@toclocoinc/lattice-grid 1.117.2 → 1.117.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 +17 -17
- package/modules/form.esm.min.js.map +2 -2
- package/modules/form.min.cjs +17 -17
- package/modules/form.min.js +17 -17
- package/modules/form.min.js.map +2 -2
- package/modules/gantt.d.ts +1 -1
- package/modules/gantt.esm.min.js +1 -1
- package/modules/gantt.min.cjs +1 -1
- package/modules/gantt.min.js +1 -1
- package/modules/geo-europe-nuts.d.ts +1 -1
- package/modules/geo-europe-nuts.esm.min.js +1 -1
- package/modules/geo-europe-nuts.min.cjs +1 -1
- package/modules/geo-europe-nuts.min.js +1 -1
- package/modules/geo-uk.d.ts +1 -1
- package/modules/geo-uk.esm.min.js +1 -1
- package/modules/geo-uk.min.cjs +1 -1
- package/modules/geo-uk.min.js +1 -1
- package/modules/geo-us-states.d.ts +1 -1
- package/modules/geo-us-states.esm.min.js +1 -1
- package/modules/geo-us-states.min.cjs +1 -1
- package/modules/geo-us-states.min.js +1 -1
- package/modules/geo-world-110m.d.ts +1 -1
- package/modules/geo-world-110m.esm.min.js +1 -1
- package/modules/geo-world-110m.min.cjs +1 -1
- package/modules/geo-world-110m.min.js +1 -1
- package/modules/geo-world-50m.d.ts +1 -1
- package/modules/geo-world-50m.esm.min.js +1 -1
- package/modules/geo-world-50m.min.cjs +1 -1
- package/modules/geo-world-50m.min.js +1 -1
- package/modules/geometry.d.ts +1 -1
- package/modules/geometry.esm.min.js +1 -1
- package/modules/geometry.min.cjs +1 -1
- package/modules/geometry.min.js +1 -1
- package/modules/htmx.d.ts +1 -1
- package/modules/htmx.esm.min.js +2 -2
- package/modules/htmx.min.cjs +2 -2
- package/modules/htmx.min.js +2 -2
- package/modules/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 +1 -1
- package/modules/mapview.min.cjs +1 -1
- package/modules/mapview.min.js +1 -1
- package/modules/mock-socket.d.ts +1 -1
- package/modules/mock-socket.esm.min.js +1 -1
- package/modules/mock-socket.min.cjs +1 -1
- package/modules/mock-socket.min.js +1 -1
- package/modules/presets.d.ts +1 -1
- package/modules/presets.esm.min.js +1 -1
- package/modules/presets.min.cjs +1 -1
- package/modules/presets.min.js +1 -1
- package/modules/react.d.ts +1 -1
- package/modules/react.esm.min.js +1 -1
- package/modules/react.min.cjs +1 -1
- package/modules/react.min.js +1 -1
- package/modules/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/lattice-grid.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.117.
|
|
2
|
+
* Lattice Grid 1.117.3, core + DOM renderer
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
6
6
|
(function(xr){"use strict";var gi=!0,ar=Object.create(null),lr=Object.create(null);function _e(e,F){ar[e]=F}function Kn(e){var F=lr[e];if(F)return F;var ie=Object.create(null);lr[e]=ie;var E=ar[e];if(!E)throw new Error("[lattice] missing module: "+e);return E(ie,Kn),ie}_e("packages/core/src/internal/predicates.js",function(e,F){"use strict";Object.defineProperty(e,"isObject",{enumerable:!0,get:function(){return ie}}),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 I}}),Object.defineProperty(e,"isCtor",{enumerable:!0,get:function(){return L}});function ie(Q){return Q!==null&&typeof Q=="object"&&!Array.isArray(Q)}function E(Q){return typeof Q=="function"}function K(Q){return Q==null}function I(Q){return Q==null||Q===""}function L(Q){return typeof Q!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(Q))?!0:!!(Q.prototype&&Object.getOwnPropertyNames(Q.prototype).length>1)}}),_e("packages/core/src/internal/warn.js",function(e,F){"use strict";Object.defineProperty(e,"reportedWarnings",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"warnOnce",{enumerable:!0,get:function(){return R}}),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 b}}),Object.defineProperty(e,"invariant",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"DEV",{enumerable:!0,get:function(){return g}});const ie=new Set,E=2e3;function K(o){if(ie.add(o),ie.size>E){const t=ie.values().next().value;t!==void 0&&ie.delete(t)}}const I=[],L=500;function Q(o,t,i){I.push({key:o,level:t,message:i.map(s=>typeof s=="string"?s:U(s)).join(" "),at:Date.now()}),I.length>L&&I.shift()}function U(o){if(o instanceof Error)return o.message;try{return JSON.stringify(o)}catch{return String(o)}}function x(){return I.map(o=>({...o}))}function q(o){if(o.length===0||typeof o[0]!="string")return o;const t=o[0].replace(/^\[lattice\]\s*/,"");return t===o[0]?o:[t,...o.slice(1)]}function R(o,...t){if(ie.has(o))return;K(o);const i=q(t);Q(o,"warn",i),console.warn("[lattice]",...i)}function j(o,...t){if(ie.has(o))return;K(o);const i=q(t);Q(o,"info",i),console.info("[lattice]",...i)}function k(){ie.clear(),I.length=0}function b(o,t){const i=new Error(`[lattice] ${o}`);throw t!==void 0&&(i.cause=t),i}function u(o,t){o||b(t)}const g=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})()}),_e("packages/core/src/formatting/rules.js",function(e,F){"use strict";Object.defineProperty(e,"RULE_OPS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"DISTRIBUTION_OPS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"DISTRIBUTION_LABELS",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"testRule",{enumerable:!0,get:function(){return R}}),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 b}}),Object.defineProperty(e,"needsDistribution",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"resolveDistribution",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ICON_SETS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"compileRules",{enumerable:!0,get:function(){return W}});const E=F("packages/core/src/internal/predicates.js").isFunction,I=F("packages/core/src/internal/warn.js").warnOnce,L=Object.freeze(["eq","ne","gt","gte","lt","lte","between","outside","contains","notContains","startsWith","endsWith","blank","notBlank","true","false"]),Q=Object.freeze(["topPercent","bottomPercent","topN","bottomN","aboveMean","belowMean","aboveMedian","belowMedian","zAbove","zBelow","outlier"]),U=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 x(S,O){const M=Number(S),A=Number(O);if(S!==null&&S!==""&&O!==null&&O!==""&&Number.isFinite(M)&&Number.isFinite(A))return M<A?-1:M>A?1:0;const $=String(S??"").toLowerCase(),H=String(O??"").toLowerCase();return $<H?-1:$>H?1:0}function q(S){return S==null||S===""}function R(S,O){if(!O||typeof O!="object")return!1;const{op:M}=O,A=O.value,N=O.value2;switch(M){case"blank":return q(S);case"notBlank":return!q(S);case"true":return S===!0;case"false":return S===!1;default:break}if(q(S))return!1;switch(M){case"eq":return x(S,A)===0;case"ne":return x(S,A)!==0;case"gt":return x(S,A)>0;case"gte":return x(S,A)>=0;case"lt":return x(S,A)<0;case"lte":return x(S,A)<=0;case"between":return x(S,A)>=0&&x(S,N)<=0;case"outside":return x(S,A)<0||x(S,N)>0;case"contains":return String(S).toLowerCase().includes(String(A??"").toLowerCase());case"notContains":return!String(S).toLowerCase().includes(String(A??"").toLowerCase());case"startsWith":return String(S).toLowerCase().startsWith(String(A??"").toLowerCase());case"endsWith":return String(S).toLowerCase().endsWith(String(A??"").toLowerCase());default:return!1}}function j(S,O,M){const A=z=>{const X=String(z).replace("#",""),ne=X.length===3?X.split("").map(se=>se+se).join(""):X;return[0,2,4].map(se=>parseInt(ne.slice(se,se+2),16)||0)},[N,$,H]=A(S),[Y,Z,J]=A(O),D=Math.max(0,Math.min(1,M)),te=(z,X)=>Math.round(z+(X-z)*D);return`#${[te(N,Y),te($,Z),te(H,J)].map(z=>z.toString(16).padStart(2,"0")).join("")}`}function k(S){const O=[];for(const Y of S||[]){if(Y==null||Y==="")continue;const Z=Y instanceof Date?Y.getTime():Number(Y);Number.isFinite(Z)&&O.push(Z)}if(!O.length)return null;O.sort((Y,Z)=>Y-Z);let M=0,A=0,N=0;for(const Y of O){M++;const Z=Y-A;A+=Z/M,N+=Z*(Y-A)}const $=b(O,.25),H=b(O,.75);return{n:O.length,min:O[0],max:O[O.length-1],mean:A,stddev:O.length>1?Math.sqrt(N/(O.length-1)):0,median:b(O,.5),q1:$,q3:H,iqr:H-$,sorted:O}}function b(S,O){if(!S.length)return 0;const M=(S.length-1)*Math.max(0,Math.min(1,O)),A=Math.floor(M),N=Math.ceil(M);return A===N?S[A]:S[A]+(M-A)*(S[N]-S[A])}function u(S){for(const O of Array.isArray(S)?S:[])if(!(!O||typeof O!="object")&&(O.when&&Q.includes(O.when.op)||O.scale&&O.scale.from||O.dataBar&&!(Number.isFinite(Number(O.dataBar.min))&&Number.isFinite(Number(O.dataBar.max)))||O.iconSet&&!Array.isArray(O.iconSet.thresholds)))return!0;return!1}function g(S,O){const M=Number(S.value),A=N=>b(O.sorted,N);switch(S.op){case"topPercent":{const N=o(M,10);return{op:"gte",value:A(1-N)}}case"bottomPercent":{const N=o(M,10);return{op:"lte",value:A(N)}}case"topN":{const N=Math.max(1,Math.floor(M)||1),$=Math.max(0,O.sorted.length-N);return{op:"gte",value:O.sorted[$]}}case"bottomN":{const N=Math.max(1,Math.floor(M)||1),$=Math.min(O.sorted.length-1,N-1);return{op:"lte",value:O.sorted[$]}}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(M)?M:2)*O.stddev}:null;case"zBelow":return O.stddev?{op:"lte",value:O.mean-(Number.isFinite(M)?M:2)*O.stddev}:null;case"outlier":{const N=(Number.isFinite(M)&&M>0?M:1.5)*O.iqr;return O.iqr?{op:"outside",value:O.q1-N,value2:O.q3+N}:null}default:return null}}function o(S,O){const M=Number.isFinite(S)?S:O,A=M>1?M/100:M;return Math.max(0,Math.min(1,A))}function t(S,O){if(S.from==="minmax")return{...S,min:O.min,max:O.max};if(S.from==="quantile")return{...S,min:b(O.sorted,o(Number(S.low),5)),max:b(O.sorted,o(Number(S.high),95))};if(S.from==="stddev"){const M=Number.isFinite(Number(S.deviations))?Number(S.deviations):2;return{...S,min:O.mean-M*O.stddev,max:O.mean+M*O.stddev}}return S}function i(S,O){const M=Array.isArray(S)?S:[];return!O||!O.n?M.map(A=>A&&u([A])?{...A,enabled:!1}:A):M.map(A=>{if(!A||typeof A!="object")return A;if(A.scale&&A.scale.from)return{...A,scale:t(A.scale,O)};if(A.dataBar)return{...A,dataBar:s(A.dataBar,O)};if(A.iconSet)return{...A,iconSet:r(A.iconSet,O)};if(!A.when||!Q.includes(A.when.op))return A;const N=g(A.when,O);return N?{...A,when:N}:{...A,enabled:!1}})}function s(S,O){const M=Number.isFinite(Number(S.min))?Number(S.min):void 0,A=Number.isFinite(Number(S.max))?Number(S.max):void 0;if(M!==void 0&&A!==void 0)return{...S,min:M,max:A};if(S.from==="quantile")return{...S,min:M??b(O.sorted,o(Number(S.low),5)),max:A??b(O.sorted,o(Number(S.high),95))};if(S.from==="stddev"){const N=Number.isFinite(Number(S.deviations))?Number(S.deviations):2;return{...S,min:M??O.mean-N*O.stddev,max:A??O.mean+N*O.stddev}}return{...S,min:M??O.min,max:A??O.max}}function r(S,O){if(Array.isArray(S.thresholds))return S;const M=n(S),A=[];for(let N=1;N<M;N++)A.push(b(O.sorted,N/M));return{...S,thresholds:A}}function n(S){if(Array.isArray(S.icons)&&S.icons.length>=2)return S.icons.length;if(Number.isFinite(Number(S.count))&&Number(S.count)>=2)return Math.floor(Number(S.count));const O=y[S.set];return O?O.length:3}function m(S){return`url("data:image/svg+xml,${encodeURIComponent(S)}")`}function l(S){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="${S}"/></svg>`}function a(S,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="${S}"/></svg>`}function c(S,O){const M="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 A=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${O*16} 16">`;for(let N=0;N<O;N++){const $=N<S?"#f5a623":"#d0d0d0";A+=`<path transform="translate(${N*16},0)" d="${M}" fill="${$}"/>`}return`${A}</svg>`}const f=Object.freeze([a("#c0392b","down"),a("#e0a800","right"),a("#2e7d32","up")]),p=Object.freeze([l("#d13438"),l("#f5a623"),l("#2e9e44")]),y=Object.freeze({arrows:f,trafficLights:p,ratings:Object.freeze([1,2,3,4,5].map(S=>c(S,5)))}),h=Object.freeze({arrows:"Arrows",trafficLights:"Traffic lights",ratings:"Ratings"});function d(S){if(Array.isArray(S.icons)&&S.icons.length>=2)return S.icons.map(A=>/^\s*(url\(|data:|<)/.test(String(A))&&String(A).trim().startsWith("<")?m(String(A)):String(A));const O=S.set||"arrows";if(O==="ratings"){const A=n(S),N=[];for(let $=1;$<=A;$++)N.push(m(c($,A)));return N}const M=y[O];return M?M.map(m):(I(`iconSet:${O}`,`unknown icon set '${O}'; falling back to arrows.`),f.map(m))}function w(S){const O=Number(S.min),A=Number(S.max)-O,N=S.colour||S.color||"#5b9bd5",$=S.negativeColour||S.negativeColor||"#d13438",H=S.direction==="rtl"?"left":"right",Y=J=>Math.max(0,Math.min(1,(J-O)/A))*100,Z=A?Math.max(0,Math.min(100,(0-O)/A*100)):0;return J=>{if(q(J))return null;const D=Number(J);if(!Number.isFinite(D)||!A)return null;const te=Y(D),z=Math.min(te,Z),X=Math.max(te,Z),ne=D>=0?N:$;return{backgroundImage:`linear-gradient(to ${H}, transparent ${z}%, ${ne} ${z}%, ${ne} ${X}%, transparent ${X}%)`,backgroundRepeat:"no-repeat",backgroundPosition:"0 0"}}}function v(S){const O=d(S),M=S.reverse?[...O].reverse():O,A=(Array.isArray(S.thresholds)?S.thresholds:[]).map(Number).filter(Number.isFinite),N=Number.isFinite(Number(S.size))?Number(S.size):16,$=S.set==="ratings"?N*n(S):N;return H=>{if(q(H))return null;const Y=Number(H);if(!Number.isFinite(Y))return null;let Z=0;for(const D of A)Y>=D&&Z++;const J=M[Math.min(Z,M.length-1)];return J?{backgroundImage:J,backgroundRepeat:"no-repeat",backgroundPosition:"left center",backgroundSize:`${$}px ${N}px`,paddingLeft:`${$+4}px`}:null}}function P(S){const O=Array.isArray(S.colours)&&S.colours.length>=2?S.colours:["#f8f9fa","#1a6bc7"],M=Number(S.min),A=Number(S.max),N=A-M,$=O.length-1,H=[];for(let Z=0;Z<=$;Z++)H.push($?Z/$:0);const Y=Number(S.mid);if(S.mid!==void 0&&S.mid!==null)if(O.length%2===0)I("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(Y)&&N&&Y>Math.min(M,A)&&Y<Math.max(M,A)){const Z=$/2,J=Math.max(0,Math.min(1,(Y-M)/N));for(let D=0;D<=$;D++)H[D]=D<=Z?Z?D/Z*J:J:J+(D-Z)/($-Z)*(1-J)}else Number.isFinite(Y)&&I("formatting.scale.mid.range",`a scale's "mid" (${Y}) is outside its min..max range, so it was ignored.`);return Z=>{const J=Number(Z);if(!Number.isFinite(J)||!N)return null;const D=Math.max(0,Math.min(1,(J-M)/N));let te=0;for(;te<$-1&&D>H[te+1];)te++;const z=H[te+1]-H[te],X=z>0?(D-H[te])/z:0;return{background:j(O[te],O[te+1],Math.max(0,Math.min(1,X)))}}}function W(S,O=null){const M=u(S)?i(S,O):S,A=(Array.isArray(M)?M:[]).filter(H=>H&&typeof H=="object");if(!A.length)return()=>null;const N=A.map(H=>H.scale?{scale:P(H.scale),enabled:H.enabled!==!1}:H.dataBar?{scale:w(H.dataBar),enabled:H.enabled!==!1}:H.iconSet?{scale:v(H.iconSet),enabled:H.enabled!==!1}:{when:H.when,style:H.style,stop:H.stopIfTrue!==!1,enabled:H.enabled!==!1}),$=V(N)?T():null;return(H,Y)=>{const Z=H?H.value:void 0;let J=null;Y&&(Y.mode=0);for(const D of N){if(!D.enabled)continue;if(D.scale){const X=D.scale(Z);X&&(J={...J||{},...X});continue}if(!R(Z,D.when))continue;let te;const z=E(D.style);if(z?Y&&$?(te=D.style($.enter(H)),$.mode>Y.mode&&(Y.mode=$.mode)):te=D.style(H):te=D.style,te&&(J=J?{...J,...te}:z?te:{...te}),D.stop)break}return J}}function V(S){return S.some(O=>O.enabled&&!O.scale&&E(O.style))}const G=new Set(["value","colId","column"]),_=new Set(["row","data","index"]);function T(){let S={};const O={mode:0,enter(N){return S=N||{},O.mode=0,A}},M=N=>{if(G.has(N))return;const $=_.has(N)?1:2;$>O.mode&&(O.mode=$)},A=new Proxy({},{get(N,$){return M($),S[$]},has(N,$){return M($),$ in S},set(N,$,H){return O.mode=2,S[$]=H,!0},ownKeys(){return O.mode=2,Reflect.ownKeys(S)},getOwnPropertyDescriptor(N,$){O.mode=2;const H=Object.getOwnPropertyDescriptor(S,$);return H?{value:S[$],enumerable:H.enumerable,configurable:!0,writable:!0}:void 0}});return O}}),_e("packages/core/src/formula/parse.js",function(e,F){"use strict";Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return i}});const ie="num",E="str",K="ref",I="name",L="op",Q="end",U=["<=",">=","<>","!="],x="+-*/^%(),<>=";class q extends Error{constructor(r,n){super(r),this.name="FormulaError",this.at=n}}function R(s){const r=[];let n=0;for(;n<s.length;){const m=s[n];if(m===" "||m===" "||m===`
|
|
7
|
-
`||m==="\r"){n++;continue}if(m>="0"&&m<="9"){n=k(s,n,r);continue}if(m==="."&&s[n+1]>="0"&&s[n+1]<="9"){n=k(s,n,r);continue}if(m==='"'||m==="'"){n=b(s,n,r);continue}if(m==="["){const a=s.indexOf("]",n+1);if(a<0)throw new q("a [column reference] was opened and never closed",n);r.push({kind:K,value:s.slice(n+1,a).trim(),at:n}),n=a+1;continue}if(j(m)){n=u(s,n,r);continue}const l=s.slice(n,n+2);if(U.includes(l)){r.push({kind:L,value:l==="!="?"<>":l,at:n}),n+=2;continue}if(x.includes(m)){r.push({kind:L,value:m,at:n}),n++;continue}throw new q(`unexpected character ${JSON.stringify(m)}`,n)}return r.push({kind:Q,value:null,at:s.length}),r}function j(s){return/[A-Za-z_À-]/.test(s)}function k(s,r,n){let m=r,l=!1;for(;m<s.length;){const a=s[m];if(a>="0"&&a<="9"){m++;continue}if(a==="."&&!l){l=!0,m++;continue}if((a==="e"||a==="E")&&/[0-9+-]/.test(s[m+1]||"")){for(m+=2;m<s.length&&s[m]>="0"&&s[m]<="9";)m++;break}break}return n.push({kind:ie,value:Number(s.slice(r,m)),at:r}),m}function b(s,r,n){const m=s[r];let l=r+1,a="";for(;l<s.length;){if(s[l]===m){if(s[l+1]===m){a+=m,l+=2;continue}return n.push({kind:E,value:a,at:r}),l+1}a+=s[l],l++}throw new q("a string was opened and never closed",r)}function u(s,r,n){let m=r;for(;m<s.length&&/[A-Za-z0-9_.À-]/.test(s[m]);)m++;const l=s.slice(r,m);let a=m;for(;a<s.length&&s[a]===" ";)a++;return n.push({kind:s[a]==="("?I:K,value:l,at:r}),m}const g={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function o(s){const r=String(s??"").replace(/^\s*=/,"");if(!r.trim())throw new q("the formula is empty");const n=R(r);let m=0;const l=()=>n[m],a=()=>n[m++],c=v=>{const P=l();if(P.kind!==L||P.value!==v)throw new q(`expected ${JSON.stringify(v)}`,P.at);m++},f=v=>{let P=p();for(;;){const W=l();if(W.kind!==L)break;const V=g[W.value];if(!V||V<v)break;m++;const G=f(W.value==="^"?V:V+1);P={kind:"bin",op:W.value,left:P,right:G}}return P},p=()=>{const v=l();return v.kind===L&&(v.value==="-"||v.value==="+")?(m++,{kind:"unary",op:v.value,arg:p()}):y()},y=()=>{let v=h();for(;l().kind===L&&l().value==="%";)m++,v={kind:"unary",op:"%",arg:v};return v},h=()=>{const v=a();if(v.kind===ie)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===I){c("(");const P=[];if(!(l().kind===L&&l().value===")"))for(;;){if(P.push(f(1)),l().kind===L&&l().value===","){m++;continue}break}return c(")"),{kind:"call",name:String(v.value).toUpperCase(),args:P}}if(v.kind===L&&v.value==="("){const P=f(1);return c(")"),P}throw v.kind===Q?new q("the formula ends unexpectedly",v.at):new q(`unexpected ${JSON.stringify(v.value)}`,v.at)},d=f(1),w=l();if(w.kind!==Q)throw new q(`unexpected ${JSON.stringify(w.value)}: is an operator missing?`,w.at);return d}function t(s){const r=new Set,n=m=>{if(!(!m||typeof m!="object")){if(m.kind==="ref"){r.add(String(m.name));return}if(m.kind==="bin"){n(m.left),n(m.right);return}if(m.kind==="unary"){n(m.arg);return}if(m.kind==="call")for(const l of m.args)n(l)}};return n(s),[...r]}function i(s){return typeof s=="string"&&/^\s*=/.test(s)&&s.trim()!=="="}}),_e("packages/core/src/formula/evaluate.js",function(e,F){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return k}});const E=F("packages/core/src/formula/parse.js").FormulaError;function K(b){if(b==null||b==="")return 0;if(typeof b=="boolean")return b?1:0;if(b instanceof Date)return b.getTime();const u=typeof b=="number"?b:Number(String(b).replace(/[,\s]/g,""));if(!Number.isFinite(u))throw new E(`${JSON.stringify(b)} is not a number`);return u}function I(b){return b==null?"":String(b)}function L(b){if(typeof b=="boolean")return b;if(b==null||b==="")return!1;if(typeof b=="number")return b!==0;const u=String(b).trim().toLowerCase();return u==="false"||u==="no"||u==="0"?!1:u!==""}function Q(b){const u=[];for(const g of b){if(Array.isArray(g)){for(const o of g)o!=null&&o!==""&&u.push(K(o));continue}g==null||g===""||u.push(K(g))}return u}function U(b,u){const g=10**u,o=b*g;return Math.sign(o)*Math.round(Math.abs(o)+Number.EPSILON*Math.abs(o))/g}function x(b,u){if(!b.length)return 0;const g=b.slice().sort((s,r)=>s-r),o=(g.length-1)*Math.min(1,Math.max(0,u)),t=Math.floor(o),i=Math.ceil(o);return t===i?g[t]:g[t]+(o-t)*(g[i]-g[t])}function q(b,u){let g=0,o=0,t=0;for(const s of b){g++;const r=s-o;o+=r/g,t+=r*(s-o)}const i=u?g-1:g;return i>0?Math.sqrt(t/i):0}const R={SUM:b=>Q(b).reduce((u,g)=>u+g,0),AVERAGE:b=>{const u=Q(b);return u.length?u.reduce((g,o)=>g+o,0)/u.length:0},MIN:b=>{const u=Q(b);return u.length?Math.min(...u):0},MAX:b=>{const u=Q(b);return u.length?Math.max(...u):0},COUNT:b=>Q(b).length,PRODUCT:b=>Q(b).reduce((u,g)=>u*g,1),ROUND:b=>U(K(b[0]),b.length>1?K(b[1]):0),ROUNDDOWN:b=>{const u=10**(b.length>1?K(b[1]):0),g=K(b[0])*u;return(g<0?Math.ceil(g):Math.floor(g))/u},ROUNDUP:b=>{const u=10**(b.length>1?K(b[1]):0),g=K(b[0])*u;return(g<0?Math.floor(g):Math.ceil(g))/u},ABS:b=>Math.abs(K(b[0])),FLOOR:b=>Math.floor(K(b[0])),CEILING:b=>Math.ceil(K(b[0])),SQRT:b=>Math.sqrt(K(b[0])),POWER:b=>K(b[0])**K(b[1]),MOD:b=>{const u=K(b[1]);if(u===0)throw new E("MOD by zero");return(K(b[0])%u+u)%u},IF:b=>L(b[0])?b[1]:b.length>2?b[2]:!1,AND:b=>b.every(L),OR:b=>b.some(L),NOT:b=>!L(b[0]),COALESCE:b=>b.find(u=>u!=null&&u!=="")??null,CONCAT:b=>b.map(I).join(""),LEN:b=>I(b[0]).length,UPPER:b=>I(b[0]).toUpperCase(),LOWER:b=>I(b[0]).toLowerCase(),TRIM:b=>I(b[0]).trim(),LEFT:b=>I(b[0]).slice(0,b.length>1?K(b[1]):1),RIGHT:b=>{const u=b.length>1?K(b[1]):1;return u<=0?"":I(b[0]).slice(-u)},MEDIAN:b=>x(Q(b),.5),PERCENTILE:b=>{const u=K(b[b.length-1]);return x(Q(b.slice(0,-1)),u>1?u/100:u)},QUARTILE1:b=>x(Q(b),.25),QUARTILE3:b=>x(Q(b),.75),STDEV:b=>q(Q(b),!0),STDEVP:b=>q(Q(b),!1),VAR:b=>{const u=q(Q(b),!0);return u*u},VARP:b=>{const u=q(Q(b),!1);return u*u},COUNTDISTINCT:b=>{const u=new Set;for(const g of b){const o=Array.isArray(g)?g:[g];for(const t of o)t!=null&&t!==""&&u.add(t)}return u.size},IQR:b=>{const u=Q(b);return x(u,.75)-x(u,.25)}};R.AVG=R.AVERAGE,R.CEIL=R.CEILING,R.POW=R.POWER,R.STDEVS=R.STDEV,R.PERCENTILEINC=R.PERCENTILE;function j(b,u){const g=Number(b),o=Number(u);if(b!==null&&b!==""&&u!==null&&u!==""&&Number.isFinite(g)&&Number.isFinite(o))return g<o?-1:g>o?1:0;const i=I(b).toLowerCase(),s=I(u).toLowerCase();return i<s?-1:i>s?1:0}function k(b,u={}){const g=typeof u.lookup=="function"?u.lookup:null,o=u.functions?{...R,...u.functions}:R,t=i=>{switch(i.kind){case"num":return i.value;case"str":return i.value;case"ref":{if(!g)throw new E(`there is no column called ${JSON.stringify(i.name)} here`);const s=g(String(i.name));if(s===void 0)throw new E(`there is no column called ${JSON.stringify(i.name)}`);return s}case"unary":{if(i.op==="%")return K(t(i.arg))/100;const s=K(t(i.arg));return i.op==="-"?-s:s}case"bin":{const s=i.op;if(s==="=")return j(t(i.left),t(i.right))===0;if(s==="<>")return j(t(i.left),t(i.right))!==0;if(s==="<")return j(t(i.left),t(i.right))<0;if(s==="<=")return j(t(i.left),t(i.right))<=0;if(s===">")return j(t(i.left),t(i.right))>0;if(s===">=")return j(t(i.left),t(i.right))>=0;const r=K(t(i.left)),n=K(t(i.right));if(s==="+")return r+n;if(s==="-")return r-n;if(s==="*")return r*n;if(s==="^")return r**n;if(s==="/"){if(n===0)throw new E("division by zero");return r/n}throw new E(`unknown operator ${JSON.stringify(s)}`)}case"call":{const s=u.lazy&&u.lazy[i.name];if(typeof s=="function")return s(i.args,t,u);const r=o[i.name];if(typeof r!="function")throw new E(`there is no function called ${i.name}`);return r(i.args.map(t),u)}default:throw new E("the formula could not be read")}};return t(b)}}),_e("packages/core/src/formula/index.js",function(e,F){"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 I}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return j}});const ie=F("packages/core/src/formula/parse.js"),E=ie.parseFormula,K=ie.referencesOf,I=ie.looksLikeFormula,L=ie.FormulaError,Q=ie.tokenise,U=F("packages/core/src/formula/evaluate.js"),x=U.evaluateAst,q=U.FUNCTIONS;function R(k){const{grid:b,row:u,data:g}=k||{},o=n=>String(n).toLowerCase().replace(/[\s_-]/g,""),t=b&&b.columns&&typeof b.columns.all=="function"?b.columns.all():[],i=b&&b.permissions,s=i&&typeof i.isReadable=="function"?n=>i.isReadable(n):()=>!0,r=new Set;for(const n of t)s(n)||(r.add(o(n.id)),n.field&&r.add(o(n.field)),n.title&&r.add(o(n.title)));return n=>{const m=o(n);if(r.has(m))throw new L(`"${n}" cannot be read`);for(const l of t)if(o(l.id)===m||l.field&&o(l.field)===m||l.title&&o(l.title)===m)return u&&b.rows&&typeof b.rows.value=="function"?b.rows.value(u.key,l.id):g?g[l.field||l.id]:void 0;if(g&&typeof g=="object"){for(const l of Object.keys(g))if(o(l)===m){if(!s(l))throw new L(`"${n}" cannot be read`);return g[l]}}}}function j(k,b={}){try{const u=E(k);return{ok:!0,value:x(u,{lookup:R(b),functions:b.formulaFunctions}),references:K(u)}}catch(u){return{ok:!1,error:u instanceof L?u.message:"the formula could not be read",at:u instanceof L?u.at:void 0}}}}),_e("packages/core/src/internal/version.js",function(e,F){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return K}});const ie="1.117.2";async function E(){return ie}const K="1.117.2"}),_e("packages/core/src/internal/merge.js",function(e,F){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"mergeRow",{enumerable:!0,get:function(){return U}});const E=F("packages/core/src/internal/predicates.js").isObject;function K(x,q,R){if(x!==void 0)return x===!0?{enabled:!0,...R}:x===!1?{enabled:!1}:E(x)?x:{[q]:x,enabled:!0}}function I(x){return x==null?[]:Array.isArray(x)?x:[x]}const L=Object.freeze(new Set(["__proto__","constructor","prototype"]));function Q(x,q){if(!E(x))return E(q)?{...q}:q;if(!E(q))return q===void 0?x:q;const R={...x};for(const j of Object.keys(q)){if(L.has(j))continue;const k=q[j];k!==void 0&&(R[j]=E(k)&&E(R[j])?Q(R[j],k):k)}return R}function U(x,q){if(!E(x)||!E(q)||x===q)return q;const R=Object.create(Object.getPrototypeOf(x));return Object.assign(R,x,q),R}}),_e("packages/core/src/internal/schedule.js",function(e,F){"use strict";Object.defineProperty(e,"now",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"nextFrame",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return U}});function ie(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const E=typeof requestAnimationFrame=="function";function K(x){return E?requestAnimationFrame(x):setTimeout(()=>x(ie()),16)}function I(x){x!=null&&(E?cancelAnimationFrame(x):clearTimeout(x))}function L(x){let q=null,R=null;const j=()=>{q=null;const b=R;R=null,x(...b||[])},k=(...b)=>{R=b,q===null&&(q=K(j))};return k.cancel=()=>{I(q),q=null,R=null},k.flush=()=>{q!==null&&(I(q),j())},k}function Q(x,q){let R=null,j=null;const k=()=>{if(R=null,j===null)return;const g=j;j=null,x(...g),b()},b=()=>{R=setTimeout(k,q),typeof R?.unref=="function"&&R.unref()},u=(...g)=>{R===null?(x(...g),b()):(j=g,clearTimeout(R),b())};return u.flush=()=>{if(R!==null&&clearTimeout(R),R=null,j===null)return;const g=j;j=null,x(...g)},u.cancel=()=>{R!==null&&clearTimeout(R),R=null,j=null},u.pending=()=>R!==null||j!==null,u}function U(x,q=50){return typeof requestIdleCallback=="function"?requestIdleCallback(x,{timeout:q}):setTimeout(()=>x({timeRemaining:()=>0,didTimeout:!0}),1)}}),_e("packages/core/src/internal/paths.js",function(e,F){"use strict";Object.defineProperty(e,"pathGetter",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"pathSetter",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"getPath",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return Q}});const ie=new Map;function E(U){let x=ie.get(U);if(x)return x;if(!U.includes("."))x=q=>q?.[U];else{const q=U.split("."),R=q.length;x=j=>{let k=j;for(let b=0;b<R;b++){if(k==null)return;k=k[q[b]]}return k}}return ie.set(U,x),x}const K=new Map;function I(U){let x=K.get(U);if(x)return x;if(!U.includes("."))x=(q,R)=>{q!=null&&(q[U]=R)};else{const q=U.split("."),R=q.length-1;x=(j,k)=>{let b=j;for(let u=0;u<R;u++){if(b==null)return;const g=q[u];b[g]==null&&(b[g]={}),b=b[g]}b!=null&&(b[q[R]]=k)}}return K.set(U,x),x}function L(U,x){return E(x)(U)}function Q(U,x,q){I(x)(U,q)}}),_e("packages/core/src/internal/compare.js",function(e,F){"use strict";Object.defineProperty(e,"collator",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"defaultCompare",{enumerable:!0,get:function(){return K}});const ie=new Map;function E(I,L){const Q=`${I||""}|${L?JSON.stringify(L):""}`;let U=ie.get(Q);return U||(U=new Intl.Collator(I||void 0,{numeric:!0,sensitivity:"variant",...L}),ie.set(Q,U)),U}function K(I,L){if(I===L)return 0;if(I==null)return 1;if(L==null)return-1;if(typeof I=="number"&&typeof L=="number")return Number.isNaN(I)?Number.isNaN(L)?0:1:Number.isNaN(L)||I<L?-1:I>L?1:0;const Q=String(I),U=String(L);return Q<U?-1:Q>U?1:0}}),_e("packages/core/src/defaults.js",function(e,F){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return j}});const E=F("packages/core/src/internal/predicates.js").isObject,I=F("packages/core/src/internal/merge.js").merge,Q=F("packages/core/src/internal/warn.js").warnOnce;let U=null;class x extends Error{}function q(k,b=new Set){if(Array.isArray(k)){if(b.has(k))throw new x;b.add(k);const g=k.map(o=>q(o,b));return b.delete(k),g}if(!E(k)||Object.getPrototypeOf(k)!==Object.prototype&&Object.getPrototypeOf(k)!==null)return k;if(b.has(k))throw new x;b.add(k);const u={};for(const[g,o]of Object.entries(k))u[g]=q(o,b);return b.delete(k),u}function R(k){if(k===void 0)return q(U??{});if(k===null)return U=null,{};if(!E(k))return Q("defaults:type",`defaults() expects a configuration object, or null to clear it, but got ${Array.isArray(k)?"an array":typeof k}. The call was ignored and the defaults are unchanged.`),q(U??{});try{U=q(k)}catch(b){if(!(b instanceof x))throw b;return Q("defaults:cyclic","defaults() expects a configuration object with no circular references, but the object passed refers back to itself. The call was ignored and the defaults are unchanged."),q(U??{})}return q(U)}function j(k){return U===null?k:I(q(U),k)}}),_e("packages/core/src/internal/uid.js",function(e,F){"use strict";Object.defineProperty(e,"uid",{enumerable:!0,get:function(){return E}});let ie=0;function E(K="l"){return`${K}${(++ie).toString(36)}`}}),_e("packages/core/src/events/names.js",function(e,F){"use strict";Object.defineProperty(e,"EVENT_NAMES",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"isKnownEvent",{enumerable:!0,get:function(){return K}});const ie=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(ie);function K(I){return I==="*"||E.has(I)}}),_e("packages/core/src/events/bus.js",function(e,F){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return g}});const ie=F("packages/core/src/internal/warn.js"),E=ie.warnOnce,K=ie.DEV,L=F("packages/core/src/internal/uid.js").uid,U=F("packages/core/src/events/names.js").isKnownEvent,x="*";function q(o,t){!K||U(t)||E(`bus.unknown:${t}`,`${o}('${t}') subscribes to an event the grid never raises, so the handler will never fire. Check the name against the EventName list — a common cause is a near miss such as 'row:click' for 'row:clicked'.`)}const R=new Set(["api","user","init","ai"]),j=new WeakMap;function k(o){let t=j.get(o);return t||(t=L("h"),j.set(o,t)),t}function b(){return typeof performance=="object"&&performance?performance.now():Date.now()}function u(o){if(!o||typeof o!="object")return{};const t={};for(const[i,s]of Object.entries(o))i!=="grid"&&(s==null?t[i]=String(s):Array.isArray(s)?t[i]=`[${s.length}]`:typeof s=="object"?t[i]=s.key?`row ${s.key}`:"{…}":typeof s=="function"?t[i]="[function]":t[i]=String(s).slice(0,60));return t}class g{#e=new Map;#t=!1;#n=[];#r=200;#i=new Map;#s=null;#a=!1;#l=0;constructor(t=null){this.#s=t}attach(t){this.#s=t}get grid(){return this.#s}get destroyed(){return this.#a}on(t,i){if(typeof i!="function")return E(`bus.handler:${t}`,`on('${t}') needs a function; ignored.`),()=>{};q("on",t);let s=this.#e.get(t);return s||(s=[],this.#e.set(t,s)),s.push(i),()=>this.off(t,i)}once(t,i){if(typeof i!="function")return E(`bus.handler:${t}`,`once('${t}') needs a function; ignored.`),()=>{};q("once",t);const s=r=>{this.off(t,i),i(r)};return this.#i.set(i,s),this.on(t,s)}off(t,i){if(i===void 0){this.#e.delete(t);return}const s=this.#e.get(t);if(!s)return;const r=this.#i.get(i),n=r&&s.includes(r)?r:i,m=s.indexOf(n);m>=0&&s.splice(m,1),r&&n===r&&this.#i.delete(i),s.length===0&&this.#e.delete(t)}count(t){const i=this.#e.get(t),s=t===x?null:this.#e.get(x);return(i?i.length:0)+(s?s.length:0)}#o(t,i,s,r,n){this.#n.push({type:t,origin:i,listeners:(r?r.length:0)+(n?n.length:0),payload:u(s),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(t,i){this.#t=!!t,Number.isFinite(i)&&i>0&&(this.#r=Math.floor(i)),t||(this.#n=[])}eventLog(){return this.#n.map(t=>({...t}))}clearEventLog(){this.#n=[]}counts(){const t={};for(const[i,s]of this.#e)t[i]=s.length;return t}emit(t,i,s){const r=s??(i&&i.origin),n=R.has(r)?r:"api",m={...i||null,type:t,origin:n,grid:this.#s};if(this.#a)return m;const l=this.#e.get(t),a=t===x?void 0:this.#e.get(x);if(this.#t&&this.#o(t,n,i,l,a),!l&&!a)return m;const c=this.#t?b():0;this.#l++;try{l&&this.#c(l.slice(),m,t),a&&this.#c(a.slice(),m,x)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=b()-c)}return m}emitBefore(t,i,s){const r=s??(i&&i.origin),n=R.has(r)?r:"user";let m=!1,l=null;const a=d=>{m=!0,d!=null&&l===null&&(l=String(d))},c={...i||null,type:t,origin:n,grid:this.#s,get defaultPrevented(){return m},get reason(){return l},preventDefault(d){a(d)}};if(this.#a)return!0;const f=this.#e.get(t);this.#t&&this.#o(t,n,i,f,void 0);const p=f?f.slice():[];if(p.length===0)return!0;const y=()=>(m&&l===null&&(l="prevented"),m&&i&&typeof i=="object"&&(i.reason=l),!m),h=[];for(const d of p)try{const w=d(c);w&&typeof w.then=="function"?h.push(w):w===!1&&a("prevented")}catch(w){a("error"),E(`bus.beforeThrow:${t}:${k(d)}`,`a '${t}' before-handler threw; the action was cancelled.`,w)}return h.length===0?y():Promise.allSettled(h).then(d=>{for(const w of d)w.status==="rejected"?(a("error"),E(`bus.beforeReject:${t}`,`a '${t}' before-handler rejected; the action was cancelled.`,w.reason)):w.value===!1&&a("prevented");return y()})}#c(t,i,s){for(let r=0;r<t.length;r++)try{t[r](i)}catch(n){E(`bus.throw:${s}:${k(t[r])}`,`a '${s}' handler threw; other handlers were unaffected.`,n)}}clear(){this.#e.clear(),this.#i.clear()}destroy(){this.clear(),this.#a=!0,this.#s=null}}}),_e("packages/core/src/registry/free-tier-notice.js",function(e,F){"use strict";Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"WATERMARK_TEXT",{enumerable:!0,get:function(){return E}});const ie="Free for non-commercial use: latticegrid.dev/free",E="Unlicensed: Lattice Grid trial"}),_e("packages/core/src/registry/licence.js",function(e,F){"use strict";Object.defineProperty(e,"PRODUCT",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"LICENCE_VERSION",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"fromBase64Url",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"toBase64Url",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"asciiBytes",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"parseLicence",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"hasEd25519",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"verifyLicence",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"isLocalHost",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"currentHost",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"matchesDomain",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"LicenceHolder",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"setLicence",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return T}});const E=F("packages/core/src/internal/warn.js").warnOnce,K=F("packages/core/src/registry/free-tier-notice.js"),I=K.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return K.FREE_TIER_NOTICE}});const L="lattice-grid",Q=1,U="LG1",x=64,q="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",R="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",j=(()=>{const S=new Int16Array(128).fill(-1);for(let O=0;O<R.length;O++)S[R.charCodeAt(O)]=O;return S[43]=62,S[47]=63,S})();function k(S){if(typeof S!="string")return null;let O="";for(let Y=0;Y<S.length;Y++){const Z=S.charCodeAt(Y);if(Z!==61){if(Z>127||j[Z]<0)return null;O+=S[Y]}}const M=O.length;if(M%4===1)return null;const A=new Uint8Array(Math.floor(M*3/4));let N=0,$=0,H=0;for(let Y=0;Y<M;Y++)N=N<<6|j[O.charCodeAt(Y)],$+=6,$>=8&&($-=8,A[H++]=N>>$&255);return H===A.length?A:A.subarray(0,H)}function b(S){let O="",M=0;for(;M+2<S.length;M+=3){const N=S[M]<<16|S[M+1]<<8|S[M+2];O+=R[N>>18&63]+R[N>>12&63]+R[N>>6&63]+R[N&63]}const A=S.length-M;if(A===1){const N=S[M]<<16;O+=R[N>>18&63]+R[N>>12&63]}else if(A===2){const N=S[M]<<16|S[M+1]<<8;O+=R[N>>18&63]+R[N>>12&63]+R[N>>6&63]}return O}function u(S){const O=new Uint8Array(S.length);for(let M=0;M<S.length;M++)O[M]=S.charCodeAt(M)&127;return O}function g(S){if(typeof TextDecoder=="function")return new TextDecoder().decode(S);let O="";for(let M=0;M<S.length;M++)O+=String.fromCharCode(S[M]);return O}function o(S){const O={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof S=="string"?S:""};if(typeof S!="string"||S.length===0)return{...O,reason:"missing"};const M=S.trim(),A=M.split(".");if(A.length!==3)return O;const[N,$,H]=A;if(N!==U)return{...O,reason:"prefix"};const Y=k($),Z=k(H);if(!Y||!Z)return O;let J;try{J=JSON.parse(g(Y))}catch{return O}return J===null||typeof J!="object"?O:{ok:!0,reason:null,product:typeof J.p=="string"?J.p:null,issuedTo:typeof J.t=="string"?J.t:null,expires:typeof J.e=="string"?J.e:null,terms:typeof J.terms=="string"?J.terms:null,features:Array.isArray(J.f)?J.f.slice():[],deployments:Array.isArray(J.d)?J.d.slice():[],version:typeof J.v=="number"?J.v:0,message:u($),signature:Z,raw:M}}function t(S,O){if(!S)return!1;const M=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(S)?`${S}T23:59:59.999Z`:S);return Number.isNaN(M)?!0:O>M}function i(S){return S==="non-commercial"?"non-commercial":"commercial"}let s=null,r=null,n=null;function m(){const S=globalThis.crypto;return S&&S.subtle?S.subtle:null}async function l(S){if(s&&r===S)return s;const O=m();if(!O)return null;const M=k(S);if(!M)return null;try{const A=await O.importKey("raw",M,{name:"Ed25519"},!1,["verify"]);return s=A,r=S,A}catch{return null}}async function a(){return n!==null||(n=await l(q)!==null),n}async function c(S,O={}){const M=O.warn!==!1,A=O.product||L,N=O.publicKey||q,$=O.now??Date.now(),H=O.host??p(),Y=f(H)?"":` ${I}`,Z=o(S);if(!Z.ok){const X=Z.reason==="missing"?"missing":"malformed";return M&&E(`licence.${X}`,X==="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.${Y}`:`licence key could not be read. The grid will render with a watermark.${Y}`),{valid:!1,reason:X,terms:"commercial"}}const J={product:Z.product||void 0,issuedTo:Z.issuedTo||void 0,expires:Z.expires||void 0,terms:i(Z.terms)};if(Z.product!==A)return M&&E("licence.product",`licence key is for '${Z.product}', not '${A}'. The grid will render with a watermark.`),{valid:!1,...J,reason:"product"};if(t(Z.expires,$))return M&&E("licence.expired",`licence expired on ${Z.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,...J,reason:"expired"};const D=Z.deployments||[];if(D.length&&H&&!f(H)&&!y(H,D))return M&&E("licence.domain",`licence key is not valid for ${H}; it covers ${D.join(", ")}. The grid will render with a watermark.`),{valid:!1,...J,reason:"domain"};const te=await l(N);if(!te){const X=!!Z.signature&&Z.signature.length===x;return M&&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."),X?{valid:!0,...J,reason:"unverified"}:{valid:!1,...J,reason:"signature"}}let z=!1;try{z=await m().verify({name:"Ed25519"},te,Z.signature,Z.message)}catch{z=!1}return z?{valid:!0,...J}:(M&&E("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...J,reason:"signature"})}function f(S){const O=String(S??p()??"").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 p(){const S=globalThis.location;return S&&typeof S.hostname=="string"?S.hostname:null}function y(S,O){const M=h(S);return!M||!Array.isArray(O)?!1:O.some(A=>{const N=h(A);if(!N)return!1;if(N==="*")return!0;if(N.startsWith("*.")){const $=N.slice(2);return M===$||M.endsWith(`.${$}`)}return M===N})}function h(S){return String(S??"").trim().toLowerCase().replace(/\.$/,"")}class d{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#i;#s=new Set;constructor(O={}){this.#i=O}set(O){this.#e=typeof O=="string"?O.trim():"";const M=o(this.#e);return this.#t=M.ok?{valid:!t(M.expires,Date.now())&&M.product===(this.#i.product||L),product:M.product||void 0,issuedTo:M.issuedTo||void 0,expires:M.expires||void 0,terms:i(M.terms),reason:"pending"}:{valid:!1,reason:M.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=c(O,this.#i).then(M=>{if(this.#e===O){this.#t=M;for(const A of this.#s)A(M)}return M}),this.#n}onSettled(O){return this.#s.add(O),()=>this.#s.delete(O)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!f(this.#r)}setHost(O){this.#r=O}state(){return this.#t.valid?"licensed":f(this.#r)?"localhost":"trial"}reset(){this.#e="",this.#t={valid:!1,reason:"missing",terms:"commercial"},this.#n=null,this.#s.clear()}}const w=Symbol.for("lattice-grid/licence/holder");function v(){const S=globalThis,O=S&&S[w];if(O&&typeof O.set=="function"&&typeof O.watermark=="function")return O;const M=new d;if(S)try{S[w]=M}catch{}return M}const P=v();function W(S){return P.set(S)}function V(){return P.info()}function G(){return P.watermark()}function _(){return P.state()}function T(){return P}}),_e("packages/core/src/registry/registry.js",function(e,F){"use strict";Object.defineProperty(e,"KINDS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"REGIONS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return s}});const ie=F("packages/core/src/internal/warn.js"),E=ie.warnOnce,K=ie.DEV,L=F("packages/core/src/internal/predicates.js").isFunction,Q=F("packages/core/src/registry/licence.js"),U=Q.LicenceHolder,x=Q.sharedLicence,q=["renderer","editor","filter","dataType","totalFn","pipe","component"],R=["all","header","body","totals","panels"];class j{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#i;#s=null;#a=null;#l=new Set;#o=new Map;constructor(n={}){for(const m of q)this.#t.set(m,new Map);this.#i=n.holder||x(),this.#a=n.grid??null,this.#s=this.#i.onSettled(()=>{this.#f({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),n.licence&&this.setLicence(n.licence)}registerModules(n,m={}){m.licence&&this.setLicence(m.licence),m.grid!==void 0&&(this.#a=m.grid);const l=Array.isArray(n)?n:[n],a=[];for(const c of l){if(!c||typeof c!="object"||typeof c.name!="string"||!c.name){E("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(c.name)){K&&this.#u(this.#e.get(c.name),c);continue}if(!L(c.install)){E(`registry.module.install:${c.name}`,`module '${c.name}' has no install() and was ignored.`);continue}const f={registry:this,grid:this.#a};try{c.install(f)}catch(p){E(`registry.module.throw:${c.name}`,`module '${c.name}' threw during install; it was not registered.`,p);continue}this.#e.set(c.name,c);for(const p of k(c))this.#n.add(p);a.push(c.name),this.#f({reason:"module",name:c.name,capabilities:this.capabilities(),regions:g(c)})}return a}unregisterModule(n){const m=this.#e.get(n);if(!m)return!1;if(L(m.uninstall))try{m.uninstall({registry:this,grid:this.#a})}catch(l){E(`registry.module.uninstall:${n}`,`module '${n}' threw during uninstall.`,l)}return this.#e.delete(n),this.#c(),this.#f({reason:"unmodule",name:n,capabilities:this.capabilities(),regions:g(m)}),!0}modules(){return[...this.#e.values()]}has(n){return this.#e.has(n)}#c(){this.#n.clear();for(const n of this.#e.values())for(const m of k(n))this.#n.add(m)}#u(n,m){!n||n===m||b(n,m)||E(`registry.module.reconfigure:${m.name}`,`module '${m.name}' was re-registered with different options; the first registration is kept and this call was ignored. Unregister it first if you mean to replace it.`)}capabilities(){return[...this.#n].sort()}can(n){return this.#n.has(n)}onChange(n){return L(n)?(this.#r.add(n),this.#o.set(n,this.#a),()=>{this.#r.delete(n),this.#o.delete(n)}):()=>{}}#f(n){for(const m of[...this.#r])try{m(n)}catch(l){E("registry.onChange.throw","a registry change handler threw.",l)}}register(n,m,l){const a=this.#t.get(n);if(!a){E(`registry.kind:${n}`,`unknown registry kind '${n}'; expected one of ${q.join(", ")}.`);return}if(!m||typeof m!="string"){E(`registry.name:${n}`,`register('${n}', ...) needs a name.`);return}a.has(m)&&a.get(m)!==l&&E(`registry.replace:${n}:${m}`,`'${m}' was already registered as a ${n} and has been replaced.`),a.set(m,l),this.#f({reason:"register",name:m,kind:n,capabilities:this.capabilities(),regions:o(n)})}registerAll(n,m){if(m)for(const l of Object.keys(m))this.register(n,l,m[l])}get(n,m){const l=this.#t.get(n);return l?l.get(m):void 0}names(n){const m=this.#t.get(n);return m?[...m.keys()]:[]}#d(n,m){const l=this.#t.get(n).get(m);return l!==void 0?l:this.#t.get("component").get(m)}renderer(n){return this.#d("renderer",n)}editor(n){return this.#d("editor",n)}filter(n){return this.#d("filter",n)}dataType(n){return this.get("dataType",n)}totalFn(n){return this.get("totalFn",n)}pipe(n){return this.get("pipe",n)}setLicence(n){return this.#i.set(n)}licence(){return this.#i.info()}licenceVerified(){return this.#i.verify()}watermark(){return this.#i.watermark()}attach(n){n!=null&&(this.#l.add(n),this.#a=n)}detach(n){if(n!=null){this.#l.delete(n);for(const[m,l]of[...this.#o])l===n&&(this.#r.delete(m),this.#o.delete(m));if(this.#a===n){const m=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#a=m}this.#l.size===0&&this.#s&&(this.#s(),this.#s=null)}}destroy(n){if(n!=null){this.detach(n);return}for(const m of[...this.#e.keys()])this.unregisterModule(m);this.#r.clear(),this.#o.clear(),this.#l.clear(),this.#s&&this.#s(),this.#s=null,this.#a=null}}function k(r){const n=r.capabilities,m=Array.isArray(n)?n.filter(l=>typeof l=="string"):[];return[r.name,...m]}function b(r,n){return r.install!==n.install||r.uninstall!==n.uninstall||(r.version||"")!==(n.version||"")?!1:u(k(r),k(n))&&u(g(r),g(n))}function u(r,n){const m=new Set(r),l=new Set(n);if(m.size!==l.size)return!1;for(const a of m)if(!l.has(a))return!1;return!0}function g(r){const n=r.regions;return!Array.isArray(n)||n.length===0?["all"]:n.filter(m=>R.includes(m))}function o(r){switch(r){case"filter":return["header"];case"totalFn":return["totals"];case"renderer":case"editor":case"pipe":return["body"];default:return["all"]}}const t=new j;function i(){return t}function s(r,n={}){return t.registerModules(r,n)}}),_e("packages/core/src/internal/text.js",function(e,F){"use strict";Object.defineProperty(e,"humanise",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"escapeHtml",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return I}});function ie(L){return L?(L.includes(".")?L.slice(L.lastIndexOf(".")+1):L).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(/^./,U=>U.toUpperCase()):""}const E={"&":"&","<":"<",">":">",'"':""","'":"'"};function K(L){const Q=L==null?"":String(L);return/[&<>"']/.test(Q)?Q.replace(/[&<>"']/g,U=>E[U]):Q}function I(L){return String(L).replace(/\w\S*/g,Q=>Q[0].toUpperCase()+Q.slice(1).toLowerCase())}}),_e("packages/core/src/format/mask.js",function(e,F){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return Q}});const ie=new Set(["0","#","?",",","."]),E="\0";function K(x){const q=[];let R="",j=!1;for(let k=0;k<x.length;k++){const b=x[k];if(b==="\\"){R+=b+(x[k+1]??""),k+=1;continue}if(b==='"'){j=!j,R+=b;continue}if(b===";"&&!j){q.push(R),R="";continue}R+=b}return q.push(R),q}function I(x){let q="",R="",j="",k=1,b=!1,u=!1;const g=a=>{u?R+=a:q+=a};for(let a=0;a<x.length;a++){const c=x[a];if(c==="\\"){g(x[a+1]??""),a+=1;continue}if(c==='"'){const f=x.indexOf('"',a+1);g(f===-1?x.slice(a+1):x.slice(a+1,f)),a=f===-1?x.length:f;continue}if(c==="%"){k*=100,g("%");continue}if(c==="@"){b=!0,g("\0");continue}if(ie.has(c)){j+=c,u=!0;continue}g(c)}let o=-1;for(let a=j.length-1;a>=0;a--){const c=j[a];if(c==="0"||c==="#"||c==="?"){o=a;break}}let t=!1,i="";for(let a=0;a<j.length;a++){const c=j[a];if(c===","){a>o?k/=1e3:t=!0;continue}i+=c}const s=i.indexOf("."),r=s===-1?i:i.slice(0,s),n=s===-1?"":i.slice(s+1);let m=0;for(const a of r)a==="0"&&(m+=1);let l=0;for(const a of n)a==="0"&&(l+=1);return{prefix:q,suffix:R,minInt:m,minDec:l,maxDec:n.length,grouping:t,scale:k,hasNumber:o!==-1,isText:b}}function L(x,q){const R=new Intl.NumberFormat(q,{minimumIntegerDigits:Math.max(x.minInt,1),minimumFractionDigits:x.minDec,maximumFractionDigits:Math.max(x.maxDec,x.minDec),useGrouping:x.grouping}),{prefix:j,suffix:k,scale:b,hasNumber:u}=x;return g=>{if(!u)return j+k;const o=b===1?g:g*b;return j+R.format(o)+k}}function Q(x,q){const j=K(String(x)).map(I),k=j.map(i=>L(i,q)),b=0,u=j.length>1?1:-1,g=j.length>2?2:-1,o=j.length>3?3:-1,t=i=>{if(i==null||i==="")return"";if(typeof i!="number"||Number.isNaN(i)){const s=Number(i);if(Number.isNaN(s))return o===-1?String(i):(j[o].prefix+j[o].suffix).split("\0").join(String(i));i=s}return i===0&&g!==-1?k[g](0):i<0&&u!==-1?k[u](-i):k[b](i)};return t.spec={mask:x},{format:t,ooxml:U(String(x))}}function U(x){return x.trim()}}),_e("packages/core/src/format/pattern.js",function(e,F){"use strict";Object.defineProperty(e,"parseNumberPattern",{enumerable:!0,get:function(){return L}});const E=F("packages/core/src/format/mask.js").splitSections;function K(Q){let U="",x="",q="",R="",j=!1,k=!1,b=!1,u=!1;const g=t=>{b?x+=t:U+=t};for(let t=0;t<Q.length;t++){const i=Q[t];if(i==="\\"){g(Q[t+1]??""),t+=1;continue}if(i==='"'){const s=Q.indexOf('"',t+1);g(s===-1?Q.slice(t+1):Q.slice(t+1,s)),t=s===-1?Q.length:s;continue}if(i==="%"){k=!0;continue}if(i==="0"||i==="#"){b=!0,u?R+=i:q+=i;continue}if(i===","){u||(j=!0);continue}if(i==="."&&!u){u=!0;continue}g(i)}if(!b)return{hasDigit:!1,prefix:U,suffix:x,minDec:0,maxDec:0,grouping:!1,percent:k};let o=0;for(const t of R)t==="0"&&(o+=1);return{hasDigit:!0,prefix:U,suffix:x,minDec:o,maxDec:R.length,grouping:j,percent:k}}function I(Q,U){const x=U.trim(),q=Q.trim();return x.startsWith("(")&&x.endsWith(")")&&x.slice(1,-1).trim()===q?"parentheses":x.endsWith("-")?"suffix":"minus"}function L(Q){if(typeof Q!="string")return null;const U=E(Q);if(U.length===0)return null;const x=K(U[0]);if(!x.hasDigit)return null;const q={style:x.percent?"percent":"decimal",prefix:x.prefix,suffix:x.suffix,minDecimals:x.minDec,maxDecimals:Math.max(x.maxDec,x.minDec),thousandsSeparator:x.grouping?void 0:!1};if(U.length>1&&(q.negative=I(U[0],U[1])),U.length>2){const R=K(U[2]);R.hasDigit||(q.zeroDisplay=R.prefix+R.suffix)}return q}}),_e("packages/core/src/format/number.js",function(e,F){"use strict";Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return U}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/internal/warn.js").warnOnce,Q=F("packages/core/src/format/pattern.js").parseNumberPattern;function U(x,q){const R=typeof x=="string"?{pattern:x}:x||{};let j=R;if(typeof R.pattern=="string"){const v=Q(R.pattern);if(v){const{pattern:P,...W}=R;j={...v,...W}}else I(`format:pattern:${R.pattern}`,`invalid number format pattern "${R.pattern}"; the value will use the default number format`)}const k=j.locale||q||void 0,b=j.style||"decimal",u=typeof j.scale=="number"?j.scale:1,g=j.nullDisplay??"",o=j.zeroDisplay,t=j.prefix||"",i=j.suffix||"",s=j.negative||"minus",r=j.signed===!0,n={style:b,notation:j.notation||"standard"};b==="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 m=new Intl.NumberFormat(k,n),l=typeof j.thousandsSeparator=="string"?j.thousandsSeparator:null,a=typeof j.decimalSeparator=="string"?j.decimalSeparator:null;let c=",",f=".";if(l||a)for(const v of m.formatToParts(12345.6))v.type==="group"?c=v.value:v.type==="decimal"&&(f=v.value);const p=v=>{let P=v;return l&&(P=P.split(c).join("")),a&&(P=P.split(f).join("")),l&&(P=P.split("").join(l)),a&&(P=P.split("").join(a)),P},y=!!(l||a),h=t!==""&&b==="currency",d=v=>{let P;if(h){const W=m.formatToParts(v);let V=!1;P="";for(const G of W)P+=G.value,!V&&G.type==="currency"&&(P+=t,V=!0);V||(P=t+P)}else P=t+m.format(v);return y&&(P=p(P)),P+i},w=v=>{if(E(v)||v==="")return g;const P=typeof v=="number"?v:Number(v);if(Number.isNaN(P))return g;const W=u===1?P:P*u;return W===0&&o!==void 0?o:W<0?s==="parentheses"?`(${d(-W)})`:s==="suffix"?`${d(-W)}-`:d(W):r&&W>0?`+${d(W)}`:d(W)};return w.negativeClass=j.negativeClass||null,w.spec=j,w}}),_e("packages/core/src/format/date.js",function(e,F){"use strict";Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return i}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/internal/warn.js").warnOnce,L=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function Q(s){const r=[];let n=0,m="";const l=()=>{m&&(r.push({token:null,text:m}),m="")};for(;n<s.length;){const a=s[n];if(a==="'"){if(s[n+1]==="'"){m+="'",n+=2;continue}const f=s.indexOf("'",n+1);if(f===-1){m+=s.slice(n+1),n=s.length;continue}m+=s.slice(n+1,f),n=f+1;continue}const c=L.find(f=>s.startsWith(f,n));if(c){l(),r.push({token:c,text:c}),n+=c.length;continue}/[A-Za-z]/.test(a)&&I(`date.pattern.token:${a}`,`the date pattern "${s}" contains '${a}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${L.join(" ")}.`),m+=a,n+=1}return l(),r}const U=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function x(s){if(E(s)||s==="")return null;if(s instanceof Date)return Number.isNaN(s.getTime())?null:s;if(typeof s=="number")return Number.isNaN(s)?null:new Date(s);if(typeof s=="string"){const r=U.exec(s.trim());if(r){const[,m,l,a,c="0",f="0",p="0"]=r;return new Date(+m,+l-1,+a,+c,+f,+p)}const n=new Date(s);return Number.isNaN(n.getTime())?null:n}return null}function q(s,r){return String(s).padStart(r,"0")}function R(s){if(!s)return m=>({year:m.getFullYear(),month:m.getMonth()+1,day:m.getDate(),hour:m.getHours(),minute:m.getMinutes(),second:m.getSeconds(),ms:m.getMilliseconds(),weekday:m.getDay()});const r=new Intl.DateTimeFormat("en-US",{timeZone:s,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,weekday:"short"}),n={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};return m=>{const l={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:m.getMilliseconds(),weekday:0};for(const a of r.formatToParts(m))switch(a.type){case"year":l.year=Number(a.value);break;case"month":l.month=Number(a.value);break;case"day":l.day=Number(a.value);break;case"hour":l.hour=Number(a.value)%24;break;case"minute":l.minute=Number(a.value);break;case"second":l.second=Number(a.value);break;case"weekday":l.weekday=n[a.value]??0;break;default:break}return l}}function j(s,r,n){const m=Q(s),l=R(n),a=new Set(m.filter(h=>h.token).map(h=>h.token)),c=a.has("MMM")?new Intl.DateTimeFormat(r,{month:"short",timeZone:n}):null,f=a.has("MMMM")?new Intl.DateTimeFormat(r,{month:"long",timeZone:n}):null,p=a.has("EEE")?new Intl.DateTimeFormat(r,{weekday:"short",timeZone:n}):null,y=a.has("EEEE")?new Intl.DateTimeFormat(r,{weekday:"long",timeZone:n}):null;return h=>{const d=l(h);let w="";for(const v of m){if(!v.token){w+=v.text;continue}switch(v.token){case"yyyy":w+=q(d.year,4);break;case"yy":w+=q(d.year%100,2);break;case"MMMM":w+=f.format(h);break;case"MMM":w+=c.format(h);break;case"MM":w+=q(d.month,2);break;case"M":w+=String(d.month);break;case"dd":w+=q(d.day,2);break;case"d":w+=String(d.day);break;case"EEEE":w+=y.format(h);break;case"EEE":w+=p.format(h);break;case"HH":w+=q(d.hour,2);break;case"H":w+=String(d.hour);break;case"hh":w+=q(d.hour%12===0?12:d.hour%12,2);break;case"h":w+=String(d.hour%12===0?12:d.hour%12);break;case"mm":w+=q(d.minute,2);break;case"m":w+=String(d.minute);break;case"ss":w+=q(d.second,2);break;case"s":w+=String(d.second);break;case"SSS":w+=q(d.ms,3);break;case"a":w+=d.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 b(s,r){const n=s||{},m=n.locale||r||void 0,l=n.nullDisplay??"",a=n.timeZone;let c;if(n.pattern)c=j(n.pattern,m,a);else if(n.dateStyle||n.timeStyle){const d={timeZone:a};n.dateStyle&&(d.dateStyle=n.dateStyle),n.timeStyle&&(d.timeStyle=n.timeStyle);const w=new Intl.DateTimeFormat(m,d);c=v=>w.format(v)}else{const d=new Intl.DateTimeFormat(m,{dateStyle:"medium",timeZone:a});c=w=>d.format(w)}const f=n.relative?new Intl.RelativeTimeFormat(m,{numeric:"auto"}):null,y=(typeof n.relative=="object"&&n.relative?n.relative.threshold??7:7)*24*36e5,h=(d,w)=>{const v=x(d);if(!v)return l;if(f){const P=w&&typeof w.now=="number"?w.now:Date.now(),W=v.getTime()-P;if(Math.abs(W)<y){for(const[V,G]of k)if(Math.abs(W)>=G||V==="second")return f.format(Math.round(W/G),V)}}return c(v)};return h.spec=n,h}function u(s){if(E(s)||s==="")return null;if(typeof s=="string"){const m=/^(\d{4}-\d{2}-\d{2})/.exec(s.trim());if(m)return m[1];const l=x(s);return l?u(l):null}const r=x(s);if(!r)return null;const n=m=>String(m).padStart(2,"0");return`${r.getFullYear()}-${n(r.getMonth()+1)}-${n(r.getDate())}`}function g(s,r){if(E(s)||s==="")return null;if(typeof s=="string"){const m=s.trim();if(o.test(m)){const c=x(m);return c?t(c,r):null}const l=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(m);if(l){const[,c,f,p,y]=l;return`${c}T${f}:${p}${y&&y!=="00"?`:${y}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(m))return`${m}T00:00`;const a=x(m);return a?g(a):null}const n=x(s);return n?t(n,r):null}const o=/(?:Z|[+-]\d{2}:?\d{2})$/i;function t(s,r){const n=c=>String(c).padStart(2,"0");if(r)try{const c=new Intl.DateTimeFormat("en-CA",{timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(s).reduce((y,h)=>(h.type!=="literal"&&(y[h.type]=h.value),y),{}),f=c.hour==="24"?"00":c.hour,p=Number(c.second);return`${c.year}-${c.month}-${c.day}T${f}:${c.minute}`+(p?`:${c.second}`:"")}catch{}const m=`${s.getFullYear()}-${n(s.getMonth()+1)}-${n(s.getDate())}`,l=s.getSeconds(),a=`${n(s.getHours())}:${n(s.getMinutes())}${l?`:${n(l)}`:""}`;return`${m}T${a}`}function i(s,r){const n=E(s)||s===""?null:String(s),m=E(r)||r===""?null:String(r);return n===null?m===null?0:1:m===null||n<m?-1:n>m?1:0}}),_e("packages/core/src/format/boolean.js",function(e,F){"use strict";Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return Q}});const E=F("packages/core/src/internal/predicates.js").isNil,K={true:"☑",false:"☐",null:""},I={true:"◉",false:"◯",null:""};function L(U){if(E(U)||U==="")return null;if(typeof U=="boolean")return U;if(typeof U=="number")return U!==0;const x=String(U).trim().toLowerCase();return x==="true"||x==="yes"||x==="y"||x==="1"?!0:x==="false"||x==="no"||x==="n"||x==="0"?!1:null}function Q(U,x){const q=U||{},R=q.display||"text",j=q.trueLabel??"Yes",k=q.falseLabel??"No",b=q.nullLabel??"";let u=j,g=k;const o=b;R==="checkbox"?(u=K.true,g=K.false):R==="switch"?(u=I.true,g=I.false):R==="icon"&&(u=q.trueIcon??j,g=q.falseIcon??k);const t=i=>{const s=L(i);return s===null?o:s?u:g};return t.display=R,t.labels={true:j,false:k,null:b},t.locale=x,t.spec=q,t}}),_e("packages/core/src/format/text.js",function(e,F){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return L}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/internal/text.js").titleCase;function L(Q,U){const x=Q||{},q=x.locale||U||void 0,R=x.nullDisplay??"",j=x.emptyDisplay??"",k=x.transform||"none",b=typeof x.truncate=="number"?{chars:x.truncate}:x.truncate||null,u=b?b.chars:0,g=b?b.ellipsis??"…":"",o=i=>{switch(k){case"upper":return q?i.toLocaleUpperCase(q):i.toUpperCase();case"lower":return q?i.toLocaleLowerCase(q):i.toLowerCase();case"title":return I(i);default:return i}},t=i=>{if(E(i))return R;let s=typeof i=="string"?i:String(i);return s===""?j:(k!=="none"&&(s=o(s)),u>0&&s.length>u&&(s=s.slice(0,u)+g),s)};return t.spec=x,t}}),_e("packages/core/src/format/shorthand.js",function(e,F){"use strict";Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return U}});const ie=["currency","number","percent","date","boolean","text","relative"],E=/[#0?@;"\\]/,K=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function I(x){return typeof x!="string"||x===""||Q(x)?!1:E.test(x)}function L(x){return typeof x!="string"||x===""||Q(x)?!1:K.test(x)}function Q(x){const q=x.indexOf(":"),R=q===-1?x:x.slice(0,q);return ie.includes(R)?R:null}function U(x){const q=Q(x);if(!q)return null;const R=x.indexOf(":"),j=R===-1?"":x.slice(R+1),k=j===""?[]:j.split(":");switch(q){case"currency":{const b={type:"number",style:"currency",currency:k[0]||"USD"};return k[1]!==void 0&&k[1]!==""&&(b.decimals=Number(k[1])),b}case"number":{const b={type:"number",style:"decimal"};return k[0]!==void 0&&k[0]!==""&&(b.decimals=Number(k[0])),b}case"percent":{const b={type:"number",style:"percent"};return k[0]!==void 0&&k[0]!==""&&(b.decimals=Number(k[0])),b}case"date":return{type:"date",pattern:j||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const b=j.split("/"),u={type:"boolean",display:"text"};return b[0]!==void 0&&b[0]!==""&&(u.trueLabel=b[0]),b[1]!==void 0&&b[1]!==""&&(u.falseLabel=b[1]),b[2]!==void 0&&(u.nullLabel=b[2]),u}case"text":{const b={type:"text"};return k[0]&&(b.transform=k[0]),k[1]!==void 0&&k[1]!==""&&(b.truncate=Number(k[1])),b}default:return null}}}),_e("packages/core/src/format/index.js",function(e,F){"use strict";Object.defineProperty(e,"compileFormat",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"specToOoxml",{enumerable:!0,get:function(){return P}});const ie=F("packages/core/src/internal/predicates.js"),E=ie.isFunction,K=ie.isObject,L=F("packages/core/src/internal/warn.js").warnOnce,Q=F("packages/core/src/format/number.js"),U=Q.compileNumber,x=F("packages/core/src/format/date.js"),q=x.compileDate,R=x.scanPattern,j=F("packages/core/src/format/boolean.js"),k=j.compileBoolean,b=F("packages/core/src/format/text.js"),u=b.compileText,g=F("packages/core/src/format/mask.js"),o=g.compileMask,t=F("packages/core/src/format/shorthand.js"),i=t.parseShorthand,s=t.looksLikeMask,r=t.looksLikeDatePattern,m=F("packages/core/src/format/pattern.js").parseNumberPattern;Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return Q.compileNumber}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return x.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return x.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return x.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return x.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 b.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 l=new Set(["decimal","currency","percent","unit"]),a=new Set(["type","locale"]),c={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"])},f=new Set(["number","date","boolean","text"]);function p(_,T){const S=_.type;if(S===void 0||f.has(S)||!l.has(String(S)))return;const O=T?`"${T}"`:"with no id";L(`format:unknown-style-key:${T||""}:${S}`,`column ${O} has format: { type: "${S}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${S}" instead?`)}function y(_,T,S){const O=c[T],M=S?`"${S}"`:"with no id";for(const A of _){if(a.has(A)||O.has(A))continue;const N=Object.keys(c).find($=>$!==T&&c[$].has(A));N?L(`format:inapplicable:${S||""}:${A}`,`column ${M} has format key "${A}", which applies to a ${N} column, not the ${T} column it was applied to; it is ignored.`):L(`format:unknown:${S||""}:${A}`,`column ${M} has an unrecognised format key "${A}" for its ${T} format; it is ignored.`)}}function h(_){if(_.type==="number"||_.type==="date"||_.type==="boolean"||_.type==="text")return!0;const T=l.has(String(_.style));return!!(_.pattern||_.dateStyle||_.timeStyle||_.relative||_.timeZone||_.trueLabel||_.falseLabel||_.display||_.trueIcon||_.falseIcon||_.transform||_.truncate||_.emptyDisplay||T||_.currency||_.decimals!==void 0||_.minDecimals!==void 0||_.maxDecimals!==void 0||_.notation||_.negative||_.scale!==void 0||_.prefix||_.suffix||_.zeroDisplay!==void 0)}function d(_,T){if(_.type==="number"||_.type==="date"||_.type==="boolean"||_.type==="text")return _.type;if(_.pattern){if(s(_.pattern))return"number";if(r(_.pattern))return"date"}if(_.dateStyle||_.timeStyle||_.relative||_.timeZone)return"date";if(_.trueLabel||_.falseLabel||_.display||_.trueIcon||_.falseIcon)return"boolean";if(_.transform||_.truncate||_.emptyDisplay)return"text";if(_.style||_.currency||_.decimals!==void 0||_.minDecimals!==void 0||_.maxDecimals!==void 0||_.notation||_.negative||_.scale!==void 0||_.prefix||_.suffix||_.zeroDisplay!==void 0)return"number";const S=T&&T.base;return S==="number"?"number":S==="date"||S==="dateString"?"date":S==="boolean"?"boolean":"text"}function w(_,T=null,S=void 0,O=void 0,M=void 0){if(_==null||_==="")return null;const A=K(_)?Object.keys(_):null;if(typeof _=="function"){const H=(Y,Z)=>String(_({...Z||{},value:Y,locale:S})??"");return H.ooxml=T&&T.excel||"General",H}if(typeof _=="string"){if(s(_)){const{format:Y,ooxml:Z}=o(_,S);return Y.ooxml=Z,Y}const H=i(_)||(r(_)?{type:"date",pattern:_}:null);return H?w(H,T,S,O,M):(L(`format:${_}`,`unrecognised format string "${_}"; the value will be stringified`),null)}if(!K(_))return L("format:shape","format must be a spec object or a string; ignoring",_),null;if(T&&E(T.format)&&!h(_)||T&&E(T.format)&&Array.isArray(T.formatPatterns)&&_.type===void 0)return null;const N=d(_,T);N==="date"&&O&&_.timeZone===void 0&&(_={..._,timeZone:O}),p(_,M),y(A||Object.keys(_),N,M);let $;switch(N){case"number":$=U(_,S);break;case"date":$=q(_,S);break;case"boolean":$=k(_,S);break;default:$=u(_,S);break}return $.ooxml=P(_,N,S,T),$.kind=N,$}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 P(_,T,S=void 0,O=null){if(T==="date"){if(_.pattern){let H="";for(const Y of R(_.pattern))H+=Y.token?v[Y.token]??Y.text:Y.text;return H}return O&&O.excel||"yyyy-mm-dd"}if(T==="boolean")return"General";if(T==="text")return"@";if(typeof _.pattern=="string"&&m(_.pattern))return String(_.pattern).trim();if(_.notation==="compact"||_.notation==="scientific")return"General";const M=typeof _.decimals=="number"?_.decimals:typeof _.minDecimals=="number"?_.minDecimals:_.style==="currency"?2:0;let N=`${_.thousandsSeparator===!1?"":"#,#"}#0${M>0?`.${"0".repeat(M)}`:""}`,$="";return _.style==="currency"&&($+=W(G(_.currency||"USD",S))),_.prefix&&($+=W(_.prefix)),N=$+N,_.style==="percent"&&(N=`${N}%`),_.suffix&&(N+=W(_.suffix)),_.negative==="parentheses"?`${N};(${N})`:_.negative==="suffix"?`${N};${N}-`:N}function W(_){return`"${String(_).split('"').join("")}"`}const V=new Map;function G(_,T){const S=`${_}|${T||""}`;let O=V.get(S);if(O!==void 0)return O;O=_;try{const A=new Intl.NumberFormat(T,{style:"currency",currency:_}).formatToParts(0).find(N=>N.type==="currency");A&&(O=A.value)}catch{}return V.set(S,O),O}}),_e("packages/core/src/columns/types/temporal.js",function(e,F){"use strict";Object.defineProperty(e,"MS_SECOND",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"MS_MINUTE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"MS_HOUR",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"MS_DAY",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"MS_WEEK",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"toTimeMs",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"zonedParts",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"zoneOffsetAt",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"instantFromParts",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"toEpochMs",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"toDurationMs",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(e,"resolveZoneName",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"zoneLabel",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"formatInstant",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"timestampGroupProjector",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"TEMPORAL_INFERENCE_ORDER",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Le}});const ie=F("packages/core/src/internal/predicates.js"),E=ie.isNil,K=ie.isFunction,I=F("packages/core/src/format/date.js"),L=I.toDate,Q=I.compilePattern,U=I.compileDate,x=I.toIsoDateTime,q=I.compareIso,R=864e5,j=Object.freeze({}),k=1e3,b=60*k,u=60*b,g=24*u,o=7*g,t=new WeakMap;function i(we,He){const Te=we&&we.locale||"",Ae=we&&we.column;if(!Ae)return Te?{locale:Te}:j;const Se=t.get(Ae);if(Se&&Se.locale===Te)return Se.bag;const Ee=Ae.typeOptions||Ae[He]||(s(Ae.format)?Ae.format:null),Me={...Ee||j,locale:Ee&&Ee.locale||Te||void 0};return t.set(Ae,{locale:Te,bag:Me}),Me}function s(we){return we!==null&&typeof we=="object"&&!Array.isArray(we)&&!(we instanceof Date)}function r(we,He){const Te=we===null||Number.isNaN(we)?null:we,Ae=He===null||Number.isNaN(He)?null:He;return Te===null?Ae===null?0:1:Ae===null||Te<Ae?-1:Te>Ae?1:0}const n=/^(\d{1,2})(?:\s*[:.h]\s*(\d{1,2})(?:\s*[:.]\s*(\d{1,2})(?:[.,](\d{1,3}))?)?)?\s*(a\.?m\.?|p\.?m\.?|a|p)?$/i,m=/^(\d{3,6})$/;function l(we,He,Te,Ae){return!(we>=0&&we<=23)||!(He>=0&&He<=59)||!(Te>=0&&Te<=59)||!(Ae>=0&&Ae<=999)?null:we*u+He*b+Te*k+Ae}function a(we){if(E(we))return null;const He=String(we).trim();if(He==="")return null;const Te=m.exec(He);if(Te){const et=Te[1];if(et.length===5)return null;const Je=et.length===3?1:2;return l(Number(et.slice(0,Je)),Number(et.slice(Je,Je+2)),Number(et.slice(Je+2,Je+4)||0),0)}const Ae=n.exec(He);if(!Ae)return null;let Se=Number(Ae[1]);const Ee=Number(Ae[2]||0),Me=Number(Ae[3]||0),Be=Ae[4]?Number(Ae[4].padEnd(3,"0")):0,Ke=Ae[5]?Ae[5][0].toLowerCase():null;if(Ke){if(Se<1||Se>12)return null;Se=Se%12,Ke==="p"&&(Se+=12)}return l(Se,Ee,Me,Be)}function c(we){return E(we)||we===""?null:typeof we=="number"?Number.isFinite(we)?(we%g+g)%g:null:we instanceof Date?Number.isNaN(we.getTime())?null:we.getHours()*u+we.getMinutes()*b+we.getSeconds()*k+we.getMilliseconds():a(we)}const f=new Map;function p(we){const He=we.pattern||"",Te=we.timeStyle||(we.seconds?"medium":"short"),Ae=`${we.locale||""}|${He}|${Te}`;let Se=f.get(Ae);if(Se)return Se;if(He)Se=Q(He,we.locale||void 0,"UTC");else{const Ee=new Intl.DateTimeFormat(we.locale||void 0,{timeStyle:Te,timeZone:"UTC"});Se=Me=>Ee.format(Me)}return f.set(Ae,Se),Se}function y(we,He){const Te=He||j;if(we==null||typeof we!="number"||!Number.isFinite(we))return Te.nullDisplay??"";const Ae=(we%g+g)%g;return p(Te)(new Date(Ae))}function h(we){return we instanceof Date?!Number.isNaN(we.getTime()):typeof we=="number"?Number.isFinite(we)&&we>=0&&we<g:typeof we!="string"||!we.includes(":")?!1:a(we)!==null}function d(we){const He=c(we);return He==null?"":y(He,{pattern:He%k===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const w=new Map;function v(we){const He=we||"";let Te=w.get(He);return Te||(Te=new Intl.DateTimeFormat("en-GB",{timeZone:we||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),w.set(He,Te)),Te}function P(we,He){const Te={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const Ae of v(He).formatToParts(new Date(we)))Ae.type==="year"?Te.year=Number(Ae.value):Ae.type==="month"?Te.month=Number(Ae.value):Ae.type==="day"?Te.day=Number(Ae.value):Ae.type==="hour"?Te.hour=Number(Ae.value)%24:Ae.type==="minute"?Te.minute=Number(Ae.value):Ae.type==="second"&&(Te.second=Number(Ae.value));return Te}function W(we,He){const Te=P(we,He);return Date.UTC(Te.year,Te.month-1,Te.day,Te.hour,Te.minute,Te.second,0)-Math.floor(we/1e3)*1e3}function V(we,He){const Te=we.hour||0,Ae=we.minute||0,Se=we.second||0,Ee=we.ms||0;if(!He)return new Date(we.year,we.month-1,we.day,Te,Ae,Se,Ee).getTime();const Me=Date.UTC(we.year,we.month-1,we.day,Te,Ae,Se,Ee);let Be=Me-W(Me,He);return Be=Me-W(Be,He),Be}const G=/(?:Z|[+-]\d{2}:?\d{2})$/i,_=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function T(we,He){if(E(we))return null;const Te=String(we).trim();if(Te==="")return null;const Ae=He&&He.timeZone||void 0;if(!G.test(Te)){const Se=_.exec(Te);if(Se){const Ee=(Se[4]||"").trim(),Me=Ee===""?0:a(Ee);if(Me===null)return null;const Be=V({year:Number(Se[1]),month:Number(Se[2]),day:Number(Se[3]),hour:Math.floor(Me/u),minute:Math.floor(Me/b)%60,second:Math.floor(Me/k)%60,ms:Me%k},Ae);return Number.isNaN(Be)?null:new Date(Be)}}return L(Te)}function S(we){if(typeof we=="number")return Number.isFinite(we)?we:null;const He=L(we);return He?He.getTime():null}const O=new Map;function M(we){const He=[we.locale||"",we.pattern||"",we.dateStyle||"",we.timeStyle||"",we.timeZone||"",we.seconds?"1":""].join("|");let Te=O.get(He);if(Te)return Te;const Ae=we.pattern?{type:"date",pattern:we.pattern,timeZone:we.timeZone}:{type:"date",dateStyle:we.dateStyle||"medium",timeStyle:we.timeStyle||(we.seconds?"medium":"short"),timeZone:we.timeZone};return Te=U(Ae,we.locale||void 0),O.set(He,Te),Te}function A(we,He){const Te=He||j,Ae=S(we);return Ae==null?Te.nullDisplay??"":M(Te)(Ae)}function N(we){return we instanceof Date?!Number.isNaN(we.getTime()):typeof we!="string"||!_.test(we.trim())?!1:T(we)!==null}const $=Object.freeze([{key:"w",ms:o,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:u,intl:"hour",long:["hour","hours"],names:["h","hr","hrs","hour","hours"]},{key:"m",ms:b,intl:"minute",long:["minute","minutes"],names:["m","min","mins","minute","minutes"]},{key:"s",ms: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"]}]),H=new Map;for(const we of $)for(const He of we.names)H.set(He,we);const Y=Object.freeze($.filter(we=>we.key!=="w")),Z=/^(\d+(?:\.\d+)?)\s*([a-z]+)\s*(?:,\s*)?/,J=/^\d+(?:\.\d+)?$/,D=/^(\d+):([0-5]?\d)(?::([0-5]?\d))?(?:\.(\d{1,3}))?$/;function te(we){const He=we&&we.defaultUnit?H.get(String(we.defaultUnit).toLowerCase()):null;return He?He.ms:b}function z(we){return(we&&we.defaultUnit?H.get(String(we.defaultUnit).toLowerCase()):null)||H.get("m")}function X(we,He){if(E(we))return null;let Te=String(we).trim().toLowerCase();if(Te==="")return null;let Ae=1;if(Te[0]==="-"?(Ae=-1,Te=Te.slice(1).trim()):Te[0]==="+"&&(Te=Te.slice(1).trim()),Te==="")return null;const Se=D.exec(Te);if(Se){const Ke=Se[3]!==void 0,et=Number(Se[1])*u+Number(Se[2])*b+(Ke?Number(Se[3])*k:0)+(Se[4]?Number(Se[4].padEnd(3,"0")):0);return Ae*et}if(J.test(Te))return Math.round(Ae*Number(Te)*te(He||j));let Ee=Te,Me=0,Be=0;for(;Ee!=="";){const Ke=Z.exec(Ee);if(!Ke)return null;const et=H.get(Ke[2]);if(!et)return null;Me+=Number(Ke[1])*et.ms,Ee=Ee.slice(Ke[0].length),Be++}return Be===0?null:Math.round(Ae*Me)}function ne(we){return E(we)||we===""?null:typeof we=="number"?Number.isFinite(we)?we:null:X(we)}const se=new Map;function ue(we,He,Te){const Ae=`${Te||""}|${He.intl}`;let Se=se.get(Ae);if(Se===void 0){try{Se=new Intl.NumberFormat(Te||void 0,{style:"unit",unit:He.intl,unitDisplay:"long"})}catch{Se=null}se.set(Ae,Se)}return Se?Se.format(we):`${we} ${we===1?He.long[0]:He.long[1]}`}function ge(we,He){return String(we).padStart(He,"0")}function Oe(we,He){const Te=He||j;if(we==null||typeof we!="number"||!Number.isFinite(we))return Te.nullDisplay??"";const Ae=Te.style||"short",Se=we<0;let Ee=Math.round(Math.abs(we));const Me=Se?"-":"";if(Ee===0&&Te.zeroDisplay!=null)return Te.zeroDisplay;if(Ae==="clock"){const Je=Math.floor(Ee/u),ut=Math.floor(Ee/b)%60,Ct=Math.floor(Ee/k)%60;return`${Me}${ge(Je,2)}:${ge(ut,2)}:${ge(Ct,2)}`}if(Ee===0){const Je=z(Te);return Ae==="long"?ue(0,Je,Te.locale):`0${Je.key}`}const Be=Te.weeks===!0?$:Y,Ke=typeof Te.maxUnits=="number"&&Te.maxUnits>0?Te.maxUnits:Te.maxUnits===void 0?2:1/0,et=[];for(const Je of Be){if(et.length>=Ke)break;const ut=Math.floor(Ee/Je.ms);ut!==0&&(Ee-=ut*Je.ms,et.push(Ae==="long"?ue(ut,Je,Te.locale):`${ut}${Je.key}`))}return Me+et.join(" ")}function Pe(we){if(typeof we!="string")return!1;const He=we.trim();return He===""||D.test(He)||!/[a-z]/i.test(He)?!1:X(He)!==null}const Ie=Date.UTC(1899,11,30),xe=new Map;function ye(we,He){const Te=we||"";let Ae=xe.get(Te);Ae||(Ae=new Intl.DateTimeFormat("en-GB",{timeZone:we||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),xe.set(Te,Ae));const Se=typeof He=="number"?He:Date.now();for(const Ee of Ae.formatToParts(new Date(Se)))if(Ee.type==="timeZoneName")return Ee.value;return""}function re(we){if(we)return we;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function fe(we,He){const Te=re(we),Ae=ye(we,He);return Ae?`${Te} (${Ae})`:Te}function oe(we,He){if(we&&we.timeZone)return we.timeZone;const Te=He&&He.grid;return(Te&&K(Te.get)?Te.get("timeZone"):void 0)||void 0}function ce(we,He){const Te=He||j,Ae=S(we);if(Ae==null)return Te.nullDisplay??"";const Se=M(Te)(Ae);if(!Te.showOrigin)return Se;const Ee=Te.originZone;return Ee?Ee===(Te.timeZone||re(Te.timeZone))?Se:`${Se} (${fe(Ee,Ae)})`:`${Se} (no origin recorded)`}function de(we,He,Te,Ae){if(He==="instant"||!He)return we;const Se=P(we,Te);if(He==="month")return V({year:Se.year,month:Se.month,day:1},Te);if(He==="week"){const Ee=Ae>=1&&Ae<=7?Ae:1,Be=((new Date(Date.UTC(Se.year,Se.month-1,Se.day)).getUTCDay()+6)%7+1-Ee+7)%7,Ke=new Date(Date.UTC(Se.year,Se.month-1,Se.day-Be));return V({year:Ke.getUTCFullYear(),month:Ke.getUTCMonth()+1,day:Ke.getUTCDate()},Te)}return V({year:Se.year,month:Se.month,day:Se.day},Te)}function ve(we,He){const Te=we&&we.group,Ae=Te&&Te.granularity||"day";if(Ae==="instant")return null;const Se=Te&&Te.weekStart;return Ee=>typeof Ee=="number"?de(Ee,Ae,He,Se):Ee}const ke={time:{base:"number",storage:"float64",matches:h,format:we=>y(c(we.value),i(we,"time")),parse:we=>a(we.text),compare:(we,He)=>r(c(we),c(He)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:we=>{const He=c(we);return He===null?null:He/R},toStorage:we=>c(we),toClipboard:d,fromClipboard:a},datetime:{base:"dateString",storage:"dictionary",matches:N,format:we=>A(we.value,i(we,"datetime")),parse:we=>x(T(we.text,i(we,"datetime"))??we.text),compare:q,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(we,He)=>x(we,He&&He.timeZone),toClipboard:we=>E(we)?"":String(we),fromClipboard:we=>x(we)},duration:{base:"number",storage:"float64",matches:Pe,format:we=>Oe(ne(we.value),i(we,"duration")),parse:we=>X(we.text,i(we,"duration")),compare:(we,He)=>r(ne(we),ne(He)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:we=>{const He=ne(we);return He===null?null:He/R},toStorage:we=>ne(we),toClipboard:we=>Oe(ne(we),{style:"short",maxUnits:-1}),fromClipboard:we=>X(we)},timestamp:{base:"number",storage:"float64",format:we=>{const He=i(we,"timestamp");return ce(we.value,{...He,timeZone:oe(He,we)})},parse:we=>{const He=i(we,"timestamp"),Te=T(we.text,{timeZone:oe(He,we)});return Te?Te.getTime():null},compare:(we,He)=>r(S(we),S(He)),groupProjector:(we,He)=>ve(we,He),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(we,He)=>{const Te=S(we);if(Te==null)return null;const Ae=P(Te,He&&He.timeZone||void 0);return(Date.UTC(Ae.year,Ae.month-1,Ae.day,Ae.hour,Ae.minute,Ae.second)-Ie)/R},toStorage:we=>S(we),toClipboard:we=>{const He=S(we);return He==null?"":new Date(He).toISOString()},fromClipboard:we=>S(we)}},Ce=["datetime","time","duration"],Le=ke}),_e("packages/core/src/internal/lru.js",function(e,F){"use strict";Object.defineProperty(e,"Lru",{enumerable:!0,get:function(){return ie}});class ie{#e;#t=new Map;#n;constructor(K=256,I=null){this.#e=K,this.#n=I}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 I=this.#t;if(!I.has(K))return;const L=I.get(K);return I.delete(K),I.set(K,L),L}peek(K){return this.#t.get(K)}set(K,I){const L=this.#t;return L.has(K)&&L.delete(K),L.set(K,I),this.#r(),I}delete(K){const I=this.#t.get(K);return this.#t.delete(K)&&this.#n&&this.#n(I,K),I}clear(){if(this.#n)for(const[K,I]of this.#t)this.#n(I,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 I=K.keys().next().value,L=K.get(I);K.delete(I),this.#n&&this.#n(L,I)}}}}),_e("packages/core/src/columns/types/network.js",function(e,F){"use strict";Object.defineProperty(e,"toUint32",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return R}}),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 o}}),Object.defineProperty(e,"cidrNetworkOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"storeNumberOf",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isCidr",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"compareCidr",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"netmask",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"addressCount",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"ipv6Groups",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"macValue",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"parseMac",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"formatMac",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"macHex",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"macContains",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"compareMac",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"MAC_OPERATORS",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return fe}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/internal/lru.js").Lru,L=4294967295,Q=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function U(oe){if(E(oe))return null;if(typeof oe=="string")return x(oe);const ce=Number(oe);return Number.isFinite(ce)?ce<0?ce<-2147483648?null:ce>>>0:ce>L?null:Math.trunc(ce)>>>0:null}function x(oe){if(E(oe))return null;const ce=String(oe).trim();if(ce==="")return null;const de=Q.exec(ce);if(!de)return null;let ve=0;for(let ke=1;ke<=4;ke++){const Ce=de[ke];if(Ce.length>1&&Ce.charCodeAt(0)===48)return null;const Le=Number(Ce);if(Le>255)return null;ve=ve*256+Le}return ve}function q(oe){const ce=U(oe);return ce===null?"":`${ce>>>24&255}.${ce>>>16&255}.${ce>>>8&255}.${ce&255}`}function R(oe){return typeof oe=="string"&&x(oe)!==null}function j(oe,ce){const de=U(oe),ve=U(ce);return de===null?ve===null?0:1:ve===null||de<ve?-1:de>ve?1:0}const k=64,b=L*k+32,u=/^(?:0|[1-9]\d?)$/;function g(oe,ce){return oe*k+ce}function o(oe){if(E(oe))return null;if(typeof oe=="string"){const ve=r(oe);return ve===null?null:o(ve)}if(typeof oe=="object"){const ve=U(oe.address),ke=Number(oe.prefix);return ve===null||!Number.isInteger(ke)||ke<0||ke>32?null:{address:ve,prefix:ke}}const ce=Number(oe);if(!Number.isInteger(ce)||ce<0||ce>b)return null;const de=ce%k;return de>32?null:{address:(ce-de)/k,prefix:de}}function t(oe){return!!(oe&&oe.typeOptions&&oe.typeOptions.cidrNetwork)}function i(oe){return!!(oe&&oe.typeOptions&&oe.typeOptions.storeNumber)}function s(oe,ce,de){return oe==null?null:i(ce)?oe:de(oe)}function r(oe,ce){if(E(oe))return null;const de=String(oe).trim();if(de==="")return null;const ve=de.indexOf("/");if(ve<0)return null;const ke=x(de.slice(0,ve));if(ke===null)return null;const Ce=de.slice(ve+1).trim();if(!u.test(Ce))return null;const Le=Number(Ce);if(Le>32)return null;const we=ce&&ce.network?(ke&a(Le))>>>0:ke;return g(we,Le)}function n(oe){const ce=o(oe);return ce?`${q(ce.address)}/${ce.prefix}`:""}function m(oe){return typeof oe=="string"&&r(oe)!==null}function l(oe,ce){const de=o(oe),ve=o(ce);return de?ve?de.address!==ve.address?de.address<ve.address?-1:1:de.prefix-ve.prefix:-1:ve?1:0}function a(oe){return oe===0?0:4294967295<<32-oe>>>0}function c(oe){const ce=o(oe);return ce?(ce.address&a(ce.prefix))>>>0:null}function f(oe){const ce=o(oe);return ce?(ce.address&a(ce.prefix)|~a(ce.prefix)>>>0)>>>0:null}function p(oe){const ce=o(oe);return ce?2**(32-ce.prefix):null}function y(oe){const ce=o(oe);return ce?ce.prefix===32?1:ce.prefix===31?2:2**(32-ce.prefix)-2:null}function h(oe,ce){const de=o(oe);if(!de)return!1;const ve=U(ce);if(ve===null)return!1;const ke=a(de.prefix);return(ve&ke)>>>0===(de.address&ke)>>>0}function d(oe,ce){const de=c(oe),ve=c(ce);return de===null||ve===null?!1:de<=f(ce)&&ve<=f(oe)}const w=/^[0-9a-fA-F]{1,4}$/,v=new I(512);function P(oe){if(E(oe))return null;let ce=String(oe).trim();if(ce==="")return null;const de=ce.indexOf("%");if(de>=0&&(ce=ce.slice(0,de)),ce==="")return null;if(ce.indexOf(".")>=0){const He=ce.lastIndexOf(":");if(He<0)return null;const Te=x(ce.slice(He+1));if(Te===null)return null;ce=`${ce.slice(0,He+1)}${(Te>>>16&65535).toString(16)}:${(Te&65535).toString(16)}`}const ve=ce.split("::");if(ve.length>2)return null;const ke=W(ve[0]);if(ke===null)return null;if(ve.length===1)return ke.length===8?ke:null;const Ce=W(ve[1]);if(Ce===null)return null;const Le=8-ke.length-Ce.length;if(Le<1)return null;const we=ke.slice();for(let He=0;He<Le;He++)we.push(0);for(const He of Ce)we.push(He);return we}function W(oe){if(oe==="")return[];const ce=[];for(const de of oe.split(":")){if(!w.test(de))return null;ce.push(parseInt(de,16))}return ce}function V(oe){if(typeof oe!="string")return P(oe);if(v.has(oe))return v.get(oe);const ce=P(oe);return v.set(oe,ce),ce}function G(oe){if(oe[0]===0&&oe[1]===0&&oe[2]===0&&oe[3]===0&&oe[4]===0&&oe[5]===65535)return`::ffff:${q((oe[6]<<16|oe[7])>>>0)}`;let ce=-1,de=0,ve=-1,ke=0;for(let we=0;we<8;we++)oe[we]===0?(ve<0?(ve=we,ke=1):ke++,ke>de&&(de=ke,ce=ve)):(ve=-1,ke=0);if(de<2)return oe.map(we=>we.toString(16)).join(":");const Ce=oe.slice(0,ce).map(we=>we.toString(16)).join(":"),Le=oe.slice(ce+de).map(we=>we.toString(16)).join(":");return`${Ce}::${Le}`}function _(oe){const ce=P(oe);return ce===null?null:G(ce)}function T(oe){return _(oe)??""}function S(oe){return typeof oe=="string"&&oe.indexOf(":")>=0&&P(oe)!==null}function O(oe,ce){const de=V(oe),ve=V(ce);if(!de)return ve?1:0;if(!ve)return-1;for(let ke=0;ke<8;ke++)if(de[ke]!==ve[ke])return de[ke]<ve[ke]?-1:1;return 0}const M=/^[0-9a-fA-F]{12}$/,A=/^[0-9a-fA-F]{4}\.[0-9a-fA-F]{4}\.[0-9a-fA-F]{4}$/,N=/^[0-9a-fA-F]{2}$/;function $(oe){const ce=[];for(let de=0;de<12;de+=2)ce.push(parseInt(oe.slice(de,de+2),16));return ce}function H(oe){if(E(oe))return null;if(typeof oe=="number"){if(!Number.isInteger(oe)||oe<0||oe>0xffffffffffff)return null;const ke=[];for(let Ce=5;Ce>=0;Ce--)ke.push(Math.floor(oe/256**Ce)%256);return ke}const ce=String(oe).trim();if(ce==="")return null;if(M.test(ce))return $(ce);if(ce.indexOf(".")>=0)return A.test(ce)?$(ce.split(".").join("")):null;const de=ce.indexOf(":")>=0?":":ce.indexOf("-")>=0?"-":null;if(de===null)return null;const ve=ce.split(de);if(ve.length!==6)return null;for(const ke of ve)if(!N.test(ke))return null;return ve.map(ke=>parseInt(ke,16))}function Y(oe){const ce=H(oe);if(!ce)return null;let de=0;for(const ve of ce)de=de*256+ve;return de}function Z(oe){const ce=H(oe);return ce?ce.map(de=>de.toString(16).padStart(2,"0")).join(":"):null}function J(oe,ce="colon"){const de=H(oe);if(!de)return"";const ve=de.map(ke=>ke.toString(16).padStart(2,"0"));switch(ce){case"hyphen":return ve.join("-");case"colon-upper":return ve.map(ke=>ke.toUpperCase()).join(":");case"cisco":return`${ve[0]}${ve[1]}.${ve[2]}${ve[3]}.${ve[4]}${ve[5]}`;default:return ve.join(":")}}function D(oe){return typeof oe=="string"&&H(oe)!==null}function te(oe){if(E(oe))return null;const ce=String(oe).trim();if(ce==="")return null;const de=ce.replace(/[:-]/g,"").replace(/\./g,"").toLowerCase();return/^[0-9a-f]+$/.test(de)?de:null}function z(oe,ce){const de=te(oe),ve=te(ce);return!!(de&&ve&&de.includes(ve))}function X(oe,ce){const de=Y(oe),ve=Y(ce);return de===null?ve===null?0:1:ve===null||de<ve?-1:de>ve?1:0}const ne=Object.freeze(["macEquals","macInRange","macContains"]),se=Object.freeze(["eq","ne","contains","notContains","startsWith","endsWith"]);function ue(oe){switch(oe){case"macEquals":return{compile:ce=>{const de=Y(ce);return de===null?()=>!1:ve=>Y(ve)===de},check:ce=>Y(ce)===null?"the operand is not a MAC address":null};case"macInRange":return{compile:ce=>{const de=Array.isArray(ce)?ce:[ce,ce],ve=Y(de[0]),ke=Y(de[1]);return ve===null||ke===null||ve>ke?()=>!1:Ce=>{const Le=Y(Ce);return Le!==null&&Le>=ve&&Le<=ke}},check:ce=>{const de=Array.isArray(ce)?ce:[];if(de.length!==2)return"the operand must be two MAC addresses, the low and high ends of the range";const ve=Y(de[0]),ke=Y(de[1]);return ve===null||ke===null?"an end of the range is not a MAC address":ve>ke?"the low end of the range is above the high end":null}};case"macContains":return{compile:ce=>de=>z(de,ce),check:ce=>te(ce)===null?"the operand is not hex":null};default:return{compile:()=>()=>!1,check:()=>"unknown MAC operator"}}}function ge(oe){switch(oe){case"eq":return{compile:ce=>{const de=Y(ce);return de===null?()=>!1:ve=>Y(ve)===de},check:ce=>Y(ce)===null?"the operand is not a MAC address":null};case"ne":return{compile:ce=>{const de=Y(ce);return de===null?()=>!1:ve=>Y(ve)!==de},check:ce=>Y(ce)===null?"the operand is not a MAC address":null};case"contains":return{compile:ce=>de=>z(de,ce),check:ce=>te(ce)===null?"the operand is not hex":null};case"notContains":return{compile:ce=>de=>!z(de,ce),check:ce=>te(ce)===null?"the operand is not hex":null};case"startsWith":return{compile:ce=>{const de=String(ce??"").toLowerCase();return ve=>ve==null?!1:String(ve).toLowerCase().startsWith(de)}};case"endsWith":return{compile:ce=>{const de=String(ce??"").toLowerCase();return ve=>ve==null?!1:String(ve).toLowerCase().endsWith(de)}};default:return{compile:()=>()=>!1,check:()=>"unknown MAC text operator"}}}const Oe=Object.freeze(["lt","lte","gt","gte","between","notBetween","in","notIn","matches"]);function Pe(oe){const ce=o(oe);return ce===null?null:g(ce.address,ce.prefix)}function Ie(oe,ce,de){const ve=we=>String(we??"").trim().toLowerCase(),ke=we=>{if(we==null)return null;const He=ce(we);return He===""?null:He.toLowerCase()},Ce=we=>oe(we)===null?`the operand is not ${de}`:null,Le=(we,He)=>({compile:Te=>{const Ae=ve(Te);return Se=>{const Ee=ke(Se);return Ee===null?He:He?!we(Ee,Ae):we(Ee,Ae)}}});return Object.freeze({eq:{compile:we=>{const He=oe(we);return He===null?()=>!1:Te=>oe(Te)===He},check:Ce},ne:{compile:we=>{const He=oe(we);return He===null?()=>!0:Te=>oe(Te)!==He},check:Ce},contains:Le((we,He)=>we.includes(He),!1),notContains:Le((we,He)=>we.includes(He),!0),startsWith:Le((we,He)=>we.startsWith(He),!1),endsWith:Le((we,He)=>we.endsWith(He),!1),...Object.fromEntries(Oe.map(we=>[we,Object.freeze({})]))})}const xe=Object.freeze({ipv4:"Enter an IPv4 address, for example 10.0.0.1",cidr:"Enter a network in CIDR form, for example 10.0.0.0/24",ipv6:"Enter an IPv6 address, for example 2001:db8::1",mac:"Enter a MAC address, for example 00:1a:2b:3c:4d:5e"}),ye=(oe,ce)=>de=>{const ve=de&&typeof de.text=="string"?de.text:"";return ve.trim()!==""&&oe(ve)===null?ce:null},re=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:R,parse:oe=>x(oe.text),parseError:ye(x,xe.ipv4),compare:j,format:oe=>q(oe.value),operators:Ie(U,q,"an IPv4 address"),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:oe=>U(oe),toRow:(oe,ce)=>s(oe,ce,q),toClipboard:oe=>q(oe),fromClipboard:oe=>x(oe)},cidr:{base:"number",storage:"float64",matches:m,parse:oe=>r(oe.text,{network:t(oe.column)}),parseError:ye(r,xe.cidr),compare:l,format:oe=>n(oe.value),operators:Ie(Pe,n,"a network in CIDR form"),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:oe=>{const ce=o(oe);return ce===null?null:g(ce.address,ce.prefix)},toRow:(oe,ce)=>s(oe,ce,n),toClipboard:oe=>n(oe),fromClipboard:(oe,ce)=>r(oe,{network:t(ce&&ce.column)})},ipv6:{base:"text",storage:"dictionary",matches:S,parse:oe=>_(oe.text),parseError:ye(_,xe.ipv6),compare:O,format:oe=>T(oe.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:oe=>_(oe),toClipboard:oe=>T(oe),fromClipboard:oe=>_(oe)},mac:{base:"text",storage:"dictionary",matches:D,parse:oe=>Z(oe.text),parseError:ye(Z,xe.mac),compare:X,format:oe=>J(oe.value,oe.column&&oe.column.typeOptions&&oe.column.typeOptions.macFormat),operators:Object.freeze({...Object.fromEntries(ne.map(oe=>[oe,ue(oe)])),...Object.fromEntries(se.map(oe=>[oe,ge(oe)]))}),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:oe=>Z(oe),fromClipboard:oe=>Z(oe)}}),fe=re}),_e("packages/core/src/columns/types/vlan.js",function(e,F){"use strict";Object.defineProperty(e,"vlanError",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseVlans",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"formatVlans",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"vlanContains",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"vlanOverlaps",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"vlanCount",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"isVlan",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"compareVlans",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"VLAN_TYPES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}});const ie=1,E=4094,K=/^\d+$/;function I(t,i){const s=!!(i&&i.single),r=t==null?"":String(t).trim();if(r==="")return{ids:null,error:null};const n=r.split(","),m=new Set;for(const l of n){const a=l.trim();if(a==="")return{ids:null,error:`"${r}" has an empty entry`};const c=a.indexOf("-");if(c>=0){if(s)return{ids:null,error:"a single-ID VLAN column holds one ID, not a list or range"};const f=a.slice(0,c).trim(),p=a.slice(c+1).trim();if(!K.test(f)||!K.test(p))return{ids:null,error:`"${a}" is not a VLAN range like 20-30`};let y=Number(f),h=Number(p);if(y<ie||y>E||h<ie||h>E)return{ids:null,error:`VLAN IDs are between ${ie} and ${E}`};if(y>h){const d=y;y=h,h=d}for(let d=y;d<=h;d++)m.add(d)}else{if(!K.test(a))return{ids:null,error:`"${a}" is not a VLAN ID (a whole number ${ie}-${E})`};const f=Number(a);if(f<ie||f>E)return{ids:null,error:`VLAN IDs are between ${ie} and ${E}`};if(s&&n.length>1)return{ids:null,error:"a single-ID VLAN column holds one ID, not a list or range"};m.add(f)}}return s&&m.size>1?{ids:null,error:"a single-ID VLAN column holds one ID, not a list or range"}:{ids:[...m].sort((l,a)=>l-a),error:null}}function L(t,i){return I(t,i).error}function Q(t){const i=[];let s=0;for(;s<t.length;){let r=s;for(;r+1<t.length&&t[r+1]===t[r]+1;)r++;i.push(r===s?String(t[s]):`${t[s]}-${t[r]}`),s=r+1}return i.join(",")}function U(t){if(t==null||t==="")return null;if(typeof t=="string")return I(t,{}).ids;if(Array.isArray(t)){const i=new Set;for(const s of t){if(typeof s!="number"||!Number.isInteger(s)||s<ie||s>E)return null;i.add(s)}return i.size?[...i].sort((s,r)=>s-r):null}return typeof t=="number"&&Number.isInteger(t)&&t>=ie&&t<=E?[t]:null}function x(t,i){const s=I(t,i);return s.ids===null?null:Q(s.ids)}function q(t){const i=U(t);return i===null?"":Q(i)}function R(t,i){const s=U(t);if(s===null)return!1;const r=Number(i);return Number.isInteger(r)&&s.includes(r)}function j(t,i){const s=U(t);if(s===null)return!1;const r=new Set(s),n=Array.isArray(i)?i:typeof i=="string"?i.split(","):[i];for(const m of n){const l=Number(typeof m=="string"?m.trim():m);if(Number.isInteger(l)&&r.has(l))return!0}return!1}function k(t){const i=U(t);return i===null?0:i.length}function b(t){return typeof t=="string"&&x(t)!==null}function u(t,i){const s=U(t),r=U(i);return s===null?r===null?0:1:r===null?-1:s[0]!==r[0]?s[0]<r[0]?-1:1:s.length<r.length?-1:s.length>r.length?1:0}const g=Object.freeze({vlan:{base:"text",storage:"dictionary",matches:b,parse:t=>x(t.text,{single:!!(t.column&&t.column.typeOptions&&t.column.typeOptions.vlanSingle)}),parseError:t=>L(t.text,{single:!!(t.column&&t.column.typeOptions&&t.column.typeOptions.vlanSingle)}),compare:u,format:t=>q(t.value),defaults:{filter:"text",editor:"vlan",align:"start"},excel:"@",operators:Object.freeze({contains:{compile:t=>i=>R(i,t),check:t=>{const i=Number(typeof t=="string"?t.trim():t);return!Number.isInteger(i)||i<ie||i>E?`contains needs one VLAN ID ${ie}-${E}`:null}},overlaps:{compile:t=>i=>j(i,t),check:t=>{const i=Array.isArray(t)?t:typeof t=="string"?t.split(","):[t];for(const s of i){const r=Number(typeof s=="string"?s.trim():s);if(!Number.isInteger(r)||r<ie||r>E)return`overlaps needs VLAN IDs ${ie}-${E}`}return null}}}),toStorage:t=>x(t),toClipboard:t=>q(t),fromClipboard:t=>x(t)}}),o=g}),_e("packages/core/src/i18n/catalogue.js",function(e,F){"use strict";Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return L}});const ie=F("packages/core/src/registry/free-tier-notice.js"),E=ie.FREE_TIER_NOTICE,K=ie.WATERMARK_TEXT,I=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.column.hidden":"{column} hidden","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","rowCap.more":"+ {count} more","panel.formatting":"Formatting","panel.statistics":"Statistics","stat.noData":"No data","stat.unavailable":"Not available on this source","stat.tone.good":"good","stat.tone.bad":"bad","stat.tone.flat":"flat","stat.target":"target {target}","meter.target":"target {value}","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","listview.pullToRefresh.pull":"Pull to refresh","listview.pullToRefresh.release":"Release to refresh","listview.pullToRefresh.refreshing":"Refreshing…","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.columnMenu":"Column menu","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; while editing, commit and open the cell below (Shift+Enter: above)","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.beforeOrEqual":"Before or equal","filter.op.after":"After","filter.op.afterOrEqual":"After or equal","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.operatorNamed":"Operator: {name}","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.order":"Order values","filter.orderAz":"A to Z","filter.orderCount":"Count","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.suppressed.unavailable":"Histogram unavailable","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"}),L=Object.freeze(Object.keys(I))}),_e("packages/core/src/i18n/format.js",function(e,F){"use strict";Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"formatMessage",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return k}});const E=F("packages/core/src/internal/predicates.js").isFunction,K=/\{(\w+)\}/g,I=new Map,L=new Map;function Q(b){const u=b||"";if(I.has(u))return I.get(u);let g=null;try{g=new Intl.PluralRules(b||void 0)}catch{g=null}return I.set(u,g),g}function U(b,u,g="conjunction"){const o=Array.isArray(b)?b.filter(s=>s!=null&&s!==""):[];if(o.length===0)return"";if(o.length===1)return String(o[0]);const t=`${u||""}|${g}`;let i=L.get(t);if(i===void 0){try{i=new Intl.ListFormat(u||void 0,{style:"long",type:g})}catch{i=null}L.set(t,i)}return i?i.format(o.map(String)):o.map(String).join(", ")}function x(b,u){return b==null?"":typeof b=="number"?Number.isFinite(b)?b.toLocaleString(u||void 0,{maximumFractionDigits:20}):"":String(b)}function q(b,u,g){if(typeof b=="string")return b;if(!b||typeof b!="object")return"";const o=u&&typeof u.count=="number"?u.count:null;if(o===null)return b.other??"";const t=Q(g),i=t?t.select(o):o===1?"one":"other";return b[i]??b.other??""}function R(b,u={},g){const o=q(b,u,g);return o?o.replace(K,(t,i)=>Object.prototype.hasOwnProperty.call(u,i)?x(u[i],g):t):""}function j(b,u,g="en-GB"){return typeof b=="string"&&b?b:typeof u=="string"&&u?u:g}function k(b,u){const g=b?b[u]:void 0;return g==null||E(g)?u:g}}),_e("packages/core/src/i18n/registry.js",function(e,F){"use strict";Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"localeCatalogue",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return Q}});const E=F("packages/core/src/i18n/catalogue.js").EN_GB,K=new Map([["en-gb",E]]);function I(U,x){const q=typeof U=="string"?U.toLowerCase():"";return!q||!x||typeof x!="object"?!1:(K.set(q,x),!0)}function L(U){if(typeof U!="string"||!U)return null;const x=U.toLowerCase(),q=K.get(x);if(q)return q;const R=x.split("-")[0],j=K.get(R);if(j)return j;for(const[k,b]of K)if(k.split("-")[0]===R)return b;return null}function Q(){return[...K.keys()]}}),_e("packages/core/src/i18n/index.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_LOCALE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"Messages",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"defaultMessages",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return r}});const ie=F("packages/core/src/i18n/catalogue.js"),E=ie.EN_GB,K=ie.MESSAGE_KEYS,I=F("packages/core/src/i18n/format.js"),L=I.formatMessage,Q=I.formatList,U=I.lookup,x=I.resolveLocale,R=F("packages/core/src/internal/predicates.js").isFunction,k=F("packages/core/src/internal/warn.js").warnOnce,b=F("packages/core/src/i18n/registry.js"),u=b.registerLocale,g=b.localeCatalogue;Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return ie.EN_GB}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return ie.MESSAGE_KEYS}}),Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return I.formatList}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return I.resolveLocale}}),Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return b.registerLocale}});const o="en-GB";class t{#e=o;#t=E;constructor(m={}){this.configure(m)}configure(m={}){this.#e=x(m.locale,m.declared,o);const l=m.messages,a=g(this.#e);if(!a&&this.#e.toLowerCase()!=="en-gb"&&(!l||typeof l!="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.`),!l||typeof l!="object"){this.#t=a?{...E,...a}:E;return}const f=Object.keys(l).filter(p=>!(p in E));f.length&&k(`i18n:unknown:${f[0]}`,`message keys not in the catalogue and so ignored: ${f.slice(0,5).join(", ")}${f.length>5?`, and ${f.length-5} more`:""}`),this.#t={...E,...a||{},...l}}get locale(){return this.#e}t(m,l){return L(U(this.#t,m),l||{},this.#e)}list(m,l){return Q(m,this.#e,l)}number(m,l){const a=Number(m);return Number.isFinite(a)?a.toLocaleString(this.#e,l||{maximumFractionDigits:20}):""}}const i=new t;function s(n){return n instanceof t?n:new t(n||{})}function r(n){const m=n&&typeof n=="object"?n:{},l=K.filter(c=>{const f=m[c];return f==null||f===""||R(f)}),a=Object.keys(m).filter(c=>!(c in E));return{missing:l,unknown:a}}}),_e("packages/core/src/columns/types/structured.js",function(e,F){"use strict";Object.defineProperty(e,"MASK_DEFAULTS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"parseJsonText",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}});const ie=F("packages/core/src/internal/predicates.js"),E=ie.isNil,K=ie.isObject,L=F("packages/core/src/i18n/index.js").defaultMessages,Q=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function U(t,i){const s=i||{},r=s.emptyDisplay??Q.emptyDisplay;if(E(t)||t==="")return r;const m=[...typeof s.char=="string"&&s.char!==""?s.char:Q.char][0]||Q.char,l=s.fixedLength??Q.fixedLength,a=Number.isFinite(s.length)&&Number(s.length)>0?Math.floor(Number(s.length)):Q.length,c=typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):null;let f=0;if(c!==null){const p=Number.isFinite(s.lastVisible)?Math.floor(Number(s.lastVisible)):Q.lastVisible,y=[...c];if(f=p>0&&p<y.length?p:0,f>0){const h=y.slice(y.length-f).join(""),d=Math.max(1,(l?a:y.length)-f);return m.repeat(d)+h}return m.repeat(l?a:Math.max(1,y.length))}return m.repeat(a)}const x=48;function q(t){try{const i=JSON.stringify(t);return i===void 0?null:i}catch{return null}}function R(t,i){if(E(t))return"";const s=Number.isFinite(i&&i.inlineLimit)?Number(i.inlineLimit):x;if(typeof t=="string")return t.length>s?`${t.slice(0,s-1)}…`:t;if(typeof t!="object")return String(t);const r=q(t);if(r!==null&&r.length<=s)return r;if(Array.isArray(t)){const m=t.length;return`[${L.t("count.items",{count:m})}]`}const n=Object.keys(t).length;return`{${L.t("count.keys",{count:n})}}`}function j(t,i){if(t==null)return"null";const s=typeof t;if(s==="number"||s==="boolean"||s==="bigint")return String(t);if(s==="string")return JSON.stringify(t);if(s!=="object")return JSON.stringify(String(t));const r=i||new WeakSet;return r.has(t)?'"[circular]"':(r.add(t),t instanceof Date?JSON.stringify(t.toISOString()):Array.isArray(t)?`[${t.map(l=>j(l,r)).join(",")}]`:`{${Object.keys(t).sort().map(l=>`${JSON.stringify(l)}:${j(t[l],r)}`).join(",")}}`)}function k(t,i){if(E(t))return E(i)?0:1;if(E(i))return-1;const s=j(t),r=j(i);return s<r?-1:s>r?1:0}function b(t){if(E(t))return null;const i=String(t);if(i.trim()==="")return null;try{return JSON.parse(i)}catch{return i}}function u(t){const i=t&&t.cell&&t.cell.props;return K(i)?i:{}}const g=Object.freeze({json:{base:"object",storage:"object",format:t=>R(t&&t.value,u(t&&t.column)),parse:t=>b(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 i=JSON.stringify(t,null,2);return i===void 0?String(t):i}catch{return String(t)}},fromClipboard:t=>b(t)},secret:{base:"text",storage:"object",format:t=>U(t&&t.value,u(t&&t.column)),parse:t=>{const i=t&&t.text;return E(i)||String(i)===""?null:String(i)},compare:(t,i)=>{const s=E(t)||t==="",r=E(i)||i==="";return s===r?0:s?1:-1},defaults:{editor:"password",filter:"none",align:"start"},excel:"@",export:{csv:!1,excel:!1},toClipboard:t=>U(t),fromClipboard:t=>E(t)||String(t)===""?null:String(t)}}),o=g}),_e("packages/core/src/columns/types/unit.js",function(e,F){"use strict";Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return U}}),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 b}}),Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return N}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/internal/warn.js").warnOnce;function L($,H,Y,Z){return Object.freeze({symbol:$,factor:H,aliases:Object.freeze(Y||[]),binary:!!(Z&&Z.binary),prefix:Z&&Z.prefix||null,auto:!(Z&&Z.auto===!1)})}function Q($,H,Y,Z){return L($,H,Y,Z)}const U=Object.freeze({data:Object.freeze([L("B",1,["byte","bytes"]),L("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),L("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),L("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),L("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),L("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),L("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),L("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),L("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),L("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([L("bps",1,["bit","bits","bit/s","b/s"]),L("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),L("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),L("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),L("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([L("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),L("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),L("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),L("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),L("in",.0254,["inch","inches"],{auto:!1}),L("ft",.3048,["foot","feet"],{auto:!1}),L("yd",.9144,["yard","yards"],{auto:!1}),L("m",1,["metre","metres","meter","meters"]),L("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),L("mi",1609.344,["mile","miles"],{auto:!1}),L("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([L("mg",.001,["milligram","milligrams"]),L("g",1,["gram","grams"]),L("oz",28.349523125,["ounce","ounces"],{auto:!1}),L("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),L("kg",1e3,["kilogram","kilograms"]),L("st",6350.29318,["stone"],{auto:!1}),L("t",1e6,["tonne","tonnes","ton"],{auto:!1}),L("ton (US)",907184.74,["ton","shortton"],{auto:!1}),L("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([L("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),L("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),L("ms",.001,["msec","msecs","millisecond","milliseconds"]),L("s",1,["sec","secs","second","seconds"]),L("m",60,["min","mins","minute","minutes"]),L("h",3600,["hr","hrs","hour","hours"]),L("d",86400,["day","days"])]),speed:Object.freeze([L("mm/s",.001,["millimetre/s","millimeter/s"]),L("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),L("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),L("mph",.44704,["mile/h","miles/h"],{auto:!1}),L("kn",1852/3600,["knot","knots"],{auto:!1}),L("m/s",1,["metre/s","meter/s","mps"]),L("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([L("mm/s²",.001,["mm/s2"]),L("ft/s²",.3048,["ft/s2"],{auto:!1}),L("m/s²",1,["m/s2","metre/s2","meter/s2"]),L("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([L("mm²",1e-6,["mm2"]),L("cm²",1e-4,["cm2"]),L("in²",64516e-8,["in2","sqin"],{auto:!1}),L("ft²",.09290304,["ft2","sqft"],{auto:!1}),L("yd²",.83612736,["yd2","sqyd"],{auto:!1}),L("m²",1,["m2","sqm"]),L("ha",1e4,["hectare","hectares"],{auto:!1}),L("ac",4046.8564224,["acre","acres"],{auto:!1}),L("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([L("µL",1e-6,["ul","microlitre","microliter"]),L("mL",.001,["millilitre","milliliter"]),L("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),L("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),L("L",1,["litre","litres","liter","liters"]),L("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),L("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),L("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),L("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([L("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),L("J",1,["joule","joules"]),L("cal",4.184,["calorie","calories"],{auto:!1}),L("kJ",1e3,["kilojoule","kilojoules"]),L("BTU",1055.05585262,["btu"],{auto:!1}),L("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),L("MJ",1e6,["megajoule","megajoules"]),L("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),L("GJ",1e9,["gigajoule","gigajoules"]),L("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([L("mW",.001,["milliwatt","milliwatts"]),L("W",1,["watt","watts"]),L("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),L("kW",1e3,["kilowatt","kilowatts"]),L("hp",745.6998715822702,["horsepower"],{auto:!1}),L("MW",1e6,["megawatt","megawatts"]),L("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([L("mN",.001,["millinewton","millinewtons"]),L("N",1,["newton","newtons"]),L("lbf",4.4482216152605,["poundforce"],{auto:!1}),L("kgf",9.80665,["kilogramforce"],{auto:!1}),L("kN",1e3,["kilonewton","kilonewtons"]),L("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([L("Pa",1,["pascal","pascals"]),L("mbar",100,["millibar"],{auto:!1}),L("inH₂O",249.0889,["inh2o"],{auto:!1}),L("mmHg",133.322387415,["torr"],{auto:!1}),L("kPa",1e3,["kilopascal","kilopascals"]),L("inHg",3386.388640341,["inhg"],{auto:!1}),L("psi",6894.757293168361,["lbf/in2"],{auto:!1}),L("bar",1e5,[],{auto:!1}),L("atm",101325,["atmosphere","atmospheres"],{auto:!1}),L("MPa",1e6,["megapascal","megapascals"]),L("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([L("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),L("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),L("kN·m",1e3,["knm","kn.m"],{auto:!1}),L("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([L("kg/m³",1,["kg/m3"]),L("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),L("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),L("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([L("L/min",1/6e4,["lpm","l/min"],{auto:!1}),L("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),L("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),L("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),L("cfm",.0004719474432,["ft3/min"],{auto:!1}),L("L/s",.001,["lps","l/s"],{auto:!1}),L("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([L("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),L("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),L("mrad",.001,["milliradian","milliradians"],{auto:!1}),L("mil",Math.PI/3200,["nato-mil"],{auto:!1}),L("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),L("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),L("rad",1,["radian","radians"]),L("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([L("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),L("rad/s",1,["radps","radians/s"]),L("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),L("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([L("ppt",1e-12,["partspertrillion"],{auto:!1}),L("ppb",1e-9,["partsperbillion"]),L("ppm",1e-6,["partspermillion"]),L("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),L("‰",.001,["permille","permil"],{auto:!1}),L("%",.01,["pct","percent"]),L("×",1,["x","ratio","times"])]),molarity:Object.freeze([L("pM",1e-12,["picomolar","picomolarity"]),L("nM",1e-9,["nanomolar","nanomolarity"]),L("µM",1e-6,["um-molar","micromolar","micromolarity"]),L("mM",.001,["millimolar","millimolarity"]),L("M",1,["molar","mol/l","mol/L","molarity"]),L("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([L("mg/s",1e-6,["milligrams/s"]),L("g/s",.001,["grams/s"]),L("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),L("kg/s",1,["kilograms/s","kgps"]),L("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),L("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),L("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([L("µPa·s",1e-6,["upas","micropascalsecond"]),L("cP",.001,["centipoise"],{auto:!1}),L("mPa·s",.001,["mpas","millipascalsecond"]),L("P",.1,["poise"],{auto:!1}),L("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([L("cSt",1e-6,["centistokes","centistoke"]),L("mm²/s",1e-6,["mm2/s"],{auto:!1}),L("St",1e-4,["stokes","stoke"],{auto:!1}),L("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([L("mW/(m·K)",.001,["mw/mk"]),L("W/(m·K)",1,["w/mk","wmk"]),L("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),L("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([L("J/(kg·K)",1,["j/kgk","jkgk"]),L("kJ/(kg·K)",1e3,["kj/kgk"]),L("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([L("nSv/h",1e-9,["nsvh"]),L("µSv/h",1e-6,["usv/h","usvh"]),L("mSv/h",.001,["msvh"]),L("Sv/h",1,["svh"]),L("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),x=Symbol("ambiguous"),q=new Map,R=new Map;function j($,H){const Y=String($||"").trim();if(!Y)throw new Error("[lattice] a unit system needs a name");if(U[Y]||R.has(Y))throw new Error(`[lattice] unit system "${Y}" already exists`);const Z=[...H||[]];if(!Z.length)throw new Error(`[lattice] unit system "${Y}" has no units`);if(!Z.some(D=>D.factor===1))throw new Error(`[lattice] unit system "${Y}" has no base unit (none with factor 1)`);const J=new Set;for(const D of Z){if(J.has(D.symbol))throw new Error(`[lattice] unit system "${Y}" declares "${D.symbol}" twice`);J.add(D.symbol)}return R.set(Y,Object.freeze(Z)),q.delete(Y),Y}function k(){return[...Object.keys(U),...R.keys()]}function b($){const H=u($);return H?H.units:[]}function u($){const H=String($||""),Y=q.get(H);if(Y!==void 0)return Y;const Z=U[H]||R.get(H);if(!Z)return q.set(H,null),null;const J=Object.freeze([...Z].sort((ne,se)=>ne.factor-se.factor)),D=new Map,te=new Map,z=(ne,se)=>{const ue=D.get(ne);ue===void 0?D.set(ne,se):ue!==se&&D.set(ne,x)};for(const ne of J){z(ne.symbol.toLowerCase(),ne);for(const se of ne.aliases)z(se.toLowerCase(),ne);if(ne.prefix){const se=te.get(ne.prefix)||[];se.push(ne),te.set(ne.prefix,se)}}const X={units:J,byToken:D,byPrefix:te,decimal:J.filter(ne=>!ne.binary&&ne.auto),binary:J.some(ne=>ne.binary)?J.filter(ne=>(ne.binary||ne.factor===1)&&ne.auto):null};return q.set(H,X),X}function g($,H){return H&&$.binary||$.decimal}function o($,H){const Y=u($);if(!Y||E(H))return null;const Z=Y.units.find(D=>D.symbol===String(H));if(Z)return Z;const J=Y.byToken.get(String(H).trim().toLowerCase());return J&&J!==x?J:null}const t=new WeakMap;function i($){const H=$||{};if(typeof H=="object"&&H!==null){const D=t.get(H);if(D!==void 0)return D}const Y=H.system||"data",Z=u(Y);let J=null;if(!Z)I(`unit:system:${Y}`,`unknown unit system "${Y}"; known systems are ${k().join(", ")}`);else{let D=H.unit?o(Y,H.unit):null;D||(H.unit&&I(`unit:unit:${Y}:${H.unit}`,`unknown unit "${H.unit}" in system "${Y}"; falling back to ${Z.units[0].symbol}`),D=Z.units.find(te=>te.factor===1)||Z.units[0]),J={index:Z,base:D,binary:H.binary===!0}}return typeof H=="object"&&H!==null&&t.set(H,J),J}const s=new WeakMap;function r($,H){if(!$||!H||!Array.isArray($.compound)||$.compound.length===0)return null;const Y=s.get($);if(Y!==void 0)return Y;const Z=new Set,J=[];for(const te of $.compound){const z=o($.system||"data",te);if(!z){I(`unit:compound:${$.system}:${te}`,`unknown compound unit "${te}" in system "${$.system||"data"}"; ignoring it`);continue}Z.has(z.symbol)||(Z.add(z.symbol),J.push(z))}J.sort((te,z)=>z.factor-te.factor);const D=J.length>=2?J:null;return s.set($,D),D}function n($,H,Y){return H===Y||H.factor===Y.factor?$:$*H.factor/Y.factor}const m=new Map;function l($){const H=$||"",Y=m.get(H);if(Y)return Y;const Z={group:",",decimal:"."};try{for(const J of new Intl.NumberFormat($||void 0).formatToParts(12345.6))J.type==="group"?Z.group=J.value:J.type==="decimal"&&(Z.decimal=J.value)}catch{}return m.set(H,Z),Z}const a=/[\s ]/g,c=/^[+-]?[\d '’ .,]*(?:[eE][+-]?\d+)?/,f=/^[^\d+\-(.,\s]+\s*/,p=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function y($,H){const{group:Y,decimal:Z}=l(H);let J=String($).replace(a,"");if(J==="")return null;const D=Z?J.indexOf(Z):-1;if(Y&&Y!==Z){if(D>=0&&J.indexOf(Y,D+Z.length)>=0)return null;J=J.split(Y).join("")}if(Z&&Z!=="."&&(J=J.split(Z).join(".")),!p.test(J))return null;const te=Number(J);return Number.isFinite(te)?te:null}function h($,H,Y){const Z=String($).trim().replace(/\.$/,"");if(Z==="")return null;const J=H.units.find(se=>se.symbol===Z);if(J)return J;const D=Z.toLowerCase(),te=H.byToken.get(D);if(te===x)return null;if(te)return te;const z=H.byPrefix.get(D);if(!z||!z.length)return null;const X=g(H,Y),ne=z.filter(se=>X.includes(se));return ne.length===1?ne[0]:null}function d($,H,Y,Z){let J=$,D=0,te=!1,z=!1;for(;J!=="";){const X=c.exec(J)[0];if(X==="")return null;const ne=y(X,Z&&Z.locale);if(ne===null)return null;J=J.slice(X.length).trim();const se=J.search(/[+-]?[\d]/),ue=(se>=0?J.slice(0,se):J).trim();if(J=se>=0?J.slice(se).trim():"",ue===""){if(te)return null;z=!0,D+=n(ne,Y[0],H.base)}else{const ge=h(ue,H.index,H.binary);if(!ge)return null;D+=n(ne,ge,H.base)}if(te=!0,z&&J!=="")return null}return te?D:null}function w($,H){if(E($))return null;if(typeof $=="number")return Number.isFinite($)?$:null;const Y=i(H);if(!Y)return null;let Z=String($).trim();if(Z==="")return null;let J=!1;Z.startsWith("(")&&Z.endsWith(")")&&(J=!0,Z=Z.slice(1,-1).trim());const D=r(H,Y);if(D){Z.startsWith("-")&&(J=!0,Z=Z.slice(1).trim());const Oe=d(Z,Y,D,H);return Oe===null?null:J?-Oe:Oe}let te=null;const z=f.exec(Z);if(z&&z[0]){const Oe=h(z[0].trim(),Y.index,Y.binary);Oe&&(te=Oe,Z=Z.slice(z[0].length).trim())}const X=c.exec(Z)[0],ne=y(X,H&&H.locale);if(ne===null)return null;const se=Z.slice(X.length).trim();if(te&&se!=="")return null;const ue=te||(se===""?Y.base:h(se,Y.index,Y.binary));if(!ue)return null;const ge=n(ne,ue,Y.base);return J?-ge:ge}const v=new Map;function P($,H,Y,Z){const J=`${$||""}|${H}|${Y}|${Z?1:0}`;let D=v.get(J);return D||(D=new Intl.NumberFormat($||void 0,{minimumFractionDigits:H,maximumFractionDigits:Y,useGrouping:Z}),v.set(J,D)),D}function W($,H){if(!Number.isFinite($)||$===0)return Math.max(0,H-1);const Y=Math.floor(Math.log10(Math.abs($)));return Math.min(20,Math.max(0,H-1-Y))}function V($,H){if(!Number.isFinite($)||$===0)return $;const Y=Math.ceil(Math.log10(Math.abs($))),Z=10**(H-Y);return Math.round($*Z)/Z}function G($,H,Y){if(!Y||Y===H.base.symbol)return H.base;if(Y!=="auto")return _(H,Y);if($===0||!Number.isFinite($))return H.base;const Z=Math.abs($)*H.base.factor,J=g(H.index,H.binary);let D=J[0];for(const X of J)Z>=X.factor&&(D=X);if(Z>=D.factor)return D;let te=D;for(const X of H.index.units)X.binary!==H.binary&&X.factor!==1||X.factor<=Z&&X.factor>(te===D?0:te.factor)&&(te=X);if(te!==D)return te;let z=D;for(const X of H.index.units)X.binary!==H.binary&&X.factor!==1||X.factor<z.factor&&(z=X);return z.factor<H.base.factor?z:H.base}function _($,H){const Y=$.index.units.find(J=>J.symbol===H);if(Y)return Y;const Z=$.index.byToken.get(String(H).toLowerCase());return Z&&Z!==x?Z:(I(`unit:display:${H}`,`unknown display unit "${H}"; rendering in ${$.base.symbol}`),$.base)}function T($,H,Y,Z){const J=$<0;let D=Math.abs($)*H.base.factor;const te=typeof Z.decimals=="number"?Z.decimals:Z.minDecimals??0,z=typeof Z.decimals=="number"?Z.decimals:Z.maxDecimals??Math.max(te,2),X=Z.space??" ",ne=[];for(let ue=0;ue<Y.length;ue++){const ge=Y[ue],Oe=ue===Y.length-1;let Pe=Oe?D/ge.factor:Math.floor(D/ge.factor);if(D-=Pe*ge.factor,Oe){const xe=10**z;Pe=Math.round(Pe*xe)/xe+0}const Ie=Oe?P(Z.locale,te,z,Z.group!==!1):P(Z.locale,0,0,Z.group!==!1);ne.push(`${Ie.format(Pe)}${X}${ge.symbol}`)}const se=ne.join(" ");return J?`-${se}`:se}function S($,H){const Y=H||{},Z=Y.nullDisplay??"";if(E($)||$==="")return Z;const J=typeof $=="number"?$:Number($);if(!Number.isFinite(J))return Z;const D=i(Y);if(!D)return String(J);const te=r(Y,D);if(te)return T(J,D,te,Y);const z=typeof Y.significantFigures=="number"&&Y.significantFigures>0?Y.significantFigures:0,X=z?V(J,z):J,ne=G(X,D,Y.display),se=n(X,D.base,ne);let ue=typeof Y.decimals=="number"?Y.decimals:Y.minDecimals??0,ge=typeof Y.decimals=="number"?Y.decimals:Y.maxDecimals??Math.max(ue,2);z&&(ue=W(se,z),ge=ue);const Oe=P(Y.locale,ue,ge,Y.group!==!1).format(se),Pe=Y.space??" ";return Y.placement==="prefix"?`${ne.symbol}${Y.space??""}${Oe}`:`${Oe}${Pe}${ne.symbol}`}function O($,H){const Y=E($)||Number.isNaN($)?null:Number($),Z=E(H)||Number.isNaN(H)?null:Number(H);return Y===null||Number.isNaN(Y)?Z===null||Number.isNaN(Z)?0:1:Z===null||Number.isNaN(Z)||Y<Z?-1:Y>Z?1:0}function M($){const H=typeof $.decimals=="number"&&$.decimals>0?`.${"0".repeat($.decimals)}`:"";return`${typeof $.decimals=="number"?`#,##0${H}`:"#,##0.##"}" ${$.symbol}"`}function A($){const H={system:"data",...$||{}},Y=i(H),Z=Y?Y.base.symbol:String(H.unit||""),J=Object.freeze({...H,unit:Z}),D=Object.freeze({...J,display:Z,decimals:void 0,minDecimals:0,maxDecimals:20,group:!1}),te=new Map([[J.locale||"",J]]),z=X=>{const ne=X||"";let se=te.get(ne);return se||(se=Object.freeze({...J,locale:X||void 0}),te.set(ne,se)),se};return{base:"number",extends:"number",storage:"float64",unitConfig:J,format:X=>S(X.value,X.locale?z(X.locale):J),parse:X=>w(X.text,X.locale?z(X.locale):J),compare:O,defaults:{filter:"number",editor:"unit",align:"end",total:H.total||"sum"},...H.totals?{totals:H.totals}:{},excel:H.excel||M({decimals:H.decimals,symbol:Z}),toStorage:X=>typeof X=="number"?Number.isFinite(X)?X:null:typeof X=="string"?w(X,J):E(X)?null:w(String(X),J),toClipboard:X=>S(X,D),fromClipboard:X=>w(X,J)}}const N=A}),_e("packages/core/src/columns/types/engineering.js",function(e,F){"use strict";Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return L}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/columns/types/unit.js").createUnitType;function L(x){const q=2*Math.PI/x;return R=>{let j=0,k=0,b=0;for(const g of R||[]){if(E(g))continue;const o=Number(g);Number.isFinite(o)&&(j+=Math.cos(o*q),k+=Math.sin(o*q),b+=1)}return!b||Math.hypot(j,k)/b<1e-12?null:(Math.atan2(k,j)/q%x+x)%x}}function Q(x){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:L(x)}}}const U=Object.freeze({metres:I({system:"length",unit:"m",display:"auto",maxDecimals:3}),millimetres:I({system:"length",unit:"mm",maxDecimals:2}),kilometres:I({system:"length",unit:"km",maxDecimals:3}),grams:I({system:"mass",unit:"g",display:"auto",maxDecimals:3}),kilograms:I({system:"mass",unit:"kg",maxDecimals:3}),tonnes:I({system:"mass",unit:"t",maxDecimals:3}),seconds:I({system:"duration",unit:"s",display:"auto",maxDecimals:3}),milliseconds:I({system:"duration",unit:"ms",maxDecimals:3}),hours:I({system:"duration",unit:"h",maxDecimals:2}),speed:I({system:"speed",unit:"m/s",display:"auto",maxDecimals:2}),kph:I({system:"speed",unit:"km/h",maxDecimals:1}),mph:I({system:"speed",unit:"mph",maxDecimals:1}),knots:I({system:"speed",unit:"kn",maxDecimals:1}),acceleration:I({system:"acceleration",unit:"m/s²",maxDecimals:3}),area:I({system:"area",unit:"m²",display:"auto",maxDecimals:2}),hectares:I({system:"area",unit:"ha",maxDecimals:4}),volume:I({system:"volume",unit:"L",display:"auto",maxDecimals:3}),cubicMetres:I({system:"volume",unit:"m³",maxDecimals:3}),energy:I({system:"energy",unit:"J",display:"auto",maxDecimals:3}),kilowattHours:I({system:"energy",unit:"kWh",maxDecimals:2}),power:I({system:"power",unit:"W",display:"auto",maxDecimals:2}),kilowatts:I({system:"power",unit:"kW",maxDecimals:2}),force:I({system:"force",unit:"N",display:"auto",maxDecimals:2}),pressure:I({system:"pressure",unit:"Pa",display:"auto",maxDecimals:2}),bar:I({system:"pressure",unit:"bar",maxDecimals:3}),psi:I({system:"pressure",unit:"psi",maxDecimals:1}),torque:I({system:"torque",unit:"N·m",maxDecimals:2}),density:I({system:"density",unit:"kg/m³",maxDecimals:2}),flow:I({system:"flow",unit:"m³/s",maxDecimals:4}),litresPerMinute:I({system:"flow",unit:"L/min",maxDecimals:1}),radians:I({system:"angle",unit:"rad",maxDecimals:4,totals:Q(2*Math.PI)}),degrees:I({system:"angle",unit:"°",maxDecimals:2,totals:Q(360)}),rpm:I({system:"angularVelocity",unit:"rpm",maxDecimals:0}),angularVelocity:I({system:"angularVelocity",unit:"rad/s",maxDecimals:3}),ppm:I({system:"fraction",unit:"ppm",maxDecimals:2}),ppb:I({system:"fraction",unit:"ppb",maxDecimals:2}),basisPoints:I({system:"fraction",unit:"bp",maxDecimals:1}),molarity:I({system:"molarity",unit:"M",display:"auto",maxDecimals:3}),massFlow:I({system:"massFlow",unit:"kg/s",maxDecimals:3}),tonnesPerHour:I({system:"massFlow",unit:"t/h",maxDecimals:2}),viscosity:I({system:"viscosity",unit:"Pa·s",display:"auto",maxDecimals:3}),kinematicViscosity:I({system:"kinematicViscosity",unit:"cSt",maxDecimals:2}),thermalConductivity:I({system:"thermalConductivity",unit:"W/(m·K)",maxDecimals:3}),specificHeat:I({system:"specificHeat",unit:"J/(kg·K)",maxDecimals:1}),doseRate:I({system:"doseRate",unit:"µSv/h",display:"auto",maxDecimals:2})})}),_e("packages/core/src/columns/types/si.js",function(e,F){"use strict";Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return j}});const ie=F("packages/core/src/columns/types/unit.js"),E=ie.defineUnit,K=ie.registerUnitSystem,I=ie.createUnitType,L=Object.freeze([Object.freeze({symbol:"f",name:"femto",factor:1e-15}),Object.freeze({symbol:"p",name:"pico",factor:1e-12}),Object.freeze({symbol:"n",name:"nano",factor:1e-9}),Object.freeze({symbol:"µ",name:"micro",factor:1e-6}),Object.freeze({symbol:"m",name:"milli",factor:.001}),Object.freeze({symbol:"c",name:"centi",factor:.01}),Object.freeze({symbol:"",name:"",factor:1}),Object.freeze({symbol:"k",name:"kilo",factor:1e3}),Object.freeze({symbol:"M",name:"mega",factor:1e6}),Object.freeze({symbol:"G",name:"giga",factor:1e9}),Object.freeze({symbol:"T",name:"tera",factor:1e12}),Object.freeze({symbol:"P",name:"peta",factor:1e15})]),Q=Object.freeze(["p","n","µ","m","","k","M","G"]);function U(k){const b=String(k.base),u=new Set([...k.prefixes||Q,""]),g=[];for(const o of L){if(!u.has(o.symbol))continue;const t=`${o.symbol}${b}`,i=[];if(k.name){i.push(`${o.name}${k.name}`,`${o.name}${k.name}s`);const s=o.name.slice(-1);if(s&&k.name.startsWith(s)){const r=`${o.name.slice(0,-1)}${k.name}`;i.push(r,`${r}s`)}}o.symbol==="µ"&&i.push(`u${b}`),o.factor===1&&k.aliases&&i.push(...k.aliases),g.push(E(t,o.factor,i))}for(const o of k.extra||[])g.push(o);return g}function x(k,b){const u=U(b);return K(k,u)}function q(k,b,u){return x(k,b),I({system:k,unit:b.base,display:"auto",maxDecimals:3,...u||{}})}const R=Object.freeze({voltage:q("voltage",{base:"V",name:"volt"}),current:q("current",{base:"A",name:"amp",aliases:["ampere","amperes"]}),resistance:q("resistance",{base:"Ω",name:"ohm",aliases:["ohm","ohms","R"],prefixes:["m","","k","M","G"]}),capacitance:q("capacitance",{base:"F",name:"farad",prefixes:["f","p","n","µ","m",""]}),inductance:q("inductance",{base:"H",name:"henry",prefixes:["p","n","µ","m",""]}),charge:q("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:q("conductance",{base:"S",name:"siemens",prefixes:["n","µ","m","","k"]}),fluxDensity:q("fluxDensity",{base:"T",name:"tesla",prefixes:["n","µ","m",""],extra:[E("G",1e-4,["gauss"],{auto:!1})]}),luminousFlux:q("luminousFlux",{base:"lm",name:"lumen",prefixes:["m","","k"]}),illuminance:q("illuminance",{base:"lx",name:"lux",prefixes:["m","","k"]}),luminousIntensity:q("luminousIntensity",{base:"cd",name:"candela",prefixes:["m","","k"]}),substance:q("substance",{base:"mol",name:"mole",prefixes:["n","µ","m","","k"]}),absorbedDose:q("absorbedDose",{base:"Gy",name:"gray",prefixes:["µ","m",""]}),equivalentDose:q("equivalentDose",{base:"Sv",name:"sievert",prefixes:["n","µ","m",""]}),radioactivity:q("radioactivity",{base:"Bq",name:"becquerel",prefixes:["","k","M","G","T"],extra:[E("Ci",37e9,["curie","curies"],{auto:!1})]}),frequency:q("frequency",{base:"Hz",name:"hertz",prefixes:["m","","k","M","G","T"]})}),j=q}),_e("packages/core/src/columns/types/temperature.js",function(e,F){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return x}}),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 b}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});const E=F("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 I(g){if(E(g))return null;const o=String(g).trim();if(o==="")return null;for(const[i,s]of Object.entries(K))if(o===i||o===s.symbol)return{key:i,scale:s};const t=o.toLowerCase();for(const[i,s]of Object.entries(K))if(s.aliases.includes(t))return{key:i,scale:s};return null}function L(g,o,t){const i=I(o),s=I(t);return!i||!s||!Number.isFinite(Number(g))?null:i.key===s.key?Number(g):s.scale.fromKelvin(i.scale.toKelvin(Number(g)))}const Q=new Map;function U(g,o,t){const i=`${g||""}|${o}|${t}`;let s=Q.get(i);return s||(s=new Intl.NumberFormat(g||void 0,{minimumFractionDigits:o,maximumFractionDigits:t}),Q.set(i,s)),s}function x(g,o){const t=o||{},i=t.nullDisplay??"";if(E(g)||g==="")return i;const s=Number(g);if(!Number.isFinite(s))return i;const r=I(t.scale||"C");if(!r)return String(s);const n=I(t.display||t.scale||"C")||r,m=n.key===r.key?s:n.scale.fromKelvin(r.scale.toKelvin(s)),l=typeof t.decimals=="number"?t.decimals:null,a=l??t.minDecimals??0,c=l??t.maxDecimals??1;return`${U(t.locale,a,c).format(m)}${t.space??" "}${n.scale.symbol}`}const q=/^[+-]?[\d\s., ]*\d/;function R(g,o){const t=String(g).trim();if(t==="")return null;const i=new Intl.NumberFormat(o||void 0).formatToParts(1.1).find(m=>m.type==="decimal")?.value||".",s=i===","?".":",",r=t.split(s).join("").split(/[\s ]/).join("").replace(i,"."),n=Number(r);return Number.isFinite(n)?n:null}function j(g,o){if(E(g))return null;const t=o||{},i=I(t.scale||"C");if(!i)return null;if(typeof g=="number")return Number.isFinite(g)?g:null;let s=String(g).trim();if(s==="")return null;let r=!1;s.startsWith("(")&&s.endsWith(")")&&(r=!0,s=s.slice(1,-1).trim());const n=q.exec(s);if(!n)return null;const m=R(n[0],t.locale);if(m===null)return null;const l=s.slice(n[0].length).trim();if(l==="")return r?-m:m;const a=I(l);if(!a)return null;const c=a.key===i.key?m:i.scale.fromKelvin(a.scale.toKelvin(m));return r?-c:c}function k(g){const o=Object.freeze({scale:"C",...g||{}}),i=(I(o.scale)||I("C")).scale.symbol,s=Object.freeze({...o,display:o.scale,decimals:void 0,minDecimals:0,maxDecimals:20}),r=new Map([[o.locale||"",o]]),n=m=>{const l=m||"";let a=r.get(l);return a||(a=Object.freeze({...o,locale:m||void 0}),r.set(l,a)),a};return{base:"number",extends:"number",storage:"float64",temperatureConfig:o,format:m=>x(m.value,m.locale?n(m.locale):o),parse:m=>j(m.text,m.locale?n(m.locale):o),defaults:{filter:"number",editor:"temperature",align:"end",total:"avg"},totals:{supported:["avg","min","max","count","countValues"]},excel:o.excel||`#,##0${typeof o.decimals=="number"&&o.decimals>0?`.${"0".repeat(o.decimals)}`:".#"}" ${i}"`,toStorage:m=>typeof m=="number"?Number.isFinite(m)?m:null:typeof m=="string"?j(m,o):E(m)?null:j(String(m),o),toClipboard:m=>x(m,s),fromClipboard:m=>j(m,o)}}const b=Object.freeze({celsius:k({scale:"C"}),fahrenheit:k({scale:"F"}),kelvin:k({scale:"K"})}),u=k}),_e("packages/core/src/columns/types/radix.js",function(e,F){"use strict";Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"digitsForWidth",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"radixRange",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"radixName",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"normaliseRadixOptions",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"compileRadixFormat",{enumerable:!0,get:function(){return d}}),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 P}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return T}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/internal/warn.js").warnOnce,L=Object.freeze({2:2,8:8,16:16,bin:2,binary:2,base2:2,oct:8,octal:8,base8:8,hex:16,hexadecimal:16,base16:16}),Q=Object.freeze({2:1,8:3,16:4}),U=Object.freeze({2:"0b",8:"0o",16:"0x"}),x=Object.freeze({2:4,8:3,16:2}),q=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),R=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,b=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,u=Object.freeze([8,16,32,53]),g=new WeakSet,o=new WeakMap,t=new Map,i=new WeakMap,s=new WeakMap,r=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(S){if(S==null)return 16;const O=typeof S=="string"?S.toLowerCase():S,M=L[O];return M||(I(`radix:base:${String(S)}`,`unsupported radix ${String(S)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function m(S,O){return Math.ceil(S/Q[O])}function l(S,O){if(!S)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**S-1};const M=2**(S-1);return{min:-M,max:M-1}}function a(S){return R[S]||"hexadecimal"}function c(S){if(typeof S=="string"){const O=r[S];return O||I(`radix:preset:${S}`,`unknown radix preset "${S}"; known presets are ${Object.keys(r).join(", ")}`),{...O||{}}}if(S&&typeof S.preset=="string"){const O=r[S.preset];return O||I(`radix:preset:${S.preset}`,`unknown radix preset "${S.preset}"; known presets are ${Object.keys(r).join(", ")}`),{...O||{},...S}}return S||{}}function f(S){const O=c(S),M=n(O.radix),A=Q[M];let N=null;if(O.bitWidth!==void 0&&O.bitWidth!==null&&O.bitWidth!==!1){const X=Number(O.bitWidth);u.includes(X)?N=X:I(`radix:width:${String(O.bitWidth)}`,`unsupported bitWidth ${String(O.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let $=O.signed!==!1;!$&&N===null&&(I("radix:unsigned:width","signed: false needs a bitWidth to render a two's-complement pattern; defaulting to 32"),N=32);const H=O.prefix===void 0||O.prefix===!0?U[M]:O.prefix===!1?"":String(O.prefix);let Y=0;O.pad===!0?Y=N?m(N,M):0:typeof O.pad=="number"&&O.pad>0&&(Y=Math.floor(O.pad));let Z=0;O.group===!0?Z=x[M]:typeof O.group=="number"&&O.group>0&&(Z=Math.floor(O.group));const J=l(N,$),D=typeof O.min=="number"?Math.max(J.min,O.min):J.min,te=typeof O.max=="number"?Math.min(J.max,O.max):J.max,z=Object.freeze({radix:M,bits:A,prefix:H,uppercase:O.uppercase!==!1,pad:Y,group:Z,groupSeparator:typeof O.groupSeparator=="string"?O.groupSeparator:" ",bitWidth:N,signed:$,min:D,max:te<D?D:te,nullDisplay:typeof O.nullDisplay=="string"?O.nullDisplay:"",name:a(M)});return g.add(z),z}function p(S){if(S&&g.has(S))return S;if(typeof S=="string"){let O=t.get(S);return O||(O=f(S),t.set(S,O)),O}if(S&&typeof S=="object"){let O=o.get(S);return O||(O=f(S),o.set(S,O)),O}return p("hex")}function y(S){return S<0?-Math.round(-S):Math.round(S)}function h(S,O,M){if(O<=0||S.length<=O)return S;const A=S.length%O||O,N=[S.slice(0,A)];for(let $=A;$<S.length;$+=O)N.push(S.slice($,$+O));return N.join(M)}function d(S){const O=p(S),{radix:M,prefix:A,uppercase:N,pad:$,group:H,groupSeparator:Y,signed:Z,bitWidth:J,nullDisplay:D}=O,te=J?2**J:0,z=X=>{if(E(X)||X==="")return D;const ne=typeof X=="number"?X:Number(X);if(!Number.isFinite(ne))return D;const se=y(ne);let ue="",ge=se;se<0&&(Z?(ue="-",ge=-se):ge=(se%te+te)%te);let Oe=ge.toString(M);return Oe=N?Oe.toUpperCase():Oe.toLowerCase(),$>0&&Oe.length<$&&(Oe=Oe.padStart($,"0")),H>0&&(Oe=h(Oe,H,Y)),ue+A+Oe};return z.options=O,z}function w(S,O){const M=p(O);let A=i.get(M);return A||(A=d(M),i.set(M,A)),A(S)}function v(S){const O=p(S),{radix:M,groupSeparator:A,signed:N,min:$,max:H}=O,Y=q[M],Z=J=>{if(E(J))return{ok:!0,value:null,reason:"blank"};let D=String(J);if(A&&A!==""&&(D=D.split(A).join("")),D=D.replace(k,""),D==="")return{ok:!0,value:null,reason:"blank"};let te=!1;if((D[0]==="-"||D[0]==="+")&&(te=D[0]==="-",D=D.slice(1)),D==="")return{ok:!1,value:null,reason:"digits"};let z=null;for(const[ne,se]of j){const ue=ne.exec(D);if(!ue)continue;const ge=D.slice(ue[0].length);if(ge==="")break;if(!q[se].test(ge))return{ok:!1,value:null,reason:"digits"};z=parseInt(ge,se);break}if(z===null)if(Y.test(D))z=parseInt(D,M);else if(b.test(D))z=Number(D);else return{ok:!1,value:null,reason:"digits"};if(!Number.isFinite(z))return{ok:!1,value:null,reason:"digits"};const X=y(te?-z:z);return!N&&X<0?{ok:!1,value:X,reason:"negative"}:X<$||X>H?{ok:!1,value:X,reason:"range"}:{ok:!0,value:X,reason:"ok"}};return Z.options=O,Z}function P(S,O){const M=p(O);let A=s.get(M);return A||(A=v(M),s.set(M,A)),A(S)}function W(S,O){const M=P(S,O);return M.ok?M.value:null}function V(S,O){const M=E(S)||Number.isNaN(S)?null:Number(S),A=E(O)||Number.isNaN(O)?null:Number(O);return M===null?A===null?0:1:A===null||M<A?-1:M>A?1:0}function G(S){const O=S.min>=-2147483648&&S.max<=2147483647;return S.bitWidth&&O?"int32":"float64"}function _(S){const O=f(S),M=d(O),A=v(O);return{base:"number",extends:"number",storage:G(O),matches:null,format:N=>M(N.value),parse:N=>{const $=A(N.text);return $.ok?$.value:null},compare:V,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:N=>M(N),fromClipboard:N=>{const $=A(N);return $.ok?$.value:null},radix:O,formatValue:M,parseText:A}}const T=_}),_e("packages/core/src/columns/types/aggregable.js",function(e,F){"use strict";Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"weightedMean",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"logarithmicSum",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"logarithmicMean",{enumerable:!0,get:function(){return L}});const E=F("packages/core/src/internal/predicates.js").isNil;function K(R){const j=[];for(const k of R||[]){if(E(k))continue;const b=Number(k);Number.isFinite(b)&&j.push(b)}return j}function I(R){return j=>{const k=K(j);if(!k.length)return null;let b=0;for(const u of k)b+=10**(u/R);return R*Math.log10(b)}}function L(R){return j=>{const k=K(j);if(!k.length)return null;let b=0;for(const u of k)b+=10**(u/R);return R*Math.log10(b/k.length)}}function Q(R,j){const k=j&&j.column,u=(k&&k.typeOptions||{}).weight,g=j&&j.valueAt;if(!u||typeof g!="function")return null;let o=0,t=0;for(let i=0;i<R.length;i++){if(E(R[i]))continue;const s=Number(R[i]);if(!Number.isFinite(s))continue;const r=g(u,i);if(E(r))continue;const n=Number(r);!Number.isFinite(n)||n<=0||(o+=s*n,t+=n)}return t===0?null:o/t}function U(R={}){const j=R.factor===20?20:10,k=typeof R.suffix=="string"?R.suffix:"",b=Number.isInteger(R.decimals)?R.decimals:1;return{base:"number",storage:"float64",name:R.name||"logarithmic",format:u=>{const g=u&&u.value;return E(g)||!Number.isFinite(Number(g))?"":`${Number(g).toFixed(b)}${k}`},parse:u=>{const g=String((u&&u.text)??"").replace(k,"").trim();if(!g)return null;const o=Number(g);return Number.isFinite(o)?o:null},defaults:{align:"end",filter:"number"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:{sum:I(j),avg:L(j)}}}}function x(R={}){const j=Number.isInteger(R.decimals)?R.decimals:1,k=R.percent===!0;return{base:"number",storage:"float64",name:R.name||"ratio",format:b=>{const u=b&&b.value;return E(u)||!Number.isFinite(Number(u))?"":k?`${Number(u).toFixed(j)}%`:Number(u).toFixed(j)},parse:b=>{const u=String((b&&b.text)??"").replace("%","").trim();if(!u)return null;const g=Number(u);return Number.isFinite(g)?g:null},defaults:{align:"end",filter:"number"},totals:{supported:["avg","min","max","count","countValues"],implement:{avg:Q}}}}const q=Object.freeze({decibel:U({name:"decibel",factor:10,suffix:" dB"}),decibelAmplitude:U({name:"decibelAmplitude",factor:20,suffix:" dB"}),ratio:x({name:"ratio"}),percentRate:x({name:"percentRate",percent:!0})})}),_e("packages/core/src/columns/types/currency.js",function(e,F){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return R}}),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 o}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});const E=F("packages/core/src/internal/predicates.js").isNil,K="⚠ no rate";function I(m){if(E(m))return null;const l=String(m).trim().toUpperCase();return l===""?null:l}function L(m){if(E(m))return null;if(typeof m=="object"&&!Array.isArray(m)){const l=Number(m.amount),a=I(m.code);return!a||!Number.isFinite(l)?null:{amount:l,code:a}}if(Array.isArray(m)&&m.length===2){const l=Number(m[0]),a=I(m[1]);return!a||!Number.isFinite(l)?null:{amount:l,code:a}}return null}const Q=Object.freeze({$:"USD","€":"EUR","£":"GBP","¥":"JPY","₹":"INR","₩":"KRW","₽":"RUB","₺":"TRY","₴":"UAH","₪":"ILS"}),U=Object.freeze({USD:"$",EUR:"€",GBP:"£",JPY:"¥",INR:"₹",KRW:"₩",RUB:"₽",TRY:"₺",UAH:"₴",ILS:"₪"}),x=/[+-]?[\d\s., ]*\d/;function q(m,l){const a=String(m).trim();if(a==="")return null;const c=new Intl.NumberFormat(l||void 0).formatToParts(1.1).find(h=>h.type==="decimal")?.value||".",f=c===","?".":",",p=a.split(f).join("").split(/[\s ]/).join("").replace(c,"."),y=Number(p);return Number.isFinite(y)?y:null}function R(m,l){const a=l||{},c=I(a.code);if(E(m))return null;const f=L(m);if(f)return f;if(typeof m=="number")return Number.isFinite(m)&&c?{amount:m,code:c}:null;let p=String(m).trim();if(p==="")return null;let y=!1;p.startsWith("(")&&p.endsWith(")")&&(y=!0,p=p.slice(1,-1).trim());let h=null;for(const[V,G]of Object.entries(Q)){if(p.startsWith(V)){h=G,p=p.slice(V.length).trim();break}if(p.endsWith(V)){h=G,p=p.slice(0,-V.length).trim();break}}const d=x.exec(p);if(!d)return null;const w=q(d[0],a.locale);if(w===null)return null;const v=(p.slice(0,d.index)+" "+p.slice(d.index+d[0].length)).trim();!h&&v!==""&&(h=I(v));const P=h||c;return P?{amount:y?-w:w,code:P}:null}function j(m,l){if(typeof m=="function")return(a,c)=>{if(a===c)return 1;const f=m(a,c);return typeof f=="number"&&Number.isFinite(f)&&f>0?f:null};if(m&&typeof m=="object"){const a=m;return(c,f)=>{if(c===f)return 1;const p=Number(a[c]),y=Number(a[f]);return!Number.isFinite(p)||!Number.isFinite(y)||p<=0||y<=0?null:y/p}}return(a,c)=>a===c?1:null}function k(m,l,a){if(!m)return null;if(m.code===l)return m.amount;const c=a(m.code,l);return c===null?null:m.amount*c}const b=new Map;function u(m,l,a){const c=`${m||""}|${l}|${a??""}`;let f=b.get(c);if(!f){const p={style:"currency",currency:l};typeof a=="number"&&(p.minimumFractionDigits=a,p.maximumFractionDigits=a);try{f={fmt:new Intl.NumberFormat(m||void 0,p),currency:!0}}catch{f={fmt:new Intl.NumberFormat(m||void 0,typeof a=="number"?{minimumFractionDigits:a,maximumFractionDigits:a}:{}),currency:!1}}b.set(c,f)}return f}function g(m,l){const a=l||{},c=a.nullDisplay??"",f=L(m);if(!f)return c;const p=I(a.display)||f.code;let y=f.amount,h=f.code;if(p!==f.code){const v=a.rateFn||j(a.rates,a.rateBase),P=k(f,p,v);if(P===null)return`${a.missingRate??K} ${f.code}→${p}`;y=P,h=p}const{fmt:d,currency:w}=u(a.locale,h,a.decimals);return w?d.format(y):`${d.format(y)} ${h}`}function o(m){const l=L(m);return l?`${l.amount} ${l.code}`:""}function t(m){const l=m||{},a=I(l.display),c=l.rateFn||j(l.rates,l.rateBase);return(f,p)=>{const y=L(f),h=L(p);if(!y&&!h)return 0;if(!y)return 1;if(!h)return-1;if(a){const d=k(y,a,c),w=k(h,a,c);if(d!==null&&w!==null)return d===w?0:d<w?-1:1}return y.code===h.code?y.amount===h.amount?0:y.amount<h.amount?-1:1:y.code<h.code?-1:1}}function i(m){const l=m||{},a=(f,p)=>{const y=[];for(const P of f||[]){const W=L(P);W&&y.push(W)}if(!y.length)return null;if(new Set(y.map(P=>P.code)).size===1){const P=y[0].code;return{amount:p(y.map(W=>W.amount)),code:P}}const d=I(l.display);if(!d)return`${l.missingRate??K}: mixed currencies, no display currency set`;const w=l.rateFn||j(l.rates,l.rateBase),v=[];for(const P of y){const W=k(P,d,w);if(W===null)return`${l.missingRate??K}: ${P.code}→${d}`;v.push(W)}return{amount:p(v),code:d}},c=f=>f.reduce((p,y)=>p+y,0);return{sum:f=>a(f,c),avg:f=>a(f,p=>c(p)/p.length),min:f=>a(f,p=>Math.min(...p)),max:f=>a(f,p=>Math.max(...p))}}function s(m){const l=Object.freeze({code:"USD",...m||{}}),a=j(l.rates,l.rateBase),c=Object.freeze({...l,rateFn:a}),f=i(c),p=t(c),y=new Map([[l.locale||"",c]]),h=v=>{const P=v||"";let W=y.get(P);return W||(W=Object.freeze({...c,locale:v||void 0}),y.set(P,W)),W},d=U[I(l.display||l.code)]||"",w=typeof l.decimals=="number"&&l.decimals>0?`.${"0".repeat(l.decimals)}`:".00";return{base:"object",extends:"object",storage:"object",name:"currency",currencyConfig:c,format:v=>g(v.value,v.locale?h(v.locale):c),parse:v=>R(v.text,v.locale?h(v.locale):c),compare:p,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:f},excel:l.excel||(d?`"${d}"#,##0${w}`:`#,##0${w}`),toStorage:v=>{const P=L(v);return P||(typeof v=="string"||typeof v=="number"?R(v,c):null)},toClipboard:v=>o(v),fromClipboard:v=>R(v,c)}}const r=Object.freeze({currency:s({code:"USD"}),usd:s({code:"USD"}),eur:s({code:"EUR"}),gbp:s({code:"GBP"}),jpy:s({code:"JPY",decimals:0})}),n=s}),_e("packages/core/src/columns/types/index.js",function(e,F){"use strict";Object.defineProperty(e,"EXTENDED_TYPES",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return _}});const ie=F("packages/core/src/columns/types/temporal.js"),E=ie.TEMPORAL_TYPES,K=F("packages/core/src/columns/types/network.js"),I=K.NETWORK_TYPES,L=F("packages/core/src/columns/types/vlan.js"),Q=L.VLAN_TYPES,U=F("packages/core/src/columns/types/structured.js"),x=U.STRUCTURED_TYPES,q=F("packages/core/src/columns/types/unit.js"),R=q.createUnitType,j=q.UNIT_SYSTEMS,k=q.parseUnit,b=q.formatUnit,u=q.registerUnitSystem,g=q.unitSystemNames,o=q.unitsOf,t=q.defineUnit,i=F("packages/core/src/columns/types/engineering.js"),s=i.ENGINEERING_TYPES,r=F("packages/core/src/columns/types/si.js"),n=r.SI_TYPES,m=r.createSiType,l=r.createSiSystem,a=r.siUnits,c=r.SI_PREFIXES,f=F("packages/core/src/columns/types/temperature.js"),p=f.TEMPERATURE_TYPES,y=f.createTemperatureType,h=f.convertTemperature,d=f.formatTemperature,w=f.parseTemperature,v=f.TEMPERATURE_SCALES,P=F("packages/core/src/columns/types/radix.js"),W=P.createRadixType,V=P.RADIX_PRESETS,G=P.parseRadix,_=P.formatRadix,T=F("packages/core/src/columns/types/aggregable.js"),S=T.AGGREGABLE_TYPES,O=F("packages/core/src/columns/types/currency.js"),M=O.CURRENCY_TYPES,A=O.createCurrencyType,N=O.parseMoney,$=O.formatMoney,H=O.convertMoney,Y=O.toMoney,Z=O.rateFunction,J=O.moneyComparator,D=O.normaliseCode,te=O.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return q.findUnit}}),Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return i.ENGINEERING_TYPES}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return i.circularMean}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return f.TEMPERATURE_TYPES}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return f.createTemperatureType}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return f.convertTemperature}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return f.formatTemperature}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return f.parseTemperature}}),Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return f.TEMPERATURE_SCALES}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return f.findScale}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return O.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return O.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return O.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return O.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return O.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return O.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return O.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return O.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return O.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return O.MISSING_RATE}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return ie.TEMPORAL_TYPES}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return K.NETWORK_TYPES}}),Object.defineProperty(e,"VLAN_TYPES",{enumerable:!0,get:function(){return L.VLAN_TYPES}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return U.STRUCTURED_TYPES}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return T.AGGREGABLE_TYPES}}),Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return T.createLogarithmicType}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return T.createRatioType}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return ie.parseTime}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return ie.formatTime}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return ie.parseDateTime}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return ie.formatDateTime}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return ie.parseDuration}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return ie.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,"parseMac",{enumerable:!0,get:function(){return K.parseMac}}),Object.defineProperty(e,"formatMac",{enumerable:!0,get:function(){return K.formatMac}}),Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return K.isMac}}),Object.defineProperty(e,"compareMac",{enumerable:!0,get:function(){return K.compareMac}}),Object.defineProperty(e,"macValue",{enumerable:!0,get:function(){return K.macValue}}),Object.defineProperty(e,"macHex",{enumerable:!0,get:function(){return K.macHex}}),Object.defineProperty(e,"macContains",{enumerable:!0,get:function(){return K.macContains}}),Object.defineProperty(e,"MAC_OPERATORS",{enumerable:!0,get:function(){return K.MAC_OPERATORS}}),Object.defineProperty(e,"parseVlans",{enumerable:!0,get:function(){return L.parseVlans}}),Object.defineProperty(e,"formatVlans",{enumerable:!0,get:function(){return L.formatVlans}}),Object.defineProperty(e,"vlanContains",{enumerable:!0,get:function(){return L.vlanContains}}),Object.defineProperty(e,"vlanOverlaps",{enumerable:!0,get:function(){return L.vlanOverlaps}}),Object.defineProperty(e,"vlanCount",{enumerable:!0,get:function(){return L.vlanCount}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return U.maskValue}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return U.summariseJson}});const z=Object.freeze({...E,...I,...Q,...x,...S,hex:W(V.hex),hex8:W(V.hex8),hex16:W(V.hex16),hex32:W(V.hex32),binary:W(V.binary),binary8:W(V.binary8),octal:W(V.octal),bytes:R({system:"data",unit:"B",display:"auto"}),megabytes:R({system:"data",unit:"MB"}),gigabytes:R({system:"data",unit:"GB"}),bitrate:R({system:"bitrate",unit:"Mbps"}),gigabits:R({system:"bitrate",unit:"Gbps"}),...s,...n,...p,...M});{const X=new Set;for(const ne of[E,I,Q,x,S,s,n,p,M])for(const se of Object.keys(ne)){if(X.has(se))throw new Error(`[lattice] data type "${se}" is declared twice`);X.add(se)}}}),_e("packages/core/src/compute/handle.js",function(e,F){"use strict";Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return R}}),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 b}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return s}});const ie=F("packages/core/src/internal/compare.js"),E=ie.collator,K=ie.defaultCompare,L=F("packages/core/src/internal/warn.js").warnOnce;function Q(r){const n=new Uint32Array(r);for(let m=0;m<r;m++)n[m]=m;return n}function U(r,n){if(n&&typeof n.count=="number")return n.count;if(!r)return 0;if(typeof r.count=="number")return r.count;if(typeof r.length=="number")return r.length;const m=r.values;return r.kind==="multi"&&r.offsets?Math.max(0,r.offsets.length-1):m?r.kind==="bitset"?typeof m.size=="number"?m.size:r.presence&&typeof r.presence.size=="number"?r.presence.size:(L(`count:${r.id}`,`column "${r.id}" is bitset-backed with no declared row count; assuming ${m.length*8}`),m.length*8):m.length:r.presence&&typeof r.presence.size=="number"?r.presence.size:0}const x=new WeakMap;function q(r){const n=r.constructor;if(!n)return"unknown";const m=x.get(n);if(m)return m;let l="unknown";try{let a=null;typeof n.from=="function"?a=n.from([!1,!0]):(a=new n(8),a.set(1));const c=a&&a.words;c&&c.length&&(c[0]===2?l="lsb":c[0]===64&&(l="msb"))}catch{l="unknown"}return x.set(n,l),l}function R(r){if(!r)return()=>0;const n=r instanceof Uint8Array?r:r.words;if(n instanceof Uint8Array){const m=r instanceof Uint8Array?"lsb":q(r);if(m==="lsb")return l=>n[l>>>3]>>>(l&7)&1;if(m==="msb")return l=>n[l>>>3]>>>7-(l&7)&1}return typeof r.get=="function"?m=>r.get(m)?1:0:()=>0}function j(r){return!r||!r.presence?null:R(r.presence)}function k(r){return r?typeof r.size=="number"?r.size:typeof r.values=="function"?r.values().length:0:0}function b(r,n){return r?typeof r.valueOf=="function"?r.valueOf(n):typeof r.values=="function"?r.values()[n]:null:null}function u(r,n){const m=r.offsets,l=r.values;if(!m||!l)return[];const a=m[n],c=m[n+1];if(!(c>a))return[];const f=r.dict,p=new Array(c-a);for(let y=a;y<c;y++)p[y-a]=f?b(f,l[y]):l[y];return p}function g(r){if(!r)return()=>{};const n=r.values,m=j(r),l=r.kind;if(l==="dictionary"){const a=r.dict;return m?c=>m(c)?b(a,n[c]):null:c=>b(a,n[c])}if(l==="bitset"){const a=R(n);return m?c=>m(c)?a(c)===1:null:c=>a(c)===1}if(l==="multi")return m?a=>m(a)?u(r,a):null:a=>u(r,a);if(!n&&typeof r.get=="function"){const a=r.get.bind(r);return c=>{const f=a(c);return f===void 0?null:f}}return m?a=>{if(!m(a))return null;const c=n[a];return c===void 0?null:c}:a=>{const c=n[a];return c===void 0?null:c}}function o(r,n){if(r<n)return-1;if(r>n)return 1;if(r===n){const a=Object.is(r,-0),c=Object.is(n,-0);return a===c?0:a?-1:1}const m=Number.isNaN(r),l=Number.isNaN(n);return m&&l?0:m?1:-1}function t(r){const n=E(r);return(m,l)=>{if(m===l)return 0;const a=typeof m,c=typeof l;if(a==="string"&&c==="string")return n.compare(m,l);if(a==="number"&&c==="number")return o(m,l);if(a==="boolean"&&c==="boolean")return m===l?0:m?1:-1;if(m instanceof Date||l instanceof Date){const f=m instanceof Date?m.getTime():Number(m),p=l instanceof Date?l.getTime():Number(l);return o(f,p)}return K(m,l)}}function i(r,n){if(r&&typeof r.ranks=="function")return r.ranks(n);const m=r&&typeof r.values=="function"?r.values():[],l=m.length,a=t(n),c=new Array(l);for(let p=0;p<l;p++)c[p]=p;c.sort((p,y)=>a(m[p],m[y])||p-y);const f=new Uint32Array(l);for(let p=0;p<l;p++)f[c[p]]=p;return f}function s(r){return r==null||typeof r=="number"&&Number.isNaN(r)}}),_e("packages/core/src/compute/filter.js",function(e,F){"use strict";Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"wallMs",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(e,"declaredOperatorFor",{enumerable:!0,get:function(){return ye}});const E=F("packages/core/src/internal/predicates.js").isBlank,I=F("packages/core/src/internal/merge.js").toArray,Q=F("packages/core/src/internal/warn.js").warnOnce,U=F("packages/core/src/format/date.js"),x=U.toDate,q=U.toIsoDate,R=F("packages/core/src/compute/handle.js"),j=R.bitReader,k=R.dictSize,b=R.dictValue,u=R.presenceReader,g=R.valueComparator,o=R.valueReader,t=/^\d{4}-\d{2}-\d{2}$/,i="\0null\0";function s(re,fe){const oe=re&&re.pool;if(oe){const ce=oe.mask||oe.acquireMask||oe.acquire||oe.take;if(typeof ce=="function"){const de=ce.call(oe,fe);if(de&&de.length>=fe)return de}}return new Uint8Array(fe)}function r(re,fe){const oe=re&&re.pool;if(!oe||!fe)return;const ce=oe.release||oe.releaseMask||oe.free||oe.recycle;typeof ce=="function"&&ce.call(oe,fe)}function n(re,fe,oe){return re.fill(oe,0,fe),re}function m(re){return re==null||typeof re=="number"&&Number.isNaN(re)}function l(re,fe){if(re==null)return re;if(fe==="number")return typeof re=="number"?re:Number(re);if(fe==="date"||fe==="dateString"){const oe=q(re);return oe===null?a(re):oe}return fe==="boolean"?typeof re=="boolean"?re:re==="true"||re===1?!0:re==="false"||re===0?!1:!!re:re}function a(re){return re instanceof Date?re.getTime():typeof re=="number"?re:Date.parse(String(re))}function c(re){return typeof re=="number"?re:re instanceof Date?re.getTime():re==null||re===""?NaN:Number(re)}function f(re,fe){const oe=typeof re=="string"?re:String(re);return fe?oe:oe.toLowerCase()}function p(re,fe){return re==null?i:typeof re=="string"?fe?re:re.toLowerCase():re instanceof Date?re.getTime():re}function y(re,fe,oe){const ce=new Set;for(const de of I(re)){const ve=l(de,oe);ce.add(p(ve,fe)),typeof ve=="string"&&ve!==""&&Number.isFinite(Number(ve))?ce.add(Number(ve)):typeof ve=="number"&&Number.isFinite(ve)&&ce.add(p(String(ve),fe))}return ce}function h(re,fe,oe){if(re==null||fe===null||fe===void 0)return re==null&&fe==null;const ce=typeof re,de=typeof fe;return ce==="string"&&de==="string"?oe?re===fe:re.toLowerCase()===fe.toLowerCase():re instanceof Date||fe instanceof Date?a(re)===a(fe):ce==="number"&&de==="number"?re===fe||Number.isNaN(re)&&Number.isNaN(fe):ce==="number"&&de==="string"?re===Number(fe):ce==="string"&&de==="number"?Number(re)===fe:ce==="boolean"||de==="boolean"?re===fe:Array.isArray(re)&&Array.isArray(fe)?re.length===fe.length&&re.every((ve,ke)=>h(ve,fe[ke],oe)):re===fe}function d(re,fe){try{if(re instanceof RegExp){const oe=re.flags.replace(/[gy]/g,"");return new RegExp(re.source,fe||oe.includes("i")?oe:`${oe}i`)}return new RegExp(String(re),fe?"":"i")}catch(oe){return Q(`regex:${String(re)}`,`filter operator "matches" received an invalid pattern: ${String(re)}`,oe),null}}function w(re,fe){if(re&&re.type==="datetime"&&v.has(re.op))return _(re,fe);const oe=T(re,fe),ce=re&&re.type;return ce!=="date"&&ce!=="dateString"?oe:de=>oe(typeof de=="string"&&t.test(de)?de:q(de)??de)}const v=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn"]),P=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3})\d*)?)?)?$/,W=new Map;function V(re,fe){let oe=W.get(fe);if(oe===void 0){try{oe=new Intl.DateTimeFormat("en-CA",{timeZone:fe,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{oe=null}W.set(fe,oe)}if(!oe)return null;const ce={};for(const de of oe.formatToParts(re))de.type!=="literal"&&(ce[de.type]=de.value);return ce}function G(re,fe){if(re==null||re==="")return null;if(typeof re=="string"){const ve=P.exec(re.trim());if(ve)return Date.UTC(+ve[1],+ve[2]-1,+ve[3],+(ve[4]||0),+(ve[5]||0),+(ve[6]||0),+(ve[7]||"0").padEnd(3,"0"))}const oe=x(re);if(!oe)return null;const ce=oe.getUTCMilliseconds(),de=fe?V(oe,fe):null;return de?Date.UTC(+de.year,+de.month-1,+de.day,de.hour==="24"?0:+de.hour,+de.minute,+de.second,ce):Date.UTC(oe.getFullYear(),oe.getMonth(),oe.getDate(),oe.getHours(),oe.getMinutes(),oe.getSeconds(),ce)}function _(re,fe){const oe=typeof re.timeZone=="string"&&re.timeZone?re.timeZone:void 0,ce=ke=>G(ke,oe),de=Array.isArray(re.value)?re.value.map(ce):ce(re.value),ve=T({...re,type:"number",value:de},fe);return ke=>ve(G(ke))}function T(re,fe){const oe=re&&re.op,ce=!!(re&&re.caseSensitive),de=re&&re.type,ve=g(fe),ke=Ce=>Le=>!Ce(Le);switch(oe){case"eq":{const Ce=ye(de,"eq");if(Ce)return Ce.compile(re.value);const Le=l(re.value,de);return we=>h(we,Le,ce)}case"ne":{const Ce=ye(de,"ne");if(Ce)return Ce.compile(re.value);const Le=l(re.value,de);return we=>!h(we,Le,ce)}case"lt":case"lte":case"gt":case"gte":{const Ce=l(re.value,de);if(m(Ce))return()=>!1;const Le=oe==="lt"?-1:oe==="lte"?0:oe==="gt"?1:2;return we=>{if(m(we))return!1;const He=ve(we,Ce);return Le===-1?He<0:Le===0?He<=0:Le===1?He>0:He>=0}}case"between":case"notBetween":{const Ce=I(re.value),Le=l(Ce[0],de),we=l(Ce[1],de),He=re.bounds||"[]",Te=He.charAt(0)!=="(",Ae=He.charAt(1)!==")";if(m(Le)||m(we))return oe==="between"?()=>!1:()=>!0;const Se=Ee=>{if(m(Ee))return!1;const Me=ve(Ee,Le),Be=ve(Ee,we);return(Te?Me>=0:Me>0)&&(Ae?Be<=0:Be<0)};return oe==="between"?Se:ke(Se)}case"in":case"notIn":{const Ce=y(re.value,ce,de),Le=we=>Ce.has(p(we,ce));return oe==="in"?Le:ke(Le)}case"contains":case"notContains":{const Ce=ye(de,oe);if(Ce)return Ce.compile(re.value);const Le=f(l(re.value,de),ce),we=He=>He==null?!1:f(He,ce).includes(Le);return oe==="contains"?we:ke(we)}case"startsWith":{const Ce=ye(de,"startsWith");if(Ce)return Ce.compile(re.value);const Le=f(l(re.value,de),ce);return we=>we==null?!1:f(we,ce).startsWith(Le)}case"endsWith":{const Ce=ye(de,"endsWith");if(Ce)return Ce.compile(re.value);const Le=f(l(re.value,de),ce);return we=>we==null?!1:f(we,ce).endsWith(Le)}case"matches":{const Ce=d(re.value,ce);return Ce?Le=>Le==null?!1:Ce.test(String(Le)):()=>!1}case"blank":case"notBlank":{const Ce=re.trim===!0,Le=we=>E(we)||Array.isArray(we)&&we.length===0||Ce&&typeof we=="string"&&we.trim()==="";return oe==="blank"?Le:we=>!Le(we)}case"containsAny":case"containsNone":{const Ce=y(re.value,ce,de),Le=we=>{const He=we==null?[]:I(we);for(let Te=0;Te<He.length;Te++)if(Ce.has(p(He[Te],ce)))return!0;return!1};return oe==="containsAny"?Le:ke(Le)}case"containsAll":{const Ce=I(re.value).map(Le=>p(l(Le,de),ce));return Le=>{const we=Le==null?[]:I(Le);if(Ce.length===0)return!0;const He=new Set(we.map(Te=>p(Te,ce)));for(let Te=0;Te<Ce.length;Te++)if(!He.has(Ce[Te]))return!1;return!0}}default:{const Ce=xe(oe);return Ce?Ce.compile(re.value):(Q(`op:${String(oe)}`,`unknown filter operator "${String(oe)}"; the condition is refused rather than matching every row`),()=>!1)}}}function S(re,fe,oe){return w(fe,oe)(re)}const O=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),M=new Set(["containsAny","containsAll","containsNone"]);function A(re,fe,oe){const ce=re&&re.op,de=O[ce]||ce,ve=w({...re,op:de,type:fe.type},oe),ke=fe.items,Ce=Le=>{const we=ke(Le);if(!we)return!1;for(let He=0;He<we.length;He++)if(ve(we[He]))return!0;return!1};return O[ce]?Le=>!Ce(Le):Ce}function N(re,fe,oe,ce,de){const ve=de?null:u(re);if(ve){const Le=fe?1:0;for(let we=0;we<ce;we++)oe[we]=ve(we)===Le?1:0;return oe}const ke=re.kind;if(ke==="float64"||ke==="int32"||ke==="bitset")return n(oe,ce,fe?1:0);const Ce=o(re);for(let Le=0;Le<ce;Le++){const we=Ce(Le),He=E(we)||Array.isArray(we)&&we.length===0||de&&typeof we=="string"&&we.trim()==="";oe[Le]=He===fe?0:1}return oe}function $(re,fe,oe,ce){const de=re.dict,ve=k(de),ke=new Uint8Array(ve);for(let He=0;He<ve;He++)ke[He]=fe(b(de,He))?1:0;const Ce=re.values,Le=u(re);if(!Le){for(let He=0;He<ce;He++)oe[He]=ke[Ce[He]];return oe}const we=fe(null)?1:0;for(let He=0;He<ce;He++)oe[He]=Le(He)===1?ke[Ce[He]]:we;return oe}function H(re,fe,oe,ce){const de=j(re.values),ve=fe(!0)?1:0,ke=fe(!1)?1:0,Ce=u(re);if(!Ce){for(let we=0;we<ce;we++)oe[we]=de(we)===1?ve:ke;return oe}const Le=fe(null)?1:0;for(let we=0;we<ce;we++)oe[we]=Ce(we)===0?Le:de(we)===1?ve:ke;return oe}function Y(re,fe,oe,ce,de){const ve=re.values,ke=fe.type,Ce=fe.op;let Le=!0;switch(Ce){case"eq":case"ne":{const He=c(l(fe.value,ke)),Te=typeof fe.value=="number"&&Number.isNaN(fe.value),Ae=Ce==="ne"?1:0;if(Te)for(let Se=0;Se<de;Se++)ce[Se]=(Number.isNaN(ve[Se])?1:0)^Ae;else for(let Se=0;Se<de;Se++)ce[Se]=(ve[Se]===He?1:0)^Ae;break}case"lt":{const He=c(l(fe.value,ke));for(let Te=0;Te<de;Te++)ce[Te]=ve[Te]<He?1:0;break}case"lte":{const He=c(l(fe.value,ke));for(let Te=0;Te<de;Te++)ce[Te]=ve[Te]<=He?1:0;break}case"gt":{const He=c(l(fe.value,ke));for(let Te=0;Te<de;Te++)ce[Te]=ve[Te]>He?1:0;break}case"gte":{const He=c(l(fe.value,ke));for(let Te=0;Te<de;Te++)ce[Te]=ve[Te]>=He?1:0;break}case"between":case"notBetween":{const He=I(fe.value),Te=c(l(He[0],ke)),Ae=c(l(He[1],ke)),Se=fe.bounds||"[]",Ee=Se.charAt(0)!=="(",Me=Se.charAt(1)!==")",Be=Ce==="notBetween"?1:0;if(Ee&&Me)for(let Ke=0;Ke<de;Ke++)ce[Ke]=(ve[Ke]>=Te&ve[Ke]<=Ae?1:0)^Be;else if(Ee)for(let Ke=0;Ke<de;Ke++)ce[Ke]=(ve[Ke]>=Te&ve[Ke]<Ae?1:0)^Be;else if(Me)for(let Ke=0;Ke<de;Ke++)ce[Ke]=(ve[Ke]>Te&ve[Ke]<=Ae?1:0)^Be;else for(let Ke=0;Ke<de;Ke++)ce[Ke]=(ve[Ke]>Te&ve[Ke]<Ae?1:0)^Be;break}case"in":case"notIn":{const He=new Set;for(const Ae of I(fe.value)){const Se=c(l(Ae,ke));Number.isNaN(Se)||He.add(Se)}const Te=Ce==="notIn"?1:0;for(let Ae=0;Ae<de;Ae++)ce[Ae]=(He.has(ve[Ae])?1:0)^Te;break}default:Le=!1;break}if(!Le)return!1;const we=u(re);if(we){const He=oe(null)?1:0;for(let Te=0;Te<de;Te++)we(Te)===0&&(ce[Te]=He)}return!0}function Z(re,fe,oe,ce){const de=o(re);for(let ve=0;ve<ce;ve++)oe[ve]=fe(de(ve))?1:0;return oe}function J(re,fe){if(!re||!Oe.has(re.op))return re;const oe=fe&&fe.typeOf;if(typeof oe!="function")return re;const ce=oe(re.col);return typeof ce!="string"||!ce||ce===re.type?re:{...re,type:ce}}function D(re,fe,oe){const ce=fe.count|0,de=oe||s(fe,ce);if(!re)return n(de,ce,1);const ve=typeof fe.handle=="function"?fe.handle(re.col):void 0,ke=typeof fe.custom=="function"?fe.custom:null;if(!ve){if(ke){for(let He=0;He<ce;He++)de[He]=ke(re,He)?1:0;return de}return Q(`filter:col:${String(re.col)}`,`filter references unknown column "${String(re.col)}"; the condition is refused rather than matching every row`),n(de,ce,0)}const Ce=re.op;if(Ce==="blank"||Ce==="notBlank")return N(ve,Ce==="notBlank",de,ce,re.trim===!0);const Le=typeof fe.itemwise=="function"?fe.itemwise(re.col):null;if(Le&&!xe(Ce)&&!M.has(Ce))return Z(ve,A(re,Le,fe.locale),de,ce);const we=w(J(re,fe),fe.locale);switch(ve.kind){case"dictionary":return $(ve,we,de,ce);case"bitset":return H(ve,we,de,ce);case"float64":case"int32":return Y(ve,re,we,de,ce)?de:Z(ve,we,de,ce);default:return Z(ve,we,de,ce)}}function te(re,fe,oe){if(!re)return n(s(fe,oe),oe,1);if(Array.isArray(re.conditions)){const ce=re.conditions.filter(ke=>ke!=null),de=re.op==="or"?"or":re.op==="not"?"not":"and";if(ce.length===0)return n(s(fe,oe),oe,1);const ve=te(ce[0],fe,oe);for(let ke=1;ke<ce.length;ke++){const Ce=te(ce[ke],fe,oe);if(de==="or")for(let Le=0;Le<oe;Le++)ve[Le]|=Ce[Le];else for(let Le=0;Le<oe;Le++)ve[Le]&=Ce[Le];r(fe,Ce)}if(de==="not")for(let ke=0;ke<oe;ke++)ve[ke]^=1;return ve}return D(re,fe,s(fe,oe))}function z(re,fe){return te(re,fe,fe.count|0)}function X(re,fe){if(!re||!fe)return re||null;const oe=re;if(Array.isArray(oe.conditions)){if((oe.op==="or"?"or":oe.op==="not"?"not":"and")!=="and")return ne(oe,fe)?null:re;const de=[];for(const ve of oe.conditions){const ke=X(ve,fe);ke&&de.push(ke)}return de.length?{...oe,op:"and",conditions:de}:null}return oe.col===fe?null:re}function ne(re,fe){if(!re||typeof re!="object")return!1;const oe=re;if(oe.col===fe)return!0;if(Array.isArray(oe.conditions)){for(const ce of oe.conditions)if(ne(ce,fe))return!0}return!1}function se(re,fe,oe){if(oe&&oe.length>=fe){let ke=0;for(let Ce=0;Ce<fe;Ce++)re[Ce]&&(oe[ke++]=Ce);return oe.subarray(0,ke)}let ce=0;for(let ke=0;ke<fe;ke++)ce+=re[ke]?1:0;const de=new Uint32Array(ce);let ve=0;for(let ke=0;ke<fe;ke++)re[ke]&&(de[ve++]=ke);return de}const ue=new Map,ge=new Map,Oe=new Set,Pe=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn","contains","notContains","startsWith","endsWith","matches","blank","notBlank","containsAny","containsAll","containsNone"]);function Ie(re,fe){if(!re||typeof re!="object")return;const oe=Object.entries(re).filter(([,ce])=>ce&&typeof ce.compile=="function");if(typeof fe=="string"&&fe){let ce=ge.get(fe);ce||(ce=new Map,ge.set(fe,ce));for(const[de,ve]of oe)ce.set(de,ve)}for(const[ce,de]of oe)Pe.has(ce)?Oe.add(ce):ue.set(ce,de)}function xe(re){return typeof re=="string"?ue.get(re):void 0}function ye(re,fe){if(typeof re!="string"||typeof fe!="string")return;const oe=ge.get(re);return oe?oe.get(fe):void 0}}),_e("packages/core/src/columns/datatypes.js",function(e,F){"use strict";Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"parseNumberText",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"BUILTIN_TYPES",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return N}});const ie=F("packages/core/src/internal/compare.js"),E=ie.collator,K=ie.defaultCompare,I=F("packages/core/src/internal/predicates.js"),L=I.isNil,Q=I.isObject,U=I.isFunction,x=F("packages/core/src/internal/warn.js"),q=x.fail,R=x.infoOnce,k=F("packages/core/src/internal/text.js").titleCase,b=F("packages/core/src/format/date.js"),u=b.toDate,g=b.toIsoDate,o=b.compareIso,i=F("packages/core/src/format/boolean.js").toTriState,r=F("packages/core/src/columns/types/index.js").EXTENDED_TYPES,n=F("packages/core/src/formula/index.js"),m=n.evaluateFormula,l=n.looksLikeFormula,c=F("packages/core/src/compute/filter.js").declareOperators,f=/^\d{4}-\d{2}-\d{2}$/;function p($){return $.getHours()===0&&$.getMinutes()===0&&$.getSeconds()===0&&$.getMilliseconds()===0}const y=new Map;function h($){const H=$||"",Y=y.get(H);if(Y)return Y;const Z={group:",",decimal:"."};try{for(const J of new Intl.NumberFormat($||void 0).formatToParts(12345.6))J.type==="group"?Z.group=J.value:J.type==="decimal"&&(Z.decimal=J.value)}catch{}return y.set(H,Z),Z}const d=/\d\s*[*/^]\s*[\d.(]/;function w($,H){if(L($))return null;let Y=String($).trim();if(Y===""||Y.startsWith("=")||d.test(Y))return null;let Z=1;Y.startsWith("(")&&Y.endsWith(")")&&(Z=-1,Y=Y.slice(1,-1));const J=Y.endsWith("%"),{group:D,decimal:te}=h(H);if(Y=Y.replace(/[\s\u00a0\u202f\u2009']/g,""),D&&D!=="."&&D!==","&&(Y=Y.split(D).join("")),Y=Y.replace(/[^0-9eE+\-.,]/g,""),te===","?Y=Y.split(".").join("").replace(",","."):Y=Y.split(",").join(""),Y===""||Y==="-"||Y==="+")return null;const z=Number(Y);return Number.isNaN(z)?null:Z*(J?z/100:z)}function v($,H){const Y=L($)||Number.isNaN($)?null:Number($),Z=L(H)||Number.isNaN(H)?null:Number(H);return Y===null?Z===null?0:1:Z===null||Y<Z?-1:Y>Z?1:0}function P($,H){const Y=i($),Z=i(H);return Y===null?Z===null?0:1:Z===null?-1:Y===Z?0:Y?1:-1}function W($,H){const Y=u($),Z=u(H);if(!Y)return Z?1:0;if(!Z)return-1;const J=Y.getTime(),D=Z.getTime();return J<D?-1:J>D?1:0}const V=new Map;function G($){const H=u($.value);if(!H)return"";const Y=$.locale||"";let Z=V.get(Y);return Z||(Z=new Intl.DateTimeFormat($.locale||void 0,{dateStyle:"medium"}),V.set(Y,Z)),Z.format(H)}const _={boolean:{base:"boolean",storage:"bitset",matches:$=>typeof $=="boolean",parse:$=>i($.text),compare:P,format:$=>i($.value)===null?"":i($.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:$=>i($)===null?"":String(i($)),fromClipboard:$=>i($)},number:{base:"number",storage:"float64",matches:$=>typeof $=="number"&&!Number.isNaN($),parse:$=>{if(l($.text)){const H=m($.text,$);if(!H.ok)return null;const Y=Number(H.value);return Number.isFinite(Y)?Y:null}return w($.text,$.locale)},compare:v,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:$=>L($)?"":String($),fromClipboard:($,H)=>w($,H&&H.locale),toStorage:($,H)=>{if(typeof $!="string")return $;const Y=w($,H&&H.locale);return Y!==null?Y:(R(`type.number.unparsed.${H&&H.colId||""}`,`column "${H&&H.colId||"?"}" is declared type "number" but holds a value that is not a number in its locale; storing it as NaN, excluded from sorts and totals.`),NaN)}},date:{base:"dateString",storage:"dictionary",matches:$=>typeof $=="string"&&f.test($)&&!Number.isNaN(Date.parse($))||$ instanceof Date&&!Number.isNaN($.getTime())&&p($),parse:$=>g($.text),compare:o,format:G,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:$=>g($),toClipboard:$=>L($)?"":String($),fromClipboard:$=>g($)},dateString:{base:"dateString",storage:"dictionary",matches:$=>typeof $=="string"&&f.test($)&&!Number.isNaN(Date.parse($)),parse:$=>g($.text),compare:o,format:G,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:$=>g($),toClipboard:$=>L($)?"":String($),fromClipboard:$=>g($)},text:{base:"text",storage:"dictionary",matches:$=>typeof $=="string",parse:$=>$.text===""?null:String($.text),compare:($,H)=>L($)?L(H)?0:1:L(H)?-1:E().compare(String($),String(H)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:$=>L($)?"":String($),fromClipboard:$=>$},image:{base:"text",storage:"dictionary",parse:$=>$.text===""||$.text==null?null:String($.text).trim(),compare:($,H)=>L($)?L(H)?0:1:L(H)?-1:E().compare(String($),String(H)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:$=>L($)?"":String($),fromClipboard:$=>$},lookup:{base:"text",storage:"dictionary",parse:$=>{if($.text===""||$.text==null)return null;const H=$.column&&$.column.lookup,Y=H&&U(H.options)?H.options():null;if(!Y)return $.text;const Z=String($.text),J=Y.find(z=>String(z.id)===Z);if(J)return J.id;const D=Z.trim().toLowerCase(),te=Y.find(z=>String(z.label).toLowerCase()===D);return te?te.id:$.text},compare:K,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:$=>L($)?"":String($),fromClipboard:$=>$},object:{base:"object",storage:"object",matches:$=>$!==null&&typeof $=="object"&&!($ instanceof Date),parse:$=>{try{return $.text===""?null:JSON.parse($.text)}catch{return $.text}},compare:($,H)=>K($,H),format:$=>{const H=$.value;if(L(H))return"";if(typeof H=="string")return H;try{return JSON.stringify(H)}catch{return String(H)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:$=>L($)?"":typeof $=="string"?$:JSON.stringify($),fromClipboard:$=>$}},T=["boolean","number","date","dateString","datetime","text","object"];function S($,H,Y,Z){const J=Y.get($);if(J)return J;Z.includes($)&&q(`circular data type extends chain: ${[...Z,$].join(" → ")}`);const D=H[$];D||q(`unknown data type "${$}"`);let te=null;D.extends&&(te=S(D.extends,H,Y,[...Z,$]));const z={...te||{},...D,name:$,defaults:{...te&&te.defaults||{},...D.defaults||{}}};return z.base||(z.base=te&&te.base||"text"),z.storage||(z.storage=te&&te.storage||"object"),Y.set($,z),z}function O($,H){const Y={..._,...r};if(H&&typeof H.dataType=="function"&&typeof H.names=="function")for(const J of H.names("dataType")){const D=H.dataType(J);D&&(Y[J]=D)}if(Q($))for(const[J,D]of Object.entries($))Y[J]=D;const Z=new Map;for(const J of T)S(J,Y,Z,[]);S("lookup",Y,Z,[]);for(const J of Object.keys(Y))S(J,Y,Z,[]);for(const J of Z.values())c(J.operators,J.name);return Z}function M($,H){if($.base==="text"&&(!$.compare||$.compare===_.text.compare)){const Y=E(H);return(Z,J)=>L(Z)?L(J)?0:1:L(J)?-1:Y.compare(String(Z),String(J))}return $.compare||K}function A($,H){return H?$.multiStorage||"multi":$.storage||"object"}function N($){return k(String($).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),_e("packages/core/src/columns/infer.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_SAMPLE",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"inferFromValues",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return U}});const E=F("packages/core/src/internal/warn.js").infoOnce,I=F("packages/core/src/internal/predicates.js").isNil,L=100;function Q(x,q,R={}){const j=R.sampleSize??L,k=[];for(let b=0;b<x.length&&k.length<j;b++){const u=x[b];I(u)||typeof u=="number"&&Number.isNaN(u)||k.push(u)}if(k.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[b,u]of q){if(typeof u.matches!="function")continue;let g=!0;for(let o=0;o<k.length;o++)if(!u.matches(k[o])){g=!1;break}if(g)return{type:b,unanimous:!0,sampled:k.length}}return R.quiet||E(`infer:${R.colId||"?"}`,`column "${R.colId||"?"}" has mixed or ambiguous values and was inferred as "text". Declare \`type\` on the column to get correct sorting, filtering and export.`),{type:"text",unanimous:!1,sampled:k.length}}function U(x,q,R,j,k={}){const b=k.sampleSize??L,u=[];for(let g=0;g<q.length&&u.length<b;g++){const o=R(q[g]);I(o)||typeof o=="number"&&Number.isNaN(o)||u.push(o)}return Q(u,j,{...k,colId:x}).type}}),_e("packages/core/src/columns/graph.js",function(e,F){"use strict";Object.defineProperty(e,"WHOLE_ROW",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"declarationOf",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return j}});const ie=F("packages/core/src/internal/warn.js"),E=ie.DEV,K=ie.fail,I=ie.warnOnce,Q=F("packages/core/src/internal/predicates.js").isFunction,U="*";function x(k){const b=k.value||{};if(!Q(b.compute))return{computed:!1,wholeRow:!1,deps:[],pure:!0};const g=b.pure!==!1;return b.deps===U?{computed:!0,wholeRow:!0,deps:[],pure:g}:Array.isArray(b.deps)?{computed:!0,wholeRow:!1,deps:b.deps.slice(),pure:g}:(I(`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 q(k){const b=new Map;for(const c of k)b.set(c.id,c);const u=new Map,g=new Map,o=new Set,t=new Set,i=new Set,s=new Set;for(const c of k){const f=x(c);if(!f.computed){u.set(c.id,[]);continue}t.add(c.id),(f.pure?i:s).add(c.id),f.wholeRow&&o.add(c.id);const p=[],y=[];for(const h of f.deps)(b.has(h)?p:y).push(h);u.set(c.id,p),y.length&&g.set(c.id,y)}for(const c of i)for(const f of u.get(c))s.has(f)&&K(`pure computed column "${c}" depends on impure column "${f}". Mark it \`value.pure: false\` or make the dependency pure.`);const r=[],n=new Map,m=[],l=c=>{const f=n.get(c);if(f!=="done"){if(f==="open"){const p=m.indexOf(c);K(`circular column dependency: ${[...m.slice(p),c].join(" → ")}`)}n.set(c,"open"),m.push(c);for(const p of u.get(c)||[])b.has(p)&&l(p);m.pop(),n.set(c,"done"),r.push(c)}};for(const c of k)l(c.id);const a=new Map;for(const c of k)a.set(c.id,[]);for(const c of k)for(const f of u.get(c.id)||[]){const p=a.get(f);p&&!p.includes(c.id)&&p.push(c.id)}if(o.size)for(const c of k){if(t.has(c.id))continue;const f=a.get(c.id);for(const p of o)f.includes(p)||f.push(p)}return{order:r,dependents:a,pure:i,impure:s,computed:t,deps:u,wholeRow:o,external:g,index:b}}function R(k,b){const u=Array.isArray(b)?b:[b],g=new Set,o=[...u];for(;o.length;){const t=o.shift();for(const i of k.dependents.get(t)||[])g.has(i)||(g.add(i),o.push(i))}for(const t of u)g.delete(t);return k.order.filter(t=>g.has(t))}function j(k,b,u){if(!E)return k;const g=b instanceof Set?b:new Set(b);return new Proxy(k,{get(o,t){return typeof t=="string"&&!g.has(t)&&!Object.hasOwn(o,t)&&I(`undeclared:${u}:${t}`,`computed column "${u}" read undeclared dependency "${t}". Add it to \`value.deps\` or the value will go stale.`),o[t]}})}}),_e("packages/core/src/model/rowkey.js",function(e,F){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return x}}),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 o}}),Object.defineProperty(e,"splitPathKey",{enumerable:!0,get:function(){return t}});const E=F("packages/core/src/internal/warn.js").warnOnce,I=F("packages/core/src/internal/paths.js").pathGetter,L=F("packages/core/src/internal/predicates.js"),Q=L.isFunction,U=L.isBlank,x=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],q="";function R(i){if(i===null)return"\0n";if(i===void 0)return"\0u";const s=typeof i;if(s==="string")return i;if(s==="number"||s==="bigint"||s==="boolean")return String(i);if(i instanceof Date)return`\0d${i.getTime()}`;try{return`\0o${JSON.stringify(i)}`}catch{return"\0o?"}}function j(i){if(i.length===1)return R(i[0]);let s="";for(let r=0;r<i.length;r++)r&&(s+=q),s+=R(i[r]);return s}function k(i,s={}){const r=s.warn!==!1;if(Q(i)){const n=i;return{stable:!0,fields:[],disabled:[],key(m,l){try{const a=n(m);return Array.isArray(a)?j(a):R(a)}catch(a){return E("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",a),`#${l??-1}`}},keyEmpty(m){try{const l=n(m);return Array.isArray(l)?l.length===0||l.some(U):U(l)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(i)&&i.length>0){const n=i.filter(a=>typeof a=="string"),m=n.map(a=>I(a)),l=m.length;return{stable:!0,fields:n,disabled:[],key(a){const c=new Array(l);for(let f=0;f<l;f++)c[f]=m[f](a);return j(c)},keyEmpty(a){for(let c=0;c<l;c++)if(U(m[c](a)))return!0;return!1},missingFields(a){const c=[];for(let f=0;f<l;f++)U(m[f](a))&&c.push(n[f]);return c}}}if(typeof i=="string"&&i.length>0){const n=I(i);return{stable:!0,fields:[i],disabled:[],key(m){return R(n(m))},keyEmpty(m){return U(n(m))},missingFields(m){return U(n(m))?[i]:[]}}}return r&&E("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${x.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:x.slice(),key(n,m){if(n===null||typeof n!="object")return`#${m??0}:${String(n)}`;let l=b.get(n);return l===void 0&&(l=`#${u++}`,b.set(n,l)),l}}}const b=new WeakMap;let u=0;function g(i,s){if(!i||i.stable===!1||!Q(i.keyEmpty)||!Array.isArray(s)||s.length===0)return;let r=0,n=null,m;for(let f=0;f<s.length;f++){const p=s[f];i.keyEmpty(p)&&(r++,n===null&&(n=Q(i.missingFields)?i.missingFields(p):[],m=p))}if(r===0)return;const l=i.fields.length?i.fields.join(","):"(function)",a=n&&n.length?n.join(", "):i.fields.length?i.fields.join(", "):"the rowKey function",c=m!==null&&typeof m=="object"?Object.keys(m).join(", ")||"(no fields)":String(m);E(`rowKey.emptyValue:${l}`,`rowKey ${a} is missing on ${r} of ${s.length} rows; the first such row has: ${c}. 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 o(i){return j(i)}function t(i){return i.split(q)}}),_e("packages/core/src/columns/lookup.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_SEPARATOR",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"normaliseOption",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"Lookup",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toValueArray",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createLookup",{enumerable:!0,get:function(){return i}});const ie=F("packages/core/src/internal/compare.js"),E=ie.collator,K=ie.defaultCompare,I=F("packages/core/src/internal/predicates.js"),L=I.isFunction,Q=I.isNil,x=F("packages/core/src/internal/warn.js").warnOnce,R=F("packages/core/src/model/rowkey.js").compositeKey,j=", ",k="";function b(s,r,n,m){if(s===null||typeof s!="object")return{id:s,label:s==null?"":String(s)};const l=s[r],a=s[n],c={id:l,label:a==null?String(l??""):String(a)};s.disabled&&(c.disabled=!0),s.variant&&(c.variant=s.variant),s.icon&&(c.icon=s.icon);const f=m?s[m]:s.group;return f!==void 0&&(c.group=f),c}function u(s,r,n=0,m=[],l=[]){for(const a of s||[]){const c=a&&typeof a=="object"?a[r]:null;if(l.push({raw:a,depth:n,path:m}),Array.isArray(c)&&c.length){const f=String(a&&typeof a=="object"?a.label??a.name??a.id??"":a);u(c,r,n+1,[...m,f],l)}}return l}function g(s){return!!s&&typeof s=="object"&&!Array.isArray(s)&&L(s.router&&s.router.subscribe)}class o{#e;#t;#n;#r;#i=[];#s=new Map;#a=new Map;#l=0;#o="idle";#c=null;#u;#f=null;#d=new Map;constructor(r,n={}){this.#e=r||{},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.#o="ready")}get colId(){return this.#t}get version(){return this.#l}get state(){return this.#o}get ready(){return this.#o==="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.#i}setLocale(r){this.#n=r,this.#u=E(r)}#h(r){const n=this.#e,m=n.valueKey||"id",l=n.labelKey||"label",a=n.childrenKey||"children";this.#i=u(r,a).map(c=>{const f=b(c.raw,m,l,n.groupKey);return c.depth&&(f.depth=c.depth,f.path=c.path),f}),this.#s=new Map,this.#a=new Map,this.#i.forEach((c,f)=>{this.#s.set(c.id,c),this.#a.set(c.id,f)}),this.#o="ready",this.#l+=1}load(){if(this.#c)return this.#c;const r=this.#e.options;if(Array.isArray(r)||r===void 0)return this.#c=Promise.resolve(this.#i),this.#c;if(g(r))return this.#c=this.#p(r),this.#c;if(!L(r))return x(`lookup:options:${this.#t}`,`column "${this.#t}" has an invalid \`lookup.options\`; expected an array, a function, or a router route`),this.#o="ready",this.#c=Promise.resolve([]),this.#c;this.#o="loading";let n;try{n=r()}catch(m){return this.#o="error",x(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,m),this.#c=Promise.resolve([]),this.#c}return!n||!L(n.then)?(this.#h(n),this.#c=Promise.resolve(this.#i),this.#r&&this.#r(this),this.#c):(this.#c=n.then(m=>(this.#h(m),this.#r&&this.#r(this),this.#i),m=>(this.#o="error",x(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,m),[])),this.#c)}refresh(){return this.#c=null,Array.isArray(this.#e.options)?(this.#h(this.#e.options),this.#r&&this.#r(this),Promise.resolve(this.#i)):this.load()}#p(r){if(this.#f)return Promise.resolve(this.#i);const n=this.#e,m=n.valueKey||"id",l=n.labelKey||"label",a=n.groupKey,c=L(r.map)?r.map:null,f=y=>b(c?c(y):y,m,l,a).id,p=y=>this.#m(y,c,m,l,a);return r.router.subscribe(r.predicate,p,{rowKey:f}),this.#f=()=>{L(r.router.detach)&&r.router.detach(p)},this.#o="ready",Promise.resolve(this.#i)}#m(r,n,m,l,a){const c=r&&r.add||[],f=r&&r.update||[],p=r&&r.remove||[];if(!(!c.length&&!f.length&&!p.length)){for(const y of c)this.#g(y,n,m,l,a);for(const y of f)this.#g(y,n,m,l,a);for(const y of p){if(!this.#d.has(y))continue;const h=this.#d.get(y);this.#d.delete(y),this.#s.delete(h);const d=this.#i.findIndex(w=>w.id===h);d>=0&&this.#i.splice(d,1)}this.#a=new Map(this.#i.map((y,h)=>[y.id,h])),this.#o="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(r,n,m,l,a){const c=b(n?n(r):r,m,l,a);this.#d.set(R([c.id]),c.id);const f=this.#i.findIndex(p=>p.id===c.id);f>=0?this.#i[f]=c:this.#i.push(c),this.#s.set(c.id,c)}destroy(){this.#f&&(this.#f(),this.#f=null)}search(r,n){const m=this.#e;if(!L(m.search)){const c=String(r||"").toLowerCase();return Promise.resolve(c===""?this.#i:this.#i.filter(f=>f.label.toLowerCase().includes(c)))}const l=m.valueKey||"id",a=m.labelKey||"label";return Promise.resolve(m.search(r,n)).then(c=>(c||[]).map(f=>b(f,l,a,m.groupKey)))}option(r){return this.#s.get(r)}has(r){return this.#s.has(r)}label(r){if(Q(r)||r==="")return"";const n=this.#s.get(r);if(n)return n.label;if(this.#o==="loading"||this.#o==="idle")return"";this.allowCustom||x(`lookup:unknown:${this.#t}`,`column "${this.#t}" holds value ${JSON.stringify(r)} which is not in its lookup options. Showing the raw value; set \`lookup.unknownLabel\` or \`lookup.allowCustom\` to change that.`);const m=this.#e.unknownLabel;return L(m)?String(m(r)??""):typeof m=="string"?m:String(r)}text(r){if(this.multiple){const n=t(r);return n.length===0?"":n.map(m=>this.label(m)).join(this.separator)}return this.label(r)}dictionary(){return this.#i.map(r=>r.id)}sorted(){const r=this.sortBy;if(r==="optionOrder"||r==="count")return this.#i.slice();if(r==="value")return this.#i.slice().sort((m,l)=>K(m.id,l.id));const n=this.#u;return this.#i.slice().sort((m,l)=>n.compare(m.label,l.label))}comparator(){const r=this.sortBy,n=this.multiple,m=this.#u,l=this.#a;if(n&&r==="count")return(c,f)=>t(c).length-t(f).length;const a=n?c=>t(c)[0]:c=>c;return r==="value"?(c,f)=>K(a(c),a(f)):r==="optionOrder"?(c,f)=>{const p=l.has(a(c))?l.get(a(c)):Number.MAX_SAFE_INTEGER,y=l.has(a(f))?l.get(a(f)):Number.MAX_SAFE_INTEGER;return p-y}:(c,f)=>{const p=a(c),y=a(f);return Q(p)?Q(y)?0:1:Q(y)?-1:m.compare(this.label(p),this.label(y))}}groupKey(r){return this.multiple?t(r).map(m=>String(m)).sort().join(k):Q(r)?"":String(r)}countValues(r){return this.multiple?t(r).length:Q(r)?0:1}contains(r,n,m){const l=this.multiple?t(r):Q(r)?[]:[r],a=Array.isArray(n)?n:[n];switch(m){case"containsAll":return a.every(c=>l.includes(c));case"containsNone":return!a.some(c=>l.includes(c));default:return a.some(c=>l.includes(c))}}exportText(r,n="label"){return n==="value"?this.multiple?t(r).join(this.separator):Q(r)?"":String(r):this.text(r)}exportColumns(){const r=this.multiple;return this.#i.map(n=>({id:n.id,label:n.label,has:m=>r?t(m).includes(n.id):m===n.id}))}}function t(s){return Array.isArray(s)?s:Q(s)||s===""?[]:[s]}function i(s,r={}){const n=s.lookup;if(!n)return null;const m=new o(n,{colId:s.id,locale:r.locale,onChange:r.onChange});return!Array.isArray(n.options)&&n.options!==void 0&&m.load(),m}}),_e("packages/core/src/columns/value.js",function(e,F){"use strict";Object.defineProperty(e,"compileDisplay",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"warnImpureUse",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ValuePipeline",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return s}});const E=F("packages/core/src/internal/paths.js").getPath,K=F("packages/core/src/internal/predicates.js"),I=K.isFunction,L=K.isNil,Q=K.isObject,x=F("packages/core/src/internal/lru.js").Lru,R=F("packages/core/src/internal/warn.js").warnOnce,k=F("packages/core/src/format/number.js").compileNumber,u=F("packages/core/src/columns/graph.js").depsProxy,g="\0";function o(l,a={}){const c=a.locale,f=a.grid??null,p=a.context,y=l.value&&l.value.format,h=l.formatter||null,d=l.dataType&&l.dataType.format,w=l.lookup||null,v=(P,W,V)=>({value:P,data:V,row:W,column:l,colId:l.id,grid:f,context:p,locale:c});if(I(y))return(P,W,V)=>{const G=y(v(P,W,V));return G==null?"":String(G)};if(h){if(w){const P=h.kind==="text";return(W,V,G)=>h(P?w.text(W):W,v(W,V,G))}return(P,W,V)=>h(P,v(P,W,V))}if(I(d))return(P,W,V)=>{const G=d(v(P,W,V));return G==null?"":String(G)};if(l.dataType&&l.dataType.base==="number"&&Q(l.typeOptions)&&typeof l.typeOptions.decimals=="number"){const P=k({decimals:l.typeOptions.decimals},c);return W=>P(W)}return w?P=>w.text(P):P=>L(P)?"":typeof P=="string"?P:String(P)}function t(l,a){!l||!l.value||l.value.pure!==!1||R(`impure:${a}:${l.id}`,`column "${l.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${a}. The result is not stable across passes.`)}class i{#e;#t;#n;#r;#i;#s;#a=new x(4096);constructor(a){this.#e=a.columns instanceof Map?a.columns:new Map((a.columns||[]).map(c=>[c.id,c])),this.#t=a.graph,this.#n=a.grid??null,this.#r=a.context,this.#s=a.stored||null,this.#i=a.rowKey||s}get graph(){return this.#t}setGraph(a){this.#t=a,this.#a.clear()}beginPass(){this.#a.clear()}endPass(){this.#a.clear()}invalidate(a){if(this.#a.size===0)return;const c=a&&a.rows?new Set([...a.rows].map(String)):null,f=a&&a.columns?[...a.columns]:null;if(!c&&!f){this.#a.clear();return}const p=f?this.#l(f):null;for(const y of[...this.#a.keys()]){const h=String(y).split(g);h.length===3&&(c&&!c.has(h[0])||p&&!p.has(h[2])||this.#a.delete(y))}}#l(a){const c=new Set,f=this.#t,p=[...a];for(;p.length;){const y=p.pop();if(!c.has(y)){c.add(y);for(const h of f?f.dependents.get(y)||[]:[])p.push(h)}}return c}value(a,c,f){const p=typeof a=="string"?this.#e.get(a):a;if(!p)return;if(!p.computed)return this.#c(p,c,f);if(p.value.pure!==!1&&this.#s&&f&&f.physical!=null&&this.#s.has(p.id))return this.#s.get(p.id,f.physical);if(p.volatile)return this.compute(p,c,f);if(p.value.pure===!1)return this.compute(p,c,f);const y=`${this.#o(c,f)}${g}${p.id}`;if(this.#a.has(y))return this.#a.get(y);const h=this.compute(p,c,f);return this.#a.set(y,h),h}#o(a,c){return`${this.#i(a,c)}${g}${r(a)}`}#c(a,c,f){if(this.#s&&f&&f.physical!=null&&this.#s.has(a.id))return this.#s.get(a.id,f.physical);if(a.field)return a.read?a.read(c):E(c,a.field)}compute(a,c,f){const p=this.#t,y=p&&p.wholeRow.has(a.id);let h;if(y)h=c??{};else{h={};const w=p&&p.deps.get(a.id)||[];for(const P of w)h[P]=this.value(P,c,f);const v=p&&p.external.get(a.id)||[];for(const P of v)h[P]=E(c,P);h=u(h,[...w,...v],a.id)}const d={data:c,row:f,column:a,grid:this.#n,context:this.#r};return a.value.compute(h,d)}values(a,c){const f={},p=this.#t?this.#t.order:[...this.#e.keys()];for(const y of p)f[y]=this.value(y,a,c);return f}text(a,c,f){const p=typeof a=="string"?this.#e.get(a):a;return p?p.formatValue(this.value(p,c,f),f,c):""}key(a,c,f){const p=typeof a=="string"?this.#e.get(a):a;if(!p)return"";const y=this.value(p,c,f);return I(p.value.key)?String(p.value.key(this.#u(p,y,c,f))):p.lookup?p.lookup.groupKey(y):L(y)?"":String(y)}quickFilterText(a,c,f){const p=typeof a=="string"?this.#e.get(a):a;if(!p)return"";if(I(p.value.quickFilterText)){const y=this.value(p,c,f);return String(p.value.quickFilterText(this.#u(p,y,c,f))??"")}return this.text(p,c,f)}#u(a,c,f,p){return{value:c,data:f,row:p,column:a,colId:a.id,grid:this.#n,context:this.#r}}parse(a,c,f,p){const y=typeof a=="string"?this.#e.get(a):a;if(!y)return c;const h={text:c,value:this.value(y,f,p),data:f,row:p,column:y,grid:this.#n,context:this.#r,locale:this.#n&&I(this.#n.get)?this.#n.get("locale"):void 0,formulaFunctions:this.#n&&I(this.#n.get)?this.#n.get("formulaFunctions"):void 0};return I(y.value.parse)?y.value.parse(h):y.dataType&&I(y.dataType.parse)?y.dataType.parse(h):c}validate(a,c,f,p,y){const h=typeof a=="string"?this.#e.get(a):a;if(!h||!I(h.edit.validate))return!0;const d=h.edit.validate({value:c,oldValue:f,data:p,row:y,column:h,grid:this.#n,context:this.#r});return d===!0||d===void 0?!0:String(d)}apply(a,c,f,p){const y=typeof a=="string"?this.#e.get(a):a;if(!y)return!1;const h=this.value(y,f,p);if(I(y.value.apply)){const d=y.value.apply({value:c,oldValue:h,data:f,row:p,column:y,grid:this.#n,context:this.#r});return this.#f(y,f,p),d!==!1}return y.field?h===c?!1:(y.write(f,c),this.#f(y,f,p),!0):(R(`apply:${y.id}`,`column "${y.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(a,c,f,p){const y=typeof a=="string"?this.#e.get(a):a;if(!y)return{ok:!1,value:void 0,oldValue:void 0,changed:!1,error:"unknown column"};const h=this.value(y,f,p),d=this.parse(y,c,f,p),w=this.validate(y,d,h,f,p);if(w!==!0)return{ok:!1,value:d,oldValue:h,changed:!1,error:w};const v=this.apply(y,d,f,p);return{ok:!0,value:d,oldValue:h,changed:v}}#f(a,c,f){if(this.#a.size===0)return;const p=this.#o(c,f);this.#a.delete(`${p}${g}${a.id}`);for(const y of this.#t?this.#t.dependents.get(a.id)||[]:[])this.#a.delete(`${p}${g}${y}`)}}function s(l,a){return a&&a.key!=null?String(a.key):r(l)}function r(l){if(l&&typeof l=="object"){let a=n.get(l);return a===void 0&&(a=`#${m++}`,n.set(l,a)),a}return String(l)}const n=new WeakMap;let m=0}),_e("packages/core/src/model/shadow.js",function(e,F){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"HISTORY_TICK_MAX_MS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"HISTORY_TICK_MIN_MS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return R}}),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 b}}),Object.defineProperty(e,"SPEC_STATUS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"POSITIONAL_KINDS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"SHADOW_LABELS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"specStatusOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ShadowTracker",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"shadowsIn",{enumerable:!0,get:function(){return a}});const E=F("packages/core/src/internal/warn.js").warnOnce,K=2e5,I=20,L=1e3,Q=50;function U(c){return Math.min(L,Math.max(Q,Math.floor(c)))}const x=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"]),q=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),R=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),j=Object.freeze(["cluster","clusterDistance"]),k=.6745,b=3.5,u=Object.freeze({PASS:"PASS",WARN:"WARN",FAIL:"FAIL"}),g=Object.freeze(["rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag"]),o=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(c,f){if(!f)return null;const p=Number.isFinite(Number(f.lower))?Number(f.lower):null,y=Number.isFinite(Number(f.upper))?Number(f.upper):null;if(p===null&&y===null||!Number.isFinite(c))return null;if(p!==null&&c<p||y!==null&&c>y)return u.FAIL;const h=Number.isFinite(Number(f.warnLower))?Number(f.warnLower):null,d=Number.isFinite(Number(f.warnUpper))?Number(f.warnUpper):null;return h!==null&&c<h||d!==null&&c>d?u.WARN:u.PASS}function i(c,f,p){if(!f||typeof f!="object")return null;if(f.kind!=="time")return f.kind!==void 0&&E(`shadow.history.window.kind:${c}`,`a 'history' shadow's 'window' only accepts {kind: 'time', span}; '${f.kind}' is not honoured (a plain count is already what 'depth' means, and a session has no span to divide into buckets), so it reported the original, unwindowed history.`),null;const y=f.minutes!=null?Number(f.minutes)*6e4:Number(f.span);if(!(y>0))return E(`shadow.history.window.span:${c}`,"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 h=Math.max(2,Math.floor(p)||I);return{span:y,bucketMs:Math.max(1,Math.floor(y/h))}}class s{#e;#t=new Map;#n=new Map;#r=new Map;#i=new Map;#s=new Map;#a=new Map;#l=0;#o;#c;#u;#f;#d=new Map;#h=null;#p=null;#m=null;constructor(f){this.#e=f.colId,this.#o=Math.max(2,f.depth||I),this.#c=Math.max(1,f.max||K),this.#u=f.now||(()=>Date.now()),this.#f=i(this.#e,f.historyWindow,this.#o),this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#f}observe(f,p){const y=l(p);if(y===null)return;if(!this.#n.has(f)){this.#p=null,this.#m=null,this.#g(),this.#t.set(f,y),this.#n.set(f,y),this.#r.set(f,0),this.#i.set(f,this.#u()),this.#s.set(f,[y]),this.#f&&this.#d.set(f,[y]),this.#a.set(f,0);return}const h=this.#n.get(f);if(h===y)return;this.#p=null,this.#m=null,this.#n.set(f,y),this.#r.set(f,(this.#r.get(f)||0)+1),this.#i.set(f,this.#u());const d=this.#s.get(f)||[];d.push(y),d.length>this.#o&&d.splice(0,d.length-this.#o),this.#s.set(f,d);const w=Math.sign(y-h),v=this.#a.get(f)||0;this.#a.set(f,Math.sign(v)===w?v+w:w)}#g(){if(this.#n.size<this.#c)return;const f=this.#n.keys().next().value;f!==void 0&&(this.#t.delete(f),this.#n.delete(f),this.#r.delete(f),this.#i.delete(f),this.#s.delete(f),this.#d.delete(f),this.#a.delete(f),this.#l++)}rebase(){for(const[f,p]of this.#n)this.#t.set(f,p);this.#p=null,this.#m=null}reset(){this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#i.clear(),this.#s.clear(),this.#d.clear(),this.#a.clear(),this.#l=0,this.#p=null,this.#m=null,this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}retain(f){const p=f instanceof Set?f:new Set(f);let y=0;for(const h of[...this.#n.keys()])p.has(h)||(this.#t.delete(h),this.#n.delete(h),this.#r.delete(h),this.#i.delete(h),this.#s.delete(h),this.#d.delete(h),this.#a.delete(h),y++);return y&&(this.#p=null,this.#m=null),y}advanceHistoryWindow(f=this.#u()){const p=this.#f;if(!p)return 0;const y=Math.floor(f/p.bucketMs),h=y-this.#h;if(!(h>0))return 0;const d=Math.min(h,this.#o);for(const[w,v]of this.#d){const P=this.#n.get(w);for(let W=0;W<d;W++)v.push(P);v.length>this.#o&&v.splice(0,v.length-this.#o)}return this.#h=y,h}read(f,p,y,h){switch(f){case"updates":return this.#r.has(p)?this.#r.get(p):0;case"updatedAt":{const d=this.#i.get(p);return d===void 0?null:new Date(d)}case"sinceUpdate":{const d=this.#i.get(p);return d===void 0?null:this.#u()-d}case"firstValue":return this.#t.has(p)?this.#t.get(p):null;case"delta":return this.#n.has(p)?this.#n.get(p)-this.#t.get(p):null;case"deltaPercent":{if(!this.#n.has(p))return null;const d=this.#t.get(p);return d?(this.#n.get(p)-d)/Math.abs(d)*100:null}case"rate":{const d=this.#s.get(p),w=this.#i.get(p);if(!d||d.length<2||w===void 0)return null;const v=this.#u()-w,P=d[d.length-1]-d[d.length-2];return v>0?P/v*1e3:P}case"history":return this.#f?this.#d.has(p)?[...this.#d.get(p)]:null:this.#s.has(p)?[...this.#s.get(p)]:null;case"streak":return this.#a.has(p)?this.#a.get(p):0;case"specStatus":return this.#n.has(p)?t(this.#n.get(p),h):null;default:return g.includes(f)?this.#O(f,p,y,h):null}}#b(f){if(f){if(this.#m&&this.#m.only===f)return this.#m.view;const p=this.#y(f);return this.#m={only:f,view:p},p}return this.#p?this.#p:(this.#p=this.#y(null),this.#p)}#y(f){const p=[];for(const[_,T]of this.#n)f&&!f.has(_)||p.push(T);const y=p.sort((_,T)=>_-T);let h=0,d=0,w=0,v=0;for(const _ of y){v+=_,h++;const T=_-d;d+=T/h,w+=T*(_-d)}const P=[];for(const[_,T]of this.#t)f&&!f.has(_)||P.push(T);const W=h?r(y):0,V=y.map(_=>Math.abs(_-W)).sort((_,T)=>_-T),G=h?r(V):0;return{sorted:y,baseline:P.sort((_,T)=>_-T),sum:v,mean:h?d:0,sd:h>1?Math.sqrt(w/(h-1)):0,median:W,mad:G}}#O(f,p,y,h){if(!this.#n.has(p)||y&&!y.has(p))return null;const d=this.#n.get(p),w=this.#b(y),v=w.sorted.length;if(!v)return null;switch(f){case"rank":return v-m(w.sorted,d)+1;case"rankAsc":return n(w.sorted,d)+1;case"rankChange":{if(!this.#t.has(p)||!w.baseline.length)return null;const P=w.baseline.length-m(w.baseline,this.#t.get(p))+1,W=v-m(w.sorted,d)+1;return P-W}case"percentile":return m(w.sorted,d)/v*100;case"quartile":{const P=m(w.sorted,d)/v;return Math.min(4,Math.max(1,Math.ceil(P*4)))}case"zScore":return w.sd?(d-w.mean)/w.sd:null;case"anomalyScore":return w.mad?k*(d-w.median)/w.mad:null;case"anomalyFlag":{if(!w.mad)return null;const P=h&&Number.isFinite(Number(h.threshold))?Number(h.threshold):b;return Math.abs(k*(d-w.median)/w.mad)>P}case"shareOfTotal":return w.sum?d/w.sum*100:null;default:return null}}}function r(c){const f=c.length;if(!f)return 0;const p=(f-1)*.5,y=Math.floor(p),h=Math.ceil(p);return y===h?c[y]:c[y]+(p-y)*(c[h]-c[y])}function n(c,f){let p=0,y=c.length;for(;p<y;){const h=p+y>>1;c[h]<f?p=h+1:y=h}return p}function m(c,f){let p=0,y=c.length;for(;p<y;){const h=p+y>>1;c[h]<=f?p=h+1:y=h}return p}function l(c){if(c==null||c==="")return null;if(c instanceof Date){const p=c.getTime();return Number.isFinite(p)?p:null}const f=typeof c=="number"?c:Number(c);return Number.isFinite(f)?f:null}function a(c){const f=[];for(const p of c||[]){const y=p.shadow;if(!y)continue;const h=typeof y=="string"?{kind:y}:y,d=h.kind;x.includes(d)&&(q.includes(d)||R.includes(d)||j.includes(d)||f.push({colId:p.id||p.field,of:h.of||p.field||p.id,kind:d,depth:h.depth,historyWindow:d==="history"?h.window:void 0}))}return f}}),_e("packages/core/src/columns/model.js",function(e,F){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return Ie}});const ie=F("packages/core/src/internal/merge.js"),E=ie.expand,K=ie.merge,I=ie.toArray,L=F("packages/core/src/internal/warn.js"),Q=L.fail,U=L.warnOnce,x=F("packages/core/src/internal/paths.js"),q=x.getPath,R=x.pathGetter,j=x.pathSetter,b=F("packages/core/src/internal/text.js").humanise,u=F("packages/core/src/internal/predicates.js"),g=u.isFunction,o=u.isObject,i=F("packages/core/src/internal/uid.js").uid,r=F("packages/core/src/format/index.js").compileFormat,n=F("packages/core/src/columns/datatypes.js"),m=n.comparatorFor,l=n.createTypeRegistry,a=n.storageKind,c=F("packages/core/src/columns/infer.js"),f=c.inferColumnType,p=c.DEFAULT_SAMPLE,y=F("packages/core/src/columns/graph.js"),h=y.buildGraph,d=y.affectedBy,v=F("packages/core/src/columns/lookup.js").createLookup,P=F("packages/core/src/columns/value.js"),W=P.compileDisplay,V=P.ValuePipeline,G=P.warnImpureUse,_=F("packages/core/src/model/shadow.js"),T=_.FIT_SHADOW_KINDS,S=_.CLUSTER_SHADOW_KINDS,O=Object.freeze({geometry:"geometry",list:"list"}),M={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},A={centre:"center"},N=new Set(["start","center","end","left","right"]);function $(ye){if(typeof ye!="string")return;const re=ye.toLowerCase();return A[re]?A[re]:N.has(re)?re:void 0}function H(ye){if(typeof ye!="string")return;const re=ye.toLowerCase();return re==="center"||re==="centre"?"middle":re==="top"||re==="middle"||re==="bottom"?re:void 0}const Y=["cell","layout","header"];function Z(ye){if(!o(ye))return{};const re={...ye},fe=(oe,ce)=>{if(ye[oe]===void 0)return;const de=E(ye[oe],ce);de&&Y.includes(oe)&&!o(ye[oe])&&delete de.enabled,re[oe]=de};return fe("sort","direction"),fe("filter","type"),fe("cell","render"),fe("edit","editor"),fe("layout","width"),fe("group","index"),fe("pivot","index"),fe("header","render"),fe("facet","strategy"),re}function J(ye,re){const fe={...ye||{}},oe=o(re)&&o(re.layout)&&re.layout.width!==void 0;return fe.fit==="content"&&!oe&&delete fe.width,fe}const D=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"]),te=new Set(["collapsible","columns","facet","header","id","marryChildren","openByDefault","showWhen","title"]);function z(ye,re,fe,oe){const ce=fe==="columnGroup"?"column group":"column";for(const de of Object.keys(ye))if(!re.has(de)){if(de==="timeZone"&&fe==="column"){U("column.timeZone",`\`timeZone\` is not a column option, so it had no effect on column "${oe}". 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}U(`${fe}.unknown:${de}`,`'${de}' is not a configuration key this grid recognises, so it had no effect on ${ce} "${oe}". Check the spelling against the reference.`)}}function X(ye){o(ye.cell)&&ye.cell.autoHeight!==void 0&&U("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${ye.id||ye.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function ne(ye,re){const fe=re&&g(ye.defaultsFor)?ye.defaultsFor(re):null,oe={...ye.defaults||{},...o(fe)?fe:{}},ce={};return oe.align&&(ce.align=oe.align,ce.cell={align:oe.align},ce.header={align:oe.align}),oe.filter&&(ce.filter=oe.filter==="none"?{enabled:!1,type:"none"}:{enabled:!0,type:oe.filter}),oe.editor&&(ce.edit=oe.editor==="none"?{editor:null}:{editor:oe.editor}),oe.total&&(ce.total=oe.total),oe.render&&(ce.cell={...ce.cell||{},render:oe.render}),ye.export&&(ce.export={...ye.export}),ce}function se(ye){if(typeof ye=="string")return ye.trim()?[ye.trim()]:[];if(!Array.isArray(ye))return[];const re=[];for(const fe of ye){if(typeof fe!="string")continue;const oe=fe.trim();oe&&!re.includes(oe)&&re.push(oe)}return re}class ue{#e=new Map;#t=[];#n=[];#r=new WeakMap;#i;#s;#a;#l;#o;#c;#u(re,fe,oe){if(re&&typeof re=="object"&&!g(re)){const ke=re;return(typeof ke.fn!="string"||!ke.fn)&&Q(`column "${oe}": a total given as an object needs a \`fn\` name, such as { fn: 'percentile', p: 0.9 }.`),ke.fn==="percentile"&&!(typeof ke.p=="number"&&ke.p>=0&&ke.p<=1)&&Q(`column "${oe}": { fn: 'percentile' } needs \`p\`, a number from 0 to 1 (0.9 for the 90th percentile).`),this.#f(ke.fn,fe,oe),Object.freeze({...ke})}const ce=this.#f(re,fe,oe);if(typeof ce!="string"||!this.#d)return ce??null;const de=fe&&fe.totals&&fe.totals.implement;if(de&&g(de[ce])){const ke=de[ce];return ke.totalName=ce,ke}const ve=this.#d.totalFn?.(ce);return g(ve)?ve:ce}#f(re,fe,oe){if(typeof re!="string")return re;const ce=fe&&fe.totals&&fe.totals.supported;if(!Array.isArray(ce)||ce.includes(re))return re;const de=ce.length?ce.join(", "):"none";return Q(`column "${oe}" is typed ${fe.name||"a type"}, for which the total "${re}" is not meaningful. Supported: ${de}. Aggregating it anyway would produce a confident wrong number.`),re}#d;#h;#p;#m;#g;#b;#y=!1;#O;#w;constructor(re={}){this.#s=Z(re.columnDefaults||{}),this.#a=re.columnPresets||{},this.#o=re.locale,this.#l=re.timeZone,this.#c=H(re.verticalAlign),this.#d=re.registry||null,this.#h=re.grid||null,this.#p=re.context,this.#O=re.sampleSize??p,this.#w=re.onChange||null,this.#b=g(re.rowKey)?re.rowKey:void 0,this.#i=l(re.dataTypes,this.#d);const{leaves:fe,groups:oe}=Ie(re.columns||[]);this.#n=oe;for(const ce of fe){ce.facet!==void 0&&this.#r.set(ce.def,ce.facet);const de=this.#A(ce.def,null);if(de.groupPath=ce.path,this.#e.has(de.id)){U(`columns.duplicate:${de.id}`,`two columns resolve to the id '${de.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}ce.column=de,this.#e.set(de.id,de),this.#t.push(de.id)}this.#C(re.stored||null)}#A(re,fe){z(re,D,"column",re.id||re.field||"(unnamed)"),X(re);const oe=Z(re),ce=I(re.preset),de=ce.map(Me=>{const Be=this.#a[Me];return Be?Z(Be):(U(`preset:${Me}`,`unknown column preset "${Me}"; ignoring`),{})}),ve=this.#S(oe,de,fe),ke=this.#i.get(ve)||this.#i.get("text");if(!this.#i.has(ve)&&re.type){const Me=O[ve];U(`type:${ve}`,`unknown data type "${ve}"; falling back to "text"`+(Me?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${Me}'.`:""))}const Ce=g(ke.items)?this.#P(oe,de,re.id||re.field||"(unnamed)"):null;let Le=M;Le=K(Le,this.#s),re.type!==!1&&(Le=K(Le,ne(ke,Ce)));for(const Me of de)Le=K(Le,Me);this.#r.has(re)&&(Le=K(Le,Z({facet:this.#r.get(re)}))),Le=K(Le,oe);const we=Le.edit;we&&we.editor&&we.enabled!==!0&&!g(we.enabled)&&(re.edit||{}).editor&&U(`column.editor-not-enabled:${re.id||re.field}`,`column '${re.id||re.field}' names the editor '${we.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const He=re.id||re.field||i("col");if(re.shadow&&!g(Le.value&&Le.value.compute)){const Me=typeof re.shadow=="string"?{kind:re.shadow}:re.shadow,Be=Me.of||re.field||He,Ke=T.includes(Me.kind),et=S.includes(Me.kind),Je=Ke?Me.model||Me:null,ut=Ke&&Je?[...Array.isArray(Je.predictors)?Je.predictors:[],Je.response].filter(Boolean):null,Ct=et?(Array.isArray(Me.columns)?Me.columns:[]).filter(Boolean):null;Le.value={...Le.value||{},deps:Ct&&Ct.length?Ct:ut&&ut.length?ut:Me.orderBy&&Me.orderBy!==Be?[Be,Me.orderBy]:[Be],pure:!1,compute:(Nt,st)=>{const it=st.grid&&st.grid.statistics;if(!it)return null;const ct=st.row&&st.row.key||it.keyOf(st.data);if(!ct)return null;if(Ke){if(!g(it.fitShadow))return null;const Tt=Me.model?{...Me.model,threshold:Me.threshold}:Me;return it.fitShadow(Me.kind,ct,Tt)}return et?g(it.clusterShadow)?it.clusterShadow(Me.kind,ct,Me):null:it.shadow(Be,Me.kind,ct,Me.scope,Me)}}}if(re.running&&!g(Le.value&&Le.value.compute)){const Me=typeof re.running=="string"?{kind:re.running}:re.running,Be=Me.of||re.field||He;Le.value={...Le.value||{},deps:[Be],pure:!1,compute:(Ke,et)=>{const Je=et.grid&&et.grid.statistics;if(!Je||!g(Je.running))return null;const ut=et.row&&et.row.key||Je.keyOf(et.data);return ut?Je.running(Be,Me.kind||"total",ut):null}},re.sort===void 0&&(Le.sort={...Le.sort||{},enabled:!1})}const Te=re.field??(g(Le.value&&Le.value.compute)?null:re.id??null),Ae=g(Le.value&&Le.value.compute),Se={id:He,field:Te,shadow:re.shadow||null,running:re.running||null,spec:re.spec||null,validation:re.validation||null,volatile:!!(re.shadow||re.running),title:Le.title??b(Te||He),type:ke.name,dataType:ke,itemType:Ce,nullable:Le.nullable!==!1,align:$(oe.cell&&oe.cell.align||oe.align||Le.cell&&Le.cell.align||Le.align||ke.defaults&&ke.defaults.align)||"start",verticalAlign:H(oe.cell&&oe.cell.verticalAlign||oe.verticalAlign||Le.cell&&Le.cell.verticalAlign||Le.verticalAlign)||this.#c,rowSpan:g(Le.rowSpan)?Le.rowSpan:null,colSpan:g(Le.colSpan)?Le.colSpan:null,value:{pure:!0,...Le.value||{}},cell:{...Le.cell||{}},edit:{...Le.edit||{}},sort:{...Le.sort||{}},filter:{...Le.filter||{}},group:{enabled:!1,index:-1,explode:!1,...Le.group||{}},pivot:{enabled:!1,index:-1,...Le.pivot||{}},total:this.#u(Le.total,ke,re.id||re.field||"(unnamed)"),groupTotal:Le.groupTotal===void 0?null:this.#u(Le.groupTotal,ke,re.id||re.field||"(unnamed)"),grandTotal:Le.grandTotal===void 0?null:this.#u(Le.grandTotal,ke,re.id||re.field||"(unnamed)"),tags:se(Le.tags),typeOptions:Le.typeOptions??null,...o(Le[ve])?{[ve]:Le[ve]}:{},layout:J(Le.layout,oe),header:{...Le.header||{}},contextMenu:Le.contextMenu===void 0?null:Le.contextMenu,facet:{...Le.facet||{}},export:{...Le.export||{}},allowGroup:Le.allowGroup!==!1,allowPivot:Le.allowPivot!==!1,allowTotal:Le.allowTotal!==!1,quickFilter:Le.quickFilter!==!1,def:re,format:Le.format,presets:ce,inferred:fe!=null&&!re.type,computed:Ae,diff:re.diff===void 0?void 0:!!re.diff,read:Te?R(Te):null,write:Te?j(Te):null};Se.cell.align=$(oe.cell&&oe.cell.align)||Se.align,Se.header.align=$(oe.header&&oe.header.align)||Se.align;const Ee=Le.lookup||null;return Se.lookup=Ee?v({id:He,lookup:Ee},{locale:this.#o,onChange:()=>{this.#w&&this.#w("lookup",{colId:He})}}):null,Se.group.explode&&Se.lookup&&Se.lookup.multiple&&U(`explode:${He}`,`column "${He}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(Se),Se}#v(re){re.formatter=r(re.format,re.dataType,this.#o,this.#l,re.id),re.formatValue=W(re,{locale:this.#o,grid:this.#h,context:this.#p}),re.itemCompare=re.itemType?m(re.itemType,this.#o):null,re.compare=g(re.value.compare)?re.value.compare:re.lookup?re.lookup.comparator():g(re.dataType.compareFor)?re.dataType.compareFor(re):m(re.dataType,this.#o),re.excel=re.formatter&&re.formatter.ooxml||re.dataType&&re.dataType.excel||"General",re.storeKind=a(re.dataType,!!(re.lookup&&re.lookup.multiple))}#P(re,fe,oe){let ce=o(re.typeOptions)?re.typeOptions:null;for(let Ce=fe.length-1;!ce&&Ce>=0;Ce--)o(fe[Ce].typeOptions)&&(ce=fe[Ce].typeOptions);!ce&&o(this.#s.typeOptions)&&(ce=this.#s.typeOptions);const de=ce&&ce.of!==void 0?ce.of:"text",ve=typeof de=="string"?this.#i.get(de):void 0;return ve&&!g(ve.items)&&ve.storage!=="object"?ve:(U(`type:of:${String(de)}`,`column "${oe}" names "${String(de)}" as its item type (typeOptions.of), which is not ${ve?"a scalar data type":"a known data type"}; its items are read as text.`),this.#i.get("text"))}#S(re,fe,oe){if(re.type===!1)return"text";if(re.type)return re.type;for(let ce=fe.length-1;ce>=0;ce--)if(fe[ce].type)return fe[ce].type;if(this.#s.type)return this.#s.type;if(re.shadow){const ce=typeof re.shadow=="string"?re.shadow:re.shadow.kind;if(ce==="fitInfluence")return"boolean";if(ce==="fitPredicted"||ce==="fitResidual"||ce==="fitStdResidual"||ce==="fitLeverage"||ce==="fitCooksD"||ce==="tsTrend"||ce==="tsSeasonal"||ce==="tsResidual"||ce==="tsCoverage"||ce==="tsSmoothed"||ce==="tsSmoothingAlpha"||ce==="tsSmoothingBeta"||ce==="cluster"||ce==="clusterDistance")return"number"}return oe||(re.lookup?"lookup":"text")}#C(re){const fe=this.all();this.#m=h(fe),this.#g?this.#g.setGraph(this.#m):this.#g=new V({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:re||null,rowKey:this.#b});const oe=this.#g;for(const ce of fe)ce.getValue=(de,ve)=>oe.value(ce,de,ve)}all(){return this.#t.map(re=>this.#e.get(re))}visible(){return this.all().filter(re=>!re.layout.hidden)}get(re){return this.#e.get(re)}groups(){const re=fe=>{const oe=[];for(const ce of fe)Array.isArray(ce.columns)?oe.push({...ce,columns:re(ce.columns)}):ce.column&&oe.push(ce.column);return oe};return re(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#i}affectedBy(re){return d(this.#m,re)}value(re,fe,oe){return this.#g.value(re,fe,oe)}text(re,fe,oe){return this.#g.text(re,fe,oe)}checkImpure(re,fe){G(this.#e.get(re),fe)}setLocale(re){this.#o=re;for(const fe of this.all())fe.lookup&&fe.lookup.setLocale(re),this.#v(fe);this.#w&&this.#w("locale",{locale:re})}infer(re){const fe={};if(this.#y||!Array.isArray(re)||re.length===0)return fe;this.#y=!0;let oe=!1;for(const ce of this.all()){const de=ce.def;if(de.type!==void 0||!ce.field||ce.computed||ce.lookup||this.#E(ce))continue;const ve=ce.read||(Le=>q(Le,ce.field)),ke=f(ce.id,re,ve,this.#i,{sampleSize:this.#O});if(ke===ce.type)continue;fe[ce.id]=ke;const Ce=this.#A(de,ke);Ce.groupPath=ce.groupPath,Ce.layout={...Ce.layout,...ge(ce.layout)},this.#e.set(ce.id,Ce),xe(this.#n,ce.id,Ce),oe=!0}return oe&&this.#C(null),fe}redecorate(re,fe,oe={}){const ce=this.#e.get(re);if(!ce){U(`redecorate:${re}`,`columns.decorate('${re}', …): no column with id '${re}'.`);return}const de=ce.def||{},ve={...o(de.cell)?de.cell:{}};ve.decoration=fe??void 0,oe&&"variant"in oe&&(ve.variant=oe.variant);const ke={...de,cell:ve};this.#r.has(de)&&this.#r.set(ke,this.#r.get(de));const Ce=this.#A(ke,ce.type);return Ce.groupPath=ce.groupPath,Ce.layout={...Ce.layout,...ge(ce.layout)},ce.lookup&&ce.lookup!==Ce.lookup&&g(ce.lookup.destroy)&&ce.lookup.destroy(),this.#e.set(re,Ce),xe(this.#n,re,Ce),this.#C(null),this.#w&&this.#w("decorate",{colId:re}),Ce}destroy(){for(const re of this.#e.values())re.lookup&&g(re.lookup.destroy)&&re.lookup.destroy()}#E(re){for(const fe of re.presets){const oe=this.#a[fe];if(oe&&oe.type)return!0}return!!this.#s.type}#T(re){return!re.computed&&g(re.dataType&&re.dataType.toStorage)}storeReader(re){if(re.computed)return fe=>this.#g.value(re,fe,null);if(this.#T(re)){const fe=re.dataType.toStorage,oe=re.format&&typeof re.format=="object"&&!Array.isArray(re.format)?re.format.locale:void 0,ce={timeZone:this.#l,colId:re.id,itemType:re.itemType||null,locale:oe||this.#o};return de=>fe(re.read(de),ce)}return re.read}storeValue(re,fe){if(!(!re||re.computed)&&g(re.read))return this.storeReader(re)(fe)}storeSchema(){const re=[];for(const fe of this.all()){if(fe.computed&&fe.value.pure===!1||!fe.computed&&!fe.field)continue;const oe=this.storeReader(fe);let ce=null;!fe.computed&&!this.#T(fe)&&typeof fe.field=="string"&&!fe.lookup&&(ce=fe.field);const de={id:fe.id,kind:fe.storeKind,nullable:fe.nullable,read:oe};ce!==null&&(de.field=ce),fe.lookup&&(de.dictionary=fe.lookup.dictionary()),re.push(de)}return re}state(){return this.all().map(re=>({id:re.id,width:re.layout.width,flex:re.layout.flex||void 0,hidden:!!re.layout.hidden,headerWrap:re.header?.wrap===!0?!0:void 0,headerOrientation:re.header?.orientation==="vertical"?"vertical":void 0,pin:re.layout.pin??null,sort:re.sort.direction??null,sortIndex:re.sort.direction?re.sort.order??0:null,groupIndex:re.group.enabled?re.group.index??0:null,pivotIndex:re.pivot.enabled?re.pivot.index??0:null,total:typeof re.total=="string"?re.total:null,groupTotal:typeof re.groupTotal=="string"?re.groupTotal:void 0,grandTotal:typeof re.grandTotal=="string"?re.grandTotal:void 0,decoration:re.cell&&re.cell.decoration!=null?Oe(re.cell.decoration):void 0,variant:re.cell&&re.cell.variant!=null?Oe(re.cell.variant):void 0}))}applyState(re,fe={}){const oe={applied:[],skipped:[]},ce=Array.isArray(re)?re:re&&re.columns||[],de=!Array.isArray(re)&&re&&re.columnOrder||null;for(const ke of ce){if(!ke||!ke.id){oe.skipped.push({key:"?",reason:"no id"});continue}let Ce=this.#e.get(ke.id);if(!Ce){oe.skipped.push({key:ke.id,reason:"unknown column"});continue}if(Object.hasOwn(ke,"decoration")||Object.hasOwn(ke,"variant")){const Le=Ce.cell?Ce.cell.decoration:void 0,we=ke.decoration??null,He=Object.hasOwn(ke,"variant"),Te=He&&!Pe(Ce.cell?Ce.cell.variant:void 0,ke.variant);(!Pe(Le,we)||Te)&&(this.redecorate(ke.id,we,He?{variant:ke.variant??void 0}:{}),Ce=this.#e.get(ke.id)||Ce)}ke.width!=null&&(Ce.layout.width=ke.width),ke.flex!=null&&(Ce.layout.flex=ke.flex),ke.hidden!=null&&(Ce.layout.hidden=!!ke.hidden),ke.headerWrap!==void 0&&(Ce.header.wrap=!!ke.headerWrap),ke.headerOrientation!==void 0&&(Ce.header.orientation=ke.headerOrientation==="vertical"?"vertical":"horizontal"),ke.pin!==void 0&&(Ce.layout.pin=ke.pin),ke.sort!==void 0&&(Ce.sort.direction=ke.sort),ke.sortIndex!=null&&(Ce.sort.order=ke.sortIndex),ke.groupIndex!=null&&(Ce.group.enabled=!0,Ce.group.index=ke.groupIndex),ke.pivotIndex!=null&&(Ce.pivot.enabled=!0,Ce.pivot.index=ke.pivotIndex),ke.total!==void 0&&(Ce.total=ke.total),ke.groupTotal!==void 0&&(Ce.groupTotal=ke.groupTotal),ke.grandTotal!==void 0&&(Ce.grandTotal=ke.grandTotal),oe.applied.push(ke.id)}const ve=de||(fe&&fe.keepOrder?[]:ce.map(ke=>ke&&ke.id).filter(Boolean));if(ve.length){const ke=ve.filter(Le=>this.#e.has(Le)),Ce=this.#t.filter(Le=>!ke.includes(Le));this.#t=[...ke,...Ce]}return this.#w&&this.#w("state",oe),oe}move(re,fe){this.#M(re,fe)&&(this.#R(),this.#w&&this.#w("move",{id:re,to:fe}))}reorder(re){const fe={applied:[],skipped:[]},oe=[];let ce=0;for(const de of Array.isArray(re)?re:[]){const ve=ce++;this.#M(de,ve)&&(fe.applied.push(de),oe.push({id:de,to:ve}))}if(!oe.length)return fe;if(this.#R(),this.#w)for(const de of oe)this.#w("move",de);return fe}#M(re,fe){const oe=this.#t.indexOf(re);if(oe===-1||Math.max(0,Math.min(Number(fe)||0,this.#t.length-1))===oe)return!1;const de=this.#e.get(re);if(de.layout.movable===!1||de.layout.lockPosition)return U(`move:${re}`,`column "${re}" is not movable; the move was ignored`),!1;const ve=this.#N(re,fe);return ve?(U(`move.married:${ve}`,`band "${ve}" declares marryChildren, so its columns stay together; the move was ignored`),!1):(this.#t.splice(oe,1),this.#t.splice(Math.max(0,Math.min(fe,this.#t.length)),0,re),!0)}#N(re,fe){if(!this.#n||!this.#n.length)return null;const oe=this.#t.filter(ke=>ke!==re),ce=Math.max(0,Math.min(fe,oe.length)),de=(ke,Ce)=>{if(Array.isArray(ke.columns)){for(const we of ke.columns)de(we,Ce);return Ce}const Le=ke.column?ke.column.id:ke.id;return Le&&Ce.push(Le),Ce},ve=ke=>{for(const Ce of ke){if(!Array.isArray(Ce.columns))continue;if(Ce.marryChildren===!0){const we=de(Ce,[]),He=we.includes(re),Te=we.map(Ae=>oe.indexOf(Ae)).filter(Ae=>Ae>=0);if(Te.length){const Ae=Math.min(...Te),Se=Math.max(...Te);if(He?ce<Ae||ce>Se+1:ce>Ae&&ce<=Se)return Ce.id}}const Le=ve(Ce.columns);if(Le)return Le}return null};return ve(this.#n)}#R(){const re=new Map(this.#t.map((ce,de)=>[ce,de])),fe=ce=>{if(!Array.isArray(ce.columns)){const ve=ce.column?ce.column.id:ce.id;return re.has(ve)?re.get(ve):1/0}let de=1/0;for(const ve of ce.columns)de=Math.min(de,fe(ve));return de},oe=ce=>{ce.sort((de,ve)=>fe(de)-fe(ve));for(const de of ce)Array.isArray(de.columns)&&oe(de.columns)};oe(this.#n)}#D(re){const fe=oe=>{for(let ce=0;ce<oe.length;ce++){const de=oe[ce];if(Array.isArray(de.columns)){const ve=fe(de.columns);if(ve)return ve}else if(de.column&&de.column.id===re)return oe.splice(ce,1)[0]}return null};return fe(this.#n)}#K(re){const fe=[];for(let oe=re.length-1;oe>=0;oe--){const ce=re[oe];Array.isArray(ce.columns)&&(fe.push(...this.#K(ce.columns)),ce.columns.length===0&&(fe.push(ce.id),re.splice(oe,1)))}return fe}#Y(){const re=(fe,oe,ce)=>{for(const de of fe)Array.isArray(de.columns)?re(de.columns,[...oe,de.id]):de.column&&(de.column.groupPath=oe)};re(this.#n,[])}#x(re){const fe=new Set(re),oe=this.#t.filter(ke=>fe.has(ke));if(!oe.length)return;const ce=Math.min(...oe.map(ke=>this.#t.indexOf(ke))),de=this.#t.slice(0,ce).filter(ke=>!fe.has(ke)),ve=this.#t.slice(ce).filter(ke=>!fe.has(ke));this.#t=[...de,...oe,...ve]}#H(re){const fe=[],oe=ce=>{if(Array.isArray(ce.columns))for(const de of ce.columns)oe(de);else ce.column&&fe.push(ce.column.id)};return oe(re),fe}#F(re){const fe=oe=>{for(const ce of oe){if(!Array.isArray(ce.columns))continue;if(ce.id===re)return{node:ce,parent:oe};const de=fe(ce.columns);if(de)return de}return null};return fe(this.#n)}groupColumns(re,fe={}){const oe=I(re).filter(Ce=>this.#e.has(Ce));if(!oe.length)return U("columns.group.empty","groupColumns was given no known column ids; nothing was grouped."),null;for(const Ce of oe)if(this.#e.get(Ce).layout.lockPosition)return U(`columns.group.locked:${Ce}`,`column "${Ce}" is position-locked and cannot be grouped.`),null;const ce=fe.groupId?this.#F(fe.groupId):null;if(fe.groupId&&!ce)return U(`columns.group.unknown:${fe.groupId}`,`no band "${fe.groupId}" to add to; nothing was grouped.`),null;let de=null;if(!ce&&fe.id!=null&&(de=String(fe.id),this.#F(de)||this.#e.has(de)))return U(`columns.group.idtaken:${de}`,`band id "${de}" is already in use; nothing was grouped.`),null;const ve=oe.map(Ce=>this.#D(Ce)).filter(Boolean);if(!ve.length)return null;let ke;if(ce)ce.node.columns.push(...ve),ke=ce.node.id;else{const Ce={id:de||i("grp"),title:fe.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:ve},Le=Number.isInteger(fe.at)?Math.max(0,Math.min(fe.at,this.#n.length)):this.#n.length;this.#n.splice(Le,0,Ce),ke=Ce.id}return this.#K(this.#n),this.#x(oe),this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"formed",groupId:ke,ids:oe}),ke}ungroupColumn(re){const fe=this.#e.get(re);if(!fe){U(`columns.ungroup.unknown:${re}`,`no column "${re}" to ungroup.`);return}const oe=fe.groupPath||[];if(!oe.length)return;const ce=oe[oe.length-1],de=this.#F(ce);if(!de)return;const ve=this.#D(re);if(!ve)return;const ke=de.parent.indexOf(de.node);de.parent.splice(ke+1,0,ve);const Ce=this.#K(this.#n),Le=this.#H(de.node);if(Le.length){this.#x(Le);const we=Math.max(...Le.map(Te=>this.#t.indexOf(Te))),He=this.#t.filter(Te=>Te!==re);He.splice(we+1,0,re),this.#t=He}this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"removed",id:re,dissolved:Ce})}renameGroup(re,fe){const oe=this.#F(re);if(!oe){U(`columns.group.rename:${re}`,`no band "${re}" to rename.`);return}oe.node.title=String(fe??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:re,title:oe.node.title})}dissolveGroup(re){const fe=this.#F(re);if(!fe){U(`columns.group.dissolve:${re}`,`no band "${re}" to dissolve.`);return}const oe=fe.parent.indexOf(fe.node);fe.parent.splice(oe,1,...fe.node.columns),this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:re})}moveGroup(re,fe){const oe=this.#F(re);if(!oe){U(`columns.group.move:${re}`,`no band "${re}" to move.`);return}const ce=oe.parent,de=ce.indexOf(oe.node);de!==-1&&(ce.splice(de,1),ce.splice(Math.max(0,Math.min(fe,ce.length)),0,oe.node),this.#X(),this.#Y(),this.#w&&this.#w("columngroup",{action:"moved",groupId:re,to:fe}))}#X(){const re=[],fe=ce=>{for(const de of ce)Array.isArray(de.columns)?fe(de.columns):de.column&&re.push(de.column.id)};fe(this.#n);const oe=new Set(re);this.#t=[...re,...this.#t.filter(ce=>!oe.has(ce))]}groupTree(){const re=oe=>oe.map(ce=>Array.isArray(ce.columns)?{id:ce.id,title:ce.title||"",collapsible:!!ce.collapsible,openByDefault:ce.openByDefault!==!1,columns:re(ce.columns)}:ce.column?ce.column.id:null).filter(ce=>ce!==null),fe=re(this.#n);return fe.some(oe=>oe&&typeof oe=="object")?fe:[]}applyGroupTree(re){if(!Array.isArray(re))return;const fe=new Set,oe=de=>{const ve=[];for(const ke of de)if(ke&&typeof ke=="object"&&Array.isArray(ke.columns)){const Ce=oe(ke.columns);if(!Ce.length)continue;ve.push({id:ke.id||i("grp"),title:ke.title||"",collapsible:ke.collapsible===!0,openByDefault:ke.openByDefault!==!1,showWhen:"always",marryChildren:!1,header:{},def:{},columns:Ce})}else if(typeof ke=="string"){const Ce=this.#e.get(ke);Ce&&!fe.has(ke)&&(fe.add(ke),ve.push({column:Ce,path:[]}))}return ve},ce=oe(re);for(const de of this.#t){if(fe.has(de))continue;const ve=this.#e.get(de);ve&&ce.push({column:ve,path:[]})}this.#n=ce,this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"applied"})}show(re){this.#V(re,!1)}hide(re){this.#V(re,!0)}#V(re,fe){const oe=[];for(const ce of I(re)){const de=this.#e.get(ce);if(de){if(fe&&de.layout.lockVisible){U(`lockVisible:${ce}`,`column "${ce}" is \`layout.lockVisible\` and cannot be hidden`);continue}de.layout.hidden!==fe&&(de.layout.hidden=fe,oe.push(ce))}}oe.length&&this.#w&&this.#w("visible",{ids:oe,hidden:fe})}pin(re,fe){const oe=this.#e.get(re);oe&&(oe.layout.pin=fe??null,this.#w&&this.#w("pin",{id:re,side:oe.layout.pin}))}pinMany(re){const fe={};for(const[ce,de]of re){const ve=this.#e.get(ce);ve&&(ve.layout.pin=de??null,fe[ce]=ve.layout.pin)}const oe=Object.keys(fe);oe.length&&this.#w&&this.#w("pin",{ids:oe,pins:fe})}#B(re,fe){const oe=re.layout.min??0,ce=re.layout.max;let de=Math.max(oe,fe);return ce!=null&&(de=Math.min(ce,de)),re.layout.width=de,re.layout.flex=0,de}resize(re,fe){const oe=this.#e.get(re);if(!oe)return;if(oe.layout.resizable===!1){U(`resize:${re}`,`column "${re}" is not resizable; the resize was ignored`);return}const ce=this.#B(oe,fe);this.#w&&this.#w("resize",{id:re,width:ce})}resizeMany(re){const fe={};for(const[ce,de]of re){const ve=this.#e.get(ce);if(ve){if(ve.layout.resizable===!1){U(`resize:${ce}`,`column "${ce}" is not resizable; the resize was ignored`);continue}fe[ce]=this.#B(ve,de)}}const oe=Object.keys(fe);oe.length&&this.#w&&this.#w("resize",{ids:oe,widths:fe})}}function ge(ye){const re={};return ye.width!=null&&(re.width=ye.width),ye.hidden!=null&&(re.hidden=ye.hidden),ye.pin!==void 0&&(re.pin=ye.pin),re}function Oe(ye){if(ye===null||typeof ye!="object")return ye;try{return structuredClone(ye)}catch{}try{return JSON.parse(JSON.stringify(ye))}catch{return ye}}function Pe(ye,re){const fe=ye??null,oe=re??null;if(fe===oe)return!0;if(fe===null||oe===null)return!1;if(typeof fe!="object"||typeof oe!="object")return fe===oe;try{return JSON.stringify(fe)===JSON.stringify(oe)}catch{return!1}}function Ie(ye){const re=[],fe=(ce,de,ve)=>{const ke=[];for(const Ce of ce){if(!o(Ce)){Q("a column definition must be an object");continue}if(Array.isArray(Ce.columns)){z(Ce,te,"columnGroup",Ce.title||Ce.id||"(unnamed)");const Le={id:Ce.id||i("grp"),title:Ce.title||"",collapsible:Ce.collapsible===!0,openByDefault:Ce.openByDefault!==!1,showWhen:Ce.showWhen||"always",marryChildren:Ce.marryChildren===!0,header:Ce.header||{},def:Ce,columns:[]};Le.columns=fe(Ce.columns,[...de,Le.id],Ce.facet!==void 0?Ce.facet:ve),ke.push(Le)}else{const Le={def:Ce,path:de,facet:ve};re.push(Le),ke.push(Le)}}return ke},oe=fe(ye,[],void 0);return{leaves:re,groups:oe}}function xe(ye,re,fe){for(const oe of ye){if(oe.columns){if(xe(oe.columns,re,fe))return!0;continue}if(oe.column&&oe.column.id===re)return oe.column=fe,!0}return!1}}),_e("packages/core/src/columns/autogroup.js",function(e,F){"use strict";Object.defineProperty(e,"AUTO_GROUP_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createAutoGroupColumn",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"warnOnAbsurdGrouping",{enumerable:!0,get:function(){return q}});const E=F("packages/core/src/internal/warn.js").warnOnce,K="__lattice_group",I=240,L=.5;function Q(R){const j=R.def&&R.def.layout;return(typeof j=="number"||j&&j.width!=null||R.def&&R.def.width!=null)&&Number.isFinite(R.layout.width)?R.layout.width:null}function U(R){const j=R.def&&R.def.layout;return!!(j&&j.min!=null)||R.def&&R.def.minWidth!=null}function x(R){const{columns:j,groupBy:k}=R,b=k.map(s=>j.get(s)).filter(Boolean),u=b.length?b.map(s=>s.title||s.id).join(" > "):"Group",g=b.find(s=>Q(s)!=null),o=R.config&&R.config.autoGroupColumnWidth||(g?Q(g):I);let t=g&&U(g)?g.layout.min:120;g&&!U(g)&&(t=Math.min(t,o));const i=g&&g.layout.max!=null?g.layout.max:null;return{id:K,field:null,title:u,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:o,min:t,max:i,pin:R.config&&R.config.autoGroupColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(s,r){return r&&r.group?r.groupValue:null},formatValue(s,r){if(!r||!r.group)return"";if(r.grandTotal)return R.config&&R.config.grandTotalLabel||"Total";const n=b[Math.min(r.level||0,b.length-1)];return n&&typeof n.formatValue=="function"?n.formatValue(s,r):s==null?"":String(s)}}}function q(R,j,k){!R.length||k<100||j<k*L||E(`grouping.cardinality:${R.join(",")}`,`grouping by ${R.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.`)}}),_e("packages/core/src/columns/selectcolumn.js",function(e,F){"use strict";Object.defineProperty(e,"SELECT_COLUMN_ID",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"createSelectionColumn",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return I}});const ie="__lattice_select",E=44;function K(L){const Q=L.selection||{},U=L.config&&L.config.selectionColumnWidth||E;return{id:ie,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:U,min:U,max:U,pin:L.config&&L.config.selectionColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,headerCheckbox:Q.headerCheckbox===!0,def:{},getValue(x,q){return q?q.selected:!1},formatValue(){return""}}}const I=K}),_e("packages/core/src/columns/rownumbercolumn.js",function(e,F){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createRowNumberColumn",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return q}});const E=F("packages/core/src/internal/predicates.js").isFunction,K="__lattice_rownumber",I=40,L=9,Q=22;function U(R){const j=String(Math.max(1,Math.trunc(Math.abs(R))||1)).length;return Math.max(I,j*L+Q)}function x(R){const j=R.rowNumbers,k=j&&typeof j=="object"?j:{},b=Number.isFinite(k.start)?k.start:1,u=Number.isFinite(k.width)?k.width:U((R.maxNumber||0)+b),g=E(R.rank)?R.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:u,min:u,max:u,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(o,t){const i=g(t);return i==null?null:i-1+b},formatValue(o){return o==null?"":String(o)}}}const q=x}),_e("packages/core/src/model/detail.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_DETAIL_HEIGHT",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"DEFAULT_CACHE_LIMIT",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"DetailModel",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return q}});const E=F("packages/core/src/internal/predicates.js").isFunction,I=F("packages/core/src/internal/warn.js").warnOnce,L=240,Q=10;function U(R){if(!R)return null;const j=R===!0?{}:R;return j.enabled===!1?null:!E(j.rows)&&!j.render?(I("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??L,maxHeight:j.maxHeight??null,cacheLimit:Number.isFinite(j.cacheLimit)?Math.max(0,j.cacheLimit):Q,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 x{#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))||L:k==="auto"?L:Number(k)||L}open(j){return this.#t.has(j)?!1:(this.inline||this.#t.clear(),this.#t.add(j),this.#i(),!0)}close(j){return this.#t.delete(j)?(this.#i(),!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.#i())}prune(j){if(!this.#t.size||!E(j))return;let k=!1;for(const b of[...this.#t])j(b)||(this.#t.delete(b),k=!0);k&&this.#i()}signature(){return`${this.#r}`}set(j){this.#t.clear();const k=Array.isArray(j)?j:[];for(const b of this.inline?k:k.slice(0,1))this.#t.add(b);this.#i()}#i(){this.#r++,this.#n()}}const q=x}),_e("packages/core/src/compute/special.js",function(e,F){"use strict";Object.defineProperty(e,"logGamma",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"incompleteBeta",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"normalQuantile",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"normalCdf",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"studentT",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"chiSquareUpperTail",{enumerable:!0,get:function(){return o}});const ie=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),E=3e-12,K=1e-300;function I(t){if(t<.5)return Math.log(Math.PI/Math.sin(Math.PI*t))-I(1-t);const i=t-1;let s=.9999999999998099;const r=i+7.5;for(let n=0;n<ie.length;n++)s+=ie[n]/(i+n+1);return .5*Math.log(2*Math.PI)+(i+.5)*Math.log(r)-r+Math.log(s)}function L(t,i,s){const r=t+i,n=t+1,m=t-1;let l=1,a=1-r*s/n;Math.abs(a)<K&&(a=K),a=1/a;let c=a;for(let f=1;f<=300;f++){const p=2*f;let y=f*(i-f)*s/((m+p)*(t+p));a=1+y*a,Math.abs(a)<K&&(a=K),l=1+y/l,Math.abs(l)<K&&(l=K),a=1/a,c*=a*l,y=-(t+f)*(r+f)*s/((t+p)*(n+p)),a=1+y*a,Math.abs(a)<K&&(a=K),l=1+y/l,Math.abs(l)<K&&(l=K),a=1/a;const h=a*l;if(c*=h,Math.abs(h-1)<E)break}return c}function Q(t,i,s){if(!(t>0)||!(i>0)||!Number.isFinite(s))return Number.NaN;if(s<=0)return 0;if(s>=1)return 1;const r=Math.exp(I(t+i)-I(t)-I(i)+t*Math.log(s)+i*Math.log(1-s));return s<(t+1)/(t+i+2)?r*L(t,i,s)/t:1-r*L(i,t,1-s)/i}function U(t){if(!(t>0)||!(t<1))return t===0?-1/0:t===1?1/0:Number.NaN;const i=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],s=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],r=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],n=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],m=.02425;let l,a,c;t<m?(l=Math.sqrt(-2*Math.log(t)),c=(((((r[0]*l+r[1])*l+r[2])*l+r[3])*l+r[4])*l+r[5])/((((n[0]*l+n[1])*l+n[2])*l+n[3])*l+1)):t<=1-m?(l=t-.5,a=l*l,c=(((((i[0]*a+i[1])*a+i[2])*a+i[3])*a+i[4])*a+i[5])*l/(((((s[0]*a+s[1])*a+s[2])*a+s[3])*a+s[4])*a+1)):(l=Math.sqrt(-2*Math.log(1-t)),c=-(((((r[0]*l+r[1])*l+r[2])*l+r[3])*l+r[4])*l+r[5])/((((n[0]*l+n[1])*l+n[2])*l+n[3])*l+1));const p=(.5*x(-c/Math.SQRT2)-t)*Math.sqrt(2*Math.PI)*Math.exp(c*c/2);return c-p/(1+c*p/2)}function x(t){const i=Math.abs(t),s=2/(2+i),r=4*s-2,n=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,15626441722e-18,-85238095915e-18,6529054439e-18,5059343495e-18,-991364156e-18,-227365122e-18,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18];let m=0,l=0,a;for(let f=n.length-1;f>0;f--)a=l,l=r*l-m+n[f],m=a;const c=s*Math.exp(-i*i+.5*(n[0]+r*l)-m);return t>=0?c:2-c}function q(t){return .5*x(-t/Math.SQRT2)}function R(t,i){if(!(i>0)||!Number.isFinite(t))return Number.NaN;const s=.5*Q(i/2,.5,i/(i+t*t));return t>0?1-s:s}function j(t,i){if(!(t>0)||!(t<1)||!(i>0))return Number.NaN;if(i>1e7)return U(t);let s=-1e4,r=1e4,n=U(t);const m=I(i/2)+I(.5)-I((i+1)/2);for(let l=0;l<60;l++){const a=R(n,i);a<t?s=n:r=n;const c=Math.exp(-((i+1)/2)*Math.log(1+n*n/i)-m)/Math.sqrt(i),f=c>0?(a-t)/c:0;if(Math.abs(f)<1e-12)break;const p=n-f;if(n=p>s&&p<r&&Number.isFinite(p)?p:(s+r)/2,r-s<1e-12)break}return n}function k(t,i){let s=t,r=1/t,n=r;for(let m=0;m<300&&(s+=1,n*=i/s,r+=n,!(Math.abs(n)<Math.abs(r)*E));m++);return r*Math.exp(-i+t*Math.log(i)-I(t))}function b(t,i){let s=i+1-t,r=1/K,n=1/s,m=n;for(let l=1;l<=300;l++){const a=-l*(l-t);s+=2,n=a*n+s,Math.abs(n)<K&&(n=K),r=s+a/r,Math.abs(r)<K&&(r=K),n=1/n;const c=n*r;if(m*=c,Math.abs(c-1)<E)break}return Math.exp(-i+t*Math.log(i)-I(t))*m}function u(t,i){return!(t>0)||!(i>=0)||!Number.isFinite(i)?Number.NaN:i===0?0:i<t+1?k(t,i):1-b(t,i)}function g(t,i){return i>0?u(i/2,t/2):Number.NaN}function o(t,i){const s=g(t,i);return Number.isNaN(s)?Number.NaN:Math.min(1,Math.max(0,1-s))}}),_e("packages/core/src/compute/linalg.js",function(e,F){"use strict";Object.defineProperty(e,"cholesky",{enumerable:!0,get:function(){return ie}}),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 I}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return Q}});function ie(U){const x=U.length,q=Array.from({length:x},()=>new Array(x).fill(0));for(let R=0;R<x;R++)for(let j=0;j<=R;j++){let k=U[R][j];for(let b=0;b<j;b++)k-=q[R][b]*q[j][b];if(R===j){if(!(k>0))return null;q[R][j]=Math.sqrt(k)}else q[R][j]=k/q[j][j]}return q}function E(U,x){const q=U.length,R=new Array(q).fill(0);for(let k=0;k<q;k++){let b=x[k];for(let u=0;u<k;u++)b-=U[k][u]*R[u];R[k]=b/U[k][k]}const j=new Array(q).fill(0);for(let k=q-1;k>=0;k--){let b=R[k];for(let u=k+1;u<q;u++)b-=U[u][k]*j[u];j[k]=b/U[k][k]}return j}function K(U){const x=U.length,q=Array.from({length:x},()=>new Array(x).fill(0));for(let R=0;R<x;R++){const j=new Array(x).fill(0);j[R]=1;const k=E(U,j);for(let b=0;b<x;b++)q[b][R]=k[b]}return q}function I(U,x,q){const R=U.length,j=R?U[0].length:0,k=Array.from({length:j},()=>new Array(j).fill(0)),b=new Array(j).fill(0);for(let u=0;u<R;u++){const g=q?q[u]:1,o=U[u];for(let t=0;t<j;t++){const i=g*o[t];b[t]+=i*x[u];for(let s=t;s<j;s++)k[t][s]+=i*o[s]}}for(let u=0;u<j;u++)for(let g=0;g<u;g++)k[u][g]=k[g][u];return{xtwx:k,xtwy:b}}function L(U,x){return U.map(q=>q.reduce((R,j,k)=>R+j*x[k],0))}function Q(U,x){let q=0;for(let R=0;R<U.length;R++){let j=0;for(let k=0;k<U.length;k++)j+=x[R][k]*U[k];q+=U[R]*j}return q}}),_e("packages/core/src/compute/sketch.js",function(e,F){"use strict";Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return k}});class ie{#e=0;#t=0;#n=0;static get errorBound(){return Object.freeze({kind:"exact",metric:"none",value:0,statement:"mean and variance match a full recompute to float rounding"})}get count(){return this.#e}add(u){if(!Number.isFinite(u))return;this.#e++;const g=u-this.#t;this.#t+=g/this.#e,this.#n+=g*(u-this.#t)}merge(u){if(u.#e===0)return;if(this.#e===0){this.#e=u.#e,this.#t=u.#t,this.#n=u.#n;return}const g=this.#e+u.#e,o=u.#t-this.#t;this.#t+=o*(u.#e/g),this.#n+=u.#n+o*o*(this.#e*u.#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 u=this.variance();return u===null?null:Math.sqrt(u)}stddevP(){const u=this.varianceP();return u===null?null:Math.sqrt(u)}}class E{#e=[];#t=0;#n;#r;constructor(u,g=Math.random){if(!(u>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(u),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(u){if(!Number.isFinite(u))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(u);return}const g=Math.floor(this.#r()*this.#t);g<this.#n&&(this.#e[g]=u)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let u=0;for(const g of this.#e)u+=g;return u/this.#e.length}quantile(u){const g=this.#e.length;if(!g)return null;const o=this.#e.slice().sort((r,n)=>r-n);if(g===1)return o[0];const t=(g-1)*Math.min(1,Math.max(0,u)),i=Math.floor(t),s=Math.ceil(t);return i===s?o[i]:o[i]+(t-i)*(o[s]-o[i])}}function K(b){return b^=b>>>16,b=Math.imul(b,2246822507),b^=b>>>13,b=Math.imul(b,3266489909),b^=b>>>15,b>>>0}function I(b){if(typeof b=="number"){const o=new DataView(new ArrayBuffer(8));return o.setFloat64(0,b===0?0:b),K(o.getUint32(0)^o.getUint32(4))}const u=typeof b=="string"?b:String(b);let g=2166136261;for(let o=0;o<u.length;o++)g^=u.charCodeAt(o),g=Math.imul(g,16777619);return K(g)}class L{#e;#t;#n;constructor(u=14){const g=Math.floor(u);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(u=14){const g=1<<Math.floor(u),o=1.04/Math.sqrt(g);return Object.freeze({kind:"probabilistic",metric:"relative",value:o,statement:`distinct count within ~${(o*100).toFixed(2)}% relative standard error (m=${g} buckets)`})}errorBound(){return L.errorBoundFor(this.#e)}add(u){const g=I(u),o=g&this.#t-1,t=g>>>this.#e|1<<32-this.#e;let i=1,s=t;for(;(s&1)===0;)i++,s>>>=1;i>this.#n[o]&&(this.#n[o]=i)}count(){const u=this.#t,g=32-this.#e,o=new Float64Array(g+2);for(let s=0;s<u;s++)o[this.#n[s]]++;let t=u*x(1-o[g+1]/u);for(let s=g;s>=1;s--)t=.5*(t+o[s]);t+=u*U(o[0]/u);const i=Q*u*u/t;return Math.round(i)}}const Q=.5/Math.log(2);function U(b){if(b===1)return 1/0;let u=1,g=b,o;do b*=b,o=g,g+=b*u,u+=u;while(g!==o);return g}function x(b){if(b===0||b===1)return 0;let u=1,g=1-b,o;do b=Math.sqrt(b),o=g,u*=.5,g-=(1-b)**2*u;while(g!==o);return g/3}class q{#e=new Map;#t;#n=0;constructor(u){if(!(u>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(u)}errorBoundFor(u){const g=u/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=${u}, m=${this.#t})`})}get seen(){return this.#n}add(u){this.#n++;const g=this.#e.get(u);if(g){g.count++;return}if(this.#e.size<this.#t){this.#e.set(u,{count:1,error:0});return}let o,t=1/0;for(const[i,s]of this.#e)s.count<t&&(t=s.count,o=i);this.#e.delete(o),this.#e.set(u,{count:t+1,error:t})}top(u=this.#t){return[...this.#e.entries()].map(([o,t])=>({item:o,count:t.count,error:t.error})).sort((o,t)=>t.count-o.count).slice(0,Math.max(0,Math.floor(u)))}}class R{#e;#t=[[]];#n=0;#r;#i;constructor(u=200,g=Math.random){this.#e=Math.max(8,Math.floor(u)),this.#r=g,this.#i=2/3}static errorBoundFor(u=200){const g=1/Math.max(8,Math.floor(u));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=${u})`})}errorBound(){return R.errorBoundFor(this.#e)}get count(){return this.#n}#s(u){const o=this.#t.length-1-u,t=Math.ceil(this.#e*this.#i**o);return Math.max(2,t)}add(u){Number.isFinite(u)&&(this.#n++,this.#t[0].push(u),this.#t[0].length>=this.#s(0)&&this.#a(0))}#a(u){const g=this.#t[u];g.sort((i,s)=>i-s),u+1>=this.#t.length&&this.#t.push([]);const o=this.#t[u+1],t=this.#r()<.5?0:1;for(let i=t;i<g.length;i+=2)o.push(g[i]);this.#t[u]=[];for(let i=0;i<this.#t.length;i++)if(this.#t[i].length>=this.#s(i)){this.#a(i);return}}#l(){const u=[];for(let g=0;g<this.#t.length;g++){const o=1<<g;for(const t of this.#t[g])u.push({v:t,w:o})}return u}quantile(u){const g=this.#l();if(!g.length)return null;g.sort((s,r)=>s.v-r.v);let o=0;for(const s of g)o+=s.w;const t=Math.min(1,Math.max(0,u))*o;let i=0;for(const s of g)if(i+=s.w,i>=t)return s.v;return g[g.length-1].v}rank(u){let g=0;for(let o=0;o<this.#t.length;o++){const t=1<<o;for(const i of this.#t[o])i<=u&&(g+=t)}return g}}const j=Object.freeze({distinct:L.errorBoundFor(14),median:R.errorBoundFor(200),p25:R.errorBoundFor(200),p75:R.errorBoundFor(200),p90:R.errorBoundFor(200),p95:R.errorBoundFor(200),p99:R.errorBoundFor(200),iqr:R.errorBoundFor(200),topK:Object.freeze({kind:"deterministic",metric:"absolute",value:0,statement:"each count overestimates the truth by at most N/m; top-K exact when the K-th item exceeds N/m"})}),k={Welford:ie,Reservoir:E,HyperLogLog:L,SpaceSaving:q,KLL:R,hash32:I,SKETCH_BOUNDS:j}}),_e("packages/core/src/compute/statistics.js",function(e,F){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"numbers",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"frequencies",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"herfindahl",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"entropy",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"evenness",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"topShare",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"gini",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"moments",{enumerable:!0,get:function(){return d}}),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 W}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"modifiedZOutliers",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"jarqueBera",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"weightedQuantile",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"covariance",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(e,"autocorrelations",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"spearman",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"kendall",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(e,"seriesStats",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(e,"D2_N2",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"D4_N2",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"movingRanges",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"withinSigma",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return He}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"countOutside",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(e,"histogram",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(e,"DEFAULT_CONFIDENCE",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(e,"meanInterval",{enumerable:!0,get:function(){return et}}),Object.defineProperty(e,"proportionInterval",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(e,"slopeInterval",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(e,"capabilityInterval",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(e,"standardizedMeanDifference",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(e,"normalTotalVariation",{enumerable:!0,get:function(){return st}}),Object.defineProperty(e,"frequencyMap",{enumerable:!0,get:function(){return it}}),Object.defineProperty(e,"categoricalDistance",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(e,"SUBSET_RELIABILITY_FLOOR",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(e,"compareColumn",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(e,"isNumericColumn",{enumerable:!0,get:function(){return It}}),Object.defineProperty(e,"populationRead",{enumerable:!0,get:function(){return ft}});const ie=F("packages/core/src/compute/handle.js"),E=ie.presenceReader,K=ie.valueReader,I=F("packages/core/src/compute/special.js"),L=I.studentTQuantile,Q=I.studentT,U=I.normalQuantile,x=I.normalCdf,q=I.chiSquareUpperTail,R=F("packages/core/src/compute/linalg.js"),j=R.cholesky,k=R.choleskySolve,b=R.choleskyInverse,u=R.normalEquations,g=R.quadForm,t=F("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,i=5e3,s=Object.freeze({variance:"rescan",varianceP:"rescan",stddev:"rescan",stddevP:"rescan",sumSquares:"rescan",weightedAvg:"rescan",median:"rescan",percentile:"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"}),r=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(ae){const me=ae==="sum"||ae==="avg"||ae==="countValues"||ae==="min"||ae==="max"?"maintained":Object.prototype.hasOwnProperty.call(s,ae)?s[ae]:null,be=Object.prototype.hasOwnProperty.call(r,ae)?r[ae]:null;return{stat:ae,exact:me,approximate:be}}function m(ae,me){const be=me.length,je=new Float64Array(be);let Ne=0;if(ae&&(ae.kind==="float64"||ae.kind==="int32")){const De=ae.values,Ge=E(ae);for(let Ve=0;Ve<be;Ve++){const Qe=me[Ve];if(Ge&&Ge(Qe)!==1)continue;const mt=De[Qe];Number.isNaN(mt)||(je[Ne++]=mt)}return je.subarray(0,Ne)}const ze=K(ae);for(let De=0;De<be;De++){const Ge=ze(me[De]);if(Ge==null||Ge==="")continue;const Ve=typeof Ge=="number"?Ge:Number(Ge);Number.isFinite(Ve)&&(je[Ne++]=Ve)}return je.subarray(0,Ne)}function l(ae,me){const be=new Map,je=K(ae);let Ne=0;for(let ze=0;ze<me.length;ze++){const De=je(me[ze]);if(De==null||De===""||typeof De=="number"&&Number.isNaN(De))continue;const Ge=typeof De=="object"?String(De):De;be.set(Ge,(be.get(Ge)||0)+1),Ne++}const Re=[...be.values()].sort((ze,De)=>De-ze);return{counts:Re,total:Ne,distinct:Re.length}}function a(ae){return ae.total>0?ae.counts.map(me=>me/ae.total):[]}function c(ae,me){const be=l(ae,me);if(!be.total)return null;let je=0;for(const Ne of a(be))je+=Ne*Ne;return je}function f(ae,me){const be=l(ae,me);if(!be.total)return null;let je=0;for(const Ne of a(be))Ne>0&&(je-=Ne*Math.log2(Ne));return je}function p(ae,me){const be=l(ae,me);if(!be.total||be.distinct<2)return be.total?1:null;let je=0;for(const Ne of a(be))Ne>0&&(je-=Ne*Math.log2(Ne));return je/Math.log2(be.distinct)}function y(ae,me,be=3){const je=l(ae,me);if(!je.total)return null;const Ne=Math.max(1,Math.floor(be));let Re=0;for(let ze=0;ze<Math.min(Ne,je.counts.length);ze++)Re+=je.counts[ze];return Re/je.total}function h(ae,me){const be=m(ae,me),je=be.length;if(!je)return null;const Ne=be.slice().sort();if(Ne[0]<0)return null;let Re=0,ze=0;for(let De=0;De<je;De++)Re+=Ne[De],ze+=(De+1)*Ne[De];return Re===0?0:2*ze/(je*Re)-(je+1)/je}function d(ae){let me=0,be=0,je=0;for(let Ne=0;Ne<ae.length;Ne++){const Re=ae[Ne];me++;const ze=Re-be;be+=ze/me,je+=ze*(Re-be)}return{n:me,mean:be,m2:je}}function w(ae,me){const be=ae.length;if(!be)return NaN;if(be===1)return ae[0];const je=(be-1)*Math.min(1,Math.max(0,me)),Ne=Math.floor(je),Re=Math.ceil(je);return Ne===Re?ae[Ne]:ae[Ne]+(je-Ne)*(ae[Re]-ae[Ne])}function v(ae,me){if(!ae.length)return NaN;const be=ae.slice().sort();return w(be,me)}function P(ae,me){const be=K(ae);let je=0,Ne=0,Re=0;for(let ze=0;ze<me.length;ze++){const De=be(me[ze]);if(De==null||De==="")continue;const Ge=String(De).toUpperCase();Ge==="PASS"?je++:Ge==="FAIL"?Ne++:Ge==="WARN"&&Re++}return{pass:je+Re,fail:Ne,warn:Re,judged:je+Re+Ne}}const W=Object.freeze({hhi:(ae,me)=>c(ae,me),entropy:(ae,me)=>f(ae,me),evenness:(ae,me)=>p(ae,me),top3Share:(ae,me)=>y(ae,me,3),top10Share:(ae,me)=>y(ae,me,10),gini:(ae,me)=>h(ae,me),trimmedMean:(ae,me)=>S(m(ae,me),.1),winsorizedMean:(ae,me)=>O(m(ae,me),.1),robustOutliers:(ae,me)=>M(m(ae,me),3.5),jarqueBera:(ae,me)=>A(m(ae,me)),variance:(ae,me)=>{const{n:be,m2:je}=d(m(ae,me));return be>1?je/(be-1):null},varianceP:(ae,me)=>{const{n:be,m2:je}=d(m(ae,me));return be>0?je/be:null},stddev:(ae,me)=>{const{n:be,m2:je}=d(m(ae,me));return be>1?Math.sqrt(je/(be-1)):null},stddevP:(ae,me)=>{const{n:be,m2:je}=d(m(ae,me));return be>0?Math.sqrt(je/be):null},median:(ae,me)=>{const be=m(ae,me);return be.length?v(be,.5):null},percentile:(ae,me,be)=>{const je=be?be.p:void 0;if(typeof je!="number"||!(je>=0&&je<=1))return null;const Ne=m(ae,me);return Ne.length?v(Ne,je):null},p25:(ae,me)=>{const be=m(ae,me);return be.length?v(be,.25):null},p75:(ae,me)=>{const be=m(ae,me);return be.length?v(be,.75):null},p90:(ae,me)=>{const be=m(ae,me);return be.length?v(be,.9):null},p95:(ae,me)=>{const be=m(ae,me);return be.length?v(be,.95):null},p99:(ae,me)=>{const be=m(ae,me);return be.length?v(be,.99):null},iqr:(ae,me)=>{const be=m(ae,me);if(!be.length)return null;const je=be.slice().sort();return w(je,.75)-w(je,.25)},mad:(ae,me)=>{const be=m(ae,me);if(!be.length)return null;const je=v(be,.5),Ne=new Float64Array(be.length);for(let Re=0;Re<be.length;Re++)Ne[Re]=Math.abs(be[Re]-je);return v(Ne,.5)},range:(ae,me)=>{const be=m(ae,me);if(!be.length)return null;let je=1/0,Ne=-1/0;for(let Re=0;Re<be.length;Re++)be[Re]<je&&(je=be[Re]),be[Re]>Ne&&(Ne=be[Re]);return Ne-je},distinct:(ae,me)=>{const be=K(ae),je=new Set;for(let Ne=0;Ne<me.length;Ne++){const Re=be(me[Ne]);Re==null||Re===""||je.add(Re instanceof Date?Re.getTime():Re)}return je.size},mode:(ae,me)=>{const be=K(ae),je=new Map;for(let ze=0;ze<me.length;ze++){const De=be(me[ze]);if(De==null||De==="")continue;const Ge=De instanceof Date?De.getTime():De;je.set(Ge,(je.get(Ge)||0)+1)}let Ne=null,Re=1;for(const[ze,De]of je)De>Re&&(Re=De,Ne=ze);return Ne},skewness:(ae,me)=>{const be=m(ae,me),{n:je,mean:Ne,m2:Re}=d(be);if(je<3||Re<=0)return null;const ze=Math.sqrt(Re/(je-1));let De=0;for(let Ge=0;Ge<be.length;Ge++)De+=((be[Ge]-Ne)/ze)**3;return je/((je-1)*(je-2))*De},kurtosis:(ae,me)=>{const be=m(ae,me),{n:je,mean:Ne,m2:Re}=d(be);if(je<4||Re<=0)return null;const ze=Math.sqrt(Re/(je-1));let De=0;for(let Qe=0;Qe<be.length;Qe++)De+=((be[Qe]-Ne)/ze)**4;const Ge=je*(je+1)/((je-1)*(je-2)*(je-3)),Ve=3*(je-1)**2/((je-2)*(je-3));return Ge*De-Ve},geomean:(ae,me)=>{const be=m(ae,me);if(!be.length)return null;let je=0;for(let Ne=0;Ne<be.length;Ne++){if(be[Ne]<=0)return null;je+=Math.log(be[Ne])}return Math.exp(je/be.length)},harmean:(ae,me)=>{const be=m(ae,me);if(!be.length)return null;let je=0;for(let Ne=0;Ne<be.length;Ne++){if(be[Ne]===0)return null;je+=1/be[Ne]}return be.length/je},sumSquares:(ae,me)=>{const be=m(ae,me);let je=0;for(let Ne=0;Ne<be.length;Ne++)je+=be[Ne]*be[Ne];return je},passRate:(ae,me)=>{const{pass:be,judged:je}=P(ae,me);return je?be/je:null},failureCount:(ae,me)=>P(ae,me).fail}),V=Object.freeze({hhi:"Concentration (HHI)",entropy:"Entropy",evenness:"Evenness",top3Share:"Top 3 share",top10Share:"Top 10 share",gini:"Gini coefficient",trimmedMean:"Trimmed mean",winsorizedMean:"Winsorized mean",robustOutliers:"Outliers (robust)",jarqueBera:"Jarque–Bera",median:"Median",percentile:"Percentile",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 G(ae,me,be){const je=K(ae),Ne=K(me);let Re=0,ze=0;for(let De=0;De<be.length;De++){const Ge=be[De],Ve=Number(je(Ge)),Qe=Number(Ne(Ge));!Number.isFinite(Ve)||!Number.isFinite(Qe)||(Re+=Ve*Qe,ze+=Qe)}return ze===0?null:Re/ze}function _(ae,me,be){const je=K(ae);let Ne=null,Re=be?-1/0:1/0;for(let ze=0;ze<me.length;ze++){const De=me[ze],Ge=Number(je(De));Number.isFinite(Ge)&&(be?Ge>Re:Ge<Re)&&(Re=Ge,Ne=De)}return Ne}function T(ae,me,be){const je=K(ae),Ne=K(me);let Re=0,ze=0,De=0,Ge=0,Ve=0,Qe=0;for(let dt=0;dt<be.length;dt++){const jt=be[dt],xt=Number(je(jt)),At=Number(Ne(jt));!Number.isFinite(xt)||!Number.isFinite(At)||(Re++,ze+=xt,De+=At,Ge+=xt*xt,Ve+=At*At,Qe+=xt*At)}if(Re<2)return null;const mt=Re*Qe-ze*De,Ot=Math.sqrt((Re*Ge-ze*ze)*(Re*Ve-De*De));if(Ot===0)return null;const gt=mt/Ot;return Math.max(-1,Math.min(1,gt))}function S(ae,me=.1){const be=ae.length;if(!be)return null;const je=Array.from(ae).sort((De,Ge)=>De-Ge),Ne=Math.floor(be*Math.min(.49,Math.max(0,me))),Re=je.slice(Ne,be-Ne);if(!Re.length)return w(je,.5);let ze=0;for(const De of Re)ze+=De;return ze/Re.length}function O(ae,me=.1){const be=ae.length;if(!be)return null;const je=Array.from(ae).sort((Ge,Ve)=>Ge-Ve),Ne=Math.floor(be*Math.min(.49,Math.max(0,me))),Re=je[Ne],ze=je[be-1-Ne];let De=0;for(const Ge of je)De+=Math.min(ze,Math.max(Re,Ge));return De/be}function M(ae,me=3.5){if(!ae.length)return null;const je=Array.from(ae).sort((Ge,Ve)=>Ge-Ve),Ne=w(je,.5),Re=je.map(Ge=>Math.abs(Ge-Ne)).sort((Ge,Ve)=>Ge-Ve),ze=w(Re,.5);if(ze===0)return null;let De=0;for(const Ge of je)Math.abs(.6745*(Ge-Ne)/ze)>me&&De++;return De}function A(ae){const me=ae.length;if(me<8)return null;let be=0;for(const Ge of ae)be+=Ge;be/=me;let je=0,Ne=0,Re=0;for(const Ge of ae){const Ve=Ge-be;je+=Ve*Ve,Ne+=Ve*Ve*Ve,Re+=Ve*Ve*Ve*Ve}if(je/=me,Ne/=me,Re/=me,je===0)return null;const ze=Ne/je**1.5,De=Re/(je*je)-3;return me/6*(ze*ze+De*De/4)}function N(ae,me,be){const je=[];let Ne=0;for(let Ge=0;Ge<ae.length;Ge++){const Ve=Number(ae[Ge]),Qe=Number(me[Ge]);!Number.isFinite(Ve)||!Number.isFinite(Qe)||Qe<=0||(je.push([Ve,Qe]),Ne+=Qe)}if(!je.length||Ne<=0)return null;if(je.sort((Ge,Ve)=>Ge[0]-Ve[0]),je.length===1)return je[0][0];const Re=[];let ze=0;for(const[,Ge]of je)Re.push((ze+Ge/2)/Ne),ze+=Ge;const De=Math.max(0,Math.min(1,be));if(De<=Re[0])return je[0][0];if(De>=Re[Re.length-1])return je[je.length-1][0];for(let Ge=1;Ge<Re.length;Ge++){if(De>Re[Ge])continue;const Ve=Re[Ge]-Re[Ge-1],Qe=Ve>0?(De-Re[Ge-1])/Ve:0;return je[Ge-1][0]+(je[Ge][0]-je[Ge-1][0])*Qe}return je[je.length-1][0]}function $(ae,me,be){const je=K(ae),Ne=K(me),Re=new Float64Array(be.length),ze=new Float64Array(be.length);let De=0;for(let Ge=0;Ge<be.length;Ge++){const Ve=be[Ge],Qe=Number(je(Ve)),mt=Number(Ne(Ve));!Number.isFinite(Qe)||!Number.isFinite(mt)||(Re[De]=Qe,ze[De]=mt,De++)}return{xs:Re.subarray(0,De),ys:ze.subarray(0,De),n:De}}function H(ae,me,be,je=!1){const{xs:Ne,ys:Re,n:ze}=$(ae,me,be);if(ze<2)return null;let De=0,Ge=0;for(let Qe=0;Qe<ze;Qe++)De+=Ne[Qe],Ge+=Re[Qe];De/=ze,Ge/=ze;let Ve=0;for(let Qe=0;Qe<ze;Qe++)Ve+=(Ne[Qe]-De)*(Re[Qe]-Ge);return Ve/(je?ze:ze-1)}function Y(ae,me,be){const{xs:je,ys:Ne,n:Re}=$(ae,me,be);if(Re<2)return null;let ze=0,De=0;for(let xt=0;xt<Re;xt++)ze+=je[xt],De+=Ne[xt];ze/=Re,De/=Re;let Ge=0,Ve=0,Qe=0;for(let xt=0;xt<Re;xt++){const At=je[xt]-ze,Bt=Ne[xt]-De;Ge+=At*At,Ve+=At*Bt,Qe+=Bt*Bt}if(Ge===0)return null;const mt=Ve/Ge,Ot=De-mt*ze,gt=Qe===0?1:Math.max(0,Math.min(1,Ve*Ve/(Ge*Qe))),dt=Math.max(0,Qe-mt*Ve),jt=Re>2?Math.sqrt(dt/(Re-2)/Ge):0;return{slope:mt,intercept:Ot,r2:gt,stdError:jt,n:Re}}const Z=new Set(["ols","wls","robust"]),J=new Set(["quantile"]),D=new Set(["ridge","lasso","elasticnet","mixed","gls"]),te=1.345;function z(ae,me,be){const{xtwx:je,xtwy:Ne}=u(ae,me,be),Re=j(je);if(!Re)return null;const ze=k(Re,Ne),De=b(Re),Ge=X(ae,ze),Ve=me.map((Qe,mt)=>Qe-Ge[mt]);return{beta:ze,cov:De,fitted:Ge,residuals:Ve}}function X(ae,me){return ae.map(be=>be.reduce((je,Ne,Re)=>je+Ne*me[Re],0))}function ne(ae,me){const be=ae.length,je=ae.map(Ve=>Ve[me]),Ne=ae.map(Ve=>[1,...Ve.filter((Qe,mt)=>mt!==me)]),Re=z(Ne,je,null);if(!Re)return 1;const ze=je.reduce((Ve,Qe)=>Ve+Qe,0)/be;let De=0,Ge=0;for(let Ve=0;Ve<be;Ve++)De+=Re.residuals[Ve]**2,Ge+=(je[Ve]-ze)**2;return Ge===0?1:Math.max(0,Math.min(1,1-De/Ge))}function se(ae){const me=[...ae].sort((Ne,Re)=>Ne-Re),be=ue(me),je=ae.map(Ne=>Math.abs(Ne-be)).sort((Ne,Re)=>Ne-Re);return ue(je)/.6745}function ue(ae){const me=ae.length;if(!me)return 0;const be=Math.floor(me/2);return me%2?ae[be]:(ae[be-1]+ae[be])/2}function ge(ae,me,be={}){const je=be.method||"ols";if(D.has(je))throw new Error(`[lattice] regression method "${je}" is out of scope; use ols, wls or robust.`);if(J.has(je))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!Z.has(je))throw new Error(`[lattice] unknown regression method "${je}"; use ols, wls or robust.`);const Ne=Array.isArray(me)?me.length:0,Re=Ne&&Array.isArray(ae[0])?ae[0].length:0,ze=Re+1;if(!(Ne>ze))return null;for(let St=0;St<Ne;St++){if(!Number.isFinite(me[St])||!Array.isArray(ae[St])||ae[St].length!==Re)return null;for(let Mt=0;Mt<Re;Mt++)if(!Number.isFinite(ae[St][Mt]))return null}let De=null;if(je==="wls"){if(De=be.weights,!Array.isArray(De)||De.length!==Ne)return null;for(let St=0;St<Ne;St++)if(!(De[St]>0)||!Number.isFinite(De[St]))return null}const Ge=ae.map(St=>[1,...St]);let Ve,Qe=null;if(je==="robust"){if(Ve=z(Ge,me,null),!Ve)return null;for(let St=0;St<50;St++){const Mt=se(Ve.residuals);if(!(Mt>0))break;const Wt=Ve.residuals.map(Ht=>{const Gt=Math.abs(Ht/Mt);return Gt<=te?1:te/Gt}),_t=z(Ge,me,Wt);if(!_t)return null;const zt=_t.beta.reduce((Ht,Gt,Dt)=>Math.max(Ht,Math.abs(Gt-Ve.beta[Dt])),0);if(Ve=_t,Qe=Wt,zt<1e-10)break}}else if(Ve=z(Ge,me,De),!Ve)return null;const mt=je==="robust"?Qe:De,{beta:Ot,cov:gt,fitted:dt,residuals:jt}=Ve;let xt=0,At=0,Bt=0;for(let St=0;St<Ne;St++){const Mt=mt?mt[St]:1;xt+=Mt*jt[St]**2,At+=Mt,Bt+=Mt*me[St]}const nn=Bt/At;let Vt=0;for(let St=0;St<Ne;St++){const Mt=mt?mt[St]:1;Vt+=Mt*(me[St]-nn)**2}const Zt=Ne-ze,Xe=xt/Zt,ot=Vt===0?1:Math.max(0,Math.min(1,1-xt/Vt)),vt=1-(1-ot)*(Ne-1)/Zt,pt=Array.isArray(be.names)&&be.names.length===Re?be.names:ae[0].map((St,Mt)=>`x${Mt+1}`),yt=Ke(be.confidence),We=Zt>0?L(1-(1-yt)/2,Zt):1/0,at=Ot.map((St,Mt)=>{const Wt=Math.sqrt(Math.max(0,Xe*gt[Mt][Mt])),_t=Wt>0?St/Wt:St===0?0:1/0,zt=Number.isFinite(_t)?2*(1-Q(Math.abs(_t),Zt)):0,Ht=Number.isFinite(We)?We*Wt:null;return{name:Mt===0?"(intercept)":pt[Mt-1],estimate:St,stdError:Wt,t:_t,p:Math.max(0,Math.min(1,zt)),lower:Ht===null?null:St-Ht,upper:Ht===null?null:St+Ht}}),rt=new Array(Ne),lt=new Array(Ne);for(let St=0;St<Ne;St++){const Mt=mt?mt[St]:1,Wt=Math.max(0,Math.min(1,Mt*g(Ge[St],gt)));rt[St]=Wt;const _t=(1-Wt)**2;lt[St]=_t>0&&Xe>0?jt[St]**2/(ze*Xe)*(Wt/_t):null}const Rt=ae[0].map((St,Mt)=>{if(Re<2)return 1;const Wt=ne(ae,Mt);return Wt>=1?1/0:1/(1-Wt)});let Lt=null;{const St=jt.map(Wt=>Wt*Wt),Mt=z(Ge,St,null);if(Mt){const Wt=St.reduce((Qt,ln)=>Qt+ln,0)/Ne;let _t=0,zt=0;for(let Qt=0;Qt<Ne;Qt++)_t+=Mt.residuals[Qt]**2,zt+=(St[Qt]-Wt)**2;const Ht=zt===0?0:Math.max(0,Math.min(1,1-_t/zt)),Gt=Ne*Ht,Dt=q(Gt,Re);Lt={statistic:Gt,df:Re,p:Dt,heteroscedastic:Dt<.05}}}let bt=null;if(Re===1){const St=ae.map((Mt,Wt)=>Wt).sort((Mt,Wt)=>ae[Mt][0]-ae[Wt][0]);bt={confidence:yt,points:St.map(Mt=>{const Wt=Ge[Mt],_t=Math.sqrt(Math.max(0,Xe*g(Wt,gt)));return{x:ae[Mt][0],yhat:dt[Mt],lower:dt[Mt]-We*_t,upper:dt[Mt]+We*_t}})}}return{method:je,coefficients:at,r2:ot,adjR2:vt,n:Ne,df:Zt,sigma2:Xe,fitted:dt,residuals:jt,leverage:rt,cooksD:lt,vif:Rt,heteroscedasticity:Lt,band:bt,weights:mt?[...mt]:null}}function Oe(ae){const me=ae.length,be=Array.from({length:me},(Re,ze)=>ze).sort((Re,ze)=>ae[Re]-ae[ze]),je=new Float64Array(me);let Ne=0;for(;Ne<me;){let Re=Ne;for(;Re+1<me&&ae[be[Re+1]]===ae[be[Ne]];)Re++;const ze=(Ne+Re)/2+1;for(let De=Ne;De<=Re;De++)je[be[De]]=ze;Ne=Re+1}return je}const Pe=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function Ie(ae){const me=[.01,.05,.1],be=[Pe["1%"],Pe["5%"],Pe["10%"]];if(ae<=be[0]){const Re=(Math.log(me[1])-Math.log(me[0]))/(be[1]-be[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(me[0])+Re*(ae-be[0]))))}if(ae>=be[2]){const Re=(Math.log(me[2])-Math.log(me[1]))/(be[2]-be[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(me[2])+Re*(ae-be[2]))))}const je=ae<be[1]?0:1,Ne=(ae-be[je])/(be[je+1]-be[je]);return Math.exp(Math.log(me[je])+Ne*(Math.log(me[je+1])-Math.log(me[je])))}function xe(ae,me,be,je){const Ne=be-je,Re=je+3,ze=new Array(Ne),De=new Array(Ne);let Ge=!0,Ve=je;for(let dt=0;dt<Ne;dt++){const jt=je+dt,xt=new Float64Array(Re);xt[0]=1,xt[1]=dt+1,xt[2]=ae[jt];for(let At=1;At<=je;At++)xt[2+At]=me[jt-At];for(let At=1;At<Re;At++)Number.isFinite(xt[At])||(Ve=Math.min(Ve,At-3));ze[dt]=xt,De[dt]=me[jt],Number.isFinite(De[dt])||(Ge=!1)}if(!Ge)return 0;const{xtwx:Qe,xtwy:mt}=u(ze,De,null);let Ot=0,gt=1/0;for(let dt=0;dt<=Ve;dt++){const jt=dt+3;if(!(Ne>jt))continue;const xt=new Array(jt);for(let ot=0;ot<jt;ot++)xt[ot]=Qe[ot].slice(0,jt);const At=j(xt);if(!At)continue;const Bt=k(At,mt.slice(0,jt));let nn=0;for(let ot=0;ot<Ne;ot++){const vt=ze[ot];let pt=0;for(let yt=0;yt<jt;yt++)pt+=vt[yt]*Bt[yt];nn+=(De[ot]-pt)**2}const Zt=nn/(Ne-jt)*(Ne-jt);if(!(Zt>0))continue;const Xe=Ne*Math.log(Zt/Ne)+2*jt;Xe<gt&&(gt=Xe,Ot=dt)}return Ot}function ye(ae,me={}){const be=[];for(let gt=0;gt<ae.length;gt++){const dt=Number(ae[gt]);Number.isFinite(dt)&&be.push(dt)}const je=be.length,Ne=je-1;if(je<8||Ne<6)return null;const Re=new Array(Ne);for(let gt=0;gt<Ne;gt++)Re[gt]=be[gt+1]-be[gt];let ze=Number.isFinite(me.maxlag)?Math.floor(me.maxlag):Math.ceil(12*(je/100)**.25);ze=Math.max(0,Math.min(ze,Math.floor((Ne-5)/2)));const De=(gt,dt)=>{const jt=[],xt=[];for(let At=dt;At<Ne;At++){const Bt=[At-dt+1,be[At]];for(let nn=1;nn<=gt;nn++)Bt.push(Re[At-nn]);jt.push(Bt),xt.push(Re[At])}return ge(jt,xt,{method:"ols"})},Ge=xe(be,Re,Ne,ze),Ve=De(Ge,Ge);if(!Ve||!Ve.coefficients[2])return null;const Qe=Ve.coefficients[2].t,mt=Ie(Qe),Ot=Qe<Pe["5%"];return{statistic:Qe,usedLag:Ge,nobs:Ne-Ge,criticalValues:{...Pe},pValue:mt,pApproximate:!0,stationary:Ot,verdict:Ot?"stationary":"non-stationary",regression:"ct"}}function re(ae,me={}){const be=[];for(let Ot=0;Ot<ae.length;Ot++){const gt=Number(ae[Ot]);Number.isFinite(gt)&&be.push(gt)}const je=be.length;if(je<3)return null;let Ne=Number.isFinite(me.maxlag)?Math.floor(me.maxlag):Math.min(10,je-1);Ne=Math.max(1,Math.min(Ne,je-1));let Re=0;for(const Ot of be)Re+=Ot;Re/=je;const ze=be.map(Ot=>Ot-Re);let De=0;for(const Ot of ze)De+=Ot*Ot;De/=je;const Ge=new Array(Ne+1).fill(0);Ge[0]=1;for(let Ot=1;Ot<=Ne;Ot++){let gt=0;for(let dt=Ot;dt<je;dt++)gt+=ze[dt]*ze[dt-Ot];Ge[Ot]=De>0?gt/je/De:0}const Ve=new Array(Ne+1).fill(0);Ve[0]=1;let Qe=[];for(let Ot=1;Ot<=Ne;Ot++){let gt=Ge[Ot];for(let At=1;At<Ot;At++)gt-=Qe[At-1]*Ge[Ot-At];let dt=1;for(let At=1;At<Ot;At++)dt-=Qe[At-1]*Ge[At];const jt=dt!==0?gt/dt:0,xt=new Array(Ot);for(let At=1;At<Ot;At++)xt[At-1]=Qe[At-1]-jt*Qe[Ot-1-At];xt[Ot-1]=jt,Ve[Ot]=jt,Qe=xt}const mt=1.96/Math.sqrt(je);return{acf:Ge,pacf:Ve,bounds:{upper:mt,lower:-mt},n:je,nlags:Ne,approximate:!0}}function fe(ae,me,be){const{xs:je,ys:Ne,n:Re}=$(ae,me,be);if(Re<2)return null;const ze=Oe(je),De=Oe(Ne);let Ge=0,Ve=0;for(let gt=0;gt<Re;gt++)Ge+=ze[gt],Ve+=De[gt];Ge/=Re,Ve/=Re;let Qe=0,mt=0,Ot=0;for(let gt=0;gt<Re;gt++){const dt=ze[gt]-Ge,jt=De[gt]-Ve;Qe+=dt*jt,mt+=dt*dt,Ot+=jt*jt}return mt===0||Ot===0?null:Math.max(-1,Math.min(1,Qe/Math.sqrt(mt*Ot)))}function oe(ae,me,be){const{xs:je,ys:Ne,n:Re}=$(ae,me,be);if(Re<2||Re>i)return null;let ze=0,De=0,Ge=0,Ve=0;for(let Ot=0;Ot<Re;Ot++)for(let gt=Ot+1;gt<Re;gt++){const dt=Math.sign(je[Ot]-je[gt]),jt=Math.sign(Ne[Ot]-Ne[gt]),xt=dt*jt;xt>0?ze++:xt<0?De++:dt===0&&jt===0||(dt===0?Ge++:Ve++)}const Qe=ze+De+Ve,mt=ze+De+Ge;return Qe===0||mt===0?null:(ze-De)/Math.sqrt(Qe*mt)}function ce(ae,me={}){const be=ae.length;if(be<2)return null;const je=ae[0],Ne=ae[be-1],Re=[];for(let At=1;At<be;At++){const Bt=ae[At-1];Bt!==0&&Re.push((ae[At]-Bt)/Math.abs(Bt))}let ze=null;if(Re.length>1){let At=0;for(const nn of Re)At+=nn;At/=Re.length;let Bt=0;for(const nn of Re)Bt+=(nn-At)**2;ze=Math.sqrt(Bt/(Re.length-1))}const De=Number(me.periodsPerYear)>0?Number(me.periodsPerYear):null;let Ge=ae[0],Ve=0,Qe=0,mt=0,Ot=0;for(let At=1;At<be;At++){if(ae[At]>Ge){Ge=ae[At],Ve=At;continue}if(Ge<=0)continue;const Bt=(Ge-ae[At])/Ge;Bt>Qe&&(Qe=Bt,mt=Ve,Ot=At)}let gt=null;if(be>2){let At=0;for(let Vt=0;Vt<be;Vt++)At+=ae[Vt];At/=be;let Bt=0,nn=0;for(let Vt=0;Vt<be;Vt++){const Zt=ae[Vt]-At;nn+=Zt*Zt,Vt>0&&(Bt+=Zt*(ae[Vt-1]-At))}gt=nn>0?Bt/nn:null}let dt=0,jt=0;for(const At of Re)At>0?dt++:At<0&&jt++;let xt=null;if(je>0&&Ne>0){const At=(Ne/je)**(1/(be-1))-1;xt=De?(1+At)**De-1:At}return{n:be,first:je,last:Ne,change:Ne-je,changePercent:je===0?null:(Ne-je)/Math.abs(je)*100,volatility:ze,annualisedVolatility:ze!==null&&De?ze*Math.sqrt(De):null,growth:xt,maxDrawdown:Qe,maxDrawdownFrom:mt,maxDrawdownTo:Ot,autocorrelation:gt,upDays:dt,downDays:jt}}const de=1.128,ve=3.267;function ke(ae){const me=ae.length;if(me<2)return null;const be=[];for(let Ne=1;Ne<me;Ne++)be.push(Math.abs(ae[Ne]-ae[Ne-1]));const je=be.reduce((Ne,Re)=>Ne+Re,0)/be.length;return{ranges:be,centre:je,upper:ve*je,lower:0}}function Ce(ae){const me=ae.length;if(me<2)return null;let be=0;for(let Ne=1;Ne<me;Ne++)be+=Math.abs(ae[Ne]-ae[Ne-1]);const je=be/(me-1);return{sigma:je/de,meanRange:je}}function Le(ae,me){const be=ae.length;if(be<2||!me)return null;const je=Number.isFinite(Number(me.lower))?Number(me.lower):null,Ne=Number.isFinite(Number(me.upper))?Number(me.upper):null;if(je===null&&Ne===null)return null;let Re=0;for(let dt=0;dt<be;dt++)Re+=ae[dt];Re/=be;let ze=0;for(let dt=0;dt<be;dt++)ze+=(ae[dt]-Re)**2;const De=Math.sqrt(ze/(be-1)),Ge=Ce(ae),Ve=Ge?Ge.sigma:null,Qe=dt=>{if(!dt||dt<=0)return{index:null,k:null};const xt=je!==null&&Ne!==null?(Ne-je)/(6*dt):null,At=Ne!==null?(Ne-Re)/(3*dt):1/0,Bt=je!==null?(Re-je)/(3*dt):1/0;return{index:xt,k:Math.min(At,Bt)}},mt=Qe(Ve),Ot=Qe(De);let gt=0;for(let dt=0;dt<be;dt++){if(je!==null&&ae[dt]<je){gt++;continue}Ne!==null&&ae[dt]>Ne&>++}return{n:be,mean:Re,lower:je,upper:Ne,target:Number.isFinite(Number(me.target))?Number(me.target):null,sigmaWithin:Ve,sigmaOverall:De,cp:mt.index,cpk:mt.k,pp:Ot.index,ppk:Ot.k,outOfSpec:gt,defectRate:be?gt/be:null}}function we(ae){const me=ae.length;if(me<2)return null;const be=Ce(ae);if(!be||!(be.sigma>0))return null;let je=0;for(let Ne=0;Ne<me;Ne++)je+=ae[Ne];return je/=me,{centre:je,sigma:be.sigma,upper:je+3*be.sigma,lower:je-3*be.sigma}}function He(ae,me){if(!me||!(me.sigma>0))return[];const be=ae.length,{centre:je,sigma:Ne}=me,Re=De=>(ae[De]-je)/Ne,ze=[];for(let De=0;De<be;De++){if(Math.abs(Re(De))>3&&ze.push({index:De,rule:1,description:"beyond three sigma"}),De>=2)for(const Ge of[1,-1]){let Ve=0;for(let Qe=De-2;Qe<=De;Qe++)Re(Qe)*Ge>2&&Ve++;if(Ve>=2){ze.push({index:De,rule:2,description:"two of three past two sigma"});break}}if(De>=4)for(const Ge of[1,-1]){let Ve=0;for(let Qe=De-4;Qe<=De;Qe++)Re(Qe)*Ge>1&&Ve++;if(Ve>=4){ze.push({index:De,rule:3,description:"four of five past one sigma"});break}}if(De>=7)for(const Ge of[1,-1]){let Ve=!0;for(let Qe=De-7;Qe<=De;Qe++)if(Re(Qe)*Ge<=0){Ve=!1;break}if(Ve){ze.push({index:De,rule:4,description:"eight in a row on one side"});break}}}return ze}function Te(ae,me){if(!me||!(me.sigma>0))return[];const be=ae.length,{centre:je,sigma:Ne}=me,Re=Ge=>(ae[Ge]-je)/Ne,ze=(Ge,Ve,Qe,mt)=>{for(const Ot of[1,-1]){let gt=0;for(let dt=Ge;dt<=Ve;dt++)Re(dt)*Ot>Qe&>++;if(gt>=mt)return!0}return!1},De=[];for(let Ge=0;Ge<be;Ge++){if(Math.abs(Re(Ge))>3&&De.push({index:Ge,rule:1,description:"beyond three sigma"}),Ge>=8)for(const Ve of[1,-1]){let Qe=!0;for(let mt=Ge-8;mt<=Ge;mt++)if(Re(mt)*Ve<=0){Qe=!1;break}if(Qe){De.push({index:Ge,rule:2,description:"nine in a row on one side"});break}}if(Ge>=5)for(const Ve of[1,-1]){let Qe=!0;for(let mt=Ge-4;mt<=Ge;mt++)if((ae[mt]-ae[mt-1])*Ve<=0){Qe=!1;break}if(Qe){De.push({index:Ge,rule:3,description:Ve>0?"six rising":"six falling"});break}}if(Ge>=13){let Ve=!0;for(let Qe=Ge-12;Qe<=Ge;Qe++){const mt=ae[Qe]-ae[Qe-1],Ot=ae[Qe+1<=Ge?Qe+1:Qe]-ae[Qe];if(Qe+1>Ge)break;if(mt===0||Ot===0||mt>0==Ot>0){Ve=!1;break}}Ve&&De.push({index:Ge,rule:4,description:"fourteen alternating"})}if(Ge>=2&&ze(Ge-2,Ge,2,2)&&De.push({index:Ge,rule:5,description:"two of three past two sigma"}),Ge>=4&&ze(Ge-4,Ge,1,4)&&De.push({index:Ge,rule:6,description:"four of five past one sigma"}),Ge>=14){let Ve=!0;for(let Qe=Ge-14;Qe<=Ge;Qe++)if(Math.abs(Re(Qe))>=1){Ve=!1;break}Ve&&De.push({index:Ge,rule:7,description:"fifteen within one sigma"})}if(Ge>=7){let Ve=!0;for(let Qe=Ge-7;Qe<=Ge;Qe++)if(Math.abs(Re(Qe))<=1){Ve=!1;break}Ve&&De.push({index:Ge,rule:8,description:"eight beyond one sigma"})}}return De}const Ae=Object.freeze(["westernElectric","nelson"]);function Se(ae,me,be="westernElectric"){return String(be)==="nelson"?Te(ae,me):He(ae,me)}function Ee(ae,me,be){let je=0;for(let Ne=0;Ne<ae.length;Ne++)(ae[Ne]<me||ae[Ne]>be)&&je++;return je}function Me(ae,me,be,je=20){const Ne=ae.length;if(!Ne)return[];const Re=ae[0],ze=ae[Ne-1];if(ze===Re)return[{from:Re,to:ze,count:Ne}];const De=be-me,Ge=1.5*De;let Ve=De>0?Math.max(Re,me-Ge):Re,Qe=De>0?Math.min(ze,be+Ge):ze;Qe>Ve||(Ve=Re,Qe=ze);const mt=De>0?2*De/Math.cbrt(Ne):(Qe-Ve)/(Math.ceil(Math.log2(Ne))+1),Ot=mt>0?Math.min(je,Math.max(1,Math.ceil((Qe-Ve)/mt))):1,gt=(Qe-Ve)/Ot,dt=[];for(let jt=0;jt<Ot;jt++)dt.push({from:Ve+jt*gt,to:Ve+(jt+1)*gt,count:0});for(let jt=0;jt<Ne;jt++){const xt=Math.min(Ot-1,Math.max(0,Math.floor((ae[jt]-Ve)/gt)));dt[xt].count++}return dt[0].from=Re,dt[Ot-1].to=ze,dt}const Be=.95;function Ke(ae){const me=Number(ae);return Number.isFinite(me)&&me>0&&me<1?me:Be}function et(ae,me=Be){const be=ae.length;if(be<2)return null;let je=0;for(let Qe=0;Qe<be;Qe++)je+=ae[Qe];const Ne=je/be;let Re=0;for(let Qe=0;Qe<be;Qe++){const mt=ae[Qe]-Ne;Re+=mt*mt}const ze=Math.sqrt(Re/(be-1)),De=Ke(me),Ve=L(1-(1-De)/2,be-1)*ze/Math.sqrt(be);return{mean:Ne,lower:Ne-Ve,upper:Ne+Ve,margin:Ve,n:be,confidence:De}}function Je(ae,me,be=Be){const je=Number(ae),Ne=Number(me);if(!(Ne>0)||!(je>=0)||je>Ne)return null;const Re=Ke(be),ze=U(1-(1-Re)/2),De=je/Ne,Ge=ze*ze,Ve=1+Ge/Ne,Qe=(De+Ge/(2*Ne))/Ve,mt=ze/Ve*Math.sqrt(De*(1-De)/Ne+Ge/(4*Ne*Ne));return{proportion:De,lower:Math.max(0,Qe-mt),upper:Math.min(1,Qe+mt),n:Ne,confidence:Re}}function ut(ae,me=Be){if(!ae||!(ae.n>2)||!Number.isFinite(ae.stdError))return null;const be=Ke(me),Ne=L(1-(1-be)/2,ae.n-2)*ae.stdError;return{slope:ae.slope,lower:ae.slope-Ne,upper:ae.slope+Ne,margin:Ne,confidence:be}}function Ct(ae,me,be=Be){const je=Number(ae),Ne=Number(me);if(!Number.isFinite(je)||!(Ne>1))return null;const Re=Ke(be),De=U(1-(1-Re)/2)*Math.sqrt(1/(9*Ne)+je*je/(2*(Ne-1)));return{index:je,lower:je-De,upper:je+De,margin:De,n:Ne,confidence:Re}}function Nt(ae,me){return!ae||!(ae.sd>0)||!Number.isFinite(me)||!Number.isFinite(ae.mean)?null:(me-ae.mean)/ae.sd}function st(ae){return Number.isFinite(ae)?Math.min(1,Math.max(0,2*x(Math.abs(ae)/2)-1)):0}function it(ae,me){const be=new Map,je=K(ae);let Ne=0;for(let Re=0;Re<me.length;Re++){const ze=je(me[Re]);if(ze==null||ze===""||typeof ze=="number"&&Number.isNaN(ze))continue;const De=ze instanceof Date?ze.getTime():typeof ze=="object"?String(ze):ze;be.set(De,(be.get(De)||0)+1),Ne++}return{map:be,total:Ne}}function ct(ae,me,be,je){if(!(me>0)||!(je>0))return null;let Ne=0;const Re=new Set(ae.keys());for(const ze of be.keys())Re.add(ze);for(const ze of Re){const De=(ae.get(ze)||0)/me,Ge=(be.get(ze)||0)/je;Ne+=Math.abs(De-Ge)}return Ne/2}const Tt=10;function $t(ae,me,be){if(be&&be.numeric){const De=m(ae,me),{n:Ge,mean:Ve}=d(De),Qe=Ge>0?Nt({mean:be.mean,sd:be.sd},Ve):null;return{measure:"standardizedMeanDifference",magnitude:Qe,distance:Qe===null?0:st(Qe),direction:Qe===null?0:Math.sign(Qe),subsetN:Ge,populationN:be.n||0,reliable:Ge>=Tt}}const{map:Ne,total:Re}=it(ae,me),ze=ct(Ne,Re,be.map,be.total);return{measure:"categoricalTotalVariation",magnitude:ze,distance:ze===null?0:ze,direction:0,subsetN:Re,populationN:be.total||0,reliable:Re>=Tt}}function It(ae,me){if(ae&&(ae.kind==="float64"||ae.kind==="int32"))return!0;const be=K(ae);let je=0,Ne=0;for(let Re=0;Re<me.length&&je<200;Re++){const ze=be(me[Re]);if(ze==null||ze==="")continue;if(ze instanceof Date)return!1;je++;const De=typeof ze=="number"?ze:Number(ze);Number.isFinite(De)&&Ne++}return je===0?!1:Ne/je>=.9}function ft(ae,me){if(It(ae,me)){const Ne=m(ae,me),{n:Re,mean:ze,m2:De}=d(Ne);return{numeric:!0,mean:ze,sd:Re>0?Math.sqrt(De/Re):0,n:Re}}const{map:be,total:je}=it(ae,me);return{numeric:!1,map:be,total:je}}}),_e("packages/core/src/compute/total.js",function(e,F){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"aggregatesFor",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"aggregateAllowed",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return d}});const E=F("packages/core/src/internal/predicates.js").isFunction,I=F("packages/core/src/internal/warn.js").warnOnce,L=F("packages/core/src/compute/handle.js"),Q=L.presenceReader,U=L.valueComparator,x=L.valueReader,q=F("packages/core/src/compute/statistics.js"),R=q.STAT_FNS,j=q.STAT_LABELS;function k(w){return!!w&&(w.kind==="float64"||w.kind==="int32")}function b(w,v){const P=v.length;let W=0;if(k(w)){const G=w.values,_=Q(w);if(!_){for(let T=0;T<P;T++){const S=G[v[T]];Number.isNaN(S)||(W+=S)}return W}for(let T=0;T<P;T++){const S=v[T];if(_(S)===1){const O=G[S];Number.isNaN(O)||(W+=O)}}return W}const V=x(w);for(let G=0;G<P;G++){const _=m(V(v[G]));_!==null&&(W+=_)}return W}b.kernel=!0;function u(w,v){const P=v.length;let W=0;if(k(w)){const G=w.values,_=Q(w);if(!_){for(let T=0;T<P;T++)Number.isNaN(G[v[T]])||W++;return W}for(let T=0;T<P;T++){const S=v[T];_(S)===1&&!Number.isNaN(G[S])&&W++}return W}const V=x(w);for(let G=0;G<P;G++){const _=V(v[G]);_!=null&&!(typeof _=="number"&&Number.isNaN(_))&&W++}return W}u.kernel=!0;function g(w,v){return v.length}g.kernel=!0;function o(w,v){const P=u(w,v);return P===0?null:b(w,v)/P}o.kernel=!0;function t(w,v,P,W){const V=v.length;if(k(w)){const S=w.values,O=Q(w);let M=null;if(!O){for(let A=0;A<V;A++){const N=S[v[A]];Number.isNaN(N)||(M===null||(P<0?N<M:N>M))&&(M=N)}return M}for(let A=0;A<V;A++){const N=v[A];if(O(N)===0)continue;const $=S[N];Number.isNaN($)||(M===null||(P<0?$<M:$>M))&&(M=$)}return M}const G=x(w),_=U(W);let T=null;for(let S=0;S<V;S++){const O=G(v[S]);O==null||typeof O=="number"&&Number.isNaN(O)||(T===null||(P<0?_(O,T)<0:_(O,T)>0))&&(T=O)}return T}function i(w,v,P){return t(w,v,-1,P&&P.locale)}i.kernel=!0;function s(w,v,P){return t(w,v,1,P&&P.locale)}s.kernel=!0;function r(w,v){return v.length===0?null:x(w)(v[0])}r.kernel=!0;function n(w,v){return v.length===0?null:x(w)(v[v.length-1])}n.kernel=!0;function m(w){if(typeof w=="number")return Number.isNaN(w)?null:w;if(w==null||w===""||typeof w=="boolean")return null;if(w instanceof Date)return w.getTime();const v=Number(w);return Number.isNaN(v)?null:v}const l={sum:b,min:i,max:s,avg:o,count:g,first:r,last:n,countValues:u,...R},a=Object.freeze({...j,sum:"Sum",avg:"Average",min:"Min",max:"Max",count:"Count",countValues:"Count of values",first:"First",last:"Last"});function c(w){return w?typeof w=="string"?a[w]||w:"Total":""}const f=Object.freeze(["sum","avg","min","max","count","countValues","first","last"]);function p(w){const v=w&&w.dataType&&w.dataType.totals&&w.dataType.totals.supported;if(Array.isArray(v))return v.slice();const P=f.filter(W=>W in l);for(const W of Object.keys(l))P.includes(W)||P.push(W);return P}function y(w,v){return typeof v!="string"?!0:p(w).includes(v)}function h(w,v){const P=x(w),W=[];for(let V=0;V<v.length;V++){const G=P(v[V]);G!=null&&W.push(G)}return W}function d(w,v,P,W){const V=v||[];if(P&&typeof P=="object"&&typeof P.fn=="string"){const{fn:G,..._}=P,T=l[G];return T?T(w,V,{...W,..._}):(I(`total:${G}`,`unknown total function "${G}"; register it in config.totalFns`),null)}if(typeof P=="string"){const G=l[P];return G?G(w,V,W):(I(`total:${P}`,`unknown total function "${P}"; register it in config.totalFns`),null)}return E(P)?P.kernel===!0?P(w,V,W):P(h(w,V),W||{}):null}}),_e("packages/core/src/compute/windowed.js",function(e,F){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Q}});const E=F("packages/core/src/compute/sketch.js").Welford;class K{#e;#t;#n=[];#r;#i;constructor(x,q=0,R=Date.now){if(x!=="count"&&x!=="time"&&x!=="session")throw new RangeError(`unknown window kind: ${x}`);if((x==="count"||x==="time")&&!(q>0))throw new RangeError(`a ${x} window needs a positive span`);this.#e=x,this.#t=Math.floor(q),this.#r=R,this.#i=R()}get size(){return this.#n.length}push(x,q=this.#r()){Number.isFinite(x)&&(this.#n.push({t:q,v:x}),this.#s(q))}#s(x){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const q=x-this.#t;for(;this.#n.length&&this.#n[0].t<q;)this.#n.shift()}}spec(){const x=this.#e==="session"?this.#r()-this.#i:this.#t;return{kind:this.#e,span:x,size:this.#n.length}}values(){return this.#n.map(x=>x.v)}aggregate(){const x=this.spec();if(!this.#n.length)return{over:x,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const q=new E;let R=0,j=1/0,k=-1/0;for(const{v:b}of this.#n)R+=b,b<j&&(j=b),b>k&&(k=b),q.add(b);return{over:x,count:this.#n.length,sum:R,mean:q.mean(),min:j,max:k,variance:q.variance(),stddev:q.stddev()}}reduce(x){const q=this.aggregate(),R={sum:q.sum,avg:q.mean,mean:q.mean,min:q.min,max:q.max,count:q.count,variance:q.variance,stddev:q.stddev};if(!(x in R))throw new RangeError(`unknown windowed aggregate: ${x}`);return{value:R[x],over:q.over}}}const I=Object.freeze(["count","time","session"]);function L(U,x=Date.now){const q=U.kind==="time"&&U.minutes!=null?U.minutes*6e4:U.span??0;return new K(U.kind,q,x)}const Q={Window:K,WINDOW_KINDS:I,openWindow:L}}),_e("packages/core/src/compute/rolling.js",function(e,F){"use strict";Object.defineProperty(e,"ROLLING_WINDOW_FIELDS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"rollingWindow",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"rollingQuantile",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"seasonalDecompose",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"exponentialSmoothing",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return m}});const E=F("packages/core/src/compute/windowed.js").openWindow,I=F("packages/core/src/compute/sketch.js").KLL,L=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function Q(l,a,c,f){if(l.kind==="count"){const p=Math.max(1,Math.floor(l.span||0));return{coverage:Math.min(1,a/p),partial:a<p}}if(l.kind==="time"){const p=l.minutes!=null?l.minutes*6e4:l.span||0;if(!(p>0))return{coverage:1,partial:!1};const y=c-f;return{coverage:Math.min(1,y/p),partial:y<p}}return{coverage:null,partial:!1}}function U(l,a){const c=E(a),f=new Map,p=l.length?l[0].at:0;for(let y=0;y<l.length;y++){const{key:h,at:d,value:w}=l[y];Number.isFinite(w)&&c.push(w,d);const v=c.aggregate(),P=Q(a,v.count,d,p);h!=null&&f.set(String(h),{sum:v.sum,avg:v.mean,min:v.min,max:v.max,count:v.count,coverage:P.coverage,partial:P.partial})}return f}function x(l){const a=new Map;let c=0;for(const{key:f,value:p}of l)Number.isFinite(p)&&(c+=p),f!=null&&a.set(String(f),c);return a}function q(l,a=1){const c=new Map,f=Math.max(1,Math.floor(a));for(let p=0;p<l.length;p++){const{key:y,value:h}=l[p];if(y==null)continue;const d=p>=f?l[p-f].value:null,w=Number.isFinite(h)?h:null,v=Number.isFinite(d)?d:null;c.set(String(y),w!==null&&v!==null?w-v:null)}return c}const R=4096;function j(l){let a=l>>>0;return()=>{a+=1831565813;let c=a;return c=Math.imul(c^c>>>15,c|1),c^=c+Math.imul(c^c>>>7,c|61),((c^c>>>14)>>>0)/4294967296}}function k(l,a){const c=l.length;if(c===1)return l[0];const f=(c-1)*a,p=Math.floor(f),y=Math.ceil(f);return p===y?l[p]:l[p]+(f-p)*(l[y]-l[p])}function b(l,a,c={}){const f=Math.min(1,Math.max(0,c.q==null?.5:c.q)),p=Math.max(1,Math.floor(c.cap==null?R:c.cap)),y=j(c.seed==null?2654435769:c.seed),h=new Map,d=l.length?l[0].at:0;if(a.kind==="session"){const v=new I(200,y);let P=0;for(const{key:W,value:V}of l)Number.isFinite(V)&&(v.add(V),P++),W!=null&&h.set(String(W),{value:P?v.quantile(f):null,approx:P>0,count:P,coverage:null,partial:!1});return h}const w=E(a);for(const{key:v,at:P,value:W}of l){Number.isFinite(W)&&w.push(W,P);const V=w.values(),G=V.length;let _=null,T=!1;if(G)if(G<=p)_=k([...V].sort((O,M)=>O-M),f);else{const O=new I(200,y);for(const M of V)O.add(M);_=O.quantile(f),T=!0}const S=Q(a,G,P,d);v!=null&&h.set(String(v),{value:_,approx:T,count:G,coverage:S.coverage,partial:S.partial})}return h}function u(l,a){const c=l.length,f=new Array(c).fill(null),p=Math.floor(a/2),y=a%2===0;for(let h=0;h<c;h++){if(h-p<0||h+p>=c)continue;let d=0,w=!0;if(y)for(let v=-p;v<=p;v++){const P=l[h+v];if(!Number.isFinite(P)){w=!1;break}d+=v===-p||v===p?P*.5:P}else for(let v=-p;v<=p;v++){const P=l[h+v];if(!Number.isFinite(P)){w=!1;break}d+=P}w&&(f[h]=d/a)}return f}function g(l,a){const c=new Map,f=Math.floor(Number(a&&a.period));if(!(f>=2))return c;const p=a&&a.model==="multiplicative",y=l.length,h=l.map(T=>Number.isFinite(T.value)?T.value:null),d=u(h,f),w=new Array(y).fill(null);for(let T=0;T<y;T++){const S=d[T],O=h[T];S===null||O===null||(p?S!==0&&(w[T]=O/S):w[T]=O-S)}const v=new Array(f).fill(0),P=new Array(f).fill(0);for(let T=0;T<y;T++){if(w[T]===null)continue;const S=T%f;v[S]+=w[T],P[S]+=1}const W=p?1:0,V=v.map((T,S)=>P[S]?T/P[S]:W),G=V.reduce((T,S)=>T+S,0)/f,_=p?V.map(T=>G!==0?T/G:1):V.map(T=>T-G);for(let T=0;T<y;T++){const{key:S}=l[T];if(S==null)continue;const O=d[T],M=_[T%f],A=h[T];let N=null;O!==null&&A!==null&&(N=p?O*M!==0?A/(O*M):null:A-O-M),c.set(String(S),{trend:O,seasonal:A===null?null:M,residual:N,coverage:O===null?0:1,partial:O===null})}return c}function o(l,a,c,f=80){const p=(Math.sqrt(5)-1)/2;let y=a,h=c,d=h-p*(h-y),w=y+p*(h-y),v=l(d),P=l(w);for(let W=0;W<f;W++)v<P?(h=w,w=d,P=v,d=h-p*(h-y),v=l(d)):(y=d,d=w,v=P,w=y+p*(h-y),P=l(w));return(y+h)/2}const t=1e-4,i=1-1e-4;function s(l,a){const c=l.length,f=new Array(c).fill(null),p=new Array(c).fill(null);let y=null,h=0;for(let d=0;d<c;d++){const w=l[d];if(!Number.isFinite(w)){y!==null&&(p[d]=y,f[d]=y);continue}if(y===null){y=w,p[d]=w,f[d]=w;continue}p[d]=y,h+=(w-y)**2,y=a*w+(1-a)*y,f[d]=y}return{smoothed:f,fitted:p,sse:h}}function r(l,a,c){const f=l.length,p=new Array(f).fill(null),y=new Array(f).fill(null);let h=null,d=null,w=0;for(let v=0;v<f;v++){const P=l[v];if(!Number.isFinite(P)){h!==null&&(h+=d,p[v]=h);continue}if(h===null){h=P,p[v]=P;continue}if(d===null){d=P-h;const G=h+d;y[v]=G,w+=(P-G)**2;const _=h;h=a*P+(1-a)*(_+d),d=c*(h-_)+(1-c)*d,p[v]=h;continue}const W=h+d;y[v]=W,w+=(P-W)**2;const V=h;h=a*P+(1-a)*(V+d),d=c*(h-V)+(1-c)*d,p[v]=h}return{smoothed:p,fitted:y,sse:w}}function n(l,a={}){const c=new Map,f=a.method==="holt",p=l.map(W=>Number.isFinite(W.value)?W.value:null),y=p.filter(W=>W!==null).length,h=W=>Math.min(i,Math.max(t,W)),d=()=>{for(const{key:W}of l)W!=null&&c.set(String(W),{smoothed:null,fitted:null,alpha:null,beta:null,sse:null});return c};if(y<(f?2:1))return d();let w=Number.isFinite(a.alpha)?h(a.alpha):null,v=f&&Number.isFinite(a.beta)?h(a.beta):null;if(f){if(w===null||v===null){let W=w===null?.5:w,V=v===null?.5:v;for(let G=0;G<6;G++)w===null&&(W=o(_=>r(p,_,V).sse,t,i)),v===null&&(V=o(_=>r(p,W,_).sse,t,i));w=w===null?W:w,v=v===null?V:v}}else w===null&&(w=o(W=>s(p,W).sse,t,i));const P=f?r(p,w,v):s(p,w);for(let W=0;W<l.length;W++){const{key:V}=l[W];V!=null&&c.set(String(V),{smoothed:P.smoothed[W],fitted:P.fitted[W],alpha:w,beta:f?v:null,sse:P.sse})}return c}const m={ROLLING_WINDOW_FIELDS:L,QUANTILE_SPAN_CAP:R,rollingWindow:U,rollingQuantile:b,cumulativeToDate:x,periodOverPeriod:q,seasonalDecompose:g,exponentialSmoothing:n}}),_e("packages/core/src/compute/cluster.js",function(e,F){"use strict";Object.defineProperty(e,"CLUSTER_ROW_CAP",{enumerable:!0,get:function(){return ie}}),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 I}}),Object.defineProperty(e,"orderByCentre",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"kmeans",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"dbscan",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"autoK",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"standardise",{enumerable:!0,get:function(){return t}});const ie=1e5,E=2e4,K=3,I=5,L=100;function Q(i){let s=i>>>0;return function(){s=s+1831565813|0;let n=Math.imul(s^s>>>15,1|s);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}function U(i,s){let r=0;for(let n=0;n<i.length;n++){const m=i[n]-s[n];r+=m*m}return r}function x(i,s){return Math.sqrt(U(i,s))}function q(i,s){let r=-1,n=1/0;for(let m=0;m<s.length;m++){const l=U(i,s[m]);l<n&&(n=l,r=m)}return r}function R(i,s,r){const n=Q(r),m=i.length,l=[Array.from(i[Math.floor(n()*m)])],a=new Float64Array(m).fill(1/0);for(let c=1;c<s;c++){let f=0;for(let d=0;d<m;d++){const w=U(i[d],l[l.length-1]);w<a[d]&&(a[d]=w),f+=a[d]}const p=n()*(f||m);let y=0,h=m-1;for(let d=0;d<m;d++)if(y+=f?a[d]:1,y>=p){h=d;break}l.push(Array.from(i[h]))}return l}function j(i,s){for(let r=0;r<i.length;r++){const n=i[r]-s[r];if(n!==0)return n}return 0}function k(i,s,r,n){const m=s.map((a,c)=>({centre:a,i:c})).sort((a,c)=>j(a.centre,c.centre)),l=new Int32Array(s.length);for(let a=0;a<m.length;a++)l[m[a].i]=a;for(let a=0;a<i.length;a++)i[a]>=0&&(i[a]=l[i[a]]);return{assignments:i,centres:m.map(a=>a.centre),sizes:m.map(a=>r[a.i]),distances:n}}function b(i,s={}){const r=i.length,n=r?i[0].length:0,m=Math.floor(s.k||K);if(!(r>=m)||m<1||n<1)return null;let l=R(i,m,s.seed===void 0?1:s.seed);const a=new Int32Array(r);let c=!0;for(let h=0;h<L&&c;h++){c=!1;for(let v=0;v<r;v++){const P=q(i[v],l);a[v]!==P&&(a[v]=P,c=!0)}const d=l.map(()=>new Float64Array(n)),w=new Array(m).fill(0);for(let v=0;v<r;v++){const P=a[v];for(let W=0;W<n;W++)d[P][W]+=i[v][W];w[P]++}for(let v=0;v<m;v++)if(w[v])for(let P=0;P<n;P++)l[v][P]=d[v][P]/w[v];else{let P=0,W=-1/0;for(let V=0;V<r;V++){const G=U(i[V],l[v]);G>W&&(W=G,P=V)}l[v]=Array.from(i[P]),c=!0}}const f=new Array(m).fill(0),p=new Float64Array(r);let y=0;for(let h=0;h<r;h++){const d=a[h];f[d]++;const w=U(i[h],l[d]);p[h]=Math.sqrt(w),y+=w}return{assignments:a,centres:l,sizes:f,inertia:y,distances:p}}function u(i,s={}){const r=i.length,n=r?i[0].length:0,m=Number(s.eps),l=Math.max(1,Math.floor(s.minPoints||I));if(!(m>0)||r===0||n<1)return null;const a=new Array(r);for(let w=0;w<r;w++){const v=[];for(let P=0;P<r;P++)w!==P&&x(i[w],i[P])<=m&&v.push(P);a[w]=v}const c=new Int32Array(r).fill(-1);let f=0;for(let w=0;w<r;w++){if(c[w]!==-1||a[w].length<l)continue;c[w]=f;const v=[...a[w]];for(let P=0;P<v.length;P++){const W=v[P];c[W]===-1&&(c[W]=f,a[W].length>=l&&v.push(...a[W]))}f++}if(!f)return{assignments:c,centres:[],sizes:[],distances:new Float64Array(r).fill(NaN)};const p=[],y=new Array(f).fill(0),h=Array.from({length:f},()=>new Float64Array(n));for(let w=0;w<r;w++){const v=c[w];if(!(v<0)){y[v]++;for(let P=0;P<n;P++)h[v][P]+=i[w][P]}}for(let w=0;w<f;w++){const v=new Array(n);for(let P=0;P<n;P++)v[P]=h[w][P]/y[w];p.push(v)}const d=new Float64Array(r).fill(NaN);for(let w=0;w<r;w++){const v=c[w];v>=0&&(d[w]=x(i[w],p[v]))}return{assignments:c,centres:p,sizes:y,distances:d}}function g(i,s,r){const n=i.length;if(n===0)return 0;const m=new Int32Array(r);for(let a=0;a<n;a++)m[s[a]]++;let l=0;for(let a=0;a<n;a++){const c=s[a],f=new Float64Array(r);for(let h=0;h<n;h++)a!==h&&(f[s[h]]+=x(i[a],i[h]));const p=m[c]>1?f[c]/(m[c]-1):0;let y=1/0;for(let h=0;h<r;h++){if(h===c||m[h]===0)continue;const d=f[h]/m[h];d<y&&(y=d)}y!==1/0&&(l+=(y-p)/Math.max(p,y))}return l/n}function o(i,s={}){const r=i.length;if(!r)return null;const n=s.criterion==="silhouette"?"silhouette":"elbow",m=Math.max(2,Math.floor(s.maxK||8)),l=s.seed===void 0?1:s.seed;if(n==="silhouette"){const w=[],v=[];for(let W=2;W<=Math.min(m,r);W++){const V=b(i,{k:W,seed:l});V&&(w.push(W),v.push(g(i,V.assignments,W)))}if(!w.length)return null;let P=0;for(let W=1;W<v.length;W++)v[W]>v[P]&&(P=W);return{k:w[P],criterion:n,scores:v,ks:w}}const a=[],c=[];for(let w=1;w<=Math.min(m,r);w++){const v=b(i,{k:w,seed:l});v&&(a.push(w),c.push(v.inertia))}if(c.length<2)return null;const f={k:a[0],y:c[0]},p={k:a[a.length-1],y:c[c.length-1]},y=Math.hypot(p.k-f.k,p.y-f.y)||1;let h=0,d=-1/0;for(let w=0;w<c.length;w++){const v=Math.abs((p.k-f.k)*(f.y-c[w])-(f.k-a[w])*(p.y-f.y))/y;v>d&&(d=v,h=w)}return{k:a[h],criterion:n,scores:c,ks:a}}function t(i){const s=i.length,r=s?i[0].length:0;if(!s||!r)return null;const n=new Array(r).fill(0);for(let l=0;l<s;l++)for(let a=0;a<r;a++)n[a]+=i[l][a];for(let l=0;l<r;l++)n[l]/=s;const m=new Array(r).fill(0);for(let l=0;l<s;l++)for(let a=0;a<r;a++){const c=i[l][a]-n[a];m[a]+=c*c}for(let l=0;l<r;l++)m[l]=s>1?Math.sqrt(m[l]/(s-1)):0;for(let l=0;l<s;l++)for(let a=0;a<r;a++)m[a]>0?i[l][a]=(i[l][a]-n[a])/m[a]:i[l][a]=i[l][a]-n[a];return{mean:n,sd:m}}}),_e("packages/core/src/compute/compare.js",function(e,F){"use strict";Object.defineProperty(e,"COMPARE_MEASURES",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"pooledStandardMeanDifference",{enumerable:!0,get:function(){return R}}),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 b}}),Object.defineProperty(e,"compareDatasets",{enumerable:!0,get:function(){return u}});const ie=F("packages/core/src/compute/statistics.js"),E=ie.numbers,K=ie.moments,I=ie.frequencyMap,L=ie.categoricalDistance,Q=ie.normalTotalVariation,U=ie.isNumericColumn,x=ie.SUBSET_RELIABILITY_FLOOR,q=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function R(g,o){if(!g||!o||!(g.n>0)||!(o.n>0)||!Number.isFinite(g.mean)||!Number.isFinite(o.mean))return null;const t=(g.n*g.sd*g.sd+o.n*o.sd*o.sd)/(g.n+o.n);return t>0?(g.mean-o.mean)/Math.sqrt(t):null}function j(g,o){const t=E(g,o),{n:i,mean:s,m2:r}=K(t),n=i>0?Math.sqrt(r/i):0;return{mean:s,sd:n,n:i}}function k(g,o,t,i){return U(g,o)&&U(t,i)}function b(g,o,t,i){if(k(g,o,t,i)){const m=j(g,o),l=j(t,i),a=R(m,l);return{measure:q.numeric,magnitude:a,distance:a===null?0:Q(a),direction:a===null?0:Math.sign(a),nA:m.n,nB:l.n,meanA:m.mean,meanB:l.mean,reliable:m.n>=x&&l.n>=x}}const s=I(g,o),r=I(t,i),n=L(s.map,s.total,r.map,r.total);return{measure:q.categorical,magnitude:n,distance:n===null?0:n,direction:0,nA:s.total,nB:r.total,meanA:null,meanB:null,reliable:s.total>=x&&r.total>=x}}function u(g,o,t={}){const i=new Set(g.columns),s=new Set(o.columns),r=g.columns.filter(c=>s.has(c)),n=Array.isArray(t.columns)&&t.columns.length?r.filter(c=>t.columns.includes(c)):r,m=g.indices(),l=o.indices(),a=[];for(const c of n){const f=g.handle(c),p=o.handle(c);if(!f||!p)continue;const y=b(f,m,p,l);a.push({column:c,name:g.name&&g.name(c)||o.name&&o.name(c)||c,measure:y.measure,magnitude:y.magnitude,distance:y.distance,direction:y.direction,nA:y.nA,nB:y.nB,meanA:y.meanA,meanB:y.meanB,reliable:y.reliable})}return a.sort((c,f)=>f.distance-c.distance||Math.abs(f.magnitude||0)-Math.abs(c.magnitude||0)),{ranked:a,nA:m.length,nB:l.length,unmatched:{onlyA:g.columns.filter(c=>!s.has(c)),onlyB:o.columns.filter(c=>!i.has(c))},measures:q}}}),_e("packages/core/src/compute/anomaly.js",function(e,F){"use strict";Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"DEFAULT_MODIFIED_Z_THRESHOLD",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return R}}),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 u}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return m}});const E=F("packages/core/src/compute/statistics.js").quantileSorted,I=F("packages/core/src/compute/special.js").logGamma,L=.6745,Q=3.5,U=1.5,x=.975,q=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function R(l){if(!l.length)return null;const c=Array.from(l,Number).sort((h,d)=>h-d),f=E(c,.5),p=c.map(h=>Math.abs(h-f)).sort((h,d)=>h-d),y=E(p,.5);return{median:f,mad:y}}function j(l,a={}){const c=Number.isFinite(a.threshold)?a.threshold:Q,f=l.length,p=new Array(f).fill(null),y=new Array(f).fill(!1),h=[];for(let v=0;v<f;v++){const P=Number(l[v]);Number.isFinite(P)&&h.push(P)}if(!h.length)return{median:null,mad:null,threshold:c,scores:p,flags:y,flagged:0};const d=R(h);if(d.mad===0)return{median:d.median,mad:0,threshold:c,scores:p,flags:y,flagged:0};let w=0;for(let v=0;v<f;v++){const P=Number(l[v]);if(!Number.isFinite(P))continue;const W=L*(P-d.median)/d.mad;p[v]=W,Math.abs(W)>c&&(y[v]=!0,w++)}return{median:d.median,mad:d.mad,threshold:c,scores:p,flags:y,flagged:w}}function k(l,a={}){const c=Number.isFinite(a.k)?a.k:U,f=[];for(let w=0;w<l.length;w++){const v=Number(l[w]);Number.isFinite(v)&&f.push(v)}if(!f.length)return null;const p=f.sort((w,v)=>w-v),y=E(p,.25),h=E(p,.75),d=h-y;return{q1:y,q3:h,iqr:d,lower:y-c*d,upper:h+c*d,k:c}}function b(l,a){if(a<=0)return 0;const c=I(l);if(a<l+1){let v=l,P=1/l,W=P;for(let V=0;V<1e3&&(v+=1,W*=a/v,P+=W,!(Math.abs(W)<Math.abs(P)*1e-15));V++);return P*Math.exp(-a+l*Math.log(a)-c)}const f=1e-300;let p=a+1-l,y=1/f,h=1/p,d=h;for(let v=1;v<1e3;v++){const P=-v*(v-l);p+=2,h=P*h+p,Math.abs(h)<f&&(h=f),y=p+P/y,Math.abs(y)<f&&(y=f),h=1/h;const W=h*y;if(d*=W,Math.abs(W-1)<1e-15)break}return 1-Math.exp(-a+l*Math.log(a)-c)*d}function u(l,a){return l<=0?0:b(a/2,l/2)}function g(l,a=x){if(!(a>0)||!(a<1))return NaN;let c=0,f=Math.max(1,l);for(;u(f,l)<a;)f*=2;for(let p=0;p<200;p++){const y=(c+f)/2;if(u(y,l)<a?c=y:f=y,f-c<1e-10)break}return(c+f)/2}function o(l){const a=l.length,c=l.map((f,p)=>{const y=f.slice();for(let h=0;h<a;h++)y.push(p===h?1:0);return y});for(let f=0;f<a;f++){let p=f;for(let h=f+1;h<a;h++)Math.abs(c[h][f])>Math.abs(c[p][f])&&(p=h);if(Math.abs(c[p][f])<1e-12)return null;if(p!==f){const h=c[p];c[p]=c[f],c[f]=h}const y=c[f][f];for(let h=0;h<2*a;h++)c[f][h]/=y;for(let h=0;h<a;h++){if(h===f)continue;const d=c[h][f];if(d!==0)for(let w=0;w<2*a;w++)c[h][w]-=d*c[f][w]}}return c.map(f=>f.slice(a))}function t(l,a){const c=l.length,f=new Array(a).fill(0);for(const h of l)for(let d=0;d<a;d++)f[d]+=h[d];for(let h=0;h<a;h++)f[h]/=c;const p=Array.from({length:a},()=>new Array(a).fill(0));for(const h of l)for(let d=0;d<a;d++){const w=h[d]-f[d];for(let v=d;v<a;v++)p[d][v]+=w*(h[v]-f[v])}const y=c>1?c-1:1;for(let h=0;h<a;h++)for(let d=h;d<a;d++)p[h][d]/=y,p[d][h]=p[h][d];return{mean:f,cov:p}}function i(l,a={}){const c=Number.isFinite(a.p)?a.p:x,f=Number.isFinite(a.ridge)?a.ridge:1e-6,p=l.length;if(!p)return null;const y=l[0].length;if(!y)return null;const h=new Array(p).fill(null),d=new Array(p).fill(null),w=new Array(p).fill(!1),v=[],P=[];for(let M=0;M<p;M++){const A=l[M];let N=A.length===y;const $=new Array(y);for(let H=0;N&&H<y;H++){const Y=Number(A[H]);Number.isFinite(Y)?$[H]=Y:N=!1}N&&(v.push(M),P.push($))}const W=y,V=g(W,c);if(P.length<=y)return{center:[],df:W,cutoff:V,singular:!0,used:P.length,distances:h,squared:d,flags:w,flagged:0};const{mean:G,cov:_}=t(P,y);let T=o(_),S=!1;if(!T){S=!0;let M=0;for(let $=0;$<y;$++)M+=_[$][$];const A=M/y*f||f,N=_.map(($,H)=>$.map((Y,Z)=>H===Z?Y+A:Y));if(T=o(N),!T)return{center:G,df:W,cutoff:V,singular:!0,used:P.length,distances:h,squared:d,flags:w,flagged:0}}let O=0;for(let M=0;M<P.length;M++){const A=P[M],N=new Array(y);for(let Y=0;Y<y;Y++)N[Y]=A[Y]-G[Y];let $=0;for(let Y=0;Y<y;Y++){let Z=0;for(let J=0;J<y;J++)Z+=T[Y][J]*N[J];$+=N[Y]*Z}$<0&&($=0);const H=v[M];d[H]=$,h[H]=Math.sqrt($),$>V&&(w[H]=!0,O++)}return{center:G,df:W,cutoff:V,singular:S,used:P.length,distances:h,squared:d,flags:w,flagged:O}}const s=20,r=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function n(l,a={}){const c=a.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",f=Number.isFinite(a.windowLen)&&a.windowLen>=1?Math.floor(a.windowLen):s,p=Number.isFinite(a.threshold)?a.threshold:Q,y=Number.isFinite(a.k)?a.k:U,h=Number.isFinite(a.minPeriods)&&a.minPeriods>=1?Math.floor(a.minPeriods):f,d=l.length,w=new Array(d).fill(null),v=new Array(d).fill(!1);let P=0;for(let W=0;W<d;W++){const V=Number(l[W]);if(!Number.isFinite(V))continue;const G=Math.max(0,W-f+1),_=[];for(let T=G;T<=W;T++){const S=Number(l[T]);Number.isFinite(S)&&_.push(S)}if(!(_.length<h))if(c==="rollingIqr"){const T=k(_,{k:y});if(!T)continue;(V<T.lower||V>T.upper)&&(v[W]=!0,P++)}else{const T=R(_);if(!T||T.mad===0)continue;const S=L*(V-T.median)/T.mad;w[W]=S,Math.abs(S)>p&&(v[W]=!0,P++)}}return{method:c,windowLen:f,minPeriods:h,threshold:p,k:y,scores:w,flags:v,flagged:P}}function m(l={}){const a=l||{},c=a.field;if(typeof c!="string"||!c)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const f=a.method||"modifiedZScore";if(!(q.includes(f)||r.includes(f))||f==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${f}'`);const y=typeof a.orderBy=="string"?a.orderBy:null,h=a.latest===!0,d=r.includes(f),w=v=>Number(v==null?NaN:v[c]);return v=>{const P=Array.isArray(v)?v.slice():[...v];y&&P.sort((T,S)=>{const O=T?.[y],M=S?.[y];return O===M?0:O==null?-1:M==null?1:O<M?-1:1});const W=P.map(w);let V,G;if(d)({flags:V,scores:G}=n(W,{method:f,windowLen:a.windowLen,threshold:a.threshold,k:a.k,minPeriods:a.minPeriods}));else if(f==="iqr"){const T=k(W,{k:a.k});V=W.map(S=>T?Number.isFinite(S)&&(S<T.lower||S>T.upper):!1),G=W.map(()=>null)}else({flags:V,scores:G}=j(W,{threshold:a.threshold}));if(h){const T=V.length-1;return T<0||!V[T]?!1:{method:f,field:c,flagged:[{row:P[T],score:G[T]}]}}const _=[];for(let T=0;T<V.length;T++)V[T]&&_.push({row:P[T],score:G[T]});return _.length?{method:f,field:c,flagged:_}:!1}}}),_e("packages/core/src/compute/forecast.js",function(e,F){"use strict";Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});const ie=F("packages/core/src/compute/special.js"),E=ie.normalQuantile,K=ie.studentTQuantile,L=F("packages/core/src/internal/warn.js").warnOnce,Q=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),U=1e-4,x=1-1e-4;function q(a){const c=[];for(let f=0;f<a.length;f++){const p=a[f];if(p!==null&&typeof p=="object"){const y=Number.isFinite(p.at)?p.at:f,h=Number.isFinite(p.value)?p.value:null;c.push({at:y,value:h})}else c.push({at:f,value:Number.isFinite(p)?Number(p):null})}return c}function R(a){const c=a.filter(d=>d.value!==null),f=c[0],p=c[c.length-1],y=p.at-f.at,h=c.length>1&&y>0?y/(c.length-1):1;return{lastAt:p.at,step:h}}function j(a){return Math.min(x,Math.max(U,a))}function k(a,c=U,f=x,p=80){const y=(Math.sqrt(5)-1)/2;let h=c,d=f,w=d-y*(d-h),v=h+y*(d-h),P=a(w),W=a(v);for(let V=0;V<p;V++)P<W?(d=v,v=w,W=P,w=d-y*(d-h),P=a(w)):(h=w,w=v,P=W,v=h+y*(d-h),W=a(v));return(h+d)/2}function b(a,c){let f=null,p=0,y=0;for(let h=0;h<a.length;h++){const d=a[h];if(d!==null){if(f===null){f=d;continue}p+=(d-f)**2,y+=1,f=c*d+(1-c)*f}}return{level:f,sse:p,m:y}}function u(a,c,f){let p=null,y=null,h=0,d=0;for(let w=0;w<a.length;w++){const v=a[w];if(v===null){p!==null&&y!==null&&(p+=y);continue}if(p===null){p=v;continue}y===null&&(y=v-p);const P=p+y;h+=(v-P)**2,d+=1;const W=p;p=c*v+(1-c)*(W+y),y=f*(p-W)+(1-f)*y}return{level:p,trend:y,sse:h,m:d}}function g(a,c,f,p,y){const h=a.length;if(h<2*c)return null;const d=S=>{let O=0,M=0;for(let A=S;A<S+c&&A<h;A++)a[A]!==null&&(O+=a[A],M+=1);return M?O/M:null},w=d(0),v=d(c);if(w===null||v===null)return null;let P=w,W=(v-w)/c;const V=new Array(c).fill(0);for(let S=0;S<c;S++)V[S]=a[S]===null?0:a[S]-P;const G=V.reduce((S,O)=>S+O,0)/c;for(let S=0;S<c;S++)V[S]-=G;let _=0,T=0;for(let S=c;S<h;S++){const O=S%c,M=V[O],A=a[S];if(A===null){P+=W;continue}const N=P+W+M;_+=(A-N)**2,T+=1;const $=P;P=f*(A-M)+(1-f)*(P+W),W=p*(P-$)+(1-p)*W,V[O]=y*(A-P)+(1-y)*M}return{level:P,trend:W,season:V,phase:(h-1)%c,sse:_,count:T}}function o(a,c,f){let p=1;for(const h of c)p+=h*h;const y=Math.sqrt(a*p);return{se:y,margin:f*y}}function t(a,c={}){if(!a||typeof a.length!="number"||a.length===0)return null;const f=Q.includes(c.method)?c.method:"linear",p=Math.max(1,Math.floor(Number(c.horizon)||1)),y=Number.isFinite(c.confidence)&&c.confidence>0&&c.confidence<1?c.confidence:.95,h=1-(1-y)/2,d=q(a),w=d.map(_=>_.value),v=w.filter(_=>_!==null),P=v.length,{lastAt:W,step:V}=P?R(d):{lastAt:0,step:1},G=_=>W+_*V;return f==="linear"?i(d,P,p,y,h,G):f==="movingAverage"?s(v,P,p,y,h,c,G):f==="ses"?r(w,P,p,y,h,c,G):f==="holt"?n(w,P,p,y,h,c,G):m(w,P,p,y,h,c,G)}function i(a,c,f,p,y,h){if(c<2)return null;let d=0,w=0;for(const A of a)A.value!==null&&(d+=A.at,w+=A.value);d/=c,w/=c;let v=0,P=0,W=0;for(const A of a){if(A.value===null)continue;const N=A.at-d,$=A.value-w;v+=N*N,P+=N*$,W+=$*$}if(v===0)return null;const V=P/v,G=w-V*d,_=W===0?1:Math.max(0,Math.min(1,P*P/(v*W))),T=Math.max(0,W-V*P),S=c>2?Math.sqrt(T/(c-2)):null,O=c>2?K(y,c-2):null,M=[];for(let A=1;A<=f;A++){const N=h(A),$=G+V*N;let H=null,Y=null,Z=null,J=null,D=null;if(S!==null){const te=1/c+(N-d)**2/v,z=S*Math.sqrt(1+te),X=S*Math.sqrt(te);D=z,H=$-O*z,Y=$+O*z,Z=$-O*X,J=$+O*X}M.push({step:A,at:N,mean:$,lower:H,upper:Y,lowerMean:Z,upperMean:J,se:D})}return{method:"linear",horizon:f,confidence:p,n:c,sigma:S,r2:_,params:{slope:V,intercept:G},points:M}}function s(a,c,f,p,y,h,d){if(c<1)return null;const w=Math.max(1,Math.min(c,Math.floor(Number(h.windowLen)||c))),v=a.slice(c-w);let P=0;for(const S of v)P+=S;const W=P/w;let V=null,G=null;if(w>1){let S=0;for(const M of v)S+=(M-W)**2;V=Math.sqrt(S/(w-1))*Math.sqrt(1+1/w),G=K(y,w-1)}const _=V===null?null:G*V,T=[];for(let S=1;S<=f;S++)T.push({step:S,at:d(S),mean:W,lower:_===null?null:W-_,upper:_===null?null:W+_,se:V});return{method:"movingAverage",horizon:f,confidence:p,n:c,sigma:V===null?null:V,params:{windowLen:w},points:T}}function r(a,c,f,p,y,h,d){if(c<1)return null;let w=Number.isFinite(h.alpha)?j(h.alpha):null;w===null&&(w=k(G=>b(a,G).sse));const v=b(a,w),P=E(y),W=v.m>0?v.sse/v.m:null,V=[];for(let G=1;G<=f;G++){const _=v.level;let T=null,S=null,O=null;if(W!==null){const M=[];for(let N=1;N<G;N++)M.push(w);const A=o(W,M,P);O=A.se,T=_-A.margin,S=_+A.margin}V.push({step:G,at:d(G),mean:_,lower:T,upper:S,se:O})}return{method:"ses",horizon:f,confidence:p,n:c,sigma:W===null?null:Math.sqrt(W),params:{alpha:w},points:V}}function n(a,c,f,p,y,h,d){if(c<2)return null;let w=Number.isFinite(h.alpha)?j(h.alpha):null,v=Number.isFinite(h.beta)?j(h.beta):null;if(w===null||v===null){let T=w===null?.5:w,S=v===null?.5:v;for(let O=0;O<6;O++)w===null&&(T=k(M=>u(a,M,S).sse)),v===null&&(S=k(M=>u(a,T,M).sse));w=w===null?T:w,v=v===null?S:v}const P=u(a,w,v),W=E(y),V=P.m>0?P.sse/P.m:null,G=w*v,_=[];for(let T=1;T<=f;T++){const S=P.level+T*P.trend;let O=null,M=null,A=null;if(V!==null){const N=[];for(let H=1;H<T;H++)N.push(w+H*G);const $=o(V,N,W);A=$.se,O=S-$.margin,M=S+$.margin}_.push({step:T,at:d(T),mean:S,lower:O,upper:M,se:A})}return{method:"holt",horizon:f,confidence:p,n:c,sigma:V===null?null:Math.sqrt(V),params:{alpha:w,beta:v},points:_}}function m(a,c,f,p,y,h,d){const w=Math.floor(Number(h.period));if(!(w>=2))return L("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(c<2*w)return null;let v=Number.isFinite(h.alpha)?j(h.alpha):null,P=Number.isFinite(h.beta)?j(h.beta):null,W=Number.isFinite(h.gamma)?j(h.gamma):null;const V=(A,N,$)=>{const H=g(a,w,A,N,$);return H?H.sse:1/0};if(v===null||P===null||W===null){let A=v===null?.5:v,N=P===null?.5:P,$=W===null?.5:W;for(let H=0;H<8;H++)v===null&&(A=k(Y=>V(Y,N,$))),P===null&&(N=k(Y=>V(A,Y,$))),W===null&&($=k(Y=>V(A,N,Y)));v=v===null?A:v,P=P===null?N:P,W=W===null?$:W}const G=g(a,w,v,P,W);if(!G)return null;const _=E(y),T=G.count>0?G.sse/G.count:null,S=v*P,O=W*(1-v),M=[];for(let A=1;A<=f;A++){const N=G.season[(G.phase+A)%w],$=G.level+A*G.trend+N;let H=null,Y=null,Z=null;if(T!==null){const J=[];for(let te=1;te<A;te++)J.push(v+te*S+(te%w===0?O:0));const D=o(T,J,_);Z=D.se,H=$-D.margin,Y=$+D.margin}M.push({step:A,at:d(A),mean:$,lower:H,upper:Y,se:Z})}return{method:"holtWinters",horizon:f,confidence:p,n:c,sigma:T===null?null:Math.sqrt(T),params:{alpha:v,beta:P,gamma:W,period:w},points:M}}const l={FORECAST_METHODS:Q,forecast:t}}),_e("packages/core/src/compute/hypothesis.js",function(e,F){"use strict";Object.defineProperty(e,"GROUP_TESTS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"NORMALITY_ALPHA",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"HL_PAIR_LIMIT",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"welchTTest",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"mannWhitneyUTest",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"chiSquareTest",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return _}});const E=F("packages/core/src/internal/warn.js").warnOnce,I=F("packages/core/src/compute/handle.js").valueReader,L=F("packages/core/src/compute/statistics.js"),Q=L.numbers,U=L.moments,x=L.frequencyMap,q=L.categoricalDistance,R=L.isNumericColumn,j=L.jarqueBera,k=L.proportionInterval,b=L.SUBSET_RELIABILITY_FLOOR,g=F("packages/core/src/compute/compare.js").pooledStandardMeanDifference,o=F("packages/core/src/compute/special.js"),t=o.studentT,i=o.studentTQuantile,s=o.normalCdf,r=o.normalQuantile,n=o.chiSquareUpperTail,m=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),l=.05,a=2e6;function c(T){const S=Number(T);return Number.isFinite(S)&&S>0&&S<1?S:.95}function f(T){const{n:S,mean:O,m2:M}=U(T);return{mean:O,sd:S>0?Math.sqrt(M/S):0,n:S}}function p(T,S){const O=T.length;if(O<2)return 0;let M=0;for(let A=0;A<O;A++){const N=T[A]-S;M+=N*N}return M/(O-1)}function y(T,S){return{name:"pooledStandardMeanDifference",value:g(f(T),f(S))}}function h(T,S,O){const M=T.length,A=S.length;if(M<2||A<2)return null;const N=c(O),{mean:$}=U(T),{mean:H}=U(S),Y=p(T,$),Z=p(S,H),J=Y/M+Z/A;if(!(J>0))return null;const D=Math.sqrt(J),te=($-H)/D,z=Y/M*(Y/M)/(M-1),X=Z/A*(Z/A)/(A-1),ne=J*J/(z+X),se=Math.min(1,Math.max(0,2*(1-t(Math.abs(te),ne)))),ue=$-H,ge=i(1-(1-N)/2,ne)*D;return{test:m.WELCH,statistic:te,statisticName:"t",df:ne,pValue:se,interval:{estimate:ue,lower:ue-ge,upper:ue+ge,confidence:N,method:"welch-t (difference of means)"},effectSize:y(T,S),nA:M,nB:A,reliable:M>=b&&A>=b,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function d(T){const S=T.length;if(S===0)return Number.NaN;const O=S>>1;return S%2?T[O]:(T[O-1]+T[O])/2}function w(T,S,O){const M=T.length,A=S.length,N=M*A;if(N===0||N>a)return null;const $=new Float64Array(N);let H=0;for(let z=0;z<M;z++)for(let X=0;X<A;X++)$[H++]=T[z]-S[X];$.sort();const Y=d($),Z=Math.sqrt(M*A*(M+A+1)/12),J=r(1-(1-O)/2);let D=Math.round(N/2-J*Z);D>=0||(D=0);const te=Math.floor((N-1)/2);return D>te&&(D=te),{estimate:Y,lower:$[D],upper:$[N-1-D],confidence:O,method:"hodges-lehmann (normal approximation)"}}function v(T,S,O){const M=T.length,A=S.length;if(M<1||A<1)return null;const N=c(O),$=M+A,H=new Array($);for(let se=0;se<M;se++)H[se]={v:T[se],g:0};for(let se=0;se<A;se++)H[M+se]={v:S[se],g:1};H.sort((se,ue)=>se.v-ue.v);let Y=0,Z=0,J=0;for(;J<$;){let se=J;for(;se<$&&H[se].v===H[J].v;)se++;const ue=se-J,ge=(J+1+se)/2;for(let Oe=J;Oe<se;Oe++)H[Oe].g===0&&(Y+=ge);Z+=ue*ue*ue-ue,J=se}const D=Y-M*(M+1)/2,te=M*A/2,z=M*A/12*($+1-Z/($*($-1)));let X=1;if(z>0){const se=Math.max(0,Math.abs(D-te)-.5);X=Math.min(1,2*s(-se/Math.sqrt(z)))}const ne=w(T,S,N);return{test:m.MANN_WHITNEY,statistic:D,statisticName:"U",df:null,pValue:X,interval:ne,effectSize:y(T,S),nA:M,nB:A,reliable:M>=b&&A>=b,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function P(T,S,O,M,A){const N=k(T,S,A),$=k(O,M,A);if(!N||!$)return null;const H=N.proportion-$.proportion,Y=H-Math.sqrt((N.proportion-N.lower)**2+($.upper-$.proportion)**2),Z=H+Math.sqrt((N.upper-N.proportion)**2+($.proportion-$.lower)**2);return{lower:Y,upper:Z}}function W(T,S,O,M,A,N={}){if(!(S>0)||!(M>0))return null;const $=new Set([...T.keys(),...O.keys()]),H=$.size;if(H<2)return null;const Y=S+M;let Z=0;for(const X of $){const ne=T.get(X)||0,se=O.get(X)||0,ue=ne+se,ge=S*ue/Y,Oe=M*ue/Y;ge>0&&(Z+=(ne-ge)*(ne-ge)/ge),Oe>0&&(Z+=(se-Oe)*(se-Oe)/Oe)}const J=H-1,D=n(Z,J);let te=null;N.category!==void 0&&$.has(N.category)?te=N.category:H===2&&([te]=[...$]);let z=null;if(te!==null){const X=P(T.get(te)||0,S,O.get(te)||0,M,c(A));X&&(z={estimate:(T.get(te)||0)/S-(O.get(te)||0)/M,lower:X.lower,upper:X.upper,confidence:c(A),method:"newcombe (difference in this category's share)",category:te})}return{test:m.CHI_SQUARE,statistic:Z,statisticName:"chiSquare",df:J,pValue:D,interval:z,effectSize:{name:"categoricalTotalVariation",value:q(T,S,O,M)},nA:S,nB:M,reliable:S>=b&&M>=b,method:"Pearson chi-square test of independence (2×k, no continuity correction)"}}function V(T){return T==null||T===""||typeof T=="number"&&Number.isNaN(T)?null:T instanceof Date?T.getTime():typeof T=="object"?String(T):T}function G(T,S,O){if(O===m.WELCH||O===m.MANN_WHITNEY)return{test:O,chosenBy:"override",reason:`caller override: ${O}`};const M=j(T),A=j(S),N=M===null?null:Math.exp(-M/2),$=A===null?null:Math.exp(-A/2);return N!==null&&N<l||$!==null&&$<l?{test:m.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${l})`}:{test:m.WELCH,chosenBy:"auto",reason:N!==null||$!==null?"column family: numeric, no departure from normality detected":"column family: numeric (too few rows to screen normality)"}}function _(T,S,O,M={}){if(!T||!S)return null;const A=c(M.confidence),N=I(S);let $;if(Array.isArray(M.groups)&&M.groups.length===2)$=[V(M.groups[0]),V(M.groups[1])];else{const{map:se}=x(S,O),ue=[...se.entries()].sort((ge,Oe)=>Oe[1]-ge[1]).slice(0,2).map(ge=>ge[0]);if(ue.length<2)return E("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;$=ue}const[H,Y]=$;if(H===null||Y===null||H===Y)return E("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const Z=[],J=[];for(let se=0;se<O.length;se++){const ue=V(N(O[se]));ue===H?Z.push(O[se]):ue===Y&&J.push(O[se])}if(Z.length===0||J.length===0)return E("compareGroups:empty","[lattice] compareGroups: one of the two groups has no rows in the current set."),null;const D=M.test&&M.test!=="auto"?String(M.test):null,te=R(T,Z.concat(J));let z,X,ne;if(D===m.CHI_SQUARE||!D&&!te){X=D?"override":"auto",ne=D?"caller override: chiSquare":"column family: categorical";const se=x(T,Z),ue=x(T,J);z=W(se.map,se.total,ue.map,ue.total,A,{category:M.category})}else{if((D===m.WELCH||D===m.MANN_WHITNEY)&&!te)return E("compareGroups:numeric-override",`[lattice] compareGroups: ${D} needs a numeric column, but the column is not numeric.`),null;const se=Q(T,Z),ue=Q(T,J),ge=G(se,ue,D);X=ge.chosenBy,ne=ge.reason,z=ge.test===m.MANN_WHITNEY?v(se,ue,A):h(se,ue,A)}return z?{...z,chosenBy:X,reason:ne,groups:[H,Y]}:(E("compareGroups:degenerate","[lattice] compareGroups: the chosen test had too little to work with (too few values, or no variation)."),null)}}),_e("packages/core/src/compute/significance.js",function(e,F){"use strict";Object.defineProperty(e,"COMPARE_TESTS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"compare",{enumerable:!0,get:function(){return Pe}});const E=F("packages/core/src/internal/warn.js").warnOnce,I=F("packages/core/src/compute/handle.js").valueReader,L=F("packages/core/src/compute/statistics.js"),Q=L.numbers,U=L.moments,x=L.frequencyMap,q=L.isNumericColumn,R=L.jarqueBera,j=L.proportionInterval,k=F("packages/core/src/compute/special.js"),b=k.studentT,u=k.studentTQuantile,g=k.normalCdf,o=k.normalQuantile,t=k.chiSquareUpperTail,i=k.incompleteBeta,s=Object.freeze({T:"t",WELCH:"welch",MANN_WHITNEY:"mannWhitney",ANOVA:"anova",KRUSKAL:"kruskal",CHI_SQUARE:"chiSquare",PROPORTIONS:"proportions"}),r=new Set([s.T,s.WELCH,s.MANN_WHITNEY]),n=new Set([s.ANOVA,s.KRUSKAL]),m=new Set([s.CHI_SQUARE,s.PROPORTIONS]),l=.05,a=[.2,.5,.8],c=[.147,.33,.474],f=[.01,.06,.14],p=[[.1,.3,.5],[.07,.21,.35],[.06,.17,.29],[.05,.15,.25]];function y(ye){const re=Number(ye);return Number.isFinite(re)&&re>0&&re<1?re:.05}function h(ye){return ye==null||ye===""||typeof ye=="number"&&Number.isNaN(ye)?null:ye instanceof Date?ye.getTime():typeof ye=="object"?String(ye):ye}function d(ye,re){const fe=I(ye),oe=[],ce=new Map;for(let de=0;de<re.length;de++){const ve=h(fe(re[de]));if(ve===null)continue;let ke=ce.get(ve);ke||(ke={value:ve,rows:[]},ce.set(ve,ke),oe.push(ke)),ke.rows.push(re[de])}return oe}function w(ye){const{n:re,mean:fe,m2:oe}=U(ye),ce=re>1?oe/(re-1):0;return{n:re,mean:fe,sd:Math.sqrt(ce),variance:ce}}function v(ye,re,fe){if(!(re>0)||!(fe>0)||!(ye>=0)||!Number.isFinite(ye))return Number.NaN;if(ye===0)return 1;const oe=re*ye/(re*ye+fe);return 1-i(re/2,fe/2,oe)}function P(ye,re){const fe=Math.abs(ye);return Number.isFinite(fe)?fe>=re[2]?"large":fe>=re[1]?"medium":fe>=re[0]?"small":"negligible":"negligible"}function W(ye,re,fe){if(ye==="cohensD")return P(re,a);if(ye==="cliffsDelta")return P(re,c);if(ye==="etaSquared")return P(re,f);const oe=Math.max(1,Math.min(p.length,Math.floor(fe||1)));return P(re,p[oe-1])}function V(ye,re){if(!(ye.n>1)||!(re.n>1))return null;const fe=((ye.n-1)*ye.variance+(re.n-1)*re.variance)/(ye.n+re.n-2);return fe>0?(ye.mean-re.mean)/Math.sqrt(fe):null}function G(ye,re){const fe=ye.length,oe=re.length;if(!fe||!oe)return null;const ce=Array.from(re).sort((ke,Ce)=>ke-Ce);let de=0,ve=0;for(let ke=0;ke<fe;ke++){const Ce=ye[ke];let Le=0,we=oe;for(;Le<we;){const Se=Le+we>>1;ce[Se]<Ce?Le=Se+1:we=Se}const He=Le;let Te=Le;for(;Te<oe&&ce[Te]===Ce;)Te++;const Ae=Te-Le;de+=He,ve+=oe-Te}return(de-ve)/(fe*oe)}function _(ye,re,fe,oe){const ce=Math.min(fe-1,oe-1);return!(re>0)||!(ce>0)?null:Math.sqrt(ye/(re*ce))}function T(ye){return Number.isFinite(ye)?ye<.001?"p < 0.001":ye>=.995?"p > 0.995":`p = ${ye.toFixed(3)}`:"p = —"}function S(ye){if(!Number.isFinite(ye))return"0";const re=Math.abs(ye);return re===0?"0":re>=1e3?String(Math.round(ye)):re>=100?String(Number(ye.toFixed(0))):re>=10?String(Number(ye.toFixed(1))):re>=1?String(Number(ye.toFixed(2))):String(Number(ye.toPrecision(2)))}const O=new Set(["cohensD","cliffsDelta"]);function M(ye){if(ye.difference!=null&&Math.abs(ye.difference)>=1e-12)return Math.sign(ye.difference);const re=ye.effectSize;if(re&&O.has(re.name)&&Number.isFinite(re.value)&&Math.abs(re.value)>=1e-12)return Math.sign(re.value);const[fe,oe]=ye.groups;return Number.isFinite(fe.mean)&&Number.isFinite(oe.mean)&&fe.mean!==oe.mean?Math.sign(fe.mean-oe.mean):0}function A(ye){const re=ye.measureName||"values";return{subject:re.charAt(0).toUpperCase()+re.slice(1),be:re==="values"?"are":"is",name:re}}function N(ye,re){const fe=re.unit?` ${re.unit}`:"",{subject:oe,be:ce}=A(re),de=ye.groups[0].label,ve=ye.groups[1].label,ke=ye.effectSize?ye.effectSize.label:"negligible",Ce=ye.pValue<ye.alpha,Le=Ce?"unlikely to be chance":"consistent with chance";if(!Ce&&ke==="negligible")return`${oe} ${ce} essentially the same for ${de} and ${ve} (${T(ye.pValue)}); the effect is ${ke}.`;const we=M(ye),He=`the difference is ${Le} (${T(ye.pValue)}) and the effect is ${ke}.`;if(we===0)return`${oe} ${ce} different between ${de} and ${ve}; ${He}`;const Te=we>0?de:ve,Ae=we>0?ve:de,Se=ye.difference!=null&&Math.abs(ye.difference)>=1e-12,Ee=Math.abs(ye.difference),Me=Se?typeof re.formatValue=="function"?` by about ${re.formatValue(Ee)}${fe}`:` by about ${S(Ee)}${fe}`:"";return`${oe} ${ce} higher for ${Te} than for ${Ae}${Me}; ${He}`}function $(ye,re){const{name:fe}=A(re),oe=ye.effectSize?ye.effectSize.label:"negligible",ce=T(ye.pValue);return ye.pValue<ye.alpha?`The groups differ in ${fe}; the difference is unlikely to be chance (${ce}) and the effect is ${oe}.`:oe==="negligible"?`The groups are essentially the same in ${fe} (${ce}); the effect is ${oe}.`:`The groups show a ${oe} effect in ${fe}, but the difference is consistent with chance (${ce}).`}function H(ye,re){const fe=ye.length;if(fe<2)return null;const{mean:oe,m2:ce}=U(ye),de=ce/(fe-1);if(!(de>0))return null;const ve=Math.sqrt(de),ke=ve/Math.sqrt(fe),Ce=oe/ke,Le=fe-1,we=Math.min(1,Math.max(0,2*(1-b(Math.abs(Ce),Le)))),He=u(1-re/2,Le)*ke,Te=oe/ve;return{test:s.T,statistic:Ce,statisticName:"t",df:Le,pValue:we,difference:oe,interval:{estimate:oe,lower:oe-He,upper:oe+He,confidence:1-re,method:"paired-t (mean of the pair differences)"},effectSize:{name:"cohensD",label:P(Te,a),value:Te}}}function Y(ye,re){const fe=Array.from(ye).filter(Ee=>Ee!==0),oe=fe.length;if(!oe)return null;const ce=Array.from({length:oe},(Ee,Me)=>Me).sort((Ee,Me)=>Math.abs(fe[Ee])-Math.abs(fe[Me])),de=new Array(oe);let ve=0;for(;ve<oe;){let Ee=ve;for(;Ee+1<oe&&Math.abs(fe[ce[Ee+1]])===Math.abs(fe[ce[ve]]);)Ee++;const Me=(ve+Ee)/2+1;for(let Be=ve;Be<=Ee;Be++)de[ce[Be]]=Me;ve=Ee+1}let ke=0,Ce=0;for(let Ee=0;Ee<oe;Ee++)Ce+=de[Ee],fe[Ee]>0&&(ke+=de[Ee]);const Le=Ce-ke,we=oe*(oe+1)/4,He=Math.sqrt(oe*(oe+1)*(2*oe+1)/24),Te=He>0?(Math.abs(ke-we)-.5)/He:0,Ae=Math.min(1,Math.max(0,2*g(-Math.max(0,Te)))),Se=Ce>0?(ke-Le)/Ce:0;return{test:s.MANN_WHITNEY,statistic:ke,statisticName:"W",df:null,pValue:Ae,difference:null,interval:null,effectSize:{name:"cliffsDelta",label:P(Se,c),value:Se}}}function Z(ye,re,fe){const oe=w(ye),ce=w(re);if(oe.n<2||ce.n<2)return null;const de=((oe.n-1)*oe.variance+(ce.n-1)*ce.variance)/(oe.n+ce.n-2);if(!(de>0))return null;const ve=Math.sqrt(de*(1/oe.n+1/ce.n)),ke=(oe.mean-ce.mean)/ve,Ce=oe.n+ce.n-2,Le=Math.min(1,Math.max(0,2*(1-b(Math.abs(ke),Ce)))),we=oe.mean-ce.mean,He=u(1-fe/2,Ce)*ve,Te=V(oe,ce);return{test:s.T,statistic:ke,statisticName:"t",df:Ce,pValue:Le,difference:we,interval:{estimate:we,lower:we-He,upper:we+He,confidence:1-fe,method:"student-t (pooled variance, difference of means)"},effectSize:{name:"cohensD",label:P(Te,a),value:Te},summaries:[oe,ce]}}function J(ye,re,fe){const oe=w(ye),ce=w(re);if(oe.n<2||ce.n<2)return null;const de=oe.variance/oe.n+ce.variance/ce.n;if(!(de>0))return null;const ve=Math.sqrt(de),ke=(oe.mean-ce.mean)/ve,Ce=oe.variance/oe.n*(oe.variance/oe.n)/(oe.n-1),Le=ce.variance/ce.n*(ce.variance/ce.n)/(ce.n-1),we=de*de/(Ce+Le),He=Math.min(1,Math.max(0,2*(1-b(Math.abs(ke),we)))),Te=oe.mean-ce.mean,Ae=u(1-fe/2,we)*ve,Se=V(oe,ce);return{test:s.WELCH,statistic:ke,statisticName:"t",df:we,pValue:He,difference:Te,interval:{estimate:Te,lower:Te-Ae,upper:Te+Ae,confidence:1-fe,method:"welch-t (unequal variances, difference of means)"},effectSize:{name:"cohensD",label:P(Se,a),value:Se},summaries:[oe,ce]}}function D(ye,re,fe){const oe=ye.length,ce=re.length;if(oe<1||ce<1)return null;const de=w(ye),ve=w(re),ke=oe+ce,Ce=new Array(ke);for(let Be=0;Be<oe;Be++)Ce[Be]={v:ye[Be],g:0};for(let Be=0;Be<ce;Be++)Ce[oe+Be]={v:re[Be],g:1};Ce.sort((Be,Ke)=>Be.v-Ke.v);let Le=0,we=0,He=0;for(;He<ke;){let Be=He;for(;Be<ke&&Ce[Be].v===Ce[He].v;)Be++;const Ke=(He+1+Be)/2;for(let Je=He;Je<Be;Je++)Ce[Je].g===0&&(Le+=Ke);const et=Be-He;we+=et*et*et-et,He=Be}const Te=Le-oe*(oe+1)/2,Ae=oe*ce/2,Se=oe*ce/12*(ke+1-we/(ke*(ke-1)));let Ee=1;if(Se>0){const Be=Math.max(0,Math.abs(Te-Ae)-.5);Ee=Math.min(1,2*g(-Be/Math.sqrt(Se)))}const Me=G(ye,re);return{test:s.MANN_WHITNEY,statistic:Te,statisticName:"U",df:null,pValue:Ee,difference:null,interval:te(ye,re,1-fe),effectSize:{name:"cliffsDelta",label:P(Me,c),value:Me},summaries:[de,ve]}}function te(ye,re,fe){const oe=ye.length,ce=re.length,de=oe*ce;if(de===0||de>2e6)return null;const ve=new Float64Array(de);let ke=0;for(let Se=0;Se<oe;Se++)for(let Ee=0;Ee<ce;Ee++)ve[ke++]=ye[Se]-re[Ee];ve.sort();const Ce=de>>1,Le=de%2?ve[Ce]:(ve[Ce-1]+ve[Ce])/2,we=Math.sqrt(oe*ce*(oe+ce+1)/12),He=o(1-(1-fe)/2);let Te=Math.round(de/2-He*we);Te>=0||(Te=0);const Ae=Math.floor((de-1)/2);return Te>Ae&&(Te=Ae),{estimate:Le,lower:ve[Te],upper:ve[de-1-Te],confidence:fe,method:"hodges-lehmann (location shift)"}}function z(ye,re){const fe=ye.length,oe=ye.map(w);if(oe.some(Ee=>Ee.n<2))return null;const ce=oe.reduce((Ee,Me)=>Ee+Me.n,0),de=oe.reduce((Ee,Me)=>Ee+Me.mean*Me.n,0)/ce;let ve=0,ke=0;for(let Ee=0;Ee<fe;Ee++)ve+=oe[Ee].n*(oe[Ee].mean-de)**2,ke+=(oe[Ee].n-1)*oe[Ee].variance;const Ce=fe-1,Le=ce-fe;if(!(ke>0)||Le<1)return null;const we=ve/Ce,He=ke/Le,Te=we/He,Ae=Math.min(1,Math.max(0,v(Te,Ce,Le))),Se=ve/(ve+ke);return{test:s.ANOVA,statistic:Te,statisticName:"F",df:{between:Ce,within:Le},pValue:Ae,difference:null,interval:null,effectSize:{name:"etaSquared",label:P(Se,f),value:Se},summaries:oe}}function X(ye,re){const fe=ye.length,oe=ye.map(w);if(fe<2)return null;const ce=oe.reduce((Me,Be)=>Me+Be.n,0),de=[];for(let Me=0;Me<fe;Me++)for(let Be=0;Be<ye[Me].length;Be++)de.push({v:ye[Me][Be],g:Me});de.sort((Me,Be)=>Me.v-Be.v);const ve=new Array(de.length);let ke=0,Ce=0;for(;Ce<de.length;){let Me=Ce;for(;Me<de.length&&de[Me].v===de[Ce].v;)Me++;const Be=(Ce+1+Me)/2;for(let et=Ce;et<Me;et++)ve[et]=Be;const Ke=Me-Ce;ke+=Ke*Ke*Ke-Ke,Ce=Me}const Le=new Array(fe).fill(0);for(let Me=0;Me<de.length;Me++)Le[de[Me].g]+=ve[Me];let we=0;for(let Me=0;Me<fe;Me++)we+=Le[Me]*Le[Me]/oe[Me].n;we=12/(ce*(ce+1))*we-3*(ce+1);const He=1-ke/(ce*ce*ce-ce),Te=He>0?we/He:we,Ae=fe-1,Se=Math.min(1,Math.max(0,t(Te,Ae))),Ee=(Te-fe+1)/(ce-fe);return{test:s.KRUSKAL,statistic:Te,statisticName:"H",df:Ae,pValue:Se,difference:null,interval:null,effectSize:{name:"etaSquared",label:P(Ee,f),value:Math.max(0,Ee)},summaries:oe}}function ne(ye,re,fe,oe,ce){const de=j(ye,re,ce),ve=j(fe,oe,ce);if(!de||!ve)return null;const ke=de.proportion-ve.proportion,Ce=ke-Math.sqrt((de.proportion-de.lower)**2+(ve.upper-ve.proportion)**2),Le=ke+Math.sqrt((de.upper-de.proportion)**2+(ve.proportion-ve.lower)**2);return{estimate:ke,lower:Ce,upper:Le}}function se(ye,re,fe,oe){const ce=I(re),de=new Set,ve=[];for(const Be of ye){const Ke=new Map;let et=0;for(const Je of Be.rows){const ut=h(ce(Je));ut!==null&&(Ke.set(ut,(Ke.get(ut)||0)+1),et++,de.add(ut))}ve.push(Ke),Be.total=et}const ke=[...de];if(ke.length<2)return null;const Ce=ye.reduce((Be,Ke)=>Be+Ke.total,0);if(!(Ce>0))return null;let Le=0;for(const Be of ye)for(const Ke of ke){const et=ve[ye.indexOf(Be)].get(Ke)||0,Je=ye.reduce((Ct,Nt)=>Ct+(ve[ye.indexOf(Nt)].get(Ke)||0),0),ut=Be.total*Je/Ce;ut>0&&(Le+=(et-ut)*(et-ut)/ut)}const we=ye.length,He=ke.length,Te=(we-1)*(He-1),Ae=Math.min(1,Math.max(0,t(Le,Te))),Se=_(Le,Ce,we,He);let Ee=null;if(we===2&&He===2){const[Be]=ke,Ke=ve[0].get(Be)||0,et=ve[1].get(Be)||0,Je=ne(Ke,ye[0].total,et,ye[1].total,oe);Je&&(Ee={...Je,confidence:oe,method:"newcombe (difference in this category's share)",category:Be})}const Me=ye.map((Be,Ke)=>{const et={};for(const Je of ke)et[String(Je)]=(ve[Ke].get(Je)||0)/Be.total;return et});return{test:s.CHI_SQUARE,statistic:Le,statisticName:"chiSquare",df:Te,pValue:Ae,difference:null,interval:Ee,effectSize:{name:"cramersV",label:W("cramersV",Se,Math.min(we-1,He-1)),value:Se},proportions:Me}}function ue(ye,re,fe,oe){const ce=I(re),de=new Set;for(const Je of ye)for(const ut of Je.rows){const Ct=h(ce(ut));Ct!==null&&de.add(Ct)}if(de.size!==2)return null;const[ve]=[...de],ke=ye[0].rows.reduce((Je,ut)=>Je+(h(ce(ut))===ve?1:0),0),Ce=ye[1].rows.reduce((Je,ut)=>Je+(h(ce(ut))===ve?1:0),0),Le=ye[0].rows.length,we=ye[1].rows.length;if(!(Le>0)||!(we>0))return null;const He=ke/Le,Te=Ce/we,Ae=(ke+Ce)/(Le+we);if(!(Ae>0)||!(Ae<1))return null;const Se=Math.sqrt(Ae*(1-Ae)*(1/Le+1/we)),Ee=(He-Te)/Se,Me=Math.min(1,Math.max(0,2*g(-Math.abs(Ee)))),Be=He-Te,Ke=ne(ke,Le,Ce,we,oe),et=_(Ee*Ee,Le+we,2,2);return{test:s.PROPORTIONS,statistic:Ee,statisticName:"z",df:null,pValue:Me,difference:Be,interval:Ke?{...Ke,confidence:oe,method:"newcombe (difference in proportions)",category:ve}:null,effectSize:{name:"cramersV",label:W("cramersV",et,1),value:et},proportions:[{[String(ve)]:He},{[String(ve)]:Te}],focalCategory:ve}}function ge(ye,re,fe,oe){if(fe&&r.has(fe))return{test:fe,reason:`caller override: ${fe}`};const ce=R(ye),de=R(re),ve=ce===null?null:Math.exp(-ce/2),ke=de===null?null:Math.exp(-de/2);if(ve!==null&&ve<l||ke!==null&&ke<l)return{test:s.MANN_WHITNEY,reason:"two numeric groups, non-normal by Jarque-Bera"};const Ce=w(ye),Le=w(re);if(Ce.n>=3&&Le.n>=3&&Ce.variance>0&&Le.variance>0){const we=Math.max(Ce.variance,Le.variance)/Math.min(Ce.variance,Le.variance),He=Ce.variance>=Le.variance?Ce.n-1:Le.n-1,Te=Ce.variance>=Le.variance?Le.n-1:Ce.n-1;if(2*Math.min(v(we,He,Te),1-v(we,He,Te))<oe)return{test:s.WELCH,reason:"two numeric groups, unequal variances (F-test)"}}return{test:s.T,reason:ve!==null||ke!==null?"two numeric groups, equal variances and no departure from normality":"two numeric groups (too few rows to screen normality)"}}function Oe(ye,re){if(re&&n.has(re))return{test:re,reason:`caller override: ${re}`};for(const fe of ye){const oe=R(fe),ce=oe===null?null:Math.exp(-oe/2);if(ce!==null&&ce<l)return{test:s.KRUSKAL,reason:"three or more numeric groups, non-normal by Jarque-Bera"}}return{test:s.ANOVA,reason:"three or more numeric groups, no departure from normality detected"}}function Pe(ye,re,fe,oe={},ce=null){if(!ye||!re)return null;const de=y(oe.alpha),ve=1-de,ke=oe.test&&oe.test!=="auto"?String(oe.test):null,Ce=d(re,fe);if(Ce.length<2)return E("compare:groups",'[lattice] statistics.compare: the "by" column has fewer than two distinct values to group by.'),null;let Le;if(Array.isArray(oe.groups)&&oe.groups.length===2){const Ke=[h(oe.groups[0]),h(oe.groups[1])];if(Ke[0]===null||Ke[1]===null||Ke[0]===Ke[1])return E("compare:distinct","[lattice] statistics.compare: the two groups must be two distinct, present values."),null;if(Le=Ce.filter(et=>et.value===Ke[0]||et.value===Ke[1]),Le.length!==2)return E("compare:empty","[lattice] statistics.compare: one of the two groups has no rows in the current set."),null;Le.sort((et,Je)=>et.value===Ke[0]?-1:1)}else Ce.length===2||ke&&r.has(ke)||ke&&m.has(ke)?Le=Ce.slice(0,2):(ke&&n.has(ke),Le=Ce);const He=q(ye,fe),Te=!!oe.paired&&ce&&Le.length===2&&He;let Ae,Se,Ee;if(He)if(Le.length===2&&!(ke&&n.has(ke))){const Ke=Q(ye,Le[0].rows),et=Q(ye,Le[1].rows);if(Ke.length<3||et.length<3)return E("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;if(w(Ke).variance===0||w(et).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(Te){const ut=xe(ye,ce,Le[0].rows,Le[1].rows);return ut?(Se=ke?"override":"auto",Ee=ke?`caller override: ${ke} (paired)`:"two numeric groups, paired",Ae=ke===s.MANN_WHITNEY?Y(ut.diffs,de):H(ut.diffs,de),Ae?(Ae.paired=!0,Ae.chosenBy=Se,Ae.reason=Ee,Ae.groups=[{value:Le[0].value,label:String(Le[0].value),n:ut.n},{value:Le[1].value,label:String(Le[1].value),n:ut.n}],Ae.alpha=de,Ae.method=Ae.test===s.MANN_WHITNEY?"Wilcoxon signed-rank test (paired)":"Student's paired t-test (difference of pairs)",Ae.verdict=N(Ae,oe),Ae.categorical=!1,Ae):(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 Je=ge(Ke,et,ke,de);Se=ke?"override":"auto",Ee=Je.reason,Je.test===s.MANN_WHITNEY?Ae=D(Ke,et,de):Je.test===s.WELCH?Ae=J(Ke,et,de):Ae=Z(Ke,et,de),Ae&&Ae.interval&&Ae.difference===null&&(Ae.difference=Ae.interval.estimate)}else{const Ke=Le.map(Je=>Q(ye,Je.rows));if(Ke.some(Je=>Je.length<3))return E("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;const et=Oe(Ke,ke);Se=ke?"override":"auto",Ee=et.reason,Ae=et.test===s.KRUSKAL?X(Ke,de):z(Ke,de)}else if(Le.length===2){const Ke=Ie(ye,Le).size===2;if(ke===s.PROPORTIONS||Ke&&!ke)Se=ke?"override":"auto",Ee=ke?"caller override: proportions":"categorical measure with two categories (binary)",Ae=ue(Le,ye,de,ve);else if(ke===s.CHI_SQUARE||!Ke&&!ke)Se=ke?"override":"auto",Ee=ke?"caller override: chiSquare":`categorical measure with ${Ie(ye,Le).size} categories`,Ae=se(Le,ye,de,ve);else return E("compare:numeric-needed",`[lattice] statistics.compare: ${ke} needs a numeric measure, but the column is categorical.`),null}else Se=ke?"override":"auto",Ee=ke?`caller override: ${ke}`:`categorical measure with ${Ie(ye,Le).size} categories`,Ae=se(Le,ye,de,ve);if(!Ae)return E("compare:degenerate","[lattice] statistics.compare: the chosen test had too little to work with (too few values, or no variation)."),null;const Me=Ae.summaries,Be=Ae.proportions;return{test:Ae.test,chosenBy:Se,reason:Ee,statistic:Ae.statistic,statisticName:Ae.statisticName,df:Ae.df===void 0?null:Ae.df,pValue:Ae.pValue,alpha:de,paired:!1,interval:Ae.interval||null,effectSize:Ae.effectSize,groups:Le.map((Ke,et)=>({value:Ke.value,label:String(Ke.value),n:Me?Me[et].n:Ke.total,...Me?{mean:Me[et].mean,sd:Me[et].sd}:{},...Be?{proportions:Be[et]}:{}})),difference:Ae.difference===void 0?null:Ae.difference,method:Ae.test,categorical:!He,verdict:Le.length===2?N({...Ae,alpha:de,groups:[{value:Le[0].value,label:String(Le[0].value),mean:Me?Me[0].mean:void 0},{value:Le[1].value,label:String(Le[1].value),mean:Me?Me[1].mean:void 0}],categorical:!He,difference:Ae.difference===void 0?null:Ae.difference},oe):$({...Ae,alpha:de},oe)}}function Ie(ye,re){const fe=I(ye),oe=new Set;for(const ce of re)for(const de of ce.rows){const ve=h(fe(de));ve!==null&&oe.add(ve)}return oe}function xe(ye,re,fe,oe){const ce=I(re),de=I(ye),ve=new Map;for(const Ce of oe){const Le=h(ce(Ce));Le!==null&&ve.set(Le,de(Ce))}const ke=[];for(const Ce of fe){const Le=h(ce(Ce));if(Le===null||!ve.has(Le))continue;const we=Number(de(Ce)),He=Number(ve.get(Le));!Number.isFinite(we)||!Number.isFinite(He)||ke.push(we-He)}return ke.length<2?null:{diffs:Float64Array.from(ke),n:ke.length}}}),_e("packages/core/src/columns/detailcolumn.js",function(e,F){"use strict";Object.defineProperty(e,"DETAIL_COLUMN_ID",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"createDetailColumn",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return I}});const ie="__lattice_detail",E=36;function K(L){const Q=L.config&&L.config.detailColumnWidth||E;return{id:ie,field:null,title:"",type:"text",dataType:{base:"text"},nullable:!0,align:"center",generated:!0,control:!0,detailExpander:!0,value:{pure:!0},cell:{render:"detailExpander",align:"center"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:Q,min:Q,max:Q,pin:L.config&&L.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(U,x){return!!(x&&x.expanded)},formatValue(){return""}}}const I=K}),_e("packages/core/src/columns/treecolumn.js",function(e,F){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createTreeColumn",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Q}});const E=F("packages/core/src/internal/predicates.js").isFunction,K="__lattice_tree",I=260;function L(U){const x=U.tree||{},q=U.config&&U.config.treeColumnWidth||I,R=!!(U.config&&U.config.treeColumnFlex),j=()=>(U.columns&&E(U.columns.visible)?U.columns.visible():[]).find(g=>!g.generated)||null,k=(u,g)=>{if(g&&g.group)return g.groupValue;if(E(x.label))return x.label(u,g);if(typeof x.label=="string")return u==null?null:u[x.label];const o=j();return o&&E(o.getValue)?o.getValue(u,g):null},b=()=>{if(x.title)return x.title;const u=typeof x.label=="string"?U.columns&&E(U.columns.get)?U.columns.get(x.label):null:j();return u&&(u.title||u.id)||"Hierarchy"};return{id:K,get title(){return b()},field:null,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group",props:{icon:x.icon,iconClass:x.iconClass,content:x.content,checkbox:x.checkbox,onCheck:x.onCheck}},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:R?{flex:1,min:0,pin:U.config&&U.config.treeColumnPin||null,hidden:!1,resizable:!1,movable:!1,lockPosition:!0}:{width:q,min:140,pin:U.config&&U.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(u,g){return k(u,g)},formatValue(u,g){if(g&&g.grandTotal)return U.config&&U.config.grandTotalLabel||"Total";if(u==null)return"";if(!x.label){const o=j();if(o&&E(o.formatValue))return o.formatValue(u,g)}return String(u)}}}const Q=L}),_e("packages/core/src/columns/pivotcolumns.js",function(e,F){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return L}});const E=F("packages/core/src/internal/warn.js").warnOnce,K="__lattice_pivot",I=500;function L(q){const{pivot:R,valueColumns:j,config:k}=q,b=R&&R.paths||[],u=q.separator||k&&k.pivot&&k.pivot.separator||" | ",g=k&&k.pivot&&k.pivot.maxColumns||I;if(!b.length||!j.length)return{tree:[],leaves:[],error:null};const o=Q(k),t=b.length*j.length+(o?j.length:0);if(t>g){const r=`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}`,r),{tree:[],leaves:[],error:r}}const i=[],s=[];for(const r of b){const n=[];for(const m of j){const l=x(r,m,u);n.push(l),s.push(l)}n.length===1?(n[0].title=String(r),i.push(n[0])):i.push({id:`${K}:group:${r}`,title:String(r),columns:n,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(o){const r=j.map(m=>U(m,k));s.push(...r);const n=k&&k.pivot&&k.pivot.totalsLabel||"Total";if(r.length===1)r[0].title=n,o==="before"?i.unshift(r[0]):i.push(r[0]);else{const m={id:`${K}:group:__totals`,title:n,columns:r,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};o==="before"?i.unshift(m):i.push(m)}}return{tree:i,leaves:s,error:null}}function Q(q){const R=q&&q.pivot&&q.pivot.groupTotals;return R==="before"||R==="after"?R:null}function U(q,R){return{id:`${K}:__total${R&&R.pivot&&R.pivot.separator||" | "}${q.id}`,field:null,title:q.title||q.id,type:q.type,dataType:q.dataType,nullable:!0,align:q.align,generated:!0,pivot:{enabled:!1,index:0,sourceId:q.id,total:!0},value:{pure:!0},cell:{align:q.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:q.total,lookup:null,layout:{width:q.layout&&q.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 b=k&&k.totals;return b&&Object.hasOwn(b,q.id)?b[q.id]:null},formatValue(j,k){return j==null?"":q.formatValue?q.formatValue(j,k):String(j)}}}function x(q,R,j){return{id:`${K}:${q}${j}${R.id}`,field:null,title:R.title||R.id,type:R.type,dataType:R.dataType,nullable:!0,align:R.align,generated:!0,pivot:{enabled:!1,index:0,path:q,sourceId:R.id},value:{pure:!0},cell:{align:R.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:R.total,lookup:null,layout:{width:R.layout&&R.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(){return null},formatValue(k,b){return k==null?"":R.formatValue?R.formatValue(k,b):String(k)}}}}),_e("packages/core/src/compute/group.js",function(e,F){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return k}});const ie=F("packages/core/src/compute/handle.js"),E=ie.dictSize,K=ie.identity,I=ie.presenceReader,L=ie.rowCount,Q=ie.valueReader,U="",x="\0",q=1<<20;function R(b,u,g,o){const t=b.length,i=b.map(a=>Q(a)),s=Array.isArray(o)&&o.some(Boolean),r=s?i.map((a,c)=>o[c]?f=>o[c](a(f)):a):i;if(!s&&t>0&&b.every(a=>a&&a.kind==="dictionary"&&a.dict)){const a=b.map(f=>E(f.dict)+1);let c=1;for(let f=0;f<t;f++)c*=a[f];if(c<=Number.MAX_SAFE_INTEGER){const f=b.map(d=>d.values),p=b.map(d=>I(d)),y=d=>{let w=0;for(let v=0;v<t;v++){const P=p[v],W=P&&P(d)===0?a[v]-1:f[v][d];w=w*a[v]+W}return w},h=new Float64Array(g);for(let d=0;d<g;d++)h[d]=y(u[d]);return{packed:h,strings:null,product:c,readers:r,keyOf:y}}}const m=a=>{let c="";for(let f=0;f<t;f++){const p=r[f](a);c+=(f===0?"":U)+(p==null?x:String(p))}return c},l=new Array(g);for(let a=0;a<g;a++)l[a]=m(u[a]);return{packed:null,strings:l,product:1/0,readers:r,keyOf:m}}function j(b,u,g,o){const t=new Uint32Array(o+1);for(let n=0;n<g;n++)t[u[n]+1]++;for(let n=0;n<o;n++)t[n+1]+=t[n];const i=new Uint32Array(g),s=t.slice(0,o);for(let n=0;n<g;n++)i[s[u[n]]++]=b[n];const r=new Array(o);for(let n=0;n<o;n++)r[n]=i.subarray(t[n],t[n+1]);return r}function k(b,u,g={}){const o=b||[],t=u||K(L(o[0],g)),i=t.length;if(o.length===0||i===0)return{keys:[],buckets:[]};const{packed:s,strings:r,product:n,readers:m}=R(o,t,i,g.project),l=new Uint32Array(i);let a=0,c=null;if(s&&n<=Math.max(1024,Math.min(q,i*4))){const h=n,d=new Int32Array(h).fill(-1);for(let w=0;w<i;w++)d[s[w]]=0;for(let w=0;w<h;w++)d[w]===0&&(d[w]=a++);for(let w=0;w<i;w++)l[w]=d[s[w]];c=new Float64Array(a);for(let w=0;w<h;w++)d[w]>=0&&(c[d[w]]=w)}else if(s){const h=new Map;for(let d=0;d<i;d++){const w=s[d];let v=h.get(w);v===void 0&&(v=a++,h.set(w,v)),l[d]=v}c=new Float64Array(a);for(const[d,w]of h)c[w]=d}else{const h=new Map;for(let d=0;d<i;d++){const w=r[d];let v=h.get(w);v===void 0&&(v=a++,h.set(w,v)),l[d]=v}}const f=j(t,l,i,a),p=new Array(a);for(let h=0;h<a;h++){const d=f[h][0],w=new Array(m.length);for(let v=0;v<m.length;v++)w[v]=m[v](d);p[h]=w}const y={keys:p,buckets:f};return c&&(y.packed=c),y}}),_e("packages/core/src/compute/pivot.js",function(e,F){"use strict";Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return R}}),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 b}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return i}});const E=F("packages/core/src/internal/warn.js").warnOnce,I=F("packages/core/src/compute/handle.js").valueComparator,Q=F("packages/core/src/compute/group.js").packKeys,x=F("packages/core/src/compute/total.js").total,q="|",R="/",j=2e3;function k(n,m,l){return`${n}${q}${m}${q}${l}`}function b(n,m){let l="";for(let a=0;a<n.length;a++){const c=n[a];l+=(a===0?"":m)+(c==null?"":String(c))}return l}function u(n,m,l={}){const a=l.separator||R,c=m.length,{keyOf:f,readers:p}=Q(n,m,0),y=new Map,h=[],d=[];for(let _=0;_<c;_++){const T=m[_],S=f(T);if(y.has(S))continue;y.set(S,h.length),d.push(S);const O=new Array(p.length);for(let M=0;M<p.length;M++)O[M]=p[M](T);h.push(O)}const w=I(l.locale),v=h.map((_,T)=>T);v.sort((_,T)=>{const S=h[_],O=h[T];for(let M=0;M<S.length;M++){const A=g(S[M],O[M],w);if(A!==0)return A}return _-T});const P=new Array(v.length),W=new Array(v.length),V=new Map;for(let _=0;_<v.length;_++){const T=v[_];P[_]=h[T],W[_]=b(h[T],a),V.set(d[T],_)}return{keys:P,paths:W,idOf:_=>{const T=V.get(f(_));return T===void 0?-1:T}}}function g(n,m,l){const a=n==null,c=m==null;return a||c?a&&c?0:a?1:-1:l(n,m)}function o(n){const m=n.values||n.totals||[];if(m.length&&typeof m[0]=="object"&&m[0]!==null)return m.filter(f=>f&&f.handle);const l=typeof n.handle=="function"?n.handle:null;if(!l)return m.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 a=typeof n.totalOf=="function"?n.totalOf:null,c=[];for(const f of m){const p=l(f);p&&c.push({colId:f,handle:p,fn:a?a(f):"sum"})}return c}function t(n,m,l){if(Array.isArray(n)){const a=l||{};return{...a,pivotHandles:n,order:m||null,groups:a.groups||null}}return n||{}}function i(n,m,l){const a=t(n,m,l),c=a.separator||R,f=o(a),p=a.maxColumns===void 0?j:a.maxColumns,y=a.groups&&a.groups.buckets?a.groups:null,h=y?y.buckets:[a.order||new Uint32Array(0)],d=a.groupPaths||(y?y.keys.map(S=>b(S,c)):[""]),w=r(h),{keys:v,paths:P,idOf:W}=u(a.pivotHandles||[],w,a),V=P.length*Math.max(1,f.length),G=s(P,f,c);if(p&&V>p){const S=new Map;return{keys:v,paths:P,fields:G,groupPaths:d,columns:V,values:S,cells:S,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${V} columns, above pivot.maxColumns of ${p}. Narrow the pivot columns or raise the limit.`,columns:V,maxColumns:p}}}const _=new Map,T=P.length;for(let S=0;S<h.length;S++){const O=h[S],M=d[S]===void 0?"":d[S],A=O.length;if(A===0)continue;const N=new Int32Array(A),$=new Uint32Array(T+1);for(let Z=0;Z<A;Z++){const J=W(O[Z]);N[Z]=J,J>=0&&$[J+1]++}for(let Z=0;Z<T;Z++)$[Z+1]+=$[Z];const H=new Uint32Array(A),Y=$.slice(0,T);for(let Z=0;Z<A;Z++){const J=N[Z];J>=0&&(H[Y[J]++]=O[Z])}for(let Z=0;Z<T;Z++){const J=$[Z],D=$[Z+1];if(D===J)continue;const te=H.subarray(J,D);for(let z=0;z<f.length;z++){const X=f[z],ne=x(X.handle,te,X.fn,a.totalContext||{locale:a.locale});_.set(k(M,P[Z],X.colId),ne)}}}return{keys:v,paths:P,fields:G,groupPaths:d,columns:V,values:_,cells:_,error:null}}function s(n,m,l){if(m.length===0)return n.slice();const a=[];for(const c of n)for(const f of m)a.push(`${c}${l}${f.colId}`);return a}function r(n){if(n.length===1)return n[0]||new Uint32Array(0);let m=0;for(const c of n)m+=c?c.length:0;const l=new Uint32Array(m);let a=0;for(const c of n)!c||c.length===0||(l.set(c,a),a+=c.length);return l}}),_e("packages/core/src/compute/explain.js",function(e,F){"use strict";Object.defineProperty(e,"explainContributors",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"explainChange",{enumerable:!0,get:function(){return k}});const E=F("packages/core/src/compute/total.js").total,I=F("packages/core/src/compute/group.js").groupByColumns,L=new Set(["sum","count","countValues"]),Q=new Set(["min","max"]),U=new Set(["avg"]);function x(b){return typeof b=="string"?b:typeof b=="function"&&b.totalName?b.totalName:null}function q(b,u,g,o){return E(b,u,g,o||{})}function R(b,u){if(u)try{return u(b)}catch{}return b==null?"":String(b)}function j(b){const{handle:u,fn:g,leaves:o,by:t,labelOf:i,rowLabel:s}=b,r={locale:b.locale},n=o&&o.length?o:[],m=x(g),l=q(u,n,g,r),a=Q.has(m);let c;if(a){let y=-1;for(let h=0;h<n.length;h++){const d=q(u,[n[h]],g,r);if(Object.is(d,l)){y=n[h];break}}c=y<0?[]:[{key:y,indices:[y],label:s?s(y):String(y)}]}else if(t){const y=I([t],n);c=y.keys.map((h,d)=>({key:h[0],indices:y.buckets[d],label:R(h[0],i)}))}else c=Array.from({length:n.length},(y,h)=>{const d=n[h];return{key:d,indices:[d],label:s?s(d):String(d)}});const f=n.length,p=[];for(const y of c){const h=q(u,y.indices,g,r),d=y.indices.length;let w,v;if(m==="avg")w=((typeof h=="number"?h:0)-(typeof l=="number"?l:0))*d,v=f?d/f:0;else if(a)w=typeof h=="number"?h:0,v=1;else{w=typeof h=="number"?h:0;const P=typeof l=="number"?l:0;v=P?w/P:0}p.push({key:y.key,label:y.label,count:d,value:h,contribution:w,share:v})}return p.sort((y,h)=>Math.abs(h.contribution)-Math.abs(y.contribution)||(y.label<h.label?-1:y.label>h.label?1:0)),{total:l,fn:m,weighted:U.has(m),single:a,contributors:p}}function k(b){const u=j({...b,leaves:b.after}),g=j({...b,leaves:b.before}),o=typeof u.total=="number"?u.total:0,t=typeof g.total=="number"?g.total:0,i=new Map;for(const n of u.contributors)i.set(n.key,n);const s=[],r=new Set;for(const n of g.contributors){r.add(n.key);const m=i.get(n.key);if(m===void 0)s.push({key:n.key,label:n.label,before:n.value,after:null,effect:-n.contribution,kind:"dropped",count:n.count});else{const l=m.contribution-n.contribution;l!==0&&s.push({key:n.key,label:n.label,before:n.value,after:m.value,effect:l,kind:"changed",count:m.count})}}for(const n of u.contributors)r.has(n.key)||s.push({key:n.key,label:n.label,before:null,after:n.value,effect:n.contribution,kind:"new",count:n.count});return s.sort((n,m)=>Math.abs(m.effect)-Math.abs(n.effect)||(n.label<m.label?-1:n.label>m.label?1:0)),{before:g.total,after:u.total,delta:o-t,weighted:u.weighted||g.weighted,single:u.single||g.single,drivers:s}}}),_e("packages/core/src/store/bitset.js",function(e,F){"use strict";Object.defineProperty(e,"Bitset",{enumerable:!0,get:function(){return E}});const ie=8;class E{static#e=new Uint8Array(256);static{for(let I=1;I<256;I++)E.#e[I]=E.#e[I>>1]+(I&1)}#t;#n;constructor(I=0){const L=Math.max(0,I|0);this.#n=L,this.#t=new Uint8Array(Math.ceil(L/ie))}get size(){return this.#n}get words(){return this.#t}get bytes(){return this.#t?this.#t.byteLength:0}get(I){return I<0||I>=this.#n?0:this.#t[I>>3]>>(I&7)&1}set(I){return I>=0&&I<this.#n&&(this.#t[I>>3]|=1<<(I&7)),this}clear(I){return I>=0&&I<this.#n&&(this.#t[I>>3]&=~(1<<(I&7))),this}assign(I,L){return L?this.set(I):this.clear(I)}fill(I=!1){return this.#t.fill(I?255:0),I&&this.#r(),this}grow(I){const L=Math.max(0,I|0);if(L<=this.#n)return this;const Q=Math.ceil(L/ie);if(Q>this.#t.length){const U=new Uint8Array(Q);U.set(this.#t),this.#t=U}return this.#n=L,this}count(){const I=this.#t,L=E.#e;let Q=0;for(let U=0;U<I.length;U++)Q+=L[I[U]];return Q}and(I){const L=I instanceof E?I.words:I,Q=this.#t,U=Math.min(Q.length,L.length);for(let x=0;x<U;x++)Q[x]&=L[x];for(let x=U;x<Q.length;x++)Q[x]=0;return this}or(I){const L=I instanceof E?I.words:I,Q=this.#t,U=Math.min(Q.length,L.length);for(let x=0;x<U;x++)Q[x]|=L[x];return this}not(){const I=this.#t;for(let L=0;L<I.length;L++)I[L]=~I[L]&255;return this.#r(),this}clone(){const I=new E(this.#n);return I.words.set(this.#t.subarray(0,I.words.length)),I}release(){this.#t=new Uint8Array(0),this.#n=0}#r(){const I=this.#n&7;if(I===0)return;const L=this.#n>>3;L<this.#t.length&&(this.#t[L]&=(1<<I)-1)}static from(I){const L=Array.isArray(I)?I:Array.from(I),Q=new E(L.length);for(let U=0;U<L.length;U++)L[U]&&Q.set(U);return Q}}}),_e("packages/core/src/store/dictionary.js",function(e,F){"use strict";Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return I}});const ie=F("packages/core/src/internal/compare.js"),E=ie.collator,K=ie.defaultCompare;class I{#e;#t=new Map;#n=0;#r=null;#i=-1;#s="\0";constructor(Q=[]){this.#e=[];for(let U=0;U<Q.length;U++){const x=Q[U];this.#t.has(x)||(this.#t.set(x,this.#e.length),this.#e.push(x))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let Q=this.#e.length*8;for(let U=0;U<this.#e.length;U++){const x=this.#e[U];typeof x=="string"&&(Q+=x.length*2),Q+=16}return Q}codeOf(Q){const U=this.#t.get(Q);if(U!==void 0)return U;const x=this.#e.length;return this.#e.push(Q),this.#t.set(Q,x),this.#n++,x}lookup(Q){const U=this.#t.get(Q);return U===void 0?-1:U}has(Q){return this.#t.has(Q)}valueOf(Q){return this.#e[Q]}values(){return this.#e}ranks(Q){const U=Q||"";if(this.#r&&this.#i===this.#n&&this.#s===U)return this.#r;const x=this.#e.length,q=new Array(x);for(let b=0;b<x;b++)q[b]=b;const R=E(Q).compare,j=this.#e;q.sort((b,u)=>this.#a(j[b],j[u],R));const k=new Uint32Array(x);for(let b=0;b<x;b++)k[q[b]]=b;return this.#r=k,this.#i=this.#n,this.#s=U,k}#a(Q,U,x){return typeof Q=="string"&&typeof U=="string"?x(Q,U):K(Q,U)}}}),_e("packages/core/src/store/multivalue.js",function(e,F){"use strict";Object.defineProperty(e,"MultiValue",{enumerable:!0,get:function(){return ie}});class ie{#e;#t;#n=0;#r=0;constructor(K={}){const I=Math.max(1,K.rows??16),L=Math.max(1,K.values??I);this.#e=new Int32Array(L),this.#t=new Uint32Array(I+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,I){if(K<0||K>=this.#n)return!1;const L=this.#e,Q=this.#t[K+1];for(let U=this.#t[K];U<Q;U++)if(L[U]===I)return!0;return!1}hasAny(K,I){for(let L=0;L<I.length;L++)if(this.has(K,I[L]))return!0;return!1}hasAll(K,I){for(let L=0;L<I.length;L++)if(!this.has(K,I[L]))return!1;return!0}hasNone(K,I){return!this.hasAny(K,I)}push(K){const I=this.#n,L=K.length;this.#i(I+1),this.#s(this.#r+L);const Q=this.#r;for(let U=0;U<L;U++)this.#e[Q+U]=K[U]|0;return this.#r+=L,this.#n=I+1,this.#t[I]=Q,this.#t[I+1]=this.#r,I}write(K,I){if(K===this.#n){this.push(I);return}if(K<0||K>this.#n)return;const L=this.#t[K],Q=this.#t[K+1],U=I.length;if(Q-L===U){for(let x=0;x<U;x++)this.#e[L+x]=I[x]|0;return}this.#a(K,I)}compact(K,I,L){const Q=this.#e,U=this.#t,x=this.#n,q=new Int32Array(Math.max(1,this.#r)),R=new Uint32Array(I+1);let j=0;for(let k=0;k<x;k++){if(K[k]===L)continue;const b=U[k],u=U[k+1];R[K[k]]=j;for(let g=b;g<u;g++)q[j++]=Q[g];R[K[k]+1]=j}this.#e=q,this.#t=R,this.#n=I,this.#r=j}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#i(K){if(K+1<=this.#t.length)return;let I=this.#t.length-1;for(;I<K;)I=I*2||16;const L=new Uint32Array(I+1);L.set(this.#t),this.#t=L}#s(K){if(K<=this.#e.length)return;let I=this.#e.length;for(;I<K;)I=I*2||16;const L=new Int32Array(I);L.set(this.#e),this.#e=L}#a(K,I){const L=this.#e,Q=this.#t,U=this.#n,x=I.length-(Q[K+1]-Q[K]),q=new Int32Array(Math.max(1,this.#r+x)),R=new Uint32Array(Q.length);let j=0;for(let k=0;k<U;k++){if(R[k]=j,k===K)for(let b=0;b<I.length;b++)q[j++]=I[b]|0;else for(let b=Q[k];b<Q[k+1];b++)q[j++]=L[b];R[k+1]=j}this.#e=q,this.#t=R,this.#r=j}}}),_e("packages/core/src/compute/sort.js",function(e,F){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return T}});const ie=F("packages/core/src/compute/handle.js"),E=ie.bitReader,K=ie.dictRanks,I=ie.dictSize,L=ie.identity,Q=ie.isMissing,U=ie.presenceReader,x=ie.rowCount,q=ie.valueComparator,R=ie.valueReader,j=new Uint32Array(0),k=new ArrayBuffer(8),b=new Float64Array(k),u=new Uint32Array(k),g=(b[0]=-1,(u[1]&2147483648)!==0?1:0),o=g===1?0:1;function t(O,M){b[0]=O;let A=u[g],N=u[o];(A&2147483648)!==0?(A=~A>>>0,N=~N>>>0):A=(A^2147483648)>>>0,M[0]=N,M[1]=A}function i(O,M,A,N){if(N<2)return O;const $=new Uint32Array(256*8);for(let X=0;X<N;X++){const ne=M[X],se=A[X];$[ne&255]++,$[256+(ne>>>8&255)]++,$[512+(ne>>>16&255)]++,$[768+(ne>>>24&255)]++,$[1024+(se&255)]++,$[1280+(se>>>8&255)]++,$[1536+(se>>>16&255)]++,$[1792+(se>>>24&255)]++}let H=O,Y=M,Z=A,J=new Uint32Array(N),D=new Uint32Array(N),te=new Uint32Array(N);const z=new Uint32Array(256);for(let X=0;X<8;X++){const ne=X<<8,se=(X&3)<<3,ue=X>=4;let ge=!1;for(let Ie=0;Ie<256;Ie++)if($[ne+Ie]===N){ge=!0;break}if(ge)continue;let Oe=0;for(let Ie=0;Ie<256;Ie++)z[Ie]=Oe,Oe+=$[ne+Ie];for(let Ie=0;Ie<N;Ie++){const xe=Y[Ie],ye=Z[Ie],re=(ue?ye:xe)>>>se&255,fe=z[re]++;J[fe]=H[Ie],D[fe]=xe,te[fe]=ye}let Pe=H;H=J,J=Pe,Pe=Y,Y=D,D=Pe,Pe=Z,Z=te,te=Pe}return H}function s(O,M,A){if(A<2)return O;const N=new Uint32Array(256*4);for(let D=0;D<A;D++){const te=M[D];N[te&255]++,N[256+(te>>>8&255)]++,N[512+(te>>>16&255)]++,N[768+(te>>>24&255)]++}let $=O,H=M,Y=new Uint32Array(A),Z=new Uint32Array(A);const J=new Uint32Array(256);for(let D=0;D<4;D++){const te=D<<8,z=D<<3;let X=!1;for(let ue=0;ue<256;ue++)if(N[te+ue]===A){X=!0;break}if(X)continue;let ne=0;for(let ue=0;ue<256;ue++)J[ue]=ne,ne+=N[te+ue];for(let ue=0;ue<A;ue++){const ge=H[ue],Oe=J[ge>>>z&255]++;Y[Oe]=$[ue],Z[Oe]=ge}let se=$;$=Y,Y=se,se=H,H=Z,Z=se}return $}function r(O,M,A,N){const $=new Uint32Array(N+1);for(let Z=0;Z<A;Z++)$[M[Z]]++;let H=0;for(let Z=0;Z<=N;Z++){const J=$[Z];$[Z]=H,H+=J}const Y=new Uint32Array(A);for(let Z=0;Z<A;Z++)Y[$[M[Z]]++]=O[Z];return Y}function n(O,M,A,N){return A<2?O:N<=65536||N<=A*2?r(O,M,A,N):s(O,M,A)}function m(O,M){return O.length===M&&O.byteOffset===0?O:Uint32Array.prototype.slice.call(O,0,M)}function l(O,M,A=!1){const N=M||L(O.length),$=N.length;if($<2)return Uint32Array.from(N);const H=new Uint32Array($),Y=new Uint32Array($),Z=new Uint32Array($),J=new Uint32Array($),D=new Uint32Array(2);let te=0,z=0;for(let se=0;se<$;se++){const ue=N[se],ge=O[ue];if(Number.isNaN(ge)){J[z++]=ue;continue}t(ge,D),A?(Y[te]=~D[0]>>>0,Z[te]=~D[1]>>>0):(Y[te]=D[0],Z[te]=D[1]),H[te++]=ue}const X=i(H.subarray(0,te),Y.subarray(0,te),Z.subarray(0,te),te);if(z===0)return m(X,te);const ne=new Uint32Array($);return ne.set(X.subarray(0,te),0),ne.set(J.subarray(0,z),te),ne}function a(O,M,A=!1){const N=M||L(O.length),$=N.length;if($<2)return Uint32Array.from(N);const H=Uint32Array.from(N),Y=new Uint32Array($);for(let Z=0;Z<$;Z++){const J=(O[H[Z]]^2147483648)>>>0;Y[Z]=A?~J>>>0:J}return m(s(H,Y,$),$)}function c(O,M,A={}){const N=M||L(x(O,A)),$=N.length;if($<2)return Uint32Array.from(N);const H=K(O.dict,A.locale),Y=O.values,Z=U(O),J=Math.max(I(O.dict),H.length),D=J,te=Uint32Array.from(N),z=new Uint32Array($),X=!!A.descending;for(let ne=0;ne<$;ne++){const se=te[ne];let ue=Z&&Z(se)===0?D:H[Y[se]];ue===void 0&&(ue=D),z[ne]=X?D-ue:ue}return m(n(te,z,$,J+1),$)}function f(O,M,A){const N=M.length;let $=Uint32Array.from(M);if(N<2)return $;let H=new Uint32Array(N);for(let Y=1;Y<N;Y<<=1){for(let J=0;J<N;J+=Y<<1){const D=Math.min(J+Y,N),te=Math.min(J+(Y<<1),N);let z=J,X=D,ne=J;for(;z<D&&X<te;)H[ne++]=A(O[$[z]],O[$[X]])<=0?$[z++]:$[X++];for(;z<D;)H[ne++]=$[z++];for(;X<te;)H[ne++]=$[X++]}const Z=$;$=H,H=Z}return $}function p(O,M,A){const N=E(O.values),$=M.length,H=new Uint32Array($),Y=A?1:0;let Z=0;for(let J=0;J<$;J++)N(M[J])===Y&&(H[Z++]=M[J]);for(let J=0;J<$;J++)N(M[J])!==Y&&(H[Z++]=M[J]);return H}function y(O,M){const A=O.values,N=O.kind;if((N==="object"||N===void 0)&&(Array.isArray(A)||ArrayBuffer.isView(A))&&!O.presence)return A;const H=R(O),Y=new Array(x(O)||0);for(let Z=0;Z<M.length;Z++){const J=M[Z];Y[J]=H(J)}return Y}function h(O,M){for(let A=0;A<M.length;A++)if(typeof O[M[A]]!="string")return!1;return!0}function d(O,M,A,N,$){const H=O.length,Y=Uint32Array.from(O);if(H<2||N<1)return Y;const Z=new Uint32Array(H),J=N-1;for(let D=0;D<H;D++){const te=A[M[D]];Z[D]=$?J-te:te}return m(n(Y,Z,H,N),H)}function w(O,M,A){const N=q(A),$=new Array(M);for(let Y=0;Y<M;Y++)$[Y]=Y;$.sort((Y,Z)=>N(O[Y],O[Z])||Y-Z);const H=new Uint32Array(M);for(let Y=0;Y<M;Y++)H[$[Y]]=Y;return H}function v(O,M,A){const N=M.length,$=new Map,H=[],Y=new Uint32Array(N);for(let D=0;D<N;D++){const te=O[M[D]];let z=$.get(te);z===void 0&&(z=H.length,$.set(te,z),H.push(te)),Y[D]=z}const Z=H.length,J=w(H,Z,A.locale);return d(M,Y,J,Z,!!A.descending)}function P(O,M,A){const N=y(O,M);if(M.length>=2&&h(N,M)){const Y=O.stringRank;return Y&&Y.version===O.version&&Y.usable(M,N,A.locale)?Y.sort(M,A):v(N,M,A)}const $=q(A.locale),H=A.descending?(Y,Z)=>$(Z,Y):$;return f(N,M,H)}function W(O,M,A){const N=y(O,M),$=A.compare,Y=!!A.descending?(Z,J)=>-$(Z,J,void 0,void 0,!0):(Z,J)=>$(Z,J,void 0,void 0,!1);return f(N,M,Y)}function V(O,M){const A=M.length,N=U(O),$=O.values,H=O.kind==="float64"&&!!$,Y=O.kind==="object"||O.kind==="multi"||O.kind===void 0;if(!N&&!H&&!Y)return{present:M,absent:j};const Z=new Uint32Array(A),J=new Uint32Array(A);let D=0,te=0;if(N&&H)for(let z=0;z<A;z++){const X=M[z];N(X)===1&&!Number.isNaN($[X])?Z[D++]=X:J[te++]=X}else if(H&&!N)for(let z=0;z<A;z++){const X=M[z];Number.isNaN($[X])?J[te++]=X:Z[D++]=X}else if(N&&!Y)for(let z=0;z<A;z++){const X=M[z];N(X)===1?Z[D++]=X:J[te++]=X}else{const z=R(O);for(let X=0;X<A;X++){const ne=M[X];Q(z(ne))?J[te++]=ne:Z[D++]=ne}}return te===0?{present:M,absent:j}:{present:Z.subarray(0,D),absent:J.subarray(0,te)}}function G(O,M,A){if(M.length===0)return O;const N=new Uint32Array(O.length+M.length);return A?(N.set(M,0),N.set(O,M.length)):(N.set(O,0),N.set(M,O.length)),N}function _(O,M,A={}){const N=M||L(x(O,A));if(!O||N.length<2)return Uint32Array.from(N);const{present:$,absent:H}=V(O,N);if($.length===0)return Uint32Array.from(N);const Y=!!A.descending;let Z;if(typeof A.compare=="function")Z=W(O,$,A);else switch(O.kind){case"float64":Z=l(O.values,$,Y);break;case"int32":Z=a(O.values,$,Y);break;case"dictionary":Z=c(O,$,A);break;case"bitset":Z=p(O,$,Y);break;default:Z=P(O,$,A);break}return G(Z,H,!!A.nullsFirst)}function T(O,M,A,N={}){const $=M||[],H=$.length&&($[0].handle||S(O,$[0].col))||O&&O[0];let Y=A||L(x(H,N));for(let Z=$.length-1;Z>=0;Z--){const J=$[Z],D=J.handle||S(O,J.col)||O&&O[Z];D&&(Y=_(D,Y,{descending:J.descending!==void 0?!!J.descending:J.dir==="desc",nullsFirst:!!J.nullsFirst,locale:J.locale!==void 0?J.locale:N.locale,compare:J.compare}))}return Y instanceof Uint32Array?Y:Uint32Array.from(Y)}function S(O,M){if(!(!O||M===void 0)){for(let A=0;A<O.length;A++)if(O[A]&&O[A].id===M)return O[A]}}}),_e("packages/core/src/store/stringrank.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_MAX_DISTINCT",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"StringRankIndex",{enumerable:!0,get:function(){return L}});const ie=F("packages/core/src/compute/sort.js"),E=ie.collateStringRanks,K=ie.rankSortStrings,I=1e5;class L{#e=[];#t=new Map;#n;#r=0;#i=0;#s=-1;#a;#l=!1;#o=null;#c=-1;#u="\0";constructor(U=I){this.#a=U>0?U:I,this.#n=new Uint32Array(0)}get version(){return this.#s}set version(U){this.#s=U}get generation(){return this.#i}get size(){return this.#e.length}get capped(){return this.#l}get length(){return this.#r}get bytes(){let U=this.#n.byteLength;const x=this.#e;for(let q=0;q<x.length;q++)U+=x[q].length*2+24;return U}#f(U,x){const q=this.#t.get(U);if(q!==void 0)return q;if(this.#l)return-1;if(x&&this.#e.length>=this.#a)return this.#l=!0,-1;const R=this.#e.length;return this.#e.push(U),this.#t.set(U,R),this.#i++,R}build(U,x){const q=x|0;this.#e=[],this.#t=new Map,this.#i=0,this.#l=!1,this.#o=null,this.#c=-1,this.#n=new Uint32Array(q);for(let R=0;R<q;R++){const j=U[R],k=typeof j=="string"?this.#f(j,!1):-1;this.#n[R]=k<0?0:k}this.#r=q}append(U,x,q){const R=(x|0)+(q|0);if(R>this.#n.length){const j=new Uint32Array(R);j.set(this.#n.subarray(0,this.#r)),this.#n=j}for(let j=x|0;j<R;j++){const k=U[j],b=typeof k=="string"?this.#f(k,!0):-1;this.#n[j]=b<0?0:b}this.#r=Math.max(this.#r,R)}ranks(U){const x=U||"";if(this.#o&&this.#c===this.#i&&this.#u===x)return this.#o;const q=E(this.#e,this.#e.length,U);return this.#o=q,this.#c=this.#i,this.#u=x,q}usable(U,x,q){if(this.#l||this.#e.length===0)return!1;const R=this.#n,j=this.#e,k=this.#r;for(let b=0;b<U.length;b++){const u=U[b];if(u>=k||j[R[u]]!==x[u])return!1}return!0}sort(U,x){const q=this.ranks(x.locale),R=this.#e.length,j=U.length,k=new Uint32Array(j),b=this.#n;for(let u=0;u<j;u++)k[u]=b[U[u]];return K(U,k,q,R,!!x.descending)}}}),_e("packages/core/src/store/columnstore.js",function(e,F){"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 f}}),Object.defineProperty(e,"ColumnStore",{enumerable:!0,get:function(){return p}});const E=F("packages/core/src/internal/warn.js").warnOnce,I=F("packages/core/src/internal/predicates.js").isFunction,Q=F("packages/core/src/internal/paths.js").pathGetter,x=F("packages/core/src/store/bitset.js").Bitset,R=F("packages/core/src/store/dictionary.js").Dictionary,k=F("packages/core/src/store/multivalue.js").MultiValue,u=F("packages/core/src/store/stringrank.js").StringRankIndex,g=4294967295,o=1024,t=5e3,i=.2,s=new Set(["float64","int32","bitset","dictionary","object","multi"]);function r(y){return y==null}function n(y){return typeof y=="number"?y:y instanceof Date?y.getTime():typeof y=="boolean"?y?1:0:Number(y)}function m(y){const h=n(y);return Number.isFinite(h)?h|0:0}function l(y){return r(y)?[]:Array.isArray(y)?y:[y]}function a(y,h){switch(y.kind){case"float64":case"int32":return y.buf[h];case"bitset":return y.bits.get(h)===1;case"dictionary":return y.dict.valueOf(y.buf[h]);case"multi":{const d=y.mv.at(h),w=new Array(d.length);for(let v=0;v<d.length;v++)w[v]=y.dict.valueOf(d[v]);return w}default:return y.buf[h]}}function c(y,h){switch(y.kind){case"float64":case"int32":return y.values[h];case"bitset":return(y.values[h>>3]&1<<(h&7))!==0;case"dictionary":return(y.table||[])[y.values[h]];case"multi":{const d=y.offsets[h],w=y.offsets[h+1],v=y.table||[],P=new Array(w-d);for(let W=d;W<w;W++)P[W-d]=v[y.values[W]];return P}default:return y.values[h]}}class f{#e;#t;#n;#r;#i;#s;#a;#l=!1;#o=null;#c=null;#u=null;#f=null;#d=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#O=null;#w=null;#A=!1;constructor(h,d){this.#e=h.id;const w=s.has(h.kind)?h.kind:"object";h.kind&&!s.has(h.kind)&&E(`store.kind.${h.id}`,`column "${h.id}" declares unknown storage kind "${h.kind}"; falling back to object`),this.#n=w,this.#t=w,this.#r=h.nullable!==!1,this.#a=h.dictionary??null,this.#s=d,this.#i=I(h.read)?h.read:Q(h.field||h.id),this.#h=h.stringRankIndex!=="off",this.#p=typeof h.stringRankMaxDistinct=="number"?h.stringRankMaxDistinct:0,this.#O=new Map}get id(){return this.#e}get kind(){return this.#l?this.#t:"object"}get target(){return this.#n}get nullable(){return this.#r}get values(){return this.#A?null:this.#l?this.#t==="bitset"?this.#c.words:this.#t==="multi"?this.#u.values:this.#o:this.#T().values}get presence(){return this.#A||!this.#r?null:this.#l?this.#g:this.#T().presence}get dict(){return this.#A||!this.#l?null:this.#t==="dictionary"||this.#t==="multi"?this.#f:null}get stringRank(){if(this.#A||!this.#h||this.kind!=="object")return null;const h=this.values,d=this.#s.physical();if(!h||d===0)return null;if(this.#d===null){if(typeof h[0]!="string")return null;const w=new u(this.#v());return w.build(h,d),w.version=this.#y,this.#d=w,this.#m=this.#y,w.capped?null:w}return this.#d.length<d&&this.#d.append(h,this.#d.length,d-this.#d.length),this.#d.version=this.#y,this.#m=this.#y,this.#d.capped?null:this.#d}#v(){return this.#p}#P(){this.#d=null,this.#m=-1}get offsets(){return this.#A||!this.#l||this.#t!=="multi"?null:this.#u.offsets}get version(){return this.#y}get bytes(){let h=0;return this.#o&&(h+=this.#o.byteLength??this.#o.length*8),this.#c&&(h+=this.#c.bytes),this.#u&&(h+=this.#u.bytes),this.#g&&(h+=this.#g.bytes),this.#f&&(h+=this.#f.bytes),this.#O&&(h+=this.#O.size*24),h}get(h){if(!this.#A&&!(h<0||h>=this.#s.physical())){if(!this.#l)return this.#E(h);if(this.#r&&this.#g.get(h)===0)return null;switch(this.#t){case"float64":case"int32":return this.#o[h];case"bitset":return this.#c.get(h)===1;case"dictionary":return this.#f.valueOf(this.#o[h]);case"multi":{const d=this.#u.at(h),w=new Array(d.length);for(let v=0;v<d.length;v++)w[v]=this.#f.valueOf(d[v]);return w}default:return this.#o[h]}}}set(h,d){this.#A||(this.#l?this.#C(h,d):this.#O.set(h,d===void 0?null:d),this.#d&&this.#P(),this.#y++)}read(h){return this.#i(h)}appendColumn(h,d,w){if(this.#A||w<=0)return;if(!this.#l){this.#y++;return}const v=this.#i,P=this.#r,W=this.#g;let V=!1;switch(this.#t){case"float64":{const G=this.#o;for(let _=0;_<w;_++){const T=v(h[_]);if(typeof T=="number"){P&&W.set(d+_),G[d+_]=T;continue}const S=T==null;P?W.assign(d+_,!S):S&&(V=!0),G[d+_]=S?NaN:n(T)}break}case"int32":{const G=this.#o;for(let _=0;_<w;_++){const T=v(h[_]),S=T==null;P?W.assign(d+_,!S):S&&(V=!0),G[d+_]=S?0:m(T)}break}case"bitset":{const G=this.#c;for(let _=0;_<w;_++){const T=v(h[_]),S=T==null;P?W.assign(d+_,!S):S&&(V=!0),G.assign(d+_,!S&&!!T)}break}case"dictionary":{const G=this.#o,_=this.#f;for(let T=0;T<w;T++){const S=v(h[T]),O=S==null;P?W.assign(d+T,!O):O&&(V=!0),G[d+T]=O?0:_.codeOf(S)}break}case"multi":{const G=this.#u,_=this.#f;for(let T=0;T<w;T++){const S=v(h[T]),O=S==null;P?W.assign(d+T,!O):O&&(V=!0);const M=l(S),A=new Array(M.length);for(let N=0;N<M.length;N++)A[N]=_.codeOf(M[N]);G.write(d+T,A)}break}default:{const G=this.#o;for(let _=0;_<w;_++){const T=v(h[_]),S=T==null;P?W.assign(d+_,!S):S&&(V=!0),G[d+_]=S?null:T}break}}V&&E(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#d&&this.#t==="object"&&(this.#d.append(this.#o,d,w),this.#d.version=this.#y+1,this.#m=this.#y+1),this.#y++}appendPacked(h,d,w){if(this.#A||w<=0||!h)return;if(!this.#l){this.#y++;return}const v=this.#g,P=h.presence;if(v)if(P)for(let V=0;V<w;V++)v.assign(d+V,(P[V>>3]&1<<(V&7))!==0);else for(let V=0;V<w;V++)v.set(d+V);const W=h.kind===this.#t;if(W&&(this.#t==="float64"||this.#t==="int32")){this.#o.set(h.values,d),this.#y++;return}if(W&&this.#t==="bitset"){const V=h.values;for(let G=0;G<w;G++)this.#c.assign(d+G,(V[G>>3]&1<<(G&7))!==0);this.#y++;return}if(W&&this.#t==="dictionary"){const V=h.table||[],G=new Uint32Array(V.length);for(let O=0;O<V.length;O++)G[O]=this.#f.codeOf(V[O]);const _=h.values,T=this.#o,S=v;for(let O=0;O<w;O++){if(S&&(P&&(P[O>>3]&1<<(O&7))===0)){T[d+O]=0;continue}T[d+O]=G[_[O]]??0}this.#y++;return}if(W&&this.#t==="multi"){const V=h.table||[],G=new Uint32Array(V.length);for(let S=0;S<V.length;S++)G[S]=this.#f.codeOf(V[S]);const _=h.values,T=h.offsets;for(let S=0;S<w;S++){const O=T[S],M=T[S+1],A=new Array(M-O);for(let N=O;N<M;N++)A[N-O]=G[_[N]]??0;this.#u.write(d+S,A)}this.#y++;return}for(let V=0;V<w;V++){const G=P?(P[V>>3]&1<<(V&7))===0:h.kind==="object"?h.values[V]===null:!1;this.#C(d+V,G?null:c(h,V))}this.#y++}touch(){this.#y++}columnarise(h,d){if(this.#l||this.#A)return;const w=new Array(d);for(let v=0;v<d;v++)w[v]=this.#E(v);this.#t=this.#n,this.#l=!0,this.#S(h);for(let v=0;v<d;v++)this.#C(v,w[v]);this.#O.clear(),this.#w=null,this.#P(),this.#y++}grow(h){if(!(!this.#l||this.#A||h<=this.#b)){switch(this.#t){case"float64":case"int32":case"dictionary":{const d=new this.#o.constructor(h);d.set(this.#o),this.#o=d;break}case"bitset":this.#c.grow(h);break;case"multi":break;default:this.#o.length=h;break}this.#g&&this.#g.grow(h),this.#b=h,this.#y++}}convert(h){if(this.#A||!s.has(h)||(this.#n=h,!this.#l||h===this.#t))return!1;const d={kind:this.#t,buf:this.#o,bits:this.#c,mv:this.#u,dict:this.#f},w=this.#s.physical(),v=this.#g;this.#t=h,this.#S(this.#b);for(let P=0;P<w;P++){const W=v!==null&&v.get(P)===0;W&&h!=="multi"||this.#C(P,W?null:a(d,P))}return this.#P(),this.#y++,!0}compact(h,d,w){if(!this.#A){if(this.#P(),!this.#l){const v=this.#O;if(v.size){const P=new Map;for(const[W,V]of v)h[W]!==g&&P.set(h[W],V);this.#O=P}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const v=this.#o;for(let P=0;P<d;P++)h[P]!==g&&(v[h[P]]=v[P]);if(this.#t==="object")for(let P=w;P<d;P++)v[P]=void 0;break}case"bitset":{const v=this.#c;for(let P=0;P<d;P++)h[P]!==g&&v.assign(h[P],v.get(P)===1);for(let P=w;P<d;P++)v.clear(P);break}case"multi":this.#u.compact(h,w,g);break;default:break}if(this.#g){const v=this.#g;for(let P=0;P<d;P++)h[P]!==g&&v.assign(h[P],v.get(P)===1);for(let P=w;P<d;P++)v.clear(P)}this.#y++}}release(){this.#A||(this.#A=!0,this.#o=null,this.#c&&this.#c.release(),this.#c=null,this.#u&&this.#u.release(),this.#u=null,this.#g&&this.#g.release(),this.#g=null,this.#f=null,this.#d=null,this.#O=new Map,this.#w=null,this.#b=0,this.#y++)}#S(h){const d=Math.max(1,h);switch(this.#o=null,this.#c=null,this.#u=null,this.#t){case"float64":this.#o=new Float64Array(d);break;case"int32":this.#o=new Int32Array(d);break;case"bitset":this.#c=new x(d);break;case"dictionary":this.#o=new Uint32Array(d),this.#f=this.#f??new R(this.#a??[]);break;case"multi":this.#u=new k({rows:d,values:d}),this.#f=this.#f??new R(this.#a??[]);break;default:this.#o=new Array(d);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#f=null),this.#r&&(this.#g?this.#g.grow(d):this.#g=new x(d)),this.#b=d}#C(h,d){const w=r(d);switch(this.#r?this.#g.assign(h,!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.#o[h]=w?NaN:n(d);break;case"int32":this.#o[h]=w?0:m(d);break;case"bitset":this.#c.assign(h,!w&&!!d);break;case"dictionary":this.#o[h]=w?0:this.#f.codeOf(d);break;case"multi":{const v=l(d),P=new Array(v.length);for(let W=0;W<v.length;W++)P[W]=this.#f.codeOf(v[W]);this.#u.write(h,P);break}default:this.#o[h]=w?null:d;break}}#E(h){if(this.#O.has(h))return this.#O.get(h);const d=this.#i(this.#s.rowAt(h));return d===void 0?null:d}#T(){if(this.#w&&this.#w.version===this.#y)return this.#w;const h=this.#s.physical(),d=new Array(h),w=this.#r?new x(h):null;for(let v=0;v<h;v++){const P=this.#E(v);d[v]=P,w&&!r(P)&&w.set(v)}return this.#w={version:this.#y,values:d,presence:w},this.#w}}class p{#e;#t=new Map;#n=[];#r=[];#i=0;#s=0;#a=0;#l=0;#o=new x(0);#c=!1;#u=!0;#f;#d;#h;#p=!1;constructor(h,d={}){this.#e=Array.isArray(h)?h:[],this.#d=Math.max(1,d.initialCapacity??o),this.#u=d.retainSource!==!1,this.#f=this.#u?d.columnarBelow??t:0,this.#h=d.compactRatio??i;const w={rowAt:v=>this.#r[v],physical:()=>this.#i};for(const v of this.#e){if(!v||!v.id)continue;if(this.#t.has(v.id)){E(`store.dup.${v.id}`,`duplicate column id "${v.id}" in the store schema; ignoring the second`);continue}const P=new f(v,w);this.#t.set(v.id,P),this.#n.push(P)}this.#f<=0&&this.#b()}get count(){return this.#a}get physical(){return this.#i}get capacity(){return this.#c?this.#s:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let h=this.#o.bytes+this.#r.length*8;for(const d of this.#n)h+=d.bytes;return h}append(h){const d=this.#i;if(this.#p||!h)return{from:d,to:d};const w=h.length|0;if(w===0)return{from:d,to:d};if(this.#u)for(let P=0;P<w;P++)this.#r[d+P]=h[P];if(this.#i=d+w,this.#a+=w,this.#o.grow(this.#i),!this.#c){if(this.#i>=this.#f)this.#b();else for(const P of this.#n)P.touch();return{from:d,to:this.#i}}this.#m(this.#i);const v=this.#n;for(let P=0;P<v.length;P++)v[P].appendColumn(h,d,w);return{from:d,to:this.#i}}appendPacked(h,d){const w=this.#i;if(this.#p||!h)return{from:w,to:w};const v=h.count|0;if(v===0)return{from:w,to:w};if(this.#u&&d)for(let W=0;W<v;W++)this.#r[w+W]=d[W];this.#i=w+v,this.#a+=v,this.#o.grow(this.#i),this.#c||this.#b(),this.#m(this.#i);const P=new Map;for(const W of h.columns)P.set(W.id,W);for(const W of this.#n){const V=P.get(W.id);V?W.appendPacked(V,w,v):W.grow(this.#s)}return{from:w,to:this.#i}}source(h){if(this.#u)return this.#r[h];if(!(h<0||h>=this.#i))return this.#g(h)}setSource(h,d){this.#p||h<0||h>=this.#i||this.#u&&(this.#r[h]=d)}get(h,d){const w=this.#t.get(h);return w?w.get(d):void 0}set(h,d,w){if(this.#p||d<0||d>=this.#i)return;const v=this.#t.get(h);if(!v){E(`store.set.${h}`,`set() on unknown column "${h}"`);return}v.set(d,w)}remove(h){return this.#p||h<0||h>=this.#i||this.#o.get(h)===1?!1:(this.#o.set(h),this.#l++,this.#a--,!0)}live(h){return h<0||h>=this.#i?!1:this.#o.get(h)===0}compact(h={}){if(this.#p||this.#l===0||!h.force&&this.#l/this.#i<this.#h)return null;const d=this.#i,w=new Uint32Array(d);let v=0;for(let P=0;P<d;P++)w[P]=this.#o.get(P)===1?g:v++;for(const P of this.#n)P.compact(w,d,v);if(this.#u){const P=this.#r;for(let W=0;W<d;W++)w[W]!==g&&(P[w[W]]=P[W]);P.length=v}return this.#i=v,this.#a=v,this.#l=0,this.#o=new x(Math.max(this.#s,v)),w}column(h){return this.#t.get(h)}columns(){return this.#n.slice()}liveIndices(){const h=new Uint32Array(this.#a);if(this.#l===0){for(let w=0;w<this.#i;w++)h[w]=w;return h}let d=0;for(let w=0;w<this.#i;w++)this.#o.get(w)===0&&(h[d++]=w);return h}convert(h,d){const w=this.#t.get(h);return w?w.convert(d):!1}destroy(){if(!this.#p){this.#p=!0;for(const h of this.#n)h.release();this.#t.clear(),this.#n.length=0,this.#r.length=0,this.#o.release(),this.#i=0,this.#a=0,this.#l=0,this.#s=0}}#m(h){if(h<=this.#s)return;let d=this.#s||this.#d;for(;d<h;)d*=2;for(const w of this.#n)w.grow(d);this.#o.grow(d),this.#s=d}#g(h){const d={};for(const w of this.#n)d[w.id]=w.get(h);return d}#b(){if(this.#c)return;let h=this.#d;for(;h<this.#i;)h*=2;this.#c=!0,this.#s=h,this.#o.grow(h);for(const d of this.#n)d.columnarise(h,this.#i)}}}),_e("packages/core/src/store/pool.js",function(e,F){"use strict";Object.defineProperty(e,"MaskPool",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"sharedPool",{enumerable:!0,get:function(){return L}});const ie=64,E=8;function K(U){let x=ie;for(;x<U;)x*=2;return x}class I{#e=new Map;#t=new WeakSet;#n;#r=0;#i={acquired:0,reused:0,released:0};constructor(x={}){this.#n=x.limit??E}get bytes(){return this.#r}mask(x){const q=new Uint8Array(this.#s(x),0,x);return q.fill(0),q}indices(x){return new Uint32Array(this.#s(x*4),0,x)}release(x){if(!x||!x.buffer)return!1;const q=x.buffer;if(!this.#t.has(q))return!1;this.#t.delete(q),this.#i.released++;const R=q.byteLength;let j=this.#e.get(R);return j||this.#e.set(R,j=[]),j.length>=this.#n||(j.push(q),this.#r+=R),!0}releaseAll(x){for(const q of x)this.release(q)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#i,retained:this.#r}}#s(x){const q=K(x),R=this.#e.get(q);this.#i.acquired++;let j;return R&&R.length?(j=R.pop(),this.#r-=q,this.#i.reused++):j=new ArrayBuffer(q),this.#t.add(j),j}}function L(){return Q??=new I,Q}let Q=null}),_e("packages/core/src/compute/sortspec.js",function(e,F){"use strict";Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return ie}}),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 I}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return L}});function ie(Q){return{locale:Q===void 0?void 0:String(Q),numeric:!0,sensitivity:"variant"}}function E(Q){return!!Q&&typeof Q.compare!="function"}function K(Q){if(!Q)return!0;for(let U=0;U<Q.length;U++)if(!E(Q[U]))return!1;return!0}function I(Q,U){const x=Q.col!==void 0?Q.col:Q.handle&&Q.handle.id,q=Q.locale!==void 0?Q.locale:U;return{col:x,descending:Q.descending!==void 0?!!Q.descending:Q.dir==="desc",nullsFirst:!!Q.nullsFirst,collation:ie(q)}}function L(Q,U){const x=Q||[],q=new Array(x.length);for(let R=0;R<x.length;R++)q[R]=I(x[R],U);return q}}),_e("packages/core/src/compute/facet.js",function(e,F){"use strict";Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return R}}),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 b}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return w}});const ie=F("packages/core/src/compute/handle.js"),E=ie.presenceReader,K=ie.valueReader,I=ie.dictSize,L=ie.dictValue,Q=Object.freeze(["equal","quantile","log"]),U=Object.freeze(["hour","day","week","month","quarter","year"]),x=20,q=50,R=1e4;function j(v,P){if(!v)return"none";const W=P;if(W&&(W.multi===!0||typeof W.items=="function"))return"category";const V=P&&P.base;if(V==="date"||V==="datetime"||V==="time"||V==="dateString")return"date";switch(v.kind){case"bitset":return"boolean";case"float64":case"int32":return"numeric";case"dictionary":return"category";case"multi":return"category";default:return V==="number"?"numeric":V==="boolean"?"boolean":V==="text"?"category":"none"}}function k(v){const P=v.values,W=v.kind;if((W==="float64"||W==="int32")&&P)return G=>P[G];const V=K(v);return G=>b(V(G))}function b(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 P=Number(v);if(Number.isFinite(P))return P;const W=Date.parse(v);return Number.isFinite(W)?W:NaN}return NaN}function u(v,P,W,V=q){if(!v)return{cardinality:0,exact:!0};if(v.dict)return{cardinality:I(v.dict),exact:!0};if(v.kind==="bitset")return{cardinality:2,exact:!0};const G=K(v),_=P?P.length:W,T=new Set;for(let S=0;S<_;S++){const O=G(P?P[S]:S);if(O!=null&&(T.add(O),T.size>V))return{cardinality:T.size,exact:!1}}return{cardinality:T.size,exact:!0}}const g=36e5,o=864e5;function t(v,P=x){const W=Number.isFinite(v)&&v>0?v:0,V=Math.max(1,P)*2;return W/g<=V?"hour":W/o<=V?"day":W/(7*o)<=V?"week":W/(30*o)<=V?"month":W/(91*o)<=V?"quarter":"year"}function i(v,P){if(!Number.isFinite(v))return NaN;const W=new Date(v);switch(P){case"hour":return W.setMinutes(0,0,0),W.getTime();case"day":return W.setHours(0,0,0,0),W.getTime();case"week":{W.setHours(0,0,0,0);const V=(W.getDay()+6)%7;return W.setDate(W.getDate()-V),W.getTime()}case"month":return W.setDate(1),W.setHours(0,0,0,0),W.getTime();case"quarter":return W.setMonth(Math.floor(W.getMonth()/3)*3,1),W.setHours(0,0,0,0),W.getTime();default:return W.setMonth(0,1),W.setHours(0,0,0,0),W.getTime()}}function s(v,P){const W=new Date(v);switch(P){case"hour":W.setHours(W.getHours()+1);break;case"day":W.setDate(W.getDate()+1);break;case"week":W.setDate(W.getDate()+7);break;case"month":W.setMonth(W.getMonth()+1);break;case"quarter":W.setMonth(W.getMonth()+3);break;default:W.setFullYear(W.getFullYear()+1);break}return W.getTime()}function r(v,P,W){const V=k(v),G=E(v),_=P?P.length:W;let T=1/0,S=-1/0,O=0,M=0;for(let A=0;A<_;A++){const N=P?P[A]:A;if(G&&!G(N)){O++;continue}const $=V(N);if(!Number.isFinite($)){O++;continue}$<T&&(T=$),$>S&&(S=$),M++}return{min:T,max:S,nulls:O,finite:M}}function n(v,P,W,V){const G=k(v),_=E(v),T=P?P.length:W,S=T>V?T/V:1,O=[];for(let A=0;A<T;A+=S){const N=P?P[Math.floor(A)]:Math.floor(A);if(_&&!_(N))continue;const $=G(N);Number.isFinite($)&&O.push($)}const M=Float64Array.from(O);return M.sort(),M}function m(v,P,W,V={}){const G=V.kind||j(v,V.type);return G==="none"||!v?{kind:"none",buckets:[],suppressed:"type"}:G==="boolean"?l(v,P,W,V):G==="category"?a(v,P,W,V):f(v,P,W,G,V)}function l(v,P,W,V={}){const G=E(v);let _=0;if(G){const S=P?P.length:W;for(let O=0;O<S;O++)G(P?P[O]:O)||_++}const T=[{value:!1,label:"false"},{value:!0,label:"true"}];return _>0&&V.blanks!==!1&&T.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:T}}function a(v,P,W,V){const G=V.cardinalityLimit??q,{cardinality:_}=u(v,P,W,G);if(_>G&&(V.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:_};const T=K(v),S=P?P.length:W,O=new Map;let M=0;for(let Y=0;Y<S;Y++){const Z=T(P?P[Y]:Y);if(Z==null||Z===""){M++;continue}if(Array.isArray(Z)){if(!Z.length){M++;continue}for(const J of Z)O.set(J,(O.get(J)||0)+1);continue}O.set(Z,(O.get(Z)||0)+1)}let A=[...O.entries()];V.order==="alpha"?A.sort((Y,Z)=>String(Y[0]).localeCompare(String(Z[0]))):A.sort((Y,Z)=>Z[1]-Y[1]);let N=0,$=0;if(A.length>G){$=A.length-G;for(let Y=G;Y<A.length;Y++)N+=A[Y][1];A=A.slice(0,G)}const H=A.map(([Y])=>({value:Y,label:String(Y)}));return N>0&&H.push({remainder:!0,label:`Other (${$} values)`}),M>0&&V.blanks!==!1&&H.push({null:!0,label:"Empty"}),{kind:"category",buckets:H,cardinality:_}}function c(v,P,W,V,G){const _=n(v,P,W,R),T=_.length;if(T<100)return null;const S=_[Math.floor(.01*T)],O=_[Math.ceil(.99*T)-1];return!(O>S)||G-V<=2*(O-S)?null:{lo:S,hi:O}}function f(v,P,W,V,G){const{min:_,max:T,nulls:S,finite:O}=r(v,P,W);if(!O)return{kind:V,buckets:S&&G.blanks!==!1?[{null:!0,label:"Empty"}]:[],empty:!0};const M=Math.max(1,Math.floor(G.buckets||x));let A=[];if(V==="date"){const $=U.includes(G.granularity)?G.granularity:t(T-_,M);let H=i(_,$);for(;H<=T&&A.length<4096;){const Y=s(H,$);if(!(Y>H))break;A.push({from:H,to:Y}),H=Y}return{kind:V,buckets:p(A,G.blanks===!1?0:S),granularity:$}}const N=Q.includes(G.strategy)?G.strategy:"equal";if(N==="quantile"){const $=n(v,P,W,R);if($.length){const H=[$[0]];for(let Y=1;Y<M;Y++){const Z=$[Math.min($.length-1,Math.floor(Y/M*$.length))];Z>H[H.length-1]&&H.push(Z)}H.push(T);for(let Y=0;Y<H.length-1;Y++)A.push({from:H[Y],to:H[Y+1]})}}else if(N==="log"&&_>0){const $=Math.log10(_),Y=(Math.log10(T)-$)/M||1;for(let Z=0;Z<M;Z++)A.push({from:10**($+Z*Y),to:10**($+(Z+1)*Y)})}if(!A.length&&N==="equal"){const $=c(v,P,W,_,T);if($){const H=($.hi-$.lo)/M;$.lo>_&&A.push({from:_,to:$.lo,overflow:"low"});for(let Y=0;Y<M;Y++)A.push({from:$.lo+Y*H,to:$.lo+(Y+1)*H});A[A.length-1].to=$.hi,$.hi<T&&A.push({from:$.hi,to:T,overflow:"high"})}}if(!A.length){const $=(T-_)/M||1;for(let H=0;H<M;H++)A.push({from:_+H*$,to:_+(H+1)*$})}return A[A.length-1].to=T,{kind:V,buckets:p(A,G.blanks===!1?0:S),strategy:N,min:_,max:T}}function p(v,P){return P>0?[...v,{null:!0,label:"Empty"}]:v}function y(v,P,W,V,G){const _=V&&V.buckets||[],T=G&&G.length>=_.length?G.subarray(0,_.length):new Uint32Array(_.length);if(T.fill(0),!v||!_.length)return T;const S=_.length-1,O=!!_[S]&&_[S].null===!0,M=P?P.length:W;if(V.kind==="boolean"){const Y=K(v);for(let Z=0;Z<M;Z++){const J=Y(P?P[Z]:Z);if(J==null){O&&T[S]++;continue}T[J?1:0]++}return T}if(V.kind==="category"){const Y=new Map;for(let D=0;D<_.length;D++)!_[D].null&&!_[D].remainder&&Y.set(_[D].value,D);const Z=_.findIndex(D=>D.remainder),J=K(v);for(let D=0;D<M;D++){const te=J(P?P[D]:D);if(te==null||te===""){O&&T[S]++;continue}if(Array.isArray(te)){if(!te.length){O&&T[S]++;continue}for(const X of te){const ne=Y.get(X);ne!==void 0?T[ne]++:Z>=0&&T[Z]++}continue}const z=Y.get(te);z!==void 0?T[z]++:Z>=0&&T[Z]++}return T}const A=O?_.length-1:_.length,N=new Float64Array(A+1);for(let Y=0;Y<A;Y++)N[Y]=_[Y].from;N[A]=A?_[A-1].to:0;const $=k(v),H=E(v);for(let Y=0;Y<M;Y++){const Z=P?P[Y]:Y;if(H&&!H(Z)){O&&T[S]++;continue}const J=$(Z);if(!Number.isFinite(J)){O&&T[S]++;continue}const D=h(N,A,J);D>=0&&T[D]++}return T}function h(v,P,W){if(!P||W<v[0])return-1;if(W>=v[P])return W===v[P]?P-1:-1;let V=0,G=P-1;for(;V<G;){const _=V+G+1>>>1;W>=v[_]?V=_:G=_-1}return V}function d(v,P,W,V={}){const G=V.bounds||m(v,V.boundsIndices??P,W,V);return{bounds:G,counts:y(v,P,W,G)}}const w=d}),_e("packages/core/src/compute/pivotmatrix.js",function(e,F){"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 o}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return i}});const E=F("packages/core/src/compute/handle.js").valueComparator,I=F("packages/core/src/compute/total.js").total,Q=F("packages/core/src/compute/group.js").packKeys,U=F("packages/core/src/compute/pivot.js"),x=U.joinPath,q=U.DEFAULT_PATH_SEPARATOR,R=U.DEFAULT_MAX_COLUMNS,j="";function k(s,r,n={}){const m=n.separator||q,l=s||[],a=r instanceof Uint32Array?r:Uint32Array.from(r||[]),c=a.length;if(l.length===0)return{tuples:[[]],paths:[j],buckets:[a]};const{keyOf:f,readers:p}=Q(l,a,0),y=new Map,h=[],d=[],w=[];for(let _=0;_<c;_++){const T=a[_],S=f(T);let O=y.get(S);if(O===void 0){O=h.length,y.set(S,O),d.push(S);const M=new Array(p.length);for(let A=0;A<p.length;A++)M[A]=p[A](T);h.push(M),w.push([])}w[O].push(T)}const v=E(n.locale),P=h.map((_,T)=>T);P.sort((_,T)=>{const S=h[_],O=h[T];for(let M=0;M<S.length;M++){const A=b(S[M],O[M],v);if(A!==0)return A}return _-T});const W=new Array(P.length),V=new Array(P.length),G=new Array(P.length);for(let _=0;_<P.length;_++){const T=P[_];W[_]=h[T],V[_]=x(h[T],m),G[_]=Uint32Array.from(w[T])}return{tuples:W,paths:V,buckets:G}}function b(s,r,n){const m=s==null,l=r==null;return m||l?m&&l?0:m?1:-1:n(s,r)}function u(s,r,n){const m=[];for(let l=0;l<s.length;l++)n.has(s[l])&&m.push(s[l]);return Uint32Array.from(m)}function g(s,r,n,m){return{value:r.length?I(s,r,n,m):null,leaves:r,count:r.length}}function o(s){const r=s&&s.opts||{},n=r.separator||q,m=r.totalContext||{locale:r.locale},l=(s.measures||[]).filter(V=>V&&V.handle),a=s.leaves instanceof Uint32Array?s.leaves:Uint32Array.from(s.leaves||[]),c=k(s.rowHandles||[],a,{...r,separator:n}),f=k(s.columnHandles||[],a,{...r,separator:n}),p=r.maxColumns===void 0?R:r.maxColumns,y=f.paths.length*Math.max(1,l.length),h=new Map;if(p&&y>p)return{rowAxis:c,columnAxis:f,measures:l.map(V=>({colId:V.colId,fn:V.fn})),body:h,rowMargin:h,columnMargin:h,grand:h,columns:y,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${y} columns, above pivot.maxColumns of ${p}. Narrow the pivot columns or raise the limit.`,columns:y,maxColumns:p}};const d=new Map,w=new Map,v=new Map,P=new Map,W=f.buckets.map(V=>new Set(V));for(let V=0;V<f.paths.length;V++){const G=f.buckets[V],_=f.paths[V];for(const T of l)v.set(i(_,T.colId),g(T.handle,G,T.fn,m))}for(let V=0;V<c.paths.length;V++){const G=c.buckets[V],_=c.paths[V];for(const T of l)w.set(i(_,T.colId),g(T.handle,G,T.fn,m));for(let T=0;T<f.paths.length;T++){const S=u(G,f.buckets[T],W[T]);if(S.length===0)continue;const O=f.paths[T];for(const M of l)d.set(t(_,O,M.colId),g(M.handle,S,M.fn,m))}}for(const V of l)P.set(V.colId,g(V.handle,a,V.fn,m));return{rowAxis:c,columnAxis:f,measures:l.map(V=>({colId:V.colId,fn:V.fn})),body:d,rowMargin:w,columnMargin:v,grand:P,columns:y,error:null}}function t(s,r,n){return`${s}\0${r}\0${n}`}function i(s,r){return`${s}\0${r}`}}),_e("packages/core/src/compute/reference.js",function(e,F){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return o}});const E=F("packages/core/src/internal/paths.js").getPath,K=F("packages/core/src/compute/handle.js"),I=K.isMissing,L=K.valueComparator,U=F("packages/core/src/compute/filter.js").testValue,x="",q="\0";function R(s,r){const n=r.includes(".")?E(s,r):s?.[r];return n===void 0?null:n}function j(s,r,n={}){const m=r||[];let l=s.map((a,c)=>c);if(m.length===0)return l;for(let a=m.length-1;a>=0;a--)l=k(s,l,m[a],n);return l}function k(s,r,n,m){const l=n.locale!==void 0?n.locale:m.locale,a=L(l),c=n.descending!==void 0?!!n.descending:n.dir==="desc",f=[],p=[];for(const d of r){const w=R(s[d],n.col);I(w)?p.push(d):f.push(d)}const y=new Map;for(let d=0;d<f.length;d++)y.set(f[d],d);const h=(d,w)=>{const v=R(s[d],n.col),P=R(s[w],n.col);let W;return typeof n.compare=="function"?(W=n.compare(v,P,s[d],s[w],c),c&&(W=-W)):W=c?a(P,v):a(v,P),W!==0?W:y.get(d)-y.get(w)};return f.sort(h),n.nullsFirst?p.concat(f):f.concat(p)}function b(s,r,n={}){const m=[];for(let l=0;l<s.length;l++)u(s[l],r,n,l)&&m.push(l);return m}function u(s,r,n,m){if(!r)return!0;if(Array.isArray(r.conditions)){const l=r.conditions.filter(c=>c!=null);if(l.length===0)return!0;if(r.op==="or")return l.some(c=>u(s,c,n,m));const a=l.every(c=>u(s,c,n,m));return r.op==="not"?!a:a}return r.col===void 0&&typeof n.custom=="function"?!!n.custom(r,s,m):U(R(s,r.col),r,n.locale)}function g(s,r,n,m){const l=n||s.map((p,y)=>y),a=new Map,c=[],f=[];for(const p of l){const y=r.map((w,v)=>{const P=R(s[p],w);return m&&m[v]?m[v](P):P}),h=y.map(w=>w==null?q:String(w)).join(x);let d=a.get(h);d===void 0&&(d=c.length,a.set(h,d),c.push(y),f.push([])),f[d].push(p)}return{keys:c,buckets:f}}function o(s,r,n={}){const m=L(n.locale),l=s.filter(c=>!I(c)),a=l.map(t).filter(c=>c!==null);switch(r){case"count":return s.length;case"countValues":return l.length;case"sum":return a.reduce((c,f)=>c+f,0);case"avg":return l.length===0?null:a.reduce((c,f)=>c+f,0)/l.length;case"min":return l.length===0?null:l.reduce((c,f)=>m(f,c)<0?f:c);case"max":return l.length===0?null:l.reduce((c,f)=>m(f,c)>0?f:c);case"first":return s.length===0?null:i(s[0]);case"last":return s.length===0?null:i(s[s.length-1]);default:return null}}function t(s){if(typeof s=="number")return Number.isNaN(s)?null:s;if(s==null||s===""||typeof s=="boolean")return null;if(s instanceof Date)return s.getTime();const r=Number(s);return Number.isNaN(r)?null:r}function i(s){return s===void 0?null:s}}),_e("packages/core/src/compute/index.js",function(e,F){"use strict";const ie=F("packages/core/src/compute/sort.js");Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return ie.sortColumn}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return ie.sortMulti}}),Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return ie.radixSortFloat64}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return ie.radixSortInt32}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return ie.rankSortDictionary}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return ie.mergeSortComparator}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return ie.collateStringRanks}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return ie.rankSortStrings}});const E=F("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=F("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 I=F("packages/core/src/compute/group.js");Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return I.groupByColumns}}),Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return I.packKeys}});const L=F("packages/core/src/compute/facet.js");Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return L.facet}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return L.computeBounds}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return L.countInto}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return L.bucketOf}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return L.facetKind}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return L.cardinalityOf}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return L.pickGranularity}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return L.floorTo}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return L.advance}}),Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return L.STRATEGIES}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return L.GRANULARITIES}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return L.DEFAULT_BUCKETS}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return L.DEFAULT_CARDINALITY_LIMIT}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return L.QUANTILE_SAMPLE}});const Q=F("packages/core/src/compute/total.js");Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return Q.TOTAL_FNS}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return Q.TOTAL_LABELS}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return Q.totalLabel}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return Q.total}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return Q.collectValues}});const U=F("packages/core/src/compute/pivot.js");Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return U.pivot}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return U.resolvePivotKeys}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return U.pivotKey}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return U.joinPath}}),Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return U.KEY_DELIMITER}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return U.DEFAULT_PATH_SEPARATOR}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return U.DEFAULT_MAX_COLUMNS}});const x=F("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return x.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return x.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return x.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return x.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return x.GRAND_PATH}});const q=F("packages/core/src/compute/reference.js");Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return q.referenceSort}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return q.referenceFilter}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return q.referenceGroup}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return q.referenceTotal}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return q.referencePasses}}),Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return q.referenceValue}});const R=F("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return R.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return R.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return R.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return R.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return R.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return R.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return R.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return R.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return R.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return R.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return R.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return R.isMissing}});const j=F("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=F("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 b=F("packages/core/src/compute/statistics.js");Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return b.MAINTENANCE}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return b.APPROXIMATE}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return b.maintenanceOf}});const u=F("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return u.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return u.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return u.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return u.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return u.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return u.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return u.anomalyCondition}});const g=F("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}})}),_e("packages/core/src/source/rows.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_ROW_HEIGHT",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"KEY_SEP",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"groupPrefixKeys",{enumerable:!0,get:function(){return g}});const E=F("packages/core/src/internal/warn.js").warnOnce,I=F("packages/core/src/internal/predicates.js").isFunction,L=32,Q="\0";function U(o){return new x(o)}class x{#e;#t;constructor(t){this.#e=I(t&&t.rowKey)?t.rowKey:null;const i=t&&t.config?t.config.rowHeight:void 0;this.#t=typeof i=="number"||I(i)?i:L}get keyed(){return this.#e!==null}keyOf(t,i){if(this.#e){const s=this.#e(t);if(s!=null)return String(s)}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`#${i}`}heightOf(t){return I(this.#t)?Number(this.#t(t))||L:this.#t}leaf(t,i,s=0,r=null){const n={key:this.keyOf(t,i),data:t,level:s,parent:r,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:i};return n.height=this.heightOf(n),n}group(t){const i={key:u(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&&(i.totals=t.totals),i.height=this.heightOf(i),i}footer(t){const i={key:`${t.key}${Q}footer`,data:null,level:t.level,parent:t,group:!0,footer:!0,expanded:!1,leafCount:t.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:t.groupColumn,groupValue:t.groupValue,groupPath:t.groupPath,hasChildren:!1,totals:t.totals};return i.height=this.heightOf(i),i}detail(t,i){return{key:`${t.key}${Q}detail`,data:t.data,level:t.level+1,parent:t,group:!1,detail:!0,expanded:!1,leafCount:0,height:i,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:t.key}}grandTotal(t,i){const s={key:`${Q}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:i,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:t};return s.height=this.heightOf(s),s}skeleton(t,i=0,s=!1){const r={key:`${Q}pending${Q}${t}`,data:null,level:i,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:t,selected:!1,physical:null,pending:!0};return s&&(r.loadError=!0),r.height=this.heightOf(r),r}}function q(o,t,i,s){return{key:`${Q}pinned${Q}${i}${Q}${t}`,data:o,level:0,parent:null,group:!1,expanded:!1,leafCount:0,height:s,index:null,selected:!1,physical:null,hasChildren:!1,pinned:i}}function R(o,t){return new Proxy([],{get(i,s,r){if(s==="length")return o();if(typeof s=="string"){const n=Number(s);if(Number.isInteger(n)&&n>=0)return t(n)}return Reflect.get(i,s,r)},has(i,s){if(typeof s=="string"){const r=Number(s);if(Number.isInteger(r)&&r>=0)return r<o()}return Reflect.has(i,s)}})}function j(o){return o==null?"":String(o)}const k="";function b(o){if(o==null)return k;const t=String(o);return t.startsWith(k)?k+t:t}function u(o){const t=o||[];let i="g";for(let s=0;s<t.length;s++)i+=Q+b(t[s]);return i}function g(o){const t=new Array(o.length),i=[];for(let s=0;s<o.length;s++)i.push(o[s]),t[s]=u(i);return t}}),_e("packages/core/src/source/handles.js",function(e,F){"use strict";Object.defineProperty(e,"HandleProvider",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"createHandleProvider",{enumerable:!0,get:function(){return Q}});const E=F("packages/core/src/internal/predicates.js").isFunction,I=F("packages/core/src/internal/warn.js").warnOnce;class L{#e;#t;#n;#r=new Map;#i=0;constructor(x,q,R){this.#e=x,this.#t=q,this.#n=E(R)?R:()=>!1}get store(){const x=this.#e.store;return x&&E(x.column)?x:null}invalidate(){this.#i++}handle(x){const q=this.store;if(q){const b=q.column(x);if(b)return b}const R=this.#r.get(x);if(R&&R.builtAt===this.#i)return R.handle;const j=this.#s(x);if(!j)return;if(q&&this.#n()){I(`source.dropped.${x}`,`column "${x}" 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.#a(j);return this.#r.set(x,{handle:k,builtAt:this.#i}),k}#s(x){const q=this.#e.columns;return q&&E(q.get)?q.get(x):void 0}#a(x){const q=this.#t()||[],R=q.length,j=new Array(R),k=E(x.getValue)?u=>x.getValue(u):u=>u?.[x.field||x.id];for(let u=0;u<R;u++)j[u]=q[u]===void 0?void 0:k(q[u]);const b=this.#i;return{id:x.id,kind:"object",nullable:!1,values:j,presence:null,dict:null,offsets:null,get(u){return j[u]},version:b}}}function Q(U,x,q){return new L(U,x,q)}}),_e("packages/core/src/compute/incremental.js",function(e,F){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return q}});const E=F("packages/core/src/store/columnstore.js").toFloat,K=Object.freeze(["sum","avg","countValues","min","max"]),I=Object.freeze(["float64"]),L=1e15;function Q(R,j){return typeof R!="string"||!K.includes(R)?!1:!!j&&I.includes(j.kind)}function U(R){if(R==null)return null;const j=E(R);return Number.isNaN(j)?null:j}class x{#e;#t=0;#n=0;#r=0;#i=1/0;#s=-1/0;#a=!1;#l=!1;constructor(j){this.#e=j}get valid(){return this.#a&&!this.#l}get fn(){return this.#e}seed(j){this.#o();for(let k=0;k<j.length;k++){const b=U(j[k]);b!==null&&this.#c(b)}this.#a=!0}seedColumn(j,k,b){this.#o();for(let u=0;u<b.length;u++){const g=b[u];if(k&&k(g)===0)continue;const o=j[g];Number.isNaN(o)||this.#c(o)}this.#a=!0}#o(){this.#t=0,this.#n=0,this.#r=0,this.#i=1/0,this.#s=-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.#i&&(this.#i=j),j>this.#s&&(this.#s=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.#a)return!1;const b=U(j),u=U(k);return b===null&&u===null?!0:b!==null&&!Number.isFinite(b)||u!==null&&!Number.isFinite(u)?!1:this.#e==="min"||this.#e==="max"?b===null||u===null?!1:this.#e==="min"?u<this.#i?(this.#i=u,!0):b>this.#i:u>this.#s?(this.#s=u,!0):b<this.#s:Math.abs(this.#t)>L?!1:(b!==null&&this.#u(b),u!==null&&this.#c(u),!0)}value(){switch(this.#e){case"countValues":return this.#r;case"avg":return this.#r?(this.#t+this.#n)/this.#r:null;case"min":return this.#r?this.#i:null;case"max":return this.#r?this.#s:null;default:return this.#t+this.#n}}invalidate(){this.#a=!1}}const q=x}),_e("packages/core/src/source/filterwire.js",function(e,F){"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 I}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"resolveRelativeRange",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"relativeTokenOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"relativeTokenHelp",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"isResolvableRelative",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"resolveRelativeCondition",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"forEachCondition",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"mapConditions",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"normaliseFilterSet",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"buildFilterSet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"wireFilters",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"querySignature",{enumerable:!0,get:function(){return v}});const E=F("packages/core/src/internal/warn.js").warnOnce,K="source.remote.hostFilter",I="source.where.pageRelative";function L(V,G){!Array.isArray(V)||!V.length||E(I,`filters.where (${V.join(", ")}) runs over the rows the ${G} source fetched,`,"not the whole dataset: match counts and totals are page-relative.","Give the predicate a { condition } twin so the engine can narrow the fetch itself.")}function Q(V){const G=(V||{}).config;!G||!G.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 U="source.where.notApplied";function x(V,G){E(`${U}:${V}`,`filters.where("${V}") is registered but the ${G} 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 q="source.where.overThreshold";function R(V,G,_,T){!Array.isArray(V)||!V.length||E(`${q}:${G}`,`filters.where (${V.join(", ")}) is not applied to the ${G} pushdown source:`,_===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${_.toLocaleString()} rows, at or past the whereRowLimit of ${T.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(V){let G=j.get(V);return G||(G=new Intl.DateTimeFormat("en-US",{timeZone:V,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),j.set(V,G)),G}function b(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function u(V,G){const _=k(G).formatToParts(new Date(V)),T={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const S of _)S.type==="year"?T.y=+S.value:S.type==="month"?T.m=+S.value:S.type==="day"?T.d=+S.value:S.type==="hour"?T.h=+S.value%24:S.type==="minute"?T.mi=+S.value:S.type==="second"&&(T.s=+S.value);return T}function g(V,G){const _=u(V,G);return Date.UTC(_.y,_.m-1,_.d,_.h,_.mi,_.s)-Math.floor(V/1e3)*1e3}function o(V,G,_,T){const S=Date.UTC(V,G-1,_),O=S-g(S,T);return S-g(O,T)}function t(V,G,_){const T=new Date(Date.UTC(V.y,V.m-1,V.d+G));return o(T.getUTCFullYear(),T.getUTCMonth()+1,T.getUTCDate(),_)}const i=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function s(V,G){if(typeof V!="string")return null;const _=V.trim().toLowerCase().replace(/[\s_-]+/g,""),T=/^last(\d*|n)days?$/.exec(_);if(T){const S=T[1]==="n"?"":T[1],O=Number(S||G);return!Number.isFinite(O)||O<=0?null:{kind:"lastNDays",n:Math.floor(O)}}switch(_){case"today":return{kind:"today",n:0};case"yesterday":return{kind:"yesterday",n:0};case"thisweek":return{kind:"thisWeek",n:0};case"thismonth":return{kind:"thisMonth",n:0};case"thisquarter":return{kind:"thisQuarter",n:0};case"thisyear":return{kind:"thisYear",n:0};case"quartertodate":case"qtd":return{kind:"quarterToDate",n:0};case"yeartodate":case"ytd":return{kind:"yearToDate",n:0};default:return null}}function r(V,G={}){const _=s(V,G.n);if(!_)return null;const T=G.tz||b(),S=G.now instanceof Date?G.now.getTime():typeof G.now=="number"?G.now:Date.now(),O=u(S,T),M=o(O.y,O.m,O.d,T),A=t(O,1,T);let N=M,$=A;switch(_.kind){case"today":break;case"yesterday":N=t(O,-1,T),$=M;break;case"lastNDays":$=G.includeToday?A:M,N=t(O,G.includeToday?-(_.n-1):-_.n,T);break;case"thisWeek":{const H=Number.isFinite(G.weekStartsOn)?Number(G.weekStartsOn):1,Z=(new Date(Date.UTC(O.y,O.m-1,O.d)).getUTCDay()-H+7)%7;N=t(O,-Z,T),$=t(O,-Z+7,T);break}case"thisMonth":N=o(O.y,O.m,1,T),$=o(O.m===12?O.y+1:O.y,O.m===12?1:O.m+1,1,T);break;case"thisQuarter":case"quarterToDate":{const H=Math.floor((O.m-1)/3)*3+1;N=o(O.y,H,1,T),$=_.kind==="quarterToDate"?A:H===10?o(O.y+1,1,1,T):o(O.y,H+3,1,T);break}case"thisYear":case"yearToDate":N=o(O.y,1,1,T),$=_.kind==="yearToDate"?A:o(O.y+1,1,1,T);break;default:return null}return{from:new Date(N).toISOString(),to:new Date($).toISOString(),bounds:"[)",tz:T,relative:_.kind==="lastNDays"?`last${_.n}Days`:_.kind,n:_.n}}function n(V){if(!V||typeof V!="object")return null;const G=V.value;if(G&&typeof G=="object"&&!Array.isArray(G)&&"relative"in G)return{token:String(G.relative),n:typeof G.n=="number"?G.n:void 0};if(V.op==="relative"&&typeof V.value=="string")return{token:V.value,n:void 0};const _=V.meta;return _&&typeof _.relative=="string"&&V.value===void 0?{token:_.relative,n:typeof _.n=="number"?_.n:void 0}:null}function m(){return`Known tokens: ${i.filter(G=>G!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function l(V){const G=n(V);return G?s(G.token,G.n)!==null:!1}function a(V,G={}){const _=n(V);if(!_)return V;const T=r(_.token,{...G,n:_.n});return T?{...V,type:V.type||"date",op:"between",value:[T.from,T.to],bounds:V.bounds||T.bounds,meta:{...V.meta||{},relative:T.relative,tz:T.tz}}:(E(`source.relative.${_.token}`,`unknown relative date token "${_.token}"; sending the condition unresolved.`,m()),V)}function c(V){return!!V&&typeof V=="object"&&Array.isArray(V.conditions)}function f(V,G){if(V){if(c(V)){for(const _ of V.conditions)f(_,G);return}G(V)}}function p(V,G){if(!V)return null;if(!c(V))return G(V);const _=V;let T=!1;const S=[];for(const O of _.conditions){const M=p(O,G);M!==O&&(T=!0),M&&S.push(M)}return!T&&S.length===_.conditions.length?V:S.length?{..._,conditions:S}:null}function y(V){if(!V)return null;if(!c(V))return V;const G=V,_=[];for(const T of G.conditions){const S=y(T);S&&_.push(S)}return _.length?{op:G.op,conditions:_}:null}function h(V){const G=y(V);return G?c(G)&&G.op==="and"?G:{op:"and",conditions:[G]}:null}function d(V){const G=(V||[]).filter(Boolean);return G.length?{op:"and",conditions:G}:null}function w(V,G={}){const _=p(V,T=>a(T,G));return h(_)}function v(V){const G=P(V.filters??null);return JSON.stringify([G,V.sort??null,V.quick??"",V.groupBy??null,V.pivotBy??null,W(V.context)])}function P(V){if(!V)return null;if(c(V)){const T=V;return{op:T.op,conditions:T.conditions.map(P)}}const G=V,_=G.meta&&typeof G.meta.relative=="string"?G.meta.relative:n(G)?.token;return{col:G.col,op:G.op,bounds:G.bounds??null,caseSensitive:G.caseSensitive??!1,value:_?`rel:${_}`:G.value??null}}function W(V){if(V==null)return null;try{return JSON.parse(JSON.stringify(V))}catch{return E("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),_e("packages/core/src/source/tree.js",function(e,F){"use strict";Object.defineProperty(e,"SYNTHETIC",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"buildFromPath",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return q}}),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 b}}),Object.defineProperty(e,"indexTree",{enumerable:!0,get:function(){return u}});const E=F("packages/core/src/internal/predicates.js").isFunction,I=F("packages/core/src/internal/warn.js").warnOnce,L="",Q="\0tree:";function U(g,o){return{physical:g,key:o,level:0,children:[],value:void 0}}function x(g,o){const t=[],i=new Map;for(let s=0;s<g.length;s++){const r=g[s],n=o.pathOf(r),m=Array.isArray(n)?n.map(a=>String(a)):[];if(!m.length){const a=U(r,o.keyOf(r));t.push(a);continue}let l=null;for(let a=0;a<m.length;a++){const c=m.slice(0,a+1).join(L),f=a===m.length-1;let p=i.get(c);p&&f&&p.physical===-1&&(p.physical=r,p.key=o.keyOf(r)),p||(p=U(f?r:-1,f?o.keyOf(r):Q+c),p.level=a,p.value=m[a],i.set(c,p),l?l.children.push(p):t.push(p)),l=p}}return{roots:t,nodes:i}}function q(g,o){const t=new Map,i=[];for(let m=0;m<g.length;m++){const l=g[m],a=o.keyOf(l),c=U(l,a);t.set(a,c);const f=o.parentOf(l);f!=null&&f!==""&&i.push({node:c,parent:String(f)})}let s=null;const r=new Map;for(const{node:m,parent:l}of i){const a=t.get(l);if(a){r.set(m.key,a);continue}o.orphans&&o.orphans!=="root"&&(s||(s=U(-1,`${Q}orphans`),s.value=o.orphans),r.set(m.key,s))}const n=[];for(const m of t.values()){const l=r.get(m.key);l?l.children.push(m):n.push(m)}return s&&s.children.length&&n.push(s),{roots:R(n,t,o.orphans,s),nodes:t}}function R(g,o,t,i){const s=new Set,r=[...g];for(;r.length;){const c=r.pop();if(!s.has(c.key)){s.add(c.key);for(const f of c.children)r.push(f)}}const n=[];for(const c of o.values())s.has(c.key)||n.push(c);if(!n.length)return g;const m=!!t&&t!=="root";I("tree.cycle",`tree.parentKey produced ${n.length} row(s) inside a parent cycle; `+(m?`they are shown under "${t}".`:"they are shown at the root."));for(const c of n)c.children=c.children.filter(f=>s.has(f.key));if(!m)return[...g,...n];let l=i;const a=[...g];return l||(l=U(-1,`${Q}orphans`),l.value=t,a.push(l)),l.children.push(...n),a}function j(g){let o=0;const t=(i,s)=>{for(const r of i)r.level=s,s>o&&(o=s),r.children.length&&t(r.children,s+1)};return t(g,0),o}function k(g,o){if(!g||typeof g!="object")return null;const t=g.path,i=g.parentKey,s=E(g.hasChildren)?r=>!!g.hasChildren(o.dataAt(r)):null;if(E(t))return{mode:"path",pathOf:r=>t(o.dataAt(r)),keyOf:o.keyOf,declaresChildren:s};if(i!=null){const r=E(i)?i:n=>n?.[i];return{mode:"parentKey",parentOf:n=>r(o.dataAt(n)),keyOf:o.keyOf,orphans:g.orphans||"root",declaresChildren:s}}return I("tree.shape","tree is configured with neither `path` nor `parentKey`; rows stay flat."),null}function b(g,o){const t=o.mode==="path"?x(g,o):q(g,o),i=j(t.roots);return{...t,depth:i}}function u(g,o){const t=new Map,i=s=>{for(let r=0;r<s.length;r++){const n=s[r];if(n.physical>=0){const m=o?o(n.physical):!1,l=m&&n.children.length===0;t.set(n.physical,{level:n.level,posinset:r+1,setsize:s.length,hasChildren:n.children.length>0||m,lazy:l})}n.children.length&&i(n.children)}};return i(g),t}}),_e("packages/core/src/source/settle.js",function(e,F){"use strict";Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"ARRIVAL_REASONS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"isArrival",{enumerable:!0,get:function(){return I}});const ie=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function E(L){const Q=L&&typeof L=="object"?L.reason:null;return typeof Q=="string"&&ie.includes(Q)}const K=Object.freeze(["page","total"]);function I(L){const Q=L&&typeof L=="object"?L.reason:null;return typeof Q=="string"&&K.includes(Q)}}),_e("packages/core/src/source/memory.js",function(e,F){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"quickMatcher",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"MemorySource",{enumerable:!0,get:function(){return Z}});const E=F("packages/core/src/internal/lru.js").Lru,K=F("packages/core/src/internal/warn.js"),I=K.warnOnce,L=K.fail,U=F("packages/core/src/internal/predicates.js").isFunction,q=F("packages/core/src/internal/compare.js").defaultCompare,j=F("packages/core/src/internal/merge.js").mergeRow,k=F("packages/core/src/source/rows.js"),b=k.createRowFactory,u=k.groupKey,g=k.groupPathElement,o=k.groupPrefixKeys,t=k.lazyRowView,s=F("packages/core/src/source/handles.js").createHandleProvider,r=F("packages/core/src/compute/incremental.js"),n=r.RunningTotal,m=r.isIncremental,a=F("packages/core/src/compute/handle.js").presenceReader,c=F("packages/core/src/source/filterwire.js"),f=c.querySignature,p=c.mapConditions,y=c.resolveRelativeCondition,h=F("packages/core/src/source/tree.js"),d=h.buildTree,w=h.resolveTree,v=h.indexTree,P=F("packages/core/src/source/settle.js"),W=P.PIPELINE_SETTLE_REASONS,V=P.isPipelineSettle,G=Object.freeze(["filter","sort","group","total","pivot","flatten"]),_=Object.freeze([]);function T(J,D){if(!J)return null;const te=D==="grand"?J.grandTotal:J.groupTotal;return te??J.total}function S(J){return!!J&&!J.running}function O(J){if(J)return J.value&&U(J.value.compare)?J.value.compare:U(J.compare)?J.compare:void 0}function M(J){const D=J&&J.dataType;return!D||!U(D.items)?null:{items:D.items,type:J.itemType&&J.itemType.name||"text"}}function A(J){return!!J&&(typeof J=="object"||typeof J=="function")&&U(J.then)}const N=new Uint32Array(0),$=4096;function H(J,D){return new Z(J,D)}function Y(J,D){if(D==="regex")try{const te=new RegExp(J,"iu");return z=>te.test(z)}catch{return te=>te.includes(J)}if(D==="fuzzy"){const te=[...J].filter(z=>z!==" ");return te.length?z=>{let X=0;for(let ne=0;ne<z.length&&X<te.length;ne++)z[ne]===te[X]&&X++;return X===te.length}:()=>!0}if(D==="words"){const te=J.split(/\s+/).filter(Boolean);return te.length?z=>te.every(X=>z.includes(X)):()=>!0}return te=>te.includes(J)}class Z{mode="memory";#e;#t;#n;#r=!1;#i=null;#s;#a;#l=new Map;#o=!1;#c=0;#u=0;#f=new Map;#d=new Map;#h;#p=null;#m=Z.#g();static#g(){return{slots:[],groupHeadings:_,unnumbered:_,pivot:null,inlineLeaves:null,matchCount:0,grand:null,grandLeaves:0,groupLeaves:null}}#b=new Map;#y=null;#O=new Map;#w=-1;#A=[];#v=new Map;#P=-1;#S=[];#C=null;#E=null;#T=null;#M=null;#N=null;#R=null;#D=null;#K=null;#Y=Symbol("unset");#x=new Map;#H=null;get#F(){return this.#m.slots}set#F(D){this.#m.slots=D}get#X(){return this.#m.inlineLeaves}set#X(D){this.#m.inlineLeaves=D}get#V(){return this.#m.groupHeadings}set#V(D){this.#m.groupHeadings=D}get#B(){return this.#m.unnumbered}set#B(D){this.#m.unnumbered=D}get#W(){return this.#m.pivot}set#W(D){this.#m.pivot=D}constructor(D,te){this.#t=D||{mode:"memory"},this.#e=te||{};const z=this.#e.config||{};this.#n=this.#t.rows||z.rows||[],this.#s=b(this.#e),this.#a=s(this.#e,()=>this.#n,()=>this.#r),this.#h=new E(Number(z.rowCacheSize)||$);for(const X of G)this.#l.set(X,{key:null,result:null,id:0,computed:!1})}count(){this.#U();const D=this.#ge();return D?D.length:this.#F.length}#ge(){const D=Number(this.#z("pageSize",0))||0;if(D<=0)return null;const te=this.#F.length,z=Math.max(1,Math.ceil(te/D)),ne=Math.min(Math.max(0,Number(this.#z("page",0))||0),z-1)*D;return{offset:ne,length:Math.max(0,Math.min(D,te-ne))}}pageInfo(){this.#U();const D=Number(this.#z("pageSize",0))||0,te=this.#F.length;if(D<=0)return{page:0,pageSize:0,total:te,pageCount:1};const z=Math.max(1,Math.ceil(te/D));return{page:Math.min(Math.max(0,Number(this.#z("page",0))||0),z-1),pageSize:D,total:te,pageCount:z}}totalCount(){return this.#et().length}matchCount(){return this.#U(),this.#m.matchCount}at(D){this.#U();const te=this.#ge();if(te)return D<0||D>=te.length?void 0:this.#_e(te.offset+D,D);if(!(D<0||D>=this.#F.length))return this.#_e(D,D)}byKey(D){this.#U(),this.#p||this.#Ae();const te=this.#p.get(D);if(te!==void 0)return this.#ce(te);for(let z=0;z<this.#F.length;z++){const X=this.#F[z];if(typeof X!="number"&&X&&X.key===D)return this.#_e(z)}}loaded(D){return D>=0&&D<this.count()}hint(D,te){}display(){return this.#U(),this.#H||(this.#H=this.#$e()),this.#H}invalidateQuickText(){this.#x.clear(),this.invalidate("filter")}invalidate(D){const te=G.indexOf(D);te<0&&L(`unknown pipeline stage "${D}"; expected one of ${G.join(", ")}`);for(let z=te;z<G.length;z++){const X=this.#l.get(G[z]);X.key=null,X.computed=!1}this.#H=null}apply(D){const te=[],z={added:[],updated:[],removed:[],rejected:te};if(!D)return z;let X=!1;const ne=new Set;if(D.remove&&D.remove.length)for(const se of D.remove){const ue=this.#Ce(se);if(ue===void 0){te.push({operation:"remove",id:this.#He(se),reason:"unknown-id"});continue}z.removed.push(this.#s.keyOf(this.#r?this.#Qe(ue):this.#n[ue],ue)),this.#r||(this.#n[ue]=void 0),this.#h.delete(ue),this.#x.delete(ue),X=!0}if(D.update&&D.update.length){const se=this.#O.size||this.#at()?this.#Ke():null,ue=this.#v.size?this.#ht():null,ge=ue&&ue.length?this.#Ke():null;for(const Oe of D.update){const Pe=this.#Ce(Oe);if(Pe===void 0){te.push({operation:"update",id:this.#xe(Oe),reason:"unknown-id"});continue}const Ie=this.#r?this.#i&&this.#i.has(Pe)?this.#i.get(Pe):this.#Qe(Pe):this.#n[Pe],xe=j(Ie,Oe);for(const ye of this.#le(Ie,xe))ne.add(ye);if(this.#r||(this.#n[Pe]=xe),se&&this.#Je(se,Pe,Ie,xe),ge&&this.#We(ue,ge,Pe,Ie,xe),this.#p){const ye=this.#s.keyOf(Ie,Pe),re=this.#s.keyOf(xe,Pe);ye!==re&&(this.#p.delete(ye),this.#p.set(re,Pe))}this.#h.delete(Pe),this.#x.delete(Pe),z.updated.push(this.#ce(Pe))}}if(D.add&&D.add.length&&this.#r){typeof D.at=="number"&&D.at<this.#j()&&(this.#h.clear(),this.#x.clear()),this.#p=null;for(const se of D.add){const ue=this.#ae(this.#xe(se));ue!==void 0&&z.added.push(this.#ce(ue))}X=!0}else if(D.add&&D.add.length){let se=typeof D.at=="number"?D.at:this.#n.length;if(se<this.#n.length){let Oe=0;for(let Pe=0;Pe<this.#n.length;Pe++)this.#n[Pe]!==void 0&&Oe++;if(Oe!==this.#n.length){let Pe=0;for(let Ie=0;Ie<this.#n.length;Ie++)this.#n[Ie]!==void 0&&(this.#n[Pe++]=this.#n[Ie]);this.#n.length=Pe,this.#p=null,this.#h.clear(),this.#x.clear()}}const ue=this.#n.length;se=Math.max(0,se);let ge=D.add===this.#n?D.add.slice():D.add;if(this.#s.keyed){const Oe=[];for(const Pe of ge){const Ie=this.#xe(Pe);if(this.#Ce(Ie)!==void 0){te.push({operation:"add",id:Ie,reason:"duplicate-id"});continue}Oe.push(Pe)}Oe.length!==ge.length&&(ge=Oe)}if(!ge.length)return z;if(se>=ue)for(let Oe=0;Oe<ge.length;Oe++)this.#n.push(ge[Oe]);else this.#n.splice(se,0,...ge),this.#h.clear(),this.#x.clear();for(let Oe=0;Oe<ge.length;Oe++)z.added.push(this.#ce(se>=ue?ue+Oe:se+Oe));X=!0}return this.#c++,X&&(this.#p=null,this.#lt()),this.#a.invalidate(),this.#H=null,X||this.#ne(ne)?(this.#u++,this.invalidate("filter")):this.invalidate("total"),this.#bt("rows:changed",{companion:!0,added:z.added.length,updated:z.updated.length,removed:z.removed.length}),this.#i=null,z}groupHeadingsAt(D){this.#U();const te=this.#V;if(!te.length||!Number.isInteger(D)||D<0)return _;let z=0,X=te.length-1,ne=-1;for(;z<=X;){const ue=z+X>>1;te[ue].at<=D?(ne=ue,z=ue+1):X=ue-1}if(ne<0)return _;const se=[];for(let ue=te[ne].row;ue;ue=ue.parent)se.push(ue);return se.reverse(),se}unnumberedRowCount(D){this.#U();const te=this.#B;if(!te.length||!Number.isInteger(D)||D<0)return 0;let z=0,X=te.length-1,ne=-1;for(;z<=X;){const se=z+X>>1;te[se].at<=D?(ne=se,z=se+1):X=se-1}return ne+1}moveRow(D,te){if(this.#r)return I("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 z=this.#n;if(!Number.isInteger(D)||!Number.isInteger(te))return!1;let X=0;for(let ue=0;ue<z.length;ue++)z[ue]!==void 0&&X++;if(D<0||D>=X)return!1;const ne=Math.max(0,Math.min(X-1,te));if(ne===D)return!1;if(X!==z.length){let ue=0;for(let ge=0;ge<z.length;ge++)z[ge]!==void 0&&(z[ue++]=z[ge]);z.length=ue}const[se]=z.splice(D,1);return z.splice(ne,0,se),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#x.clear(),this.#lt(),this.#a.invalidate(),this.#H=null,this.invalidate("filter"),this.#bt("rows:changed",{companion:!0,added:0,updated:0,removed:0,moved:1}),!0}reload(D){this.#ue(),this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#lt(),this.#a.invalidate(),this.invalidate("filter"),this.#bt("model:changed",{reason:"reload"})}destroy(){this.#ue(),this.#h.clear(),this.#x.clear(),this.#p=null,this.#F=[],this.#X=null,this.#H=null,this.#lt();for(const D of G)this.#l.set(D,{key:null,result:null,id:0,computed:!1})}#se(D){const te=this.#e.sortPending;U(te)&&te(D)}#ue(){this.#b.has("sort")&&this.#se(!1);for(const{controller:D}of this.#b.values())try{D.abort()}catch{}this.#b.clear()}setRows(D){this.#n=D||[],this.#r=!1,this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#lt(),this.#a.invalidate(),this.invalidate("filter")}notePriorRows(D){this.#i=D||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#x.clear(),this.#a.invalidate()}data(){if(!this.#r)return this.#n;const D=this.#e.store;if(!D||!U(D.source))return this.#n;const te=D.physical||0,z=new Array(te);for(let X=0;X<te;X++)z[X]=D.live&&!D.live(X)?void 0:D.source(X);return z}#Me(){const D=this.#z("detail",null);return!D||!U(D.isOpen)||D.inline===!1?null:D}#fe(){const D=(this.#e.config||{}).tree;return this.#Y!==D&&(this.#Y=D,this.#K=w(D,{dataAt:te=>this.#Qe(te),keyOf:te=>this.#s.keyOf(this.#Qe(te),te)})),this.#K}#oe(){return(this.#e.config||{}).grandTotalRow==="bottom"}grandTotalRow(){if(!this.#oe())return null;this.#U();const D=this.#m.grand;return D?this.#s.grandTotal(D,this.#te(this.#m.grandLeaves)):null}pivot(){return this.#U(),this.#W}pivotMatrix(){this.#U();const D=this.#m.groupLeaves,te=(this.#e.compute||{}).pivotMatrix;if(!U(te))return null;const z=this.#z("groupBy",[]),X=this.#z("pivotBy",[]);if(!z.length&&!X.length)return I("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 ne=this.#Ke().map(ue=>({colId:ue.id,handle:this.#a.handle(ue.id),fn:T(ue,"group")})).filter(ue=>ue.handle&&ue.fn),se=this.#e.config||{};return te({rowHandles:z.map(ue=>this.#a.handle(ue)).filter(Boolean),columnHandles:X.map(ue=>this.#a.handle(ue)).filter(Boolean),measures:ne,leaves:D||new Uint32Array(0),opts:{locale:se.locale,separator:(se.pivot||{}).separator,maxColumns:(se.pivot||{}).maxColumns}})}keysForLeaves(D){const te=[];if(!D)return te;for(let z=0;z<D.length;z++){const X=this.#ce(D[z]);X&&X.key!=null&&te.push(String(X.key))}return te}leavesOf(D){this.#U();const te=this.#l.get("group"),z=te&&te.result;if(!z||!z.nodes)return[];const X=z.nodes.get(D);if(!X)return[];const ne=[],se=ue=>{const ge=ue.row&&ue.row.children;if(ge&&ge.length){for(const Oe of ge){const Pe=z.nodes.get(Oe.key);Pe&&se(Pe)}return}if(ue.leaves)for(let Oe=0;Oe<ue.leaves.length;Oe++)ne.push(this.#ce(ue.leaves[Oe]))};return se(X),ne}#He(D){return typeof D=="string"?D:this.#xe(D)}#xe(D){try{return this.#s.keyOf(D,-1)}catch{return"(unkeyed)"}}#Ce(D){if(typeof D=="string")return this.#ae(D);if(this.#s.keyed){const z=this.#s.keyOf(D,-1),X=this.#ae(z);if(X!==void 0)return X}if(this.#r)return;const te=this.#n.indexOf(D);return te>=0?te:void 0}#ae(D){return this.#p||this.#Ae(),this.#p.get(D)}#Ae(){this.#p=new Map;const D=this.#j(),te=this.#e.store,z=te&&U(te.live)?X=>te.live(X):null;for(let X=0;X<D;X++){if(z&&!z(X))continue;const ne=this.#Qe(X);ne!==void 0&&this.#p.set(this.#s.keyOf(ne,X),X)}}#le(D,te){const z=[];for(const X of this.#G())this.#Fe(X)&&this.#Z(X,D,te,new Set)&&z.push(X);return z}#Z(D,te,z,X){if(X.has(D))return!1;X.add(D);const ne=this.#Fe(D);if(!ne)return!1;const se=ne.value&&ne.value.deps;return Array.isArray(se)&&se.length?se.some(ue=>this.#Z(String(ue),te,z,X)):U(ne.getValue)?!Object.is(ne.getValue(te),ne.getValue(z)):!1}#G(){const D=new Set;for(const z of this.#z("sort",[]))D.add(z.col);for(const z of this.#z("groupBy",[]))D.add(z);const te=z=>{if(z){if(Array.isArray(z.conditions)){z.conditions.forEach(te);return}z.col&&D.add(z.col)}};return te(this.#z("filters",null)),[...D]}#ne(D){if(!D.size)return!1;if(this.#z("quick",""))return!0;for(const te of this.#G())if(D.has(te))return!0;return!1}#U(){if(!this.#o){this.#o=!0;try{this.#Ee()}finally{this.#o=!1}}}pipelineRunning(){return this.#o}#Ee(){const D=this.#de("filter",()=>this.#$(),()=>this.#Ve()),te=this.#re(D),z=this.#de("group",()=>this.#I(),()=>this.#Ie(te)),X=this.#de("total",()=>this.#ke(),()=>this.#qe(z));this.#de("pivot",()=>this.#ee(),()=>this.#Ge(z)),this.#de("flatten",()=>this.#Le(),()=>this.#kt(z)),this.#ye(z,X)}#re(D){const te=this.#l.get("sort"),z=this.#_();if(te.computed&&te.key===z&&!this.#b.has("sort"))return te.result;const X=this.#b.get("sort");return X&&X.key===z?te.result:te.result&&this.#Te(D)?(this.#we(D,z),te.result):this.#de("sort",()=>z,()=>this.#k(D))}#pe(){if(this.#y===null){const D=this.#e.pipelineWorker,te=U(D)?D():null;this.#y=te||!1}return this.#y||null}#be(){const D=this.#z("sort",[]);if(!Array.isArray(D)||!D.length)return null;const te=(this.#e.config||{}).locale,z=[],X=[];for(const ne of D){const se=this.#Fe(ne.col);if(se&&se.running)continue;if(se&&se.value&&U(se.value.compare))return null;const ue=this.#a.handle(ne.col);if(!ue)return null;z.push({col:ne.col,descending:ne.dir==="desc",nullsFirst:!!ne.nullsFirst,locale:te}),X.push(ue)}return z.length?{entries:z,handles:X,locale:te}:null}#Te(D){if(this.#he())return!1;const te=this.#pe();if(!te)return!1;const z=Number(te.threshold);return Number.isFinite(z)&&D.length<z?!1:!!this.#be()}#we(D,te){const z=this.#pe(),X=z&&this.#be();if(!X){this.#de("sort",()=>te,()=>this.#k(D));return}const ne=new AbortController;this.#b.set("sort",{key:te,controller:ne});const se=X.entries.length===1?z.sortColumn(X.handles[0],D,{descending:X.entries[0].descending,nullsFirst:X.entries[0].nullsFirst,locale:X.locale,signal:ne.signal,key:"sort"}):z.sortMulti(X.handles,X.entries.map((ue,ge)=>({...ue,handle:X.handles[ge]})),D,{signal:ne.signal,key:"sort"});if(!A(se)){this.#b.delete("sort"),this.#de("sort",()=>te,()=>se),this.#se(!1);return}this.#se(!0),se.then(ue=>this.#ve(te,ue),ue=>this.#Se("sort",te,ue))}#ve(D,te){const z=this.#b.get("sort");if(!(!z||z.key!==D)){if(this.#_()!==D){this.#b.delete("sort"),this.#se(!1);return}this.#b.delete("sort"),this.#de("sort",()=>D,()=>te),this.#H=null,this.#U(),this.#bt("model:changed",{reason:W[0]}),this.#se(!1)}}#Se(D,te,z){const X=this.#b.get(D);if(!(!X||X.key!==te)){if(this.#b.delete(D),z&&z.name==="AbortError"){D==="sort"&&this.#se(!1);return}if(D==="sort"&&this.#_()===te){const ne=this.#de("filter",()=>this.#$(),()=>this.#Ve());this.#de("sort",()=>te,()=>this.#k(ne)),this.#H=null,this.#U(),I("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",z),this.#bt("model:changed",{reason:W[1]})}D==="sort"&&this.#se(!1)}}#ye(D,te){const z=D&&D.leaves?D.leaves.length:this.#m.slots.length;this.#m.matchCount=z,this.#m.grand=te&&te.grand||null,this.#m.grandLeaves=D&&D.leaves?D.leaves.length:0,this.#m.groupLeaves=D&&D.leaves?D.leaves:null}#de(D,te,z){const X=this.#l.get(D),ne=te();return X.computed&&X.key===ne||(X.result=z(),X.key=ne,X.computed=!0,X.id++,D==="flatten"&&(this.#H=null)),X.result}#J(D){return this.#l.get(D).id}#$(){const D=(this.#e.config||{}).hostFilter,te=D&&U(D.active)&&D.active()?1:0,z=this.#z("where",null),X=z?z.version:0,ne=this.#it("filter.sig",`${this.#St()}`,()=>f({filters:this.#z("filters",null),quick:this.#z("quick",""),quickMode:this.#z("quickMode","contains")}));return`${this.#u}|${ne}|${te}|${X}`}#_(){const D=this.#he();return`${this.#J("filter")}|${JSON.stringify(this.#z("sort",[]))}`+(D?`|manual:${D.version}`:"")}#he(){const D=this.#z("rowOrder",null);return D&&Array.isArray(D.keys)?D:null}#ie(D,te){this.#p||this.#Ae();const z=this.#p,X=this.#j(),ne=te.keys.length,se=new Float64Array(X);for(let ue=0;ue<X;ue++)se[ue]=ne+ue;for(let ue=0;ue<ne;ue++){const ge=z.get(te.keys[ue]);ge!==void 0&&(se[ge]=ue)}return Uint32Array.from(D).sort((ue,ge)=>se[ue]-se[ge])}orderedKeys(){this.#p||this.#Ae();const D=this.#p,te=new Map;for(const[ue,ge]of D)te.set(ge,ue);const z=Uint32Array.from([...te.keys()]).sort(),X=this.#he(),ne=X?this.#ie(z,X):this.#k(z),se=new Array(ne.length);for(let ue=0;ue<ne.length;ue++)se[ue]=te.get(ne[ue]);return se}#I(){const D=this.#z("pivotBy",[]).length>0?"p":"u";return`${this.#J("sort")}|${JSON.stringify(this.#z("groupBy",[]))}|${D}`}#ke(){const D=this.#rt()?"f":"a",te=(this.#e.config||{}).totalOnlyChangedColumns?"n":"w";return`${this.#J("group")}|${JSON.stringify(this.#z("totals",[]))}|${D}${te}|${this.#c}`}#ee(){return`${this.#J("group")}|${JSON.stringify(this.#z("pivotBy",[]))}`}#Le(){const te=this.#je()||!this.#oe()?this.#J("total"):"x",z=`${this.#St()}`,X=this.#it("flatten.keys",z,()=>{const se=this.#z("expanded",null);return se?[...se].sort().join(""):"*"}),ne=this.#it("flatten.detail",z,()=>{const se=this.#z("detail",null);return se&&U(se.signature)?se.signature():""});return`${te}|${this.#J("pivot")}|${X}|${ne}`}#je(){const D=this.#z("groupBy",[]);return Array.isArray(D)&&D.length>0}stageState(){const D=[];for(const[te,z]of this.#l){const X=z.result;D.push({stage:te,materialised:!!z.computed,bytes:X&&typeof X.byteLength=="number"?X.byteLength:null,rows:X&&typeof X.length=="number"?X.length:null,rebuilds:z.id})}return D}facetIndices(D){return this.#Ve(D||null)}facetRows(D){const te=this.facetIndices(D),z=[];for(let X=0;X<te.length;X++){const ne=this.#ce(te[X]);ne&&z.push(ne)}return z}invalidateRows(){this.#h.clear(),this.#x.clear(),this.#H=null}invalidateHandles(){this.#a.invalidate()}rows(){return this.#n}unfilteredIndices(){return this.#et()}filteredIndices(){const D=this.#l.get("filter");if(D&&D.computed&&D.key===this.#$())return D.result||this.#et();this.#U();const te=this.#l.get("filter");return(te&&te.computed?te.result:null)||this.#et()}unfilteredRows(){const D=this.#et(),te=[];for(let z=0;z<D.length;z++){const X=this.#ce(D[z]);X&&te.push(X)}return te}#Ve(D=null){const te=this.#et(),z=this.#z("filters",null),X=D?this.#ft("pruneColumn")(z,D):z,ne=this.#mt(X),se=String(this.#z("quick","")||"").trim().toLowerCase(),ue=se?Y(se,String(this.#z("quickMode","contains")||"contains")):null,ge=(this.#e.config||{}).hostFilter,Oe=!!(ge&&U(ge.active)&&ge.active()),Pe=this.#z("where",null),Ie=!!(Pe&&Pe.active);if(!ne&&!se&&!Oe&&!Ie)return te;let xe=null;ne&&(xe=this.#ft("evaluateFilters")(ne,{handle:oe=>this.#a.handle(oe),count:this.#j(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:oe=>M(this.#Fe(oe)),typeOf:oe=>{const ce=this.#Fe(oe);return ce?ce.type:void 0}}));const ye=new Uint32Array(te.length);let re=0;for(let fe=0;fe<te.length;fe++){const oe=te[fe];if(!(xe&&!xe[oe])&&!(ue&&!this.#Be(oe,ue))){if(Oe||Ie){const ce=this.#ce(oe);if(Oe&&!ge.passes(ce)||Ie&&!Pe.passes(ce.data,ce.key))continue}ye[re++]=oe}}if(xe){const fe=(this.#e.compute||{}).releaseMask;U(fe)&&fe({pool:this.#e.pool},xe)}return ye.subarray(0,re)}handleFor(D){return this.#a.handle(D)}#k(D){const te=this.#he();if(te)return this.#ie(D,te);const z=this.#z("sort",[]).filter(se=>{const ue=this.#Fe(se.col);return!ue||!ue.running?!0:(I(`source.sort.running.${se.col}`,`sort ignores "${se.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(!z.length)return D;const X=(this.#e.config||{}).locale;if(z.length===1){const se=z[0],ue=this.#a.handle(se.col);if(!ue)return I(`source.sort.${se.col}`,`sort ignores unknown column "${se.col}".`),D;const ge=this.#Fe(se.col);return this.#ft("sortColumn")(ue,D,{descending:se.dir==="desc",nullsFirst:se.nullsFirst,locale:X,compare:O(ge)})}const ne=[];for(const se of z){const ue=this.#a.handle(se.col);if(!ue){I(`source.sort.${se.col}`,`sort ignores unknown column "${se.col}".`);continue}ne.push({handle:ue,descending:se.dir==="desc",nullsFirst:se.nullsFirst,locale:X,compare:O(this.#Fe(se.col))})}return ne.length?this.#ft("sortMulti")(ne.map(se=>se.handle),ne,D):D}#Ie(D){const te=this.#z("groupBy",[]),z=this.#fe();if(z&&!te.length){const fe=d(D,z);return this.#R=v(fe.roots,z.declaresChildren),{roots:null,leaves:D,nodes:new Map,tree:fe}}if(this.#R=null,z&&te.length&&I("tree.grouped","grouping is active on a grid configured with `tree`; the grouping wins and the hierarchy is not shown."),!te.length)return{roots:null,leaves:D,nodes:new Map};const X=(this.#e.config||{}).timeZone,ne=[],se=[];let ue=!1;for(const fe of te){const oe=this.#a.handle(fe);if(!oe){I(`source.group.${fe}`,`grouping ignores unknown column "${fe}".`);continue}ne.push(oe);const ce=this.#Fe(fe),de=ce&&ce.dataType;if(de&&U(de.groupProjector)){const ve=ce.typeOptions&&ce.typeOptions.timeZone||X||void 0,ke=de.groupProjector(ce,ve);se.push(ke||null),ke&&(ue=!0)}else se.push(null)}if(!ne.length)return{roots:null,leaves:D,nodes:new Map};const{keys:ge,buckets:Oe}=this.#ft("groupByColumns")(ne,D,{locale:(this.#e.config||{}).locale,project:ue?se:void 0}),Pe=this.#z("pivotBy",[]).length>0,Ie=[],xe=new Map;for(let fe=0;fe<Oe.length;fe++){const oe=ge[fe];let ce=null;const de=[];for(let ve=0;ve<oe.length;ve++){de.push(g(oe[ve]));const ke=u(de),Ce=ve===oe.length-1;let Le=xe.get(ke);if(!Le){const we=this.#s.group({path:[...de],column:te[ve],value:oe[ve],level:ve,parent:ce,expanded:Pe&&Ce?!1:this.#gt(ke,{key:ke,column:te[ve],value:oe[ve],level:ve,path:[...de]}),hasChildren:!(Pe&&Ce)});Le={row:we,leaves:null},xe.set(ke,Le),ce?ce.children.push(we):Ie.push(we)}Le.row.leafCount+=Oe[fe].length,ve===oe.length-1&&(Le.leaves=Oe[fe]),ce=Le.row}}const ye=this.#z("sort",[])||[],re=(fe,oe)=>{if(!fe||fe.length<2){if(fe)for(const ke of fe)re(ke.children,oe+1);return}const ce=te[oe],de=ye.find(ke=>ke.col===ce),ve=de&&de.dir==="desc"?-1:1;fe.sort((ke,Ce)=>ve*q(ke.groupValue,Ce.groupValue));for(const ke of fe)re(ke.children,oe+1)};return re(Ie,0),{roots:Ie,leaves:D,nodes:xe,keys:ge,buckets:Oe}}#Ye(D,te){const z=new Map,X=new Map,ne=se=>{const ue=se.physical>=0?[se.physical]:[];for(const ge of se.children)ue.push(...ne(ge));if(se.children.length){const ge=this.#Xe(te,Uint32Array.from(ue),null);se.physical>=0?z.set(se.physical,ge):X.set(se.key,ge)}return ue};for(const se of D.roots)ne(se);return{byPhysical:z,byKey:X}}#qe(D){const te=this.#Ke();if(!te.length)return this.#E=null,this.#T=null,{grand:null};const z={id:this.#J("group"),columns:te.map(ye=>ye.id).join("")},X=this.#E&&this.#E.id===z.id&&this.#E.columns===z.columns,ne=this.#at()&&X?this.#C:null,se=ne?te.filter(ye=>ne.has(ye.id)):te,ue=X?this.#T:null,ge=this.#rt()?null:this.#Tt(),Oe=this.#Pe(te),Pe=ye=>{const re=D.nodes.get(ye.key);let fe=re&&re.leaves?re.leaves:null;if(ye.children&&ye.children.length){const de=ye.children.map(Pe);let ve=0;for(const Le of de)ve+=Le.length;const ke=new Uint32Array(ve);let Ce=0;for(const Le of de)ke.set(Le,Ce),Ce+=Le.length;fe=ke}fe=fe||new Uint32Array(0);const oe=ge?ge.get(ye.key)||N:fe,ce=this.#Ze(ye,ne?se:te,oe,Oe);return ye.totals=ne?{...ye.totals,...ce}:ce,fe};if(D.roots&&se.length)for(const ye of D.roots)Pe(ye);if(this.#D=D.tree?this.#Ye(D.tree,te):null,this.#E=z,this.#C=this.#at()?new Set:null,!(this.#e.config||{}).grandTotalRow)return this.#A.length=0,this.#T=null,{grand:null};const xe=ge?this.#st():D.leaves;return this.#T=this.#Oe(te,xe,ne,ue),{grand:this.#T}}#Oe(D,te,z,X){const ne={},se=this.#J("group");se!==this.#w&&(this.#ct(),this.#w=se);const ue=this.#A;this.#A=[];for(const ge of D){if(!S(ge))continue;const Oe=this.#a.handle(ge.id);if(!Oe)continue;const Pe=T(ge,"grand");if(!m(Pe,Oe)){if(z&&!z.has(ge.id)&&X&&ge.id in X){ne[ge.id]=X[ge.id];continue}ne[ge.id]=this.#Xe([ge],te,null,"grand")[ge.id];continue}let Ie=this.#O.get(ge.id);if((!Ie||Ie.fn!==Pe)&&(Ie=new n(Pe),this.#O.set(ge.id,Ie)),Ie.valid){let xe=!0;for(const ye of ue)if(ye.colId===ge.id&&!Ie.update(ye.before,ye.after)){xe=!1;break}if(xe){ne[ge.id]=Ie.value();continue}Ie.invalidate()}Ie.seedColumn(Oe.values,a(Oe),te),ne[ge.id]=Ie.valid?Ie.value():this.#Xe([ge],te,null,"grand")[ge.id]}return ne}#Pe(D){const te=this.#J("group");te!==this.#P&&(this.#v.clear(),this.#P=te);const z=new Map;for(const ne of D){if(!S(ne))continue;const se=this.#a.handle(ne.id),ue=T(ne,"group");m(ue,se)&&z.set(ne.id,{fn:ue})}if(!z.size)return this.#S.length=0,z;const X=this.#S;this.#S=[];for(const ne of X){const{beforeKeys:se,afterKeys:ue,colDeltas:ge}=ne,Oe=se.length?new Set(se):null,Pe=ue.length?new Set(ue):null;for(const{colId:Ie,before:xe,after:ye}of ge)if(z.has(Ie)){for(const re of se)Pe&&Pe.has(re)||this.#dt(re,Ie,xe,null);for(const re of ue)Oe&&Oe.has(re)||this.#dt(re,Ie,null,ye);for(const re of se)Pe&&!Pe.has(re)||this.#dt(re,Ie,xe,ye)}}return z}#dt(D,te,z,X){const ne=this.#v.get(D),se=ne&&ne.get(te);!se||!se.valid||se.update(z,X)||se.invalidate()}#Ze(D,te,z,X){if(!X||!X.size)return this.#Xe(te,z,D);const ne={};let se=null,ue=this.#v.get(D.key);for(const ge of te){const Oe=X.get(ge.id);if(!Oe){(se||(se=[])).push(ge);continue}const Pe=this.#a.handle(ge.id);if(!Pe)continue;ue||(ue=new Map,this.#v.set(D.key,ue));let Ie=ue.get(ge.id);if((!Ie||Ie.fn!==Oe.fn)&&(Ie=new n(Oe.fn),ue.set(ge.id,Ie)),Ie.valid||Ie.seedColumn(Pe.values,a(Pe),z),Ie.valid){ne[ge.id]=Ie.value();continue}(se||(se=[])).push(ge)}return se&&Object.assign(ne,this.#Xe(se,z,D)),ne}#Je(D,te,z,X){const ne=!this.#rt()||this.#Et(te);for(const se of D){const ue=se.getValue;if(!U(ue))continue;const ge=ue(z),Oe=ue(X);Object.is(ge,Oe)||(this.#C&&this.#C.add(se.id),ne&&this.#O.has(se.id)&&this.#A.push({colId:se.id,before:ge,after:Oe}))}}#ht(){const D=this.#z("groupBy",[]),te=[];for(const z of D){const X=this.#Fe(z);X&&te.push(X)}return te}#pt(D,te){const z=new Array(D.length);for(let X=0;X<D.length;X++){const ne=D[X].getValue;z[X]=g(U(ne)?ne(te):void 0)}return z}#We(D,te,z,X,ne){if(this.#rt()&&!this.#Et(z))return;const se=o(this.#pt(D,X)),ue=o(this.#pt(D,ne)),ge=se.length!==ue.length||se.some((Pe,Ie)=>Pe!==ue[Ie]),Oe=[];for(const Pe of te){const Ie=Pe.getValue;if(!U(Ie))continue;const xe=Ie(X),ye=Ie(ne);!ge&&Object.is(xe,ye)||Oe.push({colId:Pe.id,before:xe,after:ye})}!Oe.length&&!ge||this.#S.push({beforeKeys:se,afterKeys:ue,colDeltas:Oe})}#Et(D){const te=this.#l.get("filter"),z=te&&te.computed?te.result:null;if(!z)return!0;let X=0,ne=z.length-1;for(;X<=ne;){const se=X+ne>>1,ue=z[se];if(ue===D)return!0;ue<D?X=se+1:ne=se-1}return!1}#rt(){return(this.#e.config||{}).totalFilteredOnly!==!1}#te(D){return this.#rt()?D:this.#st().length}#st(){return(!this.#M||this.#M.version!==this.#u)&&(this.#M={version:this.#u,indices:this.#et()}),this.#M.indices}#Tt(){const D=this.#z("groupBy",[]),te=`${this.#u}|${JSON.stringify(D)}`;if(this.#N&&this.#N.key===te)return this.#N.map;const z=new Map,X=[];for(const ne of D){const se=this.#a.handle(ne);se&&X.push(se)}if(X.length){const ne=this.#st(),{keys:se,buckets:ue}=this.#ft("groupByColumns")(X,ne,{locale:(this.#e.config||{}).locale}),ge=new Map;for(let Oe=0;Oe<ue.length;Oe++){const Pe=se[Oe],Ie=[];for(let xe=0;xe<Pe.length;xe++){Ie.push(g(Pe[xe]));const ye=u(Ie);let re=ge.get(ye);re||(re=[],ge.set(ye,re));for(let fe=0;fe<ue[Oe].length;fe++)re.push(ue[Oe][fe])}}for(const[Oe,Pe]of ge)z.set(Oe,Uint32Array.from(Pe))}return this.#N={key:te,map:z},z}#at(){return!!(this.#e.config||{}).totalOnlyChangedColumns}#lt(){this.#ct(),this.#vt(),this.#C=null,this.#E=null,this.#T=null}#ct(){this.#O.clear(),this.#A.length=0,this.#w=-1}#vt(){this.#v.clear(),this.#S.length=0,this.#P=-1}#Ge(D){const te=this.#z("pivotBy",[]);if(!te.length)return this.#W=null,null;const z=(this.#e.compute||{}).pivot;if(!U(z))return I("source.pivot.kernel","pivot requested but ctx.compute.pivot is not available; showing unpivoted rows."),this.#W=null,null;const X=te.map(se=>this.#a.handle(se)).filter(Boolean),ne=this.#Ke();return this.#W=z(X,D.leaves,{groups:D.keys&&D.buckets?{keys:D.keys,buckets:D.buckets}:null,totals:ne.map(se=>se.id),handle:se=>this.#a.handle(se),totalOf:se=>T(ne.find(ue=>ue.id===se),"group"),separator:((this.#e.config||{}).pivot||{}).separator,maxColumns:((this.#e.config||{}).pivot||{}).maxColumns})||null,this.#W}#kt(D){const te=this.#l.get("total").result,z=!!(this.#e.config||{}).groupFooter,X=this.#Me();if(D.tree)return this.#Re(D,te,X);if(!D.roots&&!X){if(te&&te.grand&&!this.#oe()){const Pe=this.#s.grandTotal(te.grand,this.#te(D.leaves.length));if(this.#X===D.leaves&&Array.isArray(this.#F))this.#F[this.#F.length-1]=Pe;else{const Ie=Array.from(D.leaves);Ie.push(Pe),this.#F=Ie,this.#X=D.leaves}this.#B=[{at:this.#F.length-1}]}else this.#X=null,this.#F=D.leaves,this.#B=_;return this.#V=_,this.#F}const ne=[],se=[],ue=[],ge=Pe=>{if(ne.push(Pe),!X)return;const Ie=this.#ce(Pe);!Ie||!X.isOpen(Ie.key)||(Ie.master=!0,Ie.expanded=!0,ue.push({at:ne.length}),ne.push(this.#s.detail(Ie,X.heightOf(Ie))))};if(!D.roots){for(let Pe=0;Pe<D.leaves.length;Pe++)ge(D.leaves[Pe]);return te&&te.grand&&!this.#oe()&&(ue.push({at:ne.length}),ne.push(this.#s.grandTotal(te.grand,this.#te(D.leaves.length)))),this.#X=null,this.#V=_,this.#B=ue.length?ue:_,this.#F=ne,ne}const Oe=(Pe,Ie,xe)=>{if(Pe.expanded=Pe.hasChildren===!1?!1:this.#gt(Pe.key,{key:Pe.key,column:Pe.groupColumn,value:Pe.groupValue,level:Pe.level,path:Pe.groupPath}),Pe.posinset=Ie+1,Pe.setsize=xe,se.push({at:ne.length,row:Pe}),ue.push({at:ne.length}),ne.push(Pe),!!Pe.expanded){if(Pe.children&&Pe.children.length)for(let ye=0;ye<Pe.children.length;ye++)Oe(Pe.children[ye],ye,Pe.children.length);else{const ye=D.nodes.get(Pe.key),re=ye&&ye.leaves?ye.leaves:null;if(re)for(let fe=0;fe<re.length;fe++)ge(re[fe])}z&&Pe.totals&&(ue.push({at:ne.length}),ne.push(this.#s.footer(Pe)))}};for(let Pe=0;Pe<D.roots.length;Pe++)Oe(D.roots[Pe],Pe,D.roots.length);return te&&te.grand&&!this.#oe()&&(ue.push({at:ne.length}),ne.push(this.#s.grandTotal(te.grand,this.#te(D.leaves.length)))),this.#V=se,this.#B=ue,this.#F=ne,ne}#et(){const D=this.#e.store;if(D&&U(D.liveIndices))return D.liveIndices();const te=new Uint32Array(this.#n.length);let z=0;for(let X=0;X<this.#n.length;X++)this.#n[X]!==void 0&&(te[z++]=X);return te.subarray(0,z)}#j(){const D=this.#e.store;return D&&typeof D.physical=="number"?D.physical:this.#n.length}#Qe(D){const te=this.#e.store;return te&&U(te.source)?te.source(D):this.#n[D]}#_e(D,te=D){const z=this.#F[D];if(typeof z!="number")return z.index=te,z;const X=this.#ce(z);return X.index=te,X}#ce(D){let te=this.#h.get(D);te||(te=this.#s.leaf(this.#Qe(D),D),this.#h.set(D,te));const z=this.#R?this.#R.get(D):null;if(z){te.level=z.level,te.posinset=z.posinset,te.setsize=z.setsize,te.hasChildren=z.hasChildren,te.expanded=z.hasChildren&&!z.lazy&&this.#gt(te.key);const X=this.#D?this.#D.byPhysical.get(D):void 0;X?te.totals=X:te.totals&&(te.totals=null)}else te.hasChildren&&(te.level=0,te.hasChildren=!1,te.expanded=!1,te.posinset=void 0,te.setsize=void 0);return te}#Re(D,te,z){const X=[],ne=[],se=ge=>{if(ge.leafCount!==void 0)return ge.leafCount;let Oe=ge.physical>=0?1:0;for(const Pe of ge.children)Oe+=se(Pe);return ge.leafCount=Oe,Oe},ue=ge=>{const Oe=this.#gt(ge.key);if(ge.physical>=0){if(X.push(ge.physical),z&&z.isOpen(this.#ce(ge.physical).key)){const Pe=this.#ce(ge.physical);ne.push({at:X.length}),X.push(this.#s.detail(Pe,z.heightOf(Pe)))}}else X.push(this.#s.group({path:[ge.key],column:null,value:ge.value,level:ge.level,parent:null,expanded:Oe,hasChildren:ge.children.length>0,leafCount:se(ge),totals:this.#D?this.#D.byKey.get(ge.key):void 0}));if(Oe)for(const Pe of ge.children)ue(Pe)};for(const ge of D.tree.roots)ue(ge);return te&&te.grand&&!this.#oe()&&(ne.push({at:X.length}),X.push(this.#s.grandTotal(te.grand,this.#te(D.leaves.length)))),this.#X=null,this.#V=_,this.#B=ne.length?ne:_,this.#F=X,X}#$e(){return t(()=>this.count(),D=>this.at(D))}#Be(D,te){let z=this.#x.get(D);if(z===void 0){const X=this.#Qe(D),ne=this.#At(),se=[],ue=this.#e.columnHidden;for(const ge of ne){if(ge.quickFilter===!1||U(ue)&&ue(ge.id))continue;const Oe=ge.value&&U(ge.value.quickFilterText)?ge.value.quickFilterText({value:void 0,data:X,row:null,column:ge,colId:ge.id,grid:null,context:this.#z("context",null)}):null,Pe=Oe??(U(ge.formatValue)?ge.formatValue(U(ge.getValue)?ge.getValue(X):void 0):"");Pe!=null&&Pe!==""&&se.push(String(Pe))}z=se.join(" ").toLowerCase(),this.#x.set(D,z)}return te(z)}#Ke(){const D=this.#z("totals",[]),te=D&&D.length?new Set(D):null;return this.#At().filter(z=>te?te.has(z.id):!!(z.total||z.groupTotal||z.grandTotal))}#Xe(D,te,z,X="group"){const ne={},se=(this.#e.compute||{}).total;for(const ue of D){if(!S(ue))continue;const ge=this.#a.handle(ue.id);if(!ge)continue;const Oe=T(ue,X);if(Oe)if(U(Oe)){const Pe=new Array(te.length);for(let Ie=0;Ie<te.length;Ie++)Pe[Ie]=ge.get(te[Ie]);ne[ue.id]=Oe(Pe,{row:z,column:ue,grid:this.#e.grid||null,context:this.#z("context",null),valueAt:(Ie,xe)=>{const ye=this.#a.handle(Ie);return ye&&xe>=0&&xe<te.length?ye.get(te[xe]):null}})}else U(se)&&(ne[ue.id]=se(ge,te,Oe))}return ne}#mt(D){if(!D)return D;const te=this.#e.config||{},z={tz:te.timeZone,weekStartsOn:te.weekStartsOn};return p(D,X=>{const ne=y(X,z),se=this.#Fe(ne&&ne.col),ue=se&&se.type==="datetime";if(ne&&ne.type)return ne.type==="datetime"&&!ne.timeZone&&se?{...ne,timeZone:te.timeZone||void 0}:ne;if(ue)return{...ne,type:"datetime",timeZone:te.timeZone||void 0};const ge=se&&(se.dataType?.base||se.type);return ge?{...ne,type:ge}:ne})}#gt(D,te){const z=this.#z("expanded",null);return z?U(z.has)?z.has(D,te):Array.prototype.includes.call(z,D):!0}#z(D,te){if(D==="context"||!U(this.#e.stateVersion))return this.#Ot(D,te);const z=this.#Bt(D),X=this.#f.get(D);if(X&&X.version===z)return X.value;const ne=this.#Ot(D,te);return this.#f.set(D,{version:z,value:ne}),ne}#Ot(D,te){const z=this.#e.state;if(z&&U(z[D])){const X=z[D]();return X??te}return te}#St(){const D=this.#e.stateVersion;return U(D)?D():0}#ut(){const D=this.#e.columnsVersion,te=this.#e.permissionsVersion;return`${U(D)?D():0}|${U(te)?te():0}`}#Bt(D){return D==="totals"?this.#ut():`${this.#St()}`}#it(D,te,z){if(!U(this.#e.stateVersion))return z();const X=this.#d.get(D);if(X&&X.version===te)return X.key;const ne=z();return this.#d.set(D,{version:te,key:ne}),ne}#ft(D){const te=(this.#e.compute||{})[D];return U(te)||L(`ctx.compute.${D} is required by the memory source pipeline`),te}#At(){const D=this.#e.columns;return D&&U(D.all)?D.all():[]}#Fe(D){const te=this.#e.columns;return te&&U(te.get)?te.get(D):void 0}#bt(D,te){const z=this.#e.emit;U(z)&&z(D,te)}}}),_e("packages/core/src/source/abort.js",function(e,F){"use strict";Object.defineProperty(e,"SupersededError",{enumerable:!0,get:function(){return ie}}),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 I}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return L}});class ie extends Error{constructor(U,x="superseded"){super(`[lattice] request ${U?`"${U}" `:""}${x}`),this.name="SupersededError",this.superseded=!0,this.key=U}}class E{#e;constructor(U,x,q,R){this.#e=U,this.key=x,this.controller=q,this.signal=q.signal,this.seq=R}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(U){this.signal.aborted||this.controller.abort(new ie(this.key,U)),this.#e.settle(this)}}class K{#e=new Map;#t=0;begin(U="",x="superseded"){const q=this.#e.get(U);q&&!q.signal.aborted&&q.controller.abort(new ie(U,x));const R=new E(this,U,new AbortController,++this.#t);return this.#e.set(U,R),R}tokenFor(U){return this.#e.get(U)}pending(U=""){const x=this.#e.get(U);return!!x&&!x.signal.aborted}get size(){return this.#e.size}settle(U){this.#e.get(U.key)===U&&this.#e.delete(U.key)}abort(U="",x="superseded"){const q=this.#e.get(U);q&&q.abort(x)}abortAll(U="superseded"){for(const x of[...this.#e.values()])x.abort(U);this.#e.clear()}}function I(){return new K}function L(Q){if(!Q||typeof Q!="object")return!1;const U=Q;return U.superseded===!0||U.name==="AbortError"||U.name==="SupersededError"}}),_e("packages/core/src/source/blockcache.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_PAGE_SIZE",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"DEFAULT_MAX_CACHED_PAGES",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"BlockCache",{enumerable:!0,get:function(){return I}});const ie=100,E=32;class K{constructor(Q){this.id=Q,this.rows=null,this.state="pending",this.token=null,this.error=null}}class I{#e=new Map;#t;#n;#r=0;#i=-1;constructor(Q={}){this.#t=Math.max(1,Math.floor(Number(Q.pageSize)||ie)),this.#n=Math.max(1,Math.floor(Number(Q.maxCachedPages)||E))}get pageSize(){return this.#t}get maxBlocks(){return this.#n}get size(){return this.#e.size}blockOf(Q){return Math.floor(Q/this.#t)}rangeOf(Q){return{start:Q*this.#t,end:(Q+1)*this.#t}}has(Q){return this.#e.has(Q)}pending(Q){const U=this.#e.get(Q);return!!U&&U.state==="pending"}loaded(Q){const U=this.#e.get(Q);return!!U&&U.state==="loaded"}begin(Q,U){let x=this.#e.get(Q);return x||(x=new K(Q)),x.state="pending",x.token=U,x.error=null,this.#s(Q,x),x}fill(Q,U){const x=this.#e.get(Q)||new K(Q);x.rows=U,x.state="loaded",x.token=null,this.#s(Q,x)}failed(Q,U){const x=this.#e.get(Q)||new K(Q);x.state="error",x.error=U,x.token=null,this.#s(Q,x)}delete(Q){return this.#e.delete(Q)}rowAt(Q){const U=this.blockOf(Q),x=this.#e.get(U);if(!(!x||x.state!=="loaded"||!x.rows))return this.#s(U,x),x.rows[Q-U*this.#t]}rowLoaded(Q){const U=this.blockOf(Q),x=this.#e.get(U);return!!x&&x.state==="loaded"&&!!x.rows&&Q-U*this.#t<x.rows.length}erroredAt(Q){const U=this.#e.get(this.blockOf(Q));return!!U&&U.state==="error"}loadedExtent(){let Q=0;for(const U of this.#e.values()){if(U.state!=="loaded"||!U.rows)continue;const x=U.id*this.#t+U.rows.length;x>Q&&(Q=x)}return Q}fillOf(Q){const U=this.#e.get(Q);return U&&U.state==="loaded"&&U.rows?U.rows.length:null}protect(Q,U){this.#r=this.blockOf(Math.max(0,Q)),this.#i=this.blockOf(Math.max(0,U))}evict(){const Q=[];if(this.#e.size<=this.#n)return Q;for(const[U,x]of this.#e){if(this.#e.size-Q.length<=this.#n)break;U>=this.#r&&U<=this.#i||x.state!=="pending"&&Q.push(U)}for(const U of Q)this.#e.delete(U);return Q}ids(){return[...this.#e.keys()]}clear(){this.#e.clear()}#s(Q,U){this.#e.delete(Q),this.#e.set(Q,U)}}}),_e("packages/core/src/source/pagewindow.js",function(e,F){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return ie}});function ie(E,K,I,L){const Q=Math.floor(Number(E)||0);if(Q<=0)return null;const U=Math.max(0,Math.floor(Number(K)||0)),x=Math.max(0,Math.floor(Number(I)||0));if(L){const q=Math.max(1,Math.ceil(x/Q)),R=Math.min(U,q-1),j=R*Q;return{page:R,pageSize:Q,offset:j,length:Math.max(0,Math.min(Q,x-j)),pageCount:q,total:x}}return{page:U,pageSize:Q,offset:U*Q,length:Q,pageCount:Math.max(U+2,Math.ceil(x/Q)),total:null}}}),_e("packages/core/src/source/paged.js",function(e,F){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"PagedSource",{enumerable:!0,get:function(){return f}});const E=F("packages/core/src/internal/lru.js").Lru,I=F("packages/core/src/internal/predicates.js").isFunction,Q=F("packages/core/src/internal/warn.js").warnOnce,x=F("packages/core/src/internal/schedule.js").settleDebounce,q=F("packages/core/src/source/abort.js"),R=q.createAbortScope,j=q.isAbortError,k=F("packages/core/src/source/blockcache.js"),b=k.BlockCache,u=k.DEFAULT_PAGE_SIZE,g=k.DEFAULT_MAX_CACHED_PAGES,t=F("packages/core/src/source/rows.js").createRowFactory,i=F("packages/core/src/source/filterwire.js"),s=i.wireFilters,r=i.querySignature,n=i.warnHostFilterNotApplied,l=F("packages/core/src/source/pagewindow.js").pageWindow,a=120;function c(p,y){return new f(p,y)}class f{mode="paged";#e;#t;#n;#r=R();#i;#s;#a=new Map;#l=null;#o=null;#c=!1;#u=0;#f="";#d={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(y,h){this.#e=y||{mode:"paged"},this.#t=h||{},this.#n=new b({pageSize:this.#e.pageSize||u,maxCachedPages:this.#e.maxCachedPages||g}),this.#i=t(this.#t),this.#s=new E(this.#n.pageSize*4),this.#h=x((d,w)=>this.#w(d,w),a),this.#f=this.#C(),I(this.#e.fetch)||Q("source.paged.fetch",'source.mode "paged" requires a fetch function; the grid will stay empty.'),n(this.#t)}count(){const y=this.#y();return y?y.length:this.#b()}#b(){if(this.#P(),this.#l!==null)return this.#l;const y=Math.max(this.#u,this.#n.loadedExtent());return this.#c?y:y+this.#n.pageSize}matchCount(){return this.#b()}totalCount(){return this.#b()}pageInfo(){const y=this.#y();if(!y){const h=this.#b();return{page:0,pageSize:0,total:this.exact()?h:null,pageCount:1,counting:!1}}return{page:y.page,pageSize:y.pageSize,total:y.total,pageCount:y.pageCount,counting:y.total===null&&this.#r.size>0&&this.#u===0&&this.#n.loadedExtent()===0}}#y(){const y=this.#b(),h=l(this.#T("pageSize",0),this.#T("page",0),y,this.exact());if(!h)return this.#g="",null;const d=`${this.#m}:${h.offset}:${h.length}`;if(d!==this.#g&&!this.#p&&(this.#g=d,h.length>0)){const w=h.offset+h.length-1;this.#d={start:h.offset,end:w},this.#w(h.offset,w)}return h}at(y){const h=this.#y();if(h){if(y<0||y>=h.length)return;const d=this.#O(h.offset+y);return d&&(d.index=y),d}return this.#O(y)}#O(y){if(y<0||y>=this.#b())return;const h=this.#s.get(y);if(h&&(h.data!==null||!this.#n.rowLoaded(y)))return h;const d=this.#n.rowAt(y);if(d===void 0){const v=this.#i.skeleton(y,0,this.#n.erroredAt(y));return this.#s.set(y,v),v}const w=this.#i.leaf(d,y);return w.index=y,this.#s.set(y,w),this.#a.set(w.key,y),w}byKey(y){const h=this.#a.get(y);return h===void 0?void 0:this.#O(h)}loaded(y){const h=this.#y();return h?y>=0&&y<h.length&&this.#n.rowLoaded(h.offset+y):this.#n.rowLoaded(y)}loadedCount(){this.#P();let y=0;for(const h of this.#n.ids()){if(!this.#n.loaded(h))continue;const d=this.#n.fillOf(h);typeof d=="number"&&(y+=d)}return y}residentRows(){this.#P();const y=this.#y(),h=y?y.offset:0,d=y?y.offset+y.length:1/0,w=[],v=this.#n.ids().sort((P,W)=>P-W);for(const P of v){if(!this.#n.loaded(P))continue;const{start:W}=this.#n.rangeOf(P),V=this.#n.fillOf(P)||0;for(let G=W;G<W+V;G++){if(G<h||G>=d)continue;const _=this.#s.peek(G);if(_&&_.data!==null&&_.data!==void 0){w.push(_);continue}const T=this.#n.rowAt(G);if(T===void 0)continue;const S=this.#i.leaf(T,G);S.index=G,this.#s.set(G,S),this.#a.set(S.key,G),w.push(S)}}return w}hint(y,h){if(this.#p)return;const d=this.#P();let w=Math.max(0,Math.floor(y)),v=Math.max(w,Math.floor(h));const P=this.#y();if(P){if(P.length===0)return;w=P.offset,v=P.offset+P.length-1}this.#d={start:w,end:v},this.#n.protect(w,v);for(const W of this.#n.evict())this.#v(W);this.#h(w,v),d&&this.#h.flush()}#w(y,h){if(this.#p)return;this.#n.protect(y,h);const d=this.#n.blockOf(y),w=this.#n.blockOf(h);for(let v=d;v<=w&&!(this.#l!==null&&v*this.#n.pageSize>=this.#l);v++)this.#n.has(v)||this.#A(v)}apply(y){const h={added:[],updated:[],removed:[]};if(!y)return h;if(y.update)for(const d of y.update){const w=this.#i.keyOf(d,-1),v=this.#a.get(w);if(v===void 0)continue;const P=this.#i.leaf(d,v);P.index=v,this.#s.set(v,P),h.updated.push(P)}return(y.add&&y.add.length||y.remove&&y.remove.length)&&this.reload(),h}reload(y){this.#S("reload"),this.#h.cancel(),this.hint(this.#d.start,this.#d.end)}destroy(){this.#p=!0,this.#h.cancel(),this.#r.abortAll("destroyed"),this.#n.clear(),this.#s.clear(),this.#a.clear()}exact(){return this.#l!==null||this.#c}pending(){return this.#r.size}async#A(y){if(!I(this.#e.fetch))return;const h=this.#r.begin(`block:${y}`);this.#n.begin(y,h);const{start:d,end:w}=this.#n.rangeOf(y),v=this.#f;try{const P=await this.#e.fetch({range:{start:d,end:w},sort:this.#T("sort",[]),filters:s(this.#T("filters",null),this.#E()),quick:this.#T("quick","")||void 0,context:this.#T("context",null),signal:h.signal});if(!h.current||v!==this.#f||this.#p)return;h.settle();const W=P&&P.rows||[];this.#n.fill(y,W);for(let G=0;G<W.length;G++)this.#s.delete(d+G);const V=P&&typeof P.total=="number"?P.total:P&&typeof P.count=="number"?P.count:null;V!==null?(this.#l=V,this.#c=!0):W.length<this.#n.pageSize?(this.#c=!0,this.#l=d+W.length):this.#u=Math.max(this.#u,d+W.length),this.#M("model:changed",{reason:"page",block:y,from:d,to:d+W.length}),this.#M("rows:changed",{companion:!0,reason:"page",block:y,from:d,to:d+W.length}),this.#l!==null&&this.#l!==this.#o&&(this.#o=this.#l,this.#M("source:total",{total:this.#l,groupPath:[]}))}catch(P){if(h.settle(),j(P))return;this.#n.failed(y,P);for(let W=d;W<w;W++)this.#s.delete(W);this.#M("model:changed",{reason:"page-error",block:y,range:{start:d,end:w}}),this.#M("source:error",{error:P,block:y,range:{start:d,end:w}})}}#v(y){const{start:h,end:d}=this.#n.rangeOf(y);for(let w=h;w<d;w++){const v=this.#s.peek(w);v&&this.#a.delete(v.key),this.#s.delete(w)}}#P(){const y=this.#C();return y===this.#f?!1:(this.#f=y,this.#S("query"),!0)}#S(y){this.#r.abortAll(y),this.#n.clear(),this.#s.clear(),this.#a.clear(),this.#l=null,this.#o=null,this.#c=!1,this.#u=0,this.#m++,this.#M("model:changed",{reason:y})}#C(){return r({filters:this.#T("filters",null),sort:this.#T("sort",[]),quick:this.#T("quick",""),context:this.#T("context",null)})}#E(){const y=this.#t.config||{};return{tz:y.timeZone,weekStartsOn:y.weekStartsOn}}#T(y,h){const d=this.#t.state;if(d&&I(d[y])){const w=d[y]();return w??h}return h}#M(y,h){const d=this.#t.emit;I(d)&&d(y,h)}}}),_e("packages/core/src/source/aggregates.js",function(e,F){"use strict";Object.defineProperty(e,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"pushableAggregates",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"fillAggregateSql",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"aggregateP",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"routeAggregate",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"resolveAggregatePlan",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"groupKeysPushable",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"pushdownDocRows",{enumerable:!0,get:function(){return R}});const ie=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)"},percentile:{pushable:!0,class:"identical",sql:"quantile_cont(%c, %p)",parametric:!0},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 j=new Set;for(const[k,b]of Object.entries(ie))b.pushable&&j.add(k);return j}function K(j,k,b,u="?"){let g=j.split("%c").join(k);return b!==void 0&&(g=g.split("%w").join(b)),g.split("%p").join(u)}function I(j){const k=j&&(j.p!==void 0?j.p:j.params&&j.params.p);return typeof k=="number"&&k>=0&&k<=1?k:void 0}function L(j){const k=j||{},b=k.default==="engine"||k.default==="engine-if-identical"?k.default:"client",u={};if(k.overrides&&typeof k.overrides=="object")for(const[g,o]of Object.entries(k.overrides))(o==="engine"||o==="client")&&(u[g]=o);return{default:b,overrides:u}}function Q(j,k){const b=ie[j];if(!b||!b.pushable)return"client";const u=k.overrides[j];return u==="engine"||u==="client"?u:k.default==="client"?"client":k.default==="engine-if-identical"?b.class==="identical"?"engine":"client":"engine"}function U(j,k){const b=L(k),u=[],g=[];for(const o of j||[]){const t=ie[o.fn],i=Q(o.fn,b),s={id:o.id,col:o.col,fn:o.fn,class:t?t.class:"fallback"};if(o.weight!==void 0&&(s.weight=o.weight),o.params!==void 0&&(s.params=o.params),t&&t.parametric){const r=I(o);r!==void 0&&(s.p=r)}if(i==="engine"&&t&&t.parametric&&s.p===void 0){g.push({...s,reason:`"${o.fn}" needs \`p\`, a number from 0 to 1`});continue}i==="engine"?u.push(s):(s.reason=t&&!t.pushable?t.note||"the engine cannot express this stat":"client by config",g.push(s))}return{engine:u,client:g,config:b}}const x=/^[A-Za-z_][A-Za-z0-9_$]*$/;function q(j,k=[]){return(j||[]).every(u=>{if(typeof u=="string")return x.test(u);if(!u||typeof u!="object")return!1;const g=u;return Array.isArray(k)&&k.includes(g.bucket)&&typeof g.col=="string"&&x.test(g.col)&&typeof g.size=="number"&&Number.isFinite(g.size)&&g.size>0})}function R(){return Object.entries(ie).map(([j,k])=>({stat:j,class:k.class,sql:k.sql?K(k.sql,"col",k.twoColumn?"weight":void 0):"",note:k.note||(k.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),_e("packages/core/src/source/pushdown.js",function(e,F){"use strict";Object.defineProperty(e,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"NO_CAPABILITIES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"capabilitiesOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"splitFilters",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"applyResidual",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"createPushdownSource",{enumerable:!0,get:function(){return z}});const E=F("packages/core/src/internal/compare.js").defaultCompare,I=F("packages/core/src/internal/predicates.js").isFunction,Q=F("packages/core/src/internal/merge.js").toArray,x=F("packages/core/src/internal/warn.js").warnOnce,q=F("packages/core/src/source/filterwire.js"),R=q.isGroup,j=q.warnWherePageRelative,k=q.warnWhereOverThreshold,b=q.wireFilters,u=F("packages/core/src/source/aggregates.js"),g=u.resolveAggregatePlan,o=u.groupKeysPushable,t=u.STAT_PUSHDOWN,i=u.aggregateP,s=u.fillAggregateSql,n=F("packages/core/src/source/abort.js").SupersededError,m=1e3;function l(X){const ne=X&&X.signal;if(!ne||!ne.aborted)return;const se=ne.reason;throw se instanceof Error?se:new n("","superseded before it was sent")}const a=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function c(X){if(!X||typeof X!="object")return!1;const ne=X.returning==="row"||X.returning==="key"?X.returning:"none";return{append:X.append===!0,update:X.update===!0,delete:X.delete===!0,returning:ne}}function f(X,ne){if(!X||typeof ne!="string")return;if(!ne.includes("."))return X[ne];let se=X;for(const ue of ne.split(".")){if(se===null||typeof se!="object")return;se=se[ue]}return se}function p(X){if(X===!0)return!0;if(!X||typeof X!="object")return!1;const ne=X;return ne.enabled===!1?!1:ne.enabled===!0||I(ne.commit)}function y(X){const ne={...a,...X||{}};return ne.operators=new Set(ne.operators||[]),ne.mutate=c(ne.mutate),ne}function h(X,ne){return!X||!X.op||!ne.operators.size?!1:ne.operators.has(X.op)}function d(X,ne){if(!X)return{pushed:null,residual:null};if(!ne.filter)return{pushed:null,residual:X};if(ne.filter==="term"){if(R(X)){const Oe=X.conditions||[];if(String(X.op)!=="and")return{pushed:null,residual:X};const Pe=Oe.findIndex(xe=>!R(xe)&&h(xe,ne));if(Pe<0)return{pushed:null,residual:X};const Ie=Oe.filter((xe,ye)=>ye!==Pe);return{pushed:Oe[Pe],residual:Ie.length?{op:"and",conditions:Ie}:null}}return h(X,ne)?{pushed:X,residual:null}:{pushed:null,residual:X}}if(!R(X))return h(X,ne)?{pushed:X,residual:null}:{pushed:null,residual:X};if(String(X.op)!=="and")return(X.conditions||[]).every(Pe=>R(Pe)?d(Pe,ne).residual===null:h(Pe,ne))?{pushed:X,residual:null}:{pushed:null,residual:X};const se=[],ue=[];for(const Oe of X.conditions||[]){if(R(Oe)){if(ne.filter==="flat"){ue.push(Oe);continue}const Pe=d(Oe,ne);Pe.pushed&&se.push(Pe.pushed),Pe.residual&&ue.push(Pe.residual);continue}(h(Oe,ne)?se:ue).push(Oe)}const ge=Oe=>Oe.length===0?null:Oe.length===1?Oe[0]:{op:"and",conditions:Oe};return{pushed:ge(se),residual:ge(ue)}}const w="__lattice_leaves";function v(X){return X.aggregates?X.aggregates instanceof Set?X.aggregates:new Set(Q(X.aggregates)):new Set}function P(X){const ne=v(X);return ne.size?ne.has("count")?X.filter!=="tree"||!X.operators||!X.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 W(X,ne,se,ue,ge,Oe,Pe){const Ie=Array.isArray(X.groupBy)?X.groupBy:[],xe=Array.isArray(X.groupPath)?X.groupPath:[],ye=Array.isArray(X.groupValues)?X.groupValues:null;if(!ne.group){const re=P(ne);if(re)return re}return o(Ie)?se.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":ue?ge?Oe&&!Oe.conditioned?"a host `where` predicate can only run in the browser, over rows the engine grouped":Pe?"fullDataset holds the whole matching set, so the grid groups it itself":!ye||ye.length!==xe.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 V="pushdown:pivot-unsupported",G="pushdown:group-unsupported",_=Symbol("lattice.remote.ungroupedLevel");function T(X,ne,se,ue,ge,Oe){const Pe=Array.isArray(X.pivotBy)?X.pivotBy:[],Ie=Array.isArray(X.groupBy)?X.groupBy:[],xe=Array.isArray(X.groupPath)?X.groupPath:[],ye=Array.isArray(X.groupValues)?X.groupValues:null;return ne.pivot?o(Pe)?Ie.length&&!o(Ie)?"a grouping key is not a plain column the engine can name in a GROUP BY":se.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":ue?ge?Oe&&!Oe.conditioned?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!ye||ye.length!==xe.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 S(X,ne,se=!1){const ue=d(X.filters||null,ne),ge=[];ue.residual&&ge.push("filter");const Oe=X.sort||[],Pe=Oe.length===0||ne.sort==="multi"&&Oe.length>=1||ne.sort==="single"&&Oe.length===1;!Pe&&Oe.length&&ge.push("sort");const Ie=X.quick?String(X.quick):"",xe=!Ie||!!ne.quick;xe||ge.push("quick");const ye=X.where&&X.where.active?X.where:null;ye&&ge.push("where");const re={filters:ue.residual,sort:Pe?null:Oe,quick:xe?"":Ie,where:ye},fe=!!se,oe=Array.isArray(X.groupBy)&&X.groupBy.length>0,ce=oe?W(X,ne,ue,Pe,xe,ye,fe):"",de=X.pivotMode!==!1&&Array.isArray(X.pivotBy)&&X.pivotBy.length>0,ve=de?T(X,ne,ue,Pe,xe,ye):"",ke=de&&ve==="";de&&!ke&&ge.push("pivot");const Ce=de?ke&&oe:oe&&ce==="";oe&&!de&&!Ce&&ge.push("group");const Le=(Ce||ke)&&Array.isArray(X.groupValues)?X.groupValues.length:0;ye&&ye.conditioned&&(Ce||ke)&&(re.where=null,ge.splice(ge.indexOf("where"),1));const we=Ce||de?!1:fe||!!(re.filters||re.sort||re.quick||re.where)||!ne.range;return{pushed:{...X,filters:ue.pushed,sort:Pe?Oe:[],quick:xe?Ie:"",range:we?null:X.range},residual:re,needsAll:we,unpushed:ge,full:fe,grouped:Ce,groupLevel:Le,groupReason:de?"":ce,pivoted:ke,pivotReason:ve}}function O(X){const ne=Array.isArray(X.totals)?X.totals:[],se=X.totalFns&&typeof X.totalFns=="object"?X.totalFns:{},ue=[],ge=[];for(const Oe of ne){const Pe=String(Oe),Ie=se[Pe],xe=typeof Ie=="string"?Ie:Ie&&typeof Ie.fn=="string"?Ie.fn:null,ye=Ie&&typeof Ie=="object"?i(Ie):void 0,re=xe?t[xe]:null;re&&re.parametric&&ye===void 0?ge.push({id:Pe,fn:xe,class:re.class,reason:`"${xe}" needs \`p\`, a number from 0 to 1`}):xe?!re||!re.pushable||!re.sql?ge.push({id:Pe,fn:xe,class:re?re.class:"fallback",reason:re&&re.note?re.note:`the pushdown map cannot express "${xe}"`}):re.twoColumn?ge.push({id:Pe,fn:xe,class:re.class,reason:`"${xe}" reduces two columns, and a grouped request carries no weight column`}):ue.push({id:Pe,col:Pe,fn:xe,class:re.class,...ye!==void 0?{p:ye}:{}}):ge.push({id:Pe,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:ue,client:ge}}function M(X){return{...X,engine:X.engine.map(ne=>{const se=t[ne.fn];if(!se||!se.sql)return ne;const ue=ge=>`"${ge}"`;return{...ne,sql:s(se.sql,ue(ne.col),ne.weight!==void 0?ue(ne.weight):void 0)}})}}const A=Object.freeze({items:X=>X==null?[]:Array.isArray(X)?X:[X]});function N(X,ne,se){if(!ne)return X;let ue=X;if(ne.filters&&I(se.evaluateFilters)){const ge=ue,Oe={count:ue.length,handle:xe=>({id:xe,get:ye=>f(ge[ye],xe)}),itemwise:xe=>ge.some(ye=>Array.isArray(f(ye,xe)))?A:null},Pe=se.evaluateFilters(ne.filters,Oe),Ie=[];for(let xe=0;xe<ue.length;xe++)Pe[xe]&&Ie.push(ue[xe]);ue=Ie}if(ne.where&&ne.where.active&&(ne.whole||j(ne.where.names,"pushdown"),ue=ue.filter(ge=>ne.where.passes(ge))),ne.quick){const ge=ne.quick.toLowerCase();ue=ue.filter(Oe=>{if(!Oe||typeof Oe!="object")return!1;for(const Pe of Object.values(Oe))if(Pe!=null&&String(Pe).toLowerCase().includes(ge))return!0;return!1})}if(ne.sort&&ne.sort.length&&I(se.sortMulti)){const ge=[...new Set(ne.sort.map(xe=>xe.col))],Oe=ue,Pe=ge.map(xe=>({id:xe,get:ye=>f(Oe[ye],xe)})),Ie=se.sortMulti(Pe,ne.sort.map(xe=>({col:xe.col,dir:xe.dir})),Uint32Array.from({length:ue.length},(xe,ye)=>ye),{});ue=Array.from(Ie,xe=>Oe[xe])}return ue}function $(X){return JSON.stringify({filters:X.filters||null,sort:X.sort||[],quick:X.quick||"",groupBy:X.groupBy||[],groupPath:X.groupPath||[],context:X.context??null})}function H(X){if(!X||typeof X!="object")return 16;let ne="";try{ne=JSON.stringify(X)}catch{return 200}return ne.length*2+64}function Y(X){const ne=X||{};return{enabled:!!ne.enabled,maxRows:Number.isFinite(ne.maxRows)?ne.maxRows:1e6,maxBytesEstimate:Number.isFinite(ne.maxBytesEstimate)?ne.maxBytesEstimate:512*1024*1024}}const Z=5e4;function J(X){return Number.isFinite(X)&&X>=0?X:Z}function D(X){return!!X&&I(X.then)}async function te(X){if(!X||X.total!==void 0||!D(X.pendingTotal))return X;const ne=await X.pendingTotal,{pendingTotal:se,...ue}=X;return typeof ne=="number"?{...ue,total:ne}:ue}function z(X={}){const ne=X.adapter;if(!ne||!I(ne.execute))return x("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...X,mode:"remote",fetch:async()=>({rows:[],total:0})};const se=y(ne.capabilities),ue=ne.capabilities&&Object.getOwnPropertyDescriptor(ne.capabilities,"operators");ue&&I(ue.get)&&Object.defineProperty(se,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(ne.capabilities.operators||[]),set:()=>{}});const ge=ne.name||"adapter";let Oe=null;const Pe=()=>I(ne.ready)?(Oe||(Oe=Promise.resolve(ne.ready()).then(()=>{Object.assign(se,y(ne.capabilities))},Re=>{throw Oe=null,Re})),Oe):null,Ie=Y(X.fullDataset),xe=!!X.allowPartialResults,ye=J(X.whereRowLimit);let re=null;const fe=X.aggregates;let oe=null,ce=null,de=null,ve=null,ke=null,Ce=null,Le=0,we=null;const He=()=>!Ie.enabled||!oe?null:(we!==oe.key&&(Le++,we=oe.key),{rows:oe.rows,version:Le}),Te=async Re=>{const ze=Re.where&&Re.where.active?Re.where:null;if(!ze)return{request:Re,probe:null};if(ze.conditioned){const Ot=S(Re,se,Ie.enabled);if(Ot.grouped||Ot.pivoted)return{request:Re,probe:null}}const{where:De,...Ge}=Re,Ve=S(Ge,se,Ie.enabled);if(Ve.needsAll)return{request:Re,probe:null};const Qe=$(Ve.pushed);let mt=null;return(!re||re.key!==Qe)&&(se.total?(l(Re),mt=await te(await ne.execute(Ve.pushed,Re)),re={key:Qe,size:mt&&typeof mt.total=="number"?mt.total:null}):re={key:Qe,size:null}),re.size!==null&&re.size<ye?{request:Re,probe:null}:(k(ze.names,ge,re.size,ye),{request:Ge,probe:mt})},Ae=async(Re,ze)=>{Ce=null;const De=O(Re.pushed);de={engine:De.engine,client:De.client,groupBy:Re.pushed.groupBy},De.client.length&&x(`source.pushdown.group.totals.${ge}.${De.client.map(Qe=>Qe.id).join(".")}`,`the ${ge} adapter cannot compute the group subtotal for ${De.client.map(Qe=>`"${Qe.id}" (${Qe.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 Ge=await ne.executeGroupLevel(Re.pushed,De.engine,ze)||{};let Ve=Ge.rows||[];return!se.range&&ze.range&&(Ve=Ve.slice(ze.range.start,ze.range.end)),Be(Ge),Ge.total===void 0?{rows:Ve}:{rows:Ve,total:Ge.total}},Se=new Map,Ee=64,Me=async(Re,ze)=>{Ce=null;const De=Re.pushed,Ge=De.groupBy,Ve=Array.isArray(De.groupValues)?De.groupValues:[],Qe=Ve.length,mt=[...De.filters?[De.filters]:[],...Ge.slice(0,Qe).map((rt,lt)=>({col:rt,op:"eq",value:Ve[lt]===void 0?null:Ve[lt],caseSensitive:!0}))],Ot=mt.length===0?null:mt.length===1?mt[0]:{op:"and",conditions:mt},gt=ze.range?ze.range.start:0;if(Qe>=Ge.length){const rt={...De,filters:Ot,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},lt=await te(await ne.execute(rt,ze))||{};let Rt=lt.rows||[];return!se.range&&ze.range&&(Rt=Rt.slice(ze.range.start,ze.range.end)),typeof lt.total=="number"?{rows:Rt,total:lt.total}:{rows:Rt}}const dt=Ge[Qe],jt=O(De),xt=v(se),At=jt.engine.filter(rt=>xt.has(rt.fn)),Bt=[...jt.engine.filter(rt=>!xt.has(rt.fn)).map(rt=>({id:rt.id,fn:rt.fn,class:rt.class,reason:`the ${ge} adapter does not compute "${rt.fn}"`})),...jt.client];de={engine:At,client:Bt,groupBy:Ge},Bt.length&&x(`source.pushdown.group.totals.${ge}.${Bt.map(rt=>rt.id).join(".")}`,`the ${ge} adapter cannot compute the group subtotal for ${Bt.map(rt=>`"${rt.id}" (${rt.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 nn=[...At.map(rt=>({id:rt.id,col:rt.col,fn:rt.fn,...rt.p!==void 0?{p:rt.p}:{}})),{id:w,col:dt,fn:"count"}],Vt={...De,filters:Ot,range:null},Zt=JSON.stringify([$(Vt),Ve,dt,nn]);let Xe=gt>0?Se.get(Zt):void 0;if(!Xe){for(Xe=Promise.resolve(ne.executeGroupedAggregates(Vt,[dt],nn)),Se.delete(Zt),Se.set(Zt,Xe);Se.size>Ee;)Se.delete(Se.keys().next().value);Xe.catch(()=>{Se.get(Zt)===Xe&&Se.delete(Zt)})}const ot=await Xe||[];l(ze);const vt=rt=>{const lt={};for(const Rt of At)lt[Rt.id]=rt?rt[Rt.id]:void 0;return lt},pt=(De.sort||[]).find(rt=>rt&&rt.col===dt),yt=pt&&pt.dir==="desc"?-1:1,We=ot.filter(rt=>rt&&rt.level===1).map(rt=>({[dt]:rt.keys[0]===void 0?null:rt.keys[0],leafCount:Number(rt.values&&rt.values[w])||0,totals:vt(rt.values)})).sort((rt,lt)=>yt*E(rt[dt],lt[dt]));if(Qe===0){const rt=ot.find(Rt=>Rt&&Rt.level===0),lt=rt?Number(rt.values&&rt.values[w]):NaN;Be({matchCount:Number.isFinite(lt)?lt:We.reduce((Rt,Lt)=>Rt+Lt.leafCount,0),...rt?{grand:vt(rt.values)}:{}})}const at=ze.range?ze.range.end:We.length;return{rows:We.slice(gt,at),total:We.length}},Be=Re=>{typeof Re.matchCount=="number"&&(ve=Re.matchCount,ke=Re.grand?{totals:Re.grand,leafCount:Re.matchCount}:null)},Ke=async(Re,ze)=>{Ce=null;const De=O(Re.pushed);de={engine:De.engine,client:De.client,groupBy:Re.pushed.groupBy,pivotBy:Re.pushed.pivotBy},De.client.length&&x(`source.pushdown.pivot.totals.${ge}.${De.client.map(Ot=>Ot.id).join(".")}`,`the ${ge} adapter cannot compute the pivot cells for ${De.client.map(Ot=>`"${Ot.id}" (${Ot.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 Ge=await ne.executePivotLevel(Re.pushed,De.engine,ze)||{};let Ve=Ge.rows||[];!se.range&&ze.range&&(Ve=Ve.slice(ze.range.start,ze.range.end)),Be(Ge);const Qe=Ge.pivot&&typeof Ge.pivot=="object"?Ge.pivot:{},mt={cells:Array.isArray(Qe.cells)?Qe.cells:[],...Array.isArray(Qe.axis)?{axis:Qe.axis}:{}};return Ge.total===void 0?{rows:Ve,pivot:mt}:{rows:Ve,total:Ge.total,pivot:mt}},et=Re=>{x(`source.pushdown.pivot.${ge}.${Re}`,`pushdown:pivot-unsupported: the ${ge} adapter cannot pivot this query because ${Re}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const ze=new Error(`[lattice] ${V}: the ${ge} adapter cannot pivot this query because ${Re}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw ze.code=V,ze.reason=Re,ze},Je=(Re,ze)=>{const De={key:ze,state:"pending",value:null};return Ce=De,Re.then(Ge=>(Ce===De&&(Ce={key:ze,state:"settled",value:typeof Ge=="number"?Ge:null}),Ge),Ge=>{throw Ce===De&&(Ce={key:ze,state:"failed",value:null}),Ge})};let ut=0,Ct=[];const Nt=()=>ut===0?null:new Promise(Re=>{const ze=setTimeout(Re,m);Ct.push(()=>{clearTimeout(ze),Re()})});let st;const it=async Re=>{const ze=Pe();ze&&await ze;const Ge=Re&&Re.pivotMode!==!1&&Array.isArray(Re.pivotBy)&&Re.pivotBy.length>0?{request:Re,probe:null}:await Te(Re);l(Re);let Ve=S(Ge.request,se,Ie.enabled);if(se.group&&Ve.grouped&&!Ve.pivoted&&!I(ne.executeGroupLevel)&&(x(`source.pushdown.group.method.${ge}`,`the ${ge} 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.`),Ve=S(Ge.request,{...se,group:!1,aggregates:null},Ie.enabled)),Ve.pivoted&&!I(ne.executePivotLevel)&&(Ve=S(Ge.request,{...se,pivot:!1},Ie.enabled),Ve.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Ve.grouped&&!Ve.pivoted&&!se.group&&!I(ne.executeGroupedAggregates)&&(x(`source.pushdown.group.aggregates.method.${ge}`,`the ${ge} 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\`.`),Ve=S(Ge.request,{...se,aggregates:null},Ie.enabled)),ce=Ve,Ve.pivoted)return Ke(Ve,Re);if(Ve.pivotReason&&et(Ve.pivotReason),Ve.grouped)return se.group?Ae(Ve,Re):Me(Ve,Re);const mt=!!Ve.groupReason&&!Ve.full;mt?x(`source.pushdown.group-unsupported.${ge}.${Ve.groupReason}`,`pushdown:group-unsupported: the ${ge} adapter was not asked to group this query because ${Ve.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.`):Ve.groupReason&&x(`source.pushdown.group.${ge}.${Ve.groupReason}`,`the ${ge} adapter was not asked to group this query because ${Ve.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 Ot=Vt=>mt?{...Vt,[_]:!0}:Vt;if(!Ve.needsAll){const Vt=Ge.probe||await ne.execute(Ve.pushed,Re),Zt=Vt.rows||[];return D(Vt.pendingTotal)&&Vt.total===void 0?Ot({rows:Zt,pendingTotal:Je(Vt.pendingTotal,$(Ve.pushed))}):(Ce=null,!se.total&&Vt.total===void 0?Ot({rows:Zt}):Ot({rows:Zt,total:Vt.total??Zt.length}))}const gt=Ve.unpushed.filter(Vt=>!(Vt==="where"&&Ve.residual.where&&Ve.residual.where.anyConditioned));gt.length&&x(`source.pushdown.residual.${ge}.${gt.join(".")}`,`the ${ge} adapter cannot push ${gt.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 dt=$(Ve.pushed);if(!oe||oe.key!==dt){const Vt=await te(await ne.execute(Ve.pushed,Re));Ce=null;const Zt=Vt.rows||[];if(Ve.full){const Xe=typeof Vt.total=="number"?Math.max(Vt.total,Zt.length):Zt.length;if(Xe>Ie.maxRows)throw new Error(`[lattice] fullDataset refused: the ${ge} adapter's matching set is ${Xe.toLocaleString()} rows, past the configured maxRows of ${Ie.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 ot=Zt.length*H(Zt[0]);if(ot>Ie.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${ge} adapter's matching set is an estimated ${Math.round(ot/(1024*1024)).toLocaleString()} MB across ${Zt.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(Ie.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 Vt.total=="number"&&Zt.length<Vt.total){const Xe=!!(Ve.residual.filters||Ve.residual.quick||Ve.residual.sort&&Ve.residual.sort.length);if(Xe&&!xe)throw new Error(`[lattice] the ${ge} adapter returned ${Zt.length} of ${Vt.total} matching rows when asked for the whole result, and the query has residual ${Ve.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.`);Xe?x(`source.pushdown.partial.residual.${ge}`,`the ${ge} adapter returned ${Zt.length} of ${Vt.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.`):x(`source.pushdown.partial.${ge}`,`the ${ge} adapter returned ${Zt.length} of ${Vt.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}oe={key:dt,rows:Zt,total:typeof Vt.total=="number"?Vt.total:null}}let jt=Ve;if(Ve.residual.where){const Vt=oe.total??oe.rows.length;if(Vt>=ye){k(Ve.residual.where.names,ge,Vt,ye);const{where:Zt,...Xe}=Ge.request;jt=S(Xe,se,Ie.enabled),ce=jt}}const xt=oe.total!==null&&oe.rows.length>=oe.total,At=N(oe.rows,{...jt.residual,whole:xt},X.compute||{}),Bt=Re.range?Re.range.start:0,nn=Re.range?Re.range.end:At.length;return Ot({rows:At.slice(Bt,nn),total:At.length})},ct=async(Re,ze,De)=>{const Ve=De&&De.waitForPage&&st&&I(st.pageForegroundIdle)?st.pageForegroundIdle():Nt();Ve&&await Ve;const Qe=Pe();Qe&&await Qe;const mt=S(Re,se,Ie.enabled);ce=mt;const Ot=g(ze,De&&De.engine?{default:"engine"}:fe),gt=Array.isArray(Re.groupBy)?Re.groupBy:[],dt=gt.length>0,jt=!mt.residual.filters&&!mt.residual.quick,xt=!dt||o(gt,se.buckets);let At=Ot.engine,Bt=Ot.client;if(se.aggregates&&At.length){const ot=se.aggregates instanceof Set?se.aggregates:new Set(Q(se.aggregates)),vt=At.filter(pt=>!ot.has(pt.fn));vt.length&&(At=At.filter(pt=>ot.has(pt.fn)),Bt=[...vt.map(pt=>({...pt,reason:`the ${ge} adapter does not compute "${pt.fn}"`})),...Bt])}const nn=ot=>{Bt=[...At.map(vt=>({...vt,reason:ot})),...Bt],At=[]};let Vt="";if(At.length&&!jt){const ot=mt.residual.quick&&!mt.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)";nn(ot),dt&&(Vt=ot)}else if(At.length&&!xt){const ot="a grouping key the engine cannot form forces all-client (no mixed provenance)";nn(ot),Vt=ot}let Zt={},Xe;if(At.length&&(I(dt?ne.executeGroupedAggregates:ne.executeAggregates)?dt?Xe=await ne.executeGroupedAggregates(mt.pushed,gt,At)||[]:Zt=await ne.executeAggregates(mt.pushed,At)||{}:(x(`source.pushdown.aggregates.${ge}${dt?".grouped":""}`,`the ${ge} adapter cannot compute ${dt?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),nn(`adapter cannot compute ${dt?"grouped ":""}aggregates`),dt&&(Vt=`the ${ge} adapter cannot compute grouped aggregates`))),dt){const ot=Xe!==void 0;ot!==mt.grouped&&(ce={...mt,grouped:ot,groupReason:ot?"":Vt||mt.groupReason,unpushed:ot?mt.unpushed.filter(vt=>vt!=="group"):mt.unpushed.includes("group")?mt.unpushed:[...mt.unpushed,"group"]})}return de={engine:At,client:Bt,...dt?{groupBy:gt}:{}},{values:Zt,engine:At,client:Bt,...Xe!==void 0?{groups:Xe}:{}}},Tt=async Re=>{ut++;try{return await it(Re)}finally{if(ut--,ut===0&&Ct.length){const ze=Ct;Ct=[];for(const De of ze)De()}}},$t=p(X.edit),It=X.edit&&typeof X.edit=="object"&&I(X.edit.commit);let ft=X.edit;if($t&&!It)if(se.mutate&&se.mutate.update){const Re=ze=>{if(!se.mutate||!se.mutate.update)throw new Error(`[lattice] the ${ge} 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 De={kind:"update",key:String(ze.key),patch:{[ze.colId]:ze.value}};return ne.mutate(De,ze.request||{})};ft={...X.edit===!0?{}:X.edit,commit:Re}}else x(`source.pushdown.readonly.${ge}`,`edit is enabled but the ${ge} adapter declares mutate: ${se.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 ae=$t&&se.mutate&&(se.mutate.append||se.mutate.delete)?{append:se.mutate.append===!0,remove:se.mutate.delete===!0,returning:se.mutate.returning,mutate:(Re,ze)=>ne.mutate(Re,ze||{})}:null,me=async Re=>{const ze=Pe();ze&&await ze;const{range:De,signal:Ge,export:Ve,...Qe}=Re||{},mt={...Qe,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:S(mt,se,Ie.enabled),signal:Ge}};async function*be(Re,ze={}){const{plan:De,signal:Ge}=await me(Re),Ve=Math.max(1,Math.floor(Number(ze.pageSize))||5e3),Qe={signal:Ge,stream:!0},mt=Re&&Re.range&&Number.isFinite(Number(Re.range.start))&&Number.isFinite(Number(Re.range.end))?{start:Math.max(0,Number(Re.range.start)),end:Math.max(0,Number(Re.range.end))}:null;if(!De.needsAll){const dt=mt?mt.start:0,jt=mt?mt.end:1/0;for(let xt=dt;xt<jt;xt+=Ve){l(Qe);const At=Math.min(xt+Ve,jt),Bt=await ne.execute({...De.pushed,range:{start:xt,end:At}},Qe);Bt&&D(Bt.pendingTotal)&&Bt.pendingTotal.then(null,()=>{});const nn=Bt&&Bt.rows||[];if(nn.length&&(yield nn),nn.length<At-xt)return}return}l(Qe);const Ot=await te(await ne.execute({...De.pushed,range:void 0},Qe));let gt=N(Ot&&Ot.rows||[],{...De.residual,whole:!0},X.compute||{});mt&&(gt=gt.slice(mt.start,mt.end));for(let dt=0;dt<gt.length;dt+=Ve)yield gt.slice(dt,dt+Ve)}const je=async Re=>{const{plan:ze,signal:De}=await me(Re);if(!ze.needsAll&&se.total){l({signal:De});const Ve=await te(await ne.execute({...ze.pushed,range:{start:0,end:0}},{signal:De}));if(Ve&&typeof Ve.total=="number")return Ve.total}let Ge=0;for await(const Ve of be({...Re,range:void 0}))Ge+=Ve.length;return Ge},Ne=async Re=>{await Pe();const ze=b(Re.filters||null,{tz:X.timeZone,weekStartsOn:X.weekStartsOn}),De=Re.quick?String(Re.quick):"";return d(ze,se).residual||De&&!se.quick?null:ne.facets({...Re,filters:ze,quick:De})};return st={...X,edit:ft,rowMutate:ae,mode:"remote",fetch:Tt,foregroundIdle:Nt,facetProvider:I(ne.facets)?Ne:void 0,aggregate:ct,countMatching:je,streamMatching:be,capabilitiesOf:y,planQuery:S,wireFilters:b,resolveAggregatePlan:(Re,ze)=>g(Re,ze&&ze.engine?{default:"engine"}:fe),STAT_PUSHDOWN:t,lastPlan:()=>ce?{...ce,...de?{aggregates:M(de)}:{},...Ce?{total:{deferred:!0,state:Ce.state,value:Ce.value}}:{}}:null,fullFrame:He,counts:()=>({match:ve,total:ve,pending:!!Ce&&Ce.state==="pending"}),grandTotals:()=>ke},st}}),_e("packages/core/src/source/remote.js",function(e,F){"use strict";Object.defineProperty(e,"PROTOCOL",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return M}});const E=F("packages/core/src/internal/lru.js").Lru,I=F("packages/core/src/internal/predicates.js").isFunction,Q=F("packages/core/src/internal/warn.js").warnOnce,x=F("packages/core/src/internal/schedule.js").settleDebounce,q=F("packages/core/src/source/abort.js"),R=q.createAbortScope,j=q.isAbortError,k=F("packages/core/src/source/blockcache.js"),b=k.BlockCache,u=k.DEFAULT_PAGE_SIZE,g=k.DEFAULT_MAX_CACHED_PAGES,o=F("packages/core/src/source/rows.js"),t=o.createRowFactory,i=o.groupKey,s=F("packages/core/src/source/filterwire.js"),r=s.wireFilters,n=s.querySignature,m=s.warnHostFilterNotApplied,a=F("packages/core/src/source/pagewindow.js").pageWindow,f=F("packages/core/src/source/memory.js").MemorySource,y=F("packages/core/src/compute/handle.js").valueComparator,h=F("packages/core/src/compute/pivot.js"),d=h.pivotKey,w=h.joinPath,v=h.DEFAULT_PATH_SEPARATOR,W=F("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,V=1,G=120,_=1e3;function T(A,N,$){for(let H=0;H<Math.max(A.length,N.length);H++){const Y=A[H],Z=N[H],J=Y==null,D=Z==null;if(J||D){if(J&&D)continue;return J?1:-1}const te=$(Y,Z);if(te!==0)return te}return 0}function S(A,N){return new M(A,N)}class O{constructor(N,$,H,Y){this.path=N,this.keyPath=Y||N,this.values=[],this.level=$,this.key=i(this.keyPath),this.cache=new b(H),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 M{mode="remote";#e;#t;#n;#r;#i=new Map;#s=new Set;#a=R();#l;#o;#c=new Map;#u=[];#f=null;#d="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#O="";#w=null;#A=-1;constructor(N,$){this.#e=N||{mode:"remote"},this.#t=$||{},I(this.#e.fullFrame)&&(this.filteredIndices=()=>this.#D(),this.unfilteredIndices=()=>this.#K(),this.handleFor=te=>this.#Y(te),this.display=()=>this.#x(),this.grandTotalRow=()=>this.#F(),this.unfilteredRows=()=>this.#B(),this.facetIndices=te=>this.#H(te));const H=this.#e.counts;I(H)&&(this.matchCount=()=>this.#X("match"),this.totalCount=()=>this.#X("total"));const Y=this.#e.grandTotals;I(Y)&&(this.grandTotalRow=()=>this.#V());const Z=this.#e.foregroundIdle;I(Z)&&(this.foregroundIdle=()=>this.#oe(Z),this.#e.pageForegroundIdle=()=>this.#b?this.#oe(Z):null);const J=this.#e.facetProvider;I(J)&&(this.facetProvider=J);const D=this.#e;I(D.countMatching)&&I(D.streamMatching)&&(this.selectionQuery=()=>this.#W(),this.countMatching=te=>D.countMatching(te),this.streamMatching=(te,z)=>D.streamMatching(te,z),this.loadedRows=()=>this.#ge(),this.resident=()=>this.#N()!==null),this.#n={pageSize:this.#e.pageSize||u,maxCachedPages:this.#e.maxCachedPages||g},this.#l=t(this.#t),this.#o=new E(this.#n.pageSize*4),this.#h=x((te,z)=>this.#T(te,z),G),this.#r=new O([],0,this.#n),this.#i.set(this.#r.key,this.#r),this.#d=this.#be(),I(this.#e.fetch)||Q("source.remote.fetch",'source.mode "remote" requires a fetch function; the grid will stay empty.'),this.#de()}count(){const N=this.#S();return N?N.length:this.#v()}#v(){const N=this.#N();return N?N.count():(this.#re(),this.#Ae(this.#r))}#P(){if(this.#N())return!0;const N=$=>{if($.count===null&&!$.complete)return!1;for(const H of $.children.values())if(this.#Te(H.key,this.#we(H))&&!N(H))return!1;return!0};return N(this.#r)}pageInfo(){const N=this.#S(),$=this.totalPending();if(!N){const H=this.#v();return{page:0,pageSize:0,total:this.#P()?H:null,pageCount:1,counting:$}}return{page:N.page,pageSize:N.pageSize,total:N.total,pageCount:N.pageCount,counting:$||N.total===null&&this.#a.size>0&&this.#r.cache.loadedExtent()===0}}#S(){const N=this.#v(),$=a(this.#$("pageSize",0),this.#$("page",0),N,this.#P());if(!$)return this.#O="",null;const H=`${this.#y}:${$.offset}:${$.length}`;return H!==this.#O&&!this.#p&&(this.#O=H,$.length>0&&!this.#N()&&this.#T($.offset,$.offset+$.length-1)),$}at(N){const $=this.#S();if($){if(N<0||N>=$.length)return;const H=this.#C($.offset+N);return H&&(H.index=N),H}return this.#C(N)}#C(N){const $=this.#N();if($)return $.at(N);if(this.#re(),N<0||N>=this.#v())return;const H=this.#Z(this.#r,N);if(!H)return;const Y=this.#G(H.node,H.local);return Y&&(Y.index=N),Y||this.#l.skeleton(N,H.node.level,H.node.cache.erroredAt(H.local))}byKey(N){const $=this.#N();if($)return $.byKey(N);const H=this.#c.get(N);if(!H)return;const Y=H.lastIndexOf(":"),Z=this.#i.get(H.slice(0,Y));return Z&&this.#G(Z,Number(H.slice(Y+1)))||void 0}loaded(N){const $=this.#S();if($){if(N<0||N>=$.length)return!1;N+=$.offset}const H=this.#N();if(H)return H.loaded(N);if(N<0||N>=this.#v())return!1;const Y=this.#Z(this.#r,N);return!!Y&&Y.node.cache.rowLoaded(Y.local)}hint(N,$){if(this.#p)return;this.#b=!0;const H=this.#re();let Y=Math.max(0,Math.floor(N)),Z=Math.max(Y,Math.floor($));const J=this.#S();if(J){if(J.length===0)return;Y=J.offset,Z=J.offset+J.length-1}for(const[D,te]of this.#E(Y,Z)){D.cache.protect(te.min,te.max);for(const z of D.cache.evict())this.#Ee(D,z)}this.#h(Y,Z),H&&this.#h.flush()}#E(N,$){const H=this.#v(),Y=new Map;for(let Z=N;Z<=$&&Z<H;Z++){const J=this.#Z(this.#r,Z);if(!J)continue;const D=Y.get(J.node);D?(D.min=Math.min(D.min,J.local),D.max=Math.max(D.max,J.local)):Y.set(J.node,{min:J.local,max:J.local})}return Y.size||Y.set(this.#r,{min:N,max:N}),Y}#T(N,$){if(!this.#p)for(const[H,Y]of this.#E(N,$)){H.cache.protect(Y.min,Y.max);const Z=H.cache.blockOf(Y.min),J=H.cache.blockOf(Y.max);for(let D=Z;D<=J&&!(H.count!==null&&D*H.cache.pageSize>=H.count);D++)H.cache.has(D)||this.#ue(H,D)}}apply(N){const $={added:[],updated:[],removed:[]};if(!N)return $;if(N.update)for(const H of N.update){const Y=this.#c.get(this.#l.keyOf(H,-1));if(!Y)continue;this.#o.delete(Y);const Z=Y.lastIndexOf(":"),J=this.#i.get(Y.slice(0,Z));if(!J)continue;const D=Number(Y.slice(Z+1)),te=J.cache.blockOf(D);if(!J.cache.loaded(te))continue;const{start:z}=J.cache.rangeOf(te),X=[];for(let se=z;se<z+J.cache.pageSize;se++){const ue=J.cache.rowAt(se);if(ue===void 0)break;X.push(se===D?H:ue)}J.cache.fill(te,X);const ne=this.#G(J,D);ne&&$.updated.push(ne)}return(N.add&&N.add.length||N.remove&&N.remove.length)&&this.reload({keepExpanded:!0}),$}reload(N){this.#a.abortAll("reload"),this.#h.cancel(),N&&N.keepExpanded===!1&&this.#s.clear(),this.#pe(),this.#_("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#a.abortAll("destroyed"),this.#pe(),this.#i.clear(),this.#s.clear(),this.#w&&I(this.#w.destroy)&&this.#w.destroy(),this.#w=null}expand(N){this.#s.has(N)||(this.#s.add(N),this.#_("group:toggled",{key:N,expanded:!0}),this.#_("model:changed",{reason:"expand",key:N}))}collapse(N){this.#s.delete(N)&&(this.#_("group:toggled",{key:N,expanded:!1}),this.#_("model:changed",{reason:"collapse",key:N}))}expandedKeys(){return[...this.#s]}pivotFields(){return this.#u}pivot(){this.#re();const N=this.#f;if(!N||!N.keys.size||!this.#$("pivotBy",[]).length)return null;if(!N.result){const $=y((this.#t.config||{}).locale),H=[...N.keys.entries()].sort((Z,J)=>T(Z[1],J[1],$)),Y=H.map(([Z])=>Z);N.result={keys:H.map(([,Z])=>Z),paths:Y,fields:this.#Ce(Y),groupPaths:[],columns:Y.length*Math.max(1,this.#ve().length),values:N.cells,cells:N.cells,error:null}}return N.result}invalidateHandles(){this.#w&&(I(this.#w.invalidateHandles)&&this.#w.invalidateHandles(),I(this.#w.invalidate)&&this.#w.invalidate("filter"))}#M(){const N=this.#e.fullFrame;return I(N)?N():null}#N(){const N=this.#M();return N?(this.#w||(this.#w=new f({mode:"memory"},this.#R())),N.version!==this.#A&&(this.#w.setRows(N.rows),this.#A=N.version),this.#w):null}#R(){const N=this.#t,$=N.state||{};return{...N,state:{...$,page:()=>0,pageSize:()=>0}}}#D(){const N=this.#N();return N?N.filteredIndices():new Uint32Array(0)}#K(){const N=this.#N();return N?N.unfilteredIndices():new Uint32Array(0)}#Y(N){const $=this.#N();return $?$.handleFor(N):void 0}#x(){const N=this.#N();return N?N.display():[]}#H(N){const $=this.#N();return $&&I($.facetIndices)?$.facetIndices(N):new Uint32Array(0)}#F(){const N=this.#N();return N&&I(N.grandTotalRow)?N.grandTotalRow():null}#X(N){const $=this.#N();if($){const J=N==="match"?$.matchCount:$.totalCount;if(I(J))return J.call($)}const H=this.#e.counts,Y=I(H)?H():null,Z=Y?Y[N]:null;return typeof Z=="number"?Z:this.#v()}#V(){const N=this.#N();if(N&&I(N.grandTotalRow))return N.grandTotalRow();if((this.#t.config||{}).grandTotalRow!=="bottom")return null;const H=this.#e.grandTotals,Y=I(H)?H():null;return!Y||!Y.totals?null:this.#l.grandTotal(Y.totals,Y.leafCount||0)}#B(){const N=this.#N();if(N&&I(N.unfilteredRows))return N.unfilteredRows();const $=[],H=this.count();for(let Y=0;Y<H;Y++){const Z=this.at(Y);Z&&$.push(Z)}return $}#W(){const N=this.#$("quick",""),$={protocol:V,groupPath:[],groupValues:[],groupBy:[],totals:[],totalFns:{},pivotBy:[],pivotMode:!1,filters:r(this.#$("filters",null),this.#J()),sort:this.#$("sort",[]),context:this.#$("context",null)};N&&($.quick=N);const H=this.#$("where",null);return H&&H.active&&($.where=H),$}#ge(){const N=this.#$("groupBy",[]).length,$=[];for(const H of this.#i.values())if(!(H.level!==N&&!H.flat))for(const Y of H.cache.ids()){if(!H.cache.loaded(Y))continue;const{start:Z,end:J}=H.cache.rangeOf(Y);for(let D=Z;D<J&&H.cache.rowLoaded(D);D++){const te=this.#G(H,D);te&&!te.group&&$.push(te)}}return $}loadedCount(){const N=this.#N();if(N){const Y=N.matchCount();return typeof Y=="number"?Y:N.count()}this.#re();const $=this.#$("groupBy",[]).length;let H=0;for(const Y of this.#i.values())if(!(Y.level!==$&&!Y.flat))for(const Z of Y.cache.ids()){if(!Y.cache.loaded(Z))continue;const J=Y.cache.fillOf(Z);typeof J=="number"&&(H+=J)}return H}residentRows(){const N=this.#N();return N?N.display():this.#$("groupBy",[]).length>0?null:(this.#re(),this.#ge())}#se(N,$,H){const{start:Y,end:Z}=N.cache.rangeOf($),J=this.#$("groupBy",[]),D=this.#$("pivotBy",[]),te=this.#$("quick",""),z=this.#ve(),X={protocol:V,range:{start:Y,end:Z},groupPath:N.path,groupValues:N.values,groupBy:J,totals:z,totalFns:this.#Se(z),pivotBy:D,pivotMode:D.length>0,filters:r(this.#$("filters",null),this.#J()),sort:this.#$("sort",[]),context:this.#$("context",null),signal:H};te&&(X.quick=te);const ne=this.#$("where",null);return ne&&ne.active&&(X.where=ne),X}async#ue(N,$){if(!I(this.#e.fetch))return;if(!this.#m){this.#m=!0;const J=this.#g;this.#g=[],queueMicrotask(()=>{for(const D of J)D()})}const H=this.#a.begin(`${N.key}:${$}`);N.cache.begin($,H);const Y=this.#d,{start:Z}=N.cache.rangeOf($);try{const J=await this.#e.fetch(this.#se(N,$,H.signal));if(!H.current||Y!==this.#d||this.#p)return;H.settle();const D=J&&J.rows||[];if(!!(J&&J[W])&&!N.flat){N.flat=!0,N.children.clear();for(const[ne,se]of[...this.#c])se.startsWith(`${N.key}:`)&&(this.#o.delete(se),this.#c.delete(ne))}N.cache.fill($,D),N.failed=!1;for(let ne=0;ne<D.length;ne++)this.#o.delete(`${N.key}:${Z+ne}`);const z=J&&typeof J.count=="number"?J.count:J&&typeof J.total=="number"?J.total:null,X=J&&I(J.pendingTotal?.then)?J.pendingTotal:null;z!==null?(N.count=z,N.complete=!0):D.length<N.cache.pageSize?(N.count=Z+D.length,N.complete=!0):X&&(N.counting=!0,N.announced=null),J&&Array.isArray(J.pivotFields)&&this.#He(J.pivotFields),J&&J.pivot&&typeof J.pivot=="object"&&this.#ae(J.pivot),this.#_("model:changed",{reason:"page",groupPath:N.path,block:$}),this.#_("rows:changed",{companion:!0,reason:"page",groupPath:N.path,block:$}),this.#fe(N),X&&this.#Me(N,X,Y)}catch(J){if(H.settle(),j(J))return;N.cache.failed($,J),N.failed=!0;const{end:D}=N.cache.rangeOf($);for(let te=Z;te<D;te++)this.#o.delete(`${N.key}:${te}`);this.#_("model:changed",{reason:"page-error",groupPath:N.path,block:$}),this.#_("source:error",{error:J,groupPath:N.path,block:$})}}async#Me(N,$,H){let Y;try{Y=await $}catch(Z){if(H!==this.#d||this.#p)return;N.counting=!1,j(Z)||(N.failed=!0),j(Z)||this.#_("source:error",{error:Z,groupPath:N.path});return}H!==this.#d||this.#p||(N.counting=!1,typeof Y=="number"&&(N.count=Y,N.complete=!0,this.#fe(N),this.#_("model:changed",{reason:"total",count:Y,groupPath:N.path})))}#fe(N){typeof N.count!="number"||!N.complete||N.announced!==N.count&&(N.announced=N.count,this.#_("source:total",{total:N.count,groupPath:N.path}))}#oe(N){if(this.#p)return null;this.#re();const $=this.#m?null:new Promise(D=>{this.#g.push(D),setTimeout(D,_)}),H=N();if(!$&&!H)return null;const Y=(async()=>{$&&await $;for(let D=N();D;D=N())await D})();let Z;const J=new Promise(D=>{Z=setTimeout(D,_)});return Promise.race([Y,J]).then(()=>clearTimeout(Z))}totalPending(){if(this.#r.failed)return!1;if(this.#r.counting===!0)return!0;if(this.#N())return!1;this.#re();const N=this.#r;return N.count===null&&!N.complete&&N.cache.loadedExtent()===0}totalFailed(){return this.#r.failed===!0}#He(N){N.length===this.#u.length&&N.every(($,H)=>$===this.#u[H])||(this.#u=N,this.#_("column:pivoted",{pivotFields:N,remote:!0}))}#xe(){const N=this.#t.config||{};return N.pivot&&N.pivot.separator||v}#Ce(N){const $=this.#xe(),H=this.#ve();if(!H.length)return N.slice();const Y=[];for(const Z of N)for(const J of H)Y.push(`${Z}${$}${J}`);return Y}#ae(N){const $=this.#xe();this.#f||(this.#f={keys:new Map,cells:new Map,result:null});const H=this.#f;let Y=!1;const Z=D=>{const te=Array.isArray(D)?D:[D],z=w(te,$);return H.keys.has(z)||(H.keys.set(z,te),Y=!0),z},J=this.#$("groupBy",[]).length>0;for(const D of Array.isArray(N.axis)?N.axis:[])Z(D);for(const D of Array.isArray(N.cells)?N.cells:[]){if(!D||typeof D!="object")continue;const te=Z(D.pivot);if(J&&!(Array.isArray(D.group)&&D.group.length))continue;const z=w(Array.isArray(D.group)?D.group:[],$);for(const[X,ne]of Object.entries(D.values||{}))H.cells.set(d(z,te,X),ne)}H.result=null,Y&&this.#He((this.pivot()||{fields:[]}).fields)}#Ae(N){let $=this.#le(N);for(const H of N.children.values())this.#Te(H.key,this.#we(H))&&($+=this.#Ae(H));return $}#le(N){if(N.count!==null)return N.count;const $=N.cache.loadedExtent();return N.complete?$:N.row&&N.row.leafCount>0?N.level>=this.#$("groupBy",[]).length?Math.max($,N.row.leafCount):$===0?1:Math.min($+N.cache.pageSize,Math.max($,N.row.leafCount)):$+N.cache.pageSize}#Z(N,$){let H=$,Y=0;const Z=[...N.children.entries()].filter(([,D])=>this.#Te(D.key,this.#we(D))).sort((D,te)=>D[0]-te[0]);for(const[D,te]of Z){const z=D-Y+1;if(H<z)return{node:N,local:Y+H};H-=z,Y=D+1;const X=this.#Ae(te);if(H<X)return this.#Z(te,H);H-=X}const J=this.#le(N);return Y+H<J?{node:N,local:Y+H}:null}#G(N,$){const H=`${N.key}:${$}`,Y=this.#o.get(H);if(Y)return Y.group===!0?this.#U(Y):Y;const Z=N.cache.rowAt($);if(Z===void 0)return null;const J=this.#$("groupBy",[]);let D;if(N.level<J.length&&!N.flat){const te=J[N.level],z=this.#f!==null&&N.level===J.length-1&&this.#$("pivotBy",[]).length>0,X=this.#ye(Z,te),ne=X==null,se=[...N.path,ne?"":String(X)],ue=[...N.keyPath,ne?null:String(X)];if(D=this.#l.group({path:se,keyPath:ue,column:te,value:X,level:N.level,parent:N.row,leafCount:Number(Z.leafCount)||0,expanded:z?!1:this.#Te(i(ue),{key:i(ue),column:te,value:X,level:N.level,path:se}),...z?{hasChildren:!1}:{}}),D.totals=this.#ne(Z),D.data=Z,!z){let ge=this.#i.get(D.key);ge?ge.row=D:(ge=new O(se,N.level+1,this.#n,ue),ge.row=D,this.#i.set(ge.key,ge)),ge.values=[...N.values,X],N.children.set($,ge)}}else D=this.#l.leaf(Z,$,N.level,N.row);return this.#o.set(H,D),this.#c.set(D.key,H),D}#ne(N){const $=N||{};if($.totals&&typeof $.totals=="object")return $.totals;const H={};for(const Y of this.#ve())Object.hasOwn($,Y)&&(H[Y]=$[Y]);return H}#U(N){const $=this.#i.get(N.key);if(!$||$.row!==N||N.hasChildren===!1)return N;const H=this.#Te(N.key,this.#we($));return N.expanded!==H&&(N.expanded=H),N}#Ee(N,$){const{start:H,end:Y}=N.cache.rangeOf($);for(let Z=H;Z<Y;Z++){const J=`${N.key}:${Z}`,D=this.#o.peek(J);D&&this.#c.delete(D.key),this.#o.delete(J)}}#re(){const N=this.#be();return N===this.#d?!1:(this.#d=N,this.#a.abortAll("query"),this.#pe(),this.#m=!1,this.#_("model:changed",{reason:"query"}),!0)}#pe(){for(const N of this.#i.values())N.cache.clear(),N.count=null,N.complete=!1,N.announced=null,N.counting=!1,N.failed=!1,N.children.clear(),N.flat=!1;this.#o.clear(),this.#c.clear(),this.#y++,this.#f=null}#be(){const N=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)})}|${N?N.version:0}`}#Te(N,$){const H=this.#$("expanded",null);return H?I(H.has)?H.has(N,$):Array.prototype.includes.call(H,N):this.#s.has(N)}#we(N){if(N.row)return{key:N.key,column:N.row.column,value:N.row.value,level:N.level-1,path:N.path}}#ve(){const N=this.#$("totals",[]);if(N&&N.length)return[...N];const $=this.#t.columns;return!$||!I($.all)?[]:$.all().filter(H=>!!H.total).map(H=>H.id)}#Se(N){const $=this.#t.columns,H={};if(!$||!I($.get))return H;for(const Y of N){const Z=$.get(Y);if(!Z)continue;const J=Z.groupTotal!=null?Z.groupTotal:Z.total;typeof J=="string"?H[Y]=J:J&&typeof J=="object"&&typeof J.fn=="string"&&(H[Y]={...J})}return H}#ye(N,$){const H=this.#t.columns,Y=H&&I(H.get)?H.get($):void 0;return Y&&I(Y.getValue)?Y.getValue(N):N?.[$]}#de(){m(this.#t)}#J(){const N=this.#t.config||{};return{tz:N.timeZone,weekStartsOn:N.weekStartsOn}}#$(N,$){const H=this.#t.state;if(H&&I(H[N])){const Y=H[N]();return Y??$}return $}#_(N,$){const H=this.#t.emit;I(H)&&H(N,$)}}}),_e("packages/core/src/source/gapbuffer.js",function(e,F){"use strict";Object.defineProperty(e,"GapBuffer",{enumerable:!0,get:function(){return E}});const ie=64;class E{#e;#t=0;#n=0;constructor(I=ie){this.#e=new Uint32Array(Math.max(1,I)),this.#n=this.#e.length}static from(I,L=ie){const Q=new E(I.length+Math.max(1,L));return Q.#e.set(I,0),Q.#t=I.length,Q.#n=Q.#e.length,Q}get length(){return this.#t+(this.#e.length-this.#n)}get capacity(){return this.#e.length}at(I){return I<0||I>=this.length?0:I<this.#t?this.#e[I]:this.#e[I+(this.#n-this.#t)]}insert(I,L){const Q=I<0?0:I>this.length?this.length:I;this.#r(Q),this.#t===this.#n&&this.#i(),this.#e[this.#t++]=L}push(I){this.insert(this.length,I)}removeAt(I){return!Number.isInteger(I)||I<0||I>=this.length?!1:(this.#r(I),this.#n++,!0)}toArray(){const I=new Uint32Array(this.length);return I.set(this.#e.subarray(0,this.#t),0),I.set(this.#e.subarray(this.#n),this.#t),I}clear(){this.#t=0,this.#n=this.#e.length}#r(I){if(I!==this.#t)if(I<this.#t){const L=this.#t-I;this.#e.copyWithin(this.#n-L,I,this.#t),this.#t=I,this.#n-=L}else{const L=I-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+L),this.#t=I,this.#n+=L}}#i(){const I=this.#e.length-this.#n,L=new Uint32Array(Math.max(this.#e.length*2,this.#e.length+ie));L.set(this.#e.subarray(0,this.#t),0),L.set(this.#e.subarray(this.#n),L.length-I),this.#e=L,this.#n=L.length-I}}}),_e("packages/core/src/store/ingest.js",function(e,F){"use strict";Object.defineProperty(e,"INGEST_DEFAULTS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"inferKind",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"decideText",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"createReaders",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"Ingest",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return r}});const ie=F("packages/core/src/internal/schedule.js"),E=ie.now,K=ie.nextFrame,I=F("packages/core/src/internal/warn.js"),L=I.infoOnce,Q=I.warnOnce,x=F("packages/core/src/internal/predicates.js").isFunction,R=F("packages/core/src/internal/paths.js").pathGetter,k=F("packages/core/src/store/columnstore.js").ColumnStore,b=Object.freeze({chunkMs:8,chunkRows:512,sampleSize:100,dictionaryRatio:.1,columnarBelow:5e3,initialCapacity:1024});function u(n,m={}){if(m.multi)return"multi";if(n.length===0)return"object";let l=0,a=0,c=0,f=0,p=0;for(let h=0;h<n.length;h++){const d=n[h];typeof d=="number"?l++:typeof d=="boolean"?a++:typeof d=="string"?c++:d instanceof Date?f++:Array.isArray(d)&&p++}const y=n.length;return l===y?"float64":a===y?"bitset":f===y?"float64":c===y?"text":p===y?"multi":"object"}function g(n,m,l){return m<=0||n<l*m?"dictionary":"object"}function o(n,m,l){const a=new Map,c=new Map;for(const V of n){if(V.computed)continue;const G=x(V.read)?V.read:R(V.field||V.id);c.set(V.id,G),a.set(V.id,G)}const f=m?.order??[],p=m?.fns??{},y=m?.deps??{},h=m?.wrapDeps??null,d=f.filter(V=>x(p[V])),w=d.some(V=>y[V]==="*");let v=new WeakMap;const P=V=>{const G={};if(w)for(const[_,T]of c)G[_]=T(V);for(const _ of d){const T=y[_];let S;if(T==="*")S=G;else{S={};const O=T||[];for(let M=0;M<O.length;M++){const A=O[M];S[A]=A in G?G[A]:c.get(A)?.(V)}}G[_]=p[_](h?h(S,_):S,{data:V,row:null,column:null,grid:null,context:l})}return G},W=V=>{if(V===null||typeof V!="object"&&typeof V!="function")return P(V);let G=v.get(V);return G===void 0&&(G=P(V),v.set(V,G)),G};for(const V of d)a.set(V,G=>W(G)[V]);return{readers:a,reset(){v=new WeakMap}}}class t{spec;read;kind;inferred;nullable;candidate=!1;distinct=null;change=null;reason="";constructor(m,l){this.spec=m,this.read=l,this.kind="object",this.inferred=!1,this.nullable=m.nullable!==!1}}class i{#e;#t=[];#n=null;#r;#i=0;#s;#a=!1;#l=!1;#o=0;#c;constructor(m,l={},a={}){this.#e=Array.isArray(m)?m:Array.from(m||[]),this.#s={...b,...a};const c=l.columns??[];this.#r=o(c,l.computed??null,l.context),this.#c=this.#e.length>=this.#s.columnarBelow,this.#u(c,l.computed??null),this.#n=new k(this.#t.map(f=>({id:f.spec.id,kind:f.kind,nullable:f.nullable,read:f.read,dictionary:f.spec.dictionary})),{initialCapacity:this.#s.initialCapacity,columnarBelow:this.#s.columnarBelow})}get store(){return this.#n}get done(){return this.#a||this.#l}get progress(){return this.#i}slice(){if(this.done)return!1;if(this.#s.signal?.aborted)return this.#l=!0,!1;const m=E(),{chunkMs:l,chunkRows:a}=this.#s,c=this.#e.length;do{const f=Math.min(this.#i+a,c);this.#n.append(this.#e.slice(this.#i,f)),this.#f(this.#i,f),this.#i=f,this.#r.reset(),this.#h(!1)}while(this.#i<c&&E()-m<l);return this.#o+=E()-m,this.#s.onProgress?.({loaded:this.#i,total:c}),this.#i>=c?(this.#h(!0),this.#a=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(m=>({id:m.spec.id,kind:m.kind,nullable:m.nullable,read:m.read,dictionary:m.spec.dictionary})),decisions:this.#t.map(m=>({id:m.spec.id,kind:m.kind,nullable:m.nullable,inferred:m.inferred,distinct:m.candidate||m.change?this.#d(m):null,change:m.change,reason:m.reason})),count:this.#n.count,elapsed:this.#o,cancelled:this.#l}}#u(m,l){const a=this.#e,c=Math.min(this.#s.sampleSize,a.length),f=this.#s.dictionaryRatio,p=l?.pure instanceof Set?l.pure:new Set(l?.pure??l?.order??[]);for(const y of m){if(!y||!y.id)continue;if(y.computed&&(y.pure===!1||l&&!p.has(y.id))){Q(`ingest.impure.${y.id}`,`column "${y.id}" is an impure computed column and is not materialised into the store`);continue}const h=this.#r.readers.get(y.id)??(x(y.read)?y.read:R(y.field||y.id)),d=new t(y,h);if(y.kind)d.kind=y.kind,d.reason="declared by the caller";else if(y.dictionary)d.kind=y.multi?"multi":"dictionary",d.reason="value table supplied (lookup column)";else{const w=[];for(let P=0;P<c&&w.length<this.#s.sampleSize;P++){const W=h(a[P]);W!=null&&w.push(W)}d.inferred=!0;const v=u(w,{multi:y.multi});if(v==="text"){const P=new Set(w).size;d.kind=g(P,w.length,f),d.candidate=this.#c,d.reason=`sampled ${P} distinct in ${w.length}`}else d.kind=v,d.reason=`inferred from ${w.length} sampled values`,v==="object"&&w.length&&L(`ingest.mixed.${y.id}`,`column "${y.id}" holds mixed or unrecognised value types; storing as an object array. Declare a type to avoid this.`);d.kind==="object"&&d.candidate&&(d.distinct=new Set(w))}this.#t.push(d)}}#f(m,l){const a=this.#e;for(const c of this.#t){if(!c.candidate||!c.distinct)continue;const f=c.distinct;for(let p=m;p<l;p++){const y=c.read(a[p]);y!=null&&f.add(y)}}}#d(m){if(m.distinct)return m.distinct.size;const l=this.#n.column(m.spec.id);return l?.dict?l.dict.size:0}#h(m){const l=this.#s.dictionaryRatio,a=this.#e.length;for(const c of this.#t){if(!c.candidate)continue;const f=this.#d(c);if(c.kind==="dictionary"&&f>=l*a){const p=this.#n.column(c.spec.id);c.distinct=new Set(p?.dict?p.dict.values():[]),this.#n.convert(c.spec.id,"object"),c.kind="object",c.change="demoted",c.reason=`${f} distinct values is at or above ${l*100}% of ${a} rows`;continue}if(c.kind==="object"&&f>=l*a){c.candidate=!1,c.distinct=null,c.reason=`${f} distinct values is at or above ${l*100}% of ${a} rows`;continue}m&&c.kind==="object"&&f<l*a&&(this.#n.convert(c.spec.id,"dictionary"),c.kind="dictionary",c.change=c.change==="demoted"?null:"promoted",c.reason=`${f} distinct values is below ${l*100}% of ${a} rows`,c.distinct=null),m&&(c.candidate=!1)}}}async function s(n,m={},l={}){const a=new i(n,m,l),c=l.scheduler?.frame??K;for(;a.slice();)await new Promise(f=>{c(f)});return a.result()}function r(n,m={},l={}){const a=new i(n,m,{...l,chunkMs:1/0});for(;a.slice(););return a.result()}}),_e("packages/core/src/store/columnpack.js",function(e,F){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return g}});const E=F("packages/core/src/internal/paths.js").pathGetter,K=F("packages/core/src/store/ingest.js"),I=K.inferKind,L=K.decideText,Q=K.INGEST_DEFAULTS,x=F("packages/core/src/store/columnstore.js").toFloat,q=new Set(["float64","int32","bitset","dictionary","object","multi"]);function R(o){if(!Array.isArray(o)||o.length===0)return!1;for(const t of o)if(!t||typeof t.id!="string"||typeof t.field!="string"||t.field===""||t.kind&&!q.has(t.kind))return!1;return!0}function j(o){const t=x(o);return Number.isFinite(t)?t|0:0}function k(o){return o==null?[]:Array.isArray(o)?o:[o]}function b(o,t,i,s){if(o.kind)return o.kind;const r=[];for(let l=0;l<t.length&&r.length<Q.sampleSize;l++){const a=t[l];a!=null&&r.push(a)}const n=I(r,{multi:o.multi});if(n!=="text")return n;const m=new Set(r).size;return L(m,r.length,s)}function u(o,t,i={}){const s=t.length|0,r=i.dictionaryRatio??Q.dictionaryRatio,n=[];for(const m of o){const l=E(m.field||m.id),a=m.nullable!==!1,c=new Array(s);for(let d=0;d<s;d++){const w=l(t[d]);c[d]=w===void 0?null:w}const f=b(m,c,s,r),p=a?new Uint8Array(s+7>>3):null,y=d=>{p&&(p[d>>3]|=1<<(d&7))};let h;switch(f){case"float64":{const d=new Float64Array(s);for(let w=0;w<s;w++){const v=c[w],P=v===null;P||y(w),d[w]=P?NaN:x(v)}h={id:m.id,kind:f,nullable:a,values:d,presence:p,offsets:null,table:null};break}case"int32":{const d=new Int32Array(s);for(let w=0;w<s;w++){const v=c[w],P=v===null;P||y(w),d[w]=P?0:j(v)}h={id:m.id,kind:f,nullable:a,values:d,presence:p,offsets:null,table:null};break}case"bitset":{const d=new Uint8Array(s+7>>3);for(let w=0;w<s;w++){const v=c[w],P=v===null;P||y(w),!P&&v&&(d[w>>3]|=1<<(w&7))}h={id:m.id,kind:f,nullable:a,values:d,presence:p,offsets:null,table:null};break}case"dictionary":{const d=new Uint32Array(s),w=[],v=new Map;for(let P=0;P<s;P++){const W=c[P];if(W===null){d[P]=0;continue}y(P);let V=v.get(W);V===void 0&&(V=w.length,w.push(W),v.set(W,V)),d[P]=V}h={id:m.id,kind:f,nullable:a,values:d,presence:p,offsets:null,table:w};break}case"multi":{const d=[],w=new Map,v=new Uint32Array(s+1),P=[];for(let W=0;W<s;W++){const V=c[W];v[W]=P.length,V===null||y(W);const _=k(V);for(let T=0;T<_.length;T++){const S=_[T];let O=w.get(S);O===void 0&&(O=d.length,d.push(S),w.set(S,O)),P.push(O)}}v[s]=P.length,h={id:m.id,kind:f,nullable:a,values:Int32Array.from(P),presence:p,offsets:v,table:d};break}default:{const d=new Array(s);for(let w=0;w<s;w++){const v=c[w];v!==null&&y(w),d[w]=v}h={id:m.id,kind:"object",nullable:a,values:d,presence:p,offsets:null,table:null};break}}n.push(h)}return{count:s,columns:n}}function g(o){const t=[];if(!o||!Array.isArray(o.columns))return t;const i=s=>{ArrayBuffer.isView(s)&&s.buffer&&!t.includes(s.buffer)&&t.push(s.buffer)};for(const s of o.columns)i(s.values),i(s.presence),i(s.offsets);return t}}),_e("packages/core/src/source/stream.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_PROMOTE_BELOW",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"createStreamSource",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return O}});const E=F("packages/core/src/internal/lru.js").Lru,I=F("packages/core/src/internal/predicates.js").isFunction,L=F("packages/core/src/internal/schedule.js"),Q=L.now,U=L.nextFrame,x=L.cancelFrame,q=L.whenIdle,j=F("packages/core/src/internal/compare.js").defaultCompare,k=F("packages/core/src/internal/warn.js"),b=k.warnOnce,u=k.infoOnce,o=F("packages/core/src/internal/paths.js").getPath,t=F("packages/core/src/source/abort.js"),i=t.createAbortScope,s=t.isAbortError,r=F("packages/core/src/source/rows.js"),n=r.createRowFactory,m=r.lazyRowView,a=F("packages/core/src/source/gapbuffer.js").GapBuffer,f=F("packages/core/src/source/memory.js").createMemorySource,y=F("packages/core/src/source/filterwire.js").querySignature,d=F("packages/core/src/store/columnpack.js").isPortableSchema,w=25e4,v=Symbol("lattice.stream.storeBacked"),P=8,W=.1,V=1e3,G=50;function _(M){return Math.min(V,Math.max(G,Math.floor(M/4)))}function T(M){if(M instanceof Date)return M.getTime();if(typeof M=="number")return Number.isFinite(M)?M:NaN;if(typeof M=="string"){const A=M.trim();if(!A)return NaN;const N=Date.parse(A);return Number.isNaN(N)?Number(A):N}return NaN}function S(M,A){return new O(M,A)}class O{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#i=[];#s=null;#a;#l;#o=new Map;#c=i();#u={loaded:0,estimated:void 0};#f=null;#d=0;#h=0;#p=0;#m=0;#g=null;#b=null;#y=null;#O=!1;#w=!1;#A=!1;#v=!1;#P="";#S=0;#C=0;#E=0;#T=null;#M=1/0;#N=!1;#R=null;#D=null;#K=null;#Y=null;#x=!1;#H=0;#F=0;#X=!1;constructor(A,N){this.#e=A||{mode:"stream"},this.#t=N||{},this.#a=n(this.#t),this.#l=new E(4096),this.#P=this.#qe();const $=(this.#t.config||{}).ingest;this.#x=!!$&&$.retainSource===!1,I(this.#e.open)||b("source.stream.open",'source.mode "stream" requires an open function; the grid will stay empty.'),this.#e.autoStart!==!1&&queueMicrotask(()=>this.start());const H=Number(this.#e.poll);Number.isFinite(H)&&H>0&&(this.#Y=setInterval(()=>{this.#v||this.reload()},H),this.#Y&&I(this.#Y.unref)&&this.#Y.unref()),this.#B()}#V(){const A=Number(this.#e.maxAge);return Number.isFinite(A)&&A>0?A:0}#B(){const A=this.#V();if(!A)return;const N=this.#e.ageBy;I(N)?this.#D=N:typeof N=="string"&&N?this.#D=$=>o($,N):this.#D=null,this.#T=[],this.#R=setInterval(()=>{this.#v||this.#W()&&(this.#Ee(),this.#_())},_(A)),this.#R&&I(this.#R.unref)&&this.#R.unref()}#W(){const A=this.#V();return!A||!this.#T?!1:this.#N?!0:this.#M<Date.now()-A*(1+W)}#ge(A,N){if(!this.#T)return;const $=this.#D?T(this.#D(N)):Date.now();this.#T[A]=$,Number.isNaN($)||($<this.#M&&(this.#M=$),$<Date.now()-this.#V()&&(this.#N=!0))}#se(){return this.#Oe("groupBy",[]).length>0?!0:!!this.#Oe("pivotMode",!1)&&this.#Oe("pivotBy",[]).length>0}#ue(){if(this.#g||this.#v)return;const A=this.#se();if(A&&!this.#b){this.#b=f({mode:"memory",rows:this.#n},this.#Me()),this.#O=!1;return}!A&&this.#b&&(this.#b.destroy(),this.#b=null)}#Me(){if(this.#y)return this.#y;const A=this,N={liveIndices:()=>A.#fe(),live:$=>A.#n[$]!==void 0,source:$=>A.#ee($),get physical(){return A.#n.length}};return this.#x&&(N.column=$=>{const H=A.#t.store;return H&&I(H.column)?H.column($):void 0}),this.#y=Object.create(this.#t,{store:{value:N,enumerable:!0,configurable:!0}}),this.#y}#fe(){const A=new Uint32Array(this.#n.length);let N=0;for(let $=0;$<this.#n.length;$++)this.#n[$]!==void 0&&(A[N++]=$);return A.subarray(0,N)}#oe(){return this.#g?this.#g:this.#b?(this.#O&&(this.#O=!1,this.#b.setRows(this.#n)),this.#b):null}invalidate(A="filter"){if(this.#g){this.#g.invalidate(A);return}this.#ue(),this.#b&&this.#b.invalidate(A),(A==="filter"||A==="sort")&&this.#Te()}count(){const A=this.#oe();return A?A.count():this.#r?this.#r.length:this.#S}matchCount(){const A=this.#oe();return A&&I(A.matchCount)?A.matchCount():this.#r?this.#r.length:this.#S}totalCount(){const A=this.#oe();return A&&I(A.totalCount)?A.totalCount():this.#S}unfilteredRows(){const A=this.#oe();if(A&&I(A.unfilteredRows))return A.unfilteredRows();const N=[];for(let $=0;$<this.#n.length;$++){if(!this.#n[$])continue;const H=this.#je($);H&&N.push(H)}return N}at(A){const N=this.#oe();if(N)return N.at(A);if(A<0||A>=this.count())return;const $=this.#r?this.#r.at(A):A,H=this.#je($);return H.index=A,H}byKey(A){const N=this.#oe();if(N)return N.byKey(A);const $=this.#o.get(A);return $===void 0?void 0:this.#je($)}leavesOf(A){const N=this.#oe();return N&&I(N.leavesOf)?N.leavesOf(A):[]}loaded(A){return A>=0&&A<this.count()}hint(A,N){if(this.#g){this.#g.hint(A,N);return}this.#He(),this.#p=Math.max(0,Math.floor(A))}#He(){this.#v||this.#qe()===this.#P||this.reload()}display(){const A=this.#oe();return A?A.display():m(()=>this.count(),N=>this.at(N))}apply(A){if(this.#g)return this.#g.apply(A);const N={added:[],updated:[],removed:[]};if(!A)return N;if(A.update){let $=!1;for(const H of A.update){const Y=this.#o.get(this.#a.keyOf(H,-1));if(Y===void 0)continue;const Z=this.#Se(Y);this.#x?this.#Le(Y,H):this.#n[Y]=H,this.#l.delete(Y),this.#ye(Y,Z),this.#T&&(this.#ge(Y,H),$=!0),this.#O=!0,N.updated.push(this.#je(Y))}$&&this.#Ee()}if(A.add&&A.add.length){const $=this.#ne(A.add);for(const H of $)N.added.push(this.#je(H))}return A.remove&&A.remove.length&&b("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#_(),N}reload(A){this.#c.abortAll("reload"),this.#Ye(),this.#b&&(this.#b.destroy(),this.#b=null),this.#O=!1,this.#n=[],this.#r=null,this.#o.clear(),this.#l.clear(),this.#g=null,this.#S=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.#qe(),this.#Pe("model:changed",{reason:"reload"}),this.start()}destroy(){this.#v=!0,this.#Y!==null&&(clearInterval(this.#Y),this.#Y=null),this.#R!==null&&(clearInterval(this.#R),this.#R=null),this.#T=null,this.#c.abortAll("destroyed"),this.#Ye(),this.#f!==null&&(this.#ke(this.#f),this.#f=null),this.#b&&(this.#b.destroy(),this.#b=null),this.#g&&this.#g.destroy(),this.#n=[],this.#r=null,this.#o.clear(),this.#l.clear()}async start(){if(this.#A||this.#v||!I(this.#e.open))return;this.#A=!0;const A=this.#c.begin("stream");this.#Te(),this.#ue();let N;try{N=this.#e.open({sort:this.#Oe("sort",[]),filters:this.#Oe("filters",null),quick:this.#Oe("quick","")||void 0,context:this.#Oe("context",null),signal:A.signal})}catch(H){this.#Pe("source:error",{error:H});return}const $=I(N[Symbol.asyncIterator])?N[Symbol.asyncIterator]():N[Symbol.iterator]();this.#K=$;try{for(;;){const H=await $.next();if(!A.current||this.#v)return;if(H.done){this.#$();return}if(await this.#xe(H.value,A),!A.current||this.#v)return;if(H.value&&H.value.done){this.#$();return}if(await this.#he(),!A.current||this.#v)return}}catch(H){if(s(H))return;this.#Pe("source:error",{error:H})}finally{A.settle()}}progress(){return{loaded:this.#u.loaded,estimated:this.#u.estimated,done:this.#w,live:this.#S,evicted:this.#C}}promoted(){return this.#g!==null}memorySource(){return this.#g}invalidateHandles(){const A=this.#oe();A&&(I(A.invalidateHandles)&&A.invalidateHandles(),I(A.invalidate)&&A.invalidate("sort"))}renderCount(){return this.#d}ingestStats(){return{worker:this.#H,inline:this.#F,storeBacked:this.#x}}#xe(A,N){if(!A)return;const $=A.rows;if($&&$.length&&this.#ae($))return this.#le(A,N);const H=Q();$&&$.length&&(this.#ne($),this.#F++),this.#Ce(A),this.#h+=Q()-H,this.#_()}#Ce(A){this.#u.loaded=A.progress&&typeof A.progress.loaded=="number"?A.progress.loaded:this.#n.length,A.progress&&typeof A.progress.estimated=="number"&&(this.#u.estimated=A.progress.estimated)}#ae(A){if(this.#X||this.#g)return!1;const N=this.#Z();if(!N)return!1;const $=this.#t.store;if(!$||!I($.appendPacked))return!1;const H=this.#G();return!H||!d(H)?(this.#X=!0,u("source.stream.ingest-worker","stream ingest.useWorker is on but a column reads through a closure (a computed or date column); columnizing on the main thread instead."),!1):A.length<N.threshold?!1:!this.#Ae(A)}#Ae(A){if(!this.#a.keyed)return!1;const N=new Set;for(let $=0;$<A.length;$++){const H=this.#a.keyOf(A[$],this.#n.length+$);if(H!=null){if(N.has(H)||this.#o.has(H))return!0;N.add(H)}}return!1}async#le(A,N){const $=A.rows,H=this.#Z(),Y=this.#G();let Z;try{Z=await H.columnize(Y,$,{key:"ingest:stream",signal:N&&N.signal})}catch(X){if(s(X)||(b("source.stream.columnize","worker columnization failed; columnizing on the main thread",X),this.#X=!0,N&&(!N.current||this.#v)))return;this.#ne($),this.#F++,this.#Ce(A),this.#_();return}if(N&&(!N.current||this.#v))return;const J=this.#t.store,D=this.#x?void 0:$,{from:te}=J.appendPacked(Z,D),z=Z.count|0;for(let X=0;X<z;X++){const ne=te+X,se=$[X],ue=this.#a.keyed?this.#a.keyOf(se,ne):null;if(this.#n[ne]=this.#x?v:se,this.#S++,this.#ge(ne,se),ue!==null&&this.#o.set(ue,ne),!this.#r||!this.#we(ne))continue;const ge=this.#de(ne);this.#r.insert(ge,ne),ge<=this.#p&&this.#m++}this.#O=!0,this.#Ee(),this.#H++,this.#Ce(A),this.#_()}#Z(){const A=this.#t.ingestWorker;return I(A)?A():null}#G(){const A=this.#t.storeSchema;return I(A)?A():null}#ne(A){const N=[],$=this.#t.store,H=new Array(A.length),Y=[],Z=new Set;for(let D=0;D<A.length;D++){const te=this.#a.keyed?this.#a.keyOf(A[D],this.#n.length+Y.length):null;H[D]=te,!(te!==null&&(this.#o.has(te)||Z.has(te)))&&(te!==null&&Z.add(te),Y.push(A[D]))}let J=Y.length&&$&&I($.append)?$.append(Y).from:this.#n.length;for(let D=0;D<A.length;D++){const te=A[D],z=H[D];if(z!==null&&this.#o.has(z)){const se=this.#o.get(z),ue=this.#Se(se);this.#x||(this.#n[se]=te,$&&I($.setSource)&&$.setSource(se,te)),this.#Le(se,te),this.#l.delete(se),this.#ge(se,te),this.#ye(se,ue);continue}const X=J++;if(this.#n[X]=this.#x?v:te,this.#S++,this.#ge(X,te),z!==null&&this.#o.set(z,X),N.push(X),!this.#r||!this.#we(X))continue;const ne=this.#de(X);this.#r.insert(ne,X),ne<=this.#p&&this.#m++}return this.#O=!0,this.#Ee(),N}#U(A){const N=this.#n[A];let $=!1;if(this.#r){const J=this.#be(A);J>=0&&J<=this.#p&&($=!0)}else A<=this.#p&&($=!0);const H=N===v?this.#ee(A):N,Y=this.#a.keyed?this.#a.keyOf(H,A):null;Y!==null&&this.#o.get(Y)===A&&this.#o.delete(Y),this.#n[A]=void 0,this.#T&&(this.#T[A]=NaN),this.#l.delete(A);const Z=this.#t.store;return Z&&I(Z.remove)&&Z.remove(A),this.#S--,$}#Ee(){let A=0,N=0;const $=this.#pe();A+=$.dropped,N+=$.aboveAnchor;const H=this.#re();A+=H.dropped,N+=H.aboveAnchor,A&&(this.#O=!0,this.#C+=A,this.#Te(),this.#m-=N,this.#Pe("stream:evicted",{evicted:A,total:this.#C,live:this.#S}))}#re(){const A=this.#e.maxRows;if(!Number.isFinite(A)||A<=0||this.#S<=A)return{dropped:0,aboveAnchor:0};const N=Math.max(1,Math.floor(A*(1-W)));let $=0,H=0;for(;this.#S>N&&this.#E<this.#n.length;){const Y=this.#E++;this.#n[Y]!==void 0&&(this.#U(Y)&&H++,$++)}return{dropped:$,aboveAnchor:H}}#pe(){const A=this.#V();if(!A||!this.#T||!this.#W())return{dropped:0,aboveAnchor:0};const N=Date.now()-A;let $=0,H=0,Y=1/0;for(let Z=this.#E;Z<this.#n.length;Z++){if(this.#n[Z]===void 0)continue;const J=this.#T[Z];if(!(Number.isNaN(J)||J===void 0)){if(J>=N){J<Y&&(Y=J);continue}this.#U(Z)&&H++,$++}}for(this.#M=Y,this.#N=!1;this.#E<this.#n.length&&this.#n[this.#E]===void 0;)this.#E++;return{dropped:$,aboveAnchor:H}}#be(A){if(!this.#r)return A;for(let N=0;N<this.#r.length;N++)if(this.#r.at(N)===A)return N;return-1}#Te(){this.#i=this.#Oe("sort",[]),this.#s=this.#Oe("filters",null);const A=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#V()>0,N=this.#Oe("where",null),$=(this.#t.config||{}).hostFilter,H=!!(N&&N.active)||!!($&&I($.active)&&$.active());if(!(A||this.#i.length>0||!!this.#s||!!this.#Oe("quick","")||H)){this.#r=null;return}this.#r=new a(Math.max(64,this.#n.length+64));for(let Z=0;Z<this.#n.length;Z++)this.#n[Z]!==void 0&&this.#we(Z)&&this.#r.insert(this.#de(Z),Z)}#we(A){const N=this.#ee(A);if(this.#s&&!this.#ve(this.#s,N))return!1;const $=String(this.#Oe("quick","")||"").toLowerCase();if($&&!this.#k(N).includes($))return!1;const H=(this.#t.config||{}).hostFilter;if(H&&I(H.active)&&H.active()&&!H.passes(this.#je(A)))return!1;const Y=this.#Oe("where",null);if(Y&&Y.active){const Z=this.#je(A);if(!Y.passes(Z.data,Z.key))return!1}return!0}#ve(A,N){if(!A)return!0;const $=A;if(Array.isArray($.conditions))return $.op==="or"?$.conditions.some(Z=>this.#ve(Z,N)):$.op==="not"?!$.conditions.some(Z=>this.#ve(Z,N)):$.conditions.every(Z=>this.#ve(Z,N));const H=A,Y=(this.#t.compute||{}).testValue;return I(Y)?!!Y(this.#Ve(N,H.col),H,(this.#t.config||{}).locale):(b("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#Se(A){if(!this.#r)return-1;if(!this.#i.length)return this.#be(A);let N=0,$=this.#r.length;for(;N<$;){const H=N+$>>>1;this.#J(this.#r.at(H),A)<0?N=H+1:$=H}for(let H=N;H<this.#r.length;H++){const Y=this.#r.at(H);if(Y===A)return H;if(this.#J(Y,A)>0)break}return this.#be(A)}#ye(A,N){if(!this.#r||!this.#i.length)return;const $=this.#we(A);if(N>=0&&this.#r.at(N)===A)this.#r.removeAt(N),N<=this.#p&&this.#m--;else if(N>=0)return;if(!$)return;const H=this.#de(A);this.#r.insert(H,A),H<=this.#p&&this.#m++}#de(A){if(!this.#r||!this.#i.length)return this.#r?this.#r.length:0;let N=0,$=this.#r.length;for(;N<$;){const H=N+$>>>1;this.#J(A,this.#r.at(H))<0?$=H:N=H+1}return N}#J(A,N){const $=this.#ee(A),H=this.#ee(N);for(const Y of this.#i){const Z=this.#Ie(Y.col),J=this.#Ve($,Y.col),D=this.#Ve(H,Y.col),z=(Z&&Z.value&&I(Z.value.compare)?Z.value.compare:j)(J,D);if(z!==0)return Y.dir==="desc"?-z:z}return 0}#$(){this.#w=!0,this.#u.loaded=this.#u.loaded||this.#n.length;const A=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:w;!this.#x&&this.#n.length<A&&(this.#g=f({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.#_(),this.#Pe("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:A})}#_(){this.#f!==null||this.#v||(this.#f=this.#I(()=>{this.#f=null,this.#d++;const A=this.#m;this.#m=0,this.#h=0,this.#Pe("stream:chunk",{loaded:this.#u.loaded,estimated:this.#u.estimated,count:this.count(),renders:this.#d}),this.#Pe("model:changed",{reason:"stream",shiftAboveViewport:A,anchor:this.#p}),this.#Pe("rows:changed",{companion:!0,reason:"stream"})}))}#he(){return this.#d===0||this.#h<this.#ie()?Promise.resolve():(this.#h=0,new Promise(A=>{const N=(this.#t.scheduler||{}).idle;I(N)?N(()=>A()):q(()=>A())}))}#ie(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:P}#I(A){const N=this.#t.scheduler||{};return I(N.frame)?N.frame(A):U(A)}#ke(A){const N=this.#t.scheduler||{};I(N.cancel)?N.cancel(A):x(A)}#ee(A){const N=this.#n[A];if(N!==void 0&&N!==v)return N;if(N===void 0)return;const $=this.#t.store;return $&&I($.source)?$.source(A):void 0}#Le(A,N){const $=this.#t.store;if(!$||!I($.set))return;const H=this.#G();if(Array.isArray(H))for(const Y of H){if(!Y||!Y.id)continue;const Z=I(Y.read)?Y.read:J=>o(J,Y.field||Y.id);$.set(Y.id,A,Z(N))}}#je(A){let N=this.#l.get(A);return N||(N=this.#a.leaf(this.#ee(A),A),this.#l.set(A,N)),N}#Ve(A,N){const $=this.#Ie(N);return $&&I($.getValue)?$.getValue(A):A?.[N]}#k(A){const N=this.#t.columns,$=N&&I(N.all)?N.all():[],H=[];for(const Y of $){const Z=I(Y.getValue)?Y.getValue(A):void 0;Z!=null&&Z!==""&&H.push(String(Z))}return H.join(" ").toLowerCase()}#Ie(A){const N=this.#t.columns;return N&&I(N.get)?N.get(A):void 0}#Ye(){const A=this.#K;if(this.#K=null,A&&I(A.return))try{A.return()}catch{}}#qe(){return y({context:this.#Oe("context",null)})}#Oe(A,N){const $=this.#t.state;if($&&I($[A])){const H=$[A]();return H??N}return N}#Pe(A,N){const $=this.#t.emit;I($)&&$(A,N)}}}),_e("packages/core/src/source/url.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return b}});const E=F("packages/core/src/internal/warn.js").warnOnce,K=F("packages/core/src/internal/predicates.js"),I=K.isObject,L=K.isFunction,U=F("packages/core/src/internal/paths.js").getPath,q=F("packages/core/src/source/abort.js").isAbortError,R=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 b(p,y={}){const h=I(y)?y:{},d=L(h.fetch)?h.fetch:typeof globalThis<"u"&&L(globalThis.fetch)?globalThis.fetch:null,w=h.format==="json"||h.format==="ndjson"?h.format:void 0,v=typeof h.rowsPath=="string"&&h.rowsPath?h.rowsPath:void 0,P=L(h.map)?h.map:void 0,W=I(h.headers)?h.headers:void 0,V=Number.isFinite(h.batchSize)&&h.batchSize>0?Math.floor(h.batchSize):R,G=h.lenient===!0,_=Number.isFinite(h.poll)&&h.poll>0?Math.floor(h.poll):void 0,T=typeof p=="string"&&p.length>0;T||E("source.url.url","createUrlSource needs a URL string; the grid will stay empty.");async function*S(M={}){if(!T)return;if(!d)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const A=M&&M.signal;let N;try{N=await d(p,W?{signal:A,headers:W}:{signal:A})}catch(Y){throw q(Y)?Y:new Error(`[lattice] createUrlSource: request to ${p} failed — ${Y&&Y.message||Y}`)}if(!N||!N.ok){const Y=N?N.status:"no response";throw new Error(`[lattice] createUrlSource: ${Y} for ${p}`)}const $=u(p,w,N),H=N.body&&L(N.body.getReader)?N.body.getReader():null;try{if(!H){const J=await N.text();($||t(J,p))==="ndjson"?yield*l(null,null,J,0,N,p,V,G):yield*m(J,p,v,P);return}const Y=new TextDecoder("utf-8");if($==="json"){yield*m(await n(H,Y,""),p,v,P);return}if($==="ndjson"){yield*l(H,Y,"",0,N,p,V,G);return}const Z=await i(H,Y,p);Z.format==="json"?yield*m(await n(H,Y,Z.seed),p,v,P):yield*l(H,Y,Z.seed,Z.bytes,N,p,V,G)}finally{if(H&&L(H.cancel))try{await H.cancel()}catch{}}}const O={mode:"stream",open:S,autoStart:h.autoStart!==!1};return _!==void 0&&(O.poll=_),Number.isFinite(h.maxRows)&&(O.maxRows=h.maxRows),Number.isFinite(h.maxAge)&&(O.maxAge=h.maxAge),(typeof h.ageBy=="string"||L(h.ageBy))&&(O.ageBy=h.ageBy),Number.isFinite(h.coalesceMs)&&(O.coalesceMs=h.coalesceMs),Number.isFinite(h.promoteToMemoryBelow)&&(O.promoteToMemoryBelow=h.promoteToMemoryBelow),O}function u(p,y,h){if(y)return y;const d=g(p);if(d)return d;const w=h&&h.headers&&L(h.headers.get)?h.headers.get("content-type"):null;return o(w)}function g(p){const y=String(p).split(/[?#]/)[0].toLowerCase();if(y.endsWith(".ndjson")||y.endsWith(".jsonl"))return"ndjson";if(y.endsWith(".json"))return"json"}function o(p){if(!p)return;const y=p.split(";")[0].trim().toLowerCase();if(j.has(y))return"ndjson";if(y==="application/json"||y==="text/json"||y.endsWith("+json"))return"json"}function t(p,y){const h=p.replace(/^\s+/,""),d=s(h);if(d==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${y} — pass opts.format: 'json' | 'ndjson'.`);return d}async function i(p,y,h){let d="",w=0;for(;;){const{value:P,done:W}=await p.read();if(P&&(w+=P.byteLength,d+=y.decode(P,{stream:!0})),W){d+=y.decode();break}const V=d.replace(/^\s+/,"");if(V){if(V[0]==="[")return{format:"json",seed:d,bytes:w};if(V[0]!=="{"||d.indexOf(`
|
|
7
|
+
`||m==="\r"){n++;continue}if(m>="0"&&m<="9"){n=k(s,n,r);continue}if(m==="."&&s[n+1]>="0"&&s[n+1]<="9"){n=k(s,n,r);continue}if(m==='"'||m==="'"){n=b(s,n,r);continue}if(m==="["){const a=s.indexOf("]",n+1);if(a<0)throw new q("a [column reference] was opened and never closed",n);r.push({kind:K,value:s.slice(n+1,a).trim(),at:n}),n=a+1;continue}if(j(m)){n=u(s,n,r);continue}const l=s.slice(n,n+2);if(U.includes(l)){r.push({kind:L,value:l==="!="?"<>":l,at:n}),n+=2;continue}if(x.includes(m)){r.push({kind:L,value:m,at:n}),n++;continue}throw new q(`unexpected character ${JSON.stringify(m)}`,n)}return r.push({kind:Q,value:null,at:s.length}),r}function j(s){return/[A-Za-z_À-]/.test(s)}function k(s,r,n){let m=r,l=!1;for(;m<s.length;){const a=s[m];if(a>="0"&&a<="9"){m++;continue}if(a==="."&&!l){l=!0,m++;continue}if((a==="e"||a==="E")&&/[0-9+-]/.test(s[m+1]||"")){for(m+=2;m<s.length&&s[m]>="0"&&s[m]<="9";)m++;break}break}return n.push({kind:ie,value:Number(s.slice(r,m)),at:r}),m}function b(s,r,n){const m=s[r];let l=r+1,a="";for(;l<s.length;){if(s[l]===m){if(s[l+1]===m){a+=m,l+=2;continue}return n.push({kind:E,value:a,at:r}),l+1}a+=s[l],l++}throw new q("a string was opened and never closed",r)}function u(s,r,n){let m=r;for(;m<s.length&&/[A-Za-z0-9_.À-]/.test(s[m]);)m++;const l=s.slice(r,m);let a=m;for(;a<s.length&&s[a]===" ";)a++;return n.push({kind:s[a]==="("?I:K,value:l,at:r}),m}const g={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function o(s){const r=String(s??"").replace(/^\s*=/,"");if(!r.trim())throw new q("the formula is empty");const n=R(r);let m=0;const l=()=>n[m],a=()=>n[m++],c=v=>{const P=l();if(P.kind!==L||P.value!==v)throw new q(`expected ${JSON.stringify(v)}`,P.at);m++},f=v=>{let P=p();for(;;){const W=l();if(W.kind!==L)break;const V=g[W.value];if(!V||V<v)break;m++;const G=f(W.value==="^"?V:V+1);P={kind:"bin",op:W.value,left:P,right:G}}return P},p=()=>{const v=l();return v.kind===L&&(v.value==="-"||v.value==="+")?(m++,{kind:"unary",op:v.value,arg:p()}):y()},y=()=>{let v=h();for(;l().kind===L&&l().value==="%";)m++,v={kind:"unary",op:"%",arg:v};return v},h=()=>{const v=a();if(v.kind===ie)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===I){c("(");const P=[];if(!(l().kind===L&&l().value===")"))for(;;){if(P.push(f(1)),l().kind===L&&l().value===","){m++;continue}break}return c(")"),{kind:"call",name:String(v.value).toUpperCase(),args:P}}if(v.kind===L&&v.value==="("){const P=f(1);return c(")"),P}throw v.kind===Q?new q("the formula ends unexpectedly",v.at):new q(`unexpected ${JSON.stringify(v.value)}`,v.at)},d=f(1),w=l();if(w.kind!==Q)throw new q(`unexpected ${JSON.stringify(w.value)}: is an operator missing?`,w.at);return d}function t(s){const r=new Set,n=m=>{if(!(!m||typeof m!="object")){if(m.kind==="ref"){r.add(String(m.name));return}if(m.kind==="bin"){n(m.left),n(m.right);return}if(m.kind==="unary"){n(m.arg);return}if(m.kind==="call")for(const l of m.args)n(l)}};return n(s),[...r]}function i(s){return typeof s=="string"&&/^\s*=/.test(s)&&s.trim()!=="="}}),_e("packages/core/src/formula/evaluate.js",function(e,F){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return k}});const E=F("packages/core/src/formula/parse.js").FormulaError;function K(b){if(b==null||b==="")return 0;if(typeof b=="boolean")return b?1:0;if(b instanceof Date)return b.getTime();const u=typeof b=="number"?b:Number(String(b).replace(/[,\s]/g,""));if(!Number.isFinite(u))throw new E(`${JSON.stringify(b)} is not a number`);return u}function I(b){return b==null?"":String(b)}function L(b){if(typeof b=="boolean")return b;if(b==null||b==="")return!1;if(typeof b=="number")return b!==0;const u=String(b).trim().toLowerCase();return u==="false"||u==="no"||u==="0"?!1:u!==""}function Q(b){const u=[];for(const g of b){if(Array.isArray(g)){for(const o of g)o!=null&&o!==""&&u.push(K(o));continue}g==null||g===""||u.push(K(g))}return u}function U(b,u){const g=10**u,o=b*g;return Math.sign(o)*Math.round(Math.abs(o)+Number.EPSILON*Math.abs(o))/g}function x(b,u){if(!b.length)return 0;const g=b.slice().sort((s,r)=>s-r),o=(g.length-1)*Math.min(1,Math.max(0,u)),t=Math.floor(o),i=Math.ceil(o);return t===i?g[t]:g[t]+(o-t)*(g[i]-g[t])}function q(b,u){let g=0,o=0,t=0;for(const s of b){g++;const r=s-o;o+=r/g,t+=r*(s-o)}const i=u?g-1:g;return i>0?Math.sqrt(t/i):0}const R={SUM:b=>Q(b).reduce((u,g)=>u+g,0),AVERAGE:b=>{const u=Q(b);return u.length?u.reduce((g,o)=>g+o,0)/u.length:0},MIN:b=>{const u=Q(b);return u.length?Math.min(...u):0},MAX:b=>{const u=Q(b);return u.length?Math.max(...u):0},COUNT:b=>Q(b).length,PRODUCT:b=>Q(b).reduce((u,g)=>u*g,1),ROUND:b=>U(K(b[0]),b.length>1?K(b[1]):0),ROUNDDOWN:b=>{const u=10**(b.length>1?K(b[1]):0),g=K(b[0])*u;return(g<0?Math.ceil(g):Math.floor(g))/u},ROUNDUP:b=>{const u=10**(b.length>1?K(b[1]):0),g=K(b[0])*u;return(g<0?Math.floor(g):Math.ceil(g))/u},ABS:b=>Math.abs(K(b[0])),FLOOR:b=>Math.floor(K(b[0])),CEILING:b=>Math.ceil(K(b[0])),SQRT:b=>Math.sqrt(K(b[0])),POWER:b=>K(b[0])**K(b[1]),MOD:b=>{const u=K(b[1]);if(u===0)throw new E("MOD by zero");return(K(b[0])%u+u)%u},IF:b=>L(b[0])?b[1]:b.length>2?b[2]:!1,AND:b=>b.every(L),OR:b=>b.some(L),NOT:b=>!L(b[0]),COALESCE:b=>b.find(u=>u!=null&&u!=="")??null,CONCAT:b=>b.map(I).join(""),LEN:b=>I(b[0]).length,UPPER:b=>I(b[0]).toUpperCase(),LOWER:b=>I(b[0]).toLowerCase(),TRIM:b=>I(b[0]).trim(),LEFT:b=>I(b[0]).slice(0,b.length>1?K(b[1]):1),RIGHT:b=>{const u=b.length>1?K(b[1]):1;return u<=0?"":I(b[0]).slice(-u)},MEDIAN:b=>x(Q(b),.5),PERCENTILE:b=>{const u=K(b[b.length-1]);return x(Q(b.slice(0,-1)),u>1?u/100:u)},QUARTILE1:b=>x(Q(b),.25),QUARTILE3:b=>x(Q(b),.75),STDEV:b=>q(Q(b),!0),STDEVP:b=>q(Q(b),!1),VAR:b=>{const u=q(Q(b),!0);return u*u},VARP:b=>{const u=q(Q(b),!1);return u*u},COUNTDISTINCT:b=>{const u=new Set;for(const g of b){const o=Array.isArray(g)?g:[g];for(const t of o)t!=null&&t!==""&&u.add(t)}return u.size},IQR:b=>{const u=Q(b);return x(u,.75)-x(u,.25)}};R.AVG=R.AVERAGE,R.CEIL=R.CEILING,R.POW=R.POWER,R.STDEVS=R.STDEV,R.PERCENTILEINC=R.PERCENTILE;function j(b,u){const g=Number(b),o=Number(u);if(b!==null&&b!==""&&u!==null&&u!==""&&Number.isFinite(g)&&Number.isFinite(o))return g<o?-1:g>o?1:0;const i=I(b).toLowerCase(),s=I(u).toLowerCase();return i<s?-1:i>s?1:0}function k(b,u={}){const g=typeof u.lookup=="function"?u.lookup:null,o=u.functions?{...R,...u.functions}:R,t=i=>{switch(i.kind){case"num":return i.value;case"str":return i.value;case"ref":{if(!g)throw new E(`there is no column called ${JSON.stringify(i.name)} here`);const s=g(String(i.name));if(s===void 0)throw new E(`there is no column called ${JSON.stringify(i.name)}`);return s}case"unary":{if(i.op==="%")return K(t(i.arg))/100;const s=K(t(i.arg));return i.op==="-"?-s:s}case"bin":{const s=i.op;if(s==="=")return j(t(i.left),t(i.right))===0;if(s==="<>")return j(t(i.left),t(i.right))!==0;if(s==="<")return j(t(i.left),t(i.right))<0;if(s==="<=")return j(t(i.left),t(i.right))<=0;if(s===">")return j(t(i.left),t(i.right))>0;if(s===">=")return j(t(i.left),t(i.right))>=0;const r=K(t(i.left)),n=K(t(i.right));if(s==="+")return r+n;if(s==="-")return r-n;if(s==="*")return r*n;if(s==="^")return r**n;if(s==="/"){if(n===0)throw new E("division by zero");return r/n}throw new E(`unknown operator ${JSON.stringify(s)}`)}case"call":{const s=u.lazy&&u.lazy[i.name];if(typeof s=="function")return s(i.args,t,u);const r=o[i.name];if(typeof r!="function")throw new E(`there is no function called ${i.name}`);return r(i.args.map(t),u)}default:throw new E("the formula could not be read")}};return t(b)}}),_e("packages/core/src/formula/index.js",function(e,F){"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 I}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return j}});const ie=F("packages/core/src/formula/parse.js"),E=ie.parseFormula,K=ie.referencesOf,I=ie.looksLikeFormula,L=ie.FormulaError,Q=ie.tokenise,U=F("packages/core/src/formula/evaluate.js"),x=U.evaluateAst,q=U.FUNCTIONS;function R(k){const{grid:b,row:u,data:g}=k||{},o=n=>String(n).toLowerCase().replace(/[\s_-]/g,""),t=b&&b.columns&&typeof b.columns.all=="function"?b.columns.all():[],i=b&&b.permissions,s=i&&typeof i.isReadable=="function"?n=>i.isReadable(n):()=>!0,r=new Set;for(const n of t)s(n)||(r.add(o(n.id)),n.field&&r.add(o(n.field)),n.title&&r.add(o(n.title)));return n=>{const m=o(n);if(r.has(m))throw new L(`"${n}" cannot be read`);for(const l of t)if(o(l.id)===m||l.field&&o(l.field)===m||l.title&&o(l.title)===m)return u&&b.rows&&typeof b.rows.value=="function"?b.rows.value(u.key,l.id):g?g[l.field||l.id]:void 0;if(g&&typeof g=="object"){for(const l of Object.keys(g))if(o(l)===m){if(!s(l))throw new L(`"${n}" cannot be read`);return g[l]}}}}function j(k,b={}){try{const u=E(k);return{ok:!0,value:x(u,{lookup:R(b),functions:b.formulaFunctions}),references:K(u)}}catch(u){return{ok:!1,error:u instanceof L?u.message:"the formula could not be read",at:u instanceof L?u.at:void 0}}}}),_e("packages/core/src/internal/version.js",function(e,F){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return K}});const ie="1.117.3";async function E(){return ie}const K="1.117.3"}),_e("packages/core/src/internal/merge.js",function(e,F){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"mergeRow",{enumerable:!0,get:function(){return U}});const E=F("packages/core/src/internal/predicates.js").isObject;function K(x,q,R){if(x!==void 0)return x===!0?{enabled:!0,...R}:x===!1?{enabled:!1}:E(x)?x:{[q]:x,enabled:!0}}function I(x){return x==null?[]:Array.isArray(x)?x:[x]}const L=Object.freeze(new Set(["__proto__","constructor","prototype"]));function Q(x,q){if(!E(x))return E(q)?{...q}:q;if(!E(q))return q===void 0?x:q;const R={...x};for(const j of Object.keys(q)){if(L.has(j))continue;const k=q[j];k!==void 0&&(R[j]=E(k)&&E(R[j])?Q(R[j],k):k)}return R}function U(x,q){if(!E(x)||!E(q)||x===q)return q;const R=Object.create(Object.getPrototypeOf(x));return Object.assign(R,x,q),R}}),_e("packages/core/src/internal/schedule.js",function(e,F){"use strict";Object.defineProperty(e,"now",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"nextFrame",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return U}});function ie(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const E=typeof requestAnimationFrame=="function";function K(x){return E?requestAnimationFrame(x):setTimeout(()=>x(ie()),16)}function I(x){x!=null&&(E?cancelAnimationFrame(x):clearTimeout(x))}function L(x){let q=null,R=null;const j=()=>{q=null;const b=R;R=null,x(...b||[])},k=(...b)=>{R=b,q===null&&(q=K(j))};return k.cancel=()=>{I(q),q=null,R=null},k.flush=()=>{q!==null&&(I(q),j())},k}function Q(x,q){let R=null,j=null;const k=()=>{if(R=null,j===null)return;const g=j;j=null,x(...g),b()},b=()=>{R=setTimeout(k,q),typeof R?.unref=="function"&&R.unref()},u=(...g)=>{R===null?(x(...g),b()):(j=g,clearTimeout(R),b())};return u.flush=()=>{if(R!==null&&clearTimeout(R),R=null,j===null)return;const g=j;j=null,x(...g)},u.cancel=()=>{R!==null&&clearTimeout(R),R=null,j=null},u.pending=()=>R!==null||j!==null,u}function U(x,q=50){return typeof requestIdleCallback=="function"?requestIdleCallback(x,{timeout:q}):setTimeout(()=>x({timeRemaining:()=>0,didTimeout:!0}),1)}}),_e("packages/core/src/internal/paths.js",function(e,F){"use strict";Object.defineProperty(e,"pathGetter",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"pathSetter",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"getPath",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return Q}});const ie=new Map;function E(U){let x=ie.get(U);if(x)return x;if(!U.includes("."))x=q=>q?.[U];else{const q=U.split("."),R=q.length;x=j=>{let k=j;for(let b=0;b<R;b++){if(k==null)return;k=k[q[b]]}return k}}return ie.set(U,x),x}const K=new Map;function I(U){let x=K.get(U);if(x)return x;if(!U.includes("."))x=(q,R)=>{q!=null&&(q[U]=R)};else{const q=U.split("."),R=q.length-1;x=(j,k)=>{let b=j;for(let u=0;u<R;u++){if(b==null)return;const g=q[u];b[g]==null&&(b[g]={}),b=b[g]}b!=null&&(b[q[R]]=k)}}return K.set(U,x),x}function L(U,x){return E(x)(U)}function Q(U,x,q){I(x)(U,q)}}),_e("packages/core/src/internal/compare.js",function(e,F){"use strict";Object.defineProperty(e,"collator",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"defaultCompare",{enumerable:!0,get:function(){return K}});const ie=new Map;function E(I,L){const Q=`${I||""}|${L?JSON.stringify(L):""}`;let U=ie.get(Q);return U||(U=new Intl.Collator(I||void 0,{numeric:!0,sensitivity:"variant",...L}),ie.set(Q,U)),U}function K(I,L){if(I===L)return 0;if(I==null)return 1;if(L==null)return-1;if(typeof I=="number"&&typeof L=="number")return Number.isNaN(I)?Number.isNaN(L)?0:1:Number.isNaN(L)||I<L?-1:I>L?1:0;const Q=String(I),U=String(L);return Q<U?-1:Q>U?1:0}}),_e("packages/core/src/defaults.js",function(e,F){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return j}});const E=F("packages/core/src/internal/predicates.js").isObject,I=F("packages/core/src/internal/merge.js").merge,Q=F("packages/core/src/internal/warn.js").warnOnce;let U=null;class x extends Error{}function q(k,b=new Set){if(Array.isArray(k)){if(b.has(k))throw new x;b.add(k);const g=k.map(o=>q(o,b));return b.delete(k),g}if(!E(k)||Object.getPrototypeOf(k)!==Object.prototype&&Object.getPrototypeOf(k)!==null)return k;if(b.has(k))throw new x;b.add(k);const u={};for(const[g,o]of Object.entries(k))u[g]=q(o,b);return b.delete(k),u}function R(k){if(k===void 0)return q(U??{});if(k===null)return U=null,{};if(!E(k))return Q("defaults:type",`defaults() expects a configuration object, or null to clear it, but got ${Array.isArray(k)?"an array":typeof k}. The call was ignored and the defaults are unchanged.`),q(U??{});try{U=q(k)}catch(b){if(!(b instanceof x))throw b;return Q("defaults:cyclic","defaults() expects a configuration object with no circular references, but the object passed refers back to itself. The call was ignored and the defaults are unchanged."),q(U??{})}return q(U)}function j(k){return U===null?k:I(q(U),k)}}),_e("packages/core/src/internal/uid.js",function(e,F){"use strict";Object.defineProperty(e,"uid",{enumerable:!0,get:function(){return E}});let ie=0;function E(K="l"){return`${K}${(++ie).toString(36)}`}}),_e("packages/core/src/events/names.js",function(e,F){"use strict";Object.defineProperty(e,"EVENT_NAMES",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"isKnownEvent",{enumerable:!0,get:function(){return K}});const ie=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(ie);function K(I){return I==="*"||E.has(I)}}),_e("packages/core/src/events/bus.js",function(e,F){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return g}});const ie=F("packages/core/src/internal/warn.js"),E=ie.warnOnce,K=ie.DEV,L=F("packages/core/src/internal/uid.js").uid,U=F("packages/core/src/events/names.js").isKnownEvent,x="*";function q(o,t){!K||U(t)||E(`bus.unknown:${t}`,`${o}('${t}') subscribes to an event the grid never raises, so the handler will never fire. Check the name against the EventName list — a common cause is a near miss such as 'row:click' for 'row:clicked'.`)}const R=new Set(["api","user","init","ai"]),j=new WeakMap;function k(o){let t=j.get(o);return t||(t=L("h"),j.set(o,t)),t}function b(){return typeof performance=="object"&&performance?performance.now():Date.now()}function u(o){if(!o||typeof o!="object")return{};const t={};for(const[i,s]of Object.entries(o))i!=="grid"&&(s==null?t[i]=String(s):Array.isArray(s)?t[i]=`[${s.length}]`:typeof s=="object"?t[i]=s.key?`row ${s.key}`:"{…}":typeof s=="function"?t[i]="[function]":t[i]=String(s).slice(0,60));return t}class g{#e=new Map;#t=!1;#n=[];#r=200;#i=new Map;#s=null;#a=!1;#l=0;constructor(t=null){this.#s=t}attach(t){this.#s=t}get grid(){return this.#s}get destroyed(){return this.#a}on(t,i){if(typeof i!="function")return E(`bus.handler:${t}`,`on('${t}') needs a function; ignored.`),()=>{};q("on",t);let s=this.#e.get(t);return s||(s=[],this.#e.set(t,s)),s.push(i),()=>this.off(t,i)}once(t,i){if(typeof i!="function")return E(`bus.handler:${t}`,`once('${t}') needs a function; ignored.`),()=>{};q("once",t);const s=r=>{this.off(t,i),i(r)};return this.#i.set(i,s),this.on(t,s)}off(t,i){if(i===void 0){this.#e.delete(t);return}const s=this.#e.get(t);if(!s)return;const r=this.#i.get(i),n=r&&s.includes(r)?r:i,m=s.indexOf(n);m>=0&&s.splice(m,1),r&&n===r&&this.#i.delete(i),s.length===0&&this.#e.delete(t)}count(t){const i=this.#e.get(t),s=t===x?null:this.#e.get(x);return(i?i.length:0)+(s?s.length:0)}#o(t,i,s,r,n){this.#n.push({type:t,origin:i,listeners:(r?r.length:0)+(n?n.length:0),payload:u(s),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(t,i){this.#t=!!t,Number.isFinite(i)&&i>0&&(this.#r=Math.floor(i)),t||(this.#n=[])}eventLog(){return this.#n.map(t=>({...t}))}clearEventLog(){this.#n=[]}counts(){const t={};for(const[i,s]of this.#e)t[i]=s.length;return t}emit(t,i,s){const r=s??(i&&i.origin),n=R.has(r)?r:"api",m={...i||null,type:t,origin:n,grid:this.#s};if(this.#a)return m;const l=this.#e.get(t),a=t===x?void 0:this.#e.get(x);if(this.#t&&this.#o(t,n,i,l,a),!l&&!a)return m;const c=this.#t?b():0;this.#l++;try{l&&this.#c(l.slice(),m,t),a&&this.#c(a.slice(),m,x)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=b()-c)}return m}emitBefore(t,i,s){const r=s??(i&&i.origin),n=R.has(r)?r:"user";let m=!1,l=null;const a=d=>{m=!0,d!=null&&l===null&&(l=String(d))},c={...i||null,type:t,origin:n,grid:this.#s,get defaultPrevented(){return m},get reason(){return l},preventDefault(d){a(d)}};if(this.#a)return!0;const f=this.#e.get(t);this.#t&&this.#o(t,n,i,f,void 0);const p=f?f.slice():[];if(p.length===0)return!0;const y=()=>(m&&l===null&&(l="prevented"),m&&i&&typeof i=="object"&&(i.reason=l),!m),h=[];for(const d of p)try{const w=d(c);w&&typeof w.then=="function"?h.push(w):w===!1&&a("prevented")}catch(w){a("error"),E(`bus.beforeThrow:${t}:${k(d)}`,`a '${t}' before-handler threw; the action was cancelled.`,w)}return h.length===0?y():Promise.allSettled(h).then(d=>{for(const w of d)w.status==="rejected"?(a("error"),E(`bus.beforeReject:${t}`,`a '${t}' before-handler rejected; the action was cancelled.`,w.reason)):w.value===!1&&a("prevented");return y()})}#c(t,i,s){for(let r=0;r<t.length;r++)try{t[r](i)}catch(n){E(`bus.throw:${s}:${k(t[r])}`,`a '${s}' handler threw; other handlers were unaffected.`,n)}}clear(){this.#e.clear(),this.#i.clear()}destroy(){this.clear(),this.#a=!0,this.#s=null}}}),_e("packages/core/src/registry/free-tier-notice.js",function(e,F){"use strict";Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"WATERMARK_TEXT",{enumerable:!0,get:function(){return E}});const ie="Free for non-commercial use: latticegrid.dev/free",E="Unlicensed: Lattice Grid trial"}),_e("packages/core/src/registry/licence.js",function(e,F){"use strict";Object.defineProperty(e,"PRODUCT",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"LICENCE_VERSION",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"fromBase64Url",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"toBase64Url",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"asciiBytes",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"parseLicence",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"hasEd25519",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"verifyLicence",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"isLocalHost",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"currentHost",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"matchesDomain",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"LicenceHolder",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"setLicence",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return T}});const E=F("packages/core/src/internal/warn.js").warnOnce,K=F("packages/core/src/registry/free-tier-notice.js"),I=K.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return K.FREE_TIER_NOTICE}});const L="lattice-grid",Q=1,U="LG1",x=64,q="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",R="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",j=(()=>{const S=new Int16Array(128).fill(-1);for(let O=0;O<R.length;O++)S[R.charCodeAt(O)]=O;return S[43]=62,S[47]=63,S})();function k(S){if(typeof S!="string")return null;let O="";for(let Y=0;Y<S.length;Y++){const Z=S.charCodeAt(Y);if(Z!==61){if(Z>127||j[Z]<0)return null;O+=S[Y]}}const M=O.length;if(M%4===1)return null;const A=new Uint8Array(Math.floor(M*3/4));let N=0,$=0,H=0;for(let Y=0;Y<M;Y++)N=N<<6|j[O.charCodeAt(Y)],$+=6,$>=8&&($-=8,A[H++]=N>>$&255);return H===A.length?A:A.subarray(0,H)}function b(S){let O="",M=0;for(;M+2<S.length;M+=3){const N=S[M]<<16|S[M+1]<<8|S[M+2];O+=R[N>>18&63]+R[N>>12&63]+R[N>>6&63]+R[N&63]}const A=S.length-M;if(A===1){const N=S[M]<<16;O+=R[N>>18&63]+R[N>>12&63]}else if(A===2){const N=S[M]<<16|S[M+1]<<8;O+=R[N>>18&63]+R[N>>12&63]+R[N>>6&63]}return O}function u(S){const O=new Uint8Array(S.length);for(let M=0;M<S.length;M++)O[M]=S.charCodeAt(M)&127;return O}function g(S){if(typeof TextDecoder=="function")return new TextDecoder().decode(S);let O="";for(let M=0;M<S.length;M++)O+=String.fromCharCode(S[M]);return O}function o(S){const O={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof S=="string"?S:""};if(typeof S!="string"||S.length===0)return{...O,reason:"missing"};const M=S.trim(),A=M.split(".");if(A.length!==3)return O;const[N,$,H]=A;if(N!==U)return{...O,reason:"prefix"};const Y=k($),Z=k(H);if(!Y||!Z)return O;let J;try{J=JSON.parse(g(Y))}catch{return O}return J===null||typeof J!="object"?O:{ok:!0,reason:null,product:typeof J.p=="string"?J.p:null,issuedTo:typeof J.t=="string"?J.t:null,expires:typeof J.e=="string"?J.e:null,terms:typeof J.terms=="string"?J.terms:null,features:Array.isArray(J.f)?J.f.slice():[],deployments:Array.isArray(J.d)?J.d.slice():[],version:typeof J.v=="number"?J.v:0,message:u($),signature:Z,raw:M}}function t(S,O){if(!S)return!1;const M=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(S)?`${S}T23:59:59.999Z`:S);return Number.isNaN(M)?!0:O>M}function i(S){return S==="non-commercial"?"non-commercial":"commercial"}let s=null,r=null,n=null;function m(){const S=globalThis.crypto;return S&&S.subtle?S.subtle:null}async function l(S){if(s&&r===S)return s;const O=m();if(!O)return null;const M=k(S);if(!M)return null;try{const A=await O.importKey("raw",M,{name:"Ed25519"},!1,["verify"]);return s=A,r=S,A}catch{return null}}async function a(){return n!==null||(n=await l(q)!==null),n}async function c(S,O={}){const M=O.warn!==!1,A=O.product||L,N=O.publicKey||q,$=O.now??Date.now(),H=O.host??p(),Y=f(H)?"":` ${I}`,Z=o(S);if(!Z.ok){const X=Z.reason==="missing"?"missing":"malformed";return M&&E(`licence.${X}`,X==="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.${Y}`:`licence key could not be read. The grid will render with a watermark.${Y}`),{valid:!1,reason:X,terms:"commercial"}}const J={product:Z.product||void 0,issuedTo:Z.issuedTo||void 0,expires:Z.expires||void 0,terms:i(Z.terms)};if(Z.product!==A)return M&&E("licence.product",`licence key is for '${Z.product}', not '${A}'. The grid will render with a watermark.`),{valid:!1,...J,reason:"product"};if(t(Z.expires,$))return M&&E("licence.expired",`licence expired on ${Z.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,...J,reason:"expired"};const D=Z.deployments||[];if(D.length&&H&&!f(H)&&!y(H,D))return M&&E("licence.domain",`licence key is not valid for ${H}; it covers ${D.join(", ")}. The grid will render with a watermark.`),{valid:!1,...J,reason:"domain"};const te=await l(N);if(!te){const X=!!Z.signature&&Z.signature.length===x;return M&&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."),X?{valid:!0,...J,reason:"unverified"}:{valid:!1,...J,reason:"signature"}}let z=!1;try{z=await m().verify({name:"Ed25519"},te,Z.signature,Z.message)}catch{z=!1}return z?{valid:!0,...J}:(M&&E("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...J,reason:"signature"})}function f(S){const O=String(S??p()??"").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 p(){const S=globalThis.location;return S&&typeof S.hostname=="string"?S.hostname:null}function y(S,O){const M=h(S);return!M||!Array.isArray(O)?!1:O.some(A=>{const N=h(A);if(!N)return!1;if(N==="*")return!0;if(N.startsWith("*.")){const $=N.slice(2);return M===$||M.endsWith(`.${$}`)}return M===N})}function h(S){return String(S??"").trim().toLowerCase().replace(/\.$/,"")}class d{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#i;#s=new Set;constructor(O={}){this.#i=O}set(O){this.#e=typeof O=="string"?O.trim():"";const M=o(this.#e);return this.#t=M.ok?{valid:!t(M.expires,Date.now())&&M.product===(this.#i.product||L),product:M.product||void 0,issuedTo:M.issuedTo||void 0,expires:M.expires||void 0,terms:i(M.terms),reason:"pending"}:{valid:!1,reason:M.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=c(O,this.#i).then(M=>{if(this.#e===O){this.#t=M;for(const A of this.#s)A(M)}return M}),this.#n}onSettled(O){return this.#s.add(O),()=>this.#s.delete(O)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!f(this.#r)}setHost(O){this.#r=O}state(){return this.#t.valid?"licensed":f(this.#r)?"localhost":"trial"}reset(){this.#e="",this.#t={valid:!1,reason:"missing",terms:"commercial"},this.#n=null,this.#s.clear()}}const w=Symbol.for("lattice-grid/licence/holder");function v(){const S=globalThis,O=S&&S[w];if(O&&typeof O.set=="function"&&typeof O.watermark=="function")return O;const M=new d;if(S)try{S[w]=M}catch{}return M}const P=v();function W(S){return P.set(S)}function V(){return P.info()}function G(){return P.watermark()}function _(){return P.state()}function T(){return P}}),_e("packages/core/src/registry/registry.js",function(e,F){"use strict";Object.defineProperty(e,"KINDS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"REGIONS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return s}});const ie=F("packages/core/src/internal/warn.js"),E=ie.warnOnce,K=ie.DEV,L=F("packages/core/src/internal/predicates.js").isFunction,Q=F("packages/core/src/registry/licence.js"),U=Q.LicenceHolder,x=Q.sharedLicence,q=["renderer","editor","filter","dataType","totalFn","pipe","component"],R=["all","header","body","totals","panels"];class j{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#i;#s=null;#a=null;#l=new Set;#o=new Map;constructor(n={}){for(const m of q)this.#t.set(m,new Map);this.#i=n.holder||x(),this.#a=n.grid??null,this.#s=this.#i.onSettled(()=>{this.#f({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),n.licence&&this.setLicence(n.licence)}registerModules(n,m={}){m.licence&&this.setLicence(m.licence),m.grid!==void 0&&(this.#a=m.grid);const l=Array.isArray(n)?n:[n],a=[];for(const c of l){if(!c||typeof c!="object"||typeof c.name!="string"||!c.name){E("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(c.name)){K&&this.#u(this.#e.get(c.name),c);continue}if(!L(c.install)){E(`registry.module.install:${c.name}`,`module '${c.name}' has no install() and was ignored.`);continue}const f={registry:this,grid:this.#a};try{c.install(f)}catch(p){E(`registry.module.throw:${c.name}`,`module '${c.name}' threw during install; it was not registered.`,p);continue}this.#e.set(c.name,c);for(const p of k(c))this.#n.add(p);a.push(c.name),this.#f({reason:"module",name:c.name,capabilities:this.capabilities(),regions:g(c)})}return a}unregisterModule(n){const m=this.#e.get(n);if(!m)return!1;if(L(m.uninstall))try{m.uninstall({registry:this,grid:this.#a})}catch(l){E(`registry.module.uninstall:${n}`,`module '${n}' threw during uninstall.`,l)}return this.#e.delete(n),this.#c(),this.#f({reason:"unmodule",name:n,capabilities:this.capabilities(),regions:g(m)}),!0}modules(){return[...this.#e.values()]}has(n){return this.#e.has(n)}#c(){this.#n.clear();for(const n of this.#e.values())for(const m of k(n))this.#n.add(m)}#u(n,m){!n||n===m||b(n,m)||E(`registry.module.reconfigure:${m.name}`,`module '${m.name}' was re-registered with different options; the first registration is kept and this call was ignored. Unregister it first if you mean to replace it.`)}capabilities(){return[...this.#n].sort()}can(n){return this.#n.has(n)}onChange(n){return L(n)?(this.#r.add(n),this.#o.set(n,this.#a),()=>{this.#r.delete(n),this.#o.delete(n)}):()=>{}}#f(n){for(const m of[...this.#r])try{m(n)}catch(l){E("registry.onChange.throw","a registry change handler threw.",l)}}register(n,m,l){const a=this.#t.get(n);if(!a){E(`registry.kind:${n}`,`unknown registry kind '${n}'; expected one of ${q.join(", ")}.`);return}if(!m||typeof m!="string"){E(`registry.name:${n}`,`register('${n}', ...) needs a name.`);return}a.has(m)&&a.get(m)!==l&&E(`registry.replace:${n}:${m}`,`'${m}' was already registered as a ${n} and has been replaced.`),a.set(m,l),this.#f({reason:"register",name:m,kind:n,capabilities:this.capabilities(),regions:o(n)})}registerAll(n,m){if(m)for(const l of Object.keys(m))this.register(n,l,m[l])}get(n,m){const l=this.#t.get(n);return l?l.get(m):void 0}names(n){const m=this.#t.get(n);return m?[...m.keys()]:[]}#d(n,m){const l=this.#t.get(n).get(m);return l!==void 0?l:this.#t.get("component").get(m)}renderer(n){return this.#d("renderer",n)}editor(n){return this.#d("editor",n)}filter(n){return this.#d("filter",n)}dataType(n){return this.get("dataType",n)}totalFn(n){return this.get("totalFn",n)}pipe(n){return this.get("pipe",n)}setLicence(n){return this.#i.set(n)}licence(){return this.#i.info()}licenceVerified(){return this.#i.verify()}watermark(){return this.#i.watermark()}attach(n){n!=null&&(this.#l.add(n),this.#a=n)}detach(n){if(n!=null){this.#l.delete(n);for(const[m,l]of[...this.#o])l===n&&(this.#r.delete(m),this.#o.delete(m));if(this.#a===n){const m=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#a=m}this.#l.size===0&&this.#s&&(this.#s(),this.#s=null)}}destroy(n){if(n!=null){this.detach(n);return}for(const m of[...this.#e.keys()])this.unregisterModule(m);this.#r.clear(),this.#o.clear(),this.#l.clear(),this.#s&&this.#s(),this.#s=null,this.#a=null}}function k(r){const n=r.capabilities,m=Array.isArray(n)?n.filter(l=>typeof l=="string"):[];return[r.name,...m]}function b(r,n){return r.install!==n.install||r.uninstall!==n.uninstall||(r.version||"")!==(n.version||"")?!1:u(k(r),k(n))&&u(g(r),g(n))}function u(r,n){const m=new Set(r),l=new Set(n);if(m.size!==l.size)return!1;for(const a of m)if(!l.has(a))return!1;return!0}function g(r){const n=r.regions;return!Array.isArray(n)||n.length===0?["all"]:n.filter(m=>R.includes(m))}function o(r){switch(r){case"filter":return["header"];case"totalFn":return["totals"];case"renderer":case"editor":case"pipe":return["body"];default:return["all"]}}const t=new j;function i(){return t}function s(r,n={}){return t.registerModules(r,n)}}),_e("packages/core/src/internal/text.js",function(e,F){"use strict";Object.defineProperty(e,"humanise",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"escapeHtml",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return I}});function ie(L){return L?(L.includes(".")?L.slice(L.lastIndexOf(".")+1):L).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(/^./,U=>U.toUpperCase()):""}const E={"&":"&","<":"<",">":">",'"':""","'":"'"};function K(L){const Q=L==null?"":String(L);return/[&<>"']/.test(Q)?Q.replace(/[&<>"']/g,U=>E[U]):Q}function I(L){return String(L).replace(/\w\S*/g,Q=>Q[0].toUpperCase()+Q.slice(1).toLowerCase())}}),_e("packages/core/src/format/mask.js",function(e,F){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return Q}});const ie=new Set(["0","#","?",",","."]),E="\0";function K(x){const q=[];let R="",j=!1;for(let k=0;k<x.length;k++){const b=x[k];if(b==="\\"){R+=b+(x[k+1]??""),k+=1;continue}if(b==='"'){j=!j,R+=b;continue}if(b===";"&&!j){q.push(R),R="";continue}R+=b}return q.push(R),q}function I(x){let q="",R="",j="",k=1,b=!1,u=!1;const g=a=>{u?R+=a:q+=a};for(let a=0;a<x.length;a++){const c=x[a];if(c==="\\"){g(x[a+1]??""),a+=1;continue}if(c==='"'){const f=x.indexOf('"',a+1);g(f===-1?x.slice(a+1):x.slice(a+1,f)),a=f===-1?x.length:f;continue}if(c==="%"){k*=100,g("%");continue}if(c==="@"){b=!0,g("\0");continue}if(ie.has(c)){j+=c,u=!0;continue}g(c)}let o=-1;for(let a=j.length-1;a>=0;a--){const c=j[a];if(c==="0"||c==="#"||c==="?"){o=a;break}}let t=!1,i="";for(let a=0;a<j.length;a++){const c=j[a];if(c===","){a>o?k/=1e3:t=!0;continue}i+=c}const s=i.indexOf("."),r=s===-1?i:i.slice(0,s),n=s===-1?"":i.slice(s+1);let m=0;for(const a of r)a==="0"&&(m+=1);let l=0;for(const a of n)a==="0"&&(l+=1);return{prefix:q,suffix:R,minInt:m,minDec:l,maxDec:n.length,grouping:t,scale:k,hasNumber:o!==-1,isText:b}}function L(x,q){const R=new Intl.NumberFormat(q,{minimumIntegerDigits:Math.max(x.minInt,1),minimumFractionDigits:x.minDec,maximumFractionDigits:Math.max(x.maxDec,x.minDec),useGrouping:x.grouping}),{prefix:j,suffix:k,scale:b,hasNumber:u}=x;return g=>{if(!u)return j+k;const o=b===1?g:g*b;return j+R.format(o)+k}}function Q(x,q){const j=K(String(x)).map(I),k=j.map(i=>L(i,q)),b=0,u=j.length>1?1:-1,g=j.length>2?2:-1,o=j.length>3?3:-1,t=i=>{if(i==null||i==="")return"";if(typeof i!="number"||Number.isNaN(i)){const s=Number(i);if(Number.isNaN(s))return o===-1?String(i):(j[o].prefix+j[o].suffix).split("\0").join(String(i));i=s}return i===0&&g!==-1?k[g](0):i<0&&u!==-1?k[u](-i):k[b](i)};return t.spec={mask:x},{format:t,ooxml:U(String(x))}}function U(x){return x.trim()}}),_e("packages/core/src/format/pattern.js",function(e,F){"use strict";Object.defineProperty(e,"parseNumberPattern",{enumerable:!0,get:function(){return L}});const E=F("packages/core/src/format/mask.js").splitSections;function K(Q){let U="",x="",q="",R="",j=!1,k=!1,b=!1,u=!1;const g=t=>{b?x+=t:U+=t};for(let t=0;t<Q.length;t++){const i=Q[t];if(i==="\\"){g(Q[t+1]??""),t+=1;continue}if(i==='"'){const s=Q.indexOf('"',t+1);g(s===-1?Q.slice(t+1):Q.slice(t+1,s)),t=s===-1?Q.length:s;continue}if(i==="%"){k=!0;continue}if(i==="0"||i==="#"){b=!0,u?R+=i:q+=i;continue}if(i===","){u||(j=!0);continue}if(i==="."&&!u){u=!0;continue}g(i)}if(!b)return{hasDigit:!1,prefix:U,suffix:x,minDec:0,maxDec:0,grouping:!1,percent:k};let o=0;for(const t of R)t==="0"&&(o+=1);return{hasDigit:!0,prefix:U,suffix:x,minDec:o,maxDec:R.length,grouping:j,percent:k}}function I(Q,U){const x=U.trim(),q=Q.trim();return x.startsWith("(")&&x.endsWith(")")&&x.slice(1,-1).trim()===q?"parentheses":x.endsWith("-")?"suffix":"minus"}function L(Q){if(typeof Q!="string")return null;const U=E(Q);if(U.length===0)return null;const x=K(U[0]);if(!x.hasDigit)return null;const q={style:x.percent?"percent":"decimal",prefix:x.prefix,suffix:x.suffix,minDecimals:x.minDec,maxDecimals:Math.max(x.maxDec,x.minDec),thousandsSeparator:x.grouping?void 0:!1};if(U.length>1&&(q.negative=I(U[0],U[1])),U.length>2){const R=K(U[2]);R.hasDigit||(q.zeroDisplay=R.prefix+R.suffix)}return q}}),_e("packages/core/src/format/number.js",function(e,F){"use strict";Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return U}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/internal/warn.js").warnOnce,Q=F("packages/core/src/format/pattern.js").parseNumberPattern;function U(x,q){const R=typeof x=="string"?{pattern:x}:x||{};let j=R;if(typeof R.pattern=="string"){const v=Q(R.pattern);if(v){const{pattern:P,...W}=R;j={...v,...W}}else I(`format:pattern:${R.pattern}`,`invalid number format pattern "${R.pattern}"; the value will use the default number format`)}const k=j.locale||q||void 0,b=j.style||"decimal",u=typeof j.scale=="number"?j.scale:1,g=j.nullDisplay??"",o=j.zeroDisplay,t=j.prefix||"",i=j.suffix||"",s=j.negative||"minus",r=j.signed===!0,n={style:b,notation:j.notation||"standard"};b==="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 m=new Intl.NumberFormat(k,n),l=typeof j.thousandsSeparator=="string"?j.thousandsSeparator:null,a=typeof j.decimalSeparator=="string"?j.decimalSeparator:null;let c=",",f=".";if(l||a)for(const v of m.formatToParts(12345.6))v.type==="group"?c=v.value:v.type==="decimal"&&(f=v.value);const p=v=>{let P=v;return l&&(P=P.split(c).join("")),a&&(P=P.split(f).join("")),l&&(P=P.split("").join(l)),a&&(P=P.split("").join(a)),P},y=!!(l||a),h=t!==""&&b==="currency",d=v=>{let P;if(h){const W=m.formatToParts(v);let V=!1;P="";for(const G of W)P+=G.value,!V&&G.type==="currency"&&(P+=t,V=!0);V||(P=t+P)}else P=t+m.format(v);return y&&(P=p(P)),P+i},w=v=>{if(E(v)||v==="")return g;const P=typeof v=="number"?v:Number(v);if(Number.isNaN(P))return g;const W=u===1?P:P*u;return W===0&&o!==void 0?o:W<0?s==="parentheses"?`(${d(-W)})`:s==="suffix"?`${d(-W)}-`:d(W):r&&W>0?`+${d(W)}`:d(W)};return w.negativeClass=j.negativeClass||null,w.spec=j,w}}),_e("packages/core/src/format/date.js",function(e,F){"use strict";Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return i}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/internal/warn.js").warnOnce,L=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function Q(s){const r=[];let n=0,m="";const l=()=>{m&&(r.push({token:null,text:m}),m="")};for(;n<s.length;){const a=s[n];if(a==="'"){if(s[n+1]==="'"){m+="'",n+=2;continue}const f=s.indexOf("'",n+1);if(f===-1){m+=s.slice(n+1),n=s.length;continue}m+=s.slice(n+1,f),n=f+1;continue}const c=L.find(f=>s.startsWith(f,n));if(c){l(),r.push({token:c,text:c}),n+=c.length;continue}/[A-Za-z]/.test(a)&&I(`date.pattern.token:${a}`,`the date pattern "${s}" contains '${a}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${L.join(" ")}.`),m+=a,n+=1}return l(),r}const U=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function x(s){if(E(s)||s==="")return null;if(s instanceof Date)return Number.isNaN(s.getTime())?null:s;if(typeof s=="number")return Number.isNaN(s)?null:new Date(s);if(typeof s=="string"){const r=U.exec(s.trim());if(r){const[,m,l,a,c="0",f="0",p="0"]=r;return new Date(+m,+l-1,+a,+c,+f,+p)}const n=new Date(s);return Number.isNaN(n.getTime())?null:n}return null}function q(s,r){return String(s).padStart(r,"0")}function R(s){if(!s)return m=>({year:m.getFullYear(),month:m.getMonth()+1,day:m.getDate(),hour:m.getHours(),minute:m.getMinutes(),second:m.getSeconds(),ms:m.getMilliseconds(),weekday:m.getDay()});const r=new Intl.DateTimeFormat("en-US",{timeZone:s,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,weekday:"short"}),n={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};return m=>{const l={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:m.getMilliseconds(),weekday:0};for(const a of r.formatToParts(m))switch(a.type){case"year":l.year=Number(a.value);break;case"month":l.month=Number(a.value);break;case"day":l.day=Number(a.value);break;case"hour":l.hour=Number(a.value)%24;break;case"minute":l.minute=Number(a.value);break;case"second":l.second=Number(a.value);break;case"weekday":l.weekday=n[a.value]??0;break;default:break}return l}}function j(s,r,n){const m=Q(s),l=R(n),a=new Set(m.filter(h=>h.token).map(h=>h.token)),c=a.has("MMM")?new Intl.DateTimeFormat(r,{month:"short",timeZone:n}):null,f=a.has("MMMM")?new Intl.DateTimeFormat(r,{month:"long",timeZone:n}):null,p=a.has("EEE")?new Intl.DateTimeFormat(r,{weekday:"short",timeZone:n}):null,y=a.has("EEEE")?new Intl.DateTimeFormat(r,{weekday:"long",timeZone:n}):null;return h=>{const d=l(h);let w="";for(const v of m){if(!v.token){w+=v.text;continue}switch(v.token){case"yyyy":w+=q(d.year,4);break;case"yy":w+=q(d.year%100,2);break;case"MMMM":w+=f.format(h);break;case"MMM":w+=c.format(h);break;case"MM":w+=q(d.month,2);break;case"M":w+=String(d.month);break;case"dd":w+=q(d.day,2);break;case"d":w+=String(d.day);break;case"EEEE":w+=y.format(h);break;case"EEE":w+=p.format(h);break;case"HH":w+=q(d.hour,2);break;case"H":w+=String(d.hour);break;case"hh":w+=q(d.hour%12===0?12:d.hour%12,2);break;case"h":w+=String(d.hour%12===0?12:d.hour%12);break;case"mm":w+=q(d.minute,2);break;case"m":w+=String(d.minute);break;case"ss":w+=q(d.second,2);break;case"s":w+=String(d.second);break;case"SSS":w+=q(d.ms,3);break;case"a":w+=d.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 b(s,r){const n=s||{},m=n.locale||r||void 0,l=n.nullDisplay??"",a=n.timeZone;let c;if(n.pattern)c=j(n.pattern,m,a);else if(n.dateStyle||n.timeStyle){const d={timeZone:a};n.dateStyle&&(d.dateStyle=n.dateStyle),n.timeStyle&&(d.timeStyle=n.timeStyle);const w=new Intl.DateTimeFormat(m,d);c=v=>w.format(v)}else{const d=new Intl.DateTimeFormat(m,{dateStyle:"medium",timeZone:a});c=w=>d.format(w)}const f=n.relative?new Intl.RelativeTimeFormat(m,{numeric:"auto"}):null,y=(typeof n.relative=="object"&&n.relative?n.relative.threshold??7:7)*24*36e5,h=(d,w)=>{const v=x(d);if(!v)return l;if(f){const P=w&&typeof w.now=="number"?w.now:Date.now(),W=v.getTime()-P;if(Math.abs(W)<y){for(const[V,G]of k)if(Math.abs(W)>=G||V==="second")return f.format(Math.round(W/G),V)}}return c(v)};return h.spec=n,h}function u(s){if(E(s)||s==="")return null;if(typeof s=="string"){const m=/^(\d{4}-\d{2}-\d{2})/.exec(s.trim());if(m)return m[1];const l=x(s);return l?u(l):null}const r=x(s);if(!r)return null;const n=m=>String(m).padStart(2,"0");return`${r.getFullYear()}-${n(r.getMonth()+1)}-${n(r.getDate())}`}function g(s,r){if(E(s)||s==="")return null;if(typeof s=="string"){const m=s.trim();if(o.test(m)){const c=x(m);return c?t(c,r):null}const l=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(m);if(l){const[,c,f,p,y]=l;return`${c}T${f}:${p}${y&&y!=="00"?`:${y}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(m))return`${m}T00:00`;const a=x(m);return a?g(a):null}const n=x(s);return n?t(n,r):null}const o=/(?:Z|[+-]\d{2}:?\d{2})$/i;function t(s,r){const n=c=>String(c).padStart(2,"0");if(r)try{const c=new Intl.DateTimeFormat("en-CA",{timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(s).reduce((y,h)=>(h.type!=="literal"&&(y[h.type]=h.value),y),{}),f=c.hour==="24"?"00":c.hour,p=Number(c.second);return`${c.year}-${c.month}-${c.day}T${f}:${c.minute}`+(p?`:${c.second}`:"")}catch{}const m=`${s.getFullYear()}-${n(s.getMonth()+1)}-${n(s.getDate())}`,l=s.getSeconds(),a=`${n(s.getHours())}:${n(s.getMinutes())}${l?`:${n(l)}`:""}`;return`${m}T${a}`}function i(s,r){const n=E(s)||s===""?null:String(s),m=E(r)||r===""?null:String(r);return n===null?m===null?0:1:m===null||n<m?-1:n>m?1:0}}),_e("packages/core/src/format/boolean.js",function(e,F){"use strict";Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return Q}});const E=F("packages/core/src/internal/predicates.js").isNil,K={true:"☑",false:"☐",null:""},I={true:"◉",false:"◯",null:""};function L(U){if(E(U)||U==="")return null;if(typeof U=="boolean")return U;if(typeof U=="number")return U!==0;const x=String(U).trim().toLowerCase();return x==="true"||x==="yes"||x==="y"||x==="1"?!0:x==="false"||x==="no"||x==="n"||x==="0"?!1:null}function Q(U,x){const q=U||{},R=q.display||"text",j=q.trueLabel??"Yes",k=q.falseLabel??"No",b=q.nullLabel??"";let u=j,g=k;const o=b;R==="checkbox"?(u=K.true,g=K.false):R==="switch"?(u=I.true,g=I.false):R==="icon"&&(u=q.trueIcon??j,g=q.falseIcon??k);const t=i=>{const s=L(i);return s===null?o:s?u:g};return t.display=R,t.labels={true:j,false:k,null:b},t.locale=x,t.spec=q,t}}),_e("packages/core/src/format/text.js",function(e,F){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return L}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/internal/text.js").titleCase;function L(Q,U){const x=Q||{},q=x.locale||U||void 0,R=x.nullDisplay??"",j=x.emptyDisplay??"",k=x.transform||"none",b=typeof x.truncate=="number"?{chars:x.truncate}:x.truncate||null,u=b?b.chars:0,g=b?b.ellipsis??"…":"",o=i=>{switch(k){case"upper":return q?i.toLocaleUpperCase(q):i.toUpperCase();case"lower":return q?i.toLocaleLowerCase(q):i.toLowerCase();case"title":return I(i);default:return i}},t=i=>{if(E(i))return R;let s=typeof i=="string"?i:String(i);return s===""?j:(k!=="none"&&(s=o(s)),u>0&&s.length>u&&(s=s.slice(0,u)+g),s)};return t.spec=x,t}}),_e("packages/core/src/format/shorthand.js",function(e,F){"use strict";Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return U}});const ie=["currency","number","percent","date","boolean","text","relative"],E=/[#0?@;"\\]/,K=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function I(x){return typeof x!="string"||x===""||Q(x)?!1:E.test(x)}function L(x){return typeof x!="string"||x===""||Q(x)?!1:K.test(x)}function Q(x){const q=x.indexOf(":"),R=q===-1?x:x.slice(0,q);return ie.includes(R)?R:null}function U(x){const q=Q(x);if(!q)return null;const R=x.indexOf(":"),j=R===-1?"":x.slice(R+1),k=j===""?[]:j.split(":");switch(q){case"currency":{const b={type:"number",style:"currency",currency:k[0]||"USD"};return k[1]!==void 0&&k[1]!==""&&(b.decimals=Number(k[1])),b}case"number":{const b={type:"number",style:"decimal"};return k[0]!==void 0&&k[0]!==""&&(b.decimals=Number(k[0])),b}case"percent":{const b={type:"number",style:"percent"};return k[0]!==void 0&&k[0]!==""&&(b.decimals=Number(k[0])),b}case"date":return{type:"date",pattern:j||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const b=j.split("/"),u={type:"boolean",display:"text"};return b[0]!==void 0&&b[0]!==""&&(u.trueLabel=b[0]),b[1]!==void 0&&b[1]!==""&&(u.falseLabel=b[1]),b[2]!==void 0&&(u.nullLabel=b[2]),u}case"text":{const b={type:"text"};return k[0]&&(b.transform=k[0]),k[1]!==void 0&&k[1]!==""&&(b.truncate=Number(k[1])),b}default:return null}}}),_e("packages/core/src/format/index.js",function(e,F){"use strict";Object.defineProperty(e,"compileFormat",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"specToOoxml",{enumerable:!0,get:function(){return P}});const ie=F("packages/core/src/internal/predicates.js"),E=ie.isFunction,K=ie.isObject,L=F("packages/core/src/internal/warn.js").warnOnce,Q=F("packages/core/src/format/number.js"),U=Q.compileNumber,x=F("packages/core/src/format/date.js"),q=x.compileDate,R=x.scanPattern,j=F("packages/core/src/format/boolean.js"),k=j.compileBoolean,b=F("packages/core/src/format/text.js"),u=b.compileText,g=F("packages/core/src/format/mask.js"),o=g.compileMask,t=F("packages/core/src/format/shorthand.js"),i=t.parseShorthand,s=t.looksLikeMask,r=t.looksLikeDatePattern,m=F("packages/core/src/format/pattern.js").parseNumberPattern;Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return Q.compileNumber}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return x.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return x.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return x.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return x.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 b.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 l=new Set(["decimal","currency","percent","unit"]),a=new Set(["type","locale"]),c={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"])},f=new Set(["number","date","boolean","text"]);function p(_,T){const S=_.type;if(S===void 0||f.has(S)||!l.has(String(S)))return;const O=T?`"${T}"`:"with no id";L(`format:unknown-style-key:${T||""}:${S}`,`column ${O} has format: { type: "${S}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${S}" instead?`)}function y(_,T,S){const O=c[T],M=S?`"${S}"`:"with no id";for(const A of _){if(a.has(A)||O.has(A))continue;const N=Object.keys(c).find($=>$!==T&&c[$].has(A));N?L(`format:inapplicable:${S||""}:${A}`,`column ${M} has format key "${A}", which applies to a ${N} column, not the ${T} column it was applied to; it is ignored.`):L(`format:unknown:${S||""}:${A}`,`column ${M} has an unrecognised format key "${A}" for its ${T} format; it is ignored.`)}}function h(_){if(_.type==="number"||_.type==="date"||_.type==="boolean"||_.type==="text")return!0;const T=l.has(String(_.style));return!!(_.pattern||_.dateStyle||_.timeStyle||_.relative||_.timeZone||_.trueLabel||_.falseLabel||_.display||_.trueIcon||_.falseIcon||_.transform||_.truncate||_.emptyDisplay||T||_.currency||_.decimals!==void 0||_.minDecimals!==void 0||_.maxDecimals!==void 0||_.notation||_.negative||_.scale!==void 0||_.prefix||_.suffix||_.zeroDisplay!==void 0)}function d(_,T){if(_.type==="number"||_.type==="date"||_.type==="boolean"||_.type==="text")return _.type;if(_.pattern){if(s(_.pattern))return"number";if(r(_.pattern))return"date"}if(_.dateStyle||_.timeStyle||_.relative||_.timeZone)return"date";if(_.trueLabel||_.falseLabel||_.display||_.trueIcon||_.falseIcon)return"boolean";if(_.transform||_.truncate||_.emptyDisplay)return"text";if(_.style||_.currency||_.decimals!==void 0||_.minDecimals!==void 0||_.maxDecimals!==void 0||_.notation||_.negative||_.scale!==void 0||_.prefix||_.suffix||_.zeroDisplay!==void 0)return"number";const S=T&&T.base;return S==="number"?"number":S==="date"||S==="dateString"?"date":S==="boolean"?"boolean":"text"}function w(_,T=null,S=void 0,O=void 0,M=void 0){if(_==null||_==="")return null;const A=K(_)?Object.keys(_):null;if(typeof _=="function"){const H=(Y,Z)=>String(_({...Z||{},value:Y,locale:S})??"");return H.ooxml=T&&T.excel||"General",H}if(typeof _=="string"){if(s(_)){const{format:Y,ooxml:Z}=o(_,S);return Y.ooxml=Z,Y}const H=i(_)||(r(_)?{type:"date",pattern:_}:null);return H?w(H,T,S,O,M):(L(`format:${_}`,`unrecognised format string "${_}"; the value will be stringified`),null)}if(!K(_))return L("format:shape","format must be a spec object or a string; ignoring",_),null;if(T&&E(T.format)&&!h(_)||T&&E(T.format)&&Array.isArray(T.formatPatterns)&&_.type===void 0)return null;const N=d(_,T);N==="date"&&O&&_.timeZone===void 0&&(_={..._,timeZone:O}),p(_,M),y(A||Object.keys(_),N,M);let $;switch(N){case"number":$=U(_,S);break;case"date":$=q(_,S);break;case"boolean":$=k(_,S);break;default:$=u(_,S);break}return $.ooxml=P(_,N,S,T),$.kind=N,$}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 P(_,T,S=void 0,O=null){if(T==="date"){if(_.pattern){let H="";for(const Y of R(_.pattern))H+=Y.token?v[Y.token]??Y.text:Y.text;return H}return O&&O.excel||"yyyy-mm-dd"}if(T==="boolean")return"General";if(T==="text")return"@";if(typeof _.pattern=="string"&&m(_.pattern))return String(_.pattern).trim();if(_.notation==="compact"||_.notation==="scientific")return"General";const M=typeof _.decimals=="number"?_.decimals:typeof _.minDecimals=="number"?_.minDecimals:_.style==="currency"?2:0;let N=`${_.thousandsSeparator===!1?"":"#,#"}#0${M>0?`.${"0".repeat(M)}`:""}`,$="";return _.style==="currency"&&($+=W(G(_.currency||"USD",S))),_.prefix&&($+=W(_.prefix)),N=$+N,_.style==="percent"&&(N=`${N}%`),_.suffix&&(N+=W(_.suffix)),_.negative==="parentheses"?`${N};(${N})`:_.negative==="suffix"?`${N};${N}-`:N}function W(_){return`"${String(_).split('"').join("")}"`}const V=new Map;function G(_,T){const S=`${_}|${T||""}`;let O=V.get(S);if(O!==void 0)return O;O=_;try{const A=new Intl.NumberFormat(T,{style:"currency",currency:_}).formatToParts(0).find(N=>N.type==="currency");A&&(O=A.value)}catch{}return V.set(S,O),O}}),_e("packages/core/src/columns/types/temporal.js",function(e,F){"use strict";Object.defineProperty(e,"MS_SECOND",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"MS_MINUTE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"MS_HOUR",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"MS_DAY",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"MS_WEEK",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"toTimeMs",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"zonedParts",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"zoneOffsetAt",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"instantFromParts",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"toEpochMs",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"toDurationMs",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(e,"resolveZoneName",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"zoneLabel",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"formatInstant",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"timestampGroupProjector",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"TEMPORAL_INFERENCE_ORDER",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Le}});const ie=F("packages/core/src/internal/predicates.js"),E=ie.isNil,K=ie.isFunction,I=F("packages/core/src/format/date.js"),L=I.toDate,Q=I.compilePattern,U=I.compileDate,x=I.toIsoDateTime,q=I.compareIso,R=864e5,j=Object.freeze({}),k=1e3,b=60*k,u=60*b,g=24*u,o=7*g,t=new WeakMap;function i(we,He){const Te=we&&we.locale||"",Ae=we&&we.column;if(!Ae)return Te?{locale:Te}:j;const Se=t.get(Ae);if(Se&&Se.locale===Te)return Se.bag;const Ee=Ae.typeOptions||Ae[He]||(s(Ae.format)?Ae.format:null),Me={...Ee||j,locale:Ee&&Ee.locale||Te||void 0};return t.set(Ae,{locale:Te,bag:Me}),Me}function s(we){return we!==null&&typeof we=="object"&&!Array.isArray(we)&&!(we instanceof Date)}function r(we,He){const Te=we===null||Number.isNaN(we)?null:we,Ae=He===null||Number.isNaN(He)?null:He;return Te===null?Ae===null?0:1:Ae===null||Te<Ae?-1:Te>Ae?1:0}const n=/^(\d{1,2})(?:\s*[:.h]\s*(\d{1,2})(?:\s*[:.]\s*(\d{1,2})(?:[.,](\d{1,3}))?)?)?\s*(a\.?m\.?|p\.?m\.?|a|p)?$/i,m=/^(\d{3,6})$/;function l(we,He,Te,Ae){return!(we>=0&&we<=23)||!(He>=0&&He<=59)||!(Te>=0&&Te<=59)||!(Ae>=0&&Ae<=999)?null:we*u+He*b+Te*k+Ae}function a(we){if(E(we))return null;const He=String(we).trim();if(He==="")return null;const Te=m.exec(He);if(Te){const et=Te[1];if(et.length===5)return null;const Je=et.length===3?1:2;return l(Number(et.slice(0,Je)),Number(et.slice(Je,Je+2)),Number(et.slice(Je+2,Je+4)||0),0)}const Ae=n.exec(He);if(!Ae)return null;let Se=Number(Ae[1]);const Ee=Number(Ae[2]||0),Me=Number(Ae[3]||0),Be=Ae[4]?Number(Ae[4].padEnd(3,"0")):0,Ke=Ae[5]?Ae[5][0].toLowerCase():null;if(Ke){if(Se<1||Se>12)return null;Se=Se%12,Ke==="p"&&(Se+=12)}return l(Se,Ee,Me,Be)}function c(we){return E(we)||we===""?null:typeof we=="number"?Number.isFinite(we)?(we%g+g)%g:null:we instanceof Date?Number.isNaN(we.getTime())?null:we.getHours()*u+we.getMinutes()*b+we.getSeconds()*k+we.getMilliseconds():a(we)}const f=new Map;function p(we){const He=we.pattern||"",Te=we.timeStyle||(we.seconds?"medium":"short"),Ae=`${we.locale||""}|${He}|${Te}`;let Se=f.get(Ae);if(Se)return Se;if(He)Se=Q(He,we.locale||void 0,"UTC");else{const Ee=new Intl.DateTimeFormat(we.locale||void 0,{timeStyle:Te,timeZone:"UTC"});Se=Me=>Ee.format(Me)}return f.set(Ae,Se),Se}function y(we,He){const Te=He||j;if(we==null||typeof we!="number"||!Number.isFinite(we))return Te.nullDisplay??"";const Ae=(we%g+g)%g;return p(Te)(new Date(Ae))}function h(we){return we instanceof Date?!Number.isNaN(we.getTime()):typeof we=="number"?Number.isFinite(we)&&we>=0&&we<g:typeof we!="string"||!we.includes(":")?!1:a(we)!==null}function d(we){const He=c(we);return He==null?"":y(He,{pattern:He%k===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const w=new Map;function v(we){const He=we||"";let Te=w.get(He);return Te||(Te=new Intl.DateTimeFormat("en-GB",{timeZone:we||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),w.set(He,Te)),Te}function P(we,He){const Te={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const Ae of v(He).formatToParts(new Date(we)))Ae.type==="year"?Te.year=Number(Ae.value):Ae.type==="month"?Te.month=Number(Ae.value):Ae.type==="day"?Te.day=Number(Ae.value):Ae.type==="hour"?Te.hour=Number(Ae.value)%24:Ae.type==="minute"?Te.minute=Number(Ae.value):Ae.type==="second"&&(Te.second=Number(Ae.value));return Te}function W(we,He){const Te=P(we,He);return Date.UTC(Te.year,Te.month-1,Te.day,Te.hour,Te.minute,Te.second,0)-Math.floor(we/1e3)*1e3}function V(we,He){const Te=we.hour||0,Ae=we.minute||0,Se=we.second||0,Ee=we.ms||0;if(!He)return new Date(we.year,we.month-1,we.day,Te,Ae,Se,Ee).getTime();const Me=Date.UTC(we.year,we.month-1,we.day,Te,Ae,Se,Ee);let Be=Me-W(Me,He);return Be=Me-W(Be,He),Be}const G=/(?:Z|[+-]\d{2}:?\d{2})$/i,_=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function T(we,He){if(E(we))return null;const Te=String(we).trim();if(Te==="")return null;const Ae=He&&He.timeZone||void 0;if(!G.test(Te)){const Se=_.exec(Te);if(Se){const Ee=(Se[4]||"").trim(),Me=Ee===""?0:a(Ee);if(Me===null)return null;const Be=V({year:Number(Se[1]),month:Number(Se[2]),day:Number(Se[3]),hour:Math.floor(Me/u),minute:Math.floor(Me/b)%60,second:Math.floor(Me/k)%60,ms:Me%k},Ae);return Number.isNaN(Be)?null:new Date(Be)}}return L(Te)}function S(we){if(typeof we=="number")return Number.isFinite(we)?we:null;const He=L(we);return He?He.getTime():null}const O=new Map;function M(we){const He=[we.locale||"",we.pattern||"",we.dateStyle||"",we.timeStyle||"",we.timeZone||"",we.seconds?"1":""].join("|");let Te=O.get(He);if(Te)return Te;const Ae=we.pattern?{type:"date",pattern:we.pattern,timeZone:we.timeZone}:{type:"date",dateStyle:we.dateStyle||"medium",timeStyle:we.timeStyle||(we.seconds?"medium":"short"),timeZone:we.timeZone};return Te=U(Ae,we.locale||void 0),O.set(He,Te),Te}function A(we,He){const Te=He||j,Ae=S(we);return Ae==null?Te.nullDisplay??"":M(Te)(Ae)}function N(we){return we instanceof Date?!Number.isNaN(we.getTime()):typeof we!="string"||!_.test(we.trim())?!1:T(we)!==null}const $=Object.freeze([{key:"w",ms:o,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:u,intl:"hour",long:["hour","hours"],names:["h","hr","hrs","hour","hours"]},{key:"m",ms:b,intl:"minute",long:["minute","minutes"],names:["m","min","mins","minute","minutes"]},{key:"s",ms: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"]}]),H=new Map;for(const we of $)for(const He of we.names)H.set(He,we);const Y=Object.freeze($.filter(we=>we.key!=="w")),Z=/^(\d+(?:\.\d+)?)\s*([a-z]+)\s*(?:,\s*)?/,J=/^\d+(?:\.\d+)?$/,D=/^(\d+):([0-5]?\d)(?::([0-5]?\d))?(?:\.(\d{1,3}))?$/;function te(we){const He=we&&we.defaultUnit?H.get(String(we.defaultUnit).toLowerCase()):null;return He?He.ms:b}function z(we){return(we&&we.defaultUnit?H.get(String(we.defaultUnit).toLowerCase()):null)||H.get("m")}function X(we,He){if(E(we))return null;let Te=String(we).trim().toLowerCase();if(Te==="")return null;let Ae=1;if(Te[0]==="-"?(Ae=-1,Te=Te.slice(1).trim()):Te[0]==="+"&&(Te=Te.slice(1).trim()),Te==="")return null;const Se=D.exec(Te);if(Se){const Ke=Se[3]!==void 0,et=Number(Se[1])*u+Number(Se[2])*b+(Ke?Number(Se[3])*k:0)+(Se[4]?Number(Se[4].padEnd(3,"0")):0);return Ae*et}if(J.test(Te))return Math.round(Ae*Number(Te)*te(He||j));let Ee=Te,Me=0,Be=0;for(;Ee!=="";){const Ke=Z.exec(Ee);if(!Ke)return null;const et=H.get(Ke[2]);if(!et)return null;Me+=Number(Ke[1])*et.ms,Ee=Ee.slice(Ke[0].length),Be++}return Be===0?null:Math.round(Ae*Me)}function ne(we){return E(we)||we===""?null:typeof we=="number"?Number.isFinite(we)?we:null:X(we)}const se=new Map;function ue(we,He,Te){const Ae=`${Te||""}|${He.intl}`;let Se=se.get(Ae);if(Se===void 0){try{Se=new Intl.NumberFormat(Te||void 0,{style:"unit",unit:He.intl,unitDisplay:"long"})}catch{Se=null}se.set(Ae,Se)}return Se?Se.format(we):`${we} ${we===1?He.long[0]:He.long[1]}`}function ge(we,He){return String(we).padStart(He,"0")}function Oe(we,He){const Te=He||j;if(we==null||typeof we!="number"||!Number.isFinite(we))return Te.nullDisplay??"";const Ae=Te.style||"short",Se=we<0;let Ee=Math.round(Math.abs(we));const Me=Se?"-":"";if(Ee===0&&Te.zeroDisplay!=null)return Te.zeroDisplay;if(Ae==="clock"){const Je=Math.floor(Ee/u),ut=Math.floor(Ee/b)%60,Ct=Math.floor(Ee/k)%60;return`${Me}${ge(Je,2)}:${ge(ut,2)}:${ge(Ct,2)}`}if(Ee===0){const Je=z(Te);return Ae==="long"?ue(0,Je,Te.locale):`0${Je.key}`}const Be=Te.weeks===!0?$:Y,Ke=typeof Te.maxUnits=="number"&&Te.maxUnits>0?Te.maxUnits:Te.maxUnits===void 0?2:1/0,et=[];for(const Je of Be){if(et.length>=Ke)break;const ut=Math.floor(Ee/Je.ms);ut!==0&&(Ee-=ut*Je.ms,et.push(Ae==="long"?ue(ut,Je,Te.locale):`${ut}${Je.key}`))}return Me+et.join(" ")}function Pe(we){if(typeof we!="string")return!1;const He=we.trim();return He===""||D.test(He)||!/[a-z]/i.test(He)?!1:X(He)!==null}const Ie=Date.UTC(1899,11,30),xe=new Map;function ye(we,He){const Te=we||"";let Ae=xe.get(Te);Ae||(Ae=new Intl.DateTimeFormat("en-GB",{timeZone:we||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),xe.set(Te,Ae));const Se=typeof He=="number"?He:Date.now();for(const Ee of Ae.formatToParts(new Date(Se)))if(Ee.type==="timeZoneName")return Ee.value;return""}function re(we){if(we)return we;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function fe(we,He){const Te=re(we),Ae=ye(we,He);return Ae?`${Te} (${Ae})`:Te}function oe(we,He){if(we&&we.timeZone)return we.timeZone;const Te=He&&He.grid;return(Te&&K(Te.get)?Te.get("timeZone"):void 0)||void 0}function ce(we,He){const Te=He||j,Ae=S(we);if(Ae==null)return Te.nullDisplay??"";const Se=M(Te)(Ae);if(!Te.showOrigin)return Se;const Ee=Te.originZone;return Ee?Ee===(Te.timeZone||re(Te.timeZone))?Se:`${Se} (${fe(Ee,Ae)})`:`${Se} (no origin recorded)`}function de(we,He,Te,Ae){if(He==="instant"||!He)return we;const Se=P(we,Te);if(He==="month")return V({year:Se.year,month:Se.month,day:1},Te);if(He==="week"){const Ee=Ae>=1&&Ae<=7?Ae:1,Be=((new Date(Date.UTC(Se.year,Se.month-1,Se.day)).getUTCDay()+6)%7+1-Ee+7)%7,Ke=new Date(Date.UTC(Se.year,Se.month-1,Se.day-Be));return V({year:Ke.getUTCFullYear(),month:Ke.getUTCMonth()+1,day:Ke.getUTCDate()},Te)}return V({year:Se.year,month:Se.month,day:Se.day},Te)}function ve(we,He){const Te=we&&we.group,Ae=Te&&Te.granularity||"day";if(Ae==="instant")return null;const Se=Te&&Te.weekStart;return Ee=>typeof Ee=="number"?de(Ee,Ae,He,Se):Ee}const ke={time:{base:"number",storage:"float64",matches:h,format:we=>y(c(we.value),i(we,"time")),parse:we=>a(we.text),compare:(we,He)=>r(c(we),c(He)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:we=>{const He=c(we);return He===null?null:He/R},toStorage:we=>c(we),toClipboard:d,fromClipboard:a},datetime:{base:"dateString",storage:"dictionary",matches:N,format:we=>A(we.value,i(we,"datetime")),parse:we=>x(T(we.text,i(we,"datetime"))??we.text),compare:q,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(we,He)=>x(we,He&&He.timeZone),toClipboard:we=>E(we)?"":String(we),fromClipboard:we=>x(we)},duration:{base:"number",storage:"float64",matches:Pe,format:we=>Oe(ne(we.value),i(we,"duration")),parse:we=>X(we.text,i(we,"duration")),compare:(we,He)=>r(ne(we),ne(He)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:we=>{const He=ne(we);return He===null?null:He/R},toStorage:we=>ne(we),toClipboard:we=>Oe(ne(we),{style:"short",maxUnits:-1}),fromClipboard:we=>X(we)},timestamp:{base:"number",storage:"float64",format:we=>{const He=i(we,"timestamp");return ce(we.value,{...He,timeZone:oe(He,we)})},parse:we=>{const He=i(we,"timestamp"),Te=T(we.text,{timeZone:oe(He,we)});return Te?Te.getTime():null},compare:(we,He)=>r(S(we),S(He)),groupProjector:(we,He)=>ve(we,He),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(we,He)=>{const Te=S(we);if(Te==null)return null;const Ae=P(Te,He&&He.timeZone||void 0);return(Date.UTC(Ae.year,Ae.month-1,Ae.day,Ae.hour,Ae.minute,Ae.second)-Ie)/R},toStorage:we=>S(we),toClipboard:we=>{const He=S(we);return He==null?"":new Date(He).toISOString()},fromClipboard:we=>S(we)}},Ce=["datetime","time","duration"],Le=ke}),_e("packages/core/src/internal/lru.js",function(e,F){"use strict";Object.defineProperty(e,"Lru",{enumerable:!0,get:function(){return ie}});class ie{#e;#t=new Map;#n;constructor(K=256,I=null){this.#e=K,this.#n=I}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 I=this.#t;if(!I.has(K))return;const L=I.get(K);return I.delete(K),I.set(K,L),L}peek(K){return this.#t.get(K)}set(K,I){const L=this.#t;return L.has(K)&&L.delete(K),L.set(K,I),this.#r(),I}delete(K){const I=this.#t.get(K);return this.#t.delete(K)&&this.#n&&this.#n(I,K),I}clear(){if(this.#n)for(const[K,I]of this.#t)this.#n(I,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 I=K.keys().next().value,L=K.get(I);K.delete(I),this.#n&&this.#n(L,I)}}}}),_e("packages/core/src/columns/types/network.js",function(e,F){"use strict";Object.defineProperty(e,"toUint32",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return R}}),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 o}}),Object.defineProperty(e,"cidrNetworkOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"storeNumberOf",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isCidr",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"compareCidr",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"netmask",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"addressCount",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"ipv6Groups",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"macValue",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"parseMac",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"formatMac",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"macHex",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"macContains",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"compareMac",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"MAC_OPERATORS",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return fe}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/internal/lru.js").Lru,L=4294967295,Q=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function U(oe){if(E(oe))return null;if(typeof oe=="string")return x(oe);const ce=Number(oe);return Number.isFinite(ce)?ce<0?ce<-2147483648?null:ce>>>0:ce>L?null:Math.trunc(ce)>>>0:null}function x(oe){if(E(oe))return null;const ce=String(oe).trim();if(ce==="")return null;const de=Q.exec(ce);if(!de)return null;let ve=0;for(let ke=1;ke<=4;ke++){const Ce=de[ke];if(Ce.length>1&&Ce.charCodeAt(0)===48)return null;const Le=Number(Ce);if(Le>255)return null;ve=ve*256+Le}return ve}function q(oe){const ce=U(oe);return ce===null?"":`${ce>>>24&255}.${ce>>>16&255}.${ce>>>8&255}.${ce&255}`}function R(oe){return typeof oe=="string"&&x(oe)!==null}function j(oe,ce){const de=U(oe),ve=U(ce);return de===null?ve===null?0:1:ve===null||de<ve?-1:de>ve?1:0}const k=64,b=L*k+32,u=/^(?:0|[1-9]\d?)$/;function g(oe,ce){return oe*k+ce}function o(oe){if(E(oe))return null;if(typeof oe=="string"){const ve=r(oe);return ve===null?null:o(ve)}if(typeof oe=="object"){const ve=U(oe.address),ke=Number(oe.prefix);return ve===null||!Number.isInteger(ke)||ke<0||ke>32?null:{address:ve,prefix:ke}}const ce=Number(oe);if(!Number.isInteger(ce)||ce<0||ce>b)return null;const de=ce%k;return de>32?null:{address:(ce-de)/k,prefix:de}}function t(oe){return!!(oe&&oe.typeOptions&&oe.typeOptions.cidrNetwork)}function i(oe){return!!(oe&&oe.typeOptions&&oe.typeOptions.storeNumber)}function s(oe,ce,de){return oe==null?null:i(ce)?oe:de(oe)}function r(oe,ce){if(E(oe))return null;const de=String(oe).trim();if(de==="")return null;const ve=de.indexOf("/");if(ve<0)return null;const ke=x(de.slice(0,ve));if(ke===null)return null;const Ce=de.slice(ve+1).trim();if(!u.test(Ce))return null;const Le=Number(Ce);if(Le>32)return null;const we=ce&&ce.network?(ke&a(Le))>>>0:ke;return g(we,Le)}function n(oe){const ce=o(oe);return ce?`${q(ce.address)}/${ce.prefix}`:""}function m(oe){return typeof oe=="string"&&r(oe)!==null}function l(oe,ce){const de=o(oe),ve=o(ce);return de?ve?de.address!==ve.address?de.address<ve.address?-1:1:de.prefix-ve.prefix:-1:ve?1:0}function a(oe){return oe===0?0:4294967295<<32-oe>>>0}function c(oe){const ce=o(oe);return ce?(ce.address&a(ce.prefix))>>>0:null}function f(oe){const ce=o(oe);return ce?(ce.address&a(ce.prefix)|~a(ce.prefix)>>>0)>>>0:null}function p(oe){const ce=o(oe);return ce?2**(32-ce.prefix):null}function y(oe){const ce=o(oe);return ce?ce.prefix===32?1:ce.prefix===31?2:2**(32-ce.prefix)-2:null}function h(oe,ce){const de=o(oe);if(!de)return!1;const ve=U(ce);if(ve===null)return!1;const ke=a(de.prefix);return(ve&ke)>>>0===(de.address&ke)>>>0}function d(oe,ce){const de=c(oe),ve=c(ce);return de===null||ve===null?!1:de<=f(ce)&&ve<=f(oe)}const w=/^[0-9a-fA-F]{1,4}$/,v=new I(512);function P(oe){if(E(oe))return null;let ce=String(oe).trim();if(ce==="")return null;const de=ce.indexOf("%");if(de>=0&&(ce=ce.slice(0,de)),ce==="")return null;if(ce.indexOf(".")>=0){const He=ce.lastIndexOf(":");if(He<0)return null;const Te=x(ce.slice(He+1));if(Te===null)return null;ce=`${ce.slice(0,He+1)}${(Te>>>16&65535).toString(16)}:${(Te&65535).toString(16)}`}const ve=ce.split("::");if(ve.length>2)return null;const ke=W(ve[0]);if(ke===null)return null;if(ve.length===1)return ke.length===8?ke:null;const Ce=W(ve[1]);if(Ce===null)return null;const Le=8-ke.length-Ce.length;if(Le<1)return null;const we=ke.slice();for(let He=0;He<Le;He++)we.push(0);for(const He of Ce)we.push(He);return we}function W(oe){if(oe==="")return[];const ce=[];for(const de of oe.split(":")){if(!w.test(de))return null;ce.push(parseInt(de,16))}return ce}function V(oe){if(typeof oe!="string")return P(oe);if(v.has(oe))return v.get(oe);const ce=P(oe);return v.set(oe,ce),ce}function G(oe){if(oe[0]===0&&oe[1]===0&&oe[2]===0&&oe[3]===0&&oe[4]===0&&oe[5]===65535)return`::ffff:${q((oe[6]<<16|oe[7])>>>0)}`;let ce=-1,de=0,ve=-1,ke=0;for(let we=0;we<8;we++)oe[we]===0?(ve<0?(ve=we,ke=1):ke++,ke>de&&(de=ke,ce=ve)):(ve=-1,ke=0);if(de<2)return oe.map(we=>we.toString(16)).join(":");const Ce=oe.slice(0,ce).map(we=>we.toString(16)).join(":"),Le=oe.slice(ce+de).map(we=>we.toString(16)).join(":");return`${Ce}::${Le}`}function _(oe){const ce=P(oe);return ce===null?null:G(ce)}function T(oe){return _(oe)??""}function S(oe){return typeof oe=="string"&&oe.indexOf(":")>=0&&P(oe)!==null}function O(oe,ce){const de=V(oe),ve=V(ce);if(!de)return ve?1:0;if(!ve)return-1;for(let ke=0;ke<8;ke++)if(de[ke]!==ve[ke])return de[ke]<ve[ke]?-1:1;return 0}const M=/^[0-9a-fA-F]{12}$/,A=/^[0-9a-fA-F]{4}\.[0-9a-fA-F]{4}\.[0-9a-fA-F]{4}$/,N=/^[0-9a-fA-F]{2}$/;function $(oe){const ce=[];for(let de=0;de<12;de+=2)ce.push(parseInt(oe.slice(de,de+2),16));return ce}function H(oe){if(E(oe))return null;if(typeof oe=="number"){if(!Number.isInteger(oe)||oe<0||oe>0xffffffffffff)return null;const ke=[];for(let Ce=5;Ce>=0;Ce--)ke.push(Math.floor(oe/256**Ce)%256);return ke}const ce=String(oe).trim();if(ce==="")return null;if(M.test(ce))return $(ce);if(ce.indexOf(".")>=0)return A.test(ce)?$(ce.split(".").join("")):null;const de=ce.indexOf(":")>=0?":":ce.indexOf("-")>=0?"-":null;if(de===null)return null;const ve=ce.split(de);if(ve.length!==6)return null;for(const ke of ve)if(!N.test(ke))return null;return ve.map(ke=>parseInt(ke,16))}function Y(oe){const ce=H(oe);if(!ce)return null;let de=0;for(const ve of ce)de=de*256+ve;return de}function Z(oe){const ce=H(oe);return ce?ce.map(de=>de.toString(16).padStart(2,"0")).join(":"):null}function J(oe,ce="colon"){const de=H(oe);if(!de)return"";const ve=de.map(ke=>ke.toString(16).padStart(2,"0"));switch(ce){case"hyphen":return ve.join("-");case"colon-upper":return ve.map(ke=>ke.toUpperCase()).join(":");case"cisco":return`${ve[0]}${ve[1]}.${ve[2]}${ve[3]}.${ve[4]}${ve[5]}`;default:return ve.join(":")}}function D(oe){return typeof oe=="string"&&H(oe)!==null}function te(oe){if(E(oe))return null;const ce=String(oe).trim();if(ce==="")return null;const de=ce.replace(/[:-]/g,"").replace(/\./g,"").toLowerCase();return/^[0-9a-f]+$/.test(de)?de:null}function z(oe,ce){const de=te(oe),ve=te(ce);return!!(de&&ve&&de.includes(ve))}function X(oe,ce){const de=Y(oe),ve=Y(ce);return de===null?ve===null?0:1:ve===null||de<ve?-1:de>ve?1:0}const ne=Object.freeze(["macEquals","macInRange","macContains"]),se=Object.freeze(["eq","ne","contains","notContains","startsWith","endsWith"]);function ue(oe){switch(oe){case"macEquals":return{compile:ce=>{const de=Y(ce);return de===null?()=>!1:ve=>Y(ve)===de},check:ce=>Y(ce)===null?"the operand is not a MAC address":null};case"macInRange":return{compile:ce=>{const de=Array.isArray(ce)?ce:[ce,ce],ve=Y(de[0]),ke=Y(de[1]);return ve===null||ke===null||ve>ke?()=>!1:Ce=>{const Le=Y(Ce);return Le!==null&&Le>=ve&&Le<=ke}},check:ce=>{const de=Array.isArray(ce)?ce:[];if(de.length!==2)return"the operand must be two MAC addresses, the low and high ends of the range";const ve=Y(de[0]),ke=Y(de[1]);return ve===null||ke===null?"an end of the range is not a MAC address":ve>ke?"the low end of the range is above the high end":null}};case"macContains":return{compile:ce=>de=>z(de,ce),check:ce=>te(ce)===null?"the operand is not hex":null};default:return{compile:()=>()=>!1,check:()=>"unknown MAC operator"}}}function ge(oe){switch(oe){case"eq":return{compile:ce=>{const de=Y(ce);return de===null?()=>!1:ve=>Y(ve)===de},check:ce=>Y(ce)===null?"the operand is not a MAC address":null};case"ne":return{compile:ce=>{const de=Y(ce);return de===null?()=>!1:ve=>Y(ve)!==de},check:ce=>Y(ce)===null?"the operand is not a MAC address":null};case"contains":return{compile:ce=>de=>z(de,ce),check:ce=>te(ce)===null?"the operand is not hex":null};case"notContains":return{compile:ce=>de=>!z(de,ce),check:ce=>te(ce)===null?"the operand is not hex":null};case"startsWith":return{compile:ce=>{const de=String(ce??"").toLowerCase();return ve=>ve==null?!1:String(ve).toLowerCase().startsWith(de)}};case"endsWith":return{compile:ce=>{const de=String(ce??"").toLowerCase();return ve=>ve==null?!1:String(ve).toLowerCase().endsWith(de)}};default:return{compile:()=>()=>!1,check:()=>"unknown MAC text operator"}}}const Oe=Object.freeze(["lt","lte","gt","gte","between","notBetween","in","notIn","matches"]);function Pe(oe){const ce=o(oe);return ce===null?null:g(ce.address,ce.prefix)}function Ie(oe,ce,de){const ve=we=>String(we??"").trim().toLowerCase(),ke=we=>{if(we==null)return null;const He=ce(we);return He===""?null:He.toLowerCase()},Ce=we=>oe(we)===null?`the operand is not ${de}`:null,Le=(we,He)=>({compile:Te=>{const Ae=ve(Te);return Se=>{const Ee=ke(Se);return Ee===null?He:He?!we(Ee,Ae):we(Ee,Ae)}}});return Object.freeze({eq:{compile:we=>{const He=oe(we);return He===null?()=>!1:Te=>oe(Te)===He},check:Ce},ne:{compile:we=>{const He=oe(we);return He===null?()=>!0:Te=>oe(Te)!==He},check:Ce},contains:Le((we,He)=>we.includes(He),!1),notContains:Le((we,He)=>we.includes(He),!0),startsWith:Le((we,He)=>we.startsWith(He),!1),endsWith:Le((we,He)=>we.endsWith(He),!1),...Object.fromEntries(Oe.map(we=>[we,Object.freeze({})]))})}const xe=Object.freeze({ipv4:"Enter an IPv4 address, for example 10.0.0.1",cidr:"Enter a network in CIDR form, for example 10.0.0.0/24",ipv6:"Enter an IPv6 address, for example 2001:db8::1",mac:"Enter a MAC address, for example 00:1a:2b:3c:4d:5e"}),ye=(oe,ce)=>de=>{const ve=de&&typeof de.text=="string"?de.text:"";return ve.trim()!==""&&oe(ve)===null?ce:null},re=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:R,parse:oe=>x(oe.text),parseError:ye(x,xe.ipv4),compare:j,format:oe=>q(oe.value),operators:Ie(U,q,"an IPv4 address"),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:oe=>U(oe),toRow:(oe,ce)=>s(oe,ce,q),toClipboard:oe=>q(oe),fromClipboard:oe=>x(oe)},cidr:{base:"number",storage:"float64",matches:m,parse:oe=>r(oe.text,{network:t(oe.column)}),parseError:ye(r,xe.cidr),compare:l,format:oe=>n(oe.value),operators:Ie(Pe,n,"a network in CIDR form"),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:oe=>{const ce=o(oe);return ce===null?null:g(ce.address,ce.prefix)},toRow:(oe,ce)=>s(oe,ce,n),toClipboard:oe=>n(oe),fromClipboard:(oe,ce)=>r(oe,{network:t(ce&&ce.column)})},ipv6:{base:"text",storage:"dictionary",matches:S,parse:oe=>_(oe.text),parseError:ye(_,xe.ipv6),compare:O,format:oe=>T(oe.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:oe=>_(oe),toClipboard:oe=>T(oe),fromClipboard:oe=>_(oe)},mac:{base:"text",storage:"dictionary",matches:D,parse:oe=>Z(oe.text),parseError:ye(Z,xe.mac),compare:X,format:oe=>J(oe.value,oe.column&&oe.column.typeOptions&&oe.column.typeOptions.macFormat),operators:Object.freeze({...Object.fromEntries(ne.map(oe=>[oe,ue(oe)])),...Object.fromEntries(se.map(oe=>[oe,ge(oe)]))}),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:oe=>Z(oe),fromClipboard:oe=>Z(oe)}}),fe=re}),_e("packages/core/src/columns/types/vlan.js",function(e,F){"use strict";Object.defineProperty(e,"vlanError",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseVlans",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"formatVlans",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"vlanContains",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"vlanOverlaps",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"vlanCount",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"isVlan",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"compareVlans",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"VLAN_TYPES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}});const ie=1,E=4094,K=/^\d+$/;function I(t,i){const s=!!(i&&i.single),r=t==null?"":String(t).trim();if(r==="")return{ids:null,error:null};const n=r.split(","),m=new Set;for(const l of n){const a=l.trim();if(a==="")return{ids:null,error:`"${r}" has an empty entry`};const c=a.indexOf("-");if(c>=0){if(s)return{ids:null,error:"a single-ID VLAN column holds one ID, not a list or range"};const f=a.slice(0,c).trim(),p=a.slice(c+1).trim();if(!K.test(f)||!K.test(p))return{ids:null,error:`"${a}" is not a VLAN range like 20-30`};let y=Number(f),h=Number(p);if(y<ie||y>E||h<ie||h>E)return{ids:null,error:`VLAN IDs are between ${ie} and ${E}`};if(y>h){const d=y;y=h,h=d}for(let d=y;d<=h;d++)m.add(d)}else{if(!K.test(a))return{ids:null,error:`"${a}" is not a VLAN ID (a whole number ${ie}-${E})`};const f=Number(a);if(f<ie||f>E)return{ids:null,error:`VLAN IDs are between ${ie} and ${E}`};if(s&&n.length>1)return{ids:null,error:"a single-ID VLAN column holds one ID, not a list or range"};m.add(f)}}return s&&m.size>1?{ids:null,error:"a single-ID VLAN column holds one ID, not a list or range"}:{ids:[...m].sort((l,a)=>l-a),error:null}}function L(t,i){return I(t,i).error}function Q(t){const i=[];let s=0;for(;s<t.length;){let r=s;for(;r+1<t.length&&t[r+1]===t[r]+1;)r++;i.push(r===s?String(t[s]):`${t[s]}-${t[r]}`),s=r+1}return i.join(",")}function U(t){if(t==null||t==="")return null;if(typeof t=="string")return I(t,{}).ids;if(Array.isArray(t)){const i=new Set;for(const s of t){if(typeof s!="number"||!Number.isInteger(s)||s<ie||s>E)return null;i.add(s)}return i.size?[...i].sort((s,r)=>s-r):null}return typeof t=="number"&&Number.isInteger(t)&&t>=ie&&t<=E?[t]:null}function x(t,i){const s=I(t,i);return s.ids===null?null:Q(s.ids)}function q(t){const i=U(t);return i===null?"":Q(i)}function R(t,i){const s=U(t);if(s===null)return!1;const r=Number(i);return Number.isInteger(r)&&s.includes(r)}function j(t,i){const s=U(t);if(s===null)return!1;const r=new Set(s),n=Array.isArray(i)?i:typeof i=="string"?i.split(","):[i];for(const m of n){const l=Number(typeof m=="string"?m.trim():m);if(Number.isInteger(l)&&r.has(l))return!0}return!1}function k(t){const i=U(t);return i===null?0:i.length}function b(t){return typeof t=="string"&&x(t)!==null}function u(t,i){const s=U(t),r=U(i);return s===null?r===null?0:1:r===null?-1:s[0]!==r[0]?s[0]<r[0]?-1:1:s.length<r.length?-1:s.length>r.length?1:0}const g=Object.freeze({vlan:{base:"text",storage:"dictionary",matches:b,parse:t=>x(t.text,{single:!!(t.column&&t.column.typeOptions&&t.column.typeOptions.vlanSingle)}),parseError:t=>L(t.text,{single:!!(t.column&&t.column.typeOptions&&t.column.typeOptions.vlanSingle)}),compare:u,format:t=>q(t.value),defaults:{filter:"text",editor:"vlan",align:"start"},excel:"@",operators:Object.freeze({contains:{compile:t=>i=>R(i,t),check:t=>{const i=Number(typeof t=="string"?t.trim():t);return!Number.isInteger(i)||i<ie||i>E?`contains needs one VLAN ID ${ie}-${E}`:null}},overlaps:{compile:t=>i=>j(i,t),check:t=>{const i=Array.isArray(t)?t:typeof t=="string"?t.split(","):[t];for(const s of i){const r=Number(typeof s=="string"?s.trim():s);if(!Number.isInteger(r)||r<ie||r>E)return`overlaps needs VLAN IDs ${ie}-${E}`}return null}}}),toStorage:t=>x(t),toClipboard:t=>q(t),fromClipboard:t=>x(t)}}),o=g}),_e("packages/core/src/i18n/catalogue.js",function(e,F){"use strict";Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return L}});const ie=F("packages/core/src/registry/free-tier-notice.js"),E=ie.FREE_TIER_NOTICE,K=ie.WATERMARK_TEXT,I=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.column.hidden":"{column} hidden","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","rowCap.more":"+ {count} more","panel.formatting":"Formatting","panel.statistics":"Statistics","stat.noData":"No data","stat.unavailable":"Not available on this source","stat.tone.good":"good","stat.tone.bad":"bad","stat.tone.flat":"flat","stat.target":"target {target}","meter.target":"target {value}","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","listview.pullToRefresh.pull":"Pull to refresh","listview.pullToRefresh.release":"Release to refresh","listview.pullToRefresh.refreshing":"Refreshing…","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.columnMenu":"Column menu","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; while editing, commit and open the cell below (Shift+Enter: above)","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.beforeOrEqual":"Before or equal","filter.op.after":"After","filter.op.afterOrEqual":"After or equal","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.operatorNamed":"Operator: {name}","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.order":"Order values","filter.orderAz":"A to Z","filter.orderCount":"Count","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.suppressed.unavailable":"Histogram unavailable","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"}),L=Object.freeze(Object.keys(I))}),_e("packages/core/src/i18n/format.js",function(e,F){"use strict";Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"formatMessage",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return k}});const E=F("packages/core/src/internal/predicates.js").isFunction,K=/\{(\w+)\}/g,I=new Map,L=new Map;function Q(b){const u=b||"";if(I.has(u))return I.get(u);let g=null;try{g=new Intl.PluralRules(b||void 0)}catch{g=null}return I.set(u,g),g}function U(b,u,g="conjunction"){const o=Array.isArray(b)?b.filter(s=>s!=null&&s!==""):[];if(o.length===0)return"";if(o.length===1)return String(o[0]);const t=`${u||""}|${g}`;let i=L.get(t);if(i===void 0){try{i=new Intl.ListFormat(u||void 0,{style:"long",type:g})}catch{i=null}L.set(t,i)}return i?i.format(o.map(String)):o.map(String).join(", ")}function x(b,u){return b==null?"":typeof b=="number"?Number.isFinite(b)?b.toLocaleString(u||void 0,{maximumFractionDigits:20}):"":String(b)}function q(b,u,g){if(typeof b=="string")return b;if(!b||typeof b!="object")return"";const o=u&&typeof u.count=="number"?u.count:null;if(o===null)return b.other??"";const t=Q(g),i=t?t.select(o):o===1?"one":"other";return b[i]??b.other??""}function R(b,u={},g){const o=q(b,u,g);return o?o.replace(K,(t,i)=>Object.prototype.hasOwnProperty.call(u,i)?x(u[i],g):t):""}function j(b,u,g="en-GB"){return typeof b=="string"&&b?b:typeof u=="string"&&u?u:g}function k(b,u){const g=b?b[u]:void 0;return g==null||E(g)?u:g}}),_e("packages/core/src/i18n/registry.js",function(e,F){"use strict";Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"localeCatalogue",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return Q}});const E=F("packages/core/src/i18n/catalogue.js").EN_GB,K=new Map([["en-gb",E]]);function I(U,x){const q=typeof U=="string"?U.toLowerCase():"";return!q||!x||typeof x!="object"?!1:(K.set(q,x),!0)}function L(U){if(typeof U!="string"||!U)return null;const x=U.toLowerCase(),q=K.get(x);if(q)return q;const R=x.split("-")[0],j=K.get(R);if(j)return j;for(const[k,b]of K)if(k.split("-")[0]===R)return b;return null}function Q(){return[...K.keys()]}}),_e("packages/core/src/i18n/index.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_LOCALE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"Messages",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"defaultMessages",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return r}});const ie=F("packages/core/src/i18n/catalogue.js"),E=ie.EN_GB,K=ie.MESSAGE_KEYS,I=F("packages/core/src/i18n/format.js"),L=I.formatMessage,Q=I.formatList,U=I.lookup,x=I.resolveLocale,R=F("packages/core/src/internal/predicates.js").isFunction,k=F("packages/core/src/internal/warn.js").warnOnce,b=F("packages/core/src/i18n/registry.js"),u=b.registerLocale,g=b.localeCatalogue;Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return ie.EN_GB}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return ie.MESSAGE_KEYS}}),Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return I.formatList}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return I.resolveLocale}}),Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return b.registerLocale}});const o="en-GB";class t{#e=o;#t=E;constructor(m={}){this.configure(m)}configure(m={}){this.#e=x(m.locale,m.declared,o);const l=m.messages,a=g(this.#e);if(!a&&this.#e.toLowerCase()!=="en-gb"&&(!l||typeof l!="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.`),!l||typeof l!="object"){this.#t=a?{...E,...a}:E;return}const f=Object.keys(l).filter(p=>!(p in E));f.length&&k(`i18n:unknown:${f[0]}`,`message keys not in the catalogue and so ignored: ${f.slice(0,5).join(", ")}${f.length>5?`, and ${f.length-5} more`:""}`),this.#t={...E,...a||{},...l}}get locale(){return this.#e}t(m,l){return L(U(this.#t,m),l||{},this.#e)}list(m,l){return Q(m,this.#e,l)}number(m,l){const a=Number(m);return Number.isFinite(a)?a.toLocaleString(this.#e,l||{maximumFractionDigits:20}):""}}const i=new t;function s(n){return n instanceof t?n:new t(n||{})}function r(n){const m=n&&typeof n=="object"?n:{},l=K.filter(c=>{const f=m[c];return f==null||f===""||R(f)}),a=Object.keys(m).filter(c=>!(c in E));return{missing:l,unknown:a}}}),_e("packages/core/src/columns/types/structured.js",function(e,F){"use strict";Object.defineProperty(e,"MASK_DEFAULTS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"parseJsonText",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}});const ie=F("packages/core/src/internal/predicates.js"),E=ie.isNil,K=ie.isObject,L=F("packages/core/src/i18n/index.js").defaultMessages,Q=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function U(t,i){const s=i||{},r=s.emptyDisplay??Q.emptyDisplay;if(E(t)||t==="")return r;const m=[...typeof s.char=="string"&&s.char!==""?s.char:Q.char][0]||Q.char,l=s.fixedLength??Q.fixedLength,a=Number.isFinite(s.length)&&Number(s.length)>0?Math.floor(Number(s.length)):Q.length,c=typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):null;let f=0;if(c!==null){const p=Number.isFinite(s.lastVisible)?Math.floor(Number(s.lastVisible)):Q.lastVisible,y=[...c];if(f=p>0&&p<y.length?p:0,f>0){const h=y.slice(y.length-f).join(""),d=Math.max(1,(l?a:y.length)-f);return m.repeat(d)+h}return m.repeat(l?a:Math.max(1,y.length))}return m.repeat(a)}const x=48;function q(t){try{const i=JSON.stringify(t);return i===void 0?null:i}catch{return null}}function R(t,i){if(E(t))return"";const s=Number.isFinite(i&&i.inlineLimit)?Number(i.inlineLimit):x;if(typeof t=="string")return t.length>s?`${t.slice(0,s-1)}…`:t;if(typeof t!="object")return String(t);const r=q(t);if(r!==null&&r.length<=s)return r;if(Array.isArray(t)){const m=t.length;return`[${L.t("count.items",{count:m})}]`}const n=Object.keys(t).length;return`{${L.t("count.keys",{count:n})}}`}function j(t,i){if(t==null)return"null";const s=typeof t;if(s==="number"||s==="boolean"||s==="bigint")return String(t);if(s==="string")return JSON.stringify(t);if(s!=="object")return JSON.stringify(String(t));const r=i||new WeakSet;return r.has(t)?'"[circular]"':(r.add(t),t instanceof Date?JSON.stringify(t.toISOString()):Array.isArray(t)?`[${t.map(l=>j(l,r)).join(",")}]`:`{${Object.keys(t).sort().map(l=>`${JSON.stringify(l)}:${j(t[l],r)}`).join(",")}}`)}function k(t,i){if(E(t))return E(i)?0:1;if(E(i))return-1;const s=j(t),r=j(i);return s<r?-1:s>r?1:0}function b(t){if(E(t))return null;const i=String(t);if(i.trim()==="")return null;try{return JSON.parse(i)}catch{return i}}function u(t){const i=t&&t.cell&&t.cell.props;return K(i)?i:{}}const g=Object.freeze({json:{base:"object",storage:"object",format:t=>R(t&&t.value,u(t&&t.column)),parse:t=>b(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 i=JSON.stringify(t,null,2);return i===void 0?String(t):i}catch{return String(t)}},fromClipboard:t=>b(t)},secret:{base:"text",storage:"object",format:t=>U(t&&t.value,u(t&&t.column)),parse:t=>{const i=t&&t.text;return E(i)||String(i)===""?null:String(i)},compare:(t,i)=>{const s=E(t)||t==="",r=E(i)||i==="";return s===r?0:s?1:-1},defaults:{editor:"password",filter:"none",align:"start"},excel:"@",export:{csv:!1,excel:!1},toClipboard:t=>U(t),fromClipboard:t=>E(t)||String(t)===""?null:String(t)}}),o=g}),_e("packages/core/src/columns/types/unit.js",function(e,F){"use strict";Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return U}}),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 b}}),Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return N}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/internal/warn.js").warnOnce;function L($,H,Y,Z){return Object.freeze({symbol:$,factor:H,aliases:Object.freeze(Y||[]),binary:!!(Z&&Z.binary),prefix:Z&&Z.prefix||null,auto:!(Z&&Z.auto===!1)})}function Q($,H,Y,Z){return L($,H,Y,Z)}const U=Object.freeze({data:Object.freeze([L("B",1,["byte","bytes"]),L("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),L("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),L("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),L("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),L("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),L("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),L("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),L("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),L("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([L("bps",1,["bit","bits","bit/s","b/s"]),L("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),L("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),L("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),L("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([L("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),L("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),L("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),L("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),L("in",.0254,["inch","inches"],{auto:!1}),L("ft",.3048,["foot","feet"],{auto:!1}),L("yd",.9144,["yard","yards"],{auto:!1}),L("m",1,["metre","metres","meter","meters"]),L("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),L("mi",1609.344,["mile","miles"],{auto:!1}),L("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([L("mg",.001,["milligram","milligrams"]),L("g",1,["gram","grams"]),L("oz",28.349523125,["ounce","ounces"],{auto:!1}),L("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),L("kg",1e3,["kilogram","kilograms"]),L("st",6350.29318,["stone"],{auto:!1}),L("t",1e6,["tonne","tonnes","ton"],{auto:!1}),L("ton (US)",907184.74,["ton","shortton"],{auto:!1}),L("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([L("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),L("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),L("ms",.001,["msec","msecs","millisecond","milliseconds"]),L("s",1,["sec","secs","second","seconds"]),L("m",60,["min","mins","minute","minutes"]),L("h",3600,["hr","hrs","hour","hours"]),L("d",86400,["day","days"])]),speed:Object.freeze([L("mm/s",.001,["millimetre/s","millimeter/s"]),L("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),L("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),L("mph",.44704,["mile/h","miles/h"],{auto:!1}),L("kn",1852/3600,["knot","knots"],{auto:!1}),L("m/s",1,["metre/s","meter/s","mps"]),L("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([L("mm/s²",.001,["mm/s2"]),L("ft/s²",.3048,["ft/s2"],{auto:!1}),L("m/s²",1,["m/s2","metre/s2","meter/s2"]),L("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([L("mm²",1e-6,["mm2"]),L("cm²",1e-4,["cm2"]),L("in²",64516e-8,["in2","sqin"],{auto:!1}),L("ft²",.09290304,["ft2","sqft"],{auto:!1}),L("yd²",.83612736,["yd2","sqyd"],{auto:!1}),L("m²",1,["m2","sqm"]),L("ha",1e4,["hectare","hectares"],{auto:!1}),L("ac",4046.8564224,["acre","acres"],{auto:!1}),L("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([L("µL",1e-6,["ul","microlitre","microliter"]),L("mL",.001,["millilitre","milliliter"]),L("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),L("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),L("L",1,["litre","litres","liter","liters"]),L("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),L("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),L("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),L("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([L("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),L("J",1,["joule","joules"]),L("cal",4.184,["calorie","calories"],{auto:!1}),L("kJ",1e3,["kilojoule","kilojoules"]),L("BTU",1055.05585262,["btu"],{auto:!1}),L("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),L("MJ",1e6,["megajoule","megajoules"]),L("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),L("GJ",1e9,["gigajoule","gigajoules"]),L("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([L("mW",.001,["milliwatt","milliwatts"]),L("W",1,["watt","watts"]),L("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),L("kW",1e3,["kilowatt","kilowatts"]),L("hp",745.6998715822702,["horsepower"],{auto:!1}),L("MW",1e6,["megawatt","megawatts"]),L("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([L("mN",.001,["millinewton","millinewtons"]),L("N",1,["newton","newtons"]),L("lbf",4.4482216152605,["poundforce"],{auto:!1}),L("kgf",9.80665,["kilogramforce"],{auto:!1}),L("kN",1e3,["kilonewton","kilonewtons"]),L("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([L("Pa",1,["pascal","pascals"]),L("mbar",100,["millibar"],{auto:!1}),L("inH₂O",249.0889,["inh2o"],{auto:!1}),L("mmHg",133.322387415,["torr"],{auto:!1}),L("kPa",1e3,["kilopascal","kilopascals"]),L("inHg",3386.388640341,["inhg"],{auto:!1}),L("psi",6894.757293168361,["lbf/in2"],{auto:!1}),L("bar",1e5,[],{auto:!1}),L("atm",101325,["atmosphere","atmospheres"],{auto:!1}),L("MPa",1e6,["megapascal","megapascals"]),L("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([L("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),L("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),L("kN·m",1e3,["knm","kn.m"],{auto:!1}),L("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([L("kg/m³",1,["kg/m3"]),L("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),L("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),L("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([L("L/min",1/6e4,["lpm","l/min"],{auto:!1}),L("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),L("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),L("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),L("cfm",.0004719474432,["ft3/min"],{auto:!1}),L("L/s",.001,["lps","l/s"],{auto:!1}),L("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([L("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),L("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),L("mrad",.001,["milliradian","milliradians"],{auto:!1}),L("mil",Math.PI/3200,["nato-mil"],{auto:!1}),L("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),L("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),L("rad",1,["radian","radians"]),L("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([L("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),L("rad/s",1,["radps","radians/s"]),L("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),L("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([L("ppt",1e-12,["partspertrillion"],{auto:!1}),L("ppb",1e-9,["partsperbillion"]),L("ppm",1e-6,["partspermillion"]),L("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),L("‰",.001,["permille","permil"],{auto:!1}),L("%",.01,["pct","percent"]),L("×",1,["x","ratio","times"])]),molarity:Object.freeze([L("pM",1e-12,["picomolar","picomolarity"]),L("nM",1e-9,["nanomolar","nanomolarity"]),L("µM",1e-6,["um-molar","micromolar","micromolarity"]),L("mM",.001,["millimolar","millimolarity"]),L("M",1,["molar","mol/l","mol/L","molarity"]),L("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([L("mg/s",1e-6,["milligrams/s"]),L("g/s",.001,["grams/s"]),L("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),L("kg/s",1,["kilograms/s","kgps"]),L("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),L("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),L("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([L("µPa·s",1e-6,["upas","micropascalsecond"]),L("cP",.001,["centipoise"],{auto:!1}),L("mPa·s",.001,["mpas","millipascalsecond"]),L("P",.1,["poise"],{auto:!1}),L("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([L("cSt",1e-6,["centistokes","centistoke"]),L("mm²/s",1e-6,["mm2/s"],{auto:!1}),L("St",1e-4,["stokes","stoke"],{auto:!1}),L("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([L("mW/(m·K)",.001,["mw/mk"]),L("W/(m·K)",1,["w/mk","wmk"]),L("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),L("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([L("J/(kg·K)",1,["j/kgk","jkgk"]),L("kJ/(kg·K)",1e3,["kj/kgk"]),L("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([L("nSv/h",1e-9,["nsvh"]),L("µSv/h",1e-6,["usv/h","usvh"]),L("mSv/h",.001,["msvh"]),L("Sv/h",1,["svh"]),L("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),x=Symbol("ambiguous"),q=new Map,R=new Map;function j($,H){const Y=String($||"").trim();if(!Y)throw new Error("[lattice] a unit system needs a name");if(U[Y]||R.has(Y))throw new Error(`[lattice] unit system "${Y}" already exists`);const Z=[...H||[]];if(!Z.length)throw new Error(`[lattice] unit system "${Y}" has no units`);if(!Z.some(D=>D.factor===1))throw new Error(`[lattice] unit system "${Y}" has no base unit (none with factor 1)`);const J=new Set;for(const D of Z){if(J.has(D.symbol))throw new Error(`[lattice] unit system "${Y}" declares "${D.symbol}" twice`);J.add(D.symbol)}return R.set(Y,Object.freeze(Z)),q.delete(Y),Y}function k(){return[...Object.keys(U),...R.keys()]}function b($){const H=u($);return H?H.units:[]}function u($){const H=String($||""),Y=q.get(H);if(Y!==void 0)return Y;const Z=U[H]||R.get(H);if(!Z)return q.set(H,null),null;const J=Object.freeze([...Z].sort((ne,se)=>ne.factor-se.factor)),D=new Map,te=new Map,z=(ne,se)=>{const ue=D.get(ne);ue===void 0?D.set(ne,se):ue!==se&&D.set(ne,x)};for(const ne of J){z(ne.symbol.toLowerCase(),ne);for(const se of ne.aliases)z(se.toLowerCase(),ne);if(ne.prefix){const se=te.get(ne.prefix)||[];se.push(ne),te.set(ne.prefix,se)}}const X={units:J,byToken:D,byPrefix:te,decimal:J.filter(ne=>!ne.binary&&ne.auto),binary:J.some(ne=>ne.binary)?J.filter(ne=>(ne.binary||ne.factor===1)&&ne.auto):null};return q.set(H,X),X}function g($,H){return H&&$.binary||$.decimal}function o($,H){const Y=u($);if(!Y||E(H))return null;const Z=Y.units.find(D=>D.symbol===String(H));if(Z)return Z;const J=Y.byToken.get(String(H).trim().toLowerCase());return J&&J!==x?J:null}const t=new WeakMap;function i($){const H=$||{};if(typeof H=="object"&&H!==null){const D=t.get(H);if(D!==void 0)return D}const Y=H.system||"data",Z=u(Y);let J=null;if(!Z)I(`unit:system:${Y}`,`unknown unit system "${Y}"; known systems are ${k().join(", ")}`);else{let D=H.unit?o(Y,H.unit):null;D||(H.unit&&I(`unit:unit:${Y}:${H.unit}`,`unknown unit "${H.unit}" in system "${Y}"; falling back to ${Z.units[0].symbol}`),D=Z.units.find(te=>te.factor===1)||Z.units[0]),J={index:Z,base:D,binary:H.binary===!0}}return typeof H=="object"&&H!==null&&t.set(H,J),J}const s=new WeakMap;function r($,H){if(!$||!H||!Array.isArray($.compound)||$.compound.length===0)return null;const Y=s.get($);if(Y!==void 0)return Y;const Z=new Set,J=[];for(const te of $.compound){const z=o($.system||"data",te);if(!z){I(`unit:compound:${$.system}:${te}`,`unknown compound unit "${te}" in system "${$.system||"data"}"; ignoring it`);continue}Z.has(z.symbol)||(Z.add(z.symbol),J.push(z))}J.sort((te,z)=>z.factor-te.factor);const D=J.length>=2?J:null;return s.set($,D),D}function n($,H,Y){return H===Y||H.factor===Y.factor?$:$*H.factor/Y.factor}const m=new Map;function l($){const H=$||"",Y=m.get(H);if(Y)return Y;const Z={group:",",decimal:"."};try{for(const J of new Intl.NumberFormat($||void 0).formatToParts(12345.6))J.type==="group"?Z.group=J.value:J.type==="decimal"&&(Z.decimal=J.value)}catch{}return m.set(H,Z),Z}const a=/[\s ]/g,c=/^[+-]?[\d '’ .,]*(?:[eE][+-]?\d+)?/,f=/^[^\d+\-(.,\s]+\s*/,p=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function y($,H){const{group:Y,decimal:Z}=l(H);let J=String($).replace(a,"");if(J==="")return null;const D=Z?J.indexOf(Z):-1;if(Y&&Y!==Z){if(D>=0&&J.indexOf(Y,D+Z.length)>=0)return null;J=J.split(Y).join("")}if(Z&&Z!=="."&&(J=J.split(Z).join(".")),!p.test(J))return null;const te=Number(J);return Number.isFinite(te)?te:null}function h($,H,Y){const Z=String($).trim().replace(/\.$/,"");if(Z==="")return null;const J=H.units.find(se=>se.symbol===Z);if(J)return J;const D=Z.toLowerCase(),te=H.byToken.get(D);if(te===x)return null;if(te)return te;const z=H.byPrefix.get(D);if(!z||!z.length)return null;const X=g(H,Y),ne=z.filter(se=>X.includes(se));return ne.length===1?ne[0]:null}function d($,H,Y,Z){let J=$,D=0,te=!1,z=!1;for(;J!=="";){const X=c.exec(J)[0];if(X==="")return null;const ne=y(X,Z&&Z.locale);if(ne===null)return null;J=J.slice(X.length).trim();const se=J.search(/[+-]?[\d]/),ue=(se>=0?J.slice(0,se):J).trim();if(J=se>=0?J.slice(se).trim():"",ue===""){if(te)return null;z=!0,D+=n(ne,Y[0],H.base)}else{const ge=h(ue,H.index,H.binary);if(!ge)return null;D+=n(ne,ge,H.base)}if(te=!0,z&&J!=="")return null}return te?D:null}function w($,H){if(E($))return null;if(typeof $=="number")return Number.isFinite($)?$:null;const Y=i(H);if(!Y)return null;let Z=String($).trim();if(Z==="")return null;let J=!1;Z.startsWith("(")&&Z.endsWith(")")&&(J=!0,Z=Z.slice(1,-1).trim());const D=r(H,Y);if(D){Z.startsWith("-")&&(J=!0,Z=Z.slice(1).trim());const Oe=d(Z,Y,D,H);return Oe===null?null:J?-Oe:Oe}let te=null;const z=f.exec(Z);if(z&&z[0]){const Oe=h(z[0].trim(),Y.index,Y.binary);Oe&&(te=Oe,Z=Z.slice(z[0].length).trim())}const X=c.exec(Z)[0],ne=y(X,H&&H.locale);if(ne===null)return null;const se=Z.slice(X.length).trim();if(te&&se!=="")return null;const ue=te||(se===""?Y.base:h(se,Y.index,Y.binary));if(!ue)return null;const ge=n(ne,ue,Y.base);return J?-ge:ge}const v=new Map;function P($,H,Y,Z){const J=`${$||""}|${H}|${Y}|${Z?1:0}`;let D=v.get(J);return D||(D=new Intl.NumberFormat($||void 0,{minimumFractionDigits:H,maximumFractionDigits:Y,useGrouping:Z}),v.set(J,D)),D}function W($,H){if(!Number.isFinite($)||$===0)return Math.max(0,H-1);const Y=Math.floor(Math.log10(Math.abs($)));return Math.min(20,Math.max(0,H-1-Y))}function V($,H){if(!Number.isFinite($)||$===0)return $;const Y=Math.ceil(Math.log10(Math.abs($))),Z=10**(H-Y);return Math.round($*Z)/Z}function G($,H,Y){if(!Y||Y===H.base.symbol)return H.base;if(Y!=="auto")return _(H,Y);if($===0||!Number.isFinite($))return H.base;const Z=Math.abs($)*H.base.factor,J=g(H.index,H.binary);let D=J[0];for(const X of J)Z>=X.factor&&(D=X);if(Z>=D.factor)return D;let te=D;for(const X of H.index.units)X.binary!==H.binary&&X.factor!==1||X.factor<=Z&&X.factor>(te===D?0:te.factor)&&(te=X);if(te!==D)return te;let z=D;for(const X of H.index.units)X.binary!==H.binary&&X.factor!==1||X.factor<z.factor&&(z=X);return z.factor<H.base.factor?z:H.base}function _($,H){const Y=$.index.units.find(J=>J.symbol===H);if(Y)return Y;const Z=$.index.byToken.get(String(H).toLowerCase());return Z&&Z!==x?Z:(I(`unit:display:${H}`,`unknown display unit "${H}"; rendering in ${$.base.symbol}`),$.base)}function T($,H,Y,Z){const J=$<0;let D=Math.abs($)*H.base.factor;const te=typeof Z.decimals=="number"?Z.decimals:Z.minDecimals??0,z=typeof Z.decimals=="number"?Z.decimals:Z.maxDecimals??Math.max(te,2),X=Z.space??" ",ne=[];for(let ue=0;ue<Y.length;ue++){const ge=Y[ue],Oe=ue===Y.length-1;let Pe=Oe?D/ge.factor:Math.floor(D/ge.factor);if(D-=Pe*ge.factor,Oe){const xe=10**z;Pe=Math.round(Pe*xe)/xe+0}const Ie=Oe?P(Z.locale,te,z,Z.group!==!1):P(Z.locale,0,0,Z.group!==!1);ne.push(`${Ie.format(Pe)}${X}${ge.symbol}`)}const se=ne.join(" ");return J?`-${se}`:se}function S($,H){const Y=H||{},Z=Y.nullDisplay??"";if(E($)||$==="")return Z;const J=typeof $=="number"?$:Number($);if(!Number.isFinite(J))return Z;const D=i(Y);if(!D)return String(J);const te=r(Y,D);if(te)return T(J,D,te,Y);const z=typeof Y.significantFigures=="number"&&Y.significantFigures>0?Y.significantFigures:0,X=z?V(J,z):J,ne=G(X,D,Y.display),se=n(X,D.base,ne);let ue=typeof Y.decimals=="number"?Y.decimals:Y.minDecimals??0,ge=typeof Y.decimals=="number"?Y.decimals:Y.maxDecimals??Math.max(ue,2);z&&(ue=W(se,z),ge=ue);const Oe=P(Y.locale,ue,ge,Y.group!==!1).format(se),Pe=Y.space??" ";return Y.placement==="prefix"?`${ne.symbol}${Y.space??""}${Oe}`:`${Oe}${Pe}${ne.symbol}`}function O($,H){const Y=E($)||Number.isNaN($)?null:Number($),Z=E(H)||Number.isNaN(H)?null:Number(H);return Y===null||Number.isNaN(Y)?Z===null||Number.isNaN(Z)?0:1:Z===null||Number.isNaN(Z)||Y<Z?-1:Y>Z?1:0}function M($){const H=typeof $.decimals=="number"&&$.decimals>0?`.${"0".repeat($.decimals)}`:"";return`${typeof $.decimals=="number"?`#,##0${H}`:"#,##0.##"}" ${$.symbol}"`}function A($){const H={system:"data",...$||{}},Y=i(H),Z=Y?Y.base.symbol:String(H.unit||""),J=Object.freeze({...H,unit:Z}),D=Object.freeze({...J,display:Z,decimals:void 0,minDecimals:0,maxDecimals:20,group:!1}),te=new Map([[J.locale||"",J]]),z=X=>{const ne=X||"";let se=te.get(ne);return se||(se=Object.freeze({...J,locale:X||void 0}),te.set(ne,se)),se};return{base:"number",extends:"number",storage:"float64",unitConfig:J,format:X=>S(X.value,X.locale?z(X.locale):J),parse:X=>w(X.text,X.locale?z(X.locale):J),compare:O,defaults:{filter:"number",editor:"unit",align:"end",total:H.total||"sum"},...H.totals?{totals:H.totals}:{},excel:H.excel||M({decimals:H.decimals,symbol:Z}),toStorage:X=>typeof X=="number"?Number.isFinite(X)?X:null:typeof X=="string"?w(X,J):E(X)?null:w(String(X),J),toClipboard:X=>S(X,D),fromClipboard:X=>w(X,J)}}const N=A}),_e("packages/core/src/columns/types/engineering.js",function(e,F){"use strict";Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return L}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/columns/types/unit.js").createUnitType;function L(x){const q=2*Math.PI/x;return R=>{let j=0,k=0,b=0;for(const g of R||[]){if(E(g))continue;const o=Number(g);Number.isFinite(o)&&(j+=Math.cos(o*q),k+=Math.sin(o*q),b+=1)}return!b||Math.hypot(j,k)/b<1e-12?null:(Math.atan2(k,j)/q%x+x)%x}}function Q(x){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:L(x)}}}const U=Object.freeze({metres:I({system:"length",unit:"m",display:"auto",maxDecimals:3}),millimetres:I({system:"length",unit:"mm",maxDecimals:2}),kilometres:I({system:"length",unit:"km",maxDecimals:3}),grams:I({system:"mass",unit:"g",display:"auto",maxDecimals:3}),kilograms:I({system:"mass",unit:"kg",maxDecimals:3}),tonnes:I({system:"mass",unit:"t",maxDecimals:3}),seconds:I({system:"duration",unit:"s",display:"auto",maxDecimals:3}),milliseconds:I({system:"duration",unit:"ms",maxDecimals:3}),hours:I({system:"duration",unit:"h",maxDecimals:2}),speed:I({system:"speed",unit:"m/s",display:"auto",maxDecimals:2}),kph:I({system:"speed",unit:"km/h",maxDecimals:1}),mph:I({system:"speed",unit:"mph",maxDecimals:1}),knots:I({system:"speed",unit:"kn",maxDecimals:1}),acceleration:I({system:"acceleration",unit:"m/s²",maxDecimals:3}),area:I({system:"area",unit:"m²",display:"auto",maxDecimals:2}),hectares:I({system:"area",unit:"ha",maxDecimals:4}),volume:I({system:"volume",unit:"L",display:"auto",maxDecimals:3}),cubicMetres:I({system:"volume",unit:"m³",maxDecimals:3}),energy:I({system:"energy",unit:"J",display:"auto",maxDecimals:3}),kilowattHours:I({system:"energy",unit:"kWh",maxDecimals:2}),power:I({system:"power",unit:"W",display:"auto",maxDecimals:2}),kilowatts:I({system:"power",unit:"kW",maxDecimals:2}),force:I({system:"force",unit:"N",display:"auto",maxDecimals:2}),pressure:I({system:"pressure",unit:"Pa",display:"auto",maxDecimals:2}),bar:I({system:"pressure",unit:"bar",maxDecimals:3}),psi:I({system:"pressure",unit:"psi",maxDecimals:1}),torque:I({system:"torque",unit:"N·m",maxDecimals:2}),density:I({system:"density",unit:"kg/m³",maxDecimals:2}),flow:I({system:"flow",unit:"m³/s",maxDecimals:4}),litresPerMinute:I({system:"flow",unit:"L/min",maxDecimals:1}),radians:I({system:"angle",unit:"rad",maxDecimals:4,totals:Q(2*Math.PI)}),degrees:I({system:"angle",unit:"°",maxDecimals:2,totals:Q(360)}),rpm:I({system:"angularVelocity",unit:"rpm",maxDecimals:0}),angularVelocity:I({system:"angularVelocity",unit:"rad/s",maxDecimals:3}),ppm:I({system:"fraction",unit:"ppm",maxDecimals:2}),ppb:I({system:"fraction",unit:"ppb",maxDecimals:2}),basisPoints:I({system:"fraction",unit:"bp",maxDecimals:1}),molarity:I({system:"molarity",unit:"M",display:"auto",maxDecimals:3}),massFlow:I({system:"massFlow",unit:"kg/s",maxDecimals:3}),tonnesPerHour:I({system:"massFlow",unit:"t/h",maxDecimals:2}),viscosity:I({system:"viscosity",unit:"Pa·s",display:"auto",maxDecimals:3}),kinematicViscosity:I({system:"kinematicViscosity",unit:"cSt",maxDecimals:2}),thermalConductivity:I({system:"thermalConductivity",unit:"W/(m·K)",maxDecimals:3}),specificHeat:I({system:"specificHeat",unit:"J/(kg·K)",maxDecimals:1}),doseRate:I({system:"doseRate",unit:"µSv/h",display:"auto",maxDecimals:2})})}),_e("packages/core/src/columns/types/si.js",function(e,F){"use strict";Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return j}});const ie=F("packages/core/src/columns/types/unit.js"),E=ie.defineUnit,K=ie.registerUnitSystem,I=ie.createUnitType,L=Object.freeze([Object.freeze({symbol:"f",name:"femto",factor:1e-15}),Object.freeze({symbol:"p",name:"pico",factor:1e-12}),Object.freeze({symbol:"n",name:"nano",factor:1e-9}),Object.freeze({symbol:"µ",name:"micro",factor:1e-6}),Object.freeze({symbol:"m",name:"milli",factor:.001}),Object.freeze({symbol:"c",name:"centi",factor:.01}),Object.freeze({symbol:"",name:"",factor:1}),Object.freeze({symbol:"k",name:"kilo",factor:1e3}),Object.freeze({symbol:"M",name:"mega",factor:1e6}),Object.freeze({symbol:"G",name:"giga",factor:1e9}),Object.freeze({symbol:"T",name:"tera",factor:1e12}),Object.freeze({symbol:"P",name:"peta",factor:1e15})]),Q=Object.freeze(["p","n","µ","m","","k","M","G"]);function U(k){const b=String(k.base),u=new Set([...k.prefixes||Q,""]),g=[];for(const o of L){if(!u.has(o.symbol))continue;const t=`${o.symbol}${b}`,i=[];if(k.name){i.push(`${o.name}${k.name}`,`${o.name}${k.name}s`);const s=o.name.slice(-1);if(s&&k.name.startsWith(s)){const r=`${o.name.slice(0,-1)}${k.name}`;i.push(r,`${r}s`)}}o.symbol==="µ"&&i.push(`u${b}`),o.factor===1&&k.aliases&&i.push(...k.aliases),g.push(E(t,o.factor,i))}for(const o of k.extra||[])g.push(o);return g}function x(k,b){const u=U(b);return K(k,u)}function q(k,b,u){return x(k,b),I({system:k,unit:b.base,display:"auto",maxDecimals:3,...u||{}})}const R=Object.freeze({voltage:q("voltage",{base:"V",name:"volt"}),current:q("current",{base:"A",name:"amp",aliases:["ampere","amperes"]}),resistance:q("resistance",{base:"Ω",name:"ohm",aliases:["ohm","ohms","R"],prefixes:["m","","k","M","G"]}),capacitance:q("capacitance",{base:"F",name:"farad",prefixes:["f","p","n","µ","m",""]}),inductance:q("inductance",{base:"H",name:"henry",prefixes:["p","n","µ","m",""]}),charge:q("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:q("conductance",{base:"S",name:"siemens",prefixes:["n","µ","m","","k"]}),fluxDensity:q("fluxDensity",{base:"T",name:"tesla",prefixes:["n","µ","m",""],extra:[E("G",1e-4,["gauss"],{auto:!1})]}),luminousFlux:q("luminousFlux",{base:"lm",name:"lumen",prefixes:["m","","k"]}),illuminance:q("illuminance",{base:"lx",name:"lux",prefixes:["m","","k"]}),luminousIntensity:q("luminousIntensity",{base:"cd",name:"candela",prefixes:["m","","k"]}),substance:q("substance",{base:"mol",name:"mole",prefixes:["n","µ","m","","k"]}),absorbedDose:q("absorbedDose",{base:"Gy",name:"gray",prefixes:["µ","m",""]}),equivalentDose:q("equivalentDose",{base:"Sv",name:"sievert",prefixes:["n","µ","m",""]}),radioactivity:q("radioactivity",{base:"Bq",name:"becquerel",prefixes:["","k","M","G","T"],extra:[E("Ci",37e9,["curie","curies"],{auto:!1})]}),frequency:q("frequency",{base:"Hz",name:"hertz",prefixes:["m","","k","M","G","T"]})}),j=q}),_e("packages/core/src/columns/types/temperature.js",function(e,F){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return x}}),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 b}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});const E=F("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 I(g){if(E(g))return null;const o=String(g).trim();if(o==="")return null;for(const[i,s]of Object.entries(K))if(o===i||o===s.symbol)return{key:i,scale:s};const t=o.toLowerCase();for(const[i,s]of Object.entries(K))if(s.aliases.includes(t))return{key:i,scale:s};return null}function L(g,o,t){const i=I(o),s=I(t);return!i||!s||!Number.isFinite(Number(g))?null:i.key===s.key?Number(g):s.scale.fromKelvin(i.scale.toKelvin(Number(g)))}const Q=new Map;function U(g,o,t){const i=`${g||""}|${o}|${t}`;let s=Q.get(i);return s||(s=new Intl.NumberFormat(g||void 0,{minimumFractionDigits:o,maximumFractionDigits:t}),Q.set(i,s)),s}function x(g,o){const t=o||{},i=t.nullDisplay??"";if(E(g)||g==="")return i;const s=Number(g);if(!Number.isFinite(s))return i;const r=I(t.scale||"C");if(!r)return String(s);const n=I(t.display||t.scale||"C")||r,m=n.key===r.key?s:n.scale.fromKelvin(r.scale.toKelvin(s)),l=typeof t.decimals=="number"?t.decimals:null,a=l??t.minDecimals??0,c=l??t.maxDecimals??1;return`${U(t.locale,a,c).format(m)}${t.space??" "}${n.scale.symbol}`}const q=/^[+-]?[\d\s., ]*\d/;function R(g,o){const t=String(g).trim();if(t==="")return null;const i=new Intl.NumberFormat(o||void 0).formatToParts(1.1).find(m=>m.type==="decimal")?.value||".",s=i===","?".":",",r=t.split(s).join("").split(/[\s ]/).join("").replace(i,"."),n=Number(r);return Number.isFinite(n)?n:null}function j(g,o){if(E(g))return null;const t=o||{},i=I(t.scale||"C");if(!i)return null;if(typeof g=="number")return Number.isFinite(g)?g:null;let s=String(g).trim();if(s==="")return null;let r=!1;s.startsWith("(")&&s.endsWith(")")&&(r=!0,s=s.slice(1,-1).trim());const n=q.exec(s);if(!n)return null;const m=R(n[0],t.locale);if(m===null)return null;const l=s.slice(n[0].length).trim();if(l==="")return r?-m:m;const a=I(l);if(!a)return null;const c=a.key===i.key?m:i.scale.fromKelvin(a.scale.toKelvin(m));return r?-c:c}function k(g){const o=Object.freeze({scale:"C",...g||{}}),i=(I(o.scale)||I("C")).scale.symbol,s=Object.freeze({...o,display:o.scale,decimals:void 0,minDecimals:0,maxDecimals:20}),r=new Map([[o.locale||"",o]]),n=m=>{const l=m||"";let a=r.get(l);return a||(a=Object.freeze({...o,locale:m||void 0}),r.set(l,a)),a};return{base:"number",extends:"number",storage:"float64",temperatureConfig:o,format:m=>x(m.value,m.locale?n(m.locale):o),parse:m=>j(m.text,m.locale?n(m.locale):o),defaults:{filter:"number",editor:"temperature",align:"end",total:"avg"},totals:{supported:["avg","min","max","count","countValues"]},excel:o.excel||`#,##0${typeof o.decimals=="number"&&o.decimals>0?`.${"0".repeat(o.decimals)}`:".#"}" ${i}"`,toStorage:m=>typeof m=="number"?Number.isFinite(m)?m:null:typeof m=="string"?j(m,o):E(m)?null:j(String(m),o),toClipboard:m=>x(m,s),fromClipboard:m=>j(m,o)}}const b=Object.freeze({celsius:k({scale:"C"}),fahrenheit:k({scale:"F"}),kelvin:k({scale:"K"})}),u=k}),_e("packages/core/src/columns/types/radix.js",function(e,F){"use strict";Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"digitsForWidth",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"radixRange",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"radixName",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"normaliseRadixOptions",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"compileRadixFormat",{enumerable:!0,get:function(){return d}}),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 P}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return T}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/internal/warn.js").warnOnce,L=Object.freeze({2:2,8:8,16:16,bin:2,binary:2,base2:2,oct:8,octal:8,base8:8,hex:16,hexadecimal:16,base16:16}),Q=Object.freeze({2:1,8:3,16:4}),U=Object.freeze({2:"0b",8:"0o",16:"0x"}),x=Object.freeze({2:4,8:3,16:2}),q=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),R=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,b=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,u=Object.freeze([8,16,32,53]),g=new WeakSet,o=new WeakMap,t=new Map,i=new WeakMap,s=new WeakMap,r=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(S){if(S==null)return 16;const O=typeof S=="string"?S.toLowerCase():S,M=L[O];return M||(I(`radix:base:${String(S)}`,`unsupported radix ${String(S)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function m(S,O){return Math.ceil(S/Q[O])}function l(S,O){if(!S)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**S-1};const M=2**(S-1);return{min:-M,max:M-1}}function a(S){return R[S]||"hexadecimal"}function c(S){if(typeof S=="string"){const O=r[S];return O||I(`radix:preset:${S}`,`unknown radix preset "${S}"; known presets are ${Object.keys(r).join(", ")}`),{...O||{}}}if(S&&typeof S.preset=="string"){const O=r[S.preset];return O||I(`radix:preset:${S.preset}`,`unknown radix preset "${S.preset}"; known presets are ${Object.keys(r).join(", ")}`),{...O||{},...S}}return S||{}}function f(S){const O=c(S),M=n(O.radix),A=Q[M];let N=null;if(O.bitWidth!==void 0&&O.bitWidth!==null&&O.bitWidth!==!1){const X=Number(O.bitWidth);u.includes(X)?N=X:I(`radix:width:${String(O.bitWidth)}`,`unsupported bitWidth ${String(O.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let $=O.signed!==!1;!$&&N===null&&(I("radix:unsigned:width","signed: false needs a bitWidth to render a two's-complement pattern; defaulting to 32"),N=32);const H=O.prefix===void 0||O.prefix===!0?U[M]:O.prefix===!1?"":String(O.prefix);let Y=0;O.pad===!0?Y=N?m(N,M):0:typeof O.pad=="number"&&O.pad>0&&(Y=Math.floor(O.pad));let Z=0;O.group===!0?Z=x[M]:typeof O.group=="number"&&O.group>0&&(Z=Math.floor(O.group));const J=l(N,$),D=typeof O.min=="number"?Math.max(J.min,O.min):J.min,te=typeof O.max=="number"?Math.min(J.max,O.max):J.max,z=Object.freeze({radix:M,bits:A,prefix:H,uppercase:O.uppercase!==!1,pad:Y,group:Z,groupSeparator:typeof O.groupSeparator=="string"?O.groupSeparator:" ",bitWidth:N,signed:$,min:D,max:te<D?D:te,nullDisplay:typeof O.nullDisplay=="string"?O.nullDisplay:"",name:a(M)});return g.add(z),z}function p(S){if(S&&g.has(S))return S;if(typeof S=="string"){let O=t.get(S);return O||(O=f(S),t.set(S,O)),O}if(S&&typeof S=="object"){let O=o.get(S);return O||(O=f(S),o.set(S,O)),O}return p("hex")}function y(S){return S<0?-Math.round(-S):Math.round(S)}function h(S,O,M){if(O<=0||S.length<=O)return S;const A=S.length%O||O,N=[S.slice(0,A)];for(let $=A;$<S.length;$+=O)N.push(S.slice($,$+O));return N.join(M)}function d(S){const O=p(S),{radix:M,prefix:A,uppercase:N,pad:$,group:H,groupSeparator:Y,signed:Z,bitWidth:J,nullDisplay:D}=O,te=J?2**J:0,z=X=>{if(E(X)||X==="")return D;const ne=typeof X=="number"?X:Number(X);if(!Number.isFinite(ne))return D;const se=y(ne);let ue="",ge=se;se<0&&(Z?(ue="-",ge=-se):ge=(se%te+te)%te);let Oe=ge.toString(M);return Oe=N?Oe.toUpperCase():Oe.toLowerCase(),$>0&&Oe.length<$&&(Oe=Oe.padStart($,"0")),H>0&&(Oe=h(Oe,H,Y)),ue+A+Oe};return z.options=O,z}function w(S,O){const M=p(O);let A=i.get(M);return A||(A=d(M),i.set(M,A)),A(S)}function v(S){const O=p(S),{radix:M,groupSeparator:A,signed:N,min:$,max:H}=O,Y=q[M],Z=J=>{if(E(J))return{ok:!0,value:null,reason:"blank"};let D=String(J);if(A&&A!==""&&(D=D.split(A).join("")),D=D.replace(k,""),D==="")return{ok:!0,value:null,reason:"blank"};let te=!1;if((D[0]==="-"||D[0]==="+")&&(te=D[0]==="-",D=D.slice(1)),D==="")return{ok:!1,value:null,reason:"digits"};let z=null;for(const[ne,se]of j){const ue=ne.exec(D);if(!ue)continue;const ge=D.slice(ue[0].length);if(ge==="")break;if(!q[se].test(ge))return{ok:!1,value:null,reason:"digits"};z=parseInt(ge,se);break}if(z===null)if(Y.test(D))z=parseInt(D,M);else if(b.test(D))z=Number(D);else return{ok:!1,value:null,reason:"digits"};if(!Number.isFinite(z))return{ok:!1,value:null,reason:"digits"};const X=y(te?-z:z);return!N&&X<0?{ok:!1,value:X,reason:"negative"}:X<$||X>H?{ok:!1,value:X,reason:"range"}:{ok:!0,value:X,reason:"ok"}};return Z.options=O,Z}function P(S,O){const M=p(O);let A=s.get(M);return A||(A=v(M),s.set(M,A)),A(S)}function W(S,O){const M=P(S,O);return M.ok?M.value:null}function V(S,O){const M=E(S)||Number.isNaN(S)?null:Number(S),A=E(O)||Number.isNaN(O)?null:Number(O);return M===null?A===null?0:1:A===null||M<A?-1:M>A?1:0}function G(S){const O=S.min>=-2147483648&&S.max<=2147483647;return S.bitWidth&&O?"int32":"float64"}function _(S){const O=f(S),M=d(O),A=v(O);return{base:"number",extends:"number",storage:G(O),matches:null,format:N=>M(N.value),parse:N=>{const $=A(N.text);return $.ok?$.value:null},compare:V,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:N=>M(N),fromClipboard:N=>{const $=A(N);return $.ok?$.value:null},radix:O,formatValue:M,parseText:A}}const T=_}),_e("packages/core/src/columns/types/aggregable.js",function(e,F){"use strict";Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"weightedMean",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"logarithmicSum",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"logarithmicMean",{enumerable:!0,get:function(){return L}});const E=F("packages/core/src/internal/predicates.js").isNil;function K(R){const j=[];for(const k of R||[]){if(E(k))continue;const b=Number(k);Number.isFinite(b)&&j.push(b)}return j}function I(R){return j=>{const k=K(j);if(!k.length)return null;let b=0;for(const u of k)b+=10**(u/R);return R*Math.log10(b)}}function L(R){return j=>{const k=K(j);if(!k.length)return null;let b=0;for(const u of k)b+=10**(u/R);return R*Math.log10(b/k.length)}}function Q(R,j){const k=j&&j.column,u=(k&&k.typeOptions||{}).weight,g=j&&j.valueAt;if(!u||typeof g!="function")return null;let o=0,t=0;for(let i=0;i<R.length;i++){if(E(R[i]))continue;const s=Number(R[i]);if(!Number.isFinite(s))continue;const r=g(u,i);if(E(r))continue;const n=Number(r);!Number.isFinite(n)||n<=0||(o+=s*n,t+=n)}return t===0?null:o/t}function U(R={}){const j=R.factor===20?20:10,k=typeof R.suffix=="string"?R.suffix:"",b=Number.isInteger(R.decimals)?R.decimals:1;return{base:"number",storage:"float64",name:R.name||"logarithmic",format:u=>{const g=u&&u.value;return E(g)||!Number.isFinite(Number(g))?"":`${Number(g).toFixed(b)}${k}`},parse:u=>{const g=String((u&&u.text)??"").replace(k,"").trim();if(!g)return null;const o=Number(g);return Number.isFinite(o)?o:null},defaults:{align:"end",filter:"number"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:{sum:I(j),avg:L(j)}}}}function x(R={}){const j=Number.isInteger(R.decimals)?R.decimals:1,k=R.percent===!0;return{base:"number",storage:"float64",name:R.name||"ratio",format:b=>{const u=b&&b.value;return E(u)||!Number.isFinite(Number(u))?"":k?`${Number(u).toFixed(j)}%`:Number(u).toFixed(j)},parse:b=>{const u=String((b&&b.text)??"").replace("%","").trim();if(!u)return null;const g=Number(u);return Number.isFinite(g)?g:null},defaults:{align:"end",filter:"number"},totals:{supported:["avg","min","max","count","countValues"],implement:{avg:Q}}}}const q=Object.freeze({decibel:U({name:"decibel",factor:10,suffix:" dB"}),decibelAmplitude:U({name:"decibelAmplitude",factor:20,suffix:" dB"}),ratio:x({name:"ratio"}),percentRate:x({name:"percentRate",percent:!0})})}),_e("packages/core/src/columns/types/currency.js",function(e,F){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return R}}),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 o}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});const E=F("packages/core/src/internal/predicates.js").isNil,K="⚠ no rate";function I(m){if(E(m))return null;const l=String(m).trim().toUpperCase();return l===""?null:l}function L(m){if(E(m))return null;if(typeof m=="object"&&!Array.isArray(m)){const l=Number(m.amount),a=I(m.code);return!a||!Number.isFinite(l)?null:{amount:l,code:a}}if(Array.isArray(m)&&m.length===2){const l=Number(m[0]),a=I(m[1]);return!a||!Number.isFinite(l)?null:{amount:l,code:a}}return null}const Q=Object.freeze({$:"USD","€":"EUR","£":"GBP","¥":"JPY","₹":"INR","₩":"KRW","₽":"RUB","₺":"TRY","₴":"UAH","₪":"ILS"}),U=Object.freeze({USD:"$",EUR:"€",GBP:"£",JPY:"¥",INR:"₹",KRW:"₩",RUB:"₽",TRY:"₺",UAH:"₴",ILS:"₪"}),x=/[+-]?[\d\s., ]*\d/;function q(m,l){const a=String(m).trim();if(a==="")return null;const c=new Intl.NumberFormat(l||void 0).formatToParts(1.1).find(h=>h.type==="decimal")?.value||".",f=c===","?".":",",p=a.split(f).join("").split(/[\s ]/).join("").replace(c,"."),y=Number(p);return Number.isFinite(y)?y:null}function R(m,l){const a=l||{},c=I(a.code);if(E(m))return null;const f=L(m);if(f)return f;if(typeof m=="number")return Number.isFinite(m)&&c?{amount:m,code:c}:null;let p=String(m).trim();if(p==="")return null;let y=!1;p.startsWith("(")&&p.endsWith(")")&&(y=!0,p=p.slice(1,-1).trim());let h=null;for(const[V,G]of Object.entries(Q)){if(p.startsWith(V)){h=G,p=p.slice(V.length).trim();break}if(p.endsWith(V)){h=G,p=p.slice(0,-V.length).trim();break}}const d=x.exec(p);if(!d)return null;const w=q(d[0],a.locale);if(w===null)return null;const v=(p.slice(0,d.index)+" "+p.slice(d.index+d[0].length)).trim();!h&&v!==""&&(h=I(v));const P=h||c;return P?{amount:y?-w:w,code:P}:null}function j(m,l){if(typeof m=="function")return(a,c)=>{if(a===c)return 1;const f=m(a,c);return typeof f=="number"&&Number.isFinite(f)&&f>0?f:null};if(m&&typeof m=="object"){const a=m;return(c,f)=>{if(c===f)return 1;const p=Number(a[c]),y=Number(a[f]);return!Number.isFinite(p)||!Number.isFinite(y)||p<=0||y<=0?null:y/p}}return(a,c)=>a===c?1:null}function k(m,l,a){if(!m)return null;if(m.code===l)return m.amount;const c=a(m.code,l);return c===null?null:m.amount*c}const b=new Map;function u(m,l,a){const c=`${m||""}|${l}|${a??""}`;let f=b.get(c);if(!f){const p={style:"currency",currency:l};typeof a=="number"&&(p.minimumFractionDigits=a,p.maximumFractionDigits=a);try{f={fmt:new Intl.NumberFormat(m||void 0,p),currency:!0}}catch{f={fmt:new Intl.NumberFormat(m||void 0,typeof a=="number"?{minimumFractionDigits:a,maximumFractionDigits:a}:{}),currency:!1}}b.set(c,f)}return f}function g(m,l){const a=l||{},c=a.nullDisplay??"",f=L(m);if(!f)return c;const p=I(a.display)||f.code;let y=f.amount,h=f.code;if(p!==f.code){const v=a.rateFn||j(a.rates,a.rateBase),P=k(f,p,v);if(P===null)return`${a.missingRate??K} ${f.code}→${p}`;y=P,h=p}const{fmt:d,currency:w}=u(a.locale,h,a.decimals);return w?d.format(y):`${d.format(y)} ${h}`}function o(m){const l=L(m);return l?`${l.amount} ${l.code}`:""}function t(m){const l=m||{},a=I(l.display),c=l.rateFn||j(l.rates,l.rateBase);return(f,p)=>{const y=L(f),h=L(p);if(!y&&!h)return 0;if(!y)return 1;if(!h)return-1;if(a){const d=k(y,a,c),w=k(h,a,c);if(d!==null&&w!==null)return d===w?0:d<w?-1:1}return y.code===h.code?y.amount===h.amount?0:y.amount<h.amount?-1:1:y.code<h.code?-1:1}}function i(m){const l=m||{},a=(f,p)=>{const y=[];for(const P of f||[]){const W=L(P);W&&y.push(W)}if(!y.length)return null;if(new Set(y.map(P=>P.code)).size===1){const P=y[0].code;return{amount:p(y.map(W=>W.amount)),code:P}}const d=I(l.display);if(!d)return`${l.missingRate??K}: mixed currencies, no display currency set`;const w=l.rateFn||j(l.rates,l.rateBase),v=[];for(const P of y){const W=k(P,d,w);if(W===null)return`${l.missingRate??K}: ${P.code}→${d}`;v.push(W)}return{amount:p(v),code:d}},c=f=>f.reduce((p,y)=>p+y,0);return{sum:f=>a(f,c),avg:f=>a(f,p=>c(p)/p.length),min:f=>a(f,p=>Math.min(...p)),max:f=>a(f,p=>Math.max(...p))}}function s(m){const l=Object.freeze({code:"USD",...m||{}}),a=j(l.rates,l.rateBase),c=Object.freeze({...l,rateFn:a}),f=i(c),p=t(c),y=new Map([[l.locale||"",c]]),h=v=>{const P=v||"";let W=y.get(P);return W||(W=Object.freeze({...c,locale:v||void 0}),y.set(P,W)),W},d=U[I(l.display||l.code)]||"",w=typeof l.decimals=="number"&&l.decimals>0?`.${"0".repeat(l.decimals)}`:".00";return{base:"object",extends:"object",storage:"object",name:"currency",currencyConfig:c,format:v=>g(v.value,v.locale?h(v.locale):c),parse:v=>R(v.text,v.locale?h(v.locale):c),compare:p,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:f},excel:l.excel||(d?`"${d}"#,##0${w}`:`#,##0${w}`),toStorage:v=>{const P=L(v);return P||(typeof v=="string"||typeof v=="number"?R(v,c):null)},toClipboard:v=>o(v),fromClipboard:v=>R(v,c)}}const r=Object.freeze({currency:s({code:"USD"}),usd:s({code:"USD"}),eur:s({code:"EUR"}),gbp:s({code:"GBP"}),jpy:s({code:"JPY",decimals:0})}),n=s}),_e("packages/core/src/columns/types/index.js",function(e,F){"use strict";Object.defineProperty(e,"EXTENDED_TYPES",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return _}});const ie=F("packages/core/src/columns/types/temporal.js"),E=ie.TEMPORAL_TYPES,K=F("packages/core/src/columns/types/network.js"),I=K.NETWORK_TYPES,L=F("packages/core/src/columns/types/vlan.js"),Q=L.VLAN_TYPES,U=F("packages/core/src/columns/types/structured.js"),x=U.STRUCTURED_TYPES,q=F("packages/core/src/columns/types/unit.js"),R=q.createUnitType,j=q.UNIT_SYSTEMS,k=q.parseUnit,b=q.formatUnit,u=q.registerUnitSystem,g=q.unitSystemNames,o=q.unitsOf,t=q.defineUnit,i=F("packages/core/src/columns/types/engineering.js"),s=i.ENGINEERING_TYPES,r=F("packages/core/src/columns/types/si.js"),n=r.SI_TYPES,m=r.createSiType,l=r.createSiSystem,a=r.siUnits,c=r.SI_PREFIXES,f=F("packages/core/src/columns/types/temperature.js"),p=f.TEMPERATURE_TYPES,y=f.createTemperatureType,h=f.convertTemperature,d=f.formatTemperature,w=f.parseTemperature,v=f.TEMPERATURE_SCALES,P=F("packages/core/src/columns/types/radix.js"),W=P.createRadixType,V=P.RADIX_PRESETS,G=P.parseRadix,_=P.formatRadix,T=F("packages/core/src/columns/types/aggregable.js"),S=T.AGGREGABLE_TYPES,O=F("packages/core/src/columns/types/currency.js"),M=O.CURRENCY_TYPES,A=O.createCurrencyType,N=O.parseMoney,$=O.formatMoney,H=O.convertMoney,Y=O.toMoney,Z=O.rateFunction,J=O.moneyComparator,D=O.normaliseCode,te=O.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return q.findUnit}}),Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return i.ENGINEERING_TYPES}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return i.circularMean}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return f.TEMPERATURE_TYPES}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return f.createTemperatureType}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return f.convertTemperature}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return f.formatTemperature}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return f.parseTemperature}}),Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return f.TEMPERATURE_SCALES}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return f.findScale}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return O.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return O.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return O.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return O.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return O.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return O.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return O.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return O.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return O.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return O.MISSING_RATE}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return ie.TEMPORAL_TYPES}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return K.NETWORK_TYPES}}),Object.defineProperty(e,"VLAN_TYPES",{enumerable:!0,get:function(){return L.VLAN_TYPES}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return U.STRUCTURED_TYPES}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return T.AGGREGABLE_TYPES}}),Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return T.createLogarithmicType}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return T.createRatioType}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return ie.parseTime}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return ie.formatTime}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return ie.parseDateTime}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return ie.formatDateTime}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return ie.parseDuration}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return ie.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,"parseMac",{enumerable:!0,get:function(){return K.parseMac}}),Object.defineProperty(e,"formatMac",{enumerable:!0,get:function(){return K.formatMac}}),Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return K.isMac}}),Object.defineProperty(e,"compareMac",{enumerable:!0,get:function(){return K.compareMac}}),Object.defineProperty(e,"macValue",{enumerable:!0,get:function(){return K.macValue}}),Object.defineProperty(e,"macHex",{enumerable:!0,get:function(){return K.macHex}}),Object.defineProperty(e,"macContains",{enumerable:!0,get:function(){return K.macContains}}),Object.defineProperty(e,"MAC_OPERATORS",{enumerable:!0,get:function(){return K.MAC_OPERATORS}}),Object.defineProperty(e,"parseVlans",{enumerable:!0,get:function(){return L.parseVlans}}),Object.defineProperty(e,"formatVlans",{enumerable:!0,get:function(){return L.formatVlans}}),Object.defineProperty(e,"vlanContains",{enumerable:!0,get:function(){return L.vlanContains}}),Object.defineProperty(e,"vlanOverlaps",{enumerable:!0,get:function(){return L.vlanOverlaps}}),Object.defineProperty(e,"vlanCount",{enumerable:!0,get:function(){return L.vlanCount}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return U.maskValue}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return U.summariseJson}});const z=Object.freeze({...E,...I,...Q,...x,...S,hex:W(V.hex),hex8:W(V.hex8),hex16:W(V.hex16),hex32:W(V.hex32),binary:W(V.binary),binary8:W(V.binary8),octal:W(V.octal),bytes:R({system:"data",unit:"B",display:"auto"}),megabytes:R({system:"data",unit:"MB"}),gigabytes:R({system:"data",unit:"GB"}),bitrate:R({system:"bitrate",unit:"Mbps"}),gigabits:R({system:"bitrate",unit:"Gbps"}),...s,...n,...p,...M});{const X=new Set;for(const ne of[E,I,Q,x,S,s,n,p,M])for(const se of Object.keys(ne)){if(X.has(se))throw new Error(`[lattice] data type "${se}" is declared twice`);X.add(se)}}}),_e("packages/core/src/compute/handle.js",function(e,F){"use strict";Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return R}}),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 b}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return s}});const ie=F("packages/core/src/internal/compare.js"),E=ie.collator,K=ie.defaultCompare,L=F("packages/core/src/internal/warn.js").warnOnce;function Q(r){const n=new Uint32Array(r);for(let m=0;m<r;m++)n[m]=m;return n}function U(r,n){if(n&&typeof n.count=="number")return n.count;if(!r)return 0;if(typeof r.count=="number")return r.count;if(typeof r.length=="number")return r.length;const m=r.values;return r.kind==="multi"&&r.offsets?Math.max(0,r.offsets.length-1):m?r.kind==="bitset"?typeof m.size=="number"?m.size:r.presence&&typeof r.presence.size=="number"?r.presence.size:(L(`count:${r.id}`,`column "${r.id}" is bitset-backed with no declared row count; assuming ${m.length*8}`),m.length*8):m.length:r.presence&&typeof r.presence.size=="number"?r.presence.size:0}const x=new WeakMap;function q(r){const n=r.constructor;if(!n)return"unknown";const m=x.get(n);if(m)return m;let l="unknown";try{let a=null;typeof n.from=="function"?a=n.from([!1,!0]):(a=new n(8),a.set(1));const c=a&&a.words;c&&c.length&&(c[0]===2?l="lsb":c[0]===64&&(l="msb"))}catch{l="unknown"}return x.set(n,l),l}function R(r){if(!r)return()=>0;const n=r instanceof Uint8Array?r:r.words;if(n instanceof Uint8Array){const m=r instanceof Uint8Array?"lsb":q(r);if(m==="lsb")return l=>n[l>>>3]>>>(l&7)&1;if(m==="msb")return l=>n[l>>>3]>>>7-(l&7)&1}return typeof r.get=="function"?m=>r.get(m)?1:0:()=>0}function j(r){return!r||!r.presence?null:R(r.presence)}function k(r){return r?typeof r.size=="number"?r.size:typeof r.values=="function"?r.values().length:0:0}function b(r,n){return r?typeof r.valueOf=="function"?r.valueOf(n):typeof r.values=="function"?r.values()[n]:null:null}function u(r,n){const m=r.offsets,l=r.values;if(!m||!l)return[];const a=m[n],c=m[n+1];if(!(c>a))return[];const f=r.dict,p=new Array(c-a);for(let y=a;y<c;y++)p[y-a]=f?b(f,l[y]):l[y];return p}function g(r){if(!r)return()=>{};const n=r.values,m=j(r),l=r.kind;if(l==="dictionary"){const a=r.dict;return m?c=>m(c)?b(a,n[c]):null:c=>b(a,n[c])}if(l==="bitset"){const a=R(n);return m?c=>m(c)?a(c)===1:null:c=>a(c)===1}if(l==="multi")return m?a=>m(a)?u(r,a):null:a=>u(r,a);if(!n&&typeof r.get=="function"){const a=r.get.bind(r);return c=>{const f=a(c);return f===void 0?null:f}}return m?a=>{if(!m(a))return null;const c=n[a];return c===void 0?null:c}:a=>{const c=n[a];return c===void 0?null:c}}function o(r,n){if(r<n)return-1;if(r>n)return 1;if(r===n){const a=Object.is(r,-0),c=Object.is(n,-0);return a===c?0:a?-1:1}const m=Number.isNaN(r),l=Number.isNaN(n);return m&&l?0:m?1:-1}function t(r){const n=E(r);return(m,l)=>{if(m===l)return 0;const a=typeof m,c=typeof l;if(a==="string"&&c==="string")return n.compare(m,l);if(a==="number"&&c==="number")return o(m,l);if(a==="boolean"&&c==="boolean")return m===l?0:m?1:-1;if(m instanceof Date||l instanceof Date){const f=m instanceof Date?m.getTime():Number(m),p=l instanceof Date?l.getTime():Number(l);return o(f,p)}return K(m,l)}}function i(r,n){if(r&&typeof r.ranks=="function")return r.ranks(n);const m=r&&typeof r.values=="function"?r.values():[],l=m.length,a=t(n),c=new Array(l);for(let p=0;p<l;p++)c[p]=p;c.sort((p,y)=>a(m[p],m[y])||p-y);const f=new Uint32Array(l);for(let p=0;p<l;p++)f[c[p]]=p;return f}function s(r){return r==null||typeof r=="number"&&Number.isNaN(r)}}),_e("packages/core/src/compute/filter.js",function(e,F){"use strict";Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"wallMs",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(e,"declaredOperatorFor",{enumerable:!0,get:function(){return ye}});const E=F("packages/core/src/internal/predicates.js").isBlank,I=F("packages/core/src/internal/merge.js").toArray,Q=F("packages/core/src/internal/warn.js").warnOnce,U=F("packages/core/src/format/date.js"),x=U.toDate,q=U.toIsoDate,R=F("packages/core/src/compute/handle.js"),j=R.bitReader,k=R.dictSize,b=R.dictValue,u=R.presenceReader,g=R.valueComparator,o=R.valueReader,t=/^\d{4}-\d{2}-\d{2}$/,i="\0null\0";function s(re,fe){const oe=re&&re.pool;if(oe){const ce=oe.mask||oe.acquireMask||oe.acquire||oe.take;if(typeof ce=="function"){const de=ce.call(oe,fe);if(de&&de.length>=fe)return de}}return new Uint8Array(fe)}function r(re,fe){const oe=re&&re.pool;if(!oe||!fe)return;const ce=oe.release||oe.releaseMask||oe.free||oe.recycle;typeof ce=="function"&&ce.call(oe,fe)}function n(re,fe,oe){return re.fill(oe,0,fe),re}function m(re){return re==null||typeof re=="number"&&Number.isNaN(re)}function l(re,fe){if(re==null)return re;if(fe==="number")return typeof re=="number"?re:Number(re);if(fe==="date"||fe==="dateString"){const oe=q(re);return oe===null?a(re):oe}return fe==="boolean"?typeof re=="boolean"?re:re==="true"||re===1?!0:re==="false"||re===0?!1:!!re:re}function a(re){return re instanceof Date?re.getTime():typeof re=="number"?re:Date.parse(String(re))}function c(re){return typeof re=="number"?re:re instanceof Date?re.getTime():re==null||re===""?NaN:Number(re)}function f(re,fe){const oe=typeof re=="string"?re:String(re);return fe?oe:oe.toLowerCase()}function p(re,fe){return re==null?i:typeof re=="string"?fe?re:re.toLowerCase():re instanceof Date?re.getTime():re}function y(re,fe,oe){const ce=new Set;for(const de of I(re)){const ve=l(de,oe);ce.add(p(ve,fe)),typeof ve=="string"&&ve!==""&&Number.isFinite(Number(ve))?ce.add(Number(ve)):typeof ve=="number"&&Number.isFinite(ve)&&ce.add(p(String(ve),fe))}return ce}function h(re,fe,oe){if(re==null||fe===null||fe===void 0)return re==null&&fe==null;const ce=typeof re,de=typeof fe;return ce==="string"&&de==="string"?oe?re===fe:re.toLowerCase()===fe.toLowerCase():re instanceof Date||fe instanceof Date?a(re)===a(fe):ce==="number"&&de==="number"?re===fe||Number.isNaN(re)&&Number.isNaN(fe):ce==="number"&&de==="string"?re===Number(fe):ce==="string"&&de==="number"?Number(re)===fe:ce==="boolean"||de==="boolean"?re===fe:Array.isArray(re)&&Array.isArray(fe)?re.length===fe.length&&re.every((ve,ke)=>h(ve,fe[ke],oe)):re===fe}function d(re,fe){try{if(re instanceof RegExp){const oe=re.flags.replace(/[gy]/g,"");return new RegExp(re.source,fe||oe.includes("i")?oe:`${oe}i`)}return new RegExp(String(re),fe?"":"i")}catch(oe){return Q(`regex:${String(re)}`,`filter operator "matches" received an invalid pattern: ${String(re)}`,oe),null}}function w(re,fe){if(re&&re.type==="datetime"&&v.has(re.op))return _(re,fe);const oe=T(re,fe),ce=re&&re.type;return ce!=="date"&&ce!=="dateString"?oe:de=>oe(typeof de=="string"&&t.test(de)?de:q(de)??de)}const v=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn"]),P=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3})\d*)?)?)?$/,W=new Map;function V(re,fe){let oe=W.get(fe);if(oe===void 0){try{oe=new Intl.DateTimeFormat("en-CA",{timeZone:fe,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{oe=null}W.set(fe,oe)}if(!oe)return null;const ce={};for(const de of oe.formatToParts(re))de.type!=="literal"&&(ce[de.type]=de.value);return ce}function G(re,fe){if(re==null||re==="")return null;if(typeof re=="string"){const ve=P.exec(re.trim());if(ve)return Date.UTC(+ve[1],+ve[2]-1,+ve[3],+(ve[4]||0),+(ve[5]||0),+(ve[6]||0),+(ve[7]||"0").padEnd(3,"0"))}const oe=x(re);if(!oe)return null;const ce=oe.getUTCMilliseconds(),de=fe?V(oe,fe):null;return de?Date.UTC(+de.year,+de.month-1,+de.day,de.hour==="24"?0:+de.hour,+de.minute,+de.second,ce):Date.UTC(oe.getFullYear(),oe.getMonth(),oe.getDate(),oe.getHours(),oe.getMinutes(),oe.getSeconds(),ce)}function _(re,fe){const oe=typeof re.timeZone=="string"&&re.timeZone?re.timeZone:void 0,ce=ke=>G(ke,oe),de=Array.isArray(re.value)?re.value.map(ce):ce(re.value),ve=T({...re,type:"number",value:de},fe);return ke=>ve(G(ke))}function T(re,fe){const oe=re&&re.op,ce=!!(re&&re.caseSensitive),de=re&&re.type,ve=g(fe),ke=Ce=>Le=>!Ce(Le);switch(oe){case"eq":{const Ce=ye(de,"eq");if(Ce)return Ce.compile(re.value);const Le=l(re.value,de);return we=>h(we,Le,ce)}case"ne":{const Ce=ye(de,"ne");if(Ce)return Ce.compile(re.value);const Le=l(re.value,de);return we=>!h(we,Le,ce)}case"lt":case"lte":case"gt":case"gte":{const Ce=l(re.value,de);if(m(Ce))return()=>!1;const Le=oe==="lt"?-1:oe==="lte"?0:oe==="gt"?1:2;return we=>{if(m(we))return!1;const He=ve(we,Ce);return Le===-1?He<0:Le===0?He<=0:Le===1?He>0:He>=0}}case"between":case"notBetween":{const Ce=I(re.value),Le=l(Ce[0],de),we=l(Ce[1],de),He=re.bounds||"[]",Te=He.charAt(0)!=="(",Ae=He.charAt(1)!==")";if(m(Le)||m(we))return oe==="between"?()=>!1:()=>!0;const Se=Ee=>{if(m(Ee))return!1;const Me=ve(Ee,Le),Be=ve(Ee,we);return(Te?Me>=0:Me>0)&&(Ae?Be<=0:Be<0)};return oe==="between"?Se:ke(Se)}case"in":case"notIn":{const Ce=y(re.value,ce,de),Le=we=>Ce.has(p(we,ce));return oe==="in"?Le:ke(Le)}case"contains":case"notContains":{const Ce=ye(de,oe);if(Ce)return Ce.compile(re.value);const Le=f(l(re.value,de),ce),we=He=>He==null?!1:f(He,ce).includes(Le);return oe==="contains"?we:ke(we)}case"startsWith":{const Ce=ye(de,"startsWith");if(Ce)return Ce.compile(re.value);const Le=f(l(re.value,de),ce);return we=>we==null?!1:f(we,ce).startsWith(Le)}case"endsWith":{const Ce=ye(de,"endsWith");if(Ce)return Ce.compile(re.value);const Le=f(l(re.value,de),ce);return we=>we==null?!1:f(we,ce).endsWith(Le)}case"matches":{const Ce=d(re.value,ce);return Ce?Le=>Le==null?!1:Ce.test(String(Le)):()=>!1}case"blank":case"notBlank":{const Ce=re.trim===!0,Le=we=>E(we)||Array.isArray(we)&&we.length===0||Ce&&typeof we=="string"&&we.trim()==="";return oe==="blank"?Le:we=>!Le(we)}case"containsAny":case"containsNone":{const Ce=y(re.value,ce,de),Le=we=>{const He=we==null?[]:I(we);for(let Te=0;Te<He.length;Te++)if(Ce.has(p(He[Te],ce)))return!0;return!1};return oe==="containsAny"?Le:ke(Le)}case"containsAll":{const Ce=I(re.value).map(Le=>p(l(Le,de),ce));return Le=>{const we=Le==null?[]:I(Le);if(Ce.length===0)return!0;const He=new Set(we.map(Te=>p(Te,ce)));for(let Te=0;Te<Ce.length;Te++)if(!He.has(Ce[Te]))return!1;return!0}}default:{const Ce=xe(oe);return Ce?Ce.compile(re.value):(Q(`op:${String(oe)}`,`unknown filter operator "${String(oe)}"; the condition is refused rather than matching every row`),()=>!1)}}}function S(re,fe,oe){return w(fe,oe)(re)}const O=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),M=new Set(["containsAny","containsAll","containsNone"]);function A(re,fe,oe){const ce=re&&re.op,de=O[ce]||ce,ve=w({...re,op:de,type:fe.type},oe),ke=fe.items,Ce=Le=>{const we=ke(Le);if(!we)return!1;for(let He=0;He<we.length;He++)if(ve(we[He]))return!0;return!1};return O[ce]?Le=>!Ce(Le):Ce}function N(re,fe,oe,ce,de){const ve=de?null:u(re);if(ve){const Le=fe?1:0;for(let we=0;we<ce;we++)oe[we]=ve(we)===Le?1:0;return oe}const ke=re.kind;if(ke==="float64"||ke==="int32"||ke==="bitset")return n(oe,ce,fe?1:0);const Ce=o(re);for(let Le=0;Le<ce;Le++){const we=Ce(Le),He=E(we)||Array.isArray(we)&&we.length===0||de&&typeof we=="string"&&we.trim()==="";oe[Le]=He===fe?0:1}return oe}function $(re,fe,oe,ce){const de=re.dict,ve=k(de),ke=new Uint8Array(ve);for(let He=0;He<ve;He++)ke[He]=fe(b(de,He))?1:0;const Ce=re.values,Le=u(re);if(!Le){for(let He=0;He<ce;He++)oe[He]=ke[Ce[He]];return oe}const we=fe(null)?1:0;for(let He=0;He<ce;He++)oe[He]=Le(He)===1?ke[Ce[He]]:we;return oe}function H(re,fe,oe,ce){const de=j(re.values),ve=fe(!0)?1:0,ke=fe(!1)?1:0,Ce=u(re);if(!Ce){for(let we=0;we<ce;we++)oe[we]=de(we)===1?ve:ke;return oe}const Le=fe(null)?1:0;for(let we=0;we<ce;we++)oe[we]=Ce(we)===0?Le:de(we)===1?ve:ke;return oe}function Y(re,fe,oe,ce,de){const ve=re.values,ke=fe.type,Ce=fe.op;let Le=!0;switch(Ce){case"eq":case"ne":{const He=c(l(fe.value,ke)),Te=typeof fe.value=="number"&&Number.isNaN(fe.value),Ae=Ce==="ne"?1:0;if(Te)for(let Se=0;Se<de;Se++)ce[Se]=(Number.isNaN(ve[Se])?1:0)^Ae;else for(let Se=0;Se<de;Se++)ce[Se]=(ve[Se]===He?1:0)^Ae;break}case"lt":{const He=c(l(fe.value,ke));for(let Te=0;Te<de;Te++)ce[Te]=ve[Te]<He?1:0;break}case"lte":{const He=c(l(fe.value,ke));for(let Te=0;Te<de;Te++)ce[Te]=ve[Te]<=He?1:0;break}case"gt":{const He=c(l(fe.value,ke));for(let Te=0;Te<de;Te++)ce[Te]=ve[Te]>He?1:0;break}case"gte":{const He=c(l(fe.value,ke));for(let Te=0;Te<de;Te++)ce[Te]=ve[Te]>=He?1:0;break}case"between":case"notBetween":{const He=I(fe.value),Te=c(l(He[0],ke)),Ae=c(l(He[1],ke)),Se=fe.bounds||"[]",Ee=Se.charAt(0)!=="(",Me=Se.charAt(1)!==")",Be=Ce==="notBetween"?1:0;if(Ee&&Me)for(let Ke=0;Ke<de;Ke++)ce[Ke]=(ve[Ke]>=Te&ve[Ke]<=Ae?1:0)^Be;else if(Ee)for(let Ke=0;Ke<de;Ke++)ce[Ke]=(ve[Ke]>=Te&ve[Ke]<Ae?1:0)^Be;else if(Me)for(let Ke=0;Ke<de;Ke++)ce[Ke]=(ve[Ke]>Te&ve[Ke]<=Ae?1:0)^Be;else for(let Ke=0;Ke<de;Ke++)ce[Ke]=(ve[Ke]>Te&ve[Ke]<Ae?1:0)^Be;break}case"in":case"notIn":{const He=new Set;for(const Ae of I(fe.value)){const Se=c(l(Ae,ke));Number.isNaN(Se)||He.add(Se)}const Te=Ce==="notIn"?1:0;for(let Ae=0;Ae<de;Ae++)ce[Ae]=(He.has(ve[Ae])?1:0)^Te;break}default:Le=!1;break}if(!Le)return!1;const we=u(re);if(we){const He=oe(null)?1:0;for(let Te=0;Te<de;Te++)we(Te)===0&&(ce[Te]=He)}return!0}function Z(re,fe,oe,ce){const de=o(re);for(let ve=0;ve<ce;ve++)oe[ve]=fe(de(ve))?1:0;return oe}function J(re,fe){if(!re||!Oe.has(re.op))return re;const oe=fe&&fe.typeOf;if(typeof oe!="function")return re;const ce=oe(re.col);return typeof ce!="string"||!ce||ce===re.type?re:{...re,type:ce}}function D(re,fe,oe){const ce=fe.count|0,de=oe||s(fe,ce);if(!re)return n(de,ce,1);const ve=typeof fe.handle=="function"?fe.handle(re.col):void 0,ke=typeof fe.custom=="function"?fe.custom:null;if(!ve){if(ke){for(let He=0;He<ce;He++)de[He]=ke(re,He)?1:0;return de}return Q(`filter:col:${String(re.col)}`,`filter references unknown column "${String(re.col)}"; the condition is refused rather than matching every row`),n(de,ce,0)}const Ce=re.op;if(Ce==="blank"||Ce==="notBlank")return N(ve,Ce==="notBlank",de,ce,re.trim===!0);const Le=typeof fe.itemwise=="function"?fe.itemwise(re.col):null;if(Le&&!xe(Ce)&&!M.has(Ce))return Z(ve,A(re,Le,fe.locale),de,ce);const we=w(J(re,fe),fe.locale);switch(ve.kind){case"dictionary":return $(ve,we,de,ce);case"bitset":return H(ve,we,de,ce);case"float64":case"int32":return Y(ve,re,we,de,ce)?de:Z(ve,we,de,ce);default:return Z(ve,we,de,ce)}}function te(re,fe,oe){if(!re)return n(s(fe,oe),oe,1);if(Array.isArray(re.conditions)){const ce=re.conditions.filter(ke=>ke!=null),de=re.op==="or"?"or":re.op==="not"?"not":"and";if(ce.length===0)return n(s(fe,oe),oe,1);const ve=te(ce[0],fe,oe);for(let ke=1;ke<ce.length;ke++){const Ce=te(ce[ke],fe,oe);if(de==="or")for(let Le=0;Le<oe;Le++)ve[Le]|=Ce[Le];else for(let Le=0;Le<oe;Le++)ve[Le]&=Ce[Le];r(fe,Ce)}if(de==="not")for(let ke=0;ke<oe;ke++)ve[ke]^=1;return ve}return D(re,fe,s(fe,oe))}function z(re,fe){return te(re,fe,fe.count|0)}function X(re,fe){if(!re||!fe)return re||null;const oe=re;if(Array.isArray(oe.conditions)){if((oe.op==="or"?"or":oe.op==="not"?"not":"and")!=="and")return ne(oe,fe)?null:re;const de=[];for(const ve of oe.conditions){const ke=X(ve,fe);ke&&de.push(ke)}return de.length?{...oe,op:"and",conditions:de}:null}return oe.col===fe?null:re}function ne(re,fe){if(!re||typeof re!="object")return!1;const oe=re;if(oe.col===fe)return!0;if(Array.isArray(oe.conditions)){for(const ce of oe.conditions)if(ne(ce,fe))return!0}return!1}function se(re,fe,oe){if(oe&&oe.length>=fe){let ke=0;for(let Ce=0;Ce<fe;Ce++)re[Ce]&&(oe[ke++]=Ce);return oe.subarray(0,ke)}let ce=0;for(let ke=0;ke<fe;ke++)ce+=re[ke]?1:0;const de=new Uint32Array(ce);let ve=0;for(let ke=0;ke<fe;ke++)re[ke]&&(de[ve++]=ke);return de}const ue=new Map,ge=new Map,Oe=new Set,Pe=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn","contains","notContains","startsWith","endsWith","matches","blank","notBlank","containsAny","containsAll","containsNone"]);function Ie(re,fe){if(!re||typeof re!="object")return;const oe=Object.entries(re).filter(([,ce])=>ce&&typeof ce.compile=="function");if(typeof fe=="string"&&fe){let ce=ge.get(fe);ce||(ce=new Map,ge.set(fe,ce));for(const[de,ve]of oe)ce.set(de,ve)}for(const[ce,de]of oe)Pe.has(ce)?Oe.add(ce):ue.set(ce,de)}function xe(re){return typeof re=="string"?ue.get(re):void 0}function ye(re,fe){if(typeof re!="string"||typeof fe!="string")return;const oe=ge.get(re);return oe?oe.get(fe):void 0}}),_e("packages/core/src/columns/datatypes.js",function(e,F){"use strict";Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"parseNumberText",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"BUILTIN_TYPES",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return N}});const ie=F("packages/core/src/internal/compare.js"),E=ie.collator,K=ie.defaultCompare,I=F("packages/core/src/internal/predicates.js"),L=I.isNil,Q=I.isObject,U=I.isFunction,x=F("packages/core/src/internal/warn.js"),q=x.fail,R=x.infoOnce,k=F("packages/core/src/internal/text.js").titleCase,b=F("packages/core/src/format/date.js"),u=b.toDate,g=b.toIsoDate,o=b.compareIso,i=F("packages/core/src/format/boolean.js").toTriState,r=F("packages/core/src/columns/types/index.js").EXTENDED_TYPES,n=F("packages/core/src/formula/index.js"),m=n.evaluateFormula,l=n.looksLikeFormula,c=F("packages/core/src/compute/filter.js").declareOperators,f=/^\d{4}-\d{2}-\d{2}$/;function p($){return $.getHours()===0&&$.getMinutes()===0&&$.getSeconds()===0&&$.getMilliseconds()===0}const y=new Map;function h($){const H=$||"",Y=y.get(H);if(Y)return Y;const Z={group:",",decimal:"."};try{for(const J of new Intl.NumberFormat($||void 0).formatToParts(12345.6))J.type==="group"?Z.group=J.value:J.type==="decimal"&&(Z.decimal=J.value)}catch{}return y.set(H,Z),Z}const d=/\d\s*[*/^]\s*[\d.(]/;function w($,H){if(L($))return null;let Y=String($).trim();if(Y===""||Y.startsWith("=")||d.test(Y))return null;let Z=1;Y.startsWith("(")&&Y.endsWith(")")&&(Z=-1,Y=Y.slice(1,-1));const J=Y.endsWith("%"),{group:D,decimal:te}=h(H);if(Y=Y.replace(/[\s\u00a0\u202f\u2009']/g,""),D&&D!=="."&&D!==","&&(Y=Y.split(D).join("")),Y=Y.replace(/[^0-9eE+\-.,]/g,""),te===","?Y=Y.split(".").join("").replace(",","."):Y=Y.split(",").join(""),Y===""||Y==="-"||Y==="+")return null;const z=Number(Y);return Number.isNaN(z)?null:Z*(J?z/100:z)}function v($,H){const Y=L($)||Number.isNaN($)?null:Number($),Z=L(H)||Number.isNaN(H)?null:Number(H);return Y===null?Z===null?0:1:Z===null||Y<Z?-1:Y>Z?1:0}function P($,H){const Y=i($),Z=i(H);return Y===null?Z===null?0:1:Z===null?-1:Y===Z?0:Y?1:-1}function W($,H){const Y=u($),Z=u(H);if(!Y)return Z?1:0;if(!Z)return-1;const J=Y.getTime(),D=Z.getTime();return J<D?-1:J>D?1:0}const V=new Map;function G($){const H=u($.value);if(!H)return"";const Y=$.locale||"";let Z=V.get(Y);return Z||(Z=new Intl.DateTimeFormat($.locale||void 0,{dateStyle:"medium"}),V.set(Y,Z)),Z.format(H)}const _={boolean:{base:"boolean",storage:"bitset",matches:$=>typeof $=="boolean",parse:$=>i($.text),compare:P,format:$=>i($.value)===null?"":i($.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:$=>i($)===null?"":String(i($)),fromClipboard:$=>i($)},number:{base:"number",storage:"float64",matches:$=>typeof $=="number"&&!Number.isNaN($),parse:$=>{if(l($.text)){const H=m($.text,$);if(!H.ok)return null;const Y=Number(H.value);return Number.isFinite(Y)?Y:null}return w($.text,$.locale)},compare:v,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:$=>L($)?"":String($),fromClipboard:($,H)=>w($,H&&H.locale),toStorage:($,H)=>{if(typeof $!="string")return $;const Y=w($,H&&H.locale);return Y!==null?Y:(R(`type.number.unparsed.${H&&H.colId||""}`,`column "${H&&H.colId||"?"}" is declared type "number" but holds a value that is not a number in its locale; storing it as NaN, excluded from sorts and totals.`),NaN)}},date:{base:"dateString",storage:"dictionary",matches:$=>typeof $=="string"&&f.test($)&&!Number.isNaN(Date.parse($))||$ instanceof Date&&!Number.isNaN($.getTime())&&p($),parse:$=>g($.text),compare:o,format:G,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:$=>g($),toClipboard:$=>L($)?"":String($),fromClipboard:$=>g($)},dateString:{base:"dateString",storage:"dictionary",matches:$=>typeof $=="string"&&f.test($)&&!Number.isNaN(Date.parse($)),parse:$=>g($.text),compare:o,format:G,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:$=>g($),toClipboard:$=>L($)?"":String($),fromClipboard:$=>g($)},text:{base:"text",storage:"dictionary",matches:$=>typeof $=="string",parse:$=>$.text===""?null:String($.text),compare:($,H)=>L($)?L(H)?0:1:L(H)?-1:E().compare(String($),String(H)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:$=>L($)?"":String($),fromClipboard:$=>$},image:{base:"text",storage:"dictionary",parse:$=>$.text===""||$.text==null?null:String($.text).trim(),compare:($,H)=>L($)?L(H)?0:1:L(H)?-1:E().compare(String($),String(H)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:$=>L($)?"":String($),fromClipboard:$=>$},lookup:{base:"text",storage:"dictionary",parse:$=>{if($.text===""||$.text==null)return null;const H=$.column&&$.column.lookup,Y=H&&U(H.options)?H.options():null;if(!Y)return $.text;const Z=String($.text),J=Y.find(z=>String(z.id)===Z);if(J)return J.id;const D=Z.trim().toLowerCase(),te=Y.find(z=>String(z.label).toLowerCase()===D);return te?te.id:$.text},compare:K,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:$=>L($)?"":String($),fromClipboard:$=>$},object:{base:"object",storage:"object",matches:$=>$!==null&&typeof $=="object"&&!($ instanceof Date),parse:$=>{try{return $.text===""?null:JSON.parse($.text)}catch{return $.text}},compare:($,H)=>K($,H),format:$=>{const H=$.value;if(L(H))return"";if(typeof H=="string")return H;try{return JSON.stringify(H)}catch{return String(H)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:$=>L($)?"":typeof $=="string"?$:JSON.stringify($),fromClipboard:$=>$}},T=["boolean","number","date","dateString","datetime","text","object"];function S($,H,Y,Z){const J=Y.get($);if(J)return J;Z.includes($)&&q(`circular data type extends chain: ${[...Z,$].join(" → ")}`);const D=H[$];D||q(`unknown data type "${$}"`);let te=null;D.extends&&(te=S(D.extends,H,Y,[...Z,$]));const z={...te||{},...D,name:$,defaults:{...te&&te.defaults||{},...D.defaults||{}}};return z.base||(z.base=te&&te.base||"text"),z.storage||(z.storage=te&&te.storage||"object"),Y.set($,z),z}function O($,H){const Y={..._,...r};if(H&&typeof H.dataType=="function"&&typeof H.names=="function")for(const J of H.names("dataType")){const D=H.dataType(J);D&&(Y[J]=D)}if(Q($))for(const[J,D]of Object.entries($))Y[J]=D;const Z=new Map;for(const J of T)S(J,Y,Z,[]);S("lookup",Y,Z,[]);for(const J of Object.keys(Y))S(J,Y,Z,[]);for(const J of Z.values())c(J.operators,J.name);return Z}function M($,H){if($.base==="text"&&(!$.compare||$.compare===_.text.compare)){const Y=E(H);return(Z,J)=>L(Z)?L(J)?0:1:L(J)?-1:Y.compare(String(Z),String(J))}return $.compare||K}function A($,H){return H?$.multiStorage||"multi":$.storage||"object"}function N($){return k(String($).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),_e("packages/core/src/columns/infer.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_SAMPLE",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"inferFromValues",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return U}});const E=F("packages/core/src/internal/warn.js").infoOnce,I=F("packages/core/src/internal/predicates.js").isNil,L=100;function Q(x,q,R={}){const j=R.sampleSize??L,k=[];for(let b=0;b<x.length&&k.length<j;b++){const u=x[b];I(u)||typeof u=="number"&&Number.isNaN(u)||k.push(u)}if(k.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[b,u]of q){if(typeof u.matches!="function")continue;let g=!0;for(let o=0;o<k.length;o++)if(!u.matches(k[o])){g=!1;break}if(g)return{type:b,unanimous:!0,sampled:k.length}}return R.quiet||E(`infer:${R.colId||"?"}`,`column "${R.colId||"?"}" has mixed or ambiguous values and was inferred as "text". Declare \`type\` on the column to get correct sorting, filtering and export.`),{type:"text",unanimous:!1,sampled:k.length}}function U(x,q,R,j,k={}){const b=k.sampleSize??L,u=[];for(let g=0;g<q.length&&u.length<b;g++){const o=R(q[g]);I(o)||typeof o=="number"&&Number.isNaN(o)||u.push(o)}return Q(u,j,{...k,colId:x}).type}}),_e("packages/core/src/columns/graph.js",function(e,F){"use strict";Object.defineProperty(e,"WHOLE_ROW",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"declarationOf",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return j}});const ie=F("packages/core/src/internal/warn.js"),E=ie.DEV,K=ie.fail,I=ie.warnOnce,Q=F("packages/core/src/internal/predicates.js").isFunction,U="*";function x(k){const b=k.value||{};if(!Q(b.compute))return{computed:!1,wholeRow:!1,deps:[],pure:!0};const g=b.pure!==!1;return b.deps===U?{computed:!0,wholeRow:!0,deps:[],pure:g}:Array.isArray(b.deps)?{computed:!0,wholeRow:!1,deps:b.deps.slice(),pure:g}:(I(`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 q(k){const b=new Map;for(const c of k)b.set(c.id,c);const u=new Map,g=new Map,o=new Set,t=new Set,i=new Set,s=new Set;for(const c of k){const f=x(c);if(!f.computed){u.set(c.id,[]);continue}t.add(c.id),(f.pure?i:s).add(c.id),f.wholeRow&&o.add(c.id);const p=[],y=[];for(const h of f.deps)(b.has(h)?p:y).push(h);u.set(c.id,p),y.length&&g.set(c.id,y)}for(const c of i)for(const f of u.get(c))s.has(f)&&K(`pure computed column "${c}" depends on impure column "${f}". Mark it \`value.pure: false\` or make the dependency pure.`);const r=[],n=new Map,m=[],l=c=>{const f=n.get(c);if(f!=="done"){if(f==="open"){const p=m.indexOf(c);K(`circular column dependency: ${[...m.slice(p),c].join(" → ")}`)}n.set(c,"open"),m.push(c);for(const p of u.get(c)||[])b.has(p)&&l(p);m.pop(),n.set(c,"done"),r.push(c)}};for(const c of k)l(c.id);const a=new Map;for(const c of k)a.set(c.id,[]);for(const c of k)for(const f of u.get(c.id)||[]){const p=a.get(f);p&&!p.includes(c.id)&&p.push(c.id)}if(o.size)for(const c of k){if(t.has(c.id))continue;const f=a.get(c.id);for(const p of o)f.includes(p)||f.push(p)}return{order:r,dependents:a,pure:i,impure:s,computed:t,deps:u,wholeRow:o,external:g,index:b}}function R(k,b){const u=Array.isArray(b)?b:[b],g=new Set,o=[...u];for(;o.length;){const t=o.shift();for(const i of k.dependents.get(t)||[])g.has(i)||(g.add(i),o.push(i))}for(const t of u)g.delete(t);return k.order.filter(t=>g.has(t))}function j(k,b,u){if(!E)return k;const g=b instanceof Set?b:new Set(b);return new Proxy(k,{get(o,t){return typeof t=="string"&&!g.has(t)&&!Object.hasOwn(o,t)&&I(`undeclared:${u}:${t}`,`computed column "${u}" read undeclared dependency "${t}". Add it to \`value.deps\` or the value will go stale.`),o[t]}})}}),_e("packages/core/src/model/rowkey.js",function(e,F){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return x}}),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 o}}),Object.defineProperty(e,"splitPathKey",{enumerable:!0,get:function(){return t}});const E=F("packages/core/src/internal/warn.js").warnOnce,I=F("packages/core/src/internal/paths.js").pathGetter,L=F("packages/core/src/internal/predicates.js"),Q=L.isFunction,U=L.isBlank,x=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],q="";function R(i){if(i===null)return"\0n";if(i===void 0)return"\0u";const s=typeof i;if(s==="string")return i;if(s==="number"||s==="bigint"||s==="boolean")return String(i);if(i instanceof Date)return`\0d${i.getTime()}`;try{return`\0o${JSON.stringify(i)}`}catch{return"\0o?"}}function j(i){if(i.length===1)return R(i[0]);let s="";for(let r=0;r<i.length;r++)r&&(s+=q),s+=R(i[r]);return s}function k(i,s={}){const r=s.warn!==!1;if(Q(i)){const n=i;return{stable:!0,fields:[],disabled:[],key(m,l){try{const a=n(m);return Array.isArray(a)?j(a):R(a)}catch(a){return E("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",a),`#${l??-1}`}},keyEmpty(m){try{const l=n(m);return Array.isArray(l)?l.length===0||l.some(U):U(l)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(i)&&i.length>0){const n=i.filter(a=>typeof a=="string"),m=n.map(a=>I(a)),l=m.length;return{stable:!0,fields:n,disabled:[],key(a){const c=new Array(l);for(let f=0;f<l;f++)c[f]=m[f](a);return j(c)},keyEmpty(a){for(let c=0;c<l;c++)if(U(m[c](a)))return!0;return!1},missingFields(a){const c=[];for(let f=0;f<l;f++)U(m[f](a))&&c.push(n[f]);return c}}}if(typeof i=="string"&&i.length>0){const n=I(i);return{stable:!0,fields:[i],disabled:[],key(m){return R(n(m))},keyEmpty(m){return U(n(m))},missingFields(m){return U(n(m))?[i]:[]}}}return r&&E("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${x.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:x.slice(),key(n,m){if(n===null||typeof n!="object")return`#${m??0}:${String(n)}`;let l=b.get(n);return l===void 0&&(l=`#${u++}`,b.set(n,l)),l}}}const b=new WeakMap;let u=0;function g(i,s){if(!i||i.stable===!1||!Q(i.keyEmpty)||!Array.isArray(s)||s.length===0)return;let r=0,n=null,m;for(let f=0;f<s.length;f++){const p=s[f];i.keyEmpty(p)&&(r++,n===null&&(n=Q(i.missingFields)?i.missingFields(p):[],m=p))}if(r===0)return;const l=i.fields.length?i.fields.join(","):"(function)",a=n&&n.length?n.join(", "):i.fields.length?i.fields.join(", "):"the rowKey function",c=m!==null&&typeof m=="object"?Object.keys(m).join(", ")||"(no fields)":String(m);E(`rowKey.emptyValue:${l}`,`rowKey ${a} is missing on ${r} of ${s.length} rows; the first such row has: ${c}. 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 o(i){return j(i)}function t(i){return i.split(q)}}),_e("packages/core/src/columns/lookup.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_SEPARATOR",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"normaliseOption",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"Lookup",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toValueArray",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createLookup",{enumerable:!0,get:function(){return i}});const ie=F("packages/core/src/internal/compare.js"),E=ie.collator,K=ie.defaultCompare,I=F("packages/core/src/internal/predicates.js"),L=I.isFunction,Q=I.isNil,x=F("packages/core/src/internal/warn.js").warnOnce,R=F("packages/core/src/model/rowkey.js").compositeKey,j=", ",k="";function b(s,r,n,m){if(s===null||typeof s!="object")return{id:s,label:s==null?"":String(s)};const l=s[r],a=s[n],c={id:l,label:a==null?String(l??""):String(a)};s.disabled&&(c.disabled=!0),s.variant&&(c.variant=s.variant),s.icon&&(c.icon=s.icon);const f=m?s[m]:s.group;return f!==void 0&&(c.group=f),c}function u(s,r,n=0,m=[],l=[]){for(const a of s||[]){const c=a&&typeof a=="object"?a[r]:null;if(l.push({raw:a,depth:n,path:m}),Array.isArray(c)&&c.length){const f=String(a&&typeof a=="object"?a.label??a.name??a.id??"":a);u(c,r,n+1,[...m,f],l)}}return l}function g(s){return!!s&&typeof s=="object"&&!Array.isArray(s)&&L(s.router&&s.router.subscribe)}class o{#e;#t;#n;#r;#i=[];#s=new Map;#a=new Map;#l=0;#o="idle";#c=null;#u;#f=null;#d=new Map;constructor(r,n={}){this.#e=r||{},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.#o="ready")}get colId(){return this.#t}get version(){return this.#l}get state(){return this.#o}get ready(){return this.#o==="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.#i}setLocale(r){this.#n=r,this.#u=E(r)}#h(r){const n=this.#e,m=n.valueKey||"id",l=n.labelKey||"label",a=n.childrenKey||"children";this.#i=u(r,a).map(c=>{const f=b(c.raw,m,l,n.groupKey);return c.depth&&(f.depth=c.depth,f.path=c.path),f}),this.#s=new Map,this.#a=new Map,this.#i.forEach((c,f)=>{this.#s.set(c.id,c),this.#a.set(c.id,f)}),this.#o="ready",this.#l+=1}load(){if(this.#c)return this.#c;const r=this.#e.options;if(Array.isArray(r)||r===void 0)return this.#c=Promise.resolve(this.#i),this.#c;if(g(r))return this.#c=this.#p(r),this.#c;if(!L(r))return x(`lookup:options:${this.#t}`,`column "${this.#t}" has an invalid \`lookup.options\`; expected an array, a function, or a router route`),this.#o="ready",this.#c=Promise.resolve([]),this.#c;this.#o="loading";let n;try{n=r()}catch(m){return this.#o="error",x(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,m),this.#c=Promise.resolve([]),this.#c}return!n||!L(n.then)?(this.#h(n),this.#c=Promise.resolve(this.#i),this.#r&&this.#r(this),this.#c):(this.#c=n.then(m=>(this.#h(m),this.#r&&this.#r(this),this.#i),m=>(this.#o="error",x(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,m),[])),this.#c)}refresh(){return this.#c=null,Array.isArray(this.#e.options)?(this.#h(this.#e.options),this.#r&&this.#r(this),Promise.resolve(this.#i)):this.load()}#p(r){if(this.#f)return Promise.resolve(this.#i);const n=this.#e,m=n.valueKey||"id",l=n.labelKey||"label",a=n.groupKey,c=L(r.map)?r.map:null,f=y=>b(c?c(y):y,m,l,a).id,p=y=>this.#m(y,c,m,l,a);return r.router.subscribe(r.predicate,p,{rowKey:f}),this.#f=()=>{L(r.router.detach)&&r.router.detach(p)},this.#o="ready",Promise.resolve(this.#i)}#m(r,n,m,l,a){const c=r&&r.add||[],f=r&&r.update||[],p=r&&r.remove||[];if(!(!c.length&&!f.length&&!p.length)){for(const y of c)this.#g(y,n,m,l,a);for(const y of f)this.#g(y,n,m,l,a);for(const y of p){if(!this.#d.has(y))continue;const h=this.#d.get(y);this.#d.delete(y),this.#s.delete(h);const d=this.#i.findIndex(w=>w.id===h);d>=0&&this.#i.splice(d,1)}this.#a=new Map(this.#i.map((y,h)=>[y.id,h])),this.#o="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(r,n,m,l,a){const c=b(n?n(r):r,m,l,a);this.#d.set(R([c.id]),c.id);const f=this.#i.findIndex(p=>p.id===c.id);f>=0?this.#i[f]=c:this.#i.push(c),this.#s.set(c.id,c)}destroy(){this.#f&&(this.#f(),this.#f=null)}search(r,n){const m=this.#e;if(!L(m.search)){const c=String(r||"").toLowerCase();return Promise.resolve(c===""?this.#i:this.#i.filter(f=>f.label.toLowerCase().includes(c)))}const l=m.valueKey||"id",a=m.labelKey||"label";return Promise.resolve(m.search(r,n)).then(c=>(c||[]).map(f=>b(f,l,a,m.groupKey)))}option(r){return this.#s.get(r)}has(r){return this.#s.has(r)}label(r){if(Q(r)||r==="")return"";const n=this.#s.get(r);if(n)return n.label;if(this.#o==="loading"||this.#o==="idle")return"";this.allowCustom||x(`lookup:unknown:${this.#t}`,`column "${this.#t}" holds value ${JSON.stringify(r)} which is not in its lookup options. Showing the raw value; set \`lookup.unknownLabel\` or \`lookup.allowCustom\` to change that.`);const m=this.#e.unknownLabel;return L(m)?String(m(r)??""):typeof m=="string"?m:String(r)}text(r){if(this.multiple){const n=t(r);return n.length===0?"":n.map(m=>this.label(m)).join(this.separator)}return this.label(r)}dictionary(){return this.#i.map(r=>r.id)}sorted(){const r=this.sortBy;if(r==="optionOrder"||r==="count")return this.#i.slice();if(r==="value")return this.#i.slice().sort((m,l)=>K(m.id,l.id));const n=this.#u;return this.#i.slice().sort((m,l)=>n.compare(m.label,l.label))}comparator(){const r=this.sortBy,n=this.multiple,m=this.#u,l=this.#a;if(n&&r==="count")return(c,f)=>t(c).length-t(f).length;const a=n?c=>t(c)[0]:c=>c;return r==="value"?(c,f)=>K(a(c),a(f)):r==="optionOrder"?(c,f)=>{const p=l.has(a(c))?l.get(a(c)):Number.MAX_SAFE_INTEGER,y=l.has(a(f))?l.get(a(f)):Number.MAX_SAFE_INTEGER;return p-y}:(c,f)=>{const p=a(c),y=a(f);return Q(p)?Q(y)?0:1:Q(y)?-1:m.compare(this.label(p),this.label(y))}}groupKey(r){return this.multiple?t(r).map(m=>String(m)).sort().join(k):Q(r)?"":String(r)}countValues(r){return this.multiple?t(r).length:Q(r)?0:1}contains(r,n,m){const l=this.multiple?t(r):Q(r)?[]:[r],a=Array.isArray(n)?n:[n];switch(m){case"containsAll":return a.every(c=>l.includes(c));case"containsNone":return!a.some(c=>l.includes(c));default:return a.some(c=>l.includes(c))}}exportText(r,n="label"){return n==="value"?this.multiple?t(r).join(this.separator):Q(r)?"":String(r):this.text(r)}exportColumns(){const r=this.multiple;return this.#i.map(n=>({id:n.id,label:n.label,has:m=>r?t(m).includes(n.id):m===n.id}))}}function t(s){return Array.isArray(s)?s:Q(s)||s===""?[]:[s]}function i(s,r={}){const n=s.lookup;if(!n)return null;const m=new o(n,{colId:s.id,locale:r.locale,onChange:r.onChange});return!Array.isArray(n.options)&&n.options!==void 0&&m.load(),m}}),_e("packages/core/src/columns/value.js",function(e,F){"use strict";Object.defineProperty(e,"compileDisplay",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"warnImpureUse",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ValuePipeline",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return s}});const E=F("packages/core/src/internal/paths.js").getPath,K=F("packages/core/src/internal/predicates.js"),I=K.isFunction,L=K.isNil,Q=K.isObject,x=F("packages/core/src/internal/lru.js").Lru,R=F("packages/core/src/internal/warn.js").warnOnce,k=F("packages/core/src/format/number.js").compileNumber,u=F("packages/core/src/columns/graph.js").depsProxy,g="\0";function o(l,a={}){const c=a.locale,f=a.grid??null,p=a.context,y=l.value&&l.value.format,h=l.formatter||null,d=l.dataType&&l.dataType.format,w=l.lookup||null,v=(P,W,V)=>({value:P,data:V,row:W,column:l,colId:l.id,grid:f,context:p,locale:c});if(I(y))return(P,W,V)=>{const G=y(v(P,W,V));return G==null?"":String(G)};if(h){if(w){const P=h.kind==="text";return(W,V,G)=>h(P?w.text(W):W,v(W,V,G))}return(P,W,V)=>h(P,v(P,W,V))}if(I(d))return(P,W,V)=>{const G=d(v(P,W,V));return G==null?"":String(G)};if(l.dataType&&l.dataType.base==="number"&&Q(l.typeOptions)&&typeof l.typeOptions.decimals=="number"){const P=k({decimals:l.typeOptions.decimals},c);return W=>P(W)}return w?P=>w.text(P):P=>L(P)?"":typeof P=="string"?P:String(P)}function t(l,a){!l||!l.value||l.value.pure!==!1||R(`impure:${a}:${l.id}`,`column "${l.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${a}. The result is not stable across passes.`)}class i{#e;#t;#n;#r;#i;#s;#a=new x(4096);constructor(a){this.#e=a.columns instanceof Map?a.columns:new Map((a.columns||[]).map(c=>[c.id,c])),this.#t=a.graph,this.#n=a.grid??null,this.#r=a.context,this.#s=a.stored||null,this.#i=a.rowKey||s}get graph(){return this.#t}setGraph(a){this.#t=a,this.#a.clear()}beginPass(){this.#a.clear()}endPass(){this.#a.clear()}invalidate(a){if(this.#a.size===0)return;const c=a&&a.rows?new Set([...a.rows].map(String)):null,f=a&&a.columns?[...a.columns]:null;if(!c&&!f){this.#a.clear();return}const p=f?this.#l(f):null;for(const y of[...this.#a.keys()]){const h=String(y).split(g);h.length===3&&(c&&!c.has(h[0])||p&&!p.has(h[2])||this.#a.delete(y))}}#l(a){const c=new Set,f=this.#t,p=[...a];for(;p.length;){const y=p.pop();if(!c.has(y)){c.add(y);for(const h of f?f.dependents.get(y)||[]:[])p.push(h)}}return c}value(a,c,f){const p=typeof a=="string"?this.#e.get(a):a;if(!p)return;if(!p.computed)return this.#c(p,c,f);if(p.value.pure!==!1&&this.#s&&f&&f.physical!=null&&this.#s.has(p.id))return this.#s.get(p.id,f.physical);if(p.volatile)return this.compute(p,c,f);if(p.value.pure===!1)return this.compute(p,c,f);const y=`${this.#o(c,f)}${g}${p.id}`;if(this.#a.has(y))return this.#a.get(y);const h=this.compute(p,c,f);return this.#a.set(y,h),h}#o(a,c){return`${this.#i(a,c)}${g}${r(a)}`}#c(a,c,f){if(this.#s&&f&&f.physical!=null&&this.#s.has(a.id))return this.#s.get(a.id,f.physical);if(a.field)return a.read?a.read(c):E(c,a.field)}compute(a,c,f){const p=this.#t,y=p&&p.wholeRow.has(a.id);let h;if(y)h=c??{};else{h={};const w=p&&p.deps.get(a.id)||[];for(const P of w)h[P]=this.value(P,c,f);const v=p&&p.external.get(a.id)||[];for(const P of v)h[P]=E(c,P);h=u(h,[...w,...v],a.id)}const d={data:c,row:f,column:a,grid:this.#n,context:this.#r};return a.value.compute(h,d)}values(a,c){const f={},p=this.#t?this.#t.order:[...this.#e.keys()];for(const y of p)f[y]=this.value(y,a,c);return f}text(a,c,f){const p=typeof a=="string"?this.#e.get(a):a;return p?p.formatValue(this.value(p,c,f),f,c):""}key(a,c,f){const p=typeof a=="string"?this.#e.get(a):a;if(!p)return"";const y=this.value(p,c,f);return I(p.value.key)?String(p.value.key(this.#u(p,y,c,f))):p.lookup?p.lookup.groupKey(y):L(y)?"":String(y)}quickFilterText(a,c,f){const p=typeof a=="string"?this.#e.get(a):a;if(!p)return"";if(I(p.value.quickFilterText)){const y=this.value(p,c,f);return String(p.value.quickFilterText(this.#u(p,y,c,f))??"")}return this.text(p,c,f)}#u(a,c,f,p){return{value:c,data:f,row:p,column:a,colId:a.id,grid:this.#n,context:this.#r}}parse(a,c,f,p){const y=typeof a=="string"?this.#e.get(a):a;if(!y)return c;const h={text:c,value:this.value(y,f,p),data:f,row:p,column:y,grid:this.#n,context:this.#r,locale:this.#n&&I(this.#n.get)?this.#n.get("locale"):void 0,formulaFunctions:this.#n&&I(this.#n.get)?this.#n.get("formulaFunctions"):void 0};return I(y.value.parse)?y.value.parse(h):y.dataType&&I(y.dataType.parse)?y.dataType.parse(h):c}validate(a,c,f,p,y){const h=typeof a=="string"?this.#e.get(a):a;if(!h||!I(h.edit.validate))return!0;const d=h.edit.validate({value:c,oldValue:f,data:p,row:y,column:h,grid:this.#n,context:this.#r});return d===!0||d===void 0?!0:String(d)}apply(a,c,f,p){const y=typeof a=="string"?this.#e.get(a):a;if(!y)return!1;const h=this.value(y,f,p);if(I(y.value.apply)){const d=y.value.apply({value:c,oldValue:h,data:f,row:p,column:y,grid:this.#n,context:this.#r});return this.#f(y,f,p),d!==!1}return y.field?h===c?!1:(y.write(f,c),this.#f(y,f,p),!0):(R(`apply:${y.id}`,`column "${y.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(a,c,f,p){const y=typeof a=="string"?this.#e.get(a):a;if(!y)return{ok:!1,value:void 0,oldValue:void 0,changed:!1,error:"unknown column"};const h=this.value(y,f,p),d=this.parse(y,c,f,p),w=this.validate(y,d,h,f,p);if(w!==!0)return{ok:!1,value:d,oldValue:h,changed:!1,error:w};const v=this.apply(y,d,f,p);return{ok:!0,value:d,oldValue:h,changed:v}}#f(a,c,f){if(this.#a.size===0)return;const p=this.#o(c,f);this.#a.delete(`${p}${g}${a.id}`);for(const y of this.#t?this.#t.dependents.get(a.id)||[]:[])this.#a.delete(`${p}${g}${y}`)}}function s(l,a){return a&&a.key!=null?String(a.key):r(l)}function r(l){if(l&&typeof l=="object"){let a=n.get(l);return a===void 0&&(a=`#${m++}`,n.set(l,a)),a}return String(l)}const n=new WeakMap;let m=0}),_e("packages/core/src/model/shadow.js",function(e,F){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"HISTORY_TICK_MAX_MS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"HISTORY_TICK_MIN_MS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return R}}),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 b}}),Object.defineProperty(e,"SPEC_STATUS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"POSITIONAL_KINDS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"SHADOW_LABELS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"specStatusOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ShadowTracker",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"shadowsIn",{enumerable:!0,get:function(){return a}});const E=F("packages/core/src/internal/warn.js").warnOnce,K=2e5,I=20,L=1e3,Q=50;function U(c){return Math.min(L,Math.max(Q,Math.floor(c)))}const x=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"]),q=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),R=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),j=Object.freeze(["cluster","clusterDistance"]),k=.6745,b=3.5,u=Object.freeze({PASS:"PASS",WARN:"WARN",FAIL:"FAIL"}),g=Object.freeze(["rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag"]),o=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(c,f){if(!f)return null;const p=Number.isFinite(Number(f.lower))?Number(f.lower):null,y=Number.isFinite(Number(f.upper))?Number(f.upper):null;if(p===null&&y===null||!Number.isFinite(c))return null;if(p!==null&&c<p||y!==null&&c>y)return u.FAIL;const h=Number.isFinite(Number(f.warnLower))?Number(f.warnLower):null,d=Number.isFinite(Number(f.warnUpper))?Number(f.warnUpper):null;return h!==null&&c<h||d!==null&&c>d?u.WARN:u.PASS}function i(c,f,p){if(!f||typeof f!="object")return null;if(f.kind!=="time")return f.kind!==void 0&&E(`shadow.history.window.kind:${c}`,`a 'history' shadow's 'window' only accepts {kind: 'time', span}; '${f.kind}' is not honoured (a plain count is already what 'depth' means, and a session has no span to divide into buckets), so it reported the original, unwindowed history.`),null;const y=f.minutes!=null?Number(f.minutes)*6e4:Number(f.span);if(!(y>0))return E(`shadow.history.window.span:${c}`,"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 h=Math.max(2,Math.floor(p)||I);return{span:y,bucketMs:Math.max(1,Math.floor(y/h))}}class s{#e;#t=new Map;#n=new Map;#r=new Map;#i=new Map;#s=new Map;#a=new Map;#l=0;#o;#c;#u;#f;#d=new Map;#h=null;#p=null;#m=null;constructor(f){this.#e=f.colId,this.#o=Math.max(2,f.depth||I),this.#c=Math.max(1,f.max||K),this.#u=f.now||(()=>Date.now()),this.#f=i(this.#e,f.historyWindow,this.#o),this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#f}observe(f,p){const y=l(p);if(y===null)return;if(!this.#n.has(f)){this.#p=null,this.#m=null,this.#g(),this.#t.set(f,y),this.#n.set(f,y),this.#r.set(f,0),this.#i.set(f,this.#u()),this.#s.set(f,[y]),this.#f&&this.#d.set(f,[y]),this.#a.set(f,0);return}const h=this.#n.get(f);if(h===y)return;this.#p=null,this.#m=null,this.#n.set(f,y),this.#r.set(f,(this.#r.get(f)||0)+1),this.#i.set(f,this.#u());const d=this.#s.get(f)||[];d.push(y),d.length>this.#o&&d.splice(0,d.length-this.#o),this.#s.set(f,d);const w=Math.sign(y-h),v=this.#a.get(f)||0;this.#a.set(f,Math.sign(v)===w?v+w:w)}#g(){if(this.#n.size<this.#c)return;const f=this.#n.keys().next().value;f!==void 0&&(this.#t.delete(f),this.#n.delete(f),this.#r.delete(f),this.#i.delete(f),this.#s.delete(f),this.#d.delete(f),this.#a.delete(f),this.#l++)}rebase(){for(const[f,p]of this.#n)this.#t.set(f,p);this.#p=null,this.#m=null}reset(){this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#i.clear(),this.#s.clear(),this.#d.clear(),this.#a.clear(),this.#l=0,this.#p=null,this.#m=null,this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}retain(f){const p=f instanceof Set?f:new Set(f);let y=0;for(const h of[...this.#n.keys()])p.has(h)||(this.#t.delete(h),this.#n.delete(h),this.#r.delete(h),this.#i.delete(h),this.#s.delete(h),this.#d.delete(h),this.#a.delete(h),y++);return y&&(this.#p=null,this.#m=null),y}advanceHistoryWindow(f=this.#u()){const p=this.#f;if(!p)return 0;const y=Math.floor(f/p.bucketMs),h=y-this.#h;if(!(h>0))return 0;const d=Math.min(h,this.#o);for(const[w,v]of this.#d){const P=this.#n.get(w);for(let W=0;W<d;W++)v.push(P);v.length>this.#o&&v.splice(0,v.length-this.#o)}return this.#h=y,h}read(f,p,y,h){switch(f){case"updates":return this.#r.has(p)?this.#r.get(p):0;case"updatedAt":{const d=this.#i.get(p);return d===void 0?null:new Date(d)}case"sinceUpdate":{const d=this.#i.get(p);return d===void 0?null:this.#u()-d}case"firstValue":return this.#t.has(p)?this.#t.get(p):null;case"delta":return this.#n.has(p)?this.#n.get(p)-this.#t.get(p):null;case"deltaPercent":{if(!this.#n.has(p))return null;const d=this.#t.get(p);return d?(this.#n.get(p)-d)/Math.abs(d)*100:null}case"rate":{const d=this.#s.get(p),w=this.#i.get(p);if(!d||d.length<2||w===void 0)return null;const v=this.#u()-w,P=d[d.length-1]-d[d.length-2];return v>0?P/v*1e3:P}case"history":return this.#f?this.#d.has(p)?[...this.#d.get(p)]:null:this.#s.has(p)?[...this.#s.get(p)]:null;case"streak":return this.#a.has(p)?this.#a.get(p):0;case"specStatus":return this.#n.has(p)?t(this.#n.get(p),h):null;default:return g.includes(f)?this.#O(f,p,y,h):null}}#b(f){if(f){if(this.#m&&this.#m.only===f)return this.#m.view;const p=this.#y(f);return this.#m={only:f,view:p},p}return this.#p?this.#p:(this.#p=this.#y(null),this.#p)}#y(f){const p=[];for(const[_,T]of this.#n)f&&!f.has(_)||p.push(T);const y=p.sort((_,T)=>_-T);let h=0,d=0,w=0,v=0;for(const _ of y){v+=_,h++;const T=_-d;d+=T/h,w+=T*(_-d)}const P=[];for(const[_,T]of this.#t)f&&!f.has(_)||P.push(T);const W=h?r(y):0,V=y.map(_=>Math.abs(_-W)).sort((_,T)=>_-T),G=h?r(V):0;return{sorted:y,baseline:P.sort((_,T)=>_-T),sum:v,mean:h?d:0,sd:h>1?Math.sqrt(w/(h-1)):0,median:W,mad:G}}#O(f,p,y,h){if(!this.#n.has(p)||y&&!y.has(p))return null;const d=this.#n.get(p),w=this.#b(y),v=w.sorted.length;if(!v)return null;switch(f){case"rank":return v-m(w.sorted,d)+1;case"rankAsc":return n(w.sorted,d)+1;case"rankChange":{if(!this.#t.has(p)||!w.baseline.length)return null;const P=w.baseline.length-m(w.baseline,this.#t.get(p))+1,W=v-m(w.sorted,d)+1;return P-W}case"percentile":return m(w.sorted,d)/v*100;case"quartile":{const P=m(w.sorted,d)/v;return Math.min(4,Math.max(1,Math.ceil(P*4)))}case"zScore":return w.sd?(d-w.mean)/w.sd:null;case"anomalyScore":return w.mad?k*(d-w.median)/w.mad:null;case"anomalyFlag":{if(!w.mad)return null;const P=h&&Number.isFinite(Number(h.threshold))?Number(h.threshold):b;return Math.abs(k*(d-w.median)/w.mad)>P}case"shareOfTotal":return w.sum?d/w.sum*100:null;default:return null}}}function r(c){const f=c.length;if(!f)return 0;const p=(f-1)*.5,y=Math.floor(p),h=Math.ceil(p);return y===h?c[y]:c[y]+(p-y)*(c[h]-c[y])}function n(c,f){let p=0,y=c.length;for(;p<y;){const h=p+y>>1;c[h]<f?p=h+1:y=h}return p}function m(c,f){let p=0,y=c.length;for(;p<y;){const h=p+y>>1;c[h]<=f?p=h+1:y=h}return p}function l(c){if(c==null||c==="")return null;if(c instanceof Date){const p=c.getTime();return Number.isFinite(p)?p:null}const f=typeof c=="number"?c:Number(c);return Number.isFinite(f)?f:null}function a(c){const f=[];for(const p of c||[]){const y=p.shadow;if(!y)continue;const h=typeof y=="string"?{kind:y}:y,d=h.kind;x.includes(d)&&(q.includes(d)||R.includes(d)||j.includes(d)||f.push({colId:p.id||p.field,of:h.of||p.field||p.id,kind:d,depth:h.depth,historyWindow:d==="history"?h.window:void 0}))}return f}}),_e("packages/core/src/columns/model.js",function(e,F){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return Ie}});const ie=F("packages/core/src/internal/merge.js"),E=ie.expand,K=ie.merge,I=ie.toArray,L=F("packages/core/src/internal/warn.js"),Q=L.fail,U=L.warnOnce,x=F("packages/core/src/internal/paths.js"),q=x.getPath,R=x.pathGetter,j=x.pathSetter,b=F("packages/core/src/internal/text.js").humanise,u=F("packages/core/src/internal/predicates.js"),g=u.isFunction,o=u.isObject,i=F("packages/core/src/internal/uid.js").uid,r=F("packages/core/src/format/index.js").compileFormat,n=F("packages/core/src/columns/datatypes.js"),m=n.comparatorFor,l=n.createTypeRegistry,a=n.storageKind,c=F("packages/core/src/columns/infer.js"),f=c.inferColumnType,p=c.DEFAULT_SAMPLE,y=F("packages/core/src/columns/graph.js"),h=y.buildGraph,d=y.affectedBy,v=F("packages/core/src/columns/lookup.js").createLookup,P=F("packages/core/src/columns/value.js"),W=P.compileDisplay,V=P.ValuePipeline,G=P.warnImpureUse,_=F("packages/core/src/model/shadow.js"),T=_.FIT_SHADOW_KINDS,S=_.CLUSTER_SHADOW_KINDS,O=Object.freeze({geometry:"geometry",list:"list"}),M={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},A={centre:"center"},N=new Set(["start","center","end","left","right"]);function $(ye){if(typeof ye!="string")return;const re=ye.toLowerCase();return A[re]?A[re]:N.has(re)?re:void 0}function H(ye){if(typeof ye!="string")return;const re=ye.toLowerCase();return re==="center"||re==="centre"?"middle":re==="top"||re==="middle"||re==="bottom"?re:void 0}const Y=["cell","layout","header"];function Z(ye){if(!o(ye))return{};const re={...ye},fe=(oe,ce)=>{if(ye[oe]===void 0)return;const de=E(ye[oe],ce);de&&Y.includes(oe)&&!o(ye[oe])&&delete de.enabled,re[oe]=de};return fe("sort","direction"),fe("filter","type"),fe("cell","render"),fe("edit","editor"),fe("layout","width"),fe("group","index"),fe("pivot","index"),fe("header","render"),fe("facet","strategy"),re}function J(ye,re){const fe={...ye||{}},oe=o(re)&&o(re.layout)&&re.layout.width!==void 0;return fe.fit==="content"&&!oe&&delete fe.width,fe}const D=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"]),te=new Set(["collapsible","columns","facet","header","id","marryChildren","openByDefault","showWhen","title"]);function z(ye,re,fe,oe){const ce=fe==="columnGroup"?"column group":"column";for(const de of Object.keys(ye))if(!re.has(de)){if(de==="timeZone"&&fe==="column"){U("column.timeZone",`\`timeZone\` is not a column option, so it had no effect on column "${oe}". 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}U(`${fe}.unknown:${de}`,`'${de}' is not a configuration key this grid recognises, so it had no effect on ${ce} "${oe}". Check the spelling against the reference.`)}}function X(ye){o(ye.cell)&&ye.cell.autoHeight!==void 0&&U("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${ye.id||ye.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function ne(ye,re){const fe=re&&g(ye.defaultsFor)?ye.defaultsFor(re):null,oe={...ye.defaults||{},...o(fe)?fe:{}},ce={};return oe.align&&(ce.align=oe.align,ce.cell={align:oe.align},ce.header={align:oe.align}),oe.filter&&(ce.filter=oe.filter==="none"?{enabled:!1,type:"none"}:{enabled:!0,type:oe.filter}),oe.editor&&(ce.edit=oe.editor==="none"?{editor:null}:{editor:oe.editor}),oe.total&&(ce.total=oe.total),oe.render&&(ce.cell={...ce.cell||{},render:oe.render}),ye.export&&(ce.export={...ye.export}),ce}function se(ye){if(typeof ye=="string")return ye.trim()?[ye.trim()]:[];if(!Array.isArray(ye))return[];const re=[];for(const fe of ye){if(typeof fe!="string")continue;const oe=fe.trim();oe&&!re.includes(oe)&&re.push(oe)}return re}class ue{#e=new Map;#t=[];#n=[];#r=new WeakMap;#i;#s;#a;#l;#o;#c;#u(re,fe,oe){if(re&&typeof re=="object"&&!g(re)){const ke=re;return(typeof ke.fn!="string"||!ke.fn)&&Q(`column "${oe}": a total given as an object needs a \`fn\` name, such as { fn: 'percentile', p: 0.9 }.`),ke.fn==="percentile"&&!(typeof ke.p=="number"&&ke.p>=0&&ke.p<=1)&&Q(`column "${oe}": { fn: 'percentile' } needs \`p\`, a number from 0 to 1 (0.9 for the 90th percentile).`),this.#f(ke.fn,fe,oe),Object.freeze({...ke})}const ce=this.#f(re,fe,oe);if(typeof ce!="string"||!this.#d)return ce??null;const de=fe&&fe.totals&&fe.totals.implement;if(de&&g(de[ce])){const ke=de[ce];return ke.totalName=ce,ke}const ve=this.#d.totalFn?.(ce);return g(ve)?ve:ce}#f(re,fe,oe){if(typeof re!="string")return re;const ce=fe&&fe.totals&&fe.totals.supported;if(!Array.isArray(ce)||ce.includes(re))return re;const de=ce.length?ce.join(", "):"none";return Q(`column "${oe}" is typed ${fe.name||"a type"}, for which the total "${re}" is not meaningful. Supported: ${de}. Aggregating it anyway would produce a confident wrong number.`),re}#d;#h;#p;#m;#g;#b;#y=!1;#O;#w;constructor(re={}){this.#s=Z(re.columnDefaults||{}),this.#a=re.columnPresets||{},this.#o=re.locale,this.#l=re.timeZone,this.#c=H(re.verticalAlign),this.#d=re.registry||null,this.#h=re.grid||null,this.#p=re.context,this.#O=re.sampleSize??p,this.#w=re.onChange||null,this.#b=g(re.rowKey)?re.rowKey:void 0,this.#i=l(re.dataTypes,this.#d);const{leaves:fe,groups:oe}=Ie(re.columns||[]);this.#n=oe;for(const ce of fe){ce.facet!==void 0&&this.#r.set(ce.def,ce.facet);const de=this.#A(ce.def,null);if(de.groupPath=ce.path,this.#e.has(de.id)){U(`columns.duplicate:${de.id}`,`two columns resolve to the id '${de.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}ce.column=de,this.#e.set(de.id,de),this.#t.push(de.id)}this.#C(re.stored||null)}#A(re,fe){z(re,D,"column",re.id||re.field||"(unnamed)"),X(re);const oe=Z(re),ce=I(re.preset),de=ce.map(Me=>{const Be=this.#a[Me];return Be?Z(Be):(U(`preset:${Me}`,`unknown column preset "${Me}"; ignoring`),{})}),ve=this.#S(oe,de,fe),ke=this.#i.get(ve)||this.#i.get("text");if(!this.#i.has(ve)&&re.type){const Me=O[ve];U(`type:${ve}`,`unknown data type "${ve}"; falling back to "text"`+(Me?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${Me}'.`:""))}const Ce=g(ke.items)?this.#P(oe,de,re.id||re.field||"(unnamed)"):null;let Le=M;Le=K(Le,this.#s),re.type!==!1&&(Le=K(Le,ne(ke,Ce)));for(const Me of de)Le=K(Le,Me);this.#r.has(re)&&(Le=K(Le,Z({facet:this.#r.get(re)}))),Le=K(Le,oe);const we=Le.edit;we&&we.editor&&we.enabled!==!0&&!g(we.enabled)&&(re.edit||{}).editor&&U(`column.editor-not-enabled:${re.id||re.field}`,`column '${re.id||re.field}' names the editor '${we.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const He=re.id||re.field||i("col");if(re.shadow&&!g(Le.value&&Le.value.compute)){const Me=typeof re.shadow=="string"?{kind:re.shadow}:re.shadow,Be=Me.of||re.field||He,Ke=T.includes(Me.kind),et=S.includes(Me.kind),Je=Ke?Me.model||Me:null,ut=Ke&&Je?[...Array.isArray(Je.predictors)?Je.predictors:[],Je.response].filter(Boolean):null,Ct=et?(Array.isArray(Me.columns)?Me.columns:[]).filter(Boolean):null;Le.value={...Le.value||{},deps:Ct&&Ct.length?Ct:ut&&ut.length?ut:Me.orderBy&&Me.orderBy!==Be?[Be,Me.orderBy]:[Be],pure:!1,compute:(Nt,st)=>{const it=st.grid&&st.grid.statistics;if(!it)return null;const ct=st.row&&st.row.key||it.keyOf(st.data);if(!ct)return null;if(Ke){if(!g(it.fitShadow))return null;const Tt=Me.model?{...Me.model,threshold:Me.threshold}:Me;return it.fitShadow(Me.kind,ct,Tt)}return et?g(it.clusterShadow)?it.clusterShadow(Me.kind,ct,Me):null:it.shadow(Be,Me.kind,ct,Me.scope,Me)}}}if(re.running&&!g(Le.value&&Le.value.compute)){const Me=typeof re.running=="string"?{kind:re.running}:re.running,Be=Me.of||re.field||He;Le.value={...Le.value||{},deps:[Be],pure:!1,compute:(Ke,et)=>{const Je=et.grid&&et.grid.statistics;if(!Je||!g(Je.running))return null;const ut=et.row&&et.row.key||Je.keyOf(et.data);return ut?Je.running(Be,Me.kind||"total",ut):null}},re.sort===void 0&&(Le.sort={...Le.sort||{},enabled:!1})}const Te=re.field??(g(Le.value&&Le.value.compute)?null:re.id??null),Ae=g(Le.value&&Le.value.compute),Se={id:He,field:Te,shadow:re.shadow||null,running:re.running||null,spec:re.spec||null,validation:re.validation||null,volatile:!!(re.shadow||re.running),title:Le.title??b(Te||He),type:ke.name,dataType:ke,itemType:Ce,nullable:Le.nullable!==!1,align:$(oe.cell&&oe.cell.align||oe.align||Le.cell&&Le.cell.align||Le.align||ke.defaults&&ke.defaults.align)||"start",verticalAlign:H(oe.cell&&oe.cell.verticalAlign||oe.verticalAlign||Le.cell&&Le.cell.verticalAlign||Le.verticalAlign)||this.#c,rowSpan:g(Le.rowSpan)?Le.rowSpan:null,colSpan:g(Le.colSpan)?Le.colSpan:null,value:{pure:!0,...Le.value||{}},cell:{...Le.cell||{}},edit:{...Le.edit||{}},sort:{...Le.sort||{}},filter:{...Le.filter||{}},group:{enabled:!1,index:-1,explode:!1,...Le.group||{}},pivot:{enabled:!1,index:-1,...Le.pivot||{}},total:this.#u(Le.total,ke,re.id||re.field||"(unnamed)"),groupTotal:Le.groupTotal===void 0?null:this.#u(Le.groupTotal,ke,re.id||re.field||"(unnamed)"),grandTotal:Le.grandTotal===void 0?null:this.#u(Le.grandTotal,ke,re.id||re.field||"(unnamed)"),tags:se(Le.tags),typeOptions:Le.typeOptions??null,...o(Le[ve])?{[ve]:Le[ve]}:{},layout:J(Le.layout,oe),header:{...Le.header||{}},contextMenu:Le.contextMenu===void 0?null:Le.contextMenu,facet:{...Le.facet||{}},export:{...Le.export||{}},allowGroup:Le.allowGroup!==!1,allowPivot:Le.allowPivot!==!1,allowTotal:Le.allowTotal!==!1,quickFilter:Le.quickFilter!==!1,def:re,format:Le.format,presets:ce,inferred:fe!=null&&!re.type,computed:Ae,diff:re.diff===void 0?void 0:!!re.diff,read:Te?R(Te):null,write:Te?j(Te):null};Se.cell.align=$(oe.cell&&oe.cell.align)||Se.align,Se.header.align=$(oe.header&&oe.header.align)||Se.align;const Ee=Le.lookup||null;return Se.lookup=Ee?v({id:He,lookup:Ee},{locale:this.#o,onChange:()=>{this.#w&&this.#w("lookup",{colId:He})}}):null,Se.group.explode&&Se.lookup&&Se.lookup.multiple&&U(`explode:${He}`,`column "${He}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(Se),Se}#v(re){re.formatter=r(re.format,re.dataType,this.#o,this.#l,re.id),re.formatValue=W(re,{locale:this.#o,grid:this.#h,context:this.#p}),re.itemCompare=re.itemType?m(re.itemType,this.#o):null,re.compare=g(re.value.compare)?re.value.compare:re.lookup?re.lookup.comparator():g(re.dataType.compareFor)?re.dataType.compareFor(re):m(re.dataType,this.#o),re.excel=re.formatter&&re.formatter.ooxml||re.dataType&&re.dataType.excel||"General",re.storeKind=a(re.dataType,!!(re.lookup&&re.lookup.multiple))}#P(re,fe,oe){let ce=o(re.typeOptions)?re.typeOptions:null;for(let Ce=fe.length-1;!ce&&Ce>=0;Ce--)o(fe[Ce].typeOptions)&&(ce=fe[Ce].typeOptions);!ce&&o(this.#s.typeOptions)&&(ce=this.#s.typeOptions);const de=ce&&ce.of!==void 0?ce.of:"text",ve=typeof de=="string"?this.#i.get(de):void 0;return ve&&!g(ve.items)&&ve.storage!=="object"?ve:(U(`type:of:${String(de)}`,`column "${oe}" names "${String(de)}" as its item type (typeOptions.of), which is not ${ve?"a scalar data type":"a known data type"}; its items are read as text.`),this.#i.get("text"))}#S(re,fe,oe){if(re.type===!1)return"text";if(re.type)return re.type;for(let ce=fe.length-1;ce>=0;ce--)if(fe[ce].type)return fe[ce].type;if(this.#s.type)return this.#s.type;if(re.shadow){const ce=typeof re.shadow=="string"?re.shadow:re.shadow.kind;if(ce==="fitInfluence")return"boolean";if(ce==="fitPredicted"||ce==="fitResidual"||ce==="fitStdResidual"||ce==="fitLeverage"||ce==="fitCooksD"||ce==="tsTrend"||ce==="tsSeasonal"||ce==="tsResidual"||ce==="tsCoverage"||ce==="tsSmoothed"||ce==="tsSmoothingAlpha"||ce==="tsSmoothingBeta"||ce==="cluster"||ce==="clusterDistance")return"number"}return oe||(re.lookup?"lookup":"text")}#C(re){const fe=this.all();this.#m=h(fe),this.#g?this.#g.setGraph(this.#m):this.#g=new V({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:re||null,rowKey:this.#b});const oe=this.#g;for(const ce of fe)ce.getValue=(de,ve)=>oe.value(ce,de,ve)}all(){return this.#t.map(re=>this.#e.get(re))}visible(){return this.all().filter(re=>!re.layout.hidden)}get(re){return this.#e.get(re)}groups(){const re=fe=>{const oe=[];for(const ce of fe)Array.isArray(ce.columns)?oe.push({...ce,columns:re(ce.columns)}):ce.column&&oe.push(ce.column);return oe};return re(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#i}affectedBy(re){return d(this.#m,re)}value(re,fe,oe){return this.#g.value(re,fe,oe)}text(re,fe,oe){return this.#g.text(re,fe,oe)}checkImpure(re,fe){G(this.#e.get(re),fe)}setLocale(re){this.#o=re;for(const fe of this.all())fe.lookup&&fe.lookup.setLocale(re),this.#v(fe);this.#w&&this.#w("locale",{locale:re})}infer(re){const fe={};if(this.#y||!Array.isArray(re)||re.length===0)return fe;this.#y=!0;let oe=!1;for(const ce of this.all()){const de=ce.def;if(de.type!==void 0||!ce.field||ce.computed||ce.lookup||this.#E(ce))continue;const ve=ce.read||(Le=>q(Le,ce.field)),ke=f(ce.id,re,ve,this.#i,{sampleSize:this.#O});if(ke===ce.type)continue;fe[ce.id]=ke;const Ce=this.#A(de,ke);Ce.groupPath=ce.groupPath,Ce.layout={...Ce.layout,...ge(ce.layout)},this.#e.set(ce.id,Ce),xe(this.#n,ce.id,Ce),oe=!0}return oe&&this.#C(null),fe}redecorate(re,fe,oe={}){const ce=this.#e.get(re);if(!ce){U(`redecorate:${re}`,`columns.decorate('${re}', …): no column with id '${re}'.`);return}const de=ce.def||{},ve={...o(de.cell)?de.cell:{}};ve.decoration=fe??void 0,oe&&"variant"in oe&&(ve.variant=oe.variant);const ke={...de,cell:ve};this.#r.has(de)&&this.#r.set(ke,this.#r.get(de));const Ce=this.#A(ke,ce.type);return Ce.groupPath=ce.groupPath,Ce.layout={...Ce.layout,...ge(ce.layout)},ce.lookup&&ce.lookup!==Ce.lookup&&g(ce.lookup.destroy)&&ce.lookup.destroy(),this.#e.set(re,Ce),xe(this.#n,re,Ce),this.#C(null),this.#w&&this.#w("decorate",{colId:re}),Ce}destroy(){for(const re of this.#e.values())re.lookup&&g(re.lookup.destroy)&&re.lookup.destroy()}#E(re){for(const fe of re.presets){const oe=this.#a[fe];if(oe&&oe.type)return!0}return!!this.#s.type}#T(re){return!re.computed&&g(re.dataType&&re.dataType.toStorage)}storeReader(re){if(re.computed)return fe=>this.#g.value(re,fe,null);if(this.#T(re)){const fe=re.dataType.toStorage,oe=re.format&&typeof re.format=="object"&&!Array.isArray(re.format)?re.format.locale:void 0,ce={timeZone:this.#l,colId:re.id,itemType:re.itemType||null,locale:oe||this.#o};return de=>fe(re.read(de),ce)}return re.read}storeValue(re,fe){if(!(!re||re.computed)&&g(re.read))return this.storeReader(re)(fe)}storeSchema(){const re=[];for(const fe of this.all()){if(fe.computed&&fe.value.pure===!1||!fe.computed&&!fe.field)continue;const oe=this.storeReader(fe);let ce=null;!fe.computed&&!this.#T(fe)&&typeof fe.field=="string"&&!fe.lookup&&(ce=fe.field);const de={id:fe.id,kind:fe.storeKind,nullable:fe.nullable,read:oe};ce!==null&&(de.field=ce),fe.lookup&&(de.dictionary=fe.lookup.dictionary()),re.push(de)}return re}state(){return this.all().map(re=>({id:re.id,width:re.layout.width,flex:re.layout.flex||void 0,hidden:!!re.layout.hidden,headerWrap:re.header?.wrap===!0?!0:void 0,headerOrientation:re.header?.orientation==="vertical"?"vertical":void 0,pin:re.layout.pin??null,sort:re.sort.direction??null,sortIndex:re.sort.direction?re.sort.order??0:null,groupIndex:re.group.enabled?re.group.index??0:null,pivotIndex:re.pivot.enabled?re.pivot.index??0:null,total:typeof re.total=="string"?re.total:null,groupTotal:typeof re.groupTotal=="string"?re.groupTotal:void 0,grandTotal:typeof re.grandTotal=="string"?re.grandTotal:void 0,decoration:re.cell&&re.cell.decoration!=null?Oe(re.cell.decoration):void 0,variant:re.cell&&re.cell.variant!=null?Oe(re.cell.variant):void 0}))}applyState(re,fe={}){const oe={applied:[],skipped:[]},ce=Array.isArray(re)?re:re&&re.columns||[],de=!Array.isArray(re)&&re&&re.columnOrder||null;for(const ke of ce){if(!ke||!ke.id){oe.skipped.push({key:"?",reason:"no id"});continue}let Ce=this.#e.get(ke.id);if(!Ce){oe.skipped.push({key:ke.id,reason:"unknown column"});continue}if(Object.hasOwn(ke,"decoration")||Object.hasOwn(ke,"variant")){const Le=Ce.cell?Ce.cell.decoration:void 0,we=ke.decoration??null,He=Object.hasOwn(ke,"variant"),Te=He&&!Pe(Ce.cell?Ce.cell.variant:void 0,ke.variant);(!Pe(Le,we)||Te)&&(this.redecorate(ke.id,we,He?{variant:ke.variant??void 0}:{}),Ce=this.#e.get(ke.id)||Ce)}ke.width!=null&&(Ce.layout.width=ke.width),ke.flex!=null&&(Ce.layout.flex=ke.flex),ke.hidden!=null&&(Ce.layout.hidden=!!ke.hidden),ke.headerWrap!==void 0&&(Ce.header.wrap=!!ke.headerWrap),ke.headerOrientation!==void 0&&(Ce.header.orientation=ke.headerOrientation==="vertical"?"vertical":"horizontal"),ke.pin!==void 0&&(Ce.layout.pin=ke.pin),ke.sort!==void 0&&(Ce.sort.direction=ke.sort),ke.sortIndex!=null&&(Ce.sort.order=ke.sortIndex),ke.groupIndex!=null&&(Ce.group.enabled=!0,Ce.group.index=ke.groupIndex),ke.pivotIndex!=null&&(Ce.pivot.enabled=!0,Ce.pivot.index=ke.pivotIndex),ke.total!==void 0&&(Ce.total=ke.total),ke.groupTotal!==void 0&&(Ce.groupTotal=ke.groupTotal),ke.grandTotal!==void 0&&(Ce.grandTotal=ke.grandTotal),oe.applied.push(ke.id)}const ve=de||(fe&&fe.keepOrder?[]:ce.map(ke=>ke&&ke.id).filter(Boolean));if(ve.length){const ke=ve.filter(Le=>this.#e.has(Le)),Ce=this.#t.filter(Le=>!ke.includes(Le));this.#t=[...ke,...Ce]}return this.#w&&this.#w("state",oe),oe}move(re,fe){this.#M(re,fe)&&(this.#R(),this.#w&&this.#w("move",{id:re,to:fe}))}reorder(re){const fe={applied:[],skipped:[]},oe=[];let ce=0;for(const de of Array.isArray(re)?re:[]){const ve=ce++;this.#M(de,ve)&&(fe.applied.push(de),oe.push({id:de,to:ve}))}if(!oe.length)return fe;if(this.#R(),this.#w)for(const de of oe)this.#w("move",de);return fe}#M(re,fe){const oe=this.#t.indexOf(re);if(oe===-1||Math.max(0,Math.min(Number(fe)||0,this.#t.length-1))===oe)return!1;const de=this.#e.get(re);if(de.layout.movable===!1||de.layout.lockPosition)return U(`move:${re}`,`column "${re}" is not movable; the move was ignored`),!1;const ve=this.#N(re,fe);return ve?(U(`move.married:${ve}`,`band "${ve}" declares marryChildren, so its columns stay together; the move was ignored`),!1):(this.#t.splice(oe,1),this.#t.splice(Math.max(0,Math.min(fe,this.#t.length)),0,re),!0)}#N(re,fe){if(!this.#n||!this.#n.length)return null;const oe=this.#t.filter(ke=>ke!==re),ce=Math.max(0,Math.min(fe,oe.length)),de=(ke,Ce)=>{if(Array.isArray(ke.columns)){for(const we of ke.columns)de(we,Ce);return Ce}const Le=ke.column?ke.column.id:ke.id;return Le&&Ce.push(Le),Ce},ve=ke=>{for(const Ce of ke){if(!Array.isArray(Ce.columns))continue;if(Ce.marryChildren===!0){const we=de(Ce,[]),He=we.includes(re),Te=we.map(Ae=>oe.indexOf(Ae)).filter(Ae=>Ae>=0);if(Te.length){const Ae=Math.min(...Te),Se=Math.max(...Te);if(He?ce<Ae||ce>Se+1:ce>Ae&&ce<=Se)return Ce.id}}const Le=ve(Ce.columns);if(Le)return Le}return null};return ve(this.#n)}#R(){const re=new Map(this.#t.map((ce,de)=>[ce,de])),fe=ce=>{if(!Array.isArray(ce.columns)){const ve=ce.column?ce.column.id:ce.id;return re.has(ve)?re.get(ve):1/0}let de=1/0;for(const ve of ce.columns)de=Math.min(de,fe(ve));return de},oe=ce=>{ce.sort((de,ve)=>fe(de)-fe(ve));for(const de of ce)Array.isArray(de.columns)&&oe(de.columns)};oe(this.#n)}#D(re){const fe=oe=>{for(let ce=0;ce<oe.length;ce++){const de=oe[ce];if(Array.isArray(de.columns)){const ve=fe(de.columns);if(ve)return ve}else if(de.column&&de.column.id===re)return oe.splice(ce,1)[0]}return null};return fe(this.#n)}#K(re){const fe=[];for(let oe=re.length-1;oe>=0;oe--){const ce=re[oe];Array.isArray(ce.columns)&&(fe.push(...this.#K(ce.columns)),ce.columns.length===0&&(fe.push(ce.id),re.splice(oe,1)))}return fe}#Y(){const re=(fe,oe,ce)=>{for(const de of fe)Array.isArray(de.columns)?re(de.columns,[...oe,de.id]):de.column&&(de.column.groupPath=oe)};re(this.#n,[])}#x(re){const fe=new Set(re),oe=this.#t.filter(ke=>fe.has(ke));if(!oe.length)return;const ce=Math.min(...oe.map(ke=>this.#t.indexOf(ke))),de=this.#t.slice(0,ce).filter(ke=>!fe.has(ke)),ve=this.#t.slice(ce).filter(ke=>!fe.has(ke));this.#t=[...de,...oe,...ve]}#H(re){const fe=[],oe=ce=>{if(Array.isArray(ce.columns))for(const de of ce.columns)oe(de);else ce.column&&fe.push(ce.column.id)};return oe(re),fe}#F(re){const fe=oe=>{for(const ce of oe){if(!Array.isArray(ce.columns))continue;if(ce.id===re)return{node:ce,parent:oe};const de=fe(ce.columns);if(de)return de}return null};return fe(this.#n)}groupColumns(re,fe={}){const oe=I(re).filter(Ce=>this.#e.has(Ce));if(!oe.length)return U("columns.group.empty","groupColumns was given no known column ids; nothing was grouped."),null;for(const Ce of oe)if(this.#e.get(Ce).layout.lockPosition)return U(`columns.group.locked:${Ce}`,`column "${Ce}" is position-locked and cannot be grouped.`),null;const ce=fe.groupId?this.#F(fe.groupId):null;if(fe.groupId&&!ce)return U(`columns.group.unknown:${fe.groupId}`,`no band "${fe.groupId}" to add to; nothing was grouped.`),null;let de=null;if(!ce&&fe.id!=null&&(de=String(fe.id),this.#F(de)||this.#e.has(de)))return U(`columns.group.idtaken:${de}`,`band id "${de}" is already in use; nothing was grouped.`),null;const ve=oe.map(Ce=>this.#D(Ce)).filter(Boolean);if(!ve.length)return null;let ke;if(ce)ce.node.columns.push(...ve),ke=ce.node.id;else{const Ce={id:de||i("grp"),title:fe.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:ve},Le=Number.isInteger(fe.at)?Math.max(0,Math.min(fe.at,this.#n.length)):this.#n.length;this.#n.splice(Le,0,Ce),ke=Ce.id}return this.#K(this.#n),this.#x(oe),this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"formed",groupId:ke,ids:oe}),ke}ungroupColumn(re){const fe=this.#e.get(re);if(!fe){U(`columns.ungroup.unknown:${re}`,`no column "${re}" to ungroup.`);return}const oe=fe.groupPath||[];if(!oe.length)return;const ce=oe[oe.length-1],de=this.#F(ce);if(!de)return;const ve=this.#D(re);if(!ve)return;const ke=de.parent.indexOf(de.node);de.parent.splice(ke+1,0,ve);const Ce=this.#K(this.#n),Le=this.#H(de.node);if(Le.length){this.#x(Le);const we=Math.max(...Le.map(Te=>this.#t.indexOf(Te))),He=this.#t.filter(Te=>Te!==re);He.splice(we+1,0,re),this.#t=He}this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"removed",id:re,dissolved:Ce})}renameGroup(re,fe){const oe=this.#F(re);if(!oe){U(`columns.group.rename:${re}`,`no band "${re}" to rename.`);return}oe.node.title=String(fe??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:re,title:oe.node.title})}dissolveGroup(re){const fe=this.#F(re);if(!fe){U(`columns.group.dissolve:${re}`,`no band "${re}" to dissolve.`);return}const oe=fe.parent.indexOf(fe.node);fe.parent.splice(oe,1,...fe.node.columns),this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:re})}moveGroup(re,fe){const oe=this.#F(re);if(!oe){U(`columns.group.move:${re}`,`no band "${re}" to move.`);return}const ce=oe.parent,de=ce.indexOf(oe.node);de!==-1&&(ce.splice(de,1),ce.splice(Math.max(0,Math.min(fe,ce.length)),0,oe.node),this.#X(),this.#Y(),this.#w&&this.#w("columngroup",{action:"moved",groupId:re,to:fe}))}#X(){const re=[],fe=ce=>{for(const de of ce)Array.isArray(de.columns)?fe(de.columns):de.column&&re.push(de.column.id)};fe(this.#n);const oe=new Set(re);this.#t=[...re,...this.#t.filter(ce=>!oe.has(ce))]}groupTree(){const re=oe=>oe.map(ce=>Array.isArray(ce.columns)?{id:ce.id,title:ce.title||"",collapsible:!!ce.collapsible,openByDefault:ce.openByDefault!==!1,columns:re(ce.columns)}:ce.column?ce.column.id:null).filter(ce=>ce!==null),fe=re(this.#n);return fe.some(oe=>oe&&typeof oe=="object")?fe:[]}applyGroupTree(re){if(!Array.isArray(re))return;const fe=new Set,oe=de=>{const ve=[];for(const ke of de)if(ke&&typeof ke=="object"&&Array.isArray(ke.columns)){const Ce=oe(ke.columns);if(!Ce.length)continue;ve.push({id:ke.id||i("grp"),title:ke.title||"",collapsible:ke.collapsible===!0,openByDefault:ke.openByDefault!==!1,showWhen:"always",marryChildren:!1,header:{},def:{},columns:Ce})}else if(typeof ke=="string"){const Ce=this.#e.get(ke);Ce&&!fe.has(ke)&&(fe.add(ke),ve.push({column:Ce,path:[]}))}return ve},ce=oe(re);for(const de of this.#t){if(fe.has(de))continue;const ve=this.#e.get(de);ve&&ce.push({column:ve,path:[]})}this.#n=ce,this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"applied"})}show(re){this.#V(re,!1)}hide(re){this.#V(re,!0)}#V(re,fe){const oe=[];for(const ce of I(re)){const de=this.#e.get(ce);if(de){if(fe&&de.layout.lockVisible){U(`lockVisible:${ce}`,`column "${ce}" is \`layout.lockVisible\` and cannot be hidden`);continue}de.layout.hidden!==fe&&(de.layout.hidden=fe,oe.push(ce))}}oe.length&&this.#w&&this.#w("visible",{ids:oe,hidden:fe})}pin(re,fe){const oe=this.#e.get(re);oe&&(oe.layout.pin=fe??null,this.#w&&this.#w("pin",{id:re,side:oe.layout.pin}))}pinMany(re){const fe={};for(const[ce,de]of re){const ve=this.#e.get(ce);ve&&(ve.layout.pin=de??null,fe[ce]=ve.layout.pin)}const oe=Object.keys(fe);oe.length&&this.#w&&this.#w("pin",{ids:oe,pins:fe})}#B(re,fe){const oe=re.layout.min??0,ce=re.layout.max;let de=Math.max(oe,fe);return ce!=null&&(de=Math.min(ce,de)),re.layout.width=de,re.layout.flex=0,de}resize(re,fe){const oe=this.#e.get(re);if(!oe)return;if(oe.layout.resizable===!1){U(`resize:${re}`,`column "${re}" is not resizable; the resize was ignored`);return}const ce=this.#B(oe,fe);this.#w&&this.#w("resize",{id:re,width:ce})}resizeMany(re){const fe={};for(const[ce,de]of re){const ve=this.#e.get(ce);if(ve){if(ve.layout.resizable===!1){U(`resize:${ce}`,`column "${ce}" is not resizable; the resize was ignored`);continue}fe[ce]=this.#B(ve,de)}}const oe=Object.keys(fe);oe.length&&this.#w&&this.#w("resize",{ids:oe,widths:fe})}}function ge(ye){const re={};return ye.width!=null&&(re.width=ye.width),ye.hidden!=null&&(re.hidden=ye.hidden),ye.pin!==void 0&&(re.pin=ye.pin),re}function Oe(ye){if(ye===null||typeof ye!="object")return ye;try{return structuredClone(ye)}catch{}try{return JSON.parse(JSON.stringify(ye))}catch{return ye}}function Pe(ye,re){const fe=ye??null,oe=re??null;if(fe===oe)return!0;if(fe===null||oe===null)return!1;if(typeof fe!="object"||typeof oe!="object")return fe===oe;try{return JSON.stringify(fe)===JSON.stringify(oe)}catch{return!1}}function Ie(ye){const re=[],fe=(ce,de,ve)=>{const ke=[];for(const Ce of ce){if(!o(Ce)){Q("a column definition must be an object");continue}if(Array.isArray(Ce.columns)){z(Ce,te,"columnGroup",Ce.title||Ce.id||"(unnamed)");const Le={id:Ce.id||i("grp"),title:Ce.title||"",collapsible:Ce.collapsible===!0,openByDefault:Ce.openByDefault!==!1,showWhen:Ce.showWhen||"always",marryChildren:Ce.marryChildren===!0,header:Ce.header||{},def:Ce,columns:[]};Le.columns=fe(Ce.columns,[...de,Le.id],Ce.facet!==void 0?Ce.facet:ve),ke.push(Le)}else{const Le={def:Ce,path:de,facet:ve};re.push(Le),ke.push(Le)}}return ke},oe=fe(ye,[],void 0);return{leaves:re,groups:oe}}function xe(ye,re,fe){for(const oe of ye){if(oe.columns){if(xe(oe.columns,re,fe))return!0;continue}if(oe.column&&oe.column.id===re)return oe.column=fe,!0}return!1}}),_e("packages/core/src/columns/autogroup.js",function(e,F){"use strict";Object.defineProperty(e,"AUTO_GROUP_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createAutoGroupColumn",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"warnOnAbsurdGrouping",{enumerable:!0,get:function(){return q}});const E=F("packages/core/src/internal/warn.js").warnOnce,K="__lattice_group",I=240,L=.5;function Q(R){const j=R.def&&R.def.layout;return(typeof j=="number"||j&&j.width!=null||R.def&&R.def.width!=null)&&Number.isFinite(R.layout.width)?R.layout.width:null}function U(R){const j=R.def&&R.def.layout;return!!(j&&j.min!=null)||R.def&&R.def.minWidth!=null}function x(R){const{columns:j,groupBy:k}=R,b=k.map(s=>j.get(s)).filter(Boolean),u=b.length?b.map(s=>s.title||s.id).join(" > "):"Group",g=b.find(s=>Q(s)!=null),o=R.config&&R.config.autoGroupColumnWidth||(g?Q(g):I);let t=g&&U(g)?g.layout.min:120;g&&!U(g)&&(t=Math.min(t,o));const i=g&&g.layout.max!=null?g.layout.max:null;return{id:K,field:null,title:u,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:o,min:t,max:i,pin:R.config&&R.config.autoGroupColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(s,r){return r&&r.group?r.groupValue:null},formatValue(s,r){if(!r||!r.group)return"";if(r.grandTotal)return R.config&&R.config.grandTotalLabel||"Total";const n=b[Math.min(r.level||0,b.length-1)];return n&&typeof n.formatValue=="function"?n.formatValue(s,r):s==null?"":String(s)}}}function q(R,j,k){!R.length||k<100||j<k*L||E(`grouping.cardinality:${R.join(",")}`,`grouping by ${R.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.`)}}),_e("packages/core/src/columns/selectcolumn.js",function(e,F){"use strict";Object.defineProperty(e,"SELECT_COLUMN_ID",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"createSelectionColumn",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return I}});const ie="__lattice_select",E=44;function K(L){const Q=L.selection||{},U=L.config&&L.config.selectionColumnWidth||E;return{id:ie,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:U,min:U,max:U,pin:L.config&&L.config.selectionColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,headerCheckbox:Q.headerCheckbox===!0,def:{},getValue(x,q){return q?q.selected:!1},formatValue(){return""}}}const I=K}),_e("packages/core/src/columns/rownumbercolumn.js",function(e,F){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createRowNumberColumn",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return q}});const E=F("packages/core/src/internal/predicates.js").isFunction,K="__lattice_rownumber",I=40,L=9,Q=22;function U(R){const j=String(Math.max(1,Math.trunc(Math.abs(R))||1)).length;return Math.max(I,j*L+Q)}function x(R){const j=R.rowNumbers,k=j&&typeof j=="object"?j:{},b=Number.isFinite(k.start)?k.start:1,u=Number.isFinite(k.width)?k.width:U((R.maxNumber||0)+b),g=E(R.rank)?R.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:u,min:u,max:u,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(o,t){const i=g(t);return i==null?null:i-1+b},formatValue(o){return o==null?"":String(o)}}}const q=x}),_e("packages/core/src/model/detail.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_DETAIL_HEIGHT",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"DEFAULT_CACHE_LIMIT",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"DetailModel",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return q}});const E=F("packages/core/src/internal/predicates.js").isFunction,I=F("packages/core/src/internal/warn.js").warnOnce,L=240,Q=10;function U(R){if(!R)return null;const j=R===!0?{}:R;return j.enabled===!1?null:!E(j.rows)&&!j.render?(I("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??L,maxHeight:j.maxHeight??null,cacheLimit:Number.isFinite(j.cacheLimit)?Math.max(0,j.cacheLimit):Q,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 x{#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))||L:k==="auto"?L:Number(k)||L}open(j){return this.#t.has(j)?!1:(this.inline||this.#t.clear(),this.#t.add(j),this.#i(),!0)}close(j){return this.#t.delete(j)?(this.#i(),!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.#i())}prune(j){if(!this.#t.size||!E(j))return;let k=!1;for(const b of[...this.#t])j(b)||(this.#t.delete(b),k=!0);k&&this.#i()}signature(){return`${this.#r}`}set(j){this.#t.clear();const k=Array.isArray(j)?j:[];for(const b of this.inline?k:k.slice(0,1))this.#t.add(b);this.#i()}#i(){this.#r++,this.#n()}}const q=x}),_e("packages/core/src/compute/special.js",function(e,F){"use strict";Object.defineProperty(e,"logGamma",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"incompleteBeta",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"normalQuantile",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"normalCdf",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"studentT",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"chiSquareUpperTail",{enumerable:!0,get:function(){return o}});const ie=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),E=3e-12,K=1e-300;function I(t){if(t<.5)return Math.log(Math.PI/Math.sin(Math.PI*t))-I(1-t);const i=t-1;let s=.9999999999998099;const r=i+7.5;for(let n=0;n<ie.length;n++)s+=ie[n]/(i+n+1);return .5*Math.log(2*Math.PI)+(i+.5)*Math.log(r)-r+Math.log(s)}function L(t,i,s){const r=t+i,n=t+1,m=t-1;let l=1,a=1-r*s/n;Math.abs(a)<K&&(a=K),a=1/a;let c=a;for(let f=1;f<=300;f++){const p=2*f;let y=f*(i-f)*s/((m+p)*(t+p));a=1+y*a,Math.abs(a)<K&&(a=K),l=1+y/l,Math.abs(l)<K&&(l=K),a=1/a,c*=a*l,y=-(t+f)*(r+f)*s/((t+p)*(n+p)),a=1+y*a,Math.abs(a)<K&&(a=K),l=1+y/l,Math.abs(l)<K&&(l=K),a=1/a;const h=a*l;if(c*=h,Math.abs(h-1)<E)break}return c}function Q(t,i,s){if(!(t>0)||!(i>0)||!Number.isFinite(s))return Number.NaN;if(s<=0)return 0;if(s>=1)return 1;const r=Math.exp(I(t+i)-I(t)-I(i)+t*Math.log(s)+i*Math.log(1-s));return s<(t+1)/(t+i+2)?r*L(t,i,s)/t:1-r*L(i,t,1-s)/i}function U(t){if(!(t>0)||!(t<1))return t===0?-1/0:t===1?1/0:Number.NaN;const i=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],s=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],r=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],n=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],m=.02425;let l,a,c;t<m?(l=Math.sqrt(-2*Math.log(t)),c=(((((r[0]*l+r[1])*l+r[2])*l+r[3])*l+r[4])*l+r[5])/((((n[0]*l+n[1])*l+n[2])*l+n[3])*l+1)):t<=1-m?(l=t-.5,a=l*l,c=(((((i[0]*a+i[1])*a+i[2])*a+i[3])*a+i[4])*a+i[5])*l/(((((s[0]*a+s[1])*a+s[2])*a+s[3])*a+s[4])*a+1)):(l=Math.sqrt(-2*Math.log(1-t)),c=-(((((r[0]*l+r[1])*l+r[2])*l+r[3])*l+r[4])*l+r[5])/((((n[0]*l+n[1])*l+n[2])*l+n[3])*l+1));const p=(.5*x(-c/Math.SQRT2)-t)*Math.sqrt(2*Math.PI)*Math.exp(c*c/2);return c-p/(1+c*p/2)}function x(t){const i=Math.abs(t),s=2/(2+i),r=4*s-2,n=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,15626441722e-18,-85238095915e-18,6529054439e-18,5059343495e-18,-991364156e-18,-227365122e-18,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18];let m=0,l=0,a;for(let f=n.length-1;f>0;f--)a=l,l=r*l-m+n[f],m=a;const c=s*Math.exp(-i*i+.5*(n[0]+r*l)-m);return t>=0?c:2-c}function q(t){return .5*x(-t/Math.SQRT2)}function R(t,i){if(!(i>0)||!Number.isFinite(t))return Number.NaN;const s=.5*Q(i/2,.5,i/(i+t*t));return t>0?1-s:s}function j(t,i){if(!(t>0)||!(t<1)||!(i>0))return Number.NaN;if(i>1e7)return U(t);let s=-1e4,r=1e4,n=U(t);const m=I(i/2)+I(.5)-I((i+1)/2);for(let l=0;l<60;l++){const a=R(n,i);a<t?s=n:r=n;const c=Math.exp(-((i+1)/2)*Math.log(1+n*n/i)-m)/Math.sqrt(i),f=c>0?(a-t)/c:0;if(Math.abs(f)<1e-12)break;const p=n-f;if(n=p>s&&p<r&&Number.isFinite(p)?p:(s+r)/2,r-s<1e-12)break}return n}function k(t,i){let s=t,r=1/t,n=r;for(let m=0;m<300&&(s+=1,n*=i/s,r+=n,!(Math.abs(n)<Math.abs(r)*E));m++);return r*Math.exp(-i+t*Math.log(i)-I(t))}function b(t,i){let s=i+1-t,r=1/K,n=1/s,m=n;for(let l=1;l<=300;l++){const a=-l*(l-t);s+=2,n=a*n+s,Math.abs(n)<K&&(n=K),r=s+a/r,Math.abs(r)<K&&(r=K),n=1/n;const c=n*r;if(m*=c,Math.abs(c-1)<E)break}return Math.exp(-i+t*Math.log(i)-I(t))*m}function u(t,i){return!(t>0)||!(i>=0)||!Number.isFinite(i)?Number.NaN:i===0?0:i<t+1?k(t,i):1-b(t,i)}function g(t,i){return i>0?u(i/2,t/2):Number.NaN}function o(t,i){const s=g(t,i);return Number.isNaN(s)?Number.NaN:Math.min(1,Math.max(0,1-s))}}),_e("packages/core/src/compute/linalg.js",function(e,F){"use strict";Object.defineProperty(e,"cholesky",{enumerable:!0,get:function(){return ie}}),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 I}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return Q}});function ie(U){const x=U.length,q=Array.from({length:x},()=>new Array(x).fill(0));for(let R=0;R<x;R++)for(let j=0;j<=R;j++){let k=U[R][j];for(let b=0;b<j;b++)k-=q[R][b]*q[j][b];if(R===j){if(!(k>0))return null;q[R][j]=Math.sqrt(k)}else q[R][j]=k/q[j][j]}return q}function E(U,x){const q=U.length,R=new Array(q).fill(0);for(let k=0;k<q;k++){let b=x[k];for(let u=0;u<k;u++)b-=U[k][u]*R[u];R[k]=b/U[k][k]}const j=new Array(q).fill(0);for(let k=q-1;k>=0;k--){let b=R[k];for(let u=k+1;u<q;u++)b-=U[u][k]*j[u];j[k]=b/U[k][k]}return j}function K(U){const x=U.length,q=Array.from({length:x},()=>new Array(x).fill(0));for(let R=0;R<x;R++){const j=new Array(x).fill(0);j[R]=1;const k=E(U,j);for(let b=0;b<x;b++)q[b][R]=k[b]}return q}function I(U,x,q){const R=U.length,j=R?U[0].length:0,k=Array.from({length:j},()=>new Array(j).fill(0)),b=new Array(j).fill(0);for(let u=0;u<R;u++){const g=q?q[u]:1,o=U[u];for(let t=0;t<j;t++){const i=g*o[t];b[t]+=i*x[u];for(let s=t;s<j;s++)k[t][s]+=i*o[s]}}for(let u=0;u<j;u++)for(let g=0;g<u;g++)k[u][g]=k[g][u];return{xtwx:k,xtwy:b}}function L(U,x){return U.map(q=>q.reduce((R,j,k)=>R+j*x[k],0))}function Q(U,x){let q=0;for(let R=0;R<U.length;R++){let j=0;for(let k=0;k<U.length;k++)j+=x[R][k]*U[k];q+=U[R]*j}return q}}),_e("packages/core/src/compute/sketch.js",function(e,F){"use strict";Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return k}});class ie{#e=0;#t=0;#n=0;static get errorBound(){return Object.freeze({kind:"exact",metric:"none",value:0,statement:"mean and variance match a full recompute to float rounding"})}get count(){return this.#e}add(u){if(!Number.isFinite(u))return;this.#e++;const g=u-this.#t;this.#t+=g/this.#e,this.#n+=g*(u-this.#t)}merge(u){if(u.#e===0)return;if(this.#e===0){this.#e=u.#e,this.#t=u.#t,this.#n=u.#n;return}const g=this.#e+u.#e,o=u.#t-this.#t;this.#t+=o*(u.#e/g),this.#n+=u.#n+o*o*(this.#e*u.#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 u=this.variance();return u===null?null:Math.sqrt(u)}stddevP(){const u=this.varianceP();return u===null?null:Math.sqrt(u)}}class E{#e=[];#t=0;#n;#r;constructor(u,g=Math.random){if(!(u>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(u),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(u){if(!Number.isFinite(u))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(u);return}const g=Math.floor(this.#r()*this.#t);g<this.#n&&(this.#e[g]=u)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let u=0;for(const g of this.#e)u+=g;return u/this.#e.length}quantile(u){const g=this.#e.length;if(!g)return null;const o=this.#e.slice().sort((r,n)=>r-n);if(g===1)return o[0];const t=(g-1)*Math.min(1,Math.max(0,u)),i=Math.floor(t),s=Math.ceil(t);return i===s?o[i]:o[i]+(t-i)*(o[s]-o[i])}}function K(b){return b^=b>>>16,b=Math.imul(b,2246822507),b^=b>>>13,b=Math.imul(b,3266489909),b^=b>>>15,b>>>0}function I(b){if(typeof b=="number"){const o=new DataView(new ArrayBuffer(8));return o.setFloat64(0,b===0?0:b),K(o.getUint32(0)^o.getUint32(4))}const u=typeof b=="string"?b:String(b);let g=2166136261;for(let o=0;o<u.length;o++)g^=u.charCodeAt(o),g=Math.imul(g,16777619);return K(g)}class L{#e;#t;#n;constructor(u=14){const g=Math.floor(u);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(u=14){const g=1<<Math.floor(u),o=1.04/Math.sqrt(g);return Object.freeze({kind:"probabilistic",metric:"relative",value:o,statement:`distinct count within ~${(o*100).toFixed(2)}% relative standard error (m=${g} buckets)`})}errorBound(){return L.errorBoundFor(this.#e)}add(u){const g=I(u),o=g&this.#t-1,t=g>>>this.#e|1<<32-this.#e;let i=1,s=t;for(;(s&1)===0;)i++,s>>>=1;i>this.#n[o]&&(this.#n[o]=i)}count(){const u=this.#t,g=32-this.#e,o=new Float64Array(g+2);for(let s=0;s<u;s++)o[this.#n[s]]++;let t=u*x(1-o[g+1]/u);for(let s=g;s>=1;s--)t=.5*(t+o[s]);t+=u*U(o[0]/u);const i=Q*u*u/t;return Math.round(i)}}const Q=.5/Math.log(2);function U(b){if(b===1)return 1/0;let u=1,g=b,o;do b*=b,o=g,g+=b*u,u+=u;while(g!==o);return g}function x(b){if(b===0||b===1)return 0;let u=1,g=1-b,o;do b=Math.sqrt(b),o=g,u*=.5,g-=(1-b)**2*u;while(g!==o);return g/3}class q{#e=new Map;#t;#n=0;constructor(u){if(!(u>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(u)}errorBoundFor(u){const g=u/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=${u}, m=${this.#t})`})}get seen(){return this.#n}add(u){this.#n++;const g=this.#e.get(u);if(g){g.count++;return}if(this.#e.size<this.#t){this.#e.set(u,{count:1,error:0});return}let o,t=1/0;for(const[i,s]of this.#e)s.count<t&&(t=s.count,o=i);this.#e.delete(o),this.#e.set(u,{count:t+1,error:t})}top(u=this.#t){return[...this.#e.entries()].map(([o,t])=>({item:o,count:t.count,error:t.error})).sort((o,t)=>t.count-o.count).slice(0,Math.max(0,Math.floor(u)))}}class R{#e;#t=[[]];#n=0;#r;#i;constructor(u=200,g=Math.random){this.#e=Math.max(8,Math.floor(u)),this.#r=g,this.#i=2/3}static errorBoundFor(u=200){const g=1/Math.max(8,Math.floor(u));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=${u})`})}errorBound(){return R.errorBoundFor(this.#e)}get count(){return this.#n}#s(u){const o=this.#t.length-1-u,t=Math.ceil(this.#e*this.#i**o);return Math.max(2,t)}add(u){Number.isFinite(u)&&(this.#n++,this.#t[0].push(u),this.#t[0].length>=this.#s(0)&&this.#a(0))}#a(u){const g=this.#t[u];g.sort((i,s)=>i-s),u+1>=this.#t.length&&this.#t.push([]);const o=this.#t[u+1],t=this.#r()<.5?0:1;for(let i=t;i<g.length;i+=2)o.push(g[i]);this.#t[u]=[];for(let i=0;i<this.#t.length;i++)if(this.#t[i].length>=this.#s(i)){this.#a(i);return}}#l(){const u=[];for(let g=0;g<this.#t.length;g++){const o=1<<g;for(const t of this.#t[g])u.push({v:t,w:o})}return u}quantile(u){const g=this.#l();if(!g.length)return null;g.sort((s,r)=>s.v-r.v);let o=0;for(const s of g)o+=s.w;const t=Math.min(1,Math.max(0,u))*o;let i=0;for(const s of g)if(i+=s.w,i>=t)return s.v;return g[g.length-1].v}rank(u){let g=0;for(let o=0;o<this.#t.length;o++){const t=1<<o;for(const i of this.#t[o])i<=u&&(g+=t)}return g}}const j=Object.freeze({distinct:L.errorBoundFor(14),median:R.errorBoundFor(200),p25:R.errorBoundFor(200),p75:R.errorBoundFor(200),p90:R.errorBoundFor(200),p95:R.errorBoundFor(200),p99:R.errorBoundFor(200),iqr:R.errorBoundFor(200),topK:Object.freeze({kind:"deterministic",metric:"absolute",value:0,statement:"each count overestimates the truth by at most N/m; top-K exact when the K-th item exceeds N/m"})}),k={Welford:ie,Reservoir:E,HyperLogLog:L,SpaceSaving:q,KLL:R,hash32:I,SKETCH_BOUNDS:j}}),_e("packages/core/src/compute/statistics.js",function(e,F){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"numbers",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"frequencies",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"herfindahl",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"entropy",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"evenness",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"topShare",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"gini",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"moments",{enumerable:!0,get:function(){return d}}),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 W}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"modifiedZOutliers",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"jarqueBera",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"weightedQuantile",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"covariance",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(e,"autocorrelations",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"spearman",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"kendall",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(e,"seriesStats",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(e,"D2_N2",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"D4_N2",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"movingRanges",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"withinSigma",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return He}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"countOutside",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(e,"histogram",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(e,"DEFAULT_CONFIDENCE",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(e,"meanInterval",{enumerable:!0,get:function(){return et}}),Object.defineProperty(e,"proportionInterval",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(e,"slopeInterval",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(e,"capabilityInterval",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(e,"standardizedMeanDifference",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(e,"normalTotalVariation",{enumerable:!0,get:function(){return st}}),Object.defineProperty(e,"frequencyMap",{enumerable:!0,get:function(){return it}}),Object.defineProperty(e,"categoricalDistance",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(e,"SUBSET_RELIABILITY_FLOOR",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(e,"compareColumn",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(e,"isNumericColumn",{enumerable:!0,get:function(){return It}}),Object.defineProperty(e,"populationRead",{enumerable:!0,get:function(){return ft}});const ie=F("packages/core/src/compute/handle.js"),E=ie.presenceReader,K=ie.valueReader,I=F("packages/core/src/compute/special.js"),L=I.studentTQuantile,Q=I.studentT,U=I.normalQuantile,x=I.normalCdf,q=I.chiSquareUpperTail,R=F("packages/core/src/compute/linalg.js"),j=R.cholesky,k=R.choleskySolve,b=R.choleskyInverse,u=R.normalEquations,g=R.quadForm,t=F("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,i=5e3,s=Object.freeze({variance:"rescan",varianceP:"rescan",stddev:"rescan",stddevP:"rescan",sumSquares:"rescan",weightedAvg:"rescan",median:"rescan",percentile:"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"}),r=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(ae){const me=ae==="sum"||ae==="avg"||ae==="countValues"||ae==="min"||ae==="max"?"maintained":Object.prototype.hasOwnProperty.call(s,ae)?s[ae]:null,be=Object.prototype.hasOwnProperty.call(r,ae)?r[ae]:null;return{stat:ae,exact:me,approximate:be}}function m(ae,me){const be=me.length,je=new Float64Array(be);let Ne=0;if(ae&&(ae.kind==="float64"||ae.kind==="int32")){const De=ae.values,Ge=E(ae);for(let Ve=0;Ve<be;Ve++){const Qe=me[Ve];if(Ge&&Ge(Qe)!==1)continue;const mt=De[Qe];Number.isNaN(mt)||(je[Ne++]=mt)}return je.subarray(0,Ne)}const ze=K(ae);for(let De=0;De<be;De++){const Ge=ze(me[De]);if(Ge==null||Ge==="")continue;const Ve=typeof Ge=="number"?Ge:Number(Ge);Number.isFinite(Ve)&&(je[Ne++]=Ve)}return je.subarray(0,Ne)}function l(ae,me){const be=new Map,je=K(ae);let Ne=0;for(let ze=0;ze<me.length;ze++){const De=je(me[ze]);if(De==null||De===""||typeof De=="number"&&Number.isNaN(De))continue;const Ge=typeof De=="object"?String(De):De;be.set(Ge,(be.get(Ge)||0)+1),Ne++}const Re=[...be.values()].sort((ze,De)=>De-ze);return{counts:Re,total:Ne,distinct:Re.length}}function a(ae){return ae.total>0?ae.counts.map(me=>me/ae.total):[]}function c(ae,me){const be=l(ae,me);if(!be.total)return null;let je=0;for(const Ne of a(be))je+=Ne*Ne;return je}function f(ae,me){const be=l(ae,me);if(!be.total)return null;let je=0;for(const Ne of a(be))Ne>0&&(je-=Ne*Math.log2(Ne));return je}function p(ae,me){const be=l(ae,me);if(!be.total||be.distinct<2)return be.total?1:null;let je=0;for(const Ne of a(be))Ne>0&&(je-=Ne*Math.log2(Ne));return je/Math.log2(be.distinct)}function y(ae,me,be=3){const je=l(ae,me);if(!je.total)return null;const Ne=Math.max(1,Math.floor(be));let Re=0;for(let ze=0;ze<Math.min(Ne,je.counts.length);ze++)Re+=je.counts[ze];return Re/je.total}function h(ae,me){const be=m(ae,me),je=be.length;if(!je)return null;const Ne=be.slice().sort();if(Ne[0]<0)return null;let Re=0,ze=0;for(let De=0;De<je;De++)Re+=Ne[De],ze+=(De+1)*Ne[De];return Re===0?0:2*ze/(je*Re)-(je+1)/je}function d(ae){let me=0,be=0,je=0;for(let Ne=0;Ne<ae.length;Ne++){const Re=ae[Ne];me++;const ze=Re-be;be+=ze/me,je+=ze*(Re-be)}return{n:me,mean:be,m2:je}}function w(ae,me){const be=ae.length;if(!be)return NaN;if(be===1)return ae[0];const je=(be-1)*Math.min(1,Math.max(0,me)),Ne=Math.floor(je),Re=Math.ceil(je);return Ne===Re?ae[Ne]:ae[Ne]+(je-Ne)*(ae[Re]-ae[Ne])}function v(ae,me){if(!ae.length)return NaN;const be=ae.slice().sort();return w(be,me)}function P(ae,me){const be=K(ae);let je=0,Ne=0,Re=0;for(let ze=0;ze<me.length;ze++){const De=be(me[ze]);if(De==null||De==="")continue;const Ge=String(De).toUpperCase();Ge==="PASS"?je++:Ge==="FAIL"?Ne++:Ge==="WARN"&&Re++}return{pass:je+Re,fail:Ne,warn:Re,judged:je+Re+Ne}}const W=Object.freeze({hhi:(ae,me)=>c(ae,me),entropy:(ae,me)=>f(ae,me),evenness:(ae,me)=>p(ae,me),top3Share:(ae,me)=>y(ae,me,3),top10Share:(ae,me)=>y(ae,me,10),gini:(ae,me)=>h(ae,me),trimmedMean:(ae,me)=>S(m(ae,me),.1),winsorizedMean:(ae,me)=>O(m(ae,me),.1),robustOutliers:(ae,me)=>M(m(ae,me),3.5),jarqueBera:(ae,me)=>A(m(ae,me)),variance:(ae,me)=>{const{n:be,m2:je}=d(m(ae,me));return be>1?je/(be-1):null},varianceP:(ae,me)=>{const{n:be,m2:je}=d(m(ae,me));return be>0?je/be:null},stddev:(ae,me)=>{const{n:be,m2:je}=d(m(ae,me));return be>1?Math.sqrt(je/(be-1)):null},stddevP:(ae,me)=>{const{n:be,m2:je}=d(m(ae,me));return be>0?Math.sqrt(je/be):null},median:(ae,me)=>{const be=m(ae,me);return be.length?v(be,.5):null},percentile:(ae,me,be)=>{const je=be?be.p:void 0;if(typeof je!="number"||!(je>=0&&je<=1))return null;const Ne=m(ae,me);return Ne.length?v(Ne,je):null},p25:(ae,me)=>{const be=m(ae,me);return be.length?v(be,.25):null},p75:(ae,me)=>{const be=m(ae,me);return be.length?v(be,.75):null},p90:(ae,me)=>{const be=m(ae,me);return be.length?v(be,.9):null},p95:(ae,me)=>{const be=m(ae,me);return be.length?v(be,.95):null},p99:(ae,me)=>{const be=m(ae,me);return be.length?v(be,.99):null},iqr:(ae,me)=>{const be=m(ae,me);if(!be.length)return null;const je=be.slice().sort();return w(je,.75)-w(je,.25)},mad:(ae,me)=>{const be=m(ae,me);if(!be.length)return null;const je=v(be,.5),Ne=new Float64Array(be.length);for(let Re=0;Re<be.length;Re++)Ne[Re]=Math.abs(be[Re]-je);return v(Ne,.5)},range:(ae,me)=>{const be=m(ae,me);if(!be.length)return null;let je=1/0,Ne=-1/0;for(let Re=0;Re<be.length;Re++)be[Re]<je&&(je=be[Re]),be[Re]>Ne&&(Ne=be[Re]);return Ne-je},distinct:(ae,me)=>{const be=K(ae),je=new Set;for(let Ne=0;Ne<me.length;Ne++){const Re=be(me[Ne]);Re==null||Re===""||je.add(Re instanceof Date?Re.getTime():Re)}return je.size},mode:(ae,me)=>{const be=K(ae),je=new Map;for(let ze=0;ze<me.length;ze++){const De=be(me[ze]);if(De==null||De==="")continue;const Ge=De instanceof Date?De.getTime():De;je.set(Ge,(je.get(Ge)||0)+1)}let Ne=null,Re=1;for(const[ze,De]of je)De>Re&&(Re=De,Ne=ze);return Ne},skewness:(ae,me)=>{const be=m(ae,me),{n:je,mean:Ne,m2:Re}=d(be);if(je<3||Re<=0)return null;const ze=Math.sqrt(Re/(je-1));let De=0;for(let Ge=0;Ge<be.length;Ge++)De+=((be[Ge]-Ne)/ze)**3;return je/((je-1)*(je-2))*De},kurtosis:(ae,me)=>{const be=m(ae,me),{n:je,mean:Ne,m2:Re}=d(be);if(je<4||Re<=0)return null;const ze=Math.sqrt(Re/(je-1));let De=0;for(let Qe=0;Qe<be.length;Qe++)De+=((be[Qe]-Ne)/ze)**4;const Ge=je*(je+1)/((je-1)*(je-2)*(je-3)),Ve=3*(je-1)**2/((je-2)*(je-3));return Ge*De-Ve},geomean:(ae,me)=>{const be=m(ae,me);if(!be.length)return null;let je=0;for(let Ne=0;Ne<be.length;Ne++){if(be[Ne]<=0)return null;je+=Math.log(be[Ne])}return Math.exp(je/be.length)},harmean:(ae,me)=>{const be=m(ae,me);if(!be.length)return null;let je=0;for(let Ne=0;Ne<be.length;Ne++){if(be[Ne]===0)return null;je+=1/be[Ne]}return be.length/je},sumSquares:(ae,me)=>{const be=m(ae,me);let je=0;for(let Ne=0;Ne<be.length;Ne++)je+=be[Ne]*be[Ne];return je},passRate:(ae,me)=>{const{pass:be,judged:je}=P(ae,me);return je?be/je:null},failureCount:(ae,me)=>P(ae,me).fail}),V=Object.freeze({hhi:"Concentration (HHI)",entropy:"Entropy",evenness:"Evenness",top3Share:"Top 3 share",top10Share:"Top 10 share",gini:"Gini coefficient",trimmedMean:"Trimmed mean",winsorizedMean:"Winsorized mean",robustOutliers:"Outliers (robust)",jarqueBera:"Jarque–Bera",median:"Median",percentile:"Percentile",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 G(ae,me,be){const je=K(ae),Ne=K(me);let Re=0,ze=0;for(let De=0;De<be.length;De++){const Ge=be[De],Ve=Number(je(Ge)),Qe=Number(Ne(Ge));!Number.isFinite(Ve)||!Number.isFinite(Qe)||(Re+=Ve*Qe,ze+=Qe)}return ze===0?null:Re/ze}function _(ae,me,be){const je=K(ae);let Ne=null,Re=be?-1/0:1/0;for(let ze=0;ze<me.length;ze++){const De=me[ze],Ge=Number(je(De));Number.isFinite(Ge)&&(be?Ge>Re:Ge<Re)&&(Re=Ge,Ne=De)}return Ne}function T(ae,me,be){const je=K(ae),Ne=K(me);let Re=0,ze=0,De=0,Ge=0,Ve=0,Qe=0;for(let dt=0;dt<be.length;dt++){const jt=be[dt],xt=Number(je(jt)),At=Number(Ne(jt));!Number.isFinite(xt)||!Number.isFinite(At)||(Re++,ze+=xt,De+=At,Ge+=xt*xt,Ve+=At*At,Qe+=xt*At)}if(Re<2)return null;const mt=Re*Qe-ze*De,Ot=Math.sqrt((Re*Ge-ze*ze)*(Re*Ve-De*De));if(Ot===0)return null;const gt=mt/Ot;return Math.max(-1,Math.min(1,gt))}function S(ae,me=.1){const be=ae.length;if(!be)return null;const je=Array.from(ae).sort((De,Ge)=>De-Ge),Ne=Math.floor(be*Math.min(.49,Math.max(0,me))),Re=je.slice(Ne,be-Ne);if(!Re.length)return w(je,.5);let ze=0;for(const De of Re)ze+=De;return ze/Re.length}function O(ae,me=.1){const be=ae.length;if(!be)return null;const je=Array.from(ae).sort((Ge,Ve)=>Ge-Ve),Ne=Math.floor(be*Math.min(.49,Math.max(0,me))),Re=je[Ne],ze=je[be-1-Ne];let De=0;for(const Ge of je)De+=Math.min(ze,Math.max(Re,Ge));return De/be}function M(ae,me=3.5){if(!ae.length)return null;const je=Array.from(ae).sort((Ge,Ve)=>Ge-Ve),Ne=w(je,.5),Re=je.map(Ge=>Math.abs(Ge-Ne)).sort((Ge,Ve)=>Ge-Ve),ze=w(Re,.5);if(ze===0)return null;let De=0;for(const Ge of je)Math.abs(.6745*(Ge-Ne)/ze)>me&&De++;return De}function A(ae){const me=ae.length;if(me<8)return null;let be=0;for(const Ge of ae)be+=Ge;be/=me;let je=0,Ne=0,Re=0;for(const Ge of ae){const Ve=Ge-be;je+=Ve*Ve,Ne+=Ve*Ve*Ve,Re+=Ve*Ve*Ve*Ve}if(je/=me,Ne/=me,Re/=me,je===0)return null;const ze=Ne/je**1.5,De=Re/(je*je)-3;return me/6*(ze*ze+De*De/4)}function N(ae,me,be){const je=[];let Ne=0;for(let Ge=0;Ge<ae.length;Ge++){const Ve=Number(ae[Ge]),Qe=Number(me[Ge]);!Number.isFinite(Ve)||!Number.isFinite(Qe)||Qe<=0||(je.push([Ve,Qe]),Ne+=Qe)}if(!je.length||Ne<=0)return null;if(je.sort((Ge,Ve)=>Ge[0]-Ve[0]),je.length===1)return je[0][0];const Re=[];let ze=0;for(const[,Ge]of je)Re.push((ze+Ge/2)/Ne),ze+=Ge;const De=Math.max(0,Math.min(1,be));if(De<=Re[0])return je[0][0];if(De>=Re[Re.length-1])return je[je.length-1][0];for(let Ge=1;Ge<Re.length;Ge++){if(De>Re[Ge])continue;const Ve=Re[Ge]-Re[Ge-1],Qe=Ve>0?(De-Re[Ge-1])/Ve:0;return je[Ge-1][0]+(je[Ge][0]-je[Ge-1][0])*Qe}return je[je.length-1][0]}function $(ae,me,be){const je=K(ae),Ne=K(me),Re=new Float64Array(be.length),ze=new Float64Array(be.length);let De=0;for(let Ge=0;Ge<be.length;Ge++){const Ve=be[Ge],Qe=Number(je(Ve)),mt=Number(Ne(Ve));!Number.isFinite(Qe)||!Number.isFinite(mt)||(Re[De]=Qe,ze[De]=mt,De++)}return{xs:Re.subarray(0,De),ys:ze.subarray(0,De),n:De}}function H(ae,me,be,je=!1){const{xs:Ne,ys:Re,n:ze}=$(ae,me,be);if(ze<2)return null;let De=0,Ge=0;for(let Qe=0;Qe<ze;Qe++)De+=Ne[Qe],Ge+=Re[Qe];De/=ze,Ge/=ze;let Ve=0;for(let Qe=0;Qe<ze;Qe++)Ve+=(Ne[Qe]-De)*(Re[Qe]-Ge);return Ve/(je?ze:ze-1)}function Y(ae,me,be){const{xs:je,ys:Ne,n:Re}=$(ae,me,be);if(Re<2)return null;let ze=0,De=0;for(let xt=0;xt<Re;xt++)ze+=je[xt],De+=Ne[xt];ze/=Re,De/=Re;let Ge=0,Ve=0,Qe=0;for(let xt=0;xt<Re;xt++){const At=je[xt]-ze,Bt=Ne[xt]-De;Ge+=At*At,Ve+=At*Bt,Qe+=Bt*Bt}if(Ge===0)return null;const mt=Ve/Ge,Ot=De-mt*ze,gt=Qe===0?1:Math.max(0,Math.min(1,Ve*Ve/(Ge*Qe))),dt=Math.max(0,Qe-mt*Ve),jt=Re>2?Math.sqrt(dt/(Re-2)/Ge):0;return{slope:mt,intercept:Ot,r2:gt,stdError:jt,n:Re}}const Z=new Set(["ols","wls","robust"]),J=new Set(["quantile"]),D=new Set(["ridge","lasso","elasticnet","mixed","gls"]),te=1.345;function z(ae,me,be){const{xtwx:je,xtwy:Ne}=u(ae,me,be),Re=j(je);if(!Re)return null;const ze=k(Re,Ne),De=b(Re),Ge=X(ae,ze),Ve=me.map((Qe,mt)=>Qe-Ge[mt]);return{beta:ze,cov:De,fitted:Ge,residuals:Ve}}function X(ae,me){return ae.map(be=>be.reduce((je,Ne,Re)=>je+Ne*me[Re],0))}function ne(ae,me){const be=ae.length,je=ae.map(Ve=>Ve[me]),Ne=ae.map(Ve=>[1,...Ve.filter((Qe,mt)=>mt!==me)]),Re=z(Ne,je,null);if(!Re)return 1;const ze=je.reduce((Ve,Qe)=>Ve+Qe,0)/be;let De=0,Ge=0;for(let Ve=0;Ve<be;Ve++)De+=Re.residuals[Ve]**2,Ge+=(je[Ve]-ze)**2;return Ge===0?1:Math.max(0,Math.min(1,1-De/Ge))}function se(ae){const me=[...ae].sort((Ne,Re)=>Ne-Re),be=ue(me),je=ae.map(Ne=>Math.abs(Ne-be)).sort((Ne,Re)=>Ne-Re);return ue(je)/.6745}function ue(ae){const me=ae.length;if(!me)return 0;const be=Math.floor(me/2);return me%2?ae[be]:(ae[be-1]+ae[be])/2}function ge(ae,me,be={}){const je=be.method||"ols";if(D.has(je))throw new Error(`[lattice] regression method "${je}" is out of scope; use ols, wls or robust.`);if(J.has(je))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!Z.has(je))throw new Error(`[lattice] unknown regression method "${je}"; use ols, wls or robust.`);const Ne=Array.isArray(me)?me.length:0,Re=Ne&&Array.isArray(ae[0])?ae[0].length:0,ze=Re+1;if(!(Ne>ze))return null;for(let St=0;St<Ne;St++){if(!Number.isFinite(me[St])||!Array.isArray(ae[St])||ae[St].length!==Re)return null;for(let Mt=0;Mt<Re;Mt++)if(!Number.isFinite(ae[St][Mt]))return null}let De=null;if(je==="wls"){if(De=be.weights,!Array.isArray(De)||De.length!==Ne)return null;for(let St=0;St<Ne;St++)if(!(De[St]>0)||!Number.isFinite(De[St]))return null}const Ge=ae.map(St=>[1,...St]);let Ve,Qe=null;if(je==="robust"){if(Ve=z(Ge,me,null),!Ve)return null;for(let St=0;St<50;St++){const Mt=se(Ve.residuals);if(!(Mt>0))break;const Wt=Ve.residuals.map(Ht=>{const Gt=Math.abs(Ht/Mt);return Gt<=te?1:te/Gt}),_t=z(Ge,me,Wt);if(!_t)return null;const zt=_t.beta.reduce((Ht,Gt,Dt)=>Math.max(Ht,Math.abs(Gt-Ve.beta[Dt])),0);if(Ve=_t,Qe=Wt,zt<1e-10)break}}else if(Ve=z(Ge,me,De),!Ve)return null;const mt=je==="robust"?Qe:De,{beta:Ot,cov:gt,fitted:dt,residuals:jt}=Ve;let xt=0,At=0,Bt=0;for(let St=0;St<Ne;St++){const Mt=mt?mt[St]:1;xt+=Mt*jt[St]**2,At+=Mt,Bt+=Mt*me[St]}const nn=Bt/At;let Vt=0;for(let St=0;St<Ne;St++){const Mt=mt?mt[St]:1;Vt+=Mt*(me[St]-nn)**2}const Zt=Ne-ze,Xe=xt/Zt,ot=Vt===0?1:Math.max(0,Math.min(1,1-xt/Vt)),vt=1-(1-ot)*(Ne-1)/Zt,pt=Array.isArray(be.names)&&be.names.length===Re?be.names:ae[0].map((St,Mt)=>`x${Mt+1}`),yt=Ke(be.confidence),We=Zt>0?L(1-(1-yt)/2,Zt):1/0,at=Ot.map((St,Mt)=>{const Wt=Math.sqrt(Math.max(0,Xe*gt[Mt][Mt])),_t=Wt>0?St/Wt:St===0?0:1/0,zt=Number.isFinite(_t)?2*(1-Q(Math.abs(_t),Zt)):0,Ht=Number.isFinite(We)?We*Wt:null;return{name:Mt===0?"(intercept)":pt[Mt-1],estimate:St,stdError:Wt,t:_t,p:Math.max(0,Math.min(1,zt)),lower:Ht===null?null:St-Ht,upper:Ht===null?null:St+Ht}}),rt=new Array(Ne),lt=new Array(Ne);for(let St=0;St<Ne;St++){const Mt=mt?mt[St]:1,Wt=Math.max(0,Math.min(1,Mt*g(Ge[St],gt)));rt[St]=Wt;const _t=(1-Wt)**2;lt[St]=_t>0&&Xe>0?jt[St]**2/(ze*Xe)*(Wt/_t):null}const Rt=ae[0].map((St,Mt)=>{if(Re<2)return 1;const Wt=ne(ae,Mt);return Wt>=1?1/0:1/(1-Wt)});let Lt=null;{const St=jt.map(Wt=>Wt*Wt),Mt=z(Ge,St,null);if(Mt){const Wt=St.reduce((Qt,ln)=>Qt+ln,0)/Ne;let _t=0,zt=0;for(let Qt=0;Qt<Ne;Qt++)_t+=Mt.residuals[Qt]**2,zt+=(St[Qt]-Wt)**2;const Ht=zt===0?0:Math.max(0,Math.min(1,1-_t/zt)),Gt=Ne*Ht,Dt=q(Gt,Re);Lt={statistic:Gt,df:Re,p:Dt,heteroscedastic:Dt<.05}}}let bt=null;if(Re===1){const St=ae.map((Mt,Wt)=>Wt).sort((Mt,Wt)=>ae[Mt][0]-ae[Wt][0]);bt={confidence:yt,points:St.map(Mt=>{const Wt=Ge[Mt],_t=Math.sqrt(Math.max(0,Xe*g(Wt,gt)));return{x:ae[Mt][0],yhat:dt[Mt],lower:dt[Mt]-We*_t,upper:dt[Mt]+We*_t}})}}return{method:je,coefficients:at,r2:ot,adjR2:vt,n:Ne,df:Zt,sigma2:Xe,fitted:dt,residuals:jt,leverage:rt,cooksD:lt,vif:Rt,heteroscedasticity:Lt,band:bt,weights:mt?[...mt]:null}}function Oe(ae){const me=ae.length,be=Array.from({length:me},(Re,ze)=>ze).sort((Re,ze)=>ae[Re]-ae[ze]),je=new Float64Array(me);let Ne=0;for(;Ne<me;){let Re=Ne;for(;Re+1<me&&ae[be[Re+1]]===ae[be[Ne]];)Re++;const ze=(Ne+Re)/2+1;for(let De=Ne;De<=Re;De++)je[be[De]]=ze;Ne=Re+1}return je}const Pe=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function Ie(ae){const me=[.01,.05,.1],be=[Pe["1%"],Pe["5%"],Pe["10%"]];if(ae<=be[0]){const Re=(Math.log(me[1])-Math.log(me[0]))/(be[1]-be[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(me[0])+Re*(ae-be[0]))))}if(ae>=be[2]){const Re=(Math.log(me[2])-Math.log(me[1]))/(be[2]-be[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(me[2])+Re*(ae-be[2]))))}const je=ae<be[1]?0:1,Ne=(ae-be[je])/(be[je+1]-be[je]);return Math.exp(Math.log(me[je])+Ne*(Math.log(me[je+1])-Math.log(me[je])))}function xe(ae,me,be,je){const Ne=be-je,Re=je+3,ze=new Array(Ne),De=new Array(Ne);let Ge=!0,Ve=je;for(let dt=0;dt<Ne;dt++){const jt=je+dt,xt=new Float64Array(Re);xt[0]=1,xt[1]=dt+1,xt[2]=ae[jt];for(let At=1;At<=je;At++)xt[2+At]=me[jt-At];for(let At=1;At<Re;At++)Number.isFinite(xt[At])||(Ve=Math.min(Ve,At-3));ze[dt]=xt,De[dt]=me[jt],Number.isFinite(De[dt])||(Ge=!1)}if(!Ge)return 0;const{xtwx:Qe,xtwy:mt}=u(ze,De,null);let Ot=0,gt=1/0;for(let dt=0;dt<=Ve;dt++){const jt=dt+3;if(!(Ne>jt))continue;const xt=new Array(jt);for(let ot=0;ot<jt;ot++)xt[ot]=Qe[ot].slice(0,jt);const At=j(xt);if(!At)continue;const Bt=k(At,mt.slice(0,jt));let nn=0;for(let ot=0;ot<Ne;ot++){const vt=ze[ot];let pt=0;for(let yt=0;yt<jt;yt++)pt+=vt[yt]*Bt[yt];nn+=(De[ot]-pt)**2}const Zt=nn/(Ne-jt)*(Ne-jt);if(!(Zt>0))continue;const Xe=Ne*Math.log(Zt/Ne)+2*jt;Xe<gt&&(gt=Xe,Ot=dt)}return Ot}function ye(ae,me={}){const be=[];for(let gt=0;gt<ae.length;gt++){const dt=Number(ae[gt]);Number.isFinite(dt)&&be.push(dt)}const je=be.length,Ne=je-1;if(je<8||Ne<6)return null;const Re=new Array(Ne);for(let gt=0;gt<Ne;gt++)Re[gt]=be[gt+1]-be[gt];let ze=Number.isFinite(me.maxlag)?Math.floor(me.maxlag):Math.ceil(12*(je/100)**.25);ze=Math.max(0,Math.min(ze,Math.floor((Ne-5)/2)));const De=(gt,dt)=>{const jt=[],xt=[];for(let At=dt;At<Ne;At++){const Bt=[At-dt+1,be[At]];for(let nn=1;nn<=gt;nn++)Bt.push(Re[At-nn]);jt.push(Bt),xt.push(Re[At])}return ge(jt,xt,{method:"ols"})},Ge=xe(be,Re,Ne,ze),Ve=De(Ge,Ge);if(!Ve||!Ve.coefficients[2])return null;const Qe=Ve.coefficients[2].t,mt=Ie(Qe),Ot=Qe<Pe["5%"];return{statistic:Qe,usedLag:Ge,nobs:Ne-Ge,criticalValues:{...Pe},pValue:mt,pApproximate:!0,stationary:Ot,verdict:Ot?"stationary":"non-stationary",regression:"ct"}}function re(ae,me={}){const be=[];for(let Ot=0;Ot<ae.length;Ot++){const gt=Number(ae[Ot]);Number.isFinite(gt)&&be.push(gt)}const je=be.length;if(je<3)return null;let Ne=Number.isFinite(me.maxlag)?Math.floor(me.maxlag):Math.min(10,je-1);Ne=Math.max(1,Math.min(Ne,je-1));let Re=0;for(const Ot of be)Re+=Ot;Re/=je;const ze=be.map(Ot=>Ot-Re);let De=0;for(const Ot of ze)De+=Ot*Ot;De/=je;const Ge=new Array(Ne+1).fill(0);Ge[0]=1;for(let Ot=1;Ot<=Ne;Ot++){let gt=0;for(let dt=Ot;dt<je;dt++)gt+=ze[dt]*ze[dt-Ot];Ge[Ot]=De>0?gt/je/De:0}const Ve=new Array(Ne+1).fill(0);Ve[0]=1;let Qe=[];for(let Ot=1;Ot<=Ne;Ot++){let gt=Ge[Ot];for(let At=1;At<Ot;At++)gt-=Qe[At-1]*Ge[Ot-At];let dt=1;for(let At=1;At<Ot;At++)dt-=Qe[At-1]*Ge[At];const jt=dt!==0?gt/dt:0,xt=new Array(Ot);for(let At=1;At<Ot;At++)xt[At-1]=Qe[At-1]-jt*Qe[Ot-1-At];xt[Ot-1]=jt,Ve[Ot]=jt,Qe=xt}const mt=1.96/Math.sqrt(je);return{acf:Ge,pacf:Ve,bounds:{upper:mt,lower:-mt},n:je,nlags:Ne,approximate:!0}}function fe(ae,me,be){const{xs:je,ys:Ne,n:Re}=$(ae,me,be);if(Re<2)return null;const ze=Oe(je),De=Oe(Ne);let Ge=0,Ve=0;for(let gt=0;gt<Re;gt++)Ge+=ze[gt],Ve+=De[gt];Ge/=Re,Ve/=Re;let Qe=0,mt=0,Ot=0;for(let gt=0;gt<Re;gt++){const dt=ze[gt]-Ge,jt=De[gt]-Ve;Qe+=dt*jt,mt+=dt*dt,Ot+=jt*jt}return mt===0||Ot===0?null:Math.max(-1,Math.min(1,Qe/Math.sqrt(mt*Ot)))}function oe(ae,me,be){const{xs:je,ys:Ne,n:Re}=$(ae,me,be);if(Re<2||Re>i)return null;let ze=0,De=0,Ge=0,Ve=0;for(let Ot=0;Ot<Re;Ot++)for(let gt=Ot+1;gt<Re;gt++){const dt=Math.sign(je[Ot]-je[gt]),jt=Math.sign(Ne[Ot]-Ne[gt]),xt=dt*jt;xt>0?ze++:xt<0?De++:dt===0&&jt===0||(dt===0?Ge++:Ve++)}const Qe=ze+De+Ve,mt=ze+De+Ge;return Qe===0||mt===0?null:(ze-De)/Math.sqrt(Qe*mt)}function ce(ae,me={}){const be=ae.length;if(be<2)return null;const je=ae[0],Ne=ae[be-1],Re=[];for(let At=1;At<be;At++){const Bt=ae[At-1];Bt!==0&&Re.push((ae[At]-Bt)/Math.abs(Bt))}let ze=null;if(Re.length>1){let At=0;for(const nn of Re)At+=nn;At/=Re.length;let Bt=0;for(const nn of Re)Bt+=(nn-At)**2;ze=Math.sqrt(Bt/(Re.length-1))}const De=Number(me.periodsPerYear)>0?Number(me.periodsPerYear):null;let Ge=ae[0],Ve=0,Qe=0,mt=0,Ot=0;for(let At=1;At<be;At++){if(ae[At]>Ge){Ge=ae[At],Ve=At;continue}if(Ge<=0)continue;const Bt=(Ge-ae[At])/Ge;Bt>Qe&&(Qe=Bt,mt=Ve,Ot=At)}let gt=null;if(be>2){let At=0;for(let Vt=0;Vt<be;Vt++)At+=ae[Vt];At/=be;let Bt=0,nn=0;for(let Vt=0;Vt<be;Vt++){const Zt=ae[Vt]-At;nn+=Zt*Zt,Vt>0&&(Bt+=Zt*(ae[Vt-1]-At))}gt=nn>0?Bt/nn:null}let dt=0,jt=0;for(const At of Re)At>0?dt++:At<0&&jt++;let xt=null;if(je>0&&Ne>0){const At=(Ne/je)**(1/(be-1))-1;xt=De?(1+At)**De-1:At}return{n:be,first:je,last:Ne,change:Ne-je,changePercent:je===0?null:(Ne-je)/Math.abs(je)*100,volatility:ze,annualisedVolatility:ze!==null&&De?ze*Math.sqrt(De):null,growth:xt,maxDrawdown:Qe,maxDrawdownFrom:mt,maxDrawdownTo:Ot,autocorrelation:gt,upDays:dt,downDays:jt}}const de=1.128,ve=3.267;function ke(ae){const me=ae.length;if(me<2)return null;const be=[];for(let Ne=1;Ne<me;Ne++)be.push(Math.abs(ae[Ne]-ae[Ne-1]));const je=be.reduce((Ne,Re)=>Ne+Re,0)/be.length;return{ranges:be,centre:je,upper:ve*je,lower:0}}function Ce(ae){const me=ae.length;if(me<2)return null;let be=0;for(let Ne=1;Ne<me;Ne++)be+=Math.abs(ae[Ne]-ae[Ne-1]);const je=be/(me-1);return{sigma:je/de,meanRange:je}}function Le(ae,me){const be=ae.length;if(be<2||!me)return null;const je=Number.isFinite(Number(me.lower))?Number(me.lower):null,Ne=Number.isFinite(Number(me.upper))?Number(me.upper):null;if(je===null&&Ne===null)return null;let Re=0;for(let dt=0;dt<be;dt++)Re+=ae[dt];Re/=be;let ze=0;for(let dt=0;dt<be;dt++)ze+=(ae[dt]-Re)**2;const De=Math.sqrt(ze/(be-1)),Ge=Ce(ae),Ve=Ge?Ge.sigma:null,Qe=dt=>{if(!dt||dt<=0)return{index:null,k:null};const xt=je!==null&&Ne!==null?(Ne-je)/(6*dt):null,At=Ne!==null?(Ne-Re)/(3*dt):1/0,Bt=je!==null?(Re-je)/(3*dt):1/0;return{index:xt,k:Math.min(At,Bt)}},mt=Qe(Ve),Ot=Qe(De);let gt=0;for(let dt=0;dt<be;dt++){if(je!==null&&ae[dt]<je){gt++;continue}Ne!==null&&ae[dt]>Ne&>++}return{n:be,mean:Re,lower:je,upper:Ne,target:Number.isFinite(Number(me.target))?Number(me.target):null,sigmaWithin:Ve,sigmaOverall:De,cp:mt.index,cpk:mt.k,pp:Ot.index,ppk:Ot.k,outOfSpec:gt,defectRate:be?gt/be:null}}function we(ae){const me=ae.length;if(me<2)return null;const be=Ce(ae);if(!be||!(be.sigma>0))return null;let je=0;for(let Ne=0;Ne<me;Ne++)je+=ae[Ne];return je/=me,{centre:je,sigma:be.sigma,upper:je+3*be.sigma,lower:je-3*be.sigma}}function He(ae,me){if(!me||!(me.sigma>0))return[];const be=ae.length,{centre:je,sigma:Ne}=me,Re=De=>(ae[De]-je)/Ne,ze=[];for(let De=0;De<be;De++){if(Math.abs(Re(De))>3&&ze.push({index:De,rule:1,description:"beyond three sigma"}),De>=2)for(const Ge of[1,-1]){let Ve=0;for(let Qe=De-2;Qe<=De;Qe++)Re(Qe)*Ge>2&&Ve++;if(Ve>=2){ze.push({index:De,rule:2,description:"two of three past two sigma"});break}}if(De>=4)for(const Ge of[1,-1]){let Ve=0;for(let Qe=De-4;Qe<=De;Qe++)Re(Qe)*Ge>1&&Ve++;if(Ve>=4){ze.push({index:De,rule:3,description:"four of five past one sigma"});break}}if(De>=7)for(const Ge of[1,-1]){let Ve=!0;for(let Qe=De-7;Qe<=De;Qe++)if(Re(Qe)*Ge<=0){Ve=!1;break}if(Ve){ze.push({index:De,rule:4,description:"eight in a row on one side"});break}}}return ze}function Te(ae,me){if(!me||!(me.sigma>0))return[];const be=ae.length,{centre:je,sigma:Ne}=me,Re=Ge=>(ae[Ge]-je)/Ne,ze=(Ge,Ve,Qe,mt)=>{for(const Ot of[1,-1]){let gt=0;for(let dt=Ge;dt<=Ve;dt++)Re(dt)*Ot>Qe&>++;if(gt>=mt)return!0}return!1},De=[];for(let Ge=0;Ge<be;Ge++){if(Math.abs(Re(Ge))>3&&De.push({index:Ge,rule:1,description:"beyond three sigma"}),Ge>=8)for(const Ve of[1,-1]){let Qe=!0;for(let mt=Ge-8;mt<=Ge;mt++)if(Re(mt)*Ve<=0){Qe=!1;break}if(Qe){De.push({index:Ge,rule:2,description:"nine in a row on one side"});break}}if(Ge>=5)for(const Ve of[1,-1]){let Qe=!0;for(let mt=Ge-4;mt<=Ge;mt++)if((ae[mt]-ae[mt-1])*Ve<=0){Qe=!1;break}if(Qe){De.push({index:Ge,rule:3,description:Ve>0?"six rising":"six falling"});break}}if(Ge>=13){let Ve=!0;for(let Qe=Ge-12;Qe<=Ge;Qe++){const mt=ae[Qe]-ae[Qe-1],Ot=ae[Qe+1<=Ge?Qe+1:Qe]-ae[Qe];if(Qe+1>Ge)break;if(mt===0||Ot===0||mt>0==Ot>0){Ve=!1;break}}Ve&&De.push({index:Ge,rule:4,description:"fourteen alternating"})}if(Ge>=2&&ze(Ge-2,Ge,2,2)&&De.push({index:Ge,rule:5,description:"two of three past two sigma"}),Ge>=4&&ze(Ge-4,Ge,1,4)&&De.push({index:Ge,rule:6,description:"four of five past one sigma"}),Ge>=14){let Ve=!0;for(let Qe=Ge-14;Qe<=Ge;Qe++)if(Math.abs(Re(Qe))>=1){Ve=!1;break}Ve&&De.push({index:Ge,rule:7,description:"fifteen within one sigma"})}if(Ge>=7){let Ve=!0;for(let Qe=Ge-7;Qe<=Ge;Qe++)if(Math.abs(Re(Qe))<=1){Ve=!1;break}Ve&&De.push({index:Ge,rule:8,description:"eight beyond one sigma"})}}return De}const Ae=Object.freeze(["westernElectric","nelson"]);function Se(ae,me,be="westernElectric"){return String(be)==="nelson"?Te(ae,me):He(ae,me)}function Ee(ae,me,be){let je=0;for(let Ne=0;Ne<ae.length;Ne++)(ae[Ne]<me||ae[Ne]>be)&&je++;return je}function Me(ae,me,be,je=20){const Ne=ae.length;if(!Ne)return[];const Re=ae[0],ze=ae[Ne-1];if(ze===Re)return[{from:Re,to:ze,count:Ne}];const De=be-me,Ge=1.5*De;let Ve=De>0?Math.max(Re,me-Ge):Re,Qe=De>0?Math.min(ze,be+Ge):ze;Qe>Ve||(Ve=Re,Qe=ze);const mt=De>0?2*De/Math.cbrt(Ne):(Qe-Ve)/(Math.ceil(Math.log2(Ne))+1),Ot=mt>0?Math.min(je,Math.max(1,Math.ceil((Qe-Ve)/mt))):1,gt=(Qe-Ve)/Ot,dt=[];for(let jt=0;jt<Ot;jt++)dt.push({from:Ve+jt*gt,to:Ve+(jt+1)*gt,count:0});for(let jt=0;jt<Ne;jt++){const xt=Math.min(Ot-1,Math.max(0,Math.floor((ae[jt]-Ve)/gt)));dt[xt].count++}return dt[0].from=Re,dt[Ot-1].to=ze,dt}const Be=.95;function Ke(ae){const me=Number(ae);return Number.isFinite(me)&&me>0&&me<1?me:Be}function et(ae,me=Be){const be=ae.length;if(be<2)return null;let je=0;for(let Qe=0;Qe<be;Qe++)je+=ae[Qe];const Ne=je/be;let Re=0;for(let Qe=0;Qe<be;Qe++){const mt=ae[Qe]-Ne;Re+=mt*mt}const ze=Math.sqrt(Re/(be-1)),De=Ke(me),Ve=L(1-(1-De)/2,be-1)*ze/Math.sqrt(be);return{mean:Ne,lower:Ne-Ve,upper:Ne+Ve,margin:Ve,n:be,confidence:De}}function Je(ae,me,be=Be){const je=Number(ae),Ne=Number(me);if(!(Ne>0)||!(je>=0)||je>Ne)return null;const Re=Ke(be),ze=U(1-(1-Re)/2),De=je/Ne,Ge=ze*ze,Ve=1+Ge/Ne,Qe=(De+Ge/(2*Ne))/Ve,mt=ze/Ve*Math.sqrt(De*(1-De)/Ne+Ge/(4*Ne*Ne));return{proportion:De,lower:Math.max(0,Qe-mt),upper:Math.min(1,Qe+mt),n:Ne,confidence:Re}}function ut(ae,me=Be){if(!ae||!(ae.n>2)||!Number.isFinite(ae.stdError))return null;const be=Ke(me),Ne=L(1-(1-be)/2,ae.n-2)*ae.stdError;return{slope:ae.slope,lower:ae.slope-Ne,upper:ae.slope+Ne,margin:Ne,confidence:be}}function Ct(ae,me,be=Be){const je=Number(ae),Ne=Number(me);if(!Number.isFinite(je)||!(Ne>1))return null;const Re=Ke(be),De=U(1-(1-Re)/2)*Math.sqrt(1/(9*Ne)+je*je/(2*(Ne-1)));return{index:je,lower:je-De,upper:je+De,margin:De,n:Ne,confidence:Re}}function Nt(ae,me){return!ae||!(ae.sd>0)||!Number.isFinite(me)||!Number.isFinite(ae.mean)?null:(me-ae.mean)/ae.sd}function st(ae){return Number.isFinite(ae)?Math.min(1,Math.max(0,2*x(Math.abs(ae)/2)-1)):0}function it(ae,me){const be=new Map,je=K(ae);let Ne=0;for(let Re=0;Re<me.length;Re++){const ze=je(me[Re]);if(ze==null||ze===""||typeof ze=="number"&&Number.isNaN(ze))continue;const De=ze instanceof Date?ze.getTime():typeof ze=="object"?String(ze):ze;be.set(De,(be.get(De)||0)+1),Ne++}return{map:be,total:Ne}}function ct(ae,me,be,je){if(!(me>0)||!(je>0))return null;let Ne=0;const Re=new Set(ae.keys());for(const ze of be.keys())Re.add(ze);for(const ze of Re){const De=(ae.get(ze)||0)/me,Ge=(be.get(ze)||0)/je;Ne+=Math.abs(De-Ge)}return Ne/2}const Tt=10;function $t(ae,me,be){if(be&&be.numeric){const De=m(ae,me),{n:Ge,mean:Ve}=d(De),Qe=Ge>0?Nt({mean:be.mean,sd:be.sd},Ve):null;return{measure:"standardizedMeanDifference",magnitude:Qe,distance:Qe===null?0:st(Qe),direction:Qe===null?0:Math.sign(Qe),subsetN:Ge,populationN:be.n||0,reliable:Ge>=Tt}}const{map:Ne,total:Re}=it(ae,me),ze=ct(Ne,Re,be.map,be.total);return{measure:"categoricalTotalVariation",magnitude:ze,distance:ze===null?0:ze,direction:0,subsetN:Re,populationN:be.total||0,reliable:Re>=Tt}}function It(ae,me){if(ae&&(ae.kind==="float64"||ae.kind==="int32"))return!0;const be=K(ae);let je=0,Ne=0;for(let Re=0;Re<me.length&&je<200;Re++){const ze=be(me[Re]);if(ze==null||ze==="")continue;if(ze instanceof Date)return!1;je++;const De=typeof ze=="number"?ze:Number(ze);Number.isFinite(De)&&Ne++}return je===0?!1:Ne/je>=.9}function ft(ae,me){if(It(ae,me)){const Ne=m(ae,me),{n:Re,mean:ze,m2:De}=d(Ne);return{numeric:!0,mean:ze,sd:Re>0?Math.sqrt(De/Re):0,n:Re}}const{map:be,total:je}=it(ae,me);return{numeric:!1,map:be,total:je}}}),_e("packages/core/src/compute/total.js",function(e,F){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"aggregatesFor",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"aggregateAllowed",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return d}});const E=F("packages/core/src/internal/predicates.js").isFunction,I=F("packages/core/src/internal/warn.js").warnOnce,L=F("packages/core/src/compute/handle.js"),Q=L.presenceReader,U=L.valueComparator,x=L.valueReader,q=F("packages/core/src/compute/statistics.js"),R=q.STAT_FNS,j=q.STAT_LABELS;function k(w){return!!w&&(w.kind==="float64"||w.kind==="int32")}function b(w,v){const P=v.length;let W=0;if(k(w)){const G=w.values,_=Q(w);if(!_){for(let T=0;T<P;T++){const S=G[v[T]];Number.isNaN(S)||(W+=S)}return W}for(let T=0;T<P;T++){const S=v[T];if(_(S)===1){const O=G[S];Number.isNaN(O)||(W+=O)}}return W}const V=x(w);for(let G=0;G<P;G++){const _=m(V(v[G]));_!==null&&(W+=_)}return W}b.kernel=!0;function u(w,v){const P=v.length;let W=0;if(k(w)){const G=w.values,_=Q(w);if(!_){for(let T=0;T<P;T++)Number.isNaN(G[v[T]])||W++;return W}for(let T=0;T<P;T++){const S=v[T];_(S)===1&&!Number.isNaN(G[S])&&W++}return W}const V=x(w);for(let G=0;G<P;G++){const _=V(v[G]);_!=null&&!(typeof _=="number"&&Number.isNaN(_))&&W++}return W}u.kernel=!0;function g(w,v){return v.length}g.kernel=!0;function o(w,v){const P=u(w,v);return P===0?null:b(w,v)/P}o.kernel=!0;function t(w,v,P,W){const V=v.length;if(k(w)){const S=w.values,O=Q(w);let M=null;if(!O){for(let A=0;A<V;A++){const N=S[v[A]];Number.isNaN(N)||(M===null||(P<0?N<M:N>M))&&(M=N)}return M}for(let A=0;A<V;A++){const N=v[A];if(O(N)===0)continue;const $=S[N];Number.isNaN($)||(M===null||(P<0?$<M:$>M))&&(M=$)}return M}const G=x(w),_=U(W);let T=null;for(let S=0;S<V;S++){const O=G(v[S]);O==null||typeof O=="number"&&Number.isNaN(O)||(T===null||(P<0?_(O,T)<0:_(O,T)>0))&&(T=O)}return T}function i(w,v,P){return t(w,v,-1,P&&P.locale)}i.kernel=!0;function s(w,v,P){return t(w,v,1,P&&P.locale)}s.kernel=!0;function r(w,v){return v.length===0?null:x(w)(v[0])}r.kernel=!0;function n(w,v){return v.length===0?null:x(w)(v[v.length-1])}n.kernel=!0;function m(w){if(typeof w=="number")return Number.isNaN(w)?null:w;if(w==null||w===""||typeof w=="boolean")return null;if(w instanceof Date)return w.getTime();const v=Number(w);return Number.isNaN(v)?null:v}const l={sum:b,min:i,max:s,avg:o,count:g,first:r,last:n,countValues:u,...R},a=Object.freeze({...j,sum:"Sum",avg:"Average",min:"Min",max:"Max",count:"Count",countValues:"Count of values",first:"First",last:"Last"});function c(w){return w?typeof w=="string"?a[w]||w:"Total":""}const f=Object.freeze(["sum","avg","min","max","count","countValues","first","last"]);function p(w){const v=w&&w.dataType&&w.dataType.totals&&w.dataType.totals.supported;if(Array.isArray(v))return v.slice();const P=f.filter(W=>W in l);for(const W of Object.keys(l))P.includes(W)||P.push(W);return P}function y(w,v){return typeof v!="string"?!0:p(w).includes(v)}function h(w,v){const P=x(w),W=[];for(let V=0;V<v.length;V++){const G=P(v[V]);G!=null&&W.push(G)}return W}function d(w,v,P,W){const V=v||[];if(P&&typeof P=="object"&&typeof P.fn=="string"){const{fn:G,..._}=P,T=l[G];return T?T(w,V,{...W,..._}):(I(`total:${G}`,`unknown total function "${G}"; register it in config.totalFns`),null)}if(typeof P=="string"){const G=l[P];return G?G(w,V,W):(I(`total:${P}`,`unknown total function "${P}"; register it in config.totalFns`),null)}return E(P)?P.kernel===!0?P(w,V,W):P(h(w,V),W||{}):null}}),_e("packages/core/src/compute/windowed.js",function(e,F){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Q}});const E=F("packages/core/src/compute/sketch.js").Welford;class K{#e;#t;#n=[];#r;#i;constructor(x,q=0,R=Date.now){if(x!=="count"&&x!=="time"&&x!=="session")throw new RangeError(`unknown window kind: ${x}`);if((x==="count"||x==="time")&&!(q>0))throw new RangeError(`a ${x} window needs a positive span`);this.#e=x,this.#t=Math.floor(q),this.#r=R,this.#i=R()}get size(){return this.#n.length}push(x,q=this.#r()){Number.isFinite(x)&&(this.#n.push({t:q,v:x}),this.#s(q))}#s(x){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const q=x-this.#t;for(;this.#n.length&&this.#n[0].t<q;)this.#n.shift()}}spec(){const x=this.#e==="session"?this.#r()-this.#i:this.#t;return{kind:this.#e,span:x,size:this.#n.length}}values(){return this.#n.map(x=>x.v)}aggregate(){const x=this.spec();if(!this.#n.length)return{over:x,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const q=new E;let R=0,j=1/0,k=-1/0;for(const{v:b}of this.#n)R+=b,b<j&&(j=b),b>k&&(k=b),q.add(b);return{over:x,count:this.#n.length,sum:R,mean:q.mean(),min:j,max:k,variance:q.variance(),stddev:q.stddev()}}reduce(x){const q=this.aggregate(),R={sum:q.sum,avg:q.mean,mean:q.mean,min:q.min,max:q.max,count:q.count,variance:q.variance,stddev:q.stddev};if(!(x in R))throw new RangeError(`unknown windowed aggregate: ${x}`);return{value:R[x],over:q.over}}}const I=Object.freeze(["count","time","session"]);function L(U,x=Date.now){const q=U.kind==="time"&&U.minutes!=null?U.minutes*6e4:U.span??0;return new K(U.kind,q,x)}const Q={Window:K,WINDOW_KINDS:I,openWindow:L}}),_e("packages/core/src/compute/rolling.js",function(e,F){"use strict";Object.defineProperty(e,"ROLLING_WINDOW_FIELDS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"rollingWindow",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"rollingQuantile",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"seasonalDecompose",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"exponentialSmoothing",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return m}});const E=F("packages/core/src/compute/windowed.js").openWindow,I=F("packages/core/src/compute/sketch.js").KLL,L=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function Q(l,a,c,f){if(l.kind==="count"){const p=Math.max(1,Math.floor(l.span||0));return{coverage:Math.min(1,a/p),partial:a<p}}if(l.kind==="time"){const p=l.minutes!=null?l.minutes*6e4:l.span||0;if(!(p>0))return{coverage:1,partial:!1};const y=c-f;return{coverage:Math.min(1,y/p),partial:y<p}}return{coverage:null,partial:!1}}function U(l,a){const c=E(a),f=new Map,p=l.length?l[0].at:0;for(let y=0;y<l.length;y++){const{key:h,at:d,value:w}=l[y];Number.isFinite(w)&&c.push(w,d);const v=c.aggregate(),P=Q(a,v.count,d,p);h!=null&&f.set(String(h),{sum:v.sum,avg:v.mean,min:v.min,max:v.max,count:v.count,coverage:P.coverage,partial:P.partial})}return f}function x(l){const a=new Map;let c=0;for(const{key:f,value:p}of l)Number.isFinite(p)&&(c+=p),f!=null&&a.set(String(f),c);return a}function q(l,a=1){const c=new Map,f=Math.max(1,Math.floor(a));for(let p=0;p<l.length;p++){const{key:y,value:h}=l[p];if(y==null)continue;const d=p>=f?l[p-f].value:null,w=Number.isFinite(h)?h:null,v=Number.isFinite(d)?d:null;c.set(String(y),w!==null&&v!==null?w-v:null)}return c}const R=4096;function j(l){let a=l>>>0;return()=>{a+=1831565813;let c=a;return c=Math.imul(c^c>>>15,c|1),c^=c+Math.imul(c^c>>>7,c|61),((c^c>>>14)>>>0)/4294967296}}function k(l,a){const c=l.length;if(c===1)return l[0];const f=(c-1)*a,p=Math.floor(f),y=Math.ceil(f);return p===y?l[p]:l[p]+(f-p)*(l[y]-l[p])}function b(l,a,c={}){const f=Math.min(1,Math.max(0,c.q==null?.5:c.q)),p=Math.max(1,Math.floor(c.cap==null?R:c.cap)),y=j(c.seed==null?2654435769:c.seed),h=new Map,d=l.length?l[0].at:0;if(a.kind==="session"){const v=new I(200,y);let P=0;for(const{key:W,value:V}of l)Number.isFinite(V)&&(v.add(V),P++),W!=null&&h.set(String(W),{value:P?v.quantile(f):null,approx:P>0,count:P,coverage:null,partial:!1});return h}const w=E(a);for(const{key:v,at:P,value:W}of l){Number.isFinite(W)&&w.push(W,P);const V=w.values(),G=V.length;let _=null,T=!1;if(G)if(G<=p)_=k([...V].sort((O,M)=>O-M),f);else{const O=new I(200,y);for(const M of V)O.add(M);_=O.quantile(f),T=!0}const S=Q(a,G,P,d);v!=null&&h.set(String(v),{value:_,approx:T,count:G,coverage:S.coverage,partial:S.partial})}return h}function u(l,a){const c=l.length,f=new Array(c).fill(null),p=Math.floor(a/2),y=a%2===0;for(let h=0;h<c;h++){if(h-p<0||h+p>=c)continue;let d=0,w=!0;if(y)for(let v=-p;v<=p;v++){const P=l[h+v];if(!Number.isFinite(P)){w=!1;break}d+=v===-p||v===p?P*.5:P}else for(let v=-p;v<=p;v++){const P=l[h+v];if(!Number.isFinite(P)){w=!1;break}d+=P}w&&(f[h]=d/a)}return f}function g(l,a){const c=new Map,f=Math.floor(Number(a&&a.period));if(!(f>=2))return c;const p=a&&a.model==="multiplicative",y=l.length,h=l.map(T=>Number.isFinite(T.value)?T.value:null),d=u(h,f),w=new Array(y).fill(null);for(let T=0;T<y;T++){const S=d[T],O=h[T];S===null||O===null||(p?S!==0&&(w[T]=O/S):w[T]=O-S)}const v=new Array(f).fill(0),P=new Array(f).fill(0);for(let T=0;T<y;T++){if(w[T]===null)continue;const S=T%f;v[S]+=w[T],P[S]+=1}const W=p?1:0,V=v.map((T,S)=>P[S]?T/P[S]:W),G=V.reduce((T,S)=>T+S,0)/f,_=p?V.map(T=>G!==0?T/G:1):V.map(T=>T-G);for(let T=0;T<y;T++){const{key:S}=l[T];if(S==null)continue;const O=d[T],M=_[T%f],A=h[T];let N=null;O!==null&&A!==null&&(N=p?O*M!==0?A/(O*M):null:A-O-M),c.set(String(S),{trend:O,seasonal:A===null?null:M,residual:N,coverage:O===null?0:1,partial:O===null})}return c}function o(l,a,c,f=80){const p=(Math.sqrt(5)-1)/2;let y=a,h=c,d=h-p*(h-y),w=y+p*(h-y),v=l(d),P=l(w);for(let W=0;W<f;W++)v<P?(h=w,w=d,P=v,d=h-p*(h-y),v=l(d)):(y=d,d=w,v=P,w=y+p*(h-y),P=l(w));return(y+h)/2}const t=1e-4,i=1-1e-4;function s(l,a){const c=l.length,f=new Array(c).fill(null),p=new Array(c).fill(null);let y=null,h=0;for(let d=0;d<c;d++){const w=l[d];if(!Number.isFinite(w)){y!==null&&(p[d]=y,f[d]=y);continue}if(y===null){y=w,p[d]=w,f[d]=w;continue}p[d]=y,h+=(w-y)**2,y=a*w+(1-a)*y,f[d]=y}return{smoothed:f,fitted:p,sse:h}}function r(l,a,c){const f=l.length,p=new Array(f).fill(null),y=new Array(f).fill(null);let h=null,d=null,w=0;for(let v=0;v<f;v++){const P=l[v];if(!Number.isFinite(P)){h!==null&&(h+=d,p[v]=h);continue}if(h===null){h=P,p[v]=P;continue}if(d===null){d=P-h;const G=h+d;y[v]=G,w+=(P-G)**2;const _=h;h=a*P+(1-a)*(_+d),d=c*(h-_)+(1-c)*d,p[v]=h;continue}const W=h+d;y[v]=W,w+=(P-W)**2;const V=h;h=a*P+(1-a)*(V+d),d=c*(h-V)+(1-c)*d,p[v]=h}return{smoothed:p,fitted:y,sse:w}}function n(l,a={}){const c=new Map,f=a.method==="holt",p=l.map(W=>Number.isFinite(W.value)?W.value:null),y=p.filter(W=>W!==null).length,h=W=>Math.min(i,Math.max(t,W)),d=()=>{for(const{key:W}of l)W!=null&&c.set(String(W),{smoothed:null,fitted:null,alpha:null,beta:null,sse:null});return c};if(y<(f?2:1))return d();let w=Number.isFinite(a.alpha)?h(a.alpha):null,v=f&&Number.isFinite(a.beta)?h(a.beta):null;if(f){if(w===null||v===null){let W=w===null?.5:w,V=v===null?.5:v;for(let G=0;G<6;G++)w===null&&(W=o(_=>r(p,_,V).sse,t,i)),v===null&&(V=o(_=>r(p,W,_).sse,t,i));w=w===null?W:w,v=v===null?V:v}}else w===null&&(w=o(W=>s(p,W).sse,t,i));const P=f?r(p,w,v):s(p,w);for(let W=0;W<l.length;W++){const{key:V}=l[W];V!=null&&c.set(String(V),{smoothed:P.smoothed[W],fitted:P.fitted[W],alpha:w,beta:f?v:null,sse:P.sse})}return c}const m={ROLLING_WINDOW_FIELDS:L,QUANTILE_SPAN_CAP:R,rollingWindow:U,rollingQuantile:b,cumulativeToDate:x,periodOverPeriod:q,seasonalDecompose:g,exponentialSmoothing:n}}),_e("packages/core/src/compute/cluster.js",function(e,F){"use strict";Object.defineProperty(e,"CLUSTER_ROW_CAP",{enumerable:!0,get:function(){return ie}}),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 I}}),Object.defineProperty(e,"orderByCentre",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"kmeans",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"dbscan",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"autoK",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"standardise",{enumerable:!0,get:function(){return t}});const ie=1e5,E=2e4,K=3,I=5,L=100;function Q(i){let s=i>>>0;return function(){s=s+1831565813|0;let n=Math.imul(s^s>>>15,1|s);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}function U(i,s){let r=0;for(let n=0;n<i.length;n++){const m=i[n]-s[n];r+=m*m}return r}function x(i,s){return Math.sqrt(U(i,s))}function q(i,s){let r=-1,n=1/0;for(let m=0;m<s.length;m++){const l=U(i,s[m]);l<n&&(n=l,r=m)}return r}function R(i,s,r){const n=Q(r),m=i.length,l=[Array.from(i[Math.floor(n()*m)])],a=new Float64Array(m).fill(1/0);for(let c=1;c<s;c++){let f=0;for(let d=0;d<m;d++){const w=U(i[d],l[l.length-1]);w<a[d]&&(a[d]=w),f+=a[d]}const p=n()*(f||m);let y=0,h=m-1;for(let d=0;d<m;d++)if(y+=f?a[d]:1,y>=p){h=d;break}l.push(Array.from(i[h]))}return l}function j(i,s){for(let r=0;r<i.length;r++){const n=i[r]-s[r];if(n!==0)return n}return 0}function k(i,s,r,n){const m=s.map((a,c)=>({centre:a,i:c})).sort((a,c)=>j(a.centre,c.centre)),l=new Int32Array(s.length);for(let a=0;a<m.length;a++)l[m[a].i]=a;for(let a=0;a<i.length;a++)i[a]>=0&&(i[a]=l[i[a]]);return{assignments:i,centres:m.map(a=>a.centre),sizes:m.map(a=>r[a.i]),distances:n}}function b(i,s={}){const r=i.length,n=r?i[0].length:0,m=Math.floor(s.k||K);if(!(r>=m)||m<1||n<1)return null;let l=R(i,m,s.seed===void 0?1:s.seed);const a=new Int32Array(r);let c=!0;for(let h=0;h<L&&c;h++){c=!1;for(let v=0;v<r;v++){const P=q(i[v],l);a[v]!==P&&(a[v]=P,c=!0)}const d=l.map(()=>new Float64Array(n)),w=new Array(m).fill(0);for(let v=0;v<r;v++){const P=a[v];for(let W=0;W<n;W++)d[P][W]+=i[v][W];w[P]++}for(let v=0;v<m;v++)if(w[v])for(let P=0;P<n;P++)l[v][P]=d[v][P]/w[v];else{let P=0,W=-1/0;for(let V=0;V<r;V++){const G=U(i[V],l[v]);G>W&&(W=G,P=V)}l[v]=Array.from(i[P]),c=!0}}const f=new Array(m).fill(0),p=new Float64Array(r);let y=0;for(let h=0;h<r;h++){const d=a[h];f[d]++;const w=U(i[h],l[d]);p[h]=Math.sqrt(w),y+=w}return{assignments:a,centres:l,sizes:f,inertia:y,distances:p}}function u(i,s={}){const r=i.length,n=r?i[0].length:0,m=Number(s.eps),l=Math.max(1,Math.floor(s.minPoints||I));if(!(m>0)||r===0||n<1)return null;const a=new Array(r);for(let w=0;w<r;w++){const v=[];for(let P=0;P<r;P++)w!==P&&x(i[w],i[P])<=m&&v.push(P);a[w]=v}const c=new Int32Array(r).fill(-1);let f=0;for(let w=0;w<r;w++){if(c[w]!==-1||a[w].length<l)continue;c[w]=f;const v=[...a[w]];for(let P=0;P<v.length;P++){const W=v[P];c[W]===-1&&(c[W]=f,a[W].length>=l&&v.push(...a[W]))}f++}if(!f)return{assignments:c,centres:[],sizes:[],distances:new Float64Array(r).fill(NaN)};const p=[],y=new Array(f).fill(0),h=Array.from({length:f},()=>new Float64Array(n));for(let w=0;w<r;w++){const v=c[w];if(!(v<0)){y[v]++;for(let P=0;P<n;P++)h[v][P]+=i[w][P]}}for(let w=0;w<f;w++){const v=new Array(n);for(let P=0;P<n;P++)v[P]=h[w][P]/y[w];p.push(v)}const d=new Float64Array(r).fill(NaN);for(let w=0;w<r;w++){const v=c[w];v>=0&&(d[w]=x(i[w],p[v]))}return{assignments:c,centres:p,sizes:y,distances:d}}function g(i,s,r){const n=i.length;if(n===0)return 0;const m=new Int32Array(r);for(let a=0;a<n;a++)m[s[a]]++;let l=0;for(let a=0;a<n;a++){const c=s[a],f=new Float64Array(r);for(let h=0;h<n;h++)a!==h&&(f[s[h]]+=x(i[a],i[h]));const p=m[c]>1?f[c]/(m[c]-1):0;let y=1/0;for(let h=0;h<r;h++){if(h===c||m[h]===0)continue;const d=f[h]/m[h];d<y&&(y=d)}y!==1/0&&(l+=(y-p)/Math.max(p,y))}return l/n}function o(i,s={}){const r=i.length;if(!r)return null;const n=s.criterion==="silhouette"?"silhouette":"elbow",m=Math.max(2,Math.floor(s.maxK||8)),l=s.seed===void 0?1:s.seed;if(n==="silhouette"){const w=[],v=[];for(let W=2;W<=Math.min(m,r);W++){const V=b(i,{k:W,seed:l});V&&(w.push(W),v.push(g(i,V.assignments,W)))}if(!w.length)return null;let P=0;for(let W=1;W<v.length;W++)v[W]>v[P]&&(P=W);return{k:w[P],criterion:n,scores:v,ks:w}}const a=[],c=[];for(let w=1;w<=Math.min(m,r);w++){const v=b(i,{k:w,seed:l});v&&(a.push(w),c.push(v.inertia))}if(c.length<2)return null;const f={k:a[0],y:c[0]},p={k:a[a.length-1],y:c[c.length-1]},y=Math.hypot(p.k-f.k,p.y-f.y)||1;let h=0,d=-1/0;for(let w=0;w<c.length;w++){const v=Math.abs((p.k-f.k)*(f.y-c[w])-(f.k-a[w])*(p.y-f.y))/y;v>d&&(d=v,h=w)}return{k:a[h],criterion:n,scores:c,ks:a}}function t(i){const s=i.length,r=s?i[0].length:0;if(!s||!r)return null;const n=new Array(r).fill(0);for(let l=0;l<s;l++)for(let a=0;a<r;a++)n[a]+=i[l][a];for(let l=0;l<r;l++)n[l]/=s;const m=new Array(r).fill(0);for(let l=0;l<s;l++)for(let a=0;a<r;a++){const c=i[l][a]-n[a];m[a]+=c*c}for(let l=0;l<r;l++)m[l]=s>1?Math.sqrt(m[l]/(s-1)):0;for(let l=0;l<s;l++)for(let a=0;a<r;a++)m[a]>0?i[l][a]=(i[l][a]-n[a])/m[a]:i[l][a]=i[l][a]-n[a];return{mean:n,sd:m}}}),_e("packages/core/src/compute/compare.js",function(e,F){"use strict";Object.defineProperty(e,"COMPARE_MEASURES",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"pooledStandardMeanDifference",{enumerable:!0,get:function(){return R}}),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 b}}),Object.defineProperty(e,"compareDatasets",{enumerable:!0,get:function(){return u}});const ie=F("packages/core/src/compute/statistics.js"),E=ie.numbers,K=ie.moments,I=ie.frequencyMap,L=ie.categoricalDistance,Q=ie.normalTotalVariation,U=ie.isNumericColumn,x=ie.SUBSET_RELIABILITY_FLOOR,q=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function R(g,o){if(!g||!o||!(g.n>0)||!(o.n>0)||!Number.isFinite(g.mean)||!Number.isFinite(o.mean))return null;const t=(g.n*g.sd*g.sd+o.n*o.sd*o.sd)/(g.n+o.n);return t>0?(g.mean-o.mean)/Math.sqrt(t):null}function j(g,o){const t=E(g,o),{n:i,mean:s,m2:r}=K(t),n=i>0?Math.sqrt(r/i):0;return{mean:s,sd:n,n:i}}function k(g,o,t,i){return U(g,o)&&U(t,i)}function b(g,o,t,i){if(k(g,o,t,i)){const m=j(g,o),l=j(t,i),a=R(m,l);return{measure:q.numeric,magnitude:a,distance:a===null?0:Q(a),direction:a===null?0:Math.sign(a),nA:m.n,nB:l.n,meanA:m.mean,meanB:l.mean,reliable:m.n>=x&&l.n>=x}}const s=I(g,o),r=I(t,i),n=L(s.map,s.total,r.map,r.total);return{measure:q.categorical,magnitude:n,distance:n===null?0:n,direction:0,nA:s.total,nB:r.total,meanA:null,meanB:null,reliable:s.total>=x&&r.total>=x}}function u(g,o,t={}){const i=new Set(g.columns),s=new Set(o.columns),r=g.columns.filter(c=>s.has(c)),n=Array.isArray(t.columns)&&t.columns.length?r.filter(c=>t.columns.includes(c)):r,m=g.indices(),l=o.indices(),a=[];for(const c of n){const f=g.handle(c),p=o.handle(c);if(!f||!p)continue;const y=b(f,m,p,l);a.push({column:c,name:g.name&&g.name(c)||o.name&&o.name(c)||c,measure:y.measure,magnitude:y.magnitude,distance:y.distance,direction:y.direction,nA:y.nA,nB:y.nB,meanA:y.meanA,meanB:y.meanB,reliable:y.reliable})}return a.sort((c,f)=>f.distance-c.distance||Math.abs(f.magnitude||0)-Math.abs(c.magnitude||0)),{ranked:a,nA:m.length,nB:l.length,unmatched:{onlyA:g.columns.filter(c=>!s.has(c)),onlyB:o.columns.filter(c=>!i.has(c))},measures:q}}}),_e("packages/core/src/compute/anomaly.js",function(e,F){"use strict";Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"DEFAULT_MODIFIED_Z_THRESHOLD",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return R}}),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 u}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return m}});const E=F("packages/core/src/compute/statistics.js").quantileSorted,I=F("packages/core/src/compute/special.js").logGamma,L=.6745,Q=3.5,U=1.5,x=.975,q=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function R(l){if(!l.length)return null;const c=Array.from(l,Number).sort((h,d)=>h-d),f=E(c,.5),p=c.map(h=>Math.abs(h-f)).sort((h,d)=>h-d),y=E(p,.5);return{median:f,mad:y}}function j(l,a={}){const c=Number.isFinite(a.threshold)?a.threshold:Q,f=l.length,p=new Array(f).fill(null),y=new Array(f).fill(!1),h=[];for(let v=0;v<f;v++){const P=Number(l[v]);Number.isFinite(P)&&h.push(P)}if(!h.length)return{median:null,mad:null,threshold:c,scores:p,flags:y,flagged:0};const d=R(h);if(d.mad===0)return{median:d.median,mad:0,threshold:c,scores:p,flags:y,flagged:0};let w=0;for(let v=0;v<f;v++){const P=Number(l[v]);if(!Number.isFinite(P))continue;const W=L*(P-d.median)/d.mad;p[v]=W,Math.abs(W)>c&&(y[v]=!0,w++)}return{median:d.median,mad:d.mad,threshold:c,scores:p,flags:y,flagged:w}}function k(l,a={}){const c=Number.isFinite(a.k)?a.k:U,f=[];for(let w=0;w<l.length;w++){const v=Number(l[w]);Number.isFinite(v)&&f.push(v)}if(!f.length)return null;const p=f.sort((w,v)=>w-v),y=E(p,.25),h=E(p,.75),d=h-y;return{q1:y,q3:h,iqr:d,lower:y-c*d,upper:h+c*d,k:c}}function b(l,a){if(a<=0)return 0;const c=I(l);if(a<l+1){let v=l,P=1/l,W=P;for(let V=0;V<1e3&&(v+=1,W*=a/v,P+=W,!(Math.abs(W)<Math.abs(P)*1e-15));V++);return P*Math.exp(-a+l*Math.log(a)-c)}const f=1e-300;let p=a+1-l,y=1/f,h=1/p,d=h;for(let v=1;v<1e3;v++){const P=-v*(v-l);p+=2,h=P*h+p,Math.abs(h)<f&&(h=f),y=p+P/y,Math.abs(y)<f&&(y=f),h=1/h;const W=h*y;if(d*=W,Math.abs(W-1)<1e-15)break}return 1-Math.exp(-a+l*Math.log(a)-c)*d}function u(l,a){return l<=0?0:b(a/2,l/2)}function g(l,a=x){if(!(a>0)||!(a<1))return NaN;let c=0,f=Math.max(1,l);for(;u(f,l)<a;)f*=2;for(let p=0;p<200;p++){const y=(c+f)/2;if(u(y,l)<a?c=y:f=y,f-c<1e-10)break}return(c+f)/2}function o(l){const a=l.length,c=l.map((f,p)=>{const y=f.slice();for(let h=0;h<a;h++)y.push(p===h?1:0);return y});for(let f=0;f<a;f++){let p=f;for(let h=f+1;h<a;h++)Math.abs(c[h][f])>Math.abs(c[p][f])&&(p=h);if(Math.abs(c[p][f])<1e-12)return null;if(p!==f){const h=c[p];c[p]=c[f],c[f]=h}const y=c[f][f];for(let h=0;h<2*a;h++)c[f][h]/=y;for(let h=0;h<a;h++){if(h===f)continue;const d=c[h][f];if(d!==0)for(let w=0;w<2*a;w++)c[h][w]-=d*c[f][w]}}return c.map(f=>f.slice(a))}function t(l,a){const c=l.length,f=new Array(a).fill(0);for(const h of l)for(let d=0;d<a;d++)f[d]+=h[d];for(let h=0;h<a;h++)f[h]/=c;const p=Array.from({length:a},()=>new Array(a).fill(0));for(const h of l)for(let d=0;d<a;d++){const w=h[d]-f[d];for(let v=d;v<a;v++)p[d][v]+=w*(h[v]-f[v])}const y=c>1?c-1:1;for(let h=0;h<a;h++)for(let d=h;d<a;d++)p[h][d]/=y,p[d][h]=p[h][d];return{mean:f,cov:p}}function i(l,a={}){const c=Number.isFinite(a.p)?a.p:x,f=Number.isFinite(a.ridge)?a.ridge:1e-6,p=l.length;if(!p)return null;const y=l[0].length;if(!y)return null;const h=new Array(p).fill(null),d=new Array(p).fill(null),w=new Array(p).fill(!1),v=[],P=[];for(let M=0;M<p;M++){const A=l[M];let N=A.length===y;const $=new Array(y);for(let H=0;N&&H<y;H++){const Y=Number(A[H]);Number.isFinite(Y)?$[H]=Y:N=!1}N&&(v.push(M),P.push($))}const W=y,V=g(W,c);if(P.length<=y)return{center:[],df:W,cutoff:V,singular:!0,used:P.length,distances:h,squared:d,flags:w,flagged:0};const{mean:G,cov:_}=t(P,y);let T=o(_),S=!1;if(!T){S=!0;let M=0;for(let $=0;$<y;$++)M+=_[$][$];const A=M/y*f||f,N=_.map(($,H)=>$.map((Y,Z)=>H===Z?Y+A:Y));if(T=o(N),!T)return{center:G,df:W,cutoff:V,singular:!0,used:P.length,distances:h,squared:d,flags:w,flagged:0}}let O=0;for(let M=0;M<P.length;M++){const A=P[M],N=new Array(y);for(let Y=0;Y<y;Y++)N[Y]=A[Y]-G[Y];let $=0;for(let Y=0;Y<y;Y++){let Z=0;for(let J=0;J<y;J++)Z+=T[Y][J]*N[J];$+=N[Y]*Z}$<0&&($=0);const H=v[M];d[H]=$,h[H]=Math.sqrt($),$>V&&(w[H]=!0,O++)}return{center:G,df:W,cutoff:V,singular:S,used:P.length,distances:h,squared:d,flags:w,flagged:O}}const s=20,r=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function n(l,a={}){const c=a.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",f=Number.isFinite(a.windowLen)&&a.windowLen>=1?Math.floor(a.windowLen):s,p=Number.isFinite(a.threshold)?a.threshold:Q,y=Number.isFinite(a.k)?a.k:U,h=Number.isFinite(a.minPeriods)&&a.minPeriods>=1?Math.floor(a.minPeriods):f,d=l.length,w=new Array(d).fill(null),v=new Array(d).fill(!1);let P=0;for(let W=0;W<d;W++){const V=Number(l[W]);if(!Number.isFinite(V))continue;const G=Math.max(0,W-f+1),_=[];for(let T=G;T<=W;T++){const S=Number(l[T]);Number.isFinite(S)&&_.push(S)}if(!(_.length<h))if(c==="rollingIqr"){const T=k(_,{k:y});if(!T)continue;(V<T.lower||V>T.upper)&&(v[W]=!0,P++)}else{const T=R(_);if(!T||T.mad===0)continue;const S=L*(V-T.median)/T.mad;w[W]=S,Math.abs(S)>p&&(v[W]=!0,P++)}}return{method:c,windowLen:f,minPeriods:h,threshold:p,k:y,scores:w,flags:v,flagged:P}}function m(l={}){const a=l||{},c=a.field;if(typeof c!="string"||!c)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const f=a.method||"modifiedZScore";if(!(q.includes(f)||r.includes(f))||f==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${f}'`);const y=typeof a.orderBy=="string"?a.orderBy:null,h=a.latest===!0,d=r.includes(f),w=v=>Number(v==null?NaN:v[c]);return v=>{const P=Array.isArray(v)?v.slice():[...v];y&&P.sort((T,S)=>{const O=T?.[y],M=S?.[y];return O===M?0:O==null?-1:M==null?1:O<M?-1:1});const W=P.map(w);let V,G;if(d)({flags:V,scores:G}=n(W,{method:f,windowLen:a.windowLen,threshold:a.threshold,k:a.k,minPeriods:a.minPeriods}));else if(f==="iqr"){const T=k(W,{k:a.k});V=W.map(S=>T?Number.isFinite(S)&&(S<T.lower||S>T.upper):!1),G=W.map(()=>null)}else({flags:V,scores:G}=j(W,{threshold:a.threshold}));if(h){const T=V.length-1;return T<0||!V[T]?!1:{method:f,field:c,flagged:[{row:P[T],score:G[T]}]}}const _=[];for(let T=0;T<V.length;T++)V[T]&&_.push({row:P[T],score:G[T]});return _.length?{method:f,field:c,flagged:_}:!1}}}),_e("packages/core/src/compute/forecast.js",function(e,F){"use strict";Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});const ie=F("packages/core/src/compute/special.js"),E=ie.normalQuantile,K=ie.studentTQuantile,L=F("packages/core/src/internal/warn.js").warnOnce,Q=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),U=1e-4,x=1-1e-4;function q(a){const c=[];for(let f=0;f<a.length;f++){const p=a[f];if(p!==null&&typeof p=="object"){const y=Number.isFinite(p.at)?p.at:f,h=Number.isFinite(p.value)?p.value:null;c.push({at:y,value:h})}else c.push({at:f,value:Number.isFinite(p)?Number(p):null})}return c}function R(a){const c=a.filter(d=>d.value!==null),f=c[0],p=c[c.length-1],y=p.at-f.at,h=c.length>1&&y>0?y/(c.length-1):1;return{lastAt:p.at,step:h}}function j(a){return Math.min(x,Math.max(U,a))}function k(a,c=U,f=x,p=80){const y=(Math.sqrt(5)-1)/2;let h=c,d=f,w=d-y*(d-h),v=h+y*(d-h),P=a(w),W=a(v);for(let V=0;V<p;V++)P<W?(d=v,v=w,W=P,w=d-y*(d-h),P=a(w)):(h=w,w=v,P=W,v=h+y*(d-h),W=a(v));return(h+d)/2}function b(a,c){let f=null,p=0,y=0;for(let h=0;h<a.length;h++){const d=a[h];if(d!==null){if(f===null){f=d;continue}p+=(d-f)**2,y+=1,f=c*d+(1-c)*f}}return{level:f,sse:p,m:y}}function u(a,c,f){let p=null,y=null,h=0,d=0;for(let w=0;w<a.length;w++){const v=a[w];if(v===null){p!==null&&y!==null&&(p+=y);continue}if(p===null){p=v;continue}y===null&&(y=v-p);const P=p+y;h+=(v-P)**2,d+=1;const W=p;p=c*v+(1-c)*(W+y),y=f*(p-W)+(1-f)*y}return{level:p,trend:y,sse:h,m:d}}function g(a,c,f,p,y){const h=a.length;if(h<2*c)return null;const d=S=>{let O=0,M=0;for(let A=S;A<S+c&&A<h;A++)a[A]!==null&&(O+=a[A],M+=1);return M?O/M:null},w=d(0),v=d(c);if(w===null||v===null)return null;let P=w,W=(v-w)/c;const V=new Array(c).fill(0);for(let S=0;S<c;S++)V[S]=a[S]===null?0:a[S]-P;const G=V.reduce((S,O)=>S+O,0)/c;for(let S=0;S<c;S++)V[S]-=G;let _=0,T=0;for(let S=c;S<h;S++){const O=S%c,M=V[O],A=a[S];if(A===null){P+=W;continue}const N=P+W+M;_+=(A-N)**2,T+=1;const $=P;P=f*(A-M)+(1-f)*(P+W),W=p*(P-$)+(1-p)*W,V[O]=y*(A-P)+(1-y)*M}return{level:P,trend:W,season:V,phase:(h-1)%c,sse:_,count:T}}function o(a,c,f){let p=1;for(const h of c)p+=h*h;const y=Math.sqrt(a*p);return{se:y,margin:f*y}}function t(a,c={}){if(!a||typeof a.length!="number"||a.length===0)return null;const f=Q.includes(c.method)?c.method:"linear",p=Math.max(1,Math.floor(Number(c.horizon)||1)),y=Number.isFinite(c.confidence)&&c.confidence>0&&c.confidence<1?c.confidence:.95,h=1-(1-y)/2,d=q(a),w=d.map(_=>_.value),v=w.filter(_=>_!==null),P=v.length,{lastAt:W,step:V}=P?R(d):{lastAt:0,step:1},G=_=>W+_*V;return f==="linear"?i(d,P,p,y,h,G):f==="movingAverage"?s(v,P,p,y,h,c,G):f==="ses"?r(w,P,p,y,h,c,G):f==="holt"?n(w,P,p,y,h,c,G):m(w,P,p,y,h,c,G)}function i(a,c,f,p,y,h){if(c<2)return null;let d=0,w=0;for(const A of a)A.value!==null&&(d+=A.at,w+=A.value);d/=c,w/=c;let v=0,P=0,W=0;for(const A of a){if(A.value===null)continue;const N=A.at-d,$=A.value-w;v+=N*N,P+=N*$,W+=$*$}if(v===0)return null;const V=P/v,G=w-V*d,_=W===0?1:Math.max(0,Math.min(1,P*P/(v*W))),T=Math.max(0,W-V*P),S=c>2?Math.sqrt(T/(c-2)):null,O=c>2?K(y,c-2):null,M=[];for(let A=1;A<=f;A++){const N=h(A),$=G+V*N;let H=null,Y=null,Z=null,J=null,D=null;if(S!==null){const te=1/c+(N-d)**2/v,z=S*Math.sqrt(1+te),X=S*Math.sqrt(te);D=z,H=$-O*z,Y=$+O*z,Z=$-O*X,J=$+O*X}M.push({step:A,at:N,mean:$,lower:H,upper:Y,lowerMean:Z,upperMean:J,se:D})}return{method:"linear",horizon:f,confidence:p,n:c,sigma:S,r2:_,params:{slope:V,intercept:G},points:M}}function s(a,c,f,p,y,h,d){if(c<1)return null;const w=Math.max(1,Math.min(c,Math.floor(Number(h.windowLen)||c))),v=a.slice(c-w);let P=0;for(const S of v)P+=S;const W=P/w;let V=null,G=null;if(w>1){let S=0;for(const M of v)S+=(M-W)**2;V=Math.sqrt(S/(w-1))*Math.sqrt(1+1/w),G=K(y,w-1)}const _=V===null?null:G*V,T=[];for(let S=1;S<=f;S++)T.push({step:S,at:d(S),mean:W,lower:_===null?null:W-_,upper:_===null?null:W+_,se:V});return{method:"movingAverage",horizon:f,confidence:p,n:c,sigma:V===null?null:V,params:{windowLen:w},points:T}}function r(a,c,f,p,y,h,d){if(c<1)return null;let w=Number.isFinite(h.alpha)?j(h.alpha):null;w===null&&(w=k(G=>b(a,G).sse));const v=b(a,w),P=E(y),W=v.m>0?v.sse/v.m:null,V=[];for(let G=1;G<=f;G++){const _=v.level;let T=null,S=null,O=null;if(W!==null){const M=[];for(let N=1;N<G;N++)M.push(w);const A=o(W,M,P);O=A.se,T=_-A.margin,S=_+A.margin}V.push({step:G,at:d(G),mean:_,lower:T,upper:S,se:O})}return{method:"ses",horizon:f,confidence:p,n:c,sigma:W===null?null:Math.sqrt(W),params:{alpha:w},points:V}}function n(a,c,f,p,y,h,d){if(c<2)return null;let w=Number.isFinite(h.alpha)?j(h.alpha):null,v=Number.isFinite(h.beta)?j(h.beta):null;if(w===null||v===null){let T=w===null?.5:w,S=v===null?.5:v;for(let O=0;O<6;O++)w===null&&(T=k(M=>u(a,M,S).sse)),v===null&&(S=k(M=>u(a,T,M).sse));w=w===null?T:w,v=v===null?S:v}const P=u(a,w,v),W=E(y),V=P.m>0?P.sse/P.m:null,G=w*v,_=[];for(let T=1;T<=f;T++){const S=P.level+T*P.trend;let O=null,M=null,A=null;if(V!==null){const N=[];for(let H=1;H<T;H++)N.push(w+H*G);const $=o(V,N,W);A=$.se,O=S-$.margin,M=S+$.margin}_.push({step:T,at:d(T),mean:S,lower:O,upper:M,se:A})}return{method:"holt",horizon:f,confidence:p,n:c,sigma:V===null?null:Math.sqrt(V),params:{alpha:w,beta:v},points:_}}function m(a,c,f,p,y,h,d){const w=Math.floor(Number(h.period));if(!(w>=2))return L("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(c<2*w)return null;let v=Number.isFinite(h.alpha)?j(h.alpha):null,P=Number.isFinite(h.beta)?j(h.beta):null,W=Number.isFinite(h.gamma)?j(h.gamma):null;const V=(A,N,$)=>{const H=g(a,w,A,N,$);return H?H.sse:1/0};if(v===null||P===null||W===null){let A=v===null?.5:v,N=P===null?.5:P,$=W===null?.5:W;for(let H=0;H<8;H++)v===null&&(A=k(Y=>V(Y,N,$))),P===null&&(N=k(Y=>V(A,Y,$))),W===null&&($=k(Y=>V(A,N,Y)));v=v===null?A:v,P=P===null?N:P,W=W===null?$:W}const G=g(a,w,v,P,W);if(!G)return null;const _=E(y),T=G.count>0?G.sse/G.count:null,S=v*P,O=W*(1-v),M=[];for(let A=1;A<=f;A++){const N=G.season[(G.phase+A)%w],$=G.level+A*G.trend+N;let H=null,Y=null,Z=null;if(T!==null){const J=[];for(let te=1;te<A;te++)J.push(v+te*S+(te%w===0?O:0));const D=o(T,J,_);Z=D.se,H=$-D.margin,Y=$+D.margin}M.push({step:A,at:d(A),mean:$,lower:H,upper:Y,se:Z})}return{method:"holtWinters",horizon:f,confidence:p,n:c,sigma:T===null?null:Math.sqrt(T),params:{alpha:v,beta:P,gamma:W,period:w},points:M}}const l={FORECAST_METHODS:Q,forecast:t}}),_e("packages/core/src/compute/hypothesis.js",function(e,F){"use strict";Object.defineProperty(e,"GROUP_TESTS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"NORMALITY_ALPHA",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"HL_PAIR_LIMIT",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"welchTTest",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"mannWhitneyUTest",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"chiSquareTest",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return _}});const E=F("packages/core/src/internal/warn.js").warnOnce,I=F("packages/core/src/compute/handle.js").valueReader,L=F("packages/core/src/compute/statistics.js"),Q=L.numbers,U=L.moments,x=L.frequencyMap,q=L.categoricalDistance,R=L.isNumericColumn,j=L.jarqueBera,k=L.proportionInterval,b=L.SUBSET_RELIABILITY_FLOOR,g=F("packages/core/src/compute/compare.js").pooledStandardMeanDifference,o=F("packages/core/src/compute/special.js"),t=o.studentT,i=o.studentTQuantile,s=o.normalCdf,r=o.normalQuantile,n=o.chiSquareUpperTail,m=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),l=.05,a=2e6;function c(T){const S=Number(T);return Number.isFinite(S)&&S>0&&S<1?S:.95}function f(T){const{n:S,mean:O,m2:M}=U(T);return{mean:O,sd:S>0?Math.sqrt(M/S):0,n:S}}function p(T,S){const O=T.length;if(O<2)return 0;let M=0;for(let A=0;A<O;A++){const N=T[A]-S;M+=N*N}return M/(O-1)}function y(T,S){return{name:"pooledStandardMeanDifference",value:g(f(T),f(S))}}function h(T,S,O){const M=T.length,A=S.length;if(M<2||A<2)return null;const N=c(O),{mean:$}=U(T),{mean:H}=U(S),Y=p(T,$),Z=p(S,H),J=Y/M+Z/A;if(!(J>0))return null;const D=Math.sqrt(J),te=($-H)/D,z=Y/M*(Y/M)/(M-1),X=Z/A*(Z/A)/(A-1),ne=J*J/(z+X),se=Math.min(1,Math.max(0,2*(1-t(Math.abs(te),ne)))),ue=$-H,ge=i(1-(1-N)/2,ne)*D;return{test:m.WELCH,statistic:te,statisticName:"t",df:ne,pValue:se,interval:{estimate:ue,lower:ue-ge,upper:ue+ge,confidence:N,method:"welch-t (difference of means)"},effectSize:y(T,S),nA:M,nB:A,reliable:M>=b&&A>=b,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function d(T){const S=T.length;if(S===0)return Number.NaN;const O=S>>1;return S%2?T[O]:(T[O-1]+T[O])/2}function w(T,S,O){const M=T.length,A=S.length,N=M*A;if(N===0||N>a)return null;const $=new Float64Array(N);let H=0;for(let z=0;z<M;z++)for(let X=0;X<A;X++)$[H++]=T[z]-S[X];$.sort();const Y=d($),Z=Math.sqrt(M*A*(M+A+1)/12),J=r(1-(1-O)/2);let D=Math.round(N/2-J*Z);D>=0||(D=0);const te=Math.floor((N-1)/2);return D>te&&(D=te),{estimate:Y,lower:$[D],upper:$[N-1-D],confidence:O,method:"hodges-lehmann (normal approximation)"}}function v(T,S,O){const M=T.length,A=S.length;if(M<1||A<1)return null;const N=c(O),$=M+A,H=new Array($);for(let se=0;se<M;se++)H[se]={v:T[se],g:0};for(let se=0;se<A;se++)H[M+se]={v:S[se],g:1};H.sort((se,ue)=>se.v-ue.v);let Y=0,Z=0,J=0;for(;J<$;){let se=J;for(;se<$&&H[se].v===H[J].v;)se++;const ue=se-J,ge=(J+1+se)/2;for(let Oe=J;Oe<se;Oe++)H[Oe].g===0&&(Y+=ge);Z+=ue*ue*ue-ue,J=se}const D=Y-M*(M+1)/2,te=M*A/2,z=M*A/12*($+1-Z/($*($-1)));let X=1;if(z>0){const se=Math.max(0,Math.abs(D-te)-.5);X=Math.min(1,2*s(-se/Math.sqrt(z)))}const ne=w(T,S,N);return{test:m.MANN_WHITNEY,statistic:D,statisticName:"U",df:null,pValue:X,interval:ne,effectSize:y(T,S),nA:M,nB:A,reliable:M>=b&&A>=b,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function P(T,S,O,M,A){const N=k(T,S,A),$=k(O,M,A);if(!N||!$)return null;const H=N.proportion-$.proportion,Y=H-Math.sqrt((N.proportion-N.lower)**2+($.upper-$.proportion)**2),Z=H+Math.sqrt((N.upper-N.proportion)**2+($.proportion-$.lower)**2);return{lower:Y,upper:Z}}function W(T,S,O,M,A,N={}){if(!(S>0)||!(M>0))return null;const $=new Set([...T.keys(),...O.keys()]),H=$.size;if(H<2)return null;const Y=S+M;let Z=0;for(const X of $){const ne=T.get(X)||0,se=O.get(X)||0,ue=ne+se,ge=S*ue/Y,Oe=M*ue/Y;ge>0&&(Z+=(ne-ge)*(ne-ge)/ge),Oe>0&&(Z+=(se-Oe)*(se-Oe)/Oe)}const J=H-1,D=n(Z,J);let te=null;N.category!==void 0&&$.has(N.category)?te=N.category:H===2&&([te]=[...$]);let z=null;if(te!==null){const X=P(T.get(te)||0,S,O.get(te)||0,M,c(A));X&&(z={estimate:(T.get(te)||0)/S-(O.get(te)||0)/M,lower:X.lower,upper:X.upper,confidence:c(A),method:"newcombe (difference in this category's share)",category:te})}return{test:m.CHI_SQUARE,statistic:Z,statisticName:"chiSquare",df:J,pValue:D,interval:z,effectSize:{name:"categoricalTotalVariation",value:q(T,S,O,M)},nA:S,nB:M,reliable:S>=b&&M>=b,method:"Pearson chi-square test of independence (2×k, no continuity correction)"}}function V(T){return T==null||T===""||typeof T=="number"&&Number.isNaN(T)?null:T instanceof Date?T.getTime():typeof T=="object"?String(T):T}function G(T,S,O){if(O===m.WELCH||O===m.MANN_WHITNEY)return{test:O,chosenBy:"override",reason:`caller override: ${O}`};const M=j(T),A=j(S),N=M===null?null:Math.exp(-M/2),$=A===null?null:Math.exp(-A/2);return N!==null&&N<l||$!==null&&$<l?{test:m.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${l})`}:{test:m.WELCH,chosenBy:"auto",reason:N!==null||$!==null?"column family: numeric, no departure from normality detected":"column family: numeric (too few rows to screen normality)"}}function _(T,S,O,M={}){if(!T||!S)return null;const A=c(M.confidence),N=I(S);let $;if(Array.isArray(M.groups)&&M.groups.length===2)$=[V(M.groups[0]),V(M.groups[1])];else{const{map:se}=x(S,O),ue=[...se.entries()].sort((ge,Oe)=>Oe[1]-ge[1]).slice(0,2).map(ge=>ge[0]);if(ue.length<2)return E("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;$=ue}const[H,Y]=$;if(H===null||Y===null||H===Y)return E("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const Z=[],J=[];for(let se=0;se<O.length;se++){const ue=V(N(O[se]));ue===H?Z.push(O[se]):ue===Y&&J.push(O[se])}if(Z.length===0||J.length===0)return E("compareGroups:empty","[lattice] compareGroups: one of the two groups has no rows in the current set."),null;const D=M.test&&M.test!=="auto"?String(M.test):null,te=R(T,Z.concat(J));let z,X,ne;if(D===m.CHI_SQUARE||!D&&!te){X=D?"override":"auto",ne=D?"caller override: chiSquare":"column family: categorical";const se=x(T,Z),ue=x(T,J);z=W(se.map,se.total,ue.map,ue.total,A,{category:M.category})}else{if((D===m.WELCH||D===m.MANN_WHITNEY)&&!te)return E("compareGroups:numeric-override",`[lattice] compareGroups: ${D} needs a numeric column, but the column is not numeric.`),null;const se=Q(T,Z),ue=Q(T,J),ge=G(se,ue,D);X=ge.chosenBy,ne=ge.reason,z=ge.test===m.MANN_WHITNEY?v(se,ue,A):h(se,ue,A)}return z?{...z,chosenBy:X,reason:ne,groups:[H,Y]}:(E("compareGroups:degenerate","[lattice] compareGroups: the chosen test had too little to work with (too few values, or no variation)."),null)}}),_e("packages/core/src/compute/significance.js",function(e,F){"use strict";Object.defineProperty(e,"COMPARE_TESTS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"compare",{enumerable:!0,get:function(){return Pe}});const E=F("packages/core/src/internal/warn.js").warnOnce,I=F("packages/core/src/compute/handle.js").valueReader,L=F("packages/core/src/compute/statistics.js"),Q=L.numbers,U=L.moments,x=L.frequencyMap,q=L.isNumericColumn,R=L.jarqueBera,j=L.proportionInterval,k=F("packages/core/src/compute/special.js"),b=k.studentT,u=k.studentTQuantile,g=k.normalCdf,o=k.normalQuantile,t=k.chiSquareUpperTail,i=k.incompleteBeta,s=Object.freeze({T:"t",WELCH:"welch",MANN_WHITNEY:"mannWhitney",ANOVA:"anova",KRUSKAL:"kruskal",CHI_SQUARE:"chiSquare",PROPORTIONS:"proportions"}),r=new Set([s.T,s.WELCH,s.MANN_WHITNEY]),n=new Set([s.ANOVA,s.KRUSKAL]),m=new Set([s.CHI_SQUARE,s.PROPORTIONS]),l=.05,a=[.2,.5,.8],c=[.147,.33,.474],f=[.01,.06,.14],p=[[.1,.3,.5],[.07,.21,.35],[.06,.17,.29],[.05,.15,.25]];function y(ye){const re=Number(ye);return Number.isFinite(re)&&re>0&&re<1?re:.05}function h(ye){return ye==null||ye===""||typeof ye=="number"&&Number.isNaN(ye)?null:ye instanceof Date?ye.getTime():typeof ye=="object"?String(ye):ye}function d(ye,re){const fe=I(ye),oe=[],ce=new Map;for(let de=0;de<re.length;de++){const ve=h(fe(re[de]));if(ve===null)continue;let ke=ce.get(ve);ke||(ke={value:ve,rows:[]},ce.set(ve,ke),oe.push(ke)),ke.rows.push(re[de])}return oe}function w(ye){const{n:re,mean:fe,m2:oe}=U(ye),ce=re>1?oe/(re-1):0;return{n:re,mean:fe,sd:Math.sqrt(ce),variance:ce}}function v(ye,re,fe){if(!(re>0)||!(fe>0)||!(ye>=0)||!Number.isFinite(ye))return Number.NaN;if(ye===0)return 1;const oe=re*ye/(re*ye+fe);return 1-i(re/2,fe/2,oe)}function P(ye,re){const fe=Math.abs(ye);return Number.isFinite(fe)?fe>=re[2]?"large":fe>=re[1]?"medium":fe>=re[0]?"small":"negligible":"negligible"}function W(ye,re,fe){if(ye==="cohensD")return P(re,a);if(ye==="cliffsDelta")return P(re,c);if(ye==="etaSquared")return P(re,f);const oe=Math.max(1,Math.min(p.length,Math.floor(fe||1)));return P(re,p[oe-1])}function V(ye,re){if(!(ye.n>1)||!(re.n>1))return null;const fe=((ye.n-1)*ye.variance+(re.n-1)*re.variance)/(ye.n+re.n-2);return fe>0?(ye.mean-re.mean)/Math.sqrt(fe):null}function G(ye,re){const fe=ye.length,oe=re.length;if(!fe||!oe)return null;const ce=Array.from(re).sort((ke,Ce)=>ke-Ce);let de=0,ve=0;for(let ke=0;ke<fe;ke++){const Ce=ye[ke];let Le=0,we=oe;for(;Le<we;){const Se=Le+we>>1;ce[Se]<Ce?Le=Se+1:we=Se}const He=Le;let Te=Le;for(;Te<oe&&ce[Te]===Ce;)Te++;const Ae=Te-Le;de+=He,ve+=oe-Te}return(de-ve)/(fe*oe)}function _(ye,re,fe,oe){const ce=Math.min(fe-1,oe-1);return!(re>0)||!(ce>0)?null:Math.sqrt(ye/(re*ce))}function T(ye){return Number.isFinite(ye)?ye<.001?"p < 0.001":ye>=.995?"p > 0.995":`p = ${ye.toFixed(3)}`:"p = —"}function S(ye){if(!Number.isFinite(ye))return"0";const re=Math.abs(ye);return re===0?"0":re>=1e3?String(Math.round(ye)):re>=100?String(Number(ye.toFixed(0))):re>=10?String(Number(ye.toFixed(1))):re>=1?String(Number(ye.toFixed(2))):String(Number(ye.toPrecision(2)))}const O=new Set(["cohensD","cliffsDelta"]);function M(ye){if(ye.difference!=null&&Math.abs(ye.difference)>=1e-12)return Math.sign(ye.difference);const re=ye.effectSize;if(re&&O.has(re.name)&&Number.isFinite(re.value)&&Math.abs(re.value)>=1e-12)return Math.sign(re.value);const[fe,oe]=ye.groups;return Number.isFinite(fe.mean)&&Number.isFinite(oe.mean)&&fe.mean!==oe.mean?Math.sign(fe.mean-oe.mean):0}function A(ye){const re=ye.measureName||"values";return{subject:re.charAt(0).toUpperCase()+re.slice(1),be:re==="values"?"are":"is",name:re}}function N(ye,re){const fe=re.unit?` ${re.unit}`:"",{subject:oe,be:ce}=A(re),de=ye.groups[0].label,ve=ye.groups[1].label,ke=ye.effectSize?ye.effectSize.label:"negligible",Ce=ye.pValue<ye.alpha,Le=Ce?"unlikely to be chance":"consistent with chance";if(!Ce&&ke==="negligible")return`${oe} ${ce} essentially the same for ${de} and ${ve} (${T(ye.pValue)}); the effect is ${ke}.`;const we=M(ye),He=`the difference is ${Le} (${T(ye.pValue)}) and the effect is ${ke}.`;if(we===0)return`${oe} ${ce} different between ${de} and ${ve}; ${He}`;const Te=we>0?de:ve,Ae=we>0?ve:de,Se=ye.difference!=null&&Math.abs(ye.difference)>=1e-12,Ee=Math.abs(ye.difference),Me=Se?typeof re.formatValue=="function"?` by about ${re.formatValue(Ee)}${fe}`:` by about ${S(Ee)}${fe}`:"";return`${oe} ${ce} higher for ${Te} than for ${Ae}${Me}; ${He}`}function $(ye,re){const{name:fe}=A(re),oe=ye.effectSize?ye.effectSize.label:"negligible",ce=T(ye.pValue);return ye.pValue<ye.alpha?`The groups differ in ${fe}; the difference is unlikely to be chance (${ce}) and the effect is ${oe}.`:oe==="negligible"?`The groups are essentially the same in ${fe} (${ce}); the effect is ${oe}.`:`The groups show a ${oe} effect in ${fe}, but the difference is consistent with chance (${ce}).`}function H(ye,re){const fe=ye.length;if(fe<2)return null;const{mean:oe,m2:ce}=U(ye),de=ce/(fe-1);if(!(de>0))return null;const ve=Math.sqrt(de),ke=ve/Math.sqrt(fe),Ce=oe/ke,Le=fe-1,we=Math.min(1,Math.max(0,2*(1-b(Math.abs(Ce),Le)))),He=u(1-re/2,Le)*ke,Te=oe/ve;return{test:s.T,statistic:Ce,statisticName:"t",df:Le,pValue:we,difference:oe,interval:{estimate:oe,lower:oe-He,upper:oe+He,confidence:1-re,method:"paired-t (mean of the pair differences)"},effectSize:{name:"cohensD",label:P(Te,a),value:Te}}}function Y(ye,re){const fe=Array.from(ye).filter(Ee=>Ee!==0),oe=fe.length;if(!oe)return null;const ce=Array.from({length:oe},(Ee,Me)=>Me).sort((Ee,Me)=>Math.abs(fe[Ee])-Math.abs(fe[Me])),de=new Array(oe);let ve=0;for(;ve<oe;){let Ee=ve;for(;Ee+1<oe&&Math.abs(fe[ce[Ee+1]])===Math.abs(fe[ce[ve]]);)Ee++;const Me=(ve+Ee)/2+1;for(let Be=ve;Be<=Ee;Be++)de[ce[Be]]=Me;ve=Ee+1}let ke=0,Ce=0;for(let Ee=0;Ee<oe;Ee++)Ce+=de[Ee],fe[Ee]>0&&(ke+=de[Ee]);const Le=Ce-ke,we=oe*(oe+1)/4,He=Math.sqrt(oe*(oe+1)*(2*oe+1)/24),Te=He>0?(Math.abs(ke-we)-.5)/He:0,Ae=Math.min(1,Math.max(0,2*g(-Math.max(0,Te)))),Se=Ce>0?(ke-Le)/Ce:0;return{test:s.MANN_WHITNEY,statistic:ke,statisticName:"W",df:null,pValue:Ae,difference:null,interval:null,effectSize:{name:"cliffsDelta",label:P(Se,c),value:Se}}}function Z(ye,re,fe){const oe=w(ye),ce=w(re);if(oe.n<2||ce.n<2)return null;const de=((oe.n-1)*oe.variance+(ce.n-1)*ce.variance)/(oe.n+ce.n-2);if(!(de>0))return null;const ve=Math.sqrt(de*(1/oe.n+1/ce.n)),ke=(oe.mean-ce.mean)/ve,Ce=oe.n+ce.n-2,Le=Math.min(1,Math.max(0,2*(1-b(Math.abs(ke),Ce)))),we=oe.mean-ce.mean,He=u(1-fe/2,Ce)*ve,Te=V(oe,ce);return{test:s.T,statistic:ke,statisticName:"t",df:Ce,pValue:Le,difference:we,interval:{estimate:we,lower:we-He,upper:we+He,confidence:1-fe,method:"student-t (pooled variance, difference of means)"},effectSize:{name:"cohensD",label:P(Te,a),value:Te},summaries:[oe,ce]}}function J(ye,re,fe){const oe=w(ye),ce=w(re);if(oe.n<2||ce.n<2)return null;const de=oe.variance/oe.n+ce.variance/ce.n;if(!(de>0))return null;const ve=Math.sqrt(de),ke=(oe.mean-ce.mean)/ve,Ce=oe.variance/oe.n*(oe.variance/oe.n)/(oe.n-1),Le=ce.variance/ce.n*(ce.variance/ce.n)/(ce.n-1),we=de*de/(Ce+Le),He=Math.min(1,Math.max(0,2*(1-b(Math.abs(ke),we)))),Te=oe.mean-ce.mean,Ae=u(1-fe/2,we)*ve,Se=V(oe,ce);return{test:s.WELCH,statistic:ke,statisticName:"t",df:we,pValue:He,difference:Te,interval:{estimate:Te,lower:Te-Ae,upper:Te+Ae,confidence:1-fe,method:"welch-t (unequal variances, difference of means)"},effectSize:{name:"cohensD",label:P(Se,a),value:Se},summaries:[oe,ce]}}function D(ye,re,fe){const oe=ye.length,ce=re.length;if(oe<1||ce<1)return null;const de=w(ye),ve=w(re),ke=oe+ce,Ce=new Array(ke);for(let Be=0;Be<oe;Be++)Ce[Be]={v:ye[Be],g:0};for(let Be=0;Be<ce;Be++)Ce[oe+Be]={v:re[Be],g:1};Ce.sort((Be,Ke)=>Be.v-Ke.v);let Le=0,we=0,He=0;for(;He<ke;){let Be=He;for(;Be<ke&&Ce[Be].v===Ce[He].v;)Be++;const Ke=(He+1+Be)/2;for(let Je=He;Je<Be;Je++)Ce[Je].g===0&&(Le+=Ke);const et=Be-He;we+=et*et*et-et,He=Be}const Te=Le-oe*(oe+1)/2,Ae=oe*ce/2,Se=oe*ce/12*(ke+1-we/(ke*(ke-1)));let Ee=1;if(Se>0){const Be=Math.max(0,Math.abs(Te-Ae)-.5);Ee=Math.min(1,2*g(-Be/Math.sqrt(Se)))}const Me=G(ye,re);return{test:s.MANN_WHITNEY,statistic:Te,statisticName:"U",df:null,pValue:Ee,difference:null,interval:te(ye,re,1-fe),effectSize:{name:"cliffsDelta",label:P(Me,c),value:Me},summaries:[de,ve]}}function te(ye,re,fe){const oe=ye.length,ce=re.length,de=oe*ce;if(de===0||de>2e6)return null;const ve=new Float64Array(de);let ke=0;for(let Se=0;Se<oe;Se++)for(let Ee=0;Ee<ce;Ee++)ve[ke++]=ye[Se]-re[Ee];ve.sort();const Ce=de>>1,Le=de%2?ve[Ce]:(ve[Ce-1]+ve[Ce])/2,we=Math.sqrt(oe*ce*(oe+ce+1)/12),He=o(1-(1-fe)/2);let Te=Math.round(de/2-He*we);Te>=0||(Te=0);const Ae=Math.floor((de-1)/2);return Te>Ae&&(Te=Ae),{estimate:Le,lower:ve[Te],upper:ve[de-1-Te],confidence:fe,method:"hodges-lehmann (location shift)"}}function z(ye,re){const fe=ye.length,oe=ye.map(w);if(oe.some(Ee=>Ee.n<2))return null;const ce=oe.reduce((Ee,Me)=>Ee+Me.n,0),de=oe.reduce((Ee,Me)=>Ee+Me.mean*Me.n,0)/ce;let ve=0,ke=0;for(let Ee=0;Ee<fe;Ee++)ve+=oe[Ee].n*(oe[Ee].mean-de)**2,ke+=(oe[Ee].n-1)*oe[Ee].variance;const Ce=fe-1,Le=ce-fe;if(!(ke>0)||Le<1)return null;const we=ve/Ce,He=ke/Le,Te=we/He,Ae=Math.min(1,Math.max(0,v(Te,Ce,Le))),Se=ve/(ve+ke);return{test:s.ANOVA,statistic:Te,statisticName:"F",df:{between:Ce,within:Le},pValue:Ae,difference:null,interval:null,effectSize:{name:"etaSquared",label:P(Se,f),value:Se},summaries:oe}}function X(ye,re){const fe=ye.length,oe=ye.map(w);if(fe<2)return null;const ce=oe.reduce((Me,Be)=>Me+Be.n,0),de=[];for(let Me=0;Me<fe;Me++)for(let Be=0;Be<ye[Me].length;Be++)de.push({v:ye[Me][Be],g:Me});de.sort((Me,Be)=>Me.v-Be.v);const ve=new Array(de.length);let ke=0,Ce=0;for(;Ce<de.length;){let Me=Ce;for(;Me<de.length&&de[Me].v===de[Ce].v;)Me++;const Be=(Ce+1+Me)/2;for(let et=Ce;et<Me;et++)ve[et]=Be;const Ke=Me-Ce;ke+=Ke*Ke*Ke-Ke,Ce=Me}const Le=new Array(fe).fill(0);for(let Me=0;Me<de.length;Me++)Le[de[Me].g]+=ve[Me];let we=0;for(let Me=0;Me<fe;Me++)we+=Le[Me]*Le[Me]/oe[Me].n;we=12/(ce*(ce+1))*we-3*(ce+1);const He=1-ke/(ce*ce*ce-ce),Te=He>0?we/He:we,Ae=fe-1,Se=Math.min(1,Math.max(0,t(Te,Ae))),Ee=(Te-fe+1)/(ce-fe);return{test:s.KRUSKAL,statistic:Te,statisticName:"H",df:Ae,pValue:Se,difference:null,interval:null,effectSize:{name:"etaSquared",label:P(Ee,f),value:Math.max(0,Ee)},summaries:oe}}function ne(ye,re,fe,oe,ce){const de=j(ye,re,ce),ve=j(fe,oe,ce);if(!de||!ve)return null;const ke=de.proportion-ve.proportion,Ce=ke-Math.sqrt((de.proportion-de.lower)**2+(ve.upper-ve.proportion)**2),Le=ke+Math.sqrt((de.upper-de.proportion)**2+(ve.proportion-ve.lower)**2);return{estimate:ke,lower:Ce,upper:Le}}function se(ye,re,fe,oe){const ce=I(re),de=new Set,ve=[];for(const Be of ye){const Ke=new Map;let et=0;for(const Je of Be.rows){const ut=h(ce(Je));ut!==null&&(Ke.set(ut,(Ke.get(ut)||0)+1),et++,de.add(ut))}ve.push(Ke),Be.total=et}const ke=[...de];if(ke.length<2)return null;const Ce=ye.reduce((Be,Ke)=>Be+Ke.total,0);if(!(Ce>0))return null;let Le=0;for(const Be of ye)for(const Ke of ke){const et=ve[ye.indexOf(Be)].get(Ke)||0,Je=ye.reduce((Ct,Nt)=>Ct+(ve[ye.indexOf(Nt)].get(Ke)||0),0),ut=Be.total*Je/Ce;ut>0&&(Le+=(et-ut)*(et-ut)/ut)}const we=ye.length,He=ke.length,Te=(we-1)*(He-1),Ae=Math.min(1,Math.max(0,t(Le,Te))),Se=_(Le,Ce,we,He);let Ee=null;if(we===2&&He===2){const[Be]=ke,Ke=ve[0].get(Be)||0,et=ve[1].get(Be)||0,Je=ne(Ke,ye[0].total,et,ye[1].total,oe);Je&&(Ee={...Je,confidence:oe,method:"newcombe (difference in this category's share)",category:Be})}const Me=ye.map((Be,Ke)=>{const et={};for(const Je of ke)et[String(Je)]=(ve[Ke].get(Je)||0)/Be.total;return et});return{test:s.CHI_SQUARE,statistic:Le,statisticName:"chiSquare",df:Te,pValue:Ae,difference:null,interval:Ee,effectSize:{name:"cramersV",label:W("cramersV",Se,Math.min(we-1,He-1)),value:Se},proportions:Me}}function ue(ye,re,fe,oe){const ce=I(re),de=new Set;for(const Je of ye)for(const ut of Je.rows){const Ct=h(ce(ut));Ct!==null&&de.add(Ct)}if(de.size!==2)return null;const[ve]=[...de],ke=ye[0].rows.reduce((Je,ut)=>Je+(h(ce(ut))===ve?1:0),0),Ce=ye[1].rows.reduce((Je,ut)=>Je+(h(ce(ut))===ve?1:0),0),Le=ye[0].rows.length,we=ye[1].rows.length;if(!(Le>0)||!(we>0))return null;const He=ke/Le,Te=Ce/we,Ae=(ke+Ce)/(Le+we);if(!(Ae>0)||!(Ae<1))return null;const Se=Math.sqrt(Ae*(1-Ae)*(1/Le+1/we)),Ee=(He-Te)/Se,Me=Math.min(1,Math.max(0,2*g(-Math.abs(Ee)))),Be=He-Te,Ke=ne(ke,Le,Ce,we,oe),et=_(Ee*Ee,Le+we,2,2);return{test:s.PROPORTIONS,statistic:Ee,statisticName:"z",df:null,pValue:Me,difference:Be,interval:Ke?{...Ke,confidence:oe,method:"newcombe (difference in proportions)",category:ve}:null,effectSize:{name:"cramersV",label:W("cramersV",et,1),value:et},proportions:[{[String(ve)]:He},{[String(ve)]:Te}],focalCategory:ve}}function ge(ye,re,fe,oe){if(fe&&r.has(fe))return{test:fe,reason:`caller override: ${fe}`};const ce=R(ye),de=R(re),ve=ce===null?null:Math.exp(-ce/2),ke=de===null?null:Math.exp(-de/2);if(ve!==null&&ve<l||ke!==null&&ke<l)return{test:s.MANN_WHITNEY,reason:"two numeric groups, non-normal by Jarque-Bera"};const Ce=w(ye),Le=w(re);if(Ce.n>=3&&Le.n>=3&&Ce.variance>0&&Le.variance>0){const we=Math.max(Ce.variance,Le.variance)/Math.min(Ce.variance,Le.variance),He=Ce.variance>=Le.variance?Ce.n-1:Le.n-1,Te=Ce.variance>=Le.variance?Le.n-1:Ce.n-1;if(2*Math.min(v(we,He,Te),1-v(we,He,Te))<oe)return{test:s.WELCH,reason:"two numeric groups, unequal variances (F-test)"}}return{test:s.T,reason:ve!==null||ke!==null?"two numeric groups, equal variances and no departure from normality":"two numeric groups (too few rows to screen normality)"}}function Oe(ye,re){if(re&&n.has(re))return{test:re,reason:`caller override: ${re}`};for(const fe of ye){const oe=R(fe),ce=oe===null?null:Math.exp(-oe/2);if(ce!==null&&ce<l)return{test:s.KRUSKAL,reason:"three or more numeric groups, non-normal by Jarque-Bera"}}return{test:s.ANOVA,reason:"three or more numeric groups, no departure from normality detected"}}function Pe(ye,re,fe,oe={},ce=null){if(!ye||!re)return null;const de=y(oe.alpha),ve=1-de,ke=oe.test&&oe.test!=="auto"?String(oe.test):null,Ce=d(re,fe);if(Ce.length<2)return E("compare:groups",'[lattice] statistics.compare: the "by" column has fewer than two distinct values to group by.'),null;let Le;if(Array.isArray(oe.groups)&&oe.groups.length===2){const Ke=[h(oe.groups[0]),h(oe.groups[1])];if(Ke[0]===null||Ke[1]===null||Ke[0]===Ke[1])return E("compare:distinct","[lattice] statistics.compare: the two groups must be two distinct, present values."),null;if(Le=Ce.filter(et=>et.value===Ke[0]||et.value===Ke[1]),Le.length!==2)return E("compare:empty","[lattice] statistics.compare: one of the two groups has no rows in the current set."),null;Le.sort((et,Je)=>et.value===Ke[0]?-1:1)}else Ce.length===2||ke&&r.has(ke)||ke&&m.has(ke)?Le=Ce.slice(0,2):(ke&&n.has(ke),Le=Ce);const He=q(ye,fe),Te=!!oe.paired&&ce&&Le.length===2&&He;let Ae,Se,Ee;if(He)if(Le.length===2&&!(ke&&n.has(ke))){const Ke=Q(ye,Le[0].rows),et=Q(ye,Le[1].rows);if(Ke.length<3||et.length<3)return E("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;if(w(Ke).variance===0||w(et).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(Te){const ut=xe(ye,ce,Le[0].rows,Le[1].rows);return ut?(Se=ke?"override":"auto",Ee=ke?`caller override: ${ke} (paired)`:"two numeric groups, paired",Ae=ke===s.MANN_WHITNEY?Y(ut.diffs,de):H(ut.diffs,de),Ae?(Ae.paired=!0,Ae.chosenBy=Se,Ae.reason=Ee,Ae.groups=[{value:Le[0].value,label:String(Le[0].value),n:ut.n},{value:Le[1].value,label:String(Le[1].value),n:ut.n}],Ae.alpha=de,Ae.method=Ae.test===s.MANN_WHITNEY?"Wilcoxon signed-rank test (paired)":"Student's paired t-test (difference of pairs)",Ae.verdict=N(Ae,oe),Ae.categorical=!1,Ae):(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 Je=ge(Ke,et,ke,de);Se=ke?"override":"auto",Ee=Je.reason,Je.test===s.MANN_WHITNEY?Ae=D(Ke,et,de):Je.test===s.WELCH?Ae=J(Ke,et,de):Ae=Z(Ke,et,de),Ae&&Ae.interval&&Ae.difference===null&&(Ae.difference=Ae.interval.estimate)}else{const Ke=Le.map(Je=>Q(ye,Je.rows));if(Ke.some(Je=>Je.length<3))return E("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;const et=Oe(Ke,ke);Se=ke?"override":"auto",Ee=et.reason,Ae=et.test===s.KRUSKAL?X(Ke,de):z(Ke,de)}else if(Le.length===2){const Ke=Ie(ye,Le).size===2;if(ke===s.PROPORTIONS||Ke&&!ke)Se=ke?"override":"auto",Ee=ke?"caller override: proportions":"categorical measure with two categories (binary)",Ae=ue(Le,ye,de,ve);else if(ke===s.CHI_SQUARE||!Ke&&!ke)Se=ke?"override":"auto",Ee=ke?"caller override: chiSquare":`categorical measure with ${Ie(ye,Le).size} categories`,Ae=se(Le,ye,de,ve);else return E("compare:numeric-needed",`[lattice] statistics.compare: ${ke} needs a numeric measure, but the column is categorical.`),null}else Se=ke?"override":"auto",Ee=ke?`caller override: ${ke}`:`categorical measure with ${Ie(ye,Le).size} categories`,Ae=se(Le,ye,de,ve);if(!Ae)return E("compare:degenerate","[lattice] statistics.compare: the chosen test had too little to work with (too few values, or no variation)."),null;const Me=Ae.summaries,Be=Ae.proportions;return{test:Ae.test,chosenBy:Se,reason:Ee,statistic:Ae.statistic,statisticName:Ae.statisticName,df:Ae.df===void 0?null:Ae.df,pValue:Ae.pValue,alpha:de,paired:!1,interval:Ae.interval||null,effectSize:Ae.effectSize,groups:Le.map((Ke,et)=>({value:Ke.value,label:String(Ke.value),n:Me?Me[et].n:Ke.total,...Me?{mean:Me[et].mean,sd:Me[et].sd}:{},...Be?{proportions:Be[et]}:{}})),difference:Ae.difference===void 0?null:Ae.difference,method:Ae.test,categorical:!He,verdict:Le.length===2?N({...Ae,alpha:de,groups:[{value:Le[0].value,label:String(Le[0].value),mean:Me?Me[0].mean:void 0},{value:Le[1].value,label:String(Le[1].value),mean:Me?Me[1].mean:void 0}],categorical:!He,difference:Ae.difference===void 0?null:Ae.difference},oe):$({...Ae,alpha:de},oe)}}function Ie(ye,re){const fe=I(ye),oe=new Set;for(const ce of re)for(const de of ce.rows){const ve=h(fe(de));ve!==null&&oe.add(ve)}return oe}function xe(ye,re,fe,oe){const ce=I(re),de=I(ye),ve=new Map;for(const Ce of oe){const Le=h(ce(Ce));Le!==null&&ve.set(Le,de(Ce))}const ke=[];for(const Ce of fe){const Le=h(ce(Ce));if(Le===null||!ve.has(Le))continue;const we=Number(de(Ce)),He=Number(ve.get(Le));!Number.isFinite(we)||!Number.isFinite(He)||ke.push(we-He)}return ke.length<2?null:{diffs:Float64Array.from(ke),n:ke.length}}}),_e("packages/core/src/columns/detailcolumn.js",function(e,F){"use strict";Object.defineProperty(e,"DETAIL_COLUMN_ID",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"createDetailColumn",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return I}});const ie="__lattice_detail",E=36;function K(L){const Q=L.config&&L.config.detailColumnWidth||E;return{id:ie,field:null,title:"",type:"text",dataType:{base:"text"},nullable:!0,align:"center",generated:!0,control:!0,detailExpander:!0,value:{pure:!0},cell:{render:"detailExpander",align:"center"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:Q,min:Q,max:Q,pin:L.config&&L.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(U,x){return!!(x&&x.expanded)},formatValue(){return""}}}const I=K}),_e("packages/core/src/columns/treecolumn.js",function(e,F){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createTreeColumn",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Q}});const E=F("packages/core/src/internal/predicates.js").isFunction,K="__lattice_tree",I=260;function L(U){const x=U.tree||{},q=U.config&&U.config.treeColumnWidth||I,R=!!(U.config&&U.config.treeColumnFlex),j=()=>(U.columns&&E(U.columns.visible)?U.columns.visible():[]).find(g=>!g.generated)||null,k=(u,g)=>{if(g&&g.group)return g.groupValue;if(E(x.label))return x.label(u,g);if(typeof x.label=="string")return u==null?null:u[x.label];const o=j();return o&&E(o.getValue)?o.getValue(u,g):null},b=()=>{if(x.title)return x.title;const u=typeof x.label=="string"?U.columns&&E(U.columns.get)?U.columns.get(x.label):null:j();return u&&(u.title||u.id)||"Hierarchy"};return{id:K,get title(){return b()},field:null,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group",props:{icon:x.icon,iconClass:x.iconClass,content:x.content,checkbox:x.checkbox,onCheck:x.onCheck}},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:R?{flex:1,min:0,pin:U.config&&U.config.treeColumnPin||null,hidden:!1,resizable:!1,movable:!1,lockPosition:!0}:{width:q,min:140,pin:U.config&&U.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(u,g){return k(u,g)},formatValue(u,g){if(g&&g.grandTotal)return U.config&&U.config.grandTotalLabel||"Total";if(u==null)return"";if(!x.label){const o=j();if(o&&E(o.formatValue))return o.formatValue(u,g)}return String(u)}}}const Q=L}),_e("packages/core/src/columns/pivotcolumns.js",function(e,F){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return L}});const E=F("packages/core/src/internal/warn.js").warnOnce,K="__lattice_pivot",I=500;function L(q){const{pivot:R,valueColumns:j,config:k}=q,b=R&&R.paths||[],u=q.separator||k&&k.pivot&&k.pivot.separator||" | ",g=k&&k.pivot&&k.pivot.maxColumns||I;if(!b.length||!j.length)return{tree:[],leaves:[],error:null};const o=Q(k),t=b.length*j.length+(o?j.length:0);if(t>g){const r=`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}`,r),{tree:[],leaves:[],error:r}}const i=[],s=[];for(const r of b){const n=[];for(const m of j){const l=x(r,m,u);n.push(l),s.push(l)}n.length===1?(n[0].title=String(r),i.push(n[0])):i.push({id:`${K}:group:${r}`,title:String(r),columns:n,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(o){const r=j.map(m=>U(m,k));s.push(...r);const n=k&&k.pivot&&k.pivot.totalsLabel||"Total";if(r.length===1)r[0].title=n,o==="before"?i.unshift(r[0]):i.push(r[0]);else{const m={id:`${K}:group:__totals`,title:n,columns:r,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};o==="before"?i.unshift(m):i.push(m)}}return{tree:i,leaves:s,error:null}}function Q(q){const R=q&&q.pivot&&q.pivot.groupTotals;return R==="before"||R==="after"?R:null}function U(q,R){return{id:`${K}:__total${R&&R.pivot&&R.pivot.separator||" | "}${q.id}`,field:null,title:q.title||q.id,type:q.type,dataType:q.dataType,nullable:!0,align:q.align,generated:!0,pivot:{enabled:!1,index:0,sourceId:q.id,total:!0},value:{pure:!0},cell:{align:q.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:q.total,lookup:null,layout:{width:q.layout&&q.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 b=k&&k.totals;return b&&Object.hasOwn(b,q.id)?b[q.id]:null},formatValue(j,k){return j==null?"":q.formatValue?q.formatValue(j,k):String(j)}}}function x(q,R,j){return{id:`${K}:${q}${j}${R.id}`,field:null,title:R.title||R.id,type:R.type,dataType:R.dataType,nullable:!0,align:R.align,generated:!0,pivot:{enabled:!1,index:0,path:q,sourceId:R.id},value:{pure:!0},cell:{align:R.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:R.total,lookup:null,layout:{width:R.layout&&R.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(){return null},formatValue(k,b){return k==null?"":R.formatValue?R.formatValue(k,b):String(k)}}}}),_e("packages/core/src/compute/group.js",function(e,F){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return k}});const ie=F("packages/core/src/compute/handle.js"),E=ie.dictSize,K=ie.identity,I=ie.presenceReader,L=ie.rowCount,Q=ie.valueReader,U="",x="\0",q=1<<20;function R(b,u,g,o){const t=b.length,i=b.map(a=>Q(a)),s=Array.isArray(o)&&o.some(Boolean),r=s?i.map((a,c)=>o[c]?f=>o[c](a(f)):a):i;if(!s&&t>0&&b.every(a=>a&&a.kind==="dictionary"&&a.dict)){const a=b.map(f=>E(f.dict)+1);let c=1;for(let f=0;f<t;f++)c*=a[f];if(c<=Number.MAX_SAFE_INTEGER){const f=b.map(d=>d.values),p=b.map(d=>I(d)),y=d=>{let w=0;for(let v=0;v<t;v++){const P=p[v],W=P&&P(d)===0?a[v]-1:f[v][d];w=w*a[v]+W}return w},h=new Float64Array(g);for(let d=0;d<g;d++)h[d]=y(u[d]);return{packed:h,strings:null,product:c,readers:r,keyOf:y}}}const m=a=>{let c="";for(let f=0;f<t;f++){const p=r[f](a);c+=(f===0?"":U)+(p==null?x:String(p))}return c},l=new Array(g);for(let a=0;a<g;a++)l[a]=m(u[a]);return{packed:null,strings:l,product:1/0,readers:r,keyOf:m}}function j(b,u,g,o){const t=new Uint32Array(o+1);for(let n=0;n<g;n++)t[u[n]+1]++;for(let n=0;n<o;n++)t[n+1]+=t[n];const i=new Uint32Array(g),s=t.slice(0,o);for(let n=0;n<g;n++)i[s[u[n]]++]=b[n];const r=new Array(o);for(let n=0;n<o;n++)r[n]=i.subarray(t[n],t[n+1]);return r}function k(b,u,g={}){const o=b||[],t=u||K(L(o[0],g)),i=t.length;if(o.length===0||i===0)return{keys:[],buckets:[]};const{packed:s,strings:r,product:n,readers:m}=R(o,t,i,g.project),l=new Uint32Array(i);let a=0,c=null;if(s&&n<=Math.max(1024,Math.min(q,i*4))){const h=n,d=new Int32Array(h).fill(-1);for(let w=0;w<i;w++)d[s[w]]=0;for(let w=0;w<h;w++)d[w]===0&&(d[w]=a++);for(let w=0;w<i;w++)l[w]=d[s[w]];c=new Float64Array(a);for(let w=0;w<h;w++)d[w]>=0&&(c[d[w]]=w)}else if(s){const h=new Map;for(let d=0;d<i;d++){const w=s[d];let v=h.get(w);v===void 0&&(v=a++,h.set(w,v)),l[d]=v}c=new Float64Array(a);for(const[d,w]of h)c[w]=d}else{const h=new Map;for(let d=0;d<i;d++){const w=r[d];let v=h.get(w);v===void 0&&(v=a++,h.set(w,v)),l[d]=v}}const f=j(t,l,i,a),p=new Array(a);for(let h=0;h<a;h++){const d=f[h][0],w=new Array(m.length);for(let v=0;v<m.length;v++)w[v]=m[v](d);p[h]=w}const y={keys:p,buckets:f};return c&&(y.packed=c),y}}),_e("packages/core/src/compute/pivot.js",function(e,F){"use strict";Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return R}}),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 b}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return i}});const E=F("packages/core/src/internal/warn.js").warnOnce,I=F("packages/core/src/compute/handle.js").valueComparator,Q=F("packages/core/src/compute/group.js").packKeys,x=F("packages/core/src/compute/total.js").total,q="|",R="/",j=2e3;function k(n,m,l){return`${n}${q}${m}${q}${l}`}function b(n,m){let l="";for(let a=0;a<n.length;a++){const c=n[a];l+=(a===0?"":m)+(c==null?"":String(c))}return l}function u(n,m,l={}){const a=l.separator||R,c=m.length,{keyOf:f,readers:p}=Q(n,m,0),y=new Map,h=[],d=[];for(let _=0;_<c;_++){const T=m[_],S=f(T);if(y.has(S))continue;y.set(S,h.length),d.push(S);const O=new Array(p.length);for(let M=0;M<p.length;M++)O[M]=p[M](T);h.push(O)}const w=I(l.locale),v=h.map((_,T)=>T);v.sort((_,T)=>{const S=h[_],O=h[T];for(let M=0;M<S.length;M++){const A=g(S[M],O[M],w);if(A!==0)return A}return _-T});const P=new Array(v.length),W=new Array(v.length),V=new Map;for(let _=0;_<v.length;_++){const T=v[_];P[_]=h[T],W[_]=b(h[T],a),V.set(d[T],_)}return{keys:P,paths:W,idOf:_=>{const T=V.get(f(_));return T===void 0?-1:T}}}function g(n,m,l){const a=n==null,c=m==null;return a||c?a&&c?0:a?1:-1:l(n,m)}function o(n){const m=n.values||n.totals||[];if(m.length&&typeof m[0]=="object"&&m[0]!==null)return m.filter(f=>f&&f.handle);const l=typeof n.handle=="function"?n.handle:null;if(!l)return m.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 a=typeof n.totalOf=="function"?n.totalOf:null,c=[];for(const f of m){const p=l(f);p&&c.push({colId:f,handle:p,fn:a?a(f):"sum"})}return c}function t(n,m,l){if(Array.isArray(n)){const a=l||{};return{...a,pivotHandles:n,order:m||null,groups:a.groups||null}}return n||{}}function i(n,m,l){const a=t(n,m,l),c=a.separator||R,f=o(a),p=a.maxColumns===void 0?j:a.maxColumns,y=a.groups&&a.groups.buckets?a.groups:null,h=y?y.buckets:[a.order||new Uint32Array(0)],d=a.groupPaths||(y?y.keys.map(S=>b(S,c)):[""]),w=r(h),{keys:v,paths:P,idOf:W}=u(a.pivotHandles||[],w,a),V=P.length*Math.max(1,f.length),G=s(P,f,c);if(p&&V>p){const S=new Map;return{keys:v,paths:P,fields:G,groupPaths:d,columns:V,values:S,cells:S,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${V} columns, above pivot.maxColumns of ${p}. Narrow the pivot columns or raise the limit.`,columns:V,maxColumns:p}}}const _=new Map,T=P.length;for(let S=0;S<h.length;S++){const O=h[S],M=d[S]===void 0?"":d[S],A=O.length;if(A===0)continue;const N=new Int32Array(A),$=new Uint32Array(T+1);for(let Z=0;Z<A;Z++){const J=W(O[Z]);N[Z]=J,J>=0&&$[J+1]++}for(let Z=0;Z<T;Z++)$[Z+1]+=$[Z];const H=new Uint32Array(A),Y=$.slice(0,T);for(let Z=0;Z<A;Z++){const J=N[Z];J>=0&&(H[Y[J]++]=O[Z])}for(let Z=0;Z<T;Z++){const J=$[Z],D=$[Z+1];if(D===J)continue;const te=H.subarray(J,D);for(let z=0;z<f.length;z++){const X=f[z],ne=x(X.handle,te,X.fn,a.totalContext||{locale:a.locale});_.set(k(M,P[Z],X.colId),ne)}}}return{keys:v,paths:P,fields:G,groupPaths:d,columns:V,values:_,cells:_,error:null}}function s(n,m,l){if(m.length===0)return n.slice();const a=[];for(const c of n)for(const f of m)a.push(`${c}${l}${f.colId}`);return a}function r(n){if(n.length===1)return n[0]||new Uint32Array(0);let m=0;for(const c of n)m+=c?c.length:0;const l=new Uint32Array(m);let a=0;for(const c of n)!c||c.length===0||(l.set(c,a),a+=c.length);return l}}),_e("packages/core/src/compute/explain.js",function(e,F){"use strict";Object.defineProperty(e,"explainContributors",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"explainChange",{enumerable:!0,get:function(){return k}});const E=F("packages/core/src/compute/total.js").total,I=F("packages/core/src/compute/group.js").groupByColumns,L=new Set(["sum","count","countValues"]),Q=new Set(["min","max"]),U=new Set(["avg"]);function x(b){return typeof b=="string"?b:typeof b=="function"&&b.totalName?b.totalName:null}function q(b,u,g,o){return E(b,u,g,o||{})}function R(b,u){if(u)try{return u(b)}catch{}return b==null?"":String(b)}function j(b){const{handle:u,fn:g,leaves:o,by:t,labelOf:i,rowLabel:s}=b,r={locale:b.locale},n=o&&o.length?o:[],m=x(g),l=q(u,n,g,r),a=Q.has(m);let c;if(a){let y=-1;for(let h=0;h<n.length;h++){const d=q(u,[n[h]],g,r);if(Object.is(d,l)){y=n[h];break}}c=y<0?[]:[{key:y,indices:[y],label:s?s(y):String(y)}]}else if(t){const y=I([t],n);c=y.keys.map((h,d)=>({key:h[0],indices:y.buckets[d],label:R(h[0],i)}))}else c=Array.from({length:n.length},(y,h)=>{const d=n[h];return{key:d,indices:[d],label:s?s(d):String(d)}});const f=n.length,p=[];for(const y of c){const h=q(u,y.indices,g,r),d=y.indices.length;let w,v;if(m==="avg")w=((typeof h=="number"?h:0)-(typeof l=="number"?l:0))*d,v=f?d/f:0;else if(a)w=typeof h=="number"?h:0,v=1;else{w=typeof h=="number"?h:0;const P=typeof l=="number"?l:0;v=P?w/P:0}p.push({key:y.key,label:y.label,count:d,value:h,contribution:w,share:v})}return p.sort((y,h)=>Math.abs(h.contribution)-Math.abs(y.contribution)||(y.label<h.label?-1:y.label>h.label?1:0)),{total:l,fn:m,weighted:U.has(m),single:a,contributors:p}}function k(b){const u=j({...b,leaves:b.after}),g=j({...b,leaves:b.before}),o=typeof u.total=="number"?u.total:0,t=typeof g.total=="number"?g.total:0,i=new Map;for(const n of u.contributors)i.set(n.key,n);const s=[],r=new Set;for(const n of g.contributors){r.add(n.key);const m=i.get(n.key);if(m===void 0)s.push({key:n.key,label:n.label,before:n.value,after:null,effect:-n.contribution,kind:"dropped",count:n.count});else{const l=m.contribution-n.contribution;l!==0&&s.push({key:n.key,label:n.label,before:n.value,after:m.value,effect:l,kind:"changed",count:m.count})}}for(const n of u.contributors)r.has(n.key)||s.push({key:n.key,label:n.label,before:null,after:n.value,effect:n.contribution,kind:"new",count:n.count});return s.sort((n,m)=>Math.abs(m.effect)-Math.abs(n.effect)||(n.label<m.label?-1:n.label>m.label?1:0)),{before:g.total,after:u.total,delta:o-t,weighted:u.weighted||g.weighted,single:u.single||g.single,drivers:s}}}),_e("packages/core/src/store/bitset.js",function(e,F){"use strict";Object.defineProperty(e,"Bitset",{enumerable:!0,get:function(){return E}});const ie=8;class E{static#e=new Uint8Array(256);static{for(let I=1;I<256;I++)E.#e[I]=E.#e[I>>1]+(I&1)}#t;#n;constructor(I=0){const L=Math.max(0,I|0);this.#n=L,this.#t=new Uint8Array(Math.ceil(L/ie))}get size(){return this.#n}get words(){return this.#t}get bytes(){return this.#t?this.#t.byteLength:0}get(I){return I<0||I>=this.#n?0:this.#t[I>>3]>>(I&7)&1}set(I){return I>=0&&I<this.#n&&(this.#t[I>>3]|=1<<(I&7)),this}clear(I){return I>=0&&I<this.#n&&(this.#t[I>>3]&=~(1<<(I&7))),this}assign(I,L){return L?this.set(I):this.clear(I)}fill(I=!1){return this.#t.fill(I?255:0),I&&this.#r(),this}grow(I){const L=Math.max(0,I|0);if(L<=this.#n)return this;const Q=Math.ceil(L/ie);if(Q>this.#t.length){const U=new Uint8Array(Q);U.set(this.#t),this.#t=U}return this.#n=L,this}count(){const I=this.#t,L=E.#e;let Q=0;for(let U=0;U<I.length;U++)Q+=L[I[U]];return Q}and(I){const L=I instanceof E?I.words:I,Q=this.#t,U=Math.min(Q.length,L.length);for(let x=0;x<U;x++)Q[x]&=L[x];for(let x=U;x<Q.length;x++)Q[x]=0;return this}or(I){const L=I instanceof E?I.words:I,Q=this.#t,U=Math.min(Q.length,L.length);for(let x=0;x<U;x++)Q[x]|=L[x];return this}not(){const I=this.#t;for(let L=0;L<I.length;L++)I[L]=~I[L]&255;return this.#r(),this}clone(){const I=new E(this.#n);return I.words.set(this.#t.subarray(0,I.words.length)),I}release(){this.#t=new Uint8Array(0),this.#n=0}#r(){const I=this.#n&7;if(I===0)return;const L=this.#n>>3;L<this.#t.length&&(this.#t[L]&=(1<<I)-1)}static from(I){const L=Array.isArray(I)?I:Array.from(I),Q=new E(L.length);for(let U=0;U<L.length;U++)L[U]&&Q.set(U);return Q}}}),_e("packages/core/src/store/dictionary.js",function(e,F){"use strict";Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return I}});const ie=F("packages/core/src/internal/compare.js"),E=ie.collator,K=ie.defaultCompare;class I{#e;#t=new Map;#n=0;#r=null;#i=-1;#s="\0";constructor(Q=[]){this.#e=[];for(let U=0;U<Q.length;U++){const x=Q[U];this.#t.has(x)||(this.#t.set(x,this.#e.length),this.#e.push(x))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let Q=this.#e.length*8;for(let U=0;U<this.#e.length;U++){const x=this.#e[U];typeof x=="string"&&(Q+=x.length*2),Q+=16}return Q}codeOf(Q){const U=this.#t.get(Q);if(U!==void 0)return U;const x=this.#e.length;return this.#e.push(Q),this.#t.set(Q,x),this.#n++,x}lookup(Q){const U=this.#t.get(Q);return U===void 0?-1:U}has(Q){return this.#t.has(Q)}valueOf(Q){return this.#e[Q]}values(){return this.#e}ranks(Q){const U=Q||"";if(this.#r&&this.#i===this.#n&&this.#s===U)return this.#r;const x=this.#e.length,q=new Array(x);for(let b=0;b<x;b++)q[b]=b;const R=E(Q).compare,j=this.#e;q.sort((b,u)=>this.#a(j[b],j[u],R));const k=new Uint32Array(x);for(let b=0;b<x;b++)k[q[b]]=b;return this.#r=k,this.#i=this.#n,this.#s=U,k}#a(Q,U,x){return typeof Q=="string"&&typeof U=="string"?x(Q,U):K(Q,U)}}}),_e("packages/core/src/store/multivalue.js",function(e,F){"use strict";Object.defineProperty(e,"MultiValue",{enumerable:!0,get:function(){return ie}});class ie{#e;#t;#n=0;#r=0;constructor(K={}){const I=Math.max(1,K.rows??16),L=Math.max(1,K.values??I);this.#e=new Int32Array(L),this.#t=new Uint32Array(I+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,I){if(K<0||K>=this.#n)return!1;const L=this.#e,Q=this.#t[K+1];for(let U=this.#t[K];U<Q;U++)if(L[U]===I)return!0;return!1}hasAny(K,I){for(let L=0;L<I.length;L++)if(this.has(K,I[L]))return!0;return!1}hasAll(K,I){for(let L=0;L<I.length;L++)if(!this.has(K,I[L]))return!1;return!0}hasNone(K,I){return!this.hasAny(K,I)}push(K){const I=this.#n,L=K.length;this.#i(I+1),this.#s(this.#r+L);const Q=this.#r;for(let U=0;U<L;U++)this.#e[Q+U]=K[U]|0;return this.#r+=L,this.#n=I+1,this.#t[I]=Q,this.#t[I+1]=this.#r,I}write(K,I){if(K===this.#n){this.push(I);return}if(K<0||K>this.#n)return;const L=this.#t[K],Q=this.#t[K+1],U=I.length;if(Q-L===U){for(let x=0;x<U;x++)this.#e[L+x]=I[x]|0;return}this.#a(K,I)}compact(K,I,L){const Q=this.#e,U=this.#t,x=this.#n,q=new Int32Array(Math.max(1,this.#r)),R=new Uint32Array(I+1);let j=0;for(let k=0;k<x;k++){if(K[k]===L)continue;const b=U[k],u=U[k+1];R[K[k]]=j;for(let g=b;g<u;g++)q[j++]=Q[g];R[K[k]+1]=j}this.#e=q,this.#t=R,this.#n=I,this.#r=j}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#i(K){if(K+1<=this.#t.length)return;let I=this.#t.length-1;for(;I<K;)I=I*2||16;const L=new Uint32Array(I+1);L.set(this.#t),this.#t=L}#s(K){if(K<=this.#e.length)return;let I=this.#e.length;for(;I<K;)I=I*2||16;const L=new Int32Array(I);L.set(this.#e),this.#e=L}#a(K,I){const L=this.#e,Q=this.#t,U=this.#n,x=I.length-(Q[K+1]-Q[K]),q=new Int32Array(Math.max(1,this.#r+x)),R=new Uint32Array(Q.length);let j=0;for(let k=0;k<U;k++){if(R[k]=j,k===K)for(let b=0;b<I.length;b++)q[j++]=I[b]|0;else for(let b=Q[k];b<Q[k+1];b++)q[j++]=L[b];R[k+1]=j}this.#e=q,this.#t=R,this.#r=j}}}),_e("packages/core/src/compute/sort.js",function(e,F){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return T}});const ie=F("packages/core/src/compute/handle.js"),E=ie.bitReader,K=ie.dictRanks,I=ie.dictSize,L=ie.identity,Q=ie.isMissing,U=ie.presenceReader,x=ie.rowCount,q=ie.valueComparator,R=ie.valueReader,j=new Uint32Array(0),k=new ArrayBuffer(8),b=new Float64Array(k),u=new Uint32Array(k),g=(b[0]=-1,(u[1]&2147483648)!==0?1:0),o=g===1?0:1;function t(O,M){b[0]=O;let A=u[g],N=u[o];(A&2147483648)!==0?(A=~A>>>0,N=~N>>>0):A=(A^2147483648)>>>0,M[0]=N,M[1]=A}function i(O,M,A,N){if(N<2)return O;const $=new Uint32Array(256*8);for(let X=0;X<N;X++){const ne=M[X],se=A[X];$[ne&255]++,$[256+(ne>>>8&255)]++,$[512+(ne>>>16&255)]++,$[768+(ne>>>24&255)]++,$[1024+(se&255)]++,$[1280+(se>>>8&255)]++,$[1536+(se>>>16&255)]++,$[1792+(se>>>24&255)]++}let H=O,Y=M,Z=A,J=new Uint32Array(N),D=new Uint32Array(N),te=new Uint32Array(N);const z=new Uint32Array(256);for(let X=0;X<8;X++){const ne=X<<8,se=(X&3)<<3,ue=X>=4;let ge=!1;for(let Ie=0;Ie<256;Ie++)if($[ne+Ie]===N){ge=!0;break}if(ge)continue;let Oe=0;for(let Ie=0;Ie<256;Ie++)z[Ie]=Oe,Oe+=$[ne+Ie];for(let Ie=0;Ie<N;Ie++){const xe=Y[Ie],ye=Z[Ie],re=(ue?ye:xe)>>>se&255,fe=z[re]++;J[fe]=H[Ie],D[fe]=xe,te[fe]=ye}let Pe=H;H=J,J=Pe,Pe=Y,Y=D,D=Pe,Pe=Z,Z=te,te=Pe}return H}function s(O,M,A){if(A<2)return O;const N=new Uint32Array(256*4);for(let D=0;D<A;D++){const te=M[D];N[te&255]++,N[256+(te>>>8&255)]++,N[512+(te>>>16&255)]++,N[768+(te>>>24&255)]++}let $=O,H=M,Y=new Uint32Array(A),Z=new Uint32Array(A);const J=new Uint32Array(256);for(let D=0;D<4;D++){const te=D<<8,z=D<<3;let X=!1;for(let ue=0;ue<256;ue++)if(N[te+ue]===A){X=!0;break}if(X)continue;let ne=0;for(let ue=0;ue<256;ue++)J[ue]=ne,ne+=N[te+ue];for(let ue=0;ue<A;ue++){const ge=H[ue],Oe=J[ge>>>z&255]++;Y[Oe]=$[ue],Z[Oe]=ge}let se=$;$=Y,Y=se,se=H,H=Z,Z=se}return $}function r(O,M,A,N){const $=new Uint32Array(N+1);for(let Z=0;Z<A;Z++)$[M[Z]]++;let H=0;for(let Z=0;Z<=N;Z++){const J=$[Z];$[Z]=H,H+=J}const Y=new Uint32Array(A);for(let Z=0;Z<A;Z++)Y[$[M[Z]]++]=O[Z];return Y}function n(O,M,A,N){return A<2?O:N<=65536||N<=A*2?r(O,M,A,N):s(O,M,A)}function m(O,M){return O.length===M&&O.byteOffset===0?O:Uint32Array.prototype.slice.call(O,0,M)}function l(O,M,A=!1){const N=M||L(O.length),$=N.length;if($<2)return Uint32Array.from(N);const H=new Uint32Array($),Y=new Uint32Array($),Z=new Uint32Array($),J=new Uint32Array($),D=new Uint32Array(2);let te=0,z=0;for(let se=0;se<$;se++){const ue=N[se],ge=O[ue];if(Number.isNaN(ge)){J[z++]=ue;continue}t(ge,D),A?(Y[te]=~D[0]>>>0,Z[te]=~D[1]>>>0):(Y[te]=D[0],Z[te]=D[1]),H[te++]=ue}const X=i(H.subarray(0,te),Y.subarray(0,te),Z.subarray(0,te),te);if(z===0)return m(X,te);const ne=new Uint32Array($);return ne.set(X.subarray(0,te),0),ne.set(J.subarray(0,z),te),ne}function a(O,M,A=!1){const N=M||L(O.length),$=N.length;if($<2)return Uint32Array.from(N);const H=Uint32Array.from(N),Y=new Uint32Array($);for(let Z=0;Z<$;Z++){const J=(O[H[Z]]^2147483648)>>>0;Y[Z]=A?~J>>>0:J}return m(s(H,Y,$),$)}function c(O,M,A={}){const N=M||L(x(O,A)),$=N.length;if($<2)return Uint32Array.from(N);const H=K(O.dict,A.locale),Y=O.values,Z=U(O),J=Math.max(I(O.dict),H.length),D=J,te=Uint32Array.from(N),z=new Uint32Array($),X=!!A.descending;for(let ne=0;ne<$;ne++){const se=te[ne];let ue=Z&&Z(se)===0?D:H[Y[se]];ue===void 0&&(ue=D),z[ne]=X?D-ue:ue}return m(n(te,z,$,J+1),$)}function f(O,M,A){const N=M.length;let $=Uint32Array.from(M);if(N<2)return $;let H=new Uint32Array(N);for(let Y=1;Y<N;Y<<=1){for(let J=0;J<N;J+=Y<<1){const D=Math.min(J+Y,N),te=Math.min(J+(Y<<1),N);let z=J,X=D,ne=J;for(;z<D&&X<te;)H[ne++]=A(O[$[z]],O[$[X]])<=0?$[z++]:$[X++];for(;z<D;)H[ne++]=$[z++];for(;X<te;)H[ne++]=$[X++]}const Z=$;$=H,H=Z}return $}function p(O,M,A){const N=E(O.values),$=M.length,H=new Uint32Array($),Y=A?1:0;let Z=0;for(let J=0;J<$;J++)N(M[J])===Y&&(H[Z++]=M[J]);for(let J=0;J<$;J++)N(M[J])!==Y&&(H[Z++]=M[J]);return H}function y(O,M){const A=O.values,N=O.kind;if((N==="object"||N===void 0)&&(Array.isArray(A)||ArrayBuffer.isView(A))&&!O.presence)return A;const H=R(O),Y=new Array(x(O)||0);for(let Z=0;Z<M.length;Z++){const J=M[Z];Y[J]=H(J)}return Y}function h(O,M){for(let A=0;A<M.length;A++)if(typeof O[M[A]]!="string")return!1;return!0}function d(O,M,A,N,$){const H=O.length,Y=Uint32Array.from(O);if(H<2||N<1)return Y;const Z=new Uint32Array(H),J=N-1;for(let D=0;D<H;D++){const te=A[M[D]];Z[D]=$?J-te:te}return m(n(Y,Z,H,N),H)}function w(O,M,A){const N=q(A),$=new Array(M);for(let Y=0;Y<M;Y++)$[Y]=Y;$.sort((Y,Z)=>N(O[Y],O[Z])||Y-Z);const H=new Uint32Array(M);for(let Y=0;Y<M;Y++)H[$[Y]]=Y;return H}function v(O,M,A){const N=M.length,$=new Map,H=[],Y=new Uint32Array(N);for(let D=0;D<N;D++){const te=O[M[D]];let z=$.get(te);z===void 0&&(z=H.length,$.set(te,z),H.push(te)),Y[D]=z}const Z=H.length,J=w(H,Z,A.locale);return d(M,Y,J,Z,!!A.descending)}function P(O,M,A){const N=y(O,M);if(M.length>=2&&h(N,M)){const Y=O.stringRank;return Y&&Y.version===O.version&&Y.usable(M,N,A.locale)?Y.sort(M,A):v(N,M,A)}const $=q(A.locale),H=A.descending?(Y,Z)=>$(Z,Y):$;return f(N,M,H)}function W(O,M,A){const N=y(O,M),$=A.compare,Y=!!A.descending?(Z,J)=>-$(Z,J,void 0,void 0,!0):(Z,J)=>$(Z,J,void 0,void 0,!1);return f(N,M,Y)}function V(O,M){const A=M.length,N=U(O),$=O.values,H=O.kind==="float64"&&!!$,Y=O.kind==="object"||O.kind==="multi"||O.kind===void 0;if(!N&&!H&&!Y)return{present:M,absent:j};const Z=new Uint32Array(A),J=new Uint32Array(A);let D=0,te=0;if(N&&H)for(let z=0;z<A;z++){const X=M[z];N(X)===1&&!Number.isNaN($[X])?Z[D++]=X:J[te++]=X}else if(H&&!N)for(let z=0;z<A;z++){const X=M[z];Number.isNaN($[X])?J[te++]=X:Z[D++]=X}else if(N&&!Y)for(let z=0;z<A;z++){const X=M[z];N(X)===1?Z[D++]=X:J[te++]=X}else{const z=R(O);for(let X=0;X<A;X++){const ne=M[X];Q(z(ne))?J[te++]=ne:Z[D++]=ne}}return te===0?{present:M,absent:j}:{present:Z.subarray(0,D),absent:J.subarray(0,te)}}function G(O,M,A){if(M.length===0)return O;const N=new Uint32Array(O.length+M.length);return A?(N.set(M,0),N.set(O,M.length)):(N.set(O,0),N.set(M,O.length)),N}function _(O,M,A={}){const N=M||L(x(O,A));if(!O||N.length<2)return Uint32Array.from(N);const{present:$,absent:H}=V(O,N);if($.length===0)return Uint32Array.from(N);const Y=!!A.descending;let Z;if(typeof A.compare=="function")Z=W(O,$,A);else switch(O.kind){case"float64":Z=l(O.values,$,Y);break;case"int32":Z=a(O.values,$,Y);break;case"dictionary":Z=c(O,$,A);break;case"bitset":Z=p(O,$,Y);break;default:Z=P(O,$,A);break}return G(Z,H,!!A.nullsFirst)}function T(O,M,A,N={}){const $=M||[],H=$.length&&($[0].handle||S(O,$[0].col))||O&&O[0];let Y=A||L(x(H,N));for(let Z=$.length-1;Z>=0;Z--){const J=$[Z],D=J.handle||S(O,J.col)||O&&O[Z];D&&(Y=_(D,Y,{descending:J.descending!==void 0?!!J.descending:J.dir==="desc",nullsFirst:!!J.nullsFirst,locale:J.locale!==void 0?J.locale:N.locale,compare:J.compare}))}return Y instanceof Uint32Array?Y:Uint32Array.from(Y)}function S(O,M){if(!(!O||M===void 0)){for(let A=0;A<O.length;A++)if(O[A]&&O[A].id===M)return O[A]}}}),_e("packages/core/src/store/stringrank.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_MAX_DISTINCT",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"StringRankIndex",{enumerable:!0,get:function(){return L}});const ie=F("packages/core/src/compute/sort.js"),E=ie.collateStringRanks,K=ie.rankSortStrings,I=1e5;class L{#e=[];#t=new Map;#n;#r=0;#i=0;#s=-1;#a;#l=!1;#o=null;#c=-1;#u="\0";constructor(U=I){this.#a=U>0?U:I,this.#n=new Uint32Array(0)}get version(){return this.#s}set version(U){this.#s=U}get generation(){return this.#i}get size(){return this.#e.length}get capped(){return this.#l}get length(){return this.#r}get bytes(){let U=this.#n.byteLength;const x=this.#e;for(let q=0;q<x.length;q++)U+=x[q].length*2+24;return U}#f(U,x){const q=this.#t.get(U);if(q!==void 0)return q;if(this.#l)return-1;if(x&&this.#e.length>=this.#a)return this.#l=!0,-1;const R=this.#e.length;return this.#e.push(U),this.#t.set(U,R),this.#i++,R}build(U,x){const q=x|0;this.#e=[],this.#t=new Map,this.#i=0,this.#l=!1,this.#o=null,this.#c=-1,this.#n=new Uint32Array(q);for(let R=0;R<q;R++){const j=U[R],k=typeof j=="string"?this.#f(j,!1):-1;this.#n[R]=k<0?0:k}this.#r=q}append(U,x,q){const R=(x|0)+(q|0);if(R>this.#n.length){const j=new Uint32Array(R);j.set(this.#n.subarray(0,this.#r)),this.#n=j}for(let j=x|0;j<R;j++){const k=U[j],b=typeof k=="string"?this.#f(k,!0):-1;this.#n[j]=b<0?0:b}this.#r=Math.max(this.#r,R)}ranks(U){const x=U||"";if(this.#o&&this.#c===this.#i&&this.#u===x)return this.#o;const q=E(this.#e,this.#e.length,U);return this.#o=q,this.#c=this.#i,this.#u=x,q}usable(U,x,q){if(this.#l||this.#e.length===0)return!1;const R=this.#n,j=this.#e,k=this.#r;for(let b=0;b<U.length;b++){const u=U[b];if(u>=k||j[R[u]]!==x[u])return!1}return!0}sort(U,x){const q=this.ranks(x.locale),R=this.#e.length,j=U.length,k=new Uint32Array(j),b=this.#n;for(let u=0;u<j;u++)k[u]=b[U[u]];return K(U,k,q,R,!!x.descending)}}}),_e("packages/core/src/store/columnstore.js",function(e,F){"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 f}}),Object.defineProperty(e,"ColumnStore",{enumerable:!0,get:function(){return p}});const E=F("packages/core/src/internal/warn.js").warnOnce,I=F("packages/core/src/internal/predicates.js").isFunction,Q=F("packages/core/src/internal/paths.js").pathGetter,x=F("packages/core/src/store/bitset.js").Bitset,R=F("packages/core/src/store/dictionary.js").Dictionary,k=F("packages/core/src/store/multivalue.js").MultiValue,u=F("packages/core/src/store/stringrank.js").StringRankIndex,g=4294967295,o=1024,t=5e3,i=.2,s=new Set(["float64","int32","bitset","dictionary","object","multi"]);function r(y){return y==null}function n(y){return typeof y=="number"?y:y instanceof Date?y.getTime():typeof y=="boolean"?y?1:0:Number(y)}function m(y){const h=n(y);return Number.isFinite(h)?h|0:0}function l(y){return r(y)?[]:Array.isArray(y)?y:[y]}function a(y,h){switch(y.kind){case"float64":case"int32":return y.buf[h];case"bitset":return y.bits.get(h)===1;case"dictionary":return y.dict.valueOf(y.buf[h]);case"multi":{const d=y.mv.at(h),w=new Array(d.length);for(let v=0;v<d.length;v++)w[v]=y.dict.valueOf(d[v]);return w}default:return y.buf[h]}}function c(y,h){switch(y.kind){case"float64":case"int32":return y.values[h];case"bitset":return(y.values[h>>3]&1<<(h&7))!==0;case"dictionary":return(y.table||[])[y.values[h]];case"multi":{const d=y.offsets[h],w=y.offsets[h+1],v=y.table||[],P=new Array(w-d);for(let W=d;W<w;W++)P[W-d]=v[y.values[W]];return P}default:return y.values[h]}}class f{#e;#t;#n;#r;#i;#s;#a;#l=!1;#o=null;#c=null;#u=null;#f=null;#d=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#O=null;#w=null;#A=!1;constructor(h,d){this.#e=h.id;const w=s.has(h.kind)?h.kind:"object";h.kind&&!s.has(h.kind)&&E(`store.kind.${h.id}`,`column "${h.id}" declares unknown storage kind "${h.kind}"; falling back to object`),this.#n=w,this.#t=w,this.#r=h.nullable!==!1,this.#a=h.dictionary??null,this.#s=d,this.#i=I(h.read)?h.read:Q(h.field||h.id),this.#h=h.stringRankIndex!=="off",this.#p=typeof h.stringRankMaxDistinct=="number"?h.stringRankMaxDistinct:0,this.#O=new Map}get id(){return this.#e}get kind(){return this.#l?this.#t:"object"}get target(){return this.#n}get nullable(){return this.#r}get values(){return this.#A?null:this.#l?this.#t==="bitset"?this.#c.words:this.#t==="multi"?this.#u.values:this.#o:this.#T().values}get presence(){return this.#A||!this.#r?null:this.#l?this.#g:this.#T().presence}get dict(){return this.#A||!this.#l?null:this.#t==="dictionary"||this.#t==="multi"?this.#f:null}get stringRank(){if(this.#A||!this.#h||this.kind!=="object")return null;const h=this.values,d=this.#s.physical();if(!h||d===0)return null;if(this.#d===null){if(typeof h[0]!="string")return null;const w=new u(this.#v());return w.build(h,d),w.version=this.#y,this.#d=w,this.#m=this.#y,w.capped?null:w}return this.#d.length<d&&this.#d.append(h,this.#d.length,d-this.#d.length),this.#d.version=this.#y,this.#m=this.#y,this.#d.capped?null:this.#d}#v(){return this.#p}#P(){this.#d=null,this.#m=-1}get offsets(){return this.#A||!this.#l||this.#t!=="multi"?null:this.#u.offsets}get version(){return this.#y}get bytes(){let h=0;return this.#o&&(h+=this.#o.byteLength??this.#o.length*8),this.#c&&(h+=this.#c.bytes),this.#u&&(h+=this.#u.bytes),this.#g&&(h+=this.#g.bytes),this.#f&&(h+=this.#f.bytes),this.#O&&(h+=this.#O.size*24),h}get(h){if(!this.#A&&!(h<0||h>=this.#s.physical())){if(!this.#l)return this.#E(h);if(this.#r&&this.#g.get(h)===0)return null;switch(this.#t){case"float64":case"int32":return this.#o[h];case"bitset":return this.#c.get(h)===1;case"dictionary":return this.#f.valueOf(this.#o[h]);case"multi":{const d=this.#u.at(h),w=new Array(d.length);for(let v=0;v<d.length;v++)w[v]=this.#f.valueOf(d[v]);return w}default:return this.#o[h]}}}set(h,d){this.#A||(this.#l?this.#C(h,d):this.#O.set(h,d===void 0?null:d),this.#d&&this.#P(),this.#y++)}read(h){return this.#i(h)}appendColumn(h,d,w){if(this.#A||w<=0)return;if(!this.#l){this.#y++;return}const v=this.#i,P=this.#r,W=this.#g;let V=!1;switch(this.#t){case"float64":{const G=this.#o;for(let _=0;_<w;_++){const T=v(h[_]);if(typeof T=="number"){P&&W.set(d+_),G[d+_]=T;continue}const S=T==null;P?W.assign(d+_,!S):S&&(V=!0),G[d+_]=S?NaN:n(T)}break}case"int32":{const G=this.#o;for(let _=0;_<w;_++){const T=v(h[_]),S=T==null;P?W.assign(d+_,!S):S&&(V=!0),G[d+_]=S?0:m(T)}break}case"bitset":{const G=this.#c;for(let _=0;_<w;_++){const T=v(h[_]),S=T==null;P?W.assign(d+_,!S):S&&(V=!0),G.assign(d+_,!S&&!!T)}break}case"dictionary":{const G=this.#o,_=this.#f;for(let T=0;T<w;T++){const S=v(h[T]),O=S==null;P?W.assign(d+T,!O):O&&(V=!0),G[d+T]=O?0:_.codeOf(S)}break}case"multi":{const G=this.#u,_=this.#f;for(let T=0;T<w;T++){const S=v(h[T]),O=S==null;P?W.assign(d+T,!O):O&&(V=!0);const M=l(S),A=new Array(M.length);for(let N=0;N<M.length;N++)A[N]=_.codeOf(M[N]);G.write(d+T,A)}break}default:{const G=this.#o;for(let _=0;_<w;_++){const T=v(h[_]),S=T==null;P?W.assign(d+_,!S):S&&(V=!0),G[d+_]=S?null:T}break}}V&&E(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#d&&this.#t==="object"&&(this.#d.append(this.#o,d,w),this.#d.version=this.#y+1,this.#m=this.#y+1),this.#y++}appendPacked(h,d,w){if(this.#A||w<=0||!h)return;if(!this.#l){this.#y++;return}const v=this.#g,P=h.presence;if(v)if(P)for(let V=0;V<w;V++)v.assign(d+V,(P[V>>3]&1<<(V&7))!==0);else for(let V=0;V<w;V++)v.set(d+V);const W=h.kind===this.#t;if(W&&(this.#t==="float64"||this.#t==="int32")){this.#o.set(h.values,d),this.#y++;return}if(W&&this.#t==="bitset"){const V=h.values;for(let G=0;G<w;G++)this.#c.assign(d+G,(V[G>>3]&1<<(G&7))!==0);this.#y++;return}if(W&&this.#t==="dictionary"){const V=h.table||[],G=new Uint32Array(V.length);for(let O=0;O<V.length;O++)G[O]=this.#f.codeOf(V[O]);const _=h.values,T=this.#o,S=v;for(let O=0;O<w;O++){if(S&&(P&&(P[O>>3]&1<<(O&7))===0)){T[d+O]=0;continue}T[d+O]=G[_[O]]??0}this.#y++;return}if(W&&this.#t==="multi"){const V=h.table||[],G=new Uint32Array(V.length);for(let S=0;S<V.length;S++)G[S]=this.#f.codeOf(V[S]);const _=h.values,T=h.offsets;for(let S=0;S<w;S++){const O=T[S],M=T[S+1],A=new Array(M-O);for(let N=O;N<M;N++)A[N-O]=G[_[N]]??0;this.#u.write(d+S,A)}this.#y++;return}for(let V=0;V<w;V++){const G=P?(P[V>>3]&1<<(V&7))===0:h.kind==="object"?h.values[V]===null:!1;this.#C(d+V,G?null:c(h,V))}this.#y++}touch(){this.#y++}columnarise(h,d){if(this.#l||this.#A)return;const w=new Array(d);for(let v=0;v<d;v++)w[v]=this.#E(v);this.#t=this.#n,this.#l=!0,this.#S(h);for(let v=0;v<d;v++)this.#C(v,w[v]);this.#O.clear(),this.#w=null,this.#P(),this.#y++}grow(h){if(!(!this.#l||this.#A||h<=this.#b)){switch(this.#t){case"float64":case"int32":case"dictionary":{const d=new this.#o.constructor(h);d.set(this.#o),this.#o=d;break}case"bitset":this.#c.grow(h);break;case"multi":break;default:this.#o.length=h;break}this.#g&&this.#g.grow(h),this.#b=h,this.#y++}}convert(h){if(this.#A||!s.has(h)||(this.#n=h,!this.#l||h===this.#t))return!1;const d={kind:this.#t,buf:this.#o,bits:this.#c,mv:this.#u,dict:this.#f},w=this.#s.physical(),v=this.#g;this.#t=h,this.#S(this.#b);for(let P=0;P<w;P++){const W=v!==null&&v.get(P)===0;W&&h!=="multi"||this.#C(P,W?null:a(d,P))}return this.#P(),this.#y++,!0}compact(h,d,w){if(!this.#A){if(this.#P(),!this.#l){const v=this.#O;if(v.size){const P=new Map;for(const[W,V]of v)h[W]!==g&&P.set(h[W],V);this.#O=P}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const v=this.#o;for(let P=0;P<d;P++)h[P]!==g&&(v[h[P]]=v[P]);if(this.#t==="object")for(let P=w;P<d;P++)v[P]=void 0;break}case"bitset":{const v=this.#c;for(let P=0;P<d;P++)h[P]!==g&&v.assign(h[P],v.get(P)===1);for(let P=w;P<d;P++)v.clear(P);break}case"multi":this.#u.compact(h,w,g);break;default:break}if(this.#g){const v=this.#g;for(let P=0;P<d;P++)h[P]!==g&&v.assign(h[P],v.get(P)===1);for(let P=w;P<d;P++)v.clear(P)}this.#y++}}release(){this.#A||(this.#A=!0,this.#o=null,this.#c&&this.#c.release(),this.#c=null,this.#u&&this.#u.release(),this.#u=null,this.#g&&this.#g.release(),this.#g=null,this.#f=null,this.#d=null,this.#O=new Map,this.#w=null,this.#b=0,this.#y++)}#S(h){const d=Math.max(1,h);switch(this.#o=null,this.#c=null,this.#u=null,this.#t){case"float64":this.#o=new Float64Array(d);break;case"int32":this.#o=new Int32Array(d);break;case"bitset":this.#c=new x(d);break;case"dictionary":this.#o=new Uint32Array(d),this.#f=this.#f??new R(this.#a??[]);break;case"multi":this.#u=new k({rows:d,values:d}),this.#f=this.#f??new R(this.#a??[]);break;default:this.#o=new Array(d);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#f=null),this.#r&&(this.#g?this.#g.grow(d):this.#g=new x(d)),this.#b=d}#C(h,d){const w=r(d);switch(this.#r?this.#g.assign(h,!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.#o[h]=w?NaN:n(d);break;case"int32":this.#o[h]=w?0:m(d);break;case"bitset":this.#c.assign(h,!w&&!!d);break;case"dictionary":this.#o[h]=w?0:this.#f.codeOf(d);break;case"multi":{const v=l(d),P=new Array(v.length);for(let W=0;W<v.length;W++)P[W]=this.#f.codeOf(v[W]);this.#u.write(h,P);break}default:this.#o[h]=w?null:d;break}}#E(h){if(this.#O.has(h))return this.#O.get(h);const d=this.#i(this.#s.rowAt(h));return d===void 0?null:d}#T(){if(this.#w&&this.#w.version===this.#y)return this.#w;const h=this.#s.physical(),d=new Array(h),w=this.#r?new x(h):null;for(let v=0;v<h;v++){const P=this.#E(v);d[v]=P,w&&!r(P)&&w.set(v)}return this.#w={version:this.#y,values:d,presence:w},this.#w}}class p{#e;#t=new Map;#n=[];#r=[];#i=0;#s=0;#a=0;#l=0;#o=new x(0);#c=!1;#u=!0;#f;#d;#h;#p=!1;constructor(h,d={}){this.#e=Array.isArray(h)?h:[],this.#d=Math.max(1,d.initialCapacity??o),this.#u=d.retainSource!==!1,this.#f=this.#u?d.columnarBelow??t:0,this.#h=d.compactRatio??i;const w={rowAt:v=>this.#r[v],physical:()=>this.#i};for(const v of this.#e){if(!v||!v.id)continue;if(this.#t.has(v.id)){E(`store.dup.${v.id}`,`duplicate column id "${v.id}" in the store schema; ignoring the second`);continue}const P=new f(v,w);this.#t.set(v.id,P),this.#n.push(P)}this.#f<=0&&this.#b()}get count(){return this.#a}get physical(){return this.#i}get capacity(){return this.#c?this.#s:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let h=this.#o.bytes+this.#r.length*8;for(const d of this.#n)h+=d.bytes;return h}append(h){const d=this.#i;if(this.#p||!h)return{from:d,to:d};const w=h.length|0;if(w===0)return{from:d,to:d};if(this.#u)for(let P=0;P<w;P++)this.#r[d+P]=h[P];if(this.#i=d+w,this.#a+=w,this.#o.grow(this.#i),!this.#c){if(this.#i>=this.#f)this.#b();else for(const P of this.#n)P.touch();return{from:d,to:this.#i}}this.#m(this.#i);const v=this.#n;for(let P=0;P<v.length;P++)v[P].appendColumn(h,d,w);return{from:d,to:this.#i}}appendPacked(h,d){const w=this.#i;if(this.#p||!h)return{from:w,to:w};const v=h.count|0;if(v===0)return{from:w,to:w};if(this.#u&&d)for(let W=0;W<v;W++)this.#r[w+W]=d[W];this.#i=w+v,this.#a+=v,this.#o.grow(this.#i),this.#c||this.#b(),this.#m(this.#i);const P=new Map;for(const W of h.columns)P.set(W.id,W);for(const W of this.#n){const V=P.get(W.id);V?W.appendPacked(V,w,v):W.grow(this.#s)}return{from:w,to:this.#i}}source(h){if(this.#u)return this.#r[h];if(!(h<0||h>=this.#i))return this.#g(h)}setSource(h,d){this.#p||h<0||h>=this.#i||this.#u&&(this.#r[h]=d)}get(h,d){const w=this.#t.get(h);return w?w.get(d):void 0}set(h,d,w){if(this.#p||d<0||d>=this.#i)return;const v=this.#t.get(h);if(!v){E(`store.set.${h}`,`set() on unknown column "${h}"`);return}v.set(d,w)}remove(h){return this.#p||h<0||h>=this.#i||this.#o.get(h)===1?!1:(this.#o.set(h),this.#l++,this.#a--,!0)}live(h){return h<0||h>=this.#i?!1:this.#o.get(h)===0}compact(h={}){if(this.#p||this.#l===0||!h.force&&this.#l/this.#i<this.#h)return null;const d=this.#i,w=new Uint32Array(d);let v=0;for(let P=0;P<d;P++)w[P]=this.#o.get(P)===1?g:v++;for(const P of this.#n)P.compact(w,d,v);if(this.#u){const P=this.#r;for(let W=0;W<d;W++)w[W]!==g&&(P[w[W]]=P[W]);P.length=v}return this.#i=v,this.#a=v,this.#l=0,this.#o=new x(Math.max(this.#s,v)),w}column(h){return this.#t.get(h)}columns(){return this.#n.slice()}liveIndices(){const h=new Uint32Array(this.#a);if(this.#l===0){for(let w=0;w<this.#i;w++)h[w]=w;return h}let d=0;for(let w=0;w<this.#i;w++)this.#o.get(w)===0&&(h[d++]=w);return h}convert(h,d){const w=this.#t.get(h);return w?w.convert(d):!1}destroy(){if(!this.#p){this.#p=!0;for(const h of this.#n)h.release();this.#t.clear(),this.#n.length=0,this.#r.length=0,this.#o.release(),this.#i=0,this.#a=0,this.#l=0,this.#s=0}}#m(h){if(h<=this.#s)return;let d=this.#s||this.#d;for(;d<h;)d*=2;for(const w of this.#n)w.grow(d);this.#o.grow(d),this.#s=d}#g(h){const d={};for(const w of this.#n)d[w.id]=w.get(h);return d}#b(){if(this.#c)return;let h=this.#d;for(;h<this.#i;)h*=2;this.#c=!0,this.#s=h,this.#o.grow(h);for(const d of this.#n)d.columnarise(h,this.#i)}}}),_e("packages/core/src/store/pool.js",function(e,F){"use strict";Object.defineProperty(e,"MaskPool",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"sharedPool",{enumerable:!0,get:function(){return L}});const ie=64,E=8;function K(U){let x=ie;for(;x<U;)x*=2;return x}class I{#e=new Map;#t=new WeakSet;#n;#r=0;#i={acquired:0,reused:0,released:0};constructor(x={}){this.#n=x.limit??E}get bytes(){return this.#r}mask(x){const q=new Uint8Array(this.#s(x),0,x);return q.fill(0),q}indices(x){return new Uint32Array(this.#s(x*4),0,x)}release(x){if(!x||!x.buffer)return!1;const q=x.buffer;if(!this.#t.has(q))return!1;this.#t.delete(q),this.#i.released++;const R=q.byteLength;let j=this.#e.get(R);return j||this.#e.set(R,j=[]),j.length>=this.#n||(j.push(q),this.#r+=R),!0}releaseAll(x){for(const q of x)this.release(q)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#i,retained:this.#r}}#s(x){const q=K(x),R=this.#e.get(q);this.#i.acquired++;let j;return R&&R.length?(j=R.pop(),this.#r-=q,this.#i.reused++):j=new ArrayBuffer(q),this.#t.add(j),j}}function L(){return Q??=new I,Q}let Q=null}),_e("packages/core/src/compute/sortspec.js",function(e,F){"use strict";Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return ie}}),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 I}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return L}});function ie(Q){return{locale:Q===void 0?void 0:String(Q),numeric:!0,sensitivity:"variant"}}function E(Q){return!!Q&&typeof Q.compare!="function"}function K(Q){if(!Q)return!0;for(let U=0;U<Q.length;U++)if(!E(Q[U]))return!1;return!0}function I(Q,U){const x=Q.col!==void 0?Q.col:Q.handle&&Q.handle.id,q=Q.locale!==void 0?Q.locale:U;return{col:x,descending:Q.descending!==void 0?!!Q.descending:Q.dir==="desc",nullsFirst:!!Q.nullsFirst,collation:ie(q)}}function L(Q,U){const x=Q||[],q=new Array(x.length);for(let R=0;R<x.length;R++)q[R]=I(x[R],U);return q}}),_e("packages/core/src/compute/facet.js",function(e,F){"use strict";Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return R}}),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 b}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return w}});const ie=F("packages/core/src/compute/handle.js"),E=ie.presenceReader,K=ie.valueReader,I=ie.dictSize,L=ie.dictValue,Q=Object.freeze(["equal","quantile","log"]),U=Object.freeze(["hour","day","week","month","quarter","year"]),x=20,q=50,R=1e4;function j(v,P){if(!v)return"none";const W=P;if(W&&(W.multi===!0||typeof W.items=="function"))return"category";const V=P&&P.base;if(V==="date"||V==="datetime"||V==="time"||V==="dateString")return"date";switch(v.kind){case"bitset":return"boolean";case"float64":case"int32":return"numeric";case"dictionary":return"category";case"multi":return"category";default:return V==="number"?"numeric":V==="boolean"?"boolean":V==="text"?"category":"none"}}function k(v){const P=v.values,W=v.kind;if((W==="float64"||W==="int32")&&P)return G=>P[G];const V=K(v);return G=>b(V(G))}function b(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 P=Number(v);if(Number.isFinite(P))return P;const W=Date.parse(v);return Number.isFinite(W)?W:NaN}return NaN}function u(v,P,W,V=q){if(!v)return{cardinality:0,exact:!0};if(v.dict)return{cardinality:I(v.dict),exact:!0};if(v.kind==="bitset")return{cardinality:2,exact:!0};const G=K(v),_=P?P.length:W,T=new Set;for(let S=0;S<_;S++){const O=G(P?P[S]:S);if(O!=null&&(T.add(O),T.size>V))return{cardinality:T.size,exact:!1}}return{cardinality:T.size,exact:!0}}const g=36e5,o=864e5;function t(v,P=x){const W=Number.isFinite(v)&&v>0?v:0,V=Math.max(1,P)*2;return W/g<=V?"hour":W/o<=V?"day":W/(7*o)<=V?"week":W/(30*o)<=V?"month":W/(91*o)<=V?"quarter":"year"}function i(v,P){if(!Number.isFinite(v))return NaN;const W=new Date(v);switch(P){case"hour":return W.setMinutes(0,0,0),W.getTime();case"day":return W.setHours(0,0,0,0),W.getTime();case"week":{W.setHours(0,0,0,0);const V=(W.getDay()+6)%7;return W.setDate(W.getDate()-V),W.getTime()}case"month":return W.setDate(1),W.setHours(0,0,0,0),W.getTime();case"quarter":return W.setMonth(Math.floor(W.getMonth()/3)*3,1),W.setHours(0,0,0,0),W.getTime();default:return W.setMonth(0,1),W.setHours(0,0,0,0),W.getTime()}}function s(v,P){const W=new Date(v);switch(P){case"hour":W.setHours(W.getHours()+1);break;case"day":W.setDate(W.getDate()+1);break;case"week":W.setDate(W.getDate()+7);break;case"month":W.setMonth(W.getMonth()+1);break;case"quarter":W.setMonth(W.getMonth()+3);break;default:W.setFullYear(W.getFullYear()+1);break}return W.getTime()}function r(v,P,W){const V=k(v),G=E(v),_=P?P.length:W;let T=1/0,S=-1/0,O=0,M=0;for(let A=0;A<_;A++){const N=P?P[A]:A;if(G&&!G(N)){O++;continue}const $=V(N);if(!Number.isFinite($)){O++;continue}$<T&&(T=$),$>S&&(S=$),M++}return{min:T,max:S,nulls:O,finite:M}}function n(v,P,W,V){const G=k(v),_=E(v),T=P?P.length:W,S=T>V?T/V:1,O=[];for(let A=0;A<T;A+=S){const N=P?P[Math.floor(A)]:Math.floor(A);if(_&&!_(N))continue;const $=G(N);Number.isFinite($)&&O.push($)}const M=Float64Array.from(O);return M.sort(),M}function m(v,P,W,V={}){const G=V.kind||j(v,V.type);return G==="none"||!v?{kind:"none",buckets:[],suppressed:"type"}:G==="boolean"?l(v,P,W,V):G==="category"?a(v,P,W,V):f(v,P,W,G,V)}function l(v,P,W,V={}){const G=E(v);let _=0;if(G){const S=P?P.length:W;for(let O=0;O<S;O++)G(P?P[O]:O)||_++}const T=[{value:!1,label:"false"},{value:!0,label:"true"}];return _>0&&V.blanks!==!1&&T.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:T}}function a(v,P,W,V){const G=V.cardinalityLimit??q,{cardinality:_}=u(v,P,W,G);if(_>G&&(V.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:_};const T=K(v),S=P?P.length:W,O=new Map;let M=0;for(let Y=0;Y<S;Y++){const Z=T(P?P[Y]:Y);if(Z==null||Z===""){M++;continue}if(Array.isArray(Z)){if(!Z.length){M++;continue}for(const J of Z)O.set(J,(O.get(J)||0)+1);continue}O.set(Z,(O.get(Z)||0)+1)}let A=[...O.entries()];V.order==="alpha"?A.sort((Y,Z)=>String(Y[0]).localeCompare(String(Z[0]))):A.sort((Y,Z)=>Z[1]-Y[1]);let N=0,$=0;if(A.length>G){$=A.length-G;for(let Y=G;Y<A.length;Y++)N+=A[Y][1];A=A.slice(0,G)}const H=A.map(([Y])=>({value:Y,label:String(Y)}));return N>0&&H.push({remainder:!0,label:`Other (${$} values)`}),M>0&&V.blanks!==!1&&H.push({null:!0,label:"Empty"}),{kind:"category",buckets:H,cardinality:_}}function c(v,P,W,V,G){const _=n(v,P,W,R),T=_.length;if(T<100)return null;const S=_[Math.floor(.01*T)],O=_[Math.ceil(.99*T)-1];return!(O>S)||G-V<=2*(O-S)?null:{lo:S,hi:O}}function f(v,P,W,V,G){const{min:_,max:T,nulls:S,finite:O}=r(v,P,W);if(!O)return{kind:V,buckets:S&&G.blanks!==!1?[{null:!0,label:"Empty"}]:[],empty:!0};const M=Math.max(1,Math.floor(G.buckets||x));let A=[];if(V==="date"){const $=U.includes(G.granularity)?G.granularity:t(T-_,M);let H=i(_,$);for(;H<=T&&A.length<4096;){const Y=s(H,$);if(!(Y>H))break;A.push({from:H,to:Y}),H=Y}return{kind:V,buckets:p(A,G.blanks===!1?0:S),granularity:$}}const N=Q.includes(G.strategy)?G.strategy:"equal";if(N==="quantile"){const $=n(v,P,W,R);if($.length){const H=[$[0]];for(let Y=1;Y<M;Y++){const Z=$[Math.min($.length-1,Math.floor(Y/M*$.length))];Z>H[H.length-1]&&H.push(Z)}H.push(T);for(let Y=0;Y<H.length-1;Y++)A.push({from:H[Y],to:H[Y+1]})}}else if(N==="log"&&_>0){const $=Math.log10(_),Y=(Math.log10(T)-$)/M||1;for(let Z=0;Z<M;Z++)A.push({from:10**($+Z*Y),to:10**($+(Z+1)*Y)})}if(!A.length&&N==="equal"){const $=c(v,P,W,_,T);if($){const H=($.hi-$.lo)/M;$.lo>_&&A.push({from:_,to:$.lo,overflow:"low"});for(let Y=0;Y<M;Y++)A.push({from:$.lo+Y*H,to:$.lo+(Y+1)*H});A[A.length-1].to=$.hi,$.hi<T&&A.push({from:$.hi,to:T,overflow:"high"})}}if(!A.length){const $=(T-_)/M||1;for(let H=0;H<M;H++)A.push({from:_+H*$,to:_+(H+1)*$})}return A[A.length-1].to=T,{kind:V,buckets:p(A,G.blanks===!1?0:S),strategy:N,min:_,max:T}}function p(v,P){return P>0?[...v,{null:!0,label:"Empty"}]:v}function y(v,P,W,V,G){const _=V&&V.buckets||[],T=G&&G.length>=_.length?G.subarray(0,_.length):new Uint32Array(_.length);if(T.fill(0),!v||!_.length)return T;const S=_.length-1,O=!!_[S]&&_[S].null===!0,M=P?P.length:W;if(V.kind==="boolean"){const Y=K(v);for(let Z=0;Z<M;Z++){const J=Y(P?P[Z]:Z);if(J==null){O&&T[S]++;continue}T[J?1:0]++}return T}if(V.kind==="category"){const Y=new Map;for(let D=0;D<_.length;D++)!_[D].null&&!_[D].remainder&&Y.set(_[D].value,D);const Z=_.findIndex(D=>D.remainder),J=K(v);for(let D=0;D<M;D++){const te=J(P?P[D]:D);if(te==null||te===""){O&&T[S]++;continue}if(Array.isArray(te)){if(!te.length){O&&T[S]++;continue}for(const X of te){const ne=Y.get(X);ne!==void 0?T[ne]++:Z>=0&&T[Z]++}continue}const z=Y.get(te);z!==void 0?T[z]++:Z>=0&&T[Z]++}return T}const A=O?_.length-1:_.length,N=new Float64Array(A+1);for(let Y=0;Y<A;Y++)N[Y]=_[Y].from;N[A]=A?_[A-1].to:0;const $=k(v),H=E(v);for(let Y=0;Y<M;Y++){const Z=P?P[Y]:Y;if(H&&!H(Z)){O&&T[S]++;continue}const J=$(Z);if(!Number.isFinite(J)){O&&T[S]++;continue}const D=h(N,A,J);D>=0&&T[D]++}return T}function h(v,P,W){if(!P||W<v[0])return-1;if(W>=v[P])return W===v[P]?P-1:-1;let V=0,G=P-1;for(;V<G;){const _=V+G+1>>>1;W>=v[_]?V=_:G=_-1}return V}function d(v,P,W,V={}){const G=V.bounds||m(v,V.boundsIndices??P,W,V);return{bounds:G,counts:y(v,P,W,G)}}const w=d}),_e("packages/core/src/compute/pivotmatrix.js",function(e,F){"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 o}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return i}});const E=F("packages/core/src/compute/handle.js").valueComparator,I=F("packages/core/src/compute/total.js").total,Q=F("packages/core/src/compute/group.js").packKeys,U=F("packages/core/src/compute/pivot.js"),x=U.joinPath,q=U.DEFAULT_PATH_SEPARATOR,R=U.DEFAULT_MAX_COLUMNS,j="";function k(s,r,n={}){const m=n.separator||q,l=s||[],a=r instanceof Uint32Array?r:Uint32Array.from(r||[]),c=a.length;if(l.length===0)return{tuples:[[]],paths:[j],buckets:[a]};const{keyOf:f,readers:p}=Q(l,a,0),y=new Map,h=[],d=[],w=[];for(let _=0;_<c;_++){const T=a[_],S=f(T);let O=y.get(S);if(O===void 0){O=h.length,y.set(S,O),d.push(S);const M=new Array(p.length);for(let A=0;A<p.length;A++)M[A]=p[A](T);h.push(M),w.push([])}w[O].push(T)}const v=E(n.locale),P=h.map((_,T)=>T);P.sort((_,T)=>{const S=h[_],O=h[T];for(let M=0;M<S.length;M++){const A=b(S[M],O[M],v);if(A!==0)return A}return _-T});const W=new Array(P.length),V=new Array(P.length),G=new Array(P.length);for(let _=0;_<P.length;_++){const T=P[_];W[_]=h[T],V[_]=x(h[T],m),G[_]=Uint32Array.from(w[T])}return{tuples:W,paths:V,buckets:G}}function b(s,r,n){const m=s==null,l=r==null;return m||l?m&&l?0:m?1:-1:n(s,r)}function u(s,r,n){const m=[];for(let l=0;l<s.length;l++)n.has(s[l])&&m.push(s[l]);return Uint32Array.from(m)}function g(s,r,n,m){return{value:r.length?I(s,r,n,m):null,leaves:r,count:r.length}}function o(s){const r=s&&s.opts||{},n=r.separator||q,m=r.totalContext||{locale:r.locale},l=(s.measures||[]).filter(V=>V&&V.handle),a=s.leaves instanceof Uint32Array?s.leaves:Uint32Array.from(s.leaves||[]),c=k(s.rowHandles||[],a,{...r,separator:n}),f=k(s.columnHandles||[],a,{...r,separator:n}),p=r.maxColumns===void 0?R:r.maxColumns,y=f.paths.length*Math.max(1,l.length),h=new Map;if(p&&y>p)return{rowAxis:c,columnAxis:f,measures:l.map(V=>({colId:V.colId,fn:V.fn})),body:h,rowMargin:h,columnMargin:h,grand:h,columns:y,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${y} columns, above pivot.maxColumns of ${p}. Narrow the pivot columns or raise the limit.`,columns:y,maxColumns:p}};const d=new Map,w=new Map,v=new Map,P=new Map,W=f.buckets.map(V=>new Set(V));for(let V=0;V<f.paths.length;V++){const G=f.buckets[V],_=f.paths[V];for(const T of l)v.set(i(_,T.colId),g(T.handle,G,T.fn,m))}for(let V=0;V<c.paths.length;V++){const G=c.buckets[V],_=c.paths[V];for(const T of l)w.set(i(_,T.colId),g(T.handle,G,T.fn,m));for(let T=0;T<f.paths.length;T++){const S=u(G,f.buckets[T],W[T]);if(S.length===0)continue;const O=f.paths[T];for(const M of l)d.set(t(_,O,M.colId),g(M.handle,S,M.fn,m))}}for(const V of l)P.set(V.colId,g(V.handle,a,V.fn,m));return{rowAxis:c,columnAxis:f,measures:l.map(V=>({colId:V.colId,fn:V.fn})),body:d,rowMargin:w,columnMargin:v,grand:P,columns:y,error:null}}function t(s,r,n){return`${s}\0${r}\0${n}`}function i(s,r){return`${s}\0${r}`}}),_e("packages/core/src/compute/reference.js",function(e,F){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return o}});const E=F("packages/core/src/internal/paths.js").getPath,K=F("packages/core/src/compute/handle.js"),I=K.isMissing,L=K.valueComparator,U=F("packages/core/src/compute/filter.js").testValue,x="",q="\0";function R(s,r){const n=r.includes(".")?E(s,r):s?.[r];return n===void 0?null:n}function j(s,r,n={}){const m=r||[];let l=s.map((a,c)=>c);if(m.length===0)return l;for(let a=m.length-1;a>=0;a--)l=k(s,l,m[a],n);return l}function k(s,r,n,m){const l=n.locale!==void 0?n.locale:m.locale,a=L(l),c=n.descending!==void 0?!!n.descending:n.dir==="desc",f=[],p=[];for(const d of r){const w=R(s[d],n.col);I(w)?p.push(d):f.push(d)}const y=new Map;for(let d=0;d<f.length;d++)y.set(f[d],d);const h=(d,w)=>{const v=R(s[d],n.col),P=R(s[w],n.col);let W;return typeof n.compare=="function"?(W=n.compare(v,P,s[d],s[w],c),c&&(W=-W)):W=c?a(P,v):a(v,P),W!==0?W:y.get(d)-y.get(w)};return f.sort(h),n.nullsFirst?p.concat(f):f.concat(p)}function b(s,r,n={}){const m=[];for(let l=0;l<s.length;l++)u(s[l],r,n,l)&&m.push(l);return m}function u(s,r,n,m){if(!r)return!0;if(Array.isArray(r.conditions)){const l=r.conditions.filter(c=>c!=null);if(l.length===0)return!0;if(r.op==="or")return l.some(c=>u(s,c,n,m));const a=l.every(c=>u(s,c,n,m));return r.op==="not"?!a:a}return r.col===void 0&&typeof n.custom=="function"?!!n.custom(r,s,m):U(R(s,r.col),r,n.locale)}function g(s,r,n,m){const l=n||s.map((p,y)=>y),a=new Map,c=[],f=[];for(const p of l){const y=r.map((w,v)=>{const P=R(s[p],w);return m&&m[v]?m[v](P):P}),h=y.map(w=>w==null?q:String(w)).join(x);let d=a.get(h);d===void 0&&(d=c.length,a.set(h,d),c.push(y),f.push([])),f[d].push(p)}return{keys:c,buckets:f}}function o(s,r,n={}){const m=L(n.locale),l=s.filter(c=>!I(c)),a=l.map(t).filter(c=>c!==null);switch(r){case"count":return s.length;case"countValues":return l.length;case"sum":return a.reduce((c,f)=>c+f,0);case"avg":return l.length===0?null:a.reduce((c,f)=>c+f,0)/l.length;case"min":return l.length===0?null:l.reduce((c,f)=>m(f,c)<0?f:c);case"max":return l.length===0?null:l.reduce((c,f)=>m(f,c)>0?f:c);case"first":return s.length===0?null:i(s[0]);case"last":return s.length===0?null:i(s[s.length-1]);default:return null}}function t(s){if(typeof s=="number")return Number.isNaN(s)?null:s;if(s==null||s===""||typeof s=="boolean")return null;if(s instanceof Date)return s.getTime();const r=Number(s);return Number.isNaN(r)?null:r}function i(s){return s===void 0?null:s}}),_e("packages/core/src/compute/index.js",function(e,F){"use strict";const ie=F("packages/core/src/compute/sort.js");Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return ie.sortColumn}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return ie.sortMulti}}),Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return ie.radixSortFloat64}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return ie.radixSortInt32}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return ie.rankSortDictionary}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return ie.mergeSortComparator}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return ie.collateStringRanks}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return ie.rankSortStrings}});const E=F("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=F("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 I=F("packages/core/src/compute/group.js");Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return I.groupByColumns}}),Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return I.packKeys}});const L=F("packages/core/src/compute/facet.js");Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return L.facet}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return L.computeBounds}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return L.countInto}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return L.bucketOf}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return L.facetKind}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return L.cardinalityOf}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return L.pickGranularity}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return L.floorTo}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return L.advance}}),Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return L.STRATEGIES}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return L.GRANULARITIES}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return L.DEFAULT_BUCKETS}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return L.DEFAULT_CARDINALITY_LIMIT}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return L.QUANTILE_SAMPLE}});const Q=F("packages/core/src/compute/total.js");Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return Q.TOTAL_FNS}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return Q.TOTAL_LABELS}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return Q.totalLabel}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return Q.total}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return Q.collectValues}});const U=F("packages/core/src/compute/pivot.js");Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return U.pivot}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return U.resolvePivotKeys}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return U.pivotKey}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return U.joinPath}}),Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return U.KEY_DELIMITER}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return U.DEFAULT_PATH_SEPARATOR}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return U.DEFAULT_MAX_COLUMNS}});const x=F("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return x.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return x.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return x.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return x.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return x.GRAND_PATH}});const q=F("packages/core/src/compute/reference.js");Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return q.referenceSort}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return q.referenceFilter}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return q.referenceGroup}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return q.referenceTotal}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return q.referencePasses}}),Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return q.referenceValue}});const R=F("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return R.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return R.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return R.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return R.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return R.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return R.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return R.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return R.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return R.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return R.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return R.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return R.isMissing}});const j=F("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=F("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 b=F("packages/core/src/compute/statistics.js");Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return b.MAINTENANCE}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return b.APPROXIMATE}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return b.maintenanceOf}});const u=F("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return u.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return u.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return u.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return u.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return u.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return u.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return u.anomalyCondition}});const g=F("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}})}),_e("packages/core/src/source/rows.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_ROW_HEIGHT",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"KEY_SEP",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"groupPrefixKeys",{enumerable:!0,get:function(){return g}});const E=F("packages/core/src/internal/warn.js").warnOnce,I=F("packages/core/src/internal/predicates.js").isFunction,L=32,Q="\0";function U(o){return new x(o)}class x{#e;#t;constructor(t){this.#e=I(t&&t.rowKey)?t.rowKey:null;const i=t&&t.config?t.config.rowHeight:void 0;this.#t=typeof i=="number"||I(i)?i:L}get keyed(){return this.#e!==null}keyOf(t,i){if(this.#e){const s=this.#e(t);if(s!=null)return String(s)}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`#${i}`}heightOf(t){return I(this.#t)?Number(this.#t(t))||L:this.#t}leaf(t,i,s=0,r=null){const n={key:this.keyOf(t,i),data:t,level:s,parent:r,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:i};return n.height=this.heightOf(n),n}group(t){const i={key:u(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&&(i.totals=t.totals),i.height=this.heightOf(i),i}footer(t){const i={key:`${t.key}${Q}footer`,data:null,level:t.level,parent:t,group:!0,footer:!0,expanded:!1,leafCount:t.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:t.groupColumn,groupValue:t.groupValue,groupPath:t.groupPath,hasChildren:!1,totals:t.totals};return i.height=this.heightOf(i),i}detail(t,i){return{key:`${t.key}${Q}detail`,data:t.data,level:t.level+1,parent:t,group:!1,detail:!0,expanded:!1,leafCount:0,height:i,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:t.key}}grandTotal(t,i){const s={key:`${Q}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:i,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:t};return s.height=this.heightOf(s),s}skeleton(t,i=0,s=!1){const r={key:`${Q}pending${Q}${t}`,data:null,level:i,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:t,selected:!1,physical:null,pending:!0};return s&&(r.loadError=!0),r.height=this.heightOf(r),r}}function q(o,t,i,s){return{key:`${Q}pinned${Q}${i}${Q}${t}`,data:o,level:0,parent:null,group:!1,expanded:!1,leafCount:0,height:s,index:null,selected:!1,physical:null,hasChildren:!1,pinned:i}}function R(o,t){return new Proxy([],{get(i,s,r){if(s==="length")return o();if(typeof s=="string"){const n=Number(s);if(Number.isInteger(n)&&n>=0)return t(n)}return Reflect.get(i,s,r)},has(i,s){if(typeof s=="string"){const r=Number(s);if(Number.isInteger(r)&&r>=0)return r<o()}return Reflect.has(i,s)}})}function j(o){return o==null?"":String(o)}const k="";function b(o){if(o==null)return k;const t=String(o);return t.startsWith(k)?k+t:t}function u(o){const t=o||[];let i="g";for(let s=0;s<t.length;s++)i+=Q+b(t[s]);return i}function g(o){const t=new Array(o.length),i=[];for(let s=0;s<o.length;s++)i.push(o[s]),t[s]=u(i);return t}}),_e("packages/core/src/source/handles.js",function(e,F){"use strict";Object.defineProperty(e,"HandleProvider",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"createHandleProvider",{enumerable:!0,get:function(){return Q}});const E=F("packages/core/src/internal/predicates.js").isFunction,I=F("packages/core/src/internal/warn.js").warnOnce;class L{#e;#t;#n;#r=new Map;#i=0;constructor(x,q,R){this.#e=x,this.#t=q,this.#n=E(R)?R:()=>!1}get store(){const x=this.#e.store;return x&&E(x.column)?x:null}invalidate(){this.#i++}handle(x){const q=this.store;if(q){const b=q.column(x);if(b)return b}const R=this.#r.get(x);if(R&&R.builtAt===this.#i)return R.handle;const j=this.#s(x);if(!j)return;if(q&&this.#n()){I(`source.dropped.${x}`,`column "${x}" 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.#a(j);return this.#r.set(x,{handle:k,builtAt:this.#i}),k}#s(x){const q=this.#e.columns;return q&&E(q.get)?q.get(x):void 0}#a(x){const q=this.#t()||[],R=q.length,j=new Array(R),k=E(x.getValue)?u=>x.getValue(u):u=>u?.[x.field||x.id];for(let u=0;u<R;u++)j[u]=q[u]===void 0?void 0:k(q[u]);const b=this.#i;return{id:x.id,kind:"object",nullable:!1,values:j,presence:null,dict:null,offsets:null,get(u){return j[u]},version:b}}}function Q(U,x,q){return new L(U,x,q)}}),_e("packages/core/src/compute/incremental.js",function(e,F){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return q}});const E=F("packages/core/src/store/columnstore.js").toFloat,K=Object.freeze(["sum","avg","countValues","min","max"]),I=Object.freeze(["float64"]),L=1e15;function Q(R,j){return typeof R!="string"||!K.includes(R)?!1:!!j&&I.includes(j.kind)}function U(R){if(R==null)return null;const j=E(R);return Number.isNaN(j)?null:j}class x{#e;#t=0;#n=0;#r=0;#i=1/0;#s=-1/0;#a=!1;#l=!1;constructor(j){this.#e=j}get valid(){return this.#a&&!this.#l}get fn(){return this.#e}seed(j){this.#o();for(let k=0;k<j.length;k++){const b=U(j[k]);b!==null&&this.#c(b)}this.#a=!0}seedColumn(j,k,b){this.#o();for(let u=0;u<b.length;u++){const g=b[u];if(k&&k(g)===0)continue;const o=j[g];Number.isNaN(o)||this.#c(o)}this.#a=!0}#o(){this.#t=0,this.#n=0,this.#r=0,this.#i=1/0,this.#s=-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.#i&&(this.#i=j),j>this.#s&&(this.#s=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.#a)return!1;const b=U(j),u=U(k);return b===null&&u===null?!0:b!==null&&!Number.isFinite(b)||u!==null&&!Number.isFinite(u)?!1:this.#e==="min"||this.#e==="max"?b===null||u===null?!1:this.#e==="min"?u<this.#i?(this.#i=u,!0):b>this.#i:u>this.#s?(this.#s=u,!0):b<this.#s:Math.abs(this.#t)>L?!1:(b!==null&&this.#u(b),u!==null&&this.#c(u),!0)}value(){switch(this.#e){case"countValues":return this.#r;case"avg":return this.#r?(this.#t+this.#n)/this.#r:null;case"min":return this.#r?this.#i:null;case"max":return this.#r?this.#s:null;default:return this.#t+this.#n}}invalidate(){this.#a=!1}}const q=x}),_e("packages/core/src/source/filterwire.js",function(e,F){"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 I}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"resolveRelativeRange",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"relativeTokenOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"relativeTokenHelp",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"isResolvableRelative",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"resolveRelativeCondition",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"forEachCondition",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"mapConditions",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"normaliseFilterSet",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"buildFilterSet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"wireFilters",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"querySignature",{enumerable:!0,get:function(){return v}});const E=F("packages/core/src/internal/warn.js").warnOnce,K="source.remote.hostFilter",I="source.where.pageRelative";function L(V,G){!Array.isArray(V)||!V.length||E(I,`filters.where (${V.join(", ")}) runs over the rows the ${G} source fetched,`,"not the whole dataset: match counts and totals are page-relative.","Give the predicate a { condition } twin so the engine can narrow the fetch itself.")}function Q(V){const G=(V||{}).config;!G||!G.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 U="source.where.notApplied";function x(V,G){E(`${U}:${V}`,`filters.where("${V}") is registered but the ${G} 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 q="source.where.overThreshold";function R(V,G,_,T){!Array.isArray(V)||!V.length||E(`${q}:${G}`,`filters.where (${V.join(", ")}) is not applied to the ${G} pushdown source:`,_===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${_.toLocaleString()} rows, at or past the whereRowLimit of ${T.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(V){let G=j.get(V);return G||(G=new Intl.DateTimeFormat("en-US",{timeZone:V,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),j.set(V,G)),G}function b(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function u(V,G){const _=k(G).formatToParts(new Date(V)),T={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const S of _)S.type==="year"?T.y=+S.value:S.type==="month"?T.m=+S.value:S.type==="day"?T.d=+S.value:S.type==="hour"?T.h=+S.value%24:S.type==="minute"?T.mi=+S.value:S.type==="second"&&(T.s=+S.value);return T}function g(V,G){const _=u(V,G);return Date.UTC(_.y,_.m-1,_.d,_.h,_.mi,_.s)-Math.floor(V/1e3)*1e3}function o(V,G,_,T){const S=Date.UTC(V,G-1,_),O=S-g(S,T);return S-g(O,T)}function t(V,G,_){const T=new Date(Date.UTC(V.y,V.m-1,V.d+G));return o(T.getUTCFullYear(),T.getUTCMonth()+1,T.getUTCDate(),_)}const i=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function s(V,G){if(typeof V!="string")return null;const _=V.trim().toLowerCase().replace(/[\s_-]+/g,""),T=/^last(\d*|n)days?$/.exec(_);if(T){const S=T[1]==="n"?"":T[1],O=Number(S||G);return!Number.isFinite(O)||O<=0?null:{kind:"lastNDays",n:Math.floor(O)}}switch(_){case"today":return{kind:"today",n:0};case"yesterday":return{kind:"yesterday",n:0};case"thisweek":return{kind:"thisWeek",n:0};case"thismonth":return{kind:"thisMonth",n:0};case"thisquarter":return{kind:"thisQuarter",n:0};case"thisyear":return{kind:"thisYear",n:0};case"quartertodate":case"qtd":return{kind:"quarterToDate",n:0};case"yeartodate":case"ytd":return{kind:"yearToDate",n:0};default:return null}}function r(V,G={}){const _=s(V,G.n);if(!_)return null;const T=G.tz||b(),S=G.now instanceof Date?G.now.getTime():typeof G.now=="number"?G.now:Date.now(),O=u(S,T),M=o(O.y,O.m,O.d,T),A=t(O,1,T);let N=M,$=A;switch(_.kind){case"today":break;case"yesterday":N=t(O,-1,T),$=M;break;case"lastNDays":$=G.includeToday?A:M,N=t(O,G.includeToday?-(_.n-1):-_.n,T);break;case"thisWeek":{const H=Number.isFinite(G.weekStartsOn)?Number(G.weekStartsOn):1,Z=(new Date(Date.UTC(O.y,O.m-1,O.d)).getUTCDay()-H+7)%7;N=t(O,-Z,T),$=t(O,-Z+7,T);break}case"thisMonth":N=o(O.y,O.m,1,T),$=o(O.m===12?O.y+1:O.y,O.m===12?1:O.m+1,1,T);break;case"thisQuarter":case"quarterToDate":{const H=Math.floor((O.m-1)/3)*3+1;N=o(O.y,H,1,T),$=_.kind==="quarterToDate"?A:H===10?o(O.y+1,1,1,T):o(O.y,H+3,1,T);break}case"thisYear":case"yearToDate":N=o(O.y,1,1,T),$=_.kind==="yearToDate"?A:o(O.y+1,1,1,T);break;default:return null}return{from:new Date(N).toISOString(),to:new Date($).toISOString(),bounds:"[)",tz:T,relative:_.kind==="lastNDays"?`last${_.n}Days`:_.kind,n:_.n}}function n(V){if(!V||typeof V!="object")return null;const G=V.value;if(G&&typeof G=="object"&&!Array.isArray(G)&&"relative"in G)return{token:String(G.relative),n:typeof G.n=="number"?G.n:void 0};if(V.op==="relative"&&typeof V.value=="string")return{token:V.value,n:void 0};const _=V.meta;return _&&typeof _.relative=="string"&&V.value===void 0?{token:_.relative,n:typeof _.n=="number"?_.n:void 0}:null}function m(){return`Known tokens: ${i.filter(G=>G!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function l(V){const G=n(V);return G?s(G.token,G.n)!==null:!1}function a(V,G={}){const _=n(V);if(!_)return V;const T=r(_.token,{...G,n:_.n});return T?{...V,type:V.type||"date",op:"between",value:[T.from,T.to],bounds:V.bounds||T.bounds,meta:{...V.meta||{},relative:T.relative,tz:T.tz}}:(E(`source.relative.${_.token}`,`unknown relative date token "${_.token}"; sending the condition unresolved.`,m()),V)}function c(V){return!!V&&typeof V=="object"&&Array.isArray(V.conditions)}function f(V,G){if(V){if(c(V)){for(const _ of V.conditions)f(_,G);return}G(V)}}function p(V,G){if(!V)return null;if(!c(V))return G(V);const _=V;let T=!1;const S=[];for(const O of _.conditions){const M=p(O,G);M!==O&&(T=!0),M&&S.push(M)}return!T&&S.length===_.conditions.length?V:S.length?{..._,conditions:S}:null}function y(V){if(!V)return null;if(!c(V))return V;const G=V,_=[];for(const T of G.conditions){const S=y(T);S&&_.push(S)}return _.length?{op:G.op,conditions:_}:null}function h(V){const G=y(V);return G?c(G)&&G.op==="and"?G:{op:"and",conditions:[G]}:null}function d(V){const G=(V||[]).filter(Boolean);return G.length?{op:"and",conditions:G}:null}function w(V,G={}){const _=p(V,T=>a(T,G));return h(_)}function v(V){const G=P(V.filters??null);return JSON.stringify([G,V.sort??null,V.quick??"",V.groupBy??null,V.pivotBy??null,W(V.context)])}function P(V){if(!V)return null;if(c(V)){const T=V;return{op:T.op,conditions:T.conditions.map(P)}}const G=V,_=G.meta&&typeof G.meta.relative=="string"?G.meta.relative:n(G)?.token;return{col:G.col,op:G.op,bounds:G.bounds??null,caseSensitive:G.caseSensitive??!1,value:_?`rel:${_}`:G.value??null}}function W(V){if(V==null)return null;try{return JSON.parse(JSON.stringify(V))}catch{return E("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),_e("packages/core/src/source/tree.js",function(e,F){"use strict";Object.defineProperty(e,"SYNTHETIC",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"buildFromPath",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return q}}),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 b}}),Object.defineProperty(e,"indexTree",{enumerable:!0,get:function(){return u}});const E=F("packages/core/src/internal/predicates.js").isFunction,I=F("packages/core/src/internal/warn.js").warnOnce,L="",Q="\0tree:";function U(g,o){return{physical:g,key:o,level:0,children:[],value:void 0}}function x(g,o){const t=[],i=new Map;for(let s=0;s<g.length;s++){const r=g[s],n=o.pathOf(r),m=Array.isArray(n)?n.map(a=>String(a)):[];if(!m.length){const a=U(r,o.keyOf(r));t.push(a);continue}let l=null;for(let a=0;a<m.length;a++){const c=m.slice(0,a+1).join(L),f=a===m.length-1;let p=i.get(c);p&&f&&p.physical===-1&&(p.physical=r,p.key=o.keyOf(r)),p||(p=U(f?r:-1,f?o.keyOf(r):Q+c),p.level=a,p.value=m[a],i.set(c,p),l?l.children.push(p):t.push(p)),l=p}}return{roots:t,nodes:i}}function q(g,o){const t=new Map,i=[];for(let m=0;m<g.length;m++){const l=g[m],a=o.keyOf(l),c=U(l,a);t.set(a,c);const f=o.parentOf(l);f!=null&&f!==""&&i.push({node:c,parent:String(f)})}let s=null;const r=new Map;for(const{node:m,parent:l}of i){const a=t.get(l);if(a){r.set(m.key,a);continue}o.orphans&&o.orphans!=="root"&&(s||(s=U(-1,`${Q}orphans`),s.value=o.orphans),r.set(m.key,s))}const n=[];for(const m of t.values()){const l=r.get(m.key);l?l.children.push(m):n.push(m)}return s&&s.children.length&&n.push(s),{roots:R(n,t,o.orphans,s),nodes:t}}function R(g,o,t,i){const s=new Set,r=[...g];for(;r.length;){const c=r.pop();if(!s.has(c.key)){s.add(c.key);for(const f of c.children)r.push(f)}}const n=[];for(const c of o.values())s.has(c.key)||n.push(c);if(!n.length)return g;const m=!!t&&t!=="root";I("tree.cycle",`tree.parentKey produced ${n.length} row(s) inside a parent cycle; `+(m?`they are shown under "${t}".`:"they are shown at the root."));for(const c of n)c.children=c.children.filter(f=>s.has(f.key));if(!m)return[...g,...n];let l=i;const a=[...g];return l||(l=U(-1,`${Q}orphans`),l.value=t,a.push(l)),l.children.push(...n),a}function j(g){let o=0;const t=(i,s)=>{for(const r of i)r.level=s,s>o&&(o=s),r.children.length&&t(r.children,s+1)};return t(g,0),o}function k(g,o){if(!g||typeof g!="object")return null;const t=g.path,i=g.parentKey,s=E(g.hasChildren)?r=>!!g.hasChildren(o.dataAt(r)):null;if(E(t))return{mode:"path",pathOf:r=>t(o.dataAt(r)),keyOf:o.keyOf,declaresChildren:s};if(i!=null){const r=E(i)?i:n=>n?.[i];return{mode:"parentKey",parentOf:n=>r(o.dataAt(n)),keyOf:o.keyOf,orphans:g.orphans||"root",declaresChildren:s}}return I("tree.shape","tree is configured with neither `path` nor `parentKey`; rows stay flat."),null}function b(g,o){const t=o.mode==="path"?x(g,o):q(g,o),i=j(t.roots);return{...t,depth:i}}function u(g,o){const t=new Map,i=s=>{for(let r=0;r<s.length;r++){const n=s[r];if(n.physical>=0){const m=o?o(n.physical):!1,l=m&&n.children.length===0;t.set(n.physical,{level:n.level,posinset:r+1,setsize:s.length,hasChildren:n.children.length>0||m,lazy:l})}n.children.length&&i(n.children)}};return i(g),t}}),_e("packages/core/src/source/settle.js",function(e,F){"use strict";Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"ARRIVAL_REASONS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"isArrival",{enumerable:!0,get:function(){return I}});const ie=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function E(L){const Q=L&&typeof L=="object"?L.reason:null;return typeof Q=="string"&&ie.includes(Q)}const K=Object.freeze(["page","total"]);function I(L){const Q=L&&typeof L=="object"?L.reason:null;return typeof Q=="string"&&K.includes(Q)}}),_e("packages/core/src/source/memory.js",function(e,F){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"quickMatcher",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"MemorySource",{enumerable:!0,get:function(){return Z}});const E=F("packages/core/src/internal/lru.js").Lru,K=F("packages/core/src/internal/warn.js"),I=K.warnOnce,L=K.fail,U=F("packages/core/src/internal/predicates.js").isFunction,q=F("packages/core/src/internal/compare.js").defaultCompare,j=F("packages/core/src/internal/merge.js").mergeRow,k=F("packages/core/src/source/rows.js"),b=k.createRowFactory,u=k.groupKey,g=k.groupPathElement,o=k.groupPrefixKeys,t=k.lazyRowView,s=F("packages/core/src/source/handles.js").createHandleProvider,r=F("packages/core/src/compute/incremental.js"),n=r.RunningTotal,m=r.isIncremental,a=F("packages/core/src/compute/handle.js").presenceReader,c=F("packages/core/src/source/filterwire.js"),f=c.querySignature,p=c.mapConditions,y=c.resolveRelativeCondition,h=F("packages/core/src/source/tree.js"),d=h.buildTree,w=h.resolveTree,v=h.indexTree,P=F("packages/core/src/source/settle.js"),W=P.PIPELINE_SETTLE_REASONS,V=P.isPipelineSettle,G=Object.freeze(["filter","sort","group","total","pivot","flatten"]),_=Object.freeze([]);function T(J,D){if(!J)return null;const te=D==="grand"?J.grandTotal:J.groupTotal;return te??J.total}function S(J){return!!J&&!J.running}function O(J){if(J)return J.value&&U(J.value.compare)?J.value.compare:U(J.compare)?J.compare:void 0}function M(J){const D=J&&J.dataType;return!D||!U(D.items)?null:{items:D.items,type:J.itemType&&J.itemType.name||"text"}}function A(J){return!!J&&(typeof J=="object"||typeof J=="function")&&U(J.then)}const N=new Uint32Array(0),$=4096;function H(J,D){return new Z(J,D)}function Y(J,D){if(D==="regex")try{const te=new RegExp(J,"iu");return z=>te.test(z)}catch{return te=>te.includes(J)}if(D==="fuzzy"){const te=[...J].filter(z=>z!==" ");return te.length?z=>{let X=0;for(let ne=0;ne<z.length&&X<te.length;ne++)z[ne]===te[X]&&X++;return X===te.length}:()=>!0}if(D==="words"){const te=J.split(/\s+/).filter(Boolean);return te.length?z=>te.every(X=>z.includes(X)):()=>!0}return te=>te.includes(J)}class Z{mode="memory";#e;#t;#n;#r=!1;#i=null;#s;#a;#l=new Map;#o=!1;#c=0;#u=0;#f=new Map;#d=new Map;#h;#p=null;#m=Z.#g();static#g(){return{slots:[],groupHeadings:_,unnumbered:_,pivot:null,inlineLeaves:null,matchCount:0,grand:null,grandLeaves:0,groupLeaves:null}}#b=new Map;#y=null;#O=new Map;#w=-1;#A=[];#v=new Map;#P=-1;#S=[];#C=null;#E=null;#T=null;#M=null;#N=null;#R=null;#D=null;#K=null;#Y=Symbol("unset");#x=new Map;#H=null;get#F(){return this.#m.slots}set#F(D){this.#m.slots=D}get#X(){return this.#m.inlineLeaves}set#X(D){this.#m.inlineLeaves=D}get#V(){return this.#m.groupHeadings}set#V(D){this.#m.groupHeadings=D}get#B(){return this.#m.unnumbered}set#B(D){this.#m.unnumbered=D}get#W(){return this.#m.pivot}set#W(D){this.#m.pivot=D}constructor(D,te){this.#t=D||{mode:"memory"},this.#e=te||{};const z=this.#e.config||{};this.#n=this.#t.rows||z.rows||[],this.#s=b(this.#e),this.#a=s(this.#e,()=>this.#n,()=>this.#r),this.#h=new E(Number(z.rowCacheSize)||$);for(const X of G)this.#l.set(X,{key:null,result:null,id:0,computed:!1})}count(){this.#U();const D=this.#ge();return D?D.length:this.#F.length}#ge(){const D=Number(this.#z("pageSize",0))||0;if(D<=0)return null;const te=this.#F.length,z=Math.max(1,Math.ceil(te/D)),ne=Math.min(Math.max(0,Number(this.#z("page",0))||0),z-1)*D;return{offset:ne,length:Math.max(0,Math.min(D,te-ne))}}pageInfo(){this.#U();const D=Number(this.#z("pageSize",0))||0,te=this.#F.length;if(D<=0)return{page:0,pageSize:0,total:te,pageCount:1};const z=Math.max(1,Math.ceil(te/D));return{page:Math.min(Math.max(0,Number(this.#z("page",0))||0),z-1),pageSize:D,total:te,pageCount:z}}totalCount(){return this.#et().length}matchCount(){return this.#U(),this.#m.matchCount}at(D){this.#U();const te=this.#ge();if(te)return D<0||D>=te.length?void 0:this.#_e(te.offset+D,D);if(!(D<0||D>=this.#F.length))return this.#_e(D,D)}byKey(D){this.#U(),this.#p||this.#Ae();const te=this.#p.get(D);if(te!==void 0)return this.#ce(te);for(let z=0;z<this.#F.length;z++){const X=this.#F[z];if(typeof X!="number"&&X&&X.key===D)return this.#_e(z)}}loaded(D){return D>=0&&D<this.count()}hint(D,te){}display(){return this.#U(),this.#H||(this.#H=this.#$e()),this.#H}invalidateQuickText(){this.#x.clear(),this.invalidate("filter")}invalidate(D){const te=G.indexOf(D);te<0&&L(`unknown pipeline stage "${D}"; expected one of ${G.join(", ")}`);for(let z=te;z<G.length;z++){const X=this.#l.get(G[z]);X.key=null,X.computed=!1}this.#H=null}apply(D){const te=[],z={added:[],updated:[],removed:[],rejected:te};if(!D)return z;let X=!1;const ne=new Set;if(D.remove&&D.remove.length)for(const se of D.remove){const ue=this.#Ce(se);if(ue===void 0){te.push({operation:"remove",id:this.#He(se),reason:"unknown-id"});continue}z.removed.push(this.#s.keyOf(this.#r?this.#Qe(ue):this.#n[ue],ue)),this.#r||(this.#n[ue]=void 0),this.#h.delete(ue),this.#x.delete(ue),X=!0}if(D.update&&D.update.length){const se=this.#O.size||this.#at()?this.#Ke():null,ue=this.#v.size?this.#ht():null,ge=ue&&ue.length?this.#Ke():null;for(const Oe of D.update){const Pe=this.#Ce(Oe);if(Pe===void 0){te.push({operation:"update",id:this.#xe(Oe),reason:"unknown-id"});continue}const Ie=this.#r?this.#i&&this.#i.has(Pe)?this.#i.get(Pe):this.#Qe(Pe):this.#n[Pe],xe=j(Ie,Oe);for(const ye of this.#le(Ie,xe))ne.add(ye);if(this.#r||(this.#n[Pe]=xe),se&&this.#Je(se,Pe,Ie,xe),ge&&this.#We(ue,ge,Pe,Ie,xe),this.#p){const ye=this.#s.keyOf(Ie,Pe),re=this.#s.keyOf(xe,Pe);ye!==re&&(this.#p.delete(ye),this.#p.set(re,Pe))}this.#h.delete(Pe),this.#x.delete(Pe),z.updated.push(this.#ce(Pe))}}if(D.add&&D.add.length&&this.#r){typeof D.at=="number"&&D.at<this.#j()&&(this.#h.clear(),this.#x.clear()),this.#p=null;for(const se of D.add){const ue=this.#ae(this.#xe(se));ue!==void 0&&z.added.push(this.#ce(ue))}X=!0}else if(D.add&&D.add.length){let se=typeof D.at=="number"?D.at:this.#n.length;if(se<this.#n.length){let Oe=0;for(let Pe=0;Pe<this.#n.length;Pe++)this.#n[Pe]!==void 0&&Oe++;if(Oe!==this.#n.length){let Pe=0;for(let Ie=0;Ie<this.#n.length;Ie++)this.#n[Ie]!==void 0&&(this.#n[Pe++]=this.#n[Ie]);this.#n.length=Pe,this.#p=null,this.#h.clear(),this.#x.clear()}}const ue=this.#n.length;se=Math.max(0,se);let ge=D.add===this.#n?D.add.slice():D.add;if(this.#s.keyed){const Oe=[];for(const Pe of ge){const Ie=this.#xe(Pe);if(this.#Ce(Ie)!==void 0){te.push({operation:"add",id:Ie,reason:"duplicate-id"});continue}Oe.push(Pe)}Oe.length!==ge.length&&(ge=Oe)}if(!ge.length)return z;if(se>=ue)for(let Oe=0;Oe<ge.length;Oe++)this.#n.push(ge[Oe]);else this.#n.splice(se,0,...ge),this.#h.clear(),this.#x.clear();for(let Oe=0;Oe<ge.length;Oe++)z.added.push(this.#ce(se>=ue?ue+Oe:se+Oe));X=!0}return this.#c++,X&&(this.#p=null,this.#lt()),this.#a.invalidate(),this.#H=null,X||this.#ne(ne)?(this.#u++,this.invalidate("filter")):this.invalidate("total"),this.#bt("rows:changed",{companion:!0,added:z.added.length,updated:z.updated.length,removed:z.removed.length}),this.#i=null,z}groupHeadingsAt(D){this.#U();const te=this.#V;if(!te.length||!Number.isInteger(D)||D<0)return _;let z=0,X=te.length-1,ne=-1;for(;z<=X;){const ue=z+X>>1;te[ue].at<=D?(ne=ue,z=ue+1):X=ue-1}if(ne<0)return _;const se=[];for(let ue=te[ne].row;ue;ue=ue.parent)se.push(ue);return se.reverse(),se}unnumberedRowCount(D){this.#U();const te=this.#B;if(!te.length||!Number.isInteger(D)||D<0)return 0;let z=0,X=te.length-1,ne=-1;for(;z<=X;){const se=z+X>>1;te[se].at<=D?(ne=se,z=se+1):X=se-1}return ne+1}moveRow(D,te){if(this.#r)return I("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 z=this.#n;if(!Number.isInteger(D)||!Number.isInteger(te))return!1;let X=0;for(let ue=0;ue<z.length;ue++)z[ue]!==void 0&&X++;if(D<0||D>=X)return!1;const ne=Math.max(0,Math.min(X-1,te));if(ne===D)return!1;if(X!==z.length){let ue=0;for(let ge=0;ge<z.length;ge++)z[ge]!==void 0&&(z[ue++]=z[ge]);z.length=ue}const[se]=z.splice(D,1);return z.splice(ne,0,se),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#x.clear(),this.#lt(),this.#a.invalidate(),this.#H=null,this.invalidate("filter"),this.#bt("rows:changed",{companion:!0,added:0,updated:0,removed:0,moved:1}),!0}reload(D){this.#ue(),this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#lt(),this.#a.invalidate(),this.invalidate("filter"),this.#bt("model:changed",{reason:"reload"})}destroy(){this.#ue(),this.#h.clear(),this.#x.clear(),this.#p=null,this.#F=[],this.#X=null,this.#H=null,this.#lt();for(const D of G)this.#l.set(D,{key:null,result:null,id:0,computed:!1})}#se(D){const te=this.#e.sortPending;U(te)&&te(D)}#ue(){this.#b.has("sort")&&this.#se(!1);for(const{controller:D}of this.#b.values())try{D.abort()}catch{}this.#b.clear()}setRows(D){this.#n=D||[],this.#r=!1,this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#lt(),this.#a.invalidate(),this.invalidate("filter")}notePriorRows(D){this.#i=D||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#x.clear(),this.#a.invalidate()}data(){if(!this.#r)return this.#n;const D=this.#e.store;if(!D||!U(D.source))return this.#n;const te=D.physical||0,z=new Array(te);for(let X=0;X<te;X++)z[X]=D.live&&!D.live(X)?void 0:D.source(X);return z}#Me(){const D=this.#z("detail",null);return!D||!U(D.isOpen)||D.inline===!1?null:D}#fe(){const D=(this.#e.config||{}).tree;return this.#Y!==D&&(this.#Y=D,this.#K=w(D,{dataAt:te=>this.#Qe(te),keyOf:te=>this.#s.keyOf(this.#Qe(te),te)})),this.#K}#oe(){return(this.#e.config||{}).grandTotalRow==="bottom"}grandTotalRow(){if(!this.#oe())return null;this.#U();const D=this.#m.grand;return D?this.#s.grandTotal(D,this.#te(this.#m.grandLeaves)):null}pivot(){return this.#U(),this.#W}pivotMatrix(){this.#U();const D=this.#m.groupLeaves,te=(this.#e.compute||{}).pivotMatrix;if(!U(te))return null;const z=this.#z("groupBy",[]),X=this.#z("pivotBy",[]);if(!z.length&&!X.length)return I("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 ne=this.#Ke().map(ue=>({colId:ue.id,handle:this.#a.handle(ue.id),fn:T(ue,"group")})).filter(ue=>ue.handle&&ue.fn),se=this.#e.config||{};return te({rowHandles:z.map(ue=>this.#a.handle(ue)).filter(Boolean),columnHandles:X.map(ue=>this.#a.handle(ue)).filter(Boolean),measures:ne,leaves:D||new Uint32Array(0),opts:{locale:se.locale,separator:(se.pivot||{}).separator,maxColumns:(se.pivot||{}).maxColumns}})}keysForLeaves(D){const te=[];if(!D)return te;for(let z=0;z<D.length;z++){const X=this.#ce(D[z]);X&&X.key!=null&&te.push(String(X.key))}return te}leavesOf(D){this.#U();const te=this.#l.get("group"),z=te&&te.result;if(!z||!z.nodes)return[];const X=z.nodes.get(D);if(!X)return[];const ne=[],se=ue=>{const ge=ue.row&&ue.row.children;if(ge&&ge.length){for(const Oe of ge){const Pe=z.nodes.get(Oe.key);Pe&&se(Pe)}return}if(ue.leaves)for(let Oe=0;Oe<ue.leaves.length;Oe++)ne.push(this.#ce(ue.leaves[Oe]))};return se(X),ne}#He(D){return typeof D=="string"?D:this.#xe(D)}#xe(D){try{return this.#s.keyOf(D,-1)}catch{return"(unkeyed)"}}#Ce(D){if(typeof D=="string")return this.#ae(D);if(this.#s.keyed){const z=this.#s.keyOf(D,-1),X=this.#ae(z);if(X!==void 0)return X}if(this.#r)return;const te=this.#n.indexOf(D);return te>=0?te:void 0}#ae(D){return this.#p||this.#Ae(),this.#p.get(D)}#Ae(){this.#p=new Map;const D=this.#j(),te=this.#e.store,z=te&&U(te.live)?X=>te.live(X):null;for(let X=0;X<D;X++){if(z&&!z(X))continue;const ne=this.#Qe(X);ne!==void 0&&this.#p.set(this.#s.keyOf(ne,X),X)}}#le(D,te){const z=[];for(const X of this.#G())this.#Fe(X)&&this.#Z(X,D,te,new Set)&&z.push(X);return z}#Z(D,te,z,X){if(X.has(D))return!1;X.add(D);const ne=this.#Fe(D);if(!ne)return!1;const se=ne.value&&ne.value.deps;return Array.isArray(se)&&se.length?se.some(ue=>this.#Z(String(ue),te,z,X)):U(ne.getValue)?!Object.is(ne.getValue(te),ne.getValue(z)):!1}#G(){const D=new Set;for(const z of this.#z("sort",[]))D.add(z.col);for(const z of this.#z("groupBy",[]))D.add(z);const te=z=>{if(z){if(Array.isArray(z.conditions)){z.conditions.forEach(te);return}z.col&&D.add(z.col)}};return te(this.#z("filters",null)),[...D]}#ne(D){if(!D.size)return!1;if(this.#z("quick",""))return!0;for(const te of this.#G())if(D.has(te))return!0;return!1}#U(){if(!this.#o){this.#o=!0;try{this.#Ee()}finally{this.#o=!1}}}pipelineRunning(){return this.#o}#Ee(){const D=this.#de("filter",()=>this.#$(),()=>this.#Ve()),te=this.#re(D),z=this.#de("group",()=>this.#I(),()=>this.#Ie(te)),X=this.#de("total",()=>this.#ke(),()=>this.#qe(z));this.#de("pivot",()=>this.#ee(),()=>this.#Ge(z)),this.#de("flatten",()=>this.#Le(),()=>this.#kt(z)),this.#ye(z,X)}#re(D){const te=this.#l.get("sort"),z=this.#_();if(te.computed&&te.key===z&&!this.#b.has("sort"))return te.result;const X=this.#b.get("sort");return X&&X.key===z?te.result:te.result&&this.#Te(D)?(this.#we(D,z),te.result):this.#de("sort",()=>z,()=>this.#k(D))}#pe(){if(this.#y===null){const D=this.#e.pipelineWorker,te=U(D)?D():null;this.#y=te||!1}return this.#y||null}#be(){const D=this.#z("sort",[]);if(!Array.isArray(D)||!D.length)return null;const te=(this.#e.config||{}).locale,z=[],X=[];for(const ne of D){const se=this.#Fe(ne.col);if(se&&se.running)continue;if(se&&se.value&&U(se.value.compare))return null;const ue=this.#a.handle(ne.col);if(!ue)return null;z.push({col:ne.col,descending:ne.dir==="desc",nullsFirst:!!ne.nullsFirst,locale:te}),X.push(ue)}return z.length?{entries:z,handles:X,locale:te}:null}#Te(D){if(this.#he())return!1;const te=this.#pe();if(!te)return!1;const z=Number(te.threshold);return Number.isFinite(z)&&D.length<z?!1:!!this.#be()}#we(D,te){const z=this.#pe(),X=z&&this.#be();if(!X){this.#de("sort",()=>te,()=>this.#k(D));return}const ne=new AbortController;this.#b.set("sort",{key:te,controller:ne});const se=X.entries.length===1?z.sortColumn(X.handles[0],D,{descending:X.entries[0].descending,nullsFirst:X.entries[0].nullsFirst,locale:X.locale,signal:ne.signal,key:"sort"}):z.sortMulti(X.handles,X.entries.map((ue,ge)=>({...ue,handle:X.handles[ge]})),D,{signal:ne.signal,key:"sort"});if(!A(se)){this.#b.delete("sort"),this.#de("sort",()=>te,()=>se),this.#se(!1);return}this.#se(!0),se.then(ue=>this.#ve(te,ue),ue=>this.#Se("sort",te,ue))}#ve(D,te){const z=this.#b.get("sort");if(!(!z||z.key!==D)){if(this.#_()!==D){this.#b.delete("sort"),this.#se(!1);return}this.#b.delete("sort"),this.#de("sort",()=>D,()=>te),this.#H=null,this.#U(),this.#bt("model:changed",{reason:W[0]}),this.#se(!1)}}#Se(D,te,z){const X=this.#b.get(D);if(!(!X||X.key!==te)){if(this.#b.delete(D),z&&z.name==="AbortError"){D==="sort"&&this.#se(!1);return}if(D==="sort"&&this.#_()===te){const ne=this.#de("filter",()=>this.#$(),()=>this.#Ve());this.#de("sort",()=>te,()=>this.#k(ne)),this.#H=null,this.#U(),I("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",z),this.#bt("model:changed",{reason:W[1]})}D==="sort"&&this.#se(!1)}}#ye(D,te){const z=D&&D.leaves?D.leaves.length:this.#m.slots.length;this.#m.matchCount=z,this.#m.grand=te&&te.grand||null,this.#m.grandLeaves=D&&D.leaves?D.leaves.length:0,this.#m.groupLeaves=D&&D.leaves?D.leaves:null}#de(D,te,z){const X=this.#l.get(D),ne=te();return X.computed&&X.key===ne||(X.result=z(),X.key=ne,X.computed=!0,X.id++,D==="flatten"&&(this.#H=null)),X.result}#J(D){return this.#l.get(D).id}#$(){const D=(this.#e.config||{}).hostFilter,te=D&&U(D.active)&&D.active()?1:0,z=this.#z("where",null),X=z?z.version:0,ne=this.#it("filter.sig",`${this.#St()}`,()=>f({filters:this.#z("filters",null),quick:this.#z("quick",""),quickMode:this.#z("quickMode","contains")}));return`${this.#u}|${ne}|${te}|${X}`}#_(){const D=this.#he();return`${this.#J("filter")}|${JSON.stringify(this.#z("sort",[]))}`+(D?`|manual:${D.version}`:"")}#he(){const D=this.#z("rowOrder",null);return D&&Array.isArray(D.keys)?D:null}#ie(D,te){this.#p||this.#Ae();const z=this.#p,X=this.#j(),ne=te.keys.length,se=new Float64Array(X);for(let ue=0;ue<X;ue++)se[ue]=ne+ue;for(let ue=0;ue<ne;ue++){const ge=z.get(te.keys[ue]);ge!==void 0&&(se[ge]=ue)}return Uint32Array.from(D).sort((ue,ge)=>se[ue]-se[ge])}orderedKeys(){this.#p||this.#Ae();const D=this.#p,te=new Map;for(const[ue,ge]of D)te.set(ge,ue);const z=Uint32Array.from([...te.keys()]).sort(),X=this.#he(),ne=X?this.#ie(z,X):this.#k(z),se=new Array(ne.length);for(let ue=0;ue<ne.length;ue++)se[ue]=te.get(ne[ue]);return se}#I(){const D=this.#z("pivotBy",[]).length>0?"p":"u";return`${this.#J("sort")}|${JSON.stringify(this.#z("groupBy",[]))}|${D}`}#ke(){const D=this.#rt()?"f":"a",te=(this.#e.config||{}).totalOnlyChangedColumns?"n":"w";return`${this.#J("group")}|${JSON.stringify(this.#z("totals",[]))}|${D}${te}|${this.#c}`}#ee(){return`${this.#J("group")}|${JSON.stringify(this.#z("pivotBy",[]))}`}#Le(){const te=this.#je()||!this.#oe()?this.#J("total"):"x",z=`${this.#St()}`,X=this.#it("flatten.keys",z,()=>{const se=this.#z("expanded",null);return se?[...se].sort().join(""):"*"}),ne=this.#it("flatten.detail",z,()=>{const se=this.#z("detail",null);return se&&U(se.signature)?se.signature():""});return`${te}|${this.#J("pivot")}|${X}|${ne}`}#je(){const D=this.#z("groupBy",[]);return Array.isArray(D)&&D.length>0}stageState(){const D=[];for(const[te,z]of this.#l){const X=z.result;D.push({stage:te,materialised:!!z.computed,bytes:X&&typeof X.byteLength=="number"?X.byteLength:null,rows:X&&typeof X.length=="number"?X.length:null,rebuilds:z.id})}return D}facetIndices(D){return this.#Ve(D||null)}facetRows(D){const te=this.facetIndices(D),z=[];for(let X=0;X<te.length;X++){const ne=this.#ce(te[X]);ne&&z.push(ne)}return z}invalidateRows(){this.#h.clear(),this.#x.clear(),this.#H=null}invalidateHandles(){this.#a.invalidate()}rows(){return this.#n}unfilteredIndices(){return this.#et()}filteredIndices(){const D=this.#l.get("filter");if(D&&D.computed&&D.key===this.#$())return D.result||this.#et();this.#U();const te=this.#l.get("filter");return(te&&te.computed?te.result:null)||this.#et()}unfilteredRows(){const D=this.#et(),te=[];for(let z=0;z<D.length;z++){const X=this.#ce(D[z]);X&&te.push(X)}return te}#Ve(D=null){const te=this.#et(),z=this.#z("filters",null),X=D?this.#ft("pruneColumn")(z,D):z,ne=this.#mt(X),se=String(this.#z("quick","")||"").trim().toLowerCase(),ue=se?Y(se,String(this.#z("quickMode","contains")||"contains")):null,ge=(this.#e.config||{}).hostFilter,Oe=!!(ge&&U(ge.active)&&ge.active()),Pe=this.#z("where",null),Ie=!!(Pe&&Pe.active);if(!ne&&!se&&!Oe&&!Ie)return te;let xe=null;ne&&(xe=this.#ft("evaluateFilters")(ne,{handle:oe=>this.#a.handle(oe),count:this.#j(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:oe=>M(this.#Fe(oe)),typeOf:oe=>{const ce=this.#Fe(oe);return ce?ce.type:void 0}}));const ye=new Uint32Array(te.length);let re=0;for(let fe=0;fe<te.length;fe++){const oe=te[fe];if(!(xe&&!xe[oe])&&!(ue&&!this.#Be(oe,ue))){if(Oe||Ie){const ce=this.#ce(oe);if(Oe&&!ge.passes(ce)||Ie&&!Pe.passes(ce.data,ce.key))continue}ye[re++]=oe}}if(xe){const fe=(this.#e.compute||{}).releaseMask;U(fe)&&fe({pool:this.#e.pool},xe)}return ye.subarray(0,re)}handleFor(D){return this.#a.handle(D)}#k(D){const te=this.#he();if(te)return this.#ie(D,te);const z=this.#z("sort",[]).filter(se=>{const ue=this.#Fe(se.col);return!ue||!ue.running?!0:(I(`source.sort.running.${se.col}`,`sort ignores "${se.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(!z.length)return D;const X=(this.#e.config||{}).locale;if(z.length===1){const se=z[0],ue=this.#a.handle(se.col);if(!ue)return I(`source.sort.${se.col}`,`sort ignores unknown column "${se.col}".`),D;const ge=this.#Fe(se.col);return this.#ft("sortColumn")(ue,D,{descending:se.dir==="desc",nullsFirst:se.nullsFirst,locale:X,compare:O(ge)})}const ne=[];for(const se of z){const ue=this.#a.handle(se.col);if(!ue){I(`source.sort.${se.col}`,`sort ignores unknown column "${se.col}".`);continue}ne.push({handle:ue,descending:se.dir==="desc",nullsFirst:se.nullsFirst,locale:X,compare:O(this.#Fe(se.col))})}return ne.length?this.#ft("sortMulti")(ne.map(se=>se.handle),ne,D):D}#Ie(D){const te=this.#z("groupBy",[]),z=this.#fe();if(z&&!te.length){const fe=d(D,z);return this.#R=v(fe.roots,z.declaresChildren),{roots:null,leaves:D,nodes:new Map,tree:fe}}if(this.#R=null,z&&te.length&&I("tree.grouped","grouping is active on a grid configured with `tree`; the grouping wins and the hierarchy is not shown."),!te.length)return{roots:null,leaves:D,nodes:new Map};const X=(this.#e.config||{}).timeZone,ne=[],se=[];let ue=!1;for(const fe of te){const oe=this.#a.handle(fe);if(!oe){I(`source.group.${fe}`,`grouping ignores unknown column "${fe}".`);continue}ne.push(oe);const ce=this.#Fe(fe),de=ce&&ce.dataType;if(de&&U(de.groupProjector)){const ve=ce.typeOptions&&ce.typeOptions.timeZone||X||void 0,ke=de.groupProjector(ce,ve);se.push(ke||null),ke&&(ue=!0)}else se.push(null)}if(!ne.length)return{roots:null,leaves:D,nodes:new Map};const{keys:ge,buckets:Oe}=this.#ft("groupByColumns")(ne,D,{locale:(this.#e.config||{}).locale,project:ue?se:void 0}),Pe=this.#z("pivotBy",[]).length>0,Ie=[],xe=new Map;for(let fe=0;fe<Oe.length;fe++){const oe=ge[fe];let ce=null;const de=[];for(let ve=0;ve<oe.length;ve++){de.push(g(oe[ve]));const ke=u(de),Ce=ve===oe.length-1;let Le=xe.get(ke);if(!Le){const we=this.#s.group({path:[...de],column:te[ve],value:oe[ve],level:ve,parent:ce,expanded:Pe&&Ce?!1:this.#gt(ke,{key:ke,column:te[ve],value:oe[ve],level:ve,path:[...de]}),hasChildren:!(Pe&&Ce)});Le={row:we,leaves:null},xe.set(ke,Le),ce?ce.children.push(we):Ie.push(we)}Le.row.leafCount+=Oe[fe].length,ve===oe.length-1&&(Le.leaves=Oe[fe]),ce=Le.row}}const ye=this.#z("sort",[])||[],re=(fe,oe)=>{if(!fe||fe.length<2){if(fe)for(const ke of fe)re(ke.children,oe+1);return}const ce=te[oe],de=ye.find(ke=>ke.col===ce),ve=de&&de.dir==="desc"?-1:1;fe.sort((ke,Ce)=>ve*q(ke.groupValue,Ce.groupValue));for(const ke of fe)re(ke.children,oe+1)};return re(Ie,0),{roots:Ie,leaves:D,nodes:xe,keys:ge,buckets:Oe}}#Ye(D,te){const z=new Map,X=new Map,ne=se=>{const ue=se.physical>=0?[se.physical]:[];for(const ge of se.children)ue.push(...ne(ge));if(se.children.length){const ge=this.#Xe(te,Uint32Array.from(ue),null);se.physical>=0?z.set(se.physical,ge):X.set(se.key,ge)}return ue};for(const se of D.roots)ne(se);return{byPhysical:z,byKey:X}}#qe(D){const te=this.#Ke();if(!te.length)return this.#E=null,this.#T=null,{grand:null};const z={id:this.#J("group"),columns:te.map(ye=>ye.id).join("")},X=this.#E&&this.#E.id===z.id&&this.#E.columns===z.columns,ne=this.#at()&&X?this.#C:null,se=ne?te.filter(ye=>ne.has(ye.id)):te,ue=X?this.#T:null,ge=this.#rt()?null:this.#Tt(),Oe=this.#Pe(te),Pe=ye=>{const re=D.nodes.get(ye.key);let fe=re&&re.leaves?re.leaves:null;if(ye.children&&ye.children.length){const de=ye.children.map(Pe);let ve=0;for(const Le of de)ve+=Le.length;const ke=new Uint32Array(ve);let Ce=0;for(const Le of de)ke.set(Le,Ce),Ce+=Le.length;fe=ke}fe=fe||new Uint32Array(0);const oe=ge?ge.get(ye.key)||N:fe,ce=this.#Ze(ye,ne?se:te,oe,Oe);return ye.totals=ne?{...ye.totals,...ce}:ce,fe};if(D.roots&&se.length)for(const ye of D.roots)Pe(ye);if(this.#D=D.tree?this.#Ye(D.tree,te):null,this.#E=z,this.#C=this.#at()?new Set:null,!(this.#e.config||{}).grandTotalRow)return this.#A.length=0,this.#T=null,{grand:null};const xe=ge?this.#st():D.leaves;return this.#T=this.#Oe(te,xe,ne,ue),{grand:this.#T}}#Oe(D,te,z,X){const ne={},se=this.#J("group");se!==this.#w&&(this.#ct(),this.#w=se);const ue=this.#A;this.#A=[];for(const ge of D){if(!S(ge))continue;const Oe=this.#a.handle(ge.id);if(!Oe)continue;const Pe=T(ge,"grand");if(!m(Pe,Oe)){if(z&&!z.has(ge.id)&&X&&ge.id in X){ne[ge.id]=X[ge.id];continue}ne[ge.id]=this.#Xe([ge],te,null,"grand")[ge.id];continue}let Ie=this.#O.get(ge.id);if((!Ie||Ie.fn!==Pe)&&(Ie=new n(Pe),this.#O.set(ge.id,Ie)),Ie.valid){let xe=!0;for(const ye of ue)if(ye.colId===ge.id&&!Ie.update(ye.before,ye.after)){xe=!1;break}if(xe){ne[ge.id]=Ie.value();continue}Ie.invalidate()}Ie.seedColumn(Oe.values,a(Oe),te),ne[ge.id]=Ie.valid?Ie.value():this.#Xe([ge],te,null,"grand")[ge.id]}return ne}#Pe(D){const te=this.#J("group");te!==this.#P&&(this.#v.clear(),this.#P=te);const z=new Map;for(const ne of D){if(!S(ne))continue;const se=this.#a.handle(ne.id),ue=T(ne,"group");m(ue,se)&&z.set(ne.id,{fn:ue})}if(!z.size)return this.#S.length=0,z;const X=this.#S;this.#S=[];for(const ne of X){const{beforeKeys:se,afterKeys:ue,colDeltas:ge}=ne,Oe=se.length?new Set(se):null,Pe=ue.length?new Set(ue):null;for(const{colId:Ie,before:xe,after:ye}of ge)if(z.has(Ie)){for(const re of se)Pe&&Pe.has(re)||this.#dt(re,Ie,xe,null);for(const re of ue)Oe&&Oe.has(re)||this.#dt(re,Ie,null,ye);for(const re of se)Pe&&!Pe.has(re)||this.#dt(re,Ie,xe,ye)}}return z}#dt(D,te,z,X){const ne=this.#v.get(D),se=ne&&ne.get(te);!se||!se.valid||se.update(z,X)||se.invalidate()}#Ze(D,te,z,X){if(!X||!X.size)return this.#Xe(te,z,D);const ne={};let se=null,ue=this.#v.get(D.key);for(const ge of te){const Oe=X.get(ge.id);if(!Oe){(se||(se=[])).push(ge);continue}const Pe=this.#a.handle(ge.id);if(!Pe)continue;ue||(ue=new Map,this.#v.set(D.key,ue));let Ie=ue.get(ge.id);if((!Ie||Ie.fn!==Oe.fn)&&(Ie=new n(Oe.fn),ue.set(ge.id,Ie)),Ie.valid||Ie.seedColumn(Pe.values,a(Pe),z),Ie.valid){ne[ge.id]=Ie.value();continue}(se||(se=[])).push(ge)}return se&&Object.assign(ne,this.#Xe(se,z,D)),ne}#Je(D,te,z,X){const ne=!this.#rt()||this.#Et(te);for(const se of D){const ue=se.getValue;if(!U(ue))continue;const ge=ue(z),Oe=ue(X);Object.is(ge,Oe)||(this.#C&&this.#C.add(se.id),ne&&this.#O.has(se.id)&&this.#A.push({colId:se.id,before:ge,after:Oe}))}}#ht(){const D=this.#z("groupBy",[]),te=[];for(const z of D){const X=this.#Fe(z);X&&te.push(X)}return te}#pt(D,te){const z=new Array(D.length);for(let X=0;X<D.length;X++){const ne=D[X].getValue;z[X]=g(U(ne)?ne(te):void 0)}return z}#We(D,te,z,X,ne){if(this.#rt()&&!this.#Et(z))return;const se=o(this.#pt(D,X)),ue=o(this.#pt(D,ne)),ge=se.length!==ue.length||se.some((Pe,Ie)=>Pe!==ue[Ie]),Oe=[];for(const Pe of te){const Ie=Pe.getValue;if(!U(Ie))continue;const xe=Ie(X),ye=Ie(ne);!ge&&Object.is(xe,ye)||Oe.push({colId:Pe.id,before:xe,after:ye})}!Oe.length&&!ge||this.#S.push({beforeKeys:se,afterKeys:ue,colDeltas:Oe})}#Et(D){const te=this.#l.get("filter"),z=te&&te.computed?te.result:null;if(!z)return!0;let X=0,ne=z.length-1;for(;X<=ne;){const se=X+ne>>1,ue=z[se];if(ue===D)return!0;ue<D?X=se+1:ne=se-1}return!1}#rt(){return(this.#e.config||{}).totalFilteredOnly!==!1}#te(D){return this.#rt()?D:this.#st().length}#st(){return(!this.#M||this.#M.version!==this.#u)&&(this.#M={version:this.#u,indices:this.#et()}),this.#M.indices}#Tt(){const D=this.#z("groupBy",[]),te=`${this.#u}|${JSON.stringify(D)}`;if(this.#N&&this.#N.key===te)return this.#N.map;const z=new Map,X=[];for(const ne of D){const se=this.#a.handle(ne);se&&X.push(se)}if(X.length){const ne=this.#st(),{keys:se,buckets:ue}=this.#ft("groupByColumns")(X,ne,{locale:(this.#e.config||{}).locale}),ge=new Map;for(let Oe=0;Oe<ue.length;Oe++){const Pe=se[Oe],Ie=[];for(let xe=0;xe<Pe.length;xe++){Ie.push(g(Pe[xe]));const ye=u(Ie);let re=ge.get(ye);re||(re=[],ge.set(ye,re));for(let fe=0;fe<ue[Oe].length;fe++)re.push(ue[Oe][fe])}}for(const[Oe,Pe]of ge)z.set(Oe,Uint32Array.from(Pe))}return this.#N={key:te,map:z},z}#at(){return!!(this.#e.config||{}).totalOnlyChangedColumns}#lt(){this.#ct(),this.#vt(),this.#C=null,this.#E=null,this.#T=null}#ct(){this.#O.clear(),this.#A.length=0,this.#w=-1}#vt(){this.#v.clear(),this.#S.length=0,this.#P=-1}#Ge(D){const te=this.#z("pivotBy",[]);if(!te.length)return this.#W=null,null;const z=(this.#e.compute||{}).pivot;if(!U(z))return I("source.pivot.kernel","pivot requested but ctx.compute.pivot is not available; showing unpivoted rows."),this.#W=null,null;const X=te.map(se=>this.#a.handle(se)).filter(Boolean),ne=this.#Ke();return this.#W=z(X,D.leaves,{groups:D.keys&&D.buckets?{keys:D.keys,buckets:D.buckets}:null,totals:ne.map(se=>se.id),handle:se=>this.#a.handle(se),totalOf:se=>T(ne.find(ue=>ue.id===se),"group"),separator:((this.#e.config||{}).pivot||{}).separator,maxColumns:((this.#e.config||{}).pivot||{}).maxColumns})||null,this.#W}#kt(D){const te=this.#l.get("total").result,z=!!(this.#e.config||{}).groupFooter,X=this.#Me();if(D.tree)return this.#Re(D,te,X);if(!D.roots&&!X){if(te&&te.grand&&!this.#oe()){const Pe=this.#s.grandTotal(te.grand,this.#te(D.leaves.length));if(this.#X===D.leaves&&Array.isArray(this.#F))this.#F[this.#F.length-1]=Pe;else{const Ie=Array.from(D.leaves);Ie.push(Pe),this.#F=Ie,this.#X=D.leaves}this.#B=[{at:this.#F.length-1}]}else this.#X=null,this.#F=D.leaves,this.#B=_;return this.#V=_,this.#F}const ne=[],se=[],ue=[],ge=Pe=>{if(ne.push(Pe),!X)return;const Ie=this.#ce(Pe);!Ie||!X.isOpen(Ie.key)||(Ie.master=!0,Ie.expanded=!0,ue.push({at:ne.length}),ne.push(this.#s.detail(Ie,X.heightOf(Ie))))};if(!D.roots){for(let Pe=0;Pe<D.leaves.length;Pe++)ge(D.leaves[Pe]);return te&&te.grand&&!this.#oe()&&(ue.push({at:ne.length}),ne.push(this.#s.grandTotal(te.grand,this.#te(D.leaves.length)))),this.#X=null,this.#V=_,this.#B=ue.length?ue:_,this.#F=ne,ne}const Oe=(Pe,Ie,xe)=>{if(Pe.expanded=Pe.hasChildren===!1?!1:this.#gt(Pe.key,{key:Pe.key,column:Pe.groupColumn,value:Pe.groupValue,level:Pe.level,path:Pe.groupPath}),Pe.posinset=Ie+1,Pe.setsize=xe,se.push({at:ne.length,row:Pe}),ue.push({at:ne.length}),ne.push(Pe),!!Pe.expanded){if(Pe.children&&Pe.children.length)for(let ye=0;ye<Pe.children.length;ye++)Oe(Pe.children[ye],ye,Pe.children.length);else{const ye=D.nodes.get(Pe.key),re=ye&&ye.leaves?ye.leaves:null;if(re)for(let fe=0;fe<re.length;fe++)ge(re[fe])}z&&Pe.totals&&(ue.push({at:ne.length}),ne.push(this.#s.footer(Pe)))}};for(let Pe=0;Pe<D.roots.length;Pe++)Oe(D.roots[Pe],Pe,D.roots.length);return te&&te.grand&&!this.#oe()&&(ue.push({at:ne.length}),ne.push(this.#s.grandTotal(te.grand,this.#te(D.leaves.length)))),this.#V=se,this.#B=ue,this.#F=ne,ne}#et(){const D=this.#e.store;if(D&&U(D.liveIndices))return D.liveIndices();const te=new Uint32Array(this.#n.length);let z=0;for(let X=0;X<this.#n.length;X++)this.#n[X]!==void 0&&(te[z++]=X);return te.subarray(0,z)}#j(){const D=this.#e.store;return D&&typeof D.physical=="number"?D.physical:this.#n.length}#Qe(D){const te=this.#e.store;return te&&U(te.source)?te.source(D):this.#n[D]}#_e(D,te=D){const z=this.#F[D];if(typeof z!="number")return z.index=te,z;const X=this.#ce(z);return X.index=te,X}#ce(D){let te=this.#h.get(D);te||(te=this.#s.leaf(this.#Qe(D),D),this.#h.set(D,te));const z=this.#R?this.#R.get(D):null;if(z){te.level=z.level,te.posinset=z.posinset,te.setsize=z.setsize,te.hasChildren=z.hasChildren,te.expanded=z.hasChildren&&!z.lazy&&this.#gt(te.key);const X=this.#D?this.#D.byPhysical.get(D):void 0;X?te.totals=X:te.totals&&(te.totals=null)}else te.hasChildren&&(te.level=0,te.hasChildren=!1,te.expanded=!1,te.posinset=void 0,te.setsize=void 0);return te}#Re(D,te,z){const X=[],ne=[],se=ge=>{if(ge.leafCount!==void 0)return ge.leafCount;let Oe=ge.physical>=0?1:0;for(const Pe of ge.children)Oe+=se(Pe);return ge.leafCount=Oe,Oe},ue=ge=>{const Oe=this.#gt(ge.key);if(ge.physical>=0){if(X.push(ge.physical),z&&z.isOpen(this.#ce(ge.physical).key)){const Pe=this.#ce(ge.physical);ne.push({at:X.length}),X.push(this.#s.detail(Pe,z.heightOf(Pe)))}}else X.push(this.#s.group({path:[ge.key],column:null,value:ge.value,level:ge.level,parent:null,expanded:Oe,hasChildren:ge.children.length>0,leafCount:se(ge),totals:this.#D?this.#D.byKey.get(ge.key):void 0}));if(Oe)for(const Pe of ge.children)ue(Pe)};for(const ge of D.tree.roots)ue(ge);return te&&te.grand&&!this.#oe()&&(ne.push({at:X.length}),X.push(this.#s.grandTotal(te.grand,this.#te(D.leaves.length)))),this.#X=null,this.#V=_,this.#B=ne.length?ne:_,this.#F=X,X}#$e(){return t(()=>this.count(),D=>this.at(D))}#Be(D,te){let z=this.#x.get(D);if(z===void 0){const X=this.#Qe(D),ne=this.#At(),se=[],ue=this.#e.columnHidden;for(const ge of ne){if(ge.quickFilter===!1||U(ue)&&ue(ge.id))continue;const Oe=ge.value&&U(ge.value.quickFilterText)?ge.value.quickFilterText({value:void 0,data:X,row:null,column:ge,colId:ge.id,grid:null,context:this.#z("context",null)}):null,Pe=Oe??(U(ge.formatValue)?ge.formatValue(U(ge.getValue)?ge.getValue(X):void 0):"");Pe!=null&&Pe!==""&&se.push(String(Pe))}z=se.join(" ").toLowerCase(),this.#x.set(D,z)}return te(z)}#Ke(){const D=this.#z("totals",[]),te=D&&D.length?new Set(D):null;return this.#At().filter(z=>te?te.has(z.id):!!(z.total||z.groupTotal||z.grandTotal))}#Xe(D,te,z,X="group"){const ne={},se=(this.#e.compute||{}).total;for(const ue of D){if(!S(ue))continue;const ge=this.#a.handle(ue.id);if(!ge)continue;const Oe=T(ue,X);if(Oe)if(U(Oe)){const Pe=new Array(te.length);for(let Ie=0;Ie<te.length;Ie++)Pe[Ie]=ge.get(te[Ie]);ne[ue.id]=Oe(Pe,{row:z,column:ue,grid:this.#e.grid||null,context:this.#z("context",null),valueAt:(Ie,xe)=>{const ye=this.#a.handle(Ie);return ye&&xe>=0&&xe<te.length?ye.get(te[xe]):null}})}else U(se)&&(ne[ue.id]=se(ge,te,Oe))}return ne}#mt(D){if(!D)return D;const te=this.#e.config||{},z={tz:te.timeZone,weekStartsOn:te.weekStartsOn};return p(D,X=>{const ne=y(X,z),se=this.#Fe(ne&&ne.col),ue=se&&se.type==="datetime";if(ne&&ne.type)return ne.type==="datetime"&&!ne.timeZone&&se?{...ne,timeZone:te.timeZone||void 0}:ne;if(ue)return{...ne,type:"datetime",timeZone:te.timeZone||void 0};const ge=se&&(se.dataType?.base||se.type);return ge?{...ne,type:ge}:ne})}#gt(D,te){const z=this.#z("expanded",null);return z?U(z.has)?z.has(D,te):Array.prototype.includes.call(z,D):!0}#z(D,te){if(D==="context"||!U(this.#e.stateVersion))return this.#Ot(D,te);const z=this.#Bt(D),X=this.#f.get(D);if(X&&X.version===z)return X.value;const ne=this.#Ot(D,te);return this.#f.set(D,{version:z,value:ne}),ne}#Ot(D,te){const z=this.#e.state;if(z&&U(z[D])){const X=z[D]();return X??te}return te}#St(){const D=this.#e.stateVersion;return U(D)?D():0}#ut(){const D=this.#e.columnsVersion,te=this.#e.permissionsVersion;return`${U(D)?D():0}|${U(te)?te():0}`}#Bt(D){return D==="totals"?this.#ut():`${this.#St()}`}#it(D,te,z){if(!U(this.#e.stateVersion))return z();const X=this.#d.get(D);if(X&&X.version===te)return X.key;const ne=z();return this.#d.set(D,{version:te,key:ne}),ne}#ft(D){const te=(this.#e.compute||{})[D];return U(te)||L(`ctx.compute.${D} is required by the memory source pipeline`),te}#At(){const D=this.#e.columns;return D&&U(D.all)?D.all():[]}#Fe(D){const te=this.#e.columns;return te&&U(te.get)?te.get(D):void 0}#bt(D,te){const z=this.#e.emit;U(z)&&z(D,te)}}}),_e("packages/core/src/source/abort.js",function(e,F){"use strict";Object.defineProperty(e,"SupersededError",{enumerable:!0,get:function(){return ie}}),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 I}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return L}});class ie extends Error{constructor(U,x="superseded"){super(`[lattice] request ${U?`"${U}" `:""}${x}`),this.name="SupersededError",this.superseded=!0,this.key=U}}class E{#e;constructor(U,x,q,R){this.#e=U,this.key=x,this.controller=q,this.signal=q.signal,this.seq=R}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(U){this.signal.aborted||this.controller.abort(new ie(this.key,U)),this.#e.settle(this)}}class K{#e=new Map;#t=0;begin(U="",x="superseded"){const q=this.#e.get(U);q&&!q.signal.aborted&&q.controller.abort(new ie(U,x));const R=new E(this,U,new AbortController,++this.#t);return this.#e.set(U,R),R}tokenFor(U){return this.#e.get(U)}pending(U=""){const x=this.#e.get(U);return!!x&&!x.signal.aborted}get size(){return this.#e.size}settle(U){this.#e.get(U.key)===U&&this.#e.delete(U.key)}abort(U="",x="superseded"){const q=this.#e.get(U);q&&q.abort(x)}abortAll(U="superseded"){for(const x of[...this.#e.values()])x.abort(U);this.#e.clear()}}function I(){return new K}function L(Q){if(!Q||typeof Q!="object")return!1;const U=Q;return U.superseded===!0||U.name==="AbortError"||U.name==="SupersededError"}}),_e("packages/core/src/source/blockcache.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_PAGE_SIZE",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"DEFAULT_MAX_CACHED_PAGES",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"BlockCache",{enumerable:!0,get:function(){return I}});const ie=100,E=32;class K{constructor(Q){this.id=Q,this.rows=null,this.state="pending",this.token=null,this.error=null}}class I{#e=new Map;#t;#n;#r=0;#i=-1;constructor(Q={}){this.#t=Math.max(1,Math.floor(Number(Q.pageSize)||ie)),this.#n=Math.max(1,Math.floor(Number(Q.maxCachedPages)||E))}get pageSize(){return this.#t}get maxBlocks(){return this.#n}get size(){return this.#e.size}blockOf(Q){return Math.floor(Q/this.#t)}rangeOf(Q){return{start:Q*this.#t,end:(Q+1)*this.#t}}has(Q){return this.#e.has(Q)}pending(Q){const U=this.#e.get(Q);return!!U&&U.state==="pending"}loaded(Q){const U=this.#e.get(Q);return!!U&&U.state==="loaded"}begin(Q,U){let x=this.#e.get(Q);return x||(x=new K(Q)),x.state="pending",x.token=U,x.error=null,this.#s(Q,x),x}fill(Q,U){const x=this.#e.get(Q)||new K(Q);x.rows=U,x.state="loaded",x.token=null,this.#s(Q,x)}failed(Q,U){const x=this.#e.get(Q)||new K(Q);x.state="error",x.error=U,x.token=null,this.#s(Q,x)}delete(Q){return this.#e.delete(Q)}rowAt(Q){const U=this.blockOf(Q),x=this.#e.get(U);if(!(!x||x.state!=="loaded"||!x.rows))return this.#s(U,x),x.rows[Q-U*this.#t]}rowLoaded(Q){const U=this.blockOf(Q),x=this.#e.get(U);return!!x&&x.state==="loaded"&&!!x.rows&&Q-U*this.#t<x.rows.length}erroredAt(Q){const U=this.#e.get(this.blockOf(Q));return!!U&&U.state==="error"}loadedExtent(){let Q=0;for(const U of this.#e.values()){if(U.state!=="loaded"||!U.rows)continue;const x=U.id*this.#t+U.rows.length;x>Q&&(Q=x)}return Q}fillOf(Q){const U=this.#e.get(Q);return U&&U.state==="loaded"&&U.rows?U.rows.length:null}protect(Q,U){this.#r=this.blockOf(Math.max(0,Q)),this.#i=this.blockOf(Math.max(0,U))}evict(){const Q=[];if(this.#e.size<=this.#n)return Q;for(const[U,x]of this.#e){if(this.#e.size-Q.length<=this.#n)break;U>=this.#r&&U<=this.#i||x.state!=="pending"&&Q.push(U)}for(const U of Q)this.#e.delete(U);return Q}ids(){return[...this.#e.keys()]}clear(){this.#e.clear()}#s(Q,U){this.#e.delete(Q),this.#e.set(Q,U)}}}),_e("packages/core/src/source/pagewindow.js",function(e,F){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return ie}});function ie(E,K,I,L){const Q=Math.floor(Number(E)||0);if(Q<=0)return null;const U=Math.max(0,Math.floor(Number(K)||0)),x=Math.max(0,Math.floor(Number(I)||0));if(L){const q=Math.max(1,Math.ceil(x/Q)),R=Math.min(U,q-1),j=R*Q;return{page:R,pageSize:Q,offset:j,length:Math.max(0,Math.min(Q,x-j)),pageCount:q,total:x}}return{page:U,pageSize:Q,offset:U*Q,length:Q,pageCount:Math.max(U+2,Math.ceil(x/Q)),total:null}}}),_e("packages/core/src/source/paged.js",function(e,F){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"PagedSource",{enumerable:!0,get:function(){return f}});const E=F("packages/core/src/internal/lru.js").Lru,I=F("packages/core/src/internal/predicates.js").isFunction,Q=F("packages/core/src/internal/warn.js").warnOnce,x=F("packages/core/src/internal/schedule.js").settleDebounce,q=F("packages/core/src/source/abort.js"),R=q.createAbortScope,j=q.isAbortError,k=F("packages/core/src/source/blockcache.js"),b=k.BlockCache,u=k.DEFAULT_PAGE_SIZE,g=k.DEFAULT_MAX_CACHED_PAGES,t=F("packages/core/src/source/rows.js").createRowFactory,i=F("packages/core/src/source/filterwire.js"),s=i.wireFilters,r=i.querySignature,n=i.warnHostFilterNotApplied,l=F("packages/core/src/source/pagewindow.js").pageWindow,a=120;function c(p,y){return new f(p,y)}class f{mode="paged";#e;#t;#n;#r=R();#i;#s;#a=new Map;#l=null;#o=null;#c=!1;#u=0;#f="";#d={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(y,h){this.#e=y||{mode:"paged"},this.#t=h||{},this.#n=new b({pageSize:this.#e.pageSize||u,maxCachedPages:this.#e.maxCachedPages||g}),this.#i=t(this.#t),this.#s=new E(this.#n.pageSize*4),this.#h=x((d,w)=>this.#w(d,w),a),this.#f=this.#C(),I(this.#e.fetch)||Q("source.paged.fetch",'source.mode "paged" requires a fetch function; the grid will stay empty.'),n(this.#t)}count(){const y=this.#y();return y?y.length:this.#b()}#b(){if(this.#P(),this.#l!==null)return this.#l;const y=Math.max(this.#u,this.#n.loadedExtent());return this.#c?y:y+this.#n.pageSize}matchCount(){return this.#b()}totalCount(){return this.#b()}pageInfo(){const y=this.#y();if(!y){const h=this.#b();return{page:0,pageSize:0,total:this.exact()?h:null,pageCount:1,counting:!1}}return{page:y.page,pageSize:y.pageSize,total:y.total,pageCount:y.pageCount,counting:y.total===null&&this.#r.size>0&&this.#u===0&&this.#n.loadedExtent()===0}}#y(){const y=this.#b(),h=l(this.#T("pageSize",0),this.#T("page",0),y,this.exact());if(!h)return this.#g="",null;const d=`${this.#m}:${h.offset}:${h.length}`;if(d!==this.#g&&!this.#p&&(this.#g=d,h.length>0)){const w=h.offset+h.length-1;this.#d={start:h.offset,end:w},this.#w(h.offset,w)}return h}at(y){const h=this.#y();if(h){if(y<0||y>=h.length)return;const d=this.#O(h.offset+y);return d&&(d.index=y),d}return this.#O(y)}#O(y){if(y<0||y>=this.#b())return;const h=this.#s.get(y);if(h&&(h.data!==null||!this.#n.rowLoaded(y)))return h;const d=this.#n.rowAt(y);if(d===void 0){const v=this.#i.skeleton(y,0,this.#n.erroredAt(y));return this.#s.set(y,v),v}const w=this.#i.leaf(d,y);return w.index=y,this.#s.set(y,w),this.#a.set(w.key,y),w}byKey(y){const h=this.#a.get(y);return h===void 0?void 0:this.#O(h)}loaded(y){const h=this.#y();return h?y>=0&&y<h.length&&this.#n.rowLoaded(h.offset+y):this.#n.rowLoaded(y)}loadedCount(){this.#P();let y=0;for(const h of this.#n.ids()){if(!this.#n.loaded(h))continue;const d=this.#n.fillOf(h);typeof d=="number"&&(y+=d)}return y}residentRows(){this.#P();const y=this.#y(),h=y?y.offset:0,d=y?y.offset+y.length:1/0,w=[],v=this.#n.ids().sort((P,W)=>P-W);for(const P of v){if(!this.#n.loaded(P))continue;const{start:W}=this.#n.rangeOf(P),V=this.#n.fillOf(P)||0;for(let G=W;G<W+V;G++){if(G<h||G>=d)continue;const _=this.#s.peek(G);if(_&&_.data!==null&&_.data!==void 0){w.push(_);continue}const T=this.#n.rowAt(G);if(T===void 0)continue;const S=this.#i.leaf(T,G);S.index=G,this.#s.set(G,S),this.#a.set(S.key,G),w.push(S)}}return w}hint(y,h){if(this.#p)return;const d=this.#P();let w=Math.max(0,Math.floor(y)),v=Math.max(w,Math.floor(h));const P=this.#y();if(P){if(P.length===0)return;w=P.offset,v=P.offset+P.length-1}this.#d={start:w,end:v},this.#n.protect(w,v);for(const W of this.#n.evict())this.#v(W);this.#h(w,v),d&&this.#h.flush()}#w(y,h){if(this.#p)return;this.#n.protect(y,h);const d=this.#n.blockOf(y),w=this.#n.blockOf(h);for(let v=d;v<=w&&!(this.#l!==null&&v*this.#n.pageSize>=this.#l);v++)this.#n.has(v)||this.#A(v)}apply(y){const h={added:[],updated:[],removed:[]};if(!y)return h;if(y.update)for(const d of y.update){const w=this.#i.keyOf(d,-1),v=this.#a.get(w);if(v===void 0)continue;const P=this.#i.leaf(d,v);P.index=v,this.#s.set(v,P),h.updated.push(P)}return(y.add&&y.add.length||y.remove&&y.remove.length)&&this.reload(),h}reload(y){this.#S("reload"),this.#h.cancel(),this.hint(this.#d.start,this.#d.end)}destroy(){this.#p=!0,this.#h.cancel(),this.#r.abortAll("destroyed"),this.#n.clear(),this.#s.clear(),this.#a.clear()}exact(){return this.#l!==null||this.#c}pending(){return this.#r.size}async#A(y){if(!I(this.#e.fetch))return;const h=this.#r.begin(`block:${y}`);this.#n.begin(y,h);const{start:d,end:w}=this.#n.rangeOf(y),v=this.#f;try{const P=await this.#e.fetch({range:{start:d,end:w},sort:this.#T("sort",[]),filters:s(this.#T("filters",null),this.#E()),quick:this.#T("quick","")||void 0,context:this.#T("context",null),signal:h.signal});if(!h.current||v!==this.#f||this.#p)return;h.settle();const W=P&&P.rows||[];this.#n.fill(y,W);for(let G=0;G<W.length;G++)this.#s.delete(d+G);const V=P&&typeof P.total=="number"?P.total:P&&typeof P.count=="number"?P.count:null;V!==null?(this.#l=V,this.#c=!0):W.length<this.#n.pageSize?(this.#c=!0,this.#l=d+W.length):this.#u=Math.max(this.#u,d+W.length),this.#M("model:changed",{reason:"page",block:y,from:d,to:d+W.length}),this.#M("rows:changed",{companion:!0,reason:"page",block:y,from:d,to:d+W.length}),this.#l!==null&&this.#l!==this.#o&&(this.#o=this.#l,this.#M("source:total",{total:this.#l,groupPath:[]}))}catch(P){if(h.settle(),j(P))return;this.#n.failed(y,P);for(let W=d;W<w;W++)this.#s.delete(W);this.#M("model:changed",{reason:"page-error",block:y,range:{start:d,end:w}}),this.#M("source:error",{error:P,block:y,range:{start:d,end:w}})}}#v(y){const{start:h,end:d}=this.#n.rangeOf(y);for(let w=h;w<d;w++){const v=this.#s.peek(w);v&&this.#a.delete(v.key),this.#s.delete(w)}}#P(){const y=this.#C();return y===this.#f?!1:(this.#f=y,this.#S("query"),!0)}#S(y){this.#r.abortAll(y),this.#n.clear(),this.#s.clear(),this.#a.clear(),this.#l=null,this.#o=null,this.#c=!1,this.#u=0,this.#m++,this.#M("model:changed",{reason:y})}#C(){return r({filters:this.#T("filters",null),sort:this.#T("sort",[]),quick:this.#T("quick",""),context:this.#T("context",null)})}#E(){const y=this.#t.config||{};return{tz:y.timeZone,weekStartsOn:y.weekStartsOn}}#T(y,h){const d=this.#t.state;if(d&&I(d[y])){const w=d[y]();return w??h}return h}#M(y,h){const d=this.#t.emit;I(d)&&d(y,h)}}}),_e("packages/core/src/source/aggregates.js",function(e,F){"use strict";Object.defineProperty(e,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"pushableAggregates",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"fillAggregateSql",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"aggregateP",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"routeAggregate",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"resolveAggregatePlan",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"groupKeysPushable",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"pushdownDocRows",{enumerable:!0,get:function(){return R}});const ie=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)"},percentile:{pushable:!0,class:"identical",sql:"quantile_cont(%c, %p)",parametric:!0},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 j=new Set;for(const[k,b]of Object.entries(ie))b.pushable&&j.add(k);return j}function K(j,k,b,u="?"){let g=j.split("%c").join(k);return b!==void 0&&(g=g.split("%w").join(b)),g.split("%p").join(u)}function I(j){const k=j&&(j.p!==void 0?j.p:j.params&&j.params.p);return typeof k=="number"&&k>=0&&k<=1?k:void 0}function L(j){const k=j||{},b=k.default==="engine"||k.default==="engine-if-identical"?k.default:"client",u={};if(k.overrides&&typeof k.overrides=="object")for(const[g,o]of Object.entries(k.overrides))(o==="engine"||o==="client")&&(u[g]=o);return{default:b,overrides:u}}function Q(j,k){const b=ie[j];if(!b||!b.pushable)return"client";const u=k.overrides[j];return u==="engine"||u==="client"?u:k.default==="client"?"client":k.default==="engine-if-identical"?b.class==="identical"?"engine":"client":"engine"}function U(j,k){const b=L(k),u=[],g=[];for(const o of j||[]){const t=ie[o.fn],i=Q(o.fn,b),s={id:o.id,col:o.col,fn:o.fn,class:t?t.class:"fallback"};if(o.weight!==void 0&&(s.weight=o.weight),o.params!==void 0&&(s.params=o.params),t&&t.parametric){const r=I(o);r!==void 0&&(s.p=r)}if(i==="engine"&&t&&t.parametric&&s.p===void 0){g.push({...s,reason:`"${o.fn}" needs \`p\`, a number from 0 to 1`});continue}i==="engine"?u.push(s):(s.reason=t&&!t.pushable?t.note||"the engine cannot express this stat":"client by config",g.push(s))}return{engine:u,client:g,config:b}}const x=/^[A-Za-z_][A-Za-z0-9_$]*$/;function q(j,k=[]){return(j||[]).every(u=>{if(typeof u=="string")return x.test(u);if(!u||typeof u!="object")return!1;const g=u;return Array.isArray(k)&&k.includes(g.bucket)&&typeof g.col=="string"&&x.test(g.col)&&typeof g.size=="number"&&Number.isFinite(g.size)&&g.size>0})}function R(){return Object.entries(ie).map(([j,k])=>({stat:j,class:k.class,sql:k.sql?K(k.sql,"col",k.twoColumn?"weight":void 0):"",note:k.note||(k.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),_e("packages/core/src/source/pushdown.js",function(e,F){"use strict";Object.defineProperty(e,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"NO_CAPABILITIES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"capabilitiesOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"splitFilters",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"applyResidual",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"createPushdownSource",{enumerable:!0,get:function(){return z}});const E=F("packages/core/src/internal/compare.js").defaultCompare,I=F("packages/core/src/internal/predicates.js").isFunction,Q=F("packages/core/src/internal/merge.js").toArray,x=F("packages/core/src/internal/warn.js").warnOnce,q=F("packages/core/src/source/filterwire.js"),R=q.isGroup,j=q.warnWherePageRelative,k=q.warnWhereOverThreshold,b=q.wireFilters,u=F("packages/core/src/source/aggregates.js"),g=u.resolveAggregatePlan,o=u.groupKeysPushable,t=u.STAT_PUSHDOWN,i=u.aggregateP,s=u.fillAggregateSql,n=F("packages/core/src/source/abort.js").SupersededError,m=1e3;function l(X){const ne=X&&X.signal;if(!ne||!ne.aborted)return;const se=ne.reason;throw se instanceof Error?se:new n("","superseded before it was sent")}const a=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function c(X){if(!X||typeof X!="object")return!1;const ne=X.returning==="row"||X.returning==="key"?X.returning:"none";return{append:X.append===!0,update:X.update===!0,delete:X.delete===!0,returning:ne}}function f(X,ne){if(!X||typeof ne!="string")return;if(!ne.includes("."))return X[ne];let se=X;for(const ue of ne.split(".")){if(se===null||typeof se!="object")return;se=se[ue]}return se}function p(X){if(X===!0)return!0;if(!X||typeof X!="object")return!1;const ne=X;return ne.enabled===!1?!1:ne.enabled===!0||I(ne.commit)}function y(X){const ne={...a,...X||{}};return ne.operators=new Set(ne.operators||[]),ne.mutate=c(ne.mutate),ne}function h(X,ne){return!X||!X.op||!ne.operators.size?!1:ne.operators.has(X.op)}function d(X,ne){if(!X)return{pushed:null,residual:null};if(!ne.filter)return{pushed:null,residual:X};if(ne.filter==="term"){if(R(X)){const Oe=X.conditions||[];if(String(X.op)!=="and")return{pushed:null,residual:X};const Pe=Oe.findIndex(xe=>!R(xe)&&h(xe,ne));if(Pe<0)return{pushed:null,residual:X};const Ie=Oe.filter((xe,ye)=>ye!==Pe);return{pushed:Oe[Pe],residual:Ie.length?{op:"and",conditions:Ie}:null}}return h(X,ne)?{pushed:X,residual:null}:{pushed:null,residual:X}}if(!R(X))return h(X,ne)?{pushed:X,residual:null}:{pushed:null,residual:X};if(String(X.op)!=="and")return(X.conditions||[]).every(Pe=>R(Pe)?d(Pe,ne).residual===null:h(Pe,ne))?{pushed:X,residual:null}:{pushed:null,residual:X};const se=[],ue=[];for(const Oe of X.conditions||[]){if(R(Oe)){if(ne.filter==="flat"){ue.push(Oe);continue}const Pe=d(Oe,ne);Pe.pushed&&se.push(Pe.pushed),Pe.residual&&ue.push(Pe.residual);continue}(h(Oe,ne)?se:ue).push(Oe)}const ge=Oe=>Oe.length===0?null:Oe.length===1?Oe[0]:{op:"and",conditions:Oe};return{pushed:ge(se),residual:ge(ue)}}const w="__lattice_leaves";function v(X){return X.aggregates?X.aggregates instanceof Set?X.aggregates:new Set(Q(X.aggregates)):new Set}function P(X){const ne=v(X);return ne.size?ne.has("count")?X.filter!=="tree"||!X.operators||!X.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 W(X,ne,se,ue,ge,Oe,Pe){const Ie=Array.isArray(X.groupBy)?X.groupBy:[],xe=Array.isArray(X.groupPath)?X.groupPath:[],ye=Array.isArray(X.groupValues)?X.groupValues:null;if(!ne.group){const re=P(ne);if(re)return re}return o(Ie)?se.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":ue?ge?Oe&&!Oe.conditioned?"a host `where` predicate can only run in the browser, over rows the engine grouped":Pe?"fullDataset holds the whole matching set, so the grid groups it itself":!ye||ye.length!==xe.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 V="pushdown:pivot-unsupported",G="pushdown:group-unsupported",_=Symbol("lattice.remote.ungroupedLevel");function T(X,ne,se,ue,ge,Oe){const Pe=Array.isArray(X.pivotBy)?X.pivotBy:[],Ie=Array.isArray(X.groupBy)?X.groupBy:[],xe=Array.isArray(X.groupPath)?X.groupPath:[],ye=Array.isArray(X.groupValues)?X.groupValues:null;return ne.pivot?o(Pe)?Ie.length&&!o(Ie)?"a grouping key is not a plain column the engine can name in a GROUP BY":se.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":ue?ge?Oe&&!Oe.conditioned?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!ye||ye.length!==xe.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 S(X,ne,se=!1){const ue=d(X.filters||null,ne),ge=[];ue.residual&&ge.push("filter");const Oe=X.sort||[],Pe=Oe.length===0||ne.sort==="multi"&&Oe.length>=1||ne.sort==="single"&&Oe.length===1;!Pe&&Oe.length&&ge.push("sort");const Ie=X.quick?String(X.quick):"",xe=!Ie||!!ne.quick;xe||ge.push("quick");const ye=X.where&&X.where.active?X.where:null;ye&&ge.push("where");const re={filters:ue.residual,sort:Pe?null:Oe,quick:xe?"":Ie,where:ye},fe=!!se,oe=Array.isArray(X.groupBy)&&X.groupBy.length>0,ce=oe?W(X,ne,ue,Pe,xe,ye,fe):"",de=X.pivotMode!==!1&&Array.isArray(X.pivotBy)&&X.pivotBy.length>0,ve=de?T(X,ne,ue,Pe,xe,ye):"",ke=de&&ve==="";de&&!ke&&ge.push("pivot");const Ce=de?ke&&oe:oe&&ce==="";oe&&!de&&!Ce&&ge.push("group");const Le=(Ce||ke)&&Array.isArray(X.groupValues)?X.groupValues.length:0;ye&&ye.conditioned&&(Ce||ke)&&(re.where=null,ge.splice(ge.indexOf("where"),1));const we=Ce||de?!1:fe||!!(re.filters||re.sort||re.quick||re.where)||!ne.range;return{pushed:{...X,filters:ue.pushed,sort:Pe?Oe:[],quick:xe?Ie:"",range:we?null:X.range},residual:re,needsAll:we,unpushed:ge,full:fe,grouped:Ce,groupLevel:Le,groupReason:de?"":ce,pivoted:ke,pivotReason:ve}}function O(X){const ne=Array.isArray(X.totals)?X.totals:[],se=X.totalFns&&typeof X.totalFns=="object"?X.totalFns:{},ue=[],ge=[];for(const Oe of ne){const Pe=String(Oe),Ie=se[Pe],xe=typeof Ie=="string"?Ie:Ie&&typeof Ie.fn=="string"?Ie.fn:null,ye=Ie&&typeof Ie=="object"?i(Ie):void 0,re=xe?t[xe]:null;re&&re.parametric&&ye===void 0?ge.push({id:Pe,fn:xe,class:re.class,reason:`"${xe}" needs \`p\`, a number from 0 to 1`}):xe?!re||!re.pushable||!re.sql?ge.push({id:Pe,fn:xe,class:re?re.class:"fallback",reason:re&&re.note?re.note:`the pushdown map cannot express "${xe}"`}):re.twoColumn?ge.push({id:Pe,fn:xe,class:re.class,reason:`"${xe}" reduces two columns, and a grouped request carries no weight column`}):ue.push({id:Pe,col:Pe,fn:xe,class:re.class,...ye!==void 0?{p:ye}:{}}):ge.push({id:Pe,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:ue,client:ge}}function M(X){return{...X,engine:X.engine.map(ne=>{const se=t[ne.fn];if(!se||!se.sql)return ne;const ue=ge=>`"${ge}"`;return{...ne,sql:s(se.sql,ue(ne.col),ne.weight!==void 0?ue(ne.weight):void 0)}})}}const A=Object.freeze({items:X=>X==null?[]:Array.isArray(X)?X:[X]});function N(X,ne,se){if(!ne)return X;let ue=X;if(ne.filters&&I(se.evaluateFilters)){const ge=ue,Oe={count:ue.length,handle:xe=>({id:xe,get:ye=>f(ge[ye],xe)}),itemwise:xe=>ge.some(ye=>Array.isArray(f(ye,xe)))?A:null},Pe=se.evaluateFilters(ne.filters,Oe),Ie=[];for(let xe=0;xe<ue.length;xe++)Pe[xe]&&Ie.push(ue[xe]);ue=Ie}if(ne.where&&ne.where.active&&(ne.whole||j(ne.where.names,"pushdown"),ue=ue.filter(ge=>ne.where.passes(ge))),ne.quick){const ge=ne.quick.toLowerCase();ue=ue.filter(Oe=>{if(!Oe||typeof Oe!="object")return!1;for(const Pe of Object.values(Oe))if(Pe!=null&&String(Pe).toLowerCase().includes(ge))return!0;return!1})}if(ne.sort&&ne.sort.length&&I(se.sortMulti)){const ge=[...new Set(ne.sort.map(xe=>xe.col))],Oe=ue,Pe=ge.map(xe=>({id:xe,get:ye=>f(Oe[ye],xe)})),Ie=se.sortMulti(Pe,ne.sort.map(xe=>({col:xe.col,dir:xe.dir})),Uint32Array.from({length:ue.length},(xe,ye)=>ye),{});ue=Array.from(Ie,xe=>Oe[xe])}return ue}function $(X){return JSON.stringify({filters:X.filters||null,sort:X.sort||[],quick:X.quick||"",groupBy:X.groupBy||[],groupPath:X.groupPath||[],context:X.context??null})}function H(X){if(!X||typeof X!="object")return 16;let ne="";try{ne=JSON.stringify(X)}catch{return 200}return ne.length*2+64}function Y(X){const ne=X||{};return{enabled:!!ne.enabled,maxRows:Number.isFinite(ne.maxRows)?ne.maxRows:1e6,maxBytesEstimate:Number.isFinite(ne.maxBytesEstimate)?ne.maxBytesEstimate:512*1024*1024}}const Z=5e4;function J(X){return Number.isFinite(X)&&X>=0?X:Z}function D(X){return!!X&&I(X.then)}async function te(X){if(!X||X.total!==void 0||!D(X.pendingTotal))return X;const ne=await X.pendingTotal,{pendingTotal:se,...ue}=X;return typeof ne=="number"?{...ue,total:ne}:ue}function z(X={}){const ne=X.adapter;if(!ne||!I(ne.execute))return x("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...X,mode:"remote",fetch:async()=>({rows:[],total:0})};const se=y(ne.capabilities),ue=ne.capabilities&&Object.getOwnPropertyDescriptor(ne.capabilities,"operators");ue&&I(ue.get)&&Object.defineProperty(se,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(ne.capabilities.operators||[]),set:()=>{}});const ge=ne.name||"adapter";let Oe=null;const Pe=()=>I(ne.ready)?(Oe||(Oe=Promise.resolve(ne.ready()).then(()=>{Object.assign(se,y(ne.capabilities))},Re=>{throw Oe=null,Re})),Oe):null,Ie=Y(X.fullDataset),xe=!!X.allowPartialResults,ye=J(X.whereRowLimit);let re=null;const fe=X.aggregates;let oe=null,ce=null,de=null,ve=null,ke=null,Ce=null,Le=0,we=null;const He=()=>!Ie.enabled||!oe?null:(we!==oe.key&&(Le++,we=oe.key),{rows:oe.rows,version:Le}),Te=async Re=>{const ze=Re.where&&Re.where.active?Re.where:null;if(!ze)return{request:Re,probe:null};if(ze.conditioned){const Ot=S(Re,se,Ie.enabled);if(Ot.grouped||Ot.pivoted)return{request:Re,probe:null}}const{where:De,...Ge}=Re,Ve=S(Ge,se,Ie.enabled);if(Ve.needsAll)return{request:Re,probe:null};const Qe=$(Ve.pushed);let mt=null;return(!re||re.key!==Qe)&&(se.total?(l(Re),mt=await te(await ne.execute(Ve.pushed,Re)),re={key:Qe,size:mt&&typeof mt.total=="number"?mt.total:null}):re={key:Qe,size:null}),re.size!==null&&re.size<ye?{request:Re,probe:null}:(k(ze.names,ge,re.size,ye),{request:Ge,probe:mt})},Ae=async(Re,ze)=>{Ce=null;const De=O(Re.pushed);de={engine:De.engine,client:De.client,groupBy:Re.pushed.groupBy},De.client.length&&x(`source.pushdown.group.totals.${ge}.${De.client.map(Qe=>Qe.id).join(".")}`,`the ${ge} adapter cannot compute the group subtotal for ${De.client.map(Qe=>`"${Qe.id}" (${Qe.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 Ge=await ne.executeGroupLevel(Re.pushed,De.engine,ze)||{};let Ve=Ge.rows||[];return!se.range&&ze.range&&(Ve=Ve.slice(ze.range.start,ze.range.end)),Be(Ge),Ge.total===void 0?{rows:Ve}:{rows:Ve,total:Ge.total}},Se=new Map,Ee=64,Me=async(Re,ze)=>{Ce=null;const De=Re.pushed,Ge=De.groupBy,Ve=Array.isArray(De.groupValues)?De.groupValues:[],Qe=Ve.length,mt=[...De.filters?[De.filters]:[],...Ge.slice(0,Qe).map((rt,lt)=>({col:rt,op:"eq",value:Ve[lt]===void 0?null:Ve[lt],caseSensitive:!0}))],Ot=mt.length===0?null:mt.length===1?mt[0]:{op:"and",conditions:mt},gt=ze.range?ze.range.start:0;if(Qe>=Ge.length){const rt={...De,filters:Ot,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},lt=await te(await ne.execute(rt,ze))||{};let Rt=lt.rows||[];return!se.range&&ze.range&&(Rt=Rt.slice(ze.range.start,ze.range.end)),typeof lt.total=="number"?{rows:Rt,total:lt.total}:{rows:Rt}}const dt=Ge[Qe],jt=O(De),xt=v(se),At=jt.engine.filter(rt=>xt.has(rt.fn)),Bt=[...jt.engine.filter(rt=>!xt.has(rt.fn)).map(rt=>({id:rt.id,fn:rt.fn,class:rt.class,reason:`the ${ge} adapter does not compute "${rt.fn}"`})),...jt.client];de={engine:At,client:Bt,groupBy:Ge},Bt.length&&x(`source.pushdown.group.totals.${ge}.${Bt.map(rt=>rt.id).join(".")}`,`the ${ge} adapter cannot compute the group subtotal for ${Bt.map(rt=>`"${rt.id}" (${rt.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 nn=[...At.map(rt=>({id:rt.id,col:rt.col,fn:rt.fn,...rt.p!==void 0?{p:rt.p}:{}})),{id:w,col:dt,fn:"count"}],Vt={...De,filters:Ot,range:null},Zt=JSON.stringify([$(Vt),Ve,dt,nn]);let Xe=gt>0?Se.get(Zt):void 0;if(!Xe){for(Xe=Promise.resolve(ne.executeGroupedAggregates(Vt,[dt],nn)),Se.delete(Zt),Se.set(Zt,Xe);Se.size>Ee;)Se.delete(Se.keys().next().value);Xe.catch(()=>{Se.get(Zt)===Xe&&Se.delete(Zt)})}const ot=await Xe||[];l(ze);const vt=rt=>{const lt={};for(const Rt of At)lt[Rt.id]=rt?rt[Rt.id]:void 0;return lt},pt=(De.sort||[]).find(rt=>rt&&rt.col===dt),yt=pt&&pt.dir==="desc"?-1:1,We=ot.filter(rt=>rt&&rt.level===1).map(rt=>({[dt]:rt.keys[0]===void 0?null:rt.keys[0],leafCount:Number(rt.values&&rt.values[w])||0,totals:vt(rt.values)})).sort((rt,lt)=>yt*E(rt[dt],lt[dt]));if(Qe===0){const rt=ot.find(Rt=>Rt&&Rt.level===0),lt=rt?Number(rt.values&&rt.values[w]):NaN;Be({matchCount:Number.isFinite(lt)?lt:We.reduce((Rt,Lt)=>Rt+Lt.leafCount,0),...rt?{grand:vt(rt.values)}:{}})}const at=ze.range?ze.range.end:We.length;return{rows:We.slice(gt,at),total:We.length}},Be=Re=>{typeof Re.matchCount=="number"&&(ve=Re.matchCount,ke=Re.grand?{totals:Re.grand,leafCount:Re.matchCount}:null)},Ke=async(Re,ze)=>{Ce=null;const De=O(Re.pushed);de={engine:De.engine,client:De.client,groupBy:Re.pushed.groupBy,pivotBy:Re.pushed.pivotBy},De.client.length&&x(`source.pushdown.pivot.totals.${ge}.${De.client.map(Ot=>Ot.id).join(".")}`,`the ${ge} adapter cannot compute the pivot cells for ${De.client.map(Ot=>`"${Ot.id}" (${Ot.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 Ge=await ne.executePivotLevel(Re.pushed,De.engine,ze)||{};let Ve=Ge.rows||[];!se.range&&ze.range&&(Ve=Ve.slice(ze.range.start,ze.range.end)),Be(Ge);const Qe=Ge.pivot&&typeof Ge.pivot=="object"?Ge.pivot:{},mt={cells:Array.isArray(Qe.cells)?Qe.cells:[],...Array.isArray(Qe.axis)?{axis:Qe.axis}:{}};return Ge.total===void 0?{rows:Ve,pivot:mt}:{rows:Ve,total:Ge.total,pivot:mt}},et=Re=>{x(`source.pushdown.pivot.${ge}.${Re}`,`pushdown:pivot-unsupported: the ${ge} adapter cannot pivot this query because ${Re}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const ze=new Error(`[lattice] ${V}: the ${ge} adapter cannot pivot this query because ${Re}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw ze.code=V,ze.reason=Re,ze},Je=(Re,ze)=>{const De={key:ze,state:"pending",value:null};return Ce=De,Re.then(Ge=>(Ce===De&&(Ce={key:ze,state:"settled",value:typeof Ge=="number"?Ge:null}),Ge),Ge=>{throw Ce===De&&(Ce={key:ze,state:"failed",value:null}),Ge})};let ut=0,Ct=[];const Nt=()=>ut===0?null:new Promise(Re=>{const ze=setTimeout(Re,m);Ct.push(()=>{clearTimeout(ze),Re()})});let st;const it=async Re=>{const ze=Pe();ze&&await ze;const Ge=Re&&Re.pivotMode!==!1&&Array.isArray(Re.pivotBy)&&Re.pivotBy.length>0?{request:Re,probe:null}:await Te(Re);l(Re);let Ve=S(Ge.request,se,Ie.enabled);if(se.group&&Ve.grouped&&!Ve.pivoted&&!I(ne.executeGroupLevel)&&(x(`source.pushdown.group.method.${ge}`,`the ${ge} 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.`),Ve=S(Ge.request,{...se,group:!1,aggregates:null},Ie.enabled)),Ve.pivoted&&!I(ne.executePivotLevel)&&(Ve=S(Ge.request,{...se,pivot:!1},Ie.enabled),Ve.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Ve.grouped&&!Ve.pivoted&&!se.group&&!I(ne.executeGroupedAggregates)&&(x(`source.pushdown.group.aggregates.method.${ge}`,`the ${ge} 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\`.`),Ve=S(Ge.request,{...se,aggregates:null},Ie.enabled)),ce=Ve,Ve.pivoted)return Ke(Ve,Re);if(Ve.pivotReason&&et(Ve.pivotReason),Ve.grouped)return se.group?Ae(Ve,Re):Me(Ve,Re);const mt=!!Ve.groupReason&&!Ve.full;mt?x(`source.pushdown.group-unsupported.${ge}.${Ve.groupReason}`,`pushdown:group-unsupported: the ${ge} adapter was not asked to group this query because ${Ve.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.`):Ve.groupReason&&x(`source.pushdown.group.${ge}.${Ve.groupReason}`,`the ${ge} adapter was not asked to group this query because ${Ve.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 Ot=Vt=>mt?{...Vt,[_]:!0}:Vt;if(!Ve.needsAll){const Vt=Ge.probe||await ne.execute(Ve.pushed,Re),Zt=Vt.rows||[];return D(Vt.pendingTotal)&&Vt.total===void 0?Ot({rows:Zt,pendingTotal:Je(Vt.pendingTotal,$(Ve.pushed))}):(Ce=null,!se.total&&Vt.total===void 0?Ot({rows:Zt}):Ot({rows:Zt,total:Vt.total??Zt.length}))}const gt=Ve.unpushed.filter(Vt=>!(Vt==="where"&&Ve.residual.where&&Ve.residual.where.anyConditioned));gt.length&&x(`source.pushdown.residual.${ge}.${gt.join(".")}`,`the ${ge} adapter cannot push ${gt.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 dt=$(Ve.pushed);if(!oe||oe.key!==dt){const Vt=await te(await ne.execute(Ve.pushed,Re));Ce=null;const Zt=Vt.rows||[];if(Ve.full){const Xe=typeof Vt.total=="number"?Math.max(Vt.total,Zt.length):Zt.length;if(Xe>Ie.maxRows)throw new Error(`[lattice] fullDataset refused: the ${ge} adapter's matching set is ${Xe.toLocaleString()} rows, past the configured maxRows of ${Ie.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 ot=Zt.length*H(Zt[0]);if(ot>Ie.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${ge} adapter's matching set is an estimated ${Math.round(ot/(1024*1024)).toLocaleString()} MB across ${Zt.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(Ie.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 Vt.total=="number"&&Zt.length<Vt.total){const Xe=!!(Ve.residual.filters||Ve.residual.quick||Ve.residual.sort&&Ve.residual.sort.length);if(Xe&&!xe)throw new Error(`[lattice] the ${ge} adapter returned ${Zt.length} of ${Vt.total} matching rows when asked for the whole result, and the query has residual ${Ve.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.`);Xe?x(`source.pushdown.partial.residual.${ge}`,`the ${ge} adapter returned ${Zt.length} of ${Vt.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.`):x(`source.pushdown.partial.${ge}`,`the ${ge} adapter returned ${Zt.length} of ${Vt.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}oe={key:dt,rows:Zt,total:typeof Vt.total=="number"?Vt.total:null}}let jt=Ve;if(Ve.residual.where){const Vt=oe.total??oe.rows.length;if(Vt>=ye){k(Ve.residual.where.names,ge,Vt,ye);const{where:Zt,...Xe}=Ge.request;jt=S(Xe,se,Ie.enabled),ce=jt}}const xt=oe.total!==null&&oe.rows.length>=oe.total,At=N(oe.rows,{...jt.residual,whole:xt},X.compute||{}),Bt=Re.range?Re.range.start:0,nn=Re.range?Re.range.end:At.length;return Ot({rows:At.slice(Bt,nn),total:At.length})},ct=async(Re,ze,De)=>{const Ve=De&&De.waitForPage&&st&&I(st.pageForegroundIdle)?st.pageForegroundIdle():Nt();Ve&&await Ve;const Qe=Pe();Qe&&await Qe;const mt=S(Re,se,Ie.enabled);ce=mt;const Ot=g(ze,De&&De.engine?{default:"engine"}:fe),gt=Array.isArray(Re.groupBy)?Re.groupBy:[],dt=gt.length>0,jt=!mt.residual.filters&&!mt.residual.quick,xt=!dt||o(gt,se.buckets);let At=Ot.engine,Bt=Ot.client;if(se.aggregates&&At.length){const ot=se.aggregates instanceof Set?se.aggregates:new Set(Q(se.aggregates)),vt=At.filter(pt=>!ot.has(pt.fn));vt.length&&(At=At.filter(pt=>ot.has(pt.fn)),Bt=[...vt.map(pt=>({...pt,reason:`the ${ge} adapter does not compute "${pt.fn}"`})),...Bt])}const nn=ot=>{Bt=[...At.map(vt=>({...vt,reason:ot})),...Bt],At=[]};let Vt="";if(At.length&&!jt){const ot=mt.residual.quick&&!mt.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)";nn(ot),dt&&(Vt=ot)}else if(At.length&&!xt){const ot="a grouping key the engine cannot form forces all-client (no mixed provenance)";nn(ot),Vt=ot}let Zt={},Xe;if(At.length&&(I(dt?ne.executeGroupedAggregates:ne.executeAggregates)?dt?Xe=await ne.executeGroupedAggregates(mt.pushed,gt,At)||[]:Zt=await ne.executeAggregates(mt.pushed,At)||{}:(x(`source.pushdown.aggregates.${ge}${dt?".grouped":""}`,`the ${ge} adapter cannot compute ${dt?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),nn(`adapter cannot compute ${dt?"grouped ":""}aggregates`),dt&&(Vt=`the ${ge} adapter cannot compute grouped aggregates`))),dt){const ot=Xe!==void 0;ot!==mt.grouped&&(ce={...mt,grouped:ot,groupReason:ot?"":Vt||mt.groupReason,unpushed:ot?mt.unpushed.filter(vt=>vt!=="group"):mt.unpushed.includes("group")?mt.unpushed:[...mt.unpushed,"group"]})}return de={engine:At,client:Bt,...dt?{groupBy:gt}:{}},{values:Zt,engine:At,client:Bt,...Xe!==void 0?{groups:Xe}:{}}},Tt=async Re=>{ut++;try{return await it(Re)}finally{if(ut--,ut===0&&Ct.length){const ze=Ct;Ct=[];for(const De of ze)De()}}},$t=p(X.edit),It=X.edit&&typeof X.edit=="object"&&I(X.edit.commit);let ft=X.edit;if($t&&!It)if(se.mutate&&se.mutate.update){const Re=ze=>{if(!se.mutate||!se.mutate.update)throw new Error(`[lattice] the ${ge} 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 De={kind:"update",key:String(ze.key),patch:{[ze.colId]:ze.value}};return ne.mutate(De,ze.request||{})};ft={...X.edit===!0?{}:X.edit,commit:Re}}else x(`source.pushdown.readonly.${ge}`,`edit is enabled but the ${ge} adapter declares mutate: ${se.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 ae=$t&&se.mutate&&(se.mutate.append||se.mutate.delete)?{append:se.mutate.append===!0,remove:se.mutate.delete===!0,returning:se.mutate.returning,mutate:(Re,ze)=>ne.mutate(Re,ze||{})}:null,me=async Re=>{const ze=Pe();ze&&await ze;const{range:De,signal:Ge,export:Ve,...Qe}=Re||{},mt={...Qe,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:S(mt,se,Ie.enabled),signal:Ge}};async function*be(Re,ze={}){const{plan:De,signal:Ge}=await me(Re),Ve=Math.max(1,Math.floor(Number(ze.pageSize))||5e3),Qe={signal:Ge,stream:!0},mt=Re&&Re.range&&Number.isFinite(Number(Re.range.start))&&Number.isFinite(Number(Re.range.end))?{start:Math.max(0,Number(Re.range.start)),end:Math.max(0,Number(Re.range.end))}:null;if(!De.needsAll){const dt=mt?mt.start:0,jt=mt?mt.end:1/0;for(let xt=dt;xt<jt;xt+=Ve){l(Qe);const At=Math.min(xt+Ve,jt),Bt=await ne.execute({...De.pushed,range:{start:xt,end:At}},Qe);Bt&&D(Bt.pendingTotal)&&Bt.pendingTotal.then(null,()=>{});const nn=Bt&&Bt.rows||[];if(nn.length&&(yield nn),nn.length<At-xt)return}return}l(Qe);const Ot=await te(await ne.execute({...De.pushed,range:void 0},Qe));let gt=N(Ot&&Ot.rows||[],{...De.residual,whole:!0},X.compute||{});mt&&(gt=gt.slice(mt.start,mt.end));for(let dt=0;dt<gt.length;dt+=Ve)yield gt.slice(dt,dt+Ve)}const je=async Re=>{const{plan:ze,signal:De}=await me(Re);if(!ze.needsAll&&se.total){l({signal:De});const Ve=await te(await ne.execute({...ze.pushed,range:{start:0,end:0}},{signal:De}));if(Ve&&typeof Ve.total=="number")return Ve.total}let Ge=0;for await(const Ve of be({...Re,range:void 0}))Ge+=Ve.length;return Ge},Ne=async Re=>{await Pe();const ze=b(Re.filters||null,{tz:X.timeZone,weekStartsOn:X.weekStartsOn}),De=Re.quick?String(Re.quick):"";return d(ze,se).residual||De&&!se.quick?null:ne.facets({...Re,filters:ze,quick:De})};return st={...X,edit:ft,rowMutate:ae,mode:"remote",fetch:Tt,foregroundIdle:Nt,facetProvider:I(ne.facets)?Ne:void 0,aggregate:ct,countMatching:je,streamMatching:be,capabilitiesOf:y,planQuery:S,wireFilters:b,resolveAggregatePlan:(Re,ze)=>g(Re,ze&&ze.engine?{default:"engine"}:fe),STAT_PUSHDOWN:t,lastPlan:()=>ce?{...ce,...de?{aggregates:M(de)}:{},...Ce?{total:{deferred:!0,state:Ce.state,value:Ce.value}}:{}}:null,fullFrame:He,counts:()=>({match:ve,total:ve,pending:!!Ce&&Ce.state==="pending"}),grandTotals:()=>ke},st}}),_e("packages/core/src/source/remote.js",function(e,F){"use strict";Object.defineProperty(e,"PROTOCOL",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return M}});const E=F("packages/core/src/internal/lru.js").Lru,I=F("packages/core/src/internal/predicates.js").isFunction,Q=F("packages/core/src/internal/warn.js").warnOnce,x=F("packages/core/src/internal/schedule.js").settleDebounce,q=F("packages/core/src/source/abort.js"),R=q.createAbortScope,j=q.isAbortError,k=F("packages/core/src/source/blockcache.js"),b=k.BlockCache,u=k.DEFAULT_PAGE_SIZE,g=k.DEFAULT_MAX_CACHED_PAGES,o=F("packages/core/src/source/rows.js"),t=o.createRowFactory,i=o.groupKey,s=F("packages/core/src/source/filterwire.js"),r=s.wireFilters,n=s.querySignature,m=s.warnHostFilterNotApplied,a=F("packages/core/src/source/pagewindow.js").pageWindow,f=F("packages/core/src/source/memory.js").MemorySource,y=F("packages/core/src/compute/handle.js").valueComparator,h=F("packages/core/src/compute/pivot.js"),d=h.pivotKey,w=h.joinPath,v=h.DEFAULT_PATH_SEPARATOR,W=F("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,V=1,G=120,_=1e3;function T(A,N,$){for(let H=0;H<Math.max(A.length,N.length);H++){const Y=A[H],Z=N[H],J=Y==null,D=Z==null;if(J||D){if(J&&D)continue;return J?1:-1}const te=$(Y,Z);if(te!==0)return te}return 0}function S(A,N){return new M(A,N)}class O{constructor(N,$,H,Y){this.path=N,this.keyPath=Y||N,this.values=[],this.level=$,this.key=i(this.keyPath),this.cache=new b(H),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 M{mode="remote";#e;#t;#n;#r;#i=new Map;#s=new Set;#a=R();#l;#o;#c=new Map;#u=[];#f=null;#d="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#O="";#w=null;#A=-1;constructor(N,$){this.#e=N||{mode:"remote"},this.#t=$||{},I(this.#e.fullFrame)&&(this.filteredIndices=()=>this.#D(),this.unfilteredIndices=()=>this.#K(),this.handleFor=te=>this.#Y(te),this.display=()=>this.#x(),this.grandTotalRow=()=>this.#F(),this.unfilteredRows=()=>this.#B(),this.facetIndices=te=>this.#H(te));const H=this.#e.counts;I(H)&&(this.matchCount=()=>this.#X("match"),this.totalCount=()=>this.#X("total"));const Y=this.#e.grandTotals;I(Y)&&(this.grandTotalRow=()=>this.#V());const Z=this.#e.foregroundIdle;I(Z)&&(this.foregroundIdle=()=>this.#oe(Z),this.#e.pageForegroundIdle=()=>this.#b?this.#oe(Z):null);const J=this.#e.facetProvider;I(J)&&(this.facetProvider=J);const D=this.#e;I(D.countMatching)&&I(D.streamMatching)&&(this.selectionQuery=()=>this.#W(),this.countMatching=te=>D.countMatching(te),this.streamMatching=(te,z)=>D.streamMatching(te,z),this.loadedRows=()=>this.#ge(),this.resident=()=>this.#N()!==null),this.#n={pageSize:this.#e.pageSize||u,maxCachedPages:this.#e.maxCachedPages||g},this.#l=t(this.#t),this.#o=new E(this.#n.pageSize*4),this.#h=x((te,z)=>this.#T(te,z),G),this.#r=new O([],0,this.#n),this.#i.set(this.#r.key,this.#r),this.#d=this.#be(),I(this.#e.fetch)||Q("source.remote.fetch",'source.mode "remote" requires a fetch function; the grid will stay empty.'),this.#de()}count(){const N=this.#S();return N?N.length:this.#v()}#v(){const N=this.#N();return N?N.count():(this.#re(),this.#Ae(this.#r))}#P(){if(this.#N())return!0;const N=$=>{if($.count===null&&!$.complete)return!1;for(const H of $.children.values())if(this.#Te(H.key,this.#we(H))&&!N(H))return!1;return!0};return N(this.#r)}pageInfo(){const N=this.#S(),$=this.totalPending();if(!N){const H=this.#v();return{page:0,pageSize:0,total:this.#P()?H:null,pageCount:1,counting:$}}return{page:N.page,pageSize:N.pageSize,total:N.total,pageCount:N.pageCount,counting:$||N.total===null&&this.#a.size>0&&this.#r.cache.loadedExtent()===0}}#S(){const N=this.#v(),$=a(this.#$("pageSize",0),this.#$("page",0),N,this.#P());if(!$)return this.#O="",null;const H=`${this.#y}:${$.offset}:${$.length}`;return H!==this.#O&&!this.#p&&(this.#O=H,$.length>0&&!this.#N()&&this.#T($.offset,$.offset+$.length-1)),$}at(N){const $=this.#S();if($){if(N<0||N>=$.length)return;const H=this.#C($.offset+N);return H&&(H.index=N),H}return this.#C(N)}#C(N){const $=this.#N();if($)return $.at(N);if(this.#re(),N<0||N>=this.#v())return;const H=this.#Z(this.#r,N);if(!H)return;const Y=this.#G(H.node,H.local);return Y&&(Y.index=N),Y||this.#l.skeleton(N,H.node.level,H.node.cache.erroredAt(H.local))}byKey(N){const $=this.#N();if($)return $.byKey(N);const H=this.#c.get(N);if(!H)return;const Y=H.lastIndexOf(":"),Z=this.#i.get(H.slice(0,Y));return Z&&this.#G(Z,Number(H.slice(Y+1)))||void 0}loaded(N){const $=this.#S();if($){if(N<0||N>=$.length)return!1;N+=$.offset}const H=this.#N();if(H)return H.loaded(N);if(N<0||N>=this.#v())return!1;const Y=this.#Z(this.#r,N);return!!Y&&Y.node.cache.rowLoaded(Y.local)}hint(N,$){if(this.#p)return;this.#b=!0;const H=this.#re();let Y=Math.max(0,Math.floor(N)),Z=Math.max(Y,Math.floor($));const J=this.#S();if(J){if(J.length===0)return;Y=J.offset,Z=J.offset+J.length-1}for(const[D,te]of this.#E(Y,Z)){D.cache.protect(te.min,te.max);for(const z of D.cache.evict())this.#Ee(D,z)}this.#h(Y,Z),H&&this.#h.flush()}#E(N,$){const H=this.#v(),Y=new Map;for(let Z=N;Z<=$&&Z<H;Z++){const J=this.#Z(this.#r,Z);if(!J)continue;const D=Y.get(J.node);D?(D.min=Math.min(D.min,J.local),D.max=Math.max(D.max,J.local)):Y.set(J.node,{min:J.local,max:J.local})}return Y.size||Y.set(this.#r,{min:N,max:N}),Y}#T(N,$){if(!this.#p)for(const[H,Y]of this.#E(N,$)){H.cache.protect(Y.min,Y.max);const Z=H.cache.blockOf(Y.min),J=H.cache.blockOf(Y.max);for(let D=Z;D<=J&&!(H.count!==null&&D*H.cache.pageSize>=H.count);D++)H.cache.has(D)||this.#ue(H,D)}}apply(N){const $={added:[],updated:[],removed:[]};if(!N)return $;if(N.update)for(const H of N.update){const Y=this.#c.get(this.#l.keyOf(H,-1));if(!Y)continue;this.#o.delete(Y);const Z=Y.lastIndexOf(":"),J=this.#i.get(Y.slice(0,Z));if(!J)continue;const D=Number(Y.slice(Z+1)),te=J.cache.blockOf(D);if(!J.cache.loaded(te))continue;const{start:z}=J.cache.rangeOf(te),X=[];for(let se=z;se<z+J.cache.pageSize;se++){const ue=J.cache.rowAt(se);if(ue===void 0)break;X.push(se===D?H:ue)}J.cache.fill(te,X);const ne=this.#G(J,D);ne&&$.updated.push(ne)}return(N.add&&N.add.length||N.remove&&N.remove.length)&&this.reload({keepExpanded:!0}),$}reload(N){this.#a.abortAll("reload"),this.#h.cancel(),N&&N.keepExpanded===!1&&this.#s.clear(),this.#pe(),this.#_("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#a.abortAll("destroyed"),this.#pe(),this.#i.clear(),this.#s.clear(),this.#w&&I(this.#w.destroy)&&this.#w.destroy(),this.#w=null}expand(N){this.#s.has(N)||(this.#s.add(N),this.#_("group:toggled",{key:N,expanded:!0}),this.#_("model:changed",{reason:"expand",key:N}))}collapse(N){this.#s.delete(N)&&(this.#_("group:toggled",{key:N,expanded:!1}),this.#_("model:changed",{reason:"collapse",key:N}))}expandedKeys(){return[...this.#s]}pivotFields(){return this.#u}pivot(){this.#re();const N=this.#f;if(!N||!N.keys.size||!this.#$("pivotBy",[]).length)return null;if(!N.result){const $=y((this.#t.config||{}).locale),H=[...N.keys.entries()].sort((Z,J)=>T(Z[1],J[1],$)),Y=H.map(([Z])=>Z);N.result={keys:H.map(([,Z])=>Z),paths:Y,fields:this.#Ce(Y),groupPaths:[],columns:Y.length*Math.max(1,this.#ve().length),values:N.cells,cells:N.cells,error:null}}return N.result}invalidateHandles(){this.#w&&(I(this.#w.invalidateHandles)&&this.#w.invalidateHandles(),I(this.#w.invalidate)&&this.#w.invalidate("filter"))}#M(){const N=this.#e.fullFrame;return I(N)?N():null}#N(){const N=this.#M();return N?(this.#w||(this.#w=new f({mode:"memory"},this.#R())),N.version!==this.#A&&(this.#w.setRows(N.rows),this.#A=N.version),this.#w):null}#R(){const N=this.#t,$=N.state||{};return{...N,state:{...$,page:()=>0,pageSize:()=>0}}}#D(){const N=this.#N();return N?N.filteredIndices():new Uint32Array(0)}#K(){const N=this.#N();return N?N.unfilteredIndices():new Uint32Array(0)}#Y(N){const $=this.#N();return $?$.handleFor(N):void 0}#x(){const N=this.#N();return N?N.display():[]}#H(N){const $=this.#N();return $&&I($.facetIndices)?$.facetIndices(N):new Uint32Array(0)}#F(){const N=this.#N();return N&&I(N.grandTotalRow)?N.grandTotalRow():null}#X(N){const $=this.#N();if($){const J=N==="match"?$.matchCount:$.totalCount;if(I(J))return J.call($)}const H=this.#e.counts,Y=I(H)?H():null,Z=Y?Y[N]:null;return typeof Z=="number"?Z:this.#v()}#V(){const N=this.#N();if(N&&I(N.grandTotalRow))return N.grandTotalRow();if((this.#t.config||{}).grandTotalRow!=="bottom")return null;const H=this.#e.grandTotals,Y=I(H)?H():null;return!Y||!Y.totals?null:this.#l.grandTotal(Y.totals,Y.leafCount||0)}#B(){const N=this.#N();if(N&&I(N.unfilteredRows))return N.unfilteredRows();const $=[],H=this.count();for(let Y=0;Y<H;Y++){const Z=this.at(Y);Z&&$.push(Z)}return $}#W(){const N=this.#$("quick",""),$={protocol:V,groupPath:[],groupValues:[],groupBy:[],totals:[],totalFns:{},pivotBy:[],pivotMode:!1,filters:r(this.#$("filters",null),this.#J()),sort:this.#$("sort",[]),context:this.#$("context",null)};N&&($.quick=N);const H=this.#$("where",null);return H&&H.active&&($.where=H),$}#ge(){const N=this.#$("groupBy",[]).length,$=[];for(const H of this.#i.values())if(!(H.level!==N&&!H.flat))for(const Y of H.cache.ids()){if(!H.cache.loaded(Y))continue;const{start:Z,end:J}=H.cache.rangeOf(Y);for(let D=Z;D<J&&H.cache.rowLoaded(D);D++){const te=this.#G(H,D);te&&!te.group&&$.push(te)}}return $}loadedCount(){const N=this.#N();if(N){const Y=N.matchCount();return typeof Y=="number"?Y:N.count()}this.#re();const $=this.#$("groupBy",[]).length;let H=0;for(const Y of this.#i.values())if(!(Y.level!==$&&!Y.flat))for(const Z of Y.cache.ids()){if(!Y.cache.loaded(Z))continue;const J=Y.cache.fillOf(Z);typeof J=="number"&&(H+=J)}return H}residentRows(){const N=this.#N();return N?N.display():this.#$("groupBy",[]).length>0?null:(this.#re(),this.#ge())}#se(N,$,H){const{start:Y,end:Z}=N.cache.rangeOf($),J=this.#$("groupBy",[]),D=this.#$("pivotBy",[]),te=this.#$("quick",""),z=this.#ve(),X={protocol:V,range:{start:Y,end:Z},groupPath:N.path,groupValues:N.values,groupBy:J,totals:z,totalFns:this.#Se(z),pivotBy:D,pivotMode:D.length>0,filters:r(this.#$("filters",null),this.#J()),sort:this.#$("sort",[]),context:this.#$("context",null),signal:H};te&&(X.quick=te);const ne=this.#$("where",null);return ne&&ne.active&&(X.where=ne),X}async#ue(N,$){if(!I(this.#e.fetch))return;if(!this.#m){this.#m=!0;const J=this.#g;this.#g=[],queueMicrotask(()=>{for(const D of J)D()})}const H=this.#a.begin(`${N.key}:${$}`);N.cache.begin($,H);const Y=this.#d,{start:Z}=N.cache.rangeOf($);try{const J=await this.#e.fetch(this.#se(N,$,H.signal));if(!H.current||Y!==this.#d||this.#p)return;H.settle();const D=J&&J.rows||[];if(!!(J&&J[W])&&!N.flat){N.flat=!0,N.children.clear();for(const[ne,se]of[...this.#c])se.startsWith(`${N.key}:`)&&(this.#o.delete(se),this.#c.delete(ne))}N.cache.fill($,D),N.failed=!1;for(let ne=0;ne<D.length;ne++)this.#o.delete(`${N.key}:${Z+ne}`);const z=J&&typeof J.count=="number"?J.count:J&&typeof J.total=="number"?J.total:null,X=J&&I(J.pendingTotal?.then)?J.pendingTotal:null;z!==null?(N.count=z,N.complete=!0):D.length<N.cache.pageSize?(N.count=Z+D.length,N.complete=!0):X&&(N.counting=!0,N.announced=null),J&&Array.isArray(J.pivotFields)&&this.#He(J.pivotFields),J&&J.pivot&&typeof J.pivot=="object"&&this.#ae(J.pivot),this.#_("model:changed",{reason:"page",groupPath:N.path,block:$}),this.#_("rows:changed",{companion:!0,reason:"page",groupPath:N.path,block:$}),this.#fe(N),X&&this.#Me(N,X,Y)}catch(J){if(H.settle(),j(J))return;N.cache.failed($,J),N.failed=!0;const{end:D}=N.cache.rangeOf($);for(let te=Z;te<D;te++)this.#o.delete(`${N.key}:${te}`);this.#_("model:changed",{reason:"page-error",groupPath:N.path,block:$}),this.#_("source:error",{error:J,groupPath:N.path,block:$})}}async#Me(N,$,H){let Y;try{Y=await $}catch(Z){if(H!==this.#d||this.#p)return;N.counting=!1,j(Z)||(N.failed=!0),j(Z)||this.#_("source:error",{error:Z,groupPath:N.path});return}H!==this.#d||this.#p||(N.counting=!1,typeof Y=="number"&&(N.count=Y,N.complete=!0,this.#fe(N),this.#_("model:changed",{reason:"total",count:Y,groupPath:N.path})))}#fe(N){typeof N.count!="number"||!N.complete||N.announced!==N.count&&(N.announced=N.count,this.#_("source:total",{total:N.count,groupPath:N.path}))}#oe(N){if(this.#p)return null;this.#re();const $=this.#m?null:new Promise(D=>{this.#g.push(D),setTimeout(D,_)}),H=N();if(!$&&!H)return null;const Y=(async()=>{$&&await $;for(let D=N();D;D=N())await D})();let Z;const J=new Promise(D=>{Z=setTimeout(D,_)});return Promise.race([Y,J]).then(()=>clearTimeout(Z))}totalPending(){if(this.#r.failed)return!1;if(this.#r.counting===!0)return!0;if(this.#N())return!1;this.#re();const N=this.#r;return N.count===null&&!N.complete&&N.cache.loadedExtent()===0}totalFailed(){return this.#r.failed===!0}#He(N){N.length===this.#u.length&&N.every(($,H)=>$===this.#u[H])||(this.#u=N,this.#_("column:pivoted",{pivotFields:N,remote:!0}))}#xe(){const N=this.#t.config||{};return N.pivot&&N.pivot.separator||v}#Ce(N){const $=this.#xe(),H=this.#ve();if(!H.length)return N.slice();const Y=[];for(const Z of N)for(const J of H)Y.push(`${Z}${$}${J}`);return Y}#ae(N){const $=this.#xe();this.#f||(this.#f={keys:new Map,cells:new Map,result:null});const H=this.#f;let Y=!1;const Z=D=>{const te=Array.isArray(D)?D:[D],z=w(te,$);return H.keys.has(z)||(H.keys.set(z,te),Y=!0),z},J=this.#$("groupBy",[]).length>0;for(const D of Array.isArray(N.axis)?N.axis:[])Z(D);for(const D of Array.isArray(N.cells)?N.cells:[]){if(!D||typeof D!="object")continue;const te=Z(D.pivot);if(J&&!(Array.isArray(D.group)&&D.group.length))continue;const z=w(Array.isArray(D.group)?D.group:[],$);for(const[X,ne]of Object.entries(D.values||{}))H.cells.set(d(z,te,X),ne)}H.result=null,Y&&this.#He((this.pivot()||{fields:[]}).fields)}#Ae(N){let $=this.#le(N);for(const H of N.children.values())this.#Te(H.key,this.#we(H))&&($+=this.#Ae(H));return $}#le(N){if(N.count!==null)return N.count;const $=N.cache.loadedExtent();return N.complete?$:N.row&&N.row.leafCount>0?N.level>=this.#$("groupBy",[]).length?Math.max($,N.row.leafCount):$===0?1:Math.min($+N.cache.pageSize,Math.max($,N.row.leafCount)):$+N.cache.pageSize}#Z(N,$){let H=$,Y=0;const Z=[...N.children.entries()].filter(([,D])=>this.#Te(D.key,this.#we(D))).sort((D,te)=>D[0]-te[0]);for(const[D,te]of Z){const z=D-Y+1;if(H<z)return{node:N,local:Y+H};H-=z,Y=D+1;const X=this.#Ae(te);if(H<X)return this.#Z(te,H);H-=X}const J=this.#le(N);return Y+H<J?{node:N,local:Y+H}:null}#G(N,$){const H=`${N.key}:${$}`,Y=this.#o.get(H);if(Y)return Y.group===!0?this.#U(Y):Y;const Z=N.cache.rowAt($);if(Z===void 0)return null;const J=this.#$("groupBy",[]);let D;if(N.level<J.length&&!N.flat){const te=J[N.level],z=this.#f!==null&&N.level===J.length-1&&this.#$("pivotBy",[]).length>0,X=this.#ye(Z,te),ne=X==null,se=[...N.path,ne?"":String(X)],ue=[...N.keyPath,ne?null:String(X)];if(D=this.#l.group({path:se,keyPath:ue,column:te,value:X,level:N.level,parent:N.row,leafCount:Number(Z.leafCount)||0,expanded:z?!1:this.#Te(i(ue),{key:i(ue),column:te,value:X,level:N.level,path:se}),...z?{hasChildren:!1}:{}}),D.totals=this.#ne(Z),D.data=Z,!z){let ge=this.#i.get(D.key);ge?ge.row=D:(ge=new O(se,N.level+1,this.#n,ue),ge.row=D,this.#i.set(ge.key,ge)),ge.values=[...N.values,X],N.children.set($,ge)}}else D=this.#l.leaf(Z,$,N.level,N.row);return this.#o.set(H,D),this.#c.set(D.key,H),D}#ne(N){const $=N||{};if($.totals&&typeof $.totals=="object")return $.totals;const H={};for(const Y of this.#ve())Object.hasOwn($,Y)&&(H[Y]=$[Y]);return H}#U(N){const $=this.#i.get(N.key);if(!$||$.row!==N||N.hasChildren===!1)return N;const H=this.#Te(N.key,this.#we($));return N.expanded!==H&&(N.expanded=H),N}#Ee(N,$){const{start:H,end:Y}=N.cache.rangeOf($);for(let Z=H;Z<Y;Z++){const J=`${N.key}:${Z}`,D=this.#o.peek(J);D&&this.#c.delete(D.key),this.#o.delete(J)}}#re(){const N=this.#be();return N===this.#d?!1:(this.#d=N,this.#a.abortAll("query"),this.#pe(),this.#m=!1,this.#_("model:changed",{reason:"query"}),!0)}#pe(){for(const N of this.#i.values())N.cache.clear(),N.count=null,N.complete=!1,N.announced=null,N.counting=!1,N.failed=!1,N.children.clear(),N.flat=!1;this.#o.clear(),this.#c.clear(),this.#y++,this.#f=null}#be(){const N=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)})}|${N?N.version:0}`}#Te(N,$){const H=this.#$("expanded",null);return H?I(H.has)?H.has(N,$):Array.prototype.includes.call(H,N):this.#s.has(N)}#we(N){if(N.row)return{key:N.key,column:N.row.column,value:N.row.value,level:N.level-1,path:N.path}}#ve(){const N=this.#$("totals",[]);if(N&&N.length)return[...N];const $=this.#t.columns;return!$||!I($.all)?[]:$.all().filter(H=>!!H.total).map(H=>H.id)}#Se(N){const $=this.#t.columns,H={};if(!$||!I($.get))return H;for(const Y of N){const Z=$.get(Y);if(!Z)continue;const J=Z.groupTotal!=null?Z.groupTotal:Z.total;typeof J=="string"?H[Y]=J:J&&typeof J=="object"&&typeof J.fn=="string"&&(H[Y]={...J})}return H}#ye(N,$){const H=this.#t.columns,Y=H&&I(H.get)?H.get($):void 0;return Y&&I(Y.getValue)?Y.getValue(N):N?.[$]}#de(){m(this.#t)}#J(){const N=this.#t.config||{};return{tz:N.timeZone,weekStartsOn:N.weekStartsOn}}#$(N,$){const H=this.#t.state;if(H&&I(H[N])){const Y=H[N]();return Y??$}return $}#_(N,$){const H=this.#t.emit;I(H)&&H(N,$)}}}),_e("packages/core/src/source/gapbuffer.js",function(e,F){"use strict";Object.defineProperty(e,"GapBuffer",{enumerable:!0,get:function(){return E}});const ie=64;class E{#e;#t=0;#n=0;constructor(I=ie){this.#e=new Uint32Array(Math.max(1,I)),this.#n=this.#e.length}static from(I,L=ie){const Q=new E(I.length+Math.max(1,L));return Q.#e.set(I,0),Q.#t=I.length,Q.#n=Q.#e.length,Q}get length(){return this.#t+(this.#e.length-this.#n)}get capacity(){return this.#e.length}at(I){return I<0||I>=this.length?0:I<this.#t?this.#e[I]:this.#e[I+(this.#n-this.#t)]}insert(I,L){const Q=I<0?0:I>this.length?this.length:I;this.#r(Q),this.#t===this.#n&&this.#i(),this.#e[this.#t++]=L}push(I){this.insert(this.length,I)}removeAt(I){return!Number.isInteger(I)||I<0||I>=this.length?!1:(this.#r(I),this.#n++,!0)}toArray(){const I=new Uint32Array(this.length);return I.set(this.#e.subarray(0,this.#t),0),I.set(this.#e.subarray(this.#n),this.#t),I}clear(){this.#t=0,this.#n=this.#e.length}#r(I){if(I!==this.#t)if(I<this.#t){const L=this.#t-I;this.#e.copyWithin(this.#n-L,I,this.#t),this.#t=I,this.#n-=L}else{const L=I-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+L),this.#t=I,this.#n+=L}}#i(){const I=this.#e.length-this.#n,L=new Uint32Array(Math.max(this.#e.length*2,this.#e.length+ie));L.set(this.#e.subarray(0,this.#t),0),L.set(this.#e.subarray(this.#n),L.length-I),this.#e=L,this.#n=L.length-I}}}),_e("packages/core/src/store/ingest.js",function(e,F){"use strict";Object.defineProperty(e,"INGEST_DEFAULTS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"inferKind",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"decideText",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"createReaders",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"Ingest",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return r}});const ie=F("packages/core/src/internal/schedule.js"),E=ie.now,K=ie.nextFrame,I=F("packages/core/src/internal/warn.js"),L=I.infoOnce,Q=I.warnOnce,x=F("packages/core/src/internal/predicates.js").isFunction,R=F("packages/core/src/internal/paths.js").pathGetter,k=F("packages/core/src/store/columnstore.js").ColumnStore,b=Object.freeze({chunkMs:8,chunkRows:512,sampleSize:100,dictionaryRatio:.1,columnarBelow:5e3,initialCapacity:1024});function u(n,m={}){if(m.multi)return"multi";if(n.length===0)return"object";let l=0,a=0,c=0,f=0,p=0;for(let h=0;h<n.length;h++){const d=n[h];typeof d=="number"?l++:typeof d=="boolean"?a++:typeof d=="string"?c++:d instanceof Date?f++:Array.isArray(d)&&p++}const y=n.length;return l===y?"float64":a===y?"bitset":f===y?"float64":c===y?"text":p===y?"multi":"object"}function g(n,m,l){return m<=0||n<l*m?"dictionary":"object"}function o(n,m,l){const a=new Map,c=new Map;for(const V of n){if(V.computed)continue;const G=x(V.read)?V.read:R(V.field||V.id);c.set(V.id,G),a.set(V.id,G)}const f=m?.order??[],p=m?.fns??{},y=m?.deps??{},h=m?.wrapDeps??null,d=f.filter(V=>x(p[V])),w=d.some(V=>y[V]==="*");let v=new WeakMap;const P=V=>{const G={};if(w)for(const[_,T]of c)G[_]=T(V);for(const _ of d){const T=y[_];let S;if(T==="*")S=G;else{S={};const O=T||[];for(let M=0;M<O.length;M++){const A=O[M];S[A]=A in G?G[A]:c.get(A)?.(V)}}G[_]=p[_](h?h(S,_):S,{data:V,row:null,column:null,grid:null,context:l})}return G},W=V=>{if(V===null||typeof V!="object"&&typeof V!="function")return P(V);let G=v.get(V);return G===void 0&&(G=P(V),v.set(V,G)),G};for(const V of d)a.set(V,G=>W(G)[V]);return{readers:a,reset(){v=new WeakMap}}}class t{spec;read;kind;inferred;nullable;candidate=!1;distinct=null;change=null;reason="";constructor(m,l){this.spec=m,this.read=l,this.kind="object",this.inferred=!1,this.nullable=m.nullable!==!1}}class i{#e;#t=[];#n=null;#r;#i=0;#s;#a=!1;#l=!1;#o=0;#c;constructor(m,l={},a={}){this.#e=Array.isArray(m)?m:Array.from(m||[]),this.#s={...b,...a};const c=l.columns??[];this.#r=o(c,l.computed??null,l.context),this.#c=this.#e.length>=this.#s.columnarBelow,this.#u(c,l.computed??null),this.#n=new k(this.#t.map(f=>({id:f.spec.id,kind:f.kind,nullable:f.nullable,read:f.read,dictionary:f.spec.dictionary})),{initialCapacity:this.#s.initialCapacity,columnarBelow:this.#s.columnarBelow})}get store(){return this.#n}get done(){return this.#a||this.#l}get progress(){return this.#i}slice(){if(this.done)return!1;if(this.#s.signal?.aborted)return this.#l=!0,!1;const m=E(),{chunkMs:l,chunkRows:a}=this.#s,c=this.#e.length;do{const f=Math.min(this.#i+a,c);this.#n.append(this.#e.slice(this.#i,f)),this.#f(this.#i,f),this.#i=f,this.#r.reset(),this.#h(!1)}while(this.#i<c&&E()-m<l);return this.#o+=E()-m,this.#s.onProgress?.({loaded:this.#i,total:c}),this.#i>=c?(this.#h(!0),this.#a=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(m=>({id:m.spec.id,kind:m.kind,nullable:m.nullable,read:m.read,dictionary:m.spec.dictionary})),decisions:this.#t.map(m=>({id:m.spec.id,kind:m.kind,nullable:m.nullable,inferred:m.inferred,distinct:m.candidate||m.change?this.#d(m):null,change:m.change,reason:m.reason})),count:this.#n.count,elapsed:this.#o,cancelled:this.#l}}#u(m,l){const a=this.#e,c=Math.min(this.#s.sampleSize,a.length),f=this.#s.dictionaryRatio,p=l?.pure instanceof Set?l.pure:new Set(l?.pure??l?.order??[]);for(const y of m){if(!y||!y.id)continue;if(y.computed&&(y.pure===!1||l&&!p.has(y.id))){Q(`ingest.impure.${y.id}`,`column "${y.id}" is an impure computed column and is not materialised into the store`);continue}const h=this.#r.readers.get(y.id)??(x(y.read)?y.read:R(y.field||y.id)),d=new t(y,h);if(y.kind)d.kind=y.kind,d.reason="declared by the caller";else if(y.dictionary)d.kind=y.multi?"multi":"dictionary",d.reason="value table supplied (lookup column)";else{const w=[];for(let P=0;P<c&&w.length<this.#s.sampleSize;P++){const W=h(a[P]);W!=null&&w.push(W)}d.inferred=!0;const v=u(w,{multi:y.multi});if(v==="text"){const P=new Set(w).size;d.kind=g(P,w.length,f),d.candidate=this.#c,d.reason=`sampled ${P} distinct in ${w.length}`}else d.kind=v,d.reason=`inferred from ${w.length} sampled values`,v==="object"&&w.length&&L(`ingest.mixed.${y.id}`,`column "${y.id}" holds mixed or unrecognised value types; storing as an object array. Declare a type to avoid this.`);d.kind==="object"&&d.candidate&&(d.distinct=new Set(w))}this.#t.push(d)}}#f(m,l){const a=this.#e;for(const c of this.#t){if(!c.candidate||!c.distinct)continue;const f=c.distinct;for(let p=m;p<l;p++){const y=c.read(a[p]);y!=null&&f.add(y)}}}#d(m){if(m.distinct)return m.distinct.size;const l=this.#n.column(m.spec.id);return l?.dict?l.dict.size:0}#h(m){const l=this.#s.dictionaryRatio,a=this.#e.length;for(const c of this.#t){if(!c.candidate)continue;const f=this.#d(c);if(c.kind==="dictionary"&&f>=l*a){const p=this.#n.column(c.spec.id);c.distinct=new Set(p?.dict?p.dict.values():[]),this.#n.convert(c.spec.id,"object"),c.kind="object",c.change="demoted",c.reason=`${f} distinct values is at or above ${l*100}% of ${a} rows`;continue}if(c.kind==="object"&&f>=l*a){c.candidate=!1,c.distinct=null,c.reason=`${f} distinct values is at or above ${l*100}% of ${a} rows`;continue}m&&c.kind==="object"&&f<l*a&&(this.#n.convert(c.spec.id,"dictionary"),c.kind="dictionary",c.change=c.change==="demoted"?null:"promoted",c.reason=`${f} distinct values is below ${l*100}% of ${a} rows`,c.distinct=null),m&&(c.candidate=!1)}}}async function s(n,m={},l={}){const a=new i(n,m,l),c=l.scheduler?.frame??K;for(;a.slice();)await new Promise(f=>{c(f)});return a.result()}function r(n,m={},l={}){const a=new i(n,m,{...l,chunkMs:1/0});for(;a.slice(););return a.result()}}),_e("packages/core/src/store/columnpack.js",function(e,F){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return g}});const E=F("packages/core/src/internal/paths.js").pathGetter,K=F("packages/core/src/store/ingest.js"),I=K.inferKind,L=K.decideText,Q=K.INGEST_DEFAULTS,x=F("packages/core/src/store/columnstore.js").toFloat,q=new Set(["float64","int32","bitset","dictionary","object","multi"]);function R(o){if(!Array.isArray(o)||o.length===0)return!1;for(const t of o)if(!t||typeof t.id!="string"||typeof t.field!="string"||t.field===""||t.kind&&!q.has(t.kind))return!1;return!0}function j(o){const t=x(o);return Number.isFinite(t)?t|0:0}function k(o){return o==null?[]:Array.isArray(o)?o:[o]}function b(o,t,i,s){if(o.kind)return o.kind;const r=[];for(let l=0;l<t.length&&r.length<Q.sampleSize;l++){const a=t[l];a!=null&&r.push(a)}const n=I(r,{multi:o.multi});if(n!=="text")return n;const m=new Set(r).size;return L(m,r.length,s)}function u(o,t,i={}){const s=t.length|0,r=i.dictionaryRatio??Q.dictionaryRatio,n=[];for(const m of o){const l=E(m.field||m.id),a=m.nullable!==!1,c=new Array(s);for(let d=0;d<s;d++){const w=l(t[d]);c[d]=w===void 0?null:w}const f=b(m,c,s,r),p=a?new Uint8Array(s+7>>3):null,y=d=>{p&&(p[d>>3]|=1<<(d&7))};let h;switch(f){case"float64":{const d=new Float64Array(s);for(let w=0;w<s;w++){const v=c[w],P=v===null;P||y(w),d[w]=P?NaN:x(v)}h={id:m.id,kind:f,nullable:a,values:d,presence:p,offsets:null,table:null};break}case"int32":{const d=new Int32Array(s);for(let w=0;w<s;w++){const v=c[w],P=v===null;P||y(w),d[w]=P?0:j(v)}h={id:m.id,kind:f,nullable:a,values:d,presence:p,offsets:null,table:null};break}case"bitset":{const d=new Uint8Array(s+7>>3);for(let w=0;w<s;w++){const v=c[w],P=v===null;P||y(w),!P&&v&&(d[w>>3]|=1<<(w&7))}h={id:m.id,kind:f,nullable:a,values:d,presence:p,offsets:null,table:null};break}case"dictionary":{const d=new Uint32Array(s),w=[],v=new Map;for(let P=0;P<s;P++){const W=c[P];if(W===null){d[P]=0;continue}y(P);let V=v.get(W);V===void 0&&(V=w.length,w.push(W),v.set(W,V)),d[P]=V}h={id:m.id,kind:f,nullable:a,values:d,presence:p,offsets:null,table:w};break}case"multi":{const d=[],w=new Map,v=new Uint32Array(s+1),P=[];for(let W=0;W<s;W++){const V=c[W];v[W]=P.length,V===null||y(W);const _=k(V);for(let T=0;T<_.length;T++){const S=_[T];let O=w.get(S);O===void 0&&(O=d.length,d.push(S),w.set(S,O)),P.push(O)}}v[s]=P.length,h={id:m.id,kind:f,nullable:a,values:Int32Array.from(P),presence:p,offsets:v,table:d};break}default:{const d=new Array(s);for(let w=0;w<s;w++){const v=c[w];v!==null&&y(w),d[w]=v}h={id:m.id,kind:"object",nullable:a,values:d,presence:p,offsets:null,table:null};break}}n.push(h)}return{count:s,columns:n}}function g(o){const t=[];if(!o||!Array.isArray(o.columns))return t;const i=s=>{ArrayBuffer.isView(s)&&s.buffer&&!t.includes(s.buffer)&&t.push(s.buffer)};for(const s of o.columns)i(s.values),i(s.presence),i(s.offsets);return t}}),_e("packages/core/src/source/stream.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_PROMOTE_BELOW",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"createStreamSource",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return O}});const E=F("packages/core/src/internal/lru.js").Lru,I=F("packages/core/src/internal/predicates.js").isFunction,L=F("packages/core/src/internal/schedule.js"),Q=L.now,U=L.nextFrame,x=L.cancelFrame,q=L.whenIdle,j=F("packages/core/src/internal/compare.js").defaultCompare,k=F("packages/core/src/internal/warn.js"),b=k.warnOnce,u=k.infoOnce,o=F("packages/core/src/internal/paths.js").getPath,t=F("packages/core/src/source/abort.js"),i=t.createAbortScope,s=t.isAbortError,r=F("packages/core/src/source/rows.js"),n=r.createRowFactory,m=r.lazyRowView,a=F("packages/core/src/source/gapbuffer.js").GapBuffer,f=F("packages/core/src/source/memory.js").createMemorySource,y=F("packages/core/src/source/filterwire.js").querySignature,d=F("packages/core/src/store/columnpack.js").isPortableSchema,w=25e4,v=Symbol("lattice.stream.storeBacked"),P=8,W=.1,V=1e3,G=50;function _(M){return Math.min(V,Math.max(G,Math.floor(M/4)))}function T(M){if(M instanceof Date)return M.getTime();if(typeof M=="number")return Number.isFinite(M)?M:NaN;if(typeof M=="string"){const A=M.trim();if(!A)return NaN;const N=Date.parse(A);return Number.isNaN(N)?Number(A):N}return NaN}function S(M,A){return new O(M,A)}class O{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#i=[];#s=null;#a;#l;#o=new Map;#c=i();#u={loaded:0,estimated:void 0};#f=null;#d=0;#h=0;#p=0;#m=0;#g=null;#b=null;#y=null;#O=!1;#w=!1;#A=!1;#v=!1;#P="";#S=0;#C=0;#E=0;#T=null;#M=1/0;#N=!1;#R=null;#D=null;#K=null;#Y=null;#x=!1;#H=0;#F=0;#X=!1;constructor(A,N){this.#e=A||{mode:"stream"},this.#t=N||{},this.#a=n(this.#t),this.#l=new E(4096),this.#P=this.#qe();const $=(this.#t.config||{}).ingest;this.#x=!!$&&$.retainSource===!1,I(this.#e.open)||b("source.stream.open",'source.mode "stream" requires an open function; the grid will stay empty.'),this.#e.autoStart!==!1&&queueMicrotask(()=>this.start());const H=Number(this.#e.poll);Number.isFinite(H)&&H>0&&(this.#Y=setInterval(()=>{this.#v||this.reload()},H),this.#Y&&I(this.#Y.unref)&&this.#Y.unref()),this.#B()}#V(){const A=Number(this.#e.maxAge);return Number.isFinite(A)&&A>0?A:0}#B(){const A=this.#V();if(!A)return;const N=this.#e.ageBy;I(N)?this.#D=N:typeof N=="string"&&N?this.#D=$=>o($,N):this.#D=null,this.#T=[],this.#R=setInterval(()=>{this.#v||this.#W()&&(this.#Ee(),this.#_())},_(A)),this.#R&&I(this.#R.unref)&&this.#R.unref()}#W(){const A=this.#V();return!A||!this.#T?!1:this.#N?!0:this.#M<Date.now()-A*(1+W)}#ge(A,N){if(!this.#T)return;const $=this.#D?T(this.#D(N)):Date.now();this.#T[A]=$,Number.isNaN($)||($<this.#M&&(this.#M=$),$<Date.now()-this.#V()&&(this.#N=!0))}#se(){return this.#Oe("groupBy",[]).length>0?!0:!!this.#Oe("pivotMode",!1)&&this.#Oe("pivotBy",[]).length>0}#ue(){if(this.#g||this.#v)return;const A=this.#se();if(A&&!this.#b){this.#b=f({mode:"memory",rows:this.#n},this.#Me()),this.#O=!1;return}!A&&this.#b&&(this.#b.destroy(),this.#b=null)}#Me(){if(this.#y)return this.#y;const A=this,N={liveIndices:()=>A.#fe(),live:$=>A.#n[$]!==void 0,source:$=>A.#ee($),get physical(){return A.#n.length}};return this.#x&&(N.column=$=>{const H=A.#t.store;return H&&I(H.column)?H.column($):void 0}),this.#y=Object.create(this.#t,{store:{value:N,enumerable:!0,configurable:!0}}),this.#y}#fe(){const A=new Uint32Array(this.#n.length);let N=0;for(let $=0;$<this.#n.length;$++)this.#n[$]!==void 0&&(A[N++]=$);return A.subarray(0,N)}#oe(){return this.#g?this.#g:this.#b?(this.#O&&(this.#O=!1,this.#b.setRows(this.#n)),this.#b):null}invalidate(A="filter"){if(this.#g){this.#g.invalidate(A);return}this.#ue(),this.#b&&this.#b.invalidate(A),(A==="filter"||A==="sort")&&this.#Te()}count(){const A=this.#oe();return A?A.count():this.#r?this.#r.length:this.#S}matchCount(){const A=this.#oe();return A&&I(A.matchCount)?A.matchCount():this.#r?this.#r.length:this.#S}totalCount(){const A=this.#oe();return A&&I(A.totalCount)?A.totalCount():this.#S}unfilteredRows(){const A=this.#oe();if(A&&I(A.unfilteredRows))return A.unfilteredRows();const N=[];for(let $=0;$<this.#n.length;$++){if(!this.#n[$])continue;const H=this.#je($);H&&N.push(H)}return N}at(A){const N=this.#oe();if(N)return N.at(A);if(A<0||A>=this.count())return;const $=this.#r?this.#r.at(A):A,H=this.#je($);return H.index=A,H}byKey(A){const N=this.#oe();if(N)return N.byKey(A);const $=this.#o.get(A);return $===void 0?void 0:this.#je($)}leavesOf(A){const N=this.#oe();return N&&I(N.leavesOf)?N.leavesOf(A):[]}loaded(A){return A>=0&&A<this.count()}hint(A,N){if(this.#g){this.#g.hint(A,N);return}this.#He(),this.#p=Math.max(0,Math.floor(A))}#He(){this.#v||this.#qe()===this.#P||this.reload()}display(){const A=this.#oe();return A?A.display():m(()=>this.count(),N=>this.at(N))}apply(A){if(this.#g)return this.#g.apply(A);const N={added:[],updated:[],removed:[]};if(!A)return N;if(A.update){let $=!1;for(const H of A.update){const Y=this.#o.get(this.#a.keyOf(H,-1));if(Y===void 0)continue;const Z=this.#Se(Y);this.#x?this.#Le(Y,H):this.#n[Y]=H,this.#l.delete(Y),this.#ye(Y,Z),this.#T&&(this.#ge(Y,H),$=!0),this.#O=!0,N.updated.push(this.#je(Y))}$&&this.#Ee()}if(A.add&&A.add.length){const $=this.#ne(A.add);for(const H of $)N.added.push(this.#je(H))}return A.remove&&A.remove.length&&b("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#_(),N}reload(A){this.#c.abortAll("reload"),this.#Ye(),this.#b&&(this.#b.destroy(),this.#b=null),this.#O=!1,this.#n=[],this.#r=null,this.#o.clear(),this.#l.clear(),this.#g=null,this.#S=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.#qe(),this.#Pe("model:changed",{reason:"reload"}),this.start()}destroy(){this.#v=!0,this.#Y!==null&&(clearInterval(this.#Y),this.#Y=null),this.#R!==null&&(clearInterval(this.#R),this.#R=null),this.#T=null,this.#c.abortAll("destroyed"),this.#Ye(),this.#f!==null&&(this.#ke(this.#f),this.#f=null),this.#b&&(this.#b.destroy(),this.#b=null),this.#g&&this.#g.destroy(),this.#n=[],this.#r=null,this.#o.clear(),this.#l.clear()}async start(){if(this.#A||this.#v||!I(this.#e.open))return;this.#A=!0;const A=this.#c.begin("stream");this.#Te(),this.#ue();let N;try{N=this.#e.open({sort:this.#Oe("sort",[]),filters:this.#Oe("filters",null),quick:this.#Oe("quick","")||void 0,context:this.#Oe("context",null),signal:A.signal})}catch(H){this.#Pe("source:error",{error:H});return}const $=I(N[Symbol.asyncIterator])?N[Symbol.asyncIterator]():N[Symbol.iterator]();this.#K=$;try{for(;;){const H=await $.next();if(!A.current||this.#v)return;if(H.done){this.#$();return}if(await this.#xe(H.value,A),!A.current||this.#v)return;if(H.value&&H.value.done){this.#$();return}if(await this.#he(),!A.current||this.#v)return}}catch(H){if(s(H))return;this.#Pe("source:error",{error:H})}finally{A.settle()}}progress(){return{loaded:this.#u.loaded,estimated:this.#u.estimated,done:this.#w,live:this.#S,evicted:this.#C}}promoted(){return this.#g!==null}memorySource(){return this.#g}invalidateHandles(){const A=this.#oe();A&&(I(A.invalidateHandles)&&A.invalidateHandles(),I(A.invalidate)&&A.invalidate("sort"))}renderCount(){return this.#d}ingestStats(){return{worker:this.#H,inline:this.#F,storeBacked:this.#x}}#xe(A,N){if(!A)return;const $=A.rows;if($&&$.length&&this.#ae($))return this.#le(A,N);const H=Q();$&&$.length&&(this.#ne($),this.#F++),this.#Ce(A),this.#h+=Q()-H,this.#_()}#Ce(A){this.#u.loaded=A.progress&&typeof A.progress.loaded=="number"?A.progress.loaded:this.#n.length,A.progress&&typeof A.progress.estimated=="number"&&(this.#u.estimated=A.progress.estimated)}#ae(A){if(this.#X||this.#g)return!1;const N=this.#Z();if(!N)return!1;const $=this.#t.store;if(!$||!I($.appendPacked))return!1;const H=this.#G();return!H||!d(H)?(this.#X=!0,u("source.stream.ingest-worker","stream ingest.useWorker is on but a column reads through a closure (a computed or date column); columnizing on the main thread instead."),!1):A.length<N.threshold?!1:!this.#Ae(A)}#Ae(A){if(!this.#a.keyed)return!1;const N=new Set;for(let $=0;$<A.length;$++){const H=this.#a.keyOf(A[$],this.#n.length+$);if(H!=null){if(N.has(H)||this.#o.has(H))return!0;N.add(H)}}return!1}async#le(A,N){const $=A.rows,H=this.#Z(),Y=this.#G();let Z;try{Z=await H.columnize(Y,$,{key:"ingest:stream",signal:N&&N.signal})}catch(X){if(s(X)||(b("source.stream.columnize","worker columnization failed; columnizing on the main thread",X),this.#X=!0,N&&(!N.current||this.#v)))return;this.#ne($),this.#F++,this.#Ce(A),this.#_();return}if(N&&(!N.current||this.#v))return;const J=this.#t.store,D=this.#x?void 0:$,{from:te}=J.appendPacked(Z,D),z=Z.count|0;for(let X=0;X<z;X++){const ne=te+X,se=$[X],ue=this.#a.keyed?this.#a.keyOf(se,ne):null;if(this.#n[ne]=this.#x?v:se,this.#S++,this.#ge(ne,se),ue!==null&&this.#o.set(ue,ne),!this.#r||!this.#we(ne))continue;const ge=this.#de(ne);this.#r.insert(ge,ne),ge<=this.#p&&this.#m++}this.#O=!0,this.#Ee(),this.#H++,this.#Ce(A),this.#_()}#Z(){const A=this.#t.ingestWorker;return I(A)?A():null}#G(){const A=this.#t.storeSchema;return I(A)?A():null}#ne(A){const N=[],$=this.#t.store,H=new Array(A.length),Y=[],Z=new Set;for(let D=0;D<A.length;D++){const te=this.#a.keyed?this.#a.keyOf(A[D],this.#n.length+Y.length):null;H[D]=te,!(te!==null&&(this.#o.has(te)||Z.has(te)))&&(te!==null&&Z.add(te),Y.push(A[D]))}let J=Y.length&&$&&I($.append)?$.append(Y).from:this.#n.length;for(let D=0;D<A.length;D++){const te=A[D],z=H[D];if(z!==null&&this.#o.has(z)){const se=this.#o.get(z),ue=this.#Se(se);this.#x||(this.#n[se]=te,$&&I($.setSource)&&$.setSource(se,te)),this.#Le(se,te),this.#l.delete(se),this.#ge(se,te),this.#ye(se,ue);continue}const X=J++;if(this.#n[X]=this.#x?v:te,this.#S++,this.#ge(X,te),z!==null&&this.#o.set(z,X),N.push(X),!this.#r||!this.#we(X))continue;const ne=this.#de(X);this.#r.insert(ne,X),ne<=this.#p&&this.#m++}return this.#O=!0,this.#Ee(),N}#U(A){const N=this.#n[A];let $=!1;if(this.#r){const J=this.#be(A);J>=0&&J<=this.#p&&($=!0)}else A<=this.#p&&($=!0);const H=N===v?this.#ee(A):N,Y=this.#a.keyed?this.#a.keyOf(H,A):null;Y!==null&&this.#o.get(Y)===A&&this.#o.delete(Y),this.#n[A]=void 0,this.#T&&(this.#T[A]=NaN),this.#l.delete(A);const Z=this.#t.store;return Z&&I(Z.remove)&&Z.remove(A),this.#S--,$}#Ee(){let A=0,N=0;const $=this.#pe();A+=$.dropped,N+=$.aboveAnchor;const H=this.#re();A+=H.dropped,N+=H.aboveAnchor,A&&(this.#O=!0,this.#C+=A,this.#Te(),this.#m-=N,this.#Pe("stream:evicted",{evicted:A,total:this.#C,live:this.#S}))}#re(){const A=this.#e.maxRows;if(!Number.isFinite(A)||A<=0||this.#S<=A)return{dropped:0,aboveAnchor:0};const N=Math.max(1,Math.floor(A*(1-W)));let $=0,H=0;for(;this.#S>N&&this.#E<this.#n.length;){const Y=this.#E++;this.#n[Y]!==void 0&&(this.#U(Y)&&H++,$++)}return{dropped:$,aboveAnchor:H}}#pe(){const A=this.#V();if(!A||!this.#T||!this.#W())return{dropped:0,aboveAnchor:0};const N=Date.now()-A;let $=0,H=0,Y=1/0;for(let Z=this.#E;Z<this.#n.length;Z++){if(this.#n[Z]===void 0)continue;const J=this.#T[Z];if(!(Number.isNaN(J)||J===void 0)){if(J>=N){J<Y&&(Y=J);continue}this.#U(Z)&&H++,$++}}for(this.#M=Y,this.#N=!1;this.#E<this.#n.length&&this.#n[this.#E]===void 0;)this.#E++;return{dropped:$,aboveAnchor:H}}#be(A){if(!this.#r)return A;for(let N=0;N<this.#r.length;N++)if(this.#r.at(N)===A)return N;return-1}#Te(){this.#i=this.#Oe("sort",[]),this.#s=this.#Oe("filters",null);const A=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#V()>0,N=this.#Oe("where",null),$=(this.#t.config||{}).hostFilter,H=!!(N&&N.active)||!!($&&I($.active)&&$.active());if(!(A||this.#i.length>0||!!this.#s||!!this.#Oe("quick","")||H)){this.#r=null;return}this.#r=new a(Math.max(64,this.#n.length+64));for(let Z=0;Z<this.#n.length;Z++)this.#n[Z]!==void 0&&this.#we(Z)&&this.#r.insert(this.#de(Z),Z)}#we(A){const N=this.#ee(A);if(this.#s&&!this.#ve(this.#s,N))return!1;const $=String(this.#Oe("quick","")||"").toLowerCase();if($&&!this.#k(N).includes($))return!1;const H=(this.#t.config||{}).hostFilter;if(H&&I(H.active)&&H.active()&&!H.passes(this.#je(A)))return!1;const Y=this.#Oe("where",null);if(Y&&Y.active){const Z=this.#je(A);if(!Y.passes(Z.data,Z.key))return!1}return!0}#ve(A,N){if(!A)return!0;const $=A;if(Array.isArray($.conditions))return $.op==="or"?$.conditions.some(Z=>this.#ve(Z,N)):$.op==="not"?!$.conditions.some(Z=>this.#ve(Z,N)):$.conditions.every(Z=>this.#ve(Z,N));const H=A,Y=(this.#t.compute||{}).testValue;return I(Y)?!!Y(this.#Ve(N,H.col),H,(this.#t.config||{}).locale):(b("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#Se(A){if(!this.#r)return-1;if(!this.#i.length)return this.#be(A);let N=0,$=this.#r.length;for(;N<$;){const H=N+$>>>1;this.#J(this.#r.at(H),A)<0?N=H+1:$=H}for(let H=N;H<this.#r.length;H++){const Y=this.#r.at(H);if(Y===A)return H;if(this.#J(Y,A)>0)break}return this.#be(A)}#ye(A,N){if(!this.#r||!this.#i.length)return;const $=this.#we(A);if(N>=0&&this.#r.at(N)===A)this.#r.removeAt(N),N<=this.#p&&this.#m--;else if(N>=0)return;if(!$)return;const H=this.#de(A);this.#r.insert(H,A),H<=this.#p&&this.#m++}#de(A){if(!this.#r||!this.#i.length)return this.#r?this.#r.length:0;let N=0,$=this.#r.length;for(;N<$;){const H=N+$>>>1;this.#J(A,this.#r.at(H))<0?$=H:N=H+1}return N}#J(A,N){const $=this.#ee(A),H=this.#ee(N);for(const Y of this.#i){const Z=this.#Ie(Y.col),J=this.#Ve($,Y.col),D=this.#Ve(H,Y.col),z=(Z&&Z.value&&I(Z.value.compare)?Z.value.compare:j)(J,D);if(z!==0)return Y.dir==="desc"?-z:z}return 0}#$(){this.#w=!0,this.#u.loaded=this.#u.loaded||this.#n.length;const A=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:w;!this.#x&&this.#n.length<A&&(this.#g=f({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.#_(),this.#Pe("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:A})}#_(){this.#f!==null||this.#v||(this.#f=this.#I(()=>{this.#f=null,this.#d++;const A=this.#m;this.#m=0,this.#h=0,this.#Pe("stream:chunk",{loaded:this.#u.loaded,estimated:this.#u.estimated,count:this.count(),renders:this.#d}),this.#Pe("model:changed",{reason:"stream",shiftAboveViewport:A,anchor:this.#p}),this.#Pe("rows:changed",{companion:!0,reason:"stream"})}))}#he(){return this.#d===0||this.#h<this.#ie()?Promise.resolve():(this.#h=0,new Promise(A=>{const N=(this.#t.scheduler||{}).idle;I(N)?N(()=>A()):q(()=>A())}))}#ie(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:P}#I(A){const N=this.#t.scheduler||{};return I(N.frame)?N.frame(A):U(A)}#ke(A){const N=this.#t.scheduler||{};I(N.cancel)?N.cancel(A):x(A)}#ee(A){const N=this.#n[A];if(N!==void 0&&N!==v)return N;if(N===void 0)return;const $=this.#t.store;return $&&I($.source)?$.source(A):void 0}#Le(A,N){const $=this.#t.store;if(!$||!I($.set))return;const H=this.#G();if(Array.isArray(H))for(const Y of H){if(!Y||!Y.id)continue;const Z=I(Y.read)?Y.read:J=>o(J,Y.field||Y.id);$.set(Y.id,A,Z(N))}}#je(A){let N=this.#l.get(A);return N||(N=this.#a.leaf(this.#ee(A),A),this.#l.set(A,N)),N}#Ve(A,N){const $=this.#Ie(N);return $&&I($.getValue)?$.getValue(A):A?.[N]}#k(A){const N=this.#t.columns,$=N&&I(N.all)?N.all():[],H=[];for(const Y of $){const Z=I(Y.getValue)?Y.getValue(A):void 0;Z!=null&&Z!==""&&H.push(String(Z))}return H.join(" ").toLowerCase()}#Ie(A){const N=this.#t.columns;return N&&I(N.get)?N.get(A):void 0}#Ye(){const A=this.#K;if(this.#K=null,A&&I(A.return))try{A.return()}catch{}}#qe(){return y({context:this.#Oe("context",null)})}#Oe(A,N){const $=this.#t.state;if($&&I($[A])){const H=$[A]();return H??N}return N}#Pe(A,N){const $=this.#t.emit;I($)&&$(A,N)}}}),_e("packages/core/src/source/url.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return b}});const E=F("packages/core/src/internal/warn.js").warnOnce,K=F("packages/core/src/internal/predicates.js"),I=K.isObject,L=K.isFunction,U=F("packages/core/src/internal/paths.js").getPath,q=F("packages/core/src/source/abort.js").isAbortError,R=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 b(p,y={}){const h=I(y)?y:{},d=L(h.fetch)?h.fetch:typeof globalThis<"u"&&L(globalThis.fetch)?globalThis.fetch:null,w=h.format==="json"||h.format==="ndjson"?h.format:void 0,v=typeof h.rowsPath=="string"&&h.rowsPath?h.rowsPath:void 0,P=L(h.map)?h.map:void 0,W=I(h.headers)?h.headers:void 0,V=Number.isFinite(h.batchSize)&&h.batchSize>0?Math.floor(h.batchSize):R,G=h.lenient===!0,_=Number.isFinite(h.poll)&&h.poll>0?Math.floor(h.poll):void 0,T=typeof p=="string"&&p.length>0;T||E("source.url.url","createUrlSource needs a URL string; the grid will stay empty.");async function*S(M={}){if(!T)return;if(!d)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const A=M&&M.signal;let N;try{N=await d(p,W?{signal:A,headers:W}:{signal:A})}catch(Y){throw q(Y)?Y:new Error(`[lattice] createUrlSource: request to ${p} failed — ${Y&&Y.message||Y}`)}if(!N||!N.ok){const Y=N?N.status:"no response";throw new Error(`[lattice] createUrlSource: ${Y} for ${p}`)}const $=u(p,w,N),H=N.body&&L(N.body.getReader)?N.body.getReader():null;try{if(!H){const J=await N.text();($||t(J,p))==="ndjson"?yield*l(null,null,J,0,N,p,V,G):yield*m(J,p,v,P);return}const Y=new TextDecoder("utf-8");if($==="json"){yield*m(await n(H,Y,""),p,v,P);return}if($==="ndjson"){yield*l(H,Y,"",0,N,p,V,G);return}const Z=await i(H,Y,p);Z.format==="json"?yield*m(await n(H,Y,Z.seed),p,v,P):yield*l(H,Y,Z.seed,Z.bytes,N,p,V,G)}finally{if(H&&L(H.cancel))try{await H.cancel()}catch{}}}const O={mode:"stream",open:S,autoStart:h.autoStart!==!1};return _!==void 0&&(O.poll=_),Number.isFinite(h.maxRows)&&(O.maxRows=h.maxRows),Number.isFinite(h.maxAge)&&(O.maxAge=h.maxAge),(typeof h.ageBy=="string"||L(h.ageBy))&&(O.ageBy=h.ageBy),Number.isFinite(h.coalesceMs)&&(O.coalesceMs=h.coalesceMs),Number.isFinite(h.promoteToMemoryBelow)&&(O.promoteToMemoryBelow=h.promoteToMemoryBelow),O}function u(p,y,h){if(y)return y;const d=g(p);if(d)return d;const w=h&&h.headers&&L(h.headers.get)?h.headers.get("content-type"):null;return o(w)}function g(p){const y=String(p).split(/[?#]/)[0].toLowerCase();if(y.endsWith(".ndjson")||y.endsWith(".jsonl"))return"ndjson";if(y.endsWith(".json"))return"json"}function o(p){if(!p)return;const y=p.split(";")[0].trim().toLowerCase();if(j.has(y))return"ndjson";if(y==="application/json"||y==="text/json"||y.endsWith("+json"))return"json"}function t(p,y){const h=p.replace(/^\s+/,""),d=s(h);if(d==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${y} — pass opts.format: 'json' | 'ndjson'.`);return d}async function i(p,y,h){let d="",w=0;for(;;){const{value:P,done:W}=await p.read();if(P&&(w+=P.byteLength,d+=y.decode(P,{stream:!0})),W){d+=y.decode();break}const V=d.replace(/^\s+/,"");if(V){if(V[0]==="[")return{format:"json",seed:d,bytes:w};if(V[0]!=="{"||d.indexOf(`
|
|
8
8
|
`)!==-1)break}}const v=s(d.replace(/^\s+/,""));if(v==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${h} — pass opts.format: 'json' | 'ndjson'.`);return{format:v,seed:d,bytes:w}}function s(p){if(!p||p[0]==="[")return"json";if(p[0]!=="{")return"error";const y=p.indexOf(`
|
|
9
9
|
`);if(y===-1)return"json";let h=p.slice(0,y);return h.endsWith("\r")&&(h=h.slice(0,-1)),r(h)?"ndjson":"json"}function r(p){try{return JSON.parse(p),!0}catch{return!1}}async function n(p,y,h){let d=h;for(;;){const{value:w,done:v}=await p.read();if(w&&(d+=y.decode(w,{stream:!0})),v)break}return d+=y.decode(),d}function*m(p,y,h,d){let w;try{w=JSON.parse(p)}catch(P){throw new Error(`[lattice] createUrlSource: ${y} is not valid JSON — ${P.message}`)}let v=h!==void 0?U(w,h):w;if(d&&(v=d(v)),!Array.isArray(v)){const P=h!==void 0||d?"":"; pass opts.rowsPath or opts.map to select the array";throw new Error(`[lattice] createUrlSource: ${y} did not resolve to an array${P}.`)}yield{rows:v,progress:{loaded:v.length,estimated:v.length}}}async function*l(p,y,h,d,w,v,P,W){const V=f(w);let G=h||"",_=d||0,T=0,S=0,O=[];function*M(){let N;for(;(N=G.indexOf(`
|
|
10
10
|
`))!==-1;){const $=G.slice(0,N);G=G.slice(N+1),S++;const H=a($,S,v,W);H!==k&&(O.push(H),O.length>=P&&(T+=O.length,yield c(O,T,V,_),O=[]))}}if(p){for(;;){const{value:N,done:$}=await p.read();if(N&&(_+=N.byteLength,G+=y.decode(N,{stream:!0}),yield*M()),$)break}G+=y.decode()}yield*M(),S++;const A=a(G,S,v,W);A!==k&&O.push(A),O.length&&(T+=O.length,yield c(O,T,V,_))}function a(p,y,h,d){let w=p;if(w.endsWith("\r")&&(w=w.slice(0,-1)),!w.trim())return k;try{return JSON.parse(w)}catch(v){if(d)return E(`source.url.badline.${h}`,`skipping a malformed NDJSON line (line ${y}) from ${h} — ${v.message}`),k;throw new Error(`[lattice] createUrlSource: malformed NDJSON at line ${y} of ${h} — ${v.message}`)}}function c(p,y,h,d){const w=h&&d>0&&y>0?Math.max(y,Math.round(h/(d/y))):void 0;return{rows:p,progress:{loaded:y,estimated:w}}}function f(p){const y=p&&p.headers&&L(p.headers.get)?p.headers.get("content-length"):null,h=y!=null?Number(y):NaN;return Number.isFinite(h)&&h>0?h:void 0}}),_e("packages/core/src/source/derive.js",function(e,F){"use strict";Object.defineProperty(e,"FOLLOW_MODES",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"BUCKETS",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"DERIVED_ROW_KEY",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DERIVED_SOURCE_KEY",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"UNION_KEY_SEP",{enumerable:!0,get:function(){return R}}),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 b}}),Object.defineProperty(e,"reduceValues",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"applyLimit",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"applyCumulative",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"groupRows",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"finishGroups",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"derive",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"normalizeUnionSource",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"namespaceUnionKeys",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"joinRows",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"preGroup",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"buildJoinIndex",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"joinOne",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"joinKeyOf",{enumerable:!0,get:function(){return w}});const ie=F("packages/core/src/internal/predicates.js"),E=ie.isFunction,K=ie.isObject,L=F("packages/core/src/compute/total.js").TOTAL_FNS,Q=Object.freeze(["filtered","all","selected","grouped"]),U=Object.freeze(["day","week","month","quarter","year"]),x="__key",q="__source",R="";function j(v,P){if(!K(v)||typeof P!="string")return;if(!P.includes("."))return v[P];let W=v;for(const V of P.split(".")){if(!K(W))return;W=W[V]}return W}function k(v,P){const W=[];for(const V of v){const G=j(V,P);if(!(!Array.isArray(G)||!G.length))for(const _ of G)W.push({...V,[P]:_})}return W}function b(v,P){const W=v instanceof Date?v:new Date(v),V=W.getTime();if(!Number.isFinite(V))return null;const G=W.getUTCFullYear(),_=W.getUTCMonth(),T=W.getUTCDate(),S=O=>O.toISOString().slice(0,10);switch(P){case"year":return S(new Date(Date.UTC(G,0,1)));case"quarter":return S(new Date(Date.UTC(G,Math.floor(_/3)*3,1)));case"month":return S(new Date(Date.UTC(G,_,1)));case"week":{const O=(W.getUTCDay()+6)%7;return S(new Date(Date.UTC(G,_,T-O)))}default:return S(new Date(Date.UTC(G,_,T)))}}function u(v,P,W){const V=P.map(G=>W&&W.of===G?b(j(v,G),W.by):j(v,G));return{key:V.map(G=>G==null?"\0":String(G)).join(""),values:V}}function g(v,P){const W=L[P];return W?W({get:V=>v[V]},i(v.length)):null}function o(v,P){return!P||typeof P.of!="string"||P.of===""||v&&v.includes(P.of)?v:[P.of,...v||[]]}function t(v,P){const W={},V=i(v.length);for(const[G,_]of Object.entries(P)){const T=_.fn||"count",S=L[T];if(!S){W[G]=null;continue}const O=_.of?v.map(M=>j(M,_.of)):[];W[G]=S({get:M=>O[M]},V)}return W}const i=(()=>{const v=new Map;return P=>{let W=v.get(P);if(!W){W=new Uint32Array(P);for(let V=0;V<P;V++)W[V]=V;v.size<512&&v.set(P,W)}return W}})();function s(v,P,W){if(!Number.isFinite(P)||P<=0)return v;if(!W)return v.slice(0,P);const V=new Map,G=[];for(const _ of v){const T=String(j(_,W)),S=V.get(T)||0;S>=P||(V.set(T,S+1),G.push(_))}return G}function r(v,P){const W=v.reduce((T,S)=>T+(Number(j(S,P.of))||0),0);if(!W)return v;const V=W*P.upTo;let G=0;const _=[];for(const T of v)if(_.push(T),G+=Number(j(T,P.of))||0,G>=V)break;return _}function n(v,P){return!Array.isArray(P)||!P.length?v:[...v].sort((W,V)=>{for(const G of P){const _=j(W,G.col),T=j(V,G.col);if(_===T)continue;return _==null?1:T==null?-1:((typeof _=="number"&&typeof T=="number"?_<T:String(_)<String(T))?-1:1)*(G.dir==="desc"?-1:1)}return 0})}function m(v,P,W){const V=P.groupBy?Array.isArray(P.groupBy)?P.groupBy:[P.groupBy]:null,G=K(P.bucket)?P.bucket:null,_=o(V,G),T=new Map,S=new Map;if(!_)return{groups:T,rowGroup:S};for(const O of v){const{key:M,values:A}=u(O,_,G);let N=T.get(M);N||(N={values:A,rows:new Map},T.set(M,N));const $=W(O);N.rows.set($,O),S.set($,M)}return{groups:T,rowGroup:S}}function l(v,P,W=null,V=null){const G=P.groupBy?Array.isArray(P.groupBy)?P.groupBy:[P.groupBy]:null,_=K(P.bucket)?P.bucket:null,T=o(G,_);let S=[...v.entries()].map(([O,M])=>{if(W&&V&&!V.has(O)){const N=W.get(O);if(N)return N}const A={[x]:O};return T.forEach((N,$)=>{A[N.includes(".")?N.split(".").pop():N]=M.values[$]}),Object.assign(A,t([...M.rows.values()],P.select||{})),W&&W.set(O,A),A});return S=n(S,P.sort),K(P.cumulative)&&(S=r(S,P.cumulative)),s(S,P.limit,P.limitPer||null)}function a(v,P){const W=y(v,P),V=P.groupBy?Array.isArray(P.groupBy)?P.groupBy:[P.groupBy]:null,G=K(P.bucket)?P.bucket:null,_=o(V,G);let T;if(!_)T=W.map((S,O)=>({...S,[x]:String(j(S,P.rowKey||"id")??O)}));else{const S=new Map;for(const O of W){const{key:M,values:A}=u(O,_,G);let N=S.get(M);N||(N={values:A,rows:[]},S.set(M,N)),N.rows.push(O)}T=[...S.entries()].map(([O,M])=>{const A={[x]:O};return _.forEach((N,$)=>{A[N.includes(".")?N.split(".").pop():N]=M.values[$]}),Object.assign(A,t(M.rows,P.select||{})),A})}return T=n(T,P.sort),K(P.cumulative)&&(T=r(T,P.cumulative)),s(T,P.limit,P.limitPer||null)}function c(v,P){const V=K(v)&&K(v.grid)?v:{grid:v};return{grid:K(V.grid)?V.grid:null,label:V.label!=null&&V.label!==""?String(V.label):String(P),follow:typeof V.follow=="string"?V.follow:void 0,map:E(V.map)?V.map:null}}function f(v){for(const P of v){const W=P[q];W!==void 0&&(P[x]=`${W}${R}${P[x]}`)}return v}function p(v,P){const W=P.on,V=K(W)?String(W.left||W.right||""):String(W||""),G=K(W)?String(W.right||W.left||""):String(W||"");if(!V||!G)return v;const _=P.index instanceof Map?P.index:h(Array.isArray(P.rows)?P.rows:[],G),T=Array.isArray(P.select)?P.select.map(String):null,S=P.prefix?String(P.prefix):"",O=String(P.type||"inner")==="left",M=[];for(const A of v){const N=j(A,V),$=N==null?void 0:_.get(String(N));if(!$){O&&M.push(A);continue}const H={...A},Y=T||Object.keys($);for(const Z of Y)!S&&Z===V||(H[S?S+Z:Z]=j($,Z));M.push(H)}return M}function y(v,P){let W=Array.isArray(v)?v:[];return P.unnest&&(W=k(W,P.unnest)),K(P.join)&&(Array.isArray(P.join.rows)||P.join.index instanceof Map)&&(W=p(W,P.join)),E(P.where)&&(W=W.filter(V=>!!P.where(V))),W}function h(v,P){const W=new Map;for(const V of v){const G=j(V,P);if(G==null)continue;const _=String(G);W.has(_)||W.set(_,V)}return W}function d(v,P){const W=P.on,V=K(W)?String(W.left||W.right||""):String(W||""),G=K(W)?String(W.right||W.left||""):String(W||"");if(!V||!G)return v;const _=P.index instanceof Map?P.index:new Map,T=j(v,V),S=T==null?void 0:_.get(String(T));if(!S)return String(P.type||"inner")==="left"?v:null;const O=Array.isArray(P.select)?P.select.map(String):null,M=P.prefix?String(P.prefix):"",A={...v};for(const N of O||Object.keys(S))!M&&N===V||(A[M?M+N:N]=j(S,N));return A}function w(v,P){const W=j(v,P);return W==null?null:String(W)}}),_e("packages/core/src/source/derived.js",function(e,F){"use strict";Object.defineProperty(e,"IDLE_REFRESH_MS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"PROFILE_FIELDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ALERT_THRESHOLDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"STATISTICS_FNS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"SERIES_METRICS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"PRODUCER_IGNORED_KEYS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"profileAlerts",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"DerivedSource",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"createDerivedSource",{enumerable:!0,get:function(){return G}});const ie=F("packages/core/src/internal/predicates.js"),E=ie.isFunction,K=ie.isObject,L=F("packages/core/src/internal/warn.js").warnOnce,U=F("packages/core/src/source/memory.js").MemorySource,q=F("packages/core/src/source/settle.js").isPipelineSettle,R=F("packages/core/src/source/derive.js"),j=R.derive,k=R.preGroup,b=R.groupRows,u=R.finishGroups,g=R.readPath,o=R.buildJoinIndex,t=R.joinOne,i=R.joinKeyOf,s=R.FOLLOW_MODES,r=R.DERIVED_ROW_KEY,n=R.DERIVED_SOURCE_KEY,m=R.normalizeUnionSource,l=R.namespaceUnionKeys,a=16,c=Object.freeze(["column","rows","present","missing","numeric","distinct","min","max","mean","median","q1","q3","iqr","stddev","outliers","alerts","alertCount"]),f=Object.freeze({missing:.2,cardinality:.9,skew:1,outliers:.05}),p=Object.freeze(["correlation","series","datasetVsDataset"]),y=Object.freeze(["n","first","last","change","changePercent","volatility","annualisedVolatility","growth","maxDrawdown","maxDrawdownFrom","maxDrawdownTo","autocorrelation","upDays","downDays"]),h=Object.freeze(["unnest","join","where","bucket","groupBy","select","sort","limit","limitPer","cumulative"]);function d(_,T={}){const S={...f,...K(T)?T:{}},O=z=>typeof z=="number"&&Number.isFinite(z)?z:null,M=O(_.rows)??0,A=O(_.numeric)??0,N=O(_.missing)??0,$=O(_.distinct),H=O(_.mean),Y=O(_.median),Z=O(_.stddev),J=O(Array.isArray(_.outliers)?_.outliers.length:_.outliers),D=A>0,te=[];return $===0?["empty"]:($===1&&te.push("constant"),M>0&&N/M>=S.missing&&te.push("high-missing"),!D&&$!==null&&M>1&&$===M&&N===0?te.push("unique"):$!==null&&M>0&&$/M>=S.cardinality&&te.push("high-cardinality"),D&&H!==null&&Y!==null&&Z!==null&&Z>0&&Math.abs(3*(H-Y)/Z)>=S.skew&&te.push("skewed"),D&&J!==null&&J/A>=S.outliers&&te.push("outliers"),te)}class w extends U{#e=null;#t={};#n=[];#r=null;#i=!1;#s={};#a=!1;#l=null;#o=null;#c=!1;#u=null;#f=!1;#d=null;constructor(T,S){super({mode:"memory",rows:[]},S),this.#s=S||{},this.#t=K(T)?T:{};const O=this.#t.from;if(Array.isArray(O)){if(this.#e=null,this.#d=this.#g(O),!this.#d.length){L("source.derived.from",'source.mode "derived" needs `from`: at least one grid to derive from.');return}this.#t.follow!==void 0&&L("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&&L("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&&(L("source.derived.union.statistics",'source.mode "derived": `statistics` is not supported when `from` is a union of several grids (BACKLOG-0001046) — a relational statistic reduces one grid\'s own columns, and a union has no single set of them. Derive the statistics of a single grid instead.'),this.#f=!0),this.#m(),this.#b(),this.refresh();return}if(this.#e=O||null,!this.#e){L("source.derived.from",'source.mode "derived" needs `from`: the grid to derive from.');return}this.#t.follow&&!s.includes(String(this.#t.follow))&&L(`source.derived.follow.${this.#t.follow}`,`unknown follow "${this.#t.follow}"; using "filtered". Known: ${s.join(", ")}.`),this.#h()||(this.#f=!0),this.#m(),this.#b(),this.refresh()}#h(){const T=this.#t.statistics;if(T===void 0)return!0;if(this.#t.profile!==void 0)return L("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(T))return L("source.derived.statistics.shape",`source.mode "derived": \`statistics\` needs an object naming the statistic, e.g. \`{ fn: 'correlation', columns: ['a', 'b'] }\`. Known fn: ${p.join(", ")}.`),!1;const S=String(T.fn||"");return p.includes(S)?this.#p(S,T):(L(`source.derived.statistics.fn.${S}`,`source.mode "derived": unknown \`statistics.fn\` "${S}". Known: ${p.join(", ")}. Every *single-column* statistic is reached through \`select\` instead, e.g. \`select: { p95: { of: 'amount', fn: 'p95' } }\`.`),!1)}#p(T,S){if(T==="correlation"){if((Array.isArray(S.columns)?S.columns.filter(Boolean):[]).length<2)return L("source.derived.statistics.columns","source.mode \"derived\": `statistics: { fn: 'correlation' }` needs `columns`: at least two column ids to correlate pairwise."),!1;const M=S.orient===void 0?"pairs":String(S.orient);return M!=="pairs"&&M!=="matrix"&&L(`source.derived.statistics.orient.${M}`,`source.mode "derived": unknown \`statistics.orient\` "${M}" for \`fn: 'correlation'\`; using "pairs". Known: pairs, matrix.`),!0}return T==="series"?!S.of||!S.by?(L("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(S.with)?!0:(L("source.derived.statistics.with","source.mode \"derived\": `statistics: { fn: 'datasetVsDataset' }` needs `with`: the second grid to compare this one against."),!1)}#m(){const T=this.#t.statistics!==void 0?"statistics":this.#t.profile!==void 0?"profile":null;if(!T)return;const S=h.filter(O=>this.#t[O]!==void 0);S.length&&L(`source.derived.producer.ignored.${T}`,`source.mode "derived": \`${T}\` is a terminal producer and replaces the pipeline, so ${S.map(O=>`\`${O}\``).join(", ")} ${S.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(T){const S=this.#s&&this.#s.grid,O=new Set,M=[];return T.forEach((A,N)=>{const $=m(A,N);if(O.has($.label)&&L(`source.derived.union.label.${$.label}`,`source.mode "derived": two union sources share the label "${$.label}"; give each a distinct \`label\` or __source/__key will not distinguish them.`),O.add($.label),!$.grid){L(`source.derived.union.missing.${$.label}`,`source.mode "derived": union source "${$.label}" has no grid and was skipped.`),M.push($);return}if(S&&E($.grid.on)){const H=P(S,$.grid,[$.label]);if(H){L(`source.derived.union.cycle.${$.label}`,`source.mode "derived": union source "${$.label}" was refused — it derives from the grid being derived, directly or through a chain (${H.join(" → ")}). Remove it from \`from\`.`),M.push({...$,grid:null});return}}M.push($)}),M}#b(){if(this.#d){this.#O(),this.#w();return}const T=this.#e;if(!T||!E(T.on))return;const S=String(this.#t.follow||"filtered"),O=["rows:changed"];(S==="filtered"||S==="grouped")&&O.push("filter:changed","model:changed"),S==="selected"&&O.push("selection:changed"),S==="grouped"&&O.push("column:grouped");for(const M of O){const A=N=>{M==="rows:changed"&&v(N)||M==="model:changed"&&!q(N)||this.schedule(M==="rows:changed"?N:null)};T.on(M,A),this.#n.push(()=>E(T.off)&&T.off(M,A))}this.#w(),this.#y()}#y(){const T=this.#t.statistics,S=K(T)?T.with:null;if(!K(S)||!E(S.on))return;const O=S;for(const M of["rows:changed","filter:changed","model:changed"]){const A=N=>{M==="rows:changed"&&v(N)||M==="model:changed"&&!q(N)||this.schedule(null)};O.on(M,A),this.#n.push(()=>E(O.off)&&O.off(M,A))}}#O(){for(const T of this.#d){const S=T.grid;if(!S||!E(S.on))continue;const O=s.includes(String(T.follow))?String(T.follow):"filtered",M=["rows:changed"];(O==="filtered"||O==="grouped")&&M.push("filter:changed","model:changed"),O==="selected"&&M.push("selection:changed"),O==="grouped"&&M.push("column:grouped");for(const A of M){const N=$=>{A==="rows:changed"&&v($)||A==="model:changed"&&!q($)||this.schedule(null)};S.on(A,N),this.#n.push(()=>E(S.off)&&S.off(A,N))}}}#w(){const T=this.#t.join,S=T&&T.with;if(!S||!E(S.on))return;const M=String(T.follow||"all")==="all"?["rows:changed"]:["rows:changed","filter:changed","model:changed"];for(const A of M){const N=$=>{A==="rows:changed"&&v($)||A==="model:changed"&&!q($)||this.schedule({partner:!0})};S.on(A,N),this.#n.push(()=>E(S.off)&&S.off(A,N))}}#A(){const T=this.#t.join;if(!T||!T.with)return null;const S=T.on,O=K(S)?String(S.left||S.right||""):String(S||""),M=K(S)?String(S.right||S.left||""):String(S||"");return O&&M?{left:O,right:M}:null}#v(){const T=this.#A();if(!T)return this.#u=null,null;const S=this.#u;if(this.#u=o(this.#C(),T.right),!S)return null;const O=this.#t.join||{},M=Array.isArray(O.select)?O.select.map(String):null,A=H=>H?(M||Object.keys(H)).map(Z=>String(g(H,Z))).join(""):null,N=new Set,$=new Set;for(const[H,Y]of this.#u)A(Y)!==A(S.get(H))&&(N.add(H),S.has(H)||$.add(H));for(const H of S.keys())this.#u.has(H)||N.add(H);return{affected:N,gained:$}}#P(T,S){const O=this.#l;if(!O||!O.leftByJoinKey)return null;const M=[];for(const A of T){const N=O.leftByJoinKey.get(A);if(N)for(const $ of N){const H=O.rowData.get($);H!==void 0&&M.push({key:$,data:H})}}return this.#M({updated:M,added:[],removed:[]},S)}#S(T,S){if(!this.#l||!this.#l.leftByJoinKey||T.unnest||T.where||String(T.follow||"filtered")==="grouped")return!1;const O=T.join||{};return String(O.type||"inner")==="left"?!0:S.size===0}#C(){const T=this.#t.join,S=T&&T.with;if(!S||!S.rows)return[];const O=[],M=A=>{A.group||O.push(W(A))};return String(T.follow||"all")==="filtered"&&E(S.rows.forEach)?S.rows.forEach(M):E(S.rows.forEachAll)&&S.rows.forEachAll(M),O}schedule(T){const S=this.#t.refresh===void 0?"idle":this.#t.refresh;if(S==="manual")return;if(S==="live"){this.refresh(T);return}const O=typeof S=="number"&&Number.isFinite(S)?S:a;if(this.#r){this.#c=!0;return}this.#c=!1,this.#r=setTimeout(()=>{this.#r=null,this.refresh(this.#c?null:T)},O)}refresh(T){if(!(this.#i||!this.#e&&!this.#d)){if(this.#a){L("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.#a=!0;try{const S=this.#f?[]:this.#d?this.#t.profile?this.#H():this.#x():this.#t.statistics!==void 0?this.#ge():this.#t.profile?this.#fe():this.#E(T);this.setRows(S),this.invalidate("filter"),E(this.#s.emit)&&this.#s.emit("rows:changed",{derived:!0},"derived")}finally{this.#a=!1}}}#E(T){const O=K(T)&&T.partner===!0?this.#v():null,M=this.#D();if(O&&this.#l){if(!O.affected.size)return u(this.#l.groups,M,this.#l.reduced,new Set);if(this.#S(M,O.gained)){const X=this.#P(O.affected,M);if(X)return u(this.#l.groups,M,this.#l.reduced,X)}}const A=this.#T(M,T);if(A&&this.#l){const X=this.#M(A,M);return u(this.#l.groups,M,this.#l.reduced,X)}const N=k(this.#F(),M);if(this.#o=this.#R(),!M.groupBy)return this.#l=null,j(N,M);const $=this.#N(),{groups:H,rowGroup:Y}=b(N,M,$),Z=new Map;for(const[X,ne]of Y){const se=H.get(ne);se&&Z.set(X,se.rows.get(X))}const J=new Map,D=this.#A(),te=new Map,z=new Map;if(D)for(const[X,ne]of Z){const se=i(ne,D.left);if(se===null)continue;te.set(X,se);let ue=z.get(se);ue||(ue=new Set,z.set(se,ue)),ue.add(X)}return this.#l={groups:H,rowGroup:Y,rowData:Z,reduced:J,leftJoinKey:te,leftByJoinKey:z},u(H,M,J,null)}#T(T,S){if(!this.#l||!T.groupBy||T.unnest||T.where||String(T.follow||"filtered")==="grouped"||K(T.join)&&T.join.with&&!(T.join.index instanceof Map)||!K(S))return null;const O=Array.isArray(S.updated)?S.updated:null,M=Array.isArray(S.added)?S.added:null,A=Array.isArray(S.removed)?S.removed:null;if(!O&&!M&&!A)return null;const N=this.#o;if(N&&N.size&&String(T.follow||"filtered")!=="all"){if(S.edit===!0&&Array.isArray(S.columns)){for(const $ of S.columns)if(N.has(String($)))return null}for(const $ of O||[]){const H=$&&$.key,Y=H===void 0?void 0:this.#l.rowData.get(String(H)),Z=W($);for(const J of N)if(g(Y,J)!==g(Z,J))return null}}return{updated:O||[],added:M||[],removed:A||[]}}#M(T,S){const O=this.#l,M=this.#N(),A=new Set,N=K(S.join)&&S.join.index instanceof Map?S.join:null,$=this.#A(),H=Z=>{const J=O.rowGroup.get(Z);if(J===void 0)return;A.add(J);const D=O.groups.get(J);if(D&&(D.rows.delete(Z),D.rows.size||O.groups.delete(J)),O.rowGroup.delete(Z),O.rowData.delete(Z),O.leftJoinKey){const te=O.leftJoinKey.get(Z);if(te!==void 0){const z=O.leftByJoinKey.get(te);z&&(z.delete(Z),z.size||O.leftByJoinKey.delete(te)),O.leftJoinKey.delete(Z)}}},Y=Z=>{const J=N?t(Z,N):Z;if(!J)return;const D=M(J),te=b([J],S,M);for(const[z,X]of te.groups){let ne=O.groups.get(z);ne||(ne={values:X.values,rows:new Map},O.groups.set(z,ne)),ne.rows.set(D,J),O.rowGroup.set(D,z),A.add(z)}if(O.rowData.set(D,J),$&&O.leftByJoinKey){const z=i(J,$.left);if(z!==null){O.leftJoinKey.set(D,z);let X=O.leftByJoinKey.get(z);X||(X=new Set,O.leftByJoinKey.set(z,X)),X.add(D)}}};for(const Z of T.removed)H(String(Z));for(const Z of T.updated)H(String(Z.key)),Y(W(Z));for(const Z of T.added)Y(W(Z));return A}#N(){const T=this.#e,S=T&&T.config&&T.config.rowKey||"id";return O=>String(g(O,typeof S=="string"?S:"id")??"")}#R(){const T=this.#e,S=T&&T.state&&E(T.state.get)?T.state.get():null,O=new Set,M=A=>{if(A){if(Array.isArray(A.conditions)){A.conditions.forEach(M);return}A.col&&O.add(String(A.col))}};return S&&M(S.filters),O}#D(){let T=this.#t;if(T.join&&T.join.with&&(this.#u||this.#v(),T={...T,join:{...T.join,index:this.#u}}),this.#d||String(T.follow||"filtered")!=="grouped")return T;const S=this.#e,O=S&&S.state&&E(S.state.get)?S.state.get():null,M=O&&Array.isArray(O.group)?O.group:[];return M.length?{...T,groupBy:[...M]}:T}#K(){const T=[];for(const S of this.#d)if(S.grid)try{const O=s.includes(String(S.follow))?String(S.follow):"filtered",M=this.#Y(S.grid,O);for(const A of M){const N=S.map?S.map(A):A;K(N)&&T.push({...N,[n]:S.label})}}catch(O){L(`source.derived.union.failed.${S.label}`,`source.mode "derived": union source "${S.label}" failed to read (${O&&O.message?O.message:O}) and was skipped this pass.`)}return T}#Y(T,S){if(!T||!T.rows)return[];if(S==="all"){const M=[];return E(T.rows.forEachAll)&&T.rows.forEachAll(A=>{A.group||M.push(W(A))}),M}if(S==="selected")return(T.selection&&E(T.selection.rows)?T.selection.rows():[]).filter(Boolean).map(W);const O=[];return E(T.rows.forEach)&&T.rows.forEach(M=>{M.group||O.push(W(M))}),O}#x(){const T=this.#D(),S=this.#K(),O=j(S,T);return T.groupBy?O:l(O)}#H(){return L("source.derived.union.profile",'source.mode "derived": `profile` is not supported when `from` is a union of several grids (BACKLOG-0001045); profile a single grid instead.'),[]}#F(){const T=this.#e,S=String(this.#t.follow||"filtered");if(!T||!T.rows)return[];if(S==="all"){const A=[];return E(T.rows.forEachAll)&&T.rows.forEachAll(N=>{N.group||A.push(W(N))}),A}if(S==="selected")return(T.selection&&E(T.selection.rows)?T.selection.rows():[]).filter(Boolean).map(W);const O=this.#X(),M=[];return O&&this.#V().length&&E(T.rows.forEachExcept)?(T.rows.forEachExcept(O,A=>{A.group||M.push(W(A))}),M):(E(T.rows.forEach)&&T.rows.forEach(A=>{A.group||M.push(W(A))}),M)}#X(){const T=this.#t.crossFilter;if(!T||this.#d)return null;if(typeof T=="string")return T;if(T.col)return String(T.col);const S=this.#t.groupBy,O=Array.isArray(S)?S[0]:S;return O?String(O):null}#V(){const T=this.#X(),S=this.#e;if(!T||!S||!S.filters||!E(S.filters.get))return[];const O=V(S.filters.get(),T);return O?O.op==="in"&&Array.isArray(O.value)?O.value.map(String):O.op==="eq"&&O.value!==void 0?[String(O.value)]:[]:[]}#B(T){const S=this.#X(),O=this.#e;if(!S||!O||!O.filters||!E(O.filters.set))return;const M=this.#s.compute||{},A=E(O.filters.get)?O.filters.get():null,N=E(M.pruneColumn)?M.pruneColumn(A,S):null;if(!T.length){O.filters.set(N||null);return}const $=T.length===1?{col:S,op:"eq",value:T[0]}:{col:S,op:"in",value:T.slice()},H=N?N.conditions&&N.op?N.conditions:[N]:[];O.filters.set(H.length?{op:"and",conditions:[...H,$]}:$)}crossFilter(){const T=this;return{enabled(){return!!T.#X()},column(){return T.#X()},get(){return T.#V()},set(S){const O=S==null?[]:(Array.isArray(S)?S:[S]).map(M=>String(M));T.#B(O)},toggle(S){const O=String(S),M=T.#V(),N=M.indexOf(O)>=0?M.filter($=>$!==O):[...M,O];T.#B(N)},clear(){T.#B([])}}}#W(T){const S=T&&T.rows;if(S&&E(S.matchCount)){const O=S.matchCount(),M=Number(O);if(O!==null&&Number.isFinite(M))return M}if(S&&E(S.count)){const O=Number(S.count());if(Number.isFinite(O))return O}return 0}#ge(){const T=this.#e,S=this.#t.statistics;if(!T||!T.statistics||!K(S))return[];switch(String(S.fn)){case"correlation":return this.#se(T,S);case"series":return this.#ue(T,S);case"datasetVsDataset":return this.#Me(T,S);default:return[]}}#se(T,S){const O=S.columns.filter(Boolean).map(String),M=this.#W(T),A=(N,$)=>{const H=T.statistics.correlation(N,$);return typeof H=="number"&&Number.isFinite(H)?H:null};if(String(S.orient||"pairs")!=="matrix"){const N=[];for(let $=0;$<O.length;$++)for(let H=$+1;H<O.length;H++)N.push({[r]:`${O[$]}${O[H]}`,a:O[$],b:O[H],coefficient:A(O[$],O[H]),n:M});return N}return O.map(N=>{const $={[r]:N,column:N};for(const H of O)$[H]=N===H?1:A(N,H);return $.n=M,$})}#ue(T,S){const O=this.#W(T),M={by:String(S.by)};S.periodsPerYear!==void 0&&(M.periodsPerYear=Number(S.periodsPerYear));const A=T.statistics.series(String(S.of),M)||{};return y.map(N=>({[r]:N,metric:N,value:A[N]??null,n:O}))}#Me(T,S){const O=S.with,M=Array.isArray(S.columns)?{columns:S.columns.map(String)}:void 0,A=T.statistics.datasetVsDataset(O,M);if(!K(A))return[];const $=(Array.isArray(A.ranked)?A.ranked:[]).map(Z=>({[r]:String(Z.column),column:Z.column,measure:Z.measure??null,magnitude:Z.magnitude??null,distance:Z.distance??null,direction:Z.direction??null,nA:Z.nA??null,nB:Z.nB??null,meanA:Z.meanA??null,meanB:Z.meanB??null,reliable:Z.reliable??null,unmatched:""})),H=A.unmatched,Y=[["A",H&&H.onlyA],["B",H&&H.onlyB]];for(const[Z,J]of Y)for(const D of J||[])$.push({[r]:`${Z}${D}`,column:D,measure:null,magnitude:null,distance:null,direction:null,nA:null,nB:null,meanA:null,meanB:null,reliable:!1,unmatched:Z});return $}#fe(){const T=this.#e;if(!T||!T.statistics||!E(T.statistics.profile))return[];const O=(Array.isArray(this.#t.profile)?this.#t.profile:[this.#t.profile]).filter(Boolean).map(A=>{const N=T.statistics.profile(String(A))||{},$={[r]:String(A)};for(const Y of c)$[Y]=Y==="column"?String(A):N[Y]??null;$.outliers=Array.isArray(N.outliers)?N.outliers.length:N.outliers??null;const H=d({...N,rows:$.rows,outliers:$.outliers,numeric:N.numeric},this.#t.alerts);return $.alerts=H.join(", "),$.alertCount=H.length,$});if(this.#t.orient!=="metrics")return O;const M=O[0];return M?c.filter(A=>A!=="column").map(A=>({[r]:A,metric:A,value:M[A]})):[]}apply(T){const S=["add","update","remove"],O=[];for(const M of S)for(const A of T&&T[M]||[])O.push({operation:M,id:A&&A.id,reason:"derived-read-only"});return O.length&&L("source.derived.readonly","a derived grid is read-only: its rows are computed from another grid. Write to the source grid instead, and the derived one follows."),{added:[],updated:[],removed:[],rejected:O}}destroy(){this.#i=!0,this.#r&&(clearTimeout(this.#r),this.#r=null),this.#X()&&this.#V().length&&this.#B([]);for(const T of this.#n)try{T()}catch{}this.#n=[],this.#e=null,this.#d=null,super.destroy()}}function v(_){return K(_)&&_.companion===!0}function P(_,T,S,O=new Set){if(T===_)return S;if(O.has(T))return null;O.add(T);let M=null;try{M=E(T.config)?T.config():null}catch{M=null}const A=M&&K(M.source)?M.source:null;if(!A||A.mode!=="derived")return null;const N=A.from;if(Array.isArray(N)){for(let $=0;$<N.length;$++){const H=m(N[$],$);if(!H.grid||!E(H.grid.on))continue;const Y=P(_,H.grid,[...S,H.label],O);if(Y)return Y}return null}return K(N)&&E(N.on)?P(_,N,[...S,"(from)"],O):null}function W(_){return K(_)&&"data"in _?_.data:_}function V(_,T){if(!_||typeof _!="object")return null;if(Array.isArray(_.conditions)){for(const O of _.conditions){const M=V(O,T);if(M)return M}return null}return _.col===T?_:null}function G(_,T){return new w(_,T)}}),_e("packages/core/src/source/adapters/odata.js",function(e,F){"use strict";Object.defineProperty(e,"conditionToOData",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"filtersToOData",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"odataAdapter",{enumerable:!0,get:function(){return c}});const E=F("packages/core/src/internal/warn.js").warnOnce,I=F("packages/core/src/source/filterwire.js").isGroup,L=Object.freeze(["eq","ne","gt","gte","lt","lte","contains","startsWith","endsWith","blank","notBlank","between","notBetween"]),Q=/^\d{4}-\d{2}-\d{2}$/,U=/^\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/,x=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;function q(f){const p=f instanceof Date?f:typeof f=="number"&&Number.isFinite(f)?new Date(f):typeof f=="string"&&x.test(f)?new Date(f):null;return p&&!Number.isNaN(p.getTime())?p:null}const R=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function j(f,p){throw typeof p=="string"&&R.test(p)?new Error(`odataAdapter: "${p}" needs a zone designator to be used as a ${f} 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(p)}" is not a usable ${f} value`)}function k(f){const p=q(f);return p||j("DateTimeOffset",f),p.toISOString()}function b(f){if(typeof f=="string"&&Q.test(f))return f;const p=q(f);return p||j("Date",f),p.toISOString().slice(0,10)}function u(f){if(typeof f=="string"&&U.test(f))return f.length===5?`${f}:00`:f;if(typeof f=="number"&&Number.isFinite(f)&&f>=0&&f<864e5){const p=Math.floor(f),y=h=>String(h).padStart(2,"0");return`${y(Math.floor(p/36e5))}:${y(Math.floor(p%36e5/6e4))}:${y(Math.floor(p%6e4/1e3))}`}throw new Error(`odataAdapter: "${String(f)}" is not a usable TimeOfDay value`)}const g=Object.freeze({timestamp:k,datetime:k,date:b,dateString:b,time:u}),o=200,t=1e3,i=Object.freeze({eq:"eq",ne:"ne",gt:"gt",gte:"ge",lt:"lt",lte:"le"});function s(f,p){if(f==null)return"null";const y=p&&g[String(p)];return y?y(f):typeof f=="number"||typeof f=="boolean"?String(f):f instanceof Date?f.toISOString():`'${String(f).replace(/'/g,"''")}'`}function r(f){const p=String(f),y=/^[A-Za-z_][A-Za-z0-9_]*$/;if(!p||!p.split("/").every(h=>y.test(h)))throw new Error(`odataAdapter: "${p}" is not a usable column name`);return p}const n=Object.freeze({lo:{incl:"ge",excl:"gt"},hi:{incl:"le",excl:"lt"}});function m(f){const p=r(f.col),y=String(f.op),h=f.type;if(i[y])return`${p} ${i[y]} ${s(f.value,h)}`;if(y==="contains")return`contains(${p},${s(f.value,h)})`;if(y==="startsWith")return`startswith(${p},${s(f.value,h)})`;if(y==="endsWith")return`endswith(${p},${s(f.value,h)})`;if(y==="blank")return`(${p} eq null)`;if(y==="notBlank")return`(${p} ne null)`;if(y==="between"||y==="notBetween"){const d=Array.isArray(f.value)?f.value:[f.value,f.value],w=String(f.bounds||"[]"),v=w.charAt(0)==="("?n.lo.excl:n.lo.incl,P=w.charAt(1)===")"?n.hi.excl:n.hi.incl,W=`(${p} ${v} ${s(d[0],h)} and ${p} ${P} ${s(d[1],h)})`;return y==="between"?W:`(${p} eq null or not ${W})`}return null}function l(f){const p=String(f&&f.op);throw E(`source.odata.filter.refuse.${p}`,`a "${p}" 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 "${p}" filter condition cannot be expressed in OData and was refused`)}function a(f){if(!f)return"";if(!I(f)){const h=m(f);return h===null?l(f):h}const p=String(f.op)==="or"?" or ":" and ",y=(f.conditions||[]).map(h=>{if(I(h))return a(h);const d=m(h);return d===null?l(h):d}).filter(Boolean);return y.length?y.length===1?y[0]:`(${y.join(p)})`:""}function c(f={}){const p=String(f.url||""),y=f.fetch||(typeof fetch=="function"?fetch:null),h=f.count!==!1,d=r(f.key||"id"),w=f.edit===!0;return{name:"odata",capabilities:{filter:"tree",operators:L,sort:"multi",quick:f.search===!0,range:!0,total:h,mutate:w?{update:!0,delete:!0,append:!0,returning:"row"}:!1},urlFor(v){const P=[],W=(G,_)=>P.push(`${G}=${encodeURIComponent(_)}`),V=a(v.filters);return V&&W("$filter",V),v.sort&&v.sort.length&&W("$orderby",v.sort.map(G=>`${r(G.col)}${G.dir==="desc"?" desc":" asc"}`).join(",")),v.range&&(W("$skip",String(v.range.start)),W("$top",String(v.range.end-v.range.start))),v.quick&&W("$search",`"${String(v.quick).replace(/"/g,"")}"`),h&&W("$count","true"),P.length?`${p}?${P.join("&")}`:p},async execute(v,P){if(!y)throw new Error("odataAdapter needs a fetch implementation");const W={Accept:"application/json",...f.headers||{}},V=P&&P.signal,G=async O=>{const M=await y(O,{headers:W,signal:V});if(!M.ok)throw new Error(`OData request failed: ${M.status}`);return M.json()};let _=await G(this.urlFor(v)),T=_.value||_.rows||[];const S=_["@odata.count"]??_.count;if(!v.range){let O=_["@odata.nextLink"];for(;O&&T.length<o*t;)_=await G(O),T=T.concat(_.value||_.rows||[]),O=_["@odata.nextLink"]}return S==null?(h&&E("source.odata.nocount",`${p} 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:T}):{rows:T,total:Number(S)}},urlForKey(v){return`${p}(${s(v)})`},async mutate(v,P){if(!y)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 W={Accept:"application/json","Content-Type":"application/json",...f.headers||{}},V=P&&P.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 M=await y(this.urlForKey(O),{method:"DELETE",headers:W,signal:V});if(!M.ok)throw new Error(`OData delete failed: ${M.status}`);return{ok:!0}}if(v.kind==="append"){const O=Array.isArray(v.rows)?v.rows.filter(H=>H&&typeof H=="object"):[];if(O.length!==1)throw new Error("odataAdapter: an append needs exactly one row object (OData creates one entity per POST)");const M=await y(p,{method:"POST",headers:W,signal:V,body:JSON.stringify(O[0])});if(!M.ok)throw new Error(`OData add-row failed: ${M.status}`);const A=M.status===204?null:await M.json().catch(()=>null),N=A&&typeof A=="object"&&"value"in A?A.value:A;if(!N||typeof N!="object")throw new Error("odataAdapter: the POST returned no created entity to rekey the appended row by. Have the service return the created entity (Prefer: return=representation).");const $=N[d];if($==null)throw new Error(`odataAdapter: the created entity carried no ${d} to rekey the appended row by.`);return{ok:!0,keys:[String($)],rows:[N]}}const G=this.urlForKey(v.key),_=await y(G,{method:"PATCH",headers:W,signal:V,body:JSON.stringify(v.patch||{})});if(!_.ok)throw new Error(`OData update failed: ${_.status}`);if(_.status===204)return{ok:!0};const T=await _.json(),S=T&&typeof T=="object"&&"value"in T?T.value:T;return S==null?{ok:!0}:{ok:!0,rows:[S]}}}}}),_e("packages/core/src/source/adapters/rest.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_PARAMS",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"DEFAULT_VERBS",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"restAdapter",{enumerable:!0,get:function(){return K}});const ie=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(I={}){const L=String(I.url||""),Q=I.fetch||(typeof fetch=="function"?fetch:null),U={...ie,...I.params||{}},x=I.encodeFilter||(t=>JSON.stringify(t)),q=I.rows||(t=>Array.isArray(t)?t:t.rows||t.data||[]),R=I.total||((t,i)=>Array.isArray(t)?i.length:t.total??t.count??i.length),j=I.edit===!0,k=I.returning==="row"?"row":I.returning==="key"?"key":"none",b=I.keyField||"id",u=I.writeUrlFor||(t=>`${L}/${encodeURIComponent(String(t.key??(t.keys&&t.keys[0])))}`),g=I.encodeMutation||(t=>{const i=E[t.kind];if(t.kind==="update")return{method:i,url:u(t),headers:{"Content-Type":"application/json"},body:JSON.stringify(t.patch||{})};if(t.kind==="append"){const s=Array.isArray(t.rows)?t.rows:t.rows?[t.rows]:[];return{method:i,url:L,headers:{"Content-Type":"application/json"},body:JSON.stringify(s.length===1?s[0]:s)}}return{method:i,url:u(t)}}),o=I.writeRow||(t=>{if(t===null||typeof t!="object")return null;if(Array.isArray(t))return t.length?t[0]:null;const i=t;return i.row??i.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,...I.capabilities||{},...I.operators?{filter:"tree",operators:I.operators}:{}},urlFor(t){const i=new URLSearchParams;t.range&&(i.set(U.offset,String(t.range.start)),i.set(U.limit,String(t.range.end-t.range.start))),t.sort&&t.sort.length&&(i.set(U.sort,t.sort.map(r=>r.col).join(",")),i.set(U.order,t.sort.map(r=>r.dir||"asc").join(","))),t.filters&&i.set(U.filter,x(t.filters)),t.quick&&i.set(U.search,String(t.quick));const s=i.toString();return s?`${L}?${s}`:L},async execute(t,i){if(!Q)throw new Error("restAdapter needs a fetch implementation");const s=await Q(this.urlFor(t),{headers:{Accept:"application/json",...I.headers||{}},signal:i&&i.signal});if(!s.ok)throw new Error(`request failed: ${s.status}`);const r=await s.json(),n=q(r);return{rows:n,total:R(r,n)}},writeUrlFor(t){return u(t)},encodeMutation(t){return g(t)},async mutate(t,i){if(!Q)throw new Error("restAdapter needs a fetch implementation");if(!t||t.kind!=="update"&&t.kind!=="delete"&&t.kind!=="append")throw new Error(`restAdapter: mutation kind "${t&&t.kind}" is not supported (update, delete and append are wired)`);const s=g(t);if(!s||!s.url||!s.method)throw new Error("restAdapter: encodeMutation must return { method, url }");const r={Accept:"application/json",...I.headers||{},...s.headers||{}},n=await Q(s.url,{method:s.method,headers:r,signal:i&&i.signal,...s.body!==void 0?{body:s.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 a=await n.json(),c=o(a),f=c&&typeof c=="object"?c[b]:void 0;if(f==null)throw new Error(`restAdapter: the add-row response carried no ${b} to rekey the appended row by. Point \`keyField\` at the primary key the endpoint returns, or override \`writeRow\`.`);return k==="row"?{ok:!0,keys:[String(f)],rows:[c]}:{ok:!0,keys:[String(f)]}}if(k!=="row"||n.status===204)return{ok:!0};const m=await n.json(),l=o(m);return l==null?{ok:!0}:{ok:!0,rows:[l]}}}}}),_e("packages/core/src/source/adapters/dfql.js",function(e,F){"use strict";Object.defineProperty(e,"DFQL_BASE",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"DFQL_WRITE_URL",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"dfqlAdapter",{enumerable:!0,get:function(){return j}});const E=F("packages/core/src/internal/predicates.js").isFunction,I=F("packages/core/src/internal/warn.js").warnOnce,L="https://rest.demandflow.com",Q="https://stream.demandflow.com/dfql",U=Object.freeze(["id","created","updated","ownerId","entity"]);function x(k){const b={},u=[];for(const[g,o]of Object.entries(k||{})){if(U.includes(g)){u.push(g);continue}b[g]=o}return u.length&&I("source.dfql.protected",`a DFQL update tried to write protected field(s) ${u.join(", ")}; they are server-assigned and immutable, so they were dropped from the PATCH.`),b}function q(k){if(!k||typeof k!="object"||Array.isArray(k))return["fields (must be an object)"];const b=k,u=[];return(typeof b.entity!="string"||!b.entity)&&u.push("entity (uppercase code)"),Number.isFinite(Number(b.level))||u.push("level (numeric)"),(typeof b.comboKey!="string"||!b.comboKey.endsWith("|ENT:"))&&u.push("comboKey (a string ending '|ENT:')"),u}async function R(k){const b=[],u=i=>{const s=i.trim();if(s)try{b.push(JSON.parse(s))}catch{}};if(!k.body||typeof k.body.getReader!="function")return(await k.text()).split(`
|