@toclocoinc/lattice-grid 1.110.2 → 1.110.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/angular/package.json +1 -1
- package/docs/API.html +4 -4
- package/docs/api/adapters.html +1 -1
- package/docs/api/ai.html +1 -1
- package/docs/api/alarms.html +1 -1
- package/docs/api/calendar.html +1 -1
- package/docs/api/charts.html +1 -1
- package/docs/api/dashboard.html +1 -1
- package/docs/api/data-router.html +1 -1
- package/docs/api/dataview.html +1 -1
- package/docs/api/deckgl.html +1 -1
- package/docs/api/designer.html +1 -1
- package/docs/api/form.html +1 -1
- package/docs/api/gantt.html +1 -1
- package/docs/api/geometry.html +1 -1
- package/docs/api/grid.html +2 -2
- package/docs/api/index.html +1 -1
- package/docs/api/kanban.html +1 -1
- package/docs/api/kpi.html +1 -1
- package/docs/api/layout.html +1 -1
- package/docs/api/leaflet.html +1 -1
- package/docs/api/list.html +1 -1
- package/docs/api/listview.html +1 -1
- package/docs/api/mapview.html +1 -1
- package/docs/api/mock-socket.html +1 -1
- package/docs/api/presets.html +1 -1
- package/docs/api/scheduler.html +1 -1
- package/docs/api/shell.html +1 -1
- package/docs/api/tabs.html +1 -1
- package/docs/api/tree.html +1 -1
- package/docs/api/types.html +1 -1
- package/docs/api-detail.html +4 -4
- package/docs/warnings.json +1 -1
- package/lattice-grid.d.ts +1 -1
- package/lattice-grid.esm.min.js +2 -2
- package/lattice-grid.min.cjs +2 -2
- package/lattice-grid.min.js +2 -2
- package/locales/all.d.ts +1 -1
- package/locales/all.esm.min.js +1 -1
- package/locales/all.min.cjs +1 -1
- package/locales/all.min.js +1 -1
- package/locales/ar.d.ts +1 -1
- package/locales/ar.esm.min.js +1 -1
- package/locales/ar.min.cjs +1 -1
- package/locales/ar.min.js +1 -1
- package/locales/cs-CZ.d.ts +1 -1
- package/locales/cs-CZ.esm.min.js +1 -1
- package/locales/cs-CZ.min.cjs +1 -1
- package/locales/cs-CZ.min.js +1 -1
- package/locales/da-DK.d.ts +1 -1
- package/locales/da-DK.esm.min.js +1 -1
- package/locales/da-DK.min.cjs +1 -1
- package/locales/da-DK.min.js +1 -1
- package/locales/de-DE.d.ts +1 -1
- package/locales/de-DE.esm.min.js +1 -1
- package/locales/de-DE.min.cjs +1 -1
- package/locales/de-DE.min.js +1 -1
- package/locales/el-GR.d.ts +1 -1
- package/locales/el-GR.esm.min.js +1 -1
- package/locales/el-GR.min.cjs +1 -1
- package/locales/el-GR.min.js +1 -1
- package/locales/en-US.d.ts +1 -1
- package/locales/en-US.esm.min.js +1 -1
- package/locales/en-US.min.cjs +1 -1
- package/locales/en-US.min.js +1 -1
- package/locales/es-ES.d.ts +1 -1
- package/locales/es-ES.esm.min.js +1 -1
- package/locales/es-ES.min.cjs +1 -1
- package/locales/es-ES.min.js +1 -1
- package/locales/fi-FI.d.ts +1 -1
- package/locales/fi-FI.esm.min.js +1 -1
- package/locales/fi-FI.min.cjs +1 -1
- package/locales/fi-FI.min.js +1 -1
- package/locales/fr-CA.d.ts +1 -1
- package/locales/fr-CA.esm.min.js +1 -1
- package/locales/fr-CA.min.cjs +1 -1
- package/locales/fr-CA.min.js +1 -1
- package/locales/fr-FR.d.ts +1 -1
- package/locales/fr-FR.esm.min.js +1 -1
- package/locales/fr-FR.min.cjs +1 -1
- package/locales/fr-FR.min.js +1 -1
- package/locales/hu-HU.d.ts +1 -1
- package/locales/hu-HU.esm.min.js +1 -1
- package/locales/hu-HU.min.cjs +1 -1
- package/locales/hu-HU.min.js +1 -1
- package/locales/it-IT.d.ts +1 -1
- package/locales/it-IT.esm.min.js +1 -1
- package/locales/it-IT.min.cjs +1 -1
- package/locales/it-IT.min.js +1 -1
- package/locales/ja-JP.d.ts +1 -1
- package/locales/ja-JP.esm.min.js +1 -1
- package/locales/ja-JP.min.cjs +1 -1
- package/locales/ja-JP.min.js +1 -1
- package/locales/nb-NO.d.ts +1 -1
- package/locales/nb-NO.esm.min.js +1 -1
- package/locales/nb-NO.min.cjs +1 -1
- package/locales/nb-NO.min.js +1 -1
- package/locales/nl-NL.d.ts +1 -1
- package/locales/nl-NL.esm.min.js +1 -1
- package/locales/nl-NL.min.cjs +1 -1
- package/locales/nl-NL.min.js +1 -1
- package/locales/pl-PL.d.ts +1 -1
- package/locales/pl-PL.esm.min.js +1 -1
- package/locales/pl-PL.min.cjs +1 -1
- package/locales/pl-PL.min.js +1 -1
- package/locales/pt-BR.d.ts +1 -1
- package/locales/pt-BR.esm.min.js +1 -1
- package/locales/pt-BR.min.cjs +1 -1
- package/locales/pt-BR.min.js +1 -1
- package/locales/ro-RO.d.ts +1 -1
- package/locales/ro-RO.esm.min.js +1 -1
- package/locales/ro-RO.min.cjs +1 -1
- package/locales/ro-RO.min.js +1 -1
- package/locales/sv-SE.d.ts +1 -1
- package/locales/sv-SE.esm.min.js +1 -1
- package/locales/sv-SE.min.cjs +1 -1
- package/locales/sv-SE.min.js +1 -1
- package/locales/uk-UA.d.ts +1 -1
- package/locales/uk-UA.esm.min.js +1 -1
- package/locales/uk-UA.min.cjs +1 -1
- package/locales/uk-UA.min.js +1 -1
- package/modules/ai.d.ts +1 -1
- package/modules/ai.esm.min.js +1 -1
- package/modules/ai.min.cjs +1 -1
- package/modules/ai.min.js +1 -1
- package/modules/alarms.d.ts +1 -1
- package/modules/alarms.esm.min.js +1 -1
- package/modules/alarms.min.cjs +1 -1
- package/modules/alarms.min.js +1 -1
- package/modules/angular.d.ts +1 -1
- package/modules/angular.esm.min.js +1 -1
- package/modules/angular.min.cjs +1 -1
- package/modules/angular.min.js +1 -1
- package/modules/calendar.d.ts +1 -1
- package/modules/calendar.esm.min.js +1 -1
- package/modules/calendar.min.cjs +1 -1
- package/modules/calendar.min.js +1 -1
- package/modules/chart-alluvial.d.ts +1 -1
- package/modules/chart-alluvial.esm.min.js +1 -1
- package/modules/chart-alluvial.min.cjs +1 -1
- package/modules/chart-alluvial.min.js +1 -1
- package/modules/chart-arc.d.ts +1 -1
- package/modules/chart-arc.esm.min.js +1 -1
- package/modules/chart-arc.min.cjs +1 -1
- package/modules/chart-arc.min.js +1 -1
- package/modules/chart-barrace.d.ts +1 -1
- package/modules/chart-barrace.esm.min.js +1 -1
- package/modules/chart-barrace.min.cjs +1 -1
- package/modules/chart-barrace.min.js +1 -1
- package/modules/chart-bubblemap.d.ts +1 -1
- package/modules/chart-bubblemap.esm.min.js +1 -1
- package/modules/chart-bubblemap.min.cjs +1 -1
- package/modules/chart-bubblemap.min.js +1 -1
- package/modules/chart-bump.d.ts +1 -1
- package/modules/chart-bump.esm.min.js +1 -1
- package/modules/chart-bump.min.cjs +1 -1
- package/modules/chart-bump.min.js +1 -1
- package/modules/chart-calendar.d.ts +1 -1
- package/modules/chart-calendar.esm.min.js +1 -1
- package/modules/chart-calendar.min.cjs +1 -1
- package/modules/chart-calendar.min.js +1 -1
- package/modules/chart-choropleth.d.ts +1 -1
- package/modules/chart-choropleth.esm.min.js +1 -1
- package/modules/chart-choropleth.min.cjs +1 -1
- package/modules/chart-choropleth.min.js +1 -1
- package/modules/chart-decomposition.d.ts +1 -1
- package/modules/chart-decomposition.esm.min.js +1 -1
- package/modules/chart-decomposition.min.cjs +1 -1
- package/modules/chart-decomposition.min.js +1 -1
- package/modules/chart-diverging.d.ts +1 -1
- package/modules/chart-diverging.esm.min.js +1 -1
- package/modules/chart-diverging.min.cjs +1 -1
- package/modules/chart-diverging.min.js +1 -1
- package/modules/chart-dumbbell.d.ts +1 -1
- package/modules/chart-dumbbell.esm.min.js +1 -1
- package/modules/chart-dumbbell.min.cjs +1 -1
- package/modules/chart-dumbbell.min.js +1 -1
- package/modules/chart-fan.d.ts +1 -1
- package/modules/chart-fan.esm.min.js +1 -1
- package/modules/chart-fan.min.cjs +1 -1
- package/modules/chart-fan.min.js +1 -1
- package/modules/chart-forcetree.d.ts +1 -1
- package/modules/chart-forcetree.esm.min.js +1 -1
- package/modules/chart-forcetree.min.cjs +1 -1
- package/modules/chart-forcetree.min.js +1 -1
- package/modules/chart-hexbin.d.ts +1 -1
- package/modules/chart-hexbin.esm.min.js +1 -1
- package/modules/chart-hexbin.min.cjs +1 -1
- package/modules/chart-hexbin.min.js +1 -1
- package/modules/chart-hexmap.d.ts +1 -1
- package/modules/chart-hexmap.esm.min.js +1 -1
- package/modules/chart-hexmap.min.cjs +1 -1
- package/modules/chart-hexmap.min.js +1 -1
- package/modules/chart-icicle.d.ts +1 -1
- package/modules/chart-icicle.esm.min.js +1 -1
- package/modules/chart-icicle.min.cjs +1 -1
- package/modules/chart-icicle.min.js +1 -1
- package/modules/chart-markermap.d.ts +1 -1
- package/modules/chart-markermap.esm.min.js +1 -1
- package/modules/chart-markermap.min.cjs +1 -1
- package/modules/chart-markermap.min.js +1 -1
- package/modules/chart-motion.d.ts +1 -1
- package/modules/chart-motion.esm.min.js +1 -1
- package/modules/chart-motion.min.cjs +1 -1
- package/modules/chart-motion.min.js +1 -1
- package/modules/chart-pack.d.ts +1 -1
- package/modules/chart-pack.esm.min.js +1 -1
- package/modules/chart-pack.min.cjs +1 -1
- package/modules/chart-pack.min.js +1 -1
- package/modules/chart-parallel.d.ts +1 -1
- package/modules/chart-parallel.esm.min.js +1 -1
- package/modules/chart-parallel.min.cjs +1 -1
- package/modules/chart-parallel.min.js +1 -1
- package/modules/chart-pictorial.d.ts +1 -1
- package/modules/chart-pictorial.esm.min.js +1 -1
- package/modules/chart-pictorial.min.cjs +1 -1
- package/modules/chart-pictorial.min.js +1 -1
- package/modules/chart-polararea.d.ts +1 -1
- package/modules/chart-polararea.esm.min.js +1 -1
- package/modules/chart-polararea.min.cjs +1 -1
- package/modules/chart-polararea.min.js +1 -1
- package/modules/chart-polarscatter.d.ts +1 -1
- package/modules/chart-polarscatter.esm.min.js +1 -1
- package/modules/chart-polarscatter.min.cjs +1 -1
- package/modules/chart-polarscatter.min.js +1 -1
- package/modules/chart-pyramid.d.ts +1 -1
- package/modules/chart-pyramid.esm.min.js +1 -1
- package/modules/chart-pyramid.min.cjs +1 -1
- package/modules/chart-pyramid.min.js +1 -1
- package/modules/chart-radialbar.d.ts +1 -1
- package/modules/chart-radialbar.esm.min.js +1 -1
- package/modules/chart-radialbar.min.cjs +1 -1
- package/modules/chart-radialbar.min.js +1 -1
- package/modules/chart-ridgeline.d.ts +1 -1
- package/modules/chart-ridgeline.esm.min.js +1 -1
- package/modules/chart-ridgeline.min.cjs +1 -1
- package/modules/chart-ridgeline.min.js +1 -1
- package/modules/chart-roc.d.ts +1 -1
- package/modules/chart-roc.esm.min.js +1 -1
- package/modules/chart-roc.min.cjs +1 -1
- package/modules/chart-roc.min.js +1 -1
- package/modules/chart-scatter3d.d.ts +1 -1
- package/modules/chart-scatter3d.esm.min.js +1 -1
- package/modules/chart-scatter3d.min.cjs +1 -1
- package/modules/chart-scatter3d.min.js +1 -1
- package/modules/chart-serpentine.d.ts +1 -1
- package/modules/chart-serpentine.esm.min.js +1 -1
- package/modules/chart-serpentine.min.cjs +1 -1
- package/modules/chart-serpentine.min.js +1 -1
- package/modules/chart-slope.d.ts +1 -1
- package/modules/chart-slope.esm.min.js +1 -1
- package/modules/chart-slope.min.cjs +1 -1
- package/modules/chart-slope.min.js +1 -1
- package/modules/chart-spiral.d.ts +1 -1
- package/modules/chart-spiral.esm.min.js +1 -1
- package/modules/chart-spiral.min.cjs +1 -1
- package/modules/chart-spiral.min.js +1 -1
- package/modules/chart-splom.d.ts +1 -1
- package/modules/chart-splom.esm.min.js +1 -1
- package/modules/chart-splom.min.cjs +1 -1
- package/modules/chart-splom.min.js +1 -1
- package/modules/chart-tree.d.ts +1 -1
- package/modules/chart-tree.esm.min.js +1 -1
- package/modules/chart-tree.min.cjs +1 -1
- package/modules/chart-tree.min.js +1 -1
- package/modules/chart-venn.d.ts +1 -1
- package/modules/chart-venn.esm.min.js +1 -1
- package/modules/chart-venn.min.cjs +1 -1
- package/modules/chart-venn.min.js +1 -1
- package/modules/chart-voronoi.d.ts +1 -1
- package/modules/chart-voronoi.esm.min.js +1 -1
- package/modules/chart-voronoi.min.cjs +1 -1
- package/modules/chart-voronoi.min.js +1 -1
- package/modules/chart-waffle.d.ts +1 -1
- package/modules/chart-waffle.esm.min.js +1 -1
- package/modules/chart-waffle.min.cjs +1 -1
- package/modules/chart-waffle.min.js +1 -1
- package/modules/chart-wordcloud.d.ts +1 -1
- package/modules/chart-wordcloud.esm.min.js +1 -1
- package/modules/chart-wordcloud.min.cjs +1 -1
- package/modules/chart-wordcloud.min.js +1 -1
- package/modules/charts.d.ts +1 -1
- package/modules/charts.esm.min.js +1 -1
- package/modules/charts.min.cjs +1 -1
- package/modules/charts.min.js +1 -1
- package/modules/contextmenu.d.ts +1 -1
- package/modules/contextmenu.esm.min.js +1 -1
- package/modules/contextmenu.min.cjs +1 -1
- package/modules/contextmenu.min.js +1 -1
- package/modules/dashboard.d.ts +1 -1
- package/modules/dashboard.esm.min.js +1 -1
- package/modules/dashboard.min.cjs +1 -1
- package/modules/dashboard.min.js +1 -1
- package/modules/data-router.d.ts +1 -1
- package/modules/data-router.esm.min.js +1 -1
- package/modules/data-router.min.cjs +1 -1
- package/modules/data-router.min.js +1 -1
- package/modules/dataview.d.ts +1 -1
- package/modules/dataview.esm.min.js +1 -1
- package/modules/dataview.min.cjs +1 -1
- package/modules/dataview.min.js +1 -1
- package/modules/deckgl.d.ts +1 -1
- package/modules/deckgl.esm.min.js +1 -1
- package/modules/deckgl.min.cjs +1 -1
- package/modules/deckgl.min.js +1 -1
- package/modules/designer.d.ts +1 -1
- package/modules/designer.esm.min.js +1 -1
- package/modules/designer.min.cjs +1 -1
- package/modules/designer.min.js +1 -1
- package/modules/devtools.d.ts +1 -1
- package/modules/devtools.esm.min.js +1 -1
- package/modules/devtools.min.cjs +1 -1
- package/modules/devtools.min.js +1 -1
- package/modules/dhtmlx-compat.d.ts +1 -1
- package/modules/dhtmlx-compat.esm.min.js +1 -1
- package/modules/dhtmlx-compat.min.cjs +1 -1
- package/modules/dhtmlx-compat.min.js +1 -1
- package/modules/form.d.ts +1 -1
- package/modules/form.esm.min.js +1 -1
- package/modules/form.min.cjs +1 -1
- package/modules/form.min.js +1 -1
- package/modules/gantt.d.ts +1 -1
- package/modules/gantt.esm.min.js +1 -1
- package/modules/gantt.min.cjs +1 -1
- package/modules/gantt.min.js +1 -1
- package/modules/geo-europe-nuts.d.ts +1 -1
- package/modules/geo-europe-nuts.esm.min.js +1 -1
- package/modules/geo-europe-nuts.min.cjs +1 -1
- package/modules/geo-europe-nuts.min.js +1 -1
- package/modules/geo-uk.d.ts +1 -1
- package/modules/geo-uk.esm.min.js +1 -1
- package/modules/geo-uk.min.cjs +1 -1
- package/modules/geo-uk.min.js +1 -1
- package/modules/geo-us-states.d.ts +1 -1
- package/modules/geo-us-states.esm.min.js +1 -1
- package/modules/geo-us-states.min.cjs +1 -1
- package/modules/geo-us-states.min.js +1 -1
- package/modules/geo-world-110m.d.ts +1 -1
- package/modules/geo-world-110m.esm.min.js +1 -1
- package/modules/geo-world-110m.min.cjs +1 -1
- package/modules/geo-world-110m.min.js +1 -1
- package/modules/geo-world-50m.d.ts +1 -1
- package/modules/geo-world-50m.esm.min.js +1 -1
- package/modules/geo-world-50m.min.cjs +1 -1
- package/modules/geo-world-50m.min.js +1 -1
- package/modules/geometry.d.ts +1 -1
- package/modules/geometry.esm.min.js +1 -1
- package/modules/geometry.min.cjs +1 -1
- package/modules/geometry.min.js +1 -1
- package/modules/htmx.d.ts +1 -1
- package/modules/htmx.esm.min.js +2 -2
- package/modules/htmx.min.cjs +2 -2
- package/modules/htmx.min.js +2 -2
- package/modules/htmx.shared.esm.min.js +1 -1
- package/modules/htmx.shared.min.cjs +1 -1
- package/modules/htmx.shared.min.js +1 -1
- package/modules/kanban.d.ts +1 -1
- package/modules/kanban.esm.min.js +1 -1
- package/modules/kanban.min.cjs +1 -1
- package/modules/kanban.min.js +1 -1
- package/modules/kpi.d.ts +1 -1
- package/modules/kpi.esm.min.js +1 -1
- package/modules/kpi.min.cjs +1 -1
- package/modules/kpi.min.js +1 -1
- package/modules/layout.d.ts +1 -1
- package/modules/layout.esm.min.js +1 -1
- package/modules/layout.min.cjs +1 -1
- package/modules/layout.min.js +1 -1
- package/modules/leaflet.d.ts +1 -1
- package/modules/leaflet.esm.min.js +1 -1
- package/modules/leaflet.min.cjs +1 -1
- package/modules/leaflet.min.js +1 -1
- package/modules/list.d.ts +1 -1
- package/modules/list.esm.min.js +1 -1
- package/modules/list.min.cjs +1 -1
- package/modules/list.min.js +1 -1
- package/modules/listview.d.ts +1 -1
- package/modules/listview.esm.min.js +1 -1
- package/modules/listview.min.cjs +1 -1
- package/modules/listview.min.js +1 -1
- package/modules/mapview.d.ts +1 -1
- package/modules/mapview.esm.min.js +55 -55
- package/modules/mapview.esm.min.js.map +2 -2
- package/modules/mapview.min.cjs +55 -55
- package/modules/mapview.min.js +55 -55
- package/modules/mapview.min.js.map +2 -2
- package/modules/mock-socket.d.ts +1 -1
- package/modules/mock-socket.esm.min.js +1 -1
- package/modules/mock-socket.min.cjs +1 -1
- package/modules/mock-socket.min.js +1 -1
- package/modules/presets.d.ts +1 -1
- package/modules/presets.esm.min.js +1 -1
- package/modules/presets.min.cjs +1 -1
- package/modules/presets.min.js +1 -1
- package/modules/react.d.ts +1 -1
- package/modules/react.esm.min.js +1 -1
- package/modules/react.min.cjs +1 -1
- package/modules/react.min.js +1 -1
- package/modules/recordeditor.d.ts +1 -1
- package/modules/recordeditor.esm.min.js +1 -1
- package/modules/recordeditor.min.cjs +1 -1
- package/modules/recordeditor.min.js +1 -1
- package/modules/scheduler.d.ts +1 -1
- package/modules/scheduler.esm.min.js +1 -1
- package/modules/scheduler.min.cjs +1 -1
- package/modules/scheduler.min.js +1 -1
- package/modules/shell.d.ts +1 -1
- package/modules/shell.esm.min.js +1 -1
- package/modules/shell.min.cjs +1 -1
- package/modules/shell.min.js +1 -1
- package/modules/sidebar.d.ts +1 -1
- package/modules/sidebar.esm.min.js +1 -1
- package/modules/sidebar.min.cjs +1 -1
- package/modules/sidebar.min.js +1 -1
- package/modules/svelte.d.ts +1 -1
- package/modules/svelte.esm.min.js +1 -1
- package/modules/svelte.min.cjs +1 -1
- package/modules/svelte.min.js +1 -1
- package/modules/tabs.d.ts +1 -1
- package/modules/tabs.esm.min.js +1 -1
- package/modules/tabs.min.cjs +1 -1
- package/modules/tabs.min.js +1 -1
- package/modules/toolbar.d.ts +1 -1
- package/modules/toolbar.esm.min.js +1 -1
- package/modules/toolbar.min.cjs +1 -1
- package/modules/toolbar.min.js +1 -1
- package/modules/tree.d.ts +1 -1
- package/modules/tree.esm.min.js +1 -1
- package/modules/tree.min.cjs +1 -1
- package/modules/tree.min.js +1 -1
- package/modules/vue.d.ts +1 -1
- package/modules/vue.esm.min.js +1 -1
- package/modules/vue.min.cjs +1 -1
- package/modules/vue.min.js +1 -1
- package/modules/webcomponent.d.ts +1 -1
- package/modules/webcomponent.esm.min.js +2 -2
- package/modules/webcomponent.min.cjs +2 -2
- package/modules/webcomponent.min.js +2 -2
- package/package.json +1 -1
package/modules/htmx.esm.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.110.
|
|
2
|
+
* Lattice Grid 1.110.3, htmx module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
6
6
|
var Nr=Object.create(null),Mr=Object.create(null);function ze(e,_){Nr[e]=_}function ir(e){var _=Mr[e];if(_)return _;var ne=Object.create(null);Mr[e]=ne;var E=Nr[e];if(!E)throw new Error("[lattice] missing module: "+e);return E(ne,ir),ne}ze("packages/core/src/internal/predicates.js",function(e,_){"use strict";Object.defineProperty(e,"isObject",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"isFunction",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"isNil",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"isBlank",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"isCtor",{enumerable:!0,get:function(){return D}});function ne(J){return J!==null&&typeof J=="object"&&!Array.isArray(J)}function E(J){return typeof J=="function"}function K(J){return J==null}function U(J){return J==null||J===""}function D(J){return typeof J!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(J))?!0:!!(J.prototype&&Object.getOwnPropertyNames(J.prototype).length>1)}}),ze("packages/core/src/internal/warn.js",function(e,_){"use strict";Object.defineProperty(e,"reportedWarnings",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"warnOnce",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"infoOnce",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resetWarnings",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"fail",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"invariant",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"DEV",{enumerable:!0,get:function(){return g}});const ne=new Set,E=2e3;function K(s){if(ne.add(s),ne.size>E){const t=ne.values().next().value;t!==void 0&&ne.delete(t)}}const U=[],D=500;function J(s,t,o){U.push({key:s,level:t,message:o.map(c=>typeof c=="string"?c:z(c)).join(" "),at:Date.now()}),U.length>D&&U.shift()}function z(s){if(s instanceof Error)return s.message;try{return JSON.stringify(s)}catch{return String(s)}}function L(){return U.map(s=>({...s}))}function X(s){if(s.length===0||typeof s[0]!="string")return s;const t=s[0].replace(/^\[lattice\]\s*/,"");return t===s[0]?s:[t,...s.slice(1)]}function I(s,...t){if(ne.has(s))return;K(s);const o=X(t);J(s,"warn",o),console.warn("[lattice]",...o)}function j(s,...t){if(ne.has(s))return;K(s);const o=X(t);J(s,"info",o),console.info("[lattice]",...o)}function k(){ne.clear(),U.length=0}function y(s,t){const o=new Error(`[lattice] ${s}`);throw t!==void 0&&(o.cause=t),o}function l(s,t){s||y(t)}const g=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})()}),ze("packages/core/src/formatting/rules.js",function(e,_){"use strict";Object.defineProperty(e,"RULE_OPS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"DISTRIBUTION_OPS",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"DISTRIBUTION_LABELS",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"testRule",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"mixColour",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"summariseColumn",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"quantileOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"needsDistribution",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"resolveDistribution",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ICON_SETS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"compileRules",{enumerable:!0,get:function(){return H}});const E=_("packages/core/src/internal/predicates.js").isFunction,U=_("packages/core/src/internal/warn.js").warnOnce,D=Object.freeze(["eq","ne","gt","gte","lt","lte","between","outside","contains","notContains","startsWith","endsWith","blank","notBlank","true","false"]),J=Object.freeze(["topPercent","bottomPercent","topN","bottomN","aboveMean","belowMean","aboveMedian","belowMedian","zAbove","zBelow","outlier"]),z=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 L(T,O){const N=Number(T),P=Number(O);if(T!==null&&T!==""&&O!==null&&O!==""&&Number.isFinite(N)&&Number.isFinite(P))return N<P?-1:N>P?1:0;const B=String(T??"").toLowerCase(),x=String(O??"").toLowerCase();return B<x?-1:B>x?1:0}function X(T){return T==null||T===""}function I(T,O){if(!O||typeof O!="object")return!1;const{op:N}=O,P=O.value,C=O.value2;switch(N){case"blank":return X(T);case"notBlank":return!X(T);case"true":return T===!0;case"false":return T===!1;default:break}if(X(T))return!1;switch(N){case"eq":return L(T,P)===0;case"ne":return L(T,P)!==0;case"gt":return L(T,P)>0;case"gte":return L(T,P)>=0;case"lt":return L(T,P)<0;case"lte":return L(T,P)<=0;case"between":return L(T,P)>=0&&L(T,C)<=0;case"outside":return L(T,P)<0||L(T,C)>0;case"contains":return String(T).toLowerCase().includes(String(P??"").toLowerCase());case"notContains":return!String(T).toLowerCase().includes(String(P??"").toLowerCase());case"startsWith":return String(T).toLowerCase().startsWith(String(P??"").toLowerCase());case"endsWith":return String(T).toLowerCase().endsWith(String(P??"").toLowerCase());default:return!1}}function j(T,O,N){const P=ee=>{const te=String(ee).replace("#",""),re=te.length===3?te.split("").map(ie=>ie+ie).join(""):te;return[0,2,4].map(ie=>parseInt(re.slice(ie,ie+2),16)||0)},[C,B,x]=P(T),[V,Y,F]=P(O),$=Math.max(0,Math.min(1,N)),q=(ee,te)=>Math.round(ee+(te-ee)*$);return`#${[q(C,V),q(B,Y),q(x,F)].map(ee=>ee.toString(16).padStart(2,"0")).join("")}`}function k(T){const O=[];for(const V of T||[]){if(V==null||V==="")continue;const Y=V instanceof Date?V.getTime():Number(V);Number.isFinite(Y)&&O.push(Y)}if(!O.length)return null;O.sort((V,Y)=>V-Y);let N=0,P=0,C=0;for(const V of O){N++;const Y=V-P;P+=Y/N,C+=Y*(V-P)}const B=y(O,.25),x=y(O,.75);return{n:O.length,min:O[0],max:O[O.length-1],mean:P,stddev:O.length>1?Math.sqrt(C/(O.length-1)):0,median:y(O,.5),q1:B,q3:x,iqr:x-B,sorted:O}}function y(T,O){if(!T.length)return 0;const N=(T.length-1)*Math.max(0,Math.min(1,O)),P=Math.floor(N),C=Math.ceil(N);return P===C?T[P]:T[P]+(N-P)*(T[C]-T[P])}function l(T){for(const O of Array.isArray(T)?T:[])if(!(!O||typeof O!="object")&&(O.when&&J.includes(O.when.op)||O.scale&&O.scale.from||O.dataBar&&!(Number.isFinite(Number(O.dataBar.min))&&Number.isFinite(Number(O.dataBar.max)))||O.iconSet&&!Array.isArray(O.iconSet.thresholds)))return!0;return!1}function g(T,O){const N=Number(T.value),P=C=>y(O.sorted,C);switch(T.op){case"topPercent":{const C=s(N,10);return{op:"gte",value:P(1-C)}}case"bottomPercent":{const C=s(N,10);return{op:"lte",value:P(C)}}case"topN":{const C=Math.max(1,Math.floor(N)||1),B=Math.max(0,O.sorted.length-C);return{op:"gte",value:O.sorted[B]}}case"bottomN":{const C=Math.max(1,Math.floor(N)||1),B=Math.min(O.sorted.length-1,C-1);return{op:"lte",value:O.sorted[B]}}case"aboveMean":return{op:"gt",value:O.mean};case"belowMean":return{op:"lt",value:O.mean};case"aboveMedian":return{op:"gt",value:O.median};case"belowMedian":return{op:"lt",value:O.median};case"zAbove":return O.stddev?{op:"gte",value:O.mean+(Number.isFinite(N)?N:2)*O.stddev}:null;case"zBelow":return O.stddev?{op:"lte",value:O.mean-(Number.isFinite(N)?N:2)*O.stddev}:null;case"outlier":{const C=(Number.isFinite(N)&&N>0?N:1.5)*O.iqr;return O.iqr?{op:"outside",value:O.q1-C,value2:O.q3+C}:null}default:return null}}function s(T,O){const N=Number.isFinite(T)?T:O,P=N>1?N/100:N;return Math.max(0,Math.min(1,P))}function t(T,O){if(T.from==="minmax")return{...T,min:O.min,max:O.max};if(T.from==="quantile")return{...T,min:y(O.sorted,s(Number(T.low),5)),max:y(O.sorted,s(Number(T.high),95))};if(T.from==="stddev"){const N=Number.isFinite(Number(T.deviations))?Number(T.deviations):2;return{...T,min:O.mean-N*O.stddev,max:O.mean+N*O.stddev}}return T}function o(T,O){const N=Array.isArray(T)?T:[];return!O||!O.n?N.map(P=>P&&l([P])?{...P,enabled:!1}:P):N.map(P=>{if(!P||typeof P!="object")return P;if(P.scale&&P.scale.from)return{...P,scale:t(P.scale,O)};if(P.dataBar)return{...P,dataBar:c(P.dataBar,O)};if(P.iconSet)return{...P,iconSet:d(P.iconSet,O)};if(!P.when||!J.includes(P.when.op))return P;const C=g(P.when,O);return C?{...P,when:C}:{...P,enabled:!1}})}function c(T,O){const N=Number.isFinite(Number(T.min))?Number(T.min):void 0,P=Number.isFinite(Number(T.max))?Number(T.max):void 0;if(N!==void 0&&P!==void 0)return{...T,min:N,max:P};if(T.from==="quantile")return{...T,min:N??y(O.sorted,s(Number(T.low),5)),max:P??y(O.sorted,s(Number(T.high),95))};if(T.from==="stddev"){const C=Number.isFinite(Number(T.deviations))?Number(T.deviations):2;return{...T,min:N??O.mean-C*O.stddev,max:P??O.mean+C*O.stddev}}return{...T,min:N??O.min,max:P??O.max}}function d(T,O){if(Array.isArray(T.thresholds))return T;const N=n(T),P=[];for(let C=1;C<N;C++)P.push(y(O.sorted,C/N));return{...T,thresholds:P}}function n(T){if(Array.isArray(T.icons)&&T.icons.length>=2)return T.icons.length;if(Number.isFinite(Number(T.count))&&Number(T.count)>=2)return Math.floor(Number(T.count));const O=b[T.set];return O?O.length:3}function p(T){return`url("data:image/svg+xml,${encodeURIComponent(T)}")`}function i(T){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="${T}"/></svg>`}function r(T,O){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><polygon points="${O==="up"?"8,2 14,13 2,13":O==="down"?"2,3 14,3 8,14":"4,2 14,8 4,14"}" fill="${T}"/></svg>`}function f(T,O){const N="M8 1l1.9 3.9 4.3.6-3.1 3 .7 4.3L8 13.8 4.2 15.8l.7-4.3-3.1-3 4.3-.6z";let P=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${O*16} 16">`;for(let C=0;C<O;C++){const B=C<T?"#f5a623":"#d0d0d0";P+=`<path transform="translate(${C*16},0)" d="${N}" fill="${B}"/>`}return`${P}</svg>`}const m=Object.freeze([r("#c0392b","down"),r("#e0a800","right"),r("#2e7d32","up")]),u=Object.freeze([i("#d13438"),i("#f5a623"),i("#2e9e44")]),b=Object.freeze({arrows:m,trafficLights:u,ratings:Object.freeze([1,2,3,4,5].map(T=>f(T,5)))}),a=Object.freeze({arrows:"Arrows",trafficLights:"Traffic lights",ratings:"Ratings"});function h(T){if(Array.isArray(T.icons)&&T.icons.length>=2)return T.icons.map(P=>/^\s*(url\(|data:|<)/.test(String(P))&&String(P).trim().startsWith("<")?p(String(P)):String(P));const O=T.set||"arrows";if(O==="ratings"){const P=n(T),C=[];for(let B=1;B<=P;B++)C.push(p(f(B,P)));return C}const N=b[O];return N?N.map(p):(U(`iconSet:${O}`,`unknown icon set '${O}'; falling back to arrows.`),m.map(p))}function w(T){const O=Number(T.min),P=Number(T.max)-O,C=T.colour||T.color||"#5b9bd5",B=T.negativeColour||T.negativeColor||"#d13438",x=T.direction==="rtl"?"left":"right",V=F=>Math.max(0,Math.min(1,(F-O)/P))*100,Y=P?Math.max(0,Math.min(100,(0-O)/P*100)):0;return F=>{if(X(F))return null;const $=Number(F);if(!Number.isFinite($)||!P)return null;const q=V($),ee=Math.min(q,Y),te=Math.max(q,Y),re=$>=0?C:B;return{backgroundImage:`linear-gradient(to ${x}, transparent ${ee}%, ${re} ${ee}%, ${re} ${te}%, transparent ${te}%)`,backgroundRepeat:"no-repeat",backgroundPosition:"0 0"}}}function v(T){const O=h(T),N=T.reverse?[...O].reverse():O,P=(Array.isArray(T.thresholds)?T.thresholds:[]).map(Number).filter(Number.isFinite),C=Number.isFinite(Number(T.size))?Number(T.size):16,B=T.set==="ratings"?C*n(T):C;return x=>{if(X(x))return null;const V=Number(x);if(!Number.isFinite(V))return null;let Y=0;for(const $ of P)V>=$&&Y++;const F=N[Math.min(Y,N.length-1)];return F?{backgroundImage:F,backgroundRepeat:"no-repeat",backgroundPosition:"left center",backgroundSize:`${B}px ${C}px`,paddingLeft:`${B+4}px`}:null}}function A(T){const O=Array.isArray(T.colours)&&T.colours.length>=2?T.colours:["#f8f9fa","#1a6bc7"],N=Number(T.min),P=Number(T.max),C=P-N,B=O.length-1,x=[];for(let Y=0;Y<=B;Y++)x.push(B?Y/B:0);const V=Number(T.mid);if(T.mid!==void 0&&T.mid!==null)if(O.length%2===0)U("formatting.scale.mid.even",`a scale's "mid" needs an odd number of colours (a middle stop to pin); ${O.length} were given, so "mid" was ignored.`);else if(Number.isFinite(V)&&C&&V>Math.min(N,P)&&V<Math.max(N,P)){const Y=B/2,F=Math.max(0,Math.min(1,(V-N)/C));for(let $=0;$<=B;$++)x[$]=$<=Y?Y?$/Y*F:F:F+($-Y)/(B-Y)*(1-F)}else Number.isFinite(V)&&U("formatting.scale.mid.range",`a scale's "mid" (${V}) is outside its min..max range, so it was ignored.`);return Y=>{const F=Number(Y);if(!Number.isFinite(F)||!C)return null;const $=Math.max(0,Math.min(1,(F-N)/C));let q=0;for(;q<B-1&&$>x[q+1];)q++;const ee=x[q+1]-x[q],te=ee>0?($-x[q])/ee:0;return{background:j(O[q],O[q+1],Math.max(0,Math.min(1,te)))}}}function H(T,O=null){const N=l(T)?o(T,O):T,P=(Array.isArray(N)?N:[]).filter(x=>x&&typeof x=="object");if(!P.length)return()=>null;const C=P.map(x=>x.scale?{scale:A(x.scale),enabled:x.enabled!==!1}:x.dataBar?{scale:w(x.dataBar),enabled:x.enabled!==!1}:x.iconSet?{scale:v(x.iconSet),enabled:x.enabled!==!1}:{when:x.when,style:x.style,stop:x.stopIfTrue!==!1,enabled:x.enabled!==!1}),B=G(C)?S():null;return(x,V)=>{const Y=x?x.value:void 0;let F=null;V&&(V.mode=0);for(const $ of C){if(!$.enabled)continue;if($.scale){const te=$.scale(Y);te&&(F={...F||{},...te});continue}if(!I(Y,$.when))continue;let q;const ee=E($.style);if(ee?V&&B?(q=$.style(B.enter(x)),B.mode>V.mode&&(V.mode=B.mode)):q=$.style(x):q=$.style,q&&(F=F?{...F,...q}:ee?q:{...q}),$.stop)break}return F}}function G(T){return T.some(O=>O.enabled&&!O.scale&&E(O.style))}const Z=new Set(["value","colId","column"]),M=new Set(["row","data","index"]);function S(){let T={};const O={mode:0,enter(C){return T=C||{},O.mode=0,P}},N=C=>{if(Z.has(C))return;const B=M.has(C)?1:2;B>O.mode&&(O.mode=B)},P=new Proxy({},{get(C,B){return N(B),T[B]},has(C,B){return N(B),B in T},set(C,B,x){return O.mode=2,T[B]=x,!0},ownKeys(){return O.mode=2,Reflect.ownKeys(T)},getOwnPropertyDescriptor(C,B){O.mode=2;const x=Object.getOwnPropertyDescriptor(T,B);return x?{value:T[B],enumerable:x.enumerable,configurable:!0,writable:!0}:void 0}});return O}}),ze("packages/core/src/formula/parse.js",function(e,_){"use strict";Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return o}});const ne="num",E="str",K="ref",U="name",D="op",J="end",z=["<=",">=","<>","!="],L="+-*/^%(),<>=";class X extends Error{constructor(d,n){super(d),this.name="FormulaError",this.at=n}}function I(c){const d=[];let n=0;for(;n<c.length;){const p=c[n];if(p===" "||p===" "||p===`
|
|
7
|
-
`||p==="\r"){n++;continue}if(p>="0"&&p<="9"){n=k(c,n,d);continue}if(p==="."&&c[n+1]>="0"&&c[n+1]<="9"){n=k(c,n,d);continue}if(p==='"'||p==="'"){n=y(c,n,d);continue}if(p==="["){const r=c.indexOf("]",n+1);if(r<0)throw new X("a [column reference] was opened and never closed",n);d.push({kind:K,value:c.slice(n+1,r).trim(),at:n}),n=r+1;continue}if(j(p)){n=l(c,n,d);continue}const i=c.slice(n,n+2);if(z.includes(i)){d.push({kind:D,value:i==="!="?"<>":i,at:n}),n+=2;continue}if(L.includes(p)){d.push({kind:D,value:p,at:n}),n++;continue}throw new X(`unexpected character ${JSON.stringify(p)}`,n)}return d.push({kind:J,value:null,at:c.length}),d}function j(c){return/[A-Za-z_À-]/.test(c)}function k(c,d,n){let p=d,i=!1;for(;p<c.length;){const r=c[p];if(r>="0"&&r<="9"){p++;continue}if(r==="."&&!i){i=!0,p++;continue}if((r==="e"||r==="E")&&/[0-9+-]/.test(c[p+1]||"")){for(p+=2;p<c.length&&c[p]>="0"&&c[p]<="9";)p++;break}break}return n.push({kind:ne,value:Number(c.slice(d,p)),at:d}),p}function y(c,d,n){const p=c[d];let i=d+1,r="";for(;i<c.length;){if(c[i]===p){if(c[i+1]===p){r+=p,i+=2;continue}return n.push({kind:E,value:r,at:d}),i+1}r+=c[i],i++}throw new X("a string was opened and never closed",d)}function l(c,d,n){let p=d;for(;p<c.length&&/[A-Za-z0-9_.À-]/.test(c[p]);)p++;const i=c.slice(d,p);let r=p;for(;r<c.length&&c[r]===" ";)r++;return n.push({kind:c[r]==="("?U:K,value:i,at:d}),p}const g={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function s(c){const d=String(c??"").replace(/^\s*=/,"");if(!d.trim())throw new X("the formula is empty");const n=I(d);let p=0;const i=()=>n[p],r=()=>n[p++],f=v=>{const A=i();if(A.kind!==D||A.value!==v)throw new X(`expected ${JSON.stringify(v)}`,A.at);p++},m=v=>{let A=u();for(;;){const H=i();if(H.kind!==D)break;const G=g[H.value];if(!G||G<v)break;p++;const Z=m(H.value==="^"?G:G+1);A={kind:"bin",op:H.value,left:A,right:Z}}return A},u=()=>{const v=i();return v.kind===D&&(v.value==="-"||v.value==="+")?(p++,{kind:"unary",op:v.value,arg:u()}):b()},b=()=>{let v=a();for(;i().kind===D&&i().value==="%";)p++,v={kind:"unary",op:"%",arg:v};return v},a=()=>{const v=r();if(v.kind===ne)return{kind:"num",value:v.value};if(v.kind===E)return{kind:"str",value:v.value};if(v.kind===K)return{kind:"ref",name:v.value};if(v.kind===U){f("(");const A=[];if(!(i().kind===D&&i().value===")"))for(;;){if(A.push(m(1)),i().kind===D&&i().value===","){p++;continue}break}return f(")"),{kind:"call",name:String(v.value).toUpperCase(),args:A}}if(v.kind===D&&v.value==="("){const A=m(1);return f(")"),A}throw v.kind===J?new X("the formula ends unexpectedly",v.at):new X(`unexpected ${JSON.stringify(v.value)}`,v.at)},h=m(1),w=i();if(w.kind!==J)throw new X(`unexpected ${JSON.stringify(w.value)}: is an operator missing?`,w.at);return h}function t(c){const d=new Set,n=p=>{if(!(!p||typeof p!="object")){if(p.kind==="ref"){d.add(String(p.name));return}if(p.kind==="bin"){n(p.left),n(p.right);return}if(p.kind==="unary"){n(p.arg);return}if(p.kind==="call")for(const i of p.args)n(i)}};return n(c),[...d]}function o(c){return typeof c=="string"&&/^\s*=/.test(c)&&c.trim()!=="="}}),ze("packages/core/src/formula/evaluate.js",function(e,_){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return k}});const E=_("packages/core/src/formula/parse.js").FormulaError;function K(y){if(y==null||y==="")return 0;if(typeof y=="boolean")return y?1:0;if(y instanceof Date)return y.getTime();const l=typeof y=="number"?y:Number(String(y).replace(/[,\s]/g,""));if(!Number.isFinite(l))throw new E(`${JSON.stringify(y)} is not a number`);return l}function U(y){return y==null?"":String(y)}function D(y){if(typeof y=="boolean")return y;if(y==null||y==="")return!1;if(typeof y=="number")return y!==0;const l=String(y).trim().toLowerCase();return l==="false"||l==="no"||l==="0"?!1:l!==""}function J(y){const l=[];for(const g of y){if(Array.isArray(g)){for(const s of g)s!=null&&s!==""&&l.push(K(s));continue}g==null||g===""||l.push(K(g))}return l}function z(y,l){const g=10**l,s=y*g;return Math.sign(s)*Math.round(Math.abs(s)+Number.EPSILON*Math.abs(s))/g}function L(y,l){if(!y.length)return 0;const g=y.slice().sort((c,d)=>c-d),s=(g.length-1)*Math.min(1,Math.max(0,l)),t=Math.floor(s),o=Math.ceil(s);return t===o?g[t]:g[t]+(s-t)*(g[o]-g[t])}function X(y,l){let g=0,s=0,t=0;for(const c of y){g++;const d=c-s;s+=d/g,t+=d*(c-s)}const o=l?g-1:g;return o>0?Math.sqrt(t/o):0}const I={SUM:y=>J(y).reduce((l,g)=>l+g,0),AVERAGE:y=>{const l=J(y);return l.length?l.reduce((g,s)=>g+s,0)/l.length:0},MIN:y=>{const l=J(y);return l.length?Math.min(...l):0},MAX:y=>{const l=J(y);return l.length?Math.max(...l):0},COUNT:y=>J(y).length,PRODUCT:y=>J(y).reduce((l,g)=>l*g,1),ROUND:y=>z(K(y[0]),y.length>1?K(y[1]):0),ROUNDDOWN:y=>{const l=10**(y.length>1?K(y[1]):0),g=K(y[0])*l;return(g<0?Math.ceil(g):Math.floor(g))/l},ROUNDUP:y=>{const l=10**(y.length>1?K(y[1]):0),g=K(y[0])*l;return(g<0?Math.floor(g):Math.ceil(g))/l},ABS:y=>Math.abs(K(y[0])),FLOOR:y=>Math.floor(K(y[0])),CEILING:y=>Math.ceil(K(y[0])),SQRT:y=>Math.sqrt(K(y[0])),POWER:y=>K(y[0])**K(y[1]),MOD:y=>{const l=K(y[1]);if(l===0)throw new E("MOD by zero");return(K(y[0])%l+l)%l},IF:y=>D(y[0])?y[1]:y.length>2?y[2]:!1,AND:y=>y.every(D),OR:y=>y.some(D),NOT:y=>!D(y[0]),COALESCE:y=>y.find(l=>l!=null&&l!=="")??null,CONCAT:y=>y.map(U).join(""),LEN:y=>U(y[0]).length,UPPER:y=>U(y[0]).toUpperCase(),LOWER:y=>U(y[0]).toLowerCase(),TRIM:y=>U(y[0]).trim(),LEFT:y=>U(y[0]).slice(0,y.length>1?K(y[1]):1),RIGHT:y=>{const l=y.length>1?K(y[1]):1;return l<=0?"":U(y[0]).slice(-l)},MEDIAN:y=>L(J(y),.5),PERCENTILE:y=>{const l=K(y[y.length-1]);return L(J(y.slice(0,-1)),l>1?l/100:l)},QUARTILE1:y=>L(J(y),.25),QUARTILE3:y=>L(J(y),.75),STDEV:y=>X(J(y),!0),STDEVP:y=>X(J(y),!1),VAR:y=>{const l=X(J(y),!0);return l*l},VARP:y=>{const l=X(J(y),!1);return l*l},COUNTDISTINCT:y=>{const l=new Set;for(const g of y){const s=Array.isArray(g)?g:[g];for(const t of s)t!=null&&t!==""&&l.add(t)}return l.size},IQR:y=>{const l=J(y);return L(l,.75)-L(l,.25)}};I.AVG=I.AVERAGE,I.CEIL=I.CEILING,I.POW=I.POWER,I.STDEVS=I.STDEV,I.PERCENTILEINC=I.PERCENTILE;function j(y,l){const g=Number(y),s=Number(l);if(y!==null&&y!==""&&l!==null&&l!==""&&Number.isFinite(g)&&Number.isFinite(s))return g<s?-1:g>s?1:0;const o=U(y).toLowerCase(),c=U(l).toLowerCase();return o<c?-1:o>c?1:0}function k(y,l={}){const g=typeof l.lookup=="function"?l.lookup:null,s=l.functions?{...I,...l.functions}:I,t=o=>{switch(o.kind){case"num":return o.value;case"str":return o.value;case"ref":{if(!g)throw new E(`there is no column called ${JSON.stringify(o.name)} here`);const c=g(String(o.name));if(c===void 0)throw new E(`there is no column called ${JSON.stringify(o.name)}`);return c}case"unary":{if(o.op==="%")return K(t(o.arg))/100;const c=K(t(o.arg));return o.op==="-"?-c:c}case"bin":{const c=o.op;if(c==="=")return j(t(o.left),t(o.right))===0;if(c==="<>")return j(t(o.left),t(o.right))!==0;if(c==="<")return j(t(o.left),t(o.right))<0;if(c==="<=")return j(t(o.left),t(o.right))<=0;if(c===">")return j(t(o.left),t(o.right))>0;if(c===">=")return j(t(o.left),t(o.right))>=0;const d=K(t(o.left)),n=K(t(o.right));if(c==="+")return d+n;if(c==="-")return d-n;if(c==="*")return d*n;if(c==="^")return d**n;if(c==="/"){if(n===0)throw new E("division by zero");return d/n}throw new E(`unknown operator ${JSON.stringify(c)}`)}case"call":{const c=l.lazy&&l.lazy[o.name];if(typeof c=="function")return c(o.args,t,l);const d=s[o.name];if(typeof d!="function")throw new E(`there is no function called ${o.name}`);return d(o.args.map(t),l)}default:throw new E("the formula could not be read")}};return t(y)}}),ze("packages/core/src/formula/index.js",function(e,_){"use strict";Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return j}});const ne=_("packages/core/src/formula/parse.js"),E=ne.parseFormula,K=ne.referencesOf,U=ne.looksLikeFormula,D=ne.FormulaError,J=ne.tokenise,z=_("packages/core/src/formula/evaluate.js"),L=z.evaluateAst,X=z.FUNCTIONS;function I(k){const{grid:y,row:l,data:g}=k||{},s=n=>String(n).toLowerCase().replace(/[\s_-]/g,""),t=y&&y.columns&&typeof y.columns.all=="function"?y.columns.all():[],o=y&&y.permissions,c=o&&typeof o.isReadable=="function"?n=>o.isReadable(n):()=>!0,d=new Set;for(const n of t)c(n)||(d.add(s(n.id)),n.field&&d.add(s(n.field)),n.title&&d.add(s(n.title)));return n=>{const p=s(n);if(d.has(p))throw new D(`"${n}" cannot be read`);for(const i of t)if(s(i.id)===p||i.field&&s(i.field)===p||i.title&&s(i.title)===p)return l&&y.rows&&typeof y.rows.value=="function"?y.rows.value(l.key,i.id):g?g[i.field||i.id]:void 0;if(g&&typeof g=="object"){for(const i of Object.keys(g))if(s(i)===p){if(!c(i))throw new D(`"${n}" cannot be read`);return g[i]}}}}function j(k,y={}){try{const l=E(k);return{ok:!0,value:L(l,{lookup:I(y),functions:y.formulaFunctions}),references:K(l)}}catch(l){return{ok:!1,error:l instanceof D?l.message:"the formula could not be read",at:l instanceof D?l.at:void 0}}}}),ze("packages/core/src/internal/version.js",function(e,_){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return K}});const ne="1.110.2";async function E(){return ne}const K="1.110.2"}),ze("packages/core/src/internal/merge.js",function(e,_){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"mergeRow",{enumerable:!0,get:function(){return z}});const E=_("packages/core/src/internal/predicates.js").isObject;function K(L,X,I){if(L!==void 0)return L===!0?{enabled:!0,...I}:L===!1?{enabled:!1}:E(L)?L:{[X]:L,enabled:!0}}function U(L){return L==null?[]:Array.isArray(L)?L:[L]}const D=Object.freeze(new Set(["__proto__","constructor","prototype"]));function J(L,X){if(!E(L))return E(X)?{...X}:X;if(!E(X))return X===void 0?L:X;const I={...L};for(const j of Object.keys(X)){if(D.has(j))continue;const k=X[j];k!==void 0&&(I[j]=E(k)&&E(I[j])?J(I[j],k):k)}return I}function z(L,X){if(!E(L)||!E(X)||L===X)return X;const I=Object.create(Object.getPrototypeOf(L));return Object.assign(I,L,X),I}}),ze("packages/core/src/internal/schedule.js",function(e,_){"use strict";Object.defineProperty(e,"now",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"nextFrame",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return z}});function ne(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const E=typeof requestAnimationFrame=="function";function K(L){return E?requestAnimationFrame(L):setTimeout(()=>L(ne()),16)}function U(L){L!=null&&(E?cancelAnimationFrame(L):clearTimeout(L))}function D(L){let X=null,I=null;const j=()=>{X=null;const y=I;I=null,L(...y||[])},k=(...y)=>{I=y,X===null&&(X=K(j))};return k.cancel=()=>{U(X),X=null,I=null},k.flush=()=>{X!==null&&(U(X),j())},k}function J(L,X){let I=null,j=null;const k=()=>{if(I=null,j===null)return;const g=j;j=null,L(...g),y()},y=()=>{I=setTimeout(k,X),typeof I?.unref=="function"&&I.unref()},l=(...g)=>{I===null?(L(...g),y()):(j=g,clearTimeout(I),y())};return l.flush=()=>{if(I!==null&&clearTimeout(I),I=null,j===null)return;const g=j;j=null,L(...g)},l.cancel=()=>{I!==null&&clearTimeout(I),I=null,j=null},l.pending=()=>I!==null||j!==null,l}function z(L,X=50){return typeof requestIdleCallback=="function"?requestIdleCallback(L,{timeout:X}):setTimeout(()=>L({timeRemaining:()=>0,didTimeout:!0}),1)}}),ze("packages/core/src/internal/paths.js",function(e,_){"use strict";Object.defineProperty(e,"pathGetter",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"pathSetter",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"getPath",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return J}});const ne=new Map;function E(z){let L=ne.get(z);if(L)return L;if(!z.includes("."))L=X=>X?.[z];else{const X=z.split("."),I=X.length;L=j=>{let k=j;for(let y=0;y<I;y++){if(k==null)return;k=k[X[y]]}return k}}return ne.set(z,L),L}const K=new Map;function U(z){let L=K.get(z);if(L)return L;if(!z.includes("."))L=(X,I)=>{X!=null&&(X[z]=I)};else{const X=z.split("."),I=X.length-1;L=(j,k)=>{let y=j;for(let l=0;l<I;l++){if(y==null)return;const g=X[l];y[g]==null&&(y[g]={}),y=y[g]}y!=null&&(y[X[I]]=k)}}return K.set(z,L),L}function D(z,L){return E(L)(z)}function J(z,L,X){U(L)(z,X)}}),ze("packages/core/src/internal/compare.js",function(e,_){"use strict";Object.defineProperty(e,"collator",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"defaultCompare",{enumerable:!0,get:function(){return K}});const ne=new Map;function E(U,D){const J=`${U||""}|${D?JSON.stringify(D):""}`;let z=ne.get(J);return z||(z=new Intl.Collator(U||void 0,{numeric:!0,sensitivity:"variant",...D}),ne.set(J,z)),z}function K(U,D){if(U===D)return 0;if(U==null)return 1;if(D==null)return-1;if(typeof U=="number"&&typeof D=="number")return Number.isNaN(U)?Number.isNaN(D)?0:1:Number.isNaN(D)||U<D?-1:U>D?1:0;const J=String(U),z=String(D);return J<z?-1:J>z?1:0}}),ze("packages/core/src/defaults.js",function(e,_){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return j}});const E=_("packages/core/src/internal/predicates.js").isObject,U=_("packages/core/src/internal/merge.js").merge,J=_("packages/core/src/internal/warn.js").warnOnce;let z=null;class L extends Error{}function X(k,y=new Set){if(Array.isArray(k)){if(y.has(k))throw new L;y.add(k);const g=k.map(s=>X(s,y));return y.delete(k),g}if(!E(k)||Object.getPrototypeOf(k)!==Object.prototype&&Object.getPrototypeOf(k)!==null)return k;if(y.has(k))throw new L;y.add(k);const l={};for(const[g,s]of Object.entries(k))l[g]=X(s,y);return y.delete(k),l}function I(k){if(k===void 0)return X(z??{});if(k===null)return z=null,{};if(!E(k))return J("defaults:type",`defaults() expects a configuration object, or null to clear it, but got ${Array.isArray(k)?"an array":typeof k}. The call was ignored and the defaults are unchanged.`),X(z??{});try{z=X(k)}catch(y){if(!(y instanceof L))throw y;return J("defaults:cyclic","defaults() expects a configuration object with no circular references, but the object passed refers back to itself. The call was ignored and the defaults are unchanged."),X(z??{})}return X(z)}function j(k){return z===null?k:U(X(z),k)}}),ze("packages/core/src/internal/uid.js",function(e,_){"use strict";Object.defineProperty(e,"uid",{enumerable:!0,get:function(){return E}});let ne=0;function E(K="l"){return`${K}${(++ne).toString(36)}`}}),ze("packages/core/src/events/names.js",function(e,_){"use strict";Object.defineProperty(e,"EVENT_NAMES",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"isKnownEvent",{enumerable:!0,get:function(){return K}});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","beforeRowDrop","rowDrop:cancelled","rowDrop","cell:changed","cell:pending","cell:confirmed","cell:reverted","cell:conflict","cell:clicked","cell:dblclicked","cell:contextmenu","cell:mouseover","cell:mouseout","cell:mousedown","cell:mouseup","cell:edit:start","cell:edit:end","row:edit:start","row:edit:end","row:clicked","row:dblclicked","row:pending","row:confirmed","row:reverted","row:conflict","form:opened","form:closed","form:saved","form:error","sort:changed","filter:changed","group:toggled","facet:computed","facet:filtered","facet:expanded","facet:failed","column:moved","column:resized","column:visible","column:pinned","column:grouped","column:pivoted","column:filter:open","column:profile:open","column:compareGroups:open","column:menu:open","explain:open","columns:changed","columns:tagged","columngroup:changed","header:contextmenu","totals:contextmenu","pivot:drill","selection:changed","range:changed","clipboard:copy","page:changed","scroll","scroll:end","size:changed","detail:toggled","detail:cell:edit:start","detail:cell:edit:end","detail:row:edit:start","detail:row:edit:end","detail:cell:changed","toolpanel:focus","highlight:changed","find:changed","tree:loading","tree:loaded","tree:loadFailed","tree:loadAborted","state:changed","state:reset","history:changed","history:applied","views:changed","view:applied","view:saved","view:removed","view:renamed","view:default","validation:failed","validation:cleared","formatting:changed","redaction:changed","permissions:changed","presentation:changed","presentation:started","presentation:ended","presentation:view","presentation:scale","presentation:spotlight","presentation:captured","comment:added","comment:edited","comment:deleted","comment:failed","comment:resolved","comment:unresolved","comment:threadOpened","comment:threadClosed","comment:indexLoaded","presence:published","presence:joined","presence:updated","presence:left","presence:failed","presence:lockRefused","diff:changed","diff:swapped","timeline:attached","timeline:detached","timeline:seek","timeline:seeking","annotation:changed","export:progress","export:request","export:done","shortcuts:opened","shortcuts:closed","print:before","print:after","beforeEdit","beforeSort","beforeFilter","beforeColumnMove","beforeColumnResize","beforeColumnHide","beforeSelect","beforeRowAdd","beforeDelete","beforeRowMove","beforeGroup","beforeRowReceive","edit:cancelled","sort:cancelled","filter:cancelled","columnMove:cancelled","columnResize:cancelled","columnHide:cancelled","selection:cancelled","rowAdd:cancelled","delete:cancelled","rowMove:cancelled","group:cancelled","rowReceive:cancelled"]),E=new Set(ne);function K(U){return U==="*"||E.has(U)}}),ze("packages/core/src/events/bus.js",function(e,_){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return g}});const ne=_("packages/core/src/internal/warn.js"),E=ne.warnOnce,K=ne.DEV,D=_("packages/core/src/internal/uid.js").uid,z=_("packages/core/src/events/names.js").isKnownEvent,L="*";function X(s,t){!K||z(t)||E(`bus.unknown:${t}`,`${s}('${t}') subscribes to an event the grid never raises, so the handler will never fire. Check the name against the EventName list — a common cause is a near miss such as 'row:click' for 'row:clicked'.`)}const I=new Set(["api","user","init","ai"]),j=new WeakMap;function k(s){let t=j.get(s);return t||(t=D("h"),j.set(s,t)),t}function y(){return typeof performance=="object"&&performance?performance.now():Date.now()}function l(s){if(!s||typeof s!="object")return{};const t={};for(const[o,c]of Object.entries(s))o!=="grid"&&(c==null?t[o]=String(c):Array.isArray(c)?t[o]=`[${c.length}]`:typeof c=="object"?t[o]=c.key?`row ${c.key}`:"{…}":typeof c=="function"?t[o]="[function]":t[o]=String(c).slice(0,60));return t}class g{#e=new Map;#t=!1;#n=[];#r=200;#s=new Map;#i=null;#o=!1;#l=0;constructor(t=null){this.#i=t}attach(t){this.#i=t}get grid(){return this.#i}get destroyed(){return this.#o}on(t,o){if(typeof o!="function")return E(`bus.handler:${t}`,`on('${t}') needs a function; ignored.`),()=>{};X("on",t);let c=this.#e.get(t);return c||(c=[],this.#e.set(t,c)),c.push(o),()=>this.off(t,o)}once(t,o){if(typeof o!="function")return E(`bus.handler:${t}`,`once('${t}') needs a function; ignored.`),()=>{};X("once",t);const c=d=>{this.off(t,o),o(d)};return this.#s.set(o,c),this.on(t,c)}off(t,o){if(o===void 0){this.#e.delete(t);return}const c=this.#e.get(t);if(!c)return;const d=this.#s.get(o),n=d&&c.includes(d)?d:o,p=c.indexOf(n);p>=0&&c.splice(p,1),d&&n===d&&this.#s.delete(o),c.length===0&&this.#e.delete(t)}count(t){const o=this.#e.get(t),c=t===L?null:this.#e.get(L);return(o?o.length:0)+(c?c.length:0)}#a(t,o,c,d,n){this.#n.push({type:t,origin:o,listeners:(d?d.length:0)+(n?n.length:0),payload:l(c),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(t,o){this.#t=!!t,Number.isFinite(o)&&o>0&&(this.#r=Math.floor(o)),t||(this.#n=[])}eventLog(){return this.#n.map(t=>({...t}))}clearEventLog(){this.#n=[]}counts(){const t={};for(const[o,c]of this.#e)t[o]=c.length;return t}emit(t,o,c){const d=c??(o&&o.origin),n=I.has(d)?d:"api",p={...o||null,type:t,origin:n,grid:this.#i};if(this.#o)return p;const i=this.#e.get(t),r=t===L?void 0:this.#e.get(L);if(this.#t&&this.#a(t,n,o,i,r),!i&&!r)return p;const f=this.#t?y():0;this.#l++;try{i&&this.#c(i.slice(),p,t),r&&this.#c(r.slice(),p,L)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=y()-f)}return p}emitBefore(t,o,c){const d=c??(o&&o.origin),n=I.has(d)?d:"user";let p=!1,i=null;const r=h=>{p=!0,h!=null&&i===null&&(i=String(h))},f={...o||null,type:t,origin:n,grid:this.#i,get defaultPrevented(){return p},get reason(){return i},preventDefault(h){r(h)}};if(this.#o)return!0;const m=this.#e.get(t);this.#t&&this.#a(t,n,o,m,void 0);const u=m?m.slice():[];if(u.length===0)return!0;const b=()=>(p&&i===null&&(i="prevented"),p&&o&&typeof o=="object"&&(o.reason=i),!p),a=[];for(const h of u)try{const w=h(f);w&&typeof w.then=="function"?a.push(w):w===!1&&r("prevented")}catch(w){r("error"),E(`bus.beforeThrow:${t}:${k(h)}`,`a '${t}' before-handler threw; the action was cancelled.`,w)}return a.length===0?b():Promise.allSettled(a).then(h=>{for(const w of h)w.status==="rejected"?(r("error"),E(`bus.beforeReject:${t}`,`a '${t}' before-handler rejected; the action was cancelled.`,w.reason)):w.value===!1&&r("prevented");return b()})}#c(t,o,c){for(let d=0;d<t.length;d++)try{t[d](o)}catch(n){E(`bus.throw:${c}:${k(t[d])}`,`a '${c}' handler threw; other handlers were unaffected.`,n)}}clear(){this.#e.clear(),this.#s.clear()}destroy(){this.clear(),this.#o=!0,this.#i=null}}}),ze("packages/core/src/registry/free-tier-notice.js",function(e,_){"use strict";Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"WATERMARK_TEXT",{enumerable:!0,get:function(){return E}});const ne="Free for non-commercial use: latticegrid.dev/free",E="Unlicensed: Lattice Grid trial"}),ze("packages/core/src/registry/licence.js",function(e,_){"use strict";Object.defineProperty(e,"PRODUCT",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"LICENCE_VERSION",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"fromBase64Url",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"toBase64Url",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"asciiBytes",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"parseLicence",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"hasEd25519",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"verifyLicence",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isLocalHost",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"currentHost",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"matchesDomain",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LicenceHolder",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"setLicence",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return S}});const E=_("packages/core/src/internal/warn.js").warnOnce,K=_("packages/core/src/registry/free-tier-notice.js"),U=K.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return K.FREE_TIER_NOTICE}});const D="lattice-grid",J=1,z="LG1",L=64,X="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",j=(()=>{const T=new Int16Array(128).fill(-1);for(let O=0;O<I.length;O++)T[I.charCodeAt(O)]=O;return T[43]=62,T[47]=63,T})();function k(T){if(typeof T!="string")return null;let O="";for(let V=0;V<T.length;V++){const Y=T.charCodeAt(V);if(Y!==61){if(Y>127||j[Y]<0)return null;O+=T[V]}}const N=O.length;if(N%4===1)return null;const P=new Uint8Array(Math.floor(N*3/4));let C=0,B=0,x=0;for(let V=0;V<N;V++)C=C<<6|j[O.charCodeAt(V)],B+=6,B>=8&&(B-=8,P[x++]=C>>B&255);return x===P.length?P:P.subarray(0,x)}function y(T){let O="",N=0;for(;N+2<T.length;N+=3){const C=T[N]<<16|T[N+1]<<8|T[N+2];O+=I[C>>18&63]+I[C>>12&63]+I[C>>6&63]+I[C&63]}const P=T.length-N;if(P===1){const C=T[N]<<16;O+=I[C>>18&63]+I[C>>12&63]}else if(P===2){const C=T[N]<<16|T[N+1]<<8;O+=I[C>>18&63]+I[C>>12&63]+I[C>>6&63]}return O}function l(T){const O=new Uint8Array(T.length);for(let N=0;N<T.length;N++)O[N]=T.charCodeAt(N)&127;return O}function g(T){if(typeof TextDecoder=="function")return new TextDecoder().decode(T);let O="";for(let N=0;N<T.length;N++)O+=String.fromCharCode(T[N]);return O}function s(T){const O={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof T=="string"?T:""};if(typeof T!="string"||T.length===0)return{...O,reason:"missing"};const N=T.trim(),P=N.split(".");if(P.length!==3)return O;const[C,B,x]=P;if(C!==z)return{...O,reason:"prefix"};const V=k(B),Y=k(x);if(!V||!Y)return O;let F;try{F=JSON.parse(g(V))}catch{return O}return F===null||typeof F!="object"?O:{ok:!0,reason:null,product:typeof F.p=="string"?F.p:null,issuedTo:typeof F.t=="string"?F.t:null,expires:typeof F.e=="string"?F.e:null,terms:typeof F.terms=="string"?F.terms:null,features:Array.isArray(F.f)?F.f.slice():[],deployments:Array.isArray(F.d)?F.d.slice():[],version:typeof F.v=="number"?F.v:0,message:l(B),signature:Y,raw:N}}function t(T,O){if(!T)return!1;const N=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(T)?`${T}T23:59:59.999Z`:T);return Number.isNaN(N)?!0:O>N}function o(T){return T==="non-commercial"?"non-commercial":"commercial"}let c=null,d=null,n=null;function p(){const T=globalThis.crypto;return T&&T.subtle?T.subtle:null}async function i(T){if(c&&d===T)return c;const O=p();if(!O)return null;const N=k(T);if(!N)return null;try{const P=await O.importKey("raw",N,{name:"Ed25519"},!1,["verify"]);return c=P,d=T,P}catch{return null}}async function r(){return n!==null||(n=await i(X)!==null),n}async function f(T,O={}){const N=O.warn!==!1,P=O.product||D,C=O.publicKey||X,B=O.now??Date.now(),x=O.host??u(),V=m(x)?"":` ${U}`,Y=s(T);if(!Y.ok){const te=Y.reason==="missing"?"missing":"malformed";return N&&E(`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.${V}`:`licence key could not be read. The grid will render with a watermark.${V}`),{valid:!1,reason:te,terms:"commercial"}}const F={product:Y.product||void 0,issuedTo:Y.issuedTo||void 0,expires:Y.expires||void 0,terms:o(Y.terms)};if(Y.product!==P)return N&&E("licence.product",`licence key is for '${Y.product}', not '${P}'. The grid will render with a watermark.`),{valid:!1,...F,reason:"product"};if(t(Y.expires,B))return N&&E("licence.expired",`licence expired on ${Y.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,...F,reason:"expired"};const $=Y.deployments||[];if($.length&&x&&!m(x)&&!b(x,$))return N&&E("licence.domain",`licence key is not valid for ${x}; it covers ${$.join(", ")}. The grid will render with a watermark.`),{valid:!1,...F,reason:"domain"};const q=await i(C);if(!q){const te=!!Y.signature&&Y.signature.length===L;return N&&E("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,...F,reason:"unverified"}:{valid:!1,...F,reason:"signature"}}let ee=!1;try{ee=await p().verify({name:"Ed25519"},q,Y.signature,Y.message)}catch{ee=!1}return ee?{valid:!0,...F}:(N&&E("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...F,reason:"signature"})}function m(T){const O=String(T??u()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!O||O==="localhost"||O.endsWith(".localhost")||O==="::1"||O==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(O)}function u(){const T=globalThis.location;return T&&typeof T.hostname=="string"?T.hostname:null}function b(T,O){const N=a(T);return!N||!Array.isArray(O)?!1:O.some(P=>{const C=a(P);if(!C)return!1;if(C==="*")return!0;if(C.startsWith("*.")){const B=C.slice(2);return N===B||N.endsWith(`.${B}`)}return N===C})}function a(T){return String(T??"").trim().toLowerCase().replace(/\.$/,"")}class h{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#s;#i=new Set;constructor(O={}){this.#s=O}set(O){this.#e=typeof O=="string"?O.trim():"";const N=s(this.#e);return this.#t=N.ok?{valid:!t(N.expires,Date.now())&&N.product===(this.#s.product||D),product:N.product||void 0,issuedTo:N.issuedTo||void 0,expires:N.expires||void 0,terms:o(N.terms),reason:"pending"}:{valid:!1,reason:N.reason||"malformed",terms:"commercial"},this.#n=null,this.#e&&this.verify(),this.#t}verify(){if(this.#n)return this.#n;const O=this.#e;return this.#n=f(O,this.#s).then(N=>{if(this.#e===O){this.#t=N;for(const P of this.#i)P(N)}return N}),this.#n}onSettled(O){return this.#i.add(O),()=>this.#i.delete(O)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!m(this.#r)}setHost(O){this.#r=O}state(){return this.#t.valid?"licensed":m(this.#r)?"localhost":"trial"}reset(){this.#e="",this.#t={valid:!1,reason:"missing",terms:"commercial"},this.#n=null,this.#i.clear()}}const w=Symbol.for("lattice-grid/licence/holder");function v(){const T=globalThis,O=T&&T[w];if(O&&typeof O.set=="function"&&typeof O.watermark=="function")return O;const N=new h;if(T)try{T[w]=N}catch{}return N}const A=v();function H(T){return A.set(T)}function G(){return A.info()}function Z(){return A.watermark()}function M(){return A.state()}function S(){return A}}),ze("packages/core/src/registry/registry.js",function(e,_){"use strict";Object.defineProperty(e,"KINDS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"REGIONS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return c}});const ne=_("packages/core/src/internal/warn.js"),E=ne.warnOnce,K=ne.DEV,D=_("packages/core/src/internal/predicates.js").isFunction,J=_("packages/core/src/registry/licence.js"),z=J.LicenceHolder,L=J.sharedLicence,X=["renderer","editor","filter","dataType","totalFn","pipe","component"],I=["all","header","body","totals","panels"];class j{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#s;#i=null;#o=null;#l=new Set;#a=new Map;constructor(n={}){for(const p of X)this.#t.set(p,new Map);this.#s=n.holder||L(),this.#o=n.grid??null,this.#i=this.#s.onSettled(()=>{this.#d({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),n.licence&&this.setLicence(n.licence)}registerModules(n,p={}){p.licence&&this.setLicence(p.licence),p.grid!==void 0&&(this.#o=p.grid);const i=Array.isArray(n)?n:[n],r=[];for(const f of i){if(!f||typeof f!="object"||typeof f.name!="string"||!f.name){E("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(f.name)){K&&this.#u(this.#e.get(f.name),f);continue}if(!D(f.install)){E(`registry.module.install:${f.name}`,`module '${f.name}' has no install() and was ignored.`);continue}const m={registry:this,grid:this.#o};try{f.install(m)}catch(u){E(`registry.module.throw:${f.name}`,`module '${f.name}' threw during install; it was not registered.`,u);continue}this.#e.set(f.name,f);for(const u of k(f))this.#n.add(u);r.push(f.name),this.#d({reason:"module",name:f.name,capabilities:this.capabilities(),regions:g(f)})}return r}unregisterModule(n){const p=this.#e.get(n);if(!p)return!1;if(D(p.uninstall))try{p.uninstall({registry:this,grid:this.#o})}catch(i){E(`registry.module.uninstall:${n}`,`module '${n}' threw during uninstall.`,i)}return this.#e.delete(n),this.#c(),this.#d({reason:"unmodule",name:n,capabilities:this.capabilities(),regions:g(p)}),!0}modules(){return[...this.#e.values()]}has(n){return this.#e.has(n)}#c(){this.#n.clear();for(const n of this.#e.values())for(const p of k(n))this.#n.add(p)}#u(n,p){!n||n===p||y(n,p)||E(`registry.module.reconfigure:${p.name}`,`module '${p.name}' was re-registered with different options; the first registration is kept and this call was ignored. Unregister it first if you mean to replace it.`)}capabilities(){return[...this.#n].sort()}can(n){return this.#n.has(n)}onChange(n){return D(n)?(this.#r.add(n),this.#a.set(n,this.#o),()=>{this.#r.delete(n),this.#a.delete(n)}):()=>{}}#d(n){for(const p of[...this.#r])try{p(n)}catch(i){E("registry.onChange.throw","a registry change handler threw.",i)}}register(n,p,i){const r=this.#t.get(n);if(!r){E(`registry.kind:${n}`,`unknown registry kind '${n}'; expected one of ${X.join(", ")}.`);return}if(!p||typeof p!="string"){E(`registry.name:${n}`,`register('${n}', ...) needs a name.`);return}r.has(p)&&r.get(p)!==i&&E(`registry.replace:${n}:${p}`,`'${p}' was already registered as a ${n} and has been replaced.`),r.set(p,i),this.#d({reason:"register",name:p,kind:n,capabilities:this.capabilities(),regions:s(n)})}registerAll(n,p){if(p)for(const i of Object.keys(p))this.register(n,i,p[i])}get(n,p){const i=this.#t.get(n);return i?i.get(p):void 0}names(n){const p=this.#t.get(n);return p?[...p.keys()]:[]}#f(n,p){const i=this.#t.get(n).get(p);return i!==void 0?i:this.#t.get("component").get(p)}renderer(n){return this.#f("renderer",n)}editor(n){return this.#f("editor",n)}filter(n){return this.#f("filter",n)}dataType(n){return this.get("dataType",n)}totalFn(n){return this.get("totalFn",n)}pipe(n){return this.get("pipe",n)}setLicence(n){return this.#s.set(n)}licence(){return this.#s.info()}licenceVerified(){return this.#s.verify()}watermark(){return this.#s.watermark()}attach(n){n!=null&&(this.#l.add(n),this.#o=n)}detach(n){if(n!=null){this.#l.delete(n);for(const[p,i]of[...this.#a])i===n&&(this.#r.delete(p),this.#a.delete(p));if(this.#o===n){const p=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#o=p}this.#l.size===0&&this.#i&&(this.#i(),this.#i=null)}}destroy(n){if(n!=null){this.detach(n);return}for(const p of[...this.#e.keys()])this.unregisterModule(p);this.#r.clear(),this.#a.clear(),this.#l.clear(),this.#i&&this.#i(),this.#i=null,this.#o=null}}function k(d){const n=d.capabilities,p=Array.isArray(n)?n.filter(i=>typeof i=="string"):[];return[d.name,...p]}function y(d,n){return d.install!==n.install||d.uninstall!==n.uninstall||(d.version||"")!==(n.version||"")?!1:l(k(d),k(n))&&l(g(d),g(n))}function l(d,n){const p=new Set(d),i=new Set(n);if(p.size!==i.size)return!1;for(const r of p)if(!i.has(r))return!1;return!0}function g(d){const n=d.regions;return!Array.isArray(n)||n.length===0?["all"]:n.filter(p=>I.includes(p))}function s(d){switch(d){case"filter":return["header"];case"totalFn":return["totals"];case"renderer":case"editor":case"pipe":return["body"];default:return["all"]}}const t=new j;function o(){return t}function c(d,n={}){return t.registerModules(d,n)}}),ze("packages/core/src/internal/text.js",function(e,_){"use strict";Object.defineProperty(e,"humanise",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"escapeHtml",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return U}});function ne(D){return D?(D.includes(".")?D.slice(D.lastIndexOf(".")+1):D).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(/^./,z=>z.toUpperCase()):""}const E={"&":"&","<":"<",">":">",'"':""","'":"'"};function K(D){const J=D==null?"":String(D);return/[&<>"']/.test(J)?J.replace(/[&<>"']/g,z=>E[z]):J}function U(D){return String(D).replace(/\w\S*/g,J=>J[0].toUpperCase()+J.slice(1).toLowerCase())}}),ze("packages/core/src/format/mask.js",function(e,_){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return J}});const ne=new Set(["0","#","?",",","."]),E="\0";function K(L){const X=[];let I="",j=!1;for(let k=0;k<L.length;k++){const y=L[k];if(y==="\\"){I+=y+(L[k+1]??""),k+=1;continue}if(y==='"'){j=!j,I+=y;continue}if(y===";"&&!j){X.push(I),I="";continue}I+=y}return X.push(I),X}function U(L){let X="",I="",j="",k=1,y=!1,l=!1;const g=r=>{l?I+=r:X+=r};for(let r=0;r<L.length;r++){const f=L[r];if(f==="\\"){g(L[r+1]??""),r+=1;continue}if(f==='"'){const m=L.indexOf('"',r+1);g(m===-1?L.slice(r+1):L.slice(r+1,m)),r=m===-1?L.length:m;continue}if(f==="%"){k*=100,g("%");continue}if(f==="@"){y=!0,g("\0");continue}if(ne.has(f)){j+=f,l=!0;continue}g(f)}let s=-1;for(let r=j.length-1;r>=0;r--){const f=j[r];if(f==="0"||f==="#"||f==="?"){s=r;break}}let t=!1,o="";for(let r=0;r<j.length;r++){const f=j[r];if(f===","){r>s?k/=1e3:t=!0;continue}o+=f}const c=o.indexOf("."),d=c===-1?o:o.slice(0,c),n=c===-1?"":o.slice(c+1);let p=0;for(const r of d)r==="0"&&(p+=1);let i=0;for(const r of n)r==="0"&&(i+=1);return{prefix:X,suffix:I,minInt:p,minDec:i,maxDec:n.length,grouping:t,scale:k,hasNumber:s!==-1,isText:y}}function D(L,X){const I=new Intl.NumberFormat(X,{minimumIntegerDigits:Math.max(L.minInt,1),minimumFractionDigits:L.minDec,maximumFractionDigits:Math.max(L.maxDec,L.minDec),useGrouping:L.grouping}),{prefix:j,suffix:k,scale:y,hasNumber:l}=L;return g=>{if(!l)return j+k;const s=y===1?g:g*y;return j+I.format(s)+k}}function J(L,X){const j=K(String(L)).map(U),k=j.map(o=>D(o,X)),y=0,l=j.length>1?1:-1,g=j.length>2?2:-1,s=j.length>3?3:-1,t=o=>{if(o==null||o==="")return"";if(typeof o!="number"||Number.isNaN(o)){const c=Number(o);if(Number.isNaN(c))return s===-1?String(o):(j[s].prefix+j[s].suffix).split("\0").join(String(o));o=c}return o===0&&g!==-1?k[g](0):o<0&&l!==-1?k[l](-o):k[y](o)};return t.spec={mask:L},{format:t,ooxml:z(String(L))}}function z(L){return L.trim()}}),ze("packages/core/src/format/pattern.js",function(e,_){"use strict";Object.defineProperty(e,"parseNumberPattern",{enumerable:!0,get:function(){return D}});const E=_("packages/core/src/format/mask.js").splitSections;function K(J){let z="",L="",X="",I="",j=!1,k=!1,y=!1,l=!1;const g=t=>{y?L+=t:z+=t};for(let t=0;t<J.length;t++){const o=J[t];if(o==="\\"){g(J[t+1]??""),t+=1;continue}if(o==='"'){const c=J.indexOf('"',t+1);g(c===-1?J.slice(t+1):J.slice(t+1,c)),t=c===-1?J.length:c;continue}if(o==="%"){k=!0;continue}if(o==="0"||o==="#"){y=!0,l?I+=o:X+=o;continue}if(o===","){l||(j=!0);continue}if(o==="."&&!l){l=!0;continue}g(o)}if(!y)return{hasDigit:!1,prefix:z,suffix:L,minDec:0,maxDec:0,grouping:!1,percent:k};let s=0;for(const t of I)t==="0"&&(s+=1);return{hasDigit:!0,prefix:z,suffix:L,minDec:s,maxDec:I.length,grouping:j,percent:k}}function U(J,z){const L=z.trim(),X=J.trim();return L.startsWith("(")&&L.endsWith(")")&&L.slice(1,-1).trim()===X?"parentheses":L.endsWith("-")?"suffix":"minus"}function D(J){if(typeof J!="string")return null;const z=E(J);if(z.length===0)return null;const L=K(z[0]);if(!L.hasDigit)return null;const X={style:L.percent?"percent":"decimal",prefix:L.prefix,suffix:L.suffix,minDecimals:L.minDec,maxDecimals:Math.max(L.maxDec,L.minDec),thousandsSeparator:L.grouping?void 0:!1};if(z.length>1&&(X.negative=U(z[0],z[1])),z.length>2){const I=K(z[2]);I.hasDigit||(X.zeroDisplay=I.prefix+I.suffix)}return X}}),ze("packages/core/src/format/number.js",function(e,_){"use strict";Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return z}});const E=_("packages/core/src/internal/predicates.js").isNil,U=_("packages/core/src/internal/warn.js").warnOnce,J=_("packages/core/src/format/pattern.js").parseNumberPattern;function z(L,X){const I=typeof L=="string"?{pattern:L}:L||{};let j=I;if(typeof I.pattern=="string"){const v=J(I.pattern);if(v){const{pattern:A,...H}=I;j={...v,...H}}else U(`format:pattern:${I.pattern}`,`invalid number format pattern "${I.pattern}"; the value will use the default number format`)}const k=j.locale||X||void 0,y=j.style||"decimal",l=typeof j.scale=="number"?j.scale:1,g=j.nullDisplay??"",s=j.zeroDisplay,t=j.prefix||"",o=j.suffix||"",c=j.negative||"minus",d=j.signed===!0,n={style:y,notation:j.notation||"standard"};y==="currency"&&(n.currency=j.currency||"USD",j.currencyDisplay&&(n.currencyDisplay=j.currencyDisplay)),typeof j.decimals=="number"?(n.minimumFractionDigits=j.decimals,n.maximumFractionDigits=j.decimals):(typeof j.minDecimals=="number"&&(n.minimumFractionDigits=j.minDecimals),typeof j.maxDecimals=="number"&&(n.maximumFractionDigits=j.maxDecimals),n.minimumFractionDigits>(n.maximumFractionDigits??20)&&(n.maximumFractionDigits=n.minimumFractionDigits)),j.thousandsSeparator===!1&&(n.useGrouping=!1),n.notation==="compact"&&(n.compactDisplay=j.compactDisplay||"short");const p=new Intl.NumberFormat(k,n),i=typeof j.thousandsSeparator=="string"?j.thousandsSeparator:null,r=typeof j.decimalSeparator=="string"?j.decimalSeparator:null;let f=",",m=".";if(i||r)for(const v of p.formatToParts(12345.6))v.type==="group"?f=v.value:v.type==="decimal"&&(m=v.value);const u=v=>{let A=v;return i&&(A=A.split(f).join("")),r&&(A=A.split(m).join("")),i&&(A=A.split("").join(i)),r&&(A=A.split("").join(r)),A},b=!!(i||r),a=t!==""&&y==="currency",h=v=>{let A;if(a){const H=p.formatToParts(v);let G=!1;A="";for(const Z of H)A+=Z.value,!G&&Z.type==="currency"&&(A+=t,G=!0);G||(A=t+A)}else A=t+p.format(v);return b&&(A=u(A)),A+o},w=v=>{if(E(v)||v==="")return g;const A=typeof v=="number"?v:Number(v);if(Number.isNaN(A))return g;const H=l===1?A:A*l;return H===0&&s!==void 0?s:H<0?c==="parentheses"?`(${h(-H)})`:c==="suffix"?`${h(-H)}-`:h(H):d&&H>0?`+${h(H)}`:h(H)};return w.negativeClass=j.negativeClass||null,w.spec=j,w}}),ze("packages/core/src/format/date.js",function(e,_){"use strict";Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return o}});const E=_("packages/core/src/internal/predicates.js").isNil,U=_("packages/core/src/internal/warn.js").warnOnce,D=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function J(c){const d=[];let n=0,p="";const i=()=>{p&&(d.push({token:null,text:p}),p="")};for(;n<c.length;){const r=c[n];if(r==="'"){if(c[n+1]==="'"){p+="'",n+=2;continue}const m=c.indexOf("'",n+1);if(m===-1){p+=c.slice(n+1),n=c.length;continue}p+=c.slice(n+1,m),n=m+1;continue}const f=D.find(m=>c.startsWith(m,n));if(f){i(),d.push({token:f,text:f}),n+=f.length;continue}/[A-Za-z]/.test(r)&&U(`date.pattern.token:${r}`,`the date pattern "${c}" contains '${r}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${D.join(" ")}.`),p+=r,n+=1}return i(),d}const z=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function L(c){if(E(c)||c==="")return null;if(c instanceof Date)return Number.isNaN(c.getTime())?null:c;if(typeof c=="number")return Number.isNaN(c)?null:new Date(c);if(typeof c=="string"){const d=z.exec(c.trim());if(d){const[,p,i,r,f="0",m="0",u="0"]=d;return new Date(+p,+i-1,+r,+f,+m,+u)}const n=new Date(c);return Number.isNaN(n.getTime())?null:n}return null}function X(c,d){return String(c).padStart(d,"0")}function I(c){if(!c)return p=>({year:p.getFullYear(),month:p.getMonth()+1,day:p.getDate(),hour:p.getHours(),minute:p.getMinutes(),second:p.getSeconds(),ms:p.getMilliseconds(),weekday:p.getDay()});const d=new Intl.DateTimeFormat("en-US",{timeZone:c,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,weekday:"short"}),n={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};return p=>{const i={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:p.getMilliseconds(),weekday:0};for(const r of d.formatToParts(p))switch(r.type){case"year":i.year=Number(r.value);break;case"month":i.month=Number(r.value);break;case"day":i.day=Number(r.value);break;case"hour":i.hour=Number(r.value)%24;break;case"minute":i.minute=Number(r.value);break;case"second":i.second=Number(r.value);break;case"weekday":i.weekday=n[r.value]??0;break;default:break}return i}}function j(c,d,n){const p=J(c),i=I(n),r=new Set(p.filter(a=>a.token).map(a=>a.token)),f=r.has("MMM")?new Intl.DateTimeFormat(d,{month:"short",timeZone:n}):null,m=r.has("MMMM")?new Intl.DateTimeFormat(d,{month:"long",timeZone:n}):null,u=r.has("EEE")?new Intl.DateTimeFormat(d,{weekday:"short",timeZone:n}):null,b=r.has("EEEE")?new Intl.DateTimeFormat(d,{weekday:"long",timeZone:n}):null;return a=>{const h=i(a);let w="";for(const v of p){if(!v.token){w+=v.text;continue}switch(v.token){case"yyyy":w+=X(h.year,4);break;case"yy":w+=X(h.year%100,2);break;case"MMMM":w+=m.format(a);break;case"MMM":w+=f.format(a);break;case"MM":w+=X(h.month,2);break;case"M":w+=String(h.month);break;case"dd":w+=X(h.day,2);break;case"d":w+=String(h.day);break;case"EEEE":w+=b.format(a);break;case"EEE":w+=u.format(a);break;case"HH":w+=X(h.hour,2);break;case"H":w+=String(h.hour);break;case"hh":w+=X(h.hour%12===0?12:h.hour%12,2);break;case"h":w+=String(h.hour%12===0?12:h.hour%12);break;case"mm":w+=X(h.minute,2);break;case"m":w+=String(h.minute);break;case"ss":w+=X(h.second,2);break;case"s":w+=String(h.second);break;case"SSS":w+=X(h.ms,3);break;case"a":w+=h.hour<12?"AM":"PM";break;default:w+=v.text;break}}return w}}const k=[["year",365*24*36e5],["month",720*36e5],["week",168*36e5],["day",24*36e5],["hour",36e5],["minute",6e4],["second",1e3]];function y(c,d){const n=c||{},p=n.locale||d||void 0,i=n.nullDisplay??"",r=n.timeZone;let f;if(n.pattern)f=j(n.pattern,p,r);else if(n.dateStyle||n.timeStyle){const h={timeZone:r};n.dateStyle&&(h.dateStyle=n.dateStyle),n.timeStyle&&(h.timeStyle=n.timeStyle);const w=new Intl.DateTimeFormat(p,h);f=v=>w.format(v)}else{const h=new Intl.DateTimeFormat(p,{dateStyle:"medium",timeZone:r});f=w=>h.format(w)}const m=n.relative?new Intl.RelativeTimeFormat(p,{numeric:"auto"}):null,b=(typeof n.relative=="object"&&n.relative?n.relative.threshold??7:7)*24*36e5,a=(h,w)=>{const v=L(h);if(!v)return i;if(m){const A=w&&typeof w.now=="number"?w.now:Date.now(),H=v.getTime()-A;if(Math.abs(H)<b){for(const[G,Z]of k)if(Math.abs(H)>=Z||G==="second")return m.format(Math.round(H/Z),G)}}return f(v)};return a.spec=n,a}function l(c){if(E(c)||c==="")return null;if(typeof c=="string"){const p=/^(\d{4}-\d{2}-\d{2})/.exec(c.trim());if(p)return p[1];const i=L(c);return i?l(i):null}const d=L(c);if(!d)return null;const n=p=>String(p).padStart(2,"0");return`${d.getFullYear()}-${n(d.getMonth()+1)}-${n(d.getDate())}`}function g(c,d){if(E(c)||c==="")return null;if(typeof c=="string"){const p=c.trim();if(s.test(p)){const f=L(p);return f?t(f,d):null}const i=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(p);if(i){const[,f,m,u,b]=i;return`${f}T${m}:${u}${b&&b!=="00"?`:${b}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(p))return`${p}T00:00`;const r=L(p);return r?g(r):null}const n=L(c);return n?t(n,d):null}const s=/(?:Z|[+-]\d{2}:?\d{2})$/i;function t(c,d){const n=f=>String(f).padStart(2,"0");if(d)try{const f=new Intl.DateTimeFormat("en-CA",{timeZone:d,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(c).reduce((b,a)=>(a.type!=="literal"&&(b[a.type]=a.value),b),{}),m=f.hour==="24"?"00":f.hour,u=Number(f.second);return`${f.year}-${f.month}-${f.day}T${m}:${f.minute}`+(u?`:${f.second}`:"")}catch{}const p=`${c.getFullYear()}-${n(c.getMonth()+1)}-${n(c.getDate())}`,i=c.getSeconds(),r=`${n(c.getHours())}:${n(c.getMinutes())}${i?`:${n(i)}`:""}`;return`${p}T${r}`}function o(c,d){const n=E(c)||c===""?null:String(c),p=E(d)||d===""?null:String(d);return n===null?p===null?0:1:p===null||n<p?-1:n>p?1:0}}),ze("packages/core/src/format/boolean.js",function(e,_){"use strict";Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return J}});const E=_("packages/core/src/internal/predicates.js").isNil,K={true:"☑",false:"☐",null:""},U={true:"◉",false:"◯",null:""};function D(z){if(E(z)||z==="")return null;if(typeof z=="boolean")return z;if(typeof z=="number")return z!==0;const L=String(z).trim().toLowerCase();return L==="true"||L==="yes"||L==="y"||L==="1"?!0:L==="false"||L==="no"||L==="n"||L==="0"?!1:null}function J(z,L){const X=z||{},I=X.display||"text",j=X.trueLabel??"Yes",k=X.falseLabel??"No",y=X.nullLabel??"";let l=j,g=k;const s=y;I==="checkbox"?(l=K.true,g=K.false):I==="switch"?(l=U.true,g=U.false):I==="icon"&&(l=X.trueIcon??j,g=X.falseIcon??k);const t=o=>{const c=D(o);return c===null?s:c?l:g};return t.display=I,t.labels={true:j,false:k,null:y},t.locale=L,t.spec=X,t}}),ze("packages/core/src/format/text.js",function(e,_){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return D}});const E=_("packages/core/src/internal/predicates.js").isNil,U=_("packages/core/src/internal/text.js").titleCase;function D(J,z){const L=J||{},X=L.locale||z||void 0,I=L.nullDisplay??"",j=L.emptyDisplay??"",k=L.transform||"none",y=typeof L.truncate=="number"?{chars:L.truncate}:L.truncate||null,l=y?y.chars:0,g=y?y.ellipsis??"…":"",s=o=>{switch(k){case"upper":return X?o.toLocaleUpperCase(X):o.toUpperCase();case"lower":return X?o.toLocaleLowerCase(X):o.toLowerCase();case"title":return U(o);default:return o}},t=o=>{if(E(o))return I;let c=typeof o=="string"?o:String(o);return c===""?j:(k!=="none"&&(c=s(c)),l>0&&c.length>l&&(c=c.slice(0,l)+g),c)};return t.spec=L,t}}),ze("packages/core/src/format/shorthand.js",function(e,_){"use strict";Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return z}});const ne=["currency","number","percent","date","boolean","text","relative"],E=/[#0?@;"\\]/,K=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function U(L){return typeof L!="string"||L===""||J(L)?!1:E.test(L)}function D(L){return typeof L!="string"||L===""||J(L)?!1:K.test(L)}function J(L){const X=L.indexOf(":"),I=X===-1?L:L.slice(0,X);return ne.includes(I)?I:null}function z(L){const X=J(L);if(!X)return null;const I=L.indexOf(":"),j=I===-1?"":L.slice(I+1),k=j===""?[]:j.split(":");switch(X){case"currency":{const y={type:"number",style:"currency",currency:k[0]||"USD"};return k[1]!==void 0&&k[1]!==""&&(y.decimals=Number(k[1])),y}case"number":{const y={type:"number",style:"decimal"};return k[0]!==void 0&&k[0]!==""&&(y.decimals=Number(k[0])),y}case"percent":{const y={type:"number",style:"percent"};return k[0]!==void 0&&k[0]!==""&&(y.decimals=Number(k[0])),y}case"date":return{type:"date",pattern:j||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const y=j.split("/"),l={type:"boolean",display:"text"};return y[0]!==void 0&&y[0]!==""&&(l.trueLabel=y[0]),y[1]!==void 0&&y[1]!==""&&(l.falseLabel=y[1]),y[2]!==void 0&&(l.nullLabel=y[2]),l}case"text":{const y={type:"text"};return k[0]&&(y.transform=k[0]),k[1]!==void 0&&k[1]!==""&&(y.truncate=Number(k[1])),y}default:return null}}}),ze("packages/core/src/format/index.js",function(e,_){"use strict";Object.defineProperty(e,"compileFormat",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"specToOoxml",{enumerable:!0,get:function(){return A}});const ne=_("packages/core/src/internal/predicates.js"),E=ne.isFunction,K=ne.isObject,D=_("packages/core/src/internal/warn.js").warnOnce,J=_("packages/core/src/format/number.js"),z=J.compileNumber,L=_("packages/core/src/format/date.js"),X=L.compileDate,I=L.scanPattern,j=_("packages/core/src/format/boolean.js"),k=j.compileBoolean,y=_("packages/core/src/format/text.js"),l=y.compileText,g=_("packages/core/src/format/mask.js"),s=g.compileMask,t=_("packages/core/src/format/shorthand.js"),o=t.parseShorthand,c=t.looksLikeMask,d=t.looksLikeDatePattern,p=_("packages/core/src/format/pattern.js").parseNumberPattern;Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return J.compileNumber}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return L.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return L.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return L.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return L.toDate}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return j.compileBoolean}}),Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return j.toTriState}}),Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return y.compileText}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return g.compileMask}}),Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return g.splitSections}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return g.parseSection}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return t.parseShorthand}}),Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return t.looksLikeMask}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return t.looksLikeDatePattern}});const i=new Set(["decimal","currency","percent","unit"]),r=new Set(["type","locale"]),f={number:new Set(["style","currency","currencyDisplay","decimals","minDecimals","maxDecimals","thousandsSeparator","decimalSeparator","notation","compactDisplay","negative","negativeClass","signed","prefix","suffix","zeroDisplay","nullDisplay","messages","scale","pattern"]),date:new Set(["pattern","dateStyle","timeStyle","timeZone","relative","nullDisplay"]),boolean:new Set(["display","trueLabel","falseLabel","nullLabel","trueIcon","falseIcon"]),text:new Set(["transform","truncate","nullDisplay","emptyDisplay"])},m=new Set(["number","date","boolean","text"]);function u(M,S){const T=M.type;if(T===void 0||m.has(T)||!i.has(String(T)))return;const O=S?`"${S}"`:"with no id";D(`format:unknown-style-key:${S||""}:${T}`,`column ${O} has format: { type: "${T}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${T}" instead?`)}function b(M,S,T){const O=f[S],N=T?`"${T}"`:"with no id";for(const P of M){if(r.has(P)||O.has(P))continue;const C=Object.keys(f).find(B=>B!==S&&f[B].has(P));C?D(`format:inapplicable:${T||""}:${P}`,`column ${N} has format key "${P}", which applies to a ${C} column, not the ${S} column it was applied to; it is ignored.`):D(`format:unknown:${T||""}:${P}`,`column ${N} has an unrecognised format key "${P}" for its ${S} format; it is ignored.`)}}function a(M){if(M.type==="number"||M.type==="date"||M.type==="boolean"||M.type==="text")return!0;const S=i.has(String(M.style));return!!(M.pattern||M.dateStyle||M.timeStyle||M.relative||M.timeZone||M.trueLabel||M.falseLabel||M.display||M.trueIcon||M.falseIcon||M.transform||M.truncate||M.emptyDisplay||S||M.currency||M.decimals!==void 0||M.minDecimals!==void 0||M.maxDecimals!==void 0||M.notation||M.negative||M.scale!==void 0||M.prefix||M.suffix||M.zeroDisplay!==void 0)}function h(M,S){if(M.type==="number"||M.type==="date"||M.type==="boolean"||M.type==="text")return M.type;if(M.pattern){if(c(M.pattern))return"number";if(d(M.pattern))return"date"}if(M.dateStyle||M.timeStyle||M.relative||M.timeZone)return"date";if(M.trueLabel||M.falseLabel||M.display||M.trueIcon||M.falseIcon)return"boolean";if(M.transform||M.truncate||M.emptyDisplay)return"text";if(M.style||M.currency||M.decimals!==void 0||M.minDecimals!==void 0||M.maxDecimals!==void 0||M.notation||M.negative||M.scale!==void 0||M.prefix||M.suffix||M.zeroDisplay!==void 0)return"number";const T=S&&S.base;return T==="number"?"number":T==="date"||T==="dateString"?"date":T==="boolean"?"boolean":"text"}function w(M,S=null,T=void 0,O=void 0,N=void 0){if(M==null||M==="")return null;const P=K(M)?Object.keys(M):null;if(typeof M=="function"){const x=(V,Y)=>String(M({...Y||{},value:V,locale:T})??"");return x.ooxml=S&&S.excel||"General",x}if(typeof M=="string"){if(c(M)){const{format:V,ooxml:Y}=s(M,T);return V.ooxml=Y,V}const x=o(M)||(d(M)?{type:"date",pattern:M}:null);return x?w(x,S,T,O,N):(D(`format:${M}`,`unrecognised format string "${M}"; the value will be stringified`),null)}if(!K(M))return D("format:shape","format must be a spec object or a string; ignoring",M),null;if(S&&E(S.format)&&!a(M)||S&&E(S.format)&&Array.isArray(S.formatPatterns)&&M.type===void 0)return null;const C=h(M,S);C==="date"&&O&&M.timeZone===void 0&&(M={...M,timeZone:O}),u(M,N),b(P||Object.keys(M),C,N);let B;switch(C){case"number":B=z(M,T);break;case"date":B=X(M,T);break;case"boolean":B=k(M,T);break;default:B=l(M,T);break}return B.ooxml=A(M,C,T,S),B.kind=C,B}const v={yyyy:"yyyy",yy:"yy",MMMM:"mmmm",MMM:"mmm",MM:"mm",M:"m",dd:"dd",d:"d",EEEE:"dddd",EEE:"ddd",HH:"hh",H:"h",hh:"hh",h:"h",mm:"mm",m:"m",ss:"ss",s:"s",SSS:"000",a:"AM/PM"};function A(M,S,T=void 0,O=null){if(S==="date"){if(M.pattern){let x="";for(const V of I(M.pattern))x+=V.token?v[V.token]??V.text:V.text;return x}return O&&O.excel||"yyyy-mm-dd"}if(S==="boolean")return"General";if(S==="text")return"@";if(typeof M.pattern=="string"&&p(M.pattern))return String(M.pattern).trim();if(M.notation==="compact"||M.notation==="scientific")return"General";const N=typeof M.decimals=="number"?M.decimals:typeof M.minDecimals=="number"?M.minDecimals:M.style==="currency"?2:0;let C=`${M.thousandsSeparator===!1?"":"#,#"}#0${N>0?`.${"0".repeat(N)}`:""}`,B="";return M.style==="currency"&&(B+=H(Z(M.currency||"USD",T))),M.prefix&&(B+=H(M.prefix)),C=B+C,M.style==="percent"&&(C=`${C}%`),M.suffix&&(C+=H(M.suffix)),M.negative==="parentheses"?`${C};(${C})`:M.negative==="suffix"?`${C};${C}-`:C}function H(M){return`"${String(M).split('"').join("")}"`}const G=new Map;function Z(M,S){const T=`${M}|${S||""}`;let O=G.get(T);if(O!==void 0)return O;O=M;try{const P=new Intl.NumberFormat(S,{style:"currency",currency:M}).formatToParts(0).find(C=>C.type==="currency");P&&(O=P.value)}catch{}return G.set(T,O),O}}),ze("packages/core/src/columns/types/temporal.js",function(e,_){"use strict";Object.defineProperty(e,"MS_SECOND",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"MS_MINUTE",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"MS_HOUR",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"MS_DAY",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"MS_WEEK",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"toTimeMs",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"zonedParts",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"zoneOffsetAt",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"instantFromParts",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"toEpochMs",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"toDurationMs",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(e,"resolveZoneName",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"zoneLabel",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"formatInstant",{enumerable:!0,get:function(){return le}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"timestampGroupProjector",{enumerable:!0,get:function(){return he}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return be}}),Object.defineProperty(e,"TEMPORAL_INFERENCE_ORDER",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return je}});const ne=_("packages/core/src/internal/predicates.js"),E=ne.isNil,K=ne.isFunction,U=_("packages/core/src/format/date.js"),D=U.toDate,J=U.compilePattern,z=U.compileDate,L=U.toIsoDateTime,X=U.compareIso,I=864e5,j=Object.freeze({}),k=1e3,y=60*k,l=60*y,g=24*l,s=7*g,t=new WeakMap;function o(ke,Ue){const Re=ke&&ke.locale||"",Ee=ke&&ke.column;if(!Ee)return Re?{locale:Re}:j;const He=t.get(Ee);if(He&&He.locale===Re)return He.bag;const Ke=Ee.typeOptions||Ee[Ue]||(c(Ee.format)?Ee.format:null),We={...Ke||j,locale:Ke&&Ke.locale||Re||void 0};return t.set(Ee,{locale:Re,bag:We}),We}function c(ke){return ke!==null&&typeof ke=="object"&&!Array.isArray(ke)&&!(ke instanceof Date)}function d(ke,Ue){const Re=ke===null||Number.isNaN(ke)?null:ke,Ee=Ue===null||Number.isNaN(Ue)?null:Ue;return Re===null?Ee===null?0:1:Ee===null||Re<Ee?-1:Re>Ee?1:0}const n=/^(\d{1,2})(?:\s*[:.h]\s*(\d{1,2})(?:\s*[:.]\s*(\d{1,2})(?:[.,](\d{1,3}))?)?)?\s*(a\.?m\.?|p\.?m\.?|a|p)?$/i,p=/^(\d{3,6})$/;function i(ke,Ue,Re,Ee){return!(ke>=0&&ke<=23)||!(Ue>=0&&Ue<=59)||!(Re>=0&&Re<=59)||!(Ee>=0&&Ee<=999)?null:ke*l+Ue*y+Re*k+Ee}function r(ke){if(E(ke))return null;const Ue=String(ke).trim();if(Ue==="")return null;const Re=p.exec(Ue);if(Re){const dt=Re[1];if(dt.length===5)return null;const lt=dt.length===3?1:2;return i(Number(dt.slice(0,lt)),Number(dt.slice(lt,lt+2)),Number(dt.slice(lt+2,lt+4)||0),0)}const Ee=n.exec(Ue);if(!Ee)return null;let He=Number(Ee[1]);const Ke=Number(Ee[2]||0),We=Number(Ee[3]||0),qe=Ee[4]?Number(Ee[4].padEnd(3,"0")):0,et=Ee[5]?Ee[5][0].toLowerCase():null;if(et){if(He<1||He>12)return null;He=He%12,et==="p"&&(He+=12)}return i(He,Ke,We,qe)}function f(ke){return E(ke)||ke===""?null:typeof ke=="number"?Number.isFinite(ke)?(ke%g+g)%g:null:ke instanceof Date?Number.isNaN(ke.getTime())?null:ke.getHours()*l+ke.getMinutes()*y+ke.getSeconds()*k+ke.getMilliseconds():r(ke)}const m=new Map;function u(ke){const Ue=ke.pattern||"",Re=ke.timeStyle||(ke.seconds?"medium":"short"),Ee=`${ke.locale||""}|${Ue}|${Re}`;let He=m.get(Ee);if(He)return He;if(Ue)He=J(Ue,ke.locale||void 0,"UTC");else{const Ke=new Intl.DateTimeFormat(ke.locale||void 0,{timeStyle:Re,timeZone:"UTC"});He=We=>Ke.format(We)}return m.set(Ee,He),He}function b(ke,Ue){const Re=Ue||j;if(ke==null||typeof ke!="number"||!Number.isFinite(ke))return Re.nullDisplay??"";const Ee=(ke%g+g)%g;return u(Re)(new Date(Ee))}function a(ke){return ke instanceof Date?!Number.isNaN(ke.getTime()):typeof ke=="number"?Number.isFinite(ke)&&ke>=0&&ke<g:typeof ke!="string"||!ke.includes(":")?!1:r(ke)!==null}function h(ke){const Ue=f(ke);return Ue==null?"":b(Ue,{pattern:Ue%k===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const w=new Map;function v(ke){const Ue=ke||"";let Re=w.get(Ue);return Re||(Re=new Intl.DateTimeFormat("en-GB",{timeZone:ke||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),w.set(Ue,Re)),Re}function A(ke,Ue){const Re={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const Ee of v(Ue).formatToParts(new Date(ke)))Ee.type==="year"?Re.year=Number(Ee.value):Ee.type==="month"?Re.month=Number(Ee.value):Ee.type==="day"?Re.day=Number(Ee.value):Ee.type==="hour"?Re.hour=Number(Ee.value)%24:Ee.type==="minute"?Re.minute=Number(Ee.value):Ee.type==="second"&&(Re.second=Number(Ee.value));return Re}function H(ke,Ue){const Re=A(ke,Ue);return Date.UTC(Re.year,Re.month-1,Re.day,Re.hour,Re.minute,Re.second,0)-Math.floor(ke/1e3)*1e3}function G(ke,Ue){const Re=ke.hour||0,Ee=ke.minute||0,He=ke.second||0,Ke=ke.ms||0;if(!Ue)return new Date(ke.year,ke.month-1,ke.day,Re,Ee,He,Ke).getTime();const We=Date.UTC(ke.year,ke.month-1,ke.day,Re,Ee,He,Ke);let qe=We-H(We,Ue);return qe=We-H(qe,Ue),qe}const Z=/(?:Z|[+-]\d{2}:?\d{2})$/i,M=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function S(ke,Ue){if(E(ke))return null;const Re=String(ke).trim();if(Re==="")return null;const Ee=Ue&&Ue.timeZone||void 0;if(!Z.test(Re)){const He=M.exec(Re);if(He){const Ke=(He[4]||"").trim(),We=Ke===""?0:r(Ke);if(We===null)return null;const qe=G({year:Number(He[1]),month:Number(He[2]),day:Number(He[3]),hour:Math.floor(We/l),minute:Math.floor(We/y)%60,second:Math.floor(We/k)%60,ms:We%k},Ee);return Number.isNaN(qe)?null:new Date(qe)}}return D(Re)}function T(ke){if(typeof ke=="number")return Number.isFinite(ke)?ke:null;const Ue=D(ke);return Ue?Ue.getTime():null}const O=new Map;function N(ke){const Ue=[ke.locale||"",ke.pattern||"",ke.dateStyle||"",ke.timeStyle||"",ke.timeZone||"",ke.seconds?"1":""].join("|");let Re=O.get(Ue);if(Re)return Re;const Ee=ke.pattern?{type:"date",pattern:ke.pattern,timeZone:ke.timeZone}:{type:"date",dateStyle:ke.dateStyle||"medium",timeStyle:ke.timeStyle||(ke.seconds?"medium":"short"),timeZone:ke.timeZone};return Re=z(Ee,ke.locale||void 0),O.set(Ue,Re),Re}function P(ke,Ue){const Re=Ue||j,Ee=T(ke);return Ee==null?Re.nullDisplay??"":N(Re)(Ee)}function C(ke){return ke instanceof Date?!Number.isNaN(ke.getTime()):typeof ke!="string"||!M.test(ke.trim())?!1:S(ke)!==null}const B=Object.freeze([{key:"w",ms:s,intl:"week",long:["week","weeks"],names:["w","wk","wks","week","weeks"]},{key:"d",ms:g,intl:"day",long:["day","days"],names:["d","dy","day","days"]},{key:"h",ms:l,intl:"hour",long:["hour","hours"],names:["h","hr","hrs","hour","hours"]},{key:"m",ms:y,intl:"minute",long:["minute","minutes"],names:["m","min","mins","minute","minutes"]},{key:"s",ms:k,intl:"second",long:["second","seconds"],names:["s","sec","secs","second","seconds"]},{key:"ms",ms:1,intl:"millisecond",long:["millisecond","milliseconds"],names:["ms","msec","msecs","milli","millis","millisecond","milliseconds"]}]),x=new Map;for(const ke of B)for(const Ue of ke.names)x.set(Ue,ke);const V=Object.freeze(B.filter(ke=>ke.key!=="w")),Y=/^(\d+(?:\.\d+)?)\s*([a-z]+)\s*(?:,\s*)?/,F=/^\d+(?:\.\d+)?$/,$=/^(\d+):([0-5]?\d)(?::([0-5]?\d))?(?:\.(\d{1,3}))?$/;function q(ke){const Ue=ke&&ke.defaultUnit?x.get(String(ke.defaultUnit).toLowerCase()):null;return Ue?Ue.ms:y}function ee(ke){return(ke&&ke.defaultUnit?x.get(String(ke.defaultUnit).toLowerCase()):null)||x.get("m")}function te(ke,Ue){if(E(ke))return null;let Re=String(ke).trim().toLowerCase();if(Re==="")return null;let Ee=1;if(Re[0]==="-"?(Ee=-1,Re=Re.slice(1).trim()):Re[0]==="+"&&(Re=Re.slice(1).trim()),Re==="")return null;const He=$.exec(Re);if(He){const et=He[3]!==void 0,dt=Number(He[1])*l+Number(He[2])*y+(et?Number(He[3])*k:0)+(He[4]?Number(He[4].padEnd(3,"0")):0);return Ee*dt}if(F.test(Re))return Math.round(Ee*Number(Re)*q(Ue||j));let Ke=Re,We=0,qe=0;for(;Ke!=="";){const et=Y.exec(Ke);if(!et)return null;const dt=x.get(et[2]);if(!dt)return null;We+=Number(et[1])*dt.ms,Ke=Ke.slice(et[0].length),qe++}return qe===0?null:Math.round(Ee*We)}function re(ke){return E(ke)||ke===""?null:typeof ke=="number"?Number.isFinite(ke)?ke:null:te(ke)}const ie=new Map;function ue(ke,Ue,Re){const Ee=`${Re||""}|${Ue.intl}`;let He=ie.get(Ee);if(He===void 0){try{He=new Intl.NumberFormat(Re||void 0,{style:"unit",unit:Ue.intl,unitDisplay:"long"})}catch{He=null}ie.set(Ee,He)}return He?He.format(ke):`${ke} ${ke===1?Ue.long[0]:Ue.long[1]}`}function Ae(ke,Ue){return String(ke).padStart(Ue,"0")}function de(ke,Ue){const Re=Ue||j;if(ke==null||typeof ke!="number"||!Number.isFinite(ke))return Re.nullDisplay??"";const Ee=Re.style||"short",He=ke<0;let Ke=Math.round(Math.abs(ke));const We=He?"-":"";if(Ke===0&&Re.zeroDisplay!=null)return Re.zeroDisplay;if(Ee==="clock"){const lt=Math.floor(Ke/l),vt=Math.floor(Ke/y)%60,Pt=Math.floor(Ke/k)%60;return`${We}${Ae(lt,2)}:${Ae(vt,2)}:${Ae(Pt,2)}`}if(Ke===0){const lt=ee(Re);return Ee==="long"?ue(0,lt,Re.locale):`0${lt.key}`}const qe=Re.weeks===!0?B:V,et=typeof Re.maxUnits=="number"&&Re.maxUnits>0?Re.maxUnits:Re.maxUnits===void 0?2:1/0,dt=[];for(const lt of qe){if(dt.length>=et)break;const vt=Math.floor(Ke/lt.ms);vt!==0&&(Ke-=vt*lt.ms,dt.push(Ee==="long"?ue(vt,lt,Re.locale):`${vt}${lt.key}`))}return We+dt.join(" ")}function Oe(ke){if(typeof ke!="string")return!1;const Ue=ke.trim();return Ue===""||$.test(Ue)||!/[a-z]/i.test(Ue)?!1:te(Ue)!==null}const Me=Date.UTC(1899,11,30),Fe=new Map;function pe(ke,Ue){const Re=ke||"";let Ee=Fe.get(Re);Ee||(Ee=new Intl.DateTimeFormat("en-GB",{timeZone:ke||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),Fe.set(Re,Ee));const He=typeof Ue=="number"?Ue:Date.now();for(const Ke of Ee.formatToParts(new Date(He)))if(Ke.type==="timeZoneName")return Ke.value;return""}function ae(ke){if(ke)return ke;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function ge(ke,Ue){const Re=ae(ke),Ee=pe(ke,Ue);return Ee?`${Re} (${Ee})`:Re}function ve(ke,Ue){if(ke&&ke.timeZone)return ke.timeZone;const Re=Ue&&Ue.grid;return(Re&&K(Re.get)?Re.get("timeZone"):void 0)||void 0}function le(ke,Ue){const Re=Ue||j,Ee=T(ke);if(Ee==null)return Re.nullDisplay??"";const He=N(Re)(Ee);if(!Re.showOrigin)return He;const Ke=Re.originZone;return Ke?Ke===(Re.timeZone||ae(Re.timeZone))?He:`${He} (${ge(Ke,Ee)})`:`${He} (no origin recorded)`}function we(ke,Ue,Re,Ee){if(Ue==="instant"||!Ue)return ke;const He=A(ke,Re);if(Ue==="month")return G({year:He.year,month:He.month,day:1},Re);if(Ue==="week"){const Ke=Ee>=1&&Ee<=7?Ee:1,qe=((new Date(Date.UTC(He.year,He.month-1,He.day)).getUTCDay()+6)%7+1-Ke+7)%7,et=new Date(Date.UTC(He.year,He.month-1,He.day-qe));return G({year:et.getUTCFullYear(),month:et.getUTCMonth()+1,day:et.getUTCDate()},Re)}return G({year:He.year,month:He.month,day:He.day},Re)}function he(ke,Ue){const Re=ke&&ke.group,Ee=Re&&Re.granularity||"day";if(Ee==="instant")return null;const He=Re&&Re.weekStart;return Ke=>typeof Ke=="number"?we(Ke,Ee,Ue,He):Ke}const be={time:{base:"number",storage:"float64",matches:a,format:ke=>b(f(ke.value),o(ke,"time")),parse:ke=>r(ke.text),compare:(ke,Ue)=>d(f(ke),f(Ue)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:ke=>{const Ue=f(ke);return Ue===null?null:Ue/I},toStorage:ke=>f(ke),toClipboard:h,fromClipboard:r},datetime:{base:"dateString",storage:"dictionary",matches:C,format:ke=>P(ke.value,o(ke,"datetime")),parse:ke=>L(S(ke.text,o(ke,"datetime"))??ke.text),compare:X,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(ke,Ue)=>L(ke,Ue&&Ue.timeZone),toClipboard:ke=>E(ke)?"":String(ke),fromClipboard:ke=>L(ke)},duration:{base:"number",storage:"float64",matches:Oe,format:ke=>de(re(ke.value),o(ke,"duration")),parse:ke=>te(ke.text,o(ke,"duration")),compare:(ke,Ue)=>d(re(ke),re(Ue)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:ke=>{const Ue=re(ke);return Ue===null?null:Ue/I},toStorage:ke=>re(ke),toClipboard:ke=>de(re(ke),{style:"short",maxUnits:-1}),fromClipboard:ke=>te(ke)},timestamp:{base:"number",storage:"float64",format:ke=>{const Ue=o(ke,"timestamp");return le(ke.value,{...Ue,timeZone:ve(Ue,ke)})},parse:ke=>{const Ue=o(ke,"timestamp"),Re=S(ke.text,{timeZone:ve(Ue,ke)});return Re?Re.getTime():null},compare:(ke,Ue)=>d(T(ke),T(Ue)),groupProjector:(ke,Ue)=>he(ke,Ue),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(ke,Ue)=>{const Re=T(ke);if(Re==null)return null;const Ee=A(Re,Ue&&Ue.timeZone||void 0);return(Date.UTC(Ee.year,Ee.month-1,Ee.day,Ee.hour,Ee.minute,Ee.second)-Me)/I},toStorage:ke=>T(ke),toClipboard:ke=>{const Ue=T(ke);return Ue==null?"":new Date(Ue).toISOString()},fromClipboard:ke=>T(ke)}},Te=["datetime","time","duration"],je=be}),ze("packages/core/src/internal/lru.js",function(e,_){"use strict";Object.defineProperty(e,"Lru",{enumerable:!0,get:function(){return ne}});class ne{#e;#t=new Map;#n;constructor(K=256,U=null){this.#e=K,this.#n=U}get size(){return this.#t.size}get max(){return this.#e}set max(K){this.#e=K,this.#r()}has(K){return this.#t.has(K)}get(K){const U=this.#t;if(!U.has(K))return;const D=U.get(K);return U.delete(K),U.set(K,D),D}peek(K){return this.#t.get(K)}set(K,U){const D=this.#t;return D.has(K)&&D.delete(K),D.set(K,U),this.#r(),U}delete(K){const U=this.#t.get(K);return this.#t.delete(K)&&this.#n&&this.#n(U,K),U}clear(){if(this.#n)for(const[K,U]of this.#t)this.#n(U,K);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const K=this.#t;for(;K.size>this.#e;){const U=K.keys().next().value,D=K.get(U);K.delete(U),this.#n&&this.#n(D,U)}}}}),ze("packages/core/src/columns/types/network.js",function(e,_){"use strict";Object.defineProperty(e,"toUint32",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"compareIpv4",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"packCidr",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"cidrParts",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isCidr",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"compareCidr",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"netmask",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"addressCount",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"ipv6Groups",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return T}});const E=_("packages/core/src/internal/predicates.js").isNil,U=_("packages/core/src/internal/lru.js").Lru,D=4294967295,J=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function z(O){if(E(O))return null;if(typeof O=="string")return L(O);const N=Number(O);return Number.isFinite(N)?N<0?N<-2147483648?null:N>>>0:N>D?null:Math.trunc(N)>>>0:null}function L(O){if(E(O))return null;const N=String(O).trim();if(N==="")return null;const P=J.exec(N);if(!P)return null;let C=0;for(let B=1;B<=4;B++){const x=P[B];if(x.length>1&&x.charCodeAt(0)===48)return null;const V=Number(x);if(V>255)return null;C=C*256+V}return C}function X(O){const N=z(O);return N===null?"":`${N>>>24&255}.${N>>>16&255}.${N>>>8&255}.${N&255}`}function I(O){return typeof O=="string"&&L(O)!==null}function j(O,N){const P=z(O),C=z(N);return P===null?C===null?0:1:C===null||P<C?-1:P>C?1:0}const k=64,y=D*k+32,l=/^(?:0|[1-9]\d?)$/;function g(O,N){return O*k+N}function s(O){if(E(O))return null;if(typeof O=="string"){const C=t(O);return C===null?null:s(C)}if(typeof O=="object"){const C=z(O.address),B=Number(O.prefix);return C===null||!Number.isInteger(B)||B<0||B>32?null:{address:C,prefix:B}}const N=Number(O);if(!Number.isInteger(N)||N<0||N>y)return null;const P=N%k;return P>32?null:{address:(N-P)/k,prefix:P}}function t(O){if(E(O))return null;const N=String(O).trim();if(N==="")return null;const P=N.indexOf("/");if(P<0)return null;const C=L(N.slice(0,P));if(C===null)return null;const B=N.slice(P+1).trim();if(!l.test(B))return null;const x=Number(B);return x>32?null:g(C,x)}function o(O){const N=s(O);return N?`${X(N.address)}/${N.prefix}`:""}function c(O){return typeof O=="string"&&t(O)!==null}function d(O,N){const P=s(O),C=s(N);return P?C?P.address!==C.address?P.address<C.address?-1:1:P.prefix-C.prefix:-1:C?1:0}function n(O){return O===0?0:4294967295<<32-O>>>0}function p(O){const N=s(O);return N?(N.address&n(N.prefix))>>>0:null}function i(O){const N=s(O);return N?(N.address&n(N.prefix)|~n(N.prefix)>>>0)>>>0:null}function r(O){const N=s(O);return N?2**(32-N.prefix):null}function f(O){const N=s(O);return N?N.prefix===32?1:N.prefix===31?2:2**(32-N.prefix)-2:null}function m(O,N){const P=s(O);if(!P)return!1;const C=z(N);if(C===null)return!1;const B=n(P.prefix);return(C&B)>>>0===(P.address&B)>>>0}function u(O,N){const P=p(O),C=p(N);return P===null||C===null?!1:P<=i(N)&&C<=i(O)}const b=/^[0-9a-fA-F]{1,4}$/,a=new U(512);function h(O){if(E(O))return null;let N=String(O).trim();if(N==="")return null;const P=N.indexOf("%");if(P>=0&&(N=N.slice(0,P)),N==="")return null;if(N.indexOf(".")>=0){const F=N.lastIndexOf(":");if(F<0)return null;const $=L(N.slice(F+1));if($===null)return null;N=`${N.slice(0,F+1)}${($>>>16&65535).toString(16)}:${($&65535).toString(16)}`}const C=N.split("::");if(C.length>2)return null;const B=w(C[0]);if(B===null)return null;if(C.length===1)return B.length===8?B:null;const x=w(C[1]);if(x===null)return null;const V=8-B.length-x.length;if(V<1)return null;const Y=B.slice();for(let F=0;F<V;F++)Y.push(0);for(const F of x)Y.push(F);return Y}function w(O){if(O==="")return[];const N=[];for(const P of O.split(":")){if(!b.test(P))return null;N.push(parseInt(P,16))}return N}function v(O){if(typeof O!="string")return h(O);if(a.has(O))return a.get(O);const N=h(O);return a.set(O,N),N}function A(O){if(O[0]===0&&O[1]===0&&O[2]===0&&O[3]===0&&O[4]===0&&O[5]===65535)return`::ffff:${X((O[6]<<16|O[7])>>>0)}`;let N=-1,P=0,C=-1,B=0;for(let Y=0;Y<8;Y++)O[Y]===0?(C<0?(C=Y,B=1):B++,B>P&&(P=B,N=C)):(C=-1,B=0);if(P<2)return O.map(Y=>Y.toString(16)).join(":");const x=O.slice(0,N).map(Y=>Y.toString(16)).join(":"),V=O.slice(N+P).map(Y=>Y.toString(16)).join(":");return`${x}::${V}`}function H(O){const N=h(O);return N===null?null:A(N)}function G(O){return H(O)??""}function Z(O){return typeof O=="string"&&O.indexOf(":")>=0&&h(O)!==null}function M(O,N){const P=v(O),C=v(N);if(!P)return C?1:0;if(!C)return-1;for(let B=0;B<8;B++)if(P[B]!==C[B])return P[B]<C[B]?-1:1;return 0}const S=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:I,parse:O=>L(O.text),compare:j,format:O=>X(O.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:O=>z(O),toClipboard:O=>X(O),fromClipboard:O=>L(O)},cidr:{base:"number",storage:"float64",matches:c,parse:O=>t(O.text),compare:d,format:O=>o(O.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:O=>{const N=s(O);return N===null?null:g(N.address,N.prefix)},toClipboard:O=>o(O),fromClipboard:O=>t(O)},ipv6:{base:"text",storage:"dictionary",matches:Z,parse:O=>H(O.text),compare:M,format:O=>G(O.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:O=>H(O),toClipboard:O=>G(O),fromClipboard:O=>H(O)}}),T=S}),ze("packages/core/src/i18n/catalogue.js",function(e,_){"use strict";Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return D}});const ne=_("packages/core/src/registry/free-tier-notice.js"),E=ne.FREE_TIER_NOTICE,K=ne.WATERMARK_TEXT,U=Object.freeze({"count.rows":{one:"{count} row",other:"{count} rows"},"count.comments":{one:"{count} comment",other:"{count} comments"},"comments.someUnresolved":"{comments}, {unresolved} unresolved","comments.allResolved":"{comments}, all resolved","count.unresolvedComments":{one:"{count} unresolved comment",other:"{count} unresolved comments"},"count.items":{one:"{count} item",other:"{count} items"},"count.keys":{one:"{count} key",other:"{count} keys"},"count.values":{one:"value",other:"values"},"count.waiting":{one:"{count} waiting",other:"{count} waiting"},"count.rowsAdded":{one:"{count} row added",other:"{count} rows added"},"count.rowsRemoved":{one:"{count} row removed",other:"{count} rows removed"},"value.empty":"empty","a11y.sort.cleared":"Sort cleared","a11y.sort.by":"Sorted by {columns}","a11y.sort.column":"{column} {direction}","a11y.sort.ascending":"ascending","a11y.sort.descending":"descending","a11y.filter.cleared":"Filter cleared, {rows}","a11y.filter.applied":"Filtered to {shown} of {total}","a11y.find.count":{one:"{current} of {count} match",other:"{current} of {count} matches"},"a11y.find.countLoaded":{one:"{current} of {count} match in loaded rows",other:"{current} of {count} matches in loaded rows"},"a11y.find.none":"No matches","a11y.find.noneLoaded":"No matches in loaded rows","a11y.selection.cleared":"Selection cleared","a11y.selection.count":{one:"{count} row selected",other:"{count} rows selected"},"tabs.tablist":"Tabs","a11y.tabs.selected":"{label} tab selected","a11y.scrollbar.horizontal":"Horizontal scrollbar","a11y.scrollbar.vertical":"Vertical scrollbar","designer.canvas":"Dashboard canvas","designer.chrome":"Designer tools","designer.page":"Page {n}","a11y.designer.edit":"Edit mode","a11y.designer.view":"View mode","layout.region":"Dashboard layout","layout.move":"Move {title}","layout.resize":"Resize {title}","layout.close":"Close {title}","a11y.layout.grabbed":"{title} grabbed, column {x} of {columns}, row {y}","a11y.layout.position":"{title}, column {x} of {columns}, row {y}","a11y.layout.dropped":"{title} dropped, column {x} of {columns}, row {y}","a11y.layout.cancelled":"{title} move cancelled","a11y.layout.resizeCancelled":"{title} resize cancelled","a11y.layout.reverted":"{title} returned to column {x}, row {y}","a11y.layout.resizeGrabbed":"{title} resize grabbed, {w} by {h} cells","a11y.layout.resizeStep":"{title}, {w} by {h} cells","a11y.layout.resized":"{title} resized to {w} by {h} cells","a11y.layout.closed":"{title} closed","layout.maximise":"Maximise {title}","layout.minimise":"Minimise {title}","layout.restore":"Restore {title}","a11y.layout.maximised":"{title} maximised, filling the dashboard; press Escape to restore it","a11y.layout.minimised":"{title} minimised","a11y.layout.restored":"{title} restored to column {x}, row {y}","a11y.group.cleared":"Grouping cleared","a11y.group.by":"Grouped by {columns}","a11y.group.expanded":"{label} expanded, {rows} shown","a11y.group.collapsed":"{label} collapsed, {rows} shown","a11y.page.position":"Page {page} of {pages}","a11y.updates.paused":"Updates paused","a11y.updates.resumed":"Updates resumed","a11y.edit.refusedOne":"Edit to {column} was refused and put back to {value}{reason}","a11y.edit.refusedMany":{one:"{count} edit was refused and put back{reason}",other:"{count} edits were refused and put back{reason}"},"a11y.edit.reason":", {reason}","a11y.history.undo":"Undid {label}","a11y.history.redo":"Redid {label}","a11y.history.undoLast":"Undid the last change","a11y.history.redoLast":"Redid the last change","a11y.column.cannotResize":"{column} cannot be resized","a11y.column.resized":"{column} is {width} pixels wide","a11y.column.atMinimum":"{column} is at its narrowest, {width} pixels","a11y.column.atMaximum":"{column} is at its widest, {width} pixels","a11y.column.cannotMove":"{column} cannot be moved","a11y.column.alreadyFirst":"{column} is already first in its group","a11y.column.alreadyLast":"{column} is already last in its group","a11y.column.cannotMoveThere":"{column} cannot be moved there","a11y.column.moved":"{column} moved to position {at} of {of}","a11y.group.formed":"{column} grouped with {other} in a new band","a11y.group.dissolved":"band {group} dissolved","a11y.group.renamed":"band renamed to {group}","a11y.group.moved":"band {group} moved to position {at} of {of}","a11y.column.addedToGroup":"{column} added to band {group}","a11y.column.removedFromGroup":"{column} removed from its band","a11y.column.notInGroup":"{column} is not in a band","a11y.column.cannotGroup":"{column} cannot be grouped","a11y.group.cannotMove":"band {group} cannot be moved there","columngroup.newGroup":"New group","columngroup.rename":"Rename band","columngroup.dissolve":"Dissolve band","columngroup.group":"Group with adjacent column","columngroup.untitled":"Untitled band","panel.bandCollapse":"Collapse band {band}","panel.bandExpand":"Expand band {band}","panel.bandVisible":"Show or hide every column in band {band}","panel.bandRenameFor":"Rename band {band}","panel.bandDissolveFor":"Dissolve band {band}","header.filter":"Filter {column}","header.menu":"Column menu for {column}","header.toggleGroup":"Toggle {group}","header.dragHint":"Drag {column} to reorder, or onto another column to group","header.dragRole":"draggable column header","header.group":"group","header.selectAllRows":"Select all rows","header.clearSelection":"Clear selection","cell.selectRow":"Select row","cell.detail.show":"Show detail","cell.detail.hide":"Hide detail","cell.detail.showInPane":"Show in the detail pane","cell.detail.showingInPane":"Showing in the detail pane","cell.group.expand":"Expand","cell.group.collapse":"Collapse","cell.delta.up":"up","cell.delta.down":"down","cell.delta.unchanged":"unchanged","cell.delta.moved":"{direction} {magnitude}","cell.delta.describedUnchanged":"{label}, unchanged","cell.delta.described":"{label}, {direction} by {magnitude}","cell.qr.of":"QR code for {text}","cell.qr.empty":"No QR code","cell.barcode.of":"Barcode for {text}","cell.barcode.empty":"No barcode","cell.barcode.invalid":"Invalid value for this barcode","cell.rating.of":"{rating} of {max}","cell.rating.empty":"Not rated","cell.stage.of":"Stage {current} of {total}: {label}","cell.stage.empty":"No stage","a11y.panel.cannotMove":"{column} cannot be moved","a11y.panel.alreadyFirst":"{column} is already first","a11y.panel.alreadyLast":"{column} is already last","a11y.panel.moved":"{column} moved to position {at} of {of}","a11y.panel.removedFrom":"{column} removed from {list}","a11y.panel.addedTo":"{column} added to {list}","a11y.panel.cannotAddTo":"{column} cannot be added to {list}","a11y.annotate.erased":"Annotation removed","a11y.annotate.noMarks":"No annotations to erase","a11y.annotate.focusedMark":"Mark {at} of {of} selected","a11y.annotate.confirmClear":"Clear all annotations? Choose Clear or Keep.","a11y.annotate.cleared":"All annotations cleared","a11y.range.written":{one:"{count} cell updated",other:"{count} cells updated"},"a11y.range.cleared":{one:"{count} cell cleared",other:"{count} cells cleared"},"paste.preview.title":"Review paste","paste.preview.summary":{one:"{changes} cell will change, {rejected} rejected.",other:"{changes} cells will change, {rejected} rejected."},"paste.preview.changesHeading":{one:"{count} change",other:"{count} changes"},"paste.preview.rejectedHeading":{one:"{count} rejected",other:"{count} rejected"},"paste.preview.colOld":"Current","paste.preview.colNew":"New","paste.preview.colCell":"Cell","paste.preview.colReason":"Reason","paste.preview.empty":"This paste would change nothing.","paste.preview.confirm":"Apply","paste.preview.cancel":"Cancel","paste.preview.reason.permission":"Not permitted","paste.preview.reason.readOnly":"Read-only","paste.preview.reason.validation":"Invalid value","paste.preview.reason.locked":"Being edited","paste.preview.reason.missing":"No such cell","a11y.paste.previewOpened":{one:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel.",other:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel."},"a11y.paste.cancelled":"Paste cancelled; nothing changed","status.total":"{rows}","status.counting":"Counting rows…","status.shownOfTotal":"{shown} of {total}","status.selected":"{count} selected","status.selectedAcrossSource":"{count} selected across the source","status.selectedAcrossSourceCounting":"All matching rows selected, counting…","status.count":"Count {count}","status.loading":"Loading {count}…","status.loadingOf":"Loading {loaded} of {total} ({percent}%)","status.stat.sum":"Sum","status.stat.min":"Min","status.stat.max":"Max","status.stat.avg":"Avg","status.paused":"Paused","status.pausedWaiting":"Paused · {waiting}","status.coalesced":"{count} coalesced","status.hiddenComments":"{comments} on hidden rows","pagination.label":"Pagination","pagination.first":"First page","pagination.previous":"Previous page","pagination.next":"Next page","pagination.last":"Last page","pagination.page":"Page","pagination.ofPages":"of {pages}","pagination.summary":"{from}–{to} of {total}","pagination.pageSize":"Rows per page","pagination.range":"{from}–{to}","pagination.counting":"{from}–{to}, counting…","pagination.jump":"Page number, press Enter to jump","pagination.jumpBounded":"Page number, 1 to {pages}, press Enter to jump","panel.columns":"Columns","panel.filters":"Filters","panel.views":"Views","panel.quickFilter":"Quick filter","find.label":"Find in grid","find.placeholder":"Find in grid","find.next":"Next match","find.previous":"Previous match","find.close":"Close find","find.matchCase":"Match case","find.wholeCell":"Whole cell","find.columnScope":"Search in","find.allColumns":"All columns","find.count":"{current} of {total}","find.countPartial":"{current} of {total} so far","find.none":"No matches","find.searching":"Searching…","find.loadedRows":"in loaded rows","panel.formatting":"Formatting","panel.statistics":"Statistics","stat.noData":"No data","stat.tone.good":"good","stat.tone.bad":"bad","stat.tone.flat":"flat","panel.regression":"Regression","panel.compare":"Compare","panel.insights":"Insights","panel.compareGroups":"Compare groups","panel.explain":"Explain","insights.subset":"Filtered subset vs whole","insights.dataset":"This grid vs another dataset","insights.groups":"Group comparison","insights.noFilter":"Filter the grid to compare the subset against the whole.","insights.by":"Group by","insights.test":"Test","insights.effect":"Effect size","insights.interval":"Confidence interval","insights.pValue":"p-value","insights.smallSample":"small sample — interpret with care","insights.needGroups":"Choose two columns with groups to compare.","compareGroups.noTest":"Not enough readings, or no variation, in at least one group.","insights.empty":"No columns to analyse.","insights.anomalies":"Anomalies","insights.anomalyCount":"{count} flagged of {n}","insights.anomalyMethod":"Method","insights.anomalyThreshold":"Threshold","anomaly.chip":"{count} anomalies flagged","anomaly.chipActive":"Showing {count} anomalies — clear","compare.first":"First column","compare.second":"Second column","compare.needTwo":"Two numeric columns are needed to compare","compare.noPairs":"No rows have a value in both","compare.pairs":"{count} pairs","compare.pearson":"Correlation (Pearson)","compare.spearman":"Rank correlation (Spearman)","compare.kendall":"Kendall’s tau","compare.covariance":"Covariance","compare.slope":"Slope","compare.intercept":"Intercept","compare.r2":"R²","compare.stdError":"Standard error","compare.weighted":"Weighted average","panel.zone.group":"row groups","panel.zone.values":"values","panel.zone.pivot":"pivot columns","groupZone.label":"Row groups","groupZone.title":"Group by","groupZone.hint":"Drag a column here to group rows by its values","groupZone.chip":"{column}, group {at} of {of}","groupZone.remove":"Stop grouping by {column}","groupZone.add":"Add a group","total.sum":"Sum","total.avg":"Average","total.min":"Min","total.max":"Max","total.count":"Count","total.countValues":"Count of values","total.first":"First","total.last":"Last","total.custom":"Total","total.median":"Median","total.p25":"25th percentile","total.p75":"75th percentile","total.p90":"90th percentile","total.p95":"95th percentile","total.p99":"99th percentile","total.iqr":"Interquartile range","total.mad":"Median absolute deviation","total.variance":"Variance","total.varianceP":"Variance (population)","total.stddev":"Standard deviation","total.stddevP":"Standard deviation (population)","total.range":"Range","total.distinct":"Distinct","total.mode":"Mode","total.skewness":"Skewness","total.kurtosis":"Kurtosis","total.geomean":"Geometric mean","total.harmean":"Harmonic mean","total.sumSquares":"Sum of squares","total.weightedAvg":"Weighted average","total.argmin":"Lowest by","total.argmax":"Highest by","total.hhi":"Concentration (HHI)","total.entropy":"Entropy","total.evenness":"Evenness","total.top3Share":"Top 3 share","total.top10Share":"Top 10 share","total.gini":"Gini coefficient","total.trimmedMean":"Trimmed mean","total.winsorizedMean":"Winsorized mean","total.robustOutliers":"Outliers (robust)","total.jarqueBera":"Jarque–Bera","total.passRate":"Pass rate","total.failureCount":"Failures","stats.column":"Column","stats.choose":"Choose a column to profile","stats.noColumns":"No numeric columns to profile","stats.noValues":"Nothing numeric in this column","stats.count":"Count","stats.present":"Present","stats.missing":"Missing","stats.distinct":"Distinct","stats.min":"Minimum","stats.max":"Maximum","stats.mean":"Mean","stats.median":"Median","stats.q1":"Lower quartile","stats.q3":"Upper quartile","stats.iqr":"Interquartile range","stats.stddev":"Standard deviation","stats.outliers":"Outliers","stats.distribution":"Distribution","stats.distribution.detail":"Distribution: rows per range","stats.bin":"{count} between {from} and {to}","stats.topValues":"Top values","stats.section.shape":"Shape","stats.section.robust":"Robust","stats.section.concentration":"Concentration","stats.section.capability":"Capability","stats.cp":"Cp","stats.cpk":"Cpk","stats.pp":"Pp","stats.ppk":"Ppk","stats.outOfSpec":"Out of specification","stats.filtered":"Over the {count} filtered rows","stats.unavailable":"Not computed by the source: {stats}.","stats.unavailable.notPlain":"`{column}` is not a plain column the engine can name","stats.unavailable.where":"a `where` predicate is in force ({list}), which only the browser can run","stats.unavailable.filter":"the grid's filter did not fully push to the engine","stats.unavailable.quick":"the quick search did not push to the engine","stats.unavailable.client":'the source did not compute "{fn}" in the engine ({reason}); set the pushdown source\'s `{setting}`',"stats.unavailable.outliers":"the count of values outside Tukey's fences is not an engine aggregate","stats.unavailable.histogram":"the shape of the column is not an engine aggregate","stats.unavailable.topValues":"the source did not answer a grouped count in the engine","explain.column":"Value","explain.by":"Break down by","explain.byRow":"Each row","explain.noColumns":"No numeric columns to explain","explain.unavailable":"Nothing to explain in this column","explain.total":"{fn}: {total}","explain.weighted":"weighted effects","explain.single":"one contributor","explain.delta":"was {before}, now {after} (Δ {delta})","explain.breakdown":"Contributors","explain.contributor":"Contributor","explain.count":"Rows","explain.value":"Value","explain.contribution":"Contribution","explain.share":"Share","explain.change":"Change","explain.before":"Before","explain.after":"After","explain.effect":"Effect","explain.kind.new":"New","explain.kind.dropped":"Dropped","explain.kind.changed":"Changed","explain.narrative":"Explanation","explain.narrative.lead":"{top} accounts for {share}; the {fn} is {total}.","explain.narrative.next":"{next} follows at {share}.","explain.narrative.driver":"The change of {delta} was driven most by {top} ({effect}).","explain.narrative.driverNext":"{next} ({kind}) moved it {effect}.","explain.narrative.none":"Nothing contributed to this total.","explain.narrative.noChange":"Nothing changed between the two states.","regression.noModel":"No model configured. Set predictors and a response on the panel.","regression.cannotFit":"The model cannot be fitted over the current rows.","regression.observations":"Fitted over {count} rows","regression.r2":"R²","regression.adjR2":"Adjusted R²","regression.coefficients":"Coefficients","regression.term":"Term","regression.estimate":"Estimate ± SE","regression.stdError":"Std error","regression.t":"t","regression.p":"p","regression.vif":"Variance inflation (VIF)","regression.heteroscedasticity":"Heteroscedasticity (Breusch–Pagan)","regression.heteroscedastic":"Heteroscedastic: BP {statistic}, p {p}","regression.homoscedastic":"No heteroscedasticity detected: BP {statistic}, p {p}","menu.sortAscending":"Sort ascending","menu.sortDescending":"Sort descending","menu.clearSort":"Clear sort","menu.groupBy":"Group by this column","menu.ungroup":"Stop grouping by this column","menu.hideColumn":"Hide column","menu.pinStart":"Pin to start","menu.pinEnd":"Pin to end","menu.unpin":"Unpin","menu.autosize":"Fit to content","ai.valuesNotAmongOptions":'{values} {shown} not among the options for "{column}"',"menu.clearCells":{one:"Clear cell",other:"Clear {count} cells"},"menu.fillDown":"Fill down","menu.copy":"Copy","menu.copyWithHeaders":"Copy with headers","menu.paste":"Paste","menu.filterEllipsis":"Filter…","menu.columnStatistics":"Column statistics","menu.compareGroups":"Compare groups","menu.explain":"Explain this number","menu.pinColumn":"Pin column","menu.sizeToFit":"Size to fit content","menu.sizeAllToFit":"Size all columns to fit","menu.width":"Width","menu.narrower":"Narrower","menu.wider":"Wider","menu.moveColumn":"Move column","menu.moveLeft":"Move left","menu.moveRight":"Move right","menu.moveToStart":"Move to start","menu.moveToEnd":"Move to end","menu.unpivot":"Remove from pivot","menu.pivotBy":"Pivot by this column","menu.stopTotalling":"Stop totalling","menu.totalColumn":"Total this column","menu.aggregate":"Aggregate","menu.aggregateNone":"None","menu.aggregateGroup":"Group subtotals","menu.aggregateGrand":"Grand total","menu.aggregateSame":"Same as total","menu.redactColumn":"Redact column","menu.stopRedacting":"Stop redacting","menu.stopRedactingAll":"Stop redacting everything","menu.sortGroupsAscending":"Sort groups ascending","menu.sortGroupsDescending":"Sort groups descending","menu.filterGroups":"Filter groups…","menu.expandAll":"Expand all","menu.collapseAll":"Collapse all","menu.clearGrouping":"Clear grouping","menu.colour":"Colour","menu.importCsv":"Import rows from CSV…","import.title":"Import rows","import.clipboard":"the clipboard","import.summary":{one:"{count} row from {name}",other:"{count} rows from {name}"},"import.opened":{one:"Import preview open, {count} row",other:"Import preview open, {count} rows"},"import.done":{one:"{count} row imported",other:"{count} rows imported"},"import.confirm":"Import","import.cancel":"Cancel","import.colSource":"Column","import.colField":"Maps to","import.colType":"Type","import.skip":"— skip —","import.mapLabel":'Map "{source}" to a field',"import.modeLabel":"On import","import.sheetLabel":"Sheet","import.append":"Add to existing rows","import.replace":"Replace all rows","menu.deleteRow":{one:"Delete row",other:"Delete {count} rows"},"toolbar.undo":"Undo","toolbar.redo":"Redo","toolbar.undoLabelled":"Undo {label}","toolbar.redoLabelled":"Redo {label}","toolbar.exportCsv":"Export to CSV","toolbar.exportExcel":"Export to Excel","toolbar.clipboard":"Copy visible rows to the clipboard","toolbar.print":"Print","toolbar.pause":"Hold incoming updates","toolbar.resume":"Resume updates","toolbar.applyHeld":{one:"Apply {count} held update",other:"Apply {count} held updates"},"toolbar.restoreView":"Restore the default view","toolbar.maximiseGrid":"Maximise the grid to fill the window","toolbar.restoreSize":"Restore the grid to the page (Esc)","toolbar.annotate.pen":"Draw freehand","toolbar.annotate.arrow":"Draw an arrow","toolbar.annotate.rect":"Draw a rectangle","toolbar.annotate.highlight":"Highlight","toolbar.annotate.erase":"Erase","toolbar.annotate.clearAll":"Clear all annotations","toolbar.annotate.clearAllConfirm":"Clear","toolbar.annotate.clearAllKeep":"Keep","overlay.noRows":"No rows to show","overlay.noResults":"No rows match the current filters","overlay.loading":"Loading…","overlay.error":"Something went wrong","overlay.loadingRows":"Loading rows {from} to {to}","overlay.rowError":"Failed to load","comments.panel":"Cell comments","comments.close":"Close comments","comments.write":"Write a comment","comments.post":"Comment","comments.delete":"Delete","comments.valueMoved":"Written when the value was {was}: it is now {now}.","comments.resolve":"Resolve","comments.reopen":"Reopen","comments.loading":"Loading…","comments.empty":"No comments yet.","comments.unknownAuthor":"Unknown","comments.edited":"{time} (edited)","comments.cellTitle":"{column}: {row}","presence.hidden":{one:"{count} not in view",other:"{count} not in view"},"presence.someoneElse":"someone else","a11y.presence.refused":"This cell is being edited by {name}","presence.peer":"{name}: jump to their cursor","presence.peerIdle":"{name}, idle: jump to their cursor","presence.peerHidden":"{name}, not in the current view","facets.filter":"{column} distribution filter","header.totalOf":"{total} of {column}","diff.before":"Was: {value}","diff.empty":"(empty)","kanban.columnCards":{one:"{title}, {count} card",other:"{title}, {count} cards"},"kanban.laneCards":{one:"{lane}, {title}, {count} card",other:"{lane}, {title}, {count} cards"},"kanban.blocked":"Blocked","kanban.ready":"Ready","kanban.blockedBy":{one:"blocked by {count} card",other:"blocked by {count} cards"},"kanban.card.assignedTo":"Assigned to {names}","kanban.card.overdue":"Overdue","kanban.card.dueSoon":"Due soon","kanban.card.progress":"{percent}% complete","kanban.card.checklist":"{done} of {total} done","gantt.lag":"+{days}d","gantt.lead":"{days}d","gantt.a11y.moved":"{name} moved to {date}","gantt.a11y.day":"day {day}","gantt.a11y.resized":"{name} resized to {days} days","gantt.a11y.linkFrom":"Linking from {name}. Focus the successor and press L.","gantt.a11y.linked":"Linked {from} to {to}, finish to start.","gantt.a11y.linkCancelled":"Link cancelled.","gantt.a11y.deleted":"{name} deleted.","gantt.a11y.readOnly":"Read-only.","gantt.row.moveHandle":"Drag to reorder or re-parent {name}","gantt.a11y.rowMoved":"{name} moved.","gantt.a11y.rowReparented":"{name} moved under {parent}.","gantt.a11y.rowPromoted":"{name} moved to the top level.","gantt.a11y.rowMoveCancelled":"Move cancelled.","gantt.a11y.copied":"{count} tasks copied.","gantt.a11y.cut":"{count} tasks cut.","gantt.a11y.pasted":"{count} tasks pasted.","gantt.task.newName":"New task","gantt.a11y.taskAdded":"{name} added.","gantt.menu.addAbove":"Add task above","gantt.menu.addBelow":"Add task below","gantt.menu.addChild":"Add subtask","gantt.menu.addSuccessor":"Add successor","gantt.menu.addPredecessor":"Add predecessor","gantt.menu.toMilestone":"Convert to milestone","gantt.menu.toTask":"Convert to task","gantt.menu.delete":"Delete task","gantt.a11y.linkCycle":"Linking {from} to {to} would create a cycle; link not created.","gantt.a11y.linkCreated":"{from} linked to {to}, {type}.","gantt.a11y.linkDeleted":"Link from {from} to {to} deleted.","gantt.a11y.linkLabel":"Link, {from} to {to}, {type}","gantt.linkEditor.title":"Edit link from {from} to {to}","gantt.linkEditor.type":"Link type","gantt.linkEditor.lag":"Lag, in days","gantt.linkEditor.apply":"Apply","gantt.linkEditor.delete":"Delete link","gantt.linkEditor.cancel":"Cancel","gantt.a11y.undone":"Undone.","gantt.a11y.redone":"Redone.","gantt.a11y.nothingToUndo":"Nothing to undo.","gantt.a11y.nothingToRedo":"Nothing to redo.","gantt.workload.title":"Resource workload","gantt.workload.resource":"Resource","gantt.workload.total":"Total","gantt.workload.unassigned":"Unassigned","gantt.workload.ungrouped":"No group","gantt.workload.cell":"{hours} h from {date}","gantt.workload.over":"{hours} h from {date}, over a capacity of {capacity} h","gantt.workload.expand":"Show {name}’s tasks","gantt.workload.collapse":"Hide {name}’s tasks","gantt.workload.expandGroup":"Show the {name} group","gantt.workload.collapseGroup":"Hide the {name} group","gantt.workload.unitToggle":"Hours / % / Cost","gantt.workload.unitHours":"Showing hours","gantt.workload.unitPercent":"Showing percent of capacity","gantt.workload.unitCost":"Showing cost","gantt.workload.cellPercent":"{percent}% from {date}","gantt.workload.overPercent":"{percent}% from {date}, over capacity","gantt.workload.cellNoCapacity":"No available hours from {date}","gantt.workload.cellCost":"{cost} from {date}","gantt.workload.otherProjectLabel":"{name} (other project)","gantt.workload.external":"External booking","gantt.a11y.hoursSet":"{name}: {hours} h from {date}","gantt.a11y.hoursCleared":"{name}: no hours from {date}","gantt.a11y.hoursRefused":"{date} is not a working day; {name} was not changed.","gantt.histogram.title":"Resource histogram","gantt.histogram.tableTitle":"Resource histogram data","gantt.histogram.resource":"Resource","gantt.histogram.period":"Period","gantt.histogram.hours":"Hours","gantt.histogram.percent":"Percent of capacity","gantt.histogram.cost":"Cost","gantt.histogram.capacity":"Capacity","gantt.histogram.overAllocated":"Over-allocated","gantt.histogram.yes":"Yes","gantt.histogram.no":"No","gantt.histogram.tip":"{name}, {from} to {to}: {value}{capacity}{tasks}","gantt.histogram.tipHours":"{hours} h","gantt.histogram.tipPercent":"{percent}% of capacity","gantt.histogram.tipCost":"{cost}","gantt.histogram.tipCapacity":", capacity {hours} h","gantt.histogram.tipTasks":" ({tasks})","gantt.histogram.tipOver":", over capacity","gantt.histogram.tipNoCapacity":"no available hours","gantt.picker.title":"Assign resources to {name}","gantt.picker.open":"Edit assignments for {name}","gantt.picker.search":"Search resources","gantt.picker.list":"Resources","gantt.picker.selected":"Assigned resources","gantt.picker.load":"{load}% booked of {capacity}% over these dates","gantt.picker.none":"No matching resources","gantt.picker.units":"{name}, units in percent","gantt.picker.remove":"Remove {name}","gantt.picker.apply":"Apply","gantt.picker.cancel":"Cancel","gantt.picker.warn":"{name} would be over-allocated: {load}% booked of {capacity}%","gantt.picker.ok":"No resource would be over-allocated","gantt.picker.assign":"Assign","gantt.col.effort":"Effort","gantt.col.units":"Units","gantt.unscheduled":"Unscheduled","gantt.col.unscheduled":"Unscheduled","gantt.inactive":"Inactive","gantt.col.inactive":"Inactive","gantt.col.slack":"Slack","gantt.col.deadline":"Deadline","gantt.col.constraint":"Constraint","gantt.col.constraintDate":"Constraint date","gantt.col.earlyStart":"Early start","gantt.col.lateStart":"Late start","gantt.col.lateFinish":"Late finish","gantt.col.baselineStart":"Baseline start","gantt.col.baselineEnd":"Baseline finish","gantt.col.variance":"Variance","gantt.col.note":"Note","gantt.col.sequence":"#","gantt.col.predecessors":"Predecessors","gantt.col.successors":"Successors","gantt.link.invalid":"Cannot read “{token}” as a link. Write a task number, a type and a lag, like 3FS+2; links not changed.","gantt.link.unknownRef":"No task is numbered “{token}”; links not changed.","gantt.link.self":"“{token}” links a task to itself; links not changed.","gantt.link.duplicate":"“{token}” repeats a link already listed; links not changed.","gantt.link.cycle":"“{token}” would create a cycle; links not changed.","gantt.constraint.ASAP":"As soon as possible","gantt.constraint.MSO":"Must start on","gantt.constraint.MFO":"Must finish on","gantt.constraint.ALAP":"As late as possible","gantt.constraint.SNET":"Start no earlier than","gantt.constraint.SNLT":"Start no later than","gantt.constraint.FNET":"Finish no earlier than","gantt.constraint.FNLT":"Finish no later than","gantt.row.ancestor":"Shown because a task inside it matches the filter","gantt.progress.handle":"Drag to set the progress of {name}","gantt.a11y.progress":"{name} {percent}% complete","gantt.col.name":"Task name","gantt.col.start":"Start","gantt.col.end":"Finish","gantt.col.duration":"Duration","gantt.col.assignee":"Assignee","gantt.col.progress":"%","gantt.col.wbs":"WBS","gantt.zoom.label":"Zoom","gantt.zoom.day":"Day","gantt.zoom.week":"Week","gantt.zoom.month":"Month","gantt.zoom.quarter":"Quarter","gantt.zoom.fit":"Fit to plan","gantt.tip.range":"{from} to {to}","gantt.tip.duration":"{days}d","gantt.tip.slack":"slack {days}d","gantt.tip.effort":"{hours}h","gantt.tip.row":"{label}: {value}","gantt.tip.start":"Start","gantt.tip.end":"End","gantt.tip.date":"Date","gantt.tip.durationLabel":"Duration","gantt.tip.durationValue":"{days} days","gantt.tip.complete":"Complete","gantt.tip.effortLabel":"Effort","gantt.tip.effortValue":"{hours} h","gantt.tip.assigned":"Assigned","gantt.tip.cost":"Cost","gantt.tip.slackLabel":"Slack","gantt.tip.slackValue":"{days} days","gantt.tip.deadline":"Deadline","gantt.mode.fixedDuration":"Fixed duration","gantt.mode.fixedEffort":"Fixed effort","gantt.mode.fixedUnits":"Fixed units","gantt.scurve.spi":"SPI {index}","gantt.scurve.cpi":"CPI {index}","gantt.print.page":"Page {page} of {pages}","gantt.print.printed":"Printed {date}","gantt.dataBand.title":"Data band","gantt.dataBand.name":"Task","gantt.dataBand.resource":"Resource","gantt.dataBand.total":"Total","gantt.dataBand.unassigned":"Unassigned","gantt.dataBand.collapse":"Collapse {name}","gantt.dataBand.expand":"Expand {name}","gantt.dataBand.cell":"{name}, {date}: {value}","gantt.issues.title":"Scheduling conflicts","gantt.issues.empty":"No scheduling conflicts","gantt.issues.count":"{count} scheduling conflicts","gantt.issues.toggle":"Toggle the conflicts panel","gantt.issues.cycle":"Circular dependency: {tasks}","gantt.issues.constraint":"{task} cannot meet its {constraint} constraint of {date}","gantt.issues.lock":"{task} is locked but a dependency would move it","gantt.issues.deadline":"{task} finishes after its deadline of {date}","gantt.issues.fixRemoveLink":"Remove link","gantt.issues.fixAsap":"Set as soon as possible","gantt.issues.fixUnlock":"Unlock task","gantt.issues.fixClearDeadline":"Clear deadline","gantt.resize.startHandle":"Drag to change the start of {name}","gantt.a11y.resizedStart":"{name} start moved to {date}, now {days} days","gantt.a11y.startEdge":"Start edge can be resized: drag the left edge, or press Ctrl+Shift+Left or Right.","gantt.a11y.chain":"Dependency chain highlighted: {preds} predecessors, {succs} successors.","timeline.scrub":"Scrub through recent changes","timeline.goLive":"Go live","timeline.returnToPresent":"Return to the present","a11y.fillHandle":"Drag to fill","panel.icons":"Icons","value.tooLong":"Too long","dataview.label":"Items","dataview.empty":"No items","dataview.reorder.sorted":"Items cannot be reordered while the view is sorted","dataview.reorder.filtered":"Items cannot be reordered while a filter is applied","shortcuts.title":"Keyboard shortcuts","shortcuts.close":"Close keyboard shortcuts","shortcuts.hint":"Press Escape to close.","shortcuts.or":"or","a11y.reorder.moved":"Moved to position {position} of {total}","a11y.reorder.sorted":"Rows cannot be reordered while the grid is sorted","a11y.reorder.filtered":"Rows cannot be reordered while a filter is applied","a11y.reorder.grouped":"Rows cannot be reordered while the grid is grouped","a11y.reorder.grab":"Reorder row","a11y.reorder.sortedManual":"Rows cannot be reordered while the grid is sorted. Press Alt+Shift+M, or the Manual order button in the heading, to order them by hand","a11y.reorder.groupDerived":"The row cannot join that group: the group is worked out from the value, so there is no single value to give it","a11y.reorder.groupReadOnly":"The row cannot join that group: its grouping value cannot be edited","a11y.reorder.invalid":"The row cannot join that group: the new value was not valid","a11y.reorder.vetoed":"The move was declined; the row stays where it was","a11y.reorder.vetoedBecause":"The move was declined ({reason}); the row stays where it was","a11y.reorder.refused":"The row cannot be moved there","a11y.reorder.regrouped":"Moved into {group}","a11y.tree.dropRefusedDescendant":"A row cannot be dropped into one of its own descendants; the row stays where it was","a11y.rowOrder.entered":"Manual order: the rows keep their places and can be moved by hand","a11y.rowOrder.exited":"Manual order ended; the rows follow the sort","rowOrder.button":"Manual order","rowOrder.enter":"Order the rows by hand instead of by the sort","rowOrder.exit":"Return to the sorted order","a11y.transfer.moved":"Row moved to the other grid","a11y.transfer.copied":"Row copied to the other grid","a11y.transfer.refused":"That grid does not accept this row","a11y.transfer.declined":"The drop was declined; the row stays where it was","a11y.transfer.stale":"The drop target changed while it was being confirmed; the row stays where it was","shortcuts.group.grid":"In the data","shortcuts.group.header":"On a column heading","shortcuts.group.panel":"In the column list","shortcut.moveCell":"Move the focused cell","shortcut.rowEnds":"First / last cell of the row","shortcut.gridEnds":"First cell of the first row / last cell of the last row","shortcut.pageRows":"Move one viewport of rows","shortcut.nextCell":"Leave the grid for the next / previous focusable element (arrows move between cells)","shortcut.undo":"Undo the last edit, paste, fill or clear","shortcut.redo":"Redo the step that was undone","shortcut.startEdit":"Start editing the focused cell","shortcut.toggleRow":"Toggle selection of the focused row","shortcut.cancel":"Cancel the current edit or drag","shortcut.expandCollapse":"Expand / collapse a group or tree row","shortcut.focusHeader":"Move focus to the column header","shortcut.focusPanel":"Move focus to the tool panel","shortcut.explain":"Explain the focused column","shortcut.contextMenu":"Open the context menu for the focused cell","shortcut.moveRow":"Move the focused row, when row reorder is enabled","shortcut.manualOrder":"Order the rows by hand, or return to the sort, when row reorder allows a manual order","shortcut.headingMove":"Move between headings","shortcut.headingEnds":"First / last heading","shortcut.headingSort":"Sort by the column, Shift to add to the sort","shortcut.headingResize":"Resize the column, Ctrl for a coarse step","shortcut.headingAutosize":"Size the column to its content","shortcut.headingReorder":"Move the column","shortcut.headingMenu":"Open the column menu","shortcut.headingExit":"Return focus to the data","shortcut.listGroup":"Group by the column, or stop grouping by it","shortcut.listValues":"Add the column to values, or take it out","shortcut.listPivot":"Pivot by the column, or stop pivoting by it","shortcut.listMove":"Move the column","shortcut.find":"Find in the grid","tags.label":"Show columns","tags.all":"All columns","tags.showing":"Showing {tag}","form.title":"Edit row","form.save":"Save","form.cancel":"Cancel","form.loading":"Loading…","form.loadFailed":"Could not load this record.","form.loadTimeout":"The record did not arrive in time.","form.retry":"Try again","form.choose":"Choose…","form.newTitle":"New row","form.createFailed":"Could not add this record.","form.grid.cellInvalid":"Row {row}, {column}: {message}","form.grid.required":"Add at least one row.","form.grid.addRow":"Add row","form.grid.deleteRow":"Delete row","form.grid.total":"Total","form.grid.rowControls":"Row controls","presentation.cards":"Showing records as cards","presentation.table":"Showing records as a table","editor.format":"Format","editor.codeHint":"Tab indents · Esc cancels · Ctrl+Enter saves","editor.colours":"Colours","editor.customColour":"Custom colour","editor.hexValue":"Hex value","editor.hexPlaceholder":"#rrggbb","editor.clearColour":"Clear colour","editor.time":"Time","editor.noIcon":"No icon","editor.selectAll":"Select all","editor.passwordHint":"Enter the value twice to save it.","editor.clearRating":"Clear rating","editor.clear":"Clear","editor.value":"Value","editor.currency":"Currency","editor.richtext.formatting":"Formatting","editor.richtext.richText":"Rich text","editor.richtext.placeholder":"Start writing…","editor.richtext.linkLabel":"Link address","editor.richtext.linkPlaceholder":"https://","editor.richtext.linkAdd":"Add link","editor.richtext.bold":"Bold (Ctrl+B)","editor.richtext.italic":"Italic (Ctrl+I)","editor.richtext.underline":"Underline (Ctrl+U)","editor.richtext.strike":"Strikethrough","editor.richtext.heading":"Paragraph style","editor.richtext.alignLeft":"Align left","editor.richtext.alignCenter":"Align centre","editor.richtext.alignRight":"Align right","editor.richtext.ul":"Bulleted list","editor.richtext.ol":"Numbered list","editor.richtext.color":"Text colour","editor.richtext.link":"Link (Ctrl+K)","editor.richtext.image":"Insert image","editor.richtext.clear":"Clear formatting","editor.richtext.source":"HTML source","editor.richtext.undo":"Undo (Ctrl+Z)","editor.richtext.redo":"Redo (Ctrl+Y)","formatting.format":"Format","formatting.noRules":"No rules yet. The first one that matches a cell wins.","formatting.clearAll":"Clear all","formatting.addRule":"Add rule","formatting.condition":"Condition","formatting.value":"Value","formatting.secondValue":"Second value","formatting.moveEarlier":"Move earlier","formatting.moveLater":"Move later","formatting.ruleKind":"Rule type","formatting.aCondition":"A condition","formatting.aColourScale":"A colour scale","formatting.compare":"Compare a value","formatting.distribution":"By the distribution","formatting.colourScale":"Colour scale","formatting.scaleBounds":"Scale bounds","formatting.preview":"Preview","formatting.livePreview":"Live preview","history.title":"History","history.show":"Show history","history.empty":"Nothing to undo yet.","prompt.ask":"Ask","prompt.apply":"Apply","prompt.discard":"Discard","panel.searchColumns":"Search columns","panel.searchColumnsPlaceholder":"Search columns…","panel.searchColumnsToFilter":"Search columns to filter","panel.showAll":"Show all","panel.hideAll":"Hide all","panel.clearAll":"Clear all","panel.clear":"Clear","panel.filterAllColumns":"Filter all columns","panel.columnFiltered":"This column is filtered","panel.clearFilterOn":"Clear the filter on {column}","panel.clearFilter":"Clear this filter","panel.filterEmptyNoMatch":"No column matches “{query}”.","panel.filterEmptyNone":"No column on this grid can be filtered.","panel.filterSummaryActive":"{active} of {total} columns filtered","panel.filterSummaryNone":"No filters · {total} columns available","panel.filterBy":"Filter by {column}","panel.filteredBy":"Filtered by {column}","panel.columnDragHint":"Drag {column} into a zone above, or onto another column to reorder","panel.gridActions":"Grid actions","panel.tabActiveCount":{one:"{title}, {count} active",other:"{title}, {count} active"},"panel.tabActive":"{title}, active","views.default":"Default","views.namePlaceholder":"Name this view…","views.nameLabel":"Name for the current layout","views.save":"Save view","licence.watermark":K,"licence.watermark.free":E,"filter.op.contains":"Contains","filter.op.notContains":"Does not contain","filter.op.equals":"Equals","filter.op.notEqual":"Does not equal","filter.op.startsWith":"Starts with","filter.op.endsWith":"Ends with","filter.op.blank":"Is blank","filter.op.notBlank":"Is not blank","filter.op.lessThan":"Less than","filter.op.lessThanOrEqual":"Less than or equal","filter.op.greaterThan":"Greater than","filter.op.greaterThanOrEqual":"Greater than or equal","filter.op.inRange":"In range","filter.op.matches":"Matches","filter.op.before":"Before","filter.op.after":"After","filter.op.relative":"Relative to today","filter.rel.today":"Today","filter.rel.yesterday":"Yesterday","filter.rel.tomorrow":"Tomorrow","filter.rel.lastNDays":"Last N days","filter.rel.nextNDays":"Next N days","filter.rel.thisWeek":"This week","filter.rel.lastWeek":"Last week","filter.rel.thisMonth":"This month","filter.rel.lastMonth":"Last month","filter.rel.thisQuarter":"This quarter","filter.rel.quarterToDate":"Quarter to date","filter.rel.thisYear":"This year","filter.rel.yearToDate":"Year to date","filter.operator":"Operator","filter.join":"Join","filter.value":"Value","filter.from":"From","filter.to":"To","filter.addCondition":"Add condition","filter.noConditions":"No conditions","filter.removeCondition":"Remove condition","filter.search":"Search","filter.searchValues":"Search values","filter.noMatches":"No values match","filter.selectAll":"Select all","filter.clear":"Clear","filter.all":"All","filter.allExcept":"All but {count}","filter.loadingValues":"Loading values…","filter.topValues":"Top {shown} of {total} values","filter.valuesFailed":"Values could not be loaded: {error}","filter.valuesUnsupported":"This source cannot list the values of {column}; filter by condition instead.","filter.true":"True","filter.false":"False","filter.expression":"Filter expression","filter.column":"Column","filter.relativePeriod":"Relative period","filter.days":"Number of days","filter.tab.set":"Values","filter.tab.text":"Text","filter.tab.number":"Number","filter.tab.date":"Date","filter.tab.advanced":"Advanced","filterRow.label":"Filter row","filterRow.conditions":{one:"{count} condition",other:"{count} conditions"},"chart.empty":"Nothing to chart","chart.summary":"{type} chart of {measure} by {dimension}","chart.summaryShare":"{type} chart of {measure}","chart.summaryType":"{type} chart","chart.summaryGauge":"{type} chart of {measure}, {fn}: {value}","chart.waterfallTotal":"Total","chart.summaryEngine":"Figures computed by the data engine over every matching row","chart.summaryEngineViewport":"{count} points in this view, fetched from the data engine","chart.summaryEngineDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells counted by the data engine","chart.summaryClientDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells computed in the browser","chart.viewportOverCap":"{count} rows in this view, more than the {cap} this map draws; zoom in or narrow the filter","chart.dataTable":"Chart data","chart.viewportFilter.label":"Map view","chart.annotate.rail":"Drawing tools","chart.annotate.select":"Select and move a drawing","chart.annotate.trendLine":"Trend line","chart.annotate.horizontalLine":"Horizontal line","chart.annotate.verticalLine":"Vertical line","chart.annotate.channel":"Parallel channel","chart.annotate.fibonacci":"Fibonacci retracement","chart.annotate.arrow":"Arrow","chart.annotate.pen":"Freehand pen","chart.annotate.pen.described":"Freehand drawing from {from} to {to}","chart.annotate.measure-x":"Date range","chart.annotate.measure-y":"Price range","chart.annotate.measure-xy":"Date and price range","chart.annotate.measure.bars":{one:"{count} bar",other:"{count} bars"},"chart.annotate.measure.points":{one:"{count} point",other:"{count} points"},"chart.annotate.measure.volume":"Vol {value}","chart.annotate.measure.seconds":"{count}s","chart.annotate.measure.minutes":"{count}m","chart.annotate.measure.hours":"{count}h","chart.annotate.measure.days":"{count}d","chart.annotate.measure.weeks":"{count}w","chart.annotate.measure.months":"{count}mo","chart.annotate.measure.years":"{count}y","chart.annotate.measure":"Measure","chart.annotate.measure.dx":"Δx {value}","chart.annotate.measure.dy":"Δy {value}","chart.annotate.measure.pct":"{value}%","chart.annotate.measure.categories":{one:"{count} category",other:"{count} categories"},"chart.annotate.measure.slope.perDay":"Slope {value} per day","chart.annotate.measure.slope.perCategory":"Slope {value} per category","chart.annotate.measure.slope.perUnit":"Slope {value} per unit","chart.annotate.measure.dur.d":"{count} d","chart.annotate.measure.dur.h":"{count} h","chart.annotate.measure.dur.min":"{count} min","chart.annotate.measure.dur.s":"{count} s","chart.annotate.measure.dur.ms":"{count} ms","chart.annotate.measure.announce":"Measurement: {readout}","chart.annotate.measure.start":"Measure start: {x}, {y}","chart.annotate.text":"Text","chart.annotate.callout":"Callout","chart.annotate.note":"Note","chart.annotate.delete":"Delete the selected drawing","chart.annotate.editLabel":"Annotation text","chart.zoom.toolbar":"Zoom controls","chart.zoom.in":"Zoom in","chart.zoom.out":"Zoom out","chart.zoom.left":"Pan left","chart.zoom.right":"Pan right","chart.zoom.reset":"Reset the zoom","chart.legendMore":{one:"+{count} more",other:"+{count} more"},"chart.type.line":"Line","chart.type.area":"Area","chart.type.bar":"Bar","chart.type.pie":"Pie","chart.type.donut":"Donut","chart.type.sunburst":"Sunburst","chart.type.scatter":"Scatter","chart.type.step":"Step","chart.type.rangeArea":"Range","chart.type.horizontalBar":"Horizontal bar","chart.type.waterfall":"Waterfall","chart.type.floatingBar":"Floating bar","chart.type.horizontalFloatingBar":"Horizontal floating bar","chart.type.populationPyramid":"Population pyramid","chart.type.bullet":"Bullet","chart.type.bubble":"Bubble","chart.type.histogram":"Histogram","chart.type.boxplot":"Box plot","chart.type.forest":"Forest plot","chart.type.qq":"QQ plot","chart.type.ecdf":"ECDF","chart.type.lorenz":"Lorenz","chart.type.correlogram":"Correlogram","chart.type.control":"Control","chart.type.capability":"Capability","chart.type.movingRange":"Moving range","chart.type.treemap":"Treemap","chart.type.combo":"Combination","chart.type.pareto":"Pareto","chart.type.heatmap":"Heat map","chart.type.radar":"Radar","chart.type.gauge":"Gauge","chart.type.funnel":"Funnel","chart.type.candlestick":"Candlestick","chart.type.ohlc":"OHLC","chart.type.polarArea":"Polar area","chart.type.nightingale":"Nightingale rose","chart.type.rose":"Rose","chart.type.radialBar":"Radial bar","chart.type.polarScatter":"Polar scatter","chart.type.geomap":"Map","chart.type.sankey":"Sankey","chart.type.chord":"Chord","chart.type.pyramid":"Pyramid","chart.type.pictorial":"Pictorial","chart.type.serpentine":"Serpentine timeline","chart.type.spiral":"Spiral timeline","chart.edit.aggregated":"This value is a total of several rows, so it cannot be dragged.","chart.edit.refused":"That change was not applied.","chart.edit.refusedWhy":"That change was not applied: {reason}","chart.type.network":"Network","chart.type.stream":"Stream","chart.type.marimekko":"Marimekko","chart.type.violin":"Violin","chart.type.gantt":"Gantt","chart.type.forceTree":"Force-directed tree","chart.type.pack":"Packed circles","chart.type.tree":"Tree","chart.type.voronoiTreemap":"Voronoi treemap","chart.type.alluvial":"Alluvial","chart.type.arc":"Arc diagram","chart.type.barRace":"Bar chart race","chart.type.bubblemap":"Bubble map","chart.type.bump":"Bump chart","chart.type.calendar":"Calendar heat map","chart.type.choropleth":"Choropleth map","chart.type.decomposition":"Decomposition tree","chart.type.diverging":"Diverging bar","chart.type.dumbbell":"Dumbbell","chart.type.fan":"Fan chart","chart.type.hexbin":"Hexagonal bin","chart.type.hexmap":"Hex map","chart.type.icicle":"Icicle","chart.type.markermap":"Marker map","chart.type.motion":"Motion chart","chart.type.parallel":"Parallel coordinates","chart.type.ridgeline":"Ridgeline","chart.type.roc":"ROC curve","chart.type.scatter3d":"3D scatter","chart.type.slope":"Slope chart","chart.type.splom":"Scatter plot matrix","chart.type.venn":"Venn diagram","chart.type.waffle":"Waffle","chart.type.wordCloud":"Word cloud","chart.tasksDropped":{one:"{count} more task not shown",other:"{count} more tasks not shown"},"chart.geoUnmatched":{one:"{count} row could not be placed on the map",other:"{count} rows could not be placed on the map"},"chart.r2":"R² {value}","ai.insights":"Insights","ai.explainView":"Explain this view","ai.explain":"Explain","ai.ask":"Ask","ai.apply":"Apply","ai.discard":"Discard","ai.propose":"Propose","ai.approve":"Approve","ai.thinking":"Thinking…","ai.applying":"Applying…","ai.applied":"Applied: {what}","ai.couldNotApply":"Could not apply: {why}","ai.applyFailed":"it failed","ai.discarded":"Discarded.","ai.discardedNothingWritten":"Discarded. Nothing was written.","ai.nothingWritten":"Nothing was written.","ai.nothingWrittenVetoed":"Nothing was written — a before-handler vetoed it.","ai.scope":"Scope: {scope}","ai.unsafeQuery":"I could not turn that into a safe query: {why}","ai.nothingToDo":"nothing to do","ai.insightsFailed":"Could not generate insights right now. The grid is unaffected.","ai.modelUnreachable":"Could not reach the model right now. The grid is unaffected.","ai.flagged":{one:"{count} unverified figure was removed as ungrounded.",other:"{count} unverified figures were removed as ungrounded."},"ai.askPlaceholder":"Ask your data: “EMEA deals over 50k, biggest first”","ai.askLabel":"Ask your data","ai.actorPlaceholder":"Ask AI to change data: “set the Network Upgrade project to In Progress”","ai.actorLabel":"Ask AI to change data","editor.password.show":"Show value","editor.password.hide":"Hide value","editor.password.showField":"Show {column}","editor.password.hideField":"Hide {column}","facets.computing":"Computing…","facets.suppressed.cardinality":"Too many distinct values to chart","facets.suppressed.rows":"Too many rows to chart","facets.suppressed.streaming":"Paused while live data is streaming","facets.suppressed.noProvider":"No distribution available for this data source","facets.suppressed.type":"This column has no chartable distribution","facets.bucketOf":"{count} of {whole} rows","history.undo":"Undo","history.redo":"Redo","history.described":"{action} {label}","history.nothingToUndo":"Nothing to undo","history.nothingToRedo":"Nothing to redo","history.undoDisabled":"Undo (nothing to undo)","history.redoDisabled":"Redo (nothing to redo)","a11y.presence.joined":"{name} joined","a11y.presence.left":"{name} left","prompt.asking":"Asking…","prompt.moreNotes":{one:"and {count} more",other:"and {count} more"},"shortcuts.key.cmd":"Cmd","timeline.live":"Live","timeline.recording":"recording…","panel.zoneHint.group":"Drag a column here to group rows by its values","panel.zoneHint.values":"Drag a column here to total it","panel.zoneHint.pivot":"Drag a column here to pivot across its values","panel.zoneHint.any":"Drag a column here","panel.rowsOf":"{shown} of {total} rows","views.empty":"No saved views yet. Set the grid up as you want it, then save it below.","views.applied":"Applied","views.matchesGrid":"Matches the grid as it is","views.delete":"Delete","views.confirmDelete":"Delete {name}?","views.confirmDeleteLabel":"Confirm deleting {name}","views.shared":"View copied to the clipboard","views.sharedDownload":"Clipboard unavailable; the view was downloaded as {name}","views.sharedFailed":"The view could not be copied or downloaded","views.rename":"Rename","views.ownedBy":"Owned by {name}","views.ownerOnlyReason":"Only {name} or an admin can do that","views.noOwnerReason":"Only an admin can do that — this view has no recorded owner","views.unshare":"Unshare","views.unshareTitle":"Stop sharing {name}","views.duplicate":"Duplicate","views.duplicateTitle":"Duplicate {name}","views.copyName":"{name} (copy)","gantt.row.expand":"Expand {name}","gantt.row.collapse":"Collapse {name}","gantt.resource.over":"{name} — over-allocated","kanban.board":"Board","kanban.requiredTitle":"Required fields","kanban.requiredSave":"Save","kanban.requiredCancel":"Cancel","kanban.moveRefused":'Move refused: a card in "{from}" cannot move to "{to}".',"kpi.status.good":"good","kpi.status.warn":"warn","kpi.status.critical":"critical","kpi.status.unknown":"No data","kpi.node.item":"{count} item","kpi.node.items":"{count} items","kpi.node.worst":"worst status {status}","kpi.node.unknown":"{count} unknown","sidebar.nav":"Main navigation","sidebar.search":"Search","sidebar.collapse":"Collapse sidebar","sidebar.expand":"Expand sidebar","toolbar.more":"More"}),D=Object.freeze(Object.keys(U))}),ze("packages/core/src/i18n/format.js",function(e,_){"use strict";Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"formatMessage",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return k}});const E=_("packages/core/src/internal/predicates.js").isFunction,K=/\{(\w+)\}/g,U=new Map,D=new Map;function J(y){const l=y||"";if(U.has(l))return U.get(l);let g=null;try{g=new Intl.PluralRules(y||void 0)}catch{g=null}return U.set(l,g),g}function z(y,l,g="conjunction"){const s=Array.isArray(y)?y.filter(c=>c!=null&&c!==""):[];if(s.length===0)return"";if(s.length===1)return String(s[0]);const t=`${l||""}|${g}`;let o=D.get(t);if(o===void 0){try{o=new Intl.ListFormat(l||void 0,{style:"long",type:g})}catch{o=null}D.set(t,o)}return o?o.format(s.map(String)):s.map(String).join(", ")}function L(y,l){return y==null?"":typeof y=="number"?Number.isFinite(y)?y.toLocaleString(l||void 0,{maximumFractionDigits:20}):"":String(y)}function X(y,l,g){if(typeof y=="string")return y;if(!y||typeof y!="object")return"";const s=l&&typeof l.count=="number"?l.count:null;if(s===null)return y.other??"";const t=J(g),o=t?t.select(s):s===1?"one":"other";return y[o]??y.other??""}function I(y,l={},g){const s=X(y,l,g);return s?s.replace(K,(t,o)=>Object.prototype.hasOwnProperty.call(l,o)?L(l[o],g):t):""}function j(y,l,g="en-GB"){return typeof y=="string"&&y?y:typeof l=="string"&&l?l:g}function k(y,l){const g=y?y[l]:void 0;return g==null||E(g)?l:g}}),ze("packages/core/src/i18n/registry.js",function(e,_){"use strict";Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"localeCatalogue",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return J}});const E=_("packages/core/src/i18n/catalogue.js").EN_GB,K=new Map([["en-gb",E]]);function U(z,L){const X=typeof z=="string"?z.toLowerCase():"";return!X||!L||typeof L!="object"?!1:(K.set(X,L),!0)}function D(z){if(typeof z!="string"||!z)return null;const L=z.toLowerCase(),X=K.get(L);if(X)return X;const I=L.split("-")[0],j=K.get(I);if(j)return j;for(const[k,y]of K)if(k.split("-")[0]===I)return y;return null}function J(){return[...K.keys()]}}),ze("packages/core/src/i18n/index.js",function(e,_){"use strict";Object.defineProperty(e,"DEFAULT_LOCALE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"Messages",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"defaultMessages",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return d}});const ne=_("packages/core/src/i18n/catalogue.js"),E=ne.EN_GB,K=ne.MESSAGE_KEYS,U=_("packages/core/src/i18n/format.js"),D=U.formatMessage,J=U.formatList,z=U.lookup,L=U.resolveLocale,I=_("packages/core/src/internal/predicates.js").isFunction,k=_("packages/core/src/internal/warn.js").warnOnce,y=_("packages/core/src/i18n/registry.js"),l=y.registerLocale,g=y.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 U.formatList}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return U.resolveLocale}}),Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return y.registerLocale}});const s="en-GB";class t{#e=s;#t=E;constructor(p={}){this.configure(p)}configure(p={}){this.#e=L(p.locale,p.declared,s);const i=p.messages,r=g(this.#e);if(!r&&this.#e.toLowerCase()!=="en-gb"&&(!i||typeof i!="object")&&k(`i18n:locale:not-loaded:${this.#e.toLowerCase()}`,`locale "${this.#e}" is not loaded: import "@toclocoinc/lattice-grid/locales/${this.#e}" to add its text; English is used until then.`),!i||typeof i!="object"){this.#t=r?{...E,...r}:E;return}const m=Object.keys(i).filter(u=>!(u in E));m.length&&k(`i18n:unknown:${m[0]}`,`message keys not in the catalogue and so ignored: ${m.slice(0,5).join(", ")}${m.length>5?`, and ${m.length-5} more`:""}`),this.#t={...E,...r||{},...i}}get locale(){return this.#e}t(p,i){return D(z(this.#t,p),i||{},this.#e)}list(p,i){return J(p,this.#e,i)}number(p,i){const r=Number(p);return Number.isFinite(r)?r.toLocaleString(this.#e,i||{maximumFractionDigits:20}):""}}const o=new t;function c(n){return n instanceof t?n:new t(n||{})}function d(n){const p=n&&typeof n=="object"?n:{},i=K.filter(f=>{const m=p[f];return m==null||m===""||I(m)}),r=Object.keys(p).filter(f=>!(f in E));return{missing:i,unknown:r}}}),ze("packages/core/src/columns/types/structured.js",function(e,_){"use strict";Object.defineProperty(e,"MASK_DEFAULTS",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"parseJsonText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});const ne=_("packages/core/src/internal/predicates.js"),E=ne.isNil,K=ne.isObject,D=_("packages/core/src/i18n/index.js").defaultMessages,J=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function z(t,o){const c=o||{},d=c.emptyDisplay??J.emptyDisplay;if(E(t)||t==="")return d;const p=[...typeof c.char=="string"&&c.char!==""?c.char:J.char][0]||J.char,i=c.fixedLength??J.fixedLength,r=Number.isFinite(c.length)&&Number(c.length)>0?Math.floor(Number(c.length)):J.length,f=typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):null;let m=0;if(f!==null){const u=Number.isFinite(c.lastVisible)?Math.floor(Number(c.lastVisible)):J.lastVisible,b=[...f];if(m=u>0&&u<b.length?u:0,m>0){const a=b.slice(b.length-m).join(""),h=Math.max(1,(i?r:b.length)-m);return p.repeat(h)+a}return p.repeat(i?r:Math.max(1,b.length))}return p.repeat(r)}const L=48;function X(t){try{const o=JSON.stringify(t);return o===void 0?null:o}catch{return null}}function I(t,o){if(E(t))return"";const c=Number.isFinite(o&&o.inlineLimit)?Number(o.inlineLimit):L;if(typeof t=="string")return t.length>c?`${t.slice(0,c-1)}…`:t;if(typeof t!="object")return String(t);const d=X(t);if(d!==null&&d.length<=c)return d;if(Array.isArray(t)){const p=t.length;return`[${D.t("count.items",{count:p})}]`}const n=Object.keys(t).length;return`{${D.t("count.keys",{count:n})}}`}function j(t,o){if(t==null)return"null";const c=typeof t;if(c==="number"||c==="boolean"||c==="bigint")return String(t);if(c==="string")return JSON.stringify(t);if(c!=="object")return JSON.stringify(String(t));const d=o||new WeakSet;return d.has(t)?'"[circular]"':(d.add(t),t instanceof Date?JSON.stringify(t.toISOString()):Array.isArray(t)?`[${t.map(i=>j(i,d)).join(",")}]`:`{${Object.keys(t).sort().map(i=>`${JSON.stringify(i)}:${j(t[i],d)}`).join(",")}}`)}function k(t,o){if(E(t))return E(o)?0:1;if(E(o))return-1;const c=j(t),d=j(o);return c<d?-1:c>d?1:0}function y(t){if(E(t))return null;const o=String(t);if(o.trim()==="")return null;try{return JSON.parse(o)}catch{return o}}function l(t){const o=t&&t.cell&&t.cell.props;return K(o)?o:{}}const g=Object.freeze({json:{base:"object",storage:"object",format:t=>I(t&&t.value,l(t&&t.column)),parse:t=>y(t&&t.text),compare:k,defaults:{editor:"code",filter:"text",align:"start"},excel:"@",toClipboard:t=>{if(E(t))return"";if(typeof t=="string")return t;try{const o=JSON.stringify(t,null,2);return o===void 0?String(t):o}catch{return String(t)}},fromClipboard:t=>y(t)},secret:{base:"text",storage:"object",format:t=>z(t&&t.value,l(t&&t.column)),parse:t=>{const o=t&&t.text;return E(o)||String(o)===""?null:String(o)},compare:(t,o)=>{const c=E(t)||t==="",d=E(o)||o==="";return c===d?0:c?1:-1},defaults:{editor:"password",filter:"none",align:"start"},excel:"@",export:{csv:!1,excel:!1},toClipboard:t=>z(t),fromClipboard:t=>E(t)||String(t)===""?null:String(t)}}),s=g}),ze("packages/core/src/columns/types/unit.js",function(e,_){"use strict";Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return C}});const E=_("packages/core/src/internal/predicates.js").isNil,U=_("packages/core/src/internal/warn.js").warnOnce;function D(B,x,V,Y){return Object.freeze({symbol:B,factor:x,aliases:Object.freeze(V||[]),binary:!!(Y&&Y.binary),prefix:Y&&Y.prefix||null,auto:!(Y&&Y.auto===!1)})}function J(B,x,V,Y){return D(B,x,V,Y)}const z=Object.freeze({data:Object.freeze([D("B",1,["byte","bytes"]),D("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),D("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),D("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),D("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),D("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),D("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),D("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),D("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),D("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([D("bps",1,["bit","bits","bit/s","b/s"]),D("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),D("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),D("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),D("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([D("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),D("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),D("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),D("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),D("in",.0254,["inch","inches"],{auto:!1}),D("ft",.3048,["foot","feet"],{auto:!1}),D("yd",.9144,["yard","yards"],{auto:!1}),D("m",1,["metre","metres","meter","meters"]),D("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),D("mi",1609.344,["mile","miles"],{auto:!1}),D("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([D("mg",.001,["milligram","milligrams"]),D("g",1,["gram","grams"]),D("oz",28.349523125,["ounce","ounces"],{auto:!1}),D("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),D("kg",1e3,["kilogram","kilograms"]),D("st",6350.29318,["stone"],{auto:!1}),D("t",1e6,["tonne","tonnes","ton"],{auto:!1}),D("ton (US)",907184.74,["ton","shortton"],{auto:!1}),D("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([D("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),D("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),D("ms",.001,["msec","msecs","millisecond","milliseconds"]),D("s",1,["sec","secs","second","seconds"]),D("m",60,["min","mins","minute","minutes"]),D("h",3600,["hr","hrs","hour","hours"]),D("d",86400,["day","days"])]),speed:Object.freeze([D("mm/s",.001,["millimetre/s","millimeter/s"]),D("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),D("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),D("mph",.44704,["mile/h","miles/h"],{auto:!1}),D("kn",1852/3600,["knot","knots"],{auto:!1}),D("m/s",1,["metre/s","meter/s","mps"]),D("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([D("mm/s²",.001,["mm/s2"]),D("ft/s²",.3048,["ft/s2"],{auto:!1}),D("m/s²",1,["m/s2","metre/s2","meter/s2"]),D("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([D("mm²",1e-6,["mm2"]),D("cm²",1e-4,["cm2"]),D("in²",64516e-8,["in2","sqin"],{auto:!1}),D("ft²",.09290304,["ft2","sqft"],{auto:!1}),D("yd²",.83612736,["yd2","sqyd"],{auto:!1}),D("m²",1,["m2","sqm"]),D("ha",1e4,["hectare","hectares"],{auto:!1}),D("ac",4046.8564224,["acre","acres"],{auto:!1}),D("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([D("µL",1e-6,["ul","microlitre","microliter"]),D("mL",.001,["millilitre","milliliter"]),D("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),D("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),D("L",1,["litre","litres","liter","liters"]),D("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),D("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),D("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),D("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([D("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),D("J",1,["joule","joules"]),D("cal",4.184,["calorie","calories"],{auto:!1}),D("kJ",1e3,["kilojoule","kilojoules"]),D("BTU",1055.05585262,["btu"],{auto:!1}),D("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),D("MJ",1e6,["megajoule","megajoules"]),D("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),D("GJ",1e9,["gigajoule","gigajoules"]),D("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([D("mW",.001,["milliwatt","milliwatts"]),D("W",1,["watt","watts"]),D("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),D("kW",1e3,["kilowatt","kilowatts"]),D("hp",745.6998715822702,["horsepower"],{auto:!1}),D("MW",1e6,["megawatt","megawatts"]),D("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([D("mN",.001,["millinewton","millinewtons"]),D("N",1,["newton","newtons"]),D("lbf",4.4482216152605,["poundforce"],{auto:!1}),D("kgf",9.80665,["kilogramforce"],{auto:!1}),D("kN",1e3,["kilonewton","kilonewtons"]),D("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([D("Pa",1,["pascal","pascals"]),D("mbar",100,["millibar"],{auto:!1}),D("inH₂O",249.0889,["inh2o"],{auto:!1}),D("mmHg",133.322387415,["torr"],{auto:!1}),D("kPa",1e3,["kilopascal","kilopascals"]),D("inHg",3386.388640341,["inhg"],{auto:!1}),D("psi",6894.757293168361,["lbf/in2"],{auto:!1}),D("bar",1e5,[],{auto:!1}),D("atm",101325,["atmosphere","atmospheres"],{auto:!1}),D("MPa",1e6,["megapascal","megapascals"]),D("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([D("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),D("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),D("kN·m",1e3,["knm","kn.m"],{auto:!1}),D("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([D("kg/m³",1,["kg/m3"]),D("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),D("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),D("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([D("L/min",1/6e4,["lpm","l/min"],{auto:!1}),D("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),D("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),D("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),D("cfm",.0004719474432,["ft3/min"],{auto:!1}),D("L/s",.001,["lps","l/s"],{auto:!1}),D("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([D("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),D("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),D("mrad",.001,["milliradian","milliradians"],{auto:!1}),D("mil",Math.PI/3200,["nato-mil"],{auto:!1}),D("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),D("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),D("rad",1,["radian","radians"]),D("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([D("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),D("rad/s",1,["radps","radians/s"]),D("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),D("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([D("ppt",1e-12,["partspertrillion"],{auto:!1}),D("ppb",1e-9,["partsperbillion"]),D("ppm",1e-6,["partspermillion"]),D("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),D("‰",.001,["permille","permil"],{auto:!1}),D("%",.01,["pct","percent"]),D("×",1,["x","ratio","times"])]),molarity:Object.freeze([D("pM",1e-12,["picomolar","picomolarity"]),D("nM",1e-9,["nanomolar","nanomolarity"]),D("µM",1e-6,["um-molar","micromolar","micromolarity"]),D("mM",.001,["millimolar","millimolarity"]),D("M",1,["molar","mol/l","mol/L","molarity"]),D("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([D("mg/s",1e-6,["milligrams/s"]),D("g/s",.001,["grams/s"]),D("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),D("kg/s",1,["kilograms/s","kgps"]),D("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),D("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),D("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([D("µPa·s",1e-6,["upas","micropascalsecond"]),D("cP",.001,["centipoise"],{auto:!1}),D("mPa·s",.001,["mpas","millipascalsecond"]),D("P",.1,["poise"],{auto:!1}),D("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([D("cSt",1e-6,["centistokes","centistoke"]),D("mm²/s",1e-6,["mm2/s"],{auto:!1}),D("St",1e-4,["stokes","stoke"],{auto:!1}),D("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([D("mW/(m·K)",.001,["mw/mk"]),D("W/(m·K)",1,["w/mk","wmk"]),D("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),D("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([D("J/(kg·K)",1,["j/kgk","jkgk"]),D("kJ/(kg·K)",1e3,["kj/kgk"]),D("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([D("nSv/h",1e-9,["nsvh"]),D("µSv/h",1e-6,["usv/h","usvh"]),D("mSv/h",.001,["msvh"]),D("Sv/h",1,["svh"]),D("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),L=Symbol("ambiguous"),X=new Map,I=new Map;function j(B,x){const V=String(B||"").trim();if(!V)throw new Error("[lattice] a unit system needs a name");if(z[V]||I.has(V))throw new Error(`[lattice] unit system "${V}" already exists`);const Y=[...x||[]];if(!Y.length)throw new Error(`[lattice] unit system "${V}" has no units`);if(!Y.some($=>$.factor===1))throw new Error(`[lattice] unit system "${V}" has no base unit (none with factor 1)`);const F=new Set;for(const $ of Y){if(F.has($.symbol))throw new Error(`[lattice] unit system "${V}" declares "${$.symbol}" twice`);F.add($.symbol)}return I.set(V,Object.freeze(Y)),X.delete(V),V}function k(){return[...Object.keys(z),...I.keys()]}function y(B){const x=l(B);return x?x.units:[]}function l(B){const x=String(B||""),V=X.get(x);if(V!==void 0)return V;const Y=z[x]||I.get(x);if(!Y)return X.set(x,null),null;const F=Object.freeze([...Y].sort((re,ie)=>re.factor-ie.factor)),$=new Map,q=new Map,ee=(re,ie)=>{const ue=$.get(re);ue===void 0?$.set(re,ie):ue!==ie&&$.set(re,L)};for(const re of F){ee(re.symbol.toLowerCase(),re);for(const ie of re.aliases)ee(ie.toLowerCase(),re);if(re.prefix){const ie=q.get(re.prefix)||[];ie.push(re),q.set(re.prefix,ie)}}const te={units:F,byToken:$,byPrefix:q,decimal:F.filter(re=>!re.binary&&re.auto),binary:F.some(re=>re.binary)?F.filter(re=>(re.binary||re.factor===1)&&re.auto):null};return X.set(x,te),te}function g(B,x){return x&&B.binary||B.decimal}function s(B,x){const V=l(B);if(!V||E(x))return null;const Y=V.units.find($=>$.symbol===String(x));if(Y)return Y;const F=V.byToken.get(String(x).trim().toLowerCase());return F&&F!==L?F:null}const t=new WeakMap;function o(B){const x=B||{};if(typeof x=="object"&&x!==null){const $=t.get(x);if($!==void 0)return $}const V=x.system||"data",Y=l(V);let F=null;if(!Y)U(`unit:system:${V}`,`unknown unit system "${V}"; known systems are ${k().join(", ")}`);else{let $=x.unit?s(V,x.unit):null;$||(x.unit&&U(`unit:unit:${V}:${x.unit}`,`unknown unit "${x.unit}" in system "${V}"; falling back to ${Y.units[0].symbol}`),$=Y.units.find(q=>q.factor===1)||Y.units[0]),F={index:Y,base:$,binary:x.binary===!0}}return typeof x=="object"&&x!==null&&t.set(x,F),F}const c=new WeakMap;function d(B,x){if(!B||!x||!Array.isArray(B.compound)||B.compound.length===0)return null;const V=c.get(B);if(V!==void 0)return V;const Y=new Set,F=[];for(const q of B.compound){const ee=s(B.system||"data",q);if(!ee){U(`unit:compound:${B.system}:${q}`,`unknown compound unit "${q}" in system "${B.system||"data"}"; ignoring it`);continue}Y.has(ee.symbol)||(Y.add(ee.symbol),F.push(ee))}F.sort((q,ee)=>ee.factor-q.factor);const $=F.length>=2?F:null;return c.set(B,$),$}function n(B,x,V){return x===V||x.factor===V.factor?B:B*x.factor/V.factor}const p=new Map;function i(B){const x=B||"",V=p.get(x);if(V)return V;const Y={group:",",decimal:"."};try{for(const F of new Intl.NumberFormat(B||void 0).formatToParts(12345.6))F.type==="group"?Y.group=F.value:F.type==="decimal"&&(Y.decimal=F.value)}catch{}return p.set(x,Y),Y}const r=/[\s ]/g,f=/^[+-]?[\d '’ .,]*(?:[eE][+-]?\d+)?/,m=/^[^\d+\-(.,\s]+\s*/,u=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function b(B,x){const{group:V,decimal:Y}=i(x);let F=String(B).replace(r,"");if(F==="")return null;const $=Y?F.indexOf(Y):-1;if(V&&V!==Y){if($>=0&&F.indexOf(V,$+Y.length)>=0)return null;F=F.split(V).join("")}if(Y&&Y!=="."&&(F=F.split(Y).join(".")),!u.test(F))return null;const q=Number(F);return Number.isFinite(q)?q:null}function a(B,x,V){const Y=String(B).trim().replace(/\.$/,"");if(Y==="")return null;const F=x.units.find(ie=>ie.symbol===Y);if(F)return F;const $=Y.toLowerCase(),q=x.byToken.get($);if(q===L)return null;if(q)return q;const ee=x.byPrefix.get($);if(!ee||!ee.length)return null;const te=g(x,V),re=ee.filter(ie=>te.includes(ie));return re.length===1?re[0]:null}function h(B,x,V,Y){let F=B,$=0,q=!1,ee=!1;for(;F!=="";){const te=f.exec(F)[0];if(te==="")return null;const re=b(te,Y&&Y.locale);if(re===null)return null;F=F.slice(te.length).trim();const ie=F.search(/[+-]?[\d]/),ue=(ie>=0?F.slice(0,ie):F).trim();if(F=ie>=0?F.slice(ie).trim():"",ue===""){if(q)return null;ee=!0,$+=n(re,V[0],x.base)}else{const Ae=a(ue,x.index,x.binary);if(!Ae)return null;$+=n(re,Ae,x.base)}if(q=!0,ee&&F!=="")return null}return q?$:null}function w(B,x){if(E(B))return null;if(typeof B=="number")return Number.isFinite(B)?B:null;const V=o(x);if(!V)return null;let Y=String(B).trim();if(Y==="")return null;let F=!1;Y.startsWith("(")&&Y.endsWith(")")&&(F=!0,Y=Y.slice(1,-1).trim());const $=d(x,V);if($){Y.startsWith("-")&&(F=!0,Y=Y.slice(1).trim());const de=h(Y,V,$,x);return de===null?null:F?-de:de}let q=null;const ee=m.exec(Y);if(ee&&ee[0]){const de=a(ee[0].trim(),V.index,V.binary);de&&(q=de,Y=Y.slice(ee[0].length).trim())}const te=f.exec(Y)[0],re=b(te,x&&x.locale);if(re===null)return null;const ie=Y.slice(te.length).trim();if(q&&ie!=="")return null;const ue=q||(ie===""?V.base:a(ie,V.index,V.binary));if(!ue)return null;const Ae=n(re,ue,V.base);return F?-Ae:Ae}const v=new Map;function A(B,x,V,Y){const F=`${B||""}|${x}|${V}|${Y?1:0}`;let $=v.get(F);return $||($=new Intl.NumberFormat(B||void 0,{minimumFractionDigits:x,maximumFractionDigits:V,useGrouping:Y}),v.set(F,$)),$}function H(B,x){if(!Number.isFinite(B)||B===0)return Math.max(0,x-1);const V=Math.floor(Math.log10(Math.abs(B)));return Math.min(20,Math.max(0,x-1-V))}function G(B,x){if(!Number.isFinite(B)||B===0)return B;const V=Math.ceil(Math.log10(Math.abs(B))),Y=10**(x-V);return Math.round(B*Y)/Y}function Z(B,x,V){if(!V||V===x.base.symbol)return x.base;if(V!=="auto")return M(x,V);if(B===0||!Number.isFinite(B))return x.base;const Y=Math.abs(B)*x.base.factor,F=g(x.index,x.binary);let $=F[0];for(const te of F)Y>=te.factor&&($=te);if(Y>=$.factor)return $;let q=$;for(const te of x.index.units)te.binary!==x.binary&&te.factor!==1||te.factor<=Y&&te.factor>(q===$?0:q.factor)&&(q=te);if(q!==$)return q;let ee=$;for(const te of x.index.units)te.binary!==x.binary&&te.factor!==1||te.factor<ee.factor&&(ee=te);return ee.factor<x.base.factor?ee:x.base}function M(B,x){const V=B.index.units.find(F=>F.symbol===x);if(V)return V;const Y=B.index.byToken.get(String(x).toLowerCase());return Y&&Y!==L?Y:(U(`unit:display:${x}`,`unknown display unit "${x}"; rendering in ${B.base.symbol}`),B.base)}function S(B,x,V,Y){const F=B<0;let $=Math.abs(B)*x.base.factor;const q=typeof Y.decimals=="number"?Y.decimals:Y.minDecimals??0,ee=typeof Y.decimals=="number"?Y.decimals:Y.maxDecimals??Math.max(q,2),te=Y.space??" ",re=[];for(let ue=0;ue<V.length;ue++){const Ae=V[ue],de=ue===V.length-1;let Oe=de?$/Ae.factor:Math.floor($/Ae.factor);if($-=Oe*Ae.factor,de){const Fe=10**ee;Oe=Math.round(Oe*Fe)/Fe+0}const Me=de?A(Y.locale,q,ee,Y.group!==!1):A(Y.locale,0,0,Y.group!==!1);re.push(`${Me.format(Oe)}${te}${Ae.symbol}`)}const ie=re.join(" ");return F?`-${ie}`:ie}function T(B,x){const V=x||{},Y=V.nullDisplay??"";if(E(B)||B==="")return Y;const F=typeof B=="number"?B:Number(B);if(!Number.isFinite(F))return Y;const $=o(V);if(!$)return String(F);const q=d(V,$);if(q)return S(F,$,q,V);const ee=typeof V.significantFigures=="number"&&V.significantFigures>0?V.significantFigures:0,te=ee?G(F,ee):F,re=Z(te,$,V.display),ie=n(te,$.base,re);let ue=typeof V.decimals=="number"?V.decimals:V.minDecimals??0,Ae=typeof V.decimals=="number"?V.decimals:V.maxDecimals??Math.max(ue,2);ee&&(ue=H(ie,ee),Ae=ue);const de=A(V.locale,ue,Ae,V.group!==!1).format(ie),Oe=V.space??" ";return V.placement==="prefix"?`${re.symbol}${V.space??""}${de}`:`${de}${Oe}${re.symbol}`}function O(B,x){const V=E(B)||Number.isNaN(B)?null:Number(B),Y=E(x)||Number.isNaN(x)?null:Number(x);return V===null||Number.isNaN(V)?Y===null||Number.isNaN(Y)?0:1:Y===null||Number.isNaN(Y)||V<Y?-1:V>Y?1:0}function N(B){const x=typeof B.decimals=="number"&&B.decimals>0?`.${"0".repeat(B.decimals)}`:"";return`${typeof B.decimals=="number"?`#,##0${x}`:"#,##0.##"}" ${B.symbol}"`}function P(B){const x={system:"data",...B||{}},V=o(x),Y=V?V.base.symbol:String(x.unit||""),F=Object.freeze({...x,unit:Y}),$=Object.freeze({...F,display:Y,decimals:void 0,minDecimals:0,maxDecimals:20,group:!1}),q=new Map([[F.locale||"",F]]),ee=te=>{const re=te||"";let ie=q.get(re);return ie||(ie=Object.freeze({...F,locale:te||void 0}),q.set(re,ie)),ie};return{base:"number",extends:"number",storage:"float64",unitConfig:F,format:te=>T(te.value,te.locale?ee(te.locale):F),parse:te=>w(te.text,te.locale?ee(te.locale):F),compare:O,defaults:{filter:"number",editor:"unit",align:"end",total:x.total||"sum"},...x.totals?{totals:x.totals}:{},excel:x.excel||N({decimals:x.decimals,symbol:Y}),toStorage:te=>typeof te=="number"?Number.isFinite(te)?te:null:typeof te=="string"?w(te,F):E(te)?null:w(String(te),F),toClipboard:te=>T(te,$),fromClipboard:te=>w(te,F)}}const C=P}),ze("packages/core/src/columns/types/engineering.js",function(e,_){"use strict";Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return D}});const E=_("packages/core/src/internal/predicates.js").isNil,U=_("packages/core/src/columns/types/unit.js").createUnitType;function D(L){const X=2*Math.PI/L;return I=>{let j=0,k=0,y=0;for(const g of I||[]){if(E(g))continue;const s=Number(g);Number.isFinite(s)&&(j+=Math.cos(s*X),k+=Math.sin(s*X),y+=1)}return!y||Math.hypot(j,k)/y<1e-12?null:(Math.atan2(k,j)/X%L+L)%L}}function J(L){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:D(L)}}}const z=Object.freeze({metres:U({system:"length",unit:"m",display:"auto",maxDecimals:3}),millimetres:U({system:"length",unit:"mm",maxDecimals:2}),kilometres:U({system:"length",unit:"km",maxDecimals:3}),grams:U({system:"mass",unit:"g",display:"auto",maxDecimals:3}),kilograms:U({system:"mass",unit:"kg",maxDecimals:3}),tonnes:U({system:"mass",unit:"t",maxDecimals:3}),seconds:U({system:"duration",unit:"s",display:"auto",maxDecimals:3}),milliseconds:U({system:"duration",unit:"ms",maxDecimals:3}),hours:U({system:"duration",unit:"h",maxDecimals:2}),speed:U({system:"speed",unit:"m/s",display:"auto",maxDecimals:2}),kph:U({system:"speed",unit:"km/h",maxDecimals:1}),mph:U({system:"speed",unit:"mph",maxDecimals:1}),knots:U({system:"speed",unit:"kn",maxDecimals:1}),acceleration:U({system:"acceleration",unit:"m/s²",maxDecimals:3}),area:U({system:"area",unit:"m²",display:"auto",maxDecimals:2}),hectares:U({system:"area",unit:"ha",maxDecimals:4}),volume:U({system:"volume",unit:"L",display:"auto",maxDecimals:3}),cubicMetres:U({system:"volume",unit:"m³",maxDecimals:3}),energy:U({system:"energy",unit:"J",display:"auto",maxDecimals:3}),kilowattHours:U({system:"energy",unit:"kWh",maxDecimals:2}),power:U({system:"power",unit:"W",display:"auto",maxDecimals:2}),kilowatts:U({system:"power",unit:"kW",maxDecimals:2}),force:U({system:"force",unit:"N",display:"auto",maxDecimals:2}),pressure:U({system:"pressure",unit:"Pa",display:"auto",maxDecimals:2}),bar:U({system:"pressure",unit:"bar",maxDecimals:3}),psi:U({system:"pressure",unit:"psi",maxDecimals:1}),torque:U({system:"torque",unit:"N·m",maxDecimals:2}),density:U({system:"density",unit:"kg/m³",maxDecimals:2}),flow:U({system:"flow",unit:"m³/s",maxDecimals:4}),litresPerMinute:U({system:"flow",unit:"L/min",maxDecimals:1}),radians:U({system:"angle",unit:"rad",maxDecimals:4,totals:J(2*Math.PI)}),degrees:U({system:"angle",unit:"°",maxDecimals:2,totals:J(360)}),rpm:U({system:"angularVelocity",unit:"rpm",maxDecimals:0}),angularVelocity:U({system:"angularVelocity",unit:"rad/s",maxDecimals:3}),ppm:U({system:"fraction",unit:"ppm",maxDecimals:2}),ppb:U({system:"fraction",unit:"ppb",maxDecimals:2}),basisPoints:U({system:"fraction",unit:"bp",maxDecimals:1}),molarity:U({system:"molarity",unit:"M",display:"auto",maxDecimals:3}),massFlow:U({system:"massFlow",unit:"kg/s",maxDecimals:3}),tonnesPerHour:U({system:"massFlow",unit:"t/h",maxDecimals:2}),viscosity:U({system:"viscosity",unit:"Pa·s",display:"auto",maxDecimals:3}),kinematicViscosity:U({system:"kinematicViscosity",unit:"cSt",maxDecimals:2}),thermalConductivity:U({system:"thermalConductivity",unit:"W/(m·K)",maxDecimals:3}),specificHeat:U({system:"specificHeat",unit:"J/(kg·K)",maxDecimals:1}),doseRate:U({system:"doseRate",unit:"µSv/h",display:"auto",maxDecimals:2})})}),ze("packages/core/src/columns/types/si.js",function(e,_){"use strict";Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return j}});const ne=_("packages/core/src/columns/types/unit.js"),E=ne.defineUnit,K=ne.registerUnitSystem,U=ne.createUnitType,D=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})]),J=Object.freeze(["p","n","µ","m","","k","M","G"]);function z(k){const y=String(k.base),l=new Set([...k.prefixes||J,""]),g=[];for(const s of D){if(!l.has(s.symbol))continue;const t=`${s.symbol}${y}`,o=[];if(k.name){o.push(`${s.name}${k.name}`,`${s.name}${k.name}s`);const c=s.name.slice(-1);if(c&&k.name.startsWith(c)){const d=`${s.name.slice(0,-1)}${k.name}`;o.push(d,`${d}s`)}}s.symbol==="µ"&&o.push(`u${y}`),s.factor===1&&k.aliases&&o.push(...k.aliases),g.push(E(t,s.factor,o))}for(const s of k.extra||[])g.push(s);return g}function L(k,y){const l=z(y);return K(k,l)}function X(k,y,l){return L(k,y),U({system:k,unit:y.base,display:"auto",maxDecimals:3,...l||{}})}const I=Object.freeze({voltage:X("voltage",{base:"V",name:"volt"}),current:X("current",{base:"A",name:"amp",aliases:["ampere","amperes"]}),resistance:X("resistance",{base:"Ω",name:"ohm",aliases:["ohm","ohms","R"],prefixes:["m","","k","M","G"]}),capacitance:X("capacitance",{base:"F",name:"farad",prefixes:["f","p","n","µ","m",""]}),inductance:X("inductance",{base:"H",name:"henry",prefixes:["p","n","µ","m",""]}),charge:X("charge",{base:"C",name:"coulomb",prefixes:["p","n","µ","m",""],extra:[E("mAh",3.6,["milliamphour","milliamphours"],{auto:!1}),E("Ah",3600,["amphour","amphours"],{auto:!1})]}),conductance:X("conductance",{base:"S",name:"siemens",prefixes:["n","µ","m","","k"]}),fluxDensity:X("fluxDensity",{base:"T",name:"tesla",prefixes:["n","µ","m",""],extra:[E("G",1e-4,["gauss"],{auto:!1})]}),luminousFlux:X("luminousFlux",{base:"lm",name:"lumen",prefixes:["m","","k"]}),illuminance:X("illuminance",{base:"lx",name:"lux",prefixes:["m","","k"]}),luminousIntensity:X("luminousIntensity",{base:"cd",name:"candela",prefixes:["m","","k"]}),substance:X("substance",{base:"mol",name:"mole",prefixes:["n","µ","m","","k"]}),absorbedDose:X("absorbedDose",{base:"Gy",name:"gray",prefixes:["µ","m",""]}),equivalentDose:X("equivalentDose",{base:"Sv",name:"sievert",prefixes:["n","µ","m",""]}),radioactivity:X("radioactivity",{base:"Bq",name:"becquerel",prefixes:["","k","M","G","T"],extra:[E("Ci",37e9,["curie","curies"],{auto:!1})]}),frequency:X("frequency",{base:"Hz",name:"hertz",prefixes:["m","","k","M","G","T"]})}),j=X}),ze("packages/core/src/columns/types/temperature.js",function(e,_){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});const E=_("packages/core/src/internal/predicates.js").isNil,K=Object.freeze({C:Object.freeze({symbol:"°C",aliases:["c","°c","celsius","centigrade"],toKelvin:g=>g+273.15,fromKelvin:g=>g-273.15}),F:Object.freeze({symbol:"°F",aliases:["f","°f","fahrenheit"],toKelvin:g=>(g+459.67)*(5/9),fromKelvin:g=>g*(9/5)-459.67}),K:Object.freeze({symbol:"K",aliases:["k","kelvin"],toKelvin:g=>g,fromKelvin:g=>g}),R:Object.freeze({symbol:"°R",aliases:["r","°r","rankine"],toKelvin:g=>g*(5/9),fromKelvin:g=>g*(9/5)})});function U(g){if(E(g))return null;const s=String(g).trim();if(s==="")return null;for(const[o,c]of Object.entries(K))if(s===o||s===c.symbol)return{key:o,scale:c};const t=s.toLowerCase();for(const[o,c]of Object.entries(K))if(c.aliases.includes(t))return{key:o,scale:c};return null}function D(g,s,t){const o=U(s),c=U(t);return!o||!c||!Number.isFinite(Number(g))?null:o.key===c.key?Number(g):c.scale.fromKelvin(o.scale.toKelvin(Number(g)))}const J=new Map;function z(g,s,t){const o=`${g||""}|${s}|${t}`;let c=J.get(o);return c||(c=new Intl.NumberFormat(g||void 0,{minimumFractionDigits:s,maximumFractionDigits:t}),J.set(o,c)),c}function L(g,s){const t=s||{},o=t.nullDisplay??"";if(E(g)||g==="")return o;const c=Number(g);if(!Number.isFinite(c))return o;const d=U(t.scale||"C");if(!d)return String(c);const n=U(t.display||t.scale||"C")||d,p=n.key===d.key?c:n.scale.fromKelvin(d.scale.toKelvin(c)),i=typeof t.decimals=="number"?t.decimals:null,r=i??t.minDecimals??0,f=i??t.maxDecimals??1;return`${z(t.locale,r,f).format(p)}${t.space??" "}${n.scale.symbol}`}const X=/^[+-]?[\d\s., ]*\d/;function I(g,s){const t=String(g).trim();if(t==="")return null;const o=new Intl.NumberFormat(s||void 0).formatToParts(1.1).find(p=>p.type==="decimal")?.value||".",c=o===","?".":",",d=t.split(c).join("").split(/[\s ]/).join("").replace(o,"."),n=Number(d);return Number.isFinite(n)?n:null}function j(g,s){if(E(g))return null;const t=s||{},o=U(t.scale||"C");if(!o)return null;if(typeof g=="number")return Number.isFinite(g)?g:null;let c=String(g).trim();if(c==="")return null;let d=!1;c.startsWith("(")&&c.endsWith(")")&&(d=!0,c=c.slice(1,-1).trim());const n=X.exec(c);if(!n)return null;const p=I(n[0],t.locale);if(p===null)return null;const i=c.slice(n[0].length).trim();if(i==="")return d?-p:p;const r=U(i);if(!r)return null;const f=r.key===o.key?p:o.scale.fromKelvin(r.scale.toKelvin(p));return d?-f:f}function k(g){const s=Object.freeze({scale:"C",...g||{}}),o=(U(s.scale)||U("C")).scale.symbol,c=Object.freeze({...s,display:s.scale,decimals:void 0,minDecimals:0,maxDecimals:20}),d=new Map([[s.locale||"",s]]),n=p=>{const i=p||"";let r=d.get(i);return r||(r=Object.freeze({...s,locale:p||void 0}),d.set(i,r)),r};return{base:"number",extends:"number",storage:"float64",temperatureConfig:s,format:p=>L(p.value,p.locale?n(p.locale):s),parse:p=>j(p.text,p.locale?n(p.locale):s),defaults:{filter:"number",editor:"temperature",align:"end",total:"avg"},totals:{supported:["avg","min","max","count","countValues"]},excel:s.excel||`#,##0${typeof s.decimals=="number"&&s.decimals>0?`.${"0".repeat(s.decimals)}`:".#"}" ${o}"`,toStorage:p=>typeof p=="number"?Number.isFinite(p)?p:null:typeof p=="string"?j(p,s):E(p)?null:j(String(p),s),toClipboard:p=>L(p,c),fromClipboard:p=>j(p,s)}}const y=Object.freeze({celsius:k({scale:"C"}),fahrenheit:k({scale:"F"}),kelvin:k({scale:"K"})}),l=k}),ze("packages/core/src/columns/types/radix.js",function(e,_){"use strict";Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"digitsForWidth",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"radixRange",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"radixName",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"normaliseRadixOptions",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"compileRadixFormat",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"compileRadixParse",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"parseRadixResult",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return S}});const E=_("packages/core/src/internal/predicates.js").isNil,U=_("packages/core/src/internal/warn.js").warnOnce,D=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}),J=Object.freeze({2:1,8:3,16:4}),z=Object.freeze({2:"0b",8:"0o",16:"0x"}),L=Object.freeze({2:4,8:3,16:2}),X=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),I=Object.freeze({2:"binary",8:"octal",16:"hexadecimal"}),j=Object.freeze([[/^0x/i,16],[/^0b/i,2],[/^0o/i,8],[/^#/,16]]),k=/[\s\u00a0\u202f_,']/g,y=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,l=Object.freeze([8,16,32,53]),g=new WeakSet,s=new WeakMap,t=new Map,o=new WeakMap,c=new WeakMap,d=Object.freeze({hex:Object.freeze({radix:16}),hex8:Object.freeze({radix:16,bitWidth:8,pad:!0,signed:!1}),hex16:Object.freeze({radix:16,bitWidth:16,pad:!0,signed:!1}),hex32:Object.freeze({radix:16,bitWidth:32,pad:!0,signed:!1}),binary:Object.freeze({radix:2}),binary8:Object.freeze({radix:2,bitWidth:8,pad:!0,signed:!1,group:4}),octal:Object.freeze({radix:8})});function n(T){if(T==null)return 16;const O=typeof T=="string"?T.toLowerCase():T,N=D[O];return N||(U(`radix:base:${String(T)}`,`unsupported radix ${String(T)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function p(T,O){return Math.ceil(T/J[O])}function i(T,O){if(!T)return O?{min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}:{min:0,max:Number.MAX_SAFE_INTEGER};if(!O)return{min:0,max:2**T-1};const N=2**(T-1);return{min:-N,max:N-1}}function r(T){return I[T]||"hexadecimal"}function f(T){if(typeof T=="string"){const O=d[T];return O||U(`radix:preset:${T}`,`unknown radix preset "${T}"; known presets are ${Object.keys(d).join(", ")}`),{...O||{}}}if(T&&typeof T.preset=="string"){const O=d[T.preset];return O||U(`radix:preset:${T.preset}`,`unknown radix preset "${T.preset}"; known presets are ${Object.keys(d).join(", ")}`),{...O||{},...T}}return T||{}}function m(T){const O=f(T),N=n(O.radix),P=J[N];let C=null;if(O.bitWidth!==void 0&&O.bitWidth!==null&&O.bitWidth!==!1){const te=Number(O.bitWidth);l.includes(te)?C=te:U(`radix:width:${String(O.bitWidth)}`,`unsupported bitWidth ${String(O.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let B=O.signed!==!1;!B&&C===null&&(U("radix:unsigned:width","signed: false needs a bitWidth to render a two's-complement pattern; defaulting to 32"),C=32);const x=O.prefix===void 0||O.prefix===!0?z[N]:O.prefix===!1?"":String(O.prefix);let V=0;O.pad===!0?V=C?p(C,N):0:typeof O.pad=="number"&&O.pad>0&&(V=Math.floor(O.pad));let Y=0;O.group===!0?Y=L[N]:typeof O.group=="number"&&O.group>0&&(Y=Math.floor(O.group));const F=i(C,B),$=typeof O.min=="number"?Math.max(F.min,O.min):F.min,q=typeof O.max=="number"?Math.min(F.max,O.max):F.max,ee=Object.freeze({radix:N,bits:P,prefix:x,uppercase:O.uppercase!==!1,pad:V,group:Y,groupSeparator:typeof O.groupSeparator=="string"?O.groupSeparator:" ",bitWidth:C,signed:B,min:$,max:q<$?$:q,nullDisplay:typeof O.nullDisplay=="string"?O.nullDisplay:"",name:r(N)});return g.add(ee),ee}function u(T){if(T&&g.has(T))return T;if(typeof T=="string"){let O=t.get(T);return O||(O=m(T),t.set(T,O)),O}if(T&&typeof T=="object"){let O=s.get(T);return O||(O=m(T),s.set(T,O)),O}return u("hex")}function b(T){return T<0?-Math.round(-T):Math.round(T)}function a(T,O,N){if(O<=0||T.length<=O)return T;const P=T.length%O||O,C=[T.slice(0,P)];for(let B=P;B<T.length;B+=O)C.push(T.slice(B,B+O));return C.join(N)}function h(T){const O=u(T),{radix:N,prefix:P,uppercase:C,pad:B,group:x,groupSeparator:V,signed:Y,bitWidth:F,nullDisplay:$}=O,q=F?2**F:0,ee=te=>{if(E(te)||te==="")return $;const re=typeof te=="number"?te:Number(te);if(!Number.isFinite(re))return $;const ie=b(re);let ue="",Ae=ie;ie<0&&(Y?(ue="-",Ae=-ie):Ae=(ie%q+q)%q);let de=Ae.toString(N);return de=C?de.toUpperCase():de.toLowerCase(),B>0&&de.length<B&&(de=de.padStart(B,"0")),x>0&&(de=a(de,x,V)),ue+P+de};return ee.options=O,ee}function w(T,O){const N=u(O);let P=o.get(N);return P||(P=h(N),o.set(N,P)),P(T)}function v(T){const O=u(T),{radix:N,groupSeparator:P,signed:C,min:B,max:x}=O,V=X[N],Y=F=>{if(E(F))return{ok:!0,value:null,reason:"blank"};let $=String(F);if(P&&P!==""&&($=$.split(P).join("")),$=$.replace(k,""),$==="")return{ok:!0,value:null,reason:"blank"};let q=!1;if(($[0]==="-"||$[0]==="+")&&(q=$[0]==="-",$=$.slice(1)),$==="")return{ok:!1,value:null,reason:"digits"};let ee=null;for(const[re,ie]of j){const ue=re.exec($);if(!ue)continue;const Ae=$.slice(ue[0].length);if(Ae==="")break;if(!X[ie].test(Ae))return{ok:!1,value:null,reason:"digits"};ee=parseInt(Ae,ie);break}if(ee===null)if(V.test($))ee=parseInt($,N);else if(y.test($))ee=Number($);else return{ok:!1,value:null,reason:"digits"};if(!Number.isFinite(ee))return{ok:!1,value:null,reason:"digits"};const te=b(q?-ee:ee);return!C&&te<0?{ok:!1,value:te,reason:"negative"}:te<B||te>x?{ok:!1,value:te,reason:"range"}:{ok:!0,value:te,reason:"ok"}};return Y.options=O,Y}function A(T,O){const N=u(O);let P=c.get(N);return P||(P=v(N),c.set(N,P)),P(T)}function H(T,O){const N=A(T,O);return N.ok?N.value:null}function G(T,O){const N=E(T)||Number.isNaN(T)?null:Number(T),P=E(O)||Number.isNaN(O)?null:Number(O);return N===null?P===null?0:1:P===null||N<P?-1:N>P?1:0}function Z(T){const O=T.min>=-2147483648&&T.max<=2147483647;return T.bitWidth&&O?"int32":"float64"}function M(T){const O=m(T),N=h(O),P=v(O);return{base:"number",extends:"number",storage:Z(O),matches:null,format:C=>N(C.value),parse:C=>{const B=P(C.text);return B.ok?B.value:null},compare:G,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:C=>N(C),fromClipboard:C=>{const B=P(C);return B.ok?B.value:null},radix:O,formatValue:N,parseText:P}}const S=M}),ze("packages/core/src/columns/types/aggregable.js",function(e,_){"use strict";Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"weightedMean",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"logarithmicSum",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"logarithmicMean",{enumerable:!0,get:function(){return D}});const E=_("packages/core/src/internal/predicates.js").isNil;function K(I){const j=[];for(const k of I||[]){if(E(k))continue;const y=Number(k);Number.isFinite(y)&&j.push(y)}return j}function U(I){return j=>{const k=K(j);if(!k.length)return null;let y=0;for(const l of k)y+=10**(l/I);return I*Math.log10(y)}}function D(I){return j=>{const k=K(j);if(!k.length)return null;let y=0;for(const l of k)y+=10**(l/I);return I*Math.log10(y/k.length)}}function J(I,j){const k=j&&j.column,l=(k&&k.typeOptions||{}).weight,g=j&&j.valueAt;if(!l||typeof g!="function")return null;let s=0,t=0;for(let o=0;o<I.length;o++){if(E(I[o]))continue;const c=Number(I[o]);if(!Number.isFinite(c))continue;const d=g(l,o);if(E(d))continue;const n=Number(d);!Number.isFinite(n)||n<=0||(s+=c*n,t+=n)}return t===0?null:s/t}function z(I={}){const j=I.factor===20?20:10,k=typeof I.suffix=="string"?I.suffix:"",y=Number.isInteger(I.decimals)?I.decimals:1;return{base:"number",storage:"float64",name:I.name||"logarithmic",format:l=>{const g=l&&l.value;return E(g)||!Number.isFinite(Number(g))?"":`${Number(g).toFixed(y)}${k}`},parse:l=>{const g=String((l&&l.text)??"").replace(k,"").trim();if(!g)return null;const s=Number(g);return Number.isFinite(s)?s:null},defaults:{align:"end",filter:"number"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:{sum:U(j),avg:D(j)}}}}function L(I={}){const j=Number.isInteger(I.decimals)?I.decimals:1,k=I.percent===!0;return{base:"number",storage:"float64",name:I.name||"ratio",format:y=>{const l=y&&y.value;return E(l)||!Number.isFinite(Number(l))?"":k?`${Number(l).toFixed(j)}%`:Number(l).toFixed(j)},parse:y=>{const l=String((y&&y.text)??"").replace("%","").trim();if(!l)return null;const g=Number(l);return Number.isFinite(g)?g:null},defaults:{align:"end",filter:"number"},totals:{supported:["avg","min","max","count","countValues"],implement:{avg:J}}}}const X=Object.freeze({decibel:z({name:"decibel",factor:10,suffix:" dB"}),decibelAmplitude:z({name:"decibelAmplitude",factor:20,suffix:" dB"}),ratio:L({name:"ratio"}),percentRate:L({name:"percentRate",percent:!0})})}),ze("packages/core/src/columns/types/currency.js",function(e,_){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"moneyToText",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});const E=_("packages/core/src/internal/predicates.js").isNil,K="⚠ no rate";function U(p){if(E(p))return null;const i=String(p).trim().toUpperCase();return i===""?null:i}function D(p){if(E(p))return null;if(typeof p=="object"&&!Array.isArray(p)){const i=Number(p.amount),r=U(p.code);return!r||!Number.isFinite(i)?null:{amount:i,code:r}}if(Array.isArray(p)&&p.length===2){const i=Number(p[0]),r=U(p[1]);return!r||!Number.isFinite(i)?null:{amount:i,code:r}}return null}const J=Object.freeze({$:"USD","€":"EUR","£":"GBP","¥":"JPY","₹":"INR","₩":"KRW","₽":"RUB","₺":"TRY","₴":"UAH","₪":"ILS"}),z=Object.freeze({USD:"$",EUR:"€",GBP:"£",JPY:"¥",INR:"₹",KRW:"₩",RUB:"₽",TRY:"₺",UAH:"₴",ILS:"₪"}),L=/[+-]?[\d\s., ]*\d/;function X(p,i){const r=String(p).trim();if(r==="")return null;const f=new Intl.NumberFormat(i||void 0).formatToParts(1.1).find(a=>a.type==="decimal")?.value||".",m=f===","?".":",",u=r.split(m).join("").split(/[\s ]/).join("").replace(f,"."),b=Number(u);return Number.isFinite(b)?b:null}function I(p,i){const r=i||{},f=U(r.code);if(E(p))return null;const m=D(p);if(m)return m;if(typeof p=="number")return Number.isFinite(p)&&f?{amount:p,code:f}:null;let u=String(p).trim();if(u==="")return null;let b=!1;u.startsWith("(")&&u.endsWith(")")&&(b=!0,u=u.slice(1,-1).trim());let a=null;for(const[G,Z]of Object.entries(J)){if(u.startsWith(G)){a=Z,u=u.slice(G.length).trim();break}if(u.endsWith(G)){a=Z,u=u.slice(0,-G.length).trim();break}}const h=L.exec(u);if(!h)return null;const w=X(h[0],r.locale);if(w===null)return null;const v=(u.slice(0,h.index)+" "+u.slice(h.index+h[0].length)).trim();!a&&v!==""&&(a=U(v));const A=a||f;return A?{amount:b?-w:w,code:A}:null}function j(p,i){if(typeof p=="function")return(r,f)=>{if(r===f)return 1;const m=p(r,f);return typeof m=="number"&&Number.isFinite(m)&&m>0?m:null};if(p&&typeof p=="object"){const r=p;return(f,m)=>{if(f===m)return 1;const u=Number(r[f]),b=Number(r[m]);return!Number.isFinite(u)||!Number.isFinite(b)||u<=0||b<=0?null:b/u}}return(r,f)=>r===f?1:null}function k(p,i,r){if(!p)return null;if(p.code===i)return p.amount;const f=r(p.code,i);return f===null?null:p.amount*f}const y=new Map;function l(p,i,r){const f=`${p||""}|${i}|${r??""}`;let m=y.get(f);if(!m){const u={style:"currency",currency:i};typeof r=="number"&&(u.minimumFractionDigits=r,u.maximumFractionDigits=r);try{m={fmt:new Intl.NumberFormat(p||void 0,u),currency:!0}}catch{m={fmt:new Intl.NumberFormat(p||void 0,typeof r=="number"?{minimumFractionDigits:r,maximumFractionDigits:r}:{}),currency:!1}}y.set(f,m)}return m}function g(p,i){const r=i||{},f=r.nullDisplay??"",m=D(p);if(!m)return f;const u=U(r.display)||m.code;let b=m.amount,a=m.code;if(u!==m.code){const v=r.rateFn||j(r.rates,r.rateBase),A=k(m,u,v);if(A===null)return`${r.missingRate??K} ${m.code}→${u}`;b=A,a=u}const{fmt:h,currency:w}=l(r.locale,a,r.decimals);return w?h.format(b):`${h.format(b)} ${a}`}function s(p){const i=D(p);return i?`${i.amount} ${i.code}`:""}function t(p){const i=p||{},r=U(i.display),f=i.rateFn||j(i.rates,i.rateBase);return(m,u)=>{const b=D(m),a=D(u);if(!b&&!a)return 0;if(!b)return 1;if(!a)return-1;if(r){const h=k(b,r,f),w=k(a,r,f);if(h!==null&&w!==null)return h===w?0:h<w?-1:1}return b.code===a.code?b.amount===a.amount?0:b.amount<a.amount?-1:1:b.code<a.code?-1:1}}function o(p){const i=p||{},r=(m,u)=>{const b=[];for(const A of m||[]){const H=D(A);H&&b.push(H)}if(!b.length)return null;if(new Set(b.map(A=>A.code)).size===1){const A=b[0].code;return{amount:u(b.map(H=>H.amount)),code:A}}const h=U(i.display);if(!h)return`${i.missingRate??K}: mixed currencies, no display currency set`;const w=i.rateFn||j(i.rates,i.rateBase),v=[];for(const A of b){const H=k(A,h,w);if(H===null)return`${i.missingRate??K}: ${A.code}→${h}`;v.push(H)}return{amount:u(v),code:h}},f=m=>m.reduce((u,b)=>u+b,0);return{sum:m=>r(m,f),avg:m=>r(m,u=>f(u)/u.length),min:m=>r(m,u=>Math.min(...u)),max:m=>r(m,u=>Math.max(...u))}}function c(p){const i=Object.freeze({code:"USD",...p||{}}),r=j(i.rates,i.rateBase),f=Object.freeze({...i,rateFn:r}),m=o(f),u=t(f),b=new Map([[i.locale||"",f]]),a=v=>{const A=v||"";let H=b.get(A);return H||(H=Object.freeze({...f,locale:v||void 0}),b.set(A,H)),H},h=z[U(i.display||i.code)]||"",w=typeof i.decimals=="number"&&i.decimals>0?`.${"0".repeat(i.decimals)}`:".00";return{base:"object",extends:"object",storage:"object",name:"currency",currencyConfig:f,format:v=>g(v.value,v.locale?a(v.locale):f),parse:v=>I(v.text,v.locale?a(v.locale):f),compare:u,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:m},excel:i.excel||(h?`"${h}"#,##0${w}`:`#,##0${w}`),toStorage:v=>{const A=D(v);return A||(typeof v=="string"||typeof v=="number"?I(v,f):null)},toClipboard:v=>s(v),fromClipboard:v=>I(v,f)}}const d=Object.freeze({currency:c({code:"USD"}),usd:c({code:"USD"}),eur:c({code:"EUR"}),gbp:c({code:"GBP"}),jpy:c({code:"JPY",decimals:0})}),n=c}),ze("packages/core/src/columns/types/index.js",function(e,_){"use strict";Object.defineProperty(e,"EXTENDED_TYPES",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return G}});const ne=_("packages/core/src/columns/types/temporal.js"),E=ne.TEMPORAL_TYPES,K=_("packages/core/src/columns/types/network.js"),U=K.NETWORK_TYPES,D=_("packages/core/src/columns/types/structured.js"),J=D.STRUCTURED_TYPES,z=_("packages/core/src/columns/types/unit.js"),L=z.createUnitType,X=z.UNIT_SYSTEMS,I=z.parseUnit,j=z.formatUnit,k=z.registerUnitSystem,y=z.unitSystemNames,l=z.unitsOf,g=z.defineUnit,s=_("packages/core/src/columns/types/engineering.js"),t=s.ENGINEERING_TYPES,o=_("packages/core/src/columns/types/si.js"),c=o.SI_TYPES,d=o.createSiType,n=o.createSiSystem,p=o.siUnits,i=o.SI_PREFIXES,r=_("packages/core/src/columns/types/temperature.js"),f=r.TEMPERATURE_TYPES,m=r.createTemperatureType,u=r.convertTemperature,b=r.formatTemperature,a=r.parseTemperature,h=r.TEMPERATURE_SCALES,w=_("packages/core/src/columns/types/radix.js"),v=w.createRadixType,A=w.RADIX_PRESETS,H=w.parseRadix,G=w.formatRadix,Z=_("packages/core/src/columns/types/aggregable.js"),M=Z.AGGREGABLE_TYPES,S=_("packages/core/src/columns/types/currency.js"),T=S.CURRENCY_TYPES,O=S.createCurrencyType,N=S.parseMoney,P=S.formatMoney,C=S.convertMoney,B=S.toMoney,x=S.rateFunction,V=S.moneyComparator,Y=S.normaliseCode,F=S.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return z.findUnit}}),Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return s.ENGINEERING_TYPES}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return s.circularMean}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return r.TEMPERATURE_TYPES}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return r.createTemperatureType}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return r.convertTemperature}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return r.formatTemperature}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return r.parseTemperature}}),Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return r.TEMPERATURE_SCALES}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return r.findScale}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return S.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return S.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return S.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return S.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return S.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return S.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return S.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return S.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return S.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return S.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 K.NETWORK_TYPES}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return D.STRUCTURED_TYPES}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return Z.AGGREGABLE_TYPES}}),Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return Z.createLogarithmicType}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return Z.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 K.parseIpv4}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return K.formatIpv4}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return K.parseCidr}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return K.formatCidr}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return K.parseIpv6}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return K.formatIpv6}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return K.networkAddress}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return K.broadcastAddress}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return K.hostCount}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return K.containsAddress}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return K.overlaps}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return D.maskValue}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return D.summariseJson}});const $=Object.freeze({...E,...U,...J,...M,hex:v(A.hex),hex8:v(A.hex8),hex16:v(A.hex16),hex32:v(A.hex32),binary:v(A.binary),binary8:v(A.binary8),octal:v(A.octal),bytes:L({system:"data",unit:"B",display:"auto"}),megabytes:L({system:"data",unit:"MB"}),gigabytes:L({system:"data",unit:"GB"}),bitrate:L({system:"bitrate",unit:"Mbps"}),gigabits:L({system:"bitrate",unit:"Gbps"}),...t,...c,...f,...T});{const q=new Set;for(const ee of[E,U,J,M,t,c,f,T])for(const te of Object.keys(ee)){if(q.has(te))throw new Error(`[lattice] data type "${te}" is declared twice`);q.add(te)}}}),ze("packages/core/src/compute/handle.js",function(e,_){"use strict";Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return c}});const ne=_("packages/core/src/internal/compare.js"),E=ne.collator,K=ne.defaultCompare,D=_("packages/core/src/internal/warn.js").warnOnce;function J(d){const n=new Uint32Array(d);for(let p=0;p<d;p++)n[p]=p;return n}function z(d,n){if(n&&typeof n.count=="number")return n.count;if(!d)return 0;if(typeof d.count=="number")return d.count;if(typeof d.length=="number")return d.length;const p=d.values;return d.kind==="multi"&&d.offsets?Math.max(0,d.offsets.length-1):p?d.kind==="bitset"?typeof p.size=="number"?p.size:d.presence&&typeof d.presence.size=="number"?d.presence.size:(D(`count:${d.id}`,`column "${d.id}" is bitset-backed with no declared row count; assuming ${p.length*8}`),p.length*8):p.length:d.presence&&typeof d.presence.size=="number"?d.presence.size:0}const L=new WeakMap;function X(d){const n=d.constructor;if(!n)return"unknown";const p=L.get(n);if(p)return p;let i="unknown";try{let r=null;typeof n.from=="function"?r=n.from([!1,!0]):(r=new n(8),r.set(1));const f=r&&r.words;f&&f.length&&(f[0]===2?i="lsb":f[0]===64&&(i="msb"))}catch{i="unknown"}return L.set(n,i),i}function I(d){if(!d)return()=>0;const n=d instanceof Uint8Array?d:d.words;if(n instanceof Uint8Array){const p=d instanceof Uint8Array?"lsb":X(d);if(p==="lsb")return i=>n[i>>>3]>>>(i&7)&1;if(p==="msb")return i=>n[i>>>3]>>>7-(i&7)&1}return typeof d.get=="function"?p=>d.get(p)?1:0:()=>0}function j(d){return!d||!d.presence?null:I(d.presence)}function k(d){return d?typeof d.size=="number"?d.size:typeof d.values=="function"?d.values().length:0:0}function y(d,n){return d?typeof d.valueOf=="function"?d.valueOf(n):typeof d.values=="function"?d.values()[n]:null:null}function l(d,n){const p=d.offsets,i=d.values;if(!p||!i)return[];const r=p[n],f=p[n+1];if(!(f>r))return[];const m=d.dict,u=new Array(f-r);for(let b=r;b<f;b++)u[b-r]=m?y(m,i[b]):i[b];return u}function g(d){if(!d)return()=>{};const n=d.values,p=j(d),i=d.kind;if(i==="dictionary"){const r=d.dict;return p?f=>p(f)?y(r,n[f]):null:f=>y(r,n[f])}if(i==="bitset"){const r=I(n);return p?f=>p(f)?r(f)===1:null:f=>r(f)===1}if(i==="multi")return p?r=>p(r)?l(d,r):null:r=>l(d,r);if(!n&&typeof d.get=="function"){const r=d.get.bind(d);return f=>{const m=r(f);return m===void 0?null:m}}return p?r=>{if(!p(r))return null;const f=n[r];return f===void 0?null:f}:r=>{const f=n[r];return f===void 0?null:f}}function s(d,n){if(d<n)return-1;if(d>n)return 1;if(d===n){const r=Object.is(d,-0),f=Object.is(n,-0);return r===f?0:r?-1:1}const p=Number.isNaN(d),i=Number.isNaN(n);return p&&i?0:p?1:-1}function t(d){const n=E(d);return(p,i)=>{if(p===i)return 0;const r=typeof p,f=typeof i;if(r==="string"&&f==="string")return n.compare(p,i);if(r==="number"&&f==="number")return s(p,i);if(r==="boolean"&&f==="boolean")return p===i?0:p?1:-1;if(p instanceof Date||i instanceof Date){const m=p instanceof Date?p.getTime():Number(p),u=i instanceof Date?i.getTime():Number(i);return s(m,u)}return K(p,i)}}function o(d,n){if(d&&typeof d.ranks=="function")return d.ranks(n);const p=d&&typeof d.values=="function"?d.values():[],i=p.length,r=t(n),f=new Array(i);for(let u=0;u<i;u++)f[u]=u;f.sort((u,b)=>r(p[u],p[b])||u-b);const m=new Uint32Array(i);for(let u=0;u<i;u++)m[f[u]]=u;return m}function c(d){return d==null||typeof d=="number"&&Number.isNaN(d)}}),ze("packages/core/src/compute/filter.js",function(e,_){"use strict";Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"wallMs",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return Ae}});const E=_("packages/core/src/internal/predicates.js").isBlank,U=_("packages/core/src/internal/merge.js").toArray,J=_("packages/core/src/internal/warn.js").warnOnce,z=_("packages/core/src/format/date.js"),L=z.toDate,X=z.toIsoDate,I=_("packages/core/src/compute/handle.js"),j=I.bitReader,k=I.dictSize,y=I.dictValue,l=I.presenceReader,g=I.valueComparator,s=I.valueReader,t=/^\d{4}-\d{2}-\d{2}$/,o="\0null\0";function c(de,Oe){const Me=de&&de.pool;if(Me){const Fe=Me.mask||Me.acquireMask||Me.acquire||Me.take;if(typeof Fe=="function"){const pe=Fe.call(Me,Oe);if(pe&&pe.length>=Oe)return pe}}return new Uint8Array(Oe)}function d(de,Oe){const Me=de&&de.pool;if(!Me||!Oe)return;const Fe=Me.release||Me.releaseMask||Me.free||Me.recycle;typeof Fe=="function"&&Fe.call(Me,Oe)}function n(de,Oe,Me){return de.fill(Me,0,Oe),de}function p(de){return de==null||typeof de=="number"&&Number.isNaN(de)}function i(de,Oe){if(de==null)return de;if(Oe==="number")return typeof de=="number"?de:Number(de);if(Oe==="date"||Oe==="dateString"){const Me=X(de);return Me===null?r(de):Me}return Oe==="boolean"?typeof de=="boolean"?de:de==="true"||de===1?!0:de==="false"||de===0?!1:!!de:de}function r(de){return de instanceof Date?de.getTime():typeof de=="number"?de:Date.parse(String(de))}function f(de){return typeof de=="number"?de:de instanceof Date?de.getTime():de==null||de===""?NaN:Number(de)}function m(de,Oe){const Me=typeof de=="string"?de:String(de);return Oe?Me:Me.toLowerCase()}function u(de,Oe){return de==null?o:typeof de=="string"?Oe?de:de.toLowerCase():de instanceof Date?de.getTime():de}function b(de,Oe,Me){const Fe=new Set;for(const pe of U(de)){const ae=i(pe,Me);Fe.add(u(ae,Oe)),typeof ae=="string"&&ae!==""&&Number.isFinite(Number(ae))?Fe.add(Number(ae)):typeof ae=="number"&&Number.isFinite(ae)&&Fe.add(u(String(ae),Oe))}return Fe}function a(de,Oe,Me){if(de==null||Oe===null||Oe===void 0)return de==null&&Oe==null;const Fe=typeof de,pe=typeof Oe;return Fe==="string"&&pe==="string"?Me?de===Oe:de.toLowerCase()===Oe.toLowerCase():de instanceof Date||Oe instanceof Date?r(de)===r(Oe):Fe==="number"&&pe==="number"?de===Oe||Number.isNaN(de)&&Number.isNaN(Oe):Fe==="number"&&pe==="string"?de===Number(Oe):Fe==="string"&&pe==="number"?Number(de)===Oe:Fe==="boolean"||pe==="boolean"?de===Oe:Array.isArray(de)&&Array.isArray(Oe)?de.length===Oe.length&&de.every((ae,ge)=>a(ae,Oe[ge],Me)):de===Oe}function h(de,Oe){try{if(de instanceof RegExp){const Me=de.flags.replace(/[gy]/g,"");return new RegExp(de.source,Oe||Me.includes("i")?Me:`${Me}i`)}return new RegExp(String(de),Oe?"":"i")}catch(Me){return J(`regex:${String(de)}`,`filter operator "matches" received an invalid pattern: ${String(de)}`,Me),null}}function w(de,Oe){if(de&&de.type==="datetime"&&v.has(de.op))return M(de,Oe);const Me=S(de,Oe),Fe=de&&de.type;return Fe!=="date"&&Fe!=="dateString"?Me:pe=>Me(typeof pe=="string"&&t.test(pe)?pe:X(pe)??pe)}const v=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn"]),A=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3})\d*)?)?)?$/,H=new Map;function G(de,Oe){let Me=H.get(Oe);if(Me===void 0){try{Me=new Intl.DateTimeFormat("en-CA",{timeZone:Oe,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{Me=null}H.set(Oe,Me)}if(!Me)return null;const Fe={};for(const pe of Me.formatToParts(de))pe.type!=="literal"&&(Fe[pe.type]=pe.value);return Fe}function Z(de,Oe){if(de==null||de==="")return null;if(typeof de=="string"){const ae=A.exec(de.trim());if(ae)return Date.UTC(+ae[1],+ae[2]-1,+ae[3],+(ae[4]||0),+(ae[5]||0),+(ae[6]||0),+(ae[7]||"0").padEnd(3,"0"))}const Me=L(de);if(!Me)return null;const Fe=Me.getUTCMilliseconds(),pe=Oe?G(Me,Oe):null;return pe?Date.UTC(+pe.year,+pe.month-1,+pe.day,pe.hour==="24"?0:+pe.hour,+pe.minute,+pe.second,Fe):Date.UTC(Me.getFullYear(),Me.getMonth(),Me.getDate(),Me.getHours(),Me.getMinutes(),Me.getSeconds(),Fe)}function M(de,Oe){const Me=typeof de.timeZone=="string"&&de.timeZone?de.timeZone:void 0,Fe=ge=>Z(ge,Me),pe=Array.isArray(de.value)?de.value.map(Fe):Fe(de.value),ae=S({...de,type:"number",value:pe},Oe);return ge=>ae(Z(ge))}function S(de,Oe){const Me=de&&de.op,Fe=!!(de&&de.caseSensitive),pe=de&&de.type,ae=g(Oe),ge=ve=>le=>!ve(le);switch(Me){case"eq":{const ve=i(de.value,pe);return le=>a(le,ve,Fe)}case"ne":{const ve=i(de.value,pe);return le=>!a(le,ve,Fe)}case"lt":case"lte":case"gt":case"gte":{const ve=i(de.value,pe);if(p(ve))return()=>!1;const le=Me==="lt"?-1:Me==="lte"?0:Me==="gt"?1:2;return we=>{if(p(we))return!1;const he=ae(we,ve);return le===-1?he<0:le===0?he<=0:le===1?he>0:he>=0}}case"between":case"notBetween":{const ve=U(de.value),le=i(ve[0],pe),we=i(ve[1],pe),he=de.bounds||"[]",be=he.charAt(0)!=="(",Te=he.charAt(1)!==")";if(p(le)||p(we))return Me==="between"?()=>!1:()=>!0;const je=ke=>{if(p(ke))return!1;const Ue=ae(ke,le),Re=ae(ke,we);return(be?Ue>=0:Ue>0)&&(Te?Re<=0:Re<0)};return Me==="between"?je:ge(je)}case"in":case"notIn":{const ve=b(de.value,Fe,pe),le=we=>ve.has(u(we,Fe));return Me==="in"?le:ge(le)}case"contains":case"notContains":{const ve=m(i(de.value,pe),Fe),le=we=>we==null?!1:m(we,Fe).includes(ve);return Me==="contains"?le:ge(le)}case"startsWith":{const ve=m(i(de.value,pe),Fe);return le=>le==null?!1:m(le,Fe).startsWith(ve)}case"endsWith":{const ve=m(i(de.value,pe),Fe);return le=>le==null?!1:m(le,Fe).endsWith(ve)}case"matches":{const ve=h(de.value,Fe);return ve?le=>le==null?!1:ve.test(String(le)):()=>!1}case"blank":case"notBlank":{const ve=de.trim===!0,le=we=>E(we)||Array.isArray(we)&&we.length===0||ve&&typeof we=="string"&&we.trim()==="";return Me==="blank"?le:we=>!le(we)}case"containsAny":case"containsNone":{const ve=b(de.value,Fe,pe),le=we=>{const he=we==null?[]:U(we);for(let be=0;be<he.length;be++)if(ve.has(u(he[be],Fe)))return!0;return!1};return Me==="containsAny"?le:ge(le)}case"containsAll":{const ve=U(de.value).map(le=>u(i(le,pe),Fe));return le=>{const we=le==null?[]:U(le);if(ve.length===0)return!0;const he=new Set(we.map(be=>u(be,Fe)));for(let be=0;be<ve.length;be++)if(!he.has(ve[be]))return!1;return!0}}default:{const ve=Ae(Me);return ve?ve.compile(de.value):(J(`op:${String(Me)}`,`unknown filter operator "${String(Me)}"; the condition is refused rather than matching every row`),()=>!1)}}}function T(de,Oe,Me){return w(Oe,Me)(de)}const O=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),N=new Set(["containsAny","containsAll","containsNone"]);function P(de,Oe,Me){const Fe=de&&de.op,pe=O[Fe]||Fe,ae=w({...de,op:pe,type:Oe.type},Me),ge=Oe.items,ve=le=>{const we=ge(le);if(!we)return!1;for(let he=0;he<we.length;he++)if(ae(we[he]))return!0;return!1};return O[Fe]?le=>!ve(le):ve}function C(de,Oe,Me,Fe,pe){const ae=pe?null:l(de);if(ae){const le=Oe?1:0;for(let we=0;we<Fe;we++)Me[we]=ae(we)===le?1:0;return Me}const ge=de.kind;if(ge==="float64"||ge==="int32"||ge==="bitset")return n(Me,Fe,Oe?1:0);const ve=s(de);for(let le=0;le<Fe;le++){const we=ve(le),he=E(we)||Array.isArray(we)&&we.length===0||pe&&typeof we=="string"&&we.trim()==="";Me[le]=he===Oe?0:1}return Me}function B(de,Oe,Me,Fe){const pe=de.dict,ae=k(pe),ge=new Uint8Array(ae);for(let he=0;he<ae;he++)ge[he]=Oe(y(pe,he))?1:0;const ve=de.values,le=l(de);if(!le){for(let he=0;he<Fe;he++)Me[he]=ge[ve[he]];return Me}const we=Oe(null)?1:0;for(let he=0;he<Fe;he++)Me[he]=le(he)===1?ge[ve[he]]:we;return Me}function x(de,Oe,Me,Fe){const pe=j(de.values),ae=Oe(!0)?1:0,ge=Oe(!1)?1:0,ve=l(de);if(!ve){for(let we=0;we<Fe;we++)Me[we]=pe(we)===1?ae:ge;return Me}const le=Oe(null)?1:0;for(let we=0;we<Fe;we++)Me[we]=ve(we)===0?le:pe(we)===1?ae:ge;return Me}function V(de,Oe,Me,Fe,pe){const ae=de.values,ge=Oe.type,ve=Oe.op;let le=!0;switch(ve){case"eq":case"ne":{const he=f(i(Oe.value,ge)),be=typeof Oe.value=="number"&&Number.isNaN(Oe.value),Te=ve==="ne"?1:0;if(be)for(let je=0;je<pe;je++)Fe[je]=(Number.isNaN(ae[je])?1:0)^Te;else for(let je=0;je<pe;je++)Fe[je]=(ae[je]===he?1:0)^Te;break}case"lt":{const he=f(i(Oe.value,ge));for(let be=0;be<pe;be++)Fe[be]=ae[be]<he?1:0;break}case"lte":{const he=f(i(Oe.value,ge));for(let be=0;be<pe;be++)Fe[be]=ae[be]<=he?1:0;break}case"gt":{const he=f(i(Oe.value,ge));for(let be=0;be<pe;be++)Fe[be]=ae[be]>he?1:0;break}case"gte":{const he=f(i(Oe.value,ge));for(let be=0;be<pe;be++)Fe[be]=ae[be]>=he?1:0;break}case"between":case"notBetween":{const he=U(Oe.value),be=f(i(he[0],ge)),Te=f(i(he[1],ge)),je=Oe.bounds||"[]",ke=je.charAt(0)!=="(",Ue=je.charAt(1)!==")",Re=ve==="notBetween"?1:0;if(ke&&Ue)for(let Ee=0;Ee<pe;Ee++)Fe[Ee]=(ae[Ee]>=be&ae[Ee]<=Te?1:0)^Re;else if(ke)for(let Ee=0;Ee<pe;Ee++)Fe[Ee]=(ae[Ee]>=be&ae[Ee]<Te?1:0)^Re;else if(Ue)for(let Ee=0;Ee<pe;Ee++)Fe[Ee]=(ae[Ee]>be&ae[Ee]<=Te?1:0)^Re;else for(let Ee=0;Ee<pe;Ee++)Fe[Ee]=(ae[Ee]>be&ae[Ee]<Te?1:0)^Re;break}case"in":case"notIn":{const he=new Set;for(const Te of U(Oe.value)){const je=f(i(Te,ge));Number.isNaN(je)||he.add(je)}const be=ve==="notIn"?1:0;for(let Te=0;Te<pe;Te++)Fe[Te]=(he.has(ae[Te])?1:0)^be;break}default:le=!1;break}if(!le)return!1;const we=l(de);if(we){const he=Me(null)?1:0;for(let be=0;be<pe;be++)we(be)===0&&(Fe[be]=he)}return!0}function Y(de,Oe,Me,Fe){const pe=s(de);for(let ae=0;ae<Fe;ae++)Me[ae]=Oe(pe(ae))?1:0;return Me}function F(de,Oe,Me){const Fe=Oe.count|0,pe=Me||c(Oe,Fe);if(!de)return n(pe,Fe,1);const ae=typeof Oe.handle=="function"?Oe.handle(de.col):void 0,ge=typeof Oe.custom=="function"?Oe.custom:null;if(!ae){if(ge){for(let he=0;he<Fe;he++)pe[he]=ge(de,he)?1:0;return pe}return J(`filter:col:${String(de.col)}`,`filter references unknown column "${String(de.col)}"; the condition is refused rather than matching every row`),n(pe,Fe,0)}const ve=de.op;if(ve==="blank"||ve==="notBlank")return C(ae,ve==="notBlank",pe,Fe,de.trim===!0);const le=typeof Oe.itemwise=="function"?Oe.itemwise(de.col):null;if(le&&!Ae(ve)&&!N.has(ve))return Y(ae,P(de,le,Oe.locale),pe,Fe);const we=w(de,Oe.locale);switch(ae.kind){case"dictionary":return B(ae,we,pe,Fe);case"bitset":return x(ae,we,pe,Fe);case"float64":case"int32":return V(ae,de,we,pe,Fe)?pe:Y(ae,we,pe,Fe);default:return Y(ae,we,pe,Fe)}}function $(de,Oe,Me){if(!de)return n(c(Oe,Me),Me,1);if(Array.isArray(de.conditions)){const Fe=de.conditions.filter(ge=>ge!=null),pe=de.op==="or"?"or":de.op==="not"?"not":"and";if(Fe.length===0)return n(c(Oe,Me),Me,1);const ae=$(Fe[0],Oe,Me);for(let ge=1;ge<Fe.length;ge++){const ve=$(Fe[ge],Oe,Me);if(pe==="or")for(let le=0;le<Me;le++)ae[le]|=ve[le];else for(let le=0;le<Me;le++)ae[le]&=ve[le];d(Oe,ve)}if(pe==="not")for(let ge=0;ge<Me;ge++)ae[ge]^=1;return ae}return F(de,Oe,c(Oe,Me))}function q(de,Oe){return $(de,Oe,Oe.count|0)}function ee(de,Oe){if(!de||!Oe)return de||null;const Me=de;if(Array.isArray(Me.conditions)){if((Me.op==="or"?"or":Me.op==="not"?"not":"and")!=="and")return te(Me,Oe)?null:de;const pe=[];for(const ae of Me.conditions){const ge=ee(ae,Oe);ge&&pe.push(ge)}return pe.length?{...Me,op:"and",conditions:pe}:null}return Me.col===Oe?null:de}function te(de,Oe){if(!de||typeof de!="object")return!1;const Me=de;if(Me.col===Oe)return!0;if(Array.isArray(Me.conditions)){for(const Fe of Me.conditions)if(te(Fe,Oe))return!0}return!1}function re(de,Oe,Me){if(Me&&Me.length>=Oe){let ge=0;for(let ve=0;ve<Oe;ve++)de[ve]&&(Me[ge++]=ve);return Me.subarray(0,ge)}let Fe=0;for(let ge=0;ge<Oe;ge++)Fe+=de[ge]?1:0;const pe=new Uint32Array(Fe);let ae=0;for(let ge=0;ge<Oe;ge++)de[ge]&&(pe[ae++]=ge);return pe}const ie=new Map;function ue(de){if(!(!de||typeof de!="object"))for(const[Oe,Me]of Object.entries(de))Me&&typeof Me.compile=="function"&&ie.set(Oe,Me)}function Ae(de){return typeof de=="string"?ie.get(de):void 0}}),ze("packages/core/src/columns/datatypes.js",function(e,_){"use strict";Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"parseNumberText",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"BUILTIN_TYPES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return P}});const ne=_("packages/core/src/internal/compare.js"),E=ne.collator,K=ne.defaultCompare,U=_("packages/core/src/internal/predicates.js"),D=U.isNil,J=U.isObject,z=U.isFunction,X=_("packages/core/src/internal/warn.js").fail,j=_("packages/core/src/internal/text.js").titleCase,k=_("packages/core/src/format/date.js"),y=k.toDate,l=k.toIsoDate,g=k.compareIso,t=_("packages/core/src/format/boolean.js").toTriState,c=_("packages/core/src/columns/types/index.js").EXTENDED_TYPES,d=_("packages/core/src/formula/index.js"),n=d.evaluateFormula,p=d.looksLikeFormula,r=_("packages/core/src/compute/filter.js").declareOperators,f=/^\d{4}-\d{2}-\d{2}$/;function m(C){return C.getHours()===0&&C.getMinutes()===0&&C.getSeconds()===0&&C.getMilliseconds()===0}const u=new Map;function b(C){const B=C||"",x=u.get(B);if(x)return x;const V={group:",",decimal:"."};try{for(const Y of new Intl.NumberFormat(C||void 0).formatToParts(12345.6))Y.type==="group"?V.group=Y.value:Y.type==="decimal"&&(V.decimal=Y.value)}catch{}return u.set(B,V),V}const a=/\d\s*[*/^]\s*[\d.(]/;function h(C,B){if(D(C))return null;let x=String(C).trim();if(x===""||x.startsWith("=")||a.test(x))return null;let V=1;x.startsWith("(")&&x.endsWith(")")&&(V=-1,x=x.slice(1,-1));const Y=x.endsWith("%"),{group:F,decimal:$}=b(B);if(x=x.replace(/[\s\u00a0\u202f\u2009']/g,""),F&&F!=="."&&F!==","&&(x=x.split(F).join("")),x=x.replace(/[^0-9eE+\-.,]/g,""),$===","?x=x.split(".").join("").replace(",","."):x=x.split(",").join(""),x===""||x==="-"||x==="+")return null;const q=Number(x);return Number.isNaN(q)?null:V*(Y?q/100:q)}function w(C,B){const x=D(C)||Number.isNaN(C)?null:Number(C),V=D(B)||Number.isNaN(B)?null:Number(B);return x===null?V===null?0:1:V===null||x<V?-1:x>V?1:0}function v(C,B){const x=t(C),V=t(B);return x===null?V===null?0:1:V===null?-1:x===V?0:x?1:-1}function A(C,B){const x=y(C),V=y(B);if(!x)return V?1:0;if(!V)return-1;const Y=x.getTime(),F=V.getTime();return Y<F?-1:Y>F?1:0}const H=new Map;function G(C){const B=y(C.value);if(!B)return"";const x=C.locale||"";let V=H.get(x);return V||(V=new Intl.DateTimeFormat(C.locale||void 0,{dateStyle:"medium"}),H.set(x,V)),V.format(B)}const Z={boolean:{base:"boolean",storage:"bitset",matches:C=>typeof C=="boolean",parse:C=>t(C.text),compare:v,format:C=>t(C.value)===null?"":t(C.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:C=>t(C)===null?"":String(t(C)),fromClipboard:C=>t(C)},number:{base:"number",storage:"float64",matches:C=>typeof C=="number"&&!Number.isNaN(C),parse:C=>{if(p(C.text)){const B=n(C.text,C);if(!B.ok)return null;const x=Number(B.value);return Number.isFinite(x)?x:null}return h(C.text,C.locale)},compare:w,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:C=>D(C)?"":String(C),fromClipboard:(C,B)=>h(C,B&&B.locale)},date:{base:"dateString",storage:"dictionary",matches:C=>typeof C=="string"&&f.test(C)&&!Number.isNaN(Date.parse(C))||C instanceof Date&&!Number.isNaN(C.getTime())&&m(C),parse:C=>l(C.text),compare:g,format:G,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:C=>l(C),toClipboard:C=>D(C)?"":String(C),fromClipboard:C=>l(C)},dateString:{base:"dateString",storage:"dictionary",matches:C=>typeof C=="string"&&f.test(C)&&!Number.isNaN(Date.parse(C)),parse:C=>l(C.text),compare:g,format:G,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:C=>l(C),toClipboard:C=>D(C)?"":String(C),fromClipboard:C=>l(C)},text:{base:"text",storage:"dictionary",matches:C=>typeof C=="string",parse:C=>C.text===""?null:String(C.text),compare:(C,B)=>D(C)?D(B)?0:1:D(B)?-1:E().compare(String(C),String(B)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:C=>D(C)?"":String(C),fromClipboard:C=>C},image:{base:"text",storage:"dictionary",parse:C=>C.text===""||C.text==null?null:String(C.text).trim(),compare:(C,B)=>D(C)?D(B)?0:1:D(B)?-1:E().compare(String(C),String(B)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:C=>D(C)?"":String(C),fromClipboard:C=>C},lookup:{base:"text",storage:"dictionary",parse:C=>{if(C.text===""||C.text==null)return null;const B=C.column&&C.column.lookup,x=B&&z(B.options)?B.options():null;if(!x)return C.text;const V=String(C.text),Y=x.find(q=>String(q.id)===V);if(Y)return Y.id;const F=V.trim().toLowerCase(),$=x.find(q=>String(q.label).toLowerCase()===F);return $?$.id:C.text},compare:K,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:C=>D(C)?"":String(C),fromClipboard:C=>C},object:{base:"object",storage:"object",matches:C=>C!==null&&typeof C=="object"&&!(C instanceof Date),parse:C=>{try{return C.text===""?null:JSON.parse(C.text)}catch{return C.text}},compare:(C,B)=>K(C,B),format:C=>{const B=C.value;if(D(B))return"";if(typeof B=="string")return B;try{return JSON.stringify(B)}catch{return String(B)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:C=>D(C)?"":typeof C=="string"?C:JSON.stringify(C),fromClipboard:C=>C}},M=["boolean","number","date","dateString","datetime","text","object"];function S(C,B,x,V){const Y=x.get(C);if(Y)return Y;V.includes(C)&&X(`circular data type extends chain: ${[...V,C].join(" → ")}`);const F=B[C];F||X(`unknown data type "${C}"`);let $=null;F.extends&&($=S(F.extends,B,x,[...V,C]));const q={...$||{},...F,name:C,defaults:{...$&&$.defaults||{},...F.defaults||{}}};return q.base||(q.base=$&&$.base||"text"),q.storage||(q.storage=$&&$.storage||"object"),x.set(C,q),q}function T(C,B){const x={...Z,...c};if(B&&typeof B.dataType=="function"&&typeof B.names=="function")for(const Y of B.names("dataType")){const F=B.dataType(Y);F&&(x[Y]=F)}if(J(C))for(const[Y,F]of Object.entries(C))x[Y]=F;const V=new Map;for(const Y of M)S(Y,x,V,[]);S("lookup",x,V,[]);for(const Y of Object.keys(x))S(Y,x,V,[]);for(const Y of V.values())r(Y.operators);return V}function O(C,B){if(C.base==="text"&&(!C.compare||C.compare===Z.text.compare)){const x=E(B);return(V,Y)=>D(V)?D(Y)?0:1:D(Y)?-1:x.compare(String(V),String(Y))}return C.compare||K}function N(C,B){return B?C.multiStorage||"multi":C.storage||"object"}function P(C){return j(String(C).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),ze("packages/core/src/columns/infer.js",function(e,_){"use strict";Object.defineProperty(e,"DEFAULT_SAMPLE",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"inferFromValues",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return z}});const E=_("packages/core/src/internal/warn.js").infoOnce,U=_("packages/core/src/internal/predicates.js").isNil,D=100;function J(L,X,I={}){const j=I.sampleSize??D,k=[];for(let y=0;y<L.length&&k.length<j;y++){const l=L[y];U(l)||typeof l=="number"&&Number.isNaN(l)||k.push(l)}if(k.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[y,l]of X){if(typeof l.matches!="function")continue;let g=!0;for(let s=0;s<k.length;s++)if(!l.matches(k[s])){g=!1;break}if(g)return{type:y,unanimous:!0,sampled:k.length}}return I.quiet||E(`infer:${I.colId||"?"}`,`column "${I.colId||"?"}" has mixed or ambiguous values and was inferred as "text". Declare \`type\` on the column to get correct sorting, filtering and export.`),{type:"text",unanimous:!1,sampled:k.length}}function z(L,X,I,j,k={}){const y=k.sampleSize??D,l=[];for(let g=0;g<X.length&&l.length<y;g++){const s=I(X[g]);U(s)||typeof s=="number"&&Number.isNaN(s)||l.push(s)}return J(l,j,{...k,colId:L}).type}}),ze("packages/core/src/columns/graph.js",function(e,_){"use strict";Object.defineProperty(e,"WHOLE_ROW",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"declarationOf",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return j}});const ne=_("packages/core/src/internal/warn.js"),E=ne.DEV,K=ne.fail,U=ne.warnOnce,J=_("packages/core/src/internal/predicates.js").isFunction,z="*";function L(k){const y=k.value||{};if(!J(y.compute))return{computed:!1,wholeRow:!1,deps:[],pure:!0};const g=y.pure!==!1;return y.deps===z?{computed:!0,wholeRow:!0,deps:[],pure:g}:Array.isArray(y.deps)?{computed:!0,wholeRow:!1,deps:y.deps.slice(),pure:g}:(U(`deps:missing:${k.id}`,`computed column "${k.id}" declares no \`value.deps\`; treating it as \`deps: '*'\` (a whole-row dependency). Declare the dependencies to get precise invalidation.`),{computed:!0,wholeRow:!0,deps:[],pure:g})}function X(k){const y=new Map;for(const f of k)y.set(f.id,f);const l=new Map,g=new Map,s=new Set,t=new Set,o=new Set,c=new Set;for(const f of k){const m=L(f);if(!m.computed){l.set(f.id,[]);continue}t.add(f.id),(m.pure?o:c).add(f.id),m.wholeRow&&s.add(f.id);const u=[],b=[];for(const a of m.deps)(y.has(a)?u:b).push(a);l.set(f.id,u),b.length&&g.set(f.id,b)}for(const f of o)for(const m of l.get(f))c.has(m)&&K(`pure computed column "${f}" depends on impure column "${m}". Mark it \`value.pure: false\` or make the dependency pure.`);const d=[],n=new Map,p=[],i=f=>{const m=n.get(f);if(m!=="done"){if(m==="open"){const u=p.indexOf(f);K(`circular column dependency: ${[...p.slice(u),f].join(" → ")}`)}n.set(f,"open"),p.push(f);for(const u of l.get(f)||[])y.has(u)&&i(u);p.pop(),n.set(f,"done"),d.push(f)}};for(const f of k)i(f.id);const r=new Map;for(const f of k)r.set(f.id,[]);for(const f of k)for(const m of l.get(f.id)||[]){const u=r.get(m);u&&!u.includes(f.id)&&u.push(f.id)}if(s.size)for(const f of k){if(t.has(f.id))continue;const m=r.get(f.id);for(const u of s)m.includes(u)||m.push(u)}return{order:d,dependents:r,pure:o,impure:c,computed:t,deps:l,wholeRow:s,external:g,index:y}}function I(k,y){const l=Array.isArray(y)?y:[y],g=new Set,s=[...l];for(;s.length;){const t=s.shift();for(const o of k.dependents.get(t)||[])g.has(o)||(g.add(o),s.push(o))}for(const t of l)g.delete(t);return k.order.filter(t=>g.has(t))}function j(k,y,l){if(!E)return k;const g=y instanceof Set?y:new Set(y);return new Proxy(k,{get(s,t){return typeof t=="string"&&!g.has(t)&&!Object.hasOwn(s,t)&&U(`undeclared:${l}:${t}`,`computed column "${l}" read undeclared dependency "${t}". Add it to \`value.deps\` or the value will go stale.`),s[t]}})}}),ze("packages/core/src/model/rowkey.js",function(e,_){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"compositeKey",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createRowKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"warnMissingKeys",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"groupPathKey",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"splitPathKey",{enumerable:!0,get:function(){return t}});const E=_("packages/core/src/internal/warn.js").warnOnce,U=_("packages/core/src/internal/paths.js").pathGetter,D=_("packages/core/src/internal/predicates.js"),J=D.isFunction,z=D.isBlank,L=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],X="";function I(o){if(o===null)return"\0n";if(o===void 0)return"\0u";const c=typeof o;if(c==="string")return o;if(c==="number"||c==="bigint"||c==="boolean")return String(o);if(o instanceof Date)return`\0d${o.getTime()}`;try{return`\0o${JSON.stringify(o)}`}catch{return"\0o?"}}function j(o){if(o.length===1)return I(o[0]);let c="";for(let d=0;d<o.length;d++)d&&(c+=X),c+=I(o[d]);return c}function k(o,c={}){const d=c.warn!==!1;if(J(o)){const n=o;return{stable:!0,fields:[],disabled:[],key(p,i){try{const r=n(p);return Array.isArray(r)?j(r):I(r)}catch(r){return E("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",r),`#${i??-1}`}},keyEmpty(p){try{const i=n(p);return Array.isArray(i)?i.length===0||i.some(z):z(i)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(o)&&o.length>0){const n=o.filter(r=>typeof r=="string"),p=n.map(r=>U(r)),i=p.length;return{stable:!0,fields:n,disabled:[],key(r){const f=new Array(i);for(let m=0;m<i;m++)f[m]=p[m](r);return j(f)},keyEmpty(r){for(let f=0;f<i;f++)if(z(p[f](r)))return!0;return!1},missingFields(r){const f=[];for(let m=0;m<i;m++)z(p[m](r))&&f.push(n[m]);return f}}}if(typeof o=="string"&&o.length>0){const n=U(o);return{stable:!0,fields:[o],disabled:[],key(p){return I(n(p))},keyEmpty(p){return z(n(p))},missingFields(p){return z(n(p))?[o]:[]}}}return d&&E("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${L.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:L.slice(),key(n,p){if(n===null||typeof n!="object")return`#${p??0}:${String(n)}`;let i=y.get(n);return i===void 0&&(i=`#${l++}`,y.set(n,i)),i}}}const y=new WeakMap;let l=0;function g(o,c){if(!o||o.stable===!1||!J(o.keyEmpty)||!Array.isArray(c)||c.length===0)return;let d=0,n=null,p;for(let m=0;m<c.length;m++){const u=c[m];o.keyEmpty(u)&&(d++,n===null&&(n=J(o.missingFields)?o.missingFields(u):[],p=u))}if(d===0)return;const i=o.fields.length?o.fields.join(","):"(function)",r=n&&n.length?n.join(", "):o.fields.length?o.fields.join(", "):"the rowKey function",f=p!==null&&typeof p=="object"?Object.keys(p).join(", ")||"(no fields)":String(p);E(`rowKey.emptyValue:${i}`,`rowKey ${r} is missing on ${d} of ${c.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 s(o){return j(o)}function t(o){return o.split(X)}}),ze("packages/core/src/columns/lookup.js",function(e,_){"use strict";Object.defineProperty(e,"DEFAULT_SEPARATOR",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"normaliseOption",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"Lookup",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"toValueArray",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createLookup",{enumerable:!0,get:function(){return o}});const ne=_("packages/core/src/internal/compare.js"),E=ne.collator,K=ne.defaultCompare,U=_("packages/core/src/internal/predicates.js"),D=U.isFunction,J=U.isNil,L=_("packages/core/src/internal/warn.js").warnOnce,I=_("packages/core/src/model/rowkey.js").compositeKey,j=", ",k="";function y(c,d,n,p){if(c===null||typeof c!="object")return{id:c,label:c==null?"":String(c)};const i=c[d],r=c[n],f={id:i,label:r==null?String(i??""):String(r)};c.disabled&&(f.disabled=!0),c.variant&&(f.variant=c.variant),c.icon&&(f.icon=c.icon);const m=p?c[p]:c.group;return m!==void 0&&(f.group=m),f}function l(c,d,n=0,p=[],i=[]){for(const r of c||[]){const f=r&&typeof r=="object"?r[d]:null;if(i.push({raw:r,depth:n,path:p}),Array.isArray(f)&&f.length){const m=String(r&&typeof r=="object"?r.label??r.name??r.id??"":r);l(f,d,n+1,[...p,m],i)}}return i}function g(c){return!!c&&typeof c=="object"&&!Array.isArray(c)&&D(c.router&&c.router.subscribe)}class s{#e;#t;#n;#r;#s=[];#i=new Map;#o=new Map;#l=0;#a="idle";#c=null;#u;#d=null;#f=new Map;constructor(d,n={}){this.#e=d||{},this.#t=n.colId||"?",this.#n=n.locale,this.#r=n.onChange||null,this.#u=E(this.#n),Array.isArray(this.#e.options)?this.#h(this.#e.options):this.#e.options===void 0&&(this.#a="ready")}get colId(){return this.#t}get version(){return this.#l}get state(){return this.#a}get ready(){return this.#a==="ready"}get multiple(){return this.#e.multiple===!0}get separator(){return this.#e.separator??j}get allowCustom(){return this.#e.allowCustom===!0}get sortBy(){return this.#e.sortBy||"label"}get spec(){return this.#e}options(){return this.#s}setLocale(d){this.#n=d,this.#u=E(d)}#h(d){const n=this.#e,p=n.valueKey||"id",i=n.labelKey||"label",r=n.childrenKey||"children";this.#s=l(d,r).map(f=>{const m=y(f.raw,p,i,n.groupKey);return f.depth&&(m.depth=f.depth,m.path=f.path),m}),this.#i=new Map,this.#o=new Map,this.#s.forEach((f,m)=>{this.#i.set(f.id,f),this.#o.set(f.id,m)}),this.#a="ready",this.#l+=1}load(){if(this.#c)return this.#c;const d=this.#e.options;if(Array.isArray(d)||d===void 0)return this.#c=Promise.resolve(this.#s),this.#c;if(g(d))return this.#c=this.#p(d),this.#c;if(!D(d))return L(`lookup:options:${this.#t}`,`column "${this.#t}" has an invalid \`lookup.options\`; expected an array, a function, or a router route`),this.#a="ready",this.#c=Promise.resolve([]),this.#c;this.#a="loading";let n;try{n=d()}catch(p){return this.#a="error",L(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,p),this.#c=Promise.resolve([]),this.#c}return!n||!D(n.then)?(this.#h(n),this.#c=Promise.resolve(this.#s),this.#r&&this.#r(this),this.#c):(this.#c=n.then(p=>(this.#h(p),this.#r&&this.#r(this),this.#s),p=>(this.#a="error",L(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,p),[])),this.#c)}refresh(){return this.#c=null,Array.isArray(this.#e.options)?(this.#h(this.#e.options),this.#r&&this.#r(this),Promise.resolve(this.#s)):this.load()}#p(d){if(this.#d)return Promise.resolve(this.#s);const n=this.#e,p=n.valueKey||"id",i=n.labelKey||"label",r=n.groupKey,f=D(d.map)?d.map:null,m=b=>y(f?f(b):b,p,i,r).id,u=b=>this.#m(b,f,p,i,r);return d.router.subscribe(d.predicate,u,{rowKey:m}),this.#d=()=>{D(d.router.detach)&&d.router.detach(u)},this.#a="ready",Promise.resolve(this.#s)}#m(d,n,p,i,r){const f=d&&d.add||[],m=d&&d.update||[],u=d&&d.remove||[];if(!(!f.length&&!m.length&&!u.length)){for(const b of f)this.#g(b,n,p,i,r);for(const b of m)this.#g(b,n,p,i,r);for(const b of u){if(!this.#f.has(b))continue;const a=this.#f.get(b);this.#f.delete(b),this.#i.delete(a);const h=this.#s.findIndex(w=>w.id===a);h>=0&&this.#s.splice(h,1)}this.#o=new Map(this.#s.map((b,a)=>[b.id,a])),this.#a="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(d,n,p,i,r){const f=y(n?n(d):d,p,i,r);this.#f.set(I([f.id]),f.id);const m=this.#s.findIndex(u=>u.id===f.id);m>=0?this.#s[m]=f:this.#s.push(f),this.#i.set(f.id,f)}destroy(){this.#d&&(this.#d(),this.#d=null)}search(d,n){const p=this.#e;if(!D(p.search)){const f=String(d||"").toLowerCase();return Promise.resolve(f===""?this.#s:this.#s.filter(m=>m.label.toLowerCase().includes(f)))}const i=p.valueKey||"id",r=p.labelKey||"label";return Promise.resolve(p.search(d,n)).then(f=>(f||[]).map(m=>y(m,i,r,p.groupKey)))}option(d){return this.#i.get(d)}has(d){return this.#i.has(d)}label(d){if(J(d)||d==="")return"";const n=this.#i.get(d);if(n)return n.label;if(this.#a==="loading"||this.#a==="idle")return"";this.allowCustom||L(`lookup:unknown:${this.#t}`,`column "${this.#t}" holds value ${JSON.stringify(d)} which is not in its lookup options. Showing the raw value; set \`lookup.unknownLabel\` or \`lookup.allowCustom\` to change that.`);const p=this.#e.unknownLabel;return D(p)?String(p(d)??""):typeof p=="string"?p:String(d)}text(d){if(this.multiple){const n=t(d);return n.length===0?"":n.map(p=>this.label(p)).join(this.separator)}return this.label(d)}dictionary(){return this.#s.map(d=>d.id)}sorted(){const d=this.sortBy;if(d==="optionOrder"||d==="count")return this.#s.slice();if(d==="value")return this.#s.slice().sort((p,i)=>K(p.id,i.id));const n=this.#u;return this.#s.slice().sort((p,i)=>n.compare(p.label,i.label))}comparator(){const d=this.sortBy,n=this.multiple,p=this.#u,i=this.#o;if(n&&d==="count")return(f,m)=>t(f).length-t(m).length;const r=n?f=>t(f)[0]:f=>f;return d==="value"?(f,m)=>K(r(f),r(m)):d==="optionOrder"?(f,m)=>{const u=i.has(r(f))?i.get(r(f)):Number.MAX_SAFE_INTEGER,b=i.has(r(m))?i.get(r(m)):Number.MAX_SAFE_INTEGER;return u-b}:(f,m)=>{const u=r(f),b=r(m);return J(u)?J(b)?0:1:J(b)?-1:p.compare(this.label(u),this.label(b))}}groupKey(d){return this.multiple?t(d).map(p=>String(p)).sort().join(k):J(d)?"":String(d)}countValues(d){return this.multiple?t(d).length:J(d)?0:1}contains(d,n,p){const i=this.multiple?t(d):J(d)?[]:[d],r=Array.isArray(n)?n:[n];switch(p){case"containsAll":return r.every(f=>i.includes(f));case"containsNone":return!r.some(f=>i.includes(f));default:return r.some(f=>i.includes(f))}}exportText(d,n="label"){return n==="value"?this.multiple?t(d).join(this.separator):J(d)?"":String(d):this.text(d)}exportColumns(){const d=this.multiple;return this.#s.map(n=>({id:n.id,label:n.label,has:p=>d?t(p).includes(n.id):p===n.id}))}}function t(c){return Array.isArray(c)?c:J(c)||c===""?[]:[c]}function o(c,d={}){const n=c.lookup;if(!n)return null;const p=new s(n,{colId:c.id,locale:d.locale,onChange:d.onChange});return!Array.isArray(n.options)&&n.options!==void 0&&p.load(),p}}),ze("packages/core/src/columns/value.js",function(e,_){"use strict";Object.defineProperty(e,"compileDisplay",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"warnImpureUse",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"ValuePipeline",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return s}});const E=_("packages/core/src/internal/paths.js").getPath,K=_("packages/core/src/internal/predicates.js"),U=K.isFunction,D=K.isNil,z=_("packages/core/src/internal/lru.js").Lru,X=_("packages/core/src/internal/warn.js").warnOnce,j=_("packages/core/src/columns/graph.js").depsProxy,k="\0";function y(d,n={}){const p=n.locale,i=n.grid??null,r=n.context,f=d.value&&d.value.format,m=d.formatter||null,u=d.dataType&&d.dataType.format,b=d.lookup||null,a=(h,w,v)=>({value:h,data:v,row:w,column:d,colId:d.id,grid:i,context:r,locale:p});if(U(f))return(h,w,v)=>{const A=f(a(h,w,v));return A==null?"":String(A)};if(m){if(b){const h=m.kind==="text";return(w,v,A)=>m(h?b.text(w):w,a(w,v,A))}return(h,w,v)=>m(h,a(h,w,v))}return U(u)?(h,w,v)=>{const A=u(a(h,w,v));return A==null?"":String(A)}:b?h=>b.text(h):h=>D(h)?"":typeof h=="string"?h:String(h)}function l(d,n){!d||!d.value||d.value.pure!==!1||X(`impure:${n}:${d.id}`,`column "${d.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${n}. The result is not stable across passes.`)}class g{#e;#t;#n;#r;#s;#i;#o=new z(4096);constructor(n){this.#e=n.columns instanceof Map?n.columns:new Map((n.columns||[]).map(p=>[p.id,p])),this.#t=n.graph,this.#n=n.grid??null,this.#r=n.context,this.#i=n.stored||null,this.#s=n.rowKey||s}get graph(){return this.#t}setGraph(n){this.#t=n,this.#o.clear()}beginPass(){this.#o.clear()}endPass(){this.#o.clear()}invalidate(n){if(this.#o.size===0)return;const p=n&&n.rows?new Set([...n.rows].map(String)):null,i=n&&n.columns?[...n.columns]:null;if(!p&&!i){this.#o.clear();return}const r=i?this.#l(i):null;for(const f of[...this.#o.keys()]){const m=String(f).split(k);m.length===3&&(p&&!p.has(m[0])||r&&!r.has(m[2])||this.#o.delete(f))}}#l(n){const p=new Set,i=this.#t,r=[...n];for(;r.length;){const f=r.pop();if(!p.has(f)){p.add(f);for(const m of i?i.dependents.get(f)||[]:[])r.push(m)}}return p}value(n,p,i){const r=typeof n=="string"?this.#e.get(n):n;if(!r)return;if(!r.computed)return this.#c(r,p,i);if(r.value.pure!==!1&&this.#i&&i&&i.physical!=null&&this.#i.has(r.id))return this.#i.get(r.id,i.physical);if(r.volatile)return this.compute(r,p,i);if(r.value.pure===!1)return this.compute(r,p,i);const f=`${this.#a(p,i)}${k}${r.id}`;if(this.#o.has(f))return this.#o.get(f);const m=this.compute(r,p,i);return this.#o.set(f,m),m}#a(n,p){return`${this.#s(n,p)}${k}${t(n)}`}#c(n,p,i){if(this.#i&&i&&i.physical!=null&&this.#i.has(n.id))return this.#i.get(n.id,i.physical);if(n.field)return n.read?n.read(p):E(p,n.field)}compute(n,p,i){const r=this.#t,f=r&&r.wholeRow.has(n.id);let m;if(f)m=p??{};else{m={};const b=r&&r.deps.get(n.id)||[];for(const h of b)m[h]=this.value(h,p,i);const a=r&&r.external.get(n.id)||[];for(const h of a)m[h]=E(p,h);m=j(m,[...b,...a],n.id)}const u={data:p,row:i,column:n,grid:this.#n,context:this.#r};return n.value.compute(m,u)}values(n,p){const i={},r=this.#t?this.#t.order:[...this.#e.keys()];for(const f of r)i[f]=this.value(f,n,p);return i}text(n,p,i){const r=typeof n=="string"?this.#e.get(n):n;return r?r.formatValue(this.value(r,p,i),i,p):""}key(n,p,i){const r=typeof n=="string"?this.#e.get(n):n;if(!r)return"";const f=this.value(r,p,i);return U(r.value.key)?String(r.value.key(this.#u(r,f,p,i))):r.lookup?r.lookup.groupKey(f):D(f)?"":String(f)}quickFilterText(n,p,i){const r=typeof n=="string"?this.#e.get(n):n;if(!r)return"";if(U(r.value.quickFilterText)){const f=this.value(r,p,i);return String(r.value.quickFilterText(this.#u(r,f,p,i))??"")}return this.text(r,p,i)}#u(n,p,i,r){return{value:p,data:i,row:r,column:n,colId:n.id,grid:this.#n,context:this.#r}}parse(n,p,i,r){const f=typeof n=="string"?this.#e.get(n):n;if(!f)return p;const m={text:p,value:this.value(f,i,r),data:i,row:r,column:f,grid:this.#n,context:this.#r,locale:this.#n&&U(this.#n.get)?this.#n.get("locale"):void 0,formulaFunctions:this.#n&&U(this.#n.get)?this.#n.get("formulaFunctions"):void 0};return U(f.value.parse)?f.value.parse(m):f.dataType&&U(f.dataType.parse)?f.dataType.parse(m):p}validate(n,p,i,r,f){const m=typeof n=="string"?this.#e.get(n):n;if(!m||!U(m.edit.validate))return!0;const u=m.edit.validate({value:p,oldValue:i,data:r,row:f,column:m,grid:this.#n,context:this.#r});return u===!0||u===void 0?!0:String(u)}apply(n,p,i,r){const f=typeof n=="string"?this.#e.get(n):n;if(!f)return!1;const m=this.value(f,i,r);if(U(f.value.apply)){const u=f.value.apply({value:p,oldValue:m,data:i,row:r,column:f,grid:this.#n,context:this.#r});return this.#d(f,i,r),u!==!1}return f.field?m===p?!1:(f.write(i,p),this.#d(f,i,r),!0):(X(`apply:${f.id}`,`column "${f.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(n,p,i,r){const f=typeof n=="string"?this.#e.get(n):n;if(!f)return{ok:!1,value:void 0,oldValue:void 0,changed:!1,error:"unknown column"};const m=this.value(f,i,r),u=this.parse(f,p,i,r),b=this.validate(f,u,m,i,r);if(b!==!0)return{ok:!1,value:u,oldValue:m,changed:!1,error:b};const a=this.apply(f,u,i,r);return{ok:!0,value:u,oldValue:m,changed:a}}#d(n,p,i){if(this.#o.size===0)return;const r=this.#a(p,i);this.#o.delete(`${r}${k}${n.id}`);for(const f of this.#t?this.#t.dependents.get(n.id)||[]:[])this.#o.delete(`${r}${k}${f}`)}}function s(d,n){return n&&n.key!=null?String(n.key):t(d)}function t(d){if(d&&typeof d=="object"){let n=o.get(d);return n===void 0&&(n=`#${c++}`,o.set(d,n)),n}return String(d)}const o=new WeakMap;let c=0}),ze("packages/core/src/model/shadow.js",function(e,_){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"HISTORY_TICK_MAX_MS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"HISTORY_TICK_MIN_MS",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"CLUSTER_SHADOW_KINDS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"DEFAULT_ANOMALY_THRESHOLD",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"SPEC_STATUS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"POSITIONAL_KINDS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"SHADOW_LABELS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"specStatusOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ShadowTracker",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"shadowsIn",{enumerable:!0,get:function(){return r}});const E=_("packages/core/src/internal/warn.js").warnOnce,K=2e5,U=20,D=1e3,J=50;function z(f){return Math.min(D,Math.max(J,Math.floor(f)))}const L=Object.freeze(["updates","updatedAt","sinceUpdate","delta","deltaPercent","rate","history","firstValue","streak","rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag","specStatus","rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta","fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD","cluster","clusterDistance"]),X=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),I=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),j=Object.freeze(["cluster","clusterDistance"]),k=.6745,y=3.5,l=Object.freeze({PASS:"PASS",WARN:"WARN",FAIL:"FAIL"}),g=Object.freeze(["rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag"]),s=Object.freeze({updates:"Updates",updatedAt:"Updated at",sinceUpdate:"Since update",delta:"Change",deltaPercent:"Change %",rate:"Rate of change",history:"History",firstValue:"Baseline",streak:"Streak",rank:"Rank",rankAsc:"Rank, ascending",rankChange:"Rank change",percentile:"Percentile",quartile:"Quartile",zScore:"Z-score",shareOfTotal:"Share of total",anomalyScore:"Anomaly score",anomalyFlag:"Anomaly",specStatus:"Spec status",rollingSum:"Rolling sum",rollingAvg:"Rolling average",rollingMin:"Rolling minimum",rollingMax:"Rolling maximum",windowCoverage:"Window coverage",cumulativeToDate:"Cumulative to date",periodOverPeriod:"Period over period",rollingQuantile:"Rolling quantile",windowApproximate:"Window approximate",tsTrend:"Trend",tsSeasonal:"Seasonal",tsResidual:"Seasonal residual",tsCoverage:"Decomposition coverage",tsSmoothed:"Smoothed",tsSmoothingAlpha:"Smoothing α",tsSmoothingBeta:"Smoothing β",fitPredicted:"Predicted",fitResidual:"Residual",fitInfluence:"Influence",fitStdResidual:"Std. residual",fitLeverage:"Leverage",fitCooksD:"Cook's D",cluster:"Cluster",clusterDistance:"Cluster distance"});function t(f,m){if(!m)return null;const u=Number.isFinite(Number(m.lower))?Number(m.lower):null,b=Number.isFinite(Number(m.upper))?Number(m.upper):null;if(u===null&&b===null||!Number.isFinite(f))return null;if(u!==null&&f<u||b!==null&&f>b)return l.FAIL;const a=Number.isFinite(Number(m.warnLower))?Number(m.warnLower):null,h=Number.isFinite(Number(m.warnUpper))?Number(m.warnUpper):null;return a!==null&&f<a||h!==null&&f>h?l.WARN:l.PASS}function o(f,m,u){if(!m||typeof m!="object")return null;if(m.kind!=="time")return m.kind!==void 0&&E(`shadow.history.window.kind:${f}`,`a 'history' shadow's 'window' only accepts {kind: 'time', span}; '${m.kind}' is not honoured (a plain count is already what 'depth' means, and a session has no span to divide into buckets), so it reported the original, unwindowed history.`),null;const b=m.minutes!=null?Number(m.minutes)*6e4:Number(m.span);if(!(b>0))return E(`shadow.history.window.span:${f}`,"a 'history' shadow's time window needs a positive 'span' (ms) or 'minutes'; it had none, so it reported the original, unwindowed history."),null;const a=Math.max(2,Math.floor(u)||U);return{span:b,bucketMs:Math.max(1,Math.floor(b/a))}}class c{#e;#t=new Map;#n=new Map;#r=new Map;#s=new Map;#i=new Map;#o=new Map;#l=0;#a;#c;#u;#d;#f=new Map;#h=null;#p=null;#m=null;constructor(m){this.#e=m.colId,this.#a=Math.max(2,m.depth||U),this.#c=Math.max(1,m.max||K),this.#u=m.now||(()=>Date.now()),this.#d=o(this.#e,m.historyWindow,this.#a),this.#d&&(this.#h=Math.floor(this.#u()/this.#d.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#d}observe(m,u){const b=i(u);if(b===null)return;if(!this.#n.has(m)){this.#p=null,this.#m=null,this.#g(),this.#t.set(m,b),this.#n.set(m,b),this.#r.set(m,0),this.#s.set(m,this.#u()),this.#i.set(m,[b]),this.#d&&this.#f.set(m,[b]),this.#o.set(m,0);return}const a=this.#n.get(m);if(a===b)return;this.#p=null,this.#m=null,this.#n.set(m,b),this.#r.set(m,(this.#r.get(m)||0)+1),this.#s.set(m,this.#u());const h=this.#i.get(m)||[];h.push(b),h.length>this.#a&&h.splice(0,h.length-this.#a),this.#i.set(m,h);const w=Math.sign(b-a),v=this.#o.get(m)||0;this.#o.set(m,Math.sign(v)===w?v+w:w)}#g(){if(this.#n.size<this.#c)return;const m=this.#n.keys().next().value;m!==void 0&&(this.#t.delete(m),this.#n.delete(m),this.#r.delete(m),this.#s.delete(m),this.#i.delete(m),this.#f.delete(m),this.#o.delete(m),this.#l++)}rebase(){for(const[m,u]of this.#n)this.#t.set(m,u);this.#p=null,this.#m=null}reset(){this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#s.clear(),this.#i.clear(),this.#f.clear(),this.#o.clear(),this.#l=0,this.#p=null,this.#m=null,this.#d&&(this.#h=Math.floor(this.#u()/this.#d.bucketMs))}retain(m){const u=m instanceof Set?m:new Set(m);let b=0;for(const a of[...this.#n.keys()])u.has(a)||(this.#t.delete(a),this.#n.delete(a),this.#r.delete(a),this.#s.delete(a),this.#i.delete(a),this.#f.delete(a),this.#o.delete(a),b++);return b&&(this.#p=null,this.#m=null),b}advanceHistoryWindow(m=this.#u()){const u=this.#d;if(!u)return 0;const b=Math.floor(m/u.bucketMs),a=b-this.#h;if(!(a>0))return 0;const h=Math.min(a,this.#a);for(const[w,v]of this.#f){const A=this.#n.get(w);for(let H=0;H<h;H++)v.push(A);v.length>this.#a&&v.splice(0,v.length-this.#a)}return this.#h=b,a}read(m,u,b,a){switch(m){case"updates":return this.#r.has(u)?this.#r.get(u):0;case"updatedAt":{const h=this.#s.get(u);return h===void 0?null:new Date(h)}case"sinceUpdate":{const h=this.#s.get(u);return h===void 0?null:this.#u()-h}case"firstValue":return this.#t.has(u)?this.#t.get(u):null;case"delta":return this.#n.has(u)?this.#n.get(u)-this.#t.get(u):null;case"deltaPercent":{if(!this.#n.has(u))return null;const h=this.#t.get(u);return h?(this.#n.get(u)-h)/Math.abs(h)*100:null}case"rate":{const h=this.#i.get(u),w=this.#s.get(u);if(!h||h.length<2||w===void 0)return null;const v=this.#u()-w,A=h[h.length-1]-h[h.length-2];return v>0?A/v*1e3:A}case"history":return this.#d?this.#f.has(u)?[...this.#f.get(u)]:null:this.#i.has(u)?[...this.#i.get(u)]:null;case"streak":return this.#o.has(u)?this.#o.get(u):0;case"specStatus":return this.#n.has(u)?t(this.#n.get(u),a):null;default:return g.includes(m)?this.#S(m,u,b,a):null}}#b(m){if(m){if(this.#m&&this.#m.only===m)return this.#m.view;const u=this.#y(m);return this.#m={only:m,view:u},u}return this.#p?this.#p:(this.#p=this.#y(null),this.#p)}#y(m){const u=[];for(const[M,S]of this.#n)m&&!m.has(M)||u.push(S);const b=u.sort((M,S)=>M-S);let a=0,h=0,w=0,v=0;for(const M of b){v+=M,a++;const S=M-h;h+=S/a,w+=S*(M-h)}const A=[];for(const[M,S]of this.#t)m&&!m.has(M)||A.push(S);const H=a?d(b):0,G=b.map(M=>Math.abs(M-H)).sort((M,S)=>M-S),Z=a?d(G):0;return{sorted:b,baseline:A.sort((M,S)=>M-S),sum:v,mean:a?h:0,sd:a>1?Math.sqrt(w/(a-1)):0,median:H,mad:Z}}#S(m,u,b,a){if(!this.#n.has(u)||b&&!b.has(u))return null;const h=this.#n.get(u),w=this.#b(b),v=w.sorted.length;if(!v)return null;switch(m){case"rank":return v-p(w.sorted,h)+1;case"rankAsc":return n(w.sorted,h)+1;case"rankChange":{if(!this.#t.has(u)||!w.baseline.length)return null;const A=w.baseline.length-p(w.baseline,this.#t.get(u))+1,H=v-p(w.sorted,h)+1;return A-H}case"percentile":return p(w.sorted,h)/v*100;case"quartile":{const A=p(w.sorted,h)/v;return Math.min(4,Math.max(1,Math.ceil(A*4)))}case"zScore":return w.sd?(h-w.mean)/w.sd:null;case"anomalyScore":return w.mad?k*(h-w.median)/w.mad:null;case"anomalyFlag":{if(!w.mad)return null;const A=a&&Number.isFinite(Number(a.threshold))?Number(a.threshold):y;return Math.abs(k*(h-w.median)/w.mad)>A}case"shareOfTotal":return w.sum?h/w.sum*100:null;default:return null}}}function d(f){const m=f.length;if(!m)return 0;const u=(m-1)*.5,b=Math.floor(u),a=Math.ceil(u);return b===a?f[b]:f[b]+(u-b)*(f[a]-f[b])}function n(f,m){let u=0,b=f.length;for(;u<b;){const a=u+b>>1;f[a]<m?u=a+1:b=a}return u}function p(f,m){let u=0,b=f.length;for(;u<b;){const a=u+b>>1;f[a]<=m?u=a+1:b=a}return u}function i(f){if(f==null||f==="")return null;if(f instanceof Date){const u=f.getTime();return Number.isFinite(u)?u:null}const m=typeof f=="number"?f:Number(f);return Number.isFinite(m)?m:null}function r(f){const m=[];for(const u of f||[]){const b=u.shadow;if(!b)continue;const a=typeof b=="string"?{kind:b}:b,h=a.kind;L.includes(h)&&(X.includes(h)||I.includes(h)||j.includes(h)||m.push({colId:u.id||u.field,of:a.of||u.field||u.id,kind:h,depth:a.depth,historyWindow:h==="history"?a.window:void 0}))}return m}}),ze("packages/core/src/columns/model.js",function(e,_){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return Me}});const ne=_("packages/core/src/internal/merge.js"),E=ne.expand,K=ne.merge,U=ne.toArray,D=_("packages/core/src/internal/warn.js"),J=D.fail,z=D.warnOnce,L=_("packages/core/src/internal/paths.js"),X=L.getPath,I=L.pathGetter,j=L.pathSetter,y=_("packages/core/src/internal/text.js").humanise,l=_("packages/core/src/internal/predicates.js"),g=l.isFunction,s=l.isObject,o=_("packages/core/src/internal/uid.js").uid,d=_("packages/core/src/format/index.js").compileFormat,n=_("packages/core/src/columns/datatypes.js"),p=n.comparatorFor,i=n.createTypeRegistry,r=n.storageKind,f=_("packages/core/src/columns/infer.js"),m=f.inferColumnType,u=f.DEFAULT_SAMPLE,b=_("packages/core/src/columns/graph.js"),a=b.buildGraph,h=b.affectedBy,v=_("packages/core/src/columns/lookup.js").createLookup,A=_("packages/core/src/columns/value.js"),H=A.compileDisplay,G=A.ValuePipeline,Z=A.warnImpureUse,M=_("packages/core/src/model/shadow.js"),S=M.FIT_SHADOW_KINDS,T=M.CLUSTER_SHADOW_KINDS,O=Object.freeze({geometry:"geometry",list:"list"}),N={value:{pure:!0},cell:{},edit:{enabled:!1},sort:{enabled:!0,direction:null,order:0,nullsFirst:!1},filter:{enabled:!0,type:"text"},group:{enabled:!1,index:-1,explode:!1},pivot:{enabled:!1,index:-1},total:null,layout:{width:150,min:40,max:null,flex:0,pin:null,hidden:!1,resizable:!0,movable:!0,lockVisible:!1,lockPosition:!1},header:{},facet:{},export:{lookup:"label",csv:!0,excel:!0},allowGroup:!0,allowPivot:!0,allowTotal:!0,nullable:!0,quickFilter:!0},P={centre:"center"},C=new Set(["start","center","end","left","right"]);function B(pe){if(typeof pe!="string")return;const ae=pe.toLowerCase();return P[ae]?P[ae]:C.has(ae)?ae:void 0}function x(pe){if(typeof pe!="string")return;const ae=pe.toLowerCase();return ae==="center"||ae==="centre"?"middle":ae==="top"||ae==="middle"||ae==="bottom"?ae:void 0}const V=["cell","layout","header"];function Y(pe){if(!s(pe))return{};const ae={...pe},ge=(ve,le)=>{if(pe[ve]===void 0)return;const we=E(pe[ve],le);we&&V.includes(ve)&&!s(pe[ve])&&delete we.enabled,ae[ve]=we};return ge("sort","direction"),ge("filter","type"),ge("cell","render"),ge("edit","editor"),ge("layout","width"),ge("group","index"),ge("pivot","index"),ge("header","render"),ge("facet","strategy"),ae}function F(pe,ae){const ge={...pe||{}},ve=s(ae)&&s(ae.layout)&&ae.layout.width!==void 0;return ge.fit==="content"&&!ve&&delete ge.width,ge}const $=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"]),q=new Set(["collapsible","columns","facet","header","id","marryChildren","openByDefault","showWhen","title"]);function ee(pe,ae,ge,ve){const le=ge==="columnGroup"?"column group":"column";for(const we of Object.keys(pe))if(!ae.has(we)){if(we==="timeZone"&&ge==="column"){z("column.timeZone",`\`timeZone\` is not a column option, so it had no effect on column "${ve}". 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}z(`${ge}.unknown:${we}`,`'${we}' is not a configuration key this grid recognises, so it had no effect on ${le} "${ve}". Check the spelling against the reference.`)}}function te(pe){s(pe.cell)&&pe.cell.autoHeight!==void 0&&z("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${pe.id||pe.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function re(pe,ae){const ge=ae&&g(pe.defaultsFor)?pe.defaultsFor(ae):null,ve={...pe.defaults||{},...s(ge)?ge:{}},le={};return ve.align&&(le.align=ve.align,le.cell={align:ve.align},le.header={align:ve.align}),ve.filter&&(le.filter=ve.filter==="none"?{enabled:!1,type:"none"}:{enabled:!0,type:ve.filter}),ve.editor&&(le.edit=ve.editor==="none"?{editor:null}:{editor:ve.editor}),ve.total&&(le.total=ve.total),ve.render&&(le.cell={...le.cell||{},render:ve.render}),pe.export&&(le.export={...pe.export}),le}function ie(pe){if(typeof pe=="string")return pe.trim()?[pe.trim()]:[];if(!Array.isArray(pe))return[];const ae=[];for(const ge of pe){if(typeof ge!="string")continue;const ve=ge.trim();ve&&!ae.includes(ve)&&ae.push(ve)}return ae}class ue{#e=new Map;#t=[];#n=[];#r=new WeakMap;#s;#i;#o;#l;#a;#c;#u(ae,ge,ve){const le=this.#d(ae,ge,ve);if(typeof le!="string"||!this.#f)return le??null;const we=ge&&ge.totals&&ge.totals.implement;if(we&&g(we[le])){const be=we[le];return be.totalName=le,be}const he=this.#f.totalFn?.(le);return g(he)?he:le}#d(ae,ge,ve){if(typeof ae!="string")return ae;const le=ge&&ge.totals&&ge.totals.supported;if(!Array.isArray(le)||le.includes(ae))return ae;const we=le.length?le.join(", "):"none";return J(`column "${ve}" is typed ${ge.name||"a type"}, for which the total "${ae}" is not meaningful. Supported: ${we}. Aggregating it anyway would produce a confident wrong number.`),ae}#f;#h;#p;#m;#g;#b;#y=!1;#S;#w;constructor(ae={}){this.#i=Y(ae.columnDefaults||{}),this.#o=ae.columnPresets||{},this.#a=ae.locale,this.#l=ae.timeZone,this.#c=x(ae.verticalAlign),this.#f=ae.registry||null,this.#h=ae.grid||null,this.#p=ae.context,this.#S=ae.sampleSize??u,this.#w=ae.onChange||null,this.#b=g(ae.rowKey)?ae.rowKey:void 0,this.#s=i(ae.dataTypes,this.#f);const{leaves:ge,groups:ve}=Me(ae.columns||[]);this.#n=ve;for(const le of ge){le.facet!==void 0&&this.#r.set(le.def,le.facet);const we=this.#A(le.def,null);if(we.groupPath=le.path,this.#e.has(we.id)){z(`columns.duplicate:${we.id}`,`two columns resolve to the id '${we.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}le.column=we,this.#e.set(we.id,we),this.#t.push(we.id)}this.#C(ae.stored||null)}#A(ae,ge){ee(ae,$,"column",ae.id||ae.field||"(unnamed)"),te(ae);const ve=Y(ae),le=U(ae.preset),we=le.map(We=>{const qe=this.#o[We];return qe?Y(qe):(z(`preset:${We}`,`unknown column preset "${We}"; ignoring`),{})}),he=this.#O(ve,we,ge),be=this.#s.get(he)||this.#s.get("text");if(!this.#s.has(he)&&ae.type){const We=O[he];z(`type:${he}`,`unknown data type "${he}"; falling back to "text"`+(We?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${We}'.`:""))}const Te=g(be.items)?this.#P(ve,we,ae.id||ae.field||"(unnamed)"):null;let je=N;je=K(je,this.#i),ae.type!==!1&&(je=K(je,re(be,Te)));for(const We of we)je=K(je,We);this.#r.has(ae)&&(je=K(je,Y({facet:this.#r.get(ae)}))),je=K(je,ve);const ke=je.edit;ke&&ke.editor&&ke.enabled!==!0&&!g(ke.enabled)&&(ae.edit||{}).editor&&z(`column.editor-not-enabled:${ae.id||ae.field}`,`column '${ae.id||ae.field}' names the editor '${ke.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const Ue=ae.id||ae.field||o("col");if(ae.shadow&&!g(je.value&&je.value.compute)){const We=typeof ae.shadow=="string"?{kind:ae.shadow}:ae.shadow,qe=We.of||ae.field||Ue,et=S.includes(We.kind),dt=T.includes(We.kind),lt=et?We.model||We:null,vt=et&<?[...Array.isArray(lt.predictors)?lt.predictors:[],lt.response].filter(Boolean):null,Pt=dt?(Array.isArray(We.columns)?We.columns:[]).filter(Boolean):null;je.value={...je.value||{},deps:Pt&&Pt.length?Pt:vt&&vt.length?vt:We.orderBy&&We.orderBy!==qe?[qe,We.orderBy]:[qe],pure:!1,compute:($t,ht)=>{const ut=ht.grid&&ht.grid.statistics;if(!ut)return null;const wt=ht.row&&ht.row.key||ut.keyOf(ht.data);if(!wt)return null;if(et){if(!g(ut.fitShadow))return null;const Nt=We.model?{...We.model,threshold:We.threshold}:We;return ut.fitShadow(We.kind,wt,Nt)}return dt?g(ut.clusterShadow)?ut.clusterShadow(We.kind,wt,We):null:ut.shadow(qe,We.kind,wt,We.scope,We)}}}if(ae.running&&!g(je.value&&je.value.compute)){const We=typeof ae.running=="string"?{kind:ae.running}:ae.running,qe=We.of||ae.field||Ue;je.value={...je.value||{},deps:[qe],pure:!1,compute:(et,dt)=>{const lt=dt.grid&&dt.grid.statistics;if(!lt||!g(lt.running))return null;const vt=dt.row&&dt.row.key||lt.keyOf(dt.data);return vt?lt.running(qe,We.kind||"total",vt):null}},ae.sort===void 0&&(je.sort={...je.sort||{},enabled:!1})}const Re=ae.field??(g(je.value&&je.value.compute)?null:ae.id??null),Ee=g(je.value&&je.value.compute),He={id:Ue,field:Re,shadow:ae.shadow||null,running:ae.running||null,spec:ae.spec||null,validation:ae.validation||null,volatile:!!(ae.shadow||ae.running),title:je.title??y(Re||Ue),type:be.name,dataType:be,itemType:Te,nullable:je.nullable!==!1,align:B(ve.cell&&ve.cell.align||ve.align||je.cell&&je.cell.align||je.align||be.defaults&&be.defaults.align)||"start",verticalAlign:x(ve.cell&&ve.cell.verticalAlign||ve.verticalAlign||je.cell&&je.cell.verticalAlign||je.verticalAlign)||this.#c,rowSpan:g(je.rowSpan)?je.rowSpan:null,colSpan:g(je.colSpan)?je.colSpan:null,value:{pure:!0,...je.value||{}},cell:{...je.cell||{}},edit:{...je.edit||{}},sort:{...je.sort||{}},filter:{...je.filter||{}},group:{enabled:!1,index:-1,explode:!1,...je.group||{}},pivot:{enabled:!1,index:-1,...je.pivot||{}},total:this.#u(je.total,be,ae.id||ae.field||"(unnamed)"),groupTotal:je.groupTotal===void 0?null:this.#u(je.groupTotal,be,ae.id||ae.field||"(unnamed)"),grandTotal:je.grandTotal===void 0?null:this.#u(je.grandTotal,be,ae.id||ae.field||"(unnamed)"),tags:ie(je.tags),typeOptions:je.typeOptions??null,...s(je[he])?{[he]:je[he]}:{},layout:F(je.layout,ve),header:{...je.header||{}},contextMenu:je.contextMenu===void 0?null:je.contextMenu,facet:{...je.facet||{}},export:{...je.export||{}},allowGroup:je.allowGroup!==!1,allowPivot:je.allowPivot!==!1,allowTotal:je.allowTotal!==!1,quickFilter:je.quickFilter!==!1,def:ae,format:je.format,presets:le,inferred:ge!=null&&!ae.type,computed:Ee,diff:ae.diff===void 0?void 0:!!ae.diff,read:Re?I(Re):null,write:Re?j(Re):null};He.cell.align=B(ve.cell&&ve.cell.align)||He.align,He.header.align=B(ve.header&&ve.header.align)||He.align;const Ke=je.lookup||null;return He.lookup=Ke?v({id:Ue,lookup:Ke},{locale:this.#a,onChange:()=>{this.#w&&this.#w("lookup",{colId:Ue})}}):null,He.group.explode&&He.lookup&&He.lookup.multiple&&z(`explode:${Ue}`,`column "${Ue}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(He),He}#v(ae){ae.formatter=d(ae.format,ae.dataType,this.#a,this.#l,ae.id),ae.formatValue=H(ae,{locale:this.#a,grid:this.#h,context:this.#p}),ae.itemCompare=ae.itemType?p(ae.itemType,this.#a):null,ae.compare=g(ae.value.compare)?ae.value.compare:ae.lookup?ae.lookup.comparator():g(ae.dataType.compareFor)?ae.dataType.compareFor(ae):p(ae.dataType,this.#a),ae.excel=ae.formatter&&ae.formatter.ooxml||ae.dataType&&ae.dataType.excel||"General",ae.storeKind=r(ae.dataType,!!(ae.lookup&&ae.lookup.multiple))}#P(ae,ge,ve){let le=s(ae.typeOptions)?ae.typeOptions:null;for(let Te=ge.length-1;!le&&Te>=0;Te--)s(ge[Te].typeOptions)&&(le=ge[Te].typeOptions);!le&&s(this.#i.typeOptions)&&(le=this.#i.typeOptions);const we=le&&le.of!==void 0?le.of:"text",he=typeof we=="string"?this.#s.get(we):void 0;return he&&!g(he.items)&&he.storage!=="object"?he:(z(`type:of:${String(we)}`,`column "${ve}" names "${String(we)}" as its item type (typeOptions.of), which is not ${he?"a scalar data type":"a known data type"}; its items are read as text.`),this.#s.get("text"))}#O(ae,ge,ve){if(ae.type===!1)return"text";if(ae.type)return ae.type;for(let le=ge.length-1;le>=0;le--)if(ge[le].type)return ge[le].type;if(this.#i.type)return this.#i.type;if(ae.shadow){const le=typeof ae.shadow=="string"?ae.shadow:ae.shadow.kind;if(le==="fitInfluence")return"boolean";if(le==="fitPredicted"||le==="fitResidual"||le==="fitStdResidual"||le==="fitLeverage"||le==="fitCooksD"||le==="tsTrend"||le==="tsSeasonal"||le==="tsResidual"||le==="tsCoverage"||le==="tsSmoothed"||le==="tsSmoothingAlpha"||le==="tsSmoothingBeta"||le==="cluster"||le==="clusterDistance")return"number"}return ve||(ae.lookup?"lookup":"text")}#C(ae){const ge=this.all();this.#m=a(ge),this.#g?this.#g.setGraph(this.#m):this.#g=new G({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:ae||null,rowKey:this.#b});const ve=this.#g;for(const le of ge)le.getValue=(we,he)=>ve.value(le,we,he)}all(){return this.#t.map(ae=>this.#e.get(ae))}visible(){return this.all().filter(ae=>!ae.layout.hidden)}get(ae){return this.#e.get(ae)}groups(){const ae=ge=>{const ve=[];for(const le of ge)Array.isArray(le.columns)?ve.push({...le,columns:ae(le.columns)}):le.column&&ve.push(le.column);return ve};return ae(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#s}affectedBy(ae){return h(this.#m,ae)}value(ae,ge,ve){return this.#g.value(ae,ge,ve)}text(ae,ge,ve){return this.#g.text(ae,ge,ve)}checkImpure(ae,ge){Z(this.#e.get(ae),ge)}setLocale(ae){this.#a=ae;for(const ge of this.all())ge.lookup&&ge.lookup.setLocale(ae),this.#v(ge);this.#w&&this.#w("locale",{locale:ae})}infer(ae){const ge={};if(this.#y||!Array.isArray(ae)||ae.length===0)return ge;this.#y=!0;let ve=!1;for(const le of this.all()){const we=le.def;if(we.type!==void 0||!le.field||le.computed||le.lookup||this.#E(le))continue;const he=le.read||(je=>X(je,le.field)),be=m(le.id,ae,he,this.#s,{sampleSize:this.#S});if(be===le.type)continue;ge[le.id]=be;const Te=this.#A(we,be);Te.groupPath=le.groupPath,Te.layout={...Te.layout,...Ae(le.layout)},this.#e.set(le.id,Te),Fe(this.#n,le.id,Te),ve=!0}return ve&&this.#C(null),ge}redecorate(ae,ge,ve={}){const le=this.#e.get(ae);if(!le){z(`redecorate:${ae}`,`columns.decorate('${ae}', …): no column with id '${ae}'.`);return}const we=le.def||{},he={...s(we.cell)?we.cell:{}};he.decoration=ge??void 0,ve&&"variant"in ve&&(he.variant=ve.variant);const be={...we,cell:he};this.#r.has(we)&&this.#r.set(be,this.#r.get(we));const Te=this.#A(be,le.type);return Te.groupPath=le.groupPath,Te.layout={...Te.layout,...Ae(le.layout)},le.lookup&&le.lookup!==Te.lookup&&g(le.lookup.destroy)&&le.lookup.destroy(),this.#e.set(ae,Te),Fe(this.#n,ae,Te),this.#C(null),this.#w&&this.#w("decorate",{colId:ae}),Te}destroy(){for(const ae of this.#e.values())ae.lookup&&g(ae.lookup.destroy)&&ae.lookup.destroy()}#E(ae){for(const ge of ae.presets){const ve=this.#o[ge];if(ve&&ve.type)return!0}return!!this.#i.type}#T(ae){return!ae.computed&&g(ae.dataType&&ae.dataType.toStorage)}storeReader(ae){if(ae.computed)return ge=>this.#g.value(ae,ge,null);if(this.#T(ae)){const ge=ae.dataType.toStorage,ve={timeZone:this.#l,colId:ae.id,itemType:ae.itemType||null};return le=>ge(ae.read(le),ve)}return ae.read}storeValue(ae,ge){if(!(!ae||ae.computed)&&g(ae.read))return this.storeReader(ae)(ge)}storeSchema(){const ae=[];for(const ge of this.all()){if(ge.computed&&ge.value.pure===!1||!ge.computed&&!ge.field)continue;const ve=this.storeReader(ge);let le=null;!ge.computed&&!this.#T(ge)&&typeof ge.field=="string"&&!ge.lookup&&(le=ge.field);const we={id:ge.id,kind:ge.storeKind,nullable:ge.nullable,read:ve};le!==null&&(we.field=le),ge.lookup&&(we.dictionary=ge.lookup.dictionary()),ae.push(we)}return ae}state(){return this.all().map(ae=>({id:ae.id,width:ae.layout.width,flex:ae.layout.flex||void 0,hidden:!!ae.layout.hidden,headerWrap:ae.header?.wrap===!0?!0:void 0,headerOrientation:ae.header?.orientation==="vertical"?"vertical":void 0,pin:ae.layout.pin??null,sort:ae.sort.direction??null,sortIndex:ae.sort.direction?ae.sort.order??0:null,groupIndex:ae.group.enabled?ae.group.index??0:null,pivotIndex:ae.pivot.enabled?ae.pivot.index??0:null,total:typeof ae.total=="string"?ae.total:null,groupTotal:typeof ae.groupTotal=="string"?ae.groupTotal:void 0,grandTotal:typeof ae.grandTotal=="string"?ae.grandTotal:void 0,decoration:ae.cell&&ae.cell.decoration!=null?de(ae.cell.decoration):void 0,variant:ae.cell&&ae.cell.variant!=null?de(ae.cell.variant):void 0}))}applyState(ae,ge={}){const ve={applied:[],skipped:[]},le=Array.isArray(ae)?ae:ae&&ae.columns||[],we=!Array.isArray(ae)&&ae&&ae.columnOrder||null;for(const be of le){if(!be||!be.id){ve.skipped.push({key:"?",reason:"no id"});continue}let Te=this.#e.get(be.id);if(!Te){ve.skipped.push({key:be.id,reason:"unknown column"});continue}if(Object.hasOwn(be,"decoration")||Object.hasOwn(be,"variant")){const je=Te.cell?Te.cell.decoration:void 0,ke=be.decoration??null,Ue=Object.hasOwn(be,"variant"),Re=Ue&&!Oe(Te.cell?Te.cell.variant:void 0,be.variant);(!Oe(je,ke)||Re)&&(this.redecorate(be.id,ke,Ue?{variant:be.variant??void 0}:{}),Te=this.#e.get(be.id)||Te)}be.width!=null&&(Te.layout.width=be.width),be.flex!=null&&(Te.layout.flex=be.flex),be.hidden!=null&&(Te.layout.hidden=!!be.hidden),be.headerWrap!==void 0&&(Te.header.wrap=!!be.headerWrap),be.headerOrientation!==void 0&&(Te.header.orientation=be.headerOrientation==="vertical"?"vertical":"horizontal"),be.pin!==void 0&&(Te.layout.pin=be.pin),be.sort!==void 0&&(Te.sort.direction=be.sort),be.sortIndex!=null&&(Te.sort.order=be.sortIndex),be.groupIndex!=null&&(Te.group.enabled=!0,Te.group.index=be.groupIndex),be.pivotIndex!=null&&(Te.pivot.enabled=!0,Te.pivot.index=be.pivotIndex),be.total!==void 0&&(Te.total=be.total),be.groupTotal!==void 0&&(Te.groupTotal=be.groupTotal),be.grandTotal!==void 0&&(Te.grandTotal=be.grandTotal),ve.applied.push(be.id)}const he=we||(ge&&ge.keepOrder?[]:le.map(be=>be&&be.id).filter(Boolean));if(he.length){const be=he.filter(je=>this.#e.has(je)),Te=this.#t.filter(je=>!be.includes(je));this.#t=[...be,...Te]}return this.#w&&this.#w("state",ve),ve}move(ae,ge){this.#M(ae,ge)&&(this.#R(),this.#w&&this.#w("move",{id:ae,to:ge}))}reorder(ae){const ge={applied:[],skipped:[]},ve=[];let le=0;for(const we of Array.isArray(ae)?ae:[]){const he=le++;this.#M(we,he)&&(ge.applied.push(we),ve.push({id:we,to:he}))}if(!ve.length)return ge;if(this.#R(),this.#w)for(const we of ve)this.#w("move",we);return ge}#M(ae,ge){const ve=this.#t.indexOf(ae);if(ve===-1||Math.max(0,Math.min(Number(ge)||0,this.#t.length-1))===ve)return!1;const we=this.#e.get(ae);if(we.layout.movable===!1||we.layout.lockPosition)return z(`move:${ae}`,`column "${ae}" is not movable; the move was ignored`),!1;const he=this.#N(ae,ge);return he?(z(`move.married:${he}`,`band "${he}" declares marryChildren, so its columns stay together; the move was ignored`),!1):(this.#t.splice(ve,1),this.#t.splice(Math.max(0,Math.min(ge,this.#t.length)),0,ae),!0)}#N(ae,ge){if(!this.#n||!this.#n.length)return null;const ve=this.#t.filter(be=>be!==ae),le=Math.max(0,Math.min(ge,ve.length)),we=(be,Te)=>{if(Array.isArray(be.columns)){for(const ke of be.columns)we(ke,Te);return Te}const je=be.column?be.column.id:be.id;return je&&Te.push(je),Te},he=be=>{for(const Te of be){if(!Array.isArray(Te.columns))continue;if(Te.marryChildren===!0){const ke=we(Te,[]),Ue=ke.includes(ae),Re=ke.map(Ee=>ve.indexOf(Ee)).filter(Ee=>Ee>=0);if(Re.length){const Ee=Math.min(...Re),He=Math.max(...Re);if(Ue?le<Ee||le>He+1:le>Ee&&le<=He)return Te.id}}const je=he(Te.columns);if(je)return je}return null};return he(this.#n)}#R(){const ae=new Map(this.#t.map((le,we)=>[le,we])),ge=le=>{if(!Array.isArray(le.columns)){const he=le.column?le.column.id:le.id;return ae.has(he)?ae.get(he):1/0}let we=1/0;for(const he of le.columns)we=Math.min(we,ge(he));return we},ve=le=>{le.sort((we,he)=>ge(we)-ge(he));for(const we of le)Array.isArray(we.columns)&&ve(we.columns)};ve(this.#n)}#F(ae){const ge=ve=>{for(let le=0;le<ve.length;le++){const we=ve[le];if(Array.isArray(we.columns)){const he=ge(we.columns);if(he)return he}else if(we.column&&we.column.id===ae)return ve.splice(le,1)[0]}return null};return ge(this.#n)}#W(ae){const ge=[];for(let ve=ae.length-1;ve>=0;ve--){const le=ae[ve];Array.isArray(le.columns)&&(ge.push(...this.#W(le.columns)),le.columns.length===0&&(ge.push(le.id),ae.splice(ve,1)))}return ge}#V(){const ae=(ge,ve,le)=>{for(const we of ge)Array.isArray(we.columns)?ae(we.columns,[...ve,we.id]):we.column&&(we.column.groupPath=ve)};ae(this.#n,[])}#x(ae){const ge=new Set(ae),ve=this.#t.filter(be=>ge.has(be));if(!ve.length)return;const le=Math.min(...ve.map(be=>this.#t.indexOf(be))),we=this.#t.slice(0,le).filter(be=>!ge.has(be)),he=this.#t.slice(le).filter(be=>!ge.has(be));this.#t=[...we,...ve,...he]}#q(ae){const ge=[],ve=le=>{if(Array.isArray(le.columns))for(const we of le.columns)ve(we);else le.column&&ge.push(le.column.id)};return ve(ae),ge}#_(ae){const ge=ve=>{for(const le of ve){if(!Array.isArray(le.columns))continue;if(le.id===ae)return{node:le,parent:ve};const we=ge(le.columns);if(we)return we}return null};return ge(this.#n)}groupColumns(ae,ge={}){const ve=U(ae).filter(Te=>this.#e.has(Te));if(!ve.length)return z("columns.group.empty","groupColumns was given no known column ids; nothing was grouped."),null;for(const Te of ve)if(this.#e.get(Te).layout.lockPosition)return z(`columns.group.locked:${Te}`,`column "${Te}" is position-locked and cannot be grouped.`),null;const le=ge.groupId?this.#_(ge.groupId):null;if(ge.groupId&&!le)return z(`columns.group.unknown:${ge.groupId}`,`no band "${ge.groupId}" to add to; nothing was grouped.`),null;let we=null;if(!le&&ge.id!=null&&(we=String(ge.id),this.#_(we)||this.#e.has(we)))return z(`columns.group.idtaken:${we}`,`band id "${we}" is already in use; nothing was grouped.`),null;const he=ve.map(Te=>this.#F(Te)).filter(Boolean);if(!he.length)return null;let be;if(le)le.node.columns.push(...he),be=le.node.id;else{const Te={id:we||o("grp"),title:ge.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:he},je=Number.isInteger(ge.at)?Math.max(0,Math.min(ge.at,this.#n.length)):this.#n.length;this.#n.splice(je,0,Te),be=Te.id}return this.#W(this.#n),this.#x(ve),this.#V(),this.#R(),this.#w&&this.#w("columngroup",{action:"formed",groupId:be,ids:ve}),be}ungroupColumn(ae){const ge=this.#e.get(ae);if(!ge){z(`columns.ungroup.unknown:${ae}`,`no column "${ae}" to ungroup.`);return}const ve=ge.groupPath||[];if(!ve.length)return;const le=ve[ve.length-1],we=this.#_(le);if(!we)return;const he=this.#F(ae);if(!he)return;const be=we.parent.indexOf(we.node);we.parent.splice(be+1,0,he);const Te=this.#W(this.#n),je=this.#q(we.node);if(je.length){this.#x(je);const ke=Math.max(...je.map(Re=>this.#t.indexOf(Re))),Ue=this.#t.filter(Re=>Re!==ae);Ue.splice(ke+1,0,ae),this.#t=Ue}this.#V(),this.#R(),this.#w&&this.#w("columngroup",{action:"removed",id:ae,dissolved:Te})}renameGroup(ae,ge){const ve=this.#_(ae);if(!ve){z(`columns.group.rename:${ae}`,`no band "${ae}" to rename.`);return}ve.node.title=String(ge??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:ae,title:ve.node.title})}dissolveGroup(ae){const ge=this.#_(ae);if(!ge){z(`columns.group.dissolve:${ae}`,`no band "${ae}" to dissolve.`);return}const ve=ge.parent.indexOf(ge.node);ge.parent.splice(ve,1,...ge.node.columns),this.#V(),this.#R(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:ae})}moveGroup(ae,ge){const ve=this.#_(ae);if(!ve){z(`columns.group.move:${ae}`,`no band "${ae}" to move.`);return}const le=ve.parent,we=le.indexOf(ve.node);we!==-1&&(le.splice(we,1),le.splice(Math.max(0,Math.min(ge,le.length)),0,ve.node),this.#Y(),this.#V(),this.#w&&this.#w("columngroup",{action:"moved",groupId:ae,to:ge}))}#Y(){const ae=[],ge=le=>{for(const we of le)Array.isArray(we.columns)?ge(we.columns):we.column&&ae.push(we.column.id)};ge(this.#n);const ve=new Set(ae);this.#t=[...ae,...this.#t.filter(le=>!ve.has(le))]}groupTree(){const ae=ve=>ve.map(le=>Array.isArray(le.columns)?{id:le.id,title:le.title||"",collapsible:!!le.collapsible,openByDefault:le.openByDefault!==!1,columns:ae(le.columns)}:le.column?le.column.id:null).filter(le=>le!==null),ge=ae(this.#n);return ge.some(ve=>ve&&typeof ve=="object")?ge:[]}applyGroupTree(ae){if(!Array.isArray(ae))return;const ge=new Set,ve=we=>{const he=[];for(const be of we)if(be&&typeof be=="object"&&Array.isArray(be.columns)){const Te=ve(be.columns);if(!Te.length)continue;he.push({id:be.id||o("grp"),title:be.title||"",collapsible:be.collapsible===!0,openByDefault:be.openByDefault!==!1,showWhen:"always",marryChildren:!1,header:{},def:{},columns:Te})}else if(typeof be=="string"){const Te=this.#e.get(be);Te&&!ge.has(be)&&(ge.add(be),he.push({column:Te,path:[]}))}return he},le=ve(ae);for(const we of this.#t){if(ge.has(we))continue;const he=this.#e.get(we);he&&le.push({column:he,path:[]})}this.#n=le,this.#V(),this.#R(),this.#w&&this.#w("columngroup",{action:"applied"})}show(ae){this.#G(ae,!1)}hide(ae){this.#G(ae,!0)}#G(ae,ge){const ve=[];for(const le of U(ae)){const we=this.#e.get(le);if(we){if(ge&&we.layout.lockVisible){z(`lockVisible:${le}`,`column "${le}" is \`layout.lockVisible\` and cannot be hidden`);continue}we.layout.hidden!==ge&&(we.layout.hidden=ge,ve.push(le))}}ve.length&&this.#w&&this.#w("visible",{ids:ve,hidden:ge})}pin(ae,ge){const ve=this.#e.get(ae);ve&&(ve.layout.pin=ge??null,this.#w&&this.#w("pin",{id:ae,side:ve.layout.pin}))}pinMany(ae){const ge={};for(const[le,we]of ae){const he=this.#e.get(le);he&&(he.layout.pin=we??null,ge[le]=he.layout.pin)}const ve=Object.keys(ge);ve.length&&this.#w&&this.#w("pin",{ids:ve,pins:ge})}#I(ae,ge){const ve=ae.layout.min??0,le=ae.layout.max;let we=Math.max(ve,ge);return le!=null&&(we=Math.min(le,we)),ae.layout.width=we,ae.layout.flex=0,we}resize(ae,ge){const ve=this.#e.get(ae);if(!ve)return;if(ve.layout.resizable===!1){z(`resize:${ae}`,`column "${ae}" is not resizable; the resize was ignored`);return}const le=this.#I(ve,ge);this.#w&&this.#w("resize",{id:ae,width:le})}resizeMany(ae){const ge={};for(const[le,we]of ae){const he=this.#e.get(le);if(he){if(he.layout.resizable===!1){z(`resize:${le}`,`column "${le}" is not resizable; the resize was ignored`);continue}ge[le]=this.#I(he,we)}}const ve=Object.keys(ge);ve.length&&this.#w&&this.#w("resize",{ids:ve,widths:ge})}}function Ae(pe){const ae={};return pe.width!=null&&(ae.width=pe.width),pe.hidden!=null&&(ae.hidden=pe.hidden),pe.pin!==void 0&&(ae.pin=pe.pin),ae}function de(pe){if(pe===null||typeof pe!="object")return pe;try{return structuredClone(pe)}catch{}try{return JSON.parse(JSON.stringify(pe))}catch{return pe}}function Oe(pe,ae){const ge=pe??null,ve=ae??null;if(ge===ve)return!0;if(ge===null||ve===null)return!1;if(typeof ge!="object"||typeof ve!="object")return ge===ve;try{return JSON.stringify(ge)===JSON.stringify(ve)}catch{return!1}}function Me(pe){const ae=[],ge=(le,we,he)=>{const be=[];for(const Te of le){if(!s(Te)){J("a column definition must be an object");continue}if(Array.isArray(Te.columns)){ee(Te,q,"columnGroup",Te.title||Te.id||"(unnamed)");const je={id:Te.id||o("grp"),title:Te.title||"",collapsible:Te.collapsible===!0,openByDefault:Te.openByDefault!==!1,showWhen:Te.showWhen||"always",marryChildren:Te.marryChildren===!0,header:Te.header||{},def:Te,columns:[]};je.columns=ge(Te.columns,[...we,je.id],Te.facet!==void 0?Te.facet:he),be.push(je)}else{const je={def:Te,path:we,facet:he};ae.push(je),be.push(je)}}return be},ve=ge(pe,[],void 0);return{leaves:ae,groups:ve}}function Fe(pe,ae,ge){for(const ve of pe){if(ve.columns){if(Fe(ve.columns,ae,ge))return!0;continue}if(ve.column&&ve.column.id===ae)return ve.column=ge,!0}return!1}}),ze("packages/core/src/columns/autogroup.js",function(e,_){"use strict";Object.defineProperty(e,"AUTO_GROUP_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createAutoGroupColumn",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"warnOnAbsurdGrouping",{enumerable:!0,get:function(){return X}});const E=_("packages/core/src/internal/warn.js").warnOnce,K="__lattice_group",U=240,D=.5;function J(I){const j=I.def&&I.def.layout;return(typeof j=="number"||j&&j.width!=null||I.def&&I.def.width!=null)&&Number.isFinite(I.layout.width)?I.layout.width:null}function z(I){const j=I.def&&I.def.layout;return!!(j&&j.min!=null)||I.def&&I.def.minWidth!=null}function L(I){const{columns:j,groupBy:k}=I,y=k.map(c=>j.get(c)).filter(Boolean),l=y.length?y.map(c=>c.title||c.id).join(" > "):"Group",g=y.find(c=>J(c)!=null),s=I.config&&I.config.autoGroupColumnWidth||(g?J(g):U);let t=g&&z(g)?g.layout.min:120;g&&!z(g)&&(t=Math.min(t,s));const o=g&&g.layout.max!=null?g.layout.max:null;return{id:K,field:null,title:l,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group"},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!0},groupedIds:k.slice(),group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:s,min:t,max:o,pin:I.config&&I.config.autoGroupColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(c,d){return d&&d.group?d.groupValue:null},formatValue(c,d){if(!d||!d.group)return"";if(d.grandTotal)return I.config&&I.config.grandTotalLabel||"Total";const n=y[Math.min(d.level||0,y.length-1)];return n&&typeof n.formatValue=="function"?n.formatValue(c,d):c==null?"":String(c)}}}function X(I,j,k){!I.length||k<100||j<k*D||E(`grouping.cardinality:${I.join(",")}`,`grouping by ${I.join(", ")} produced ${j} 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.`)}}),ze("packages/core/src/columns/selectcolumn.js",function(e,_){"use strict";Object.defineProperty(e,"SELECT_COLUMN_ID",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"createSelectionColumn",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return U}});const ne="__lattice_select",E=44;function K(D){const J=D.selection||{},z=D.config&&D.config.selectionColumnWidth||E;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:z,min:z,max:z,pin:D.config&&D.config.selectionColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,headerCheckbox:J.headerCheckbox===!0,def:{},getValue(L,X){return X?X.selected:!1},formatValue(){return""}}}const U=K}),ze("packages/core/src/columns/rownumbercolumn.js",function(e,_){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createRowNumberColumn",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return X}});const E=_("packages/core/src/internal/predicates.js").isFunction,K="__lattice_rownumber",U=40,D=9,J=22;function z(I){const j=String(Math.max(1,Math.trunc(Math.abs(I))||1)).length;return Math.max(U,j*D+J)}function L(I){const j=I.rowNumbers,k=j&&typeof j=="object"?j:{},y=Number.isFinite(k.start)?k.start:1,l=Number.isFinite(k.width)?k.width:z((I.maxNumber||0)+y),g=E(I.rank)?I.rank:()=>null;return{id:K,field:null,title:typeof k.title=="string"?k.title:"",type:"number",dataType:{base:"number"},nullable:!0,align:"end",generated:!0,control:!0,value:{pure:!0},cell:{align:"end"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:l,min:l,max:l,pin:"start",hidden:!1,resizable:k.width==null,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(s,t){const o=g(t);return o==null?null:o-1+y},formatValue(s){return s==null?"":String(s)}}}const X=L}),ze("packages/core/src/model/detail.js",function(e,_){"use strict";Object.defineProperty(e,"DEFAULT_DETAIL_HEIGHT",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"DEFAULT_CACHE_LIMIT",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"DetailModel",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return X}});const E=_("packages/core/src/internal/predicates.js").isFunction,U=_("packages/core/src/internal/warn.js").warnOnce,D=240,J=10;function z(I){if(!I)return null;const j=I===!0?{}:I;return j.enabled===!1?null:!E(j.rows)&&!j.render?(U("detail.rows","detail is enabled but neither `rows` nor `render` was supplied; expanding a master would show an empty region, so it stays off."),null):{render:j.render||null,config:j.config||null,rows:E(j.rows)?j.rows:null,height:j.height??D,maxHeight:j.maxHeight??null,cacheLimit:Number.isFinite(j.cacheLimit)?Math.max(0,j.cacheLimit):J,isMaster:E(j.isMaster)?j.isMaster:null,target:j.target||null,onCreate:E(j.onCreate)?j.onCreate:null,path:typeof j.path=="string"?j.path:null}}class L{#e;#t=new Set;#n;#r=0;constructor(j){this.#e=j.config,this.#n=E(j.onChange)?j.onChange:()=>{}}get config(){return this.#e}get inline(){return!this.#e.target}isMaster(j){if(!j||j.group||j.detail)return!1;const k=this.#e.isMaster;return k?!!k(j.data,j):!0}isOpen(j){return this.#t.has(j)}keys(){return[...this.#t]}activeKey(){for(const j of this.#t)return j;return null}heightOf(j){const k=this.#e.height;return E(k)?Number(k(j))||D:k==="auto"?D:Number(k)||D}open(j){return this.#t.has(j)?!1:(this.inline||this.#t.clear(),this.#t.add(j),this.#s(),!0)}close(j){return this.#t.delete(j)?(this.#s(),!0):!1}toggle(j){return this.#t.has(j)?(this.close(j),!1):(this.open(j),!0)}closeAll(){this.#t.size&&(this.#t.clear(),this.#s())}prune(j){if(!this.#t.size||!E(j))return;let k=!1;for(const y of[...this.#t])j(y)||(this.#t.delete(y),k=!0);k&&this.#s()}signature(){return`${this.#r}`}set(j){this.#t.clear();const k=Array.isArray(j)?j:[];for(const y of this.inline?k:k.slice(0,1))this.#t.add(y);this.#s()}#s(){this.#r++,this.#n()}}const X=L}),ze("packages/core/src/compute/special.js",function(e,_){"use strict";Object.defineProperty(e,"logGamma",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"incompleteBeta",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"normalQuantile",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"normalCdf",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"studentT",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"chiSquareUpperTail",{enumerable:!0,get:function(){return s}});const ne=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),E=3e-12,K=1e-300;function U(t){if(t<.5)return Math.log(Math.PI/Math.sin(Math.PI*t))-U(1-t);const o=t-1;let c=.9999999999998099;const d=o+7.5;for(let n=0;n<ne.length;n++)c+=ne[n]/(o+n+1);return .5*Math.log(2*Math.PI)+(o+.5)*Math.log(d)-d+Math.log(c)}function D(t,o,c){const d=t+o,n=t+1,p=t-1;let i=1,r=1-d*c/n;Math.abs(r)<K&&(r=K),r=1/r;let f=r;for(let m=1;m<=300;m++){const u=2*m;let b=m*(o-m)*c/((p+u)*(t+u));r=1+b*r,Math.abs(r)<K&&(r=K),i=1+b/i,Math.abs(i)<K&&(i=K),r=1/r,f*=r*i,b=-(t+m)*(d+m)*c/((t+u)*(n+u)),r=1+b*r,Math.abs(r)<K&&(r=K),i=1+b/i,Math.abs(i)<K&&(i=K),r=1/r;const a=r*i;if(f*=a,Math.abs(a-1)<E)break}return f}function J(t,o,c){if(!(t>0)||!(o>0)||!Number.isFinite(c))return Number.NaN;if(c<=0)return 0;if(c>=1)return 1;const d=Math.exp(U(t+o)-U(t)-U(o)+t*Math.log(c)+o*Math.log(1-c));return c<(t+1)/(t+o+2)?d*D(t,o,c)/t:1-d*D(o,t,1-c)/o}function z(t){if(!(t>0)||!(t<1))return t===0?-1/0:t===1?1/0:Number.NaN;const o=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],c=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],d=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],n=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],p=.02425;let i,r,f;t<p?(i=Math.sqrt(-2*Math.log(t)),f=(((((d[0]*i+d[1])*i+d[2])*i+d[3])*i+d[4])*i+d[5])/((((n[0]*i+n[1])*i+n[2])*i+n[3])*i+1)):t<=1-p?(i=t-.5,r=i*i,f=(((((o[0]*r+o[1])*r+o[2])*r+o[3])*r+o[4])*r+o[5])*i/(((((c[0]*r+c[1])*r+c[2])*r+c[3])*r+c[4])*r+1)):(i=Math.sqrt(-2*Math.log(1-t)),f=-(((((d[0]*i+d[1])*i+d[2])*i+d[3])*i+d[4])*i+d[5])/((((n[0]*i+n[1])*i+n[2])*i+n[3])*i+1));const u=(.5*L(-f/Math.SQRT2)-t)*Math.sqrt(2*Math.PI)*Math.exp(f*f/2);return f-u/(1+f*u/2)}function L(t){const o=Math.abs(t),c=2/(2+o),d=4*c-2,n=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,15626441722e-18,-85238095915e-18,6529054439e-18,5059343495e-18,-991364156e-18,-227365122e-18,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18];let p=0,i=0,r;for(let m=n.length-1;m>0;m--)r=i,i=d*i-p+n[m],p=r;const f=c*Math.exp(-o*o+.5*(n[0]+d*i)-p);return t>=0?f:2-f}function X(t){return .5*L(-t/Math.SQRT2)}function I(t,o){if(!(o>0)||!Number.isFinite(t))return Number.NaN;const c=.5*J(o/2,.5,o/(o+t*t));return t>0?1-c:c}function j(t,o){if(!(t>0)||!(t<1)||!(o>0))return Number.NaN;if(o>1e7)return z(t);let c=-1e4,d=1e4,n=z(t);const p=U(o/2)+U(.5)-U((o+1)/2);for(let i=0;i<60;i++){const r=I(n,o);r<t?c=n:d=n;const f=Math.exp(-((o+1)/2)*Math.log(1+n*n/o)-p)/Math.sqrt(o),m=f>0?(r-t)/f:0;if(Math.abs(m)<1e-12)break;const u=n-m;if(n=u>c&&u<d&&Number.isFinite(u)?u:(c+d)/2,d-c<1e-12)break}return n}function k(t,o){let c=t,d=1/t,n=d;for(let p=0;p<300&&(c+=1,n*=o/c,d+=n,!(Math.abs(n)<Math.abs(d)*E));p++);return d*Math.exp(-o+t*Math.log(o)-U(t))}function y(t,o){let c=o+1-t,d=1/K,n=1/c,p=n;for(let i=1;i<=300;i++){const r=-i*(i-t);c+=2,n=r*n+c,Math.abs(n)<K&&(n=K),d=c+r/d,Math.abs(d)<K&&(d=K),n=1/n;const f=n*d;if(p*=f,Math.abs(f-1)<E)break}return Math.exp(-o+t*Math.log(o)-U(t))*p}function l(t,o){return!(t>0)||!(o>=0)||!Number.isFinite(o)?Number.NaN:o===0?0:o<t+1?k(t,o):1-y(t,o)}function g(t,o){return o>0?l(o/2,t/2):Number.NaN}function s(t,o){const c=g(t,o);return Number.isNaN(c)?Number.NaN:Math.min(1,Math.max(0,1-c))}}),ze("packages/core/src/compute/linalg.js",function(e,_){"use strict";Object.defineProperty(e,"cholesky",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"choleskySolve",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"choleskyInverse",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"normalEquations",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return J}});function ne(z){const L=z.length,X=Array.from({length:L},()=>new Array(L).fill(0));for(let I=0;I<L;I++)for(let j=0;j<=I;j++){let k=z[I][j];for(let y=0;y<j;y++)k-=X[I][y]*X[j][y];if(I===j){if(!(k>0))return null;X[I][j]=Math.sqrt(k)}else X[I][j]=k/X[j][j]}return X}function E(z,L){const X=z.length,I=new Array(X).fill(0);for(let k=0;k<X;k++){let y=L[k];for(let l=0;l<k;l++)y-=z[k][l]*I[l];I[k]=y/z[k][k]}const j=new Array(X).fill(0);for(let k=X-1;k>=0;k--){let y=I[k];for(let l=k+1;l<X;l++)y-=z[l][k]*j[l];j[k]=y/z[k][k]}return j}function K(z){const L=z.length,X=Array.from({length:L},()=>new Array(L).fill(0));for(let I=0;I<L;I++){const j=new Array(L).fill(0);j[I]=1;const k=E(z,j);for(let y=0;y<L;y++)X[y][I]=k[y]}return X}function U(z,L,X){const I=z.length,j=I?z[0].length:0,k=Array.from({length:j},()=>new Array(j).fill(0)),y=new Array(j).fill(0);for(let l=0;l<I;l++){const g=X?X[l]:1,s=z[l];for(let t=0;t<j;t++){const o=g*s[t];y[t]+=o*L[l];for(let c=t;c<j;c++)k[t][c]+=o*s[c]}}for(let l=0;l<j;l++)for(let g=0;g<l;g++)k[l][g]=k[g][l];return{xtwx:k,xtwy:y}}function D(z,L){return z.map(X=>X.reduce((I,j,k)=>I+j*L[k],0))}function J(z,L){let X=0;for(let I=0;I<z.length;I++){let j=0;for(let k=0;k<z.length;k++)j+=L[I][k]*z[k];X+=z[I]*j}return X}}),ze("packages/core/src/compute/sketch.js",function(e,_){"use strict";Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return k}});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(l){if(!Number.isFinite(l))return;this.#e++;const g=l-this.#t;this.#t+=g/this.#e,this.#n+=g*(l-this.#t)}merge(l){if(l.#e===0)return;if(this.#e===0){this.#e=l.#e,this.#t=l.#t,this.#n=l.#n;return}const g=this.#e+l.#e,s=l.#t-this.#t;this.#t+=s*(l.#e/g),this.#n+=l.#n+s*s*(this.#e*l.#e/g),this.#e=g}mean(){return this.#e?this.#t:null}variance(){return this.#e>1?this.#n/(this.#e-1):null}varianceP(){return this.#e?this.#n/this.#e:null}stddev(){const l=this.variance();return l===null?null:Math.sqrt(l)}stddevP(){const l=this.varianceP();return l===null?null:Math.sqrt(l)}}class E{#e=[];#t=0;#n;#r;constructor(l,g=Math.random){if(!(l>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(l),this.#r=g}static get errorBound(){return Object.freeze({kind:"probabilistic",metric:"none",value:0,statement:"uniform sample: each element included with probability capacity/n; sample statistics are unbiased estimators"})}get seen(){return this.#t}get size(){return this.#e.length}add(l){if(!Number.isFinite(l))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(l);return}const g=Math.floor(this.#r()*this.#t);g<this.#n&&(this.#e[g]=l)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let l=0;for(const g of this.#e)l+=g;return l/this.#e.length}quantile(l){const g=this.#e.length;if(!g)return null;const s=this.#e.slice().sort((d,n)=>d-n);if(g===1)return s[0];const t=(g-1)*Math.min(1,Math.max(0,l)),o=Math.floor(t),c=Math.ceil(t);return o===c?s[o]:s[o]+(t-o)*(s[c]-s[o])}}function K(y){return y^=y>>>16,y=Math.imul(y,2246822507),y^=y>>>13,y=Math.imul(y,3266489909),y^=y>>>15,y>>>0}function U(y){if(typeof y=="number"){const s=new DataView(new ArrayBuffer(8));return s.setFloat64(0,y===0?0:y),K(s.getUint32(0)^s.getUint32(4))}const l=typeof y=="string"?y:String(y);let g=2166136261;for(let s=0;s<l.length;s++)g^=l.charCodeAt(s),g=Math.imul(g,16777619);return K(g)}class D{#e;#t;#n;constructor(l=14){const g=Math.floor(l);if(g<4||g>16)throw new RangeError("HLL precision must be 4..16");this.#e=g,this.#t=1<<g,this.#n=new Uint8Array(this.#t)}static errorBoundFor(l=14){const g=1<<Math.floor(l),s=1.04/Math.sqrt(g);return Object.freeze({kind:"probabilistic",metric:"relative",value:s,statement:`distinct count within ~${(s*100).toFixed(2)}% relative standard error (m=${g} buckets)`})}errorBound(){return D.errorBoundFor(this.#e)}add(l){const g=U(l),s=g&this.#t-1,t=g>>>this.#e|1<<32-this.#e;let o=1,c=t;for(;(c&1)===0;)o++,c>>>=1;o>this.#n[s]&&(this.#n[s]=o)}count(){const l=this.#t,g=32-this.#e,s=new Float64Array(g+2);for(let c=0;c<l;c++)s[this.#n[c]]++;let t=l*L(1-s[g+1]/l);for(let c=g;c>=1;c--)t=.5*(t+s[c]);t+=l*z(s[0]/l);const o=J*l*l/t;return Math.round(o)}}const J=.5/Math.log(2);function z(y){if(y===1)return 1/0;let l=1,g=y,s;do y*=y,s=g,g+=y*l,l+=l;while(g!==s);return g}function L(y){if(y===0||y===1)return 0;let l=1,g=1-y,s;do y=Math.sqrt(y),s=g,l*=.5,g-=(1-y)**2*l;while(g!==s);return g/3}class X{#e=new Map;#t;#n=0;constructor(l){if(!(l>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(l)}errorBoundFor(l){const g=l/this.#t;return Object.freeze({kind:"deterministic",metric:"absolute",value:g,statement:`each count overestimates the truth by at most N/m = ${g.toFixed(2)} (N=${l}, m=${this.#t})`})}get seen(){return this.#n}add(l){this.#n++;const g=this.#e.get(l);if(g){g.count++;return}if(this.#e.size<this.#t){this.#e.set(l,{count:1,error:0});return}let s,t=1/0;for(const[o,c]of this.#e)c.count<t&&(t=c.count,s=o);this.#e.delete(s),this.#e.set(l,{count:t+1,error:t})}top(l=this.#t){return[...this.#e.entries()].map(([s,t])=>({item:s,count:t.count,error:t.error})).sort((s,t)=>t.count-s.count).slice(0,Math.max(0,Math.floor(l)))}}class I{#e;#t=[[]];#n=0;#r;#s;constructor(l=200,g=Math.random){this.#e=Math.max(8,Math.floor(l)),this.#r=g,this.#s=2/3}static errorBoundFor(l=200){const g=1/Math.max(8,Math.floor(l));return Object.freeze({kind:"probabilistic",metric:"rank",value:g,statement:`queried quantile's true rank within ~${(g*100).toFixed(2)}% of N of the requested rank (k=${l})`})}errorBound(){return I.errorBoundFor(this.#e)}get count(){return this.#n}#i(l){const s=this.#t.length-1-l,t=Math.ceil(this.#e*this.#s**s);return Math.max(2,t)}add(l){Number.isFinite(l)&&(this.#n++,this.#t[0].push(l),this.#t[0].length>=this.#i(0)&&this.#o(0))}#o(l){const g=this.#t[l];g.sort((o,c)=>o-c),l+1>=this.#t.length&&this.#t.push([]);const s=this.#t[l+1],t=this.#r()<.5?0:1;for(let o=t;o<g.length;o+=2)s.push(g[o]);this.#t[l]=[];for(let o=0;o<this.#t.length;o++)if(this.#t[o].length>=this.#i(o)){this.#o(o);return}}#l(){const l=[];for(let g=0;g<this.#t.length;g++){const s=1<<g;for(const t of this.#t[g])l.push({v:t,w:s})}return l}quantile(l){const g=this.#l();if(!g.length)return null;g.sort((c,d)=>c.v-d.v);let s=0;for(const c of g)s+=c.w;const t=Math.min(1,Math.max(0,l))*s;let o=0;for(const c of g)if(o+=c.w,o>=t)return c.v;return g[g.length-1].v}rank(l){let g=0;for(let s=0;s<this.#t.length;s++){const t=1<<s;for(const o of this.#t[s])o<=l&&(g+=t)}return g}}const j=Object.freeze({distinct:D.errorBoundFor(14),median:I.errorBoundFor(200),p25:I.errorBoundFor(200),p75:I.errorBoundFor(200),p90:I.errorBoundFor(200),p95:I.errorBoundFor(200),p99:I.errorBoundFor(200),iqr:I.errorBoundFor(200),topK:Object.freeze({kind:"deterministic",metric:"absolute",value:0,statement:"each count overestimates the truth by at most N/m; top-K exact when the K-th item exceeds N/m"})}),k={Welford:ne,Reservoir:E,HyperLogLog:D,SpaceSaving:X,KLL:I,hash32:U,SKETCH_BOUNDS:j}}),ze("packages/core/src/compute/statistics.js",function(e,_){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"numbers",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"frequencies",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"herfindahl",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"entropy",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"evenness",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"topShare",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"gini",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"moments",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"quantileSorted",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"quantile",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"STAT_FNS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"modifiedZOutliers",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"jarqueBera",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"weightedQuantile",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"covariance",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(e,"autocorrelations",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"spearman",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"kendall",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"seriesStats",{enumerable:!0,get:function(){return le}}),Object.defineProperty(e,"D2_N2",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"D4_N2",{enumerable:!0,get:function(){return he}}),Object.defineProperty(e,"movingRanges",{enumerable:!0,get:function(){return be}}),Object.defineProperty(e,"withinSigma",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return He}}),Object.defineProperty(e,"countOutside",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(e,"histogram",{enumerable:!0,get:function(){return We}}),Object.defineProperty(e,"DEFAULT_CONFIDENCE",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(e,"meanInterval",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(e,"proportionInterval",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(e,"slopeInterval",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(e,"capabilityInterval",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(e,"standardizedMeanDifference",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(e,"normalTotalVariation",{enumerable:!0,get:function(){return ht}}),Object.defineProperty(e,"frequencyMap",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(e,"categoricalDistance",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(e,"SUBSET_RELIABILITY_FLOOR",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(e,"compareColumn",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(e,"isNumericColumn",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(e,"populationRead",{enumerable:!0,get:function(){return $e}});const ne=_("packages/core/src/compute/handle.js"),E=ne.presenceReader,K=ne.valueReader,U=_("packages/core/src/compute/special.js"),D=U.studentTQuantile,J=U.studentT,z=U.normalQuantile,L=U.normalCdf,X=U.chiSquareUpperTail,I=_("packages/core/src/compute/linalg.js"),j=I.cholesky,k=I.choleskySolve,y=I.choleskyInverse,l=I.normalEquations,g=I.quadForm,t=_("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,o=5e3,c=Object.freeze({variance:"rescan",varianceP:"rescan",stddev:"rescan",stddevP:"rescan",sumSquares:"rescan",weightedAvg:"rescan",median:"rescan",p25:"rescan",p75:"rescan",p90:"rescan",p95:"rescan",p99:"rescan",iqr:"rescan",mode:"rescan",distinct:"rescan",range:"rescan",skewness:"rescan",kurtosis:"rescan",geomean:"rescan",harmean:"rescan",mad:"rescan",argmin:"rescan",argmax:"rescan",hhi:"rescan",entropy:"rescan",evenness:"rescan",top3Share:"rescan",top10Share:"rescan",gini:"rescan",trimmedMean:"rescan",winsorizedMean:"rescan",robustOutliers:"rescan",jarqueBera:"rescan",passRate:"rescan",failureCount:"rescan"}),d=Object.freeze({distinct:Object.freeze({sketch:"HyperLogLog",bound:t.distinct}),median:Object.freeze({sketch:"KLL",bound:t.median}),p25:Object.freeze({sketch:"KLL",bound:t.p25}),p75:Object.freeze({sketch:"KLL",bound:t.p75}),p90:Object.freeze({sketch:"KLL",bound:t.p90}),p95:Object.freeze({sketch:"KLL",bound:t.p95}),p99:Object.freeze({sketch:"KLL",bound:t.p99}),iqr:Object.freeze({sketch:"KLL",bound:t.iqr}),top3Share:Object.freeze({sketch:"SpaceSaving",bound:t.topK}),top10Share:Object.freeze({sketch:"SpaceSaving",bound:t.topK})});function n(ye){const xe=ye==="sum"||ye==="avg"||ye==="countValues"||ye==="min"||ye==="max"?"maintained":Object.prototype.hasOwnProperty.call(c,ye)?c[ye]:null,Se=Object.prototype.hasOwnProperty.call(d,ye)?d[ye]:null;return{stat:ye,exact:xe,approximate:Se}}function p(ye,xe){const Se=xe.length,Le=new Float64Array(Se);let se=0;if(ye&&(ye.kind==="float64"||ye.kind==="int32")){const Ne=ye.values,De=E(ye);for(let Be=0;Be<Se;Be++){const Ye=xe[Be];if(De&&De(Ye)!==1)continue;const Qe=Ne[Ye];Number.isNaN(Qe)||(Le[se++]=Qe)}return Le.subarray(0,se)}const Pe=K(ye);for(let Ne=0;Ne<Se;Ne++){const De=Pe(xe[Ne]);if(De==null||De==="")continue;const Be=typeof De=="number"?De:Number(De);Number.isFinite(Be)&&(Le[se++]=Be)}return Le.subarray(0,se)}function i(ye,xe){const Se=new Map,Le=K(ye);let se=0;for(let Pe=0;Pe<xe.length;Pe++){const Ne=Le(xe[Pe]);if(Ne==null||Ne===""||typeof Ne=="number"&&Number.isNaN(Ne))continue;const De=typeof Ne=="object"?String(Ne):Ne;Se.set(De,(Se.get(De)||0)+1),se++}const ce=[...Se.values()].sort((Pe,Ne)=>Ne-Pe);return{counts:ce,total:se,distinct:ce.length}}function r(ye){return ye.total>0?ye.counts.map(xe=>xe/ye.total):[]}function f(ye,xe){const Se=i(ye,xe);if(!Se.total)return null;let Le=0;for(const se of r(Se))Le+=se*se;return Le}function m(ye,xe){const Se=i(ye,xe);if(!Se.total)return null;let Le=0;for(const se of r(Se))se>0&&(Le-=se*Math.log2(se));return Le}function u(ye,xe){const Se=i(ye,xe);if(!Se.total||Se.distinct<2)return Se.total?1:null;let Le=0;for(const se of r(Se))se>0&&(Le-=se*Math.log2(se));return Le/Math.log2(Se.distinct)}function b(ye,xe,Se=3){const Le=i(ye,xe);if(!Le.total)return null;const se=Math.max(1,Math.floor(Se));let ce=0;for(let Pe=0;Pe<Math.min(se,Le.counts.length);Pe++)ce+=Le.counts[Pe];return ce/Le.total}function a(ye,xe){const Se=p(ye,xe),Le=Se.length;if(!Le)return null;const se=Se.slice().sort();if(se[0]<0)return null;let ce=0,Pe=0;for(let Ne=0;Ne<Le;Ne++)ce+=se[Ne],Pe+=(Ne+1)*se[Ne];return ce===0?0:2*Pe/(Le*ce)-(Le+1)/Le}function h(ye){let xe=0,Se=0,Le=0;for(let se=0;se<ye.length;se++){const ce=ye[se];xe++;const Pe=ce-Se;Se+=Pe/xe,Le+=Pe*(ce-Se)}return{n:xe,mean:Se,m2:Le}}function w(ye,xe){const Se=ye.length;if(!Se)return NaN;if(Se===1)return ye[0];const Le=(Se-1)*Math.min(1,Math.max(0,xe)),se=Math.floor(Le),ce=Math.ceil(Le);return se===ce?ye[se]:ye[se]+(Le-se)*(ye[ce]-ye[se])}function v(ye,xe){if(!ye.length)return NaN;const Se=ye.slice().sort();return w(Se,xe)}function A(ye,xe){const Se=K(ye);let Le=0,se=0,ce=0;for(let Pe=0;Pe<xe.length;Pe++){const Ne=Se(xe[Pe]);if(Ne==null||Ne==="")continue;const De=String(Ne).toUpperCase();De==="PASS"?Le++:De==="FAIL"?se++:De==="WARN"&&ce++}return{pass:Le+ce,fail:se,warn:ce,judged:Le+ce+se}}const H=Object.freeze({hhi:(ye,xe)=>f(ye,xe),entropy:(ye,xe)=>m(ye,xe),evenness:(ye,xe)=>u(ye,xe),top3Share:(ye,xe)=>b(ye,xe,3),top10Share:(ye,xe)=>b(ye,xe,10),gini:(ye,xe)=>a(ye,xe),trimmedMean:(ye,xe)=>T(p(ye,xe),.1),winsorizedMean:(ye,xe)=>O(p(ye,xe),.1),robustOutliers:(ye,xe)=>N(p(ye,xe),3.5),jarqueBera:(ye,xe)=>P(p(ye,xe)),variance:(ye,xe)=>{const{n:Se,m2:Le}=h(p(ye,xe));return Se>1?Le/(Se-1):null},varianceP:(ye,xe)=>{const{n:Se,m2:Le}=h(p(ye,xe));return Se>0?Le/Se:null},stddev:(ye,xe)=>{const{n:Se,m2:Le}=h(p(ye,xe));return Se>1?Math.sqrt(Le/(Se-1)):null},stddevP:(ye,xe)=>{const{n:Se,m2:Le}=h(p(ye,xe));return Se>0?Math.sqrt(Le/Se):null},median:(ye,xe)=>{const Se=p(ye,xe);return Se.length?v(Se,.5):null},p25:(ye,xe)=>{const Se=p(ye,xe);return Se.length?v(Se,.25):null},p75:(ye,xe)=>{const Se=p(ye,xe);return Se.length?v(Se,.75):null},p90:(ye,xe)=>{const Se=p(ye,xe);return Se.length?v(Se,.9):null},p95:(ye,xe)=>{const Se=p(ye,xe);return Se.length?v(Se,.95):null},p99:(ye,xe)=>{const Se=p(ye,xe);return Se.length?v(Se,.99):null},iqr:(ye,xe)=>{const Se=p(ye,xe);if(!Se.length)return null;const Le=Se.slice().sort();return w(Le,.75)-w(Le,.25)},mad:(ye,xe)=>{const Se=p(ye,xe);if(!Se.length)return null;const Le=v(Se,.5),se=new Float64Array(Se.length);for(let ce=0;ce<Se.length;ce++)se[ce]=Math.abs(Se[ce]-Le);return v(se,.5)},range:(ye,xe)=>{const Se=p(ye,xe);if(!Se.length)return null;let Le=1/0,se=-1/0;for(let ce=0;ce<Se.length;ce++)Se[ce]<Le&&(Le=Se[ce]),Se[ce]>se&&(se=Se[ce]);return se-Le},distinct:(ye,xe)=>{const Se=K(ye),Le=new Set;for(let se=0;se<xe.length;se++){const ce=Se(xe[se]);ce==null||ce===""||Le.add(ce instanceof Date?ce.getTime():ce)}return Le.size},mode:(ye,xe)=>{const Se=K(ye),Le=new Map;for(let Pe=0;Pe<xe.length;Pe++){const Ne=Se(xe[Pe]);if(Ne==null||Ne==="")continue;const De=Ne instanceof Date?Ne.getTime():Ne;Le.set(De,(Le.get(De)||0)+1)}let se=null,ce=1;for(const[Pe,Ne]of Le)Ne>ce&&(ce=Ne,se=Pe);return se},skewness:(ye,xe)=>{const Se=p(ye,xe),{n:Le,mean:se,m2:ce}=h(Se);if(Le<3||ce<=0)return null;const Pe=Math.sqrt(ce/(Le-1));let Ne=0;for(let De=0;De<Se.length;De++)Ne+=((Se[De]-se)/Pe)**3;return Le/((Le-1)*(Le-2))*Ne},kurtosis:(ye,xe)=>{const Se=p(ye,xe),{n:Le,mean:se,m2:ce}=h(Se);if(Le<4||ce<=0)return null;const Pe=Math.sqrt(ce/(Le-1));let Ne=0;for(let Ye=0;Ye<Se.length;Ye++)Ne+=((Se[Ye]-se)/Pe)**4;const De=Le*(Le+1)/((Le-1)*(Le-2)*(Le-3)),Be=3*(Le-1)**2/((Le-2)*(Le-3));return De*Ne-Be},geomean:(ye,xe)=>{const Se=p(ye,xe);if(!Se.length)return null;let Le=0;for(let se=0;se<Se.length;se++){if(Se[se]<=0)return null;Le+=Math.log(Se[se])}return Math.exp(Le/Se.length)},harmean:(ye,xe)=>{const Se=p(ye,xe);if(!Se.length)return null;let Le=0;for(let se=0;se<Se.length;se++){if(Se[se]===0)return null;Le+=1/Se[se]}return Se.length/Le},sumSquares:(ye,xe)=>{const Se=p(ye,xe);let Le=0;for(let se=0;se<Se.length;se++)Le+=Se[se]*Se[se];return Le},passRate:(ye,xe)=>{const{pass:Se,judged:Le}=A(ye,xe);return Le?Se/Le:null},failureCount:(ye,xe)=>A(ye,xe).fail}),G=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 Z(ye,xe,Se){const Le=K(ye),se=K(xe);let ce=0,Pe=0;for(let Ne=0;Ne<Se.length;Ne++){const De=Se[Ne],Be=Number(Le(De)),Ye=Number(se(De));!Number.isFinite(Be)||!Number.isFinite(Ye)||(ce+=Be*Ye,Pe+=Ye)}return Pe===0?null:ce/Pe}function M(ye,xe,Se){const Le=K(ye);let se=null,ce=Se?-1/0:1/0;for(let Pe=0;Pe<xe.length;Pe++){const Ne=xe[Pe],De=Number(Le(Ne));Number.isFinite(De)&&(Se?De>ce:De<ce)&&(ce=De,se=Ne)}return se}function S(ye,xe,Se){const Le=K(ye),se=K(xe);let ce=0,Pe=0,Ne=0,De=0,Be=0,Ye=0;for(let Ge=0;Ge<Se.length;Ge++){const nt=Se[Ge],at=Number(Le(nt)),rt=Number(se(nt));!Number.isFinite(at)||!Number.isFinite(rt)||(ce++,Pe+=at,Ne+=rt,De+=at*at,Be+=rt*rt,Ye+=at*rt)}if(ce<2)return null;const Qe=ce*Ye-Pe*Ne,ct=Math.sqrt((ce*De-Pe*Pe)*(ce*Be-Ne*Ne));if(ct===0)return null;const pt=Qe/ct;return Math.max(-1,Math.min(1,pt))}function T(ye,xe=.1){const Se=ye.length;if(!Se)return null;const Le=Array.from(ye).sort((Ne,De)=>Ne-De),se=Math.floor(Se*Math.min(.49,Math.max(0,xe))),ce=Le.slice(se,Se-se);if(!ce.length)return w(Le,.5);let Pe=0;for(const Ne of ce)Pe+=Ne;return Pe/ce.length}function O(ye,xe=.1){const Se=ye.length;if(!Se)return null;const Le=Array.from(ye).sort((De,Be)=>De-Be),se=Math.floor(Se*Math.min(.49,Math.max(0,xe))),ce=Le[se],Pe=Le[Se-1-se];let Ne=0;for(const De of Le)Ne+=Math.min(Pe,Math.max(ce,De));return Ne/Se}function N(ye,xe=3.5){if(!ye.length)return null;const Le=Array.from(ye).sort((De,Be)=>De-Be),se=w(Le,.5),ce=Le.map(De=>Math.abs(De-se)).sort((De,Be)=>De-Be),Pe=w(ce,.5);if(Pe===0)return null;let Ne=0;for(const De of Le)Math.abs(.6745*(De-se)/Pe)>xe&&Ne++;return Ne}function P(ye){const xe=ye.length;if(xe<8)return null;let Se=0;for(const De of ye)Se+=De;Se/=xe;let Le=0,se=0,ce=0;for(const De of ye){const Be=De-Se;Le+=Be*Be,se+=Be*Be*Be,ce+=Be*Be*Be*Be}if(Le/=xe,se/=xe,ce/=xe,Le===0)return null;const Pe=se/Le**1.5,Ne=ce/(Le*Le)-3;return xe/6*(Pe*Pe+Ne*Ne/4)}function C(ye,xe,Se){const Le=[];let se=0;for(let De=0;De<ye.length;De++){const Be=Number(ye[De]),Ye=Number(xe[De]);!Number.isFinite(Be)||!Number.isFinite(Ye)||Ye<=0||(Le.push([Be,Ye]),se+=Ye)}if(!Le.length||se<=0)return null;if(Le.sort((De,Be)=>De[0]-Be[0]),Le.length===1)return Le[0][0];const ce=[];let Pe=0;for(const[,De]of Le)ce.push((Pe+De/2)/se),Pe+=De;const Ne=Math.max(0,Math.min(1,Se));if(Ne<=ce[0])return Le[0][0];if(Ne>=ce[ce.length-1])return Le[Le.length-1][0];for(let De=1;De<ce.length;De++){if(Ne>ce[De])continue;const Be=ce[De]-ce[De-1],Ye=Be>0?(Ne-ce[De-1])/Be:0;return Le[De-1][0]+(Le[De][0]-Le[De-1][0])*Ye}return Le[Le.length-1][0]}function B(ye,xe,Se){const Le=K(ye),se=K(xe),ce=new Float64Array(Se.length),Pe=new Float64Array(Se.length);let Ne=0;for(let De=0;De<Se.length;De++){const Be=Se[De],Ye=Number(Le(Be)),Qe=Number(se(Be));!Number.isFinite(Ye)||!Number.isFinite(Qe)||(ce[Ne]=Ye,Pe[Ne]=Qe,Ne++)}return{xs:ce.subarray(0,Ne),ys:Pe.subarray(0,Ne),n:Ne}}function x(ye,xe,Se,Le=!1){const{xs:se,ys:ce,n:Pe}=B(ye,xe,Se);if(Pe<2)return null;let Ne=0,De=0;for(let Ye=0;Ye<Pe;Ye++)Ne+=se[Ye],De+=ce[Ye];Ne/=Pe,De/=Pe;let Be=0;for(let Ye=0;Ye<Pe;Ye++)Be+=(se[Ye]-Ne)*(ce[Ye]-De);return Be/(Le?Pe:Pe-1)}function V(ye,xe,Se){const{xs:Le,ys:se,n:ce}=B(ye,xe,Se);if(ce<2)return null;let Pe=0,Ne=0;for(let at=0;at<ce;at++)Pe+=Le[at],Ne+=se[at];Pe/=ce,Ne/=ce;let De=0,Be=0,Ye=0;for(let at=0;at<ce;at++){const rt=Le[at]-Pe,ft=se[at]-Ne;De+=rt*rt,Be+=rt*ft,Ye+=ft*ft}if(De===0)return null;const Qe=Be/De,ct=Ne-Qe*Pe,pt=Ye===0?1:Math.max(0,Math.min(1,Be*Be/(De*Ye))),Ge=Math.max(0,Ye-Qe*Be),nt=ce>2?Math.sqrt(Ge/(ce-2)/De):0;return{slope:Qe,intercept:ct,r2:pt,stdError:nt,n:ce}}const Y=new Set(["ols","wls","robust"]),F=new Set(["quantile"]),$=new Set(["ridge","lasso","elasticnet","mixed","gls"]),q=1.345;function ee(ye,xe,Se){const{xtwx:Le,xtwy:se}=l(ye,xe,Se),ce=j(Le);if(!ce)return null;const Pe=k(ce,se),Ne=y(ce),De=te(ye,Pe),Be=xe.map((Ye,Qe)=>Ye-De[Qe]);return{beta:Pe,cov:Ne,fitted:De,residuals:Be}}function te(ye,xe){return ye.map(Se=>Se.reduce((Le,se,ce)=>Le+se*xe[ce],0))}function re(ye,xe){const Se=ye.length,Le=ye.map(Be=>Be[xe]),se=ye.map(Be=>[1,...Be.filter((Ye,Qe)=>Qe!==xe)]),ce=ee(se,Le,null);if(!ce)return 1;const Pe=Le.reduce((Be,Ye)=>Be+Ye,0)/Se;let Ne=0,De=0;for(let Be=0;Be<Se;Be++)Ne+=ce.residuals[Be]**2,De+=(Le[Be]-Pe)**2;return De===0?1:Math.max(0,Math.min(1,1-Ne/De))}function ie(ye){const xe=[...ye].sort((se,ce)=>se-ce),Se=ue(xe),Le=ye.map(se=>Math.abs(se-Se)).sort((se,ce)=>se-ce);return ue(Le)/.6745}function ue(ye){const xe=ye.length;if(!xe)return 0;const Se=Math.floor(xe/2);return xe%2?ye[Se]:(ye[Se-1]+ye[Se])/2}function Ae(ye,xe,Se={}){const Le=Se.method||"ols";if($.has(Le))throw new Error(`[lattice] regression method "${Le}" is out of scope; use ols, wls or robust.`);if(F.has(Le))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!Y.has(Le))throw new Error(`[lattice] unknown regression method "${Le}"; use ols, wls or robust.`);const se=Array.isArray(xe)?xe.length:0,ce=se&&Array.isArray(ye[0])?ye[0].length:0,Pe=ce+1;if(!(se>Pe))return null;for(let Ft=0;Ft<se;Ft++){if(!Number.isFinite(xe[Ft])||!Array.isArray(ye[Ft])||ye[Ft].length!==ce)return null;for(let Vt=0;Vt<ce;Vt++)if(!Number.isFinite(ye[Ft][Vt]))return null}let Ne=null;if(Le==="wls"){if(Ne=Se.weights,!Array.isArray(Ne)||Ne.length!==se)return null;for(let Ft=0;Ft<se;Ft++)if(!(Ne[Ft]>0)||!Number.isFinite(Ne[Ft]))return null}const De=ye.map(Ft=>[1,...Ft]);let Be,Ye=null;if(Le==="robust"){if(Be=ee(De,xe,null),!Be)return null;for(let Ft=0;Ft<50;Ft++){const Vt=ie(Be.residuals);if(!(Vt>0))break;const qt=Be.residuals.map(Kt=>{const nn=Math.abs(Kt/Vt);return nn<=q?1:q/nn}),Qt=ee(De,xe,qt);if(!Qt)return null;const rn=Qt.beta.reduce((Kt,nn,an)=>Math.max(Kt,Math.abs(nn-Be.beta[an])),0);if(Be=Qt,Ye=qt,rn<1e-10)break}}else if(Be=ee(De,xe,Ne),!Be)return null;const Qe=Le==="robust"?Ye:Ne,{beta:ct,cov:pt,fitted:Ge,residuals:nt}=Be;let at=0,rt=0,ft=0;for(let Ft=0;Ft<se;Ft++){const Vt=Qe?Qe[Ft]:1;at+=Vt*nt[Ft]**2,rt+=Vt,ft+=Vt*xe[Ft]}const jt=ft/rt;let Tt=0;for(let Ft=0;Ft<se;Ft++){const Vt=Qe?Qe[Ft]:1;Tt+=Vt*(xe[Ft]-jt)**2}const Mt=se-Pe,Rt=at/Mt,It=Tt===0?1:Math.max(0,Math.min(1,1-at/Tt)),zt=1-(1-It)*(se-1)/Mt,Je=Array.isArray(Se.names)&&Se.names.length===ce?Se.names:ye[0].map((Ft,Vt)=>`x${Vt+1}`),mt=et(Se.confidence),bt=Mt>0?D(1-(1-mt)/2,Mt):1/0,At=ct.map((Ft,Vt)=>{const qt=Math.sqrt(Math.max(0,Rt*pt[Vt][Vt])),Qt=qt>0?Ft/qt:Ft===0?0:1/0,rn=Number.isFinite(Qt)?2*(1-J(Math.abs(Qt),Mt)):0,Kt=Number.isFinite(bt)?bt*qt:null;return{name:Vt===0?"(intercept)":Je[Vt-1],estimate:Ft,stdError:qt,t:Qt,p:Math.max(0,Math.min(1,rn)),lower:Kt===null?null:Ft-Kt,upper:Kt===null?null:Ft+Kt}}),Dt=new Array(se),Lt=new Array(se);for(let Ft=0;Ft<se;Ft++){const Vt=Qe?Qe[Ft]:1,qt=Math.max(0,Math.min(1,Vt*g(De[Ft],pt)));Dt[Ft]=qt;const Qt=(1-qt)**2;Lt[Ft]=Qt>0&&Rt>0?nt[Ft]**2/(Pe*Rt)*(qt/Qt):null}const Ot=ye[0].map((Ft,Vt)=>{if(ce<2)return 1;const qt=re(ye,Vt);return qt>=1?1/0:1/(1-qt)});let _t=null;{const Ft=nt.map(qt=>qt*qt),Vt=ee(De,Ft,null);if(Vt){const qt=Ft.reduce((sn,bn)=>sn+bn,0)/se;let Qt=0,rn=0;for(let sn=0;sn<se;sn++)Qt+=Vt.residuals[sn]**2,rn+=(Ft[sn]-qt)**2;const Kt=rn===0?0:Math.max(0,Math.min(1,1-Qt/rn)),nn=se*Kt,an=X(nn,ce);_t={statistic:nn,df:ce,p:an,heteroscedastic:an<.05}}}let Gt=null;if(ce===1){const Ft=ye.map((Vt,qt)=>qt).sort((Vt,qt)=>ye[Vt][0]-ye[qt][0]);Gt={confidence:mt,points:Ft.map(Vt=>{const qt=De[Vt],Qt=Math.sqrt(Math.max(0,Rt*g(qt,pt)));return{x:ye[Vt][0],yhat:Ge[Vt],lower:Ge[Vt]-bt*Qt,upper:Ge[Vt]+bt*Qt}})}}return{method:Le,coefficients:At,r2:It,adjR2:zt,n:se,df:Mt,sigma2:Rt,fitted:Ge,residuals:nt,leverage:Dt,cooksD:Lt,vif:Ot,heteroscedasticity:_t,band:Gt,weights:Qe?[...Qe]:null}}function de(ye){const xe=ye.length,Se=Array.from({length:xe},(ce,Pe)=>Pe).sort((ce,Pe)=>ye[ce]-ye[Pe]),Le=new Float64Array(xe);let se=0;for(;se<xe;){let ce=se;for(;ce+1<xe&&ye[Se[ce+1]]===ye[Se[se]];)ce++;const Pe=(se+ce)/2+1;for(let Ne=se;Ne<=ce;Ne++)Le[Se[Ne]]=Pe;se=ce+1}return Le}const Oe=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function Me(ye){const xe=[.01,.05,.1],Se=[Oe["1%"],Oe["5%"],Oe["10%"]];if(ye<=Se[0]){const ce=(Math.log(xe[1])-Math.log(xe[0]))/(Se[1]-Se[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(xe[0])+ce*(ye-Se[0]))))}if(ye>=Se[2]){const ce=(Math.log(xe[2])-Math.log(xe[1]))/(Se[2]-Se[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(xe[2])+ce*(ye-Se[2]))))}const Le=ye<Se[1]?0:1,se=(ye-Se[Le])/(Se[Le+1]-Se[Le]);return Math.exp(Math.log(xe[Le])+se*(Math.log(xe[Le+1])-Math.log(xe[Le])))}function Fe(ye,xe,Se,Le){const se=Se-Le,ce=Le+3,Pe=new Array(se),Ne=new Array(se);let De=!0,Be=Le;for(let Ge=0;Ge<se;Ge++){const nt=Le+Ge,at=new Float64Array(ce);at[0]=1,at[1]=Ge+1,at[2]=ye[nt];for(let rt=1;rt<=Le;rt++)at[2+rt]=xe[nt-rt];for(let rt=1;rt<ce;rt++)Number.isFinite(at[rt])||(Be=Math.min(Be,rt-3));Pe[Ge]=at,Ne[Ge]=xe[nt],Number.isFinite(Ne[Ge])||(De=!1)}if(!De)return 0;const{xtwx:Ye,xtwy:Qe}=l(Pe,Ne,null);let ct=0,pt=1/0;for(let Ge=0;Ge<=Be;Ge++){const nt=Ge+3;if(!(se>nt))continue;const at=new Array(nt);for(let It=0;It<nt;It++)at[It]=Ye[It].slice(0,nt);const rt=j(at);if(!rt)continue;const ft=k(rt,Qe.slice(0,nt));let jt=0;for(let It=0;It<se;It++){const zt=Pe[It];let Je=0;for(let mt=0;mt<nt;mt++)Je+=zt[mt]*ft[mt];jt+=(Ne[It]-Je)**2}const Mt=jt/(se-nt)*(se-nt);if(!(Mt>0))continue;const Rt=se*Math.log(Mt/se)+2*nt;Rt<pt&&(pt=Rt,ct=Ge)}return ct}function pe(ye,xe={}){const Se=[];for(let pt=0;pt<ye.length;pt++){const Ge=Number(ye[pt]);Number.isFinite(Ge)&&Se.push(Ge)}const Le=Se.length,se=Le-1;if(Le<8||se<6)return null;const ce=new Array(se);for(let pt=0;pt<se;pt++)ce[pt]=Se[pt+1]-Se[pt];let Pe=Number.isFinite(xe.maxlag)?Math.floor(xe.maxlag):Math.ceil(12*(Le/100)**.25);Pe=Math.max(0,Math.min(Pe,Math.floor((se-5)/2)));const Ne=(pt,Ge)=>{const nt=[],at=[];for(let rt=Ge;rt<se;rt++){const ft=[rt-Ge+1,Se[rt]];for(let jt=1;jt<=pt;jt++)ft.push(ce[rt-jt]);nt.push(ft),at.push(ce[rt])}return Ae(nt,at,{method:"ols"})},De=Fe(Se,ce,se,Pe),Be=Ne(De,De);if(!Be||!Be.coefficients[2])return null;const Ye=Be.coefficients[2].t,Qe=Me(Ye),ct=Ye<Oe["5%"];return{statistic:Ye,usedLag:De,nobs:se-De,criticalValues:{...Oe},pValue:Qe,pApproximate:!0,stationary:ct,verdict:ct?"stationary":"non-stationary",regression:"ct"}}function ae(ye,xe={}){const Se=[];for(let ct=0;ct<ye.length;ct++){const pt=Number(ye[ct]);Number.isFinite(pt)&&Se.push(pt)}const Le=Se.length;if(Le<3)return null;let se=Number.isFinite(xe.maxlag)?Math.floor(xe.maxlag):Math.min(10,Le-1);se=Math.max(1,Math.min(se,Le-1));let ce=0;for(const ct of Se)ce+=ct;ce/=Le;const Pe=Se.map(ct=>ct-ce);let Ne=0;for(const ct of Pe)Ne+=ct*ct;Ne/=Le;const De=new Array(se+1).fill(0);De[0]=1;for(let ct=1;ct<=se;ct++){let pt=0;for(let Ge=ct;Ge<Le;Ge++)pt+=Pe[Ge]*Pe[Ge-ct];De[ct]=Ne>0?pt/Le/Ne:0}const Be=new Array(se+1).fill(0);Be[0]=1;let Ye=[];for(let ct=1;ct<=se;ct++){let pt=De[ct];for(let rt=1;rt<ct;rt++)pt-=Ye[rt-1]*De[ct-rt];let Ge=1;for(let rt=1;rt<ct;rt++)Ge-=Ye[rt-1]*De[rt];const nt=Ge!==0?pt/Ge:0,at=new Array(ct);for(let rt=1;rt<ct;rt++)at[rt-1]=Ye[rt-1]-nt*Ye[ct-1-rt];at[ct-1]=nt,Be[ct]=nt,Ye=at}const Qe=1.96/Math.sqrt(Le);return{acf:De,pacf:Be,bounds:{upper:Qe,lower:-Qe},n:Le,nlags:se,approximate:!0}}function ge(ye,xe,Se){const{xs:Le,ys:se,n:ce}=B(ye,xe,Se);if(ce<2)return null;const Pe=de(Le),Ne=de(se);let De=0,Be=0;for(let pt=0;pt<ce;pt++)De+=Pe[pt],Be+=Ne[pt];De/=ce,Be/=ce;let Ye=0,Qe=0,ct=0;for(let pt=0;pt<ce;pt++){const Ge=Pe[pt]-De,nt=Ne[pt]-Be;Ye+=Ge*nt,Qe+=Ge*Ge,ct+=nt*nt}return Qe===0||ct===0?null:Math.max(-1,Math.min(1,Ye/Math.sqrt(Qe*ct)))}function ve(ye,xe,Se){const{xs:Le,ys:se,n:ce}=B(ye,xe,Se);if(ce<2||ce>o)return null;let Pe=0,Ne=0,De=0,Be=0;for(let ct=0;ct<ce;ct++)for(let pt=ct+1;pt<ce;pt++){const Ge=Math.sign(Le[ct]-Le[pt]),nt=Math.sign(se[ct]-se[pt]),at=Ge*nt;at>0?Pe++:at<0?Ne++:Ge===0&&nt===0||(Ge===0?De++:Be++)}const Ye=Pe+Ne+Be,Qe=Pe+Ne+De;return Ye===0||Qe===0?null:(Pe-Ne)/Math.sqrt(Ye*Qe)}function le(ye,xe={}){const Se=ye.length;if(Se<2)return null;const Le=ye[0],se=ye[Se-1],ce=[];for(let rt=1;rt<Se;rt++){const ft=ye[rt-1];ft!==0&&ce.push((ye[rt]-ft)/Math.abs(ft))}let Pe=null;if(ce.length>1){let rt=0;for(const jt of ce)rt+=jt;rt/=ce.length;let ft=0;for(const jt of ce)ft+=(jt-rt)**2;Pe=Math.sqrt(ft/(ce.length-1))}const Ne=Number(xe.periodsPerYear)>0?Number(xe.periodsPerYear):null;let De=ye[0],Be=0,Ye=0,Qe=0,ct=0;for(let rt=1;rt<Se;rt++){if(ye[rt]>De){De=ye[rt],Be=rt;continue}if(De<=0)continue;const ft=(De-ye[rt])/De;ft>Ye&&(Ye=ft,Qe=Be,ct=rt)}let pt=null;if(Se>2){let rt=0;for(let Tt=0;Tt<Se;Tt++)rt+=ye[Tt];rt/=Se;let ft=0,jt=0;for(let Tt=0;Tt<Se;Tt++){const Mt=ye[Tt]-rt;jt+=Mt*Mt,Tt>0&&(ft+=Mt*(ye[Tt-1]-rt))}pt=jt>0?ft/jt:null}let Ge=0,nt=0;for(const rt of ce)rt>0?Ge++:rt<0&&nt++;let at=null;if(Le>0&&se>0){const rt=(se/Le)**(1/(Se-1))-1;at=Ne?(1+rt)**Ne-1:rt}return{n:Se,first:Le,last:se,change:se-Le,changePercent:Le===0?null:(se-Le)/Math.abs(Le)*100,volatility:Pe,annualisedVolatility:Pe!==null&&Ne?Pe*Math.sqrt(Ne):null,growth:at,maxDrawdown:Ye,maxDrawdownFrom:Qe,maxDrawdownTo:ct,autocorrelation:pt,upDays:Ge,downDays:nt}}const we=1.128,he=3.267;function be(ye){const xe=ye.length;if(xe<2)return null;const Se=[];for(let se=1;se<xe;se++)Se.push(Math.abs(ye[se]-ye[se-1]));const Le=Se.reduce((se,ce)=>se+ce,0)/Se.length;return{ranges:Se,centre:Le,upper:he*Le,lower:0}}function Te(ye){const xe=ye.length;if(xe<2)return null;let Se=0;for(let se=1;se<xe;se++)Se+=Math.abs(ye[se]-ye[se-1]);const Le=Se/(xe-1);return{sigma:Le/we,meanRange:Le}}function je(ye,xe){const Se=ye.length;if(Se<2||!xe)return null;const Le=Number.isFinite(Number(xe.lower))?Number(xe.lower):null,se=Number.isFinite(Number(xe.upper))?Number(xe.upper):null;if(Le===null&&se===null)return null;let ce=0;for(let Ge=0;Ge<Se;Ge++)ce+=ye[Ge];ce/=Se;let Pe=0;for(let Ge=0;Ge<Se;Ge++)Pe+=(ye[Ge]-ce)**2;const Ne=Math.sqrt(Pe/(Se-1)),De=Te(ye),Be=De?De.sigma:null,Ye=Ge=>{if(!Ge||Ge<=0)return{index:null,k:null};const at=Le!==null&&se!==null?(se-Le)/(6*Ge):null,rt=se!==null?(se-ce)/(3*Ge):1/0,ft=Le!==null?(ce-Le)/(3*Ge):1/0;return{index:at,k:Math.min(rt,ft)}},Qe=Ye(Be),ct=Ye(Ne);let pt=0;for(let Ge=0;Ge<Se;Ge++){if(Le!==null&&ye[Ge]<Le){pt++;continue}se!==null&&ye[Ge]>se&&pt++}return{n:Se,mean:ce,lower:Le,upper:se,target:Number.isFinite(Number(xe.target))?Number(xe.target):null,sigmaWithin:Be,sigmaOverall:Ne,cp:Qe.index,cpk:Qe.k,pp:ct.index,ppk:ct.k,outOfSpec:pt,defectRate:Se?pt/Se:null}}function ke(ye){const xe=ye.length;if(xe<2)return null;const Se=Te(ye);if(!Se||!(Se.sigma>0))return null;let Le=0;for(let se=0;se<xe;se++)Le+=ye[se];return Le/=xe,{centre:Le,sigma:Se.sigma,upper:Le+3*Se.sigma,lower:Le-3*Se.sigma}}function Ue(ye,xe){if(!xe||!(xe.sigma>0))return[];const Se=ye.length,{centre:Le,sigma:se}=xe,ce=Ne=>(ye[Ne]-Le)/se,Pe=[];for(let Ne=0;Ne<Se;Ne++){if(Math.abs(ce(Ne))>3&&Pe.push({index:Ne,rule:1,description:"beyond three sigma"}),Ne>=2)for(const De of[1,-1]){let Be=0;for(let Ye=Ne-2;Ye<=Ne;Ye++)ce(Ye)*De>2&&Be++;if(Be>=2){Pe.push({index:Ne,rule:2,description:"two of three past two sigma"});break}}if(Ne>=4)for(const De of[1,-1]){let Be=0;for(let Ye=Ne-4;Ye<=Ne;Ye++)ce(Ye)*De>1&&Be++;if(Be>=4){Pe.push({index:Ne,rule:3,description:"four of five past one sigma"});break}}if(Ne>=7)for(const De of[1,-1]){let Be=!0;for(let Ye=Ne-7;Ye<=Ne;Ye++)if(ce(Ye)*De<=0){Be=!1;break}if(Be){Pe.push({index:Ne,rule:4,description:"eight in a row on one side"});break}}}return Pe}function Re(ye,xe){if(!xe||!(xe.sigma>0))return[];const Se=ye.length,{centre:Le,sigma:se}=xe,ce=De=>(ye[De]-Le)/se,Pe=(De,Be,Ye,Qe)=>{for(const ct of[1,-1]){let pt=0;for(let Ge=De;Ge<=Be;Ge++)ce(Ge)*ct>Ye&&pt++;if(pt>=Qe)return!0}return!1},Ne=[];for(let De=0;De<Se;De++){if(Math.abs(ce(De))>3&&Ne.push({index:De,rule:1,description:"beyond three sigma"}),De>=8)for(const Be of[1,-1]){let Ye=!0;for(let Qe=De-8;Qe<=De;Qe++)if(ce(Qe)*Be<=0){Ye=!1;break}if(Ye){Ne.push({index:De,rule:2,description:"nine in a row on one side"});break}}if(De>=5)for(const Be of[1,-1]){let Ye=!0;for(let Qe=De-4;Qe<=De;Qe++)if((ye[Qe]-ye[Qe-1])*Be<=0){Ye=!1;break}if(Ye){Ne.push({index:De,rule:3,description:Be>0?"six rising":"six falling"});break}}if(De>=13){let Be=!0;for(let Ye=De-12;Ye<=De;Ye++){const Qe=ye[Ye]-ye[Ye-1],ct=ye[Ye+1<=De?Ye+1:Ye]-ye[Ye];if(Ye+1>De)break;if(Qe===0||ct===0||Qe>0==ct>0){Be=!1;break}}Be&&Ne.push({index:De,rule:4,description:"fourteen alternating"})}if(De>=2&&Pe(De-2,De,2,2)&&Ne.push({index:De,rule:5,description:"two of three past two sigma"}),De>=4&&Pe(De-4,De,1,4)&&Ne.push({index:De,rule:6,description:"four of five past one sigma"}),De>=14){let Be=!0;for(let Ye=De-14;Ye<=De;Ye++)if(Math.abs(ce(Ye))>=1){Be=!1;break}Be&&Ne.push({index:De,rule:7,description:"fifteen within one sigma"})}if(De>=7){let Be=!0;for(let Ye=De-7;Ye<=De;Ye++)if(Math.abs(ce(Ye))<=1){Be=!1;break}Be&&Ne.push({index:De,rule:8,description:"eight beyond one sigma"})}}return Ne}const Ee=Object.freeze(["westernElectric","nelson"]);function He(ye,xe,Se="westernElectric"){return String(Se)==="nelson"?Re(ye,xe):Ue(ye,xe)}function Ke(ye,xe,Se){let Le=0;for(let se=0;se<ye.length;se++)(ye[se]<xe||ye[se]>Se)&&Le++;return Le}function We(ye,xe,Se,Le=20){const se=ye.length;if(!se)return[];const ce=ye[0],Pe=ye[se-1];if(Pe===ce)return[{from:ce,to:Pe,count:se}];const Ne=Se-xe,De=1.5*Ne;let Be=Ne>0?Math.max(ce,xe-De):ce,Ye=Ne>0?Math.min(Pe,Se+De):Pe;Ye>Be||(Be=ce,Ye=Pe);const Qe=Ne>0?2*Ne/Math.cbrt(se):(Ye-Be)/(Math.ceil(Math.log2(se))+1),ct=Qe>0?Math.min(Le,Math.max(1,Math.ceil((Ye-Be)/Qe))):1,pt=(Ye-Be)/ct,Ge=[];for(let nt=0;nt<ct;nt++)Ge.push({from:Be+nt*pt,to:Be+(nt+1)*pt,count:0});for(let nt=0;nt<se;nt++){const at=Math.min(ct-1,Math.max(0,Math.floor((ye[nt]-Be)/pt)));Ge[at].count++}return Ge[0].from=ce,Ge[ct-1].to=Pe,Ge}const qe=.95;function et(ye){const xe=Number(ye);return Number.isFinite(xe)&&xe>0&&xe<1?xe:qe}function dt(ye,xe=qe){const Se=ye.length;if(Se<2)return null;let Le=0;for(let Ye=0;Ye<Se;Ye++)Le+=ye[Ye];const se=Le/Se;let ce=0;for(let Ye=0;Ye<Se;Ye++){const Qe=ye[Ye]-se;ce+=Qe*Qe}const Pe=Math.sqrt(ce/(Se-1)),Ne=et(xe),Be=D(1-(1-Ne)/2,Se-1)*Pe/Math.sqrt(Se);return{mean:se,lower:se-Be,upper:se+Be,margin:Be,n:Se,confidence:Ne}}function lt(ye,xe,Se=qe){const Le=Number(ye),se=Number(xe);if(!(se>0)||!(Le>=0)||Le>se)return null;const ce=et(Se),Pe=z(1-(1-ce)/2),Ne=Le/se,De=Pe*Pe,Be=1+De/se,Ye=(Ne+De/(2*se))/Be,Qe=Pe/Be*Math.sqrt(Ne*(1-Ne)/se+De/(4*se*se));return{proportion:Ne,lower:Math.max(0,Ye-Qe),upper:Math.min(1,Ye+Qe),n:se,confidence:ce}}function vt(ye,xe=qe){if(!ye||!(ye.n>2)||!Number.isFinite(ye.stdError))return null;const Se=et(xe),se=D(1-(1-Se)/2,ye.n-2)*ye.stdError;return{slope:ye.slope,lower:ye.slope-se,upper:ye.slope+se,margin:se,confidence:Se}}function Pt(ye,xe,Se=qe){const Le=Number(ye),se=Number(xe);if(!Number.isFinite(Le)||!(se>1))return null;const ce=et(Se),Ne=z(1-(1-ce)/2)*Math.sqrt(1/(9*se)+Le*Le/(2*(se-1)));return{index:Le,lower:Le-Ne,upper:Le+Ne,margin:Ne,n:se,confidence:ce}}function $t(ye,xe){return!ye||!(ye.sd>0)||!Number.isFinite(xe)||!Number.isFinite(ye.mean)?null:(xe-ye.mean)/ye.sd}function ht(ye){return Number.isFinite(ye)?Math.min(1,Math.max(0,2*L(Math.abs(ye)/2)-1)):0}function ut(ye,xe){const Se=new Map,Le=K(ye);let se=0;for(let ce=0;ce<xe.length;ce++){const Pe=Le(xe[ce]);if(Pe==null||Pe===""||typeof Pe=="number"&&Number.isNaN(Pe))continue;const Ne=Pe instanceof Date?Pe.getTime():typeof Pe=="object"?String(Pe):Pe;Se.set(Ne,(Se.get(Ne)||0)+1),se++}return{map:Se,total:se}}function wt(ye,xe,Se,Le){if(!(xe>0)||!(Le>0))return null;let se=0;const ce=new Set(ye.keys());for(const Pe of Se.keys())ce.add(Pe);for(const Pe of ce){const Ne=(ye.get(Pe)||0)/xe,De=(Se.get(Pe)||0)/Le;se+=Math.abs(Ne-De)}return se/2}const Nt=10;function gt(ye,xe,Se){if(Se&&Se.numeric){const Ne=p(ye,xe),{n:De,mean:Be}=h(Ne),Ye=De>0?$t({mean:Se.mean,sd:Se.sd},Be):null;return{measure:"standardizedMeanDifference",magnitude:Ye,distance:Ye===null?0:ht(Ye),direction:Ye===null?0:Math.sign(Ye),subsetN:De,populationN:Se.n||0,reliable:De>=Nt}}const{map:se,total:ce}=ut(ye,xe),Pe=wt(se,ce,Se.map,Se.total);return{measure:"categoricalTotalVariation",magnitude:Pe,distance:Pe===null?0:Pe,direction:0,subsetN:ce,populationN:Se.total||0,reliable:ce>=Nt}}function Ce(ye,xe){if(ye&&(ye.kind==="float64"||ye.kind==="int32"))return!0;const Se=K(ye);let Le=0,se=0;for(let ce=0;ce<xe.length&&Le<200;ce++){const Pe=Se(xe[ce]);if(Pe==null||Pe==="")continue;if(Pe instanceof Date)return!1;Le++;const Ne=typeof Pe=="number"?Pe:Number(Pe);Number.isFinite(Ne)&&se++}return Le===0?!1:se/Le>=.9}function $e(ye,xe){if(Ce(ye,xe)){const se=p(ye,xe),{n:ce,mean:Pe,m2:Ne}=h(se);return{numeric:!0,mean:Pe,sd:ce>0?Math.sqrt(Ne/ce):0,n:ce}}const{map:Se,total:Le}=ut(ye,xe);return{numeric:!1,map:Se,total:Le}}}),ze("packages/core/src/compute/total.js",function(e,_){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"aggregatesFor",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"aggregateAllowed",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return h}});const E=_("packages/core/src/internal/predicates.js").isFunction,U=_("packages/core/src/internal/warn.js").warnOnce,D=_("packages/core/src/compute/handle.js"),J=D.presenceReader,z=D.valueComparator,L=D.valueReader,X=_("packages/core/src/compute/statistics.js"),I=X.STAT_FNS,j=X.STAT_LABELS;function k(w){return!!w&&(w.kind==="float64"||w.kind==="int32")}function y(w,v){const A=v.length;let H=0;if(k(w)){const Z=w.values,M=J(w);if(!M){for(let S=0;S<A;S++){const T=Z[v[S]];Number.isNaN(T)||(H+=T)}return H}for(let S=0;S<A;S++){const T=v[S];if(M(T)===1){const O=Z[T];Number.isNaN(O)||(H+=O)}}return H}const G=L(w);for(let Z=0;Z<A;Z++){const M=p(G(v[Z]));M!==null&&(H+=M)}return H}y.kernel=!0;function l(w,v){const A=v.length;let H=0;if(k(w)){const Z=w.values,M=J(w);if(!M){for(let S=0;S<A;S++)Number.isNaN(Z[v[S]])||H++;return H}for(let S=0;S<A;S++){const T=v[S];M(T)===1&&!Number.isNaN(Z[T])&&H++}return H}const G=L(w);for(let Z=0;Z<A;Z++){const M=G(v[Z]);M!=null&&!(typeof M=="number"&&Number.isNaN(M))&&H++}return H}l.kernel=!0;function g(w,v){return v.length}g.kernel=!0;function s(w,v){const A=l(w,v);return A===0?null:y(w,v)/A}s.kernel=!0;function t(w,v,A,H){const G=v.length;if(k(w)){const T=w.values,O=J(w);let N=null;if(!O){for(let P=0;P<G;P++){const C=T[v[P]];Number.isNaN(C)||(N===null||(A<0?C<N:C>N))&&(N=C)}return N}for(let P=0;P<G;P++){const C=v[P];if(O(C)===0)continue;const B=T[C];Number.isNaN(B)||(N===null||(A<0?B<N:B>N))&&(N=B)}return N}const Z=L(w),M=z(H);let S=null;for(let T=0;T<G;T++){const O=Z(v[T]);O==null||typeof O=="number"&&Number.isNaN(O)||(S===null||(A<0?M(O,S)<0:M(O,S)>0))&&(S=O)}return S}function o(w,v,A){return t(w,v,-1,A&&A.locale)}o.kernel=!0;function c(w,v,A){return t(w,v,1,A&&A.locale)}c.kernel=!0;function d(w,v){return v.length===0?null:L(w)(v[0])}d.kernel=!0;function n(w,v){return v.length===0?null:L(w)(v[v.length-1])}n.kernel=!0;function p(w){if(typeof w=="number")return Number.isNaN(w)?null:w;if(w==null||w===""||typeof w=="boolean")return null;if(w instanceof Date)return w.getTime();const v=Number(w);return Number.isNaN(v)?null:v}const i={sum:y,min:o,max:c,avg:s,count:g,first:d,last:n,countValues:l,...I},r=Object.freeze({...j,sum:"Sum",avg:"Average",min:"Min",max:"Max",count:"Count",countValues:"Count of values",first:"First",last:"Last"});function f(w){return w?typeof w=="string"?r[w]||w:"Total":""}const m=Object.freeze(["sum","avg","min","max","count","countValues","first","last"]);function u(w){const v=w&&w.dataType&&w.dataType.totals&&w.dataType.totals.supported;if(Array.isArray(v))return v.slice();const A=m.filter(H=>H in i);for(const H of Object.keys(i))A.includes(H)||A.push(H);return A}function b(w,v){return typeof v!="string"?!0:u(w).includes(v)}function a(w,v){const A=L(w),H=[];for(let G=0;G<v.length;G++){const Z=A(v[G]);Z!=null&&H.push(Z)}return H}function h(w,v,A,H){const G=v||[];if(typeof A=="string"){const Z=i[A];return Z?Z(w,G,H):(U(`total:${A}`,`unknown total function "${A}"; register it in config.totalFns`),null)}return E(A)?A.kernel===!0?A(w,G,H):A(a(w,G),H||{}):null}}),ze("packages/core/src/compute/windowed.js",function(e,_){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return J}});const E=_("packages/core/src/compute/sketch.js").Welford;class K{#e;#t;#n=[];#r;#s;constructor(L,X=0,I=Date.now){if(L!=="count"&&L!=="time"&&L!=="session")throw new RangeError(`unknown window kind: ${L}`);if((L==="count"||L==="time")&&!(X>0))throw new RangeError(`a ${L} window needs a positive span`);this.#e=L,this.#t=Math.floor(X),this.#r=I,this.#s=I()}get size(){return this.#n.length}push(L,X=this.#r()){Number.isFinite(L)&&(this.#n.push({t:X,v:L}),this.#i(X))}#i(L){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const X=L-this.#t;for(;this.#n.length&&this.#n[0].t<X;)this.#n.shift()}}spec(){const L=this.#e==="session"?this.#r()-this.#s:this.#t;return{kind:this.#e,span:L,size:this.#n.length}}values(){return this.#n.map(L=>L.v)}aggregate(){const L=this.spec();if(!this.#n.length)return{over:L,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const X=new E;let I=0,j=1/0,k=-1/0;for(const{v:y}of this.#n)I+=y,y<j&&(j=y),y>k&&(k=y),X.add(y);return{over:L,count:this.#n.length,sum:I,mean:X.mean(),min:j,max:k,variance:X.variance(),stddev:X.stddev()}}reduce(L){const X=this.aggregate(),I={sum:X.sum,avg:X.mean,mean:X.mean,min:X.min,max:X.max,count:X.count,variance:X.variance,stddev:X.stddev};if(!(L in I))throw new RangeError(`unknown windowed aggregate: ${L}`);return{value:I[L],over:X.over}}}const U=Object.freeze(["count","time","session"]);function D(z,L=Date.now){const X=z.kind==="time"&&z.minutes!=null?z.minutes*6e4:z.span??0;return new K(z.kind,X,L)}const J={Window:K,WINDOW_KINDS:U,openWindow:D}}),ze("packages/core/src/compute/rolling.js",function(e,_){"use strict";Object.defineProperty(e,"ROLLING_WINDOW_FIELDS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"rollingWindow",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"rollingQuantile",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"seasonalDecompose",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"exponentialSmoothing",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return p}});const E=_("packages/core/src/compute/windowed.js").openWindow,U=_("packages/core/src/compute/sketch.js").KLL,D=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function J(i,r,f,m){if(i.kind==="count"){const u=Math.max(1,Math.floor(i.span||0));return{coverage:Math.min(1,r/u),partial:r<u}}if(i.kind==="time"){const u=i.minutes!=null?i.minutes*6e4:i.span||0;if(!(u>0))return{coverage:1,partial:!1};const b=f-m;return{coverage:Math.min(1,b/u),partial:b<u}}return{coverage:null,partial:!1}}function z(i,r){const f=E(r),m=new Map,u=i.length?i[0].at:0;for(let b=0;b<i.length;b++){const{key:a,at:h,value:w}=i[b];Number.isFinite(w)&&f.push(w,h);const v=f.aggregate(),A=J(r,v.count,h,u);a!=null&&m.set(String(a),{sum:v.sum,avg:v.mean,min:v.min,max:v.max,count:v.count,coverage:A.coverage,partial:A.partial})}return m}function L(i){const r=new Map;let f=0;for(const{key:m,value:u}of i)Number.isFinite(u)&&(f+=u),m!=null&&r.set(String(m),f);return r}function X(i,r=1){const f=new Map,m=Math.max(1,Math.floor(r));for(let u=0;u<i.length;u++){const{key:b,value:a}=i[u];if(b==null)continue;const h=u>=m?i[u-m].value:null,w=Number.isFinite(a)?a:null,v=Number.isFinite(h)?h:null;f.set(String(b),w!==null&&v!==null?w-v:null)}return f}const I=4096;function j(i){let r=i>>>0;return()=>{r+=1831565813;let f=r;return f=Math.imul(f^f>>>15,f|1),f^=f+Math.imul(f^f>>>7,f|61),((f^f>>>14)>>>0)/4294967296}}function k(i,r){const f=i.length;if(f===1)return i[0];const m=(f-1)*r,u=Math.floor(m),b=Math.ceil(m);return u===b?i[u]:i[u]+(m-u)*(i[b]-i[u])}function y(i,r,f={}){const m=Math.min(1,Math.max(0,f.q==null?.5:f.q)),u=Math.max(1,Math.floor(f.cap==null?I:f.cap)),b=j(f.seed==null?2654435769:f.seed),a=new Map,h=i.length?i[0].at:0;if(r.kind==="session"){const v=new U(200,b);let A=0;for(const{key:H,value:G}of i)Number.isFinite(G)&&(v.add(G),A++),H!=null&&a.set(String(H),{value:A?v.quantile(m):null,approx:A>0,count:A,coverage:null,partial:!1});return a}const w=E(r);for(const{key:v,at:A,value:H}of i){Number.isFinite(H)&&w.push(H,A);const G=w.values(),Z=G.length;let M=null,S=!1;if(Z)if(Z<=u)M=k([...G].sort((O,N)=>O-N),m);else{const O=new U(200,b);for(const N of G)O.add(N);M=O.quantile(m),S=!0}const T=J(r,Z,A,h);v!=null&&a.set(String(v),{value:M,approx:S,count:Z,coverage:T.coverage,partial:T.partial})}return a}function l(i,r){const f=i.length,m=new Array(f).fill(null),u=Math.floor(r/2),b=r%2===0;for(let a=0;a<f;a++){if(a-u<0||a+u>=f)continue;let h=0,w=!0;if(b)for(let v=-u;v<=u;v++){const A=i[a+v];if(!Number.isFinite(A)){w=!1;break}h+=v===-u||v===u?A*.5:A}else for(let v=-u;v<=u;v++){const A=i[a+v];if(!Number.isFinite(A)){w=!1;break}h+=A}w&&(m[a]=h/r)}return m}function g(i,r){const f=new Map,m=Math.floor(Number(r&&r.period));if(!(m>=2))return f;const u=r&&r.model==="multiplicative",b=i.length,a=i.map(S=>Number.isFinite(S.value)?S.value:null),h=l(a,m),w=new Array(b).fill(null);for(let S=0;S<b;S++){const T=h[S],O=a[S];T===null||O===null||(u?T!==0&&(w[S]=O/T):w[S]=O-T)}const v=new Array(m).fill(0),A=new Array(m).fill(0);for(let S=0;S<b;S++){if(w[S]===null)continue;const T=S%m;v[T]+=w[S],A[T]+=1}const H=u?1:0,G=v.map((S,T)=>A[T]?S/A[T]:H),Z=G.reduce((S,T)=>S+T,0)/m,M=u?G.map(S=>Z!==0?S/Z:1):G.map(S=>S-Z);for(let S=0;S<b;S++){const{key:T}=i[S];if(T==null)continue;const O=h[S],N=M[S%m],P=a[S];let C=null;O!==null&&P!==null&&(C=u?O*N!==0?P/(O*N):null:P-O-N),f.set(String(T),{trend:O,seasonal:P===null?null:N,residual:C,coverage:O===null?0:1,partial:O===null})}return f}function s(i,r,f,m=80){const u=(Math.sqrt(5)-1)/2;let b=r,a=f,h=a-u*(a-b),w=b+u*(a-b),v=i(h),A=i(w);for(let H=0;H<m;H++)v<A?(a=w,w=h,A=v,h=a-u*(a-b),v=i(h)):(b=h,h=w,v=A,w=b+u*(a-b),A=i(w));return(b+a)/2}const t=1e-4,o=1-1e-4;function c(i,r){const f=i.length,m=new Array(f).fill(null),u=new Array(f).fill(null);let b=null,a=0;for(let h=0;h<f;h++){const w=i[h];if(!Number.isFinite(w)){b!==null&&(u[h]=b,m[h]=b);continue}if(b===null){b=w,u[h]=w,m[h]=w;continue}u[h]=b,a+=(w-b)**2,b=r*w+(1-r)*b,m[h]=b}return{smoothed:m,fitted:u,sse:a}}function d(i,r,f){const m=i.length,u=new Array(m).fill(null),b=new Array(m).fill(null);let a=null,h=null,w=0;for(let v=0;v<m;v++){const A=i[v];if(!Number.isFinite(A)){a!==null&&(a+=h,u[v]=a);continue}if(a===null){a=A,u[v]=A;continue}if(h===null){h=A-a;const Z=a+h;b[v]=Z,w+=(A-Z)**2;const M=a;a=r*A+(1-r)*(M+h),h=f*(a-M)+(1-f)*h,u[v]=a;continue}const H=a+h;b[v]=H,w+=(A-H)**2;const G=a;a=r*A+(1-r)*(G+h),h=f*(a-G)+(1-f)*h,u[v]=a}return{smoothed:u,fitted:b,sse:w}}function n(i,r={}){const f=new Map,m=r.method==="holt",u=i.map(H=>Number.isFinite(H.value)?H.value:null),b=u.filter(H=>H!==null).length,a=H=>Math.min(o,Math.max(t,H)),h=()=>{for(const{key:H}of i)H!=null&&f.set(String(H),{smoothed:null,fitted:null,alpha:null,beta:null,sse:null});return f};if(b<(m?2:1))return h();let w=Number.isFinite(r.alpha)?a(r.alpha):null,v=m&&Number.isFinite(r.beta)?a(r.beta):null;if(m){if(w===null||v===null){let H=w===null?.5:w,G=v===null?.5:v;for(let Z=0;Z<6;Z++)w===null&&(H=s(M=>d(u,M,G).sse,t,o)),v===null&&(G=s(M=>d(u,H,M).sse,t,o));w=w===null?H:w,v=v===null?G:v}}else w===null&&(w=s(H=>c(u,H).sse,t,o));const A=m?d(u,w,v):c(u,w);for(let H=0;H<i.length;H++){const{key:G}=i[H];G!=null&&f.set(String(G),{smoothed:A.smoothed[H],fitted:A.fitted[H],alpha:w,beta:m?v:null,sse:A.sse})}return f}const p={ROLLING_WINDOW_FIELDS:D,QUANTILE_SPAN_CAP:I,rollingWindow:z,rollingQuantile:y,cumulativeToDate:L,periodOverPeriod:X,seasonalDecompose:g,exponentialSmoothing:n}}),ze("packages/core/src/compute/cluster.js",function(e,_){"use strict";Object.defineProperty(e,"CLUSTER_ROW_CAP",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"DBSCAN_ROW_CAP",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"DEFAULT_K",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DEFAULT_MIN_POINTS",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"orderByCentre",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"kmeans",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"dbscan",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"autoK",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"standardise",{enumerable:!0,get:function(){return t}});const ne=1e5,E=2e4,K=3,U=5,D=100;function J(o){let c=o>>>0;return function(){c=c+1831565813|0;let n=Math.imul(c^c>>>15,1|c);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}function z(o,c){let d=0;for(let n=0;n<o.length;n++){const p=o[n]-c[n];d+=p*p}return d}function L(o,c){return Math.sqrt(z(o,c))}function X(o,c){let d=-1,n=1/0;for(let p=0;p<c.length;p++){const i=z(o,c[p]);i<n&&(n=i,d=p)}return d}function I(o,c,d){const n=J(d),p=o.length,i=[Array.from(o[Math.floor(n()*p)])],r=new Float64Array(p).fill(1/0);for(let f=1;f<c;f++){let m=0;for(let h=0;h<p;h++){const w=z(o[h],i[i.length-1]);w<r[h]&&(r[h]=w),m+=r[h]}const u=n()*(m||p);let b=0,a=p-1;for(let h=0;h<p;h++)if(b+=m?r[h]:1,b>=u){a=h;break}i.push(Array.from(o[a]))}return i}function j(o,c){for(let d=0;d<o.length;d++){const n=o[d]-c[d];if(n!==0)return n}return 0}function k(o,c,d,n){const p=c.map((r,f)=>({centre:r,i:f})).sort((r,f)=>j(r.centre,f.centre)),i=new Int32Array(c.length);for(let r=0;r<p.length;r++)i[p[r].i]=r;for(let r=0;r<o.length;r++)o[r]>=0&&(o[r]=i[o[r]]);return{assignments:o,centres:p.map(r=>r.centre),sizes:p.map(r=>d[r.i]),distances:n}}function y(o,c={}){const d=o.length,n=d?o[0].length:0,p=Math.floor(c.k||K);if(!(d>=p)||p<1||n<1)return null;let i=I(o,p,c.seed===void 0?1:c.seed);const r=new Int32Array(d);let f=!0;for(let a=0;a<D&&f;a++){f=!1;for(let v=0;v<d;v++){const A=X(o[v],i);r[v]!==A&&(r[v]=A,f=!0)}const h=i.map(()=>new Float64Array(n)),w=new Array(p).fill(0);for(let v=0;v<d;v++){const A=r[v];for(let H=0;H<n;H++)h[A][H]+=o[v][H];w[A]++}for(let v=0;v<p;v++)if(w[v])for(let A=0;A<n;A++)i[v][A]=h[v][A]/w[v];else{let A=0,H=-1/0;for(let G=0;G<d;G++){const Z=z(o[G],i[v]);Z>H&&(H=Z,A=G)}i[v]=Array.from(o[A]),f=!0}}const m=new Array(p).fill(0),u=new Float64Array(d);let b=0;for(let a=0;a<d;a++){const h=r[a];m[h]++;const w=z(o[a],i[h]);u[a]=Math.sqrt(w),b+=w}return{assignments:r,centres:i,sizes:m,inertia:b,distances:u}}function l(o,c={}){const d=o.length,n=d?o[0].length:0,p=Number(c.eps),i=Math.max(1,Math.floor(c.minPoints||U));if(!(p>0)||d===0||n<1)return null;const r=new Array(d);for(let w=0;w<d;w++){const v=[];for(let A=0;A<d;A++)w!==A&&L(o[w],o[A])<=p&&v.push(A);r[w]=v}const f=new Int32Array(d).fill(-1);let m=0;for(let w=0;w<d;w++){if(f[w]!==-1||r[w].length<i)continue;f[w]=m;const v=[...r[w]];for(let A=0;A<v.length;A++){const H=v[A];f[H]===-1&&(f[H]=m,r[H].length>=i&&v.push(...r[H]))}m++}if(!m)return{assignments:f,centres:[],sizes:[],distances:new Float64Array(d).fill(NaN)};const u=[],b=new Array(m).fill(0),a=Array.from({length:m},()=>new Float64Array(n));for(let w=0;w<d;w++){const v=f[w];if(!(v<0)){b[v]++;for(let A=0;A<n;A++)a[v][A]+=o[w][A]}}for(let w=0;w<m;w++){const v=new Array(n);for(let A=0;A<n;A++)v[A]=a[w][A]/b[w];u.push(v)}const h=new Float64Array(d).fill(NaN);for(let w=0;w<d;w++){const v=f[w];v>=0&&(h[w]=L(o[w],u[v]))}return{assignments:f,centres:u,sizes:b,distances:h}}function g(o,c,d){const n=o.length;if(n===0)return 0;const p=new Int32Array(d);for(let r=0;r<n;r++)p[c[r]]++;let i=0;for(let r=0;r<n;r++){const f=c[r],m=new Float64Array(d);for(let a=0;a<n;a++)r!==a&&(m[c[a]]+=L(o[r],o[a]));const u=p[f]>1?m[f]/(p[f]-1):0;let b=1/0;for(let a=0;a<d;a++){if(a===f||p[a]===0)continue;const h=m[a]/p[a];h<b&&(b=h)}b!==1/0&&(i+=(b-u)/Math.max(u,b))}return i/n}function s(o,c={}){const d=o.length;if(!d)return null;const n=c.criterion==="silhouette"?"silhouette":"elbow",p=Math.max(2,Math.floor(c.maxK||8)),i=c.seed===void 0?1:c.seed;if(n==="silhouette"){const w=[],v=[];for(let H=2;H<=Math.min(p,d);H++){const G=y(o,{k:H,seed:i});G&&(w.push(H),v.push(g(o,G.assignments,H)))}if(!w.length)return null;let A=0;for(let H=1;H<v.length;H++)v[H]>v[A]&&(A=H);return{k:w[A],criterion:n,scores:v,ks:w}}const r=[],f=[];for(let w=1;w<=Math.min(p,d);w++){const v=y(o,{k:w,seed:i});v&&(r.push(w),f.push(v.inertia))}if(f.length<2)return null;const m={k:r[0],y:f[0]},u={k:r[r.length-1],y:f[f.length-1]},b=Math.hypot(u.k-m.k,u.y-m.y)||1;let a=0,h=-1/0;for(let w=0;w<f.length;w++){const v=Math.abs((u.k-m.k)*(m.y-f[w])-(m.k-r[w])*(u.y-m.y))/b;v>h&&(h=v,a=w)}return{k:r[a],criterion:n,scores:f,ks:r}}function t(o){const c=o.length,d=c?o[0].length:0;if(!c||!d)return null;const n=new Array(d).fill(0);for(let i=0;i<c;i++)for(let r=0;r<d;r++)n[r]+=o[i][r];for(let i=0;i<d;i++)n[i]/=c;const p=new Array(d).fill(0);for(let i=0;i<c;i++)for(let r=0;r<d;r++){const f=o[i][r]-n[r];p[r]+=f*f}for(let i=0;i<d;i++)p[i]=c>1?Math.sqrt(p[i]/(c-1)):0;for(let i=0;i<c;i++)for(let r=0;r<d;r++)p[r]>0?o[i][r]=(o[i][r]-n[r])/p[r]:o[i][r]=o[i][r]-n[r];return{mean:n,sd:p}}}),ze("packages/core/src/compute/compare.js",function(e,_){"use strict";Object.defineProperty(e,"COMPARE_MEASURES",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"pooledStandardMeanDifference",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"numericSummary",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"bothNumeric",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"compareColumnAcross",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"compareDatasets",{enumerable:!0,get:function(){return l}});const ne=_("packages/core/src/compute/statistics.js"),E=ne.numbers,K=ne.moments,U=ne.frequencyMap,D=ne.categoricalDistance,J=ne.normalTotalVariation,z=ne.isNumericColumn,L=ne.SUBSET_RELIABILITY_FLOOR,X=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function I(g,s){if(!g||!s||!(g.n>0)||!(s.n>0)||!Number.isFinite(g.mean)||!Number.isFinite(s.mean))return null;const t=(g.n*g.sd*g.sd+s.n*s.sd*s.sd)/(g.n+s.n);return t>0?(g.mean-s.mean)/Math.sqrt(t):null}function j(g,s){const t=E(g,s),{n:o,mean:c,m2:d}=K(t),n=o>0?Math.sqrt(d/o):0;return{mean:c,sd:n,n:o}}function k(g,s,t,o){return z(g,s)&&z(t,o)}function y(g,s,t,o){if(k(g,s,t,o)){const p=j(g,s),i=j(t,o),r=I(p,i);return{measure:X.numeric,magnitude:r,distance:r===null?0:J(r),direction:r===null?0:Math.sign(r),nA:p.n,nB:i.n,meanA:p.mean,meanB:i.mean,reliable:p.n>=L&&i.n>=L}}const c=U(g,s),d=U(t,o),n=D(c.map,c.total,d.map,d.total);return{measure:X.categorical,magnitude:n,distance:n===null?0:n,direction:0,nA:c.total,nB:d.total,meanA:null,meanB:null,reliable:c.total>=L&&d.total>=L}}function l(g,s,t={}){const o=new Set(g.columns),c=new Set(s.columns),d=g.columns.filter(f=>c.has(f)),n=Array.isArray(t.columns)&&t.columns.length?d.filter(f=>t.columns.includes(f)):d,p=g.indices(),i=s.indices(),r=[];for(const f of n){const m=g.handle(f),u=s.handle(f);if(!m||!u)continue;const b=y(m,p,u,i);r.push({column:f,name:g.name&&g.name(f)||s.name&&s.name(f)||f,measure:b.measure,magnitude:b.magnitude,distance:b.distance,direction:b.direction,nA:b.nA,nB:b.nB,meanA:b.meanA,meanB:b.meanB,reliable:b.reliable})}return r.sort((f,m)=>m.distance-f.distance||Math.abs(m.magnitude||0)-Math.abs(f.magnitude||0)),{ranked:r,nA:p.length,nB:i.length,unmatched:{onlyA:g.columns.filter(f=>!c.has(f)),onlyB:s.columns.filter(f=>!o.has(f))},measures:X}}}),ze("packages/core/src/compute/anomaly.js",function(e,_){"use strict";Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"DEFAULT_MODIFIED_Z_THRESHOLD",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return p}});const E=_("packages/core/src/compute/statistics.js").quantileSorted,U=_("packages/core/src/compute/special.js").logGamma,D=.6745,J=3.5,z=1.5,L=.975,X=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function I(i){if(!i.length)return null;const f=Array.from(i,Number).sort((a,h)=>a-h),m=E(f,.5),u=f.map(a=>Math.abs(a-m)).sort((a,h)=>a-h),b=E(u,.5);return{median:m,mad:b}}function j(i,r={}){const f=Number.isFinite(r.threshold)?r.threshold:J,m=i.length,u=new Array(m).fill(null),b=new Array(m).fill(!1),a=[];for(let v=0;v<m;v++){const A=Number(i[v]);Number.isFinite(A)&&a.push(A)}if(!a.length)return{median:null,mad:null,threshold:f,scores:u,flags:b,flagged:0};const h=I(a);if(h.mad===0)return{median:h.median,mad:0,threshold:f,scores:u,flags:b,flagged:0};let w=0;for(let v=0;v<m;v++){const A=Number(i[v]);if(!Number.isFinite(A))continue;const H=D*(A-h.median)/h.mad;u[v]=H,Math.abs(H)>f&&(b[v]=!0,w++)}return{median:h.median,mad:h.mad,threshold:f,scores:u,flags:b,flagged:w}}function k(i,r={}){const f=Number.isFinite(r.k)?r.k:z,m=[];for(let w=0;w<i.length;w++){const v=Number(i[w]);Number.isFinite(v)&&m.push(v)}if(!m.length)return null;const u=m.sort((w,v)=>w-v),b=E(u,.25),a=E(u,.75),h=a-b;return{q1:b,q3:a,iqr:h,lower:b-f*h,upper:a+f*h,k:f}}function y(i,r){if(r<=0)return 0;const f=U(i);if(r<i+1){let v=i,A=1/i,H=A;for(let G=0;G<1e3&&(v+=1,H*=r/v,A+=H,!(Math.abs(H)<Math.abs(A)*1e-15));G++);return A*Math.exp(-r+i*Math.log(r)-f)}const m=1e-300;let u=r+1-i,b=1/m,a=1/u,h=a;for(let v=1;v<1e3;v++){const A=-v*(v-i);u+=2,a=A*a+u,Math.abs(a)<m&&(a=m),b=u+A/b,Math.abs(b)<m&&(b=m),a=1/a;const H=a*b;if(h*=H,Math.abs(H-1)<1e-15)break}return 1-Math.exp(-r+i*Math.log(r)-f)*h}function l(i,r){return i<=0?0:y(r/2,i/2)}function g(i,r=L){if(!(r>0)||!(r<1))return NaN;let f=0,m=Math.max(1,i);for(;l(m,i)<r;)m*=2;for(let u=0;u<200;u++){const b=(f+m)/2;if(l(b,i)<r?f=b:m=b,m-f<1e-10)break}return(f+m)/2}function s(i){const r=i.length,f=i.map((m,u)=>{const b=m.slice();for(let a=0;a<r;a++)b.push(u===a?1:0);return b});for(let m=0;m<r;m++){let u=m;for(let a=m+1;a<r;a++)Math.abs(f[a][m])>Math.abs(f[u][m])&&(u=a);if(Math.abs(f[u][m])<1e-12)return null;if(u!==m){const a=f[u];f[u]=f[m],f[m]=a}const b=f[m][m];for(let a=0;a<2*r;a++)f[m][a]/=b;for(let a=0;a<r;a++){if(a===m)continue;const h=f[a][m];if(h!==0)for(let w=0;w<2*r;w++)f[a][w]-=h*f[m][w]}}return f.map(m=>m.slice(r))}function t(i,r){const f=i.length,m=new Array(r).fill(0);for(const a of i)for(let h=0;h<r;h++)m[h]+=a[h];for(let a=0;a<r;a++)m[a]/=f;const u=Array.from({length:r},()=>new Array(r).fill(0));for(const a of i)for(let h=0;h<r;h++){const w=a[h]-m[h];for(let v=h;v<r;v++)u[h][v]+=w*(a[v]-m[v])}const b=f>1?f-1:1;for(let a=0;a<r;a++)for(let h=a;h<r;h++)u[a][h]/=b,u[h][a]=u[a][h];return{mean:m,cov:u}}function o(i,r={}){const f=Number.isFinite(r.p)?r.p:L,m=Number.isFinite(r.ridge)?r.ridge:1e-6,u=i.length;if(!u)return null;const b=i[0].length;if(!b)return null;const a=new Array(u).fill(null),h=new Array(u).fill(null),w=new Array(u).fill(!1),v=[],A=[];for(let N=0;N<u;N++){const P=i[N];let C=P.length===b;const B=new Array(b);for(let x=0;C&&x<b;x++){const V=Number(P[x]);Number.isFinite(V)?B[x]=V:C=!1}C&&(v.push(N),A.push(B))}const H=b,G=g(H,f);if(A.length<=b)return{center:[],df:H,cutoff:G,singular:!0,used:A.length,distances:a,squared:h,flags:w,flagged:0};const{mean:Z,cov:M}=t(A,b);let S=s(M),T=!1;if(!S){T=!0;let N=0;for(let B=0;B<b;B++)N+=M[B][B];const P=N/b*m||m,C=M.map((B,x)=>B.map((V,Y)=>x===Y?V+P:V));if(S=s(C),!S)return{center:Z,df:H,cutoff:G,singular:!0,used:A.length,distances:a,squared:h,flags:w,flagged:0}}let O=0;for(let N=0;N<A.length;N++){const P=A[N],C=new Array(b);for(let V=0;V<b;V++)C[V]=P[V]-Z[V];let B=0;for(let V=0;V<b;V++){let Y=0;for(let F=0;F<b;F++)Y+=S[V][F]*C[F];B+=C[V]*Y}B<0&&(B=0);const x=v[N];h[x]=B,a[x]=Math.sqrt(B),B>G&&(w[x]=!0,O++)}return{center:Z,df:H,cutoff:G,singular:T,used:A.length,distances:a,squared:h,flags:w,flagged:O}}const c=20,d=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function n(i,r={}){const f=r.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",m=Number.isFinite(r.windowLen)&&r.windowLen>=1?Math.floor(r.windowLen):c,u=Number.isFinite(r.threshold)?r.threshold:J,b=Number.isFinite(r.k)?r.k:z,a=Number.isFinite(r.minPeriods)&&r.minPeriods>=1?Math.floor(r.minPeriods):m,h=i.length,w=new Array(h).fill(null),v=new Array(h).fill(!1);let A=0;for(let H=0;H<h;H++){const G=Number(i[H]);if(!Number.isFinite(G))continue;const Z=Math.max(0,H-m+1),M=[];for(let S=Z;S<=H;S++){const T=Number(i[S]);Number.isFinite(T)&&M.push(T)}if(!(M.length<a))if(f==="rollingIqr"){const S=k(M,{k:b});if(!S)continue;(G<S.lower||G>S.upper)&&(v[H]=!0,A++)}else{const S=I(M);if(!S||S.mad===0)continue;const T=D*(G-S.median)/S.mad;w[H]=T,Math.abs(T)>u&&(v[H]=!0,A++)}}return{method:f,windowLen:m,minPeriods:a,threshold:u,k:b,scores:w,flags:v,flagged:A}}function p(i={}){const r=i||{},f=r.field;if(typeof f!="string"||!f)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const m=r.method||"modifiedZScore";if(!(X.includes(m)||d.includes(m))||m==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${m}'`);const b=typeof r.orderBy=="string"?r.orderBy:null,a=r.latest===!0,h=d.includes(m),w=v=>Number(v==null?NaN:v[f]);return v=>{const A=Array.isArray(v)?v.slice():[...v];b&&A.sort((S,T)=>{const O=S?.[b],N=T?.[b];return O===N?0:O==null?-1:N==null?1:O<N?-1:1});const H=A.map(w);let G,Z;if(h)({flags:G,scores:Z}=n(H,{method:m,windowLen:r.windowLen,threshold:r.threshold,k:r.k,minPeriods:r.minPeriods}));else if(m==="iqr"){const S=k(H,{k:r.k});G=H.map(T=>S?Number.isFinite(T)&&(T<S.lower||T>S.upper):!1),Z=H.map(()=>null)}else({flags:G,scores:Z}=j(H,{threshold:r.threshold}));if(a){const S=G.length-1;return S<0||!G[S]?!1:{method:m,field:f,flagged:[{row:A[S],score:Z[S]}]}}const M=[];for(let S=0;S<G.length;S++)G[S]&&M.push({row:A[S],score:Z[S]});return M.length?{method:m,field:f,flagged:M}:!1}}}),ze("packages/core/src/compute/forecast.js",function(e,_){"use strict";Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return i}});const ne=_("packages/core/src/compute/special.js"),E=ne.normalQuantile,K=ne.studentTQuantile,D=_("packages/core/src/internal/warn.js").warnOnce,J=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),z=1e-4,L=1-1e-4;function X(r){const f=[];for(let m=0;m<r.length;m++){const u=r[m];if(u!==null&&typeof u=="object"){const b=Number.isFinite(u.at)?u.at:m,a=Number.isFinite(u.value)?u.value:null;f.push({at:b,value:a})}else f.push({at:m,value:Number.isFinite(u)?Number(u):null})}return f}function I(r){const f=r.filter(h=>h.value!==null),m=f[0],u=f[f.length-1],b=u.at-m.at,a=f.length>1&&b>0?b/(f.length-1):1;return{lastAt:u.at,step:a}}function j(r){return Math.min(L,Math.max(z,r))}function k(r,f=z,m=L,u=80){const b=(Math.sqrt(5)-1)/2;let a=f,h=m,w=h-b*(h-a),v=a+b*(h-a),A=r(w),H=r(v);for(let G=0;G<u;G++)A<H?(h=v,v=w,H=A,w=h-b*(h-a),A=r(w)):(a=w,w=v,A=H,v=a+b*(h-a),H=r(v));return(a+h)/2}function y(r,f){let m=null,u=0,b=0;for(let a=0;a<r.length;a++){const h=r[a];if(h!==null){if(m===null){m=h;continue}u+=(h-m)**2,b+=1,m=f*h+(1-f)*m}}return{level:m,sse:u,m:b}}function l(r,f,m){let u=null,b=null,a=0,h=0;for(let w=0;w<r.length;w++){const v=r[w];if(v===null){u!==null&&b!==null&&(u+=b);continue}if(u===null){u=v;continue}b===null&&(b=v-u);const A=u+b;a+=(v-A)**2,h+=1;const H=u;u=f*v+(1-f)*(H+b),b=m*(u-H)+(1-m)*b}return{level:u,trend:b,sse:a,m:h}}function g(r,f,m,u,b){const a=r.length;if(a<2*f)return null;const h=T=>{let O=0,N=0;for(let P=T;P<T+f&&P<a;P++)r[P]!==null&&(O+=r[P],N+=1);return N?O/N:null},w=h(0),v=h(f);if(w===null||v===null)return null;let A=w,H=(v-w)/f;const G=new Array(f).fill(0);for(let T=0;T<f;T++)G[T]=r[T]===null?0:r[T]-A;const Z=G.reduce((T,O)=>T+O,0)/f;for(let T=0;T<f;T++)G[T]-=Z;let M=0,S=0;for(let T=f;T<a;T++){const O=T%f,N=G[O],P=r[T];if(P===null){A+=H;continue}const C=A+H+N;M+=(P-C)**2,S+=1;const B=A;A=m*(P-N)+(1-m)*(A+H),H=u*(A-B)+(1-u)*H,G[O]=b*(P-A)+(1-b)*N}return{level:A,trend:H,season:G,phase:(a-1)%f,sse:M,count:S}}function s(r,f,m){let u=1;for(const a of f)u+=a*a;const b=Math.sqrt(r*u);return{se:b,margin:m*b}}function t(r,f={}){if(!r||typeof r.length!="number"||r.length===0)return null;const m=J.includes(f.method)?f.method:"linear",u=Math.max(1,Math.floor(Number(f.horizon)||1)),b=Number.isFinite(f.confidence)&&f.confidence>0&&f.confidence<1?f.confidence:.95,a=1-(1-b)/2,h=X(r),w=h.map(M=>M.value),v=w.filter(M=>M!==null),A=v.length,{lastAt:H,step:G}=A?I(h):{lastAt:0,step:1},Z=M=>H+M*G;return m==="linear"?o(h,A,u,b,a,Z):m==="movingAverage"?c(v,A,u,b,a,f,Z):m==="ses"?d(w,A,u,b,a,f,Z):m==="holt"?n(w,A,u,b,a,f,Z):p(w,A,u,b,a,f,Z)}function o(r,f,m,u,b,a){if(f<2)return null;let h=0,w=0;for(const P of r)P.value!==null&&(h+=P.at,w+=P.value);h/=f,w/=f;let v=0,A=0,H=0;for(const P of r){if(P.value===null)continue;const C=P.at-h,B=P.value-w;v+=C*C,A+=C*B,H+=B*B}if(v===0)return null;const G=A/v,Z=w-G*h,M=H===0?1:Math.max(0,Math.min(1,A*A/(v*H))),S=Math.max(0,H-G*A),T=f>2?Math.sqrt(S/(f-2)):null,O=f>2?K(b,f-2):null,N=[];for(let P=1;P<=m;P++){const C=a(P),B=Z+G*C;let x=null,V=null,Y=null,F=null,$=null;if(T!==null){const q=1/f+(C-h)**2/v,ee=T*Math.sqrt(1+q),te=T*Math.sqrt(q);$=ee,x=B-O*ee,V=B+O*ee,Y=B-O*te,F=B+O*te}N.push({step:P,at:C,mean:B,lower:x,upper:V,lowerMean:Y,upperMean:F,se:$})}return{method:"linear",horizon:m,confidence:u,n:f,sigma:T,r2:M,params:{slope:G,intercept:Z},points:N}}function c(r,f,m,u,b,a,h){if(f<1)return null;const w=Math.max(1,Math.min(f,Math.floor(Number(a.windowLen)||f))),v=r.slice(f-w);let A=0;for(const T of v)A+=T;const H=A/w;let G=null,Z=null;if(w>1){let T=0;for(const N of v)T+=(N-H)**2;G=Math.sqrt(T/(w-1))*Math.sqrt(1+1/w),Z=K(b,w-1)}const M=G===null?null:Z*G,S=[];for(let T=1;T<=m;T++)S.push({step:T,at:h(T),mean:H,lower:M===null?null:H-M,upper:M===null?null:H+M,se:G});return{method:"movingAverage",horizon:m,confidence:u,n:f,sigma:G===null?null:G,params:{windowLen:w},points:S}}function d(r,f,m,u,b,a,h){if(f<1)return null;let w=Number.isFinite(a.alpha)?j(a.alpha):null;w===null&&(w=k(Z=>y(r,Z).sse));const v=y(r,w),A=E(b),H=v.m>0?v.sse/v.m:null,G=[];for(let Z=1;Z<=m;Z++){const M=v.level;let S=null,T=null,O=null;if(H!==null){const N=[];for(let C=1;C<Z;C++)N.push(w);const P=s(H,N,A);O=P.se,S=M-P.margin,T=M+P.margin}G.push({step:Z,at:h(Z),mean:M,lower:S,upper:T,se:O})}return{method:"ses",horizon:m,confidence:u,n:f,sigma:H===null?null:Math.sqrt(H),params:{alpha:w},points:G}}function n(r,f,m,u,b,a,h){if(f<2)return null;let w=Number.isFinite(a.alpha)?j(a.alpha):null,v=Number.isFinite(a.beta)?j(a.beta):null;if(w===null||v===null){let S=w===null?.5:w,T=v===null?.5:v;for(let O=0;O<6;O++)w===null&&(S=k(N=>l(r,N,T).sse)),v===null&&(T=k(N=>l(r,S,N).sse));w=w===null?S:w,v=v===null?T:v}const A=l(r,w,v),H=E(b),G=A.m>0?A.sse/A.m:null,Z=w*v,M=[];for(let S=1;S<=m;S++){const T=A.level+S*A.trend;let O=null,N=null,P=null;if(G!==null){const C=[];for(let x=1;x<S;x++)C.push(w+x*Z);const B=s(G,C,H);P=B.se,O=T-B.margin,N=T+B.margin}M.push({step:S,at:h(S),mean:T,lower:O,upper:N,se:P})}return{method:"holt",horizon:m,confidence:u,n:f,sigma:G===null?null:Math.sqrt(G),params:{alpha:w,beta:v},points:M}}function p(r,f,m,u,b,a,h){const w=Math.floor(Number(a.period));if(!(w>=2))return D("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(f<2*w)return null;let v=Number.isFinite(a.alpha)?j(a.alpha):null,A=Number.isFinite(a.beta)?j(a.beta):null,H=Number.isFinite(a.gamma)?j(a.gamma):null;const G=(P,C,B)=>{const x=g(r,w,P,C,B);return x?x.sse:1/0};if(v===null||A===null||H===null){let P=v===null?.5:v,C=A===null?.5:A,B=H===null?.5:H;for(let x=0;x<8;x++)v===null&&(P=k(V=>G(V,C,B))),A===null&&(C=k(V=>G(P,V,B))),H===null&&(B=k(V=>G(P,C,V)));v=v===null?P:v,A=A===null?C:A,H=H===null?B:H}const Z=g(r,w,v,A,H);if(!Z)return null;const M=E(b),S=Z.count>0?Z.sse/Z.count:null,T=v*A,O=H*(1-v),N=[];for(let P=1;P<=m;P++){const C=Z.season[(Z.phase+P)%w],B=Z.level+P*Z.trend+C;let x=null,V=null,Y=null;if(S!==null){const F=[];for(let q=1;q<P;q++)F.push(v+q*T+(q%w===0?O:0));const $=s(S,F,M);Y=$.se,x=B-$.margin,V=B+$.margin}N.push({step:P,at:h(P),mean:B,lower:x,upper:V,se:Y})}return{method:"holtWinters",horizon:m,confidence:u,n:f,sigma:S===null?null:Math.sqrt(S),params:{alpha:v,beta:A,gamma:H,period:w},points:N}}const i={FORECAST_METHODS:J,forecast:t}}),ze("packages/core/src/compute/hypothesis.js",function(e,_){"use strict";Object.defineProperty(e,"GROUP_TESTS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"NORMALITY_ALPHA",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"HL_PAIR_LIMIT",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"welchTTest",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"mannWhitneyUTest",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"chiSquareTest",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return M}});const E=_("packages/core/src/internal/warn.js").warnOnce,U=_("packages/core/src/compute/handle.js").valueReader,D=_("packages/core/src/compute/statistics.js"),J=D.numbers,z=D.moments,L=D.frequencyMap,X=D.categoricalDistance,I=D.isNumericColumn,j=D.jarqueBera,k=D.proportionInterval,y=D.SUBSET_RELIABILITY_FLOOR,g=_("packages/core/src/compute/compare.js").pooledStandardMeanDifference,s=_("packages/core/src/compute/special.js"),t=s.studentT,o=s.studentTQuantile,c=s.normalCdf,d=s.normalQuantile,n=s.chiSquareUpperTail,p=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),i=.05,r=2e6;function f(S){const T=Number(S);return Number.isFinite(T)&&T>0&&T<1?T:.95}function m(S){const{n:T,mean:O,m2:N}=z(S);return{mean:O,sd:T>0?Math.sqrt(N/T):0,n:T}}function u(S,T){const O=S.length;if(O<2)return 0;let N=0;for(let P=0;P<O;P++){const C=S[P]-T;N+=C*C}return N/(O-1)}function b(S,T){return{name:"pooledStandardMeanDifference",value:g(m(S),m(T))}}function a(S,T,O){const N=S.length,P=T.length;if(N<2||P<2)return null;const C=f(O),{mean:B}=z(S),{mean:x}=z(T),V=u(S,B),Y=u(T,x),F=V/N+Y/P;if(!(F>0))return null;const $=Math.sqrt(F),q=(B-x)/$,ee=V/N*(V/N)/(N-1),te=Y/P*(Y/P)/(P-1),re=F*F/(ee+te),ie=Math.min(1,Math.max(0,2*(1-t(Math.abs(q),re)))),ue=B-x,Ae=o(1-(1-C)/2,re)*$;return{test:p.WELCH,statistic:q,statisticName:"t",df:re,pValue:ie,interval:{estimate:ue,lower:ue-Ae,upper:ue+Ae,confidence:C,method:"welch-t (difference of means)"},effectSize:b(S,T),nA:N,nB:P,reliable:N>=y&&P>=y,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function h(S){const T=S.length;if(T===0)return Number.NaN;const O=T>>1;return T%2?S[O]:(S[O-1]+S[O])/2}function w(S,T,O){const N=S.length,P=T.length,C=N*P;if(C===0||C>r)return null;const B=new Float64Array(C);let x=0;for(let ee=0;ee<N;ee++)for(let te=0;te<P;te++)B[x++]=S[ee]-T[te];B.sort();const V=h(B),Y=Math.sqrt(N*P*(N+P+1)/12),F=d(1-(1-O)/2);let $=Math.round(C/2-F*Y);$>=0||($=0);const q=Math.floor((C-1)/2);return $>q&&($=q),{estimate:V,lower:B[$],upper:B[C-1-$],confidence:O,method:"hodges-lehmann (normal approximation)"}}function v(S,T,O){const N=S.length,P=T.length;if(N<1||P<1)return null;const C=f(O),B=N+P,x=new Array(B);for(let ie=0;ie<N;ie++)x[ie]={v:S[ie],g:0};for(let ie=0;ie<P;ie++)x[N+ie]={v:T[ie],g:1};x.sort((ie,ue)=>ie.v-ue.v);let V=0,Y=0,F=0;for(;F<B;){let ie=F;for(;ie<B&&x[ie].v===x[F].v;)ie++;const ue=ie-F,Ae=(F+1+ie)/2;for(let de=F;de<ie;de++)x[de].g===0&&(V+=Ae);Y+=ue*ue*ue-ue,F=ie}const $=V-N*(N+1)/2,q=N*P/2,ee=N*P/12*(B+1-Y/(B*(B-1)));let te=1;if(ee>0){const ie=Math.max(0,Math.abs($-q)-.5);te=Math.min(1,2*c(-ie/Math.sqrt(ee)))}const re=w(S,T,C);return{test:p.MANN_WHITNEY,statistic:$,statisticName:"U",df:null,pValue:te,interval:re,effectSize:b(S,T),nA:N,nB:P,reliable:N>=y&&P>=y,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function A(S,T,O,N,P){const C=k(S,T,P),B=k(O,N,P);if(!C||!B)return null;const x=C.proportion-B.proportion,V=x-Math.sqrt((C.proportion-C.lower)**2+(B.upper-B.proportion)**2),Y=x+Math.sqrt((C.upper-C.proportion)**2+(B.proportion-B.lower)**2);return{lower:V,upper:Y}}function H(S,T,O,N,P,C={}){if(!(T>0)||!(N>0))return null;const B=new Set([...S.keys(),...O.keys()]),x=B.size;if(x<2)return null;const V=T+N;let Y=0;for(const te of B){const re=S.get(te)||0,ie=O.get(te)||0,ue=re+ie,Ae=T*ue/V,de=N*ue/V;Ae>0&&(Y+=(re-Ae)*(re-Ae)/Ae),de>0&&(Y+=(ie-de)*(ie-de)/de)}const F=x-1,$=n(Y,F);let q=null;C.category!==void 0&&B.has(C.category)?q=C.category:x===2&&([q]=[...B]);let ee=null;if(q!==null){const te=A(S.get(q)||0,T,O.get(q)||0,N,f(P));te&&(ee={estimate:(S.get(q)||0)/T-(O.get(q)||0)/N,lower:te.lower,upper:te.upper,confidence:f(P),method:"newcombe (difference in this category's share)",category:q})}return{test:p.CHI_SQUARE,statistic:Y,statisticName:"chiSquare",df:F,pValue:$,interval:ee,effectSize:{name:"categoricalTotalVariation",value:X(S,T,O,N)},nA:T,nB:N,reliable:T>=y&&N>=y,method:"Pearson chi-square test of independence (2×k, no continuity correction)"}}function G(S){return S==null||S===""||typeof S=="number"&&Number.isNaN(S)?null:S instanceof Date?S.getTime():typeof S=="object"?String(S):S}function Z(S,T,O){if(O===p.WELCH||O===p.MANN_WHITNEY)return{test:O,chosenBy:"override",reason:`caller override: ${O}`};const N=j(S),P=j(T),C=N===null?null:Math.exp(-N/2),B=P===null?null:Math.exp(-P/2);return C!==null&&C<i||B!==null&&B<i?{test:p.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${i})`}:{test:p.WELCH,chosenBy:"auto",reason:C!==null||B!==null?"column family: numeric, no departure from normality detected":"column family: numeric (too few rows to screen normality)"}}function M(S,T,O,N={}){if(!S||!T)return null;const P=f(N.confidence),C=U(T);let B;if(Array.isArray(N.groups)&&N.groups.length===2)B=[G(N.groups[0]),G(N.groups[1])];else{const{map:ie}=L(T,O),ue=[...ie.entries()].sort((Ae,de)=>de[1]-Ae[1]).slice(0,2).map(Ae=>Ae[0]);if(ue.length<2)return E("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;B=ue}const[x,V]=B;if(x===null||V===null||x===V)return E("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const Y=[],F=[];for(let ie=0;ie<O.length;ie++){const ue=G(C(O[ie]));ue===x?Y.push(O[ie]):ue===V&&F.push(O[ie])}if(Y.length===0||F.length===0)return E("compareGroups:empty","[lattice] compareGroups: one of the two groups has no rows in the current set."),null;const $=N.test&&N.test!=="auto"?String(N.test):null,q=I(S,Y.concat(F));let ee,te,re;if($===p.CHI_SQUARE||!$&&!q){te=$?"override":"auto",re=$?"caller override: chiSquare":"column family: categorical";const ie=L(S,Y),ue=L(S,F);ee=H(ie.map,ie.total,ue.map,ue.total,P,{category:N.category})}else{if(($===p.WELCH||$===p.MANN_WHITNEY)&&!q)return E("compareGroups:numeric-override",`[lattice] compareGroups: ${$} needs a numeric column, but the column is not numeric.`),null;const ie=J(S,Y),ue=J(S,F),Ae=Z(ie,ue,$);te=Ae.chosenBy,re=Ae.reason,ee=Ae.test===p.MANN_WHITNEY?v(ie,ue,P):a(ie,ue,P)}return ee?{...ee,chosenBy:te,reason:re,groups:[x,V]}:(E("compareGroups:degenerate","[lattice] compareGroups: the chosen test had too little to work with (too few values, or no variation)."),null)}}),ze("packages/core/src/compute/significance.js",function(e,_){"use strict";Object.defineProperty(e,"COMPARE_TESTS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"compare",{enumerable:!0,get:function(){return Oe}});const E=_("packages/core/src/internal/warn.js").warnOnce,U=_("packages/core/src/compute/handle.js").valueReader,D=_("packages/core/src/compute/statistics.js"),J=D.numbers,z=D.moments,L=D.frequencyMap,X=D.isNumericColumn,I=D.jarqueBera,j=D.proportionInterval,k=_("packages/core/src/compute/special.js"),y=k.studentT,l=k.studentTQuantile,g=k.normalCdf,s=k.normalQuantile,t=k.chiSquareUpperTail,o=k.incompleteBeta,c=Object.freeze({T:"t",WELCH:"welch",MANN_WHITNEY:"mannWhitney",ANOVA:"anova",KRUSKAL:"kruskal",CHI_SQUARE:"chiSquare",PROPORTIONS:"proportions"}),d=new Set([c.T,c.WELCH,c.MANN_WHITNEY]),n=new Set([c.ANOVA,c.KRUSKAL]),p=new Set([c.CHI_SQUARE,c.PROPORTIONS]),i=.05,r=[.2,.5,.8],f=[.147,.33,.474],m=[.01,.06,.14],u=[[.1,.3,.5],[.07,.21,.35],[.06,.17,.29],[.05,.15,.25]];function b(pe){const ae=Number(pe);return Number.isFinite(ae)&&ae>0&&ae<1?ae:.05}function a(pe){return pe==null||pe===""||typeof pe=="number"&&Number.isNaN(pe)?null:pe instanceof Date?pe.getTime():typeof pe=="object"?String(pe):pe}function h(pe,ae){const ge=U(pe),ve=[],le=new Map;for(let we=0;we<ae.length;we++){const he=a(ge(ae[we]));if(he===null)continue;let be=le.get(he);be||(be={value:he,rows:[]},le.set(he,be),ve.push(be)),be.rows.push(ae[we])}return ve}function w(pe){const{n:ae,mean:ge,m2:ve}=z(pe),le=ae>1?ve/(ae-1):0;return{n:ae,mean:ge,sd:Math.sqrt(le),variance:le}}function v(pe,ae,ge){if(!(ae>0)||!(ge>0)||!(pe>=0)||!Number.isFinite(pe))return Number.NaN;if(pe===0)return 1;const ve=ae*pe/(ae*pe+ge);return 1-o(ae/2,ge/2,ve)}function A(pe,ae){const ge=Math.abs(pe);return Number.isFinite(ge)?ge>=ae[2]?"large":ge>=ae[1]?"medium":ge>=ae[0]?"small":"negligible":"negligible"}function H(pe,ae,ge){if(pe==="cohensD")return A(ae,r);if(pe==="cliffsDelta")return A(ae,f);if(pe==="etaSquared")return A(ae,m);const ve=Math.max(1,Math.min(u.length,Math.floor(ge||1)));return A(ae,u[ve-1])}function G(pe,ae){if(!(pe.n>1)||!(ae.n>1))return null;const ge=((pe.n-1)*pe.variance+(ae.n-1)*ae.variance)/(pe.n+ae.n-2);return ge>0?(pe.mean-ae.mean)/Math.sqrt(ge):null}function Z(pe,ae){const ge=pe.length,ve=ae.length;if(!ge||!ve)return null;const le=Array.from(ae).sort((be,Te)=>be-Te);let we=0,he=0;for(let be=0;be<ge;be++){const Te=pe[be];let je=0,ke=ve;for(;je<ke;){const He=je+ke>>1;le[He]<Te?je=He+1:ke=He}const Ue=je;let Re=je;for(;Re<ve&&le[Re]===Te;)Re++;const Ee=Re-je;we+=Ue,he+=ve-Re}return(we-he)/(ge*ve)}function M(pe,ae,ge,ve){const le=Math.min(ge-1,ve-1);return!(ae>0)||!(le>0)?null:Math.sqrt(pe/(ae*le))}function S(pe){return Number.isFinite(pe)?pe<.001?"p < 0.001":pe>=.995?"p > 0.995":`p = ${pe.toFixed(3)}`:"p = —"}function T(pe){if(!Number.isFinite(pe))return"0";const ae=Math.abs(pe);return ae===0?"0":ae>=1e3?String(Math.round(pe)):ae>=100?String(Number(pe.toFixed(0))):ae>=10?String(Number(pe.toFixed(1))):ae>=1?String(Number(pe.toFixed(2))):String(Number(pe.toPrecision(2)))}const O=new Set(["cohensD","cliffsDelta"]);function N(pe){if(pe.difference!=null&&Math.abs(pe.difference)>=1e-12)return Math.sign(pe.difference);const ae=pe.effectSize;if(ae&&O.has(ae.name)&&Number.isFinite(ae.value)&&Math.abs(ae.value)>=1e-12)return Math.sign(ae.value);const[ge,ve]=pe.groups;return Number.isFinite(ge.mean)&&Number.isFinite(ve.mean)&&ge.mean!==ve.mean?Math.sign(ge.mean-ve.mean):0}function P(pe){const ae=pe.measureName||"values";return{subject:ae.charAt(0).toUpperCase()+ae.slice(1),be:ae==="values"?"are":"is",name:ae}}function C(pe,ae){const ge=ae.unit?` ${ae.unit}`:"",{subject:ve,be:le}=P(ae),we=pe.groups[0].label,he=pe.groups[1].label,be=pe.effectSize?pe.effectSize.label:"negligible",Te=pe.pValue<pe.alpha,je=Te?"unlikely to be chance":"consistent with chance";if(!Te&&be==="negligible")return`${ve} ${le} essentially the same for ${we} and ${he} (${S(pe.pValue)}); the effect is ${be}.`;const ke=N(pe),Ue=`the difference is ${je} (${S(pe.pValue)}) and the effect is ${be}.`;if(ke===0)return`${ve} ${le} different between ${we} and ${he}; ${Ue}`;const Re=ke>0?we:he,Ee=ke>0?he:we,Ke=pe.difference!=null&&Math.abs(pe.difference)>=1e-12?` by about ${T(Math.abs(pe.difference))}${ge}`:"";return`${ve} ${le} higher for ${Re} than for ${Ee}${Ke}; ${Ue}`}function B(pe,ae){const{name:ge}=P(ae),ve=pe.effectSize?pe.effectSize.label:"negligible",le=S(pe.pValue);return pe.pValue<pe.alpha?`The groups differ in ${ge}; the difference is unlikely to be chance (${le}) and the effect is ${ve}.`:ve==="negligible"?`The groups are essentially the same in ${ge} (${le}); the effect is ${ve}.`:`The groups show a ${ve} effect in ${ge}, but the difference is consistent with chance (${le}).`}function x(pe,ae){const ge=pe.length;if(ge<2)return null;const{mean:ve,m2:le}=z(pe),we=le/(ge-1);if(!(we>0))return null;const he=Math.sqrt(we),be=he/Math.sqrt(ge),Te=ve/be,je=ge-1,ke=Math.min(1,Math.max(0,2*(1-y(Math.abs(Te),je)))),Ue=l(1-ae/2,je)*be,Re=ve/he;return{test:c.T,statistic:Te,statisticName:"t",df:je,pValue:ke,difference:ve,interval:{estimate:ve,lower:ve-Ue,upper:ve+Ue,confidence:1-ae,method:"paired-t (mean of the pair differences)"},effectSize:{name:"cohensD",label:A(Re,r),value:Re}}}function V(pe,ae){const ge=Array.from(pe).filter(Ke=>Ke!==0),ve=ge.length;if(!ve)return null;const le=Array.from({length:ve},(Ke,We)=>We).sort((Ke,We)=>Math.abs(ge[Ke])-Math.abs(ge[We])),we=new Array(ve);let he=0;for(;he<ve;){let Ke=he;for(;Ke+1<ve&&Math.abs(ge[le[Ke+1]])===Math.abs(ge[le[he]]);)Ke++;const We=(he+Ke)/2+1;for(let qe=he;qe<=Ke;qe++)we[le[qe]]=We;he=Ke+1}let be=0,Te=0;for(let Ke=0;Ke<ve;Ke++)Te+=we[Ke],ge[Ke]>0&&(be+=we[Ke]);const je=Te-be,ke=ve*(ve+1)/4,Ue=Math.sqrt(ve*(ve+1)*(2*ve+1)/24),Re=Ue>0?(Math.abs(be-ke)-.5)/Ue:0,Ee=Math.min(1,Math.max(0,2*g(-Math.max(0,Re)))),He=Te>0?(be-je)/Te:0;return{test:c.MANN_WHITNEY,statistic:be,statisticName:"W",df:null,pValue:Ee,difference:null,interval:null,effectSize:{name:"cliffsDelta",label:A(He,f),value:He}}}function Y(pe,ae,ge){const ve=w(pe),le=w(ae);if(ve.n<2||le.n<2)return null;const we=((ve.n-1)*ve.variance+(le.n-1)*le.variance)/(ve.n+le.n-2);if(!(we>0))return null;const he=Math.sqrt(we*(1/ve.n+1/le.n)),be=(ve.mean-le.mean)/he,Te=ve.n+le.n-2,je=Math.min(1,Math.max(0,2*(1-y(Math.abs(be),Te)))),ke=ve.mean-le.mean,Ue=l(1-ge/2,Te)*he,Re=G(ve,le);return{test:c.T,statistic:be,statisticName:"t",df:Te,pValue:je,difference:ke,interval:{estimate:ke,lower:ke-Ue,upper:ke+Ue,confidence:1-ge,method:"student-t (pooled variance, difference of means)"},effectSize:{name:"cohensD",label:A(Re,r),value:Re},summaries:[ve,le]}}function F(pe,ae,ge){const ve=w(pe),le=w(ae);if(ve.n<2||le.n<2)return null;const we=ve.variance/ve.n+le.variance/le.n;if(!(we>0))return null;const he=Math.sqrt(we),be=(ve.mean-le.mean)/he,Te=ve.variance/ve.n*(ve.variance/ve.n)/(ve.n-1),je=le.variance/le.n*(le.variance/le.n)/(le.n-1),ke=we*we/(Te+je),Ue=Math.min(1,Math.max(0,2*(1-y(Math.abs(be),ke)))),Re=ve.mean-le.mean,Ee=l(1-ge/2,ke)*he,He=G(ve,le);return{test:c.WELCH,statistic:be,statisticName:"t",df:ke,pValue:Ue,difference:Re,interval:{estimate:Re,lower:Re-Ee,upper:Re+Ee,confidence:1-ge,method:"welch-t (unequal variances, difference of means)"},effectSize:{name:"cohensD",label:A(He,r),value:He},summaries:[ve,le]}}function $(pe,ae,ge){const ve=pe.length,le=ae.length;if(ve<1||le<1)return null;const we=w(pe),he=w(ae),be=ve+le,Te=new Array(be);for(let qe=0;qe<ve;qe++)Te[qe]={v:pe[qe],g:0};for(let qe=0;qe<le;qe++)Te[ve+qe]={v:ae[qe],g:1};Te.sort((qe,et)=>qe.v-et.v);let je=0,ke=0,Ue=0;for(;Ue<be;){let qe=Ue;for(;qe<be&&Te[qe].v===Te[Ue].v;)qe++;const et=(Ue+1+qe)/2;for(let lt=Ue;lt<qe;lt++)Te[lt].g===0&&(je+=et);const dt=qe-Ue;ke+=dt*dt*dt-dt,Ue=qe}const Re=je-ve*(ve+1)/2,Ee=ve*le/2,He=ve*le/12*(be+1-ke/(be*(be-1)));let Ke=1;if(He>0){const qe=Math.max(0,Math.abs(Re-Ee)-.5);Ke=Math.min(1,2*g(-qe/Math.sqrt(He)))}const We=Z(pe,ae);return{test:c.MANN_WHITNEY,statistic:Re,statisticName:"U",df:null,pValue:Ke,difference:null,interval:q(pe,ae,1-ge),effectSize:{name:"cliffsDelta",label:A(We,f),value:We},summaries:[we,he]}}function q(pe,ae,ge){const ve=pe.length,le=ae.length,we=ve*le;if(we===0||we>2e6)return null;const he=new Float64Array(we);let be=0;for(let He=0;He<ve;He++)for(let Ke=0;Ke<le;Ke++)he[be++]=pe[He]-ae[Ke];he.sort();const Te=we>>1,je=we%2?he[Te]:(he[Te-1]+he[Te])/2,ke=Math.sqrt(ve*le*(ve+le+1)/12),Ue=s(1-(1-ge)/2);let Re=Math.round(we/2-Ue*ke);Re>=0||(Re=0);const Ee=Math.floor((we-1)/2);return Re>Ee&&(Re=Ee),{estimate:je,lower:he[Re],upper:he[we-1-Re],confidence:ge,method:"hodges-lehmann (location shift)"}}function ee(pe,ae){const ge=pe.length,ve=pe.map(w);if(ve.some(Ke=>Ke.n<2))return null;const le=ve.reduce((Ke,We)=>Ke+We.n,0),we=ve.reduce((Ke,We)=>Ke+We.mean*We.n,0)/le;let he=0,be=0;for(let Ke=0;Ke<ge;Ke++)he+=ve[Ke].n*(ve[Ke].mean-we)**2,be+=(ve[Ke].n-1)*ve[Ke].variance;const Te=ge-1,je=le-ge;if(!(be>0)||je<1)return null;const ke=he/Te,Ue=be/je,Re=ke/Ue,Ee=Math.min(1,Math.max(0,v(Re,Te,je))),He=he/(he+be);return{test:c.ANOVA,statistic:Re,statisticName:"F",df:{between:Te,within:je},pValue:Ee,difference:null,interval:null,effectSize:{name:"etaSquared",label:A(He,m),value:He},summaries:ve}}function te(pe,ae){const ge=pe.length,ve=pe.map(w);if(ge<2)return null;const le=ve.reduce((We,qe)=>We+qe.n,0),we=[];for(let We=0;We<ge;We++)for(let qe=0;qe<pe[We].length;qe++)we.push({v:pe[We][qe],g:We});we.sort((We,qe)=>We.v-qe.v);const he=new Array(we.length);let be=0,Te=0;for(;Te<we.length;){let We=Te;for(;We<we.length&&we[We].v===we[Te].v;)We++;const qe=(Te+1+We)/2;for(let dt=Te;dt<We;dt++)he[dt]=qe;const et=We-Te;be+=et*et*et-et,Te=We}const je=new Array(ge).fill(0);for(let We=0;We<we.length;We++)je[we[We].g]+=he[We];let ke=0;for(let We=0;We<ge;We++)ke+=je[We]*je[We]/ve[We].n;ke=12/(le*(le+1))*ke-3*(le+1);const Ue=1-be/(le*le*le-le),Re=Ue>0?ke/Ue:ke,Ee=ge-1,He=Math.min(1,Math.max(0,t(Re,Ee))),Ke=(Re-ge+1)/(le-ge);return{test:c.KRUSKAL,statistic:Re,statisticName:"H",df:Ee,pValue:He,difference:null,interval:null,effectSize:{name:"etaSquared",label:A(Ke,m),value:Math.max(0,Ke)},summaries:ve}}function re(pe,ae,ge,ve,le){const we=j(pe,ae,le),he=j(ge,ve,le);if(!we||!he)return null;const be=we.proportion-he.proportion,Te=be-Math.sqrt((we.proportion-we.lower)**2+(he.upper-he.proportion)**2),je=be+Math.sqrt((we.upper-we.proportion)**2+(he.proportion-he.lower)**2);return{estimate:be,lower:Te,upper:je}}function ie(pe,ae,ge,ve){const le=U(ae),we=new Set,he=[];for(const qe of pe){const et=new Map;let dt=0;for(const lt of qe.rows){const vt=a(le(lt));vt!==null&&(et.set(vt,(et.get(vt)||0)+1),dt++,we.add(vt))}he.push(et),qe.total=dt}const be=[...we];if(be.length<2)return null;const Te=pe.reduce((qe,et)=>qe+et.total,0);if(!(Te>0))return null;let je=0;for(const qe of pe)for(const et of be){const dt=he[pe.indexOf(qe)].get(et)||0,lt=pe.reduce((Pt,$t)=>Pt+(he[pe.indexOf($t)].get(et)||0),0),vt=qe.total*lt/Te;vt>0&&(je+=(dt-vt)*(dt-vt)/vt)}const ke=pe.length,Ue=be.length,Re=(ke-1)*(Ue-1),Ee=Math.min(1,Math.max(0,t(je,Re))),He=M(je,Te,ke,Ue);let Ke=null;if(ke===2&&Ue===2){const[qe]=be,et=he[0].get(qe)||0,dt=he[1].get(qe)||0,lt=re(et,pe[0].total,dt,pe[1].total,ve);lt&&(Ke={...lt,confidence:ve,method:"newcombe (difference in this category's share)",category:qe})}const We=pe.map((qe,et)=>{const dt={};for(const lt of be)dt[String(lt)]=(he[et].get(lt)||0)/qe.total;return dt});return{test:c.CHI_SQUARE,statistic:je,statisticName:"chiSquare",df:Re,pValue:Ee,difference:null,interval:Ke,effectSize:{name:"cramersV",label:H("cramersV",He,Math.min(ke-1,Ue-1)),value:He},proportions:We}}function ue(pe,ae,ge,ve){const le=U(ae),we=new Set;for(const lt of pe)for(const vt of lt.rows){const Pt=a(le(vt));Pt!==null&&we.add(Pt)}if(we.size!==2)return null;const[he]=[...we],be=pe[0].rows.reduce((lt,vt)=>lt+(a(le(vt))===he?1:0),0),Te=pe[1].rows.reduce((lt,vt)=>lt+(a(le(vt))===he?1:0),0),je=pe[0].rows.length,ke=pe[1].rows.length;if(!(je>0)||!(ke>0))return null;const Ue=be/je,Re=Te/ke,Ee=(be+Te)/(je+ke);if(!(Ee>0)||!(Ee<1))return null;const He=Math.sqrt(Ee*(1-Ee)*(1/je+1/ke)),Ke=(Ue-Re)/He,We=Math.min(1,Math.max(0,2*g(-Math.abs(Ke)))),qe=Ue-Re,et=re(be,je,Te,ke,ve),dt=M(Ke*Ke,je+ke,2,2);return{test:c.PROPORTIONS,statistic:Ke,statisticName:"z",df:null,pValue:We,difference:qe,interval:et?{...et,confidence:ve,method:"newcombe (difference in proportions)",category:he}:null,effectSize:{name:"cramersV",label:H("cramersV",dt,1),value:dt},proportions:[{[String(he)]:Ue},{[String(he)]:Re}],focalCategory:he}}function Ae(pe,ae,ge,ve){if(ge&&d.has(ge))return{test:ge,reason:`caller override: ${ge}`};const le=I(pe),we=I(ae),he=le===null?null:Math.exp(-le/2),be=we===null?null:Math.exp(-we/2);if(he!==null&&he<i||be!==null&&be<i)return{test:c.MANN_WHITNEY,reason:"two numeric groups, non-normal by Jarque-Bera"};const Te=w(pe),je=w(ae);if(Te.n>=3&&je.n>=3&&Te.variance>0&&je.variance>0){const ke=Math.max(Te.variance,je.variance)/Math.min(Te.variance,je.variance),Ue=Te.variance>=je.variance?Te.n-1:je.n-1,Re=Te.variance>=je.variance?je.n-1:Te.n-1;if(2*Math.min(v(ke,Ue,Re),1-v(ke,Ue,Re))<ve)return{test:c.WELCH,reason:"two numeric groups, unequal variances (F-test)"}}return{test:c.T,reason:he!==null||be!==null?"two numeric groups, equal variances and no departure from normality":"two numeric groups (too few rows to screen normality)"}}function de(pe,ae){if(ae&&n.has(ae))return{test:ae,reason:`caller override: ${ae}`};for(const ge of pe){const ve=I(ge),le=ve===null?null:Math.exp(-ve/2);if(le!==null&&le<i)return{test:c.KRUSKAL,reason:"three or more numeric groups, non-normal by Jarque-Bera"}}return{test:c.ANOVA,reason:"three or more numeric groups, no departure from normality detected"}}function Oe(pe,ae,ge,ve={},le=null){if(!pe||!ae)return null;const we=b(ve.alpha),he=1-we,be=ve.test&&ve.test!=="auto"?String(ve.test):null,Te=h(ae,ge);if(Te.length<2)return E("compare:groups",'[lattice] statistics.compare: the "by" column has fewer than two distinct values to group by.'),null;let je;if(Array.isArray(ve.groups)&&ve.groups.length===2){const et=[a(ve.groups[0]),a(ve.groups[1])];if(et[0]===null||et[1]===null||et[0]===et[1])return E("compare:distinct","[lattice] statistics.compare: the two groups must be two distinct, present values."),null;if(je=Te.filter(dt=>dt.value===et[0]||dt.value===et[1]),je.length!==2)return E("compare:empty","[lattice] statistics.compare: one of the two groups has no rows in the current set."),null;je.sort((dt,lt)=>dt.value===et[0]?-1:1)}else Te.length===2||be&&d.has(be)||be&&p.has(be)?je=Te.slice(0,2):(be&&n.has(be),je=Te);const Ue=X(pe,ge),Re=!!ve.paired&&le&&je.length===2&&Ue;let Ee,He,Ke;if(Ue)if(je.length===2&&!(be&&n.has(be))){const et=J(pe,je[0].rows),dt=J(pe,je[1].rows);if(et.length<3||dt.length<3)return E("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;if(w(et).variance===0||w(dt).variance===0)return E("compare:zero-variance","[lattice] statistics.compare: a group has zero variance, so the difference has no scale to test."),null;if(Re){const vt=Fe(pe,le,je[0].rows,je[1].rows);return vt?(He=be?"override":"auto",Ke=be?`caller override: ${be} (paired)`:"two numeric groups, paired",Ee=be===c.MANN_WHITNEY?V(vt.diffs,we):x(vt.diffs,we),Ee?(Ee.paired=!0,Ee.chosenBy=He,Ee.reason=Ke,Ee.groups=[{value:je[0].value,label:String(je[0].value),n:vt.n},{value:je[1].value,label:String(je[1].value),n:vt.n}],Ee.alpha=we,Ee.method=Ee.test===c.MANN_WHITNEY?"Wilcoxon signed-rank test (paired)":"Student's paired t-test (difference of pairs)",Ee.verdict=C(Ee,ve),Ee.categorical=!1,Ee):(E("compare:degenerate","[lattice] statistics.compare: the paired test had too little to work with."),null)):(E("compare:paired","[lattice] statistics.compare: not enough matched pairs to run a paired test."),null)}const lt=Ae(et,dt,be,we);He=be?"override":"auto",Ke=lt.reason,lt.test===c.MANN_WHITNEY?Ee=$(et,dt,we):lt.test===c.WELCH?Ee=F(et,dt,we):Ee=Y(et,dt,we),Ee&&Ee.interval&&Ee.difference===null&&(Ee.difference=Ee.interval.estimate)}else{const et=je.map(lt=>J(pe,lt.rows));if(et.some(lt=>lt.length<3))return E("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;const dt=de(et,be);He=be?"override":"auto",Ke=dt.reason,Ee=dt.test===c.KRUSKAL?te(et,we):ee(et,we)}else if(je.length===2){const et=Me(pe,je).size===2;if(be===c.PROPORTIONS||et&&!be)He=be?"override":"auto",Ke=be?"caller override: proportions":"categorical measure with two categories (binary)",Ee=ue(je,pe,we,he);else if(be===c.CHI_SQUARE||!et&&!be)He=be?"override":"auto",Ke=be?"caller override: chiSquare":`categorical measure with ${Me(pe,je).size} categories`,Ee=ie(je,pe,we,he);else return E("compare:numeric-needed",`[lattice] statistics.compare: ${be} needs a numeric measure, but the column is categorical.`),null}else He=be?"override":"auto",Ke=be?`caller override: ${be}`:`categorical measure with ${Me(pe,je).size} categories`,Ee=ie(je,pe,we,he);if(!Ee)return E("compare:degenerate","[lattice] statistics.compare: the chosen test had too little to work with (too few values, or no variation)."),null;const We=Ee.summaries,qe=Ee.proportions;return{test:Ee.test,chosenBy:He,reason:Ke,statistic:Ee.statistic,statisticName:Ee.statisticName,df:Ee.df===void 0?null:Ee.df,pValue:Ee.pValue,alpha:we,paired:!1,interval:Ee.interval||null,effectSize:Ee.effectSize,groups:je.map((et,dt)=>({value:et.value,label:String(et.value),n:We?We[dt].n:et.total,...We?{mean:We[dt].mean,sd:We[dt].sd}:{},...qe?{proportions:qe[dt]}:{}})),difference:Ee.difference===void 0?null:Ee.difference,method:Ee.test,categorical:!Ue,verdict:je.length===2?C({...Ee,alpha:we,groups:[{value:je[0].value,label:String(je[0].value),mean:We?We[0].mean:void 0},{value:je[1].value,label:String(je[1].value),mean:We?We[1].mean:void 0}],categorical:!Ue,difference:Ee.difference===void 0?null:Ee.difference},ve):B({...Ee,alpha:we},ve)}}function Me(pe,ae){const ge=U(pe),ve=new Set;for(const le of ae)for(const we of le.rows){const he=a(ge(we));he!==null&&ve.add(he)}return ve}function Fe(pe,ae,ge,ve){const le=U(ae),we=U(pe),he=new Map;for(const Te of ve){const je=a(le(Te));je!==null&&he.set(je,we(Te))}const be=[];for(const Te of ge){const je=a(le(Te));if(je===null||!he.has(je))continue;const ke=Number(we(Te)),Ue=Number(he.get(je));!Number.isFinite(ke)||!Number.isFinite(Ue)||be.push(ke-Ue)}return be.length<2?null:{diffs:Float64Array.from(be),n:be.length}}}),ze("packages/core/src/columns/detailcolumn.js",function(e,_){"use strict";Object.defineProperty(e,"DETAIL_COLUMN_ID",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"createDetailColumn",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return U}});const ne="__lattice_detail",E=36;function K(D){const J=D.config&&D.config.detailColumnWidth||E;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:J,min:J,max:J,pin:D.config&&D.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(z,L){return!!(L&&L.expanded)},formatValue(){return""}}}const U=K}),ze("packages/core/src/columns/treecolumn.js",function(e,_){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createTreeColumn",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return J}});const E=_("packages/core/src/internal/predicates.js").isFunction,K="__lattice_tree",U=260;function D(z){const L=z.tree||{},X=z.config&&z.config.treeColumnWidth||U,I=!!(z.config&&z.config.treeColumnFlex),j=()=>(z.columns&&E(z.columns.visible)?z.columns.visible():[]).find(g=>!g.generated)||null,k=(l,g)=>{if(g&&g.group)return g.groupValue;if(E(L.label))return L.label(l,g);if(typeof L.label=="string")return l==null?null:l[L.label];const s=j();return s&&E(s.getValue)?s.getValue(l,g):null},y=()=>{if(L.title)return L.title;const l=typeof L.label=="string"?z.columns&&E(z.columns.get)?z.columns.get(L.label):null:j();return l&&(l.title||l.id)||"Hierarchy"};return{id:K,get title(){return y()},field:null,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group",props:{icon:L.icon,iconClass:L.iconClass,content:L.content,checkbox:L.checkbox,onCheck:L.onCheck}},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:I?{flex:1,min:0,pin:z.config&&z.config.treeColumnPin||null,hidden:!1,resizable:!1,movable:!1,lockPosition:!0}:{width:X,min:140,pin:z.config&&z.config.treeColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(l,g){return k(l,g)},formatValue(l,g){if(g&&g.grandTotal)return z.config&&z.config.grandTotalLabel||"Total";if(l==null)return"";if(!L.label){const s=j();if(s&&E(s.formatValue))return s.formatValue(l,g)}return String(l)}}}const J=D}),ze("packages/core/src/columns/pivotcolumns.js",function(e,_){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return D}});const E=_("packages/core/src/internal/warn.js").warnOnce,K="__lattice_pivot",U=500;function D(X){const{pivot:I,valueColumns:j,config:k}=X,y=I&&I.paths||[],l=X.separator||k&&k.pivot&&k.pivot.separator||" | ",g=k&&k.pivot&&k.pivot.maxColumns||U;if(!y.length||!j.length)return{tree:[],leaves:[],error:null};const s=J(k),t=y.length*j.length+(s?j.length:0);if(t>g){const d=`pivot would generate ${t} columns, above the limit of ${g}. Pivot on a lower-cardinality column, or raise pivot.maxColumns.`;return E(`pivot.maxColumns:${t}`,d),{tree:[],leaves:[],error:d}}const o=[],c=[];for(const d of y){const n=[];for(const p of j){const i=L(d,p,l);n.push(i),c.push(i)}n.length===1?(n[0].title=String(d),o.push(n[0])):o.push({id:`${K}:group:${d}`,title:String(d),columns:n,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(s){const d=j.map(p=>z(p,k));c.push(...d);const n=k&&k.pivot&&k.pivot.totalsLabel||"Total";if(d.length===1)d[0].title=n,s==="before"?o.unshift(d[0]):o.push(d[0]);else{const p={id:`${K}:group:__totals`,title:n,columns:d,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};s==="before"?o.unshift(p):o.push(p)}}return{tree:o,leaves:c,error:null}}function J(X){const I=X&&X.pivot&&X.pivot.groupTotals;return I==="before"||I==="after"?I:null}function z(X,I){return{id:`${K}:__total${I&&I.pivot&&I.pivot.separator||" | "}${X.id}`,field:null,title:X.title||X.id,type:X.type,dataType:X.dataType,nullable:!0,align:X.align,generated:!0,pivot:{enabled:!1,index:0,sourceId:X.id,total:!0},value:{pure:!0},cell:{align:X.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:X.total,lookup:null,layout:{width:X.layout&&X.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(j,k){const y=k&&k.totals;return y&&Object.hasOwn(y,X.id)?y[X.id]:null},formatValue(j,k){return j==null?"":X.formatValue?X.formatValue(j,k):String(j)}}}function L(X,I,j){return{id:`${K}:${X}${j}${I.id}`,field:null,title:I.title||I.id,type:I.type,dataType:I.dataType,nullable:!0,align:I.align,generated:!0,pivot:{enabled:!1,index:0,path:X,sourceId:I.id},value:{pure:!0},cell:{align:I.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:I.total,lookup:null,layout:{width:I.layout&&I.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(){return null},formatValue(k,y){return k==null?"":I.formatValue?I.formatValue(k,y):String(k)}}}}),ze("packages/core/src/compute/group.js",function(e,_){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return k}});const ne=_("packages/core/src/compute/handle.js"),E=ne.dictSize,K=ne.identity,U=ne.presenceReader,D=ne.rowCount,J=ne.valueReader,z="",L="\0",X=1<<20;function I(y,l,g,s){const t=y.length,o=y.map(r=>J(r)),c=Array.isArray(s)&&s.some(Boolean),d=c?o.map((r,f)=>s[f]?m=>s[f](r(m)):r):o;if(!c&&t>0&&y.every(r=>r&&r.kind==="dictionary"&&r.dict)){const r=y.map(m=>E(m.dict)+1);let f=1;for(let m=0;m<t;m++)f*=r[m];if(f<=Number.MAX_SAFE_INTEGER){const m=y.map(h=>h.values),u=y.map(h=>U(h)),b=h=>{let w=0;for(let v=0;v<t;v++){const A=u[v],H=A&&A(h)===0?r[v]-1:m[v][h];w=w*r[v]+H}return w},a=new Float64Array(g);for(let h=0;h<g;h++)a[h]=b(l[h]);return{packed:a,strings:null,product:f,readers:d,keyOf:b}}}const p=r=>{let f="";for(let m=0;m<t;m++){const u=d[m](r);f+=(m===0?"":z)+(u==null?L:String(u))}return f},i=new Array(g);for(let r=0;r<g;r++)i[r]=p(l[r]);return{packed:null,strings:i,product:1/0,readers:d,keyOf:p}}function j(y,l,g,s){const t=new Uint32Array(s+1);for(let n=0;n<g;n++)t[l[n]+1]++;for(let n=0;n<s;n++)t[n+1]+=t[n];const o=new Uint32Array(g),c=t.slice(0,s);for(let n=0;n<g;n++)o[c[l[n]]++]=y[n];const d=new Array(s);for(let n=0;n<s;n++)d[n]=o.subarray(t[n],t[n+1]);return d}function k(y,l,g={}){const s=y||[],t=l||K(D(s[0],g)),o=t.length;if(s.length===0||o===0)return{keys:[],buckets:[]};const{packed:c,strings:d,product:n,readers:p}=I(s,t,o,g.project),i=new Uint32Array(o);let r=0,f=null;if(c&&n<=Math.max(1024,Math.min(X,o*4))){const a=n,h=new Int32Array(a).fill(-1);for(let w=0;w<o;w++)h[c[w]]=0;for(let w=0;w<a;w++)h[w]===0&&(h[w]=r++);for(let w=0;w<o;w++)i[w]=h[c[w]];f=new Float64Array(r);for(let w=0;w<a;w++)h[w]>=0&&(f[h[w]]=w)}else if(c){const a=new Map;for(let h=0;h<o;h++){const w=c[h];let v=a.get(w);v===void 0&&(v=r++,a.set(w,v)),i[h]=v}f=new Float64Array(r);for(const[h,w]of a)f[w]=h}else{const a=new Map;for(let h=0;h<o;h++){const w=d[h];let v=a.get(w);v===void 0&&(v=r++,a.set(w,v)),i[h]=v}}const m=j(t,i,o,r),u=new Array(r);for(let a=0;a<r;a++){const h=m[a][0],w=new Array(p.length);for(let v=0;v<p.length;v++)w[v]=p[v](h);u[a]=w}const b={keys:u,buckets:m};return f&&(b.packed=f),b}}),ze("packages/core/src/compute/pivot.js",function(e,_){"use strict";Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return o}});const E=_("packages/core/src/internal/warn.js").warnOnce,U=_("packages/core/src/compute/handle.js").valueComparator,J=_("packages/core/src/compute/group.js").packKeys,L=_("packages/core/src/compute/total.js").total,X="|",I="/",j=2e3;function k(n,p,i){return`${n}${X}${p}${X}${i}`}function y(n,p){let i="";for(let r=0;r<n.length;r++){const f=n[r];i+=(r===0?"":p)+(f==null?"":String(f))}return i}function l(n,p,i={}){const r=i.separator||I,f=p.length,{keyOf:m,readers:u}=J(n,p,0),b=new Map,a=[],h=[];for(let M=0;M<f;M++){const S=p[M],T=m(S);if(b.has(T))continue;b.set(T,a.length),h.push(T);const O=new Array(u.length);for(let N=0;N<u.length;N++)O[N]=u[N](S);a.push(O)}const w=U(i.locale),v=a.map((M,S)=>S);v.sort((M,S)=>{const T=a[M],O=a[S];for(let N=0;N<T.length;N++){const P=g(T[N],O[N],w);if(P!==0)return P}return M-S});const A=new Array(v.length),H=new Array(v.length),G=new Map;for(let M=0;M<v.length;M++){const S=v[M];A[M]=a[S],H[M]=y(a[S],r),G.set(h[S],M)}return{keys:A,paths:H,idOf:M=>{const S=G.get(m(M));return S===void 0?-1:S}}}function g(n,p,i){const r=n==null,f=p==null;return r||f?r&&f?0:r?1:-1:i(n,p)}function s(n){const p=n.values||n.totals||[];if(p.length&&typeof p[0]=="object"&&p[0]!==null)return p.filter(m=>m&&m.handle);const i=typeof n.handle=="function"?n.handle:null;if(!i)return p.length&&E("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 r=typeof n.totalOf=="function"?n.totalOf:null,f=[];for(const m of p){const u=i(m);u&&f.push({colId:m,handle:u,fn:r?r(m):"sum"})}return f}function t(n,p,i){if(Array.isArray(n)){const r=i||{};return{...r,pivotHandles:n,order:p||null,groups:r.groups||null}}return n||{}}function o(n,p,i){const r=t(n,p,i),f=r.separator||I,m=s(r),u=r.maxColumns===void 0?j:r.maxColumns,b=r.groups&&r.groups.buckets?r.groups:null,a=b?b.buckets:[r.order||new Uint32Array(0)],h=r.groupPaths||(b?b.keys.map(T=>y(T,f)):[""]),w=d(a),{keys:v,paths:A,idOf:H}=l(r.pivotHandles||[],w,r),G=A.length*Math.max(1,m.length),Z=c(A,m,f);if(u&&G>u){const T=new Map;return{keys:v,paths:A,fields:Z,groupPaths:h,columns:G,values:T,cells:T,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${G} columns, above pivot.maxColumns of ${u}. Narrow the pivot columns or raise the limit.`,columns:G,maxColumns:u}}}const M=new Map,S=A.length;for(let T=0;T<a.length;T++){const O=a[T],N=h[T]===void 0?"":h[T],P=O.length;if(P===0)continue;const C=new Int32Array(P),B=new Uint32Array(S+1);for(let Y=0;Y<P;Y++){const F=H(O[Y]);C[Y]=F,F>=0&&B[F+1]++}for(let Y=0;Y<S;Y++)B[Y+1]+=B[Y];const x=new Uint32Array(P),V=B.slice(0,S);for(let Y=0;Y<P;Y++){const F=C[Y];F>=0&&(x[V[F]++]=O[Y])}for(let Y=0;Y<S;Y++){const F=B[Y],$=B[Y+1];if($===F)continue;const q=x.subarray(F,$);for(let ee=0;ee<m.length;ee++){const te=m[ee],re=L(te.handle,q,te.fn,r.totalContext||{locale:r.locale});M.set(k(N,A[Y],te.colId),re)}}}return{keys:v,paths:A,fields:Z,groupPaths:h,columns:G,values:M,cells:M,error:null}}function c(n,p,i){if(p.length===0)return n.slice();const r=[];for(const f of n)for(const m of p)r.push(`${f}${i}${m.colId}`);return r}function d(n){if(n.length===1)return n[0]||new Uint32Array(0);let p=0;for(const f of n)p+=f?f.length:0;const i=new Uint32Array(p);let r=0;for(const f of n)!f||f.length===0||(i.set(f,r),r+=f.length);return i}}),ze("packages/core/src/compute/explain.js",function(e,_){"use strict";Object.defineProperty(e,"explainContributors",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"explainChange",{enumerable:!0,get:function(){return k}});const E=_("packages/core/src/compute/total.js").total,U=_("packages/core/src/compute/group.js").groupByColumns,D=new Set(["sum","count","countValues"]),J=new Set(["min","max"]),z=new Set(["avg"]);function L(y){return typeof y=="string"?y:typeof y=="function"&&y.totalName?y.totalName:null}function X(y,l,g,s){return E(y,l,g,s||{})}function I(y,l){if(l)try{return l(y)}catch{}return y==null?"":String(y)}function j(y){const{handle:l,fn:g,leaves:s,by:t,labelOf:o,rowLabel:c}=y,d={locale:y.locale},n=s&&s.length?s:[],p=L(g),i=X(l,n,g,d),r=J.has(p);let f;if(r){let b=-1;for(let a=0;a<n.length;a++){const h=X(l,[n[a]],g,d);if(Object.is(h,i)){b=n[a];break}}f=b<0?[]:[{key:b,indices:[b],label:c?c(b):String(b)}]}else if(t){const b=U([t],n);f=b.keys.map((a,h)=>({key:a[0],indices:b.buckets[h],label:I(a[0],o)}))}else f=Array.from({length:n.length},(b,a)=>{const h=n[a];return{key:h,indices:[h],label:c?c(h):String(h)}});const m=n.length,u=[];for(const b of f){const a=X(l,b.indices,g,d),h=b.indices.length;let w,v;if(p==="avg")w=((typeof a=="number"?a:0)-(typeof i=="number"?i:0))*h,v=m?h/m:0;else if(r)w=typeof a=="number"?a:0,v=1;else{w=typeof a=="number"?a:0;const A=typeof i=="number"?i:0;v=A?w/A:0}u.push({key:b.key,label:b.label,count:h,value:a,contribution:w,share:v})}return u.sort((b,a)=>Math.abs(a.contribution)-Math.abs(b.contribution)||(b.label<a.label?-1:b.label>a.label?1:0)),{total:i,fn:p,weighted:z.has(p),single:r,contributors:u}}function k(y){const l=j({...y,leaves:y.after}),g=j({...y,leaves:y.before}),s=typeof l.total=="number"?l.total:0,t=typeof g.total=="number"?g.total:0,o=new Map;for(const n of l.contributors)o.set(n.key,n);const c=[],d=new Set;for(const n of g.contributors){d.add(n.key);const p=o.get(n.key);if(p===void 0)c.push({key:n.key,label:n.label,before:n.value,after:null,effect:-n.contribution,kind:"dropped",count:n.count});else{const i=p.contribution-n.contribution;i!==0&&c.push({key:n.key,label:n.label,before:n.value,after:p.value,effect:i,kind:"changed",count:p.count})}}for(const n of l.contributors)d.has(n.key)||c.push({key:n.key,label:n.label,before:null,after:n.value,effect:n.contribution,kind:"new",count:n.count});return c.sort((n,p)=>Math.abs(p.effect)-Math.abs(n.effect)||(n.label<p.label?-1:n.label>p.label?1:0)),{before:g.total,after:l.total,delta:s-t,weighted:l.weighted||g.weighted,single:l.single||g.single,drivers:c}}}),ze("packages/core/src/store/bitset.js",function(e,_){"use strict";Object.defineProperty(e,"Bitset",{enumerable:!0,get:function(){return E}});const ne=8;class E{static#e=new Uint8Array(256);static{for(let U=1;U<256;U++)E.#e[U]=E.#e[U>>1]+(U&1)}#t;#n;constructor(U=0){const D=Math.max(0,U|0);this.#n=D,this.#t=new Uint8Array(Math.ceil(D/ne))}get size(){return this.#n}get words(){return this.#t}get bytes(){return this.#t?this.#t.byteLength:0}get(U){return U<0||U>=this.#n?0:this.#t[U>>3]>>(U&7)&1}set(U){return U>=0&&U<this.#n&&(this.#t[U>>3]|=1<<(U&7)),this}clear(U){return U>=0&&U<this.#n&&(this.#t[U>>3]&=~(1<<(U&7))),this}assign(U,D){return D?this.set(U):this.clear(U)}fill(U=!1){return this.#t.fill(U?255:0),U&&this.#r(),this}grow(U){const D=Math.max(0,U|0);if(D<=this.#n)return this;const J=Math.ceil(D/ne);if(J>this.#t.length){const z=new Uint8Array(J);z.set(this.#t),this.#t=z}return this.#n=D,this}count(){const U=this.#t,D=E.#e;let J=0;for(let z=0;z<U.length;z++)J+=D[U[z]];return J}and(U){const D=U instanceof E?U.words:U,J=this.#t,z=Math.min(J.length,D.length);for(let L=0;L<z;L++)J[L]&=D[L];for(let L=z;L<J.length;L++)J[L]=0;return this}or(U){const D=U instanceof E?U.words:U,J=this.#t,z=Math.min(J.length,D.length);for(let L=0;L<z;L++)J[L]|=D[L];return this}not(){const U=this.#t;for(let D=0;D<U.length;D++)U[D]=~U[D]&255;return this.#r(),this}clone(){const U=new E(this.#n);return U.words.set(this.#t.subarray(0,U.words.length)),U}release(){this.#t=new Uint8Array(0),this.#n=0}#r(){const U=this.#n&7;if(U===0)return;const D=this.#n>>3;D<this.#t.length&&(this.#t[D]&=(1<<U)-1)}static from(U){const D=Array.isArray(U)?U:Array.from(U),J=new E(D.length);for(let z=0;z<D.length;z++)D[z]&&J.set(z);return J}}}),ze("packages/core/src/store/dictionary.js",function(e,_){"use strict";Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return U}});const ne=_("packages/core/src/internal/compare.js"),E=ne.collator,K=ne.defaultCompare;class U{#e;#t=new Map;#n=0;#r=null;#s=-1;#i="\0";constructor(J=[]){this.#e=[];for(let z=0;z<J.length;z++){const L=J[z];this.#t.has(L)||(this.#t.set(L,this.#e.length),this.#e.push(L))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let J=this.#e.length*8;for(let z=0;z<this.#e.length;z++){const L=this.#e[z];typeof L=="string"&&(J+=L.length*2),J+=16}return J}codeOf(J){const z=this.#t.get(J);if(z!==void 0)return z;const L=this.#e.length;return this.#e.push(J),this.#t.set(J,L),this.#n++,L}lookup(J){const z=this.#t.get(J);return z===void 0?-1:z}has(J){return this.#t.has(J)}valueOf(J){return this.#e[J]}values(){return this.#e}ranks(J){const z=J||"";if(this.#r&&this.#s===this.#n&&this.#i===z)return this.#r;const L=this.#e.length,X=new Array(L);for(let y=0;y<L;y++)X[y]=y;const I=E(J).compare,j=this.#e;X.sort((y,l)=>this.#o(j[y],j[l],I));const k=new Uint32Array(L);for(let y=0;y<L;y++)k[X[y]]=y;return this.#r=k,this.#s=this.#n,this.#i=z,k}#o(J,z,L){return typeof J=="string"&&typeof z=="string"?L(J,z):K(J,z)}}}),ze("packages/core/src/store/multivalue.js",function(e,_){"use strict";Object.defineProperty(e,"MultiValue",{enumerable:!0,get:function(){return ne}});class ne{#e;#t;#n=0;#r=0;constructor(K={}){const U=Math.max(1,K.rows??16),D=Math.max(1,K.values??U);this.#e=new Int32Array(D),this.#t=new Uint32Array(U+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(K){return K<0||K>=this.#n?0:this.#t[K+1]-this.#t[K]}at(K){return K<0||K>=this.#n?this.#e.subarray(0,0):this.#e.subarray(this.#t[K],this.#t[K+1])}has(K,U){if(K<0||K>=this.#n)return!1;const D=this.#e,J=this.#t[K+1];for(let z=this.#t[K];z<J;z++)if(D[z]===U)return!0;return!1}hasAny(K,U){for(let D=0;D<U.length;D++)if(this.has(K,U[D]))return!0;return!1}hasAll(K,U){for(let D=0;D<U.length;D++)if(!this.has(K,U[D]))return!1;return!0}hasNone(K,U){return!this.hasAny(K,U)}push(K){const U=this.#n,D=K.length;this.#s(U+1),this.#i(this.#r+D);const J=this.#r;for(let z=0;z<D;z++)this.#e[J+z]=K[z]|0;return this.#r+=D,this.#n=U+1,this.#t[U]=J,this.#t[U+1]=this.#r,U}write(K,U){if(K===this.#n){this.push(U);return}if(K<0||K>this.#n)return;const D=this.#t[K],J=this.#t[K+1],z=U.length;if(J-D===z){for(let L=0;L<z;L++)this.#e[D+L]=U[L]|0;return}this.#o(K,U)}compact(K,U,D){const J=this.#e,z=this.#t,L=this.#n,X=new Int32Array(Math.max(1,this.#r)),I=new Uint32Array(U+1);let j=0;for(let k=0;k<L;k++){if(K[k]===D)continue;const y=z[k],l=z[k+1];I[K[k]]=j;for(let g=y;g<l;g++)X[j++]=J[g];I[K[k]+1]=j}this.#e=X,this.#t=I,this.#n=U,this.#r=j}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#s(K){if(K+1<=this.#t.length)return;let U=this.#t.length-1;for(;U<K;)U=U*2||16;const D=new Uint32Array(U+1);D.set(this.#t),this.#t=D}#i(K){if(K<=this.#e.length)return;let U=this.#e.length;for(;U<K;)U=U*2||16;const D=new Int32Array(U);D.set(this.#e),this.#e=D}#o(K,U){const D=this.#e,J=this.#t,z=this.#n,L=U.length-(J[K+1]-J[K]),X=new Int32Array(Math.max(1,this.#r+L)),I=new Uint32Array(J.length);let j=0;for(let k=0;k<z;k++){if(I[k]=j,k===K)for(let y=0;y<U.length;y++)X[j++]=U[y]|0;else for(let y=J[k];y<J[k+1];y++)X[j++]=D[y];I[k+1]=j}this.#e=X,this.#t=I,this.#r=j}}}),ze("packages/core/src/compute/sort.js",function(e,_){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return S}});const ne=_("packages/core/src/compute/handle.js"),E=ne.bitReader,K=ne.dictRanks,U=ne.dictSize,D=ne.identity,J=ne.isMissing,z=ne.presenceReader,L=ne.rowCount,X=ne.valueComparator,I=ne.valueReader,j=new Uint32Array(0),k=new ArrayBuffer(8),y=new Float64Array(k),l=new Uint32Array(k),g=(y[0]=-1,(l[1]&2147483648)!==0?1:0),s=g===1?0:1;function t(O,N){y[0]=O;let P=l[g],C=l[s];(P&2147483648)!==0?(P=~P>>>0,C=~C>>>0):P=(P^2147483648)>>>0,N[0]=C,N[1]=P}function o(O,N,P,C){if(C<2)return O;const B=new Uint32Array(256*8);for(let te=0;te<C;te++){const re=N[te],ie=P[te];B[re&255]++,B[256+(re>>>8&255)]++,B[512+(re>>>16&255)]++,B[768+(re>>>24&255)]++,B[1024+(ie&255)]++,B[1280+(ie>>>8&255)]++,B[1536+(ie>>>16&255)]++,B[1792+(ie>>>24&255)]++}let x=O,V=N,Y=P,F=new Uint32Array(C),$=new Uint32Array(C),q=new Uint32Array(C);const ee=new Uint32Array(256);for(let te=0;te<8;te++){const re=te<<8,ie=(te&3)<<3,ue=te>=4;let Ae=!1;for(let Me=0;Me<256;Me++)if(B[re+Me]===C){Ae=!0;break}if(Ae)continue;let de=0;for(let Me=0;Me<256;Me++)ee[Me]=de,de+=B[re+Me];for(let Me=0;Me<C;Me++){const Fe=V[Me],pe=Y[Me],ae=(ue?pe:Fe)>>>ie&255,ge=ee[ae]++;F[ge]=x[Me],$[ge]=Fe,q[ge]=pe}let Oe=x;x=F,F=Oe,Oe=V,V=$,$=Oe,Oe=Y,Y=q,q=Oe}return x}function c(O,N,P){if(P<2)return O;const C=new Uint32Array(256*4);for(let $=0;$<P;$++){const q=N[$];C[q&255]++,C[256+(q>>>8&255)]++,C[512+(q>>>16&255)]++,C[768+(q>>>24&255)]++}let B=O,x=N,V=new Uint32Array(P),Y=new Uint32Array(P);const F=new Uint32Array(256);for(let $=0;$<4;$++){const q=$<<8,ee=$<<3;let te=!1;for(let ue=0;ue<256;ue++)if(C[q+ue]===P){te=!0;break}if(te)continue;let re=0;for(let ue=0;ue<256;ue++)F[ue]=re,re+=C[q+ue];for(let ue=0;ue<P;ue++){const Ae=x[ue],de=F[Ae>>>ee&255]++;V[de]=B[ue],Y[de]=Ae}let ie=B;B=V,V=ie,ie=x,x=Y,Y=ie}return B}function d(O,N,P,C){const B=new Uint32Array(C+1);for(let Y=0;Y<P;Y++)B[N[Y]]++;let x=0;for(let Y=0;Y<=C;Y++){const F=B[Y];B[Y]=x,x+=F}const V=new Uint32Array(P);for(let Y=0;Y<P;Y++)V[B[N[Y]]++]=O[Y];return V}function n(O,N,P,C){return P<2?O:C<=65536||C<=P*2?d(O,N,P,C):c(O,N,P)}function p(O,N){return O.length===N&&O.byteOffset===0?O:Uint32Array.prototype.slice.call(O,0,N)}function i(O,N,P=!1){const C=N||D(O.length),B=C.length;if(B<2)return Uint32Array.from(C);const x=new Uint32Array(B),V=new Uint32Array(B),Y=new Uint32Array(B),F=new Uint32Array(B),$=new Uint32Array(2);let q=0,ee=0;for(let ie=0;ie<B;ie++){const ue=C[ie],Ae=O[ue];if(Number.isNaN(Ae)){F[ee++]=ue;continue}t(Ae,$),P?(V[q]=~$[0]>>>0,Y[q]=~$[1]>>>0):(V[q]=$[0],Y[q]=$[1]),x[q++]=ue}const te=o(x.subarray(0,q),V.subarray(0,q),Y.subarray(0,q),q);if(ee===0)return p(te,q);const re=new Uint32Array(B);return re.set(te.subarray(0,q),0),re.set(F.subarray(0,ee),q),re}function r(O,N,P=!1){const C=N||D(O.length),B=C.length;if(B<2)return Uint32Array.from(C);const x=Uint32Array.from(C),V=new Uint32Array(B);for(let Y=0;Y<B;Y++){const F=(O[x[Y]]^2147483648)>>>0;V[Y]=P?~F>>>0:F}return p(c(x,V,B),B)}function f(O,N,P={}){const C=N||D(L(O,P)),B=C.length;if(B<2)return Uint32Array.from(C);const x=K(O.dict,P.locale),V=O.values,Y=z(O),F=Math.max(U(O.dict),x.length),$=F,q=Uint32Array.from(C),ee=new Uint32Array(B),te=!!P.descending;for(let re=0;re<B;re++){const ie=q[re];let ue=Y&&Y(ie)===0?$:x[V[ie]];ue===void 0&&(ue=$),ee[re]=te?$-ue:ue}return p(n(q,ee,B,F+1),B)}function m(O,N,P){const C=N.length;let B=Uint32Array.from(N);if(C<2)return B;let x=new Uint32Array(C);for(let V=1;V<C;V<<=1){for(let F=0;F<C;F+=V<<1){const $=Math.min(F+V,C),q=Math.min(F+(V<<1),C);let ee=F,te=$,re=F;for(;ee<$&&te<q;)x[re++]=P(O[B[ee]],O[B[te]])<=0?B[ee++]:B[te++];for(;ee<$;)x[re++]=B[ee++];for(;te<q;)x[re++]=B[te++]}const Y=B;B=x,x=Y}return B}function u(O,N,P){const C=E(O.values),B=N.length,x=new Uint32Array(B),V=P?1:0;let Y=0;for(let F=0;F<B;F++)C(N[F])===V&&(x[Y++]=N[F]);for(let F=0;F<B;F++)C(N[F])!==V&&(x[Y++]=N[F]);return x}function b(O,N){const P=O.values,C=O.kind;if((C==="object"||C===void 0)&&(Array.isArray(P)||ArrayBuffer.isView(P))&&!O.presence)return P;const x=I(O),V=new Array(L(O)||0);for(let Y=0;Y<N.length;Y++){const F=N[Y];V[F]=x(F)}return V}function a(O,N){for(let P=0;P<N.length;P++)if(typeof O[N[P]]!="string")return!1;return!0}function h(O,N,P,C,B){const x=O.length,V=Uint32Array.from(O);if(x<2||C<1)return V;const Y=new Uint32Array(x),F=C-1;for(let $=0;$<x;$++){const q=P[N[$]];Y[$]=B?F-q:q}return p(n(V,Y,x,C),x)}function w(O,N,P){const C=X(P),B=new Array(N);for(let V=0;V<N;V++)B[V]=V;B.sort((V,Y)=>C(O[V],O[Y])||V-Y);const x=new Uint32Array(N);for(let V=0;V<N;V++)x[B[V]]=V;return x}function v(O,N,P){const C=N.length,B=new Map,x=[],V=new Uint32Array(C);for(let $=0;$<C;$++){const q=O[N[$]];let ee=B.get(q);ee===void 0&&(ee=x.length,B.set(q,ee),x.push(q)),V[$]=ee}const Y=x.length,F=w(x,Y,P.locale);return h(N,V,F,Y,!!P.descending)}function A(O,N,P){const C=b(O,N);if(N.length>=2&&a(C,N)){const V=O.stringRank;return V&&V.version===O.version&&V.usable(N,C,P.locale)?V.sort(N,P):v(C,N,P)}const B=X(P.locale),x=P.descending?(V,Y)=>B(Y,V):B;return m(C,N,x)}function H(O,N,P){const C=b(O,N),B=P.compare,V=!!P.descending?(Y,F)=>-B(Y,F,void 0,void 0,!0):(Y,F)=>B(Y,F,void 0,void 0,!1);return m(C,N,V)}function G(O,N){const P=N.length,C=z(O),B=O.values,x=O.kind==="float64"&&!!B,V=O.kind==="object"||O.kind==="multi"||O.kind===void 0;if(!C&&!x&&!V)return{present:N,absent:j};const Y=new Uint32Array(P),F=new Uint32Array(P);let $=0,q=0;if(C&&x)for(let ee=0;ee<P;ee++){const te=N[ee];C(te)===1&&!Number.isNaN(B[te])?Y[$++]=te:F[q++]=te}else if(x&&!C)for(let ee=0;ee<P;ee++){const te=N[ee];Number.isNaN(B[te])?F[q++]=te:Y[$++]=te}else if(C&&!V)for(let ee=0;ee<P;ee++){const te=N[ee];C(te)===1?Y[$++]=te:F[q++]=te}else{const ee=I(O);for(let te=0;te<P;te++){const re=N[te];J(ee(re))?F[q++]=re:Y[$++]=re}}return q===0?{present:N,absent:j}:{present:Y.subarray(0,$),absent:F.subarray(0,q)}}function Z(O,N,P){if(N.length===0)return O;const C=new Uint32Array(O.length+N.length);return P?(C.set(N,0),C.set(O,N.length)):(C.set(O,0),C.set(N,O.length)),C}function M(O,N,P={}){const C=N||D(L(O,P));if(!O||C.length<2)return Uint32Array.from(C);const{present:B,absent:x}=G(O,C);if(B.length===0)return Uint32Array.from(C);const V=!!P.descending;let Y;if(typeof P.compare=="function")Y=H(O,B,P);else switch(O.kind){case"float64":Y=i(O.values,B,V);break;case"int32":Y=r(O.values,B,V);break;case"dictionary":Y=f(O,B,P);break;case"bitset":Y=u(O,B,V);break;default:Y=A(O,B,P);break}return Z(Y,x,!!P.nullsFirst)}function S(O,N,P,C={}){const B=N||[],x=B.length&&(B[0].handle||T(O,B[0].col))||O&&O[0];let V=P||D(L(x,C));for(let Y=B.length-1;Y>=0;Y--){const F=B[Y],$=F.handle||T(O,F.col)||O&&O[Y];$&&(V=M($,V,{descending:F.descending!==void 0?!!F.descending:F.dir==="desc",nullsFirst:!!F.nullsFirst,locale:F.locale!==void 0?F.locale:C.locale,compare:F.compare}))}return V instanceof Uint32Array?V:Uint32Array.from(V)}function T(O,N){if(!(!O||N===void 0)){for(let P=0;P<O.length;P++)if(O[P]&&O[P].id===N)return O[P]}}}),ze("packages/core/src/store/stringrank.js",function(e,_){"use strict";Object.defineProperty(e,"DEFAULT_MAX_DISTINCT",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"StringRankIndex",{enumerable:!0,get:function(){return D}});const ne=_("packages/core/src/compute/sort.js"),E=ne.collateStringRanks,K=ne.rankSortStrings,U=1e5;class D{#e=[];#t=new Map;#n;#r=0;#s=0;#i=-1;#o;#l=!1;#a=null;#c=-1;#u="\0";constructor(z=U){this.#o=z>0?z:U,this.#n=new Uint32Array(0)}get version(){return this.#i}set version(z){this.#i=z}get generation(){return this.#s}get size(){return this.#e.length}get capped(){return this.#l}get length(){return this.#r}get bytes(){let z=this.#n.byteLength;const L=this.#e;for(let X=0;X<L.length;X++)z+=L[X].length*2+24;return z}#d(z,L){const X=this.#t.get(z);if(X!==void 0)return X;if(this.#l)return-1;if(L&&this.#e.length>=this.#o)return this.#l=!0,-1;const I=this.#e.length;return this.#e.push(z),this.#t.set(z,I),this.#s++,I}build(z,L){const X=L|0;this.#e=[],this.#t=new Map,this.#s=0,this.#l=!1,this.#a=null,this.#c=-1,this.#n=new Uint32Array(X);for(let I=0;I<X;I++){const j=z[I],k=typeof j=="string"?this.#d(j,!1):-1;this.#n[I]=k<0?0:k}this.#r=X}append(z,L,X){const I=(L|0)+(X|0);if(I>this.#n.length){const j=new Uint32Array(I);j.set(this.#n.subarray(0,this.#r)),this.#n=j}for(let j=L|0;j<I;j++){const k=z[j],y=typeof k=="string"?this.#d(k,!0):-1;this.#n[j]=y<0?0:y}this.#r=Math.max(this.#r,I)}ranks(z){const L=z||"";if(this.#a&&this.#c===this.#s&&this.#u===L)return this.#a;const X=E(this.#e,this.#e.length,z);return this.#a=X,this.#c=this.#s,this.#u=L,X}usable(z,L,X){if(this.#l||this.#e.length===0)return!1;const I=this.#n,j=this.#e,k=this.#r;for(let y=0;y<z.length;y++){const l=z[y];if(l>=k||j[I[l]]!==L[l])return!1}return!0}sort(z,L){const X=this.ranks(L.locale),I=this.#e.length,j=z.length,k=new Uint32Array(j),y=this.#n;for(let l=0;l<j;l++)k[l]=y[z[l]];return K(z,k,X,I,!!L.descending)}}}),ze("packages/core/src/store/columnstore.js",function(e,_){"use strict";Object.defineProperty(e,"REMOVED",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"toFloat",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ColumnHandle",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"ColumnStore",{enumerable:!0,get:function(){return u}});const E=_("packages/core/src/internal/warn.js").warnOnce,U=_("packages/core/src/internal/predicates.js").isFunction,J=_("packages/core/src/internal/paths.js").pathGetter,L=_("packages/core/src/store/bitset.js").Bitset,I=_("packages/core/src/store/dictionary.js").Dictionary,k=_("packages/core/src/store/multivalue.js").MultiValue,l=_("packages/core/src/store/stringrank.js").StringRankIndex,g=4294967295,s=1024,t=5e3,o=.2,c=new Set(["float64","int32","bitset","dictionary","object","multi"]);function d(b){return b==null}function n(b){if(typeof b=="number")return b;if(b instanceof Date)return b.getTime();if(typeof b=="boolean")return b?1:0;const a=Number(b);return Number.isNaN(a)&&typeof b=="string"?Date.parse(b):a}function p(b){const a=n(b);return Number.isFinite(a)?a|0:0}function i(b){return d(b)?[]:Array.isArray(b)?b:[b]}function r(b,a){switch(b.kind){case"float64":case"int32":return b.buf[a];case"bitset":return b.bits.get(a)===1;case"dictionary":return b.dict.valueOf(b.buf[a]);case"multi":{const h=b.mv.at(a),w=new Array(h.length);for(let v=0;v<h.length;v++)w[v]=b.dict.valueOf(h[v]);return w}default:return b.buf[a]}}function f(b,a){switch(b.kind){case"float64":case"int32":return b.values[a];case"bitset":return(b.values[a>>3]&1<<(a&7))!==0;case"dictionary":return(b.table||[])[b.values[a]];case"multi":{const h=b.offsets[a],w=b.offsets[a+1],v=b.table||[],A=new Array(w-h);for(let H=h;H<w;H++)A[H-h]=v[b.values[H]];return A}default:return b.values[a]}}class m{#e;#t;#n;#r;#s;#i;#o;#l=!1;#a=null;#c=null;#u=null;#d=null;#f=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#S=null;#w=null;#A=!1;constructor(a,h){this.#e=a.id;const w=c.has(a.kind)?a.kind:"object";a.kind&&!c.has(a.kind)&&E(`store.kind.${a.id}`,`column "${a.id}" declares unknown storage kind "${a.kind}"; falling back to object`),this.#n=w,this.#t=w,this.#r=a.nullable!==!1,this.#o=a.dictionary??null,this.#i=h,this.#s=U(a.read)?a.read:J(a.field||a.id),this.#h=a.stringRankIndex!=="off",this.#p=typeof a.stringRankMaxDistinct=="number"?a.stringRankMaxDistinct:0,this.#S=new Map}get id(){return this.#e}get kind(){return this.#l?this.#t:"object"}get target(){return this.#n}get nullable(){return this.#r}get values(){return this.#A?null:this.#l?this.#t==="bitset"?this.#c.words:this.#t==="multi"?this.#u.values:this.#a:this.#T().values}get presence(){return this.#A||!this.#r?null:this.#l?this.#g:this.#T().presence}get dict(){return this.#A||!this.#l?null:this.#t==="dictionary"||this.#t==="multi"?this.#d:null}get stringRank(){if(this.#A||!this.#h||this.kind!=="object")return null;const a=this.values,h=this.#i.physical();if(!a||h===0)return null;if(this.#f===null){if(typeof a[0]!="string")return null;const w=new l(this.#v());return w.build(a,h),w.version=this.#y,this.#f=w,this.#m=this.#y,w.capped?null:w}return this.#f.length<h&&this.#f.append(a,this.#f.length,h-this.#f.length),this.#f.version=this.#y,this.#m=this.#y,this.#f.capped?null:this.#f}#v(){return this.#p}#P(){this.#f=null,this.#m=-1}get offsets(){return this.#A||!this.#l||this.#t!=="multi"?null:this.#u.offsets}get version(){return this.#y}get bytes(){let a=0;return this.#a&&(a+=this.#a.byteLength??this.#a.length*8),this.#c&&(a+=this.#c.bytes),this.#u&&(a+=this.#u.bytes),this.#g&&(a+=this.#g.bytes),this.#d&&(a+=this.#d.bytes),this.#S&&(a+=this.#S.size*24),a}get(a){if(!this.#A&&!(a<0||a>=this.#i.physical())){if(!this.#l)return this.#E(a);if(this.#r&&this.#g.get(a)===0)return null;switch(this.#t){case"float64":case"int32":return this.#a[a];case"bitset":return this.#c.get(a)===1;case"dictionary":return this.#d.valueOf(this.#a[a]);case"multi":{const h=this.#u.at(a),w=new Array(h.length);for(let v=0;v<h.length;v++)w[v]=this.#d.valueOf(h[v]);return w}default:return this.#a[a]}}}set(a,h){this.#A||(this.#l?this.#C(a,h):this.#S.set(a,h===void 0?null:h),this.#f&&this.#P(),this.#y++)}read(a){return this.#s(a)}appendColumn(a,h,w){if(this.#A||w<=0)return;if(!this.#l){this.#y++;return}const v=this.#s,A=this.#r,H=this.#g;let G=!1;switch(this.#t){case"float64":{const Z=this.#a;for(let M=0;M<w;M++){const S=v(a[M]);if(typeof S=="number"){A&&H.set(h+M),Z[h+M]=S;continue}const T=S==null;A?H.assign(h+M,!T):T&&(G=!0),Z[h+M]=T?NaN:n(S)}break}case"int32":{const Z=this.#a;for(let M=0;M<w;M++){const S=v(a[M]),T=S==null;A?H.assign(h+M,!T):T&&(G=!0),Z[h+M]=T?0:p(S)}break}case"bitset":{const Z=this.#c;for(let M=0;M<w;M++){const S=v(a[M]),T=S==null;A?H.assign(h+M,!T):T&&(G=!0),Z.assign(h+M,!T&&!!S)}break}case"dictionary":{const Z=this.#a,M=this.#d;for(let S=0;S<w;S++){const T=v(a[S]),O=T==null;A?H.assign(h+S,!O):O&&(G=!0),Z[h+S]=O?0:M.codeOf(T)}break}case"multi":{const Z=this.#u,M=this.#d;for(let S=0;S<w;S++){const T=v(a[S]),O=T==null;A?H.assign(h+S,!O):O&&(G=!0);const N=i(T),P=new Array(N.length);for(let C=0;C<N.length;C++)P[C]=M.codeOf(N[C]);Z.write(h+S,P)}break}default:{const Z=this.#a;for(let M=0;M<w;M++){const S=v(a[M]),T=S==null;A?H.assign(h+M,!T):T&&(G=!0),Z[h+M]=T?null:S}break}}G&&E(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#f&&this.#t==="object"&&(this.#f.append(this.#a,h,w),this.#f.version=this.#y+1,this.#m=this.#y+1),this.#y++}appendPacked(a,h,w){if(this.#A||w<=0||!a)return;if(!this.#l){this.#y++;return}const v=this.#g,A=a.presence;if(v)if(A)for(let G=0;G<w;G++)v.assign(h+G,(A[G>>3]&1<<(G&7))!==0);else for(let G=0;G<w;G++)v.set(h+G);const H=a.kind===this.#t;if(H&&(this.#t==="float64"||this.#t==="int32")){this.#a.set(a.values,h),this.#y++;return}if(H&&this.#t==="bitset"){const G=a.values;for(let Z=0;Z<w;Z++)this.#c.assign(h+Z,(G[Z>>3]&1<<(Z&7))!==0);this.#y++;return}if(H&&this.#t==="dictionary"){const G=a.table||[],Z=new Uint32Array(G.length);for(let O=0;O<G.length;O++)Z[O]=this.#d.codeOf(G[O]);const M=a.values,S=this.#a,T=v;for(let O=0;O<w;O++){if(T&&(A&&(A[O>>3]&1<<(O&7))===0)){S[h+O]=0;continue}S[h+O]=Z[M[O]]??0}this.#y++;return}if(H&&this.#t==="multi"){const G=a.table||[],Z=new Uint32Array(G.length);for(let T=0;T<G.length;T++)Z[T]=this.#d.codeOf(G[T]);const M=a.values,S=a.offsets;for(let T=0;T<w;T++){const O=S[T],N=S[T+1],P=new Array(N-O);for(let C=O;C<N;C++)P[C-O]=Z[M[C]]??0;this.#u.write(h+T,P)}this.#y++;return}for(let G=0;G<w;G++){const Z=A?(A[G>>3]&1<<(G&7))===0:a.kind==="object"?a.values[G]===null:!1;this.#C(h+G,Z?null:f(a,G))}this.#y++}touch(){this.#y++}columnarise(a,h){if(this.#l||this.#A)return;const w=new Array(h);for(let v=0;v<h;v++)w[v]=this.#E(v);this.#t=this.#n,this.#l=!0,this.#O(a);for(let v=0;v<h;v++)this.#C(v,w[v]);this.#S.clear(),this.#w=null,this.#P(),this.#y++}grow(a){if(!(!this.#l||this.#A||a<=this.#b)){switch(this.#t){case"float64":case"int32":case"dictionary":{const h=new this.#a.constructor(a);h.set(this.#a),this.#a=h;break}case"bitset":this.#c.grow(a);break;case"multi":break;default:this.#a.length=a;break}this.#g&&this.#g.grow(a),this.#b=a,this.#y++}}convert(a){if(this.#A||!c.has(a)||(this.#n=a,!this.#l||a===this.#t))return!1;const h={kind:this.#t,buf:this.#a,bits:this.#c,mv:this.#u,dict:this.#d},w=this.#i.physical(),v=this.#g;this.#t=a,this.#O(this.#b);for(let A=0;A<w;A++){const H=v!==null&&v.get(A)===0;H&&a!=="multi"||this.#C(A,H?null:r(h,A))}return this.#P(),this.#y++,!0}compact(a,h,w){if(!this.#A){if(this.#P(),!this.#l){const v=this.#S;if(v.size){const A=new Map;for(const[H,G]of v)a[H]!==g&&A.set(a[H],G);this.#S=A}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const v=this.#a;for(let A=0;A<h;A++)a[A]!==g&&(v[a[A]]=v[A]);if(this.#t==="object")for(let A=w;A<h;A++)v[A]=void 0;break}case"bitset":{const v=this.#c;for(let A=0;A<h;A++)a[A]!==g&&v.assign(a[A],v.get(A)===1);for(let A=w;A<h;A++)v.clear(A);break}case"multi":this.#u.compact(a,w,g);break;default:break}if(this.#g){const v=this.#g;for(let A=0;A<h;A++)a[A]!==g&&v.assign(a[A],v.get(A)===1);for(let A=w;A<h;A++)v.clear(A)}this.#y++}}release(){this.#A||(this.#A=!0,this.#a=null,this.#c&&this.#c.release(),this.#c=null,this.#u&&this.#u.release(),this.#u=null,this.#g&&this.#g.release(),this.#g=null,this.#d=null,this.#f=null,this.#S=new Map,this.#w=null,this.#b=0,this.#y++)}#O(a){const h=Math.max(1,a);switch(this.#a=null,this.#c=null,this.#u=null,this.#t){case"float64":this.#a=new Float64Array(h);break;case"int32":this.#a=new Int32Array(h);break;case"bitset":this.#c=new L(h);break;case"dictionary":this.#a=new Uint32Array(h),this.#d=this.#d??new I(this.#o??[]);break;case"multi":this.#u=new k({rows:h,values:h}),this.#d=this.#d??new I(this.#o??[]);break;default:this.#a=new Array(h);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#d=null),this.#r&&(this.#g?this.#g.grow(h):this.#g=new L(h)),this.#b=h}#C(a,h){const w=d(h);switch(this.#r?this.#g.assign(a,!w):w&&E(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#t){case"float64":this.#a[a]=w?NaN:n(h);break;case"int32":this.#a[a]=w?0:p(h);break;case"bitset":this.#c.assign(a,!w&&!!h);break;case"dictionary":this.#a[a]=w?0:this.#d.codeOf(h);break;case"multi":{const v=i(h),A=new Array(v.length);for(let H=0;H<v.length;H++)A[H]=this.#d.codeOf(v[H]);this.#u.write(a,A);break}default:this.#a[a]=w?null:h;break}}#E(a){if(this.#S.has(a))return this.#S.get(a);const h=this.#s(this.#i.rowAt(a));return h===void 0?null:h}#T(){if(this.#w&&this.#w.version===this.#y)return this.#w;const a=this.#i.physical(),h=new Array(a),w=this.#r?new L(a):null;for(let v=0;v<a;v++){const A=this.#E(v);h[v]=A,w&&!d(A)&&w.set(v)}return this.#w={version:this.#y,values:h,presence:w},this.#w}}class u{#e;#t=new Map;#n=[];#r=[];#s=0;#i=0;#o=0;#l=0;#a=new L(0);#c=!1;#u=!0;#d;#f;#h;#p=!1;constructor(a,h={}){this.#e=Array.isArray(a)?a:[],this.#f=Math.max(1,h.initialCapacity??s),this.#u=h.retainSource!==!1,this.#d=this.#u?h.columnarBelow??t:0,this.#h=h.compactRatio??o;const w={rowAt:v=>this.#r[v],physical:()=>this.#s};for(const v of this.#e){if(!v||!v.id)continue;if(this.#t.has(v.id)){E(`store.dup.${v.id}`,`duplicate column id "${v.id}" in the store schema; ignoring the second`);continue}const A=new m(v,w);this.#t.set(v.id,A),this.#n.push(A)}this.#d<=0&&this.#b()}get count(){return this.#o}get physical(){return this.#s}get capacity(){return this.#c?this.#i:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let a=this.#a.bytes+this.#r.length*8;for(const h of this.#n)a+=h.bytes;return a}append(a){const h=this.#s;if(this.#p||!a)return{from:h,to:h};const w=a.length|0;if(w===0)return{from:h,to:h};if(this.#u)for(let A=0;A<w;A++)this.#r[h+A]=a[A];if(this.#s=h+w,this.#o+=w,this.#a.grow(this.#s),!this.#c){if(this.#s>=this.#d)this.#b();else for(const A of this.#n)A.touch();return{from:h,to:this.#s}}this.#m(this.#s);const v=this.#n;for(let A=0;A<v.length;A++)v[A].appendColumn(a,h,w);return{from:h,to:this.#s}}appendPacked(a,h){const w=this.#s;if(this.#p||!a)return{from:w,to:w};const v=a.count|0;if(v===0)return{from:w,to:w};if(this.#u&&h)for(let H=0;H<v;H++)this.#r[w+H]=h[H];this.#s=w+v,this.#o+=v,this.#a.grow(this.#s),this.#c||this.#b(),this.#m(this.#s);const A=new Map;for(const H of a.columns)A.set(H.id,H);for(const H of this.#n){const G=A.get(H.id);G?H.appendPacked(G,w,v):H.grow(this.#i)}return{from:w,to:this.#s}}source(a){if(this.#u)return this.#r[a];if(!(a<0||a>=this.#s))return this.#g(a)}setSource(a,h){this.#p||a<0||a>=this.#s||this.#u&&(this.#r[a]=h)}get(a,h){const w=this.#t.get(a);return w?w.get(h):void 0}set(a,h,w){if(this.#p||h<0||h>=this.#s)return;const v=this.#t.get(a);if(!v){E(`store.set.${a}`,`set() on unknown column "${a}"`);return}v.set(h,w)}remove(a){return this.#p||a<0||a>=this.#s||this.#a.get(a)===1?!1:(this.#a.set(a),this.#l++,this.#o--,!0)}live(a){return a<0||a>=this.#s?!1:this.#a.get(a)===0}compact(a={}){if(this.#p||this.#l===0||!a.force&&this.#l/this.#s<this.#h)return null;const h=this.#s,w=new Uint32Array(h);let v=0;for(let A=0;A<h;A++)w[A]=this.#a.get(A)===1?g:v++;for(const A of this.#n)A.compact(w,h,v);if(this.#u){const A=this.#r;for(let H=0;H<h;H++)w[H]!==g&&(A[w[H]]=A[H]);A.length=v}return this.#s=v,this.#o=v,this.#l=0,this.#a=new L(Math.max(this.#i,v)),w}column(a){return this.#t.get(a)}columns(){return this.#n.slice()}liveIndices(){const a=new Uint32Array(this.#o);if(this.#l===0){for(let w=0;w<this.#s;w++)a[w]=w;return a}let h=0;for(let w=0;w<this.#s;w++)this.#a.get(w)===0&&(a[h++]=w);return a}convert(a,h){const w=this.#t.get(a);return w?w.convert(h):!1}destroy(){if(!this.#p){this.#p=!0;for(const a of this.#n)a.release();this.#t.clear(),this.#n.length=0,this.#r.length=0,this.#a.release(),this.#s=0,this.#o=0,this.#l=0,this.#i=0}}#m(a){if(a<=this.#i)return;let h=this.#i||this.#f;for(;h<a;)h*=2;for(const w of this.#n)w.grow(h);this.#a.grow(h),this.#i=h}#g(a){const h={};for(const w of this.#n)h[w.id]=w.get(a);return h}#b(){if(this.#c)return;let a=this.#f;for(;a<this.#s;)a*=2;this.#c=!0,this.#i=a,this.#a.grow(a);for(const h of this.#n)h.columnarise(a,this.#s)}}}),ze("packages/core/src/store/pool.js",function(e,_){"use strict";Object.defineProperty(e,"MaskPool",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"sharedPool",{enumerable:!0,get:function(){return D}});const ne=64,E=8;function K(z){let L=ne;for(;L<z;)L*=2;return L}class U{#e=new Map;#t=new WeakSet;#n;#r=0;#s={acquired:0,reused:0,released:0};constructor(L={}){this.#n=L.limit??E}get bytes(){return this.#r}mask(L){const X=new Uint8Array(this.#i(L),0,L);return X.fill(0),X}indices(L){return new Uint32Array(this.#i(L*4),0,L)}release(L){if(!L||!L.buffer)return!1;const X=L.buffer;if(!this.#t.has(X))return!1;this.#t.delete(X),this.#s.released++;const I=X.byteLength;let j=this.#e.get(I);return j||this.#e.set(I,j=[]),j.length>=this.#n||(j.push(X),this.#r+=I),!0}releaseAll(L){for(const X of L)this.release(X)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#s,retained:this.#r}}#i(L){const X=K(L),I=this.#e.get(X);this.#s.acquired++;let j;return I&&I.length?(j=I.pop(),this.#r-=X,this.#s.reused++):j=new ArrayBuffer(X),this.#t.add(j),j}}function D(){return J??=new U,J}let J=null}),ze("packages/core/src/compute/sortspec.js",function(e,_){"use strict";Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return D}});function ne(J){return{locale:J===void 0?void 0:String(J),numeric:!0,sensitivity:"variant"}}function E(J){return!!J&&typeof J.compare!="function"}function K(J){if(!J)return!0;for(let z=0;z<J.length;z++)if(!E(J[z]))return!1;return!0}function U(J,z){const L=J.col!==void 0?J.col:J.handle&&J.handle.id,X=J.locale!==void 0?J.locale:z;return{col:L,descending:J.descending!==void 0?!!J.descending:J.dir==="desc",nullsFirst:!!J.nullsFirst,collation:ne(X)}}function D(J,z){const L=J||[],X=new Array(L.length);for(let I=0;I<L.length;I++)X[I]=U(L[I],z);return X}}),ze("packages/core/src/compute/facet.js",function(e,_){"use strict";Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"orderedReader",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"toNumeric",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return w}});const ne=_("packages/core/src/compute/handle.js"),E=ne.presenceReader,K=ne.valueReader,U=ne.dictSize,D=ne.dictValue,J=Object.freeze(["equal","quantile","log"]),z=Object.freeze(["hour","day","week","month","quarter","year"]),L=20,X=50,I=1e4;function j(v,A){if(!v)return"none";const H=A;if(H&&(H.multi===!0||typeof H.items=="function"))return"category";const G=A&&A.base;if(G==="date"||G==="datetime"||G==="time"||G==="dateString")return"date";switch(v.kind){case"bitset":return"boolean";case"float64":case"int32":return"numeric";case"dictionary":return"category";case"multi":return"category";default:return G==="number"?"numeric":G==="boolean"?"boolean":G==="text"?"category":"none"}}function k(v){const A=v.values,H=v.kind;if((H==="float64"||H==="int32")&&A)return Z=>A[Z];const G=K(v);return Z=>y(G(Z))}function y(v){if(typeof v=="number")return v;if(v instanceof Date)return v.getTime();if(v==null||v==="")return NaN;if(typeof v=="boolean")return v?1:0;if(typeof v=="string"){const A=Number(v);if(Number.isFinite(A))return A;const H=Date.parse(v);return Number.isFinite(H)?H:NaN}return NaN}function l(v,A,H,G=X){if(!v)return{cardinality:0,exact:!0};if(v.dict)return{cardinality:U(v.dict),exact:!0};if(v.kind==="bitset")return{cardinality:2,exact:!0};const Z=K(v),M=A?A.length:H,S=new Set;for(let T=0;T<M;T++){const O=Z(A?A[T]:T);if(O!=null&&(S.add(O),S.size>G))return{cardinality:S.size,exact:!1}}return{cardinality:S.size,exact:!0}}const g=36e5,s=864e5;function t(v,A=L){const H=Number.isFinite(v)&&v>0?v:0,G=Math.max(1,A)*2;return H/g<=G?"hour":H/s<=G?"day":H/(7*s)<=G?"week":H/(30*s)<=G?"month":H/(91*s)<=G?"quarter":"year"}function o(v,A){if(!Number.isFinite(v))return NaN;const H=new Date(v);switch(A){case"hour":return H.setMinutes(0,0,0),H.getTime();case"day":return H.setHours(0,0,0,0),H.getTime();case"week":{H.setHours(0,0,0,0);const G=(H.getDay()+6)%7;return H.setDate(H.getDate()-G),H.getTime()}case"month":return H.setDate(1),H.setHours(0,0,0,0),H.getTime();case"quarter":return H.setMonth(Math.floor(H.getMonth()/3)*3,1),H.setHours(0,0,0,0),H.getTime();default:return H.setMonth(0,1),H.setHours(0,0,0,0),H.getTime()}}function c(v,A){const H=new Date(v);switch(A){case"hour":H.setHours(H.getHours()+1);break;case"day":H.setDate(H.getDate()+1);break;case"week":H.setDate(H.getDate()+7);break;case"month":H.setMonth(H.getMonth()+1);break;case"quarter":H.setMonth(H.getMonth()+3);break;default:H.setFullYear(H.getFullYear()+1);break}return H.getTime()}function d(v,A,H){const G=k(v),Z=E(v),M=A?A.length:H;let S=1/0,T=-1/0,O=0,N=0;for(let P=0;P<M;P++){const C=A?A[P]:P;if(Z&&!Z(C)){O++;continue}const B=G(C);if(!Number.isFinite(B)){O++;continue}B<S&&(S=B),B>T&&(T=B),N++}return{min:S,max:T,nulls:O,finite:N}}function n(v,A,H,G){const Z=k(v),M=E(v),S=A?A.length:H,T=S>G?S/G:1,O=[];for(let P=0;P<S;P+=T){const C=A?A[Math.floor(P)]:Math.floor(P);if(M&&!M(C))continue;const B=Z(C);Number.isFinite(B)&&O.push(B)}const N=Float64Array.from(O);return N.sort(),N}function p(v,A,H,G={}){const Z=G.kind||j(v,G.type);return Z==="none"||!v?{kind:"none",buckets:[],suppressed:"type"}:Z==="boolean"?i(v,A,H):Z==="category"?r(v,A,H,G):m(v,A,H,Z,G)}function i(v,A,H){const G=E(v);let Z=0;if(G){const S=A?A.length:H;for(let T=0;T<S;T++)G(A?A[T]:T)||Z++}const M=[{value:!1,label:"false"},{value:!0,label:"true"}];return Z>0&&M.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:M}}function r(v,A,H,G){const Z=G.cardinalityLimit??X,{cardinality:M}=l(v,A,H,Z);if(M>Z&&(G.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:M};const S=K(v),T=A?A.length:H,O=new Map;let N=0;for(let V=0;V<T;V++){const Y=S(A?A[V]:V);if(Y==null||Y===""){N++;continue}if(Array.isArray(Y)){if(!Y.length){N++;continue}for(const F of Y)O.set(F,(O.get(F)||0)+1);continue}O.set(Y,(O.get(Y)||0)+1)}let P=[...O.entries()];G.order==="alpha"?P.sort((V,Y)=>String(V[0]).localeCompare(String(Y[0]))):P.sort((V,Y)=>Y[1]-V[1]);let C=0,B=0;if(P.length>Z){B=P.length-Z;for(let V=Z;V<P.length;V++)C+=P[V][1];P=P.slice(0,Z)}const x=P.map(([V])=>({value:V,label:String(V)}));return C>0&&x.push({remainder:!0,label:`Other (${B} values)`}),N>0&&x.push({null:!0,label:"Empty"}),{kind:"category",buckets:x,cardinality:M}}function f(v,A,H,G,Z){const M=n(v,A,H,I),S=M.length;if(S<100)return null;const T=M[Math.floor(.01*S)],O=M[Math.ceil(.99*S)-1];return!(O>T)||Z-G<=2*(O-T)?null:{lo:T,hi:O}}function m(v,A,H,G,Z){const{min:M,max:S,nulls:T,finite:O}=d(v,A,H);if(!O)return{kind:G,buckets:T?[{null:!0,label:"Empty"}]:[],empty:!0};const N=Math.max(1,Math.floor(Z.buckets||L));let P=[];if(G==="date"){const B=z.includes(Z.granularity)?Z.granularity:t(S-M,N);let x=o(M,B);for(;x<=S&&P.length<4096;){const V=c(x,B);if(!(V>x))break;P.push({from:x,to:V}),x=V}return{kind:G,buckets:u(P,T),granularity:B}}const C=J.includes(Z.strategy)?Z.strategy:"equal";if(C==="quantile"){const B=n(v,A,H,I);if(B.length){const x=[B[0]];for(let V=1;V<N;V++){const Y=B[Math.min(B.length-1,Math.floor(V/N*B.length))];Y>x[x.length-1]&&x.push(Y)}x.push(S);for(let V=0;V<x.length-1;V++)P.push({from:x[V],to:x[V+1]})}}else if(C==="log"&&M>0){const B=Math.log10(M),V=(Math.log10(S)-B)/N||1;for(let Y=0;Y<N;Y++)P.push({from:10**(B+Y*V),to:10**(B+(Y+1)*V)})}if(!P.length&&C==="equal"){const B=f(v,A,H,M,S);if(B){const x=(B.hi-B.lo)/N;B.lo>M&&P.push({from:M,to:B.lo,overflow:"low"});for(let V=0;V<N;V++)P.push({from:B.lo+V*x,to:B.lo+(V+1)*x});P[P.length-1].to=B.hi,B.hi<S&&P.push({from:B.hi,to:S,overflow:"high"})}}if(!P.length){const B=(S-M)/N||1;for(let x=0;x<N;x++)P.push({from:M+x*B,to:M+(x+1)*B})}return P[P.length-1].to=S,{kind:G,buckets:u(P,T),strategy:C,min:M,max:S}}function u(v,A){return A>0?[...v,{null:!0,label:"Empty"}]:v}function b(v,A,H,G,Z){const M=G&&G.buckets||[],S=Z&&Z.length>=M.length?Z.subarray(0,M.length):new Uint32Array(M.length);if(S.fill(0),!v||!M.length)return S;const T=M.length-1,O=!!M[T]&&M[T].null===!0,N=A?A.length:H;if(G.kind==="boolean"){const V=K(v);for(let Y=0;Y<N;Y++){const F=V(A?A[Y]:Y);if(F==null){O&&S[T]++;continue}S[F?1:0]++}return S}if(G.kind==="category"){const V=new Map;for(let $=0;$<M.length;$++)!M[$].null&&!M[$].remainder&&V.set(M[$].value,$);const Y=M.findIndex($=>$.remainder),F=K(v);for(let $=0;$<N;$++){const q=F(A?A[$]:$);if(q==null||q===""){O&&S[T]++;continue}if(Array.isArray(q)){if(!q.length){O&&S[T]++;continue}for(const te of q){const re=V.get(te);re!==void 0?S[re]++:Y>=0&&S[Y]++}continue}const ee=V.get(q);ee!==void 0?S[ee]++:Y>=0&&S[Y]++}return S}const P=O?M.length-1:M.length,C=new Float64Array(P+1);for(let V=0;V<P;V++)C[V]=M[V].from;C[P]=P?M[P-1].to:0;const B=k(v),x=E(v);for(let V=0;V<N;V++){const Y=A?A[V]:V;if(x&&!x(Y)){O&&S[T]++;continue}const F=B(Y);if(!Number.isFinite(F)){O&&S[T]++;continue}const $=a(C,P,F);$>=0&&S[$]++}return S}function a(v,A,H){if(!A||H<v[0])return-1;if(H>=v[A])return H===v[A]?A-1:-1;let G=0,Z=A-1;for(;G<Z;){const M=G+Z+1>>>1;H>=v[M]?G=M:Z=M-1}return G}function h(v,A,H,G={}){const Z=G.bounds||p(v,G.boundsIndices??A,H,G);return{bounds:Z,counts:b(v,A,H,Z)}}const w=h}),ze("packages/core/src/compute/pivotmatrix.js",function(e,_){"use strict";Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return o}});const E=_("packages/core/src/compute/handle.js").valueComparator,U=_("packages/core/src/compute/total.js").total,J=_("packages/core/src/compute/group.js").packKeys,z=_("packages/core/src/compute/pivot.js"),L=z.joinPath,X=z.DEFAULT_PATH_SEPARATOR,I=z.DEFAULT_MAX_COLUMNS,j="";function k(c,d,n={}){const p=n.separator||X,i=c||[],r=d instanceof Uint32Array?d:Uint32Array.from(d||[]),f=r.length;if(i.length===0)return{tuples:[[]],paths:[j],buckets:[r]};const{keyOf:m,readers:u}=J(i,r,0),b=new Map,a=[],h=[],w=[];for(let M=0;M<f;M++){const S=r[M],T=m(S);let O=b.get(T);if(O===void 0){O=a.length,b.set(T,O),h.push(T);const N=new Array(u.length);for(let P=0;P<u.length;P++)N[P]=u[P](S);a.push(N),w.push([])}w[O].push(S)}const v=E(n.locale),A=a.map((M,S)=>S);A.sort((M,S)=>{const T=a[M],O=a[S];for(let N=0;N<T.length;N++){const P=y(T[N],O[N],v);if(P!==0)return P}return M-S});const H=new Array(A.length),G=new Array(A.length),Z=new Array(A.length);for(let M=0;M<A.length;M++){const S=A[M];H[M]=a[S],G[M]=L(a[S],p),Z[M]=Uint32Array.from(w[S])}return{tuples:H,paths:G,buckets:Z}}function y(c,d,n){const p=c==null,i=d==null;return p||i?p&&i?0:p?1:-1:n(c,d)}function l(c,d,n){const p=[];for(let i=0;i<c.length;i++)n.has(c[i])&&p.push(c[i]);return Uint32Array.from(p)}function g(c,d,n,p){return{value:d.length?U(c,d,n,p):null,leaves:d,count:d.length}}function s(c){const d=c&&c.opts||{},n=d.separator||X,p=d.totalContext||{locale:d.locale},i=(c.measures||[]).filter(G=>G&&G.handle),r=c.leaves instanceof Uint32Array?c.leaves:Uint32Array.from(c.leaves||[]),f=k(c.rowHandles||[],r,{...d,separator:n}),m=k(c.columnHandles||[],r,{...d,separator:n}),u=d.maxColumns===void 0?I:d.maxColumns,b=m.paths.length*Math.max(1,i.length),a=new Map;if(u&&b>u)return{rowAxis:f,columnAxis:m,measures:i.map(G=>({colId:G.colId,fn:G.fn})),body:a,rowMargin:a,columnMargin:a,grand:a,columns:b,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${b} columns, above pivot.maxColumns of ${u}. Narrow the pivot columns or raise the limit.`,columns:b,maxColumns:u}};const h=new Map,w=new Map,v=new Map,A=new Map,H=m.buckets.map(G=>new Set(G));for(let G=0;G<m.paths.length;G++){const Z=m.buckets[G],M=m.paths[G];for(const S of i)v.set(o(M,S.colId),g(S.handle,Z,S.fn,p))}for(let G=0;G<f.paths.length;G++){const Z=f.buckets[G],M=f.paths[G];for(const S of i)w.set(o(M,S.colId),g(S.handle,Z,S.fn,p));for(let S=0;S<m.paths.length;S++){const T=l(Z,m.buckets[S],H[S]);if(T.length===0)continue;const O=m.paths[S];for(const N of i)h.set(t(M,O,N.colId),g(N.handle,T,N.fn,p))}}for(const G of i)A.set(G.colId,g(G.handle,r,G.fn,p));return{rowAxis:f,columnAxis:m,measures:i.map(G=>({colId:G.colId,fn:G.fn})),body:h,rowMargin:w,columnMargin:v,grand:A,columns:b,error:null}}function t(c,d,n){return`${c}\0${d}\0${n}`}function o(c,d){return`${c}\0${d}`}}),ze("packages/core/src/compute/reference.js",function(e,_){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return s}});const E=_("packages/core/src/internal/paths.js").getPath,K=_("packages/core/src/compute/handle.js"),U=K.isMissing,D=K.valueComparator,z=_("packages/core/src/compute/filter.js").testValue,L="",X="\0";function I(c,d){const n=d.includes(".")?E(c,d):c?.[d];return n===void 0?null:n}function j(c,d,n={}){const p=d||[];let i=c.map((r,f)=>f);if(p.length===0)return i;for(let r=p.length-1;r>=0;r--)i=k(c,i,p[r],n);return i}function k(c,d,n,p){const i=n.locale!==void 0?n.locale:p.locale,r=D(i),f=n.descending!==void 0?!!n.descending:n.dir==="desc",m=[],u=[];for(const h of d){const w=I(c[h],n.col);U(w)?u.push(h):m.push(h)}const b=new Map;for(let h=0;h<m.length;h++)b.set(m[h],h);const a=(h,w)=>{const v=I(c[h],n.col),A=I(c[w],n.col);let H;return typeof n.compare=="function"?(H=n.compare(v,A,c[h],c[w],f),f&&(H=-H)):H=f?r(A,v):r(v,A),H!==0?H:b.get(h)-b.get(w)};return m.sort(a),n.nullsFirst?u.concat(m):m.concat(u)}function y(c,d,n={}){const p=[];for(let i=0;i<c.length;i++)l(c[i],d,n,i)&&p.push(i);return p}function l(c,d,n,p){if(!d)return!0;if(Array.isArray(d.conditions)){const i=d.conditions.filter(f=>f!=null);if(i.length===0)return!0;if(d.op==="or")return i.some(f=>l(c,f,n,p));const r=i.every(f=>l(c,f,n,p));return d.op==="not"?!r:r}return d.col===void 0&&typeof n.custom=="function"?!!n.custom(d,c,p):z(I(c,d.col),d,n.locale)}function g(c,d,n,p){const i=n||c.map((u,b)=>b),r=new Map,f=[],m=[];for(const u of i){const b=d.map((w,v)=>{const A=I(c[u],w);return p&&p[v]?p[v](A):A}),a=b.map(w=>w==null?X:String(w)).join(L);let h=r.get(a);h===void 0&&(h=f.length,r.set(a,h),f.push(b),m.push([])),m[h].push(u)}return{keys:f,buckets:m}}function s(c,d,n={}){const p=D(n.locale),i=c.filter(f=>!U(f)),r=i.map(t).filter(f=>f!==null);switch(d){case"count":return c.length;case"countValues":return i.length;case"sum":return r.reduce((f,m)=>f+m,0);case"avg":return i.length===0?null:r.reduce((f,m)=>f+m,0)/i.length;case"min":return i.length===0?null:i.reduce((f,m)=>p(m,f)<0?m:f);case"max":return i.length===0?null:i.reduce((f,m)=>p(m,f)>0?m:f);case"first":return c.length===0?null:o(c[0]);case"last":return c.length===0?null:o(c[c.length-1]);default:return null}}function t(c){if(typeof c=="number")return Number.isNaN(c)?null:c;if(c==null||c===""||typeof c=="boolean")return null;if(c instanceof Date)return c.getTime();const d=Number(c);return Number.isNaN(d)?null:d}function o(c){return c===void 0?null:c}}),ze("packages/core/src/compute/index.js",function(e,_){"use strict";const ne=_("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 E=_("packages/core/src/compute/sortspec.js");Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return E.collationDescriptor}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return E.isPortableSort}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return E.isPortableSortSet}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return E.describeSortEntry}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return E.describeSort}});const K=_("packages/core/src/compute/filter.js");Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return K.evaluateFilters}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return K.evaluateCondition}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return K.compact}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return K.testValue}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return K.compilePredicate}}),Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return K.releaseMask}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return K.pruneColumn}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return K.mentionsColumn}});const U=_("packages/core/src/compute/group.js");Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return U.groupByColumns}}),Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return U.packKeys}});const D=_("packages/core/src/compute/facet.js");Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return D.facet}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return D.computeBounds}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return D.countInto}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return D.bucketOf}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return D.facetKind}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return D.cardinalityOf}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return D.pickGranularity}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return D.floorTo}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return D.advance}}),Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return D.STRATEGIES}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return D.GRANULARITIES}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return D.DEFAULT_BUCKETS}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return D.DEFAULT_CARDINALITY_LIMIT}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return D.QUANTILE_SAMPLE}});const J=_("packages/core/src/compute/total.js");Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return J.TOTAL_FNS}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return J.TOTAL_LABELS}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return J.totalLabel}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return J.total}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return J.collectValues}});const z=_("packages/core/src/compute/pivot.js");Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return z.pivot}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return z.resolvePivotKeys}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return z.pivotKey}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return z.joinPath}}),Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return z.KEY_DELIMITER}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return z.DEFAULT_PATH_SEPARATOR}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return z.DEFAULT_MAX_COLUMNS}});const L=_("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return L.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return L.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return L.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return L.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return L.GRAND_PATH}});const X=_("packages/core/src/compute/reference.js");Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return X.referenceSort}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return X.referenceFilter}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return X.referenceGroup}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return X.referenceTotal}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return X.referencePasses}}),Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return X.referenceValue}});const I=_("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return I.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return I.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return I.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return I.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return I.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return I.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return I.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return I.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return I.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return I.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return I.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return I.isMissing}});const j=_("packages/core/src/compute/sketch.js");Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return j.Welford}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return j.Reservoir}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return j.HyperLogLog}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return j.SpaceSaving}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return j.KLL}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return j.hash32}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j.SKETCH_BOUNDS}});const k=_("packages/core/src/compute/windowed.js");Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return k.Window}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return k.WINDOW_KINDS}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return k.openWindow}});const y=_("packages/core/src/compute/statistics.js");Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return y.MAINTENANCE}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return y.APPROXIMATE}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return y.maintenanceOf}});const l=_("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return l.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return l.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return l.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return l.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return l.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return l.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return l.anomalyCondition}});const g=_("packages/core/src/compute/forecast.js");Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return g.FORECAST_METHODS}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return g.forecast}})}),ze("packages/core/src/source/rows.js",function(e,_){"use strict";Object.defineProperty(e,"DEFAULT_ROW_HEIGHT",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"KEY_SEP",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"groupPrefixKeys",{enumerable:!0,get:function(){return g}});const E=_("packages/core/src/internal/warn.js").warnOnce,U=_("packages/core/src/internal/predicates.js").isFunction,D=32,J="\0";function z(s){return new L(s)}class L{#e;#t;constructor(t){this.#e=U(t&&t.rowKey)?t.rowKey:null;const o=t&&t.config?t.config.rowHeight:void 0;this.#t=typeof o=="number"||U(o)?o:D}get keyed(){return this.#e!==null}keyOf(t,o){if(this.#e){const c=this.#e(t);if(c!=null)return String(c)}else E("source.rowKey.missing","no config.rowKey; falling back to index identity.","Row changes, streaming dedupe, selection persistence and remote reload are disabled.");return`#${o}`}heightOf(t){return U(this.#t)?Number(this.#t(t))||D:this.#t}leaf(t,o,c=0,d=null){const n={key:this.keyOf(t,o),data:t,level:c,parent:d,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:o};return n.height=this.heightOf(n),n}group(t){const o={key:l(t.keyPath||t.path),data:null,level:t.level,parent:t.parent||null,children:[],group:!0,expanded:t.expanded!==!1,leafCount:t.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:t.column,groupValue:t.value,groupPath:t.path,hasChildren:t.hasChildren!==!1};return t.totals&&(o.totals=t.totals),o.height=this.heightOf(o),o}footer(t){const o={key:`${t.key}${J}footer`,data:null,level:t.level,parent:t,group:!0,footer:!0,expanded:!1,leafCount:t.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:t.groupColumn,groupValue:t.groupValue,groupPath:t.groupPath,hasChildren:!1,totals:t.totals};return o.height=this.heightOf(o),o}detail(t,o){return{key:`${t.key}${J}detail`,data:t.data,level:t.level+1,parent:t,group:!1,detail:!0,expanded:!1,leafCount:0,height:o,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:t.key}}grandTotal(t,o){const c={key:`${J}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:o,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:t};return c.height=this.heightOf(c),c}skeleton(t,o=0,c=!1){const d={key:`${J}pending${J}${t}`,data:null,level:o,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:t,selected:!1,physical:null,pending:!0};return c&&(d.loadError=!0),d.height=this.heightOf(d),d}}function X(s,t,o,c){return{key:`${J}pinned${J}${o}${J}${t}`,data:s,level:0,parent:null,group:!1,expanded:!1,leafCount:0,height:c,index:null,selected:!1,physical:null,hasChildren:!1,pinned:o}}function I(s,t){return new Proxy([],{get(o,c,d){if(c==="length")return s();if(typeof c=="string"){const n=Number(c);if(Number.isInteger(n)&&n>=0)return t(n)}return Reflect.get(o,c,d)},has(o,c){if(typeof c=="string"){const d=Number(c);if(Number.isInteger(d)&&d>=0)return d<s()}return Reflect.has(o,c)}})}function j(s){return s==null?"":String(s)}const k="";function y(s){if(s==null)return k;const t=String(s);return t.startsWith(k)?k+t:t}function l(s){const t=s||[];let o="g";for(let c=0;c<t.length;c++)o+=J+y(t[c]);return o}function g(s){const t=new Array(s.length),o=[];for(let c=0;c<s.length;c++)o.push(s[c]),t[c]=l(o);return t}}),ze("packages/core/src/source/handles.js",function(e,_){"use strict";Object.defineProperty(e,"HandleProvider",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"createHandleProvider",{enumerable:!0,get:function(){return J}});const E=_("packages/core/src/internal/predicates.js").isFunction,U=_("packages/core/src/internal/warn.js").warnOnce;class D{#e;#t;#n;#r=new Map;#s=0;constructor(L,X,I){this.#e=L,this.#t=X,this.#n=E(I)?I:()=>!1}get store(){const L=this.#e.store;return L&&E(L.column)?L:null}invalidate(){this.#s++}handle(L){const X=this.store;if(X){const y=X.column(L);if(y)return y}const I=this.#r.get(L);if(I&&I.builtAt===this.#s)return I.handle;const j=this.#i(L);if(!j)return;if(X&&this.#n()){U(`source.dropped.${L}`,`column "${L}" cannot be served under ingest.dropSourceRows: it is an impure computed column (a shadow or a positional/rank column) that is never stored, so it can only be read from the caller's row objects — which dropSourceRows has released. Do not sort, filter, group or total on such a column with dropSourceRows enabled.`);return}const k=this.#o(j);return this.#r.set(L,{handle:k,builtAt:this.#s}),k}#i(L){const X=this.#e.columns;return X&&E(X.get)?X.get(L):void 0}#o(L){const X=this.#t()||[],I=X.length,j=new Array(I),k=E(L.getValue)?l=>L.getValue(l):l=>l?.[L.field||L.id];for(let l=0;l<I;l++)j[l]=X[l]===void 0?void 0:k(X[l]);const y=this.#s;return{id:L.id,kind:"object",nullable:!1,values:j,presence:null,dict:null,offsets:null,get(l){return j[l]},version:y}}}function J(z,L,X){return new D(z,L,X)}}),ze("packages/core/src/compute/incremental.js",function(e,_){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return X}});const E=_("packages/core/src/store/columnstore.js").toFloat,K=Object.freeze(["sum","avg","countValues","min","max"]),U=Object.freeze(["float64"]),D=1e15;function J(I,j){return typeof I!="string"||!K.includes(I)?!1:!!j&&U.includes(j.kind)}function z(I){if(I==null)return null;const j=E(I);return Number.isNaN(j)?null:j}class L{#e;#t=0;#n=0;#r=0;#s=1/0;#i=-1/0;#o=!1;#l=!1;constructor(j){this.#e=j}get valid(){return this.#o&&!this.#l}get fn(){return this.#e}seed(j){this.#a();for(let k=0;k<j.length;k++){const y=z(j[k]);y!==null&&this.#c(y)}this.#o=!0}seedColumn(j,k,y){this.#a();for(let l=0;l<y.length;l++){const g=y[l];if(k&&k(g)===0)continue;const s=j[g];Number.isNaN(s)||this.#c(s)}this.#o=!0}#a(){this.#t=0,this.#n=0,this.#r=0,this.#s=1/0,this.#i=-1/0,this.#l=!1}#c(j){if(!Number.isFinite(j)){this.#l=!0;return}const k=this.#t+j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-k+j:j-k+this.#t,this.#t=k,this.#r++,j<this.#s&&(this.#s=j),j>this.#i&&(this.#i=j)}#u(j){const k=this.#t-j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-k-j:-j-k+this.#t,this.#t=k,this.#r--}update(j,k){if(!this.#o)return!1;const y=z(j),l=z(k);return y===null&&l===null?!0:y!==null&&!Number.isFinite(y)||l!==null&&!Number.isFinite(l)?!1:this.#e==="min"||this.#e==="max"?y===null||l===null?!1:this.#e==="min"?l<this.#s?(this.#s=l,!0):y>this.#s:l>this.#i?(this.#i=l,!0):y<this.#i:Math.abs(this.#t)>D?!1:(y!==null&&this.#u(y),l!==null&&this.#c(l),!0)}value(){switch(this.#e){case"countValues":return this.#r;case"avg":return this.#r?(this.#t+this.#n)/this.#r:null;case"min":return this.#r?this.#s:null;case"max":return this.#r?this.#i:null;default:return this.#t+this.#n}}invalidate(){this.#o=!1}}const X=L}),ze("packages/core/src/source/filterwire.js",function(e,_){"use strict";Object.defineProperty(e,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"resolveRelativeRange",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"relativeTokenOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"relativeTokenHelp",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"isResolvableRelative",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"resolveRelativeCondition",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"forEachCondition",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"mapConditions",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"normaliseFilterSet",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"buildFilterSet",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"wireFilters",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"querySignature",{enumerable:!0,get:function(){return v}});const E=_("packages/core/src/internal/warn.js").warnOnce,K="source.remote.hostFilter",U="source.where.pageRelative";function D(G,Z){!Array.isArray(G)||!G.length||E(U,`filters.where (${G.join(", ")}) runs over the rows the ${Z} 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 J(G){const Z=(G||{}).config;!Z||!Z.hostFilter||E(K,"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 z="source.where.notApplied";function L(G,Z){E(`${z}:${G}`,`filters.where("${G}") is registered but the ${Z} source holds only its fetched window`,"and cannot run the predicate over it: the predicate is not applied there, and rows it would","exclude stay on screen.","Give it a { condition } twin so the engine can narrow the fetch itself — that is the","supported route for a paged or remote source.")}const X="source.where.overThreshold";function I(G,Z,M,S){!Array.isArray(G)||!G.length||E(`${X}:${Z}`,`filters.where (${G.join(", ")}) is not applied to the ${Z} pushdown source:`,M===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${M.toLocaleString()} rows, at or past the whereRowLimit of ${S.toLocaleString()}.`,"Running the predicate needs every matching row fetched and held here, which is the whole","download a pushdown source exists to avoid, so it is refused and the rows the predicate","would exclude stay on screen.","Give the predicate a { condition } twin so the engine narrows the fetch itself — that is the","route that works at any size — or raise `whereRowLimit` on the source config if you want the","download.")}const j=new Map;function k(G){let Z=j.get(G);return Z||(Z=new Intl.DateTimeFormat("en-US",{timeZone:G,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),j.set(G,Z)),Z}function y(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function l(G,Z){const M=k(Z).formatToParts(new Date(G)),S={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const T of M)T.type==="year"?S.y=+T.value:T.type==="month"?S.m=+T.value:T.type==="day"?S.d=+T.value:T.type==="hour"?S.h=+T.value%24:T.type==="minute"?S.mi=+T.value:T.type==="second"&&(S.s=+T.value);return S}function g(G,Z){const M=l(G,Z);return Date.UTC(M.y,M.m-1,M.d,M.h,M.mi,M.s)-Math.floor(G/1e3)*1e3}function s(G,Z,M,S){const T=Date.UTC(G,Z-1,M),O=T-g(T,S);return T-g(O,S)}function t(G,Z,M){const S=new Date(Date.UTC(G.y,G.m-1,G.d+Z));return s(S.getUTCFullYear(),S.getUTCMonth()+1,S.getUTCDate(),M)}const o=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function c(G,Z){if(typeof G!="string")return null;const M=G.trim().toLowerCase().replace(/[\s_-]+/g,""),S=/^last(\d*|n)days?$/.exec(M);if(S){const T=S[1]==="n"?"":S[1],O=Number(T||Z);return!Number.isFinite(O)||O<=0?null:{kind:"lastNDays",n:Math.floor(O)}}switch(M){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 d(G,Z={}){const M=c(G,Z.n);if(!M)return null;const S=Z.tz||y(),T=Z.now instanceof Date?Z.now.getTime():typeof Z.now=="number"?Z.now:Date.now(),O=l(T,S),N=s(O.y,O.m,O.d,S),P=t(O,1,S);let C=N,B=P;switch(M.kind){case"today":break;case"yesterday":C=t(O,-1,S),B=N;break;case"lastNDays":B=Z.includeToday?P:N,C=t(O,Z.includeToday?-(M.n-1):-M.n,S);break;case"thisWeek":{const x=Number.isFinite(Z.weekStartsOn)?Number(Z.weekStartsOn):1,Y=(new Date(Date.UTC(O.y,O.m-1,O.d)).getUTCDay()-x+7)%7;C=t(O,-Y,S),B=t(O,-Y+7,S);break}case"thisMonth":C=s(O.y,O.m,1,S),B=s(O.m===12?O.y+1:O.y,O.m===12?1:O.m+1,1,S);break;case"thisQuarter":case"quarterToDate":{const x=Math.floor((O.m-1)/3)*3+1;C=s(O.y,x,1,S),B=M.kind==="quarterToDate"?P:x===10?s(O.y+1,1,1,S):s(O.y,x+3,1,S);break}case"thisYear":case"yearToDate":C=s(O.y,1,1,S),B=M.kind==="yearToDate"?P:s(O.y+1,1,1,S);break;default:return null}return{from:new Date(C).toISOString(),to:new Date(B).toISOString(),bounds:"[)",tz:S,relative:M.kind==="lastNDays"?`last${M.n}Days`:M.kind,n:M.n}}function n(G){if(!G||typeof G!="object")return null;const Z=G.value;if(Z&&typeof Z=="object"&&!Array.isArray(Z)&&"relative"in Z)return{token:String(Z.relative),n:typeof Z.n=="number"?Z.n:void 0};if(G.op==="relative"&&typeof G.value=="string")return{token:G.value,n:void 0};const M=G.meta;return M&&typeof M.relative=="string"&&G.value===void 0?{token:M.relative,n:typeof M.n=="number"?M.n:void 0}:null}function p(){return`Known tokens: ${o.filter(Z=>Z!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function i(G){const Z=n(G);return Z?c(Z.token,Z.n)!==null:!1}function r(G,Z={}){const M=n(G);if(!M)return G;const S=d(M.token,{...Z,n:M.n});return S?{...G,type:G.type||"date",op:"between",value:[S.from,S.to],bounds:G.bounds||S.bounds,meta:{...G.meta||{},relative:S.relative,tz:S.tz}}:(E(`source.relative.${M.token}`,`unknown relative date token "${M.token}"; sending the condition unresolved.`,p()),G)}function f(G){return!!G&&typeof G=="object"&&Array.isArray(G.conditions)}function m(G,Z){if(G){if(f(G)){for(const M of G.conditions)m(M,Z);return}Z(G)}}function u(G,Z){if(!G)return null;if(!f(G))return Z(G);const M=G;let S=!1;const T=[];for(const O of M.conditions){const N=u(O,Z);N!==O&&(S=!0),N&&T.push(N)}return!S&&T.length===M.conditions.length?G:T.length?{...M,conditions:T}:null}function b(G){if(!G)return null;if(!f(G))return G;const Z=G,M=[];for(const S of Z.conditions){const T=b(S);T&&M.push(T)}return M.length?{op:Z.op,conditions:M}:null}function a(G){const Z=b(G);return Z?f(Z)&&Z.op==="and"?Z:{op:"and",conditions:[Z]}:null}function h(G){const Z=(G||[]).filter(Boolean);return Z.length?{op:"and",conditions:Z}:null}function w(G,Z={}){const M=u(G,S=>r(S,Z));return a(M)}function v(G){const Z=A(G.filters??null);return JSON.stringify([Z,G.sort??null,G.quick??"",G.groupBy??null,G.pivotBy??null,H(G.context)])}function A(G){if(!G)return null;if(f(G)){const S=G;return{op:S.op,conditions:S.conditions.map(A)}}const Z=G,M=Z.meta&&typeof Z.meta.relative=="string"?Z.meta.relative:n(Z)?.token;return{col:Z.col,op:Z.op,bounds:Z.bounds??null,caseSensitive:Z.caseSensitive??!1,value:M?`rel:${M}`:Z.value??null}}function H(G){if(G==null)return null;try{return JSON.parse(JSON.stringify(G))}catch{return E("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),ze("packages/core/src/source/tree.js",function(e,_){"use strict";Object.defineProperty(e,"SYNTHETIC",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"buildFromPath",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"assignLevels",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resolveTree",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"buildTree",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"indexTree",{enumerable:!0,get:function(){return l}});const E=_("packages/core/src/internal/predicates.js").isFunction,U=_("packages/core/src/internal/warn.js").warnOnce,D="",J="\0tree:";function z(g,s){return{physical:g,key:s,level:0,children:[],value:void 0}}function L(g,s){const t=[],o=new Map;for(let c=0;c<g.length;c++){const d=g[c],n=s.pathOf(d),p=Array.isArray(n)?n.map(r=>String(r)):[];if(!p.length){const r=z(d,s.keyOf(d));t.push(r);continue}let i=null;for(let r=0;r<p.length;r++){const f=p.slice(0,r+1).join(D),m=r===p.length-1;let u=o.get(f);u&&m&&u.physical===-1&&(u.physical=d,u.key=s.keyOf(d)),u||(u=z(m?d:-1,m?s.keyOf(d):J+f),u.level=r,u.value=p[r],o.set(f,u),i?i.children.push(u):t.push(u)),i=u}}return{roots:t,nodes:o}}function X(g,s){const t=new Map,o=[];for(let p=0;p<g.length;p++){const i=g[p],r=s.keyOf(i),f=z(i,r);t.set(r,f);const m=s.parentOf(i);m!=null&&m!==""&&o.push({node:f,parent:String(m)})}let c=null;const d=new Map;for(const{node:p,parent:i}of o){const r=t.get(i);if(r){d.set(p.key,r);continue}s.orphans&&s.orphans!=="root"&&(c||(c=z(-1,`${J}orphans`),c.value=s.orphans),d.set(p.key,c))}const n=[];for(const p of t.values()){const i=d.get(p.key);i?i.children.push(p):n.push(p)}return c&&c.children.length&&n.push(c),{roots:I(n,t,s.orphans,c),nodes:t}}function I(g,s,t,o){const c=new Set,d=[...g];for(;d.length;){const f=d.pop();if(!c.has(f.key)){c.add(f.key);for(const m of f.children)d.push(m)}}const n=[];for(const f of s.values())c.has(f.key)||n.push(f);if(!n.length)return g;const p=!!t&&t!=="root";U("tree.cycle",`tree.parentKey produced ${n.length} row(s) inside a parent cycle; `+(p?`they are shown under "${t}".`:"they are shown at the root."));for(const f of n)f.children=f.children.filter(m=>c.has(m.key));if(!p)return[...g,...n];let i=o;const r=[...g];return i||(i=z(-1,`${J}orphans`),i.value=t,r.push(i)),i.children.push(...n),r}function j(g){let s=0;const t=(o,c)=>{for(const d of o)d.level=c,c>s&&(s=c),d.children.length&&t(d.children,c+1)};return t(g,0),s}function k(g,s){if(!g||typeof g!="object")return null;const t=g.path,o=g.parentKey,c=E(g.hasChildren)?d=>!!g.hasChildren(s.dataAt(d)):null;if(E(t))return{mode:"path",pathOf:d=>t(s.dataAt(d)),keyOf:s.keyOf,declaresChildren:c};if(o!=null){const d=E(o)?o:n=>n?.[o];return{mode:"parentKey",parentOf:n=>d(s.dataAt(n)),keyOf:s.keyOf,orphans:g.orphans||"root",declaresChildren:c}}return U("tree.shape","tree is configured with neither `path` nor `parentKey`; rows stay flat."),null}function y(g,s){const t=s.mode==="path"?L(g,s):X(g,s),o=j(t.roots);return{...t,depth:o}}function l(g,s){const t=new Map,o=c=>{for(let d=0;d<c.length;d++){const n=c[d];if(n.physical>=0){const p=s?s(n.physical):!1,i=p&&n.children.length===0;t.set(n.physical,{level:n.level,posinset:d+1,setsize:c.length,hasChildren:n.children.length>0||p,lazy:i})}n.children.length&&o(n.children)}};return o(g),t}}),ze("packages/core/src/source/settle.js",function(e,_){"use strict";Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return E}});const ne=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function E(K){const U=K&&typeof K=="object"?K.reason:null;return typeof U=="string"&&ne.includes(U)}}),ze("packages/core/src/source/memory.js",function(e,_){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"quickMatcher",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"MemorySource",{enumerable:!0,get:function(){return Y}});const E=_("packages/core/src/internal/lru.js").Lru,K=_("packages/core/src/internal/warn.js"),U=K.warnOnce,D=K.fail,z=_("packages/core/src/internal/predicates.js").isFunction,X=_("packages/core/src/internal/compare.js").defaultCompare,j=_("packages/core/src/internal/merge.js").mergeRow,k=_("packages/core/src/source/rows.js"),y=k.createRowFactory,l=k.groupKey,g=k.groupPathElement,s=k.groupPrefixKeys,t=k.lazyRowView,c=_("packages/core/src/source/handles.js").createHandleProvider,d=_("packages/core/src/compute/incremental.js"),n=d.RunningTotal,p=d.isIncremental,r=_("packages/core/src/compute/handle.js").presenceReader,f=_("packages/core/src/source/filterwire.js"),m=f.querySignature,u=f.mapConditions,b=f.resolveRelativeCondition,a=_("packages/core/src/source/tree.js"),h=a.buildTree,w=a.resolveTree,v=a.indexTree,A=_("packages/core/src/source/settle.js"),H=A.PIPELINE_SETTLE_REASONS,G=A.isPipelineSettle,Z=Object.freeze(["filter","sort","group","total","pivot","flatten"]),M=Object.freeze([]);function S(F,$){if(!F)return null;const q=$==="grand"?F.grandTotal:F.groupTotal;return q??F.total}function T(F){return!!F&&!F.running}function O(F){if(F)return F.value&&z(F.value.compare)?F.value.compare:z(F.compare)?F.compare:void 0}function N(F){const $=F&&F.dataType;return!$||!z($.items)?null:{items:$.items,type:F.itemType&&F.itemType.name||"text"}}function P(F){return!!F&&(typeof F=="object"||typeof F=="function")&&z(F.then)}const C=new Uint32Array(0),B=4096;function x(F,$){return new Y(F,$)}function V(F,$){if($==="regex")try{const q=new RegExp(F,"iu");return ee=>q.test(ee)}catch{return q=>q.includes(F)}if($==="fuzzy"){const q=[...F].filter(ee=>ee!==" ");return q.length?ee=>{let te=0;for(let re=0;re<ee.length&&te<q.length;re++)ee[re]===q[te]&&te++;return te===q.length}:()=>!0}if($==="words"){const q=F.split(/\s+/).filter(Boolean);return q.length?ee=>q.every(te=>ee.includes(te)):()=>!0}return q=>q.includes(F)}class Y{mode="memory";#e;#t;#n;#r=!1;#s=null;#i;#o;#l=new Map;#a=!1;#c=0;#u=0;#d=new Map;#f=new Map;#h;#p=null;#m=Y.#g();static#g(){return{slots:[],groupHeadings:M,unnumbered:M,pivot:null,inlineLeaves:null,matchCount:0,grand:null,grandLeaves:0,groupLeaves:null}}#b=new Map;#y=null;#S=new Map;#w=-1;#A=[];#v=new Map;#P=-1;#O=[];#C=null;#E=null;#T=null;#M=null;#N=null;#R=null;#F=null;#W=null;#V=Symbol("unset");#x=new Map;#q=null;get#_(){return this.#m.slots}set#_($){this.#m.slots=$}get#Y(){return this.#m.inlineLeaves}set#Y($){this.#m.inlineLeaves=$}get#G(){return this.#m.groupHeadings}set#G($){this.#m.groupHeadings=$}get#I(){return this.#m.unnumbered}set#I($){this.#m.unnumbered=$}get#U(){return this.#m.pivot}set#U($){this.#m.pivot=$}constructor($,q){this.#t=$||{mode:"memory"},this.#e=q||{};const ee=this.#e.config||{};this.#n=this.#t.rows||ee.rows||[],this.#i=y(this.#e),this.#o=c(this.#e,()=>this.#n,()=>this.#r),this.#h=new E(Number(ee.rowCacheSize)||B);for(const te of Z)this.#l.set(te,{key:null,result:null,id:0,computed:!1})}count(){this.#B();const $=this.#ye();return $?$.length:this.#_.length}#ye(){const $=Number(this.#z("pageSize",0))||0;if($<=0)return null;const q=this.#_.length,ee=Math.max(1,Math.ceil(q/$)),re=Math.min(Math.max(0,Number(this.#z("page",0))||0),ee-1)*$;return{offset:re,length:Math.max(0,Math.min($,q-re))}}pageInfo(){this.#B();const $=Number(this.#z("pageSize",0))||0,q=this.#_.length;if($<=0)return{page:0,pageSize:0,total:q,pageCount:1};const ee=Math.max(1,Math.ceil(q/$));return{page:Math.min(Math.max(0,Number(this.#z("page",0))||0),ee-1),pageSize:$,total:q,pageCount:ee}}totalCount(){return this.#j().length}matchCount(){return this.#B(),this.#m.matchCount}at($){this.#B();const q=this.#ye();if(q)return $<0||$>=q.length?void 0:this.#Ee(q.offset+$,$);if(!($<0||$>=this.#_.length))return this.#Ee($,$)}byKey($){this.#B(),this.#p||this.#se();const q=this.#p.get($);if(q!==void 0)return this.#ae(q);for(let ee=0;ee<this.#_.length;ee++){const te=this.#_[ee];if(typeof te!="number"&&te&&te.key===$)return this.#Ee(ee)}}loaded($){return $>=0&&$<this.count()}hint($,q){}display(){return this.#B(),this.#q||(this.#q=this.#Fe()),this.#q}invalidateQuickText(){this.#x.clear(),this.invalidate("filter")}invalidate($){const q=Z.indexOf($);q<0&&D(`unknown pipeline stage "${$}"; expected one of ${Z.join(", ")}`);for(let ee=q;ee<Z.length;ee++){const te=this.#l.get(Z[ee]);te.key=null,te.computed=!1}this.#q=null}apply($){const q=[],ee={added:[],updated:[],removed:[],rejected:q};if(!$)return ee;let te=!1;const re=new Set;if($.remove&&$.remove.length)for(const ie of $.remove){const ue=this.#Le(ie);if(ue===void 0){q.push({operation:"remove",id:this.#me(ie),reason:"unknown-id"});continue}ee.removed.push(this.#i.keyOf(this.#r?this.#Pe(ue):this.#n[ue],ue)),this.#r||(this.#n[ue]=void 0),this.#h.delete(ue),this.#x.delete(ue),te=!0}if($.update&&$.update.length){const ie=this.#S.size||this.#vt()?this.#Ge():null,ue=this.#v.size?this.#lt():null,Ae=ue&&ue.length?this.#Ge():null;for(const de of $.update){const Oe=this.#Le(de);if(Oe===void 0){q.push({operation:"update",id:this.#Me(de),reason:"unknown-id"});continue}const Me=this.#r?this.#s&&this.#s.has(Oe)?this.#s.get(Oe):this.#Pe(Oe):this.#n[Oe],Fe=j(Me,de);for(const pe of this.#$e(Me,Fe))re.add(pe);if(this.#r||(this.#n[Oe]=Fe),ie&&this.#Qe(ie,Oe,Me,Fe),Ae&&this.#yt(ue,Ae,Oe,Me,Fe),this.#p){const pe=this.#i.keyOf(Me,Oe),ae=this.#i.keyOf(Fe,Oe);pe!==ae&&(this.#p.delete(pe),this.#p.set(ae,Oe))}this.#h.delete(Oe),this.#x.delete(Oe),ee.updated.push(this.#ae(Oe))}}if($.add&&$.add.length&&this.#r){typeof $.at=="number"&&$.at<this.#ct()&&(this.#h.clear(),this.#x.clear()),this.#p=null;for(const ie of $.add){const ue=this.#je(this.#Me(ie));ue!==void 0&&ee.added.push(this.#ae(ue))}te=!0}else if($.add&&$.add.length){let ie=typeof $.at=="number"?$.at:this.#n.length;if(ie<this.#n.length){let de=0;for(let Oe=0;Oe<this.#n.length;Oe++)this.#n[Oe]!==void 0&&de++;if(de!==this.#n.length){let Oe=0;for(let Me=0;Me<this.#n.length;Me++)this.#n[Me]!==void 0&&(this.#n[Oe++]=this.#n[Me]);this.#n.length=Oe,this.#p=null,this.#h.clear(),this.#x.clear()}}const ue=this.#n.length;ie=Math.max(0,ie);let Ae=$.add===this.#n?$.add.slice():$.add;if(this.#i.keyed){const de=[];for(const Oe of Ae){const Me=this.#Me(Oe);if(this.#Le(Me)!==void 0){q.push({operation:"add",id:Me,reason:"duplicate-id"});continue}de.push(Oe)}de.length!==Ae.length&&(Ae=de)}if(!Ae.length)return ee;if(ie>=ue)for(let de=0;de<Ae.length;de++)this.#n.push(Ae[de]);else this.#n.splice(ie,0,...Ae),this.#h.clear(),this.#x.clear();for(let de=0;de<Ae.length;de++)ee.added.push(this.#ae(ie>=ue?ue+de:ie+de));te=!0}return this.#c++,te&&(this.#p=null,this.#Ze()),this.#o.invalidate(),this.#q=null,te||this.#H(re)?(this.#u++,this.invalidate("filter")):this.invalidate("total"),this.#ut("rows:changed",{companion:!0,added:ee.added.length,updated:ee.updated.length,removed:ee.removed.length}),this.#s=null,ee}groupHeadingsAt($){this.#B();const q=this.#G;if(!q.length||!Number.isInteger($)||$<0)return M;let ee=0,te=q.length-1,re=-1;for(;ee<=te;){const ue=ee+te>>1;q[ue].at<=$?(re=ue,ee=ue+1):te=ue-1}if(re<0)return M;const ie=[];for(let ue=q[re].row;ue;ue=ue.parent)ie.push(ue);return ie.reverse(),ie}unnumberedRowCount($){this.#B();const q=this.#I;if(!q.length||!Number.isInteger($)||$<0)return 0;let ee=0,te=q.length-1,re=-1;for(;ee<=te;){const ie=ee+te>>1;q[ie].at<=$?(re=ie,ee=ie+1):te=ie-1}return re+1}moveRow($,q){if(this.#r)return U("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($)||!Number.isInteger(q))return!1;let te=0;for(let ue=0;ue<ee.length;ue++)ee[ue]!==void 0&&te++;if($<0||$>=te)return!1;const re=Math.max(0,Math.min(te-1,q));if(re===$)return!1;if(te!==ee.length){let ue=0;for(let Ae=0;Ae<ee.length;Ae++)ee[Ae]!==void 0&&(ee[ue++]=ee[Ae]);ee.length=ue}const[ie]=ee.splice($,1);return ee.splice(re,0,ie),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#x.clear(),this.#Ze(),this.#o.invalidate(),this.#q=null,this.invalidate("filter"),this.#ut("rows:changed",{companion:!0,added:0,updated:0,removed:0,moved:1}),!0}reload($){this.#ce(),this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#Ze(),this.#o.invalidate(),this.invalidate("filter"),this.#ut("model:changed",{reason:"reload"})}destroy(){this.#ce(),this.#h.clear(),this.#x.clear(),this.#p=null,this.#_=[],this.#Y=null,this.#q=null,this.#Ze();for(const $ of Z)this.#l.set($,{key:null,result:null,id:0,computed:!1})}#ce(){for(const{controller:$}of this.#b.values())try{$.abort()}catch{}this.#b.clear()}setRows($){this.#n=$||[],this.#r=!1,this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#Ze(),this.#o.invalidate(),this.invalidate("filter")}notePriorRows($){this.#s=$||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#x.clear(),this.#o.invalidate()}data(){if(!this.#r)return this.#n;const $=this.#e.store;if(!$||!z($.source))return this.#n;const q=$.physical||0,ee=new Array(q);for(let te=0;te<q;te++)ee[te]=$.live&&!$.live(te)?void 0:$.source(te);return ee}#ue(){const $=this.#z("detail",null);return!$||!z($.isOpen)||$.inline===!1?null:$}#Ne(){const $=(this.#e.config||{}).tree;return this.#V!==$&&(this.#V=$,this.#W=w($,{dataAt:q=>this.#Pe(q),keyOf:q=>this.#i.keyOf(this.#Pe(q),q)})),this.#W}#ie(){return(this.#e.config||{}).grandTotalRow==="bottom"}grandTotalRow(){if(!this.#ie())return null;this.#B();const $=this.#m.grand;return $?this.#i.grandTotal($,this.#qe(this.#m.grandLeaves)):null}pivot(){return this.#B(),this.#U}pivotMatrix(){this.#B();const $=this.#m.groupLeaves,q=(this.#e.compute||{}).pivotMatrix;if(!z(q))return null;const ee=this.#z("groupBy",[]),te=this.#z("pivotBy",[]);if(!ee.length&&!te.length)return U("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 re=this.#Ge().map(ue=>({colId:ue.id,handle:this.#o.handle(ue.id),fn:S(ue,"group")})).filter(ue=>ue.handle&&ue.fn),ie=this.#e.config||{};return q({rowHandles:ee.map(ue=>this.#o.handle(ue)).filter(Boolean),columnHandles:te.map(ue=>this.#o.handle(ue)).filter(Boolean),measures:re,leaves:$||new Uint32Array(0),opts:{locale:ie.locale,separator:(ie.pivot||{}).separator,maxColumns:(ie.pivot||{}).maxColumns}})}keysForLeaves($){const q=[];if(!$)return q;for(let ee=0;ee<$.length;ee++){const te=this.#ae($[ee]);te&&te.key!=null&&q.push(String(te.key))}return q}leavesOf($){this.#B();const q=this.#l.get("group"),ee=q&&q.result;if(!ee||!ee.nodes)return[];const te=ee.nodes.get($);if(!te)return[];const re=[],ie=ue=>{const Ae=ue.row&&ue.row.children;if(Ae&&Ae.length){for(const de of Ae){const Oe=ee.nodes.get(de.key);Oe&&ie(Oe)}return}if(ue.leaves)for(let de=0;de<ue.leaves.length;de++)re.push(this.#ae(ue.leaves[de]))};return ie(te),re}#me($){return typeof $=="string"?$:this.#Me($)}#Me($){try{return this.#i.keyOf($,-1)}catch{return"(unkeyed)"}}#Le($){if(typeof $=="string")return this.#je($);if(this.#i.keyed){const ee=this.#i.keyOf($,-1),te=this.#je(ee);if(te!==void 0)return te}if(this.#r)return;const q=this.#n.indexOf($);return q>=0?q:void 0}#je($){return this.#p||this.#se(),this.#p.get($)}#se(){this.#p=new Map;const $=this.#ct(),q=this.#e.store,ee=q&&z(q.live)?te=>q.live(te):null;for(let te=0;te<$;te++){if(ee&&!ee(te))continue;const re=this.#Pe(te);re!==void 0&&this.#p.set(this.#i.keyOf(re,te),te)}}#$e($,q){const ee=[];for(const te of this.#J())this.#Ke(te)&&this.#oe(te,$,q,new Set)&&ee.push(te);return ee}#oe($,q,ee,te){if(te.has($))return!1;te.add($);const re=this.#Ke($);if(!re)return!1;const ie=re.value&&re.value.deps;return Array.isArray(ie)&&ie.length?ie.some(ue=>this.#oe(String(ue),q,ee,te)):z(re.getValue)?!Object.is(re.getValue(q),re.getValue(ee)):!1}#J(){const $=new Set;for(const ee of this.#z("sort",[]))$.add(ee.col);for(const ee of this.#z("groupBy",[]))$.add(ee);const q=ee=>{if(ee){if(Array.isArray(ee.conditions)){ee.conditions.forEach(q);return}ee.col&&$.add(ee.col)}};return q(this.#z("filters",null)),[...$]}#H($){if(!$.size)return!1;if(this.#z("quick",""))return!0;for(const q of this.#J())if($.has(q))return!0;return!1}#B(){if(!this.#a){this.#a=!0;try{this.#Q()}finally{this.#a=!1}}}pipelineRunning(){return this.#a}#Q(){const $=this.#pe("filter",()=>this.#Z(),()=>this.#k()),q=this.#de($),ee=this.#pe("group",()=>this.#K(),()=>this.#We(q)),te=this.#pe("total",()=>this.#D(),()=>this.#Xe(ee));this.#pe("pivot",()=>this.#ve(),()=>this.#kt(ee)),this.#pe("flatten",()=>this.#Ae(),()=>this.#Mt(ee)),this.#he(ee,te)}#de($){const q=this.#l.get("sort"),ee=this.#ne();if(q.computed&&q.key===ee&&!this.#b.has("sort"))return q.result;const te=this.#b.get("sort");return te&&te.key===ee?q.result:q.result&&this.#ge($)?(this.#ke($,ee),q.result):this.#pe("sort",()=>ee,()=>this.#Ce($))}#le(){if(this.#y===null){const $=this.#e.pipelineWorker,q=z($)?$():null;this.#y=q||!1}return this.#y||null}#we(){const $=this.#z("sort",[]);if(!Array.isArray($)||!$.length)return null;const q=(this.#e.config||{}).locale,ee=[],te=[];for(const re of $){const ie=this.#Ke(re.col);if(ie&&ie.running)continue;if(ie&&ie.value&&z(ie.value.compare))return null;const ue=this.#o.handle(re.col);if(!ue)return null;ee.push({col:re.col,descending:re.dir==="desc",nullsFirst:!!re.nullsFirst,locale:q}),te.push(ue)}return ee.length?{entries:ee,handles:te,locale:q}:null}#ge($){if(this.#re())return!1;const q=this.#le();if(!q)return!1;const ee=Number(q.threshold);return Number.isFinite(ee)&&$.length<ee?!1:!!this.#we()}#ke($,q){const ee=this.#le(),te=ee&&this.#we();if(!te){this.#pe("sort",()=>q,()=>this.#Ce($));return}const re=new AbortController;this.#b.set("sort",{key:q,controller:re});const ie=te.entries.length===1?ee.sortColumn(te.handles[0],$,{descending:te.entries[0].descending,nullsFirst:te.entries[0].nullsFirst,locale:te.locale,signal:re.signal,key:"sort"}):ee.sortMulti(te.handles,te.entries.map((ue,Ae)=>({...ue,handle:te.handles[Ae]})),$,{signal:re.signal,key:"sort"});if(!P(ie)){this.#b.delete("sort"),this.#pe("sort",()=>q,()=>ie);return}ie.then(ue=>this.#De(q,ue),ue=>this.#fe("sort",q,ue))}#De($,q){const ee=this.#b.get("sort");if(!(!ee||ee.key!==$)){if(this.#ne()!==$){this.#b.delete("sort");return}this.#b.delete("sort"),this.#pe("sort",()=>$,()=>q),this.#q=null,this.#B(),this.#ut("model:changed",{reason:H[0]})}}#fe($,q,ee){const te=this.#b.get($);if(!(!te||te.key!==q)&&(this.#b.delete($),!(ee&&ee.name==="AbortError")&&$==="sort"&&this.#ne()===q)){const re=this.#pe("filter",()=>this.#Z(),()=>this.#k());this.#pe("sort",()=>q,()=>this.#Ce(re)),this.#q=null,this.#B(),U("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",ee),this.#ut("model:changed",{reason:H[1]})}}#he($,q){const ee=$&&$.leaves?$.leaves.length:this.#m.slots.length;this.#m.matchCount=ee,this.#m.grand=q&&q.grand||null,this.#m.grandLeaves=$&&$.leaves?$.leaves.length:0,this.#m.groupLeaves=$&&$.leaves?$.leaves:null}#pe($,q,ee){const te=this.#l.get($),re=q();return te.computed&&te.key===re||(te.result=ee(),te.key=re,te.computed=!0,te.id++,$==="flatten"&&(this.#q=null)),te.result}#$($){return this.#l.get($).id}#Z(){const $=(this.#e.config||{}).hostFilter,q=$&&z($.active)&&$.active()?1:0,ee=this.#z("where",null),te=ee?ee.version:0,re=this.#Ct("filter.sig",`${this.#nt()}`,()=>m({filters:this.#z("filters",null),quick:this.#z("quick",""),quickMode:this.#z("quickMode","contains")}));return`${this.#u}|${re}|${q}|${te}`}#ne(){const $=this.#re();return`${this.#$("filter")}|${JSON.stringify(this.#z("sort",[]))}`+($?`|manual:${$.version}`:"")}#re(){const $=this.#z("rowOrder",null);return $&&Array.isArray($.keys)?$:null}#_e($,q){this.#p||this.#se();const ee=this.#p,te=this.#ct(),re=q.keys.length,ie=new Float64Array(te);for(let ue=0;ue<te;ue++)ie[ue]=re+ue;for(let ue=0;ue<re;ue++){const Ae=ee.get(q.keys[ue]);Ae!==void 0&&(ie[Ae]=ue)}return Uint32Array.from($).sort((ue,Ae)=>ie[ue]-ie[Ae])}orderedKeys(){this.#p||this.#se();const $=this.#p,q=new Map;for(const[ue,Ae]of $)q.set(Ae,ue);const ee=Uint32Array.from([...q.keys()]).sort(),te=this.#re(),re=te?this.#_e(ee,te):this.#Ce(ee),ie=new Array(re.length);for(let ue=0;ue<re.length;ue++)ie[ue]=q.get(re[ue]);return ie}#K(){const $=this.#z("pivotBy",[]).length>0?"p":"u";return`${this.#$("sort")}|${JSON.stringify(this.#z("groupBy",[]))}|${$}`}#D(){const $=this.#te()?"f":"a",q=(this.#e.config||{}).totalOnlyChangedColumns?"n":"w";return`${this.#$("group")}|${JSON.stringify(this.#z("totals",[]))}|${$}${q}|${this.#c}`}#ve(){return`${this.#$("group")}|${JSON.stringify(this.#z("pivotBy",[]))}`}#Ae(){const q=this.#He()||!this.#ie()?this.#$("total"):"x",ee=`${this.#nt()}`,te=this.#Ct("flatten.keys",ee,()=>{const ie=this.#z("expanded",null);return ie?[...ie].sort().join(""):"*"}),re=this.#Ct("flatten.detail",ee,()=>{const ie=this.#z("detail",null);return ie&&z(ie.signature)?ie.signature():""});return`${q}|${this.#$("pivot")}|${te}|${re}`}#He(){const $=this.#z("groupBy",[]);return Array.isArray($)&&$.length>0}stageState(){const $=[];for(const[q,ee]of this.#l){const te=ee.result;$.push({stage:q,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 $}facetIndices($){return this.#k($||null)}facetRows($){const q=this.facetIndices($),ee=[];for(let te=0;te<q.length;te++){const re=this.#ae(q[te]);re&&ee.push(re)}return ee}invalidateRows(){this.#h.clear(),this.#x.clear(),this.#q=null}invalidateHandles(){this.#o.invalidate()}rows(){return this.#n}unfilteredIndices(){return this.#j()}filteredIndices(){const $=this.#l.get("filter");if($&&$.computed&&$.key===this.#Z())return $.result||this.#j();this.#B();const q=this.#l.get("filter");return(q&&q.computed?q.result:null)||this.#j()}unfilteredRows(){const $=this.#j(),q=[];for(let ee=0;ee<$.length;ee++){const te=this.#ae($[ee]);te&&q.push(te)}return q}#k($=null){const q=this.#j(),ee=this.#z("filters",null),te=$?this.#rt("pruneColumn")(ee,$):ee,re=this.#Rt(te),ie=String(this.#z("quick","")||"").trim().toLowerCase(),ue=ie?V(ie,String(this.#z("quickMode","contains")||"contains")):null,Ae=(this.#e.config||{}).hostFilter,de=!!(Ae&&z(Ae.active)&&Ae.active()),Oe=this.#z("where",null),Me=!!(Oe&&Oe.active);if(!re&&!ie&&!de&&!Me)return q;let Fe=null;re&&(Fe=this.#rt("evaluateFilters")(re,{handle:ve=>this.#o.handle(ve),count:this.#ct(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:ve=>N(this.#Ke(ve))}));const pe=new Uint32Array(q.length);let ae=0;for(let ge=0;ge<q.length;ge++){const ve=q[ge];if(!(Fe&&!Fe[ve])&&!(ue&&!this.#ot(ve,ue))){if(de||Me){const le=this.#ae(ve);if(de&&!Ae.passes(le)||Me&&!Oe.passes(le.data,le.key))continue}pe[ae++]=ve}}if(Fe){const ge=(this.#e.compute||{}).releaseMask;z(ge)&&ge({pool:this.#e.pool},Fe)}return pe.subarray(0,ae)}handleFor($){return this.#o.handle($)}#Ce($){const q=this.#re();if(q)return this.#_e($,q);const ee=this.#z("sort",[]).filter(ie=>{const ue=this.#Ke(ie.col);return!ue||!ue.running?!0:(U(`source.sort.running.${ie.col}`,`sort ignores "${ie.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 $;const te=(this.#e.config||{}).locale;if(ee.length===1){const ie=ee[0],ue=this.#o.handle(ie.col);if(!ue)return U(`source.sort.${ie.col}`,`sort ignores unknown column "${ie.col}".`),$;const Ae=this.#Ke(ie.col);return this.#rt("sortColumn")(ue,$,{descending:ie.dir==="desc",nullsFirst:ie.nullsFirst,locale:te,compare:O(Ae)})}const re=[];for(const ie of ee){const ue=this.#o.handle(ie.col);if(!ue){U(`source.sort.${ie.col}`,`sort ignores unknown column "${ie.col}".`);continue}re.push({handle:ue,descending:ie.dir==="desc",nullsFirst:ie.nullsFirst,locale:te,compare:O(this.#Ke(ie.col))})}return re.length?this.#rt("sortMulti")(re.map(ie=>ie.handle),re,$):$}#We($){const q=this.#z("groupBy",[]),ee=this.#Ne();if(ee&&!q.length){const ge=h($,ee);return this.#R=v(ge.roots,ee.declaresChildren),{roots:null,leaves:$,nodes:new Map,tree:ge}}if(this.#R=null,ee&&q.length&&U("tree.grouped","grouping is active on a grid configured with `tree`; the grouping wins and the hierarchy is not shown."),!q.length)return{roots:null,leaves:$,nodes:new Map};const te=(this.#e.config||{}).timeZone,re=[],ie=[];let ue=!1;for(const ge of q){const ve=this.#o.handle(ge);if(!ve){U(`source.group.${ge}`,`grouping ignores unknown column "${ge}".`);continue}re.push(ve);const le=this.#Ke(ge),we=le&&le.dataType;if(we&&z(we.groupProjector)){const he=le.typeOptions&&le.typeOptions.timeZone||te||void 0,be=we.groupProjector(le,he);ie.push(be||null),be&&(ue=!0)}else ie.push(null)}if(!re.length)return{roots:null,leaves:$,nodes:new Map};const{keys:Ae,buckets:de}=this.#rt("groupByColumns")(re,$,{locale:(this.#e.config||{}).locale,project:ue?ie:void 0}),Oe=this.#z("pivotBy",[]).length>0,Me=[],Fe=new Map;for(let ge=0;ge<de.length;ge++){const ve=Ae[ge];let le=null;const we=[];for(let he=0;he<ve.length;he++){we.push(g(ve[he]));const be=l(we),Te=he===ve.length-1;let je=Fe.get(be);if(!je){const ke=this.#i.group({path:[...we],column:q[he],value:ve[he],level:he,parent:le,expanded:Oe&&Te?!1:this.#tt(be,{key:be,column:q[he],value:ve[he],level:he,path:[...we]}),hasChildren:!(Oe&&Te)});je={row:ke,leaves:null},Fe.set(be,je),le?le.children.push(ke):Me.push(ke)}je.row.leafCount+=de[ge].length,he===ve.length-1&&(je.leaves=de[ge]),le=je.row}}const pe=this.#z("sort",[])||[],ae=(ge,ve)=>{if(!ge||ge.length<2){if(ge)for(const be of ge)ae(be.children,ve+1);return}const le=q[ve],we=pe.find(be=>be.col===le),he=we&&we.dir==="desc"?-1:1;ge.sort((be,Te)=>he*X(be.groupValue,Te.groupValue));for(const be of ge)ae(be.children,ve+1)};return ae(Me,0),{roots:Me,leaves:$,nodes:Fe,keys:Ae,buckets:de}}#Ye($,q){const ee=new Map,te=new Map,re=ie=>{const ue=ie.physical>=0?[ie.physical]:[];for(const Ae of ie.children)ue.push(...re(Ae));if(ie.children.length){const Ae=this.#Je(q,Uint32Array.from(ue),null);ie.physical>=0?ee.set(ie.physical,Ae):te.set(ie.key,Ae)}return ue};for(const ie of $.roots)re(ie);return{byPhysical:ee,byKey:te}}#Xe($){const q=this.#Ge();if(!q.length)return this.#E=null,this.#T=null,{grand:null};const ee={id:this.#$("group"),columns:q.map(pe=>pe.id).join("")},te=this.#E&&this.#E.id===ee.id&&this.#E.columns===ee.columns,re=this.#vt()&&te?this.#C:null,ie=re?q.filter(pe=>re.has(pe.id)):q,ue=te?this.#T:null,Ae=this.#te()?null:this.#wt(),de=this.#Se(q),Oe=pe=>{const ae=$.nodes.get(pe.key);let ge=ae&&ae.leaves?ae.leaves:null;if(pe.children&&pe.children.length){const we=pe.children.map(Oe);let he=0;for(const je of we)he+=je.length;const be=new Uint32Array(he);let Te=0;for(const je of we)be.set(je,Te),Te+=je.length;ge=be}ge=ge||new Uint32Array(0);const ve=Ae?Ae.get(pe.key)||C:ge,le=this.#dt(pe,re?ie:q,ve,de);return pe.totals=re?{...pe.totals,...le}:le,ge};if($.roots&&ie.length)for(const pe of $.roots)Oe(pe);if(this.#F=$.tree?this.#Ye($.tree,q):null,this.#E=ee,this.#C=this.#vt()?new Set:null,!(this.#e.config||{}).grandTotalRow)return this.#A.length=0,this.#T=null,{grand:null};const Fe=Ae?this.#ft():$.leaves;return this.#T=this.#Be(q,Fe,re,ue),{grand:this.#T}}#Be($,q,ee,te){const re={},ie=this.#$("group");ie!==this.#w&&(this.#ht(),this.#w=ie);const ue=this.#A;this.#A=[];for(const Ae of $){if(!T(Ae))continue;const de=this.#o.handle(Ae.id);if(!de)continue;const Oe=S(Ae,"grand");if(!p(Oe,de)){if(ee&&!ee.has(Ae.id)&&te&&Ae.id in te){re[Ae.id]=te[Ae.id];continue}re[Ae.id]=this.#Je([Ae],q,null,"grand")[Ae.id];continue}let Me=this.#S.get(Ae.id);if((!Me||Me.fn!==Oe)&&(Me=new n(Oe),this.#S.set(Ae.id,Me)),Me.valid){let Fe=!0;for(const pe of ue)if(pe.colId===Ae.id&&!Me.update(pe.before,pe.after)){Fe=!1;break}if(Fe){re[Ae.id]=Me.value();continue}Me.invalidate()}Me.seedColumn(de.values,r(de),q),re[Ae.id]=Me.valid?Me.value():this.#Je([Ae],q,null,"grand")[Ae.id]}return re}#Se($){const q=this.#$("group");q!==this.#P&&(this.#v.clear(),this.#P=q);const ee=new Map;for(const re of $){if(!T(re))continue;const ie=this.#o.handle(re.id),ue=S(re,"group");p(ue,ie)&&ee.set(re.id,{fn:ue})}if(!ee.size)return this.#O.length=0,ee;const te=this.#O;this.#O=[];for(const re of te){const{beforeKeys:ie,afterKeys:ue,colDeltas:Ae}=re,de=ie.length?new Set(ie):null,Oe=ue.length?new Set(ue):null;for(const{colId:Me,before:Fe,after:pe}of Ae)if(ee.has(Me)){for(const ae of ie)Oe&&Oe.has(ae)||this.#Oe(ae,Me,Fe,null);for(const ae of ue)de&&de.has(ae)||this.#Oe(ae,Me,null,pe);for(const ae of ie)Oe&&!Oe.has(ae)||this.#Oe(ae,Me,Fe,pe)}}return ee}#Oe($,q,ee,te){const re=this.#v.get($),ie=re&&re.get(q);!ie||!ie.valid||ie.update(ee,te)||ie.invalidate()}#dt($,q,ee,te){if(!te||!te.size)return this.#Je(q,ee,$);const re={};let ie=null,ue=this.#v.get($.key);for(const Ae of q){const de=te.get(Ae.id);if(!de){(ie||(ie=[])).push(Ae);continue}const Oe=this.#o.handle(Ae.id);if(!Oe)continue;ue||(ue=new Map,this.#v.set($.key,ue));let Me=ue.get(Ae.id);if((!Me||Me.fn!==de.fn)&&(Me=new n(de.fn),ue.set(Ae.id,Me)),Me.valid||Me.seedColumn(Oe.values,r(Oe),ee),Me.valid){re[Ae.id]=Me.value();continue}(ie||(ie=[])).push(Ae)}return ie&&Object.assign(re,this.#Je(ie,ee,$)),re}#Qe($,q,ee,te){const re=!this.#te()||this.#et(q);for(const ie of $){const ue=ie.getValue;if(!z(ue))continue;const Ae=ue(ee),de=ue(te);Object.is(Ae,de)||(this.#C&&this.#C.add(ie.id),re&&this.#S.has(ie.id)&&this.#A.push({colId:ie.id,before:Ae,after:de}))}}#lt(){const $=this.#z("groupBy",[]),q=[];for(const ee of $){const te=this.#Ke(ee);te&&q.push(te)}return q}#Ve($,q){const ee=new Array($.length);for(let te=0;te<$.length;te++){const re=$[te].getValue;ee[te]=g(z(re)?re(q):void 0)}return ee}#yt($,q,ee,te,re){if(this.#te()&&!this.#et(ee))return;const ie=s(this.#Ve($,te)),ue=s(this.#Ve($,re)),Ae=ie.length!==ue.length||ie.some((Oe,Me)=>Oe!==ue[Me]),de=[];for(const Oe of q){const Me=Oe.getValue;if(!z(Me))continue;const Fe=Me(te),pe=Me(re);!Ae&&Object.is(Fe,pe)||de.push({colId:Oe.id,before:Fe,after:pe})}!de.length&&!Ae||this.#O.push({beforeKeys:ie,afterKeys:ue,colDeltas:de})}#et($){const q=this.#l.get("filter"),ee=q&&q.computed?q.result:null;if(!ee)return!0;let te=0,re=ee.length-1;for(;te<=re;){const ie=te+re>>1,ue=ee[ie];if(ue===$)return!0;ue<$?te=ie+1:re=ie-1}return!1}#te(){return(this.#e.config||{}).totalFilteredOnly!==!1}#qe($){return this.#te()?$:this.#ft().length}#ft(){return(!this.#M||this.#M.version!==this.#u)&&(this.#M={version:this.#u,indices:this.#j()}),this.#M.indices}#wt(){const $=this.#z("groupBy",[]),q=`${this.#u}|${JSON.stringify($)}`;if(this.#N&&this.#N.key===q)return this.#N.map;const ee=new Map,te=[];for(const re of $){const ie=this.#o.handle(re);ie&&te.push(ie)}if(te.length){const re=this.#ft(),{keys:ie,buckets:ue}=this.#rt("groupByColumns")(te,re,{locale:(this.#e.config||{}).locale}),Ae=new Map;for(let de=0;de<ue.length;de++){const Oe=ie[de],Me=[];for(let Fe=0;Fe<Oe.length;Fe++){Me.push(g(Oe[Fe]));const pe=l(Me);let ae=Ae.get(pe);ae||(ae=[],Ae.set(pe,ae));for(let ge=0;ge<ue[de].length;ge++)ae.push(ue[de][ge])}}for(const[de,Oe]of Ae)ee.set(de,Uint32Array.from(Oe))}return this.#N={key:q,map:ee},ee}#vt(){return!!(this.#e.config||{}).totalOnlyChangedColumns}#Ze(){this.#ht(),this.#ze(),this.#C=null,this.#E=null,this.#T=null}#ht(){this.#S.clear(),this.#A.length=0,this.#w=-1}#ze(){this.#v.clear(),this.#O.length=0,this.#P=-1}#kt($){const q=this.#z("pivotBy",[]);if(!q.length)return this.#U=null,null;const ee=(this.#e.compute||{}).pivot;if(!z(ee))return U("source.pivot.kernel","pivot requested but ctx.compute.pivot is not available; showing unpivoted rows."),this.#U=null,null;const te=q.map(ie=>this.#o.handle(ie)).filter(Boolean),re=this.#Ge();return this.#U=ee(te,$.leaves,{groups:$.keys&&$.buckets?{keys:$.keys,buckets:$.buckets}:null,totals:re.map(ie=>ie.id),handle:ie=>this.#o.handle(ie),totalOf:ie=>S(re.find(ue=>ue.id===ie),"group"),separator:((this.#e.config||{}).pivot||{}).separator,maxColumns:((this.#e.config||{}).pivot||{}).maxColumns})||null,this.#U}#Mt($){const q=this.#l.get("total").result,ee=!!(this.#e.config||{}).groupFooter,te=this.#ue();if($.tree)return this.#Re($,q,te);if(!$.roots&&!te){if(q&&q.grand&&!this.#ie()){const Oe=this.#i.grandTotal(q.grand,this.#qe($.leaves.length));if(this.#Y===$.leaves&&Array.isArray(this.#_))this.#_[this.#_.length-1]=Oe;else{const Me=Array.from($.leaves);Me.push(Oe),this.#_=Me,this.#Y=$.leaves}this.#I=[{at:this.#_.length-1}]}else this.#Y=null,this.#_=$.leaves,this.#I=M;return this.#G=M,this.#_}const re=[],ie=[],ue=[],Ae=Oe=>{if(re.push(Oe),!te)return;const Me=this.#ae(Oe);!Me||!te.isOpen(Me.key)||(Me.master=!0,Me.expanded=!0,ue.push({at:re.length}),re.push(this.#i.detail(Me,te.heightOf(Me))))};if(!$.roots){for(let Oe=0;Oe<$.leaves.length;Oe++)Ae($.leaves[Oe]);return q&&q.grand&&!this.#ie()&&(ue.push({at:re.length}),re.push(this.#i.grandTotal(q.grand,this.#qe($.leaves.length)))),this.#Y=null,this.#G=M,this.#I=ue.length?ue:M,this.#_=re,re}const de=(Oe,Me,Fe)=>{if(Oe.expanded=Oe.hasChildren===!1?!1:this.#tt(Oe.key,{key:Oe.key,column:Oe.groupColumn,value:Oe.groupValue,level:Oe.level,path:Oe.groupPath}),Oe.posinset=Me+1,Oe.setsize=Fe,ie.push({at:re.length,row:Oe}),ue.push({at:re.length}),re.push(Oe),!!Oe.expanded){if(Oe.children&&Oe.children.length)for(let pe=0;pe<Oe.children.length;pe++)de(Oe.children[pe],pe,Oe.children.length);else{const pe=$.nodes.get(Oe.key),ae=pe&&pe.leaves?pe.leaves:null;if(ae)for(let ge=0;ge<ae.length;ge++)Ae(ae[ge])}ee&&Oe.totals&&(ue.push({at:re.length}),re.push(this.#i.footer(Oe)))}};for(let Oe=0;Oe<$.roots.length;Oe++)de($.roots[Oe],Oe,$.roots.length);return q&&q.grand&&!this.#ie()&&(ue.push({at:re.length}),re.push(this.#i.grandTotal(q.grand,this.#qe($.leaves.length)))),this.#G=ie,this.#I=ue,this.#_=re,re}#j(){const $=this.#e.store;if($&&z($.liveIndices))return $.liveIndices();const q=new Uint32Array(this.#n.length);let ee=0;for(let te=0;te<this.#n.length;te++)this.#n[te]!==void 0&&(q[ee++]=te);return q.subarray(0,ee)}#ct(){const $=this.#e.store;return $&&typeof $.physical=="number"?$.physical:this.#n.length}#Pe($){const q=this.#e.store;return q&&z(q.source)?q.source($):this.#n[$]}#Ee($,q=$){const ee=this.#_[$];if(typeof ee!="number")return ee.index=q,ee;const te=this.#ae(ee);return te.index=q,te}#ae($){let q=this.#h.get($);q||(q=this.#i.leaf(this.#Pe($),$),this.#h.set($,q));const ee=this.#R?this.#R.get($):null;if(ee){q.level=ee.level,q.posinset=ee.posinset,q.setsize=ee.setsize,q.hasChildren=ee.hasChildren,q.expanded=ee.hasChildren&&!ee.lazy&&this.#tt(q.key);const te=this.#F?this.#F.byPhysical.get($):void 0;te?q.totals=te:q.totals&&(q.totals=null)}else q.hasChildren&&(q.level=0,q.hasChildren=!1,q.expanded=!1,q.posinset=void 0,q.setsize=void 0);return q}#Re($,q,ee){const te=[],re=[],ie=Ae=>{if(Ae.leafCount!==void 0)return Ae.leafCount;let de=Ae.physical>=0?1:0;for(const Oe of Ae.children)de+=ie(Oe);return Ae.leafCount=de,de},ue=Ae=>{const de=this.#tt(Ae.key);if(Ae.physical>=0){if(te.push(Ae.physical),ee&&ee.isOpen(this.#ae(Ae.physical).key)){const Oe=this.#ae(Ae.physical);re.push({at:te.length}),te.push(this.#i.detail(Oe,ee.heightOf(Oe)))}}else te.push(this.#i.group({path:[Ae.key],column:null,value:Ae.value,level:Ae.level,parent:null,expanded:de,hasChildren:Ae.children.length>0,leafCount:ie(Ae),totals:this.#F?this.#F.byKey.get(Ae.key):void 0}));if(de)for(const Oe of Ae.children)ue(Oe)};for(const Ae of $.tree.roots)ue(Ae);return q&&q.grand&&!this.#ie()&&(re.push({at:te.length}),te.push(this.#i.grandTotal(q.grand,this.#qe($.leaves.length)))),this.#Y=null,this.#G=M,this.#I=re.length?re:M,this.#_=te,te}#Fe(){return t(()=>this.count(),$=>this.at($))}#ot($,q){let ee=this.#x.get($);if(ee===void 0){const te=this.#Pe($),re=this.#mt(),ie=[],ue=this.#e.columnHidden;for(const Ae of re){if(Ae.quickFilter===!1||z(ue)&&ue(Ae.id))continue;const de=Ae.value&&z(Ae.value.quickFilterText)?Ae.value.quickFilterText({value:void 0,data:te,row:null,column:Ae,colId:Ae.id,grid:null,context:this.#z("context",null)}):null,Oe=de??(z(Ae.formatValue)?Ae.formatValue(z(Ae.getValue)?Ae.getValue(te):void 0):"");Oe!=null&&Oe!==""&&ie.push(String(Oe))}ee=ie.join(" ").toLowerCase(),this.#x.set($,ee)}return q(ee)}#Ge(){const $=this.#z("totals",[]),q=$&&$.length?new Set($):null;return this.#mt().filter(ee=>q?q.has(ee.id):!!(ee.total||ee.groupTotal||ee.grandTotal))}#Je($,q,ee,te="group"){const re={},ie=(this.#e.compute||{}).total;for(const ue of $){if(!T(ue))continue;const Ae=this.#o.handle(ue.id);if(!Ae)continue;const de=S(ue,te);if(de)if(z(de)){const Oe=new Array(q.length);for(let Me=0;Me<q.length;Me++)Oe[Me]=Ae.get(q[Me]);re[ue.id]=de(Oe,{row:ee,column:ue,grid:this.#e.grid||null,context:this.#z("context",null),valueAt:(Me,Fe)=>{const pe=this.#o.handle(Me);return pe&&Fe>=0&&Fe<q.length?pe.get(q[Fe]):null}})}else z(ie)&&(re[ue.id]=ie(Ae,q,de))}return re}#Rt($){if(!$)return $;const q=this.#e.config||{},ee={tz:q.timeZone,weekStartsOn:q.weekStartsOn};return u($,te=>{const re=b(te,ee),ie=this.#Ke(re&&re.col),ue=ie&&ie.type==="datetime";if(re&&re.type)return re.type==="datetime"&&!re.timeZone&&ie?{...re,timeZone:q.timeZone||void 0}:re;if(ue)return{...re,type:"datetime",timeZone:q.timeZone||void 0};const Ae=ie&&(ie.dataType?.base||ie.type);return Ae?{...re,type:Ae}:re})}#tt($,q){const ee=this.#z("expanded",null);return ee?z(ee.has)?ee.has($,q):Array.prototype.includes.call(ee,$):!0}#z($,q){if($==="context"||!z(this.#e.stateVersion))return this.#jt($,q);const ee=this.#pt($),te=this.#d.get($);if(te&&te.version===ee)return te.value;const re=this.#jt($,q);return this.#d.set($,{version:ee,value:re}),re}#jt($,q){const ee=this.#e.state;if(ee&&z(ee[$])){const te=ee[$]();return te??q}return q}#nt(){const $=this.#e.stateVersion;return z($)?$():0}#It(){const $=this.#e.columnsVersion,q=this.#e.permissionsVersion;return`${z($)?$():0}|${z(q)?q():0}`}#pt($){return $==="totals"?this.#It():`${this.#nt()}`}#Ct($,q,ee){if(!z(this.#e.stateVersion))return ee();const te=this.#f.get($);if(te&&te.version===q)return te.key;const re=ee();return this.#f.set($,{version:q,key:re}),re}#rt($){const q=(this.#e.compute||{})[$];return z(q)||D(`ctx.compute.${$} is required by the memory source pipeline`),q}#mt(){const $=this.#e.columns;return $&&z($.all)?$.all():[]}#Ke($){const q=this.#e.columns;return q&&z(q.get)?q.get($):void 0}#ut($,q){const ee=this.#e.emit;z(ee)&&ee($,q)}}}),ze("packages/core/src/source/abort.js",function(e,_){"use strict";Object.defineProperty(e,"SupersededError",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"RequestToken",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"AbortScope",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createAbortScope",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return D}});class ne extends Error{constructor(z,L="superseded"){super(`[lattice] request ${z?`"${z}" `:""}${L}`),this.name="SupersededError",this.superseded=!0,this.key=z}}class E{#e;constructor(z,L,X,I){this.#e=z,this.key=L,this.controller=X,this.signal=X.signal,this.seq=I}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(z){this.signal.aborted||this.controller.abort(new ne(this.key,z)),this.#e.settle(this)}}class K{#e=new Map;#t=0;begin(z="",L="superseded"){const X=this.#e.get(z);X&&!X.signal.aborted&&X.controller.abort(new ne(z,L));const I=new E(this,z,new AbortController,++this.#t);return this.#e.set(z,I),I}tokenFor(z){return this.#e.get(z)}pending(z=""){const L=this.#e.get(z);return!!L&&!L.signal.aborted}get size(){return this.#e.size}settle(z){this.#e.get(z.key)===z&&this.#e.delete(z.key)}abort(z="",L="superseded"){const X=this.#e.get(z);X&&X.abort(L)}abortAll(z="superseded"){for(const L of[...this.#e.values()])L.abort(z);this.#e.clear()}}function U(){return new K}function D(J){if(!J||typeof J!="object")return!1;const z=J;return z.superseded===!0||z.name==="AbortError"||z.name==="SupersededError"}}),ze("packages/core/src/source/blockcache.js",function(e,_){"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 E}}),Object.defineProperty(e,"BlockCache",{enumerable:!0,get:function(){return U}});const ne=100,E=32;class K{constructor(J){this.id=J,this.rows=null,this.state="pending",this.token=null,this.error=null}}class U{#e=new Map;#t;#n;#r=0;#s=-1;constructor(J={}){this.#t=Math.max(1,Math.floor(Number(J.pageSize)||ne)),this.#n=Math.max(1,Math.floor(Number(J.maxCachedPages)||E))}get pageSize(){return this.#t}get maxBlocks(){return this.#n}get size(){return this.#e.size}blockOf(J){return Math.floor(J/this.#t)}rangeOf(J){return{start:J*this.#t,end:(J+1)*this.#t}}has(J){return this.#e.has(J)}pending(J){const z=this.#e.get(J);return!!z&&z.state==="pending"}loaded(J){const z=this.#e.get(J);return!!z&&z.state==="loaded"}begin(J,z){let L=this.#e.get(J);return L||(L=new K(J)),L.state="pending",L.token=z,L.error=null,this.#i(J,L),L}fill(J,z){const L=this.#e.get(J)||new K(J);L.rows=z,L.state="loaded",L.token=null,this.#i(J,L)}failed(J,z){const L=this.#e.get(J)||new K(J);L.state="error",L.error=z,L.token=null,this.#i(J,L)}delete(J){return this.#e.delete(J)}rowAt(J){const z=this.blockOf(J),L=this.#e.get(z);if(!(!L||L.state!=="loaded"||!L.rows))return this.#i(z,L),L.rows[J-z*this.#t]}rowLoaded(J){const z=this.blockOf(J),L=this.#e.get(z);return!!L&&L.state==="loaded"&&!!L.rows&&J-z*this.#t<L.rows.length}erroredAt(J){const z=this.#e.get(this.blockOf(J));return!!z&&z.state==="error"}loadedExtent(){let J=0;for(const z of this.#e.values()){if(z.state!=="loaded"||!z.rows)continue;const L=z.id*this.#t+z.rows.length;L>J&&(J=L)}return J}fillOf(J){const z=this.#e.get(J);return z&&z.state==="loaded"&&z.rows?z.rows.length:null}protect(J,z){this.#r=this.blockOf(Math.max(0,J)),this.#s=this.blockOf(Math.max(0,z))}evict(){const J=[];if(this.#e.size<=this.#n)return J;for(const[z,L]of this.#e){if(this.#e.size-J.length<=this.#n)break;z>=this.#r&&z<=this.#s||L.state!=="pending"&&J.push(z)}for(const z of J)this.#e.delete(z);return J}ids(){return[...this.#e.keys()]}clear(){this.#e.clear()}#i(J,z){this.#e.delete(J),this.#e.set(J,z)}}}),ze("packages/core/src/source/pagewindow.js",function(e,_){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return ne}});function ne(E,K,U,D){const J=Math.floor(Number(E)||0);if(J<=0)return null;const z=Math.max(0,Math.floor(Number(K)||0)),L=Math.max(0,Math.floor(Number(U)||0));if(D){const X=Math.max(1,Math.ceil(L/J)),I=Math.min(z,X-1),j=I*J;return{page:I,pageSize:J,offset:j,length:Math.max(0,Math.min(J,L-j)),pageCount:X,total:L}}return{page:z,pageSize:J,offset:z*J,length:J,pageCount:Math.max(z+2,Math.ceil(L/J)),total:null}}}),ze("packages/core/src/source/paged.js",function(e,_){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"PagedSource",{enumerable:!0,get:function(){return m}});const E=_("packages/core/src/internal/lru.js").Lru,U=_("packages/core/src/internal/predicates.js").isFunction,J=_("packages/core/src/internal/warn.js").warnOnce,L=_("packages/core/src/internal/schedule.js").settleDebounce,X=_("packages/core/src/source/abort.js"),I=X.createAbortScope,j=X.isAbortError,k=_("packages/core/src/source/blockcache.js"),y=k.BlockCache,l=k.DEFAULT_PAGE_SIZE,g=k.DEFAULT_MAX_CACHED_PAGES,t=_("packages/core/src/source/rows.js").createRowFactory,o=_("packages/core/src/source/filterwire.js"),c=o.wireFilters,d=o.querySignature,n=o.warnHostFilterNotApplied,i=_("packages/core/src/source/pagewindow.js").pageWindow,r=120;function f(u,b){return new m(u,b)}class m{mode="paged";#e;#t;#n;#r=I();#s;#i;#o=new Map;#l=null;#a=null;#c=!1;#u=0;#d="";#f={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(b,a){this.#e=b||{mode:"paged"},this.#t=a||{},this.#n=new y({pageSize:this.#e.pageSize||l,maxCachedPages:this.#e.maxCachedPages||g}),this.#s=t(this.#t),this.#i=new E(this.#n.pageSize*4),this.#h=L((h,w)=>this.#w(h,w),r),this.#d=this.#C(),U(this.#e.fetch)||J("source.paged.fetch",'source.mode "paged" requires a fetch function; the grid will stay empty.'),n(this.#t)}count(){const b=this.#y();return b?b.length:this.#b()}#b(){if(this.#P(),this.#l!==null)return this.#l;const b=Math.max(this.#u,this.#n.loadedExtent());return this.#c?b:b+this.#n.pageSize}matchCount(){return this.#b()}totalCount(){return this.#b()}pageInfo(){const b=this.#y();if(!b){const a=this.#b();return{page:0,pageSize:0,total:this.exact()?a:null,pageCount:1,counting:!1}}return{page:b.page,pageSize:b.pageSize,total:b.total,pageCount:b.pageCount,counting:b.total===null&&this.#r.size>0&&this.#u===0&&this.#n.loadedExtent()===0}}#y(){const b=this.#b(),a=i(this.#T("pageSize",0),this.#T("page",0),b,this.exact());if(!a)return this.#g="",null;const h=`${this.#m}:${a.offset}:${a.length}`;if(h!==this.#g&&!this.#p&&(this.#g=h,a.length>0)){const w=a.offset+a.length-1;this.#f={start:a.offset,end:w},this.#w(a.offset,w)}return a}at(b){const a=this.#y();if(a){if(b<0||b>=a.length)return;const h=this.#S(a.offset+b);return h&&(h.index=b),h}return this.#S(b)}#S(b){if(b<0||b>=this.#b())return;const a=this.#i.get(b);if(a&&(a.data!==null||!this.#n.rowLoaded(b)))return a;const h=this.#n.rowAt(b);if(h===void 0){const v=this.#s.skeleton(b,0,this.#n.erroredAt(b));return this.#i.set(b,v),v}const w=this.#s.leaf(h,b);return w.index=b,this.#i.set(b,w),this.#o.set(w.key,b),w}byKey(b){const a=this.#o.get(b);return a===void 0?void 0:this.#S(a)}loaded(b){const a=this.#y();return a?b>=0&&b<a.length&&this.#n.rowLoaded(a.offset+b):this.#n.rowLoaded(b)}loadedCount(){this.#P();let b=0;for(const a of this.#n.ids()){if(!this.#n.loaded(a))continue;const h=this.#n.fillOf(a);typeof h=="number"&&(b+=h)}return b}residentRows(){this.#P();const b=this.#y(),a=b?b.offset:0,h=b?b.offset+b.length:1/0,w=[],v=this.#n.ids().sort((A,H)=>A-H);for(const A of v){if(!this.#n.loaded(A))continue;const{start:H}=this.#n.rangeOf(A),G=this.#n.fillOf(A)||0;for(let Z=H;Z<H+G;Z++){if(Z<a||Z>=h)continue;const M=this.#i.peek(Z);if(M&&M.data!==null&&M.data!==void 0){w.push(M);continue}const S=this.#n.rowAt(Z);if(S===void 0)continue;const T=this.#s.leaf(S,Z);T.index=Z,this.#i.set(Z,T),this.#o.set(T.key,Z),w.push(T)}}return w}hint(b,a){if(this.#p)return;const h=this.#P();let w=Math.max(0,Math.floor(b)),v=Math.max(w,Math.floor(a));const A=this.#y();if(A){if(A.length===0)return;w=A.offset,v=A.offset+A.length-1}this.#f={start:w,end:v},this.#n.protect(w,v);for(const H of this.#n.evict())this.#v(H);this.#h(w,v),h&&this.#h.flush()}#w(b,a){if(this.#p)return;this.#n.protect(b,a);const h=this.#n.blockOf(b),w=this.#n.blockOf(a);for(let v=h;v<=w&&!(this.#l!==null&&v*this.#n.pageSize>=this.#l);v++)this.#n.has(v)||this.#A(v)}apply(b){const a={added:[],updated:[],removed:[]};if(!b)return a;if(b.update)for(const h of b.update){const w=this.#s.keyOf(h,-1),v=this.#o.get(w);if(v===void 0)continue;const A=this.#s.leaf(h,v);A.index=v,this.#i.set(v,A),a.updated.push(A)}return(b.add&&b.add.length||b.remove&&b.remove.length)&&this.reload(),a}reload(b){this.#O("reload"),this.#h.cancel(),this.hint(this.#f.start,this.#f.end)}destroy(){this.#p=!0,this.#h.cancel(),this.#r.abortAll("destroyed"),this.#n.clear(),this.#i.clear(),this.#o.clear()}exact(){return this.#l!==null||this.#c}pending(){return this.#r.size}async#A(b){if(!U(this.#e.fetch))return;const a=this.#r.begin(`block:${b}`);this.#n.begin(b,a);const{start:h,end:w}=this.#n.rangeOf(b),v=this.#d;try{const A=await this.#e.fetch({range:{start:h,end:w},sort:this.#T("sort",[]),filters:c(this.#T("filters",null),this.#E()),quick:this.#T("quick","")||void 0,context:this.#T("context",null),signal:a.signal});if(!a.current||v!==this.#d||this.#p)return;a.settle();const H=A&&A.rows||[];this.#n.fill(b,H);for(let Z=0;Z<H.length;Z++)this.#i.delete(h+Z);const G=A&&typeof A.total=="number"?A.total:A&&typeof A.count=="number"?A.count:null;G!==null?(this.#l=G,this.#c=!0):H.length<this.#n.pageSize?(this.#c=!0,this.#l=h+H.length):this.#u=Math.max(this.#u,h+H.length),this.#M("model:changed",{reason:"page",block:b,from:h,to:h+H.length}),this.#M("rows:changed",{companion:!0,reason:"page",block:b,from:h,to:h+H.length}),this.#l!==null&&this.#l!==this.#a&&(this.#a=this.#l,this.#M("source:total",{total:this.#l,groupPath:[]}))}catch(A){if(a.settle(),j(A))return;this.#n.failed(b,A);for(let H=h;H<w;H++)this.#i.delete(H);this.#M("model:changed",{reason:"page-error",block:b,range:{start:h,end:w}}),this.#M("source:error",{error:A,block:b,range:{start:h,end:w}})}}#v(b){const{start:a,end:h}=this.#n.rangeOf(b);for(let w=a;w<h;w++){const v=this.#i.peek(w);v&&this.#o.delete(v.key),this.#i.delete(w)}}#P(){const b=this.#C();return b===this.#d?!1:(this.#d=b,this.#O("query"),!0)}#O(b){this.#r.abortAll(b),this.#n.clear(),this.#i.clear(),this.#o.clear(),this.#l=null,this.#a=null,this.#c=!1,this.#u=0,this.#m++,this.#M("model:changed",{reason:b})}#C(){return d({filters:this.#T("filters",null),sort:this.#T("sort",[]),quick:this.#T("quick",""),context:this.#T("context",null)})}#E(){const b=this.#t.config||{};return{tz:b.timeZone,weekStartsOn:b.weekStartsOn}}#T(b,a){const h=this.#t.state;if(h&&U(h[b])){const w=h[b]();return w??a}return a}#M(b,a){const h=this.#t.emit;U(h)&&h(b,a)}}}),ze("packages/core/src/source/aggregates.js",function(e,_){"use strict";Object.defineProperty(e,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"pushableAggregates",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"fillAggregateSql",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"routeAggregate",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"resolveAggregatePlan",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"groupKeysPushable",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"pushdownDocRows",{enumerable:!0,get:function(){return X}});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 E(){const I=new Set;for(const[j,k]of Object.entries(ne))k.pushable&&I.add(j);return I}function K(I,j,k){let y=I.split("%c").join(j);return k!==void 0&&(y=y.split("%w").join(k)),y}function U(I){const j=I||{},k=j.default==="engine"||j.default==="engine-if-identical"?j.default:"client",y={};if(j.overrides&&typeof j.overrides=="object")for(const[l,g]of Object.entries(j.overrides))(g==="engine"||g==="client")&&(y[l]=g);return{default:k,overrides:y}}function D(I,j){const k=ne[I];if(!k||!k.pushable)return"client";const y=j.overrides[I];return y==="engine"||y==="client"?y:j.default==="client"?"client":j.default==="engine-if-identical"?k.class==="identical"?"engine":"client":"engine"}function J(I,j){const k=U(j),y=[],l=[];for(const g of I||[]){const s=ne[g.fn],t=D(g.fn,k),o={id:g.id,col:g.col,fn:g.fn,class:s?s.class:"fallback"};g.weight!==void 0&&(o.weight=g.weight),g.params!==void 0&&(o.params=g.params),t==="engine"?y.push(o):(o.reason=s&&!s.pushable?s.note||"the engine cannot express this stat":"client by config",l.push(o))}return{engine:y,client:l,config:k}}const z=/^[A-Za-z_][A-Za-z0-9_$]*$/;function L(I,j=[]){return(I||[]).every(y=>{if(typeof y=="string")return z.test(y);if(!y||typeof y!="object")return!1;const l=y;return Array.isArray(j)&&j.includes(l.bucket)&&typeof l.col=="string"&&z.test(l.col)&&typeof l.size=="number"&&Number.isFinite(l.size)&&l.size>0})}function X(){return Object.entries(ne).map(([I,j])=>({stat:I,class:j.class,sql:j.sql?K(j.sql,"col",j.twoColumn?"weight":void 0):"",note:j.note||(j.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),ze("packages/core/src/source/pushdown.js",function(e,_){"use strict";Object.defineProperty(e,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"NO_CAPABILITIES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"capabilitiesOf",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"splitFilters",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"applyResidual",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"createPushdownSource",{enumerable:!0,get:function(){return F}});const E=_("packages/core/src/internal/compare.js").defaultCompare,U=_("packages/core/src/internal/predicates.js").isFunction,J=_("packages/core/src/internal/merge.js").toArray,L=_("packages/core/src/internal/warn.js").warnOnce,X=_("packages/core/src/source/filterwire.js"),I=X.isGroup,j=X.warnWherePageRelative,k=X.warnWhereOverThreshold,y=X.wireFilters,l=_("packages/core/src/source/aggregates.js"),g=l.resolveAggregatePlan,s=l.groupKeysPushable,t=l.STAT_PUSHDOWN,c=_("packages/core/src/source/abort.js").SupersededError,d=1e3;function n($){const q=$&&$.signal;if(!q||!q.aborted)return;const ee=q.reason;throw ee instanceof Error?ee:new c("","superseded before it was sent")}const p=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function i($){if(!$||typeof $!="object")return!1;const q=$.returning==="row"||$.returning==="key"?$.returning:"none";return{append:$.append===!0,update:$.update===!0,delete:$.delete===!0,returning:q}}function r($,q){if(!$||typeof q!="string")return;if(!q.includes("."))return $[q];let ee=$;for(const te of q.split(".")){if(ee===null||typeof ee!="object")return;ee=ee[te]}return ee}function f($){if($===!0)return!0;if(!$||typeof $!="object")return!1;const q=$;return q.enabled===!1?!1:q.enabled===!0||U(q.commit)}function m($){const q={...p,...$||{}};return q.operators=new Set(q.operators||[]),q.mutate=i(q.mutate),q}function u($,q){return!$||!$.op||!q.operators.size?!1:q.operators.has($.op)}function b($,q){if(!$)return{pushed:null,residual:null};if(!q.filter)return{pushed:null,residual:$};if(q.filter==="term"){if(I($)){const ie=$.conditions||[];if(String($.op)!=="and")return{pushed:null,residual:$};const ue=ie.findIndex(de=>!I(de)&&u(de,q));if(ue<0)return{pushed:null,residual:$};const Ae=ie.filter((de,Oe)=>Oe!==ue);return{pushed:ie[ue],residual:Ae.length?{op:"and",conditions:Ae}:null}}return u($,q)?{pushed:$,residual:null}:{pushed:null,residual:$}}if(!I($))return u($,q)?{pushed:$,residual:null}:{pushed:null,residual:$};if(String($.op)!=="and")return($.conditions||[]).every(ue=>I(ue)?b(ue,q).residual===null:u(ue,q))?{pushed:$,residual:null}:{pushed:null,residual:$};const ee=[],te=[];for(const ie of $.conditions||[]){if(I(ie)){if(q.filter==="flat"){te.push(ie);continue}const ue=b(ie,q);ue.pushed&&ee.push(ue.pushed),ue.residual&&te.push(ue.residual);continue}(u(ie,q)?ee:te).push(ie)}const re=ie=>ie.length===0?null:ie.length===1?ie[0]:{op:"and",conditions:ie};return{pushed:re(ee),residual:re(te)}}const a="__lattice_leaves";function h($){return $.aggregates?$.aggregates instanceof Set?$.aggregates:new Set(J($.aggregates)):new Set}function w($){const q=h($);return q.size?q.has("count")?$.filter!=="tree"||!$.operators||!$.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($,q,ee,te,re,ie,ue){const Ae=Array.isArray($.groupBy)?$.groupBy:[],de=Array.isArray($.groupPath)?$.groupPath:[],Oe=Array.isArray($.groupValues)?$.groupValues:null;if(!q.group){const Me=w(q);if(Me)return Me}return s(Ae)?ee.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":te?re?ie?"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":!Oe||Oe.length!==de.length?"the request carries no typed `groupValues` for its group path, and the string `groupPath` cannot be compared against a typed column":"":"a quick search did not push, so the engine would group unsearched rows":"the sort did not push, so the engine would order the groups differently":"a grouping key is not a plain column the engine can name in a GROUP BY"}const A="pushdown:pivot-unsupported",H="pushdown:group-unsupported",G=Symbol("lattice.remote.ungroupedLevel");function Z($,q,ee,te,re,ie){const ue=Array.isArray($.pivotBy)?$.pivotBy:[],Ae=Array.isArray($.groupBy)?$.groupBy:[],de=Array.isArray($.groupPath)?$.groupPath:[],Oe=Array.isArray($.groupValues)?$.groupValues:null;return q.pivot?s(ue)?Ae.length&&!s(Ae)?"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?re?ie?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!Oe||Oe.length!==de.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 M($,q,ee=!1){const te=b($.filters||null,q),re=[];te.residual&&re.push("filter");const ie=$.sort||[],ue=ie.length===0||q.sort==="multi"&&ie.length>=1||q.sort==="single"&&ie.length===1;!ue&&ie.length&&re.push("sort");const Ae=$.quick?String($.quick):"",de=!Ae||!!q.quick;de||re.push("quick");const Oe=$.where&&$.where.active?$.where:null;Oe&&re.push("where");const Me={filters:te.residual,sort:ue?null:ie,quick:de?"":Ae,where:Oe},Fe=!!ee,pe=Array.isArray($.groupBy)&&$.groupBy.length>0,ae=pe?v($,q,te,ue,de,Oe,Fe):"",ge=$.pivotMode!==!1&&Array.isArray($.pivotBy)&&$.pivotBy.length>0,ve=ge?Z($,q,te,ue,de,Oe):"",le=ge&&ve==="";ge&&!le&&re.push("pivot");const we=ge?le&&pe:pe&&ae==="";pe&&!ge&&!we&&re.push("group");const he=(we||le)&&Array.isArray($.groupValues)?$.groupValues.length:0,be=we||ge?!1:Fe||!!(Me.filters||Me.sort||Me.quick||Me.where)||!q.range;return{pushed:{...$,filters:te.pushed,sort:ue?ie:[],quick:de?Ae:"",range:be?null:$.range},residual:Me,needsAll:be,unpushed:re,full:Fe,grouped:we,groupLevel:he,groupReason:ge?"":ae,pivoted:le,pivotReason:ve}}function S($){const q=Array.isArray($.totals)?$.totals:[],ee=$.totalFns&&typeof $.totalFns=="object"?$.totalFns:{},te=[],re=[];for(const ie of q){const ue=String(ie),Ae=typeof ee[ue]=="string"?ee[ue]:null,de=Ae?t[Ae]:null;Ae?!de||!de.pushable||!de.sql?re.push({id:ue,fn:Ae,class:de?de.class:"fallback",reason:de&&de.note?de.note:`the pushdown map cannot express "${Ae}"`}):de.twoColumn?re.push({id:ue,fn:Ae,class:de.class,reason:`"${Ae}" reduces two columns, and a grouped request carries no weight column`}):te.push({id:ue,col:ue,fn:Ae,class:de.class}):re.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:re}}const T=Object.freeze({items:$=>$==null?[]:Array.isArray($)?$:[$]});function O($,q,ee){if(!q)return $;let te=$;if(q.filters&&U(ee.evaluateFilters)){const re=te,ie={count:te.length,handle:de=>({id:de,get:Oe=>r(re[Oe],de)}),itemwise:de=>re.some(Oe=>Array.isArray(r(Oe,de)))?T:null},ue=ee.evaluateFilters(q.filters,ie),Ae=[];for(let de=0;de<te.length;de++)ue[de]&&Ae.push(te[de]);te=Ae}if(q.where&&q.where.active&&(q.whole||j(q.where.names,"pushdown"),te=te.filter(re=>q.where.passes(re))),q.quick){const re=q.quick.toLowerCase();te=te.filter(ie=>{if(!ie||typeof ie!="object")return!1;for(const ue of Object.values(ie))if(ue!=null&&String(ue).toLowerCase().includes(re))return!0;return!1})}if(q.sort&&q.sort.length&&U(ee.sortMulti)){const re=[...new Set(q.sort.map(de=>de.col))],ie=te,ue=re.map(de=>({id:de,get:Oe=>r(ie[Oe],de)})),Ae=ee.sortMulti(ue,q.sort.map(de=>({col:de.col,dir:de.dir})),Uint32Array.from({length:te.length},(de,Oe)=>Oe),{});te=Array.from(Ae,de=>ie[de])}return te}function N($){return JSON.stringify({filters:$.filters||null,sort:$.sort||[],quick:$.quick||"",groupBy:$.groupBy||[],groupPath:$.groupPath||[],context:$.context??null})}function P($){if(!$||typeof $!="object")return 16;let q="";try{q=JSON.stringify($)}catch{return 200}return q.length*2+64}function C($){const q=$||{};return{enabled:!!q.enabled,maxRows:Number.isFinite(q.maxRows)?q.maxRows:1e6,maxBytesEstimate:Number.isFinite(q.maxBytesEstimate)?q.maxBytesEstimate:512*1024*1024}}const B=5e4;function x($){return Number.isFinite($)&&$>=0?$:B}function V($){return!!$&&U($.then)}async function Y($){if(!$||$.total!==void 0||!V($.pendingTotal))return $;const q=await $.pendingTotal,{pendingTotal:ee,...te}=$;return typeof q=="number"?{...te,total:q}:te}function F($={}){const q=$.adapter;if(!q||!U(q.execute))return L("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...$,mode:"remote",fetch:async()=>({rows:[],total:0})};const ee=m(q.capabilities),te=q.capabilities&&Object.getOwnPropertyDescriptor(q.capabilities,"operators");te&&U(te.get)&&Object.defineProperty(ee,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(q.capabilities.operators||[]),set:()=>{}});const re=q.name||"adapter";let ie=null;const ue=()=>U(q.ready)?(ie||(ie=Promise.resolve(q.ready()).then(()=>{Object.assign(ee,m(q.capabilities))},Se=>{throw ie=null,Se})),ie):null,Ae=C($.fullDataset),de=!!$.allowPartialResults,Oe=x($.whereRowLimit);let Me=null;const Fe=$.aggregates;let pe=null,ae=null,ge=null,ve=null,le=null,we,he=null,be=0,Te=null;const je=()=>!Ae.enabled||!pe?null:(Te!==pe.key&&(be++,Te=pe.key),{rows:pe.rows,version:be}),ke=async Se=>{const Le=Se.where&&Se.where.active?Se.where:null;if(!Le)return{request:Se,probe:null};const{where:se,...ce}=Se,Pe=M(ce,ee,Ae.enabled);if(Pe.needsAll)return{request:Se,probe:null};const Ne=N(Pe.pushed);let De=null;return(!Me||Me.key!==Ne)&&(ee.total?(n(Se),De=await Y(await q.execute(Pe.pushed,Se)),Me={key:Ne,size:De&&typeof De.total=="number"?De.total:null}):Me={key:Ne,size:null}),Me.size!==null&&Me.size<Oe?{request:Se,probe:null}:(k(Le.names,re,Me.size,Oe),{request:ce,probe:De})},Ue=async(Se,Le)=>{he=null;const se=S(Se.pushed);ge={engine:se.engine,client:se.client,groupBy:Se.pushed.groupBy},se.client.length&&L(`source.pushdown.group.totals.${re}.${se.client.map(Ne=>Ne.id).join(".")}`,`the ${re} adapter cannot compute the group subtotal for ${se.client.map(Ne=>`"${Ne.id}" (${Ne.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 ce=await q.executeGroupLevel(Se.pushed,se.engine,Le)||{};let Pe=ce.rows||[];return!ee.range&&Le.range&&(Pe=Pe.slice(Le.range.start,Le.range.end)),Ke(ce),ce.total===void 0?{rows:Pe}:{rows:Pe,total:ce.total}},Re=new Map,Ee=64,He=async(Se,Le)=>{he=null;const se=Se.pushed,ce=se.groupBy,Pe=Array.isArray(se.groupValues)?se.groupValues:[],Ne=Pe.length,De=[...se.filters?[se.filters]:[],...ce.slice(0,Ne).map((mt,bt)=>({col:mt,op:"eq",value:Pe[bt]===void 0?null:Pe[bt],caseSensitive:!0}))],Be=De.length===0?null:De.length===1?De[0]:{op:"and",conditions:De},Ye=Le.range?Le.range.start:0;if(Ne>=ce.length){const mt={...se,filters:Be,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},bt=await Y(await q.execute(mt,Le))||{};let At=bt.rows||[];return!ee.range&&Le.range&&(At=At.slice(Le.range.start,Le.range.end)),typeof bt.total=="number"?{rows:At,total:bt.total}:{rows:At}}const Qe=ce[Ne],ct=S(se),pt=h(ee),Ge=ct.engine.filter(mt=>pt.has(mt.fn)),nt=[...ct.engine.filter(mt=>!pt.has(mt.fn)).map(mt=>({id:mt.id,fn:mt.fn,class:mt.class,reason:`the ${re} adapter does not compute "${mt.fn}"`})),...ct.client];ge={engine:Ge,client:nt,groupBy:ce},nt.length&&L(`source.pushdown.group.totals.${re}.${nt.map(mt=>mt.id).join(".")}`,`the ${re} adapter cannot compute the group subtotal for ${nt.map(mt=>`"${mt.id}" (${mt.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 at=[...Ge.map(mt=>({id:mt.id,col:mt.col,fn:mt.fn})),{id:a,col:Qe,fn:"count"}],rt={...se,filters:Be,range:null},ft=JSON.stringify([N(rt),Pe,Qe,at]);let jt=Ye>0?Re.get(ft):void 0;if(!jt){for(jt=Promise.resolve(q.executeGroupedAggregates(rt,[Qe],at)),Re.delete(ft),Re.set(ft,jt);Re.size>Ee;)Re.delete(Re.keys().next().value);jt.catch(()=>{Re.get(ft)===jt&&Re.delete(ft)})}const Tt=await jt||[];n(Le);const Mt=mt=>{const bt={};for(const At of Ge)bt[At.id]=mt?mt[At.id]:void 0;return bt},Rt=(se.sort||[]).find(mt=>mt&&mt.col===Qe),It=Rt&&Rt.dir==="desc"?-1:1,zt=Tt.filter(mt=>mt&&mt.level===1).map(mt=>({[Qe]:mt.keys[0]===void 0?null:mt.keys[0],leafCount:Number(mt.values&&mt.values[a])||0,totals:Mt(mt.values)})).sort((mt,bt)=>It*E(mt[Qe],bt[Qe]));if(Ne===0){const mt=Tt.find(At=>At&&At.level===0),bt=mt?Number(mt.values&&mt.values[a]):NaN;Ke({matchCount:Number.isFinite(bt)?bt:zt.reduce((At,Dt)=>At+Dt.leafCount,0),...mt?{grand:Mt(mt.values)}:{}})}const Je=Le.range?Le.range.end:zt.length;return{rows:zt.slice(Ye,Je),total:zt.length}},Ke=Se=>{typeof Se.matchCount=="number"&&(ve=Se.matchCount,le=Se.grand?{totals:Se.grand,leafCount:Se.matchCount}:null,we===void 0&&U(q.unfilteredCount)&&(we=null,Promise.resolve(q.unfilteredCount()).then(Le=>{we=typeof Le=="number"?Le:null}).catch(Le=>{L(`source.pushdown.group.unfiltered.${re}`,`the ${re} adapter could not count the unfiltered set (${Le&&Le.message?Le.message:Le}), so "N of M" falls back to the display count for its denominator.`)})))},We=async(Se,Le)=>{he=null;const se=S(Se.pushed);ge={engine:se.engine,client:se.client,groupBy:Se.pushed.groupBy,pivotBy:Se.pushed.pivotBy},se.client.length&&L(`source.pushdown.pivot.totals.${re}.${se.client.map(Be=>Be.id).join(".")}`,`the ${re} adapter cannot compute the pivot cells for ${se.client.map(Be=>`"${Be.id}" (${Be.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 ce=await q.executePivotLevel(Se.pushed,se.engine,Le)||{};let Pe=ce.rows||[];!ee.range&&Le.range&&(Pe=Pe.slice(Le.range.start,Le.range.end)),Ke(ce);const Ne=ce.pivot&&typeof ce.pivot=="object"?ce.pivot:{},De={cells:Array.isArray(Ne.cells)?Ne.cells:[],...Array.isArray(Ne.axis)?{axis:Ne.axis}:{}};return ce.total===void 0?{rows:Pe,pivot:De}:{rows:Pe,total:ce.total,pivot:De}},qe=Se=>{L(`source.pushdown.pivot.${re}.${Se}`,`pushdown:pivot-unsupported: the ${re} adapter cannot pivot this query because ${Se}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const Le=new Error(`[lattice] ${A}: the ${re} adapter cannot pivot this query because ${Se}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw Le.code=A,Le.reason=Se,Le},et=(Se,Le)=>{const se={key:Le,state:"pending",value:null};return he=se,Se.then(ce=>(he===se&&(he={key:Le,state:"settled",value:typeof ce=="number"?ce:null}),ce),ce=>{throw he===se&&(he={key:Le,state:"failed",value:null}),ce})};let dt=0,lt=[];const vt=()=>dt===0?null:new Promise(Se=>{const Le=setTimeout(Se,d);lt.push(()=>{clearTimeout(Le),Se()})});let Pt;const $t=async Se=>{const Le=ue();Le&&await Le;const ce=Se&&Se.pivotMode!==!1&&Array.isArray(Se.pivotBy)&&Se.pivotBy.length>0?{request:Se,probe:null}:await ke(Se);n(Se);let Pe=M(ce.request,ee,Ae.enabled);if(ee.group&&Pe.grouped&&!Pe.pivoted&&!U(q.executeGroupLevel)&&(L(`source.pushdown.group.method.${re}`,`the ${re} 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.`),Pe=M(ce.request,{...ee,group:!1,aggregates:null},Ae.enabled)),Pe.pivoted&&!U(q.executePivotLevel)&&(Pe=M(ce.request,{...ee,pivot:!1},Ae.enabled),Pe.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Pe.grouped&&!Pe.pivoted&&!ee.group&&!U(q.executeGroupedAggregates)&&(L(`source.pushdown.group.aggregates.method.${re}`,`the ${re} 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\`.`),Pe=M(ce.request,{...ee,aggregates:null},Ae.enabled)),ae=Pe,Pe.pivoted)return We(Pe,Se);if(Pe.pivotReason&&qe(Pe.pivotReason),Pe.grouped)return ee.group?Ue(Pe,Se):He(Pe,Se);const De=!!Pe.groupReason&&!Pe.full;De?L(`source.pushdown.group-unsupported.${re}.${Pe.groupReason}`,`pushdown:group-unsupported: the ${re} adapter was not asked to group this query because ${Pe.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.`):Pe.groupReason&&L(`source.pushdown.group.${re}.${Pe.groupReason}`,`the ${re} adapter was not asked to group this query because ${Pe.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 Be=at=>De?{...at,[G]:!0}:at;if(!Pe.needsAll){const at=ce.probe||await q.execute(Pe.pushed,Se),rt=at.rows||[];return V(at.pendingTotal)&&at.total===void 0?Be({rows:rt,pendingTotal:et(at.pendingTotal,N(Pe.pushed))}):(he=null,!ee.total&&at.total===void 0?Be({rows:rt}):Be({rows:rt,total:at.total??rt.length}))}Pe.unpushed.length&&L(`source.pushdown.residual.${re}.${Pe.unpushed.join(".")}`,`the ${re} adapter cannot push ${Pe.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 Ye=N(Pe.pushed);if(!pe||pe.key!==Ye){const at=await Y(await q.execute(Pe.pushed,Se));he=null;const rt=at.rows||[];if(Pe.full){const ft=typeof at.total=="number"?Math.max(at.total,rt.length):rt.length;if(ft>Ae.maxRows)throw new Error(`[lattice] fullDataset refused: the ${re} adapter's matching set is ${ft.toLocaleString()} rows, past the configured maxRows of ${Ae.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=rt.length*P(rt[0]);if(jt>Ae.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${re} adapter's matching set is an estimated ${Math.round(jt/(1024*1024)).toLocaleString()} MB across ${rt.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(Ae.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 at.total=="number"&&rt.length<at.total){const ft=!!(Pe.residual.filters||Pe.residual.quick||Pe.residual.sort&&Pe.residual.sort.length);if(ft&&!de)throw new Error(`[lattice] the ${re} adapter returned ${rt.length} of ${at.total} matching rows when asked for the whole result, and the query has residual ${Pe.unpushed.join(" and ")||"work"} to finish in the browser. Filtering or sorting a fraction of the result would return wrong rows, so the result is refused. Fix the adapter to follow the engine's own paging before returning, hold the data in memory, or set \`allowPartialResults: true\` on the source config to accept this knowingly.`);ft?L(`source.pushdown.partial.residual.${re}`,`the ${re} adapter returned ${rt.length} of ${at.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.`):L(`source.pushdown.partial.${re}`,`the ${re} adapter returned ${rt.length} of ${at.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}pe={key:Ye,rows:rt,total:typeof at.total=="number"?at.total:null}}let Qe=Pe;if(Pe.residual.where){const at=pe.total??pe.rows.length;if(at>=Oe){k(Pe.residual.where.names,re,at,Oe);const{where:rt,...ft}=ce.request;Qe=M(ft,ee,Ae.enabled),ae=Qe}}const ct=pe.total!==null&&pe.rows.length>=pe.total,pt=O(pe.rows,{...Qe.residual,whole:ct},$.compute||{}),Ge=Se.range?Se.range.start:0,nt=Se.range?Se.range.end:pt.length;return Be({rows:pt.slice(Ge,nt),total:pt.length})},ht=async(Se,Le,se)=>{const Pe=se&&se.waitForPage&&Pt&&U(Pt.pageForegroundIdle)?Pt.pageForegroundIdle():vt();Pe&&await Pe;const Ne=ue();Ne&&await Ne;const De=M(Se,ee,Ae.enabled);ae=De;const Be=g(Le,Fe),Ye=Array.isArray(Se.groupBy)?Se.groupBy:[],Qe=Ye.length>0,ct=!De.residual.filters&&!De.residual.quick,pt=!Qe||s(Ye,ee.buckets);let Ge=Be.engine,nt=Be.client;if(ee.aggregates&&Ge.length){const jt=ee.aggregates instanceof Set?ee.aggregates:new Set(J(ee.aggregates)),Tt=Ge.filter(Mt=>!jt.has(Mt.fn));Tt.length&&(Ge=Ge.filter(Mt=>jt.has(Mt.fn)),nt=[...Tt.map(Mt=>({...Mt,reason:`the ${re} adapter does not compute "${Mt.fn}"`})),...nt])}const at=jt=>{nt=[...Ge.map(Tt=>({...Tt,reason:jt})),...nt],Ge=[]};Ge.length&&!ct?at(De.residual.quick&&!De.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):Ge.length&&!pt&&at("a grouping key the engine cannot form forces all-client (no mixed provenance)");let rt={},ft;return Ge.length&&(U(Qe?q.executeGroupedAggregates:q.executeAggregates)?Qe?ft=await q.executeGroupedAggregates(De.pushed,Ye,Ge)||[]:rt=await q.executeAggregates(De.pushed,Ge)||{}:(L(`source.pushdown.aggregates.${re}${Qe?".grouped":""}`,`the ${re} adapter cannot compute ${Qe?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),at(`adapter cannot compute ${Qe?"grouped ":""}aggregates`))),ge={engine:Ge,client:nt,...Qe?{groupBy:Ye}:{}},{values:rt,engine:Ge,client:nt,...ft!==void 0?{groups:ft}:{}}},ut=async Se=>{dt++;try{return await $t(Se)}finally{if(dt--,dt===0&<.length){const Le=lt;lt=[];for(const se of Le)se()}}},wt=f($.edit),Nt=$.edit&&typeof $.edit=="object"&&U($.edit.commit);let gt=$.edit;if(wt&&!Nt)if(ee.mutate&&ee.mutate.update){const Se=Le=>{if(!ee.mutate||!ee.mutate.update)throw new Error(`[lattice] the ${re} 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 se={kind:"update",key:String(Le.key),patch:{[Le.colId]:Le.value}};return q.mutate(se,Le.request||{})};gt={...$.edit===!0?{}:$.edit,commit:Se}}else L(`source.pushdown.readonly.${re}`,`edit is enabled but the ${re} 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 Ce=wt&&ee.mutate&&(ee.mutate.append||ee.mutate.delete)?{append:ee.mutate.append===!0,remove:ee.mutate.delete===!0,returning:ee.mutate.returning,mutate:(Se,Le)=>q.mutate(Se,Le||{})}:null,$e=async Se=>{const Le=ue();Le&&await Le;const{range:se,signal:ce,export:Pe,...Ne}=Se||{},De={...Ne,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:M(De,ee,Ae.enabled),signal:ce}};async function*ye(Se,Le={}){const{plan:se,signal:ce}=await $e(Se),Pe=Math.max(1,Math.floor(Number(Le.pageSize))||5e3),Ne={signal:ce,stream:!0},De=Se&&Se.range&&Number.isFinite(Number(Se.range.start))&&Number.isFinite(Number(Se.range.end))?{start:Math.max(0,Number(Se.range.start)),end:Math.max(0,Number(Se.range.end))}:null;if(!se.needsAll){const Qe=De?De.start:0,ct=De?De.end:1/0;for(let pt=Qe;pt<ct;pt+=Pe){n(Ne);const Ge=Math.min(pt+Pe,ct),nt=await q.execute({...se.pushed,range:{start:pt,end:Ge}},Ne);nt&&V(nt.pendingTotal)&&nt.pendingTotal.then(null,()=>{});const at=nt&&nt.rows||[];if(at.length&&(yield at),at.length<Ge-pt)return}return}n(Ne);const Be=await Y(await q.execute({...se.pushed,range:void 0},Ne));let Ye=O(Be&&Be.rows||[],{...se.residual,whole:!0},$.compute||{});De&&(Ye=Ye.slice(De.start,De.end));for(let Qe=0;Qe<Ye.length;Qe+=Pe)yield Ye.slice(Qe,Qe+Pe)}return Pt={...$,edit:gt,rowMutate:Ce,mode:"remote",fetch:ut,foregroundIdle:vt,aggregate:ht,countMatching:async Se=>{const{plan:Le,signal:se}=await $e(Se);if(!Le.needsAll&&ee.total){n({signal:se});const Pe=await Y(await q.execute({...Le.pushed,range:{start:0,end:0}},{signal:se}));if(Pe&&typeof Pe.total=="number")return Pe.total}let ce=0;for await(const Pe of ye({...Se,range:void 0}))ce+=Pe.length;return ce},streamMatching:ye,capabilitiesOf:m,planQuery:M,wireFilters:y,resolveAggregatePlan:Se=>g(Se,Fe),STAT_PUSHDOWN:t,lastPlan:()=>ae?{...ae,...ge?{aggregates:ge}:{},...he?{total:{deferred:!0,state:he.state,value:he.value}}:{}}:null,fullFrame:je,counts:()=>({match:ve,total:we??null,pending:!!he&&he.state==="pending"}),grandTotals:()=>le},Pt}}),ze("packages/core/src/source/remote.js",function(e,_){"use strict";Object.defineProperty(e,"PROTOCOL",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return N}});const E=_("packages/core/src/internal/lru.js").Lru,U=_("packages/core/src/internal/predicates.js").isFunction,J=_("packages/core/src/internal/warn.js").warnOnce,L=_("packages/core/src/internal/schedule.js").settleDebounce,X=_("packages/core/src/source/abort.js"),I=X.createAbortScope,j=X.isAbortError,k=_("packages/core/src/source/blockcache.js"),y=k.BlockCache,l=k.DEFAULT_PAGE_SIZE,g=k.DEFAULT_MAX_CACHED_PAGES,s=_("packages/core/src/source/rows.js"),t=s.createRowFactory,o=s.groupKey,c=_("packages/core/src/source/filterwire.js"),d=c.wireFilters,n=c.querySignature,p=c.warnHostFilterNotApplied,r=_("packages/core/src/source/pagewindow.js").pageWindow,m=_("packages/core/src/source/memory.js").MemorySource,b=_("packages/core/src/compute/handle.js").valueComparator,a=_("packages/core/src/compute/pivot.js"),h=a.pivotKey,w=a.joinPath,v=a.DEFAULT_PATH_SEPARATOR,H=_("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,G=1,Z=120,M=1e3;function S(P,C,B){for(let x=0;x<Math.max(P.length,C.length);x++){const V=P[x],Y=C[x],F=V==null,$=Y==null;if(F||$){if(F&&$)continue;return F?1:-1}const q=B(V,Y);if(q!==0)return q}return 0}function T(P,C){return new N(P,C)}class O{constructor(C,B,x,V){this.path=C,this.keyPath=V||C,this.values=[],this.level=B,this.key=o(this.keyPath),this.cache=new y(x),this.count=null,this.complete=!1,this.announced=null,this.counting=!1,this.failed=!1,this.children=new Map,this.row=null,this.flat=!1}}class N{mode="remote";#e;#t;#n;#r;#s=new Map;#i=new Set;#o=I();#l;#a;#c=new Map;#u=[];#d=null;#f="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#S="";#w=null;#A=-1;constructor(C,B){this.#e=C||{mode:"remote"},this.#t=B||{},U(this.#e.fullFrame)&&(this.filteredIndices=()=>this.#F(),this.unfilteredIndices=()=>this.#W(),this.handleFor=$=>this.#V($),this.display=()=>this.#x(),this.grandTotalRow=()=>this.#_(),this.unfilteredRows=()=>this.#I(),this.facetIndices=$=>this.#q($));const x=this.#e.counts;U(x)&&(this.matchCount=()=>this.#Y("match"),this.totalCount=()=>this.#Y("total"));const V=this.#e.grandTotals;U(V)&&(this.grandTotalRow=()=>this.#G());const Y=this.#e.foregroundIdle;U(Y)&&(this.foregroundIdle=()=>this.#me(Y),this.#e.pageForegroundIdle=()=>this.#b?this.#me(Y):null);const F=this.#e;U(F.countMatching)&&U(F.streamMatching)&&(this.selectionQuery=()=>this.#U(),this.countMatching=$=>F.countMatching($),this.streamMatching=($,q)=>F.streamMatching($,q),this.loadedRows=()=>this.#ye(),this.resident=()=>this.#N()!==null),this.#n={pageSize:this.#e.pageSize||l,maxCachedPages:this.#e.maxCachedPages||g},this.#l=t(this.#t),this.#a=new E(this.#n.pageSize*4),this.#h=L(($,q)=>this.#T($,q),Z),this.#r=new O([],0,this.#n),this.#s.set(this.#r.key,this.#r),this.#f=this.#we(),U(this.#e.fetch)||J("source.remote.fetch",'source.mode "remote" requires a fetch function; the grid will stay empty.'),this.#he()}count(){const C=this.#O();return C?C.length:this.#v()}#v(){const C=this.#N();return C?C.count():(this.#de(),this.#$e(this.#r))}#P(){if(this.#N())return!0;const C=B=>{if(B.count===null&&!B.complete)return!1;for(const x of B.children.values())if(this.#ge(x.key)&&!C(x))return!1;return!0};return C(this.#r)}pageInfo(){const C=this.#O(),B=this.totalPending();if(!C){const x=this.#v();return{page:0,pageSize:0,total:this.#P()?x:null,pageCount:1,counting:B}}return{page:C.page,pageSize:C.pageSize,total:C.total,pageCount:C.pageCount,counting:B||C.total===null&&this.#o.size>0&&this.#r.cache.loadedExtent()===0}}#O(){const C=this.#v(),B=r(this.#$("pageSize",0),this.#$("page",0),C,this.#P());if(!B)return this.#S="",null;const x=`${this.#y}:${B.offset}:${B.length}`;return x!==this.#S&&!this.#p&&(this.#S=x,B.length>0&&!this.#N()&&this.#T(B.offset,B.offset+B.length-1)),B}at(C){const B=this.#O();if(B){if(C<0||C>=B.length)return;const x=this.#C(B.offset+C);return x&&(x.index=C),x}return this.#C(C)}#C(C){const B=this.#N();if(B)return B.at(C);if(this.#de(),C<0||C>=this.#v())return;const x=this.#J(this.#r,C);if(!x)return;const V=this.#H(x.node,x.local);return V&&(V.index=C),V||this.#l.skeleton(C,x.node.level,x.node.cache.erroredAt(x.local))}byKey(C){const B=this.#N();if(B)return B.byKey(C);const x=this.#c.get(C);if(!x)return;const V=x.lastIndexOf(":"),Y=this.#s.get(x.slice(0,V));return Y&&this.#H(Y,Number(x.slice(V+1)))||void 0}loaded(C){const B=this.#O();if(B){if(C<0||C>=B.length)return!1;C+=B.offset}const x=this.#N();if(x)return x.loaded(C);if(C<0||C>=this.#v())return!1;const V=this.#J(this.#r,C);return!!V&&V.node.cache.rowLoaded(V.local)}hint(C,B){if(this.#p)return;this.#b=!0;const x=this.#de();let V=Math.max(0,Math.floor(C)),Y=Math.max(V,Math.floor(B));const F=this.#O();if(F){if(F.length===0)return;V=F.offset,Y=F.offset+F.length-1}for(const[$,q]of this.#E(V,Y)){$.cache.protect(q.min,q.max);for(const ee of $.cache.evict())this.#Q($,ee)}this.#h(V,Y),x&&this.#h.flush()}#E(C,B){const x=this.#v(),V=new Map;for(let Y=C;Y<=B&&Y<x;Y++){const F=this.#J(this.#r,Y);if(!F)continue;const $=V.get(F.node);$?($.min=Math.min($.min,F.local),$.max=Math.max($.max,F.local)):V.set(F.node,{min:F.local,max:F.local})}return V.size||V.set(this.#r,{min:C,max:C}),V}#T(C,B){if(!this.#p)for(const[x,V]of this.#E(C,B)){x.cache.protect(V.min,V.max);const Y=x.cache.blockOf(V.min),F=x.cache.blockOf(V.max);for(let $=Y;$<=F&&!(x.count!==null&&$*x.cache.pageSize>=x.count);$++)x.cache.has($)||this.#ue(x,$)}}apply(C){const B={added:[],updated:[],removed:[]};if(!C)return B;if(C.update)for(const x of C.update){const V=this.#c.get(this.#l.keyOf(x,-1));if(!V)continue;this.#a.delete(V);const Y=V.lastIndexOf(":"),F=this.#s.get(V.slice(0,Y));if(!F)continue;const $=Number(V.slice(Y+1)),q=F.cache.blockOf($);if(!F.cache.loaded(q))continue;const{start:ee}=F.cache.rangeOf(q),te=[];for(let ie=ee;ie<ee+F.cache.pageSize;ie++){const ue=F.cache.rowAt(ie);if(ue===void 0)break;te.push(ie===$?x:ue)}F.cache.fill(q,te);const re=this.#H(F,$);re&&B.updated.push(re)}return(C.add&&C.add.length||C.remove&&C.remove.length)&&this.reload({keepExpanded:!0}),B}reload(C){this.#o.abortAll("reload"),this.#h.cancel(),C&&C.keepExpanded===!1&&this.#i.clear(),this.#le(),this.#Z("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#o.abortAll("destroyed"),this.#le(),this.#s.clear(),this.#i.clear(),this.#w&&U(this.#w.destroy)&&this.#w.destroy(),this.#w=null}expand(C){this.#i.has(C)||(this.#i.add(C),this.#Z("group:toggled",{key:C,expanded:!0}),this.#Z("model:changed",{reason:"expand",key:C}))}collapse(C){this.#i.delete(C)&&(this.#Z("group:toggled",{key:C,expanded:!1}),this.#Z("model:changed",{reason:"collapse",key:C}))}expandedKeys(){return[...this.#i]}pivotFields(){return this.#u}pivot(){this.#de();const C=this.#d;if(!C||!C.keys.size||!this.#$("pivotBy",[]).length)return null;if(!C.result){const B=b((this.#t.config||{}).locale),x=[...C.keys.entries()].sort((Y,F)=>S(Y[1],F[1],B)),V=x.map(([Y])=>Y);C.result={keys:x.map(([,Y])=>Y),paths:V,fields:this.#je(V),groupPaths:[],columns:V.length*Math.max(1,this.#ke().length),values:C.cells,cells:C.cells,error:null}}return C.result}invalidateHandles(){this.#w&&(U(this.#w.invalidateHandles)&&this.#w.invalidateHandles(),U(this.#w.invalidate)&&this.#w.invalidate("filter"))}#M(){const C=this.#e.fullFrame;return U(C)?C():null}#N(){const C=this.#M();return C?(this.#w||(this.#w=new m({mode:"memory"},this.#R())),C.version!==this.#A&&(this.#w.setRows(C.rows),this.#A=C.version),this.#w):null}#R(){const C=this.#t,B=C.state||{};return{...C,state:{...B,page:()=>0,pageSize:()=>0}}}#F(){const C=this.#N();return C?C.filteredIndices():new Uint32Array(0)}#W(){const C=this.#N();return C?C.unfilteredIndices():new Uint32Array(0)}#V(C){const B=this.#N();return B?B.handleFor(C):void 0}#x(){const C=this.#N();return C?C.display():[]}#q(C){const B=this.#N();return B&&U(B.facetIndices)?B.facetIndices(C):new Uint32Array(0)}#_(){const C=this.#N();return C&&U(C.grandTotalRow)?C.grandTotalRow():null}#Y(C){const B=this.#N();if(B){const F=C==="match"?B.matchCount:B.totalCount;if(U(F))return F.call(B)}const x=this.#e.counts,V=U(x)?x():null,Y=V?V[C]:null;return typeof Y=="number"?Y:this.#v()}#G(){const C=this.#N();if(C&&U(C.grandTotalRow))return C.grandTotalRow();if((this.#t.config||{}).grandTotalRow!=="bottom")return null;const x=this.#e.grandTotals,V=U(x)?x():null;return!V||!V.totals?null:this.#l.grandTotal(V.totals,V.leafCount||0)}#I(){const C=this.#N();if(C&&U(C.unfilteredRows))return C.unfilteredRows();const B=[],x=this.count();for(let V=0;V<x;V++){const Y=this.at(V);Y&&B.push(Y)}return B}#U(){const C=this.#$("quick",""),B={protocol:G,groupPath:[],groupValues:[],groupBy:[],totals:[],totalFns:{},pivotBy:[],pivotMode:!1,filters:d(this.#$("filters",null),this.#pe()),sort:this.#$("sort",[]),context:this.#$("context",null)};C&&(B.quick=C);const x=this.#$("where",null);return x&&x.active&&(B.where=x),B}#ye(){const C=this.#$("groupBy",[]).length,B=[];for(const x of this.#s.values())if(!(x.level!==C&&!x.flat))for(const V of x.cache.ids()){if(!x.cache.loaded(V))continue;const{start:Y,end:F}=x.cache.rangeOf(V);for(let $=Y;$<F&&x.cache.rowLoaded($);$++){const q=this.#H(x,$);q&&!q.group&&B.push(q)}}return B}loadedCount(){const C=this.#N();if(C){const V=C.matchCount();return typeof V=="number"?V:C.count()}this.#de();const B=this.#$("groupBy",[]).length;let x=0;for(const V of this.#s.values())if(!(V.level!==B&&!V.flat))for(const Y of V.cache.ids()){if(!V.cache.loaded(Y))continue;const F=V.cache.fillOf(Y);typeof F=="number"&&(x+=F)}return x}residentRows(){const C=this.#N();return C?C.display():this.#$("groupBy",[]).length>0?null:(this.#de(),this.#ye())}#ce(C,B,x){const{start:V,end:Y}=C.cache.rangeOf(B),F=this.#$("groupBy",[]),$=this.#$("pivotBy",[]),q=this.#$("quick",""),ee=this.#ke(),te={protocol:G,range:{start:V,end:Y},groupPath:C.path,groupValues:C.values,groupBy:F,totals:ee,totalFns:this.#De(ee),pivotBy:$,pivotMode:$.length>0,filters:d(this.#$("filters",null),this.#pe()),sort:this.#$("sort",[]),context:this.#$("context",null),signal:x};q&&(te.quick=q);const re=this.#$("where",null);return re&&re.active&&(te.where=re),te}async#ue(C,B){if(!U(this.#e.fetch))return;if(!this.#m){this.#m=!0;const F=this.#g;this.#g=[],queueMicrotask(()=>{for(const $ of F)$()})}const x=this.#o.begin(`${C.key}:${B}`);C.cache.begin(B,x);const V=this.#f,{start:Y}=C.cache.rangeOf(B);try{const F=await this.#e.fetch(this.#ce(C,B,x.signal));if(!x.current||V!==this.#f||this.#p)return;x.settle();const $=F&&F.rows||[];if(!!(F&&F[H])&&!C.flat){C.flat=!0,C.children.clear();for(const[re,ie]of[...this.#c])ie.startsWith(`${C.key}:`)&&(this.#a.delete(ie),this.#c.delete(re))}C.cache.fill(B,$),C.failed=!1;for(let re=0;re<$.length;re++)this.#a.delete(`${C.key}:${Y+re}`);const ee=F&&typeof F.count=="number"?F.count:F&&typeof F.total=="number"?F.total:null,te=F&&U(F.pendingTotal?.then)?F.pendingTotal:null;ee!==null?(C.count=ee,C.complete=!0):$.length<C.cache.pageSize?(C.count=Y+$.length,C.complete=!0):te&&(C.counting=!0,C.announced=null),F&&Array.isArray(F.pivotFields)&&this.#Me(F.pivotFields),F&&F.pivot&&typeof F.pivot=="object"&&this.#se(F.pivot),this.#Z("model:changed",{reason:"page",groupPath:C.path,block:B}),this.#Z("rows:changed",{companion:!0,reason:"page",groupPath:C.path,block:B}),this.#ie(C),te&&this.#Ne(C,te,V)}catch(F){if(x.settle(),j(F))return;C.cache.failed(B,F),C.failed=!0;const{end:$}=C.cache.rangeOf(B);for(let q=Y;q<$;q++)this.#a.delete(`${C.key}:${q}`);this.#Z("model:changed",{reason:"page-error",groupPath:C.path,block:B}),this.#Z("source:error",{error:F,groupPath:C.path,block:B})}}async#Ne(C,B,x){let V;try{V=await B}catch(Y){if(x!==this.#f||this.#p)return;C.counting=!1,j(Y)||(C.failed=!0),j(Y)||this.#Z("source:error",{error:Y,groupPath:C.path});return}x!==this.#f||this.#p||(C.counting=!1,typeof V=="number"&&(C.count=V,C.complete=!0,this.#ie(C),this.#Z("model:changed",{reason:"total",count:V,groupPath:C.path})))}#ie(C){typeof C.count!="number"||!C.complete||C.announced!==C.count&&(C.announced=C.count,this.#Z("source:total",{total:C.count,groupPath:C.path}))}#me(C){if(this.#p)return null;this.#de();const B=this.#m?null:new Promise($=>{this.#g.push($),setTimeout($,M)}),x=C();if(!B&&!x)return null;const V=(async()=>{B&&await B;for(let $=C();$;$=C())await $})();let Y;const F=new Promise($=>{Y=setTimeout($,M)});return Promise.race([V,F]).then(()=>clearTimeout(Y))}totalPending(){if(this.#r.failed)return!1;if(this.#r.counting===!0)return!0;if(this.#N())return!1;this.#de();const C=this.#r;return C.count===null&&!C.complete&&C.cache.loadedExtent()===0}totalFailed(){return this.#r.failed===!0}#Me(C){C.length===this.#u.length&&C.every((B,x)=>B===this.#u[x])||(this.#u=C,this.#Z("column:pivoted",{pivotFields:C,remote:!0}))}#Le(){const C=this.#t.config||{};return C.pivot&&C.pivot.separator||v}#je(C){const B=this.#Le(),x=this.#ke();if(!x.length)return C.slice();const V=[];for(const Y of C)for(const F of x)V.push(`${Y}${B}${F}`);return V}#se(C){const B=this.#Le();this.#d||(this.#d={keys:new Map,cells:new Map,result:null});const x=this.#d;let V=!1;const Y=$=>{const q=Array.isArray($)?$:[$],ee=w(q,B);return x.keys.has(ee)||(x.keys.set(ee,q),V=!0),ee},F=this.#$("groupBy",[]).length>0;for(const $ of Array.isArray(C.axis)?C.axis:[])Y($);for(const $ of Array.isArray(C.cells)?C.cells:[]){if(!$||typeof $!="object")continue;const q=Y($.pivot);if(F&&!(Array.isArray($.group)&&$.group.length))continue;const ee=w(Array.isArray($.group)?$.group:[],B);for(const[te,re]of Object.entries($.values||{}))x.cells.set(h(ee,q,te),re)}x.result=null,V&&this.#Me((this.pivot()||{fields:[]}).fields)}#$e(C){let B=this.#oe(C);for(const x of C.children.values())this.#ge(x.key)&&(B+=this.#$e(x));return B}#oe(C){if(C.count!==null)return C.count;const B=C.cache.loadedExtent();return C.complete?B:C.row&&C.row.leafCount>0?C.level>=this.#$("groupBy",[]).length?Math.max(B,C.row.leafCount):B===0?1:Math.min(B+C.cache.pageSize,Math.max(B,C.row.leafCount)):B+C.cache.pageSize}#J(C,B){let x=B,V=0;const Y=[...C.children.entries()].filter(([,$])=>this.#ge($.key)).sort(($,q)=>$[0]-q[0]);for(const[$,q]of Y){const ee=$-V+1;if(x<ee)return{node:C,local:V+x};x-=ee,V=$+1;const te=this.#$e(q);if(x<te)return this.#J(q,x);x-=te}const F=this.#oe(C);return V+x<F?{node:C,local:V+x}:null}#H(C,B){const x=`${C.key}:${B}`,V=this.#a.get(x);if(V)return V;const Y=C.cache.rowAt(B);if(Y===void 0)return null;const F=this.#$("groupBy",[]);let $;if(C.level<F.length&&!C.flat){const q=F[C.level],ee=this.#d!==null&&C.level===F.length-1&&this.#$("pivotBy",[]).length>0,te=this.#fe(Y,q),re=te==null,ie=[...C.path,re?"":String(te)],ue=[...C.keyPath,re?null:String(te)];if($=this.#l.group({path:ie,keyPath:ue,column:q,value:te,level:C.level,parent:C.row,leafCount:Number(Y.leafCount)||0,expanded:ee?!1:this.#ge(o(ue)),...ee?{hasChildren:!1}:{}}),$.totals=this.#B(Y),$.data=Y,!ee){let Ae=this.#s.get($.key);Ae?Ae.row=$:(Ae=new O(ie,C.level+1,this.#n,ue),Ae.row=$,this.#s.set(Ae.key,Ae)),Ae.values=[...C.values,te],C.children.set(B,Ae)}}else $=this.#l.leaf(Y,B,C.level,C.row);return this.#a.set(x,$),this.#c.set($.key,x),$}#B(C){const B=C||{};if(B.totals&&typeof B.totals=="object")return B.totals;const x={};for(const V of this.#ke())Object.hasOwn(B,V)&&(x[V]=B[V]);return x}#Q(C,B){const{start:x,end:V}=C.cache.rangeOf(B);for(let Y=x;Y<V;Y++){const F=`${C.key}:${Y}`,$=this.#a.peek(F);$&&this.#c.delete($.key),this.#a.delete(F)}}#de(){const C=this.#we();return C===this.#f?!1:(this.#f=C,this.#o.abortAll("query"),this.#le(),this.#m=!1,this.#Z("model:changed",{reason:"query"}),!0)}#le(){for(const C of this.#s.values())C.cache.clear(),C.count=null,C.complete=!1,C.announced=null,C.counting=!1,C.failed=!1,C.children.clear(),C.flat=!1;this.#a.clear(),this.#c.clear(),this.#y++,this.#d=null}#we(){const C=this.#$("where",null);return`${n({filters:this.#$("filters",null),sort:this.#$("sort",[]),quick:this.#$("quick",""),groupBy:this.#$("groupBy",[]),pivotBy:this.#$("pivotBy",[]),context:this.#$("context",null)})}|${C?C.version:0}`}#ge(C){const B=this.#$("expanded",null);return B?U(B.has)?B.has(C):Array.prototype.includes.call(B,C):this.#i.has(C)}#ke(){const C=this.#$("totals",[]);if(C&&C.length)return[...C];const B=this.#t.columns;return!B||!U(B.all)?[]:B.all().filter(x=>!!x.total).map(x=>x.id)}#De(C){const B=this.#t.columns,x={};if(!B||!U(B.get))return x;for(const V of C){const Y=B.get(V);if(!Y)continue;const F=Y.groupTotal!=null?Y.groupTotal:Y.total;typeof F=="string"&&(x[V]=F)}return x}#fe(C,B){const x=this.#t.columns,V=x&&U(x.get)?x.get(B):void 0;return V&&U(V.getValue)?V.getValue(C):C?.[B]}#he(){p(this.#t)}#pe(){const C=this.#t.config||{};return{tz:C.timeZone,weekStartsOn:C.weekStartsOn}}#$(C,B){const x=this.#t.state;if(x&&U(x[C])){const V=x[C]();return V??B}return B}#Z(C,B){const x=this.#t.emit;U(x)&&x(C,B)}}}),ze("packages/core/src/source/gapbuffer.js",function(e,_){"use strict";Object.defineProperty(e,"GapBuffer",{enumerable:!0,get:function(){return E}});const ne=64;class E{#e;#t=0;#n=0;constructor(U=ne){this.#e=new Uint32Array(Math.max(1,U)),this.#n=this.#e.length}static from(U,D=ne){const J=new E(U.length+Math.max(1,D));return J.#e.set(U,0),J.#t=U.length,J.#n=J.#e.length,J}get length(){return this.#t+(this.#e.length-this.#n)}get capacity(){return this.#e.length}at(U){return U<0||U>=this.length?0:U<this.#t?this.#e[U]:this.#e[U+(this.#n-this.#t)]}insert(U,D){const J=U<0?0:U>this.length?this.length:U;this.#r(J),this.#t===this.#n&&this.#s(),this.#e[this.#t++]=D}push(U){this.insert(this.length,U)}removeAt(U){return!Number.isInteger(U)||U<0||U>=this.length?!1:(this.#r(U),this.#n++,!0)}toArray(){const U=new Uint32Array(this.length);return U.set(this.#e.subarray(0,this.#t),0),U.set(this.#e.subarray(this.#n),this.#t),U}clear(){this.#t=0,this.#n=this.#e.length}#r(U){if(U!==this.#t)if(U<this.#t){const D=this.#t-U;this.#e.copyWithin(this.#n-D,U,this.#t),this.#t=U,this.#n-=D}else{const D=U-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+D),this.#t=U,this.#n+=D}}#s(){const U=this.#e.length-this.#n,D=new Uint32Array(Math.max(this.#e.length*2,this.#e.length+ne));D.set(this.#e.subarray(0,this.#t),0),D.set(this.#e.subarray(this.#n),D.length-U),this.#e=D,this.#n=D.length-U}}}),ze("packages/core/src/store/ingest.js",function(e,_){"use strict";Object.defineProperty(e,"INGEST_DEFAULTS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"inferKind",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"decideText",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"createReaders",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"Ingest",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return d}});const ne=_("packages/core/src/internal/schedule.js"),E=ne.now,K=ne.nextFrame,U=_("packages/core/src/internal/warn.js"),D=U.infoOnce,J=U.warnOnce,L=_("packages/core/src/internal/predicates.js").isFunction,I=_("packages/core/src/internal/paths.js").pathGetter,k=_("packages/core/src/store/columnstore.js").ColumnStore,y=Object.freeze({chunkMs:8,chunkRows:512,sampleSize:100,dictionaryRatio:.1,columnarBelow:5e3,initialCapacity:1024});function l(n,p={}){if(p.multi)return"multi";if(n.length===0)return"object";let i=0,r=0,f=0,m=0,u=0;for(let a=0;a<n.length;a++){const h=n[a];typeof h=="number"?i++:typeof h=="boolean"?r++:typeof h=="string"?f++:h instanceof Date?m++:Array.isArray(h)&&u++}const b=n.length;return i===b?"float64":r===b?"bitset":m===b?"float64":f===b?"text":u===b?"multi":"object"}function g(n,p,i){return p<=0||n<i*p?"dictionary":"object"}function s(n,p,i){const r=new Map,f=new Map;for(const G of n){if(G.computed)continue;const Z=L(G.read)?G.read:I(G.field||G.id);f.set(G.id,Z),r.set(G.id,Z)}const m=p?.order??[],u=p?.fns??{},b=p?.deps??{},a=p?.wrapDeps??null,h=m.filter(G=>L(u[G])),w=h.some(G=>b[G]==="*");let v=new WeakMap;const A=G=>{const Z={};if(w)for(const[M,S]of f)Z[M]=S(G);for(const M of h){const S=b[M];let T;if(S==="*")T=Z;else{T={};const O=S||[];for(let N=0;N<O.length;N++){const P=O[N];T[P]=P in Z?Z[P]:f.get(P)?.(G)}}Z[M]=u[M](a?a(T,M):T,{data:G,row:null,column:null,grid:null,context:i})}return Z},H=G=>{if(G===null||typeof G!="object"&&typeof G!="function")return A(G);let Z=v.get(G);return Z===void 0&&(Z=A(G),v.set(G,Z)),Z};for(const G of h)r.set(G,Z=>H(Z)[G]);return{readers:r,reset(){v=new WeakMap}}}class t{spec;read;kind;inferred;nullable;candidate=!1;distinct=null;change=null;reason="";constructor(p,i){this.spec=p,this.read=i,this.kind="object",this.inferred=!1,this.nullable=p.nullable!==!1}}class o{#e;#t=[];#n=null;#r;#s=0;#i;#o=!1;#l=!1;#a=0;#c;constructor(p,i={},r={}){this.#e=Array.isArray(p)?p:Array.from(p||[]),this.#i={...y,...r};const f=i.columns??[];this.#r=s(f,i.computed??null,i.context),this.#c=this.#e.length>=this.#i.columnarBelow,this.#u(f,i.computed??null),this.#n=new k(this.#t.map(m=>({id:m.spec.id,kind:m.kind,nullable:m.nullable,read:m.read,dictionary:m.spec.dictionary})),{initialCapacity:this.#i.initialCapacity,columnarBelow:this.#i.columnarBelow})}get store(){return this.#n}get done(){return this.#o||this.#l}get progress(){return this.#s}slice(){if(this.done)return!1;if(this.#i.signal?.aborted)return this.#l=!0,!1;const p=E(),{chunkMs:i,chunkRows:r}=this.#i,f=this.#e.length;do{const m=Math.min(this.#s+r,f);this.#n.append(this.#e.slice(this.#s,m)),this.#d(this.#s,m),this.#s=m,this.#r.reset(),this.#h(!1)}while(this.#s<f&&E()-p<i);return this.#a+=E()-p,this.#i.onProgress?.({loaded:this.#s,total:f}),this.#s>=f?(this.#h(!0),this.#o=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(p=>({id:p.spec.id,kind:p.kind,nullable:p.nullable,read:p.read,dictionary:p.spec.dictionary})),decisions:this.#t.map(p=>({id:p.spec.id,kind:p.kind,nullable:p.nullable,inferred:p.inferred,distinct:p.candidate||p.change?this.#f(p):null,change:p.change,reason:p.reason})),count:this.#n.count,elapsed:this.#a,cancelled:this.#l}}#u(p,i){const r=this.#e,f=Math.min(this.#i.sampleSize,r.length),m=this.#i.dictionaryRatio,u=i?.pure instanceof Set?i.pure:new Set(i?.pure??i?.order??[]);for(const b of p){if(!b||!b.id)continue;if(b.computed&&(b.pure===!1||i&&!u.has(b.id))){J(`ingest.impure.${b.id}`,`column "${b.id}" is an impure computed column and is not materialised into the store`);continue}const a=this.#r.readers.get(b.id)??(L(b.read)?b.read:I(b.field||b.id)),h=new t(b,a);if(b.kind)h.kind=b.kind,h.reason="declared by the caller";else if(b.dictionary)h.kind=b.multi?"multi":"dictionary",h.reason="value table supplied (lookup column)";else{const w=[];for(let A=0;A<f&&w.length<this.#i.sampleSize;A++){const H=a(r[A]);H!=null&&w.push(H)}h.inferred=!0;const v=l(w,{multi:b.multi});if(v==="text"){const A=new Set(w).size;h.kind=g(A,w.length,m),h.candidate=this.#c,h.reason=`sampled ${A} distinct in ${w.length}`}else h.kind=v,h.reason=`inferred from ${w.length} sampled values`,v==="object"&&w.length&&D(`ingest.mixed.${b.id}`,`column "${b.id}" holds mixed or unrecognised value types; storing as an object array. Declare a type to avoid this.`);h.kind==="object"&&h.candidate&&(h.distinct=new Set(w))}this.#t.push(h)}}#d(p,i){const r=this.#e;for(const f of this.#t){if(!f.candidate||!f.distinct)continue;const m=f.distinct;for(let u=p;u<i;u++){const b=f.read(r[u]);b!=null&&m.add(b)}}}#f(p){if(p.distinct)return p.distinct.size;const i=this.#n.column(p.spec.id);return i?.dict?i.dict.size:0}#h(p){const i=this.#i.dictionaryRatio,r=this.#e.length;for(const f of this.#t){if(!f.candidate)continue;const m=this.#f(f);if(f.kind==="dictionary"&&m>=i*r){const u=this.#n.column(f.spec.id);f.distinct=new Set(u?.dict?u.dict.values():[]),this.#n.convert(f.spec.id,"object"),f.kind="object",f.change="demoted",f.reason=`${m} distinct values is at or above ${i*100}% of ${r} rows`;continue}if(f.kind==="object"&&m>=i*r){f.candidate=!1,f.distinct=null,f.reason=`${m} distinct values is at or above ${i*100}% of ${r} rows`;continue}p&&f.kind==="object"&&m<i*r&&(this.#n.convert(f.spec.id,"dictionary"),f.kind="dictionary",f.change=f.change==="demoted"?null:"promoted",f.reason=`${m} distinct values is below ${i*100}% of ${r} rows`,f.distinct=null),p&&(f.candidate=!1)}}}async function c(n,p={},i={}){const r=new o(n,p,i),f=i.scheduler?.frame??K;for(;r.slice();)await new Promise(m=>{f(m)});return r.result()}function d(n,p={},i={}){const r=new o(n,p,{...i,chunkMs:1/0});for(;r.slice(););return r.result()}}),ze("packages/core/src/store/columnpack.js",function(e,_){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return g}});const E=_("packages/core/src/internal/paths.js").pathGetter,K=_("packages/core/src/store/ingest.js"),U=K.inferKind,D=K.decideText,J=K.INGEST_DEFAULTS,L=_("packages/core/src/store/columnstore.js").toFloat,X=new Set(["float64","int32","bitset","dictionary","object","multi"]);function I(s){if(!Array.isArray(s)||s.length===0)return!1;for(const t of s)if(!t||typeof t.id!="string"||typeof t.field!="string"||t.field===""||t.kind&&!X.has(t.kind))return!1;return!0}function j(s){const t=L(s);return Number.isFinite(t)?t|0:0}function k(s){return s==null?[]:Array.isArray(s)?s:[s]}function y(s,t,o,c){if(s.kind)return s.kind;const d=[];for(let i=0;i<t.length&&d.length<J.sampleSize;i++){const r=t[i];r!=null&&d.push(r)}const n=U(d,{multi:s.multi});if(n!=="text")return n;const p=new Set(d).size;return D(p,d.length,c)}function l(s,t,o={}){const c=t.length|0,d=o.dictionaryRatio??J.dictionaryRatio,n=[];for(const p of s){const i=E(p.field||p.id),r=p.nullable!==!1,f=new Array(c);for(let h=0;h<c;h++){const w=i(t[h]);f[h]=w===void 0?null:w}const m=y(p,f,c,d),u=r?new Uint8Array(c+7>>3):null,b=h=>{u&&(u[h>>3]|=1<<(h&7))};let a;switch(m){case"float64":{const h=new Float64Array(c);for(let w=0;w<c;w++){const v=f[w],A=v===null;A||b(w),h[w]=A?NaN:L(v)}a={id:p.id,kind:m,nullable:r,values:h,presence:u,offsets:null,table:null};break}case"int32":{const h=new Int32Array(c);for(let w=0;w<c;w++){const v=f[w],A=v===null;A||b(w),h[w]=A?0:j(v)}a={id:p.id,kind:m,nullable:r,values:h,presence:u,offsets:null,table:null};break}case"bitset":{const h=new Uint8Array(c+7>>3);for(let w=0;w<c;w++){const v=f[w],A=v===null;A||b(w),!A&&v&&(h[w>>3]|=1<<(w&7))}a={id:p.id,kind:m,nullable:r,values:h,presence:u,offsets:null,table:null};break}case"dictionary":{const h=new Uint32Array(c),w=[],v=new Map;for(let A=0;A<c;A++){const H=f[A];if(H===null){h[A]=0;continue}b(A);let G=v.get(H);G===void 0&&(G=w.length,w.push(H),v.set(H,G)),h[A]=G}a={id:p.id,kind:m,nullable:r,values:h,presence:u,offsets:null,table:w};break}case"multi":{const h=[],w=new Map,v=new Uint32Array(c+1),A=[];for(let H=0;H<c;H++){const G=f[H];v[H]=A.length,G===null||b(H);const M=k(G);for(let S=0;S<M.length;S++){const T=M[S];let O=w.get(T);O===void 0&&(O=h.length,h.push(T),w.set(T,O)),A.push(O)}}v[c]=A.length,a={id:p.id,kind:m,nullable:r,values:Int32Array.from(A),presence:u,offsets:v,table:h};break}default:{const h=new Array(c);for(let w=0;w<c;w++){const v=f[w];v!==null&&b(w),h[w]=v}a={id:p.id,kind:"object",nullable:r,values:h,presence:u,offsets:null,table:null};break}}n.push(a)}return{count:c,columns:n}}function g(s){const t=[];if(!s||!Array.isArray(s.columns))return t;const o=c=>{ArrayBuffer.isView(c)&&c.buffer&&!t.includes(c.buffer)&&t.push(c.buffer)};for(const c of s.columns)o(c.values),o(c.presence),o(c.offsets);return t}}),ze("packages/core/src/source/stream.js",function(e,_){"use strict";Object.defineProperty(e,"DEFAULT_PROMOTE_BELOW",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"createStreamSource",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return O}});const E=_("packages/core/src/internal/lru.js").Lru,U=_("packages/core/src/internal/predicates.js").isFunction,D=_("packages/core/src/internal/schedule.js"),J=D.now,z=D.nextFrame,L=D.cancelFrame,X=D.whenIdle,j=_("packages/core/src/internal/compare.js").defaultCompare,k=_("packages/core/src/internal/warn.js"),y=k.warnOnce,l=k.infoOnce,s=_("packages/core/src/internal/paths.js").getPath,t=_("packages/core/src/source/abort.js"),o=t.createAbortScope,c=t.isAbortError,d=_("packages/core/src/source/rows.js"),n=d.createRowFactory,p=d.lazyRowView,r=_("packages/core/src/source/gapbuffer.js").GapBuffer,m=_("packages/core/src/source/memory.js").createMemorySource,b=_("packages/core/src/source/filterwire.js").querySignature,h=_("packages/core/src/store/columnpack.js").isPortableSchema,w=25e4,v=Symbol("lattice.stream.storeBacked"),A=8,H=.1,G=1e3,Z=50;function M(N){return Math.min(G,Math.max(Z,Math.floor(N/4)))}function S(N){if(N instanceof Date)return N.getTime();if(typeof N=="number")return Number.isFinite(N)?N:NaN;if(typeof N=="string"){const P=N.trim();if(!P)return NaN;const C=Date.parse(P);return Number.isNaN(C)?Number(P):C}return NaN}function T(N,P){return new O(N,P)}class O{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#s=[];#i=null;#o;#l;#a=new Map;#c=o();#u={loaded:0,estimated:void 0};#d=null;#f=0;#h=0;#p=0;#m=0;#g=null;#b=null;#y=null;#S=!1;#w=!1;#A=!1;#v=!1;#P="";#O=0;#C=0;#E=0;#T=null;#M=1/0;#N=!1;#R=null;#F=null;#W=null;#V=null;#x=!1;#q=0;#_=0;#Y=!1;constructor(P,C){this.#e=P||{mode:"stream"},this.#t=C||{},this.#o=n(this.#t),this.#l=new E(4096),this.#P=this.#Be();const B=(this.#t.config||{}).ingest;this.#x=!!B&&B.retainSource===!1,U(this.#e.open)||y("source.stream.open",'source.mode "stream" requires an open function; the grid will stay empty.'),this.#e.autoStart!==!1&&queueMicrotask(()=>this.start());const x=Number(this.#e.poll);Number.isFinite(x)&&x>0&&(this.#V=setInterval(()=>{this.#v||this.reload()},x),this.#V&&U(this.#V.unref)&&this.#V.unref()),this.#I()}#G(){const P=Number(this.#e.maxAge);return Number.isFinite(P)&&P>0?P:0}#I(){const P=this.#G();if(!P)return;const C=this.#e.ageBy;U(C)?this.#F=C:typeof C=="string"&&C?this.#F=B=>s(B,C):this.#F=null,this.#T=[],this.#R=setInterval(()=>{this.#v||this.#U()&&(this.#de(),this.#re())},M(P)),this.#R&&U(this.#R.unref)&&this.#R.unref()}#U(){const P=this.#G();return!P||!this.#T?!1:this.#N?!0:this.#M<Date.now()-P*(1+H)}#ye(P,C){if(!this.#T)return;const B=this.#F?S(this.#F(C)):Date.now();this.#T[P]=B,Number.isNaN(B)||(B<this.#M&&(this.#M=B),B<Date.now()-this.#G()&&(this.#N=!0))}#ce(){return this.#Se("groupBy",[]).length>0?!0:!!this.#Se("pivotMode",!1)&&this.#Se("pivotBy",[]).length>0}#ue(){if(this.#g||this.#v)return;const P=this.#ce();if(P&&!this.#b){this.#b=m({mode:"memory",rows:this.#n},this.#Ne()),this.#S=!1;return}!P&&this.#b&&(this.#b.destroy(),this.#b=null)}#Ne(){if(this.#y)return this.#y;const P=this,C={liveIndices:()=>P.#ie(),live:B=>P.#n[B]!==void 0,source:B=>P.#Ae(B),get physical(){return P.#n.length}};return this.#x&&(C.column=B=>{const x=P.#t.store;return x&&U(x.column)?x.column(B):void 0}),this.#y=Object.create(this.#t,{store:{value:C,enumerable:!0,configurable:!0}}),this.#y}#ie(){const P=new Uint32Array(this.#n.length);let C=0;for(let B=0;B<this.#n.length;B++)this.#n[B]!==void 0&&(P[C++]=B);return P.subarray(0,C)}#me(){return this.#g?this.#g:this.#b?(this.#S&&(this.#S=!1,this.#b.setRows(this.#n)),this.#b):null}invalidate(P="filter"){if(this.#g){this.#g.invalidate(P);return}this.#ue(),this.#b&&this.#b.invalidate(P),(P==="filter"||P==="sort")&&this.#ke()}count(){const P=this.#me();return P?P.count():this.#r?this.#r.length:this.#O}matchCount(){const P=this.#me();return P&&U(P.matchCount)?P.matchCount():this.#r?this.#r.length:this.#O}totalCount(){const P=this.#me();return P&&U(P.totalCount)?P.totalCount():this.#O}unfilteredRows(){const P=this.#me();if(P&&U(P.unfilteredRows))return P.unfilteredRows();const C=[];for(let B=0;B<this.#n.length;B++){if(!this.#n[B])continue;const x=this.#k(B);x&&C.push(x)}return C}at(P){const C=this.#me();if(C)return C.at(P);if(P<0||P>=this.count())return;const B=this.#r?this.#r.at(P):P,x=this.#k(B);return x.index=P,x}byKey(P){const C=this.#me();if(C)return C.byKey(P);const B=this.#a.get(P);return B===void 0?void 0:this.#k(B)}leavesOf(P){const C=this.#me();return C&&U(C.leavesOf)?C.leavesOf(P):[]}loaded(P){return P>=0&&P<this.count()}hint(P,C){if(this.#g){this.#g.hint(P,C);return}this.#Me(),this.#p=Math.max(0,Math.floor(P))}#Me(){this.#v||this.#Be()===this.#P||this.reload()}display(){const P=this.#me();return P?P.display():p(()=>this.count(),C=>this.at(C))}apply(P){if(this.#g)return this.#g.apply(P);const C={added:[],updated:[],removed:[]};if(!P)return C;if(P.update){let B=!1;for(const x of P.update){const V=this.#a.get(this.#o.keyOf(x,-1));if(V===void 0)continue;const Y=this.#he(V);this.#x?this.#He(V,x):this.#n[V]=x,this.#l.delete(V),this.#pe(V,Y),this.#T&&(this.#ye(V,x),B=!0),this.#S=!0,C.updated.push(this.#k(V))}B&&this.#de()}if(P.add&&P.add.length){const B=this.#B(P.add);for(const x of B)C.added.push(this.#k(x))}return P.remove&&P.remove.length&&y("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#re(),C}reload(P){this.#c.abortAll("reload"),this.#Xe(),this.#b&&(this.#b.destroy(),this.#b=null),this.#S=!1,this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear(),this.#g=null,this.#O=0,this.#C=0,this.#E=0,this.#T&&(this.#T=[]),this.#M=1/0,this.#N=!1,this.#w=!1,this.#A=!1,this.#u={loaded:0,estimated:void 0},this.#P=this.#Be(),this.#Oe("model:changed",{reason:"reload"}),this.start()}destroy(){this.#v=!0,this.#V!==null&&(clearInterval(this.#V),this.#V=null),this.#R!==null&&(clearInterval(this.#R),this.#R=null),this.#T=null,this.#c.abortAll("destroyed"),this.#Xe(),this.#d!==null&&(this.#ve(this.#d),this.#d=null),this.#b&&(this.#b.destroy(),this.#b=null),this.#g&&this.#g.destroy(),this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear()}async start(){if(this.#A||this.#v||!U(this.#e.open))return;this.#A=!0;const P=this.#c.begin("stream");this.#ke(),this.#ue();let C;try{C=this.#e.open({sort:this.#Se("sort",[]),filters:this.#Se("filters",null),quick:this.#Se("quick","")||void 0,context:this.#Se("context",null),signal:P.signal})}catch(x){this.#Oe("source:error",{error:x});return}const B=U(C[Symbol.asyncIterator])?C[Symbol.asyncIterator]():C[Symbol.iterator]();this.#W=B;try{for(;;){const x=await B.next();if(!P.current||this.#v)return;if(x.done){this.#ne();return}if(await this.#Le(x.value,P),!P.current||this.#v)return;if(x.value&&x.value.done){this.#ne();return}if(await this.#_e(),!P.current||this.#v)return}}catch(x){if(c(x))return;this.#Oe("source:error",{error:x})}finally{P.settle()}}progress(){return{loaded:this.#u.loaded,estimated:this.#u.estimated,done:this.#w,live:this.#O,evicted:this.#C}}promoted(){return this.#g!==null}memorySource(){return this.#g}invalidateHandles(){const P=this.#me();P&&(U(P.invalidateHandles)&&P.invalidateHandles(),U(P.invalidate)&&P.invalidate("sort"))}renderCount(){return this.#f}ingestStats(){return{worker:this.#q,inline:this.#_,storeBacked:this.#x}}#Le(P,C){if(!P)return;const B=P.rows;if(B&&B.length&&this.#se(B))return this.#oe(P,C);const x=J();B&&B.length&&(this.#B(B),this.#_++),this.#je(P),this.#h+=J()-x,this.#re()}#je(P){this.#u.loaded=P.progress&&typeof P.progress.loaded=="number"?P.progress.loaded:this.#n.length,P.progress&&typeof P.progress.estimated=="number"&&(this.#u.estimated=P.progress.estimated)}#se(P){if(this.#Y||this.#g)return!1;const C=this.#J();if(!C)return!1;const B=this.#t.store;if(!B||!U(B.appendPacked))return!1;const x=this.#H();return!x||!h(x)?(this.#Y=!0,l("source.stream.ingest-worker","stream ingest.useWorker is on but a column reads through a closure (a computed or date column); columnizing on the main thread instead."),!1):P.length<C.threshold?!1:!this.#$e(P)}#$e(P){if(!this.#o.keyed)return!1;const C=new Set;for(let B=0;B<P.length;B++){const x=this.#o.keyOf(P[B],this.#n.length+B);if(x!=null){if(C.has(x)||this.#a.has(x))return!0;C.add(x)}}return!1}async#oe(P,C){const B=P.rows,x=this.#J(),V=this.#H();let Y;try{Y=await x.columnize(V,B,{key:"ingest:stream",signal:C&&C.signal})}catch(te){if(c(te)||(y("source.stream.columnize","worker columnization failed; columnizing on the main thread",te),this.#Y=!0,C&&(!C.current||this.#v)))return;this.#B(B),this.#_++,this.#je(P),this.#re();return}if(C&&(!C.current||this.#v))return;const F=this.#t.store,$=this.#x?void 0:B,{from:q}=F.appendPacked(Y,$),ee=Y.count|0;for(let te=0;te<ee;te++){const re=q+te,ie=B[te],ue=this.#o.keyed?this.#o.keyOf(ie,re):null;if(this.#n[re]=this.#x?v:ie,this.#O++,this.#ye(re,ie),ue!==null&&this.#a.set(ue,re),!this.#r||!this.#De(re))continue;const Ae=this.#$(re);this.#r.insert(Ae,re),Ae<=this.#p&&this.#m++}this.#S=!0,this.#de(),this.#q++,this.#je(P),this.#re()}#J(){const P=this.#t.ingestWorker;return U(P)?P():null}#H(){const P=this.#t.storeSchema;return U(P)?P():null}#B(P){const C=[],B=this.#t.store,x=new Array(P.length),V=[],Y=new Set;for(let $=0;$<P.length;$++){const q=this.#o.keyed?this.#o.keyOf(P[$],this.#n.length+V.length):null;x[$]=q,!(q!==null&&(this.#a.has(q)||Y.has(q)))&&(q!==null&&Y.add(q),V.push(P[$]))}let F=V.length&&B&&U(B.append)?B.append(V).from:this.#n.length;for(let $=0;$<P.length;$++){const q=P[$],ee=x[$];if(ee!==null&&this.#a.has(ee)){const ie=this.#a.get(ee),ue=this.#he(ie);this.#x||(this.#n[ie]=q,B&&U(B.setSource)&&B.setSource(ie,q)),this.#He(ie,q),this.#l.delete(ie),this.#ye(ie,q),this.#pe(ie,ue);continue}const te=F++;if(this.#n[te]=this.#x?v:q,this.#O++,this.#ye(te,q),ee!==null&&this.#a.set(ee,te),C.push(te),!this.#r||!this.#De(te))continue;const re=this.#$(te);this.#r.insert(re,te),re<=this.#p&&this.#m++}return this.#S=!0,this.#de(),C}#Q(P){const C=this.#n[P];let B=!1;if(this.#r){const F=this.#ge(P);F>=0&&F<=this.#p&&(B=!0)}else P<=this.#p&&(B=!0);const x=C===v?this.#Ae(P):C,V=this.#o.keyed?this.#o.keyOf(x,P):null;V!==null&&this.#a.get(V)===P&&this.#a.delete(V),this.#n[P]=void 0,this.#T&&(this.#T[P]=NaN),this.#l.delete(P);const Y=this.#t.store;return Y&&U(Y.remove)&&Y.remove(P),this.#O--,B}#de(){let P=0,C=0;const B=this.#we();P+=B.dropped,C+=B.aboveAnchor;const x=this.#le();P+=x.dropped,C+=x.aboveAnchor,P&&(this.#S=!0,this.#C+=P,this.#ke(),this.#m-=C,this.#Oe("stream:evicted",{evicted:P,total:this.#C,live:this.#O}))}#le(){const P=this.#e.maxRows;if(!Number.isFinite(P)||P<=0||this.#O<=P)return{dropped:0,aboveAnchor:0};const C=Math.max(1,Math.floor(P*(1-H)));let B=0,x=0;for(;this.#O>C&&this.#E<this.#n.length;){const V=this.#E++;this.#n[V]!==void 0&&(this.#Q(V)&&x++,B++)}return{dropped:B,aboveAnchor:x}}#we(){const P=this.#G();if(!P||!this.#T||!this.#U())return{dropped:0,aboveAnchor:0};const C=Date.now()-P;let B=0,x=0,V=1/0;for(let Y=this.#E;Y<this.#n.length;Y++){if(this.#n[Y]===void 0)continue;const F=this.#T[Y];if(!(Number.isNaN(F)||F===void 0)){if(F>=C){F<V&&(V=F);continue}this.#Q(Y)&&x++,B++}}for(this.#M=V,this.#N=!1;this.#E<this.#n.length&&this.#n[this.#E]===void 0;)this.#E++;return{dropped:B,aboveAnchor:x}}#ge(P){if(!this.#r)return P;for(let C=0;C<this.#r.length;C++)if(this.#r.at(C)===P)return C;return-1}#ke(){this.#s=this.#Se("sort",[]),this.#i=this.#Se("filters",null);const P=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#G()>0,C=this.#Se("where",null),B=(this.#t.config||{}).hostFilter,x=!!(C&&C.active)||!!(B&&U(B.active)&&B.active());if(!(P||this.#s.length>0||!!this.#i||!!this.#Se("quick","")||x)){this.#r=null;return}this.#r=new r(Math.max(64,this.#n.length+64));for(let Y=0;Y<this.#n.length;Y++)this.#n[Y]!==void 0&&this.#De(Y)&&this.#r.insert(this.#$(Y),Y)}#De(P){const C=this.#Ae(P);if(this.#i&&!this.#fe(this.#i,C))return!1;const B=String(this.#Se("quick","")||"").toLowerCase();if(B&&!this.#We(C).includes(B))return!1;const x=(this.#t.config||{}).hostFilter;if(x&&U(x.active)&&x.active()&&!x.passes(this.#k(P)))return!1;const V=this.#Se("where",null);if(V&&V.active){const Y=this.#k(P);if(!V.passes(Y.data,Y.key))return!1}return!0}#fe(P,C){if(!P)return!0;const B=P;if(Array.isArray(B.conditions))return B.op==="or"?B.conditions.some(Y=>this.#fe(Y,C)):B.op==="not"?!B.conditions.some(Y=>this.#fe(Y,C)):B.conditions.every(Y=>this.#fe(Y,C));const x=P,V=(this.#t.compute||{}).testValue;return U(V)?!!V(this.#Ce(C,x.col),x,(this.#t.config||{}).locale):(y("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#he(P){if(!this.#r)return-1;if(!this.#s.length)return this.#ge(P);let C=0,B=this.#r.length;for(;C<B;){const x=C+B>>>1;this.#Z(this.#r.at(x),P)<0?C=x+1:B=x}for(let x=C;x<this.#r.length;x++){const V=this.#r.at(x);if(V===P)return x;if(this.#Z(V,P)>0)break}return this.#ge(P)}#pe(P,C){if(!this.#r||!this.#s.length)return;const B=this.#De(P);if(C>=0&&this.#r.at(C)===P)this.#r.removeAt(C),C<=this.#p&&this.#m--;else if(C>=0)return;if(!B)return;const x=this.#$(P);this.#r.insert(x,P),x<=this.#p&&this.#m++}#$(P){if(!this.#r||!this.#s.length)return this.#r?this.#r.length:0;let C=0,B=this.#r.length;for(;C<B;){const x=C+B>>>1;this.#Z(P,this.#r.at(x))<0?B=x:C=x+1}return C}#Z(P,C){const B=this.#Ae(P),x=this.#Ae(C);for(const V of this.#s){const Y=this.#Ye(V.col),F=this.#Ce(B,V.col),$=this.#Ce(x,V.col),ee=(Y&&Y.value&&U(Y.value.compare)?Y.value.compare:j)(F,$);if(ee!==0)return V.dir==="desc"?-ee:ee}return 0}#ne(){this.#w=!0,this.#u.loaded=this.#u.loaded||this.#n.length;const P=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:w;!this.#x&&this.#n.length<P&&(this.#g=m({mode:"memory",rows:this.#n},this.#t),this.#R!==null&&(clearInterval(this.#R),this.#R=null),this.#b&&(this.#b.destroy(),this.#b=null)),this.#re(),this.#Oe("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:P})}#re(){this.#d!==null||this.#v||(this.#d=this.#D(()=>{this.#d=null,this.#f++;const P=this.#m;this.#m=0,this.#h=0,this.#Oe("stream:chunk",{loaded:this.#u.loaded,estimated:this.#u.estimated,count:this.count(),renders:this.#f}),this.#Oe("model:changed",{reason:"stream",shiftAboveViewport:P,anchor:this.#p}),this.#Oe("rows:changed",{companion:!0,reason:"stream"})}))}#_e(){return this.#f===0||this.#h<this.#K()?Promise.resolve():(this.#h=0,new Promise(P=>{const C=(this.#t.scheduler||{}).idle;U(C)?C(()=>P()):X(()=>P())}))}#K(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:A}#D(P){const C=this.#t.scheduler||{};return U(C.frame)?C.frame(P):z(P)}#ve(P){const C=this.#t.scheduler||{};U(C.cancel)?C.cancel(P):L(P)}#Ae(P){const C=this.#n[P];if(C!==void 0&&C!==v)return C;if(C===void 0)return;const B=this.#t.store;return B&&U(B.source)?B.source(P):void 0}#He(P,C){const B=this.#t.store;if(!B||!U(B.set))return;const x=this.#H();if(Array.isArray(x))for(const V of x){if(!V||!V.id)continue;const Y=U(V.read)?V.read:F=>s(F,V.field||V.id);B.set(V.id,P,Y(C))}}#k(P){let C=this.#l.get(P);return C||(C=this.#o.leaf(this.#Ae(P),P),this.#l.set(P,C)),C}#Ce(P,C){const B=this.#Ye(C);return B&&U(B.getValue)?B.getValue(P):P?.[C]}#We(P){const C=this.#t.columns,B=C&&U(C.all)?C.all():[],x=[];for(const V of B){const Y=U(V.getValue)?V.getValue(P):void 0;Y!=null&&Y!==""&&x.push(String(Y))}return x.join(" ").toLowerCase()}#Ye(P){const C=this.#t.columns;return C&&U(C.get)?C.get(P):void 0}#Xe(){const P=this.#W;if(this.#W=null,P&&U(P.return))try{P.return()}catch{}}#Be(){return b({context:this.#Se("context",null)})}#Se(P,C){const B=this.#t.state;if(B&&U(B[P])){const x=B[P]();return x??C}return C}#Oe(P,C){const B=this.#t.emit;U(B)&&B(P,C)}}}),ze("packages/core/src/source/url.js",function(e,_){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return y}});const E=_("packages/core/src/internal/warn.js").warnOnce,K=_("packages/core/src/internal/predicates.js"),U=K.isObject,D=K.isFunction,z=_("packages/core/src/internal/paths.js").getPath,X=_("packages/core/src/source/abort.js").isAbortError,I=500,j=new Set(["application/x-ndjson","application/ndjson","application/jsonlines","application/jsonl","application/x-jsonlines","text/x-ndjson"]),k=Symbol("lattice.url.skip");function y(u,b={}){const a=U(b)?b:{},h=D(a.fetch)?a.fetch:typeof globalThis<"u"&&D(globalThis.fetch)?globalThis.fetch:null,w=a.format==="json"||a.format==="ndjson"?a.format:void 0,v=typeof a.rowsPath=="string"&&a.rowsPath?a.rowsPath:void 0,A=D(a.map)?a.map:void 0,H=U(a.headers)?a.headers:void 0,G=Number.isFinite(a.batchSize)&&a.batchSize>0?Math.floor(a.batchSize):I,Z=a.lenient===!0,M=Number.isFinite(a.poll)&&a.poll>0?Math.floor(a.poll):void 0,S=typeof u=="string"&&u.length>0;S||E("source.url.url","createUrlSource needs a URL string; the grid will stay empty.");async function*T(N={}){if(!S)return;if(!h)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const P=N&&N.signal;let C;try{C=await h(u,H?{signal:P,headers:H}:{signal:P})}catch(V){throw X(V)?V:new Error(`[lattice] createUrlSource: request to ${u} failed — ${V&&V.message||V}`)}if(!C||!C.ok){const V=C?C.status:"no response";throw new Error(`[lattice] createUrlSource: ${V} for ${u}`)}const B=l(u,w,C),x=C.body&&D(C.body.getReader)?C.body.getReader():null;try{if(!x){const F=await C.text();(B||t(F,u))==="ndjson"?yield*i(null,null,F,0,C,u,G,Z):yield*p(F,u,v,A);return}const V=new TextDecoder("utf-8");if(B==="json"){yield*p(await n(x,V,""),u,v,A);return}if(B==="ndjson"){yield*i(x,V,"",0,C,u,G,Z);return}const Y=await o(x,V,u);Y.format==="json"?yield*p(await n(x,V,Y.seed),u,v,A):yield*i(x,V,Y.seed,Y.bytes,C,u,G,Z)}finally{if(x&&D(x.cancel))try{await x.cancel()}catch{}}}const O={mode:"stream",open:T,autoStart:a.autoStart!==!1};return M!==void 0&&(O.poll=M),Number.isFinite(a.maxRows)&&(O.maxRows=a.maxRows),Number.isFinite(a.maxAge)&&(O.maxAge=a.maxAge),(typeof a.ageBy=="string"||D(a.ageBy))&&(O.ageBy=a.ageBy),Number.isFinite(a.coalesceMs)&&(O.coalesceMs=a.coalesceMs),Number.isFinite(a.promoteToMemoryBelow)&&(O.promoteToMemoryBelow=a.promoteToMemoryBelow),O}function l(u,b,a){if(b)return b;const h=g(u);if(h)return h;const w=a&&a.headers&&D(a.headers.get)?a.headers.get("content-type"):null;return s(w)}function g(u){const b=String(u).split(/[?#]/)[0].toLowerCase();if(b.endsWith(".ndjson")||b.endsWith(".jsonl"))return"ndjson";if(b.endsWith(".json"))return"json"}function s(u){if(!u)return;const b=u.split(";")[0].trim().toLowerCase();if(j.has(b))return"ndjson";if(b==="application/json"||b==="text/json"||b.endsWith("+json"))return"json"}function t(u,b){const a=u.replace(/^\s+/,""),h=c(a);if(h==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${b} — pass opts.format: 'json' | 'ndjson'.`);return h}async function o(u,b,a){let h="",w=0;for(;;){const{value:A,done:H}=await u.read();if(A&&(w+=A.byteLength,h+=b.decode(A,{stream:!0})),H){h+=b.decode();break}const G=h.replace(/^\s+/,"");if(G){if(G[0]==="[")return{format:"json",seed:h,bytes:w};if(G[0]!=="{"||h.indexOf(`
|
|
7
|
+
`||p==="\r"){n++;continue}if(p>="0"&&p<="9"){n=k(c,n,d);continue}if(p==="."&&c[n+1]>="0"&&c[n+1]<="9"){n=k(c,n,d);continue}if(p==='"'||p==="'"){n=y(c,n,d);continue}if(p==="["){const r=c.indexOf("]",n+1);if(r<0)throw new X("a [column reference] was opened and never closed",n);d.push({kind:K,value:c.slice(n+1,r).trim(),at:n}),n=r+1;continue}if(j(p)){n=l(c,n,d);continue}const i=c.slice(n,n+2);if(z.includes(i)){d.push({kind:D,value:i==="!="?"<>":i,at:n}),n+=2;continue}if(L.includes(p)){d.push({kind:D,value:p,at:n}),n++;continue}throw new X(`unexpected character ${JSON.stringify(p)}`,n)}return d.push({kind:J,value:null,at:c.length}),d}function j(c){return/[A-Za-z_À-]/.test(c)}function k(c,d,n){let p=d,i=!1;for(;p<c.length;){const r=c[p];if(r>="0"&&r<="9"){p++;continue}if(r==="."&&!i){i=!0,p++;continue}if((r==="e"||r==="E")&&/[0-9+-]/.test(c[p+1]||"")){for(p+=2;p<c.length&&c[p]>="0"&&c[p]<="9";)p++;break}break}return n.push({kind:ne,value:Number(c.slice(d,p)),at:d}),p}function y(c,d,n){const p=c[d];let i=d+1,r="";for(;i<c.length;){if(c[i]===p){if(c[i+1]===p){r+=p,i+=2;continue}return n.push({kind:E,value:r,at:d}),i+1}r+=c[i],i++}throw new X("a string was opened and never closed",d)}function l(c,d,n){let p=d;for(;p<c.length&&/[A-Za-z0-9_.À-]/.test(c[p]);)p++;const i=c.slice(d,p);let r=p;for(;r<c.length&&c[r]===" ";)r++;return n.push({kind:c[r]==="("?U:K,value:i,at:d}),p}const g={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function s(c){const d=String(c??"").replace(/^\s*=/,"");if(!d.trim())throw new X("the formula is empty");const n=I(d);let p=0;const i=()=>n[p],r=()=>n[p++],f=v=>{const A=i();if(A.kind!==D||A.value!==v)throw new X(`expected ${JSON.stringify(v)}`,A.at);p++},m=v=>{let A=u();for(;;){const H=i();if(H.kind!==D)break;const G=g[H.value];if(!G||G<v)break;p++;const Z=m(H.value==="^"?G:G+1);A={kind:"bin",op:H.value,left:A,right:Z}}return A},u=()=>{const v=i();return v.kind===D&&(v.value==="-"||v.value==="+")?(p++,{kind:"unary",op:v.value,arg:u()}):b()},b=()=>{let v=a();for(;i().kind===D&&i().value==="%";)p++,v={kind:"unary",op:"%",arg:v};return v},a=()=>{const v=r();if(v.kind===ne)return{kind:"num",value:v.value};if(v.kind===E)return{kind:"str",value:v.value};if(v.kind===K)return{kind:"ref",name:v.value};if(v.kind===U){f("(");const A=[];if(!(i().kind===D&&i().value===")"))for(;;){if(A.push(m(1)),i().kind===D&&i().value===","){p++;continue}break}return f(")"),{kind:"call",name:String(v.value).toUpperCase(),args:A}}if(v.kind===D&&v.value==="("){const A=m(1);return f(")"),A}throw v.kind===J?new X("the formula ends unexpectedly",v.at):new X(`unexpected ${JSON.stringify(v.value)}`,v.at)},h=m(1),w=i();if(w.kind!==J)throw new X(`unexpected ${JSON.stringify(w.value)}: is an operator missing?`,w.at);return h}function t(c){const d=new Set,n=p=>{if(!(!p||typeof p!="object")){if(p.kind==="ref"){d.add(String(p.name));return}if(p.kind==="bin"){n(p.left),n(p.right);return}if(p.kind==="unary"){n(p.arg);return}if(p.kind==="call")for(const i of p.args)n(i)}};return n(c),[...d]}function o(c){return typeof c=="string"&&/^\s*=/.test(c)&&c.trim()!=="="}}),ze("packages/core/src/formula/evaluate.js",function(e,_){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return k}});const E=_("packages/core/src/formula/parse.js").FormulaError;function K(y){if(y==null||y==="")return 0;if(typeof y=="boolean")return y?1:0;if(y instanceof Date)return y.getTime();const l=typeof y=="number"?y:Number(String(y).replace(/[,\s]/g,""));if(!Number.isFinite(l))throw new E(`${JSON.stringify(y)} is not a number`);return l}function U(y){return y==null?"":String(y)}function D(y){if(typeof y=="boolean")return y;if(y==null||y==="")return!1;if(typeof y=="number")return y!==0;const l=String(y).trim().toLowerCase();return l==="false"||l==="no"||l==="0"?!1:l!==""}function J(y){const l=[];for(const g of y){if(Array.isArray(g)){for(const s of g)s!=null&&s!==""&&l.push(K(s));continue}g==null||g===""||l.push(K(g))}return l}function z(y,l){const g=10**l,s=y*g;return Math.sign(s)*Math.round(Math.abs(s)+Number.EPSILON*Math.abs(s))/g}function L(y,l){if(!y.length)return 0;const g=y.slice().sort((c,d)=>c-d),s=(g.length-1)*Math.min(1,Math.max(0,l)),t=Math.floor(s),o=Math.ceil(s);return t===o?g[t]:g[t]+(s-t)*(g[o]-g[t])}function X(y,l){let g=0,s=0,t=0;for(const c of y){g++;const d=c-s;s+=d/g,t+=d*(c-s)}const o=l?g-1:g;return o>0?Math.sqrt(t/o):0}const I={SUM:y=>J(y).reduce((l,g)=>l+g,0),AVERAGE:y=>{const l=J(y);return l.length?l.reduce((g,s)=>g+s,0)/l.length:0},MIN:y=>{const l=J(y);return l.length?Math.min(...l):0},MAX:y=>{const l=J(y);return l.length?Math.max(...l):0},COUNT:y=>J(y).length,PRODUCT:y=>J(y).reduce((l,g)=>l*g,1),ROUND:y=>z(K(y[0]),y.length>1?K(y[1]):0),ROUNDDOWN:y=>{const l=10**(y.length>1?K(y[1]):0),g=K(y[0])*l;return(g<0?Math.ceil(g):Math.floor(g))/l},ROUNDUP:y=>{const l=10**(y.length>1?K(y[1]):0),g=K(y[0])*l;return(g<0?Math.floor(g):Math.ceil(g))/l},ABS:y=>Math.abs(K(y[0])),FLOOR:y=>Math.floor(K(y[0])),CEILING:y=>Math.ceil(K(y[0])),SQRT:y=>Math.sqrt(K(y[0])),POWER:y=>K(y[0])**K(y[1]),MOD:y=>{const l=K(y[1]);if(l===0)throw new E("MOD by zero");return(K(y[0])%l+l)%l},IF:y=>D(y[0])?y[1]:y.length>2?y[2]:!1,AND:y=>y.every(D),OR:y=>y.some(D),NOT:y=>!D(y[0]),COALESCE:y=>y.find(l=>l!=null&&l!=="")??null,CONCAT:y=>y.map(U).join(""),LEN:y=>U(y[0]).length,UPPER:y=>U(y[0]).toUpperCase(),LOWER:y=>U(y[0]).toLowerCase(),TRIM:y=>U(y[0]).trim(),LEFT:y=>U(y[0]).slice(0,y.length>1?K(y[1]):1),RIGHT:y=>{const l=y.length>1?K(y[1]):1;return l<=0?"":U(y[0]).slice(-l)},MEDIAN:y=>L(J(y),.5),PERCENTILE:y=>{const l=K(y[y.length-1]);return L(J(y.slice(0,-1)),l>1?l/100:l)},QUARTILE1:y=>L(J(y),.25),QUARTILE3:y=>L(J(y),.75),STDEV:y=>X(J(y),!0),STDEVP:y=>X(J(y),!1),VAR:y=>{const l=X(J(y),!0);return l*l},VARP:y=>{const l=X(J(y),!1);return l*l},COUNTDISTINCT:y=>{const l=new Set;for(const g of y){const s=Array.isArray(g)?g:[g];for(const t of s)t!=null&&t!==""&&l.add(t)}return l.size},IQR:y=>{const l=J(y);return L(l,.75)-L(l,.25)}};I.AVG=I.AVERAGE,I.CEIL=I.CEILING,I.POW=I.POWER,I.STDEVS=I.STDEV,I.PERCENTILEINC=I.PERCENTILE;function j(y,l){const g=Number(y),s=Number(l);if(y!==null&&y!==""&&l!==null&&l!==""&&Number.isFinite(g)&&Number.isFinite(s))return g<s?-1:g>s?1:0;const o=U(y).toLowerCase(),c=U(l).toLowerCase();return o<c?-1:o>c?1:0}function k(y,l={}){const g=typeof l.lookup=="function"?l.lookup:null,s=l.functions?{...I,...l.functions}:I,t=o=>{switch(o.kind){case"num":return o.value;case"str":return o.value;case"ref":{if(!g)throw new E(`there is no column called ${JSON.stringify(o.name)} here`);const c=g(String(o.name));if(c===void 0)throw new E(`there is no column called ${JSON.stringify(o.name)}`);return c}case"unary":{if(o.op==="%")return K(t(o.arg))/100;const c=K(t(o.arg));return o.op==="-"?-c:c}case"bin":{const c=o.op;if(c==="=")return j(t(o.left),t(o.right))===0;if(c==="<>")return j(t(o.left),t(o.right))!==0;if(c==="<")return j(t(o.left),t(o.right))<0;if(c==="<=")return j(t(o.left),t(o.right))<=0;if(c===">")return j(t(o.left),t(o.right))>0;if(c===">=")return j(t(o.left),t(o.right))>=0;const d=K(t(o.left)),n=K(t(o.right));if(c==="+")return d+n;if(c==="-")return d-n;if(c==="*")return d*n;if(c==="^")return d**n;if(c==="/"){if(n===0)throw new E("division by zero");return d/n}throw new E(`unknown operator ${JSON.stringify(c)}`)}case"call":{const c=l.lazy&&l.lazy[o.name];if(typeof c=="function")return c(o.args,t,l);const d=s[o.name];if(typeof d!="function")throw new E(`there is no function called ${o.name}`);return d(o.args.map(t),l)}default:throw new E("the formula could not be read")}};return t(y)}}),ze("packages/core/src/formula/index.js",function(e,_){"use strict";Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return j}});const ne=_("packages/core/src/formula/parse.js"),E=ne.parseFormula,K=ne.referencesOf,U=ne.looksLikeFormula,D=ne.FormulaError,J=ne.tokenise,z=_("packages/core/src/formula/evaluate.js"),L=z.evaluateAst,X=z.FUNCTIONS;function I(k){const{grid:y,row:l,data:g}=k||{},s=n=>String(n).toLowerCase().replace(/[\s_-]/g,""),t=y&&y.columns&&typeof y.columns.all=="function"?y.columns.all():[],o=y&&y.permissions,c=o&&typeof o.isReadable=="function"?n=>o.isReadable(n):()=>!0,d=new Set;for(const n of t)c(n)||(d.add(s(n.id)),n.field&&d.add(s(n.field)),n.title&&d.add(s(n.title)));return n=>{const p=s(n);if(d.has(p))throw new D(`"${n}" cannot be read`);for(const i of t)if(s(i.id)===p||i.field&&s(i.field)===p||i.title&&s(i.title)===p)return l&&y.rows&&typeof y.rows.value=="function"?y.rows.value(l.key,i.id):g?g[i.field||i.id]:void 0;if(g&&typeof g=="object"){for(const i of Object.keys(g))if(s(i)===p){if(!c(i))throw new D(`"${n}" cannot be read`);return g[i]}}}}function j(k,y={}){try{const l=E(k);return{ok:!0,value:L(l,{lookup:I(y),functions:y.formulaFunctions}),references:K(l)}}catch(l){return{ok:!1,error:l instanceof D?l.message:"the formula could not be read",at:l instanceof D?l.at:void 0}}}}),ze("packages/core/src/internal/version.js",function(e,_){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return K}});const ne="1.110.3";async function E(){return ne}const K="1.110.3"}),ze("packages/core/src/internal/merge.js",function(e,_){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"mergeRow",{enumerable:!0,get:function(){return z}});const E=_("packages/core/src/internal/predicates.js").isObject;function K(L,X,I){if(L!==void 0)return L===!0?{enabled:!0,...I}:L===!1?{enabled:!1}:E(L)?L:{[X]:L,enabled:!0}}function U(L){return L==null?[]:Array.isArray(L)?L:[L]}const D=Object.freeze(new Set(["__proto__","constructor","prototype"]));function J(L,X){if(!E(L))return E(X)?{...X}:X;if(!E(X))return X===void 0?L:X;const I={...L};for(const j of Object.keys(X)){if(D.has(j))continue;const k=X[j];k!==void 0&&(I[j]=E(k)&&E(I[j])?J(I[j],k):k)}return I}function z(L,X){if(!E(L)||!E(X)||L===X)return X;const I=Object.create(Object.getPrototypeOf(L));return Object.assign(I,L,X),I}}),ze("packages/core/src/internal/schedule.js",function(e,_){"use strict";Object.defineProperty(e,"now",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"nextFrame",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return z}});function ne(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const E=typeof requestAnimationFrame=="function";function K(L){return E?requestAnimationFrame(L):setTimeout(()=>L(ne()),16)}function U(L){L!=null&&(E?cancelAnimationFrame(L):clearTimeout(L))}function D(L){let X=null,I=null;const j=()=>{X=null;const y=I;I=null,L(...y||[])},k=(...y)=>{I=y,X===null&&(X=K(j))};return k.cancel=()=>{U(X),X=null,I=null},k.flush=()=>{X!==null&&(U(X),j())},k}function J(L,X){let I=null,j=null;const k=()=>{if(I=null,j===null)return;const g=j;j=null,L(...g),y()},y=()=>{I=setTimeout(k,X),typeof I?.unref=="function"&&I.unref()},l=(...g)=>{I===null?(L(...g),y()):(j=g,clearTimeout(I),y())};return l.flush=()=>{if(I!==null&&clearTimeout(I),I=null,j===null)return;const g=j;j=null,L(...g)},l.cancel=()=>{I!==null&&clearTimeout(I),I=null,j=null},l.pending=()=>I!==null||j!==null,l}function z(L,X=50){return typeof requestIdleCallback=="function"?requestIdleCallback(L,{timeout:X}):setTimeout(()=>L({timeRemaining:()=>0,didTimeout:!0}),1)}}),ze("packages/core/src/internal/paths.js",function(e,_){"use strict";Object.defineProperty(e,"pathGetter",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"pathSetter",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"getPath",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return J}});const ne=new Map;function E(z){let L=ne.get(z);if(L)return L;if(!z.includes("."))L=X=>X?.[z];else{const X=z.split("."),I=X.length;L=j=>{let k=j;for(let y=0;y<I;y++){if(k==null)return;k=k[X[y]]}return k}}return ne.set(z,L),L}const K=new Map;function U(z){let L=K.get(z);if(L)return L;if(!z.includes("."))L=(X,I)=>{X!=null&&(X[z]=I)};else{const X=z.split("."),I=X.length-1;L=(j,k)=>{let y=j;for(let l=0;l<I;l++){if(y==null)return;const g=X[l];y[g]==null&&(y[g]={}),y=y[g]}y!=null&&(y[X[I]]=k)}}return K.set(z,L),L}function D(z,L){return E(L)(z)}function J(z,L,X){U(L)(z,X)}}),ze("packages/core/src/internal/compare.js",function(e,_){"use strict";Object.defineProperty(e,"collator",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"defaultCompare",{enumerable:!0,get:function(){return K}});const ne=new Map;function E(U,D){const J=`${U||""}|${D?JSON.stringify(D):""}`;let z=ne.get(J);return z||(z=new Intl.Collator(U||void 0,{numeric:!0,sensitivity:"variant",...D}),ne.set(J,z)),z}function K(U,D){if(U===D)return 0;if(U==null)return 1;if(D==null)return-1;if(typeof U=="number"&&typeof D=="number")return Number.isNaN(U)?Number.isNaN(D)?0:1:Number.isNaN(D)||U<D?-1:U>D?1:0;const J=String(U),z=String(D);return J<z?-1:J>z?1:0}}),ze("packages/core/src/defaults.js",function(e,_){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return j}});const E=_("packages/core/src/internal/predicates.js").isObject,U=_("packages/core/src/internal/merge.js").merge,J=_("packages/core/src/internal/warn.js").warnOnce;let z=null;class L extends Error{}function X(k,y=new Set){if(Array.isArray(k)){if(y.has(k))throw new L;y.add(k);const g=k.map(s=>X(s,y));return y.delete(k),g}if(!E(k)||Object.getPrototypeOf(k)!==Object.prototype&&Object.getPrototypeOf(k)!==null)return k;if(y.has(k))throw new L;y.add(k);const l={};for(const[g,s]of Object.entries(k))l[g]=X(s,y);return y.delete(k),l}function I(k){if(k===void 0)return X(z??{});if(k===null)return z=null,{};if(!E(k))return J("defaults:type",`defaults() expects a configuration object, or null to clear it, but got ${Array.isArray(k)?"an array":typeof k}. The call was ignored and the defaults are unchanged.`),X(z??{});try{z=X(k)}catch(y){if(!(y instanceof L))throw y;return J("defaults:cyclic","defaults() expects a configuration object with no circular references, but the object passed refers back to itself. The call was ignored and the defaults are unchanged."),X(z??{})}return X(z)}function j(k){return z===null?k:U(X(z),k)}}),ze("packages/core/src/internal/uid.js",function(e,_){"use strict";Object.defineProperty(e,"uid",{enumerable:!0,get:function(){return E}});let ne=0;function E(K="l"){return`${K}${(++ne).toString(36)}`}}),ze("packages/core/src/events/names.js",function(e,_){"use strict";Object.defineProperty(e,"EVENT_NAMES",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"isKnownEvent",{enumerable:!0,get:function(){return K}});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","beforeRowDrop","rowDrop:cancelled","rowDrop","cell:changed","cell:pending","cell:confirmed","cell:reverted","cell:conflict","cell:clicked","cell:dblclicked","cell:contextmenu","cell:mouseover","cell:mouseout","cell:mousedown","cell:mouseup","cell:edit:start","cell:edit:end","row:edit:start","row:edit:end","row:clicked","row:dblclicked","row:pending","row:confirmed","row:reverted","row:conflict","form:opened","form:closed","form:saved","form:error","sort:changed","filter:changed","group:toggled","facet:computed","facet:filtered","facet:expanded","facet:failed","column:moved","column:resized","column:visible","column:pinned","column:grouped","column:pivoted","column:filter:open","column:profile:open","column:compareGroups:open","column:menu:open","explain:open","columns:changed","columns:tagged","columngroup:changed","header:contextmenu","totals:contextmenu","pivot:drill","selection:changed","range:changed","clipboard:copy","page:changed","scroll","scroll:end","size:changed","detail:toggled","detail:cell:edit:start","detail:cell:edit:end","detail:row:edit:start","detail:row:edit:end","detail:cell:changed","toolpanel:focus","highlight:changed","find:changed","tree:loading","tree:loaded","tree:loadFailed","tree:loadAborted","state:changed","state:reset","history:changed","history:applied","views:changed","view:applied","view:saved","view:removed","view:renamed","view:default","validation:failed","validation:cleared","formatting:changed","redaction:changed","permissions:changed","presentation:changed","presentation:started","presentation:ended","presentation:view","presentation:scale","presentation:spotlight","presentation:captured","comment:added","comment:edited","comment:deleted","comment:failed","comment:resolved","comment:unresolved","comment:threadOpened","comment:threadClosed","comment:indexLoaded","presence:published","presence:joined","presence:updated","presence:left","presence:failed","presence:lockRefused","diff:changed","diff:swapped","timeline:attached","timeline:detached","timeline:seek","timeline:seeking","annotation:changed","export:progress","export:request","export:done","shortcuts:opened","shortcuts:closed","print:before","print:after","beforeEdit","beforeSort","beforeFilter","beforeColumnMove","beforeColumnResize","beforeColumnHide","beforeSelect","beforeRowAdd","beforeDelete","beforeRowMove","beforeGroup","beforeRowReceive","edit:cancelled","sort:cancelled","filter:cancelled","columnMove:cancelled","columnResize:cancelled","columnHide:cancelled","selection:cancelled","rowAdd:cancelled","delete:cancelled","rowMove:cancelled","group:cancelled","rowReceive:cancelled"]),E=new Set(ne);function K(U){return U==="*"||E.has(U)}}),ze("packages/core/src/events/bus.js",function(e,_){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return g}});const ne=_("packages/core/src/internal/warn.js"),E=ne.warnOnce,K=ne.DEV,D=_("packages/core/src/internal/uid.js").uid,z=_("packages/core/src/events/names.js").isKnownEvent,L="*";function X(s,t){!K||z(t)||E(`bus.unknown:${t}`,`${s}('${t}') subscribes to an event the grid never raises, so the handler will never fire. Check the name against the EventName list — a common cause is a near miss such as 'row:click' for 'row:clicked'.`)}const I=new Set(["api","user","init","ai"]),j=new WeakMap;function k(s){let t=j.get(s);return t||(t=D("h"),j.set(s,t)),t}function y(){return typeof performance=="object"&&performance?performance.now():Date.now()}function l(s){if(!s||typeof s!="object")return{};const t={};for(const[o,c]of Object.entries(s))o!=="grid"&&(c==null?t[o]=String(c):Array.isArray(c)?t[o]=`[${c.length}]`:typeof c=="object"?t[o]=c.key?`row ${c.key}`:"{…}":typeof c=="function"?t[o]="[function]":t[o]=String(c).slice(0,60));return t}class g{#e=new Map;#t=!1;#n=[];#r=200;#s=new Map;#i=null;#o=!1;#l=0;constructor(t=null){this.#i=t}attach(t){this.#i=t}get grid(){return this.#i}get destroyed(){return this.#o}on(t,o){if(typeof o!="function")return E(`bus.handler:${t}`,`on('${t}') needs a function; ignored.`),()=>{};X("on",t);let c=this.#e.get(t);return c||(c=[],this.#e.set(t,c)),c.push(o),()=>this.off(t,o)}once(t,o){if(typeof o!="function")return E(`bus.handler:${t}`,`once('${t}') needs a function; ignored.`),()=>{};X("once",t);const c=d=>{this.off(t,o),o(d)};return this.#s.set(o,c),this.on(t,c)}off(t,o){if(o===void 0){this.#e.delete(t);return}const c=this.#e.get(t);if(!c)return;const d=this.#s.get(o),n=d&&c.includes(d)?d:o,p=c.indexOf(n);p>=0&&c.splice(p,1),d&&n===d&&this.#s.delete(o),c.length===0&&this.#e.delete(t)}count(t){const o=this.#e.get(t),c=t===L?null:this.#e.get(L);return(o?o.length:0)+(c?c.length:0)}#a(t,o,c,d,n){this.#n.push({type:t,origin:o,listeners:(d?d.length:0)+(n?n.length:0),payload:l(c),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(t,o){this.#t=!!t,Number.isFinite(o)&&o>0&&(this.#r=Math.floor(o)),t||(this.#n=[])}eventLog(){return this.#n.map(t=>({...t}))}clearEventLog(){this.#n=[]}counts(){const t={};for(const[o,c]of this.#e)t[o]=c.length;return t}emit(t,o,c){const d=c??(o&&o.origin),n=I.has(d)?d:"api",p={...o||null,type:t,origin:n,grid:this.#i};if(this.#o)return p;const i=this.#e.get(t),r=t===L?void 0:this.#e.get(L);if(this.#t&&this.#a(t,n,o,i,r),!i&&!r)return p;const f=this.#t?y():0;this.#l++;try{i&&this.#c(i.slice(),p,t),r&&this.#c(r.slice(),p,L)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=y()-f)}return p}emitBefore(t,o,c){const d=c??(o&&o.origin),n=I.has(d)?d:"user";let p=!1,i=null;const r=h=>{p=!0,h!=null&&i===null&&(i=String(h))},f={...o||null,type:t,origin:n,grid:this.#i,get defaultPrevented(){return p},get reason(){return i},preventDefault(h){r(h)}};if(this.#o)return!0;const m=this.#e.get(t);this.#t&&this.#a(t,n,o,m,void 0);const u=m?m.slice():[];if(u.length===0)return!0;const b=()=>(p&&i===null&&(i="prevented"),p&&o&&typeof o=="object"&&(o.reason=i),!p),a=[];for(const h of u)try{const w=h(f);w&&typeof w.then=="function"?a.push(w):w===!1&&r("prevented")}catch(w){r("error"),E(`bus.beforeThrow:${t}:${k(h)}`,`a '${t}' before-handler threw; the action was cancelled.`,w)}return a.length===0?b():Promise.allSettled(a).then(h=>{for(const w of h)w.status==="rejected"?(r("error"),E(`bus.beforeReject:${t}`,`a '${t}' before-handler rejected; the action was cancelled.`,w.reason)):w.value===!1&&r("prevented");return b()})}#c(t,o,c){for(let d=0;d<t.length;d++)try{t[d](o)}catch(n){E(`bus.throw:${c}:${k(t[d])}`,`a '${c}' handler threw; other handlers were unaffected.`,n)}}clear(){this.#e.clear(),this.#s.clear()}destroy(){this.clear(),this.#o=!0,this.#i=null}}}),ze("packages/core/src/registry/free-tier-notice.js",function(e,_){"use strict";Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"WATERMARK_TEXT",{enumerable:!0,get:function(){return E}});const ne="Free for non-commercial use: latticegrid.dev/free",E="Unlicensed: Lattice Grid trial"}),ze("packages/core/src/registry/licence.js",function(e,_){"use strict";Object.defineProperty(e,"PRODUCT",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"LICENCE_VERSION",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"fromBase64Url",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"toBase64Url",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"asciiBytes",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"parseLicence",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"hasEd25519",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"verifyLicence",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isLocalHost",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"currentHost",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"matchesDomain",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LicenceHolder",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"setLicence",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return S}});const E=_("packages/core/src/internal/warn.js").warnOnce,K=_("packages/core/src/registry/free-tier-notice.js"),U=K.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return K.FREE_TIER_NOTICE}});const D="lattice-grid",J=1,z="LG1",L=64,X="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",j=(()=>{const T=new Int16Array(128).fill(-1);for(let O=0;O<I.length;O++)T[I.charCodeAt(O)]=O;return T[43]=62,T[47]=63,T})();function k(T){if(typeof T!="string")return null;let O="";for(let V=0;V<T.length;V++){const Y=T.charCodeAt(V);if(Y!==61){if(Y>127||j[Y]<0)return null;O+=T[V]}}const N=O.length;if(N%4===1)return null;const P=new Uint8Array(Math.floor(N*3/4));let C=0,B=0,x=0;for(let V=0;V<N;V++)C=C<<6|j[O.charCodeAt(V)],B+=6,B>=8&&(B-=8,P[x++]=C>>B&255);return x===P.length?P:P.subarray(0,x)}function y(T){let O="",N=0;for(;N+2<T.length;N+=3){const C=T[N]<<16|T[N+1]<<8|T[N+2];O+=I[C>>18&63]+I[C>>12&63]+I[C>>6&63]+I[C&63]}const P=T.length-N;if(P===1){const C=T[N]<<16;O+=I[C>>18&63]+I[C>>12&63]}else if(P===2){const C=T[N]<<16|T[N+1]<<8;O+=I[C>>18&63]+I[C>>12&63]+I[C>>6&63]}return O}function l(T){const O=new Uint8Array(T.length);for(let N=0;N<T.length;N++)O[N]=T.charCodeAt(N)&127;return O}function g(T){if(typeof TextDecoder=="function")return new TextDecoder().decode(T);let O="";for(let N=0;N<T.length;N++)O+=String.fromCharCode(T[N]);return O}function s(T){const O={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof T=="string"?T:""};if(typeof T!="string"||T.length===0)return{...O,reason:"missing"};const N=T.trim(),P=N.split(".");if(P.length!==3)return O;const[C,B,x]=P;if(C!==z)return{...O,reason:"prefix"};const V=k(B),Y=k(x);if(!V||!Y)return O;let F;try{F=JSON.parse(g(V))}catch{return O}return F===null||typeof F!="object"?O:{ok:!0,reason:null,product:typeof F.p=="string"?F.p:null,issuedTo:typeof F.t=="string"?F.t:null,expires:typeof F.e=="string"?F.e:null,terms:typeof F.terms=="string"?F.terms:null,features:Array.isArray(F.f)?F.f.slice():[],deployments:Array.isArray(F.d)?F.d.slice():[],version:typeof F.v=="number"?F.v:0,message:l(B),signature:Y,raw:N}}function t(T,O){if(!T)return!1;const N=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(T)?`${T}T23:59:59.999Z`:T);return Number.isNaN(N)?!0:O>N}function o(T){return T==="non-commercial"?"non-commercial":"commercial"}let c=null,d=null,n=null;function p(){const T=globalThis.crypto;return T&&T.subtle?T.subtle:null}async function i(T){if(c&&d===T)return c;const O=p();if(!O)return null;const N=k(T);if(!N)return null;try{const P=await O.importKey("raw",N,{name:"Ed25519"},!1,["verify"]);return c=P,d=T,P}catch{return null}}async function r(){return n!==null||(n=await i(X)!==null),n}async function f(T,O={}){const N=O.warn!==!1,P=O.product||D,C=O.publicKey||X,B=O.now??Date.now(),x=O.host??u(),V=m(x)?"":` ${U}`,Y=s(T);if(!Y.ok){const te=Y.reason==="missing"?"missing":"malformed";return N&&E(`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.${V}`:`licence key could not be read. The grid will render with a watermark.${V}`),{valid:!1,reason:te,terms:"commercial"}}const F={product:Y.product||void 0,issuedTo:Y.issuedTo||void 0,expires:Y.expires||void 0,terms:o(Y.terms)};if(Y.product!==P)return N&&E("licence.product",`licence key is for '${Y.product}', not '${P}'. The grid will render with a watermark.`),{valid:!1,...F,reason:"product"};if(t(Y.expires,B))return N&&E("licence.expired",`licence expired on ${Y.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,...F,reason:"expired"};const $=Y.deployments||[];if($.length&&x&&!m(x)&&!b(x,$))return N&&E("licence.domain",`licence key is not valid for ${x}; it covers ${$.join(", ")}. The grid will render with a watermark.`),{valid:!1,...F,reason:"domain"};const q=await i(C);if(!q){const te=!!Y.signature&&Y.signature.length===L;return N&&E("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,...F,reason:"unverified"}:{valid:!1,...F,reason:"signature"}}let ee=!1;try{ee=await p().verify({name:"Ed25519"},q,Y.signature,Y.message)}catch{ee=!1}return ee?{valid:!0,...F}:(N&&E("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...F,reason:"signature"})}function m(T){const O=String(T??u()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!O||O==="localhost"||O.endsWith(".localhost")||O==="::1"||O==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(O)}function u(){const T=globalThis.location;return T&&typeof T.hostname=="string"?T.hostname:null}function b(T,O){const N=a(T);return!N||!Array.isArray(O)?!1:O.some(P=>{const C=a(P);if(!C)return!1;if(C==="*")return!0;if(C.startsWith("*.")){const B=C.slice(2);return N===B||N.endsWith(`.${B}`)}return N===C})}function a(T){return String(T??"").trim().toLowerCase().replace(/\.$/,"")}class h{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#s;#i=new Set;constructor(O={}){this.#s=O}set(O){this.#e=typeof O=="string"?O.trim():"";const N=s(this.#e);return this.#t=N.ok?{valid:!t(N.expires,Date.now())&&N.product===(this.#s.product||D),product:N.product||void 0,issuedTo:N.issuedTo||void 0,expires:N.expires||void 0,terms:o(N.terms),reason:"pending"}:{valid:!1,reason:N.reason||"malformed",terms:"commercial"},this.#n=null,this.#e&&this.verify(),this.#t}verify(){if(this.#n)return this.#n;const O=this.#e;return this.#n=f(O,this.#s).then(N=>{if(this.#e===O){this.#t=N;for(const P of this.#i)P(N)}return N}),this.#n}onSettled(O){return this.#i.add(O),()=>this.#i.delete(O)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!m(this.#r)}setHost(O){this.#r=O}state(){return this.#t.valid?"licensed":m(this.#r)?"localhost":"trial"}reset(){this.#e="",this.#t={valid:!1,reason:"missing",terms:"commercial"},this.#n=null,this.#i.clear()}}const w=Symbol.for("lattice-grid/licence/holder");function v(){const T=globalThis,O=T&&T[w];if(O&&typeof O.set=="function"&&typeof O.watermark=="function")return O;const N=new h;if(T)try{T[w]=N}catch{}return N}const A=v();function H(T){return A.set(T)}function G(){return A.info()}function Z(){return A.watermark()}function M(){return A.state()}function S(){return A}}),ze("packages/core/src/registry/registry.js",function(e,_){"use strict";Object.defineProperty(e,"KINDS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"REGIONS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return c}});const ne=_("packages/core/src/internal/warn.js"),E=ne.warnOnce,K=ne.DEV,D=_("packages/core/src/internal/predicates.js").isFunction,J=_("packages/core/src/registry/licence.js"),z=J.LicenceHolder,L=J.sharedLicence,X=["renderer","editor","filter","dataType","totalFn","pipe","component"],I=["all","header","body","totals","panels"];class j{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#s;#i=null;#o=null;#l=new Set;#a=new Map;constructor(n={}){for(const p of X)this.#t.set(p,new Map);this.#s=n.holder||L(),this.#o=n.grid??null,this.#i=this.#s.onSettled(()=>{this.#d({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),n.licence&&this.setLicence(n.licence)}registerModules(n,p={}){p.licence&&this.setLicence(p.licence),p.grid!==void 0&&(this.#o=p.grid);const i=Array.isArray(n)?n:[n],r=[];for(const f of i){if(!f||typeof f!="object"||typeof f.name!="string"||!f.name){E("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(f.name)){K&&this.#u(this.#e.get(f.name),f);continue}if(!D(f.install)){E(`registry.module.install:${f.name}`,`module '${f.name}' has no install() and was ignored.`);continue}const m={registry:this,grid:this.#o};try{f.install(m)}catch(u){E(`registry.module.throw:${f.name}`,`module '${f.name}' threw during install; it was not registered.`,u);continue}this.#e.set(f.name,f);for(const u of k(f))this.#n.add(u);r.push(f.name),this.#d({reason:"module",name:f.name,capabilities:this.capabilities(),regions:g(f)})}return r}unregisterModule(n){const p=this.#e.get(n);if(!p)return!1;if(D(p.uninstall))try{p.uninstall({registry:this,grid:this.#o})}catch(i){E(`registry.module.uninstall:${n}`,`module '${n}' threw during uninstall.`,i)}return this.#e.delete(n),this.#c(),this.#d({reason:"unmodule",name:n,capabilities:this.capabilities(),regions:g(p)}),!0}modules(){return[...this.#e.values()]}has(n){return this.#e.has(n)}#c(){this.#n.clear();for(const n of this.#e.values())for(const p of k(n))this.#n.add(p)}#u(n,p){!n||n===p||y(n,p)||E(`registry.module.reconfigure:${p.name}`,`module '${p.name}' was re-registered with different options; the first registration is kept and this call was ignored. Unregister it first if you mean to replace it.`)}capabilities(){return[...this.#n].sort()}can(n){return this.#n.has(n)}onChange(n){return D(n)?(this.#r.add(n),this.#a.set(n,this.#o),()=>{this.#r.delete(n),this.#a.delete(n)}):()=>{}}#d(n){for(const p of[...this.#r])try{p(n)}catch(i){E("registry.onChange.throw","a registry change handler threw.",i)}}register(n,p,i){const r=this.#t.get(n);if(!r){E(`registry.kind:${n}`,`unknown registry kind '${n}'; expected one of ${X.join(", ")}.`);return}if(!p||typeof p!="string"){E(`registry.name:${n}`,`register('${n}', ...) needs a name.`);return}r.has(p)&&r.get(p)!==i&&E(`registry.replace:${n}:${p}`,`'${p}' was already registered as a ${n} and has been replaced.`),r.set(p,i),this.#d({reason:"register",name:p,kind:n,capabilities:this.capabilities(),regions:s(n)})}registerAll(n,p){if(p)for(const i of Object.keys(p))this.register(n,i,p[i])}get(n,p){const i=this.#t.get(n);return i?i.get(p):void 0}names(n){const p=this.#t.get(n);return p?[...p.keys()]:[]}#f(n,p){const i=this.#t.get(n).get(p);return i!==void 0?i:this.#t.get("component").get(p)}renderer(n){return this.#f("renderer",n)}editor(n){return this.#f("editor",n)}filter(n){return this.#f("filter",n)}dataType(n){return this.get("dataType",n)}totalFn(n){return this.get("totalFn",n)}pipe(n){return this.get("pipe",n)}setLicence(n){return this.#s.set(n)}licence(){return this.#s.info()}licenceVerified(){return this.#s.verify()}watermark(){return this.#s.watermark()}attach(n){n!=null&&(this.#l.add(n),this.#o=n)}detach(n){if(n!=null){this.#l.delete(n);for(const[p,i]of[...this.#a])i===n&&(this.#r.delete(p),this.#a.delete(p));if(this.#o===n){const p=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#o=p}this.#l.size===0&&this.#i&&(this.#i(),this.#i=null)}}destroy(n){if(n!=null){this.detach(n);return}for(const p of[...this.#e.keys()])this.unregisterModule(p);this.#r.clear(),this.#a.clear(),this.#l.clear(),this.#i&&this.#i(),this.#i=null,this.#o=null}}function k(d){const n=d.capabilities,p=Array.isArray(n)?n.filter(i=>typeof i=="string"):[];return[d.name,...p]}function y(d,n){return d.install!==n.install||d.uninstall!==n.uninstall||(d.version||"")!==(n.version||"")?!1:l(k(d),k(n))&&l(g(d),g(n))}function l(d,n){const p=new Set(d),i=new Set(n);if(p.size!==i.size)return!1;for(const r of p)if(!i.has(r))return!1;return!0}function g(d){const n=d.regions;return!Array.isArray(n)||n.length===0?["all"]:n.filter(p=>I.includes(p))}function s(d){switch(d){case"filter":return["header"];case"totalFn":return["totals"];case"renderer":case"editor":case"pipe":return["body"];default:return["all"]}}const t=new j;function o(){return t}function c(d,n={}){return t.registerModules(d,n)}}),ze("packages/core/src/internal/text.js",function(e,_){"use strict";Object.defineProperty(e,"humanise",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"escapeHtml",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return U}});function ne(D){return D?(D.includes(".")?D.slice(D.lastIndexOf(".")+1):D).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(/^./,z=>z.toUpperCase()):""}const E={"&":"&","<":"<",">":">",'"':""","'":"'"};function K(D){const J=D==null?"":String(D);return/[&<>"']/.test(J)?J.replace(/[&<>"']/g,z=>E[z]):J}function U(D){return String(D).replace(/\w\S*/g,J=>J[0].toUpperCase()+J.slice(1).toLowerCase())}}),ze("packages/core/src/format/mask.js",function(e,_){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return J}});const ne=new Set(["0","#","?",",","."]),E="\0";function K(L){const X=[];let I="",j=!1;for(let k=0;k<L.length;k++){const y=L[k];if(y==="\\"){I+=y+(L[k+1]??""),k+=1;continue}if(y==='"'){j=!j,I+=y;continue}if(y===";"&&!j){X.push(I),I="";continue}I+=y}return X.push(I),X}function U(L){let X="",I="",j="",k=1,y=!1,l=!1;const g=r=>{l?I+=r:X+=r};for(let r=0;r<L.length;r++){const f=L[r];if(f==="\\"){g(L[r+1]??""),r+=1;continue}if(f==='"'){const m=L.indexOf('"',r+1);g(m===-1?L.slice(r+1):L.slice(r+1,m)),r=m===-1?L.length:m;continue}if(f==="%"){k*=100,g("%");continue}if(f==="@"){y=!0,g("\0");continue}if(ne.has(f)){j+=f,l=!0;continue}g(f)}let s=-1;for(let r=j.length-1;r>=0;r--){const f=j[r];if(f==="0"||f==="#"||f==="?"){s=r;break}}let t=!1,o="";for(let r=0;r<j.length;r++){const f=j[r];if(f===","){r>s?k/=1e3:t=!0;continue}o+=f}const c=o.indexOf("."),d=c===-1?o:o.slice(0,c),n=c===-1?"":o.slice(c+1);let p=0;for(const r of d)r==="0"&&(p+=1);let i=0;for(const r of n)r==="0"&&(i+=1);return{prefix:X,suffix:I,minInt:p,minDec:i,maxDec:n.length,grouping:t,scale:k,hasNumber:s!==-1,isText:y}}function D(L,X){const I=new Intl.NumberFormat(X,{minimumIntegerDigits:Math.max(L.minInt,1),minimumFractionDigits:L.minDec,maximumFractionDigits:Math.max(L.maxDec,L.minDec),useGrouping:L.grouping}),{prefix:j,suffix:k,scale:y,hasNumber:l}=L;return g=>{if(!l)return j+k;const s=y===1?g:g*y;return j+I.format(s)+k}}function J(L,X){const j=K(String(L)).map(U),k=j.map(o=>D(o,X)),y=0,l=j.length>1?1:-1,g=j.length>2?2:-1,s=j.length>3?3:-1,t=o=>{if(o==null||o==="")return"";if(typeof o!="number"||Number.isNaN(o)){const c=Number(o);if(Number.isNaN(c))return s===-1?String(o):(j[s].prefix+j[s].suffix).split("\0").join(String(o));o=c}return o===0&&g!==-1?k[g](0):o<0&&l!==-1?k[l](-o):k[y](o)};return t.spec={mask:L},{format:t,ooxml:z(String(L))}}function z(L){return L.trim()}}),ze("packages/core/src/format/pattern.js",function(e,_){"use strict";Object.defineProperty(e,"parseNumberPattern",{enumerable:!0,get:function(){return D}});const E=_("packages/core/src/format/mask.js").splitSections;function K(J){let z="",L="",X="",I="",j=!1,k=!1,y=!1,l=!1;const g=t=>{y?L+=t:z+=t};for(let t=0;t<J.length;t++){const o=J[t];if(o==="\\"){g(J[t+1]??""),t+=1;continue}if(o==='"'){const c=J.indexOf('"',t+1);g(c===-1?J.slice(t+1):J.slice(t+1,c)),t=c===-1?J.length:c;continue}if(o==="%"){k=!0;continue}if(o==="0"||o==="#"){y=!0,l?I+=o:X+=o;continue}if(o===","){l||(j=!0);continue}if(o==="."&&!l){l=!0;continue}g(o)}if(!y)return{hasDigit:!1,prefix:z,suffix:L,minDec:0,maxDec:0,grouping:!1,percent:k};let s=0;for(const t of I)t==="0"&&(s+=1);return{hasDigit:!0,prefix:z,suffix:L,minDec:s,maxDec:I.length,grouping:j,percent:k}}function U(J,z){const L=z.trim(),X=J.trim();return L.startsWith("(")&&L.endsWith(")")&&L.slice(1,-1).trim()===X?"parentheses":L.endsWith("-")?"suffix":"minus"}function D(J){if(typeof J!="string")return null;const z=E(J);if(z.length===0)return null;const L=K(z[0]);if(!L.hasDigit)return null;const X={style:L.percent?"percent":"decimal",prefix:L.prefix,suffix:L.suffix,minDecimals:L.minDec,maxDecimals:Math.max(L.maxDec,L.minDec),thousandsSeparator:L.grouping?void 0:!1};if(z.length>1&&(X.negative=U(z[0],z[1])),z.length>2){const I=K(z[2]);I.hasDigit||(X.zeroDisplay=I.prefix+I.suffix)}return X}}),ze("packages/core/src/format/number.js",function(e,_){"use strict";Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return z}});const E=_("packages/core/src/internal/predicates.js").isNil,U=_("packages/core/src/internal/warn.js").warnOnce,J=_("packages/core/src/format/pattern.js").parseNumberPattern;function z(L,X){const I=typeof L=="string"?{pattern:L}:L||{};let j=I;if(typeof I.pattern=="string"){const v=J(I.pattern);if(v){const{pattern:A,...H}=I;j={...v,...H}}else U(`format:pattern:${I.pattern}`,`invalid number format pattern "${I.pattern}"; the value will use the default number format`)}const k=j.locale||X||void 0,y=j.style||"decimal",l=typeof j.scale=="number"?j.scale:1,g=j.nullDisplay??"",s=j.zeroDisplay,t=j.prefix||"",o=j.suffix||"",c=j.negative||"minus",d=j.signed===!0,n={style:y,notation:j.notation||"standard"};y==="currency"&&(n.currency=j.currency||"USD",j.currencyDisplay&&(n.currencyDisplay=j.currencyDisplay)),typeof j.decimals=="number"?(n.minimumFractionDigits=j.decimals,n.maximumFractionDigits=j.decimals):(typeof j.minDecimals=="number"&&(n.minimumFractionDigits=j.minDecimals),typeof j.maxDecimals=="number"&&(n.maximumFractionDigits=j.maxDecimals),n.minimumFractionDigits>(n.maximumFractionDigits??20)&&(n.maximumFractionDigits=n.minimumFractionDigits)),j.thousandsSeparator===!1&&(n.useGrouping=!1),n.notation==="compact"&&(n.compactDisplay=j.compactDisplay||"short");const p=new Intl.NumberFormat(k,n),i=typeof j.thousandsSeparator=="string"?j.thousandsSeparator:null,r=typeof j.decimalSeparator=="string"?j.decimalSeparator:null;let f=",",m=".";if(i||r)for(const v of p.formatToParts(12345.6))v.type==="group"?f=v.value:v.type==="decimal"&&(m=v.value);const u=v=>{let A=v;return i&&(A=A.split(f).join("")),r&&(A=A.split(m).join("")),i&&(A=A.split("").join(i)),r&&(A=A.split("").join(r)),A},b=!!(i||r),a=t!==""&&y==="currency",h=v=>{let A;if(a){const H=p.formatToParts(v);let G=!1;A="";for(const Z of H)A+=Z.value,!G&&Z.type==="currency"&&(A+=t,G=!0);G||(A=t+A)}else A=t+p.format(v);return b&&(A=u(A)),A+o},w=v=>{if(E(v)||v==="")return g;const A=typeof v=="number"?v:Number(v);if(Number.isNaN(A))return g;const H=l===1?A:A*l;return H===0&&s!==void 0?s:H<0?c==="parentheses"?`(${h(-H)})`:c==="suffix"?`${h(-H)}-`:h(H):d&&H>0?`+${h(H)}`:h(H)};return w.negativeClass=j.negativeClass||null,w.spec=j,w}}),ze("packages/core/src/format/date.js",function(e,_){"use strict";Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return o}});const E=_("packages/core/src/internal/predicates.js").isNil,U=_("packages/core/src/internal/warn.js").warnOnce,D=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function J(c){const d=[];let n=0,p="";const i=()=>{p&&(d.push({token:null,text:p}),p="")};for(;n<c.length;){const r=c[n];if(r==="'"){if(c[n+1]==="'"){p+="'",n+=2;continue}const m=c.indexOf("'",n+1);if(m===-1){p+=c.slice(n+1),n=c.length;continue}p+=c.slice(n+1,m),n=m+1;continue}const f=D.find(m=>c.startsWith(m,n));if(f){i(),d.push({token:f,text:f}),n+=f.length;continue}/[A-Za-z]/.test(r)&&U(`date.pattern.token:${r}`,`the date pattern "${c}" contains '${r}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${D.join(" ")}.`),p+=r,n+=1}return i(),d}const z=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function L(c){if(E(c)||c==="")return null;if(c instanceof Date)return Number.isNaN(c.getTime())?null:c;if(typeof c=="number")return Number.isNaN(c)?null:new Date(c);if(typeof c=="string"){const d=z.exec(c.trim());if(d){const[,p,i,r,f="0",m="0",u="0"]=d;return new Date(+p,+i-1,+r,+f,+m,+u)}const n=new Date(c);return Number.isNaN(n.getTime())?null:n}return null}function X(c,d){return String(c).padStart(d,"0")}function I(c){if(!c)return p=>({year:p.getFullYear(),month:p.getMonth()+1,day:p.getDate(),hour:p.getHours(),minute:p.getMinutes(),second:p.getSeconds(),ms:p.getMilliseconds(),weekday:p.getDay()});const d=new Intl.DateTimeFormat("en-US",{timeZone:c,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,weekday:"short"}),n={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};return p=>{const i={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:p.getMilliseconds(),weekday:0};for(const r of d.formatToParts(p))switch(r.type){case"year":i.year=Number(r.value);break;case"month":i.month=Number(r.value);break;case"day":i.day=Number(r.value);break;case"hour":i.hour=Number(r.value)%24;break;case"minute":i.minute=Number(r.value);break;case"second":i.second=Number(r.value);break;case"weekday":i.weekday=n[r.value]??0;break;default:break}return i}}function j(c,d,n){const p=J(c),i=I(n),r=new Set(p.filter(a=>a.token).map(a=>a.token)),f=r.has("MMM")?new Intl.DateTimeFormat(d,{month:"short",timeZone:n}):null,m=r.has("MMMM")?new Intl.DateTimeFormat(d,{month:"long",timeZone:n}):null,u=r.has("EEE")?new Intl.DateTimeFormat(d,{weekday:"short",timeZone:n}):null,b=r.has("EEEE")?new Intl.DateTimeFormat(d,{weekday:"long",timeZone:n}):null;return a=>{const h=i(a);let w="";for(const v of p){if(!v.token){w+=v.text;continue}switch(v.token){case"yyyy":w+=X(h.year,4);break;case"yy":w+=X(h.year%100,2);break;case"MMMM":w+=m.format(a);break;case"MMM":w+=f.format(a);break;case"MM":w+=X(h.month,2);break;case"M":w+=String(h.month);break;case"dd":w+=X(h.day,2);break;case"d":w+=String(h.day);break;case"EEEE":w+=b.format(a);break;case"EEE":w+=u.format(a);break;case"HH":w+=X(h.hour,2);break;case"H":w+=String(h.hour);break;case"hh":w+=X(h.hour%12===0?12:h.hour%12,2);break;case"h":w+=String(h.hour%12===0?12:h.hour%12);break;case"mm":w+=X(h.minute,2);break;case"m":w+=String(h.minute);break;case"ss":w+=X(h.second,2);break;case"s":w+=String(h.second);break;case"SSS":w+=X(h.ms,3);break;case"a":w+=h.hour<12?"AM":"PM";break;default:w+=v.text;break}}return w}}const k=[["year",365*24*36e5],["month",720*36e5],["week",168*36e5],["day",24*36e5],["hour",36e5],["minute",6e4],["second",1e3]];function y(c,d){const n=c||{},p=n.locale||d||void 0,i=n.nullDisplay??"",r=n.timeZone;let f;if(n.pattern)f=j(n.pattern,p,r);else if(n.dateStyle||n.timeStyle){const h={timeZone:r};n.dateStyle&&(h.dateStyle=n.dateStyle),n.timeStyle&&(h.timeStyle=n.timeStyle);const w=new Intl.DateTimeFormat(p,h);f=v=>w.format(v)}else{const h=new Intl.DateTimeFormat(p,{dateStyle:"medium",timeZone:r});f=w=>h.format(w)}const m=n.relative?new Intl.RelativeTimeFormat(p,{numeric:"auto"}):null,b=(typeof n.relative=="object"&&n.relative?n.relative.threshold??7:7)*24*36e5,a=(h,w)=>{const v=L(h);if(!v)return i;if(m){const A=w&&typeof w.now=="number"?w.now:Date.now(),H=v.getTime()-A;if(Math.abs(H)<b){for(const[G,Z]of k)if(Math.abs(H)>=Z||G==="second")return m.format(Math.round(H/Z),G)}}return f(v)};return a.spec=n,a}function l(c){if(E(c)||c==="")return null;if(typeof c=="string"){const p=/^(\d{4}-\d{2}-\d{2})/.exec(c.trim());if(p)return p[1];const i=L(c);return i?l(i):null}const d=L(c);if(!d)return null;const n=p=>String(p).padStart(2,"0");return`${d.getFullYear()}-${n(d.getMonth()+1)}-${n(d.getDate())}`}function g(c,d){if(E(c)||c==="")return null;if(typeof c=="string"){const p=c.trim();if(s.test(p)){const f=L(p);return f?t(f,d):null}const i=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(p);if(i){const[,f,m,u,b]=i;return`${f}T${m}:${u}${b&&b!=="00"?`:${b}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(p))return`${p}T00:00`;const r=L(p);return r?g(r):null}const n=L(c);return n?t(n,d):null}const s=/(?:Z|[+-]\d{2}:?\d{2})$/i;function t(c,d){const n=f=>String(f).padStart(2,"0");if(d)try{const f=new Intl.DateTimeFormat("en-CA",{timeZone:d,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(c).reduce((b,a)=>(a.type!=="literal"&&(b[a.type]=a.value),b),{}),m=f.hour==="24"?"00":f.hour,u=Number(f.second);return`${f.year}-${f.month}-${f.day}T${m}:${f.minute}`+(u?`:${f.second}`:"")}catch{}const p=`${c.getFullYear()}-${n(c.getMonth()+1)}-${n(c.getDate())}`,i=c.getSeconds(),r=`${n(c.getHours())}:${n(c.getMinutes())}${i?`:${n(i)}`:""}`;return`${p}T${r}`}function o(c,d){const n=E(c)||c===""?null:String(c),p=E(d)||d===""?null:String(d);return n===null?p===null?0:1:p===null||n<p?-1:n>p?1:0}}),ze("packages/core/src/format/boolean.js",function(e,_){"use strict";Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return J}});const E=_("packages/core/src/internal/predicates.js").isNil,K={true:"☑",false:"☐",null:""},U={true:"◉",false:"◯",null:""};function D(z){if(E(z)||z==="")return null;if(typeof z=="boolean")return z;if(typeof z=="number")return z!==0;const L=String(z).trim().toLowerCase();return L==="true"||L==="yes"||L==="y"||L==="1"?!0:L==="false"||L==="no"||L==="n"||L==="0"?!1:null}function J(z,L){const X=z||{},I=X.display||"text",j=X.trueLabel??"Yes",k=X.falseLabel??"No",y=X.nullLabel??"";let l=j,g=k;const s=y;I==="checkbox"?(l=K.true,g=K.false):I==="switch"?(l=U.true,g=U.false):I==="icon"&&(l=X.trueIcon??j,g=X.falseIcon??k);const t=o=>{const c=D(o);return c===null?s:c?l:g};return t.display=I,t.labels={true:j,false:k,null:y},t.locale=L,t.spec=X,t}}),ze("packages/core/src/format/text.js",function(e,_){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return D}});const E=_("packages/core/src/internal/predicates.js").isNil,U=_("packages/core/src/internal/text.js").titleCase;function D(J,z){const L=J||{},X=L.locale||z||void 0,I=L.nullDisplay??"",j=L.emptyDisplay??"",k=L.transform||"none",y=typeof L.truncate=="number"?{chars:L.truncate}:L.truncate||null,l=y?y.chars:0,g=y?y.ellipsis??"…":"",s=o=>{switch(k){case"upper":return X?o.toLocaleUpperCase(X):o.toUpperCase();case"lower":return X?o.toLocaleLowerCase(X):o.toLowerCase();case"title":return U(o);default:return o}},t=o=>{if(E(o))return I;let c=typeof o=="string"?o:String(o);return c===""?j:(k!=="none"&&(c=s(c)),l>0&&c.length>l&&(c=c.slice(0,l)+g),c)};return t.spec=L,t}}),ze("packages/core/src/format/shorthand.js",function(e,_){"use strict";Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return z}});const ne=["currency","number","percent","date","boolean","text","relative"],E=/[#0?@;"\\]/,K=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function U(L){return typeof L!="string"||L===""||J(L)?!1:E.test(L)}function D(L){return typeof L!="string"||L===""||J(L)?!1:K.test(L)}function J(L){const X=L.indexOf(":"),I=X===-1?L:L.slice(0,X);return ne.includes(I)?I:null}function z(L){const X=J(L);if(!X)return null;const I=L.indexOf(":"),j=I===-1?"":L.slice(I+1),k=j===""?[]:j.split(":");switch(X){case"currency":{const y={type:"number",style:"currency",currency:k[0]||"USD"};return k[1]!==void 0&&k[1]!==""&&(y.decimals=Number(k[1])),y}case"number":{const y={type:"number",style:"decimal"};return k[0]!==void 0&&k[0]!==""&&(y.decimals=Number(k[0])),y}case"percent":{const y={type:"number",style:"percent"};return k[0]!==void 0&&k[0]!==""&&(y.decimals=Number(k[0])),y}case"date":return{type:"date",pattern:j||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const y=j.split("/"),l={type:"boolean",display:"text"};return y[0]!==void 0&&y[0]!==""&&(l.trueLabel=y[0]),y[1]!==void 0&&y[1]!==""&&(l.falseLabel=y[1]),y[2]!==void 0&&(l.nullLabel=y[2]),l}case"text":{const y={type:"text"};return k[0]&&(y.transform=k[0]),k[1]!==void 0&&k[1]!==""&&(y.truncate=Number(k[1])),y}default:return null}}}),ze("packages/core/src/format/index.js",function(e,_){"use strict";Object.defineProperty(e,"compileFormat",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"specToOoxml",{enumerable:!0,get:function(){return A}});const ne=_("packages/core/src/internal/predicates.js"),E=ne.isFunction,K=ne.isObject,D=_("packages/core/src/internal/warn.js").warnOnce,J=_("packages/core/src/format/number.js"),z=J.compileNumber,L=_("packages/core/src/format/date.js"),X=L.compileDate,I=L.scanPattern,j=_("packages/core/src/format/boolean.js"),k=j.compileBoolean,y=_("packages/core/src/format/text.js"),l=y.compileText,g=_("packages/core/src/format/mask.js"),s=g.compileMask,t=_("packages/core/src/format/shorthand.js"),o=t.parseShorthand,c=t.looksLikeMask,d=t.looksLikeDatePattern,p=_("packages/core/src/format/pattern.js").parseNumberPattern;Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return J.compileNumber}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return L.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return L.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return L.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return L.toDate}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return j.compileBoolean}}),Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return j.toTriState}}),Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return y.compileText}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return g.compileMask}}),Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return g.splitSections}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return g.parseSection}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return t.parseShorthand}}),Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return t.looksLikeMask}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return t.looksLikeDatePattern}});const i=new Set(["decimal","currency","percent","unit"]),r=new Set(["type","locale"]),f={number:new Set(["style","currency","currencyDisplay","decimals","minDecimals","maxDecimals","thousandsSeparator","decimalSeparator","notation","compactDisplay","negative","negativeClass","signed","prefix","suffix","zeroDisplay","nullDisplay","messages","scale","pattern"]),date:new Set(["pattern","dateStyle","timeStyle","timeZone","relative","nullDisplay"]),boolean:new Set(["display","trueLabel","falseLabel","nullLabel","trueIcon","falseIcon"]),text:new Set(["transform","truncate","nullDisplay","emptyDisplay"])},m=new Set(["number","date","boolean","text"]);function u(M,S){const T=M.type;if(T===void 0||m.has(T)||!i.has(String(T)))return;const O=S?`"${S}"`:"with no id";D(`format:unknown-style-key:${S||""}:${T}`,`column ${O} has format: { type: "${T}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${T}" instead?`)}function b(M,S,T){const O=f[S],N=T?`"${T}"`:"with no id";for(const P of M){if(r.has(P)||O.has(P))continue;const C=Object.keys(f).find(B=>B!==S&&f[B].has(P));C?D(`format:inapplicable:${T||""}:${P}`,`column ${N} has format key "${P}", which applies to a ${C} column, not the ${S} column it was applied to; it is ignored.`):D(`format:unknown:${T||""}:${P}`,`column ${N} has an unrecognised format key "${P}" for its ${S} format; it is ignored.`)}}function a(M){if(M.type==="number"||M.type==="date"||M.type==="boolean"||M.type==="text")return!0;const S=i.has(String(M.style));return!!(M.pattern||M.dateStyle||M.timeStyle||M.relative||M.timeZone||M.trueLabel||M.falseLabel||M.display||M.trueIcon||M.falseIcon||M.transform||M.truncate||M.emptyDisplay||S||M.currency||M.decimals!==void 0||M.minDecimals!==void 0||M.maxDecimals!==void 0||M.notation||M.negative||M.scale!==void 0||M.prefix||M.suffix||M.zeroDisplay!==void 0)}function h(M,S){if(M.type==="number"||M.type==="date"||M.type==="boolean"||M.type==="text")return M.type;if(M.pattern){if(c(M.pattern))return"number";if(d(M.pattern))return"date"}if(M.dateStyle||M.timeStyle||M.relative||M.timeZone)return"date";if(M.trueLabel||M.falseLabel||M.display||M.trueIcon||M.falseIcon)return"boolean";if(M.transform||M.truncate||M.emptyDisplay)return"text";if(M.style||M.currency||M.decimals!==void 0||M.minDecimals!==void 0||M.maxDecimals!==void 0||M.notation||M.negative||M.scale!==void 0||M.prefix||M.suffix||M.zeroDisplay!==void 0)return"number";const T=S&&S.base;return T==="number"?"number":T==="date"||T==="dateString"?"date":T==="boolean"?"boolean":"text"}function w(M,S=null,T=void 0,O=void 0,N=void 0){if(M==null||M==="")return null;const P=K(M)?Object.keys(M):null;if(typeof M=="function"){const x=(V,Y)=>String(M({...Y||{},value:V,locale:T})??"");return x.ooxml=S&&S.excel||"General",x}if(typeof M=="string"){if(c(M)){const{format:V,ooxml:Y}=s(M,T);return V.ooxml=Y,V}const x=o(M)||(d(M)?{type:"date",pattern:M}:null);return x?w(x,S,T,O,N):(D(`format:${M}`,`unrecognised format string "${M}"; the value will be stringified`),null)}if(!K(M))return D("format:shape","format must be a spec object or a string; ignoring",M),null;if(S&&E(S.format)&&!a(M)||S&&E(S.format)&&Array.isArray(S.formatPatterns)&&M.type===void 0)return null;const C=h(M,S);C==="date"&&O&&M.timeZone===void 0&&(M={...M,timeZone:O}),u(M,N),b(P||Object.keys(M),C,N);let B;switch(C){case"number":B=z(M,T);break;case"date":B=X(M,T);break;case"boolean":B=k(M,T);break;default:B=l(M,T);break}return B.ooxml=A(M,C,T,S),B.kind=C,B}const v={yyyy:"yyyy",yy:"yy",MMMM:"mmmm",MMM:"mmm",MM:"mm",M:"m",dd:"dd",d:"d",EEEE:"dddd",EEE:"ddd",HH:"hh",H:"h",hh:"hh",h:"h",mm:"mm",m:"m",ss:"ss",s:"s",SSS:"000",a:"AM/PM"};function A(M,S,T=void 0,O=null){if(S==="date"){if(M.pattern){let x="";for(const V of I(M.pattern))x+=V.token?v[V.token]??V.text:V.text;return x}return O&&O.excel||"yyyy-mm-dd"}if(S==="boolean")return"General";if(S==="text")return"@";if(typeof M.pattern=="string"&&p(M.pattern))return String(M.pattern).trim();if(M.notation==="compact"||M.notation==="scientific")return"General";const N=typeof M.decimals=="number"?M.decimals:typeof M.minDecimals=="number"?M.minDecimals:M.style==="currency"?2:0;let C=`${M.thousandsSeparator===!1?"":"#,#"}#0${N>0?`.${"0".repeat(N)}`:""}`,B="";return M.style==="currency"&&(B+=H(Z(M.currency||"USD",T))),M.prefix&&(B+=H(M.prefix)),C=B+C,M.style==="percent"&&(C=`${C}%`),M.suffix&&(C+=H(M.suffix)),M.negative==="parentheses"?`${C};(${C})`:M.negative==="suffix"?`${C};${C}-`:C}function H(M){return`"${String(M).split('"').join("")}"`}const G=new Map;function Z(M,S){const T=`${M}|${S||""}`;let O=G.get(T);if(O!==void 0)return O;O=M;try{const P=new Intl.NumberFormat(S,{style:"currency",currency:M}).formatToParts(0).find(C=>C.type==="currency");P&&(O=P.value)}catch{}return G.set(T,O),O}}),ze("packages/core/src/columns/types/temporal.js",function(e,_){"use strict";Object.defineProperty(e,"MS_SECOND",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"MS_MINUTE",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"MS_HOUR",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"MS_DAY",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"MS_WEEK",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"toTimeMs",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"zonedParts",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"zoneOffsetAt",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"instantFromParts",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"toEpochMs",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"toDurationMs",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(e,"resolveZoneName",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"zoneLabel",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"formatInstant",{enumerable:!0,get:function(){return le}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"timestampGroupProjector",{enumerable:!0,get:function(){return he}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return be}}),Object.defineProperty(e,"TEMPORAL_INFERENCE_ORDER",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return je}});const ne=_("packages/core/src/internal/predicates.js"),E=ne.isNil,K=ne.isFunction,U=_("packages/core/src/format/date.js"),D=U.toDate,J=U.compilePattern,z=U.compileDate,L=U.toIsoDateTime,X=U.compareIso,I=864e5,j=Object.freeze({}),k=1e3,y=60*k,l=60*y,g=24*l,s=7*g,t=new WeakMap;function o(ke,Ue){const Re=ke&&ke.locale||"",Ee=ke&&ke.column;if(!Ee)return Re?{locale:Re}:j;const He=t.get(Ee);if(He&&He.locale===Re)return He.bag;const Ke=Ee.typeOptions||Ee[Ue]||(c(Ee.format)?Ee.format:null),We={...Ke||j,locale:Ke&&Ke.locale||Re||void 0};return t.set(Ee,{locale:Re,bag:We}),We}function c(ke){return ke!==null&&typeof ke=="object"&&!Array.isArray(ke)&&!(ke instanceof Date)}function d(ke,Ue){const Re=ke===null||Number.isNaN(ke)?null:ke,Ee=Ue===null||Number.isNaN(Ue)?null:Ue;return Re===null?Ee===null?0:1:Ee===null||Re<Ee?-1:Re>Ee?1:0}const n=/^(\d{1,2})(?:\s*[:.h]\s*(\d{1,2})(?:\s*[:.]\s*(\d{1,2})(?:[.,](\d{1,3}))?)?)?\s*(a\.?m\.?|p\.?m\.?|a|p)?$/i,p=/^(\d{3,6})$/;function i(ke,Ue,Re,Ee){return!(ke>=0&&ke<=23)||!(Ue>=0&&Ue<=59)||!(Re>=0&&Re<=59)||!(Ee>=0&&Ee<=999)?null:ke*l+Ue*y+Re*k+Ee}function r(ke){if(E(ke))return null;const Ue=String(ke).trim();if(Ue==="")return null;const Re=p.exec(Ue);if(Re){const dt=Re[1];if(dt.length===5)return null;const lt=dt.length===3?1:2;return i(Number(dt.slice(0,lt)),Number(dt.slice(lt,lt+2)),Number(dt.slice(lt+2,lt+4)||0),0)}const Ee=n.exec(Ue);if(!Ee)return null;let He=Number(Ee[1]);const Ke=Number(Ee[2]||0),We=Number(Ee[3]||0),qe=Ee[4]?Number(Ee[4].padEnd(3,"0")):0,et=Ee[5]?Ee[5][0].toLowerCase():null;if(et){if(He<1||He>12)return null;He=He%12,et==="p"&&(He+=12)}return i(He,Ke,We,qe)}function f(ke){return E(ke)||ke===""?null:typeof ke=="number"?Number.isFinite(ke)?(ke%g+g)%g:null:ke instanceof Date?Number.isNaN(ke.getTime())?null:ke.getHours()*l+ke.getMinutes()*y+ke.getSeconds()*k+ke.getMilliseconds():r(ke)}const m=new Map;function u(ke){const Ue=ke.pattern||"",Re=ke.timeStyle||(ke.seconds?"medium":"short"),Ee=`${ke.locale||""}|${Ue}|${Re}`;let He=m.get(Ee);if(He)return He;if(Ue)He=J(Ue,ke.locale||void 0,"UTC");else{const Ke=new Intl.DateTimeFormat(ke.locale||void 0,{timeStyle:Re,timeZone:"UTC"});He=We=>Ke.format(We)}return m.set(Ee,He),He}function b(ke,Ue){const Re=Ue||j;if(ke==null||typeof ke!="number"||!Number.isFinite(ke))return Re.nullDisplay??"";const Ee=(ke%g+g)%g;return u(Re)(new Date(Ee))}function a(ke){return ke instanceof Date?!Number.isNaN(ke.getTime()):typeof ke=="number"?Number.isFinite(ke)&&ke>=0&&ke<g:typeof ke!="string"||!ke.includes(":")?!1:r(ke)!==null}function h(ke){const Ue=f(ke);return Ue==null?"":b(Ue,{pattern:Ue%k===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const w=new Map;function v(ke){const Ue=ke||"";let Re=w.get(Ue);return Re||(Re=new Intl.DateTimeFormat("en-GB",{timeZone:ke||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),w.set(Ue,Re)),Re}function A(ke,Ue){const Re={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const Ee of v(Ue).formatToParts(new Date(ke)))Ee.type==="year"?Re.year=Number(Ee.value):Ee.type==="month"?Re.month=Number(Ee.value):Ee.type==="day"?Re.day=Number(Ee.value):Ee.type==="hour"?Re.hour=Number(Ee.value)%24:Ee.type==="minute"?Re.minute=Number(Ee.value):Ee.type==="second"&&(Re.second=Number(Ee.value));return Re}function H(ke,Ue){const Re=A(ke,Ue);return Date.UTC(Re.year,Re.month-1,Re.day,Re.hour,Re.minute,Re.second,0)-Math.floor(ke/1e3)*1e3}function G(ke,Ue){const Re=ke.hour||0,Ee=ke.minute||0,He=ke.second||0,Ke=ke.ms||0;if(!Ue)return new Date(ke.year,ke.month-1,ke.day,Re,Ee,He,Ke).getTime();const We=Date.UTC(ke.year,ke.month-1,ke.day,Re,Ee,He,Ke);let qe=We-H(We,Ue);return qe=We-H(qe,Ue),qe}const Z=/(?:Z|[+-]\d{2}:?\d{2})$/i,M=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function S(ke,Ue){if(E(ke))return null;const Re=String(ke).trim();if(Re==="")return null;const Ee=Ue&&Ue.timeZone||void 0;if(!Z.test(Re)){const He=M.exec(Re);if(He){const Ke=(He[4]||"").trim(),We=Ke===""?0:r(Ke);if(We===null)return null;const qe=G({year:Number(He[1]),month:Number(He[2]),day:Number(He[3]),hour:Math.floor(We/l),minute:Math.floor(We/y)%60,second:Math.floor(We/k)%60,ms:We%k},Ee);return Number.isNaN(qe)?null:new Date(qe)}}return D(Re)}function T(ke){if(typeof ke=="number")return Number.isFinite(ke)?ke:null;const Ue=D(ke);return Ue?Ue.getTime():null}const O=new Map;function N(ke){const Ue=[ke.locale||"",ke.pattern||"",ke.dateStyle||"",ke.timeStyle||"",ke.timeZone||"",ke.seconds?"1":""].join("|");let Re=O.get(Ue);if(Re)return Re;const Ee=ke.pattern?{type:"date",pattern:ke.pattern,timeZone:ke.timeZone}:{type:"date",dateStyle:ke.dateStyle||"medium",timeStyle:ke.timeStyle||(ke.seconds?"medium":"short"),timeZone:ke.timeZone};return Re=z(Ee,ke.locale||void 0),O.set(Ue,Re),Re}function P(ke,Ue){const Re=Ue||j,Ee=T(ke);return Ee==null?Re.nullDisplay??"":N(Re)(Ee)}function C(ke){return ke instanceof Date?!Number.isNaN(ke.getTime()):typeof ke!="string"||!M.test(ke.trim())?!1:S(ke)!==null}const B=Object.freeze([{key:"w",ms:s,intl:"week",long:["week","weeks"],names:["w","wk","wks","week","weeks"]},{key:"d",ms:g,intl:"day",long:["day","days"],names:["d","dy","day","days"]},{key:"h",ms:l,intl:"hour",long:["hour","hours"],names:["h","hr","hrs","hour","hours"]},{key:"m",ms:y,intl:"minute",long:["minute","minutes"],names:["m","min","mins","minute","minutes"]},{key:"s",ms:k,intl:"second",long:["second","seconds"],names:["s","sec","secs","second","seconds"]},{key:"ms",ms:1,intl:"millisecond",long:["millisecond","milliseconds"],names:["ms","msec","msecs","milli","millis","millisecond","milliseconds"]}]),x=new Map;for(const ke of B)for(const Ue of ke.names)x.set(Ue,ke);const V=Object.freeze(B.filter(ke=>ke.key!=="w")),Y=/^(\d+(?:\.\d+)?)\s*([a-z]+)\s*(?:,\s*)?/,F=/^\d+(?:\.\d+)?$/,$=/^(\d+):([0-5]?\d)(?::([0-5]?\d))?(?:\.(\d{1,3}))?$/;function q(ke){const Ue=ke&&ke.defaultUnit?x.get(String(ke.defaultUnit).toLowerCase()):null;return Ue?Ue.ms:y}function ee(ke){return(ke&&ke.defaultUnit?x.get(String(ke.defaultUnit).toLowerCase()):null)||x.get("m")}function te(ke,Ue){if(E(ke))return null;let Re=String(ke).trim().toLowerCase();if(Re==="")return null;let Ee=1;if(Re[0]==="-"?(Ee=-1,Re=Re.slice(1).trim()):Re[0]==="+"&&(Re=Re.slice(1).trim()),Re==="")return null;const He=$.exec(Re);if(He){const et=He[3]!==void 0,dt=Number(He[1])*l+Number(He[2])*y+(et?Number(He[3])*k:0)+(He[4]?Number(He[4].padEnd(3,"0")):0);return Ee*dt}if(F.test(Re))return Math.round(Ee*Number(Re)*q(Ue||j));let Ke=Re,We=0,qe=0;for(;Ke!=="";){const et=Y.exec(Ke);if(!et)return null;const dt=x.get(et[2]);if(!dt)return null;We+=Number(et[1])*dt.ms,Ke=Ke.slice(et[0].length),qe++}return qe===0?null:Math.round(Ee*We)}function re(ke){return E(ke)||ke===""?null:typeof ke=="number"?Number.isFinite(ke)?ke:null:te(ke)}const ie=new Map;function ue(ke,Ue,Re){const Ee=`${Re||""}|${Ue.intl}`;let He=ie.get(Ee);if(He===void 0){try{He=new Intl.NumberFormat(Re||void 0,{style:"unit",unit:Ue.intl,unitDisplay:"long"})}catch{He=null}ie.set(Ee,He)}return He?He.format(ke):`${ke} ${ke===1?Ue.long[0]:Ue.long[1]}`}function Ae(ke,Ue){return String(ke).padStart(Ue,"0")}function de(ke,Ue){const Re=Ue||j;if(ke==null||typeof ke!="number"||!Number.isFinite(ke))return Re.nullDisplay??"";const Ee=Re.style||"short",He=ke<0;let Ke=Math.round(Math.abs(ke));const We=He?"-":"";if(Ke===0&&Re.zeroDisplay!=null)return Re.zeroDisplay;if(Ee==="clock"){const lt=Math.floor(Ke/l),vt=Math.floor(Ke/y)%60,Pt=Math.floor(Ke/k)%60;return`${We}${Ae(lt,2)}:${Ae(vt,2)}:${Ae(Pt,2)}`}if(Ke===0){const lt=ee(Re);return Ee==="long"?ue(0,lt,Re.locale):`0${lt.key}`}const qe=Re.weeks===!0?B:V,et=typeof Re.maxUnits=="number"&&Re.maxUnits>0?Re.maxUnits:Re.maxUnits===void 0?2:1/0,dt=[];for(const lt of qe){if(dt.length>=et)break;const vt=Math.floor(Ke/lt.ms);vt!==0&&(Ke-=vt*lt.ms,dt.push(Ee==="long"?ue(vt,lt,Re.locale):`${vt}${lt.key}`))}return We+dt.join(" ")}function Oe(ke){if(typeof ke!="string")return!1;const Ue=ke.trim();return Ue===""||$.test(Ue)||!/[a-z]/i.test(Ue)?!1:te(Ue)!==null}const Me=Date.UTC(1899,11,30),Fe=new Map;function pe(ke,Ue){const Re=ke||"";let Ee=Fe.get(Re);Ee||(Ee=new Intl.DateTimeFormat("en-GB",{timeZone:ke||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),Fe.set(Re,Ee));const He=typeof Ue=="number"?Ue:Date.now();for(const Ke of Ee.formatToParts(new Date(He)))if(Ke.type==="timeZoneName")return Ke.value;return""}function ae(ke){if(ke)return ke;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function ge(ke,Ue){const Re=ae(ke),Ee=pe(ke,Ue);return Ee?`${Re} (${Ee})`:Re}function ve(ke,Ue){if(ke&&ke.timeZone)return ke.timeZone;const Re=Ue&&Ue.grid;return(Re&&K(Re.get)?Re.get("timeZone"):void 0)||void 0}function le(ke,Ue){const Re=Ue||j,Ee=T(ke);if(Ee==null)return Re.nullDisplay??"";const He=N(Re)(Ee);if(!Re.showOrigin)return He;const Ke=Re.originZone;return Ke?Ke===(Re.timeZone||ae(Re.timeZone))?He:`${He} (${ge(Ke,Ee)})`:`${He} (no origin recorded)`}function we(ke,Ue,Re,Ee){if(Ue==="instant"||!Ue)return ke;const He=A(ke,Re);if(Ue==="month")return G({year:He.year,month:He.month,day:1},Re);if(Ue==="week"){const Ke=Ee>=1&&Ee<=7?Ee:1,qe=((new Date(Date.UTC(He.year,He.month-1,He.day)).getUTCDay()+6)%7+1-Ke+7)%7,et=new Date(Date.UTC(He.year,He.month-1,He.day-qe));return G({year:et.getUTCFullYear(),month:et.getUTCMonth()+1,day:et.getUTCDate()},Re)}return G({year:He.year,month:He.month,day:He.day},Re)}function he(ke,Ue){const Re=ke&&ke.group,Ee=Re&&Re.granularity||"day";if(Ee==="instant")return null;const He=Re&&Re.weekStart;return Ke=>typeof Ke=="number"?we(Ke,Ee,Ue,He):Ke}const be={time:{base:"number",storage:"float64",matches:a,format:ke=>b(f(ke.value),o(ke,"time")),parse:ke=>r(ke.text),compare:(ke,Ue)=>d(f(ke),f(Ue)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:ke=>{const Ue=f(ke);return Ue===null?null:Ue/I},toStorage:ke=>f(ke),toClipboard:h,fromClipboard:r},datetime:{base:"dateString",storage:"dictionary",matches:C,format:ke=>P(ke.value,o(ke,"datetime")),parse:ke=>L(S(ke.text,o(ke,"datetime"))??ke.text),compare:X,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(ke,Ue)=>L(ke,Ue&&Ue.timeZone),toClipboard:ke=>E(ke)?"":String(ke),fromClipboard:ke=>L(ke)},duration:{base:"number",storage:"float64",matches:Oe,format:ke=>de(re(ke.value),o(ke,"duration")),parse:ke=>te(ke.text,o(ke,"duration")),compare:(ke,Ue)=>d(re(ke),re(Ue)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:ke=>{const Ue=re(ke);return Ue===null?null:Ue/I},toStorage:ke=>re(ke),toClipboard:ke=>de(re(ke),{style:"short",maxUnits:-1}),fromClipboard:ke=>te(ke)},timestamp:{base:"number",storage:"float64",format:ke=>{const Ue=o(ke,"timestamp");return le(ke.value,{...Ue,timeZone:ve(Ue,ke)})},parse:ke=>{const Ue=o(ke,"timestamp"),Re=S(ke.text,{timeZone:ve(Ue,ke)});return Re?Re.getTime():null},compare:(ke,Ue)=>d(T(ke),T(Ue)),groupProjector:(ke,Ue)=>he(ke,Ue),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(ke,Ue)=>{const Re=T(ke);if(Re==null)return null;const Ee=A(Re,Ue&&Ue.timeZone||void 0);return(Date.UTC(Ee.year,Ee.month-1,Ee.day,Ee.hour,Ee.minute,Ee.second)-Me)/I},toStorage:ke=>T(ke),toClipboard:ke=>{const Ue=T(ke);return Ue==null?"":new Date(Ue).toISOString()},fromClipboard:ke=>T(ke)}},Te=["datetime","time","duration"],je=be}),ze("packages/core/src/internal/lru.js",function(e,_){"use strict";Object.defineProperty(e,"Lru",{enumerable:!0,get:function(){return ne}});class ne{#e;#t=new Map;#n;constructor(K=256,U=null){this.#e=K,this.#n=U}get size(){return this.#t.size}get max(){return this.#e}set max(K){this.#e=K,this.#r()}has(K){return this.#t.has(K)}get(K){const U=this.#t;if(!U.has(K))return;const D=U.get(K);return U.delete(K),U.set(K,D),D}peek(K){return this.#t.get(K)}set(K,U){const D=this.#t;return D.has(K)&&D.delete(K),D.set(K,U),this.#r(),U}delete(K){const U=this.#t.get(K);return this.#t.delete(K)&&this.#n&&this.#n(U,K),U}clear(){if(this.#n)for(const[K,U]of this.#t)this.#n(U,K);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const K=this.#t;for(;K.size>this.#e;){const U=K.keys().next().value,D=K.get(U);K.delete(U),this.#n&&this.#n(D,U)}}}}),ze("packages/core/src/columns/types/network.js",function(e,_){"use strict";Object.defineProperty(e,"toUint32",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"compareIpv4",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"packCidr",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"cidrParts",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isCidr",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"compareCidr",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"netmask",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"addressCount",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"ipv6Groups",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return T}});const E=_("packages/core/src/internal/predicates.js").isNil,U=_("packages/core/src/internal/lru.js").Lru,D=4294967295,J=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function z(O){if(E(O))return null;if(typeof O=="string")return L(O);const N=Number(O);return Number.isFinite(N)?N<0?N<-2147483648?null:N>>>0:N>D?null:Math.trunc(N)>>>0:null}function L(O){if(E(O))return null;const N=String(O).trim();if(N==="")return null;const P=J.exec(N);if(!P)return null;let C=0;for(let B=1;B<=4;B++){const x=P[B];if(x.length>1&&x.charCodeAt(0)===48)return null;const V=Number(x);if(V>255)return null;C=C*256+V}return C}function X(O){const N=z(O);return N===null?"":`${N>>>24&255}.${N>>>16&255}.${N>>>8&255}.${N&255}`}function I(O){return typeof O=="string"&&L(O)!==null}function j(O,N){const P=z(O),C=z(N);return P===null?C===null?0:1:C===null||P<C?-1:P>C?1:0}const k=64,y=D*k+32,l=/^(?:0|[1-9]\d?)$/;function g(O,N){return O*k+N}function s(O){if(E(O))return null;if(typeof O=="string"){const C=t(O);return C===null?null:s(C)}if(typeof O=="object"){const C=z(O.address),B=Number(O.prefix);return C===null||!Number.isInteger(B)||B<0||B>32?null:{address:C,prefix:B}}const N=Number(O);if(!Number.isInteger(N)||N<0||N>y)return null;const P=N%k;return P>32?null:{address:(N-P)/k,prefix:P}}function t(O){if(E(O))return null;const N=String(O).trim();if(N==="")return null;const P=N.indexOf("/");if(P<0)return null;const C=L(N.slice(0,P));if(C===null)return null;const B=N.slice(P+1).trim();if(!l.test(B))return null;const x=Number(B);return x>32?null:g(C,x)}function o(O){const N=s(O);return N?`${X(N.address)}/${N.prefix}`:""}function c(O){return typeof O=="string"&&t(O)!==null}function d(O,N){const P=s(O),C=s(N);return P?C?P.address!==C.address?P.address<C.address?-1:1:P.prefix-C.prefix:-1:C?1:0}function n(O){return O===0?0:4294967295<<32-O>>>0}function p(O){const N=s(O);return N?(N.address&n(N.prefix))>>>0:null}function i(O){const N=s(O);return N?(N.address&n(N.prefix)|~n(N.prefix)>>>0)>>>0:null}function r(O){const N=s(O);return N?2**(32-N.prefix):null}function f(O){const N=s(O);return N?N.prefix===32?1:N.prefix===31?2:2**(32-N.prefix)-2:null}function m(O,N){const P=s(O);if(!P)return!1;const C=z(N);if(C===null)return!1;const B=n(P.prefix);return(C&B)>>>0===(P.address&B)>>>0}function u(O,N){const P=p(O),C=p(N);return P===null||C===null?!1:P<=i(N)&&C<=i(O)}const b=/^[0-9a-fA-F]{1,4}$/,a=new U(512);function h(O){if(E(O))return null;let N=String(O).trim();if(N==="")return null;const P=N.indexOf("%");if(P>=0&&(N=N.slice(0,P)),N==="")return null;if(N.indexOf(".")>=0){const F=N.lastIndexOf(":");if(F<0)return null;const $=L(N.slice(F+1));if($===null)return null;N=`${N.slice(0,F+1)}${($>>>16&65535).toString(16)}:${($&65535).toString(16)}`}const C=N.split("::");if(C.length>2)return null;const B=w(C[0]);if(B===null)return null;if(C.length===1)return B.length===8?B:null;const x=w(C[1]);if(x===null)return null;const V=8-B.length-x.length;if(V<1)return null;const Y=B.slice();for(let F=0;F<V;F++)Y.push(0);for(const F of x)Y.push(F);return Y}function w(O){if(O==="")return[];const N=[];for(const P of O.split(":")){if(!b.test(P))return null;N.push(parseInt(P,16))}return N}function v(O){if(typeof O!="string")return h(O);if(a.has(O))return a.get(O);const N=h(O);return a.set(O,N),N}function A(O){if(O[0]===0&&O[1]===0&&O[2]===0&&O[3]===0&&O[4]===0&&O[5]===65535)return`::ffff:${X((O[6]<<16|O[7])>>>0)}`;let N=-1,P=0,C=-1,B=0;for(let Y=0;Y<8;Y++)O[Y]===0?(C<0?(C=Y,B=1):B++,B>P&&(P=B,N=C)):(C=-1,B=0);if(P<2)return O.map(Y=>Y.toString(16)).join(":");const x=O.slice(0,N).map(Y=>Y.toString(16)).join(":"),V=O.slice(N+P).map(Y=>Y.toString(16)).join(":");return`${x}::${V}`}function H(O){const N=h(O);return N===null?null:A(N)}function G(O){return H(O)??""}function Z(O){return typeof O=="string"&&O.indexOf(":")>=0&&h(O)!==null}function M(O,N){const P=v(O),C=v(N);if(!P)return C?1:0;if(!C)return-1;for(let B=0;B<8;B++)if(P[B]!==C[B])return P[B]<C[B]?-1:1;return 0}const S=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:I,parse:O=>L(O.text),compare:j,format:O=>X(O.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:O=>z(O),toClipboard:O=>X(O),fromClipboard:O=>L(O)},cidr:{base:"number",storage:"float64",matches:c,parse:O=>t(O.text),compare:d,format:O=>o(O.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:O=>{const N=s(O);return N===null?null:g(N.address,N.prefix)},toClipboard:O=>o(O),fromClipboard:O=>t(O)},ipv6:{base:"text",storage:"dictionary",matches:Z,parse:O=>H(O.text),compare:M,format:O=>G(O.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:O=>H(O),toClipboard:O=>G(O),fromClipboard:O=>H(O)}}),T=S}),ze("packages/core/src/i18n/catalogue.js",function(e,_){"use strict";Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return D}});const ne=_("packages/core/src/registry/free-tier-notice.js"),E=ne.FREE_TIER_NOTICE,K=ne.WATERMARK_TEXT,U=Object.freeze({"count.rows":{one:"{count} row",other:"{count} rows"},"count.comments":{one:"{count} comment",other:"{count} comments"},"comments.someUnresolved":"{comments}, {unresolved} unresolved","comments.allResolved":"{comments}, all resolved","count.unresolvedComments":{one:"{count} unresolved comment",other:"{count} unresolved comments"},"count.items":{one:"{count} item",other:"{count} items"},"count.keys":{one:"{count} key",other:"{count} keys"},"count.values":{one:"value",other:"values"},"count.waiting":{one:"{count} waiting",other:"{count} waiting"},"count.rowsAdded":{one:"{count} row added",other:"{count} rows added"},"count.rowsRemoved":{one:"{count} row removed",other:"{count} rows removed"},"value.empty":"empty","a11y.sort.cleared":"Sort cleared","a11y.sort.by":"Sorted by {columns}","a11y.sort.column":"{column} {direction}","a11y.sort.ascending":"ascending","a11y.sort.descending":"descending","a11y.filter.cleared":"Filter cleared, {rows}","a11y.filter.applied":"Filtered to {shown} of {total}","a11y.find.count":{one:"{current} of {count} match",other:"{current} of {count} matches"},"a11y.find.countLoaded":{one:"{current} of {count} match in loaded rows",other:"{current} of {count} matches in loaded rows"},"a11y.find.none":"No matches","a11y.find.noneLoaded":"No matches in loaded rows","a11y.selection.cleared":"Selection cleared","a11y.selection.count":{one:"{count} row selected",other:"{count} rows selected"},"tabs.tablist":"Tabs","a11y.tabs.selected":"{label} tab selected","a11y.scrollbar.horizontal":"Horizontal scrollbar","a11y.scrollbar.vertical":"Vertical scrollbar","designer.canvas":"Dashboard canvas","designer.chrome":"Designer tools","designer.page":"Page {n}","a11y.designer.edit":"Edit mode","a11y.designer.view":"View mode","layout.region":"Dashboard layout","layout.move":"Move {title}","layout.resize":"Resize {title}","layout.close":"Close {title}","a11y.layout.grabbed":"{title} grabbed, column {x} of {columns}, row {y}","a11y.layout.position":"{title}, column {x} of {columns}, row {y}","a11y.layout.dropped":"{title} dropped, column {x} of {columns}, row {y}","a11y.layout.cancelled":"{title} move cancelled","a11y.layout.resizeCancelled":"{title} resize cancelled","a11y.layout.reverted":"{title} returned to column {x}, row {y}","a11y.layout.resizeGrabbed":"{title} resize grabbed, {w} by {h} cells","a11y.layout.resizeStep":"{title}, {w} by {h} cells","a11y.layout.resized":"{title} resized to {w} by {h} cells","a11y.layout.closed":"{title} closed","layout.maximise":"Maximise {title}","layout.minimise":"Minimise {title}","layout.restore":"Restore {title}","a11y.layout.maximised":"{title} maximised, filling the dashboard; press Escape to restore it","a11y.layout.minimised":"{title} minimised","a11y.layout.restored":"{title} restored to column {x}, row {y}","a11y.group.cleared":"Grouping cleared","a11y.group.by":"Grouped by {columns}","a11y.group.expanded":"{label} expanded, {rows} shown","a11y.group.collapsed":"{label} collapsed, {rows} shown","a11y.page.position":"Page {page} of {pages}","a11y.updates.paused":"Updates paused","a11y.updates.resumed":"Updates resumed","a11y.edit.refusedOne":"Edit to {column} was refused and put back to {value}{reason}","a11y.edit.refusedMany":{one:"{count} edit was refused and put back{reason}",other:"{count} edits were refused and put back{reason}"},"a11y.edit.reason":", {reason}","a11y.history.undo":"Undid {label}","a11y.history.redo":"Redid {label}","a11y.history.undoLast":"Undid the last change","a11y.history.redoLast":"Redid the last change","a11y.column.cannotResize":"{column} cannot be resized","a11y.column.resized":"{column} is {width} pixels wide","a11y.column.atMinimum":"{column} is at its narrowest, {width} pixels","a11y.column.atMaximum":"{column} is at its widest, {width} pixels","a11y.column.cannotMove":"{column} cannot be moved","a11y.column.alreadyFirst":"{column} is already first in its group","a11y.column.alreadyLast":"{column} is already last in its group","a11y.column.cannotMoveThere":"{column} cannot be moved there","a11y.column.moved":"{column} moved to position {at} of {of}","a11y.group.formed":"{column} grouped with {other} in a new band","a11y.group.dissolved":"band {group} dissolved","a11y.group.renamed":"band renamed to {group}","a11y.group.moved":"band {group} moved to position {at} of {of}","a11y.column.addedToGroup":"{column} added to band {group}","a11y.column.removedFromGroup":"{column} removed from its band","a11y.column.notInGroup":"{column} is not in a band","a11y.column.cannotGroup":"{column} cannot be grouped","a11y.group.cannotMove":"band {group} cannot be moved there","columngroup.newGroup":"New group","columngroup.rename":"Rename band","columngroup.dissolve":"Dissolve band","columngroup.group":"Group with adjacent column","columngroup.untitled":"Untitled band","panel.bandCollapse":"Collapse band {band}","panel.bandExpand":"Expand band {band}","panel.bandVisible":"Show or hide every column in band {band}","panel.bandRenameFor":"Rename band {band}","panel.bandDissolveFor":"Dissolve band {band}","header.filter":"Filter {column}","header.menu":"Column menu for {column}","header.toggleGroup":"Toggle {group}","header.dragHint":"Drag {column} to reorder, or onto another column to group","header.dragRole":"draggable column header","header.group":"group","header.selectAllRows":"Select all rows","header.clearSelection":"Clear selection","cell.selectRow":"Select row","cell.detail.show":"Show detail","cell.detail.hide":"Hide detail","cell.detail.showInPane":"Show in the detail pane","cell.detail.showingInPane":"Showing in the detail pane","cell.group.expand":"Expand","cell.group.collapse":"Collapse","cell.delta.up":"up","cell.delta.down":"down","cell.delta.unchanged":"unchanged","cell.delta.moved":"{direction} {magnitude}","cell.delta.describedUnchanged":"{label}, unchanged","cell.delta.described":"{label}, {direction} by {magnitude}","cell.qr.of":"QR code for {text}","cell.qr.empty":"No QR code","cell.barcode.of":"Barcode for {text}","cell.barcode.empty":"No barcode","cell.barcode.invalid":"Invalid value for this barcode","cell.rating.of":"{rating} of {max}","cell.rating.empty":"Not rated","cell.stage.of":"Stage {current} of {total}: {label}","cell.stage.empty":"No stage","a11y.panel.cannotMove":"{column} cannot be moved","a11y.panel.alreadyFirst":"{column} is already first","a11y.panel.alreadyLast":"{column} is already last","a11y.panel.moved":"{column} moved to position {at} of {of}","a11y.panel.removedFrom":"{column} removed from {list}","a11y.panel.addedTo":"{column} added to {list}","a11y.panel.cannotAddTo":"{column} cannot be added to {list}","a11y.annotate.erased":"Annotation removed","a11y.annotate.noMarks":"No annotations to erase","a11y.annotate.focusedMark":"Mark {at} of {of} selected","a11y.annotate.confirmClear":"Clear all annotations? Choose Clear or Keep.","a11y.annotate.cleared":"All annotations cleared","a11y.range.written":{one:"{count} cell updated",other:"{count} cells updated"},"a11y.range.cleared":{one:"{count} cell cleared",other:"{count} cells cleared"},"paste.preview.title":"Review paste","paste.preview.summary":{one:"{changes} cell will change, {rejected} rejected.",other:"{changes} cells will change, {rejected} rejected."},"paste.preview.changesHeading":{one:"{count} change",other:"{count} changes"},"paste.preview.rejectedHeading":{one:"{count} rejected",other:"{count} rejected"},"paste.preview.colOld":"Current","paste.preview.colNew":"New","paste.preview.colCell":"Cell","paste.preview.colReason":"Reason","paste.preview.empty":"This paste would change nothing.","paste.preview.confirm":"Apply","paste.preview.cancel":"Cancel","paste.preview.reason.permission":"Not permitted","paste.preview.reason.readOnly":"Read-only","paste.preview.reason.validation":"Invalid value","paste.preview.reason.locked":"Being edited","paste.preview.reason.missing":"No such cell","a11y.paste.previewOpened":{one:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel.",other:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel."},"a11y.paste.cancelled":"Paste cancelled; nothing changed","status.total":"{rows}","status.counting":"Counting rows…","status.shownOfTotal":"{shown} of {total}","status.selected":"{count} selected","status.selectedAcrossSource":"{count} selected across the source","status.selectedAcrossSourceCounting":"All matching rows selected, counting…","status.count":"Count {count}","status.loading":"Loading {count}…","status.loadingOf":"Loading {loaded} of {total} ({percent}%)","status.stat.sum":"Sum","status.stat.min":"Min","status.stat.max":"Max","status.stat.avg":"Avg","status.paused":"Paused","status.pausedWaiting":"Paused · {waiting}","status.coalesced":"{count} coalesced","status.hiddenComments":"{comments} on hidden rows","pagination.label":"Pagination","pagination.first":"First page","pagination.previous":"Previous page","pagination.next":"Next page","pagination.last":"Last page","pagination.page":"Page","pagination.ofPages":"of {pages}","pagination.summary":"{from}–{to} of {total}","pagination.pageSize":"Rows per page","pagination.range":"{from}–{to}","pagination.counting":"{from}–{to}, counting…","pagination.jump":"Page number, press Enter to jump","pagination.jumpBounded":"Page number, 1 to {pages}, press Enter to jump","panel.columns":"Columns","panel.filters":"Filters","panel.views":"Views","panel.quickFilter":"Quick filter","find.label":"Find in grid","find.placeholder":"Find in grid","find.next":"Next match","find.previous":"Previous match","find.close":"Close find","find.matchCase":"Match case","find.wholeCell":"Whole cell","find.columnScope":"Search in","find.allColumns":"All columns","find.count":"{current} of {total}","find.countPartial":"{current} of {total} so far","find.none":"No matches","find.searching":"Searching…","find.loadedRows":"in loaded rows","panel.formatting":"Formatting","panel.statistics":"Statistics","stat.noData":"No data","stat.tone.good":"good","stat.tone.bad":"bad","stat.tone.flat":"flat","panel.regression":"Regression","panel.compare":"Compare","panel.insights":"Insights","panel.compareGroups":"Compare groups","panel.explain":"Explain","insights.subset":"Filtered subset vs whole","insights.dataset":"This grid vs another dataset","insights.groups":"Group comparison","insights.noFilter":"Filter the grid to compare the subset against the whole.","insights.by":"Group by","insights.test":"Test","insights.effect":"Effect size","insights.interval":"Confidence interval","insights.pValue":"p-value","insights.smallSample":"small sample — interpret with care","insights.needGroups":"Choose two columns with groups to compare.","compareGroups.noTest":"Not enough readings, or no variation, in at least one group.","insights.empty":"No columns to analyse.","insights.anomalies":"Anomalies","insights.anomalyCount":"{count} flagged of {n}","insights.anomalyMethod":"Method","insights.anomalyThreshold":"Threshold","anomaly.chip":"{count} anomalies flagged","anomaly.chipActive":"Showing {count} anomalies — clear","compare.first":"First column","compare.second":"Second column","compare.needTwo":"Two numeric columns are needed to compare","compare.noPairs":"No rows have a value in both","compare.pairs":"{count} pairs","compare.pearson":"Correlation (Pearson)","compare.spearman":"Rank correlation (Spearman)","compare.kendall":"Kendall’s tau","compare.covariance":"Covariance","compare.slope":"Slope","compare.intercept":"Intercept","compare.r2":"R²","compare.stdError":"Standard error","compare.weighted":"Weighted average","panel.zone.group":"row groups","panel.zone.values":"values","panel.zone.pivot":"pivot columns","groupZone.label":"Row groups","groupZone.title":"Group by","groupZone.hint":"Drag a column here to group rows by its values","groupZone.chip":"{column}, group {at} of {of}","groupZone.remove":"Stop grouping by {column}","groupZone.add":"Add a group","total.sum":"Sum","total.avg":"Average","total.min":"Min","total.max":"Max","total.count":"Count","total.countValues":"Count of values","total.first":"First","total.last":"Last","total.custom":"Total","total.median":"Median","total.p25":"25th percentile","total.p75":"75th percentile","total.p90":"90th percentile","total.p95":"95th percentile","total.p99":"99th percentile","total.iqr":"Interquartile range","total.mad":"Median absolute deviation","total.variance":"Variance","total.varianceP":"Variance (population)","total.stddev":"Standard deviation","total.stddevP":"Standard deviation (population)","total.range":"Range","total.distinct":"Distinct","total.mode":"Mode","total.skewness":"Skewness","total.kurtosis":"Kurtosis","total.geomean":"Geometric mean","total.harmean":"Harmonic mean","total.sumSquares":"Sum of squares","total.weightedAvg":"Weighted average","total.argmin":"Lowest by","total.argmax":"Highest by","total.hhi":"Concentration (HHI)","total.entropy":"Entropy","total.evenness":"Evenness","total.top3Share":"Top 3 share","total.top10Share":"Top 10 share","total.gini":"Gini coefficient","total.trimmedMean":"Trimmed mean","total.winsorizedMean":"Winsorized mean","total.robustOutliers":"Outliers (robust)","total.jarqueBera":"Jarque–Bera","total.passRate":"Pass rate","total.failureCount":"Failures","stats.column":"Column","stats.choose":"Choose a column to profile","stats.noColumns":"No numeric columns to profile","stats.noValues":"Nothing numeric in this column","stats.count":"Count","stats.present":"Present","stats.missing":"Missing","stats.distinct":"Distinct","stats.min":"Minimum","stats.max":"Maximum","stats.mean":"Mean","stats.median":"Median","stats.q1":"Lower quartile","stats.q3":"Upper quartile","stats.iqr":"Interquartile range","stats.stddev":"Standard deviation","stats.outliers":"Outliers","stats.distribution":"Distribution","stats.distribution.detail":"Distribution: rows per range","stats.bin":"{count} between {from} and {to}","stats.topValues":"Top values","stats.section.shape":"Shape","stats.section.robust":"Robust","stats.section.concentration":"Concentration","stats.section.capability":"Capability","stats.cp":"Cp","stats.cpk":"Cpk","stats.pp":"Pp","stats.ppk":"Ppk","stats.outOfSpec":"Out of specification","stats.filtered":"Over the {count} filtered rows","stats.unavailable":"Not computed by the source: {stats}.","stats.unavailable.notPlain":"`{column}` is not a plain column the engine can name","stats.unavailable.where":"a `where` predicate is in force ({list}), which only the browser can run","stats.unavailable.filter":"the grid's filter did not fully push to the engine","stats.unavailable.quick":"the quick search did not push to the engine","stats.unavailable.client":'the source did not compute "{fn}" in the engine ({reason}); set the pushdown source\'s `{setting}`',"stats.unavailable.outliers":"the count of values outside Tukey's fences is not an engine aggregate","stats.unavailable.histogram":"the shape of the column is not an engine aggregate","stats.unavailable.topValues":"the source did not answer a grouped count in the engine","explain.column":"Value","explain.by":"Break down by","explain.byRow":"Each row","explain.noColumns":"No numeric columns to explain","explain.unavailable":"Nothing to explain in this column","explain.total":"{fn}: {total}","explain.weighted":"weighted effects","explain.single":"one contributor","explain.delta":"was {before}, now {after} (Δ {delta})","explain.breakdown":"Contributors","explain.contributor":"Contributor","explain.count":"Rows","explain.value":"Value","explain.contribution":"Contribution","explain.share":"Share","explain.change":"Change","explain.before":"Before","explain.after":"After","explain.effect":"Effect","explain.kind.new":"New","explain.kind.dropped":"Dropped","explain.kind.changed":"Changed","explain.narrative":"Explanation","explain.narrative.lead":"{top} accounts for {share}; the {fn} is {total}.","explain.narrative.next":"{next} follows at {share}.","explain.narrative.driver":"The change of {delta} was driven most by {top} ({effect}).","explain.narrative.driverNext":"{next} ({kind}) moved it {effect}.","explain.narrative.none":"Nothing contributed to this total.","explain.narrative.noChange":"Nothing changed between the two states.","regression.noModel":"No model configured. Set predictors and a response on the panel.","regression.cannotFit":"The model cannot be fitted over the current rows.","regression.observations":"Fitted over {count} rows","regression.r2":"R²","regression.adjR2":"Adjusted R²","regression.coefficients":"Coefficients","regression.term":"Term","regression.estimate":"Estimate ± SE","regression.stdError":"Std error","regression.t":"t","regression.p":"p","regression.vif":"Variance inflation (VIF)","regression.heteroscedasticity":"Heteroscedasticity (Breusch–Pagan)","regression.heteroscedastic":"Heteroscedastic: BP {statistic}, p {p}","regression.homoscedastic":"No heteroscedasticity detected: BP {statistic}, p {p}","menu.sortAscending":"Sort ascending","menu.sortDescending":"Sort descending","menu.clearSort":"Clear sort","menu.groupBy":"Group by this column","menu.ungroup":"Stop grouping by this column","menu.hideColumn":"Hide column","menu.pinStart":"Pin to start","menu.pinEnd":"Pin to end","menu.unpin":"Unpin","menu.autosize":"Fit to content","ai.valuesNotAmongOptions":'{values} {shown} not among the options for "{column}"',"menu.clearCells":{one:"Clear cell",other:"Clear {count} cells"},"menu.fillDown":"Fill down","menu.copy":"Copy","menu.copyWithHeaders":"Copy with headers","menu.paste":"Paste","menu.filterEllipsis":"Filter…","menu.columnStatistics":"Column statistics","menu.compareGroups":"Compare groups","menu.explain":"Explain this number","menu.pinColumn":"Pin column","menu.sizeToFit":"Size to fit content","menu.sizeAllToFit":"Size all columns to fit","menu.width":"Width","menu.narrower":"Narrower","menu.wider":"Wider","menu.moveColumn":"Move column","menu.moveLeft":"Move left","menu.moveRight":"Move right","menu.moveToStart":"Move to start","menu.moveToEnd":"Move to end","menu.unpivot":"Remove from pivot","menu.pivotBy":"Pivot by this column","menu.stopTotalling":"Stop totalling","menu.totalColumn":"Total this column","menu.aggregate":"Aggregate","menu.aggregateNone":"None","menu.aggregateGroup":"Group subtotals","menu.aggregateGrand":"Grand total","menu.aggregateSame":"Same as total","menu.redactColumn":"Redact column","menu.stopRedacting":"Stop redacting","menu.stopRedactingAll":"Stop redacting everything","menu.sortGroupsAscending":"Sort groups ascending","menu.sortGroupsDescending":"Sort groups descending","menu.filterGroups":"Filter groups…","menu.expandAll":"Expand all","menu.collapseAll":"Collapse all","menu.clearGrouping":"Clear grouping","menu.colour":"Colour","menu.importCsv":"Import rows from CSV…","import.title":"Import rows","import.clipboard":"the clipboard","import.summary":{one:"{count} row from {name}",other:"{count} rows from {name}"},"import.opened":{one:"Import preview open, {count} row",other:"Import preview open, {count} rows"},"import.done":{one:"{count} row imported",other:"{count} rows imported"},"import.confirm":"Import","import.cancel":"Cancel","import.colSource":"Column","import.colField":"Maps to","import.colType":"Type","import.skip":"— skip —","import.mapLabel":'Map "{source}" to a field',"import.modeLabel":"On import","import.sheetLabel":"Sheet","import.append":"Add to existing rows","import.replace":"Replace all rows","menu.deleteRow":{one:"Delete row",other:"Delete {count} rows"},"toolbar.undo":"Undo","toolbar.redo":"Redo","toolbar.undoLabelled":"Undo {label}","toolbar.redoLabelled":"Redo {label}","toolbar.exportCsv":"Export to CSV","toolbar.exportExcel":"Export to Excel","toolbar.clipboard":"Copy visible rows to the clipboard","toolbar.print":"Print","toolbar.pause":"Hold incoming updates","toolbar.resume":"Resume updates","toolbar.applyHeld":{one:"Apply {count} held update",other:"Apply {count} held updates"},"toolbar.restoreView":"Restore the default view","toolbar.maximiseGrid":"Maximise the grid to fill the window","toolbar.restoreSize":"Restore the grid to the page (Esc)","toolbar.annotate.pen":"Draw freehand","toolbar.annotate.arrow":"Draw an arrow","toolbar.annotate.rect":"Draw a rectangle","toolbar.annotate.highlight":"Highlight","toolbar.annotate.erase":"Erase","toolbar.annotate.clearAll":"Clear all annotations","toolbar.annotate.clearAllConfirm":"Clear","toolbar.annotate.clearAllKeep":"Keep","overlay.noRows":"No rows to show","overlay.noResults":"No rows match the current filters","overlay.loading":"Loading…","overlay.error":"Something went wrong","overlay.loadingRows":"Loading rows {from} to {to}","overlay.rowError":"Failed to load","comments.panel":"Cell comments","comments.close":"Close comments","comments.write":"Write a comment","comments.post":"Comment","comments.delete":"Delete","comments.valueMoved":"Written when the value was {was}: it is now {now}.","comments.resolve":"Resolve","comments.reopen":"Reopen","comments.loading":"Loading…","comments.empty":"No comments yet.","comments.unknownAuthor":"Unknown","comments.edited":"{time} (edited)","comments.cellTitle":"{column}: {row}","presence.hidden":{one:"{count} not in view",other:"{count} not in view"},"presence.someoneElse":"someone else","a11y.presence.refused":"This cell is being edited by {name}","presence.peer":"{name}: jump to their cursor","presence.peerIdle":"{name}, idle: jump to their cursor","presence.peerHidden":"{name}, not in the current view","facets.filter":"{column} distribution filter","header.totalOf":"{total} of {column}","diff.before":"Was: {value}","diff.empty":"(empty)","kanban.columnCards":{one:"{title}, {count} card",other:"{title}, {count} cards"},"kanban.laneCards":{one:"{lane}, {title}, {count} card",other:"{lane}, {title}, {count} cards"},"kanban.blocked":"Blocked","kanban.ready":"Ready","kanban.blockedBy":{one:"blocked by {count} card",other:"blocked by {count} cards"},"kanban.card.assignedTo":"Assigned to {names}","kanban.card.overdue":"Overdue","kanban.card.dueSoon":"Due soon","kanban.card.progress":"{percent}% complete","kanban.card.checklist":"{done} of {total} done","gantt.lag":"+{days}d","gantt.lead":"{days}d","gantt.a11y.moved":"{name} moved to {date}","gantt.a11y.day":"day {day}","gantt.a11y.resized":"{name} resized to {days} days","gantt.a11y.linkFrom":"Linking from {name}. Focus the successor and press L.","gantt.a11y.linked":"Linked {from} to {to}, finish to start.","gantt.a11y.linkCancelled":"Link cancelled.","gantt.a11y.deleted":"{name} deleted.","gantt.a11y.readOnly":"Read-only.","gantt.row.moveHandle":"Drag to reorder or re-parent {name}","gantt.a11y.rowMoved":"{name} moved.","gantt.a11y.rowReparented":"{name} moved under {parent}.","gantt.a11y.rowPromoted":"{name} moved to the top level.","gantt.a11y.rowMoveCancelled":"Move cancelled.","gantt.a11y.copied":"{count} tasks copied.","gantt.a11y.cut":"{count} tasks cut.","gantt.a11y.pasted":"{count} tasks pasted.","gantt.task.newName":"New task","gantt.a11y.taskAdded":"{name} added.","gantt.menu.addAbove":"Add task above","gantt.menu.addBelow":"Add task below","gantt.menu.addChild":"Add subtask","gantt.menu.addSuccessor":"Add successor","gantt.menu.addPredecessor":"Add predecessor","gantt.menu.toMilestone":"Convert to milestone","gantt.menu.toTask":"Convert to task","gantt.menu.delete":"Delete task","gantt.a11y.linkCycle":"Linking {from} to {to} would create a cycle; link not created.","gantt.a11y.linkCreated":"{from} linked to {to}, {type}.","gantt.a11y.linkDeleted":"Link from {from} to {to} deleted.","gantt.a11y.linkLabel":"Link, {from} to {to}, {type}","gantt.linkEditor.title":"Edit link from {from} to {to}","gantt.linkEditor.type":"Link type","gantt.linkEditor.lag":"Lag, in days","gantt.linkEditor.apply":"Apply","gantt.linkEditor.delete":"Delete link","gantt.linkEditor.cancel":"Cancel","gantt.a11y.undone":"Undone.","gantt.a11y.redone":"Redone.","gantt.a11y.nothingToUndo":"Nothing to undo.","gantt.a11y.nothingToRedo":"Nothing to redo.","gantt.workload.title":"Resource workload","gantt.workload.resource":"Resource","gantt.workload.total":"Total","gantt.workload.unassigned":"Unassigned","gantt.workload.ungrouped":"No group","gantt.workload.cell":"{hours} h from {date}","gantt.workload.over":"{hours} h from {date}, over a capacity of {capacity} h","gantt.workload.expand":"Show {name}’s tasks","gantt.workload.collapse":"Hide {name}’s tasks","gantt.workload.expandGroup":"Show the {name} group","gantt.workload.collapseGroup":"Hide the {name} group","gantt.workload.unitToggle":"Hours / % / Cost","gantt.workload.unitHours":"Showing hours","gantt.workload.unitPercent":"Showing percent of capacity","gantt.workload.unitCost":"Showing cost","gantt.workload.cellPercent":"{percent}% from {date}","gantt.workload.overPercent":"{percent}% from {date}, over capacity","gantt.workload.cellNoCapacity":"No available hours from {date}","gantt.workload.cellCost":"{cost} from {date}","gantt.workload.otherProjectLabel":"{name} (other project)","gantt.workload.external":"External booking","gantt.a11y.hoursSet":"{name}: {hours} h from {date}","gantt.a11y.hoursCleared":"{name}: no hours from {date}","gantt.a11y.hoursRefused":"{date} is not a working day; {name} was not changed.","gantt.histogram.title":"Resource histogram","gantt.histogram.tableTitle":"Resource histogram data","gantt.histogram.resource":"Resource","gantt.histogram.period":"Period","gantt.histogram.hours":"Hours","gantt.histogram.percent":"Percent of capacity","gantt.histogram.cost":"Cost","gantt.histogram.capacity":"Capacity","gantt.histogram.overAllocated":"Over-allocated","gantt.histogram.yes":"Yes","gantt.histogram.no":"No","gantt.histogram.tip":"{name}, {from} to {to}: {value}{capacity}{tasks}","gantt.histogram.tipHours":"{hours} h","gantt.histogram.tipPercent":"{percent}% of capacity","gantt.histogram.tipCost":"{cost}","gantt.histogram.tipCapacity":", capacity {hours} h","gantt.histogram.tipTasks":" ({tasks})","gantt.histogram.tipOver":", over capacity","gantt.histogram.tipNoCapacity":"no available hours","gantt.picker.title":"Assign resources to {name}","gantt.picker.open":"Edit assignments for {name}","gantt.picker.search":"Search resources","gantt.picker.list":"Resources","gantt.picker.selected":"Assigned resources","gantt.picker.load":"{load}% booked of {capacity}% over these dates","gantt.picker.none":"No matching resources","gantt.picker.units":"{name}, units in percent","gantt.picker.remove":"Remove {name}","gantt.picker.apply":"Apply","gantt.picker.cancel":"Cancel","gantt.picker.warn":"{name} would be over-allocated: {load}% booked of {capacity}%","gantt.picker.ok":"No resource would be over-allocated","gantt.picker.assign":"Assign","gantt.col.effort":"Effort","gantt.col.units":"Units","gantt.unscheduled":"Unscheduled","gantt.col.unscheduled":"Unscheduled","gantt.inactive":"Inactive","gantt.col.inactive":"Inactive","gantt.col.slack":"Slack","gantt.col.deadline":"Deadline","gantt.col.constraint":"Constraint","gantt.col.constraintDate":"Constraint date","gantt.col.earlyStart":"Early start","gantt.col.lateStart":"Late start","gantt.col.lateFinish":"Late finish","gantt.col.baselineStart":"Baseline start","gantt.col.baselineEnd":"Baseline finish","gantt.col.variance":"Variance","gantt.col.note":"Note","gantt.col.sequence":"#","gantt.col.predecessors":"Predecessors","gantt.col.successors":"Successors","gantt.link.invalid":"Cannot read “{token}” as a link. Write a task number, a type and a lag, like 3FS+2; links not changed.","gantt.link.unknownRef":"No task is numbered “{token}”; links not changed.","gantt.link.self":"“{token}” links a task to itself; links not changed.","gantt.link.duplicate":"“{token}” repeats a link already listed; links not changed.","gantt.link.cycle":"“{token}” would create a cycle; links not changed.","gantt.constraint.ASAP":"As soon as possible","gantt.constraint.MSO":"Must start on","gantt.constraint.MFO":"Must finish on","gantt.constraint.ALAP":"As late as possible","gantt.constraint.SNET":"Start no earlier than","gantt.constraint.SNLT":"Start no later than","gantt.constraint.FNET":"Finish no earlier than","gantt.constraint.FNLT":"Finish no later than","gantt.row.ancestor":"Shown because a task inside it matches the filter","gantt.progress.handle":"Drag to set the progress of {name}","gantt.a11y.progress":"{name} {percent}% complete","gantt.col.name":"Task name","gantt.col.start":"Start","gantt.col.end":"Finish","gantt.col.duration":"Duration","gantt.col.assignee":"Assignee","gantt.col.progress":"%","gantt.col.wbs":"WBS","gantt.zoom.label":"Zoom","gantt.zoom.day":"Day","gantt.zoom.week":"Week","gantt.zoom.month":"Month","gantt.zoom.quarter":"Quarter","gantt.zoom.fit":"Fit to plan","gantt.tip.range":"{from} to {to}","gantt.tip.duration":"{days}d","gantt.tip.slack":"slack {days}d","gantt.tip.effort":"{hours}h","gantt.tip.row":"{label}: {value}","gantt.tip.start":"Start","gantt.tip.end":"End","gantt.tip.date":"Date","gantt.tip.durationLabel":"Duration","gantt.tip.durationValue":"{days} days","gantt.tip.complete":"Complete","gantt.tip.effortLabel":"Effort","gantt.tip.effortValue":"{hours} h","gantt.tip.assigned":"Assigned","gantt.tip.cost":"Cost","gantt.tip.slackLabel":"Slack","gantt.tip.slackValue":"{days} days","gantt.tip.deadline":"Deadline","gantt.mode.fixedDuration":"Fixed duration","gantt.mode.fixedEffort":"Fixed effort","gantt.mode.fixedUnits":"Fixed units","gantt.scurve.spi":"SPI {index}","gantt.scurve.cpi":"CPI {index}","gantt.print.page":"Page {page} of {pages}","gantt.print.printed":"Printed {date}","gantt.dataBand.title":"Data band","gantt.dataBand.name":"Task","gantt.dataBand.resource":"Resource","gantt.dataBand.total":"Total","gantt.dataBand.unassigned":"Unassigned","gantt.dataBand.collapse":"Collapse {name}","gantt.dataBand.expand":"Expand {name}","gantt.dataBand.cell":"{name}, {date}: {value}","gantt.issues.title":"Scheduling conflicts","gantt.issues.empty":"No scheduling conflicts","gantt.issues.count":"{count} scheduling conflicts","gantt.issues.toggle":"Toggle the conflicts panel","gantt.issues.cycle":"Circular dependency: {tasks}","gantt.issues.constraint":"{task} cannot meet its {constraint} constraint of {date}","gantt.issues.lock":"{task} is locked but a dependency would move it","gantt.issues.deadline":"{task} finishes after its deadline of {date}","gantt.issues.fixRemoveLink":"Remove link","gantt.issues.fixAsap":"Set as soon as possible","gantt.issues.fixUnlock":"Unlock task","gantt.issues.fixClearDeadline":"Clear deadline","gantt.resize.startHandle":"Drag to change the start of {name}","gantt.a11y.resizedStart":"{name} start moved to {date}, now {days} days","gantt.a11y.startEdge":"Start edge can be resized: drag the left edge, or press Ctrl+Shift+Left or Right.","gantt.a11y.chain":"Dependency chain highlighted: {preds} predecessors, {succs} successors.","timeline.scrub":"Scrub through recent changes","timeline.goLive":"Go live","timeline.returnToPresent":"Return to the present","a11y.fillHandle":"Drag to fill","panel.icons":"Icons","value.tooLong":"Too long","dataview.label":"Items","dataview.empty":"No items","dataview.reorder.sorted":"Items cannot be reordered while the view is sorted","dataview.reorder.filtered":"Items cannot be reordered while a filter is applied","shortcuts.title":"Keyboard shortcuts","shortcuts.close":"Close keyboard shortcuts","shortcuts.hint":"Press Escape to close.","shortcuts.or":"or","a11y.reorder.moved":"Moved to position {position} of {total}","a11y.reorder.sorted":"Rows cannot be reordered while the grid is sorted","a11y.reorder.filtered":"Rows cannot be reordered while a filter is applied","a11y.reorder.grouped":"Rows cannot be reordered while the grid is grouped","a11y.reorder.grab":"Reorder row","a11y.reorder.sortedManual":"Rows cannot be reordered while the grid is sorted. Press Alt+Shift+M, or the Manual order button in the heading, to order them by hand","a11y.reorder.groupDerived":"The row cannot join that group: the group is worked out from the value, so there is no single value to give it","a11y.reorder.groupReadOnly":"The row cannot join that group: its grouping value cannot be edited","a11y.reorder.invalid":"The row cannot join that group: the new value was not valid","a11y.reorder.vetoed":"The move was declined; the row stays where it was","a11y.reorder.vetoedBecause":"The move was declined ({reason}); the row stays where it was","a11y.reorder.refused":"The row cannot be moved there","a11y.reorder.regrouped":"Moved into {group}","a11y.tree.dropRefusedDescendant":"A row cannot be dropped into one of its own descendants; the row stays where it was","a11y.rowOrder.entered":"Manual order: the rows keep their places and can be moved by hand","a11y.rowOrder.exited":"Manual order ended; the rows follow the sort","rowOrder.button":"Manual order","rowOrder.enter":"Order the rows by hand instead of by the sort","rowOrder.exit":"Return to the sorted order","a11y.transfer.moved":"Row moved to the other grid","a11y.transfer.copied":"Row copied to the other grid","a11y.transfer.refused":"That grid does not accept this row","a11y.transfer.declined":"The drop was declined; the row stays where it was","a11y.transfer.stale":"The drop target changed while it was being confirmed; the row stays where it was","shortcuts.group.grid":"In the data","shortcuts.group.header":"On a column heading","shortcuts.group.panel":"In the column list","shortcut.moveCell":"Move the focused cell","shortcut.rowEnds":"First / last cell of the row","shortcut.gridEnds":"First cell of the first row / last cell of the last row","shortcut.pageRows":"Move one viewport of rows","shortcut.nextCell":"Leave the grid for the next / previous focusable element (arrows move between cells)","shortcut.undo":"Undo the last edit, paste, fill or clear","shortcut.redo":"Redo the step that was undone","shortcut.startEdit":"Start editing the focused cell","shortcut.toggleRow":"Toggle selection of the focused row","shortcut.cancel":"Cancel the current edit or drag","shortcut.expandCollapse":"Expand / collapse a group or tree row","shortcut.focusHeader":"Move focus to the column header","shortcut.focusPanel":"Move focus to the tool panel","shortcut.explain":"Explain the focused column","shortcut.contextMenu":"Open the context menu for the focused cell","shortcut.moveRow":"Move the focused row, when row reorder is enabled","shortcut.manualOrder":"Order the rows by hand, or return to the sort, when row reorder allows a manual order","shortcut.headingMove":"Move between headings","shortcut.headingEnds":"First / last heading","shortcut.headingSort":"Sort by the column, Shift to add to the sort","shortcut.headingResize":"Resize the column, Ctrl for a coarse step","shortcut.headingAutosize":"Size the column to its content","shortcut.headingReorder":"Move the column","shortcut.headingMenu":"Open the column menu","shortcut.headingExit":"Return focus to the data","shortcut.listGroup":"Group by the column, or stop grouping by it","shortcut.listValues":"Add the column to values, or take it out","shortcut.listPivot":"Pivot by the column, or stop pivoting by it","shortcut.listMove":"Move the column","shortcut.find":"Find in the grid","tags.label":"Show columns","tags.all":"All columns","tags.showing":"Showing {tag}","form.title":"Edit row","form.save":"Save","form.cancel":"Cancel","form.loading":"Loading…","form.loadFailed":"Could not load this record.","form.loadTimeout":"The record did not arrive in time.","form.retry":"Try again","form.choose":"Choose…","form.newTitle":"New row","form.createFailed":"Could not add this record.","form.grid.cellInvalid":"Row {row}, {column}: {message}","form.grid.required":"Add at least one row.","form.grid.addRow":"Add row","form.grid.deleteRow":"Delete row","form.grid.total":"Total","form.grid.rowControls":"Row controls","presentation.cards":"Showing records as cards","presentation.table":"Showing records as a table","editor.format":"Format","editor.codeHint":"Tab indents · Esc cancels · Ctrl+Enter saves","editor.colours":"Colours","editor.customColour":"Custom colour","editor.hexValue":"Hex value","editor.hexPlaceholder":"#rrggbb","editor.clearColour":"Clear colour","editor.time":"Time","editor.noIcon":"No icon","editor.selectAll":"Select all","editor.passwordHint":"Enter the value twice to save it.","editor.clearRating":"Clear rating","editor.clear":"Clear","editor.value":"Value","editor.currency":"Currency","editor.richtext.formatting":"Formatting","editor.richtext.richText":"Rich text","editor.richtext.placeholder":"Start writing…","editor.richtext.linkLabel":"Link address","editor.richtext.linkPlaceholder":"https://","editor.richtext.linkAdd":"Add link","editor.richtext.bold":"Bold (Ctrl+B)","editor.richtext.italic":"Italic (Ctrl+I)","editor.richtext.underline":"Underline (Ctrl+U)","editor.richtext.strike":"Strikethrough","editor.richtext.heading":"Paragraph style","editor.richtext.alignLeft":"Align left","editor.richtext.alignCenter":"Align centre","editor.richtext.alignRight":"Align right","editor.richtext.ul":"Bulleted list","editor.richtext.ol":"Numbered list","editor.richtext.color":"Text colour","editor.richtext.link":"Link (Ctrl+K)","editor.richtext.image":"Insert image","editor.richtext.clear":"Clear formatting","editor.richtext.source":"HTML source","editor.richtext.undo":"Undo (Ctrl+Z)","editor.richtext.redo":"Redo (Ctrl+Y)","formatting.format":"Format","formatting.noRules":"No rules yet. The first one that matches a cell wins.","formatting.clearAll":"Clear all","formatting.addRule":"Add rule","formatting.condition":"Condition","formatting.value":"Value","formatting.secondValue":"Second value","formatting.moveEarlier":"Move earlier","formatting.moveLater":"Move later","formatting.ruleKind":"Rule type","formatting.aCondition":"A condition","formatting.aColourScale":"A colour scale","formatting.compare":"Compare a value","formatting.distribution":"By the distribution","formatting.colourScale":"Colour scale","formatting.scaleBounds":"Scale bounds","formatting.preview":"Preview","formatting.livePreview":"Live preview","history.title":"History","history.show":"Show history","history.empty":"Nothing to undo yet.","prompt.ask":"Ask","prompt.apply":"Apply","prompt.discard":"Discard","panel.searchColumns":"Search columns","panel.searchColumnsPlaceholder":"Search columns…","panel.searchColumnsToFilter":"Search columns to filter","panel.showAll":"Show all","panel.hideAll":"Hide all","panel.clearAll":"Clear all","panel.clear":"Clear","panel.filterAllColumns":"Filter all columns","panel.columnFiltered":"This column is filtered","panel.clearFilterOn":"Clear the filter on {column}","panel.clearFilter":"Clear this filter","panel.filterEmptyNoMatch":"No column matches “{query}”.","panel.filterEmptyNone":"No column on this grid can be filtered.","panel.filterSummaryActive":"{active} of {total} columns filtered","panel.filterSummaryNone":"No filters · {total} columns available","panel.filterBy":"Filter by {column}","panel.filteredBy":"Filtered by {column}","panel.columnDragHint":"Drag {column} into a zone above, or onto another column to reorder","panel.gridActions":"Grid actions","panel.tabActiveCount":{one:"{title}, {count} active",other:"{title}, {count} active"},"panel.tabActive":"{title}, active","views.default":"Default","views.namePlaceholder":"Name this view…","views.nameLabel":"Name for the current layout","views.save":"Save view","licence.watermark":K,"licence.watermark.free":E,"filter.op.contains":"Contains","filter.op.notContains":"Does not contain","filter.op.equals":"Equals","filter.op.notEqual":"Does not equal","filter.op.startsWith":"Starts with","filter.op.endsWith":"Ends with","filter.op.blank":"Is blank","filter.op.notBlank":"Is not blank","filter.op.lessThan":"Less than","filter.op.lessThanOrEqual":"Less than or equal","filter.op.greaterThan":"Greater than","filter.op.greaterThanOrEqual":"Greater than or equal","filter.op.inRange":"In range","filter.op.matches":"Matches","filter.op.before":"Before","filter.op.after":"After","filter.op.relative":"Relative to today","filter.rel.today":"Today","filter.rel.yesterday":"Yesterday","filter.rel.tomorrow":"Tomorrow","filter.rel.lastNDays":"Last N days","filter.rel.nextNDays":"Next N days","filter.rel.thisWeek":"This week","filter.rel.lastWeek":"Last week","filter.rel.thisMonth":"This month","filter.rel.lastMonth":"Last month","filter.rel.thisQuarter":"This quarter","filter.rel.quarterToDate":"Quarter to date","filter.rel.thisYear":"This year","filter.rel.yearToDate":"Year to date","filter.operator":"Operator","filter.join":"Join","filter.value":"Value","filter.from":"From","filter.to":"To","filter.addCondition":"Add condition","filter.noConditions":"No conditions","filter.removeCondition":"Remove condition","filter.search":"Search","filter.searchValues":"Search values","filter.noMatches":"No values match","filter.selectAll":"Select all","filter.clear":"Clear","filter.all":"All","filter.allExcept":"All but {count}","filter.loadingValues":"Loading values…","filter.topValues":"Top {shown} of {total} values","filter.valuesFailed":"Values could not be loaded: {error}","filter.valuesUnsupported":"This source cannot list the values of {column}; filter by condition instead.","filter.true":"True","filter.false":"False","filter.expression":"Filter expression","filter.column":"Column","filter.relativePeriod":"Relative period","filter.days":"Number of days","filter.tab.set":"Values","filter.tab.text":"Text","filter.tab.number":"Number","filter.tab.date":"Date","filter.tab.advanced":"Advanced","filterRow.label":"Filter row","filterRow.conditions":{one:"{count} condition",other:"{count} conditions"},"chart.empty":"Nothing to chart","chart.summary":"{type} chart of {measure} by {dimension}","chart.summaryShare":"{type} chart of {measure}","chart.summaryType":"{type} chart","chart.summaryGauge":"{type} chart of {measure}, {fn}: {value}","chart.waterfallTotal":"Total","chart.summaryEngine":"Figures computed by the data engine over every matching row","chart.summaryEngineViewport":"{count} points in this view, fetched from the data engine","chart.summaryEngineDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells counted by the data engine","chart.summaryClientDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells computed in the browser","chart.viewportOverCap":"{count} rows in this view, more than the {cap} this map draws; zoom in or narrow the filter","chart.dataTable":"Chart data","chart.viewportFilter.label":"Map view","chart.annotate.rail":"Drawing tools","chart.annotate.select":"Select and move a drawing","chart.annotate.trendLine":"Trend line","chart.annotate.horizontalLine":"Horizontal line","chart.annotate.verticalLine":"Vertical line","chart.annotate.channel":"Parallel channel","chart.annotate.fibonacci":"Fibonacci retracement","chart.annotate.arrow":"Arrow","chart.annotate.pen":"Freehand pen","chart.annotate.pen.described":"Freehand drawing from {from} to {to}","chart.annotate.measure-x":"Date range","chart.annotate.measure-y":"Price range","chart.annotate.measure-xy":"Date and price range","chart.annotate.measure.bars":{one:"{count} bar",other:"{count} bars"},"chart.annotate.measure.points":{one:"{count} point",other:"{count} points"},"chart.annotate.measure.volume":"Vol {value}","chart.annotate.measure.seconds":"{count}s","chart.annotate.measure.minutes":"{count}m","chart.annotate.measure.hours":"{count}h","chart.annotate.measure.days":"{count}d","chart.annotate.measure.weeks":"{count}w","chart.annotate.measure.months":"{count}mo","chart.annotate.measure.years":"{count}y","chart.annotate.measure":"Measure","chart.annotate.measure.dx":"Δx {value}","chart.annotate.measure.dy":"Δy {value}","chart.annotate.measure.pct":"{value}%","chart.annotate.measure.categories":{one:"{count} category",other:"{count} categories"},"chart.annotate.measure.slope.perDay":"Slope {value} per day","chart.annotate.measure.slope.perCategory":"Slope {value} per category","chart.annotate.measure.slope.perUnit":"Slope {value} per unit","chart.annotate.measure.dur.d":"{count} d","chart.annotate.measure.dur.h":"{count} h","chart.annotate.measure.dur.min":"{count} min","chart.annotate.measure.dur.s":"{count} s","chart.annotate.measure.dur.ms":"{count} ms","chart.annotate.measure.announce":"Measurement: {readout}","chart.annotate.measure.start":"Measure start: {x}, {y}","chart.annotate.text":"Text","chart.annotate.callout":"Callout","chart.annotate.note":"Note","chart.annotate.delete":"Delete the selected drawing","chart.annotate.editLabel":"Annotation text","chart.zoom.toolbar":"Zoom controls","chart.zoom.in":"Zoom in","chart.zoom.out":"Zoom out","chart.zoom.left":"Pan left","chart.zoom.right":"Pan right","chart.zoom.reset":"Reset the zoom","chart.legendMore":{one:"+{count} more",other:"+{count} more"},"chart.type.line":"Line","chart.type.area":"Area","chart.type.bar":"Bar","chart.type.pie":"Pie","chart.type.donut":"Donut","chart.type.sunburst":"Sunburst","chart.type.scatter":"Scatter","chart.type.step":"Step","chart.type.rangeArea":"Range","chart.type.horizontalBar":"Horizontal bar","chart.type.waterfall":"Waterfall","chart.type.floatingBar":"Floating bar","chart.type.horizontalFloatingBar":"Horizontal floating bar","chart.type.populationPyramid":"Population pyramid","chart.type.bullet":"Bullet","chart.type.bubble":"Bubble","chart.type.histogram":"Histogram","chart.type.boxplot":"Box plot","chart.type.forest":"Forest plot","chart.type.qq":"QQ plot","chart.type.ecdf":"ECDF","chart.type.lorenz":"Lorenz","chart.type.correlogram":"Correlogram","chart.type.control":"Control","chart.type.capability":"Capability","chart.type.movingRange":"Moving range","chart.type.treemap":"Treemap","chart.type.combo":"Combination","chart.type.pareto":"Pareto","chart.type.heatmap":"Heat map","chart.type.radar":"Radar","chart.type.gauge":"Gauge","chart.type.funnel":"Funnel","chart.type.candlestick":"Candlestick","chart.type.ohlc":"OHLC","chart.type.polarArea":"Polar area","chart.type.nightingale":"Nightingale rose","chart.type.rose":"Rose","chart.type.radialBar":"Radial bar","chart.type.polarScatter":"Polar scatter","chart.type.geomap":"Map","chart.type.sankey":"Sankey","chart.type.chord":"Chord","chart.type.pyramid":"Pyramid","chart.type.pictorial":"Pictorial","chart.type.serpentine":"Serpentine timeline","chart.type.spiral":"Spiral timeline","chart.edit.aggregated":"This value is a total of several rows, so it cannot be dragged.","chart.edit.refused":"That change was not applied.","chart.edit.refusedWhy":"That change was not applied: {reason}","chart.type.network":"Network","chart.type.stream":"Stream","chart.type.marimekko":"Marimekko","chart.type.violin":"Violin","chart.type.gantt":"Gantt","chart.type.forceTree":"Force-directed tree","chart.type.pack":"Packed circles","chart.type.tree":"Tree","chart.type.voronoiTreemap":"Voronoi treemap","chart.type.alluvial":"Alluvial","chart.type.arc":"Arc diagram","chart.type.barRace":"Bar chart race","chart.type.bubblemap":"Bubble map","chart.type.bump":"Bump chart","chart.type.calendar":"Calendar heat map","chart.type.choropleth":"Choropleth map","chart.type.decomposition":"Decomposition tree","chart.type.diverging":"Diverging bar","chart.type.dumbbell":"Dumbbell","chart.type.fan":"Fan chart","chart.type.hexbin":"Hexagonal bin","chart.type.hexmap":"Hex map","chart.type.icicle":"Icicle","chart.type.markermap":"Marker map","chart.type.motion":"Motion chart","chart.type.parallel":"Parallel coordinates","chart.type.ridgeline":"Ridgeline","chart.type.roc":"ROC curve","chart.type.scatter3d":"3D scatter","chart.type.slope":"Slope chart","chart.type.splom":"Scatter plot matrix","chart.type.venn":"Venn diagram","chart.type.waffle":"Waffle","chart.type.wordCloud":"Word cloud","chart.tasksDropped":{one:"{count} more task not shown",other:"{count} more tasks not shown"},"chart.geoUnmatched":{one:"{count} row could not be placed on the map",other:"{count} rows could not be placed on the map"},"chart.r2":"R² {value}","ai.insights":"Insights","ai.explainView":"Explain this view","ai.explain":"Explain","ai.ask":"Ask","ai.apply":"Apply","ai.discard":"Discard","ai.propose":"Propose","ai.approve":"Approve","ai.thinking":"Thinking…","ai.applying":"Applying…","ai.applied":"Applied: {what}","ai.couldNotApply":"Could not apply: {why}","ai.applyFailed":"it failed","ai.discarded":"Discarded.","ai.discardedNothingWritten":"Discarded. Nothing was written.","ai.nothingWritten":"Nothing was written.","ai.nothingWrittenVetoed":"Nothing was written — a before-handler vetoed it.","ai.scope":"Scope: {scope}","ai.unsafeQuery":"I could not turn that into a safe query: {why}","ai.nothingToDo":"nothing to do","ai.insightsFailed":"Could not generate insights right now. The grid is unaffected.","ai.modelUnreachable":"Could not reach the model right now. The grid is unaffected.","ai.flagged":{one:"{count} unverified figure was removed as ungrounded.",other:"{count} unverified figures were removed as ungrounded."},"ai.askPlaceholder":"Ask your data: “EMEA deals over 50k, biggest first”","ai.askLabel":"Ask your data","ai.actorPlaceholder":"Ask AI to change data: “set the Network Upgrade project to In Progress”","ai.actorLabel":"Ask AI to change data","editor.password.show":"Show value","editor.password.hide":"Hide value","editor.password.showField":"Show {column}","editor.password.hideField":"Hide {column}","facets.computing":"Computing…","facets.suppressed.cardinality":"Too many distinct values to chart","facets.suppressed.rows":"Too many rows to chart","facets.suppressed.streaming":"Paused while live data is streaming","facets.suppressed.noProvider":"No distribution available for this data source","facets.suppressed.type":"This column has no chartable distribution","facets.bucketOf":"{count} of {whole} rows","history.undo":"Undo","history.redo":"Redo","history.described":"{action} {label}","history.nothingToUndo":"Nothing to undo","history.nothingToRedo":"Nothing to redo","history.undoDisabled":"Undo (nothing to undo)","history.redoDisabled":"Redo (nothing to redo)","a11y.presence.joined":"{name} joined","a11y.presence.left":"{name} left","prompt.asking":"Asking…","prompt.moreNotes":{one:"and {count} more",other:"and {count} more"},"shortcuts.key.cmd":"Cmd","timeline.live":"Live","timeline.recording":"recording…","panel.zoneHint.group":"Drag a column here to group rows by its values","panel.zoneHint.values":"Drag a column here to total it","panel.zoneHint.pivot":"Drag a column here to pivot across its values","panel.zoneHint.any":"Drag a column here","panel.rowsOf":"{shown} of {total} rows","views.empty":"No saved views yet. Set the grid up as you want it, then save it below.","views.applied":"Applied","views.matchesGrid":"Matches the grid as it is","views.delete":"Delete","views.confirmDelete":"Delete {name}?","views.confirmDeleteLabel":"Confirm deleting {name}","views.shared":"View copied to the clipboard","views.sharedDownload":"Clipboard unavailable; the view was downloaded as {name}","views.sharedFailed":"The view could not be copied or downloaded","views.rename":"Rename","views.ownedBy":"Owned by {name}","views.ownerOnlyReason":"Only {name} or an admin can do that","views.noOwnerReason":"Only an admin can do that — this view has no recorded owner","views.unshare":"Unshare","views.unshareTitle":"Stop sharing {name}","views.duplicate":"Duplicate","views.duplicateTitle":"Duplicate {name}","views.copyName":"{name} (copy)","gantt.row.expand":"Expand {name}","gantt.row.collapse":"Collapse {name}","gantt.resource.over":"{name} — over-allocated","kanban.board":"Board","kanban.requiredTitle":"Required fields","kanban.requiredSave":"Save","kanban.requiredCancel":"Cancel","kanban.moveRefused":'Move refused: a card in "{from}" cannot move to "{to}".',"kpi.status.good":"good","kpi.status.warn":"warn","kpi.status.critical":"critical","kpi.status.unknown":"No data","kpi.node.item":"{count} item","kpi.node.items":"{count} items","kpi.node.worst":"worst status {status}","kpi.node.unknown":"{count} unknown","sidebar.nav":"Main navigation","sidebar.search":"Search","sidebar.collapse":"Collapse sidebar","sidebar.expand":"Expand sidebar","toolbar.more":"More"}),D=Object.freeze(Object.keys(U))}),ze("packages/core/src/i18n/format.js",function(e,_){"use strict";Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"formatMessage",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return k}});const E=_("packages/core/src/internal/predicates.js").isFunction,K=/\{(\w+)\}/g,U=new Map,D=new Map;function J(y){const l=y||"";if(U.has(l))return U.get(l);let g=null;try{g=new Intl.PluralRules(y||void 0)}catch{g=null}return U.set(l,g),g}function z(y,l,g="conjunction"){const s=Array.isArray(y)?y.filter(c=>c!=null&&c!==""):[];if(s.length===0)return"";if(s.length===1)return String(s[0]);const t=`${l||""}|${g}`;let o=D.get(t);if(o===void 0){try{o=new Intl.ListFormat(l||void 0,{style:"long",type:g})}catch{o=null}D.set(t,o)}return o?o.format(s.map(String)):s.map(String).join(", ")}function L(y,l){return y==null?"":typeof y=="number"?Number.isFinite(y)?y.toLocaleString(l||void 0,{maximumFractionDigits:20}):"":String(y)}function X(y,l,g){if(typeof y=="string")return y;if(!y||typeof y!="object")return"";const s=l&&typeof l.count=="number"?l.count:null;if(s===null)return y.other??"";const t=J(g),o=t?t.select(s):s===1?"one":"other";return y[o]??y.other??""}function I(y,l={},g){const s=X(y,l,g);return s?s.replace(K,(t,o)=>Object.prototype.hasOwnProperty.call(l,o)?L(l[o],g):t):""}function j(y,l,g="en-GB"){return typeof y=="string"&&y?y:typeof l=="string"&&l?l:g}function k(y,l){const g=y?y[l]:void 0;return g==null||E(g)?l:g}}),ze("packages/core/src/i18n/registry.js",function(e,_){"use strict";Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"localeCatalogue",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return J}});const E=_("packages/core/src/i18n/catalogue.js").EN_GB,K=new Map([["en-gb",E]]);function U(z,L){const X=typeof z=="string"?z.toLowerCase():"";return!X||!L||typeof L!="object"?!1:(K.set(X,L),!0)}function D(z){if(typeof z!="string"||!z)return null;const L=z.toLowerCase(),X=K.get(L);if(X)return X;const I=L.split("-")[0],j=K.get(I);if(j)return j;for(const[k,y]of K)if(k.split("-")[0]===I)return y;return null}function J(){return[...K.keys()]}}),ze("packages/core/src/i18n/index.js",function(e,_){"use strict";Object.defineProperty(e,"DEFAULT_LOCALE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"Messages",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"defaultMessages",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return d}});const ne=_("packages/core/src/i18n/catalogue.js"),E=ne.EN_GB,K=ne.MESSAGE_KEYS,U=_("packages/core/src/i18n/format.js"),D=U.formatMessage,J=U.formatList,z=U.lookup,L=U.resolveLocale,I=_("packages/core/src/internal/predicates.js").isFunction,k=_("packages/core/src/internal/warn.js").warnOnce,y=_("packages/core/src/i18n/registry.js"),l=y.registerLocale,g=y.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 U.formatList}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return U.resolveLocale}}),Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return y.registerLocale}});const s="en-GB";class t{#e=s;#t=E;constructor(p={}){this.configure(p)}configure(p={}){this.#e=L(p.locale,p.declared,s);const i=p.messages,r=g(this.#e);if(!r&&this.#e.toLowerCase()!=="en-gb"&&(!i||typeof i!="object")&&k(`i18n:locale:not-loaded:${this.#e.toLowerCase()}`,`locale "${this.#e}" is not loaded: import "@toclocoinc/lattice-grid/locales/${this.#e}" to add its text; English is used until then.`),!i||typeof i!="object"){this.#t=r?{...E,...r}:E;return}const m=Object.keys(i).filter(u=>!(u in E));m.length&&k(`i18n:unknown:${m[0]}`,`message keys not in the catalogue and so ignored: ${m.slice(0,5).join(", ")}${m.length>5?`, and ${m.length-5} more`:""}`),this.#t={...E,...r||{},...i}}get locale(){return this.#e}t(p,i){return D(z(this.#t,p),i||{},this.#e)}list(p,i){return J(p,this.#e,i)}number(p,i){const r=Number(p);return Number.isFinite(r)?r.toLocaleString(this.#e,i||{maximumFractionDigits:20}):""}}const o=new t;function c(n){return n instanceof t?n:new t(n||{})}function d(n){const p=n&&typeof n=="object"?n:{},i=K.filter(f=>{const m=p[f];return m==null||m===""||I(m)}),r=Object.keys(p).filter(f=>!(f in E));return{missing:i,unknown:r}}}),ze("packages/core/src/columns/types/structured.js",function(e,_){"use strict";Object.defineProperty(e,"MASK_DEFAULTS",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"parseJsonText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});const ne=_("packages/core/src/internal/predicates.js"),E=ne.isNil,K=ne.isObject,D=_("packages/core/src/i18n/index.js").defaultMessages,J=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function z(t,o){const c=o||{},d=c.emptyDisplay??J.emptyDisplay;if(E(t)||t==="")return d;const p=[...typeof c.char=="string"&&c.char!==""?c.char:J.char][0]||J.char,i=c.fixedLength??J.fixedLength,r=Number.isFinite(c.length)&&Number(c.length)>0?Math.floor(Number(c.length)):J.length,f=typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):null;let m=0;if(f!==null){const u=Number.isFinite(c.lastVisible)?Math.floor(Number(c.lastVisible)):J.lastVisible,b=[...f];if(m=u>0&&u<b.length?u:0,m>0){const a=b.slice(b.length-m).join(""),h=Math.max(1,(i?r:b.length)-m);return p.repeat(h)+a}return p.repeat(i?r:Math.max(1,b.length))}return p.repeat(r)}const L=48;function X(t){try{const o=JSON.stringify(t);return o===void 0?null:o}catch{return null}}function I(t,o){if(E(t))return"";const c=Number.isFinite(o&&o.inlineLimit)?Number(o.inlineLimit):L;if(typeof t=="string")return t.length>c?`${t.slice(0,c-1)}…`:t;if(typeof t!="object")return String(t);const d=X(t);if(d!==null&&d.length<=c)return d;if(Array.isArray(t)){const p=t.length;return`[${D.t("count.items",{count:p})}]`}const n=Object.keys(t).length;return`{${D.t("count.keys",{count:n})}}`}function j(t,o){if(t==null)return"null";const c=typeof t;if(c==="number"||c==="boolean"||c==="bigint")return String(t);if(c==="string")return JSON.stringify(t);if(c!=="object")return JSON.stringify(String(t));const d=o||new WeakSet;return d.has(t)?'"[circular]"':(d.add(t),t instanceof Date?JSON.stringify(t.toISOString()):Array.isArray(t)?`[${t.map(i=>j(i,d)).join(",")}]`:`{${Object.keys(t).sort().map(i=>`${JSON.stringify(i)}:${j(t[i],d)}`).join(",")}}`)}function k(t,o){if(E(t))return E(o)?0:1;if(E(o))return-1;const c=j(t),d=j(o);return c<d?-1:c>d?1:0}function y(t){if(E(t))return null;const o=String(t);if(o.trim()==="")return null;try{return JSON.parse(o)}catch{return o}}function l(t){const o=t&&t.cell&&t.cell.props;return K(o)?o:{}}const g=Object.freeze({json:{base:"object",storage:"object",format:t=>I(t&&t.value,l(t&&t.column)),parse:t=>y(t&&t.text),compare:k,defaults:{editor:"code",filter:"text",align:"start"},excel:"@",toClipboard:t=>{if(E(t))return"";if(typeof t=="string")return t;try{const o=JSON.stringify(t,null,2);return o===void 0?String(t):o}catch{return String(t)}},fromClipboard:t=>y(t)},secret:{base:"text",storage:"object",format:t=>z(t&&t.value,l(t&&t.column)),parse:t=>{const o=t&&t.text;return E(o)||String(o)===""?null:String(o)},compare:(t,o)=>{const c=E(t)||t==="",d=E(o)||o==="";return c===d?0:c?1:-1},defaults:{editor:"password",filter:"none",align:"start"},excel:"@",export:{csv:!1,excel:!1},toClipboard:t=>z(t),fromClipboard:t=>E(t)||String(t)===""?null:String(t)}}),s=g}),ze("packages/core/src/columns/types/unit.js",function(e,_){"use strict";Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return C}});const E=_("packages/core/src/internal/predicates.js").isNil,U=_("packages/core/src/internal/warn.js").warnOnce;function D(B,x,V,Y){return Object.freeze({symbol:B,factor:x,aliases:Object.freeze(V||[]),binary:!!(Y&&Y.binary),prefix:Y&&Y.prefix||null,auto:!(Y&&Y.auto===!1)})}function J(B,x,V,Y){return D(B,x,V,Y)}const z=Object.freeze({data:Object.freeze([D("B",1,["byte","bytes"]),D("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),D("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),D("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),D("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),D("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),D("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),D("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),D("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),D("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([D("bps",1,["bit","bits","bit/s","b/s"]),D("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),D("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),D("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),D("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([D("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),D("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),D("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),D("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),D("in",.0254,["inch","inches"],{auto:!1}),D("ft",.3048,["foot","feet"],{auto:!1}),D("yd",.9144,["yard","yards"],{auto:!1}),D("m",1,["metre","metres","meter","meters"]),D("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),D("mi",1609.344,["mile","miles"],{auto:!1}),D("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([D("mg",.001,["milligram","milligrams"]),D("g",1,["gram","grams"]),D("oz",28.349523125,["ounce","ounces"],{auto:!1}),D("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),D("kg",1e3,["kilogram","kilograms"]),D("st",6350.29318,["stone"],{auto:!1}),D("t",1e6,["tonne","tonnes","ton"],{auto:!1}),D("ton (US)",907184.74,["ton","shortton"],{auto:!1}),D("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([D("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),D("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),D("ms",.001,["msec","msecs","millisecond","milliseconds"]),D("s",1,["sec","secs","second","seconds"]),D("m",60,["min","mins","minute","minutes"]),D("h",3600,["hr","hrs","hour","hours"]),D("d",86400,["day","days"])]),speed:Object.freeze([D("mm/s",.001,["millimetre/s","millimeter/s"]),D("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),D("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),D("mph",.44704,["mile/h","miles/h"],{auto:!1}),D("kn",1852/3600,["knot","knots"],{auto:!1}),D("m/s",1,["metre/s","meter/s","mps"]),D("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([D("mm/s²",.001,["mm/s2"]),D("ft/s²",.3048,["ft/s2"],{auto:!1}),D("m/s²",1,["m/s2","metre/s2","meter/s2"]),D("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([D("mm²",1e-6,["mm2"]),D("cm²",1e-4,["cm2"]),D("in²",64516e-8,["in2","sqin"],{auto:!1}),D("ft²",.09290304,["ft2","sqft"],{auto:!1}),D("yd²",.83612736,["yd2","sqyd"],{auto:!1}),D("m²",1,["m2","sqm"]),D("ha",1e4,["hectare","hectares"],{auto:!1}),D("ac",4046.8564224,["acre","acres"],{auto:!1}),D("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([D("µL",1e-6,["ul","microlitre","microliter"]),D("mL",.001,["millilitre","milliliter"]),D("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),D("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),D("L",1,["litre","litres","liter","liters"]),D("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),D("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),D("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),D("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([D("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),D("J",1,["joule","joules"]),D("cal",4.184,["calorie","calories"],{auto:!1}),D("kJ",1e3,["kilojoule","kilojoules"]),D("BTU",1055.05585262,["btu"],{auto:!1}),D("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),D("MJ",1e6,["megajoule","megajoules"]),D("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),D("GJ",1e9,["gigajoule","gigajoules"]),D("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([D("mW",.001,["milliwatt","milliwatts"]),D("W",1,["watt","watts"]),D("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),D("kW",1e3,["kilowatt","kilowatts"]),D("hp",745.6998715822702,["horsepower"],{auto:!1}),D("MW",1e6,["megawatt","megawatts"]),D("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([D("mN",.001,["millinewton","millinewtons"]),D("N",1,["newton","newtons"]),D("lbf",4.4482216152605,["poundforce"],{auto:!1}),D("kgf",9.80665,["kilogramforce"],{auto:!1}),D("kN",1e3,["kilonewton","kilonewtons"]),D("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([D("Pa",1,["pascal","pascals"]),D("mbar",100,["millibar"],{auto:!1}),D("inH₂O",249.0889,["inh2o"],{auto:!1}),D("mmHg",133.322387415,["torr"],{auto:!1}),D("kPa",1e3,["kilopascal","kilopascals"]),D("inHg",3386.388640341,["inhg"],{auto:!1}),D("psi",6894.757293168361,["lbf/in2"],{auto:!1}),D("bar",1e5,[],{auto:!1}),D("atm",101325,["atmosphere","atmospheres"],{auto:!1}),D("MPa",1e6,["megapascal","megapascals"]),D("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([D("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),D("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),D("kN·m",1e3,["knm","kn.m"],{auto:!1}),D("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([D("kg/m³",1,["kg/m3"]),D("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),D("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),D("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([D("L/min",1/6e4,["lpm","l/min"],{auto:!1}),D("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),D("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),D("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),D("cfm",.0004719474432,["ft3/min"],{auto:!1}),D("L/s",.001,["lps","l/s"],{auto:!1}),D("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([D("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),D("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),D("mrad",.001,["milliradian","milliradians"],{auto:!1}),D("mil",Math.PI/3200,["nato-mil"],{auto:!1}),D("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),D("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),D("rad",1,["radian","radians"]),D("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([D("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),D("rad/s",1,["radps","radians/s"]),D("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),D("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([D("ppt",1e-12,["partspertrillion"],{auto:!1}),D("ppb",1e-9,["partsperbillion"]),D("ppm",1e-6,["partspermillion"]),D("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),D("‰",.001,["permille","permil"],{auto:!1}),D("%",.01,["pct","percent"]),D("×",1,["x","ratio","times"])]),molarity:Object.freeze([D("pM",1e-12,["picomolar","picomolarity"]),D("nM",1e-9,["nanomolar","nanomolarity"]),D("µM",1e-6,["um-molar","micromolar","micromolarity"]),D("mM",.001,["millimolar","millimolarity"]),D("M",1,["molar","mol/l","mol/L","molarity"]),D("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([D("mg/s",1e-6,["milligrams/s"]),D("g/s",.001,["grams/s"]),D("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),D("kg/s",1,["kilograms/s","kgps"]),D("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),D("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),D("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([D("µPa·s",1e-6,["upas","micropascalsecond"]),D("cP",.001,["centipoise"],{auto:!1}),D("mPa·s",.001,["mpas","millipascalsecond"]),D("P",.1,["poise"],{auto:!1}),D("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([D("cSt",1e-6,["centistokes","centistoke"]),D("mm²/s",1e-6,["mm2/s"],{auto:!1}),D("St",1e-4,["stokes","stoke"],{auto:!1}),D("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([D("mW/(m·K)",.001,["mw/mk"]),D("W/(m·K)",1,["w/mk","wmk"]),D("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),D("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([D("J/(kg·K)",1,["j/kgk","jkgk"]),D("kJ/(kg·K)",1e3,["kj/kgk"]),D("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([D("nSv/h",1e-9,["nsvh"]),D("µSv/h",1e-6,["usv/h","usvh"]),D("mSv/h",.001,["msvh"]),D("Sv/h",1,["svh"]),D("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),L=Symbol("ambiguous"),X=new Map,I=new Map;function j(B,x){const V=String(B||"").trim();if(!V)throw new Error("[lattice] a unit system needs a name");if(z[V]||I.has(V))throw new Error(`[lattice] unit system "${V}" already exists`);const Y=[...x||[]];if(!Y.length)throw new Error(`[lattice] unit system "${V}" has no units`);if(!Y.some($=>$.factor===1))throw new Error(`[lattice] unit system "${V}" has no base unit (none with factor 1)`);const F=new Set;for(const $ of Y){if(F.has($.symbol))throw new Error(`[lattice] unit system "${V}" declares "${$.symbol}" twice`);F.add($.symbol)}return I.set(V,Object.freeze(Y)),X.delete(V),V}function k(){return[...Object.keys(z),...I.keys()]}function y(B){const x=l(B);return x?x.units:[]}function l(B){const x=String(B||""),V=X.get(x);if(V!==void 0)return V;const Y=z[x]||I.get(x);if(!Y)return X.set(x,null),null;const F=Object.freeze([...Y].sort((re,ie)=>re.factor-ie.factor)),$=new Map,q=new Map,ee=(re,ie)=>{const ue=$.get(re);ue===void 0?$.set(re,ie):ue!==ie&&$.set(re,L)};for(const re of F){ee(re.symbol.toLowerCase(),re);for(const ie of re.aliases)ee(ie.toLowerCase(),re);if(re.prefix){const ie=q.get(re.prefix)||[];ie.push(re),q.set(re.prefix,ie)}}const te={units:F,byToken:$,byPrefix:q,decimal:F.filter(re=>!re.binary&&re.auto),binary:F.some(re=>re.binary)?F.filter(re=>(re.binary||re.factor===1)&&re.auto):null};return X.set(x,te),te}function g(B,x){return x&&B.binary||B.decimal}function s(B,x){const V=l(B);if(!V||E(x))return null;const Y=V.units.find($=>$.symbol===String(x));if(Y)return Y;const F=V.byToken.get(String(x).trim().toLowerCase());return F&&F!==L?F:null}const t=new WeakMap;function o(B){const x=B||{};if(typeof x=="object"&&x!==null){const $=t.get(x);if($!==void 0)return $}const V=x.system||"data",Y=l(V);let F=null;if(!Y)U(`unit:system:${V}`,`unknown unit system "${V}"; known systems are ${k().join(", ")}`);else{let $=x.unit?s(V,x.unit):null;$||(x.unit&&U(`unit:unit:${V}:${x.unit}`,`unknown unit "${x.unit}" in system "${V}"; falling back to ${Y.units[0].symbol}`),$=Y.units.find(q=>q.factor===1)||Y.units[0]),F={index:Y,base:$,binary:x.binary===!0}}return typeof x=="object"&&x!==null&&t.set(x,F),F}const c=new WeakMap;function d(B,x){if(!B||!x||!Array.isArray(B.compound)||B.compound.length===0)return null;const V=c.get(B);if(V!==void 0)return V;const Y=new Set,F=[];for(const q of B.compound){const ee=s(B.system||"data",q);if(!ee){U(`unit:compound:${B.system}:${q}`,`unknown compound unit "${q}" in system "${B.system||"data"}"; ignoring it`);continue}Y.has(ee.symbol)||(Y.add(ee.symbol),F.push(ee))}F.sort((q,ee)=>ee.factor-q.factor);const $=F.length>=2?F:null;return c.set(B,$),$}function n(B,x,V){return x===V||x.factor===V.factor?B:B*x.factor/V.factor}const p=new Map;function i(B){const x=B||"",V=p.get(x);if(V)return V;const Y={group:",",decimal:"."};try{for(const F of new Intl.NumberFormat(B||void 0).formatToParts(12345.6))F.type==="group"?Y.group=F.value:F.type==="decimal"&&(Y.decimal=F.value)}catch{}return p.set(x,Y),Y}const r=/[\s ]/g,f=/^[+-]?[\d '’ .,]*(?:[eE][+-]?\d+)?/,m=/^[^\d+\-(.,\s]+\s*/,u=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function b(B,x){const{group:V,decimal:Y}=i(x);let F=String(B).replace(r,"");if(F==="")return null;const $=Y?F.indexOf(Y):-1;if(V&&V!==Y){if($>=0&&F.indexOf(V,$+Y.length)>=0)return null;F=F.split(V).join("")}if(Y&&Y!=="."&&(F=F.split(Y).join(".")),!u.test(F))return null;const q=Number(F);return Number.isFinite(q)?q:null}function a(B,x,V){const Y=String(B).trim().replace(/\.$/,"");if(Y==="")return null;const F=x.units.find(ie=>ie.symbol===Y);if(F)return F;const $=Y.toLowerCase(),q=x.byToken.get($);if(q===L)return null;if(q)return q;const ee=x.byPrefix.get($);if(!ee||!ee.length)return null;const te=g(x,V),re=ee.filter(ie=>te.includes(ie));return re.length===1?re[0]:null}function h(B,x,V,Y){let F=B,$=0,q=!1,ee=!1;for(;F!=="";){const te=f.exec(F)[0];if(te==="")return null;const re=b(te,Y&&Y.locale);if(re===null)return null;F=F.slice(te.length).trim();const ie=F.search(/[+-]?[\d]/),ue=(ie>=0?F.slice(0,ie):F).trim();if(F=ie>=0?F.slice(ie).trim():"",ue===""){if(q)return null;ee=!0,$+=n(re,V[0],x.base)}else{const Ae=a(ue,x.index,x.binary);if(!Ae)return null;$+=n(re,Ae,x.base)}if(q=!0,ee&&F!=="")return null}return q?$:null}function w(B,x){if(E(B))return null;if(typeof B=="number")return Number.isFinite(B)?B:null;const V=o(x);if(!V)return null;let Y=String(B).trim();if(Y==="")return null;let F=!1;Y.startsWith("(")&&Y.endsWith(")")&&(F=!0,Y=Y.slice(1,-1).trim());const $=d(x,V);if($){Y.startsWith("-")&&(F=!0,Y=Y.slice(1).trim());const de=h(Y,V,$,x);return de===null?null:F?-de:de}let q=null;const ee=m.exec(Y);if(ee&&ee[0]){const de=a(ee[0].trim(),V.index,V.binary);de&&(q=de,Y=Y.slice(ee[0].length).trim())}const te=f.exec(Y)[0],re=b(te,x&&x.locale);if(re===null)return null;const ie=Y.slice(te.length).trim();if(q&&ie!=="")return null;const ue=q||(ie===""?V.base:a(ie,V.index,V.binary));if(!ue)return null;const Ae=n(re,ue,V.base);return F?-Ae:Ae}const v=new Map;function A(B,x,V,Y){const F=`${B||""}|${x}|${V}|${Y?1:0}`;let $=v.get(F);return $||($=new Intl.NumberFormat(B||void 0,{minimumFractionDigits:x,maximumFractionDigits:V,useGrouping:Y}),v.set(F,$)),$}function H(B,x){if(!Number.isFinite(B)||B===0)return Math.max(0,x-1);const V=Math.floor(Math.log10(Math.abs(B)));return Math.min(20,Math.max(0,x-1-V))}function G(B,x){if(!Number.isFinite(B)||B===0)return B;const V=Math.ceil(Math.log10(Math.abs(B))),Y=10**(x-V);return Math.round(B*Y)/Y}function Z(B,x,V){if(!V||V===x.base.symbol)return x.base;if(V!=="auto")return M(x,V);if(B===0||!Number.isFinite(B))return x.base;const Y=Math.abs(B)*x.base.factor,F=g(x.index,x.binary);let $=F[0];for(const te of F)Y>=te.factor&&($=te);if(Y>=$.factor)return $;let q=$;for(const te of x.index.units)te.binary!==x.binary&&te.factor!==1||te.factor<=Y&&te.factor>(q===$?0:q.factor)&&(q=te);if(q!==$)return q;let ee=$;for(const te of x.index.units)te.binary!==x.binary&&te.factor!==1||te.factor<ee.factor&&(ee=te);return ee.factor<x.base.factor?ee:x.base}function M(B,x){const V=B.index.units.find(F=>F.symbol===x);if(V)return V;const Y=B.index.byToken.get(String(x).toLowerCase());return Y&&Y!==L?Y:(U(`unit:display:${x}`,`unknown display unit "${x}"; rendering in ${B.base.symbol}`),B.base)}function S(B,x,V,Y){const F=B<0;let $=Math.abs(B)*x.base.factor;const q=typeof Y.decimals=="number"?Y.decimals:Y.minDecimals??0,ee=typeof Y.decimals=="number"?Y.decimals:Y.maxDecimals??Math.max(q,2),te=Y.space??" ",re=[];for(let ue=0;ue<V.length;ue++){const Ae=V[ue],de=ue===V.length-1;let Oe=de?$/Ae.factor:Math.floor($/Ae.factor);if($-=Oe*Ae.factor,de){const Fe=10**ee;Oe=Math.round(Oe*Fe)/Fe+0}const Me=de?A(Y.locale,q,ee,Y.group!==!1):A(Y.locale,0,0,Y.group!==!1);re.push(`${Me.format(Oe)}${te}${Ae.symbol}`)}const ie=re.join(" ");return F?`-${ie}`:ie}function T(B,x){const V=x||{},Y=V.nullDisplay??"";if(E(B)||B==="")return Y;const F=typeof B=="number"?B:Number(B);if(!Number.isFinite(F))return Y;const $=o(V);if(!$)return String(F);const q=d(V,$);if(q)return S(F,$,q,V);const ee=typeof V.significantFigures=="number"&&V.significantFigures>0?V.significantFigures:0,te=ee?G(F,ee):F,re=Z(te,$,V.display),ie=n(te,$.base,re);let ue=typeof V.decimals=="number"?V.decimals:V.minDecimals??0,Ae=typeof V.decimals=="number"?V.decimals:V.maxDecimals??Math.max(ue,2);ee&&(ue=H(ie,ee),Ae=ue);const de=A(V.locale,ue,Ae,V.group!==!1).format(ie),Oe=V.space??" ";return V.placement==="prefix"?`${re.symbol}${V.space??""}${de}`:`${de}${Oe}${re.symbol}`}function O(B,x){const V=E(B)||Number.isNaN(B)?null:Number(B),Y=E(x)||Number.isNaN(x)?null:Number(x);return V===null||Number.isNaN(V)?Y===null||Number.isNaN(Y)?0:1:Y===null||Number.isNaN(Y)||V<Y?-1:V>Y?1:0}function N(B){const x=typeof B.decimals=="number"&&B.decimals>0?`.${"0".repeat(B.decimals)}`:"";return`${typeof B.decimals=="number"?`#,##0${x}`:"#,##0.##"}" ${B.symbol}"`}function P(B){const x={system:"data",...B||{}},V=o(x),Y=V?V.base.symbol:String(x.unit||""),F=Object.freeze({...x,unit:Y}),$=Object.freeze({...F,display:Y,decimals:void 0,minDecimals:0,maxDecimals:20,group:!1}),q=new Map([[F.locale||"",F]]),ee=te=>{const re=te||"";let ie=q.get(re);return ie||(ie=Object.freeze({...F,locale:te||void 0}),q.set(re,ie)),ie};return{base:"number",extends:"number",storage:"float64",unitConfig:F,format:te=>T(te.value,te.locale?ee(te.locale):F),parse:te=>w(te.text,te.locale?ee(te.locale):F),compare:O,defaults:{filter:"number",editor:"unit",align:"end",total:x.total||"sum"},...x.totals?{totals:x.totals}:{},excel:x.excel||N({decimals:x.decimals,symbol:Y}),toStorage:te=>typeof te=="number"?Number.isFinite(te)?te:null:typeof te=="string"?w(te,F):E(te)?null:w(String(te),F),toClipboard:te=>T(te,$),fromClipboard:te=>w(te,F)}}const C=P}),ze("packages/core/src/columns/types/engineering.js",function(e,_){"use strict";Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return D}});const E=_("packages/core/src/internal/predicates.js").isNil,U=_("packages/core/src/columns/types/unit.js").createUnitType;function D(L){const X=2*Math.PI/L;return I=>{let j=0,k=0,y=0;for(const g of I||[]){if(E(g))continue;const s=Number(g);Number.isFinite(s)&&(j+=Math.cos(s*X),k+=Math.sin(s*X),y+=1)}return!y||Math.hypot(j,k)/y<1e-12?null:(Math.atan2(k,j)/X%L+L)%L}}function J(L){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:D(L)}}}const z=Object.freeze({metres:U({system:"length",unit:"m",display:"auto",maxDecimals:3}),millimetres:U({system:"length",unit:"mm",maxDecimals:2}),kilometres:U({system:"length",unit:"km",maxDecimals:3}),grams:U({system:"mass",unit:"g",display:"auto",maxDecimals:3}),kilograms:U({system:"mass",unit:"kg",maxDecimals:3}),tonnes:U({system:"mass",unit:"t",maxDecimals:3}),seconds:U({system:"duration",unit:"s",display:"auto",maxDecimals:3}),milliseconds:U({system:"duration",unit:"ms",maxDecimals:3}),hours:U({system:"duration",unit:"h",maxDecimals:2}),speed:U({system:"speed",unit:"m/s",display:"auto",maxDecimals:2}),kph:U({system:"speed",unit:"km/h",maxDecimals:1}),mph:U({system:"speed",unit:"mph",maxDecimals:1}),knots:U({system:"speed",unit:"kn",maxDecimals:1}),acceleration:U({system:"acceleration",unit:"m/s²",maxDecimals:3}),area:U({system:"area",unit:"m²",display:"auto",maxDecimals:2}),hectares:U({system:"area",unit:"ha",maxDecimals:4}),volume:U({system:"volume",unit:"L",display:"auto",maxDecimals:3}),cubicMetres:U({system:"volume",unit:"m³",maxDecimals:3}),energy:U({system:"energy",unit:"J",display:"auto",maxDecimals:3}),kilowattHours:U({system:"energy",unit:"kWh",maxDecimals:2}),power:U({system:"power",unit:"W",display:"auto",maxDecimals:2}),kilowatts:U({system:"power",unit:"kW",maxDecimals:2}),force:U({system:"force",unit:"N",display:"auto",maxDecimals:2}),pressure:U({system:"pressure",unit:"Pa",display:"auto",maxDecimals:2}),bar:U({system:"pressure",unit:"bar",maxDecimals:3}),psi:U({system:"pressure",unit:"psi",maxDecimals:1}),torque:U({system:"torque",unit:"N·m",maxDecimals:2}),density:U({system:"density",unit:"kg/m³",maxDecimals:2}),flow:U({system:"flow",unit:"m³/s",maxDecimals:4}),litresPerMinute:U({system:"flow",unit:"L/min",maxDecimals:1}),radians:U({system:"angle",unit:"rad",maxDecimals:4,totals:J(2*Math.PI)}),degrees:U({system:"angle",unit:"°",maxDecimals:2,totals:J(360)}),rpm:U({system:"angularVelocity",unit:"rpm",maxDecimals:0}),angularVelocity:U({system:"angularVelocity",unit:"rad/s",maxDecimals:3}),ppm:U({system:"fraction",unit:"ppm",maxDecimals:2}),ppb:U({system:"fraction",unit:"ppb",maxDecimals:2}),basisPoints:U({system:"fraction",unit:"bp",maxDecimals:1}),molarity:U({system:"molarity",unit:"M",display:"auto",maxDecimals:3}),massFlow:U({system:"massFlow",unit:"kg/s",maxDecimals:3}),tonnesPerHour:U({system:"massFlow",unit:"t/h",maxDecimals:2}),viscosity:U({system:"viscosity",unit:"Pa·s",display:"auto",maxDecimals:3}),kinematicViscosity:U({system:"kinematicViscosity",unit:"cSt",maxDecimals:2}),thermalConductivity:U({system:"thermalConductivity",unit:"W/(m·K)",maxDecimals:3}),specificHeat:U({system:"specificHeat",unit:"J/(kg·K)",maxDecimals:1}),doseRate:U({system:"doseRate",unit:"µSv/h",display:"auto",maxDecimals:2})})}),ze("packages/core/src/columns/types/si.js",function(e,_){"use strict";Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return j}});const ne=_("packages/core/src/columns/types/unit.js"),E=ne.defineUnit,K=ne.registerUnitSystem,U=ne.createUnitType,D=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})]),J=Object.freeze(["p","n","µ","m","","k","M","G"]);function z(k){const y=String(k.base),l=new Set([...k.prefixes||J,""]),g=[];for(const s of D){if(!l.has(s.symbol))continue;const t=`${s.symbol}${y}`,o=[];if(k.name){o.push(`${s.name}${k.name}`,`${s.name}${k.name}s`);const c=s.name.slice(-1);if(c&&k.name.startsWith(c)){const d=`${s.name.slice(0,-1)}${k.name}`;o.push(d,`${d}s`)}}s.symbol==="µ"&&o.push(`u${y}`),s.factor===1&&k.aliases&&o.push(...k.aliases),g.push(E(t,s.factor,o))}for(const s of k.extra||[])g.push(s);return g}function L(k,y){const l=z(y);return K(k,l)}function X(k,y,l){return L(k,y),U({system:k,unit:y.base,display:"auto",maxDecimals:3,...l||{}})}const I=Object.freeze({voltage:X("voltage",{base:"V",name:"volt"}),current:X("current",{base:"A",name:"amp",aliases:["ampere","amperes"]}),resistance:X("resistance",{base:"Ω",name:"ohm",aliases:["ohm","ohms","R"],prefixes:["m","","k","M","G"]}),capacitance:X("capacitance",{base:"F",name:"farad",prefixes:["f","p","n","µ","m",""]}),inductance:X("inductance",{base:"H",name:"henry",prefixes:["p","n","µ","m",""]}),charge:X("charge",{base:"C",name:"coulomb",prefixes:["p","n","µ","m",""],extra:[E("mAh",3.6,["milliamphour","milliamphours"],{auto:!1}),E("Ah",3600,["amphour","amphours"],{auto:!1})]}),conductance:X("conductance",{base:"S",name:"siemens",prefixes:["n","µ","m","","k"]}),fluxDensity:X("fluxDensity",{base:"T",name:"tesla",prefixes:["n","µ","m",""],extra:[E("G",1e-4,["gauss"],{auto:!1})]}),luminousFlux:X("luminousFlux",{base:"lm",name:"lumen",prefixes:["m","","k"]}),illuminance:X("illuminance",{base:"lx",name:"lux",prefixes:["m","","k"]}),luminousIntensity:X("luminousIntensity",{base:"cd",name:"candela",prefixes:["m","","k"]}),substance:X("substance",{base:"mol",name:"mole",prefixes:["n","µ","m","","k"]}),absorbedDose:X("absorbedDose",{base:"Gy",name:"gray",prefixes:["µ","m",""]}),equivalentDose:X("equivalentDose",{base:"Sv",name:"sievert",prefixes:["n","µ","m",""]}),radioactivity:X("radioactivity",{base:"Bq",name:"becquerel",prefixes:["","k","M","G","T"],extra:[E("Ci",37e9,["curie","curies"],{auto:!1})]}),frequency:X("frequency",{base:"Hz",name:"hertz",prefixes:["m","","k","M","G","T"]})}),j=X}),ze("packages/core/src/columns/types/temperature.js",function(e,_){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});const E=_("packages/core/src/internal/predicates.js").isNil,K=Object.freeze({C:Object.freeze({symbol:"°C",aliases:["c","°c","celsius","centigrade"],toKelvin:g=>g+273.15,fromKelvin:g=>g-273.15}),F:Object.freeze({symbol:"°F",aliases:["f","°f","fahrenheit"],toKelvin:g=>(g+459.67)*(5/9),fromKelvin:g=>g*(9/5)-459.67}),K:Object.freeze({symbol:"K",aliases:["k","kelvin"],toKelvin:g=>g,fromKelvin:g=>g}),R:Object.freeze({symbol:"°R",aliases:["r","°r","rankine"],toKelvin:g=>g*(5/9),fromKelvin:g=>g*(9/5)})});function U(g){if(E(g))return null;const s=String(g).trim();if(s==="")return null;for(const[o,c]of Object.entries(K))if(s===o||s===c.symbol)return{key:o,scale:c};const t=s.toLowerCase();for(const[o,c]of Object.entries(K))if(c.aliases.includes(t))return{key:o,scale:c};return null}function D(g,s,t){const o=U(s),c=U(t);return!o||!c||!Number.isFinite(Number(g))?null:o.key===c.key?Number(g):c.scale.fromKelvin(o.scale.toKelvin(Number(g)))}const J=new Map;function z(g,s,t){const o=`${g||""}|${s}|${t}`;let c=J.get(o);return c||(c=new Intl.NumberFormat(g||void 0,{minimumFractionDigits:s,maximumFractionDigits:t}),J.set(o,c)),c}function L(g,s){const t=s||{},o=t.nullDisplay??"";if(E(g)||g==="")return o;const c=Number(g);if(!Number.isFinite(c))return o;const d=U(t.scale||"C");if(!d)return String(c);const n=U(t.display||t.scale||"C")||d,p=n.key===d.key?c:n.scale.fromKelvin(d.scale.toKelvin(c)),i=typeof t.decimals=="number"?t.decimals:null,r=i??t.minDecimals??0,f=i??t.maxDecimals??1;return`${z(t.locale,r,f).format(p)}${t.space??" "}${n.scale.symbol}`}const X=/^[+-]?[\d\s., ]*\d/;function I(g,s){const t=String(g).trim();if(t==="")return null;const o=new Intl.NumberFormat(s||void 0).formatToParts(1.1).find(p=>p.type==="decimal")?.value||".",c=o===","?".":",",d=t.split(c).join("").split(/[\s ]/).join("").replace(o,"."),n=Number(d);return Number.isFinite(n)?n:null}function j(g,s){if(E(g))return null;const t=s||{},o=U(t.scale||"C");if(!o)return null;if(typeof g=="number")return Number.isFinite(g)?g:null;let c=String(g).trim();if(c==="")return null;let d=!1;c.startsWith("(")&&c.endsWith(")")&&(d=!0,c=c.slice(1,-1).trim());const n=X.exec(c);if(!n)return null;const p=I(n[0],t.locale);if(p===null)return null;const i=c.slice(n[0].length).trim();if(i==="")return d?-p:p;const r=U(i);if(!r)return null;const f=r.key===o.key?p:o.scale.fromKelvin(r.scale.toKelvin(p));return d?-f:f}function k(g){const s=Object.freeze({scale:"C",...g||{}}),o=(U(s.scale)||U("C")).scale.symbol,c=Object.freeze({...s,display:s.scale,decimals:void 0,minDecimals:0,maxDecimals:20}),d=new Map([[s.locale||"",s]]),n=p=>{const i=p||"";let r=d.get(i);return r||(r=Object.freeze({...s,locale:p||void 0}),d.set(i,r)),r};return{base:"number",extends:"number",storage:"float64",temperatureConfig:s,format:p=>L(p.value,p.locale?n(p.locale):s),parse:p=>j(p.text,p.locale?n(p.locale):s),defaults:{filter:"number",editor:"temperature",align:"end",total:"avg"},totals:{supported:["avg","min","max","count","countValues"]},excel:s.excel||`#,##0${typeof s.decimals=="number"&&s.decimals>0?`.${"0".repeat(s.decimals)}`:".#"}" ${o}"`,toStorage:p=>typeof p=="number"?Number.isFinite(p)?p:null:typeof p=="string"?j(p,s):E(p)?null:j(String(p),s),toClipboard:p=>L(p,c),fromClipboard:p=>j(p,s)}}const y=Object.freeze({celsius:k({scale:"C"}),fahrenheit:k({scale:"F"}),kelvin:k({scale:"K"})}),l=k}),ze("packages/core/src/columns/types/radix.js",function(e,_){"use strict";Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"digitsForWidth",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"radixRange",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"radixName",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"normaliseRadixOptions",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"compileRadixFormat",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"compileRadixParse",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"parseRadixResult",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return S}});const E=_("packages/core/src/internal/predicates.js").isNil,U=_("packages/core/src/internal/warn.js").warnOnce,D=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}),J=Object.freeze({2:1,8:3,16:4}),z=Object.freeze({2:"0b",8:"0o",16:"0x"}),L=Object.freeze({2:4,8:3,16:2}),X=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),I=Object.freeze({2:"binary",8:"octal",16:"hexadecimal"}),j=Object.freeze([[/^0x/i,16],[/^0b/i,2],[/^0o/i,8],[/^#/,16]]),k=/[\s\u00a0\u202f_,']/g,y=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,l=Object.freeze([8,16,32,53]),g=new WeakSet,s=new WeakMap,t=new Map,o=new WeakMap,c=new WeakMap,d=Object.freeze({hex:Object.freeze({radix:16}),hex8:Object.freeze({radix:16,bitWidth:8,pad:!0,signed:!1}),hex16:Object.freeze({radix:16,bitWidth:16,pad:!0,signed:!1}),hex32:Object.freeze({radix:16,bitWidth:32,pad:!0,signed:!1}),binary:Object.freeze({radix:2}),binary8:Object.freeze({radix:2,bitWidth:8,pad:!0,signed:!1,group:4}),octal:Object.freeze({radix:8})});function n(T){if(T==null)return 16;const O=typeof T=="string"?T.toLowerCase():T,N=D[O];return N||(U(`radix:base:${String(T)}`,`unsupported radix ${String(T)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function p(T,O){return Math.ceil(T/J[O])}function i(T,O){if(!T)return O?{min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}:{min:0,max:Number.MAX_SAFE_INTEGER};if(!O)return{min:0,max:2**T-1};const N=2**(T-1);return{min:-N,max:N-1}}function r(T){return I[T]||"hexadecimal"}function f(T){if(typeof T=="string"){const O=d[T];return O||U(`radix:preset:${T}`,`unknown radix preset "${T}"; known presets are ${Object.keys(d).join(", ")}`),{...O||{}}}if(T&&typeof T.preset=="string"){const O=d[T.preset];return O||U(`radix:preset:${T.preset}`,`unknown radix preset "${T.preset}"; known presets are ${Object.keys(d).join(", ")}`),{...O||{},...T}}return T||{}}function m(T){const O=f(T),N=n(O.radix),P=J[N];let C=null;if(O.bitWidth!==void 0&&O.bitWidth!==null&&O.bitWidth!==!1){const te=Number(O.bitWidth);l.includes(te)?C=te:U(`radix:width:${String(O.bitWidth)}`,`unsupported bitWidth ${String(O.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let B=O.signed!==!1;!B&&C===null&&(U("radix:unsigned:width","signed: false needs a bitWidth to render a two's-complement pattern; defaulting to 32"),C=32);const x=O.prefix===void 0||O.prefix===!0?z[N]:O.prefix===!1?"":String(O.prefix);let V=0;O.pad===!0?V=C?p(C,N):0:typeof O.pad=="number"&&O.pad>0&&(V=Math.floor(O.pad));let Y=0;O.group===!0?Y=L[N]:typeof O.group=="number"&&O.group>0&&(Y=Math.floor(O.group));const F=i(C,B),$=typeof O.min=="number"?Math.max(F.min,O.min):F.min,q=typeof O.max=="number"?Math.min(F.max,O.max):F.max,ee=Object.freeze({radix:N,bits:P,prefix:x,uppercase:O.uppercase!==!1,pad:V,group:Y,groupSeparator:typeof O.groupSeparator=="string"?O.groupSeparator:" ",bitWidth:C,signed:B,min:$,max:q<$?$:q,nullDisplay:typeof O.nullDisplay=="string"?O.nullDisplay:"",name:r(N)});return g.add(ee),ee}function u(T){if(T&&g.has(T))return T;if(typeof T=="string"){let O=t.get(T);return O||(O=m(T),t.set(T,O)),O}if(T&&typeof T=="object"){let O=s.get(T);return O||(O=m(T),s.set(T,O)),O}return u("hex")}function b(T){return T<0?-Math.round(-T):Math.round(T)}function a(T,O,N){if(O<=0||T.length<=O)return T;const P=T.length%O||O,C=[T.slice(0,P)];for(let B=P;B<T.length;B+=O)C.push(T.slice(B,B+O));return C.join(N)}function h(T){const O=u(T),{radix:N,prefix:P,uppercase:C,pad:B,group:x,groupSeparator:V,signed:Y,bitWidth:F,nullDisplay:$}=O,q=F?2**F:0,ee=te=>{if(E(te)||te==="")return $;const re=typeof te=="number"?te:Number(te);if(!Number.isFinite(re))return $;const ie=b(re);let ue="",Ae=ie;ie<0&&(Y?(ue="-",Ae=-ie):Ae=(ie%q+q)%q);let de=Ae.toString(N);return de=C?de.toUpperCase():de.toLowerCase(),B>0&&de.length<B&&(de=de.padStart(B,"0")),x>0&&(de=a(de,x,V)),ue+P+de};return ee.options=O,ee}function w(T,O){const N=u(O);let P=o.get(N);return P||(P=h(N),o.set(N,P)),P(T)}function v(T){const O=u(T),{radix:N,groupSeparator:P,signed:C,min:B,max:x}=O,V=X[N],Y=F=>{if(E(F))return{ok:!0,value:null,reason:"blank"};let $=String(F);if(P&&P!==""&&($=$.split(P).join("")),$=$.replace(k,""),$==="")return{ok:!0,value:null,reason:"blank"};let q=!1;if(($[0]==="-"||$[0]==="+")&&(q=$[0]==="-",$=$.slice(1)),$==="")return{ok:!1,value:null,reason:"digits"};let ee=null;for(const[re,ie]of j){const ue=re.exec($);if(!ue)continue;const Ae=$.slice(ue[0].length);if(Ae==="")break;if(!X[ie].test(Ae))return{ok:!1,value:null,reason:"digits"};ee=parseInt(Ae,ie);break}if(ee===null)if(V.test($))ee=parseInt($,N);else if(y.test($))ee=Number($);else return{ok:!1,value:null,reason:"digits"};if(!Number.isFinite(ee))return{ok:!1,value:null,reason:"digits"};const te=b(q?-ee:ee);return!C&&te<0?{ok:!1,value:te,reason:"negative"}:te<B||te>x?{ok:!1,value:te,reason:"range"}:{ok:!0,value:te,reason:"ok"}};return Y.options=O,Y}function A(T,O){const N=u(O);let P=c.get(N);return P||(P=v(N),c.set(N,P)),P(T)}function H(T,O){const N=A(T,O);return N.ok?N.value:null}function G(T,O){const N=E(T)||Number.isNaN(T)?null:Number(T),P=E(O)||Number.isNaN(O)?null:Number(O);return N===null?P===null?0:1:P===null||N<P?-1:N>P?1:0}function Z(T){const O=T.min>=-2147483648&&T.max<=2147483647;return T.bitWidth&&O?"int32":"float64"}function M(T){const O=m(T),N=h(O),P=v(O);return{base:"number",extends:"number",storage:Z(O),matches:null,format:C=>N(C.value),parse:C=>{const B=P(C.text);return B.ok?B.value:null},compare:G,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:C=>N(C),fromClipboard:C=>{const B=P(C);return B.ok?B.value:null},radix:O,formatValue:N,parseText:P}}const S=M}),ze("packages/core/src/columns/types/aggregable.js",function(e,_){"use strict";Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"weightedMean",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"logarithmicSum",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"logarithmicMean",{enumerable:!0,get:function(){return D}});const E=_("packages/core/src/internal/predicates.js").isNil;function K(I){const j=[];for(const k of I||[]){if(E(k))continue;const y=Number(k);Number.isFinite(y)&&j.push(y)}return j}function U(I){return j=>{const k=K(j);if(!k.length)return null;let y=0;for(const l of k)y+=10**(l/I);return I*Math.log10(y)}}function D(I){return j=>{const k=K(j);if(!k.length)return null;let y=0;for(const l of k)y+=10**(l/I);return I*Math.log10(y/k.length)}}function J(I,j){const k=j&&j.column,l=(k&&k.typeOptions||{}).weight,g=j&&j.valueAt;if(!l||typeof g!="function")return null;let s=0,t=0;for(let o=0;o<I.length;o++){if(E(I[o]))continue;const c=Number(I[o]);if(!Number.isFinite(c))continue;const d=g(l,o);if(E(d))continue;const n=Number(d);!Number.isFinite(n)||n<=0||(s+=c*n,t+=n)}return t===0?null:s/t}function z(I={}){const j=I.factor===20?20:10,k=typeof I.suffix=="string"?I.suffix:"",y=Number.isInteger(I.decimals)?I.decimals:1;return{base:"number",storage:"float64",name:I.name||"logarithmic",format:l=>{const g=l&&l.value;return E(g)||!Number.isFinite(Number(g))?"":`${Number(g).toFixed(y)}${k}`},parse:l=>{const g=String((l&&l.text)??"").replace(k,"").trim();if(!g)return null;const s=Number(g);return Number.isFinite(s)?s:null},defaults:{align:"end",filter:"number"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:{sum:U(j),avg:D(j)}}}}function L(I={}){const j=Number.isInteger(I.decimals)?I.decimals:1,k=I.percent===!0;return{base:"number",storage:"float64",name:I.name||"ratio",format:y=>{const l=y&&y.value;return E(l)||!Number.isFinite(Number(l))?"":k?`${Number(l).toFixed(j)}%`:Number(l).toFixed(j)},parse:y=>{const l=String((y&&y.text)??"").replace("%","").trim();if(!l)return null;const g=Number(l);return Number.isFinite(g)?g:null},defaults:{align:"end",filter:"number"},totals:{supported:["avg","min","max","count","countValues"],implement:{avg:J}}}}const X=Object.freeze({decibel:z({name:"decibel",factor:10,suffix:" dB"}),decibelAmplitude:z({name:"decibelAmplitude",factor:20,suffix:" dB"}),ratio:L({name:"ratio"}),percentRate:L({name:"percentRate",percent:!0})})}),ze("packages/core/src/columns/types/currency.js",function(e,_){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"moneyToText",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});const E=_("packages/core/src/internal/predicates.js").isNil,K="⚠ no rate";function U(p){if(E(p))return null;const i=String(p).trim().toUpperCase();return i===""?null:i}function D(p){if(E(p))return null;if(typeof p=="object"&&!Array.isArray(p)){const i=Number(p.amount),r=U(p.code);return!r||!Number.isFinite(i)?null:{amount:i,code:r}}if(Array.isArray(p)&&p.length===2){const i=Number(p[0]),r=U(p[1]);return!r||!Number.isFinite(i)?null:{amount:i,code:r}}return null}const J=Object.freeze({$:"USD","€":"EUR","£":"GBP","¥":"JPY","₹":"INR","₩":"KRW","₽":"RUB","₺":"TRY","₴":"UAH","₪":"ILS"}),z=Object.freeze({USD:"$",EUR:"€",GBP:"£",JPY:"¥",INR:"₹",KRW:"₩",RUB:"₽",TRY:"₺",UAH:"₴",ILS:"₪"}),L=/[+-]?[\d\s., ]*\d/;function X(p,i){const r=String(p).trim();if(r==="")return null;const f=new Intl.NumberFormat(i||void 0).formatToParts(1.1).find(a=>a.type==="decimal")?.value||".",m=f===","?".":",",u=r.split(m).join("").split(/[\s ]/).join("").replace(f,"."),b=Number(u);return Number.isFinite(b)?b:null}function I(p,i){const r=i||{},f=U(r.code);if(E(p))return null;const m=D(p);if(m)return m;if(typeof p=="number")return Number.isFinite(p)&&f?{amount:p,code:f}:null;let u=String(p).trim();if(u==="")return null;let b=!1;u.startsWith("(")&&u.endsWith(")")&&(b=!0,u=u.slice(1,-1).trim());let a=null;for(const[G,Z]of Object.entries(J)){if(u.startsWith(G)){a=Z,u=u.slice(G.length).trim();break}if(u.endsWith(G)){a=Z,u=u.slice(0,-G.length).trim();break}}const h=L.exec(u);if(!h)return null;const w=X(h[0],r.locale);if(w===null)return null;const v=(u.slice(0,h.index)+" "+u.slice(h.index+h[0].length)).trim();!a&&v!==""&&(a=U(v));const A=a||f;return A?{amount:b?-w:w,code:A}:null}function j(p,i){if(typeof p=="function")return(r,f)=>{if(r===f)return 1;const m=p(r,f);return typeof m=="number"&&Number.isFinite(m)&&m>0?m:null};if(p&&typeof p=="object"){const r=p;return(f,m)=>{if(f===m)return 1;const u=Number(r[f]),b=Number(r[m]);return!Number.isFinite(u)||!Number.isFinite(b)||u<=0||b<=0?null:b/u}}return(r,f)=>r===f?1:null}function k(p,i,r){if(!p)return null;if(p.code===i)return p.amount;const f=r(p.code,i);return f===null?null:p.amount*f}const y=new Map;function l(p,i,r){const f=`${p||""}|${i}|${r??""}`;let m=y.get(f);if(!m){const u={style:"currency",currency:i};typeof r=="number"&&(u.minimumFractionDigits=r,u.maximumFractionDigits=r);try{m={fmt:new Intl.NumberFormat(p||void 0,u),currency:!0}}catch{m={fmt:new Intl.NumberFormat(p||void 0,typeof r=="number"?{minimumFractionDigits:r,maximumFractionDigits:r}:{}),currency:!1}}y.set(f,m)}return m}function g(p,i){const r=i||{},f=r.nullDisplay??"",m=D(p);if(!m)return f;const u=U(r.display)||m.code;let b=m.amount,a=m.code;if(u!==m.code){const v=r.rateFn||j(r.rates,r.rateBase),A=k(m,u,v);if(A===null)return`${r.missingRate??K} ${m.code}→${u}`;b=A,a=u}const{fmt:h,currency:w}=l(r.locale,a,r.decimals);return w?h.format(b):`${h.format(b)} ${a}`}function s(p){const i=D(p);return i?`${i.amount} ${i.code}`:""}function t(p){const i=p||{},r=U(i.display),f=i.rateFn||j(i.rates,i.rateBase);return(m,u)=>{const b=D(m),a=D(u);if(!b&&!a)return 0;if(!b)return 1;if(!a)return-1;if(r){const h=k(b,r,f),w=k(a,r,f);if(h!==null&&w!==null)return h===w?0:h<w?-1:1}return b.code===a.code?b.amount===a.amount?0:b.amount<a.amount?-1:1:b.code<a.code?-1:1}}function o(p){const i=p||{},r=(m,u)=>{const b=[];for(const A of m||[]){const H=D(A);H&&b.push(H)}if(!b.length)return null;if(new Set(b.map(A=>A.code)).size===1){const A=b[0].code;return{amount:u(b.map(H=>H.amount)),code:A}}const h=U(i.display);if(!h)return`${i.missingRate??K}: mixed currencies, no display currency set`;const w=i.rateFn||j(i.rates,i.rateBase),v=[];for(const A of b){const H=k(A,h,w);if(H===null)return`${i.missingRate??K}: ${A.code}→${h}`;v.push(H)}return{amount:u(v),code:h}},f=m=>m.reduce((u,b)=>u+b,0);return{sum:m=>r(m,f),avg:m=>r(m,u=>f(u)/u.length),min:m=>r(m,u=>Math.min(...u)),max:m=>r(m,u=>Math.max(...u))}}function c(p){const i=Object.freeze({code:"USD",...p||{}}),r=j(i.rates,i.rateBase),f=Object.freeze({...i,rateFn:r}),m=o(f),u=t(f),b=new Map([[i.locale||"",f]]),a=v=>{const A=v||"";let H=b.get(A);return H||(H=Object.freeze({...f,locale:v||void 0}),b.set(A,H)),H},h=z[U(i.display||i.code)]||"",w=typeof i.decimals=="number"&&i.decimals>0?`.${"0".repeat(i.decimals)}`:".00";return{base:"object",extends:"object",storage:"object",name:"currency",currencyConfig:f,format:v=>g(v.value,v.locale?a(v.locale):f),parse:v=>I(v.text,v.locale?a(v.locale):f),compare:u,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:m},excel:i.excel||(h?`"${h}"#,##0${w}`:`#,##0${w}`),toStorage:v=>{const A=D(v);return A||(typeof v=="string"||typeof v=="number"?I(v,f):null)},toClipboard:v=>s(v),fromClipboard:v=>I(v,f)}}const d=Object.freeze({currency:c({code:"USD"}),usd:c({code:"USD"}),eur:c({code:"EUR"}),gbp:c({code:"GBP"}),jpy:c({code:"JPY",decimals:0})}),n=c}),ze("packages/core/src/columns/types/index.js",function(e,_){"use strict";Object.defineProperty(e,"EXTENDED_TYPES",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return G}});const ne=_("packages/core/src/columns/types/temporal.js"),E=ne.TEMPORAL_TYPES,K=_("packages/core/src/columns/types/network.js"),U=K.NETWORK_TYPES,D=_("packages/core/src/columns/types/structured.js"),J=D.STRUCTURED_TYPES,z=_("packages/core/src/columns/types/unit.js"),L=z.createUnitType,X=z.UNIT_SYSTEMS,I=z.parseUnit,j=z.formatUnit,k=z.registerUnitSystem,y=z.unitSystemNames,l=z.unitsOf,g=z.defineUnit,s=_("packages/core/src/columns/types/engineering.js"),t=s.ENGINEERING_TYPES,o=_("packages/core/src/columns/types/si.js"),c=o.SI_TYPES,d=o.createSiType,n=o.createSiSystem,p=o.siUnits,i=o.SI_PREFIXES,r=_("packages/core/src/columns/types/temperature.js"),f=r.TEMPERATURE_TYPES,m=r.createTemperatureType,u=r.convertTemperature,b=r.formatTemperature,a=r.parseTemperature,h=r.TEMPERATURE_SCALES,w=_("packages/core/src/columns/types/radix.js"),v=w.createRadixType,A=w.RADIX_PRESETS,H=w.parseRadix,G=w.formatRadix,Z=_("packages/core/src/columns/types/aggregable.js"),M=Z.AGGREGABLE_TYPES,S=_("packages/core/src/columns/types/currency.js"),T=S.CURRENCY_TYPES,O=S.createCurrencyType,N=S.parseMoney,P=S.formatMoney,C=S.convertMoney,B=S.toMoney,x=S.rateFunction,V=S.moneyComparator,Y=S.normaliseCode,F=S.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return z.findUnit}}),Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return s.ENGINEERING_TYPES}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return s.circularMean}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return r.TEMPERATURE_TYPES}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return r.createTemperatureType}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return r.convertTemperature}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return r.formatTemperature}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return r.parseTemperature}}),Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return r.TEMPERATURE_SCALES}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return r.findScale}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return S.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return S.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return S.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return S.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return S.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return S.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return S.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return S.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return S.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return S.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 K.NETWORK_TYPES}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return D.STRUCTURED_TYPES}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return Z.AGGREGABLE_TYPES}}),Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return Z.createLogarithmicType}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return Z.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 K.parseIpv4}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return K.formatIpv4}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return K.parseCidr}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return K.formatCidr}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return K.parseIpv6}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return K.formatIpv6}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return K.networkAddress}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return K.broadcastAddress}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return K.hostCount}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return K.containsAddress}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return K.overlaps}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return D.maskValue}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return D.summariseJson}});const $=Object.freeze({...E,...U,...J,...M,hex:v(A.hex),hex8:v(A.hex8),hex16:v(A.hex16),hex32:v(A.hex32),binary:v(A.binary),binary8:v(A.binary8),octal:v(A.octal),bytes:L({system:"data",unit:"B",display:"auto"}),megabytes:L({system:"data",unit:"MB"}),gigabytes:L({system:"data",unit:"GB"}),bitrate:L({system:"bitrate",unit:"Mbps"}),gigabits:L({system:"bitrate",unit:"Gbps"}),...t,...c,...f,...T});{const q=new Set;for(const ee of[E,U,J,M,t,c,f,T])for(const te of Object.keys(ee)){if(q.has(te))throw new Error(`[lattice] data type "${te}" is declared twice`);q.add(te)}}}),ze("packages/core/src/compute/handle.js",function(e,_){"use strict";Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return c}});const ne=_("packages/core/src/internal/compare.js"),E=ne.collator,K=ne.defaultCompare,D=_("packages/core/src/internal/warn.js").warnOnce;function J(d){const n=new Uint32Array(d);for(let p=0;p<d;p++)n[p]=p;return n}function z(d,n){if(n&&typeof n.count=="number")return n.count;if(!d)return 0;if(typeof d.count=="number")return d.count;if(typeof d.length=="number")return d.length;const p=d.values;return d.kind==="multi"&&d.offsets?Math.max(0,d.offsets.length-1):p?d.kind==="bitset"?typeof p.size=="number"?p.size:d.presence&&typeof d.presence.size=="number"?d.presence.size:(D(`count:${d.id}`,`column "${d.id}" is bitset-backed with no declared row count; assuming ${p.length*8}`),p.length*8):p.length:d.presence&&typeof d.presence.size=="number"?d.presence.size:0}const L=new WeakMap;function X(d){const n=d.constructor;if(!n)return"unknown";const p=L.get(n);if(p)return p;let i="unknown";try{let r=null;typeof n.from=="function"?r=n.from([!1,!0]):(r=new n(8),r.set(1));const f=r&&r.words;f&&f.length&&(f[0]===2?i="lsb":f[0]===64&&(i="msb"))}catch{i="unknown"}return L.set(n,i),i}function I(d){if(!d)return()=>0;const n=d instanceof Uint8Array?d:d.words;if(n instanceof Uint8Array){const p=d instanceof Uint8Array?"lsb":X(d);if(p==="lsb")return i=>n[i>>>3]>>>(i&7)&1;if(p==="msb")return i=>n[i>>>3]>>>7-(i&7)&1}return typeof d.get=="function"?p=>d.get(p)?1:0:()=>0}function j(d){return!d||!d.presence?null:I(d.presence)}function k(d){return d?typeof d.size=="number"?d.size:typeof d.values=="function"?d.values().length:0:0}function y(d,n){return d?typeof d.valueOf=="function"?d.valueOf(n):typeof d.values=="function"?d.values()[n]:null:null}function l(d,n){const p=d.offsets,i=d.values;if(!p||!i)return[];const r=p[n],f=p[n+1];if(!(f>r))return[];const m=d.dict,u=new Array(f-r);for(let b=r;b<f;b++)u[b-r]=m?y(m,i[b]):i[b];return u}function g(d){if(!d)return()=>{};const n=d.values,p=j(d),i=d.kind;if(i==="dictionary"){const r=d.dict;return p?f=>p(f)?y(r,n[f]):null:f=>y(r,n[f])}if(i==="bitset"){const r=I(n);return p?f=>p(f)?r(f)===1:null:f=>r(f)===1}if(i==="multi")return p?r=>p(r)?l(d,r):null:r=>l(d,r);if(!n&&typeof d.get=="function"){const r=d.get.bind(d);return f=>{const m=r(f);return m===void 0?null:m}}return p?r=>{if(!p(r))return null;const f=n[r];return f===void 0?null:f}:r=>{const f=n[r];return f===void 0?null:f}}function s(d,n){if(d<n)return-1;if(d>n)return 1;if(d===n){const r=Object.is(d,-0),f=Object.is(n,-0);return r===f?0:r?-1:1}const p=Number.isNaN(d),i=Number.isNaN(n);return p&&i?0:p?1:-1}function t(d){const n=E(d);return(p,i)=>{if(p===i)return 0;const r=typeof p,f=typeof i;if(r==="string"&&f==="string")return n.compare(p,i);if(r==="number"&&f==="number")return s(p,i);if(r==="boolean"&&f==="boolean")return p===i?0:p?1:-1;if(p instanceof Date||i instanceof Date){const m=p instanceof Date?p.getTime():Number(p),u=i instanceof Date?i.getTime():Number(i);return s(m,u)}return K(p,i)}}function o(d,n){if(d&&typeof d.ranks=="function")return d.ranks(n);const p=d&&typeof d.values=="function"?d.values():[],i=p.length,r=t(n),f=new Array(i);for(let u=0;u<i;u++)f[u]=u;f.sort((u,b)=>r(p[u],p[b])||u-b);const m=new Uint32Array(i);for(let u=0;u<i;u++)m[f[u]]=u;return m}function c(d){return d==null||typeof d=="number"&&Number.isNaN(d)}}),ze("packages/core/src/compute/filter.js",function(e,_){"use strict";Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"wallMs",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return Ae}});const E=_("packages/core/src/internal/predicates.js").isBlank,U=_("packages/core/src/internal/merge.js").toArray,J=_("packages/core/src/internal/warn.js").warnOnce,z=_("packages/core/src/format/date.js"),L=z.toDate,X=z.toIsoDate,I=_("packages/core/src/compute/handle.js"),j=I.bitReader,k=I.dictSize,y=I.dictValue,l=I.presenceReader,g=I.valueComparator,s=I.valueReader,t=/^\d{4}-\d{2}-\d{2}$/,o="\0null\0";function c(de,Oe){const Me=de&&de.pool;if(Me){const Fe=Me.mask||Me.acquireMask||Me.acquire||Me.take;if(typeof Fe=="function"){const pe=Fe.call(Me,Oe);if(pe&&pe.length>=Oe)return pe}}return new Uint8Array(Oe)}function d(de,Oe){const Me=de&&de.pool;if(!Me||!Oe)return;const Fe=Me.release||Me.releaseMask||Me.free||Me.recycle;typeof Fe=="function"&&Fe.call(Me,Oe)}function n(de,Oe,Me){return de.fill(Me,0,Oe),de}function p(de){return de==null||typeof de=="number"&&Number.isNaN(de)}function i(de,Oe){if(de==null)return de;if(Oe==="number")return typeof de=="number"?de:Number(de);if(Oe==="date"||Oe==="dateString"){const Me=X(de);return Me===null?r(de):Me}return Oe==="boolean"?typeof de=="boolean"?de:de==="true"||de===1?!0:de==="false"||de===0?!1:!!de:de}function r(de){return de instanceof Date?de.getTime():typeof de=="number"?de:Date.parse(String(de))}function f(de){return typeof de=="number"?de:de instanceof Date?de.getTime():de==null||de===""?NaN:Number(de)}function m(de,Oe){const Me=typeof de=="string"?de:String(de);return Oe?Me:Me.toLowerCase()}function u(de,Oe){return de==null?o:typeof de=="string"?Oe?de:de.toLowerCase():de instanceof Date?de.getTime():de}function b(de,Oe,Me){const Fe=new Set;for(const pe of U(de)){const ae=i(pe,Me);Fe.add(u(ae,Oe)),typeof ae=="string"&&ae!==""&&Number.isFinite(Number(ae))?Fe.add(Number(ae)):typeof ae=="number"&&Number.isFinite(ae)&&Fe.add(u(String(ae),Oe))}return Fe}function a(de,Oe,Me){if(de==null||Oe===null||Oe===void 0)return de==null&&Oe==null;const Fe=typeof de,pe=typeof Oe;return Fe==="string"&&pe==="string"?Me?de===Oe:de.toLowerCase()===Oe.toLowerCase():de instanceof Date||Oe instanceof Date?r(de)===r(Oe):Fe==="number"&&pe==="number"?de===Oe||Number.isNaN(de)&&Number.isNaN(Oe):Fe==="number"&&pe==="string"?de===Number(Oe):Fe==="string"&&pe==="number"?Number(de)===Oe:Fe==="boolean"||pe==="boolean"?de===Oe:Array.isArray(de)&&Array.isArray(Oe)?de.length===Oe.length&&de.every((ae,ge)=>a(ae,Oe[ge],Me)):de===Oe}function h(de,Oe){try{if(de instanceof RegExp){const Me=de.flags.replace(/[gy]/g,"");return new RegExp(de.source,Oe||Me.includes("i")?Me:`${Me}i`)}return new RegExp(String(de),Oe?"":"i")}catch(Me){return J(`regex:${String(de)}`,`filter operator "matches" received an invalid pattern: ${String(de)}`,Me),null}}function w(de,Oe){if(de&&de.type==="datetime"&&v.has(de.op))return M(de,Oe);const Me=S(de,Oe),Fe=de&&de.type;return Fe!=="date"&&Fe!=="dateString"?Me:pe=>Me(typeof pe=="string"&&t.test(pe)?pe:X(pe)??pe)}const v=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn"]),A=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3})\d*)?)?)?$/,H=new Map;function G(de,Oe){let Me=H.get(Oe);if(Me===void 0){try{Me=new Intl.DateTimeFormat("en-CA",{timeZone:Oe,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{Me=null}H.set(Oe,Me)}if(!Me)return null;const Fe={};for(const pe of Me.formatToParts(de))pe.type!=="literal"&&(Fe[pe.type]=pe.value);return Fe}function Z(de,Oe){if(de==null||de==="")return null;if(typeof de=="string"){const ae=A.exec(de.trim());if(ae)return Date.UTC(+ae[1],+ae[2]-1,+ae[3],+(ae[4]||0),+(ae[5]||0),+(ae[6]||0),+(ae[7]||"0").padEnd(3,"0"))}const Me=L(de);if(!Me)return null;const Fe=Me.getUTCMilliseconds(),pe=Oe?G(Me,Oe):null;return pe?Date.UTC(+pe.year,+pe.month-1,+pe.day,pe.hour==="24"?0:+pe.hour,+pe.minute,+pe.second,Fe):Date.UTC(Me.getFullYear(),Me.getMonth(),Me.getDate(),Me.getHours(),Me.getMinutes(),Me.getSeconds(),Fe)}function M(de,Oe){const Me=typeof de.timeZone=="string"&&de.timeZone?de.timeZone:void 0,Fe=ge=>Z(ge,Me),pe=Array.isArray(de.value)?de.value.map(Fe):Fe(de.value),ae=S({...de,type:"number",value:pe},Oe);return ge=>ae(Z(ge))}function S(de,Oe){const Me=de&&de.op,Fe=!!(de&&de.caseSensitive),pe=de&&de.type,ae=g(Oe),ge=ve=>le=>!ve(le);switch(Me){case"eq":{const ve=i(de.value,pe);return le=>a(le,ve,Fe)}case"ne":{const ve=i(de.value,pe);return le=>!a(le,ve,Fe)}case"lt":case"lte":case"gt":case"gte":{const ve=i(de.value,pe);if(p(ve))return()=>!1;const le=Me==="lt"?-1:Me==="lte"?0:Me==="gt"?1:2;return we=>{if(p(we))return!1;const he=ae(we,ve);return le===-1?he<0:le===0?he<=0:le===1?he>0:he>=0}}case"between":case"notBetween":{const ve=U(de.value),le=i(ve[0],pe),we=i(ve[1],pe),he=de.bounds||"[]",be=he.charAt(0)!=="(",Te=he.charAt(1)!==")";if(p(le)||p(we))return Me==="between"?()=>!1:()=>!0;const je=ke=>{if(p(ke))return!1;const Ue=ae(ke,le),Re=ae(ke,we);return(be?Ue>=0:Ue>0)&&(Te?Re<=0:Re<0)};return Me==="between"?je:ge(je)}case"in":case"notIn":{const ve=b(de.value,Fe,pe),le=we=>ve.has(u(we,Fe));return Me==="in"?le:ge(le)}case"contains":case"notContains":{const ve=m(i(de.value,pe),Fe),le=we=>we==null?!1:m(we,Fe).includes(ve);return Me==="contains"?le:ge(le)}case"startsWith":{const ve=m(i(de.value,pe),Fe);return le=>le==null?!1:m(le,Fe).startsWith(ve)}case"endsWith":{const ve=m(i(de.value,pe),Fe);return le=>le==null?!1:m(le,Fe).endsWith(ve)}case"matches":{const ve=h(de.value,Fe);return ve?le=>le==null?!1:ve.test(String(le)):()=>!1}case"blank":case"notBlank":{const ve=de.trim===!0,le=we=>E(we)||Array.isArray(we)&&we.length===0||ve&&typeof we=="string"&&we.trim()==="";return Me==="blank"?le:we=>!le(we)}case"containsAny":case"containsNone":{const ve=b(de.value,Fe,pe),le=we=>{const he=we==null?[]:U(we);for(let be=0;be<he.length;be++)if(ve.has(u(he[be],Fe)))return!0;return!1};return Me==="containsAny"?le:ge(le)}case"containsAll":{const ve=U(de.value).map(le=>u(i(le,pe),Fe));return le=>{const we=le==null?[]:U(le);if(ve.length===0)return!0;const he=new Set(we.map(be=>u(be,Fe)));for(let be=0;be<ve.length;be++)if(!he.has(ve[be]))return!1;return!0}}default:{const ve=Ae(Me);return ve?ve.compile(de.value):(J(`op:${String(Me)}`,`unknown filter operator "${String(Me)}"; the condition is refused rather than matching every row`),()=>!1)}}}function T(de,Oe,Me){return w(Oe,Me)(de)}const O=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),N=new Set(["containsAny","containsAll","containsNone"]);function P(de,Oe,Me){const Fe=de&&de.op,pe=O[Fe]||Fe,ae=w({...de,op:pe,type:Oe.type},Me),ge=Oe.items,ve=le=>{const we=ge(le);if(!we)return!1;for(let he=0;he<we.length;he++)if(ae(we[he]))return!0;return!1};return O[Fe]?le=>!ve(le):ve}function C(de,Oe,Me,Fe,pe){const ae=pe?null:l(de);if(ae){const le=Oe?1:0;for(let we=0;we<Fe;we++)Me[we]=ae(we)===le?1:0;return Me}const ge=de.kind;if(ge==="float64"||ge==="int32"||ge==="bitset")return n(Me,Fe,Oe?1:0);const ve=s(de);for(let le=0;le<Fe;le++){const we=ve(le),he=E(we)||Array.isArray(we)&&we.length===0||pe&&typeof we=="string"&&we.trim()==="";Me[le]=he===Oe?0:1}return Me}function B(de,Oe,Me,Fe){const pe=de.dict,ae=k(pe),ge=new Uint8Array(ae);for(let he=0;he<ae;he++)ge[he]=Oe(y(pe,he))?1:0;const ve=de.values,le=l(de);if(!le){for(let he=0;he<Fe;he++)Me[he]=ge[ve[he]];return Me}const we=Oe(null)?1:0;for(let he=0;he<Fe;he++)Me[he]=le(he)===1?ge[ve[he]]:we;return Me}function x(de,Oe,Me,Fe){const pe=j(de.values),ae=Oe(!0)?1:0,ge=Oe(!1)?1:0,ve=l(de);if(!ve){for(let we=0;we<Fe;we++)Me[we]=pe(we)===1?ae:ge;return Me}const le=Oe(null)?1:0;for(let we=0;we<Fe;we++)Me[we]=ve(we)===0?le:pe(we)===1?ae:ge;return Me}function V(de,Oe,Me,Fe,pe){const ae=de.values,ge=Oe.type,ve=Oe.op;let le=!0;switch(ve){case"eq":case"ne":{const he=f(i(Oe.value,ge)),be=typeof Oe.value=="number"&&Number.isNaN(Oe.value),Te=ve==="ne"?1:0;if(be)for(let je=0;je<pe;je++)Fe[je]=(Number.isNaN(ae[je])?1:0)^Te;else for(let je=0;je<pe;je++)Fe[je]=(ae[je]===he?1:0)^Te;break}case"lt":{const he=f(i(Oe.value,ge));for(let be=0;be<pe;be++)Fe[be]=ae[be]<he?1:0;break}case"lte":{const he=f(i(Oe.value,ge));for(let be=0;be<pe;be++)Fe[be]=ae[be]<=he?1:0;break}case"gt":{const he=f(i(Oe.value,ge));for(let be=0;be<pe;be++)Fe[be]=ae[be]>he?1:0;break}case"gte":{const he=f(i(Oe.value,ge));for(let be=0;be<pe;be++)Fe[be]=ae[be]>=he?1:0;break}case"between":case"notBetween":{const he=U(Oe.value),be=f(i(he[0],ge)),Te=f(i(he[1],ge)),je=Oe.bounds||"[]",ke=je.charAt(0)!=="(",Ue=je.charAt(1)!==")",Re=ve==="notBetween"?1:0;if(ke&&Ue)for(let Ee=0;Ee<pe;Ee++)Fe[Ee]=(ae[Ee]>=be&ae[Ee]<=Te?1:0)^Re;else if(ke)for(let Ee=0;Ee<pe;Ee++)Fe[Ee]=(ae[Ee]>=be&ae[Ee]<Te?1:0)^Re;else if(Ue)for(let Ee=0;Ee<pe;Ee++)Fe[Ee]=(ae[Ee]>be&ae[Ee]<=Te?1:0)^Re;else for(let Ee=0;Ee<pe;Ee++)Fe[Ee]=(ae[Ee]>be&ae[Ee]<Te?1:0)^Re;break}case"in":case"notIn":{const he=new Set;for(const Te of U(Oe.value)){const je=f(i(Te,ge));Number.isNaN(je)||he.add(je)}const be=ve==="notIn"?1:0;for(let Te=0;Te<pe;Te++)Fe[Te]=(he.has(ae[Te])?1:0)^be;break}default:le=!1;break}if(!le)return!1;const we=l(de);if(we){const he=Me(null)?1:0;for(let be=0;be<pe;be++)we(be)===0&&(Fe[be]=he)}return!0}function Y(de,Oe,Me,Fe){const pe=s(de);for(let ae=0;ae<Fe;ae++)Me[ae]=Oe(pe(ae))?1:0;return Me}function F(de,Oe,Me){const Fe=Oe.count|0,pe=Me||c(Oe,Fe);if(!de)return n(pe,Fe,1);const ae=typeof Oe.handle=="function"?Oe.handle(de.col):void 0,ge=typeof Oe.custom=="function"?Oe.custom:null;if(!ae){if(ge){for(let he=0;he<Fe;he++)pe[he]=ge(de,he)?1:0;return pe}return J(`filter:col:${String(de.col)}`,`filter references unknown column "${String(de.col)}"; the condition is refused rather than matching every row`),n(pe,Fe,0)}const ve=de.op;if(ve==="blank"||ve==="notBlank")return C(ae,ve==="notBlank",pe,Fe,de.trim===!0);const le=typeof Oe.itemwise=="function"?Oe.itemwise(de.col):null;if(le&&!Ae(ve)&&!N.has(ve))return Y(ae,P(de,le,Oe.locale),pe,Fe);const we=w(de,Oe.locale);switch(ae.kind){case"dictionary":return B(ae,we,pe,Fe);case"bitset":return x(ae,we,pe,Fe);case"float64":case"int32":return V(ae,de,we,pe,Fe)?pe:Y(ae,we,pe,Fe);default:return Y(ae,we,pe,Fe)}}function $(de,Oe,Me){if(!de)return n(c(Oe,Me),Me,1);if(Array.isArray(de.conditions)){const Fe=de.conditions.filter(ge=>ge!=null),pe=de.op==="or"?"or":de.op==="not"?"not":"and";if(Fe.length===0)return n(c(Oe,Me),Me,1);const ae=$(Fe[0],Oe,Me);for(let ge=1;ge<Fe.length;ge++){const ve=$(Fe[ge],Oe,Me);if(pe==="or")for(let le=0;le<Me;le++)ae[le]|=ve[le];else for(let le=0;le<Me;le++)ae[le]&=ve[le];d(Oe,ve)}if(pe==="not")for(let ge=0;ge<Me;ge++)ae[ge]^=1;return ae}return F(de,Oe,c(Oe,Me))}function q(de,Oe){return $(de,Oe,Oe.count|0)}function ee(de,Oe){if(!de||!Oe)return de||null;const Me=de;if(Array.isArray(Me.conditions)){if((Me.op==="or"?"or":Me.op==="not"?"not":"and")!=="and")return te(Me,Oe)?null:de;const pe=[];for(const ae of Me.conditions){const ge=ee(ae,Oe);ge&&pe.push(ge)}return pe.length?{...Me,op:"and",conditions:pe}:null}return Me.col===Oe?null:de}function te(de,Oe){if(!de||typeof de!="object")return!1;const Me=de;if(Me.col===Oe)return!0;if(Array.isArray(Me.conditions)){for(const Fe of Me.conditions)if(te(Fe,Oe))return!0}return!1}function re(de,Oe,Me){if(Me&&Me.length>=Oe){let ge=0;for(let ve=0;ve<Oe;ve++)de[ve]&&(Me[ge++]=ve);return Me.subarray(0,ge)}let Fe=0;for(let ge=0;ge<Oe;ge++)Fe+=de[ge]?1:0;const pe=new Uint32Array(Fe);let ae=0;for(let ge=0;ge<Oe;ge++)de[ge]&&(pe[ae++]=ge);return pe}const ie=new Map;function ue(de){if(!(!de||typeof de!="object"))for(const[Oe,Me]of Object.entries(de))Me&&typeof Me.compile=="function"&&ie.set(Oe,Me)}function Ae(de){return typeof de=="string"?ie.get(de):void 0}}),ze("packages/core/src/columns/datatypes.js",function(e,_){"use strict";Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"parseNumberText",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"BUILTIN_TYPES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return P}});const ne=_("packages/core/src/internal/compare.js"),E=ne.collator,K=ne.defaultCompare,U=_("packages/core/src/internal/predicates.js"),D=U.isNil,J=U.isObject,z=U.isFunction,X=_("packages/core/src/internal/warn.js").fail,j=_("packages/core/src/internal/text.js").titleCase,k=_("packages/core/src/format/date.js"),y=k.toDate,l=k.toIsoDate,g=k.compareIso,t=_("packages/core/src/format/boolean.js").toTriState,c=_("packages/core/src/columns/types/index.js").EXTENDED_TYPES,d=_("packages/core/src/formula/index.js"),n=d.evaluateFormula,p=d.looksLikeFormula,r=_("packages/core/src/compute/filter.js").declareOperators,f=/^\d{4}-\d{2}-\d{2}$/;function m(C){return C.getHours()===0&&C.getMinutes()===0&&C.getSeconds()===0&&C.getMilliseconds()===0}const u=new Map;function b(C){const B=C||"",x=u.get(B);if(x)return x;const V={group:",",decimal:"."};try{for(const Y of new Intl.NumberFormat(C||void 0).formatToParts(12345.6))Y.type==="group"?V.group=Y.value:Y.type==="decimal"&&(V.decimal=Y.value)}catch{}return u.set(B,V),V}const a=/\d\s*[*/^]\s*[\d.(]/;function h(C,B){if(D(C))return null;let x=String(C).trim();if(x===""||x.startsWith("=")||a.test(x))return null;let V=1;x.startsWith("(")&&x.endsWith(")")&&(V=-1,x=x.slice(1,-1));const Y=x.endsWith("%"),{group:F,decimal:$}=b(B);if(x=x.replace(/[\s\u00a0\u202f\u2009']/g,""),F&&F!=="."&&F!==","&&(x=x.split(F).join("")),x=x.replace(/[^0-9eE+\-.,]/g,""),$===","?x=x.split(".").join("").replace(",","."):x=x.split(",").join(""),x===""||x==="-"||x==="+")return null;const q=Number(x);return Number.isNaN(q)?null:V*(Y?q/100:q)}function w(C,B){const x=D(C)||Number.isNaN(C)?null:Number(C),V=D(B)||Number.isNaN(B)?null:Number(B);return x===null?V===null?0:1:V===null||x<V?-1:x>V?1:0}function v(C,B){const x=t(C),V=t(B);return x===null?V===null?0:1:V===null?-1:x===V?0:x?1:-1}function A(C,B){const x=y(C),V=y(B);if(!x)return V?1:0;if(!V)return-1;const Y=x.getTime(),F=V.getTime();return Y<F?-1:Y>F?1:0}const H=new Map;function G(C){const B=y(C.value);if(!B)return"";const x=C.locale||"";let V=H.get(x);return V||(V=new Intl.DateTimeFormat(C.locale||void 0,{dateStyle:"medium"}),H.set(x,V)),V.format(B)}const Z={boolean:{base:"boolean",storage:"bitset",matches:C=>typeof C=="boolean",parse:C=>t(C.text),compare:v,format:C=>t(C.value)===null?"":t(C.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:C=>t(C)===null?"":String(t(C)),fromClipboard:C=>t(C)},number:{base:"number",storage:"float64",matches:C=>typeof C=="number"&&!Number.isNaN(C),parse:C=>{if(p(C.text)){const B=n(C.text,C);if(!B.ok)return null;const x=Number(B.value);return Number.isFinite(x)?x:null}return h(C.text,C.locale)},compare:w,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:C=>D(C)?"":String(C),fromClipboard:(C,B)=>h(C,B&&B.locale)},date:{base:"dateString",storage:"dictionary",matches:C=>typeof C=="string"&&f.test(C)&&!Number.isNaN(Date.parse(C))||C instanceof Date&&!Number.isNaN(C.getTime())&&m(C),parse:C=>l(C.text),compare:g,format:G,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:C=>l(C),toClipboard:C=>D(C)?"":String(C),fromClipboard:C=>l(C)},dateString:{base:"dateString",storage:"dictionary",matches:C=>typeof C=="string"&&f.test(C)&&!Number.isNaN(Date.parse(C)),parse:C=>l(C.text),compare:g,format:G,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:C=>l(C),toClipboard:C=>D(C)?"":String(C),fromClipboard:C=>l(C)},text:{base:"text",storage:"dictionary",matches:C=>typeof C=="string",parse:C=>C.text===""?null:String(C.text),compare:(C,B)=>D(C)?D(B)?0:1:D(B)?-1:E().compare(String(C),String(B)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:C=>D(C)?"":String(C),fromClipboard:C=>C},image:{base:"text",storage:"dictionary",parse:C=>C.text===""||C.text==null?null:String(C.text).trim(),compare:(C,B)=>D(C)?D(B)?0:1:D(B)?-1:E().compare(String(C),String(B)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:C=>D(C)?"":String(C),fromClipboard:C=>C},lookup:{base:"text",storage:"dictionary",parse:C=>{if(C.text===""||C.text==null)return null;const B=C.column&&C.column.lookup,x=B&&z(B.options)?B.options():null;if(!x)return C.text;const V=String(C.text),Y=x.find(q=>String(q.id)===V);if(Y)return Y.id;const F=V.trim().toLowerCase(),$=x.find(q=>String(q.label).toLowerCase()===F);return $?$.id:C.text},compare:K,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:C=>D(C)?"":String(C),fromClipboard:C=>C},object:{base:"object",storage:"object",matches:C=>C!==null&&typeof C=="object"&&!(C instanceof Date),parse:C=>{try{return C.text===""?null:JSON.parse(C.text)}catch{return C.text}},compare:(C,B)=>K(C,B),format:C=>{const B=C.value;if(D(B))return"";if(typeof B=="string")return B;try{return JSON.stringify(B)}catch{return String(B)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:C=>D(C)?"":typeof C=="string"?C:JSON.stringify(C),fromClipboard:C=>C}},M=["boolean","number","date","dateString","datetime","text","object"];function S(C,B,x,V){const Y=x.get(C);if(Y)return Y;V.includes(C)&&X(`circular data type extends chain: ${[...V,C].join(" → ")}`);const F=B[C];F||X(`unknown data type "${C}"`);let $=null;F.extends&&($=S(F.extends,B,x,[...V,C]));const q={...$||{},...F,name:C,defaults:{...$&&$.defaults||{},...F.defaults||{}}};return q.base||(q.base=$&&$.base||"text"),q.storage||(q.storage=$&&$.storage||"object"),x.set(C,q),q}function T(C,B){const x={...Z,...c};if(B&&typeof B.dataType=="function"&&typeof B.names=="function")for(const Y of B.names("dataType")){const F=B.dataType(Y);F&&(x[Y]=F)}if(J(C))for(const[Y,F]of Object.entries(C))x[Y]=F;const V=new Map;for(const Y of M)S(Y,x,V,[]);S("lookup",x,V,[]);for(const Y of Object.keys(x))S(Y,x,V,[]);for(const Y of V.values())r(Y.operators);return V}function O(C,B){if(C.base==="text"&&(!C.compare||C.compare===Z.text.compare)){const x=E(B);return(V,Y)=>D(V)?D(Y)?0:1:D(Y)?-1:x.compare(String(V),String(Y))}return C.compare||K}function N(C,B){return B?C.multiStorage||"multi":C.storage||"object"}function P(C){return j(String(C).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),ze("packages/core/src/columns/infer.js",function(e,_){"use strict";Object.defineProperty(e,"DEFAULT_SAMPLE",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"inferFromValues",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return z}});const E=_("packages/core/src/internal/warn.js").infoOnce,U=_("packages/core/src/internal/predicates.js").isNil,D=100;function J(L,X,I={}){const j=I.sampleSize??D,k=[];for(let y=0;y<L.length&&k.length<j;y++){const l=L[y];U(l)||typeof l=="number"&&Number.isNaN(l)||k.push(l)}if(k.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[y,l]of X){if(typeof l.matches!="function")continue;let g=!0;for(let s=0;s<k.length;s++)if(!l.matches(k[s])){g=!1;break}if(g)return{type:y,unanimous:!0,sampled:k.length}}return I.quiet||E(`infer:${I.colId||"?"}`,`column "${I.colId||"?"}" has mixed or ambiguous values and was inferred as "text". Declare \`type\` on the column to get correct sorting, filtering and export.`),{type:"text",unanimous:!1,sampled:k.length}}function z(L,X,I,j,k={}){const y=k.sampleSize??D,l=[];for(let g=0;g<X.length&&l.length<y;g++){const s=I(X[g]);U(s)||typeof s=="number"&&Number.isNaN(s)||l.push(s)}return J(l,j,{...k,colId:L}).type}}),ze("packages/core/src/columns/graph.js",function(e,_){"use strict";Object.defineProperty(e,"WHOLE_ROW",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"declarationOf",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return j}});const ne=_("packages/core/src/internal/warn.js"),E=ne.DEV,K=ne.fail,U=ne.warnOnce,J=_("packages/core/src/internal/predicates.js").isFunction,z="*";function L(k){const y=k.value||{};if(!J(y.compute))return{computed:!1,wholeRow:!1,deps:[],pure:!0};const g=y.pure!==!1;return y.deps===z?{computed:!0,wholeRow:!0,deps:[],pure:g}:Array.isArray(y.deps)?{computed:!0,wholeRow:!1,deps:y.deps.slice(),pure:g}:(U(`deps:missing:${k.id}`,`computed column "${k.id}" declares no \`value.deps\`; treating it as \`deps: '*'\` (a whole-row dependency). Declare the dependencies to get precise invalidation.`),{computed:!0,wholeRow:!0,deps:[],pure:g})}function X(k){const y=new Map;for(const f of k)y.set(f.id,f);const l=new Map,g=new Map,s=new Set,t=new Set,o=new Set,c=new Set;for(const f of k){const m=L(f);if(!m.computed){l.set(f.id,[]);continue}t.add(f.id),(m.pure?o:c).add(f.id),m.wholeRow&&s.add(f.id);const u=[],b=[];for(const a of m.deps)(y.has(a)?u:b).push(a);l.set(f.id,u),b.length&&g.set(f.id,b)}for(const f of o)for(const m of l.get(f))c.has(m)&&K(`pure computed column "${f}" depends on impure column "${m}". Mark it \`value.pure: false\` or make the dependency pure.`);const d=[],n=new Map,p=[],i=f=>{const m=n.get(f);if(m!=="done"){if(m==="open"){const u=p.indexOf(f);K(`circular column dependency: ${[...p.slice(u),f].join(" → ")}`)}n.set(f,"open"),p.push(f);for(const u of l.get(f)||[])y.has(u)&&i(u);p.pop(),n.set(f,"done"),d.push(f)}};for(const f of k)i(f.id);const r=new Map;for(const f of k)r.set(f.id,[]);for(const f of k)for(const m of l.get(f.id)||[]){const u=r.get(m);u&&!u.includes(f.id)&&u.push(f.id)}if(s.size)for(const f of k){if(t.has(f.id))continue;const m=r.get(f.id);for(const u of s)m.includes(u)||m.push(u)}return{order:d,dependents:r,pure:o,impure:c,computed:t,deps:l,wholeRow:s,external:g,index:y}}function I(k,y){const l=Array.isArray(y)?y:[y],g=new Set,s=[...l];for(;s.length;){const t=s.shift();for(const o of k.dependents.get(t)||[])g.has(o)||(g.add(o),s.push(o))}for(const t of l)g.delete(t);return k.order.filter(t=>g.has(t))}function j(k,y,l){if(!E)return k;const g=y instanceof Set?y:new Set(y);return new Proxy(k,{get(s,t){return typeof t=="string"&&!g.has(t)&&!Object.hasOwn(s,t)&&U(`undeclared:${l}:${t}`,`computed column "${l}" read undeclared dependency "${t}". Add it to \`value.deps\` or the value will go stale.`),s[t]}})}}),ze("packages/core/src/model/rowkey.js",function(e,_){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"compositeKey",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createRowKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"warnMissingKeys",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"groupPathKey",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"splitPathKey",{enumerable:!0,get:function(){return t}});const E=_("packages/core/src/internal/warn.js").warnOnce,U=_("packages/core/src/internal/paths.js").pathGetter,D=_("packages/core/src/internal/predicates.js"),J=D.isFunction,z=D.isBlank,L=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],X="";function I(o){if(o===null)return"\0n";if(o===void 0)return"\0u";const c=typeof o;if(c==="string")return o;if(c==="number"||c==="bigint"||c==="boolean")return String(o);if(o instanceof Date)return`\0d${o.getTime()}`;try{return`\0o${JSON.stringify(o)}`}catch{return"\0o?"}}function j(o){if(o.length===1)return I(o[0]);let c="";for(let d=0;d<o.length;d++)d&&(c+=X),c+=I(o[d]);return c}function k(o,c={}){const d=c.warn!==!1;if(J(o)){const n=o;return{stable:!0,fields:[],disabled:[],key(p,i){try{const r=n(p);return Array.isArray(r)?j(r):I(r)}catch(r){return E("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",r),`#${i??-1}`}},keyEmpty(p){try{const i=n(p);return Array.isArray(i)?i.length===0||i.some(z):z(i)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(o)&&o.length>0){const n=o.filter(r=>typeof r=="string"),p=n.map(r=>U(r)),i=p.length;return{stable:!0,fields:n,disabled:[],key(r){const f=new Array(i);for(let m=0;m<i;m++)f[m]=p[m](r);return j(f)},keyEmpty(r){for(let f=0;f<i;f++)if(z(p[f](r)))return!0;return!1},missingFields(r){const f=[];for(let m=0;m<i;m++)z(p[m](r))&&f.push(n[m]);return f}}}if(typeof o=="string"&&o.length>0){const n=U(o);return{stable:!0,fields:[o],disabled:[],key(p){return I(n(p))},keyEmpty(p){return z(n(p))},missingFields(p){return z(n(p))?[o]:[]}}}return d&&E("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${L.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:L.slice(),key(n,p){if(n===null||typeof n!="object")return`#${p??0}:${String(n)}`;let i=y.get(n);return i===void 0&&(i=`#${l++}`,y.set(n,i)),i}}}const y=new WeakMap;let l=0;function g(o,c){if(!o||o.stable===!1||!J(o.keyEmpty)||!Array.isArray(c)||c.length===0)return;let d=0,n=null,p;for(let m=0;m<c.length;m++){const u=c[m];o.keyEmpty(u)&&(d++,n===null&&(n=J(o.missingFields)?o.missingFields(u):[],p=u))}if(d===0)return;const i=o.fields.length?o.fields.join(","):"(function)",r=n&&n.length?n.join(", "):o.fields.length?o.fields.join(", "):"the rowKey function",f=p!==null&&typeof p=="object"?Object.keys(p).join(", ")||"(no fields)":String(p);E(`rowKey.emptyValue:${i}`,`rowKey ${r} is missing on ${d} of ${c.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 s(o){return j(o)}function t(o){return o.split(X)}}),ze("packages/core/src/columns/lookup.js",function(e,_){"use strict";Object.defineProperty(e,"DEFAULT_SEPARATOR",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"normaliseOption",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"Lookup",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"toValueArray",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createLookup",{enumerable:!0,get:function(){return o}});const ne=_("packages/core/src/internal/compare.js"),E=ne.collator,K=ne.defaultCompare,U=_("packages/core/src/internal/predicates.js"),D=U.isFunction,J=U.isNil,L=_("packages/core/src/internal/warn.js").warnOnce,I=_("packages/core/src/model/rowkey.js").compositeKey,j=", ",k="";function y(c,d,n,p){if(c===null||typeof c!="object")return{id:c,label:c==null?"":String(c)};const i=c[d],r=c[n],f={id:i,label:r==null?String(i??""):String(r)};c.disabled&&(f.disabled=!0),c.variant&&(f.variant=c.variant),c.icon&&(f.icon=c.icon);const m=p?c[p]:c.group;return m!==void 0&&(f.group=m),f}function l(c,d,n=0,p=[],i=[]){for(const r of c||[]){const f=r&&typeof r=="object"?r[d]:null;if(i.push({raw:r,depth:n,path:p}),Array.isArray(f)&&f.length){const m=String(r&&typeof r=="object"?r.label??r.name??r.id??"":r);l(f,d,n+1,[...p,m],i)}}return i}function g(c){return!!c&&typeof c=="object"&&!Array.isArray(c)&&D(c.router&&c.router.subscribe)}class s{#e;#t;#n;#r;#s=[];#i=new Map;#o=new Map;#l=0;#a="idle";#c=null;#u;#d=null;#f=new Map;constructor(d,n={}){this.#e=d||{},this.#t=n.colId||"?",this.#n=n.locale,this.#r=n.onChange||null,this.#u=E(this.#n),Array.isArray(this.#e.options)?this.#h(this.#e.options):this.#e.options===void 0&&(this.#a="ready")}get colId(){return this.#t}get version(){return this.#l}get state(){return this.#a}get ready(){return this.#a==="ready"}get multiple(){return this.#e.multiple===!0}get separator(){return this.#e.separator??j}get allowCustom(){return this.#e.allowCustom===!0}get sortBy(){return this.#e.sortBy||"label"}get spec(){return this.#e}options(){return this.#s}setLocale(d){this.#n=d,this.#u=E(d)}#h(d){const n=this.#e,p=n.valueKey||"id",i=n.labelKey||"label",r=n.childrenKey||"children";this.#s=l(d,r).map(f=>{const m=y(f.raw,p,i,n.groupKey);return f.depth&&(m.depth=f.depth,m.path=f.path),m}),this.#i=new Map,this.#o=new Map,this.#s.forEach((f,m)=>{this.#i.set(f.id,f),this.#o.set(f.id,m)}),this.#a="ready",this.#l+=1}load(){if(this.#c)return this.#c;const d=this.#e.options;if(Array.isArray(d)||d===void 0)return this.#c=Promise.resolve(this.#s),this.#c;if(g(d))return this.#c=this.#p(d),this.#c;if(!D(d))return L(`lookup:options:${this.#t}`,`column "${this.#t}" has an invalid \`lookup.options\`; expected an array, a function, or a router route`),this.#a="ready",this.#c=Promise.resolve([]),this.#c;this.#a="loading";let n;try{n=d()}catch(p){return this.#a="error",L(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,p),this.#c=Promise.resolve([]),this.#c}return!n||!D(n.then)?(this.#h(n),this.#c=Promise.resolve(this.#s),this.#r&&this.#r(this),this.#c):(this.#c=n.then(p=>(this.#h(p),this.#r&&this.#r(this),this.#s),p=>(this.#a="error",L(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,p),[])),this.#c)}refresh(){return this.#c=null,Array.isArray(this.#e.options)?(this.#h(this.#e.options),this.#r&&this.#r(this),Promise.resolve(this.#s)):this.load()}#p(d){if(this.#d)return Promise.resolve(this.#s);const n=this.#e,p=n.valueKey||"id",i=n.labelKey||"label",r=n.groupKey,f=D(d.map)?d.map:null,m=b=>y(f?f(b):b,p,i,r).id,u=b=>this.#m(b,f,p,i,r);return d.router.subscribe(d.predicate,u,{rowKey:m}),this.#d=()=>{D(d.router.detach)&&d.router.detach(u)},this.#a="ready",Promise.resolve(this.#s)}#m(d,n,p,i,r){const f=d&&d.add||[],m=d&&d.update||[],u=d&&d.remove||[];if(!(!f.length&&!m.length&&!u.length)){for(const b of f)this.#g(b,n,p,i,r);for(const b of m)this.#g(b,n,p,i,r);for(const b of u){if(!this.#f.has(b))continue;const a=this.#f.get(b);this.#f.delete(b),this.#i.delete(a);const h=this.#s.findIndex(w=>w.id===a);h>=0&&this.#s.splice(h,1)}this.#o=new Map(this.#s.map((b,a)=>[b.id,a])),this.#a="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(d,n,p,i,r){const f=y(n?n(d):d,p,i,r);this.#f.set(I([f.id]),f.id);const m=this.#s.findIndex(u=>u.id===f.id);m>=0?this.#s[m]=f:this.#s.push(f),this.#i.set(f.id,f)}destroy(){this.#d&&(this.#d(),this.#d=null)}search(d,n){const p=this.#e;if(!D(p.search)){const f=String(d||"").toLowerCase();return Promise.resolve(f===""?this.#s:this.#s.filter(m=>m.label.toLowerCase().includes(f)))}const i=p.valueKey||"id",r=p.labelKey||"label";return Promise.resolve(p.search(d,n)).then(f=>(f||[]).map(m=>y(m,i,r,p.groupKey)))}option(d){return this.#i.get(d)}has(d){return this.#i.has(d)}label(d){if(J(d)||d==="")return"";const n=this.#i.get(d);if(n)return n.label;if(this.#a==="loading"||this.#a==="idle")return"";this.allowCustom||L(`lookup:unknown:${this.#t}`,`column "${this.#t}" holds value ${JSON.stringify(d)} which is not in its lookup options. Showing the raw value; set \`lookup.unknownLabel\` or \`lookup.allowCustom\` to change that.`);const p=this.#e.unknownLabel;return D(p)?String(p(d)??""):typeof p=="string"?p:String(d)}text(d){if(this.multiple){const n=t(d);return n.length===0?"":n.map(p=>this.label(p)).join(this.separator)}return this.label(d)}dictionary(){return this.#s.map(d=>d.id)}sorted(){const d=this.sortBy;if(d==="optionOrder"||d==="count")return this.#s.slice();if(d==="value")return this.#s.slice().sort((p,i)=>K(p.id,i.id));const n=this.#u;return this.#s.slice().sort((p,i)=>n.compare(p.label,i.label))}comparator(){const d=this.sortBy,n=this.multiple,p=this.#u,i=this.#o;if(n&&d==="count")return(f,m)=>t(f).length-t(m).length;const r=n?f=>t(f)[0]:f=>f;return d==="value"?(f,m)=>K(r(f),r(m)):d==="optionOrder"?(f,m)=>{const u=i.has(r(f))?i.get(r(f)):Number.MAX_SAFE_INTEGER,b=i.has(r(m))?i.get(r(m)):Number.MAX_SAFE_INTEGER;return u-b}:(f,m)=>{const u=r(f),b=r(m);return J(u)?J(b)?0:1:J(b)?-1:p.compare(this.label(u),this.label(b))}}groupKey(d){return this.multiple?t(d).map(p=>String(p)).sort().join(k):J(d)?"":String(d)}countValues(d){return this.multiple?t(d).length:J(d)?0:1}contains(d,n,p){const i=this.multiple?t(d):J(d)?[]:[d],r=Array.isArray(n)?n:[n];switch(p){case"containsAll":return r.every(f=>i.includes(f));case"containsNone":return!r.some(f=>i.includes(f));default:return r.some(f=>i.includes(f))}}exportText(d,n="label"){return n==="value"?this.multiple?t(d).join(this.separator):J(d)?"":String(d):this.text(d)}exportColumns(){const d=this.multiple;return this.#s.map(n=>({id:n.id,label:n.label,has:p=>d?t(p).includes(n.id):p===n.id}))}}function t(c){return Array.isArray(c)?c:J(c)||c===""?[]:[c]}function o(c,d={}){const n=c.lookup;if(!n)return null;const p=new s(n,{colId:c.id,locale:d.locale,onChange:d.onChange});return!Array.isArray(n.options)&&n.options!==void 0&&p.load(),p}}),ze("packages/core/src/columns/value.js",function(e,_){"use strict";Object.defineProperty(e,"compileDisplay",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"warnImpureUse",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"ValuePipeline",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return s}});const E=_("packages/core/src/internal/paths.js").getPath,K=_("packages/core/src/internal/predicates.js"),U=K.isFunction,D=K.isNil,z=_("packages/core/src/internal/lru.js").Lru,X=_("packages/core/src/internal/warn.js").warnOnce,j=_("packages/core/src/columns/graph.js").depsProxy,k="\0";function y(d,n={}){const p=n.locale,i=n.grid??null,r=n.context,f=d.value&&d.value.format,m=d.formatter||null,u=d.dataType&&d.dataType.format,b=d.lookup||null,a=(h,w,v)=>({value:h,data:v,row:w,column:d,colId:d.id,grid:i,context:r,locale:p});if(U(f))return(h,w,v)=>{const A=f(a(h,w,v));return A==null?"":String(A)};if(m){if(b){const h=m.kind==="text";return(w,v,A)=>m(h?b.text(w):w,a(w,v,A))}return(h,w,v)=>m(h,a(h,w,v))}return U(u)?(h,w,v)=>{const A=u(a(h,w,v));return A==null?"":String(A)}:b?h=>b.text(h):h=>D(h)?"":typeof h=="string"?h:String(h)}function l(d,n){!d||!d.value||d.value.pure!==!1||X(`impure:${n}:${d.id}`,`column "${d.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${n}. The result is not stable across passes.`)}class g{#e;#t;#n;#r;#s;#i;#o=new z(4096);constructor(n){this.#e=n.columns instanceof Map?n.columns:new Map((n.columns||[]).map(p=>[p.id,p])),this.#t=n.graph,this.#n=n.grid??null,this.#r=n.context,this.#i=n.stored||null,this.#s=n.rowKey||s}get graph(){return this.#t}setGraph(n){this.#t=n,this.#o.clear()}beginPass(){this.#o.clear()}endPass(){this.#o.clear()}invalidate(n){if(this.#o.size===0)return;const p=n&&n.rows?new Set([...n.rows].map(String)):null,i=n&&n.columns?[...n.columns]:null;if(!p&&!i){this.#o.clear();return}const r=i?this.#l(i):null;for(const f of[...this.#o.keys()]){const m=String(f).split(k);m.length===3&&(p&&!p.has(m[0])||r&&!r.has(m[2])||this.#o.delete(f))}}#l(n){const p=new Set,i=this.#t,r=[...n];for(;r.length;){const f=r.pop();if(!p.has(f)){p.add(f);for(const m of i?i.dependents.get(f)||[]:[])r.push(m)}}return p}value(n,p,i){const r=typeof n=="string"?this.#e.get(n):n;if(!r)return;if(!r.computed)return this.#c(r,p,i);if(r.value.pure!==!1&&this.#i&&i&&i.physical!=null&&this.#i.has(r.id))return this.#i.get(r.id,i.physical);if(r.volatile)return this.compute(r,p,i);if(r.value.pure===!1)return this.compute(r,p,i);const f=`${this.#a(p,i)}${k}${r.id}`;if(this.#o.has(f))return this.#o.get(f);const m=this.compute(r,p,i);return this.#o.set(f,m),m}#a(n,p){return`${this.#s(n,p)}${k}${t(n)}`}#c(n,p,i){if(this.#i&&i&&i.physical!=null&&this.#i.has(n.id))return this.#i.get(n.id,i.physical);if(n.field)return n.read?n.read(p):E(p,n.field)}compute(n,p,i){const r=this.#t,f=r&&r.wholeRow.has(n.id);let m;if(f)m=p??{};else{m={};const b=r&&r.deps.get(n.id)||[];for(const h of b)m[h]=this.value(h,p,i);const a=r&&r.external.get(n.id)||[];for(const h of a)m[h]=E(p,h);m=j(m,[...b,...a],n.id)}const u={data:p,row:i,column:n,grid:this.#n,context:this.#r};return n.value.compute(m,u)}values(n,p){const i={},r=this.#t?this.#t.order:[...this.#e.keys()];for(const f of r)i[f]=this.value(f,n,p);return i}text(n,p,i){const r=typeof n=="string"?this.#e.get(n):n;return r?r.formatValue(this.value(r,p,i),i,p):""}key(n,p,i){const r=typeof n=="string"?this.#e.get(n):n;if(!r)return"";const f=this.value(r,p,i);return U(r.value.key)?String(r.value.key(this.#u(r,f,p,i))):r.lookup?r.lookup.groupKey(f):D(f)?"":String(f)}quickFilterText(n,p,i){const r=typeof n=="string"?this.#e.get(n):n;if(!r)return"";if(U(r.value.quickFilterText)){const f=this.value(r,p,i);return String(r.value.quickFilterText(this.#u(r,f,p,i))??"")}return this.text(r,p,i)}#u(n,p,i,r){return{value:p,data:i,row:r,column:n,colId:n.id,grid:this.#n,context:this.#r}}parse(n,p,i,r){const f=typeof n=="string"?this.#e.get(n):n;if(!f)return p;const m={text:p,value:this.value(f,i,r),data:i,row:r,column:f,grid:this.#n,context:this.#r,locale:this.#n&&U(this.#n.get)?this.#n.get("locale"):void 0,formulaFunctions:this.#n&&U(this.#n.get)?this.#n.get("formulaFunctions"):void 0};return U(f.value.parse)?f.value.parse(m):f.dataType&&U(f.dataType.parse)?f.dataType.parse(m):p}validate(n,p,i,r,f){const m=typeof n=="string"?this.#e.get(n):n;if(!m||!U(m.edit.validate))return!0;const u=m.edit.validate({value:p,oldValue:i,data:r,row:f,column:m,grid:this.#n,context:this.#r});return u===!0||u===void 0?!0:String(u)}apply(n,p,i,r){const f=typeof n=="string"?this.#e.get(n):n;if(!f)return!1;const m=this.value(f,i,r);if(U(f.value.apply)){const u=f.value.apply({value:p,oldValue:m,data:i,row:r,column:f,grid:this.#n,context:this.#r});return this.#d(f,i,r),u!==!1}return f.field?m===p?!1:(f.write(i,p),this.#d(f,i,r),!0):(X(`apply:${f.id}`,`column "${f.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(n,p,i,r){const f=typeof n=="string"?this.#e.get(n):n;if(!f)return{ok:!1,value:void 0,oldValue:void 0,changed:!1,error:"unknown column"};const m=this.value(f,i,r),u=this.parse(f,p,i,r),b=this.validate(f,u,m,i,r);if(b!==!0)return{ok:!1,value:u,oldValue:m,changed:!1,error:b};const a=this.apply(f,u,i,r);return{ok:!0,value:u,oldValue:m,changed:a}}#d(n,p,i){if(this.#o.size===0)return;const r=this.#a(p,i);this.#o.delete(`${r}${k}${n.id}`);for(const f of this.#t?this.#t.dependents.get(n.id)||[]:[])this.#o.delete(`${r}${k}${f}`)}}function s(d,n){return n&&n.key!=null?String(n.key):t(d)}function t(d){if(d&&typeof d=="object"){let n=o.get(d);return n===void 0&&(n=`#${c++}`,o.set(d,n)),n}return String(d)}const o=new WeakMap;let c=0}),ze("packages/core/src/model/shadow.js",function(e,_){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"HISTORY_TICK_MAX_MS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"HISTORY_TICK_MIN_MS",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"CLUSTER_SHADOW_KINDS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"DEFAULT_ANOMALY_THRESHOLD",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"SPEC_STATUS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"POSITIONAL_KINDS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"SHADOW_LABELS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"specStatusOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ShadowTracker",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"shadowsIn",{enumerable:!0,get:function(){return r}});const E=_("packages/core/src/internal/warn.js").warnOnce,K=2e5,U=20,D=1e3,J=50;function z(f){return Math.min(D,Math.max(J,Math.floor(f)))}const L=Object.freeze(["updates","updatedAt","sinceUpdate","delta","deltaPercent","rate","history","firstValue","streak","rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag","specStatus","rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta","fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD","cluster","clusterDistance"]),X=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),I=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),j=Object.freeze(["cluster","clusterDistance"]),k=.6745,y=3.5,l=Object.freeze({PASS:"PASS",WARN:"WARN",FAIL:"FAIL"}),g=Object.freeze(["rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag"]),s=Object.freeze({updates:"Updates",updatedAt:"Updated at",sinceUpdate:"Since update",delta:"Change",deltaPercent:"Change %",rate:"Rate of change",history:"History",firstValue:"Baseline",streak:"Streak",rank:"Rank",rankAsc:"Rank, ascending",rankChange:"Rank change",percentile:"Percentile",quartile:"Quartile",zScore:"Z-score",shareOfTotal:"Share of total",anomalyScore:"Anomaly score",anomalyFlag:"Anomaly",specStatus:"Spec status",rollingSum:"Rolling sum",rollingAvg:"Rolling average",rollingMin:"Rolling minimum",rollingMax:"Rolling maximum",windowCoverage:"Window coverage",cumulativeToDate:"Cumulative to date",periodOverPeriod:"Period over period",rollingQuantile:"Rolling quantile",windowApproximate:"Window approximate",tsTrend:"Trend",tsSeasonal:"Seasonal",tsResidual:"Seasonal residual",tsCoverage:"Decomposition coverage",tsSmoothed:"Smoothed",tsSmoothingAlpha:"Smoothing α",tsSmoothingBeta:"Smoothing β",fitPredicted:"Predicted",fitResidual:"Residual",fitInfluence:"Influence",fitStdResidual:"Std. residual",fitLeverage:"Leverage",fitCooksD:"Cook's D",cluster:"Cluster",clusterDistance:"Cluster distance"});function t(f,m){if(!m)return null;const u=Number.isFinite(Number(m.lower))?Number(m.lower):null,b=Number.isFinite(Number(m.upper))?Number(m.upper):null;if(u===null&&b===null||!Number.isFinite(f))return null;if(u!==null&&f<u||b!==null&&f>b)return l.FAIL;const a=Number.isFinite(Number(m.warnLower))?Number(m.warnLower):null,h=Number.isFinite(Number(m.warnUpper))?Number(m.warnUpper):null;return a!==null&&f<a||h!==null&&f>h?l.WARN:l.PASS}function o(f,m,u){if(!m||typeof m!="object")return null;if(m.kind!=="time")return m.kind!==void 0&&E(`shadow.history.window.kind:${f}`,`a 'history' shadow's 'window' only accepts {kind: 'time', span}; '${m.kind}' is not honoured (a plain count is already what 'depth' means, and a session has no span to divide into buckets), so it reported the original, unwindowed history.`),null;const b=m.minutes!=null?Number(m.minutes)*6e4:Number(m.span);if(!(b>0))return E(`shadow.history.window.span:${f}`,"a 'history' shadow's time window needs a positive 'span' (ms) or 'minutes'; it had none, so it reported the original, unwindowed history."),null;const a=Math.max(2,Math.floor(u)||U);return{span:b,bucketMs:Math.max(1,Math.floor(b/a))}}class c{#e;#t=new Map;#n=new Map;#r=new Map;#s=new Map;#i=new Map;#o=new Map;#l=0;#a;#c;#u;#d;#f=new Map;#h=null;#p=null;#m=null;constructor(m){this.#e=m.colId,this.#a=Math.max(2,m.depth||U),this.#c=Math.max(1,m.max||K),this.#u=m.now||(()=>Date.now()),this.#d=o(this.#e,m.historyWindow,this.#a),this.#d&&(this.#h=Math.floor(this.#u()/this.#d.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#d}observe(m,u){const b=i(u);if(b===null)return;if(!this.#n.has(m)){this.#p=null,this.#m=null,this.#g(),this.#t.set(m,b),this.#n.set(m,b),this.#r.set(m,0),this.#s.set(m,this.#u()),this.#i.set(m,[b]),this.#d&&this.#f.set(m,[b]),this.#o.set(m,0);return}const a=this.#n.get(m);if(a===b)return;this.#p=null,this.#m=null,this.#n.set(m,b),this.#r.set(m,(this.#r.get(m)||0)+1),this.#s.set(m,this.#u());const h=this.#i.get(m)||[];h.push(b),h.length>this.#a&&h.splice(0,h.length-this.#a),this.#i.set(m,h);const w=Math.sign(b-a),v=this.#o.get(m)||0;this.#o.set(m,Math.sign(v)===w?v+w:w)}#g(){if(this.#n.size<this.#c)return;const m=this.#n.keys().next().value;m!==void 0&&(this.#t.delete(m),this.#n.delete(m),this.#r.delete(m),this.#s.delete(m),this.#i.delete(m),this.#f.delete(m),this.#o.delete(m),this.#l++)}rebase(){for(const[m,u]of this.#n)this.#t.set(m,u);this.#p=null,this.#m=null}reset(){this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#s.clear(),this.#i.clear(),this.#f.clear(),this.#o.clear(),this.#l=0,this.#p=null,this.#m=null,this.#d&&(this.#h=Math.floor(this.#u()/this.#d.bucketMs))}retain(m){const u=m instanceof Set?m:new Set(m);let b=0;for(const a of[...this.#n.keys()])u.has(a)||(this.#t.delete(a),this.#n.delete(a),this.#r.delete(a),this.#s.delete(a),this.#i.delete(a),this.#f.delete(a),this.#o.delete(a),b++);return b&&(this.#p=null,this.#m=null),b}advanceHistoryWindow(m=this.#u()){const u=this.#d;if(!u)return 0;const b=Math.floor(m/u.bucketMs),a=b-this.#h;if(!(a>0))return 0;const h=Math.min(a,this.#a);for(const[w,v]of this.#f){const A=this.#n.get(w);for(let H=0;H<h;H++)v.push(A);v.length>this.#a&&v.splice(0,v.length-this.#a)}return this.#h=b,a}read(m,u,b,a){switch(m){case"updates":return this.#r.has(u)?this.#r.get(u):0;case"updatedAt":{const h=this.#s.get(u);return h===void 0?null:new Date(h)}case"sinceUpdate":{const h=this.#s.get(u);return h===void 0?null:this.#u()-h}case"firstValue":return this.#t.has(u)?this.#t.get(u):null;case"delta":return this.#n.has(u)?this.#n.get(u)-this.#t.get(u):null;case"deltaPercent":{if(!this.#n.has(u))return null;const h=this.#t.get(u);return h?(this.#n.get(u)-h)/Math.abs(h)*100:null}case"rate":{const h=this.#i.get(u),w=this.#s.get(u);if(!h||h.length<2||w===void 0)return null;const v=this.#u()-w,A=h[h.length-1]-h[h.length-2];return v>0?A/v*1e3:A}case"history":return this.#d?this.#f.has(u)?[...this.#f.get(u)]:null:this.#i.has(u)?[...this.#i.get(u)]:null;case"streak":return this.#o.has(u)?this.#o.get(u):0;case"specStatus":return this.#n.has(u)?t(this.#n.get(u),a):null;default:return g.includes(m)?this.#S(m,u,b,a):null}}#b(m){if(m){if(this.#m&&this.#m.only===m)return this.#m.view;const u=this.#y(m);return this.#m={only:m,view:u},u}return this.#p?this.#p:(this.#p=this.#y(null),this.#p)}#y(m){const u=[];for(const[M,S]of this.#n)m&&!m.has(M)||u.push(S);const b=u.sort((M,S)=>M-S);let a=0,h=0,w=0,v=0;for(const M of b){v+=M,a++;const S=M-h;h+=S/a,w+=S*(M-h)}const A=[];for(const[M,S]of this.#t)m&&!m.has(M)||A.push(S);const H=a?d(b):0,G=b.map(M=>Math.abs(M-H)).sort((M,S)=>M-S),Z=a?d(G):0;return{sorted:b,baseline:A.sort((M,S)=>M-S),sum:v,mean:a?h:0,sd:a>1?Math.sqrt(w/(a-1)):0,median:H,mad:Z}}#S(m,u,b,a){if(!this.#n.has(u)||b&&!b.has(u))return null;const h=this.#n.get(u),w=this.#b(b),v=w.sorted.length;if(!v)return null;switch(m){case"rank":return v-p(w.sorted,h)+1;case"rankAsc":return n(w.sorted,h)+1;case"rankChange":{if(!this.#t.has(u)||!w.baseline.length)return null;const A=w.baseline.length-p(w.baseline,this.#t.get(u))+1,H=v-p(w.sorted,h)+1;return A-H}case"percentile":return p(w.sorted,h)/v*100;case"quartile":{const A=p(w.sorted,h)/v;return Math.min(4,Math.max(1,Math.ceil(A*4)))}case"zScore":return w.sd?(h-w.mean)/w.sd:null;case"anomalyScore":return w.mad?k*(h-w.median)/w.mad:null;case"anomalyFlag":{if(!w.mad)return null;const A=a&&Number.isFinite(Number(a.threshold))?Number(a.threshold):y;return Math.abs(k*(h-w.median)/w.mad)>A}case"shareOfTotal":return w.sum?h/w.sum*100:null;default:return null}}}function d(f){const m=f.length;if(!m)return 0;const u=(m-1)*.5,b=Math.floor(u),a=Math.ceil(u);return b===a?f[b]:f[b]+(u-b)*(f[a]-f[b])}function n(f,m){let u=0,b=f.length;for(;u<b;){const a=u+b>>1;f[a]<m?u=a+1:b=a}return u}function p(f,m){let u=0,b=f.length;for(;u<b;){const a=u+b>>1;f[a]<=m?u=a+1:b=a}return u}function i(f){if(f==null||f==="")return null;if(f instanceof Date){const u=f.getTime();return Number.isFinite(u)?u:null}const m=typeof f=="number"?f:Number(f);return Number.isFinite(m)?m:null}function r(f){const m=[];for(const u of f||[]){const b=u.shadow;if(!b)continue;const a=typeof b=="string"?{kind:b}:b,h=a.kind;L.includes(h)&&(X.includes(h)||I.includes(h)||j.includes(h)||m.push({colId:u.id||u.field,of:a.of||u.field||u.id,kind:h,depth:a.depth,historyWindow:h==="history"?a.window:void 0}))}return m}}),ze("packages/core/src/columns/model.js",function(e,_){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return Me}});const ne=_("packages/core/src/internal/merge.js"),E=ne.expand,K=ne.merge,U=ne.toArray,D=_("packages/core/src/internal/warn.js"),J=D.fail,z=D.warnOnce,L=_("packages/core/src/internal/paths.js"),X=L.getPath,I=L.pathGetter,j=L.pathSetter,y=_("packages/core/src/internal/text.js").humanise,l=_("packages/core/src/internal/predicates.js"),g=l.isFunction,s=l.isObject,o=_("packages/core/src/internal/uid.js").uid,d=_("packages/core/src/format/index.js").compileFormat,n=_("packages/core/src/columns/datatypes.js"),p=n.comparatorFor,i=n.createTypeRegistry,r=n.storageKind,f=_("packages/core/src/columns/infer.js"),m=f.inferColumnType,u=f.DEFAULT_SAMPLE,b=_("packages/core/src/columns/graph.js"),a=b.buildGraph,h=b.affectedBy,v=_("packages/core/src/columns/lookup.js").createLookup,A=_("packages/core/src/columns/value.js"),H=A.compileDisplay,G=A.ValuePipeline,Z=A.warnImpureUse,M=_("packages/core/src/model/shadow.js"),S=M.FIT_SHADOW_KINDS,T=M.CLUSTER_SHADOW_KINDS,O=Object.freeze({geometry:"geometry",list:"list"}),N={value:{pure:!0},cell:{},edit:{enabled:!1},sort:{enabled:!0,direction:null,order:0,nullsFirst:!1},filter:{enabled:!0,type:"text"},group:{enabled:!1,index:-1,explode:!1},pivot:{enabled:!1,index:-1},total:null,layout:{width:150,min:40,max:null,flex:0,pin:null,hidden:!1,resizable:!0,movable:!0,lockVisible:!1,lockPosition:!1},header:{},facet:{},export:{lookup:"label",csv:!0,excel:!0},allowGroup:!0,allowPivot:!0,allowTotal:!0,nullable:!0,quickFilter:!0},P={centre:"center"},C=new Set(["start","center","end","left","right"]);function B(pe){if(typeof pe!="string")return;const ae=pe.toLowerCase();return P[ae]?P[ae]:C.has(ae)?ae:void 0}function x(pe){if(typeof pe!="string")return;const ae=pe.toLowerCase();return ae==="center"||ae==="centre"?"middle":ae==="top"||ae==="middle"||ae==="bottom"?ae:void 0}const V=["cell","layout","header"];function Y(pe){if(!s(pe))return{};const ae={...pe},ge=(ve,le)=>{if(pe[ve]===void 0)return;const we=E(pe[ve],le);we&&V.includes(ve)&&!s(pe[ve])&&delete we.enabled,ae[ve]=we};return ge("sort","direction"),ge("filter","type"),ge("cell","render"),ge("edit","editor"),ge("layout","width"),ge("group","index"),ge("pivot","index"),ge("header","render"),ge("facet","strategy"),ae}function F(pe,ae){const ge={...pe||{}},ve=s(ae)&&s(ae.layout)&&ae.layout.width!==void 0;return ge.fit==="content"&&!ve&&delete ge.width,ge}const $=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"]),q=new Set(["collapsible","columns","facet","header","id","marryChildren","openByDefault","showWhen","title"]);function ee(pe,ae,ge,ve){const le=ge==="columnGroup"?"column group":"column";for(const we of Object.keys(pe))if(!ae.has(we)){if(we==="timeZone"&&ge==="column"){z("column.timeZone",`\`timeZone\` is not a column option, so it had no effect on column "${ve}". 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}z(`${ge}.unknown:${we}`,`'${we}' is not a configuration key this grid recognises, so it had no effect on ${le} "${ve}". Check the spelling against the reference.`)}}function te(pe){s(pe.cell)&&pe.cell.autoHeight!==void 0&&z("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${pe.id||pe.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function re(pe,ae){const ge=ae&&g(pe.defaultsFor)?pe.defaultsFor(ae):null,ve={...pe.defaults||{},...s(ge)?ge:{}},le={};return ve.align&&(le.align=ve.align,le.cell={align:ve.align},le.header={align:ve.align}),ve.filter&&(le.filter=ve.filter==="none"?{enabled:!1,type:"none"}:{enabled:!0,type:ve.filter}),ve.editor&&(le.edit=ve.editor==="none"?{editor:null}:{editor:ve.editor}),ve.total&&(le.total=ve.total),ve.render&&(le.cell={...le.cell||{},render:ve.render}),pe.export&&(le.export={...pe.export}),le}function ie(pe){if(typeof pe=="string")return pe.trim()?[pe.trim()]:[];if(!Array.isArray(pe))return[];const ae=[];for(const ge of pe){if(typeof ge!="string")continue;const ve=ge.trim();ve&&!ae.includes(ve)&&ae.push(ve)}return ae}class ue{#e=new Map;#t=[];#n=[];#r=new WeakMap;#s;#i;#o;#l;#a;#c;#u(ae,ge,ve){const le=this.#d(ae,ge,ve);if(typeof le!="string"||!this.#f)return le??null;const we=ge&&ge.totals&&ge.totals.implement;if(we&&g(we[le])){const be=we[le];return be.totalName=le,be}const he=this.#f.totalFn?.(le);return g(he)?he:le}#d(ae,ge,ve){if(typeof ae!="string")return ae;const le=ge&&ge.totals&&ge.totals.supported;if(!Array.isArray(le)||le.includes(ae))return ae;const we=le.length?le.join(", "):"none";return J(`column "${ve}" is typed ${ge.name||"a type"}, for which the total "${ae}" is not meaningful. Supported: ${we}. Aggregating it anyway would produce a confident wrong number.`),ae}#f;#h;#p;#m;#g;#b;#y=!1;#S;#w;constructor(ae={}){this.#i=Y(ae.columnDefaults||{}),this.#o=ae.columnPresets||{},this.#a=ae.locale,this.#l=ae.timeZone,this.#c=x(ae.verticalAlign),this.#f=ae.registry||null,this.#h=ae.grid||null,this.#p=ae.context,this.#S=ae.sampleSize??u,this.#w=ae.onChange||null,this.#b=g(ae.rowKey)?ae.rowKey:void 0,this.#s=i(ae.dataTypes,this.#f);const{leaves:ge,groups:ve}=Me(ae.columns||[]);this.#n=ve;for(const le of ge){le.facet!==void 0&&this.#r.set(le.def,le.facet);const we=this.#A(le.def,null);if(we.groupPath=le.path,this.#e.has(we.id)){z(`columns.duplicate:${we.id}`,`two columns resolve to the id '${we.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}le.column=we,this.#e.set(we.id,we),this.#t.push(we.id)}this.#C(ae.stored||null)}#A(ae,ge){ee(ae,$,"column",ae.id||ae.field||"(unnamed)"),te(ae);const ve=Y(ae),le=U(ae.preset),we=le.map(We=>{const qe=this.#o[We];return qe?Y(qe):(z(`preset:${We}`,`unknown column preset "${We}"; ignoring`),{})}),he=this.#O(ve,we,ge),be=this.#s.get(he)||this.#s.get("text");if(!this.#s.has(he)&&ae.type){const We=O[he];z(`type:${he}`,`unknown data type "${he}"; falling back to "text"`+(We?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${We}'.`:""))}const Te=g(be.items)?this.#P(ve,we,ae.id||ae.field||"(unnamed)"):null;let je=N;je=K(je,this.#i),ae.type!==!1&&(je=K(je,re(be,Te)));for(const We of we)je=K(je,We);this.#r.has(ae)&&(je=K(je,Y({facet:this.#r.get(ae)}))),je=K(je,ve);const ke=je.edit;ke&&ke.editor&&ke.enabled!==!0&&!g(ke.enabled)&&(ae.edit||{}).editor&&z(`column.editor-not-enabled:${ae.id||ae.field}`,`column '${ae.id||ae.field}' names the editor '${ke.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const Ue=ae.id||ae.field||o("col");if(ae.shadow&&!g(je.value&&je.value.compute)){const We=typeof ae.shadow=="string"?{kind:ae.shadow}:ae.shadow,qe=We.of||ae.field||Ue,et=S.includes(We.kind),dt=T.includes(We.kind),lt=et?We.model||We:null,vt=et&<?[...Array.isArray(lt.predictors)?lt.predictors:[],lt.response].filter(Boolean):null,Pt=dt?(Array.isArray(We.columns)?We.columns:[]).filter(Boolean):null;je.value={...je.value||{},deps:Pt&&Pt.length?Pt:vt&&vt.length?vt:We.orderBy&&We.orderBy!==qe?[qe,We.orderBy]:[qe],pure:!1,compute:($t,ht)=>{const ut=ht.grid&&ht.grid.statistics;if(!ut)return null;const wt=ht.row&&ht.row.key||ut.keyOf(ht.data);if(!wt)return null;if(et){if(!g(ut.fitShadow))return null;const Nt=We.model?{...We.model,threshold:We.threshold}:We;return ut.fitShadow(We.kind,wt,Nt)}return dt?g(ut.clusterShadow)?ut.clusterShadow(We.kind,wt,We):null:ut.shadow(qe,We.kind,wt,We.scope,We)}}}if(ae.running&&!g(je.value&&je.value.compute)){const We=typeof ae.running=="string"?{kind:ae.running}:ae.running,qe=We.of||ae.field||Ue;je.value={...je.value||{},deps:[qe],pure:!1,compute:(et,dt)=>{const lt=dt.grid&&dt.grid.statistics;if(!lt||!g(lt.running))return null;const vt=dt.row&&dt.row.key||lt.keyOf(dt.data);return vt?lt.running(qe,We.kind||"total",vt):null}},ae.sort===void 0&&(je.sort={...je.sort||{},enabled:!1})}const Re=ae.field??(g(je.value&&je.value.compute)?null:ae.id??null),Ee=g(je.value&&je.value.compute),He={id:Ue,field:Re,shadow:ae.shadow||null,running:ae.running||null,spec:ae.spec||null,validation:ae.validation||null,volatile:!!(ae.shadow||ae.running),title:je.title??y(Re||Ue),type:be.name,dataType:be,itemType:Te,nullable:je.nullable!==!1,align:B(ve.cell&&ve.cell.align||ve.align||je.cell&&je.cell.align||je.align||be.defaults&&be.defaults.align)||"start",verticalAlign:x(ve.cell&&ve.cell.verticalAlign||ve.verticalAlign||je.cell&&je.cell.verticalAlign||je.verticalAlign)||this.#c,rowSpan:g(je.rowSpan)?je.rowSpan:null,colSpan:g(je.colSpan)?je.colSpan:null,value:{pure:!0,...je.value||{}},cell:{...je.cell||{}},edit:{...je.edit||{}},sort:{...je.sort||{}},filter:{...je.filter||{}},group:{enabled:!1,index:-1,explode:!1,...je.group||{}},pivot:{enabled:!1,index:-1,...je.pivot||{}},total:this.#u(je.total,be,ae.id||ae.field||"(unnamed)"),groupTotal:je.groupTotal===void 0?null:this.#u(je.groupTotal,be,ae.id||ae.field||"(unnamed)"),grandTotal:je.grandTotal===void 0?null:this.#u(je.grandTotal,be,ae.id||ae.field||"(unnamed)"),tags:ie(je.tags),typeOptions:je.typeOptions??null,...s(je[he])?{[he]:je[he]}:{},layout:F(je.layout,ve),header:{...je.header||{}},contextMenu:je.contextMenu===void 0?null:je.contextMenu,facet:{...je.facet||{}},export:{...je.export||{}},allowGroup:je.allowGroup!==!1,allowPivot:je.allowPivot!==!1,allowTotal:je.allowTotal!==!1,quickFilter:je.quickFilter!==!1,def:ae,format:je.format,presets:le,inferred:ge!=null&&!ae.type,computed:Ee,diff:ae.diff===void 0?void 0:!!ae.diff,read:Re?I(Re):null,write:Re?j(Re):null};He.cell.align=B(ve.cell&&ve.cell.align)||He.align,He.header.align=B(ve.header&&ve.header.align)||He.align;const Ke=je.lookup||null;return He.lookup=Ke?v({id:Ue,lookup:Ke},{locale:this.#a,onChange:()=>{this.#w&&this.#w("lookup",{colId:Ue})}}):null,He.group.explode&&He.lookup&&He.lookup.multiple&&z(`explode:${Ue}`,`column "${Ue}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(He),He}#v(ae){ae.formatter=d(ae.format,ae.dataType,this.#a,this.#l,ae.id),ae.formatValue=H(ae,{locale:this.#a,grid:this.#h,context:this.#p}),ae.itemCompare=ae.itemType?p(ae.itemType,this.#a):null,ae.compare=g(ae.value.compare)?ae.value.compare:ae.lookup?ae.lookup.comparator():g(ae.dataType.compareFor)?ae.dataType.compareFor(ae):p(ae.dataType,this.#a),ae.excel=ae.formatter&&ae.formatter.ooxml||ae.dataType&&ae.dataType.excel||"General",ae.storeKind=r(ae.dataType,!!(ae.lookup&&ae.lookup.multiple))}#P(ae,ge,ve){let le=s(ae.typeOptions)?ae.typeOptions:null;for(let Te=ge.length-1;!le&&Te>=0;Te--)s(ge[Te].typeOptions)&&(le=ge[Te].typeOptions);!le&&s(this.#i.typeOptions)&&(le=this.#i.typeOptions);const we=le&&le.of!==void 0?le.of:"text",he=typeof we=="string"?this.#s.get(we):void 0;return he&&!g(he.items)&&he.storage!=="object"?he:(z(`type:of:${String(we)}`,`column "${ve}" names "${String(we)}" as its item type (typeOptions.of), which is not ${he?"a scalar data type":"a known data type"}; its items are read as text.`),this.#s.get("text"))}#O(ae,ge,ve){if(ae.type===!1)return"text";if(ae.type)return ae.type;for(let le=ge.length-1;le>=0;le--)if(ge[le].type)return ge[le].type;if(this.#i.type)return this.#i.type;if(ae.shadow){const le=typeof ae.shadow=="string"?ae.shadow:ae.shadow.kind;if(le==="fitInfluence")return"boolean";if(le==="fitPredicted"||le==="fitResidual"||le==="fitStdResidual"||le==="fitLeverage"||le==="fitCooksD"||le==="tsTrend"||le==="tsSeasonal"||le==="tsResidual"||le==="tsCoverage"||le==="tsSmoothed"||le==="tsSmoothingAlpha"||le==="tsSmoothingBeta"||le==="cluster"||le==="clusterDistance")return"number"}return ve||(ae.lookup?"lookup":"text")}#C(ae){const ge=this.all();this.#m=a(ge),this.#g?this.#g.setGraph(this.#m):this.#g=new G({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:ae||null,rowKey:this.#b});const ve=this.#g;for(const le of ge)le.getValue=(we,he)=>ve.value(le,we,he)}all(){return this.#t.map(ae=>this.#e.get(ae))}visible(){return this.all().filter(ae=>!ae.layout.hidden)}get(ae){return this.#e.get(ae)}groups(){const ae=ge=>{const ve=[];for(const le of ge)Array.isArray(le.columns)?ve.push({...le,columns:ae(le.columns)}):le.column&&ve.push(le.column);return ve};return ae(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#s}affectedBy(ae){return h(this.#m,ae)}value(ae,ge,ve){return this.#g.value(ae,ge,ve)}text(ae,ge,ve){return this.#g.text(ae,ge,ve)}checkImpure(ae,ge){Z(this.#e.get(ae),ge)}setLocale(ae){this.#a=ae;for(const ge of this.all())ge.lookup&&ge.lookup.setLocale(ae),this.#v(ge);this.#w&&this.#w("locale",{locale:ae})}infer(ae){const ge={};if(this.#y||!Array.isArray(ae)||ae.length===0)return ge;this.#y=!0;let ve=!1;for(const le of this.all()){const we=le.def;if(we.type!==void 0||!le.field||le.computed||le.lookup||this.#E(le))continue;const he=le.read||(je=>X(je,le.field)),be=m(le.id,ae,he,this.#s,{sampleSize:this.#S});if(be===le.type)continue;ge[le.id]=be;const Te=this.#A(we,be);Te.groupPath=le.groupPath,Te.layout={...Te.layout,...Ae(le.layout)},this.#e.set(le.id,Te),Fe(this.#n,le.id,Te),ve=!0}return ve&&this.#C(null),ge}redecorate(ae,ge,ve={}){const le=this.#e.get(ae);if(!le){z(`redecorate:${ae}`,`columns.decorate('${ae}', …): no column with id '${ae}'.`);return}const we=le.def||{},he={...s(we.cell)?we.cell:{}};he.decoration=ge??void 0,ve&&"variant"in ve&&(he.variant=ve.variant);const be={...we,cell:he};this.#r.has(we)&&this.#r.set(be,this.#r.get(we));const Te=this.#A(be,le.type);return Te.groupPath=le.groupPath,Te.layout={...Te.layout,...Ae(le.layout)},le.lookup&&le.lookup!==Te.lookup&&g(le.lookup.destroy)&&le.lookup.destroy(),this.#e.set(ae,Te),Fe(this.#n,ae,Te),this.#C(null),this.#w&&this.#w("decorate",{colId:ae}),Te}destroy(){for(const ae of this.#e.values())ae.lookup&&g(ae.lookup.destroy)&&ae.lookup.destroy()}#E(ae){for(const ge of ae.presets){const ve=this.#o[ge];if(ve&&ve.type)return!0}return!!this.#i.type}#T(ae){return!ae.computed&&g(ae.dataType&&ae.dataType.toStorage)}storeReader(ae){if(ae.computed)return ge=>this.#g.value(ae,ge,null);if(this.#T(ae)){const ge=ae.dataType.toStorage,ve={timeZone:this.#l,colId:ae.id,itemType:ae.itemType||null};return le=>ge(ae.read(le),ve)}return ae.read}storeValue(ae,ge){if(!(!ae||ae.computed)&&g(ae.read))return this.storeReader(ae)(ge)}storeSchema(){const ae=[];for(const ge of this.all()){if(ge.computed&&ge.value.pure===!1||!ge.computed&&!ge.field)continue;const ve=this.storeReader(ge);let le=null;!ge.computed&&!this.#T(ge)&&typeof ge.field=="string"&&!ge.lookup&&(le=ge.field);const we={id:ge.id,kind:ge.storeKind,nullable:ge.nullable,read:ve};le!==null&&(we.field=le),ge.lookup&&(we.dictionary=ge.lookup.dictionary()),ae.push(we)}return ae}state(){return this.all().map(ae=>({id:ae.id,width:ae.layout.width,flex:ae.layout.flex||void 0,hidden:!!ae.layout.hidden,headerWrap:ae.header?.wrap===!0?!0:void 0,headerOrientation:ae.header?.orientation==="vertical"?"vertical":void 0,pin:ae.layout.pin??null,sort:ae.sort.direction??null,sortIndex:ae.sort.direction?ae.sort.order??0:null,groupIndex:ae.group.enabled?ae.group.index??0:null,pivotIndex:ae.pivot.enabled?ae.pivot.index??0:null,total:typeof ae.total=="string"?ae.total:null,groupTotal:typeof ae.groupTotal=="string"?ae.groupTotal:void 0,grandTotal:typeof ae.grandTotal=="string"?ae.grandTotal:void 0,decoration:ae.cell&&ae.cell.decoration!=null?de(ae.cell.decoration):void 0,variant:ae.cell&&ae.cell.variant!=null?de(ae.cell.variant):void 0}))}applyState(ae,ge={}){const ve={applied:[],skipped:[]},le=Array.isArray(ae)?ae:ae&&ae.columns||[],we=!Array.isArray(ae)&&ae&&ae.columnOrder||null;for(const be of le){if(!be||!be.id){ve.skipped.push({key:"?",reason:"no id"});continue}let Te=this.#e.get(be.id);if(!Te){ve.skipped.push({key:be.id,reason:"unknown column"});continue}if(Object.hasOwn(be,"decoration")||Object.hasOwn(be,"variant")){const je=Te.cell?Te.cell.decoration:void 0,ke=be.decoration??null,Ue=Object.hasOwn(be,"variant"),Re=Ue&&!Oe(Te.cell?Te.cell.variant:void 0,be.variant);(!Oe(je,ke)||Re)&&(this.redecorate(be.id,ke,Ue?{variant:be.variant??void 0}:{}),Te=this.#e.get(be.id)||Te)}be.width!=null&&(Te.layout.width=be.width),be.flex!=null&&(Te.layout.flex=be.flex),be.hidden!=null&&(Te.layout.hidden=!!be.hidden),be.headerWrap!==void 0&&(Te.header.wrap=!!be.headerWrap),be.headerOrientation!==void 0&&(Te.header.orientation=be.headerOrientation==="vertical"?"vertical":"horizontal"),be.pin!==void 0&&(Te.layout.pin=be.pin),be.sort!==void 0&&(Te.sort.direction=be.sort),be.sortIndex!=null&&(Te.sort.order=be.sortIndex),be.groupIndex!=null&&(Te.group.enabled=!0,Te.group.index=be.groupIndex),be.pivotIndex!=null&&(Te.pivot.enabled=!0,Te.pivot.index=be.pivotIndex),be.total!==void 0&&(Te.total=be.total),be.groupTotal!==void 0&&(Te.groupTotal=be.groupTotal),be.grandTotal!==void 0&&(Te.grandTotal=be.grandTotal),ve.applied.push(be.id)}const he=we||(ge&&ge.keepOrder?[]:le.map(be=>be&&be.id).filter(Boolean));if(he.length){const be=he.filter(je=>this.#e.has(je)),Te=this.#t.filter(je=>!be.includes(je));this.#t=[...be,...Te]}return this.#w&&this.#w("state",ve),ve}move(ae,ge){this.#M(ae,ge)&&(this.#R(),this.#w&&this.#w("move",{id:ae,to:ge}))}reorder(ae){const ge={applied:[],skipped:[]},ve=[];let le=0;for(const we of Array.isArray(ae)?ae:[]){const he=le++;this.#M(we,he)&&(ge.applied.push(we),ve.push({id:we,to:he}))}if(!ve.length)return ge;if(this.#R(),this.#w)for(const we of ve)this.#w("move",we);return ge}#M(ae,ge){const ve=this.#t.indexOf(ae);if(ve===-1||Math.max(0,Math.min(Number(ge)||0,this.#t.length-1))===ve)return!1;const we=this.#e.get(ae);if(we.layout.movable===!1||we.layout.lockPosition)return z(`move:${ae}`,`column "${ae}" is not movable; the move was ignored`),!1;const he=this.#N(ae,ge);return he?(z(`move.married:${he}`,`band "${he}" declares marryChildren, so its columns stay together; the move was ignored`),!1):(this.#t.splice(ve,1),this.#t.splice(Math.max(0,Math.min(ge,this.#t.length)),0,ae),!0)}#N(ae,ge){if(!this.#n||!this.#n.length)return null;const ve=this.#t.filter(be=>be!==ae),le=Math.max(0,Math.min(ge,ve.length)),we=(be,Te)=>{if(Array.isArray(be.columns)){for(const ke of be.columns)we(ke,Te);return Te}const je=be.column?be.column.id:be.id;return je&&Te.push(je),Te},he=be=>{for(const Te of be){if(!Array.isArray(Te.columns))continue;if(Te.marryChildren===!0){const ke=we(Te,[]),Ue=ke.includes(ae),Re=ke.map(Ee=>ve.indexOf(Ee)).filter(Ee=>Ee>=0);if(Re.length){const Ee=Math.min(...Re),He=Math.max(...Re);if(Ue?le<Ee||le>He+1:le>Ee&&le<=He)return Te.id}}const je=he(Te.columns);if(je)return je}return null};return he(this.#n)}#R(){const ae=new Map(this.#t.map((le,we)=>[le,we])),ge=le=>{if(!Array.isArray(le.columns)){const he=le.column?le.column.id:le.id;return ae.has(he)?ae.get(he):1/0}let we=1/0;for(const he of le.columns)we=Math.min(we,ge(he));return we},ve=le=>{le.sort((we,he)=>ge(we)-ge(he));for(const we of le)Array.isArray(we.columns)&&ve(we.columns)};ve(this.#n)}#F(ae){const ge=ve=>{for(let le=0;le<ve.length;le++){const we=ve[le];if(Array.isArray(we.columns)){const he=ge(we.columns);if(he)return he}else if(we.column&&we.column.id===ae)return ve.splice(le,1)[0]}return null};return ge(this.#n)}#W(ae){const ge=[];for(let ve=ae.length-1;ve>=0;ve--){const le=ae[ve];Array.isArray(le.columns)&&(ge.push(...this.#W(le.columns)),le.columns.length===0&&(ge.push(le.id),ae.splice(ve,1)))}return ge}#V(){const ae=(ge,ve,le)=>{for(const we of ge)Array.isArray(we.columns)?ae(we.columns,[...ve,we.id]):we.column&&(we.column.groupPath=ve)};ae(this.#n,[])}#x(ae){const ge=new Set(ae),ve=this.#t.filter(be=>ge.has(be));if(!ve.length)return;const le=Math.min(...ve.map(be=>this.#t.indexOf(be))),we=this.#t.slice(0,le).filter(be=>!ge.has(be)),he=this.#t.slice(le).filter(be=>!ge.has(be));this.#t=[...we,...ve,...he]}#q(ae){const ge=[],ve=le=>{if(Array.isArray(le.columns))for(const we of le.columns)ve(we);else le.column&&ge.push(le.column.id)};return ve(ae),ge}#_(ae){const ge=ve=>{for(const le of ve){if(!Array.isArray(le.columns))continue;if(le.id===ae)return{node:le,parent:ve};const we=ge(le.columns);if(we)return we}return null};return ge(this.#n)}groupColumns(ae,ge={}){const ve=U(ae).filter(Te=>this.#e.has(Te));if(!ve.length)return z("columns.group.empty","groupColumns was given no known column ids; nothing was grouped."),null;for(const Te of ve)if(this.#e.get(Te).layout.lockPosition)return z(`columns.group.locked:${Te}`,`column "${Te}" is position-locked and cannot be grouped.`),null;const le=ge.groupId?this.#_(ge.groupId):null;if(ge.groupId&&!le)return z(`columns.group.unknown:${ge.groupId}`,`no band "${ge.groupId}" to add to; nothing was grouped.`),null;let we=null;if(!le&&ge.id!=null&&(we=String(ge.id),this.#_(we)||this.#e.has(we)))return z(`columns.group.idtaken:${we}`,`band id "${we}" is already in use; nothing was grouped.`),null;const he=ve.map(Te=>this.#F(Te)).filter(Boolean);if(!he.length)return null;let be;if(le)le.node.columns.push(...he),be=le.node.id;else{const Te={id:we||o("grp"),title:ge.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:he},je=Number.isInteger(ge.at)?Math.max(0,Math.min(ge.at,this.#n.length)):this.#n.length;this.#n.splice(je,0,Te),be=Te.id}return this.#W(this.#n),this.#x(ve),this.#V(),this.#R(),this.#w&&this.#w("columngroup",{action:"formed",groupId:be,ids:ve}),be}ungroupColumn(ae){const ge=this.#e.get(ae);if(!ge){z(`columns.ungroup.unknown:${ae}`,`no column "${ae}" to ungroup.`);return}const ve=ge.groupPath||[];if(!ve.length)return;const le=ve[ve.length-1],we=this.#_(le);if(!we)return;const he=this.#F(ae);if(!he)return;const be=we.parent.indexOf(we.node);we.parent.splice(be+1,0,he);const Te=this.#W(this.#n),je=this.#q(we.node);if(je.length){this.#x(je);const ke=Math.max(...je.map(Re=>this.#t.indexOf(Re))),Ue=this.#t.filter(Re=>Re!==ae);Ue.splice(ke+1,0,ae),this.#t=Ue}this.#V(),this.#R(),this.#w&&this.#w("columngroup",{action:"removed",id:ae,dissolved:Te})}renameGroup(ae,ge){const ve=this.#_(ae);if(!ve){z(`columns.group.rename:${ae}`,`no band "${ae}" to rename.`);return}ve.node.title=String(ge??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:ae,title:ve.node.title})}dissolveGroup(ae){const ge=this.#_(ae);if(!ge){z(`columns.group.dissolve:${ae}`,`no band "${ae}" to dissolve.`);return}const ve=ge.parent.indexOf(ge.node);ge.parent.splice(ve,1,...ge.node.columns),this.#V(),this.#R(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:ae})}moveGroup(ae,ge){const ve=this.#_(ae);if(!ve){z(`columns.group.move:${ae}`,`no band "${ae}" to move.`);return}const le=ve.parent,we=le.indexOf(ve.node);we!==-1&&(le.splice(we,1),le.splice(Math.max(0,Math.min(ge,le.length)),0,ve.node),this.#Y(),this.#V(),this.#w&&this.#w("columngroup",{action:"moved",groupId:ae,to:ge}))}#Y(){const ae=[],ge=le=>{for(const we of le)Array.isArray(we.columns)?ge(we.columns):we.column&&ae.push(we.column.id)};ge(this.#n);const ve=new Set(ae);this.#t=[...ae,...this.#t.filter(le=>!ve.has(le))]}groupTree(){const ae=ve=>ve.map(le=>Array.isArray(le.columns)?{id:le.id,title:le.title||"",collapsible:!!le.collapsible,openByDefault:le.openByDefault!==!1,columns:ae(le.columns)}:le.column?le.column.id:null).filter(le=>le!==null),ge=ae(this.#n);return ge.some(ve=>ve&&typeof ve=="object")?ge:[]}applyGroupTree(ae){if(!Array.isArray(ae))return;const ge=new Set,ve=we=>{const he=[];for(const be of we)if(be&&typeof be=="object"&&Array.isArray(be.columns)){const Te=ve(be.columns);if(!Te.length)continue;he.push({id:be.id||o("grp"),title:be.title||"",collapsible:be.collapsible===!0,openByDefault:be.openByDefault!==!1,showWhen:"always",marryChildren:!1,header:{},def:{},columns:Te})}else if(typeof be=="string"){const Te=this.#e.get(be);Te&&!ge.has(be)&&(ge.add(be),he.push({column:Te,path:[]}))}return he},le=ve(ae);for(const we of this.#t){if(ge.has(we))continue;const he=this.#e.get(we);he&&le.push({column:he,path:[]})}this.#n=le,this.#V(),this.#R(),this.#w&&this.#w("columngroup",{action:"applied"})}show(ae){this.#G(ae,!1)}hide(ae){this.#G(ae,!0)}#G(ae,ge){const ve=[];for(const le of U(ae)){const we=this.#e.get(le);if(we){if(ge&&we.layout.lockVisible){z(`lockVisible:${le}`,`column "${le}" is \`layout.lockVisible\` and cannot be hidden`);continue}we.layout.hidden!==ge&&(we.layout.hidden=ge,ve.push(le))}}ve.length&&this.#w&&this.#w("visible",{ids:ve,hidden:ge})}pin(ae,ge){const ve=this.#e.get(ae);ve&&(ve.layout.pin=ge??null,this.#w&&this.#w("pin",{id:ae,side:ve.layout.pin}))}pinMany(ae){const ge={};for(const[le,we]of ae){const he=this.#e.get(le);he&&(he.layout.pin=we??null,ge[le]=he.layout.pin)}const ve=Object.keys(ge);ve.length&&this.#w&&this.#w("pin",{ids:ve,pins:ge})}#I(ae,ge){const ve=ae.layout.min??0,le=ae.layout.max;let we=Math.max(ve,ge);return le!=null&&(we=Math.min(le,we)),ae.layout.width=we,ae.layout.flex=0,we}resize(ae,ge){const ve=this.#e.get(ae);if(!ve)return;if(ve.layout.resizable===!1){z(`resize:${ae}`,`column "${ae}" is not resizable; the resize was ignored`);return}const le=this.#I(ve,ge);this.#w&&this.#w("resize",{id:ae,width:le})}resizeMany(ae){const ge={};for(const[le,we]of ae){const he=this.#e.get(le);if(he){if(he.layout.resizable===!1){z(`resize:${le}`,`column "${le}" is not resizable; the resize was ignored`);continue}ge[le]=this.#I(he,we)}}const ve=Object.keys(ge);ve.length&&this.#w&&this.#w("resize",{ids:ve,widths:ge})}}function Ae(pe){const ae={};return pe.width!=null&&(ae.width=pe.width),pe.hidden!=null&&(ae.hidden=pe.hidden),pe.pin!==void 0&&(ae.pin=pe.pin),ae}function de(pe){if(pe===null||typeof pe!="object")return pe;try{return structuredClone(pe)}catch{}try{return JSON.parse(JSON.stringify(pe))}catch{return pe}}function Oe(pe,ae){const ge=pe??null,ve=ae??null;if(ge===ve)return!0;if(ge===null||ve===null)return!1;if(typeof ge!="object"||typeof ve!="object")return ge===ve;try{return JSON.stringify(ge)===JSON.stringify(ve)}catch{return!1}}function Me(pe){const ae=[],ge=(le,we,he)=>{const be=[];for(const Te of le){if(!s(Te)){J("a column definition must be an object");continue}if(Array.isArray(Te.columns)){ee(Te,q,"columnGroup",Te.title||Te.id||"(unnamed)");const je={id:Te.id||o("grp"),title:Te.title||"",collapsible:Te.collapsible===!0,openByDefault:Te.openByDefault!==!1,showWhen:Te.showWhen||"always",marryChildren:Te.marryChildren===!0,header:Te.header||{},def:Te,columns:[]};je.columns=ge(Te.columns,[...we,je.id],Te.facet!==void 0?Te.facet:he),be.push(je)}else{const je={def:Te,path:we,facet:he};ae.push(je),be.push(je)}}return be},ve=ge(pe,[],void 0);return{leaves:ae,groups:ve}}function Fe(pe,ae,ge){for(const ve of pe){if(ve.columns){if(Fe(ve.columns,ae,ge))return!0;continue}if(ve.column&&ve.column.id===ae)return ve.column=ge,!0}return!1}}),ze("packages/core/src/columns/autogroup.js",function(e,_){"use strict";Object.defineProperty(e,"AUTO_GROUP_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createAutoGroupColumn",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"warnOnAbsurdGrouping",{enumerable:!0,get:function(){return X}});const E=_("packages/core/src/internal/warn.js").warnOnce,K="__lattice_group",U=240,D=.5;function J(I){const j=I.def&&I.def.layout;return(typeof j=="number"||j&&j.width!=null||I.def&&I.def.width!=null)&&Number.isFinite(I.layout.width)?I.layout.width:null}function z(I){const j=I.def&&I.def.layout;return!!(j&&j.min!=null)||I.def&&I.def.minWidth!=null}function L(I){const{columns:j,groupBy:k}=I,y=k.map(c=>j.get(c)).filter(Boolean),l=y.length?y.map(c=>c.title||c.id).join(" > "):"Group",g=y.find(c=>J(c)!=null),s=I.config&&I.config.autoGroupColumnWidth||(g?J(g):U);let t=g&&z(g)?g.layout.min:120;g&&!z(g)&&(t=Math.min(t,s));const o=g&&g.layout.max!=null?g.layout.max:null;return{id:K,field:null,title:l,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group"},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!0},groupedIds:k.slice(),group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:s,min:t,max:o,pin:I.config&&I.config.autoGroupColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(c,d){return d&&d.group?d.groupValue:null},formatValue(c,d){if(!d||!d.group)return"";if(d.grandTotal)return I.config&&I.config.grandTotalLabel||"Total";const n=y[Math.min(d.level||0,y.length-1)];return n&&typeof n.formatValue=="function"?n.formatValue(c,d):c==null?"":String(c)}}}function X(I,j,k){!I.length||k<100||j<k*D||E(`grouping.cardinality:${I.join(",")}`,`grouping by ${I.join(", ")} produced ${j} 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.`)}}),ze("packages/core/src/columns/selectcolumn.js",function(e,_){"use strict";Object.defineProperty(e,"SELECT_COLUMN_ID",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"createSelectionColumn",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return U}});const ne="__lattice_select",E=44;function K(D){const J=D.selection||{},z=D.config&&D.config.selectionColumnWidth||E;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:z,min:z,max:z,pin:D.config&&D.config.selectionColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,headerCheckbox:J.headerCheckbox===!0,def:{},getValue(L,X){return X?X.selected:!1},formatValue(){return""}}}const U=K}),ze("packages/core/src/columns/rownumbercolumn.js",function(e,_){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createRowNumberColumn",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return X}});const E=_("packages/core/src/internal/predicates.js").isFunction,K="__lattice_rownumber",U=40,D=9,J=22;function z(I){const j=String(Math.max(1,Math.trunc(Math.abs(I))||1)).length;return Math.max(U,j*D+J)}function L(I){const j=I.rowNumbers,k=j&&typeof j=="object"?j:{},y=Number.isFinite(k.start)?k.start:1,l=Number.isFinite(k.width)?k.width:z((I.maxNumber||0)+y),g=E(I.rank)?I.rank:()=>null;return{id:K,field:null,title:typeof k.title=="string"?k.title:"",type:"number",dataType:{base:"number"},nullable:!0,align:"end",generated:!0,control:!0,value:{pure:!0},cell:{align:"end"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:l,min:l,max:l,pin:"start",hidden:!1,resizable:k.width==null,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(s,t){const o=g(t);return o==null?null:o-1+y},formatValue(s){return s==null?"":String(s)}}}const X=L}),ze("packages/core/src/model/detail.js",function(e,_){"use strict";Object.defineProperty(e,"DEFAULT_DETAIL_HEIGHT",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"DEFAULT_CACHE_LIMIT",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"DetailModel",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return X}});const E=_("packages/core/src/internal/predicates.js").isFunction,U=_("packages/core/src/internal/warn.js").warnOnce,D=240,J=10;function z(I){if(!I)return null;const j=I===!0?{}:I;return j.enabled===!1?null:!E(j.rows)&&!j.render?(U("detail.rows","detail is enabled but neither `rows` nor `render` was supplied; expanding a master would show an empty region, so it stays off."),null):{render:j.render||null,config:j.config||null,rows:E(j.rows)?j.rows:null,height:j.height??D,maxHeight:j.maxHeight??null,cacheLimit:Number.isFinite(j.cacheLimit)?Math.max(0,j.cacheLimit):J,isMaster:E(j.isMaster)?j.isMaster:null,target:j.target||null,onCreate:E(j.onCreate)?j.onCreate:null,path:typeof j.path=="string"?j.path:null}}class L{#e;#t=new Set;#n;#r=0;constructor(j){this.#e=j.config,this.#n=E(j.onChange)?j.onChange:()=>{}}get config(){return this.#e}get inline(){return!this.#e.target}isMaster(j){if(!j||j.group||j.detail)return!1;const k=this.#e.isMaster;return k?!!k(j.data,j):!0}isOpen(j){return this.#t.has(j)}keys(){return[...this.#t]}activeKey(){for(const j of this.#t)return j;return null}heightOf(j){const k=this.#e.height;return E(k)?Number(k(j))||D:k==="auto"?D:Number(k)||D}open(j){return this.#t.has(j)?!1:(this.inline||this.#t.clear(),this.#t.add(j),this.#s(),!0)}close(j){return this.#t.delete(j)?(this.#s(),!0):!1}toggle(j){return this.#t.has(j)?(this.close(j),!1):(this.open(j),!0)}closeAll(){this.#t.size&&(this.#t.clear(),this.#s())}prune(j){if(!this.#t.size||!E(j))return;let k=!1;for(const y of[...this.#t])j(y)||(this.#t.delete(y),k=!0);k&&this.#s()}signature(){return`${this.#r}`}set(j){this.#t.clear();const k=Array.isArray(j)?j:[];for(const y of this.inline?k:k.slice(0,1))this.#t.add(y);this.#s()}#s(){this.#r++,this.#n()}}const X=L}),ze("packages/core/src/compute/special.js",function(e,_){"use strict";Object.defineProperty(e,"logGamma",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"incompleteBeta",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"normalQuantile",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"normalCdf",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"studentT",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"chiSquareUpperTail",{enumerable:!0,get:function(){return s}});const ne=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),E=3e-12,K=1e-300;function U(t){if(t<.5)return Math.log(Math.PI/Math.sin(Math.PI*t))-U(1-t);const o=t-1;let c=.9999999999998099;const d=o+7.5;for(let n=0;n<ne.length;n++)c+=ne[n]/(o+n+1);return .5*Math.log(2*Math.PI)+(o+.5)*Math.log(d)-d+Math.log(c)}function D(t,o,c){const d=t+o,n=t+1,p=t-1;let i=1,r=1-d*c/n;Math.abs(r)<K&&(r=K),r=1/r;let f=r;for(let m=1;m<=300;m++){const u=2*m;let b=m*(o-m)*c/((p+u)*(t+u));r=1+b*r,Math.abs(r)<K&&(r=K),i=1+b/i,Math.abs(i)<K&&(i=K),r=1/r,f*=r*i,b=-(t+m)*(d+m)*c/((t+u)*(n+u)),r=1+b*r,Math.abs(r)<K&&(r=K),i=1+b/i,Math.abs(i)<K&&(i=K),r=1/r;const a=r*i;if(f*=a,Math.abs(a-1)<E)break}return f}function J(t,o,c){if(!(t>0)||!(o>0)||!Number.isFinite(c))return Number.NaN;if(c<=0)return 0;if(c>=1)return 1;const d=Math.exp(U(t+o)-U(t)-U(o)+t*Math.log(c)+o*Math.log(1-c));return c<(t+1)/(t+o+2)?d*D(t,o,c)/t:1-d*D(o,t,1-c)/o}function z(t){if(!(t>0)||!(t<1))return t===0?-1/0:t===1?1/0:Number.NaN;const o=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],c=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],d=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],n=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],p=.02425;let i,r,f;t<p?(i=Math.sqrt(-2*Math.log(t)),f=(((((d[0]*i+d[1])*i+d[2])*i+d[3])*i+d[4])*i+d[5])/((((n[0]*i+n[1])*i+n[2])*i+n[3])*i+1)):t<=1-p?(i=t-.5,r=i*i,f=(((((o[0]*r+o[1])*r+o[2])*r+o[3])*r+o[4])*r+o[5])*i/(((((c[0]*r+c[1])*r+c[2])*r+c[3])*r+c[4])*r+1)):(i=Math.sqrt(-2*Math.log(1-t)),f=-(((((d[0]*i+d[1])*i+d[2])*i+d[3])*i+d[4])*i+d[5])/((((n[0]*i+n[1])*i+n[2])*i+n[3])*i+1));const u=(.5*L(-f/Math.SQRT2)-t)*Math.sqrt(2*Math.PI)*Math.exp(f*f/2);return f-u/(1+f*u/2)}function L(t){const o=Math.abs(t),c=2/(2+o),d=4*c-2,n=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,15626441722e-18,-85238095915e-18,6529054439e-18,5059343495e-18,-991364156e-18,-227365122e-18,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18];let p=0,i=0,r;for(let m=n.length-1;m>0;m--)r=i,i=d*i-p+n[m],p=r;const f=c*Math.exp(-o*o+.5*(n[0]+d*i)-p);return t>=0?f:2-f}function X(t){return .5*L(-t/Math.SQRT2)}function I(t,o){if(!(o>0)||!Number.isFinite(t))return Number.NaN;const c=.5*J(o/2,.5,o/(o+t*t));return t>0?1-c:c}function j(t,o){if(!(t>0)||!(t<1)||!(o>0))return Number.NaN;if(o>1e7)return z(t);let c=-1e4,d=1e4,n=z(t);const p=U(o/2)+U(.5)-U((o+1)/2);for(let i=0;i<60;i++){const r=I(n,o);r<t?c=n:d=n;const f=Math.exp(-((o+1)/2)*Math.log(1+n*n/o)-p)/Math.sqrt(o),m=f>0?(r-t)/f:0;if(Math.abs(m)<1e-12)break;const u=n-m;if(n=u>c&&u<d&&Number.isFinite(u)?u:(c+d)/2,d-c<1e-12)break}return n}function k(t,o){let c=t,d=1/t,n=d;for(let p=0;p<300&&(c+=1,n*=o/c,d+=n,!(Math.abs(n)<Math.abs(d)*E));p++);return d*Math.exp(-o+t*Math.log(o)-U(t))}function y(t,o){let c=o+1-t,d=1/K,n=1/c,p=n;for(let i=1;i<=300;i++){const r=-i*(i-t);c+=2,n=r*n+c,Math.abs(n)<K&&(n=K),d=c+r/d,Math.abs(d)<K&&(d=K),n=1/n;const f=n*d;if(p*=f,Math.abs(f-1)<E)break}return Math.exp(-o+t*Math.log(o)-U(t))*p}function l(t,o){return!(t>0)||!(o>=0)||!Number.isFinite(o)?Number.NaN:o===0?0:o<t+1?k(t,o):1-y(t,o)}function g(t,o){return o>0?l(o/2,t/2):Number.NaN}function s(t,o){const c=g(t,o);return Number.isNaN(c)?Number.NaN:Math.min(1,Math.max(0,1-c))}}),ze("packages/core/src/compute/linalg.js",function(e,_){"use strict";Object.defineProperty(e,"cholesky",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"choleskySolve",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"choleskyInverse",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"normalEquations",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return J}});function ne(z){const L=z.length,X=Array.from({length:L},()=>new Array(L).fill(0));for(let I=0;I<L;I++)for(let j=0;j<=I;j++){let k=z[I][j];for(let y=0;y<j;y++)k-=X[I][y]*X[j][y];if(I===j){if(!(k>0))return null;X[I][j]=Math.sqrt(k)}else X[I][j]=k/X[j][j]}return X}function E(z,L){const X=z.length,I=new Array(X).fill(0);for(let k=0;k<X;k++){let y=L[k];for(let l=0;l<k;l++)y-=z[k][l]*I[l];I[k]=y/z[k][k]}const j=new Array(X).fill(0);for(let k=X-1;k>=0;k--){let y=I[k];for(let l=k+1;l<X;l++)y-=z[l][k]*j[l];j[k]=y/z[k][k]}return j}function K(z){const L=z.length,X=Array.from({length:L},()=>new Array(L).fill(0));for(let I=0;I<L;I++){const j=new Array(L).fill(0);j[I]=1;const k=E(z,j);for(let y=0;y<L;y++)X[y][I]=k[y]}return X}function U(z,L,X){const I=z.length,j=I?z[0].length:0,k=Array.from({length:j},()=>new Array(j).fill(0)),y=new Array(j).fill(0);for(let l=0;l<I;l++){const g=X?X[l]:1,s=z[l];for(let t=0;t<j;t++){const o=g*s[t];y[t]+=o*L[l];for(let c=t;c<j;c++)k[t][c]+=o*s[c]}}for(let l=0;l<j;l++)for(let g=0;g<l;g++)k[l][g]=k[g][l];return{xtwx:k,xtwy:y}}function D(z,L){return z.map(X=>X.reduce((I,j,k)=>I+j*L[k],0))}function J(z,L){let X=0;for(let I=0;I<z.length;I++){let j=0;for(let k=0;k<z.length;k++)j+=L[I][k]*z[k];X+=z[I]*j}return X}}),ze("packages/core/src/compute/sketch.js",function(e,_){"use strict";Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return k}});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(l){if(!Number.isFinite(l))return;this.#e++;const g=l-this.#t;this.#t+=g/this.#e,this.#n+=g*(l-this.#t)}merge(l){if(l.#e===0)return;if(this.#e===0){this.#e=l.#e,this.#t=l.#t,this.#n=l.#n;return}const g=this.#e+l.#e,s=l.#t-this.#t;this.#t+=s*(l.#e/g),this.#n+=l.#n+s*s*(this.#e*l.#e/g),this.#e=g}mean(){return this.#e?this.#t:null}variance(){return this.#e>1?this.#n/(this.#e-1):null}varianceP(){return this.#e?this.#n/this.#e:null}stddev(){const l=this.variance();return l===null?null:Math.sqrt(l)}stddevP(){const l=this.varianceP();return l===null?null:Math.sqrt(l)}}class E{#e=[];#t=0;#n;#r;constructor(l,g=Math.random){if(!(l>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(l),this.#r=g}static get errorBound(){return Object.freeze({kind:"probabilistic",metric:"none",value:0,statement:"uniform sample: each element included with probability capacity/n; sample statistics are unbiased estimators"})}get seen(){return this.#t}get size(){return this.#e.length}add(l){if(!Number.isFinite(l))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(l);return}const g=Math.floor(this.#r()*this.#t);g<this.#n&&(this.#e[g]=l)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let l=0;for(const g of this.#e)l+=g;return l/this.#e.length}quantile(l){const g=this.#e.length;if(!g)return null;const s=this.#e.slice().sort((d,n)=>d-n);if(g===1)return s[0];const t=(g-1)*Math.min(1,Math.max(0,l)),o=Math.floor(t),c=Math.ceil(t);return o===c?s[o]:s[o]+(t-o)*(s[c]-s[o])}}function K(y){return y^=y>>>16,y=Math.imul(y,2246822507),y^=y>>>13,y=Math.imul(y,3266489909),y^=y>>>15,y>>>0}function U(y){if(typeof y=="number"){const s=new DataView(new ArrayBuffer(8));return s.setFloat64(0,y===0?0:y),K(s.getUint32(0)^s.getUint32(4))}const l=typeof y=="string"?y:String(y);let g=2166136261;for(let s=0;s<l.length;s++)g^=l.charCodeAt(s),g=Math.imul(g,16777619);return K(g)}class D{#e;#t;#n;constructor(l=14){const g=Math.floor(l);if(g<4||g>16)throw new RangeError("HLL precision must be 4..16");this.#e=g,this.#t=1<<g,this.#n=new Uint8Array(this.#t)}static errorBoundFor(l=14){const g=1<<Math.floor(l),s=1.04/Math.sqrt(g);return Object.freeze({kind:"probabilistic",metric:"relative",value:s,statement:`distinct count within ~${(s*100).toFixed(2)}% relative standard error (m=${g} buckets)`})}errorBound(){return D.errorBoundFor(this.#e)}add(l){const g=U(l),s=g&this.#t-1,t=g>>>this.#e|1<<32-this.#e;let o=1,c=t;for(;(c&1)===0;)o++,c>>>=1;o>this.#n[s]&&(this.#n[s]=o)}count(){const l=this.#t,g=32-this.#e,s=new Float64Array(g+2);for(let c=0;c<l;c++)s[this.#n[c]]++;let t=l*L(1-s[g+1]/l);for(let c=g;c>=1;c--)t=.5*(t+s[c]);t+=l*z(s[0]/l);const o=J*l*l/t;return Math.round(o)}}const J=.5/Math.log(2);function z(y){if(y===1)return 1/0;let l=1,g=y,s;do y*=y,s=g,g+=y*l,l+=l;while(g!==s);return g}function L(y){if(y===0||y===1)return 0;let l=1,g=1-y,s;do y=Math.sqrt(y),s=g,l*=.5,g-=(1-y)**2*l;while(g!==s);return g/3}class X{#e=new Map;#t;#n=0;constructor(l){if(!(l>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(l)}errorBoundFor(l){const g=l/this.#t;return Object.freeze({kind:"deterministic",metric:"absolute",value:g,statement:`each count overestimates the truth by at most N/m = ${g.toFixed(2)} (N=${l}, m=${this.#t})`})}get seen(){return this.#n}add(l){this.#n++;const g=this.#e.get(l);if(g){g.count++;return}if(this.#e.size<this.#t){this.#e.set(l,{count:1,error:0});return}let s,t=1/0;for(const[o,c]of this.#e)c.count<t&&(t=c.count,s=o);this.#e.delete(s),this.#e.set(l,{count:t+1,error:t})}top(l=this.#t){return[...this.#e.entries()].map(([s,t])=>({item:s,count:t.count,error:t.error})).sort((s,t)=>t.count-s.count).slice(0,Math.max(0,Math.floor(l)))}}class I{#e;#t=[[]];#n=0;#r;#s;constructor(l=200,g=Math.random){this.#e=Math.max(8,Math.floor(l)),this.#r=g,this.#s=2/3}static errorBoundFor(l=200){const g=1/Math.max(8,Math.floor(l));return Object.freeze({kind:"probabilistic",metric:"rank",value:g,statement:`queried quantile's true rank within ~${(g*100).toFixed(2)}% of N of the requested rank (k=${l})`})}errorBound(){return I.errorBoundFor(this.#e)}get count(){return this.#n}#i(l){const s=this.#t.length-1-l,t=Math.ceil(this.#e*this.#s**s);return Math.max(2,t)}add(l){Number.isFinite(l)&&(this.#n++,this.#t[0].push(l),this.#t[0].length>=this.#i(0)&&this.#o(0))}#o(l){const g=this.#t[l];g.sort((o,c)=>o-c),l+1>=this.#t.length&&this.#t.push([]);const s=this.#t[l+1],t=this.#r()<.5?0:1;for(let o=t;o<g.length;o+=2)s.push(g[o]);this.#t[l]=[];for(let o=0;o<this.#t.length;o++)if(this.#t[o].length>=this.#i(o)){this.#o(o);return}}#l(){const l=[];for(let g=0;g<this.#t.length;g++){const s=1<<g;for(const t of this.#t[g])l.push({v:t,w:s})}return l}quantile(l){const g=this.#l();if(!g.length)return null;g.sort((c,d)=>c.v-d.v);let s=0;for(const c of g)s+=c.w;const t=Math.min(1,Math.max(0,l))*s;let o=0;for(const c of g)if(o+=c.w,o>=t)return c.v;return g[g.length-1].v}rank(l){let g=0;for(let s=0;s<this.#t.length;s++){const t=1<<s;for(const o of this.#t[s])o<=l&&(g+=t)}return g}}const j=Object.freeze({distinct:D.errorBoundFor(14),median:I.errorBoundFor(200),p25:I.errorBoundFor(200),p75:I.errorBoundFor(200),p90:I.errorBoundFor(200),p95:I.errorBoundFor(200),p99:I.errorBoundFor(200),iqr:I.errorBoundFor(200),topK:Object.freeze({kind:"deterministic",metric:"absolute",value:0,statement:"each count overestimates the truth by at most N/m; top-K exact when the K-th item exceeds N/m"})}),k={Welford:ne,Reservoir:E,HyperLogLog:D,SpaceSaving:X,KLL:I,hash32:U,SKETCH_BOUNDS:j}}),ze("packages/core/src/compute/statistics.js",function(e,_){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"numbers",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"frequencies",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"herfindahl",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"entropy",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"evenness",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"topShare",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"gini",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"moments",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"quantileSorted",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"quantile",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"STAT_FNS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"modifiedZOutliers",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"jarqueBera",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"weightedQuantile",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"covariance",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(e,"autocorrelations",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"spearman",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"kendall",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"seriesStats",{enumerable:!0,get:function(){return le}}),Object.defineProperty(e,"D2_N2",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"D4_N2",{enumerable:!0,get:function(){return he}}),Object.defineProperty(e,"movingRanges",{enumerable:!0,get:function(){return be}}),Object.defineProperty(e,"withinSigma",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return He}}),Object.defineProperty(e,"countOutside",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(e,"histogram",{enumerable:!0,get:function(){return We}}),Object.defineProperty(e,"DEFAULT_CONFIDENCE",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(e,"meanInterval",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(e,"proportionInterval",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(e,"slopeInterval",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(e,"capabilityInterval",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(e,"standardizedMeanDifference",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(e,"normalTotalVariation",{enumerable:!0,get:function(){return ht}}),Object.defineProperty(e,"frequencyMap",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(e,"categoricalDistance",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(e,"SUBSET_RELIABILITY_FLOOR",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(e,"compareColumn",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(e,"isNumericColumn",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(e,"populationRead",{enumerable:!0,get:function(){return $e}});const ne=_("packages/core/src/compute/handle.js"),E=ne.presenceReader,K=ne.valueReader,U=_("packages/core/src/compute/special.js"),D=U.studentTQuantile,J=U.studentT,z=U.normalQuantile,L=U.normalCdf,X=U.chiSquareUpperTail,I=_("packages/core/src/compute/linalg.js"),j=I.cholesky,k=I.choleskySolve,y=I.choleskyInverse,l=I.normalEquations,g=I.quadForm,t=_("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,o=5e3,c=Object.freeze({variance:"rescan",varianceP:"rescan",stddev:"rescan",stddevP:"rescan",sumSquares:"rescan",weightedAvg:"rescan",median:"rescan",p25:"rescan",p75:"rescan",p90:"rescan",p95:"rescan",p99:"rescan",iqr:"rescan",mode:"rescan",distinct:"rescan",range:"rescan",skewness:"rescan",kurtosis:"rescan",geomean:"rescan",harmean:"rescan",mad:"rescan",argmin:"rescan",argmax:"rescan",hhi:"rescan",entropy:"rescan",evenness:"rescan",top3Share:"rescan",top10Share:"rescan",gini:"rescan",trimmedMean:"rescan",winsorizedMean:"rescan",robustOutliers:"rescan",jarqueBera:"rescan",passRate:"rescan",failureCount:"rescan"}),d=Object.freeze({distinct:Object.freeze({sketch:"HyperLogLog",bound:t.distinct}),median:Object.freeze({sketch:"KLL",bound:t.median}),p25:Object.freeze({sketch:"KLL",bound:t.p25}),p75:Object.freeze({sketch:"KLL",bound:t.p75}),p90:Object.freeze({sketch:"KLL",bound:t.p90}),p95:Object.freeze({sketch:"KLL",bound:t.p95}),p99:Object.freeze({sketch:"KLL",bound:t.p99}),iqr:Object.freeze({sketch:"KLL",bound:t.iqr}),top3Share:Object.freeze({sketch:"SpaceSaving",bound:t.topK}),top10Share:Object.freeze({sketch:"SpaceSaving",bound:t.topK})});function n(ye){const xe=ye==="sum"||ye==="avg"||ye==="countValues"||ye==="min"||ye==="max"?"maintained":Object.prototype.hasOwnProperty.call(c,ye)?c[ye]:null,Se=Object.prototype.hasOwnProperty.call(d,ye)?d[ye]:null;return{stat:ye,exact:xe,approximate:Se}}function p(ye,xe){const Se=xe.length,Le=new Float64Array(Se);let se=0;if(ye&&(ye.kind==="float64"||ye.kind==="int32")){const Ne=ye.values,De=E(ye);for(let Be=0;Be<Se;Be++){const Ye=xe[Be];if(De&&De(Ye)!==1)continue;const Qe=Ne[Ye];Number.isNaN(Qe)||(Le[se++]=Qe)}return Le.subarray(0,se)}const Pe=K(ye);for(let Ne=0;Ne<Se;Ne++){const De=Pe(xe[Ne]);if(De==null||De==="")continue;const Be=typeof De=="number"?De:Number(De);Number.isFinite(Be)&&(Le[se++]=Be)}return Le.subarray(0,se)}function i(ye,xe){const Se=new Map,Le=K(ye);let se=0;for(let Pe=0;Pe<xe.length;Pe++){const Ne=Le(xe[Pe]);if(Ne==null||Ne===""||typeof Ne=="number"&&Number.isNaN(Ne))continue;const De=typeof Ne=="object"?String(Ne):Ne;Se.set(De,(Se.get(De)||0)+1),se++}const ce=[...Se.values()].sort((Pe,Ne)=>Ne-Pe);return{counts:ce,total:se,distinct:ce.length}}function r(ye){return ye.total>0?ye.counts.map(xe=>xe/ye.total):[]}function f(ye,xe){const Se=i(ye,xe);if(!Se.total)return null;let Le=0;for(const se of r(Se))Le+=se*se;return Le}function m(ye,xe){const Se=i(ye,xe);if(!Se.total)return null;let Le=0;for(const se of r(Se))se>0&&(Le-=se*Math.log2(se));return Le}function u(ye,xe){const Se=i(ye,xe);if(!Se.total||Se.distinct<2)return Se.total?1:null;let Le=0;for(const se of r(Se))se>0&&(Le-=se*Math.log2(se));return Le/Math.log2(Se.distinct)}function b(ye,xe,Se=3){const Le=i(ye,xe);if(!Le.total)return null;const se=Math.max(1,Math.floor(Se));let ce=0;for(let Pe=0;Pe<Math.min(se,Le.counts.length);Pe++)ce+=Le.counts[Pe];return ce/Le.total}function a(ye,xe){const Se=p(ye,xe),Le=Se.length;if(!Le)return null;const se=Se.slice().sort();if(se[0]<0)return null;let ce=0,Pe=0;for(let Ne=0;Ne<Le;Ne++)ce+=se[Ne],Pe+=(Ne+1)*se[Ne];return ce===0?0:2*Pe/(Le*ce)-(Le+1)/Le}function h(ye){let xe=0,Se=0,Le=0;for(let se=0;se<ye.length;se++){const ce=ye[se];xe++;const Pe=ce-Se;Se+=Pe/xe,Le+=Pe*(ce-Se)}return{n:xe,mean:Se,m2:Le}}function w(ye,xe){const Se=ye.length;if(!Se)return NaN;if(Se===1)return ye[0];const Le=(Se-1)*Math.min(1,Math.max(0,xe)),se=Math.floor(Le),ce=Math.ceil(Le);return se===ce?ye[se]:ye[se]+(Le-se)*(ye[ce]-ye[se])}function v(ye,xe){if(!ye.length)return NaN;const Se=ye.slice().sort();return w(Se,xe)}function A(ye,xe){const Se=K(ye);let Le=0,se=0,ce=0;for(let Pe=0;Pe<xe.length;Pe++){const Ne=Se(xe[Pe]);if(Ne==null||Ne==="")continue;const De=String(Ne).toUpperCase();De==="PASS"?Le++:De==="FAIL"?se++:De==="WARN"&&ce++}return{pass:Le+ce,fail:se,warn:ce,judged:Le+ce+se}}const H=Object.freeze({hhi:(ye,xe)=>f(ye,xe),entropy:(ye,xe)=>m(ye,xe),evenness:(ye,xe)=>u(ye,xe),top3Share:(ye,xe)=>b(ye,xe,3),top10Share:(ye,xe)=>b(ye,xe,10),gini:(ye,xe)=>a(ye,xe),trimmedMean:(ye,xe)=>T(p(ye,xe),.1),winsorizedMean:(ye,xe)=>O(p(ye,xe),.1),robustOutliers:(ye,xe)=>N(p(ye,xe),3.5),jarqueBera:(ye,xe)=>P(p(ye,xe)),variance:(ye,xe)=>{const{n:Se,m2:Le}=h(p(ye,xe));return Se>1?Le/(Se-1):null},varianceP:(ye,xe)=>{const{n:Se,m2:Le}=h(p(ye,xe));return Se>0?Le/Se:null},stddev:(ye,xe)=>{const{n:Se,m2:Le}=h(p(ye,xe));return Se>1?Math.sqrt(Le/(Se-1)):null},stddevP:(ye,xe)=>{const{n:Se,m2:Le}=h(p(ye,xe));return Se>0?Math.sqrt(Le/Se):null},median:(ye,xe)=>{const Se=p(ye,xe);return Se.length?v(Se,.5):null},p25:(ye,xe)=>{const Se=p(ye,xe);return Se.length?v(Se,.25):null},p75:(ye,xe)=>{const Se=p(ye,xe);return Se.length?v(Se,.75):null},p90:(ye,xe)=>{const Se=p(ye,xe);return Se.length?v(Se,.9):null},p95:(ye,xe)=>{const Se=p(ye,xe);return Se.length?v(Se,.95):null},p99:(ye,xe)=>{const Se=p(ye,xe);return Se.length?v(Se,.99):null},iqr:(ye,xe)=>{const Se=p(ye,xe);if(!Se.length)return null;const Le=Se.slice().sort();return w(Le,.75)-w(Le,.25)},mad:(ye,xe)=>{const Se=p(ye,xe);if(!Se.length)return null;const Le=v(Se,.5),se=new Float64Array(Se.length);for(let ce=0;ce<Se.length;ce++)se[ce]=Math.abs(Se[ce]-Le);return v(se,.5)},range:(ye,xe)=>{const Se=p(ye,xe);if(!Se.length)return null;let Le=1/0,se=-1/0;for(let ce=0;ce<Se.length;ce++)Se[ce]<Le&&(Le=Se[ce]),Se[ce]>se&&(se=Se[ce]);return se-Le},distinct:(ye,xe)=>{const Se=K(ye),Le=new Set;for(let se=0;se<xe.length;se++){const ce=Se(xe[se]);ce==null||ce===""||Le.add(ce instanceof Date?ce.getTime():ce)}return Le.size},mode:(ye,xe)=>{const Se=K(ye),Le=new Map;for(let Pe=0;Pe<xe.length;Pe++){const Ne=Se(xe[Pe]);if(Ne==null||Ne==="")continue;const De=Ne instanceof Date?Ne.getTime():Ne;Le.set(De,(Le.get(De)||0)+1)}let se=null,ce=1;for(const[Pe,Ne]of Le)Ne>ce&&(ce=Ne,se=Pe);return se},skewness:(ye,xe)=>{const Se=p(ye,xe),{n:Le,mean:se,m2:ce}=h(Se);if(Le<3||ce<=0)return null;const Pe=Math.sqrt(ce/(Le-1));let Ne=0;for(let De=0;De<Se.length;De++)Ne+=((Se[De]-se)/Pe)**3;return Le/((Le-1)*(Le-2))*Ne},kurtosis:(ye,xe)=>{const Se=p(ye,xe),{n:Le,mean:se,m2:ce}=h(Se);if(Le<4||ce<=0)return null;const Pe=Math.sqrt(ce/(Le-1));let Ne=0;for(let Ye=0;Ye<Se.length;Ye++)Ne+=((Se[Ye]-se)/Pe)**4;const De=Le*(Le+1)/((Le-1)*(Le-2)*(Le-3)),Be=3*(Le-1)**2/((Le-2)*(Le-3));return De*Ne-Be},geomean:(ye,xe)=>{const Se=p(ye,xe);if(!Se.length)return null;let Le=0;for(let se=0;se<Se.length;se++){if(Se[se]<=0)return null;Le+=Math.log(Se[se])}return Math.exp(Le/Se.length)},harmean:(ye,xe)=>{const Se=p(ye,xe);if(!Se.length)return null;let Le=0;for(let se=0;se<Se.length;se++){if(Se[se]===0)return null;Le+=1/Se[se]}return Se.length/Le},sumSquares:(ye,xe)=>{const Se=p(ye,xe);let Le=0;for(let se=0;se<Se.length;se++)Le+=Se[se]*Se[se];return Le},passRate:(ye,xe)=>{const{pass:Se,judged:Le}=A(ye,xe);return Le?Se/Le:null},failureCount:(ye,xe)=>A(ye,xe).fail}),G=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 Z(ye,xe,Se){const Le=K(ye),se=K(xe);let ce=0,Pe=0;for(let Ne=0;Ne<Se.length;Ne++){const De=Se[Ne],Be=Number(Le(De)),Ye=Number(se(De));!Number.isFinite(Be)||!Number.isFinite(Ye)||(ce+=Be*Ye,Pe+=Ye)}return Pe===0?null:ce/Pe}function M(ye,xe,Se){const Le=K(ye);let se=null,ce=Se?-1/0:1/0;for(let Pe=0;Pe<xe.length;Pe++){const Ne=xe[Pe],De=Number(Le(Ne));Number.isFinite(De)&&(Se?De>ce:De<ce)&&(ce=De,se=Ne)}return se}function S(ye,xe,Se){const Le=K(ye),se=K(xe);let ce=0,Pe=0,Ne=0,De=0,Be=0,Ye=0;for(let Ge=0;Ge<Se.length;Ge++){const nt=Se[Ge],at=Number(Le(nt)),rt=Number(se(nt));!Number.isFinite(at)||!Number.isFinite(rt)||(ce++,Pe+=at,Ne+=rt,De+=at*at,Be+=rt*rt,Ye+=at*rt)}if(ce<2)return null;const Qe=ce*Ye-Pe*Ne,ct=Math.sqrt((ce*De-Pe*Pe)*(ce*Be-Ne*Ne));if(ct===0)return null;const pt=Qe/ct;return Math.max(-1,Math.min(1,pt))}function T(ye,xe=.1){const Se=ye.length;if(!Se)return null;const Le=Array.from(ye).sort((Ne,De)=>Ne-De),se=Math.floor(Se*Math.min(.49,Math.max(0,xe))),ce=Le.slice(se,Se-se);if(!ce.length)return w(Le,.5);let Pe=0;for(const Ne of ce)Pe+=Ne;return Pe/ce.length}function O(ye,xe=.1){const Se=ye.length;if(!Se)return null;const Le=Array.from(ye).sort((De,Be)=>De-Be),se=Math.floor(Se*Math.min(.49,Math.max(0,xe))),ce=Le[se],Pe=Le[Se-1-se];let Ne=0;for(const De of Le)Ne+=Math.min(Pe,Math.max(ce,De));return Ne/Se}function N(ye,xe=3.5){if(!ye.length)return null;const Le=Array.from(ye).sort((De,Be)=>De-Be),se=w(Le,.5),ce=Le.map(De=>Math.abs(De-se)).sort((De,Be)=>De-Be),Pe=w(ce,.5);if(Pe===0)return null;let Ne=0;for(const De of Le)Math.abs(.6745*(De-se)/Pe)>xe&&Ne++;return Ne}function P(ye){const xe=ye.length;if(xe<8)return null;let Se=0;for(const De of ye)Se+=De;Se/=xe;let Le=0,se=0,ce=0;for(const De of ye){const Be=De-Se;Le+=Be*Be,se+=Be*Be*Be,ce+=Be*Be*Be*Be}if(Le/=xe,se/=xe,ce/=xe,Le===0)return null;const Pe=se/Le**1.5,Ne=ce/(Le*Le)-3;return xe/6*(Pe*Pe+Ne*Ne/4)}function C(ye,xe,Se){const Le=[];let se=0;for(let De=0;De<ye.length;De++){const Be=Number(ye[De]),Ye=Number(xe[De]);!Number.isFinite(Be)||!Number.isFinite(Ye)||Ye<=0||(Le.push([Be,Ye]),se+=Ye)}if(!Le.length||se<=0)return null;if(Le.sort((De,Be)=>De[0]-Be[0]),Le.length===1)return Le[0][0];const ce=[];let Pe=0;for(const[,De]of Le)ce.push((Pe+De/2)/se),Pe+=De;const Ne=Math.max(0,Math.min(1,Se));if(Ne<=ce[0])return Le[0][0];if(Ne>=ce[ce.length-1])return Le[Le.length-1][0];for(let De=1;De<ce.length;De++){if(Ne>ce[De])continue;const Be=ce[De]-ce[De-1],Ye=Be>0?(Ne-ce[De-1])/Be:0;return Le[De-1][0]+(Le[De][0]-Le[De-1][0])*Ye}return Le[Le.length-1][0]}function B(ye,xe,Se){const Le=K(ye),se=K(xe),ce=new Float64Array(Se.length),Pe=new Float64Array(Se.length);let Ne=0;for(let De=0;De<Se.length;De++){const Be=Se[De],Ye=Number(Le(Be)),Qe=Number(se(Be));!Number.isFinite(Ye)||!Number.isFinite(Qe)||(ce[Ne]=Ye,Pe[Ne]=Qe,Ne++)}return{xs:ce.subarray(0,Ne),ys:Pe.subarray(0,Ne),n:Ne}}function x(ye,xe,Se,Le=!1){const{xs:se,ys:ce,n:Pe}=B(ye,xe,Se);if(Pe<2)return null;let Ne=0,De=0;for(let Ye=0;Ye<Pe;Ye++)Ne+=se[Ye],De+=ce[Ye];Ne/=Pe,De/=Pe;let Be=0;for(let Ye=0;Ye<Pe;Ye++)Be+=(se[Ye]-Ne)*(ce[Ye]-De);return Be/(Le?Pe:Pe-1)}function V(ye,xe,Se){const{xs:Le,ys:se,n:ce}=B(ye,xe,Se);if(ce<2)return null;let Pe=0,Ne=0;for(let at=0;at<ce;at++)Pe+=Le[at],Ne+=se[at];Pe/=ce,Ne/=ce;let De=0,Be=0,Ye=0;for(let at=0;at<ce;at++){const rt=Le[at]-Pe,ft=se[at]-Ne;De+=rt*rt,Be+=rt*ft,Ye+=ft*ft}if(De===0)return null;const Qe=Be/De,ct=Ne-Qe*Pe,pt=Ye===0?1:Math.max(0,Math.min(1,Be*Be/(De*Ye))),Ge=Math.max(0,Ye-Qe*Be),nt=ce>2?Math.sqrt(Ge/(ce-2)/De):0;return{slope:Qe,intercept:ct,r2:pt,stdError:nt,n:ce}}const Y=new Set(["ols","wls","robust"]),F=new Set(["quantile"]),$=new Set(["ridge","lasso","elasticnet","mixed","gls"]),q=1.345;function ee(ye,xe,Se){const{xtwx:Le,xtwy:se}=l(ye,xe,Se),ce=j(Le);if(!ce)return null;const Pe=k(ce,se),Ne=y(ce),De=te(ye,Pe),Be=xe.map((Ye,Qe)=>Ye-De[Qe]);return{beta:Pe,cov:Ne,fitted:De,residuals:Be}}function te(ye,xe){return ye.map(Se=>Se.reduce((Le,se,ce)=>Le+se*xe[ce],0))}function re(ye,xe){const Se=ye.length,Le=ye.map(Be=>Be[xe]),se=ye.map(Be=>[1,...Be.filter((Ye,Qe)=>Qe!==xe)]),ce=ee(se,Le,null);if(!ce)return 1;const Pe=Le.reduce((Be,Ye)=>Be+Ye,0)/Se;let Ne=0,De=0;for(let Be=0;Be<Se;Be++)Ne+=ce.residuals[Be]**2,De+=(Le[Be]-Pe)**2;return De===0?1:Math.max(0,Math.min(1,1-Ne/De))}function ie(ye){const xe=[...ye].sort((se,ce)=>se-ce),Se=ue(xe),Le=ye.map(se=>Math.abs(se-Se)).sort((se,ce)=>se-ce);return ue(Le)/.6745}function ue(ye){const xe=ye.length;if(!xe)return 0;const Se=Math.floor(xe/2);return xe%2?ye[Se]:(ye[Se-1]+ye[Se])/2}function Ae(ye,xe,Se={}){const Le=Se.method||"ols";if($.has(Le))throw new Error(`[lattice] regression method "${Le}" is out of scope; use ols, wls or robust.`);if(F.has(Le))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!Y.has(Le))throw new Error(`[lattice] unknown regression method "${Le}"; use ols, wls or robust.`);const se=Array.isArray(xe)?xe.length:0,ce=se&&Array.isArray(ye[0])?ye[0].length:0,Pe=ce+1;if(!(se>Pe))return null;for(let Ft=0;Ft<se;Ft++){if(!Number.isFinite(xe[Ft])||!Array.isArray(ye[Ft])||ye[Ft].length!==ce)return null;for(let Vt=0;Vt<ce;Vt++)if(!Number.isFinite(ye[Ft][Vt]))return null}let Ne=null;if(Le==="wls"){if(Ne=Se.weights,!Array.isArray(Ne)||Ne.length!==se)return null;for(let Ft=0;Ft<se;Ft++)if(!(Ne[Ft]>0)||!Number.isFinite(Ne[Ft]))return null}const De=ye.map(Ft=>[1,...Ft]);let Be,Ye=null;if(Le==="robust"){if(Be=ee(De,xe,null),!Be)return null;for(let Ft=0;Ft<50;Ft++){const Vt=ie(Be.residuals);if(!(Vt>0))break;const qt=Be.residuals.map(Kt=>{const nn=Math.abs(Kt/Vt);return nn<=q?1:q/nn}),Qt=ee(De,xe,qt);if(!Qt)return null;const rn=Qt.beta.reduce((Kt,nn,an)=>Math.max(Kt,Math.abs(nn-Be.beta[an])),0);if(Be=Qt,Ye=qt,rn<1e-10)break}}else if(Be=ee(De,xe,Ne),!Be)return null;const Qe=Le==="robust"?Ye:Ne,{beta:ct,cov:pt,fitted:Ge,residuals:nt}=Be;let at=0,rt=0,ft=0;for(let Ft=0;Ft<se;Ft++){const Vt=Qe?Qe[Ft]:1;at+=Vt*nt[Ft]**2,rt+=Vt,ft+=Vt*xe[Ft]}const jt=ft/rt;let Tt=0;for(let Ft=0;Ft<se;Ft++){const Vt=Qe?Qe[Ft]:1;Tt+=Vt*(xe[Ft]-jt)**2}const Mt=se-Pe,Rt=at/Mt,It=Tt===0?1:Math.max(0,Math.min(1,1-at/Tt)),zt=1-(1-It)*(se-1)/Mt,Je=Array.isArray(Se.names)&&Se.names.length===ce?Se.names:ye[0].map((Ft,Vt)=>`x${Vt+1}`),mt=et(Se.confidence),bt=Mt>0?D(1-(1-mt)/2,Mt):1/0,At=ct.map((Ft,Vt)=>{const qt=Math.sqrt(Math.max(0,Rt*pt[Vt][Vt])),Qt=qt>0?Ft/qt:Ft===0?0:1/0,rn=Number.isFinite(Qt)?2*(1-J(Math.abs(Qt),Mt)):0,Kt=Number.isFinite(bt)?bt*qt:null;return{name:Vt===0?"(intercept)":Je[Vt-1],estimate:Ft,stdError:qt,t:Qt,p:Math.max(0,Math.min(1,rn)),lower:Kt===null?null:Ft-Kt,upper:Kt===null?null:Ft+Kt}}),Dt=new Array(se),Lt=new Array(se);for(let Ft=0;Ft<se;Ft++){const Vt=Qe?Qe[Ft]:1,qt=Math.max(0,Math.min(1,Vt*g(De[Ft],pt)));Dt[Ft]=qt;const Qt=(1-qt)**2;Lt[Ft]=Qt>0&&Rt>0?nt[Ft]**2/(Pe*Rt)*(qt/Qt):null}const Ot=ye[0].map((Ft,Vt)=>{if(ce<2)return 1;const qt=re(ye,Vt);return qt>=1?1/0:1/(1-qt)});let _t=null;{const Ft=nt.map(qt=>qt*qt),Vt=ee(De,Ft,null);if(Vt){const qt=Ft.reduce((sn,bn)=>sn+bn,0)/se;let Qt=0,rn=0;for(let sn=0;sn<se;sn++)Qt+=Vt.residuals[sn]**2,rn+=(Ft[sn]-qt)**2;const Kt=rn===0?0:Math.max(0,Math.min(1,1-Qt/rn)),nn=se*Kt,an=X(nn,ce);_t={statistic:nn,df:ce,p:an,heteroscedastic:an<.05}}}let Gt=null;if(ce===1){const Ft=ye.map((Vt,qt)=>qt).sort((Vt,qt)=>ye[Vt][0]-ye[qt][0]);Gt={confidence:mt,points:Ft.map(Vt=>{const qt=De[Vt],Qt=Math.sqrt(Math.max(0,Rt*g(qt,pt)));return{x:ye[Vt][0],yhat:Ge[Vt],lower:Ge[Vt]-bt*Qt,upper:Ge[Vt]+bt*Qt}})}}return{method:Le,coefficients:At,r2:It,adjR2:zt,n:se,df:Mt,sigma2:Rt,fitted:Ge,residuals:nt,leverage:Dt,cooksD:Lt,vif:Ot,heteroscedasticity:_t,band:Gt,weights:Qe?[...Qe]:null}}function de(ye){const xe=ye.length,Se=Array.from({length:xe},(ce,Pe)=>Pe).sort((ce,Pe)=>ye[ce]-ye[Pe]),Le=new Float64Array(xe);let se=0;for(;se<xe;){let ce=se;for(;ce+1<xe&&ye[Se[ce+1]]===ye[Se[se]];)ce++;const Pe=(se+ce)/2+1;for(let Ne=se;Ne<=ce;Ne++)Le[Se[Ne]]=Pe;se=ce+1}return Le}const Oe=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function Me(ye){const xe=[.01,.05,.1],Se=[Oe["1%"],Oe["5%"],Oe["10%"]];if(ye<=Se[0]){const ce=(Math.log(xe[1])-Math.log(xe[0]))/(Se[1]-Se[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(xe[0])+ce*(ye-Se[0]))))}if(ye>=Se[2]){const ce=(Math.log(xe[2])-Math.log(xe[1]))/(Se[2]-Se[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(xe[2])+ce*(ye-Se[2]))))}const Le=ye<Se[1]?0:1,se=(ye-Se[Le])/(Se[Le+1]-Se[Le]);return Math.exp(Math.log(xe[Le])+se*(Math.log(xe[Le+1])-Math.log(xe[Le])))}function Fe(ye,xe,Se,Le){const se=Se-Le,ce=Le+3,Pe=new Array(se),Ne=new Array(se);let De=!0,Be=Le;for(let Ge=0;Ge<se;Ge++){const nt=Le+Ge,at=new Float64Array(ce);at[0]=1,at[1]=Ge+1,at[2]=ye[nt];for(let rt=1;rt<=Le;rt++)at[2+rt]=xe[nt-rt];for(let rt=1;rt<ce;rt++)Number.isFinite(at[rt])||(Be=Math.min(Be,rt-3));Pe[Ge]=at,Ne[Ge]=xe[nt],Number.isFinite(Ne[Ge])||(De=!1)}if(!De)return 0;const{xtwx:Ye,xtwy:Qe}=l(Pe,Ne,null);let ct=0,pt=1/0;for(let Ge=0;Ge<=Be;Ge++){const nt=Ge+3;if(!(se>nt))continue;const at=new Array(nt);for(let It=0;It<nt;It++)at[It]=Ye[It].slice(0,nt);const rt=j(at);if(!rt)continue;const ft=k(rt,Qe.slice(0,nt));let jt=0;for(let It=0;It<se;It++){const zt=Pe[It];let Je=0;for(let mt=0;mt<nt;mt++)Je+=zt[mt]*ft[mt];jt+=(Ne[It]-Je)**2}const Mt=jt/(se-nt)*(se-nt);if(!(Mt>0))continue;const Rt=se*Math.log(Mt/se)+2*nt;Rt<pt&&(pt=Rt,ct=Ge)}return ct}function pe(ye,xe={}){const Se=[];for(let pt=0;pt<ye.length;pt++){const Ge=Number(ye[pt]);Number.isFinite(Ge)&&Se.push(Ge)}const Le=Se.length,se=Le-1;if(Le<8||se<6)return null;const ce=new Array(se);for(let pt=0;pt<se;pt++)ce[pt]=Se[pt+1]-Se[pt];let Pe=Number.isFinite(xe.maxlag)?Math.floor(xe.maxlag):Math.ceil(12*(Le/100)**.25);Pe=Math.max(0,Math.min(Pe,Math.floor((se-5)/2)));const Ne=(pt,Ge)=>{const nt=[],at=[];for(let rt=Ge;rt<se;rt++){const ft=[rt-Ge+1,Se[rt]];for(let jt=1;jt<=pt;jt++)ft.push(ce[rt-jt]);nt.push(ft),at.push(ce[rt])}return Ae(nt,at,{method:"ols"})},De=Fe(Se,ce,se,Pe),Be=Ne(De,De);if(!Be||!Be.coefficients[2])return null;const Ye=Be.coefficients[2].t,Qe=Me(Ye),ct=Ye<Oe["5%"];return{statistic:Ye,usedLag:De,nobs:se-De,criticalValues:{...Oe},pValue:Qe,pApproximate:!0,stationary:ct,verdict:ct?"stationary":"non-stationary",regression:"ct"}}function ae(ye,xe={}){const Se=[];for(let ct=0;ct<ye.length;ct++){const pt=Number(ye[ct]);Number.isFinite(pt)&&Se.push(pt)}const Le=Se.length;if(Le<3)return null;let se=Number.isFinite(xe.maxlag)?Math.floor(xe.maxlag):Math.min(10,Le-1);se=Math.max(1,Math.min(se,Le-1));let ce=0;for(const ct of Se)ce+=ct;ce/=Le;const Pe=Se.map(ct=>ct-ce);let Ne=0;for(const ct of Pe)Ne+=ct*ct;Ne/=Le;const De=new Array(se+1).fill(0);De[0]=1;for(let ct=1;ct<=se;ct++){let pt=0;for(let Ge=ct;Ge<Le;Ge++)pt+=Pe[Ge]*Pe[Ge-ct];De[ct]=Ne>0?pt/Le/Ne:0}const Be=new Array(se+1).fill(0);Be[0]=1;let Ye=[];for(let ct=1;ct<=se;ct++){let pt=De[ct];for(let rt=1;rt<ct;rt++)pt-=Ye[rt-1]*De[ct-rt];let Ge=1;for(let rt=1;rt<ct;rt++)Ge-=Ye[rt-1]*De[rt];const nt=Ge!==0?pt/Ge:0,at=new Array(ct);for(let rt=1;rt<ct;rt++)at[rt-1]=Ye[rt-1]-nt*Ye[ct-1-rt];at[ct-1]=nt,Be[ct]=nt,Ye=at}const Qe=1.96/Math.sqrt(Le);return{acf:De,pacf:Be,bounds:{upper:Qe,lower:-Qe},n:Le,nlags:se,approximate:!0}}function ge(ye,xe,Se){const{xs:Le,ys:se,n:ce}=B(ye,xe,Se);if(ce<2)return null;const Pe=de(Le),Ne=de(se);let De=0,Be=0;for(let pt=0;pt<ce;pt++)De+=Pe[pt],Be+=Ne[pt];De/=ce,Be/=ce;let Ye=0,Qe=0,ct=0;for(let pt=0;pt<ce;pt++){const Ge=Pe[pt]-De,nt=Ne[pt]-Be;Ye+=Ge*nt,Qe+=Ge*Ge,ct+=nt*nt}return Qe===0||ct===0?null:Math.max(-1,Math.min(1,Ye/Math.sqrt(Qe*ct)))}function ve(ye,xe,Se){const{xs:Le,ys:se,n:ce}=B(ye,xe,Se);if(ce<2||ce>o)return null;let Pe=0,Ne=0,De=0,Be=0;for(let ct=0;ct<ce;ct++)for(let pt=ct+1;pt<ce;pt++){const Ge=Math.sign(Le[ct]-Le[pt]),nt=Math.sign(se[ct]-se[pt]),at=Ge*nt;at>0?Pe++:at<0?Ne++:Ge===0&&nt===0||(Ge===0?De++:Be++)}const Ye=Pe+Ne+Be,Qe=Pe+Ne+De;return Ye===0||Qe===0?null:(Pe-Ne)/Math.sqrt(Ye*Qe)}function le(ye,xe={}){const Se=ye.length;if(Se<2)return null;const Le=ye[0],se=ye[Se-1],ce=[];for(let rt=1;rt<Se;rt++){const ft=ye[rt-1];ft!==0&&ce.push((ye[rt]-ft)/Math.abs(ft))}let Pe=null;if(ce.length>1){let rt=0;for(const jt of ce)rt+=jt;rt/=ce.length;let ft=0;for(const jt of ce)ft+=(jt-rt)**2;Pe=Math.sqrt(ft/(ce.length-1))}const Ne=Number(xe.periodsPerYear)>0?Number(xe.periodsPerYear):null;let De=ye[0],Be=0,Ye=0,Qe=0,ct=0;for(let rt=1;rt<Se;rt++){if(ye[rt]>De){De=ye[rt],Be=rt;continue}if(De<=0)continue;const ft=(De-ye[rt])/De;ft>Ye&&(Ye=ft,Qe=Be,ct=rt)}let pt=null;if(Se>2){let rt=0;for(let Tt=0;Tt<Se;Tt++)rt+=ye[Tt];rt/=Se;let ft=0,jt=0;for(let Tt=0;Tt<Se;Tt++){const Mt=ye[Tt]-rt;jt+=Mt*Mt,Tt>0&&(ft+=Mt*(ye[Tt-1]-rt))}pt=jt>0?ft/jt:null}let Ge=0,nt=0;for(const rt of ce)rt>0?Ge++:rt<0&&nt++;let at=null;if(Le>0&&se>0){const rt=(se/Le)**(1/(Se-1))-1;at=Ne?(1+rt)**Ne-1:rt}return{n:Se,first:Le,last:se,change:se-Le,changePercent:Le===0?null:(se-Le)/Math.abs(Le)*100,volatility:Pe,annualisedVolatility:Pe!==null&&Ne?Pe*Math.sqrt(Ne):null,growth:at,maxDrawdown:Ye,maxDrawdownFrom:Qe,maxDrawdownTo:ct,autocorrelation:pt,upDays:Ge,downDays:nt}}const we=1.128,he=3.267;function be(ye){const xe=ye.length;if(xe<2)return null;const Se=[];for(let se=1;se<xe;se++)Se.push(Math.abs(ye[se]-ye[se-1]));const Le=Se.reduce((se,ce)=>se+ce,0)/Se.length;return{ranges:Se,centre:Le,upper:he*Le,lower:0}}function Te(ye){const xe=ye.length;if(xe<2)return null;let Se=0;for(let se=1;se<xe;se++)Se+=Math.abs(ye[se]-ye[se-1]);const Le=Se/(xe-1);return{sigma:Le/we,meanRange:Le}}function je(ye,xe){const Se=ye.length;if(Se<2||!xe)return null;const Le=Number.isFinite(Number(xe.lower))?Number(xe.lower):null,se=Number.isFinite(Number(xe.upper))?Number(xe.upper):null;if(Le===null&&se===null)return null;let ce=0;for(let Ge=0;Ge<Se;Ge++)ce+=ye[Ge];ce/=Se;let Pe=0;for(let Ge=0;Ge<Se;Ge++)Pe+=(ye[Ge]-ce)**2;const Ne=Math.sqrt(Pe/(Se-1)),De=Te(ye),Be=De?De.sigma:null,Ye=Ge=>{if(!Ge||Ge<=0)return{index:null,k:null};const at=Le!==null&&se!==null?(se-Le)/(6*Ge):null,rt=se!==null?(se-ce)/(3*Ge):1/0,ft=Le!==null?(ce-Le)/(3*Ge):1/0;return{index:at,k:Math.min(rt,ft)}},Qe=Ye(Be),ct=Ye(Ne);let pt=0;for(let Ge=0;Ge<Se;Ge++){if(Le!==null&&ye[Ge]<Le){pt++;continue}se!==null&&ye[Ge]>se&&pt++}return{n:Se,mean:ce,lower:Le,upper:se,target:Number.isFinite(Number(xe.target))?Number(xe.target):null,sigmaWithin:Be,sigmaOverall:Ne,cp:Qe.index,cpk:Qe.k,pp:ct.index,ppk:ct.k,outOfSpec:pt,defectRate:Se?pt/Se:null}}function ke(ye){const xe=ye.length;if(xe<2)return null;const Se=Te(ye);if(!Se||!(Se.sigma>0))return null;let Le=0;for(let se=0;se<xe;se++)Le+=ye[se];return Le/=xe,{centre:Le,sigma:Se.sigma,upper:Le+3*Se.sigma,lower:Le-3*Se.sigma}}function Ue(ye,xe){if(!xe||!(xe.sigma>0))return[];const Se=ye.length,{centre:Le,sigma:se}=xe,ce=Ne=>(ye[Ne]-Le)/se,Pe=[];for(let Ne=0;Ne<Se;Ne++){if(Math.abs(ce(Ne))>3&&Pe.push({index:Ne,rule:1,description:"beyond three sigma"}),Ne>=2)for(const De of[1,-1]){let Be=0;for(let Ye=Ne-2;Ye<=Ne;Ye++)ce(Ye)*De>2&&Be++;if(Be>=2){Pe.push({index:Ne,rule:2,description:"two of three past two sigma"});break}}if(Ne>=4)for(const De of[1,-1]){let Be=0;for(let Ye=Ne-4;Ye<=Ne;Ye++)ce(Ye)*De>1&&Be++;if(Be>=4){Pe.push({index:Ne,rule:3,description:"four of five past one sigma"});break}}if(Ne>=7)for(const De of[1,-1]){let Be=!0;for(let Ye=Ne-7;Ye<=Ne;Ye++)if(ce(Ye)*De<=0){Be=!1;break}if(Be){Pe.push({index:Ne,rule:4,description:"eight in a row on one side"});break}}}return Pe}function Re(ye,xe){if(!xe||!(xe.sigma>0))return[];const Se=ye.length,{centre:Le,sigma:se}=xe,ce=De=>(ye[De]-Le)/se,Pe=(De,Be,Ye,Qe)=>{for(const ct of[1,-1]){let pt=0;for(let Ge=De;Ge<=Be;Ge++)ce(Ge)*ct>Ye&&pt++;if(pt>=Qe)return!0}return!1},Ne=[];for(let De=0;De<Se;De++){if(Math.abs(ce(De))>3&&Ne.push({index:De,rule:1,description:"beyond three sigma"}),De>=8)for(const Be of[1,-1]){let Ye=!0;for(let Qe=De-8;Qe<=De;Qe++)if(ce(Qe)*Be<=0){Ye=!1;break}if(Ye){Ne.push({index:De,rule:2,description:"nine in a row on one side"});break}}if(De>=5)for(const Be of[1,-1]){let Ye=!0;for(let Qe=De-4;Qe<=De;Qe++)if((ye[Qe]-ye[Qe-1])*Be<=0){Ye=!1;break}if(Ye){Ne.push({index:De,rule:3,description:Be>0?"six rising":"six falling"});break}}if(De>=13){let Be=!0;for(let Ye=De-12;Ye<=De;Ye++){const Qe=ye[Ye]-ye[Ye-1],ct=ye[Ye+1<=De?Ye+1:Ye]-ye[Ye];if(Ye+1>De)break;if(Qe===0||ct===0||Qe>0==ct>0){Be=!1;break}}Be&&Ne.push({index:De,rule:4,description:"fourteen alternating"})}if(De>=2&&Pe(De-2,De,2,2)&&Ne.push({index:De,rule:5,description:"two of three past two sigma"}),De>=4&&Pe(De-4,De,1,4)&&Ne.push({index:De,rule:6,description:"four of five past one sigma"}),De>=14){let Be=!0;for(let Ye=De-14;Ye<=De;Ye++)if(Math.abs(ce(Ye))>=1){Be=!1;break}Be&&Ne.push({index:De,rule:7,description:"fifteen within one sigma"})}if(De>=7){let Be=!0;for(let Ye=De-7;Ye<=De;Ye++)if(Math.abs(ce(Ye))<=1){Be=!1;break}Be&&Ne.push({index:De,rule:8,description:"eight beyond one sigma"})}}return Ne}const Ee=Object.freeze(["westernElectric","nelson"]);function He(ye,xe,Se="westernElectric"){return String(Se)==="nelson"?Re(ye,xe):Ue(ye,xe)}function Ke(ye,xe,Se){let Le=0;for(let se=0;se<ye.length;se++)(ye[se]<xe||ye[se]>Se)&&Le++;return Le}function We(ye,xe,Se,Le=20){const se=ye.length;if(!se)return[];const ce=ye[0],Pe=ye[se-1];if(Pe===ce)return[{from:ce,to:Pe,count:se}];const Ne=Se-xe,De=1.5*Ne;let Be=Ne>0?Math.max(ce,xe-De):ce,Ye=Ne>0?Math.min(Pe,Se+De):Pe;Ye>Be||(Be=ce,Ye=Pe);const Qe=Ne>0?2*Ne/Math.cbrt(se):(Ye-Be)/(Math.ceil(Math.log2(se))+1),ct=Qe>0?Math.min(Le,Math.max(1,Math.ceil((Ye-Be)/Qe))):1,pt=(Ye-Be)/ct,Ge=[];for(let nt=0;nt<ct;nt++)Ge.push({from:Be+nt*pt,to:Be+(nt+1)*pt,count:0});for(let nt=0;nt<se;nt++){const at=Math.min(ct-1,Math.max(0,Math.floor((ye[nt]-Be)/pt)));Ge[at].count++}return Ge[0].from=ce,Ge[ct-1].to=Pe,Ge}const qe=.95;function et(ye){const xe=Number(ye);return Number.isFinite(xe)&&xe>0&&xe<1?xe:qe}function dt(ye,xe=qe){const Se=ye.length;if(Se<2)return null;let Le=0;for(let Ye=0;Ye<Se;Ye++)Le+=ye[Ye];const se=Le/Se;let ce=0;for(let Ye=0;Ye<Se;Ye++){const Qe=ye[Ye]-se;ce+=Qe*Qe}const Pe=Math.sqrt(ce/(Se-1)),Ne=et(xe),Be=D(1-(1-Ne)/2,Se-1)*Pe/Math.sqrt(Se);return{mean:se,lower:se-Be,upper:se+Be,margin:Be,n:Se,confidence:Ne}}function lt(ye,xe,Se=qe){const Le=Number(ye),se=Number(xe);if(!(se>0)||!(Le>=0)||Le>se)return null;const ce=et(Se),Pe=z(1-(1-ce)/2),Ne=Le/se,De=Pe*Pe,Be=1+De/se,Ye=(Ne+De/(2*se))/Be,Qe=Pe/Be*Math.sqrt(Ne*(1-Ne)/se+De/(4*se*se));return{proportion:Ne,lower:Math.max(0,Ye-Qe),upper:Math.min(1,Ye+Qe),n:se,confidence:ce}}function vt(ye,xe=qe){if(!ye||!(ye.n>2)||!Number.isFinite(ye.stdError))return null;const Se=et(xe),se=D(1-(1-Se)/2,ye.n-2)*ye.stdError;return{slope:ye.slope,lower:ye.slope-se,upper:ye.slope+se,margin:se,confidence:Se}}function Pt(ye,xe,Se=qe){const Le=Number(ye),se=Number(xe);if(!Number.isFinite(Le)||!(se>1))return null;const ce=et(Se),Ne=z(1-(1-ce)/2)*Math.sqrt(1/(9*se)+Le*Le/(2*(se-1)));return{index:Le,lower:Le-Ne,upper:Le+Ne,margin:Ne,n:se,confidence:ce}}function $t(ye,xe){return!ye||!(ye.sd>0)||!Number.isFinite(xe)||!Number.isFinite(ye.mean)?null:(xe-ye.mean)/ye.sd}function ht(ye){return Number.isFinite(ye)?Math.min(1,Math.max(0,2*L(Math.abs(ye)/2)-1)):0}function ut(ye,xe){const Se=new Map,Le=K(ye);let se=0;for(let ce=0;ce<xe.length;ce++){const Pe=Le(xe[ce]);if(Pe==null||Pe===""||typeof Pe=="number"&&Number.isNaN(Pe))continue;const Ne=Pe instanceof Date?Pe.getTime():typeof Pe=="object"?String(Pe):Pe;Se.set(Ne,(Se.get(Ne)||0)+1),se++}return{map:Se,total:se}}function wt(ye,xe,Se,Le){if(!(xe>0)||!(Le>0))return null;let se=0;const ce=new Set(ye.keys());for(const Pe of Se.keys())ce.add(Pe);for(const Pe of ce){const Ne=(ye.get(Pe)||0)/xe,De=(Se.get(Pe)||0)/Le;se+=Math.abs(Ne-De)}return se/2}const Nt=10;function gt(ye,xe,Se){if(Se&&Se.numeric){const Ne=p(ye,xe),{n:De,mean:Be}=h(Ne),Ye=De>0?$t({mean:Se.mean,sd:Se.sd},Be):null;return{measure:"standardizedMeanDifference",magnitude:Ye,distance:Ye===null?0:ht(Ye),direction:Ye===null?0:Math.sign(Ye),subsetN:De,populationN:Se.n||0,reliable:De>=Nt}}const{map:se,total:ce}=ut(ye,xe),Pe=wt(se,ce,Se.map,Se.total);return{measure:"categoricalTotalVariation",magnitude:Pe,distance:Pe===null?0:Pe,direction:0,subsetN:ce,populationN:Se.total||0,reliable:ce>=Nt}}function Ce(ye,xe){if(ye&&(ye.kind==="float64"||ye.kind==="int32"))return!0;const Se=K(ye);let Le=0,se=0;for(let ce=0;ce<xe.length&&Le<200;ce++){const Pe=Se(xe[ce]);if(Pe==null||Pe==="")continue;if(Pe instanceof Date)return!1;Le++;const Ne=typeof Pe=="number"?Pe:Number(Pe);Number.isFinite(Ne)&&se++}return Le===0?!1:se/Le>=.9}function $e(ye,xe){if(Ce(ye,xe)){const se=p(ye,xe),{n:ce,mean:Pe,m2:Ne}=h(se);return{numeric:!0,mean:Pe,sd:ce>0?Math.sqrt(Ne/ce):0,n:ce}}const{map:Se,total:Le}=ut(ye,xe);return{numeric:!1,map:Se,total:Le}}}),ze("packages/core/src/compute/total.js",function(e,_){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"aggregatesFor",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"aggregateAllowed",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return h}});const E=_("packages/core/src/internal/predicates.js").isFunction,U=_("packages/core/src/internal/warn.js").warnOnce,D=_("packages/core/src/compute/handle.js"),J=D.presenceReader,z=D.valueComparator,L=D.valueReader,X=_("packages/core/src/compute/statistics.js"),I=X.STAT_FNS,j=X.STAT_LABELS;function k(w){return!!w&&(w.kind==="float64"||w.kind==="int32")}function y(w,v){const A=v.length;let H=0;if(k(w)){const Z=w.values,M=J(w);if(!M){for(let S=0;S<A;S++){const T=Z[v[S]];Number.isNaN(T)||(H+=T)}return H}for(let S=0;S<A;S++){const T=v[S];if(M(T)===1){const O=Z[T];Number.isNaN(O)||(H+=O)}}return H}const G=L(w);for(let Z=0;Z<A;Z++){const M=p(G(v[Z]));M!==null&&(H+=M)}return H}y.kernel=!0;function l(w,v){const A=v.length;let H=0;if(k(w)){const Z=w.values,M=J(w);if(!M){for(let S=0;S<A;S++)Number.isNaN(Z[v[S]])||H++;return H}for(let S=0;S<A;S++){const T=v[S];M(T)===1&&!Number.isNaN(Z[T])&&H++}return H}const G=L(w);for(let Z=0;Z<A;Z++){const M=G(v[Z]);M!=null&&!(typeof M=="number"&&Number.isNaN(M))&&H++}return H}l.kernel=!0;function g(w,v){return v.length}g.kernel=!0;function s(w,v){const A=l(w,v);return A===0?null:y(w,v)/A}s.kernel=!0;function t(w,v,A,H){const G=v.length;if(k(w)){const T=w.values,O=J(w);let N=null;if(!O){for(let P=0;P<G;P++){const C=T[v[P]];Number.isNaN(C)||(N===null||(A<0?C<N:C>N))&&(N=C)}return N}for(let P=0;P<G;P++){const C=v[P];if(O(C)===0)continue;const B=T[C];Number.isNaN(B)||(N===null||(A<0?B<N:B>N))&&(N=B)}return N}const Z=L(w),M=z(H);let S=null;for(let T=0;T<G;T++){const O=Z(v[T]);O==null||typeof O=="number"&&Number.isNaN(O)||(S===null||(A<0?M(O,S)<0:M(O,S)>0))&&(S=O)}return S}function o(w,v,A){return t(w,v,-1,A&&A.locale)}o.kernel=!0;function c(w,v,A){return t(w,v,1,A&&A.locale)}c.kernel=!0;function d(w,v){return v.length===0?null:L(w)(v[0])}d.kernel=!0;function n(w,v){return v.length===0?null:L(w)(v[v.length-1])}n.kernel=!0;function p(w){if(typeof w=="number")return Number.isNaN(w)?null:w;if(w==null||w===""||typeof w=="boolean")return null;if(w instanceof Date)return w.getTime();const v=Number(w);return Number.isNaN(v)?null:v}const i={sum:y,min:o,max:c,avg:s,count:g,first:d,last:n,countValues:l,...I},r=Object.freeze({...j,sum:"Sum",avg:"Average",min:"Min",max:"Max",count:"Count",countValues:"Count of values",first:"First",last:"Last"});function f(w){return w?typeof w=="string"?r[w]||w:"Total":""}const m=Object.freeze(["sum","avg","min","max","count","countValues","first","last"]);function u(w){const v=w&&w.dataType&&w.dataType.totals&&w.dataType.totals.supported;if(Array.isArray(v))return v.slice();const A=m.filter(H=>H in i);for(const H of Object.keys(i))A.includes(H)||A.push(H);return A}function b(w,v){return typeof v!="string"?!0:u(w).includes(v)}function a(w,v){const A=L(w),H=[];for(let G=0;G<v.length;G++){const Z=A(v[G]);Z!=null&&H.push(Z)}return H}function h(w,v,A,H){const G=v||[];if(typeof A=="string"){const Z=i[A];return Z?Z(w,G,H):(U(`total:${A}`,`unknown total function "${A}"; register it in config.totalFns`),null)}return E(A)?A.kernel===!0?A(w,G,H):A(a(w,G),H||{}):null}}),ze("packages/core/src/compute/windowed.js",function(e,_){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return J}});const E=_("packages/core/src/compute/sketch.js").Welford;class K{#e;#t;#n=[];#r;#s;constructor(L,X=0,I=Date.now){if(L!=="count"&&L!=="time"&&L!=="session")throw new RangeError(`unknown window kind: ${L}`);if((L==="count"||L==="time")&&!(X>0))throw new RangeError(`a ${L} window needs a positive span`);this.#e=L,this.#t=Math.floor(X),this.#r=I,this.#s=I()}get size(){return this.#n.length}push(L,X=this.#r()){Number.isFinite(L)&&(this.#n.push({t:X,v:L}),this.#i(X))}#i(L){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const X=L-this.#t;for(;this.#n.length&&this.#n[0].t<X;)this.#n.shift()}}spec(){const L=this.#e==="session"?this.#r()-this.#s:this.#t;return{kind:this.#e,span:L,size:this.#n.length}}values(){return this.#n.map(L=>L.v)}aggregate(){const L=this.spec();if(!this.#n.length)return{over:L,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const X=new E;let I=0,j=1/0,k=-1/0;for(const{v:y}of this.#n)I+=y,y<j&&(j=y),y>k&&(k=y),X.add(y);return{over:L,count:this.#n.length,sum:I,mean:X.mean(),min:j,max:k,variance:X.variance(),stddev:X.stddev()}}reduce(L){const X=this.aggregate(),I={sum:X.sum,avg:X.mean,mean:X.mean,min:X.min,max:X.max,count:X.count,variance:X.variance,stddev:X.stddev};if(!(L in I))throw new RangeError(`unknown windowed aggregate: ${L}`);return{value:I[L],over:X.over}}}const U=Object.freeze(["count","time","session"]);function D(z,L=Date.now){const X=z.kind==="time"&&z.minutes!=null?z.minutes*6e4:z.span??0;return new K(z.kind,X,L)}const J={Window:K,WINDOW_KINDS:U,openWindow:D}}),ze("packages/core/src/compute/rolling.js",function(e,_){"use strict";Object.defineProperty(e,"ROLLING_WINDOW_FIELDS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"rollingWindow",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"rollingQuantile",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"seasonalDecompose",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"exponentialSmoothing",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return p}});const E=_("packages/core/src/compute/windowed.js").openWindow,U=_("packages/core/src/compute/sketch.js").KLL,D=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function J(i,r,f,m){if(i.kind==="count"){const u=Math.max(1,Math.floor(i.span||0));return{coverage:Math.min(1,r/u),partial:r<u}}if(i.kind==="time"){const u=i.minutes!=null?i.minutes*6e4:i.span||0;if(!(u>0))return{coverage:1,partial:!1};const b=f-m;return{coverage:Math.min(1,b/u),partial:b<u}}return{coverage:null,partial:!1}}function z(i,r){const f=E(r),m=new Map,u=i.length?i[0].at:0;for(let b=0;b<i.length;b++){const{key:a,at:h,value:w}=i[b];Number.isFinite(w)&&f.push(w,h);const v=f.aggregate(),A=J(r,v.count,h,u);a!=null&&m.set(String(a),{sum:v.sum,avg:v.mean,min:v.min,max:v.max,count:v.count,coverage:A.coverage,partial:A.partial})}return m}function L(i){const r=new Map;let f=0;for(const{key:m,value:u}of i)Number.isFinite(u)&&(f+=u),m!=null&&r.set(String(m),f);return r}function X(i,r=1){const f=new Map,m=Math.max(1,Math.floor(r));for(let u=0;u<i.length;u++){const{key:b,value:a}=i[u];if(b==null)continue;const h=u>=m?i[u-m].value:null,w=Number.isFinite(a)?a:null,v=Number.isFinite(h)?h:null;f.set(String(b),w!==null&&v!==null?w-v:null)}return f}const I=4096;function j(i){let r=i>>>0;return()=>{r+=1831565813;let f=r;return f=Math.imul(f^f>>>15,f|1),f^=f+Math.imul(f^f>>>7,f|61),((f^f>>>14)>>>0)/4294967296}}function k(i,r){const f=i.length;if(f===1)return i[0];const m=(f-1)*r,u=Math.floor(m),b=Math.ceil(m);return u===b?i[u]:i[u]+(m-u)*(i[b]-i[u])}function y(i,r,f={}){const m=Math.min(1,Math.max(0,f.q==null?.5:f.q)),u=Math.max(1,Math.floor(f.cap==null?I:f.cap)),b=j(f.seed==null?2654435769:f.seed),a=new Map,h=i.length?i[0].at:0;if(r.kind==="session"){const v=new U(200,b);let A=0;for(const{key:H,value:G}of i)Number.isFinite(G)&&(v.add(G),A++),H!=null&&a.set(String(H),{value:A?v.quantile(m):null,approx:A>0,count:A,coverage:null,partial:!1});return a}const w=E(r);for(const{key:v,at:A,value:H}of i){Number.isFinite(H)&&w.push(H,A);const G=w.values(),Z=G.length;let M=null,S=!1;if(Z)if(Z<=u)M=k([...G].sort((O,N)=>O-N),m);else{const O=new U(200,b);for(const N of G)O.add(N);M=O.quantile(m),S=!0}const T=J(r,Z,A,h);v!=null&&a.set(String(v),{value:M,approx:S,count:Z,coverage:T.coverage,partial:T.partial})}return a}function l(i,r){const f=i.length,m=new Array(f).fill(null),u=Math.floor(r/2),b=r%2===0;for(let a=0;a<f;a++){if(a-u<0||a+u>=f)continue;let h=0,w=!0;if(b)for(let v=-u;v<=u;v++){const A=i[a+v];if(!Number.isFinite(A)){w=!1;break}h+=v===-u||v===u?A*.5:A}else for(let v=-u;v<=u;v++){const A=i[a+v];if(!Number.isFinite(A)){w=!1;break}h+=A}w&&(m[a]=h/r)}return m}function g(i,r){const f=new Map,m=Math.floor(Number(r&&r.period));if(!(m>=2))return f;const u=r&&r.model==="multiplicative",b=i.length,a=i.map(S=>Number.isFinite(S.value)?S.value:null),h=l(a,m),w=new Array(b).fill(null);for(let S=0;S<b;S++){const T=h[S],O=a[S];T===null||O===null||(u?T!==0&&(w[S]=O/T):w[S]=O-T)}const v=new Array(m).fill(0),A=new Array(m).fill(0);for(let S=0;S<b;S++){if(w[S]===null)continue;const T=S%m;v[T]+=w[S],A[T]+=1}const H=u?1:0,G=v.map((S,T)=>A[T]?S/A[T]:H),Z=G.reduce((S,T)=>S+T,0)/m,M=u?G.map(S=>Z!==0?S/Z:1):G.map(S=>S-Z);for(let S=0;S<b;S++){const{key:T}=i[S];if(T==null)continue;const O=h[S],N=M[S%m],P=a[S];let C=null;O!==null&&P!==null&&(C=u?O*N!==0?P/(O*N):null:P-O-N),f.set(String(T),{trend:O,seasonal:P===null?null:N,residual:C,coverage:O===null?0:1,partial:O===null})}return f}function s(i,r,f,m=80){const u=(Math.sqrt(5)-1)/2;let b=r,a=f,h=a-u*(a-b),w=b+u*(a-b),v=i(h),A=i(w);for(let H=0;H<m;H++)v<A?(a=w,w=h,A=v,h=a-u*(a-b),v=i(h)):(b=h,h=w,v=A,w=b+u*(a-b),A=i(w));return(b+a)/2}const t=1e-4,o=1-1e-4;function c(i,r){const f=i.length,m=new Array(f).fill(null),u=new Array(f).fill(null);let b=null,a=0;for(let h=0;h<f;h++){const w=i[h];if(!Number.isFinite(w)){b!==null&&(u[h]=b,m[h]=b);continue}if(b===null){b=w,u[h]=w,m[h]=w;continue}u[h]=b,a+=(w-b)**2,b=r*w+(1-r)*b,m[h]=b}return{smoothed:m,fitted:u,sse:a}}function d(i,r,f){const m=i.length,u=new Array(m).fill(null),b=new Array(m).fill(null);let a=null,h=null,w=0;for(let v=0;v<m;v++){const A=i[v];if(!Number.isFinite(A)){a!==null&&(a+=h,u[v]=a);continue}if(a===null){a=A,u[v]=A;continue}if(h===null){h=A-a;const Z=a+h;b[v]=Z,w+=(A-Z)**2;const M=a;a=r*A+(1-r)*(M+h),h=f*(a-M)+(1-f)*h,u[v]=a;continue}const H=a+h;b[v]=H,w+=(A-H)**2;const G=a;a=r*A+(1-r)*(G+h),h=f*(a-G)+(1-f)*h,u[v]=a}return{smoothed:u,fitted:b,sse:w}}function n(i,r={}){const f=new Map,m=r.method==="holt",u=i.map(H=>Number.isFinite(H.value)?H.value:null),b=u.filter(H=>H!==null).length,a=H=>Math.min(o,Math.max(t,H)),h=()=>{for(const{key:H}of i)H!=null&&f.set(String(H),{smoothed:null,fitted:null,alpha:null,beta:null,sse:null});return f};if(b<(m?2:1))return h();let w=Number.isFinite(r.alpha)?a(r.alpha):null,v=m&&Number.isFinite(r.beta)?a(r.beta):null;if(m){if(w===null||v===null){let H=w===null?.5:w,G=v===null?.5:v;for(let Z=0;Z<6;Z++)w===null&&(H=s(M=>d(u,M,G).sse,t,o)),v===null&&(G=s(M=>d(u,H,M).sse,t,o));w=w===null?H:w,v=v===null?G:v}}else w===null&&(w=s(H=>c(u,H).sse,t,o));const A=m?d(u,w,v):c(u,w);for(let H=0;H<i.length;H++){const{key:G}=i[H];G!=null&&f.set(String(G),{smoothed:A.smoothed[H],fitted:A.fitted[H],alpha:w,beta:m?v:null,sse:A.sse})}return f}const p={ROLLING_WINDOW_FIELDS:D,QUANTILE_SPAN_CAP:I,rollingWindow:z,rollingQuantile:y,cumulativeToDate:L,periodOverPeriod:X,seasonalDecompose:g,exponentialSmoothing:n}}),ze("packages/core/src/compute/cluster.js",function(e,_){"use strict";Object.defineProperty(e,"CLUSTER_ROW_CAP",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"DBSCAN_ROW_CAP",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"DEFAULT_K",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DEFAULT_MIN_POINTS",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"orderByCentre",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"kmeans",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"dbscan",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"autoK",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"standardise",{enumerable:!0,get:function(){return t}});const ne=1e5,E=2e4,K=3,U=5,D=100;function J(o){let c=o>>>0;return function(){c=c+1831565813|0;let n=Math.imul(c^c>>>15,1|c);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}function z(o,c){let d=0;for(let n=0;n<o.length;n++){const p=o[n]-c[n];d+=p*p}return d}function L(o,c){return Math.sqrt(z(o,c))}function X(o,c){let d=-1,n=1/0;for(let p=0;p<c.length;p++){const i=z(o,c[p]);i<n&&(n=i,d=p)}return d}function I(o,c,d){const n=J(d),p=o.length,i=[Array.from(o[Math.floor(n()*p)])],r=new Float64Array(p).fill(1/0);for(let f=1;f<c;f++){let m=0;for(let h=0;h<p;h++){const w=z(o[h],i[i.length-1]);w<r[h]&&(r[h]=w),m+=r[h]}const u=n()*(m||p);let b=0,a=p-1;for(let h=0;h<p;h++)if(b+=m?r[h]:1,b>=u){a=h;break}i.push(Array.from(o[a]))}return i}function j(o,c){for(let d=0;d<o.length;d++){const n=o[d]-c[d];if(n!==0)return n}return 0}function k(o,c,d,n){const p=c.map((r,f)=>({centre:r,i:f})).sort((r,f)=>j(r.centre,f.centre)),i=new Int32Array(c.length);for(let r=0;r<p.length;r++)i[p[r].i]=r;for(let r=0;r<o.length;r++)o[r]>=0&&(o[r]=i[o[r]]);return{assignments:o,centres:p.map(r=>r.centre),sizes:p.map(r=>d[r.i]),distances:n}}function y(o,c={}){const d=o.length,n=d?o[0].length:0,p=Math.floor(c.k||K);if(!(d>=p)||p<1||n<1)return null;let i=I(o,p,c.seed===void 0?1:c.seed);const r=new Int32Array(d);let f=!0;for(let a=0;a<D&&f;a++){f=!1;for(let v=0;v<d;v++){const A=X(o[v],i);r[v]!==A&&(r[v]=A,f=!0)}const h=i.map(()=>new Float64Array(n)),w=new Array(p).fill(0);for(let v=0;v<d;v++){const A=r[v];for(let H=0;H<n;H++)h[A][H]+=o[v][H];w[A]++}for(let v=0;v<p;v++)if(w[v])for(let A=0;A<n;A++)i[v][A]=h[v][A]/w[v];else{let A=0,H=-1/0;for(let G=0;G<d;G++){const Z=z(o[G],i[v]);Z>H&&(H=Z,A=G)}i[v]=Array.from(o[A]),f=!0}}const m=new Array(p).fill(0),u=new Float64Array(d);let b=0;for(let a=0;a<d;a++){const h=r[a];m[h]++;const w=z(o[a],i[h]);u[a]=Math.sqrt(w),b+=w}return{assignments:r,centres:i,sizes:m,inertia:b,distances:u}}function l(o,c={}){const d=o.length,n=d?o[0].length:0,p=Number(c.eps),i=Math.max(1,Math.floor(c.minPoints||U));if(!(p>0)||d===0||n<1)return null;const r=new Array(d);for(let w=0;w<d;w++){const v=[];for(let A=0;A<d;A++)w!==A&&L(o[w],o[A])<=p&&v.push(A);r[w]=v}const f=new Int32Array(d).fill(-1);let m=0;for(let w=0;w<d;w++){if(f[w]!==-1||r[w].length<i)continue;f[w]=m;const v=[...r[w]];for(let A=0;A<v.length;A++){const H=v[A];f[H]===-1&&(f[H]=m,r[H].length>=i&&v.push(...r[H]))}m++}if(!m)return{assignments:f,centres:[],sizes:[],distances:new Float64Array(d).fill(NaN)};const u=[],b=new Array(m).fill(0),a=Array.from({length:m},()=>new Float64Array(n));for(let w=0;w<d;w++){const v=f[w];if(!(v<0)){b[v]++;for(let A=0;A<n;A++)a[v][A]+=o[w][A]}}for(let w=0;w<m;w++){const v=new Array(n);for(let A=0;A<n;A++)v[A]=a[w][A]/b[w];u.push(v)}const h=new Float64Array(d).fill(NaN);for(let w=0;w<d;w++){const v=f[w];v>=0&&(h[w]=L(o[w],u[v]))}return{assignments:f,centres:u,sizes:b,distances:h}}function g(o,c,d){const n=o.length;if(n===0)return 0;const p=new Int32Array(d);for(let r=0;r<n;r++)p[c[r]]++;let i=0;for(let r=0;r<n;r++){const f=c[r],m=new Float64Array(d);for(let a=0;a<n;a++)r!==a&&(m[c[a]]+=L(o[r],o[a]));const u=p[f]>1?m[f]/(p[f]-1):0;let b=1/0;for(let a=0;a<d;a++){if(a===f||p[a]===0)continue;const h=m[a]/p[a];h<b&&(b=h)}b!==1/0&&(i+=(b-u)/Math.max(u,b))}return i/n}function s(o,c={}){const d=o.length;if(!d)return null;const n=c.criterion==="silhouette"?"silhouette":"elbow",p=Math.max(2,Math.floor(c.maxK||8)),i=c.seed===void 0?1:c.seed;if(n==="silhouette"){const w=[],v=[];for(let H=2;H<=Math.min(p,d);H++){const G=y(o,{k:H,seed:i});G&&(w.push(H),v.push(g(o,G.assignments,H)))}if(!w.length)return null;let A=0;for(let H=1;H<v.length;H++)v[H]>v[A]&&(A=H);return{k:w[A],criterion:n,scores:v,ks:w}}const r=[],f=[];for(let w=1;w<=Math.min(p,d);w++){const v=y(o,{k:w,seed:i});v&&(r.push(w),f.push(v.inertia))}if(f.length<2)return null;const m={k:r[0],y:f[0]},u={k:r[r.length-1],y:f[f.length-1]},b=Math.hypot(u.k-m.k,u.y-m.y)||1;let a=0,h=-1/0;for(let w=0;w<f.length;w++){const v=Math.abs((u.k-m.k)*(m.y-f[w])-(m.k-r[w])*(u.y-m.y))/b;v>h&&(h=v,a=w)}return{k:r[a],criterion:n,scores:f,ks:r}}function t(o){const c=o.length,d=c?o[0].length:0;if(!c||!d)return null;const n=new Array(d).fill(0);for(let i=0;i<c;i++)for(let r=0;r<d;r++)n[r]+=o[i][r];for(let i=0;i<d;i++)n[i]/=c;const p=new Array(d).fill(0);for(let i=0;i<c;i++)for(let r=0;r<d;r++){const f=o[i][r]-n[r];p[r]+=f*f}for(let i=0;i<d;i++)p[i]=c>1?Math.sqrt(p[i]/(c-1)):0;for(let i=0;i<c;i++)for(let r=0;r<d;r++)p[r]>0?o[i][r]=(o[i][r]-n[r])/p[r]:o[i][r]=o[i][r]-n[r];return{mean:n,sd:p}}}),ze("packages/core/src/compute/compare.js",function(e,_){"use strict";Object.defineProperty(e,"COMPARE_MEASURES",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"pooledStandardMeanDifference",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"numericSummary",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"bothNumeric",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"compareColumnAcross",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"compareDatasets",{enumerable:!0,get:function(){return l}});const ne=_("packages/core/src/compute/statistics.js"),E=ne.numbers,K=ne.moments,U=ne.frequencyMap,D=ne.categoricalDistance,J=ne.normalTotalVariation,z=ne.isNumericColumn,L=ne.SUBSET_RELIABILITY_FLOOR,X=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function I(g,s){if(!g||!s||!(g.n>0)||!(s.n>0)||!Number.isFinite(g.mean)||!Number.isFinite(s.mean))return null;const t=(g.n*g.sd*g.sd+s.n*s.sd*s.sd)/(g.n+s.n);return t>0?(g.mean-s.mean)/Math.sqrt(t):null}function j(g,s){const t=E(g,s),{n:o,mean:c,m2:d}=K(t),n=o>0?Math.sqrt(d/o):0;return{mean:c,sd:n,n:o}}function k(g,s,t,o){return z(g,s)&&z(t,o)}function y(g,s,t,o){if(k(g,s,t,o)){const p=j(g,s),i=j(t,o),r=I(p,i);return{measure:X.numeric,magnitude:r,distance:r===null?0:J(r),direction:r===null?0:Math.sign(r),nA:p.n,nB:i.n,meanA:p.mean,meanB:i.mean,reliable:p.n>=L&&i.n>=L}}const c=U(g,s),d=U(t,o),n=D(c.map,c.total,d.map,d.total);return{measure:X.categorical,magnitude:n,distance:n===null?0:n,direction:0,nA:c.total,nB:d.total,meanA:null,meanB:null,reliable:c.total>=L&&d.total>=L}}function l(g,s,t={}){const o=new Set(g.columns),c=new Set(s.columns),d=g.columns.filter(f=>c.has(f)),n=Array.isArray(t.columns)&&t.columns.length?d.filter(f=>t.columns.includes(f)):d,p=g.indices(),i=s.indices(),r=[];for(const f of n){const m=g.handle(f),u=s.handle(f);if(!m||!u)continue;const b=y(m,p,u,i);r.push({column:f,name:g.name&&g.name(f)||s.name&&s.name(f)||f,measure:b.measure,magnitude:b.magnitude,distance:b.distance,direction:b.direction,nA:b.nA,nB:b.nB,meanA:b.meanA,meanB:b.meanB,reliable:b.reliable})}return r.sort((f,m)=>m.distance-f.distance||Math.abs(m.magnitude||0)-Math.abs(f.magnitude||0)),{ranked:r,nA:p.length,nB:i.length,unmatched:{onlyA:g.columns.filter(f=>!c.has(f)),onlyB:s.columns.filter(f=>!o.has(f))},measures:X}}}),ze("packages/core/src/compute/anomaly.js",function(e,_){"use strict";Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"DEFAULT_MODIFIED_Z_THRESHOLD",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return p}});const E=_("packages/core/src/compute/statistics.js").quantileSorted,U=_("packages/core/src/compute/special.js").logGamma,D=.6745,J=3.5,z=1.5,L=.975,X=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function I(i){if(!i.length)return null;const f=Array.from(i,Number).sort((a,h)=>a-h),m=E(f,.5),u=f.map(a=>Math.abs(a-m)).sort((a,h)=>a-h),b=E(u,.5);return{median:m,mad:b}}function j(i,r={}){const f=Number.isFinite(r.threshold)?r.threshold:J,m=i.length,u=new Array(m).fill(null),b=new Array(m).fill(!1),a=[];for(let v=0;v<m;v++){const A=Number(i[v]);Number.isFinite(A)&&a.push(A)}if(!a.length)return{median:null,mad:null,threshold:f,scores:u,flags:b,flagged:0};const h=I(a);if(h.mad===0)return{median:h.median,mad:0,threshold:f,scores:u,flags:b,flagged:0};let w=0;for(let v=0;v<m;v++){const A=Number(i[v]);if(!Number.isFinite(A))continue;const H=D*(A-h.median)/h.mad;u[v]=H,Math.abs(H)>f&&(b[v]=!0,w++)}return{median:h.median,mad:h.mad,threshold:f,scores:u,flags:b,flagged:w}}function k(i,r={}){const f=Number.isFinite(r.k)?r.k:z,m=[];for(let w=0;w<i.length;w++){const v=Number(i[w]);Number.isFinite(v)&&m.push(v)}if(!m.length)return null;const u=m.sort((w,v)=>w-v),b=E(u,.25),a=E(u,.75),h=a-b;return{q1:b,q3:a,iqr:h,lower:b-f*h,upper:a+f*h,k:f}}function y(i,r){if(r<=0)return 0;const f=U(i);if(r<i+1){let v=i,A=1/i,H=A;for(let G=0;G<1e3&&(v+=1,H*=r/v,A+=H,!(Math.abs(H)<Math.abs(A)*1e-15));G++);return A*Math.exp(-r+i*Math.log(r)-f)}const m=1e-300;let u=r+1-i,b=1/m,a=1/u,h=a;for(let v=1;v<1e3;v++){const A=-v*(v-i);u+=2,a=A*a+u,Math.abs(a)<m&&(a=m),b=u+A/b,Math.abs(b)<m&&(b=m),a=1/a;const H=a*b;if(h*=H,Math.abs(H-1)<1e-15)break}return 1-Math.exp(-r+i*Math.log(r)-f)*h}function l(i,r){return i<=0?0:y(r/2,i/2)}function g(i,r=L){if(!(r>0)||!(r<1))return NaN;let f=0,m=Math.max(1,i);for(;l(m,i)<r;)m*=2;for(let u=0;u<200;u++){const b=(f+m)/2;if(l(b,i)<r?f=b:m=b,m-f<1e-10)break}return(f+m)/2}function s(i){const r=i.length,f=i.map((m,u)=>{const b=m.slice();for(let a=0;a<r;a++)b.push(u===a?1:0);return b});for(let m=0;m<r;m++){let u=m;for(let a=m+1;a<r;a++)Math.abs(f[a][m])>Math.abs(f[u][m])&&(u=a);if(Math.abs(f[u][m])<1e-12)return null;if(u!==m){const a=f[u];f[u]=f[m],f[m]=a}const b=f[m][m];for(let a=0;a<2*r;a++)f[m][a]/=b;for(let a=0;a<r;a++){if(a===m)continue;const h=f[a][m];if(h!==0)for(let w=0;w<2*r;w++)f[a][w]-=h*f[m][w]}}return f.map(m=>m.slice(r))}function t(i,r){const f=i.length,m=new Array(r).fill(0);for(const a of i)for(let h=0;h<r;h++)m[h]+=a[h];for(let a=0;a<r;a++)m[a]/=f;const u=Array.from({length:r},()=>new Array(r).fill(0));for(const a of i)for(let h=0;h<r;h++){const w=a[h]-m[h];for(let v=h;v<r;v++)u[h][v]+=w*(a[v]-m[v])}const b=f>1?f-1:1;for(let a=0;a<r;a++)for(let h=a;h<r;h++)u[a][h]/=b,u[h][a]=u[a][h];return{mean:m,cov:u}}function o(i,r={}){const f=Number.isFinite(r.p)?r.p:L,m=Number.isFinite(r.ridge)?r.ridge:1e-6,u=i.length;if(!u)return null;const b=i[0].length;if(!b)return null;const a=new Array(u).fill(null),h=new Array(u).fill(null),w=new Array(u).fill(!1),v=[],A=[];for(let N=0;N<u;N++){const P=i[N];let C=P.length===b;const B=new Array(b);for(let x=0;C&&x<b;x++){const V=Number(P[x]);Number.isFinite(V)?B[x]=V:C=!1}C&&(v.push(N),A.push(B))}const H=b,G=g(H,f);if(A.length<=b)return{center:[],df:H,cutoff:G,singular:!0,used:A.length,distances:a,squared:h,flags:w,flagged:0};const{mean:Z,cov:M}=t(A,b);let S=s(M),T=!1;if(!S){T=!0;let N=0;for(let B=0;B<b;B++)N+=M[B][B];const P=N/b*m||m,C=M.map((B,x)=>B.map((V,Y)=>x===Y?V+P:V));if(S=s(C),!S)return{center:Z,df:H,cutoff:G,singular:!0,used:A.length,distances:a,squared:h,flags:w,flagged:0}}let O=0;for(let N=0;N<A.length;N++){const P=A[N],C=new Array(b);for(let V=0;V<b;V++)C[V]=P[V]-Z[V];let B=0;for(let V=0;V<b;V++){let Y=0;for(let F=0;F<b;F++)Y+=S[V][F]*C[F];B+=C[V]*Y}B<0&&(B=0);const x=v[N];h[x]=B,a[x]=Math.sqrt(B),B>G&&(w[x]=!0,O++)}return{center:Z,df:H,cutoff:G,singular:T,used:A.length,distances:a,squared:h,flags:w,flagged:O}}const c=20,d=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function n(i,r={}){const f=r.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",m=Number.isFinite(r.windowLen)&&r.windowLen>=1?Math.floor(r.windowLen):c,u=Number.isFinite(r.threshold)?r.threshold:J,b=Number.isFinite(r.k)?r.k:z,a=Number.isFinite(r.minPeriods)&&r.minPeriods>=1?Math.floor(r.minPeriods):m,h=i.length,w=new Array(h).fill(null),v=new Array(h).fill(!1);let A=0;for(let H=0;H<h;H++){const G=Number(i[H]);if(!Number.isFinite(G))continue;const Z=Math.max(0,H-m+1),M=[];for(let S=Z;S<=H;S++){const T=Number(i[S]);Number.isFinite(T)&&M.push(T)}if(!(M.length<a))if(f==="rollingIqr"){const S=k(M,{k:b});if(!S)continue;(G<S.lower||G>S.upper)&&(v[H]=!0,A++)}else{const S=I(M);if(!S||S.mad===0)continue;const T=D*(G-S.median)/S.mad;w[H]=T,Math.abs(T)>u&&(v[H]=!0,A++)}}return{method:f,windowLen:m,minPeriods:a,threshold:u,k:b,scores:w,flags:v,flagged:A}}function p(i={}){const r=i||{},f=r.field;if(typeof f!="string"||!f)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const m=r.method||"modifiedZScore";if(!(X.includes(m)||d.includes(m))||m==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${m}'`);const b=typeof r.orderBy=="string"?r.orderBy:null,a=r.latest===!0,h=d.includes(m),w=v=>Number(v==null?NaN:v[f]);return v=>{const A=Array.isArray(v)?v.slice():[...v];b&&A.sort((S,T)=>{const O=S?.[b],N=T?.[b];return O===N?0:O==null?-1:N==null?1:O<N?-1:1});const H=A.map(w);let G,Z;if(h)({flags:G,scores:Z}=n(H,{method:m,windowLen:r.windowLen,threshold:r.threshold,k:r.k,minPeriods:r.minPeriods}));else if(m==="iqr"){const S=k(H,{k:r.k});G=H.map(T=>S?Number.isFinite(T)&&(T<S.lower||T>S.upper):!1),Z=H.map(()=>null)}else({flags:G,scores:Z}=j(H,{threshold:r.threshold}));if(a){const S=G.length-1;return S<0||!G[S]?!1:{method:m,field:f,flagged:[{row:A[S],score:Z[S]}]}}const M=[];for(let S=0;S<G.length;S++)G[S]&&M.push({row:A[S],score:Z[S]});return M.length?{method:m,field:f,flagged:M}:!1}}}),ze("packages/core/src/compute/forecast.js",function(e,_){"use strict";Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return i}});const ne=_("packages/core/src/compute/special.js"),E=ne.normalQuantile,K=ne.studentTQuantile,D=_("packages/core/src/internal/warn.js").warnOnce,J=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),z=1e-4,L=1-1e-4;function X(r){const f=[];for(let m=0;m<r.length;m++){const u=r[m];if(u!==null&&typeof u=="object"){const b=Number.isFinite(u.at)?u.at:m,a=Number.isFinite(u.value)?u.value:null;f.push({at:b,value:a})}else f.push({at:m,value:Number.isFinite(u)?Number(u):null})}return f}function I(r){const f=r.filter(h=>h.value!==null),m=f[0],u=f[f.length-1],b=u.at-m.at,a=f.length>1&&b>0?b/(f.length-1):1;return{lastAt:u.at,step:a}}function j(r){return Math.min(L,Math.max(z,r))}function k(r,f=z,m=L,u=80){const b=(Math.sqrt(5)-1)/2;let a=f,h=m,w=h-b*(h-a),v=a+b*(h-a),A=r(w),H=r(v);for(let G=0;G<u;G++)A<H?(h=v,v=w,H=A,w=h-b*(h-a),A=r(w)):(a=w,w=v,A=H,v=a+b*(h-a),H=r(v));return(a+h)/2}function y(r,f){let m=null,u=0,b=0;for(let a=0;a<r.length;a++){const h=r[a];if(h!==null){if(m===null){m=h;continue}u+=(h-m)**2,b+=1,m=f*h+(1-f)*m}}return{level:m,sse:u,m:b}}function l(r,f,m){let u=null,b=null,a=0,h=0;for(let w=0;w<r.length;w++){const v=r[w];if(v===null){u!==null&&b!==null&&(u+=b);continue}if(u===null){u=v;continue}b===null&&(b=v-u);const A=u+b;a+=(v-A)**2,h+=1;const H=u;u=f*v+(1-f)*(H+b),b=m*(u-H)+(1-m)*b}return{level:u,trend:b,sse:a,m:h}}function g(r,f,m,u,b){const a=r.length;if(a<2*f)return null;const h=T=>{let O=0,N=0;for(let P=T;P<T+f&&P<a;P++)r[P]!==null&&(O+=r[P],N+=1);return N?O/N:null},w=h(0),v=h(f);if(w===null||v===null)return null;let A=w,H=(v-w)/f;const G=new Array(f).fill(0);for(let T=0;T<f;T++)G[T]=r[T]===null?0:r[T]-A;const Z=G.reduce((T,O)=>T+O,0)/f;for(let T=0;T<f;T++)G[T]-=Z;let M=0,S=0;for(let T=f;T<a;T++){const O=T%f,N=G[O],P=r[T];if(P===null){A+=H;continue}const C=A+H+N;M+=(P-C)**2,S+=1;const B=A;A=m*(P-N)+(1-m)*(A+H),H=u*(A-B)+(1-u)*H,G[O]=b*(P-A)+(1-b)*N}return{level:A,trend:H,season:G,phase:(a-1)%f,sse:M,count:S}}function s(r,f,m){let u=1;for(const a of f)u+=a*a;const b=Math.sqrt(r*u);return{se:b,margin:m*b}}function t(r,f={}){if(!r||typeof r.length!="number"||r.length===0)return null;const m=J.includes(f.method)?f.method:"linear",u=Math.max(1,Math.floor(Number(f.horizon)||1)),b=Number.isFinite(f.confidence)&&f.confidence>0&&f.confidence<1?f.confidence:.95,a=1-(1-b)/2,h=X(r),w=h.map(M=>M.value),v=w.filter(M=>M!==null),A=v.length,{lastAt:H,step:G}=A?I(h):{lastAt:0,step:1},Z=M=>H+M*G;return m==="linear"?o(h,A,u,b,a,Z):m==="movingAverage"?c(v,A,u,b,a,f,Z):m==="ses"?d(w,A,u,b,a,f,Z):m==="holt"?n(w,A,u,b,a,f,Z):p(w,A,u,b,a,f,Z)}function o(r,f,m,u,b,a){if(f<2)return null;let h=0,w=0;for(const P of r)P.value!==null&&(h+=P.at,w+=P.value);h/=f,w/=f;let v=0,A=0,H=0;for(const P of r){if(P.value===null)continue;const C=P.at-h,B=P.value-w;v+=C*C,A+=C*B,H+=B*B}if(v===0)return null;const G=A/v,Z=w-G*h,M=H===0?1:Math.max(0,Math.min(1,A*A/(v*H))),S=Math.max(0,H-G*A),T=f>2?Math.sqrt(S/(f-2)):null,O=f>2?K(b,f-2):null,N=[];for(let P=1;P<=m;P++){const C=a(P),B=Z+G*C;let x=null,V=null,Y=null,F=null,$=null;if(T!==null){const q=1/f+(C-h)**2/v,ee=T*Math.sqrt(1+q),te=T*Math.sqrt(q);$=ee,x=B-O*ee,V=B+O*ee,Y=B-O*te,F=B+O*te}N.push({step:P,at:C,mean:B,lower:x,upper:V,lowerMean:Y,upperMean:F,se:$})}return{method:"linear",horizon:m,confidence:u,n:f,sigma:T,r2:M,params:{slope:G,intercept:Z},points:N}}function c(r,f,m,u,b,a,h){if(f<1)return null;const w=Math.max(1,Math.min(f,Math.floor(Number(a.windowLen)||f))),v=r.slice(f-w);let A=0;for(const T of v)A+=T;const H=A/w;let G=null,Z=null;if(w>1){let T=0;for(const N of v)T+=(N-H)**2;G=Math.sqrt(T/(w-1))*Math.sqrt(1+1/w),Z=K(b,w-1)}const M=G===null?null:Z*G,S=[];for(let T=1;T<=m;T++)S.push({step:T,at:h(T),mean:H,lower:M===null?null:H-M,upper:M===null?null:H+M,se:G});return{method:"movingAverage",horizon:m,confidence:u,n:f,sigma:G===null?null:G,params:{windowLen:w},points:S}}function d(r,f,m,u,b,a,h){if(f<1)return null;let w=Number.isFinite(a.alpha)?j(a.alpha):null;w===null&&(w=k(Z=>y(r,Z).sse));const v=y(r,w),A=E(b),H=v.m>0?v.sse/v.m:null,G=[];for(let Z=1;Z<=m;Z++){const M=v.level;let S=null,T=null,O=null;if(H!==null){const N=[];for(let C=1;C<Z;C++)N.push(w);const P=s(H,N,A);O=P.se,S=M-P.margin,T=M+P.margin}G.push({step:Z,at:h(Z),mean:M,lower:S,upper:T,se:O})}return{method:"ses",horizon:m,confidence:u,n:f,sigma:H===null?null:Math.sqrt(H),params:{alpha:w},points:G}}function n(r,f,m,u,b,a,h){if(f<2)return null;let w=Number.isFinite(a.alpha)?j(a.alpha):null,v=Number.isFinite(a.beta)?j(a.beta):null;if(w===null||v===null){let S=w===null?.5:w,T=v===null?.5:v;for(let O=0;O<6;O++)w===null&&(S=k(N=>l(r,N,T).sse)),v===null&&(T=k(N=>l(r,S,N).sse));w=w===null?S:w,v=v===null?T:v}const A=l(r,w,v),H=E(b),G=A.m>0?A.sse/A.m:null,Z=w*v,M=[];for(let S=1;S<=m;S++){const T=A.level+S*A.trend;let O=null,N=null,P=null;if(G!==null){const C=[];for(let x=1;x<S;x++)C.push(w+x*Z);const B=s(G,C,H);P=B.se,O=T-B.margin,N=T+B.margin}M.push({step:S,at:h(S),mean:T,lower:O,upper:N,se:P})}return{method:"holt",horizon:m,confidence:u,n:f,sigma:G===null?null:Math.sqrt(G),params:{alpha:w,beta:v},points:M}}function p(r,f,m,u,b,a,h){const w=Math.floor(Number(a.period));if(!(w>=2))return D("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(f<2*w)return null;let v=Number.isFinite(a.alpha)?j(a.alpha):null,A=Number.isFinite(a.beta)?j(a.beta):null,H=Number.isFinite(a.gamma)?j(a.gamma):null;const G=(P,C,B)=>{const x=g(r,w,P,C,B);return x?x.sse:1/0};if(v===null||A===null||H===null){let P=v===null?.5:v,C=A===null?.5:A,B=H===null?.5:H;for(let x=0;x<8;x++)v===null&&(P=k(V=>G(V,C,B))),A===null&&(C=k(V=>G(P,V,B))),H===null&&(B=k(V=>G(P,C,V)));v=v===null?P:v,A=A===null?C:A,H=H===null?B:H}const Z=g(r,w,v,A,H);if(!Z)return null;const M=E(b),S=Z.count>0?Z.sse/Z.count:null,T=v*A,O=H*(1-v),N=[];for(let P=1;P<=m;P++){const C=Z.season[(Z.phase+P)%w],B=Z.level+P*Z.trend+C;let x=null,V=null,Y=null;if(S!==null){const F=[];for(let q=1;q<P;q++)F.push(v+q*T+(q%w===0?O:0));const $=s(S,F,M);Y=$.se,x=B-$.margin,V=B+$.margin}N.push({step:P,at:h(P),mean:B,lower:x,upper:V,se:Y})}return{method:"holtWinters",horizon:m,confidence:u,n:f,sigma:S===null?null:Math.sqrt(S),params:{alpha:v,beta:A,gamma:H,period:w},points:N}}const i={FORECAST_METHODS:J,forecast:t}}),ze("packages/core/src/compute/hypothesis.js",function(e,_){"use strict";Object.defineProperty(e,"GROUP_TESTS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"NORMALITY_ALPHA",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"HL_PAIR_LIMIT",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"welchTTest",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"mannWhitneyUTest",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"chiSquareTest",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return M}});const E=_("packages/core/src/internal/warn.js").warnOnce,U=_("packages/core/src/compute/handle.js").valueReader,D=_("packages/core/src/compute/statistics.js"),J=D.numbers,z=D.moments,L=D.frequencyMap,X=D.categoricalDistance,I=D.isNumericColumn,j=D.jarqueBera,k=D.proportionInterval,y=D.SUBSET_RELIABILITY_FLOOR,g=_("packages/core/src/compute/compare.js").pooledStandardMeanDifference,s=_("packages/core/src/compute/special.js"),t=s.studentT,o=s.studentTQuantile,c=s.normalCdf,d=s.normalQuantile,n=s.chiSquareUpperTail,p=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),i=.05,r=2e6;function f(S){const T=Number(S);return Number.isFinite(T)&&T>0&&T<1?T:.95}function m(S){const{n:T,mean:O,m2:N}=z(S);return{mean:O,sd:T>0?Math.sqrt(N/T):0,n:T}}function u(S,T){const O=S.length;if(O<2)return 0;let N=0;for(let P=0;P<O;P++){const C=S[P]-T;N+=C*C}return N/(O-1)}function b(S,T){return{name:"pooledStandardMeanDifference",value:g(m(S),m(T))}}function a(S,T,O){const N=S.length,P=T.length;if(N<2||P<2)return null;const C=f(O),{mean:B}=z(S),{mean:x}=z(T),V=u(S,B),Y=u(T,x),F=V/N+Y/P;if(!(F>0))return null;const $=Math.sqrt(F),q=(B-x)/$,ee=V/N*(V/N)/(N-1),te=Y/P*(Y/P)/(P-1),re=F*F/(ee+te),ie=Math.min(1,Math.max(0,2*(1-t(Math.abs(q),re)))),ue=B-x,Ae=o(1-(1-C)/2,re)*$;return{test:p.WELCH,statistic:q,statisticName:"t",df:re,pValue:ie,interval:{estimate:ue,lower:ue-Ae,upper:ue+Ae,confidence:C,method:"welch-t (difference of means)"},effectSize:b(S,T),nA:N,nB:P,reliable:N>=y&&P>=y,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function h(S){const T=S.length;if(T===0)return Number.NaN;const O=T>>1;return T%2?S[O]:(S[O-1]+S[O])/2}function w(S,T,O){const N=S.length,P=T.length,C=N*P;if(C===0||C>r)return null;const B=new Float64Array(C);let x=0;for(let ee=0;ee<N;ee++)for(let te=0;te<P;te++)B[x++]=S[ee]-T[te];B.sort();const V=h(B),Y=Math.sqrt(N*P*(N+P+1)/12),F=d(1-(1-O)/2);let $=Math.round(C/2-F*Y);$>=0||($=0);const q=Math.floor((C-1)/2);return $>q&&($=q),{estimate:V,lower:B[$],upper:B[C-1-$],confidence:O,method:"hodges-lehmann (normal approximation)"}}function v(S,T,O){const N=S.length,P=T.length;if(N<1||P<1)return null;const C=f(O),B=N+P,x=new Array(B);for(let ie=0;ie<N;ie++)x[ie]={v:S[ie],g:0};for(let ie=0;ie<P;ie++)x[N+ie]={v:T[ie],g:1};x.sort((ie,ue)=>ie.v-ue.v);let V=0,Y=0,F=0;for(;F<B;){let ie=F;for(;ie<B&&x[ie].v===x[F].v;)ie++;const ue=ie-F,Ae=(F+1+ie)/2;for(let de=F;de<ie;de++)x[de].g===0&&(V+=Ae);Y+=ue*ue*ue-ue,F=ie}const $=V-N*(N+1)/2,q=N*P/2,ee=N*P/12*(B+1-Y/(B*(B-1)));let te=1;if(ee>0){const ie=Math.max(0,Math.abs($-q)-.5);te=Math.min(1,2*c(-ie/Math.sqrt(ee)))}const re=w(S,T,C);return{test:p.MANN_WHITNEY,statistic:$,statisticName:"U",df:null,pValue:te,interval:re,effectSize:b(S,T),nA:N,nB:P,reliable:N>=y&&P>=y,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function A(S,T,O,N,P){const C=k(S,T,P),B=k(O,N,P);if(!C||!B)return null;const x=C.proportion-B.proportion,V=x-Math.sqrt((C.proportion-C.lower)**2+(B.upper-B.proportion)**2),Y=x+Math.sqrt((C.upper-C.proportion)**2+(B.proportion-B.lower)**2);return{lower:V,upper:Y}}function H(S,T,O,N,P,C={}){if(!(T>0)||!(N>0))return null;const B=new Set([...S.keys(),...O.keys()]),x=B.size;if(x<2)return null;const V=T+N;let Y=0;for(const te of B){const re=S.get(te)||0,ie=O.get(te)||0,ue=re+ie,Ae=T*ue/V,de=N*ue/V;Ae>0&&(Y+=(re-Ae)*(re-Ae)/Ae),de>0&&(Y+=(ie-de)*(ie-de)/de)}const F=x-1,$=n(Y,F);let q=null;C.category!==void 0&&B.has(C.category)?q=C.category:x===2&&([q]=[...B]);let ee=null;if(q!==null){const te=A(S.get(q)||0,T,O.get(q)||0,N,f(P));te&&(ee={estimate:(S.get(q)||0)/T-(O.get(q)||0)/N,lower:te.lower,upper:te.upper,confidence:f(P),method:"newcombe (difference in this category's share)",category:q})}return{test:p.CHI_SQUARE,statistic:Y,statisticName:"chiSquare",df:F,pValue:$,interval:ee,effectSize:{name:"categoricalTotalVariation",value:X(S,T,O,N)},nA:T,nB:N,reliable:T>=y&&N>=y,method:"Pearson chi-square test of independence (2×k, no continuity correction)"}}function G(S){return S==null||S===""||typeof S=="number"&&Number.isNaN(S)?null:S instanceof Date?S.getTime():typeof S=="object"?String(S):S}function Z(S,T,O){if(O===p.WELCH||O===p.MANN_WHITNEY)return{test:O,chosenBy:"override",reason:`caller override: ${O}`};const N=j(S),P=j(T),C=N===null?null:Math.exp(-N/2),B=P===null?null:Math.exp(-P/2);return C!==null&&C<i||B!==null&&B<i?{test:p.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${i})`}:{test:p.WELCH,chosenBy:"auto",reason:C!==null||B!==null?"column family: numeric, no departure from normality detected":"column family: numeric (too few rows to screen normality)"}}function M(S,T,O,N={}){if(!S||!T)return null;const P=f(N.confidence),C=U(T);let B;if(Array.isArray(N.groups)&&N.groups.length===2)B=[G(N.groups[0]),G(N.groups[1])];else{const{map:ie}=L(T,O),ue=[...ie.entries()].sort((Ae,de)=>de[1]-Ae[1]).slice(0,2).map(Ae=>Ae[0]);if(ue.length<2)return E("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;B=ue}const[x,V]=B;if(x===null||V===null||x===V)return E("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const Y=[],F=[];for(let ie=0;ie<O.length;ie++){const ue=G(C(O[ie]));ue===x?Y.push(O[ie]):ue===V&&F.push(O[ie])}if(Y.length===0||F.length===0)return E("compareGroups:empty","[lattice] compareGroups: one of the two groups has no rows in the current set."),null;const $=N.test&&N.test!=="auto"?String(N.test):null,q=I(S,Y.concat(F));let ee,te,re;if($===p.CHI_SQUARE||!$&&!q){te=$?"override":"auto",re=$?"caller override: chiSquare":"column family: categorical";const ie=L(S,Y),ue=L(S,F);ee=H(ie.map,ie.total,ue.map,ue.total,P,{category:N.category})}else{if(($===p.WELCH||$===p.MANN_WHITNEY)&&!q)return E("compareGroups:numeric-override",`[lattice] compareGroups: ${$} needs a numeric column, but the column is not numeric.`),null;const ie=J(S,Y),ue=J(S,F),Ae=Z(ie,ue,$);te=Ae.chosenBy,re=Ae.reason,ee=Ae.test===p.MANN_WHITNEY?v(ie,ue,P):a(ie,ue,P)}return ee?{...ee,chosenBy:te,reason:re,groups:[x,V]}:(E("compareGroups:degenerate","[lattice] compareGroups: the chosen test had too little to work with (too few values, or no variation)."),null)}}),ze("packages/core/src/compute/significance.js",function(e,_){"use strict";Object.defineProperty(e,"COMPARE_TESTS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"compare",{enumerable:!0,get:function(){return Oe}});const E=_("packages/core/src/internal/warn.js").warnOnce,U=_("packages/core/src/compute/handle.js").valueReader,D=_("packages/core/src/compute/statistics.js"),J=D.numbers,z=D.moments,L=D.frequencyMap,X=D.isNumericColumn,I=D.jarqueBera,j=D.proportionInterval,k=_("packages/core/src/compute/special.js"),y=k.studentT,l=k.studentTQuantile,g=k.normalCdf,s=k.normalQuantile,t=k.chiSquareUpperTail,o=k.incompleteBeta,c=Object.freeze({T:"t",WELCH:"welch",MANN_WHITNEY:"mannWhitney",ANOVA:"anova",KRUSKAL:"kruskal",CHI_SQUARE:"chiSquare",PROPORTIONS:"proportions"}),d=new Set([c.T,c.WELCH,c.MANN_WHITNEY]),n=new Set([c.ANOVA,c.KRUSKAL]),p=new Set([c.CHI_SQUARE,c.PROPORTIONS]),i=.05,r=[.2,.5,.8],f=[.147,.33,.474],m=[.01,.06,.14],u=[[.1,.3,.5],[.07,.21,.35],[.06,.17,.29],[.05,.15,.25]];function b(pe){const ae=Number(pe);return Number.isFinite(ae)&&ae>0&&ae<1?ae:.05}function a(pe){return pe==null||pe===""||typeof pe=="number"&&Number.isNaN(pe)?null:pe instanceof Date?pe.getTime():typeof pe=="object"?String(pe):pe}function h(pe,ae){const ge=U(pe),ve=[],le=new Map;for(let we=0;we<ae.length;we++){const he=a(ge(ae[we]));if(he===null)continue;let be=le.get(he);be||(be={value:he,rows:[]},le.set(he,be),ve.push(be)),be.rows.push(ae[we])}return ve}function w(pe){const{n:ae,mean:ge,m2:ve}=z(pe),le=ae>1?ve/(ae-1):0;return{n:ae,mean:ge,sd:Math.sqrt(le),variance:le}}function v(pe,ae,ge){if(!(ae>0)||!(ge>0)||!(pe>=0)||!Number.isFinite(pe))return Number.NaN;if(pe===0)return 1;const ve=ae*pe/(ae*pe+ge);return 1-o(ae/2,ge/2,ve)}function A(pe,ae){const ge=Math.abs(pe);return Number.isFinite(ge)?ge>=ae[2]?"large":ge>=ae[1]?"medium":ge>=ae[0]?"small":"negligible":"negligible"}function H(pe,ae,ge){if(pe==="cohensD")return A(ae,r);if(pe==="cliffsDelta")return A(ae,f);if(pe==="etaSquared")return A(ae,m);const ve=Math.max(1,Math.min(u.length,Math.floor(ge||1)));return A(ae,u[ve-1])}function G(pe,ae){if(!(pe.n>1)||!(ae.n>1))return null;const ge=((pe.n-1)*pe.variance+(ae.n-1)*ae.variance)/(pe.n+ae.n-2);return ge>0?(pe.mean-ae.mean)/Math.sqrt(ge):null}function Z(pe,ae){const ge=pe.length,ve=ae.length;if(!ge||!ve)return null;const le=Array.from(ae).sort((be,Te)=>be-Te);let we=0,he=0;for(let be=0;be<ge;be++){const Te=pe[be];let je=0,ke=ve;for(;je<ke;){const He=je+ke>>1;le[He]<Te?je=He+1:ke=He}const Ue=je;let Re=je;for(;Re<ve&&le[Re]===Te;)Re++;const Ee=Re-je;we+=Ue,he+=ve-Re}return(we-he)/(ge*ve)}function M(pe,ae,ge,ve){const le=Math.min(ge-1,ve-1);return!(ae>0)||!(le>0)?null:Math.sqrt(pe/(ae*le))}function S(pe){return Number.isFinite(pe)?pe<.001?"p < 0.001":pe>=.995?"p > 0.995":`p = ${pe.toFixed(3)}`:"p = —"}function T(pe){if(!Number.isFinite(pe))return"0";const ae=Math.abs(pe);return ae===0?"0":ae>=1e3?String(Math.round(pe)):ae>=100?String(Number(pe.toFixed(0))):ae>=10?String(Number(pe.toFixed(1))):ae>=1?String(Number(pe.toFixed(2))):String(Number(pe.toPrecision(2)))}const O=new Set(["cohensD","cliffsDelta"]);function N(pe){if(pe.difference!=null&&Math.abs(pe.difference)>=1e-12)return Math.sign(pe.difference);const ae=pe.effectSize;if(ae&&O.has(ae.name)&&Number.isFinite(ae.value)&&Math.abs(ae.value)>=1e-12)return Math.sign(ae.value);const[ge,ve]=pe.groups;return Number.isFinite(ge.mean)&&Number.isFinite(ve.mean)&&ge.mean!==ve.mean?Math.sign(ge.mean-ve.mean):0}function P(pe){const ae=pe.measureName||"values";return{subject:ae.charAt(0).toUpperCase()+ae.slice(1),be:ae==="values"?"are":"is",name:ae}}function C(pe,ae){const ge=ae.unit?` ${ae.unit}`:"",{subject:ve,be:le}=P(ae),we=pe.groups[0].label,he=pe.groups[1].label,be=pe.effectSize?pe.effectSize.label:"negligible",Te=pe.pValue<pe.alpha,je=Te?"unlikely to be chance":"consistent with chance";if(!Te&&be==="negligible")return`${ve} ${le} essentially the same for ${we} and ${he} (${S(pe.pValue)}); the effect is ${be}.`;const ke=N(pe),Ue=`the difference is ${je} (${S(pe.pValue)}) and the effect is ${be}.`;if(ke===0)return`${ve} ${le} different between ${we} and ${he}; ${Ue}`;const Re=ke>0?we:he,Ee=ke>0?he:we,Ke=pe.difference!=null&&Math.abs(pe.difference)>=1e-12?` by about ${T(Math.abs(pe.difference))}${ge}`:"";return`${ve} ${le} higher for ${Re} than for ${Ee}${Ke}; ${Ue}`}function B(pe,ae){const{name:ge}=P(ae),ve=pe.effectSize?pe.effectSize.label:"negligible",le=S(pe.pValue);return pe.pValue<pe.alpha?`The groups differ in ${ge}; the difference is unlikely to be chance (${le}) and the effect is ${ve}.`:ve==="negligible"?`The groups are essentially the same in ${ge} (${le}); the effect is ${ve}.`:`The groups show a ${ve} effect in ${ge}, but the difference is consistent with chance (${le}).`}function x(pe,ae){const ge=pe.length;if(ge<2)return null;const{mean:ve,m2:le}=z(pe),we=le/(ge-1);if(!(we>0))return null;const he=Math.sqrt(we),be=he/Math.sqrt(ge),Te=ve/be,je=ge-1,ke=Math.min(1,Math.max(0,2*(1-y(Math.abs(Te),je)))),Ue=l(1-ae/2,je)*be,Re=ve/he;return{test:c.T,statistic:Te,statisticName:"t",df:je,pValue:ke,difference:ve,interval:{estimate:ve,lower:ve-Ue,upper:ve+Ue,confidence:1-ae,method:"paired-t (mean of the pair differences)"},effectSize:{name:"cohensD",label:A(Re,r),value:Re}}}function V(pe,ae){const ge=Array.from(pe).filter(Ke=>Ke!==0),ve=ge.length;if(!ve)return null;const le=Array.from({length:ve},(Ke,We)=>We).sort((Ke,We)=>Math.abs(ge[Ke])-Math.abs(ge[We])),we=new Array(ve);let he=0;for(;he<ve;){let Ke=he;for(;Ke+1<ve&&Math.abs(ge[le[Ke+1]])===Math.abs(ge[le[he]]);)Ke++;const We=(he+Ke)/2+1;for(let qe=he;qe<=Ke;qe++)we[le[qe]]=We;he=Ke+1}let be=0,Te=0;for(let Ke=0;Ke<ve;Ke++)Te+=we[Ke],ge[Ke]>0&&(be+=we[Ke]);const je=Te-be,ke=ve*(ve+1)/4,Ue=Math.sqrt(ve*(ve+1)*(2*ve+1)/24),Re=Ue>0?(Math.abs(be-ke)-.5)/Ue:0,Ee=Math.min(1,Math.max(0,2*g(-Math.max(0,Re)))),He=Te>0?(be-je)/Te:0;return{test:c.MANN_WHITNEY,statistic:be,statisticName:"W",df:null,pValue:Ee,difference:null,interval:null,effectSize:{name:"cliffsDelta",label:A(He,f),value:He}}}function Y(pe,ae,ge){const ve=w(pe),le=w(ae);if(ve.n<2||le.n<2)return null;const we=((ve.n-1)*ve.variance+(le.n-1)*le.variance)/(ve.n+le.n-2);if(!(we>0))return null;const he=Math.sqrt(we*(1/ve.n+1/le.n)),be=(ve.mean-le.mean)/he,Te=ve.n+le.n-2,je=Math.min(1,Math.max(0,2*(1-y(Math.abs(be),Te)))),ke=ve.mean-le.mean,Ue=l(1-ge/2,Te)*he,Re=G(ve,le);return{test:c.T,statistic:be,statisticName:"t",df:Te,pValue:je,difference:ke,interval:{estimate:ke,lower:ke-Ue,upper:ke+Ue,confidence:1-ge,method:"student-t (pooled variance, difference of means)"},effectSize:{name:"cohensD",label:A(Re,r),value:Re},summaries:[ve,le]}}function F(pe,ae,ge){const ve=w(pe),le=w(ae);if(ve.n<2||le.n<2)return null;const we=ve.variance/ve.n+le.variance/le.n;if(!(we>0))return null;const he=Math.sqrt(we),be=(ve.mean-le.mean)/he,Te=ve.variance/ve.n*(ve.variance/ve.n)/(ve.n-1),je=le.variance/le.n*(le.variance/le.n)/(le.n-1),ke=we*we/(Te+je),Ue=Math.min(1,Math.max(0,2*(1-y(Math.abs(be),ke)))),Re=ve.mean-le.mean,Ee=l(1-ge/2,ke)*he,He=G(ve,le);return{test:c.WELCH,statistic:be,statisticName:"t",df:ke,pValue:Ue,difference:Re,interval:{estimate:Re,lower:Re-Ee,upper:Re+Ee,confidence:1-ge,method:"welch-t (unequal variances, difference of means)"},effectSize:{name:"cohensD",label:A(He,r),value:He},summaries:[ve,le]}}function $(pe,ae,ge){const ve=pe.length,le=ae.length;if(ve<1||le<1)return null;const we=w(pe),he=w(ae),be=ve+le,Te=new Array(be);for(let qe=0;qe<ve;qe++)Te[qe]={v:pe[qe],g:0};for(let qe=0;qe<le;qe++)Te[ve+qe]={v:ae[qe],g:1};Te.sort((qe,et)=>qe.v-et.v);let je=0,ke=0,Ue=0;for(;Ue<be;){let qe=Ue;for(;qe<be&&Te[qe].v===Te[Ue].v;)qe++;const et=(Ue+1+qe)/2;for(let lt=Ue;lt<qe;lt++)Te[lt].g===0&&(je+=et);const dt=qe-Ue;ke+=dt*dt*dt-dt,Ue=qe}const Re=je-ve*(ve+1)/2,Ee=ve*le/2,He=ve*le/12*(be+1-ke/(be*(be-1)));let Ke=1;if(He>0){const qe=Math.max(0,Math.abs(Re-Ee)-.5);Ke=Math.min(1,2*g(-qe/Math.sqrt(He)))}const We=Z(pe,ae);return{test:c.MANN_WHITNEY,statistic:Re,statisticName:"U",df:null,pValue:Ke,difference:null,interval:q(pe,ae,1-ge),effectSize:{name:"cliffsDelta",label:A(We,f),value:We},summaries:[we,he]}}function q(pe,ae,ge){const ve=pe.length,le=ae.length,we=ve*le;if(we===0||we>2e6)return null;const he=new Float64Array(we);let be=0;for(let He=0;He<ve;He++)for(let Ke=0;Ke<le;Ke++)he[be++]=pe[He]-ae[Ke];he.sort();const Te=we>>1,je=we%2?he[Te]:(he[Te-1]+he[Te])/2,ke=Math.sqrt(ve*le*(ve+le+1)/12),Ue=s(1-(1-ge)/2);let Re=Math.round(we/2-Ue*ke);Re>=0||(Re=0);const Ee=Math.floor((we-1)/2);return Re>Ee&&(Re=Ee),{estimate:je,lower:he[Re],upper:he[we-1-Re],confidence:ge,method:"hodges-lehmann (location shift)"}}function ee(pe,ae){const ge=pe.length,ve=pe.map(w);if(ve.some(Ke=>Ke.n<2))return null;const le=ve.reduce((Ke,We)=>Ke+We.n,0),we=ve.reduce((Ke,We)=>Ke+We.mean*We.n,0)/le;let he=0,be=0;for(let Ke=0;Ke<ge;Ke++)he+=ve[Ke].n*(ve[Ke].mean-we)**2,be+=(ve[Ke].n-1)*ve[Ke].variance;const Te=ge-1,je=le-ge;if(!(be>0)||je<1)return null;const ke=he/Te,Ue=be/je,Re=ke/Ue,Ee=Math.min(1,Math.max(0,v(Re,Te,je))),He=he/(he+be);return{test:c.ANOVA,statistic:Re,statisticName:"F",df:{between:Te,within:je},pValue:Ee,difference:null,interval:null,effectSize:{name:"etaSquared",label:A(He,m),value:He},summaries:ve}}function te(pe,ae){const ge=pe.length,ve=pe.map(w);if(ge<2)return null;const le=ve.reduce((We,qe)=>We+qe.n,0),we=[];for(let We=0;We<ge;We++)for(let qe=0;qe<pe[We].length;qe++)we.push({v:pe[We][qe],g:We});we.sort((We,qe)=>We.v-qe.v);const he=new Array(we.length);let be=0,Te=0;for(;Te<we.length;){let We=Te;for(;We<we.length&&we[We].v===we[Te].v;)We++;const qe=(Te+1+We)/2;for(let dt=Te;dt<We;dt++)he[dt]=qe;const et=We-Te;be+=et*et*et-et,Te=We}const je=new Array(ge).fill(0);for(let We=0;We<we.length;We++)je[we[We].g]+=he[We];let ke=0;for(let We=0;We<ge;We++)ke+=je[We]*je[We]/ve[We].n;ke=12/(le*(le+1))*ke-3*(le+1);const Ue=1-be/(le*le*le-le),Re=Ue>0?ke/Ue:ke,Ee=ge-1,He=Math.min(1,Math.max(0,t(Re,Ee))),Ke=(Re-ge+1)/(le-ge);return{test:c.KRUSKAL,statistic:Re,statisticName:"H",df:Ee,pValue:He,difference:null,interval:null,effectSize:{name:"etaSquared",label:A(Ke,m),value:Math.max(0,Ke)},summaries:ve}}function re(pe,ae,ge,ve,le){const we=j(pe,ae,le),he=j(ge,ve,le);if(!we||!he)return null;const be=we.proportion-he.proportion,Te=be-Math.sqrt((we.proportion-we.lower)**2+(he.upper-he.proportion)**2),je=be+Math.sqrt((we.upper-we.proportion)**2+(he.proportion-he.lower)**2);return{estimate:be,lower:Te,upper:je}}function ie(pe,ae,ge,ve){const le=U(ae),we=new Set,he=[];for(const qe of pe){const et=new Map;let dt=0;for(const lt of qe.rows){const vt=a(le(lt));vt!==null&&(et.set(vt,(et.get(vt)||0)+1),dt++,we.add(vt))}he.push(et),qe.total=dt}const be=[...we];if(be.length<2)return null;const Te=pe.reduce((qe,et)=>qe+et.total,0);if(!(Te>0))return null;let je=0;for(const qe of pe)for(const et of be){const dt=he[pe.indexOf(qe)].get(et)||0,lt=pe.reduce((Pt,$t)=>Pt+(he[pe.indexOf($t)].get(et)||0),0),vt=qe.total*lt/Te;vt>0&&(je+=(dt-vt)*(dt-vt)/vt)}const ke=pe.length,Ue=be.length,Re=(ke-1)*(Ue-1),Ee=Math.min(1,Math.max(0,t(je,Re))),He=M(je,Te,ke,Ue);let Ke=null;if(ke===2&&Ue===2){const[qe]=be,et=he[0].get(qe)||0,dt=he[1].get(qe)||0,lt=re(et,pe[0].total,dt,pe[1].total,ve);lt&&(Ke={...lt,confidence:ve,method:"newcombe (difference in this category's share)",category:qe})}const We=pe.map((qe,et)=>{const dt={};for(const lt of be)dt[String(lt)]=(he[et].get(lt)||0)/qe.total;return dt});return{test:c.CHI_SQUARE,statistic:je,statisticName:"chiSquare",df:Re,pValue:Ee,difference:null,interval:Ke,effectSize:{name:"cramersV",label:H("cramersV",He,Math.min(ke-1,Ue-1)),value:He},proportions:We}}function ue(pe,ae,ge,ve){const le=U(ae),we=new Set;for(const lt of pe)for(const vt of lt.rows){const Pt=a(le(vt));Pt!==null&&we.add(Pt)}if(we.size!==2)return null;const[he]=[...we],be=pe[0].rows.reduce((lt,vt)=>lt+(a(le(vt))===he?1:0),0),Te=pe[1].rows.reduce((lt,vt)=>lt+(a(le(vt))===he?1:0),0),je=pe[0].rows.length,ke=pe[1].rows.length;if(!(je>0)||!(ke>0))return null;const Ue=be/je,Re=Te/ke,Ee=(be+Te)/(je+ke);if(!(Ee>0)||!(Ee<1))return null;const He=Math.sqrt(Ee*(1-Ee)*(1/je+1/ke)),Ke=(Ue-Re)/He,We=Math.min(1,Math.max(0,2*g(-Math.abs(Ke)))),qe=Ue-Re,et=re(be,je,Te,ke,ve),dt=M(Ke*Ke,je+ke,2,2);return{test:c.PROPORTIONS,statistic:Ke,statisticName:"z",df:null,pValue:We,difference:qe,interval:et?{...et,confidence:ve,method:"newcombe (difference in proportions)",category:he}:null,effectSize:{name:"cramersV",label:H("cramersV",dt,1),value:dt},proportions:[{[String(he)]:Ue},{[String(he)]:Re}],focalCategory:he}}function Ae(pe,ae,ge,ve){if(ge&&d.has(ge))return{test:ge,reason:`caller override: ${ge}`};const le=I(pe),we=I(ae),he=le===null?null:Math.exp(-le/2),be=we===null?null:Math.exp(-we/2);if(he!==null&&he<i||be!==null&&be<i)return{test:c.MANN_WHITNEY,reason:"two numeric groups, non-normal by Jarque-Bera"};const Te=w(pe),je=w(ae);if(Te.n>=3&&je.n>=3&&Te.variance>0&&je.variance>0){const ke=Math.max(Te.variance,je.variance)/Math.min(Te.variance,je.variance),Ue=Te.variance>=je.variance?Te.n-1:je.n-1,Re=Te.variance>=je.variance?je.n-1:Te.n-1;if(2*Math.min(v(ke,Ue,Re),1-v(ke,Ue,Re))<ve)return{test:c.WELCH,reason:"two numeric groups, unequal variances (F-test)"}}return{test:c.T,reason:he!==null||be!==null?"two numeric groups, equal variances and no departure from normality":"two numeric groups (too few rows to screen normality)"}}function de(pe,ae){if(ae&&n.has(ae))return{test:ae,reason:`caller override: ${ae}`};for(const ge of pe){const ve=I(ge),le=ve===null?null:Math.exp(-ve/2);if(le!==null&&le<i)return{test:c.KRUSKAL,reason:"three or more numeric groups, non-normal by Jarque-Bera"}}return{test:c.ANOVA,reason:"three or more numeric groups, no departure from normality detected"}}function Oe(pe,ae,ge,ve={},le=null){if(!pe||!ae)return null;const we=b(ve.alpha),he=1-we,be=ve.test&&ve.test!=="auto"?String(ve.test):null,Te=h(ae,ge);if(Te.length<2)return E("compare:groups",'[lattice] statistics.compare: the "by" column has fewer than two distinct values to group by.'),null;let je;if(Array.isArray(ve.groups)&&ve.groups.length===2){const et=[a(ve.groups[0]),a(ve.groups[1])];if(et[0]===null||et[1]===null||et[0]===et[1])return E("compare:distinct","[lattice] statistics.compare: the two groups must be two distinct, present values."),null;if(je=Te.filter(dt=>dt.value===et[0]||dt.value===et[1]),je.length!==2)return E("compare:empty","[lattice] statistics.compare: one of the two groups has no rows in the current set."),null;je.sort((dt,lt)=>dt.value===et[0]?-1:1)}else Te.length===2||be&&d.has(be)||be&&p.has(be)?je=Te.slice(0,2):(be&&n.has(be),je=Te);const Ue=X(pe,ge),Re=!!ve.paired&&le&&je.length===2&&Ue;let Ee,He,Ke;if(Ue)if(je.length===2&&!(be&&n.has(be))){const et=J(pe,je[0].rows),dt=J(pe,je[1].rows);if(et.length<3||dt.length<3)return E("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;if(w(et).variance===0||w(dt).variance===0)return E("compare:zero-variance","[lattice] statistics.compare: a group has zero variance, so the difference has no scale to test."),null;if(Re){const vt=Fe(pe,le,je[0].rows,je[1].rows);return vt?(He=be?"override":"auto",Ke=be?`caller override: ${be} (paired)`:"two numeric groups, paired",Ee=be===c.MANN_WHITNEY?V(vt.diffs,we):x(vt.diffs,we),Ee?(Ee.paired=!0,Ee.chosenBy=He,Ee.reason=Ke,Ee.groups=[{value:je[0].value,label:String(je[0].value),n:vt.n},{value:je[1].value,label:String(je[1].value),n:vt.n}],Ee.alpha=we,Ee.method=Ee.test===c.MANN_WHITNEY?"Wilcoxon signed-rank test (paired)":"Student's paired t-test (difference of pairs)",Ee.verdict=C(Ee,ve),Ee.categorical=!1,Ee):(E("compare:degenerate","[lattice] statistics.compare: the paired test had too little to work with."),null)):(E("compare:paired","[lattice] statistics.compare: not enough matched pairs to run a paired test."),null)}const lt=Ae(et,dt,be,we);He=be?"override":"auto",Ke=lt.reason,lt.test===c.MANN_WHITNEY?Ee=$(et,dt,we):lt.test===c.WELCH?Ee=F(et,dt,we):Ee=Y(et,dt,we),Ee&&Ee.interval&&Ee.difference===null&&(Ee.difference=Ee.interval.estimate)}else{const et=je.map(lt=>J(pe,lt.rows));if(et.some(lt=>lt.length<3))return E("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;const dt=de(et,be);He=be?"override":"auto",Ke=dt.reason,Ee=dt.test===c.KRUSKAL?te(et,we):ee(et,we)}else if(je.length===2){const et=Me(pe,je).size===2;if(be===c.PROPORTIONS||et&&!be)He=be?"override":"auto",Ke=be?"caller override: proportions":"categorical measure with two categories (binary)",Ee=ue(je,pe,we,he);else if(be===c.CHI_SQUARE||!et&&!be)He=be?"override":"auto",Ke=be?"caller override: chiSquare":`categorical measure with ${Me(pe,je).size} categories`,Ee=ie(je,pe,we,he);else return E("compare:numeric-needed",`[lattice] statistics.compare: ${be} needs a numeric measure, but the column is categorical.`),null}else He=be?"override":"auto",Ke=be?`caller override: ${be}`:`categorical measure with ${Me(pe,je).size} categories`,Ee=ie(je,pe,we,he);if(!Ee)return E("compare:degenerate","[lattice] statistics.compare: the chosen test had too little to work with (too few values, or no variation)."),null;const We=Ee.summaries,qe=Ee.proportions;return{test:Ee.test,chosenBy:He,reason:Ke,statistic:Ee.statistic,statisticName:Ee.statisticName,df:Ee.df===void 0?null:Ee.df,pValue:Ee.pValue,alpha:we,paired:!1,interval:Ee.interval||null,effectSize:Ee.effectSize,groups:je.map((et,dt)=>({value:et.value,label:String(et.value),n:We?We[dt].n:et.total,...We?{mean:We[dt].mean,sd:We[dt].sd}:{},...qe?{proportions:qe[dt]}:{}})),difference:Ee.difference===void 0?null:Ee.difference,method:Ee.test,categorical:!Ue,verdict:je.length===2?C({...Ee,alpha:we,groups:[{value:je[0].value,label:String(je[0].value),mean:We?We[0].mean:void 0},{value:je[1].value,label:String(je[1].value),mean:We?We[1].mean:void 0}],categorical:!Ue,difference:Ee.difference===void 0?null:Ee.difference},ve):B({...Ee,alpha:we},ve)}}function Me(pe,ae){const ge=U(pe),ve=new Set;for(const le of ae)for(const we of le.rows){const he=a(ge(we));he!==null&&ve.add(he)}return ve}function Fe(pe,ae,ge,ve){const le=U(ae),we=U(pe),he=new Map;for(const Te of ve){const je=a(le(Te));je!==null&&he.set(je,we(Te))}const be=[];for(const Te of ge){const je=a(le(Te));if(je===null||!he.has(je))continue;const ke=Number(we(Te)),Ue=Number(he.get(je));!Number.isFinite(ke)||!Number.isFinite(Ue)||be.push(ke-Ue)}return be.length<2?null:{diffs:Float64Array.from(be),n:be.length}}}),ze("packages/core/src/columns/detailcolumn.js",function(e,_){"use strict";Object.defineProperty(e,"DETAIL_COLUMN_ID",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"createDetailColumn",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return U}});const ne="__lattice_detail",E=36;function K(D){const J=D.config&&D.config.detailColumnWidth||E;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:J,min:J,max:J,pin:D.config&&D.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(z,L){return!!(L&&L.expanded)},formatValue(){return""}}}const U=K}),ze("packages/core/src/columns/treecolumn.js",function(e,_){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createTreeColumn",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return J}});const E=_("packages/core/src/internal/predicates.js").isFunction,K="__lattice_tree",U=260;function D(z){const L=z.tree||{},X=z.config&&z.config.treeColumnWidth||U,I=!!(z.config&&z.config.treeColumnFlex),j=()=>(z.columns&&E(z.columns.visible)?z.columns.visible():[]).find(g=>!g.generated)||null,k=(l,g)=>{if(g&&g.group)return g.groupValue;if(E(L.label))return L.label(l,g);if(typeof L.label=="string")return l==null?null:l[L.label];const s=j();return s&&E(s.getValue)?s.getValue(l,g):null},y=()=>{if(L.title)return L.title;const l=typeof L.label=="string"?z.columns&&E(z.columns.get)?z.columns.get(L.label):null:j();return l&&(l.title||l.id)||"Hierarchy"};return{id:K,get title(){return y()},field:null,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group",props:{icon:L.icon,iconClass:L.iconClass,content:L.content,checkbox:L.checkbox,onCheck:L.onCheck}},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:I?{flex:1,min:0,pin:z.config&&z.config.treeColumnPin||null,hidden:!1,resizable:!1,movable:!1,lockPosition:!0}:{width:X,min:140,pin:z.config&&z.config.treeColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(l,g){return k(l,g)},formatValue(l,g){if(g&&g.grandTotal)return z.config&&z.config.grandTotalLabel||"Total";if(l==null)return"";if(!L.label){const s=j();if(s&&E(s.formatValue))return s.formatValue(l,g)}return String(l)}}}const J=D}),ze("packages/core/src/columns/pivotcolumns.js",function(e,_){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return D}});const E=_("packages/core/src/internal/warn.js").warnOnce,K="__lattice_pivot",U=500;function D(X){const{pivot:I,valueColumns:j,config:k}=X,y=I&&I.paths||[],l=X.separator||k&&k.pivot&&k.pivot.separator||" | ",g=k&&k.pivot&&k.pivot.maxColumns||U;if(!y.length||!j.length)return{tree:[],leaves:[],error:null};const s=J(k),t=y.length*j.length+(s?j.length:0);if(t>g){const d=`pivot would generate ${t} columns, above the limit of ${g}. Pivot on a lower-cardinality column, or raise pivot.maxColumns.`;return E(`pivot.maxColumns:${t}`,d),{tree:[],leaves:[],error:d}}const o=[],c=[];for(const d of y){const n=[];for(const p of j){const i=L(d,p,l);n.push(i),c.push(i)}n.length===1?(n[0].title=String(d),o.push(n[0])):o.push({id:`${K}:group:${d}`,title:String(d),columns:n,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(s){const d=j.map(p=>z(p,k));c.push(...d);const n=k&&k.pivot&&k.pivot.totalsLabel||"Total";if(d.length===1)d[0].title=n,s==="before"?o.unshift(d[0]):o.push(d[0]);else{const p={id:`${K}:group:__totals`,title:n,columns:d,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};s==="before"?o.unshift(p):o.push(p)}}return{tree:o,leaves:c,error:null}}function J(X){const I=X&&X.pivot&&X.pivot.groupTotals;return I==="before"||I==="after"?I:null}function z(X,I){return{id:`${K}:__total${I&&I.pivot&&I.pivot.separator||" | "}${X.id}`,field:null,title:X.title||X.id,type:X.type,dataType:X.dataType,nullable:!0,align:X.align,generated:!0,pivot:{enabled:!1,index:0,sourceId:X.id,total:!0},value:{pure:!0},cell:{align:X.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:X.total,lookup:null,layout:{width:X.layout&&X.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(j,k){const y=k&&k.totals;return y&&Object.hasOwn(y,X.id)?y[X.id]:null},formatValue(j,k){return j==null?"":X.formatValue?X.formatValue(j,k):String(j)}}}function L(X,I,j){return{id:`${K}:${X}${j}${I.id}`,field:null,title:I.title||I.id,type:I.type,dataType:I.dataType,nullable:!0,align:I.align,generated:!0,pivot:{enabled:!1,index:0,path:X,sourceId:I.id},value:{pure:!0},cell:{align:I.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:I.total,lookup:null,layout:{width:I.layout&&I.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(){return null},formatValue(k,y){return k==null?"":I.formatValue?I.formatValue(k,y):String(k)}}}}),ze("packages/core/src/compute/group.js",function(e,_){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return k}});const ne=_("packages/core/src/compute/handle.js"),E=ne.dictSize,K=ne.identity,U=ne.presenceReader,D=ne.rowCount,J=ne.valueReader,z="",L="\0",X=1<<20;function I(y,l,g,s){const t=y.length,o=y.map(r=>J(r)),c=Array.isArray(s)&&s.some(Boolean),d=c?o.map((r,f)=>s[f]?m=>s[f](r(m)):r):o;if(!c&&t>0&&y.every(r=>r&&r.kind==="dictionary"&&r.dict)){const r=y.map(m=>E(m.dict)+1);let f=1;for(let m=0;m<t;m++)f*=r[m];if(f<=Number.MAX_SAFE_INTEGER){const m=y.map(h=>h.values),u=y.map(h=>U(h)),b=h=>{let w=0;for(let v=0;v<t;v++){const A=u[v],H=A&&A(h)===0?r[v]-1:m[v][h];w=w*r[v]+H}return w},a=new Float64Array(g);for(let h=0;h<g;h++)a[h]=b(l[h]);return{packed:a,strings:null,product:f,readers:d,keyOf:b}}}const p=r=>{let f="";for(let m=0;m<t;m++){const u=d[m](r);f+=(m===0?"":z)+(u==null?L:String(u))}return f},i=new Array(g);for(let r=0;r<g;r++)i[r]=p(l[r]);return{packed:null,strings:i,product:1/0,readers:d,keyOf:p}}function j(y,l,g,s){const t=new Uint32Array(s+1);for(let n=0;n<g;n++)t[l[n]+1]++;for(let n=0;n<s;n++)t[n+1]+=t[n];const o=new Uint32Array(g),c=t.slice(0,s);for(let n=0;n<g;n++)o[c[l[n]]++]=y[n];const d=new Array(s);for(let n=0;n<s;n++)d[n]=o.subarray(t[n],t[n+1]);return d}function k(y,l,g={}){const s=y||[],t=l||K(D(s[0],g)),o=t.length;if(s.length===0||o===0)return{keys:[],buckets:[]};const{packed:c,strings:d,product:n,readers:p}=I(s,t,o,g.project),i=new Uint32Array(o);let r=0,f=null;if(c&&n<=Math.max(1024,Math.min(X,o*4))){const a=n,h=new Int32Array(a).fill(-1);for(let w=0;w<o;w++)h[c[w]]=0;for(let w=0;w<a;w++)h[w]===0&&(h[w]=r++);for(let w=0;w<o;w++)i[w]=h[c[w]];f=new Float64Array(r);for(let w=0;w<a;w++)h[w]>=0&&(f[h[w]]=w)}else if(c){const a=new Map;for(let h=0;h<o;h++){const w=c[h];let v=a.get(w);v===void 0&&(v=r++,a.set(w,v)),i[h]=v}f=new Float64Array(r);for(const[h,w]of a)f[w]=h}else{const a=new Map;for(let h=0;h<o;h++){const w=d[h];let v=a.get(w);v===void 0&&(v=r++,a.set(w,v)),i[h]=v}}const m=j(t,i,o,r),u=new Array(r);for(let a=0;a<r;a++){const h=m[a][0],w=new Array(p.length);for(let v=0;v<p.length;v++)w[v]=p[v](h);u[a]=w}const b={keys:u,buckets:m};return f&&(b.packed=f),b}}),ze("packages/core/src/compute/pivot.js",function(e,_){"use strict";Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return o}});const E=_("packages/core/src/internal/warn.js").warnOnce,U=_("packages/core/src/compute/handle.js").valueComparator,J=_("packages/core/src/compute/group.js").packKeys,L=_("packages/core/src/compute/total.js").total,X="|",I="/",j=2e3;function k(n,p,i){return`${n}${X}${p}${X}${i}`}function y(n,p){let i="";for(let r=0;r<n.length;r++){const f=n[r];i+=(r===0?"":p)+(f==null?"":String(f))}return i}function l(n,p,i={}){const r=i.separator||I,f=p.length,{keyOf:m,readers:u}=J(n,p,0),b=new Map,a=[],h=[];for(let M=0;M<f;M++){const S=p[M],T=m(S);if(b.has(T))continue;b.set(T,a.length),h.push(T);const O=new Array(u.length);for(let N=0;N<u.length;N++)O[N]=u[N](S);a.push(O)}const w=U(i.locale),v=a.map((M,S)=>S);v.sort((M,S)=>{const T=a[M],O=a[S];for(let N=0;N<T.length;N++){const P=g(T[N],O[N],w);if(P!==0)return P}return M-S});const A=new Array(v.length),H=new Array(v.length),G=new Map;for(let M=0;M<v.length;M++){const S=v[M];A[M]=a[S],H[M]=y(a[S],r),G.set(h[S],M)}return{keys:A,paths:H,idOf:M=>{const S=G.get(m(M));return S===void 0?-1:S}}}function g(n,p,i){const r=n==null,f=p==null;return r||f?r&&f?0:r?1:-1:i(n,p)}function s(n){const p=n.values||n.totals||[];if(p.length&&typeof p[0]=="object"&&p[0]!==null)return p.filter(m=>m&&m.handle);const i=typeof n.handle=="function"?n.handle:null;if(!i)return p.length&&E("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 r=typeof n.totalOf=="function"?n.totalOf:null,f=[];for(const m of p){const u=i(m);u&&f.push({colId:m,handle:u,fn:r?r(m):"sum"})}return f}function t(n,p,i){if(Array.isArray(n)){const r=i||{};return{...r,pivotHandles:n,order:p||null,groups:r.groups||null}}return n||{}}function o(n,p,i){const r=t(n,p,i),f=r.separator||I,m=s(r),u=r.maxColumns===void 0?j:r.maxColumns,b=r.groups&&r.groups.buckets?r.groups:null,a=b?b.buckets:[r.order||new Uint32Array(0)],h=r.groupPaths||(b?b.keys.map(T=>y(T,f)):[""]),w=d(a),{keys:v,paths:A,idOf:H}=l(r.pivotHandles||[],w,r),G=A.length*Math.max(1,m.length),Z=c(A,m,f);if(u&&G>u){const T=new Map;return{keys:v,paths:A,fields:Z,groupPaths:h,columns:G,values:T,cells:T,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${G} columns, above pivot.maxColumns of ${u}. Narrow the pivot columns or raise the limit.`,columns:G,maxColumns:u}}}const M=new Map,S=A.length;for(let T=0;T<a.length;T++){const O=a[T],N=h[T]===void 0?"":h[T],P=O.length;if(P===0)continue;const C=new Int32Array(P),B=new Uint32Array(S+1);for(let Y=0;Y<P;Y++){const F=H(O[Y]);C[Y]=F,F>=0&&B[F+1]++}for(let Y=0;Y<S;Y++)B[Y+1]+=B[Y];const x=new Uint32Array(P),V=B.slice(0,S);for(let Y=0;Y<P;Y++){const F=C[Y];F>=0&&(x[V[F]++]=O[Y])}for(let Y=0;Y<S;Y++){const F=B[Y],$=B[Y+1];if($===F)continue;const q=x.subarray(F,$);for(let ee=0;ee<m.length;ee++){const te=m[ee],re=L(te.handle,q,te.fn,r.totalContext||{locale:r.locale});M.set(k(N,A[Y],te.colId),re)}}}return{keys:v,paths:A,fields:Z,groupPaths:h,columns:G,values:M,cells:M,error:null}}function c(n,p,i){if(p.length===0)return n.slice();const r=[];for(const f of n)for(const m of p)r.push(`${f}${i}${m.colId}`);return r}function d(n){if(n.length===1)return n[0]||new Uint32Array(0);let p=0;for(const f of n)p+=f?f.length:0;const i=new Uint32Array(p);let r=0;for(const f of n)!f||f.length===0||(i.set(f,r),r+=f.length);return i}}),ze("packages/core/src/compute/explain.js",function(e,_){"use strict";Object.defineProperty(e,"explainContributors",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"explainChange",{enumerable:!0,get:function(){return k}});const E=_("packages/core/src/compute/total.js").total,U=_("packages/core/src/compute/group.js").groupByColumns,D=new Set(["sum","count","countValues"]),J=new Set(["min","max"]),z=new Set(["avg"]);function L(y){return typeof y=="string"?y:typeof y=="function"&&y.totalName?y.totalName:null}function X(y,l,g,s){return E(y,l,g,s||{})}function I(y,l){if(l)try{return l(y)}catch{}return y==null?"":String(y)}function j(y){const{handle:l,fn:g,leaves:s,by:t,labelOf:o,rowLabel:c}=y,d={locale:y.locale},n=s&&s.length?s:[],p=L(g),i=X(l,n,g,d),r=J.has(p);let f;if(r){let b=-1;for(let a=0;a<n.length;a++){const h=X(l,[n[a]],g,d);if(Object.is(h,i)){b=n[a];break}}f=b<0?[]:[{key:b,indices:[b],label:c?c(b):String(b)}]}else if(t){const b=U([t],n);f=b.keys.map((a,h)=>({key:a[0],indices:b.buckets[h],label:I(a[0],o)}))}else f=Array.from({length:n.length},(b,a)=>{const h=n[a];return{key:h,indices:[h],label:c?c(h):String(h)}});const m=n.length,u=[];for(const b of f){const a=X(l,b.indices,g,d),h=b.indices.length;let w,v;if(p==="avg")w=((typeof a=="number"?a:0)-(typeof i=="number"?i:0))*h,v=m?h/m:0;else if(r)w=typeof a=="number"?a:0,v=1;else{w=typeof a=="number"?a:0;const A=typeof i=="number"?i:0;v=A?w/A:0}u.push({key:b.key,label:b.label,count:h,value:a,contribution:w,share:v})}return u.sort((b,a)=>Math.abs(a.contribution)-Math.abs(b.contribution)||(b.label<a.label?-1:b.label>a.label?1:0)),{total:i,fn:p,weighted:z.has(p),single:r,contributors:u}}function k(y){const l=j({...y,leaves:y.after}),g=j({...y,leaves:y.before}),s=typeof l.total=="number"?l.total:0,t=typeof g.total=="number"?g.total:0,o=new Map;for(const n of l.contributors)o.set(n.key,n);const c=[],d=new Set;for(const n of g.contributors){d.add(n.key);const p=o.get(n.key);if(p===void 0)c.push({key:n.key,label:n.label,before:n.value,after:null,effect:-n.contribution,kind:"dropped",count:n.count});else{const i=p.contribution-n.contribution;i!==0&&c.push({key:n.key,label:n.label,before:n.value,after:p.value,effect:i,kind:"changed",count:p.count})}}for(const n of l.contributors)d.has(n.key)||c.push({key:n.key,label:n.label,before:null,after:n.value,effect:n.contribution,kind:"new",count:n.count});return c.sort((n,p)=>Math.abs(p.effect)-Math.abs(n.effect)||(n.label<p.label?-1:n.label>p.label?1:0)),{before:g.total,after:l.total,delta:s-t,weighted:l.weighted||g.weighted,single:l.single||g.single,drivers:c}}}),ze("packages/core/src/store/bitset.js",function(e,_){"use strict";Object.defineProperty(e,"Bitset",{enumerable:!0,get:function(){return E}});const ne=8;class E{static#e=new Uint8Array(256);static{for(let U=1;U<256;U++)E.#e[U]=E.#e[U>>1]+(U&1)}#t;#n;constructor(U=0){const D=Math.max(0,U|0);this.#n=D,this.#t=new Uint8Array(Math.ceil(D/ne))}get size(){return this.#n}get words(){return this.#t}get bytes(){return this.#t?this.#t.byteLength:0}get(U){return U<0||U>=this.#n?0:this.#t[U>>3]>>(U&7)&1}set(U){return U>=0&&U<this.#n&&(this.#t[U>>3]|=1<<(U&7)),this}clear(U){return U>=0&&U<this.#n&&(this.#t[U>>3]&=~(1<<(U&7))),this}assign(U,D){return D?this.set(U):this.clear(U)}fill(U=!1){return this.#t.fill(U?255:0),U&&this.#r(),this}grow(U){const D=Math.max(0,U|0);if(D<=this.#n)return this;const J=Math.ceil(D/ne);if(J>this.#t.length){const z=new Uint8Array(J);z.set(this.#t),this.#t=z}return this.#n=D,this}count(){const U=this.#t,D=E.#e;let J=0;for(let z=0;z<U.length;z++)J+=D[U[z]];return J}and(U){const D=U instanceof E?U.words:U,J=this.#t,z=Math.min(J.length,D.length);for(let L=0;L<z;L++)J[L]&=D[L];for(let L=z;L<J.length;L++)J[L]=0;return this}or(U){const D=U instanceof E?U.words:U,J=this.#t,z=Math.min(J.length,D.length);for(let L=0;L<z;L++)J[L]|=D[L];return this}not(){const U=this.#t;for(let D=0;D<U.length;D++)U[D]=~U[D]&255;return this.#r(),this}clone(){const U=new E(this.#n);return U.words.set(this.#t.subarray(0,U.words.length)),U}release(){this.#t=new Uint8Array(0),this.#n=0}#r(){const U=this.#n&7;if(U===0)return;const D=this.#n>>3;D<this.#t.length&&(this.#t[D]&=(1<<U)-1)}static from(U){const D=Array.isArray(U)?U:Array.from(U),J=new E(D.length);for(let z=0;z<D.length;z++)D[z]&&J.set(z);return J}}}),ze("packages/core/src/store/dictionary.js",function(e,_){"use strict";Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return U}});const ne=_("packages/core/src/internal/compare.js"),E=ne.collator,K=ne.defaultCompare;class U{#e;#t=new Map;#n=0;#r=null;#s=-1;#i="\0";constructor(J=[]){this.#e=[];for(let z=0;z<J.length;z++){const L=J[z];this.#t.has(L)||(this.#t.set(L,this.#e.length),this.#e.push(L))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let J=this.#e.length*8;for(let z=0;z<this.#e.length;z++){const L=this.#e[z];typeof L=="string"&&(J+=L.length*2),J+=16}return J}codeOf(J){const z=this.#t.get(J);if(z!==void 0)return z;const L=this.#e.length;return this.#e.push(J),this.#t.set(J,L),this.#n++,L}lookup(J){const z=this.#t.get(J);return z===void 0?-1:z}has(J){return this.#t.has(J)}valueOf(J){return this.#e[J]}values(){return this.#e}ranks(J){const z=J||"";if(this.#r&&this.#s===this.#n&&this.#i===z)return this.#r;const L=this.#e.length,X=new Array(L);for(let y=0;y<L;y++)X[y]=y;const I=E(J).compare,j=this.#e;X.sort((y,l)=>this.#o(j[y],j[l],I));const k=new Uint32Array(L);for(let y=0;y<L;y++)k[X[y]]=y;return this.#r=k,this.#s=this.#n,this.#i=z,k}#o(J,z,L){return typeof J=="string"&&typeof z=="string"?L(J,z):K(J,z)}}}),ze("packages/core/src/store/multivalue.js",function(e,_){"use strict";Object.defineProperty(e,"MultiValue",{enumerable:!0,get:function(){return ne}});class ne{#e;#t;#n=0;#r=0;constructor(K={}){const U=Math.max(1,K.rows??16),D=Math.max(1,K.values??U);this.#e=new Int32Array(D),this.#t=new Uint32Array(U+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(K){return K<0||K>=this.#n?0:this.#t[K+1]-this.#t[K]}at(K){return K<0||K>=this.#n?this.#e.subarray(0,0):this.#e.subarray(this.#t[K],this.#t[K+1])}has(K,U){if(K<0||K>=this.#n)return!1;const D=this.#e,J=this.#t[K+1];for(let z=this.#t[K];z<J;z++)if(D[z]===U)return!0;return!1}hasAny(K,U){for(let D=0;D<U.length;D++)if(this.has(K,U[D]))return!0;return!1}hasAll(K,U){for(let D=0;D<U.length;D++)if(!this.has(K,U[D]))return!1;return!0}hasNone(K,U){return!this.hasAny(K,U)}push(K){const U=this.#n,D=K.length;this.#s(U+1),this.#i(this.#r+D);const J=this.#r;for(let z=0;z<D;z++)this.#e[J+z]=K[z]|0;return this.#r+=D,this.#n=U+1,this.#t[U]=J,this.#t[U+1]=this.#r,U}write(K,U){if(K===this.#n){this.push(U);return}if(K<0||K>this.#n)return;const D=this.#t[K],J=this.#t[K+1],z=U.length;if(J-D===z){for(let L=0;L<z;L++)this.#e[D+L]=U[L]|0;return}this.#o(K,U)}compact(K,U,D){const J=this.#e,z=this.#t,L=this.#n,X=new Int32Array(Math.max(1,this.#r)),I=new Uint32Array(U+1);let j=0;for(let k=0;k<L;k++){if(K[k]===D)continue;const y=z[k],l=z[k+1];I[K[k]]=j;for(let g=y;g<l;g++)X[j++]=J[g];I[K[k]+1]=j}this.#e=X,this.#t=I,this.#n=U,this.#r=j}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#s(K){if(K+1<=this.#t.length)return;let U=this.#t.length-1;for(;U<K;)U=U*2||16;const D=new Uint32Array(U+1);D.set(this.#t),this.#t=D}#i(K){if(K<=this.#e.length)return;let U=this.#e.length;for(;U<K;)U=U*2||16;const D=new Int32Array(U);D.set(this.#e),this.#e=D}#o(K,U){const D=this.#e,J=this.#t,z=this.#n,L=U.length-(J[K+1]-J[K]),X=new Int32Array(Math.max(1,this.#r+L)),I=new Uint32Array(J.length);let j=0;for(let k=0;k<z;k++){if(I[k]=j,k===K)for(let y=0;y<U.length;y++)X[j++]=U[y]|0;else for(let y=J[k];y<J[k+1];y++)X[j++]=D[y];I[k+1]=j}this.#e=X,this.#t=I,this.#r=j}}}),ze("packages/core/src/compute/sort.js",function(e,_){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return S}});const ne=_("packages/core/src/compute/handle.js"),E=ne.bitReader,K=ne.dictRanks,U=ne.dictSize,D=ne.identity,J=ne.isMissing,z=ne.presenceReader,L=ne.rowCount,X=ne.valueComparator,I=ne.valueReader,j=new Uint32Array(0),k=new ArrayBuffer(8),y=new Float64Array(k),l=new Uint32Array(k),g=(y[0]=-1,(l[1]&2147483648)!==0?1:0),s=g===1?0:1;function t(O,N){y[0]=O;let P=l[g],C=l[s];(P&2147483648)!==0?(P=~P>>>0,C=~C>>>0):P=(P^2147483648)>>>0,N[0]=C,N[1]=P}function o(O,N,P,C){if(C<2)return O;const B=new Uint32Array(256*8);for(let te=0;te<C;te++){const re=N[te],ie=P[te];B[re&255]++,B[256+(re>>>8&255)]++,B[512+(re>>>16&255)]++,B[768+(re>>>24&255)]++,B[1024+(ie&255)]++,B[1280+(ie>>>8&255)]++,B[1536+(ie>>>16&255)]++,B[1792+(ie>>>24&255)]++}let x=O,V=N,Y=P,F=new Uint32Array(C),$=new Uint32Array(C),q=new Uint32Array(C);const ee=new Uint32Array(256);for(let te=0;te<8;te++){const re=te<<8,ie=(te&3)<<3,ue=te>=4;let Ae=!1;for(let Me=0;Me<256;Me++)if(B[re+Me]===C){Ae=!0;break}if(Ae)continue;let de=0;for(let Me=0;Me<256;Me++)ee[Me]=de,de+=B[re+Me];for(let Me=0;Me<C;Me++){const Fe=V[Me],pe=Y[Me],ae=(ue?pe:Fe)>>>ie&255,ge=ee[ae]++;F[ge]=x[Me],$[ge]=Fe,q[ge]=pe}let Oe=x;x=F,F=Oe,Oe=V,V=$,$=Oe,Oe=Y,Y=q,q=Oe}return x}function c(O,N,P){if(P<2)return O;const C=new Uint32Array(256*4);for(let $=0;$<P;$++){const q=N[$];C[q&255]++,C[256+(q>>>8&255)]++,C[512+(q>>>16&255)]++,C[768+(q>>>24&255)]++}let B=O,x=N,V=new Uint32Array(P),Y=new Uint32Array(P);const F=new Uint32Array(256);for(let $=0;$<4;$++){const q=$<<8,ee=$<<3;let te=!1;for(let ue=0;ue<256;ue++)if(C[q+ue]===P){te=!0;break}if(te)continue;let re=0;for(let ue=0;ue<256;ue++)F[ue]=re,re+=C[q+ue];for(let ue=0;ue<P;ue++){const Ae=x[ue],de=F[Ae>>>ee&255]++;V[de]=B[ue],Y[de]=Ae}let ie=B;B=V,V=ie,ie=x,x=Y,Y=ie}return B}function d(O,N,P,C){const B=new Uint32Array(C+1);for(let Y=0;Y<P;Y++)B[N[Y]]++;let x=0;for(let Y=0;Y<=C;Y++){const F=B[Y];B[Y]=x,x+=F}const V=new Uint32Array(P);for(let Y=0;Y<P;Y++)V[B[N[Y]]++]=O[Y];return V}function n(O,N,P,C){return P<2?O:C<=65536||C<=P*2?d(O,N,P,C):c(O,N,P)}function p(O,N){return O.length===N&&O.byteOffset===0?O:Uint32Array.prototype.slice.call(O,0,N)}function i(O,N,P=!1){const C=N||D(O.length),B=C.length;if(B<2)return Uint32Array.from(C);const x=new Uint32Array(B),V=new Uint32Array(B),Y=new Uint32Array(B),F=new Uint32Array(B),$=new Uint32Array(2);let q=0,ee=0;for(let ie=0;ie<B;ie++){const ue=C[ie],Ae=O[ue];if(Number.isNaN(Ae)){F[ee++]=ue;continue}t(Ae,$),P?(V[q]=~$[0]>>>0,Y[q]=~$[1]>>>0):(V[q]=$[0],Y[q]=$[1]),x[q++]=ue}const te=o(x.subarray(0,q),V.subarray(0,q),Y.subarray(0,q),q);if(ee===0)return p(te,q);const re=new Uint32Array(B);return re.set(te.subarray(0,q),0),re.set(F.subarray(0,ee),q),re}function r(O,N,P=!1){const C=N||D(O.length),B=C.length;if(B<2)return Uint32Array.from(C);const x=Uint32Array.from(C),V=new Uint32Array(B);for(let Y=0;Y<B;Y++){const F=(O[x[Y]]^2147483648)>>>0;V[Y]=P?~F>>>0:F}return p(c(x,V,B),B)}function f(O,N,P={}){const C=N||D(L(O,P)),B=C.length;if(B<2)return Uint32Array.from(C);const x=K(O.dict,P.locale),V=O.values,Y=z(O),F=Math.max(U(O.dict),x.length),$=F,q=Uint32Array.from(C),ee=new Uint32Array(B),te=!!P.descending;for(let re=0;re<B;re++){const ie=q[re];let ue=Y&&Y(ie)===0?$:x[V[ie]];ue===void 0&&(ue=$),ee[re]=te?$-ue:ue}return p(n(q,ee,B,F+1),B)}function m(O,N,P){const C=N.length;let B=Uint32Array.from(N);if(C<2)return B;let x=new Uint32Array(C);for(let V=1;V<C;V<<=1){for(let F=0;F<C;F+=V<<1){const $=Math.min(F+V,C),q=Math.min(F+(V<<1),C);let ee=F,te=$,re=F;for(;ee<$&&te<q;)x[re++]=P(O[B[ee]],O[B[te]])<=0?B[ee++]:B[te++];for(;ee<$;)x[re++]=B[ee++];for(;te<q;)x[re++]=B[te++]}const Y=B;B=x,x=Y}return B}function u(O,N,P){const C=E(O.values),B=N.length,x=new Uint32Array(B),V=P?1:0;let Y=0;for(let F=0;F<B;F++)C(N[F])===V&&(x[Y++]=N[F]);for(let F=0;F<B;F++)C(N[F])!==V&&(x[Y++]=N[F]);return x}function b(O,N){const P=O.values,C=O.kind;if((C==="object"||C===void 0)&&(Array.isArray(P)||ArrayBuffer.isView(P))&&!O.presence)return P;const x=I(O),V=new Array(L(O)||0);for(let Y=0;Y<N.length;Y++){const F=N[Y];V[F]=x(F)}return V}function a(O,N){for(let P=0;P<N.length;P++)if(typeof O[N[P]]!="string")return!1;return!0}function h(O,N,P,C,B){const x=O.length,V=Uint32Array.from(O);if(x<2||C<1)return V;const Y=new Uint32Array(x),F=C-1;for(let $=0;$<x;$++){const q=P[N[$]];Y[$]=B?F-q:q}return p(n(V,Y,x,C),x)}function w(O,N,P){const C=X(P),B=new Array(N);for(let V=0;V<N;V++)B[V]=V;B.sort((V,Y)=>C(O[V],O[Y])||V-Y);const x=new Uint32Array(N);for(let V=0;V<N;V++)x[B[V]]=V;return x}function v(O,N,P){const C=N.length,B=new Map,x=[],V=new Uint32Array(C);for(let $=0;$<C;$++){const q=O[N[$]];let ee=B.get(q);ee===void 0&&(ee=x.length,B.set(q,ee),x.push(q)),V[$]=ee}const Y=x.length,F=w(x,Y,P.locale);return h(N,V,F,Y,!!P.descending)}function A(O,N,P){const C=b(O,N);if(N.length>=2&&a(C,N)){const V=O.stringRank;return V&&V.version===O.version&&V.usable(N,C,P.locale)?V.sort(N,P):v(C,N,P)}const B=X(P.locale),x=P.descending?(V,Y)=>B(Y,V):B;return m(C,N,x)}function H(O,N,P){const C=b(O,N),B=P.compare,V=!!P.descending?(Y,F)=>-B(Y,F,void 0,void 0,!0):(Y,F)=>B(Y,F,void 0,void 0,!1);return m(C,N,V)}function G(O,N){const P=N.length,C=z(O),B=O.values,x=O.kind==="float64"&&!!B,V=O.kind==="object"||O.kind==="multi"||O.kind===void 0;if(!C&&!x&&!V)return{present:N,absent:j};const Y=new Uint32Array(P),F=new Uint32Array(P);let $=0,q=0;if(C&&x)for(let ee=0;ee<P;ee++){const te=N[ee];C(te)===1&&!Number.isNaN(B[te])?Y[$++]=te:F[q++]=te}else if(x&&!C)for(let ee=0;ee<P;ee++){const te=N[ee];Number.isNaN(B[te])?F[q++]=te:Y[$++]=te}else if(C&&!V)for(let ee=0;ee<P;ee++){const te=N[ee];C(te)===1?Y[$++]=te:F[q++]=te}else{const ee=I(O);for(let te=0;te<P;te++){const re=N[te];J(ee(re))?F[q++]=re:Y[$++]=re}}return q===0?{present:N,absent:j}:{present:Y.subarray(0,$),absent:F.subarray(0,q)}}function Z(O,N,P){if(N.length===0)return O;const C=new Uint32Array(O.length+N.length);return P?(C.set(N,0),C.set(O,N.length)):(C.set(O,0),C.set(N,O.length)),C}function M(O,N,P={}){const C=N||D(L(O,P));if(!O||C.length<2)return Uint32Array.from(C);const{present:B,absent:x}=G(O,C);if(B.length===0)return Uint32Array.from(C);const V=!!P.descending;let Y;if(typeof P.compare=="function")Y=H(O,B,P);else switch(O.kind){case"float64":Y=i(O.values,B,V);break;case"int32":Y=r(O.values,B,V);break;case"dictionary":Y=f(O,B,P);break;case"bitset":Y=u(O,B,V);break;default:Y=A(O,B,P);break}return Z(Y,x,!!P.nullsFirst)}function S(O,N,P,C={}){const B=N||[],x=B.length&&(B[0].handle||T(O,B[0].col))||O&&O[0];let V=P||D(L(x,C));for(let Y=B.length-1;Y>=0;Y--){const F=B[Y],$=F.handle||T(O,F.col)||O&&O[Y];$&&(V=M($,V,{descending:F.descending!==void 0?!!F.descending:F.dir==="desc",nullsFirst:!!F.nullsFirst,locale:F.locale!==void 0?F.locale:C.locale,compare:F.compare}))}return V instanceof Uint32Array?V:Uint32Array.from(V)}function T(O,N){if(!(!O||N===void 0)){for(let P=0;P<O.length;P++)if(O[P]&&O[P].id===N)return O[P]}}}),ze("packages/core/src/store/stringrank.js",function(e,_){"use strict";Object.defineProperty(e,"DEFAULT_MAX_DISTINCT",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"StringRankIndex",{enumerable:!0,get:function(){return D}});const ne=_("packages/core/src/compute/sort.js"),E=ne.collateStringRanks,K=ne.rankSortStrings,U=1e5;class D{#e=[];#t=new Map;#n;#r=0;#s=0;#i=-1;#o;#l=!1;#a=null;#c=-1;#u="\0";constructor(z=U){this.#o=z>0?z:U,this.#n=new Uint32Array(0)}get version(){return this.#i}set version(z){this.#i=z}get generation(){return this.#s}get size(){return this.#e.length}get capped(){return this.#l}get length(){return this.#r}get bytes(){let z=this.#n.byteLength;const L=this.#e;for(let X=0;X<L.length;X++)z+=L[X].length*2+24;return z}#d(z,L){const X=this.#t.get(z);if(X!==void 0)return X;if(this.#l)return-1;if(L&&this.#e.length>=this.#o)return this.#l=!0,-1;const I=this.#e.length;return this.#e.push(z),this.#t.set(z,I),this.#s++,I}build(z,L){const X=L|0;this.#e=[],this.#t=new Map,this.#s=0,this.#l=!1,this.#a=null,this.#c=-1,this.#n=new Uint32Array(X);for(let I=0;I<X;I++){const j=z[I],k=typeof j=="string"?this.#d(j,!1):-1;this.#n[I]=k<0?0:k}this.#r=X}append(z,L,X){const I=(L|0)+(X|0);if(I>this.#n.length){const j=new Uint32Array(I);j.set(this.#n.subarray(0,this.#r)),this.#n=j}for(let j=L|0;j<I;j++){const k=z[j],y=typeof k=="string"?this.#d(k,!0):-1;this.#n[j]=y<0?0:y}this.#r=Math.max(this.#r,I)}ranks(z){const L=z||"";if(this.#a&&this.#c===this.#s&&this.#u===L)return this.#a;const X=E(this.#e,this.#e.length,z);return this.#a=X,this.#c=this.#s,this.#u=L,X}usable(z,L,X){if(this.#l||this.#e.length===0)return!1;const I=this.#n,j=this.#e,k=this.#r;for(let y=0;y<z.length;y++){const l=z[y];if(l>=k||j[I[l]]!==L[l])return!1}return!0}sort(z,L){const X=this.ranks(L.locale),I=this.#e.length,j=z.length,k=new Uint32Array(j),y=this.#n;for(let l=0;l<j;l++)k[l]=y[z[l]];return K(z,k,X,I,!!L.descending)}}}),ze("packages/core/src/store/columnstore.js",function(e,_){"use strict";Object.defineProperty(e,"REMOVED",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"toFloat",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ColumnHandle",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"ColumnStore",{enumerable:!0,get:function(){return u}});const E=_("packages/core/src/internal/warn.js").warnOnce,U=_("packages/core/src/internal/predicates.js").isFunction,J=_("packages/core/src/internal/paths.js").pathGetter,L=_("packages/core/src/store/bitset.js").Bitset,I=_("packages/core/src/store/dictionary.js").Dictionary,k=_("packages/core/src/store/multivalue.js").MultiValue,l=_("packages/core/src/store/stringrank.js").StringRankIndex,g=4294967295,s=1024,t=5e3,o=.2,c=new Set(["float64","int32","bitset","dictionary","object","multi"]);function d(b){return b==null}function n(b){if(typeof b=="number")return b;if(b instanceof Date)return b.getTime();if(typeof b=="boolean")return b?1:0;const a=Number(b);return Number.isNaN(a)&&typeof b=="string"?Date.parse(b):a}function p(b){const a=n(b);return Number.isFinite(a)?a|0:0}function i(b){return d(b)?[]:Array.isArray(b)?b:[b]}function r(b,a){switch(b.kind){case"float64":case"int32":return b.buf[a];case"bitset":return b.bits.get(a)===1;case"dictionary":return b.dict.valueOf(b.buf[a]);case"multi":{const h=b.mv.at(a),w=new Array(h.length);for(let v=0;v<h.length;v++)w[v]=b.dict.valueOf(h[v]);return w}default:return b.buf[a]}}function f(b,a){switch(b.kind){case"float64":case"int32":return b.values[a];case"bitset":return(b.values[a>>3]&1<<(a&7))!==0;case"dictionary":return(b.table||[])[b.values[a]];case"multi":{const h=b.offsets[a],w=b.offsets[a+1],v=b.table||[],A=new Array(w-h);for(let H=h;H<w;H++)A[H-h]=v[b.values[H]];return A}default:return b.values[a]}}class m{#e;#t;#n;#r;#s;#i;#o;#l=!1;#a=null;#c=null;#u=null;#d=null;#f=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#S=null;#w=null;#A=!1;constructor(a,h){this.#e=a.id;const w=c.has(a.kind)?a.kind:"object";a.kind&&!c.has(a.kind)&&E(`store.kind.${a.id}`,`column "${a.id}" declares unknown storage kind "${a.kind}"; falling back to object`),this.#n=w,this.#t=w,this.#r=a.nullable!==!1,this.#o=a.dictionary??null,this.#i=h,this.#s=U(a.read)?a.read:J(a.field||a.id),this.#h=a.stringRankIndex!=="off",this.#p=typeof a.stringRankMaxDistinct=="number"?a.stringRankMaxDistinct:0,this.#S=new Map}get id(){return this.#e}get kind(){return this.#l?this.#t:"object"}get target(){return this.#n}get nullable(){return this.#r}get values(){return this.#A?null:this.#l?this.#t==="bitset"?this.#c.words:this.#t==="multi"?this.#u.values:this.#a:this.#T().values}get presence(){return this.#A||!this.#r?null:this.#l?this.#g:this.#T().presence}get dict(){return this.#A||!this.#l?null:this.#t==="dictionary"||this.#t==="multi"?this.#d:null}get stringRank(){if(this.#A||!this.#h||this.kind!=="object")return null;const a=this.values,h=this.#i.physical();if(!a||h===0)return null;if(this.#f===null){if(typeof a[0]!="string")return null;const w=new l(this.#v());return w.build(a,h),w.version=this.#y,this.#f=w,this.#m=this.#y,w.capped?null:w}return this.#f.length<h&&this.#f.append(a,this.#f.length,h-this.#f.length),this.#f.version=this.#y,this.#m=this.#y,this.#f.capped?null:this.#f}#v(){return this.#p}#P(){this.#f=null,this.#m=-1}get offsets(){return this.#A||!this.#l||this.#t!=="multi"?null:this.#u.offsets}get version(){return this.#y}get bytes(){let a=0;return this.#a&&(a+=this.#a.byteLength??this.#a.length*8),this.#c&&(a+=this.#c.bytes),this.#u&&(a+=this.#u.bytes),this.#g&&(a+=this.#g.bytes),this.#d&&(a+=this.#d.bytes),this.#S&&(a+=this.#S.size*24),a}get(a){if(!this.#A&&!(a<0||a>=this.#i.physical())){if(!this.#l)return this.#E(a);if(this.#r&&this.#g.get(a)===0)return null;switch(this.#t){case"float64":case"int32":return this.#a[a];case"bitset":return this.#c.get(a)===1;case"dictionary":return this.#d.valueOf(this.#a[a]);case"multi":{const h=this.#u.at(a),w=new Array(h.length);for(let v=0;v<h.length;v++)w[v]=this.#d.valueOf(h[v]);return w}default:return this.#a[a]}}}set(a,h){this.#A||(this.#l?this.#C(a,h):this.#S.set(a,h===void 0?null:h),this.#f&&this.#P(),this.#y++)}read(a){return this.#s(a)}appendColumn(a,h,w){if(this.#A||w<=0)return;if(!this.#l){this.#y++;return}const v=this.#s,A=this.#r,H=this.#g;let G=!1;switch(this.#t){case"float64":{const Z=this.#a;for(let M=0;M<w;M++){const S=v(a[M]);if(typeof S=="number"){A&&H.set(h+M),Z[h+M]=S;continue}const T=S==null;A?H.assign(h+M,!T):T&&(G=!0),Z[h+M]=T?NaN:n(S)}break}case"int32":{const Z=this.#a;for(let M=0;M<w;M++){const S=v(a[M]),T=S==null;A?H.assign(h+M,!T):T&&(G=!0),Z[h+M]=T?0:p(S)}break}case"bitset":{const Z=this.#c;for(let M=0;M<w;M++){const S=v(a[M]),T=S==null;A?H.assign(h+M,!T):T&&(G=!0),Z.assign(h+M,!T&&!!S)}break}case"dictionary":{const Z=this.#a,M=this.#d;for(let S=0;S<w;S++){const T=v(a[S]),O=T==null;A?H.assign(h+S,!O):O&&(G=!0),Z[h+S]=O?0:M.codeOf(T)}break}case"multi":{const Z=this.#u,M=this.#d;for(let S=0;S<w;S++){const T=v(a[S]),O=T==null;A?H.assign(h+S,!O):O&&(G=!0);const N=i(T),P=new Array(N.length);for(let C=0;C<N.length;C++)P[C]=M.codeOf(N[C]);Z.write(h+S,P)}break}default:{const Z=this.#a;for(let M=0;M<w;M++){const S=v(a[M]),T=S==null;A?H.assign(h+M,!T):T&&(G=!0),Z[h+M]=T?null:S}break}}G&&E(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#f&&this.#t==="object"&&(this.#f.append(this.#a,h,w),this.#f.version=this.#y+1,this.#m=this.#y+1),this.#y++}appendPacked(a,h,w){if(this.#A||w<=0||!a)return;if(!this.#l){this.#y++;return}const v=this.#g,A=a.presence;if(v)if(A)for(let G=0;G<w;G++)v.assign(h+G,(A[G>>3]&1<<(G&7))!==0);else for(let G=0;G<w;G++)v.set(h+G);const H=a.kind===this.#t;if(H&&(this.#t==="float64"||this.#t==="int32")){this.#a.set(a.values,h),this.#y++;return}if(H&&this.#t==="bitset"){const G=a.values;for(let Z=0;Z<w;Z++)this.#c.assign(h+Z,(G[Z>>3]&1<<(Z&7))!==0);this.#y++;return}if(H&&this.#t==="dictionary"){const G=a.table||[],Z=new Uint32Array(G.length);for(let O=0;O<G.length;O++)Z[O]=this.#d.codeOf(G[O]);const M=a.values,S=this.#a,T=v;for(let O=0;O<w;O++){if(T&&(A&&(A[O>>3]&1<<(O&7))===0)){S[h+O]=0;continue}S[h+O]=Z[M[O]]??0}this.#y++;return}if(H&&this.#t==="multi"){const G=a.table||[],Z=new Uint32Array(G.length);for(let T=0;T<G.length;T++)Z[T]=this.#d.codeOf(G[T]);const M=a.values,S=a.offsets;for(let T=0;T<w;T++){const O=S[T],N=S[T+1],P=new Array(N-O);for(let C=O;C<N;C++)P[C-O]=Z[M[C]]??0;this.#u.write(h+T,P)}this.#y++;return}for(let G=0;G<w;G++){const Z=A?(A[G>>3]&1<<(G&7))===0:a.kind==="object"?a.values[G]===null:!1;this.#C(h+G,Z?null:f(a,G))}this.#y++}touch(){this.#y++}columnarise(a,h){if(this.#l||this.#A)return;const w=new Array(h);for(let v=0;v<h;v++)w[v]=this.#E(v);this.#t=this.#n,this.#l=!0,this.#O(a);for(let v=0;v<h;v++)this.#C(v,w[v]);this.#S.clear(),this.#w=null,this.#P(),this.#y++}grow(a){if(!(!this.#l||this.#A||a<=this.#b)){switch(this.#t){case"float64":case"int32":case"dictionary":{const h=new this.#a.constructor(a);h.set(this.#a),this.#a=h;break}case"bitset":this.#c.grow(a);break;case"multi":break;default:this.#a.length=a;break}this.#g&&this.#g.grow(a),this.#b=a,this.#y++}}convert(a){if(this.#A||!c.has(a)||(this.#n=a,!this.#l||a===this.#t))return!1;const h={kind:this.#t,buf:this.#a,bits:this.#c,mv:this.#u,dict:this.#d},w=this.#i.physical(),v=this.#g;this.#t=a,this.#O(this.#b);for(let A=0;A<w;A++){const H=v!==null&&v.get(A)===0;H&&a!=="multi"||this.#C(A,H?null:r(h,A))}return this.#P(),this.#y++,!0}compact(a,h,w){if(!this.#A){if(this.#P(),!this.#l){const v=this.#S;if(v.size){const A=new Map;for(const[H,G]of v)a[H]!==g&&A.set(a[H],G);this.#S=A}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const v=this.#a;for(let A=0;A<h;A++)a[A]!==g&&(v[a[A]]=v[A]);if(this.#t==="object")for(let A=w;A<h;A++)v[A]=void 0;break}case"bitset":{const v=this.#c;for(let A=0;A<h;A++)a[A]!==g&&v.assign(a[A],v.get(A)===1);for(let A=w;A<h;A++)v.clear(A);break}case"multi":this.#u.compact(a,w,g);break;default:break}if(this.#g){const v=this.#g;for(let A=0;A<h;A++)a[A]!==g&&v.assign(a[A],v.get(A)===1);for(let A=w;A<h;A++)v.clear(A)}this.#y++}}release(){this.#A||(this.#A=!0,this.#a=null,this.#c&&this.#c.release(),this.#c=null,this.#u&&this.#u.release(),this.#u=null,this.#g&&this.#g.release(),this.#g=null,this.#d=null,this.#f=null,this.#S=new Map,this.#w=null,this.#b=0,this.#y++)}#O(a){const h=Math.max(1,a);switch(this.#a=null,this.#c=null,this.#u=null,this.#t){case"float64":this.#a=new Float64Array(h);break;case"int32":this.#a=new Int32Array(h);break;case"bitset":this.#c=new L(h);break;case"dictionary":this.#a=new Uint32Array(h),this.#d=this.#d??new I(this.#o??[]);break;case"multi":this.#u=new k({rows:h,values:h}),this.#d=this.#d??new I(this.#o??[]);break;default:this.#a=new Array(h);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#d=null),this.#r&&(this.#g?this.#g.grow(h):this.#g=new L(h)),this.#b=h}#C(a,h){const w=d(h);switch(this.#r?this.#g.assign(a,!w):w&&E(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#t){case"float64":this.#a[a]=w?NaN:n(h);break;case"int32":this.#a[a]=w?0:p(h);break;case"bitset":this.#c.assign(a,!w&&!!h);break;case"dictionary":this.#a[a]=w?0:this.#d.codeOf(h);break;case"multi":{const v=i(h),A=new Array(v.length);for(let H=0;H<v.length;H++)A[H]=this.#d.codeOf(v[H]);this.#u.write(a,A);break}default:this.#a[a]=w?null:h;break}}#E(a){if(this.#S.has(a))return this.#S.get(a);const h=this.#s(this.#i.rowAt(a));return h===void 0?null:h}#T(){if(this.#w&&this.#w.version===this.#y)return this.#w;const a=this.#i.physical(),h=new Array(a),w=this.#r?new L(a):null;for(let v=0;v<a;v++){const A=this.#E(v);h[v]=A,w&&!d(A)&&w.set(v)}return this.#w={version:this.#y,values:h,presence:w},this.#w}}class u{#e;#t=new Map;#n=[];#r=[];#s=0;#i=0;#o=0;#l=0;#a=new L(0);#c=!1;#u=!0;#d;#f;#h;#p=!1;constructor(a,h={}){this.#e=Array.isArray(a)?a:[],this.#f=Math.max(1,h.initialCapacity??s),this.#u=h.retainSource!==!1,this.#d=this.#u?h.columnarBelow??t:0,this.#h=h.compactRatio??o;const w={rowAt:v=>this.#r[v],physical:()=>this.#s};for(const v of this.#e){if(!v||!v.id)continue;if(this.#t.has(v.id)){E(`store.dup.${v.id}`,`duplicate column id "${v.id}" in the store schema; ignoring the second`);continue}const A=new m(v,w);this.#t.set(v.id,A),this.#n.push(A)}this.#d<=0&&this.#b()}get count(){return this.#o}get physical(){return this.#s}get capacity(){return this.#c?this.#i:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let a=this.#a.bytes+this.#r.length*8;for(const h of this.#n)a+=h.bytes;return a}append(a){const h=this.#s;if(this.#p||!a)return{from:h,to:h};const w=a.length|0;if(w===0)return{from:h,to:h};if(this.#u)for(let A=0;A<w;A++)this.#r[h+A]=a[A];if(this.#s=h+w,this.#o+=w,this.#a.grow(this.#s),!this.#c){if(this.#s>=this.#d)this.#b();else for(const A of this.#n)A.touch();return{from:h,to:this.#s}}this.#m(this.#s);const v=this.#n;for(let A=0;A<v.length;A++)v[A].appendColumn(a,h,w);return{from:h,to:this.#s}}appendPacked(a,h){const w=this.#s;if(this.#p||!a)return{from:w,to:w};const v=a.count|0;if(v===0)return{from:w,to:w};if(this.#u&&h)for(let H=0;H<v;H++)this.#r[w+H]=h[H];this.#s=w+v,this.#o+=v,this.#a.grow(this.#s),this.#c||this.#b(),this.#m(this.#s);const A=new Map;for(const H of a.columns)A.set(H.id,H);for(const H of this.#n){const G=A.get(H.id);G?H.appendPacked(G,w,v):H.grow(this.#i)}return{from:w,to:this.#s}}source(a){if(this.#u)return this.#r[a];if(!(a<0||a>=this.#s))return this.#g(a)}setSource(a,h){this.#p||a<0||a>=this.#s||this.#u&&(this.#r[a]=h)}get(a,h){const w=this.#t.get(a);return w?w.get(h):void 0}set(a,h,w){if(this.#p||h<0||h>=this.#s)return;const v=this.#t.get(a);if(!v){E(`store.set.${a}`,`set() on unknown column "${a}"`);return}v.set(h,w)}remove(a){return this.#p||a<0||a>=this.#s||this.#a.get(a)===1?!1:(this.#a.set(a),this.#l++,this.#o--,!0)}live(a){return a<0||a>=this.#s?!1:this.#a.get(a)===0}compact(a={}){if(this.#p||this.#l===0||!a.force&&this.#l/this.#s<this.#h)return null;const h=this.#s,w=new Uint32Array(h);let v=0;for(let A=0;A<h;A++)w[A]=this.#a.get(A)===1?g:v++;for(const A of this.#n)A.compact(w,h,v);if(this.#u){const A=this.#r;for(let H=0;H<h;H++)w[H]!==g&&(A[w[H]]=A[H]);A.length=v}return this.#s=v,this.#o=v,this.#l=0,this.#a=new L(Math.max(this.#i,v)),w}column(a){return this.#t.get(a)}columns(){return this.#n.slice()}liveIndices(){const a=new Uint32Array(this.#o);if(this.#l===0){for(let w=0;w<this.#s;w++)a[w]=w;return a}let h=0;for(let w=0;w<this.#s;w++)this.#a.get(w)===0&&(a[h++]=w);return a}convert(a,h){const w=this.#t.get(a);return w?w.convert(h):!1}destroy(){if(!this.#p){this.#p=!0;for(const a of this.#n)a.release();this.#t.clear(),this.#n.length=0,this.#r.length=0,this.#a.release(),this.#s=0,this.#o=0,this.#l=0,this.#i=0}}#m(a){if(a<=this.#i)return;let h=this.#i||this.#f;for(;h<a;)h*=2;for(const w of this.#n)w.grow(h);this.#a.grow(h),this.#i=h}#g(a){const h={};for(const w of this.#n)h[w.id]=w.get(a);return h}#b(){if(this.#c)return;let a=this.#f;for(;a<this.#s;)a*=2;this.#c=!0,this.#i=a,this.#a.grow(a);for(const h of this.#n)h.columnarise(a,this.#s)}}}),ze("packages/core/src/store/pool.js",function(e,_){"use strict";Object.defineProperty(e,"MaskPool",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"sharedPool",{enumerable:!0,get:function(){return D}});const ne=64,E=8;function K(z){let L=ne;for(;L<z;)L*=2;return L}class U{#e=new Map;#t=new WeakSet;#n;#r=0;#s={acquired:0,reused:0,released:0};constructor(L={}){this.#n=L.limit??E}get bytes(){return this.#r}mask(L){const X=new Uint8Array(this.#i(L),0,L);return X.fill(0),X}indices(L){return new Uint32Array(this.#i(L*4),0,L)}release(L){if(!L||!L.buffer)return!1;const X=L.buffer;if(!this.#t.has(X))return!1;this.#t.delete(X),this.#s.released++;const I=X.byteLength;let j=this.#e.get(I);return j||this.#e.set(I,j=[]),j.length>=this.#n||(j.push(X),this.#r+=I),!0}releaseAll(L){for(const X of L)this.release(X)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#s,retained:this.#r}}#i(L){const X=K(L),I=this.#e.get(X);this.#s.acquired++;let j;return I&&I.length?(j=I.pop(),this.#r-=X,this.#s.reused++):j=new ArrayBuffer(X),this.#t.add(j),j}}function D(){return J??=new U,J}let J=null}),ze("packages/core/src/compute/sortspec.js",function(e,_){"use strict";Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return D}});function ne(J){return{locale:J===void 0?void 0:String(J),numeric:!0,sensitivity:"variant"}}function E(J){return!!J&&typeof J.compare!="function"}function K(J){if(!J)return!0;for(let z=0;z<J.length;z++)if(!E(J[z]))return!1;return!0}function U(J,z){const L=J.col!==void 0?J.col:J.handle&&J.handle.id,X=J.locale!==void 0?J.locale:z;return{col:L,descending:J.descending!==void 0?!!J.descending:J.dir==="desc",nullsFirst:!!J.nullsFirst,collation:ne(X)}}function D(J,z){const L=J||[],X=new Array(L.length);for(let I=0;I<L.length;I++)X[I]=U(L[I],z);return X}}),ze("packages/core/src/compute/facet.js",function(e,_){"use strict";Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"orderedReader",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"toNumeric",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return w}});const ne=_("packages/core/src/compute/handle.js"),E=ne.presenceReader,K=ne.valueReader,U=ne.dictSize,D=ne.dictValue,J=Object.freeze(["equal","quantile","log"]),z=Object.freeze(["hour","day","week","month","quarter","year"]),L=20,X=50,I=1e4;function j(v,A){if(!v)return"none";const H=A;if(H&&(H.multi===!0||typeof H.items=="function"))return"category";const G=A&&A.base;if(G==="date"||G==="datetime"||G==="time"||G==="dateString")return"date";switch(v.kind){case"bitset":return"boolean";case"float64":case"int32":return"numeric";case"dictionary":return"category";case"multi":return"category";default:return G==="number"?"numeric":G==="boolean"?"boolean":G==="text"?"category":"none"}}function k(v){const A=v.values,H=v.kind;if((H==="float64"||H==="int32")&&A)return Z=>A[Z];const G=K(v);return Z=>y(G(Z))}function y(v){if(typeof v=="number")return v;if(v instanceof Date)return v.getTime();if(v==null||v==="")return NaN;if(typeof v=="boolean")return v?1:0;if(typeof v=="string"){const A=Number(v);if(Number.isFinite(A))return A;const H=Date.parse(v);return Number.isFinite(H)?H:NaN}return NaN}function l(v,A,H,G=X){if(!v)return{cardinality:0,exact:!0};if(v.dict)return{cardinality:U(v.dict),exact:!0};if(v.kind==="bitset")return{cardinality:2,exact:!0};const Z=K(v),M=A?A.length:H,S=new Set;for(let T=0;T<M;T++){const O=Z(A?A[T]:T);if(O!=null&&(S.add(O),S.size>G))return{cardinality:S.size,exact:!1}}return{cardinality:S.size,exact:!0}}const g=36e5,s=864e5;function t(v,A=L){const H=Number.isFinite(v)&&v>0?v:0,G=Math.max(1,A)*2;return H/g<=G?"hour":H/s<=G?"day":H/(7*s)<=G?"week":H/(30*s)<=G?"month":H/(91*s)<=G?"quarter":"year"}function o(v,A){if(!Number.isFinite(v))return NaN;const H=new Date(v);switch(A){case"hour":return H.setMinutes(0,0,0),H.getTime();case"day":return H.setHours(0,0,0,0),H.getTime();case"week":{H.setHours(0,0,0,0);const G=(H.getDay()+6)%7;return H.setDate(H.getDate()-G),H.getTime()}case"month":return H.setDate(1),H.setHours(0,0,0,0),H.getTime();case"quarter":return H.setMonth(Math.floor(H.getMonth()/3)*3,1),H.setHours(0,0,0,0),H.getTime();default:return H.setMonth(0,1),H.setHours(0,0,0,0),H.getTime()}}function c(v,A){const H=new Date(v);switch(A){case"hour":H.setHours(H.getHours()+1);break;case"day":H.setDate(H.getDate()+1);break;case"week":H.setDate(H.getDate()+7);break;case"month":H.setMonth(H.getMonth()+1);break;case"quarter":H.setMonth(H.getMonth()+3);break;default:H.setFullYear(H.getFullYear()+1);break}return H.getTime()}function d(v,A,H){const G=k(v),Z=E(v),M=A?A.length:H;let S=1/0,T=-1/0,O=0,N=0;for(let P=0;P<M;P++){const C=A?A[P]:P;if(Z&&!Z(C)){O++;continue}const B=G(C);if(!Number.isFinite(B)){O++;continue}B<S&&(S=B),B>T&&(T=B),N++}return{min:S,max:T,nulls:O,finite:N}}function n(v,A,H,G){const Z=k(v),M=E(v),S=A?A.length:H,T=S>G?S/G:1,O=[];for(let P=0;P<S;P+=T){const C=A?A[Math.floor(P)]:Math.floor(P);if(M&&!M(C))continue;const B=Z(C);Number.isFinite(B)&&O.push(B)}const N=Float64Array.from(O);return N.sort(),N}function p(v,A,H,G={}){const Z=G.kind||j(v,G.type);return Z==="none"||!v?{kind:"none",buckets:[],suppressed:"type"}:Z==="boolean"?i(v,A,H):Z==="category"?r(v,A,H,G):m(v,A,H,Z,G)}function i(v,A,H){const G=E(v);let Z=0;if(G){const S=A?A.length:H;for(let T=0;T<S;T++)G(A?A[T]:T)||Z++}const M=[{value:!1,label:"false"},{value:!0,label:"true"}];return Z>0&&M.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:M}}function r(v,A,H,G){const Z=G.cardinalityLimit??X,{cardinality:M}=l(v,A,H,Z);if(M>Z&&(G.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:M};const S=K(v),T=A?A.length:H,O=new Map;let N=0;for(let V=0;V<T;V++){const Y=S(A?A[V]:V);if(Y==null||Y===""){N++;continue}if(Array.isArray(Y)){if(!Y.length){N++;continue}for(const F of Y)O.set(F,(O.get(F)||0)+1);continue}O.set(Y,(O.get(Y)||0)+1)}let P=[...O.entries()];G.order==="alpha"?P.sort((V,Y)=>String(V[0]).localeCompare(String(Y[0]))):P.sort((V,Y)=>Y[1]-V[1]);let C=0,B=0;if(P.length>Z){B=P.length-Z;for(let V=Z;V<P.length;V++)C+=P[V][1];P=P.slice(0,Z)}const x=P.map(([V])=>({value:V,label:String(V)}));return C>0&&x.push({remainder:!0,label:`Other (${B} values)`}),N>0&&x.push({null:!0,label:"Empty"}),{kind:"category",buckets:x,cardinality:M}}function f(v,A,H,G,Z){const M=n(v,A,H,I),S=M.length;if(S<100)return null;const T=M[Math.floor(.01*S)],O=M[Math.ceil(.99*S)-1];return!(O>T)||Z-G<=2*(O-T)?null:{lo:T,hi:O}}function m(v,A,H,G,Z){const{min:M,max:S,nulls:T,finite:O}=d(v,A,H);if(!O)return{kind:G,buckets:T?[{null:!0,label:"Empty"}]:[],empty:!0};const N=Math.max(1,Math.floor(Z.buckets||L));let P=[];if(G==="date"){const B=z.includes(Z.granularity)?Z.granularity:t(S-M,N);let x=o(M,B);for(;x<=S&&P.length<4096;){const V=c(x,B);if(!(V>x))break;P.push({from:x,to:V}),x=V}return{kind:G,buckets:u(P,T),granularity:B}}const C=J.includes(Z.strategy)?Z.strategy:"equal";if(C==="quantile"){const B=n(v,A,H,I);if(B.length){const x=[B[0]];for(let V=1;V<N;V++){const Y=B[Math.min(B.length-1,Math.floor(V/N*B.length))];Y>x[x.length-1]&&x.push(Y)}x.push(S);for(let V=0;V<x.length-1;V++)P.push({from:x[V],to:x[V+1]})}}else if(C==="log"&&M>0){const B=Math.log10(M),V=(Math.log10(S)-B)/N||1;for(let Y=0;Y<N;Y++)P.push({from:10**(B+Y*V),to:10**(B+(Y+1)*V)})}if(!P.length&&C==="equal"){const B=f(v,A,H,M,S);if(B){const x=(B.hi-B.lo)/N;B.lo>M&&P.push({from:M,to:B.lo,overflow:"low"});for(let V=0;V<N;V++)P.push({from:B.lo+V*x,to:B.lo+(V+1)*x});P[P.length-1].to=B.hi,B.hi<S&&P.push({from:B.hi,to:S,overflow:"high"})}}if(!P.length){const B=(S-M)/N||1;for(let x=0;x<N;x++)P.push({from:M+x*B,to:M+(x+1)*B})}return P[P.length-1].to=S,{kind:G,buckets:u(P,T),strategy:C,min:M,max:S}}function u(v,A){return A>0?[...v,{null:!0,label:"Empty"}]:v}function b(v,A,H,G,Z){const M=G&&G.buckets||[],S=Z&&Z.length>=M.length?Z.subarray(0,M.length):new Uint32Array(M.length);if(S.fill(0),!v||!M.length)return S;const T=M.length-1,O=!!M[T]&&M[T].null===!0,N=A?A.length:H;if(G.kind==="boolean"){const V=K(v);for(let Y=0;Y<N;Y++){const F=V(A?A[Y]:Y);if(F==null){O&&S[T]++;continue}S[F?1:0]++}return S}if(G.kind==="category"){const V=new Map;for(let $=0;$<M.length;$++)!M[$].null&&!M[$].remainder&&V.set(M[$].value,$);const Y=M.findIndex($=>$.remainder),F=K(v);for(let $=0;$<N;$++){const q=F(A?A[$]:$);if(q==null||q===""){O&&S[T]++;continue}if(Array.isArray(q)){if(!q.length){O&&S[T]++;continue}for(const te of q){const re=V.get(te);re!==void 0?S[re]++:Y>=0&&S[Y]++}continue}const ee=V.get(q);ee!==void 0?S[ee]++:Y>=0&&S[Y]++}return S}const P=O?M.length-1:M.length,C=new Float64Array(P+1);for(let V=0;V<P;V++)C[V]=M[V].from;C[P]=P?M[P-1].to:0;const B=k(v),x=E(v);for(let V=0;V<N;V++){const Y=A?A[V]:V;if(x&&!x(Y)){O&&S[T]++;continue}const F=B(Y);if(!Number.isFinite(F)){O&&S[T]++;continue}const $=a(C,P,F);$>=0&&S[$]++}return S}function a(v,A,H){if(!A||H<v[0])return-1;if(H>=v[A])return H===v[A]?A-1:-1;let G=0,Z=A-1;for(;G<Z;){const M=G+Z+1>>>1;H>=v[M]?G=M:Z=M-1}return G}function h(v,A,H,G={}){const Z=G.bounds||p(v,G.boundsIndices??A,H,G);return{bounds:Z,counts:b(v,A,H,Z)}}const w=h}),ze("packages/core/src/compute/pivotmatrix.js",function(e,_){"use strict";Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return o}});const E=_("packages/core/src/compute/handle.js").valueComparator,U=_("packages/core/src/compute/total.js").total,J=_("packages/core/src/compute/group.js").packKeys,z=_("packages/core/src/compute/pivot.js"),L=z.joinPath,X=z.DEFAULT_PATH_SEPARATOR,I=z.DEFAULT_MAX_COLUMNS,j="";function k(c,d,n={}){const p=n.separator||X,i=c||[],r=d instanceof Uint32Array?d:Uint32Array.from(d||[]),f=r.length;if(i.length===0)return{tuples:[[]],paths:[j],buckets:[r]};const{keyOf:m,readers:u}=J(i,r,0),b=new Map,a=[],h=[],w=[];for(let M=0;M<f;M++){const S=r[M],T=m(S);let O=b.get(T);if(O===void 0){O=a.length,b.set(T,O),h.push(T);const N=new Array(u.length);for(let P=0;P<u.length;P++)N[P]=u[P](S);a.push(N),w.push([])}w[O].push(S)}const v=E(n.locale),A=a.map((M,S)=>S);A.sort((M,S)=>{const T=a[M],O=a[S];for(let N=0;N<T.length;N++){const P=y(T[N],O[N],v);if(P!==0)return P}return M-S});const H=new Array(A.length),G=new Array(A.length),Z=new Array(A.length);for(let M=0;M<A.length;M++){const S=A[M];H[M]=a[S],G[M]=L(a[S],p),Z[M]=Uint32Array.from(w[S])}return{tuples:H,paths:G,buckets:Z}}function y(c,d,n){const p=c==null,i=d==null;return p||i?p&&i?0:p?1:-1:n(c,d)}function l(c,d,n){const p=[];for(let i=0;i<c.length;i++)n.has(c[i])&&p.push(c[i]);return Uint32Array.from(p)}function g(c,d,n,p){return{value:d.length?U(c,d,n,p):null,leaves:d,count:d.length}}function s(c){const d=c&&c.opts||{},n=d.separator||X,p=d.totalContext||{locale:d.locale},i=(c.measures||[]).filter(G=>G&&G.handle),r=c.leaves instanceof Uint32Array?c.leaves:Uint32Array.from(c.leaves||[]),f=k(c.rowHandles||[],r,{...d,separator:n}),m=k(c.columnHandles||[],r,{...d,separator:n}),u=d.maxColumns===void 0?I:d.maxColumns,b=m.paths.length*Math.max(1,i.length),a=new Map;if(u&&b>u)return{rowAxis:f,columnAxis:m,measures:i.map(G=>({colId:G.colId,fn:G.fn})),body:a,rowMargin:a,columnMargin:a,grand:a,columns:b,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${b} columns, above pivot.maxColumns of ${u}. Narrow the pivot columns or raise the limit.`,columns:b,maxColumns:u}};const h=new Map,w=new Map,v=new Map,A=new Map,H=m.buckets.map(G=>new Set(G));for(let G=0;G<m.paths.length;G++){const Z=m.buckets[G],M=m.paths[G];for(const S of i)v.set(o(M,S.colId),g(S.handle,Z,S.fn,p))}for(let G=0;G<f.paths.length;G++){const Z=f.buckets[G],M=f.paths[G];for(const S of i)w.set(o(M,S.colId),g(S.handle,Z,S.fn,p));for(let S=0;S<m.paths.length;S++){const T=l(Z,m.buckets[S],H[S]);if(T.length===0)continue;const O=m.paths[S];for(const N of i)h.set(t(M,O,N.colId),g(N.handle,T,N.fn,p))}}for(const G of i)A.set(G.colId,g(G.handle,r,G.fn,p));return{rowAxis:f,columnAxis:m,measures:i.map(G=>({colId:G.colId,fn:G.fn})),body:h,rowMargin:w,columnMargin:v,grand:A,columns:b,error:null}}function t(c,d,n){return`${c}\0${d}\0${n}`}function o(c,d){return`${c}\0${d}`}}),ze("packages/core/src/compute/reference.js",function(e,_){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return s}});const E=_("packages/core/src/internal/paths.js").getPath,K=_("packages/core/src/compute/handle.js"),U=K.isMissing,D=K.valueComparator,z=_("packages/core/src/compute/filter.js").testValue,L="",X="\0";function I(c,d){const n=d.includes(".")?E(c,d):c?.[d];return n===void 0?null:n}function j(c,d,n={}){const p=d||[];let i=c.map((r,f)=>f);if(p.length===0)return i;for(let r=p.length-1;r>=0;r--)i=k(c,i,p[r],n);return i}function k(c,d,n,p){const i=n.locale!==void 0?n.locale:p.locale,r=D(i),f=n.descending!==void 0?!!n.descending:n.dir==="desc",m=[],u=[];for(const h of d){const w=I(c[h],n.col);U(w)?u.push(h):m.push(h)}const b=new Map;for(let h=0;h<m.length;h++)b.set(m[h],h);const a=(h,w)=>{const v=I(c[h],n.col),A=I(c[w],n.col);let H;return typeof n.compare=="function"?(H=n.compare(v,A,c[h],c[w],f),f&&(H=-H)):H=f?r(A,v):r(v,A),H!==0?H:b.get(h)-b.get(w)};return m.sort(a),n.nullsFirst?u.concat(m):m.concat(u)}function y(c,d,n={}){const p=[];for(let i=0;i<c.length;i++)l(c[i],d,n,i)&&p.push(i);return p}function l(c,d,n,p){if(!d)return!0;if(Array.isArray(d.conditions)){const i=d.conditions.filter(f=>f!=null);if(i.length===0)return!0;if(d.op==="or")return i.some(f=>l(c,f,n,p));const r=i.every(f=>l(c,f,n,p));return d.op==="not"?!r:r}return d.col===void 0&&typeof n.custom=="function"?!!n.custom(d,c,p):z(I(c,d.col),d,n.locale)}function g(c,d,n,p){const i=n||c.map((u,b)=>b),r=new Map,f=[],m=[];for(const u of i){const b=d.map((w,v)=>{const A=I(c[u],w);return p&&p[v]?p[v](A):A}),a=b.map(w=>w==null?X:String(w)).join(L);let h=r.get(a);h===void 0&&(h=f.length,r.set(a,h),f.push(b),m.push([])),m[h].push(u)}return{keys:f,buckets:m}}function s(c,d,n={}){const p=D(n.locale),i=c.filter(f=>!U(f)),r=i.map(t).filter(f=>f!==null);switch(d){case"count":return c.length;case"countValues":return i.length;case"sum":return r.reduce((f,m)=>f+m,0);case"avg":return i.length===0?null:r.reduce((f,m)=>f+m,0)/i.length;case"min":return i.length===0?null:i.reduce((f,m)=>p(m,f)<0?m:f);case"max":return i.length===0?null:i.reduce((f,m)=>p(m,f)>0?m:f);case"first":return c.length===0?null:o(c[0]);case"last":return c.length===0?null:o(c[c.length-1]);default:return null}}function t(c){if(typeof c=="number")return Number.isNaN(c)?null:c;if(c==null||c===""||typeof c=="boolean")return null;if(c instanceof Date)return c.getTime();const d=Number(c);return Number.isNaN(d)?null:d}function o(c){return c===void 0?null:c}}),ze("packages/core/src/compute/index.js",function(e,_){"use strict";const ne=_("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 E=_("packages/core/src/compute/sortspec.js");Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return E.collationDescriptor}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return E.isPortableSort}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return E.isPortableSortSet}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return E.describeSortEntry}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return E.describeSort}});const K=_("packages/core/src/compute/filter.js");Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return K.evaluateFilters}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return K.evaluateCondition}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return K.compact}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return K.testValue}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return K.compilePredicate}}),Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return K.releaseMask}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return K.pruneColumn}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return K.mentionsColumn}});const U=_("packages/core/src/compute/group.js");Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return U.groupByColumns}}),Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return U.packKeys}});const D=_("packages/core/src/compute/facet.js");Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return D.facet}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return D.computeBounds}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return D.countInto}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return D.bucketOf}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return D.facetKind}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return D.cardinalityOf}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return D.pickGranularity}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return D.floorTo}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return D.advance}}),Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return D.STRATEGIES}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return D.GRANULARITIES}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return D.DEFAULT_BUCKETS}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return D.DEFAULT_CARDINALITY_LIMIT}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return D.QUANTILE_SAMPLE}});const J=_("packages/core/src/compute/total.js");Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return J.TOTAL_FNS}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return J.TOTAL_LABELS}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return J.totalLabel}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return J.total}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return J.collectValues}});const z=_("packages/core/src/compute/pivot.js");Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return z.pivot}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return z.resolvePivotKeys}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return z.pivotKey}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return z.joinPath}}),Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return z.KEY_DELIMITER}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return z.DEFAULT_PATH_SEPARATOR}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return z.DEFAULT_MAX_COLUMNS}});const L=_("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return L.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return L.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return L.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return L.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return L.GRAND_PATH}});const X=_("packages/core/src/compute/reference.js");Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return X.referenceSort}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return X.referenceFilter}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return X.referenceGroup}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return X.referenceTotal}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return X.referencePasses}}),Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return X.referenceValue}});const I=_("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return I.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return I.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return I.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return I.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return I.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return I.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return I.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return I.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return I.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return I.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return I.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return I.isMissing}});const j=_("packages/core/src/compute/sketch.js");Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return j.Welford}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return j.Reservoir}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return j.HyperLogLog}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return j.SpaceSaving}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return j.KLL}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return j.hash32}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j.SKETCH_BOUNDS}});const k=_("packages/core/src/compute/windowed.js");Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return k.Window}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return k.WINDOW_KINDS}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return k.openWindow}});const y=_("packages/core/src/compute/statistics.js");Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return y.MAINTENANCE}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return y.APPROXIMATE}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return y.maintenanceOf}});const l=_("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return l.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return l.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return l.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return l.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return l.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return l.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return l.anomalyCondition}});const g=_("packages/core/src/compute/forecast.js");Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return g.FORECAST_METHODS}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return g.forecast}})}),ze("packages/core/src/source/rows.js",function(e,_){"use strict";Object.defineProperty(e,"DEFAULT_ROW_HEIGHT",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"KEY_SEP",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"groupPrefixKeys",{enumerable:!0,get:function(){return g}});const E=_("packages/core/src/internal/warn.js").warnOnce,U=_("packages/core/src/internal/predicates.js").isFunction,D=32,J="\0";function z(s){return new L(s)}class L{#e;#t;constructor(t){this.#e=U(t&&t.rowKey)?t.rowKey:null;const o=t&&t.config?t.config.rowHeight:void 0;this.#t=typeof o=="number"||U(o)?o:D}get keyed(){return this.#e!==null}keyOf(t,o){if(this.#e){const c=this.#e(t);if(c!=null)return String(c)}else E("source.rowKey.missing","no config.rowKey; falling back to index identity.","Row changes, streaming dedupe, selection persistence and remote reload are disabled.");return`#${o}`}heightOf(t){return U(this.#t)?Number(this.#t(t))||D:this.#t}leaf(t,o,c=0,d=null){const n={key:this.keyOf(t,o),data:t,level:c,parent:d,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:o};return n.height=this.heightOf(n),n}group(t){const o={key:l(t.keyPath||t.path),data:null,level:t.level,parent:t.parent||null,children:[],group:!0,expanded:t.expanded!==!1,leafCount:t.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:t.column,groupValue:t.value,groupPath:t.path,hasChildren:t.hasChildren!==!1};return t.totals&&(o.totals=t.totals),o.height=this.heightOf(o),o}footer(t){const o={key:`${t.key}${J}footer`,data:null,level:t.level,parent:t,group:!0,footer:!0,expanded:!1,leafCount:t.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:t.groupColumn,groupValue:t.groupValue,groupPath:t.groupPath,hasChildren:!1,totals:t.totals};return o.height=this.heightOf(o),o}detail(t,o){return{key:`${t.key}${J}detail`,data:t.data,level:t.level+1,parent:t,group:!1,detail:!0,expanded:!1,leafCount:0,height:o,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:t.key}}grandTotal(t,o){const c={key:`${J}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:o,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:t};return c.height=this.heightOf(c),c}skeleton(t,o=0,c=!1){const d={key:`${J}pending${J}${t}`,data:null,level:o,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:t,selected:!1,physical:null,pending:!0};return c&&(d.loadError=!0),d.height=this.heightOf(d),d}}function X(s,t,o,c){return{key:`${J}pinned${J}${o}${J}${t}`,data:s,level:0,parent:null,group:!1,expanded:!1,leafCount:0,height:c,index:null,selected:!1,physical:null,hasChildren:!1,pinned:o}}function I(s,t){return new Proxy([],{get(o,c,d){if(c==="length")return s();if(typeof c=="string"){const n=Number(c);if(Number.isInteger(n)&&n>=0)return t(n)}return Reflect.get(o,c,d)},has(o,c){if(typeof c=="string"){const d=Number(c);if(Number.isInteger(d)&&d>=0)return d<s()}return Reflect.has(o,c)}})}function j(s){return s==null?"":String(s)}const k="";function y(s){if(s==null)return k;const t=String(s);return t.startsWith(k)?k+t:t}function l(s){const t=s||[];let o="g";for(let c=0;c<t.length;c++)o+=J+y(t[c]);return o}function g(s){const t=new Array(s.length),o=[];for(let c=0;c<s.length;c++)o.push(s[c]),t[c]=l(o);return t}}),ze("packages/core/src/source/handles.js",function(e,_){"use strict";Object.defineProperty(e,"HandleProvider",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"createHandleProvider",{enumerable:!0,get:function(){return J}});const E=_("packages/core/src/internal/predicates.js").isFunction,U=_("packages/core/src/internal/warn.js").warnOnce;class D{#e;#t;#n;#r=new Map;#s=0;constructor(L,X,I){this.#e=L,this.#t=X,this.#n=E(I)?I:()=>!1}get store(){const L=this.#e.store;return L&&E(L.column)?L:null}invalidate(){this.#s++}handle(L){const X=this.store;if(X){const y=X.column(L);if(y)return y}const I=this.#r.get(L);if(I&&I.builtAt===this.#s)return I.handle;const j=this.#i(L);if(!j)return;if(X&&this.#n()){U(`source.dropped.${L}`,`column "${L}" cannot be served under ingest.dropSourceRows: it is an impure computed column (a shadow or a positional/rank column) that is never stored, so it can only be read from the caller's row objects — which dropSourceRows has released. Do not sort, filter, group or total on such a column with dropSourceRows enabled.`);return}const k=this.#o(j);return this.#r.set(L,{handle:k,builtAt:this.#s}),k}#i(L){const X=this.#e.columns;return X&&E(X.get)?X.get(L):void 0}#o(L){const X=this.#t()||[],I=X.length,j=new Array(I),k=E(L.getValue)?l=>L.getValue(l):l=>l?.[L.field||L.id];for(let l=0;l<I;l++)j[l]=X[l]===void 0?void 0:k(X[l]);const y=this.#s;return{id:L.id,kind:"object",nullable:!1,values:j,presence:null,dict:null,offsets:null,get(l){return j[l]},version:y}}}function J(z,L,X){return new D(z,L,X)}}),ze("packages/core/src/compute/incremental.js",function(e,_){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return X}});const E=_("packages/core/src/store/columnstore.js").toFloat,K=Object.freeze(["sum","avg","countValues","min","max"]),U=Object.freeze(["float64"]),D=1e15;function J(I,j){return typeof I!="string"||!K.includes(I)?!1:!!j&&U.includes(j.kind)}function z(I){if(I==null)return null;const j=E(I);return Number.isNaN(j)?null:j}class L{#e;#t=0;#n=0;#r=0;#s=1/0;#i=-1/0;#o=!1;#l=!1;constructor(j){this.#e=j}get valid(){return this.#o&&!this.#l}get fn(){return this.#e}seed(j){this.#a();for(let k=0;k<j.length;k++){const y=z(j[k]);y!==null&&this.#c(y)}this.#o=!0}seedColumn(j,k,y){this.#a();for(let l=0;l<y.length;l++){const g=y[l];if(k&&k(g)===0)continue;const s=j[g];Number.isNaN(s)||this.#c(s)}this.#o=!0}#a(){this.#t=0,this.#n=0,this.#r=0,this.#s=1/0,this.#i=-1/0,this.#l=!1}#c(j){if(!Number.isFinite(j)){this.#l=!0;return}const k=this.#t+j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-k+j:j-k+this.#t,this.#t=k,this.#r++,j<this.#s&&(this.#s=j),j>this.#i&&(this.#i=j)}#u(j){const k=this.#t-j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-k-j:-j-k+this.#t,this.#t=k,this.#r--}update(j,k){if(!this.#o)return!1;const y=z(j),l=z(k);return y===null&&l===null?!0:y!==null&&!Number.isFinite(y)||l!==null&&!Number.isFinite(l)?!1:this.#e==="min"||this.#e==="max"?y===null||l===null?!1:this.#e==="min"?l<this.#s?(this.#s=l,!0):y>this.#s:l>this.#i?(this.#i=l,!0):y<this.#i:Math.abs(this.#t)>D?!1:(y!==null&&this.#u(y),l!==null&&this.#c(l),!0)}value(){switch(this.#e){case"countValues":return this.#r;case"avg":return this.#r?(this.#t+this.#n)/this.#r:null;case"min":return this.#r?this.#s:null;case"max":return this.#r?this.#i:null;default:return this.#t+this.#n}}invalidate(){this.#o=!1}}const X=L}),ze("packages/core/src/source/filterwire.js",function(e,_){"use strict";Object.defineProperty(e,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"resolveRelativeRange",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"relativeTokenOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"relativeTokenHelp",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"isResolvableRelative",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"resolveRelativeCondition",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"forEachCondition",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"mapConditions",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"normaliseFilterSet",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"buildFilterSet",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"wireFilters",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"querySignature",{enumerable:!0,get:function(){return v}});const E=_("packages/core/src/internal/warn.js").warnOnce,K="source.remote.hostFilter",U="source.where.pageRelative";function D(G,Z){!Array.isArray(G)||!G.length||E(U,`filters.where (${G.join(", ")}) runs over the rows the ${Z} 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 J(G){const Z=(G||{}).config;!Z||!Z.hostFilter||E(K,"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 z="source.where.notApplied";function L(G,Z){E(`${z}:${G}`,`filters.where("${G}") is registered but the ${Z} source holds only its fetched window`,"and cannot run the predicate over it: the predicate is not applied there, and rows it would","exclude stay on screen.","Give it a { condition } twin so the engine can narrow the fetch itself — that is the","supported route for a paged or remote source.")}const X="source.where.overThreshold";function I(G,Z,M,S){!Array.isArray(G)||!G.length||E(`${X}:${Z}`,`filters.where (${G.join(", ")}) is not applied to the ${Z} pushdown source:`,M===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${M.toLocaleString()} rows, at or past the whereRowLimit of ${S.toLocaleString()}.`,"Running the predicate needs every matching row fetched and held here, which is the whole","download a pushdown source exists to avoid, so it is refused and the rows the predicate","would exclude stay on screen.","Give the predicate a { condition } twin so the engine narrows the fetch itself — that is the","route that works at any size — or raise `whereRowLimit` on the source config if you want the","download.")}const j=new Map;function k(G){let Z=j.get(G);return Z||(Z=new Intl.DateTimeFormat("en-US",{timeZone:G,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),j.set(G,Z)),Z}function y(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function l(G,Z){const M=k(Z).formatToParts(new Date(G)),S={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const T of M)T.type==="year"?S.y=+T.value:T.type==="month"?S.m=+T.value:T.type==="day"?S.d=+T.value:T.type==="hour"?S.h=+T.value%24:T.type==="minute"?S.mi=+T.value:T.type==="second"&&(S.s=+T.value);return S}function g(G,Z){const M=l(G,Z);return Date.UTC(M.y,M.m-1,M.d,M.h,M.mi,M.s)-Math.floor(G/1e3)*1e3}function s(G,Z,M,S){const T=Date.UTC(G,Z-1,M),O=T-g(T,S);return T-g(O,S)}function t(G,Z,M){const S=new Date(Date.UTC(G.y,G.m-1,G.d+Z));return s(S.getUTCFullYear(),S.getUTCMonth()+1,S.getUTCDate(),M)}const o=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function c(G,Z){if(typeof G!="string")return null;const M=G.trim().toLowerCase().replace(/[\s_-]+/g,""),S=/^last(\d*|n)days?$/.exec(M);if(S){const T=S[1]==="n"?"":S[1],O=Number(T||Z);return!Number.isFinite(O)||O<=0?null:{kind:"lastNDays",n:Math.floor(O)}}switch(M){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 d(G,Z={}){const M=c(G,Z.n);if(!M)return null;const S=Z.tz||y(),T=Z.now instanceof Date?Z.now.getTime():typeof Z.now=="number"?Z.now:Date.now(),O=l(T,S),N=s(O.y,O.m,O.d,S),P=t(O,1,S);let C=N,B=P;switch(M.kind){case"today":break;case"yesterday":C=t(O,-1,S),B=N;break;case"lastNDays":B=Z.includeToday?P:N,C=t(O,Z.includeToday?-(M.n-1):-M.n,S);break;case"thisWeek":{const x=Number.isFinite(Z.weekStartsOn)?Number(Z.weekStartsOn):1,Y=(new Date(Date.UTC(O.y,O.m-1,O.d)).getUTCDay()-x+7)%7;C=t(O,-Y,S),B=t(O,-Y+7,S);break}case"thisMonth":C=s(O.y,O.m,1,S),B=s(O.m===12?O.y+1:O.y,O.m===12?1:O.m+1,1,S);break;case"thisQuarter":case"quarterToDate":{const x=Math.floor((O.m-1)/3)*3+1;C=s(O.y,x,1,S),B=M.kind==="quarterToDate"?P:x===10?s(O.y+1,1,1,S):s(O.y,x+3,1,S);break}case"thisYear":case"yearToDate":C=s(O.y,1,1,S),B=M.kind==="yearToDate"?P:s(O.y+1,1,1,S);break;default:return null}return{from:new Date(C).toISOString(),to:new Date(B).toISOString(),bounds:"[)",tz:S,relative:M.kind==="lastNDays"?`last${M.n}Days`:M.kind,n:M.n}}function n(G){if(!G||typeof G!="object")return null;const Z=G.value;if(Z&&typeof Z=="object"&&!Array.isArray(Z)&&"relative"in Z)return{token:String(Z.relative),n:typeof Z.n=="number"?Z.n:void 0};if(G.op==="relative"&&typeof G.value=="string")return{token:G.value,n:void 0};const M=G.meta;return M&&typeof M.relative=="string"&&G.value===void 0?{token:M.relative,n:typeof M.n=="number"?M.n:void 0}:null}function p(){return`Known tokens: ${o.filter(Z=>Z!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function i(G){const Z=n(G);return Z?c(Z.token,Z.n)!==null:!1}function r(G,Z={}){const M=n(G);if(!M)return G;const S=d(M.token,{...Z,n:M.n});return S?{...G,type:G.type||"date",op:"between",value:[S.from,S.to],bounds:G.bounds||S.bounds,meta:{...G.meta||{},relative:S.relative,tz:S.tz}}:(E(`source.relative.${M.token}`,`unknown relative date token "${M.token}"; sending the condition unresolved.`,p()),G)}function f(G){return!!G&&typeof G=="object"&&Array.isArray(G.conditions)}function m(G,Z){if(G){if(f(G)){for(const M of G.conditions)m(M,Z);return}Z(G)}}function u(G,Z){if(!G)return null;if(!f(G))return Z(G);const M=G;let S=!1;const T=[];for(const O of M.conditions){const N=u(O,Z);N!==O&&(S=!0),N&&T.push(N)}return!S&&T.length===M.conditions.length?G:T.length?{...M,conditions:T}:null}function b(G){if(!G)return null;if(!f(G))return G;const Z=G,M=[];for(const S of Z.conditions){const T=b(S);T&&M.push(T)}return M.length?{op:Z.op,conditions:M}:null}function a(G){const Z=b(G);return Z?f(Z)&&Z.op==="and"?Z:{op:"and",conditions:[Z]}:null}function h(G){const Z=(G||[]).filter(Boolean);return Z.length?{op:"and",conditions:Z}:null}function w(G,Z={}){const M=u(G,S=>r(S,Z));return a(M)}function v(G){const Z=A(G.filters??null);return JSON.stringify([Z,G.sort??null,G.quick??"",G.groupBy??null,G.pivotBy??null,H(G.context)])}function A(G){if(!G)return null;if(f(G)){const S=G;return{op:S.op,conditions:S.conditions.map(A)}}const Z=G,M=Z.meta&&typeof Z.meta.relative=="string"?Z.meta.relative:n(Z)?.token;return{col:Z.col,op:Z.op,bounds:Z.bounds??null,caseSensitive:Z.caseSensitive??!1,value:M?`rel:${M}`:Z.value??null}}function H(G){if(G==null)return null;try{return JSON.parse(JSON.stringify(G))}catch{return E("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),ze("packages/core/src/source/tree.js",function(e,_){"use strict";Object.defineProperty(e,"SYNTHETIC",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"buildFromPath",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"assignLevels",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resolveTree",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"buildTree",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"indexTree",{enumerable:!0,get:function(){return l}});const E=_("packages/core/src/internal/predicates.js").isFunction,U=_("packages/core/src/internal/warn.js").warnOnce,D="",J="\0tree:";function z(g,s){return{physical:g,key:s,level:0,children:[],value:void 0}}function L(g,s){const t=[],o=new Map;for(let c=0;c<g.length;c++){const d=g[c],n=s.pathOf(d),p=Array.isArray(n)?n.map(r=>String(r)):[];if(!p.length){const r=z(d,s.keyOf(d));t.push(r);continue}let i=null;for(let r=0;r<p.length;r++){const f=p.slice(0,r+1).join(D),m=r===p.length-1;let u=o.get(f);u&&m&&u.physical===-1&&(u.physical=d,u.key=s.keyOf(d)),u||(u=z(m?d:-1,m?s.keyOf(d):J+f),u.level=r,u.value=p[r],o.set(f,u),i?i.children.push(u):t.push(u)),i=u}}return{roots:t,nodes:o}}function X(g,s){const t=new Map,o=[];for(let p=0;p<g.length;p++){const i=g[p],r=s.keyOf(i),f=z(i,r);t.set(r,f);const m=s.parentOf(i);m!=null&&m!==""&&o.push({node:f,parent:String(m)})}let c=null;const d=new Map;for(const{node:p,parent:i}of o){const r=t.get(i);if(r){d.set(p.key,r);continue}s.orphans&&s.orphans!=="root"&&(c||(c=z(-1,`${J}orphans`),c.value=s.orphans),d.set(p.key,c))}const n=[];for(const p of t.values()){const i=d.get(p.key);i?i.children.push(p):n.push(p)}return c&&c.children.length&&n.push(c),{roots:I(n,t,s.orphans,c),nodes:t}}function I(g,s,t,o){const c=new Set,d=[...g];for(;d.length;){const f=d.pop();if(!c.has(f.key)){c.add(f.key);for(const m of f.children)d.push(m)}}const n=[];for(const f of s.values())c.has(f.key)||n.push(f);if(!n.length)return g;const p=!!t&&t!=="root";U("tree.cycle",`tree.parentKey produced ${n.length} row(s) inside a parent cycle; `+(p?`they are shown under "${t}".`:"they are shown at the root."));for(const f of n)f.children=f.children.filter(m=>c.has(m.key));if(!p)return[...g,...n];let i=o;const r=[...g];return i||(i=z(-1,`${J}orphans`),i.value=t,r.push(i)),i.children.push(...n),r}function j(g){let s=0;const t=(o,c)=>{for(const d of o)d.level=c,c>s&&(s=c),d.children.length&&t(d.children,c+1)};return t(g,0),s}function k(g,s){if(!g||typeof g!="object")return null;const t=g.path,o=g.parentKey,c=E(g.hasChildren)?d=>!!g.hasChildren(s.dataAt(d)):null;if(E(t))return{mode:"path",pathOf:d=>t(s.dataAt(d)),keyOf:s.keyOf,declaresChildren:c};if(o!=null){const d=E(o)?o:n=>n?.[o];return{mode:"parentKey",parentOf:n=>d(s.dataAt(n)),keyOf:s.keyOf,orphans:g.orphans||"root",declaresChildren:c}}return U("tree.shape","tree is configured with neither `path` nor `parentKey`; rows stay flat."),null}function y(g,s){const t=s.mode==="path"?L(g,s):X(g,s),o=j(t.roots);return{...t,depth:o}}function l(g,s){const t=new Map,o=c=>{for(let d=0;d<c.length;d++){const n=c[d];if(n.physical>=0){const p=s?s(n.physical):!1,i=p&&n.children.length===0;t.set(n.physical,{level:n.level,posinset:d+1,setsize:c.length,hasChildren:n.children.length>0||p,lazy:i})}n.children.length&&o(n.children)}};return o(g),t}}),ze("packages/core/src/source/settle.js",function(e,_){"use strict";Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return E}});const ne=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function E(K){const U=K&&typeof K=="object"?K.reason:null;return typeof U=="string"&&ne.includes(U)}}),ze("packages/core/src/source/memory.js",function(e,_){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"quickMatcher",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"MemorySource",{enumerable:!0,get:function(){return Y}});const E=_("packages/core/src/internal/lru.js").Lru,K=_("packages/core/src/internal/warn.js"),U=K.warnOnce,D=K.fail,z=_("packages/core/src/internal/predicates.js").isFunction,X=_("packages/core/src/internal/compare.js").defaultCompare,j=_("packages/core/src/internal/merge.js").mergeRow,k=_("packages/core/src/source/rows.js"),y=k.createRowFactory,l=k.groupKey,g=k.groupPathElement,s=k.groupPrefixKeys,t=k.lazyRowView,c=_("packages/core/src/source/handles.js").createHandleProvider,d=_("packages/core/src/compute/incremental.js"),n=d.RunningTotal,p=d.isIncremental,r=_("packages/core/src/compute/handle.js").presenceReader,f=_("packages/core/src/source/filterwire.js"),m=f.querySignature,u=f.mapConditions,b=f.resolveRelativeCondition,a=_("packages/core/src/source/tree.js"),h=a.buildTree,w=a.resolveTree,v=a.indexTree,A=_("packages/core/src/source/settle.js"),H=A.PIPELINE_SETTLE_REASONS,G=A.isPipelineSettle,Z=Object.freeze(["filter","sort","group","total","pivot","flatten"]),M=Object.freeze([]);function S(F,$){if(!F)return null;const q=$==="grand"?F.grandTotal:F.groupTotal;return q??F.total}function T(F){return!!F&&!F.running}function O(F){if(F)return F.value&&z(F.value.compare)?F.value.compare:z(F.compare)?F.compare:void 0}function N(F){const $=F&&F.dataType;return!$||!z($.items)?null:{items:$.items,type:F.itemType&&F.itemType.name||"text"}}function P(F){return!!F&&(typeof F=="object"||typeof F=="function")&&z(F.then)}const C=new Uint32Array(0),B=4096;function x(F,$){return new Y(F,$)}function V(F,$){if($==="regex")try{const q=new RegExp(F,"iu");return ee=>q.test(ee)}catch{return q=>q.includes(F)}if($==="fuzzy"){const q=[...F].filter(ee=>ee!==" ");return q.length?ee=>{let te=0;for(let re=0;re<ee.length&&te<q.length;re++)ee[re]===q[te]&&te++;return te===q.length}:()=>!0}if($==="words"){const q=F.split(/\s+/).filter(Boolean);return q.length?ee=>q.every(te=>ee.includes(te)):()=>!0}return q=>q.includes(F)}class Y{mode="memory";#e;#t;#n;#r=!1;#s=null;#i;#o;#l=new Map;#a=!1;#c=0;#u=0;#d=new Map;#f=new Map;#h;#p=null;#m=Y.#g();static#g(){return{slots:[],groupHeadings:M,unnumbered:M,pivot:null,inlineLeaves:null,matchCount:0,grand:null,grandLeaves:0,groupLeaves:null}}#b=new Map;#y=null;#S=new Map;#w=-1;#A=[];#v=new Map;#P=-1;#O=[];#C=null;#E=null;#T=null;#M=null;#N=null;#R=null;#F=null;#W=null;#V=Symbol("unset");#x=new Map;#q=null;get#_(){return this.#m.slots}set#_($){this.#m.slots=$}get#Y(){return this.#m.inlineLeaves}set#Y($){this.#m.inlineLeaves=$}get#G(){return this.#m.groupHeadings}set#G($){this.#m.groupHeadings=$}get#I(){return this.#m.unnumbered}set#I($){this.#m.unnumbered=$}get#U(){return this.#m.pivot}set#U($){this.#m.pivot=$}constructor($,q){this.#t=$||{mode:"memory"},this.#e=q||{};const ee=this.#e.config||{};this.#n=this.#t.rows||ee.rows||[],this.#i=y(this.#e),this.#o=c(this.#e,()=>this.#n,()=>this.#r),this.#h=new E(Number(ee.rowCacheSize)||B);for(const te of Z)this.#l.set(te,{key:null,result:null,id:0,computed:!1})}count(){this.#B();const $=this.#ye();return $?$.length:this.#_.length}#ye(){const $=Number(this.#z("pageSize",0))||0;if($<=0)return null;const q=this.#_.length,ee=Math.max(1,Math.ceil(q/$)),re=Math.min(Math.max(0,Number(this.#z("page",0))||0),ee-1)*$;return{offset:re,length:Math.max(0,Math.min($,q-re))}}pageInfo(){this.#B();const $=Number(this.#z("pageSize",0))||0,q=this.#_.length;if($<=0)return{page:0,pageSize:0,total:q,pageCount:1};const ee=Math.max(1,Math.ceil(q/$));return{page:Math.min(Math.max(0,Number(this.#z("page",0))||0),ee-1),pageSize:$,total:q,pageCount:ee}}totalCount(){return this.#j().length}matchCount(){return this.#B(),this.#m.matchCount}at($){this.#B();const q=this.#ye();if(q)return $<0||$>=q.length?void 0:this.#Ee(q.offset+$,$);if(!($<0||$>=this.#_.length))return this.#Ee($,$)}byKey($){this.#B(),this.#p||this.#se();const q=this.#p.get($);if(q!==void 0)return this.#ae(q);for(let ee=0;ee<this.#_.length;ee++){const te=this.#_[ee];if(typeof te!="number"&&te&&te.key===$)return this.#Ee(ee)}}loaded($){return $>=0&&$<this.count()}hint($,q){}display(){return this.#B(),this.#q||(this.#q=this.#Fe()),this.#q}invalidateQuickText(){this.#x.clear(),this.invalidate("filter")}invalidate($){const q=Z.indexOf($);q<0&&D(`unknown pipeline stage "${$}"; expected one of ${Z.join(", ")}`);for(let ee=q;ee<Z.length;ee++){const te=this.#l.get(Z[ee]);te.key=null,te.computed=!1}this.#q=null}apply($){const q=[],ee={added:[],updated:[],removed:[],rejected:q};if(!$)return ee;let te=!1;const re=new Set;if($.remove&&$.remove.length)for(const ie of $.remove){const ue=this.#Le(ie);if(ue===void 0){q.push({operation:"remove",id:this.#me(ie),reason:"unknown-id"});continue}ee.removed.push(this.#i.keyOf(this.#r?this.#Pe(ue):this.#n[ue],ue)),this.#r||(this.#n[ue]=void 0),this.#h.delete(ue),this.#x.delete(ue),te=!0}if($.update&&$.update.length){const ie=this.#S.size||this.#vt()?this.#Ge():null,ue=this.#v.size?this.#lt():null,Ae=ue&&ue.length?this.#Ge():null;for(const de of $.update){const Oe=this.#Le(de);if(Oe===void 0){q.push({operation:"update",id:this.#Me(de),reason:"unknown-id"});continue}const Me=this.#r?this.#s&&this.#s.has(Oe)?this.#s.get(Oe):this.#Pe(Oe):this.#n[Oe],Fe=j(Me,de);for(const pe of this.#$e(Me,Fe))re.add(pe);if(this.#r||(this.#n[Oe]=Fe),ie&&this.#Qe(ie,Oe,Me,Fe),Ae&&this.#yt(ue,Ae,Oe,Me,Fe),this.#p){const pe=this.#i.keyOf(Me,Oe),ae=this.#i.keyOf(Fe,Oe);pe!==ae&&(this.#p.delete(pe),this.#p.set(ae,Oe))}this.#h.delete(Oe),this.#x.delete(Oe),ee.updated.push(this.#ae(Oe))}}if($.add&&$.add.length&&this.#r){typeof $.at=="number"&&$.at<this.#ct()&&(this.#h.clear(),this.#x.clear()),this.#p=null;for(const ie of $.add){const ue=this.#je(this.#Me(ie));ue!==void 0&&ee.added.push(this.#ae(ue))}te=!0}else if($.add&&$.add.length){let ie=typeof $.at=="number"?$.at:this.#n.length;if(ie<this.#n.length){let de=0;for(let Oe=0;Oe<this.#n.length;Oe++)this.#n[Oe]!==void 0&&de++;if(de!==this.#n.length){let Oe=0;for(let Me=0;Me<this.#n.length;Me++)this.#n[Me]!==void 0&&(this.#n[Oe++]=this.#n[Me]);this.#n.length=Oe,this.#p=null,this.#h.clear(),this.#x.clear()}}const ue=this.#n.length;ie=Math.max(0,ie);let Ae=$.add===this.#n?$.add.slice():$.add;if(this.#i.keyed){const de=[];for(const Oe of Ae){const Me=this.#Me(Oe);if(this.#Le(Me)!==void 0){q.push({operation:"add",id:Me,reason:"duplicate-id"});continue}de.push(Oe)}de.length!==Ae.length&&(Ae=de)}if(!Ae.length)return ee;if(ie>=ue)for(let de=0;de<Ae.length;de++)this.#n.push(Ae[de]);else this.#n.splice(ie,0,...Ae),this.#h.clear(),this.#x.clear();for(let de=0;de<Ae.length;de++)ee.added.push(this.#ae(ie>=ue?ue+de:ie+de));te=!0}return this.#c++,te&&(this.#p=null,this.#Ze()),this.#o.invalidate(),this.#q=null,te||this.#H(re)?(this.#u++,this.invalidate("filter")):this.invalidate("total"),this.#ut("rows:changed",{companion:!0,added:ee.added.length,updated:ee.updated.length,removed:ee.removed.length}),this.#s=null,ee}groupHeadingsAt($){this.#B();const q=this.#G;if(!q.length||!Number.isInteger($)||$<0)return M;let ee=0,te=q.length-1,re=-1;for(;ee<=te;){const ue=ee+te>>1;q[ue].at<=$?(re=ue,ee=ue+1):te=ue-1}if(re<0)return M;const ie=[];for(let ue=q[re].row;ue;ue=ue.parent)ie.push(ue);return ie.reverse(),ie}unnumberedRowCount($){this.#B();const q=this.#I;if(!q.length||!Number.isInteger($)||$<0)return 0;let ee=0,te=q.length-1,re=-1;for(;ee<=te;){const ie=ee+te>>1;q[ie].at<=$?(re=ie,ee=ie+1):te=ie-1}return re+1}moveRow($,q){if(this.#r)return U("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($)||!Number.isInteger(q))return!1;let te=0;for(let ue=0;ue<ee.length;ue++)ee[ue]!==void 0&&te++;if($<0||$>=te)return!1;const re=Math.max(0,Math.min(te-1,q));if(re===$)return!1;if(te!==ee.length){let ue=0;for(let Ae=0;Ae<ee.length;Ae++)ee[Ae]!==void 0&&(ee[ue++]=ee[Ae]);ee.length=ue}const[ie]=ee.splice($,1);return ee.splice(re,0,ie),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#x.clear(),this.#Ze(),this.#o.invalidate(),this.#q=null,this.invalidate("filter"),this.#ut("rows:changed",{companion:!0,added:0,updated:0,removed:0,moved:1}),!0}reload($){this.#ce(),this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#Ze(),this.#o.invalidate(),this.invalidate("filter"),this.#ut("model:changed",{reason:"reload"})}destroy(){this.#ce(),this.#h.clear(),this.#x.clear(),this.#p=null,this.#_=[],this.#Y=null,this.#q=null,this.#Ze();for(const $ of Z)this.#l.set($,{key:null,result:null,id:0,computed:!1})}#ce(){for(const{controller:$}of this.#b.values())try{$.abort()}catch{}this.#b.clear()}setRows($){this.#n=$||[],this.#r=!1,this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#Ze(),this.#o.invalidate(),this.invalidate("filter")}notePriorRows($){this.#s=$||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#x.clear(),this.#o.invalidate()}data(){if(!this.#r)return this.#n;const $=this.#e.store;if(!$||!z($.source))return this.#n;const q=$.physical||0,ee=new Array(q);for(let te=0;te<q;te++)ee[te]=$.live&&!$.live(te)?void 0:$.source(te);return ee}#ue(){const $=this.#z("detail",null);return!$||!z($.isOpen)||$.inline===!1?null:$}#Ne(){const $=(this.#e.config||{}).tree;return this.#V!==$&&(this.#V=$,this.#W=w($,{dataAt:q=>this.#Pe(q),keyOf:q=>this.#i.keyOf(this.#Pe(q),q)})),this.#W}#ie(){return(this.#e.config||{}).grandTotalRow==="bottom"}grandTotalRow(){if(!this.#ie())return null;this.#B();const $=this.#m.grand;return $?this.#i.grandTotal($,this.#qe(this.#m.grandLeaves)):null}pivot(){return this.#B(),this.#U}pivotMatrix(){this.#B();const $=this.#m.groupLeaves,q=(this.#e.compute||{}).pivotMatrix;if(!z(q))return null;const ee=this.#z("groupBy",[]),te=this.#z("pivotBy",[]);if(!ee.length&&!te.length)return U("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 re=this.#Ge().map(ue=>({colId:ue.id,handle:this.#o.handle(ue.id),fn:S(ue,"group")})).filter(ue=>ue.handle&&ue.fn),ie=this.#e.config||{};return q({rowHandles:ee.map(ue=>this.#o.handle(ue)).filter(Boolean),columnHandles:te.map(ue=>this.#o.handle(ue)).filter(Boolean),measures:re,leaves:$||new Uint32Array(0),opts:{locale:ie.locale,separator:(ie.pivot||{}).separator,maxColumns:(ie.pivot||{}).maxColumns}})}keysForLeaves($){const q=[];if(!$)return q;for(let ee=0;ee<$.length;ee++){const te=this.#ae($[ee]);te&&te.key!=null&&q.push(String(te.key))}return q}leavesOf($){this.#B();const q=this.#l.get("group"),ee=q&&q.result;if(!ee||!ee.nodes)return[];const te=ee.nodes.get($);if(!te)return[];const re=[],ie=ue=>{const Ae=ue.row&&ue.row.children;if(Ae&&Ae.length){for(const de of Ae){const Oe=ee.nodes.get(de.key);Oe&&ie(Oe)}return}if(ue.leaves)for(let de=0;de<ue.leaves.length;de++)re.push(this.#ae(ue.leaves[de]))};return ie(te),re}#me($){return typeof $=="string"?$:this.#Me($)}#Me($){try{return this.#i.keyOf($,-1)}catch{return"(unkeyed)"}}#Le($){if(typeof $=="string")return this.#je($);if(this.#i.keyed){const ee=this.#i.keyOf($,-1),te=this.#je(ee);if(te!==void 0)return te}if(this.#r)return;const q=this.#n.indexOf($);return q>=0?q:void 0}#je($){return this.#p||this.#se(),this.#p.get($)}#se(){this.#p=new Map;const $=this.#ct(),q=this.#e.store,ee=q&&z(q.live)?te=>q.live(te):null;for(let te=0;te<$;te++){if(ee&&!ee(te))continue;const re=this.#Pe(te);re!==void 0&&this.#p.set(this.#i.keyOf(re,te),te)}}#$e($,q){const ee=[];for(const te of this.#J())this.#Ke(te)&&this.#oe(te,$,q,new Set)&&ee.push(te);return ee}#oe($,q,ee,te){if(te.has($))return!1;te.add($);const re=this.#Ke($);if(!re)return!1;const ie=re.value&&re.value.deps;return Array.isArray(ie)&&ie.length?ie.some(ue=>this.#oe(String(ue),q,ee,te)):z(re.getValue)?!Object.is(re.getValue(q),re.getValue(ee)):!1}#J(){const $=new Set;for(const ee of this.#z("sort",[]))$.add(ee.col);for(const ee of this.#z("groupBy",[]))$.add(ee);const q=ee=>{if(ee){if(Array.isArray(ee.conditions)){ee.conditions.forEach(q);return}ee.col&&$.add(ee.col)}};return q(this.#z("filters",null)),[...$]}#H($){if(!$.size)return!1;if(this.#z("quick",""))return!0;for(const q of this.#J())if($.has(q))return!0;return!1}#B(){if(!this.#a){this.#a=!0;try{this.#Q()}finally{this.#a=!1}}}pipelineRunning(){return this.#a}#Q(){const $=this.#pe("filter",()=>this.#Z(),()=>this.#k()),q=this.#de($),ee=this.#pe("group",()=>this.#K(),()=>this.#We(q)),te=this.#pe("total",()=>this.#D(),()=>this.#Xe(ee));this.#pe("pivot",()=>this.#ve(),()=>this.#kt(ee)),this.#pe("flatten",()=>this.#Ae(),()=>this.#Mt(ee)),this.#he(ee,te)}#de($){const q=this.#l.get("sort"),ee=this.#ne();if(q.computed&&q.key===ee&&!this.#b.has("sort"))return q.result;const te=this.#b.get("sort");return te&&te.key===ee?q.result:q.result&&this.#ge($)?(this.#ke($,ee),q.result):this.#pe("sort",()=>ee,()=>this.#Ce($))}#le(){if(this.#y===null){const $=this.#e.pipelineWorker,q=z($)?$():null;this.#y=q||!1}return this.#y||null}#we(){const $=this.#z("sort",[]);if(!Array.isArray($)||!$.length)return null;const q=(this.#e.config||{}).locale,ee=[],te=[];for(const re of $){const ie=this.#Ke(re.col);if(ie&&ie.running)continue;if(ie&&ie.value&&z(ie.value.compare))return null;const ue=this.#o.handle(re.col);if(!ue)return null;ee.push({col:re.col,descending:re.dir==="desc",nullsFirst:!!re.nullsFirst,locale:q}),te.push(ue)}return ee.length?{entries:ee,handles:te,locale:q}:null}#ge($){if(this.#re())return!1;const q=this.#le();if(!q)return!1;const ee=Number(q.threshold);return Number.isFinite(ee)&&$.length<ee?!1:!!this.#we()}#ke($,q){const ee=this.#le(),te=ee&&this.#we();if(!te){this.#pe("sort",()=>q,()=>this.#Ce($));return}const re=new AbortController;this.#b.set("sort",{key:q,controller:re});const ie=te.entries.length===1?ee.sortColumn(te.handles[0],$,{descending:te.entries[0].descending,nullsFirst:te.entries[0].nullsFirst,locale:te.locale,signal:re.signal,key:"sort"}):ee.sortMulti(te.handles,te.entries.map((ue,Ae)=>({...ue,handle:te.handles[Ae]})),$,{signal:re.signal,key:"sort"});if(!P(ie)){this.#b.delete("sort"),this.#pe("sort",()=>q,()=>ie);return}ie.then(ue=>this.#De(q,ue),ue=>this.#fe("sort",q,ue))}#De($,q){const ee=this.#b.get("sort");if(!(!ee||ee.key!==$)){if(this.#ne()!==$){this.#b.delete("sort");return}this.#b.delete("sort"),this.#pe("sort",()=>$,()=>q),this.#q=null,this.#B(),this.#ut("model:changed",{reason:H[0]})}}#fe($,q,ee){const te=this.#b.get($);if(!(!te||te.key!==q)&&(this.#b.delete($),!(ee&&ee.name==="AbortError")&&$==="sort"&&this.#ne()===q)){const re=this.#pe("filter",()=>this.#Z(),()=>this.#k());this.#pe("sort",()=>q,()=>this.#Ce(re)),this.#q=null,this.#B(),U("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",ee),this.#ut("model:changed",{reason:H[1]})}}#he($,q){const ee=$&&$.leaves?$.leaves.length:this.#m.slots.length;this.#m.matchCount=ee,this.#m.grand=q&&q.grand||null,this.#m.grandLeaves=$&&$.leaves?$.leaves.length:0,this.#m.groupLeaves=$&&$.leaves?$.leaves:null}#pe($,q,ee){const te=this.#l.get($),re=q();return te.computed&&te.key===re||(te.result=ee(),te.key=re,te.computed=!0,te.id++,$==="flatten"&&(this.#q=null)),te.result}#$($){return this.#l.get($).id}#Z(){const $=(this.#e.config||{}).hostFilter,q=$&&z($.active)&&$.active()?1:0,ee=this.#z("where",null),te=ee?ee.version:0,re=this.#Ct("filter.sig",`${this.#nt()}`,()=>m({filters:this.#z("filters",null),quick:this.#z("quick",""),quickMode:this.#z("quickMode","contains")}));return`${this.#u}|${re}|${q}|${te}`}#ne(){const $=this.#re();return`${this.#$("filter")}|${JSON.stringify(this.#z("sort",[]))}`+($?`|manual:${$.version}`:"")}#re(){const $=this.#z("rowOrder",null);return $&&Array.isArray($.keys)?$:null}#_e($,q){this.#p||this.#se();const ee=this.#p,te=this.#ct(),re=q.keys.length,ie=new Float64Array(te);for(let ue=0;ue<te;ue++)ie[ue]=re+ue;for(let ue=0;ue<re;ue++){const Ae=ee.get(q.keys[ue]);Ae!==void 0&&(ie[Ae]=ue)}return Uint32Array.from($).sort((ue,Ae)=>ie[ue]-ie[Ae])}orderedKeys(){this.#p||this.#se();const $=this.#p,q=new Map;for(const[ue,Ae]of $)q.set(Ae,ue);const ee=Uint32Array.from([...q.keys()]).sort(),te=this.#re(),re=te?this.#_e(ee,te):this.#Ce(ee),ie=new Array(re.length);for(let ue=0;ue<re.length;ue++)ie[ue]=q.get(re[ue]);return ie}#K(){const $=this.#z("pivotBy",[]).length>0?"p":"u";return`${this.#$("sort")}|${JSON.stringify(this.#z("groupBy",[]))}|${$}`}#D(){const $=this.#te()?"f":"a",q=(this.#e.config||{}).totalOnlyChangedColumns?"n":"w";return`${this.#$("group")}|${JSON.stringify(this.#z("totals",[]))}|${$}${q}|${this.#c}`}#ve(){return`${this.#$("group")}|${JSON.stringify(this.#z("pivotBy",[]))}`}#Ae(){const q=this.#He()||!this.#ie()?this.#$("total"):"x",ee=`${this.#nt()}`,te=this.#Ct("flatten.keys",ee,()=>{const ie=this.#z("expanded",null);return ie?[...ie].sort().join(""):"*"}),re=this.#Ct("flatten.detail",ee,()=>{const ie=this.#z("detail",null);return ie&&z(ie.signature)?ie.signature():""});return`${q}|${this.#$("pivot")}|${te}|${re}`}#He(){const $=this.#z("groupBy",[]);return Array.isArray($)&&$.length>0}stageState(){const $=[];for(const[q,ee]of this.#l){const te=ee.result;$.push({stage:q,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 $}facetIndices($){return this.#k($||null)}facetRows($){const q=this.facetIndices($),ee=[];for(let te=0;te<q.length;te++){const re=this.#ae(q[te]);re&&ee.push(re)}return ee}invalidateRows(){this.#h.clear(),this.#x.clear(),this.#q=null}invalidateHandles(){this.#o.invalidate()}rows(){return this.#n}unfilteredIndices(){return this.#j()}filteredIndices(){const $=this.#l.get("filter");if($&&$.computed&&$.key===this.#Z())return $.result||this.#j();this.#B();const q=this.#l.get("filter");return(q&&q.computed?q.result:null)||this.#j()}unfilteredRows(){const $=this.#j(),q=[];for(let ee=0;ee<$.length;ee++){const te=this.#ae($[ee]);te&&q.push(te)}return q}#k($=null){const q=this.#j(),ee=this.#z("filters",null),te=$?this.#rt("pruneColumn")(ee,$):ee,re=this.#Rt(te),ie=String(this.#z("quick","")||"").trim().toLowerCase(),ue=ie?V(ie,String(this.#z("quickMode","contains")||"contains")):null,Ae=(this.#e.config||{}).hostFilter,de=!!(Ae&&z(Ae.active)&&Ae.active()),Oe=this.#z("where",null),Me=!!(Oe&&Oe.active);if(!re&&!ie&&!de&&!Me)return q;let Fe=null;re&&(Fe=this.#rt("evaluateFilters")(re,{handle:ve=>this.#o.handle(ve),count:this.#ct(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:ve=>N(this.#Ke(ve))}));const pe=new Uint32Array(q.length);let ae=0;for(let ge=0;ge<q.length;ge++){const ve=q[ge];if(!(Fe&&!Fe[ve])&&!(ue&&!this.#ot(ve,ue))){if(de||Me){const le=this.#ae(ve);if(de&&!Ae.passes(le)||Me&&!Oe.passes(le.data,le.key))continue}pe[ae++]=ve}}if(Fe){const ge=(this.#e.compute||{}).releaseMask;z(ge)&&ge({pool:this.#e.pool},Fe)}return pe.subarray(0,ae)}handleFor($){return this.#o.handle($)}#Ce($){const q=this.#re();if(q)return this.#_e($,q);const ee=this.#z("sort",[]).filter(ie=>{const ue=this.#Ke(ie.col);return!ue||!ue.running?!0:(U(`source.sort.running.${ie.col}`,`sort ignores "${ie.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 $;const te=(this.#e.config||{}).locale;if(ee.length===1){const ie=ee[0],ue=this.#o.handle(ie.col);if(!ue)return U(`source.sort.${ie.col}`,`sort ignores unknown column "${ie.col}".`),$;const Ae=this.#Ke(ie.col);return this.#rt("sortColumn")(ue,$,{descending:ie.dir==="desc",nullsFirst:ie.nullsFirst,locale:te,compare:O(Ae)})}const re=[];for(const ie of ee){const ue=this.#o.handle(ie.col);if(!ue){U(`source.sort.${ie.col}`,`sort ignores unknown column "${ie.col}".`);continue}re.push({handle:ue,descending:ie.dir==="desc",nullsFirst:ie.nullsFirst,locale:te,compare:O(this.#Ke(ie.col))})}return re.length?this.#rt("sortMulti")(re.map(ie=>ie.handle),re,$):$}#We($){const q=this.#z("groupBy",[]),ee=this.#Ne();if(ee&&!q.length){const ge=h($,ee);return this.#R=v(ge.roots,ee.declaresChildren),{roots:null,leaves:$,nodes:new Map,tree:ge}}if(this.#R=null,ee&&q.length&&U("tree.grouped","grouping is active on a grid configured with `tree`; the grouping wins and the hierarchy is not shown."),!q.length)return{roots:null,leaves:$,nodes:new Map};const te=(this.#e.config||{}).timeZone,re=[],ie=[];let ue=!1;for(const ge of q){const ve=this.#o.handle(ge);if(!ve){U(`source.group.${ge}`,`grouping ignores unknown column "${ge}".`);continue}re.push(ve);const le=this.#Ke(ge),we=le&&le.dataType;if(we&&z(we.groupProjector)){const he=le.typeOptions&&le.typeOptions.timeZone||te||void 0,be=we.groupProjector(le,he);ie.push(be||null),be&&(ue=!0)}else ie.push(null)}if(!re.length)return{roots:null,leaves:$,nodes:new Map};const{keys:Ae,buckets:de}=this.#rt("groupByColumns")(re,$,{locale:(this.#e.config||{}).locale,project:ue?ie:void 0}),Oe=this.#z("pivotBy",[]).length>0,Me=[],Fe=new Map;for(let ge=0;ge<de.length;ge++){const ve=Ae[ge];let le=null;const we=[];for(let he=0;he<ve.length;he++){we.push(g(ve[he]));const be=l(we),Te=he===ve.length-1;let je=Fe.get(be);if(!je){const ke=this.#i.group({path:[...we],column:q[he],value:ve[he],level:he,parent:le,expanded:Oe&&Te?!1:this.#tt(be,{key:be,column:q[he],value:ve[he],level:he,path:[...we]}),hasChildren:!(Oe&&Te)});je={row:ke,leaves:null},Fe.set(be,je),le?le.children.push(ke):Me.push(ke)}je.row.leafCount+=de[ge].length,he===ve.length-1&&(je.leaves=de[ge]),le=je.row}}const pe=this.#z("sort",[])||[],ae=(ge,ve)=>{if(!ge||ge.length<2){if(ge)for(const be of ge)ae(be.children,ve+1);return}const le=q[ve],we=pe.find(be=>be.col===le),he=we&&we.dir==="desc"?-1:1;ge.sort((be,Te)=>he*X(be.groupValue,Te.groupValue));for(const be of ge)ae(be.children,ve+1)};return ae(Me,0),{roots:Me,leaves:$,nodes:Fe,keys:Ae,buckets:de}}#Ye($,q){const ee=new Map,te=new Map,re=ie=>{const ue=ie.physical>=0?[ie.physical]:[];for(const Ae of ie.children)ue.push(...re(Ae));if(ie.children.length){const Ae=this.#Je(q,Uint32Array.from(ue),null);ie.physical>=0?ee.set(ie.physical,Ae):te.set(ie.key,Ae)}return ue};for(const ie of $.roots)re(ie);return{byPhysical:ee,byKey:te}}#Xe($){const q=this.#Ge();if(!q.length)return this.#E=null,this.#T=null,{grand:null};const ee={id:this.#$("group"),columns:q.map(pe=>pe.id).join("")},te=this.#E&&this.#E.id===ee.id&&this.#E.columns===ee.columns,re=this.#vt()&&te?this.#C:null,ie=re?q.filter(pe=>re.has(pe.id)):q,ue=te?this.#T:null,Ae=this.#te()?null:this.#wt(),de=this.#Se(q),Oe=pe=>{const ae=$.nodes.get(pe.key);let ge=ae&&ae.leaves?ae.leaves:null;if(pe.children&&pe.children.length){const we=pe.children.map(Oe);let he=0;for(const je of we)he+=je.length;const be=new Uint32Array(he);let Te=0;for(const je of we)be.set(je,Te),Te+=je.length;ge=be}ge=ge||new Uint32Array(0);const ve=Ae?Ae.get(pe.key)||C:ge,le=this.#dt(pe,re?ie:q,ve,de);return pe.totals=re?{...pe.totals,...le}:le,ge};if($.roots&&ie.length)for(const pe of $.roots)Oe(pe);if(this.#F=$.tree?this.#Ye($.tree,q):null,this.#E=ee,this.#C=this.#vt()?new Set:null,!(this.#e.config||{}).grandTotalRow)return this.#A.length=0,this.#T=null,{grand:null};const Fe=Ae?this.#ft():$.leaves;return this.#T=this.#Be(q,Fe,re,ue),{grand:this.#T}}#Be($,q,ee,te){const re={},ie=this.#$("group");ie!==this.#w&&(this.#ht(),this.#w=ie);const ue=this.#A;this.#A=[];for(const Ae of $){if(!T(Ae))continue;const de=this.#o.handle(Ae.id);if(!de)continue;const Oe=S(Ae,"grand");if(!p(Oe,de)){if(ee&&!ee.has(Ae.id)&&te&&Ae.id in te){re[Ae.id]=te[Ae.id];continue}re[Ae.id]=this.#Je([Ae],q,null,"grand")[Ae.id];continue}let Me=this.#S.get(Ae.id);if((!Me||Me.fn!==Oe)&&(Me=new n(Oe),this.#S.set(Ae.id,Me)),Me.valid){let Fe=!0;for(const pe of ue)if(pe.colId===Ae.id&&!Me.update(pe.before,pe.after)){Fe=!1;break}if(Fe){re[Ae.id]=Me.value();continue}Me.invalidate()}Me.seedColumn(de.values,r(de),q),re[Ae.id]=Me.valid?Me.value():this.#Je([Ae],q,null,"grand")[Ae.id]}return re}#Se($){const q=this.#$("group");q!==this.#P&&(this.#v.clear(),this.#P=q);const ee=new Map;for(const re of $){if(!T(re))continue;const ie=this.#o.handle(re.id),ue=S(re,"group");p(ue,ie)&&ee.set(re.id,{fn:ue})}if(!ee.size)return this.#O.length=0,ee;const te=this.#O;this.#O=[];for(const re of te){const{beforeKeys:ie,afterKeys:ue,colDeltas:Ae}=re,de=ie.length?new Set(ie):null,Oe=ue.length?new Set(ue):null;for(const{colId:Me,before:Fe,after:pe}of Ae)if(ee.has(Me)){for(const ae of ie)Oe&&Oe.has(ae)||this.#Oe(ae,Me,Fe,null);for(const ae of ue)de&&de.has(ae)||this.#Oe(ae,Me,null,pe);for(const ae of ie)Oe&&!Oe.has(ae)||this.#Oe(ae,Me,Fe,pe)}}return ee}#Oe($,q,ee,te){const re=this.#v.get($),ie=re&&re.get(q);!ie||!ie.valid||ie.update(ee,te)||ie.invalidate()}#dt($,q,ee,te){if(!te||!te.size)return this.#Je(q,ee,$);const re={};let ie=null,ue=this.#v.get($.key);for(const Ae of q){const de=te.get(Ae.id);if(!de){(ie||(ie=[])).push(Ae);continue}const Oe=this.#o.handle(Ae.id);if(!Oe)continue;ue||(ue=new Map,this.#v.set($.key,ue));let Me=ue.get(Ae.id);if((!Me||Me.fn!==de.fn)&&(Me=new n(de.fn),ue.set(Ae.id,Me)),Me.valid||Me.seedColumn(Oe.values,r(Oe),ee),Me.valid){re[Ae.id]=Me.value();continue}(ie||(ie=[])).push(Ae)}return ie&&Object.assign(re,this.#Je(ie,ee,$)),re}#Qe($,q,ee,te){const re=!this.#te()||this.#et(q);for(const ie of $){const ue=ie.getValue;if(!z(ue))continue;const Ae=ue(ee),de=ue(te);Object.is(Ae,de)||(this.#C&&this.#C.add(ie.id),re&&this.#S.has(ie.id)&&this.#A.push({colId:ie.id,before:Ae,after:de}))}}#lt(){const $=this.#z("groupBy",[]),q=[];for(const ee of $){const te=this.#Ke(ee);te&&q.push(te)}return q}#Ve($,q){const ee=new Array($.length);for(let te=0;te<$.length;te++){const re=$[te].getValue;ee[te]=g(z(re)?re(q):void 0)}return ee}#yt($,q,ee,te,re){if(this.#te()&&!this.#et(ee))return;const ie=s(this.#Ve($,te)),ue=s(this.#Ve($,re)),Ae=ie.length!==ue.length||ie.some((Oe,Me)=>Oe!==ue[Me]),de=[];for(const Oe of q){const Me=Oe.getValue;if(!z(Me))continue;const Fe=Me(te),pe=Me(re);!Ae&&Object.is(Fe,pe)||de.push({colId:Oe.id,before:Fe,after:pe})}!de.length&&!Ae||this.#O.push({beforeKeys:ie,afterKeys:ue,colDeltas:de})}#et($){const q=this.#l.get("filter"),ee=q&&q.computed?q.result:null;if(!ee)return!0;let te=0,re=ee.length-1;for(;te<=re;){const ie=te+re>>1,ue=ee[ie];if(ue===$)return!0;ue<$?te=ie+1:re=ie-1}return!1}#te(){return(this.#e.config||{}).totalFilteredOnly!==!1}#qe($){return this.#te()?$:this.#ft().length}#ft(){return(!this.#M||this.#M.version!==this.#u)&&(this.#M={version:this.#u,indices:this.#j()}),this.#M.indices}#wt(){const $=this.#z("groupBy",[]),q=`${this.#u}|${JSON.stringify($)}`;if(this.#N&&this.#N.key===q)return this.#N.map;const ee=new Map,te=[];for(const re of $){const ie=this.#o.handle(re);ie&&te.push(ie)}if(te.length){const re=this.#ft(),{keys:ie,buckets:ue}=this.#rt("groupByColumns")(te,re,{locale:(this.#e.config||{}).locale}),Ae=new Map;for(let de=0;de<ue.length;de++){const Oe=ie[de],Me=[];for(let Fe=0;Fe<Oe.length;Fe++){Me.push(g(Oe[Fe]));const pe=l(Me);let ae=Ae.get(pe);ae||(ae=[],Ae.set(pe,ae));for(let ge=0;ge<ue[de].length;ge++)ae.push(ue[de][ge])}}for(const[de,Oe]of Ae)ee.set(de,Uint32Array.from(Oe))}return this.#N={key:q,map:ee},ee}#vt(){return!!(this.#e.config||{}).totalOnlyChangedColumns}#Ze(){this.#ht(),this.#ze(),this.#C=null,this.#E=null,this.#T=null}#ht(){this.#S.clear(),this.#A.length=0,this.#w=-1}#ze(){this.#v.clear(),this.#O.length=0,this.#P=-1}#kt($){const q=this.#z("pivotBy",[]);if(!q.length)return this.#U=null,null;const ee=(this.#e.compute||{}).pivot;if(!z(ee))return U("source.pivot.kernel","pivot requested but ctx.compute.pivot is not available; showing unpivoted rows."),this.#U=null,null;const te=q.map(ie=>this.#o.handle(ie)).filter(Boolean),re=this.#Ge();return this.#U=ee(te,$.leaves,{groups:$.keys&&$.buckets?{keys:$.keys,buckets:$.buckets}:null,totals:re.map(ie=>ie.id),handle:ie=>this.#o.handle(ie),totalOf:ie=>S(re.find(ue=>ue.id===ie),"group"),separator:((this.#e.config||{}).pivot||{}).separator,maxColumns:((this.#e.config||{}).pivot||{}).maxColumns})||null,this.#U}#Mt($){const q=this.#l.get("total").result,ee=!!(this.#e.config||{}).groupFooter,te=this.#ue();if($.tree)return this.#Re($,q,te);if(!$.roots&&!te){if(q&&q.grand&&!this.#ie()){const Oe=this.#i.grandTotal(q.grand,this.#qe($.leaves.length));if(this.#Y===$.leaves&&Array.isArray(this.#_))this.#_[this.#_.length-1]=Oe;else{const Me=Array.from($.leaves);Me.push(Oe),this.#_=Me,this.#Y=$.leaves}this.#I=[{at:this.#_.length-1}]}else this.#Y=null,this.#_=$.leaves,this.#I=M;return this.#G=M,this.#_}const re=[],ie=[],ue=[],Ae=Oe=>{if(re.push(Oe),!te)return;const Me=this.#ae(Oe);!Me||!te.isOpen(Me.key)||(Me.master=!0,Me.expanded=!0,ue.push({at:re.length}),re.push(this.#i.detail(Me,te.heightOf(Me))))};if(!$.roots){for(let Oe=0;Oe<$.leaves.length;Oe++)Ae($.leaves[Oe]);return q&&q.grand&&!this.#ie()&&(ue.push({at:re.length}),re.push(this.#i.grandTotal(q.grand,this.#qe($.leaves.length)))),this.#Y=null,this.#G=M,this.#I=ue.length?ue:M,this.#_=re,re}const de=(Oe,Me,Fe)=>{if(Oe.expanded=Oe.hasChildren===!1?!1:this.#tt(Oe.key,{key:Oe.key,column:Oe.groupColumn,value:Oe.groupValue,level:Oe.level,path:Oe.groupPath}),Oe.posinset=Me+1,Oe.setsize=Fe,ie.push({at:re.length,row:Oe}),ue.push({at:re.length}),re.push(Oe),!!Oe.expanded){if(Oe.children&&Oe.children.length)for(let pe=0;pe<Oe.children.length;pe++)de(Oe.children[pe],pe,Oe.children.length);else{const pe=$.nodes.get(Oe.key),ae=pe&&pe.leaves?pe.leaves:null;if(ae)for(let ge=0;ge<ae.length;ge++)Ae(ae[ge])}ee&&Oe.totals&&(ue.push({at:re.length}),re.push(this.#i.footer(Oe)))}};for(let Oe=0;Oe<$.roots.length;Oe++)de($.roots[Oe],Oe,$.roots.length);return q&&q.grand&&!this.#ie()&&(ue.push({at:re.length}),re.push(this.#i.grandTotal(q.grand,this.#qe($.leaves.length)))),this.#G=ie,this.#I=ue,this.#_=re,re}#j(){const $=this.#e.store;if($&&z($.liveIndices))return $.liveIndices();const q=new Uint32Array(this.#n.length);let ee=0;for(let te=0;te<this.#n.length;te++)this.#n[te]!==void 0&&(q[ee++]=te);return q.subarray(0,ee)}#ct(){const $=this.#e.store;return $&&typeof $.physical=="number"?$.physical:this.#n.length}#Pe($){const q=this.#e.store;return q&&z(q.source)?q.source($):this.#n[$]}#Ee($,q=$){const ee=this.#_[$];if(typeof ee!="number")return ee.index=q,ee;const te=this.#ae(ee);return te.index=q,te}#ae($){let q=this.#h.get($);q||(q=this.#i.leaf(this.#Pe($),$),this.#h.set($,q));const ee=this.#R?this.#R.get($):null;if(ee){q.level=ee.level,q.posinset=ee.posinset,q.setsize=ee.setsize,q.hasChildren=ee.hasChildren,q.expanded=ee.hasChildren&&!ee.lazy&&this.#tt(q.key);const te=this.#F?this.#F.byPhysical.get($):void 0;te?q.totals=te:q.totals&&(q.totals=null)}else q.hasChildren&&(q.level=0,q.hasChildren=!1,q.expanded=!1,q.posinset=void 0,q.setsize=void 0);return q}#Re($,q,ee){const te=[],re=[],ie=Ae=>{if(Ae.leafCount!==void 0)return Ae.leafCount;let de=Ae.physical>=0?1:0;for(const Oe of Ae.children)de+=ie(Oe);return Ae.leafCount=de,de},ue=Ae=>{const de=this.#tt(Ae.key);if(Ae.physical>=0){if(te.push(Ae.physical),ee&&ee.isOpen(this.#ae(Ae.physical).key)){const Oe=this.#ae(Ae.physical);re.push({at:te.length}),te.push(this.#i.detail(Oe,ee.heightOf(Oe)))}}else te.push(this.#i.group({path:[Ae.key],column:null,value:Ae.value,level:Ae.level,parent:null,expanded:de,hasChildren:Ae.children.length>0,leafCount:ie(Ae),totals:this.#F?this.#F.byKey.get(Ae.key):void 0}));if(de)for(const Oe of Ae.children)ue(Oe)};for(const Ae of $.tree.roots)ue(Ae);return q&&q.grand&&!this.#ie()&&(re.push({at:te.length}),te.push(this.#i.grandTotal(q.grand,this.#qe($.leaves.length)))),this.#Y=null,this.#G=M,this.#I=re.length?re:M,this.#_=te,te}#Fe(){return t(()=>this.count(),$=>this.at($))}#ot($,q){let ee=this.#x.get($);if(ee===void 0){const te=this.#Pe($),re=this.#mt(),ie=[],ue=this.#e.columnHidden;for(const Ae of re){if(Ae.quickFilter===!1||z(ue)&&ue(Ae.id))continue;const de=Ae.value&&z(Ae.value.quickFilterText)?Ae.value.quickFilterText({value:void 0,data:te,row:null,column:Ae,colId:Ae.id,grid:null,context:this.#z("context",null)}):null,Oe=de??(z(Ae.formatValue)?Ae.formatValue(z(Ae.getValue)?Ae.getValue(te):void 0):"");Oe!=null&&Oe!==""&&ie.push(String(Oe))}ee=ie.join(" ").toLowerCase(),this.#x.set($,ee)}return q(ee)}#Ge(){const $=this.#z("totals",[]),q=$&&$.length?new Set($):null;return this.#mt().filter(ee=>q?q.has(ee.id):!!(ee.total||ee.groupTotal||ee.grandTotal))}#Je($,q,ee,te="group"){const re={},ie=(this.#e.compute||{}).total;for(const ue of $){if(!T(ue))continue;const Ae=this.#o.handle(ue.id);if(!Ae)continue;const de=S(ue,te);if(de)if(z(de)){const Oe=new Array(q.length);for(let Me=0;Me<q.length;Me++)Oe[Me]=Ae.get(q[Me]);re[ue.id]=de(Oe,{row:ee,column:ue,grid:this.#e.grid||null,context:this.#z("context",null),valueAt:(Me,Fe)=>{const pe=this.#o.handle(Me);return pe&&Fe>=0&&Fe<q.length?pe.get(q[Fe]):null}})}else z(ie)&&(re[ue.id]=ie(Ae,q,de))}return re}#Rt($){if(!$)return $;const q=this.#e.config||{},ee={tz:q.timeZone,weekStartsOn:q.weekStartsOn};return u($,te=>{const re=b(te,ee),ie=this.#Ke(re&&re.col),ue=ie&&ie.type==="datetime";if(re&&re.type)return re.type==="datetime"&&!re.timeZone&&ie?{...re,timeZone:q.timeZone||void 0}:re;if(ue)return{...re,type:"datetime",timeZone:q.timeZone||void 0};const Ae=ie&&(ie.dataType?.base||ie.type);return Ae?{...re,type:Ae}:re})}#tt($,q){const ee=this.#z("expanded",null);return ee?z(ee.has)?ee.has($,q):Array.prototype.includes.call(ee,$):!0}#z($,q){if($==="context"||!z(this.#e.stateVersion))return this.#jt($,q);const ee=this.#pt($),te=this.#d.get($);if(te&&te.version===ee)return te.value;const re=this.#jt($,q);return this.#d.set($,{version:ee,value:re}),re}#jt($,q){const ee=this.#e.state;if(ee&&z(ee[$])){const te=ee[$]();return te??q}return q}#nt(){const $=this.#e.stateVersion;return z($)?$():0}#It(){const $=this.#e.columnsVersion,q=this.#e.permissionsVersion;return`${z($)?$():0}|${z(q)?q():0}`}#pt($){return $==="totals"?this.#It():`${this.#nt()}`}#Ct($,q,ee){if(!z(this.#e.stateVersion))return ee();const te=this.#f.get($);if(te&&te.version===q)return te.key;const re=ee();return this.#f.set($,{version:q,key:re}),re}#rt($){const q=(this.#e.compute||{})[$];return z(q)||D(`ctx.compute.${$} is required by the memory source pipeline`),q}#mt(){const $=this.#e.columns;return $&&z($.all)?$.all():[]}#Ke($){const q=this.#e.columns;return q&&z(q.get)?q.get($):void 0}#ut($,q){const ee=this.#e.emit;z(ee)&&ee($,q)}}}),ze("packages/core/src/source/abort.js",function(e,_){"use strict";Object.defineProperty(e,"SupersededError",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"RequestToken",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"AbortScope",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createAbortScope",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return D}});class ne extends Error{constructor(z,L="superseded"){super(`[lattice] request ${z?`"${z}" `:""}${L}`),this.name="SupersededError",this.superseded=!0,this.key=z}}class E{#e;constructor(z,L,X,I){this.#e=z,this.key=L,this.controller=X,this.signal=X.signal,this.seq=I}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(z){this.signal.aborted||this.controller.abort(new ne(this.key,z)),this.#e.settle(this)}}class K{#e=new Map;#t=0;begin(z="",L="superseded"){const X=this.#e.get(z);X&&!X.signal.aborted&&X.controller.abort(new ne(z,L));const I=new E(this,z,new AbortController,++this.#t);return this.#e.set(z,I),I}tokenFor(z){return this.#e.get(z)}pending(z=""){const L=this.#e.get(z);return!!L&&!L.signal.aborted}get size(){return this.#e.size}settle(z){this.#e.get(z.key)===z&&this.#e.delete(z.key)}abort(z="",L="superseded"){const X=this.#e.get(z);X&&X.abort(L)}abortAll(z="superseded"){for(const L of[...this.#e.values()])L.abort(z);this.#e.clear()}}function U(){return new K}function D(J){if(!J||typeof J!="object")return!1;const z=J;return z.superseded===!0||z.name==="AbortError"||z.name==="SupersededError"}}),ze("packages/core/src/source/blockcache.js",function(e,_){"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 E}}),Object.defineProperty(e,"BlockCache",{enumerable:!0,get:function(){return U}});const ne=100,E=32;class K{constructor(J){this.id=J,this.rows=null,this.state="pending",this.token=null,this.error=null}}class U{#e=new Map;#t;#n;#r=0;#s=-1;constructor(J={}){this.#t=Math.max(1,Math.floor(Number(J.pageSize)||ne)),this.#n=Math.max(1,Math.floor(Number(J.maxCachedPages)||E))}get pageSize(){return this.#t}get maxBlocks(){return this.#n}get size(){return this.#e.size}blockOf(J){return Math.floor(J/this.#t)}rangeOf(J){return{start:J*this.#t,end:(J+1)*this.#t}}has(J){return this.#e.has(J)}pending(J){const z=this.#e.get(J);return!!z&&z.state==="pending"}loaded(J){const z=this.#e.get(J);return!!z&&z.state==="loaded"}begin(J,z){let L=this.#e.get(J);return L||(L=new K(J)),L.state="pending",L.token=z,L.error=null,this.#i(J,L),L}fill(J,z){const L=this.#e.get(J)||new K(J);L.rows=z,L.state="loaded",L.token=null,this.#i(J,L)}failed(J,z){const L=this.#e.get(J)||new K(J);L.state="error",L.error=z,L.token=null,this.#i(J,L)}delete(J){return this.#e.delete(J)}rowAt(J){const z=this.blockOf(J),L=this.#e.get(z);if(!(!L||L.state!=="loaded"||!L.rows))return this.#i(z,L),L.rows[J-z*this.#t]}rowLoaded(J){const z=this.blockOf(J),L=this.#e.get(z);return!!L&&L.state==="loaded"&&!!L.rows&&J-z*this.#t<L.rows.length}erroredAt(J){const z=this.#e.get(this.blockOf(J));return!!z&&z.state==="error"}loadedExtent(){let J=0;for(const z of this.#e.values()){if(z.state!=="loaded"||!z.rows)continue;const L=z.id*this.#t+z.rows.length;L>J&&(J=L)}return J}fillOf(J){const z=this.#e.get(J);return z&&z.state==="loaded"&&z.rows?z.rows.length:null}protect(J,z){this.#r=this.blockOf(Math.max(0,J)),this.#s=this.blockOf(Math.max(0,z))}evict(){const J=[];if(this.#e.size<=this.#n)return J;for(const[z,L]of this.#e){if(this.#e.size-J.length<=this.#n)break;z>=this.#r&&z<=this.#s||L.state!=="pending"&&J.push(z)}for(const z of J)this.#e.delete(z);return J}ids(){return[...this.#e.keys()]}clear(){this.#e.clear()}#i(J,z){this.#e.delete(J),this.#e.set(J,z)}}}),ze("packages/core/src/source/pagewindow.js",function(e,_){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return ne}});function ne(E,K,U,D){const J=Math.floor(Number(E)||0);if(J<=0)return null;const z=Math.max(0,Math.floor(Number(K)||0)),L=Math.max(0,Math.floor(Number(U)||0));if(D){const X=Math.max(1,Math.ceil(L/J)),I=Math.min(z,X-1),j=I*J;return{page:I,pageSize:J,offset:j,length:Math.max(0,Math.min(J,L-j)),pageCount:X,total:L}}return{page:z,pageSize:J,offset:z*J,length:J,pageCount:Math.max(z+2,Math.ceil(L/J)),total:null}}}),ze("packages/core/src/source/paged.js",function(e,_){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"PagedSource",{enumerable:!0,get:function(){return m}});const E=_("packages/core/src/internal/lru.js").Lru,U=_("packages/core/src/internal/predicates.js").isFunction,J=_("packages/core/src/internal/warn.js").warnOnce,L=_("packages/core/src/internal/schedule.js").settleDebounce,X=_("packages/core/src/source/abort.js"),I=X.createAbortScope,j=X.isAbortError,k=_("packages/core/src/source/blockcache.js"),y=k.BlockCache,l=k.DEFAULT_PAGE_SIZE,g=k.DEFAULT_MAX_CACHED_PAGES,t=_("packages/core/src/source/rows.js").createRowFactory,o=_("packages/core/src/source/filterwire.js"),c=o.wireFilters,d=o.querySignature,n=o.warnHostFilterNotApplied,i=_("packages/core/src/source/pagewindow.js").pageWindow,r=120;function f(u,b){return new m(u,b)}class m{mode="paged";#e;#t;#n;#r=I();#s;#i;#o=new Map;#l=null;#a=null;#c=!1;#u=0;#d="";#f={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(b,a){this.#e=b||{mode:"paged"},this.#t=a||{},this.#n=new y({pageSize:this.#e.pageSize||l,maxCachedPages:this.#e.maxCachedPages||g}),this.#s=t(this.#t),this.#i=new E(this.#n.pageSize*4),this.#h=L((h,w)=>this.#w(h,w),r),this.#d=this.#C(),U(this.#e.fetch)||J("source.paged.fetch",'source.mode "paged" requires a fetch function; the grid will stay empty.'),n(this.#t)}count(){const b=this.#y();return b?b.length:this.#b()}#b(){if(this.#P(),this.#l!==null)return this.#l;const b=Math.max(this.#u,this.#n.loadedExtent());return this.#c?b:b+this.#n.pageSize}matchCount(){return this.#b()}totalCount(){return this.#b()}pageInfo(){const b=this.#y();if(!b){const a=this.#b();return{page:0,pageSize:0,total:this.exact()?a:null,pageCount:1,counting:!1}}return{page:b.page,pageSize:b.pageSize,total:b.total,pageCount:b.pageCount,counting:b.total===null&&this.#r.size>0&&this.#u===0&&this.#n.loadedExtent()===0}}#y(){const b=this.#b(),a=i(this.#T("pageSize",0),this.#T("page",0),b,this.exact());if(!a)return this.#g="",null;const h=`${this.#m}:${a.offset}:${a.length}`;if(h!==this.#g&&!this.#p&&(this.#g=h,a.length>0)){const w=a.offset+a.length-1;this.#f={start:a.offset,end:w},this.#w(a.offset,w)}return a}at(b){const a=this.#y();if(a){if(b<0||b>=a.length)return;const h=this.#S(a.offset+b);return h&&(h.index=b),h}return this.#S(b)}#S(b){if(b<0||b>=this.#b())return;const a=this.#i.get(b);if(a&&(a.data!==null||!this.#n.rowLoaded(b)))return a;const h=this.#n.rowAt(b);if(h===void 0){const v=this.#s.skeleton(b,0,this.#n.erroredAt(b));return this.#i.set(b,v),v}const w=this.#s.leaf(h,b);return w.index=b,this.#i.set(b,w),this.#o.set(w.key,b),w}byKey(b){const a=this.#o.get(b);return a===void 0?void 0:this.#S(a)}loaded(b){const a=this.#y();return a?b>=0&&b<a.length&&this.#n.rowLoaded(a.offset+b):this.#n.rowLoaded(b)}loadedCount(){this.#P();let b=0;for(const a of this.#n.ids()){if(!this.#n.loaded(a))continue;const h=this.#n.fillOf(a);typeof h=="number"&&(b+=h)}return b}residentRows(){this.#P();const b=this.#y(),a=b?b.offset:0,h=b?b.offset+b.length:1/0,w=[],v=this.#n.ids().sort((A,H)=>A-H);for(const A of v){if(!this.#n.loaded(A))continue;const{start:H}=this.#n.rangeOf(A),G=this.#n.fillOf(A)||0;for(let Z=H;Z<H+G;Z++){if(Z<a||Z>=h)continue;const M=this.#i.peek(Z);if(M&&M.data!==null&&M.data!==void 0){w.push(M);continue}const S=this.#n.rowAt(Z);if(S===void 0)continue;const T=this.#s.leaf(S,Z);T.index=Z,this.#i.set(Z,T),this.#o.set(T.key,Z),w.push(T)}}return w}hint(b,a){if(this.#p)return;const h=this.#P();let w=Math.max(0,Math.floor(b)),v=Math.max(w,Math.floor(a));const A=this.#y();if(A){if(A.length===0)return;w=A.offset,v=A.offset+A.length-1}this.#f={start:w,end:v},this.#n.protect(w,v);for(const H of this.#n.evict())this.#v(H);this.#h(w,v),h&&this.#h.flush()}#w(b,a){if(this.#p)return;this.#n.protect(b,a);const h=this.#n.blockOf(b),w=this.#n.blockOf(a);for(let v=h;v<=w&&!(this.#l!==null&&v*this.#n.pageSize>=this.#l);v++)this.#n.has(v)||this.#A(v)}apply(b){const a={added:[],updated:[],removed:[]};if(!b)return a;if(b.update)for(const h of b.update){const w=this.#s.keyOf(h,-1),v=this.#o.get(w);if(v===void 0)continue;const A=this.#s.leaf(h,v);A.index=v,this.#i.set(v,A),a.updated.push(A)}return(b.add&&b.add.length||b.remove&&b.remove.length)&&this.reload(),a}reload(b){this.#O("reload"),this.#h.cancel(),this.hint(this.#f.start,this.#f.end)}destroy(){this.#p=!0,this.#h.cancel(),this.#r.abortAll("destroyed"),this.#n.clear(),this.#i.clear(),this.#o.clear()}exact(){return this.#l!==null||this.#c}pending(){return this.#r.size}async#A(b){if(!U(this.#e.fetch))return;const a=this.#r.begin(`block:${b}`);this.#n.begin(b,a);const{start:h,end:w}=this.#n.rangeOf(b),v=this.#d;try{const A=await this.#e.fetch({range:{start:h,end:w},sort:this.#T("sort",[]),filters:c(this.#T("filters",null),this.#E()),quick:this.#T("quick","")||void 0,context:this.#T("context",null),signal:a.signal});if(!a.current||v!==this.#d||this.#p)return;a.settle();const H=A&&A.rows||[];this.#n.fill(b,H);for(let Z=0;Z<H.length;Z++)this.#i.delete(h+Z);const G=A&&typeof A.total=="number"?A.total:A&&typeof A.count=="number"?A.count:null;G!==null?(this.#l=G,this.#c=!0):H.length<this.#n.pageSize?(this.#c=!0,this.#l=h+H.length):this.#u=Math.max(this.#u,h+H.length),this.#M("model:changed",{reason:"page",block:b,from:h,to:h+H.length}),this.#M("rows:changed",{companion:!0,reason:"page",block:b,from:h,to:h+H.length}),this.#l!==null&&this.#l!==this.#a&&(this.#a=this.#l,this.#M("source:total",{total:this.#l,groupPath:[]}))}catch(A){if(a.settle(),j(A))return;this.#n.failed(b,A);for(let H=h;H<w;H++)this.#i.delete(H);this.#M("model:changed",{reason:"page-error",block:b,range:{start:h,end:w}}),this.#M("source:error",{error:A,block:b,range:{start:h,end:w}})}}#v(b){const{start:a,end:h}=this.#n.rangeOf(b);for(let w=a;w<h;w++){const v=this.#i.peek(w);v&&this.#o.delete(v.key),this.#i.delete(w)}}#P(){const b=this.#C();return b===this.#d?!1:(this.#d=b,this.#O("query"),!0)}#O(b){this.#r.abortAll(b),this.#n.clear(),this.#i.clear(),this.#o.clear(),this.#l=null,this.#a=null,this.#c=!1,this.#u=0,this.#m++,this.#M("model:changed",{reason:b})}#C(){return d({filters:this.#T("filters",null),sort:this.#T("sort",[]),quick:this.#T("quick",""),context:this.#T("context",null)})}#E(){const b=this.#t.config||{};return{tz:b.timeZone,weekStartsOn:b.weekStartsOn}}#T(b,a){const h=this.#t.state;if(h&&U(h[b])){const w=h[b]();return w??a}return a}#M(b,a){const h=this.#t.emit;U(h)&&h(b,a)}}}),ze("packages/core/src/source/aggregates.js",function(e,_){"use strict";Object.defineProperty(e,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"pushableAggregates",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"fillAggregateSql",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"routeAggregate",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"resolveAggregatePlan",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"groupKeysPushable",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"pushdownDocRows",{enumerable:!0,get:function(){return X}});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 E(){const I=new Set;for(const[j,k]of Object.entries(ne))k.pushable&&I.add(j);return I}function K(I,j,k){let y=I.split("%c").join(j);return k!==void 0&&(y=y.split("%w").join(k)),y}function U(I){const j=I||{},k=j.default==="engine"||j.default==="engine-if-identical"?j.default:"client",y={};if(j.overrides&&typeof j.overrides=="object")for(const[l,g]of Object.entries(j.overrides))(g==="engine"||g==="client")&&(y[l]=g);return{default:k,overrides:y}}function D(I,j){const k=ne[I];if(!k||!k.pushable)return"client";const y=j.overrides[I];return y==="engine"||y==="client"?y:j.default==="client"?"client":j.default==="engine-if-identical"?k.class==="identical"?"engine":"client":"engine"}function J(I,j){const k=U(j),y=[],l=[];for(const g of I||[]){const s=ne[g.fn],t=D(g.fn,k),o={id:g.id,col:g.col,fn:g.fn,class:s?s.class:"fallback"};g.weight!==void 0&&(o.weight=g.weight),g.params!==void 0&&(o.params=g.params),t==="engine"?y.push(o):(o.reason=s&&!s.pushable?s.note||"the engine cannot express this stat":"client by config",l.push(o))}return{engine:y,client:l,config:k}}const z=/^[A-Za-z_][A-Za-z0-9_$]*$/;function L(I,j=[]){return(I||[]).every(y=>{if(typeof y=="string")return z.test(y);if(!y||typeof y!="object")return!1;const l=y;return Array.isArray(j)&&j.includes(l.bucket)&&typeof l.col=="string"&&z.test(l.col)&&typeof l.size=="number"&&Number.isFinite(l.size)&&l.size>0})}function X(){return Object.entries(ne).map(([I,j])=>({stat:I,class:j.class,sql:j.sql?K(j.sql,"col",j.twoColumn?"weight":void 0):"",note:j.note||(j.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),ze("packages/core/src/source/pushdown.js",function(e,_){"use strict";Object.defineProperty(e,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"NO_CAPABILITIES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"capabilitiesOf",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"splitFilters",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"applyResidual",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"createPushdownSource",{enumerable:!0,get:function(){return F}});const E=_("packages/core/src/internal/compare.js").defaultCompare,U=_("packages/core/src/internal/predicates.js").isFunction,J=_("packages/core/src/internal/merge.js").toArray,L=_("packages/core/src/internal/warn.js").warnOnce,X=_("packages/core/src/source/filterwire.js"),I=X.isGroup,j=X.warnWherePageRelative,k=X.warnWhereOverThreshold,y=X.wireFilters,l=_("packages/core/src/source/aggregates.js"),g=l.resolveAggregatePlan,s=l.groupKeysPushable,t=l.STAT_PUSHDOWN,c=_("packages/core/src/source/abort.js").SupersededError,d=1e3;function n($){const q=$&&$.signal;if(!q||!q.aborted)return;const ee=q.reason;throw ee instanceof Error?ee:new c("","superseded before it was sent")}const p=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function i($){if(!$||typeof $!="object")return!1;const q=$.returning==="row"||$.returning==="key"?$.returning:"none";return{append:$.append===!0,update:$.update===!0,delete:$.delete===!0,returning:q}}function r($,q){if(!$||typeof q!="string")return;if(!q.includes("."))return $[q];let ee=$;for(const te of q.split(".")){if(ee===null||typeof ee!="object")return;ee=ee[te]}return ee}function f($){if($===!0)return!0;if(!$||typeof $!="object")return!1;const q=$;return q.enabled===!1?!1:q.enabled===!0||U(q.commit)}function m($){const q={...p,...$||{}};return q.operators=new Set(q.operators||[]),q.mutate=i(q.mutate),q}function u($,q){return!$||!$.op||!q.operators.size?!1:q.operators.has($.op)}function b($,q){if(!$)return{pushed:null,residual:null};if(!q.filter)return{pushed:null,residual:$};if(q.filter==="term"){if(I($)){const ie=$.conditions||[];if(String($.op)!=="and")return{pushed:null,residual:$};const ue=ie.findIndex(de=>!I(de)&&u(de,q));if(ue<0)return{pushed:null,residual:$};const Ae=ie.filter((de,Oe)=>Oe!==ue);return{pushed:ie[ue],residual:Ae.length?{op:"and",conditions:Ae}:null}}return u($,q)?{pushed:$,residual:null}:{pushed:null,residual:$}}if(!I($))return u($,q)?{pushed:$,residual:null}:{pushed:null,residual:$};if(String($.op)!=="and")return($.conditions||[]).every(ue=>I(ue)?b(ue,q).residual===null:u(ue,q))?{pushed:$,residual:null}:{pushed:null,residual:$};const ee=[],te=[];for(const ie of $.conditions||[]){if(I(ie)){if(q.filter==="flat"){te.push(ie);continue}const ue=b(ie,q);ue.pushed&&ee.push(ue.pushed),ue.residual&&te.push(ue.residual);continue}(u(ie,q)?ee:te).push(ie)}const re=ie=>ie.length===0?null:ie.length===1?ie[0]:{op:"and",conditions:ie};return{pushed:re(ee),residual:re(te)}}const a="__lattice_leaves";function h($){return $.aggregates?$.aggregates instanceof Set?$.aggregates:new Set(J($.aggregates)):new Set}function w($){const q=h($);return q.size?q.has("count")?$.filter!=="tree"||!$.operators||!$.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($,q,ee,te,re,ie,ue){const Ae=Array.isArray($.groupBy)?$.groupBy:[],de=Array.isArray($.groupPath)?$.groupPath:[],Oe=Array.isArray($.groupValues)?$.groupValues:null;if(!q.group){const Me=w(q);if(Me)return Me}return s(Ae)?ee.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":te?re?ie?"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":!Oe||Oe.length!==de.length?"the request carries no typed `groupValues` for its group path, and the string `groupPath` cannot be compared against a typed column":"":"a quick search did not push, so the engine would group unsearched rows":"the sort did not push, so the engine would order the groups differently":"a grouping key is not a plain column the engine can name in a GROUP BY"}const A="pushdown:pivot-unsupported",H="pushdown:group-unsupported",G=Symbol("lattice.remote.ungroupedLevel");function Z($,q,ee,te,re,ie){const ue=Array.isArray($.pivotBy)?$.pivotBy:[],Ae=Array.isArray($.groupBy)?$.groupBy:[],de=Array.isArray($.groupPath)?$.groupPath:[],Oe=Array.isArray($.groupValues)?$.groupValues:null;return q.pivot?s(ue)?Ae.length&&!s(Ae)?"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?re?ie?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!Oe||Oe.length!==de.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 M($,q,ee=!1){const te=b($.filters||null,q),re=[];te.residual&&re.push("filter");const ie=$.sort||[],ue=ie.length===0||q.sort==="multi"&&ie.length>=1||q.sort==="single"&&ie.length===1;!ue&&ie.length&&re.push("sort");const Ae=$.quick?String($.quick):"",de=!Ae||!!q.quick;de||re.push("quick");const Oe=$.where&&$.where.active?$.where:null;Oe&&re.push("where");const Me={filters:te.residual,sort:ue?null:ie,quick:de?"":Ae,where:Oe},Fe=!!ee,pe=Array.isArray($.groupBy)&&$.groupBy.length>0,ae=pe?v($,q,te,ue,de,Oe,Fe):"",ge=$.pivotMode!==!1&&Array.isArray($.pivotBy)&&$.pivotBy.length>0,ve=ge?Z($,q,te,ue,de,Oe):"",le=ge&&ve==="";ge&&!le&&re.push("pivot");const we=ge?le&&pe:pe&&ae==="";pe&&!ge&&!we&&re.push("group");const he=(we||le)&&Array.isArray($.groupValues)?$.groupValues.length:0,be=we||ge?!1:Fe||!!(Me.filters||Me.sort||Me.quick||Me.where)||!q.range;return{pushed:{...$,filters:te.pushed,sort:ue?ie:[],quick:de?Ae:"",range:be?null:$.range},residual:Me,needsAll:be,unpushed:re,full:Fe,grouped:we,groupLevel:he,groupReason:ge?"":ae,pivoted:le,pivotReason:ve}}function S($){const q=Array.isArray($.totals)?$.totals:[],ee=$.totalFns&&typeof $.totalFns=="object"?$.totalFns:{},te=[],re=[];for(const ie of q){const ue=String(ie),Ae=typeof ee[ue]=="string"?ee[ue]:null,de=Ae?t[Ae]:null;Ae?!de||!de.pushable||!de.sql?re.push({id:ue,fn:Ae,class:de?de.class:"fallback",reason:de&&de.note?de.note:`the pushdown map cannot express "${Ae}"`}):de.twoColumn?re.push({id:ue,fn:Ae,class:de.class,reason:`"${Ae}" reduces two columns, and a grouped request carries no weight column`}):te.push({id:ue,col:ue,fn:Ae,class:de.class}):re.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:re}}const T=Object.freeze({items:$=>$==null?[]:Array.isArray($)?$:[$]});function O($,q,ee){if(!q)return $;let te=$;if(q.filters&&U(ee.evaluateFilters)){const re=te,ie={count:te.length,handle:de=>({id:de,get:Oe=>r(re[Oe],de)}),itemwise:de=>re.some(Oe=>Array.isArray(r(Oe,de)))?T:null},ue=ee.evaluateFilters(q.filters,ie),Ae=[];for(let de=0;de<te.length;de++)ue[de]&&Ae.push(te[de]);te=Ae}if(q.where&&q.where.active&&(q.whole||j(q.where.names,"pushdown"),te=te.filter(re=>q.where.passes(re))),q.quick){const re=q.quick.toLowerCase();te=te.filter(ie=>{if(!ie||typeof ie!="object")return!1;for(const ue of Object.values(ie))if(ue!=null&&String(ue).toLowerCase().includes(re))return!0;return!1})}if(q.sort&&q.sort.length&&U(ee.sortMulti)){const re=[...new Set(q.sort.map(de=>de.col))],ie=te,ue=re.map(de=>({id:de,get:Oe=>r(ie[Oe],de)})),Ae=ee.sortMulti(ue,q.sort.map(de=>({col:de.col,dir:de.dir})),Uint32Array.from({length:te.length},(de,Oe)=>Oe),{});te=Array.from(Ae,de=>ie[de])}return te}function N($){return JSON.stringify({filters:$.filters||null,sort:$.sort||[],quick:$.quick||"",groupBy:$.groupBy||[],groupPath:$.groupPath||[],context:$.context??null})}function P($){if(!$||typeof $!="object")return 16;let q="";try{q=JSON.stringify($)}catch{return 200}return q.length*2+64}function C($){const q=$||{};return{enabled:!!q.enabled,maxRows:Number.isFinite(q.maxRows)?q.maxRows:1e6,maxBytesEstimate:Number.isFinite(q.maxBytesEstimate)?q.maxBytesEstimate:512*1024*1024}}const B=5e4;function x($){return Number.isFinite($)&&$>=0?$:B}function V($){return!!$&&U($.then)}async function Y($){if(!$||$.total!==void 0||!V($.pendingTotal))return $;const q=await $.pendingTotal,{pendingTotal:ee,...te}=$;return typeof q=="number"?{...te,total:q}:te}function F($={}){const q=$.adapter;if(!q||!U(q.execute))return L("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...$,mode:"remote",fetch:async()=>({rows:[],total:0})};const ee=m(q.capabilities),te=q.capabilities&&Object.getOwnPropertyDescriptor(q.capabilities,"operators");te&&U(te.get)&&Object.defineProperty(ee,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(q.capabilities.operators||[]),set:()=>{}});const re=q.name||"adapter";let ie=null;const ue=()=>U(q.ready)?(ie||(ie=Promise.resolve(q.ready()).then(()=>{Object.assign(ee,m(q.capabilities))},Se=>{throw ie=null,Se})),ie):null,Ae=C($.fullDataset),de=!!$.allowPartialResults,Oe=x($.whereRowLimit);let Me=null;const Fe=$.aggregates;let pe=null,ae=null,ge=null,ve=null,le=null,we,he=null,be=0,Te=null;const je=()=>!Ae.enabled||!pe?null:(Te!==pe.key&&(be++,Te=pe.key),{rows:pe.rows,version:be}),ke=async Se=>{const Le=Se.where&&Se.where.active?Se.where:null;if(!Le)return{request:Se,probe:null};const{where:se,...ce}=Se,Pe=M(ce,ee,Ae.enabled);if(Pe.needsAll)return{request:Se,probe:null};const Ne=N(Pe.pushed);let De=null;return(!Me||Me.key!==Ne)&&(ee.total?(n(Se),De=await Y(await q.execute(Pe.pushed,Se)),Me={key:Ne,size:De&&typeof De.total=="number"?De.total:null}):Me={key:Ne,size:null}),Me.size!==null&&Me.size<Oe?{request:Se,probe:null}:(k(Le.names,re,Me.size,Oe),{request:ce,probe:De})},Ue=async(Se,Le)=>{he=null;const se=S(Se.pushed);ge={engine:se.engine,client:se.client,groupBy:Se.pushed.groupBy},se.client.length&&L(`source.pushdown.group.totals.${re}.${se.client.map(Ne=>Ne.id).join(".")}`,`the ${re} adapter cannot compute the group subtotal for ${se.client.map(Ne=>`"${Ne.id}" (${Ne.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 ce=await q.executeGroupLevel(Se.pushed,se.engine,Le)||{};let Pe=ce.rows||[];return!ee.range&&Le.range&&(Pe=Pe.slice(Le.range.start,Le.range.end)),Ke(ce),ce.total===void 0?{rows:Pe}:{rows:Pe,total:ce.total}},Re=new Map,Ee=64,He=async(Se,Le)=>{he=null;const se=Se.pushed,ce=se.groupBy,Pe=Array.isArray(se.groupValues)?se.groupValues:[],Ne=Pe.length,De=[...se.filters?[se.filters]:[],...ce.slice(0,Ne).map((mt,bt)=>({col:mt,op:"eq",value:Pe[bt]===void 0?null:Pe[bt],caseSensitive:!0}))],Be=De.length===0?null:De.length===1?De[0]:{op:"and",conditions:De},Ye=Le.range?Le.range.start:0;if(Ne>=ce.length){const mt={...se,filters:Be,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},bt=await Y(await q.execute(mt,Le))||{};let At=bt.rows||[];return!ee.range&&Le.range&&(At=At.slice(Le.range.start,Le.range.end)),typeof bt.total=="number"?{rows:At,total:bt.total}:{rows:At}}const Qe=ce[Ne],ct=S(se),pt=h(ee),Ge=ct.engine.filter(mt=>pt.has(mt.fn)),nt=[...ct.engine.filter(mt=>!pt.has(mt.fn)).map(mt=>({id:mt.id,fn:mt.fn,class:mt.class,reason:`the ${re} adapter does not compute "${mt.fn}"`})),...ct.client];ge={engine:Ge,client:nt,groupBy:ce},nt.length&&L(`source.pushdown.group.totals.${re}.${nt.map(mt=>mt.id).join(".")}`,`the ${re} adapter cannot compute the group subtotal for ${nt.map(mt=>`"${mt.id}" (${mt.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 at=[...Ge.map(mt=>({id:mt.id,col:mt.col,fn:mt.fn})),{id:a,col:Qe,fn:"count"}],rt={...se,filters:Be,range:null},ft=JSON.stringify([N(rt),Pe,Qe,at]);let jt=Ye>0?Re.get(ft):void 0;if(!jt){for(jt=Promise.resolve(q.executeGroupedAggregates(rt,[Qe],at)),Re.delete(ft),Re.set(ft,jt);Re.size>Ee;)Re.delete(Re.keys().next().value);jt.catch(()=>{Re.get(ft)===jt&&Re.delete(ft)})}const Tt=await jt||[];n(Le);const Mt=mt=>{const bt={};for(const At of Ge)bt[At.id]=mt?mt[At.id]:void 0;return bt},Rt=(se.sort||[]).find(mt=>mt&&mt.col===Qe),It=Rt&&Rt.dir==="desc"?-1:1,zt=Tt.filter(mt=>mt&&mt.level===1).map(mt=>({[Qe]:mt.keys[0]===void 0?null:mt.keys[0],leafCount:Number(mt.values&&mt.values[a])||0,totals:Mt(mt.values)})).sort((mt,bt)=>It*E(mt[Qe],bt[Qe]));if(Ne===0){const mt=Tt.find(At=>At&&At.level===0),bt=mt?Number(mt.values&&mt.values[a]):NaN;Ke({matchCount:Number.isFinite(bt)?bt:zt.reduce((At,Dt)=>At+Dt.leafCount,0),...mt?{grand:Mt(mt.values)}:{}})}const Je=Le.range?Le.range.end:zt.length;return{rows:zt.slice(Ye,Je),total:zt.length}},Ke=Se=>{typeof Se.matchCount=="number"&&(ve=Se.matchCount,le=Se.grand?{totals:Se.grand,leafCount:Se.matchCount}:null,we===void 0&&U(q.unfilteredCount)&&(we=null,Promise.resolve(q.unfilteredCount()).then(Le=>{we=typeof Le=="number"?Le:null}).catch(Le=>{L(`source.pushdown.group.unfiltered.${re}`,`the ${re} adapter could not count the unfiltered set (${Le&&Le.message?Le.message:Le}), so "N of M" falls back to the display count for its denominator.`)})))},We=async(Se,Le)=>{he=null;const se=S(Se.pushed);ge={engine:se.engine,client:se.client,groupBy:Se.pushed.groupBy,pivotBy:Se.pushed.pivotBy},se.client.length&&L(`source.pushdown.pivot.totals.${re}.${se.client.map(Be=>Be.id).join(".")}`,`the ${re} adapter cannot compute the pivot cells for ${se.client.map(Be=>`"${Be.id}" (${Be.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 ce=await q.executePivotLevel(Se.pushed,se.engine,Le)||{};let Pe=ce.rows||[];!ee.range&&Le.range&&(Pe=Pe.slice(Le.range.start,Le.range.end)),Ke(ce);const Ne=ce.pivot&&typeof ce.pivot=="object"?ce.pivot:{},De={cells:Array.isArray(Ne.cells)?Ne.cells:[],...Array.isArray(Ne.axis)?{axis:Ne.axis}:{}};return ce.total===void 0?{rows:Pe,pivot:De}:{rows:Pe,total:ce.total,pivot:De}},qe=Se=>{L(`source.pushdown.pivot.${re}.${Se}`,`pushdown:pivot-unsupported: the ${re} adapter cannot pivot this query because ${Se}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const Le=new Error(`[lattice] ${A}: the ${re} adapter cannot pivot this query because ${Se}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw Le.code=A,Le.reason=Se,Le},et=(Se,Le)=>{const se={key:Le,state:"pending",value:null};return he=se,Se.then(ce=>(he===se&&(he={key:Le,state:"settled",value:typeof ce=="number"?ce:null}),ce),ce=>{throw he===se&&(he={key:Le,state:"failed",value:null}),ce})};let dt=0,lt=[];const vt=()=>dt===0?null:new Promise(Se=>{const Le=setTimeout(Se,d);lt.push(()=>{clearTimeout(Le),Se()})});let Pt;const $t=async Se=>{const Le=ue();Le&&await Le;const ce=Se&&Se.pivotMode!==!1&&Array.isArray(Se.pivotBy)&&Se.pivotBy.length>0?{request:Se,probe:null}:await ke(Se);n(Se);let Pe=M(ce.request,ee,Ae.enabled);if(ee.group&&Pe.grouped&&!Pe.pivoted&&!U(q.executeGroupLevel)&&(L(`source.pushdown.group.method.${re}`,`the ${re} 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.`),Pe=M(ce.request,{...ee,group:!1,aggregates:null},Ae.enabled)),Pe.pivoted&&!U(q.executePivotLevel)&&(Pe=M(ce.request,{...ee,pivot:!1},Ae.enabled),Pe.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Pe.grouped&&!Pe.pivoted&&!ee.group&&!U(q.executeGroupedAggregates)&&(L(`source.pushdown.group.aggregates.method.${re}`,`the ${re} 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\`.`),Pe=M(ce.request,{...ee,aggregates:null},Ae.enabled)),ae=Pe,Pe.pivoted)return We(Pe,Se);if(Pe.pivotReason&&qe(Pe.pivotReason),Pe.grouped)return ee.group?Ue(Pe,Se):He(Pe,Se);const De=!!Pe.groupReason&&!Pe.full;De?L(`source.pushdown.group-unsupported.${re}.${Pe.groupReason}`,`pushdown:group-unsupported: the ${re} adapter was not asked to group this query because ${Pe.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.`):Pe.groupReason&&L(`source.pushdown.group.${re}.${Pe.groupReason}`,`the ${re} adapter was not asked to group this query because ${Pe.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 Be=at=>De?{...at,[G]:!0}:at;if(!Pe.needsAll){const at=ce.probe||await q.execute(Pe.pushed,Se),rt=at.rows||[];return V(at.pendingTotal)&&at.total===void 0?Be({rows:rt,pendingTotal:et(at.pendingTotal,N(Pe.pushed))}):(he=null,!ee.total&&at.total===void 0?Be({rows:rt}):Be({rows:rt,total:at.total??rt.length}))}Pe.unpushed.length&&L(`source.pushdown.residual.${re}.${Pe.unpushed.join(".")}`,`the ${re} adapter cannot push ${Pe.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 Ye=N(Pe.pushed);if(!pe||pe.key!==Ye){const at=await Y(await q.execute(Pe.pushed,Se));he=null;const rt=at.rows||[];if(Pe.full){const ft=typeof at.total=="number"?Math.max(at.total,rt.length):rt.length;if(ft>Ae.maxRows)throw new Error(`[lattice] fullDataset refused: the ${re} adapter's matching set is ${ft.toLocaleString()} rows, past the configured maxRows of ${Ae.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=rt.length*P(rt[0]);if(jt>Ae.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${re} adapter's matching set is an estimated ${Math.round(jt/(1024*1024)).toLocaleString()} MB across ${rt.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(Ae.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 at.total=="number"&&rt.length<at.total){const ft=!!(Pe.residual.filters||Pe.residual.quick||Pe.residual.sort&&Pe.residual.sort.length);if(ft&&!de)throw new Error(`[lattice] the ${re} adapter returned ${rt.length} of ${at.total} matching rows when asked for the whole result, and the query has residual ${Pe.unpushed.join(" and ")||"work"} to finish in the browser. Filtering or sorting a fraction of the result would return wrong rows, so the result is refused. Fix the adapter to follow the engine's own paging before returning, hold the data in memory, or set \`allowPartialResults: true\` on the source config to accept this knowingly.`);ft?L(`source.pushdown.partial.residual.${re}`,`the ${re} adapter returned ${rt.length} of ${at.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.`):L(`source.pushdown.partial.${re}`,`the ${re} adapter returned ${rt.length} of ${at.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}pe={key:Ye,rows:rt,total:typeof at.total=="number"?at.total:null}}let Qe=Pe;if(Pe.residual.where){const at=pe.total??pe.rows.length;if(at>=Oe){k(Pe.residual.where.names,re,at,Oe);const{where:rt,...ft}=ce.request;Qe=M(ft,ee,Ae.enabled),ae=Qe}}const ct=pe.total!==null&&pe.rows.length>=pe.total,pt=O(pe.rows,{...Qe.residual,whole:ct},$.compute||{}),Ge=Se.range?Se.range.start:0,nt=Se.range?Se.range.end:pt.length;return Be({rows:pt.slice(Ge,nt),total:pt.length})},ht=async(Se,Le,se)=>{const Pe=se&&se.waitForPage&&Pt&&U(Pt.pageForegroundIdle)?Pt.pageForegroundIdle():vt();Pe&&await Pe;const Ne=ue();Ne&&await Ne;const De=M(Se,ee,Ae.enabled);ae=De;const Be=g(Le,Fe),Ye=Array.isArray(Se.groupBy)?Se.groupBy:[],Qe=Ye.length>0,ct=!De.residual.filters&&!De.residual.quick,pt=!Qe||s(Ye,ee.buckets);let Ge=Be.engine,nt=Be.client;if(ee.aggregates&&Ge.length){const jt=ee.aggregates instanceof Set?ee.aggregates:new Set(J(ee.aggregates)),Tt=Ge.filter(Mt=>!jt.has(Mt.fn));Tt.length&&(Ge=Ge.filter(Mt=>jt.has(Mt.fn)),nt=[...Tt.map(Mt=>({...Mt,reason:`the ${re} adapter does not compute "${Mt.fn}"`})),...nt])}const at=jt=>{nt=[...Ge.map(Tt=>({...Tt,reason:jt})),...nt],Ge=[]};Ge.length&&!ct?at(De.residual.quick&&!De.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):Ge.length&&!pt&&at("a grouping key the engine cannot form forces all-client (no mixed provenance)");let rt={},ft;return Ge.length&&(U(Qe?q.executeGroupedAggregates:q.executeAggregates)?Qe?ft=await q.executeGroupedAggregates(De.pushed,Ye,Ge)||[]:rt=await q.executeAggregates(De.pushed,Ge)||{}:(L(`source.pushdown.aggregates.${re}${Qe?".grouped":""}`,`the ${re} adapter cannot compute ${Qe?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),at(`adapter cannot compute ${Qe?"grouped ":""}aggregates`))),ge={engine:Ge,client:nt,...Qe?{groupBy:Ye}:{}},{values:rt,engine:Ge,client:nt,...ft!==void 0?{groups:ft}:{}}},ut=async Se=>{dt++;try{return await $t(Se)}finally{if(dt--,dt===0&<.length){const Le=lt;lt=[];for(const se of Le)se()}}},wt=f($.edit),Nt=$.edit&&typeof $.edit=="object"&&U($.edit.commit);let gt=$.edit;if(wt&&!Nt)if(ee.mutate&&ee.mutate.update){const Se=Le=>{if(!ee.mutate||!ee.mutate.update)throw new Error(`[lattice] the ${re} 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 se={kind:"update",key:String(Le.key),patch:{[Le.colId]:Le.value}};return q.mutate(se,Le.request||{})};gt={...$.edit===!0?{}:$.edit,commit:Se}}else L(`source.pushdown.readonly.${re}`,`edit is enabled but the ${re} 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 Ce=wt&&ee.mutate&&(ee.mutate.append||ee.mutate.delete)?{append:ee.mutate.append===!0,remove:ee.mutate.delete===!0,returning:ee.mutate.returning,mutate:(Se,Le)=>q.mutate(Se,Le||{})}:null,$e=async Se=>{const Le=ue();Le&&await Le;const{range:se,signal:ce,export:Pe,...Ne}=Se||{},De={...Ne,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:M(De,ee,Ae.enabled),signal:ce}};async function*ye(Se,Le={}){const{plan:se,signal:ce}=await $e(Se),Pe=Math.max(1,Math.floor(Number(Le.pageSize))||5e3),Ne={signal:ce,stream:!0},De=Se&&Se.range&&Number.isFinite(Number(Se.range.start))&&Number.isFinite(Number(Se.range.end))?{start:Math.max(0,Number(Se.range.start)),end:Math.max(0,Number(Se.range.end))}:null;if(!se.needsAll){const Qe=De?De.start:0,ct=De?De.end:1/0;for(let pt=Qe;pt<ct;pt+=Pe){n(Ne);const Ge=Math.min(pt+Pe,ct),nt=await q.execute({...se.pushed,range:{start:pt,end:Ge}},Ne);nt&&V(nt.pendingTotal)&&nt.pendingTotal.then(null,()=>{});const at=nt&&nt.rows||[];if(at.length&&(yield at),at.length<Ge-pt)return}return}n(Ne);const Be=await Y(await q.execute({...se.pushed,range:void 0},Ne));let Ye=O(Be&&Be.rows||[],{...se.residual,whole:!0},$.compute||{});De&&(Ye=Ye.slice(De.start,De.end));for(let Qe=0;Qe<Ye.length;Qe+=Pe)yield Ye.slice(Qe,Qe+Pe)}return Pt={...$,edit:gt,rowMutate:Ce,mode:"remote",fetch:ut,foregroundIdle:vt,aggregate:ht,countMatching:async Se=>{const{plan:Le,signal:se}=await $e(Se);if(!Le.needsAll&&ee.total){n({signal:se});const Pe=await Y(await q.execute({...Le.pushed,range:{start:0,end:0}},{signal:se}));if(Pe&&typeof Pe.total=="number")return Pe.total}let ce=0;for await(const Pe of ye({...Se,range:void 0}))ce+=Pe.length;return ce},streamMatching:ye,capabilitiesOf:m,planQuery:M,wireFilters:y,resolveAggregatePlan:Se=>g(Se,Fe),STAT_PUSHDOWN:t,lastPlan:()=>ae?{...ae,...ge?{aggregates:ge}:{},...he?{total:{deferred:!0,state:he.state,value:he.value}}:{}}:null,fullFrame:je,counts:()=>({match:ve,total:we??null,pending:!!he&&he.state==="pending"}),grandTotals:()=>le},Pt}}),ze("packages/core/src/source/remote.js",function(e,_){"use strict";Object.defineProperty(e,"PROTOCOL",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return N}});const E=_("packages/core/src/internal/lru.js").Lru,U=_("packages/core/src/internal/predicates.js").isFunction,J=_("packages/core/src/internal/warn.js").warnOnce,L=_("packages/core/src/internal/schedule.js").settleDebounce,X=_("packages/core/src/source/abort.js"),I=X.createAbortScope,j=X.isAbortError,k=_("packages/core/src/source/blockcache.js"),y=k.BlockCache,l=k.DEFAULT_PAGE_SIZE,g=k.DEFAULT_MAX_CACHED_PAGES,s=_("packages/core/src/source/rows.js"),t=s.createRowFactory,o=s.groupKey,c=_("packages/core/src/source/filterwire.js"),d=c.wireFilters,n=c.querySignature,p=c.warnHostFilterNotApplied,r=_("packages/core/src/source/pagewindow.js").pageWindow,m=_("packages/core/src/source/memory.js").MemorySource,b=_("packages/core/src/compute/handle.js").valueComparator,a=_("packages/core/src/compute/pivot.js"),h=a.pivotKey,w=a.joinPath,v=a.DEFAULT_PATH_SEPARATOR,H=_("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,G=1,Z=120,M=1e3;function S(P,C,B){for(let x=0;x<Math.max(P.length,C.length);x++){const V=P[x],Y=C[x],F=V==null,$=Y==null;if(F||$){if(F&&$)continue;return F?1:-1}const q=B(V,Y);if(q!==0)return q}return 0}function T(P,C){return new N(P,C)}class O{constructor(C,B,x,V){this.path=C,this.keyPath=V||C,this.values=[],this.level=B,this.key=o(this.keyPath),this.cache=new y(x),this.count=null,this.complete=!1,this.announced=null,this.counting=!1,this.failed=!1,this.children=new Map,this.row=null,this.flat=!1}}class N{mode="remote";#e;#t;#n;#r;#s=new Map;#i=new Set;#o=I();#l;#a;#c=new Map;#u=[];#d=null;#f="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#S="";#w=null;#A=-1;constructor(C,B){this.#e=C||{mode:"remote"},this.#t=B||{},U(this.#e.fullFrame)&&(this.filteredIndices=()=>this.#F(),this.unfilteredIndices=()=>this.#W(),this.handleFor=$=>this.#V($),this.display=()=>this.#x(),this.grandTotalRow=()=>this.#_(),this.unfilteredRows=()=>this.#I(),this.facetIndices=$=>this.#q($));const x=this.#e.counts;U(x)&&(this.matchCount=()=>this.#Y("match"),this.totalCount=()=>this.#Y("total"));const V=this.#e.grandTotals;U(V)&&(this.grandTotalRow=()=>this.#G());const Y=this.#e.foregroundIdle;U(Y)&&(this.foregroundIdle=()=>this.#me(Y),this.#e.pageForegroundIdle=()=>this.#b?this.#me(Y):null);const F=this.#e;U(F.countMatching)&&U(F.streamMatching)&&(this.selectionQuery=()=>this.#U(),this.countMatching=$=>F.countMatching($),this.streamMatching=($,q)=>F.streamMatching($,q),this.loadedRows=()=>this.#ye(),this.resident=()=>this.#N()!==null),this.#n={pageSize:this.#e.pageSize||l,maxCachedPages:this.#e.maxCachedPages||g},this.#l=t(this.#t),this.#a=new E(this.#n.pageSize*4),this.#h=L(($,q)=>this.#T($,q),Z),this.#r=new O([],0,this.#n),this.#s.set(this.#r.key,this.#r),this.#f=this.#we(),U(this.#e.fetch)||J("source.remote.fetch",'source.mode "remote" requires a fetch function; the grid will stay empty.'),this.#he()}count(){const C=this.#O();return C?C.length:this.#v()}#v(){const C=this.#N();return C?C.count():(this.#de(),this.#$e(this.#r))}#P(){if(this.#N())return!0;const C=B=>{if(B.count===null&&!B.complete)return!1;for(const x of B.children.values())if(this.#ge(x.key)&&!C(x))return!1;return!0};return C(this.#r)}pageInfo(){const C=this.#O(),B=this.totalPending();if(!C){const x=this.#v();return{page:0,pageSize:0,total:this.#P()?x:null,pageCount:1,counting:B}}return{page:C.page,pageSize:C.pageSize,total:C.total,pageCount:C.pageCount,counting:B||C.total===null&&this.#o.size>0&&this.#r.cache.loadedExtent()===0}}#O(){const C=this.#v(),B=r(this.#$("pageSize",0),this.#$("page",0),C,this.#P());if(!B)return this.#S="",null;const x=`${this.#y}:${B.offset}:${B.length}`;return x!==this.#S&&!this.#p&&(this.#S=x,B.length>0&&!this.#N()&&this.#T(B.offset,B.offset+B.length-1)),B}at(C){const B=this.#O();if(B){if(C<0||C>=B.length)return;const x=this.#C(B.offset+C);return x&&(x.index=C),x}return this.#C(C)}#C(C){const B=this.#N();if(B)return B.at(C);if(this.#de(),C<0||C>=this.#v())return;const x=this.#J(this.#r,C);if(!x)return;const V=this.#H(x.node,x.local);return V&&(V.index=C),V||this.#l.skeleton(C,x.node.level,x.node.cache.erroredAt(x.local))}byKey(C){const B=this.#N();if(B)return B.byKey(C);const x=this.#c.get(C);if(!x)return;const V=x.lastIndexOf(":"),Y=this.#s.get(x.slice(0,V));return Y&&this.#H(Y,Number(x.slice(V+1)))||void 0}loaded(C){const B=this.#O();if(B){if(C<0||C>=B.length)return!1;C+=B.offset}const x=this.#N();if(x)return x.loaded(C);if(C<0||C>=this.#v())return!1;const V=this.#J(this.#r,C);return!!V&&V.node.cache.rowLoaded(V.local)}hint(C,B){if(this.#p)return;this.#b=!0;const x=this.#de();let V=Math.max(0,Math.floor(C)),Y=Math.max(V,Math.floor(B));const F=this.#O();if(F){if(F.length===0)return;V=F.offset,Y=F.offset+F.length-1}for(const[$,q]of this.#E(V,Y)){$.cache.protect(q.min,q.max);for(const ee of $.cache.evict())this.#Q($,ee)}this.#h(V,Y),x&&this.#h.flush()}#E(C,B){const x=this.#v(),V=new Map;for(let Y=C;Y<=B&&Y<x;Y++){const F=this.#J(this.#r,Y);if(!F)continue;const $=V.get(F.node);$?($.min=Math.min($.min,F.local),$.max=Math.max($.max,F.local)):V.set(F.node,{min:F.local,max:F.local})}return V.size||V.set(this.#r,{min:C,max:C}),V}#T(C,B){if(!this.#p)for(const[x,V]of this.#E(C,B)){x.cache.protect(V.min,V.max);const Y=x.cache.blockOf(V.min),F=x.cache.blockOf(V.max);for(let $=Y;$<=F&&!(x.count!==null&&$*x.cache.pageSize>=x.count);$++)x.cache.has($)||this.#ue(x,$)}}apply(C){const B={added:[],updated:[],removed:[]};if(!C)return B;if(C.update)for(const x of C.update){const V=this.#c.get(this.#l.keyOf(x,-1));if(!V)continue;this.#a.delete(V);const Y=V.lastIndexOf(":"),F=this.#s.get(V.slice(0,Y));if(!F)continue;const $=Number(V.slice(Y+1)),q=F.cache.blockOf($);if(!F.cache.loaded(q))continue;const{start:ee}=F.cache.rangeOf(q),te=[];for(let ie=ee;ie<ee+F.cache.pageSize;ie++){const ue=F.cache.rowAt(ie);if(ue===void 0)break;te.push(ie===$?x:ue)}F.cache.fill(q,te);const re=this.#H(F,$);re&&B.updated.push(re)}return(C.add&&C.add.length||C.remove&&C.remove.length)&&this.reload({keepExpanded:!0}),B}reload(C){this.#o.abortAll("reload"),this.#h.cancel(),C&&C.keepExpanded===!1&&this.#i.clear(),this.#le(),this.#Z("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#o.abortAll("destroyed"),this.#le(),this.#s.clear(),this.#i.clear(),this.#w&&U(this.#w.destroy)&&this.#w.destroy(),this.#w=null}expand(C){this.#i.has(C)||(this.#i.add(C),this.#Z("group:toggled",{key:C,expanded:!0}),this.#Z("model:changed",{reason:"expand",key:C}))}collapse(C){this.#i.delete(C)&&(this.#Z("group:toggled",{key:C,expanded:!1}),this.#Z("model:changed",{reason:"collapse",key:C}))}expandedKeys(){return[...this.#i]}pivotFields(){return this.#u}pivot(){this.#de();const C=this.#d;if(!C||!C.keys.size||!this.#$("pivotBy",[]).length)return null;if(!C.result){const B=b((this.#t.config||{}).locale),x=[...C.keys.entries()].sort((Y,F)=>S(Y[1],F[1],B)),V=x.map(([Y])=>Y);C.result={keys:x.map(([,Y])=>Y),paths:V,fields:this.#je(V),groupPaths:[],columns:V.length*Math.max(1,this.#ke().length),values:C.cells,cells:C.cells,error:null}}return C.result}invalidateHandles(){this.#w&&(U(this.#w.invalidateHandles)&&this.#w.invalidateHandles(),U(this.#w.invalidate)&&this.#w.invalidate("filter"))}#M(){const C=this.#e.fullFrame;return U(C)?C():null}#N(){const C=this.#M();return C?(this.#w||(this.#w=new m({mode:"memory"},this.#R())),C.version!==this.#A&&(this.#w.setRows(C.rows),this.#A=C.version),this.#w):null}#R(){const C=this.#t,B=C.state||{};return{...C,state:{...B,page:()=>0,pageSize:()=>0}}}#F(){const C=this.#N();return C?C.filteredIndices():new Uint32Array(0)}#W(){const C=this.#N();return C?C.unfilteredIndices():new Uint32Array(0)}#V(C){const B=this.#N();return B?B.handleFor(C):void 0}#x(){const C=this.#N();return C?C.display():[]}#q(C){const B=this.#N();return B&&U(B.facetIndices)?B.facetIndices(C):new Uint32Array(0)}#_(){const C=this.#N();return C&&U(C.grandTotalRow)?C.grandTotalRow():null}#Y(C){const B=this.#N();if(B){const F=C==="match"?B.matchCount:B.totalCount;if(U(F))return F.call(B)}const x=this.#e.counts,V=U(x)?x():null,Y=V?V[C]:null;return typeof Y=="number"?Y:this.#v()}#G(){const C=this.#N();if(C&&U(C.grandTotalRow))return C.grandTotalRow();if((this.#t.config||{}).grandTotalRow!=="bottom")return null;const x=this.#e.grandTotals,V=U(x)?x():null;return!V||!V.totals?null:this.#l.grandTotal(V.totals,V.leafCount||0)}#I(){const C=this.#N();if(C&&U(C.unfilteredRows))return C.unfilteredRows();const B=[],x=this.count();for(let V=0;V<x;V++){const Y=this.at(V);Y&&B.push(Y)}return B}#U(){const C=this.#$("quick",""),B={protocol:G,groupPath:[],groupValues:[],groupBy:[],totals:[],totalFns:{},pivotBy:[],pivotMode:!1,filters:d(this.#$("filters",null),this.#pe()),sort:this.#$("sort",[]),context:this.#$("context",null)};C&&(B.quick=C);const x=this.#$("where",null);return x&&x.active&&(B.where=x),B}#ye(){const C=this.#$("groupBy",[]).length,B=[];for(const x of this.#s.values())if(!(x.level!==C&&!x.flat))for(const V of x.cache.ids()){if(!x.cache.loaded(V))continue;const{start:Y,end:F}=x.cache.rangeOf(V);for(let $=Y;$<F&&x.cache.rowLoaded($);$++){const q=this.#H(x,$);q&&!q.group&&B.push(q)}}return B}loadedCount(){const C=this.#N();if(C){const V=C.matchCount();return typeof V=="number"?V:C.count()}this.#de();const B=this.#$("groupBy",[]).length;let x=0;for(const V of this.#s.values())if(!(V.level!==B&&!V.flat))for(const Y of V.cache.ids()){if(!V.cache.loaded(Y))continue;const F=V.cache.fillOf(Y);typeof F=="number"&&(x+=F)}return x}residentRows(){const C=this.#N();return C?C.display():this.#$("groupBy",[]).length>0?null:(this.#de(),this.#ye())}#ce(C,B,x){const{start:V,end:Y}=C.cache.rangeOf(B),F=this.#$("groupBy",[]),$=this.#$("pivotBy",[]),q=this.#$("quick",""),ee=this.#ke(),te={protocol:G,range:{start:V,end:Y},groupPath:C.path,groupValues:C.values,groupBy:F,totals:ee,totalFns:this.#De(ee),pivotBy:$,pivotMode:$.length>0,filters:d(this.#$("filters",null),this.#pe()),sort:this.#$("sort",[]),context:this.#$("context",null),signal:x};q&&(te.quick=q);const re=this.#$("where",null);return re&&re.active&&(te.where=re),te}async#ue(C,B){if(!U(this.#e.fetch))return;if(!this.#m){this.#m=!0;const F=this.#g;this.#g=[],queueMicrotask(()=>{for(const $ of F)$()})}const x=this.#o.begin(`${C.key}:${B}`);C.cache.begin(B,x);const V=this.#f,{start:Y}=C.cache.rangeOf(B);try{const F=await this.#e.fetch(this.#ce(C,B,x.signal));if(!x.current||V!==this.#f||this.#p)return;x.settle();const $=F&&F.rows||[];if(!!(F&&F[H])&&!C.flat){C.flat=!0,C.children.clear();for(const[re,ie]of[...this.#c])ie.startsWith(`${C.key}:`)&&(this.#a.delete(ie),this.#c.delete(re))}C.cache.fill(B,$),C.failed=!1;for(let re=0;re<$.length;re++)this.#a.delete(`${C.key}:${Y+re}`);const ee=F&&typeof F.count=="number"?F.count:F&&typeof F.total=="number"?F.total:null,te=F&&U(F.pendingTotal?.then)?F.pendingTotal:null;ee!==null?(C.count=ee,C.complete=!0):$.length<C.cache.pageSize?(C.count=Y+$.length,C.complete=!0):te&&(C.counting=!0,C.announced=null),F&&Array.isArray(F.pivotFields)&&this.#Me(F.pivotFields),F&&F.pivot&&typeof F.pivot=="object"&&this.#se(F.pivot),this.#Z("model:changed",{reason:"page",groupPath:C.path,block:B}),this.#Z("rows:changed",{companion:!0,reason:"page",groupPath:C.path,block:B}),this.#ie(C),te&&this.#Ne(C,te,V)}catch(F){if(x.settle(),j(F))return;C.cache.failed(B,F),C.failed=!0;const{end:$}=C.cache.rangeOf(B);for(let q=Y;q<$;q++)this.#a.delete(`${C.key}:${q}`);this.#Z("model:changed",{reason:"page-error",groupPath:C.path,block:B}),this.#Z("source:error",{error:F,groupPath:C.path,block:B})}}async#Ne(C,B,x){let V;try{V=await B}catch(Y){if(x!==this.#f||this.#p)return;C.counting=!1,j(Y)||(C.failed=!0),j(Y)||this.#Z("source:error",{error:Y,groupPath:C.path});return}x!==this.#f||this.#p||(C.counting=!1,typeof V=="number"&&(C.count=V,C.complete=!0,this.#ie(C),this.#Z("model:changed",{reason:"total",count:V,groupPath:C.path})))}#ie(C){typeof C.count!="number"||!C.complete||C.announced!==C.count&&(C.announced=C.count,this.#Z("source:total",{total:C.count,groupPath:C.path}))}#me(C){if(this.#p)return null;this.#de();const B=this.#m?null:new Promise($=>{this.#g.push($),setTimeout($,M)}),x=C();if(!B&&!x)return null;const V=(async()=>{B&&await B;for(let $=C();$;$=C())await $})();let Y;const F=new Promise($=>{Y=setTimeout($,M)});return Promise.race([V,F]).then(()=>clearTimeout(Y))}totalPending(){if(this.#r.failed)return!1;if(this.#r.counting===!0)return!0;if(this.#N())return!1;this.#de();const C=this.#r;return C.count===null&&!C.complete&&C.cache.loadedExtent()===0}totalFailed(){return this.#r.failed===!0}#Me(C){C.length===this.#u.length&&C.every((B,x)=>B===this.#u[x])||(this.#u=C,this.#Z("column:pivoted",{pivotFields:C,remote:!0}))}#Le(){const C=this.#t.config||{};return C.pivot&&C.pivot.separator||v}#je(C){const B=this.#Le(),x=this.#ke();if(!x.length)return C.slice();const V=[];for(const Y of C)for(const F of x)V.push(`${Y}${B}${F}`);return V}#se(C){const B=this.#Le();this.#d||(this.#d={keys:new Map,cells:new Map,result:null});const x=this.#d;let V=!1;const Y=$=>{const q=Array.isArray($)?$:[$],ee=w(q,B);return x.keys.has(ee)||(x.keys.set(ee,q),V=!0),ee},F=this.#$("groupBy",[]).length>0;for(const $ of Array.isArray(C.axis)?C.axis:[])Y($);for(const $ of Array.isArray(C.cells)?C.cells:[]){if(!$||typeof $!="object")continue;const q=Y($.pivot);if(F&&!(Array.isArray($.group)&&$.group.length))continue;const ee=w(Array.isArray($.group)?$.group:[],B);for(const[te,re]of Object.entries($.values||{}))x.cells.set(h(ee,q,te),re)}x.result=null,V&&this.#Me((this.pivot()||{fields:[]}).fields)}#$e(C){let B=this.#oe(C);for(const x of C.children.values())this.#ge(x.key)&&(B+=this.#$e(x));return B}#oe(C){if(C.count!==null)return C.count;const B=C.cache.loadedExtent();return C.complete?B:C.row&&C.row.leafCount>0?C.level>=this.#$("groupBy",[]).length?Math.max(B,C.row.leafCount):B===0?1:Math.min(B+C.cache.pageSize,Math.max(B,C.row.leafCount)):B+C.cache.pageSize}#J(C,B){let x=B,V=0;const Y=[...C.children.entries()].filter(([,$])=>this.#ge($.key)).sort(($,q)=>$[0]-q[0]);for(const[$,q]of Y){const ee=$-V+1;if(x<ee)return{node:C,local:V+x};x-=ee,V=$+1;const te=this.#$e(q);if(x<te)return this.#J(q,x);x-=te}const F=this.#oe(C);return V+x<F?{node:C,local:V+x}:null}#H(C,B){const x=`${C.key}:${B}`,V=this.#a.get(x);if(V)return V;const Y=C.cache.rowAt(B);if(Y===void 0)return null;const F=this.#$("groupBy",[]);let $;if(C.level<F.length&&!C.flat){const q=F[C.level],ee=this.#d!==null&&C.level===F.length-1&&this.#$("pivotBy",[]).length>0,te=this.#fe(Y,q),re=te==null,ie=[...C.path,re?"":String(te)],ue=[...C.keyPath,re?null:String(te)];if($=this.#l.group({path:ie,keyPath:ue,column:q,value:te,level:C.level,parent:C.row,leafCount:Number(Y.leafCount)||0,expanded:ee?!1:this.#ge(o(ue)),...ee?{hasChildren:!1}:{}}),$.totals=this.#B(Y),$.data=Y,!ee){let Ae=this.#s.get($.key);Ae?Ae.row=$:(Ae=new O(ie,C.level+1,this.#n,ue),Ae.row=$,this.#s.set(Ae.key,Ae)),Ae.values=[...C.values,te],C.children.set(B,Ae)}}else $=this.#l.leaf(Y,B,C.level,C.row);return this.#a.set(x,$),this.#c.set($.key,x),$}#B(C){const B=C||{};if(B.totals&&typeof B.totals=="object")return B.totals;const x={};for(const V of this.#ke())Object.hasOwn(B,V)&&(x[V]=B[V]);return x}#Q(C,B){const{start:x,end:V}=C.cache.rangeOf(B);for(let Y=x;Y<V;Y++){const F=`${C.key}:${Y}`,$=this.#a.peek(F);$&&this.#c.delete($.key),this.#a.delete(F)}}#de(){const C=this.#we();return C===this.#f?!1:(this.#f=C,this.#o.abortAll("query"),this.#le(),this.#m=!1,this.#Z("model:changed",{reason:"query"}),!0)}#le(){for(const C of this.#s.values())C.cache.clear(),C.count=null,C.complete=!1,C.announced=null,C.counting=!1,C.failed=!1,C.children.clear(),C.flat=!1;this.#a.clear(),this.#c.clear(),this.#y++,this.#d=null}#we(){const C=this.#$("where",null);return`${n({filters:this.#$("filters",null),sort:this.#$("sort",[]),quick:this.#$("quick",""),groupBy:this.#$("groupBy",[]),pivotBy:this.#$("pivotBy",[]),context:this.#$("context",null)})}|${C?C.version:0}`}#ge(C){const B=this.#$("expanded",null);return B?U(B.has)?B.has(C):Array.prototype.includes.call(B,C):this.#i.has(C)}#ke(){const C=this.#$("totals",[]);if(C&&C.length)return[...C];const B=this.#t.columns;return!B||!U(B.all)?[]:B.all().filter(x=>!!x.total).map(x=>x.id)}#De(C){const B=this.#t.columns,x={};if(!B||!U(B.get))return x;for(const V of C){const Y=B.get(V);if(!Y)continue;const F=Y.groupTotal!=null?Y.groupTotal:Y.total;typeof F=="string"&&(x[V]=F)}return x}#fe(C,B){const x=this.#t.columns,V=x&&U(x.get)?x.get(B):void 0;return V&&U(V.getValue)?V.getValue(C):C?.[B]}#he(){p(this.#t)}#pe(){const C=this.#t.config||{};return{tz:C.timeZone,weekStartsOn:C.weekStartsOn}}#$(C,B){const x=this.#t.state;if(x&&U(x[C])){const V=x[C]();return V??B}return B}#Z(C,B){const x=this.#t.emit;U(x)&&x(C,B)}}}),ze("packages/core/src/source/gapbuffer.js",function(e,_){"use strict";Object.defineProperty(e,"GapBuffer",{enumerable:!0,get:function(){return E}});const ne=64;class E{#e;#t=0;#n=0;constructor(U=ne){this.#e=new Uint32Array(Math.max(1,U)),this.#n=this.#e.length}static from(U,D=ne){const J=new E(U.length+Math.max(1,D));return J.#e.set(U,0),J.#t=U.length,J.#n=J.#e.length,J}get length(){return this.#t+(this.#e.length-this.#n)}get capacity(){return this.#e.length}at(U){return U<0||U>=this.length?0:U<this.#t?this.#e[U]:this.#e[U+(this.#n-this.#t)]}insert(U,D){const J=U<0?0:U>this.length?this.length:U;this.#r(J),this.#t===this.#n&&this.#s(),this.#e[this.#t++]=D}push(U){this.insert(this.length,U)}removeAt(U){return!Number.isInteger(U)||U<0||U>=this.length?!1:(this.#r(U),this.#n++,!0)}toArray(){const U=new Uint32Array(this.length);return U.set(this.#e.subarray(0,this.#t),0),U.set(this.#e.subarray(this.#n),this.#t),U}clear(){this.#t=0,this.#n=this.#e.length}#r(U){if(U!==this.#t)if(U<this.#t){const D=this.#t-U;this.#e.copyWithin(this.#n-D,U,this.#t),this.#t=U,this.#n-=D}else{const D=U-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+D),this.#t=U,this.#n+=D}}#s(){const U=this.#e.length-this.#n,D=new Uint32Array(Math.max(this.#e.length*2,this.#e.length+ne));D.set(this.#e.subarray(0,this.#t),0),D.set(this.#e.subarray(this.#n),D.length-U),this.#e=D,this.#n=D.length-U}}}),ze("packages/core/src/store/ingest.js",function(e,_){"use strict";Object.defineProperty(e,"INGEST_DEFAULTS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"inferKind",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"decideText",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"createReaders",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"Ingest",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return d}});const ne=_("packages/core/src/internal/schedule.js"),E=ne.now,K=ne.nextFrame,U=_("packages/core/src/internal/warn.js"),D=U.infoOnce,J=U.warnOnce,L=_("packages/core/src/internal/predicates.js").isFunction,I=_("packages/core/src/internal/paths.js").pathGetter,k=_("packages/core/src/store/columnstore.js").ColumnStore,y=Object.freeze({chunkMs:8,chunkRows:512,sampleSize:100,dictionaryRatio:.1,columnarBelow:5e3,initialCapacity:1024});function l(n,p={}){if(p.multi)return"multi";if(n.length===0)return"object";let i=0,r=0,f=0,m=0,u=0;for(let a=0;a<n.length;a++){const h=n[a];typeof h=="number"?i++:typeof h=="boolean"?r++:typeof h=="string"?f++:h instanceof Date?m++:Array.isArray(h)&&u++}const b=n.length;return i===b?"float64":r===b?"bitset":m===b?"float64":f===b?"text":u===b?"multi":"object"}function g(n,p,i){return p<=0||n<i*p?"dictionary":"object"}function s(n,p,i){const r=new Map,f=new Map;for(const G of n){if(G.computed)continue;const Z=L(G.read)?G.read:I(G.field||G.id);f.set(G.id,Z),r.set(G.id,Z)}const m=p?.order??[],u=p?.fns??{},b=p?.deps??{},a=p?.wrapDeps??null,h=m.filter(G=>L(u[G])),w=h.some(G=>b[G]==="*");let v=new WeakMap;const A=G=>{const Z={};if(w)for(const[M,S]of f)Z[M]=S(G);for(const M of h){const S=b[M];let T;if(S==="*")T=Z;else{T={};const O=S||[];for(let N=0;N<O.length;N++){const P=O[N];T[P]=P in Z?Z[P]:f.get(P)?.(G)}}Z[M]=u[M](a?a(T,M):T,{data:G,row:null,column:null,grid:null,context:i})}return Z},H=G=>{if(G===null||typeof G!="object"&&typeof G!="function")return A(G);let Z=v.get(G);return Z===void 0&&(Z=A(G),v.set(G,Z)),Z};for(const G of h)r.set(G,Z=>H(Z)[G]);return{readers:r,reset(){v=new WeakMap}}}class t{spec;read;kind;inferred;nullable;candidate=!1;distinct=null;change=null;reason="";constructor(p,i){this.spec=p,this.read=i,this.kind="object",this.inferred=!1,this.nullable=p.nullable!==!1}}class o{#e;#t=[];#n=null;#r;#s=0;#i;#o=!1;#l=!1;#a=0;#c;constructor(p,i={},r={}){this.#e=Array.isArray(p)?p:Array.from(p||[]),this.#i={...y,...r};const f=i.columns??[];this.#r=s(f,i.computed??null,i.context),this.#c=this.#e.length>=this.#i.columnarBelow,this.#u(f,i.computed??null),this.#n=new k(this.#t.map(m=>({id:m.spec.id,kind:m.kind,nullable:m.nullable,read:m.read,dictionary:m.spec.dictionary})),{initialCapacity:this.#i.initialCapacity,columnarBelow:this.#i.columnarBelow})}get store(){return this.#n}get done(){return this.#o||this.#l}get progress(){return this.#s}slice(){if(this.done)return!1;if(this.#i.signal?.aborted)return this.#l=!0,!1;const p=E(),{chunkMs:i,chunkRows:r}=this.#i,f=this.#e.length;do{const m=Math.min(this.#s+r,f);this.#n.append(this.#e.slice(this.#s,m)),this.#d(this.#s,m),this.#s=m,this.#r.reset(),this.#h(!1)}while(this.#s<f&&E()-p<i);return this.#a+=E()-p,this.#i.onProgress?.({loaded:this.#s,total:f}),this.#s>=f?(this.#h(!0),this.#o=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(p=>({id:p.spec.id,kind:p.kind,nullable:p.nullable,read:p.read,dictionary:p.spec.dictionary})),decisions:this.#t.map(p=>({id:p.spec.id,kind:p.kind,nullable:p.nullable,inferred:p.inferred,distinct:p.candidate||p.change?this.#f(p):null,change:p.change,reason:p.reason})),count:this.#n.count,elapsed:this.#a,cancelled:this.#l}}#u(p,i){const r=this.#e,f=Math.min(this.#i.sampleSize,r.length),m=this.#i.dictionaryRatio,u=i?.pure instanceof Set?i.pure:new Set(i?.pure??i?.order??[]);for(const b of p){if(!b||!b.id)continue;if(b.computed&&(b.pure===!1||i&&!u.has(b.id))){J(`ingest.impure.${b.id}`,`column "${b.id}" is an impure computed column and is not materialised into the store`);continue}const a=this.#r.readers.get(b.id)??(L(b.read)?b.read:I(b.field||b.id)),h=new t(b,a);if(b.kind)h.kind=b.kind,h.reason="declared by the caller";else if(b.dictionary)h.kind=b.multi?"multi":"dictionary",h.reason="value table supplied (lookup column)";else{const w=[];for(let A=0;A<f&&w.length<this.#i.sampleSize;A++){const H=a(r[A]);H!=null&&w.push(H)}h.inferred=!0;const v=l(w,{multi:b.multi});if(v==="text"){const A=new Set(w).size;h.kind=g(A,w.length,m),h.candidate=this.#c,h.reason=`sampled ${A} distinct in ${w.length}`}else h.kind=v,h.reason=`inferred from ${w.length} sampled values`,v==="object"&&w.length&&D(`ingest.mixed.${b.id}`,`column "${b.id}" holds mixed or unrecognised value types; storing as an object array. Declare a type to avoid this.`);h.kind==="object"&&h.candidate&&(h.distinct=new Set(w))}this.#t.push(h)}}#d(p,i){const r=this.#e;for(const f of this.#t){if(!f.candidate||!f.distinct)continue;const m=f.distinct;for(let u=p;u<i;u++){const b=f.read(r[u]);b!=null&&m.add(b)}}}#f(p){if(p.distinct)return p.distinct.size;const i=this.#n.column(p.spec.id);return i?.dict?i.dict.size:0}#h(p){const i=this.#i.dictionaryRatio,r=this.#e.length;for(const f of this.#t){if(!f.candidate)continue;const m=this.#f(f);if(f.kind==="dictionary"&&m>=i*r){const u=this.#n.column(f.spec.id);f.distinct=new Set(u?.dict?u.dict.values():[]),this.#n.convert(f.spec.id,"object"),f.kind="object",f.change="demoted",f.reason=`${m} distinct values is at or above ${i*100}% of ${r} rows`;continue}if(f.kind==="object"&&m>=i*r){f.candidate=!1,f.distinct=null,f.reason=`${m} distinct values is at or above ${i*100}% of ${r} rows`;continue}p&&f.kind==="object"&&m<i*r&&(this.#n.convert(f.spec.id,"dictionary"),f.kind="dictionary",f.change=f.change==="demoted"?null:"promoted",f.reason=`${m} distinct values is below ${i*100}% of ${r} rows`,f.distinct=null),p&&(f.candidate=!1)}}}async function c(n,p={},i={}){const r=new o(n,p,i),f=i.scheduler?.frame??K;for(;r.slice();)await new Promise(m=>{f(m)});return r.result()}function d(n,p={},i={}){const r=new o(n,p,{...i,chunkMs:1/0});for(;r.slice(););return r.result()}}),ze("packages/core/src/store/columnpack.js",function(e,_){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return g}});const E=_("packages/core/src/internal/paths.js").pathGetter,K=_("packages/core/src/store/ingest.js"),U=K.inferKind,D=K.decideText,J=K.INGEST_DEFAULTS,L=_("packages/core/src/store/columnstore.js").toFloat,X=new Set(["float64","int32","bitset","dictionary","object","multi"]);function I(s){if(!Array.isArray(s)||s.length===0)return!1;for(const t of s)if(!t||typeof t.id!="string"||typeof t.field!="string"||t.field===""||t.kind&&!X.has(t.kind))return!1;return!0}function j(s){const t=L(s);return Number.isFinite(t)?t|0:0}function k(s){return s==null?[]:Array.isArray(s)?s:[s]}function y(s,t,o,c){if(s.kind)return s.kind;const d=[];for(let i=0;i<t.length&&d.length<J.sampleSize;i++){const r=t[i];r!=null&&d.push(r)}const n=U(d,{multi:s.multi});if(n!=="text")return n;const p=new Set(d).size;return D(p,d.length,c)}function l(s,t,o={}){const c=t.length|0,d=o.dictionaryRatio??J.dictionaryRatio,n=[];for(const p of s){const i=E(p.field||p.id),r=p.nullable!==!1,f=new Array(c);for(let h=0;h<c;h++){const w=i(t[h]);f[h]=w===void 0?null:w}const m=y(p,f,c,d),u=r?new Uint8Array(c+7>>3):null,b=h=>{u&&(u[h>>3]|=1<<(h&7))};let a;switch(m){case"float64":{const h=new Float64Array(c);for(let w=0;w<c;w++){const v=f[w],A=v===null;A||b(w),h[w]=A?NaN:L(v)}a={id:p.id,kind:m,nullable:r,values:h,presence:u,offsets:null,table:null};break}case"int32":{const h=new Int32Array(c);for(let w=0;w<c;w++){const v=f[w],A=v===null;A||b(w),h[w]=A?0:j(v)}a={id:p.id,kind:m,nullable:r,values:h,presence:u,offsets:null,table:null};break}case"bitset":{const h=new Uint8Array(c+7>>3);for(let w=0;w<c;w++){const v=f[w],A=v===null;A||b(w),!A&&v&&(h[w>>3]|=1<<(w&7))}a={id:p.id,kind:m,nullable:r,values:h,presence:u,offsets:null,table:null};break}case"dictionary":{const h=new Uint32Array(c),w=[],v=new Map;for(let A=0;A<c;A++){const H=f[A];if(H===null){h[A]=0;continue}b(A);let G=v.get(H);G===void 0&&(G=w.length,w.push(H),v.set(H,G)),h[A]=G}a={id:p.id,kind:m,nullable:r,values:h,presence:u,offsets:null,table:w};break}case"multi":{const h=[],w=new Map,v=new Uint32Array(c+1),A=[];for(let H=0;H<c;H++){const G=f[H];v[H]=A.length,G===null||b(H);const M=k(G);for(let S=0;S<M.length;S++){const T=M[S];let O=w.get(T);O===void 0&&(O=h.length,h.push(T),w.set(T,O)),A.push(O)}}v[c]=A.length,a={id:p.id,kind:m,nullable:r,values:Int32Array.from(A),presence:u,offsets:v,table:h};break}default:{const h=new Array(c);for(let w=0;w<c;w++){const v=f[w];v!==null&&b(w),h[w]=v}a={id:p.id,kind:"object",nullable:r,values:h,presence:u,offsets:null,table:null};break}}n.push(a)}return{count:c,columns:n}}function g(s){const t=[];if(!s||!Array.isArray(s.columns))return t;const o=c=>{ArrayBuffer.isView(c)&&c.buffer&&!t.includes(c.buffer)&&t.push(c.buffer)};for(const c of s.columns)o(c.values),o(c.presence),o(c.offsets);return t}}),ze("packages/core/src/source/stream.js",function(e,_){"use strict";Object.defineProperty(e,"DEFAULT_PROMOTE_BELOW",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"createStreamSource",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return O}});const E=_("packages/core/src/internal/lru.js").Lru,U=_("packages/core/src/internal/predicates.js").isFunction,D=_("packages/core/src/internal/schedule.js"),J=D.now,z=D.nextFrame,L=D.cancelFrame,X=D.whenIdle,j=_("packages/core/src/internal/compare.js").defaultCompare,k=_("packages/core/src/internal/warn.js"),y=k.warnOnce,l=k.infoOnce,s=_("packages/core/src/internal/paths.js").getPath,t=_("packages/core/src/source/abort.js"),o=t.createAbortScope,c=t.isAbortError,d=_("packages/core/src/source/rows.js"),n=d.createRowFactory,p=d.lazyRowView,r=_("packages/core/src/source/gapbuffer.js").GapBuffer,m=_("packages/core/src/source/memory.js").createMemorySource,b=_("packages/core/src/source/filterwire.js").querySignature,h=_("packages/core/src/store/columnpack.js").isPortableSchema,w=25e4,v=Symbol("lattice.stream.storeBacked"),A=8,H=.1,G=1e3,Z=50;function M(N){return Math.min(G,Math.max(Z,Math.floor(N/4)))}function S(N){if(N instanceof Date)return N.getTime();if(typeof N=="number")return Number.isFinite(N)?N:NaN;if(typeof N=="string"){const P=N.trim();if(!P)return NaN;const C=Date.parse(P);return Number.isNaN(C)?Number(P):C}return NaN}function T(N,P){return new O(N,P)}class O{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#s=[];#i=null;#o;#l;#a=new Map;#c=o();#u={loaded:0,estimated:void 0};#d=null;#f=0;#h=0;#p=0;#m=0;#g=null;#b=null;#y=null;#S=!1;#w=!1;#A=!1;#v=!1;#P="";#O=0;#C=0;#E=0;#T=null;#M=1/0;#N=!1;#R=null;#F=null;#W=null;#V=null;#x=!1;#q=0;#_=0;#Y=!1;constructor(P,C){this.#e=P||{mode:"stream"},this.#t=C||{},this.#o=n(this.#t),this.#l=new E(4096),this.#P=this.#Be();const B=(this.#t.config||{}).ingest;this.#x=!!B&&B.retainSource===!1,U(this.#e.open)||y("source.stream.open",'source.mode "stream" requires an open function; the grid will stay empty.'),this.#e.autoStart!==!1&&queueMicrotask(()=>this.start());const x=Number(this.#e.poll);Number.isFinite(x)&&x>0&&(this.#V=setInterval(()=>{this.#v||this.reload()},x),this.#V&&U(this.#V.unref)&&this.#V.unref()),this.#I()}#G(){const P=Number(this.#e.maxAge);return Number.isFinite(P)&&P>0?P:0}#I(){const P=this.#G();if(!P)return;const C=this.#e.ageBy;U(C)?this.#F=C:typeof C=="string"&&C?this.#F=B=>s(B,C):this.#F=null,this.#T=[],this.#R=setInterval(()=>{this.#v||this.#U()&&(this.#de(),this.#re())},M(P)),this.#R&&U(this.#R.unref)&&this.#R.unref()}#U(){const P=this.#G();return!P||!this.#T?!1:this.#N?!0:this.#M<Date.now()-P*(1+H)}#ye(P,C){if(!this.#T)return;const B=this.#F?S(this.#F(C)):Date.now();this.#T[P]=B,Number.isNaN(B)||(B<this.#M&&(this.#M=B),B<Date.now()-this.#G()&&(this.#N=!0))}#ce(){return this.#Se("groupBy",[]).length>0?!0:!!this.#Se("pivotMode",!1)&&this.#Se("pivotBy",[]).length>0}#ue(){if(this.#g||this.#v)return;const P=this.#ce();if(P&&!this.#b){this.#b=m({mode:"memory",rows:this.#n},this.#Ne()),this.#S=!1;return}!P&&this.#b&&(this.#b.destroy(),this.#b=null)}#Ne(){if(this.#y)return this.#y;const P=this,C={liveIndices:()=>P.#ie(),live:B=>P.#n[B]!==void 0,source:B=>P.#Ae(B),get physical(){return P.#n.length}};return this.#x&&(C.column=B=>{const x=P.#t.store;return x&&U(x.column)?x.column(B):void 0}),this.#y=Object.create(this.#t,{store:{value:C,enumerable:!0,configurable:!0}}),this.#y}#ie(){const P=new Uint32Array(this.#n.length);let C=0;for(let B=0;B<this.#n.length;B++)this.#n[B]!==void 0&&(P[C++]=B);return P.subarray(0,C)}#me(){return this.#g?this.#g:this.#b?(this.#S&&(this.#S=!1,this.#b.setRows(this.#n)),this.#b):null}invalidate(P="filter"){if(this.#g){this.#g.invalidate(P);return}this.#ue(),this.#b&&this.#b.invalidate(P),(P==="filter"||P==="sort")&&this.#ke()}count(){const P=this.#me();return P?P.count():this.#r?this.#r.length:this.#O}matchCount(){const P=this.#me();return P&&U(P.matchCount)?P.matchCount():this.#r?this.#r.length:this.#O}totalCount(){const P=this.#me();return P&&U(P.totalCount)?P.totalCount():this.#O}unfilteredRows(){const P=this.#me();if(P&&U(P.unfilteredRows))return P.unfilteredRows();const C=[];for(let B=0;B<this.#n.length;B++){if(!this.#n[B])continue;const x=this.#k(B);x&&C.push(x)}return C}at(P){const C=this.#me();if(C)return C.at(P);if(P<0||P>=this.count())return;const B=this.#r?this.#r.at(P):P,x=this.#k(B);return x.index=P,x}byKey(P){const C=this.#me();if(C)return C.byKey(P);const B=this.#a.get(P);return B===void 0?void 0:this.#k(B)}leavesOf(P){const C=this.#me();return C&&U(C.leavesOf)?C.leavesOf(P):[]}loaded(P){return P>=0&&P<this.count()}hint(P,C){if(this.#g){this.#g.hint(P,C);return}this.#Me(),this.#p=Math.max(0,Math.floor(P))}#Me(){this.#v||this.#Be()===this.#P||this.reload()}display(){const P=this.#me();return P?P.display():p(()=>this.count(),C=>this.at(C))}apply(P){if(this.#g)return this.#g.apply(P);const C={added:[],updated:[],removed:[]};if(!P)return C;if(P.update){let B=!1;for(const x of P.update){const V=this.#a.get(this.#o.keyOf(x,-1));if(V===void 0)continue;const Y=this.#he(V);this.#x?this.#He(V,x):this.#n[V]=x,this.#l.delete(V),this.#pe(V,Y),this.#T&&(this.#ye(V,x),B=!0),this.#S=!0,C.updated.push(this.#k(V))}B&&this.#de()}if(P.add&&P.add.length){const B=this.#B(P.add);for(const x of B)C.added.push(this.#k(x))}return P.remove&&P.remove.length&&y("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#re(),C}reload(P){this.#c.abortAll("reload"),this.#Xe(),this.#b&&(this.#b.destroy(),this.#b=null),this.#S=!1,this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear(),this.#g=null,this.#O=0,this.#C=0,this.#E=0,this.#T&&(this.#T=[]),this.#M=1/0,this.#N=!1,this.#w=!1,this.#A=!1,this.#u={loaded:0,estimated:void 0},this.#P=this.#Be(),this.#Oe("model:changed",{reason:"reload"}),this.start()}destroy(){this.#v=!0,this.#V!==null&&(clearInterval(this.#V),this.#V=null),this.#R!==null&&(clearInterval(this.#R),this.#R=null),this.#T=null,this.#c.abortAll("destroyed"),this.#Xe(),this.#d!==null&&(this.#ve(this.#d),this.#d=null),this.#b&&(this.#b.destroy(),this.#b=null),this.#g&&this.#g.destroy(),this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear()}async start(){if(this.#A||this.#v||!U(this.#e.open))return;this.#A=!0;const P=this.#c.begin("stream");this.#ke(),this.#ue();let C;try{C=this.#e.open({sort:this.#Se("sort",[]),filters:this.#Se("filters",null),quick:this.#Se("quick","")||void 0,context:this.#Se("context",null),signal:P.signal})}catch(x){this.#Oe("source:error",{error:x});return}const B=U(C[Symbol.asyncIterator])?C[Symbol.asyncIterator]():C[Symbol.iterator]();this.#W=B;try{for(;;){const x=await B.next();if(!P.current||this.#v)return;if(x.done){this.#ne();return}if(await this.#Le(x.value,P),!P.current||this.#v)return;if(x.value&&x.value.done){this.#ne();return}if(await this.#_e(),!P.current||this.#v)return}}catch(x){if(c(x))return;this.#Oe("source:error",{error:x})}finally{P.settle()}}progress(){return{loaded:this.#u.loaded,estimated:this.#u.estimated,done:this.#w,live:this.#O,evicted:this.#C}}promoted(){return this.#g!==null}memorySource(){return this.#g}invalidateHandles(){const P=this.#me();P&&(U(P.invalidateHandles)&&P.invalidateHandles(),U(P.invalidate)&&P.invalidate("sort"))}renderCount(){return this.#f}ingestStats(){return{worker:this.#q,inline:this.#_,storeBacked:this.#x}}#Le(P,C){if(!P)return;const B=P.rows;if(B&&B.length&&this.#se(B))return this.#oe(P,C);const x=J();B&&B.length&&(this.#B(B),this.#_++),this.#je(P),this.#h+=J()-x,this.#re()}#je(P){this.#u.loaded=P.progress&&typeof P.progress.loaded=="number"?P.progress.loaded:this.#n.length,P.progress&&typeof P.progress.estimated=="number"&&(this.#u.estimated=P.progress.estimated)}#se(P){if(this.#Y||this.#g)return!1;const C=this.#J();if(!C)return!1;const B=this.#t.store;if(!B||!U(B.appendPacked))return!1;const x=this.#H();return!x||!h(x)?(this.#Y=!0,l("source.stream.ingest-worker","stream ingest.useWorker is on but a column reads through a closure (a computed or date column); columnizing on the main thread instead."),!1):P.length<C.threshold?!1:!this.#$e(P)}#$e(P){if(!this.#o.keyed)return!1;const C=new Set;for(let B=0;B<P.length;B++){const x=this.#o.keyOf(P[B],this.#n.length+B);if(x!=null){if(C.has(x)||this.#a.has(x))return!0;C.add(x)}}return!1}async#oe(P,C){const B=P.rows,x=this.#J(),V=this.#H();let Y;try{Y=await x.columnize(V,B,{key:"ingest:stream",signal:C&&C.signal})}catch(te){if(c(te)||(y("source.stream.columnize","worker columnization failed; columnizing on the main thread",te),this.#Y=!0,C&&(!C.current||this.#v)))return;this.#B(B),this.#_++,this.#je(P),this.#re();return}if(C&&(!C.current||this.#v))return;const F=this.#t.store,$=this.#x?void 0:B,{from:q}=F.appendPacked(Y,$),ee=Y.count|0;for(let te=0;te<ee;te++){const re=q+te,ie=B[te],ue=this.#o.keyed?this.#o.keyOf(ie,re):null;if(this.#n[re]=this.#x?v:ie,this.#O++,this.#ye(re,ie),ue!==null&&this.#a.set(ue,re),!this.#r||!this.#De(re))continue;const Ae=this.#$(re);this.#r.insert(Ae,re),Ae<=this.#p&&this.#m++}this.#S=!0,this.#de(),this.#q++,this.#je(P),this.#re()}#J(){const P=this.#t.ingestWorker;return U(P)?P():null}#H(){const P=this.#t.storeSchema;return U(P)?P():null}#B(P){const C=[],B=this.#t.store,x=new Array(P.length),V=[],Y=new Set;for(let $=0;$<P.length;$++){const q=this.#o.keyed?this.#o.keyOf(P[$],this.#n.length+V.length):null;x[$]=q,!(q!==null&&(this.#a.has(q)||Y.has(q)))&&(q!==null&&Y.add(q),V.push(P[$]))}let F=V.length&&B&&U(B.append)?B.append(V).from:this.#n.length;for(let $=0;$<P.length;$++){const q=P[$],ee=x[$];if(ee!==null&&this.#a.has(ee)){const ie=this.#a.get(ee),ue=this.#he(ie);this.#x||(this.#n[ie]=q,B&&U(B.setSource)&&B.setSource(ie,q)),this.#He(ie,q),this.#l.delete(ie),this.#ye(ie,q),this.#pe(ie,ue);continue}const te=F++;if(this.#n[te]=this.#x?v:q,this.#O++,this.#ye(te,q),ee!==null&&this.#a.set(ee,te),C.push(te),!this.#r||!this.#De(te))continue;const re=this.#$(te);this.#r.insert(re,te),re<=this.#p&&this.#m++}return this.#S=!0,this.#de(),C}#Q(P){const C=this.#n[P];let B=!1;if(this.#r){const F=this.#ge(P);F>=0&&F<=this.#p&&(B=!0)}else P<=this.#p&&(B=!0);const x=C===v?this.#Ae(P):C,V=this.#o.keyed?this.#o.keyOf(x,P):null;V!==null&&this.#a.get(V)===P&&this.#a.delete(V),this.#n[P]=void 0,this.#T&&(this.#T[P]=NaN),this.#l.delete(P);const Y=this.#t.store;return Y&&U(Y.remove)&&Y.remove(P),this.#O--,B}#de(){let P=0,C=0;const B=this.#we();P+=B.dropped,C+=B.aboveAnchor;const x=this.#le();P+=x.dropped,C+=x.aboveAnchor,P&&(this.#S=!0,this.#C+=P,this.#ke(),this.#m-=C,this.#Oe("stream:evicted",{evicted:P,total:this.#C,live:this.#O}))}#le(){const P=this.#e.maxRows;if(!Number.isFinite(P)||P<=0||this.#O<=P)return{dropped:0,aboveAnchor:0};const C=Math.max(1,Math.floor(P*(1-H)));let B=0,x=0;for(;this.#O>C&&this.#E<this.#n.length;){const V=this.#E++;this.#n[V]!==void 0&&(this.#Q(V)&&x++,B++)}return{dropped:B,aboveAnchor:x}}#we(){const P=this.#G();if(!P||!this.#T||!this.#U())return{dropped:0,aboveAnchor:0};const C=Date.now()-P;let B=0,x=0,V=1/0;for(let Y=this.#E;Y<this.#n.length;Y++){if(this.#n[Y]===void 0)continue;const F=this.#T[Y];if(!(Number.isNaN(F)||F===void 0)){if(F>=C){F<V&&(V=F);continue}this.#Q(Y)&&x++,B++}}for(this.#M=V,this.#N=!1;this.#E<this.#n.length&&this.#n[this.#E]===void 0;)this.#E++;return{dropped:B,aboveAnchor:x}}#ge(P){if(!this.#r)return P;for(let C=0;C<this.#r.length;C++)if(this.#r.at(C)===P)return C;return-1}#ke(){this.#s=this.#Se("sort",[]),this.#i=this.#Se("filters",null);const P=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#G()>0,C=this.#Se("where",null),B=(this.#t.config||{}).hostFilter,x=!!(C&&C.active)||!!(B&&U(B.active)&&B.active());if(!(P||this.#s.length>0||!!this.#i||!!this.#Se("quick","")||x)){this.#r=null;return}this.#r=new r(Math.max(64,this.#n.length+64));for(let Y=0;Y<this.#n.length;Y++)this.#n[Y]!==void 0&&this.#De(Y)&&this.#r.insert(this.#$(Y),Y)}#De(P){const C=this.#Ae(P);if(this.#i&&!this.#fe(this.#i,C))return!1;const B=String(this.#Se("quick","")||"").toLowerCase();if(B&&!this.#We(C).includes(B))return!1;const x=(this.#t.config||{}).hostFilter;if(x&&U(x.active)&&x.active()&&!x.passes(this.#k(P)))return!1;const V=this.#Se("where",null);if(V&&V.active){const Y=this.#k(P);if(!V.passes(Y.data,Y.key))return!1}return!0}#fe(P,C){if(!P)return!0;const B=P;if(Array.isArray(B.conditions))return B.op==="or"?B.conditions.some(Y=>this.#fe(Y,C)):B.op==="not"?!B.conditions.some(Y=>this.#fe(Y,C)):B.conditions.every(Y=>this.#fe(Y,C));const x=P,V=(this.#t.compute||{}).testValue;return U(V)?!!V(this.#Ce(C,x.col),x,(this.#t.config||{}).locale):(y("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#he(P){if(!this.#r)return-1;if(!this.#s.length)return this.#ge(P);let C=0,B=this.#r.length;for(;C<B;){const x=C+B>>>1;this.#Z(this.#r.at(x),P)<0?C=x+1:B=x}for(let x=C;x<this.#r.length;x++){const V=this.#r.at(x);if(V===P)return x;if(this.#Z(V,P)>0)break}return this.#ge(P)}#pe(P,C){if(!this.#r||!this.#s.length)return;const B=this.#De(P);if(C>=0&&this.#r.at(C)===P)this.#r.removeAt(C),C<=this.#p&&this.#m--;else if(C>=0)return;if(!B)return;const x=this.#$(P);this.#r.insert(x,P),x<=this.#p&&this.#m++}#$(P){if(!this.#r||!this.#s.length)return this.#r?this.#r.length:0;let C=0,B=this.#r.length;for(;C<B;){const x=C+B>>>1;this.#Z(P,this.#r.at(x))<0?B=x:C=x+1}return C}#Z(P,C){const B=this.#Ae(P),x=this.#Ae(C);for(const V of this.#s){const Y=this.#Ye(V.col),F=this.#Ce(B,V.col),$=this.#Ce(x,V.col),ee=(Y&&Y.value&&U(Y.value.compare)?Y.value.compare:j)(F,$);if(ee!==0)return V.dir==="desc"?-ee:ee}return 0}#ne(){this.#w=!0,this.#u.loaded=this.#u.loaded||this.#n.length;const P=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:w;!this.#x&&this.#n.length<P&&(this.#g=m({mode:"memory",rows:this.#n},this.#t),this.#R!==null&&(clearInterval(this.#R),this.#R=null),this.#b&&(this.#b.destroy(),this.#b=null)),this.#re(),this.#Oe("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:P})}#re(){this.#d!==null||this.#v||(this.#d=this.#D(()=>{this.#d=null,this.#f++;const P=this.#m;this.#m=0,this.#h=0,this.#Oe("stream:chunk",{loaded:this.#u.loaded,estimated:this.#u.estimated,count:this.count(),renders:this.#f}),this.#Oe("model:changed",{reason:"stream",shiftAboveViewport:P,anchor:this.#p}),this.#Oe("rows:changed",{companion:!0,reason:"stream"})}))}#_e(){return this.#f===0||this.#h<this.#K()?Promise.resolve():(this.#h=0,new Promise(P=>{const C=(this.#t.scheduler||{}).idle;U(C)?C(()=>P()):X(()=>P())}))}#K(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:A}#D(P){const C=this.#t.scheduler||{};return U(C.frame)?C.frame(P):z(P)}#ve(P){const C=this.#t.scheduler||{};U(C.cancel)?C.cancel(P):L(P)}#Ae(P){const C=this.#n[P];if(C!==void 0&&C!==v)return C;if(C===void 0)return;const B=this.#t.store;return B&&U(B.source)?B.source(P):void 0}#He(P,C){const B=this.#t.store;if(!B||!U(B.set))return;const x=this.#H();if(Array.isArray(x))for(const V of x){if(!V||!V.id)continue;const Y=U(V.read)?V.read:F=>s(F,V.field||V.id);B.set(V.id,P,Y(C))}}#k(P){let C=this.#l.get(P);return C||(C=this.#o.leaf(this.#Ae(P),P),this.#l.set(P,C)),C}#Ce(P,C){const B=this.#Ye(C);return B&&U(B.getValue)?B.getValue(P):P?.[C]}#We(P){const C=this.#t.columns,B=C&&U(C.all)?C.all():[],x=[];for(const V of B){const Y=U(V.getValue)?V.getValue(P):void 0;Y!=null&&Y!==""&&x.push(String(Y))}return x.join(" ").toLowerCase()}#Ye(P){const C=this.#t.columns;return C&&U(C.get)?C.get(P):void 0}#Xe(){const P=this.#W;if(this.#W=null,P&&U(P.return))try{P.return()}catch{}}#Be(){return b({context:this.#Se("context",null)})}#Se(P,C){const B=this.#t.state;if(B&&U(B[P])){const x=B[P]();return x??C}return C}#Oe(P,C){const B=this.#t.emit;U(B)&&B(P,C)}}}),ze("packages/core/src/source/url.js",function(e,_){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return y}});const E=_("packages/core/src/internal/warn.js").warnOnce,K=_("packages/core/src/internal/predicates.js"),U=K.isObject,D=K.isFunction,z=_("packages/core/src/internal/paths.js").getPath,X=_("packages/core/src/source/abort.js").isAbortError,I=500,j=new Set(["application/x-ndjson","application/ndjson","application/jsonlines","application/jsonl","application/x-jsonlines","text/x-ndjson"]),k=Symbol("lattice.url.skip");function y(u,b={}){const a=U(b)?b:{},h=D(a.fetch)?a.fetch:typeof globalThis<"u"&&D(globalThis.fetch)?globalThis.fetch:null,w=a.format==="json"||a.format==="ndjson"?a.format:void 0,v=typeof a.rowsPath=="string"&&a.rowsPath?a.rowsPath:void 0,A=D(a.map)?a.map:void 0,H=U(a.headers)?a.headers:void 0,G=Number.isFinite(a.batchSize)&&a.batchSize>0?Math.floor(a.batchSize):I,Z=a.lenient===!0,M=Number.isFinite(a.poll)&&a.poll>0?Math.floor(a.poll):void 0,S=typeof u=="string"&&u.length>0;S||E("source.url.url","createUrlSource needs a URL string; the grid will stay empty.");async function*T(N={}){if(!S)return;if(!h)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const P=N&&N.signal;let C;try{C=await h(u,H?{signal:P,headers:H}:{signal:P})}catch(V){throw X(V)?V:new Error(`[lattice] createUrlSource: request to ${u} failed — ${V&&V.message||V}`)}if(!C||!C.ok){const V=C?C.status:"no response";throw new Error(`[lattice] createUrlSource: ${V} for ${u}`)}const B=l(u,w,C),x=C.body&&D(C.body.getReader)?C.body.getReader():null;try{if(!x){const F=await C.text();(B||t(F,u))==="ndjson"?yield*i(null,null,F,0,C,u,G,Z):yield*p(F,u,v,A);return}const V=new TextDecoder("utf-8");if(B==="json"){yield*p(await n(x,V,""),u,v,A);return}if(B==="ndjson"){yield*i(x,V,"",0,C,u,G,Z);return}const Y=await o(x,V,u);Y.format==="json"?yield*p(await n(x,V,Y.seed),u,v,A):yield*i(x,V,Y.seed,Y.bytes,C,u,G,Z)}finally{if(x&&D(x.cancel))try{await x.cancel()}catch{}}}const O={mode:"stream",open:T,autoStart:a.autoStart!==!1};return M!==void 0&&(O.poll=M),Number.isFinite(a.maxRows)&&(O.maxRows=a.maxRows),Number.isFinite(a.maxAge)&&(O.maxAge=a.maxAge),(typeof a.ageBy=="string"||D(a.ageBy))&&(O.ageBy=a.ageBy),Number.isFinite(a.coalesceMs)&&(O.coalesceMs=a.coalesceMs),Number.isFinite(a.promoteToMemoryBelow)&&(O.promoteToMemoryBelow=a.promoteToMemoryBelow),O}function l(u,b,a){if(b)return b;const h=g(u);if(h)return h;const w=a&&a.headers&&D(a.headers.get)?a.headers.get("content-type"):null;return s(w)}function g(u){const b=String(u).split(/[?#]/)[0].toLowerCase();if(b.endsWith(".ndjson")||b.endsWith(".jsonl"))return"ndjson";if(b.endsWith(".json"))return"json"}function s(u){if(!u)return;const b=u.split(";")[0].trim().toLowerCase();if(j.has(b))return"ndjson";if(b==="application/json"||b==="text/json"||b.endsWith("+json"))return"json"}function t(u,b){const a=u.replace(/^\s+/,""),h=c(a);if(h==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${b} — pass opts.format: 'json' | 'ndjson'.`);return h}async function o(u,b,a){let h="",w=0;for(;;){const{value:A,done:H}=await u.read();if(A&&(w+=A.byteLength,h+=b.decode(A,{stream:!0})),H){h+=b.decode();break}const G=h.replace(/^\s+/,"");if(G){if(G[0]==="[")return{format:"json",seed:h,bytes:w};if(G[0]!=="{"||h.indexOf(`
|
|
8
8
|
`)!==-1)break}}const v=c(h.replace(/^\s+/,""));if(v==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${a} — pass opts.format: 'json' | 'ndjson'.`);return{format:v,seed:h,bytes:w}}function c(u){if(!u||u[0]==="[")return"json";if(u[0]!=="{")return"error";const b=u.indexOf(`
|
|
9
9
|
`);if(b===-1)return"json";let a=u.slice(0,b);return a.endsWith("\r")&&(a=a.slice(0,-1)),d(a)?"ndjson":"json"}function d(u){try{return JSON.parse(u),!0}catch{return!1}}async function n(u,b,a){let h=a;for(;;){const{value:w,done:v}=await u.read();if(w&&(h+=b.decode(w,{stream:!0})),v)break}return h+=b.decode(),h}function*p(u,b,a,h){let w;try{w=JSON.parse(u)}catch(A){throw new Error(`[lattice] createUrlSource: ${b} is not valid JSON — ${A.message}`)}let v=a!==void 0?z(w,a):w;if(h&&(v=h(v)),!Array.isArray(v)){const A=a!==void 0||h?"":"; pass opts.rowsPath or opts.map to select the array";throw new Error(`[lattice] createUrlSource: ${b} did not resolve to an array${A}.`)}yield{rows:v,progress:{loaded:v.length,estimated:v.length}}}async function*i(u,b,a,h,w,v,A,H){const G=m(w);let Z=a||"",M=h||0,S=0,T=0,O=[];function*N(){let C;for(;(C=Z.indexOf(`
|
|
10
10
|
`))!==-1;){const B=Z.slice(0,C);Z=Z.slice(C+1),T++;const x=r(B,T,v,H);x!==k&&(O.push(x),O.length>=A&&(S+=O.length,yield f(O,S,G,M),O=[]))}}if(u){for(;;){const{value:C,done:B}=await u.read();if(C&&(M+=C.byteLength,Z+=b.decode(C,{stream:!0}),yield*N()),B)break}Z+=b.decode()}yield*N(),T++;const P=r(Z,T,v,H);P!==k&&O.push(P),O.length&&(S+=O.length,yield f(O,S,G,M))}function r(u,b,a,h){let w=u;if(w.endsWith("\r")&&(w=w.slice(0,-1)),!w.trim())return k;try{return JSON.parse(w)}catch(v){if(h)return E(`source.url.badline.${a}`,`skipping a malformed NDJSON line (line ${b}) from ${a} — ${v.message}`),k;throw new Error(`[lattice] createUrlSource: malformed NDJSON at line ${b} of ${a} — ${v.message}`)}}function f(u,b,a,h){const w=a&&h>0&&b>0?Math.max(b,Math.round(a/(h/b))):void 0;return{rows:u,progress:{loaded:b,estimated:w}}}function m(u){const b=u&&u.headers&&D(u.headers.get)?u.headers.get("content-length"):null,a=b!=null?Number(b):NaN;return Number.isFinite(a)&&a>0?a:void 0}}),ze("packages/core/src/source/derive.js",function(e,_){"use strict";Object.defineProperty(e,"FOLLOW_MODES",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"BUCKETS",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"DERIVED_ROW_KEY",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"DERIVED_SOURCE_KEY",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"UNION_KEY_SEP",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"readPath",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"unnest",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"reduceValues",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"applyLimit",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"applyCumulative",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"groupRows",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"finishGroups",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"derive",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"normalizeUnionSource",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"namespaceUnionKeys",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"joinRows",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"preGroup",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"buildJoinIndex",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"joinOne",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"joinKeyOf",{enumerable:!0,get:function(){return w}});const ne=_("packages/core/src/internal/predicates.js"),E=ne.isFunction,K=ne.isObject,D=_("packages/core/src/compute/total.js").TOTAL_FNS,J=Object.freeze(["filtered","all","selected","grouped"]),z=Object.freeze(["day","week","month","quarter","year"]),L="__key",X="__source",I="";function j(v,A){if(!K(v)||typeof A!="string")return;if(!A.includes("."))return v[A];let H=v;for(const G of A.split(".")){if(!K(H))return;H=H[G]}return H}function k(v,A){const H=[];for(const G of v){const Z=j(G,A);if(!(!Array.isArray(Z)||!Z.length))for(const M of Z)H.push({...G,[A]:M})}return H}function y(v,A){const H=v instanceof Date?v:new Date(v),G=H.getTime();if(!Number.isFinite(G))return null;const Z=H.getUTCFullYear(),M=H.getUTCMonth(),S=H.getUTCDate(),T=O=>O.toISOString().slice(0,10);switch(A){case"year":return T(new Date(Date.UTC(Z,0,1)));case"quarter":return T(new Date(Date.UTC(Z,Math.floor(M/3)*3,1)));case"month":return T(new Date(Date.UTC(Z,M,1)));case"week":{const O=(H.getUTCDay()+6)%7;return T(new Date(Date.UTC(Z,M,S-O)))}default:return T(new Date(Date.UTC(Z,M,S)))}}function l(v,A,H){const G=A.map(Z=>H&&H.of===Z?y(j(v,Z),H.by):j(v,Z));return{key:G.map(Z=>Z==null?"\0":String(Z)).join(""),values:G}}function g(v,A){const H=D[A];return H?H({get:G=>v[G]},o(v.length)):null}function s(v,A){return!A||typeof A.of!="string"||A.of===""||v&&v.includes(A.of)?v:[A.of,...v||[]]}function t(v,A){const H={},G=o(v.length);for(const[Z,M]of Object.entries(A)){const S=M.fn||"count",T=D[S];if(!T){H[Z]=null;continue}const O=M.of?v.map(N=>j(N,M.of)):[];H[Z]=T({get:N=>O[N]},G)}return H}const o=(()=>{const v=new Map;return A=>{let H=v.get(A);if(!H){H=new Uint32Array(A);for(let G=0;G<A;G++)H[G]=G;v.size<512&&v.set(A,H)}return H}})();function c(v,A,H){if(!Number.isFinite(A)||A<=0)return v;if(!H)return v.slice(0,A);const G=new Map,Z=[];for(const M of v){const S=String(j(M,H)),T=G.get(S)||0;T>=A||(G.set(S,T+1),Z.push(M))}return Z}function d(v,A){const H=v.reduce((S,T)=>S+(Number(j(T,A.of))||0),0);if(!H)return v;const G=H*A.upTo;let Z=0;const M=[];for(const S of v)if(M.push(S),Z+=Number(j(S,A.of))||0,Z>=G)break;return M}function n(v,A){return!Array.isArray(A)||!A.length?v:[...v].sort((H,G)=>{for(const Z of A){const M=j(H,Z.col),S=j(G,Z.col);if(M===S)continue;return M==null?1:S==null?-1:((typeof M=="number"&&typeof S=="number"?M<S:String(M)<String(S))?-1:1)*(Z.dir==="desc"?-1:1)}return 0})}function p(v,A,H){const G=A.groupBy?Array.isArray(A.groupBy)?A.groupBy:[A.groupBy]:null,Z=K(A.bucket)?A.bucket:null,M=s(G,Z),S=new Map,T=new Map;if(!M)return{groups:S,rowGroup:T};for(const O of v){const{key:N,values:P}=l(O,M,Z);let C=S.get(N);C||(C={values:P,rows:new Map},S.set(N,C));const B=H(O);C.rows.set(B,O),T.set(B,N)}return{groups:S,rowGroup:T}}function i(v,A,H=null,G=null){const Z=A.groupBy?Array.isArray(A.groupBy)?A.groupBy:[A.groupBy]:null,M=K(A.bucket)?A.bucket:null,S=s(Z,M);let T=[...v.entries()].map(([O,N])=>{if(H&&G&&!G.has(O)){const C=H.get(O);if(C)return C}const P={[L]:O};return S.forEach((C,B)=>{P[C.includes(".")?C.split(".").pop():C]=N.values[B]}),Object.assign(P,t([...N.rows.values()],A.select||{})),H&&H.set(O,P),P});return T=n(T,A.sort),K(A.cumulative)&&(T=d(T,A.cumulative)),c(T,A.limit,A.limitPer||null)}function r(v,A){const H=b(v,A),G=A.groupBy?Array.isArray(A.groupBy)?A.groupBy:[A.groupBy]:null,Z=K(A.bucket)?A.bucket:null,M=s(G,Z);let S;if(!M)S=H.map((T,O)=>({...T,[L]:String(j(T,A.rowKey||"id")??O)}));else{const T=new Map;for(const O of H){const{key:N,values:P}=l(O,M,Z);let C=T.get(N);C||(C={values:P,rows:[]},T.set(N,C)),C.rows.push(O)}S=[...T.entries()].map(([O,N])=>{const P={[L]:O};return M.forEach((C,B)=>{P[C.includes(".")?C.split(".").pop():C]=N.values[B]}),Object.assign(P,t(N.rows,A.select||{})),P})}return S=n(S,A.sort),K(A.cumulative)&&(S=d(S,A.cumulative)),c(S,A.limit,A.limitPer||null)}function f(v,A){const G=K(v)&&K(v.grid)?v:{grid:v};return{grid:K(G.grid)?G.grid:null,label:G.label!=null&&G.label!==""?String(G.label):String(A),follow:typeof G.follow=="string"?G.follow:void 0,map:E(G.map)?G.map:null}}function m(v){for(const A of v){const H=A[X];H!==void 0&&(A[L]=`${H}${I}${A[L]}`)}return v}function u(v,A){const H=A.on,G=K(H)?String(H.left||H.right||""):String(H||""),Z=K(H)?String(H.right||H.left||""):String(H||"");if(!G||!Z)return v;const M=A.index instanceof Map?A.index:a(Array.isArray(A.rows)?A.rows:[],Z),S=Array.isArray(A.select)?A.select.map(String):null,T=A.prefix?String(A.prefix):"",O=String(A.type||"inner")==="left",N=[];for(const P of v){const C=j(P,G),B=C==null?void 0:M.get(String(C));if(!B){O&&N.push(P);continue}const x={...P},V=S||Object.keys(B);for(const Y of V)!T&&Y===G||(x[T?T+Y:Y]=j(B,Y));N.push(x)}return N}function b(v,A){let H=Array.isArray(v)?v:[];return A.unnest&&(H=k(H,A.unnest)),K(A.join)&&(Array.isArray(A.join.rows)||A.join.index instanceof Map)&&(H=u(H,A.join)),E(A.where)&&(H=H.filter(G=>!!A.where(G))),H}function a(v,A){const H=new Map;for(const G of v){const Z=j(G,A);if(Z==null)continue;const M=String(Z);H.has(M)||H.set(M,G)}return H}function h(v,A){const H=A.on,G=K(H)?String(H.left||H.right||""):String(H||""),Z=K(H)?String(H.right||H.left||""):String(H||"");if(!G||!Z)return v;const M=A.index instanceof Map?A.index:new Map,S=j(v,G),T=S==null?void 0:M.get(String(S));if(!T)return String(A.type||"inner")==="left"?v:null;const O=Array.isArray(A.select)?A.select.map(String):null,N=A.prefix?String(A.prefix):"",P={...v};for(const C of O||Object.keys(T))!N&&C===G||(P[N?N+C:C]=j(T,C));return P}function w(v,A){const H=j(v,A);return H==null?null:String(H)}}),ze("packages/core/src/source/derived.js",function(e,_){"use strict";Object.defineProperty(e,"IDLE_REFRESH_MS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"PROFILE_FIELDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ALERT_THRESHOLDS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"STATISTICS_FNS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SERIES_METRICS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"PRODUCER_IGNORED_KEYS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"profileAlerts",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"DerivedSource",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"createDerivedSource",{enumerable:!0,get:function(){return Z}});const ne=_("packages/core/src/internal/predicates.js"),E=ne.isFunction,K=ne.isObject,D=_("packages/core/src/internal/warn.js").warnOnce,z=_("packages/core/src/source/memory.js").MemorySource,X=_("packages/core/src/source/settle.js").isPipelineSettle,I=_("packages/core/src/source/derive.js"),j=I.derive,k=I.preGroup,y=I.groupRows,l=I.finishGroups,g=I.readPath,s=I.buildJoinIndex,t=I.joinOne,o=I.joinKeyOf,c=I.FOLLOW_MODES,d=I.DERIVED_ROW_KEY,n=I.DERIVED_SOURCE_KEY,p=I.normalizeUnionSource,i=I.namespaceUnionKeys,r=16,f=Object.freeze(["column","rows","present","missing","numeric","distinct","min","max","mean","median","q1","q3","iqr","stddev","outliers","alerts","alertCount"]),m=Object.freeze({missing:.2,cardinality:.9,skew:1,outliers:.05}),u=Object.freeze(["correlation","series","datasetVsDataset"]),b=Object.freeze(["n","first","last","change","changePercent","volatility","annualisedVolatility","growth","maxDrawdown","maxDrawdownFrom","maxDrawdownTo","autocorrelation","upDays","downDays"]),a=Object.freeze(["unnest","join","where","bucket","groupBy","select","sort","limit","limitPer","cumulative"]);function h(M,S={}){const T={...m,...K(S)?S:{}},O=ee=>typeof ee=="number"&&Number.isFinite(ee)?ee:null,N=O(M.rows)??0,P=O(M.numeric)??0,C=O(M.missing)??0,B=O(M.distinct),x=O(M.mean),V=O(M.median),Y=O(M.stddev),F=O(Array.isArray(M.outliers)?M.outliers.length:M.outliers),$=P>0,q=[];return B===0?["empty"]:(B===1&&q.push("constant"),N>0&&C/N>=T.missing&&q.push("high-missing"),!$&&B!==null&&N>1&&B===N&&C===0?q.push("unique"):B!==null&&N>0&&B/N>=T.cardinality&&q.push("high-cardinality"),$&&x!==null&&V!==null&&Y!==null&&Y>0&&Math.abs(3*(x-V)/Y)>=T.skew&&q.push("skewed"),$&&F!==null&&F/P>=T.outliers&&q.push("outliers"),q)}class w extends z{#e=null;#t={};#n=[];#r=null;#s=!1;#i={};#o=!1;#l=null;#a=null;#c=!1;#u=null;#d=!1;#f=null;constructor(S,T){super({mode:"memory",rows:[]},T),this.#i=T||{},this.#t=K(S)?S:{};const O=this.#t.from;if(Array.isArray(O)){if(this.#e=null,this.#f=this.#g(O),!this.#f.length){D("source.derived.from",'source.mode "derived" needs `from`: at least one grid to derive from.');return}this.#t.follow!==void 0&&D("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&&D("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&&(D("source.derived.union.statistics",'source.mode "derived": `statistics` is not supported when `from` is a union of several grids (BACKLOG-0001046) — a relational statistic reduces one grid\'s own columns, and a union has no single set of them. Derive the statistics of a single grid instead.'),this.#d=!0),this.#m(),this.#b(),this.refresh();return}if(this.#e=O||null,!this.#e){D("source.derived.from",'source.mode "derived" needs `from`: the grid to derive from.');return}this.#t.follow&&!c.includes(String(this.#t.follow))&&D(`source.derived.follow.${this.#t.follow}`,`unknown follow "${this.#t.follow}"; using "filtered". Known: ${c.join(", ")}.`),this.#h()||(this.#d=!0),this.#m(),this.#b(),this.refresh()}#h(){const S=this.#t.statistics;if(S===void 0)return!0;if(this.#t.profile!==void 0)return D("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(!K(S))return D("source.derived.statistics.shape",`source.mode "derived": \`statistics\` needs an object naming the statistic, e.g. \`{ fn: 'correlation', columns: ['a', 'b'] }\`. Known fn: ${u.join(", ")}.`),!1;const T=String(S.fn||"");return u.includes(T)?this.#p(T,S):(D(`source.derived.statistics.fn.${T}`,`source.mode "derived": unknown \`statistics.fn\` "${T}". Known: ${u.join(", ")}. Every *single-column* statistic is reached through \`select\` instead, e.g. \`select: { p95: { of: 'amount', fn: 'p95' } }\`.`),!1)}#p(S,T){if(S==="correlation"){if((Array.isArray(T.columns)?T.columns.filter(Boolean):[]).length<2)return D("source.derived.statistics.columns","source.mode \"derived\": `statistics: { fn: 'correlation' }` needs `columns`: at least two column ids to correlate pairwise."),!1;const N=T.orient===void 0?"pairs":String(T.orient);return N!=="pairs"&&N!=="matrix"&&D(`source.derived.statistics.orient.${N}`,`source.mode "derived": unknown \`statistics.orient\` "${N}" for \`fn: 'correlation'\`; using "pairs". Known: pairs, matrix.`),!0}return S==="series"?!T.of||!T.by?(D("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:K(T.with)?!0:(D("source.derived.statistics.with","source.mode \"derived\": `statistics: { fn: 'datasetVsDataset' }` needs `with`: the second grid to compare this one against."),!1)}#m(){const S=this.#t.statistics!==void 0?"statistics":this.#t.profile!==void 0?"profile":null;if(!S)return;const T=a.filter(O=>this.#t[O]!==void 0);T.length&&D(`source.derived.producer.ignored.${S}`,`source.mode "derived": \`${S}\` is a terminal producer and replaces the pipeline, so ${T.map(O=>`\`${O}\``).join(", ")} ${T.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(S){const T=this.#i&&this.#i.grid,O=new Set,N=[];return S.forEach((P,C)=>{const B=p(P,C);if(O.has(B.label)&&D(`source.derived.union.label.${B.label}`,`source.mode "derived": two union sources share the label "${B.label}"; give each a distinct \`label\` or __source/__key will not distinguish them.`),O.add(B.label),!B.grid){D(`source.derived.union.missing.${B.label}`,`source.mode "derived": union source "${B.label}" has no grid and was skipped.`),N.push(B);return}if(T&&E(B.grid.on)){const x=A(T,B.grid,[B.label]);if(x){D(`source.derived.union.cycle.${B.label}`,`source.mode "derived": union source "${B.label}" was refused — it derives from the grid being derived, directly or through a chain (${x.join(" → ")}). Remove it from \`from\`.`),N.push({...B,grid:null});return}}N.push(B)}),N}#b(){if(this.#f){this.#S(),this.#w();return}const S=this.#e;if(!S||!E(S.on))return;const T=String(this.#t.follow||"filtered"),O=["rows:changed"];(T==="filtered"||T==="grouped")&&O.push("filter:changed","model:changed"),T==="selected"&&O.push("selection:changed"),T==="grouped"&&O.push("column:grouped");for(const N of O){const P=C=>{N==="rows:changed"&&v(C)||N==="model:changed"&&!X(C)||this.schedule(N==="rows:changed"?C:null)};S.on(N,P),this.#n.push(()=>E(S.off)&&S.off(N,P))}this.#w(),this.#y()}#y(){const S=this.#t.statistics,T=K(S)?S.with:null;if(!K(T)||!E(T.on))return;const O=T;for(const N of["rows:changed","filter:changed","model:changed"]){const P=C=>{N==="rows:changed"&&v(C)||N==="model:changed"&&!X(C)||this.schedule(null)};O.on(N,P),this.#n.push(()=>E(O.off)&&O.off(N,P))}}#S(){for(const S of this.#f){const T=S.grid;if(!T||!E(T.on))continue;const O=c.includes(String(S.follow))?String(S.follow):"filtered",N=["rows:changed"];(O==="filtered"||O==="grouped")&&N.push("filter:changed","model:changed"),O==="selected"&&N.push("selection:changed"),O==="grouped"&&N.push("column:grouped");for(const P of N){const C=B=>{P==="rows:changed"&&v(B)||P==="model:changed"&&!X(B)||this.schedule(null)};T.on(P,C),this.#n.push(()=>E(T.off)&&T.off(P,C))}}}#w(){const S=this.#t.join,T=S&&S.with;if(!T||!E(T.on))return;const N=String(S.follow||"all")==="all"?["rows:changed"]:["rows:changed","filter:changed","model:changed"];for(const P of N){const C=B=>{P==="rows:changed"&&v(B)||P==="model:changed"&&!X(B)||this.schedule({partner:!0})};T.on(P,C),this.#n.push(()=>E(T.off)&&T.off(P,C))}}#A(){const S=this.#t.join;if(!S||!S.with)return null;const T=S.on,O=K(T)?String(T.left||T.right||""):String(T||""),N=K(T)?String(T.right||T.left||""):String(T||"");return O&&N?{left:O,right:N}:null}#v(){const S=this.#A();if(!S)return this.#u=null,null;const T=this.#u;if(this.#u=s(this.#C(),S.right),!T)return null;const O=this.#t.join||{},N=Array.isArray(O.select)?O.select.map(String):null,P=x=>x?(N||Object.keys(x)).map(Y=>String(g(x,Y))).join(""):null,C=new Set,B=new Set;for(const[x,V]of this.#u)P(V)!==P(T.get(x))&&(C.add(x),T.has(x)||B.add(x));for(const x of T.keys())this.#u.has(x)||C.add(x);return{affected:C,gained:B}}#P(S,T){const O=this.#l;if(!O||!O.leftByJoinKey)return null;const N=[];for(const P of S){const C=O.leftByJoinKey.get(P);if(C)for(const B of C){const x=O.rowData.get(B);x!==void 0&&N.push({key:B,data:x})}}return this.#M({updated:N,added:[],removed:[]},T)}#O(S,T){if(!this.#l||!this.#l.leftByJoinKey||S.unnest||S.where||String(S.follow||"filtered")==="grouped")return!1;const O=S.join||{};return String(O.type||"inner")==="left"?!0:T.size===0}#C(){const S=this.#t.join,T=S&&S.with;if(!T||!T.rows)return[];const O=[],N=P=>{P.group||O.push(H(P))};return String(S.follow||"all")==="filtered"&&E(T.rows.forEach)?T.rows.forEach(N):E(T.rows.forEachAll)&&T.rows.forEachAll(N),O}schedule(S){const T=this.#t.refresh===void 0?"idle":this.#t.refresh;if(T==="manual")return;if(T==="live"){this.refresh(S);return}const O=typeof T=="number"&&Number.isFinite(T)?T:r;if(this.#r){this.#c=!0;return}this.#c=!1,this.#r=setTimeout(()=>{this.#r=null,this.refresh(this.#c?null:S)},O)}refresh(S){if(!(this.#s||!this.#e&&!this.#f)){if(this.#o){D("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 T=this.#d?[]:this.#f?this.#t.profile?this.#q():this.#x():this.#t.statistics!==void 0?this.#ye():this.#t.profile?this.#ie():this.#E(S);this.setRows(T),this.invalidate("filter"),E(this.#i.emit)&&this.#i.emit("rows:changed",{derived:!0},"derived")}finally{this.#o=!1}}}#E(S){const O=K(S)&&S.partner===!0?this.#v():null,N=this.#F();if(O&&this.#l){if(!O.affected.size)return l(this.#l.groups,N,this.#l.reduced,new Set);if(this.#O(N,O.gained)){const te=this.#P(O.affected,N);if(te)return l(this.#l.groups,N,this.#l.reduced,te)}}const P=this.#T(N,S);if(P&&this.#l){const te=this.#M(P,N);return l(this.#l.groups,N,this.#l.reduced,te)}const C=k(this.#_(),N);if(this.#a=this.#R(),!N.groupBy)return this.#l=null,j(C,N);const B=this.#N(),{groups:x,rowGroup:V}=y(C,N,B),Y=new Map;for(const[te,re]of V){const ie=x.get(re);ie&&Y.set(te,ie.rows.get(te))}const F=new Map,$=this.#A(),q=new Map,ee=new Map;if($)for(const[te,re]of Y){const ie=o(re,$.left);if(ie===null)continue;q.set(te,ie);let ue=ee.get(ie);ue||(ue=new Set,ee.set(ie,ue)),ue.add(te)}return this.#l={groups:x,rowGroup:V,rowData:Y,reduced:F,leftJoinKey:q,leftByJoinKey:ee},l(x,N,F,null)}#T(S,T){if(!this.#l||!S.groupBy||S.unnest||S.where||String(S.follow||"filtered")==="grouped"||K(S.join)&&S.join.with&&!(S.join.index instanceof Map)||!K(T))return null;const O=Array.isArray(T.updated)?T.updated:null,N=Array.isArray(T.added)?T.added:null,P=Array.isArray(T.removed)?T.removed:null;if(!O&&!N&&!P)return null;const C=this.#a;if(C&&C.size&&String(S.follow||"filtered")!=="all"){if(T.edit===!0&&Array.isArray(T.columns)){for(const B of T.columns)if(C.has(String(B)))return null}for(const B of O||[]){const x=B&&B.key,V=x===void 0?void 0:this.#l.rowData.get(String(x)),Y=H(B);for(const F of C)if(g(V,F)!==g(Y,F))return null}}return{updated:O||[],added:N||[],removed:P||[]}}#M(S,T){const O=this.#l,N=this.#N(),P=new Set,C=K(T.join)&&T.join.index instanceof Map?T.join:null,B=this.#A(),x=Y=>{const F=O.rowGroup.get(Y);if(F===void 0)return;P.add(F);const $=O.groups.get(F);if($&&($.rows.delete(Y),$.rows.size||O.groups.delete(F)),O.rowGroup.delete(Y),O.rowData.delete(Y),O.leftJoinKey){const q=O.leftJoinKey.get(Y);if(q!==void 0){const ee=O.leftByJoinKey.get(q);ee&&(ee.delete(Y),ee.size||O.leftByJoinKey.delete(q)),O.leftJoinKey.delete(Y)}}},V=Y=>{const F=C?t(Y,C):Y;if(!F)return;const $=N(F),q=y([F],T,N);for(const[ee,te]of q.groups){let re=O.groups.get(ee);re||(re={values:te.values,rows:new Map},O.groups.set(ee,re)),re.rows.set($,F),O.rowGroup.set($,ee),P.add(ee)}if(O.rowData.set($,F),B&&O.leftByJoinKey){const ee=o(F,B.left);if(ee!==null){O.leftJoinKey.set($,ee);let te=O.leftByJoinKey.get(ee);te||(te=new Set,O.leftByJoinKey.set(ee,te)),te.add($)}}};for(const Y of S.removed)x(String(Y));for(const Y of S.updated)x(String(Y.key)),V(H(Y));for(const Y of S.added)V(H(Y));return P}#N(){const S=this.#e,T=S&&S.config&&S.config.rowKey||"id";return O=>String(g(O,typeof T=="string"?T:"id")??"")}#R(){const S=this.#e,T=S&&S.state&&E(S.state.get)?S.state.get():null,O=new Set,N=P=>{if(P){if(Array.isArray(P.conditions)){P.conditions.forEach(N);return}P.col&&O.add(String(P.col))}};return T&&N(T.filters),O}#F(){let S=this.#t;if(S.join&&S.join.with&&(this.#u||this.#v(),S={...S,join:{...S.join,index:this.#u}}),this.#f||String(S.follow||"filtered")!=="grouped")return S;const T=this.#e,O=T&&T.state&&E(T.state.get)?T.state.get():null,N=O&&Array.isArray(O.group)?O.group:[];return N.length?{...S,groupBy:[...N]}:S}#W(){const S=[];for(const T of this.#f)if(T.grid)try{const O=c.includes(String(T.follow))?String(T.follow):"filtered",N=this.#V(T.grid,O);for(const P of N){const C=T.map?T.map(P):P;K(C)&&S.push({...C,[n]:T.label})}}catch(O){D(`source.derived.union.failed.${T.label}`,`source.mode "derived": union source "${T.label}" failed to read (${O&&O.message?O.message:O}) and was skipped this pass.`)}return S}#V(S,T){if(!S||!S.rows)return[];if(T==="all"){const N=[];return E(S.rows.forEachAll)&&S.rows.forEachAll(P=>{P.group||N.push(H(P))}),N}if(T==="selected")return(S.selection&&E(S.selection.rows)?S.selection.rows():[]).filter(Boolean).map(H);const O=[];return E(S.rows.forEach)&&S.rows.forEach(N=>{N.group||O.push(H(N))}),O}#x(){const S=this.#F(),T=this.#W(),O=j(T,S);return S.groupBy?O:i(O)}#q(){return D("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.'),[]}#_(){const S=this.#e,T=String(this.#t.follow||"filtered");if(!S||!S.rows)return[];if(T==="all"){const P=[];return E(S.rows.forEachAll)&&S.rows.forEachAll(C=>{C.group||P.push(H(C))}),P}if(T==="selected")return(S.selection&&E(S.selection.rows)?S.selection.rows():[]).filter(Boolean).map(H);const O=this.#Y(),N=[];return O&&this.#G().length&&E(S.rows.forEachExcept)?(S.rows.forEachExcept(O,P=>{P.group||N.push(H(P))}),N):(E(S.rows.forEach)&&S.rows.forEach(P=>{P.group||N.push(H(P))}),N)}#Y(){const S=this.#t.crossFilter;if(!S||this.#f)return null;if(typeof S=="string")return S;if(S.col)return String(S.col);const T=this.#t.groupBy,O=Array.isArray(T)?T[0]:T;return O?String(O):null}#G(){const S=this.#Y(),T=this.#e;if(!S||!T||!T.filters||!E(T.filters.get))return[];const O=G(T.filters.get(),S);return O?O.op==="in"&&Array.isArray(O.value)?O.value.map(String):O.op==="eq"&&O.value!==void 0?[String(O.value)]:[]:[]}#I(S){const T=this.#Y(),O=this.#e;if(!T||!O||!O.filters||!E(O.filters.set))return;const N=this.#i.compute||{},P=E(O.filters.get)?O.filters.get():null,C=E(N.pruneColumn)?N.pruneColumn(P,T):null;if(!S.length){O.filters.set(C||null);return}const B=S.length===1?{col:T,op:"eq",value:S[0]}:{col:T,op:"in",value:S.slice()},x=C?C.conditions&&C.op?C.conditions:[C]:[];O.filters.set(x.length?{op:"and",conditions:[...x,B]}:B)}crossFilter(){const S=this;return{enabled(){return!!S.#Y()},column(){return S.#Y()},get(){return S.#G()},set(T){const O=T==null?[]:(Array.isArray(T)?T:[T]).map(N=>String(N));S.#I(O)},toggle(T){const O=String(T),N=S.#G(),C=N.indexOf(O)>=0?N.filter(B=>B!==O):[...N,O];S.#I(C)},clear(){S.#I([])}}}#U(S){const T=S&&S.rows;if(T&&E(T.matchCount)){const O=T.matchCount(),N=Number(O);if(O!==null&&Number.isFinite(N))return N}if(T&&E(T.count)){const O=Number(T.count());if(Number.isFinite(O))return O}return 0}#ye(){const S=this.#e,T=this.#t.statistics;if(!S||!S.statistics||!K(T))return[];switch(String(T.fn)){case"correlation":return this.#ce(S,T);case"series":return this.#ue(S,T);case"datasetVsDataset":return this.#Ne(S,T);default:return[]}}#ce(S,T){const O=T.columns.filter(Boolean).map(String),N=this.#U(S),P=(C,B)=>{const x=S.statistics.correlation(C,B);return typeof x=="number"&&Number.isFinite(x)?x:null};if(String(T.orient||"pairs")!=="matrix"){const C=[];for(let B=0;B<O.length;B++)for(let x=B+1;x<O.length;x++)C.push({[d]:`${O[B]}${O[x]}`,a:O[B],b:O[x],coefficient:P(O[B],O[x]),n:N});return C}return O.map(C=>{const B={[d]:C,column:C};for(const x of O)B[x]=C===x?1:P(C,x);return B.n=N,B})}#ue(S,T){const O=this.#U(S),N={by:String(T.by)};T.periodsPerYear!==void 0&&(N.periodsPerYear=Number(T.periodsPerYear));const P=S.statistics.series(String(T.of),N)||{};return b.map(C=>({[d]:C,metric:C,value:P[C]??null,n:O}))}#Ne(S,T){const O=T.with,N=Array.isArray(T.columns)?{columns:T.columns.map(String)}:void 0,P=S.statistics.datasetVsDataset(O,N);if(!K(P))return[];const B=(Array.isArray(P.ranked)?P.ranked:[]).map(Y=>({[d]:String(Y.column),column:Y.column,measure:Y.measure??null,magnitude:Y.magnitude??null,distance:Y.distance??null,direction:Y.direction??null,nA:Y.nA??null,nB:Y.nB??null,meanA:Y.meanA??null,meanB:Y.meanB??null,reliable:Y.reliable??null,unmatched:""})),x=P.unmatched,V=[["A",x&&x.onlyA],["B",x&&x.onlyB]];for(const[Y,F]of V)for(const $ of F||[])B.push({[d]:`${Y}${$}`,column:$,measure:null,magnitude:null,distance:null,direction:null,nA:null,nB:null,meanA:null,meanB:null,reliable:!1,unmatched:Y});return B}#ie(){const S=this.#e;if(!S||!S.statistics||!E(S.statistics.profile))return[];const O=(Array.isArray(this.#t.profile)?this.#t.profile:[this.#t.profile]).filter(Boolean).map(P=>{const C=S.statistics.profile(String(P))||{},B={[d]:String(P)};for(const V of f)B[V]=V==="column"?String(P):C[V]??null;B.outliers=Array.isArray(C.outliers)?C.outliers.length:C.outliers??null;const x=h({...C,rows:B.rows,outliers:B.outliers,numeric:C.numeric},this.#t.alerts);return B.alerts=x.join(", "),B.alertCount=x.length,B});if(this.#t.orient!=="metrics")return O;const N=O[0];return N?f.filter(P=>P!=="column").map(P=>({[d]:P,metric:P,value:N[P]})):[]}apply(S){const T=["add","update","remove"],O=[];for(const N of T)for(const P of S&&S[N]||[])O.push({operation:N,id:P&&P.id,reason:"derived-read-only"});return O.length&&D("source.derived.readonly","a derived grid is read-only: its rows are computed from another grid. Write to the source grid instead, and the derived one follows."),{added:[],updated:[],removed:[],rejected:O}}destroy(){this.#s=!0,this.#r&&(clearTimeout(this.#r),this.#r=null),this.#Y()&&this.#G().length&&this.#I([]);for(const S of this.#n)try{S()}catch{}this.#n=[],this.#e=null,this.#f=null,super.destroy()}}function v(M){return K(M)&&M.companion===!0}function A(M,S,T,O=new Set){if(S===M)return T;if(O.has(S))return null;O.add(S);let N=null;try{N=E(S.config)?S.config():null}catch{N=null}const P=N&&K(N.source)?N.source:null;if(!P||P.mode!=="derived")return null;const C=P.from;if(Array.isArray(C)){for(let B=0;B<C.length;B++){const x=p(C[B],B);if(!x.grid||!E(x.grid.on))continue;const V=A(M,x.grid,[...T,x.label],O);if(V)return V}return null}return K(C)&&E(C.on)?A(M,C,[...T,"(from)"],O):null}function H(M){return K(M)&&"data"in M?M.data:M}function G(M,S){if(!M||typeof M!="object")return null;if(Array.isArray(M.conditions)){for(const O of M.conditions){const N=G(O,S);if(N)return N}return null}return M.col===S?M:null}function Z(M,S){return new w(M,S)}}),ze("packages/core/src/source/adapters/odata.js",function(e,_){"use strict";Object.defineProperty(e,"conditionToOData",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"filtersToOData",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"odataAdapter",{enumerable:!0,get:function(){return f}});const E=_("packages/core/src/internal/warn.js").warnOnce,U=_("packages/core/src/source/filterwire.js").isGroup,D=Object.freeze(["eq","ne","gt","gte","lt","lte","contains","startsWith","endsWith","blank","notBlank","between","notBetween"]),J=/^\d{4}-\d{2}-\d{2}$/,z=/^\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/,L=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;function X(m){const u=m instanceof Date?m:typeof m=="number"&&Number.isFinite(m)?new Date(m):typeof m=="string"&&L.test(m)?new Date(m):null;return u&&!Number.isNaN(u.getTime())?u:null}const I=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function j(m,u){throw typeof u=="string"&&I.test(u)?new Error(`odataAdapter: "${u}" needs a zone designator to be used as a ${m} value — add "Z" for UTC or a "+HH:MM"/"-HH:MM" offset. A date-time with no zone is ambiguous (whose local time?) and would otherwise silently become the wrong instant rather than the one intended.`):new Error(`odataAdapter: "${String(u)}" is not a usable ${m} value`)}function k(m){const u=X(m);return u||j("DateTimeOffset",m),u.toISOString()}function y(m){if(typeof m=="string"&&J.test(m))return m;const u=X(m);return u||j("Date",m),u.toISOString().slice(0,10)}function l(m){if(typeof m=="string"&&z.test(m))return m.length===5?`${m}:00`:m;if(typeof m=="number"&&Number.isFinite(m)&&m>=0&&m<864e5){const u=Math.floor(m),b=a=>String(a).padStart(2,"0");return`${b(Math.floor(u/36e5))}:${b(Math.floor(u%36e5/6e4))}:${b(Math.floor(u%6e4/1e3))}`}throw new Error(`odataAdapter: "${String(m)}" is not a usable TimeOfDay value`)}const g=Object.freeze({timestamp:k,datetime:k,date:y,dateString:y,time:l}),s=200,t=1e3,o=Object.freeze({eq:"eq",ne:"ne",gt:"gt",gte:"ge",lt:"lt",lte:"le"});function c(m,u){if(m==null)return"null";const b=u&&g[String(u)];return b?b(m):typeof m=="number"||typeof m=="boolean"?String(m):m instanceof Date?m.toISOString():`'${String(m).replace(/'/g,"''")}'`}function d(m){const u=String(m),b=/^[A-Za-z_][A-Za-z0-9_]*$/;if(!u||!u.split("/").every(a=>b.test(a)))throw new Error(`odataAdapter: "${u}" is not a usable column name`);return u}const n=Object.freeze({lo:{incl:"ge",excl:"gt"},hi:{incl:"le",excl:"lt"}});function p(m){const u=d(m.col),b=String(m.op),a=m.type;if(o[b])return`${u} ${o[b]} ${c(m.value,a)}`;if(b==="contains")return`contains(${u},${c(m.value,a)})`;if(b==="startsWith")return`startswith(${u},${c(m.value,a)})`;if(b==="endsWith")return`endswith(${u},${c(m.value,a)})`;if(b==="blank")return`(${u} eq null)`;if(b==="notBlank")return`(${u} ne null)`;if(b==="between"||b==="notBetween"){const h=Array.isArray(m.value)?m.value:[m.value,m.value],w=String(m.bounds||"[]"),v=w.charAt(0)==="("?n.lo.excl:n.lo.incl,A=w.charAt(1)===")"?n.hi.excl:n.hi.incl,H=`(${u} ${v} ${c(h[0],a)} and ${u} ${A} ${c(h[1],a)})`;return b==="between"?H:`(${u} eq null or not ${H})`}return null}function i(m){const u=String(m&&m.op);throw E(`source.odata.filter.refuse.${u}`,`a "${u}" filter condition cannot be written as an OData $filter expression, so the request was refused rather than sent without it — silently dropping it would have matched more or fewer rows than the filter asked for. Route this condition through a source that can pushdown-split it as residual (source.filter capability), or drop it from the tree before building the URL.`),new Error(`odataAdapter: a "${u}" filter condition cannot be expressed in OData and was refused`)}function r(m){if(!m)return"";if(!U(m)){const a=p(m);return a===null?i(m):a}const u=String(m.op)==="or"?" or ":" and ",b=(m.conditions||[]).map(a=>{if(U(a))return r(a);const h=p(a);return h===null?i(a):h}).filter(Boolean);return b.length?b.length===1?b[0]:`(${b.join(u)})`:""}function f(m={}){const u=String(m.url||""),b=m.fetch||(typeof fetch=="function"?fetch:null),a=m.count!==!1,h=d(m.key||"id"),w=m.edit===!0;return{name:"odata",capabilities:{filter:"tree",operators:D,sort:"multi",quick:m.search===!0,range:!0,total:a,mutate:w?{update:!0,delete:!0,append:!0,returning:"row"}:!1},urlFor(v){const A=[],H=(Z,M)=>A.push(`${Z}=${encodeURIComponent(M)}`),G=r(v.filters);return G&&H("$filter",G),v.sort&&v.sort.length&&H("$orderby",v.sort.map(Z=>`${d(Z.col)}${Z.dir==="desc"?" desc":" asc"}`).join(",")),v.range&&(H("$skip",String(v.range.start)),H("$top",String(v.range.end-v.range.start))),v.quick&&H("$search",`"${String(v.quick).replace(/"/g,"")}"`),a&&H("$count","true"),A.length?`${u}?${A.join("&")}`:u},async execute(v,A){if(!b)throw new Error("odataAdapter needs a fetch implementation");const H={Accept:"application/json",...m.headers||{}},G=A&&A.signal,Z=async O=>{const N=await b(O,{headers:H,signal:G});if(!N.ok)throw new Error(`OData request failed: ${N.status}`);return N.json()};let M=await Z(this.urlFor(v)),S=M.value||M.rows||[];const T=M["@odata.count"]??M.count;if(!v.range){let O=M["@odata.nextLink"];for(;O&&S.length<s*t;)M=await Z(O),S=S.concat(M.value||M.rows||[]),O=M["@odata.nextLink"]}return T==null?(a&&E("source.odata.nocount",`${u} was asked for $count=true and answered without an @odata.count, so the grid has no total for this query and will scroll open-ended rather than present the page size as the whole. The endpoint does not support $count, or filters it out.`),{rows:S}):{rows:S,total:Number(T)}},urlForKey(v){return`${u}(${c(v)})`},async mutate(v,A){if(!b)throw new Error("odataAdapter needs a fetch implementation");if(!v||v.kind!=="update"&&v.kind!=="delete"&&v.kind!=="append")throw new Error(`odataAdapter: mutation kind "${v&&v.kind}" is not supported (update, delete and append are wired)`);const H={Accept:"application/json","Content-Type":"application/json",...m.headers||{}},G=A&&A.signal;if(v.kind==="delete"){const O=Array.isArray(v.keys)&&v.keys.length?v.keys[0]:v.key;if(O==null)throw new Error("odataAdapter: a delete needs a row key");const N=await b(this.urlForKey(O),{method:"DELETE",headers:H,signal:G});if(!N.ok)throw new Error(`OData delete failed: ${N.status}`);return{ok:!0}}if(v.kind==="append"){const O=Array.isArray(v.rows)?v.rows.filter(x=>x&&typeof x=="object"):[];if(O.length!==1)throw new Error("odataAdapter: an append needs exactly one row object (OData creates one entity per POST)");const N=await b(u,{method:"POST",headers:H,signal:G,body:JSON.stringify(O[0])});if(!N.ok)throw new Error(`OData add-row failed: ${N.status}`);const P=N.status===204?null:await N.json().catch(()=>null),C=P&&typeof P=="object"&&"value"in P?P.value:P;if(!C||typeof C!="object")throw new Error("odataAdapter: the POST returned no created entity to rekey the appended row by. Have the service return the created entity (Prefer: return=representation).");const B=C[h];if(B==null)throw new Error(`odataAdapter: the created entity carried no ${h} to rekey the appended row by.`);return{ok:!0,keys:[String(B)],rows:[C]}}const Z=this.urlForKey(v.key),M=await b(Z,{method:"PATCH",headers:H,signal:G,body:JSON.stringify(v.patch||{})});if(!M.ok)throw new Error(`OData update failed: ${M.status}`);if(M.status===204)return{ok:!0};const S=await M.json(),T=S&&typeof S=="object"&&"value"in S?S.value:S;return T==null?{ok:!0}:{ok:!0,rows:[T]}}}}}),ze("packages/core/src/source/adapters/rest.js",function(e,_){"use strict";Object.defineProperty(e,"DEFAULT_PARAMS",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"DEFAULT_VERBS",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"restAdapter",{enumerable:!0,get:function(){return K}});const ne=Object.freeze({offset:"offset",limit:"limit",sort:"sort",order:"order",filter:"filter",search:"q"}),E=Object.freeze({update:"PATCH",delete:"DELETE",append:"POST"});function K(U={}){const D=String(U.url||""),J=U.fetch||(typeof fetch=="function"?fetch:null),z={...ne,...U.params||{}},L=U.encodeFilter||(t=>JSON.stringify(t)),X=U.rows||(t=>Array.isArray(t)?t:t.rows||t.data||[]),I=U.total||((t,o)=>Array.isArray(t)?o.length:t.total??t.count??o.length),j=U.edit===!0,k=U.returning==="row"?"row":U.returning==="key"?"key":"none",y=U.keyField||"id",l=U.writeUrlFor||(t=>`${D}/${encodeURIComponent(String(t.key??(t.keys&&t.keys[0])))}`),g=U.encodeMutation||(t=>{const o=E[t.kind];if(t.kind==="update")return{method:o,url:l(t),headers:{"Content-Type":"application/json"},body:JSON.stringify(t.patch||{})};if(t.kind==="append"){const c=Array.isArray(t.rows)?t.rows:t.rows?[t.rows]:[];return{method:o,url:D,headers:{"Content-Type":"application/json"},body:JSON.stringify(c.length===1?c[0]:c)}}return{method:o,url:l(t)}}),s=U.writeRow||(t=>{if(t===null||typeof t!="object")return null;if(Array.isArray(t))return t.length?t[0]:null;const o=t;return o.row??o.data??t});return{name:"rest",capabilities:{range:!0,total:!0,sort:"multi",filter:!1,quick:!1,mutate:j?{update:!0,delete:!0,append:!0,returning:k}:!1,...U.capabilities||{},...U.operators?{filter:"tree",operators:U.operators}:{}},urlFor(t){const o=new URLSearchParams;t.range&&(o.set(z.offset,String(t.range.start)),o.set(z.limit,String(t.range.end-t.range.start))),t.sort&&t.sort.length&&(o.set(z.sort,t.sort.map(d=>d.col).join(",")),o.set(z.order,t.sort.map(d=>d.dir||"asc").join(","))),t.filters&&o.set(z.filter,L(t.filters)),t.quick&&o.set(z.search,String(t.quick));const c=o.toString();return c?`${D}?${c}`:D},async execute(t,o){if(!J)throw new Error("restAdapter needs a fetch implementation");const c=await J(this.urlFor(t),{headers:{Accept:"application/json",...U.headers||{}},signal:o&&o.signal});if(!c.ok)throw new Error(`request failed: ${c.status}`);const d=await c.json(),n=X(d);return{rows:n,total:I(d,n)}},writeUrlFor(t){return l(t)},encodeMutation(t){return g(t)},async mutate(t,o){if(!J)throw new Error("restAdapter needs a fetch implementation");if(!t||t.kind!=="update"&&t.kind!=="delete"&&t.kind!=="append")throw new Error(`restAdapter: mutation kind "${t&&t.kind}" is not supported (update, delete and append are wired)`);const c=g(t);if(!c||!c.url||!c.method)throw new Error("restAdapter: encodeMutation must return { method, url }");const d={Accept:"application/json",...U.headers||{},...c.headers||{}},n=await J(c.url,{method:c.method,headers:d,signal:o&&o.signal,...c.body!==void 0?{body:c.body}:{}});if(!n.ok)throw new Error(`REST ${t.kind} failed: ${n.status}`);if(t.kind==="append"){if(k==="none")return{ok:!0};if(n.status===204)throw new Error("restAdapter: the add-row POST returned 204 with no body, so the appended row has no server key to rekey by. Declare returning: 'row'/'key' and have the endpoint return the created row.");const r=await n.json(),f=s(r),m=f&&typeof f=="object"?f[y]:void 0;if(m==null)throw new Error(`restAdapter: the add-row response carried no ${y} to rekey the appended row by. Point \`keyField\` at the primary key the endpoint returns, or override \`writeRow\`.`);return k==="row"?{ok:!0,keys:[String(m)],rows:[f]}:{ok:!0,keys:[String(m)]}}if(k!=="row"||n.status===204)return{ok:!0};const p=await n.json(),i=s(p);return i==null?{ok:!0}:{ok:!0,rows:[i]}}}}}),ze("packages/core/src/source/adapters/dfql.js",function(e,_){"use strict";Object.defineProperty(e,"DFQL_BASE",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"DFQL_WRITE_URL",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"dfqlAdapter",{enumerable:!0,get:function(){return j}});const E=_("packages/core/src/internal/predicates.js").isFunction,U=_("packages/core/src/internal/warn.js").warnOnce,D="https://rest.demandflow.com",J="https://stream.demandflow.com/dfql",z=Object.freeze(["id","created","updated","ownerId","entity"]);function L(k){const y={},l=[];for(const[g,s]of Object.entries(k||{})){if(z.includes(g)){l.push(g);continue}y[g]=s}return l.length&&U("source.dfql.protected",`a DFQL update tried to write protected field(s) ${l.join(", ")}; they are server-assigned and immutable, so they were dropped from the PATCH.`),y}function X(k){if(!k||typeof k!="object"||Array.isArray(k))return["fields (must be an object)"];const y=k,l=[];return(typeof y.entity!="string"||!y.entity)&&l.push("entity (uppercase code)"),Number.isFinite(Number(y.level))||l.push("level (numeric)"),(typeof y.comboKey!="string"||!y.comboKey.endsWith("|ENT:"))&&l.push("comboKey (a string ending '|ENT:')"),l}async function I(k){const y=[],l=o=>{const c=o.trim();if(c)try{y.push(JSON.parse(c))}catch{}};if(!k.body||typeof k.body.getReader!="function")return(await k.text()).split(`
|