@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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.117.
|
|
2
|
+
* Lattice Grid 1.117.3, webcomponent module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
6
6
|
(function(lr){"use strict";var yi=!0,cr=Object.create(null),ur=Object.create(null);function He(e,F){cr[e]=F}function Yn(e){var F=ur[e];if(F)return F;var ie=Object.create(null);ur[e]=ie;var E=cr[e];if(!E)throw new Error("[lattice] missing module: "+e);return E(ie,Yn),ie}He("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 W}}),Object.defineProperty(e,"isBlank",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"isCtor",{enumerable:!0,get:function(){return x}});function ie(Q){return Q!==null&&typeof Q=="object"&&!Array.isArray(Q)}function E(Q){return typeof Q=="function"}function W(Q){return Q==null}function I(Q){return Q==null||Q===""}function x(Q){return typeof Q!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(Q))?!0:!!(Q.prototype&&Object.getOwnPropertyNames(Q.prototype).length>1)}}),He("packages/core/src/internal/warn.js",function(e,F){"use strict";Object.defineProperty(e,"reportedWarnings",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"warnOnce",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"infoOnce",{enumerable:!0,get:function(){return O}}),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 a}}),Object.defineProperty(e,"DEV",{enumerable:!0,get:function(){return g}});const ie=new Set,E=2e3;function W(o){if(ie.add(o),ie.size>E){const t=ie.values().next().value;t!==void 0&&ie.delete(t)}}const I=[],x=500;function Q(o,t,r){I.push({key:o,level:t,message:r.map(s=>typeof s=="string"?s:U(s)).join(" "),at:Date.now()}),I.length>x&&I.shift()}function U(o){if(o instanceof Error)return o.message;try{return JSON.stringify(o)}catch{return String(o)}}function L(){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 M(o,...t){if(ie.has(o))return;W(o);const r=q(t);Q(o,"warn",r),console.warn("[lattice]",...r)}function O(o,...t){if(ie.has(o))return;W(o);const r=q(t);Q(o,"info",r),console.info("[lattice]",...r)}function k(){ie.clear(),I.length=0}function b(o,t){const r=new Error(`[lattice] ${o}`);throw t!==void 0&&(r.cause=t),r}function a(o,t){o||b(t)}const g=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})()}),He("packages/core/src/formatting/rules.js",function(e,F){"use strict";Object.defineProperty(e,"RULE_OPS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DISTRIBUTION_OPS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"DISTRIBUTION_LABELS",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"testRule",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"mixColour",{enumerable:!0,get:function(){return O}}),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 a}}),Object.defineProperty(e,"resolveDistribution",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"ICON_SETS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"compileRules",{enumerable:!0,get:function(){return G}});const E=F("packages/core/src/internal/predicates.js").isFunction,I=F("packages/core/src/internal/warn.js").warnOnce,x=Object.freeze(["eq","ne","gt","gte","lt","lte","between","outside","contains","notContains","startsWith","endsWith","blank","notBlank","true","false"]),Q=Object.freeze(["topPercent","bottomPercent","topN","bottomN","aboveMean","belowMean","aboveMedian","belowMedian","zAbove","zBelow","outlier"]),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 L(A,S){const R=Number(A),j=Number(S);if(A!==null&&A!==""&&S!==null&&S!==""&&Number.isFinite(R)&&Number.isFinite(j))return R<j?-1:R>j?1:0;const $=String(A??"").toLowerCase(),_=String(S??"").toLowerCase();return $<_?-1:$>_?1:0}function q(A){return A==null||A===""}function M(A,S){if(!S||typeof S!="object")return!1;const{op:R}=S,j=S.value,N=S.value2;switch(R){case"blank":return q(A);case"notBlank":return!q(A);case"true":return A===!0;case"false":return A===!1;default:break}if(q(A))return!1;switch(R){case"eq":return L(A,j)===0;case"ne":return L(A,j)!==0;case"gt":return L(A,j)>0;case"gte":return L(A,j)>=0;case"lt":return L(A,j)<0;case"lte":return L(A,j)<=0;case"between":return L(A,j)>=0&&L(A,N)<=0;case"outside":return L(A,j)<0||L(A,N)>0;case"contains":return String(A).toLowerCase().includes(String(j??"").toLowerCase());case"notContains":return!String(A).toLowerCase().includes(String(j??"").toLowerCase());case"startsWith":return String(A).toLowerCase().startsWith(String(j??"").toLowerCase());case"endsWith":return String(A).toLowerCase().endsWith(String(j??"").toLowerCase());default:return!1}}function O(A,S,R){const j=z=>{const X=String(z).replace("#",""),ne=X.length===3?X.split("").map(re=>re+re).join(""):X;return[0,2,4].map(re=>parseInt(ne.slice(re,re+2),16)||0)},[N,$,_]=j(A),[Y,Z,J]=j(S),D=Math.max(0,Math.min(1,R)),te=(z,X)=>Math.round(z+(X-z)*D);return`#${[te(N,Y),te($,Z),te(_,J)].map(z=>z.toString(16).padStart(2,"0")).join("")}`}function k(A){const S=[];for(const Y of A||[]){if(Y==null||Y==="")continue;const Z=Y instanceof Date?Y.getTime():Number(Y);Number.isFinite(Z)&&S.push(Z)}if(!S.length)return null;S.sort((Y,Z)=>Y-Z);let R=0,j=0,N=0;for(const Y of S){R++;const Z=Y-j;j+=Z/R,N+=Z*(Y-j)}const $=b(S,.25),_=b(S,.75);return{n:S.length,min:S[0],max:S[S.length-1],mean:j,stddev:S.length>1?Math.sqrt(N/(S.length-1)):0,median:b(S,.5),q1:$,q3:_,iqr:_-$,sorted:S}}function b(A,S){if(!A.length)return 0;const R=(A.length-1)*Math.max(0,Math.min(1,S)),j=Math.floor(R),N=Math.ceil(R);return j===N?A[j]:A[j]+(R-j)*(A[N]-A[j])}function a(A){for(const S of Array.isArray(A)?A:[])if(!(!S||typeof S!="object")&&(S.when&&Q.includes(S.when.op)||S.scale&&S.scale.from||S.dataBar&&!(Number.isFinite(Number(S.dataBar.min))&&Number.isFinite(Number(S.dataBar.max)))||S.iconSet&&!Array.isArray(S.iconSet.thresholds)))return!0;return!1}function g(A,S){const R=Number(A.value),j=N=>b(S.sorted,N);switch(A.op){case"topPercent":{const N=o(R,10);return{op:"gte",value:j(1-N)}}case"bottomPercent":{const N=o(R,10);return{op:"lte",value:j(N)}}case"topN":{const N=Math.max(1,Math.floor(R)||1),$=Math.max(0,S.sorted.length-N);return{op:"gte",value:S.sorted[$]}}case"bottomN":{const N=Math.max(1,Math.floor(R)||1),$=Math.min(S.sorted.length-1,N-1);return{op:"lte",value:S.sorted[$]}}case"aboveMean":return{op:"gt",value:S.mean};case"belowMean":return{op:"lt",value:S.mean};case"aboveMedian":return{op:"gt",value:S.median};case"belowMedian":return{op:"lt",value:S.median};case"zAbove":return S.stddev?{op:"gte",value:S.mean+(Number.isFinite(R)?R:2)*S.stddev}:null;case"zBelow":return S.stddev?{op:"lte",value:S.mean-(Number.isFinite(R)?R:2)*S.stddev}:null;case"outlier":{const N=(Number.isFinite(R)&&R>0?R:1.5)*S.iqr;return S.iqr?{op:"outside",value:S.q1-N,value2:S.q3+N}:null}default:return null}}function o(A,S){const R=Number.isFinite(A)?A:S,j=R>1?R/100:R;return Math.max(0,Math.min(1,j))}function t(A,S){if(A.from==="minmax")return{...A,min:S.min,max:S.max};if(A.from==="quantile")return{...A,min:b(S.sorted,o(Number(A.low),5)),max:b(S.sorted,o(Number(A.high),95))};if(A.from==="stddev"){const R=Number.isFinite(Number(A.deviations))?Number(A.deviations):2;return{...A,min:S.mean-R*S.stddev,max:S.mean+R*S.stddev}}return A}function r(A,S){const R=Array.isArray(A)?A:[];return!S||!S.n?R.map(j=>j&&a([j])?{...j,enabled:!1}:j):R.map(j=>{if(!j||typeof j!="object")return j;if(j.scale&&j.scale.from)return{...j,scale:t(j.scale,S)};if(j.dataBar)return{...j,dataBar:s(j.dataBar,S)};if(j.iconSet)return{...j,iconSet:i(j.iconSet,S)};if(!j.when||!Q.includes(j.when.op))return j;const N=g(j.when,S);return N?{...j,when:N}:{...j,enabled:!1}})}function s(A,S){const R=Number.isFinite(Number(A.min))?Number(A.min):void 0,j=Number.isFinite(Number(A.max))?Number(A.max):void 0;if(R!==void 0&&j!==void 0)return{...A,min:R,max:j};if(A.from==="quantile")return{...A,min:R??b(S.sorted,o(Number(A.low),5)),max:j??b(S.sorted,o(Number(A.high),95))};if(A.from==="stddev"){const N=Number.isFinite(Number(A.deviations))?Number(A.deviations):2;return{...A,min:R??S.mean-N*S.stddev,max:j??S.mean+N*S.stddev}}return{...A,min:R??S.min,max:j??S.max}}function i(A,S){if(Array.isArray(A.thresholds))return A;const R=n(A),j=[];for(let N=1;N<R;N++)j.push(b(S.sorted,N/R));return{...A,thresholds:j}}function n(A){if(Array.isArray(A.icons)&&A.icons.length>=2)return A.icons.length;if(Number.isFinite(Number(A.count))&&Number(A.count)>=2)return Math.floor(Number(A.count));const S=y[A.set];return S?S.length:3}function m(A){return`url("data:image/svg+xml,${encodeURIComponent(A)}")`}function c(A){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="${A}"/></svg>`}function l(A,S){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><polygon points="${S==="up"?"8,2 14,13 2,13":S==="down"?"2,3 14,3 8,14":"4,2 14,8 4,14"}" fill="${A}"/></svg>`}function u(A,S){const R="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 j=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${S*16} 16">`;for(let N=0;N<S;N++){const $=N<A?"#f5a623":"#d0d0d0";j+=`<path transform="translate(${N*16},0)" d="${R}" fill="${$}"/>`}return`${j}</svg>`}const f=Object.freeze([l("#c0392b","down"),l("#e0a800","right"),l("#2e7d32","up")]),p=Object.freeze([c("#d13438"),c("#f5a623"),c("#2e9e44")]),y=Object.freeze({arrows:f,trafficLights:p,ratings:Object.freeze([1,2,3,4,5].map(A=>u(A,5)))}),h=Object.freeze({arrows:"Arrows",trafficLights:"Traffic lights",ratings:"Ratings"});function d(A){if(Array.isArray(A.icons)&&A.icons.length>=2)return A.icons.map(j=>/^\s*(url\(|data:|<)/.test(String(j))&&String(j).trim().startsWith("<")?m(String(j)):String(j));const S=A.set||"arrows";if(S==="ratings"){const j=n(A),N=[];for(let $=1;$<=j;$++)N.push(m(u($,j)));return N}const R=y[S];return R?R.map(m):(I(`iconSet:${S}`,`unknown icon set '${S}'; falling back to arrows.`),f.map(m))}function w(A){const S=Number(A.min),j=Number(A.max)-S,N=A.colour||A.color||"#5b9bd5",$=A.negativeColour||A.negativeColor||"#d13438",_=A.direction==="rtl"?"left":"right",Y=J=>Math.max(0,Math.min(1,(J-S)/j))*100,Z=j?Math.max(0,Math.min(100,(0-S)/j*100)):0;return J=>{if(q(J))return null;const D=Number(J);if(!Number.isFinite(D)||!j)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 ${_}, transparent ${z}%, ${ne} ${z}%, ${ne} ${X}%, transparent ${X}%)`,backgroundRepeat:"no-repeat",backgroundPosition:"0 0"}}}function v(A){const S=d(A),R=A.reverse?[...S].reverse():S,j=(Array.isArray(A.thresholds)?A.thresholds:[]).map(Number).filter(Number.isFinite),N=Number.isFinite(Number(A.size))?Number(A.size):16,$=A.set==="ratings"?N*n(A):N;return _=>{if(q(_))return null;const Y=Number(_);if(!Number.isFinite(Y))return null;let Z=0;for(const D of j)Y>=D&&Z++;const J=R[Math.min(Z,R.length-1)];return J?{backgroundImage:J,backgroundRepeat:"no-repeat",backgroundPosition:"left center",backgroundSize:`${$}px ${N}px`,paddingLeft:`${$+4}px`}:null}}function P(A){const S=Array.isArray(A.colours)&&A.colours.length>=2?A.colours:["#f8f9fa","#1a6bc7"],R=Number(A.min),j=Number(A.max),N=j-R,$=S.length-1,_=[];for(let Z=0;Z<=$;Z++)_.push($?Z/$:0);const Y=Number(A.mid);if(A.mid!==void 0&&A.mid!==null)if(S.length%2===0)I("formatting.scale.mid.even",`a scale's "mid" needs an odd number of colours (a middle stop to pin); ${S.length} were given, so "mid" was ignored.`);else if(Number.isFinite(Y)&&N&&Y>Math.min(R,j)&&Y<Math.max(R,j)){const Z=$/2,J=Math.max(0,Math.min(1,(Y-R)/N));for(let D=0;D<=$;D++)_[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-R)/N));let te=0;for(;te<$-1&&D>_[te+1];)te++;const z=_[te+1]-_[te],X=z>0?(D-_[te])/z:0;return{background:O(S[te],S[te+1],Math.max(0,Math.min(1,X)))}}}function G(A,S=null){const R=a(A)?r(A,S):A,j=(Array.isArray(R)?R:[]).filter(_=>_&&typeof _=="object");if(!j.length)return()=>null;const N=j.map(_=>_.scale?{scale:P(_.scale),enabled:_.enabled!==!1}:_.dataBar?{scale:w(_.dataBar),enabled:_.enabled!==!1}:_.iconSet?{scale:v(_.iconSet),enabled:_.enabled!==!1}:{when:_.when,style:_.style,stop:_.stopIfTrue!==!1,enabled:_.enabled!==!1}),$=V(N)?T():null;return(_,Y)=>{const Z=_?_.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(!M(Z,D.when))continue;let te;const z=E(D.style);if(z?Y&&$?(te=D.style($.enter(_)),$.mode>Y.mode&&(Y.mode=$.mode)):te=D.style(_):te=D.style,te&&(J=J?{...J,...te}:z?te:{...te}),D.stop)break}return J}}function V(A){return A.some(S=>S.enabled&&!S.scale&&E(S.style))}const K=new Set(["value","colId","column"]),H=new Set(["row","data","index"]);function T(){let A={};const S={mode:0,enter(N){return A=N||{},S.mode=0,j}},R=N=>{if(K.has(N))return;const $=H.has(N)?1:2;$>S.mode&&(S.mode=$)},j=new Proxy({},{get(N,$){return R($),A[$]},has(N,$){return R($),$ in A},set(N,$,_){return S.mode=2,A[$]=_,!0},ownKeys(){return S.mode=2,Reflect.ownKeys(A)},getOwnPropertyDescriptor(N,$){S.mode=2;const _=Object.getOwnPropertyDescriptor(A,$);return _?{value:A[$],enumerable:_.enumerable,configurable:!0,writable:!0}:void 0}});return S}}),He("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 M}}),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 r}});const ie="num",E="str",W="ref",I="name",x="op",Q="end",U=["<=",">=","<>","!="],L="+-*/^%(),<>=";class q extends Error{constructor(i,n){super(i),this.name="FormulaError",this.at=n}}function M(s){const i=[];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,i);continue}if(m==="."&&s[n+1]>="0"&&s[n+1]<="9"){n=k(s,n,i);continue}if(m==='"'||m==="'"){n=b(s,n,i);continue}if(m==="["){const l=s.indexOf("]",n+1);if(l<0)throw new q("a [column reference] was opened and never closed",n);i.push({kind:W,value:s.slice(n+1,l).trim(),at:n}),n=l+1;continue}if(O(m)){n=a(s,n,i);continue}const c=s.slice(n,n+2);if(U.includes(c)){i.push({kind:x,value:c==="!="?"<>":c,at:n}),n+=2;continue}if(L.includes(m)){i.push({kind:x,value:m,at:n}),n++;continue}throw new q(`unexpected character ${JSON.stringify(m)}`,n)}return i.push({kind:Q,value:null,at:s.length}),i}function O(s){return/[A-Za-z_À-]/.test(s)}function k(s,i,n){let m=i,c=!1;for(;m<s.length;){const l=s[m];if(l>="0"&&l<="9"){m++;continue}if(l==="."&&!c){c=!0,m++;continue}if((l==="e"||l==="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(i,m)),at:i}),m}function b(s,i,n){const m=s[i];let c=i+1,l="";for(;c<s.length;){if(s[c]===m){if(s[c+1]===m){l+=m,c+=2;continue}return n.push({kind:E,value:l,at:i}),c+1}l+=s[c],c++}throw new q("a string was opened and never closed",i)}function a(s,i,n){let m=i;for(;m<s.length&&/[A-Za-z0-9_.À-]/.test(s[m]);)m++;const c=s.slice(i,m);let l=m;for(;l<s.length&&s[l]===" ";)l++;return n.push({kind:s[l]==="("?I:W,value:c,at:i}),m}const g={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function o(s){const i=String(s??"").replace(/^\s*=/,"");if(!i.trim())throw new q("the formula is empty");const n=M(i);let m=0;const c=()=>n[m],l=()=>n[m++],u=v=>{const P=c();if(P.kind!==x||P.value!==v)throw new q(`expected ${JSON.stringify(v)}`,P.at);m++},f=v=>{let P=p();for(;;){const G=c();if(G.kind!==x)break;const V=g[G.value];if(!V||V<v)break;m++;const K=f(G.value==="^"?V:V+1);P={kind:"bin",op:G.value,left:P,right:K}}return P},p=()=>{const v=c();return v.kind===x&&(v.value==="-"||v.value==="+")?(m++,{kind:"unary",op:v.value,arg:p()}):y()},y=()=>{let v=h();for(;c().kind===x&&c().value==="%";)m++,v={kind:"unary",op:"%",arg:v};return v},h=()=>{const v=l();if(v.kind===ie)return{kind:"num",value:v.value};if(v.kind===E)return{kind:"str",value:v.value};if(v.kind===W)return{kind:"ref",name:v.value};if(v.kind===I){u("(");const P=[];if(!(c().kind===x&&c().value===")"))for(;;){if(P.push(f(1)),c().kind===x&&c().value===","){m++;continue}break}return u(")"),{kind:"call",name:String(v.value).toUpperCase(),args:P}}if(v.kind===x&&v.value==="("){const P=f(1);return u(")"),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=c();if(w.kind!==Q)throw new q(`unexpected ${JSON.stringify(w.value)}: is an operator missing?`,w.at);return d}function t(s){const i=new Set,n=m=>{if(!(!m||typeof m!="object")){if(m.kind==="ref"){i.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 c of m.args)n(c)}};return n(s),[...i]}function r(s){return typeof s=="string"&&/^\s*=/.test(s)&&s.trim()!=="="}}),He("packages/core/src/formula/evaluate.js",function(e,F){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return k}});const E=F("packages/core/src/formula/parse.js").FormulaError;function W(b){if(b==null||b==="")return 0;if(typeof b=="boolean")return b?1:0;if(b instanceof Date)return b.getTime();const a=typeof b=="number"?b:Number(String(b).replace(/[,\s]/g,""));if(!Number.isFinite(a))throw new E(`${JSON.stringify(b)} is not a number`);return a}function I(b){return b==null?"":String(b)}function x(b){if(typeof b=="boolean")return b;if(b==null||b==="")return!1;if(typeof b=="number")return b!==0;const a=String(b).trim().toLowerCase();return a==="false"||a==="no"||a==="0"?!1:a!==""}function Q(b){const a=[];for(const g of b){if(Array.isArray(g)){for(const o of g)o!=null&&o!==""&&a.push(W(o));continue}g==null||g===""||a.push(W(g))}return a}function U(b,a){const g=10**a,o=b*g;return Math.sign(o)*Math.round(Math.abs(o)+Number.EPSILON*Math.abs(o))/g}function L(b,a){if(!b.length)return 0;const g=b.slice().sort((s,i)=>s-i),o=(g.length-1)*Math.min(1,Math.max(0,a)),t=Math.floor(o),r=Math.ceil(o);return t===r?g[t]:g[t]+(o-t)*(g[r]-g[t])}function q(b,a){let g=0,o=0,t=0;for(const s of b){g++;const i=s-o;o+=i/g,t+=i*(s-o)}const r=a?g-1:g;return r>0?Math.sqrt(t/r):0}const M={SUM:b=>Q(b).reduce((a,g)=>a+g,0),AVERAGE:b=>{const a=Q(b);return a.length?a.reduce((g,o)=>g+o,0)/a.length:0},MIN:b=>{const a=Q(b);return a.length?Math.min(...a):0},MAX:b=>{const a=Q(b);return a.length?Math.max(...a):0},COUNT:b=>Q(b).length,PRODUCT:b=>Q(b).reduce((a,g)=>a*g,1),ROUND:b=>U(W(b[0]),b.length>1?W(b[1]):0),ROUNDDOWN:b=>{const a=10**(b.length>1?W(b[1]):0),g=W(b[0])*a;return(g<0?Math.ceil(g):Math.floor(g))/a},ROUNDUP:b=>{const a=10**(b.length>1?W(b[1]):0),g=W(b[0])*a;return(g<0?Math.floor(g):Math.ceil(g))/a},ABS:b=>Math.abs(W(b[0])),FLOOR:b=>Math.floor(W(b[0])),CEILING:b=>Math.ceil(W(b[0])),SQRT:b=>Math.sqrt(W(b[0])),POWER:b=>W(b[0])**W(b[1]),MOD:b=>{const a=W(b[1]);if(a===0)throw new E("MOD by zero");return(W(b[0])%a+a)%a},IF:b=>x(b[0])?b[1]:b.length>2?b[2]:!1,AND:b=>b.every(x),OR:b=>b.some(x),NOT:b=>!x(b[0]),COALESCE:b=>b.find(a=>a!=null&&a!=="")??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?W(b[1]):1),RIGHT:b=>{const a=b.length>1?W(b[1]):1;return a<=0?"":I(b[0]).slice(-a)},MEDIAN:b=>L(Q(b),.5),PERCENTILE:b=>{const a=W(b[b.length-1]);return L(Q(b.slice(0,-1)),a>1?a/100:a)},QUARTILE1:b=>L(Q(b),.25),QUARTILE3:b=>L(Q(b),.75),STDEV:b=>q(Q(b),!0),STDEVP:b=>q(Q(b),!1),VAR:b=>{const a=q(Q(b),!0);return a*a},VARP:b=>{const a=q(Q(b),!1);return a*a},COUNTDISTINCT:b=>{const a=new Set;for(const g of b){const o=Array.isArray(g)?g:[g];for(const t of o)t!=null&&t!==""&&a.add(t)}return a.size},IQR:b=>{const a=Q(b);return L(a,.75)-L(a,.25)}};M.AVG=M.AVERAGE,M.CEIL=M.CEILING,M.POW=M.POWER,M.STDEVS=M.STDEV,M.PERCENTILEINC=M.PERCENTILE;function O(b,a){const g=Number(b),o=Number(a);if(b!==null&&b!==""&&a!==null&&a!==""&&Number.isFinite(g)&&Number.isFinite(o))return g<o?-1:g>o?1:0;const r=I(b).toLowerCase(),s=I(a).toLowerCase();return r<s?-1:r>s?1:0}function k(b,a={}){const g=typeof a.lookup=="function"?a.lookup:null,o=a.functions?{...M,...a.functions}:M,t=r=>{switch(r.kind){case"num":return r.value;case"str":return r.value;case"ref":{if(!g)throw new E(`there is no column called ${JSON.stringify(r.name)} here`);const s=g(String(r.name));if(s===void 0)throw new E(`there is no column called ${JSON.stringify(r.name)}`);return s}case"unary":{if(r.op==="%")return W(t(r.arg))/100;const s=W(t(r.arg));return r.op==="-"?-s:s}case"bin":{const s=r.op;if(s==="=")return O(t(r.left),t(r.right))===0;if(s==="<>")return O(t(r.left),t(r.right))!==0;if(s==="<")return O(t(r.left),t(r.right))<0;if(s==="<=")return O(t(r.left),t(r.right))<=0;if(s===">")return O(t(r.left),t(r.right))>0;if(s===">=")return O(t(r.left),t(r.right))>=0;const i=W(t(r.left)),n=W(t(r.right));if(s==="+")return i+n;if(s==="-")return i-n;if(s==="*")return i*n;if(s==="^")return i**n;if(s==="/"){if(n===0)throw new E("division by zero");return i/n}throw new E(`unknown operator ${JSON.stringify(s)}`)}case"call":{const s=a.lazy&&a.lazy[r.name];if(typeof s=="function")return s(r.args,t,a);const i=o[r.name];if(typeof i!="function")throw new E(`there is no function called ${r.name}`);return i(r.args.map(t),a)}default:throw new E("the formula could not be read")}};return t(b)}}),He("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 W}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return O}});const ie=F("packages/core/src/formula/parse.js"),E=ie.parseFormula,W=ie.referencesOf,I=ie.looksLikeFormula,x=ie.FormulaError,Q=ie.tokenise,U=F("packages/core/src/formula/evaluate.js"),L=U.evaluateAst,q=U.FUNCTIONS;function M(k){const{grid:b,row:a,data:g}=k||{},o=n=>String(n).toLowerCase().replace(/[\s_-]/g,""),t=b&&b.columns&&typeof b.columns.all=="function"?b.columns.all():[],r=b&&b.permissions,s=r&&typeof r.isReadable=="function"?n=>r.isReadable(n):()=>!0,i=new Set;for(const n of t)s(n)||(i.add(o(n.id)),n.field&&i.add(o(n.field)),n.title&&i.add(o(n.title)));return n=>{const m=o(n);if(i.has(m))throw new x(`"${n}" cannot be read`);for(const c of t)if(o(c.id)===m||c.field&&o(c.field)===m||c.title&&o(c.title)===m)return a&&b.rows&&typeof b.rows.value=="function"?b.rows.value(a.key,c.id):g?g[c.field||c.id]:void 0;if(g&&typeof g=="object"){for(const c of Object.keys(g))if(o(c)===m){if(!s(c))throw new x(`"${n}" cannot be read`);return g[c]}}}}function O(k,b={}){try{const a=E(k);return{ok:!0,value:L(a,{lookup:M(b),functions:b.formulaFunctions}),references:W(a)}}catch(a){return{ok:!1,error:a instanceof x?a.message:"the formula could not be read",at:a instanceof x?a.at:void 0}}}}),He("packages/core/src/internal/version.js",function(e,F){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return W}});const ie="1.117.2";async function E(){return ie}const W="1.117.2"}),He("packages/core/src/internal/merge.js",function(e,F){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return W}}),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 W(L,q,M){if(L!==void 0)return L===!0?{enabled:!0,...M}:L===!1?{enabled:!1}:E(L)?L:{[q]:L,enabled:!0}}function I(L){return L==null?[]:Array.isArray(L)?L:[L]}const x=Object.freeze(new Set(["__proto__","constructor","prototype"]));function Q(L,q){if(!E(L))return E(q)?{...q}:q;if(!E(q))return q===void 0?L:q;const M={...L};for(const O of Object.keys(q)){if(x.has(O))continue;const k=q[O];k!==void 0&&(M[O]=E(k)&&E(M[O])?Q(M[O],k):k)}return M}function U(L,q){if(!E(L)||!E(q)||L===q)return q;const M=Object.create(Object.getPrototypeOf(L));return Object.assign(M,L,q),M}}),He("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 W}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return U}});function ie(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const E=typeof requestAnimationFrame=="function";function W(L){return E?requestAnimationFrame(L):setTimeout(()=>L(ie()),16)}function I(L){L!=null&&(E?cancelAnimationFrame(L):clearTimeout(L))}function x(L){let q=null,M=null;const O=()=>{q=null;const b=M;M=null,L(...b||[])},k=(...b)=>{M=b,q===null&&(q=W(O))};return k.cancel=()=>{I(q),q=null,M=null},k.flush=()=>{q!==null&&(I(q),O())},k}function Q(L,q){let M=null,O=null;const k=()=>{if(M=null,O===null)return;const g=O;O=null,L(...g),b()},b=()=>{M=setTimeout(k,q),typeof M?.unref=="function"&&M.unref()},a=(...g)=>{M===null?(L(...g),b()):(O=g,clearTimeout(M),b())};return a.flush=()=>{if(M!==null&&clearTimeout(M),M=null,O===null)return;const g=O;O=null,L(...g)},a.cancel=()=>{M!==null&&clearTimeout(M),M=null,O=null},a.pending=()=>M!==null||O!==null,a}function U(L,q=50){return typeof requestIdleCallback=="function"?requestIdleCallback(L,{timeout:q}):setTimeout(()=>L({timeRemaining:()=>0,didTimeout:!0}),1)}}),He("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 x}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return Q}});const ie=new Map;function E(U){let L=ie.get(U);if(L)return L;if(!U.includes("."))L=q=>q?.[U];else{const q=U.split("."),M=q.length;L=O=>{let k=O;for(let b=0;b<M;b++){if(k==null)return;k=k[q[b]]}return k}}return ie.set(U,L),L}const W=new Map;function I(U){let L=W.get(U);if(L)return L;if(!U.includes("."))L=(q,M)=>{q!=null&&(q[U]=M)};else{const q=U.split("."),M=q.length-1;L=(O,k)=>{let b=O;for(let a=0;a<M;a++){if(b==null)return;const g=q[a];b[g]==null&&(b[g]={}),b=b[g]}b!=null&&(b[q[M]]=k)}}return W.set(U,L),L}function x(U,L){return E(L)(U)}function Q(U,L,q){I(L)(U,q)}}),He("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 W}});const ie=new Map;function E(I,x){const Q=`${I||""}|${x?JSON.stringify(x):""}`;let U=ie.get(Q);return U||(U=new Intl.Collator(I||void 0,{numeric:!0,sensitivity:"variant",...x}),ie.set(Q,U)),U}function W(I,x){if(I===x)return 0;if(I==null)return 1;if(x==null)return-1;if(typeof I=="number"&&typeof x=="number")return Number.isNaN(I)?Number.isNaN(x)?0:1:Number.isNaN(x)||I<x?-1:I>x?1:0;const Q=String(I),U=String(x);return Q<U?-1:Q>U?1:0}}),He("packages/core/src/defaults.js",function(e,F){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return O}});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 L extends Error{}function q(k,b=new Set){if(Array.isArray(k)){if(b.has(k))throw new L;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 L;b.add(k);const a={};for(const[g,o]of Object.entries(k))a[g]=q(o,b);return b.delete(k),a}function M(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 L))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 O(k){return U===null?k:I(q(U),k)}}),He("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(W="l"){return`${W}${(++ie).toString(36)}`}}),He("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 W}});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 W(I){return I==="*"||E.has(I)}}),He("packages/core/src/events/bus.js",function(e,F){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return g}});const ie=F("packages/core/src/internal/warn.js"),E=ie.warnOnce,W=ie.DEV,x=F("packages/core/src/internal/uid.js").uid,U=F("packages/core/src/events/names.js").isKnownEvent,L="*";function q(o,t){!W||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 M=new Set(["api","user","init","ai"]),O=new WeakMap;function k(o){let t=O.get(o);return t||(t=x("h"),O.set(o,t)),t}function b(){return typeof performance=="object"&&performance?performance.now():Date.now()}function a(o){if(!o||typeof o!="object")return{};const t={};for(const[r,s]of Object.entries(o))r!=="grid"&&(s==null?t[r]=String(s):Array.isArray(s)?t[r]=`[${s.length}]`:typeof s=="object"?t[r]=s.key?`row ${s.key}`:"{…}":typeof s=="function"?t[r]="[function]":t[r]=String(s).slice(0,60));return t}class g{#e=new Map;#t=!1;#n=[];#r=200;#i=new Map;#s=null;#o=!1;#l=0;constructor(t=null){this.#s=t}attach(t){this.#s=t}get grid(){return this.#s}get destroyed(){return this.#o}on(t,r){if(typeof r!="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(r),()=>this.off(t,r)}once(t,r){if(typeof r!="function")return E(`bus.handler:${t}`,`once('${t}') needs a function; ignored.`),()=>{};q("once",t);const s=i=>{this.off(t,r),r(i)};return this.#i.set(r,s),this.on(t,s)}off(t,r){if(r===void 0){this.#e.delete(t);return}const s=this.#e.get(t);if(!s)return;const i=this.#i.get(r),n=i&&s.includes(i)?i:r,m=s.indexOf(n);m>=0&&s.splice(m,1),i&&n===i&&this.#i.delete(r),s.length===0&&this.#e.delete(t)}count(t){const r=this.#e.get(t),s=t===L?null:this.#e.get(L);return(r?r.length:0)+(s?s.length:0)}#a(t,r,s,i,n){this.#n.push({type:t,origin:r,listeners:(i?i.length:0)+(n?n.length:0),payload:a(s),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(t,r){this.#t=!!t,Number.isFinite(r)&&r>0&&(this.#r=Math.floor(r)),t||(this.#n=[])}eventLog(){return this.#n.map(t=>({...t}))}clearEventLog(){this.#n=[]}counts(){const t={};for(const[r,s]of this.#e)t[r]=s.length;return t}emit(t,r,s){const i=s??(r&&r.origin),n=M.has(i)?i:"api",m={...r||null,type:t,origin:n,grid:this.#s};if(this.#o)return m;const c=this.#e.get(t),l=t===L?void 0:this.#e.get(L);if(this.#t&&this.#a(t,n,r,c,l),!c&&!l)return m;const u=this.#t?b():0;this.#l++;try{c&&this.#c(c.slice(),m,t),l&&this.#c(l.slice(),m,L)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=b()-u)}return m}emitBefore(t,r,s){const i=s??(r&&r.origin),n=M.has(i)?i:"user";let m=!1,c=null;const l=d=>{m=!0,d!=null&&c===null&&(c=String(d))},u={...r||null,type:t,origin:n,grid:this.#s,get defaultPrevented(){return m},get reason(){return c},preventDefault(d){l(d)}};if(this.#o)return!0;const f=this.#e.get(t);this.#t&&this.#a(t,n,r,f,void 0);const p=f?f.slice():[];if(p.length===0)return!0;const y=()=>(m&&c===null&&(c="prevented"),m&&r&&typeof r=="object"&&(r.reason=c),!m),h=[];for(const d of p)try{const w=d(u);w&&typeof w.then=="function"?h.push(w):w===!1&&l("prevented")}catch(w){l("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"?(l("error"),E(`bus.beforeReject:${t}`,`a '${t}' before-handler rejected; the action was cancelled.`,w.reason)):w.value===!1&&l("prevented");return y()})}#c(t,r,s){for(let i=0;i<t.length;i++)try{t[i](r)}catch(n){E(`bus.throw:${s}:${k(t[i])}`,`a '${s}' handler threw; other handlers were unaffected.`,n)}}clear(){this.#e.clear(),this.#i.clear()}destroy(){this.clear(),this.#o=!0,this.#s=null}}}),He("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"}),He("packages/core/src/registry/licence.js",function(e,F){"use strict";Object.defineProperty(e,"PRODUCT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"LICENCE_VERSION",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return 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 a}}),Object.defineProperty(e,"parseLicence",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"hasEd25519",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"verifyLicence",{enumerable:!0,get:function(){return u}}),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 G}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return T}});const E=F("packages/core/src/internal/warn.js").warnOnce,W=F("packages/core/src/registry/free-tier-notice.js"),I=W.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return W.FREE_TIER_NOTICE}});const x="lattice-grid",Q=1,U="LG1",L=64,q="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",O=(()=>{const A=new Int16Array(128).fill(-1);for(let S=0;S<M.length;S++)A[M.charCodeAt(S)]=S;return A[43]=62,A[47]=63,A})();function k(A){if(typeof A!="string")return null;let S="";for(let Y=0;Y<A.length;Y++){const Z=A.charCodeAt(Y);if(Z!==61){if(Z>127||O[Z]<0)return null;S+=A[Y]}}const R=S.length;if(R%4===1)return null;const j=new Uint8Array(Math.floor(R*3/4));let N=0,$=0,_=0;for(let Y=0;Y<R;Y++)N=N<<6|O[S.charCodeAt(Y)],$+=6,$>=8&&($-=8,j[_++]=N>>$&255);return _===j.length?j:j.subarray(0,_)}function b(A){let S="",R=0;for(;R+2<A.length;R+=3){const N=A[R]<<16|A[R+1]<<8|A[R+2];S+=M[N>>18&63]+M[N>>12&63]+M[N>>6&63]+M[N&63]}const j=A.length-R;if(j===1){const N=A[R]<<16;S+=M[N>>18&63]+M[N>>12&63]}else if(j===2){const N=A[R]<<16|A[R+1]<<8;S+=M[N>>18&63]+M[N>>12&63]+M[N>>6&63]}return S}function a(A){const S=new Uint8Array(A.length);for(let R=0;R<A.length;R++)S[R]=A.charCodeAt(R)&127;return S}function g(A){if(typeof TextDecoder=="function")return new TextDecoder().decode(A);let S="";for(let R=0;R<A.length;R++)S+=String.fromCharCode(A[R]);return S}function o(A){const S={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof A=="string"?A:""};if(typeof A!="string"||A.length===0)return{...S,reason:"missing"};const R=A.trim(),j=R.split(".");if(j.length!==3)return S;const[N,$,_]=j;if(N!==U)return{...S,reason:"prefix"};const Y=k($),Z=k(_);if(!Y||!Z)return S;let J;try{J=JSON.parse(g(Y))}catch{return S}return J===null||typeof J!="object"?S:{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:a($),signature:Z,raw:R}}function t(A,S){if(!A)return!1;const R=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(A)?`${A}T23:59:59.999Z`:A);return Number.isNaN(R)?!0:S>R}function r(A){return A==="non-commercial"?"non-commercial":"commercial"}let s=null,i=null,n=null;function m(){const A=globalThis.crypto;return A&&A.subtle?A.subtle:null}async function c(A){if(s&&i===A)return s;const S=m();if(!S)return null;const R=k(A);if(!R)return null;try{const j=await S.importKey("raw",R,{name:"Ed25519"},!1,["verify"]);return s=j,i=A,j}catch{return null}}async function l(){return n!==null||(n=await c(q)!==null),n}async function u(A,S={}){const R=S.warn!==!1,j=S.product||x,N=S.publicKey||q,$=S.now??Date.now(),_=S.host??p(),Y=f(_)?"":` ${I}`,Z=o(A);if(!Z.ok){const X=Z.reason==="missing"?"missing":"malformed";return R&&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:r(Z.terms)};if(Z.product!==j)return R&&E("licence.product",`licence key is for '${Z.product}', not '${j}'. The grid will render with a watermark.`),{valid:!1,...J,reason:"product"};if(t(Z.expires,$))return R&&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&&_&&!f(_)&&!y(_,D))return R&&E("licence.domain",`licence key is not valid for ${_}; it covers ${D.join(", ")}. The grid will render with a watermark.`),{valid:!1,...J,reason:"domain"};const te=await c(N);if(!te){const X=!!Z.signature&&Z.signature.length===L;return R&&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}:(R&&E("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...J,reason:"signature"})}function f(A){const S=String(A??p()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!S||S==="localhost"||S.endsWith(".localhost")||S==="::1"||S==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(S)}function p(){const A=globalThis.location;return A&&typeof A.hostname=="string"?A.hostname:null}function y(A,S){const R=h(A);return!R||!Array.isArray(S)?!1:S.some(j=>{const N=h(j);if(!N)return!1;if(N==="*")return!0;if(N.startsWith("*.")){const $=N.slice(2);return R===$||R.endsWith(`.${$}`)}return R===N})}function h(A){return String(A??"").trim().toLowerCase().replace(/\.$/,"")}class d{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#i;#s=new Set;constructor(S={}){this.#i=S}set(S){this.#e=typeof S=="string"?S.trim():"";const R=o(this.#e);return this.#t=R.ok?{valid:!t(R.expires,Date.now())&&R.product===(this.#i.product||x),product:R.product||void 0,issuedTo:R.issuedTo||void 0,expires:R.expires||void 0,terms:r(R.terms),reason:"pending"}:{valid:!1,reason:R.reason||"malformed",terms:"commercial"},this.#n=null,this.#e&&this.verify(),this.#t}verify(){if(this.#n)return this.#n;const S=this.#e;return this.#n=u(S,this.#i).then(R=>{if(this.#e===S){this.#t=R;for(const j of this.#s)j(R)}return R}),this.#n}onSettled(S){return this.#s.add(S),()=>this.#s.delete(S)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!f(this.#r)}setHost(S){this.#r=S}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 A=globalThis,S=A&&A[w];if(S&&typeof S.set=="function"&&typeof S.watermark=="function")return S;const R=new d;if(A)try{A[w]=R}catch{}return R}const P=v();function G(A){return P.set(A)}function V(){return P.info()}function K(){return P.watermark()}function H(){return P.state()}function T(){return P}}),He("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 M}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return s}});const ie=F("packages/core/src/internal/warn.js"),E=ie.warnOnce,W=ie.DEV,x=F("packages/core/src/internal/predicates.js").isFunction,Q=F("packages/core/src/registry/licence.js"),U=Q.LicenceHolder,L=Q.sharedLicence,q=["renderer","editor","filter","dataType","totalFn","pipe","component"],M=["all","header","body","totals","panels"];class O{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#i;#s=null;#o=null;#l=new Set;#a=new Map;constructor(n={}){for(const m of q)this.#t.set(m,new Map);this.#i=n.holder||L(),this.#o=n.grid??null,this.#s=this.#i.onSettled(()=>{this.#f({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),n.licence&&this.setLicence(n.licence)}registerModules(n,m={}){m.licence&&this.setLicence(m.licence),m.grid!==void 0&&(this.#o=m.grid);const c=Array.isArray(n)?n:[n],l=[];for(const u of c){if(!u||typeof u!="object"||typeof u.name!="string"||!u.name){E("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(u.name)){W&&this.#u(this.#e.get(u.name),u);continue}if(!x(u.install)){E(`registry.module.install:${u.name}`,`module '${u.name}' has no install() and was ignored.`);continue}const f={registry:this,grid:this.#o};try{u.install(f)}catch(p){E(`registry.module.throw:${u.name}`,`module '${u.name}' threw during install; it was not registered.`,p);continue}this.#e.set(u.name,u);for(const p of k(u))this.#n.add(p);l.push(u.name),this.#f({reason:"module",name:u.name,capabilities:this.capabilities(),regions:g(u)})}return l}unregisterModule(n){const m=this.#e.get(n);if(!m)return!1;if(x(m.uninstall))try{m.uninstall({registry:this,grid:this.#o})}catch(c){E(`registry.module.uninstall:${n}`,`module '${n}' threw during uninstall.`,c)}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 x(n)?(this.#r.add(n),this.#a.set(n,this.#o),()=>{this.#r.delete(n),this.#a.delete(n)}):()=>{}}#f(n){for(const m of[...this.#r])try{m(n)}catch(c){E("registry.onChange.throw","a registry change handler threw.",c)}}register(n,m,c){const l=this.#t.get(n);if(!l){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}l.has(m)&&l.get(m)!==c&&E(`registry.replace:${n}:${m}`,`'${m}' was already registered as a ${n} and has been replaced.`),l.set(m,c),this.#f({reason:"register",name:m,kind:n,capabilities:this.capabilities(),regions:o(n)})}registerAll(n,m){if(m)for(const c of Object.keys(m))this.register(n,c,m[c])}get(n,m){const c=this.#t.get(n);return c?c.get(m):void 0}names(n){const m=this.#t.get(n);return m?[...m.keys()]:[]}#d(n,m){const c=this.#t.get(n).get(m);return c!==void 0?c:this.#t.get("component").get(m)}renderer(n){return this.#d("renderer",n)}editor(n){return this.#d("editor",n)}filter(n){return this.#d("filter",n)}dataType(n){return this.get("dataType",n)}totalFn(n){return this.get("totalFn",n)}pipe(n){return this.get("pipe",n)}setLicence(n){return this.#i.set(n)}licence(){return this.#i.info()}licenceVerified(){return this.#i.verify()}watermark(){return this.#i.watermark()}attach(n){n!=null&&(this.#l.add(n),this.#o=n)}detach(n){if(n!=null){this.#l.delete(n);for(const[m,c]of[...this.#a])c===n&&(this.#r.delete(m),this.#a.delete(m));if(this.#o===n){const m=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#o=m}this.#l.size===0&&this.#s&&(this.#s(),this.#s=null)}}destroy(n){if(n!=null){this.detach(n);return}for(const m of[...this.#e.keys()])this.unregisterModule(m);this.#r.clear(),this.#a.clear(),this.#l.clear(),this.#s&&this.#s(),this.#s=null,this.#o=null}}function k(i){const n=i.capabilities,m=Array.isArray(n)?n.filter(c=>typeof c=="string"):[];return[i.name,...m]}function b(i,n){return i.install!==n.install||i.uninstall!==n.uninstall||(i.version||"")!==(n.version||"")?!1:a(k(i),k(n))&&a(g(i),g(n))}function a(i,n){const m=new Set(i),c=new Set(n);if(m.size!==c.size)return!1;for(const l of m)if(!c.has(l))return!1;return!0}function g(i){const n=i.regions;return!Array.isArray(n)||n.length===0?["all"]:n.filter(m=>M.includes(m))}function o(i){switch(i){case"filter":return["header"];case"totalFn":return["totals"];case"renderer":case"editor":case"pipe":return["body"];default:return["all"]}}const t=new O;function r(){return t}function s(i,n={}){return t.registerModules(i,n)}}),He("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 W}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return I}});function ie(x){return x?(x.includes(".")?x.slice(x.lastIndexOf(".")+1):x).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,U=>U.toUpperCase()):""}const E={"&":"&","<":"<",">":">",'"':""","'":"'"};function W(x){const Q=x==null?"":String(x);return/[&<>"']/.test(Q)?Q.replace(/[&<>"']/g,U=>E[U]):Q}function I(x){return String(x).replace(/\w\S*/g,Q=>Q[0].toUpperCase()+Q.slice(1).toLowerCase())}}),He("packages/core/src/format/mask.js",function(e,F){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return W}}),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 W(L){const q=[];let M="",O=!1;for(let k=0;k<L.length;k++){const b=L[k];if(b==="\\"){M+=b+(L[k+1]??""),k+=1;continue}if(b==='"'){O=!O,M+=b;continue}if(b===";"&&!O){q.push(M),M="";continue}M+=b}return q.push(M),q}function I(L){let q="",M="",O="",k=1,b=!1,a=!1;const g=l=>{a?M+=l:q+=l};for(let l=0;l<L.length;l++){const u=L[l];if(u==="\\"){g(L[l+1]??""),l+=1;continue}if(u==='"'){const f=L.indexOf('"',l+1);g(f===-1?L.slice(l+1):L.slice(l+1,f)),l=f===-1?L.length:f;continue}if(u==="%"){k*=100,g("%");continue}if(u==="@"){b=!0,g("\0");continue}if(ie.has(u)){O+=u,a=!0;continue}g(u)}let o=-1;for(let l=O.length-1;l>=0;l--){const u=O[l];if(u==="0"||u==="#"||u==="?"){o=l;break}}let t=!1,r="";for(let l=0;l<O.length;l++){const u=O[l];if(u===","){l>o?k/=1e3:t=!0;continue}r+=u}const s=r.indexOf("."),i=s===-1?r:r.slice(0,s),n=s===-1?"":r.slice(s+1);let m=0;for(const l of i)l==="0"&&(m+=1);let c=0;for(const l of n)l==="0"&&(c+=1);return{prefix:q,suffix:M,minInt:m,minDec:c,maxDec:n.length,grouping:t,scale:k,hasNumber:o!==-1,isText:b}}function x(L,q){const M=new Intl.NumberFormat(q,{minimumIntegerDigits:Math.max(L.minInt,1),minimumFractionDigits:L.minDec,maximumFractionDigits:Math.max(L.maxDec,L.minDec),useGrouping:L.grouping}),{prefix:O,suffix:k,scale:b,hasNumber:a}=L;return g=>{if(!a)return O+k;const o=b===1?g:g*b;return O+M.format(o)+k}}function Q(L,q){const O=W(String(L)).map(I),k=O.map(r=>x(r,q)),b=0,a=O.length>1?1:-1,g=O.length>2?2:-1,o=O.length>3?3:-1,t=r=>{if(r==null||r==="")return"";if(typeof r!="number"||Number.isNaN(r)){const s=Number(r);if(Number.isNaN(s))return o===-1?String(r):(O[o].prefix+O[o].suffix).split("\0").join(String(r));r=s}return r===0&&g!==-1?k[g](0):r<0&&a!==-1?k[a](-r):k[b](r)};return t.spec={mask:L},{format:t,ooxml:U(String(L))}}function U(L){return L.trim()}}),He("packages/core/src/format/pattern.js",function(e,F){"use strict";Object.defineProperty(e,"parseNumberPattern",{enumerable:!0,get:function(){return x}});const E=F("packages/core/src/format/mask.js").splitSections;function W(Q){let U="",L="",q="",M="",O=!1,k=!1,b=!1,a=!1;const g=t=>{b?L+=t:U+=t};for(let t=0;t<Q.length;t++){const r=Q[t];if(r==="\\"){g(Q[t+1]??""),t+=1;continue}if(r==='"'){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(r==="%"){k=!0;continue}if(r==="0"||r==="#"){b=!0,a?M+=r:q+=r;continue}if(r===","){a||(O=!0);continue}if(r==="."&&!a){a=!0;continue}g(r)}if(!b)return{hasDigit:!1,prefix:U,suffix:L,minDec:0,maxDec:0,grouping:!1,percent:k};let o=0;for(const t of M)t==="0"&&(o+=1);return{hasDigit:!0,prefix:U,suffix:L,minDec:o,maxDec:M.length,grouping:O,percent:k}}function I(Q,U){const L=U.trim(),q=Q.trim();return L.startsWith("(")&&L.endsWith(")")&&L.slice(1,-1).trim()===q?"parentheses":L.endsWith("-")?"suffix":"minus"}function x(Q){if(typeof Q!="string")return null;const U=E(Q);if(U.length===0)return null;const L=W(U[0]);if(!L.hasDigit)return null;const q={style:L.percent?"percent":"decimal",prefix:L.prefix,suffix:L.suffix,minDecimals:L.minDec,maxDecimals:Math.max(L.maxDec,L.minDec),thousandsSeparator:L.grouping?void 0:!1};if(U.length>1&&(q.negative=I(U[0],U[1])),U.length>2){const M=W(U[2]);M.hasDigit||(q.zeroDisplay=M.prefix+M.suffix)}return q}}),He("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(L,q){const M=typeof L=="string"?{pattern:L}:L||{};let O=M;if(typeof M.pattern=="string"){const v=Q(M.pattern);if(v){const{pattern:P,...G}=M;O={...v,...G}}else I(`format:pattern:${M.pattern}`,`invalid number format pattern "${M.pattern}"; the value will use the default number format`)}const k=O.locale||q||void 0,b=O.style||"decimal",a=typeof O.scale=="number"?O.scale:1,g=O.nullDisplay??"",o=O.zeroDisplay,t=O.prefix||"",r=O.suffix||"",s=O.negative||"minus",i=O.signed===!0,n={style:b,notation:O.notation||"standard"};b==="currency"&&(n.currency=O.currency||"USD",O.currencyDisplay&&(n.currencyDisplay=O.currencyDisplay)),typeof O.decimals=="number"?(n.minimumFractionDigits=O.decimals,n.maximumFractionDigits=O.decimals):(typeof O.minDecimals=="number"&&(n.minimumFractionDigits=O.minDecimals),typeof O.maxDecimals=="number"&&(n.maximumFractionDigits=O.maxDecimals),n.minimumFractionDigits>(n.maximumFractionDigits??20)&&(n.maximumFractionDigits=n.minimumFractionDigits)),O.thousandsSeparator===!1&&(n.useGrouping=!1),n.notation==="compact"&&(n.compactDisplay=O.compactDisplay||"short");const m=new Intl.NumberFormat(k,n),c=typeof O.thousandsSeparator=="string"?O.thousandsSeparator:null,l=typeof O.decimalSeparator=="string"?O.decimalSeparator:null;let u=",",f=".";if(c||l)for(const v of m.formatToParts(12345.6))v.type==="group"?u=v.value:v.type==="decimal"&&(f=v.value);const p=v=>{let P=v;return c&&(P=P.split(u).join("")),l&&(P=P.split(f).join("")),c&&(P=P.split("").join(c)),l&&(P=P.split("").join(l)),P},y=!!(c||l),h=t!==""&&b==="currency",d=v=>{let P;if(h){const G=m.formatToParts(v);let V=!1;P="";for(const K of G)P+=K.value,!V&&K.type==="currency"&&(P+=t,V=!0);V||(P=t+P)}else P=t+m.format(v);return y&&(P=p(P)),P+r},w=v=>{if(E(v)||v==="")return g;const P=typeof v=="number"?v:Number(v);if(Number.isNaN(P))return g;const G=a===1?P:P*a;return G===0&&o!==void 0?o:G<0?s==="parentheses"?`(${d(-G)})`:s==="suffix"?`${d(-G)}-`:d(G):i&&G>0?`+${d(G)}`:d(G)};return w.negativeClass=O.negativeClass||null,w.spec=O,w}}),He("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 L}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return r}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/internal/warn.js").warnOnce,x=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function Q(s){const i=[];let n=0,m="";const c=()=>{m&&(i.push({token:null,text:m}),m="")};for(;n<s.length;){const l=s[n];if(l==="'"){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 u=x.find(f=>s.startsWith(f,n));if(u){c(),i.push({token:u,text:u}),n+=u.length;continue}/[A-Za-z]/.test(l)&&I(`date.pattern.token:${l}`,`the date pattern "${s}" contains '${l}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${x.join(" ")}.`),m+=l,n+=1}return c(),i}const U=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function L(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 i=U.exec(s.trim());if(i){const[,m,c,l,u="0",f="0",p="0"]=i;return new Date(+m,+c-1,+l,+u,+f,+p)}const n=new Date(s);return Number.isNaN(n.getTime())?null:n}return null}function q(s,i){return String(s).padStart(i,"0")}function M(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 i=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 c={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:m.getMilliseconds(),weekday:0};for(const l of i.formatToParts(m))switch(l.type){case"year":c.year=Number(l.value);break;case"month":c.month=Number(l.value);break;case"day":c.day=Number(l.value);break;case"hour":c.hour=Number(l.value)%24;break;case"minute":c.minute=Number(l.value);break;case"second":c.second=Number(l.value);break;case"weekday":c.weekday=n[l.value]??0;break;default:break}return c}}function O(s,i,n){const m=Q(s),c=M(n),l=new Set(m.filter(h=>h.token).map(h=>h.token)),u=l.has("MMM")?new Intl.DateTimeFormat(i,{month:"short",timeZone:n}):null,f=l.has("MMMM")?new Intl.DateTimeFormat(i,{month:"long",timeZone:n}):null,p=l.has("EEE")?new Intl.DateTimeFormat(i,{weekday:"short",timeZone:n}):null,y=l.has("EEEE")?new Intl.DateTimeFormat(i,{weekday:"long",timeZone:n}):null;return h=>{const d=c(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+=u.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,i){const n=s||{},m=n.locale||i||void 0,c=n.nullDisplay??"",l=n.timeZone;let u;if(n.pattern)u=O(n.pattern,m,l);else if(n.dateStyle||n.timeStyle){const d={timeZone:l};n.dateStyle&&(d.dateStyle=n.dateStyle),n.timeStyle&&(d.timeStyle=n.timeStyle);const w=new Intl.DateTimeFormat(m,d);u=v=>w.format(v)}else{const d=new Intl.DateTimeFormat(m,{dateStyle:"medium",timeZone:l});u=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=L(d);if(!v)return c;if(f){const P=w&&typeof w.now=="number"?w.now:Date.now(),G=v.getTime()-P;if(Math.abs(G)<y){for(const[V,K]of k)if(Math.abs(G)>=K||V==="second")return f.format(Math.round(G/K),V)}}return u(v)};return h.spec=n,h}function a(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 c=L(s);return c?a(c):null}const i=L(s);if(!i)return null;const n=m=>String(m).padStart(2,"0");return`${i.getFullYear()}-${n(i.getMonth()+1)}-${n(i.getDate())}`}function g(s,i){if(E(s)||s==="")return null;if(typeof s=="string"){const m=s.trim();if(o.test(m)){const u=L(m);return u?t(u,i):null}const c=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(m);if(c){const[,u,f,p,y]=c;return`${u}T${f}:${p}${y&&y!=="00"?`:${y}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(m))return`${m}T00:00`;const l=L(m);return l?g(l):null}const n=L(s);return n?t(n,i):null}const o=/(?:Z|[+-]\d{2}:?\d{2})$/i;function t(s,i){const n=u=>String(u).padStart(2,"0");if(i)try{const u=new Intl.DateTimeFormat("en-CA",{timeZone:i,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(s).reduce((y,h)=>(h.type!=="literal"&&(y[h.type]=h.value),y),{}),f=u.hour==="24"?"00":u.hour,p=Number(u.second);return`${u.year}-${u.month}-${u.day}T${f}:${u.minute}`+(p?`:${u.second}`:"")}catch{}const m=`${s.getFullYear()}-${n(s.getMonth()+1)}-${n(s.getDate())}`,c=s.getSeconds(),l=`${n(s.getHours())}:${n(s.getMinutes())}${c?`:${n(c)}`:""}`;return`${m}T${l}`}function r(s,i){const n=E(s)||s===""?null:String(s),m=E(i)||i===""?null:String(i);return n===null?m===null?0:1:m===null||n<m?-1:n>m?1:0}}),He("packages/core/src/format/boolean.js",function(e,F){"use strict";Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return Q}});const E=F("packages/core/src/internal/predicates.js").isNil,W={true:"☑",false:"☐",null:""},I={true:"◉",false:"◯",null:""};function x(U){if(E(U)||U==="")return null;if(typeof U=="boolean")return U;if(typeof U=="number")return U!==0;const L=String(U).trim().toLowerCase();return L==="true"||L==="yes"||L==="y"||L==="1"?!0:L==="false"||L==="no"||L==="n"||L==="0"?!1:null}function Q(U,L){const q=U||{},M=q.display||"text",O=q.trueLabel??"Yes",k=q.falseLabel??"No",b=q.nullLabel??"";let a=O,g=k;const o=b;M==="checkbox"?(a=W.true,g=W.false):M==="switch"?(a=I.true,g=I.false):M==="icon"&&(a=q.trueIcon??O,g=q.falseIcon??k);const t=r=>{const s=x(r);return s===null?o:s?a:g};return t.display=M,t.labels={true:O,false:k,null:b},t.locale=L,t.spec=q,t}}),He("packages/core/src/format/text.js",function(e,F){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return x}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/internal/text.js").titleCase;function x(Q,U){const L=Q||{},q=L.locale||U||void 0,M=L.nullDisplay??"",O=L.emptyDisplay??"",k=L.transform||"none",b=typeof L.truncate=="number"?{chars:L.truncate}:L.truncate||null,a=b?b.chars:0,g=b?b.ellipsis??"…":"",o=r=>{switch(k){case"upper":return q?r.toLocaleUpperCase(q):r.toUpperCase();case"lower":return q?r.toLocaleLowerCase(q):r.toLowerCase();case"title":return I(r);default:return r}},t=r=>{if(E(r))return M;let s=typeof r=="string"?r:String(r);return s===""?O:(k!=="none"&&(s=o(s)),a>0&&s.length>a&&(s=s.slice(0,a)+g),s)};return t.spec=L,t}}),He("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 x}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return U}});const ie=["currency","number","percent","date","boolean","text","relative"],E=/[#0?@;"\\]/,W=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function I(L){return typeof L!="string"||L===""||Q(L)?!1:E.test(L)}function x(L){return typeof L!="string"||L===""||Q(L)?!1:W.test(L)}function Q(L){const q=L.indexOf(":"),M=q===-1?L:L.slice(0,q);return ie.includes(M)?M:null}function U(L){const q=Q(L);if(!q)return null;const M=L.indexOf(":"),O=M===-1?"":L.slice(M+1),k=O===""?[]:O.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:O||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const b=O.split("/"),a={type:"boolean",display:"text"};return b[0]!==void 0&&b[0]!==""&&(a.trueLabel=b[0]),b[1]!==void 0&&b[1]!==""&&(a.falseLabel=b[1]),b[2]!==void 0&&(a.nullLabel=b[2]),a}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}}}),He("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,W=ie.isObject,x=F("packages/core/src/internal/warn.js").warnOnce,Q=F("packages/core/src/format/number.js"),U=Q.compileNumber,L=F("packages/core/src/format/date.js"),q=L.compileDate,M=L.scanPattern,O=F("packages/core/src/format/boolean.js"),k=O.compileBoolean,b=F("packages/core/src/format/text.js"),a=b.compileText,g=F("packages/core/src/format/mask.js"),o=g.compileMask,t=F("packages/core/src/format/shorthand.js"),r=t.parseShorthand,s=t.looksLikeMask,i=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 L.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return L.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return L.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return L.toDate}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return O.compileBoolean}}),Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return O.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 c=new Set(["decimal","currency","percent","unit"]),l=new Set(["type","locale"]),u={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(H,T){const A=H.type;if(A===void 0||f.has(A)||!c.has(String(A)))return;const S=T?`"${T}"`:"with no id";x(`format:unknown-style-key:${T||""}:${A}`,`column ${S} has format: { type: "${A}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${A}" instead?`)}function y(H,T,A){const S=u[T],R=A?`"${A}"`:"with no id";for(const j of H){if(l.has(j)||S.has(j))continue;const N=Object.keys(u).find($=>$!==T&&u[$].has(j));N?x(`format:inapplicable:${A||""}:${j}`,`column ${R} has format key "${j}", which applies to a ${N} column, not the ${T} column it was applied to; it is ignored.`):x(`format:unknown:${A||""}:${j}`,`column ${R} has an unrecognised format key "${j}" for its ${T} format; it is ignored.`)}}function h(H){if(H.type==="number"||H.type==="date"||H.type==="boolean"||H.type==="text")return!0;const T=c.has(String(H.style));return!!(H.pattern||H.dateStyle||H.timeStyle||H.relative||H.timeZone||H.trueLabel||H.falseLabel||H.display||H.trueIcon||H.falseIcon||H.transform||H.truncate||H.emptyDisplay||T||H.currency||H.decimals!==void 0||H.minDecimals!==void 0||H.maxDecimals!==void 0||H.notation||H.negative||H.scale!==void 0||H.prefix||H.suffix||H.zeroDisplay!==void 0)}function d(H,T){if(H.type==="number"||H.type==="date"||H.type==="boolean"||H.type==="text")return H.type;if(H.pattern){if(s(H.pattern))return"number";if(i(H.pattern))return"date"}if(H.dateStyle||H.timeStyle||H.relative||H.timeZone)return"date";if(H.trueLabel||H.falseLabel||H.display||H.trueIcon||H.falseIcon)return"boolean";if(H.transform||H.truncate||H.emptyDisplay)return"text";if(H.style||H.currency||H.decimals!==void 0||H.minDecimals!==void 0||H.maxDecimals!==void 0||H.notation||H.negative||H.scale!==void 0||H.prefix||H.suffix||H.zeroDisplay!==void 0)return"number";const A=T&&T.base;return A==="number"?"number":A==="date"||A==="dateString"?"date":A==="boolean"?"boolean":"text"}function w(H,T=null,A=void 0,S=void 0,R=void 0){if(H==null||H==="")return null;const j=W(H)?Object.keys(H):null;if(typeof H=="function"){const _=(Y,Z)=>String(H({...Z||{},value:Y,locale:A})??"");return _.ooxml=T&&T.excel||"General",_}if(typeof H=="string"){if(s(H)){const{format:Y,ooxml:Z}=o(H,A);return Y.ooxml=Z,Y}const _=r(H)||(i(H)?{type:"date",pattern:H}:null);return _?w(_,T,A,S,R):(x(`format:${H}`,`unrecognised format string "${H}"; the value will be stringified`),null)}if(!W(H))return x("format:shape","format must be a spec object or a string; ignoring",H),null;if(T&&E(T.format)&&!h(H)||T&&E(T.format)&&Array.isArray(T.formatPatterns)&&H.type===void 0)return null;const N=d(H,T);N==="date"&&S&&H.timeZone===void 0&&(H={...H,timeZone:S}),p(H,R),y(j||Object.keys(H),N,R);let $;switch(N){case"number":$=U(H,A);break;case"date":$=q(H,A);break;case"boolean":$=k(H,A);break;default:$=a(H,A);break}return $.ooxml=P(H,N,A,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(H,T,A=void 0,S=null){if(T==="date"){if(H.pattern){let _="";for(const Y of M(H.pattern))_+=Y.token?v[Y.token]??Y.text:Y.text;return _}return S&&S.excel||"yyyy-mm-dd"}if(T==="boolean")return"General";if(T==="text")return"@";if(typeof H.pattern=="string"&&m(H.pattern))return String(H.pattern).trim();if(H.notation==="compact"||H.notation==="scientific")return"General";const R=typeof H.decimals=="number"?H.decimals:typeof H.minDecimals=="number"?H.minDecimals:H.style==="currency"?2:0;let N=`${H.thousandsSeparator===!1?"":"#,#"}#0${R>0?`.${"0".repeat(R)}`:""}`,$="";return H.style==="currency"&&($+=G(K(H.currency||"USD",A))),H.prefix&&($+=G(H.prefix)),N=$+N,H.style==="percent"&&(N=`${N}%`),H.suffix&&(N+=G(H.suffix)),H.negative==="parentheses"?`${N};(${N})`:H.negative==="suffix"?`${N};${N}-`:N}function G(H){return`"${String(H).split('"').join("")}"`}const V=new Map;function K(H,T){const A=`${H}|${T||""}`;let S=V.get(A);if(S!==void 0)return S;S=H;try{const j=new Intl.NumberFormat(T,{style:"currency",currency:H}).formatToParts(0).find(N=>N.type==="currency");j&&(S=j.value)}catch{}return V.set(A,S),S}}),He("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 a}}),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 l}}),Object.defineProperty(e,"toTimeMs",{enumerable:!0,get:function(){return u}}),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 G}}),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 A}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return j}}),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 we}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return be}}),Object.defineProperty(e,"resolveZoneName",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"zoneLabel",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"formatInstant",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return he}}),Object.defineProperty(e,"timestampGroupProjector",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"TEMPORAL_INFERENCE_ORDER",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Ie}});const ie=F("packages/core/src/internal/predicates.js"),E=ie.isNil,W=ie.isFunction,I=F("packages/core/src/format/date.js"),x=I.toDate,Q=I.compilePattern,U=I.compileDate,L=I.toIsoDateTime,q=I.compareIso,M=864e5,O=Object.freeze({}),k=1e3,b=60*k,a=60*b,g=24*a,o=7*g,t=new WeakMap;function r(ke,_e){const Te=ke&&ke.locale||"",je=ke&&ke.column;if(!je)return Te?{locale:Te}:O;const Ae=t.get(je);if(Ae&&Ae.locale===Te)return Ae.bag;const Ee=je.typeOptions||je[_e]||(s(je.format)?je.format:null),Me={...Ee||O,locale:Ee&&Ee.locale||Te||void 0};return t.set(je,{locale:Te,bag:Me}),Me}function s(ke){return ke!==null&&typeof ke=="object"&&!Array.isArray(ke)&&!(ke instanceof Date)}function i(ke,_e){const Te=ke===null||Number.isNaN(ke)?null:ke,je=_e===null||Number.isNaN(_e)?null:_e;return Te===null?je===null?0:1:je===null||Te<je?-1:Te>je?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 c(ke,_e,Te,je){return!(ke>=0&&ke<=23)||!(_e>=0&&_e<=59)||!(Te>=0&&Te<=59)||!(je>=0&&je<=999)?null:ke*a+_e*b+Te*k+je}function l(ke){if(E(ke))return null;const _e=String(ke).trim();if(_e==="")return null;const Te=m.exec(_e);if(Te){const et=Te[1];if(et.length===5)return null;const Je=et.length===3?1:2;return c(Number(et.slice(0,Je)),Number(et.slice(Je,Je+2)),Number(et.slice(Je+2,Je+4)||0),0)}const je=n.exec(_e);if(!je)return null;let Ae=Number(je[1]);const Ee=Number(je[2]||0),Me=Number(je[3]||0),Be=je[4]?Number(je[4].padEnd(3,"0")):0,Ke=je[5]?je[5][0].toLowerCase():null;if(Ke){if(Ae<1||Ae>12)return null;Ae=Ae%12,Ke==="p"&&(Ae+=12)}return c(Ae,Ee,Me,Be)}function u(ke){return E(ke)||ke===""?null:typeof ke=="number"?Number.isFinite(ke)?(ke%g+g)%g:null:ke instanceof Date?Number.isNaN(ke.getTime())?null:ke.getHours()*a+ke.getMinutes()*b+ke.getSeconds()*k+ke.getMilliseconds():l(ke)}const f=new Map;function p(ke){const _e=ke.pattern||"",Te=ke.timeStyle||(ke.seconds?"medium":"short"),je=`${ke.locale||""}|${_e}|${Te}`;let Ae=f.get(je);if(Ae)return Ae;if(_e)Ae=Q(_e,ke.locale||void 0,"UTC");else{const Ee=new Intl.DateTimeFormat(ke.locale||void 0,{timeStyle:Te,timeZone:"UTC"});Ae=Me=>Ee.format(Me)}return f.set(je,Ae),Ae}function y(ke,_e){const Te=_e||O;if(ke==null||typeof ke!="number"||!Number.isFinite(ke))return Te.nullDisplay??"";const je=(ke%g+g)%g;return p(Te)(new Date(je))}function h(ke){return ke instanceof Date?!Number.isNaN(ke.getTime()):typeof ke=="number"?Number.isFinite(ke)&&ke>=0&&ke<g:typeof ke!="string"||!ke.includes(":")?!1:l(ke)!==null}function d(ke){const _e=u(ke);return _e==null?"":y(_e,{pattern:_e%k===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const w=new Map;function v(ke){const _e=ke||"";let Te=w.get(_e);return Te||(Te=new Intl.DateTimeFormat("en-GB",{timeZone:ke||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),w.set(_e,Te)),Te}function P(ke,_e){const Te={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const je of v(_e).formatToParts(new Date(ke)))je.type==="year"?Te.year=Number(je.value):je.type==="month"?Te.month=Number(je.value):je.type==="day"?Te.day=Number(je.value):je.type==="hour"?Te.hour=Number(je.value)%24:je.type==="minute"?Te.minute=Number(je.value):je.type==="second"&&(Te.second=Number(je.value));return Te}function G(ke,_e){const Te=P(ke,_e);return Date.UTC(Te.year,Te.month-1,Te.day,Te.hour,Te.minute,Te.second,0)-Math.floor(ke/1e3)*1e3}function V(ke,_e){const Te=ke.hour||0,je=ke.minute||0,Ae=ke.second||0,Ee=ke.ms||0;if(!_e)return new Date(ke.year,ke.month-1,ke.day,Te,je,Ae,Ee).getTime();const Me=Date.UTC(ke.year,ke.month-1,ke.day,Te,je,Ae,Ee);let Be=Me-G(Me,_e);return Be=Me-G(Be,_e),Be}const K=/(?:Z|[+-]\d{2}:?\d{2})$/i,H=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function T(ke,_e){if(E(ke))return null;const Te=String(ke).trim();if(Te==="")return null;const je=_e&&_e.timeZone||void 0;if(!K.test(Te)){const Ae=H.exec(Te);if(Ae){const Ee=(Ae[4]||"").trim(),Me=Ee===""?0:l(Ee);if(Me===null)return null;const Be=V({year:Number(Ae[1]),month:Number(Ae[2]),day:Number(Ae[3]),hour:Math.floor(Me/a),minute:Math.floor(Me/b)%60,second:Math.floor(Me/k)%60,ms:Me%k},je);return Number.isNaN(Be)?null:new Date(Be)}}return x(Te)}function A(ke){if(typeof ke=="number")return Number.isFinite(ke)?ke:null;const _e=x(ke);return _e?_e.getTime():null}const S=new Map;function R(ke){const _e=[ke.locale||"",ke.pattern||"",ke.dateStyle||"",ke.timeStyle||"",ke.timeZone||"",ke.seconds?"1":""].join("|");let Te=S.get(_e);if(Te)return Te;const je=ke.pattern?{type:"date",pattern:ke.pattern,timeZone:ke.timeZone}:{type:"date",dateStyle:ke.dateStyle||"medium",timeStyle:ke.timeStyle||(ke.seconds?"medium":"short"),timeZone:ke.timeZone};return Te=U(je,ke.locale||void 0),S.set(_e,Te),Te}function j(ke,_e){const Te=_e||O,je=A(ke);return je==null?Te.nullDisplay??"":R(Te)(je)}function N(ke){return ke instanceof Date?!Number.isNaN(ke.getTime()):typeof ke!="string"||!H.test(ke.trim())?!1:T(ke)!==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:a,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"]}]),_=new Map;for(const ke of $)for(const _e of ke.names)_.set(_e,ke);const Y=Object.freeze($.filter(ke=>ke.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(ke){const _e=ke&&ke.defaultUnit?_.get(String(ke.defaultUnit).toLowerCase()):null;return _e?_e.ms:b}function z(ke){return(ke&&ke.defaultUnit?_.get(String(ke.defaultUnit).toLowerCase()):null)||_.get("m")}function X(ke,_e){if(E(ke))return null;let Te=String(ke).trim().toLowerCase();if(Te==="")return null;let je=1;if(Te[0]==="-"?(je=-1,Te=Te.slice(1).trim()):Te[0]==="+"&&(Te=Te.slice(1).trim()),Te==="")return null;const Ae=D.exec(Te);if(Ae){const Ke=Ae[3]!==void 0,et=Number(Ae[1])*a+Number(Ae[2])*b+(Ke?Number(Ae[3])*k:0)+(Ae[4]?Number(Ae[4].padEnd(3,"0")):0);return je*et}if(J.test(Te))return Math.round(je*Number(Te)*te(_e||O));let Ee=Te,Me=0,Be=0;for(;Ee!=="";){const Ke=Z.exec(Ee);if(!Ke)return null;const et=_.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(je*Me)}function ne(ke){return E(ke)||ke===""?null:typeof ke=="number"?Number.isFinite(ke)?ke:null:X(ke)}const re=new Map;function ae(ke,_e,Te){const je=`${Te||""}|${_e.intl}`;let Ae=re.get(je);if(Ae===void 0){try{Ae=new Intl.NumberFormat(Te||void 0,{style:"unit",unit:_e.intl,unitDisplay:"long"})}catch{Ae=null}re.set(je,Ae)}return Ae?Ae.format(ke):`${ke} ${ke===1?_e.long[0]:_e.long[1]}`}function fe(ke,_e){return String(ke).padStart(_e,"0")}function we(ke,_e){const Te=_e||O;if(ke==null||typeof ke!="number"||!Number.isFinite(ke))return Te.nullDisplay??"";const je=Te.style||"short",Ae=ke<0;let Ee=Math.round(Math.abs(ke));const Me=Ae?"-":"";if(Ee===0&&Te.zeroDisplay!=null)return Te.zeroDisplay;if(je==="clock"){const Je=Math.floor(Ee/a),ut=Math.floor(Ee/b)%60,Ct=Math.floor(Ee/k)%60;return`${Me}${fe(Je,2)}:${fe(ut,2)}:${fe(Ct,2)}`}if(Ee===0){const Je=z(Te);return je==="long"?ae(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(je==="long"?ae(ut,Je,Te.locale):`${ut}${Je.key}`))}return Me+et.join(" ")}function ve(ke){if(typeof ke!="string")return!1;const _e=ke.trim();return _e===""||D.test(_e)||!/[a-z]/i.test(_e)?!1:X(_e)!==null}const Re=Date.UTC(1899,11,30),$e=new Map;function be(ke,_e){const Te=ke||"";let je=$e.get(Te);je||(je=new Intl.DateTimeFormat("en-GB",{timeZone:ke||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),$e.set(Te,je));const Ae=typeof _e=="number"?_e:Date.now();for(const Ee of je.formatToParts(new Date(Ae)))if(Ee.type==="timeZoneName")return Ee.value;return""}function se(ke){if(ke)return ke;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function de(ke,_e){const Te=se(ke),je=be(ke,_e);return je?`${Te} (${je})`:Te}function oe(ke,_e){if(ke&&ke.timeZone)return ke.timeZone;const Te=_e&&_e.grid;return(Te&&W(Te.get)?Te.get("timeZone"):void 0)||void 0}function ce(ke,_e){const Te=_e||O,je=A(ke);if(je==null)return Te.nullDisplay??"";const Ae=R(Te)(je);if(!Te.showOrigin)return Ae;const Ee=Te.originZone;return Ee?Ee===(Te.timeZone||se(Te.timeZone))?Ae:`${Ae} (${de(Ee,je)})`:`${Ae} (no origin recorded)`}function he(ke,_e,Te,je){if(_e==="instant"||!_e)return ke;const Ae=P(ke,Te);if(_e==="month")return V({year:Ae.year,month:Ae.month,day:1},Te);if(_e==="week"){const Ee=je>=1&&je<=7?je:1,Be=((new Date(Date.UTC(Ae.year,Ae.month-1,Ae.day)).getUTCDay()+6)%7+1-Ee+7)%7,Ke=new Date(Date.UTC(Ae.year,Ae.month-1,Ae.day-Be));return V({year:Ke.getUTCFullYear(),month:Ke.getUTCMonth()+1,day:Ke.getUTCDate()},Te)}return V({year:Ae.year,month:Ae.month,day:Ae.day},Te)}function Oe(ke,_e){const Te=ke&&ke.group,je=Te&&Te.granularity||"day";if(je==="instant")return null;const Ae=Te&&Te.weekStart;return Ee=>typeof Ee=="number"?he(Ee,je,_e,Ae):Ee}const Se={time:{base:"number",storage:"float64",matches:h,format:ke=>y(u(ke.value),r(ke,"time")),parse:ke=>l(ke.text),compare:(ke,_e)=>i(u(ke),u(_e)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:ke=>{const _e=u(ke);return _e===null?null:_e/M},toStorage:ke=>u(ke),toClipboard:d,fromClipboard:l},datetime:{base:"dateString",storage:"dictionary",matches:N,format:ke=>j(ke.value,r(ke,"datetime")),parse:ke=>L(T(ke.text,r(ke,"datetime"))??ke.text),compare:q,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(ke,_e)=>L(ke,_e&&_e.timeZone),toClipboard:ke=>E(ke)?"":String(ke),fromClipboard:ke=>L(ke)},duration:{base:"number",storage:"float64",matches:ve,format:ke=>we(ne(ke.value),r(ke,"duration")),parse:ke=>X(ke.text,r(ke,"duration")),compare:(ke,_e)=>i(ne(ke),ne(_e)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:ke=>{const _e=ne(ke);return _e===null?null:_e/M},toStorage:ke=>ne(ke),toClipboard:ke=>we(ne(ke),{style:"short",maxUnits:-1}),fromClipboard:ke=>X(ke)},timestamp:{base:"number",storage:"float64",format:ke=>{const _e=r(ke,"timestamp");return ce(ke.value,{..._e,timeZone:oe(_e,ke)})},parse:ke=>{const _e=r(ke,"timestamp"),Te=T(ke.text,{timeZone:oe(_e,ke)});return Te?Te.getTime():null},compare:(ke,_e)=>i(A(ke),A(_e)),groupProjector:(ke,_e)=>Oe(ke,_e),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(ke,_e)=>{const Te=A(ke);if(Te==null)return null;const je=P(Te,_e&&_e.timeZone||void 0);return(Date.UTC(je.year,je.month-1,je.day,je.hour,je.minute,je.second)-Re)/M},toStorage:ke=>A(ke),toClipboard:ke=>{const _e=A(ke);return _e==null?"":new Date(_e).toISOString()},fromClipboard:ke=>A(ke)}},Ce=["datetime","time","duration"],Ie=Se}),He("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(W=256,I=null){this.#e=W,this.#n=I}get size(){return this.#t.size}get max(){return this.#e}set max(W){this.#e=W,this.#r()}has(W){return this.#t.has(W)}get(W){const I=this.#t;if(!I.has(W))return;const x=I.get(W);return I.delete(W),I.set(W,x),x}peek(W){return this.#t.get(W)}set(W,I){const x=this.#t;return x.has(W)&&x.delete(W),x.set(W,I),this.#r(),I}delete(W){const I=this.#t.get(W);return this.#t.delete(W)&&this.#n&&this.#n(I,W),I}clear(){if(this.#n)for(const[W,I]of this.#t)this.#n(I,W);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const W=this.#t;for(;W.size>this.#e;){const I=W.keys().next().value,x=W.get(I);W.delete(I),this.#n&&this.#n(x,I)}}}}),He("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 L}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"compareIpv4",{enumerable:!0,get:function(){return O}}),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 r}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return i}}),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 c}}),Object.defineProperty(e,"netmask",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return u}}),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 H}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return S}}),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 se}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return de}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/internal/lru.js").Lru,x=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 L(oe);const ce=Number(oe);return Number.isFinite(ce)?ce<0?ce<-2147483648?null:ce>>>0:ce>x?null:Math.trunc(ce)>>>0:null}function L(oe){if(E(oe))return null;const ce=String(oe).trim();if(ce==="")return null;const he=Q.exec(ce);if(!he)return null;let Oe=0;for(let Se=1;Se<=4;Se++){const Ce=he[Se];if(Ce.length>1&&Ce.charCodeAt(0)===48)return null;const Ie=Number(Ce);if(Ie>255)return null;Oe=Oe*256+Ie}return Oe}function q(oe){const ce=U(oe);return ce===null?"":`${ce>>>24&255}.${ce>>>16&255}.${ce>>>8&255}.${ce&255}`}function M(oe){return typeof oe=="string"&&L(oe)!==null}function O(oe,ce){const he=U(oe),Oe=U(ce);return he===null?Oe===null?0:1:Oe===null||he<Oe?-1:he>Oe?1:0}const k=64,b=x*k+32,a=/^(?: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 Oe=i(oe);return Oe===null?null:o(Oe)}if(typeof oe=="object"){const Oe=U(oe.address),Se=Number(oe.prefix);return Oe===null||!Number.isInteger(Se)||Se<0||Se>32?null:{address:Oe,prefix:Se}}const ce=Number(oe);if(!Number.isInteger(ce)||ce<0||ce>b)return null;const he=ce%k;return he>32?null:{address:(ce-he)/k,prefix:he}}function t(oe){return!!(oe&&oe.typeOptions&&oe.typeOptions.cidrNetwork)}function r(oe){return!!(oe&&oe.typeOptions&&oe.typeOptions.storeNumber)}function s(oe,ce,he){return oe==null?null:r(ce)?oe:he(oe)}function i(oe,ce){if(E(oe))return null;const he=String(oe).trim();if(he==="")return null;const Oe=he.indexOf("/");if(Oe<0)return null;const Se=L(he.slice(0,Oe));if(Se===null)return null;const Ce=he.slice(Oe+1).trim();if(!a.test(Ce))return null;const Ie=Number(Ce);if(Ie>32)return null;const ke=ce&&ce.network?(Se&l(Ie))>>>0:Se;return g(ke,Ie)}function n(oe){const ce=o(oe);return ce?`${q(ce.address)}/${ce.prefix}`:""}function m(oe){return typeof oe=="string"&&i(oe)!==null}function c(oe,ce){const he=o(oe),Oe=o(ce);return he?Oe?he.address!==Oe.address?he.address<Oe.address?-1:1:he.prefix-Oe.prefix:-1:Oe?1:0}function l(oe){return oe===0?0:4294967295<<32-oe>>>0}function u(oe){const ce=o(oe);return ce?(ce.address&l(ce.prefix))>>>0:null}function f(oe){const ce=o(oe);return ce?(ce.address&l(ce.prefix)|~l(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 he=o(oe);if(!he)return!1;const Oe=U(ce);if(Oe===null)return!1;const Se=l(he.prefix);return(Oe&Se)>>>0===(he.address&Se)>>>0}function d(oe,ce){const he=u(oe),Oe=u(ce);return he===null||Oe===null?!1:he<=f(ce)&&Oe<=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 he=ce.indexOf("%");if(he>=0&&(ce=ce.slice(0,he)),ce==="")return null;if(ce.indexOf(".")>=0){const _e=ce.lastIndexOf(":");if(_e<0)return null;const Te=L(ce.slice(_e+1));if(Te===null)return null;ce=`${ce.slice(0,_e+1)}${(Te>>>16&65535).toString(16)}:${(Te&65535).toString(16)}`}const Oe=ce.split("::");if(Oe.length>2)return null;const Se=G(Oe[0]);if(Se===null)return null;if(Oe.length===1)return Se.length===8?Se:null;const Ce=G(Oe[1]);if(Ce===null)return null;const Ie=8-Se.length-Ce.length;if(Ie<1)return null;const ke=Se.slice();for(let _e=0;_e<Ie;_e++)ke.push(0);for(const _e of Ce)ke.push(_e);return ke}function G(oe){if(oe==="")return[];const ce=[];for(const he of oe.split(":")){if(!w.test(he))return null;ce.push(parseInt(he,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 K(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,he=0,Oe=-1,Se=0;for(let ke=0;ke<8;ke++)oe[ke]===0?(Oe<0?(Oe=ke,Se=1):Se++,Se>he&&(he=Se,ce=Oe)):(Oe=-1,Se=0);if(he<2)return oe.map(ke=>ke.toString(16)).join(":");const Ce=oe.slice(0,ce).map(ke=>ke.toString(16)).join(":"),Ie=oe.slice(ce+he).map(ke=>ke.toString(16)).join(":");return`${Ce}::${Ie}`}function H(oe){const ce=P(oe);return ce===null?null:K(ce)}function T(oe){return H(oe)??""}function A(oe){return typeof oe=="string"&&oe.indexOf(":")>=0&&P(oe)!==null}function S(oe,ce){const he=V(oe),Oe=V(ce);if(!he)return Oe?1:0;if(!Oe)return-1;for(let Se=0;Se<8;Se++)if(he[Se]!==Oe[Se])return he[Se]<Oe[Se]?-1:1;return 0}const R=/^[0-9a-fA-F]{12}$/,j=/^[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 he=0;he<12;he+=2)ce.push(parseInt(oe.slice(he,he+2),16));return ce}function _(oe){if(E(oe))return null;if(typeof oe=="number"){if(!Number.isInteger(oe)||oe<0||oe>0xffffffffffff)return null;const Se=[];for(let Ce=5;Ce>=0;Ce--)Se.push(Math.floor(oe/256**Ce)%256);return Se}const ce=String(oe).trim();if(ce==="")return null;if(R.test(ce))return $(ce);if(ce.indexOf(".")>=0)return j.test(ce)?$(ce.split(".").join("")):null;const he=ce.indexOf(":")>=0?":":ce.indexOf("-")>=0?"-":null;if(he===null)return null;const Oe=ce.split(he);if(Oe.length!==6)return null;for(const Se of Oe)if(!N.test(Se))return null;return Oe.map(Se=>parseInt(Se,16))}function Y(oe){const ce=_(oe);if(!ce)return null;let he=0;for(const Oe of ce)he=he*256+Oe;return he}function Z(oe){const ce=_(oe);return ce?ce.map(he=>he.toString(16).padStart(2,"0")).join(":"):null}function J(oe,ce="colon"){const he=_(oe);if(!he)return"";const Oe=he.map(Se=>Se.toString(16).padStart(2,"0"));switch(ce){case"hyphen":return Oe.join("-");case"colon-upper":return Oe.map(Se=>Se.toUpperCase()).join(":");case"cisco":return`${Oe[0]}${Oe[1]}.${Oe[2]}${Oe[3]}.${Oe[4]}${Oe[5]}`;default:return Oe.join(":")}}function D(oe){return typeof oe=="string"&&_(oe)!==null}function te(oe){if(E(oe))return null;const ce=String(oe).trim();if(ce==="")return null;const he=ce.replace(/[:-]/g,"").replace(/\./g,"").toLowerCase();return/^[0-9a-f]+$/.test(he)?he:null}function z(oe,ce){const he=te(oe),Oe=te(ce);return!!(he&&Oe&&he.includes(Oe))}function X(oe,ce){const he=Y(oe),Oe=Y(ce);return he===null?Oe===null?0:1:Oe===null||he<Oe?-1:he>Oe?1:0}const ne=Object.freeze(["macEquals","macInRange","macContains"]),re=Object.freeze(["eq","ne","contains","notContains","startsWith","endsWith"]);function ae(oe){switch(oe){case"macEquals":return{compile:ce=>{const he=Y(ce);return he===null?()=>!1:Oe=>Y(Oe)===he},check:ce=>Y(ce)===null?"the operand is not a MAC address":null};case"macInRange":return{compile:ce=>{const he=Array.isArray(ce)?ce:[ce,ce],Oe=Y(he[0]),Se=Y(he[1]);return Oe===null||Se===null||Oe>Se?()=>!1:Ce=>{const Ie=Y(Ce);return Ie!==null&&Ie>=Oe&&Ie<=Se}},check:ce=>{const he=Array.isArray(ce)?ce:[];if(he.length!==2)return"the operand must be two MAC addresses, the low and high ends of the range";const Oe=Y(he[0]),Se=Y(he[1]);return Oe===null||Se===null?"an end of the range is not a MAC address":Oe>Se?"the low end of the range is above the high end":null}};case"macContains":return{compile:ce=>he=>z(he,ce),check:ce=>te(ce)===null?"the operand is not hex":null};default:return{compile:()=>()=>!1,check:()=>"unknown MAC operator"}}}function fe(oe){switch(oe){case"eq":return{compile:ce=>{const he=Y(ce);return he===null?()=>!1:Oe=>Y(Oe)===he},check:ce=>Y(ce)===null?"the operand is not a MAC address":null};case"ne":return{compile:ce=>{const he=Y(ce);return he===null?()=>!1:Oe=>Y(Oe)!==he},check:ce=>Y(ce)===null?"the operand is not a MAC address":null};case"contains":return{compile:ce=>he=>z(he,ce),check:ce=>te(ce)===null?"the operand is not hex":null};case"notContains":return{compile:ce=>he=>!z(he,ce),check:ce=>te(ce)===null?"the operand is not hex":null};case"startsWith":return{compile:ce=>{const he=String(ce??"").toLowerCase();return Oe=>Oe==null?!1:String(Oe).toLowerCase().startsWith(he)}};case"endsWith":return{compile:ce=>{const he=String(ce??"").toLowerCase();return Oe=>Oe==null?!1:String(Oe).toLowerCase().endsWith(he)}};default:return{compile:()=>()=>!1,check:()=>"unknown MAC text operator"}}}const we=Object.freeze(["lt","lte","gt","gte","between","notBetween","in","notIn","matches"]);function ve(oe){const ce=o(oe);return ce===null?null:g(ce.address,ce.prefix)}function Re(oe,ce,he){const Oe=ke=>String(ke??"").trim().toLowerCase(),Se=ke=>{if(ke==null)return null;const _e=ce(ke);return _e===""?null:_e.toLowerCase()},Ce=ke=>oe(ke)===null?`the operand is not ${he}`:null,Ie=(ke,_e)=>({compile:Te=>{const je=Oe(Te);return Ae=>{const Ee=Se(Ae);return Ee===null?_e:_e?!ke(Ee,je):ke(Ee,je)}}});return Object.freeze({eq:{compile:ke=>{const _e=oe(ke);return _e===null?()=>!1:Te=>oe(Te)===_e},check:Ce},ne:{compile:ke=>{const _e=oe(ke);return _e===null?()=>!0:Te=>oe(Te)!==_e},check:Ce},contains:Ie((ke,_e)=>ke.includes(_e),!1),notContains:Ie((ke,_e)=>ke.includes(_e),!0),startsWith:Ie((ke,_e)=>ke.startsWith(_e),!1),endsWith:Ie((ke,_e)=>ke.endsWith(_e),!1),...Object.fromEntries(we.map(ke=>[ke,Object.freeze({})]))})}const $e=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"}),be=(oe,ce)=>he=>{const Oe=he&&typeof he.text=="string"?he.text:"";return Oe.trim()!==""&&oe(Oe)===null?ce:null},se=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:M,parse:oe=>L(oe.text),parseError:be(L,$e.ipv4),compare:O,format:oe=>q(oe.value),operators:Re(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=>L(oe)},cidr:{base:"number",storage:"float64",matches:m,parse:oe=>i(oe.text,{network:t(oe.column)}),parseError:be(i,$e.cidr),compare:c,format:oe=>n(oe.value),operators:Re(ve,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)=>i(oe,{network:t(ce&&ce.column)})},ipv6:{base:"text",storage:"dictionary",matches:A,parse:oe=>H(oe.text),parseError:be(H,$e.ipv6),compare:S,format:oe=>T(oe.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:oe=>H(oe),toClipboard:oe=>T(oe),fromClipboard:oe=>H(oe)},mac:{base:"text",storage:"dictionary",matches:D,parse:oe=>Z(oe.text),parseError:be(Z,$e.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,ae(oe)])),...Object.fromEntries(re.map(oe=>[oe,fe(oe)]))}),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:oe=>Z(oe),fromClipboard:oe=>Z(oe)}}),de=se}),He("packages/core/src/columns/types/vlan.js",function(e,F){"use strict";Object.defineProperty(e,"vlanError",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"parseVlans",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"formatVlans",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"vlanContains",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"vlanOverlaps",{enumerable:!0,get:function(){return O}}),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 a}}),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,W=/^\d+$/;function I(t,r){const s=!!(r&&r.single),i=t==null?"":String(t).trim();if(i==="")return{ids:null,error:null};const n=i.split(","),m=new Set;for(const c of n){const l=c.trim();if(l==="")return{ids:null,error:`"${i}" has an empty entry`};const u=l.indexOf("-");if(u>=0){if(s)return{ids:null,error:"a single-ID VLAN column holds one ID, not a list or range"};const f=l.slice(0,u).trim(),p=l.slice(u+1).trim();if(!W.test(f)||!W.test(p))return{ids:null,error:`"${l}" 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(!W.test(l))return{ids:null,error:`"${l}" is not a VLAN ID (a whole number ${ie}-${E})`};const f=Number(l);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((c,l)=>c-l),error:null}}function x(t,r){return I(t,r).error}function Q(t){const r=[];let s=0;for(;s<t.length;){let i=s;for(;i+1<t.length&&t[i+1]===t[i]+1;)i++;r.push(i===s?String(t[s]):`${t[s]}-${t[i]}`),s=i+1}return r.join(",")}function U(t){if(t==null||t==="")return null;if(typeof t=="string")return I(t,{}).ids;if(Array.isArray(t)){const r=new Set;for(const s of t){if(typeof s!="number"||!Number.isInteger(s)||s<ie||s>E)return null;r.add(s)}return r.size?[...r].sort((s,i)=>s-i):null}return typeof t=="number"&&Number.isInteger(t)&&t>=ie&&t<=E?[t]:null}function L(t,r){const s=I(t,r);return s.ids===null?null:Q(s.ids)}function q(t){const r=U(t);return r===null?"":Q(r)}function M(t,r){const s=U(t);if(s===null)return!1;const i=Number(r);return Number.isInteger(i)&&s.includes(i)}function O(t,r){const s=U(t);if(s===null)return!1;const i=new Set(s),n=Array.isArray(r)?r:typeof r=="string"?r.split(","):[r];for(const m of n){const c=Number(typeof m=="string"?m.trim():m);if(Number.isInteger(c)&&i.has(c))return!0}return!1}function k(t){const r=U(t);return r===null?0:r.length}function b(t){return typeof t=="string"&&L(t)!==null}function a(t,r){const s=U(t),i=U(r);return s===null?i===null?0:1:i===null?-1:s[0]!==i[0]?s[0]<i[0]?-1:1:s.length<i.length?-1:s.length>i.length?1:0}const g=Object.freeze({vlan:{base:"text",storage:"dictionary",matches:b,parse:t=>L(t.text,{single:!!(t.column&&t.column.typeOptions&&t.column.typeOptions.vlanSingle)}),parseError:t=>x(t.text,{single:!!(t.column&&t.column.typeOptions&&t.column.typeOptions.vlanSingle)}),compare:a,format:t=>q(t.value),defaults:{filter:"text",editor:"vlan",align:"start"},excel:"@",operators:Object.freeze({contains:{compile:t=>r=>M(r,t),check:t=>{const r=Number(typeof t=="string"?t.trim():t);return!Number.isInteger(r)||r<ie||r>E?`contains needs one VLAN ID ${ie}-${E}`:null}},overlaps:{compile:t=>r=>O(r,t),check:t=>{const r=Array.isArray(t)?t:typeof t=="string"?t.split(","):[t];for(const s of r){const i=Number(typeof s=="string"?s.trim():s);if(!Number.isInteger(i)||i<ie||i>E)return`overlaps needs VLAN IDs ${ie}-${E}`}return null}}}),toStorage:t=>L(t),toClipboard:t=>q(t),fromClipboard:t=>L(t)}}),o=g}),He("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 x}});const ie=F("packages/core/src/registry/free-tier-notice.js"),E=ie.FREE_TIER_NOTICE,W=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":W,"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"}),x=Object.freeze(Object.keys(I))}),He("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 M}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return k}});const E=F("packages/core/src/internal/predicates.js").isFunction,W=/\{(\w+)\}/g,I=new Map,x=new Map;function Q(b){const a=b||"";if(I.has(a))return I.get(a);let g=null;try{g=new Intl.PluralRules(b||void 0)}catch{g=null}return I.set(a,g),g}function U(b,a,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=`${a||""}|${g}`;let r=x.get(t);if(r===void 0){try{r=new Intl.ListFormat(a||void 0,{style:"long",type:g})}catch{r=null}x.set(t,r)}return r?r.format(o.map(String)):o.map(String).join(", ")}function L(b,a){return b==null?"":typeof b=="number"?Number.isFinite(b)?b.toLocaleString(a||void 0,{maximumFractionDigits:20}):"":String(b)}function q(b,a,g){if(typeof b=="string")return b;if(!b||typeof b!="object")return"";const o=a&&typeof a.count=="number"?a.count:null;if(o===null)return b.other??"";const t=Q(g),r=t?t.select(o):o===1?"one":"other";return b[r]??b.other??""}function M(b,a={},g){const o=q(b,a,g);return o?o.replace(W,(t,r)=>Object.prototype.hasOwnProperty.call(a,r)?L(a[r],g):t):""}function O(b,a,g="en-GB"){return typeof b=="string"&&b?b:typeof a=="string"&&a?a:g}function k(b,a){const g=b?b[a]:void 0;return g==null||E(g)?a:g}}),He("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 x}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return Q}});const E=F("packages/core/src/i18n/catalogue.js").EN_GB,W=new Map([["en-gb",E]]);function I(U,L){const q=typeof U=="string"?U.toLowerCase():"";return!q||!L||typeof L!="object"?!1:(W.set(q,L),!0)}function x(U){if(typeof U!="string"||!U)return null;const L=U.toLowerCase(),q=W.get(L);if(q)return q;const M=L.split("-")[0],O=W.get(M);if(O)return O;for(const[k,b]of W)if(k.split("-")[0]===M)return b;return null}function Q(){return[...W.keys()]}}),He("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 r}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return i}});const ie=F("packages/core/src/i18n/catalogue.js"),E=ie.EN_GB,W=ie.MESSAGE_KEYS,I=F("packages/core/src/i18n/format.js"),x=I.formatMessage,Q=I.formatList,U=I.lookup,L=I.resolveLocale,M=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"),a=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=L(m.locale,m.declared,o);const c=m.messages,l=g(this.#e);if(!l&&this.#e.toLowerCase()!=="en-gb"&&(!c||typeof c!="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.`),!c||typeof c!="object"){this.#t=l?{...E,...l}:E;return}const f=Object.keys(c).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,...l||{},...c}}get locale(){return this.#e}t(m,c){return x(U(this.#t,m),c||{},this.#e)}list(m,c){return Q(m,this.#e,c)}number(m,c){const l=Number(m);return Number.isFinite(l)?l.toLocaleString(this.#e,c||{maximumFractionDigits:20}):""}}const r=new t;function s(n){return n instanceof t?n:new t(n||{})}function i(n){const m=n&&typeof n=="object"?n:{},c=W.filter(u=>{const f=m[u];return f==null||f===""||M(f)}),l=Object.keys(m).filter(u=>!(u in E));return{missing:c,unknown:l}}}),He("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 M}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return O}}),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,W=ie.isObject,x=F("packages/core/src/i18n/index.js").defaultMessages,Q=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function U(t,r){const s=r||{},i=s.emptyDisplay??Q.emptyDisplay;if(E(t)||t==="")return i;const m=[...typeof s.char=="string"&&s.char!==""?s.char:Q.char][0]||Q.char,c=s.fixedLength??Q.fixedLength,l=Number.isFinite(s.length)&&Number(s.length)>0?Math.floor(Number(s.length)):Q.length,u=typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):null;let f=0;if(u!==null){const p=Number.isFinite(s.lastVisible)?Math.floor(Number(s.lastVisible)):Q.lastVisible,y=[...u];if(f=p>0&&p<y.length?p:0,f>0){const h=y.slice(y.length-f).join(""),d=Math.max(1,(c?l:y.length)-f);return m.repeat(d)+h}return m.repeat(c?l:Math.max(1,y.length))}return m.repeat(l)}const L=48;function q(t){try{const r=JSON.stringify(t);return r===void 0?null:r}catch{return null}}function M(t,r){if(E(t))return"";const s=Number.isFinite(r&&r.inlineLimit)?Number(r.inlineLimit):L;if(typeof t=="string")return t.length>s?`${t.slice(0,s-1)}…`:t;if(typeof t!="object")return String(t);const i=q(t);if(i!==null&&i.length<=s)return i;if(Array.isArray(t)){const m=t.length;return`[${x.t("count.items",{count:m})}]`}const n=Object.keys(t).length;return`{${x.t("count.keys",{count:n})}}`}function O(t,r){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 i=r||new WeakSet;return i.has(t)?'"[circular]"':(i.add(t),t instanceof Date?JSON.stringify(t.toISOString()):Array.isArray(t)?`[${t.map(c=>O(c,i)).join(",")}]`:`{${Object.keys(t).sort().map(c=>`${JSON.stringify(c)}:${O(t[c],i)}`).join(",")}}`)}function k(t,r){if(E(t))return E(r)?0:1;if(E(r))return-1;const s=O(t),i=O(r);return s<i?-1:s>i?1:0}function b(t){if(E(t))return null;const r=String(t);if(r.trim()==="")return null;try{return JSON.parse(r)}catch{return r}}function a(t){const r=t&&t.cell&&t.cell.props;return W(r)?r:{}}const g=Object.freeze({json:{base:"object",storage:"object",format:t=>M(t&&t.value,a(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 r=JSON.stringify(t,null,2);return r===void 0?String(t):r}catch{return String(t)}},fromClipboard:t=>b(t)},secret:{base:"text",storage:"object",format:t=>U(t&&t.value,a(t&&t.column)),parse:t=>{const r=t&&t.text;return E(r)||String(r)===""?null:String(r)},compare:(t,r)=>{const s=E(t)||t==="",i=E(r)||r==="";return s===i?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}),He("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 O}}),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 c}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return j}}),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 x($,_,Y,Z){return Object.freeze({symbol:$,factor:_,aliases:Object.freeze(Y||[]),binary:!!(Z&&Z.binary),prefix:Z&&Z.prefix||null,auto:!(Z&&Z.auto===!1)})}function Q($,_,Y,Z){return x($,_,Y,Z)}const U=Object.freeze({data:Object.freeze([x("B",1,["byte","bytes"]),x("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),x("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),x("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),x("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),x("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),x("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),x("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),x("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),x("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([x("bps",1,["bit","bits","bit/s","b/s"]),x("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),x("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),x("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),x("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([x("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),x("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),x("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),x("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),x("in",.0254,["inch","inches"],{auto:!1}),x("ft",.3048,["foot","feet"],{auto:!1}),x("yd",.9144,["yard","yards"],{auto:!1}),x("m",1,["metre","metres","meter","meters"]),x("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),x("mi",1609.344,["mile","miles"],{auto:!1}),x("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([x("mg",.001,["milligram","milligrams"]),x("g",1,["gram","grams"]),x("oz",28.349523125,["ounce","ounces"],{auto:!1}),x("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),x("kg",1e3,["kilogram","kilograms"]),x("st",6350.29318,["stone"],{auto:!1}),x("t",1e6,["tonne","tonnes","ton"],{auto:!1}),x("ton (US)",907184.74,["ton","shortton"],{auto:!1}),x("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([x("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),x("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),x("ms",.001,["msec","msecs","millisecond","milliseconds"]),x("s",1,["sec","secs","second","seconds"]),x("m",60,["min","mins","minute","minutes"]),x("h",3600,["hr","hrs","hour","hours"]),x("d",86400,["day","days"])]),speed:Object.freeze([x("mm/s",.001,["millimetre/s","millimeter/s"]),x("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),x("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),x("mph",.44704,["mile/h","miles/h"],{auto:!1}),x("kn",1852/3600,["knot","knots"],{auto:!1}),x("m/s",1,["metre/s","meter/s","mps"]),x("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([x("mm/s²",.001,["mm/s2"]),x("ft/s²",.3048,["ft/s2"],{auto:!1}),x("m/s²",1,["m/s2","metre/s2","meter/s2"]),x("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([x("mm²",1e-6,["mm2"]),x("cm²",1e-4,["cm2"]),x("in²",64516e-8,["in2","sqin"],{auto:!1}),x("ft²",.09290304,["ft2","sqft"],{auto:!1}),x("yd²",.83612736,["yd2","sqyd"],{auto:!1}),x("m²",1,["m2","sqm"]),x("ha",1e4,["hectare","hectares"],{auto:!1}),x("ac",4046.8564224,["acre","acres"],{auto:!1}),x("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([x("µL",1e-6,["ul","microlitre","microliter"]),x("mL",.001,["millilitre","milliliter"]),x("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),x("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),x("L",1,["litre","litres","liter","liters"]),x("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),x("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),x("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),x("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([x("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),x("J",1,["joule","joules"]),x("cal",4.184,["calorie","calories"],{auto:!1}),x("kJ",1e3,["kilojoule","kilojoules"]),x("BTU",1055.05585262,["btu"],{auto:!1}),x("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),x("MJ",1e6,["megajoule","megajoules"]),x("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),x("GJ",1e9,["gigajoule","gigajoules"]),x("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([x("mW",.001,["milliwatt","milliwatts"]),x("W",1,["watt","watts"]),x("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),x("kW",1e3,["kilowatt","kilowatts"]),x("hp",745.6998715822702,["horsepower"],{auto:!1}),x("MW",1e6,["megawatt","megawatts"]),x("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([x("mN",.001,["millinewton","millinewtons"]),x("N",1,["newton","newtons"]),x("lbf",4.4482216152605,["poundforce"],{auto:!1}),x("kgf",9.80665,["kilogramforce"],{auto:!1}),x("kN",1e3,["kilonewton","kilonewtons"]),x("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([x("Pa",1,["pascal","pascals"]),x("mbar",100,["millibar"],{auto:!1}),x("inH₂O",249.0889,["inh2o"],{auto:!1}),x("mmHg",133.322387415,["torr"],{auto:!1}),x("kPa",1e3,["kilopascal","kilopascals"]),x("inHg",3386.388640341,["inhg"],{auto:!1}),x("psi",6894.757293168361,["lbf/in2"],{auto:!1}),x("bar",1e5,[],{auto:!1}),x("atm",101325,["atmosphere","atmospheres"],{auto:!1}),x("MPa",1e6,["megapascal","megapascals"]),x("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([x("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),x("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),x("kN·m",1e3,["knm","kn.m"],{auto:!1}),x("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([x("kg/m³",1,["kg/m3"]),x("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),x("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),x("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([x("L/min",1/6e4,["lpm","l/min"],{auto:!1}),x("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),x("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),x("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),x("cfm",.0004719474432,["ft3/min"],{auto:!1}),x("L/s",.001,["lps","l/s"],{auto:!1}),x("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([x("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),x("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),x("mrad",.001,["milliradian","milliradians"],{auto:!1}),x("mil",Math.PI/3200,["nato-mil"],{auto:!1}),x("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),x("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),x("rad",1,["radian","radians"]),x("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([x("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),x("rad/s",1,["radps","radians/s"]),x("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),x("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([x("ppt",1e-12,["partspertrillion"],{auto:!1}),x("ppb",1e-9,["partsperbillion"]),x("ppm",1e-6,["partspermillion"]),x("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),x("‰",.001,["permille","permil"],{auto:!1}),x("%",.01,["pct","percent"]),x("×",1,["x","ratio","times"])]),molarity:Object.freeze([x("pM",1e-12,["picomolar","picomolarity"]),x("nM",1e-9,["nanomolar","nanomolarity"]),x("µM",1e-6,["um-molar","micromolar","micromolarity"]),x("mM",.001,["millimolar","millimolarity"]),x("M",1,["molar","mol/l","mol/L","molarity"]),x("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([x("mg/s",1e-6,["milligrams/s"]),x("g/s",.001,["grams/s"]),x("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),x("kg/s",1,["kilograms/s","kgps"]),x("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),x("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),x("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([x("µPa·s",1e-6,["upas","micropascalsecond"]),x("cP",.001,["centipoise"],{auto:!1}),x("mPa·s",.001,["mpas","millipascalsecond"]),x("P",.1,["poise"],{auto:!1}),x("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([x("cSt",1e-6,["centistokes","centistoke"]),x("mm²/s",1e-6,["mm2/s"],{auto:!1}),x("St",1e-4,["stokes","stoke"],{auto:!1}),x("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([x("mW/(m·K)",.001,["mw/mk"]),x("W/(m·K)",1,["w/mk","wmk"]),x("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),x("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([x("J/(kg·K)",1,["j/kgk","jkgk"]),x("kJ/(kg·K)",1e3,["kj/kgk"]),x("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([x("nSv/h",1e-9,["nsvh"]),x("µSv/h",1e-6,["usv/h","usvh"]),x("mSv/h",.001,["msvh"]),x("Sv/h",1,["svh"]),x("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),L=Symbol("ambiguous"),q=new Map,M=new Map;function O($,_){const Y=String($||"").trim();if(!Y)throw new Error("[lattice] a unit system needs a name");if(U[Y]||M.has(Y))throw new Error(`[lattice] unit system "${Y}" already exists`);const Z=[..._||[]];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 M.set(Y,Object.freeze(Z)),q.delete(Y),Y}function k(){return[...Object.keys(U),...M.keys()]}function b($){const _=a($);return _?_.units:[]}function a($){const _=String($||""),Y=q.get(_);if(Y!==void 0)return Y;const Z=U[_]||M.get(_);if(!Z)return q.set(_,null),null;const J=Object.freeze([...Z].sort((ne,re)=>ne.factor-re.factor)),D=new Map,te=new Map,z=(ne,re)=>{const ae=D.get(ne);ae===void 0?D.set(ne,re):ae!==re&&D.set(ne,L)};for(const ne of J){z(ne.symbol.toLowerCase(),ne);for(const re of ne.aliases)z(re.toLowerCase(),ne);if(ne.prefix){const re=te.get(ne.prefix)||[];re.push(ne),te.set(ne.prefix,re)}}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(_,X),X}function g($,_){return _&&$.binary||$.decimal}function o($,_){const Y=a($);if(!Y||E(_))return null;const Z=Y.units.find(D=>D.symbol===String(_));if(Z)return Z;const J=Y.byToken.get(String(_).trim().toLowerCase());return J&&J!==L?J:null}const t=new WeakMap;function r($){const _=$||{};if(typeof _=="object"&&_!==null){const D=t.get(_);if(D!==void 0)return D}const Y=_.system||"data",Z=a(Y);let J=null;if(!Z)I(`unit:system:${Y}`,`unknown unit system "${Y}"; known systems are ${k().join(", ")}`);else{let D=_.unit?o(Y,_.unit):null;D||(_.unit&&I(`unit:unit:${Y}:${_.unit}`,`unknown unit "${_.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:_.binary===!0}}return typeof _=="object"&&_!==null&&t.set(_,J),J}const s=new WeakMap;function i($,_){if(!$||!_||!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($,_,Y){return _===Y||_.factor===Y.factor?$:$*_.factor/Y.factor}const m=new Map;function c($){const _=$||"",Y=m.get(_);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(_,Z),Z}const l=/[\s ]/g,u=/^[+-]?[\d '’ .,]*(?:[eE][+-]?\d+)?/,f=/^[^\d+\-(.,\s]+\s*/,p=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function y($,_){const{group:Y,decimal:Z}=c(_);let J=String($).replace(l,"");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($,_,Y){const Z=String($).trim().replace(/\.$/,"");if(Z==="")return null;const J=_.units.find(re=>re.symbol===Z);if(J)return J;const D=Z.toLowerCase(),te=_.byToken.get(D);if(te===L)return null;if(te)return te;const z=_.byPrefix.get(D);if(!z||!z.length)return null;const X=g(_,Y),ne=z.filter(re=>X.includes(re));return ne.length===1?ne[0]:null}function d($,_,Y,Z){let J=$,D=0,te=!1,z=!1;for(;J!=="";){const X=u.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 re=J.search(/[+-]?[\d]/),ae=(re>=0?J.slice(0,re):J).trim();if(J=re>=0?J.slice(re).trim():"",ae===""){if(te)return null;z=!0,D+=n(ne,Y[0],_.base)}else{const fe=h(ae,_.index,_.binary);if(!fe)return null;D+=n(ne,fe,_.base)}if(te=!0,z&&J!=="")return null}return te?D:null}function w($,_){if(E($))return null;if(typeof $=="number")return Number.isFinite($)?$:null;const Y=r(_);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=i(_,Y);if(D){Z.startsWith("-")&&(J=!0,Z=Z.slice(1).trim());const we=d(Z,Y,D,_);return we===null?null:J?-we:we}let te=null;const z=f.exec(Z);if(z&&z[0]){const we=h(z[0].trim(),Y.index,Y.binary);we&&(te=we,Z=Z.slice(z[0].length).trim())}const X=u.exec(Z)[0],ne=y(X,_&&_.locale);if(ne===null)return null;const re=Z.slice(X.length).trim();if(te&&re!=="")return null;const ae=te||(re===""?Y.base:h(re,Y.index,Y.binary));if(!ae)return null;const fe=n(ne,ae,Y.base);return J?-fe:fe}const v=new Map;function P($,_,Y,Z){const J=`${$||""}|${_}|${Y}|${Z?1:0}`;let D=v.get(J);return D||(D=new Intl.NumberFormat($||void 0,{minimumFractionDigits:_,maximumFractionDigits:Y,useGrouping:Z}),v.set(J,D)),D}function G($,_){if(!Number.isFinite($)||$===0)return Math.max(0,_-1);const Y=Math.floor(Math.log10(Math.abs($)));return Math.min(20,Math.max(0,_-1-Y))}function V($,_){if(!Number.isFinite($)||$===0)return $;const Y=Math.ceil(Math.log10(Math.abs($))),Z=10**(_-Y);return Math.round($*Z)/Z}function K($,_,Y){if(!Y||Y===_.base.symbol)return _.base;if(Y!=="auto")return H(_,Y);if($===0||!Number.isFinite($))return _.base;const Z=Math.abs($)*_.base.factor,J=g(_.index,_.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 _.index.units)X.binary!==_.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 _.index.units)X.binary!==_.binary&&X.factor!==1||X.factor<z.factor&&(z=X);return z.factor<_.base.factor?z:_.base}function H($,_){const Y=$.index.units.find(J=>J.symbol===_);if(Y)return Y;const Z=$.index.byToken.get(String(_).toLowerCase());return Z&&Z!==L?Z:(I(`unit:display:${_}`,`unknown display unit "${_}"; rendering in ${$.base.symbol}`),$.base)}function T($,_,Y,Z){const J=$<0;let D=Math.abs($)*_.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 ae=0;ae<Y.length;ae++){const fe=Y[ae],we=ae===Y.length-1;let ve=we?D/fe.factor:Math.floor(D/fe.factor);if(D-=ve*fe.factor,we){const $e=10**z;ve=Math.round(ve*$e)/$e+0}const Re=we?P(Z.locale,te,z,Z.group!==!1):P(Z.locale,0,0,Z.group!==!1);ne.push(`${Re.format(ve)}${X}${fe.symbol}`)}const re=ne.join(" ");return J?`-${re}`:re}function A($,_){const Y=_||{},Z=Y.nullDisplay??"";if(E($)||$==="")return Z;const J=typeof $=="number"?$:Number($);if(!Number.isFinite(J))return Z;const D=r(Y);if(!D)return String(J);const te=i(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=K(X,D,Y.display),re=n(X,D.base,ne);let ae=typeof Y.decimals=="number"?Y.decimals:Y.minDecimals??0,fe=typeof Y.decimals=="number"?Y.decimals:Y.maxDecimals??Math.max(ae,2);z&&(ae=G(re,z),fe=ae);const we=P(Y.locale,ae,fe,Y.group!==!1).format(re),ve=Y.space??" ";return Y.placement==="prefix"?`${ne.symbol}${Y.space??""}${we}`:`${we}${ve}${ne.symbol}`}function S($,_){const Y=E($)||Number.isNaN($)?null:Number($),Z=E(_)||Number.isNaN(_)?null:Number(_);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 R($){const _=typeof $.decimals=="number"&&$.decimals>0?`.${"0".repeat($.decimals)}`:"";return`${typeof $.decimals=="number"?`#,##0${_}`:"#,##0.##"}" ${$.symbol}"`}function j($){const _={system:"data",...$||{}},Y=r(_),Z=Y?Y.base.symbol:String(_.unit||""),J=Object.freeze({..._,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 re=te.get(ne);return re||(re=Object.freeze({...J,locale:X||void 0}),te.set(ne,re)),re};return{base:"number",extends:"number",storage:"float64",unitConfig:J,format:X=>A(X.value,X.locale?z(X.locale):J),parse:X=>w(X.text,X.locale?z(X.locale):J),compare:S,defaults:{filter:"number",editor:"unit",align:"end",total:_.total||"sum"},..._.totals?{totals:_.totals}:{},excel:_.excel||R({decimals:_.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=>A(X,D),fromClipboard:X=>w(X,J)}}const N=j}),He("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 x}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/columns/types/unit.js").createUnitType;function x(L){const q=2*Math.PI/L;return M=>{let O=0,k=0,b=0;for(const g of M||[]){if(E(g))continue;const o=Number(g);Number.isFinite(o)&&(O+=Math.cos(o*q),k+=Math.sin(o*q),b+=1)}return!b||Math.hypot(O,k)/b<1e-12?null:(Math.atan2(k,O)/q%L+L)%L}}function Q(L){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:x(L)}}}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})})}),He("packages/core/src/columns/types/si.js",function(e,F){"use strict";Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return O}});const ie=F("packages/core/src/columns/types/unit.js"),E=ie.defineUnit,W=ie.registerUnitSystem,I=ie.createUnitType,x=Object.freeze([Object.freeze({symbol:"f",name:"femto",factor:1e-15}),Object.freeze({symbol:"p",name:"pico",factor:1e-12}),Object.freeze({symbol:"n",name:"nano",factor:1e-9}),Object.freeze({symbol:"µ",name:"micro",factor:1e-6}),Object.freeze({symbol:"m",name:"milli",factor:.001}),Object.freeze({symbol:"c",name:"centi",factor:.01}),Object.freeze({symbol:"",name:"",factor:1}),Object.freeze({symbol:"k",name:"kilo",factor:1e3}),Object.freeze({symbol:"M",name:"mega",factor:1e6}),Object.freeze({symbol:"G",name:"giga",factor:1e9}),Object.freeze({symbol:"T",name:"tera",factor:1e12}),Object.freeze({symbol:"P",name:"peta",factor:1e15})]),Q=Object.freeze(["p","n","µ","m","","k","M","G"]);function U(k){const b=String(k.base),a=new Set([...k.prefixes||Q,""]),g=[];for(const o of x){if(!a.has(o.symbol))continue;const t=`${o.symbol}${b}`,r=[];if(k.name){r.push(`${o.name}${k.name}`,`${o.name}${k.name}s`);const s=o.name.slice(-1);if(s&&k.name.startsWith(s)){const i=`${o.name.slice(0,-1)}${k.name}`;r.push(i,`${i}s`)}}o.symbol==="µ"&&r.push(`u${b}`),o.factor===1&&k.aliases&&r.push(...k.aliases),g.push(E(t,o.factor,r))}for(const o of k.extra||[])g.push(o);return g}function L(k,b){const a=U(b);return W(k,a)}function q(k,b,a){return L(k,b),I({system:k,unit:b.base,display:"auto",maxDecimals:3,...a||{}})}const M=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"]})}),O=q}),He("packages/core/src/columns/types/temperature.js",function(e,F){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return O}}),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 a}});const E=F("packages/core/src/internal/predicates.js").isNil,W=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[r,s]of Object.entries(W))if(o===r||o===s.symbol)return{key:r,scale:s};const t=o.toLowerCase();for(const[r,s]of Object.entries(W))if(s.aliases.includes(t))return{key:r,scale:s};return null}function x(g,o,t){const r=I(o),s=I(t);return!r||!s||!Number.isFinite(Number(g))?null:r.key===s.key?Number(g):s.scale.fromKelvin(r.scale.toKelvin(Number(g)))}const Q=new Map;function U(g,o,t){const r=`${g||""}|${o}|${t}`;let s=Q.get(r);return s||(s=new Intl.NumberFormat(g||void 0,{minimumFractionDigits:o,maximumFractionDigits:t}),Q.set(r,s)),s}function L(g,o){const t=o||{},r=t.nullDisplay??"";if(E(g)||g==="")return r;const s=Number(g);if(!Number.isFinite(s))return r;const i=I(t.scale||"C");if(!i)return String(s);const n=I(t.display||t.scale||"C")||i,m=n.key===i.key?s:n.scale.fromKelvin(i.scale.toKelvin(s)),c=typeof t.decimals=="number"?t.decimals:null,l=c??t.minDecimals??0,u=c??t.maxDecimals??1;return`${U(t.locale,l,u).format(m)}${t.space??" "}${n.scale.symbol}`}const q=/^[+-]?[\d\s., ]*\d/;function M(g,o){const t=String(g).trim();if(t==="")return null;const r=new Intl.NumberFormat(o||void 0).formatToParts(1.1).find(m=>m.type==="decimal")?.value||".",s=r===","?".":",",i=t.split(s).join("").split(/[\s ]/).join("").replace(r,"."),n=Number(i);return Number.isFinite(n)?n:null}function O(g,o){if(E(g))return null;const t=o||{},r=I(t.scale||"C");if(!r)return null;if(typeof g=="number")return Number.isFinite(g)?g:null;let s=String(g).trim();if(s==="")return null;let i=!1;s.startsWith("(")&&s.endsWith(")")&&(i=!0,s=s.slice(1,-1).trim());const n=q.exec(s);if(!n)return null;const m=M(n[0],t.locale);if(m===null)return null;const c=s.slice(n[0].length).trim();if(c==="")return i?-m:m;const l=I(c);if(!l)return null;const u=l.key===r.key?m:r.scale.fromKelvin(l.scale.toKelvin(m));return i?-u:u}function k(g){const o=Object.freeze({scale:"C",...g||{}}),r=(I(o.scale)||I("C")).scale.symbol,s=Object.freeze({...o,display:o.scale,decimals:void 0,minDecimals:0,maxDecimals:20}),i=new Map([[o.locale||"",o]]),n=m=>{const c=m||"";let l=i.get(c);return l||(l=Object.freeze({...o,locale:m||void 0}),i.set(c,l)),l};return{base:"number",extends:"number",storage:"float64",temperatureConfig:o,format:m=>L(m.value,m.locale?n(m.locale):o),parse:m=>O(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)}`:".#"}" ${r}"`,toStorage:m=>typeof m=="number"?Number.isFinite(m)?m:null:typeof m=="string"?O(m,o):E(m)?null:O(String(m),o),toClipboard:m=>L(m,s),fromClipboard:m=>O(m,o)}}const b=Object.freeze({celsius:k({scale:"C"}),fahrenheit:k({scale:"F"}),kelvin:k({scale:"K"})}),a=k}),He("packages/core/src/columns/types/radix.js",function(e,F){"use strict";Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"digitsForWidth",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"radixRange",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"radixName",{enumerable:!0,get:function(){return l}}),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 G}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return H}}),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,x=Object.freeze({2:2,8:8,16:16,bin:2,binary:2,base2:2,oct:8,octal:8,base8:8,hex:16,hexadecimal:16,base16:16}),Q=Object.freeze({2:1,8:3,16:4}),U=Object.freeze({2:"0b",8:"0o",16:"0x"}),L=Object.freeze({2:4,8:3,16:2}),q=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),M=Object.freeze({2:"binary",8:"octal",16:"hexadecimal"}),O=Object.freeze([[/^0x/i,16],[/^0b/i,2],[/^0o/i,8],[/^#/,16]]),k=/[\s\u00a0\u202f_,']/g,b=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,a=Object.freeze([8,16,32,53]),g=new WeakSet,o=new WeakMap,t=new Map,r=new WeakMap,s=new WeakMap,i=Object.freeze({hex:Object.freeze({radix:16}),hex8:Object.freeze({radix:16,bitWidth:8,pad:!0,signed:!1}),hex16:Object.freeze({radix:16,bitWidth:16,pad:!0,signed:!1}),hex32:Object.freeze({radix:16,bitWidth:32,pad:!0,signed:!1}),binary:Object.freeze({radix:2}),binary8:Object.freeze({radix:2,bitWidth:8,pad:!0,signed:!1,group:4}),octal:Object.freeze({radix:8})});function n(A){if(A==null)return 16;const S=typeof A=="string"?A.toLowerCase():A,R=x[S];return R||(I(`radix:base:${String(A)}`,`unsupported radix ${String(A)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function m(A,S){return Math.ceil(A/Q[S])}function c(A,S){if(!A)return S?{min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}:{min:0,max:Number.MAX_SAFE_INTEGER};if(!S)return{min:0,max:2**A-1};const R=2**(A-1);return{min:-R,max:R-1}}function l(A){return M[A]||"hexadecimal"}function u(A){if(typeof A=="string"){const S=i[A];return S||I(`radix:preset:${A}`,`unknown radix preset "${A}"; known presets are ${Object.keys(i).join(", ")}`),{...S||{}}}if(A&&typeof A.preset=="string"){const S=i[A.preset];return S||I(`radix:preset:${A.preset}`,`unknown radix preset "${A.preset}"; known presets are ${Object.keys(i).join(", ")}`),{...S||{},...A}}return A||{}}function f(A){const S=u(A),R=n(S.radix),j=Q[R];let N=null;if(S.bitWidth!==void 0&&S.bitWidth!==null&&S.bitWidth!==!1){const X=Number(S.bitWidth);a.includes(X)?N=X:I(`radix:width:${String(S.bitWidth)}`,`unsupported bitWidth ${String(S.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let $=S.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 _=S.prefix===void 0||S.prefix===!0?U[R]:S.prefix===!1?"":String(S.prefix);let Y=0;S.pad===!0?Y=N?m(N,R):0:typeof S.pad=="number"&&S.pad>0&&(Y=Math.floor(S.pad));let Z=0;S.group===!0?Z=L[R]:typeof S.group=="number"&&S.group>0&&(Z=Math.floor(S.group));const J=c(N,$),D=typeof S.min=="number"?Math.max(J.min,S.min):J.min,te=typeof S.max=="number"?Math.min(J.max,S.max):J.max,z=Object.freeze({radix:R,bits:j,prefix:_,uppercase:S.uppercase!==!1,pad:Y,group:Z,groupSeparator:typeof S.groupSeparator=="string"?S.groupSeparator:" ",bitWidth:N,signed:$,min:D,max:te<D?D:te,nullDisplay:typeof S.nullDisplay=="string"?S.nullDisplay:"",name:l(R)});return g.add(z),z}function p(A){if(A&&g.has(A))return A;if(typeof A=="string"){let S=t.get(A);return S||(S=f(A),t.set(A,S)),S}if(A&&typeof A=="object"){let S=o.get(A);return S||(S=f(A),o.set(A,S)),S}return p("hex")}function y(A){return A<0?-Math.round(-A):Math.round(A)}function h(A,S,R){if(S<=0||A.length<=S)return A;const j=A.length%S||S,N=[A.slice(0,j)];for(let $=j;$<A.length;$+=S)N.push(A.slice($,$+S));return N.join(R)}function d(A){const S=p(A),{radix:R,prefix:j,uppercase:N,pad:$,group:_,groupSeparator:Y,signed:Z,bitWidth:J,nullDisplay:D}=S,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 re=y(ne);let ae="",fe=re;re<0&&(Z?(ae="-",fe=-re):fe=(re%te+te)%te);let we=fe.toString(R);return we=N?we.toUpperCase():we.toLowerCase(),$>0&&we.length<$&&(we=we.padStart($,"0")),_>0&&(we=h(we,_,Y)),ae+j+we};return z.options=S,z}function w(A,S){const R=p(S);let j=r.get(R);return j||(j=d(R),r.set(R,j)),j(A)}function v(A){const S=p(A),{radix:R,groupSeparator:j,signed:N,min:$,max:_}=S,Y=q[R],Z=J=>{if(E(J))return{ok:!0,value:null,reason:"blank"};let D=String(J);if(j&&j!==""&&(D=D.split(j).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,re]of O){const ae=ne.exec(D);if(!ae)continue;const fe=D.slice(ae[0].length);if(fe==="")break;if(!q[re].test(fe))return{ok:!1,value:null,reason:"digits"};z=parseInt(fe,re);break}if(z===null)if(Y.test(D))z=parseInt(D,R);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>_?{ok:!1,value:X,reason:"range"}:{ok:!0,value:X,reason:"ok"}};return Z.options=S,Z}function P(A,S){const R=p(S);let j=s.get(R);return j||(j=v(R),s.set(R,j)),j(A)}function G(A,S){const R=P(A,S);return R.ok?R.value:null}function V(A,S){const R=E(A)||Number.isNaN(A)?null:Number(A),j=E(S)||Number.isNaN(S)?null:Number(S);return R===null?j===null?0:1:j===null||R<j?-1:R>j?1:0}function K(A){const S=A.min>=-2147483648&&A.max<=2147483647;return A.bitWidth&&S?"int32":"float64"}function H(A){const S=f(A),R=d(S),j=v(S);return{base:"number",extends:"number",storage:K(S),matches:null,format:N=>R(N.value),parse:N=>{const $=j(N.text);return $.ok?$.value:null},compare:V,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:N=>R(N),fromClipboard:N=>{const $=j(N);return $.ok?$.value:null},radix:S,formatValue:R,parseText:j}}const T=H}),He("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 L}}),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 x}});const E=F("packages/core/src/internal/predicates.js").isNil;function W(M){const O=[];for(const k of M||[]){if(E(k))continue;const b=Number(k);Number.isFinite(b)&&O.push(b)}return O}function I(M){return O=>{const k=W(O);if(!k.length)return null;let b=0;for(const a of k)b+=10**(a/M);return M*Math.log10(b)}}function x(M){return O=>{const k=W(O);if(!k.length)return null;let b=0;for(const a of k)b+=10**(a/M);return M*Math.log10(b/k.length)}}function Q(M,O){const k=O&&O.column,a=(k&&k.typeOptions||{}).weight,g=O&&O.valueAt;if(!a||typeof g!="function")return null;let o=0,t=0;for(let r=0;r<M.length;r++){if(E(M[r]))continue;const s=Number(M[r]);if(!Number.isFinite(s))continue;const i=g(a,r);if(E(i))continue;const n=Number(i);!Number.isFinite(n)||n<=0||(o+=s*n,t+=n)}return t===0?null:o/t}function U(M={}){const O=M.factor===20?20:10,k=typeof M.suffix=="string"?M.suffix:"",b=Number.isInteger(M.decimals)?M.decimals:1;return{base:"number",storage:"float64",name:M.name||"logarithmic",format:a=>{const g=a&&a.value;return E(g)||!Number.isFinite(Number(g))?"":`${Number(g).toFixed(b)}${k}`},parse:a=>{const g=String((a&&a.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(O),avg:x(O)}}}}function L(M={}){const O=Number.isInteger(M.decimals)?M.decimals:1,k=M.percent===!0;return{base:"number",storage:"float64",name:M.name||"ratio",format:b=>{const a=b&&b.value;return E(a)||!Number.isFinite(Number(a))?"":k?`${Number(a).toFixed(O)}%`:Number(a).toFixed(O)},parse:b=>{const a=String((b&&b.text)??"").replace("%","").trim();if(!a)return null;const g=Number(a);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:L({name:"ratio"}),percentRate:L({name:"percentRate",percent:!0})})}),He("packages/core/src/columns/types/currency.js",function(e,F){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return O}}),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 i}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});const E=F("packages/core/src/internal/predicates.js").isNil,W="⚠ no rate";function I(m){if(E(m))return null;const c=String(m).trim().toUpperCase();return c===""?null:c}function x(m){if(E(m))return null;if(typeof m=="object"&&!Array.isArray(m)){const c=Number(m.amount),l=I(m.code);return!l||!Number.isFinite(c)?null:{amount:c,code:l}}if(Array.isArray(m)&&m.length===2){const c=Number(m[0]),l=I(m[1]);return!l||!Number.isFinite(c)?null:{amount:c,code:l}}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:"₪"}),L=/[+-]?[\d\s., ]*\d/;function q(m,c){const l=String(m).trim();if(l==="")return null;const u=new Intl.NumberFormat(c||void 0).formatToParts(1.1).find(h=>h.type==="decimal")?.value||".",f=u===","?".":",",p=l.split(f).join("").split(/[\s ]/).join("").replace(u,"."),y=Number(p);return Number.isFinite(y)?y:null}function M(m,c){const l=c||{},u=I(l.code);if(E(m))return null;const f=x(m);if(f)return f;if(typeof m=="number")return Number.isFinite(m)&&u?{amount:m,code:u}: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,K]of Object.entries(Q)){if(p.startsWith(V)){h=K,p=p.slice(V.length).trim();break}if(p.endsWith(V)){h=K,p=p.slice(0,-V.length).trim();break}}const d=L.exec(p);if(!d)return null;const w=q(d[0],l.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||u;return P?{amount:y?-w:w,code:P}:null}function O(m,c){if(typeof m=="function")return(l,u)=>{if(l===u)return 1;const f=m(l,u);return typeof f=="number"&&Number.isFinite(f)&&f>0?f:null};if(m&&typeof m=="object"){const l=m;return(u,f)=>{if(u===f)return 1;const p=Number(l[u]),y=Number(l[f]);return!Number.isFinite(p)||!Number.isFinite(y)||p<=0||y<=0?null:y/p}}return(l,u)=>l===u?1:null}function k(m,c,l){if(!m)return null;if(m.code===c)return m.amount;const u=l(m.code,c);return u===null?null:m.amount*u}const b=new Map;function a(m,c,l){const u=`${m||""}|${c}|${l??""}`;let f=b.get(u);if(!f){const p={style:"currency",currency:c};typeof l=="number"&&(p.minimumFractionDigits=l,p.maximumFractionDigits=l);try{f={fmt:new Intl.NumberFormat(m||void 0,p),currency:!0}}catch{f={fmt:new Intl.NumberFormat(m||void 0,typeof l=="number"?{minimumFractionDigits:l,maximumFractionDigits:l}:{}),currency:!1}}b.set(u,f)}return f}function g(m,c){const l=c||{},u=l.nullDisplay??"",f=x(m);if(!f)return u;const p=I(l.display)||f.code;let y=f.amount,h=f.code;if(p!==f.code){const v=l.rateFn||O(l.rates,l.rateBase),P=k(f,p,v);if(P===null)return`${l.missingRate??W} ${f.code}→${p}`;y=P,h=p}const{fmt:d,currency:w}=a(l.locale,h,l.decimals);return w?d.format(y):`${d.format(y)} ${h}`}function o(m){const c=x(m);return c?`${c.amount} ${c.code}`:""}function t(m){const c=m||{},l=I(c.display),u=c.rateFn||O(c.rates,c.rateBase);return(f,p)=>{const y=x(f),h=x(p);if(!y&&!h)return 0;if(!y)return 1;if(!h)return-1;if(l){const d=k(y,l,u),w=k(h,l,u);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 r(m){const c=m||{},l=(f,p)=>{const y=[];for(const P of f||[]){const G=x(P);G&&y.push(G)}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(G=>G.amount)),code:P}}const d=I(c.display);if(!d)return`${c.missingRate??W}: mixed currencies, no display currency set`;const w=c.rateFn||O(c.rates,c.rateBase),v=[];for(const P of y){const G=k(P,d,w);if(G===null)return`${c.missingRate??W}: ${P.code}→${d}`;v.push(G)}return{amount:p(v),code:d}},u=f=>f.reduce((p,y)=>p+y,0);return{sum:f=>l(f,u),avg:f=>l(f,p=>u(p)/p.length),min:f=>l(f,p=>Math.min(...p)),max:f=>l(f,p=>Math.max(...p))}}function s(m){const c=Object.freeze({code:"USD",...m||{}}),l=O(c.rates,c.rateBase),u=Object.freeze({...c,rateFn:l}),f=r(u),p=t(u),y=new Map([[c.locale||"",u]]),h=v=>{const P=v||"";let G=y.get(P);return G||(G=Object.freeze({...u,locale:v||void 0}),y.set(P,G)),G},d=U[I(c.display||c.code)]||"",w=typeof c.decimals=="number"&&c.decimals>0?`.${"0".repeat(c.decimals)}`:".00";return{base:"object",extends:"object",storage:"object",name:"currency",currencyConfig:u,format:v=>g(v.value,v.locale?h(v.locale):u),parse:v=>M(v.text,v.locale?h(v.locale):u),compare:p,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:f},excel:c.excel||(d?`"${d}"#,##0${w}`:`#,##0${w}`),toStorage:v=>{const P=x(v);return P||(typeof v=="string"||typeof v=="number"?M(v,u):null)},toClipboard:v=>o(v),fromClipboard:v=>M(v,u)}}const i=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}),He("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 M}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return O}}),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 a}}),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 c}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return H}});const ie=F("packages/core/src/columns/types/temporal.js"),E=ie.TEMPORAL_TYPES,W=F("packages/core/src/columns/types/network.js"),I=W.NETWORK_TYPES,x=F("packages/core/src/columns/types/vlan.js"),Q=x.VLAN_TYPES,U=F("packages/core/src/columns/types/structured.js"),L=U.STRUCTURED_TYPES,q=F("packages/core/src/columns/types/unit.js"),M=q.createUnitType,O=q.UNIT_SYSTEMS,k=q.parseUnit,b=q.formatUnit,a=q.registerUnitSystem,g=q.unitSystemNames,o=q.unitsOf,t=q.defineUnit,r=F("packages/core/src/columns/types/engineering.js"),s=r.ENGINEERING_TYPES,i=F("packages/core/src/columns/types/si.js"),n=i.SI_TYPES,m=i.createSiType,c=i.createSiSystem,l=i.siUnits,u=i.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"),G=P.createRadixType,V=P.RADIX_PRESETS,K=P.parseRadix,H=P.formatRadix,T=F("packages/core/src/columns/types/aggregable.js"),A=T.AGGREGABLE_TYPES,S=F("packages/core/src/columns/types/currency.js"),R=S.CURRENCY_TYPES,j=S.createCurrencyType,N=S.parseMoney,$=S.formatMoney,_=S.convertMoney,Y=S.toMoney,Z=S.rateFunction,J=S.moneyComparator,D=S.normaliseCode,te=S.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return q.findUnit}}),Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return r.ENGINEERING_TYPES}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return r.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 S.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return S.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return S.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return S.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return S.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return S.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return S.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return S.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return S.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return S.MISSING_RATE}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return ie.TEMPORAL_TYPES}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return W.NETWORK_TYPES}}),Object.defineProperty(e,"VLAN_TYPES",{enumerable:!0,get:function(){return x.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 W.parseIpv4}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return W.formatIpv4}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return W.parseCidr}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return W.formatCidr}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return W.parseIpv6}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return W.formatIpv6}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return W.networkAddress}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return W.broadcastAddress}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return W.hostCount}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return W.containsAddress}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return W.overlaps}}),Object.defineProperty(e,"parseMac",{enumerable:!0,get:function(){return W.parseMac}}),Object.defineProperty(e,"formatMac",{enumerable:!0,get:function(){return W.formatMac}}),Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return W.isMac}}),Object.defineProperty(e,"compareMac",{enumerable:!0,get:function(){return W.compareMac}}),Object.defineProperty(e,"macValue",{enumerable:!0,get:function(){return W.macValue}}),Object.defineProperty(e,"macHex",{enumerable:!0,get:function(){return W.macHex}}),Object.defineProperty(e,"macContains",{enumerable:!0,get:function(){return W.macContains}}),Object.defineProperty(e,"MAC_OPERATORS",{enumerable:!0,get:function(){return W.MAC_OPERATORS}}),Object.defineProperty(e,"parseVlans",{enumerable:!0,get:function(){return x.parseVlans}}),Object.defineProperty(e,"formatVlans",{enumerable:!0,get:function(){return x.formatVlans}}),Object.defineProperty(e,"vlanContains",{enumerable:!0,get:function(){return x.vlanContains}}),Object.defineProperty(e,"vlanOverlaps",{enumerable:!0,get:function(){return x.vlanOverlaps}}),Object.defineProperty(e,"vlanCount",{enumerable:!0,get:function(){return x.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,...L,...A,hex:G(V.hex),hex8:G(V.hex8),hex16:G(V.hex16),hex32:G(V.hex32),binary:G(V.binary),binary8:G(V.binary8),octal:G(V.octal),bytes:M({system:"data",unit:"B",display:"auto"}),megabytes:M({system:"data",unit:"MB"}),gigabytes:M({system:"data",unit:"GB"}),bitrate:M({system:"bitrate",unit:"Mbps"}),gigabits:M({system:"bitrate",unit:"Gbps"}),...s,...n,...p,...R});{const X=new Set;for(const ne of[E,I,Q,L,A,s,n,p,R])for(const re of Object.keys(ne)){if(X.has(re))throw new Error(`[lattice] data type "${re}" is declared twice`);X.add(re)}}}),He("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 M}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return O}}),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 a}}),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 r}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return s}});const ie=F("packages/core/src/internal/compare.js"),E=ie.collator,W=ie.defaultCompare,x=F("packages/core/src/internal/warn.js").warnOnce;function Q(i){const n=new Uint32Array(i);for(let m=0;m<i;m++)n[m]=m;return n}function U(i,n){if(n&&typeof n.count=="number")return n.count;if(!i)return 0;if(typeof i.count=="number")return i.count;if(typeof i.length=="number")return i.length;const m=i.values;return i.kind==="multi"&&i.offsets?Math.max(0,i.offsets.length-1):m?i.kind==="bitset"?typeof m.size=="number"?m.size:i.presence&&typeof i.presence.size=="number"?i.presence.size:(x(`count:${i.id}`,`column "${i.id}" is bitset-backed with no declared row count; assuming ${m.length*8}`),m.length*8):m.length:i.presence&&typeof i.presence.size=="number"?i.presence.size:0}const L=new WeakMap;function q(i){const n=i.constructor;if(!n)return"unknown";const m=L.get(n);if(m)return m;let c="unknown";try{let l=null;typeof n.from=="function"?l=n.from([!1,!0]):(l=new n(8),l.set(1));const u=l&&l.words;u&&u.length&&(u[0]===2?c="lsb":u[0]===64&&(c="msb"))}catch{c="unknown"}return L.set(n,c),c}function M(i){if(!i)return()=>0;const n=i instanceof Uint8Array?i:i.words;if(n instanceof Uint8Array){const m=i instanceof Uint8Array?"lsb":q(i);if(m==="lsb")return c=>n[c>>>3]>>>(c&7)&1;if(m==="msb")return c=>n[c>>>3]>>>7-(c&7)&1}return typeof i.get=="function"?m=>i.get(m)?1:0:()=>0}function O(i){return!i||!i.presence?null:M(i.presence)}function k(i){return i?typeof i.size=="number"?i.size:typeof i.values=="function"?i.values().length:0:0}function b(i,n){return i?typeof i.valueOf=="function"?i.valueOf(n):typeof i.values=="function"?i.values()[n]:null:null}function a(i,n){const m=i.offsets,c=i.values;if(!m||!c)return[];const l=m[n],u=m[n+1];if(!(u>l))return[];const f=i.dict,p=new Array(u-l);for(let y=l;y<u;y++)p[y-l]=f?b(f,c[y]):c[y];return p}function g(i){if(!i)return()=>{};const n=i.values,m=O(i),c=i.kind;if(c==="dictionary"){const l=i.dict;return m?u=>m(u)?b(l,n[u]):null:u=>b(l,n[u])}if(c==="bitset"){const l=M(n);return m?u=>m(u)?l(u)===1:null:u=>l(u)===1}if(c==="multi")return m?l=>m(l)?a(i,l):null:l=>a(i,l);if(!n&&typeof i.get=="function"){const l=i.get.bind(i);return u=>{const f=l(u);return f===void 0?null:f}}return m?l=>{if(!m(l))return null;const u=n[l];return u===void 0?null:u}:l=>{const u=n[l];return u===void 0?null:u}}function o(i,n){if(i<n)return-1;if(i>n)return 1;if(i===n){const l=Object.is(i,-0),u=Object.is(n,-0);return l===u?0:l?-1:1}const m=Number.isNaN(i),c=Number.isNaN(n);return m&&c?0:m?1:-1}function t(i){const n=E(i);return(m,c)=>{if(m===c)return 0;const l=typeof m,u=typeof c;if(l==="string"&&u==="string")return n.compare(m,c);if(l==="number"&&u==="number")return o(m,c);if(l==="boolean"&&u==="boolean")return m===c?0:m?1:-1;if(m instanceof Date||c instanceof Date){const f=m instanceof Date?m.getTime():Number(m),p=c instanceof Date?c.getTime():Number(c);return o(f,p)}return W(m,c)}}function r(i,n){if(i&&typeof i.ranks=="function")return i.ranks(n);const m=i&&typeof i.values=="function"?i.values():[],c=m.length,l=t(n),u=new Array(c);for(let p=0;p<c;p++)u[p]=p;u.sort((p,y)=>l(m[p],m[y])||p-y);const f=new Uint32Array(c);for(let p=0;p<c;p++)f[u[p]]=p;return f}function s(i){return i==null||typeof i=="number"&&Number.isNaN(i)}}),He("packages/core/src/compute/filter.js",function(e,F){"use strict";Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"wallMs",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return j}}),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 re}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(e,"declaredOperatorFor",{enumerable:!0,get:function(){return be}});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"),L=U.toDate,q=U.toIsoDate,M=F("packages/core/src/compute/handle.js"),O=M.bitReader,k=M.dictSize,b=M.dictValue,a=M.presenceReader,g=M.valueComparator,o=M.valueReader,t=/^\d{4}-\d{2}-\d{2}$/,r="\0null\0";function s(se,de){const oe=se&&se.pool;if(oe){const ce=oe.mask||oe.acquireMask||oe.acquire||oe.take;if(typeof ce=="function"){const he=ce.call(oe,de);if(he&&he.length>=de)return he}}return new Uint8Array(de)}function i(se,de){const oe=se&&se.pool;if(!oe||!de)return;const ce=oe.release||oe.releaseMask||oe.free||oe.recycle;typeof ce=="function"&&ce.call(oe,de)}function n(se,de,oe){return se.fill(oe,0,de),se}function m(se){return se==null||typeof se=="number"&&Number.isNaN(se)}function c(se,de){if(se==null)return se;if(de==="number")return typeof se=="number"?se:Number(se);if(de==="date"||de==="dateString"){const oe=q(se);return oe===null?l(se):oe}return de==="boolean"?typeof se=="boolean"?se:se==="true"||se===1?!0:se==="false"||se===0?!1:!!se:se}function l(se){return se instanceof Date?se.getTime():typeof se=="number"?se:Date.parse(String(se))}function u(se){return typeof se=="number"?se:se instanceof Date?se.getTime():se==null||se===""?NaN:Number(se)}function f(se,de){const oe=typeof se=="string"?se:String(se);return de?oe:oe.toLowerCase()}function p(se,de){return se==null?r:typeof se=="string"?de?se:se.toLowerCase():se instanceof Date?se.getTime():se}function y(se,de,oe){const ce=new Set;for(const he of I(se)){const Oe=c(he,oe);ce.add(p(Oe,de)),typeof Oe=="string"&&Oe!==""&&Number.isFinite(Number(Oe))?ce.add(Number(Oe)):typeof Oe=="number"&&Number.isFinite(Oe)&&ce.add(p(String(Oe),de))}return ce}function h(se,de,oe){if(se==null||de===null||de===void 0)return se==null&&de==null;const ce=typeof se,he=typeof de;return ce==="string"&&he==="string"?oe?se===de:se.toLowerCase()===de.toLowerCase():se instanceof Date||de instanceof Date?l(se)===l(de):ce==="number"&&he==="number"?se===de||Number.isNaN(se)&&Number.isNaN(de):ce==="number"&&he==="string"?se===Number(de):ce==="string"&&he==="number"?Number(se)===de:ce==="boolean"||he==="boolean"?se===de:Array.isArray(se)&&Array.isArray(de)?se.length===de.length&&se.every((Oe,Se)=>h(Oe,de[Se],oe)):se===de}function d(se,de){try{if(se instanceof RegExp){const oe=se.flags.replace(/[gy]/g,"");return new RegExp(se.source,de||oe.includes("i")?oe:`${oe}i`)}return new RegExp(String(se),de?"":"i")}catch(oe){return Q(`regex:${String(se)}`,`filter operator "matches" received an invalid pattern: ${String(se)}`,oe),null}}function w(se,de){if(se&&se.type==="datetime"&&v.has(se.op))return H(se,de);const oe=T(se,de),ce=se&&se.type;return ce!=="date"&&ce!=="dateString"?oe:he=>oe(typeof he=="string"&&t.test(he)?he:q(he)??he)}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*)?)?)?$/,G=new Map;function V(se,de){let oe=G.get(de);if(oe===void 0){try{oe=new Intl.DateTimeFormat("en-CA",{timeZone:de,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{oe=null}G.set(de,oe)}if(!oe)return null;const ce={};for(const he of oe.formatToParts(se))he.type!=="literal"&&(ce[he.type]=he.value);return ce}function K(se,de){if(se==null||se==="")return null;if(typeof se=="string"){const Oe=P.exec(se.trim());if(Oe)return Date.UTC(+Oe[1],+Oe[2]-1,+Oe[3],+(Oe[4]||0),+(Oe[5]||0),+(Oe[6]||0),+(Oe[7]||"0").padEnd(3,"0"))}const oe=L(se);if(!oe)return null;const ce=oe.getUTCMilliseconds(),he=de?V(oe,de):null;return he?Date.UTC(+he.year,+he.month-1,+he.day,he.hour==="24"?0:+he.hour,+he.minute,+he.second,ce):Date.UTC(oe.getFullYear(),oe.getMonth(),oe.getDate(),oe.getHours(),oe.getMinutes(),oe.getSeconds(),ce)}function H(se,de){const oe=typeof se.timeZone=="string"&&se.timeZone?se.timeZone:void 0,ce=Se=>K(Se,oe),he=Array.isArray(se.value)?se.value.map(ce):ce(se.value),Oe=T({...se,type:"number",value:he},de);return Se=>Oe(K(Se))}function T(se,de){const oe=se&&se.op,ce=!!(se&&se.caseSensitive),he=se&&se.type,Oe=g(de),Se=Ce=>Ie=>!Ce(Ie);switch(oe){case"eq":{const Ce=be(he,"eq");if(Ce)return Ce.compile(se.value);const Ie=c(se.value,he);return ke=>h(ke,Ie,ce)}case"ne":{const Ce=be(he,"ne");if(Ce)return Ce.compile(se.value);const Ie=c(se.value,he);return ke=>!h(ke,Ie,ce)}case"lt":case"lte":case"gt":case"gte":{const Ce=c(se.value,he);if(m(Ce))return()=>!1;const Ie=oe==="lt"?-1:oe==="lte"?0:oe==="gt"?1:2;return ke=>{if(m(ke))return!1;const _e=Oe(ke,Ce);return Ie===-1?_e<0:Ie===0?_e<=0:Ie===1?_e>0:_e>=0}}case"between":case"notBetween":{const Ce=I(se.value),Ie=c(Ce[0],he),ke=c(Ce[1],he),_e=se.bounds||"[]",Te=_e.charAt(0)!=="(",je=_e.charAt(1)!==")";if(m(Ie)||m(ke))return oe==="between"?()=>!1:()=>!0;const Ae=Ee=>{if(m(Ee))return!1;const Me=Oe(Ee,Ie),Be=Oe(Ee,ke);return(Te?Me>=0:Me>0)&&(je?Be<=0:Be<0)};return oe==="between"?Ae:Se(Ae)}case"in":case"notIn":{const Ce=y(se.value,ce,he),Ie=ke=>Ce.has(p(ke,ce));return oe==="in"?Ie:Se(Ie)}case"contains":case"notContains":{const Ce=be(he,oe);if(Ce)return Ce.compile(se.value);const Ie=f(c(se.value,he),ce),ke=_e=>_e==null?!1:f(_e,ce).includes(Ie);return oe==="contains"?ke:Se(ke)}case"startsWith":{const Ce=be(he,"startsWith");if(Ce)return Ce.compile(se.value);const Ie=f(c(se.value,he),ce);return ke=>ke==null?!1:f(ke,ce).startsWith(Ie)}case"endsWith":{const Ce=be(he,"endsWith");if(Ce)return Ce.compile(se.value);const Ie=f(c(se.value,he),ce);return ke=>ke==null?!1:f(ke,ce).endsWith(Ie)}case"matches":{const Ce=d(se.value,ce);return Ce?Ie=>Ie==null?!1:Ce.test(String(Ie)):()=>!1}case"blank":case"notBlank":{const Ce=se.trim===!0,Ie=ke=>E(ke)||Array.isArray(ke)&&ke.length===0||Ce&&typeof ke=="string"&&ke.trim()==="";return oe==="blank"?Ie:ke=>!Ie(ke)}case"containsAny":case"containsNone":{const Ce=y(se.value,ce,he),Ie=ke=>{const _e=ke==null?[]:I(ke);for(let Te=0;Te<_e.length;Te++)if(Ce.has(p(_e[Te],ce)))return!0;return!1};return oe==="containsAny"?Ie:Se(Ie)}case"containsAll":{const Ce=I(se.value).map(Ie=>p(c(Ie,he),ce));return Ie=>{const ke=Ie==null?[]:I(Ie);if(Ce.length===0)return!0;const _e=new Set(ke.map(Te=>p(Te,ce)));for(let Te=0;Te<Ce.length;Te++)if(!_e.has(Ce[Te]))return!1;return!0}}default:{const Ce=$e(oe);return Ce?Ce.compile(se.value):(Q(`op:${String(oe)}`,`unknown filter operator "${String(oe)}"; the condition is refused rather than matching every row`),()=>!1)}}}function A(se,de,oe){return w(de,oe)(se)}const S=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),R=new Set(["containsAny","containsAll","containsNone"]);function j(se,de,oe){const ce=se&&se.op,he=S[ce]||ce,Oe=w({...se,op:he,type:de.type},oe),Se=de.items,Ce=Ie=>{const ke=Se(Ie);if(!ke)return!1;for(let _e=0;_e<ke.length;_e++)if(Oe(ke[_e]))return!0;return!1};return S[ce]?Ie=>!Ce(Ie):Ce}function N(se,de,oe,ce,he){const Oe=he?null:a(se);if(Oe){const Ie=de?1:0;for(let ke=0;ke<ce;ke++)oe[ke]=Oe(ke)===Ie?1:0;return oe}const Se=se.kind;if(Se==="float64"||Se==="int32"||Se==="bitset")return n(oe,ce,de?1:0);const Ce=o(se);for(let Ie=0;Ie<ce;Ie++){const ke=Ce(Ie),_e=E(ke)||Array.isArray(ke)&&ke.length===0||he&&typeof ke=="string"&&ke.trim()==="";oe[Ie]=_e===de?0:1}return oe}function $(se,de,oe,ce){const he=se.dict,Oe=k(he),Se=new Uint8Array(Oe);for(let _e=0;_e<Oe;_e++)Se[_e]=de(b(he,_e))?1:0;const Ce=se.values,Ie=a(se);if(!Ie){for(let _e=0;_e<ce;_e++)oe[_e]=Se[Ce[_e]];return oe}const ke=de(null)?1:0;for(let _e=0;_e<ce;_e++)oe[_e]=Ie(_e)===1?Se[Ce[_e]]:ke;return oe}function _(se,de,oe,ce){const he=O(se.values),Oe=de(!0)?1:0,Se=de(!1)?1:0,Ce=a(se);if(!Ce){for(let ke=0;ke<ce;ke++)oe[ke]=he(ke)===1?Oe:Se;return oe}const Ie=de(null)?1:0;for(let ke=0;ke<ce;ke++)oe[ke]=Ce(ke)===0?Ie:he(ke)===1?Oe:Se;return oe}function Y(se,de,oe,ce,he){const Oe=se.values,Se=de.type,Ce=de.op;let Ie=!0;switch(Ce){case"eq":case"ne":{const _e=u(c(de.value,Se)),Te=typeof de.value=="number"&&Number.isNaN(de.value),je=Ce==="ne"?1:0;if(Te)for(let Ae=0;Ae<he;Ae++)ce[Ae]=(Number.isNaN(Oe[Ae])?1:0)^je;else for(let Ae=0;Ae<he;Ae++)ce[Ae]=(Oe[Ae]===_e?1:0)^je;break}case"lt":{const _e=u(c(de.value,Se));for(let Te=0;Te<he;Te++)ce[Te]=Oe[Te]<_e?1:0;break}case"lte":{const _e=u(c(de.value,Se));for(let Te=0;Te<he;Te++)ce[Te]=Oe[Te]<=_e?1:0;break}case"gt":{const _e=u(c(de.value,Se));for(let Te=0;Te<he;Te++)ce[Te]=Oe[Te]>_e?1:0;break}case"gte":{const _e=u(c(de.value,Se));for(let Te=0;Te<he;Te++)ce[Te]=Oe[Te]>=_e?1:0;break}case"between":case"notBetween":{const _e=I(de.value),Te=u(c(_e[0],Se)),je=u(c(_e[1],Se)),Ae=de.bounds||"[]",Ee=Ae.charAt(0)!=="(",Me=Ae.charAt(1)!==")",Be=Ce==="notBetween"?1:0;if(Ee&&Me)for(let Ke=0;Ke<he;Ke++)ce[Ke]=(Oe[Ke]>=Te&Oe[Ke]<=je?1:0)^Be;else if(Ee)for(let Ke=0;Ke<he;Ke++)ce[Ke]=(Oe[Ke]>=Te&Oe[Ke]<je?1:0)^Be;else if(Me)for(let Ke=0;Ke<he;Ke++)ce[Ke]=(Oe[Ke]>Te&Oe[Ke]<=je?1:0)^Be;else for(let Ke=0;Ke<he;Ke++)ce[Ke]=(Oe[Ke]>Te&Oe[Ke]<je?1:0)^Be;break}case"in":case"notIn":{const _e=new Set;for(const je of I(de.value)){const Ae=u(c(je,Se));Number.isNaN(Ae)||_e.add(Ae)}const Te=Ce==="notIn"?1:0;for(let je=0;je<he;je++)ce[je]=(_e.has(Oe[je])?1:0)^Te;break}default:Ie=!1;break}if(!Ie)return!1;const ke=a(se);if(ke){const _e=oe(null)?1:0;for(let Te=0;Te<he;Te++)ke(Te)===0&&(ce[Te]=_e)}return!0}function Z(se,de,oe,ce){const he=o(se);for(let Oe=0;Oe<ce;Oe++)oe[Oe]=de(he(Oe))?1:0;return oe}function J(se,de){if(!se||!we.has(se.op))return se;const oe=de&&de.typeOf;if(typeof oe!="function")return se;const ce=oe(se.col);return typeof ce!="string"||!ce||ce===se.type?se:{...se,type:ce}}function D(se,de,oe){const ce=de.count|0,he=oe||s(de,ce);if(!se)return n(he,ce,1);const Oe=typeof de.handle=="function"?de.handle(se.col):void 0,Se=typeof de.custom=="function"?de.custom:null;if(!Oe){if(Se){for(let _e=0;_e<ce;_e++)he[_e]=Se(se,_e)?1:0;return he}return Q(`filter:col:${String(se.col)}`,`filter references unknown column "${String(se.col)}"; the condition is refused rather than matching every row`),n(he,ce,0)}const Ce=se.op;if(Ce==="blank"||Ce==="notBlank")return N(Oe,Ce==="notBlank",he,ce,se.trim===!0);const Ie=typeof de.itemwise=="function"?de.itemwise(se.col):null;if(Ie&&!$e(Ce)&&!R.has(Ce))return Z(Oe,j(se,Ie,de.locale),he,ce);const ke=w(J(se,de),de.locale);switch(Oe.kind){case"dictionary":return $(Oe,ke,he,ce);case"bitset":return _(Oe,ke,he,ce);case"float64":case"int32":return Y(Oe,se,ke,he,ce)?he:Z(Oe,ke,he,ce);default:return Z(Oe,ke,he,ce)}}function te(se,de,oe){if(!se)return n(s(de,oe),oe,1);if(Array.isArray(se.conditions)){const ce=se.conditions.filter(Se=>Se!=null),he=se.op==="or"?"or":se.op==="not"?"not":"and";if(ce.length===0)return n(s(de,oe),oe,1);const Oe=te(ce[0],de,oe);for(let Se=1;Se<ce.length;Se++){const Ce=te(ce[Se],de,oe);if(he==="or")for(let Ie=0;Ie<oe;Ie++)Oe[Ie]|=Ce[Ie];else for(let Ie=0;Ie<oe;Ie++)Oe[Ie]&=Ce[Ie];i(de,Ce)}if(he==="not")for(let Se=0;Se<oe;Se++)Oe[Se]^=1;return Oe}return D(se,de,s(de,oe))}function z(se,de){return te(se,de,de.count|0)}function X(se,de){if(!se||!de)return se||null;const oe=se;if(Array.isArray(oe.conditions)){if((oe.op==="or"?"or":oe.op==="not"?"not":"and")!=="and")return ne(oe,de)?null:se;const he=[];for(const Oe of oe.conditions){const Se=X(Oe,de);Se&&he.push(Se)}return he.length?{...oe,op:"and",conditions:he}:null}return oe.col===de?null:se}function ne(se,de){if(!se||typeof se!="object")return!1;const oe=se;if(oe.col===de)return!0;if(Array.isArray(oe.conditions)){for(const ce of oe.conditions)if(ne(ce,de))return!0}return!1}function re(se,de,oe){if(oe&&oe.length>=de){let Se=0;for(let Ce=0;Ce<de;Ce++)se[Ce]&&(oe[Se++]=Ce);return oe.subarray(0,Se)}let ce=0;for(let Se=0;Se<de;Se++)ce+=se[Se]?1:0;const he=new Uint32Array(ce);let Oe=0;for(let Se=0;Se<de;Se++)se[Se]&&(he[Oe++]=Se);return he}const ae=new Map,fe=new Map,we=new Set,ve=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn","contains","notContains","startsWith","endsWith","matches","blank","notBlank","containsAny","containsAll","containsNone"]);function Re(se,de){if(!se||typeof se!="object")return;const oe=Object.entries(se).filter(([,ce])=>ce&&typeof ce.compile=="function");if(typeof de=="string"&&de){let ce=fe.get(de);ce||(ce=new Map,fe.set(de,ce));for(const[he,Oe]of oe)ce.set(he,Oe)}for(const[ce,he]of oe)ve.has(ce)?we.add(ce):ae.set(ce,he)}function $e(se){return typeof se=="string"?ae.get(se):void 0}function be(se,de){if(typeof se!="string"||typeof de!="string")return;const oe=fe.get(se);return oe?oe.get(de):void 0}}),He("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 H}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return N}});const ie=F("packages/core/src/internal/compare.js"),E=ie.collator,W=ie.defaultCompare,I=F("packages/core/src/internal/predicates.js"),x=I.isNil,Q=I.isObject,U=I.isFunction,L=F("packages/core/src/internal/warn.js"),q=L.fail,M=L.infoOnce,k=F("packages/core/src/internal/text.js").titleCase,b=F("packages/core/src/format/date.js"),a=b.toDate,g=b.toIsoDate,o=b.compareIso,r=F("packages/core/src/format/boolean.js").toTriState,i=F("packages/core/src/columns/types/index.js").EXTENDED_TYPES,n=F("packages/core/src/formula/index.js"),m=n.evaluateFormula,c=n.looksLikeFormula,u=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 _=$||"",Y=y.get(_);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(_,Z),Z}const d=/\d\s*[*/^]\s*[\d.(]/;function w($,_){if(x($))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(_);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($,_){const Y=x($)||Number.isNaN($)?null:Number($),Z=x(_)||Number.isNaN(_)?null:Number(_);return Y===null?Z===null?0:1:Z===null||Y<Z?-1:Y>Z?1:0}function P($,_){const Y=r($),Z=r(_);return Y===null?Z===null?0:1:Z===null?-1:Y===Z?0:Y?1:-1}function G($,_){const Y=a($),Z=a(_);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 K($){const _=a($.value);if(!_)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(_)}const H={boolean:{base:"boolean",storage:"bitset",matches:$=>typeof $=="boolean",parse:$=>r($.text),compare:P,format:$=>r($.value)===null?"":r($.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:$=>r($)===null?"":String(r($)),fromClipboard:$=>r($)},number:{base:"number",storage:"float64",matches:$=>typeof $=="number"&&!Number.isNaN($),parse:$=>{if(c($.text)){const _=m($.text,$);if(!_.ok)return null;const Y=Number(_.value);return Number.isFinite(Y)?Y:null}return w($.text,$.locale)},compare:v,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:$=>x($)?"":String($),fromClipboard:($,_)=>w($,_&&_.locale),toStorage:($,_)=>{if(typeof $!="string")return $;const Y=w($,_&&_.locale);return Y!==null?Y:(M(`type.number.unparsed.${_&&_.colId||""}`,`column "${_&&_.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:K,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:$=>g($),toClipboard:$=>x($)?"":String($),fromClipboard:$=>g($)},dateString:{base:"dateString",storage:"dictionary",matches:$=>typeof $=="string"&&f.test($)&&!Number.isNaN(Date.parse($)),parse:$=>g($.text),compare:o,format:K,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:$=>g($),toClipboard:$=>x($)?"":String($),fromClipboard:$=>g($)},text:{base:"text",storage:"dictionary",matches:$=>typeof $=="string",parse:$=>$.text===""?null:String($.text),compare:($,_)=>x($)?x(_)?0:1:x(_)?-1:E().compare(String($),String(_)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:$=>x($)?"":String($),fromClipboard:$=>$},image:{base:"text",storage:"dictionary",parse:$=>$.text===""||$.text==null?null:String($.text).trim(),compare:($,_)=>x($)?x(_)?0:1:x(_)?-1:E().compare(String($),String(_)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:$=>x($)?"":String($),fromClipboard:$=>$},lookup:{base:"text",storage:"dictionary",parse:$=>{if($.text===""||$.text==null)return null;const _=$.column&&$.column.lookup,Y=_&&U(_.options)?_.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:W,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:$=>x($)?"":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:($,_)=>W($,_),format:$=>{const _=$.value;if(x(_))return"";if(typeof _=="string")return _;try{return JSON.stringify(_)}catch{return String(_)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:$=>x($)?"":typeof $=="string"?$:JSON.stringify($),fromClipboard:$=>$}},T=["boolean","number","date","dateString","datetime","text","object"];function A($,_,Y,Z){const J=Y.get($);if(J)return J;Z.includes($)&&q(`circular data type extends chain: ${[...Z,$].join(" → ")}`);const D=_[$];D||q(`unknown data type "${$}"`);let te=null;D.extends&&(te=A(D.extends,_,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 S($,_){const Y={...H,...i};if(_&&typeof _.dataType=="function"&&typeof _.names=="function")for(const J of _.names("dataType")){const D=_.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)A(J,Y,Z,[]);A("lookup",Y,Z,[]);for(const J of Object.keys(Y))A(J,Y,Z,[]);for(const J of Z.values())u(J.operators,J.name);return Z}function R($,_){if($.base==="text"&&(!$.compare||$.compare===H.text.compare)){const Y=E(_);return(Z,J)=>x(Z)?x(J)?0:1:x(J)?-1:Y.compare(String(Z),String(J))}return $.compare||W}function j($,_){return _?$.multiStorage||"multi":$.storage||"object"}function N($){return k(String($).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),He("packages/core/src/columns/infer.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_SAMPLE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"inferFromValues",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return U}});const E=F("packages/core/src/internal/warn.js").infoOnce,I=F("packages/core/src/internal/predicates.js").isNil,x=100;function Q(L,q,M={}){const O=M.sampleSize??x,k=[];for(let b=0;b<L.length&&k.length<O;b++){const a=L[b];I(a)||typeof a=="number"&&Number.isNaN(a)||k.push(a)}if(k.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[b,a]of q){if(typeof a.matches!="function")continue;let g=!0;for(let o=0;o<k.length;o++)if(!a.matches(k[o])){g=!1;break}if(g)return{type:b,unanimous:!0,sampled:k.length}}return M.quiet||E(`infer:${M.colId||"?"}`,`column "${M.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(L,q,M,O,k={}){const b=k.sampleSize??x,a=[];for(let g=0;g<q.length&&a.length<b;g++){const o=M(q[g]);I(o)||typeof o=="number"&&Number.isNaN(o)||a.push(o)}return Q(a,O,{...k,colId:L}).type}}),He("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 L}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return O}});const ie=F("packages/core/src/internal/warn.js"),E=ie.DEV,W=ie.fail,I=ie.warnOnce,Q=F("packages/core/src/internal/predicates.js").isFunction,U="*";function L(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 u of k)b.set(u.id,u);const a=new Map,g=new Map,o=new Set,t=new Set,r=new Set,s=new Set;for(const u of k){const f=L(u);if(!f.computed){a.set(u.id,[]);continue}t.add(u.id),(f.pure?r:s).add(u.id),f.wholeRow&&o.add(u.id);const p=[],y=[];for(const h of f.deps)(b.has(h)?p:y).push(h);a.set(u.id,p),y.length&&g.set(u.id,y)}for(const u of r)for(const f of a.get(u))s.has(f)&&W(`pure computed column "${u}" depends on impure column "${f}". Mark it \`value.pure: false\` or make the dependency pure.`);const i=[],n=new Map,m=[],c=u=>{const f=n.get(u);if(f!=="done"){if(f==="open"){const p=m.indexOf(u);W(`circular column dependency: ${[...m.slice(p),u].join(" → ")}`)}n.set(u,"open"),m.push(u);for(const p of a.get(u)||[])b.has(p)&&c(p);m.pop(),n.set(u,"done"),i.push(u)}};for(const u of k)c(u.id);const l=new Map;for(const u of k)l.set(u.id,[]);for(const u of k)for(const f of a.get(u.id)||[]){const p=l.get(f);p&&!p.includes(u.id)&&p.push(u.id)}if(o.size)for(const u of k){if(t.has(u.id))continue;const f=l.get(u.id);for(const p of o)f.includes(p)||f.push(p)}return{order:i,dependents:l,pure:r,impure:s,computed:t,deps:a,wholeRow:o,external:g,index:b}}function M(k,b){const a=Array.isArray(b)?b:[b],g=new Set,o=[...a];for(;o.length;){const t=o.shift();for(const r of k.dependents.get(t)||[])g.has(r)||(g.add(r),o.push(r))}for(const t of a)g.delete(t);return k.order.filter(t=>g.has(t))}function O(k,b,a){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:${a}:${t}`,`computed column "${a}" read undeclared dependency "${t}". Add it to \`value.deps\` or the value will go stale.`),o[t]}})}}),He("packages/core/src/model/rowkey.js",function(e,F){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"compositeKey",{enumerable:!0,get:function(){return O}}),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,x=F("packages/core/src/internal/predicates.js"),Q=x.isFunction,U=x.isBlank,L=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],q="";function M(r){if(r===null)return"\0n";if(r===void 0)return"\0u";const s=typeof r;if(s==="string")return r;if(s==="number"||s==="bigint"||s==="boolean")return String(r);if(r instanceof Date)return`\0d${r.getTime()}`;try{return`\0o${JSON.stringify(r)}`}catch{return"\0o?"}}function O(r){if(r.length===1)return M(r[0]);let s="";for(let i=0;i<r.length;i++)i&&(s+=q),s+=M(r[i]);return s}function k(r,s={}){const i=s.warn!==!1;if(Q(r)){const n=r;return{stable:!0,fields:[],disabled:[],key(m,c){try{const l=n(m);return Array.isArray(l)?O(l):M(l)}catch(l){return E("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",l),`#${c??-1}`}},keyEmpty(m){try{const c=n(m);return Array.isArray(c)?c.length===0||c.some(U):U(c)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(r)&&r.length>0){const n=r.filter(l=>typeof l=="string"),m=n.map(l=>I(l)),c=m.length;return{stable:!0,fields:n,disabled:[],key(l){const u=new Array(c);for(let f=0;f<c;f++)u[f]=m[f](l);return O(u)},keyEmpty(l){for(let u=0;u<c;u++)if(U(m[u](l)))return!0;return!1},missingFields(l){const u=[];for(let f=0;f<c;f++)U(m[f](l))&&u.push(n[f]);return u}}}if(typeof r=="string"&&r.length>0){const n=I(r);return{stable:!0,fields:[r],disabled:[],key(m){return M(n(m))},keyEmpty(m){return U(n(m))},missingFields(m){return U(n(m))?[r]:[]}}}return i&&E("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${L.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:L.slice(),key(n,m){if(n===null||typeof n!="object")return`#${m??0}:${String(n)}`;let c=b.get(n);return c===void 0&&(c=`#${a++}`,b.set(n,c)),c}}}const b=new WeakMap;let a=0;function g(r,s){if(!r||r.stable===!1||!Q(r.keyEmpty)||!Array.isArray(s)||s.length===0)return;let i=0,n=null,m;for(let f=0;f<s.length;f++){const p=s[f];r.keyEmpty(p)&&(i++,n===null&&(n=Q(r.missingFields)?r.missingFields(p):[],m=p))}if(i===0)return;const c=r.fields.length?r.fields.join(","):"(function)",l=n&&n.length?n.join(", "):r.fields.length?r.fields.join(", "):"the rowKey function",u=m!==null&&typeof m=="object"?Object.keys(m).join(", ")||"(no fields)":String(m);E(`rowKey.emptyValue:${c}`,`rowKey ${l} is missing on ${i} of ${s.length} rows; the first such row has: ${u}. 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(r){return O(r)}function t(r){return r.split(q)}}),He("packages/core/src/columns/lookup.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_SEPARATOR",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"normaliseOption",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return a}}),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 r}});const ie=F("packages/core/src/internal/compare.js"),E=ie.collator,W=ie.defaultCompare,I=F("packages/core/src/internal/predicates.js"),x=I.isFunction,Q=I.isNil,L=F("packages/core/src/internal/warn.js").warnOnce,M=F("packages/core/src/model/rowkey.js").compositeKey,O=", ",k="";function b(s,i,n,m){if(s===null||typeof s!="object")return{id:s,label:s==null?"":String(s)};const c=s[i],l=s[n],u={id:c,label:l==null?String(c??""):String(l)};s.disabled&&(u.disabled=!0),s.variant&&(u.variant=s.variant),s.icon&&(u.icon=s.icon);const f=m?s[m]:s.group;return f!==void 0&&(u.group=f),u}function a(s,i,n=0,m=[],c=[]){for(const l of s||[]){const u=l&&typeof l=="object"?l[i]:null;if(c.push({raw:l,depth:n,path:m}),Array.isArray(u)&&u.length){const f=String(l&&typeof l=="object"?l.label??l.name??l.id??"":l);a(u,i,n+1,[...m,f],c)}}return c}function g(s){return!!s&&typeof s=="object"&&!Array.isArray(s)&&x(s.router&&s.router.subscribe)}class o{#e;#t;#n;#r;#i=[];#s=new Map;#o=new Map;#l=0;#a="idle";#c=null;#u;#f=null;#d=new Map;constructor(i,n={}){this.#e=i||{},this.#t=n.colId||"?",this.#n=n.locale,this.#r=n.onChange||null,this.#u=E(this.#n),Array.isArray(this.#e.options)?this.#h(this.#e.options):this.#e.options===void 0&&(this.#a="ready")}get colId(){return this.#t}get version(){return this.#l}get state(){return this.#a}get ready(){return this.#a==="ready"}get multiple(){return this.#e.multiple===!0}get separator(){return this.#e.separator??O}get allowCustom(){return this.#e.allowCustom===!0}get sortBy(){return this.#e.sortBy||"label"}get spec(){return this.#e}options(){return this.#i}setLocale(i){this.#n=i,this.#u=E(i)}#h(i){const n=this.#e,m=n.valueKey||"id",c=n.labelKey||"label",l=n.childrenKey||"children";this.#i=a(i,l).map(u=>{const f=b(u.raw,m,c,n.groupKey);return u.depth&&(f.depth=u.depth,f.path=u.path),f}),this.#s=new Map,this.#o=new Map,this.#i.forEach((u,f)=>{this.#s.set(u.id,u),this.#o.set(u.id,f)}),this.#a="ready",this.#l+=1}load(){if(this.#c)return this.#c;const i=this.#e.options;if(Array.isArray(i)||i===void 0)return this.#c=Promise.resolve(this.#i),this.#c;if(g(i))return this.#c=this.#p(i),this.#c;if(!x(i))return L(`lookup:options:${this.#t}`,`column "${this.#t}" has an invalid \`lookup.options\`; expected an array, a function, or a router route`),this.#a="ready",this.#c=Promise.resolve([]),this.#c;this.#a="loading";let n;try{n=i()}catch(m){return this.#a="error",L(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,m),this.#c=Promise.resolve([]),this.#c}return!n||!x(n.then)?(this.#h(n),this.#c=Promise.resolve(this.#i),this.#r&&this.#r(this),this.#c):(this.#c=n.then(m=>(this.#h(m),this.#r&&this.#r(this),this.#i),m=>(this.#a="error",L(`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(i){if(this.#f)return Promise.resolve(this.#i);const n=this.#e,m=n.valueKey||"id",c=n.labelKey||"label",l=n.groupKey,u=x(i.map)?i.map:null,f=y=>b(u?u(y):y,m,c,l).id,p=y=>this.#m(y,u,m,c,l);return i.router.subscribe(i.predicate,p,{rowKey:f}),this.#f=()=>{x(i.router.detach)&&i.router.detach(p)},this.#a="ready",Promise.resolve(this.#i)}#m(i,n,m,c,l){const u=i&&i.add||[],f=i&&i.update||[],p=i&&i.remove||[];if(!(!u.length&&!f.length&&!p.length)){for(const y of u)this.#g(y,n,m,c,l);for(const y of f)this.#g(y,n,m,c,l);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.#o=new Map(this.#i.map((y,h)=>[y.id,h])),this.#a="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(i,n,m,c,l){const u=b(n?n(i):i,m,c,l);this.#d.set(M([u.id]),u.id);const f=this.#i.findIndex(p=>p.id===u.id);f>=0?this.#i[f]=u:this.#i.push(u),this.#s.set(u.id,u)}destroy(){this.#f&&(this.#f(),this.#f=null)}search(i,n){const m=this.#e;if(!x(m.search)){const u=String(i||"").toLowerCase();return Promise.resolve(u===""?this.#i:this.#i.filter(f=>f.label.toLowerCase().includes(u)))}const c=m.valueKey||"id",l=m.labelKey||"label";return Promise.resolve(m.search(i,n)).then(u=>(u||[]).map(f=>b(f,c,l,m.groupKey)))}option(i){return this.#s.get(i)}has(i){return this.#s.has(i)}label(i){if(Q(i)||i==="")return"";const n=this.#s.get(i);if(n)return n.label;if(this.#a==="loading"||this.#a==="idle")return"";this.allowCustom||L(`lookup:unknown:${this.#t}`,`column "${this.#t}" holds value ${JSON.stringify(i)} which is not in its lookup options. Showing the raw value; set \`lookup.unknownLabel\` or \`lookup.allowCustom\` to change that.`);const m=this.#e.unknownLabel;return x(m)?String(m(i)??""):typeof m=="string"?m:String(i)}text(i){if(this.multiple){const n=t(i);return n.length===0?"":n.map(m=>this.label(m)).join(this.separator)}return this.label(i)}dictionary(){return this.#i.map(i=>i.id)}sorted(){const i=this.sortBy;if(i==="optionOrder"||i==="count")return this.#i.slice();if(i==="value")return this.#i.slice().sort((m,c)=>W(m.id,c.id));const n=this.#u;return this.#i.slice().sort((m,c)=>n.compare(m.label,c.label))}comparator(){const i=this.sortBy,n=this.multiple,m=this.#u,c=this.#o;if(n&&i==="count")return(u,f)=>t(u).length-t(f).length;const l=n?u=>t(u)[0]:u=>u;return i==="value"?(u,f)=>W(l(u),l(f)):i==="optionOrder"?(u,f)=>{const p=c.has(l(u))?c.get(l(u)):Number.MAX_SAFE_INTEGER,y=c.has(l(f))?c.get(l(f)):Number.MAX_SAFE_INTEGER;return p-y}:(u,f)=>{const p=l(u),y=l(f);return Q(p)?Q(y)?0:1:Q(y)?-1:m.compare(this.label(p),this.label(y))}}groupKey(i){return this.multiple?t(i).map(m=>String(m)).sort().join(k):Q(i)?"":String(i)}countValues(i){return this.multiple?t(i).length:Q(i)?0:1}contains(i,n,m){const c=this.multiple?t(i):Q(i)?[]:[i],l=Array.isArray(n)?n:[n];switch(m){case"containsAll":return l.every(u=>c.includes(u));case"containsNone":return!l.some(u=>c.includes(u));default:return l.some(u=>c.includes(u))}}exportText(i,n="label"){return n==="value"?this.multiple?t(i).join(this.separator):Q(i)?"":String(i):this.text(i)}exportColumns(){const i=this.multiple;return this.#i.map(n=>({id:n.id,label:n.label,has:m=>i?t(m).includes(n.id):m===n.id}))}}function t(s){return Array.isArray(s)?s:Q(s)||s===""?[]:[s]}function r(s,i={}){const n=s.lookup;if(!n)return null;const m=new o(n,{colId:s.id,locale:i.locale,onChange:i.onChange});return!Array.isArray(n.options)&&n.options!==void 0&&m.load(),m}}),He("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 r}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return s}});const E=F("packages/core/src/internal/paths.js").getPath,W=F("packages/core/src/internal/predicates.js"),I=W.isFunction,x=W.isNil,Q=W.isObject,L=F("packages/core/src/internal/lru.js").Lru,M=F("packages/core/src/internal/warn.js").warnOnce,k=F("packages/core/src/format/number.js").compileNumber,a=F("packages/core/src/columns/graph.js").depsProxy,g="\0";function o(c,l={}){const u=l.locale,f=l.grid??null,p=l.context,y=c.value&&c.value.format,h=c.formatter||null,d=c.dataType&&c.dataType.format,w=c.lookup||null,v=(P,G,V)=>({value:P,data:V,row:G,column:c,colId:c.id,grid:f,context:p,locale:u});if(I(y))return(P,G,V)=>{const K=y(v(P,G,V));return K==null?"":String(K)};if(h){if(w){const P=h.kind==="text";return(G,V,K)=>h(P?w.text(G):G,v(G,V,K))}return(P,G,V)=>h(P,v(P,G,V))}if(I(d))return(P,G,V)=>{const K=d(v(P,G,V));return K==null?"":String(K)};if(c.dataType&&c.dataType.base==="number"&&Q(c.typeOptions)&&typeof c.typeOptions.decimals=="number"){const P=k({decimals:c.typeOptions.decimals},u);return G=>P(G)}return w?P=>w.text(P):P=>x(P)?"":typeof P=="string"?P:String(P)}function t(c,l){!c||!c.value||c.value.pure!==!1||M(`impure:${l}:${c.id}`,`column "${c.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${l}. The result is not stable across passes.`)}class r{#e;#t;#n;#r;#i;#s;#o=new L(4096);constructor(l){this.#e=l.columns instanceof Map?l.columns:new Map((l.columns||[]).map(u=>[u.id,u])),this.#t=l.graph,this.#n=l.grid??null,this.#r=l.context,this.#s=l.stored||null,this.#i=l.rowKey||s}get graph(){return this.#t}setGraph(l){this.#t=l,this.#o.clear()}beginPass(){this.#o.clear()}endPass(){this.#o.clear()}invalidate(l){if(this.#o.size===0)return;const u=l&&l.rows?new Set([...l.rows].map(String)):null,f=l&&l.columns?[...l.columns]:null;if(!u&&!f){this.#o.clear();return}const p=f?this.#l(f):null;for(const y of[...this.#o.keys()]){const h=String(y).split(g);h.length===3&&(u&&!u.has(h[0])||p&&!p.has(h[2])||this.#o.delete(y))}}#l(l){const u=new Set,f=this.#t,p=[...l];for(;p.length;){const y=p.pop();if(!u.has(y)){u.add(y);for(const h of f?f.dependents.get(y)||[]:[])p.push(h)}}return u}value(l,u,f){const p=typeof l=="string"?this.#e.get(l):l;if(!p)return;if(!p.computed)return this.#c(p,u,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,u,f);if(p.value.pure===!1)return this.compute(p,u,f);const y=`${this.#a(u,f)}${g}${p.id}`;if(this.#o.has(y))return this.#o.get(y);const h=this.compute(p,u,f);return this.#o.set(y,h),h}#a(l,u){return`${this.#i(l,u)}${g}${i(l)}`}#c(l,u,f){if(this.#s&&f&&f.physical!=null&&this.#s.has(l.id))return this.#s.get(l.id,f.physical);if(l.field)return l.read?l.read(u):E(u,l.field)}compute(l,u,f){const p=this.#t,y=p&&p.wholeRow.has(l.id);let h;if(y)h=u??{};else{h={};const w=p&&p.deps.get(l.id)||[];for(const P of w)h[P]=this.value(P,u,f);const v=p&&p.external.get(l.id)||[];for(const P of v)h[P]=E(u,P);h=a(h,[...w,...v],l.id)}const d={data:u,row:f,column:l,grid:this.#n,context:this.#r};return l.value.compute(h,d)}values(l,u){const f={},p=this.#t?this.#t.order:[...this.#e.keys()];for(const y of p)f[y]=this.value(y,l,u);return f}text(l,u,f){const p=typeof l=="string"?this.#e.get(l):l;return p?p.formatValue(this.value(p,u,f),f,u):""}key(l,u,f){const p=typeof l=="string"?this.#e.get(l):l;if(!p)return"";const y=this.value(p,u,f);return I(p.value.key)?String(p.value.key(this.#u(p,y,u,f))):p.lookup?p.lookup.groupKey(y):x(y)?"":String(y)}quickFilterText(l,u,f){const p=typeof l=="string"?this.#e.get(l):l;if(!p)return"";if(I(p.value.quickFilterText)){const y=this.value(p,u,f);return String(p.value.quickFilterText(this.#u(p,y,u,f))??"")}return this.text(p,u,f)}#u(l,u,f,p){return{value:u,data:f,row:p,column:l,colId:l.id,grid:this.#n,context:this.#r}}parse(l,u,f,p){const y=typeof l=="string"?this.#e.get(l):l;if(!y)return u;const h={text:u,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):u}validate(l,u,f,p,y){const h=typeof l=="string"?this.#e.get(l):l;if(!h||!I(h.edit.validate))return!0;const d=h.edit.validate({value:u,oldValue:f,data:p,row:y,column:h,grid:this.#n,context:this.#r});return d===!0||d===void 0?!0:String(d)}apply(l,u,f,p){const y=typeof l=="string"?this.#e.get(l):l;if(!y)return!1;const h=this.value(y,f,p);if(I(y.value.apply)){const d=y.value.apply({value:u,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===u?!1:(y.write(f,u),this.#f(y,f,p),!0):(M(`apply:${y.id}`,`column "${y.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(l,u,f,p){const y=typeof l=="string"?this.#e.get(l):l;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,u,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(l,u,f){if(this.#o.size===0)return;const p=this.#a(u,f);this.#o.delete(`${p}${g}${l.id}`);for(const y of this.#t?this.#t.dependents.get(l.id)||[]:[])this.#o.delete(`${p}${g}${y}`)}}function s(c,l){return l&&l.key!=null?String(l.key):i(c)}function i(c){if(c&&typeof c=="object"){let l=n.get(c);return l===void 0&&(l=`#${m++}`,n.set(c,l)),l}return String(c)}const n=new WeakMap;let m=0}),He("packages/core/src/model/shadow.js",function(e,F){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"HISTORY_TICK_MAX_MS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"HISTORY_TICK_MIN_MS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"CLUSTER_SHADOW_KINDS",{enumerable:!0,get:function(){return O}}),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 a}}),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 l}});const E=F("packages/core/src/internal/warn.js").warnOnce,W=2e5,I=20,x=1e3,Q=50;function U(u){return Math.min(x,Math.max(Q,Math.floor(u)))}const L=Object.freeze(["updates","updatedAt","sinceUpdate","delta","deltaPercent","rate","history","firstValue","streak","rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag","specStatus","rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta","fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD","cluster","clusterDistance"]),q=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),M=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),O=Object.freeze(["cluster","clusterDistance"]),k=.6745,b=3.5,a=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(u,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(u))return null;if(p!==null&&u<p||y!==null&&u>y)return a.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&&u<h||d!==null&&u>d?a.WARN:a.PASS}function r(u,f,p){if(!f||typeof f!="object")return null;if(f.kind!=="time")return f.kind!==void 0&&E(`shadow.history.window.kind:${u}`,`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:${u}`,"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;#o=new Map;#l=0;#a;#c;#u;#f;#d=new Map;#h=null;#p=null;#m=null;constructor(f){this.#e=f.colId,this.#a=Math.max(2,f.depth||I),this.#c=Math.max(1,f.max||W),this.#u=f.now||(()=>Date.now()),this.#f=r(this.#e,f.historyWindow,this.#a),this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#f}observe(f,p){const y=c(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.#o.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.#a&&d.splice(0,d.length-this.#a),this.#s.set(f,d);const w=Math.sign(y-h),v=this.#o.get(f)||0;this.#o.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.#o.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.#o.clear(),this.#l=0,this.#p=null,this.#m=null,this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}retain(f){const 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.#o.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.#a);for(const[w,v]of this.#d){const P=this.#n.get(w);for(let G=0;G<d;G++)v.push(P);v.length>this.#a&&v.splice(0,v.length-this.#a)}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.#o.has(p)?this.#o.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[H,T]of this.#n)f&&!f.has(H)||p.push(T);const y=p.sort((H,T)=>H-T);let h=0,d=0,w=0,v=0;for(const H of y){v+=H,h++;const T=H-d;d+=T/h,w+=T*(H-d)}const P=[];for(const[H,T]of this.#t)f&&!f.has(H)||P.push(T);const G=h?i(y):0,V=y.map(H=>Math.abs(H-G)).sort((H,T)=>H-T),K=h?i(V):0;return{sorted:y,baseline:P.sort((H,T)=>H-T),sum:v,mean:h?d:0,sd:h>1?Math.sqrt(w/(h-1)):0,median:G,mad:K}}#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,G=v-m(w.sorted,d)+1;return P-G}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 i(u){const f=u.length;if(!f)return 0;const p=(f-1)*.5,y=Math.floor(p),h=Math.ceil(p);return y===h?u[y]:u[y]+(p-y)*(u[h]-u[y])}function n(u,f){let p=0,y=u.length;for(;p<y;){const h=p+y>>1;u[h]<f?p=h+1:y=h}return p}function m(u,f){let p=0,y=u.length;for(;p<y;){const h=p+y>>1;u[h]<=f?p=h+1:y=h}return p}function c(u){if(u==null||u==="")return null;if(u instanceof Date){const p=u.getTime();return Number.isFinite(p)?p:null}const f=typeof u=="number"?u:Number(u);return Number.isFinite(f)?f:null}function l(u){const f=[];for(const p of u||[]){const y=p.shadow;if(!y)continue;const h=typeof y=="string"?{kind:y}:y,d=h.kind;L.includes(d)&&(q.includes(d)||M.includes(d)||O.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}}),He("packages/core/src/columns/model.js",function(e,F){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return Re}});const ie=F("packages/core/src/internal/merge.js"),E=ie.expand,W=ie.merge,I=ie.toArray,x=F("packages/core/src/internal/warn.js"),Q=x.fail,U=x.warnOnce,L=F("packages/core/src/internal/paths.js"),q=L.getPath,M=L.pathGetter,O=L.pathSetter,b=F("packages/core/src/internal/text.js").humanise,a=F("packages/core/src/internal/predicates.js"),g=a.isFunction,o=a.isObject,r=F("packages/core/src/internal/uid.js").uid,i=F("packages/core/src/format/index.js").compileFormat,n=F("packages/core/src/columns/datatypes.js"),m=n.comparatorFor,c=n.createTypeRegistry,l=n.storageKind,u=F("packages/core/src/columns/infer.js"),f=u.inferColumnType,p=u.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"),G=P.compileDisplay,V=P.ValuePipeline,K=P.warnImpureUse,H=F("packages/core/src/model/shadow.js"),T=H.FIT_SHADOW_KINDS,A=H.CLUSTER_SHADOW_KINDS,S=Object.freeze({geometry:"geometry",list:"list"}),R={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},j={centre:"center"},N=new Set(["start","center","end","left","right"]);function $(be){if(typeof be!="string")return;const se=be.toLowerCase();return j[se]?j[se]:N.has(se)?se:void 0}function _(be){if(typeof be!="string")return;const se=be.toLowerCase();return se==="center"||se==="centre"?"middle":se==="top"||se==="middle"||se==="bottom"?se:void 0}const Y=["cell","layout","header"];function Z(be){if(!o(be))return{};const se={...be},de=(oe,ce)=>{if(be[oe]===void 0)return;const he=E(be[oe],ce);he&&Y.includes(oe)&&!o(be[oe])&&delete he.enabled,se[oe]=he};return de("sort","direction"),de("filter","type"),de("cell","render"),de("edit","editor"),de("layout","width"),de("group","index"),de("pivot","index"),de("header","render"),de("facet","strategy"),se}function J(be,se){const de={...be||{}},oe=o(se)&&o(se.layout)&&se.layout.width!==void 0;return de.fit==="content"&&!oe&&delete de.width,de}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(be,se,de,oe){const ce=de==="columnGroup"?"column group":"column";for(const he of Object.keys(be))if(!se.has(he)){if(he==="timeZone"&&de==="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(`${de}.unknown:${he}`,`'${he}' is not a configuration key this grid recognises, so it had no effect on ${ce} "${oe}". Check the spelling against the reference.`)}}function X(be){o(be.cell)&&be.cell.autoHeight!==void 0&&U("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${be.id||be.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function ne(be,se){const de=se&&g(be.defaultsFor)?be.defaultsFor(se):null,oe={...be.defaults||{},...o(de)?de:{}},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}),be.export&&(ce.export={...be.export}),ce}function re(be){if(typeof be=="string")return be.trim()?[be.trim()]:[];if(!Array.isArray(be))return[];const se=[];for(const de of be){if(typeof de!="string")continue;const oe=de.trim();oe&&!se.includes(oe)&&se.push(oe)}return se}class ae{#e=new Map;#t=[];#n=[];#r=new WeakMap;#i;#s;#o;#l;#a;#c;#u(se,de,oe){if(se&&typeof se=="object"&&!g(se)){const Se=se;return(typeof Se.fn!="string"||!Se.fn)&&Q(`column "${oe}": a total given as an object needs a \`fn\` name, such as { fn: 'percentile', p: 0.9 }.`),Se.fn==="percentile"&&!(typeof Se.p=="number"&&Se.p>=0&&Se.p<=1)&&Q(`column "${oe}": { fn: 'percentile' } needs \`p\`, a number from 0 to 1 (0.9 for the 90th percentile).`),this.#f(Se.fn,de,oe),Object.freeze({...Se})}const ce=this.#f(se,de,oe);if(typeof ce!="string"||!this.#d)return ce??null;const he=de&&de.totals&&de.totals.implement;if(he&&g(he[ce])){const Se=he[ce];return Se.totalName=ce,Se}const Oe=this.#d.totalFn?.(ce);return g(Oe)?Oe:ce}#f(se,de,oe){if(typeof se!="string")return se;const ce=de&&de.totals&&de.totals.supported;if(!Array.isArray(ce)||ce.includes(se))return se;const he=ce.length?ce.join(", "):"none";return Q(`column "${oe}" is typed ${de.name||"a type"}, for which the total "${se}" is not meaningful. Supported: ${he}. Aggregating it anyway would produce a confident wrong number.`),se}#d;#h;#p;#m;#g;#b;#y=!1;#O;#w;constructor(se={}){this.#s=Z(se.columnDefaults||{}),this.#o=se.columnPresets||{},this.#a=se.locale,this.#l=se.timeZone,this.#c=_(se.verticalAlign),this.#d=se.registry||null,this.#h=se.grid||null,this.#p=se.context,this.#O=se.sampleSize??p,this.#w=se.onChange||null,this.#b=g(se.rowKey)?se.rowKey:void 0,this.#i=c(se.dataTypes,this.#d);const{leaves:de,groups:oe}=Re(se.columns||[]);this.#n=oe;for(const ce of de){ce.facet!==void 0&&this.#r.set(ce.def,ce.facet);const he=this.#A(ce.def,null);if(he.groupPath=ce.path,this.#e.has(he.id)){U(`columns.duplicate:${he.id}`,`two columns resolve to the id '${he.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=he,this.#e.set(he.id,he),this.#t.push(he.id)}this.#C(se.stored||null)}#A(se,de){z(se,D,"column",se.id||se.field||"(unnamed)"),X(se);const oe=Z(se),ce=I(se.preset),he=ce.map(Me=>{const Be=this.#o[Me];return Be?Z(Be):(U(`preset:${Me}`,`unknown column preset "${Me}"; ignoring`),{})}),Oe=this.#S(oe,he,de),Se=this.#i.get(Oe)||this.#i.get("text");if(!this.#i.has(Oe)&&se.type){const Me=S[Oe];U(`type:${Oe}`,`unknown data type "${Oe}"; falling back to "text"`+(Me?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${Me}'.`:""))}const Ce=g(Se.items)?this.#P(oe,he,se.id||se.field||"(unnamed)"):null;let Ie=R;Ie=W(Ie,this.#s),se.type!==!1&&(Ie=W(Ie,ne(Se,Ce)));for(const Me of he)Ie=W(Ie,Me);this.#r.has(se)&&(Ie=W(Ie,Z({facet:this.#r.get(se)}))),Ie=W(Ie,oe);const ke=Ie.edit;ke&&ke.editor&&ke.enabled!==!0&&!g(ke.enabled)&&(se.edit||{}).editor&&U(`column.editor-not-enabled:${se.id||se.field}`,`column '${se.id||se.field}' names the editor '${ke.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const _e=se.id||se.field||r("col");if(se.shadow&&!g(Ie.value&&Ie.value.compute)){const Me=typeof se.shadow=="string"?{kind:se.shadow}:se.shadow,Be=Me.of||se.field||_e,Ke=T.includes(Me.kind),et=A.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;Ie.value={...Ie.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(se.running&&!g(Ie.value&&Ie.value.compute)){const Me=typeof se.running=="string"?{kind:se.running}:se.running,Be=Me.of||se.field||_e;Ie.value={...Ie.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}},se.sort===void 0&&(Ie.sort={...Ie.sort||{},enabled:!1})}const Te=se.field??(g(Ie.value&&Ie.value.compute)?null:se.id??null),je=g(Ie.value&&Ie.value.compute),Ae={id:_e,field:Te,shadow:se.shadow||null,running:se.running||null,spec:se.spec||null,validation:se.validation||null,volatile:!!(se.shadow||se.running),title:Ie.title??b(Te||_e),type:Se.name,dataType:Se,itemType:Ce,nullable:Ie.nullable!==!1,align:$(oe.cell&&oe.cell.align||oe.align||Ie.cell&&Ie.cell.align||Ie.align||Se.defaults&&Se.defaults.align)||"start",verticalAlign:_(oe.cell&&oe.cell.verticalAlign||oe.verticalAlign||Ie.cell&&Ie.cell.verticalAlign||Ie.verticalAlign)||this.#c,rowSpan:g(Ie.rowSpan)?Ie.rowSpan:null,colSpan:g(Ie.colSpan)?Ie.colSpan:null,value:{pure:!0,...Ie.value||{}},cell:{...Ie.cell||{}},edit:{...Ie.edit||{}},sort:{...Ie.sort||{}},filter:{...Ie.filter||{}},group:{enabled:!1,index:-1,explode:!1,...Ie.group||{}},pivot:{enabled:!1,index:-1,...Ie.pivot||{}},total:this.#u(Ie.total,Se,se.id||se.field||"(unnamed)"),groupTotal:Ie.groupTotal===void 0?null:this.#u(Ie.groupTotal,Se,se.id||se.field||"(unnamed)"),grandTotal:Ie.grandTotal===void 0?null:this.#u(Ie.grandTotal,Se,se.id||se.field||"(unnamed)"),tags:re(Ie.tags),typeOptions:Ie.typeOptions??null,...o(Ie[Oe])?{[Oe]:Ie[Oe]}:{},layout:J(Ie.layout,oe),header:{...Ie.header||{}},contextMenu:Ie.contextMenu===void 0?null:Ie.contextMenu,facet:{...Ie.facet||{}},export:{...Ie.export||{}},allowGroup:Ie.allowGroup!==!1,allowPivot:Ie.allowPivot!==!1,allowTotal:Ie.allowTotal!==!1,quickFilter:Ie.quickFilter!==!1,def:se,format:Ie.format,presets:ce,inferred:de!=null&&!se.type,computed:je,diff:se.diff===void 0?void 0:!!se.diff,read:Te?M(Te):null,write:Te?O(Te):null};Ae.cell.align=$(oe.cell&&oe.cell.align)||Ae.align,Ae.header.align=$(oe.header&&oe.header.align)||Ae.align;const Ee=Ie.lookup||null;return Ae.lookup=Ee?v({id:_e,lookup:Ee},{locale:this.#a,onChange:()=>{this.#w&&this.#w("lookup",{colId:_e})}}):null,Ae.group.explode&&Ae.lookup&&Ae.lookup.multiple&&U(`explode:${_e}`,`column "${_e}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(Ae),Ae}#v(se){se.formatter=i(se.format,se.dataType,this.#a,this.#l,se.id),se.formatValue=G(se,{locale:this.#a,grid:this.#h,context:this.#p}),se.itemCompare=se.itemType?m(se.itemType,this.#a):null,se.compare=g(se.value.compare)?se.value.compare:se.lookup?se.lookup.comparator():g(se.dataType.compareFor)?se.dataType.compareFor(se):m(se.dataType,this.#a),se.excel=se.formatter&&se.formatter.ooxml||se.dataType&&se.dataType.excel||"General",se.storeKind=l(se.dataType,!!(se.lookup&&se.lookup.multiple))}#P(se,de,oe){let ce=o(se.typeOptions)?se.typeOptions:null;for(let Ce=de.length-1;!ce&&Ce>=0;Ce--)o(de[Ce].typeOptions)&&(ce=de[Ce].typeOptions);!ce&&o(this.#s.typeOptions)&&(ce=this.#s.typeOptions);const he=ce&&ce.of!==void 0?ce.of:"text",Oe=typeof he=="string"?this.#i.get(he):void 0;return Oe&&!g(Oe.items)&&Oe.storage!=="object"?Oe:(U(`type:of:${String(he)}`,`column "${oe}" names "${String(he)}" as its item type (typeOptions.of), which is not ${Oe?"a scalar data type":"a known data type"}; its items are read as text.`),this.#i.get("text"))}#S(se,de,oe){if(se.type===!1)return"text";if(se.type)return se.type;for(let ce=de.length-1;ce>=0;ce--)if(de[ce].type)return de[ce].type;if(this.#s.type)return this.#s.type;if(se.shadow){const ce=typeof se.shadow=="string"?se.shadow:se.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||(se.lookup?"lookup":"text")}#C(se){const de=this.all();this.#m=h(de),this.#g?this.#g.setGraph(this.#m):this.#g=new V({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:se||null,rowKey:this.#b});const oe=this.#g;for(const ce of de)ce.getValue=(he,Oe)=>oe.value(ce,he,Oe)}all(){return this.#t.map(se=>this.#e.get(se))}visible(){return this.all().filter(se=>!se.layout.hidden)}get(se){return this.#e.get(se)}groups(){const se=de=>{const oe=[];for(const ce of de)Array.isArray(ce.columns)?oe.push({...ce,columns:se(ce.columns)}):ce.column&&oe.push(ce.column);return oe};return se(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#i}affectedBy(se){return d(this.#m,se)}value(se,de,oe){return this.#g.value(se,de,oe)}text(se,de,oe){return this.#g.text(se,de,oe)}checkImpure(se,de){K(this.#e.get(se),de)}setLocale(se){this.#a=se;for(const de of this.all())de.lookup&&de.lookup.setLocale(se),this.#v(de);this.#w&&this.#w("locale",{locale:se})}infer(se){const de={};if(this.#y||!Array.isArray(se)||se.length===0)return de;this.#y=!0;let oe=!1;for(const ce of this.all()){const he=ce.def;if(he.type!==void 0||!ce.field||ce.computed||ce.lookup||this.#E(ce))continue;const Oe=ce.read||(Ie=>q(Ie,ce.field)),Se=f(ce.id,se,Oe,this.#i,{sampleSize:this.#O});if(Se===ce.type)continue;de[ce.id]=Se;const Ce=this.#A(he,Se);Ce.groupPath=ce.groupPath,Ce.layout={...Ce.layout,...fe(ce.layout)},this.#e.set(ce.id,Ce),$e(this.#n,ce.id,Ce),oe=!0}return oe&&this.#C(null),de}redecorate(se,de,oe={}){const ce=this.#e.get(se);if(!ce){U(`redecorate:${se}`,`columns.decorate('${se}', …): no column with id '${se}'.`);return}const he=ce.def||{},Oe={...o(he.cell)?he.cell:{}};Oe.decoration=de??void 0,oe&&"variant"in oe&&(Oe.variant=oe.variant);const Se={...he,cell:Oe};this.#r.has(he)&&this.#r.set(Se,this.#r.get(he));const Ce=this.#A(Se,ce.type);return Ce.groupPath=ce.groupPath,Ce.layout={...Ce.layout,...fe(ce.layout)},ce.lookup&&ce.lookup!==Ce.lookup&&g(ce.lookup.destroy)&&ce.lookup.destroy(),this.#e.set(se,Ce),$e(this.#n,se,Ce),this.#C(null),this.#w&&this.#w("decorate",{colId:se}),Ce}destroy(){for(const se of this.#e.values())se.lookup&&g(se.lookup.destroy)&&se.lookup.destroy()}#E(se){for(const de of se.presets){const oe=this.#o[de];if(oe&&oe.type)return!0}return!!this.#s.type}#T(se){return!se.computed&&g(se.dataType&&se.dataType.toStorage)}storeReader(se){if(se.computed)return de=>this.#g.value(se,de,null);if(this.#T(se)){const de=se.dataType.toStorage,oe=se.format&&typeof se.format=="object"&&!Array.isArray(se.format)?se.format.locale:void 0,ce={timeZone:this.#l,colId:se.id,itemType:se.itemType||null,locale:oe||this.#a};return he=>de(se.read(he),ce)}return se.read}storeValue(se,de){if(!(!se||se.computed)&&g(se.read))return this.storeReader(se)(de)}storeSchema(){const se=[];for(const de of this.all()){if(de.computed&&de.value.pure===!1||!de.computed&&!de.field)continue;const oe=this.storeReader(de);let ce=null;!de.computed&&!this.#T(de)&&typeof de.field=="string"&&!de.lookup&&(ce=de.field);const he={id:de.id,kind:de.storeKind,nullable:de.nullable,read:oe};ce!==null&&(he.field=ce),de.lookup&&(he.dictionary=de.lookup.dictionary()),se.push(he)}return se}state(){return this.all().map(se=>({id:se.id,width:se.layout.width,flex:se.layout.flex||void 0,hidden:!!se.layout.hidden,headerWrap:se.header?.wrap===!0?!0:void 0,headerOrientation:se.header?.orientation==="vertical"?"vertical":void 0,pin:se.layout.pin??null,sort:se.sort.direction??null,sortIndex:se.sort.direction?se.sort.order??0:null,groupIndex:se.group.enabled?se.group.index??0:null,pivotIndex:se.pivot.enabled?se.pivot.index??0:null,total:typeof se.total=="string"?se.total:null,groupTotal:typeof se.groupTotal=="string"?se.groupTotal:void 0,grandTotal:typeof se.grandTotal=="string"?se.grandTotal:void 0,decoration:se.cell&&se.cell.decoration!=null?we(se.cell.decoration):void 0,variant:se.cell&&se.cell.variant!=null?we(se.cell.variant):void 0}))}applyState(se,de={}){const oe={applied:[],skipped:[]},ce=Array.isArray(se)?se:se&&se.columns||[],he=!Array.isArray(se)&&se&&se.columnOrder||null;for(const Se of ce){if(!Se||!Se.id){oe.skipped.push({key:"?",reason:"no id"});continue}let Ce=this.#e.get(Se.id);if(!Ce){oe.skipped.push({key:Se.id,reason:"unknown column"});continue}if(Object.hasOwn(Se,"decoration")||Object.hasOwn(Se,"variant")){const Ie=Ce.cell?Ce.cell.decoration:void 0,ke=Se.decoration??null,_e=Object.hasOwn(Se,"variant"),Te=_e&&!ve(Ce.cell?Ce.cell.variant:void 0,Se.variant);(!ve(Ie,ke)||Te)&&(this.redecorate(Se.id,ke,_e?{variant:Se.variant??void 0}:{}),Ce=this.#e.get(Se.id)||Ce)}Se.width!=null&&(Ce.layout.width=Se.width),Se.flex!=null&&(Ce.layout.flex=Se.flex),Se.hidden!=null&&(Ce.layout.hidden=!!Se.hidden),Se.headerWrap!==void 0&&(Ce.header.wrap=!!Se.headerWrap),Se.headerOrientation!==void 0&&(Ce.header.orientation=Se.headerOrientation==="vertical"?"vertical":"horizontal"),Se.pin!==void 0&&(Ce.layout.pin=Se.pin),Se.sort!==void 0&&(Ce.sort.direction=Se.sort),Se.sortIndex!=null&&(Ce.sort.order=Se.sortIndex),Se.groupIndex!=null&&(Ce.group.enabled=!0,Ce.group.index=Se.groupIndex),Se.pivotIndex!=null&&(Ce.pivot.enabled=!0,Ce.pivot.index=Se.pivotIndex),Se.total!==void 0&&(Ce.total=Se.total),Se.groupTotal!==void 0&&(Ce.groupTotal=Se.groupTotal),Se.grandTotal!==void 0&&(Ce.grandTotal=Se.grandTotal),oe.applied.push(Se.id)}const Oe=he||(de&&de.keepOrder?[]:ce.map(Se=>Se&&Se.id).filter(Boolean));if(Oe.length){const Se=Oe.filter(Ie=>this.#e.has(Ie)),Ce=this.#t.filter(Ie=>!Se.includes(Ie));this.#t=[...Se,...Ce]}return this.#w&&this.#w("state",oe),oe}move(se,de){this.#M(se,de)&&(this.#R(),this.#w&&this.#w("move",{id:se,to:de}))}reorder(se){const de={applied:[],skipped:[]},oe=[];let ce=0;for(const he of Array.isArray(se)?se:[]){const Oe=ce++;this.#M(he,Oe)&&(de.applied.push(he),oe.push({id:he,to:Oe}))}if(!oe.length)return de;if(this.#R(),this.#w)for(const he of oe)this.#w("move",he);return de}#M(se,de){const oe=this.#t.indexOf(se);if(oe===-1||Math.max(0,Math.min(Number(de)||0,this.#t.length-1))===oe)return!1;const he=this.#e.get(se);if(he.layout.movable===!1||he.layout.lockPosition)return U(`move:${se}`,`column "${se}" is not movable; the move was ignored`),!1;const Oe=this.#N(se,de);return Oe?(U(`move.married:${Oe}`,`band "${Oe}" 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(de,this.#t.length)),0,se),!0)}#N(se,de){if(!this.#n||!this.#n.length)return null;const oe=this.#t.filter(Se=>Se!==se),ce=Math.max(0,Math.min(de,oe.length)),he=(Se,Ce)=>{if(Array.isArray(Se.columns)){for(const ke of Se.columns)he(ke,Ce);return Ce}const Ie=Se.column?Se.column.id:Se.id;return Ie&&Ce.push(Ie),Ce},Oe=Se=>{for(const Ce of Se){if(!Array.isArray(Ce.columns))continue;if(Ce.marryChildren===!0){const ke=he(Ce,[]),_e=ke.includes(se),Te=ke.map(je=>oe.indexOf(je)).filter(je=>je>=0);if(Te.length){const je=Math.min(...Te),Ae=Math.max(...Te);if(_e?ce<je||ce>Ae+1:ce>je&&ce<=Ae)return Ce.id}}const Ie=Oe(Ce.columns);if(Ie)return Ie}return null};return Oe(this.#n)}#R(){const se=new Map(this.#t.map((ce,he)=>[ce,he])),de=ce=>{if(!Array.isArray(ce.columns)){const Oe=ce.column?ce.column.id:ce.id;return se.has(Oe)?se.get(Oe):1/0}let he=1/0;for(const Oe of ce.columns)he=Math.min(he,de(Oe));return he},oe=ce=>{ce.sort((he,Oe)=>de(he)-de(Oe));for(const he of ce)Array.isArray(he.columns)&&oe(he.columns)};oe(this.#n)}#D(se){const de=oe=>{for(let ce=0;ce<oe.length;ce++){const he=oe[ce];if(Array.isArray(he.columns)){const Oe=de(he.columns);if(Oe)return Oe}else if(he.column&&he.column.id===se)return oe.splice(ce,1)[0]}return null};return de(this.#n)}#K(se){const de=[];for(let oe=se.length-1;oe>=0;oe--){const ce=se[oe];Array.isArray(ce.columns)&&(de.push(...this.#K(ce.columns)),ce.columns.length===0&&(de.push(ce.id),se.splice(oe,1)))}return de}#Y(){const se=(de,oe,ce)=>{for(const he of de)Array.isArray(he.columns)?se(he.columns,[...oe,he.id]):he.column&&(he.column.groupPath=oe)};se(this.#n,[])}#L(se){const de=new Set(se),oe=this.#t.filter(Se=>de.has(Se));if(!oe.length)return;const ce=Math.min(...oe.map(Se=>this.#t.indexOf(Se))),he=this.#t.slice(0,ce).filter(Se=>!de.has(Se)),Oe=this.#t.slice(ce).filter(Se=>!de.has(Se));this.#t=[...he,...oe,...Oe]}#_(se){const de=[],oe=ce=>{if(Array.isArray(ce.columns))for(const he of ce.columns)oe(he);else ce.column&&de.push(ce.column.id)};return oe(se),de}#F(se){const de=oe=>{for(const ce of oe){if(!Array.isArray(ce.columns))continue;if(ce.id===se)return{node:ce,parent:oe};const he=de(ce.columns);if(he)return he}return null};return de(this.#n)}groupColumns(se,de={}){const oe=I(se).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=de.groupId?this.#F(de.groupId):null;if(de.groupId&&!ce)return U(`columns.group.unknown:${de.groupId}`,`no band "${de.groupId}" to add to; nothing was grouped.`),null;let he=null;if(!ce&&de.id!=null&&(he=String(de.id),this.#F(he)||this.#e.has(he)))return U(`columns.group.idtaken:${he}`,`band id "${he}" is already in use; nothing was grouped.`),null;const Oe=oe.map(Ce=>this.#D(Ce)).filter(Boolean);if(!Oe.length)return null;let Se;if(ce)ce.node.columns.push(...Oe),Se=ce.node.id;else{const Ce={id:he||r("grp"),title:de.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:Oe},Ie=Number.isInteger(de.at)?Math.max(0,Math.min(de.at,this.#n.length)):this.#n.length;this.#n.splice(Ie,0,Ce),Se=Ce.id}return this.#K(this.#n),this.#L(oe),this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"formed",groupId:Se,ids:oe}),Se}ungroupColumn(se){const de=this.#e.get(se);if(!de){U(`columns.ungroup.unknown:${se}`,`no column "${se}" to ungroup.`);return}const oe=de.groupPath||[];if(!oe.length)return;const ce=oe[oe.length-1],he=this.#F(ce);if(!he)return;const Oe=this.#D(se);if(!Oe)return;const Se=he.parent.indexOf(he.node);he.parent.splice(Se+1,0,Oe);const Ce=this.#K(this.#n),Ie=this.#_(he.node);if(Ie.length){this.#L(Ie);const ke=Math.max(...Ie.map(Te=>this.#t.indexOf(Te))),_e=this.#t.filter(Te=>Te!==se);_e.splice(ke+1,0,se),this.#t=_e}this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"removed",id:se,dissolved:Ce})}renameGroup(se,de){const oe=this.#F(se);if(!oe){U(`columns.group.rename:${se}`,`no band "${se}" to rename.`);return}oe.node.title=String(de??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:se,title:oe.node.title})}dissolveGroup(se){const de=this.#F(se);if(!de){U(`columns.group.dissolve:${se}`,`no band "${se}" to dissolve.`);return}const oe=de.parent.indexOf(de.node);de.parent.splice(oe,1,...de.node.columns),this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:se})}moveGroup(se,de){const oe=this.#F(se);if(!oe){U(`columns.group.move:${se}`,`no band "${se}" to move.`);return}const ce=oe.parent,he=ce.indexOf(oe.node);he!==-1&&(ce.splice(he,1),ce.splice(Math.max(0,Math.min(de,ce.length)),0,oe.node),this.#X(),this.#Y(),this.#w&&this.#w("columngroup",{action:"moved",groupId:se,to:de}))}#X(){const se=[],de=ce=>{for(const he of ce)Array.isArray(he.columns)?de(he.columns):he.column&&se.push(he.column.id)};de(this.#n);const oe=new Set(se);this.#t=[...se,...this.#t.filter(ce=>!oe.has(ce))]}groupTree(){const se=oe=>oe.map(ce=>Array.isArray(ce.columns)?{id:ce.id,title:ce.title||"",collapsible:!!ce.collapsible,openByDefault:ce.openByDefault!==!1,columns:se(ce.columns)}:ce.column?ce.column.id:null).filter(ce=>ce!==null),de=se(this.#n);return de.some(oe=>oe&&typeof oe=="object")?de:[]}applyGroupTree(se){if(!Array.isArray(se))return;const de=new Set,oe=he=>{const Oe=[];for(const Se of he)if(Se&&typeof Se=="object"&&Array.isArray(Se.columns)){const Ce=oe(Se.columns);if(!Ce.length)continue;Oe.push({id:Se.id||r("grp"),title:Se.title||"",collapsible:Se.collapsible===!0,openByDefault:Se.openByDefault!==!1,showWhen:"always",marryChildren:!1,header:{},def:{},columns:Ce})}else if(typeof Se=="string"){const Ce=this.#e.get(Se);Ce&&!de.has(Se)&&(de.add(Se),Oe.push({column:Ce,path:[]}))}return Oe},ce=oe(se);for(const he of this.#t){if(de.has(he))continue;const Oe=this.#e.get(he);Oe&&ce.push({column:Oe,path:[]})}this.#n=ce,this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"applied"})}show(se){this.#V(se,!1)}hide(se){this.#V(se,!0)}#V(se,de){const oe=[];for(const ce of I(se)){const he=this.#e.get(ce);if(he){if(de&&he.layout.lockVisible){U(`lockVisible:${ce}`,`column "${ce}" is \`layout.lockVisible\` and cannot be hidden`);continue}he.layout.hidden!==de&&(he.layout.hidden=de,oe.push(ce))}}oe.length&&this.#w&&this.#w("visible",{ids:oe,hidden:de})}pin(se,de){const oe=this.#e.get(se);oe&&(oe.layout.pin=de??null,this.#w&&this.#w("pin",{id:se,side:oe.layout.pin}))}pinMany(se){const de={};for(const[ce,he]of se){const Oe=this.#e.get(ce);Oe&&(Oe.layout.pin=he??null,de[ce]=Oe.layout.pin)}const oe=Object.keys(de);oe.length&&this.#w&&this.#w("pin",{ids:oe,pins:de})}#B(se,de){const oe=se.layout.min??0,ce=se.layout.max;let he=Math.max(oe,de);return ce!=null&&(he=Math.min(ce,he)),se.layout.width=he,se.layout.flex=0,he}resize(se,de){const oe=this.#e.get(se);if(!oe)return;if(oe.layout.resizable===!1){U(`resize:${se}`,`column "${se}" is not resizable; the resize was ignored`);return}const ce=this.#B(oe,de);this.#w&&this.#w("resize",{id:se,width:ce})}resizeMany(se){const de={};for(const[ce,he]of se){const Oe=this.#e.get(ce);if(Oe){if(Oe.layout.resizable===!1){U(`resize:${ce}`,`column "${ce}" is not resizable; the resize was ignored`);continue}de[ce]=this.#B(Oe,he)}}const oe=Object.keys(de);oe.length&&this.#w&&this.#w("resize",{ids:oe,widths:de})}}function fe(be){const se={};return be.width!=null&&(se.width=be.width),be.hidden!=null&&(se.hidden=be.hidden),be.pin!==void 0&&(se.pin=be.pin),se}function we(be){if(be===null||typeof be!="object")return be;try{return structuredClone(be)}catch{}try{return JSON.parse(JSON.stringify(be))}catch{return be}}function ve(be,se){const de=be??null,oe=se??null;if(de===oe)return!0;if(de===null||oe===null)return!1;if(typeof de!="object"||typeof oe!="object")return de===oe;try{return JSON.stringify(de)===JSON.stringify(oe)}catch{return!1}}function Re(be){const se=[],de=(ce,he,Oe)=>{const Se=[];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 Ie={id:Ce.id||r("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:[]};Ie.columns=de(Ce.columns,[...he,Ie.id],Ce.facet!==void 0?Ce.facet:Oe),Se.push(Ie)}else{const Ie={def:Ce,path:he,facet:Oe};se.push(Ie),Se.push(Ie)}}return Se},oe=de(be,[],void 0);return{leaves:se,groups:oe}}function $e(be,se,de){for(const oe of be){if(oe.columns){if($e(oe.columns,se,de))return!0;continue}if(oe.column&&oe.column.id===se)return oe.column=de,!0}return!1}}),He("packages/core/src/columns/autogroup.js",function(e,F){"use strict";Object.defineProperty(e,"AUTO_GROUP_ID",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createAutoGroupColumn",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"warnOnAbsurdGrouping",{enumerable:!0,get:function(){return q}});const E=F("packages/core/src/internal/warn.js").warnOnce,W="__lattice_group",I=240,x=.5;function Q(M){const O=M.def&&M.def.layout;return(typeof O=="number"||O&&O.width!=null||M.def&&M.def.width!=null)&&Number.isFinite(M.layout.width)?M.layout.width:null}function U(M){const O=M.def&&M.def.layout;return!!(O&&O.min!=null)||M.def&&M.def.minWidth!=null}function L(M){const{columns:O,groupBy:k}=M,b=k.map(s=>O.get(s)).filter(Boolean),a=b.length?b.map(s=>s.title||s.id).join(" > "):"Group",g=b.find(s=>Q(s)!=null),o=M.config&&M.config.autoGroupColumnWidth||(g?Q(g):I);let t=g&&U(g)?g.layout.min:120;g&&!U(g)&&(t=Math.min(t,o));const r=g&&g.layout.max!=null?g.layout.max:null;return{id:W,field:null,title:a,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:r,pin:M.config&&M.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,i){return i&&i.group?i.groupValue:null},formatValue(s,i){if(!i||!i.group)return"";if(i.grandTotal)return M.config&&M.config.grandTotalLabel||"Total";const n=b[Math.min(i.level||0,b.length-1)];return n&&typeof n.formatValue=="function"?n.formatValue(s,i):s==null?"":String(s)}}}function q(M,O,k){!M.length||k<100||O<k*x||E(`grouping.cardinality:${M.join(",")}`,`grouping by ${M.join(", ")} produced ${O} 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.`)}}),He("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 W}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return I}});const ie="__lattice_select",E=44;function W(x){const Q=x.selection||{},U=x.config&&x.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:x.config&&x.config.selectionColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,headerCheckbox:Q.headerCheckbox===!0,def:{},getValue(L,q){return q?q.selected:!1},formatValue(){return""}}}const I=W}),He("packages/core/src/columns/rownumbercolumn.js",function(e,F){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createRowNumberColumn",{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,W="__lattice_rownumber",I=40,x=9,Q=22;function U(M){const O=String(Math.max(1,Math.trunc(Math.abs(M))||1)).length;return Math.max(I,O*x+Q)}function L(M){const O=M.rowNumbers,k=O&&typeof O=="object"?O:{},b=Number.isFinite(k.start)?k.start:1,a=Number.isFinite(k.width)?k.width:U((M.maxNumber||0)+b),g=E(M.rank)?M.rank:()=>null;return{id:W,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:a,min:a,max:a,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 r=g(t);return r==null?null:r-1+b},formatValue(o){return o==null?"":String(o)}}}const q=L}),He("packages/core/src/model/detail.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_DETAIL_HEIGHT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DEFAULT_CACHE_LIMIT",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"DetailModel",{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,I=F("packages/core/src/internal/warn.js").warnOnce,x=240,Q=10;function U(M){if(!M)return null;const O=M===!0?{}:M;return O.enabled===!1?null:!E(O.rows)&&!O.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:O.render||null,config:O.config||null,rows:E(O.rows)?O.rows:null,height:O.height??x,maxHeight:O.maxHeight??null,cacheLimit:Number.isFinite(O.cacheLimit)?Math.max(0,O.cacheLimit):Q,isMaster:E(O.isMaster)?O.isMaster:null,target:O.target||null,onCreate:E(O.onCreate)?O.onCreate:null,path:typeof O.path=="string"?O.path:null}}class L{#e;#t=new Set;#n;#r=0;constructor(O){this.#e=O.config,this.#n=E(O.onChange)?O.onChange:()=>{}}get config(){return this.#e}get inline(){return!this.#e.target}isMaster(O){if(!O||O.group||O.detail)return!1;const k=this.#e.isMaster;return k?!!k(O.data,O):!0}isOpen(O){return this.#t.has(O)}keys(){return[...this.#t]}activeKey(){for(const O of this.#t)return O;return null}heightOf(O){const k=this.#e.height;return E(k)?Number(k(O))||x:k==="auto"?x:Number(k)||x}open(O){return this.#t.has(O)?!1:(this.inline||this.#t.clear(),this.#t.add(O),this.#i(),!0)}close(O){return this.#t.delete(O)?(this.#i(),!0):!1}toggle(O){return this.#t.has(O)?(this.close(O),!1):(this.open(O),!0)}closeAll(){this.#t.size&&(this.#t.clear(),this.#i())}prune(O){if(!this.#t.size||!E(O))return;let k=!1;for(const b of[...this.#t])O(b)||(this.#t.delete(b),k=!0);k&&this.#i()}signature(){return`${this.#r}`}set(O){this.#t.clear();const k=Array.isArray(O)?O:[];for(const b of this.inline?k:k.slice(0,1))this.#t.add(b);this.#i()}#i(){this.#r++,this.#n()}}const q=L}),He("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 M}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return a}}),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,W=1e-300;function I(t){if(t<.5)return Math.log(Math.PI/Math.sin(Math.PI*t))-I(1-t);const r=t-1;let s=.9999999999998099;const i=r+7.5;for(let n=0;n<ie.length;n++)s+=ie[n]/(r+n+1);return .5*Math.log(2*Math.PI)+(r+.5)*Math.log(i)-i+Math.log(s)}function x(t,r,s){const i=t+r,n=t+1,m=t-1;let c=1,l=1-i*s/n;Math.abs(l)<W&&(l=W),l=1/l;let u=l;for(let f=1;f<=300;f++){const p=2*f;let y=f*(r-f)*s/((m+p)*(t+p));l=1+y*l,Math.abs(l)<W&&(l=W),c=1+y/c,Math.abs(c)<W&&(c=W),l=1/l,u*=l*c,y=-(t+f)*(i+f)*s/((t+p)*(n+p)),l=1+y*l,Math.abs(l)<W&&(l=W),c=1+y/c,Math.abs(c)<W&&(c=W),l=1/l;const h=l*c;if(u*=h,Math.abs(h-1)<E)break}return u}function Q(t,r,s){if(!(t>0)||!(r>0)||!Number.isFinite(s))return Number.NaN;if(s<=0)return 0;if(s>=1)return 1;const i=Math.exp(I(t+r)-I(t)-I(r)+t*Math.log(s)+r*Math.log(1-s));return s<(t+1)/(t+r+2)?i*x(t,r,s)/t:1-i*x(r,t,1-s)/r}function U(t){if(!(t>0)||!(t<1))return t===0?-1/0:t===1?1/0:Number.NaN;const r=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],s=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],i=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],n=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],m=.02425;let c,l,u;t<m?(c=Math.sqrt(-2*Math.log(t)),u=(((((i[0]*c+i[1])*c+i[2])*c+i[3])*c+i[4])*c+i[5])/((((n[0]*c+n[1])*c+n[2])*c+n[3])*c+1)):t<=1-m?(c=t-.5,l=c*c,u=(((((r[0]*l+r[1])*l+r[2])*l+r[3])*l+r[4])*l+r[5])*c/(((((s[0]*l+s[1])*l+s[2])*l+s[3])*l+s[4])*l+1)):(c=Math.sqrt(-2*Math.log(1-t)),u=-(((((i[0]*c+i[1])*c+i[2])*c+i[3])*c+i[4])*c+i[5])/((((n[0]*c+n[1])*c+n[2])*c+n[3])*c+1));const p=(.5*L(-u/Math.SQRT2)-t)*Math.sqrt(2*Math.PI)*Math.exp(u*u/2);return u-p/(1+u*p/2)}function L(t){const r=Math.abs(t),s=2/(2+r),i=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,c=0,l;for(let f=n.length-1;f>0;f--)l=c,c=i*c-m+n[f],m=l;const u=s*Math.exp(-r*r+.5*(n[0]+i*c)-m);return t>=0?u:2-u}function q(t){return .5*L(-t/Math.SQRT2)}function M(t,r){if(!(r>0)||!Number.isFinite(t))return Number.NaN;const s=.5*Q(r/2,.5,r/(r+t*t));return t>0?1-s:s}function O(t,r){if(!(t>0)||!(t<1)||!(r>0))return Number.NaN;if(r>1e7)return U(t);let s=-1e4,i=1e4,n=U(t);const m=I(r/2)+I(.5)-I((r+1)/2);for(let c=0;c<60;c++){const l=M(n,r);l<t?s=n:i=n;const u=Math.exp(-((r+1)/2)*Math.log(1+n*n/r)-m)/Math.sqrt(r),f=u>0?(l-t)/u:0;if(Math.abs(f)<1e-12)break;const p=n-f;if(n=p>s&&p<i&&Number.isFinite(p)?p:(s+i)/2,i-s<1e-12)break}return n}function k(t,r){let s=t,i=1/t,n=i;for(let m=0;m<300&&(s+=1,n*=r/s,i+=n,!(Math.abs(n)<Math.abs(i)*E));m++);return i*Math.exp(-r+t*Math.log(r)-I(t))}function b(t,r){let s=r+1-t,i=1/W,n=1/s,m=n;for(let c=1;c<=300;c++){const l=-c*(c-t);s+=2,n=l*n+s,Math.abs(n)<W&&(n=W),i=s+l/i,Math.abs(i)<W&&(i=W),n=1/n;const u=n*i;if(m*=u,Math.abs(u-1)<E)break}return Math.exp(-r+t*Math.log(r)-I(t))*m}function a(t,r){return!(t>0)||!(r>=0)||!Number.isFinite(r)?Number.NaN:r===0?0:r<t+1?k(t,r):1-b(t,r)}function g(t,r){return r>0?a(r/2,t/2):Number.NaN}function o(t,r){const s=g(t,r);return Number.isNaN(s)?Number.NaN:Math.min(1,Math.max(0,1-s))}}),He("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 W}}),Object.defineProperty(e,"normalEquations",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return Q}});function ie(U){const L=U.length,q=Array.from({length:L},()=>new Array(L).fill(0));for(let M=0;M<L;M++)for(let O=0;O<=M;O++){let k=U[M][O];for(let b=0;b<O;b++)k-=q[M][b]*q[O][b];if(M===O){if(!(k>0))return null;q[M][O]=Math.sqrt(k)}else q[M][O]=k/q[O][O]}return q}function E(U,L){const q=U.length,M=new Array(q).fill(0);for(let k=0;k<q;k++){let b=L[k];for(let a=0;a<k;a++)b-=U[k][a]*M[a];M[k]=b/U[k][k]}const O=new Array(q).fill(0);for(let k=q-1;k>=0;k--){let b=M[k];for(let a=k+1;a<q;a++)b-=U[a][k]*O[a];O[k]=b/U[k][k]}return O}function W(U){const L=U.length,q=Array.from({length:L},()=>new Array(L).fill(0));for(let M=0;M<L;M++){const O=new Array(L).fill(0);O[M]=1;const k=E(U,O);for(let b=0;b<L;b++)q[b][M]=k[b]}return q}function I(U,L,q){const M=U.length,O=M?U[0].length:0,k=Array.from({length:O},()=>new Array(O).fill(0)),b=new Array(O).fill(0);for(let a=0;a<M;a++){const g=q?q[a]:1,o=U[a];for(let t=0;t<O;t++){const r=g*o[t];b[t]+=r*L[a];for(let s=t;s<O;s++)k[t][s]+=r*o[s]}}for(let a=0;a<O;a++)for(let g=0;g<a;g++)k[a][g]=k[g][a];return{xtwx:k,xtwy:b}}function x(U,L){return U.map(q=>q.reduce((M,O,k)=>M+O*L[k],0))}function Q(U,L){let q=0;for(let M=0;M<U.length;M++){let O=0;for(let k=0;k<U.length;k++)O+=L[M][k]*U[k];q+=U[M]*O}return q}}),He("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 x}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return O}}),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(a){if(!Number.isFinite(a))return;this.#e++;const g=a-this.#t;this.#t+=g/this.#e,this.#n+=g*(a-this.#t)}merge(a){if(a.#e===0)return;if(this.#e===0){this.#e=a.#e,this.#t=a.#t,this.#n=a.#n;return}const g=this.#e+a.#e,o=a.#t-this.#t;this.#t+=o*(a.#e/g),this.#n+=a.#n+o*o*(this.#e*a.#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 a=this.variance();return a===null?null:Math.sqrt(a)}stddevP(){const a=this.varianceP();return a===null?null:Math.sqrt(a)}}class E{#e=[];#t=0;#n;#r;constructor(a,g=Math.random){if(!(a>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(a),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(a){if(!Number.isFinite(a))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(a);return}const g=Math.floor(this.#r()*this.#t);g<this.#n&&(this.#e[g]=a)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let a=0;for(const g of this.#e)a+=g;return a/this.#e.length}quantile(a){const g=this.#e.length;if(!g)return null;const o=this.#e.slice().sort((i,n)=>i-n);if(g===1)return o[0];const t=(g-1)*Math.min(1,Math.max(0,a)),r=Math.floor(t),s=Math.ceil(t);return r===s?o[r]:o[r]+(t-r)*(o[s]-o[r])}}function W(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),W(o.getUint32(0)^o.getUint32(4))}const a=typeof b=="string"?b:String(b);let g=2166136261;for(let o=0;o<a.length;o++)g^=a.charCodeAt(o),g=Math.imul(g,16777619);return W(g)}class x{#e;#t;#n;constructor(a=14){const g=Math.floor(a);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(a=14){const g=1<<Math.floor(a),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 x.errorBoundFor(this.#e)}add(a){const g=I(a),o=g&this.#t-1,t=g>>>this.#e|1<<32-this.#e;let r=1,s=t;for(;(s&1)===0;)r++,s>>>=1;r>this.#n[o]&&(this.#n[o]=r)}count(){const a=this.#t,g=32-this.#e,o=new Float64Array(g+2);for(let s=0;s<a;s++)o[this.#n[s]]++;let t=a*L(1-o[g+1]/a);for(let s=g;s>=1;s--)t=.5*(t+o[s]);t+=a*U(o[0]/a);const r=Q*a*a/t;return Math.round(r)}}const Q=.5/Math.log(2);function U(b){if(b===1)return 1/0;let a=1,g=b,o;do b*=b,o=g,g+=b*a,a+=a;while(g!==o);return g}function L(b){if(b===0||b===1)return 0;let a=1,g=1-b,o;do b=Math.sqrt(b),o=g,a*=.5,g-=(1-b)**2*a;while(g!==o);return g/3}class q{#e=new Map;#t;#n=0;constructor(a){if(!(a>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(a)}errorBoundFor(a){const g=a/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=${a}, m=${this.#t})`})}get seen(){return this.#n}add(a){this.#n++;const g=this.#e.get(a);if(g){g.count++;return}if(this.#e.size<this.#t){this.#e.set(a,{count:1,error:0});return}let o,t=1/0;for(const[r,s]of this.#e)s.count<t&&(t=s.count,o=r);this.#e.delete(o),this.#e.set(a,{count:t+1,error:t})}top(a=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(a)))}}class M{#e;#t=[[]];#n=0;#r;#i;constructor(a=200,g=Math.random){this.#e=Math.max(8,Math.floor(a)),this.#r=g,this.#i=2/3}static errorBoundFor(a=200){const g=1/Math.max(8,Math.floor(a));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=${a})`})}errorBound(){return M.errorBoundFor(this.#e)}get count(){return this.#n}#s(a){const o=this.#t.length-1-a,t=Math.ceil(this.#e*this.#i**o);return Math.max(2,t)}add(a){Number.isFinite(a)&&(this.#n++,this.#t[0].push(a),this.#t[0].length>=this.#s(0)&&this.#o(0))}#o(a){const g=this.#t[a];g.sort((r,s)=>r-s),a+1>=this.#t.length&&this.#t.push([]);const o=this.#t[a+1],t=this.#r()<.5?0:1;for(let r=t;r<g.length;r+=2)o.push(g[r]);this.#t[a]=[];for(let r=0;r<this.#t.length;r++)if(this.#t[r].length>=this.#s(r)){this.#o(r);return}}#l(){const a=[];for(let g=0;g<this.#t.length;g++){const o=1<<g;for(const t of this.#t[g])a.push({v:t,w:o})}return a}quantile(a){const g=this.#l();if(!g.length)return null;g.sort((s,i)=>s.v-i.v);let o=0;for(const s of g)o+=s.w;const t=Math.min(1,Math.max(0,a))*o;let r=0;for(const s of g)if(r+=s.w,r>=t)return s.v;return g[g.length-1].v}rank(a){let g=0;for(let o=0;o<this.#t.length;o++){const t=1<<o;for(const r of this.#t[o])r<=a&&(g+=t)}return g}}const O=Object.freeze({distinct:x.errorBoundFor(14),median:M.errorBoundFor(200),p25:M.errorBoundFor(200),p75:M.errorBoundFor(200),p90:M.errorBoundFor(200),p95:M.errorBoundFor(200),p99:M.errorBoundFor(200),iqr:M.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:x,SpaceSaving:q,KLL:M,hash32:I,SKETCH_BOUNDS:O}}),He("packages/core/src/compute/statistics.js",function(e,F){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return i}}),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 c}}),Object.defineProperty(e,"herfindahl",{enumerable:!0,get:function(){return u}}),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 G}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"modifiedZOutliers",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"jarqueBera",{enumerable:!0,get:function(){return j}}),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 _}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return be}}),Object.defineProperty(e,"autocorrelations",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"spearman",{enumerable:!0,get:function(){return de}}),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 he}}),Object.defineProperty(e,"D4_N2",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"movingRanges",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"withinSigma",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return Ae}}),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,W=ie.valueReader,I=F("packages/core/src/compute/special.js"),x=I.studentTQuantile,Q=I.studentT,U=I.normalQuantile,L=I.normalCdf,q=I.chiSquareUpperTail,M=F("packages/core/src/compute/linalg.js"),O=M.cholesky,k=M.choleskySolve,b=M.choleskyInverse,a=M.normalEquations,g=M.quadForm,t=F("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,r=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"}),i=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(le){const ge=le==="sum"||le==="avg"||le==="countValues"||le==="min"||le==="max"?"maintained":Object.prototype.hasOwnProperty.call(s,le)?s[le]:null,ye=Object.prototype.hasOwnProperty.call(i,le)?i[le]:null;return{stat:le,exact:ge,approximate:ye}}function m(le,ge){const ye=ge.length,Pe=new Float64Array(ye);let Ne=0;if(le&&(le.kind==="float64"||le.kind==="int32")){const De=le.values,Ge=E(le);for(let Ve=0;Ve<ye;Ve++){const Qe=ge[Ve];if(Ge&&Ge(Qe)!==1)continue;const mt=De[Qe];Number.isNaN(mt)||(Pe[Ne++]=mt)}return Pe.subarray(0,Ne)}const ze=W(le);for(let De=0;De<ye;De++){const Ge=ze(ge[De]);if(Ge==null||Ge==="")continue;const Ve=typeof Ge=="number"?Ge:Number(Ge);Number.isFinite(Ve)&&(Pe[Ne++]=Ve)}return Pe.subarray(0,Ne)}function c(le,ge){const ye=new Map,Pe=W(le);let Ne=0;for(let ze=0;ze<ge.length;ze++){const De=Pe(ge[ze]);if(De==null||De===""||typeof De=="number"&&Number.isNaN(De))continue;const Ge=typeof De=="object"?String(De):De;ye.set(Ge,(ye.get(Ge)||0)+1),Ne++}const Le=[...ye.values()].sort((ze,De)=>De-ze);return{counts:Le,total:Ne,distinct:Le.length}}function l(le){return le.total>0?le.counts.map(ge=>ge/le.total):[]}function u(le,ge){const ye=c(le,ge);if(!ye.total)return null;let Pe=0;for(const Ne of l(ye))Pe+=Ne*Ne;return Pe}function f(le,ge){const ye=c(le,ge);if(!ye.total)return null;let Pe=0;for(const Ne of l(ye))Ne>0&&(Pe-=Ne*Math.log2(Ne));return Pe}function p(le,ge){const ye=c(le,ge);if(!ye.total||ye.distinct<2)return ye.total?1:null;let Pe=0;for(const Ne of l(ye))Ne>0&&(Pe-=Ne*Math.log2(Ne));return Pe/Math.log2(ye.distinct)}function y(le,ge,ye=3){const Pe=c(le,ge);if(!Pe.total)return null;const Ne=Math.max(1,Math.floor(ye));let Le=0;for(let ze=0;ze<Math.min(Ne,Pe.counts.length);ze++)Le+=Pe.counts[ze];return Le/Pe.total}function h(le,ge){const ye=m(le,ge),Pe=ye.length;if(!Pe)return null;const Ne=ye.slice().sort();if(Ne[0]<0)return null;let Le=0,ze=0;for(let De=0;De<Pe;De++)Le+=Ne[De],ze+=(De+1)*Ne[De];return Le===0?0:2*ze/(Pe*Le)-(Pe+1)/Pe}function d(le){let ge=0,ye=0,Pe=0;for(let Ne=0;Ne<le.length;Ne++){const Le=le[Ne];ge++;const ze=Le-ye;ye+=ze/ge,Pe+=ze*(Le-ye)}return{n:ge,mean:ye,m2:Pe}}function w(le,ge){const ye=le.length;if(!ye)return NaN;if(ye===1)return le[0];const Pe=(ye-1)*Math.min(1,Math.max(0,ge)),Ne=Math.floor(Pe),Le=Math.ceil(Pe);return Ne===Le?le[Ne]:le[Ne]+(Pe-Ne)*(le[Le]-le[Ne])}function v(le,ge){if(!le.length)return NaN;const ye=le.slice().sort();return w(ye,ge)}function P(le,ge){const ye=W(le);let Pe=0,Ne=0,Le=0;for(let ze=0;ze<ge.length;ze++){const De=ye(ge[ze]);if(De==null||De==="")continue;const Ge=String(De).toUpperCase();Ge==="PASS"?Pe++:Ge==="FAIL"?Ne++:Ge==="WARN"&&Le++}return{pass:Pe+Le,fail:Ne,warn:Le,judged:Pe+Le+Ne}}const G=Object.freeze({hhi:(le,ge)=>u(le,ge),entropy:(le,ge)=>f(le,ge),evenness:(le,ge)=>p(le,ge),top3Share:(le,ge)=>y(le,ge,3),top10Share:(le,ge)=>y(le,ge,10),gini:(le,ge)=>h(le,ge),trimmedMean:(le,ge)=>A(m(le,ge),.1),winsorizedMean:(le,ge)=>S(m(le,ge),.1),robustOutliers:(le,ge)=>R(m(le,ge),3.5),jarqueBera:(le,ge)=>j(m(le,ge)),variance:(le,ge)=>{const{n:ye,m2:Pe}=d(m(le,ge));return ye>1?Pe/(ye-1):null},varianceP:(le,ge)=>{const{n:ye,m2:Pe}=d(m(le,ge));return ye>0?Pe/ye:null},stddev:(le,ge)=>{const{n:ye,m2:Pe}=d(m(le,ge));return ye>1?Math.sqrt(Pe/(ye-1)):null},stddevP:(le,ge)=>{const{n:ye,m2:Pe}=d(m(le,ge));return ye>0?Math.sqrt(Pe/ye):null},median:(le,ge)=>{const ye=m(le,ge);return ye.length?v(ye,.5):null},percentile:(le,ge,ye)=>{const Pe=ye?ye.p:void 0;if(typeof Pe!="number"||!(Pe>=0&&Pe<=1))return null;const Ne=m(le,ge);return Ne.length?v(Ne,Pe):null},p25:(le,ge)=>{const ye=m(le,ge);return ye.length?v(ye,.25):null},p75:(le,ge)=>{const ye=m(le,ge);return ye.length?v(ye,.75):null},p90:(le,ge)=>{const ye=m(le,ge);return ye.length?v(ye,.9):null},p95:(le,ge)=>{const ye=m(le,ge);return ye.length?v(ye,.95):null},p99:(le,ge)=>{const ye=m(le,ge);return ye.length?v(ye,.99):null},iqr:(le,ge)=>{const ye=m(le,ge);if(!ye.length)return null;const Pe=ye.slice().sort();return w(Pe,.75)-w(Pe,.25)},mad:(le,ge)=>{const ye=m(le,ge);if(!ye.length)return null;const Pe=v(ye,.5),Ne=new Float64Array(ye.length);for(let Le=0;Le<ye.length;Le++)Ne[Le]=Math.abs(ye[Le]-Pe);return v(Ne,.5)},range:(le,ge)=>{const ye=m(le,ge);if(!ye.length)return null;let Pe=1/0,Ne=-1/0;for(let Le=0;Le<ye.length;Le++)ye[Le]<Pe&&(Pe=ye[Le]),ye[Le]>Ne&&(Ne=ye[Le]);return Ne-Pe},distinct:(le,ge)=>{const ye=W(le),Pe=new Set;for(let Ne=0;Ne<ge.length;Ne++){const Le=ye(ge[Ne]);Le==null||Le===""||Pe.add(Le instanceof Date?Le.getTime():Le)}return Pe.size},mode:(le,ge)=>{const ye=W(le),Pe=new Map;for(let ze=0;ze<ge.length;ze++){const De=ye(ge[ze]);if(De==null||De==="")continue;const Ge=De instanceof Date?De.getTime():De;Pe.set(Ge,(Pe.get(Ge)||0)+1)}let Ne=null,Le=1;for(const[ze,De]of Pe)De>Le&&(Le=De,Ne=ze);return Ne},skewness:(le,ge)=>{const ye=m(le,ge),{n:Pe,mean:Ne,m2:Le}=d(ye);if(Pe<3||Le<=0)return null;const ze=Math.sqrt(Le/(Pe-1));let De=0;for(let Ge=0;Ge<ye.length;Ge++)De+=((ye[Ge]-Ne)/ze)**3;return Pe/((Pe-1)*(Pe-2))*De},kurtosis:(le,ge)=>{const ye=m(le,ge),{n:Pe,mean:Ne,m2:Le}=d(ye);if(Pe<4||Le<=0)return null;const ze=Math.sqrt(Le/(Pe-1));let De=0;for(let Qe=0;Qe<ye.length;Qe++)De+=((ye[Qe]-Ne)/ze)**4;const Ge=Pe*(Pe+1)/((Pe-1)*(Pe-2)*(Pe-3)),Ve=3*(Pe-1)**2/((Pe-2)*(Pe-3));return Ge*De-Ve},geomean:(le,ge)=>{const ye=m(le,ge);if(!ye.length)return null;let Pe=0;for(let Ne=0;Ne<ye.length;Ne++){if(ye[Ne]<=0)return null;Pe+=Math.log(ye[Ne])}return Math.exp(Pe/ye.length)},harmean:(le,ge)=>{const ye=m(le,ge);if(!ye.length)return null;let Pe=0;for(let Ne=0;Ne<ye.length;Ne++){if(ye[Ne]===0)return null;Pe+=1/ye[Ne]}return ye.length/Pe},sumSquares:(le,ge)=>{const ye=m(le,ge);let Pe=0;for(let Ne=0;Ne<ye.length;Ne++)Pe+=ye[Ne]*ye[Ne];return Pe},passRate:(le,ge)=>{const{pass:ye,judged:Pe}=P(le,ge);return Pe?ye/Pe:null},failureCount:(le,ge)=>P(le,ge).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 K(le,ge,ye){const Pe=W(le),Ne=W(ge);let Le=0,ze=0;for(let De=0;De<ye.length;De++){const Ge=ye[De],Ve=Number(Pe(Ge)),Qe=Number(Ne(Ge));!Number.isFinite(Ve)||!Number.isFinite(Qe)||(Le+=Ve*Qe,ze+=Qe)}return ze===0?null:Le/ze}function H(le,ge,ye){const Pe=W(le);let Ne=null,Le=ye?-1/0:1/0;for(let ze=0;ze<ge.length;ze++){const De=ge[ze],Ge=Number(Pe(De));Number.isFinite(Ge)&&(ye?Ge>Le:Ge<Le)&&(Le=Ge,Ne=De)}return Ne}function T(le,ge,ye){const Pe=W(le),Ne=W(ge);let Le=0,ze=0,De=0,Ge=0,Ve=0,Qe=0;for(let dt=0;dt<ye.length;dt++){const jt=ye[dt],Lt=Number(Pe(jt)),At=Number(Ne(jt));!Number.isFinite(Lt)||!Number.isFinite(At)||(Le++,ze+=Lt,De+=At,Ge+=Lt*Lt,Ve+=At*At,Qe+=Lt*At)}if(Le<2)return null;const mt=Le*Qe-ze*De,Ot=Math.sqrt((Le*Ge-ze*ze)*(Le*Ve-De*De));if(Ot===0)return null;const gt=mt/Ot;return Math.max(-1,Math.min(1,gt))}function A(le,ge=.1){const ye=le.length;if(!ye)return null;const Pe=Array.from(le).sort((De,Ge)=>De-Ge),Ne=Math.floor(ye*Math.min(.49,Math.max(0,ge))),Le=Pe.slice(Ne,ye-Ne);if(!Le.length)return w(Pe,.5);let ze=0;for(const De of Le)ze+=De;return ze/Le.length}function S(le,ge=.1){const ye=le.length;if(!ye)return null;const Pe=Array.from(le).sort((Ge,Ve)=>Ge-Ve),Ne=Math.floor(ye*Math.min(.49,Math.max(0,ge))),Le=Pe[Ne],ze=Pe[ye-1-Ne];let De=0;for(const Ge of Pe)De+=Math.min(ze,Math.max(Le,Ge));return De/ye}function R(le,ge=3.5){if(!le.length)return null;const Pe=Array.from(le).sort((Ge,Ve)=>Ge-Ve),Ne=w(Pe,.5),Le=Pe.map(Ge=>Math.abs(Ge-Ne)).sort((Ge,Ve)=>Ge-Ve),ze=w(Le,.5);if(ze===0)return null;let De=0;for(const Ge of Pe)Math.abs(.6745*(Ge-Ne)/ze)>ge&&De++;return De}function j(le){const ge=le.length;if(ge<8)return null;let ye=0;for(const Ge of le)ye+=Ge;ye/=ge;let Pe=0,Ne=0,Le=0;for(const Ge of le){const Ve=Ge-ye;Pe+=Ve*Ve,Ne+=Ve*Ve*Ve,Le+=Ve*Ve*Ve*Ve}if(Pe/=ge,Ne/=ge,Le/=ge,Pe===0)return null;const ze=Ne/Pe**1.5,De=Le/(Pe*Pe)-3;return ge/6*(ze*ze+De*De/4)}function N(le,ge,ye){const Pe=[];let Ne=0;for(let Ge=0;Ge<le.length;Ge++){const Ve=Number(le[Ge]),Qe=Number(ge[Ge]);!Number.isFinite(Ve)||!Number.isFinite(Qe)||Qe<=0||(Pe.push([Ve,Qe]),Ne+=Qe)}if(!Pe.length||Ne<=0)return null;if(Pe.sort((Ge,Ve)=>Ge[0]-Ve[0]),Pe.length===1)return Pe[0][0];const Le=[];let ze=0;for(const[,Ge]of Pe)Le.push((ze+Ge/2)/Ne),ze+=Ge;const De=Math.max(0,Math.min(1,ye));if(De<=Le[0])return Pe[0][0];if(De>=Le[Le.length-1])return Pe[Pe.length-1][0];for(let Ge=1;Ge<Le.length;Ge++){if(De>Le[Ge])continue;const Ve=Le[Ge]-Le[Ge-1],Qe=Ve>0?(De-Le[Ge-1])/Ve:0;return Pe[Ge-1][0]+(Pe[Ge][0]-Pe[Ge-1][0])*Qe}return Pe[Pe.length-1][0]}function $(le,ge,ye){const Pe=W(le),Ne=W(ge),Le=new Float64Array(ye.length),ze=new Float64Array(ye.length);let De=0;for(let Ge=0;Ge<ye.length;Ge++){const Ve=ye[Ge],Qe=Number(Pe(Ve)),mt=Number(Ne(Ve));!Number.isFinite(Qe)||!Number.isFinite(mt)||(Le[De]=Qe,ze[De]=mt,De++)}return{xs:Le.subarray(0,De),ys:ze.subarray(0,De),n:De}}function _(le,ge,ye,Pe=!1){const{xs:Ne,ys:Le,n:ze}=$(le,ge,ye);if(ze<2)return null;let De=0,Ge=0;for(let Qe=0;Qe<ze;Qe++)De+=Ne[Qe],Ge+=Le[Qe];De/=ze,Ge/=ze;let Ve=0;for(let Qe=0;Qe<ze;Qe++)Ve+=(Ne[Qe]-De)*(Le[Qe]-Ge);return Ve/(Pe?ze:ze-1)}function Y(le,ge,ye){const{xs:Pe,ys:Ne,n:Le}=$(le,ge,ye);if(Le<2)return null;let ze=0,De=0;for(let Lt=0;Lt<Le;Lt++)ze+=Pe[Lt],De+=Ne[Lt];ze/=Le,De/=Le;let Ge=0,Ve=0,Qe=0;for(let Lt=0;Lt<Le;Lt++){const At=Pe[Lt]-ze,Bt=Ne[Lt]-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=Le>2?Math.sqrt(dt/(Le-2)/Ge):0;return{slope:mt,intercept:Ot,r2:gt,stdError:jt,n:Le}}const Z=new Set(["ols","wls","robust"]),J=new Set(["quantile"]),D=new Set(["ridge","lasso","elasticnet","mixed","gls"]),te=1.345;function z(le,ge,ye){const{xtwx:Pe,xtwy:Ne}=a(le,ge,ye),Le=O(Pe);if(!Le)return null;const ze=k(Le,Ne),De=b(Le),Ge=X(le,ze),Ve=ge.map((Qe,mt)=>Qe-Ge[mt]);return{beta:ze,cov:De,fitted:Ge,residuals:Ve}}function X(le,ge){return le.map(ye=>ye.reduce((Pe,Ne,Le)=>Pe+Ne*ge[Le],0))}function ne(le,ge){const ye=le.length,Pe=le.map(Ve=>Ve[ge]),Ne=le.map(Ve=>[1,...Ve.filter((Qe,mt)=>mt!==ge)]),Le=z(Ne,Pe,null);if(!Le)return 1;const ze=Pe.reduce((Ve,Qe)=>Ve+Qe,0)/ye;let De=0,Ge=0;for(let Ve=0;Ve<ye;Ve++)De+=Le.residuals[Ve]**2,Ge+=(Pe[Ve]-ze)**2;return Ge===0?1:Math.max(0,Math.min(1,1-De/Ge))}function re(le){const ge=[...le].sort((Ne,Le)=>Ne-Le),ye=ae(ge),Pe=le.map(Ne=>Math.abs(Ne-ye)).sort((Ne,Le)=>Ne-Le);return ae(Pe)/.6745}function ae(le){const ge=le.length;if(!ge)return 0;const ye=Math.floor(ge/2);return ge%2?le[ye]:(le[ye-1]+le[ye])/2}function fe(le,ge,ye={}){const Pe=ye.method||"ols";if(D.has(Pe))throw new Error(`[lattice] regression method "${Pe}" is out of scope; use ols, wls or robust.`);if(J.has(Pe))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!Z.has(Pe))throw new Error(`[lattice] unknown regression method "${Pe}"; use ols, wls or robust.`);const Ne=Array.isArray(ge)?ge.length:0,Le=Ne&&Array.isArray(le[0])?le[0].length:0,ze=Le+1;if(!(Ne>ze))return null;for(let St=0;St<Ne;St++){if(!Number.isFinite(ge[St])||!Array.isArray(le[St])||le[St].length!==Le)return null;for(let Mt=0;Mt<Le;Mt++)if(!Number.isFinite(le[St][Mt]))return null}let De=null;if(Pe==="wls"){if(De=ye.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=le.map(St=>[1,...St]);let Ve,Qe=null;if(Pe==="robust"){if(Ve=z(Ge,ge,null),!Ve)return null;for(let St=0;St<50;St++){const Mt=re(Ve.residuals);if(!(Mt>0))break;const Wt=Ve.residuals.map(_t=>{const Gt=Math.abs(_t/Mt);return Gt<=te?1:te/Gt}),Ht=z(Ge,ge,Wt);if(!Ht)return null;const zt=Ht.beta.reduce((_t,Gt,Dt)=>Math.max(_t,Math.abs(Gt-Ve.beta[Dt])),0);if(Ve=Ht,Qe=Wt,zt<1e-10)break}}else if(Ve=z(Ge,ge,De),!Ve)return null;const mt=Pe==="robust"?Qe:De,{beta:Ot,cov:gt,fitted:dt,residuals:jt}=Ve;let Lt=0,At=0,Bt=0;for(let St=0;St<Ne;St++){const Mt=mt?mt[St]:1;Lt+=Mt*jt[St]**2,At+=Mt,Bt+=Mt*ge[St]}const nn=Bt/At;let Vt=0;for(let St=0;St<Ne;St++){const Mt=mt?mt[St]:1;Vt+=Mt*(ge[St]-nn)**2}const Zt=Ne-ze,Xe=Lt/Zt,ot=Vt===0?1:Math.max(0,Math.min(1,1-Lt/Vt)),vt=1-(1-ot)*(Ne-1)/Zt,pt=Array.isArray(ye.names)&&ye.names.length===Le?ye.names:le[0].map((St,Mt)=>`x${Mt+1}`),yt=Ke(ye.confidence),We=Zt>0?x(1-(1-yt)/2,Zt):1/0,at=Ot.map((St,Mt)=>{const Wt=Math.sqrt(Math.max(0,Xe*gt[Mt][Mt])),Ht=Wt>0?St/Wt:St===0?0:1/0,zt=Number.isFinite(Ht)?2*(1-Q(Math.abs(Ht),Zt)):0,_t=Number.isFinite(We)?We*Wt:null;return{name:Mt===0?"(intercept)":pt[Mt-1],estimate:St,stdError:Wt,t:Ht,p:Math.max(0,Math.min(1,zt)),lower:_t===null?null:St-_t,upper:_t===null?null:St+_t}}),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 Ht=(1-Wt)**2;lt[St]=Ht>0&&Xe>0?jt[St]**2/(ze*Xe)*(Wt/Ht):null}const Rt=le[0].map((St,Mt)=>{if(Le<2)return 1;const Wt=ne(le,Mt);return Wt>=1?1/0:1/(1-Wt)});let xt=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 Ht=0,zt=0;for(let Qt=0;Qt<Ne;Qt++)Ht+=Mt.residuals[Qt]**2,zt+=(St[Qt]-Wt)**2;const _t=zt===0?0:Math.max(0,Math.min(1,1-Ht/zt)),Gt=Ne*_t,Dt=q(Gt,Le);xt={statistic:Gt,df:Le,p:Dt,heteroscedastic:Dt<.05}}}let bt=null;if(Le===1){const St=le.map((Mt,Wt)=>Wt).sort((Mt,Wt)=>le[Mt][0]-le[Wt][0]);bt={confidence:yt,points:St.map(Mt=>{const Wt=Ge[Mt],Ht=Math.sqrt(Math.max(0,Xe*g(Wt,gt)));return{x:le[Mt][0],yhat:dt[Mt],lower:dt[Mt]-We*Ht,upper:dt[Mt]+We*Ht}})}}return{method:Pe,coefficients:at,r2:ot,adjR2:vt,n:Ne,df:Zt,sigma2:Xe,fitted:dt,residuals:jt,leverage:rt,cooksD:lt,vif:Rt,heteroscedasticity:xt,band:bt,weights:mt?[...mt]:null}}function we(le){const ge=le.length,ye=Array.from({length:ge},(Le,ze)=>ze).sort((Le,ze)=>le[Le]-le[ze]),Pe=new Float64Array(ge);let Ne=0;for(;Ne<ge;){let Le=Ne;for(;Le+1<ge&&le[ye[Le+1]]===le[ye[Ne]];)Le++;const ze=(Ne+Le)/2+1;for(let De=Ne;De<=Le;De++)Pe[ye[De]]=ze;Ne=Le+1}return Pe}const ve=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function Re(le){const ge=[.01,.05,.1],ye=[ve["1%"],ve["5%"],ve["10%"]];if(le<=ye[0]){const Le=(Math.log(ge[1])-Math.log(ge[0]))/(ye[1]-ye[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(ge[0])+Le*(le-ye[0]))))}if(le>=ye[2]){const Le=(Math.log(ge[2])-Math.log(ge[1]))/(ye[2]-ye[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(ge[2])+Le*(le-ye[2]))))}const Pe=le<ye[1]?0:1,Ne=(le-ye[Pe])/(ye[Pe+1]-ye[Pe]);return Math.exp(Math.log(ge[Pe])+Ne*(Math.log(ge[Pe+1])-Math.log(ge[Pe])))}function $e(le,ge,ye,Pe){const Ne=ye-Pe,Le=Pe+3,ze=new Array(Ne),De=new Array(Ne);let Ge=!0,Ve=Pe;for(let dt=0;dt<Ne;dt++){const jt=Pe+dt,Lt=new Float64Array(Le);Lt[0]=1,Lt[1]=dt+1,Lt[2]=le[jt];for(let At=1;At<=Pe;At++)Lt[2+At]=ge[jt-At];for(let At=1;At<Le;At++)Number.isFinite(Lt[At])||(Ve=Math.min(Ve,At-3));ze[dt]=Lt,De[dt]=ge[jt],Number.isFinite(De[dt])||(Ge=!1)}if(!Ge)return 0;const{xtwx:Qe,xtwy:mt}=a(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 Lt=new Array(jt);for(let ot=0;ot<jt;ot++)Lt[ot]=Qe[ot].slice(0,jt);const At=O(Lt);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 be(le,ge={}){const ye=[];for(let gt=0;gt<le.length;gt++){const dt=Number(le[gt]);Number.isFinite(dt)&&ye.push(dt)}const Pe=ye.length,Ne=Pe-1;if(Pe<8||Ne<6)return null;const Le=new Array(Ne);for(let gt=0;gt<Ne;gt++)Le[gt]=ye[gt+1]-ye[gt];let ze=Number.isFinite(ge.maxlag)?Math.floor(ge.maxlag):Math.ceil(12*(Pe/100)**.25);ze=Math.max(0,Math.min(ze,Math.floor((Ne-5)/2)));const De=(gt,dt)=>{const jt=[],Lt=[];for(let At=dt;At<Ne;At++){const Bt=[At-dt+1,ye[At]];for(let nn=1;nn<=gt;nn++)Bt.push(Le[At-nn]);jt.push(Bt),Lt.push(Le[At])}return fe(jt,Lt,{method:"ols"})},Ge=$e(ye,Le,Ne,ze),Ve=De(Ge,Ge);if(!Ve||!Ve.coefficients[2])return null;const Qe=Ve.coefficients[2].t,mt=Re(Qe),Ot=Qe<ve["5%"];return{statistic:Qe,usedLag:Ge,nobs:Ne-Ge,criticalValues:{...ve},pValue:mt,pApproximate:!0,stationary:Ot,verdict:Ot?"stationary":"non-stationary",regression:"ct"}}function se(le,ge={}){const ye=[];for(let Ot=0;Ot<le.length;Ot++){const gt=Number(le[Ot]);Number.isFinite(gt)&&ye.push(gt)}const Pe=ye.length;if(Pe<3)return null;let Ne=Number.isFinite(ge.maxlag)?Math.floor(ge.maxlag):Math.min(10,Pe-1);Ne=Math.max(1,Math.min(Ne,Pe-1));let Le=0;for(const Ot of ye)Le+=Ot;Le/=Pe;const ze=ye.map(Ot=>Ot-Le);let De=0;for(const Ot of ze)De+=Ot*Ot;De/=Pe;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<Pe;dt++)gt+=ze[dt]*ze[dt-Ot];Ge[Ot]=De>0?gt/Pe/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,Lt=new Array(Ot);for(let At=1;At<Ot;At++)Lt[At-1]=Qe[At-1]-jt*Qe[Ot-1-At];Lt[Ot-1]=jt,Ve[Ot]=jt,Qe=Lt}const mt=1.96/Math.sqrt(Pe);return{acf:Ge,pacf:Ve,bounds:{upper:mt,lower:-mt},n:Pe,nlags:Ne,approximate:!0}}function de(le,ge,ye){const{xs:Pe,ys:Ne,n:Le}=$(le,ge,ye);if(Le<2)return null;const ze=we(Pe),De=we(Ne);let Ge=0,Ve=0;for(let gt=0;gt<Le;gt++)Ge+=ze[gt],Ve+=De[gt];Ge/=Le,Ve/=Le;let Qe=0,mt=0,Ot=0;for(let gt=0;gt<Le;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(le,ge,ye){const{xs:Pe,ys:Ne,n:Le}=$(le,ge,ye);if(Le<2||Le>r)return null;let ze=0,De=0,Ge=0,Ve=0;for(let Ot=0;Ot<Le;Ot++)for(let gt=Ot+1;gt<Le;gt++){const dt=Math.sign(Pe[Ot]-Pe[gt]),jt=Math.sign(Ne[Ot]-Ne[gt]),Lt=dt*jt;Lt>0?ze++:Lt<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(le,ge={}){const ye=le.length;if(ye<2)return null;const Pe=le[0],Ne=le[ye-1],Le=[];for(let At=1;At<ye;At++){const Bt=le[At-1];Bt!==0&&Le.push((le[At]-Bt)/Math.abs(Bt))}let ze=null;if(Le.length>1){let At=0;for(const nn of Le)At+=nn;At/=Le.length;let Bt=0;for(const nn of Le)Bt+=(nn-At)**2;ze=Math.sqrt(Bt/(Le.length-1))}const De=Number(ge.periodsPerYear)>0?Number(ge.periodsPerYear):null;let Ge=le[0],Ve=0,Qe=0,mt=0,Ot=0;for(let At=1;At<ye;At++){if(le[At]>Ge){Ge=le[At],Ve=At;continue}if(Ge<=0)continue;const Bt=(Ge-le[At])/Ge;Bt>Qe&&(Qe=Bt,mt=Ve,Ot=At)}let gt=null;if(ye>2){let At=0;for(let Vt=0;Vt<ye;Vt++)At+=le[Vt];At/=ye;let Bt=0,nn=0;for(let Vt=0;Vt<ye;Vt++){const Zt=le[Vt]-At;nn+=Zt*Zt,Vt>0&&(Bt+=Zt*(le[Vt-1]-At))}gt=nn>0?Bt/nn:null}let dt=0,jt=0;for(const At of Le)At>0?dt++:At<0&&jt++;let Lt=null;if(Pe>0&&Ne>0){const At=(Ne/Pe)**(1/(ye-1))-1;Lt=De?(1+At)**De-1:At}return{n:ye,first:Pe,last:Ne,change:Ne-Pe,changePercent:Pe===0?null:(Ne-Pe)/Math.abs(Pe)*100,volatility:ze,annualisedVolatility:ze!==null&&De?ze*Math.sqrt(De):null,growth:Lt,maxDrawdown:Qe,maxDrawdownFrom:mt,maxDrawdownTo:Ot,autocorrelation:gt,upDays:dt,downDays:jt}}const he=1.128,Oe=3.267;function Se(le){const ge=le.length;if(ge<2)return null;const ye=[];for(let Ne=1;Ne<ge;Ne++)ye.push(Math.abs(le[Ne]-le[Ne-1]));const Pe=ye.reduce((Ne,Le)=>Ne+Le,0)/ye.length;return{ranges:ye,centre:Pe,upper:Oe*Pe,lower:0}}function Ce(le){const ge=le.length;if(ge<2)return null;let ye=0;for(let Ne=1;Ne<ge;Ne++)ye+=Math.abs(le[Ne]-le[Ne-1]);const Pe=ye/(ge-1);return{sigma:Pe/he,meanRange:Pe}}function Ie(le,ge){const ye=le.length;if(ye<2||!ge)return null;const Pe=Number.isFinite(Number(ge.lower))?Number(ge.lower):null,Ne=Number.isFinite(Number(ge.upper))?Number(ge.upper):null;if(Pe===null&&Ne===null)return null;let Le=0;for(let dt=0;dt<ye;dt++)Le+=le[dt];Le/=ye;let ze=0;for(let dt=0;dt<ye;dt++)ze+=(le[dt]-Le)**2;const De=Math.sqrt(ze/(ye-1)),Ge=Ce(le),Ve=Ge?Ge.sigma:null,Qe=dt=>{if(!dt||dt<=0)return{index:null,k:null};const Lt=Pe!==null&&Ne!==null?(Ne-Pe)/(6*dt):null,At=Ne!==null?(Ne-Le)/(3*dt):1/0,Bt=Pe!==null?(Le-Pe)/(3*dt):1/0;return{index:Lt,k:Math.min(At,Bt)}},mt=Qe(Ve),Ot=Qe(De);let gt=0;for(let dt=0;dt<ye;dt++){if(Pe!==null&&le[dt]<Pe){gt++;continue}Ne!==null&&le[dt]>Ne&>++}return{n:ye,mean:Le,lower:Pe,upper:Ne,target:Number.isFinite(Number(ge.target))?Number(ge.target):null,sigmaWithin:Ve,sigmaOverall:De,cp:mt.index,cpk:mt.k,pp:Ot.index,ppk:Ot.k,outOfSpec:gt,defectRate:ye?gt/ye:null}}function ke(le){const ge=le.length;if(ge<2)return null;const ye=Ce(le);if(!ye||!(ye.sigma>0))return null;let Pe=0;for(let Ne=0;Ne<ge;Ne++)Pe+=le[Ne];return Pe/=ge,{centre:Pe,sigma:ye.sigma,upper:Pe+3*ye.sigma,lower:Pe-3*ye.sigma}}function _e(le,ge){if(!ge||!(ge.sigma>0))return[];const ye=le.length,{centre:Pe,sigma:Ne}=ge,Le=De=>(le[De]-Pe)/Ne,ze=[];for(let De=0;De<ye;De++){if(Math.abs(Le(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++)Le(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++)Le(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(Le(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(le,ge){if(!ge||!(ge.sigma>0))return[];const ye=le.length,{centre:Pe,sigma:Ne}=ge,Le=Ge=>(le[Ge]-Pe)/Ne,ze=(Ge,Ve,Qe,mt)=>{for(const Ot of[1,-1]){let gt=0;for(let dt=Ge;dt<=Ve;dt++)Le(dt)*Ot>Qe&>++;if(gt>=mt)return!0}return!1},De=[];for(let Ge=0;Ge<ye;Ge++){if(Math.abs(Le(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(Le(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((le[mt]-le[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=le[Qe]-le[Qe-1],Ot=le[Qe+1<=Ge?Qe+1:Qe]-le[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(Le(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(Le(Qe))<=1){Ve=!1;break}Ve&&De.push({index:Ge,rule:8,description:"eight beyond one sigma"})}}return De}const je=Object.freeze(["westernElectric","nelson"]);function Ae(le,ge,ye="westernElectric"){return String(ye)==="nelson"?Te(le,ge):_e(le,ge)}function Ee(le,ge,ye){let Pe=0;for(let Ne=0;Ne<le.length;Ne++)(le[Ne]<ge||le[Ne]>ye)&&Pe++;return Pe}function Me(le,ge,ye,Pe=20){const Ne=le.length;if(!Ne)return[];const Le=le[0],ze=le[Ne-1];if(ze===Le)return[{from:Le,to:ze,count:Ne}];const De=ye-ge,Ge=1.5*De;let Ve=De>0?Math.max(Le,ge-Ge):Le,Qe=De>0?Math.min(ze,ye+Ge):ze;Qe>Ve||(Ve=Le,Qe=ze);const mt=De>0?2*De/Math.cbrt(Ne):(Qe-Ve)/(Math.ceil(Math.log2(Ne))+1),Ot=mt>0?Math.min(Pe,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 Lt=Math.min(Ot-1,Math.max(0,Math.floor((le[jt]-Ve)/gt)));dt[Lt].count++}return dt[0].from=Le,dt[Ot-1].to=ze,dt}const Be=.95;function Ke(le){const ge=Number(le);return Number.isFinite(ge)&&ge>0&&ge<1?ge:Be}function et(le,ge=Be){const ye=le.length;if(ye<2)return null;let Pe=0;for(let Qe=0;Qe<ye;Qe++)Pe+=le[Qe];const Ne=Pe/ye;let Le=0;for(let Qe=0;Qe<ye;Qe++){const mt=le[Qe]-Ne;Le+=mt*mt}const ze=Math.sqrt(Le/(ye-1)),De=Ke(ge),Ve=x(1-(1-De)/2,ye-1)*ze/Math.sqrt(ye);return{mean:Ne,lower:Ne-Ve,upper:Ne+Ve,margin:Ve,n:ye,confidence:De}}function Je(le,ge,ye=Be){const Pe=Number(le),Ne=Number(ge);if(!(Ne>0)||!(Pe>=0)||Pe>Ne)return null;const Le=Ke(ye),ze=U(1-(1-Le)/2),De=Pe/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:Le}}function ut(le,ge=Be){if(!le||!(le.n>2)||!Number.isFinite(le.stdError))return null;const ye=Ke(ge),Ne=x(1-(1-ye)/2,le.n-2)*le.stdError;return{slope:le.slope,lower:le.slope-Ne,upper:le.slope+Ne,margin:Ne,confidence:ye}}function Ct(le,ge,ye=Be){const Pe=Number(le),Ne=Number(ge);if(!Number.isFinite(Pe)||!(Ne>1))return null;const Le=Ke(ye),De=U(1-(1-Le)/2)*Math.sqrt(1/(9*Ne)+Pe*Pe/(2*(Ne-1)));return{index:Pe,lower:Pe-De,upper:Pe+De,margin:De,n:Ne,confidence:Le}}function Nt(le,ge){return!le||!(le.sd>0)||!Number.isFinite(ge)||!Number.isFinite(le.mean)?null:(ge-le.mean)/le.sd}function st(le){return Number.isFinite(le)?Math.min(1,Math.max(0,2*L(Math.abs(le)/2)-1)):0}function it(le,ge){const ye=new Map,Pe=W(le);let Ne=0;for(let Le=0;Le<ge.length;Le++){const ze=Pe(ge[Le]);if(ze==null||ze===""||typeof ze=="number"&&Number.isNaN(ze))continue;const De=ze instanceof Date?ze.getTime():typeof ze=="object"?String(ze):ze;ye.set(De,(ye.get(De)||0)+1),Ne++}return{map:ye,total:Ne}}function ct(le,ge,ye,Pe){if(!(ge>0)||!(Pe>0))return null;let Ne=0;const Le=new Set(le.keys());for(const ze of ye.keys())Le.add(ze);for(const ze of Le){const De=(le.get(ze)||0)/ge,Ge=(ye.get(ze)||0)/Pe;Ne+=Math.abs(De-Ge)}return Ne/2}const Tt=10;function $t(le,ge,ye){if(ye&&ye.numeric){const De=m(le,ge),{n:Ge,mean:Ve}=d(De),Qe=Ge>0?Nt({mean:ye.mean,sd:ye.sd},Ve):null;return{measure:"standardizedMeanDifference",magnitude:Qe,distance:Qe===null?0:st(Qe),direction:Qe===null?0:Math.sign(Qe),subsetN:Ge,populationN:ye.n||0,reliable:Ge>=Tt}}const{map:Ne,total:Le}=it(le,ge),ze=ct(Ne,Le,ye.map,ye.total);return{measure:"categoricalTotalVariation",magnitude:ze,distance:ze===null?0:ze,direction:0,subsetN:Le,populationN:ye.total||0,reliable:Le>=Tt}}function It(le,ge){if(le&&(le.kind==="float64"||le.kind==="int32"))return!0;const ye=W(le);let Pe=0,Ne=0;for(let Le=0;Le<ge.length&&Pe<200;Le++){const ze=ye(ge[Le]);if(ze==null||ze==="")continue;if(ze instanceof Date)return!1;Pe++;const De=typeof ze=="number"?ze:Number(ze);Number.isFinite(De)&&Ne++}return Pe===0?!1:Ne/Pe>=.9}function ft(le,ge){if(It(le,ge)){const Ne=m(le,ge),{n:Le,mean:ze,m2:De}=d(Ne);return{numeric:!0,mean:ze,sd:Le>0?Math.sqrt(De/Le):0,n:Le}}const{map:ye,total:Pe}=it(le,ge);return{numeric:!1,map:ye,total:Pe}}}),He("packages/core/src/compute/total.js",function(e,F){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return u}}),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,x=F("packages/core/src/compute/handle.js"),Q=x.presenceReader,U=x.valueComparator,L=x.valueReader,q=F("packages/core/src/compute/statistics.js"),M=q.STAT_FNS,O=q.STAT_LABELS;function k(w){return!!w&&(w.kind==="float64"||w.kind==="int32")}function b(w,v){const P=v.length;let G=0;if(k(w)){const K=w.values,H=Q(w);if(!H){for(let T=0;T<P;T++){const A=K[v[T]];Number.isNaN(A)||(G+=A)}return G}for(let T=0;T<P;T++){const A=v[T];if(H(A)===1){const S=K[A];Number.isNaN(S)||(G+=S)}}return G}const V=L(w);for(let K=0;K<P;K++){const H=m(V(v[K]));H!==null&&(G+=H)}return G}b.kernel=!0;function a(w,v){const P=v.length;let G=0;if(k(w)){const K=w.values,H=Q(w);if(!H){for(let T=0;T<P;T++)Number.isNaN(K[v[T]])||G++;return G}for(let T=0;T<P;T++){const A=v[T];H(A)===1&&!Number.isNaN(K[A])&&G++}return G}const V=L(w);for(let K=0;K<P;K++){const H=V(v[K]);H!=null&&!(typeof H=="number"&&Number.isNaN(H))&&G++}return G}a.kernel=!0;function g(w,v){return v.length}g.kernel=!0;function o(w,v){const P=a(w,v);return P===0?null:b(w,v)/P}o.kernel=!0;function t(w,v,P,G){const V=v.length;if(k(w)){const A=w.values,S=Q(w);let R=null;if(!S){for(let j=0;j<V;j++){const N=A[v[j]];Number.isNaN(N)||(R===null||(P<0?N<R:N>R))&&(R=N)}return R}for(let j=0;j<V;j++){const N=v[j];if(S(N)===0)continue;const $=A[N];Number.isNaN($)||(R===null||(P<0?$<R:$>R))&&(R=$)}return R}const K=L(w),H=U(G);let T=null;for(let A=0;A<V;A++){const S=K(v[A]);S==null||typeof S=="number"&&Number.isNaN(S)||(T===null||(P<0?H(S,T)<0:H(S,T)>0))&&(T=S)}return T}function r(w,v,P){return t(w,v,-1,P&&P.locale)}r.kernel=!0;function s(w,v,P){return t(w,v,1,P&&P.locale)}s.kernel=!0;function i(w,v){return v.length===0?null:L(w)(v[0])}i.kernel=!0;function n(w,v){return v.length===0?null:L(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 c={sum:b,min:r,max:s,avg:o,count:g,first:i,last:n,countValues:a,...M},l=Object.freeze({...O,sum:"Sum",avg:"Average",min:"Min",max:"Max",count:"Count",countValues:"Count of values",first:"First",last:"Last"});function u(w){return w?typeof w=="string"?l[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(G=>G in c);for(const G of Object.keys(c))P.includes(G)||P.push(G);return P}function y(w,v){return typeof v!="string"?!0:p(w).includes(v)}function h(w,v){const P=L(w),G=[];for(let V=0;V<v.length;V++){const K=P(v[V]);K!=null&&G.push(K)}return G}function d(w,v,P,G){const V=v||[];if(P&&typeof P=="object"&&typeof P.fn=="string"){const{fn:K,...H}=P,T=c[K];return T?T(w,V,{...G,...H}):(I(`total:${K}`,`unknown total function "${K}"; register it in config.totalFns`),null)}if(typeof P=="string"){const K=c[P];return K?K(w,V,G):(I(`total:${P}`,`unknown total function "${P}"; register it in config.totalFns`),null)}return E(P)?P.kernel===!0?P(w,V,G):P(h(w,V),G||{}):null}}),He("packages/core/src/compute/windowed.js",function(e,F){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Q}});const E=F("packages/core/src/compute/sketch.js").Welford;class W{#e;#t;#n=[];#r;#i;constructor(L,q=0,M=Date.now){if(L!=="count"&&L!=="time"&&L!=="session")throw new RangeError(`unknown window kind: ${L}`);if((L==="count"||L==="time")&&!(q>0))throw new RangeError(`a ${L} window needs a positive span`);this.#e=L,this.#t=Math.floor(q),this.#r=M,this.#i=M()}get size(){return this.#n.length}push(L,q=this.#r()){Number.isFinite(L)&&(this.#n.push({t:q,v:L}),this.#s(q))}#s(L){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const q=L-this.#t;for(;this.#n.length&&this.#n[0].t<q;)this.#n.shift()}}spec(){const L=this.#e==="session"?this.#r()-this.#i:this.#t;return{kind:this.#e,span:L,size:this.#n.length}}values(){return this.#n.map(L=>L.v)}aggregate(){const L=this.spec();if(!this.#n.length)return{over:L,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const q=new E;let M=0,O=1/0,k=-1/0;for(const{v:b}of this.#n)M+=b,b<O&&(O=b),b>k&&(k=b),q.add(b);return{over:L,count:this.#n.length,sum:M,mean:q.mean(),min:O,max:k,variance:q.variance(),stddev:q.stddev()}}reduce(L){const q=this.aggregate(),M={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(!(L in M))throw new RangeError(`unknown windowed aggregate: ${L}`);return{value:M[L],over:q.over}}}const I=Object.freeze(["count","time","session"]);function x(U,L=Date.now){const q=U.kind==="time"&&U.minutes!=null?U.minutes*6e4:U.span??0;return new W(U.kind,q,L)}const Q={Window:W,WINDOW_KINDS:I,openWindow:x}}),He("packages/core/src/compute/rolling.js",function(e,F){"use strict";Object.defineProperty(e,"ROLLING_WINDOW_FIELDS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"rollingWindow",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return M}}),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,x=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function Q(c,l,u,f){if(c.kind==="count"){const p=Math.max(1,Math.floor(c.span||0));return{coverage:Math.min(1,l/p),partial:l<p}}if(c.kind==="time"){const p=c.minutes!=null?c.minutes*6e4:c.span||0;if(!(p>0))return{coverage:1,partial:!1};const y=u-f;return{coverage:Math.min(1,y/p),partial:y<p}}return{coverage:null,partial:!1}}function U(c,l){const u=E(l),f=new Map,p=c.length?c[0].at:0;for(let y=0;y<c.length;y++){const{key:h,at:d,value:w}=c[y];Number.isFinite(w)&&u.push(w,d);const v=u.aggregate(),P=Q(l,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 L(c){const l=new Map;let u=0;for(const{key:f,value:p}of c)Number.isFinite(p)&&(u+=p),f!=null&&l.set(String(f),u);return l}function q(c,l=1){const u=new Map,f=Math.max(1,Math.floor(l));for(let p=0;p<c.length;p++){const{key:y,value:h}=c[p];if(y==null)continue;const d=p>=f?c[p-f].value:null,w=Number.isFinite(h)?h:null,v=Number.isFinite(d)?d:null;u.set(String(y),w!==null&&v!==null?w-v:null)}return u}const M=4096;function O(c){let l=c>>>0;return()=>{l+=1831565813;let u=l;return u=Math.imul(u^u>>>15,u|1),u^=u+Math.imul(u^u>>>7,u|61),((u^u>>>14)>>>0)/4294967296}}function k(c,l){const u=c.length;if(u===1)return c[0];const f=(u-1)*l,p=Math.floor(f),y=Math.ceil(f);return p===y?c[p]:c[p]+(f-p)*(c[y]-c[p])}function b(c,l,u={}){const f=Math.min(1,Math.max(0,u.q==null?.5:u.q)),p=Math.max(1,Math.floor(u.cap==null?M:u.cap)),y=O(u.seed==null?2654435769:u.seed),h=new Map,d=c.length?c[0].at:0;if(l.kind==="session"){const v=new I(200,y);let P=0;for(const{key:G,value:V}of c)Number.isFinite(V)&&(v.add(V),P++),G!=null&&h.set(String(G),{value:P?v.quantile(f):null,approx:P>0,count:P,coverage:null,partial:!1});return h}const w=E(l);for(const{key:v,at:P,value:G}of c){Number.isFinite(G)&&w.push(G,P);const V=w.values(),K=V.length;let H=null,T=!1;if(K)if(K<=p)H=k([...V].sort((S,R)=>S-R),f);else{const S=new I(200,y);for(const R of V)S.add(R);H=S.quantile(f),T=!0}const A=Q(l,K,P,d);v!=null&&h.set(String(v),{value:H,approx:T,count:K,coverage:A.coverage,partial:A.partial})}return h}function a(c,l){const u=c.length,f=new Array(u).fill(null),p=Math.floor(l/2),y=l%2===0;for(let h=0;h<u;h++){if(h-p<0||h+p>=u)continue;let d=0,w=!0;if(y)for(let v=-p;v<=p;v++){const P=c[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=c[h+v];if(!Number.isFinite(P)){w=!1;break}d+=P}w&&(f[h]=d/l)}return f}function g(c,l){const u=new Map,f=Math.floor(Number(l&&l.period));if(!(f>=2))return u;const p=l&&l.model==="multiplicative",y=c.length,h=c.map(T=>Number.isFinite(T.value)?T.value:null),d=a(h,f),w=new Array(y).fill(null);for(let T=0;T<y;T++){const A=d[T],S=h[T];A===null||S===null||(p?A!==0&&(w[T]=S/A):w[T]=S-A)}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 A=T%f;v[A]+=w[T],P[A]+=1}const G=p?1:0,V=v.map((T,A)=>P[A]?T/P[A]:G),K=V.reduce((T,A)=>T+A,0)/f,H=p?V.map(T=>K!==0?T/K:1):V.map(T=>T-K);for(let T=0;T<y;T++){const{key:A}=c[T];if(A==null)continue;const S=d[T],R=H[T%f],j=h[T];let N=null;S!==null&&j!==null&&(N=p?S*R!==0?j/(S*R):null:j-S-R),u.set(String(A),{trend:S,seasonal:j===null?null:R,residual:N,coverage:S===null?0:1,partial:S===null})}return u}function o(c,l,u,f=80){const p=(Math.sqrt(5)-1)/2;let y=l,h=u,d=h-p*(h-y),w=y+p*(h-y),v=c(d),P=c(w);for(let G=0;G<f;G++)v<P?(h=w,w=d,P=v,d=h-p*(h-y),v=c(d)):(y=d,d=w,v=P,w=y+p*(h-y),P=c(w));return(y+h)/2}const t=1e-4,r=1-1e-4;function s(c,l){const u=c.length,f=new Array(u).fill(null),p=new Array(u).fill(null);let y=null,h=0;for(let d=0;d<u;d++){const w=c[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=l*w+(1-l)*y,f[d]=y}return{smoothed:f,fitted:p,sse:h}}function i(c,l,u){const f=c.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=c[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 K=h+d;y[v]=K,w+=(P-K)**2;const H=h;h=l*P+(1-l)*(H+d),d=u*(h-H)+(1-u)*d,p[v]=h;continue}const G=h+d;y[v]=G,w+=(P-G)**2;const V=h;h=l*P+(1-l)*(V+d),d=u*(h-V)+(1-u)*d,p[v]=h}return{smoothed:p,fitted:y,sse:w}}function n(c,l={}){const u=new Map,f=l.method==="holt",p=c.map(G=>Number.isFinite(G.value)?G.value:null),y=p.filter(G=>G!==null).length,h=G=>Math.min(r,Math.max(t,G)),d=()=>{for(const{key:G}of c)G!=null&&u.set(String(G),{smoothed:null,fitted:null,alpha:null,beta:null,sse:null});return u};if(y<(f?2:1))return d();let w=Number.isFinite(l.alpha)?h(l.alpha):null,v=f&&Number.isFinite(l.beta)?h(l.beta):null;if(f){if(w===null||v===null){let G=w===null?.5:w,V=v===null?.5:v;for(let K=0;K<6;K++)w===null&&(G=o(H=>i(p,H,V).sse,t,r)),v===null&&(V=o(H=>i(p,G,H).sse,t,r));w=w===null?G:w,v=v===null?V:v}}else w===null&&(w=o(G=>s(p,G).sse,t,r));const P=f?i(p,w,v):s(p,w);for(let G=0;G<c.length;G++){const{key:V}=c[G];V!=null&&u.set(String(V),{smoothed:P.smoothed[G],fitted:P.fitted[G],alpha:w,beta:f?v:null,sse:P.sse})}return u}const m={ROLLING_WINDOW_FIELDS:x,QUANTILE_SPAN_CAP:M,rollingWindow:U,rollingQuantile:b,cumulativeToDate:L,periodOverPeriod:q,seasonalDecompose:g,exponentialSmoothing:n}}),He("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 W}}),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 a}}),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,W=3,I=5,x=100;function Q(r){let s=r>>>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(r,s){let i=0;for(let n=0;n<r.length;n++){const m=r[n]-s[n];i+=m*m}return i}function L(r,s){return Math.sqrt(U(r,s))}function q(r,s){let i=-1,n=1/0;for(let m=0;m<s.length;m++){const c=U(r,s[m]);c<n&&(n=c,i=m)}return i}function M(r,s,i){const n=Q(i),m=r.length,c=[Array.from(r[Math.floor(n()*m)])],l=new Float64Array(m).fill(1/0);for(let u=1;u<s;u++){let f=0;for(let d=0;d<m;d++){const w=U(r[d],c[c.length-1]);w<l[d]&&(l[d]=w),f+=l[d]}const p=n()*(f||m);let y=0,h=m-1;for(let d=0;d<m;d++)if(y+=f?l[d]:1,y>=p){h=d;break}c.push(Array.from(r[h]))}return c}function O(r,s){for(let i=0;i<r.length;i++){const n=r[i]-s[i];if(n!==0)return n}return 0}function k(r,s,i,n){const m=s.map((l,u)=>({centre:l,i:u})).sort((l,u)=>O(l.centre,u.centre)),c=new Int32Array(s.length);for(let l=0;l<m.length;l++)c[m[l].i]=l;for(let l=0;l<r.length;l++)r[l]>=0&&(r[l]=c[r[l]]);return{assignments:r,centres:m.map(l=>l.centre),sizes:m.map(l=>i[l.i]),distances:n}}function b(r,s={}){const i=r.length,n=i?r[0].length:0,m=Math.floor(s.k||W);if(!(i>=m)||m<1||n<1)return null;let c=M(r,m,s.seed===void 0?1:s.seed);const l=new Int32Array(i);let u=!0;for(let h=0;h<x&&u;h++){u=!1;for(let v=0;v<i;v++){const P=q(r[v],c);l[v]!==P&&(l[v]=P,u=!0)}const d=c.map(()=>new Float64Array(n)),w=new Array(m).fill(0);for(let v=0;v<i;v++){const P=l[v];for(let G=0;G<n;G++)d[P][G]+=r[v][G];w[P]++}for(let v=0;v<m;v++)if(w[v])for(let P=0;P<n;P++)c[v][P]=d[v][P]/w[v];else{let P=0,G=-1/0;for(let V=0;V<i;V++){const K=U(r[V],c[v]);K>G&&(G=K,P=V)}c[v]=Array.from(r[P]),u=!0}}const f=new Array(m).fill(0),p=new Float64Array(i);let y=0;for(let h=0;h<i;h++){const d=l[h];f[d]++;const w=U(r[h],c[d]);p[h]=Math.sqrt(w),y+=w}return{assignments:l,centres:c,sizes:f,inertia:y,distances:p}}function a(r,s={}){const i=r.length,n=i?r[0].length:0,m=Number(s.eps),c=Math.max(1,Math.floor(s.minPoints||I));if(!(m>0)||i===0||n<1)return null;const l=new Array(i);for(let w=0;w<i;w++){const v=[];for(let P=0;P<i;P++)w!==P&&L(r[w],r[P])<=m&&v.push(P);l[w]=v}const u=new Int32Array(i).fill(-1);let f=0;for(let w=0;w<i;w++){if(u[w]!==-1||l[w].length<c)continue;u[w]=f;const v=[...l[w]];for(let P=0;P<v.length;P++){const G=v[P];u[G]===-1&&(u[G]=f,l[G].length>=c&&v.push(...l[G]))}f++}if(!f)return{assignments:u,centres:[],sizes:[],distances:new Float64Array(i).fill(NaN)};const p=[],y=new Array(f).fill(0),h=Array.from({length:f},()=>new Float64Array(n));for(let w=0;w<i;w++){const v=u[w];if(!(v<0)){y[v]++;for(let P=0;P<n;P++)h[v][P]+=r[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(i).fill(NaN);for(let w=0;w<i;w++){const v=u[w];v>=0&&(d[w]=L(r[w],p[v]))}return{assignments:u,centres:p,sizes:y,distances:d}}function g(r,s,i){const n=r.length;if(n===0)return 0;const m=new Int32Array(i);for(let l=0;l<n;l++)m[s[l]]++;let c=0;for(let l=0;l<n;l++){const u=s[l],f=new Float64Array(i);for(let h=0;h<n;h++)l!==h&&(f[s[h]]+=L(r[l],r[h]));const p=m[u]>1?f[u]/(m[u]-1):0;let y=1/0;for(let h=0;h<i;h++){if(h===u||m[h]===0)continue;const d=f[h]/m[h];d<y&&(y=d)}y!==1/0&&(c+=(y-p)/Math.max(p,y))}return c/n}function o(r,s={}){const i=r.length;if(!i)return null;const n=s.criterion==="silhouette"?"silhouette":"elbow",m=Math.max(2,Math.floor(s.maxK||8)),c=s.seed===void 0?1:s.seed;if(n==="silhouette"){const w=[],v=[];for(let G=2;G<=Math.min(m,i);G++){const V=b(r,{k:G,seed:c});V&&(w.push(G),v.push(g(r,V.assignments,G)))}if(!w.length)return null;let P=0;for(let G=1;G<v.length;G++)v[G]>v[P]&&(P=G);return{k:w[P],criterion:n,scores:v,ks:w}}const l=[],u=[];for(let w=1;w<=Math.min(m,i);w++){const v=b(r,{k:w,seed:c});v&&(l.push(w),u.push(v.inertia))}if(u.length<2)return null;const f={k:l[0],y:u[0]},p={k:l[l.length-1],y:u[u.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<u.length;w++){const v=Math.abs((p.k-f.k)*(f.y-u[w])-(f.k-l[w])*(p.y-f.y))/y;v>d&&(d=v,h=w)}return{k:l[h],criterion:n,scores:u,ks:l}}function t(r){const s=r.length,i=s?r[0].length:0;if(!s||!i)return null;const n=new Array(i).fill(0);for(let c=0;c<s;c++)for(let l=0;l<i;l++)n[l]+=r[c][l];for(let c=0;c<i;c++)n[c]/=s;const m=new Array(i).fill(0);for(let c=0;c<s;c++)for(let l=0;l<i;l++){const u=r[c][l]-n[l];m[l]+=u*u}for(let c=0;c<i;c++)m[c]=s>1?Math.sqrt(m[c]/(s-1)):0;for(let c=0;c<s;c++)for(let l=0;l<i;l++)m[l]>0?r[c][l]=(r[c][l]-n[l])/m[l]:r[c][l]=r[c][l]-n[l];return{mean:n,sd:m}}}),He("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 M}}),Object.defineProperty(e,"numericSummary",{enumerable:!0,get:function(){return O}}),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 a}});const ie=F("packages/core/src/compute/statistics.js"),E=ie.numbers,W=ie.moments,I=ie.frequencyMap,x=ie.categoricalDistance,Q=ie.normalTotalVariation,U=ie.isNumericColumn,L=ie.SUBSET_RELIABILITY_FLOOR,q=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function M(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 O(g,o){const t=E(g,o),{n:r,mean:s,m2:i}=W(t),n=r>0?Math.sqrt(i/r):0;return{mean:s,sd:n,n:r}}function k(g,o,t,r){return U(g,o)&&U(t,r)}function b(g,o,t,r){if(k(g,o,t,r)){const m=O(g,o),c=O(t,r),l=M(m,c);return{measure:q.numeric,magnitude:l,distance:l===null?0:Q(l),direction:l===null?0:Math.sign(l),nA:m.n,nB:c.n,meanA:m.mean,meanB:c.mean,reliable:m.n>=L&&c.n>=L}}const s=I(g,o),i=I(t,r),n=x(s.map,s.total,i.map,i.total);return{measure:q.categorical,magnitude:n,distance:n===null?0:n,direction:0,nA:s.total,nB:i.total,meanA:null,meanB:null,reliable:s.total>=L&&i.total>=L}}function a(g,o,t={}){const r=new Set(g.columns),s=new Set(o.columns),i=g.columns.filter(u=>s.has(u)),n=Array.isArray(t.columns)&&t.columns.length?i.filter(u=>t.columns.includes(u)):i,m=g.indices(),c=o.indices(),l=[];for(const u of n){const f=g.handle(u),p=o.handle(u);if(!f||!p)continue;const y=b(f,m,p,c);l.push({column:u,name:g.name&&g.name(u)||o.name&&o.name(u)||u,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 l.sort((u,f)=>f.distance-u.distance||Math.abs(f.magnitude||0)-Math.abs(u.magnitude||0)),{ranked:l,nA:m.length,nB:c.length,unmatched:{onlyA:g.columns.filter(u=>!s.has(u)),onlyB:o.columns.filter(u=>!r.has(u))},measures:q}}}),He("packages/core/src/compute/anomaly.js",function(e,F){"use strict";Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DEFAULT_MODIFIED_Z_THRESHOLD",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return i}}),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,x=.6745,Q=3.5,U=1.5,L=.975,q=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function M(c){if(!c.length)return null;const u=Array.from(c,Number).sort((h,d)=>h-d),f=E(u,.5),p=u.map(h=>Math.abs(h-f)).sort((h,d)=>h-d),y=E(p,.5);return{median:f,mad:y}}function O(c,l={}){const u=Number.isFinite(l.threshold)?l.threshold:Q,f=c.length,p=new Array(f).fill(null),y=new Array(f).fill(!1),h=[];for(let v=0;v<f;v++){const P=Number(c[v]);Number.isFinite(P)&&h.push(P)}if(!h.length)return{median:null,mad:null,threshold:u,scores:p,flags:y,flagged:0};const d=M(h);if(d.mad===0)return{median:d.median,mad:0,threshold:u,scores:p,flags:y,flagged:0};let w=0;for(let v=0;v<f;v++){const P=Number(c[v]);if(!Number.isFinite(P))continue;const G=x*(P-d.median)/d.mad;p[v]=G,Math.abs(G)>u&&(y[v]=!0,w++)}return{median:d.median,mad:d.mad,threshold:u,scores:p,flags:y,flagged:w}}function k(c,l={}){const u=Number.isFinite(l.k)?l.k:U,f=[];for(let w=0;w<c.length;w++){const v=Number(c[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-u*d,upper:h+u*d,k:u}}function b(c,l){if(l<=0)return 0;const u=I(c);if(l<c+1){let v=c,P=1/c,G=P;for(let V=0;V<1e3&&(v+=1,G*=l/v,P+=G,!(Math.abs(G)<Math.abs(P)*1e-15));V++);return P*Math.exp(-l+c*Math.log(l)-u)}const f=1e-300;let p=l+1-c,y=1/f,h=1/p,d=h;for(let v=1;v<1e3;v++){const P=-v*(v-c);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 G=h*y;if(d*=G,Math.abs(G-1)<1e-15)break}return 1-Math.exp(-l+c*Math.log(l)-u)*d}function a(c,l){return c<=0?0:b(l/2,c/2)}function g(c,l=L){if(!(l>0)||!(l<1))return NaN;let u=0,f=Math.max(1,c);for(;a(f,c)<l;)f*=2;for(let p=0;p<200;p++){const y=(u+f)/2;if(a(y,c)<l?u=y:f=y,f-u<1e-10)break}return(u+f)/2}function o(c){const l=c.length,u=c.map((f,p)=>{const y=f.slice();for(let h=0;h<l;h++)y.push(p===h?1:0);return y});for(let f=0;f<l;f++){let p=f;for(let h=f+1;h<l;h++)Math.abs(u[h][f])>Math.abs(u[p][f])&&(p=h);if(Math.abs(u[p][f])<1e-12)return null;if(p!==f){const h=u[p];u[p]=u[f],u[f]=h}const y=u[f][f];for(let h=0;h<2*l;h++)u[f][h]/=y;for(let h=0;h<l;h++){if(h===f)continue;const d=u[h][f];if(d!==0)for(let w=0;w<2*l;w++)u[h][w]-=d*u[f][w]}}return u.map(f=>f.slice(l))}function t(c,l){const u=c.length,f=new Array(l).fill(0);for(const h of c)for(let d=0;d<l;d++)f[d]+=h[d];for(let h=0;h<l;h++)f[h]/=u;const p=Array.from({length:l},()=>new Array(l).fill(0));for(const h of c)for(let d=0;d<l;d++){const w=h[d]-f[d];for(let v=d;v<l;v++)p[d][v]+=w*(h[v]-f[v])}const y=u>1?u-1:1;for(let h=0;h<l;h++)for(let d=h;d<l;d++)p[h][d]/=y,p[d][h]=p[h][d];return{mean:f,cov:p}}function r(c,l={}){const u=Number.isFinite(l.p)?l.p:L,f=Number.isFinite(l.ridge)?l.ridge:1e-6,p=c.length;if(!p)return null;const y=c[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 R=0;R<p;R++){const j=c[R];let N=j.length===y;const $=new Array(y);for(let _=0;N&&_<y;_++){const Y=Number(j[_]);Number.isFinite(Y)?$[_]=Y:N=!1}N&&(v.push(R),P.push($))}const G=y,V=g(G,u);if(P.length<=y)return{center:[],df:G,cutoff:V,singular:!0,used:P.length,distances:h,squared:d,flags:w,flagged:0};const{mean:K,cov:H}=t(P,y);let T=o(H),A=!1;if(!T){A=!0;let R=0;for(let $=0;$<y;$++)R+=H[$][$];const j=R/y*f||f,N=H.map(($,_)=>$.map((Y,Z)=>_===Z?Y+j:Y));if(T=o(N),!T)return{center:K,df:G,cutoff:V,singular:!0,used:P.length,distances:h,squared:d,flags:w,flagged:0}}let S=0;for(let R=0;R<P.length;R++){const j=P[R],N=new Array(y);for(let Y=0;Y<y;Y++)N[Y]=j[Y]-K[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 _=v[R];d[_]=$,h[_]=Math.sqrt($),$>V&&(w[_]=!0,S++)}return{center:K,df:G,cutoff:V,singular:A,used:P.length,distances:h,squared:d,flags:w,flagged:S}}const s=20,i=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function n(c,l={}){const u=l.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",f=Number.isFinite(l.windowLen)&&l.windowLen>=1?Math.floor(l.windowLen):s,p=Number.isFinite(l.threshold)?l.threshold:Q,y=Number.isFinite(l.k)?l.k:U,h=Number.isFinite(l.minPeriods)&&l.minPeriods>=1?Math.floor(l.minPeriods):f,d=c.length,w=new Array(d).fill(null),v=new Array(d).fill(!1);let P=0;for(let G=0;G<d;G++){const V=Number(c[G]);if(!Number.isFinite(V))continue;const K=Math.max(0,G-f+1),H=[];for(let T=K;T<=G;T++){const A=Number(c[T]);Number.isFinite(A)&&H.push(A)}if(!(H.length<h))if(u==="rollingIqr"){const T=k(H,{k:y});if(!T)continue;(V<T.lower||V>T.upper)&&(v[G]=!0,P++)}else{const T=M(H);if(!T||T.mad===0)continue;const A=x*(V-T.median)/T.mad;w[G]=A,Math.abs(A)>p&&(v[G]=!0,P++)}}return{method:u,windowLen:f,minPeriods:h,threshold:p,k:y,scores:w,flags:v,flagged:P}}function m(c={}){const l=c||{},u=l.field;if(typeof u!="string"||!u)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const f=l.method||"modifiedZScore";if(!(q.includes(f)||i.includes(f))||f==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${f}'`);const y=typeof l.orderBy=="string"?l.orderBy:null,h=l.latest===!0,d=i.includes(f),w=v=>Number(v==null?NaN:v[u]);return v=>{const P=Array.isArray(v)?v.slice():[...v];y&&P.sort((T,A)=>{const S=T?.[y],R=A?.[y];return S===R?0:S==null?-1:R==null?1:S<R?-1:1});const G=P.map(w);let V,K;if(d)({flags:V,scores:K}=n(G,{method:f,windowLen:l.windowLen,threshold:l.threshold,k:l.k,minPeriods:l.minPeriods}));else if(f==="iqr"){const T=k(G,{k:l.k});V=G.map(A=>T?Number.isFinite(A)&&(A<T.lower||A>T.upper):!1),K=G.map(()=>null)}else({flags:V,scores:K}=O(G,{threshold:l.threshold}));if(h){const T=V.length-1;return T<0||!V[T]?!1:{method:f,field:u,flagged:[{row:P[T],score:K[T]}]}}const H=[];for(let T=0;T<V.length;T++)V[T]&&H.push({row:P[T],score:K[T]});return H.length?{method:f,field:u,flagged:H}:!1}}}),He("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 c}});const ie=F("packages/core/src/compute/special.js"),E=ie.normalQuantile,W=ie.studentTQuantile,x=F("packages/core/src/internal/warn.js").warnOnce,Q=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),U=1e-4,L=1-1e-4;function q(l){const u=[];for(let f=0;f<l.length;f++){const p=l[f];if(p!==null&&typeof p=="object"){const y=Number.isFinite(p.at)?p.at:f,h=Number.isFinite(p.value)?p.value:null;u.push({at:y,value:h})}else u.push({at:f,value:Number.isFinite(p)?Number(p):null})}return u}function M(l){const u=l.filter(d=>d.value!==null),f=u[0],p=u[u.length-1],y=p.at-f.at,h=u.length>1&&y>0?y/(u.length-1):1;return{lastAt:p.at,step:h}}function O(l){return Math.min(L,Math.max(U,l))}function k(l,u=U,f=L,p=80){const y=(Math.sqrt(5)-1)/2;let h=u,d=f,w=d-y*(d-h),v=h+y*(d-h),P=l(w),G=l(v);for(let V=0;V<p;V++)P<G?(d=v,v=w,G=P,w=d-y*(d-h),P=l(w)):(h=w,w=v,P=G,v=h+y*(d-h),G=l(v));return(h+d)/2}function b(l,u){let f=null,p=0,y=0;for(let h=0;h<l.length;h++){const d=l[h];if(d!==null){if(f===null){f=d;continue}p+=(d-f)**2,y+=1,f=u*d+(1-u)*f}}return{level:f,sse:p,m:y}}function a(l,u,f){let p=null,y=null,h=0,d=0;for(let w=0;w<l.length;w++){const v=l[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 G=p;p=u*v+(1-u)*(G+y),y=f*(p-G)+(1-f)*y}return{level:p,trend:y,sse:h,m:d}}function g(l,u,f,p,y){const h=l.length;if(h<2*u)return null;const d=A=>{let S=0,R=0;for(let j=A;j<A+u&&j<h;j++)l[j]!==null&&(S+=l[j],R+=1);return R?S/R:null},w=d(0),v=d(u);if(w===null||v===null)return null;let P=w,G=(v-w)/u;const V=new Array(u).fill(0);for(let A=0;A<u;A++)V[A]=l[A]===null?0:l[A]-P;const K=V.reduce((A,S)=>A+S,0)/u;for(let A=0;A<u;A++)V[A]-=K;let H=0,T=0;for(let A=u;A<h;A++){const S=A%u,R=V[S],j=l[A];if(j===null){P+=G;continue}const N=P+G+R;H+=(j-N)**2,T+=1;const $=P;P=f*(j-R)+(1-f)*(P+G),G=p*(P-$)+(1-p)*G,V[S]=y*(j-P)+(1-y)*R}return{level:P,trend:G,season:V,phase:(h-1)%u,sse:H,count:T}}function o(l,u,f){let p=1;for(const h of u)p+=h*h;const y=Math.sqrt(l*p);return{se:y,margin:f*y}}function t(l,u={}){if(!l||typeof l.length!="number"||l.length===0)return null;const f=Q.includes(u.method)?u.method:"linear",p=Math.max(1,Math.floor(Number(u.horizon)||1)),y=Number.isFinite(u.confidence)&&u.confidence>0&&u.confidence<1?u.confidence:.95,h=1-(1-y)/2,d=q(l),w=d.map(H=>H.value),v=w.filter(H=>H!==null),P=v.length,{lastAt:G,step:V}=P?M(d):{lastAt:0,step:1},K=H=>G+H*V;return f==="linear"?r(d,P,p,y,h,K):f==="movingAverage"?s(v,P,p,y,h,u,K):f==="ses"?i(w,P,p,y,h,u,K):f==="holt"?n(w,P,p,y,h,u,K):m(w,P,p,y,h,u,K)}function r(l,u,f,p,y,h){if(u<2)return null;let d=0,w=0;for(const j of l)j.value!==null&&(d+=j.at,w+=j.value);d/=u,w/=u;let v=0,P=0,G=0;for(const j of l){if(j.value===null)continue;const N=j.at-d,$=j.value-w;v+=N*N,P+=N*$,G+=$*$}if(v===0)return null;const V=P/v,K=w-V*d,H=G===0?1:Math.max(0,Math.min(1,P*P/(v*G))),T=Math.max(0,G-V*P),A=u>2?Math.sqrt(T/(u-2)):null,S=u>2?W(y,u-2):null,R=[];for(let j=1;j<=f;j++){const N=h(j),$=K+V*N;let _=null,Y=null,Z=null,J=null,D=null;if(A!==null){const te=1/u+(N-d)**2/v,z=A*Math.sqrt(1+te),X=A*Math.sqrt(te);D=z,_=$-S*z,Y=$+S*z,Z=$-S*X,J=$+S*X}R.push({step:j,at:N,mean:$,lower:_,upper:Y,lowerMean:Z,upperMean:J,se:D})}return{method:"linear",horizon:f,confidence:p,n:u,sigma:A,r2:H,params:{slope:V,intercept:K},points:R}}function s(l,u,f,p,y,h,d){if(u<1)return null;const w=Math.max(1,Math.min(u,Math.floor(Number(h.windowLen)||u))),v=l.slice(u-w);let P=0;for(const A of v)P+=A;const G=P/w;let V=null,K=null;if(w>1){let A=0;for(const R of v)A+=(R-G)**2;V=Math.sqrt(A/(w-1))*Math.sqrt(1+1/w),K=W(y,w-1)}const H=V===null?null:K*V,T=[];for(let A=1;A<=f;A++)T.push({step:A,at:d(A),mean:G,lower:H===null?null:G-H,upper:H===null?null:G+H,se:V});return{method:"movingAverage",horizon:f,confidence:p,n:u,sigma:V===null?null:V,params:{windowLen:w},points:T}}function i(l,u,f,p,y,h,d){if(u<1)return null;let w=Number.isFinite(h.alpha)?O(h.alpha):null;w===null&&(w=k(K=>b(l,K).sse));const v=b(l,w),P=E(y),G=v.m>0?v.sse/v.m:null,V=[];for(let K=1;K<=f;K++){const H=v.level;let T=null,A=null,S=null;if(G!==null){const R=[];for(let N=1;N<K;N++)R.push(w);const j=o(G,R,P);S=j.se,T=H-j.margin,A=H+j.margin}V.push({step:K,at:d(K),mean:H,lower:T,upper:A,se:S})}return{method:"ses",horizon:f,confidence:p,n:u,sigma:G===null?null:Math.sqrt(G),params:{alpha:w},points:V}}function n(l,u,f,p,y,h,d){if(u<2)return null;let w=Number.isFinite(h.alpha)?O(h.alpha):null,v=Number.isFinite(h.beta)?O(h.beta):null;if(w===null||v===null){let T=w===null?.5:w,A=v===null?.5:v;for(let S=0;S<6;S++)w===null&&(T=k(R=>a(l,R,A).sse)),v===null&&(A=k(R=>a(l,T,R).sse));w=w===null?T:w,v=v===null?A:v}const P=a(l,w,v),G=E(y),V=P.m>0?P.sse/P.m:null,K=w*v,H=[];for(let T=1;T<=f;T++){const A=P.level+T*P.trend;let S=null,R=null,j=null;if(V!==null){const N=[];for(let _=1;_<T;_++)N.push(w+_*K);const $=o(V,N,G);j=$.se,S=A-$.margin,R=A+$.margin}H.push({step:T,at:d(T),mean:A,lower:S,upper:R,se:j})}return{method:"holt",horizon:f,confidence:p,n:u,sigma:V===null?null:Math.sqrt(V),params:{alpha:w,beta:v},points:H}}function m(l,u,f,p,y,h,d){const w=Math.floor(Number(h.period));if(!(w>=2))return x("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(u<2*w)return null;let v=Number.isFinite(h.alpha)?O(h.alpha):null,P=Number.isFinite(h.beta)?O(h.beta):null,G=Number.isFinite(h.gamma)?O(h.gamma):null;const V=(j,N,$)=>{const _=g(l,w,j,N,$);return _?_.sse:1/0};if(v===null||P===null||G===null){let j=v===null?.5:v,N=P===null?.5:P,$=G===null?.5:G;for(let _=0;_<8;_++)v===null&&(j=k(Y=>V(Y,N,$))),P===null&&(N=k(Y=>V(j,Y,$))),G===null&&($=k(Y=>V(j,N,Y)));v=v===null?j:v,P=P===null?N:P,G=G===null?$:G}const K=g(l,w,v,P,G);if(!K)return null;const H=E(y),T=K.count>0?K.sse/K.count:null,A=v*P,S=G*(1-v),R=[];for(let j=1;j<=f;j++){const N=K.season[(K.phase+j)%w],$=K.level+j*K.trend+N;let _=null,Y=null,Z=null;if(T!==null){const J=[];for(let te=1;te<j;te++)J.push(v+te*A+(te%w===0?S:0));const D=o(T,J,H);Z=D.se,_=$-D.margin,Y=$+D.margin}R.push({step:j,at:d(j),mean:$,lower:_,upper:Y,se:Z})}return{method:"holtWinters",horizon:f,confidence:p,n:u,sigma:T===null?null:Math.sqrt(T),params:{alpha:v,beta:P,gamma:G,period:w},points:R}}const c={FORECAST_METHODS:Q,forecast:t}}),He("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 c}}),Object.defineProperty(e,"HL_PAIR_LIMIT",{enumerable:!0,get:function(){return l}}),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 G}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return H}});const E=F("packages/core/src/internal/warn.js").warnOnce,I=F("packages/core/src/compute/handle.js").valueReader,x=F("packages/core/src/compute/statistics.js"),Q=x.numbers,U=x.moments,L=x.frequencyMap,q=x.categoricalDistance,M=x.isNumericColumn,O=x.jarqueBera,k=x.proportionInterval,b=x.SUBSET_RELIABILITY_FLOOR,g=F("packages/core/src/compute/compare.js").pooledStandardMeanDifference,o=F("packages/core/src/compute/special.js"),t=o.studentT,r=o.studentTQuantile,s=o.normalCdf,i=o.normalQuantile,n=o.chiSquareUpperTail,m=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),c=.05,l=2e6;function u(T){const A=Number(T);return Number.isFinite(A)&&A>0&&A<1?A:.95}function f(T){const{n:A,mean:S,m2:R}=U(T);return{mean:S,sd:A>0?Math.sqrt(R/A):0,n:A}}function p(T,A){const S=T.length;if(S<2)return 0;let R=0;for(let j=0;j<S;j++){const N=T[j]-A;R+=N*N}return R/(S-1)}function y(T,A){return{name:"pooledStandardMeanDifference",value:g(f(T),f(A))}}function h(T,A,S){const R=T.length,j=A.length;if(R<2||j<2)return null;const N=u(S),{mean:$}=U(T),{mean:_}=U(A),Y=p(T,$),Z=p(A,_),J=Y/R+Z/j;if(!(J>0))return null;const D=Math.sqrt(J),te=($-_)/D,z=Y/R*(Y/R)/(R-1),X=Z/j*(Z/j)/(j-1),ne=J*J/(z+X),re=Math.min(1,Math.max(0,2*(1-t(Math.abs(te),ne)))),ae=$-_,fe=r(1-(1-N)/2,ne)*D;return{test:m.WELCH,statistic:te,statisticName:"t",df:ne,pValue:re,interval:{estimate:ae,lower:ae-fe,upper:ae+fe,confidence:N,method:"welch-t (difference of means)"},effectSize:y(T,A),nA:R,nB:j,reliable:R>=b&&j>=b,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function d(T){const A=T.length;if(A===0)return Number.NaN;const S=A>>1;return A%2?T[S]:(T[S-1]+T[S])/2}function w(T,A,S){const R=T.length,j=A.length,N=R*j;if(N===0||N>l)return null;const $=new Float64Array(N);let _=0;for(let z=0;z<R;z++)for(let X=0;X<j;X++)$[_++]=T[z]-A[X];$.sort();const Y=d($),Z=Math.sqrt(R*j*(R+j+1)/12),J=i(1-(1-S)/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:S,method:"hodges-lehmann (normal approximation)"}}function v(T,A,S){const R=T.length,j=A.length;if(R<1||j<1)return null;const N=u(S),$=R+j,_=new Array($);for(let re=0;re<R;re++)_[re]={v:T[re],g:0};for(let re=0;re<j;re++)_[R+re]={v:A[re],g:1};_.sort((re,ae)=>re.v-ae.v);let Y=0,Z=0,J=0;for(;J<$;){let re=J;for(;re<$&&_[re].v===_[J].v;)re++;const ae=re-J,fe=(J+1+re)/2;for(let we=J;we<re;we++)_[we].g===0&&(Y+=fe);Z+=ae*ae*ae-ae,J=re}const D=Y-R*(R+1)/2,te=R*j/2,z=R*j/12*($+1-Z/($*($-1)));let X=1;if(z>0){const re=Math.max(0,Math.abs(D-te)-.5);X=Math.min(1,2*s(-re/Math.sqrt(z)))}const ne=w(T,A,N);return{test:m.MANN_WHITNEY,statistic:D,statisticName:"U",df:null,pValue:X,interval:ne,effectSize:y(T,A),nA:R,nB:j,reliable:R>=b&&j>=b,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function P(T,A,S,R,j){const N=k(T,A,j),$=k(S,R,j);if(!N||!$)return null;const _=N.proportion-$.proportion,Y=_-Math.sqrt((N.proportion-N.lower)**2+($.upper-$.proportion)**2),Z=_+Math.sqrt((N.upper-N.proportion)**2+($.proportion-$.lower)**2);return{lower:Y,upper:Z}}function G(T,A,S,R,j,N={}){if(!(A>0)||!(R>0))return null;const $=new Set([...T.keys(),...S.keys()]),_=$.size;if(_<2)return null;const Y=A+R;let Z=0;for(const X of $){const ne=T.get(X)||0,re=S.get(X)||0,ae=ne+re,fe=A*ae/Y,we=R*ae/Y;fe>0&&(Z+=(ne-fe)*(ne-fe)/fe),we>0&&(Z+=(re-we)*(re-we)/we)}const J=_-1,D=n(Z,J);let te=null;N.category!==void 0&&$.has(N.category)?te=N.category:_===2&&([te]=[...$]);let z=null;if(te!==null){const X=P(T.get(te)||0,A,S.get(te)||0,R,u(j));X&&(z={estimate:(T.get(te)||0)/A-(S.get(te)||0)/R,lower:X.lower,upper:X.upper,confidence:u(j),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,A,S,R)},nA:A,nB:R,reliable:A>=b&&R>=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 K(T,A,S){if(S===m.WELCH||S===m.MANN_WHITNEY)return{test:S,chosenBy:"override",reason:`caller override: ${S}`};const R=O(T),j=O(A),N=R===null?null:Math.exp(-R/2),$=j===null?null:Math.exp(-j/2);return N!==null&&N<c||$!==null&&$<c?{test:m.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${c})`}:{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 H(T,A,S,R={}){if(!T||!A)return null;const j=u(R.confidence),N=I(A);let $;if(Array.isArray(R.groups)&&R.groups.length===2)$=[V(R.groups[0]),V(R.groups[1])];else{const{map:re}=L(A,S),ae=[...re.entries()].sort((fe,we)=>we[1]-fe[1]).slice(0,2).map(fe=>fe[0]);if(ae.length<2)return E("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;$=ae}const[_,Y]=$;if(_===null||Y===null||_===Y)return E("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const Z=[],J=[];for(let re=0;re<S.length;re++){const ae=V(N(S[re]));ae===_?Z.push(S[re]):ae===Y&&J.push(S[re])}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=R.test&&R.test!=="auto"?String(R.test):null,te=M(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 re=L(T,Z),ae=L(T,J);z=G(re.map,re.total,ae.map,ae.total,j,{category:R.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 re=Q(T,Z),ae=Q(T,J),fe=K(re,ae,D);X=fe.chosenBy,ne=fe.reason,z=fe.test===m.MANN_WHITNEY?v(re,ae,j):h(re,ae,j)}return z?{...z,chosenBy:X,reason:ne,groups:[_,Y]}:(E("compareGroups:degenerate","[lattice] compareGroups: the chosen test had too little to work with (too few values, or no variation)."),null)}}),He("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 ve}});const E=F("packages/core/src/internal/warn.js").warnOnce,I=F("packages/core/src/compute/handle.js").valueReader,x=F("packages/core/src/compute/statistics.js"),Q=x.numbers,U=x.moments,L=x.frequencyMap,q=x.isNumericColumn,M=x.jarqueBera,O=x.proportionInterval,k=F("packages/core/src/compute/special.js"),b=k.studentT,a=k.studentTQuantile,g=k.normalCdf,o=k.normalQuantile,t=k.chiSquareUpperTail,r=k.incompleteBeta,s=Object.freeze({T:"t",WELCH:"welch",MANN_WHITNEY:"mannWhitney",ANOVA:"anova",KRUSKAL:"kruskal",CHI_SQUARE:"chiSquare",PROPORTIONS:"proportions"}),i=new Set([s.T,s.WELCH,s.MANN_WHITNEY]),n=new Set([s.ANOVA,s.KRUSKAL]),m=new Set([s.CHI_SQUARE,s.PROPORTIONS]),c=.05,l=[.2,.5,.8],u=[.147,.33,.474],f=[.01,.06,.14],p=[[.1,.3,.5],[.07,.21,.35],[.06,.17,.29],[.05,.15,.25]];function y(be){const se=Number(be);return Number.isFinite(se)&&se>0&&se<1?se:.05}function h(be){return be==null||be===""||typeof be=="number"&&Number.isNaN(be)?null:be instanceof Date?be.getTime():typeof be=="object"?String(be):be}function d(be,se){const de=I(be),oe=[],ce=new Map;for(let he=0;he<se.length;he++){const Oe=h(de(se[he]));if(Oe===null)continue;let Se=ce.get(Oe);Se||(Se={value:Oe,rows:[]},ce.set(Oe,Se),oe.push(Se)),Se.rows.push(se[he])}return oe}function w(be){const{n:se,mean:de,m2:oe}=U(be),ce=se>1?oe/(se-1):0;return{n:se,mean:de,sd:Math.sqrt(ce),variance:ce}}function v(be,se,de){if(!(se>0)||!(de>0)||!(be>=0)||!Number.isFinite(be))return Number.NaN;if(be===0)return 1;const oe=se*be/(se*be+de);return 1-r(se/2,de/2,oe)}function P(be,se){const de=Math.abs(be);return Number.isFinite(de)?de>=se[2]?"large":de>=se[1]?"medium":de>=se[0]?"small":"negligible":"negligible"}function G(be,se,de){if(be==="cohensD")return P(se,l);if(be==="cliffsDelta")return P(se,u);if(be==="etaSquared")return P(se,f);const oe=Math.max(1,Math.min(p.length,Math.floor(de||1)));return P(se,p[oe-1])}function V(be,se){if(!(be.n>1)||!(se.n>1))return null;const de=((be.n-1)*be.variance+(se.n-1)*se.variance)/(be.n+se.n-2);return de>0?(be.mean-se.mean)/Math.sqrt(de):null}function K(be,se){const de=be.length,oe=se.length;if(!de||!oe)return null;const ce=Array.from(se).sort((Se,Ce)=>Se-Ce);let he=0,Oe=0;for(let Se=0;Se<de;Se++){const Ce=be[Se];let Ie=0,ke=oe;for(;Ie<ke;){const Ae=Ie+ke>>1;ce[Ae]<Ce?Ie=Ae+1:ke=Ae}const _e=Ie;let Te=Ie;for(;Te<oe&&ce[Te]===Ce;)Te++;const je=Te-Ie;he+=_e,Oe+=oe-Te}return(he-Oe)/(de*oe)}function H(be,se,de,oe){const ce=Math.min(de-1,oe-1);return!(se>0)||!(ce>0)?null:Math.sqrt(be/(se*ce))}function T(be){return Number.isFinite(be)?be<.001?"p < 0.001":be>=.995?"p > 0.995":`p = ${be.toFixed(3)}`:"p = —"}function A(be){if(!Number.isFinite(be))return"0";const se=Math.abs(be);return se===0?"0":se>=1e3?String(Math.round(be)):se>=100?String(Number(be.toFixed(0))):se>=10?String(Number(be.toFixed(1))):se>=1?String(Number(be.toFixed(2))):String(Number(be.toPrecision(2)))}const S=new Set(["cohensD","cliffsDelta"]);function R(be){if(be.difference!=null&&Math.abs(be.difference)>=1e-12)return Math.sign(be.difference);const se=be.effectSize;if(se&&S.has(se.name)&&Number.isFinite(se.value)&&Math.abs(se.value)>=1e-12)return Math.sign(se.value);const[de,oe]=be.groups;return Number.isFinite(de.mean)&&Number.isFinite(oe.mean)&&de.mean!==oe.mean?Math.sign(de.mean-oe.mean):0}function j(be){const se=be.measureName||"values";return{subject:se.charAt(0).toUpperCase()+se.slice(1),be:se==="values"?"are":"is",name:se}}function N(be,se){const de=se.unit?` ${se.unit}`:"",{subject:oe,be:ce}=j(se),he=be.groups[0].label,Oe=be.groups[1].label,Se=be.effectSize?be.effectSize.label:"negligible",Ce=be.pValue<be.alpha,Ie=Ce?"unlikely to be chance":"consistent with chance";if(!Ce&&Se==="negligible")return`${oe} ${ce} essentially the same for ${he} and ${Oe} (${T(be.pValue)}); the effect is ${Se}.`;const ke=R(be),_e=`the difference is ${Ie} (${T(be.pValue)}) and the effect is ${Se}.`;if(ke===0)return`${oe} ${ce} different between ${he} and ${Oe}; ${_e}`;const Te=ke>0?he:Oe,je=ke>0?Oe:he,Ae=be.difference!=null&&Math.abs(be.difference)>=1e-12,Ee=Math.abs(be.difference),Me=Ae?typeof se.formatValue=="function"?` by about ${se.formatValue(Ee)}${de}`:` by about ${A(Ee)}${de}`:"";return`${oe} ${ce} higher for ${Te} than for ${je}${Me}; ${_e}`}function $(be,se){const{name:de}=j(se),oe=be.effectSize?be.effectSize.label:"negligible",ce=T(be.pValue);return be.pValue<be.alpha?`The groups differ in ${de}; the difference is unlikely to be chance (${ce}) and the effect is ${oe}.`:oe==="negligible"?`The groups are essentially the same in ${de} (${ce}); the effect is ${oe}.`:`The groups show a ${oe} effect in ${de}, but the difference is consistent with chance (${ce}).`}function _(be,se){const de=be.length;if(de<2)return null;const{mean:oe,m2:ce}=U(be),he=ce/(de-1);if(!(he>0))return null;const Oe=Math.sqrt(he),Se=Oe/Math.sqrt(de),Ce=oe/Se,Ie=de-1,ke=Math.min(1,Math.max(0,2*(1-b(Math.abs(Ce),Ie)))),_e=a(1-se/2,Ie)*Se,Te=oe/Oe;return{test:s.T,statistic:Ce,statisticName:"t",df:Ie,pValue:ke,difference:oe,interval:{estimate:oe,lower:oe-_e,upper:oe+_e,confidence:1-se,method:"paired-t (mean of the pair differences)"},effectSize:{name:"cohensD",label:P(Te,l),value:Te}}}function Y(be,se){const de=Array.from(be).filter(Ee=>Ee!==0),oe=de.length;if(!oe)return null;const ce=Array.from({length:oe},(Ee,Me)=>Me).sort((Ee,Me)=>Math.abs(de[Ee])-Math.abs(de[Me])),he=new Array(oe);let Oe=0;for(;Oe<oe;){let Ee=Oe;for(;Ee+1<oe&&Math.abs(de[ce[Ee+1]])===Math.abs(de[ce[Oe]]);)Ee++;const Me=(Oe+Ee)/2+1;for(let Be=Oe;Be<=Ee;Be++)he[ce[Be]]=Me;Oe=Ee+1}let Se=0,Ce=0;for(let Ee=0;Ee<oe;Ee++)Ce+=he[Ee],de[Ee]>0&&(Se+=he[Ee]);const Ie=Ce-Se,ke=oe*(oe+1)/4,_e=Math.sqrt(oe*(oe+1)*(2*oe+1)/24),Te=_e>0?(Math.abs(Se-ke)-.5)/_e:0,je=Math.min(1,Math.max(0,2*g(-Math.max(0,Te)))),Ae=Ce>0?(Se-Ie)/Ce:0;return{test:s.MANN_WHITNEY,statistic:Se,statisticName:"W",df:null,pValue:je,difference:null,interval:null,effectSize:{name:"cliffsDelta",label:P(Ae,u),value:Ae}}}function Z(be,se,de){const oe=w(be),ce=w(se);if(oe.n<2||ce.n<2)return null;const he=((oe.n-1)*oe.variance+(ce.n-1)*ce.variance)/(oe.n+ce.n-2);if(!(he>0))return null;const Oe=Math.sqrt(he*(1/oe.n+1/ce.n)),Se=(oe.mean-ce.mean)/Oe,Ce=oe.n+ce.n-2,Ie=Math.min(1,Math.max(0,2*(1-b(Math.abs(Se),Ce)))),ke=oe.mean-ce.mean,_e=a(1-de/2,Ce)*Oe,Te=V(oe,ce);return{test:s.T,statistic:Se,statisticName:"t",df:Ce,pValue:Ie,difference:ke,interval:{estimate:ke,lower:ke-_e,upper:ke+_e,confidence:1-de,method:"student-t (pooled variance, difference of means)"},effectSize:{name:"cohensD",label:P(Te,l),value:Te},summaries:[oe,ce]}}function J(be,se,de){const oe=w(be),ce=w(se);if(oe.n<2||ce.n<2)return null;const he=oe.variance/oe.n+ce.variance/ce.n;if(!(he>0))return null;const Oe=Math.sqrt(he),Se=(oe.mean-ce.mean)/Oe,Ce=oe.variance/oe.n*(oe.variance/oe.n)/(oe.n-1),Ie=ce.variance/ce.n*(ce.variance/ce.n)/(ce.n-1),ke=he*he/(Ce+Ie),_e=Math.min(1,Math.max(0,2*(1-b(Math.abs(Se),ke)))),Te=oe.mean-ce.mean,je=a(1-de/2,ke)*Oe,Ae=V(oe,ce);return{test:s.WELCH,statistic:Se,statisticName:"t",df:ke,pValue:_e,difference:Te,interval:{estimate:Te,lower:Te-je,upper:Te+je,confidence:1-de,method:"welch-t (unequal variances, difference of means)"},effectSize:{name:"cohensD",label:P(Ae,l),value:Ae},summaries:[oe,ce]}}function D(be,se,de){const oe=be.length,ce=se.length;if(oe<1||ce<1)return null;const he=w(be),Oe=w(se),Se=oe+ce,Ce=new Array(Se);for(let Be=0;Be<oe;Be++)Ce[Be]={v:be[Be],g:0};for(let Be=0;Be<ce;Be++)Ce[oe+Be]={v:se[Be],g:1};Ce.sort((Be,Ke)=>Be.v-Ke.v);let Ie=0,ke=0,_e=0;for(;_e<Se;){let Be=_e;for(;Be<Se&&Ce[Be].v===Ce[_e].v;)Be++;const Ke=(_e+1+Be)/2;for(let Je=_e;Je<Be;Je++)Ce[Je].g===0&&(Ie+=Ke);const et=Be-_e;ke+=et*et*et-et,_e=Be}const Te=Ie-oe*(oe+1)/2,je=oe*ce/2,Ae=oe*ce/12*(Se+1-ke/(Se*(Se-1)));let Ee=1;if(Ae>0){const Be=Math.max(0,Math.abs(Te-je)-.5);Ee=Math.min(1,2*g(-Be/Math.sqrt(Ae)))}const Me=K(be,se);return{test:s.MANN_WHITNEY,statistic:Te,statisticName:"U",df:null,pValue:Ee,difference:null,interval:te(be,se,1-de),effectSize:{name:"cliffsDelta",label:P(Me,u),value:Me},summaries:[he,Oe]}}function te(be,se,de){const oe=be.length,ce=se.length,he=oe*ce;if(he===0||he>2e6)return null;const Oe=new Float64Array(he);let Se=0;for(let Ae=0;Ae<oe;Ae++)for(let Ee=0;Ee<ce;Ee++)Oe[Se++]=be[Ae]-se[Ee];Oe.sort();const Ce=he>>1,Ie=he%2?Oe[Ce]:(Oe[Ce-1]+Oe[Ce])/2,ke=Math.sqrt(oe*ce*(oe+ce+1)/12),_e=o(1-(1-de)/2);let Te=Math.round(he/2-_e*ke);Te>=0||(Te=0);const je=Math.floor((he-1)/2);return Te>je&&(Te=je),{estimate:Ie,lower:Oe[Te],upper:Oe[he-1-Te],confidence:de,method:"hodges-lehmann (location shift)"}}function z(be,se){const de=be.length,oe=be.map(w);if(oe.some(Ee=>Ee.n<2))return null;const ce=oe.reduce((Ee,Me)=>Ee+Me.n,0),he=oe.reduce((Ee,Me)=>Ee+Me.mean*Me.n,0)/ce;let Oe=0,Se=0;for(let Ee=0;Ee<de;Ee++)Oe+=oe[Ee].n*(oe[Ee].mean-he)**2,Se+=(oe[Ee].n-1)*oe[Ee].variance;const Ce=de-1,Ie=ce-de;if(!(Se>0)||Ie<1)return null;const ke=Oe/Ce,_e=Se/Ie,Te=ke/_e,je=Math.min(1,Math.max(0,v(Te,Ce,Ie))),Ae=Oe/(Oe+Se);return{test:s.ANOVA,statistic:Te,statisticName:"F",df:{between:Ce,within:Ie},pValue:je,difference:null,interval:null,effectSize:{name:"etaSquared",label:P(Ae,f),value:Ae},summaries:oe}}function X(be,se){const de=be.length,oe=be.map(w);if(de<2)return null;const ce=oe.reduce((Me,Be)=>Me+Be.n,0),he=[];for(let Me=0;Me<de;Me++)for(let Be=0;Be<be[Me].length;Be++)he.push({v:be[Me][Be],g:Me});he.sort((Me,Be)=>Me.v-Be.v);const Oe=new Array(he.length);let Se=0,Ce=0;for(;Ce<he.length;){let Me=Ce;for(;Me<he.length&&he[Me].v===he[Ce].v;)Me++;const Be=(Ce+1+Me)/2;for(let et=Ce;et<Me;et++)Oe[et]=Be;const Ke=Me-Ce;Se+=Ke*Ke*Ke-Ke,Ce=Me}const Ie=new Array(de).fill(0);for(let Me=0;Me<he.length;Me++)Ie[he[Me].g]+=Oe[Me];let ke=0;for(let Me=0;Me<de;Me++)ke+=Ie[Me]*Ie[Me]/oe[Me].n;ke=12/(ce*(ce+1))*ke-3*(ce+1);const _e=1-Se/(ce*ce*ce-ce),Te=_e>0?ke/_e:ke,je=de-1,Ae=Math.min(1,Math.max(0,t(Te,je))),Ee=(Te-de+1)/(ce-de);return{test:s.KRUSKAL,statistic:Te,statisticName:"H",df:je,pValue:Ae,difference:null,interval:null,effectSize:{name:"etaSquared",label:P(Ee,f),value:Math.max(0,Ee)},summaries:oe}}function ne(be,se,de,oe,ce){const he=O(be,se,ce),Oe=O(de,oe,ce);if(!he||!Oe)return null;const Se=he.proportion-Oe.proportion,Ce=Se-Math.sqrt((he.proportion-he.lower)**2+(Oe.upper-Oe.proportion)**2),Ie=Se+Math.sqrt((he.upper-he.proportion)**2+(Oe.proportion-Oe.lower)**2);return{estimate:Se,lower:Ce,upper:Ie}}function re(be,se,de,oe){const ce=I(se),he=new Set,Oe=[];for(const Be of be){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++,he.add(ut))}Oe.push(Ke),Be.total=et}const Se=[...he];if(Se.length<2)return null;const Ce=be.reduce((Be,Ke)=>Be+Ke.total,0);if(!(Ce>0))return null;let Ie=0;for(const Be of be)for(const Ke of Se){const et=Oe[be.indexOf(Be)].get(Ke)||0,Je=be.reduce((Ct,Nt)=>Ct+(Oe[be.indexOf(Nt)].get(Ke)||0),0),ut=Be.total*Je/Ce;ut>0&&(Ie+=(et-ut)*(et-ut)/ut)}const ke=be.length,_e=Se.length,Te=(ke-1)*(_e-1),je=Math.min(1,Math.max(0,t(Ie,Te))),Ae=H(Ie,Ce,ke,_e);let Ee=null;if(ke===2&&_e===2){const[Be]=Se,Ke=Oe[0].get(Be)||0,et=Oe[1].get(Be)||0,Je=ne(Ke,be[0].total,et,be[1].total,oe);Je&&(Ee={...Je,confidence:oe,method:"newcombe (difference in this category's share)",category:Be})}const Me=be.map((Be,Ke)=>{const et={};for(const Je of Se)et[String(Je)]=(Oe[Ke].get(Je)||0)/Be.total;return et});return{test:s.CHI_SQUARE,statistic:Ie,statisticName:"chiSquare",df:Te,pValue:je,difference:null,interval:Ee,effectSize:{name:"cramersV",label:G("cramersV",Ae,Math.min(ke-1,_e-1)),value:Ae},proportions:Me}}function ae(be,se,de,oe){const ce=I(se),he=new Set;for(const Je of be)for(const ut of Je.rows){const Ct=h(ce(ut));Ct!==null&&he.add(Ct)}if(he.size!==2)return null;const[Oe]=[...he],Se=be[0].rows.reduce((Je,ut)=>Je+(h(ce(ut))===Oe?1:0),0),Ce=be[1].rows.reduce((Je,ut)=>Je+(h(ce(ut))===Oe?1:0),0),Ie=be[0].rows.length,ke=be[1].rows.length;if(!(Ie>0)||!(ke>0))return null;const _e=Se/Ie,Te=Ce/ke,je=(Se+Ce)/(Ie+ke);if(!(je>0)||!(je<1))return null;const Ae=Math.sqrt(je*(1-je)*(1/Ie+1/ke)),Ee=(_e-Te)/Ae,Me=Math.min(1,Math.max(0,2*g(-Math.abs(Ee)))),Be=_e-Te,Ke=ne(Se,Ie,Ce,ke,oe),et=H(Ee*Ee,Ie+ke,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:Oe}:null,effectSize:{name:"cramersV",label:G("cramersV",et,1),value:et},proportions:[{[String(Oe)]:_e},{[String(Oe)]:Te}],focalCategory:Oe}}function fe(be,se,de,oe){if(de&&i.has(de))return{test:de,reason:`caller override: ${de}`};const ce=M(be),he=M(se),Oe=ce===null?null:Math.exp(-ce/2),Se=he===null?null:Math.exp(-he/2);if(Oe!==null&&Oe<c||Se!==null&&Se<c)return{test:s.MANN_WHITNEY,reason:"two numeric groups, non-normal by Jarque-Bera"};const Ce=w(be),Ie=w(se);if(Ce.n>=3&&Ie.n>=3&&Ce.variance>0&&Ie.variance>0){const ke=Math.max(Ce.variance,Ie.variance)/Math.min(Ce.variance,Ie.variance),_e=Ce.variance>=Ie.variance?Ce.n-1:Ie.n-1,Te=Ce.variance>=Ie.variance?Ie.n-1:Ce.n-1;if(2*Math.min(v(ke,_e,Te),1-v(ke,_e,Te))<oe)return{test:s.WELCH,reason:"two numeric groups, unequal variances (F-test)"}}return{test:s.T,reason:Oe!==null||Se!==null?"two numeric groups, equal variances and no departure from normality":"two numeric groups (too few rows to screen normality)"}}function we(be,se){if(se&&n.has(se))return{test:se,reason:`caller override: ${se}`};for(const de of be){const oe=M(de),ce=oe===null?null:Math.exp(-oe/2);if(ce!==null&&ce<c)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 ve(be,se,de,oe={},ce=null){if(!be||!se)return null;const he=y(oe.alpha),Oe=1-he,Se=oe.test&&oe.test!=="auto"?String(oe.test):null,Ce=d(se,de);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 Ie;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(Ie=Ce.filter(et=>et.value===Ke[0]||et.value===Ke[1]),Ie.length!==2)return E("compare:empty","[lattice] statistics.compare: one of the two groups has no rows in the current set."),null;Ie.sort((et,Je)=>et.value===Ke[0]?-1:1)}else Ce.length===2||Se&&i.has(Se)||Se&&m.has(Se)?Ie=Ce.slice(0,2):(Se&&n.has(Se),Ie=Ce);const _e=q(be,de),Te=!!oe.paired&&ce&&Ie.length===2&&_e;let je,Ae,Ee;if(_e)if(Ie.length===2&&!(Se&&n.has(Se))){const Ke=Q(be,Ie[0].rows),et=Q(be,Ie[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=$e(be,ce,Ie[0].rows,Ie[1].rows);return ut?(Ae=Se?"override":"auto",Ee=Se?`caller override: ${Se} (paired)`:"two numeric groups, paired",je=Se===s.MANN_WHITNEY?Y(ut.diffs,he):_(ut.diffs,he),je?(je.paired=!0,je.chosenBy=Ae,je.reason=Ee,je.groups=[{value:Ie[0].value,label:String(Ie[0].value),n:ut.n},{value:Ie[1].value,label:String(Ie[1].value),n:ut.n}],je.alpha=he,je.method=je.test===s.MANN_WHITNEY?"Wilcoxon signed-rank test (paired)":"Student's paired t-test (difference of pairs)",je.verdict=N(je,oe),je.categorical=!1,je):(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=fe(Ke,et,Se,he);Ae=Se?"override":"auto",Ee=Je.reason,Je.test===s.MANN_WHITNEY?je=D(Ke,et,he):Je.test===s.WELCH?je=J(Ke,et,he):je=Z(Ke,et,he),je&&je.interval&&je.difference===null&&(je.difference=je.interval.estimate)}else{const Ke=Ie.map(Je=>Q(be,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=we(Ke,Se);Ae=Se?"override":"auto",Ee=et.reason,je=et.test===s.KRUSKAL?X(Ke,he):z(Ke,he)}else if(Ie.length===2){const Ke=Re(be,Ie).size===2;if(Se===s.PROPORTIONS||Ke&&!Se)Ae=Se?"override":"auto",Ee=Se?"caller override: proportions":"categorical measure with two categories (binary)",je=ae(Ie,be,he,Oe);else if(Se===s.CHI_SQUARE||!Ke&&!Se)Ae=Se?"override":"auto",Ee=Se?"caller override: chiSquare":`categorical measure with ${Re(be,Ie).size} categories`,je=re(Ie,be,he,Oe);else return E("compare:numeric-needed",`[lattice] statistics.compare: ${Se} needs a numeric measure, but the column is categorical.`),null}else Ae=Se?"override":"auto",Ee=Se?`caller override: ${Se}`:`categorical measure with ${Re(be,Ie).size} categories`,je=re(Ie,be,he,Oe);if(!je)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=je.summaries,Be=je.proportions;return{test:je.test,chosenBy:Ae,reason:Ee,statistic:je.statistic,statisticName:je.statisticName,df:je.df===void 0?null:je.df,pValue:je.pValue,alpha:he,paired:!1,interval:je.interval||null,effectSize:je.effectSize,groups:Ie.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:je.difference===void 0?null:je.difference,method:je.test,categorical:!_e,verdict:Ie.length===2?N({...je,alpha:he,groups:[{value:Ie[0].value,label:String(Ie[0].value),mean:Me?Me[0].mean:void 0},{value:Ie[1].value,label:String(Ie[1].value),mean:Me?Me[1].mean:void 0}],categorical:!_e,difference:je.difference===void 0?null:je.difference},oe):$({...je,alpha:he},oe)}}function Re(be,se){const de=I(be),oe=new Set;for(const ce of se)for(const he of ce.rows){const Oe=h(de(he));Oe!==null&&oe.add(Oe)}return oe}function $e(be,se,de,oe){const ce=I(se),he=I(be),Oe=new Map;for(const Ce of oe){const Ie=h(ce(Ce));Ie!==null&&Oe.set(Ie,he(Ce))}const Se=[];for(const Ce of de){const Ie=h(ce(Ce));if(Ie===null||!Oe.has(Ie))continue;const ke=Number(he(Ce)),_e=Number(Oe.get(Ie));!Number.isFinite(ke)||!Number.isFinite(_e)||Se.push(ke-_e)}return Se.length<2?null:{diffs:Float64Array.from(Se),n:Se.length}}}),He("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 W}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return I}});const ie="__lattice_detail",E=36;function W(x){const Q=x.config&&x.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:x.config&&x.config.detailColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(U,L){return!!(L&&L.expanded)},formatValue(){return""}}}const I=W}),He("packages/core/src/columns/treecolumn.js",function(e,F){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createTreeColumn",{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,W="__lattice_tree",I=260;function x(U){const L=U.tree||{},q=U.config&&U.config.treeColumnWidth||I,M=!!(U.config&&U.config.treeColumnFlex),O=()=>(U.columns&&E(U.columns.visible)?U.columns.visible():[]).find(g=>!g.generated)||null,k=(a,g)=>{if(g&&g.group)return g.groupValue;if(E(L.label))return L.label(a,g);if(typeof L.label=="string")return a==null?null:a[L.label];const o=O();return o&&E(o.getValue)?o.getValue(a,g):null},b=()=>{if(L.title)return L.title;const a=typeof L.label=="string"?U.columns&&E(U.columns.get)?U.columns.get(L.label):null:O();return a&&(a.title||a.id)||"Hierarchy"};return{id:W,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:L.icon,iconClass:L.iconClass,content:L.content,checkbox:L.checkbox,onCheck:L.onCheck}},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:M?{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(a,g){return k(a,g)},formatValue(a,g){if(g&&g.grandTotal)return U.config&&U.config.grandTotalLabel||"Total";if(a==null)return"";if(!L.label){const o=O();if(o&&E(o.formatValue))return o.formatValue(a,g)}return String(a)}}}const Q=x}),He("packages/core/src/columns/pivotcolumns.js",function(e,F){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return x}});const E=F("packages/core/src/internal/warn.js").warnOnce,W="__lattice_pivot",I=500;function x(q){const{pivot:M,valueColumns:O,config:k}=q,b=M&&M.paths||[],a=q.separator||k&&k.pivot&&k.pivot.separator||" | ",g=k&&k.pivot&&k.pivot.maxColumns||I;if(!b.length||!O.length)return{tree:[],leaves:[],error:null};const o=Q(k),t=b.length*O.length+(o?O.length:0);if(t>g){const i=`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}`,i),{tree:[],leaves:[],error:i}}const r=[],s=[];for(const i of b){const n=[];for(const m of O){const c=L(i,m,a);n.push(c),s.push(c)}n.length===1?(n[0].title=String(i),r.push(n[0])):r.push({id:`${W}:group:${i}`,title:String(i),columns:n,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(o){const i=O.map(m=>U(m,k));s.push(...i);const n=k&&k.pivot&&k.pivot.totalsLabel||"Total";if(i.length===1)i[0].title=n,o==="before"?r.unshift(i[0]):r.push(i[0]);else{const m={id:`${W}:group:__totals`,title:n,columns:i,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};o==="before"?r.unshift(m):r.push(m)}}return{tree:r,leaves:s,error:null}}function Q(q){const M=q&&q.pivot&&q.pivot.groupTotals;return M==="before"||M==="after"?M:null}function U(q,M){return{id:`${W}:__total${M&&M.pivot&&M.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(O,k){const b=k&&k.totals;return b&&Object.hasOwn(b,q.id)?b[q.id]:null},formatValue(O,k){return O==null?"":q.formatValue?q.formatValue(O,k):String(O)}}}function L(q,M,O){return{id:`${W}:${q}${O}${M.id}`,field:null,title:M.title||M.id,type:M.type,dataType:M.dataType,nullable:!0,align:M.align,generated:!0,pivot:{enabled:!1,index:0,path:q,sourceId:M.id},value:{pure:!0},cell:{align:M.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:M.total,lookup:null,layout:{width:M.layout&&M.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?"":M.formatValue?M.formatValue(k,b):String(k)}}}}),He("packages/core/src/compute/group.js",function(e,F){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return k}});const ie=F("packages/core/src/compute/handle.js"),E=ie.dictSize,W=ie.identity,I=ie.presenceReader,x=ie.rowCount,Q=ie.valueReader,U="",L="\0",q=1<<20;function M(b,a,g,o){const t=b.length,r=b.map(l=>Q(l)),s=Array.isArray(o)&&o.some(Boolean),i=s?r.map((l,u)=>o[u]?f=>o[u](l(f)):l):r;if(!s&&t>0&&b.every(l=>l&&l.kind==="dictionary"&&l.dict)){const l=b.map(f=>E(f.dict)+1);let u=1;for(let f=0;f<t;f++)u*=l[f];if(u<=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],G=P&&P(d)===0?l[v]-1:f[v][d];w=w*l[v]+G}return w},h=new Float64Array(g);for(let d=0;d<g;d++)h[d]=y(a[d]);return{packed:h,strings:null,product:u,readers:i,keyOf:y}}}const m=l=>{let u="";for(let f=0;f<t;f++){const p=i[f](l);u+=(f===0?"":U)+(p==null?L:String(p))}return u},c=new Array(g);for(let l=0;l<g;l++)c[l]=m(a[l]);return{packed:null,strings:c,product:1/0,readers:i,keyOf:m}}function O(b,a,g,o){const t=new Uint32Array(o+1);for(let n=0;n<g;n++)t[a[n]+1]++;for(let n=0;n<o;n++)t[n+1]+=t[n];const r=new Uint32Array(g),s=t.slice(0,o);for(let n=0;n<g;n++)r[s[a[n]]++]=b[n];const i=new Array(o);for(let n=0;n<o;n++)i[n]=r.subarray(t[n],t[n+1]);return i}function k(b,a,g={}){const o=b||[],t=a||W(x(o[0],g)),r=t.length;if(o.length===0||r===0)return{keys:[],buckets:[]};const{packed:s,strings:i,product:n,readers:m}=M(o,t,r,g.project),c=new Uint32Array(r);let l=0,u=null;if(s&&n<=Math.max(1024,Math.min(q,r*4))){const h=n,d=new Int32Array(h).fill(-1);for(let w=0;w<r;w++)d[s[w]]=0;for(let w=0;w<h;w++)d[w]===0&&(d[w]=l++);for(let w=0;w<r;w++)c[w]=d[s[w]];u=new Float64Array(l);for(let w=0;w<h;w++)d[w]>=0&&(u[d[w]]=w)}else if(s){const h=new Map;for(let d=0;d<r;d++){const w=s[d];let v=h.get(w);v===void 0&&(v=l++,h.set(w,v)),c[d]=v}u=new Float64Array(l);for(const[d,w]of h)u[w]=d}else{const h=new Map;for(let d=0;d<r;d++){const w=i[d];let v=h.get(w);v===void 0&&(v=l++,h.set(w,v)),c[d]=v}}const f=O(t,c,r,l),p=new Array(l);for(let h=0;h<l;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 u&&(y.packed=u),y}}),He("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 M}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return O}}),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 a}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return r}});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,L=F("packages/core/src/compute/total.js").total,q="|",M="/",O=2e3;function k(n,m,c){return`${n}${q}${m}${q}${c}`}function b(n,m){let c="";for(let l=0;l<n.length;l++){const u=n[l];c+=(l===0?"":m)+(u==null?"":String(u))}return c}function a(n,m,c={}){const l=c.separator||M,u=m.length,{keyOf:f,readers:p}=Q(n,m,0),y=new Map,h=[],d=[];for(let H=0;H<u;H++){const T=m[H],A=f(T);if(y.has(A))continue;y.set(A,h.length),d.push(A);const S=new Array(p.length);for(let R=0;R<p.length;R++)S[R]=p[R](T);h.push(S)}const w=I(c.locale),v=h.map((H,T)=>T);v.sort((H,T)=>{const A=h[H],S=h[T];for(let R=0;R<A.length;R++){const j=g(A[R],S[R],w);if(j!==0)return j}return H-T});const P=new Array(v.length),G=new Array(v.length),V=new Map;for(let H=0;H<v.length;H++){const T=v[H];P[H]=h[T],G[H]=b(h[T],l),V.set(d[T],H)}return{keys:P,paths:G,idOf:H=>{const T=V.get(f(H));return T===void 0?-1:T}}}function g(n,m,c){const l=n==null,u=m==null;return l||u?l&&u?0:l?1:-1:c(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 c=typeof n.handle=="function"?n.handle:null;if(!c)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 l=typeof n.totalOf=="function"?n.totalOf:null,u=[];for(const f of m){const p=c(f);p&&u.push({colId:f,handle:p,fn:l?l(f):"sum"})}return u}function t(n,m,c){if(Array.isArray(n)){const l=c||{};return{...l,pivotHandles:n,order:m||null,groups:l.groups||null}}return n||{}}function r(n,m,c){const l=t(n,m,c),u=l.separator||M,f=o(l),p=l.maxColumns===void 0?O:l.maxColumns,y=l.groups&&l.groups.buckets?l.groups:null,h=y?y.buckets:[l.order||new Uint32Array(0)],d=l.groupPaths||(y?y.keys.map(A=>b(A,u)):[""]),w=i(h),{keys:v,paths:P,idOf:G}=a(l.pivotHandles||[],w,l),V=P.length*Math.max(1,f.length),K=s(P,f,u);if(p&&V>p){const A=new Map;return{keys:v,paths:P,fields:K,groupPaths:d,columns:V,values:A,cells:A,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 H=new Map,T=P.length;for(let A=0;A<h.length;A++){const S=h[A],R=d[A]===void 0?"":d[A],j=S.length;if(j===0)continue;const N=new Int32Array(j),$=new Uint32Array(T+1);for(let Z=0;Z<j;Z++){const J=G(S[Z]);N[Z]=J,J>=0&&$[J+1]++}for(let Z=0;Z<T;Z++)$[Z+1]+=$[Z];const _=new Uint32Array(j),Y=$.slice(0,T);for(let Z=0;Z<j;Z++){const J=N[Z];J>=0&&(_[Y[J]++]=S[Z])}for(let Z=0;Z<T;Z++){const J=$[Z],D=$[Z+1];if(D===J)continue;const te=_.subarray(J,D);for(let z=0;z<f.length;z++){const X=f[z],ne=L(X.handle,te,X.fn,l.totalContext||{locale:l.locale});H.set(k(R,P[Z],X.colId),ne)}}}return{keys:v,paths:P,fields:K,groupPaths:d,columns:V,values:H,cells:H,error:null}}function s(n,m,c){if(m.length===0)return n.slice();const l=[];for(const u of n)for(const f of m)l.push(`${u}${c}${f.colId}`);return l}function i(n){if(n.length===1)return n[0]||new Uint32Array(0);let m=0;for(const u of n)m+=u?u.length:0;const c=new Uint32Array(m);let l=0;for(const u of n)!u||u.length===0||(c.set(u,l),l+=u.length);return c}}),He("packages/core/src/compute/explain.js",function(e,F){"use strict";Object.defineProperty(e,"explainContributors",{enumerable:!0,get:function(){return O}}),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,x=new Set(["sum","count","countValues"]),Q=new Set(["min","max"]),U=new Set(["avg"]);function L(b){return typeof b=="string"?b:typeof b=="function"&&b.totalName?b.totalName:null}function q(b,a,g,o){return E(b,a,g,o||{})}function M(b,a){if(a)try{return a(b)}catch{}return b==null?"":String(b)}function O(b){const{handle:a,fn:g,leaves:o,by:t,labelOf:r,rowLabel:s}=b,i={locale:b.locale},n=o&&o.length?o:[],m=L(g),c=q(a,n,g,i),l=Q.has(m);let u;if(l){let y=-1;for(let h=0;h<n.length;h++){const d=q(a,[n[h]],g,i);if(Object.is(d,c)){y=n[h];break}}u=y<0?[]:[{key:y,indices:[y],label:s?s(y):String(y)}]}else if(t){const y=I([t],n);u=y.keys.map((h,d)=>({key:h[0],indices:y.buckets[d],label:M(h[0],r)}))}else u=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 u){const h=q(a,y.indices,g,i),d=y.indices.length;let w,v;if(m==="avg")w=((typeof h=="number"?h:0)-(typeof c=="number"?c:0))*d,v=f?d/f:0;else if(l)w=typeof h=="number"?h:0,v=1;else{w=typeof h=="number"?h:0;const P=typeof c=="number"?c: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:c,fn:m,weighted:U.has(m),single:l,contributors:p}}function k(b){const a=O({...b,leaves:b.after}),g=O({...b,leaves:b.before}),o=typeof a.total=="number"?a.total:0,t=typeof g.total=="number"?g.total:0,r=new Map;for(const n of a.contributors)r.set(n.key,n);const s=[],i=new Set;for(const n of g.contributors){i.add(n.key);const m=r.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 c=m.contribution-n.contribution;c!==0&&s.push({key:n.key,label:n.label,before:n.value,after:m.value,effect:c,kind:"changed",count:m.count})}}for(const n of a.contributors)i.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:a.total,delta:o-t,weighted:a.weighted||g.weighted,single:a.single||g.single,drivers:s}}}),He("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 x=Math.max(0,I|0);this.#n=x,this.#t=new Uint8Array(Math.ceil(x/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,x){return x?this.set(I):this.clear(I)}fill(I=!1){return this.#t.fill(I?255:0),I&&this.#r(),this}grow(I){const x=Math.max(0,I|0);if(x<=this.#n)return this;const Q=Math.ceil(x/ie);if(Q>this.#t.length){const U=new Uint8Array(Q);U.set(this.#t),this.#t=U}return this.#n=x,this}count(){const I=this.#t,x=E.#e;let Q=0;for(let U=0;U<I.length;U++)Q+=x[I[U]];return Q}and(I){const x=I instanceof E?I.words:I,Q=this.#t,U=Math.min(Q.length,x.length);for(let L=0;L<U;L++)Q[L]&=x[L];for(let L=U;L<Q.length;L++)Q[L]=0;return this}or(I){const x=I instanceof E?I.words:I,Q=this.#t,U=Math.min(Q.length,x.length);for(let L=0;L<U;L++)Q[L]|=x[L];return this}not(){const I=this.#t;for(let x=0;x<I.length;x++)I[x]=~I[x]&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 x=this.#n>>3;x<this.#t.length&&(this.#t[x]&=(1<<I)-1)}static from(I){const x=Array.isArray(I)?I:Array.from(I),Q=new E(x.length);for(let U=0;U<x.length;U++)x[U]&&Q.set(U);return Q}}}),He("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,W=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 L=Q[U];this.#t.has(L)||(this.#t.set(L,this.#e.length),this.#e.push(L))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let Q=this.#e.length*8;for(let U=0;U<this.#e.length;U++){const L=this.#e[U];typeof L=="string"&&(Q+=L.length*2),Q+=16}return Q}codeOf(Q){const U=this.#t.get(Q);if(U!==void 0)return U;const L=this.#e.length;return this.#e.push(Q),this.#t.set(Q,L),this.#n++,L}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 L=this.#e.length,q=new Array(L);for(let b=0;b<L;b++)q[b]=b;const M=E(Q).compare,O=this.#e;q.sort((b,a)=>this.#o(O[b],O[a],M));const k=new Uint32Array(L);for(let b=0;b<L;b++)k[q[b]]=b;return this.#r=k,this.#i=this.#n,this.#s=U,k}#o(Q,U,L){return typeof Q=="string"&&typeof U=="string"?L(Q,U):W(Q,U)}}}),He("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(W={}){const I=Math.max(1,W.rows??16),x=Math.max(1,W.values??I);this.#e=new Int32Array(x),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(W){return W<0||W>=this.#n?0:this.#t[W+1]-this.#t[W]}at(W){return W<0||W>=this.#n?this.#e.subarray(0,0):this.#e.subarray(this.#t[W],this.#t[W+1])}has(W,I){if(W<0||W>=this.#n)return!1;const x=this.#e,Q=this.#t[W+1];for(let U=this.#t[W];U<Q;U++)if(x[U]===I)return!0;return!1}hasAny(W,I){for(let x=0;x<I.length;x++)if(this.has(W,I[x]))return!0;return!1}hasAll(W,I){for(let x=0;x<I.length;x++)if(!this.has(W,I[x]))return!1;return!0}hasNone(W,I){return!this.hasAny(W,I)}push(W){const I=this.#n,x=W.length;this.#i(I+1),this.#s(this.#r+x);const Q=this.#r;for(let U=0;U<x;U++)this.#e[Q+U]=W[U]|0;return this.#r+=x,this.#n=I+1,this.#t[I]=Q,this.#t[I+1]=this.#r,I}write(W,I){if(W===this.#n){this.push(I);return}if(W<0||W>this.#n)return;const x=this.#t[W],Q=this.#t[W+1],U=I.length;if(Q-x===U){for(let L=0;L<U;L++)this.#e[x+L]=I[L]|0;return}this.#o(W,I)}compact(W,I,x){const Q=this.#e,U=this.#t,L=this.#n,q=new Int32Array(Math.max(1,this.#r)),M=new Uint32Array(I+1);let O=0;for(let k=0;k<L;k++){if(W[k]===x)continue;const b=U[k],a=U[k+1];M[W[k]]=O;for(let g=b;g<a;g++)q[O++]=Q[g];M[W[k]+1]=O}this.#e=q,this.#t=M,this.#n=I,this.#r=O}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#i(W){if(W+1<=this.#t.length)return;let I=this.#t.length-1;for(;I<W;)I=I*2||16;const x=new Uint32Array(I+1);x.set(this.#t),this.#t=x}#s(W){if(W<=this.#e.length)return;let I=this.#e.length;for(;I<W;)I=I*2||16;const x=new Int32Array(I);x.set(this.#e),this.#e=x}#o(W,I){const x=this.#e,Q=this.#t,U=this.#n,L=I.length-(Q[W+1]-Q[W]),q=new Int32Array(Math.max(1,this.#r+L)),M=new Uint32Array(Q.length);let O=0;for(let k=0;k<U;k++){if(M[k]=O,k===W)for(let b=0;b<I.length;b++)q[O++]=I[b]|0;else for(let b=Q[k];b<Q[k+1];b++)q[O++]=x[b];M[k+1]=O}this.#e=q,this.#t=M,this.#r=O}}}),He("packages/core/src/compute/sort.js",function(e,F){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return u}}),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 H}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return T}});const ie=F("packages/core/src/compute/handle.js"),E=ie.bitReader,W=ie.dictRanks,I=ie.dictSize,x=ie.identity,Q=ie.isMissing,U=ie.presenceReader,L=ie.rowCount,q=ie.valueComparator,M=ie.valueReader,O=new Uint32Array(0),k=new ArrayBuffer(8),b=new Float64Array(k),a=new Uint32Array(k),g=(b[0]=-1,(a[1]&2147483648)!==0?1:0),o=g===1?0:1;function t(S,R){b[0]=S;let j=a[g],N=a[o];(j&2147483648)!==0?(j=~j>>>0,N=~N>>>0):j=(j^2147483648)>>>0,R[0]=N,R[1]=j}function r(S,R,j,N){if(N<2)return S;const $=new Uint32Array(256*8);for(let X=0;X<N;X++){const ne=R[X],re=j[X];$[ne&255]++,$[256+(ne>>>8&255)]++,$[512+(ne>>>16&255)]++,$[768+(ne>>>24&255)]++,$[1024+(re&255)]++,$[1280+(re>>>8&255)]++,$[1536+(re>>>16&255)]++,$[1792+(re>>>24&255)]++}let _=S,Y=R,Z=j,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,re=(X&3)<<3,ae=X>=4;let fe=!1;for(let Re=0;Re<256;Re++)if($[ne+Re]===N){fe=!0;break}if(fe)continue;let we=0;for(let Re=0;Re<256;Re++)z[Re]=we,we+=$[ne+Re];for(let Re=0;Re<N;Re++){const $e=Y[Re],be=Z[Re],se=(ae?be:$e)>>>re&255,de=z[se]++;J[de]=_[Re],D[de]=$e,te[de]=be}let ve=_;_=J,J=ve,ve=Y,Y=D,D=ve,ve=Z,Z=te,te=ve}return _}function s(S,R,j){if(j<2)return S;const N=new Uint32Array(256*4);for(let D=0;D<j;D++){const te=R[D];N[te&255]++,N[256+(te>>>8&255)]++,N[512+(te>>>16&255)]++,N[768+(te>>>24&255)]++}let $=S,_=R,Y=new Uint32Array(j),Z=new Uint32Array(j);const J=new Uint32Array(256);for(let D=0;D<4;D++){const te=D<<8,z=D<<3;let X=!1;for(let ae=0;ae<256;ae++)if(N[te+ae]===j){X=!0;break}if(X)continue;let ne=0;for(let ae=0;ae<256;ae++)J[ae]=ne,ne+=N[te+ae];for(let ae=0;ae<j;ae++){const fe=_[ae],we=J[fe>>>z&255]++;Y[we]=$[ae],Z[we]=fe}let re=$;$=Y,Y=re,re=_,_=Z,Z=re}return $}function i(S,R,j,N){const $=new Uint32Array(N+1);for(let Z=0;Z<j;Z++)$[R[Z]]++;let _=0;for(let Z=0;Z<=N;Z++){const J=$[Z];$[Z]=_,_+=J}const Y=new Uint32Array(j);for(let Z=0;Z<j;Z++)Y[$[R[Z]]++]=S[Z];return Y}function n(S,R,j,N){return j<2?S:N<=65536||N<=j*2?i(S,R,j,N):s(S,R,j)}function m(S,R){return S.length===R&&S.byteOffset===0?S:Uint32Array.prototype.slice.call(S,0,R)}function c(S,R,j=!1){const N=R||x(S.length),$=N.length;if($<2)return Uint32Array.from(N);const _=new Uint32Array($),Y=new Uint32Array($),Z=new Uint32Array($),J=new Uint32Array($),D=new Uint32Array(2);let te=0,z=0;for(let re=0;re<$;re++){const ae=N[re],fe=S[ae];if(Number.isNaN(fe)){J[z++]=ae;continue}t(fe,D),j?(Y[te]=~D[0]>>>0,Z[te]=~D[1]>>>0):(Y[te]=D[0],Z[te]=D[1]),_[te++]=ae}const X=r(_.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 l(S,R,j=!1){const N=R||x(S.length),$=N.length;if($<2)return Uint32Array.from(N);const _=Uint32Array.from(N),Y=new Uint32Array($);for(let Z=0;Z<$;Z++){const J=(S[_[Z]]^2147483648)>>>0;Y[Z]=j?~J>>>0:J}return m(s(_,Y,$),$)}function u(S,R,j={}){const N=R||x(L(S,j)),$=N.length;if($<2)return Uint32Array.from(N);const _=W(S.dict,j.locale),Y=S.values,Z=U(S),J=Math.max(I(S.dict),_.length),D=J,te=Uint32Array.from(N),z=new Uint32Array($),X=!!j.descending;for(let ne=0;ne<$;ne++){const re=te[ne];let ae=Z&&Z(re)===0?D:_[Y[re]];ae===void 0&&(ae=D),z[ne]=X?D-ae:ae}return m(n(te,z,$,J+1),$)}function f(S,R,j){const N=R.length;let $=Uint32Array.from(R);if(N<2)return $;let _=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;)_[ne++]=j(S[$[z]],S[$[X]])<=0?$[z++]:$[X++];for(;z<D;)_[ne++]=$[z++];for(;X<te;)_[ne++]=$[X++]}const Z=$;$=_,_=Z}return $}function p(S,R,j){const N=E(S.values),$=R.length,_=new Uint32Array($),Y=j?1:0;let Z=0;for(let J=0;J<$;J++)N(R[J])===Y&&(_[Z++]=R[J]);for(let J=0;J<$;J++)N(R[J])!==Y&&(_[Z++]=R[J]);return _}function y(S,R){const j=S.values,N=S.kind;if((N==="object"||N===void 0)&&(Array.isArray(j)||ArrayBuffer.isView(j))&&!S.presence)return j;const _=M(S),Y=new Array(L(S)||0);for(let Z=0;Z<R.length;Z++){const J=R[Z];Y[J]=_(J)}return Y}function h(S,R){for(let j=0;j<R.length;j++)if(typeof S[R[j]]!="string")return!1;return!0}function d(S,R,j,N,$){const _=S.length,Y=Uint32Array.from(S);if(_<2||N<1)return Y;const Z=new Uint32Array(_),J=N-1;for(let D=0;D<_;D++){const te=j[R[D]];Z[D]=$?J-te:te}return m(n(Y,Z,_,N),_)}function w(S,R,j){const N=q(j),$=new Array(R);for(let Y=0;Y<R;Y++)$[Y]=Y;$.sort((Y,Z)=>N(S[Y],S[Z])||Y-Z);const _=new Uint32Array(R);for(let Y=0;Y<R;Y++)_[$[Y]]=Y;return _}function v(S,R,j){const N=R.length,$=new Map,_=[],Y=new Uint32Array(N);for(let D=0;D<N;D++){const te=S[R[D]];let z=$.get(te);z===void 0&&(z=_.length,$.set(te,z),_.push(te)),Y[D]=z}const Z=_.length,J=w(_,Z,j.locale);return d(R,Y,J,Z,!!j.descending)}function P(S,R,j){const N=y(S,R);if(R.length>=2&&h(N,R)){const Y=S.stringRank;return Y&&Y.version===S.version&&Y.usable(R,N,j.locale)?Y.sort(R,j):v(N,R,j)}const $=q(j.locale),_=j.descending?(Y,Z)=>$(Z,Y):$;return f(N,R,_)}function G(S,R,j){const N=y(S,R),$=j.compare,Y=!!j.descending?(Z,J)=>-$(Z,J,void 0,void 0,!0):(Z,J)=>$(Z,J,void 0,void 0,!1);return f(N,R,Y)}function V(S,R){const j=R.length,N=U(S),$=S.values,_=S.kind==="float64"&&!!$,Y=S.kind==="object"||S.kind==="multi"||S.kind===void 0;if(!N&&!_&&!Y)return{present:R,absent:O};const Z=new Uint32Array(j),J=new Uint32Array(j);let D=0,te=0;if(N&&_)for(let z=0;z<j;z++){const X=R[z];N(X)===1&&!Number.isNaN($[X])?Z[D++]=X:J[te++]=X}else if(_&&!N)for(let z=0;z<j;z++){const X=R[z];Number.isNaN($[X])?J[te++]=X:Z[D++]=X}else if(N&&!Y)for(let z=0;z<j;z++){const X=R[z];N(X)===1?Z[D++]=X:J[te++]=X}else{const z=M(S);for(let X=0;X<j;X++){const ne=R[X];Q(z(ne))?J[te++]=ne:Z[D++]=ne}}return te===0?{present:R,absent:O}:{present:Z.subarray(0,D),absent:J.subarray(0,te)}}function K(S,R,j){if(R.length===0)return S;const N=new Uint32Array(S.length+R.length);return j?(N.set(R,0),N.set(S,R.length)):(N.set(S,0),N.set(R,S.length)),N}function H(S,R,j={}){const N=R||x(L(S,j));if(!S||N.length<2)return Uint32Array.from(N);const{present:$,absent:_}=V(S,N);if($.length===0)return Uint32Array.from(N);const Y=!!j.descending;let Z;if(typeof j.compare=="function")Z=G(S,$,j);else switch(S.kind){case"float64":Z=c(S.values,$,Y);break;case"int32":Z=l(S.values,$,Y);break;case"dictionary":Z=u(S,$,j);break;case"bitset":Z=p(S,$,Y);break;default:Z=P(S,$,j);break}return K(Z,_,!!j.nullsFirst)}function T(S,R,j,N={}){const $=R||[],_=$.length&&($[0].handle||A(S,$[0].col))||S&&S[0];let Y=j||x(L(_,N));for(let Z=$.length-1;Z>=0;Z--){const J=$[Z],D=J.handle||A(S,J.col)||S&&S[Z];D&&(Y=H(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 A(S,R){if(!(!S||R===void 0)){for(let j=0;j<S.length;j++)if(S[j]&&S[j].id===R)return S[j]}}}),He("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 x}});const ie=F("packages/core/src/compute/sort.js"),E=ie.collateStringRanks,W=ie.rankSortStrings,I=1e5;class x{#e=[];#t=new Map;#n;#r=0;#i=0;#s=-1;#o;#l=!1;#a=null;#c=-1;#u="\0";constructor(U=I){this.#o=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 L=this.#e;for(let q=0;q<L.length;q++)U+=L[q].length*2+24;return U}#f(U,L){const q=this.#t.get(U);if(q!==void 0)return q;if(this.#l)return-1;if(L&&this.#e.length>=this.#o)return this.#l=!0,-1;const M=this.#e.length;return this.#e.push(U),this.#t.set(U,M),this.#i++,M}build(U,L){const q=L|0;this.#e=[],this.#t=new Map,this.#i=0,this.#l=!1,this.#a=null,this.#c=-1,this.#n=new Uint32Array(q);for(let M=0;M<q;M++){const O=U[M],k=typeof O=="string"?this.#f(O,!1):-1;this.#n[M]=k<0?0:k}this.#r=q}append(U,L,q){const M=(L|0)+(q|0);if(M>this.#n.length){const O=new Uint32Array(M);O.set(this.#n.subarray(0,this.#r)),this.#n=O}for(let O=L|0;O<M;O++){const k=U[O],b=typeof k=="string"?this.#f(k,!0):-1;this.#n[O]=b<0?0:b}this.#r=Math.max(this.#r,M)}ranks(U){const L=U||"";if(this.#a&&this.#c===this.#i&&this.#u===L)return this.#a;const q=E(this.#e,this.#e.length,U);return this.#a=q,this.#c=this.#i,this.#u=L,q}usable(U,L,q){if(this.#l||this.#e.length===0)return!1;const M=this.#n,O=this.#e,k=this.#r;for(let b=0;b<U.length;b++){const a=U[b];if(a>=k||O[M[a]]!==L[a])return!1}return!0}sort(U,L){const q=this.ranks(L.locale),M=this.#e.length,O=U.length,k=new Uint32Array(O),b=this.#n;for(let a=0;a<O;a++)k[a]=b[U[a]];return W(U,k,q,M,!!L.descending)}}}),He("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,L=F("packages/core/src/store/bitset.js").Bitset,M=F("packages/core/src/store/dictionary.js").Dictionary,k=F("packages/core/src/store/multivalue.js").MultiValue,a=F("packages/core/src/store/stringrank.js").StringRankIndex,g=4294967295,o=1024,t=5e3,r=.2,s=new Set(["float64","int32","bitset","dictionary","object","multi"]);function i(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 c(y){return i(y)?[]:Array.isArray(y)?y:[y]}function l(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 u(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 G=d;G<w;G++)P[G-d]=v[y.values[G]];return P}default:return y.values[h]}}class f{#e;#t;#n;#r;#i;#s;#o;#l=!1;#a=null;#c=null;#u=null;#f=null;#d=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#O=null;#w=null;#A=!1;constructor(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.#o=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.#a:this.#T().values}get presence(){return this.#A||!this.#r?null:this.#l?this.#g:this.#T().presence}get dict(){return this.#A||!this.#l?null:this.#t==="dictionary"||this.#t==="multi"?this.#f:null}get stringRank(){if(this.#A||!this.#h||this.kind!=="object")return null;const 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 a(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.#a&&(h+=this.#a.byteLength??this.#a.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.#a[h];case"bitset":return this.#c.get(h)===1;case"dictionary":return this.#f.valueOf(this.#a[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.#a[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,G=this.#g;let V=!1;switch(this.#t){case"float64":{const K=this.#a;for(let H=0;H<w;H++){const T=v(h[H]);if(typeof T=="number"){P&&G.set(d+H),K[d+H]=T;continue}const A=T==null;P?G.assign(d+H,!A):A&&(V=!0),K[d+H]=A?NaN:n(T)}break}case"int32":{const K=this.#a;for(let H=0;H<w;H++){const T=v(h[H]),A=T==null;P?G.assign(d+H,!A):A&&(V=!0),K[d+H]=A?0:m(T)}break}case"bitset":{const K=this.#c;for(let H=0;H<w;H++){const T=v(h[H]),A=T==null;P?G.assign(d+H,!A):A&&(V=!0),K.assign(d+H,!A&&!!T)}break}case"dictionary":{const K=this.#a,H=this.#f;for(let T=0;T<w;T++){const A=v(h[T]),S=A==null;P?G.assign(d+T,!S):S&&(V=!0),K[d+T]=S?0:H.codeOf(A)}break}case"multi":{const K=this.#u,H=this.#f;for(let T=0;T<w;T++){const A=v(h[T]),S=A==null;P?G.assign(d+T,!S):S&&(V=!0);const R=c(A),j=new Array(R.length);for(let N=0;N<R.length;N++)j[N]=H.codeOf(R[N]);K.write(d+T,j)}break}default:{const K=this.#a;for(let H=0;H<w;H++){const T=v(h[H]),A=T==null;P?G.assign(d+H,!A):A&&(V=!0),K[d+H]=A?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.#a,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 G=h.kind===this.#t;if(G&&(this.#t==="float64"||this.#t==="int32")){this.#a.set(h.values,d),this.#y++;return}if(G&&this.#t==="bitset"){const V=h.values;for(let K=0;K<w;K++)this.#c.assign(d+K,(V[K>>3]&1<<(K&7))!==0);this.#y++;return}if(G&&this.#t==="dictionary"){const V=h.table||[],K=new Uint32Array(V.length);for(let S=0;S<V.length;S++)K[S]=this.#f.codeOf(V[S]);const H=h.values,T=this.#a,A=v;for(let S=0;S<w;S++){if(A&&(P&&(P[S>>3]&1<<(S&7))===0)){T[d+S]=0;continue}T[d+S]=K[H[S]]??0}this.#y++;return}if(G&&this.#t==="multi"){const V=h.table||[],K=new Uint32Array(V.length);for(let A=0;A<V.length;A++)K[A]=this.#f.codeOf(V[A]);const H=h.values,T=h.offsets;for(let A=0;A<w;A++){const S=T[A],R=T[A+1],j=new Array(R-S);for(let N=S;N<R;N++)j[N-S]=K[H[N]]??0;this.#u.write(d+A,j)}this.#y++;return}for(let V=0;V<w;V++){const K=P?(P[V>>3]&1<<(V&7))===0:h.kind==="object"?h.values[V]===null:!1;this.#C(d+V,K?null:u(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.#a.constructor(h);d.set(this.#a),this.#a=d;break}case"bitset":this.#c.grow(h);break;case"multi":break;default:this.#a.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.#a,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 G=v!==null&&v.get(P)===0;G&&h!=="multi"||this.#C(P,G?null:l(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[G,V]of v)h[G]!==g&&P.set(h[G],V);this.#O=P}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const v=this.#a;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.#a=null,this.#c&&this.#c.release(),this.#c=null,this.#u&&this.#u.release(),this.#u=null,this.#g&&this.#g.release(),this.#g=null,this.#f=null,this.#d=null,this.#O=new Map,this.#w=null,this.#b=0,this.#y++)}#S(h){const d=Math.max(1,h);switch(this.#a=null,this.#c=null,this.#u=null,this.#t){case"float64":this.#a=new Float64Array(d);break;case"int32":this.#a=new Int32Array(d);break;case"bitset":this.#c=new L(d);break;case"dictionary":this.#a=new Uint32Array(d),this.#f=this.#f??new M(this.#o??[]);break;case"multi":this.#u=new k({rows:d,values:d}),this.#f=this.#f??new M(this.#o??[]);break;default:this.#a=new Array(d);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#f=null),this.#r&&(this.#g?this.#g.grow(d):this.#g=new L(d)),this.#b=d}#C(h,d){const w=i(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.#a[h]=w?NaN:n(d);break;case"int32":this.#a[h]=w?0:m(d);break;case"bitset":this.#c.assign(h,!w&&!!d);break;case"dictionary":this.#a[h]=w?0:this.#f.codeOf(d);break;case"multi":{const v=c(d),P=new Array(v.length);for(let G=0;G<v.length;G++)P[G]=this.#f.codeOf(v[G]);this.#u.write(h,P);break}default:this.#a[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 L(h):null;for(let v=0;v<h;v++){const P=this.#E(v);d[v]=P,w&&!i(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;#o=0;#l=0;#a=new L(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??r;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.#o}get physical(){return this.#i}get capacity(){return this.#c?this.#s:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let h=this.#a.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.#o+=w,this.#a.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 G=0;G<v;G++)this.#r[w+G]=d[G];this.#i=w+v,this.#o+=v,this.#a.grow(this.#i),this.#c||this.#b(),this.#m(this.#i);const P=new Map;for(const G of h.columns)P.set(G.id,G);for(const G of this.#n){const V=P.get(G.id);V?G.appendPacked(V,w,v):G.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.#a.get(h)===1?!1:(this.#a.set(h),this.#l++,this.#o--,!0)}live(h){return h<0||h>=this.#i?!1:this.#a.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.#a.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 G=0;G<d;G++)w[G]!==g&&(P[w[G]]=P[G]);P.length=v}return this.#i=v,this.#o=v,this.#l=0,this.#a=new L(Math.max(this.#s,v)),w}column(h){return this.#t.get(h)}columns(){return this.#n.slice()}liveIndices(){const h=new Uint32Array(this.#o);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.#a.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.#a.release(),this.#i=0,this.#o=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.#a.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.#a.grow(h);for(const d of this.#n)d.columnarise(h,this.#i)}}}),He("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 x}});const ie=64,E=8;function W(U){let L=ie;for(;L<U;)L*=2;return L}class I{#e=new Map;#t=new WeakSet;#n;#r=0;#i={acquired:0,reused:0,released:0};constructor(L={}){this.#n=L.limit??E}get bytes(){return this.#r}mask(L){const q=new Uint8Array(this.#s(L),0,L);return q.fill(0),q}indices(L){return new Uint32Array(this.#s(L*4),0,L)}release(L){if(!L||!L.buffer)return!1;const q=L.buffer;if(!this.#t.has(q))return!1;this.#t.delete(q),this.#i.released++;const M=q.byteLength;let O=this.#e.get(M);return O||this.#e.set(M,O=[]),O.length>=this.#n||(O.push(q),this.#r+=M),!0}releaseAll(L){for(const q of L)this.release(q)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#i,retained:this.#r}}#s(L){const q=W(L),M=this.#e.get(q);this.#i.acquired++;let O;return M&&M.length?(O=M.pop(),this.#r-=q,this.#i.reused++):O=new ArrayBuffer(q),this.#t.add(O),O}}function x(){return Q??=new I,Q}let Q=null}),He("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 W}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return x}});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 W(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 L=Q.col!==void 0?Q.col:Q.handle&&Q.handle.id,q=Q.locale!==void 0?Q.locale:U;return{col:L,descending:Q.descending!==void 0?!!Q.descending:Q.dir==="desc",nullsFirst:!!Q.nullsFirst,collation:ie(q)}}function x(Q,U){const L=Q||[],q=new Array(L.length);for(let M=0;M<L.length;M++)q[M]=I(L[M],U);return q}}),He("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 L}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return O}}),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 a}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return r}}),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,W=ie.valueReader,I=ie.dictSize,x=ie.dictValue,Q=Object.freeze(["equal","quantile","log"]),U=Object.freeze(["hour","day","week","month","quarter","year"]),L=20,q=50,M=1e4;function O(v,P){if(!v)return"none";const G=P;if(G&&(G.multi===!0||typeof G.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,G=v.kind;if((G==="float64"||G==="int32")&&P)return K=>P[K];const V=W(v);return K=>b(V(K))}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 G=Date.parse(v);return Number.isFinite(G)?G:NaN}return NaN}function a(v,P,G,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 K=W(v),H=P?P.length:G,T=new Set;for(let A=0;A<H;A++){const S=K(P?P[A]:A);if(S!=null&&(T.add(S),T.size>V))return{cardinality:T.size,exact:!1}}return{cardinality:T.size,exact:!0}}const g=36e5,o=864e5;function t(v,P=L){const G=Number.isFinite(v)&&v>0?v:0,V=Math.max(1,P)*2;return G/g<=V?"hour":G/o<=V?"day":G/(7*o)<=V?"week":G/(30*o)<=V?"month":G/(91*o)<=V?"quarter":"year"}function r(v,P){if(!Number.isFinite(v))return NaN;const G=new Date(v);switch(P){case"hour":return G.setMinutes(0,0,0),G.getTime();case"day":return G.setHours(0,0,0,0),G.getTime();case"week":{G.setHours(0,0,0,0);const V=(G.getDay()+6)%7;return G.setDate(G.getDate()-V),G.getTime()}case"month":return G.setDate(1),G.setHours(0,0,0,0),G.getTime();case"quarter":return G.setMonth(Math.floor(G.getMonth()/3)*3,1),G.setHours(0,0,0,0),G.getTime();default:return G.setMonth(0,1),G.setHours(0,0,0,0),G.getTime()}}function s(v,P){const G=new Date(v);switch(P){case"hour":G.setHours(G.getHours()+1);break;case"day":G.setDate(G.getDate()+1);break;case"week":G.setDate(G.getDate()+7);break;case"month":G.setMonth(G.getMonth()+1);break;case"quarter":G.setMonth(G.getMonth()+3);break;default:G.setFullYear(G.getFullYear()+1);break}return G.getTime()}function i(v,P,G){const V=k(v),K=E(v),H=P?P.length:G;let T=1/0,A=-1/0,S=0,R=0;for(let j=0;j<H;j++){const N=P?P[j]:j;if(K&&!K(N)){S++;continue}const $=V(N);if(!Number.isFinite($)){S++;continue}$<T&&(T=$),$>A&&(A=$),R++}return{min:T,max:A,nulls:S,finite:R}}function n(v,P,G,V){const K=k(v),H=E(v),T=P?P.length:G,A=T>V?T/V:1,S=[];for(let j=0;j<T;j+=A){const N=P?P[Math.floor(j)]:Math.floor(j);if(H&&!H(N))continue;const $=K(N);Number.isFinite($)&&S.push($)}const R=Float64Array.from(S);return R.sort(),R}function m(v,P,G,V={}){const K=V.kind||O(v,V.type);return K==="none"||!v?{kind:"none",buckets:[],suppressed:"type"}:K==="boolean"?c(v,P,G,V):K==="category"?l(v,P,G,V):f(v,P,G,K,V)}function c(v,P,G,V={}){const K=E(v);let H=0;if(K){const A=P?P.length:G;for(let S=0;S<A;S++)K(P?P[S]:S)||H++}const T=[{value:!1,label:"false"},{value:!0,label:"true"}];return H>0&&V.blanks!==!1&&T.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:T}}function l(v,P,G,V){const K=V.cardinalityLimit??q,{cardinality:H}=a(v,P,G,K);if(H>K&&(V.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:H};const T=W(v),A=P?P.length:G,S=new Map;let R=0;for(let Y=0;Y<A;Y++){const Z=T(P?P[Y]:Y);if(Z==null||Z===""){R++;continue}if(Array.isArray(Z)){if(!Z.length){R++;continue}for(const J of Z)S.set(J,(S.get(J)||0)+1);continue}S.set(Z,(S.get(Z)||0)+1)}let j=[...S.entries()];V.order==="alpha"?j.sort((Y,Z)=>String(Y[0]).localeCompare(String(Z[0]))):j.sort((Y,Z)=>Z[1]-Y[1]);let N=0,$=0;if(j.length>K){$=j.length-K;for(let Y=K;Y<j.length;Y++)N+=j[Y][1];j=j.slice(0,K)}const _=j.map(([Y])=>({value:Y,label:String(Y)}));return N>0&&_.push({remainder:!0,label:`Other (${$} values)`}),R>0&&V.blanks!==!1&&_.push({null:!0,label:"Empty"}),{kind:"category",buckets:_,cardinality:H}}function u(v,P,G,V,K){const H=n(v,P,G,M),T=H.length;if(T<100)return null;const A=H[Math.floor(.01*T)],S=H[Math.ceil(.99*T)-1];return!(S>A)||K-V<=2*(S-A)?null:{lo:A,hi:S}}function f(v,P,G,V,K){const{min:H,max:T,nulls:A,finite:S}=i(v,P,G);if(!S)return{kind:V,buckets:A&&K.blanks!==!1?[{null:!0,label:"Empty"}]:[],empty:!0};const R=Math.max(1,Math.floor(K.buckets||L));let j=[];if(V==="date"){const $=U.includes(K.granularity)?K.granularity:t(T-H,R);let _=r(H,$);for(;_<=T&&j.length<4096;){const Y=s(_,$);if(!(Y>_))break;j.push({from:_,to:Y}),_=Y}return{kind:V,buckets:p(j,K.blanks===!1?0:A),granularity:$}}const N=Q.includes(K.strategy)?K.strategy:"equal";if(N==="quantile"){const $=n(v,P,G,M);if($.length){const _=[$[0]];for(let Y=1;Y<R;Y++){const Z=$[Math.min($.length-1,Math.floor(Y/R*$.length))];Z>_[_.length-1]&&_.push(Z)}_.push(T);for(let Y=0;Y<_.length-1;Y++)j.push({from:_[Y],to:_[Y+1]})}}else if(N==="log"&&H>0){const $=Math.log10(H),Y=(Math.log10(T)-$)/R||1;for(let Z=0;Z<R;Z++)j.push({from:10**($+Z*Y),to:10**($+(Z+1)*Y)})}if(!j.length&&N==="equal"){const $=u(v,P,G,H,T);if($){const _=($.hi-$.lo)/R;$.lo>H&&j.push({from:H,to:$.lo,overflow:"low"});for(let Y=0;Y<R;Y++)j.push({from:$.lo+Y*_,to:$.lo+(Y+1)*_});j[j.length-1].to=$.hi,$.hi<T&&j.push({from:$.hi,to:T,overflow:"high"})}}if(!j.length){const $=(T-H)/R||1;for(let _=0;_<R;_++)j.push({from:H+_*$,to:H+(_+1)*$})}return j[j.length-1].to=T,{kind:V,buckets:p(j,K.blanks===!1?0:A),strategy:N,min:H,max:T}}function p(v,P){return P>0?[...v,{null:!0,label:"Empty"}]:v}function y(v,P,G,V,K){const H=V&&V.buckets||[],T=K&&K.length>=H.length?K.subarray(0,H.length):new Uint32Array(H.length);if(T.fill(0),!v||!H.length)return T;const A=H.length-1,S=!!H[A]&&H[A].null===!0,R=P?P.length:G;if(V.kind==="boolean"){const Y=W(v);for(let Z=0;Z<R;Z++){const J=Y(P?P[Z]:Z);if(J==null){S&&T[A]++;continue}T[J?1:0]++}return T}if(V.kind==="category"){const Y=new Map;for(let D=0;D<H.length;D++)!H[D].null&&!H[D].remainder&&Y.set(H[D].value,D);const Z=H.findIndex(D=>D.remainder),J=W(v);for(let D=0;D<R;D++){const te=J(P?P[D]:D);if(te==null||te===""){S&&T[A]++;continue}if(Array.isArray(te)){if(!te.length){S&&T[A]++;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 j=S?H.length-1:H.length,N=new Float64Array(j+1);for(let Y=0;Y<j;Y++)N[Y]=H[Y].from;N[j]=j?H[j-1].to:0;const $=k(v),_=E(v);for(let Y=0;Y<R;Y++){const Z=P?P[Y]:Y;if(_&&!_(Z)){S&&T[A]++;continue}const J=$(Z);if(!Number.isFinite(J)){S&&T[A]++;continue}const D=h(N,j,J);D>=0&&T[D]++}return T}function h(v,P,G){if(!P||G<v[0])return-1;if(G>=v[P])return G===v[P]?P-1:-1;let V=0,K=P-1;for(;V<K;){const H=V+K+1>>>1;G>=v[H]?V=H:K=H-1}return V}function d(v,P,G,V={}){const K=V.bounds||m(v,V.boundsIndices??P,G,V);return{bounds:K,counts:y(v,P,G,K)}}const w=d}),He("packages/core/src/compute/pivotmatrix.js",function(e,F){"use strict";Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return O}}),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 r}});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"),L=U.joinPath,q=U.DEFAULT_PATH_SEPARATOR,M=U.DEFAULT_MAX_COLUMNS,O="";function k(s,i,n={}){const m=n.separator||q,c=s||[],l=i instanceof Uint32Array?i:Uint32Array.from(i||[]),u=l.length;if(c.length===0)return{tuples:[[]],paths:[O],buckets:[l]};const{keyOf:f,readers:p}=Q(c,l,0),y=new Map,h=[],d=[],w=[];for(let H=0;H<u;H++){const T=l[H],A=f(T);let S=y.get(A);if(S===void 0){S=h.length,y.set(A,S),d.push(A);const R=new Array(p.length);for(let j=0;j<p.length;j++)R[j]=p[j](T);h.push(R),w.push([])}w[S].push(T)}const v=E(n.locale),P=h.map((H,T)=>T);P.sort((H,T)=>{const A=h[H],S=h[T];for(let R=0;R<A.length;R++){const j=b(A[R],S[R],v);if(j!==0)return j}return H-T});const G=new Array(P.length),V=new Array(P.length),K=new Array(P.length);for(let H=0;H<P.length;H++){const T=P[H];G[H]=h[T],V[H]=L(h[T],m),K[H]=Uint32Array.from(w[T])}return{tuples:G,paths:V,buckets:K}}function b(s,i,n){const m=s==null,c=i==null;return m||c?m&&c?0:m?1:-1:n(s,i)}function a(s,i,n){const m=[];for(let c=0;c<s.length;c++)n.has(s[c])&&m.push(s[c]);return Uint32Array.from(m)}function g(s,i,n,m){return{value:i.length?I(s,i,n,m):null,leaves:i,count:i.length}}function o(s){const i=s&&s.opts||{},n=i.separator||q,m=i.totalContext||{locale:i.locale},c=(s.measures||[]).filter(V=>V&&V.handle),l=s.leaves instanceof Uint32Array?s.leaves:Uint32Array.from(s.leaves||[]),u=k(s.rowHandles||[],l,{...i,separator:n}),f=k(s.columnHandles||[],l,{...i,separator:n}),p=i.maxColumns===void 0?M:i.maxColumns,y=f.paths.length*Math.max(1,c.length),h=new Map;if(p&&y>p)return{rowAxis:u,columnAxis:f,measures:c.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,G=f.buckets.map(V=>new Set(V));for(let V=0;V<f.paths.length;V++){const K=f.buckets[V],H=f.paths[V];for(const T of c)v.set(r(H,T.colId),g(T.handle,K,T.fn,m))}for(let V=0;V<u.paths.length;V++){const K=u.buckets[V],H=u.paths[V];for(const T of c)w.set(r(H,T.colId),g(T.handle,K,T.fn,m));for(let T=0;T<f.paths.length;T++){const A=a(K,f.buckets[T],G[T]);if(A.length===0)continue;const S=f.paths[T];for(const R of c)d.set(t(H,S,R.colId),g(R.handle,A,R.fn,m))}}for(const V of c)P.set(V.colId,g(V.handle,l,V.fn,m));return{rowAxis:u,columnAxis:f,measures:c.map(V=>({colId:V.colId,fn:V.fn})),body:d,rowMargin:w,columnMargin:v,grand:P,columns:y,error:null}}function t(s,i,n){return`${s}\0${i}\0${n}`}function r(s,i){return`${s}\0${i}`}}),He("packages/core/src/compute/reference.js",function(e,F){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return a}}),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,W=F("packages/core/src/compute/handle.js"),I=W.isMissing,x=W.valueComparator,U=F("packages/core/src/compute/filter.js").testValue,L="",q="\0";function M(s,i){const n=i.includes(".")?E(s,i):s?.[i];return n===void 0?null:n}function O(s,i,n={}){const m=i||[];let c=s.map((l,u)=>u);if(m.length===0)return c;for(let l=m.length-1;l>=0;l--)c=k(s,c,m[l],n);return c}function k(s,i,n,m){const c=n.locale!==void 0?n.locale:m.locale,l=x(c),u=n.descending!==void 0?!!n.descending:n.dir==="desc",f=[],p=[];for(const d of i){const w=M(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=M(s[d],n.col),P=M(s[w],n.col);let G;return typeof n.compare=="function"?(G=n.compare(v,P,s[d],s[w],u),u&&(G=-G)):G=u?l(P,v):l(v,P),G!==0?G:y.get(d)-y.get(w)};return f.sort(h),n.nullsFirst?p.concat(f):f.concat(p)}function b(s,i,n={}){const m=[];for(let c=0;c<s.length;c++)a(s[c],i,n,c)&&m.push(c);return m}function a(s,i,n,m){if(!i)return!0;if(Array.isArray(i.conditions)){const c=i.conditions.filter(u=>u!=null);if(c.length===0)return!0;if(i.op==="or")return c.some(u=>a(s,u,n,m));const l=c.every(u=>a(s,u,n,m));return i.op==="not"?!l:l}return i.col===void 0&&typeof n.custom=="function"?!!n.custom(i,s,m):U(M(s,i.col),i,n.locale)}function g(s,i,n,m){const c=n||s.map((p,y)=>y),l=new Map,u=[],f=[];for(const p of c){const y=i.map((w,v)=>{const P=M(s[p],w);return m&&m[v]?m[v](P):P}),h=y.map(w=>w==null?q:String(w)).join(L);let d=l.get(h);d===void 0&&(d=u.length,l.set(h,d),u.push(y),f.push([])),f[d].push(p)}return{keys:u,buckets:f}}function o(s,i,n={}){const m=x(n.locale),c=s.filter(u=>!I(u)),l=c.map(t).filter(u=>u!==null);switch(i){case"count":return s.length;case"countValues":return c.length;case"sum":return l.reduce((u,f)=>u+f,0);case"avg":return c.length===0?null:l.reduce((u,f)=>u+f,0)/c.length;case"min":return c.length===0?null:c.reduce((u,f)=>m(f,u)<0?f:u);case"max":return c.length===0?null:c.reduce((u,f)=>m(f,u)>0?f:u);case"first":return s.length===0?null:r(s[0]);case"last":return s.length===0?null:r(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 i=Number(s);return Number.isNaN(i)?null:i}function r(s){return s===void 0?null:s}}),He("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 W=F("packages/core/src/compute/filter.js");Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return W.evaluateFilters}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return W.evaluateCondition}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return W.compact}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return W.testValue}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return W.compilePredicate}}),Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return W.releaseMask}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return W.pruneColumn}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return W.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 x=F("packages/core/src/compute/facet.js");Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return x.facet}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return x.computeBounds}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return x.countInto}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return x.bucketOf}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return x.facetKind}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return x.cardinalityOf}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return x.pickGranularity}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return x.floorTo}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return x.advance}}),Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return x.STRATEGIES}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return x.GRANULARITIES}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return x.DEFAULT_BUCKETS}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return x.DEFAULT_CARDINALITY_LIMIT}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return x.QUANTILE_SAMPLE}});const Q=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 L=F("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return L.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return L.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return L.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return L.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return L.GRAND_PATH}});const 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 M=F("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return M.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return M.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return M.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return M.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return M.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return M.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return M.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return M.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return M.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return M.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return M.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return M.isMissing}});const O=F("packages/core/src/compute/sketch.js");Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return O.Welford}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return O.Reservoir}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return O.HyperLogLog}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return O.SpaceSaving}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return O.KLL}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return O.hash32}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return O.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 a=F("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return a.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return a.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return a.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return a.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return a.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return a.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return a.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}})}),He("packages/core/src/source/rows.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_ROW_HEIGHT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"KEY_SEP",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return a}}),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,x=32,Q="\0";function U(o){return new L(o)}class L{#e;#t;constructor(t){this.#e=I(t&&t.rowKey)?t.rowKey:null;const r=t&&t.config?t.config.rowHeight:void 0;this.#t=typeof r=="number"||I(r)?r:x}get keyed(){return this.#e!==null}keyOf(t,r){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`#${r}`}heightOf(t){return I(this.#t)?Number(this.#t(t))||x:this.#t}leaf(t,r,s=0,i=null){const n={key:this.keyOf(t,r),data:t,level:s,parent:i,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:r};return n.height=this.heightOf(n),n}group(t){const r={key:a(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&&(r.totals=t.totals),r.height=this.heightOf(r),r}footer(t){const r={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 r.height=this.heightOf(r),r}detail(t,r){return{key:`${t.key}${Q}detail`,data:t.data,level:t.level+1,parent:t,group:!1,detail:!0,expanded:!1,leafCount:0,height:r,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:t.key}}grandTotal(t,r){const s={key:`${Q}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:r,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:t};return s.height=this.heightOf(s),s}skeleton(t,r=0,s=!1){const i={key:`${Q}pending${Q}${t}`,data:null,level:r,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:t,selected:!1,physical:null,pending:!0};return s&&(i.loadError=!0),i.height=this.heightOf(i),i}}function q(o,t,r,s){return{key:`${Q}pinned${Q}${r}${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:r}}function M(o,t){return new Proxy([],{get(r,s,i){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(r,s,i)},has(r,s){if(typeof s=="string"){const i=Number(s);if(Number.isInteger(i)&&i>=0)return i<o()}return Reflect.has(r,s)}})}function O(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 a(o){const t=o||[];let r="g";for(let s=0;s<t.length;s++)r+=Q+b(t[s]);return r}function g(o){const t=new Array(o.length),r=[];for(let s=0;s<o.length;s++)r.push(o[s]),t[s]=a(r);return t}}),He("packages/core/src/source/handles.js",function(e,F){"use strict";Object.defineProperty(e,"HandleProvider",{enumerable:!0,get:function(){return x}}),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 x{#e;#t;#n;#r=new Map;#i=0;constructor(L,q,M){this.#e=L,this.#t=q,this.#n=E(M)?M:()=>!1}get store(){const L=this.#e.store;return L&&E(L.column)?L:null}invalidate(){this.#i++}handle(L){const q=this.store;if(q){const b=q.column(L);if(b)return b}const M=this.#r.get(L);if(M&&M.builtAt===this.#i)return M.handle;const O=this.#s(L);if(!O)return;if(q&&this.#n()){I(`source.dropped.${L}`,`column "${L}" cannot be served under ingest.dropSourceRows: it is an impure computed column (a shadow or a positional/rank column) that is never stored, so it can only be read from the caller's row objects — which dropSourceRows has released. Do not sort, filter, group or total on such a column with dropSourceRows enabled.`);return}const k=this.#o(O);return this.#r.set(L,{handle:k,builtAt:this.#i}),k}#s(L){const q=this.#e.columns;return q&&E(q.get)?q.get(L):void 0}#o(L){const q=this.#t()||[],M=q.length,O=new Array(M),k=E(L.getValue)?a=>L.getValue(a):a=>a?.[L.field||L.id];for(let a=0;a<M;a++)O[a]=q[a]===void 0?void 0:k(q[a]);const b=this.#i;return{id:L.id,kind:"object",nullable:!1,values:O,presence:null,dict:null,offsets:null,get(a){return O[a]},version:b}}}function Q(U,L,q){return new x(U,L,q)}}),He("packages/core/src/compute/incremental.js",function(e,F){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return q}});const E=F("packages/core/src/store/columnstore.js").toFloat,W=Object.freeze(["sum","avg","countValues","min","max"]),I=Object.freeze(["float64"]),x=1e15;function Q(M,O){return typeof M!="string"||!W.includes(M)?!1:!!O&&I.includes(O.kind)}function U(M){if(M==null)return null;const O=E(M);return Number.isNaN(O)?null:O}class L{#e;#t=0;#n=0;#r=0;#i=1/0;#s=-1/0;#o=!1;#l=!1;constructor(O){this.#e=O}get valid(){return this.#o&&!this.#l}get fn(){return this.#e}seed(O){this.#a();for(let k=0;k<O.length;k++){const b=U(O[k]);b!==null&&this.#c(b)}this.#o=!0}seedColumn(O,k,b){this.#a();for(let a=0;a<b.length;a++){const g=b[a];if(k&&k(g)===0)continue;const o=O[g];Number.isNaN(o)||this.#c(o)}this.#o=!0}#a(){this.#t=0,this.#n=0,this.#r=0,this.#i=1/0,this.#s=-1/0,this.#l=!1}#c(O){if(!Number.isFinite(O)){this.#l=!0;return}const k=this.#t+O;this.#n+=Math.abs(this.#t)>=Math.abs(O)?this.#t-k+O:O-k+this.#t,this.#t=k,this.#r++,O<this.#i&&(this.#i=O),O>this.#s&&(this.#s=O)}#u(O){const k=this.#t-O;this.#n+=Math.abs(this.#t)>=Math.abs(O)?this.#t-k-O:-O-k+this.#t,this.#t=k,this.#r--}update(O,k){if(!this.#o)return!1;const b=U(O),a=U(k);return b===null&&a===null?!0:b!==null&&!Number.isFinite(b)||a!==null&&!Number.isFinite(a)?!1:this.#e==="min"||this.#e==="max"?b===null||a===null?!1:this.#e==="min"?a<this.#i?(this.#i=a,!0):b>this.#i:a>this.#s?(this.#s=a,!0):b<this.#s:Math.abs(this.#t)>x?!1:(b!==null&&this.#u(b),a!==null&&this.#c(a),!0)}value(){switch(this.#e){case"countValues":return this.#r;case"avg":return this.#r?(this.#t+this.#n)/this.#r:null;case"min":return this.#r?this.#i:null;case"max":return this.#r?this.#s:null;default:return this.#t+this.#n}}invalidate(){this.#o=!1}}const q=L}),He("packages/core/src/source/filterwire.js",function(e,F){"use strict";Object.defineProperty(e,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"resolveRelativeRange",{enumerable:!0,get:function(){return i}}),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 c}}),Object.defineProperty(e,"resolveRelativeCondition",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return u}}),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,W="source.remote.hostFilter",I="source.where.pageRelative";function x(V,K){!Array.isArray(V)||!V.length||E(I,`filters.where (${V.join(", ")}) runs over the rows the ${K} 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 K=(V||{}).config;!K||!K.hostFilter||E(W,"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 L(V,K){E(`${U}:${V}`,`filters.where("${V}") is registered but the ${K} 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 M(V,K,H,T){!Array.isArray(V)||!V.length||E(`${q}:${K}`,`filters.where (${V.join(", ")}) is not applied to the ${K} pushdown source:`,H===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${H.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 O=new Map;function k(V){let K=O.get(V);return K||(K=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"}),O.set(V,K)),K}function b(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function a(V,K){const H=k(K).formatToParts(new Date(V)),T={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const A of H)A.type==="year"?T.y=+A.value:A.type==="month"?T.m=+A.value:A.type==="day"?T.d=+A.value:A.type==="hour"?T.h=+A.value%24:A.type==="minute"?T.mi=+A.value:A.type==="second"&&(T.s=+A.value);return T}function g(V,K){const H=a(V,K);return Date.UTC(H.y,H.m-1,H.d,H.h,H.mi,H.s)-Math.floor(V/1e3)*1e3}function o(V,K,H,T){const A=Date.UTC(V,K-1,H),S=A-g(A,T);return A-g(S,T)}function t(V,K,H){const T=new Date(Date.UTC(V.y,V.m-1,V.d+K));return o(T.getUTCFullYear(),T.getUTCMonth()+1,T.getUTCDate(),H)}const r=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function s(V,K){if(typeof V!="string")return null;const H=V.trim().toLowerCase().replace(/[\s_-]+/g,""),T=/^last(\d*|n)days?$/.exec(H);if(T){const A=T[1]==="n"?"":T[1],S=Number(A||K);return!Number.isFinite(S)||S<=0?null:{kind:"lastNDays",n:Math.floor(S)}}switch(H){case"today":return{kind:"today",n:0};case"yesterday":return{kind:"yesterday",n:0};case"thisweek":return{kind:"thisWeek",n:0};case"thismonth":return{kind:"thisMonth",n:0};case"thisquarter":return{kind:"thisQuarter",n:0};case"thisyear":return{kind:"thisYear",n:0};case"quartertodate":case"qtd":return{kind:"quarterToDate",n:0};case"yeartodate":case"ytd":return{kind:"yearToDate",n:0};default:return null}}function i(V,K={}){const H=s(V,K.n);if(!H)return null;const T=K.tz||b(),A=K.now instanceof Date?K.now.getTime():typeof K.now=="number"?K.now:Date.now(),S=a(A,T),R=o(S.y,S.m,S.d,T),j=t(S,1,T);let N=R,$=j;switch(H.kind){case"today":break;case"yesterday":N=t(S,-1,T),$=R;break;case"lastNDays":$=K.includeToday?j:R,N=t(S,K.includeToday?-(H.n-1):-H.n,T);break;case"thisWeek":{const _=Number.isFinite(K.weekStartsOn)?Number(K.weekStartsOn):1,Z=(new Date(Date.UTC(S.y,S.m-1,S.d)).getUTCDay()-_+7)%7;N=t(S,-Z,T),$=t(S,-Z+7,T);break}case"thisMonth":N=o(S.y,S.m,1,T),$=o(S.m===12?S.y+1:S.y,S.m===12?1:S.m+1,1,T);break;case"thisQuarter":case"quarterToDate":{const _=Math.floor((S.m-1)/3)*3+1;N=o(S.y,_,1,T),$=H.kind==="quarterToDate"?j:_===10?o(S.y+1,1,1,T):o(S.y,_+3,1,T);break}case"thisYear":case"yearToDate":N=o(S.y,1,1,T),$=H.kind==="yearToDate"?j:o(S.y+1,1,1,T);break;default:return null}return{from:new Date(N).toISOString(),to:new Date($).toISOString(),bounds:"[)",tz:T,relative:H.kind==="lastNDays"?`last${H.n}Days`:H.kind,n:H.n}}function n(V){if(!V||typeof V!="object")return null;const K=V.value;if(K&&typeof K=="object"&&!Array.isArray(K)&&"relative"in K)return{token:String(K.relative),n:typeof K.n=="number"?K.n:void 0};if(V.op==="relative"&&typeof V.value=="string")return{token:V.value,n:void 0};const H=V.meta;return H&&typeof H.relative=="string"&&V.value===void 0?{token:H.relative,n:typeof H.n=="number"?H.n:void 0}:null}function m(){return`Known tokens: ${r.filter(K=>K!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function c(V){const K=n(V);return K?s(K.token,K.n)!==null:!1}function l(V,K={}){const H=n(V);if(!H)return V;const T=i(H.token,{...K,n:H.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.${H.token}`,`unknown relative date token "${H.token}"; sending the condition unresolved.`,m()),V)}function u(V){return!!V&&typeof V=="object"&&Array.isArray(V.conditions)}function f(V,K){if(V){if(u(V)){for(const H of V.conditions)f(H,K);return}K(V)}}function p(V,K){if(!V)return null;if(!u(V))return K(V);const H=V;let T=!1;const A=[];for(const S of H.conditions){const R=p(S,K);R!==S&&(T=!0),R&&A.push(R)}return!T&&A.length===H.conditions.length?V:A.length?{...H,conditions:A}:null}function y(V){if(!V)return null;if(!u(V))return V;const K=V,H=[];for(const T of K.conditions){const A=y(T);A&&H.push(A)}return H.length?{op:K.op,conditions:H}:null}function h(V){const K=y(V);return K?u(K)&&K.op==="and"?K:{op:"and",conditions:[K]}:null}function d(V){const K=(V||[]).filter(Boolean);return K.length?{op:"and",conditions:K}:null}function w(V,K={}){const H=p(V,T=>l(T,K));return h(H)}function v(V){const K=P(V.filters??null);return JSON.stringify([K,V.sort??null,V.quick??"",V.groupBy??null,V.pivotBy??null,G(V.context)])}function P(V){if(!V)return null;if(u(V)){const T=V;return{op:T.op,conditions:T.conditions.map(P)}}const K=V,H=K.meta&&typeof K.meta.relative=="string"?K.meta.relative:n(K)?.token;return{col:K.col,op:K.op,bounds:K.bounds??null,caseSensitive:K.caseSensitive??!1,value:H?`rel:${H}`:K.value??null}}function G(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]"}}}),He("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 L}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"assignLevels",{enumerable:!0,get:function(){return O}}),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 a}});const E=F("packages/core/src/internal/predicates.js").isFunction,I=F("packages/core/src/internal/warn.js").warnOnce,x="",Q="\0tree:";function U(g,o){return{physical:g,key:o,level:0,children:[],value:void 0}}function L(g,o){const t=[],r=new Map;for(let s=0;s<g.length;s++){const i=g[s],n=o.pathOf(i),m=Array.isArray(n)?n.map(l=>String(l)):[];if(!m.length){const l=U(i,o.keyOf(i));t.push(l);continue}let c=null;for(let l=0;l<m.length;l++){const u=m.slice(0,l+1).join(x),f=l===m.length-1;let p=r.get(u);p&&f&&p.physical===-1&&(p.physical=i,p.key=o.keyOf(i)),p||(p=U(f?i:-1,f?o.keyOf(i):Q+u),p.level=l,p.value=m[l],r.set(u,p),c?c.children.push(p):t.push(p)),c=p}}return{roots:t,nodes:r}}function q(g,o){const t=new Map,r=[];for(let m=0;m<g.length;m++){const c=g[m],l=o.keyOf(c),u=U(c,l);t.set(l,u);const f=o.parentOf(c);f!=null&&f!==""&&r.push({node:u,parent:String(f)})}let s=null;const i=new Map;for(const{node:m,parent:c}of r){const l=t.get(c);if(l){i.set(m.key,l);continue}o.orphans&&o.orphans!=="root"&&(s||(s=U(-1,`${Q}orphans`),s.value=o.orphans),i.set(m.key,s))}const n=[];for(const m of t.values()){const c=i.get(m.key);c?c.children.push(m):n.push(m)}return s&&s.children.length&&n.push(s),{roots:M(n,t,o.orphans,s),nodes:t}}function M(g,o,t,r){const s=new Set,i=[...g];for(;i.length;){const u=i.pop();if(!s.has(u.key)){s.add(u.key);for(const f of u.children)i.push(f)}}const n=[];for(const u of o.values())s.has(u.key)||n.push(u);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 u of n)u.children=u.children.filter(f=>s.has(f.key));if(!m)return[...g,...n];let c=r;const l=[...g];return c||(c=U(-1,`${Q}orphans`),c.value=t,l.push(c)),c.children.push(...n),l}function O(g){let o=0;const t=(r,s)=>{for(const i of r)i.level=s,s>o&&(o=s),i.children.length&&t(i.children,s+1)};return t(g,0),o}function k(g,o){if(!g||typeof g!="object")return null;const t=g.path,r=g.parentKey,s=E(g.hasChildren)?i=>!!g.hasChildren(o.dataAt(i)):null;if(E(t))return{mode:"path",pathOf:i=>t(o.dataAt(i)),keyOf:o.keyOf,declaresChildren:s};if(r!=null){const i=E(r)?r:n=>n?.[r];return{mode:"parentKey",parentOf:n=>i(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"?L(g,o):q(g,o),r=O(t.roots);return{...t,depth:r}}function a(g,o){const t=new Map,r=s=>{for(let i=0;i<s.length;i++){const n=s[i];if(n.physical>=0){const m=o?o(n.physical):!1,c=m&&n.children.length===0;t.set(n.physical,{level:n.level,posinset:i+1,setsize:s.length,hasChildren:n.children.length>0||m,lazy:c})}n.children.length&&r(n.children)}};return r(g),t}}),He("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 W}}),Object.defineProperty(e,"isArrival",{enumerable:!0,get:function(){return I}});const ie=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function E(x){const Q=x&&typeof x=="object"?x.reason:null;return typeof Q=="string"&&ie.includes(Q)}const W=Object.freeze(["page","total"]);function I(x){const Q=x&&typeof x=="object"?x.reason:null;return typeof Q=="string"&&W.includes(Q)}}),He("packages/core/src/source/memory.js",function(e,F){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return _}}),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,W=F("packages/core/src/internal/warn.js"),I=W.warnOnce,x=W.fail,U=F("packages/core/src/internal/predicates.js").isFunction,q=F("packages/core/src/internal/compare.js").defaultCompare,O=F("packages/core/src/internal/merge.js").mergeRow,k=F("packages/core/src/source/rows.js"),b=k.createRowFactory,a=k.groupKey,g=k.groupPathElement,o=k.groupPrefixKeys,t=k.lazyRowView,s=F("packages/core/src/source/handles.js").createHandleProvider,i=F("packages/core/src/compute/incremental.js"),n=i.RunningTotal,m=i.isIncremental,l=F("packages/core/src/compute/handle.js").presenceReader,u=F("packages/core/src/source/filterwire.js"),f=u.querySignature,p=u.mapConditions,y=u.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"),G=P.PIPELINE_SETTLE_REASONS,V=P.isPipelineSettle,K=Object.freeze(["filter","sort","group","total","pivot","flatten"]),H=Object.freeze([]);function T(J,D){if(!J)return null;const te=D==="grand"?J.grandTotal:J.groupTotal;return te??J.total}function A(J){return!!J&&!J.running}function S(J){if(J)return J.value&&U(J.value.compare)?J.value.compare:U(J.compare)?J.compare:void 0}function R(J){const D=J&&J.dataType;return!D||!U(D.items)?null:{items:D.items,type:J.itemType&&J.itemType.name||"text"}}function j(J){return!!J&&(typeof J=="object"||typeof J=="function")&&U(J.then)}const N=new Uint32Array(0),$=4096;function _(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;#o;#l=new Map;#a=!1;#c=0;#u=0;#f=new Map;#d=new Map;#h;#p=null;#m=Z.#g();static#g(){return{slots:[],groupHeadings:H,unnumbered:H,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");#L=new Map;#_=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.#o=s(this.#e,()=>this.#n,()=>this.#r),this.#h=new E(Number(z.rowCacheSize)||$);for(const X of K)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.#He(te.offset+D,D);if(!(D<0||D>=this.#F.length))return this.#He(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.#He(z)}}loaded(D){return D>=0&&D<this.count()}hint(D,te){}display(){return this.#U(),this.#_||(this.#_=this.#$e()),this.#_}invalidateQuickText(){this.#L.clear(),this.invalidate("filter")}invalidate(D){const te=K.indexOf(D);te<0&&x(`unknown pipeline stage "${D}"; expected one of ${K.join(", ")}`);for(let z=te;z<K.length;z++){const X=this.#l.get(K[z]);X.key=null,X.computed=!1}this.#_=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 re of D.remove){const ae=this.#Ce(re);if(ae===void 0){te.push({operation:"remove",id:this.#_e(re),reason:"unknown-id"});continue}z.removed.push(this.#s.keyOf(this.#r?this.#Qe(ae):this.#n[ae],ae)),this.#r||(this.#n[ae]=void 0),this.#h.delete(ae),this.#L.delete(ae),X=!0}if(D.update&&D.update.length){const re=this.#O.size||this.#at()?this.#Ke():null,ae=this.#v.size?this.#ht():null,fe=ae&&ae.length?this.#Ke():null;for(const we of D.update){const ve=this.#Ce(we);if(ve===void 0){te.push({operation:"update",id:this.#Le(we),reason:"unknown-id"});continue}const Re=this.#r?this.#i&&this.#i.has(ve)?this.#i.get(ve):this.#Qe(ve):this.#n[ve],$e=O(Re,we);for(const be of this.#le(Re,$e))ne.add(be);if(this.#r||(this.#n[ve]=$e),re&&this.#Je(re,ve,Re,$e),fe&&this.#We(ae,fe,ve,Re,$e),this.#p){const be=this.#s.keyOf(Re,ve),se=this.#s.keyOf($e,ve);be!==se&&(this.#p.delete(be),this.#p.set(se,ve))}this.#h.delete(ve),this.#L.delete(ve),z.updated.push(this.#ce(ve))}}if(D.add&&D.add.length&&this.#r){typeof D.at=="number"&&D.at<this.#j()&&(this.#h.clear(),this.#L.clear()),this.#p=null;for(const re of D.add){const ae=this.#ae(this.#Le(re));ae!==void 0&&z.added.push(this.#ce(ae))}X=!0}else if(D.add&&D.add.length){let re=typeof D.at=="number"?D.at:this.#n.length;if(re<this.#n.length){let we=0;for(let ve=0;ve<this.#n.length;ve++)this.#n[ve]!==void 0&&we++;if(we!==this.#n.length){let ve=0;for(let Re=0;Re<this.#n.length;Re++)this.#n[Re]!==void 0&&(this.#n[ve++]=this.#n[Re]);this.#n.length=ve,this.#p=null,this.#h.clear(),this.#L.clear()}}const ae=this.#n.length;re=Math.max(0,re);let fe=D.add===this.#n?D.add.slice():D.add;if(this.#s.keyed){const we=[];for(const ve of fe){const Re=this.#Le(ve);if(this.#Ce(Re)!==void 0){te.push({operation:"add",id:Re,reason:"duplicate-id"});continue}we.push(ve)}we.length!==fe.length&&(fe=we)}if(!fe.length)return z;if(re>=ae)for(let we=0;we<fe.length;we++)this.#n.push(fe[we]);else this.#n.splice(re,0,...fe),this.#h.clear(),this.#L.clear();for(let we=0;we<fe.length;we++)z.added.push(this.#ce(re>=ae?ae+we:re+we));X=!0}return this.#c++,X&&(this.#p=null,this.#lt()),this.#o.invalidate(),this.#_=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 H;let z=0,X=te.length-1,ne=-1;for(;z<=X;){const ae=z+X>>1;te[ae].at<=D?(ne=ae,z=ae+1):X=ae-1}if(ne<0)return H;const re=[];for(let ae=te[ne].row;ae;ae=ae.parent)re.push(ae);return re.reverse(),re}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 re=z+X>>1;te[re].at<=D?(ne=re,z=re+1):X=re-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 ae=0;ae<z.length;ae++)z[ae]!==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 ae=0;for(let fe=0;fe<z.length;fe++)z[fe]!==void 0&&(z[ae++]=z[fe]);z.length=ae}const[re]=z.splice(D,1);return z.splice(ne,0,re),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#L.clear(),this.#lt(),this.#o.invalidate(),this.#_=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.#L.clear(),this.#h.clear(),this.#lt(),this.#o.invalidate(),this.invalidate("filter"),this.#bt("model:changed",{reason:"reload"})}destroy(){this.#ue(),this.#h.clear(),this.#L.clear(),this.#p=null,this.#F=[],this.#X=null,this.#_=null,this.#lt();for(const D of K)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.#L.clear(),this.#h.clear(),this.#lt(),this.#o.invalidate(),this.invalidate("filter")}notePriorRows(D){this.#i=D||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#L.clear(),this.#o.invalidate()}data(){if(!this.#r)return this.#n;const 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(ae=>({colId:ae.id,handle:this.#o.handle(ae.id),fn:T(ae,"group")})).filter(ae=>ae.handle&&ae.fn),re=this.#e.config||{};return te({rowHandles:z.map(ae=>this.#o.handle(ae)).filter(Boolean),columnHandles:X.map(ae=>this.#o.handle(ae)).filter(Boolean),measures:ne,leaves:D||new Uint32Array(0),opts:{locale:re.locale,separator:(re.pivot||{}).separator,maxColumns:(re.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=[],re=ae=>{const fe=ae.row&&ae.row.children;if(fe&&fe.length){for(const we of fe){const ve=z.nodes.get(we.key);ve&&re(ve)}return}if(ae.leaves)for(let we=0;we<ae.leaves.length;we++)ne.push(this.#ce(ae.leaves[we]))};return re(X),ne}#_e(D){return typeof D=="string"?D:this.#Le(D)}#Le(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 re=ne.value&&ne.value.deps;return Array.isArray(re)&&re.length?re.some(ae=>this.#Z(String(ae),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.#a){this.#a=!0;try{this.#Ee()}finally{this.#a=!1}}}pipelineRunning(){return this.#a}#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.#xe(),()=>this.#kt(z)),this.#ye(z,X)}#re(D){const te=this.#l.get("sort"),z=this.#H();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 re=this.#Fe(ne.col);if(re&&re.running)continue;if(re&&re.value&&U(re.value.compare))return null;const ae=this.#o.handle(ne.col);if(!ae)return null;z.push({col:ne.col,descending:ne.dir==="desc",nullsFirst:!!ne.nullsFirst,locale:te}),X.push(ae)}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 re=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((ae,fe)=>({...ae,handle:X.handles[fe]})),D,{signal:ne.signal,key:"sort"});if(!j(re)){this.#b.delete("sort"),this.#de("sort",()=>te,()=>re),this.#se(!1);return}this.#se(!0),re.then(ae=>this.#ve(te,ae),ae=>this.#Se("sort",te,ae))}#ve(D,te){const z=this.#b.get("sort");if(!(!z||z.key!==D)){if(this.#H()!==D){this.#b.delete("sort"),this.#se(!1);return}this.#b.delete("sort"),this.#de("sort",()=>D,()=>te),this.#_=null,this.#U(),this.#bt("model:changed",{reason:G[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.#H()===te){const ne=this.#de("filter",()=>this.#$(),()=>this.#Ve());this.#de("sort",()=>te,()=>this.#k(ne)),this.#_=null,this.#U(),I("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",z),this.#bt("model:changed",{reason:G[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.#_=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}`}#H(){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,re=new Float64Array(X);for(let ae=0;ae<X;ae++)re[ae]=ne+ae;for(let ae=0;ae<ne;ae++){const fe=z.get(te.keys[ae]);fe!==void 0&&(re[fe]=ae)}return Uint32Array.from(D).sort((ae,fe)=>re[ae]-re[fe])}orderedKeys(){this.#p||this.#Ae();const D=this.#p,te=new Map;for(const[ae,fe]of D)te.set(fe,ae);const z=Uint32Array.from([...te.keys()]).sort(),X=this.#he(),ne=X?this.#ie(z,X):this.#k(z),re=new Array(ne.length);for(let ae=0;ae<ne.length;ae++)re[ae]=te.get(ne[ae]);return re}#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",[]))}`}#xe(){const te=this.#je()||!this.#oe()?this.#J("total"):"x",z=`${this.#St()}`,X=this.#it("flatten.keys",z,()=>{const re=this.#z("expanded",null);return re?[...re].sort().join(""):"*"}),ne=this.#it("flatten.detail",z,()=>{const re=this.#z("detail",null);return re&&U(re.signature)?re.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.#L.clear(),this.#_=null}invalidateHandles(){this.#o.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),re=String(this.#z("quick","")||"").trim().toLowerCase(),ae=re?Y(re,String(this.#z("quickMode","contains")||"contains")):null,fe=(this.#e.config||{}).hostFilter,we=!!(fe&&U(fe.active)&&fe.active()),ve=this.#z("where",null),Re=!!(ve&&ve.active);if(!ne&&!re&&!we&&!Re)return te;let $e=null;ne&&($e=this.#ft("evaluateFilters")(ne,{handle:oe=>this.#o.handle(oe),count:this.#j(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:oe=>R(this.#Fe(oe)),typeOf:oe=>{const ce=this.#Fe(oe);return ce?ce.type:void 0}}));const be=new Uint32Array(te.length);let se=0;for(let de=0;de<te.length;de++){const oe=te[de];if(!($e&&!$e[oe])&&!(ae&&!this.#Be(oe,ae))){if(we||Re){const ce=this.#ce(oe);if(we&&!fe.passes(ce)||Re&&!ve.passes(ce.data,ce.key))continue}be[se++]=oe}}if($e){const de=(this.#e.compute||{}).releaseMask;U(de)&&de({pool:this.#e.pool},$e)}return be.subarray(0,se)}handleFor(D){return this.#o.handle(D)}#k(D){const te=this.#he();if(te)return this.#ie(D,te);const z=this.#z("sort",[]).filter(re=>{const ae=this.#Fe(re.col);return!ae||!ae.running?!0:(I(`source.sort.running.${re.col}`,`sort ignores "${re.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 re=z[0],ae=this.#o.handle(re.col);if(!ae)return I(`source.sort.${re.col}`,`sort ignores unknown column "${re.col}".`),D;const fe=this.#Fe(re.col);return this.#ft("sortColumn")(ae,D,{descending:re.dir==="desc",nullsFirst:re.nullsFirst,locale:X,compare:S(fe)})}const ne=[];for(const re of z){const ae=this.#o.handle(re.col);if(!ae){I(`source.sort.${re.col}`,`sort ignores unknown column "${re.col}".`);continue}ne.push({handle:ae,descending:re.dir==="desc",nullsFirst:re.nullsFirst,locale:X,compare:S(this.#Fe(re.col))})}return ne.length?this.#ft("sortMulti")(ne.map(re=>re.handle),ne,D):D}#Ie(D){const te=this.#z("groupBy",[]),z=this.#fe();if(z&&!te.length){const de=d(D,z);return this.#R=v(de.roots,z.declaresChildren),{roots:null,leaves:D,nodes:new Map,tree:de}}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=[],re=[];let ae=!1;for(const de of te){const oe=this.#o.handle(de);if(!oe){I(`source.group.${de}`,`grouping ignores unknown column "${de}".`);continue}ne.push(oe);const ce=this.#Fe(de),he=ce&&ce.dataType;if(he&&U(he.groupProjector)){const Oe=ce.typeOptions&&ce.typeOptions.timeZone||X||void 0,Se=he.groupProjector(ce,Oe);re.push(Se||null),Se&&(ae=!0)}else re.push(null)}if(!ne.length)return{roots:null,leaves:D,nodes:new Map};const{keys:fe,buckets:we}=this.#ft("groupByColumns")(ne,D,{locale:(this.#e.config||{}).locale,project:ae?re:void 0}),ve=this.#z("pivotBy",[]).length>0,Re=[],$e=new Map;for(let de=0;de<we.length;de++){const oe=fe[de];let ce=null;const he=[];for(let Oe=0;Oe<oe.length;Oe++){he.push(g(oe[Oe]));const Se=a(he),Ce=Oe===oe.length-1;let Ie=$e.get(Se);if(!Ie){const ke=this.#s.group({path:[...he],column:te[Oe],value:oe[Oe],level:Oe,parent:ce,expanded:ve&&Ce?!1:this.#gt(Se,{key:Se,column:te[Oe],value:oe[Oe],level:Oe,path:[...he]}),hasChildren:!(ve&&Ce)});Ie={row:ke,leaves:null},$e.set(Se,Ie),ce?ce.children.push(ke):Re.push(ke)}Ie.row.leafCount+=we[de].length,Oe===oe.length-1&&(Ie.leaves=we[de]),ce=Ie.row}}const be=this.#z("sort",[])||[],se=(de,oe)=>{if(!de||de.length<2){if(de)for(const Se of de)se(Se.children,oe+1);return}const ce=te[oe],he=be.find(Se=>Se.col===ce),Oe=he&&he.dir==="desc"?-1:1;de.sort((Se,Ce)=>Oe*q(Se.groupValue,Ce.groupValue));for(const Se of de)se(Se.children,oe+1)};return se(Re,0),{roots:Re,leaves:D,nodes:$e,keys:fe,buckets:we}}#Ye(D,te){const z=new Map,X=new Map,ne=re=>{const ae=re.physical>=0?[re.physical]:[];for(const fe of re.children)ae.push(...ne(fe));if(re.children.length){const fe=this.#Xe(te,Uint32Array.from(ae),null);re.physical>=0?z.set(re.physical,fe):X.set(re.key,fe)}return ae};for(const re of D.roots)ne(re);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(be=>be.id).join("")},X=this.#E&&this.#E.id===z.id&&this.#E.columns===z.columns,ne=this.#at()&&X?this.#C:null,re=ne?te.filter(be=>ne.has(be.id)):te,ae=X?this.#T:null,fe=this.#rt()?null:this.#Tt(),we=this.#Pe(te),ve=be=>{const se=D.nodes.get(be.key);let de=se&&se.leaves?se.leaves:null;if(be.children&&be.children.length){const he=be.children.map(ve);let Oe=0;for(const Ie of he)Oe+=Ie.length;const Se=new Uint32Array(Oe);let Ce=0;for(const Ie of he)Se.set(Ie,Ce),Ce+=Ie.length;de=Se}de=de||new Uint32Array(0);const oe=fe?fe.get(be.key)||N:de,ce=this.#Ze(be,ne?re:te,oe,we);return be.totals=ne?{...be.totals,...ce}:ce,de};if(D.roots&&re.length)for(const be of D.roots)ve(be);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 $e=fe?this.#st():D.leaves;return this.#T=this.#Oe(te,$e,ne,ae),{grand:this.#T}}#Oe(D,te,z,X){const ne={},re=this.#J("group");re!==this.#w&&(this.#ct(),this.#w=re);const ae=this.#A;this.#A=[];for(const fe of D){if(!A(fe))continue;const we=this.#o.handle(fe.id);if(!we)continue;const ve=T(fe,"grand");if(!m(ve,we)){if(z&&!z.has(fe.id)&&X&&fe.id in X){ne[fe.id]=X[fe.id];continue}ne[fe.id]=this.#Xe([fe],te,null,"grand")[fe.id];continue}let Re=this.#O.get(fe.id);if((!Re||Re.fn!==ve)&&(Re=new n(ve),this.#O.set(fe.id,Re)),Re.valid){let $e=!0;for(const be of ae)if(be.colId===fe.id&&!Re.update(be.before,be.after)){$e=!1;break}if($e){ne[fe.id]=Re.value();continue}Re.invalidate()}Re.seedColumn(we.values,l(we),te),ne[fe.id]=Re.valid?Re.value():this.#Xe([fe],te,null,"grand")[fe.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(!A(ne))continue;const re=this.#o.handle(ne.id),ae=T(ne,"group");m(ae,re)&&z.set(ne.id,{fn:ae})}if(!z.size)return this.#S.length=0,z;const X=this.#S;this.#S=[];for(const ne of X){const{beforeKeys:re,afterKeys:ae,colDeltas:fe}=ne,we=re.length?new Set(re):null,ve=ae.length?new Set(ae):null;for(const{colId:Re,before:$e,after:be}of fe)if(z.has(Re)){for(const se of re)ve&&ve.has(se)||this.#dt(se,Re,$e,null);for(const se of ae)we&&we.has(se)||this.#dt(se,Re,null,be);for(const se of re)ve&&!ve.has(se)||this.#dt(se,Re,$e,be)}}return z}#dt(D,te,z,X){const ne=this.#v.get(D),re=ne&&ne.get(te);!re||!re.valid||re.update(z,X)||re.invalidate()}#Ze(D,te,z,X){if(!X||!X.size)return this.#Xe(te,z,D);const ne={};let re=null,ae=this.#v.get(D.key);for(const fe of te){const we=X.get(fe.id);if(!we){(re||(re=[])).push(fe);continue}const ve=this.#o.handle(fe.id);if(!ve)continue;ae||(ae=new Map,this.#v.set(D.key,ae));let Re=ae.get(fe.id);if((!Re||Re.fn!==we.fn)&&(Re=new n(we.fn),ae.set(fe.id,Re)),Re.valid||Re.seedColumn(ve.values,l(ve),z),Re.valid){ne[fe.id]=Re.value();continue}(re||(re=[])).push(fe)}return re&&Object.assign(ne,this.#Xe(re,z,D)),ne}#Je(D,te,z,X){const ne=!this.#rt()||this.#Et(te);for(const re of D){const ae=re.getValue;if(!U(ae))continue;const fe=ae(z),we=ae(X);Object.is(fe,we)||(this.#C&&this.#C.add(re.id),ne&&this.#O.has(re.id)&&this.#A.push({colId:re.id,before:fe,after:we}))}}#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 re=o(this.#pt(D,X)),ae=o(this.#pt(D,ne)),fe=re.length!==ae.length||re.some((ve,Re)=>ve!==ae[Re]),we=[];for(const ve of te){const Re=ve.getValue;if(!U(Re))continue;const $e=Re(X),be=Re(ne);!fe&&Object.is($e,be)||we.push({colId:ve.id,before:$e,after:be})}!we.length&&!fe||this.#S.push({beforeKeys:re,afterKeys:ae,colDeltas:we})}#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 re=X+ne>>1,ae=z[re];if(ae===D)return!0;ae<D?X=re+1:ne=re-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 re=this.#o.handle(ne);re&&X.push(re)}if(X.length){const ne=this.#st(),{keys:re,buckets:ae}=this.#ft("groupByColumns")(X,ne,{locale:(this.#e.config||{}).locale}),fe=new Map;for(let we=0;we<ae.length;we++){const ve=re[we],Re=[];for(let $e=0;$e<ve.length;$e++){Re.push(g(ve[$e]));const be=a(Re);let se=fe.get(be);se||(se=[],fe.set(be,se));for(let de=0;de<ae[we].length;de++)se.push(ae[we][de])}}for(const[we,ve]of fe)z.set(we,Uint32Array.from(ve))}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(re=>this.#o.handle(re)).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(re=>re.id),handle:re=>this.#o.handle(re),totalOf:re=>T(ne.find(ae=>ae.id===re),"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 ve=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]=ve;else{const Re=Array.from(D.leaves);Re.push(ve),this.#F=Re,this.#X=D.leaves}this.#B=[{at:this.#F.length-1}]}else this.#X=null,this.#F=D.leaves,this.#B=H;return this.#V=H,this.#F}const ne=[],re=[],ae=[],fe=ve=>{if(ne.push(ve),!X)return;const Re=this.#ce(ve);!Re||!X.isOpen(Re.key)||(Re.master=!0,Re.expanded=!0,ae.push({at:ne.length}),ne.push(this.#s.detail(Re,X.heightOf(Re))))};if(!D.roots){for(let ve=0;ve<D.leaves.length;ve++)fe(D.leaves[ve]);return te&&te.grand&&!this.#oe()&&(ae.push({at:ne.length}),ne.push(this.#s.grandTotal(te.grand,this.#te(D.leaves.length)))),this.#X=null,this.#V=H,this.#B=ae.length?ae:H,this.#F=ne,ne}const we=(ve,Re,$e)=>{if(ve.expanded=ve.hasChildren===!1?!1:this.#gt(ve.key,{key:ve.key,column:ve.groupColumn,value:ve.groupValue,level:ve.level,path:ve.groupPath}),ve.posinset=Re+1,ve.setsize=$e,re.push({at:ne.length,row:ve}),ae.push({at:ne.length}),ne.push(ve),!!ve.expanded){if(ve.children&&ve.children.length)for(let be=0;be<ve.children.length;be++)we(ve.children[be],be,ve.children.length);else{const be=D.nodes.get(ve.key),se=be&&be.leaves?be.leaves:null;if(se)for(let de=0;de<se.length;de++)fe(se[de])}z&&ve.totals&&(ae.push({at:ne.length}),ne.push(this.#s.footer(ve)))}};for(let ve=0;ve<D.roots.length;ve++)we(D.roots[ve],ve,D.roots.length);return te&&te.grand&&!this.#oe()&&(ae.push({at:ne.length}),ne.push(this.#s.grandTotal(te.grand,this.#te(D.leaves.length)))),this.#V=re,this.#B=ae,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]}#He(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=[],re=fe=>{if(fe.leafCount!==void 0)return fe.leafCount;let we=fe.physical>=0?1:0;for(const ve of fe.children)we+=re(ve);return fe.leafCount=we,we},ae=fe=>{const we=this.#gt(fe.key);if(fe.physical>=0){if(X.push(fe.physical),z&&z.isOpen(this.#ce(fe.physical).key)){const ve=this.#ce(fe.physical);ne.push({at:X.length}),X.push(this.#s.detail(ve,z.heightOf(ve)))}}else X.push(this.#s.group({path:[fe.key],column:null,value:fe.value,level:fe.level,parent:null,expanded:we,hasChildren:fe.children.length>0,leafCount:re(fe),totals:this.#D?this.#D.byKey.get(fe.key):void 0}));if(we)for(const ve of fe.children)ae(ve)};for(const fe of D.tree.roots)ae(fe);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=H,this.#B=ne.length?ne:H,this.#F=X,X}#$e(){return t(()=>this.count(),D=>this.at(D))}#Be(D,te){let z=this.#L.get(D);if(z===void 0){const X=this.#Qe(D),ne=this.#At(),re=[],ae=this.#e.columnHidden;for(const fe of ne){if(fe.quickFilter===!1||U(ae)&&ae(fe.id))continue;const we=fe.value&&U(fe.value.quickFilterText)?fe.value.quickFilterText({value:void 0,data:X,row:null,column:fe,colId:fe.id,grid:null,context:this.#z("context",null)}):null,ve=we??(U(fe.formatValue)?fe.formatValue(U(fe.getValue)?fe.getValue(X):void 0):"");ve!=null&&ve!==""&&re.push(String(ve))}z=re.join(" ").toLowerCase(),this.#L.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={},re=(this.#e.compute||{}).total;for(const ae of D){if(!A(ae))continue;const fe=this.#o.handle(ae.id);if(!fe)continue;const we=T(ae,X);if(we)if(U(we)){const ve=new Array(te.length);for(let Re=0;Re<te.length;Re++)ve[Re]=fe.get(te[Re]);ne[ae.id]=we(ve,{row:z,column:ae,grid:this.#e.grid||null,context:this.#z("context",null),valueAt:(Re,$e)=>{const be=this.#o.handle(Re);return be&&$e>=0&&$e<te.length?be.get(te[$e]):null}})}else U(re)&&(ne[ae.id]=re(fe,te,we))}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),re=this.#Fe(ne&&ne.col),ae=re&&re.type==="datetime";if(ne&&ne.type)return ne.type==="datetime"&&!ne.timeZone&&re?{...ne,timeZone:te.timeZone||void 0}:ne;if(ae)return{...ne,type:"datetime",timeZone:te.timeZone||void 0};const fe=re&&(re.dataType?.base||re.type);return fe?{...ne,type:fe}: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)||x(`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)}}}),He("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 W}}),Object.defineProperty(e,"createAbortScope",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return x}});class ie extends Error{constructor(U,L="superseded"){super(`[lattice] request ${U?`"${U}" `:""}${L}`),this.name="SupersededError",this.superseded=!0,this.key=U}}class E{#e;constructor(U,L,q,M){this.#e=U,this.key=L,this.controller=q,this.signal=q.signal,this.seq=M}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 W{#e=new Map;#t=0;begin(U="",L="superseded"){const q=this.#e.get(U);q&&!q.signal.aborted&&q.controller.abort(new ie(U,L));const M=new E(this,U,new AbortController,++this.#t);return this.#e.set(U,M),M}tokenFor(U){return this.#e.get(U)}pending(U=""){const L=this.#e.get(U);return!!L&&!L.signal.aborted}get size(){return this.#e.size}settle(U){this.#e.get(U.key)===U&&this.#e.delete(U.key)}abort(U="",L="superseded"){const q=this.#e.get(U);q&&q.abort(L)}abortAll(U="superseded"){for(const L of[...this.#e.values()])L.abort(U);this.#e.clear()}}function I(){return new W}function x(Q){if(!Q||typeof Q!="object")return!1;const U=Q;return U.superseded===!0||U.name==="AbortError"||U.name==="SupersededError"}}),He("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 W{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 L=this.#e.get(Q);return L||(L=new W(Q)),L.state="pending",L.token=U,L.error=null,this.#s(Q,L),L}fill(Q,U){const L=this.#e.get(Q)||new W(Q);L.rows=U,L.state="loaded",L.token=null,this.#s(Q,L)}failed(Q,U){const L=this.#e.get(Q)||new W(Q);L.state="error",L.error=U,L.token=null,this.#s(Q,L)}delete(Q){return this.#e.delete(Q)}rowAt(Q){const U=this.blockOf(Q),L=this.#e.get(U);if(!(!L||L.state!=="loaded"||!L.rows))return this.#s(U,L),L.rows[Q-U*this.#t]}rowLoaded(Q){const U=this.blockOf(Q),L=this.#e.get(U);return!!L&&L.state==="loaded"&&!!L.rows&&Q-U*this.#t<L.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 L=U.id*this.#t+U.rows.length;L>Q&&(Q=L)}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,L]of this.#e){if(this.#e.size-Q.length<=this.#n)break;U>=this.#r&&U<=this.#i||L.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)}}}),He("packages/core/src/source/pagewindow.js",function(e,F){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return ie}});function ie(E,W,I,x){const Q=Math.floor(Number(E)||0);if(Q<=0)return null;const U=Math.max(0,Math.floor(Number(W)||0)),L=Math.max(0,Math.floor(Number(I)||0));if(x){const q=Math.max(1,Math.ceil(L/Q)),M=Math.min(U,q-1),O=M*Q;return{page:M,pageSize:Q,offset:O,length:Math.max(0,Math.min(Q,L-O)),pageCount:q,total:L}}return{page:U,pageSize:Q,offset:U*Q,length:Q,pageCount:Math.max(U+2,Math.ceil(L/Q)),total:null}}}),He("packages/core/src/source/paged.js",function(e,F){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return u}}),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,L=F("packages/core/src/internal/schedule.js").settleDebounce,q=F("packages/core/src/source/abort.js"),M=q.createAbortScope,O=q.isAbortError,k=F("packages/core/src/source/blockcache.js"),b=k.BlockCache,a=k.DEFAULT_PAGE_SIZE,g=k.DEFAULT_MAX_CACHED_PAGES,t=F("packages/core/src/source/rows.js").createRowFactory,r=F("packages/core/src/source/filterwire.js"),s=r.wireFilters,i=r.querySignature,n=r.warnHostFilterNotApplied,c=F("packages/core/src/source/pagewindow.js").pageWindow,l=120;function u(p,y){return new f(p,y)}class f{mode="paged";#e;#t;#n;#r=M();#i;#s;#o=new Map;#l=null;#a=null;#c=!1;#u=0;#f="";#d={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(y,h){this.#e=y||{mode:"paged"},this.#t=h||{},this.#n=new b({pageSize:this.#e.pageSize||a,maxCachedPages:this.#e.maxCachedPages||g}),this.#i=t(this.#t),this.#s=new E(this.#n.pageSize*4),this.#h=L((d,w)=>this.#w(d,w),l),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=c(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.#o.set(w.key,y),w}byKey(y){const h=this.#o.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,G)=>P-G);for(const P of v){if(!this.#n.loaded(P))continue;const{start:G}=this.#n.rangeOf(P),V=this.#n.fillOf(P)||0;for(let K=G;K<G+V;K++){if(K<h||K>=d)continue;const H=this.#s.peek(K);if(H&&H.data!==null&&H.data!==void 0){w.push(H);continue}const T=this.#n.rowAt(K);if(T===void 0)continue;const A=this.#i.leaf(T,K);A.index=K,this.#s.set(K,A),this.#o.set(A.key,K),w.push(A)}}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 G of this.#n.evict())this.#v(G);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.#o.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.#o.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 G=P&&P.rows||[];this.#n.fill(y,G);for(let K=0;K<G.length;K++)this.#s.delete(d+K);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):G.length<this.#n.pageSize?(this.#c=!0,this.#l=d+G.length):this.#u=Math.max(this.#u,d+G.length),this.#M("model:changed",{reason:"page",block:y,from:d,to:d+G.length}),this.#M("rows:changed",{companion:!0,reason:"page",block:y,from:d,to:d+G.length}),this.#l!==null&&this.#l!==this.#a&&(this.#a=this.#l,this.#M("source:total",{total:this.#l,groupPath:[]}))}catch(P){if(h.settle(),O(P))return;this.#n.failed(y,P);for(let G=d;G<w;G++)this.#s.delete(G);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.#o.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.#o.clear(),this.#l=null,this.#a=null,this.#c=!1,this.#u=0,this.#m++,this.#M("model:changed",{reason:y})}#C(){return i({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)}}}),He("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 W}}),Object.defineProperty(e,"aggregateP",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return x}}),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 M}});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 O=new Set;for(const[k,b]of Object.entries(ie))b.pushable&&O.add(k);return O}function W(O,k,b,a="?"){let g=O.split("%c").join(k);return b!==void 0&&(g=g.split("%w").join(b)),g.split("%p").join(a)}function I(O){const k=O&&(O.p!==void 0?O.p:O.params&&O.params.p);return typeof k=="number"&&k>=0&&k<=1?k:void 0}function x(O){const k=O||{},b=k.default==="engine"||k.default==="engine-if-identical"?k.default:"client",a={};if(k.overrides&&typeof k.overrides=="object")for(const[g,o]of Object.entries(k.overrides))(o==="engine"||o==="client")&&(a[g]=o);return{default:b,overrides:a}}function Q(O,k){const b=ie[O];if(!b||!b.pushable)return"client";const a=k.overrides[O];return a==="engine"||a==="client"?a:k.default==="client"?"client":k.default==="engine-if-identical"?b.class==="identical"?"engine":"client":"engine"}function U(O,k){const b=x(k),a=[],g=[];for(const o of O||[]){const t=ie[o.fn],r=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 i=I(o);i!==void 0&&(s.p=i)}if(r==="engine"&&t&&t.parametric&&s.p===void 0){g.push({...s,reason:`"${o.fn}" needs \`p\`, a number from 0 to 1`});continue}r==="engine"?a.push(s):(s.reason=t&&!t.pushable?t.note||"the engine cannot express this stat":"client by config",g.push(s))}return{engine:a,client:g,config:b}}const L=/^[A-Za-z_][A-Za-z0-9_$]*$/;function q(O,k=[]){return(O||[]).every(a=>{if(typeof a=="string")return L.test(a);if(!a||typeof a!="object")return!1;const g=a;return Array.isArray(k)&&k.includes(g.bucket)&&typeof g.col=="string"&&L.test(g.col)&&typeof g.size=="number"&&Number.isFinite(g.size)&&g.size>0})}function M(){return Object.entries(ie).map(([O,k])=>({stat:O,class:k.class,sql:k.sql?W(k.sql,"col",k.twoColumn?"weight":void 0):"",note:k.note||(k.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),He("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 l}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return u}}),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 K}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return A}}),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,L=F("packages/core/src/internal/warn.js").warnOnce,q=F("packages/core/src/source/filterwire.js"),M=q.isGroup,O=q.warnWherePageRelative,k=q.warnWhereOverThreshold,b=q.wireFilters,a=F("packages/core/src/source/aggregates.js"),g=a.resolveAggregatePlan,o=a.groupKeysPushable,t=a.STAT_PUSHDOWN,r=a.aggregateP,s=a.fillAggregateSql,n=F("packages/core/src/source/abort.js").SupersededError,m=1e3;function c(X){const ne=X&&X.signal;if(!ne||!ne.aborted)return;const re=ne.reason;throw re instanceof Error?re:new n("","superseded before it was sent")}const l=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function u(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 re=X;for(const ae of ne.split(".")){if(re===null||typeof re!="object")return;re=re[ae]}return re}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={...l,...X||{}};return ne.operators=new Set(ne.operators||[]),ne.mutate=u(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(M(X)){const we=X.conditions||[];if(String(X.op)!=="and")return{pushed:null,residual:X};const ve=we.findIndex($e=>!M($e)&&h($e,ne));if(ve<0)return{pushed:null,residual:X};const Re=we.filter(($e,be)=>be!==ve);return{pushed:we[ve],residual:Re.length?{op:"and",conditions:Re}:null}}return h(X,ne)?{pushed:X,residual:null}:{pushed:null,residual:X}}if(!M(X))return h(X,ne)?{pushed:X,residual:null}:{pushed:null,residual:X};if(String(X.op)!=="and")return(X.conditions||[]).every(ve=>M(ve)?d(ve,ne).residual===null:h(ve,ne))?{pushed:X,residual:null}:{pushed:null,residual:X};const re=[],ae=[];for(const we of X.conditions||[]){if(M(we)){if(ne.filter==="flat"){ae.push(we);continue}const ve=d(we,ne);ve.pushed&&re.push(ve.pushed),ve.residual&&ae.push(ve.residual);continue}(h(we,ne)?re:ae).push(we)}const fe=we=>we.length===0?null:we.length===1?we[0]:{op:"and",conditions:we};return{pushed:fe(re),residual:fe(ae)}}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 G(X,ne,re,ae,fe,we,ve){const Re=Array.isArray(X.groupBy)?X.groupBy:[],$e=Array.isArray(X.groupPath)?X.groupPath:[],be=Array.isArray(X.groupValues)?X.groupValues:null;if(!ne.group){const se=P(ne);if(se)return se}return o(Re)?re.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":ae?fe?we&&!we.conditioned?"a host `where` predicate can only run in the browser, over rows the engine grouped":ve?"fullDataset holds the whole matching set, so the grid groups it itself":!be||be.length!==$e.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",K="pushdown:group-unsupported",H=Symbol("lattice.remote.ungroupedLevel");function T(X,ne,re,ae,fe,we){const ve=Array.isArray(X.pivotBy)?X.pivotBy:[],Re=Array.isArray(X.groupBy)?X.groupBy:[],$e=Array.isArray(X.groupPath)?X.groupPath:[],be=Array.isArray(X.groupValues)?X.groupValues:null;return ne.pivot?o(ve)?Re.length&&!o(Re)?"a grouping key is not a plain column the engine can name in a GROUP BY":re.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":ae?fe?we&&!we.conditioned?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!be||be.length!==$e.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 A(X,ne,re=!1){const ae=d(X.filters||null,ne),fe=[];ae.residual&&fe.push("filter");const we=X.sort||[],ve=we.length===0||ne.sort==="multi"&&we.length>=1||ne.sort==="single"&&we.length===1;!ve&&we.length&&fe.push("sort");const Re=X.quick?String(X.quick):"",$e=!Re||!!ne.quick;$e||fe.push("quick");const be=X.where&&X.where.active?X.where:null;be&&fe.push("where");const se={filters:ae.residual,sort:ve?null:we,quick:$e?"":Re,where:be},de=!!re,oe=Array.isArray(X.groupBy)&&X.groupBy.length>0,ce=oe?G(X,ne,ae,ve,$e,be,de):"",he=X.pivotMode!==!1&&Array.isArray(X.pivotBy)&&X.pivotBy.length>0,Oe=he?T(X,ne,ae,ve,$e,be):"",Se=he&&Oe==="";he&&!Se&&fe.push("pivot");const Ce=he?Se&&oe:oe&&ce==="";oe&&!he&&!Ce&&fe.push("group");const Ie=(Ce||Se)&&Array.isArray(X.groupValues)?X.groupValues.length:0;be&&be.conditioned&&(Ce||Se)&&(se.where=null,fe.splice(fe.indexOf("where"),1));const ke=Ce||he?!1:de||!!(se.filters||se.sort||se.quick||se.where)||!ne.range;return{pushed:{...X,filters:ae.pushed,sort:ve?we:[],quick:$e?Re:"",range:ke?null:X.range},residual:se,needsAll:ke,unpushed:fe,full:de,grouped:Ce,groupLevel:Ie,groupReason:he?"":ce,pivoted:Se,pivotReason:Oe}}function S(X){const ne=Array.isArray(X.totals)?X.totals:[],re=X.totalFns&&typeof X.totalFns=="object"?X.totalFns:{},ae=[],fe=[];for(const we of ne){const ve=String(we),Re=re[ve],$e=typeof Re=="string"?Re:Re&&typeof Re.fn=="string"?Re.fn:null,be=Re&&typeof Re=="object"?r(Re):void 0,se=$e?t[$e]:null;se&&se.parametric&&be===void 0?fe.push({id:ve,fn:$e,class:se.class,reason:`"${$e}" needs \`p\`, a number from 0 to 1`}):$e?!se||!se.pushable||!se.sql?fe.push({id:ve,fn:$e,class:se?se.class:"fallback",reason:se&&se.note?se.note:`the pushdown map cannot express "${$e}"`}):se.twoColumn?fe.push({id:ve,fn:$e,class:se.class,reason:`"${$e}" reduces two columns, and a grouped request carries no weight column`}):ae.push({id:ve,col:ve,fn:$e,class:se.class,...be!==void 0?{p:be}:{}}):fe.push({id:ve,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:ae,client:fe}}function R(X){return{...X,engine:X.engine.map(ne=>{const re=t[ne.fn];if(!re||!re.sql)return ne;const ae=fe=>`"${fe}"`;return{...ne,sql:s(re.sql,ae(ne.col),ne.weight!==void 0?ae(ne.weight):void 0)}})}}const j=Object.freeze({items:X=>X==null?[]:Array.isArray(X)?X:[X]});function N(X,ne,re){if(!ne)return X;let ae=X;if(ne.filters&&I(re.evaluateFilters)){const fe=ae,we={count:ae.length,handle:$e=>({id:$e,get:be=>f(fe[be],$e)}),itemwise:$e=>fe.some(be=>Array.isArray(f(be,$e)))?j:null},ve=re.evaluateFilters(ne.filters,we),Re=[];for(let $e=0;$e<ae.length;$e++)ve[$e]&&Re.push(ae[$e]);ae=Re}if(ne.where&&ne.where.active&&(ne.whole||O(ne.where.names,"pushdown"),ae=ae.filter(fe=>ne.where.passes(fe))),ne.quick){const fe=ne.quick.toLowerCase();ae=ae.filter(we=>{if(!we||typeof we!="object")return!1;for(const ve of Object.values(we))if(ve!=null&&String(ve).toLowerCase().includes(fe))return!0;return!1})}if(ne.sort&&ne.sort.length&&I(re.sortMulti)){const fe=[...new Set(ne.sort.map($e=>$e.col))],we=ae,ve=fe.map($e=>({id:$e,get:be=>f(we[be],$e)})),Re=re.sortMulti(ve,ne.sort.map($e=>({col:$e.col,dir:$e.dir})),Uint32Array.from({length:ae.length},($e,be)=>be),{});ae=Array.from(Re,$e=>we[$e])}return ae}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 _(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:re,...ae}=X;return typeof ne=="number"?{...ae,total:ne}:ae}function z(X={}){const ne=X.adapter;if(!ne||!I(ne.execute))return L("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...X,mode:"remote",fetch:async()=>({rows:[],total:0})};const re=y(ne.capabilities),ae=ne.capabilities&&Object.getOwnPropertyDescriptor(ne.capabilities,"operators");ae&&I(ae.get)&&Object.defineProperty(re,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(ne.capabilities.operators||[]),set:()=>{}});const fe=ne.name||"adapter";let we=null;const ve=()=>I(ne.ready)?(we||(we=Promise.resolve(ne.ready()).then(()=>{Object.assign(re,y(ne.capabilities))},Le=>{throw we=null,Le})),we):null,Re=Y(X.fullDataset),$e=!!X.allowPartialResults,be=J(X.whereRowLimit);let se=null;const de=X.aggregates;let oe=null,ce=null,he=null,Oe=null,Se=null,Ce=null,Ie=0,ke=null;const _e=()=>!Re.enabled||!oe?null:(ke!==oe.key&&(Ie++,ke=oe.key),{rows:oe.rows,version:Ie}),Te=async Le=>{const ze=Le.where&&Le.where.active?Le.where:null;if(!ze)return{request:Le,probe:null};if(ze.conditioned){const Ot=A(Le,re,Re.enabled);if(Ot.grouped||Ot.pivoted)return{request:Le,probe:null}}const{where:De,...Ge}=Le,Ve=A(Ge,re,Re.enabled);if(Ve.needsAll)return{request:Le,probe:null};const Qe=$(Ve.pushed);let mt=null;return(!se||se.key!==Qe)&&(re.total?(c(Le),mt=await te(await ne.execute(Ve.pushed,Le)),se={key:Qe,size:mt&&typeof mt.total=="number"?mt.total:null}):se={key:Qe,size:null}),se.size!==null&&se.size<be?{request:Le,probe:null}:(k(ze.names,fe,se.size,be),{request:Ge,probe:mt})},je=async(Le,ze)=>{Ce=null;const De=S(Le.pushed);he={engine:De.engine,client:De.client,groupBy:Le.pushed.groupBy},De.client.length&&L(`source.pushdown.group.totals.${fe}.${De.client.map(Qe=>Qe.id).join(".")}`,`the ${fe} 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(Le.pushed,De.engine,ze)||{};let Ve=Ge.rows||[];return!re.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}},Ae=new Map,Ee=64,Me=async(Le,ze)=>{Ce=null;const De=Le.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!re.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=S(De),Lt=v(re),At=jt.engine.filter(rt=>Lt.has(rt.fn)),Bt=[...jt.engine.filter(rt=>!Lt.has(rt.fn)).map(rt=>({id:rt.id,fn:rt.fn,class:rt.class,reason:`the ${fe} adapter does not compute "${rt.fn}"`})),...jt.client];he={engine:At,client:Bt,groupBy:Ge},Bt.length&&L(`source.pushdown.group.totals.${fe}.${Bt.map(rt=>rt.id).join(".")}`,`the ${fe} 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?Ae.get(Zt):void 0;if(!Xe){for(Xe=Promise.resolve(ne.executeGroupedAggregates(Vt,[dt],nn)),Ae.delete(Zt),Ae.set(Zt,Xe);Ae.size>Ee;)Ae.delete(Ae.keys().next().value);Xe.catch(()=>{Ae.get(Zt)===Xe&&Ae.delete(Zt)})}const ot=await Xe||[];c(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,xt)=>Rt+xt.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=Le=>{typeof Le.matchCount=="number"&&(Oe=Le.matchCount,Se=Le.grand?{totals:Le.grand,leafCount:Le.matchCount}:null)},Ke=async(Le,ze)=>{Ce=null;const De=S(Le.pushed);he={engine:De.engine,client:De.client,groupBy:Le.pushed.groupBy,pivotBy:Le.pushed.pivotBy},De.client.length&&L(`source.pushdown.pivot.totals.${fe}.${De.client.map(Ot=>Ot.id).join(".")}`,`the ${fe} 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(Le.pushed,De.engine,ze)||{};let Ve=Ge.rows||[];!re.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=Le=>{L(`source.pushdown.pivot.${fe}.${Le}`,`pushdown:pivot-unsupported: the ${fe} adapter cannot pivot this query because ${Le}, 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 ${fe} adapter cannot pivot this query because ${Le}, 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=Le,ze},Je=(Le,ze)=>{const De={key:ze,state:"pending",value:null};return Ce=De,Le.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(Le=>{const ze=setTimeout(Le,m);Ct.push(()=>{clearTimeout(ze),Le()})});let st;const it=async Le=>{const ze=ve();ze&&await ze;const Ge=Le&&Le.pivotMode!==!1&&Array.isArray(Le.pivotBy)&&Le.pivotBy.length>0?{request:Le,probe:null}:await Te(Le);c(Le);let Ve=A(Ge.request,re,Re.enabled);if(re.group&&Ve.grouped&&!Ve.pivoted&&!I(ne.executeGroupLevel)&&(L(`source.pushdown.group.method.${fe}`,`the ${fe} 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=A(Ge.request,{...re,group:!1,aggregates:null},Re.enabled)),Ve.pivoted&&!I(ne.executePivotLevel)&&(Ve=A(Ge.request,{...re,pivot:!1},Re.enabled),Ve.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Ve.grouped&&!Ve.pivoted&&!re.group&&!I(ne.executeGroupedAggregates)&&(L(`source.pushdown.group.aggregates.method.${fe}`,`the ${fe} 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=A(Ge.request,{...re,aggregates:null},Re.enabled)),ce=Ve,Ve.pivoted)return Ke(Ve,Le);if(Ve.pivotReason&&et(Ve.pivotReason),Ve.grouped)return re.group?je(Ve,Le):Me(Ve,Le);const mt=!!Ve.groupReason&&!Ve.full;mt?L(`source.pushdown.group-unsupported.${fe}.${Ve.groupReason}`,`pushdown:group-unsupported: the ${fe} 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&&L(`source.pushdown.group.${fe}.${Ve.groupReason}`,`the ${fe} 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,[H]:!0}:Vt;if(!Ve.needsAll){const Vt=Ge.probe||await ne.execute(Ve.pushed,Le),Zt=Vt.rows||[];return D(Vt.pendingTotal)&&Vt.total===void 0?Ot({rows:Zt,pendingTotal:Je(Vt.pendingTotal,$(Ve.pushed))}):(Ce=null,!re.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&&L(`source.pushdown.residual.${fe}.${gt.join(".")}`,`the ${fe} 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,Le));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>Re.maxRows)throw new Error(`[lattice] fullDataset refused: the ${fe} adapter's matching set is ${Xe.toLocaleString()} rows, past the configured maxRows of ${Re.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*_(Zt[0]);if(ot>Re.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${fe} 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(Re.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&&!$e)throw new Error(`[lattice] the ${fe} 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?L(`source.pushdown.partial.residual.${fe}`,`the ${fe} 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.`):L(`source.pushdown.partial.${fe}`,`the ${fe} 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>=be){k(Ve.residual.where.names,fe,Vt,be);const{where:Zt,...Xe}=Ge.request;jt=A(Xe,re,Re.enabled),ce=jt}}const Lt=oe.total!==null&&oe.rows.length>=oe.total,At=N(oe.rows,{...jt.residual,whole:Lt},X.compute||{}),Bt=Le.range?Le.range.start:0,nn=Le.range?Le.range.end:At.length;return Ot({rows:At.slice(Bt,nn),total:At.length})},ct=async(Le,ze,De)=>{const Ve=De&&De.waitForPage&&st&&I(st.pageForegroundIdle)?st.pageForegroundIdle():Nt();Ve&&await Ve;const Qe=ve();Qe&&await Qe;const mt=A(Le,re,Re.enabled);ce=mt;const Ot=g(ze,De&&De.engine?{default:"engine"}:de),gt=Array.isArray(Le.groupBy)?Le.groupBy:[],dt=gt.length>0,jt=!mt.residual.filters&&!mt.residual.quick,Lt=!dt||o(gt,re.buckets);let At=Ot.engine,Bt=Ot.client;if(re.aggregates&&At.length){const ot=re.aggregates instanceof Set?re.aggregates:new Set(Q(re.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 ${fe} 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&&!Lt){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)||{}:(L(`source.pushdown.aggregates.${fe}${dt?".grouped":""}`,`the ${fe} 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 ${fe} 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 he={engine:At,client:Bt,...dt?{groupBy:gt}:{}},{values:Zt,engine:At,client:Bt,...Xe!==void 0?{groups:Xe}:{}}},Tt=async Le=>{ut++;try{return await it(Le)}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(re.mutate&&re.mutate.update){const Le=ze=>{if(!re.mutate||!re.mutate.update)throw new Error(`[lattice] the ${fe} 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:Le}}else L(`source.pushdown.readonly.${fe}`,`edit is enabled but the ${fe} adapter declares mutate: ${re.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 le=$t&&re.mutate&&(re.mutate.append||re.mutate.delete)?{append:re.mutate.append===!0,remove:re.mutate.delete===!0,returning:re.mutate.returning,mutate:(Le,ze)=>ne.mutate(Le,ze||{})}:null,ge=async Le=>{const ze=ve();ze&&await ze;const{range:De,signal:Ge,export:Ve,...Qe}=Le||{},mt={...Qe,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:A(mt,re,Re.enabled),signal:Ge}};async function*ye(Le,ze={}){const{plan:De,signal:Ge}=await ge(Le),Ve=Math.max(1,Math.floor(Number(ze.pageSize))||5e3),Qe={signal:Ge,stream:!0},mt=Le&&Le.range&&Number.isFinite(Number(Le.range.start))&&Number.isFinite(Number(Le.range.end))?{start:Math.max(0,Number(Le.range.start)),end:Math.max(0,Number(Le.range.end))}:null;if(!De.needsAll){const dt=mt?mt.start:0,jt=mt?mt.end:1/0;for(let Lt=dt;Lt<jt;Lt+=Ve){c(Qe);const At=Math.min(Lt+Ve,jt),Bt=await ne.execute({...De.pushed,range:{start:Lt,end:At}},Qe);Bt&&D(Bt.pendingTotal)&&Bt.pendingTotal.then(null,()=>{});const nn=Bt&&Bt.rows||[];if(nn.length&&(yield nn),nn.length<At-Lt)return}return}c(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 Pe=async Le=>{const{plan:ze,signal:De}=await ge(Le);if(!ze.needsAll&&re.total){c({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 ye({...Le,range:void 0}))Ge+=Ve.length;return Ge},Ne=async Le=>{await ve();const ze=b(Le.filters||null,{tz:X.timeZone,weekStartsOn:X.weekStartsOn}),De=Le.quick?String(Le.quick):"";return d(ze,re).residual||De&&!re.quick?null:ne.facets({...Le,filters:ze,quick:De})};return st={...X,edit:ft,rowMutate:le,mode:"remote",fetch:Tt,foregroundIdle:Nt,facetProvider:I(ne.facets)?Ne:void 0,aggregate:ct,countMatching:Pe,streamMatching:ye,capabilitiesOf:y,planQuery:A,wireFilters:b,resolveAggregatePlan:(Le,ze)=>g(Le,ze&&ze.engine?{default:"engine"}:de),STAT_PUSHDOWN:t,lastPlan:()=>ce?{...ce,...he?{aggregates:R(he)}:{},...Ce?{total:{deferred:!0,state:Ce.state,value:Ce.value}}:{}}:null,fullFrame:_e,counts:()=>({match:Oe,total:Oe,pending:!!Ce&&Ce.state==="pending"}),grandTotals:()=>Se},st}}),He("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 K}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return R}});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,L=F("packages/core/src/internal/schedule.js").settleDebounce,q=F("packages/core/src/source/abort.js"),M=q.createAbortScope,O=q.isAbortError,k=F("packages/core/src/source/blockcache.js"),b=k.BlockCache,a=k.DEFAULT_PAGE_SIZE,g=k.DEFAULT_MAX_CACHED_PAGES,o=F("packages/core/src/source/rows.js"),t=o.createRowFactory,r=o.groupKey,s=F("packages/core/src/source/filterwire.js"),i=s.wireFilters,n=s.querySignature,m=s.warnHostFilterNotApplied,l=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,G=F("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,V=1,K=120,H=1e3;function T(j,N,$){for(let _=0;_<Math.max(j.length,N.length);_++){const Y=j[_],Z=N[_],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 A(j,N){return new R(j,N)}class S{constructor(N,$,_,Y){this.path=N,this.keyPath=Y||N,this.values=[],this.level=$,this.key=r(this.keyPath),this.cache=new b(_),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 R{mode="remote";#e;#t;#n;#r;#i=new Map;#s=new Set;#o=M();#l;#a;#c=new Map;#u=[];#f=null;#d="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#O="";#w=null;#A=-1;constructor(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.#L(),this.grandTotalRow=()=>this.#F(),this.unfilteredRows=()=>this.#B(),this.facetIndices=te=>this.#_(te));const _=this.#e.counts;I(_)&&(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||a,maxCachedPages:this.#e.maxCachedPages||g},this.#l=t(this.#t),this.#a=new E(this.#n.pageSize*4),this.#h=L((te,z)=>this.#T(te,z),K),this.#r=new S([],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 _ of $.children.values())if(this.#Te(_.key,this.#we(_))&&!N(_))return!1;return!0};return N(this.#r)}pageInfo(){const N=this.#S(),$=this.totalPending();if(!N){const _=this.#v();return{page:0,pageSize:0,total:this.#P()?_:null,pageCount:1,counting:$}}return{page:N.page,pageSize:N.pageSize,total:N.total,pageCount:N.pageCount,counting:$||N.total===null&&this.#o.size>0&&this.#r.cache.loadedExtent()===0}}#S(){const N=this.#v(),$=l(this.#$("pageSize",0),this.#$("page",0),N,this.#P());if(!$)return this.#O="",null;const _=`${this.#y}:${$.offset}:${$.length}`;return _!==this.#O&&!this.#p&&(this.#O=_,$.length>0&&!this.#N()&&this.#T($.offset,$.offset+$.length-1)),$}at(N){const $=this.#S();if($){if(N<0||N>=$.length)return;const _=this.#C($.offset+N);return _&&(_.index=N),_}return this.#C(N)}#C(N){const $=this.#N();if($)return $.at(N);if(this.#re(),N<0||N>=this.#v())return;const _=this.#Z(this.#r,N);if(!_)return;const Y=this.#G(_.node,_.local);return Y&&(Y.index=N),Y||this.#l.skeleton(N,_.node.level,_.node.cache.erroredAt(_.local))}byKey(N){const $=this.#N();if($)return $.byKey(N);const _=this.#c.get(N);if(!_)return;const Y=_.lastIndexOf(":"),Z=this.#i.get(_.slice(0,Y));return Z&&this.#G(Z,Number(_.slice(Y+1)))||void 0}loaded(N){const $=this.#S();if($){if(N<0||N>=$.length)return!1;N+=$.offset}const _=this.#N();if(_)return _.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 _=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),_&&this.#h.flush()}#E(N,$){const _=this.#v(),Y=new Map;for(let Z=N;Z<=$&&Z<_;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[_,Y]of this.#E(N,$)){_.cache.protect(Y.min,Y.max);const Z=_.cache.blockOf(Y.min),J=_.cache.blockOf(Y.max);for(let D=Z;D<=J&&!(_.count!==null&&D*_.cache.pageSize>=_.count);D++)_.cache.has(D)||this.#ue(_,D)}}apply(N){const $={added:[],updated:[],removed:[]};if(!N)return $;if(N.update)for(const _ of N.update){const Y=this.#c.get(this.#l.keyOf(_,-1));if(!Y)continue;this.#a.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 re=z;re<z+J.cache.pageSize;re++){const ae=J.cache.rowAt(re);if(ae===void 0)break;X.push(re===D?_:ae)}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.#o.abortAll("reload"),this.#h.cancel(),N&&N.keepExpanded===!1&&this.#s.clear(),this.#pe(),this.#H("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#o.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.#H("group:toggled",{key:N,expanded:!0}),this.#H("model:changed",{reason:"expand",key:N}))}collapse(N){this.#s.delete(N)&&(this.#H("group:toggled",{key:N,expanded:!1}),this.#H("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),_=[...N.keys.entries()].sort((Z,J)=>T(Z[1],J[1],$)),Y=_.map(([Z])=>Z);N.result={keys:_.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}#L(){const N=this.#N();return N?N.display():[]}#_(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 _=this.#e.counts,Y=I(_)?_():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 _=this.#e.grandTotals,Y=I(_)?_():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 $=[],_=this.count();for(let Y=0;Y<_;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:i(this.#$("filters",null),this.#J()),sort:this.#$("sort",[]),context:this.#$("context",null)};N&&($.quick=N);const _=this.#$("where",null);return _&&_.active&&($.where=_),$}#ge(){const N=this.#$("groupBy",[]).length,$=[];for(const _ of this.#i.values())if(!(_.level!==N&&!_.flat))for(const Y of _.cache.ids()){if(!_.cache.loaded(Y))continue;const{start:Z,end:J}=_.cache.rangeOf(Y);for(let D=Z;D<J&&_.cache.rowLoaded(D);D++){const te=this.#G(_,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 _=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"&&(_+=J)}return _}residentRows(){const N=this.#N();return N?N.display():this.#$("groupBy",[]).length>0?null:(this.#re(),this.#ge())}#se(N,$,_){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:i(this.#$("filters",null),this.#J()),sort:this.#$("sort",[]),context:this.#$("context",null),signal:_};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 _=this.#o.begin(`${N.key}:${$}`);N.cache.begin($,_);const Y=this.#d,{start:Z}=N.cache.rangeOf($);try{const J=await this.#e.fetch(this.#se(N,$,_.signal));if(!_.current||Y!==this.#d||this.#p)return;_.settle();const D=J&&J.rows||[];if(!!(J&&J[G])&&!N.flat){N.flat=!0,N.children.clear();for(const[ne,re]of[...this.#c])re.startsWith(`${N.key}:`)&&(this.#a.delete(re),this.#c.delete(ne))}N.cache.fill($,D),N.failed=!1;for(let ne=0;ne<D.length;ne++)this.#a.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.#_e(J.pivotFields),J&&J.pivot&&typeof J.pivot=="object"&&this.#ae(J.pivot),this.#H("model:changed",{reason:"page",groupPath:N.path,block:$}),this.#H("rows:changed",{companion:!0,reason:"page",groupPath:N.path,block:$}),this.#fe(N),X&&this.#Me(N,X,Y)}catch(J){if(_.settle(),O(J))return;N.cache.failed($,J),N.failed=!0;const{end:D}=N.cache.rangeOf($);for(let te=Z;te<D;te++)this.#a.delete(`${N.key}:${te}`);this.#H("model:changed",{reason:"page-error",groupPath:N.path,block:$}),this.#H("source:error",{error:J,groupPath:N.path,block:$})}}async#Me(N,$,_){let Y;try{Y=await $}catch(Z){if(_!==this.#d||this.#p)return;N.counting=!1,O(Z)||(N.failed=!0),O(Z)||this.#H("source:error",{error:Z,groupPath:N.path});return}_!==this.#d||this.#p||(N.counting=!1,typeof Y=="number"&&(N.count=Y,N.complete=!0,this.#fe(N),this.#H("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.#H("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(!$&&!_)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,H)});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}#_e(N){N.length===this.#u.length&&N.every(($,_)=>$===this.#u[_])||(this.#u=N,this.#H("column:pivoted",{pivotFields:N,remote:!0}))}#Le(){const N=this.#t.config||{};return N.pivot&&N.pivot.separator||v}#Ce(N){const $=this.#Le(),_=this.#ve();if(!_.length)return N.slice();const Y=[];for(const Z of N)for(const J of _)Y.push(`${Z}${$}${J}`);return Y}#ae(N){const $=this.#Le();this.#f||(this.#f={keys:new Map,cells:new Map,result:null});const _=this.#f;let Y=!1;const Z=D=>{const te=Array.isArray(D)?D:[D],z=w(te,$);return _.keys.has(z)||(_.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||{}))_.cells.set(d(z,te,X),ne)}_.result=null,Y&&this.#_e((this.pivot()||{fields:[]}).fields)}#Ae(N){let $=this.#le(N);for(const _ of N.children.values())this.#Te(_.key,this.#we(_))&&($+=this.#Ae(_));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 _=$,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(_<z)return{node:N,local:Y+_};_-=z,Y=D+1;const X=this.#Ae(te);if(_<X)return this.#Z(te,_);_-=X}const J=this.#le(N);return Y+_<J?{node:N,local:Y+_}:null}#G(N,$){const _=`${N.key}:${$}`,Y=this.#a.get(_);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,re=[...N.path,ne?"":String(X)],ae=[...N.keyPath,ne?null:String(X)];if(D=this.#l.group({path:re,keyPath:ae,column:te,value:X,level:N.level,parent:N.row,leafCount:Number(Z.leafCount)||0,expanded:z?!1:this.#Te(r(ae),{key:r(ae),column:te,value:X,level:N.level,path:re}),...z?{hasChildren:!1}:{}}),D.totals=this.#ne(Z),D.data=Z,!z){let fe=this.#i.get(D.key);fe?fe.row=D:(fe=new S(re,N.level+1,this.#n,ae),fe.row=D,this.#i.set(fe.key,fe)),fe.values=[...N.values,X],N.children.set($,fe)}}else D=this.#l.leaf(Z,$,N.level,N.row);return this.#a.set(_,D),this.#c.set(D.key,_),D}#ne(N){const $=N||{};if($.totals&&typeof $.totals=="object")return $.totals;const _={};for(const Y of this.#ve())Object.hasOwn($,Y)&&(_[Y]=$[Y]);return _}#U(N){const $=this.#i.get(N.key);if(!$||$.row!==N||N.hasChildren===!1)return N;const _=this.#Te(N.key,this.#we($));return N.expanded!==_&&(N.expanded=_),N}#Ee(N,$){const{start:_,end:Y}=N.cache.rangeOf($);for(let Z=_;Z<Y;Z++){const J=`${N.key}:${Z}`,D=this.#a.peek(J);D&&this.#c.delete(D.key),this.#a.delete(J)}}#re(){const N=this.#be();return N===this.#d?!1:(this.#d=N,this.#o.abortAll("query"),this.#pe(),this.#m=!1,this.#H("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.#a.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 _=this.#$("expanded",null);return _?I(_.has)?_.has(N,$):Array.prototype.includes.call(_,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(_=>!!_.total).map(_=>_.id)}#Se(N){const $=this.#t.columns,_={};if(!$||!I($.get))return _;for(const Y of N){const Z=$.get(Y);if(!Z)continue;const J=Z.groupTotal!=null?Z.groupTotal:Z.total;typeof J=="string"?_[Y]=J:J&&typeof J=="object"&&typeof J.fn=="string"&&(_[Y]={...J})}return _}#ye(N,$){const _=this.#t.columns,Y=_&&I(_.get)?_.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 _=this.#t.state;if(_&&I(_[N])){const Y=_[N]();return Y??$}return $}#H(N,$){const _=this.#t.emit;I(_)&&_(N,$)}}}),He("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,x=ie){const Q=new E(I.length+Math.max(1,x));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,x){const Q=I<0?0:I>this.length?this.length:I;this.#r(Q),this.#t===this.#n&&this.#i(),this.#e[this.#t++]=x}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 x=this.#t-I;this.#e.copyWithin(this.#n-x,I,this.#t),this.#t=I,this.#n-=x}else{const x=I-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+x),this.#t=I,this.#n+=x}}#i(){const I=this.#e.length-this.#n,x=new Uint32Array(Math.max(this.#e.length*2,this.#e.length+ie));x.set(this.#e.subarray(0,this.#t),0),x.set(this.#e.subarray(this.#n),x.length-I),this.#e=x,this.#n=x.length-I}}}),He("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 a}}),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 r}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return i}});const ie=F("packages/core/src/internal/schedule.js"),E=ie.now,W=ie.nextFrame,I=F("packages/core/src/internal/warn.js"),x=I.infoOnce,Q=I.warnOnce,L=F("packages/core/src/internal/predicates.js").isFunction,M=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 a(n,m={}){if(m.multi)return"multi";if(n.length===0)return"object";let c=0,l=0,u=0,f=0,p=0;for(let h=0;h<n.length;h++){const d=n[h];typeof d=="number"?c++:typeof d=="boolean"?l++:typeof d=="string"?u++:d instanceof Date?f++:Array.isArray(d)&&p++}const y=n.length;return c===y?"float64":l===y?"bitset":f===y?"float64":u===y?"text":p===y?"multi":"object"}function g(n,m,c){return m<=0||n<c*m?"dictionary":"object"}function o(n,m,c){const l=new Map,u=new Map;for(const V of n){if(V.computed)continue;const K=L(V.read)?V.read:M(V.field||V.id);u.set(V.id,K),l.set(V.id,K)}const f=m?.order??[],p=m?.fns??{},y=m?.deps??{},h=m?.wrapDeps??null,d=f.filter(V=>L(p[V])),w=d.some(V=>y[V]==="*");let v=new WeakMap;const P=V=>{const K={};if(w)for(const[H,T]of u)K[H]=T(V);for(const H of d){const T=y[H];let A;if(T==="*")A=K;else{A={};const S=T||[];for(let R=0;R<S.length;R++){const j=S[R];A[j]=j in K?K[j]:u.get(j)?.(V)}}K[H]=p[H](h?h(A,H):A,{data:V,row:null,column:null,grid:null,context:c})}return K},G=V=>{if(V===null||typeof V!="object"&&typeof V!="function")return P(V);let K=v.get(V);return K===void 0&&(K=P(V),v.set(V,K)),K};for(const V of d)l.set(V,K=>G(K)[V]);return{readers:l,reset(){v=new WeakMap}}}class t{spec;read;kind;inferred;nullable;candidate=!1;distinct=null;change=null;reason="";constructor(m,c){this.spec=m,this.read=c,this.kind="object",this.inferred=!1,this.nullable=m.nullable!==!1}}class r{#e;#t=[];#n=null;#r;#i=0;#s;#o=!1;#l=!1;#a=0;#c;constructor(m,c={},l={}){this.#e=Array.isArray(m)?m:Array.from(m||[]),this.#s={...b,...l};const u=c.columns??[];this.#r=o(u,c.computed??null,c.context),this.#c=this.#e.length>=this.#s.columnarBelow,this.#u(u,c.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.#o||this.#l}get progress(){return this.#i}slice(){if(this.done)return!1;if(this.#s.signal?.aborted)return this.#l=!0,!1;const m=E(),{chunkMs:c,chunkRows:l}=this.#s,u=this.#e.length;do{const f=Math.min(this.#i+l,u);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<u&&E()-m<c);return this.#a+=E()-m,this.#s.onProgress?.({loaded:this.#i,total:u}),this.#i>=u?(this.#h(!0),this.#o=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(m=>({id:m.spec.id,kind:m.kind,nullable:m.nullable,read:m.read,dictionary:m.spec.dictionary})),decisions:this.#t.map(m=>({id:m.spec.id,kind:m.kind,nullable:m.nullable,inferred:m.inferred,distinct:m.candidate||m.change?this.#d(m):null,change:m.change,reason:m.reason})),count:this.#n.count,elapsed:this.#a,cancelled:this.#l}}#u(m,c){const l=this.#e,u=Math.min(this.#s.sampleSize,l.length),f=this.#s.dictionaryRatio,p=c?.pure instanceof Set?c.pure:new Set(c?.pure??c?.order??[]);for(const y of m){if(!y||!y.id)continue;if(y.computed&&(y.pure===!1||c&&!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)??(L(y.read)?y.read:M(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<u&&w.length<this.#s.sampleSize;P++){const G=h(l[P]);G!=null&&w.push(G)}d.inferred=!0;const v=a(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&&x(`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,c){const l=this.#e;for(const u of this.#t){if(!u.candidate||!u.distinct)continue;const f=u.distinct;for(let p=m;p<c;p++){const y=u.read(l[p]);y!=null&&f.add(y)}}}#d(m){if(m.distinct)return m.distinct.size;const c=this.#n.column(m.spec.id);return c?.dict?c.dict.size:0}#h(m){const c=this.#s.dictionaryRatio,l=this.#e.length;for(const u of this.#t){if(!u.candidate)continue;const f=this.#d(u);if(u.kind==="dictionary"&&f>=c*l){const p=this.#n.column(u.spec.id);u.distinct=new Set(p?.dict?p.dict.values():[]),this.#n.convert(u.spec.id,"object"),u.kind="object",u.change="demoted",u.reason=`${f} distinct values is at or above ${c*100}% of ${l} rows`;continue}if(u.kind==="object"&&f>=c*l){u.candidate=!1,u.distinct=null,u.reason=`${f} distinct values is at or above ${c*100}% of ${l} rows`;continue}m&&u.kind==="object"&&f<c*l&&(this.#n.convert(u.spec.id,"dictionary"),u.kind="dictionary",u.change=u.change==="demoted"?null:"promoted",u.reason=`${f} distinct values is below ${c*100}% of ${l} rows`,u.distinct=null),m&&(u.candidate=!1)}}}async function s(n,m={},c={}){const l=new r(n,m,c),u=c.scheduler?.frame??W;for(;l.slice();)await new Promise(f=>{u(f)});return l.result()}function i(n,m={},c={}){const l=new r(n,m,{...c,chunkMs:1/0});for(;l.slice(););return l.result()}}),He("packages/core/src/store/columnpack.js",function(e,F){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return g}});const E=F("packages/core/src/internal/paths.js").pathGetter,W=F("packages/core/src/store/ingest.js"),I=W.inferKind,x=W.decideText,Q=W.INGEST_DEFAULTS,L=F("packages/core/src/store/columnstore.js").toFloat,q=new Set(["float64","int32","bitset","dictionary","object","multi"]);function M(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 O(o){const t=L(o);return Number.isFinite(t)?t|0:0}function k(o){return o==null?[]:Array.isArray(o)?o:[o]}function b(o,t,r,s){if(o.kind)return o.kind;const i=[];for(let c=0;c<t.length&&i.length<Q.sampleSize;c++){const l=t[c];l!=null&&i.push(l)}const n=I(i,{multi:o.multi});if(n!=="text")return n;const m=new Set(i).size;return x(m,i.length,s)}function a(o,t,r={}){const s=t.length|0,i=r.dictionaryRatio??Q.dictionaryRatio,n=[];for(const m of o){const c=E(m.field||m.id),l=m.nullable!==!1,u=new Array(s);for(let d=0;d<s;d++){const w=c(t[d]);u[d]=w===void 0?null:w}const f=b(m,u,s,i),p=l?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=u[w],P=v===null;P||y(w),d[w]=P?NaN:L(v)}h={id:m.id,kind:f,nullable:l,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=u[w],P=v===null;P||y(w),d[w]=P?0:O(v)}h={id:m.id,kind:f,nullable:l,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=u[w],P=v===null;P||y(w),!P&&v&&(d[w>>3]|=1<<(w&7))}h={id:m.id,kind:f,nullable:l,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 G=u[P];if(G===null){d[P]=0;continue}y(P);let V=v.get(G);V===void 0&&(V=w.length,w.push(G),v.set(G,V)),d[P]=V}h={id:m.id,kind:f,nullable:l,values:d,presence:p,offsets:null,table:w};break}case"multi":{const d=[],w=new Map,v=new Uint32Array(s+1),P=[];for(let G=0;G<s;G++){const V=u[G];v[G]=P.length,V===null||y(G);const H=k(V);for(let T=0;T<H.length;T++){const A=H[T];let S=w.get(A);S===void 0&&(S=d.length,d.push(A),w.set(A,S)),P.push(S)}}v[s]=P.length,h={id:m.id,kind:f,nullable:l,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=u[w];v!==null&&y(w),d[w]=v}h={id:m.id,kind:"object",nullable:l,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 r=s=>{ArrayBuffer.isView(s)&&s.buffer&&!t.includes(s.buffer)&&t.push(s.buffer)};for(const s of o.columns)r(s.values),r(s.presence),r(s.offsets);return t}}),He("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 A}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return S}});const E=F("packages/core/src/internal/lru.js").Lru,I=F("packages/core/src/internal/predicates.js").isFunction,x=F("packages/core/src/internal/schedule.js"),Q=x.now,U=x.nextFrame,L=x.cancelFrame,q=x.whenIdle,O=F("packages/core/src/internal/compare.js").defaultCompare,k=F("packages/core/src/internal/warn.js"),b=k.warnOnce,a=k.infoOnce,o=F("packages/core/src/internal/paths.js").getPath,t=F("packages/core/src/source/abort.js"),r=t.createAbortScope,s=t.isAbortError,i=F("packages/core/src/source/rows.js"),n=i.createRowFactory,m=i.lazyRowView,l=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,G=.1,V=1e3,K=50;function H(R){return Math.min(V,Math.max(K,Math.floor(R/4)))}function T(R){if(R instanceof Date)return R.getTime();if(typeof R=="number")return Number.isFinite(R)?R:NaN;if(typeof R=="string"){const j=R.trim();if(!j)return NaN;const N=Date.parse(j);return Number.isNaN(N)?Number(j):N}return NaN}function A(R,j){return new S(R,j)}class S{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#i=[];#s=null;#o;#l;#a=new Map;#c=r();#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;#L=!1;#_=0;#F=0;#X=!1;constructor(j,N){this.#e=j||{mode:"stream"},this.#t=N||{},this.#o=n(this.#t),this.#l=new E(4096),this.#P=this.#qe();const $=(this.#t.config||{}).ingest;this.#L=!!$&&$.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 _=Number(this.#e.poll);Number.isFinite(_)&&_>0&&(this.#Y=setInterval(()=>{this.#v||this.reload()},_),this.#Y&&I(this.#Y.unref)&&this.#Y.unref()),this.#B()}#V(){const j=Number(this.#e.maxAge);return Number.isFinite(j)&&j>0?j:0}#B(){const j=this.#V();if(!j)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.#H())},H(j)),this.#R&&I(this.#R.unref)&&this.#R.unref()}#W(){const j=this.#V();return!j||!this.#T?!1:this.#N?!0:this.#M<Date.now()-j*(1+G)}#ge(j,N){if(!this.#T)return;const $=this.#D?T(this.#D(N)):Date.now();this.#T[j]=$,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 j=this.#se();if(j&&!this.#b){this.#b=f({mode:"memory",rows:this.#n},this.#Me()),this.#O=!1;return}!j&&this.#b&&(this.#b.destroy(),this.#b=null)}#Me(){if(this.#y)return this.#y;const j=this,N={liveIndices:()=>j.#fe(),live:$=>j.#n[$]!==void 0,source:$=>j.#ee($),get physical(){return j.#n.length}};return this.#L&&(N.column=$=>{const _=j.#t.store;return _&&I(_.column)?_.column($):void 0}),this.#y=Object.create(this.#t,{store:{value:N,enumerable:!0,configurable:!0}}),this.#y}#fe(){const j=new Uint32Array(this.#n.length);let N=0;for(let $=0;$<this.#n.length;$++)this.#n[$]!==void 0&&(j[N++]=$);return j.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(j="filter"){if(this.#g){this.#g.invalidate(j);return}this.#ue(),this.#b&&this.#b.invalidate(j),(j==="filter"||j==="sort")&&this.#Te()}count(){const j=this.#oe();return j?j.count():this.#r?this.#r.length:this.#S}matchCount(){const j=this.#oe();return j&&I(j.matchCount)?j.matchCount():this.#r?this.#r.length:this.#S}totalCount(){const j=this.#oe();return j&&I(j.totalCount)?j.totalCount():this.#S}unfilteredRows(){const j=this.#oe();if(j&&I(j.unfilteredRows))return j.unfilteredRows();const N=[];for(let $=0;$<this.#n.length;$++){if(!this.#n[$])continue;const _=this.#je($);_&&N.push(_)}return N}at(j){const N=this.#oe();if(N)return N.at(j);if(j<0||j>=this.count())return;const $=this.#r?this.#r.at(j):j,_=this.#je($);return _.index=j,_}byKey(j){const N=this.#oe();if(N)return N.byKey(j);const $=this.#a.get(j);return $===void 0?void 0:this.#je($)}leavesOf(j){const N=this.#oe();return N&&I(N.leavesOf)?N.leavesOf(j):[]}loaded(j){return j>=0&&j<this.count()}hint(j,N){if(this.#g){this.#g.hint(j,N);return}this.#_e(),this.#p=Math.max(0,Math.floor(j))}#_e(){this.#v||this.#qe()===this.#P||this.reload()}display(){const j=this.#oe();return j?j.display():m(()=>this.count(),N=>this.at(N))}apply(j){if(this.#g)return this.#g.apply(j);const N={added:[],updated:[],removed:[]};if(!j)return N;if(j.update){let $=!1;for(const _ of j.update){const Y=this.#a.get(this.#o.keyOf(_,-1));if(Y===void 0)continue;const Z=this.#Se(Y);this.#L?this.#xe(Y,_):this.#n[Y]=_,this.#l.delete(Y),this.#ye(Y,Z),this.#T&&(this.#ge(Y,_),$=!0),this.#O=!0,N.updated.push(this.#je(Y))}$&&this.#Ee()}if(j.add&&j.add.length){const $=this.#ne(j.add);for(const _ of $)N.added.push(this.#je(_))}return j.remove&&j.remove.length&&b("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#H(),N}reload(j){this.#c.abortAll("reload"),this.#Ye(),this.#b&&(this.#b.destroy(),this.#b=null),this.#O=!1,this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear(),this.#g=null,this.#S=0,this.#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.#a.clear(),this.#l.clear()}async start(){if(this.#A||this.#v||!I(this.#e.open))return;this.#A=!0;const j=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:j.signal})}catch(_){this.#Pe("source:error",{error:_});return}const $=I(N[Symbol.asyncIterator])?N[Symbol.asyncIterator]():N[Symbol.iterator]();this.#K=$;try{for(;;){const _=await $.next();if(!j.current||this.#v)return;if(_.done){this.#$();return}if(await this.#Le(_.value,j),!j.current||this.#v)return;if(_.value&&_.value.done){this.#$();return}if(await this.#he(),!j.current||this.#v)return}}catch(_){if(s(_))return;this.#Pe("source:error",{error:_})}finally{j.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 j=this.#oe();j&&(I(j.invalidateHandles)&&j.invalidateHandles(),I(j.invalidate)&&j.invalidate("sort"))}renderCount(){return this.#d}ingestStats(){return{worker:this.#_,inline:this.#F,storeBacked:this.#L}}#Le(j,N){if(!j)return;const $=j.rows;if($&&$.length&&this.#ae($))return this.#le(j,N);const _=Q();$&&$.length&&(this.#ne($),this.#F++),this.#Ce(j),this.#h+=Q()-_,this.#H()}#Ce(j){this.#u.loaded=j.progress&&typeof j.progress.loaded=="number"?j.progress.loaded:this.#n.length,j.progress&&typeof j.progress.estimated=="number"&&(this.#u.estimated=j.progress.estimated)}#ae(j){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 _=this.#G();return!_||!d(_)?(this.#X=!0,a("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):j.length<N.threshold?!1:!this.#Ae(j)}#Ae(j){if(!this.#o.keyed)return!1;const N=new Set;for(let $=0;$<j.length;$++){const _=this.#o.keyOf(j[$],this.#n.length+$);if(_!=null){if(N.has(_)||this.#a.has(_))return!0;N.add(_)}}return!1}async#le(j,N){const $=j.rows,_=this.#Z(),Y=this.#G();let Z;try{Z=await _.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(j),this.#H();return}if(N&&(!N.current||this.#v))return;const J=this.#t.store,D=this.#L?void 0:$,{from:te}=J.appendPacked(Z,D),z=Z.count|0;for(let X=0;X<z;X++){const ne=te+X,re=$[X],ae=this.#o.keyed?this.#o.keyOf(re,ne):null;if(this.#n[ne]=this.#L?v:re,this.#S++,this.#ge(ne,re),ae!==null&&this.#a.set(ae,ne),!this.#r||!this.#we(ne))continue;const fe=this.#de(ne);this.#r.insert(fe,ne),fe<=this.#p&&this.#m++}this.#O=!0,this.#Ee(),this.#_++,this.#Ce(j),this.#H()}#Z(){const j=this.#t.ingestWorker;return I(j)?j():null}#G(){const j=this.#t.storeSchema;return I(j)?j():null}#ne(j){const N=[],$=this.#t.store,_=new Array(j.length),Y=[],Z=new Set;for(let D=0;D<j.length;D++){const te=this.#o.keyed?this.#o.keyOf(j[D],this.#n.length+Y.length):null;_[D]=te,!(te!==null&&(this.#a.has(te)||Z.has(te)))&&(te!==null&&Z.add(te),Y.push(j[D]))}let J=Y.length&&$&&I($.append)?$.append(Y).from:this.#n.length;for(let D=0;D<j.length;D++){const te=j[D],z=_[D];if(z!==null&&this.#a.has(z)){const re=this.#a.get(z),ae=this.#Se(re);this.#L||(this.#n[re]=te,$&&I($.setSource)&&$.setSource(re,te)),this.#xe(re,te),this.#l.delete(re),this.#ge(re,te),this.#ye(re,ae);continue}const X=J++;if(this.#n[X]=this.#L?v:te,this.#S++,this.#ge(X,te),z!==null&&this.#a.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(j){const N=this.#n[j];let $=!1;if(this.#r){const J=this.#be(j);J>=0&&J<=this.#p&&($=!0)}else j<=this.#p&&($=!0);const _=N===v?this.#ee(j):N,Y=this.#o.keyed?this.#o.keyOf(_,j):null;Y!==null&&this.#a.get(Y)===j&&this.#a.delete(Y),this.#n[j]=void 0,this.#T&&(this.#T[j]=NaN),this.#l.delete(j);const Z=this.#t.store;return Z&&I(Z.remove)&&Z.remove(j),this.#S--,$}#Ee(){let j=0,N=0;const $=this.#pe();j+=$.dropped,N+=$.aboveAnchor;const _=this.#re();j+=_.dropped,N+=_.aboveAnchor,j&&(this.#O=!0,this.#C+=j,this.#Te(),this.#m-=N,this.#Pe("stream:evicted",{evicted:j,total:this.#C,live:this.#S}))}#re(){const j=this.#e.maxRows;if(!Number.isFinite(j)||j<=0||this.#S<=j)return{dropped:0,aboveAnchor:0};const N=Math.max(1,Math.floor(j*(1-G)));let $=0,_=0;for(;this.#S>N&&this.#E<this.#n.length;){const Y=this.#E++;this.#n[Y]!==void 0&&(this.#U(Y)&&_++,$++)}return{dropped:$,aboveAnchor:_}}#pe(){const j=this.#V();if(!j||!this.#T||!this.#W())return{dropped:0,aboveAnchor:0};const N=Date.now()-j;let $=0,_=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)&&_++,$++}}for(this.#M=Y,this.#N=!1;this.#E<this.#n.length&&this.#n[this.#E]===void 0;)this.#E++;return{dropped:$,aboveAnchor:_}}#be(j){if(!this.#r)return j;for(let N=0;N<this.#r.length;N++)if(this.#r.at(N)===j)return N;return-1}#Te(){this.#i=this.#Oe("sort",[]),this.#s=this.#Oe("filters",null);const j=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#V()>0,N=this.#Oe("where",null),$=(this.#t.config||{}).hostFilter,_=!!(N&&N.active)||!!($&&I($.active)&&$.active());if(!(j||this.#i.length>0||!!this.#s||!!this.#Oe("quick","")||_)){this.#r=null;return}this.#r=new l(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(j){const N=this.#ee(j);if(this.#s&&!this.#ve(this.#s,N))return!1;const $=String(this.#Oe("quick","")||"").toLowerCase();if($&&!this.#k(N).includes($))return!1;const _=(this.#t.config||{}).hostFilter;if(_&&I(_.active)&&_.active()&&!_.passes(this.#je(j)))return!1;const Y=this.#Oe("where",null);if(Y&&Y.active){const Z=this.#je(j);if(!Y.passes(Z.data,Z.key))return!1}return!0}#ve(j,N){if(!j)return!0;const $=j;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 _=j,Y=(this.#t.compute||{}).testValue;return I(Y)?!!Y(this.#Ve(N,_.col),_,(this.#t.config||{}).locale):(b("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#Se(j){if(!this.#r)return-1;if(!this.#i.length)return this.#be(j);let N=0,$=this.#r.length;for(;N<$;){const _=N+$>>>1;this.#J(this.#r.at(_),j)<0?N=_+1:$=_}for(let _=N;_<this.#r.length;_++){const Y=this.#r.at(_);if(Y===j)return _;if(this.#J(Y,j)>0)break}return this.#be(j)}#ye(j,N){if(!this.#r||!this.#i.length)return;const $=this.#we(j);if(N>=0&&this.#r.at(N)===j)this.#r.removeAt(N),N<=this.#p&&this.#m--;else if(N>=0)return;if(!$)return;const _=this.#de(j);this.#r.insert(_,j),_<=this.#p&&this.#m++}#de(j){if(!this.#r||!this.#i.length)return this.#r?this.#r.length:0;let N=0,$=this.#r.length;for(;N<$;){const _=N+$>>>1;this.#J(j,this.#r.at(_))<0?$=_:N=_+1}return N}#J(j,N){const $=this.#ee(j),_=this.#ee(N);for(const Y of this.#i){const Z=this.#Ie(Y.col),J=this.#Ve($,Y.col),D=this.#Ve(_,Y.col),z=(Z&&Z.value&&I(Z.value.compare)?Z.value.compare:O)(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 j=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:w;!this.#L&&this.#n.length<j&&(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.#H(),this.#Pe("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:j})}#H(){this.#f!==null||this.#v||(this.#f=this.#I(()=>{this.#f=null,this.#d++;const j=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:j,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(j=>{const N=(this.#t.scheduler||{}).idle;I(N)?N(()=>j()):q(()=>j())}))}#ie(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:P}#I(j){const N=this.#t.scheduler||{};return I(N.frame)?N.frame(j):U(j)}#ke(j){const N=this.#t.scheduler||{};I(N.cancel)?N.cancel(j):L(j)}#ee(j){const N=this.#n[j];if(N!==void 0&&N!==v)return N;if(N===void 0)return;const $=this.#t.store;return $&&I($.source)?$.source(j):void 0}#xe(j,N){const $=this.#t.store;if(!$||!I($.set))return;const _=this.#G();if(Array.isArray(_))for(const Y of _){if(!Y||!Y.id)continue;const Z=I(Y.read)?Y.read:J=>o(J,Y.field||Y.id);$.set(Y.id,j,Z(N))}}#je(j){let N=this.#l.get(j);return N||(N=this.#o.leaf(this.#ee(j),j),this.#l.set(j,N)),N}#Ve(j,N){const $=this.#Ie(N);return $&&I($.getValue)?$.getValue(j):j?.[N]}#k(j){const N=this.#t.columns,$=N&&I(N.all)?N.all():[],_=[];for(const Y of $){const Z=I(Y.getValue)?Y.getValue(j):void 0;Z!=null&&Z!==""&&_.push(String(Z))}return _.join(" ").toLowerCase()}#Ie(j){const N=this.#t.columns;return N&&I(N.get)?N.get(j):void 0}#Ye(){const j=this.#K;if(this.#K=null,j&&I(j.return))try{j.return()}catch{}}#qe(){return y({context:this.#Oe("context",null)})}#Oe(j,N){const $=this.#t.state;if($&&I($[j])){const _=$[j]();return _??N}return N}#Pe(j,N){const $=this.#t.emit;I($)&&$(j,N)}}}),He("packages/core/src/source/url.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return b}});const E=F("packages/core/src/internal/warn.js").warnOnce,W=F("packages/core/src/internal/predicates.js"),I=W.isObject,x=W.isFunction,U=F("packages/core/src/internal/paths.js").getPath,q=F("packages/core/src/source/abort.js").isAbortError,M=500,O=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=x(h.fetch)?h.fetch:typeof globalThis<"u"&&x(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=x(h.map)?h.map:void 0,G=I(h.headers)?h.headers:void 0,V=Number.isFinite(h.batchSize)&&h.batchSize>0?Math.floor(h.batchSize):M,K=h.lenient===!0,H=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*A(R={}){if(!T)return;if(!d)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const j=R&&R.signal;let N;try{N=await d(p,G?{signal:j,headers:G}:{signal:j})}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 $=a(p,w,N),_=N.body&&x(N.body.getReader)?N.body.getReader():null;try{if(!_){const J=await N.text();($||t(J,p))==="ndjson"?yield*c(null,null,J,0,N,p,V,K):yield*m(J,p,v,P);return}const Y=new TextDecoder("utf-8");if($==="json"){yield*m(await n(_,Y,""),p,v,P);return}if($==="ndjson"){yield*c(_,Y,"",0,N,p,V,K);return}const Z=await r(_,Y,p);Z.format==="json"?yield*m(await n(_,Y,Z.seed),p,v,P):yield*c(_,Y,Z.seed,Z.bytes,N,p,V,K)}finally{if(_&&x(_.cancel))try{await _.cancel()}catch{}}}const S={mode:"stream",open:A,autoStart:h.autoStart!==!1};return H!==void 0&&(S.poll=H),Number.isFinite(h.maxRows)&&(S.maxRows=h.maxRows),Number.isFinite(h.maxAge)&&(S.maxAge=h.maxAge),(typeof h.ageBy=="string"||x(h.ageBy))&&(S.ageBy=h.ageBy),Number.isFinite(h.coalesceMs)&&(S.coalesceMs=h.coalesceMs),Number.isFinite(h.promoteToMemoryBelow)&&(S.promoteToMemoryBelow=h.promoteToMemoryBelow),S}function a(p,y,h){if(y)return y;const d=g(p);if(d)return d;const w=h&&h.headers&&x(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(O.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 r(p,y,h){let d="",w=0;for(;;){const{value:P,done:G}=await p.read();if(P&&(w+=P.byteLength,d+=y.decode(P,{stream:!0})),G){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,i);continue}if(m==="."&&s[n+1]>="0"&&s[n+1]<="9"){n=k(s,n,i);continue}if(m==='"'||m==="'"){n=b(s,n,i);continue}if(m==="["){const l=s.indexOf("]",n+1);if(l<0)throw new q("a [column reference] was opened and never closed",n);i.push({kind:W,value:s.slice(n+1,l).trim(),at:n}),n=l+1;continue}if(O(m)){n=a(s,n,i);continue}const c=s.slice(n,n+2);if(U.includes(c)){i.push({kind:x,value:c==="!="?"<>":c,at:n}),n+=2;continue}if(L.includes(m)){i.push({kind:x,value:m,at:n}),n++;continue}throw new q(`unexpected character ${JSON.stringify(m)}`,n)}return i.push({kind:Q,value:null,at:s.length}),i}function O(s){return/[A-Za-z_À-]/.test(s)}function k(s,i,n){let m=i,c=!1;for(;m<s.length;){const l=s[m];if(l>="0"&&l<="9"){m++;continue}if(l==="."&&!c){c=!0,m++;continue}if((l==="e"||l==="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(i,m)),at:i}),m}function b(s,i,n){const m=s[i];let c=i+1,l="";for(;c<s.length;){if(s[c]===m){if(s[c+1]===m){l+=m,c+=2;continue}return n.push({kind:E,value:l,at:i}),c+1}l+=s[c],c++}throw new q("a string was opened and never closed",i)}function a(s,i,n){let m=i;for(;m<s.length&&/[A-Za-z0-9_.À-]/.test(s[m]);)m++;const c=s.slice(i,m);let l=m;for(;l<s.length&&s[l]===" ";)l++;return n.push({kind:s[l]==="("?I:W,value:c,at:i}),m}const g={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function o(s){const i=String(s??"").replace(/^\s*=/,"");if(!i.trim())throw new q("the formula is empty");const n=M(i);let m=0;const c=()=>n[m],l=()=>n[m++],u=v=>{const P=c();if(P.kind!==x||P.value!==v)throw new q(`expected ${JSON.stringify(v)}`,P.at);m++},f=v=>{let P=p();for(;;){const G=c();if(G.kind!==x)break;const V=g[G.value];if(!V||V<v)break;m++;const K=f(G.value==="^"?V:V+1);P={kind:"bin",op:G.value,left:P,right:K}}return P},p=()=>{const v=c();return v.kind===x&&(v.value==="-"||v.value==="+")?(m++,{kind:"unary",op:v.value,arg:p()}):y()},y=()=>{let v=h();for(;c().kind===x&&c().value==="%";)m++,v={kind:"unary",op:"%",arg:v};return v},h=()=>{const v=l();if(v.kind===ie)return{kind:"num",value:v.value};if(v.kind===E)return{kind:"str",value:v.value};if(v.kind===W)return{kind:"ref",name:v.value};if(v.kind===I){u("(");const P=[];if(!(c().kind===x&&c().value===")"))for(;;){if(P.push(f(1)),c().kind===x&&c().value===","){m++;continue}break}return u(")"),{kind:"call",name:String(v.value).toUpperCase(),args:P}}if(v.kind===x&&v.value==="("){const P=f(1);return u(")"),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=c();if(w.kind!==Q)throw new q(`unexpected ${JSON.stringify(w.value)}: is an operator missing?`,w.at);return d}function t(s){const i=new Set,n=m=>{if(!(!m||typeof m!="object")){if(m.kind==="ref"){i.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 c of m.args)n(c)}};return n(s),[...i]}function r(s){return typeof s=="string"&&/^\s*=/.test(s)&&s.trim()!=="="}}),He("packages/core/src/formula/evaluate.js",function(e,F){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return k}});const E=F("packages/core/src/formula/parse.js").FormulaError;function W(b){if(b==null||b==="")return 0;if(typeof b=="boolean")return b?1:0;if(b instanceof Date)return b.getTime();const a=typeof b=="number"?b:Number(String(b).replace(/[,\s]/g,""));if(!Number.isFinite(a))throw new E(`${JSON.stringify(b)} is not a number`);return a}function I(b){return b==null?"":String(b)}function x(b){if(typeof b=="boolean")return b;if(b==null||b==="")return!1;if(typeof b=="number")return b!==0;const a=String(b).trim().toLowerCase();return a==="false"||a==="no"||a==="0"?!1:a!==""}function Q(b){const a=[];for(const g of b){if(Array.isArray(g)){for(const o of g)o!=null&&o!==""&&a.push(W(o));continue}g==null||g===""||a.push(W(g))}return a}function U(b,a){const g=10**a,o=b*g;return Math.sign(o)*Math.round(Math.abs(o)+Number.EPSILON*Math.abs(o))/g}function L(b,a){if(!b.length)return 0;const g=b.slice().sort((s,i)=>s-i),o=(g.length-1)*Math.min(1,Math.max(0,a)),t=Math.floor(o),r=Math.ceil(o);return t===r?g[t]:g[t]+(o-t)*(g[r]-g[t])}function q(b,a){let g=0,o=0,t=0;for(const s of b){g++;const i=s-o;o+=i/g,t+=i*(s-o)}const r=a?g-1:g;return r>0?Math.sqrt(t/r):0}const M={SUM:b=>Q(b).reduce((a,g)=>a+g,0),AVERAGE:b=>{const a=Q(b);return a.length?a.reduce((g,o)=>g+o,0)/a.length:0},MIN:b=>{const a=Q(b);return a.length?Math.min(...a):0},MAX:b=>{const a=Q(b);return a.length?Math.max(...a):0},COUNT:b=>Q(b).length,PRODUCT:b=>Q(b).reduce((a,g)=>a*g,1),ROUND:b=>U(W(b[0]),b.length>1?W(b[1]):0),ROUNDDOWN:b=>{const a=10**(b.length>1?W(b[1]):0),g=W(b[0])*a;return(g<0?Math.ceil(g):Math.floor(g))/a},ROUNDUP:b=>{const a=10**(b.length>1?W(b[1]):0),g=W(b[0])*a;return(g<0?Math.floor(g):Math.ceil(g))/a},ABS:b=>Math.abs(W(b[0])),FLOOR:b=>Math.floor(W(b[0])),CEILING:b=>Math.ceil(W(b[0])),SQRT:b=>Math.sqrt(W(b[0])),POWER:b=>W(b[0])**W(b[1]),MOD:b=>{const a=W(b[1]);if(a===0)throw new E("MOD by zero");return(W(b[0])%a+a)%a},IF:b=>x(b[0])?b[1]:b.length>2?b[2]:!1,AND:b=>b.every(x),OR:b=>b.some(x),NOT:b=>!x(b[0]),COALESCE:b=>b.find(a=>a!=null&&a!=="")??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?W(b[1]):1),RIGHT:b=>{const a=b.length>1?W(b[1]):1;return a<=0?"":I(b[0]).slice(-a)},MEDIAN:b=>L(Q(b),.5),PERCENTILE:b=>{const a=W(b[b.length-1]);return L(Q(b.slice(0,-1)),a>1?a/100:a)},QUARTILE1:b=>L(Q(b),.25),QUARTILE3:b=>L(Q(b),.75),STDEV:b=>q(Q(b),!0),STDEVP:b=>q(Q(b),!1),VAR:b=>{const a=q(Q(b),!0);return a*a},VARP:b=>{const a=q(Q(b),!1);return a*a},COUNTDISTINCT:b=>{const a=new Set;for(const g of b){const o=Array.isArray(g)?g:[g];for(const t of o)t!=null&&t!==""&&a.add(t)}return a.size},IQR:b=>{const a=Q(b);return L(a,.75)-L(a,.25)}};M.AVG=M.AVERAGE,M.CEIL=M.CEILING,M.POW=M.POWER,M.STDEVS=M.STDEV,M.PERCENTILEINC=M.PERCENTILE;function O(b,a){const g=Number(b),o=Number(a);if(b!==null&&b!==""&&a!==null&&a!==""&&Number.isFinite(g)&&Number.isFinite(o))return g<o?-1:g>o?1:0;const r=I(b).toLowerCase(),s=I(a).toLowerCase();return r<s?-1:r>s?1:0}function k(b,a={}){const g=typeof a.lookup=="function"?a.lookup:null,o=a.functions?{...M,...a.functions}:M,t=r=>{switch(r.kind){case"num":return r.value;case"str":return r.value;case"ref":{if(!g)throw new E(`there is no column called ${JSON.stringify(r.name)} here`);const s=g(String(r.name));if(s===void 0)throw new E(`there is no column called ${JSON.stringify(r.name)}`);return s}case"unary":{if(r.op==="%")return W(t(r.arg))/100;const s=W(t(r.arg));return r.op==="-"?-s:s}case"bin":{const s=r.op;if(s==="=")return O(t(r.left),t(r.right))===0;if(s==="<>")return O(t(r.left),t(r.right))!==0;if(s==="<")return O(t(r.left),t(r.right))<0;if(s==="<=")return O(t(r.left),t(r.right))<=0;if(s===">")return O(t(r.left),t(r.right))>0;if(s===">=")return O(t(r.left),t(r.right))>=0;const i=W(t(r.left)),n=W(t(r.right));if(s==="+")return i+n;if(s==="-")return i-n;if(s==="*")return i*n;if(s==="^")return i**n;if(s==="/"){if(n===0)throw new E("division by zero");return i/n}throw new E(`unknown operator ${JSON.stringify(s)}`)}case"call":{const s=a.lazy&&a.lazy[r.name];if(typeof s=="function")return s(r.args,t,a);const i=o[r.name];if(typeof i!="function")throw new E(`there is no function called ${r.name}`);return i(r.args.map(t),a)}default:throw new E("the formula could not be read")}};return t(b)}}),He("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 W}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return O}});const ie=F("packages/core/src/formula/parse.js"),E=ie.parseFormula,W=ie.referencesOf,I=ie.looksLikeFormula,x=ie.FormulaError,Q=ie.tokenise,U=F("packages/core/src/formula/evaluate.js"),L=U.evaluateAst,q=U.FUNCTIONS;function M(k){const{grid:b,row:a,data:g}=k||{},o=n=>String(n).toLowerCase().replace(/[\s_-]/g,""),t=b&&b.columns&&typeof b.columns.all=="function"?b.columns.all():[],r=b&&b.permissions,s=r&&typeof r.isReadable=="function"?n=>r.isReadable(n):()=>!0,i=new Set;for(const n of t)s(n)||(i.add(o(n.id)),n.field&&i.add(o(n.field)),n.title&&i.add(o(n.title)));return n=>{const m=o(n);if(i.has(m))throw new x(`"${n}" cannot be read`);for(const c of t)if(o(c.id)===m||c.field&&o(c.field)===m||c.title&&o(c.title)===m)return a&&b.rows&&typeof b.rows.value=="function"?b.rows.value(a.key,c.id):g?g[c.field||c.id]:void 0;if(g&&typeof g=="object"){for(const c of Object.keys(g))if(o(c)===m){if(!s(c))throw new x(`"${n}" cannot be read`);return g[c]}}}}function O(k,b={}){try{const a=E(k);return{ok:!0,value:L(a,{lookup:M(b),functions:b.formulaFunctions}),references:W(a)}}catch(a){return{ok:!1,error:a instanceof x?a.message:"the formula could not be read",at:a instanceof x?a.at:void 0}}}}),He("packages/core/src/internal/version.js",function(e,F){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return W}});const ie="1.117.3";async function E(){return ie}const W="1.117.3"}),He("packages/core/src/internal/merge.js",function(e,F){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return W}}),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 W(L,q,M){if(L!==void 0)return L===!0?{enabled:!0,...M}:L===!1?{enabled:!1}:E(L)?L:{[q]:L,enabled:!0}}function I(L){return L==null?[]:Array.isArray(L)?L:[L]}const x=Object.freeze(new Set(["__proto__","constructor","prototype"]));function Q(L,q){if(!E(L))return E(q)?{...q}:q;if(!E(q))return q===void 0?L:q;const M={...L};for(const O of Object.keys(q)){if(x.has(O))continue;const k=q[O];k!==void 0&&(M[O]=E(k)&&E(M[O])?Q(M[O],k):k)}return M}function U(L,q){if(!E(L)||!E(q)||L===q)return q;const M=Object.create(Object.getPrototypeOf(L));return Object.assign(M,L,q),M}}),He("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 W}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return U}});function ie(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const E=typeof requestAnimationFrame=="function";function W(L){return E?requestAnimationFrame(L):setTimeout(()=>L(ie()),16)}function I(L){L!=null&&(E?cancelAnimationFrame(L):clearTimeout(L))}function x(L){let q=null,M=null;const O=()=>{q=null;const b=M;M=null,L(...b||[])},k=(...b)=>{M=b,q===null&&(q=W(O))};return k.cancel=()=>{I(q),q=null,M=null},k.flush=()=>{q!==null&&(I(q),O())},k}function Q(L,q){let M=null,O=null;const k=()=>{if(M=null,O===null)return;const g=O;O=null,L(...g),b()},b=()=>{M=setTimeout(k,q),typeof M?.unref=="function"&&M.unref()},a=(...g)=>{M===null?(L(...g),b()):(O=g,clearTimeout(M),b())};return a.flush=()=>{if(M!==null&&clearTimeout(M),M=null,O===null)return;const g=O;O=null,L(...g)},a.cancel=()=>{M!==null&&clearTimeout(M),M=null,O=null},a.pending=()=>M!==null||O!==null,a}function U(L,q=50){return typeof requestIdleCallback=="function"?requestIdleCallback(L,{timeout:q}):setTimeout(()=>L({timeRemaining:()=>0,didTimeout:!0}),1)}}),He("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 x}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return Q}});const ie=new Map;function E(U){let L=ie.get(U);if(L)return L;if(!U.includes("."))L=q=>q?.[U];else{const q=U.split("."),M=q.length;L=O=>{let k=O;for(let b=0;b<M;b++){if(k==null)return;k=k[q[b]]}return k}}return ie.set(U,L),L}const W=new Map;function I(U){let L=W.get(U);if(L)return L;if(!U.includes("."))L=(q,M)=>{q!=null&&(q[U]=M)};else{const q=U.split("."),M=q.length-1;L=(O,k)=>{let b=O;for(let a=0;a<M;a++){if(b==null)return;const g=q[a];b[g]==null&&(b[g]={}),b=b[g]}b!=null&&(b[q[M]]=k)}}return W.set(U,L),L}function x(U,L){return E(L)(U)}function Q(U,L,q){I(L)(U,q)}}),He("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 W}});const ie=new Map;function E(I,x){const Q=`${I||""}|${x?JSON.stringify(x):""}`;let U=ie.get(Q);return U||(U=new Intl.Collator(I||void 0,{numeric:!0,sensitivity:"variant",...x}),ie.set(Q,U)),U}function W(I,x){if(I===x)return 0;if(I==null)return 1;if(x==null)return-1;if(typeof I=="number"&&typeof x=="number")return Number.isNaN(I)?Number.isNaN(x)?0:1:Number.isNaN(x)||I<x?-1:I>x?1:0;const Q=String(I),U=String(x);return Q<U?-1:Q>U?1:0}}),He("packages/core/src/defaults.js",function(e,F){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return O}});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 L extends Error{}function q(k,b=new Set){if(Array.isArray(k)){if(b.has(k))throw new L;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 L;b.add(k);const a={};for(const[g,o]of Object.entries(k))a[g]=q(o,b);return b.delete(k),a}function M(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 L))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 O(k){return U===null?k:I(q(U),k)}}),He("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(W="l"){return`${W}${(++ie).toString(36)}`}}),He("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 W}});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 W(I){return I==="*"||E.has(I)}}),He("packages/core/src/events/bus.js",function(e,F){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return g}});const ie=F("packages/core/src/internal/warn.js"),E=ie.warnOnce,W=ie.DEV,x=F("packages/core/src/internal/uid.js").uid,U=F("packages/core/src/events/names.js").isKnownEvent,L="*";function q(o,t){!W||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 M=new Set(["api","user","init","ai"]),O=new WeakMap;function k(o){let t=O.get(o);return t||(t=x("h"),O.set(o,t)),t}function b(){return typeof performance=="object"&&performance?performance.now():Date.now()}function a(o){if(!o||typeof o!="object")return{};const t={};for(const[r,s]of Object.entries(o))r!=="grid"&&(s==null?t[r]=String(s):Array.isArray(s)?t[r]=`[${s.length}]`:typeof s=="object"?t[r]=s.key?`row ${s.key}`:"{…}":typeof s=="function"?t[r]="[function]":t[r]=String(s).slice(0,60));return t}class g{#e=new Map;#t=!1;#n=[];#r=200;#i=new Map;#s=null;#o=!1;#l=0;constructor(t=null){this.#s=t}attach(t){this.#s=t}get grid(){return this.#s}get destroyed(){return this.#o}on(t,r){if(typeof r!="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(r),()=>this.off(t,r)}once(t,r){if(typeof r!="function")return E(`bus.handler:${t}`,`once('${t}') needs a function; ignored.`),()=>{};q("once",t);const s=i=>{this.off(t,r),r(i)};return this.#i.set(r,s),this.on(t,s)}off(t,r){if(r===void 0){this.#e.delete(t);return}const s=this.#e.get(t);if(!s)return;const i=this.#i.get(r),n=i&&s.includes(i)?i:r,m=s.indexOf(n);m>=0&&s.splice(m,1),i&&n===i&&this.#i.delete(r),s.length===0&&this.#e.delete(t)}count(t){const r=this.#e.get(t),s=t===L?null:this.#e.get(L);return(r?r.length:0)+(s?s.length:0)}#a(t,r,s,i,n){this.#n.push({type:t,origin:r,listeners:(i?i.length:0)+(n?n.length:0),payload:a(s),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(t,r){this.#t=!!t,Number.isFinite(r)&&r>0&&(this.#r=Math.floor(r)),t||(this.#n=[])}eventLog(){return this.#n.map(t=>({...t}))}clearEventLog(){this.#n=[]}counts(){const t={};for(const[r,s]of this.#e)t[r]=s.length;return t}emit(t,r,s){const i=s??(r&&r.origin),n=M.has(i)?i:"api",m={...r||null,type:t,origin:n,grid:this.#s};if(this.#o)return m;const c=this.#e.get(t),l=t===L?void 0:this.#e.get(L);if(this.#t&&this.#a(t,n,r,c,l),!c&&!l)return m;const u=this.#t?b():0;this.#l++;try{c&&this.#c(c.slice(),m,t),l&&this.#c(l.slice(),m,L)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=b()-u)}return m}emitBefore(t,r,s){const i=s??(r&&r.origin),n=M.has(i)?i:"user";let m=!1,c=null;const l=d=>{m=!0,d!=null&&c===null&&(c=String(d))},u={...r||null,type:t,origin:n,grid:this.#s,get defaultPrevented(){return m},get reason(){return c},preventDefault(d){l(d)}};if(this.#o)return!0;const f=this.#e.get(t);this.#t&&this.#a(t,n,r,f,void 0);const p=f?f.slice():[];if(p.length===0)return!0;const y=()=>(m&&c===null&&(c="prevented"),m&&r&&typeof r=="object"&&(r.reason=c),!m),h=[];for(const d of p)try{const w=d(u);w&&typeof w.then=="function"?h.push(w):w===!1&&l("prevented")}catch(w){l("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"?(l("error"),E(`bus.beforeReject:${t}`,`a '${t}' before-handler rejected; the action was cancelled.`,w.reason)):w.value===!1&&l("prevented");return y()})}#c(t,r,s){for(let i=0;i<t.length;i++)try{t[i](r)}catch(n){E(`bus.throw:${s}:${k(t[i])}`,`a '${s}' handler threw; other handlers were unaffected.`,n)}}clear(){this.#e.clear(),this.#i.clear()}destroy(){this.clear(),this.#o=!0,this.#s=null}}}),He("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"}),He("packages/core/src/registry/licence.js",function(e,F){"use strict";Object.defineProperty(e,"PRODUCT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"LICENCE_VERSION",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return 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 a}}),Object.defineProperty(e,"parseLicence",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"hasEd25519",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"verifyLicence",{enumerable:!0,get:function(){return u}}),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 G}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return T}});const E=F("packages/core/src/internal/warn.js").warnOnce,W=F("packages/core/src/registry/free-tier-notice.js"),I=W.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return W.FREE_TIER_NOTICE}});const x="lattice-grid",Q=1,U="LG1",L=64,q="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",O=(()=>{const A=new Int16Array(128).fill(-1);for(let S=0;S<M.length;S++)A[M.charCodeAt(S)]=S;return A[43]=62,A[47]=63,A})();function k(A){if(typeof A!="string")return null;let S="";for(let Y=0;Y<A.length;Y++){const Z=A.charCodeAt(Y);if(Z!==61){if(Z>127||O[Z]<0)return null;S+=A[Y]}}const R=S.length;if(R%4===1)return null;const j=new Uint8Array(Math.floor(R*3/4));let N=0,$=0,_=0;for(let Y=0;Y<R;Y++)N=N<<6|O[S.charCodeAt(Y)],$+=6,$>=8&&($-=8,j[_++]=N>>$&255);return _===j.length?j:j.subarray(0,_)}function b(A){let S="",R=0;for(;R+2<A.length;R+=3){const N=A[R]<<16|A[R+1]<<8|A[R+2];S+=M[N>>18&63]+M[N>>12&63]+M[N>>6&63]+M[N&63]}const j=A.length-R;if(j===1){const N=A[R]<<16;S+=M[N>>18&63]+M[N>>12&63]}else if(j===2){const N=A[R]<<16|A[R+1]<<8;S+=M[N>>18&63]+M[N>>12&63]+M[N>>6&63]}return S}function a(A){const S=new Uint8Array(A.length);for(let R=0;R<A.length;R++)S[R]=A.charCodeAt(R)&127;return S}function g(A){if(typeof TextDecoder=="function")return new TextDecoder().decode(A);let S="";for(let R=0;R<A.length;R++)S+=String.fromCharCode(A[R]);return S}function o(A){const S={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof A=="string"?A:""};if(typeof A!="string"||A.length===0)return{...S,reason:"missing"};const R=A.trim(),j=R.split(".");if(j.length!==3)return S;const[N,$,_]=j;if(N!==U)return{...S,reason:"prefix"};const Y=k($),Z=k(_);if(!Y||!Z)return S;let J;try{J=JSON.parse(g(Y))}catch{return S}return J===null||typeof J!="object"?S:{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:a($),signature:Z,raw:R}}function t(A,S){if(!A)return!1;const R=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(A)?`${A}T23:59:59.999Z`:A);return Number.isNaN(R)?!0:S>R}function r(A){return A==="non-commercial"?"non-commercial":"commercial"}let s=null,i=null,n=null;function m(){const A=globalThis.crypto;return A&&A.subtle?A.subtle:null}async function c(A){if(s&&i===A)return s;const S=m();if(!S)return null;const R=k(A);if(!R)return null;try{const j=await S.importKey("raw",R,{name:"Ed25519"},!1,["verify"]);return s=j,i=A,j}catch{return null}}async function l(){return n!==null||(n=await c(q)!==null),n}async function u(A,S={}){const R=S.warn!==!1,j=S.product||x,N=S.publicKey||q,$=S.now??Date.now(),_=S.host??p(),Y=f(_)?"":` ${I}`,Z=o(A);if(!Z.ok){const X=Z.reason==="missing"?"missing":"malformed";return R&&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:r(Z.terms)};if(Z.product!==j)return R&&E("licence.product",`licence key is for '${Z.product}', not '${j}'. The grid will render with a watermark.`),{valid:!1,...J,reason:"product"};if(t(Z.expires,$))return R&&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&&_&&!f(_)&&!y(_,D))return R&&E("licence.domain",`licence key is not valid for ${_}; it covers ${D.join(", ")}. The grid will render with a watermark.`),{valid:!1,...J,reason:"domain"};const te=await c(N);if(!te){const X=!!Z.signature&&Z.signature.length===L;return R&&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}:(R&&E("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...J,reason:"signature"})}function f(A){const S=String(A??p()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!S||S==="localhost"||S.endsWith(".localhost")||S==="::1"||S==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(S)}function p(){const A=globalThis.location;return A&&typeof A.hostname=="string"?A.hostname:null}function y(A,S){const R=h(A);return!R||!Array.isArray(S)?!1:S.some(j=>{const N=h(j);if(!N)return!1;if(N==="*")return!0;if(N.startsWith("*.")){const $=N.slice(2);return R===$||R.endsWith(`.${$}`)}return R===N})}function h(A){return String(A??"").trim().toLowerCase().replace(/\.$/,"")}class d{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#i;#s=new Set;constructor(S={}){this.#i=S}set(S){this.#e=typeof S=="string"?S.trim():"";const R=o(this.#e);return this.#t=R.ok?{valid:!t(R.expires,Date.now())&&R.product===(this.#i.product||x),product:R.product||void 0,issuedTo:R.issuedTo||void 0,expires:R.expires||void 0,terms:r(R.terms),reason:"pending"}:{valid:!1,reason:R.reason||"malformed",terms:"commercial"},this.#n=null,this.#e&&this.verify(),this.#t}verify(){if(this.#n)return this.#n;const S=this.#e;return this.#n=u(S,this.#i).then(R=>{if(this.#e===S){this.#t=R;for(const j of this.#s)j(R)}return R}),this.#n}onSettled(S){return this.#s.add(S),()=>this.#s.delete(S)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!f(this.#r)}setHost(S){this.#r=S}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 A=globalThis,S=A&&A[w];if(S&&typeof S.set=="function"&&typeof S.watermark=="function")return S;const R=new d;if(A)try{A[w]=R}catch{}return R}const P=v();function G(A){return P.set(A)}function V(){return P.info()}function K(){return P.watermark()}function H(){return P.state()}function T(){return P}}),He("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 M}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return s}});const ie=F("packages/core/src/internal/warn.js"),E=ie.warnOnce,W=ie.DEV,x=F("packages/core/src/internal/predicates.js").isFunction,Q=F("packages/core/src/registry/licence.js"),U=Q.LicenceHolder,L=Q.sharedLicence,q=["renderer","editor","filter","dataType","totalFn","pipe","component"],M=["all","header","body","totals","panels"];class O{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#i;#s=null;#o=null;#l=new Set;#a=new Map;constructor(n={}){for(const m of q)this.#t.set(m,new Map);this.#i=n.holder||L(),this.#o=n.grid??null,this.#s=this.#i.onSettled(()=>{this.#f({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),n.licence&&this.setLicence(n.licence)}registerModules(n,m={}){m.licence&&this.setLicence(m.licence),m.grid!==void 0&&(this.#o=m.grid);const c=Array.isArray(n)?n:[n],l=[];for(const u of c){if(!u||typeof u!="object"||typeof u.name!="string"||!u.name){E("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(u.name)){W&&this.#u(this.#e.get(u.name),u);continue}if(!x(u.install)){E(`registry.module.install:${u.name}`,`module '${u.name}' has no install() and was ignored.`);continue}const f={registry:this,grid:this.#o};try{u.install(f)}catch(p){E(`registry.module.throw:${u.name}`,`module '${u.name}' threw during install; it was not registered.`,p);continue}this.#e.set(u.name,u);for(const p of k(u))this.#n.add(p);l.push(u.name),this.#f({reason:"module",name:u.name,capabilities:this.capabilities(),regions:g(u)})}return l}unregisterModule(n){const m=this.#e.get(n);if(!m)return!1;if(x(m.uninstall))try{m.uninstall({registry:this,grid:this.#o})}catch(c){E(`registry.module.uninstall:${n}`,`module '${n}' threw during uninstall.`,c)}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 x(n)?(this.#r.add(n),this.#a.set(n,this.#o),()=>{this.#r.delete(n),this.#a.delete(n)}):()=>{}}#f(n){for(const m of[...this.#r])try{m(n)}catch(c){E("registry.onChange.throw","a registry change handler threw.",c)}}register(n,m,c){const l=this.#t.get(n);if(!l){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}l.has(m)&&l.get(m)!==c&&E(`registry.replace:${n}:${m}`,`'${m}' was already registered as a ${n} and has been replaced.`),l.set(m,c),this.#f({reason:"register",name:m,kind:n,capabilities:this.capabilities(),regions:o(n)})}registerAll(n,m){if(m)for(const c of Object.keys(m))this.register(n,c,m[c])}get(n,m){const c=this.#t.get(n);return c?c.get(m):void 0}names(n){const m=this.#t.get(n);return m?[...m.keys()]:[]}#d(n,m){const c=this.#t.get(n).get(m);return c!==void 0?c:this.#t.get("component").get(m)}renderer(n){return this.#d("renderer",n)}editor(n){return this.#d("editor",n)}filter(n){return this.#d("filter",n)}dataType(n){return this.get("dataType",n)}totalFn(n){return this.get("totalFn",n)}pipe(n){return this.get("pipe",n)}setLicence(n){return this.#i.set(n)}licence(){return this.#i.info()}licenceVerified(){return this.#i.verify()}watermark(){return this.#i.watermark()}attach(n){n!=null&&(this.#l.add(n),this.#o=n)}detach(n){if(n!=null){this.#l.delete(n);for(const[m,c]of[...this.#a])c===n&&(this.#r.delete(m),this.#a.delete(m));if(this.#o===n){const m=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#o=m}this.#l.size===0&&this.#s&&(this.#s(),this.#s=null)}}destroy(n){if(n!=null){this.detach(n);return}for(const m of[...this.#e.keys()])this.unregisterModule(m);this.#r.clear(),this.#a.clear(),this.#l.clear(),this.#s&&this.#s(),this.#s=null,this.#o=null}}function k(i){const n=i.capabilities,m=Array.isArray(n)?n.filter(c=>typeof c=="string"):[];return[i.name,...m]}function b(i,n){return i.install!==n.install||i.uninstall!==n.uninstall||(i.version||"")!==(n.version||"")?!1:a(k(i),k(n))&&a(g(i),g(n))}function a(i,n){const m=new Set(i),c=new Set(n);if(m.size!==c.size)return!1;for(const l of m)if(!c.has(l))return!1;return!0}function g(i){const n=i.regions;return!Array.isArray(n)||n.length===0?["all"]:n.filter(m=>M.includes(m))}function o(i){switch(i){case"filter":return["header"];case"totalFn":return["totals"];case"renderer":case"editor":case"pipe":return["body"];default:return["all"]}}const t=new O;function r(){return t}function s(i,n={}){return t.registerModules(i,n)}}),He("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 W}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return I}});function ie(x){return x?(x.includes(".")?x.slice(x.lastIndexOf(".")+1):x).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,U=>U.toUpperCase()):""}const E={"&":"&","<":"<",">":">",'"':""","'":"'"};function W(x){const Q=x==null?"":String(x);return/[&<>"']/.test(Q)?Q.replace(/[&<>"']/g,U=>E[U]):Q}function I(x){return String(x).replace(/\w\S*/g,Q=>Q[0].toUpperCase()+Q.slice(1).toLowerCase())}}),He("packages/core/src/format/mask.js",function(e,F){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return W}}),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 W(L){const q=[];let M="",O=!1;for(let k=0;k<L.length;k++){const b=L[k];if(b==="\\"){M+=b+(L[k+1]??""),k+=1;continue}if(b==='"'){O=!O,M+=b;continue}if(b===";"&&!O){q.push(M),M="";continue}M+=b}return q.push(M),q}function I(L){let q="",M="",O="",k=1,b=!1,a=!1;const g=l=>{a?M+=l:q+=l};for(let l=0;l<L.length;l++){const u=L[l];if(u==="\\"){g(L[l+1]??""),l+=1;continue}if(u==='"'){const f=L.indexOf('"',l+1);g(f===-1?L.slice(l+1):L.slice(l+1,f)),l=f===-1?L.length:f;continue}if(u==="%"){k*=100,g("%");continue}if(u==="@"){b=!0,g("\0");continue}if(ie.has(u)){O+=u,a=!0;continue}g(u)}let o=-1;for(let l=O.length-1;l>=0;l--){const u=O[l];if(u==="0"||u==="#"||u==="?"){o=l;break}}let t=!1,r="";for(let l=0;l<O.length;l++){const u=O[l];if(u===","){l>o?k/=1e3:t=!0;continue}r+=u}const s=r.indexOf("."),i=s===-1?r:r.slice(0,s),n=s===-1?"":r.slice(s+1);let m=0;for(const l of i)l==="0"&&(m+=1);let c=0;for(const l of n)l==="0"&&(c+=1);return{prefix:q,suffix:M,minInt:m,minDec:c,maxDec:n.length,grouping:t,scale:k,hasNumber:o!==-1,isText:b}}function x(L,q){const M=new Intl.NumberFormat(q,{minimumIntegerDigits:Math.max(L.minInt,1),minimumFractionDigits:L.minDec,maximumFractionDigits:Math.max(L.maxDec,L.minDec),useGrouping:L.grouping}),{prefix:O,suffix:k,scale:b,hasNumber:a}=L;return g=>{if(!a)return O+k;const o=b===1?g:g*b;return O+M.format(o)+k}}function Q(L,q){const O=W(String(L)).map(I),k=O.map(r=>x(r,q)),b=0,a=O.length>1?1:-1,g=O.length>2?2:-1,o=O.length>3?3:-1,t=r=>{if(r==null||r==="")return"";if(typeof r!="number"||Number.isNaN(r)){const s=Number(r);if(Number.isNaN(s))return o===-1?String(r):(O[o].prefix+O[o].suffix).split("\0").join(String(r));r=s}return r===0&&g!==-1?k[g](0):r<0&&a!==-1?k[a](-r):k[b](r)};return t.spec={mask:L},{format:t,ooxml:U(String(L))}}function U(L){return L.trim()}}),He("packages/core/src/format/pattern.js",function(e,F){"use strict";Object.defineProperty(e,"parseNumberPattern",{enumerable:!0,get:function(){return x}});const E=F("packages/core/src/format/mask.js").splitSections;function W(Q){let U="",L="",q="",M="",O=!1,k=!1,b=!1,a=!1;const g=t=>{b?L+=t:U+=t};for(let t=0;t<Q.length;t++){const r=Q[t];if(r==="\\"){g(Q[t+1]??""),t+=1;continue}if(r==='"'){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(r==="%"){k=!0;continue}if(r==="0"||r==="#"){b=!0,a?M+=r:q+=r;continue}if(r===","){a||(O=!0);continue}if(r==="."&&!a){a=!0;continue}g(r)}if(!b)return{hasDigit:!1,prefix:U,suffix:L,minDec:0,maxDec:0,grouping:!1,percent:k};let o=0;for(const t of M)t==="0"&&(o+=1);return{hasDigit:!0,prefix:U,suffix:L,minDec:o,maxDec:M.length,grouping:O,percent:k}}function I(Q,U){const L=U.trim(),q=Q.trim();return L.startsWith("(")&&L.endsWith(")")&&L.slice(1,-1).trim()===q?"parentheses":L.endsWith("-")?"suffix":"minus"}function x(Q){if(typeof Q!="string")return null;const U=E(Q);if(U.length===0)return null;const L=W(U[0]);if(!L.hasDigit)return null;const q={style:L.percent?"percent":"decimal",prefix:L.prefix,suffix:L.suffix,minDecimals:L.minDec,maxDecimals:Math.max(L.maxDec,L.minDec),thousandsSeparator:L.grouping?void 0:!1};if(U.length>1&&(q.negative=I(U[0],U[1])),U.length>2){const M=W(U[2]);M.hasDigit||(q.zeroDisplay=M.prefix+M.suffix)}return q}}),He("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(L,q){const M=typeof L=="string"?{pattern:L}:L||{};let O=M;if(typeof M.pattern=="string"){const v=Q(M.pattern);if(v){const{pattern:P,...G}=M;O={...v,...G}}else I(`format:pattern:${M.pattern}`,`invalid number format pattern "${M.pattern}"; the value will use the default number format`)}const k=O.locale||q||void 0,b=O.style||"decimal",a=typeof O.scale=="number"?O.scale:1,g=O.nullDisplay??"",o=O.zeroDisplay,t=O.prefix||"",r=O.suffix||"",s=O.negative||"minus",i=O.signed===!0,n={style:b,notation:O.notation||"standard"};b==="currency"&&(n.currency=O.currency||"USD",O.currencyDisplay&&(n.currencyDisplay=O.currencyDisplay)),typeof O.decimals=="number"?(n.minimumFractionDigits=O.decimals,n.maximumFractionDigits=O.decimals):(typeof O.minDecimals=="number"&&(n.minimumFractionDigits=O.minDecimals),typeof O.maxDecimals=="number"&&(n.maximumFractionDigits=O.maxDecimals),n.minimumFractionDigits>(n.maximumFractionDigits??20)&&(n.maximumFractionDigits=n.minimumFractionDigits)),O.thousandsSeparator===!1&&(n.useGrouping=!1),n.notation==="compact"&&(n.compactDisplay=O.compactDisplay||"short");const m=new Intl.NumberFormat(k,n),c=typeof O.thousandsSeparator=="string"?O.thousandsSeparator:null,l=typeof O.decimalSeparator=="string"?O.decimalSeparator:null;let u=",",f=".";if(c||l)for(const v of m.formatToParts(12345.6))v.type==="group"?u=v.value:v.type==="decimal"&&(f=v.value);const p=v=>{let P=v;return c&&(P=P.split(u).join("")),l&&(P=P.split(f).join("")),c&&(P=P.split("").join(c)),l&&(P=P.split("").join(l)),P},y=!!(c||l),h=t!==""&&b==="currency",d=v=>{let P;if(h){const G=m.formatToParts(v);let V=!1;P="";for(const K of G)P+=K.value,!V&&K.type==="currency"&&(P+=t,V=!0);V||(P=t+P)}else P=t+m.format(v);return y&&(P=p(P)),P+r},w=v=>{if(E(v)||v==="")return g;const P=typeof v=="number"?v:Number(v);if(Number.isNaN(P))return g;const G=a===1?P:P*a;return G===0&&o!==void 0?o:G<0?s==="parentheses"?`(${d(-G)})`:s==="suffix"?`${d(-G)}-`:d(G):i&&G>0?`+${d(G)}`:d(G)};return w.negativeClass=O.negativeClass||null,w.spec=O,w}}),He("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 L}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return r}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/internal/warn.js").warnOnce,x=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function Q(s){const i=[];let n=0,m="";const c=()=>{m&&(i.push({token:null,text:m}),m="")};for(;n<s.length;){const l=s[n];if(l==="'"){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 u=x.find(f=>s.startsWith(f,n));if(u){c(),i.push({token:u,text:u}),n+=u.length;continue}/[A-Za-z]/.test(l)&&I(`date.pattern.token:${l}`,`the date pattern "${s}" contains '${l}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${x.join(" ")}.`),m+=l,n+=1}return c(),i}const U=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function L(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 i=U.exec(s.trim());if(i){const[,m,c,l,u="0",f="0",p="0"]=i;return new Date(+m,+c-1,+l,+u,+f,+p)}const n=new Date(s);return Number.isNaN(n.getTime())?null:n}return null}function q(s,i){return String(s).padStart(i,"0")}function M(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 i=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 c={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:m.getMilliseconds(),weekday:0};for(const l of i.formatToParts(m))switch(l.type){case"year":c.year=Number(l.value);break;case"month":c.month=Number(l.value);break;case"day":c.day=Number(l.value);break;case"hour":c.hour=Number(l.value)%24;break;case"minute":c.minute=Number(l.value);break;case"second":c.second=Number(l.value);break;case"weekday":c.weekday=n[l.value]??0;break;default:break}return c}}function O(s,i,n){const m=Q(s),c=M(n),l=new Set(m.filter(h=>h.token).map(h=>h.token)),u=l.has("MMM")?new Intl.DateTimeFormat(i,{month:"short",timeZone:n}):null,f=l.has("MMMM")?new Intl.DateTimeFormat(i,{month:"long",timeZone:n}):null,p=l.has("EEE")?new Intl.DateTimeFormat(i,{weekday:"short",timeZone:n}):null,y=l.has("EEEE")?new Intl.DateTimeFormat(i,{weekday:"long",timeZone:n}):null;return h=>{const d=c(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+=u.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,i){const n=s||{},m=n.locale||i||void 0,c=n.nullDisplay??"",l=n.timeZone;let u;if(n.pattern)u=O(n.pattern,m,l);else if(n.dateStyle||n.timeStyle){const d={timeZone:l};n.dateStyle&&(d.dateStyle=n.dateStyle),n.timeStyle&&(d.timeStyle=n.timeStyle);const w=new Intl.DateTimeFormat(m,d);u=v=>w.format(v)}else{const d=new Intl.DateTimeFormat(m,{dateStyle:"medium",timeZone:l});u=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=L(d);if(!v)return c;if(f){const P=w&&typeof w.now=="number"?w.now:Date.now(),G=v.getTime()-P;if(Math.abs(G)<y){for(const[V,K]of k)if(Math.abs(G)>=K||V==="second")return f.format(Math.round(G/K),V)}}return u(v)};return h.spec=n,h}function a(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 c=L(s);return c?a(c):null}const i=L(s);if(!i)return null;const n=m=>String(m).padStart(2,"0");return`${i.getFullYear()}-${n(i.getMonth()+1)}-${n(i.getDate())}`}function g(s,i){if(E(s)||s==="")return null;if(typeof s=="string"){const m=s.trim();if(o.test(m)){const u=L(m);return u?t(u,i):null}const c=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(m);if(c){const[,u,f,p,y]=c;return`${u}T${f}:${p}${y&&y!=="00"?`:${y}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(m))return`${m}T00:00`;const l=L(m);return l?g(l):null}const n=L(s);return n?t(n,i):null}const o=/(?:Z|[+-]\d{2}:?\d{2})$/i;function t(s,i){const n=u=>String(u).padStart(2,"0");if(i)try{const u=new Intl.DateTimeFormat("en-CA",{timeZone:i,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(s).reduce((y,h)=>(h.type!=="literal"&&(y[h.type]=h.value),y),{}),f=u.hour==="24"?"00":u.hour,p=Number(u.second);return`${u.year}-${u.month}-${u.day}T${f}:${u.minute}`+(p?`:${u.second}`:"")}catch{}const m=`${s.getFullYear()}-${n(s.getMonth()+1)}-${n(s.getDate())}`,c=s.getSeconds(),l=`${n(s.getHours())}:${n(s.getMinutes())}${c?`:${n(c)}`:""}`;return`${m}T${l}`}function r(s,i){const n=E(s)||s===""?null:String(s),m=E(i)||i===""?null:String(i);return n===null?m===null?0:1:m===null||n<m?-1:n>m?1:0}}),He("packages/core/src/format/boolean.js",function(e,F){"use strict";Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return Q}});const E=F("packages/core/src/internal/predicates.js").isNil,W={true:"☑",false:"☐",null:""},I={true:"◉",false:"◯",null:""};function x(U){if(E(U)||U==="")return null;if(typeof U=="boolean")return U;if(typeof U=="number")return U!==0;const L=String(U).trim().toLowerCase();return L==="true"||L==="yes"||L==="y"||L==="1"?!0:L==="false"||L==="no"||L==="n"||L==="0"?!1:null}function Q(U,L){const q=U||{},M=q.display||"text",O=q.trueLabel??"Yes",k=q.falseLabel??"No",b=q.nullLabel??"";let a=O,g=k;const o=b;M==="checkbox"?(a=W.true,g=W.false):M==="switch"?(a=I.true,g=I.false):M==="icon"&&(a=q.trueIcon??O,g=q.falseIcon??k);const t=r=>{const s=x(r);return s===null?o:s?a:g};return t.display=M,t.labels={true:O,false:k,null:b},t.locale=L,t.spec=q,t}}),He("packages/core/src/format/text.js",function(e,F){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return x}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/internal/text.js").titleCase;function x(Q,U){const L=Q||{},q=L.locale||U||void 0,M=L.nullDisplay??"",O=L.emptyDisplay??"",k=L.transform||"none",b=typeof L.truncate=="number"?{chars:L.truncate}:L.truncate||null,a=b?b.chars:0,g=b?b.ellipsis??"…":"",o=r=>{switch(k){case"upper":return q?r.toLocaleUpperCase(q):r.toUpperCase();case"lower":return q?r.toLocaleLowerCase(q):r.toLowerCase();case"title":return I(r);default:return r}},t=r=>{if(E(r))return M;let s=typeof r=="string"?r:String(r);return s===""?O:(k!=="none"&&(s=o(s)),a>0&&s.length>a&&(s=s.slice(0,a)+g),s)};return t.spec=L,t}}),He("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 x}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return U}});const ie=["currency","number","percent","date","boolean","text","relative"],E=/[#0?@;"\\]/,W=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function I(L){return typeof L!="string"||L===""||Q(L)?!1:E.test(L)}function x(L){return typeof L!="string"||L===""||Q(L)?!1:W.test(L)}function Q(L){const q=L.indexOf(":"),M=q===-1?L:L.slice(0,q);return ie.includes(M)?M:null}function U(L){const q=Q(L);if(!q)return null;const M=L.indexOf(":"),O=M===-1?"":L.slice(M+1),k=O===""?[]:O.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:O||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const b=O.split("/"),a={type:"boolean",display:"text"};return b[0]!==void 0&&b[0]!==""&&(a.trueLabel=b[0]),b[1]!==void 0&&b[1]!==""&&(a.falseLabel=b[1]),b[2]!==void 0&&(a.nullLabel=b[2]),a}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}}}),He("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,W=ie.isObject,x=F("packages/core/src/internal/warn.js").warnOnce,Q=F("packages/core/src/format/number.js"),U=Q.compileNumber,L=F("packages/core/src/format/date.js"),q=L.compileDate,M=L.scanPattern,O=F("packages/core/src/format/boolean.js"),k=O.compileBoolean,b=F("packages/core/src/format/text.js"),a=b.compileText,g=F("packages/core/src/format/mask.js"),o=g.compileMask,t=F("packages/core/src/format/shorthand.js"),r=t.parseShorthand,s=t.looksLikeMask,i=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 L.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return L.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return L.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return L.toDate}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return O.compileBoolean}}),Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return O.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 c=new Set(["decimal","currency","percent","unit"]),l=new Set(["type","locale"]),u={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(H,T){const A=H.type;if(A===void 0||f.has(A)||!c.has(String(A)))return;const S=T?`"${T}"`:"with no id";x(`format:unknown-style-key:${T||""}:${A}`,`column ${S} has format: { type: "${A}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${A}" instead?`)}function y(H,T,A){const S=u[T],R=A?`"${A}"`:"with no id";for(const j of H){if(l.has(j)||S.has(j))continue;const N=Object.keys(u).find($=>$!==T&&u[$].has(j));N?x(`format:inapplicable:${A||""}:${j}`,`column ${R} has format key "${j}", which applies to a ${N} column, not the ${T} column it was applied to; it is ignored.`):x(`format:unknown:${A||""}:${j}`,`column ${R} has an unrecognised format key "${j}" for its ${T} format; it is ignored.`)}}function h(H){if(H.type==="number"||H.type==="date"||H.type==="boolean"||H.type==="text")return!0;const T=c.has(String(H.style));return!!(H.pattern||H.dateStyle||H.timeStyle||H.relative||H.timeZone||H.trueLabel||H.falseLabel||H.display||H.trueIcon||H.falseIcon||H.transform||H.truncate||H.emptyDisplay||T||H.currency||H.decimals!==void 0||H.minDecimals!==void 0||H.maxDecimals!==void 0||H.notation||H.negative||H.scale!==void 0||H.prefix||H.suffix||H.zeroDisplay!==void 0)}function d(H,T){if(H.type==="number"||H.type==="date"||H.type==="boolean"||H.type==="text")return H.type;if(H.pattern){if(s(H.pattern))return"number";if(i(H.pattern))return"date"}if(H.dateStyle||H.timeStyle||H.relative||H.timeZone)return"date";if(H.trueLabel||H.falseLabel||H.display||H.trueIcon||H.falseIcon)return"boolean";if(H.transform||H.truncate||H.emptyDisplay)return"text";if(H.style||H.currency||H.decimals!==void 0||H.minDecimals!==void 0||H.maxDecimals!==void 0||H.notation||H.negative||H.scale!==void 0||H.prefix||H.suffix||H.zeroDisplay!==void 0)return"number";const A=T&&T.base;return A==="number"?"number":A==="date"||A==="dateString"?"date":A==="boolean"?"boolean":"text"}function w(H,T=null,A=void 0,S=void 0,R=void 0){if(H==null||H==="")return null;const j=W(H)?Object.keys(H):null;if(typeof H=="function"){const _=(Y,Z)=>String(H({...Z||{},value:Y,locale:A})??"");return _.ooxml=T&&T.excel||"General",_}if(typeof H=="string"){if(s(H)){const{format:Y,ooxml:Z}=o(H,A);return Y.ooxml=Z,Y}const _=r(H)||(i(H)?{type:"date",pattern:H}:null);return _?w(_,T,A,S,R):(x(`format:${H}`,`unrecognised format string "${H}"; the value will be stringified`),null)}if(!W(H))return x("format:shape","format must be a spec object or a string; ignoring",H),null;if(T&&E(T.format)&&!h(H)||T&&E(T.format)&&Array.isArray(T.formatPatterns)&&H.type===void 0)return null;const N=d(H,T);N==="date"&&S&&H.timeZone===void 0&&(H={...H,timeZone:S}),p(H,R),y(j||Object.keys(H),N,R);let $;switch(N){case"number":$=U(H,A);break;case"date":$=q(H,A);break;case"boolean":$=k(H,A);break;default:$=a(H,A);break}return $.ooxml=P(H,N,A,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(H,T,A=void 0,S=null){if(T==="date"){if(H.pattern){let _="";for(const Y of M(H.pattern))_+=Y.token?v[Y.token]??Y.text:Y.text;return _}return S&&S.excel||"yyyy-mm-dd"}if(T==="boolean")return"General";if(T==="text")return"@";if(typeof H.pattern=="string"&&m(H.pattern))return String(H.pattern).trim();if(H.notation==="compact"||H.notation==="scientific")return"General";const R=typeof H.decimals=="number"?H.decimals:typeof H.minDecimals=="number"?H.minDecimals:H.style==="currency"?2:0;let N=`${H.thousandsSeparator===!1?"":"#,#"}#0${R>0?`.${"0".repeat(R)}`:""}`,$="";return H.style==="currency"&&($+=G(K(H.currency||"USD",A))),H.prefix&&($+=G(H.prefix)),N=$+N,H.style==="percent"&&(N=`${N}%`),H.suffix&&(N+=G(H.suffix)),H.negative==="parentheses"?`${N};(${N})`:H.negative==="suffix"?`${N};${N}-`:N}function G(H){return`"${String(H).split('"').join("")}"`}const V=new Map;function K(H,T){const A=`${H}|${T||""}`;let S=V.get(A);if(S!==void 0)return S;S=H;try{const j=new Intl.NumberFormat(T,{style:"currency",currency:H}).formatToParts(0).find(N=>N.type==="currency");j&&(S=j.value)}catch{}return V.set(A,S),S}}),He("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 a}}),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 l}}),Object.defineProperty(e,"toTimeMs",{enumerable:!0,get:function(){return u}}),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 G}}),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 A}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return j}}),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 we}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return be}}),Object.defineProperty(e,"resolveZoneName",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"zoneLabel",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"formatInstant",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return he}}),Object.defineProperty(e,"timestampGroupProjector",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"TEMPORAL_INFERENCE_ORDER",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Ie}});const ie=F("packages/core/src/internal/predicates.js"),E=ie.isNil,W=ie.isFunction,I=F("packages/core/src/format/date.js"),x=I.toDate,Q=I.compilePattern,U=I.compileDate,L=I.toIsoDateTime,q=I.compareIso,M=864e5,O=Object.freeze({}),k=1e3,b=60*k,a=60*b,g=24*a,o=7*g,t=new WeakMap;function r(ke,_e){const Te=ke&&ke.locale||"",je=ke&&ke.column;if(!je)return Te?{locale:Te}:O;const Ae=t.get(je);if(Ae&&Ae.locale===Te)return Ae.bag;const Ee=je.typeOptions||je[_e]||(s(je.format)?je.format:null),Me={...Ee||O,locale:Ee&&Ee.locale||Te||void 0};return t.set(je,{locale:Te,bag:Me}),Me}function s(ke){return ke!==null&&typeof ke=="object"&&!Array.isArray(ke)&&!(ke instanceof Date)}function i(ke,_e){const Te=ke===null||Number.isNaN(ke)?null:ke,je=_e===null||Number.isNaN(_e)?null:_e;return Te===null?je===null?0:1:je===null||Te<je?-1:Te>je?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 c(ke,_e,Te,je){return!(ke>=0&&ke<=23)||!(_e>=0&&_e<=59)||!(Te>=0&&Te<=59)||!(je>=0&&je<=999)?null:ke*a+_e*b+Te*k+je}function l(ke){if(E(ke))return null;const _e=String(ke).trim();if(_e==="")return null;const Te=m.exec(_e);if(Te){const et=Te[1];if(et.length===5)return null;const Je=et.length===3?1:2;return c(Number(et.slice(0,Je)),Number(et.slice(Je,Je+2)),Number(et.slice(Je+2,Je+4)||0),0)}const je=n.exec(_e);if(!je)return null;let Ae=Number(je[1]);const Ee=Number(je[2]||0),Me=Number(je[3]||0),Be=je[4]?Number(je[4].padEnd(3,"0")):0,Ke=je[5]?je[5][0].toLowerCase():null;if(Ke){if(Ae<1||Ae>12)return null;Ae=Ae%12,Ke==="p"&&(Ae+=12)}return c(Ae,Ee,Me,Be)}function u(ke){return E(ke)||ke===""?null:typeof ke=="number"?Number.isFinite(ke)?(ke%g+g)%g:null:ke instanceof Date?Number.isNaN(ke.getTime())?null:ke.getHours()*a+ke.getMinutes()*b+ke.getSeconds()*k+ke.getMilliseconds():l(ke)}const f=new Map;function p(ke){const _e=ke.pattern||"",Te=ke.timeStyle||(ke.seconds?"medium":"short"),je=`${ke.locale||""}|${_e}|${Te}`;let Ae=f.get(je);if(Ae)return Ae;if(_e)Ae=Q(_e,ke.locale||void 0,"UTC");else{const Ee=new Intl.DateTimeFormat(ke.locale||void 0,{timeStyle:Te,timeZone:"UTC"});Ae=Me=>Ee.format(Me)}return f.set(je,Ae),Ae}function y(ke,_e){const Te=_e||O;if(ke==null||typeof ke!="number"||!Number.isFinite(ke))return Te.nullDisplay??"";const je=(ke%g+g)%g;return p(Te)(new Date(je))}function h(ke){return ke instanceof Date?!Number.isNaN(ke.getTime()):typeof ke=="number"?Number.isFinite(ke)&&ke>=0&&ke<g:typeof ke!="string"||!ke.includes(":")?!1:l(ke)!==null}function d(ke){const _e=u(ke);return _e==null?"":y(_e,{pattern:_e%k===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const w=new Map;function v(ke){const _e=ke||"";let Te=w.get(_e);return Te||(Te=new Intl.DateTimeFormat("en-GB",{timeZone:ke||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),w.set(_e,Te)),Te}function P(ke,_e){const Te={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const je of v(_e).formatToParts(new Date(ke)))je.type==="year"?Te.year=Number(je.value):je.type==="month"?Te.month=Number(je.value):je.type==="day"?Te.day=Number(je.value):je.type==="hour"?Te.hour=Number(je.value)%24:je.type==="minute"?Te.minute=Number(je.value):je.type==="second"&&(Te.second=Number(je.value));return Te}function G(ke,_e){const Te=P(ke,_e);return Date.UTC(Te.year,Te.month-1,Te.day,Te.hour,Te.minute,Te.second,0)-Math.floor(ke/1e3)*1e3}function V(ke,_e){const Te=ke.hour||0,je=ke.minute||0,Ae=ke.second||0,Ee=ke.ms||0;if(!_e)return new Date(ke.year,ke.month-1,ke.day,Te,je,Ae,Ee).getTime();const Me=Date.UTC(ke.year,ke.month-1,ke.day,Te,je,Ae,Ee);let Be=Me-G(Me,_e);return Be=Me-G(Be,_e),Be}const K=/(?:Z|[+-]\d{2}:?\d{2})$/i,H=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function T(ke,_e){if(E(ke))return null;const Te=String(ke).trim();if(Te==="")return null;const je=_e&&_e.timeZone||void 0;if(!K.test(Te)){const Ae=H.exec(Te);if(Ae){const Ee=(Ae[4]||"").trim(),Me=Ee===""?0:l(Ee);if(Me===null)return null;const Be=V({year:Number(Ae[1]),month:Number(Ae[2]),day:Number(Ae[3]),hour:Math.floor(Me/a),minute:Math.floor(Me/b)%60,second:Math.floor(Me/k)%60,ms:Me%k},je);return Number.isNaN(Be)?null:new Date(Be)}}return x(Te)}function A(ke){if(typeof ke=="number")return Number.isFinite(ke)?ke:null;const _e=x(ke);return _e?_e.getTime():null}const S=new Map;function R(ke){const _e=[ke.locale||"",ke.pattern||"",ke.dateStyle||"",ke.timeStyle||"",ke.timeZone||"",ke.seconds?"1":""].join("|");let Te=S.get(_e);if(Te)return Te;const je=ke.pattern?{type:"date",pattern:ke.pattern,timeZone:ke.timeZone}:{type:"date",dateStyle:ke.dateStyle||"medium",timeStyle:ke.timeStyle||(ke.seconds?"medium":"short"),timeZone:ke.timeZone};return Te=U(je,ke.locale||void 0),S.set(_e,Te),Te}function j(ke,_e){const Te=_e||O,je=A(ke);return je==null?Te.nullDisplay??"":R(Te)(je)}function N(ke){return ke instanceof Date?!Number.isNaN(ke.getTime()):typeof ke!="string"||!H.test(ke.trim())?!1:T(ke)!==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:a,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"]}]),_=new Map;for(const ke of $)for(const _e of ke.names)_.set(_e,ke);const Y=Object.freeze($.filter(ke=>ke.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(ke){const _e=ke&&ke.defaultUnit?_.get(String(ke.defaultUnit).toLowerCase()):null;return _e?_e.ms:b}function z(ke){return(ke&&ke.defaultUnit?_.get(String(ke.defaultUnit).toLowerCase()):null)||_.get("m")}function X(ke,_e){if(E(ke))return null;let Te=String(ke).trim().toLowerCase();if(Te==="")return null;let je=1;if(Te[0]==="-"?(je=-1,Te=Te.slice(1).trim()):Te[0]==="+"&&(Te=Te.slice(1).trim()),Te==="")return null;const Ae=D.exec(Te);if(Ae){const Ke=Ae[3]!==void 0,et=Number(Ae[1])*a+Number(Ae[2])*b+(Ke?Number(Ae[3])*k:0)+(Ae[4]?Number(Ae[4].padEnd(3,"0")):0);return je*et}if(J.test(Te))return Math.round(je*Number(Te)*te(_e||O));let Ee=Te,Me=0,Be=0;for(;Ee!=="";){const Ke=Z.exec(Ee);if(!Ke)return null;const et=_.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(je*Me)}function ne(ke){return E(ke)||ke===""?null:typeof ke=="number"?Number.isFinite(ke)?ke:null:X(ke)}const re=new Map;function ae(ke,_e,Te){const je=`${Te||""}|${_e.intl}`;let Ae=re.get(je);if(Ae===void 0){try{Ae=new Intl.NumberFormat(Te||void 0,{style:"unit",unit:_e.intl,unitDisplay:"long"})}catch{Ae=null}re.set(je,Ae)}return Ae?Ae.format(ke):`${ke} ${ke===1?_e.long[0]:_e.long[1]}`}function fe(ke,_e){return String(ke).padStart(_e,"0")}function we(ke,_e){const Te=_e||O;if(ke==null||typeof ke!="number"||!Number.isFinite(ke))return Te.nullDisplay??"";const je=Te.style||"short",Ae=ke<0;let Ee=Math.round(Math.abs(ke));const Me=Ae?"-":"";if(Ee===0&&Te.zeroDisplay!=null)return Te.zeroDisplay;if(je==="clock"){const Je=Math.floor(Ee/a),ut=Math.floor(Ee/b)%60,Ct=Math.floor(Ee/k)%60;return`${Me}${fe(Je,2)}:${fe(ut,2)}:${fe(Ct,2)}`}if(Ee===0){const Je=z(Te);return je==="long"?ae(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(je==="long"?ae(ut,Je,Te.locale):`${ut}${Je.key}`))}return Me+et.join(" ")}function ve(ke){if(typeof ke!="string")return!1;const _e=ke.trim();return _e===""||D.test(_e)||!/[a-z]/i.test(_e)?!1:X(_e)!==null}const Re=Date.UTC(1899,11,30),$e=new Map;function be(ke,_e){const Te=ke||"";let je=$e.get(Te);je||(je=new Intl.DateTimeFormat("en-GB",{timeZone:ke||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),$e.set(Te,je));const Ae=typeof _e=="number"?_e:Date.now();for(const Ee of je.formatToParts(new Date(Ae)))if(Ee.type==="timeZoneName")return Ee.value;return""}function se(ke){if(ke)return ke;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function de(ke,_e){const Te=se(ke),je=be(ke,_e);return je?`${Te} (${je})`:Te}function oe(ke,_e){if(ke&&ke.timeZone)return ke.timeZone;const Te=_e&&_e.grid;return(Te&&W(Te.get)?Te.get("timeZone"):void 0)||void 0}function ce(ke,_e){const Te=_e||O,je=A(ke);if(je==null)return Te.nullDisplay??"";const Ae=R(Te)(je);if(!Te.showOrigin)return Ae;const Ee=Te.originZone;return Ee?Ee===(Te.timeZone||se(Te.timeZone))?Ae:`${Ae} (${de(Ee,je)})`:`${Ae} (no origin recorded)`}function he(ke,_e,Te,je){if(_e==="instant"||!_e)return ke;const Ae=P(ke,Te);if(_e==="month")return V({year:Ae.year,month:Ae.month,day:1},Te);if(_e==="week"){const Ee=je>=1&&je<=7?je:1,Be=((new Date(Date.UTC(Ae.year,Ae.month-1,Ae.day)).getUTCDay()+6)%7+1-Ee+7)%7,Ke=new Date(Date.UTC(Ae.year,Ae.month-1,Ae.day-Be));return V({year:Ke.getUTCFullYear(),month:Ke.getUTCMonth()+1,day:Ke.getUTCDate()},Te)}return V({year:Ae.year,month:Ae.month,day:Ae.day},Te)}function Oe(ke,_e){const Te=ke&&ke.group,je=Te&&Te.granularity||"day";if(je==="instant")return null;const Ae=Te&&Te.weekStart;return Ee=>typeof Ee=="number"?he(Ee,je,_e,Ae):Ee}const Se={time:{base:"number",storage:"float64",matches:h,format:ke=>y(u(ke.value),r(ke,"time")),parse:ke=>l(ke.text),compare:(ke,_e)=>i(u(ke),u(_e)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:ke=>{const _e=u(ke);return _e===null?null:_e/M},toStorage:ke=>u(ke),toClipboard:d,fromClipboard:l},datetime:{base:"dateString",storage:"dictionary",matches:N,format:ke=>j(ke.value,r(ke,"datetime")),parse:ke=>L(T(ke.text,r(ke,"datetime"))??ke.text),compare:q,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(ke,_e)=>L(ke,_e&&_e.timeZone),toClipboard:ke=>E(ke)?"":String(ke),fromClipboard:ke=>L(ke)},duration:{base:"number",storage:"float64",matches:ve,format:ke=>we(ne(ke.value),r(ke,"duration")),parse:ke=>X(ke.text,r(ke,"duration")),compare:(ke,_e)=>i(ne(ke),ne(_e)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:ke=>{const _e=ne(ke);return _e===null?null:_e/M},toStorage:ke=>ne(ke),toClipboard:ke=>we(ne(ke),{style:"short",maxUnits:-1}),fromClipboard:ke=>X(ke)},timestamp:{base:"number",storage:"float64",format:ke=>{const _e=r(ke,"timestamp");return ce(ke.value,{..._e,timeZone:oe(_e,ke)})},parse:ke=>{const _e=r(ke,"timestamp"),Te=T(ke.text,{timeZone:oe(_e,ke)});return Te?Te.getTime():null},compare:(ke,_e)=>i(A(ke),A(_e)),groupProjector:(ke,_e)=>Oe(ke,_e),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(ke,_e)=>{const Te=A(ke);if(Te==null)return null;const je=P(Te,_e&&_e.timeZone||void 0);return(Date.UTC(je.year,je.month-1,je.day,je.hour,je.minute,je.second)-Re)/M},toStorage:ke=>A(ke),toClipboard:ke=>{const _e=A(ke);return _e==null?"":new Date(_e).toISOString()},fromClipboard:ke=>A(ke)}},Ce=["datetime","time","duration"],Ie=Se}),He("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(W=256,I=null){this.#e=W,this.#n=I}get size(){return this.#t.size}get max(){return this.#e}set max(W){this.#e=W,this.#r()}has(W){return this.#t.has(W)}get(W){const I=this.#t;if(!I.has(W))return;const x=I.get(W);return I.delete(W),I.set(W,x),x}peek(W){return this.#t.get(W)}set(W,I){const x=this.#t;return x.has(W)&&x.delete(W),x.set(W,I),this.#r(),I}delete(W){const I=this.#t.get(W);return this.#t.delete(W)&&this.#n&&this.#n(I,W),I}clear(){if(this.#n)for(const[W,I]of this.#t)this.#n(I,W);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const W=this.#t;for(;W.size>this.#e;){const I=W.keys().next().value,x=W.get(I);W.delete(I),this.#n&&this.#n(x,I)}}}}),He("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 L}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"compareIpv4",{enumerable:!0,get:function(){return O}}),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 r}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return i}}),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 c}}),Object.defineProperty(e,"netmask",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return u}}),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 H}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return S}}),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 se}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return de}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/internal/lru.js").Lru,x=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 L(oe);const ce=Number(oe);return Number.isFinite(ce)?ce<0?ce<-2147483648?null:ce>>>0:ce>x?null:Math.trunc(ce)>>>0:null}function L(oe){if(E(oe))return null;const ce=String(oe).trim();if(ce==="")return null;const he=Q.exec(ce);if(!he)return null;let Oe=0;for(let Se=1;Se<=4;Se++){const Ce=he[Se];if(Ce.length>1&&Ce.charCodeAt(0)===48)return null;const Ie=Number(Ce);if(Ie>255)return null;Oe=Oe*256+Ie}return Oe}function q(oe){const ce=U(oe);return ce===null?"":`${ce>>>24&255}.${ce>>>16&255}.${ce>>>8&255}.${ce&255}`}function M(oe){return typeof oe=="string"&&L(oe)!==null}function O(oe,ce){const he=U(oe),Oe=U(ce);return he===null?Oe===null?0:1:Oe===null||he<Oe?-1:he>Oe?1:0}const k=64,b=x*k+32,a=/^(?: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 Oe=i(oe);return Oe===null?null:o(Oe)}if(typeof oe=="object"){const Oe=U(oe.address),Se=Number(oe.prefix);return Oe===null||!Number.isInteger(Se)||Se<0||Se>32?null:{address:Oe,prefix:Se}}const ce=Number(oe);if(!Number.isInteger(ce)||ce<0||ce>b)return null;const he=ce%k;return he>32?null:{address:(ce-he)/k,prefix:he}}function t(oe){return!!(oe&&oe.typeOptions&&oe.typeOptions.cidrNetwork)}function r(oe){return!!(oe&&oe.typeOptions&&oe.typeOptions.storeNumber)}function s(oe,ce,he){return oe==null?null:r(ce)?oe:he(oe)}function i(oe,ce){if(E(oe))return null;const he=String(oe).trim();if(he==="")return null;const Oe=he.indexOf("/");if(Oe<0)return null;const Se=L(he.slice(0,Oe));if(Se===null)return null;const Ce=he.slice(Oe+1).trim();if(!a.test(Ce))return null;const Ie=Number(Ce);if(Ie>32)return null;const ke=ce&&ce.network?(Se&l(Ie))>>>0:Se;return g(ke,Ie)}function n(oe){const ce=o(oe);return ce?`${q(ce.address)}/${ce.prefix}`:""}function m(oe){return typeof oe=="string"&&i(oe)!==null}function c(oe,ce){const he=o(oe),Oe=o(ce);return he?Oe?he.address!==Oe.address?he.address<Oe.address?-1:1:he.prefix-Oe.prefix:-1:Oe?1:0}function l(oe){return oe===0?0:4294967295<<32-oe>>>0}function u(oe){const ce=o(oe);return ce?(ce.address&l(ce.prefix))>>>0:null}function f(oe){const ce=o(oe);return ce?(ce.address&l(ce.prefix)|~l(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 he=o(oe);if(!he)return!1;const Oe=U(ce);if(Oe===null)return!1;const Se=l(he.prefix);return(Oe&Se)>>>0===(he.address&Se)>>>0}function d(oe,ce){const he=u(oe),Oe=u(ce);return he===null||Oe===null?!1:he<=f(ce)&&Oe<=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 he=ce.indexOf("%");if(he>=0&&(ce=ce.slice(0,he)),ce==="")return null;if(ce.indexOf(".")>=0){const _e=ce.lastIndexOf(":");if(_e<0)return null;const Te=L(ce.slice(_e+1));if(Te===null)return null;ce=`${ce.slice(0,_e+1)}${(Te>>>16&65535).toString(16)}:${(Te&65535).toString(16)}`}const Oe=ce.split("::");if(Oe.length>2)return null;const Se=G(Oe[0]);if(Se===null)return null;if(Oe.length===1)return Se.length===8?Se:null;const Ce=G(Oe[1]);if(Ce===null)return null;const Ie=8-Se.length-Ce.length;if(Ie<1)return null;const ke=Se.slice();for(let _e=0;_e<Ie;_e++)ke.push(0);for(const _e of Ce)ke.push(_e);return ke}function G(oe){if(oe==="")return[];const ce=[];for(const he of oe.split(":")){if(!w.test(he))return null;ce.push(parseInt(he,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 K(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,he=0,Oe=-1,Se=0;for(let ke=0;ke<8;ke++)oe[ke]===0?(Oe<0?(Oe=ke,Se=1):Se++,Se>he&&(he=Se,ce=Oe)):(Oe=-1,Se=0);if(he<2)return oe.map(ke=>ke.toString(16)).join(":");const Ce=oe.slice(0,ce).map(ke=>ke.toString(16)).join(":"),Ie=oe.slice(ce+he).map(ke=>ke.toString(16)).join(":");return`${Ce}::${Ie}`}function H(oe){const ce=P(oe);return ce===null?null:K(ce)}function T(oe){return H(oe)??""}function A(oe){return typeof oe=="string"&&oe.indexOf(":")>=0&&P(oe)!==null}function S(oe,ce){const he=V(oe),Oe=V(ce);if(!he)return Oe?1:0;if(!Oe)return-1;for(let Se=0;Se<8;Se++)if(he[Se]!==Oe[Se])return he[Se]<Oe[Se]?-1:1;return 0}const R=/^[0-9a-fA-F]{12}$/,j=/^[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 he=0;he<12;he+=2)ce.push(parseInt(oe.slice(he,he+2),16));return ce}function _(oe){if(E(oe))return null;if(typeof oe=="number"){if(!Number.isInteger(oe)||oe<0||oe>0xffffffffffff)return null;const Se=[];for(let Ce=5;Ce>=0;Ce--)Se.push(Math.floor(oe/256**Ce)%256);return Se}const ce=String(oe).trim();if(ce==="")return null;if(R.test(ce))return $(ce);if(ce.indexOf(".")>=0)return j.test(ce)?$(ce.split(".").join("")):null;const he=ce.indexOf(":")>=0?":":ce.indexOf("-")>=0?"-":null;if(he===null)return null;const Oe=ce.split(he);if(Oe.length!==6)return null;for(const Se of Oe)if(!N.test(Se))return null;return Oe.map(Se=>parseInt(Se,16))}function Y(oe){const ce=_(oe);if(!ce)return null;let he=0;for(const Oe of ce)he=he*256+Oe;return he}function Z(oe){const ce=_(oe);return ce?ce.map(he=>he.toString(16).padStart(2,"0")).join(":"):null}function J(oe,ce="colon"){const he=_(oe);if(!he)return"";const Oe=he.map(Se=>Se.toString(16).padStart(2,"0"));switch(ce){case"hyphen":return Oe.join("-");case"colon-upper":return Oe.map(Se=>Se.toUpperCase()).join(":");case"cisco":return`${Oe[0]}${Oe[1]}.${Oe[2]}${Oe[3]}.${Oe[4]}${Oe[5]}`;default:return Oe.join(":")}}function D(oe){return typeof oe=="string"&&_(oe)!==null}function te(oe){if(E(oe))return null;const ce=String(oe).trim();if(ce==="")return null;const he=ce.replace(/[:-]/g,"").replace(/\./g,"").toLowerCase();return/^[0-9a-f]+$/.test(he)?he:null}function z(oe,ce){const he=te(oe),Oe=te(ce);return!!(he&&Oe&&he.includes(Oe))}function X(oe,ce){const he=Y(oe),Oe=Y(ce);return he===null?Oe===null?0:1:Oe===null||he<Oe?-1:he>Oe?1:0}const ne=Object.freeze(["macEquals","macInRange","macContains"]),re=Object.freeze(["eq","ne","contains","notContains","startsWith","endsWith"]);function ae(oe){switch(oe){case"macEquals":return{compile:ce=>{const he=Y(ce);return he===null?()=>!1:Oe=>Y(Oe)===he},check:ce=>Y(ce)===null?"the operand is not a MAC address":null};case"macInRange":return{compile:ce=>{const he=Array.isArray(ce)?ce:[ce,ce],Oe=Y(he[0]),Se=Y(he[1]);return Oe===null||Se===null||Oe>Se?()=>!1:Ce=>{const Ie=Y(Ce);return Ie!==null&&Ie>=Oe&&Ie<=Se}},check:ce=>{const he=Array.isArray(ce)?ce:[];if(he.length!==2)return"the operand must be two MAC addresses, the low and high ends of the range";const Oe=Y(he[0]),Se=Y(he[1]);return Oe===null||Se===null?"an end of the range is not a MAC address":Oe>Se?"the low end of the range is above the high end":null}};case"macContains":return{compile:ce=>he=>z(he,ce),check:ce=>te(ce)===null?"the operand is not hex":null};default:return{compile:()=>()=>!1,check:()=>"unknown MAC operator"}}}function fe(oe){switch(oe){case"eq":return{compile:ce=>{const he=Y(ce);return he===null?()=>!1:Oe=>Y(Oe)===he},check:ce=>Y(ce)===null?"the operand is not a MAC address":null};case"ne":return{compile:ce=>{const he=Y(ce);return he===null?()=>!1:Oe=>Y(Oe)!==he},check:ce=>Y(ce)===null?"the operand is not a MAC address":null};case"contains":return{compile:ce=>he=>z(he,ce),check:ce=>te(ce)===null?"the operand is not hex":null};case"notContains":return{compile:ce=>he=>!z(he,ce),check:ce=>te(ce)===null?"the operand is not hex":null};case"startsWith":return{compile:ce=>{const he=String(ce??"").toLowerCase();return Oe=>Oe==null?!1:String(Oe).toLowerCase().startsWith(he)}};case"endsWith":return{compile:ce=>{const he=String(ce??"").toLowerCase();return Oe=>Oe==null?!1:String(Oe).toLowerCase().endsWith(he)}};default:return{compile:()=>()=>!1,check:()=>"unknown MAC text operator"}}}const we=Object.freeze(["lt","lte","gt","gte","between","notBetween","in","notIn","matches"]);function ve(oe){const ce=o(oe);return ce===null?null:g(ce.address,ce.prefix)}function Re(oe,ce,he){const Oe=ke=>String(ke??"").trim().toLowerCase(),Se=ke=>{if(ke==null)return null;const _e=ce(ke);return _e===""?null:_e.toLowerCase()},Ce=ke=>oe(ke)===null?`the operand is not ${he}`:null,Ie=(ke,_e)=>({compile:Te=>{const je=Oe(Te);return Ae=>{const Ee=Se(Ae);return Ee===null?_e:_e?!ke(Ee,je):ke(Ee,je)}}});return Object.freeze({eq:{compile:ke=>{const _e=oe(ke);return _e===null?()=>!1:Te=>oe(Te)===_e},check:Ce},ne:{compile:ke=>{const _e=oe(ke);return _e===null?()=>!0:Te=>oe(Te)!==_e},check:Ce},contains:Ie((ke,_e)=>ke.includes(_e),!1),notContains:Ie((ke,_e)=>ke.includes(_e),!0),startsWith:Ie((ke,_e)=>ke.startsWith(_e),!1),endsWith:Ie((ke,_e)=>ke.endsWith(_e),!1),...Object.fromEntries(we.map(ke=>[ke,Object.freeze({})]))})}const $e=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"}),be=(oe,ce)=>he=>{const Oe=he&&typeof he.text=="string"?he.text:"";return Oe.trim()!==""&&oe(Oe)===null?ce:null},se=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:M,parse:oe=>L(oe.text),parseError:be(L,$e.ipv4),compare:O,format:oe=>q(oe.value),operators:Re(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=>L(oe)},cidr:{base:"number",storage:"float64",matches:m,parse:oe=>i(oe.text,{network:t(oe.column)}),parseError:be(i,$e.cidr),compare:c,format:oe=>n(oe.value),operators:Re(ve,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)=>i(oe,{network:t(ce&&ce.column)})},ipv6:{base:"text",storage:"dictionary",matches:A,parse:oe=>H(oe.text),parseError:be(H,$e.ipv6),compare:S,format:oe=>T(oe.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:oe=>H(oe),toClipboard:oe=>T(oe),fromClipboard:oe=>H(oe)},mac:{base:"text",storage:"dictionary",matches:D,parse:oe=>Z(oe.text),parseError:be(Z,$e.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,ae(oe)])),...Object.fromEntries(re.map(oe=>[oe,fe(oe)]))}),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:oe=>Z(oe),fromClipboard:oe=>Z(oe)}}),de=se}),He("packages/core/src/columns/types/vlan.js",function(e,F){"use strict";Object.defineProperty(e,"vlanError",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"parseVlans",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"formatVlans",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"vlanContains",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"vlanOverlaps",{enumerable:!0,get:function(){return O}}),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 a}}),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,W=/^\d+$/;function I(t,r){const s=!!(r&&r.single),i=t==null?"":String(t).trim();if(i==="")return{ids:null,error:null};const n=i.split(","),m=new Set;for(const c of n){const l=c.trim();if(l==="")return{ids:null,error:`"${i}" has an empty entry`};const u=l.indexOf("-");if(u>=0){if(s)return{ids:null,error:"a single-ID VLAN column holds one ID, not a list or range"};const f=l.slice(0,u).trim(),p=l.slice(u+1).trim();if(!W.test(f)||!W.test(p))return{ids:null,error:`"${l}" 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(!W.test(l))return{ids:null,error:`"${l}" is not a VLAN ID (a whole number ${ie}-${E})`};const f=Number(l);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((c,l)=>c-l),error:null}}function x(t,r){return I(t,r).error}function Q(t){const r=[];let s=0;for(;s<t.length;){let i=s;for(;i+1<t.length&&t[i+1]===t[i]+1;)i++;r.push(i===s?String(t[s]):`${t[s]}-${t[i]}`),s=i+1}return r.join(",")}function U(t){if(t==null||t==="")return null;if(typeof t=="string")return I(t,{}).ids;if(Array.isArray(t)){const r=new Set;for(const s of t){if(typeof s!="number"||!Number.isInteger(s)||s<ie||s>E)return null;r.add(s)}return r.size?[...r].sort((s,i)=>s-i):null}return typeof t=="number"&&Number.isInteger(t)&&t>=ie&&t<=E?[t]:null}function L(t,r){const s=I(t,r);return s.ids===null?null:Q(s.ids)}function q(t){const r=U(t);return r===null?"":Q(r)}function M(t,r){const s=U(t);if(s===null)return!1;const i=Number(r);return Number.isInteger(i)&&s.includes(i)}function O(t,r){const s=U(t);if(s===null)return!1;const i=new Set(s),n=Array.isArray(r)?r:typeof r=="string"?r.split(","):[r];for(const m of n){const c=Number(typeof m=="string"?m.trim():m);if(Number.isInteger(c)&&i.has(c))return!0}return!1}function k(t){const r=U(t);return r===null?0:r.length}function b(t){return typeof t=="string"&&L(t)!==null}function a(t,r){const s=U(t),i=U(r);return s===null?i===null?0:1:i===null?-1:s[0]!==i[0]?s[0]<i[0]?-1:1:s.length<i.length?-1:s.length>i.length?1:0}const g=Object.freeze({vlan:{base:"text",storage:"dictionary",matches:b,parse:t=>L(t.text,{single:!!(t.column&&t.column.typeOptions&&t.column.typeOptions.vlanSingle)}),parseError:t=>x(t.text,{single:!!(t.column&&t.column.typeOptions&&t.column.typeOptions.vlanSingle)}),compare:a,format:t=>q(t.value),defaults:{filter:"text",editor:"vlan",align:"start"},excel:"@",operators:Object.freeze({contains:{compile:t=>r=>M(r,t),check:t=>{const r=Number(typeof t=="string"?t.trim():t);return!Number.isInteger(r)||r<ie||r>E?`contains needs one VLAN ID ${ie}-${E}`:null}},overlaps:{compile:t=>r=>O(r,t),check:t=>{const r=Array.isArray(t)?t:typeof t=="string"?t.split(","):[t];for(const s of r){const i=Number(typeof s=="string"?s.trim():s);if(!Number.isInteger(i)||i<ie||i>E)return`overlaps needs VLAN IDs ${ie}-${E}`}return null}}}),toStorage:t=>L(t),toClipboard:t=>q(t),fromClipboard:t=>L(t)}}),o=g}),He("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 x}});const ie=F("packages/core/src/registry/free-tier-notice.js"),E=ie.FREE_TIER_NOTICE,W=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":W,"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"}),x=Object.freeze(Object.keys(I))}),He("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 M}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return k}});const E=F("packages/core/src/internal/predicates.js").isFunction,W=/\{(\w+)\}/g,I=new Map,x=new Map;function Q(b){const a=b||"";if(I.has(a))return I.get(a);let g=null;try{g=new Intl.PluralRules(b||void 0)}catch{g=null}return I.set(a,g),g}function U(b,a,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=`${a||""}|${g}`;let r=x.get(t);if(r===void 0){try{r=new Intl.ListFormat(a||void 0,{style:"long",type:g})}catch{r=null}x.set(t,r)}return r?r.format(o.map(String)):o.map(String).join(", ")}function L(b,a){return b==null?"":typeof b=="number"?Number.isFinite(b)?b.toLocaleString(a||void 0,{maximumFractionDigits:20}):"":String(b)}function q(b,a,g){if(typeof b=="string")return b;if(!b||typeof b!="object")return"";const o=a&&typeof a.count=="number"?a.count:null;if(o===null)return b.other??"";const t=Q(g),r=t?t.select(o):o===1?"one":"other";return b[r]??b.other??""}function M(b,a={},g){const o=q(b,a,g);return o?o.replace(W,(t,r)=>Object.prototype.hasOwnProperty.call(a,r)?L(a[r],g):t):""}function O(b,a,g="en-GB"){return typeof b=="string"&&b?b:typeof a=="string"&&a?a:g}function k(b,a){const g=b?b[a]:void 0;return g==null||E(g)?a:g}}),He("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 x}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return Q}});const E=F("packages/core/src/i18n/catalogue.js").EN_GB,W=new Map([["en-gb",E]]);function I(U,L){const q=typeof U=="string"?U.toLowerCase():"";return!q||!L||typeof L!="object"?!1:(W.set(q,L),!0)}function x(U){if(typeof U!="string"||!U)return null;const L=U.toLowerCase(),q=W.get(L);if(q)return q;const M=L.split("-")[0],O=W.get(M);if(O)return O;for(const[k,b]of W)if(k.split("-")[0]===M)return b;return null}function Q(){return[...W.keys()]}}),He("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 r}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return i}});const ie=F("packages/core/src/i18n/catalogue.js"),E=ie.EN_GB,W=ie.MESSAGE_KEYS,I=F("packages/core/src/i18n/format.js"),x=I.formatMessage,Q=I.formatList,U=I.lookup,L=I.resolveLocale,M=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"),a=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=L(m.locale,m.declared,o);const c=m.messages,l=g(this.#e);if(!l&&this.#e.toLowerCase()!=="en-gb"&&(!c||typeof c!="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.`),!c||typeof c!="object"){this.#t=l?{...E,...l}:E;return}const f=Object.keys(c).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,...l||{},...c}}get locale(){return this.#e}t(m,c){return x(U(this.#t,m),c||{},this.#e)}list(m,c){return Q(m,this.#e,c)}number(m,c){const l=Number(m);return Number.isFinite(l)?l.toLocaleString(this.#e,c||{maximumFractionDigits:20}):""}}const r=new t;function s(n){return n instanceof t?n:new t(n||{})}function i(n){const m=n&&typeof n=="object"?n:{},c=W.filter(u=>{const f=m[u];return f==null||f===""||M(f)}),l=Object.keys(m).filter(u=>!(u in E));return{missing:c,unknown:l}}}),He("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 M}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return O}}),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,W=ie.isObject,x=F("packages/core/src/i18n/index.js").defaultMessages,Q=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function U(t,r){const s=r||{},i=s.emptyDisplay??Q.emptyDisplay;if(E(t)||t==="")return i;const m=[...typeof s.char=="string"&&s.char!==""?s.char:Q.char][0]||Q.char,c=s.fixedLength??Q.fixedLength,l=Number.isFinite(s.length)&&Number(s.length)>0?Math.floor(Number(s.length)):Q.length,u=typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):null;let f=0;if(u!==null){const p=Number.isFinite(s.lastVisible)?Math.floor(Number(s.lastVisible)):Q.lastVisible,y=[...u];if(f=p>0&&p<y.length?p:0,f>0){const h=y.slice(y.length-f).join(""),d=Math.max(1,(c?l:y.length)-f);return m.repeat(d)+h}return m.repeat(c?l:Math.max(1,y.length))}return m.repeat(l)}const L=48;function q(t){try{const r=JSON.stringify(t);return r===void 0?null:r}catch{return null}}function M(t,r){if(E(t))return"";const s=Number.isFinite(r&&r.inlineLimit)?Number(r.inlineLimit):L;if(typeof t=="string")return t.length>s?`${t.slice(0,s-1)}…`:t;if(typeof t!="object")return String(t);const i=q(t);if(i!==null&&i.length<=s)return i;if(Array.isArray(t)){const m=t.length;return`[${x.t("count.items",{count:m})}]`}const n=Object.keys(t).length;return`{${x.t("count.keys",{count:n})}}`}function O(t,r){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 i=r||new WeakSet;return i.has(t)?'"[circular]"':(i.add(t),t instanceof Date?JSON.stringify(t.toISOString()):Array.isArray(t)?`[${t.map(c=>O(c,i)).join(",")}]`:`{${Object.keys(t).sort().map(c=>`${JSON.stringify(c)}:${O(t[c],i)}`).join(",")}}`)}function k(t,r){if(E(t))return E(r)?0:1;if(E(r))return-1;const s=O(t),i=O(r);return s<i?-1:s>i?1:0}function b(t){if(E(t))return null;const r=String(t);if(r.trim()==="")return null;try{return JSON.parse(r)}catch{return r}}function a(t){const r=t&&t.cell&&t.cell.props;return W(r)?r:{}}const g=Object.freeze({json:{base:"object",storage:"object",format:t=>M(t&&t.value,a(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 r=JSON.stringify(t,null,2);return r===void 0?String(t):r}catch{return String(t)}},fromClipboard:t=>b(t)},secret:{base:"text",storage:"object",format:t=>U(t&&t.value,a(t&&t.column)),parse:t=>{const r=t&&t.text;return E(r)||String(r)===""?null:String(r)},compare:(t,r)=>{const s=E(t)||t==="",i=E(r)||r==="";return s===i?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}),He("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 O}}),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 c}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return j}}),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 x($,_,Y,Z){return Object.freeze({symbol:$,factor:_,aliases:Object.freeze(Y||[]),binary:!!(Z&&Z.binary),prefix:Z&&Z.prefix||null,auto:!(Z&&Z.auto===!1)})}function Q($,_,Y,Z){return x($,_,Y,Z)}const U=Object.freeze({data:Object.freeze([x("B",1,["byte","bytes"]),x("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),x("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),x("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),x("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),x("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),x("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),x("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),x("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),x("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([x("bps",1,["bit","bits","bit/s","b/s"]),x("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),x("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),x("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),x("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([x("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),x("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),x("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),x("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),x("in",.0254,["inch","inches"],{auto:!1}),x("ft",.3048,["foot","feet"],{auto:!1}),x("yd",.9144,["yard","yards"],{auto:!1}),x("m",1,["metre","metres","meter","meters"]),x("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),x("mi",1609.344,["mile","miles"],{auto:!1}),x("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([x("mg",.001,["milligram","milligrams"]),x("g",1,["gram","grams"]),x("oz",28.349523125,["ounce","ounces"],{auto:!1}),x("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),x("kg",1e3,["kilogram","kilograms"]),x("st",6350.29318,["stone"],{auto:!1}),x("t",1e6,["tonne","tonnes","ton"],{auto:!1}),x("ton (US)",907184.74,["ton","shortton"],{auto:!1}),x("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([x("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),x("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),x("ms",.001,["msec","msecs","millisecond","milliseconds"]),x("s",1,["sec","secs","second","seconds"]),x("m",60,["min","mins","minute","minutes"]),x("h",3600,["hr","hrs","hour","hours"]),x("d",86400,["day","days"])]),speed:Object.freeze([x("mm/s",.001,["millimetre/s","millimeter/s"]),x("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),x("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),x("mph",.44704,["mile/h","miles/h"],{auto:!1}),x("kn",1852/3600,["knot","knots"],{auto:!1}),x("m/s",1,["metre/s","meter/s","mps"]),x("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([x("mm/s²",.001,["mm/s2"]),x("ft/s²",.3048,["ft/s2"],{auto:!1}),x("m/s²",1,["m/s2","metre/s2","meter/s2"]),x("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([x("mm²",1e-6,["mm2"]),x("cm²",1e-4,["cm2"]),x("in²",64516e-8,["in2","sqin"],{auto:!1}),x("ft²",.09290304,["ft2","sqft"],{auto:!1}),x("yd²",.83612736,["yd2","sqyd"],{auto:!1}),x("m²",1,["m2","sqm"]),x("ha",1e4,["hectare","hectares"],{auto:!1}),x("ac",4046.8564224,["acre","acres"],{auto:!1}),x("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([x("µL",1e-6,["ul","microlitre","microliter"]),x("mL",.001,["millilitre","milliliter"]),x("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),x("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),x("L",1,["litre","litres","liter","liters"]),x("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),x("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),x("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),x("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([x("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),x("J",1,["joule","joules"]),x("cal",4.184,["calorie","calories"],{auto:!1}),x("kJ",1e3,["kilojoule","kilojoules"]),x("BTU",1055.05585262,["btu"],{auto:!1}),x("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),x("MJ",1e6,["megajoule","megajoules"]),x("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),x("GJ",1e9,["gigajoule","gigajoules"]),x("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([x("mW",.001,["milliwatt","milliwatts"]),x("W",1,["watt","watts"]),x("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),x("kW",1e3,["kilowatt","kilowatts"]),x("hp",745.6998715822702,["horsepower"],{auto:!1}),x("MW",1e6,["megawatt","megawatts"]),x("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([x("mN",.001,["millinewton","millinewtons"]),x("N",1,["newton","newtons"]),x("lbf",4.4482216152605,["poundforce"],{auto:!1}),x("kgf",9.80665,["kilogramforce"],{auto:!1}),x("kN",1e3,["kilonewton","kilonewtons"]),x("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([x("Pa",1,["pascal","pascals"]),x("mbar",100,["millibar"],{auto:!1}),x("inH₂O",249.0889,["inh2o"],{auto:!1}),x("mmHg",133.322387415,["torr"],{auto:!1}),x("kPa",1e3,["kilopascal","kilopascals"]),x("inHg",3386.388640341,["inhg"],{auto:!1}),x("psi",6894.757293168361,["lbf/in2"],{auto:!1}),x("bar",1e5,[],{auto:!1}),x("atm",101325,["atmosphere","atmospheres"],{auto:!1}),x("MPa",1e6,["megapascal","megapascals"]),x("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([x("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),x("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),x("kN·m",1e3,["knm","kn.m"],{auto:!1}),x("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([x("kg/m³",1,["kg/m3"]),x("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),x("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),x("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([x("L/min",1/6e4,["lpm","l/min"],{auto:!1}),x("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),x("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),x("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),x("cfm",.0004719474432,["ft3/min"],{auto:!1}),x("L/s",.001,["lps","l/s"],{auto:!1}),x("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([x("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),x("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),x("mrad",.001,["milliradian","milliradians"],{auto:!1}),x("mil",Math.PI/3200,["nato-mil"],{auto:!1}),x("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),x("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),x("rad",1,["radian","radians"]),x("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([x("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),x("rad/s",1,["radps","radians/s"]),x("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),x("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([x("ppt",1e-12,["partspertrillion"],{auto:!1}),x("ppb",1e-9,["partsperbillion"]),x("ppm",1e-6,["partspermillion"]),x("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),x("‰",.001,["permille","permil"],{auto:!1}),x("%",.01,["pct","percent"]),x("×",1,["x","ratio","times"])]),molarity:Object.freeze([x("pM",1e-12,["picomolar","picomolarity"]),x("nM",1e-9,["nanomolar","nanomolarity"]),x("µM",1e-6,["um-molar","micromolar","micromolarity"]),x("mM",.001,["millimolar","millimolarity"]),x("M",1,["molar","mol/l","mol/L","molarity"]),x("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([x("mg/s",1e-6,["milligrams/s"]),x("g/s",.001,["grams/s"]),x("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),x("kg/s",1,["kilograms/s","kgps"]),x("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),x("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),x("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([x("µPa·s",1e-6,["upas","micropascalsecond"]),x("cP",.001,["centipoise"],{auto:!1}),x("mPa·s",.001,["mpas","millipascalsecond"]),x("P",.1,["poise"],{auto:!1}),x("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([x("cSt",1e-6,["centistokes","centistoke"]),x("mm²/s",1e-6,["mm2/s"],{auto:!1}),x("St",1e-4,["stokes","stoke"],{auto:!1}),x("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([x("mW/(m·K)",.001,["mw/mk"]),x("W/(m·K)",1,["w/mk","wmk"]),x("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),x("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([x("J/(kg·K)",1,["j/kgk","jkgk"]),x("kJ/(kg·K)",1e3,["kj/kgk"]),x("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([x("nSv/h",1e-9,["nsvh"]),x("µSv/h",1e-6,["usv/h","usvh"]),x("mSv/h",.001,["msvh"]),x("Sv/h",1,["svh"]),x("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),L=Symbol("ambiguous"),q=new Map,M=new Map;function O($,_){const Y=String($||"").trim();if(!Y)throw new Error("[lattice] a unit system needs a name");if(U[Y]||M.has(Y))throw new Error(`[lattice] unit system "${Y}" already exists`);const Z=[..._||[]];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 M.set(Y,Object.freeze(Z)),q.delete(Y),Y}function k(){return[...Object.keys(U),...M.keys()]}function b($){const _=a($);return _?_.units:[]}function a($){const _=String($||""),Y=q.get(_);if(Y!==void 0)return Y;const Z=U[_]||M.get(_);if(!Z)return q.set(_,null),null;const J=Object.freeze([...Z].sort((ne,re)=>ne.factor-re.factor)),D=new Map,te=new Map,z=(ne,re)=>{const ae=D.get(ne);ae===void 0?D.set(ne,re):ae!==re&&D.set(ne,L)};for(const ne of J){z(ne.symbol.toLowerCase(),ne);for(const re of ne.aliases)z(re.toLowerCase(),ne);if(ne.prefix){const re=te.get(ne.prefix)||[];re.push(ne),te.set(ne.prefix,re)}}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(_,X),X}function g($,_){return _&&$.binary||$.decimal}function o($,_){const Y=a($);if(!Y||E(_))return null;const Z=Y.units.find(D=>D.symbol===String(_));if(Z)return Z;const J=Y.byToken.get(String(_).trim().toLowerCase());return J&&J!==L?J:null}const t=new WeakMap;function r($){const _=$||{};if(typeof _=="object"&&_!==null){const D=t.get(_);if(D!==void 0)return D}const Y=_.system||"data",Z=a(Y);let J=null;if(!Z)I(`unit:system:${Y}`,`unknown unit system "${Y}"; known systems are ${k().join(", ")}`);else{let D=_.unit?o(Y,_.unit):null;D||(_.unit&&I(`unit:unit:${Y}:${_.unit}`,`unknown unit "${_.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:_.binary===!0}}return typeof _=="object"&&_!==null&&t.set(_,J),J}const s=new WeakMap;function i($,_){if(!$||!_||!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($,_,Y){return _===Y||_.factor===Y.factor?$:$*_.factor/Y.factor}const m=new Map;function c($){const _=$||"",Y=m.get(_);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(_,Z),Z}const l=/[\s ]/g,u=/^[+-]?[\d '’ .,]*(?:[eE][+-]?\d+)?/,f=/^[^\d+\-(.,\s]+\s*/,p=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function y($,_){const{group:Y,decimal:Z}=c(_);let J=String($).replace(l,"");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($,_,Y){const Z=String($).trim().replace(/\.$/,"");if(Z==="")return null;const J=_.units.find(re=>re.symbol===Z);if(J)return J;const D=Z.toLowerCase(),te=_.byToken.get(D);if(te===L)return null;if(te)return te;const z=_.byPrefix.get(D);if(!z||!z.length)return null;const X=g(_,Y),ne=z.filter(re=>X.includes(re));return ne.length===1?ne[0]:null}function d($,_,Y,Z){let J=$,D=0,te=!1,z=!1;for(;J!=="";){const X=u.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 re=J.search(/[+-]?[\d]/),ae=(re>=0?J.slice(0,re):J).trim();if(J=re>=0?J.slice(re).trim():"",ae===""){if(te)return null;z=!0,D+=n(ne,Y[0],_.base)}else{const fe=h(ae,_.index,_.binary);if(!fe)return null;D+=n(ne,fe,_.base)}if(te=!0,z&&J!=="")return null}return te?D:null}function w($,_){if(E($))return null;if(typeof $=="number")return Number.isFinite($)?$:null;const Y=r(_);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=i(_,Y);if(D){Z.startsWith("-")&&(J=!0,Z=Z.slice(1).trim());const we=d(Z,Y,D,_);return we===null?null:J?-we:we}let te=null;const z=f.exec(Z);if(z&&z[0]){const we=h(z[0].trim(),Y.index,Y.binary);we&&(te=we,Z=Z.slice(z[0].length).trim())}const X=u.exec(Z)[0],ne=y(X,_&&_.locale);if(ne===null)return null;const re=Z.slice(X.length).trim();if(te&&re!=="")return null;const ae=te||(re===""?Y.base:h(re,Y.index,Y.binary));if(!ae)return null;const fe=n(ne,ae,Y.base);return J?-fe:fe}const v=new Map;function P($,_,Y,Z){const J=`${$||""}|${_}|${Y}|${Z?1:0}`;let D=v.get(J);return D||(D=new Intl.NumberFormat($||void 0,{minimumFractionDigits:_,maximumFractionDigits:Y,useGrouping:Z}),v.set(J,D)),D}function G($,_){if(!Number.isFinite($)||$===0)return Math.max(0,_-1);const Y=Math.floor(Math.log10(Math.abs($)));return Math.min(20,Math.max(0,_-1-Y))}function V($,_){if(!Number.isFinite($)||$===0)return $;const Y=Math.ceil(Math.log10(Math.abs($))),Z=10**(_-Y);return Math.round($*Z)/Z}function K($,_,Y){if(!Y||Y===_.base.symbol)return _.base;if(Y!=="auto")return H(_,Y);if($===0||!Number.isFinite($))return _.base;const Z=Math.abs($)*_.base.factor,J=g(_.index,_.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 _.index.units)X.binary!==_.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 _.index.units)X.binary!==_.binary&&X.factor!==1||X.factor<z.factor&&(z=X);return z.factor<_.base.factor?z:_.base}function H($,_){const Y=$.index.units.find(J=>J.symbol===_);if(Y)return Y;const Z=$.index.byToken.get(String(_).toLowerCase());return Z&&Z!==L?Z:(I(`unit:display:${_}`,`unknown display unit "${_}"; rendering in ${$.base.symbol}`),$.base)}function T($,_,Y,Z){const J=$<0;let D=Math.abs($)*_.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 ae=0;ae<Y.length;ae++){const fe=Y[ae],we=ae===Y.length-1;let ve=we?D/fe.factor:Math.floor(D/fe.factor);if(D-=ve*fe.factor,we){const $e=10**z;ve=Math.round(ve*$e)/$e+0}const Re=we?P(Z.locale,te,z,Z.group!==!1):P(Z.locale,0,0,Z.group!==!1);ne.push(`${Re.format(ve)}${X}${fe.symbol}`)}const re=ne.join(" ");return J?`-${re}`:re}function A($,_){const Y=_||{},Z=Y.nullDisplay??"";if(E($)||$==="")return Z;const J=typeof $=="number"?$:Number($);if(!Number.isFinite(J))return Z;const D=r(Y);if(!D)return String(J);const te=i(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=K(X,D,Y.display),re=n(X,D.base,ne);let ae=typeof Y.decimals=="number"?Y.decimals:Y.minDecimals??0,fe=typeof Y.decimals=="number"?Y.decimals:Y.maxDecimals??Math.max(ae,2);z&&(ae=G(re,z),fe=ae);const we=P(Y.locale,ae,fe,Y.group!==!1).format(re),ve=Y.space??" ";return Y.placement==="prefix"?`${ne.symbol}${Y.space??""}${we}`:`${we}${ve}${ne.symbol}`}function S($,_){const Y=E($)||Number.isNaN($)?null:Number($),Z=E(_)||Number.isNaN(_)?null:Number(_);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 R($){const _=typeof $.decimals=="number"&&$.decimals>0?`.${"0".repeat($.decimals)}`:"";return`${typeof $.decimals=="number"?`#,##0${_}`:"#,##0.##"}" ${$.symbol}"`}function j($){const _={system:"data",...$||{}},Y=r(_),Z=Y?Y.base.symbol:String(_.unit||""),J=Object.freeze({..._,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 re=te.get(ne);return re||(re=Object.freeze({...J,locale:X||void 0}),te.set(ne,re)),re};return{base:"number",extends:"number",storage:"float64",unitConfig:J,format:X=>A(X.value,X.locale?z(X.locale):J),parse:X=>w(X.text,X.locale?z(X.locale):J),compare:S,defaults:{filter:"number",editor:"unit",align:"end",total:_.total||"sum"},..._.totals?{totals:_.totals}:{},excel:_.excel||R({decimals:_.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=>A(X,D),fromClipboard:X=>w(X,J)}}const N=j}),He("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 x}});const E=F("packages/core/src/internal/predicates.js").isNil,I=F("packages/core/src/columns/types/unit.js").createUnitType;function x(L){const q=2*Math.PI/L;return M=>{let O=0,k=0,b=0;for(const g of M||[]){if(E(g))continue;const o=Number(g);Number.isFinite(o)&&(O+=Math.cos(o*q),k+=Math.sin(o*q),b+=1)}return!b||Math.hypot(O,k)/b<1e-12?null:(Math.atan2(k,O)/q%L+L)%L}}function Q(L){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:x(L)}}}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})})}),He("packages/core/src/columns/types/si.js",function(e,F){"use strict";Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return O}});const ie=F("packages/core/src/columns/types/unit.js"),E=ie.defineUnit,W=ie.registerUnitSystem,I=ie.createUnitType,x=Object.freeze([Object.freeze({symbol:"f",name:"femto",factor:1e-15}),Object.freeze({symbol:"p",name:"pico",factor:1e-12}),Object.freeze({symbol:"n",name:"nano",factor:1e-9}),Object.freeze({symbol:"µ",name:"micro",factor:1e-6}),Object.freeze({symbol:"m",name:"milli",factor:.001}),Object.freeze({symbol:"c",name:"centi",factor:.01}),Object.freeze({symbol:"",name:"",factor:1}),Object.freeze({symbol:"k",name:"kilo",factor:1e3}),Object.freeze({symbol:"M",name:"mega",factor:1e6}),Object.freeze({symbol:"G",name:"giga",factor:1e9}),Object.freeze({symbol:"T",name:"tera",factor:1e12}),Object.freeze({symbol:"P",name:"peta",factor:1e15})]),Q=Object.freeze(["p","n","µ","m","","k","M","G"]);function U(k){const b=String(k.base),a=new Set([...k.prefixes||Q,""]),g=[];for(const o of x){if(!a.has(o.symbol))continue;const t=`${o.symbol}${b}`,r=[];if(k.name){r.push(`${o.name}${k.name}`,`${o.name}${k.name}s`);const s=o.name.slice(-1);if(s&&k.name.startsWith(s)){const i=`${o.name.slice(0,-1)}${k.name}`;r.push(i,`${i}s`)}}o.symbol==="µ"&&r.push(`u${b}`),o.factor===1&&k.aliases&&r.push(...k.aliases),g.push(E(t,o.factor,r))}for(const o of k.extra||[])g.push(o);return g}function L(k,b){const a=U(b);return W(k,a)}function q(k,b,a){return L(k,b),I({system:k,unit:b.base,display:"auto",maxDecimals:3,...a||{}})}const M=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"]})}),O=q}),He("packages/core/src/columns/types/temperature.js",function(e,F){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return O}}),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 a}});const E=F("packages/core/src/internal/predicates.js").isNil,W=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[r,s]of Object.entries(W))if(o===r||o===s.symbol)return{key:r,scale:s};const t=o.toLowerCase();for(const[r,s]of Object.entries(W))if(s.aliases.includes(t))return{key:r,scale:s};return null}function x(g,o,t){const r=I(o),s=I(t);return!r||!s||!Number.isFinite(Number(g))?null:r.key===s.key?Number(g):s.scale.fromKelvin(r.scale.toKelvin(Number(g)))}const Q=new Map;function U(g,o,t){const r=`${g||""}|${o}|${t}`;let s=Q.get(r);return s||(s=new Intl.NumberFormat(g||void 0,{minimumFractionDigits:o,maximumFractionDigits:t}),Q.set(r,s)),s}function L(g,o){const t=o||{},r=t.nullDisplay??"";if(E(g)||g==="")return r;const s=Number(g);if(!Number.isFinite(s))return r;const i=I(t.scale||"C");if(!i)return String(s);const n=I(t.display||t.scale||"C")||i,m=n.key===i.key?s:n.scale.fromKelvin(i.scale.toKelvin(s)),c=typeof t.decimals=="number"?t.decimals:null,l=c??t.minDecimals??0,u=c??t.maxDecimals??1;return`${U(t.locale,l,u).format(m)}${t.space??" "}${n.scale.symbol}`}const q=/^[+-]?[\d\s., ]*\d/;function M(g,o){const t=String(g).trim();if(t==="")return null;const r=new Intl.NumberFormat(o||void 0).formatToParts(1.1).find(m=>m.type==="decimal")?.value||".",s=r===","?".":",",i=t.split(s).join("").split(/[\s ]/).join("").replace(r,"."),n=Number(i);return Number.isFinite(n)?n:null}function O(g,o){if(E(g))return null;const t=o||{},r=I(t.scale||"C");if(!r)return null;if(typeof g=="number")return Number.isFinite(g)?g:null;let s=String(g).trim();if(s==="")return null;let i=!1;s.startsWith("(")&&s.endsWith(")")&&(i=!0,s=s.slice(1,-1).trim());const n=q.exec(s);if(!n)return null;const m=M(n[0],t.locale);if(m===null)return null;const c=s.slice(n[0].length).trim();if(c==="")return i?-m:m;const l=I(c);if(!l)return null;const u=l.key===r.key?m:r.scale.fromKelvin(l.scale.toKelvin(m));return i?-u:u}function k(g){const o=Object.freeze({scale:"C",...g||{}}),r=(I(o.scale)||I("C")).scale.symbol,s=Object.freeze({...o,display:o.scale,decimals:void 0,minDecimals:0,maxDecimals:20}),i=new Map([[o.locale||"",o]]),n=m=>{const c=m||"";let l=i.get(c);return l||(l=Object.freeze({...o,locale:m||void 0}),i.set(c,l)),l};return{base:"number",extends:"number",storage:"float64",temperatureConfig:o,format:m=>L(m.value,m.locale?n(m.locale):o),parse:m=>O(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)}`:".#"}" ${r}"`,toStorage:m=>typeof m=="number"?Number.isFinite(m)?m:null:typeof m=="string"?O(m,o):E(m)?null:O(String(m),o),toClipboard:m=>L(m,s),fromClipboard:m=>O(m,o)}}const b=Object.freeze({celsius:k({scale:"C"}),fahrenheit:k({scale:"F"}),kelvin:k({scale:"K"})}),a=k}),He("packages/core/src/columns/types/radix.js",function(e,F){"use strict";Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"digitsForWidth",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"radixRange",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"radixName",{enumerable:!0,get:function(){return l}}),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 G}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return H}}),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,x=Object.freeze({2:2,8:8,16:16,bin:2,binary:2,base2:2,oct:8,octal:8,base8:8,hex:16,hexadecimal:16,base16:16}),Q=Object.freeze({2:1,8:3,16:4}),U=Object.freeze({2:"0b",8:"0o",16:"0x"}),L=Object.freeze({2:4,8:3,16:2}),q=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),M=Object.freeze({2:"binary",8:"octal",16:"hexadecimal"}),O=Object.freeze([[/^0x/i,16],[/^0b/i,2],[/^0o/i,8],[/^#/,16]]),k=/[\s\u00a0\u202f_,']/g,b=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,a=Object.freeze([8,16,32,53]),g=new WeakSet,o=new WeakMap,t=new Map,r=new WeakMap,s=new WeakMap,i=Object.freeze({hex:Object.freeze({radix:16}),hex8:Object.freeze({radix:16,bitWidth:8,pad:!0,signed:!1}),hex16:Object.freeze({radix:16,bitWidth:16,pad:!0,signed:!1}),hex32:Object.freeze({radix:16,bitWidth:32,pad:!0,signed:!1}),binary:Object.freeze({radix:2}),binary8:Object.freeze({radix:2,bitWidth:8,pad:!0,signed:!1,group:4}),octal:Object.freeze({radix:8})});function n(A){if(A==null)return 16;const S=typeof A=="string"?A.toLowerCase():A,R=x[S];return R||(I(`radix:base:${String(A)}`,`unsupported radix ${String(A)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function m(A,S){return Math.ceil(A/Q[S])}function c(A,S){if(!A)return S?{min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}:{min:0,max:Number.MAX_SAFE_INTEGER};if(!S)return{min:0,max:2**A-1};const R=2**(A-1);return{min:-R,max:R-1}}function l(A){return M[A]||"hexadecimal"}function u(A){if(typeof A=="string"){const S=i[A];return S||I(`radix:preset:${A}`,`unknown radix preset "${A}"; known presets are ${Object.keys(i).join(", ")}`),{...S||{}}}if(A&&typeof A.preset=="string"){const S=i[A.preset];return S||I(`radix:preset:${A.preset}`,`unknown radix preset "${A.preset}"; known presets are ${Object.keys(i).join(", ")}`),{...S||{},...A}}return A||{}}function f(A){const S=u(A),R=n(S.radix),j=Q[R];let N=null;if(S.bitWidth!==void 0&&S.bitWidth!==null&&S.bitWidth!==!1){const X=Number(S.bitWidth);a.includes(X)?N=X:I(`radix:width:${String(S.bitWidth)}`,`unsupported bitWidth ${String(S.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let $=S.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 _=S.prefix===void 0||S.prefix===!0?U[R]:S.prefix===!1?"":String(S.prefix);let Y=0;S.pad===!0?Y=N?m(N,R):0:typeof S.pad=="number"&&S.pad>0&&(Y=Math.floor(S.pad));let Z=0;S.group===!0?Z=L[R]:typeof S.group=="number"&&S.group>0&&(Z=Math.floor(S.group));const J=c(N,$),D=typeof S.min=="number"?Math.max(J.min,S.min):J.min,te=typeof S.max=="number"?Math.min(J.max,S.max):J.max,z=Object.freeze({radix:R,bits:j,prefix:_,uppercase:S.uppercase!==!1,pad:Y,group:Z,groupSeparator:typeof S.groupSeparator=="string"?S.groupSeparator:" ",bitWidth:N,signed:$,min:D,max:te<D?D:te,nullDisplay:typeof S.nullDisplay=="string"?S.nullDisplay:"",name:l(R)});return g.add(z),z}function p(A){if(A&&g.has(A))return A;if(typeof A=="string"){let S=t.get(A);return S||(S=f(A),t.set(A,S)),S}if(A&&typeof A=="object"){let S=o.get(A);return S||(S=f(A),o.set(A,S)),S}return p("hex")}function y(A){return A<0?-Math.round(-A):Math.round(A)}function h(A,S,R){if(S<=0||A.length<=S)return A;const j=A.length%S||S,N=[A.slice(0,j)];for(let $=j;$<A.length;$+=S)N.push(A.slice($,$+S));return N.join(R)}function d(A){const S=p(A),{radix:R,prefix:j,uppercase:N,pad:$,group:_,groupSeparator:Y,signed:Z,bitWidth:J,nullDisplay:D}=S,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 re=y(ne);let ae="",fe=re;re<0&&(Z?(ae="-",fe=-re):fe=(re%te+te)%te);let we=fe.toString(R);return we=N?we.toUpperCase():we.toLowerCase(),$>0&&we.length<$&&(we=we.padStart($,"0")),_>0&&(we=h(we,_,Y)),ae+j+we};return z.options=S,z}function w(A,S){const R=p(S);let j=r.get(R);return j||(j=d(R),r.set(R,j)),j(A)}function v(A){const S=p(A),{radix:R,groupSeparator:j,signed:N,min:$,max:_}=S,Y=q[R],Z=J=>{if(E(J))return{ok:!0,value:null,reason:"blank"};let D=String(J);if(j&&j!==""&&(D=D.split(j).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,re]of O){const ae=ne.exec(D);if(!ae)continue;const fe=D.slice(ae[0].length);if(fe==="")break;if(!q[re].test(fe))return{ok:!1,value:null,reason:"digits"};z=parseInt(fe,re);break}if(z===null)if(Y.test(D))z=parseInt(D,R);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>_?{ok:!1,value:X,reason:"range"}:{ok:!0,value:X,reason:"ok"}};return Z.options=S,Z}function P(A,S){const R=p(S);let j=s.get(R);return j||(j=v(R),s.set(R,j)),j(A)}function G(A,S){const R=P(A,S);return R.ok?R.value:null}function V(A,S){const R=E(A)||Number.isNaN(A)?null:Number(A),j=E(S)||Number.isNaN(S)?null:Number(S);return R===null?j===null?0:1:j===null||R<j?-1:R>j?1:0}function K(A){const S=A.min>=-2147483648&&A.max<=2147483647;return A.bitWidth&&S?"int32":"float64"}function H(A){const S=f(A),R=d(S),j=v(S);return{base:"number",extends:"number",storage:K(S),matches:null,format:N=>R(N.value),parse:N=>{const $=j(N.text);return $.ok?$.value:null},compare:V,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:N=>R(N),fromClipboard:N=>{const $=j(N);return $.ok?$.value:null},radix:S,formatValue:R,parseText:j}}const T=H}),He("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 L}}),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 x}});const E=F("packages/core/src/internal/predicates.js").isNil;function W(M){const O=[];for(const k of M||[]){if(E(k))continue;const b=Number(k);Number.isFinite(b)&&O.push(b)}return O}function I(M){return O=>{const k=W(O);if(!k.length)return null;let b=0;for(const a of k)b+=10**(a/M);return M*Math.log10(b)}}function x(M){return O=>{const k=W(O);if(!k.length)return null;let b=0;for(const a of k)b+=10**(a/M);return M*Math.log10(b/k.length)}}function Q(M,O){const k=O&&O.column,a=(k&&k.typeOptions||{}).weight,g=O&&O.valueAt;if(!a||typeof g!="function")return null;let o=0,t=0;for(let r=0;r<M.length;r++){if(E(M[r]))continue;const s=Number(M[r]);if(!Number.isFinite(s))continue;const i=g(a,r);if(E(i))continue;const n=Number(i);!Number.isFinite(n)||n<=0||(o+=s*n,t+=n)}return t===0?null:o/t}function U(M={}){const O=M.factor===20?20:10,k=typeof M.suffix=="string"?M.suffix:"",b=Number.isInteger(M.decimals)?M.decimals:1;return{base:"number",storage:"float64",name:M.name||"logarithmic",format:a=>{const g=a&&a.value;return E(g)||!Number.isFinite(Number(g))?"":`${Number(g).toFixed(b)}${k}`},parse:a=>{const g=String((a&&a.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(O),avg:x(O)}}}}function L(M={}){const O=Number.isInteger(M.decimals)?M.decimals:1,k=M.percent===!0;return{base:"number",storage:"float64",name:M.name||"ratio",format:b=>{const a=b&&b.value;return E(a)||!Number.isFinite(Number(a))?"":k?`${Number(a).toFixed(O)}%`:Number(a).toFixed(O)},parse:b=>{const a=String((b&&b.text)??"").replace("%","").trim();if(!a)return null;const g=Number(a);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:L({name:"ratio"}),percentRate:L({name:"percentRate",percent:!0})})}),He("packages/core/src/columns/types/currency.js",function(e,F){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return O}}),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 i}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});const E=F("packages/core/src/internal/predicates.js").isNil,W="⚠ no rate";function I(m){if(E(m))return null;const c=String(m).trim().toUpperCase();return c===""?null:c}function x(m){if(E(m))return null;if(typeof m=="object"&&!Array.isArray(m)){const c=Number(m.amount),l=I(m.code);return!l||!Number.isFinite(c)?null:{amount:c,code:l}}if(Array.isArray(m)&&m.length===2){const c=Number(m[0]),l=I(m[1]);return!l||!Number.isFinite(c)?null:{amount:c,code:l}}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:"₪"}),L=/[+-]?[\d\s., ]*\d/;function q(m,c){const l=String(m).trim();if(l==="")return null;const u=new Intl.NumberFormat(c||void 0).formatToParts(1.1).find(h=>h.type==="decimal")?.value||".",f=u===","?".":",",p=l.split(f).join("").split(/[\s ]/).join("").replace(u,"."),y=Number(p);return Number.isFinite(y)?y:null}function M(m,c){const l=c||{},u=I(l.code);if(E(m))return null;const f=x(m);if(f)return f;if(typeof m=="number")return Number.isFinite(m)&&u?{amount:m,code:u}: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,K]of Object.entries(Q)){if(p.startsWith(V)){h=K,p=p.slice(V.length).trim();break}if(p.endsWith(V)){h=K,p=p.slice(0,-V.length).trim();break}}const d=L.exec(p);if(!d)return null;const w=q(d[0],l.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||u;return P?{amount:y?-w:w,code:P}:null}function O(m,c){if(typeof m=="function")return(l,u)=>{if(l===u)return 1;const f=m(l,u);return typeof f=="number"&&Number.isFinite(f)&&f>0?f:null};if(m&&typeof m=="object"){const l=m;return(u,f)=>{if(u===f)return 1;const p=Number(l[u]),y=Number(l[f]);return!Number.isFinite(p)||!Number.isFinite(y)||p<=0||y<=0?null:y/p}}return(l,u)=>l===u?1:null}function k(m,c,l){if(!m)return null;if(m.code===c)return m.amount;const u=l(m.code,c);return u===null?null:m.amount*u}const b=new Map;function a(m,c,l){const u=`${m||""}|${c}|${l??""}`;let f=b.get(u);if(!f){const p={style:"currency",currency:c};typeof l=="number"&&(p.minimumFractionDigits=l,p.maximumFractionDigits=l);try{f={fmt:new Intl.NumberFormat(m||void 0,p),currency:!0}}catch{f={fmt:new Intl.NumberFormat(m||void 0,typeof l=="number"?{minimumFractionDigits:l,maximumFractionDigits:l}:{}),currency:!1}}b.set(u,f)}return f}function g(m,c){const l=c||{},u=l.nullDisplay??"",f=x(m);if(!f)return u;const p=I(l.display)||f.code;let y=f.amount,h=f.code;if(p!==f.code){const v=l.rateFn||O(l.rates,l.rateBase),P=k(f,p,v);if(P===null)return`${l.missingRate??W} ${f.code}→${p}`;y=P,h=p}const{fmt:d,currency:w}=a(l.locale,h,l.decimals);return w?d.format(y):`${d.format(y)} ${h}`}function o(m){const c=x(m);return c?`${c.amount} ${c.code}`:""}function t(m){const c=m||{},l=I(c.display),u=c.rateFn||O(c.rates,c.rateBase);return(f,p)=>{const y=x(f),h=x(p);if(!y&&!h)return 0;if(!y)return 1;if(!h)return-1;if(l){const d=k(y,l,u),w=k(h,l,u);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 r(m){const c=m||{},l=(f,p)=>{const y=[];for(const P of f||[]){const G=x(P);G&&y.push(G)}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(G=>G.amount)),code:P}}const d=I(c.display);if(!d)return`${c.missingRate??W}: mixed currencies, no display currency set`;const w=c.rateFn||O(c.rates,c.rateBase),v=[];for(const P of y){const G=k(P,d,w);if(G===null)return`${c.missingRate??W}: ${P.code}→${d}`;v.push(G)}return{amount:p(v),code:d}},u=f=>f.reduce((p,y)=>p+y,0);return{sum:f=>l(f,u),avg:f=>l(f,p=>u(p)/p.length),min:f=>l(f,p=>Math.min(...p)),max:f=>l(f,p=>Math.max(...p))}}function s(m){const c=Object.freeze({code:"USD",...m||{}}),l=O(c.rates,c.rateBase),u=Object.freeze({...c,rateFn:l}),f=r(u),p=t(u),y=new Map([[c.locale||"",u]]),h=v=>{const P=v||"";let G=y.get(P);return G||(G=Object.freeze({...u,locale:v||void 0}),y.set(P,G)),G},d=U[I(c.display||c.code)]||"",w=typeof c.decimals=="number"&&c.decimals>0?`.${"0".repeat(c.decimals)}`:".00";return{base:"object",extends:"object",storage:"object",name:"currency",currencyConfig:u,format:v=>g(v.value,v.locale?h(v.locale):u),parse:v=>M(v.text,v.locale?h(v.locale):u),compare:p,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:f},excel:c.excel||(d?`"${d}"#,##0${w}`:`#,##0${w}`),toStorage:v=>{const P=x(v);return P||(typeof v=="string"||typeof v=="number"?M(v,u):null)},toClipboard:v=>o(v),fromClipboard:v=>M(v,u)}}const i=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}),He("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 M}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return O}}),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 a}}),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 c}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return H}});const ie=F("packages/core/src/columns/types/temporal.js"),E=ie.TEMPORAL_TYPES,W=F("packages/core/src/columns/types/network.js"),I=W.NETWORK_TYPES,x=F("packages/core/src/columns/types/vlan.js"),Q=x.VLAN_TYPES,U=F("packages/core/src/columns/types/structured.js"),L=U.STRUCTURED_TYPES,q=F("packages/core/src/columns/types/unit.js"),M=q.createUnitType,O=q.UNIT_SYSTEMS,k=q.parseUnit,b=q.formatUnit,a=q.registerUnitSystem,g=q.unitSystemNames,o=q.unitsOf,t=q.defineUnit,r=F("packages/core/src/columns/types/engineering.js"),s=r.ENGINEERING_TYPES,i=F("packages/core/src/columns/types/si.js"),n=i.SI_TYPES,m=i.createSiType,c=i.createSiSystem,l=i.siUnits,u=i.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"),G=P.createRadixType,V=P.RADIX_PRESETS,K=P.parseRadix,H=P.formatRadix,T=F("packages/core/src/columns/types/aggregable.js"),A=T.AGGREGABLE_TYPES,S=F("packages/core/src/columns/types/currency.js"),R=S.CURRENCY_TYPES,j=S.createCurrencyType,N=S.parseMoney,$=S.formatMoney,_=S.convertMoney,Y=S.toMoney,Z=S.rateFunction,J=S.moneyComparator,D=S.normaliseCode,te=S.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return q.findUnit}}),Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return r.ENGINEERING_TYPES}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return r.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 S.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return S.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return S.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return S.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return S.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return S.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return S.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return S.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return S.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return S.MISSING_RATE}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return ie.TEMPORAL_TYPES}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return W.NETWORK_TYPES}}),Object.defineProperty(e,"VLAN_TYPES",{enumerable:!0,get:function(){return x.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 W.parseIpv4}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return W.formatIpv4}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return W.parseCidr}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return W.formatCidr}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return W.parseIpv6}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return W.formatIpv6}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return W.networkAddress}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return W.broadcastAddress}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return W.hostCount}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return W.containsAddress}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return W.overlaps}}),Object.defineProperty(e,"parseMac",{enumerable:!0,get:function(){return W.parseMac}}),Object.defineProperty(e,"formatMac",{enumerable:!0,get:function(){return W.formatMac}}),Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return W.isMac}}),Object.defineProperty(e,"compareMac",{enumerable:!0,get:function(){return W.compareMac}}),Object.defineProperty(e,"macValue",{enumerable:!0,get:function(){return W.macValue}}),Object.defineProperty(e,"macHex",{enumerable:!0,get:function(){return W.macHex}}),Object.defineProperty(e,"macContains",{enumerable:!0,get:function(){return W.macContains}}),Object.defineProperty(e,"MAC_OPERATORS",{enumerable:!0,get:function(){return W.MAC_OPERATORS}}),Object.defineProperty(e,"parseVlans",{enumerable:!0,get:function(){return x.parseVlans}}),Object.defineProperty(e,"formatVlans",{enumerable:!0,get:function(){return x.formatVlans}}),Object.defineProperty(e,"vlanContains",{enumerable:!0,get:function(){return x.vlanContains}}),Object.defineProperty(e,"vlanOverlaps",{enumerable:!0,get:function(){return x.vlanOverlaps}}),Object.defineProperty(e,"vlanCount",{enumerable:!0,get:function(){return x.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,...L,...A,hex:G(V.hex),hex8:G(V.hex8),hex16:G(V.hex16),hex32:G(V.hex32),binary:G(V.binary),binary8:G(V.binary8),octal:G(V.octal),bytes:M({system:"data",unit:"B",display:"auto"}),megabytes:M({system:"data",unit:"MB"}),gigabytes:M({system:"data",unit:"GB"}),bitrate:M({system:"bitrate",unit:"Mbps"}),gigabits:M({system:"bitrate",unit:"Gbps"}),...s,...n,...p,...R});{const X=new Set;for(const ne of[E,I,Q,L,A,s,n,p,R])for(const re of Object.keys(ne)){if(X.has(re))throw new Error(`[lattice] data type "${re}" is declared twice`);X.add(re)}}}),He("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 M}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return O}}),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 a}}),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 r}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return s}});const ie=F("packages/core/src/internal/compare.js"),E=ie.collator,W=ie.defaultCompare,x=F("packages/core/src/internal/warn.js").warnOnce;function Q(i){const n=new Uint32Array(i);for(let m=0;m<i;m++)n[m]=m;return n}function U(i,n){if(n&&typeof n.count=="number")return n.count;if(!i)return 0;if(typeof i.count=="number")return i.count;if(typeof i.length=="number")return i.length;const m=i.values;return i.kind==="multi"&&i.offsets?Math.max(0,i.offsets.length-1):m?i.kind==="bitset"?typeof m.size=="number"?m.size:i.presence&&typeof i.presence.size=="number"?i.presence.size:(x(`count:${i.id}`,`column "${i.id}" is bitset-backed with no declared row count; assuming ${m.length*8}`),m.length*8):m.length:i.presence&&typeof i.presence.size=="number"?i.presence.size:0}const L=new WeakMap;function q(i){const n=i.constructor;if(!n)return"unknown";const m=L.get(n);if(m)return m;let c="unknown";try{let l=null;typeof n.from=="function"?l=n.from([!1,!0]):(l=new n(8),l.set(1));const u=l&&l.words;u&&u.length&&(u[0]===2?c="lsb":u[0]===64&&(c="msb"))}catch{c="unknown"}return L.set(n,c),c}function M(i){if(!i)return()=>0;const n=i instanceof Uint8Array?i:i.words;if(n instanceof Uint8Array){const m=i instanceof Uint8Array?"lsb":q(i);if(m==="lsb")return c=>n[c>>>3]>>>(c&7)&1;if(m==="msb")return c=>n[c>>>3]>>>7-(c&7)&1}return typeof i.get=="function"?m=>i.get(m)?1:0:()=>0}function O(i){return!i||!i.presence?null:M(i.presence)}function k(i){return i?typeof i.size=="number"?i.size:typeof i.values=="function"?i.values().length:0:0}function b(i,n){return i?typeof i.valueOf=="function"?i.valueOf(n):typeof i.values=="function"?i.values()[n]:null:null}function a(i,n){const m=i.offsets,c=i.values;if(!m||!c)return[];const l=m[n],u=m[n+1];if(!(u>l))return[];const f=i.dict,p=new Array(u-l);for(let y=l;y<u;y++)p[y-l]=f?b(f,c[y]):c[y];return p}function g(i){if(!i)return()=>{};const n=i.values,m=O(i),c=i.kind;if(c==="dictionary"){const l=i.dict;return m?u=>m(u)?b(l,n[u]):null:u=>b(l,n[u])}if(c==="bitset"){const l=M(n);return m?u=>m(u)?l(u)===1:null:u=>l(u)===1}if(c==="multi")return m?l=>m(l)?a(i,l):null:l=>a(i,l);if(!n&&typeof i.get=="function"){const l=i.get.bind(i);return u=>{const f=l(u);return f===void 0?null:f}}return m?l=>{if(!m(l))return null;const u=n[l];return u===void 0?null:u}:l=>{const u=n[l];return u===void 0?null:u}}function o(i,n){if(i<n)return-1;if(i>n)return 1;if(i===n){const l=Object.is(i,-0),u=Object.is(n,-0);return l===u?0:l?-1:1}const m=Number.isNaN(i),c=Number.isNaN(n);return m&&c?0:m?1:-1}function t(i){const n=E(i);return(m,c)=>{if(m===c)return 0;const l=typeof m,u=typeof c;if(l==="string"&&u==="string")return n.compare(m,c);if(l==="number"&&u==="number")return o(m,c);if(l==="boolean"&&u==="boolean")return m===c?0:m?1:-1;if(m instanceof Date||c instanceof Date){const f=m instanceof Date?m.getTime():Number(m),p=c instanceof Date?c.getTime():Number(c);return o(f,p)}return W(m,c)}}function r(i,n){if(i&&typeof i.ranks=="function")return i.ranks(n);const m=i&&typeof i.values=="function"?i.values():[],c=m.length,l=t(n),u=new Array(c);for(let p=0;p<c;p++)u[p]=p;u.sort((p,y)=>l(m[p],m[y])||p-y);const f=new Uint32Array(c);for(let p=0;p<c;p++)f[u[p]]=p;return f}function s(i){return i==null||typeof i=="number"&&Number.isNaN(i)}}),He("packages/core/src/compute/filter.js",function(e,F){"use strict";Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"wallMs",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return j}}),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 re}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(e,"declaredOperatorFor",{enumerable:!0,get:function(){return be}});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"),L=U.toDate,q=U.toIsoDate,M=F("packages/core/src/compute/handle.js"),O=M.bitReader,k=M.dictSize,b=M.dictValue,a=M.presenceReader,g=M.valueComparator,o=M.valueReader,t=/^\d{4}-\d{2}-\d{2}$/,r="\0null\0";function s(se,de){const oe=se&&se.pool;if(oe){const ce=oe.mask||oe.acquireMask||oe.acquire||oe.take;if(typeof ce=="function"){const he=ce.call(oe,de);if(he&&he.length>=de)return he}}return new Uint8Array(de)}function i(se,de){const oe=se&&se.pool;if(!oe||!de)return;const ce=oe.release||oe.releaseMask||oe.free||oe.recycle;typeof ce=="function"&&ce.call(oe,de)}function n(se,de,oe){return se.fill(oe,0,de),se}function m(se){return se==null||typeof se=="number"&&Number.isNaN(se)}function c(se,de){if(se==null)return se;if(de==="number")return typeof se=="number"?se:Number(se);if(de==="date"||de==="dateString"){const oe=q(se);return oe===null?l(se):oe}return de==="boolean"?typeof se=="boolean"?se:se==="true"||se===1?!0:se==="false"||se===0?!1:!!se:se}function l(se){return se instanceof Date?se.getTime():typeof se=="number"?se:Date.parse(String(se))}function u(se){return typeof se=="number"?se:se instanceof Date?se.getTime():se==null||se===""?NaN:Number(se)}function f(se,de){const oe=typeof se=="string"?se:String(se);return de?oe:oe.toLowerCase()}function p(se,de){return se==null?r:typeof se=="string"?de?se:se.toLowerCase():se instanceof Date?se.getTime():se}function y(se,de,oe){const ce=new Set;for(const he of I(se)){const Oe=c(he,oe);ce.add(p(Oe,de)),typeof Oe=="string"&&Oe!==""&&Number.isFinite(Number(Oe))?ce.add(Number(Oe)):typeof Oe=="number"&&Number.isFinite(Oe)&&ce.add(p(String(Oe),de))}return ce}function h(se,de,oe){if(se==null||de===null||de===void 0)return se==null&&de==null;const ce=typeof se,he=typeof de;return ce==="string"&&he==="string"?oe?se===de:se.toLowerCase()===de.toLowerCase():se instanceof Date||de instanceof Date?l(se)===l(de):ce==="number"&&he==="number"?se===de||Number.isNaN(se)&&Number.isNaN(de):ce==="number"&&he==="string"?se===Number(de):ce==="string"&&he==="number"?Number(se)===de:ce==="boolean"||he==="boolean"?se===de:Array.isArray(se)&&Array.isArray(de)?se.length===de.length&&se.every((Oe,Se)=>h(Oe,de[Se],oe)):se===de}function d(se,de){try{if(se instanceof RegExp){const oe=se.flags.replace(/[gy]/g,"");return new RegExp(se.source,de||oe.includes("i")?oe:`${oe}i`)}return new RegExp(String(se),de?"":"i")}catch(oe){return Q(`regex:${String(se)}`,`filter operator "matches" received an invalid pattern: ${String(se)}`,oe),null}}function w(se,de){if(se&&se.type==="datetime"&&v.has(se.op))return H(se,de);const oe=T(se,de),ce=se&&se.type;return ce!=="date"&&ce!=="dateString"?oe:he=>oe(typeof he=="string"&&t.test(he)?he:q(he)??he)}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*)?)?)?$/,G=new Map;function V(se,de){let oe=G.get(de);if(oe===void 0){try{oe=new Intl.DateTimeFormat("en-CA",{timeZone:de,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{oe=null}G.set(de,oe)}if(!oe)return null;const ce={};for(const he of oe.formatToParts(se))he.type!=="literal"&&(ce[he.type]=he.value);return ce}function K(se,de){if(se==null||se==="")return null;if(typeof se=="string"){const Oe=P.exec(se.trim());if(Oe)return Date.UTC(+Oe[1],+Oe[2]-1,+Oe[3],+(Oe[4]||0),+(Oe[5]||0),+(Oe[6]||0),+(Oe[7]||"0").padEnd(3,"0"))}const oe=L(se);if(!oe)return null;const ce=oe.getUTCMilliseconds(),he=de?V(oe,de):null;return he?Date.UTC(+he.year,+he.month-1,+he.day,he.hour==="24"?0:+he.hour,+he.minute,+he.second,ce):Date.UTC(oe.getFullYear(),oe.getMonth(),oe.getDate(),oe.getHours(),oe.getMinutes(),oe.getSeconds(),ce)}function H(se,de){const oe=typeof se.timeZone=="string"&&se.timeZone?se.timeZone:void 0,ce=Se=>K(Se,oe),he=Array.isArray(se.value)?se.value.map(ce):ce(se.value),Oe=T({...se,type:"number",value:he},de);return Se=>Oe(K(Se))}function T(se,de){const oe=se&&se.op,ce=!!(se&&se.caseSensitive),he=se&&se.type,Oe=g(de),Se=Ce=>Ie=>!Ce(Ie);switch(oe){case"eq":{const Ce=be(he,"eq");if(Ce)return Ce.compile(se.value);const Ie=c(se.value,he);return ke=>h(ke,Ie,ce)}case"ne":{const Ce=be(he,"ne");if(Ce)return Ce.compile(se.value);const Ie=c(se.value,he);return ke=>!h(ke,Ie,ce)}case"lt":case"lte":case"gt":case"gte":{const Ce=c(se.value,he);if(m(Ce))return()=>!1;const Ie=oe==="lt"?-1:oe==="lte"?0:oe==="gt"?1:2;return ke=>{if(m(ke))return!1;const _e=Oe(ke,Ce);return Ie===-1?_e<0:Ie===0?_e<=0:Ie===1?_e>0:_e>=0}}case"between":case"notBetween":{const Ce=I(se.value),Ie=c(Ce[0],he),ke=c(Ce[1],he),_e=se.bounds||"[]",Te=_e.charAt(0)!=="(",je=_e.charAt(1)!==")";if(m(Ie)||m(ke))return oe==="between"?()=>!1:()=>!0;const Ae=Ee=>{if(m(Ee))return!1;const Me=Oe(Ee,Ie),Be=Oe(Ee,ke);return(Te?Me>=0:Me>0)&&(je?Be<=0:Be<0)};return oe==="between"?Ae:Se(Ae)}case"in":case"notIn":{const Ce=y(se.value,ce,he),Ie=ke=>Ce.has(p(ke,ce));return oe==="in"?Ie:Se(Ie)}case"contains":case"notContains":{const Ce=be(he,oe);if(Ce)return Ce.compile(se.value);const Ie=f(c(se.value,he),ce),ke=_e=>_e==null?!1:f(_e,ce).includes(Ie);return oe==="contains"?ke:Se(ke)}case"startsWith":{const Ce=be(he,"startsWith");if(Ce)return Ce.compile(se.value);const Ie=f(c(se.value,he),ce);return ke=>ke==null?!1:f(ke,ce).startsWith(Ie)}case"endsWith":{const Ce=be(he,"endsWith");if(Ce)return Ce.compile(se.value);const Ie=f(c(se.value,he),ce);return ke=>ke==null?!1:f(ke,ce).endsWith(Ie)}case"matches":{const Ce=d(se.value,ce);return Ce?Ie=>Ie==null?!1:Ce.test(String(Ie)):()=>!1}case"blank":case"notBlank":{const Ce=se.trim===!0,Ie=ke=>E(ke)||Array.isArray(ke)&&ke.length===0||Ce&&typeof ke=="string"&&ke.trim()==="";return oe==="blank"?Ie:ke=>!Ie(ke)}case"containsAny":case"containsNone":{const Ce=y(se.value,ce,he),Ie=ke=>{const _e=ke==null?[]:I(ke);for(let Te=0;Te<_e.length;Te++)if(Ce.has(p(_e[Te],ce)))return!0;return!1};return oe==="containsAny"?Ie:Se(Ie)}case"containsAll":{const Ce=I(se.value).map(Ie=>p(c(Ie,he),ce));return Ie=>{const ke=Ie==null?[]:I(Ie);if(Ce.length===0)return!0;const _e=new Set(ke.map(Te=>p(Te,ce)));for(let Te=0;Te<Ce.length;Te++)if(!_e.has(Ce[Te]))return!1;return!0}}default:{const Ce=$e(oe);return Ce?Ce.compile(se.value):(Q(`op:${String(oe)}`,`unknown filter operator "${String(oe)}"; the condition is refused rather than matching every row`),()=>!1)}}}function A(se,de,oe){return w(de,oe)(se)}const S=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),R=new Set(["containsAny","containsAll","containsNone"]);function j(se,de,oe){const ce=se&&se.op,he=S[ce]||ce,Oe=w({...se,op:he,type:de.type},oe),Se=de.items,Ce=Ie=>{const ke=Se(Ie);if(!ke)return!1;for(let _e=0;_e<ke.length;_e++)if(Oe(ke[_e]))return!0;return!1};return S[ce]?Ie=>!Ce(Ie):Ce}function N(se,de,oe,ce,he){const Oe=he?null:a(se);if(Oe){const Ie=de?1:0;for(let ke=0;ke<ce;ke++)oe[ke]=Oe(ke)===Ie?1:0;return oe}const Se=se.kind;if(Se==="float64"||Se==="int32"||Se==="bitset")return n(oe,ce,de?1:0);const Ce=o(se);for(let Ie=0;Ie<ce;Ie++){const ke=Ce(Ie),_e=E(ke)||Array.isArray(ke)&&ke.length===0||he&&typeof ke=="string"&&ke.trim()==="";oe[Ie]=_e===de?0:1}return oe}function $(se,de,oe,ce){const he=se.dict,Oe=k(he),Se=new Uint8Array(Oe);for(let _e=0;_e<Oe;_e++)Se[_e]=de(b(he,_e))?1:0;const Ce=se.values,Ie=a(se);if(!Ie){for(let _e=0;_e<ce;_e++)oe[_e]=Se[Ce[_e]];return oe}const ke=de(null)?1:0;for(let _e=0;_e<ce;_e++)oe[_e]=Ie(_e)===1?Se[Ce[_e]]:ke;return oe}function _(se,de,oe,ce){const he=O(se.values),Oe=de(!0)?1:0,Se=de(!1)?1:0,Ce=a(se);if(!Ce){for(let ke=0;ke<ce;ke++)oe[ke]=he(ke)===1?Oe:Se;return oe}const Ie=de(null)?1:0;for(let ke=0;ke<ce;ke++)oe[ke]=Ce(ke)===0?Ie:he(ke)===1?Oe:Se;return oe}function Y(se,de,oe,ce,he){const Oe=se.values,Se=de.type,Ce=de.op;let Ie=!0;switch(Ce){case"eq":case"ne":{const _e=u(c(de.value,Se)),Te=typeof de.value=="number"&&Number.isNaN(de.value),je=Ce==="ne"?1:0;if(Te)for(let Ae=0;Ae<he;Ae++)ce[Ae]=(Number.isNaN(Oe[Ae])?1:0)^je;else for(let Ae=0;Ae<he;Ae++)ce[Ae]=(Oe[Ae]===_e?1:0)^je;break}case"lt":{const _e=u(c(de.value,Se));for(let Te=0;Te<he;Te++)ce[Te]=Oe[Te]<_e?1:0;break}case"lte":{const _e=u(c(de.value,Se));for(let Te=0;Te<he;Te++)ce[Te]=Oe[Te]<=_e?1:0;break}case"gt":{const _e=u(c(de.value,Se));for(let Te=0;Te<he;Te++)ce[Te]=Oe[Te]>_e?1:0;break}case"gte":{const _e=u(c(de.value,Se));for(let Te=0;Te<he;Te++)ce[Te]=Oe[Te]>=_e?1:0;break}case"between":case"notBetween":{const _e=I(de.value),Te=u(c(_e[0],Se)),je=u(c(_e[1],Se)),Ae=de.bounds||"[]",Ee=Ae.charAt(0)!=="(",Me=Ae.charAt(1)!==")",Be=Ce==="notBetween"?1:0;if(Ee&&Me)for(let Ke=0;Ke<he;Ke++)ce[Ke]=(Oe[Ke]>=Te&Oe[Ke]<=je?1:0)^Be;else if(Ee)for(let Ke=0;Ke<he;Ke++)ce[Ke]=(Oe[Ke]>=Te&Oe[Ke]<je?1:0)^Be;else if(Me)for(let Ke=0;Ke<he;Ke++)ce[Ke]=(Oe[Ke]>Te&Oe[Ke]<=je?1:0)^Be;else for(let Ke=0;Ke<he;Ke++)ce[Ke]=(Oe[Ke]>Te&Oe[Ke]<je?1:0)^Be;break}case"in":case"notIn":{const _e=new Set;for(const je of I(de.value)){const Ae=u(c(je,Se));Number.isNaN(Ae)||_e.add(Ae)}const Te=Ce==="notIn"?1:0;for(let je=0;je<he;je++)ce[je]=(_e.has(Oe[je])?1:0)^Te;break}default:Ie=!1;break}if(!Ie)return!1;const ke=a(se);if(ke){const _e=oe(null)?1:0;for(let Te=0;Te<he;Te++)ke(Te)===0&&(ce[Te]=_e)}return!0}function Z(se,de,oe,ce){const he=o(se);for(let Oe=0;Oe<ce;Oe++)oe[Oe]=de(he(Oe))?1:0;return oe}function J(se,de){if(!se||!we.has(se.op))return se;const oe=de&&de.typeOf;if(typeof oe!="function")return se;const ce=oe(se.col);return typeof ce!="string"||!ce||ce===se.type?se:{...se,type:ce}}function D(se,de,oe){const ce=de.count|0,he=oe||s(de,ce);if(!se)return n(he,ce,1);const Oe=typeof de.handle=="function"?de.handle(se.col):void 0,Se=typeof de.custom=="function"?de.custom:null;if(!Oe){if(Se){for(let _e=0;_e<ce;_e++)he[_e]=Se(se,_e)?1:0;return he}return Q(`filter:col:${String(se.col)}`,`filter references unknown column "${String(se.col)}"; the condition is refused rather than matching every row`),n(he,ce,0)}const Ce=se.op;if(Ce==="blank"||Ce==="notBlank")return N(Oe,Ce==="notBlank",he,ce,se.trim===!0);const Ie=typeof de.itemwise=="function"?de.itemwise(se.col):null;if(Ie&&!$e(Ce)&&!R.has(Ce))return Z(Oe,j(se,Ie,de.locale),he,ce);const ke=w(J(se,de),de.locale);switch(Oe.kind){case"dictionary":return $(Oe,ke,he,ce);case"bitset":return _(Oe,ke,he,ce);case"float64":case"int32":return Y(Oe,se,ke,he,ce)?he:Z(Oe,ke,he,ce);default:return Z(Oe,ke,he,ce)}}function te(se,de,oe){if(!se)return n(s(de,oe),oe,1);if(Array.isArray(se.conditions)){const ce=se.conditions.filter(Se=>Se!=null),he=se.op==="or"?"or":se.op==="not"?"not":"and";if(ce.length===0)return n(s(de,oe),oe,1);const Oe=te(ce[0],de,oe);for(let Se=1;Se<ce.length;Se++){const Ce=te(ce[Se],de,oe);if(he==="or")for(let Ie=0;Ie<oe;Ie++)Oe[Ie]|=Ce[Ie];else for(let Ie=0;Ie<oe;Ie++)Oe[Ie]&=Ce[Ie];i(de,Ce)}if(he==="not")for(let Se=0;Se<oe;Se++)Oe[Se]^=1;return Oe}return D(se,de,s(de,oe))}function z(se,de){return te(se,de,de.count|0)}function X(se,de){if(!se||!de)return se||null;const oe=se;if(Array.isArray(oe.conditions)){if((oe.op==="or"?"or":oe.op==="not"?"not":"and")!=="and")return ne(oe,de)?null:se;const he=[];for(const Oe of oe.conditions){const Se=X(Oe,de);Se&&he.push(Se)}return he.length?{...oe,op:"and",conditions:he}:null}return oe.col===de?null:se}function ne(se,de){if(!se||typeof se!="object")return!1;const oe=se;if(oe.col===de)return!0;if(Array.isArray(oe.conditions)){for(const ce of oe.conditions)if(ne(ce,de))return!0}return!1}function re(se,de,oe){if(oe&&oe.length>=de){let Se=0;for(let Ce=0;Ce<de;Ce++)se[Ce]&&(oe[Se++]=Ce);return oe.subarray(0,Se)}let ce=0;for(let Se=0;Se<de;Se++)ce+=se[Se]?1:0;const he=new Uint32Array(ce);let Oe=0;for(let Se=0;Se<de;Se++)se[Se]&&(he[Oe++]=Se);return he}const ae=new Map,fe=new Map,we=new Set,ve=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn","contains","notContains","startsWith","endsWith","matches","blank","notBlank","containsAny","containsAll","containsNone"]);function Re(se,de){if(!se||typeof se!="object")return;const oe=Object.entries(se).filter(([,ce])=>ce&&typeof ce.compile=="function");if(typeof de=="string"&&de){let ce=fe.get(de);ce||(ce=new Map,fe.set(de,ce));for(const[he,Oe]of oe)ce.set(he,Oe)}for(const[ce,he]of oe)ve.has(ce)?we.add(ce):ae.set(ce,he)}function $e(se){return typeof se=="string"?ae.get(se):void 0}function be(se,de){if(typeof se!="string"||typeof de!="string")return;const oe=fe.get(se);return oe?oe.get(de):void 0}}),He("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 H}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return N}});const ie=F("packages/core/src/internal/compare.js"),E=ie.collator,W=ie.defaultCompare,I=F("packages/core/src/internal/predicates.js"),x=I.isNil,Q=I.isObject,U=I.isFunction,L=F("packages/core/src/internal/warn.js"),q=L.fail,M=L.infoOnce,k=F("packages/core/src/internal/text.js").titleCase,b=F("packages/core/src/format/date.js"),a=b.toDate,g=b.toIsoDate,o=b.compareIso,r=F("packages/core/src/format/boolean.js").toTriState,i=F("packages/core/src/columns/types/index.js").EXTENDED_TYPES,n=F("packages/core/src/formula/index.js"),m=n.evaluateFormula,c=n.looksLikeFormula,u=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 _=$||"",Y=y.get(_);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(_,Z),Z}const d=/\d\s*[*/^]\s*[\d.(]/;function w($,_){if(x($))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(_);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($,_){const Y=x($)||Number.isNaN($)?null:Number($),Z=x(_)||Number.isNaN(_)?null:Number(_);return Y===null?Z===null?0:1:Z===null||Y<Z?-1:Y>Z?1:0}function P($,_){const Y=r($),Z=r(_);return Y===null?Z===null?0:1:Z===null?-1:Y===Z?0:Y?1:-1}function G($,_){const Y=a($),Z=a(_);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 K($){const _=a($.value);if(!_)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(_)}const H={boolean:{base:"boolean",storage:"bitset",matches:$=>typeof $=="boolean",parse:$=>r($.text),compare:P,format:$=>r($.value)===null?"":r($.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:$=>r($)===null?"":String(r($)),fromClipboard:$=>r($)},number:{base:"number",storage:"float64",matches:$=>typeof $=="number"&&!Number.isNaN($),parse:$=>{if(c($.text)){const _=m($.text,$);if(!_.ok)return null;const Y=Number(_.value);return Number.isFinite(Y)?Y:null}return w($.text,$.locale)},compare:v,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:$=>x($)?"":String($),fromClipboard:($,_)=>w($,_&&_.locale),toStorage:($,_)=>{if(typeof $!="string")return $;const Y=w($,_&&_.locale);return Y!==null?Y:(M(`type.number.unparsed.${_&&_.colId||""}`,`column "${_&&_.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:K,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:$=>g($),toClipboard:$=>x($)?"":String($),fromClipboard:$=>g($)},dateString:{base:"dateString",storage:"dictionary",matches:$=>typeof $=="string"&&f.test($)&&!Number.isNaN(Date.parse($)),parse:$=>g($.text),compare:o,format:K,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:$=>g($),toClipboard:$=>x($)?"":String($),fromClipboard:$=>g($)},text:{base:"text",storage:"dictionary",matches:$=>typeof $=="string",parse:$=>$.text===""?null:String($.text),compare:($,_)=>x($)?x(_)?0:1:x(_)?-1:E().compare(String($),String(_)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:$=>x($)?"":String($),fromClipboard:$=>$},image:{base:"text",storage:"dictionary",parse:$=>$.text===""||$.text==null?null:String($.text).trim(),compare:($,_)=>x($)?x(_)?0:1:x(_)?-1:E().compare(String($),String(_)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:$=>x($)?"":String($),fromClipboard:$=>$},lookup:{base:"text",storage:"dictionary",parse:$=>{if($.text===""||$.text==null)return null;const _=$.column&&$.column.lookup,Y=_&&U(_.options)?_.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:W,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:$=>x($)?"":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:($,_)=>W($,_),format:$=>{const _=$.value;if(x(_))return"";if(typeof _=="string")return _;try{return JSON.stringify(_)}catch{return String(_)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:$=>x($)?"":typeof $=="string"?$:JSON.stringify($),fromClipboard:$=>$}},T=["boolean","number","date","dateString","datetime","text","object"];function A($,_,Y,Z){const J=Y.get($);if(J)return J;Z.includes($)&&q(`circular data type extends chain: ${[...Z,$].join(" → ")}`);const D=_[$];D||q(`unknown data type "${$}"`);let te=null;D.extends&&(te=A(D.extends,_,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 S($,_){const Y={...H,...i};if(_&&typeof _.dataType=="function"&&typeof _.names=="function")for(const J of _.names("dataType")){const D=_.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)A(J,Y,Z,[]);A("lookup",Y,Z,[]);for(const J of Object.keys(Y))A(J,Y,Z,[]);for(const J of Z.values())u(J.operators,J.name);return Z}function R($,_){if($.base==="text"&&(!$.compare||$.compare===H.text.compare)){const Y=E(_);return(Z,J)=>x(Z)?x(J)?0:1:x(J)?-1:Y.compare(String(Z),String(J))}return $.compare||W}function j($,_){return _?$.multiStorage||"multi":$.storage||"object"}function N($){return k(String($).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),He("packages/core/src/columns/infer.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_SAMPLE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"inferFromValues",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return U}});const E=F("packages/core/src/internal/warn.js").infoOnce,I=F("packages/core/src/internal/predicates.js").isNil,x=100;function Q(L,q,M={}){const O=M.sampleSize??x,k=[];for(let b=0;b<L.length&&k.length<O;b++){const a=L[b];I(a)||typeof a=="number"&&Number.isNaN(a)||k.push(a)}if(k.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[b,a]of q){if(typeof a.matches!="function")continue;let g=!0;for(let o=0;o<k.length;o++)if(!a.matches(k[o])){g=!1;break}if(g)return{type:b,unanimous:!0,sampled:k.length}}return M.quiet||E(`infer:${M.colId||"?"}`,`column "${M.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(L,q,M,O,k={}){const b=k.sampleSize??x,a=[];for(let g=0;g<q.length&&a.length<b;g++){const o=M(q[g]);I(o)||typeof o=="number"&&Number.isNaN(o)||a.push(o)}return Q(a,O,{...k,colId:L}).type}}),He("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 L}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return O}});const ie=F("packages/core/src/internal/warn.js"),E=ie.DEV,W=ie.fail,I=ie.warnOnce,Q=F("packages/core/src/internal/predicates.js").isFunction,U="*";function L(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 u of k)b.set(u.id,u);const a=new Map,g=new Map,o=new Set,t=new Set,r=new Set,s=new Set;for(const u of k){const f=L(u);if(!f.computed){a.set(u.id,[]);continue}t.add(u.id),(f.pure?r:s).add(u.id),f.wholeRow&&o.add(u.id);const p=[],y=[];for(const h of f.deps)(b.has(h)?p:y).push(h);a.set(u.id,p),y.length&&g.set(u.id,y)}for(const u of r)for(const f of a.get(u))s.has(f)&&W(`pure computed column "${u}" depends on impure column "${f}". Mark it \`value.pure: false\` or make the dependency pure.`);const i=[],n=new Map,m=[],c=u=>{const f=n.get(u);if(f!=="done"){if(f==="open"){const p=m.indexOf(u);W(`circular column dependency: ${[...m.slice(p),u].join(" → ")}`)}n.set(u,"open"),m.push(u);for(const p of a.get(u)||[])b.has(p)&&c(p);m.pop(),n.set(u,"done"),i.push(u)}};for(const u of k)c(u.id);const l=new Map;for(const u of k)l.set(u.id,[]);for(const u of k)for(const f of a.get(u.id)||[]){const p=l.get(f);p&&!p.includes(u.id)&&p.push(u.id)}if(o.size)for(const u of k){if(t.has(u.id))continue;const f=l.get(u.id);for(const p of o)f.includes(p)||f.push(p)}return{order:i,dependents:l,pure:r,impure:s,computed:t,deps:a,wholeRow:o,external:g,index:b}}function M(k,b){const a=Array.isArray(b)?b:[b],g=new Set,o=[...a];for(;o.length;){const t=o.shift();for(const r of k.dependents.get(t)||[])g.has(r)||(g.add(r),o.push(r))}for(const t of a)g.delete(t);return k.order.filter(t=>g.has(t))}function O(k,b,a){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:${a}:${t}`,`computed column "${a}" read undeclared dependency "${t}". Add it to \`value.deps\` or the value will go stale.`),o[t]}})}}),He("packages/core/src/model/rowkey.js",function(e,F){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"compositeKey",{enumerable:!0,get:function(){return O}}),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,x=F("packages/core/src/internal/predicates.js"),Q=x.isFunction,U=x.isBlank,L=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],q="";function M(r){if(r===null)return"\0n";if(r===void 0)return"\0u";const s=typeof r;if(s==="string")return r;if(s==="number"||s==="bigint"||s==="boolean")return String(r);if(r instanceof Date)return`\0d${r.getTime()}`;try{return`\0o${JSON.stringify(r)}`}catch{return"\0o?"}}function O(r){if(r.length===1)return M(r[0]);let s="";for(let i=0;i<r.length;i++)i&&(s+=q),s+=M(r[i]);return s}function k(r,s={}){const i=s.warn!==!1;if(Q(r)){const n=r;return{stable:!0,fields:[],disabled:[],key(m,c){try{const l=n(m);return Array.isArray(l)?O(l):M(l)}catch(l){return E("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",l),`#${c??-1}`}},keyEmpty(m){try{const c=n(m);return Array.isArray(c)?c.length===0||c.some(U):U(c)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(r)&&r.length>0){const n=r.filter(l=>typeof l=="string"),m=n.map(l=>I(l)),c=m.length;return{stable:!0,fields:n,disabled:[],key(l){const u=new Array(c);for(let f=0;f<c;f++)u[f]=m[f](l);return O(u)},keyEmpty(l){for(let u=0;u<c;u++)if(U(m[u](l)))return!0;return!1},missingFields(l){const u=[];for(let f=0;f<c;f++)U(m[f](l))&&u.push(n[f]);return u}}}if(typeof r=="string"&&r.length>0){const n=I(r);return{stable:!0,fields:[r],disabled:[],key(m){return M(n(m))},keyEmpty(m){return U(n(m))},missingFields(m){return U(n(m))?[r]:[]}}}return i&&E("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${L.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:L.slice(),key(n,m){if(n===null||typeof n!="object")return`#${m??0}:${String(n)}`;let c=b.get(n);return c===void 0&&(c=`#${a++}`,b.set(n,c)),c}}}const b=new WeakMap;let a=0;function g(r,s){if(!r||r.stable===!1||!Q(r.keyEmpty)||!Array.isArray(s)||s.length===0)return;let i=0,n=null,m;for(let f=0;f<s.length;f++){const p=s[f];r.keyEmpty(p)&&(i++,n===null&&(n=Q(r.missingFields)?r.missingFields(p):[],m=p))}if(i===0)return;const c=r.fields.length?r.fields.join(","):"(function)",l=n&&n.length?n.join(", "):r.fields.length?r.fields.join(", "):"the rowKey function",u=m!==null&&typeof m=="object"?Object.keys(m).join(", ")||"(no fields)":String(m);E(`rowKey.emptyValue:${c}`,`rowKey ${l} is missing on ${i} of ${s.length} rows; the first such row has: ${u}. 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(r){return O(r)}function t(r){return r.split(q)}}),He("packages/core/src/columns/lookup.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_SEPARATOR",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"normaliseOption",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return a}}),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 r}});const ie=F("packages/core/src/internal/compare.js"),E=ie.collator,W=ie.defaultCompare,I=F("packages/core/src/internal/predicates.js"),x=I.isFunction,Q=I.isNil,L=F("packages/core/src/internal/warn.js").warnOnce,M=F("packages/core/src/model/rowkey.js").compositeKey,O=", ",k="";function b(s,i,n,m){if(s===null||typeof s!="object")return{id:s,label:s==null?"":String(s)};const c=s[i],l=s[n],u={id:c,label:l==null?String(c??""):String(l)};s.disabled&&(u.disabled=!0),s.variant&&(u.variant=s.variant),s.icon&&(u.icon=s.icon);const f=m?s[m]:s.group;return f!==void 0&&(u.group=f),u}function a(s,i,n=0,m=[],c=[]){for(const l of s||[]){const u=l&&typeof l=="object"?l[i]:null;if(c.push({raw:l,depth:n,path:m}),Array.isArray(u)&&u.length){const f=String(l&&typeof l=="object"?l.label??l.name??l.id??"":l);a(u,i,n+1,[...m,f],c)}}return c}function g(s){return!!s&&typeof s=="object"&&!Array.isArray(s)&&x(s.router&&s.router.subscribe)}class o{#e;#t;#n;#r;#i=[];#s=new Map;#o=new Map;#l=0;#a="idle";#c=null;#u;#f=null;#d=new Map;constructor(i,n={}){this.#e=i||{},this.#t=n.colId||"?",this.#n=n.locale,this.#r=n.onChange||null,this.#u=E(this.#n),Array.isArray(this.#e.options)?this.#h(this.#e.options):this.#e.options===void 0&&(this.#a="ready")}get colId(){return this.#t}get version(){return this.#l}get state(){return this.#a}get ready(){return this.#a==="ready"}get multiple(){return this.#e.multiple===!0}get separator(){return this.#e.separator??O}get allowCustom(){return this.#e.allowCustom===!0}get sortBy(){return this.#e.sortBy||"label"}get spec(){return this.#e}options(){return this.#i}setLocale(i){this.#n=i,this.#u=E(i)}#h(i){const n=this.#e,m=n.valueKey||"id",c=n.labelKey||"label",l=n.childrenKey||"children";this.#i=a(i,l).map(u=>{const f=b(u.raw,m,c,n.groupKey);return u.depth&&(f.depth=u.depth,f.path=u.path),f}),this.#s=new Map,this.#o=new Map,this.#i.forEach((u,f)=>{this.#s.set(u.id,u),this.#o.set(u.id,f)}),this.#a="ready",this.#l+=1}load(){if(this.#c)return this.#c;const i=this.#e.options;if(Array.isArray(i)||i===void 0)return this.#c=Promise.resolve(this.#i),this.#c;if(g(i))return this.#c=this.#p(i),this.#c;if(!x(i))return L(`lookup:options:${this.#t}`,`column "${this.#t}" has an invalid \`lookup.options\`; expected an array, a function, or a router route`),this.#a="ready",this.#c=Promise.resolve([]),this.#c;this.#a="loading";let n;try{n=i()}catch(m){return this.#a="error",L(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,m),this.#c=Promise.resolve([]),this.#c}return!n||!x(n.then)?(this.#h(n),this.#c=Promise.resolve(this.#i),this.#r&&this.#r(this),this.#c):(this.#c=n.then(m=>(this.#h(m),this.#r&&this.#r(this),this.#i),m=>(this.#a="error",L(`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(i){if(this.#f)return Promise.resolve(this.#i);const n=this.#e,m=n.valueKey||"id",c=n.labelKey||"label",l=n.groupKey,u=x(i.map)?i.map:null,f=y=>b(u?u(y):y,m,c,l).id,p=y=>this.#m(y,u,m,c,l);return i.router.subscribe(i.predicate,p,{rowKey:f}),this.#f=()=>{x(i.router.detach)&&i.router.detach(p)},this.#a="ready",Promise.resolve(this.#i)}#m(i,n,m,c,l){const u=i&&i.add||[],f=i&&i.update||[],p=i&&i.remove||[];if(!(!u.length&&!f.length&&!p.length)){for(const y of u)this.#g(y,n,m,c,l);for(const y of f)this.#g(y,n,m,c,l);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.#o=new Map(this.#i.map((y,h)=>[y.id,h])),this.#a="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(i,n,m,c,l){const u=b(n?n(i):i,m,c,l);this.#d.set(M([u.id]),u.id);const f=this.#i.findIndex(p=>p.id===u.id);f>=0?this.#i[f]=u:this.#i.push(u),this.#s.set(u.id,u)}destroy(){this.#f&&(this.#f(),this.#f=null)}search(i,n){const m=this.#e;if(!x(m.search)){const u=String(i||"").toLowerCase();return Promise.resolve(u===""?this.#i:this.#i.filter(f=>f.label.toLowerCase().includes(u)))}const c=m.valueKey||"id",l=m.labelKey||"label";return Promise.resolve(m.search(i,n)).then(u=>(u||[]).map(f=>b(f,c,l,m.groupKey)))}option(i){return this.#s.get(i)}has(i){return this.#s.has(i)}label(i){if(Q(i)||i==="")return"";const n=this.#s.get(i);if(n)return n.label;if(this.#a==="loading"||this.#a==="idle")return"";this.allowCustom||L(`lookup:unknown:${this.#t}`,`column "${this.#t}" holds value ${JSON.stringify(i)} which is not in its lookup options. Showing the raw value; set \`lookup.unknownLabel\` or \`lookup.allowCustom\` to change that.`);const m=this.#e.unknownLabel;return x(m)?String(m(i)??""):typeof m=="string"?m:String(i)}text(i){if(this.multiple){const n=t(i);return n.length===0?"":n.map(m=>this.label(m)).join(this.separator)}return this.label(i)}dictionary(){return this.#i.map(i=>i.id)}sorted(){const i=this.sortBy;if(i==="optionOrder"||i==="count")return this.#i.slice();if(i==="value")return this.#i.slice().sort((m,c)=>W(m.id,c.id));const n=this.#u;return this.#i.slice().sort((m,c)=>n.compare(m.label,c.label))}comparator(){const i=this.sortBy,n=this.multiple,m=this.#u,c=this.#o;if(n&&i==="count")return(u,f)=>t(u).length-t(f).length;const l=n?u=>t(u)[0]:u=>u;return i==="value"?(u,f)=>W(l(u),l(f)):i==="optionOrder"?(u,f)=>{const p=c.has(l(u))?c.get(l(u)):Number.MAX_SAFE_INTEGER,y=c.has(l(f))?c.get(l(f)):Number.MAX_SAFE_INTEGER;return p-y}:(u,f)=>{const p=l(u),y=l(f);return Q(p)?Q(y)?0:1:Q(y)?-1:m.compare(this.label(p),this.label(y))}}groupKey(i){return this.multiple?t(i).map(m=>String(m)).sort().join(k):Q(i)?"":String(i)}countValues(i){return this.multiple?t(i).length:Q(i)?0:1}contains(i,n,m){const c=this.multiple?t(i):Q(i)?[]:[i],l=Array.isArray(n)?n:[n];switch(m){case"containsAll":return l.every(u=>c.includes(u));case"containsNone":return!l.some(u=>c.includes(u));default:return l.some(u=>c.includes(u))}}exportText(i,n="label"){return n==="value"?this.multiple?t(i).join(this.separator):Q(i)?"":String(i):this.text(i)}exportColumns(){const i=this.multiple;return this.#i.map(n=>({id:n.id,label:n.label,has:m=>i?t(m).includes(n.id):m===n.id}))}}function t(s){return Array.isArray(s)?s:Q(s)||s===""?[]:[s]}function r(s,i={}){const n=s.lookup;if(!n)return null;const m=new o(n,{colId:s.id,locale:i.locale,onChange:i.onChange});return!Array.isArray(n.options)&&n.options!==void 0&&m.load(),m}}),He("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 r}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return s}});const E=F("packages/core/src/internal/paths.js").getPath,W=F("packages/core/src/internal/predicates.js"),I=W.isFunction,x=W.isNil,Q=W.isObject,L=F("packages/core/src/internal/lru.js").Lru,M=F("packages/core/src/internal/warn.js").warnOnce,k=F("packages/core/src/format/number.js").compileNumber,a=F("packages/core/src/columns/graph.js").depsProxy,g="\0";function o(c,l={}){const u=l.locale,f=l.grid??null,p=l.context,y=c.value&&c.value.format,h=c.formatter||null,d=c.dataType&&c.dataType.format,w=c.lookup||null,v=(P,G,V)=>({value:P,data:V,row:G,column:c,colId:c.id,grid:f,context:p,locale:u});if(I(y))return(P,G,V)=>{const K=y(v(P,G,V));return K==null?"":String(K)};if(h){if(w){const P=h.kind==="text";return(G,V,K)=>h(P?w.text(G):G,v(G,V,K))}return(P,G,V)=>h(P,v(P,G,V))}if(I(d))return(P,G,V)=>{const K=d(v(P,G,V));return K==null?"":String(K)};if(c.dataType&&c.dataType.base==="number"&&Q(c.typeOptions)&&typeof c.typeOptions.decimals=="number"){const P=k({decimals:c.typeOptions.decimals},u);return G=>P(G)}return w?P=>w.text(P):P=>x(P)?"":typeof P=="string"?P:String(P)}function t(c,l){!c||!c.value||c.value.pure!==!1||M(`impure:${l}:${c.id}`,`column "${c.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${l}. The result is not stable across passes.`)}class r{#e;#t;#n;#r;#i;#s;#o=new L(4096);constructor(l){this.#e=l.columns instanceof Map?l.columns:new Map((l.columns||[]).map(u=>[u.id,u])),this.#t=l.graph,this.#n=l.grid??null,this.#r=l.context,this.#s=l.stored||null,this.#i=l.rowKey||s}get graph(){return this.#t}setGraph(l){this.#t=l,this.#o.clear()}beginPass(){this.#o.clear()}endPass(){this.#o.clear()}invalidate(l){if(this.#o.size===0)return;const u=l&&l.rows?new Set([...l.rows].map(String)):null,f=l&&l.columns?[...l.columns]:null;if(!u&&!f){this.#o.clear();return}const p=f?this.#l(f):null;for(const y of[...this.#o.keys()]){const h=String(y).split(g);h.length===3&&(u&&!u.has(h[0])||p&&!p.has(h[2])||this.#o.delete(y))}}#l(l){const u=new Set,f=this.#t,p=[...l];for(;p.length;){const y=p.pop();if(!u.has(y)){u.add(y);for(const h of f?f.dependents.get(y)||[]:[])p.push(h)}}return u}value(l,u,f){const p=typeof l=="string"?this.#e.get(l):l;if(!p)return;if(!p.computed)return this.#c(p,u,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,u,f);if(p.value.pure===!1)return this.compute(p,u,f);const y=`${this.#a(u,f)}${g}${p.id}`;if(this.#o.has(y))return this.#o.get(y);const h=this.compute(p,u,f);return this.#o.set(y,h),h}#a(l,u){return`${this.#i(l,u)}${g}${i(l)}`}#c(l,u,f){if(this.#s&&f&&f.physical!=null&&this.#s.has(l.id))return this.#s.get(l.id,f.physical);if(l.field)return l.read?l.read(u):E(u,l.field)}compute(l,u,f){const p=this.#t,y=p&&p.wholeRow.has(l.id);let h;if(y)h=u??{};else{h={};const w=p&&p.deps.get(l.id)||[];for(const P of w)h[P]=this.value(P,u,f);const v=p&&p.external.get(l.id)||[];for(const P of v)h[P]=E(u,P);h=a(h,[...w,...v],l.id)}const d={data:u,row:f,column:l,grid:this.#n,context:this.#r};return l.value.compute(h,d)}values(l,u){const f={},p=this.#t?this.#t.order:[...this.#e.keys()];for(const y of p)f[y]=this.value(y,l,u);return f}text(l,u,f){const p=typeof l=="string"?this.#e.get(l):l;return p?p.formatValue(this.value(p,u,f),f,u):""}key(l,u,f){const p=typeof l=="string"?this.#e.get(l):l;if(!p)return"";const y=this.value(p,u,f);return I(p.value.key)?String(p.value.key(this.#u(p,y,u,f))):p.lookup?p.lookup.groupKey(y):x(y)?"":String(y)}quickFilterText(l,u,f){const p=typeof l=="string"?this.#e.get(l):l;if(!p)return"";if(I(p.value.quickFilterText)){const y=this.value(p,u,f);return String(p.value.quickFilterText(this.#u(p,y,u,f))??"")}return this.text(p,u,f)}#u(l,u,f,p){return{value:u,data:f,row:p,column:l,colId:l.id,grid:this.#n,context:this.#r}}parse(l,u,f,p){const y=typeof l=="string"?this.#e.get(l):l;if(!y)return u;const h={text:u,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):u}validate(l,u,f,p,y){const h=typeof l=="string"?this.#e.get(l):l;if(!h||!I(h.edit.validate))return!0;const d=h.edit.validate({value:u,oldValue:f,data:p,row:y,column:h,grid:this.#n,context:this.#r});return d===!0||d===void 0?!0:String(d)}apply(l,u,f,p){const y=typeof l=="string"?this.#e.get(l):l;if(!y)return!1;const h=this.value(y,f,p);if(I(y.value.apply)){const d=y.value.apply({value:u,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===u?!1:(y.write(f,u),this.#f(y,f,p),!0):(M(`apply:${y.id}`,`column "${y.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(l,u,f,p){const y=typeof l=="string"?this.#e.get(l):l;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,u,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(l,u,f){if(this.#o.size===0)return;const p=this.#a(u,f);this.#o.delete(`${p}${g}${l.id}`);for(const y of this.#t?this.#t.dependents.get(l.id)||[]:[])this.#o.delete(`${p}${g}${y}`)}}function s(c,l){return l&&l.key!=null?String(l.key):i(c)}function i(c){if(c&&typeof c=="object"){let l=n.get(c);return l===void 0&&(l=`#${m++}`,n.set(c,l)),l}return String(c)}const n=new WeakMap;let m=0}),He("packages/core/src/model/shadow.js",function(e,F){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"HISTORY_TICK_MAX_MS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"HISTORY_TICK_MIN_MS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"CLUSTER_SHADOW_KINDS",{enumerable:!0,get:function(){return O}}),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 a}}),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 l}});const E=F("packages/core/src/internal/warn.js").warnOnce,W=2e5,I=20,x=1e3,Q=50;function U(u){return Math.min(x,Math.max(Q,Math.floor(u)))}const L=Object.freeze(["updates","updatedAt","sinceUpdate","delta","deltaPercent","rate","history","firstValue","streak","rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag","specStatus","rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta","fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD","cluster","clusterDistance"]),q=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),M=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),O=Object.freeze(["cluster","clusterDistance"]),k=.6745,b=3.5,a=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(u,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(u))return null;if(p!==null&&u<p||y!==null&&u>y)return a.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&&u<h||d!==null&&u>d?a.WARN:a.PASS}function r(u,f,p){if(!f||typeof f!="object")return null;if(f.kind!=="time")return f.kind!==void 0&&E(`shadow.history.window.kind:${u}`,`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:${u}`,"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;#o=new Map;#l=0;#a;#c;#u;#f;#d=new Map;#h=null;#p=null;#m=null;constructor(f){this.#e=f.colId,this.#a=Math.max(2,f.depth||I),this.#c=Math.max(1,f.max||W),this.#u=f.now||(()=>Date.now()),this.#f=r(this.#e,f.historyWindow,this.#a),this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#f}observe(f,p){const y=c(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.#o.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.#a&&d.splice(0,d.length-this.#a),this.#s.set(f,d);const w=Math.sign(y-h),v=this.#o.get(f)||0;this.#o.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.#o.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.#o.clear(),this.#l=0,this.#p=null,this.#m=null,this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}retain(f){const 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.#o.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.#a);for(const[w,v]of this.#d){const P=this.#n.get(w);for(let G=0;G<d;G++)v.push(P);v.length>this.#a&&v.splice(0,v.length-this.#a)}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.#o.has(p)?this.#o.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[H,T]of this.#n)f&&!f.has(H)||p.push(T);const y=p.sort((H,T)=>H-T);let h=0,d=0,w=0,v=0;for(const H of y){v+=H,h++;const T=H-d;d+=T/h,w+=T*(H-d)}const P=[];for(const[H,T]of this.#t)f&&!f.has(H)||P.push(T);const G=h?i(y):0,V=y.map(H=>Math.abs(H-G)).sort((H,T)=>H-T),K=h?i(V):0;return{sorted:y,baseline:P.sort((H,T)=>H-T),sum:v,mean:h?d:0,sd:h>1?Math.sqrt(w/(h-1)):0,median:G,mad:K}}#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,G=v-m(w.sorted,d)+1;return P-G}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 i(u){const f=u.length;if(!f)return 0;const p=(f-1)*.5,y=Math.floor(p),h=Math.ceil(p);return y===h?u[y]:u[y]+(p-y)*(u[h]-u[y])}function n(u,f){let p=0,y=u.length;for(;p<y;){const h=p+y>>1;u[h]<f?p=h+1:y=h}return p}function m(u,f){let p=0,y=u.length;for(;p<y;){const h=p+y>>1;u[h]<=f?p=h+1:y=h}return p}function c(u){if(u==null||u==="")return null;if(u instanceof Date){const p=u.getTime();return Number.isFinite(p)?p:null}const f=typeof u=="number"?u:Number(u);return Number.isFinite(f)?f:null}function l(u){const f=[];for(const p of u||[]){const y=p.shadow;if(!y)continue;const h=typeof y=="string"?{kind:y}:y,d=h.kind;L.includes(d)&&(q.includes(d)||M.includes(d)||O.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}}),He("packages/core/src/columns/model.js",function(e,F){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return Re}});const ie=F("packages/core/src/internal/merge.js"),E=ie.expand,W=ie.merge,I=ie.toArray,x=F("packages/core/src/internal/warn.js"),Q=x.fail,U=x.warnOnce,L=F("packages/core/src/internal/paths.js"),q=L.getPath,M=L.pathGetter,O=L.pathSetter,b=F("packages/core/src/internal/text.js").humanise,a=F("packages/core/src/internal/predicates.js"),g=a.isFunction,o=a.isObject,r=F("packages/core/src/internal/uid.js").uid,i=F("packages/core/src/format/index.js").compileFormat,n=F("packages/core/src/columns/datatypes.js"),m=n.comparatorFor,c=n.createTypeRegistry,l=n.storageKind,u=F("packages/core/src/columns/infer.js"),f=u.inferColumnType,p=u.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"),G=P.compileDisplay,V=P.ValuePipeline,K=P.warnImpureUse,H=F("packages/core/src/model/shadow.js"),T=H.FIT_SHADOW_KINDS,A=H.CLUSTER_SHADOW_KINDS,S=Object.freeze({geometry:"geometry",list:"list"}),R={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},j={centre:"center"},N=new Set(["start","center","end","left","right"]);function $(be){if(typeof be!="string")return;const se=be.toLowerCase();return j[se]?j[se]:N.has(se)?se:void 0}function _(be){if(typeof be!="string")return;const se=be.toLowerCase();return se==="center"||se==="centre"?"middle":se==="top"||se==="middle"||se==="bottom"?se:void 0}const Y=["cell","layout","header"];function Z(be){if(!o(be))return{};const se={...be},de=(oe,ce)=>{if(be[oe]===void 0)return;const he=E(be[oe],ce);he&&Y.includes(oe)&&!o(be[oe])&&delete he.enabled,se[oe]=he};return de("sort","direction"),de("filter","type"),de("cell","render"),de("edit","editor"),de("layout","width"),de("group","index"),de("pivot","index"),de("header","render"),de("facet","strategy"),se}function J(be,se){const de={...be||{}},oe=o(se)&&o(se.layout)&&se.layout.width!==void 0;return de.fit==="content"&&!oe&&delete de.width,de}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(be,se,de,oe){const ce=de==="columnGroup"?"column group":"column";for(const he of Object.keys(be))if(!se.has(he)){if(he==="timeZone"&&de==="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(`${de}.unknown:${he}`,`'${he}' is not a configuration key this grid recognises, so it had no effect on ${ce} "${oe}". Check the spelling against the reference.`)}}function X(be){o(be.cell)&&be.cell.autoHeight!==void 0&&U("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${be.id||be.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function ne(be,se){const de=se&&g(be.defaultsFor)?be.defaultsFor(se):null,oe={...be.defaults||{},...o(de)?de:{}},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}),be.export&&(ce.export={...be.export}),ce}function re(be){if(typeof be=="string")return be.trim()?[be.trim()]:[];if(!Array.isArray(be))return[];const se=[];for(const de of be){if(typeof de!="string")continue;const oe=de.trim();oe&&!se.includes(oe)&&se.push(oe)}return se}class ae{#e=new Map;#t=[];#n=[];#r=new WeakMap;#i;#s;#o;#l;#a;#c;#u(se,de,oe){if(se&&typeof se=="object"&&!g(se)){const Se=se;return(typeof Se.fn!="string"||!Se.fn)&&Q(`column "${oe}": a total given as an object needs a \`fn\` name, such as { fn: 'percentile', p: 0.9 }.`),Se.fn==="percentile"&&!(typeof Se.p=="number"&&Se.p>=0&&Se.p<=1)&&Q(`column "${oe}": { fn: 'percentile' } needs \`p\`, a number from 0 to 1 (0.9 for the 90th percentile).`),this.#f(Se.fn,de,oe),Object.freeze({...Se})}const ce=this.#f(se,de,oe);if(typeof ce!="string"||!this.#d)return ce??null;const he=de&&de.totals&&de.totals.implement;if(he&&g(he[ce])){const Se=he[ce];return Se.totalName=ce,Se}const Oe=this.#d.totalFn?.(ce);return g(Oe)?Oe:ce}#f(se,de,oe){if(typeof se!="string")return se;const ce=de&&de.totals&&de.totals.supported;if(!Array.isArray(ce)||ce.includes(se))return se;const he=ce.length?ce.join(", "):"none";return Q(`column "${oe}" is typed ${de.name||"a type"}, for which the total "${se}" is not meaningful. Supported: ${he}. Aggregating it anyway would produce a confident wrong number.`),se}#d;#h;#p;#m;#g;#b;#y=!1;#O;#w;constructor(se={}){this.#s=Z(se.columnDefaults||{}),this.#o=se.columnPresets||{},this.#a=se.locale,this.#l=se.timeZone,this.#c=_(se.verticalAlign),this.#d=se.registry||null,this.#h=se.grid||null,this.#p=se.context,this.#O=se.sampleSize??p,this.#w=se.onChange||null,this.#b=g(se.rowKey)?se.rowKey:void 0,this.#i=c(se.dataTypes,this.#d);const{leaves:de,groups:oe}=Re(se.columns||[]);this.#n=oe;for(const ce of de){ce.facet!==void 0&&this.#r.set(ce.def,ce.facet);const he=this.#A(ce.def,null);if(he.groupPath=ce.path,this.#e.has(he.id)){U(`columns.duplicate:${he.id}`,`two columns resolve to the id '${he.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=he,this.#e.set(he.id,he),this.#t.push(he.id)}this.#C(se.stored||null)}#A(se,de){z(se,D,"column",se.id||se.field||"(unnamed)"),X(se);const oe=Z(se),ce=I(se.preset),he=ce.map(Me=>{const Be=this.#o[Me];return Be?Z(Be):(U(`preset:${Me}`,`unknown column preset "${Me}"; ignoring`),{})}),Oe=this.#S(oe,he,de),Se=this.#i.get(Oe)||this.#i.get("text");if(!this.#i.has(Oe)&&se.type){const Me=S[Oe];U(`type:${Oe}`,`unknown data type "${Oe}"; falling back to "text"`+(Me?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${Me}'.`:""))}const Ce=g(Se.items)?this.#P(oe,he,se.id||se.field||"(unnamed)"):null;let Ie=R;Ie=W(Ie,this.#s),se.type!==!1&&(Ie=W(Ie,ne(Se,Ce)));for(const Me of he)Ie=W(Ie,Me);this.#r.has(se)&&(Ie=W(Ie,Z({facet:this.#r.get(se)}))),Ie=W(Ie,oe);const ke=Ie.edit;ke&&ke.editor&&ke.enabled!==!0&&!g(ke.enabled)&&(se.edit||{}).editor&&U(`column.editor-not-enabled:${se.id||se.field}`,`column '${se.id||se.field}' names the editor '${ke.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const _e=se.id||se.field||r("col");if(se.shadow&&!g(Ie.value&&Ie.value.compute)){const Me=typeof se.shadow=="string"?{kind:se.shadow}:se.shadow,Be=Me.of||se.field||_e,Ke=T.includes(Me.kind),et=A.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;Ie.value={...Ie.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(se.running&&!g(Ie.value&&Ie.value.compute)){const Me=typeof se.running=="string"?{kind:se.running}:se.running,Be=Me.of||se.field||_e;Ie.value={...Ie.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}},se.sort===void 0&&(Ie.sort={...Ie.sort||{},enabled:!1})}const Te=se.field??(g(Ie.value&&Ie.value.compute)?null:se.id??null),je=g(Ie.value&&Ie.value.compute),Ae={id:_e,field:Te,shadow:se.shadow||null,running:se.running||null,spec:se.spec||null,validation:se.validation||null,volatile:!!(se.shadow||se.running),title:Ie.title??b(Te||_e),type:Se.name,dataType:Se,itemType:Ce,nullable:Ie.nullable!==!1,align:$(oe.cell&&oe.cell.align||oe.align||Ie.cell&&Ie.cell.align||Ie.align||Se.defaults&&Se.defaults.align)||"start",verticalAlign:_(oe.cell&&oe.cell.verticalAlign||oe.verticalAlign||Ie.cell&&Ie.cell.verticalAlign||Ie.verticalAlign)||this.#c,rowSpan:g(Ie.rowSpan)?Ie.rowSpan:null,colSpan:g(Ie.colSpan)?Ie.colSpan:null,value:{pure:!0,...Ie.value||{}},cell:{...Ie.cell||{}},edit:{...Ie.edit||{}},sort:{...Ie.sort||{}},filter:{...Ie.filter||{}},group:{enabled:!1,index:-1,explode:!1,...Ie.group||{}},pivot:{enabled:!1,index:-1,...Ie.pivot||{}},total:this.#u(Ie.total,Se,se.id||se.field||"(unnamed)"),groupTotal:Ie.groupTotal===void 0?null:this.#u(Ie.groupTotal,Se,se.id||se.field||"(unnamed)"),grandTotal:Ie.grandTotal===void 0?null:this.#u(Ie.grandTotal,Se,se.id||se.field||"(unnamed)"),tags:re(Ie.tags),typeOptions:Ie.typeOptions??null,...o(Ie[Oe])?{[Oe]:Ie[Oe]}:{},layout:J(Ie.layout,oe),header:{...Ie.header||{}},contextMenu:Ie.contextMenu===void 0?null:Ie.contextMenu,facet:{...Ie.facet||{}},export:{...Ie.export||{}},allowGroup:Ie.allowGroup!==!1,allowPivot:Ie.allowPivot!==!1,allowTotal:Ie.allowTotal!==!1,quickFilter:Ie.quickFilter!==!1,def:se,format:Ie.format,presets:ce,inferred:de!=null&&!se.type,computed:je,diff:se.diff===void 0?void 0:!!se.diff,read:Te?M(Te):null,write:Te?O(Te):null};Ae.cell.align=$(oe.cell&&oe.cell.align)||Ae.align,Ae.header.align=$(oe.header&&oe.header.align)||Ae.align;const Ee=Ie.lookup||null;return Ae.lookup=Ee?v({id:_e,lookup:Ee},{locale:this.#a,onChange:()=>{this.#w&&this.#w("lookup",{colId:_e})}}):null,Ae.group.explode&&Ae.lookup&&Ae.lookup.multiple&&U(`explode:${_e}`,`column "${_e}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(Ae),Ae}#v(se){se.formatter=i(se.format,se.dataType,this.#a,this.#l,se.id),se.formatValue=G(se,{locale:this.#a,grid:this.#h,context:this.#p}),se.itemCompare=se.itemType?m(se.itemType,this.#a):null,se.compare=g(se.value.compare)?se.value.compare:se.lookup?se.lookup.comparator():g(se.dataType.compareFor)?se.dataType.compareFor(se):m(se.dataType,this.#a),se.excel=se.formatter&&se.formatter.ooxml||se.dataType&&se.dataType.excel||"General",se.storeKind=l(se.dataType,!!(se.lookup&&se.lookup.multiple))}#P(se,de,oe){let ce=o(se.typeOptions)?se.typeOptions:null;for(let Ce=de.length-1;!ce&&Ce>=0;Ce--)o(de[Ce].typeOptions)&&(ce=de[Ce].typeOptions);!ce&&o(this.#s.typeOptions)&&(ce=this.#s.typeOptions);const he=ce&&ce.of!==void 0?ce.of:"text",Oe=typeof he=="string"?this.#i.get(he):void 0;return Oe&&!g(Oe.items)&&Oe.storage!=="object"?Oe:(U(`type:of:${String(he)}`,`column "${oe}" names "${String(he)}" as its item type (typeOptions.of), which is not ${Oe?"a scalar data type":"a known data type"}; its items are read as text.`),this.#i.get("text"))}#S(se,de,oe){if(se.type===!1)return"text";if(se.type)return se.type;for(let ce=de.length-1;ce>=0;ce--)if(de[ce].type)return de[ce].type;if(this.#s.type)return this.#s.type;if(se.shadow){const ce=typeof se.shadow=="string"?se.shadow:se.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||(se.lookup?"lookup":"text")}#C(se){const de=this.all();this.#m=h(de),this.#g?this.#g.setGraph(this.#m):this.#g=new V({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:se||null,rowKey:this.#b});const oe=this.#g;for(const ce of de)ce.getValue=(he,Oe)=>oe.value(ce,he,Oe)}all(){return this.#t.map(se=>this.#e.get(se))}visible(){return this.all().filter(se=>!se.layout.hidden)}get(se){return this.#e.get(se)}groups(){const se=de=>{const oe=[];for(const ce of de)Array.isArray(ce.columns)?oe.push({...ce,columns:se(ce.columns)}):ce.column&&oe.push(ce.column);return oe};return se(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#i}affectedBy(se){return d(this.#m,se)}value(se,de,oe){return this.#g.value(se,de,oe)}text(se,de,oe){return this.#g.text(se,de,oe)}checkImpure(se,de){K(this.#e.get(se),de)}setLocale(se){this.#a=se;for(const de of this.all())de.lookup&&de.lookup.setLocale(se),this.#v(de);this.#w&&this.#w("locale",{locale:se})}infer(se){const de={};if(this.#y||!Array.isArray(se)||se.length===0)return de;this.#y=!0;let oe=!1;for(const ce of this.all()){const he=ce.def;if(he.type!==void 0||!ce.field||ce.computed||ce.lookup||this.#E(ce))continue;const Oe=ce.read||(Ie=>q(Ie,ce.field)),Se=f(ce.id,se,Oe,this.#i,{sampleSize:this.#O});if(Se===ce.type)continue;de[ce.id]=Se;const Ce=this.#A(he,Se);Ce.groupPath=ce.groupPath,Ce.layout={...Ce.layout,...fe(ce.layout)},this.#e.set(ce.id,Ce),$e(this.#n,ce.id,Ce),oe=!0}return oe&&this.#C(null),de}redecorate(se,de,oe={}){const ce=this.#e.get(se);if(!ce){U(`redecorate:${se}`,`columns.decorate('${se}', …): no column with id '${se}'.`);return}const he=ce.def||{},Oe={...o(he.cell)?he.cell:{}};Oe.decoration=de??void 0,oe&&"variant"in oe&&(Oe.variant=oe.variant);const Se={...he,cell:Oe};this.#r.has(he)&&this.#r.set(Se,this.#r.get(he));const Ce=this.#A(Se,ce.type);return Ce.groupPath=ce.groupPath,Ce.layout={...Ce.layout,...fe(ce.layout)},ce.lookup&&ce.lookup!==Ce.lookup&&g(ce.lookup.destroy)&&ce.lookup.destroy(),this.#e.set(se,Ce),$e(this.#n,se,Ce),this.#C(null),this.#w&&this.#w("decorate",{colId:se}),Ce}destroy(){for(const se of this.#e.values())se.lookup&&g(se.lookup.destroy)&&se.lookup.destroy()}#E(se){for(const de of se.presets){const oe=this.#o[de];if(oe&&oe.type)return!0}return!!this.#s.type}#T(se){return!se.computed&&g(se.dataType&&se.dataType.toStorage)}storeReader(se){if(se.computed)return de=>this.#g.value(se,de,null);if(this.#T(se)){const de=se.dataType.toStorage,oe=se.format&&typeof se.format=="object"&&!Array.isArray(se.format)?se.format.locale:void 0,ce={timeZone:this.#l,colId:se.id,itemType:se.itemType||null,locale:oe||this.#a};return he=>de(se.read(he),ce)}return se.read}storeValue(se,de){if(!(!se||se.computed)&&g(se.read))return this.storeReader(se)(de)}storeSchema(){const se=[];for(const de of this.all()){if(de.computed&&de.value.pure===!1||!de.computed&&!de.field)continue;const oe=this.storeReader(de);let ce=null;!de.computed&&!this.#T(de)&&typeof de.field=="string"&&!de.lookup&&(ce=de.field);const he={id:de.id,kind:de.storeKind,nullable:de.nullable,read:oe};ce!==null&&(he.field=ce),de.lookup&&(he.dictionary=de.lookup.dictionary()),se.push(he)}return se}state(){return this.all().map(se=>({id:se.id,width:se.layout.width,flex:se.layout.flex||void 0,hidden:!!se.layout.hidden,headerWrap:se.header?.wrap===!0?!0:void 0,headerOrientation:se.header?.orientation==="vertical"?"vertical":void 0,pin:se.layout.pin??null,sort:se.sort.direction??null,sortIndex:se.sort.direction?se.sort.order??0:null,groupIndex:se.group.enabled?se.group.index??0:null,pivotIndex:se.pivot.enabled?se.pivot.index??0:null,total:typeof se.total=="string"?se.total:null,groupTotal:typeof se.groupTotal=="string"?se.groupTotal:void 0,grandTotal:typeof se.grandTotal=="string"?se.grandTotal:void 0,decoration:se.cell&&se.cell.decoration!=null?we(se.cell.decoration):void 0,variant:se.cell&&se.cell.variant!=null?we(se.cell.variant):void 0}))}applyState(se,de={}){const oe={applied:[],skipped:[]},ce=Array.isArray(se)?se:se&&se.columns||[],he=!Array.isArray(se)&&se&&se.columnOrder||null;for(const Se of ce){if(!Se||!Se.id){oe.skipped.push({key:"?",reason:"no id"});continue}let Ce=this.#e.get(Se.id);if(!Ce){oe.skipped.push({key:Se.id,reason:"unknown column"});continue}if(Object.hasOwn(Se,"decoration")||Object.hasOwn(Se,"variant")){const Ie=Ce.cell?Ce.cell.decoration:void 0,ke=Se.decoration??null,_e=Object.hasOwn(Se,"variant"),Te=_e&&!ve(Ce.cell?Ce.cell.variant:void 0,Se.variant);(!ve(Ie,ke)||Te)&&(this.redecorate(Se.id,ke,_e?{variant:Se.variant??void 0}:{}),Ce=this.#e.get(Se.id)||Ce)}Se.width!=null&&(Ce.layout.width=Se.width),Se.flex!=null&&(Ce.layout.flex=Se.flex),Se.hidden!=null&&(Ce.layout.hidden=!!Se.hidden),Se.headerWrap!==void 0&&(Ce.header.wrap=!!Se.headerWrap),Se.headerOrientation!==void 0&&(Ce.header.orientation=Se.headerOrientation==="vertical"?"vertical":"horizontal"),Se.pin!==void 0&&(Ce.layout.pin=Se.pin),Se.sort!==void 0&&(Ce.sort.direction=Se.sort),Se.sortIndex!=null&&(Ce.sort.order=Se.sortIndex),Se.groupIndex!=null&&(Ce.group.enabled=!0,Ce.group.index=Se.groupIndex),Se.pivotIndex!=null&&(Ce.pivot.enabled=!0,Ce.pivot.index=Se.pivotIndex),Se.total!==void 0&&(Ce.total=Se.total),Se.groupTotal!==void 0&&(Ce.groupTotal=Se.groupTotal),Se.grandTotal!==void 0&&(Ce.grandTotal=Se.grandTotal),oe.applied.push(Se.id)}const Oe=he||(de&&de.keepOrder?[]:ce.map(Se=>Se&&Se.id).filter(Boolean));if(Oe.length){const Se=Oe.filter(Ie=>this.#e.has(Ie)),Ce=this.#t.filter(Ie=>!Se.includes(Ie));this.#t=[...Se,...Ce]}return this.#w&&this.#w("state",oe),oe}move(se,de){this.#M(se,de)&&(this.#R(),this.#w&&this.#w("move",{id:se,to:de}))}reorder(se){const de={applied:[],skipped:[]},oe=[];let ce=0;for(const he of Array.isArray(se)?se:[]){const Oe=ce++;this.#M(he,Oe)&&(de.applied.push(he),oe.push({id:he,to:Oe}))}if(!oe.length)return de;if(this.#R(),this.#w)for(const he of oe)this.#w("move",he);return de}#M(se,de){const oe=this.#t.indexOf(se);if(oe===-1||Math.max(0,Math.min(Number(de)||0,this.#t.length-1))===oe)return!1;const he=this.#e.get(se);if(he.layout.movable===!1||he.layout.lockPosition)return U(`move:${se}`,`column "${se}" is not movable; the move was ignored`),!1;const Oe=this.#N(se,de);return Oe?(U(`move.married:${Oe}`,`band "${Oe}" 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(de,this.#t.length)),0,se),!0)}#N(se,de){if(!this.#n||!this.#n.length)return null;const oe=this.#t.filter(Se=>Se!==se),ce=Math.max(0,Math.min(de,oe.length)),he=(Se,Ce)=>{if(Array.isArray(Se.columns)){for(const ke of Se.columns)he(ke,Ce);return Ce}const Ie=Se.column?Se.column.id:Se.id;return Ie&&Ce.push(Ie),Ce},Oe=Se=>{for(const Ce of Se){if(!Array.isArray(Ce.columns))continue;if(Ce.marryChildren===!0){const ke=he(Ce,[]),_e=ke.includes(se),Te=ke.map(je=>oe.indexOf(je)).filter(je=>je>=0);if(Te.length){const je=Math.min(...Te),Ae=Math.max(...Te);if(_e?ce<je||ce>Ae+1:ce>je&&ce<=Ae)return Ce.id}}const Ie=Oe(Ce.columns);if(Ie)return Ie}return null};return Oe(this.#n)}#R(){const se=new Map(this.#t.map((ce,he)=>[ce,he])),de=ce=>{if(!Array.isArray(ce.columns)){const Oe=ce.column?ce.column.id:ce.id;return se.has(Oe)?se.get(Oe):1/0}let he=1/0;for(const Oe of ce.columns)he=Math.min(he,de(Oe));return he},oe=ce=>{ce.sort((he,Oe)=>de(he)-de(Oe));for(const he of ce)Array.isArray(he.columns)&&oe(he.columns)};oe(this.#n)}#D(se){const de=oe=>{for(let ce=0;ce<oe.length;ce++){const he=oe[ce];if(Array.isArray(he.columns)){const Oe=de(he.columns);if(Oe)return Oe}else if(he.column&&he.column.id===se)return oe.splice(ce,1)[0]}return null};return de(this.#n)}#K(se){const de=[];for(let oe=se.length-1;oe>=0;oe--){const ce=se[oe];Array.isArray(ce.columns)&&(de.push(...this.#K(ce.columns)),ce.columns.length===0&&(de.push(ce.id),se.splice(oe,1)))}return de}#Y(){const se=(de,oe,ce)=>{for(const he of de)Array.isArray(he.columns)?se(he.columns,[...oe,he.id]):he.column&&(he.column.groupPath=oe)};se(this.#n,[])}#L(se){const de=new Set(se),oe=this.#t.filter(Se=>de.has(Se));if(!oe.length)return;const ce=Math.min(...oe.map(Se=>this.#t.indexOf(Se))),he=this.#t.slice(0,ce).filter(Se=>!de.has(Se)),Oe=this.#t.slice(ce).filter(Se=>!de.has(Se));this.#t=[...he,...oe,...Oe]}#_(se){const de=[],oe=ce=>{if(Array.isArray(ce.columns))for(const he of ce.columns)oe(he);else ce.column&&de.push(ce.column.id)};return oe(se),de}#F(se){const de=oe=>{for(const ce of oe){if(!Array.isArray(ce.columns))continue;if(ce.id===se)return{node:ce,parent:oe};const he=de(ce.columns);if(he)return he}return null};return de(this.#n)}groupColumns(se,de={}){const oe=I(se).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=de.groupId?this.#F(de.groupId):null;if(de.groupId&&!ce)return U(`columns.group.unknown:${de.groupId}`,`no band "${de.groupId}" to add to; nothing was grouped.`),null;let he=null;if(!ce&&de.id!=null&&(he=String(de.id),this.#F(he)||this.#e.has(he)))return U(`columns.group.idtaken:${he}`,`band id "${he}" is already in use; nothing was grouped.`),null;const Oe=oe.map(Ce=>this.#D(Ce)).filter(Boolean);if(!Oe.length)return null;let Se;if(ce)ce.node.columns.push(...Oe),Se=ce.node.id;else{const Ce={id:he||r("grp"),title:de.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:Oe},Ie=Number.isInteger(de.at)?Math.max(0,Math.min(de.at,this.#n.length)):this.#n.length;this.#n.splice(Ie,0,Ce),Se=Ce.id}return this.#K(this.#n),this.#L(oe),this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"formed",groupId:Se,ids:oe}),Se}ungroupColumn(se){const de=this.#e.get(se);if(!de){U(`columns.ungroup.unknown:${se}`,`no column "${se}" to ungroup.`);return}const oe=de.groupPath||[];if(!oe.length)return;const ce=oe[oe.length-1],he=this.#F(ce);if(!he)return;const Oe=this.#D(se);if(!Oe)return;const Se=he.parent.indexOf(he.node);he.parent.splice(Se+1,0,Oe);const Ce=this.#K(this.#n),Ie=this.#_(he.node);if(Ie.length){this.#L(Ie);const ke=Math.max(...Ie.map(Te=>this.#t.indexOf(Te))),_e=this.#t.filter(Te=>Te!==se);_e.splice(ke+1,0,se),this.#t=_e}this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"removed",id:se,dissolved:Ce})}renameGroup(se,de){const oe=this.#F(se);if(!oe){U(`columns.group.rename:${se}`,`no band "${se}" to rename.`);return}oe.node.title=String(de??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:se,title:oe.node.title})}dissolveGroup(se){const de=this.#F(se);if(!de){U(`columns.group.dissolve:${se}`,`no band "${se}" to dissolve.`);return}const oe=de.parent.indexOf(de.node);de.parent.splice(oe,1,...de.node.columns),this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:se})}moveGroup(se,de){const oe=this.#F(se);if(!oe){U(`columns.group.move:${se}`,`no band "${se}" to move.`);return}const ce=oe.parent,he=ce.indexOf(oe.node);he!==-1&&(ce.splice(he,1),ce.splice(Math.max(0,Math.min(de,ce.length)),0,oe.node),this.#X(),this.#Y(),this.#w&&this.#w("columngroup",{action:"moved",groupId:se,to:de}))}#X(){const se=[],de=ce=>{for(const he of ce)Array.isArray(he.columns)?de(he.columns):he.column&&se.push(he.column.id)};de(this.#n);const oe=new Set(se);this.#t=[...se,...this.#t.filter(ce=>!oe.has(ce))]}groupTree(){const se=oe=>oe.map(ce=>Array.isArray(ce.columns)?{id:ce.id,title:ce.title||"",collapsible:!!ce.collapsible,openByDefault:ce.openByDefault!==!1,columns:se(ce.columns)}:ce.column?ce.column.id:null).filter(ce=>ce!==null),de=se(this.#n);return de.some(oe=>oe&&typeof oe=="object")?de:[]}applyGroupTree(se){if(!Array.isArray(se))return;const de=new Set,oe=he=>{const Oe=[];for(const Se of he)if(Se&&typeof Se=="object"&&Array.isArray(Se.columns)){const Ce=oe(Se.columns);if(!Ce.length)continue;Oe.push({id:Se.id||r("grp"),title:Se.title||"",collapsible:Se.collapsible===!0,openByDefault:Se.openByDefault!==!1,showWhen:"always",marryChildren:!1,header:{},def:{},columns:Ce})}else if(typeof Se=="string"){const Ce=this.#e.get(Se);Ce&&!de.has(Se)&&(de.add(Se),Oe.push({column:Ce,path:[]}))}return Oe},ce=oe(se);for(const he of this.#t){if(de.has(he))continue;const Oe=this.#e.get(he);Oe&&ce.push({column:Oe,path:[]})}this.#n=ce,this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"applied"})}show(se){this.#V(se,!1)}hide(se){this.#V(se,!0)}#V(se,de){const oe=[];for(const ce of I(se)){const he=this.#e.get(ce);if(he){if(de&&he.layout.lockVisible){U(`lockVisible:${ce}`,`column "${ce}" is \`layout.lockVisible\` and cannot be hidden`);continue}he.layout.hidden!==de&&(he.layout.hidden=de,oe.push(ce))}}oe.length&&this.#w&&this.#w("visible",{ids:oe,hidden:de})}pin(se,de){const oe=this.#e.get(se);oe&&(oe.layout.pin=de??null,this.#w&&this.#w("pin",{id:se,side:oe.layout.pin}))}pinMany(se){const de={};for(const[ce,he]of se){const Oe=this.#e.get(ce);Oe&&(Oe.layout.pin=he??null,de[ce]=Oe.layout.pin)}const oe=Object.keys(de);oe.length&&this.#w&&this.#w("pin",{ids:oe,pins:de})}#B(se,de){const oe=se.layout.min??0,ce=se.layout.max;let he=Math.max(oe,de);return ce!=null&&(he=Math.min(ce,he)),se.layout.width=he,se.layout.flex=0,he}resize(se,de){const oe=this.#e.get(se);if(!oe)return;if(oe.layout.resizable===!1){U(`resize:${se}`,`column "${se}" is not resizable; the resize was ignored`);return}const ce=this.#B(oe,de);this.#w&&this.#w("resize",{id:se,width:ce})}resizeMany(se){const de={};for(const[ce,he]of se){const Oe=this.#e.get(ce);if(Oe){if(Oe.layout.resizable===!1){U(`resize:${ce}`,`column "${ce}" is not resizable; the resize was ignored`);continue}de[ce]=this.#B(Oe,he)}}const oe=Object.keys(de);oe.length&&this.#w&&this.#w("resize",{ids:oe,widths:de})}}function fe(be){const se={};return be.width!=null&&(se.width=be.width),be.hidden!=null&&(se.hidden=be.hidden),be.pin!==void 0&&(se.pin=be.pin),se}function we(be){if(be===null||typeof be!="object")return be;try{return structuredClone(be)}catch{}try{return JSON.parse(JSON.stringify(be))}catch{return be}}function ve(be,se){const de=be??null,oe=se??null;if(de===oe)return!0;if(de===null||oe===null)return!1;if(typeof de!="object"||typeof oe!="object")return de===oe;try{return JSON.stringify(de)===JSON.stringify(oe)}catch{return!1}}function Re(be){const se=[],de=(ce,he,Oe)=>{const Se=[];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 Ie={id:Ce.id||r("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:[]};Ie.columns=de(Ce.columns,[...he,Ie.id],Ce.facet!==void 0?Ce.facet:Oe),Se.push(Ie)}else{const Ie={def:Ce,path:he,facet:Oe};se.push(Ie),Se.push(Ie)}}return Se},oe=de(be,[],void 0);return{leaves:se,groups:oe}}function $e(be,se,de){for(const oe of be){if(oe.columns){if($e(oe.columns,se,de))return!0;continue}if(oe.column&&oe.column.id===se)return oe.column=de,!0}return!1}}),He("packages/core/src/columns/autogroup.js",function(e,F){"use strict";Object.defineProperty(e,"AUTO_GROUP_ID",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createAutoGroupColumn",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"warnOnAbsurdGrouping",{enumerable:!0,get:function(){return q}});const E=F("packages/core/src/internal/warn.js").warnOnce,W="__lattice_group",I=240,x=.5;function Q(M){const O=M.def&&M.def.layout;return(typeof O=="number"||O&&O.width!=null||M.def&&M.def.width!=null)&&Number.isFinite(M.layout.width)?M.layout.width:null}function U(M){const O=M.def&&M.def.layout;return!!(O&&O.min!=null)||M.def&&M.def.minWidth!=null}function L(M){const{columns:O,groupBy:k}=M,b=k.map(s=>O.get(s)).filter(Boolean),a=b.length?b.map(s=>s.title||s.id).join(" > "):"Group",g=b.find(s=>Q(s)!=null),o=M.config&&M.config.autoGroupColumnWidth||(g?Q(g):I);let t=g&&U(g)?g.layout.min:120;g&&!U(g)&&(t=Math.min(t,o));const r=g&&g.layout.max!=null?g.layout.max:null;return{id:W,field:null,title:a,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:r,pin:M.config&&M.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,i){return i&&i.group?i.groupValue:null},formatValue(s,i){if(!i||!i.group)return"";if(i.grandTotal)return M.config&&M.config.grandTotalLabel||"Total";const n=b[Math.min(i.level||0,b.length-1)];return n&&typeof n.formatValue=="function"?n.formatValue(s,i):s==null?"":String(s)}}}function q(M,O,k){!M.length||k<100||O<k*x||E(`grouping.cardinality:${M.join(",")}`,`grouping by ${M.join(", ")} produced ${O} 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.`)}}),He("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 W}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return I}});const ie="__lattice_select",E=44;function W(x){const Q=x.selection||{},U=x.config&&x.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:x.config&&x.config.selectionColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,headerCheckbox:Q.headerCheckbox===!0,def:{},getValue(L,q){return q?q.selected:!1},formatValue(){return""}}}const I=W}),He("packages/core/src/columns/rownumbercolumn.js",function(e,F){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createRowNumberColumn",{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,W="__lattice_rownumber",I=40,x=9,Q=22;function U(M){const O=String(Math.max(1,Math.trunc(Math.abs(M))||1)).length;return Math.max(I,O*x+Q)}function L(M){const O=M.rowNumbers,k=O&&typeof O=="object"?O:{},b=Number.isFinite(k.start)?k.start:1,a=Number.isFinite(k.width)?k.width:U((M.maxNumber||0)+b),g=E(M.rank)?M.rank:()=>null;return{id:W,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:a,min:a,max:a,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 r=g(t);return r==null?null:r-1+b},formatValue(o){return o==null?"":String(o)}}}const q=L}),He("packages/core/src/model/detail.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_DETAIL_HEIGHT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DEFAULT_CACHE_LIMIT",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"DetailModel",{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,I=F("packages/core/src/internal/warn.js").warnOnce,x=240,Q=10;function U(M){if(!M)return null;const O=M===!0?{}:M;return O.enabled===!1?null:!E(O.rows)&&!O.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:O.render||null,config:O.config||null,rows:E(O.rows)?O.rows:null,height:O.height??x,maxHeight:O.maxHeight??null,cacheLimit:Number.isFinite(O.cacheLimit)?Math.max(0,O.cacheLimit):Q,isMaster:E(O.isMaster)?O.isMaster:null,target:O.target||null,onCreate:E(O.onCreate)?O.onCreate:null,path:typeof O.path=="string"?O.path:null}}class L{#e;#t=new Set;#n;#r=0;constructor(O){this.#e=O.config,this.#n=E(O.onChange)?O.onChange:()=>{}}get config(){return this.#e}get inline(){return!this.#e.target}isMaster(O){if(!O||O.group||O.detail)return!1;const k=this.#e.isMaster;return k?!!k(O.data,O):!0}isOpen(O){return this.#t.has(O)}keys(){return[...this.#t]}activeKey(){for(const O of this.#t)return O;return null}heightOf(O){const k=this.#e.height;return E(k)?Number(k(O))||x:k==="auto"?x:Number(k)||x}open(O){return this.#t.has(O)?!1:(this.inline||this.#t.clear(),this.#t.add(O),this.#i(),!0)}close(O){return this.#t.delete(O)?(this.#i(),!0):!1}toggle(O){return this.#t.has(O)?(this.close(O),!1):(this.open(O),!0)}closeAll(){this.#t.size&&(this.#t.clear(),this.#i())}prune(O){if(!this.#t.size||!E(O))return;let k=!1;for(const b of[...this.#t])O(b)||(this.#t.delete(b),k=!0);k&&this.#i()}signature(){return`${this.#r}`}set(O){this.#t.clear();const k=Array.isArray(O)?O:[];for(const b of this.inline?k:k.slice(0,1))this.#t.add(b);this.#i()}#i(){this.#r++,this.#n()}}const q=L}),He("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 M}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return a}}),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,W=1e-300;function I(t){if(t<.5)return Math.log(Math.PI/Math.sin(Math.PI*t))-I(1-t);const r=t-1;let s=.9999999999998099;const i=r+7.5;for(let n=0;n<ie.length;n++)s+=ie[n]/(r+n+1);return .5*Math.log(2*Math.PI)+(r+.5)*Math.log(i)-i+Math.log(s)}function x(t,r,s){const i=t+r,n=t+1,m=t-1;let c=1,l=1-i*s/n;Math.abs(l)<W&&(l=W),l=1/l;let u=l;for(let f=1;f<=300;f++){const p=2*f;let y=f*(r-f)*s/((m+p)*(t+p));l=1+y*l,Math.abs(l)<W&&(l=W),c=1+y/c,Math.abs(c)<W&&(c=W),l=1/l,u*=l*c,y=-(t+f)*(i+f)*s/((t+p)*(n+p)),l=1+y*l,Math.abs(l)<W&&(l=W),c=1+y/c,Math.abs(c)<W&&(c=W),l=1/l;const h=l*c;if(u*=h,Math.abs(h-1)<E)break}return u}function Q(t,r,s){if(!(t>0)||!(r>0)||!Number.isFinite(s))return Number.NaN;if(s<=0)return 0;if(s>=1)return 1;const i=Math.exp(I(t+r)-I(t)-I(r)+t*Math.log(s)+r*Math.log(1-s));return s<(t+1)/(t+r+2)?i*x(t,r,s)/t:1-i*x(r,t,1-s)/r}function U(t){if(!(t>0)||!(t<1))return t===0?-1/0:t===1?1/0:Number.NaN;const r=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],s=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],i=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],n=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],m=.02425;let c,l,u;t<m?(c=Math.sqrt(-2*Math.log(t)),u=(((((i[0]*c+i[1])*c+i[2])*c+i[3])*c+i[4])*c+i[5])/((((n[0]*c+n[1])*c+n[2])*c+n[3])*c+1)):t<=1-m?(c=t-.5,l=c*c,u=(((((r[0]*l+r[1])*l+r[2])*l+r[3])*l+r[4])*l+r[5])*c/(((((s[0]*l+s[1])*l+s[2])*l+s[3])*l+s[4])*l+1)):(c=Math.sqrt(-2*Math.log(1-t)),u=-(((((i[0]*c+i[1])*c+i[2])*c+i[3])*c+i[4])*c+i[5])/((((n[0]*c+n[1])*c+n[2])*c+n[3])*c+1));const p=(.5*L(-u/Math.SQRT2)-t)*Math.sqrt(2*Math.PI)*Math.exp(u*u/2);return u-p/(1+u*p/2)}function L(t){const r=Math.abs(t),s=2/(2+r),i=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,c=0,l;for(let f=n.length-1;f>0;f--)l=c,c=i*c-m+n[f],m=l;const u=s*Math.exp(-r*r+.5*(n[0]+i*c)-m);return t>=0?u:2-u}function q(t){return .5*L(-t/Math.SQRT2)}function M(t,r){if(!(r>0)||!Number.isFinite(t))return Number.NaN;const s=.5*Q(r/2,.5,r/(r+t*t));return t>0?1-s:s}function O(t,r){if(!(t>0)||!(t<1)||!(r>0))return Number.NaN;if(r>1e7)return U(t);let s=-1e4,i=1e4,n=U(t);const m=I(r/2)+I(.5)-I((r+1)/2);for(let c=0;c<60;c++){const l=M(n,r);l<t?s=n:i=n;const u=Math.exp(-((r+1)/2)*Math.log(1+n*n/r)-m)/Math.sqrt(r),f=u>0?(l-t)/u:0;if(Math.abs(f)<1e-12)break;const p=n-f;if(n=p>s&&p<i&&Number.isFinite(p)?p:(s+i)/2,i-s<1e-12)break}return n}function k(t,r){let s=t,i=1/t,n=i;for(let m=0;m<300&&(s+=1,n*=r/s,i+=n,!(Math.abs(n)<Math.abs(i)*E));m++);return i*Math.exp(-r+t*Math.log(r)-I(t))}function b(t,r){let s=r+1-t,i=1/W,n=1/s,m=n;for(let c=1;c<=300;c++){const l=-c*(c-t);s+=2,n=l*n+s,Math.abs(n)<W&&(n=W),i=s+l/i,Math.abs(i)<W&&(i=W),n=1/n;const u=n*i;if(m*=u,Math.abs(u-1)<E)break}return Math.exp(-r+t*Math.log(r)-I(t))*m}function a(t,r){return!(t>0)||!(r>=0)||!Number.isFinite(r)?Number.NaN:r===0?0:r<t+1?k(t,r):1-b(t,r)}function g(t,r){return r>0?a(r/2,t/2):Number.NaN}function o(t,r){const s=g(t,r);return Number.isNaN(s)?Number.NaN:Math.min(1,Math.max(0,1-s))}}),He("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 W}}),Object.defineProperty(e,"normalEquations",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return Q}});function ie(U){const L=U.length,q=Array.from({length:L},()=>new Array(L).fill(0));for(let M=0;M<L;M++)for(let O=0;O<=M;O++){let k=U[M][O];for(let b=0;b<O;b++)k-=q[M][b]*q[O][b];if(M===O){if(!(k>0))return null;q[M][O]=Math.sqrt(k)}else q[M][O]=k/q[O][O]}return q}function E(U,L){const q=U.length,M=new Array(q).fill(0);for(let k=0;k<q;k++){let b=L[k];for(let a=0;a<k;a++)b-=U[k][a]*M[a];M[k]=b/U[k][k]}const O=new Array(q).fill(0);for(let k=q-1;k>=0;k--){let b=M[k];for(let a=k+1;a<q;a++)b-=U[a][k]*O[a];O[k]=b/U[k][k]}return O}function W(U){const L=U.length,q=Array.from({length:L},()=>new Array(L).fill(0));for(let M=0;M<L;M++){const O=new Array(L).fill(0);O[M]=1;const k=E(U,O);for(let b=0;b<L;b++)q[b][M]=k[b]}return q}function I(U,L,q){const M=U.length,O=M?U[0].length:0,k=Array.from({length:O},()=>new Array(O).fill(0)),b=new Array(O).fill(0);for(let a=0;a<M;a++){const g=q?q[a]:1,o=U[a];for(let t=0;t<O;t++){const r=g*o[t];b[t]+=r*L[a];for(let s=t;s<O;s++)k[t][s]+=r*o[s]}}for(let a=0;a<O;a++)for(let g=0;g<a;g++)k[a][g]=k[g][a];return{xtwx:k,xtwy:b}}function x(U,L){return U.map(q=>q.reduce((M,O,k)=>M+O*L[k],0))}function Q(U,L){let q=0;for(let M=0;M<U.length;M++){let O=0;for(let k=0;k<U.length;k++)O+=L[M][k]*U[k];q+=U[M]*O}return q}}),He("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 x}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return O}}),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(a){if(!Number.isFinite(a))return;this.#e++;const g=a-this.#t;this.#t+=g/this.#e,this.#n+=g*(a-this.#t)}merge(a){if(a.#e===0)return;if(this.#e===0){this.#e=a.#e,this.#t=a.#t,this.#n=a.#n;return}const g=this.#e+a.#e,o=a.#t-this.#t;this.#t+=o*(a.#e/g),this.#n+=a.#n+o*o*(this.#e*a.#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 a=this.variance();return a===null?null:Math.sqrt(a)}stddevP(){const a=this.varianceP();return a===null?null:Math.sqrt(a)}}class E{#e=[];#t=0;#n;#r;constructor(a,g=Math.random){if(!(a>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(a),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(a){if(!Number.isFinite(a))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(a);return}const g=Math.floor(this.#r()*this.#t);g<this.#n&&(this.#e[g]=a)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let a=0;for(const g of this.#e)a+=g;return a/this.#e.length}quantile(a){const g=this.#e.length;if(!g)return null;const o=this.#e.slice().sort((i,n)=>i-n);if(g===1)return o[0];const t=(g-1)*Math.min(1,Math.max(0,a)),r=Math.floor(t),s=Math.ceil(t);return r===s?o[r]:o[r]+(t-r)*(o[s]-o[r])}}function W(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),W(o.getUint32(0)^o.getUint32(4))}const a=typeof b=="string"?b:String(b);let g=2166136261;for(let o=0;o<a.length;o++)g^=a.charCodeAt(o),g=Math.imul(g,16777619);return W(g)}class x{#e;#t;#n;constructor(a=14){const g=Math.floor(a);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(a=14){const g=1<<Math.floor(a),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 x.errorBoundFor(this.#e)}add(a){const g=I(a),o=g&this.#t-1,t=g>>>this.#e|1<<32-this.#e;let r=1,s=t;for(;(s&1)===0;)r++,s>>>=1;r>this.#n[o]&&(this.#n[o]=r)}count(){const a=this.#t,g=32-this.#e,o=new Float64Array(g+2);for(let s=0;s<a;s++)o[this.#n[s]]++;let t=a*L(1-o[g+1]/a);for(let s=g;s>=1;s--)t=.5*(t+o[s]);t+=a*U(o[0]/a);const r=Q*a*a/t;return Math.round(r)}}const Q=.5/Math.log(2);function U(b){if(b===1)return 1/0;let a=1,g=b,o;do b*=b,o=g,g+=b*a,a+=a;while(g!==o);return g}function L(b){if(b===0||b===1)return 0;let a=1,g=1-b,o;do b=Math.sqrt(b),o=g,a*=.5,g-=(1-b)**2*a;while(g!==o);return g/3}class q{#e=new Map;#t;#n=0;constructor(a){if(!(a>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(a)}errorBoundFor(a){const g=a/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=${a}, m=${this.#t})`})}get seen(){return this.#n}add(a){this.#n++;const g=this.#e.get(a);if(g){g.count++;return}if(this.#e.size<this.#t){this.#e.set(a,{count:1,error:0});return}let o,t=1/0;for(const[r,s]of this.#e)s.count<t&&(t=s.count,o=r);this.#e.delete(o),this.#e.set(a,{count:t+1,error:t})}top(a=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(a)))}}class M{#e;#t=[[]];#n=0;#r;#i;constructor(a=200,g=Math.random){this.#e=Math.max(8,Math.floor(a)),this.#r=g,this.#i=2/3}static errorBoundFor(a=200){const g=1/Math.max(8,Math.floor(a));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=${a})`})}errorBound(){return M.errorBoundFor(this.#e)}get count(){return this.#n}#s(a){const o=this.#t.length-1-a,t=Math.ceil(this.#e*this.#i**o);return Math.max(2,t)}add(a){Number.isFinite(a)&&(this.#n++,this.#t[0].push(a),this.#t[0].length>=this.#s(0)&&this.#o(0))}#o(a){const g=this.#t[a];g.sort((r,s)=>r-s),a+1>=this.#t.length&&this.#t.push([]);const o=this.#t[a+1],t=this.#r()<.5?0:1;for(let r=t;r<g.length;r+=2)o.push(g[r]);this.#t[a]=[];for(let r=0;r<this.#t.length;r++)if(this.#t[r].length>=this.#s(r)){this.#o(r);return}}#l(){const a=[];for(let g=0;g<this.#t.length;g++){const o=1<<g;for(const t of this.#t[g])a.push({v:t,w:o})}return a}quantile(a){const g=this.#l();if(!g.length)return null;g.sort((s,i)=>s.v-i.v);let o=0;for(const s of g)o+=s.w;const t=Math.min(1,Math.max(0,a))*o;let r=0;for(const s of g)if(r+=s.w,r>=t)return s.v;return g[g.length-1].v}rank(a){let g=0;for(let o=0;o<this.#t.length;o++){const t=1<<o;for(const r of this.#t[o])r<=a&&(g+=t)}return g}}const O=Object.freeze({distinct:x.errorBoundFor(14),median:M.errorBoundFor(200),p25:M.errorBoundFor(200),p75:M.errorBoundFor(200),p90:M.errorBoundFor(200),p95:M.errorBoundFor(200),p99:M.errorBoundFor(200),iqr:M.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:x,SpaceSaving:q,KLL:M,hash32:I,SKETCH_BOUNDS:O}}),He("packages/core/src/compute/statistics.js",function(e,F){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return i}}),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 c}}),Object.defineProperty(e,"herfindahl",{enumerable:!0,get:function(){return u}}),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 G}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"modifiedZOutliers",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"jarqueBera",{enumerable:!0,get:function(){return j}}),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 _}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return be}}),Object.defineProperty(e,"autocorrelations",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"spearman",{enumerable:!0,get:function(){return de}}),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 he}}),Object.defineProperty(e,"D4_N2",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"movingRanges",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"withinSigma",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return Ae}}),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,W=ie.valueReader,I=F("packages/core/src/compute/special.js"),x=I.studentTQuantile,Q=I.studentT,U=I.normalQuantile,L=I.normalCdf,q=I.chiSquareUpperTail,M=F("packages/core/src/compute/linalg.js"),O=M.cholesky,k=M.choleskySolve,b=M.choleskyInverse,a=M.normalEquations,g=M.quadForm,t=F("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,r=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"}),i=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(le){const ge=le==="sum"||le==="avg"||le==="countValues"||le==="min"||le==="max"?"maintained":Object.prototype.hasOwnProperty.call(s,le)?s[le]:null,ye=Object.prototype.hasOwnProperty.call(i,le)?i[le]:null;return{stat:le,exact:ge,approximate:ye}}function m(le,ge){const ye=ge.length,Pe=new Float64Array(ye);let Ne=0;if(le&&(le.kind==="float64"||le.kind==="int32")){const De=le.values,Ge=E(le);for(let Ve=0;Ve<ye;Ve++){const Qe=ge[Ve];if(Ge&&Ge(Qe)!==1)continue;const mt=De[Qe];Number.isNaN(mt)||(Pe[Ne++]=mt)}return Pe.subarray(0,Ne)}const ze=W(le);for(let De=0;De<ye;De++){const Ge=ze(ge[De]);if(Ge==null||Ge==="")continue;const Ve=typeof Ge=="number"?Ge:Number(Ge);Number.isFinite(Ve)&&(Pe[Ne++]=Ve)}return Pe.subarray(0,Ne)}function c(le,ge){const ye=new Map,Pe=W(le);let Ne=0;for(let ze=0;ze<ge.length;ze++){const De=Pe(ge[ze]);if(De==null||De===""||typeof De=="number"&&Number.isNaN(De))continue;const Ge=typeof De=="object"?String(De):De;ye.set(Ge,(ye.get(Ge)||0)+1),Ne++}const Le=[...ye.values()].sort((ze,De)=>De-ze);return{counts:Le,total:Ne,distinct:Le.length}}function l(le){return le.total>0?le.counts.map(ge=>ge/le.total):[]}function u(le,ge){const ye=c(le,ge);if(!ye.total)return null;let Pe=0;for(const Ne of l(ye))Pe+=Ne*Ne;return Pe}function f(le,ge){const ye=c(le,ge);if(!ye.total)return null;let Pe=0;for(const Ne of l(ye))Ne>0&&(Pe-=Ne*Math.log2(Ne));return Pe}function p(le,ge){const ye=c(le,ge);if(!ye.total||ye.distinct<2)return ye.total?1:null;let Pe=0;for(const Ne of l(ye))Ne>0&&(Pe-=Ne*Math.log2(Ne));return Pe/Math.log2(ye.distinct)}function y(le,ge,ye=3){const Pe=c(le,ge);if(!Pe.total)return null;const Ne=Math.max(1,Math.floor(ye));let Le=0;for(let ze=0;ze<Math.min(Ne,Pe.counts.length);ze++)Le+=Pe.counts[ze];return Le/Pe.total}function h(le,ge){const ye=m(le,ge),Pe=ye.length;if(!Pe)return null;const Ne=ye.slice().sort();if(Ne[0]<0)return null;let Le=0,ze=0;for(let De=0;De<Pe;De++)Le+=Ne[De],ze+=(De+1)*Ne[De];return Le===0?0:2*ze/(Pe*Le)-(Pe+1)/Pe}function d(le){let ge=0,ye=0,Pe=0;for(let Ne=0;Ne<le.length;Ne++){const Le=le[Ne];ge++;const ze=Le-ye;ye+=ze/ge,Pe+=ze*(Le-ye)}return{n:ge,mean:ye,m2:Pe}}function w(le,ge){const ye=le.length;if(!ye)return NaN;if(ye===1)return le[0];const Pe=(ye-1)*Math.min(1,Math.max(0,ge)),Ne=Math.floor(Pe),Le=Math.ceil(Pe);return Ne===Le?le[Ne]:le[Ne]+(Pe-Ne)*(le[Le]-le[Ne])}function v(le,ge){if(!le.length)return NaN;const ye=le.slice().sort();return w(ye,ge)}function P(le,ge){const ye=W(le);let Pe=0,Ne=0,Le=0;for(let ze=0;ze<ge.length;ze++){const De=ye(ge[ze]);if(De==null||De==="")continue;const Ge=String(De).toUpperCase();Ge==="PASS"?Pe++:Ge==="FAIL"?Ne++:Ge==="WARN"&&Le++}return{pass:Pe+Le,fail:Ne,warn:Le,judged:Pe+Le+Ne}}const G=Object.freeze({hhi:(le,ge)=>u(le,ge),entropy:(le,ge)=>f(le,ge),evenness:(le,ge)=>p(le,ge),top3Share:(le,ge)=>y(le,ge,3),top10Share:(le,ge)=>y(le,ge,10),gini:(le,ge)=>h(le,ge),trimmedMean:(le,ge)=>A(m(le,ge),.1),winsorizedMean:(le,ge)=>S(m(le,ge),.1),robustOutliers:(le,ge)=>R(m(le,ge),3.5),jarqueBera:(le,ge)=>j(m(le,ge)),variance:(le,ge)=>{const{n:ye,m2:Pe}=d(m(le,ge));return ye>1?Pe/(ye-1):null},varianceP:(le,ge)=>{const{n:ye,m2:Pe}=d(m(le,ge));return ye>0?Pe/ye:null},stddev:(le,ge)=>{const{n:ye,m2:Pe}=d(m(le,ge));return ye>1?Math.sqrt(Pe/(ye-1)):null},stddevP:(le,ge)=>{const{n:ye,m2:Pe}=d(m(le,ge));return ye>0?Math.sqrt(Pe/ye):null},median:(le,ge)=>{const ye=m(le,ge);return ye.length?v(ye,.5):null},percentile:(le,ge,ye)=>{const Pe=ye?ye.p:void 0;if(typeof Pe!="number"||!(Pe>=0&&Pe<=1))return null;const Ne=m(le,ge);return Ne.length?v(Ne,Pe):null},p25:(le,ge)=>{const ye=m(le,ge);return ye.length?v(ye,.25):null},p75:(le,ge)=>{const ye=m(le,ge);return ye.length?v(ye,.75):null},p90:(le,ge)=>{const ye=m(le,ge);return ye.length?v(ye,.9):null},p95:(le,ge)=>{const ye=m(le,ge);return ye.length?v(ye,.95):null},p99:(le,ge)=>{const ye=m(le,ge);return ye.length?v(ye,.99):null},iqr:(le,ge)=>{const ye=m(le,ge);if(!ye.length)return null;const Pe=ye.slice().sort();return w(Pe,.75)-w(Pe,.25)},mad:(le,ge)=>{const ye=m(le,ge);if(!ye.length)return null;const Pe=v(ye,.5),Ne=new Float64Array(ye.length);for(let Le=0;Le<ye.length;Le++)Ne[Le]=Math.abs(ye[Le]-Pe);return v(Ne,.5)},range:(le,ge)=>{const ye=m(le,ge);if(!ye.length)return null;let Pe=1/0,Ne=-1/0;for(let Le=0;Le<ye.length;Le++)ye[Le]<Pe&&(Pe=ye[Le]),ye[Le]>Ne&&(Ne=ye[Le]);return Ne-Pe},distinct:(le,ge)=>{const ye=W(le),Pe=new Set;for(let Ne=0;Ne<ge.length;Ne++){const Le=ye(ge[Ne]);Le==null||Le===""||Pe.add(Le instanceof Date?Le.getTime():Le)}return Pe.size},mode:(le,ge)=>{const ye=W(le),Pe=new Map;for(let ze=0;ze<ge.length;ze++){const De=ye(ge[ze]);if(De==null||De==="")continue;const Ge=De instanceof Date?De.getTime():De;Pe.set(Ge,(Pe.get(Ge)||0)+1)}let Ne=null,Le=1;for(const[ze,De]of Pe)De>Le&&(Le=De,Ne=ze);return Ne},skewness:(le,ge)=>{const ye=m(le,ge),{n:Pe,mean:Ne,m2:Le}=d(ye);if(Pe<3||Le<=0)return null;const ze=Math.sqrt(Le/(Pe-1));let De=0;for(let Ge=0;Ge<ye.length;Ge++)De+=((ye[Ge]-Ne)/ze)**3;return Pe/((Pe-1)*(Pe-2))*De},kurtosis:(le,ge)=>{const ye=m(le,ge),{n:Pe,mean:Ne,m2:Le}=d(ye);if(Pe<4||Le<=0)return null;const ze=Math.sqrt(Le/(Pe-1));let De=0;for(let Qe=0;Qe<ye.length;Qe++)De+=((ye[Qe]-Ne)/ze)**4;const Ge=Pe*(Pe+1)/((Pe-1)*(Pe-2)*(Pe-3)),Ve=3*(Pe-1)**2/((Pe-2)*(Pe-3));return Ge*De-Ve},geomean:(le,ge)=>{const ye=m(le,ge);if(!ye.length)return null;let Pe=0;for(let Ne=0;Ne<ye.length;Ne++){if(ye[Ne]<=0)return null;Pe+=Math.log(ye[Ne])}return Math.exp(Pe/ye.length)},harmean:(le,ge)=>{const ye=m(le,ge);if(!ye.length)return null;let Pe=0;for(let Ne=0;Ne<ye.length;Ne++){if(ye[Ne]===0)return null;Pe+=1/ye[Ne]}return ye.length/Pe},sumSquares:(le,ge)=>{const ye=m(le,ge);let Pe=0;for(let Ne=0;Ne<ye.length;Ne++)Pe+=ye[Ne]*ye[Ne];return Pe},passRate:(le,ge)=>{const{pass:ye,judged:Pe}=P(le,ge);return Pe?ye/Pe:null},failureCount:(le,ge)=>P(le,ge).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 K(le,ge,ye){const Pe=W(le),Ne=W(ge);let Le=0,ze=0;for(let De=0;De<ye.length;De++){const Ge=ye[De],Ve=Number(Pe(Ge)),Qe=Number(Ne(Ge));!Number.isFinite(Ve)||!Number.isFinite(Qe)||(Le+=Ve*Qe,ze+=Qe)}return ze===0?null:Le/ze}function H(le,ge,ye){const Pe=W(le);let Ne=null,Le=ye?-1/0:1/0;for(let ze=0;ze<ge.length;ze++){const De=ge[ze],Ge=Number(Pe(De));Number.isFinite(Ge)&&(ye?Ge>Le:Ge<Le)&&(Le=Ge,Ne=De)}return Ne}function T(le,ge,ye){const Pe=W(le),Ne=W(ge);let Le=0,ze=0,De=0,Ge=0,Ve=0,Qe=0;for(let dt=0;dt<ye.length;dt++){const jt=ye[dt],Lt=Number(Pe(jt)),At=Number(Ne(jt));!Number.isFinite(Lt)||!Number.isFinite(At)||(Le++,ze+=Lt,De+=At,Ge+=Lt*Lt,Ve+=At*At,Qe+=Lt*At)}if(Le<2)return null;const mt=Le*Qe-ze*De,Ot=Math.sqrt((Le*Ge-ze*ze)*(Le*Ve-De*De));if(Ot===0)return null;const gt=mt/Ot;return Math.max(-1,Math.min(1,gt))}function A(le,ge=.1){const ye=le.length;if(!ye)return null;const Pe=Array.from(le).sort((De,Ge)=>De-Ge),Ne=Math.floor(ye*Math.min(.49,Math.max(0,ge))),Le=Pe.slice(Ne,ye-Ne);if(!Le.length)return w(Pe,.5);let ze=0;for(const De of Le)ze+=De;return ze/Le.length}function S(le,ge=.1){const ye=le.length;if(!ye)return null;const Pe=Array.from(le).sort((Ge,Ve)=>Ge-Ve),Ne=Math.floor(ye*Math.min(.49,Math.max(0,ge))),Le=Pe[Ne],ze=Pe[ye-1-Ne];let De=0;for(const Ge of Pe)De+=Math.min(ze,Math.max(Le,Ge));return De/ye}function R(le,ge=3.5){if(!le.length)return null;const Pe=Array.from(le).sort((Ge,Ve)=>Ge-Ve),Ne=w(Pe,.5),Le=Pe.map(Ge=>Math.abs(Ge-Ne)).sort((Ge,Ve)=>Ge-Ve),ze=w(Le,.5);if(ze===0)return null;let De=0;for(const Ge of Pe)Math.abs(.6745*(Ge-Ne)/ze)>ge&&De++;return De}function j(le){const ge=le.length;if(ge<8)return null;let ye=0;for(const Ge of le)ye+=Ge;ye/=ge;let Pe=0,Ne=0,Le=0;for(const Ge of le){const Ve=Ge-ye;Pe+=Ve*Ve,Ne+=Ve*Ve*Ve,Le+=Ve*Ve*Ve*Ve}if(Pe/=ge,Ne/=ge,Le/=ge,Pe===0)return null;const ze=Ne/Pe**1.5,De=Le/(Pe*Pe)-3;return ge/6*(ze*ze+De*De/4)}function N(le,ge,ye){const Pe=[];let Ne=0;for(let Ge=0;Ge<le.length;Ge++){const Ve=Number(le[Ge]),Qe=Number(ge[Ge]);!Number.isFinite(Ve)||!Number.isFinite(Qe)||Qe<=0||(Pe.push([Ve,Qe]),Ne+=Qe)}if(!Pe.length||Ne<=0)return null;if(Pe.sort((Ge,Ve)=>Ge[0]-Ve[0]),Pe.length===1)return Pe[0][0];const Le=[];let ze=0;for(const[,Ge]of Pe)Le.push((ze+Ge/2)/Ne),ze+=Ge;const De=Math.max(0,Math.min(1,ye));if(De<=Le[0])return Pe[0][0];if(De>=Le[Le.length-1])return Pe[Pe.length-1][0];for(let Ge=1;Ge<Le.length;Ge++){if(De>Le[Ge])continue;const Ve=Le[Ge]-Le[Ge-1],Qe=Ve>0?(De-Le[Ge-1])/Ve:0;return Pe[Ge-1][0]+(Pe[Ge][0]-Pe[Ge-1][0])*Qe}return Pe[Pe.length-1][0]}function $(le,ge,ye){const Pe=W(le),Ne=W(ge),Le=new Float64Array(ye.length),ze=new Float64Array(ye.length);let De=0;for(let Ge=0;Ge<ye.length;Ge++){const Ve=ye[Ge],Qe=Number(Pe(Ve)),mt=Number(Ne(Ve));!Number.isFinite(Qe)||!Number.isFinite(mt)||(Le[De]=Qe,ze[De]=mt,De++)}return{xs:Le.subarray(0,De),ys:ze.subarray(0,De),n:De}}function _(le,ge,ye,Pe=!1){const{xs:Ne,ys:Le,n:ze}=$(le,ge,ye);if(ze<2)return null;let De=0,Ge=0;for(let Qe=0;Qe<ze;Qe++)De+=Ne[Qe],Ge+=Le[Qe];De/=ze,Ge/=ze;let Ve=0;for(let Qe=0;Qe<ze;Qe++)Ve+=(Ne[Qe]-De)*(Le[Qe]-Ge);return Ve/(Pe?ze:ze-1)}function Y(le,ge,ye){const{xs:Pe,ys:Ne,n:Le}=$(le,ge,ye);if(Le<2)return null;let ze=0,De=0;for(let Lt=0;Lt<Le;Lt++)ze+=Pe[Lt],De+=Ne[Lt];ze/=Le,De/=Le;let Ge=0,Ve=0,Qe=0;for(let Lt=0;Lt<Le;Lt++){const At=Pe[Lt]-ze,Bt=Ne[Lt]-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=Le>2?Math.sqrt(dt/(Le-2)/Ge):0;return{slope:mt,intercept:Ot,r2:gt,stdError:jt,n:Le}}const Z=new Set(["ols","wls","robust"]),J=new Set(["quantile"]),D=new Set(["ridge","lasso","elasticnet","mixed","gls"]),te=1.345;function z(le,ge,ye){const{xtwx:Pe,xtwy:Ne}=a(le,ge,ye),Le=O(Pe);if(!Le)return null;const ze=k(Le,Ne),De=b(Le),Ge=X(le,ze),Ve=ge.map((Qe,mt)=>Qe-Ge[mt]);return{beta:ze,cov:De,fitted:Ge,residuals:Ve}}function X(le,ge){return le.map(ye=>ye.reduce((Pe,Ne,Le)=>Pe+Ne*ge[Le],0))}function ne(le,ge){const ye=le.length,Pe=le.map(Ve=>Ve[ge]),Ne=le.map(Ve=>[1,...Ve.filter((Qe,mt)=>mt!==ge)]),Le=z(Ne,Pe,null);if(!Le)return 1;const ze=Pe.reduce((Ve,Qe)=>Ve+Qe,0)/ye;let De=0,Ge=0;for(let Ve=0;Ve<ye;Ve++)De+=Le.residuals[Ve]**2,Ge+=(Pe[Ve]-ze)**2;return Ge===0?1:Math.max(0,Math.min(1,1-De/Ge))}function re(le){const ge=[...le].sort((Ne,Le)=>Ne-Le),ye=ae(ge),Pe=le.map(Ne=>Math.abs(Ne-ye)).sort((Ne,Le)=>Ne-Le);return ae(Pe)/.6745}function ae(le){const ge=le.length;if(!ge)return 0;const ye=Math.floor(ge/2);return ge%2?le[ye]:(le[ye-1]+le[ye])/2}function fe(le,ge,ye={}){const Pe=ye.method||"ols";if(D.has(Pe))throw new Error(`[lattice] regression method "${Pe}" is out of scope; use ols, wls or robust.`);if(J.has(Pe))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!Z.has(Pe))throw new Error(`[lattice] unknown regression method "${Pe}"; use ols, wls or robust.`);const Ne=Array.isArray(ge)?ge.length:0,Le=Ne&&Array.isArray(le[0])?le[0].length:0,ze=Le+1;if(!(Ne>ze))return null;for(let St=0;St<Ne;St++){if(!Number.isFinite(ge[St])||!Array.isArray(le[St])||le[St].length!==Le)return null;for(let Mt=0;Mt<Le;Mt++)if(!Number.isFinite(le[St][Mt]))return null}let De=null;if(Pe==="wls"){if(De=ye.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=le.map(St=>[1,...St]);let Ve,Qe=null;if(Pe==="robust"){if(Ve=z(Ge,ge,null),!Ve)return null;for(let St=0;St<50;St++){const Mt=re(Ve.residuals);if(!(Mt>0))break;const Wt=Ve.residuals.map(_t=>{const Gt=Math.abs(_t/Mt);return Gt<=te?1:te/Gt}),Ht=z(Ge,ge,Wt);if(!Ht)return null;const zt=Ht.beta.reduce((_t,Gt,Dt)=>Math.max(_t,Math.abs(Gt-Ve.beta[Dt])),0);if(Ve=Ht,Qe=Wt,zt<1e-10)break}}else if(Ve=z(Ge,ge,De),!Ve)return null;const mt=Pe==="robust"?Qe:De,{beta:Ot,cov:gt,fitted:dt,residuals:jt}=Ve;let Lt=0,At=0,Bt=0;for(let St=0;St<Ne;St++){const Mt=mt?mt[St]:1;Lt+=Mt*jt[St]**2,At+=Mt,Bt+=Mt*ge[St]}const nn=Bt/At;let Vt=0;for(let St=0;St<Ne;St++){const Mt=mt?mt[St]:1;Vt+=Mt*(ge[St]-nn)**2}const Zt=Ne-ze,Xe=Lt/Zt,ot=Vt===0?1:Math.max(0,Math.min(1,1-Lt/Vt)),vt=1-(1-ot)*(Ne-1)/Zt,pt=Array.isArray(ye.names)&&ye.names.length===Le?ye.names:le[0].map((St,Mt)=>`x${Mt+1}`),yt=Ke(ye.confidence),We=Zt>0?x(1-(1-yt)/2,Zt):1/0,at=Ot.map((St,Mt)=>{const Wt=Math.sqrt(Math.max(0,Xe*gt[Mt][Mt])),Ht=Wt>0?St/Wt:St===0?0:1/0,zt=Number.isFinite(Ht)?2*(1-Q(Math.abs(Ht),Zt)):0,_t=Number.isFinite(We)?We*Wt:null;return{name:Mt===0?"(intercept)":pt[Mt-1],estimate:St,stdError:Wt,t:Ht,p:Math.max(0,Math.min(1,zt)),lower:_t===null?null:St-_t,upper:_t===null?null:St+_t}}),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 Ht=(1-Wt)**2;lt[St]=Ht>0&&Xe>0?jt[St]**2/(ze*Xe)*(Wt/Ht):null}const Rt=le[0].map((St,Mt)=>{if(Le<2)return 1;const Wt=ne(le,Mt);return Wt>=1?1/0:1/(1-Wt)});let xt=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 Ht=0,zt=0;for(let Qt=0;Qt<Ne;Qt++)Ht+=Mt.residuals[Qt]**2,zt+=(St[Qt]-Wt)**2;const _t=zt===0?0:Math.max(0,Math.min(1,1-Ht/zt)),Gt=Ne*_t,Dt=q(Gt,Le);xt={statistic:Gt,df:Le,p:Dt,heteroscedastic:Dt<.05}}}let bt=null;if(Le===1){const St=le.map((Mt,Wt)=>Wt).sort((Mt,Wt)=>le[Mt][0]-le[Wt][0]);bt={confidence:yt,points:St.map(Mt=>{const Wt=Ge[Mt],Ht=Math.sqrt(Math.max(0,Xe*g(Wt,gt)));return{x:le[Mt][0],yhat:dt[Mt],lower:dt[Mt]-We*Ht,upper:dt[Mt]+We*Ht}})}}return{method:Pe,coefficients:at,r2:ot,adjR2:vt,n:Ne,df:Zt,sigma2:Xe,fitted:dt,residuals:jt,leverage:rt,cooksD:lt,vif:Rt,heteroscedasticity:xt,band:bt,weights:mt?[...mt]:null}}function we(le){const ge=le.length,ye=Array.from({length:ge},(Le,ze)=>ze).sort((Le,ze)=>le[Le]-le[ze]),Pe=new Float64Array(ge);let Ne=0;for(;Ne<ge;){let Le=Ne;for(;Le+1<ge&&le[ye[Le+1]]===le[ye[Ne]];)Le++;const ze=(Ne+Le)/2+1;for(let De=Ne;De<=Le;De++)Pe[ye[De]]=ze;Ne=Le+1}return Pe}const ve=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function Re(le){const ge=[.01,.05,.1],ye=[ve["1%"],ve["5%"],ve["10%"]];if(le<=ye[0]){const Le=(Math.log(ge[1])-Math.log(ge[0]))/(ye[1]-ye[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(ge[0])+Le*(le-ye[0]))))}if(le>=ye[2]){const Le=(Math.log(ge[2])-Math.log(ge[1]))/(ye[2]-ye[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(ge[2])+Le*(le-ye[2]))))}const Pe=le<ye[1]?0:1,Ne=(le-ye[Pe])/(ye[Pe+1]-ye[Pe]);return Math.exp(Math.log(ge[Pe])+Ne*(Math.log(ge[Pe+1])-Math.log(ge[Pe])))}function $e(le,ge,ye,Pe){const Ne=ye-Pe,Le=Pe+3,ze=new Array(Ne),De=new Array(Ne);let Ge=!0,Ve=Pe;for(let dt=0;dt<Ne;dt++){const jt=Pe+dt,Lt=new Float64Array(Le);Lt[0]=1,Lt[1]=dt+1,Lt[2]=le[jt];for(let At=1;At<=Pe;At++)Lt[2+At]=ge[jt-At];for(let At=1;At<Le;At++)Number.isFinite(Lt[At])||(Ve=Math.min(Ve,At-3));ze[dt]=Lt,De[dt]=ge[jt],Number.isFinite(De[dt])||(Ge=!1)}if(!Ge)return 0;const{xtwx:Qe,xtwy:mt}=a(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 Lt=new Array(jt);for(let ot=0;ot<jt;ot++)Lt[ot]=Qe[ot].slice(0,jt);const At=O(Lt);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 be(le,ge={}){const ye=[];for(let gt=0;gt<le.length;gt++){const dt=Number(le[gt]);Number.isFinite(dt)&&ye.push(dt)}const Pe=ye.length,Ne=Pe-1;if(Pe<8||Ne<6)return null;const Le=new Array(Ne);for(let gt=0;gt<Ne;gt++)Le[gt]=ye[gt+1]-ye[gt];let ze=Number.isFinite(ge.maxlag)?Math.floor(ge.maxlag):Math.ceil(12*(Pe/100)**.25);ze=Math.max(0,Math.min(ze,Math.floor((Ne-5)/2)));const De=(gt,dt)=>{const jt=[],Lt=[];for(let At=dt;At<Ne;At++){const Bt=[At-dt+1,ye[At]];for(let nn=1;nn<=gt;nn++)Bt.push(Le[At-nn]);jt.push(Bt),Lt.push(Le[At])}return fe(jt,Lt,{method:"ols"})},Ge=$e(ye,Le,Ne,ze),Ve=De(Ge,Ge);if(!Ve||!Ve.coefficients[2])return null;const Qe=Ve.coefficients[2].t,mt=Re(Qe),Ot=Qe<ve["5%"];return{statistic:Qe,usedLag:Ge,nobs:Ne-Ge,criticalValues:{...ve},pValue:mt,pApproximate:!0,stationary:Ot,verdict:Ot?"stationary":"non-stationary",regression:"ct"}}function se(le,ge={}){const ye=[];for(let Ot=0;Ot<le.length;Ot++){const gt=Number(le[Ot]);Number.isFinite(gt)&&ye.push(gt)}const Pe=ye.length;if(Pe<3)return null;let Ne=Number.isFinite(ge.maxlag)?Math.floor(ge.maxlag):Math.min(10,Pe-1);Ne=Math.max(1,Math.min(Ne,Pe-1));let Le=0;for(const Ot of ye)Le+=Ot;Le/=Pe;const ze=ye.map(Ot=>Ot-Le);let De=0;for(const Ot of ze)De+=Ot*Ot;De/=Pe;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<Pe;dt++)gt+=ze[dt]*ze[dt-Ot];Ge[Ot]=De>0?gt/Pe/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,Lt=new Array(Ot);for(let At=1;At<Ot;At++)Lt[At-1]=Qe[At-1]-jt*Qe[Ot-1-At];Lt[Ot-1]=jt,Ve[Ot]=jt,Qe=Lt}const mt=1.96/Math.sqrt(Pe);return{acf:Ge,pacf:Ve,bounds:{upper:mt,lower:-mt},n:Pe,nlags:Ne,approximate:!0}}function de(le,ge,ye){const{xs:Pe,ys:Ne,n:Le}=$(le,ge,ye);if(Le<2)return null;const ze=we(Pe),De=we(Ne);let Ge=0,Ve=0;for(let gt=0;gt<Le;gt++)Ge+=ze[gt],Ve+=De[gt];Ge/=Le,Ve/=Le;let Qe=0,mt=0,Ot=0;for(let gt=0;gt<Le;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(le,ge,ye){const{xs:Pe,ys:Ne,n:Le}=$(le,ge,ye);if(Le<2||Le>r)return null;let ze=0,De=0,Ge=0,Ve=0;for(let Ot=0;Ot<Le;Ot++)for(let gt=Ot+1;gt<Le;gt++){const dt=Math.sign(Pe[Ot]-Pe[gt]),jt=Math.sign(Ne[Ot]-Ne[gt]),Lt=dt*jt;Lt>0?ze++:Lt<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(le,ge={}){const ye=le.length;if(ye<2)return null;const Pe=le[0],Ne=le[ye-1],Le=[];for(let At=1;At<ye;At++){const Bt=le[At-1];Bt!==0&&Le.push((le[At]-Bt)/Math.abs(Bt))}let ze=null;if(Le.length>1){let At=0;for(const nn of Le)At+=nn;At/=Le.length;let Bt=0;for(const nn of Le)Bt+=(nn-At)**2;ze=Math.sqrt(Bt/(Le.length-1))}const De=Number(ge.periodsPerYear)>0?Number(ge.periodsPerYear):null;let Ge=le[0],Ve=0,Qe=0,mt=0,Ot=0;for(let At=1;At<ye;At++){if(le[At]>Ge){Ge=le[At],Ve=At;continue}if(Ge<=0)continue;const Bt=(Ge-le[At])/Ge;Bt>Qe&&(Qe=Bt,mt=Ve,Ot=At)}let gt=null;if(ye>2){let At=0;for(let Vt=0;Vt<ye;Vt++)At+=le[Vt];At/=ye;let Bt=0,nn=0;for(let Vt=0;Vt<ye;Vt++){const Zt=le[Vt]-At;nn+=Zt*Zt,Vt>0&&(Bt+=Zt*(le[Vt-1]-At))}gt=nn>0?Bt/nn:null}let dt=0,jt=0;for(const At of Le)At>0?dt++:At<0&&jt++;let Lt=null;if(Pe>0&&Ne>0){const At=(Ne/Pe)**(1/(ye-1))-1;Lt=De?(1+At)**De-1:At}return{n:ye,first:Pe,last:Ne,change:Ne-Pe,changePercent:Pe===0?null:(Ne-Pe)/Math.abs(Pe)*100,volatility:ze,annualisedVolatility:ze!==null&&De?ze*Math.sqrt(De):null,growth:Lt,maxDrawdown:Qe,maxDrawdownFrom:mt,maxDrawdownTo:Ot,autocorrelation:gt,upDays:dt,downDays:jt}}const he=1.128,Oe=3.267;function Se(le){const ge=le.length;if(ge<2)return null;const ye=[];for(let Ne=1;Ne<ge;Ne++)ye.push(Math.abs(le[Ne]-le[Ne-1]));const Pe=ye.reduce((Ne,Le)=>Ne+Le,0)/ye.length;return{ranges:ye,centre:Pe,upper:Oe*Pe,lower:0}}function Ce(le){const ge=le.length;if(ge<2)return null;let ye=0;for(let Ne=1;Ne<ge;Ne++)ye+=Math.abs(le[Ne]-le[Ne-1]);const Pe=ye/(ge-1);return{sigma:Pe/he,meanRange:Pe}}function Ie(le,ge){const ye=le.length;if(ye<2||!ge)return null;const Pe=Number.isFinite(Number(ge.lower))?Number(ge.lower):null,Ne=Number.isFinite(Number(ge.upper))?Number(ge.upper):null;if(Pe===null&&Ne===null)return null;let Le=0;for(let dt=0;dt<ye;dt++)Le+=le[dt];Le/=ye;let ze=0;for(let dt=0;dt<ye;dt++)ze+=(le[dt]-Le)**2;const De=Math.sqrt(ze/(ye-1)),Ge=Ce(le),Ve=Ge?Ge.sigma:null,Qe=dt=>{if(!dt||dt<=0)return{index:null,k:null};const Lt=Pe!==null&&Ne!==null?(Ne-Pe)/(6*dt):null,At=Ne!==null?(Ne-Le)/(3*dt):1/0,Bt=Pe!==null?(Le-Pe)/(3*dt):1/0;return{index:Lt,k:Math.min(At,Bt)}},mt=Qe(Ve),Ot=Qe(De);let gt=0;for(let dt=0;dt<ye;dt++){if(Pe!==null&&le[dt]<Pe){gt++;continue}Ne!==null&&le[dt]>Ne&>++}return{n:ye,mean:Le,lower:Pe,upper:Ne,target:Number.isFinite(Number(ge.target))?Number(ge.target):null,sigmaWithin:Ve,sigmaOverall:De,cp:mt.index,cpk:mt.k,pp:Ot.index,ppk:Ot.k,outOfSpec:gt,defectRate:ye?gt/ye:null}}function ke(le){const ge=le.length;if(ge<2)return null;const ye=Ce(le);if(!ye||!(ye.sigma>0))return null;let Pe=0;for(let Ne=0;Ne<ge;Ne++)Pe+=le[Ne];return Pe/=ge,{centre:Pe,sigma:ye.sigma,upper:Pe+3*ye.sigma,lower:Pe-3*ye.sigma}}function _e(le,ge){if(!ge||!(ge.sigma>0))return[];const ye=le.length,{centre:Pe,sigma:Ne}=ge,Le=De=>(le[De]-Pe)/Ne,ze=[];for(let De=0;De<ye;De++){if(Math.abs(Le(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++)Le(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++)Le(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(Le(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(le,ge){if(!ge||!(ge.sigma>0))return[];const ye=le.length,{centre:Pe,sigma:Ne}=ge,Le=Ge=>(le[Ge]-Pe)/Ne,ze=(Ge,Ve,Qe,mt)=>{for(const Ot of[1,-1]){let gt=0;for(let dt=Ge;dt<=Ve;dt++)Le(dt)*Ot>Qe&>++;if(gt>=mt)return!0}return!1},De=[];for(let Ge=0;Ge<ye;Ge++){if(Math.abs(Le(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(Le(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((le[mt]-le[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=le[Qe]-le[Qe-1],Ot=le[Qe+1<=Ge?Qe+1:Qe]-le[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(Le(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(Le(Qe))<=1){Ve=!1;break}Ve&&De.push({index:Ge,rule:8,description:"eight beyond one sigma"})}}return De}const je=Object.freeze(["westernElectric","nelson"]);function Ae(le,ge,ye="westernElectric"){return String(ye)==="nelson"?Te(le,ge):_e(le,ge)}function Ee(le,ge,ye){let Pe=0;for(let Ne=0;Ne<le.length;Ne++)(le[Ne]<ge||le[Ne]>ye)&&Pe++;return Pe}function Me(le,ge,ye,Pe=20){const Ne=le.length;if(!Ne)return[];const Le=le[0],ze=le[Ne-1];if(ze===Le)return[{from:Le,to:ze,count:Ne}];const De=ye-ge,Ge=1.5*De;let Ve=De>0?Math.max(Le,ge-Ge):Le,Qe=De>0?Math.min(ze,ye+Ge):ze;Qe>Ve||(Ve=Le,Qe=ze);const mt=De>0?2*De/Math.cbrt(Ne):(Qe-Ve)/(Math.ceil(Math.log2(Ne))+1),Ot=mt>0?Math.min(Pe,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 Lt=Math.min(Ot-1,Math.max(0,Math.floor((le[jt]-Ve)/gt)));dt[Lt].count++}return dt[0].from=Le,dt[Ot-1].to=ze,dt}const Be=.95;function Ke(le){const ge=Number(le);return Number.isFinite(ge)&&ge>0&&ge<1?ge:Be}function et(le,ge=Be){const ye=le.length;if(ye<2)return null;let Pe=0;for(let Qe=0;Qe<ye;Qe++)Pe+=le[Qe];const Ne=Pe/ye;let Le=0;for(let Qe=0;Qe<ye;Qe++){const mt=le[Qe]-Ne;Le+=mt*mt}const ze=Math.sqrt(Le/(ye-1)),De=Ke(ge),Ve=x(1-(1-De)/2,ye-1)*ze/Math.sqrt(ye);return{mean:Ne,lower:Ne-Ve,upper:Ne+Ve,margin:Ve,n:ye,confidence:De}}function Je(le,ge,ye=Be){const Pe=Number(le),Ne=Number(ge);if(!(Ne>0)||!(Pe>=0)||Pe>Ne)return null;const Le=Ke(ye),ze=U(1-(1-Le)/2),De=Pe/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:Le}}function ut(le,ge=Be){if(!le||!(le.n>2)||!Number.isFinite(le.stdError))return null;const ye=Ke(ge),Ne=x(1-(1-ye)/2,le.n-2)*le.stdError;return{slope:le.slope,lower:le.slope-Ne,upper:le.slope+Ne,margin:Ne,confidence:ye}}function Ct(le,ge,ye=Be){const Pe=Number(le),Ne=Number(ge);if(!Number.isFinite(Pe)||!(Ne>1))return null;const Le=Ke(ye),De=U(1-(1-Le)/2)*Math.sqrt(1/(9*Ne)+Pe*Pe/(2*(Ne-1)));return{index:Pe,lower:Pe-De,upper:Pe+De,margin:De,n:Ne,confidence:Le}}function Nt(le,ge){return!le||!(le.sd>0)||!Number.isFinite(ge)||!Number.isFinite(le.mean)?null:(ge-le.mean)/le.sd}function st(le){return Number.isFinite(le)?Math.min(1,Math.max(0,2*L(Math.abs(le)/2)-1)):0}function it(le,ge){const ye=new Map,Pe=W(le);let Ne=0;for(let Le=0;Le<ge.length;Le++){const ze=Pe(ge[Le]);if(ze==null||ze===""||typeof ze=="number"&&Number.isNaN(ze))continue;const De=ze instanceof Date?ze.getTime():typeof ze=="object"?String(ze):ze;ye.set(De,(ye.get(De)||0)+1),Ne++}return{map:ye,total:Ne}}function ct(le,ge,ye,Pe){if(!(ge>0)||!(Pe>0))return null;let Ne=0;const Le=new Set(le.keys());for(const ze of ye.keys())Le.add(ze);for(const ze of Le){const De=(le.get(ze)||0)/ge,Ge=(ye.get(ze)||0)/Pe;Ne+=Math.abs(De-Ge)}return Ne/2}const Tt=10;function $t(le,ge,ye){if(ye&&ye.numeric){const De=m(le,ge),{n:Ge,mean:Ve}=d(De),Qe=Ge>0?Nt({mean:ye.mean,sd:ye.sd},Ve):null;return{measure:"standardizedMeanDifference",magnitude:Qe,distance:Qe===null?0:st(Qe),direction:Qe===null?0:Math.sign(Qe),subsetN:Ge,populationN:ye.n||0,reliable:Ge>=Tt}}const{map:Ne,total:Le}=it(le,ge),ze=ct(Ne,Le,ye.map,ye.total);return{measure:"categoricalTotalVariation",magnitude:ze,distance:ze===null?0:ze,direction:0,subsetN:Le,populationN:ye.total||0,reliable:Le>=Tt}}function It(le,ge){if(le&&(le.kind==="float64"||le.kind==="int32"))return!0;const ye=W(le);let Pe=0,Ne=0;for(let Le=0;Le<ge.length&&Pe<200;Le++){const ze=ye(ge[Le]);if(ze==null||ze==="")continue;if(ze instanceof Date)return!1;Pe++;const De=typeof ze=="number"?ze:Number(ze);Number.isFinite(De)&&Ne++}return Pe===0?!1:Ne/Pe>=.9}function ft(le,ge){if(It(le,ge)){const Ne=m(le,ge),{n:Le,mean:ze,m2:De}=d(Ne);return{numeric:!0,mean:ze,sd:Le>0?Math.sqrt(De/Le):0,n:Le}}const{map:ye,total:Pe}=it(le,ge);return{numeric:!1,map:ye,total:Pe}}}),He("packages/core/src/compute/total.js",function(e,F){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return u}}),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,x=F("packages/core/src/compute/handle.js"),Q=x.presenceReader,U=x.valueComparator,L=x.valueReader,q=F("packages/core/src/compute/statistics.js"),M=q.STAT_FNS,O=q.STAT_LABELS;function k(w){return!!w&&(w.kind==="float64"||w.kind==="int32")}function b(w,v){const P=v.length;let G=0;if(k(w)){const K=w.values,H=Q(w);if(!H){for(let T=0;T<P;T++){const A=K[v[T]];Number.isNaN(A)||(G+=A)}return G}for(let T=0;T<P;T++){const A=v[T];if(H(A)===1){const S=K[A];Number.isNaN(S)||(G+=S)}}return G}const V=L(w);for(let K=0;K<P;K++){const H=m(V(v[K]));H!==null&&(G+=H)}return G}b.kernel=!0;function a(w,v){const P=v.length;let G=0;if(k(w)){const K=w.values,H=Q(w);if(!H){for(let T=0;T<P;T++)Number.isNaN(K[v[T]])||G++;return G}for(let T=0;T<P;T++){const A=v[T];H(A)===1&&!Number.isNaN(K[A])&&G++}return G}const V=L(w);for(let K=0;K<P;K++){const H=V(v[K]);H!=null&&!(typeof H=="number"&&Number.isNaN(H))&&G++}return G}a.kernel=!0;function g(w,v){return v.length}g.kernel=!0;function o(w,v){const P=a(w,v);return P===0?null:b(w,v)/P}o.kernel=!0;function t(w,v,P,G){const V=v.length;if(k(w)){const A=w.values,S=Q(w);let R=null;if(!S){for(let j=0;j<V;j++){const N=A[v[j]];Number.isNaN(N)||(R===null||(P<0?N<R:N>R))&&(R=N)}return R}for(let j=0;j<V;j++){const N=v[j];if(S(N)===0)continue;const $=A[N];Number.isNaN($)||(R===null||(P<0?$<R:$>R))&&(R=$)}return R}const K=L(w),H=U(G);let T=null;for(let A=0;A<V;A++){const S=K(v[A]);S==null||typeof S=="number"&&Number.isNaN(S)||(T===null||(P<0?H(S,T)<0:H(S,T)>0))&&(T=S)}return T}function r(w,v,P){return t(w,v,-1,P&&P.locale)}r.kernel=!0;function s(w,v,P){return t(w,v,1,P&&P.locale)}s.kernel=!0;function i(w,v){return v.length===0?null:L(w)(v[0])}i.kernel=!0;function n(w,v){return v.length===0?null:L(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 c={sum:b,min:r,max:s,avg:o,count:g,first:i,last:n,countValues:a,...M},l=Object.freeze({...O,sum:"Sum",avg:"Average",min:"Min",max:"Max",count:"Count",countValues:"Count of values",first:"First",last:"Last"});function u(w){return w?typeof w=="string"?l[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(G=>G in c);for(const G of Object.keys(c))P.includes(G)||P.push(G);return P}function y(w,v){return typeof v!="string"?!0:p(w).includes(v)}function h(w,v){const P=L(w),G=[];for(let V=0;V<v.length;V++){const K=P(v[V]);K!=null&&G.push(K)}return G}function d(w,v,P,G){const V=v||[];if(P&&typeof P=="object"&&typeof P.fn=="string"){const{fn:K,...H}=P,T=c[K];return T?T(w,V,{...G,...H}):(I(`total:${K}`,`unknown total function "${K}"; register it in config.totalFns`),null)}if(typeof P=="string"){const K=c[P];return K?K(w,V,G):(I(`total:${P}`,`unknown total function "${P}"; register it in config.totalFns`),null)}return E(P)?P.kernel===!0?P(w,V,G):P(h(w,V),G||{}):null}}),He("packages/core/src/compute/windowed.js",function(e,F){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Q}});const E=F("packages/core/src/compute/sketch.js").Welford;class W{#e;#t;#n=[];#r;#i;constructor(L,q=0,M=Date.now){if(L!=="count"&&L!=="time"&&L!=="session")throw new RangeError(`unknown window kind: ${L}`);if((L==="count"||L==="time")&&!(q>0))throw new RangeError(`a ${L} window needs a positive span`);this.#e=L,this.#t=Math.floor(q),this.#r=M,this.#i=M()}get size(){return this.#n.length}push(L,q=this.#r()){Number.isFinite(L)&&(this.#n.push({t:q,v:L}),this.#s(q))}#s(L){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const q=L-this.#t;for(;this.#n.length&&this.#n[0].t<q;)this.#n.shift()}}spec(){const L=this.#e==="session"?this.#r()-this.#i:this.#t;return{kind:this.#e,span:L,size:this.#n.length}}values(){return this.#n.map(L=>L.v)}aggregate(){const L=this.spec();if(!this.#n.length)return{over:L,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const q=new E;let M=0,O=1/0,k=-1/0;for(const{v:b}of this.#n)M+=b,b<O&&(O=b),b>k&&(k=b),q.add(b);return{over:L,count:this.#n.length,sum:M,mean:q.mean(),min:O,max:k,variance:q.variance(),stddev:q.stddev()}}reduce(L){const q=this.aggregate(),M={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(!(L in M))throw new RangeError(`unknown windowed aggregate: ${L}`);return{value:M[L],over:q.over}}}const I=Object.freeze(["count","time","session"]);function x(U,L=Date.now){const q=U.kind==="time"&&U.minutes!=null?U.minutes*6e4:U.span??0;return new W(U.kind,q,L)}const Q={Window:W,WINDOW_KINDS:I,openWindow:x}}),He("packages/core/src/compute/rolling.js",function(e,F){"use strict";Object.defineProperty(e,"ROLLING_WINDOW_FIELDS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"rollingWindow",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return M}}),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,x=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function Q(c,l,u,f){if(c.kind==="count"){const p=Math.max(1,Math.floor(c.span||0));return{coverage:Math.min(1,l/p),partial:l<p}}if(c.kind==="time"){const p=c.minutes!=null?c.minutes*6e4:c.span||0;if(!(p>0))return{coverage:1,partial:!1};const y=u-f;return{coverage:Math.min(1,y/p),partial:y<p}}return{coverage:null,partial:!1}}function U(c,l){const u=E(l),f=new Map,p=c.length?c[0].at:0;for(let y=0;y<c.length;y++){const{key:h,at:d,value:w}=c[y];Number.isFinite(w)&&u.push(w,d);const v=u.aggregate(),P=Q(l,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 L(c){const l=new Map;let u=0;for(const{key:f,value:p}of c)Number.isFinite(p)&&(u+=p),f!=null&&l.set(String(f),u);return l}function q(c,l=1){const u=new Map,f=Math.max(1,Math.floor(l));for(let p=0;p<c.length;p++){const{key:y,value:h}=c[p];if(y==null)continue;const d=p>=f?c[p-f].value:null,w=Number.isFinite(h)?h:null,v=Number.isFinite(d)?d:null;u.set(String(y),w!==null&&v!==null?w-v:null)}return u}const M=4096;function O(c){let l=c>>>0;return()=>{l+=1831565813;let u=l;return u=Math.imul(u^u>>>15,u|1),u^=u+Math.imul(u^u>>>7,u|61),((u^u>>>14)>>>0)/4294967296}}function k(c,l){const u=c.length;if(u===1)return c[0];const f=(u-1)*l,p=Math.floor(f),y=Math.ceil(f);return p===y?c[p]:c[p]+(f-p)*(c[y]-c[p])}function b(c,l,u={}){const f=Math.min(1,Math.max(0,u.q==null?.5:u.q)),p=Math.max(1,Math.floor(u.cap==null?M:u.cap)),y=O(u.seed==null?2654435769:u.seed),h=new Map,d=c.length?c[0].at:0;if(l.kind==="session"){const v=new I(200,y);let P=0;for(const{key:G,value:V}of c)Number.isFinite(V)&&(v.add(V),P++),G!=null&&h.set(String(G),{value:P?v.quantile(f):null,approx:P>0,count:P,coverage:null,partial:!1});return h}const w=E(l);for(const{key:v,at:P,value:G}of c){Number.isFinite(G)&&w.push(G,P);const V=w.values(),K=V.length;let H=null,T=!1;if(K)if(K<=p)H=k([...V].sort((S,R)=>S-R),f);else{const S=new I(200,y);for(const R of V)S.add(R);H=S.quantile(f),T=!0}const A=Q(l,K,P,d);v!=null&&h.set(String(v),{value:H,approx:T,count:K,coverage:A.coverage,partial:A.partial})}return h}function a(c,l){const u=c.length,f=new Array(u).fill(null),p=Math.floor(l/2),y=l%2===0;for(let h=0;h<u;h++){if(h-p<0||h+p>=u)continue;let d=0,w=!0;if(y)for(let v=-p;v<=p;v++){const P=c[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=c[h+v];if(!Number.isFinite(P)){w=!1;break}d+=P}w&&(f[h]=d/l)}return f}function g(c,l){const u=new Map,f=Math.floor(Number(l&&l.period));if(!(f>=2))return u;const p=l&&l.model==="multiplicative",y=c.length,h=c.map(T=>Number.isFinite(T.value)?T.value:null),d=a(h,f),w=new Array(y).fill(null);for(let T=0;T<y;T++){const A=d[T],S=h[T];A===null||S===null||(p?A!==0&&(w[T]=S/A):w[T]=S-A)}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 A=T%f;v[A]+=w[T],P[A]+=1}const G=p?1:0,V=v.map((T,A)=>P[A]?T/P[A]:G),K=V.reduce((T,A)=>T+A,0)/f,H=p?V.map(T=>K!==0?T/K:1):V.map(T=>T-K);for(let T=0;T<y;T++){const{key:A}=c[T];if(A==null)continue;const S=d[T],R=H[T%f],j=h[T];let N=null;S!==null&&j!==null&&(N=p?S*R!==0?j/(S*R):null:j-S-R),u.set(String(A),{trend:S,seasonal:j===null?null:R,residual:N,coverage:S===null?0:1,partial:S===null})}return u}function o(c,l,u,f=80){const p=(Math.sqrt(5)-1)/2;let y=l,h=u,d=h-p*(h-y),w=y+p*(h-y),v=c(d),P=c(w);for(let G=0;G<f;G++)v<P?(h=w,w=d,P=v,d=h-p*(h-y),v=c(d)):(y=d,d=w,v=P,w=y+p*(h-y),P=c(w));return(y+h)/2}const t=1e-4,r=1-1e-4;function s(c,l){const u=c.length,f=new Array(u).fill(null),p=new Array(u).fill(null);let y=null,h=0;for(let d=0;d<u;d++){const w=c[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=l*w+(1-l)*y,f[d]=y}return{smoothed:f,fitted:p,sse:h}}function i(c,l,u){const f=c.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=c[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 K=h+d;y[v]=K,w+=(P-K)**2;const H=h;h=l*P+(1-l)*(H+d),d=u*(h-H)+(1-u)*d,p[v]=h;continue}const G=h+d;y[v]=G,w+=(P-G)**2;const V=h;h=l*P+(1-l)*(V+d),d=u*(h-V)+(1-u)*d,p[v]=h}return{smoothed:p,fitted:y,sse:w}}function n(c,l={}){const u=new Map,f=l.method==="holt",p=c.map(G=>Number.isFinite(G.value)?G.value:null),y=p.filter(G=>G!==null).length,h=G=>Math.min(r,Math.max(t,G)),d=()=>{for(const{key:G}of c)G!=null&&u.set(String(G),{smoothed:null,fitted:null,alpha:null,beta:null,sse:null});return u};if(y<(f?2:1))return d();let w=Number.isFinite(l.alpha)?h(l.alpha):null,v=f&&Number.isFinite(l.beta)?h(l.beta):null;if(f){if(w===null||v===null){let G=w===null?.5:w,V=v===null?.5:v;for(let K=0;K<6;K++)w===null&&(G=o(H=>i(p,H,V).sse,t,r)),v===null&&(V=o(H=>i(p,G,H).sse,t,r));w=w===null?G:w,v=v===null?V:v}}else w===null&&(w=o(G=>s(p,G).sse,t,r));const P=f?i(p,w,v):s(p,w);for(let G=0;G<c.length;G++){const{key:V}=c[G];V!=null&&u.set(String(V),{smoothed:P.smoothed[G],fitted:P.fitted[G],alpha:w,beta:f?v:null,sse:P.sse})}return u}const m={ROLLING_WINDOW_FIELDS:x,QUANTILE_SPAN_CAP:M,rollingWindow:U,rollingQuantile:b,cumulativeToDate:L,periodOverPeriod:q,seasonalDecompose:g,exponentialSmoothing:n}}),He("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 W}}),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 a}}),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,W=3,I=5,x=100;function Q(r){let s=r>>>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(r,s){let i=0;for(let n=0;n<r.length;n++){const m=r[n]-s[n];i+=m*m}return i}function L(r,s){return Math.sqrt(U(r,s))}function q(r,s){let i=-1,n=1/0;for(let m=0;m<s.length;m++){const c=U(r,s[m]);c<n&&(n=c,i=m)}return i}function M(r,s,i){const n=Q(i),m=r.length,c=[Array.from(r[Math.floor(n()*m)])],l=new Float64Array(m).fill(1/0);for(let u=1;u<s;u++){let f=0;for(let d=0;d<m;d++){const w=U(r[d],c[c.length-1]);w<l[d]&&(l[d]=w),f+=l[d]}const p=n()*(f||m);let y=0,h=m-1;for(let d=0;d<m;d++)if(y+=f?l[d]:1,y>=p){h=d;break}c.push(Array.from(r[h]))}return c}function O(r,s){for(let i=0;i<r.length;i++){const n=r[i]-s[i];if(n!==0)return n}return 0}function k(r,s,i,n){const m=s.map((l,u)=>({centre:l,i:u})).sort((l,u)=>O(l.centre,u.centre)),c=new Int32Array(s.length);for(let l=0;l<m.length;l++)c[m[l].i]=l;for(let l=0;l<r.length;l++)r[l]>=0&&(r[l]=c[r[l]]);return{assignments:r,centres:m.map(l=>l.centre),sizes:m.map(l=>i[l.i]),distances:n}}function b(r,s={}){const i=r.length,n=i?r[0].length:0,m=Math.floor(s.k||W);if(!(i>=m)||m<1||n<1)return null;let c=M(r,m,s.seed===void 0?1:s.seed);const l=new Int32Array(i);let u=!0;for(let h=0;h<x&&u;h++){u=!1;for(let v=0;v<i;v++){const P=q(r[v],c);l[v]!==P&&(l[v]=P,u=!0)}const d=c.map(()=>new Float64Array(n)),w=new Array(m).fill(0);for(let v=0;v<i;v++){const P=l[v];for(let G=0;G<n;G++)d[P][G]+=r[v][G];w[P]++}for(let v=0;v<m;v++)if(w[v])for(let P=0;P<n;P++)c[v][P]=d[v][P]/w[v];else{let P=0,G=-1/0;for(let V=0;V<i;V++){const K=U(r[V],c[v]);K>G&&(G=K,P=V)}c[v]=Array.from(r[P]),u=!0}}const f=new Array(m).fill(0),p=new Float64Array(i);let y=0;for(let h=0;h<i;h++){const d=l[h];f[d]++;const w=U(r[h],c[d]);p[h]=Math.sqrt(w),y+=w}return{assignments:l,centres:c,sizes:f,inertia:y,distances:p}}function a(r,s={}){const i=r.length,n=i?r[0].length:0,m=Number(s.eps),c=Math.max(1,Math.floor(s.minPoints||I));if(!(m>0)||i===0||n<1)return null;const l=new Array(i);for(let w=0;w<i;w++){const v=[];for(let P=0;P<i;P++)w!==P&&L(r[w],r[P])<=m&&v.push(P);l[w]=v}const u=new Int32Array(i).fill(-1);let f=0;for(let w=0;w<i;w++){if(u[w]!==-1||l[w].length<c)continue;u[w]=f;const v=[...l[w]];for(let P=0;P<v.length;P++){const G=v[P];u[G]===-1&&(u[G]=f,l[G].length>=c&&v.push(...l[G]))}f++}if(!f)return{assignments:u,centres:[],sizes:[],distances:new Float64Array(i).fill(NaN)};const p=[],y=new Array(f).fill(0),h=Array.from({length:f},()=>new Float64Array(n));for(let w=0;w<i;w++){const v=u[w];if(!(v<0)){y[v]++;for(let P=0;P<n;P++)h[v][P]+=r[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(i).fill(NaN);for(let w=0;w<i;w++){const v=u[w];v>=0&&(d[w]=L(r[w],p[v]))}return{assignments:u,centres:p,sizes:y,distances:d}}function g(r,s,i){const n=r.length;if(n===0)return 0;const m=new Int32Array(i);for(let l=0;l<n;l++)m[s[l]]++;let c=0;for(let l=0;l<n;l++){const u=s[l],f=new Float64Array(i);for(let h=0;h<n;h++)l!==h&&(f[s[h]]+=L(r[l],r[h]));const p=m[u]>1?f[u]/(m[u]-1):0;let y=1/0;for(let h=0;h<i;h++){if(h===u||m[h]===0)continue;const d=f[h]/m[h];d<y&&(y=d)}y!==1/0&&(c+=(y-p)/Math.max(p,y))}return c/n}function o(r,s={}){const i=r.length;if(!i)return null;const n=s.criterion==="silhouette"?"silhouette":"elbow",m=Math.max(2,Math.floor(s.maxK||8)),c=s.seed===void 0?1:s.seed;if(n==="silhouette"){const w=[],v=[];for(let G=2;G<=Math.min(m,i);G++){const V=b(r,{k:G,seed:c});V&&(w.push(G),v.push(g(r,V.assignments,G)))}if(!w.length)return null;let P=0;for(let G=1;G<v.length;G++)v[G]>v[P]&&(P=G);return{k:w[P],criterion:n,scores:v,ks:w}}const l=[],u=[];for(let w=1;w<=Math.min(m,i);w++){const v=b(r,{k:w,seed:c});v&&(l.push(w),u.push(v.inertia))}if(u.length<2)return null;const f={k:l[0],y:u[0]},p={k:l[l.length-1],y:u[u.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<u.length;w++){const v=Math.abs((p.k-f.k)*(f.y-u[w])-(f.k-l[w])*(p.y-f.y))/y;v>d&&(d=v,h=w)}return{k:l[h],criterion:n,scores:u,ks:l}}function t(r){const s=r.length,i=s?r[0].length:0;if(!s||!i)return null;const n=new Array(i).fill(0);for(let c=0;c<s;c++)for(let l=0;l<i;l++)n[l]+=r[c][l];for(let c=0;c<i;c++)n[c]/=s;const m=new Array(i).fill(0);for(let c=0;c<s;c++)for(let l=0;l<i;l++){const u=r[c][l]-n[l];m[l]+=u*u}for(let c=0;c<i;c++)m[c]=s>1?Math.sqrt(m[c]/(s-1)):0;for(let c=0;c<s;c++)for(let l=0;l<i;l++)m[l]>0?r[c][l]=(r[c][l]-n[l])/m[l]:r[c][l]=r[c][l]-n[l];return{mean:n,sd:m}}}),He("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 M}}),Object.defineProperty(e,"numericSummary",{enumerable:!0,get:function(){return O}}),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 a}});const ie=F("packages/core/src/compute/statistics.js"),E=ie.numbers,W=ie.moments,I=ie.frequencyMap,x=ie.categoricalDistance,Q=ie.normalTotalVariation,U=ie.isNumericColumn,L=ie.SUBSET_RELIABILITY_FLOOR,q=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function M(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 O(g,o){const t=E(g,o),{n:r,mean:s,m2:i}=W(t),n=r>0?Math.sqrt(i/r):0;return{mean:s,sd:n,n:r}}function k(g,o,t,r){return U(g,o)&&U(t,r)}function b(g,o,t,r){if(k(g,o,t,r)){const m=O(g,o),c=O(t,r),l=M(m,c);return{measure:q.numeric,magnitude:l,distance:l===null?0:Q(l),direction:l===null?0:Math.sign(l),nA:m.n,nB:c.n,meanA:m.mean,meanB:c.mean,reliable:m.n>=L&&c.n>=L}}const s=I(g,o),i=I(t,r),n=x(s.map,s.total,i.map,i.total);return{measure:q.categorical,magnitude:n,distance:n===null?0:n,direction:0,nA:s.total,nB:i.total,meanA:null,meanB:null,reliable:s.total>=L&&i.total>=L}}function a(g,o,t={}){const r=new Set(g.columns),s=new Set(o.columns),i=g.columns.filter(u=>s.has(u)),n=Array.isArray(t.columns)&&t.columns.length?i.filter(u=>t.columns.includes(u)):i,m=g.indices(),c=o.indices(),l=[];for(const u of n){const f=g.handle(u),p=o.handle(u);if(!f||!p)continue;const y=b(f,m,p,c);l.push({column:u,name:g.name&&g.name(u)||o.name&&o.name(u)||u,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 l.sort((u,f)=>f.distance-u.distance||Math.abs(f.magnitude||0)-Math.abs(u.magnitude||0)),{ranked:l,nA:m.length,nB:c.length,unmatched:{onlyA:g.columns.filter(u=>!s.has(u)),onlyB:o.columns.filter(u=>!r.has(u))},measures:q}}}),He("packages/core/src/compute/anomaly.js",function(e,F){"use strict";Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DEFAULT_MODIFIED_Z_THRESHOLD",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return i}}),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,x=.6745,Q=3.5,U=1.5,L=.975,q=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function M(c){if(!c.length)return null;const u=Array.from(c,Number).sort((h,d)=>h-d),f=E(u,.5),p=u.map(h=>Math.abs(h-f)).sort((h,d)=>h-d),y=E(p,.5);return{median:f,mad:y}}function O(c,l={}){const u=Number.isFinite(l.threshold)?l.threshold:Q,f=c.length,p=new Array(f).fill(null),y=new Array(f).fill(!1),h=[];for(let v=0;v<f;v++){const P=Number(c[v]);Number.isFinite(P)&&h.push(P)}if(!h.length)return{median:null,mad:null,threshold:u,scores:p,flags:y,flagged:0};const d=M(h);if(d.mad===0)return{median:d.median,mad:0,threshold:u,scores:p,flags:y,flagged:0};let w=0;for(let v=0;v<f;v++){const P=Number(c[v]);if(!Number.isFinite(P))continue;const G=x*(P-d.median)/d.mad;p[v]=G,Math.abs(G)>u&&(y[v]=!0,w++)}return{median:d.median,mad:d.mad,threshold:u,scores:p,flags:y,flagged:w}}function k(c,l={}){const u=Number.isFinite(l.k)?l.k:U,f=[];for(let w=0;w<c.length;w++){const v=Number(c[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-u*d,upper:h+u*d,k:u}}function b(c,l){if(l<=0)return 0;const u=I(c);if(l<c+1){let v=c,P=1/c,G=P;for(let V=0;V<1e3&&(v+=1,G*=l/v,P+=G,!(Math.abs(G)<Math.abs(P)*1e-15));V++);return P*Math.exp(-l+c*Math.log(l)-u)}const f=1e-300;let p=l+1-c,y=1/f,h=1/p,d=h;for(let v=1;v<1e3;v++){const P=-v*(v-c);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 G=h*y;if(d*=G,Math.abs(G-1)<1e-15)break}return 1-Math.exp(-l+c*Math.log(l)-u)*d}function a(c,l){return c<=0?0:b(l/2,c/2)}function g(c,l=L){if(!(l>0)||!(l<1))return NaN;let u=0,f=Math.max(1,c);for(;a(f,c)<l;)f*=2;for(let p=0;p<200;p++){const y=(u+f)/2;if(a(y,c)<l?u=y:f=y,f-u<1e-10)break}return(u+f)/2}function o(c){const l=c.length,u=c.map((f,p)=>{const y=f.slice();for(let h=0;h<l;h++)y.push(p===h?1:0);return y});for(let f=0;f<l;f++){let p=f;for(let h=f+1;h<l;h++)Math.abs(u[h][f])>Math.abs(u[p][f])&&(p=h);if(Math.abs(u[p][f])<1e-12)return null;if(p!==f){const h=u[p];u[p]=u[f],u[f]=h}const y=u[f][f];for(let h=0;h<2*l;h++)u[f][h]/=y;for(let h=0;h<l;h++){if(h===f)continue;const d=u[h][f];if(d!==0)for(let w=0;w<2*l;w++)u[h][w]-=d*u[f][w]}}return u.map(f=>f.slice(l))}function t(c,l){const u=c.length,f=new Array(l).fill(0);for(const h of c)for(let d=0;d<l;d++)f[d]+=h[d];for(let h=0;h<l;h++)f[h]/=u;const p=Array.from({length:l},()=>new Array(l).fill(0));for(const h of c)for(let d=0;d<l;d++){const w=h[d]-f[d];for(let v=d;v<l;v++)p[d][v]+=w*(h[v]-f[v])}const y=u>1?u-1:1;for(let h=0;h<l;h++)for(let d=h;d<l;d++)p[h][d]/=y,p[d][h]=p[h][d];return{mean:f,cov:p}}function r(c,l={}){const u=Number.isFinite(l.p)?l.p:L,f=Number.isFinite(l.ridge)?l.ridge:1e-6,p=c.length;if(!p)return null;const y=c[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 R=0;R<p;R++){const j=c[R];let N=j.length===y;const $=new Array(y);for(let _=0;N&&_<y;_++){const Y=Number(j[_]);Number.isFinite(Y)?$[_]=Y:N=!1}N&&(v.push(R),P.push($))}const G=y,V=g(G,u);if(P.length<=y)return{center:[],df:G,cutoff:V,singular:!0,used:P.length,distances:h,squared:d,flags:w,flagged:0};const{mean:K,cov:H}=t(P,y);let T=o(H),A=!1;if(!T){A=!0;let R=0;for(let $=0;$<y;$++)R+=H[$][$];const j=R/y*f||f,N=H.map(($,_)=>$.map((Y,Z)=>_===Z?Y+j:Y));if(T=o(N),!T)return{center:K,df:G,cutoff:V,singular:!0,used:P.length,distances:h,squared:d,flags:w,flagged:0}}let S=0;for(let R=0;R<P.length;R++){const j=P[R],N=new Array(y);for(let Y=0;Y<y;Y++)N[Y]=j[Y]-K[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 _=v[R];d[_]=$,h[_]=Math.sqrt($),$>V&&(w[_]=!0,S++)}return{center:K,df:G,cutoff:V,singular:A,used:P.length,distances:h,squared:d,flags:w,flagged:S}}const s=20,i=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function n(c,l={}){const u=l.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",f=Number.isFinite(l.windowLen)&&l.windowLen>=1?Math.floor(l.windowLen):s,p=Number.isFinite(l.threshold)?l.threshold:Q,y=Number.isFinite(l.k)?l.k:U,h=Number.isFinite(l.minPeriods)&&l.minPeriods>=1?Math.floor(l.minPeriods):f,d=c.length,w=new Array(d).fill(null),v=new Array(d).fill(!1);let P=0;for(let G=0;G<d;G++){const V=Number(c[G]);if(!Number.isFinite(V))continue;const K=Math.max(0,G-f+1),H=[];for(let T=K;T<=G;T++){const A=Number(c[T]);Number.isFinite(A)&&H.push(A)}if(!(H.length<h))if(u==="rollingIqr"){const T=k(H,{k:y});if(!T)continue;(V<T.lower||V>T.upper)&&(v[G]=!0,P++)}else{const T=M(H);if(!T||T.mad===0)continue;const A=x*(V-T.median)/T.mad;w[G]=A,Math.abs(A)>p&&(v[G]=!0,P++)}}return{method:u,windowLen:f,minPeriods:h,threshold:p,k:y,scores:w,flags:v,flagged:P}}function m(c={}){const l=c||{},u=l.field;if(typeof u!="string"||!u)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const f=l.method||"modifiedZScore";if(!(q.includes(f)||i.includes(f))||f==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${f}'`);const y=typeof l.orderBy=="string"?l.orderBy:null,h=l.latest===!0,d=i.includes(f),w=v=>Number(v==null?NaN:v[u]);return v=>{const P=Array.isArray(v)?v.slice():[...v];y&&P.sort((T,A)=>{const S=T?.[y],R=A?.[y];return S===R?0:S==null?-1:R==null?1:S<R?-1:1});const G=P.map(w);let V,K;if(d)({flags:V,scores:K}=n(G,{method:f,windowLen:l.windowLen,threshold:l.threshold,k:l.k,minPeriods:l.minPeriods}));else if(f==="iqr"){const T=k(G,{k:l.k});V=G.map(A=>T?Number.isFinite(A)&&(A<T.lower||A>T.upper):!1),K=G.map(()=>null)}else({flags:V,scores:K}=O(G,{threshold:l.threshold}));if(h){const T=V.length-1;return T<0||!V[T]?!1:{method:f,field:u,flagged:[{row:P[T],score:K[T]}]}}const H=[];for(let T=0;T<V.length;T++)V[T]&&H.push({row:P[T],score:K[T]});return H.length?{method:f,field:u,flagged:H}:!1}}}),He("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 c}});const ie=F("packages/core/src/compute/special.js"),E=ie.normalQuantile,W=ie.studentTQuantile,x=F("packages/core/src/internal/warn.js").warnOnce,Q=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),U=1e-4,L=1-1e-4;function q(l){const u=[];for(let f=0;f<l.length;f++){const p=l[f];if(p!==null&&typeof p=="object"){const y=Number.isFinite(p.at)?p.at:f,h=Number.isFinite(p.value)?p.value:null;u.push({at:y,value:h})}else u.push({at:f,value:Number.isFinite(p)?Number(p):null})}return u}function M(l){const u=l.filter(d=>d.value!==null),f=u[0],p=u[u.length-1],y=p.at-f.at,h=u.length>1&&y>0?y/(u.length-1):1;return{lastAt:p.at,step:h}}function O(l){return Math.min(L,Math.max(U,l))}function k(l,u=U,f=L,p=80){const y=(Math.sqrt(5)-1)/2;let h=u,d=f,w=d-y*(d-h),v=h+y*(d-h),P=l(w),G=l(v);for(let V=0;V<p;V++)P<G?(d=v,v=w,G=P,w=d-y*(d-h),P=l(w)):(h=w,w=v,P=G,v=h+y*(d-h),G=l(v));return(h+d)/2}function b(l,u){let f=null,p=0,y=0;for(let h=0;h<l.length;h++){const d=l[h];if(d!==null){if(f===null){f=d;continue}p+=(d-f)**2,y+=1,f=u*d+(1-u)*f}}return{level:f,sse:p,m:y}}function a(l,u,f){let p=null,y=null,h=0,d=0;for(let w=0;w<l.length;w++){const v=l[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 G=p;p=u*v+(1-u)*(G+y),y=f*(p-G)+(1-f)*y}return{level:p,trend:y,sse:h,m:d}}function g(l,u,f,p,y){const h=l.length;if(h<2*u)return null;const d=A=>{let S=0,R=0;for(let j=A;j<A+u&&j<h;j++)l[j]!==null&&(S+=l[j],R+=1);return R?S/R:null},w=d(0),v=d(u);if(w===null||v===null)return null;let P=w,G=(v-w)/u;const V=new Array(u).fill(0);for(let A=0;A<u;A++)V[A]=l[A]===null?0:l[A]-P;const K=V.reduce((A,S)=>A+S,0)/u;for(let A=0;A<u;A++)V[A]-=K;let H=0,T=0;for(let A=u;A<h;A++){const S=A%u,R=V[S],j=l[A];if(j===null){P+=G;continue}const N=P+G+R;H+=(j-N)**2,T+=1;const $=P;P=f*(j-R)+(1-f)*(P+G),G=p*(P-$)+(1-p)*G,V[S]=y*(j-P)+(1-y)*R}return{level:P,trend:G,season:V,phase:(h-1)%u,sse:H,count:T}}function o(l,u,f){let p=1;for(const h of u)p+=h*h;const y=Math.sqrt(l*p);return{se:y,margin:f*y}}function t(l,u={}){if(!l||typeof l.length!="number"||l.length===0)return null;const f=Q.includes(u.method)?u.method:"linear",p=Math.max(1,Math.floor(Number(u.horizon)||1)),y=Number.isFinite(u.confidence)&&u.confidence>0&&u.confidence<1?u.confidence:.95,h=1-(1-y)/2,d=q(l),w=d.map(H=>H.value),v=w.filter(H=>H!==null),P=v.length,{lastAt:G,step:V}=P?M(d):{lastAt:0,step:1},K=H=>G+H*V;return f==="linear"?r(d,P,p,y,h,K):f==="movingAverage"?s(v,P,p,y,h,u,K):f==="ses"?i(w,P,p,y,h,u,K):f==="holt"?n(w,P,p,y,h,u,K):m(w,P,p,y,h,u,K)}function r(l,u,f,p,y,h){if(u<2)return null;let d=0,w=0;for(const j of l)j.value!==null&&(d+=j.at,w+=j.value);d/=u,w/=u;let v=0,P=0,G=0;for(const j of l){if(j.value===null)continue;const N=j.at-d,$=j.value-w;v+=N*N,P+=N*$,G+=$*$}if(v===0)return null;const V=P/v,K=w-V*d,H=G===0?1:Math.max(0,Math.min(1,P*P/(v*G))),T=Math.max(0,G-V*P),A=u>2?Math.sqrt(T/(u-2)):null,S=u>2?W(y,u-2):null,R=[];for(let j=1;j<=f;j++){const N=h(j),$=K+V*N;let _=null,Y=null,Z=null,J=null,D=null;if(A!==null){const te=1/u+(N-d)**2/v,z=A*Math.sqrt(1+te),X=A*Math.sqrt(te);D=z,_=$-S*z,Y=$+S*z,Z=$-S*X,J=$+S*X}R.push({step:j,at:N,mean:$,lower:_,upper:Y,lowerMean:Z,upperMean:J,se:D})}return{method:"linear",horizon:f,confidence:p,n:u,sigma:A,r2:H,params:{slope:V,intercept:K},points:R}}function s(l,u,f,p,y,h,d){if(u<1)return null;const w=Math.max(1,Math.min(u,Math.floor(Number(h.windowLen)||u))),v=l.slice(u-w);let P=0;for(const A of v)P+=A;const G=P/w;let V=null,K=null;if(w>1){let A=0;for(const R of v)A+=(R-G)**2;V=Math.sqrt(A/(w-1))*Math.sqrt(1+1/w),K=W(y,w-1)}const H=V===null?null:K*V,T=[];for(let A=1;A<=f;A++)T.push({step:A,at:d(A),mean:G,lower:H===null?null:G-H,upper:H===null?null:G+H,se:V});return{method:"movingAverage",horizon:f,confidence:p,n:u,sigma:V===null?null:V,params:{windowLen:w},points:T}}function i(l,u,f,p,y,h,d){if(u<1)return null;let w=Number.isFinite(h.alpha)?O(h.alpha):null;w===null&&(w=k(K=>b(l,K).sse));const v=b(l,w),P=E(y),G=v.m>0?v.sse/v.m:null,V=[];for(let K=1;K<=f;K++){const H=v.level;let T=null,A=null,S=null;if(G!==null){const R=[];for(let N=1;N<K;N++)R.push(w);const j=o(G,R,P);S=j.se,T=H-j.margin,A=H+j.margin}V.push({step:K,at:d(K),mean:H,lower:T,upper:A,se:S})}return{method:"ses",horizon:f,confidence:p,n:u,sigma:G===null?null:Math.sqrt(G),params:{alpha:w},points:V}}function n(l,u,f,p,y,h,d){if(u<2)return null;let w=Number.isFinite(h.alpha)?O(h.alpha):null,v=Number.isFinite(h.beta)?O(h.beta):null;if(w===null||v===null){let T=w===null?.5:w,A=v===null?.5:v;for(let S=0;S<6;S++)w===null&&(T=k(R=>a(l,R,A).sse)),v===null&&(A=k(R=>a(l,T,R).sse));w=w===null?T:w,v=v===null?A:v}const P=a(l,w,v),G=E(y),V=P.m>0?P.sse/P.m:null,K=w*v,H=[];for(let T=1;T<=f;T++){const A=P.level+T*P.trend;let S=null,R=null,j=null;if(V!==null){const N=[];for(let _=1;_<T;_++)N.push(w+_*K);const $=o(V,N,G);j=$.se,S=A-$.margin,R=A+$.margin}H.push({step:T,at:d(T),mean:A,lower:S,upper:R,se:j})}return{method:"holt",horizon:f,confidence:p,n:u,sigma:V===null?null:Math.sqrt(V),params:{alpha:w,beta:v},points:H}}function m(l,u,f,p,y,h,d){const w=Math.floor(Number(h.period));if(!(w>=2))return x("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(u<2*w)return null;let v=Number.isFinite(h.alpha)?O(h.alpha):null,P=Number.isFinite(h.beta)?O(h.beta):null,G=Number.isFinite(h.gamma)?O(h.gamma):null;const V=(j,N,$)=>{const _=g(l,w,j,N,$);return _?_.sse:1/0};if(v===null||P===null||G===null){let j=v===null?.5:v,N=P===null?.5:P,$=G===null?.5:G;for(let _=0;_<8;_++)v===null&&(j=k(Y=>V(Y,N,$))),P===null&&(N=k(Y=>V(j,Y,$))),G===null&&($=k(Y=>V(j,N,Y)));v=v===null?j:v,P=P===null?N:P,G=G===null?$:G}const K=g(l,w,v,P,G);if(!K)return null;const H=E(y),T=K.count>0?K.sse/K.count:null,A=v*P,S=G*(1-v),R=[];for(let j=1;j<=f;j++){const N=K.season[(K.phase+j)%w],$=K.level+j*K.trend+N;let _=null,Y=null,Z=null;if(T!==null){const J=[];for(let te=1;te<j;te++)J.push(v+te*A+(te%w===0?S:0));const D=o(T,J,H);Z=D.se,_=$-D.margin,Y=$+D.margin}R.push({step:j,at:d(j),mean:$,lower:_,upper:Y,se:Z})}return{method:"holtWinters",horizon:f,confidence:p,n:u,sigma:T===null?null:Math.sqrt(T),params:{alpha:v,beta:P,gamma:G,period:w},points:R}}const c={FORECAST_METHODS:Q,forecast:t}}),He("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 c}}),Object.defineProperty(e,"HL_PAIR_LIMIT",{enumerable:!0,get:function(){return l}}),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 G}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return H}});const E=F("packages/core/src/internal/warn.js").warnOnce,I=F("packages/core/src/compute/handle.js").valueReader,x=F("packages/core/src/compute/statistics.js"),Q=x.numbers,U=x.moments,L=x.frequencyMap,q=x.categoricalDistance,M=x.isNumericColumn,O=x.jarqueBera,k=x.proportionInterval,b=x.SUBSET_RELIABILITY_FLOOR,g=F("packages/core/src/compute/compare.js").pooledStandardMeanDifference,o=F("packages/core/src/compute/special.js"),t=o.studentT,r=o.studentTQuantile,s=o.normalCdf,i=o.normalQuantile,n=o.chiSquareUpperTail,m=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),c=.05,l=2e6;function u(T){const A=Number(T);return Number.isFinite(A)&&A>0&&A<1?A:.95}function f(T){const{n:A,mean:S,m2:R}=U(T);return{mean:S,sd:A>0?Math.sqrt(R/A):0,n:A}}function p(T,A){const S=T.length;if(S<2)return 0;let R=0;for(let j=0;j<S;j++){const N=T[j]-A;R+=N*N}return R/(S-1)}function y(T,A){return{name:"pooledStandardMeanDifference",value:g(f(T),f(A))}}function h(T,A,S){const R=T.length,j=A.length;if(R<2||j<2)return null;const N=u(S),{mean:$}=U(T),{mean:_}=U(A),Y=p(T,$),Z=p(A,_),J=Y/R+Z/j;if(!(J>0))return null;const D=Math.sqrt(J),te=($-_)/D,z=Y/R*(Y/R)/(R-1),X=Z/j*(Z/j)/(j-1),ne=J*J/(z+X),re=Math.min(1,Math.max(0,2*(1-t(Math.abs(te),ne)))),ae=$-_,fe=r(1-(1-N)/2,ne)*D;return{test:m.WELCH,statistic:te,statisticName:"t",df:ne,pValue:re,interval:{estimate:ae,lower:ae-fe,upper:ae+fe,confidence:N,method:"welch-t (difference of means)"},effectSize:y(T,A),nA:R,nB:j,reliable:R>=b&&j>=b,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function d(T){const A=T.length;if(A===0)return Number.NaN;const S=A>>1;return A%2?T[S]:(T[S-1]+T[S])/2}function w(T,A,S){const R=T.length,j=A.length,N=R*j;if(N===0||N>l)return null;const $=new Float64Array(N);let _=0;for(let z=0;z<R;z++)for(let X=0;X<j;X++)$[_++]=T[z]-A[X];$.sort();const Y=d($),Z=Math.sqrt(R*j*(R+j+1)/12),J=i(1-(1-S)/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:S,method:"hodges-lehmann (normal approximation)"}}function v(T,A,S){const R=T.length,j=A.length;if(R<1||j<1)return null;const N=u(S),$=R+j,_=new Array($);for(let re=0;re<R;re++)_[re]={v:T[re],g:0};for(let re=0;re<j;re++)_[R+re]={v:A[re],g:1};_.sort((re,ae)=>re.v-ae.v);let Y=0,Z=0,J=0;for(;J<$;){let re=J;for(;re<$&&_[re].v===_[J].v;)re++;const ae=re-J,fe=(J+1+re)/2;for(let we=J;we<re;we++)_[we].g===0&&(Y+=fe);Z+=ae*ae*ae-ae,J=re}const D=Y-R*(R+1)/2,te=R*j/2,z=R*j/12*($+1-Z/($*($-1)));let X=1;if(z>0){const re=Math.max(0,Math.abs(D-te)-.5);X=Math.min(1,2*s(-re/Math.sqrt(z)))}const ne=w(T,A,N);return{test:m.MANN_WHITNEY,statistic:D,statisticName:"U",df:null,pValue:X,interval:ne,effectSize:y(T,A),nA:R,nB:j,reliable:R>=b&&j>=b,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function P(T,A,S,R,j){const N=k(T,A,j),$=k(S,R,j);if(!N||!$)return null;const _=N.proportion-$.proportion,Y=_-Math.sqrt((N.proportion-N.lower)**2+($.upper-$.proportion)**2),Z=_+Math.sqrt((N.upper-N.proportion)**2+($.proportion-$.lower)**2);return{lower:Y,upper:Z}}function G(T,A,S,R,j,N={}){if(!(A>0)||!(R>0))return null;const $=new Set([...T.keys(),...S.keys()]),_=$.size;if(_<2)return null;const Y=A+R;let Z=0;for(const X of $){const ne=T.get(X)||0,re=S.get(X)||0,ae=ne+re,fe=A*ae/Y,we=R*ae/Y;fe>0&&(Z+=(ne-fe)*(ne-fe)/fe),we>0&&(Z+=(re-we)*(re-we)/we)}const J=_-1,D=n(Z,J);let te=null;N.category!==void 0&&$.has(N.category)?te=N.category:_===2&&([te]=[...$]);let z=null;if(te!==null){const X=P(T.get(te)||0,A,S.get(te)||0,R,u(j));X&&(z={estimate:(T.get(te)||0)/A-(S.get(te)||0)/R,lower:X.lower,upper:X.upper,confidence:u(j),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,A,S,R)},nA:A,nB:R,reliable:A>=b&&R>=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 K(T,A,S){if(S===m.WELCH||S===m.MANN_WHITNEY)return{test:S,chosenBy:"override",reason:`caller override: ${S}`};const R=O(T),j=O(A),N=R===null?null:Math.exp(-R/2),$=j===null?null:Math.exp(-j/2);return N!==null&&N<c||$!==null&&$<c?{test:m.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${c})`}:{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 H(T,A,S,R={}){if(!T||!A)return null;const j=u(R.confidence),N=I(A);let $;if(Array.isArray(R.groups)&&R.groups.length===2)$=[V(R.groups[0]),V(R.groups[1])];else{const{map:re}=L(A,S),ae=[...re.entries()].sort((fe,we)=>we[1]-fe[1]).slice(0,2).map(fe=>fe[0]);if(ae.length<2)return E("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;$=ae}const[_,Y]=$;if(_===null||Y===null||_===Y)return E("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const Z=[],J=[];for(let re=0;re<S.length;re++){const ae=V(N(S[re]));ae===_?Z.push(S[re]):ae===Y&&J.push(S[re])}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=R.test&&R.test!=="auto"?String(R.test):null,te=M(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 re=L(T,Z),ae=L(T,J);z=G(re.map,re.total,ae.map,ae.total,j,{category:R.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 re=Q(T,Z),ae=Q(T,J),fe=K(re,ae,D);X=fe.chosenBy,ne=fe.reason,z=fe.test===m.MANN_WHITNEY?v(re,ae,j):h(re,ae,j)}return z?{...z,chosenBy:X,reason:ne,groups:[_,Y]}:(E("compareGroups:degenerate","[lattice] compareGroups: the chosen test had too little to work with (too few values, or no variation)."),null)}}),He("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 ve}});const E=F("packages/core/src/internal/warn.js").warnOnce,I=F("packages/core/src/compute/handle.js").valueReader,x=F("packages/core/src/compute/statistics.js"),Q=x.numbers,U=x.moments,L=x.frequencyMap,q=x.isNumericColumn,M=x.jarqueBera,O=x.proportionInterval,k=F("packages/core/src/compute/special.js"),b=k.studentT,a=k.studentTQuantile,g=k.normalCdf,o=k.normalQuantile,t=k.chiSquareUpperTail,r=k.incompleteBeta,s=Object.freeze({T:"t",WELCH:"welch",MANN_WHITNEY:"mannWhitney",ANOVA:"anova",KRUSKAL:"kruskal",CHI_SQUARE:"chiSquare",PROPORTIONS:"proportions"}),i=new Set([s.T,s.WELCH,s.MANN_WHITNEY]),n=new Set([s.ANOVA,s.KRUSKAL]),m=new Set([s.CHI_SQUARE,s.PROPORTIONS]),c=.05,l=[.2,.5,.8],u=[.147,.33,.474],f=[.01,.06,.14],p=[[.1,.3,.5],[.07,.21,.35],[.06,.17,.29],[.05,.15,.25]];function y(be){const se=Number(be);return Number.isFinite(se)&&se>0&&se<1?se:.05}function h(be){return be==null||be===""||typeof be=="number"&&Number.isNaN(be)?null:be instanceof Date?be.getTime():typeof be=="object"?String(be):be}function d(be,se){const de=I(be),oe=[],ce=new Map;for(let he=0;he<se.length;he++){const Oe=h(de(se[he]));if(Oe===null)continue;let Se=ce.get(Oe);Se||(Se={value:Oe,rows:[]},ce.set(Oe,Se),oe.push(Se)),Se.rows.push(se[he])}return oe}function w(be){const{n:se,mean:de,m2:oe}=U(be),ce=se>1?oe/(se-1):0;return{n:se,mean:de,sd:Math.sqrt(ce),variance:ce}}function v(be,se,de){if(!(se>0)||!(de>0)||!(be>=0)||!Number.isFinite(be))return Number.NaN;if(be===0)return 1;const oe=se*be/(se*be+de);return 1-r(se/2,de/2,oe)}function P(be,se){const de=Math.abs(be);return Number.isFinite(de)?de>=se[2]?"large":de>=se[1]?"medium":de>=se[0]?"small":"negligible":"negligible"}function G(be,se,de){if(be==="cohensD")return P(se,l);if(be==="cliffsDelta")return P(se,u);if(be==="etaSquared")return P(se,f);const oe=Math.max(1,Math.min(p.length,Math.floor(de||1)));return P(se,p[oe-1])}function V(be,se){if(!(be.n>1)||!(se.n>1))return null;const de=((be.n-1)*be.variance+(se.n-1)*se.variance)/(be.n+se.n-2);return de>0?(be.mean-se.mean)/Math.sqrt(de):null}function K(be,se){const de=be.length,oe=se.length;if(!de||!oe)return null;const ce=Array.from(se).sort((Se,Ce)=>Se-Ce);let he=0,Oe=0;for(let Se=0;Se<de;Se++){const Ce=be[Se];let Ie=0,ke=oe;for(;Ie<ke;){const Ae=Ie+ke>>1;ce[Ae]<Ce?Ie=Ae+1:ke=Ae}const _e=Ie;let Te=Ie;for(;Te<oe&&ce[Te]===Ce;)Te++;const je=Te-Ie;he+=_e,Oe+=oe-Te}return(he-Oe)/(de*oe)}function H(be,se,de,oe){const ce=Math.min(de-1,oe-1);return!(se>0)||!(ce>0)?null:Math.sqrt(be/(se*ce))}function T(be){return Number.isFinite(be)?be<.001?"p < 0.001":be>=.995?"p > 0.995":`p = ${be.toFixed(3)}`:"p = —"}function A(be){if(!Number.isFinite(be))return"0";const se=Math.abs(be);return se===0?"0":se>=1e3?String(Math.round(be)):se>=100?String(Number(be.toFixed(0))):se>=10?String(Number(be.toFixed(1))):se>=1?String(Number(be.toFixed(2))):String(Number(be.toPrecision(2)))}const S=new Set(["cohensD","cliffsDelta"]);function R(be){if(be.difference!=null&&Math.abs(be.difference)>=1e-12)return Math.sign(be.difference);const se=be.effectSize;if(se&&S.has(se.name)&&Number.isFinite(se.value)&&Math.abs(se.value)>=1e-12)return Math.sign(se.value);const[de,oe]=be.groups;return Number.isFinite(de.mean)&&Number.isFinite(oe.mean)&&de.mean!==oe.mean?Math.sign(de.mean-oe.mean):0}function j(be){const se=be.measureName||"values";return{subject:se.charAt(0).toUpperCase()+se.slice(1),be:se==="values"?"are":"is",name:se}}function N(be,se){const de=se.unit?` ${se.unit}`:"",{subject:oe,be:ce}=j(se),he=be.groups[0].label,Oe=be.groups[1].label,Se=be.effectSize?be.effectSize.label:"negligible",Ce=be.pValue<be.alpha,Ie=Ce?"unlikely to be chance":"consistent with chance";if(!Ce&&Se==="negligible")return`${oe} ${ce} essentially the same for ${he} and ${Oe} (${T(be.pValue)}); the effect is ${Se}.`;const ke=R(be),_e=`the difference is ${Ie} (${T(be.pValue)}) and the effect is ${Se}.`;if(ke===0)return`${oe} ${ce} different between ${he} and ${Oe}; ${_e}`;const Te=ke>0?he:Oe,je=ke>0?Oe:he,Ae=be.difference!=null&&Math.abs(be.difference)>=1e-12,Ee=Math.abs(be.difference),Me=Ae?typeof se.formatValue=="function"?` by about ${se.formatValue(Ee)}${de}`:` by about ${A(Ee)}${de}`:"";return`${oe} ${ce} higher for ${Te} than for ${je}${Me}; ${_e}`}function $(be,se){const{name:de}=j(se),oe=be.effectSize?be.effectSize.label:"negligible",ce=T(be.pValue);return be.pValue<be.alpha?`The groups differ in ${de}; the difference is unlikely to be chance (${ce}) and the effect is ${oe}.`:oe==="negligible"?`The groups are essentially the same in ${de} (${ce}); the effect is ${oe}.`:`The groups show a ${oe} effect in ${de}, but the difference is consistent with chance (${ce}).`}function _(be,se){const de=be.length;if(de<2)return null;const{mean:oe,m2:ce}=U(be),he=ce/(de-1);if(!(he>0))return null;const Oe=Math.sqrt(he),Se=Oe/Math.sqrt(de),Ce=oe/Se,Ie=de-1,ke=Math.min(1,Math.max(0,2*(1-b(Math.abs(Ce),Ie)))),_e=a(1-se/2,Ie)*Se,Te=oe/Oe;return{test:s.T,statistic:Ce,statisticName:"t",df:Ie,pValue:ke,difference:oe,interval:{estimate:oe,lower:oe-_e,upper:oe+_e,confidence:1-se,method:"paired-t (mean of the pair differences)"},effectSize:{name:"cohensD",label:P(Te,l),value:Te}}}function Y(be,se){const de=Array.from(be).filter(Ee=>Ee!==0),oe=de.length;if(!oe)return null;const ce=Array.from({length:oe},(Ee,Me)=>Me).sort((Ee,Me)=>Math.abs(de[Ee])-Math.abs(de[Me])),he=new Array(oe);let Oe=0;for(;Oe<oe;){let Ee=Oe;for(;Ee+1<oe&&Math.abs(de[ce[Ee+1]])===Math.abs(de[ce[Oe]]);)Ee++;const Me=(Oe+Ee)/2+1;for(let Be=Oe;Be<=Ee;Be++)he[ce[Be]]=Me;Oe=Ee+1}let Se=0,Ce=0;for(let Ee=0;Ee<oe;Ee++)Ce+=he[Ee],de[Ee]>0&&(Se+=he[Ee]);const Ie=Ce-Se,ke=oe*(oe+1)/4,_e=Math.sqrt(oe*(oe+1)*(2*oe+1)/24),Te=_e>0?(Math.abs(Se-ke)-.5)/_e:0,je=Math.min(1,Math.max(0,2*g(-Math.max(0,Te)))),Ae=Ce>0?(Se-Ie)/Ce:0;return{test:s.MANN_WHITNEY,statistic:Se,statisticName:"W",df:null,pValue:je,difference:null,interval:null,effectSize:{name:"cliffsDelta",label:P(Ae,u),value:Ae}}}function Z(be,se,de){const oe=w(be),ce=w(se);if(oe.n<2||ce.n<2)return null;const he=((oe.n-1)*oe.variance+(ce.n-1)*ce.variance)/(oe.n+ce.n-2);if(!(he>0))return null;const Oe=Math.sqrt(he*(1/oe.n+1/ce.n)),Se=(oe.mean-ce.mean)/Oe,Ce=oe.n+ce.n-2,Ie=Math.min(1,Math.max(0,2*(1-b(Math.abs(Se),Ce)))),ke=oe.mean-ce.mean,_e=a(1-de/2,Ce)*Oe,Te=V(oe,ce);return{test:s.T,statistic:Se,statisticName:"t",df:Ce,pValue:Ie,difference:ke,interval:{estimate:ke,lower:ke-_e,upper:ke+_e,confidence:1-de,method:"student-t (pooled variance, difference of means)"},effectSize:{name:"cohensD",label:P(Te,l),value:Te},summaries:[oe,ce]}}function J(be,se,de){const oe=w(be),ce=w(se);if(oe.n<2||ce.n<2)return null;const he=oe.variance/oe.n+ce.variance/ce.n;if(!(he>0))return null;const Oe=Math.sqrt(he),Se=(oe.mean-ce.mean)/Oe,Ce=oe.variance/oe.n*(oe.variance/oe.n)/(oe.n-1),Ie=ce.variance/ce.n*(ce.variance/ce.n)/(ce.n-1),ke=he*he/(Ce+Ie),_e=Math.min(1,Math.max(0,2*(1-b(Math.abs(Se),ke)))),Te=oe.mean-ce.mean,je=a(1-de/2,ke)*Oe,Ae=V(oe,ce);return{test:s.WELCH,statistic:Se,statisticName:"t",df:ke,pValue:_e,difference:Te,interval:{estimate:Te,lower:Te-je,upper:Te+je,confidence:1-de,method:"welch-t (unequal variances, difference of means)"},effectSize:{name:"cohensD",label:P(Ae,l),value:Ae},summaries:[oe,ce]}}function D(be,se,de){const oe=be.length,ce=se.length;if(oe<1||ce<1)return null;const he=w(be),Oe=w(se),Se=oe+ce,Ce=new Array(Se);for(let Be=0;Be<oe;Be++)Ce[Be]={v:be[Be],g:0};for(let Be=0;Be<ce;Be++)Ce[oe+Be]={v:se[Be],g:1};Ce.sort((Be,Ke)=>Be.v-Ke.v);let Ie=0,ke=0,_e=0;for(;_e<Se;){let Be=_e;for(;Be<Se&&Ce[Be].v===Ce[_e].v;)Be++;const Ke=(_e+1+Be)/2;for(let Je=_e;Je<Be;Je++)Ce[Je].g===0&&(Ie+=Ke);const et=Be-_e;ke+=et*et*et-et,_e=Be}const Te=Ie-oe*(oe+1)/2,je=oe*ce/2,Ae=oe*ce/12*(Se+1-ke/(Se*(Se-1)));let Ee=1;if(Ae>0){const Be=Math.max(0,Math.abs(Te-je)-.5);Ee=Math.min(1,2*g(-Be/Math.sqrt(Ae)))}const Me=K(be,se);return{test:s.MANN_WHITNEY,statistic:Te,statisticName:"U",df:null,pValue:Ee,difference:null,interval:te(be,se,1-de),effectSize:{name:"cliffsDelta",label:P(Me,u),value:Me},summaries:[he,Oe]}}function te(be,se,de){const oe=be.length,ce=se.length,he=oe*ce;if(he===0||he>2e6)return null;const Oe=new Float64Array(he);let Se=0;for(let Ae=0;Ae<oe;Ae++)for(let Ee=0;Ee<ce;Ee++)Oe[Se++]=be[Ae]-se[Ee];Oe.sort();const Ce=he>>1,Ie=he%2?Oe[Ce]:(Oe[Ce-1]+Oe[Ce])/2,ke=Math.sqrt(oe*ce*(oe+ce+1)/12),_e=o(1-(1-de)/2);let Te=Math.round(he/2-_e*ke);Te>=0||(Te=0);const je=Math.floor((he-1)/2);return Te>je&&(Te=je),{estimate:Ie,lower:Oe[Te],upper:Oe[he-1-Te],confidence:de,method:"hodges-lehmann (location shift)"}}function z(be,se){const de=be.length,oe=be.map(w);if(oe.some(Ee=>Ee.n<2))return null;const ce=oe.reduce((Ee,Me)=>Ee+Me.n,0),he=oe.reduce((Ee,Me)=>Ee+Me.mean*Me.n,0)/ce;let Oe=0,Se=0;for(let Ee=0;Ee<de;Ee++)Oe+=oe[Ee].n*(oe[Ee].mean-he)**2,Se+=(oe[Ee].n-1)*oe[Ee].variance;const Ce=de-1,Ie=ce-de;if(!(Se>0)||Ie<1)return null;const ke=Oe/Ce,_e=Se/Ie,Te=ke/_e,je=Math.min(1,Math.max(0,v(Te,Ce,Ie))),Ae=Oe/(Oe+Se);return{test:s.ANOVA,statistic:Te,statisticName:"F",df:{between:Ce,within:Ie},pValue:je,difference:null,interval:null,effectSize:{name:"etaSquared",label:P(Ae,f),value:Ae},summaries:oe}}function X(be,se){const de=be.length,oe=be.map(w);if(de<2)return null;const ce=oe.reduce((Me,Be)=>Me+Be.n,0),he=[];for(let Me=0;Me<de;Me++)for(let Be=0;Be<be[Me].length;Be++)he.push({v:be[Me][Be],g:Me});he.sort((Me,Be)=>Me.v-Be.v);const Oe=new Array(he.length);let Se=0,Ce=0;for(;Ce<he.length;){let Me=Ce;for(;Me<he.length&&he[Me].v===he[Ce].v;)Me++;const Be=(Ce+1+Me)/2;for(let et=Ce;et<Me;et++)Oe[et]=Be;const Ke=Me-Ce;Se+=Ke*Ke*Ke-Ke,Ce=Me}const Ie=new Array(de).fill(0);for(let Me=0;Me<he.length;Me++)Ie[he[Me].g]+=Oe[Me];let ke=0;for(let Me=0;Me<de;Me++)ke+=Ie[Me]*Ie[Me]/oe[Me].n;ke=12/(ce*(ce+1))*ke-3*(ce+1);const _e=1-Se/(ce*ce*ce-ce),Te=_e>0?ke/_e:ke,je=de-1,Ae=Math.min(1,Math.max(0,t(Te,je))),Ee=(Te-de+1)/(ce-de);return{test:s.KRUSKAL,statistic:Te,statisticName:"H",df:je,pValue:Ae,difference:null,interval:null,effectSize:{name:"etaSquared",label:P(Ee,f),value:Math.max(0,Ee)},summaries:oe}}function ne(be,se,de,oe,ce){const he=O(be,se,ce),Oe=O(de,oe,ce);if(!he||!Oe)return null;const Se=he.proportion-Oe.proportion,Ce=Se-Math.sqrt((he.proportion-he.lower)**2+(Oe.upper-Oe.proportion)**2),Ie=Se+Math.sqrt((he.upper-he.proportion)**2+(Oe.proportion-Oe.lower)**2);return{estimate:Se,lower:Ce,upper:Ie}}function re(be,se,de,oe){const ce=I(se),he=new Set,Oe=[];for(const Be of be){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++,he.add(ut))}Oe.push(Ke),Be.total=et}const Se=[...he];if(Se.length<2)return null;const Ce=be.reduce((Be,Ke)=>Be+Ke.total,0);if(!(Ce>0))return null;let Ie=0;for(const Be of be)for(const Ke of Se){const et=Oe[be.indexOf(Be)].get(Ke)||0,Je=be.reduce((Ct,Nt)=>Ct+(Oe[be.indexOf(Nt)].get(Ke)||0),0),ut=Be.total*Je/Ce;ut>0&&(Ie+=(et-ut)*(et-ut)/ut)}const ke=be.length,_e=Se.length,Te=(ke-1)*(_e-1),je=Math.min(1,Math.max(0,t(Ie,Te))),Ae=H(Ie,Ce,ke,_e);let Ee=null;if(ke===2&&_e===2){const[Be]=Se,Ke=Oe[0].get(Be)||0,et=Oe[1].get(Be)||0,Je=ne(Ke,be[0].total,et,be[1].total,oe);Je&&(Ee={...Je,confidence:oe,method:"newcombe (difference in this category's share)",category:Be})}const Me=be.map((Be,Ke)=>{const et={};for(const Je of Se)et[String(Je)]=(Oe[Ke].get(Je)||0)/Be.total;return et});return{test:s.CHI_SQUARE,statistic:Ie,statisticName:"chiSquare",df:Te,pValue:je,difference:null,interval:Ee,effectSize:{name:"cramersV",label:G("cramersV",Ae,Math.min(ke-1,_e-1)),value:Ae},proportions:Me}}function ae(be,se,de,oe){const ce=I(se),he=new Set;for(const Je of be)for(const ut of Je.rows){const Ct=h(ce(ut));Ct!==null&&he.add(Ct)}if(he.size!==2)return null;const[Oe]=[...he],Se=be[0].rows.reduce((Je,ut)=>Je+(h(ce(ut))===Oe?1:0),0),Ce=be[1].rows.reduce((Je,ut)=>Je+(h(ce(ut))===Oe?1:0),0),Ie=be[0].rows.length,ke=be[1].rows.length;if(!(Ie>0)||!(ke>0))return null;const _e=Se/Ie,Te=Ce/ke,je=(Se+Ce)/(Ie+ke);if(!(je>0)||!(je<1))return null;const Ae=Math.sqrt(je*(1-je)*(1/Ie+1/ke)),Ee=(_e-Te)/Ae,Me=Math.min(1,Math.max(0,2*g(-Math.abs(Ee)))),Be=_e-Te,Ke=ne(Se,Ie,Ce,ke,oe),et=H(Ee*Ee,Ie+ke,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:Oe}:null,effectSize:{name:"cramersV",label:G("cramersV",et,1),value:et},proportions:[{[String(Oe)]:_e},{[String(Oe)]:Te}],focalCategory:Oe}}function fe(be,se,de,oe){if(de&&i.has(de))return{test:de,reason:`caller override: ${de}`};const ce=M(be),he=M(se),Oe=ce===null?null:Math.exp(-ce/2),Se=he===null?null:Math.exp(-he/2);if(Oe!==null&&Oe<c||Se!==null&&Se<c)return{test:s.MANN_WHITNEY,reason:"two numeric groups, non-normal by Jarque-Bera"};const Ce=w(be),Ie=w(se);if(Ce.n>=3&&Ie.n>=3&&Ce.variance>0&&Ie.variance>0){const ke=Math.max(Ce.variance,Ie.variance)/Math.min(Ce.variance,Ie.variance),_e=Ce.variance>=Ie.variance?Ce.n-1:Ie.n-1,Te=Ce.variance>=Ie.variance?Ie.n-1:Ce.n-1;if(2*Math.min(v(ke,_e,Te),1-v(ke,_e,Te))<oe)return{test:s.WELCH,reason:"two numeric groups, unequal variances (F-test)"}}return{test:s.T,reason:Oe!==null||Se!==null?"two numeric groups, equal variances and no departure from normality":"two numeric groups (too few rows to screen normality)"}}function we(be,se){if(se&&n.has(se))return{test:se,reason:`caller override: ${se}`};for(const de of be){const oe=M(de),ce=oe===null?null:Math.exp(-oe/2);if(ce!==null&&ce<c)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 ve(be,se,de,oe={},ce=null){if(!be||!se)return null;const he=y(oe.alpha),Oe=1-he,Se=oe.test&&oe.test!=="auto"?String(oe.test):null,Ce=d(se,de);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 Ie;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(Ie=Ce.filter(et=>et.value===Ke[0]||et.value===Ke[1]),Ie.length!==2)return E("compare:empty","[lattice] statistics.compare: one of the two groups has no rows in the current set."),null;Ie.sort((et,Je)=>et.value===Ke[0]?-1:1)}else Ce.length===2||Se&&i.has(Se)||Se&&m.has(Se)?Ie=Ce.slice(0,2):(Se&&n.has(Se),Ie=Ce);const _e=q(be,de),Te=!!oe.paired&&ce&&Ie.length===2&&_e;let je,Ae,Ee;if(_e)if(Ie.length===2&&!(Se&&n.has(Se))){const Ke=Q(be,Ie[0].rows),et=Q(be,Ie[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=$e(be,ce,Ie[0].rows,Ie[1].rows);return ut?(Ae=Se?"override":"auto",Ee=Se?`caller override: ${Se} (paired)`:"two numeric groups, paired",je=Se===s.MANN_WHITNEY?Y(ut.diffs,he):_(ut.diffs,he),je?(je.paired=!0,je.chosenBy=Ae,je.reason=Ee,je.groups=[{value:Ie[0].value,label:String(Ie[0].value),n:ut.n},{value:Ie[1].value,label:String(Ie[1].value),n:ut.n}],je.alpha=he,je.method=je.test===s.MANN_WHITNEY?"Wilcoxon signed-rank test (paired)":"Student's paired t-test (difference of pairs)",je.verdict=N(je,oe),je.categorical=!1,je):(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=fe(Ke,et,Se,he);Ae=Se?"override":"auto",Ee=Je.reason,Je.test===s.MANN_WHITNEY?je=D(Ke,et,he):Je.test===s.WELCH?je=J(Ke,et,he):je=Z(Ke,et,he),je&&je.interval&&je.difference===null&&(je.difference=je.interval.estimate)}else{const Ke=Ie.map(Je=>Q(be,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=we(Ke,Se);Ae=Se?"override":"auto",Ee=et.reason,je=et.test===s.KRUSKAL?X(Ke,he):z(Ke,he)}else if(Ie.length===2){const Ke=Re(be,Ie).size===2;if(Se===s.PROPORTIONS||Ke&&!Se)Ae=Se?"override":"auto",Ee=Se?"caller override: proportions":"categorical measure with two categories (binary)",je=ae(Ie,be,he,Oe);else if(Se===s.CHI_SQUARE||!Ke&&!Se)Ae=Se?"override":"auto",Ee=Se?"caller override: chiSquare":`categorical measure with ${Re(be,Ie).size} categories`,je=re(Ie,be,he,Oe);else return E("compare:numeric-needed",`[lattice] statistics.compare: ${Se} needs a numeric measure, but the column is categorical.`),null}else Ae=Se?"override":"auto",Ee=Se?`caller override: ${Se}`:`categorical measure with ${Re(be,Ie).size} categories`,je=re(Ie,be,he,Oe);if(!je)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=je.summaries,Be=je.proportions;return{test:je.test,chosenBy:Ae,reason:Ee,statistic:je.statistic,statisticName:je.statisticName,df:je.df===void 0?null:je.df,pValue:je.pValue,alpha:he,paired:!1,interval:je.interval||null,effectSize:je.effectSize,groups:Ie.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:je.difference===void 0?null:je.difference,method:je.test,categorical:!_e,verdict:Ie.length===2?N({...je,alpha:he,groups:[{value:Ie[0].value,label:String(Ie[0].value),mean:Me?Me[0].mean:void 0},{value:Ie[1].value,label:String(Ie[1].value),mean:Me?Me[1].mean:void 0}],categorical:!_e,difference:je.difference===void 0?null:je.difference},oe):$({...je,alpha:he},oe)}}function Re(be,se){const de=I(be),oe=new Set;for(const ce of se)for(const he of ce.rows){const Oe=h(de(he));Oe!==null&&oe.add(Oe)}return oe}function $e(be,se,de,oe){const ce=I(se),he=I(be),Oe=new Map;for(const Ce of oe){const Ie=h(ce(Ce));Ie!==null&&Oe.set(Ie,he(Ce))}const Se=[];for(const Ce of de){const Ie=h(ce(Ce));if(Ie===null||!Oe.has(Ie))continue;const ke=Number(he(Ce)),_e=Number(Oe.get(Ie));!Number.isFinite(ke)||!Number.isFinite(_e)||Se.push(ke-_e)}return Se.length<2?null:{diffs:Float64Array.from(Se),n:Se.length}}}),He("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 W}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return I}});const ie="__lattice_detail",E=36;function W(x){const Q=x.config&&x.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:x.config&&x.config.detailColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(U,L){return!!(L&&L.expanded)},formatValue(){return""}}}const I=W}),He("packages/core/src/columns/treecolumn.js",function(e,F){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createTreeColumn",{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,W="__lattice_tree",I=260;function x(U){const L=U.tree||{},q=U.config&&U.config.treeColumnWidth||I,M=!!(U.config&&U.config.treeColumnFlex),O=()=>(U.columns&&E(U.columns.visible)?U.columns.visible():[]).find(g=>!g.generated)||null,k=(a,g)=>{if(g&&g.group)return g.groupValue;if(E(L.label))return L.label(a,g);if(typeof L.label=="string")return a==null?null:a[L.label];const o=O();return o&&E(o.getValue)?o.getValue(a,g):null},b=()=>{if(L.title)return L.title;const a=typeof L.label=="string"?U.columns&&E(U.columns.get)?U.columns.get(L.label):null:O();return a&&(a.title||a.id)||"Hierarchy"};return{id:W,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:L.icon,iconClass:L.iconClass,content:L.content,checkbox:L.checkbox,onCheck:L.onCheck}},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:M?{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(a,g){return k(a,g)},formatValue(a,g){if(g&&g.grandTotal)return U.config&&U.config.grandTotalLabel||"Total";if(a==null)return"";if(!L.label){const o=O();if(o&&E(o.formatValue))return o.formatValue(a,g)}return String(a)}}}const Q=x}),He("packages/core/src/columns/pivotcolumns.js",function(e,F){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return x}});const E=F("packages/core/src/internal/warn.js").warnOnce,W="__lattice_pivot",I=500;function x(q){const{pivot:M,valueColumns:O,config:k}=q,b=M&&M.paths||[],a=q.separator||k&&k.pivot&&k.pivot.separator||" | ",g=k&&k.pivot&&k.pivot.maxColumns||I;if(!b.length||!O.length)return{tree:[],leaves:[],error:null};const o=Q(k),t=b.length*O.length+(o?O.length:0);if(t>g){const i=`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}`,i),{tree:[],leaves:[],error:i}}const r=[],s=[];for(const i of b){const n=[];for(const m of O){const c=L(i,m,a);n.push(c),s.push(c)}n.length===1?(n[0].title=String(i),r.push(n[0])):r.push({id:`${W}:group:${i}`,title:String(i),columns:n,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(o){const i=O.map(m=>U(m,k));s.push(...i);const n=k&&k.pivot&&k.pivot.totalsLabel||"Total";if(i.length===1)i[0].title=n,o==="before"?r.unshift(i[0]):r.push(i[0]);else{const m={id:`${W}:group:__totals`,title:n,columns:i,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};o==="before"?r.unshift(m):r.push(m)}}return{tree:r,leaves:s,error:null}}function Q(q){const M=q&&q.pivot&&q.pivot.groupTotals;return M==="before"||M==="after"?M:null}function U(q,M){return{id:`${W}:__total${M&&M.pivot&&M.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(O,k){const b=k&&k.totals;return b&&Object.hasOwn(b,q.id)?b[q.id]:null},formatValue(O,k){return O==null?"":q.formatValue?q.formatValue(O,k):String(O)}}}function L(q,M,O){return{id:`${W}:${q}${O}${M.id}`,field:null,title:M.title||M.id,type:M.type,dataType:M.dataType,nullable:!0,align:M.align,generated:!0,pivot:{enabled:!1,index:0,path:q,sourceId:M.id},value:{pure:!0},cell:{align:M.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:M.total,lookup:null,layout:{width:M.layout&&M.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?"":M.formatValue?M.formatValue(k,b):String(k)}}}}),He("packages/core/src/compute/group.js",function(e,F){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return k}});const ie=F("packages/core/src/compute/handle.js"),E=ie.dictSize,W=ie.identity,I=ie.presenceReader,x=ie.rowCount,Q=ie.valueReader,U="",L="\0",q=1<<20;function M(b,a,g,o){const t=b.length,r=b.map(l=>Q(l)),s=Array.isArray(o)&&o.some(Boolean),i=s?r.map((l,u)=>o[u]?f=>o[u](l(f)):l):r;if(!s&&t>0&&b.every(l=>l&&l.kind==="dictionary"&&l.dict)){const l=b.map(f=>E(f.dict)+1);let u=1;for(let f=0;f<t;f++)u*=l[f];if(u<=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],G=P&&P(d)===0?l[v]-1:f[v][d];w=w*l[v]+G}return w},h=new Float64Array(g);for(let d=0;d<g;d++)h[d]=y(a[d]);return{packed:h,strings:null,product:u,readers:i,keyOf:y}}}const m=l=>{let u="";for(let f=0;f<t;f++){const p=i[f](l);u+=(f===0?"":U)+(p==null?L:String(p))}return u},c=new Array(g);for(let l=0;l<g;l++)c[l]=m(a[l]);return{packed:null,strings:c,product:1/0,readers:i,keyOf:m}}function O(b,a,g,o){const t=new Uint32Array(o+1);for(let n=0;n<g;n++)t[a[n]+1]++;for(let n=0;n<o;n++)t[n+1]+=t[n];const r=new Uint32Array(g),s=t.slice(0,o);for(let n=0;n<g;n++)r[s[a[n]]++]=b[n];const i=new Array(o);for(let n=0;n<o;n++)i[n]=r.subarray(t[n],t[n+1]);return i}function k(b,a,g={}){const o=b||[],t=a||W(x(o[0],g)),r=t.length;if(o.length===0||r===0)return{keys:[],buckets:[]};const{packed:s,strings:i,product:n,readers:m}=M(o,t,r,g.project),c=new Uint32Array(r);let l=0,u=null;if(s&&n<=Math.max(1024,Math.min(q,r*4))){const h=n,d=new Int32Array(h).fill(-1);for(let w=0;w<r;w++)d[s[w]]=0;for(let w=0;w<h;w++)d[w]===0&&(d[w]=l++);for(let w=0;w<r;w++)c[w]=d[s[w]];u=new Float64Array(l);for(let w=0;w<h;w++)d[w]>=0&&(u[d[w]]=w)}else if(s){const h=new Map;for(let d=0;d<r;d++){const w=s[d];let v=h.get(w);v===void 0&&(v=l++,h.set(w,v)),c[d]=v}u=new Float64Array(l);for(const[d,w]of h)u[w]=d}else{const h=new Map;for(let d=0;d<r;d++){const w=i[d];let v=h.get(w);v===void 0&&(v=l++,h.set(w,v)),c[d]=v}}const f=O(t,c,r,l),p=new Array(l);for(let h=0;h<l;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 u&&(y.packed=u),y}}),He("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 M}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return O}}),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 a}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return r}});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,L=F("packages/core/src/compute/total.js").total,q="|",M="/",O=2e3;function k(n,m,c){return`${n}${q}${m}${q}${c}`}function b(n,m){let c="";for(let l=0;l<n.length;l++){const u=n[l];c+=(l===0?"":m)+(u==null?"":String(u))}return c}function a(n,m,c={}){const l=c.separator||M,u=m.length,{keyOf:f,readers:p}=Q(n,m,0),y=new Map,h=[],d=[];for(let H=0;H<u;H++){const T=m[H],A=f(T);if(y.has(A))continue;y.set(A,h.length),d.push(A);const S=new Array(p.length);for(let R=0;R<p.length;R++)S[R]=p[R](T);h.push(S)}const w=I(c.locale),v=h.map((H,T)=>T);v.sort((H,T)=>{const A=h[H],S=h[T];for(let R=0;R<A.length;R++){const j=g(A[R],S[R],w);if(j!==0)return j}return H-T});const P=new Array(v.length),G=new Array(v.length),V=new Map;for(let H=0;H<v.length;H++){const T=v[H];P[H]=h[T],G[H]=b(h[T],l),V.set(d[T],H)}return{keys:P,paths:G,idOf:H=>{const T=V.get(f(H));return T===void 0?-1:T}}}function g(n,m,c){const l=n==null,u=m==null;return l||u?l&&u?0:l?1:-1:c(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 c=typeof n.handle=="function"?n.handle:null;if(!c)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 l=typeof n.totalOf=="function"?n.totalOf:null,u=[];for(const f of m){const p=c(f);p&&u.push({colId:f,handle:p,fn:l?l(f):"sum"})}return u}function t(n,m,c){if(Array.isArray(n)){const l=c||{};return{...l,pivotHandles:n,order:m||null,groups:l.groups||null}}return n||{}}function r(n,m,c){const l=t(n,m,c),u=l.separator||M,f=o(l),p=l.maxColumns===void 0?O:l.maxColumns,y=l.groups&&l.groups.buckets?l.groups:null,h=y?y.buckets:[l.order||new Uint32Array(0)],d=l.groupPaths||(y?y.keys.map(A=>b(A,u)):[""]),w=i(h),{keys:v,paths:P,idOf:G}=a(l.pivotHandles||[],w,l),V=P.length*Math.max(1,f.length),K=s(P,f,u);if(p&&V>p){const A=new Map;return{keys:v,paths:P,fields:K,groupPaths:d,columns:V,values:A,cells:A,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 H=new Map,T=P.length;for(let A=0;A<h.length;A++){const S=h[A],R=d[A]===void 0?"":d[A],j=S.length;if(j===0)continue;const N=new Int32Array(j),$=new Uint32Array(T+1);for(let Z=0;Z<j;Z++){const J=G(S[Z]);N[Z]=J,J>=0&&$[J+1]++}for(let Z=0;Z<T;Z++)$[Z+1]+=$[Z];const _=new Uint32Array(j),Y=$.slice(0,T);for(let Z=0;Z<j;Z++){const J=N[Z];J>=0&&(_[Y[J]++]=S[Z])}for(let Z=0;Z<T;Z++){const J=$[Z],D=$[Z+1];if(D===J)continue;const te=_.subarray(J,D);for(let z=0;z<f.length;z++){const X=f[z],ne=L(X.handle,te,X.fn,l.totalContext||{locale:l.locale});H.set(k(R,P[Z],X.colId),ne)}}}return{keys:v,paths:P,fields:K,groupPaths:d,columns:V,values:H,cells:H,error:null}}function s(n,m,c){if(m.length===0)return n.slice();const l=[];for(const u of n)for(const f of m)l.push(`${u}${c}${f.colId}`);return l}function i(n){if(n.length===1)return n[0]||new Uint32Array(0);let m=0;for(const u of n)m+=u?u.length:0;const c=new Uint32Array(m);let l=0;for(const u of n)!u||u.length===0||(c.set(u,l),l+=u.length);return c}}),He("packages/core/src/compute/explain.js",function(e,F){"use strict";Object.defineProperty(e,"explainContributors",{enumerable:!0,get:function(){return O}}),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,x=new Set(["sum","count","countValues"]),Q=new Set(["min","max"]),U=new Set(["avg"]);function L(b){return typeof b=="string"?b:typeof b=="function"&&b.totalName?b.totalName:null}function q(b,a,g,o){return E(b,a,g,o||{})}function M(b,a){if(a)try{return a(b)}catch{}return b==null?"":String(b)}function O(b){const{handle:a,fn:g,leaves:o,by:t,labelOf:r,rowLabel:s}=b,i={locale:b.locale},n=o&&o.length?o:[],m=L(g),c=q(a,n,g,i),l=Q.has(m);let u;if(l){let y=-1;for(let h=0;h<n.length;h++){const d=q(a,[n[h]],g,i);if(Object.is(d,c)){y=n[h];break}}u=y<0?[]:[{key:y,indices:[y],label:s?s(y):String(y)}]}else if(t){const y=I([t],n);u=y.keys.map((h,d)=>({key:h[0],indices:y.buckets[d],label:M(h[0],r)}))}else u=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 u){const h=q(a,y.indices,g,i),d=y.indices.length;let w,v;if(m==="avg")w=((typeof h=="number"?h:0)-(typeof c=="number"?c:0))*d,v=f?d/f:0;else if(l)w=typeof h=="number"?h:0,v=1;else{w=typeof h=="number"?h:0;const P=typeof c=="number"?c: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:c,fn:m,weighted:U.has(m),single:l,contributors:p}}function k(b){const a=O({...b,leaves:b.after}),g=O({...b,leaves:b.before}),o=typeof a.total=="number"?a.total:0,t=typeof g.total=="number"?g.total:0,r=new Map;for(const n of a.contributors)r.set(n.key,n);const s=[],i=new Set;for(const n of g.contributors){i.add(n.key);const m=r.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 c=m.contribution-n.contribution;c!==0&&s.push({key:n.key,label:n.label,before:n.value,after:m.value,effect:c,kind:"changed",count:m.count})}}for(const n of a.contributors)i.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:a.total,delta:o-t,weighted:a.weighted||g.weighted,single:a.single||g.single,drivers:s}}}),He("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 x=Math.max(0,I|0);this.#n=x,this.#t=new Uint8Array(Math.ceil(x/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,x){return x?this.set(I):this.clear(I)}fill(I=!1){return this.#t.fill(I?255:0),I&&this.#r(),this}grow(I){const x=Math.max(0,I|0);if(x<=this.#n)return this;const Q=Math.ceil(x/ie);if(Q>this.#t.length){const U=new Uint8Array(Q);U.set(this.#t),this.#t=U}return this.#n=x,this}count(){const I=this.#t,x=E.#e;let Q=0;for(let U=0;U<I.length;U++)Q+=x[I[U]];return Q}and(I){const x=I instanceof E?I.words:I,Q=this.#t,U=Math.min(Q.length,x.length);for(let L=0;L<U;L++)Q[L]&=x[L];for(let L=U;L<Q.length;L++)Q[L]=0;return this}or(I){const x=I instanceof E?I.words:I,Q=this.#t,U=Math.min(Q.length,x.length);for(let L=0;L<U;L++)Q[L]|=x[L];return this}not(){const I=this.#t;for(let x=0;x<I.length;x++)I[x]=~I[x]&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 x=this.#n>>3;x<this.#t.length&&(this.#t[x]&=(1<<I)-1)}static from(I){const x=Array.isArray(I)?I:Array.from(I),Q=new E(x.length);for(let U=0;U<x.length;U++)x[U]&&Q.set(U);return Q}}}),He("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,W=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 L=Q[U];this.#t.has(L)||(this.#t.set(L,this.#e.length),this.#e.push(L))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let Q=this.#e.length*8;for(let U=0;U<this.#e.length;U++){const L=this.#e[U];typeof L=="string"&&(Q+=L.length*2),Q+=16}return Q}codeOf(Q){const U=this.#t.get(Q);if(U!==void 0)return U;const L=this.#e.length;return this.#e.push(Q),this.#t.set(Q,L),this.#n++,L}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 L=this.#e.length,q=new Array(L);for(let b=0;b<L;b++)q[b]=b;const M=E(Q).compare,O=this.#e;q.sort((b,a)=>this.#o(O[b],O[a],M));const k=new Uint32Array(L);for(let b=0;b<L;b++)k[q[b]]=b;return this.#r=k,this.#i=this.#n,this.#s=U,k}#o(Q,U,L){return typeof Q=="string"&&typeof U=="string"?L(Q,U):W(Q,U)}}}),He("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(W={}){const I=Math.max(1,W.rows??16),x=Math.max(1,W.values??I);this.#e=new Int32Array(x),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(W){return W<0||W>=this.#n?0:this.#t[W+1]-this.#t[W]}at(W){return W<0||W>=this.#n?this.#e.subarray(0,0):this.#e.subarray(this.#t[W],this.#t[W+1])}has(W,I){if(W<0||W>=this.#n)return!1;const x=this.#e,Q=this.#t[W+1];for(let U=this.#t[W];U<Q;U++)if(x[U]===I)return!0;return!1}hasAny(W,I){for(let x=0;x<I.length;x++)if(this.has(W,I[x]))return!0;return!1}hasAll(W,I){for(let x=0;x<I.length;x++)if(!this.has(W,I[x]))return!1;return!0}hasNone(W,I){return!this.hasAny(W,I)}push(W){const I=this.#n,x=W.length;this.#i(I+1),this.#s(this.#r+x);const Q=this.#r;for(let U=0;U<x;U++)this.#e[Q+U]=W[U]|0;return this.#r+=x,this.#n=I+1,this.#t[I]=Q,this.#t[I+1]=this.#r,I}write(W,I){if(W===this.#n){this.push(I);return}if(W<0||W>this.#n)return;const x=this.#t[W],Q=this.#t[W+1],U=I.length;if(Q-x===U){for(let L=0;L<U;L++)this.#e[x+L]=I[L]|0;return}this.#o(W,I)}compact(W,I,x){const Q=this.#e,U=this.#t,L=this.#n,q=new Int32Array(Math.max(1,this.#r)),M=new Uint32Array(I+1);let O=0;for(let k=0;k<L;k++){if(W[k]===x)continue;const b=U[k],a=U[k+1];M[W[k]]=O;for(let g=b;g<a;g++)q[O++]=Q[g];M[W[k]+1]=O}this.#e=q,this.#t=M,this.#n=I,this.#r=O}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#i(W){if(W+1<=this.#t.length)return;let I=this.#t.length-1;for(;I<W;)I=I*2||16;const x=new Uint32Array(I+1);x.set(this.#t),this.#t=x}#s(W){if(W<=this.#e.length)return;let I=this.#e.length;for(;I<W;)I=I*2||16;const x=new Int32Array(I);x.set(this.#e),this.#e=x}#o(W,I){const x=this.#e,Q=this.#t,U=this.#n,L=I.length-(Q[W+1]-Q[W]),q=new Int32Array(Math.max(1,this.#r+L)),M=new Uint32Array(Q.length);let O=0;for(let k=0;k<U;k++){if(M[k]=O,k===W)for(let b=0;b<I.length;b++)q[O++]=I[b]|0;else for(let b=Q[k];b<Q[k+1];b++)q[O++]=x[b];M[k+1]=O}this.#e=q,this.#t=M,this.#r=O}}}),He("packages/core/src/compute/sort.js",function(e,F){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return u}}),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 H}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return T}});const ie=F("packages/core/src/compute/handle.js"),E=ie.bitReader,W=ie.dictRanks,I=ie.dictSize,x=ie.identity,Q=ie.isMissing,U=ie.presenceReader,L=ie.rowCount,q=ie.valueComparator,M=ie.valueReader,O=new Uint32Array(0),k=new ArrayBuffer(8),b=new Float64Array(k),a=new Uint32Array(k),g=(b[0]=-1,(a[1]&2147483648)!==0?1:0),o=g===1?0:1;function t(S,R){b[0]=S;let j=a[g],N=a[o];(j&2147483648)!==0?(j=~j>>>0,N=~N>>>0):j=(j^2147483648)>>>0,R[0]=N,R[1]=j}function r(S,R,j,N){if(N<2)return S;const $=new Uint32Array(256*8);for(let X=0;X<N;X++){const ne=R[X],re=j[X];$[ne&255]++,$[256+(ne>>>8&255)]++,$[512+(ne>>>16&255)]++,$[768+(ne>>>24&255)]++,$[1024+(re&255)]++,$[1280+(re>>>8&255)]++,$[1536+(re>>>16&255)]++,$[1792+(re>>>24&255)]++}let _=S,Y=R,Z=j,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,re=(X&3)<<3,ae=X>=4;let fe=!1;for(let Re=0;Re<256;Re++)if($[ne+Re]===N){fe=!0;break}if(fe)continue;let we=0;for(let Re=0;Re<256;Re++)z[Re]=we,we+=$[ne+Re];for(let Re=0;Re<N;Re++){const $e=Y[Re],be=Z[Re],se=(ae?be:$e)>>>re&255,de=z[se]++;J[de]=_[Re],D[de]=$e,te[de]=be}let ve=_;_=J,J=ve,ve=Y,Y=D,D=ve,ve=Z,Z=te,te=ve}return _}function s(S,R,j){if(j<2)return S;const N=new Uint32Array(256*4);for(let D=0;D<j;D++){const te=R[D];N[te&255]++,N[256+(te>>>8&255)]++,N[512+(te>>>16&255)]++,N[768+(te>>>24&255)]++}let $=S,_=R,Y=new Uint32Array(j),Z=new Uint32Array(j);const J=new Uint32Array(256);for(let D=0;D<4;D++){const te=D<<8,z=D<<3;let X=!1;for(let ae=0;ae<256;ae++)if(N[te+ae]===j){X=!0;break}if(X)continue;let ne=0;for(let ae=0;ae<256;ae++)J[ae]=ne,ne+=N[te+ae];for(let ae=0;ae<j;ae++){const fe=_[ae],we=J[fe>>>z&255]++;Y[we]=$[ae],Z[we]=fe}let re=$;$=Y,Y=re,re=_,_=Z,Z=re}return $}function i(S,R,j,N){const $=new Uint32Array(N+1);for(let Z=0;Z<j;Z++)$[R[Z]]++;let _=0;for(let Z=0;Z<=N;Z++){const J=$[Z];$[Z]=_,_+=J}const Y=new Uint32Array(j);for(let Z=0;Z<j;Z++)Y[$[R[Z]]++]=S[Z];return Y}function n(S,R,j,N){return j<2?S:N<=65536||N<=j*2?i(S,R,j,N):s(S,R,j)}function m(S,R){return S.length===R&&S.byteOffset===0?S:Uint32Array.prototype.slice.call(S,0,R)}function c(S,R,j=!1){const N=R||x(S.length),$=N.length;if($<2)return Uint32Array.from(N);const _=new Uint32Array($),Y=new Uint32Array($),Z=new Uint32Array($),J=new Uint32Array($),D=new Uint32Array(2);let te=0,z=0;for(let re=0;re<$;re++){const ae=N[re],fe=S[ae];if(Number.isNaN(fe)){J[z++]=ae;continue}t(fe,D),j?(Y[te]=~D[0]>>>0,Z[te]=~D[1]>>>0):(Y[te]=D[0],Z[te]=D[1]),_[te++]=ae}const X=r(_.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 l(S,R,j=!1){const N=R||x(S.length),$=N.length;if($<2)return Uint32Array.from(N);const _=Uint32Array.from(N),Y=new Uint32Array($);for(let Z=0;Z<$;Z++){const J=(S[_[Z]]^2147483648)>>>0;Y[Z]=j?~J>>>0:J}return m(s(_,Y,$),$)}function u(S,R,j={}){const N=R||x(L(S,j)),$=N.length;if($<2)return Uint32Array.from(N);const _=W(S.dict,j.locale),Y=S.values,Z=U(S),J=Math.max(I(S.dict),_.length),D=J,te=Uint32Array.from(N),z=new Uint32Array($),X=!!j.descending;for(let ne=0;ne<$;ne++){const re=te[ne];let ae=Z&&Z(re)===0?D:_[Y[re]];ae===void 0&&(ae=D),z[ne]=X?D-ae:ae}return m(n(te,z,$,J+1),$)}function f(S,R,j){const N=R.length;let $=Uint32Array.from(R);if(N<2)return $;let _=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;)_[ne++]=j(S[$[z]],S[$[X]])<=0?$[z++]:$[X++];for(;z<D;)_[ne++]=$[z++];for(;X<te;)_[ne++]=$[X++]}const Z=$;$=_,_=Z}return $}function p(S,R,j){const N=E(S.values),$=R.length,_=new Uint32Array($),Y=j?1:0;let Z=0;for(let J=0;J<$;J++)N(R[J])===Y&&(_[Z++]=R[J]);for(let J=0;J<$;J++)N(R[J])!==Y&&(_[Z++]=R[J]);return _}function y(S,R){const j=S.values,N=S.kind;if((N==="object"||N===void 0)&&(Array.isArray(j)||ArrayBuffer.isView(j))&&!S.presence)return j;const _=M(S),Y=new Array(L(S)||0);for(let Z=0;Z<R.length;Z++){const J=R[Z];Y[J]=_(J)}return Y}function h(S,R){for(let j=0;j<R.length;j++)if(typeof S[R[j]]!="string")return!1;return!0}function d(S,R,j,N,$){const _=S.length,Y=Uint32Array.from(S);if(_<2||N<1)return Y;const Z=new Uint32Array(_),J=N-1;for(let D=0;D<_;D++){const te=j[R[D]];Z[D]=$?J-te:te}return m(n(Y,Z,_,N),_)}function w(S,R,j){const N=q(j),$=new Array(R);for(let Y=0;Y<R;Y++)$[Y]=Y;$.sort((Y,Z)=>N(S[Y],S[Z])||Y-Z);const _=new Uint32Array(R);for(let Y=0;Y<R;Y++)_[$[Y]]=Y;return _}function v(S,R,j){const N=R.length,$=new Map,_=[],Y=new Uint32Array(N);for(let D=0;D<N;D++){const te=S[R[D]];let z=$.get(te);z===void 0&&(z=_.length,$.set(te,z),_.push(te)),Y[D]=z}const Z=_.length,J=w(_,Z,j.locale);return d(R,Y,J,Z,!!j.descending)}function P(S,R,j){const N=y(S,R);if(R.length>=2&&h(N,R)){const Y=S.stringRank;return Y&&Y.version===S.version&&Y.usable(R,N,j.locale)?Y.sort(R,j):v(N,R,j)}const $=q(j.locale),_=j.descending?(Y,Z)=>$(Z,Y):$;return f(N,R,_)}function G(S,R,j){const N=y(S,R),$=j.compare,Y=!!j.descending?(Z,J)=>-$(Z,J,void 0,void 0,!0):(Z,J)=>$(Z,J,void 0,void 0,!1);return f(N,R,Y)}function V(S,R){const j=R.length,N=U(S),$=S.values,_=S.kind==="float64"&&!!$,Y=S.kind==="object"||S.kind==="multi"||S.kind===void 0;if(!N&&!_&&!Y)return{present:R,absent:O};const Z=new Uint32Array(j),J=new Uint32Array(j);let D=0,te=0;if(N&&_)for(let z=0;z<j;z++){const X=R[z];N(X)===1&&!Number.isNaN($[X])?Z[D++]=X:J[te++]=X}else if(_&&!N)for(let z=0;z<j;z++){const X=R[z];Number.isNaN($[X])?J[te++]=X:Z[D++]=X}else if(N&&!Y)for(let z=0;z<j;z++){const X=R[z];N(X)===1?Z[D++]=X:J[te++]=X}else{const z=M(S);for(let X=0;X<j;X++){const ne=R[X];Q(z(ne))?J[te++]=ne:Z[D++]=ne}}return te===0?{present:R,absent:O}:{present:Z.subarray(0,D),absent:J.subarray(0,te)}}function K(S,R,j){if(R.length===0)return S;const N=new Uint32Array(S.length+R.length);return j?(N.set(R,0),N.set(S,R.length)):(N.set(S,0),N.set(R,S.length)),N}function H(S,R,j={}){const N=R||x(L(S,j));if(!S||N.length<2)return Uint32Array.from(N);const{present:$,absent:_}=V(S,N);if($.length===0)return Uint32Array.from(N);const Y=!!j.descending;let Z;if(typeof j.compare=="function")Z=G(S,$,j);else switch(S.kind){case"float64":Z=c(S.values,$,Y);break;case"int32":Z=l(S.values,$,Y);break;case"dictionary":Z=u(S,$,j);break;case"bitset":Z=p(S,$,Y);break;default:Z=P(S,$,j);break}return K(Z,_,!!j.nullsFirst)}function T(S,R,j,N={}){const $=R||[],_=$.length&&($[0].handle||A(S,$[0].col))||S&&S[0];let Y=j||x(L(_,N));for(let Z=$.length-1;Z>=0;Z--){const J=$[Z],D=J.handle||A(S,J.col)||S&&S[Z];D&&(Y=H(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 A(S,R){if(!(!S||R===void 0)){for(let j=0;j<S.length;j++)if(S[j]&&S[j].id===R)return S[j]}}}),He("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 x}});const ie=F("packages/core/src/compute/sort.js"),E=ie.collateStringRanks,W=ie.rankSortStrings,I=1e5;class x{#e=[];#t=new Map;#n;#r=0;#i=0;#s=-1;#o;#l=!1;#a=null;#c=-1;#u="\0";constructor(U=I){this.#o=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 L=this.#e;for(let q=0;q<L.length;q++)U+=L[q].length*2+24;return U}#f(U,L){const q=this.#t.get(U);if(q!==void 0)return q;if(this.#l)return-1;if(L&&this.#e.length>=this.#o)return this.#l=!0,-1;const M=this.#e.length;return this.#e.push(U),this.#t.set(U,M),this.#i++,M}build(U,L){const q=L|0;this.#e=[],this.#t=new Map,this.#i=0,this.#l=!1,this.#a=null,this.#c=-1,this.#n=new Uint32Array(q);for(let M=0;M<q;M++){const O=U[M],k=typeof O=="string"?this.#f(O,!1):-1;this.#n[M]=k<0?0:k}this.#r=q}append(U,L,q){const M=(L|0)+(q|0);if(M>this.#n.length){const O=new Uint32Array(M);O.set(this.#n.subarray(0,this.#r)),this.#n=O}for(let O=L|0;O<M;O++){const k=U[O],b=typeof k=="string"?this.#f(k,!0):-1;this.#n[O]=b<0?0:b}this.#r=Math.max(this.#r,M)}ranks(U){const L=U||"";if(this.#a&&this.#c===this.#i&&this.#u===L)return this.#a;const q=E(this.#e,this.#e.length,U);return this.#a=q,this.#c=this.#i,this.#u=L,q}usable(U,L,q){if(this.#l||this.#e.length===0)return!1;const M=this.#n,O=this.#e,k=this.#r;for(let b=0;b<U.length;b++){const a=U[b];if(a>=k||O[M[a]]!==L[a])return!1}return!0}sort(U,L){const q=this.ranks(L.locale),M=this.#e.length,O=U.length,k=new Uint32Array(O),b=this.#n;for(let a=0;a<O;a++)k[a]=b[U[a]];return W(U,k,q,M,!!L.descending)}}}),He("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,L=F("packages/core/src/store/bitset.js").Bitset,M=F("packages/core/src/store/dictionary.js").Dictionary,k=F("packages/core/src/store/multivalue.js").MultiValue,a=F("packages/core/src/store/stringrank.js").StringRankIndex,g=4294967295,o=1024,t=5e3,r=.2,s=new Set(["float64","int32","bitset","dictionary","object","multi"]);function i(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 c(y){return i(y)?[]:Array.isArray(y)?y:[y]}function l(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 u(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 G=d;G<w;G++)P[G-d]=v[y.values[G]];return P}default:return y.values[h]}}class f{#e;#t;#n;#r;#i;#s;#o;#l=!1;#a=null;#c=null;#u=null;#f=null;#d=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#O=null;#w=null;#A=!1;constructor(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.#o=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.#a:this.#T().values}get presence(){return this.#A||!this.#r?null:this.#l?this.#g:this.#T().presence}get dict(){return this.#A||!this.#l?null:this.#t==="dictionary"||this.#t==="multi"?this.#f:null}get stringRank(){if(this.#A||!this.#h||this.kind!=="object")return null;const 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 a(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.#a&&(h+=this.#a.byteLength??this.#a.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.#a[h];case"bitset":return this.#c.get(h)===1;case"dictionary":return this.#f.valueOf(this.#a[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.#a[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,G=this.#g;let V=!1;switch(this.#t){case"float64":{const K=this.#a;for(let H=0;H<w;H++){const T=v(h[H]);if(typeof T=="number"){P&&G.set(d+H),K[d+H]=T;continue}const A=T==null;P?G.assign(d+H,!A):A&&(V=!0),K[d+H]=A?NaN:n(T)}break}case"int32":{const K=this.#a;for(let H=0;H<w;H++){const T=v(h[H]),A=T==null;P?G.assign(d+H,!A):A&&(V=!0),K[d+H]=A?0:m(T)}break}case"bitset":{const K=this.#c;for(let H=0;H<w;H++){const T=v(h[H]),A=T==null;P?G.assign(d+H,!A):A&&(V=!0),K.assign(d+H,!A&&!!T)}break}case"dictionary":{const K=this.#a,H=this.#f;for(let T=0;T<w;T++){const A=v(h[T]),S=A==null;P?G.assign(d+T,!S):S&&(V=!0),K[d+T]=S?0:H.codeOf(A)}break}case"multi":{const K=this.#u,H=this.#f;for(let T=0;T<w;T++){const A=v(h[T]),S=A==null;P?G.assign(d+T,!S):S&&(V=!0);const R=c(A),j=new Array(R.length);for(let N=0;N<R.length;N++)j[N]=H.codeOf(R[N]);K.write(d+T,j)}break}default:{const K=this.#a;for(let H=0;H<w;H++){const T=v(h[H]),A=T==null;P?G.assign(d+H,!A):A&&(V=!0),K[d+H]=A?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.#a,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 G=h.kind===this.#t;if(G&&(this.#t==="float64"||this.#t==="int32")){this.#a.set(h.values,d),this.#y++;return}if(G&&this.#t==="bitset"){const V=h.values;for(let K=0;K<w;K++)this.#c.assign(d+K,(V[K>>3]&1<<(K&7))!==0);this.#y++;return}if(G&&this.#t==="dictionary"){const V=h.table||[],K=new Uint32Array(V.length);for(let S=0;S<V.length;S++)K[S]=this.#f.codeOf(V[S]);const H=h.values,T=this.#a,A=v;for(let S=0;S<w;S++){if(A&&(P&&(P[S>>3]&1<<(S&7))===0)){T[d+S]=0;continue}T[d+S]=K[H[S]]??0}this.#y++;return}if(G&&this.#t==="multi"){const V=h.table||[],K=new Uint32Array(V.length);for(let A=0;A<V.length;A++)K[A]=this.#f.codeOf(V[A]);const H=h.values,T=h.offsets;for(let A=0;A<w;A++){const S=T[A],R=T[A+1],j=new Array(R-S);for(let N=S;N<R;N++)j[N-S]=K[H[N]]??0;this.#u.write(d+A,j)}this.#y++;return}for(let V=0;V<w;V++){const K=P?(P[V>>3]&1<<(V&7))===0:h.kind==="object"?h.values[V]===null:!1;this.#C(d+V,K?null:u(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.#a.constructor(h);d.set(this.#a),this.#a=d;break}case"bitset":this.#c.grow(h);break;case"multi":break;default:this.#a.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.#a,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 G=v!==null&&v.get(P)===0;G&&h!=="multi"||this.#C(P,G?null:l(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[G,V]of v)h[G]!==g&&P.set(h[G],V);this.#O=P}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const v=this.#a;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.#a=null,this.#c&&this.#c.release(),this.#c=null,this.#u&&this.#u.release(),this.#u=null,this.#g&&this.#g.release(),this.#g=null,this.#f=null,this.#d=null,this.#O=new Map,this.#w=null,this.#b=0,this.#y++)}#S(h){const d=Math.max(1,h);switch(this.#a=null,this.#c=null,this.#u=null,this.#t){case"float64":this.#a=new Float64Array(d);break;case"int32":this.#a=new Int32Array(d);break;case"bitset":this.#c=new L(d);break;case"dictionary":this.#a=new Uint32Array(d),this.#f=this.#f??new M(this.#o??[]);break;case"multi":this.#u=new k({rows:d,values:d}),this.#f=this.#f??new M(this.#o??[]);break;default:this.#a=new Array(d);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#f=null),this.#r&&(this.#g?this.#g.grow(d):this.#g=new L(d)),this.#b=d}#C(h,d){const w=i(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.#a[h]=w?NaN:n(d);break;case"int32":this.#a[h]=w?0:m(d);break;case"bitset":this.#c.assign(h,!w&&!!d);break;case"dictionary":this.#a[h]=w?0:this.#f.codeOf(d);break;case"multi":{const v=c(d),P=new Array(v.length);for(let G=0;G<v.length;G++)P[G]=this.#f.codeOf(v[G]);this.#u.write(h,P);break}default:this.#a[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 L(h):null;for(let v=0;v<h;v++){const P=this.#E(v);d[v]=P,w&&!i(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;#o=0;#l=0;#a=new L(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??r;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.#o}get physical(){return this.#i}get capacity(){return this.#c?this.#s:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let h=this.#a.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.#o+=w,this.#a.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 G=0;G<v;G++)this.#r[w+G]=d[G];this.#i=w+v,this.#o+=v,this.#a.grow(this.#i),this.#c||this.#b(),this.#m(this.#i);const P=new Map;for(const G of h.columns)P.set(G.id,G);for(const G of this.#n){const V=P.get(G.id);V?G.appendPacked(V,w,v):G.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.#a.get(h)===1?!1:(this.#a.set(h),this.#l++,this.#o--,!0)}live(h){return h<0||h>=this.#i?!1:this.#a.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.#a.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 G=0;G<d;G++)w[G]!==g&&(P[w[G]]=P[G]);P.length=v}return this.#i=v,this.#o=v,this.#l=0,this.#a=new L(Math.max(this.#s,v)),w}column(h){return this.#t.get(h)}columns(){return this.#n.slice()}liveIndices(){const h=new Uint32Array(this.#o);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.#a.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.#a.release(),this.#i=0,this.#o=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.#a.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.#a.grow(h);for(const d of this.#n)d.columnarise(h,this.#i)}}}),He("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 x}});const ie=64,E=8;function W(U){let L=ie;for(;L<U;)L*=2;return L}class I{#e=new Map;#t=new WeakSet;#n;#r=0;#i={acquired:0,reused:0,released:0};constructor(L={}){this.#n=L.limit??E}get bytes(){return this.#r}mask(L){const q=new Uint8Array(this.#s(L),0,L);return q.fill(0),q}indices(L){return new Uint32Array(this.#s(L*4),0,L)}release(L){if(!L||!L.buffer)return!1;const q=L.buffer;if(!this.#t.has(q))return!1;this.#t.delete(q),this.#i.released++;const M=q.byteLength;let O=this.#e.get(M);return O||this.#e.set(M,O=[]),O.length>=this.#n||(O.push(q),this.#r+=M),!0}releaseAll(L){for(const q of L)this.release(q)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#i,retained:this.#r}}#s(L){const q=W(L),M=this.#e.get(q);this.#i.acquired++;let O;return M&&M.length?(O=M.pop(),this.#r-=q,this.#i.reused++):O=new ArrayBuffer(q),this.#t.add(O),O}}function x(){return Q??=new I,Q}let Q=null}),He("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 W}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return x}});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 W(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 L=Q.col!==void 0?Q.col:Q.handle&&Q.handle.id,q=Q.locale!==void 0?Q.locale:U;return{col:L,descending:Q.descending!==void 0?!!Q.descending:Q.dir==="desc",nullsFirst:!!Q.nullsFirst,collation:ie(q)}}function x(Q,U){const L=Q||[],q=new Array(L.length);for(let M=0;M<L.length;M++)q[M]=I(L[M],U);return q}}),He("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 L}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return O}}),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 a}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return r}}),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,W=ie.valueReader,I=ie.dictSize,x=ie.dictValue,Q=Object.freeze(["equal","quantile","log"]),U=Object.freeze(["hour","day","week","month","quarter","year"]),L=20,q=50,M=1e4;function O(v,P){if(!v)return"none";const G=P;if(G&&(G.multi===!0||typeof G.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,G=v.kind;if((G==="float64"||G==="int32")&&P)return K=>P[K];const V=W(v);return K=>b(V(K))}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 G=Date.parse(v);return Number.isFinite(G)?G:NaN}return NaN}function a(v,P,G,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 K=W(v),H=P?P.length:G,T=new Set;for(let A=0;A<H;A++){const S=K(P?P[A]:A);if(S!=null&&(T.add(S),T.size>V))return{cardinality:T.size,exact:!1}}return{cardinality:T.size,exact:!0}}const g=36e5,o=864e5;function t(v,P=L){const G=Number.isFinite(v)&&v>0?v:0,V=Math.max(1,P)*2;return G/g<=V?"hour":G/o<=V?"day":G/(7*o)<=V?"week":G/(30*o)<=V?"month":G/(91*o)<=V?"quarter":"year"}function r(v,P){if(!Number.isFinite(v))return NaN;const G=new Date(v);switch(P){case"hour":return G.setMinutes(0,0,0),G.getTime();case"day":return G.setHours(0,0,0,0),G.getTime();case"week":{G.setHours(0,0,0,0);const V=(G.getDay()+6)%7;return G.setDate(G.getDate()-V),G.getTime()}case"month":return G.setDate(1),G.setHours(0,0,0,0),G.getTime();case"quarter":return G.setMonth(Math.floor(G.getMonth()/3)*3,1),G.setHours(0,0,0,0),G.getTime();default:return G.setMonth(0,1),G.setHours(0,0,0,0),G.getTime()}}function s(v,P){const G=new Date(v);switch(P){case"hour":G.setHours(G.getHours()+1);break;case"day":G.setDate(G.getDate()+1);break;case"week":G.setDate(G.getDate()+7);break;case"month":G.setMonth(G.getMonth()+1);break;case"quarter":G.setMonth(G.getMonth()+3);break;default:G.setFullYear(G.getFullYear()+1);break}return G.getTime()}function i(v,P,G){const V=k(v),K=E(v),H=P?P.length:G;let T=1/0,A=-1/0,S=0,R=0;for(let j=0;j<H;j++){const N=P?P[j]:j;if(K&&!K(N)){S++;continue}const $=V(N);if(!Number.isFinite($)){S++;continue}$<T&&(T=$),$>A&&(A=$),R++}return{min:T,max:A,nulls:S,finite:R}}function n(v,P,G,V){const K=k(v),H=E(v),T=P?P.length:G,A=T>V?T/V:1,S=[];for(let j=0;j<T;j+=A){const N=P?P[Math.floor(j)]:Math.floor(j);if(H&&!H(N))continue;const $=K(N);Number.isFinite($)&&S.push($)}const R=Float64Array.from(S);return R.sort(),R}function m(v,P,G,V={}){const K=V.kind||O(v,V.type);return K==="none"||!v?{kind:"none",buckets:[],suppressed:"type"}:K==="boolean"?c(v,P,G,V):K==="category"?l(v,P,G,V):f(v,P,G,K,V)}function c(v,P,G,V={}){const K=E(v);let H=0;if(K){const A=P?P.length:G;for(let S=0;S<A;S++)K(P?P[S]:S)||H++}const T=[{value:!1,label:"false"},{value:!0,label:"true"}];return H>0&&V.blanks!==!1&&T.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:T}}function l(v,P,G,V){const K=V.cardinalityLimit??q,{cardinality:H}=a(v,P,G,K);if(H>K&&(V.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:H};const T=W(v),A=P?P.length:G,S=new Map;let R=0;for(let Y=0;Y<A;Y++){const Z=T(P?P[Y]:Y);if(Z==null||Z===""){R++;continue}if(Array.isArray(Z)){if(!Z.length){R++;continue}for(const J of Z)S.set(J,(S.get(J)||0)+1);continue}S.set(Z,(S.get(Z)||0)+1)}let j=[...S.entries()];V.order==="alpha"?j.sort((Y,Z)=>String(Y[0]).localeCompare(String(Z[0]))):j.sort((Y,Z)=>Z[1]-Y[1]);let N=0,$=0;if(j.length>K){$=j.length-K;for(let Y=K;Y<j.length;Y++)N+=j[Y][1];j=j.slice(0,K)}const _=j.map(([Y])=>({value:Y,label:String(Y)}));return N>0&&_.push({remainder:!0,label:`Other (${$} values)`}),R>0&&V.blanks!==!1&&_.push({null:!0,label:"Empty"}),{kind:"category",buckets:_,cardinality:H}}function u(v,P,G,V,K){const H=n(v,P,G,M),T=H.length;if(T<100)return null;const A=H[Math.floor(.01*T)],S=H[Math.ceil(.99*T)-1];return!(S>A)||K-V<=2*(S-A)?null:{lo:A,hi:S}}function f(v,P,G,V,K){const{min:H,max:T,nulls:A,finite:S}=i(v,P,G);if(!S)return{kind:V,buckets:A&&K.blanks!==!1?[{null:!0,label:"Empty"}]:[],empty:!0};const R=Math.max(1,Math.floor(K.buckets||L));let j=[];if(V==="date"){const $=U.includes(K.granularity)?K.granularity:t(T-H,R);let _=r(H,$);for(;_<=T&&j.length<4096;){const Y=s(_,$);if(!(Y>_))break;j.push({from:_,to:Y}),_=Y}return{kind:V,buckets:p(j,K.blanks===!1?0:A),granularity:$}}const N=Q.includes(K.strategy)?K.strategy:"equal";if(N==="quantile"){const $=n(v,P,G,M);if($.length){const _=[$[0]];for(let Y=1;Y<R;Y++){const Z=$[Math.min($.length-1,Math.floor(Y/R*$.length))];Z>_[_.length-1]&&_.push(Z)}_.push(T);for(let Y=0;Y<_.length-1;Y++)j.push({from:_[Y],to:_[Y+1]})}}else if(N==="log"&&H>0){const $=Math.log10(H),Y=(Math.log10(T)-$)/R||1;for(let Z=0;Z<R;Z++)j.push({from:10**($+Z*Y),to:10**($+(Z+1)*Y)})}if(!j.length&&N==="equal"){const $=u(v,P,G,H,T);if($){const _=($.hi-$.lo)/R;$.lo>H&&j.push({from:H,to:$.lo,overflow:"low"});for(let Y=0;Y<R;Y++)j.push({from:$.lo+Y*_,to:$.lo+(Y+1)*_});j[j.length-1].to=$.hi,$.hi<T&&j.push({from:$.hi,to:T,overflow:"high"})}}if(!j.length){const $=(T-H)/R||1;for(let _=0;_<R;_++)j.push({from:H+_*$,to:H+(_+1)*$})}return j[j.length-1].to=T,{kind:V,buckets:p(j,K.blanks===!1?0:A),strategy:N,min:H,max:T}}function p(v,P){return P>0?[...v,{null:!0,label:"Empty"}]:v}function y(v,P,G,V,K){const H=V&&V.buckets||[],T=K&&K.length>=H.length?K.subarray(0,H.length):new Uint32Array(H.length);if(T.fill(0),!v||!H.length)return T;const A=H.length-1,S=!!H[A]&&H[A].null===!0,R=P?P.length:G;if(V.kind==="boolean"){const Y=W(v);for(let Z=0;Z<R;Z++){const J=Y(P?P[Z]:Z);if(J==null){S&&T[A]++;continue}T[J?1:0]++}return T}if(V.kind==="category"){const Y=new Map;for(let D=0;D<H.length;D++)!H[D].null&&!H[D].remainder&&Y.set(H[D].value,D);const Z=H.findIndex(D=>D.remainder),J=W(v);for(let D=0;D<R;D++){const te=J(P?P[D]:D);if(te==null||te===""){S&&T[A]++;continue}if(Array.isArray(te)){if(!te.length){S&&T[A]++;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 j=S?H.length-1:H.length,N=new Float64Array(j+1);for(let Y=0;Y<j;Y++)N[Y]=H[Y].from;N[j]=j?H[j-1].to:0;const $=k(v),_=E(v);for(let Y=0;Y<R;Y++){const Z=P?P[Y]:Y;if(_&&!_(Z)){S&&T[A]++;continue}const J=$(Z);if(!Number.isFinite(J)){S&&T[A]++;continue}const D=h(N,j,J);D>=0&&T[D]++}return T}function h(v,P,G){if(!P||G<v[0])return-1;if(G>=v[P])return G===v[P]?P-1:-1;let V=0,K=P-1;for(;V<K;){const H=V+K+1>>>1;G>=v[H]?V=H:K=H-1}return V}function d(v,P,G,V={}){const K=V.bounds||m(v,V.boundsIndices??P,G,V);return{bounds:K,counts:y(v,P,G,K)}}const w=d}),He("packages/core/src/compute/pivotmatrix.js",function(e,F){"use strict";Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return O}}),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 r}});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"),L=U.joinPath,q=U.DEFAULT_PATH_SEPARATOR,M=U.DEFAULT_MAX_COLUMNS,O="";function k(s,i,n={}){const m=n.separator||q,c=s||[],l=i instanceof Uint32Array?i:Uint32Array.from(i||[]),u=l.length;if(c.length===0)return{tuples:[[]],paths:[O],buckets:[l]};const{keyOf:f,readers:p}=Q(c,l,0),y=new Map,h=[],d=[],w=[];for(let H=0;H<u;H++){const T=l[H],A=f(T);let S=y.get(A);if(S===void 0){S=h.length,y.set(A,S),d.push(A);const R=new Array(p.length);for(let j=0;j<p.length;j++)R[j]=p[j](T);h.push(R),w.push([])}w[S].push(T)}const v=E(n.locale),P=h.map((H,T)=>T);P.sort((H,T)=>{const A=h[H],S=h[T];for(let R=0;R<A.length;R++){const j=b(A[R],S[R],v);if(j!==0)return j}return H-T});const G=new Array(P.length),V=new Array(P.length),K=new Array(P.length);for(let H=0;H<P.length;H++){const T=P[H];G[H]=h[T],V[H]=L(h[T],m),K[H]=Uint32Array.from(w[T])}return{tuples:G,paths:V,buckets:K}}function b(s,i,n){const m=s==null,c=i==null;return m||c?m&&c?0:m?1:-1:n(s,i)}function a(s,i,n){const m=[];for(let c=0;c<s.length;c++)n.has(s[c])&&m.push(s[c]);return Uint32Array.from(m)}function g(s,i,n,m){return{value:i.length?I(s,i,n,m):null,leaves:i,count:i.length}}function o(s){const i=s&&s.opts||{},n=i.separator||q,m=i.totalContext||{locale:i.locale},c=(s.measures||[]).filter(V=>V&&V.handle),l=s.leaves instanceof Uint32Array?s.leaves:Uint32Array.from(s.leaves||[]),u=k(s.rowHandles||[],l,{...i,separator:n}),f=k(s.columnHandles||[],l,{...i,separator:n}),p=i.maxColumns===void 0?M:i.maxColumns,y=f.paths.length*Math.max(1,c.length),h=new Map;if(p&&y>p)return{rowAxis:u,columnAxis:f,measures:c.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,G=f.buckets.map(V=>new Set(V));for(let V=0;V<f.paths.length;V++){const K=f.buckets[V],H=f.paths[V];for(const T of c)v.set(r(H,T.colId),g(T.handle,K,T.fn,m))}for(let V=0;V<u.paths.length;V++){const K=u.buckets[V],H=u.paths[V];for(const T of c)w.set(r(H,T.colId),g(T.handle,K,T.fn,m));for(let T=0;T<f.paths.length;T++){const A=a(K,f.buckets[T],G[T]);if(A.length===0)continue;const S=f.paths[T];for(const R of c)d.set(t(H,S,R.colId),g(R.handle,A,R.fn,m))}}for(const V of c)P.set(V.colId,g(V.handle,l,V.fn,m));return{rowAxis:u,columnAxis:f,measures:c.map(V=>({colId:V.colId,fn:V.fn})),body:d,rowMargin:w,columnMargin:v,grand:P,columns:y,error:null}}function t(s,i,n){return`${s}\0${i}\0${n}`}function r(s,i){return`${s}\0${i}`}}),He("packages/core/src/compute/reference.js",function(e,F){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return a}}),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,W=F("packages/core/src/compute/handle.js"),I=W.isMissing,x=W.valueComparator,U=F("packages/core/src/compute/filter.js").testValue,L="",q="\0";function M(s,i){const n=i.includes(".")?E(s,i):s?.[i];return n===void 0?null:n}function O(s,i,n={}){const m=i||[];let c=s.map((l,u)=>u);if(m.length===0)return c;for(let l=m.length-1;l>=0;l--)c=k(s,c,m[l],n);return c}function k(s,i,n,m){const c=n.locale!==void 0?n.locale:m.locale,l=x(c),u=n.descending!==void 0?!!n.descending:n.dir==="desc",f=[],p=[];for(const d of i){const w=M(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=M(s[d],n.col),P=M(s[w],n.col);let G;return typeof n.compare=="function"?(G=n.compare(v,P,s[d],s[w],u),u&&(G=-G)):G=u?l(P,v):l(v,P),G!==0?G:y.get(d)-y.get(w)};return f.sort(h),n.nullsFirst?p.concat(f):f.concat(p)}function b(s,i,n={}){const m=[];for(let c=0;c<s.length;c++)a(s[c],i,n,c)&&m.push(c);return m}function a(s,i,n,m){if(!i)return!0;if(Array.isArray(i.conditions)){const c=i.conditions.filter(u=>u!=null);if(c.length===0)return!0;if(i.op==="or")return c.some(u=>a(s,u,n,m));const l=c.every(u=>a(s,u,n,m));return i.op==="not"?!l:l}return i.col===void 0&&typeof n.custom=="function"?!!n.custom(i,s,m):U(M(s,i.col),i,n.locale)}function g(s,i,n,m){const c=n||s.map((p,y)=>y),l=new Map,u=[],f=[];for(const p of c){const y=i.map((w,v)=>{const P=M(s[p],w);return m&&m[v]?m[v](P):P}),h=y.map(w=>w==null?q:String(w)).join(L);let d=l.get(h);d===void 0&&(d=u.length,l.set(h,d),u.push(y),f.push([])),f[d].push(p)}return{keys:u,buckets:f}}function o(s,i,n={}){const m=x(n.locale),c=s.filter(u=>!I(u)),l=c.map(t).filter(u=>u!==null);switch(i){case"count":return s.length;case"countValues":return c.length;case"sum":return l.reduce((u,f)=>u+f,0);case"avg":return c.length===0?null:l.reduce((u,f)=>u+f,0)/c.length;case"min":return c.length===0?null:c.reduce((u,f)=>m(f,u)<0?f:u);case"max":return c.length===0?null:c.reduce((u,f)=>m(f,u)>0?f:u);case"first":return s.length===0?null:r(s[0]);case"last":return s.length===0?null:r(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 i=Number(s);return Number.isNaN(i)?null:i}function r(s){return s===void 0?null:s}}),He("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 W=F("packages/core/src/compute/filter.js");Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return W.evaluateFilters}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return W.evaluateCondition}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return W.compact}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return W.testValue}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return W.compilePredicate}}),Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return W.releaseMask}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return W.pruneColumn}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return W.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 x=F("packages/core/src/compute/facet.js");Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return x.facet}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return x.computeBounds}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return x.countInto}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return x.bucketOf}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return x.facetKind}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return x.cardinalityOf}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return x.pickGranularity}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return x.floorTo}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return x.advance}}),Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return x.STRATEGIES}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return x.GRANULARITIES}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return x.DEFAULT_BUCKETS}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return x.DEFAULT_CARDINALITY_LIMIT}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return x.QUANTILE_SAMPLE}});const Q=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 L=F("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return L.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return L.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return L.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return L.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return L.GRAND_PATH}});const 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 M=F("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return M.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return M.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return M.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return M.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return M.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return M.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return M.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return M.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return M.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return M.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return M.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return M.isMissing}});const O=F("packages/core/src/compute/sketch.js");Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return O.Welford}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return O.Reservoir}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return O.HyperLogLog}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return O.SpaceSaving}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return O.KLL}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return O.hash32}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return O.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 a=F("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return a.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return a.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return a.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return a.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return a.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return a.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return a.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}})}),He("packages/core/src/source/rows.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_ROW_HEIGHT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"KEY_SEP",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return a}}),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,x=32,Q="\0";function U(o){return new L(o)}class L{#e;#t;constructor(t){this.#e=I(t&&t.rowKey)?t.rowKey:null;const r=t&&t.config?t.config.rowHeight:void 0;this.#t=typeof r=="number"||I(r)?r:x}get keyed(){return this.#e!==null}keyOf(t,r){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`#${r}`}heightOf(t){return I(this.#t)?Number(this.#t(t))||x:this.#t}leaf(t,r,s=0,i=null){const n={key:this.keyOf(t,r),data:t,level:s,parent:i,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:r};return n.height=this.heightOf(n),n}group(t){const r={key:a(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&&(r.totals=t.totals),r.height=this.heightOf(r),r}footer(t){const r={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 r.height=this.heightOf(r),r}detail(t,r){return{key:`${t.key}${Q}detail`,data:t.data,level:t.level+1,parent:t,group:!1,detail:!0,expanded:!1,leafCount:0,height:r,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:t.key}}grandTotal(t,r){const s={key:`${Q}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:r,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:t};return s.height=this.heightOf(s),s}skeleton(t,r=0,s=!1){const i={key:`${Q}pending${Q}${t}`,data:null,level:r,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:t,selected:!1,physical:null,pending:!0};return s&&(i.loadError=!0),i.height=this.heightOf(i),i}}function q(o,t,r,s){return{key:`${Q}pinned${Q}${r}${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:r}}function M(o,t){return new Proxy([],{get(r,s,i){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(r,s,i)},has(r,s){if(typeof s=="string"){const i=Number(s);if(Number.isInteger(i)&&i>=0)return i<o()}return Reflect.has(r,s)}})}function O(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 a(o){const t=o||[];let r="g";for(let s=0;s<t.length;s++)r+=Q+b(t[s]);return r}function g(o){const t=new Array(o.length),r=[];for(let s=0;s<o.length;s++)r.push(o[s]),t[s]=a(r);return t}}),He("packages/core/src/source/handles.js",function(e,F){"use strict";Object.defineProperty(e,"HandleProvider",{enumerable:!0,get:function(){return x}}),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 x{#e;#t;#n;#r=new Map;#i=0;constructor(L,q,M){this.#e=L,this.#t=q,this.#n=E(M)?M:()=>!1}get store(){const L=this.#e.store;return L&&E(L.column)?L:null}invalidate(){this.#i++}handle(L){const q=this.store;if(q){const b=q.column(L);if(b)return b}const M=this.#r.get(L);if(M&&M.builtAt===this.#i)return M.handle;const O=this.#s(L);if(!O)return;if(q&&this.#n()){I(`source.dropped.${L}`,`column "${L}" cannot be served under ingest.dropSourceRows: it is an impure computed column (a shadow or a positional/rank column) that is never stored, so it can only be read from the caller's row objects — which dropSourceRows has released. Do not sort, filter, group or total on such a column with dropSourceRows enabled.`);return}const k=this.#o(O);return this.#r.set(L,{handle:k,builtAt:this.#i}),k}#s(L){const q=this.#e.columns;return q&&E(q.get)?q.get(L):void 0}#o(L){const q=this.#t()||[],M=q.length,O=new Array(M),k=E(L.getValue)?a=>L.getValue(a):a=>a?.[L.field||L.id];for(let a=0;a<M;a++)O[a]=q[a]===void 0?void 0:k(q[a]);const b=this.#i;return{id:L.id,kind:"object",nullable:!1,values:O,presence:null,dict:null,offsets:null,get(a){return O[a]},version:b}}}function Q(U,L,q){return new x(U,L,q)}}),He("packages/core/src/compute/incremental.js",function(e,F){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return q}});const E=F("packages/core/src/store/columnstore.js").toFloat,W=Object.freeze(["sum","avg","countValues","min","max"]),I=Object.freeze(["float64"]),x=1e15;function Q(M,O){return typeof M!="string"||!W.includes(M)?!1:!!O&&I.includes(O.kind)}function U(M){if(M==null)return null;const O=E(M);return Number.isNaN(O)?null:O}class L{#e;#t=0;#n=0;#r=0;#i=1/0;#s=-1/0;#o=!1;#l=!1;constructor(O){this.#e=O}get valid(){return this.#o&&!this.#l}get fn(){return this.#e}seed(O){this.#a();for(let k=0;k<O.length;k++){const b=U(O[k]);b!==null&&this.#c(b)}this.#o=!0}seedColumn(O,k,b){this.#a();for(let a=0;a<b.length;a++){const g=b[a];if(k&&k(g)===0)continue;const o=O[g];Number.isNaN(o)||this.#c(o)}this.#o=!0}#a(){this.#t=0,this.#n=0,this.#r=0,this.#i=1/0,this.#s=-1/0,this.#l=!1}#c(O){if(!Number.isFinite(O)){this.#l=!0;return}const k=this.#t+O;this.#n+=Math.abs(this.#t)>=Math.abs(O)?this.#t-k+O:O-k+this.#t,this.#t=k,this.#r++,O<this.#i&&(this.#i=O),O>this.#s&&(this.#s=O)}#u(O){const k=this.#t-O;this.#n+=Math.abs(this.#t)>=Math.abs(O)?this.#t-k-O:-O-k+this.#t,this.#t=k,this.#r--}update(O,k){if(!this.#o)return!1;const b=U(O),a=U(k);return b===null&&a===null?!0:b!==null&&!Number.isFinite(b)||a!==null&&!Number.isFinite(a)?!1:this.#e==="min"||this.#e==="max"?b===null||a===null?!1:this.#e==="min"?a<this.#i?(this.#i=a,!0):b>this.#i:a>this.#s?(this.#s=a,!0):b<this.#s:Math.abs(this.#t)>x?!1:(b!==null&&this.#u(b),a!==null&&this.#c(a),!0)}value(){switch(this.#e){case"countValues":return this.#r;case"avg":return this.#r?(this.#t+this.#n)/this.#r:null;case"min":return this.#r?this.#i:null;case"max":return this.#r?this.#s:null;default:return this.#t+this.#n}}invalidate(){this.#o=!1}}const q=L}),He("packages/core/src/source/filterwire.js",function(e,F){"use strict";Object.defineProperty(e,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"resolveRelativeRange",{enumerable:!0,get:function(){return i}}),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 c}}),Object.defineProperty(e,"resolveRelativeCondition",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return u}}),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,W="source.remote.hostFilter",I="source.where.pageRelative";function x(V,K){!Array.isArray(V)||!V.length||E(I,`filters.where (${V.join(", ")}) runs over the rows the ${K} 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 K=(V||{}).config;!K||!K.hostFilter||E(W,"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 L(V,K){E(`${U}:${V}`,`filters.where("${V}") is registered but the ${K} 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 M(V,K,H,T){!Array.isArray(V)||!V.length||E(`${q}:${K}`,`filters.where (${V.join(", ")}) is not applied to the ${K} pushdown source:`,H===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${H.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 O=new Map;function k(V){let K=O.get(V);return K||(K=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"}),O.set(V,K)),K}function b(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function a(V,K){const H=k(K).formatToParts(new Date(V)),T={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const A of H)A.type==="year"?T.y=+A.value:A.type==="month"?T.m=+A.value:A.type==="day"?T.d=+A.value:A.type==="hour"?T.h=+A.value%24:A.type==="minute"?T.mi=+A.value:A.type==="second"&&(T.s=+A.value);return T}function g(V,K){const H=a(V,K);return Date.UTC(H.y,H.m-1,H.d,H.h,H.mi,H.s)-Math.floor(V/1e3)*1e3}function o(V,K,H,T){const A=Date.UTC(V,K-1,H),S=A-g(A,T);return A-g(S,T)}function t(V,K,H){const T=new Date(Date.UTC(V.y,V.m-1,V.d+K));return o(T.getUTCFullYear(),T.getUTCMonth()+1,T.getUTCDate(),H)}const r=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function s(V,K){if(typeof V!="string")return null;const H=V.trim().toLowerCase().replace(/[\s_-]+/g,""),T=/^last(\d*|n)days?$/.exec(H);if(T){const A=T[1]==="n"?"":T[1],S=Number(A||K);return!Number.isFinite(S)||S<=0?null:{kind:"lastNDays",n:Math.floor(S)}}switch(H){case"today":return{kind:"today",n:0};case"yesterday":return{kind:"yesterday",n:0};case"thisweek":return{kind:"thisWeek",n:0};case"thismonth":return{kind:"thisMonth",n:0};case"thisquarter":return{kind:"thisQuarter",n:0};case"thisyear":return{kind:"thisYear",n:0};case"quartertodate":case"qtd":return{kind:"quarterToDate",n:0};case"yeartodate":case"ytd":return{kind:"yearToDate",n:0};default:return null}}function i(V,K={}){const H=s(V,K.n);if(!H)return null;const T=K.tz||b(),A=K.now instanceof Date?K.now.getTime():typeof K.now=="number"?K.now:Date.now(),S=a(A,T),R=o(S.y,S.m,S.d,T),j=t(S,1,T);let N=R,$=j;switch(H.kind){case"today":break;case"yesterday":N=t(S,-1,T),$=R;break;case"lastNDays":$=K.includeToday?j:R,N=t(S,K.includeToday?-(H.n-1):-H.n,T);break;case"thisWeek":{const _=Number.isFinite(K.weekStartsOn)?Number(K.weekStartsOn):1,Z=(new Date(Date.UTC(S.y,S.m-1,S.d)).getUTCDay()-_+7)%7;N=t(S,-Z,T),$=t(S,-Z+7,T);break}case"thisMonth":N=o(S.y,S.m,1,T),$=o(S.m===12?S.y+1:S.y,S.m===12?1:S.m+1,1,T);break;case"thisQuarter":case"quarterToDate":{const _=Math.floor((S.m-1)/3)*3+1;N=o(S.y,_,1,T),$=H.kind==="quarterToDate"?j:_===10?o(S.y+1,1,1,T):o(S.y,_+3,1,T);break}case"thisYear":case"yearToDate":N=o(S.y,1,1,T),$=H.kind==="yearToDate"?j:o(S.y+1,1,1,T);break;default:return null}return{from:new Date(N).toISOString(),to:new Date($).toISOString(),bounds:"[)",tz:T,relative:H.kind==="lastNDays"?`last${H.n}Days`:H.kind,n:H.n}}function n(V){if(!V||typeof V!="object")return null;const K=V.value;if(K&&typeof K=="object"&&!Array.isArray(K)&&"relative"in K)return{token:String(K.relative),n:typeof K.n=="number"?K.n:void 0};if(V.op==="relative"&&typeof V.value=="string")return{token:V.value,n:void 0};const H=V.meta;return H&&typeof H.relative=="string"&&V.value===void 0?{token:H.relative,n:typeof H.n=="number"?H.n:void 0}:null}function m(){return`Known tokens: ${r.filter(K=>K!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function c(V){const K=n(V);return K?s(K.token,K.n)!==null:!1}function l(V,K={}){const H=n(V);if(!H)return V;const T=i(H.token,{...K,n:H.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.${H.token}`,`unknown relative date token "${H.token}"; sending the condition unresolved.`,m()),V)}function u(V){return!!V&&typeof V=="object"&&Array.isArray(V.conditions)}function f(V,K){if(V){if(u(V)){for(const H of V.conditions)f(H,K);return}K(V)}}function p(V,K){if(!V)return null;if(!u(V))return K(V);const H=V;let T=!1;const A=[];for(const S of H.conditions){const R=p(S,K);R!==S&&(T=!0),R&&A.push(R)}return!T&&A.length===H.conditions.length?V:A.length?{...H,conditions:A}:null}function y(V){if(!V)return null;if(!u(V))return V;const K=V,H=[];for(const T of K.conditions){const A=y(T);A&&H.push(A)}return H.length?{op:K.op,conditions:H}:null}function h(V){const K=y(V);return K?u(K)&&K.op==="and"?K:{op:"and",conditions:[K]}:null}function d(V){const K=(V||[]).filter(Boolean);return K.length?{op:"and",conditions:K}:null}function w(V,K={}){const H=p(V,T=>l(T,K));return h(H)}function v(V){const K=P(V.filters??null);return JSON.stringify([K,V.sort??null,V.quick??"",V.groupBy??null,V.pivotBy??null,G(V.context)])}function P(V){if(!V)return null;if(u(V)){const T=V;return{op:T.op,conditions:T.conditions.map(P)}}const K=V,H=K.meta&&typeof K.meta.relative=="string"?K.meta.relative:n(K)?.token;return{col:K.col,op:K.op,bounds:K.bounds??null,caseSensitive:K.caseSensitive??!1,value:H?`rel:${H}`:K.value??null}}function G(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]"}}}),He("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 L}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"assignLevels",{enumerable:!0,get:function(){return O}}),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 a}});const E=F("packages/core/src/internal/predicates.js").isFunction,I=F("packages/core/src/internal/warn.js").warnOnce,x="",Q="\0tree:";function U(g,o){return{physical:g,key:o,level:0,children:[],value:void 0}}function L(g,o){const t=[],r=new Map;for(let s=0;s<g.length;s++){const i=g[s],n=o.pathOf(i),m=Array.isArray(n)?n.map(l=>String(l)):[];if(!m.length){const l=U(i,o.keyOf(i));t.push(l);continue}let c=null;for(let l=0;l<m.length;l++){const u=m.slice(0,l+1).join(x),f=l===m.length-1;let p=r.get(u);p&&f&&p.physical===-1&&(p.physical=i,p.key=o.keyOf(i)),p||(p=U(f?i:-1,f?o.keyOf(i):Q+u),p.level=l,p.value=m[l],r.set(u,p),c?c.children.push(p):t.push(p)),c=p}}return{roots:t,nodes:r}}function q(g,o){const t=new Map,r=[];for(let m=0;m<g.length;m++){const c=g[m],l=o.keyOf(c),u=U(c,l);t.set(l,u);const f=o.parentOf(c);f!=null&&f!==""&&r.push({node:u,parent:String(f)})}let s=null;const i=new Map;for(const{node:m,parent:c}of r){const l=t.get(c);if(l){i.set(m.key,l);continue}o.orphans&&o.orphans!=="root"&&(s||(s=U(-1,`${Q}orphans`),s.value=o.orphans),i.set(m.key,s))}const n=[];for(const m of t.values()){const c=i.get(m.key);c?c.children.push(m):n.push(m)}return s&&s.children.length&&n.push(s),{roots:M(n,t,o.orphans,s),nodes:t}}function M(g,o,t,r){const s=new Set,i=[...g];for(;i.length;){const u=i.pop();if(!s.has(u.key)){s.add(u.key);for(const f of u.children)i.push(f)}}const n=[];for(const u of o.values())s.has(u.key)||n.push(u);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 u of n)u.children=u.children.filter(f=>s.has(f.key));if(!m)return[...g,...n];let c=r;const l=[...g];return c||(c=U(-1,`${Q}orphans`),c.value=t,l.push(c)),c.children.push(...n),l}function O(g){let o=0;const t=(r,s)=>{for(const i of r)i.level=s,s>o&&(o=s),i.children.length&&t(i.children,s+1)};return t(g,0),o}function k(g,o){if(!g||typeof g!="object")return null;const t=g.path,r=g.parentKey,s=E(g.hasChildren)?i=>!!g.hasChildren(o.dataAt(i)):null;if(E(t))return{mode:"path",pathOf:i=>t(o.dataAt(i)),keyOf:o.keyOf,declaresChildren:s};if(r!=null){const i=E(r)?r:n=>n?.[r];return{mode:"parentKey",parentOf:n=>i(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"?L(g,o):q(g,o),r=O(t.roots);return{...t,depth:r}}function a(g,o){const t=new Map,r=s=>{for(let i=0;i<s.length;i++){const n=s[i];if(n.physical>=0){const m=o?o(n.physical):!1,c=m&&n.children.length===0;t.set(n.physical,{level:n.level,posinset:i+1,setsize:s.length,hasChildren:n.children.length>0||m,lazy:c})}n.children.length&&r(n.children)}};return r(g),t}}),He("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 W}}),Object.defineProperty(e,"isArrival",{enumerable:!0,get:function(){return I}});const ie=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function E(x){const Q=x&&typeof x=="object"?x.reason:null;return typeof Q=="string"&&ie.includes(Q)}const W=Object.freeze(["page","total"]);function I(x){const Q=x&&typeof x=="object"?x.reason:null;return typeof Q=="string"&&W.includes(Q)}}),He("packages/core/src/source/memory.js",function(e,F){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return _}}),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,W=F("packages/core/src/internal/warn.js"),I=W.warnOnce,x=W.fail,U=F("packages/core/src/internal/predicates.js").isFunction,q=F("packages/core/src/internal/compare.js").defaultCompare,O=F("packages/core/src/internal/merge.js").mergeRow,k=F("packages/core/src/source/rows.js"),b=k.createRowFactory,a=k.groupKey,g=k.groupPathElement,o=k.groupPrefixKeys,t=k.lazyRowView,s=F("packages/core/src/source/handles.js").createHandleProvider,i=F("packages/core/src/compute/incremental.js"),n=i.RunningTotal,m=i.isIncremental,l=F("packages/core/src/compute/handle.js").presenceReader,u=F("packages/core/src/source/filterwire.js"),f=u.querySignature,p=u.mapConditions,y=u.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"),G=P.PIPELINE_SETTLE_REASONS,V=P.isPipelineSettle,K=Object.freeze(["filter","sort","group","total","pivot","flatten"]),H=Object.freeze([]);function T(J,D){if(!J)return null;const te=D==="grand"?J.grandTotal:J.groupTotal;return te??J.total}function A(J){return!!J&&!J.running}function S(J){if(J)return J.value&&U(J.value.compare)?J.value.compare:U(J.compare)?J.compare:void 0}function R(J){const D=J&&J.dataType;return!D||!U(D.items)?null:{items:D.items,type:J.itemType&&J.itemType.name||"text"}}function j(J){return!!J&&(typeof J=="object"||typeof J=="function")&&U(J.then)}const N=new Uint32Array(0),$=4096;function _(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;#o;#l=new Map;#a=!1;#c=0;#u=0;#f=new Map;#d=new Map;#h;#p=null;#m=Z.#g();static#g(){return{slots:[],groupHeadings:H,unnumbered:H,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");#L=new Map;#_=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.#o=s(this.#e,()=>this.#n,()=>this.#r),this.#h=new E(Number(z.rowCacheSize)||$);for(const X of K)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.#He(te.offset+D,D);if(!(D<0||D>=this.#F.length))return this.#He(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.#He(z)}}loaded(D){return D>=0&&D<this.count()}hint(D,te){}display(){return this.#U(),this.#_||(this.#_=this.#$e()),this.#_}invalidateQuickText(){this.#L.clear(),this.invalidate("filter")}invalidate(D){const te=K.indexOf(D);te<0&&x(`unknown pipeline stage "${D}"; expected one of ${K.join(", ")}`);for(let z=te;z<K.length;z++){const X=this.#l.get(K[z]);X.key=null,X.computed=!1}this.#_=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 re of D.remove){const ae=this.#Ce(re);if(ae===void 0){te.push({operation:"remove",id:this.#_e(re),reason:"unknown-id"});continue}z.removed.push(this.#s.keyOf(this.#r?this.#Qe(ae):this.#n[ae],ae)),this.#r||(this.#n[ae]=void 0),this.#h.delete(ae),this.#L.delete(ae),X=!0}if(D.update&&D.update.length){const re=this.#O.size||this.#at()?this.#Ke():null,ae=this.#v.size?this.#ht():null,fe=ae&&ae.length?this.#Ke():null;for(const we of D.update){const ve=this.#Ce(we);if(ve===void 0){te.push({operation:"update",id:this.#Le(we),reason:"unknown-id"});continue}const Re=this.#r?this.#i&&this.#i.has(ve)?this.#i.get(ve):this.#Qe(ve):this.#n[ve],$e=O(Re,we);for(const be of this.#le(Re,$e))ne.add(be);if(this.#r||(this.#n[ve]=$e),re&&this.#Je(re,ve,Re,$e),fe&&this.#We(ae,fe,ve,Re,$e),this.#p){const be=this.#s.keyOf(Re,ve),se=this.#s.keyOf($e,ve);be!==se&&(this.#p.delete(be),this.#p.set(se,ve))}this.#h.delete(ve),this.#L.delete(ve),z.updated.push(this.#ce(ve))}}if(D.add&&D.add.length&&this.#r){typeof D.at=="number"&&D.at<this.#j()&&(this.#h.clear(),this.#L.clear()),this.#p=null;for(const re of D.add){const ae=this.#ae(this.#Le(re));ae!==void 0&&z.added.push(this.#ce(ae))}X=!0}else if(D.add&&D.add.length){let re=typeof D.at=="number"?D.at:this.#n.length;if(re<this.#n.length){let we=0;for(let ve=0;ve<this.#n.length;ve++)this.#n[ve]!==void 0&&we++;if(we!==this.#n.length){let ve=0;for(let Re=0;Re<this.#n.length;Re++)this.#n[Re]!==void 0&&(this.#n[ve++]=this.#n[Re]);this.#n.length=ve,this.#p=null,this.#h.clear(),this.#L.clear()}}const ae=this.#n.length;re=Math.max(0,re);let fe=D.add===this.#n?D.add.slice():D.add;if(this.#s.keyed){const we=[];for(const ve of fe){const Re=this.#Le(ve);if(this.#Ce(Re)!==void 0){te.push({operation:"add",id:Re,reason:"duplicate-id"});continue}we.push(ve)}we.length!==fe.length&&(fe=we)}if(!fe.length)return z;if(re>=ae)for(let we=0;we<fe.length;we++)this.#n.push(fe[we]);else this.#n.splice(re,0,...fe),this.#h.clear(),this.#L.clear();for(let we=0;we<fe.length;we++)z.added.push(this.#ce(re>=ae?ae+we:re+we));X=!0}return this.#c++,X&&(this.#p=null,this.#lt()),this.#o.invalidate(),this.#_=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 H;let z=0,X=te.length-1,ne=-1;for(;z<=X;){const ae=z+X>>1;te[ae].at<=D?(ne=ae,z=ae+1):X=ae-1}if(ne<0)return H;const re=[];for(let ae=te[ne].row;ae;ae=ae.parent)re.push(ae);return re.reverse(),re}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 re=z+X>>1;te[re].at<=D?(ne=re,z=re+1):X=re-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 ae=0;ae<z.length;ae++)z[ae]!==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 ae=0;for(let fe=0;fe<z.length;fe++)z[fe]!==void 0&&(z[ae++]=z[fe]);z.length=ae}const[re]=z.splice(D,1);return z.splice(ne,0,re),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#L.clear(),this.#lt(),this.#o.invalidate(),this.#_=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.#L.clear(),this.#h.clear(),this.#lt(),this.#o.invalidate(),this.invalidate("filter"),this.#bt("model:changed",{reason:"reload"})}destroy(){this.#ue(),this.#h.clear(),this.#L.clear(),this.#p=null,this.#F=[],this.#X=null,this.#_=null,this.#lt();for(const D of K)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.#L.clear(),this.#h.clear(),this.#lt(),this.#o.invalidate(),this.invalidate("filter")}notePriorRows(D){this.#i=D||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#L.clear(),this.#o.invalidate()}data(){if(!this.#r)return this.#n;const 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(ae=>({colId:ae.id,handle:this.#o.handle(ae.id),fn:T(ae,"group")})).filter(ae=>ae.handle&&ae.fn),re=this.#e.config||{};return te({rowHandles:z.map(ae=>this.#o.handle(ae)).filter(Boolean),columnHandles:X.map(ae=>this.#o.handle(ae)).filter(Boolean),measures:ne,leaves:D||new Uint32Array(0),opts:{locale:re.locale,separator:(re.pivot||{}).separator,maxColumns:(re.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=[],re=ae=>{const fe=ae.row&&ae.row.children;if(fe&&fe.length){for(const we of fe){const ve=z.nodes.get(we.key);ve&&re(ve)}return}if(ae.leaves)for(let we=0;we<ae.leaves.length;we++)ne.push(this.#ce(ae.leaves[we]))};return re(X),ne}#_e(D){return typeof D=="string"?D:this.#Le(D)}#Le(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 re=ne.value&&ne.value.deps;return Array.isArray(re)&&re.length?re.some(ae=>this.#Z(String(ae),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.#a){this.#a=!0;try{this.#Ee()}finally{this.#a=!1}}}pipelineRunning(){return this.#a}#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.#xe(),()=>this.#kt(z)),this.#ye(z,X)}#re(D){const te=this.#l.get("sort"),z=this.#H();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 re=this.#Fe(ne.col);if(re&&re.running)continue;if(re&&re.value&&U(re.value.compare))return null;const ae=this.#o.handle(ne.col);if(!ae)return null;z.push({col:ne.col,descending:ne.dir==="desc",nullsFirst:!!ne.nullsFirst,locale:te}),X.push(ae)}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 re=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((ae,fe)=>({...ae,handle:X.handles[fe]})),D,{signal:ne.signal,key:"sort"});if(!j(re)){this.#b.delete("sort"),this.#de("sort",()=>te,()=>re),this.#se(!1);return}this.#se(!0),re.then(ae=>this.#ve(te,ae),ae=>this.#Se("sort",te,ae))}#ve(D,te){const z=this.#b.get("sort");if(!(!z||z.key!==D)){if(this.#H()!==D){this.#b.delete("sort"),this.#se(!1);return}this.#b.delete("sort"),this.#de("sort",()=>D,()=>te),this.#_=null,this.#U(),this.#bt("model:changed",{reason:G[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.#H()===te){const ne=this.#de("filter",()=>this.#$(),()=>this.#Ve());this.#de("sort",()=>te,()=>this.#k(ne)),this.#_=null,this.#U(),I("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",z),this.#bt("model:changed",{reason:G[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.#_=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}`}#H(){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,re=new Float64Array(X);for(let ae=0;ae<X;ae++)re[ae]=ne+ae;for(let ae=0;ae<ne;ae++){const fe=z.get(te.keys[ae]);fe!==void 0&&(re[fe]=ae)}return Uint32Array.from(D).sort((ae,fe)=>re[ae]-re[fe])}orderedKeys(){this.#p||this.#Ae();const D=this.#p,te=new Map;for(const[ae,fe]of D)te.set(fe,ae);const z=Uint32Array.from([...te.keys()]).sort(),X=this.#he(),ne=X?this.#ie(z,X):this.#k(z),re=new Array(ne.length);for(let ae=0;ae<ne.length;ae++)re[ae]=te.get(ne[ae]);return re}#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",[]))}`}#xe(){const te=this.#je()||!this.#oe()?this.#J("total"):"x",z=`${this.#St()}`,X=this.#it("flatten.keys",z,()=>{const re=this.#z("expanded",null);return re?[...re].sort().join(""):"*"}),ne=this.#it("flatten.detail",z,()=>{const re=this.#z("detail",null);return re&&U(re.signature)?re.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.#L.clear(),this.#_=null}invalidateHandles(){this.#o.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),re=String(this.#z("quick","")||"").trim().toLowerCase(),ae=re?Y(re,String(this.#z("quickMode","contains")||"contains")):null,fe=(this.#e.config||{}).hostFilter,we=!!(fe&&U(fe.active)&&fe.active()),ve=this.#z("where",null),Re=!!(ve&&ve.active);if(!ne&&!re&&!we&&!Re)return te;let $e=null;ne&&($e=this.#ft("evaluateFilters")(ne,{handle:oe=>this.#o.handle(oe),count:this.#j(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:oe=>R(this.#Fe(oe)),typeOf:oe=>{const ce=this.#Fe(oe);return ce?ce.type:void 0}}));const be=new Uint32Array(te.length);let se=0;for(let de=0;de<te.length;de++){const oe=te[de];if(!($e&&!$e[oe])&&!(ae&&!this.#Be(oe,ae))){if(we||Re){const ce=this.#ce(oe);if(we&&!fe.passes(ce)||Re&&!ve.passes(ce.data,ce.key))continue}be[se++]=oe}}if($e){const de=(this.#e.compute||{}).releaseMask;U(de)&&de({pool:this.#e.pool},$e)}return be.subarray(0,se)}handleFor(D){return this.#o.handle(D)}#k(D){const te=this.#he();if(te)return this.#ie(D,te);const z=this.#z("sort",[]).filter(re=>{const ae=this.#Fe(re.col);return!ae||!ae.running?!0:(I(`source.sort.running.${re.col}`,`sort ignores "${re.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 re=z[0],ae=this.#o.handle(re.col);if(!ae)return I(`source.sort.${re.col}`,`sort ignores unknown column "${re.col}".`),D;const fe=this.#Fe(re.col);return this.#ft("sortColumn")(ae,D,{descending:re.dir==="desc",nullsFirst:re.nullsFirst,locale:X,compare:S(fe)})}const ne=[];for(const re of z){const ae=this.#o.handle(re.col);if(!ae){I(`source.sort.${re.col}`,`sort ignores unknown column "${re.col}".`);continue}ne.push({handle:ae,descending:re.dir==="desc",nullsFirst:re.nullsFirst,locale:X,compare:S(this.#Fe(re.col))})}return ne.length?this.#ft("sortMulti")(ne.map(re=>re.handle),ne,D):D}#Ie(D){const te=this.#z("groupBy",[]),z=this.#fe();if(z&&!te.length){const de=d(D,z);return this.#R=v(de.roots,z.declaresChildren),{roots:null,leaves:D,nodes:new Map,tree:de}}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=[],re=[];let ae=!1;for(const de of te){const oe=this.#o.handle(de);if(!oe){I(`source.group.${de}`,`grouping ignores unknown column "${de}".`);continue}ne.push(oe);const ce=this.#Fe(de),he=ce&&ce.dataType;if(he&&U(he.groupProjector)){const Oe=ce.typeOptions&&ce.typeOptions.timeZone||X||void 0,Se=he.groupProjector(ce,Oe);re.push(Se||null),Se&&(ae=!0)}else re.push(null)}if(!ne.length)return{roots:null,leaves:D,nodes:new Map};const{keys:fe,buckets:we}=this.#ft("groupByColumns")(ne,D,{locale:(this.#e.config||{}).locale,project:ae?re:void 0}),ve=this.#z("pivotBy",[]).length>0,Re=[],$e=new Map;for(let de=0;de<we.length;de++){const oe=fe[de];let ce=null;const he=[];for(let Oe=0;Oe<oe.length;Oe++){he.push(g(oe[Oe]));const Se=a(he),Ce=Oe===oe.length-1;let Ie=$e.get(Se);if(!Ie){const ke=this.#s.group({path:[...he],column:te[Oe],value:oe[Oe],level:Oe,parent:ce,expanded:ve&&Ce?!1:this.#gt(Se,{key:Se,column:te[Oe],value:oe[Oe],level:Oe,path:[...he]}),hasChildren:!(ve&&Ce)});Ie={row:ke,leaves:null},$e.set(Se,Ie),ce?ce.children.push(ke):Re.push(ke)}Ie.row.leafCount+=we[de].length,Oe===oe.length-1&&(Ie.leaves=we[de]),ce=Ie.row}}const be=this.#z("sort",[])||[],se=(de,oe)=>{if(!de||de.length<2){if(de)for(const Se of de)se(Se.children,oe+1);return}const ce=te[oe],he=be.find(Se=>Se.col===ce),Oe=he&&he.dir==="desc"?-1:1;de.sort((Se,Ce)=>Oe*q(Se.groupValue,Ce.groupValue));for(const Se of de)se(Se.children,oe+1)};return se(Re,0),{roots:Re,leaves:D,nodes:$e,keys:fe,buckets:we}}#Ye(D,te){const z=new Map,X=new Map,ne=re=>{const ae=re.physical>=0?[re.physical]:[];for(const fe of re.children)ae.push(...ne(fe));if(re.children.length){const fe=this.#Xe(te,Uint32Array.from(ae),null);re.physical>=0?z.set(re.physical,fe):X.set(re.key,fe)}return ae};for(const re of D.roots)ne(re);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(be=>be.id).join("")},X=this.#E&&this.#E.id===z.id&&this.#E.columns===z.columns,ne=this.#at()&&X?this.#C:null,re=ne?te.filter(be=>ne.has(be.id)):te,ae=X?this.#T:null,fe=this.#rt()?null:this.#Tt(),we=this.#Pe(te),ve=be=>{const se=D.nodes.get(be.key);let de=se&&se.leaves?se.leaves:null;if(be.children&&be.children.length){const he=be.children.map(ve);let Oe=0;for(const Ie of he)Oe+=Ie.length;const Se=new Uint32Array(Oe);let Ce=0;for(const Ie of he)Se.set(Ie,Ce),Ce+=Ie.length;de=Se}de=de||new Uint32Array(0);const oe=fe?fe.get(be.key)||N:de,ce=this.#Ze(be,ne?re:te,oe,we);return be.totals=ne?{...be.totals,...ce}:ce,de};if(D.roots&&re.length)for(const be of D.roots)ve(be);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 $e=fe?this.#st():D.leaves;return this.#T=this.#Oe(te,$e,ne,ae),{grand:this.#T}}#Oe(D,te,z,X){const ne={},re=this.#J("group");re!==this.#w&&(this.#ct(),this.#w=re);const ae=this.#A;this.#A=[];for(const fe of D){if(!A(fe))continue;const we=this.#o.handle(fe.id);if(!we)continue;const ve=T(fe,"grand");if(!m(ve,we)){if(z&&!z.has(fe.id)&&X&&fe.id in X){ne[fe.id]=X[fe.id];continue}ne[fe.id]=this.#Xe([fe],te,null,"grand")[fe.id];continue}let Re=this.#O.get(fe.id);if((!Re||Re.fn!==ve)&&(Re=new n(ve),this.#O.set(fe.id,Re)),Re.valid){let $e=!0;for(const be of ae)if(be.colId===fe.id&&!Re.update(be.before,be.after)){$e=!1;break}if($e){ne[fe.id]=Re.value();continue}Re.invalidate()}Re.seedColumn(we.values,l(we),te),ne[fe.id]=Re.valid?Re.value():this.#Xe([fe],te,null,"grand")[fe.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(!A(ne))continue;const re=this.#o.handle(ne.id),ae=T(ne,"group");m(ae,re)&&z.set(ne.id,{fn:ae})}if(!z.size)return this.#S.length=0,z;const X=this.#S;this.#S=[];for(const ne of X){const{beforeKeys:re,afterKeys:ae,colDeltas:fe}=ne,we=re.length?new Set(re):null,ve=ae.length?new Set(ae):null;for(const{colId:Re,before:$e,after:be}of fe)if(z.has(Re)){for(const se of re)ve&&ve.has(se)||this.#dt(se,Re,$e,null);for(const se of ae)we&&we.has(se)||this.#dt(se,Re,null,be);for(const se of re)ve&&!ve.has(se)||this.#dt(se,Re,$e,be)}}return z}#dt(D,te,z,X){const ne=this.#v.get(D),re=ne&&ne.get(te);!re||!re.valid||re.update(z,X)||re.invalidate()}#Ze(D,te,z,X){if(!X||!X.size)return this.#Xe(te,z,D);const ne={};let re=null,ae=this.#v.get(D.key);for(const fe of te){const we=X.get(fe.id);if(!we){(re||(re=[])).push(fe);continue}const ve=this.#o.handle(fe.id);if(!ve)continue;ae||(ae=new Map,this.#v.set(D.key,ae));let Re=ae.get(fe.id);if((!Re||Re.fn!==we.fn)&&(Re=new n(we.fn),ae.set(fe.id,Re)),Re.valid||Re.seedColumn(ve.values,l(ve),z),Re.valid){ne[fe.id]=Re.value();continue}(re||(re=[])).push(fe)}return re&&Object.assign(ne,this.#Xe(re,z,D)),ne}#Je(D,te,z,X){const ne=!this.#rt()||this.#Et(te);for(const re of D){const ae=re.getValue;if(!U(ae))continue;const fe=ae(z),we=ae(X);Object.is(fe,we)||(this.#C&&this.#C.add(re.id),ne&&this.#O.has(re.id)&&this.#A.push({colId:re.id,before:fe,after:we}))}}#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 re=o(this.#pt(D,X)),ae=o(this.#pt(D,ne)),fe=re.length!==ae.length||re.some((ve,Re)=>ve!==ae[Re]),we=[];for(const ve of te){const Re=ve.getValue;if(!U(Re))continue;const $e=Re(X),be=Re(ne);!fe&&Object.is($e,be)||we.push({colId:ve.id,before:$e,after:be})}!we.length&&!fe||this.#S.push({beforeKeys:re,afterKeys:ae,colDeltas:we})}#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 re=X+ne>>1,ae=z[re];if(ae===D)return!0;ae<D?X=re+1:ne=re-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 re=this.#o.handle(ne);re&&X.push(re)}if(X.length){const ne=this.#st(),{keys:re,buckets:ae}=this.#ft("groupByColumns")(X,ne,{locale:(this.#e.config||{}).locale}),fe=new Map;for(let we=0;we<ae.length;we++){const ve=re[we],Re=[];for(let $e=0;$e<ve.length;$e++){Re.push(g(ve[$e]));const be=a(Re);let se=fe.get(be);se||(se=[],fe.set(be,se));for(let de=0;de<ae[we].length;de++)se.push(ae[we][de])}}for(const[we,ve]of fe)z.set(we,Uint32Array.from(ve))}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(re=>this.#o.handle(re)).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(re=>re.id),handle:re=>this.#o.handle(re),totalOf:re=>T(ne.find(ae=>ae.id===re),"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 ve=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]=ve;else{const Re=Array.from(D.leaves);Re.push(ve),this.#F=Re,this.#X=D.leaves}this.#B=[{at:this.#F.length-1}]}else this.#X=null,this.#F=D.leaves,this.#B=H;return this.#V=H,this.#F}const ne=[],re=[],ae=[],fe=ve=>{if(ne.push(ve),!X)return;const Re=this.#ce(ve);!Re||!X.isOpen(Re.key)||(Re.master=!0,Re.expanded=!0,ae.push({at:ne.length}),ne.push(this.#s.detail(Re,X.heightOf(Re))))};if(!D.roots){for(let ve=0;ve<D.leaves.length;ve++)fe(D.leaves[ve]);return te&&te.grand&&!this.#oe()&&(ae.push({at:ne.length}),ne.push(this.#s.grandTotal(te.grand,this.#te(D.leaves.length)))),this.#X=null,this.#V=H,this.#B=ae.length?ae:H,this.#F=ne,ne}const we=(ve,Re,$e)=>{if(ve.expanded=ve.hasChildren===!1?!1:this.#gt(ve.key,{key:ve.key,column:ve.groupColumn,value:ve.groupValue,level:ve.level,path:ve.groupPath}),ve.posinset=Re+1,ve.setsize=$e,re.push({at:ne.length,row:ve}),ae.push({at:ne.length}),ne.push(ve),!!ve.expanded){if(ve.children&&ve.children.length)for(let be=0;be<ve.children.length;be++)we(ve.children[be],be,ve.children.length);else{const be=D.nodes.get(ve.key),se=be&&be.leaves?be.leaves:null;if(se)for(let de=0;de<se.length;de++)fe(se[de])}z&&ve.totals&&(ae.push({at:ne.length}),ne.push(this.#s.footer(ve)))}};for(let ve=0;ve<D.roots.length;ve++)we(D.roots[ve],ve,D.roots.length);return te&&te.grand&&!this.#oe()&&(ae.push({at:ne.length}),ne.push(this.#s.grandTotal(te.grand,this.#te(D.leaves.length)))),this.#V=re,this.#B=ae,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]}#He(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=[],re=fe=>{if(fe.leafCount!==void 0)return fe.leafCount;let we=fe.physical>=0?1:0;for(const ve of fe.children)we+=re(ve);return fe.leafCount=we,we},ae=fe=>{const we=this.#gt(fe.key);if(fe.physical>=0){if(X.push(fe.physical),z&&z.isOpen(this.#ce(fe.physical).key)){const ve=this.#ce(fe.physical);ne.push({at:X.length}),X.push(this.#s.detail(ve,z.heightOf(ve)))}}else X.push(this.#s.group({path:[fe.key],column:null,value:fe.value,level:fe.level,parent:null,expanded:we,hasChildren:fe.children.length>0,leafCount:re(fe),totals:this.#D?this.#D.byKey.get(fe.key):void 0}));if(we)for(const ve of fe.children)ae(ve)};for(const fe of D.tree.roots)ae(fe);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=H,this.#B=ne.length?ne:H,this.#F=X,X}#$e(){return t(()=>this.count(),D=>this.at(D))}#Be(D,te){let z=this.#L.get(D);if(z===void 0){const X=this.#Qe(D),ne=this.#At(),re=[],ae=this.#e.columnHidden;for(const fe of ne){if(fe.quickFilter===!1||U(ae)&&ae(fe.id))continue;const we=fe.value&&U(fe.value.quickFilterText)?fe.value.quickFilterText({value:void 0,data:X,row:null,column:fe,colId:fe.id,grid:null,context:this.#z("context",null)}):null,ve=we??(U(fe.formatValue)?fe.formatValue(U(fe.getValue)?fe.getValue(X):void 0):"");ve!=null&&ve!==""&&re.push(String(ve))}z=re.join(" ").toLowerCase(),this.#L.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={},re=(this.#e.compute||{}).total;for(const ae of D){if(!A(ae))continue;const fe=this.#o.handle(ae.id);if(!fe)continue;const we=T(ae,X);if(we)if(U(we)){const ve=new Array(te.length);for(let Re=0;Re<te.length;Re++)ve[Re]=fe.get(te[Re]);ne[ae.id]=we(ve,{row:z,column:ae,grid:this.#e.grid||null,context:this.#z("context",null),valueAt:(Re,$e)=>{const be=this.#o.handle(Re);return be&&$e>=0&&$e<te.length?be.get(te[$e]):null}})}else U(re)&&(ne[ae.id]=re(fe,te,we))}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),re=this.#Fe(ne&&ne.col),ae=re&&re.type==="datetime";if(ne&&ne.type)return ne.type==="datetime"&&!ne.timeZone&&re?{...ne,timeZone:te.timeZone||void 0}:ne;if(ae)return{...ne,type:"datetime",timeZone:te.timeZone||void 0};const fe=re&&(re.dataType?.base||re.type);return fe?{...ne,type:fe}: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)||x(`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)}}}),He("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 W}}),Object.defineProperty(e,"createAbortScope",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return x}});class ie extends Error{constructor(U,L="superseded"){super(`[lattice] request ${U?`"${U}" `:""}${L}`),this.name="SupersededError",this.superseded=!0,this.key=U}}class E{#e;constructor(U,L,q,M){this.#e=U,this.key=L,this.controller=q,this.signal=q.signal,this.seq=M}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 W{#e=new Map;#t=0;begin(U="",L="superseded"){const q=this.#e.get(U);q&&!q.signal.aborted&&q.controller.abort(new ie(U,L));const M=new E(this,U,new AbortController,++this.#t);return this.#e.set(U,M),M}tokenFor(U){return this.#e.get(U)}pending(U=""){const L=this.#e.get(U);return!!L&&!L.signal.aborted}get size(){return this.#e.size}settle(U){this.#e.get(U.key)===U&&this.#e.delete(U.key)}abort(U="",L="superseded"){const q=this.#e.get(U);q&&q.abort(L)}abortAll(U="superseded"){for(const L of[...this.#e.values()])L.abort(U);this.#e.clear()}}function I(){return new W}function x(Q){if(!Q||typeof Q!="object")return!1;const U=Q;return U.superseded===!0||U.name==="AbortError"||U.name==="SupersededError"}}),He("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 W{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 L=this.#e.get(Q);return L||(L=new W(Q)),L.state="pending",L.token=U,L.error=null,this.#s(Q,L),L}fill(Q,U){const L=this.#e.get(Q)||new W(Q);L.rows=U,L.state="loaded",L.token=null,this.#s(Q,L)}failed(Q,U){const L=this.#e.get(Q)||new W(Q);L.state="error",L.error=U,L.token=null,this.#s(Q,L)}delete(Q){return this.#e.delete(Q)}rowAt(Q){const U=this.blockOf(Q),L=this.#e.get(U);if(!(!L||L.state!=="loaded"||!L.rows))return this.#s(U,L),L.rows[Q-U*this.#t]}rowLoaded(Q){const U=this.blockOf(Q),L=this.#e.get(U);return!!L&&L.state==="loaded"&&!!L.rows&&Q-U*this.#t<L.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 L=U.id*this.#t+U.rows.length;L>Q&&(Q=L)}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,L]of this.#e){if(this.#e.size-Q.length<=this.#n)break;U>=this.#r&&U<=this.#i||L.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)}}}),He("packages/core/src/source/pagewindow.js",function(e,F){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return ie}});function ie(E,W,I,x){const Q=Math.floor(Number(E)||0);if(Q<=0)return null;const U=Math.max(0,Math.floor(Number(W)||0)),L=Math.max(0,Math.floor(Number(I)||0));if(x){const q=Math.max(1,Math.ceil(L/Q)),M=Math.min(U,q-1),O=M*Q;return{page:M,pageSize:Q,offset:O,length:Math.max(0,Math.min(Q,L-O)),pageCount:q,total:L}}return{page:U,pageSize:Q,offset:U*Q,length:Q,pageCount:Math.max(U+2,Math.ceil(L/Q)),total:null}}}),He("packages/core/src/source/paged.js",function(e,F){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return u}}),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,L=F("packages/core/src/internal/schedule.js").settleDebounce,q=F("packages/core/src/source/abort.js"),M=q.createAbortScope,O=q.isAbortError,k=F("packages/core/src/source/blockcache.js"),b=k.BlockCache,a=k.DEFAULT_PAGE_SIZE,g=k.DEFAULT_MAX_CACHED_PAGES,t=F("packages/core/src/source/rows.js").createRowFactory,r=F("packages/core/src/source/filterwire.js"),s=r.wireFilters,i=r.querySignature,n=r.warnHostFilterNotApplied,c=F("packages/core/src/source/pagewindow.js").pageWindow,l=120;function u(p,y){return new f(p,y)}class f{mode="paged";#e;#t;#n;#r=M();#i;#s;#o=new Map;#l=null;#a=null;#c=!1;#u=0;#f="";#d={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(y,h){this.#e=y||{mode:"paged"},this.#t=h||{},this.#n=new b({pageSize:this.#e.pageSize||a,maxCachedPages:this.#e.maxCachedPages||g}),this.#i=t(this.#t),this.#s=new E(this.#n.pageSize*4),this.#h=L((d,w)=>this.#w(d,w),l),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=c(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.#o.set(w.key,y),w}byKey(y){const h=this.#o.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,G)=>P-G);for(const P of v){if(!this.#n.loaded(P))continue;const{start:G}=this.#n.rangeOf(P),V=this.#n.fillOf(P)||0;for(let K=G;K<G+V;K++){if(K<h||K>=d)continue;const H=this.#s.peek(K);if(H&&H.data!==null&&H.data!==void 0){w.push(H);continue}const T=this.#n.rowAt(K);if(T===void 0)continue;const A=this.#i.leaf(T,K);A.index=K,this.#s.set(K,A),this.#o.set(A.key,K),w.push(A)}}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 G of this.#n.evict())this.#v(G);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.#o.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.#o.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 G=P&&P.rows||[];this.#n.fill(y,G);for(let K=0;K<G.length;K++)this.#s.delete(d+K);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):G.length<this.#n.pageSize?(this.#c=!0,this.#l=d+G.length):this.#u=Math.max(this.#u,d+G.length),this.#M("model:changed",{reason:"page",block:y,from:d,to:d+G.length}),this.#M("rows:changed",{companion:!0,reason:"page",block:y,from:d,to:d+G.length}),this.#l!==null&&this.#l!==this.#a&&(this.#a=this.#l,this.#M("source:total",{total:this.#l,groupPath:[]}))}catch(P){if(h.settle(),O(P))return;this.#n.failed(y,P);for(let G=d;G<w;G++)this.#s.delete(G);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.#o.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.#o.clear(),this.#l=null,this.#a=null,this.#c=!1,this.#u=0,this.#m++,this.#M("model:changed",{reason:y})}#C(){return i({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)}}}),He("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 W}}),Object.defineProperty(e,"aggregateP",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return x}}),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 M}});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 O=new Set;for(const[k,b]of Object.entries(ie))b.pushable&&O.add(k);return O}function W(O,k,b,a="?"){let g=O.split("%c").join(k);return b!==void 0&&(g=g.split("%w").join(b)),g.split("%p").join(a)}function I(O){const k=O&&(O.p!==void 0?O.p:O.params&&O.params.p);return typeof k=="number"&&k>=0&&k<=1?k:void 0}function x(O){const k=O||{},b=k.default==="engine"||k.default==="engine-if-identical"?k.default:"client",a={};if(k.overrides&&typeof k.overrides=="object")for(const[g,o]of Object.entries(k.overrides))(o==="engine"||o==="client")&&(a[g]=o);return{default:b,overrides:a}}function Q(O,k){const b=ie[O];if(!b||!b.pushable)return"client";const a=k.overrides[O];return a==="engine"||a==="client"?a:k.default==="client"?"client":k.default==="engine-if-identical"?b.class==="identical"?"engine":"client":"engine"}function U(O,k){const b=x(k),a=[],g=[];for(const o of O||[]){const t=ie[o.fn],r=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 i=I(o);i!==void 0&&(s.p=i)}if(r==="engine"&&t&&t.parametric&&s.p===void 0){g.push({...s,reason:`"${o.fn}" needs \`p\`, a number from 0 to 1`});continue}r==="engine"?a.push(s):(s.reason=t&&!t.pushable?t.note||"the engine cannot express this stat":"client by config",g.push(s))}return{engine:a,client:g,config:b}}const L=/^[A-Za-z_][A-Za-z0-9_$]*$/;function q(O,k=[]){return(O||[]).every(a=>{if(typeof a=="string")return L.test(a);if(!a||typeof a!="object")return!1;const g=a;return Array.isArray(k)&&k.includes(g.bucket)&&typeof g.col=="string"&&L.test(g.col)&&typeof g.size=="number"&&Number.isFinite(g.size)&&g.size>0})}function M(){return Object.entries(ie).map(([O,k])=>({stat:O,class:k.class,sql:k.sql?W(k.sql,"col",k.twoColumn?"weight":void 0):"",note:k.note||(k.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),He("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 l}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return u}}),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 K}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return A}}),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,L=F("packages/core/src/internal/warn.js").warnOnce,q=F("packages/core/src/source/filterwire.js"),M=q.isGroup,O=q.warnWherePageRelative,k=q.warnWhereOverThreshold,b=q.wireFilters,a=F("packages/core/src/source/aggregates.js"),g=a.resolveAggregatePlan,o=a.groupKeysPushable,t=a.STAT_PUSHDOWN,r=a.aggregateP,s=a.fillAggregateSql,n=F("packages/core/src/source/abort.js").SupersededError,m=1e3;function c(X){const ne=X&&X.signal;if(!ne||!ne.aborted)return;const re=ne.reason;throw re instanceof Error?re:new n("","superseded before it was sent")}const l=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function u(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 re=X;for(const ae of ne.split(".")){if(re===null||typeof re!="object")return;re=re[ae]}return re}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={...l,...X||{}};return ne.operators=new Set(ne.operators||[]),ne.mutate=u(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(M(X)){const we=X.conditions||[];if(String(X.op)!=="and")return{pushed:null,residual:X};const ve=we.findIndex($e=>!M($e)&&h($e,ne));if(ve<0)return{pushed:null,residual:X};const Re=we.filter(($e,be)=>be!==ve);return{pushed:we[ve],residual:Re.length?{op:"and",conditions:Re}:null}}return h(X,ne)?{pushed:X,residual:null}:{pushed:null,residual:X}}if(!M(X))return h(X,ne)?{pushed:X,residual:null}:{pushed:null,residual:X};if(String(X.op)!=="and")return(X.conditions||[]).every(ve=>M(ve)?d(ve,ne).residual===null:h(ve,ne))?{pushed:X,residual:null}:{pushed:null,residual:X};const re=[],ae=[];for(const we of X.conditions||[]){if(M(we)){if(ne.filter==="flat"){ae.push(we);continue}const ve=d(we,ne);ve.pushed&&re.push(ve.pushed),ve.residual&&ae.push(ve.residual);continue}(h(we,ne)?re:ae).push(we)}const fe=we=>we.length===0?null:we.length===1?we[0]:{op:"and",conditions:we};return{pushed:fe(re),residual:fe(ae)}}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 G(X,ne,re,ae,fe,we,ve){const Re=Array.isArray(X.groupBy)?X.groupBy:[],$e=Array.isArray(X.groupPath)?X.groupPath:[],be=Array.isArray(X.groupValues)?X.groupValues:null;if(!ne.group){const se=P(ne);if(se)return se}return o(Re)?re.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":ae?fe?we&&!we.conditioned?"a host `where` predicate can only run in the browser, over rows the engine grouped":ve?"fullDataset holds the whole matching set, so the grid groups it itself":!be||be.length!==$e.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",K="pushdown:group-unsupported",H=Symbol("lattice.remote.ungroupedLevel");function T(X,ne,re,ae,fe,we){const ve=Array.isArray(X.pivotBy)?X.pivotBy:[],Re=Array.isArray(X.groupBy)?X.groupBy:[],$e=Array.isArray(X.groupPath)?X.groupPath:[],be=Array.isArray(X.groupValues)?X.groupValues:null;return ne.pivot?o(ve)?Re.length&&!o(Re)?"a grouping key is not a plain column the engine can name in a GROUP BY":re.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":ae?fe?we&&!we.conditioned?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!be||be.length!==$e.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 A(X,ne,re=!1){const ae=d(X.filters||null,ne),fe=[];ae.residual&&fe.push("filter");const we=X.sort||[],ve=we.length===0||ne.sort==="multi"&&we.length>=1||ne.sort==="single"&&we.length===1;!ve&&we.length&&fe.push("sort");const Re=X.quick?String(X.quick):"",$e=!Re||!!ne.quick;$e||fe.push("quick");const be=X.where&&X.where.active?X.where:null;be&&fe.push("where");const se={filters:ae.residual,sort:ve?null:we,quick:$e?"":Re,where:be},de=!!re,oe=Array.isArray(X.groupBy)&&X.groupBy.length>0,ce=oe?G(X,ne,ae,ve,$e,be,de):"",he=X.pivotMode!==!1&&Array.isArray(X.pivotBy)&&X.pivotBy.length>0,Oe=he?T(X,ne,ae,ve,$e,be):"",Se=he&&Oe==="";he&&!Se&&fe.push("pivot");const Ce=he?Se&&oe:oe&&ce==="";oe&&!he&&!Ce&&fe.push("group");const Ie=(Ce||Se)&&Array.isArray(X.groupValues)?X.groupValues.length:0;be&&be.conditioned&&(Ce||Se)&&(se.where=null,fe.splice(fe.indexOf("where"),1));const ke=Ce||he?!1:de||!!(se.filters||se.sort||se.quick||se.where)||!ne.range;return{pushed:{...X,filters:ae.pushed,sort:ve?we:[],quick:$e?Re:"",range:ke?null:X.range},residual:se,needsAll:ke,unpushed:fe,full:de,grouped:Ce,groupLevel:Ie,groupReason:he?"":ce,pivoted:Se,pivotReason:Oe}}function S(X){const ne=Array.isArray(X.totals)?X.totals:[],re=X.totalFns&&typeof X.totalFns=="object"?X.totalFns:{},ae=[],fe=[];for(const we of ne){const ve=String(we),Re=re[ve],$e=typeof Re=="string"?Re:Re&&typeof Re.fn=="string"?Re.fn:null,be=Re&&typeof Re=="object"?r(Re):void 0,se=$e?t[$e]:null;se&&se.parametric&&be===void 0?fe.push({id:ve,fn:$e,class:se.class,reason:`"${$e}" needs \`p\`, a number from 0 to 1`}):$e?!se||!se.pushable||!se.sql?fe.push({id:ve,fn:$e,class:se?se.class:"fallback",reason:se&&se.note?se.note:`the pushdown map cannot express "${$e}"`}):se.twoColumn?fe.push({id:ve,fn:$e,class:se.class,reason:`"${$e}" reduces two columns, and a grouped request carries no weight column`}):ae.push({id:ve,col:ve,fn:$e,class:se.class,...be!==void 0?{p:be}:{}}):fe.push({id:ve,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:ae,client:fe}}function R(X){return{...X,engine:X.engine.map(ne=>{const re=t[ne.fn];if(!re||!re.sql)return ne;const ae=fe=>`"${fe}"`;return{...ne,sql:s(re.sql,ae(ne.col),ne.weight!==void 0?ae(ne.weight):void 0)}})}}const j=Object.freeze({items:X=>X==null?[]:Array.isArray(X)?X:[X]});function N(X,ne,re){if(!ne)return X;let ae=X;if(ne.filters&&I(re.evaluateFilters)){const fe=ae,we={count:ae.length,handle:$e=>({id:$e,get:be=>f(fe[be],$e)}),itemwise:$e=>fe.some(be=>Array.isArray(f(be,$e)))?j:null},ve=re.evaluateFilters(ne.filters,we),Re=[];for(let $e=0;$e<ae.length;$e++)ve[$e]&&Re.push(ae[$e]);ae=Re}if(ne.where&&ne.where.active&&(ne.whole||O(ne.where.names,"pushdown"),ae=ae.filter(fe=>ne.where.passes(fe))),ne.quick){const fe=ne.quick.toLowerCase();ae=ae.filter(we=>{if(!we||typeof we!="object")return!1;for(const ve of Object.values(we))if(ve!=null&&String(ve).toLowerCase().includes(fe))return!0;return!1})}if(ne.sort&&ne.sort.length&&I(re.sortMulti)){const fe=[...new Set(ne.sort.map($e=>$e.col))],we=ae,ve=fe.map($e=>({id:$e,get:be=>f(we[be],$e)})),Re=re.sortMulti(ve,ne.sort.map($e=>({col:$e.col,dir:$e.dir})),Uint32Array.from({length:ae.length},($e,be)=>be),{});ae=Array.from(Re,$e=>we[$e])}return ae}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 _(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:re,...ae}=X;return typeof ne=="number"?{...ae,total:ne}:ae}function z(X={}){const ne=X.adapter;if(!ne||!I(ne.execute))return L("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...X,mode:"remote",fetch:async()=>({rows:[],total:0})};const re=y(ne.capabilities),ae=ne.capabilities&&Object.getOwnPropertyDescriptor(ne.capabilities,"operators");ae&&I(ae.get)&&Object.defineProperty(re,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(ne.capabilities.operators||[]),set:()=>{}});const fe=ne.name||"adapter";let we=null;const ve=()=>I(ne.ready)?(we||(we=Promise.resolve(ne.ready()).then(()=>{Object.assign(re,y(ne.capabilities))},Le=>{throw we=null,Le})),we):null,Re=Y(X.fullDataset),$e=!!X.allowPartialResults,be=J(X.whereRowLimit);let se=null;const de=X.aggregates;let oe=null,ce=null,he=null,Oe=null,Se=null,Ce=null,Ie=0,ke=null;const _e=()=>!Re.enabled||!oe?null:(ke!==oe.key&&(Ie++,ke=oe.key),{rows:oe.rows,version:Ie}),Te=async Le=>{const ze=Le.where&&Le.where.active?Le.where:null;if(!ze)return{request:Le,probe:null};if(ze.conditioned){const Ot=A(Le,re,Re.enabled);if(Ot.grouped||Ot.pivoted)return{request:Le,probe:null}}const{where:De,...Ge}=Le,Ve=A(Ge,re,Re.enabled);if(Ve.needsAll)return{request:Le,probe:null};const Qe=$(Ve.pushed);let mt=null;return(!se||se.key!==Qe)&&(re.total?(c(Le),mt=await te(await ne.execute(Ve.pushed,Le)),se={key:Qe,size:mt&&typeof mt.total=="number"?mt.total:null}):se={key:Qe,size:null}),se.size!==null&&se.size<be?{request:Le,probe:null}:(k(ze.names,fe,se.size,be),{request:Ge,probe:mt})},je=async(Le,ze)=>{Ce=null;const De=S(Le.pushed);he={engine:De.engine,client:De.client,groupBy:Le.pushed.groupBy},De.client.length&&L(`source.pushdown.group.totals.${fe}.${De.client.map(Qe=>Qe.id).join(".")}`,`the ${fe} 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(Le.pushed,De.engine,ze)||{};let Ve=Ge.rows||[];return!re.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}},Ae=new Map,Ee=64,Me=async(Le,ze)=>{Ce=null;const De=Le.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!re.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=S(De),Lt=v(re),At=jt.engine.filter(rt=>Lt.has(rt.fn)),Bt=[...jt.engine.filter(rt=>!Lt.has(rt.fn)).map(rt=>({id:rt.id,fn:rt.fn,class:rt.class,reason:`the ${fe} adapter does not compute "${rt.fn}"`})),...jt.client];he={engine:At,client:Bt,groupBy:Ge},Bt.length&&L(`source.pushdown.group.totals.${fe}.${Bt.map(rt=>rt.id).join(".")}`,`the ${fe} 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?Ae.get(Zt):void 0;if(!Xe){for(Xe=Promise.resolve(ne.executeGroupedAggregates(Vt,[dt],nn)),Ae.delete(Zt),Ae.set(Zt,Xe);Ae.size>Ee;)Ae.delete(Ae.keys().next().value);Xe.catch(()=>{Ae.get(Zt)===Xe&&Ae.delete(Zt)})}const ot=await Xe||[];c(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,xt)=>Rt+xt.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=Le=>{typeof Le.matchCount=="number"&&(Oe=Le.matchCount,Se=Le.grand?{totals:Le.grand,leafCount:Le.matchCount}:null)},Ke=async(Le,ze)=>{Ce=null;const De=S(Le.pushed);he={engine:De.engine,client:De.client,groupBy:Le.pushed.groupBy,pivotBy:Le.pushed.pivotBy},De.client.length&&L(`source.pushdown.pivot.totals.${fe}.${De.client.map(Ot=>Ot.id).join(".")}`,`the ${fe} 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(Le.pushed,De.engine,ze)||{};let Ve=Ge.rows||[];!re.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=Le=>{L(`source.pushdown.pivot.${fe}.${Le}`,`pushdown:pivot-unsupported: the ${fe} adapter cannot pivot this query because ${Le}, 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 ${fe} adapter cannot pivot this query because ${Le}, 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=Le,ze},Je=(Le,ze)=>{const De={key:ze,state:"pending",value:null};return Ce=De,Le.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(Le=>{const ze=setTimeout(Le,m);Ct.push(()=>{clearTimeout(ze),Le()})});let st;const it=async Le=>{const ze=ve();ze&&await ze;const Ge=Le&&Le.pivotMode!==!1&&Array.isArray(Le.pivotBy)&&Le.pivotBy.length>0?{request:Le,probe:null}:await Te(Le);c(Le);let Ve=A(Ge.request,re,Re.enabled);if(re.group&&Ve.grouped&&!Ve.pivoted&&!I(ne.executeGroupLevel)&&(L(`source.pushdown.group.method.${fe}`,`the ${fe} 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=A(Ge.request,{...re,group:!1,aggregates:null},Re.enabled)),Ve.pivoted&&!I(ne.executePivotLevel)&&(Ve=A(Ge.request,{...re,pivot:!1},Re.enabled),Ve.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Ve.grouped&&!Ve.pivoted&&!re.group&&!I(ne.executeGroupedAggregates)&&(L(`source.pushdown.group.aggregates.method.${fe}`,`the ${fe} 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=A(Ge.request,{...re,aggregates:null},Re.enabled)),ce=Ve,Ve.pivoted)return Ke(Ve,Le);if(Ve.pivotReason&&et(Ve.pivotReason),Ve.grouped)return re.group?je(Ve,Le):Me(Ve,Le);const mt=!!Ve.groupReason&&!Ve.full;mt?L(`source.pushdown.group-unsupported.${fe}.${Ve.groupReason}`,`pushdown:group-unsupported: the ${fe} 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&&L(`source.pushdown.group.${fe}.${Ve.groupReason}`,`the ${fe} 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,[H]:!0}:Vt;if(!Ve.needsAll){const Vt=Ge.probe||await ne.execute(Ve.pushed,Le),Zt=Vt.rows||[];return D(Vt.pendingTotal)&&Vt.total===void 0?Ot({rows:Zt,pendingTotal:Je(Vt.pendingTotal,$(Ve.pushed))}):(Ce=null,!re.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&&L(`source.pushdown.residual.${fe}.${gt.join(".")}`,`the ${fe} 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,Le));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>Re.maxRows)throw new Error(`[lattice] fullDataset refused: the ${fe} adapter's matching set is ${Xe.toLocaleString()} rows, past the configured maxRows of ${Re.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*_(Zt[0]);if(ot>Re.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${fe} 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(Re.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&&!$e)throw new Error(`[lattice] the ${fe} 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?L(`source.pushdown.partial.residual.${fe}`,`the ${fe} 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.`):L(`source.pushdown.partial.${fe}`,`the ${fe} 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>=be){k(Ve.residual.where.names,fe,Vt,be);const{where:Zt,...Xe}=Ge.request;jt=A(Xe,re,Re.enabled),ce=jt}}const Lt=oe.total!==null&&oe.rows.length>=oe.total,At=N(oe.rows,{...jt.residual,whole:Lt},X.compute||{}),Bt=Le.range?Le.range.start:0,nn=Le.range?Le.range.end:At.length;return Ot({rows:At.slice(Bt,nn),total:At.length})},ct=async(Le,ze,De)=>{const Ve=De&&De.waitForPage&&st&&I(st.pageForegroundIdle)?st.pageForegroundIdle():Nt();Ve&&await Ve;const Qe=ve();Qe&&await Qe;const mt=A(Le,re,Re.enabled);ce=mt;const Ot=g(ze,De&&De.engine?{default:"engine"}:de),gt=Array.isArray(Le.groupBy)?Le.groupBy:[],dt=gt.length>0,jt=!mt.residual.filters&&!mt.residual.quick,Lt=!dt||o(gt,re.buckets);let At=Ot.engine,Bt=Ot.client;if(re.aggregates&&At.length){const ot=re.aggregates instanceof Set?re.aggregates:new Set(Q(re.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 ${fe} 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&&!Lt){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)||{}:(L(`source.pushdown.aggregates.${fe}${dt?".grouped":""}`,`the ${fe} 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 ${fe} 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 he={engine:At,client:Bt,...dt?{groupBy:gt}:{}},{values:Zt,engine:At,client:Bt,...Xe!==void 0?{groups:Xe}:{}}},Tt=async Le=>{ut++;try{return await it(Le)}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(re.mutate&&re.mutate.update){const Le=ze=>{if(!re.mutate||!re.mutate.update)throw new Error(`[lattice] the ${fe} 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:Le}}else L(`source.pushdown.readonly.${fe}`,`edit is enabled but the ${fe} adapter declares mutate: ${re.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 le=$t&&re.mutate&&(re.mutate.append||re.mutate.delete)?{append:re.mutate.append===!0,remove:re.mutate.delete===!0,returning:re.mutate.returning,mutate:(Le,ze)=>ne.mutate(Le,ze||{})}:null,ge=async Le=>{const ze=ve();ze&&await ze;const{range:De,signal:Ge,export:Ve,...Qe}=Le||{},mt={...Qe,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:A(mt,re,Re.enabled),signal:Ge}};async function*ye(Le,ze={}){const{plan:De,signal:Ge}=await ge(Le),Ve=Math.max(1,Math.floor(Number(ze.pageSize))||5e3),Qe={signal:Ge,stream:!0},mt=Le&&Le.range&&Number.isFinite(Number(Le.range.start))&&Number.isFinite(Number(Le.range.end))?{start:Math.max(0,Number(Le.range.start)),end:Math.max(0,Number(Le.range.end))}:null;if(!De.needsAll){const dt=mt?mt.start:0,jt=mt?mt.end:1/0;for(let Lt=dt;Lt<jt;Lt+=Ve){c(Qe);const At=Math.min(Lt+Ve,jt),Bt=await ne.execute({...De.pushed,range:{start:Lt,end:At}},Qe);Bt&&D(Bt.pendingTotal)&&Bt.pendingTotal.then(null,()=>{});const nn=Bt&&Bt.rows||[];if(nn.length&&(yield nn),nn.length<At-Lt)return}return}c(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 Pe=async Le=>{const{plan:ze,signal:De}=await ge(Le);if(!ze.needsAll&&re.total){c({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 ye({...Le,range:void 0}))Ge+=Ve.length;return Ge},Ne=async Le=>{await ve();const ze=b(Le.filters||null,{tz:X.timeZone,weekStartsOn:X.weekStartsOn}),De=Le.quick?String(Le.quick):"";return d(ze,re).residual||De&&!re.quick?null:ne.facets({...Le,filters:ze,quick:De})};return st={...X,edit:ft,rowMutate:le,mode:"remote",fetch:Tt,foregroundIdle:Nt,facetProvider:I(ne.facets)?Ne:void 0,aggregate:ct,countMatching:Pe,streamMatching:ye,capabilitiesOf:y,planQuery:A,wireFilters:b,resolveAggregatePlan:(Le,ze)=>g(Le,ze&&ze.engine?{default:"engine"}:de),STAT_PUSHDOWN:t,lastPlan:()=>ce?{...ce,...he?{aggregates:R(he)}:{},...Ce?{total:{deferred:!0,state:Ce.state,value:Ce.value}}:{}}:null,fullFrame:_e,counts:()=>({match:Oe,total:Oe,pending:!!Ce&&Ce.state==="pending"}),grandTotals:()=>Se},st}}),He("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 K}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return R}});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,L=F("packages/core/src/internal/schedule.js").settleDebounce,q=F("packages/core/src/source/abort.js"),M=q.createAbortScope,O=q.isAbortError,k=F("packages/core/src/source/blockcache.js"),b=k.BlockCache,a=k.DEFAULT_PAGE_SIZE,g=k.DEFAULT_MAX_CACHED_PAGES,o=F("packages/core/src/source/rows.js"),t=o.createRowFactory,r=o.groupKey,s=F("packages/core/src/source/filterwire.js"),i=s.wireFilters,n=s.querySignature,m=s.warnHostFilterNotApplied,l=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,G=F("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,V=1,K=120,H=1e3;function T(j,N,$){for(let _=0;_<Math.max(j.length,N.length);_++){const Y=j[_],Z=N[_],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 A(j,N){return new R(j,N)}class S{constructor(N,$,_,Y){this.path=N,this.keyPath=Y||N,this.values=[],this.level=$,this.key=r(this.keyPath),this.cache=new b(_),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 R{mode="remote";#e;#t;#n;#r;#i=new Map;#s=new Set;#o=M();#l;#a;#c=new Map;#u=[];#f=null;#d="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#O="";#w=null;#A=-1;constructor(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.#L(),this.grandTotalRow=()=>this.#F(),this.unfilteredRows=()=>this.#B(),this.facetIndices=te=>this.#_(te));const _=this.#e.counts;I(_)&&(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||a,maxCachedPages:this.#e.maxCachedPages||g},this.#l=t(this.#t),this.#a=new E(this.#n.pageSize*4),this.#h=L((te,z)=>this.#T(te,z),K),this.#r=new S([],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 _ of $.children.values())if(this.#Te(_.key,this.#we(_))&&!N(_))return!1;return!0};return N(this.#r)}pageInfo(){const N=this.#S(),$=this.totalPending();if(!N){const _=this.#v();return{page:0,pageSize:0,total:this.#P()?_:null,pageCount:1,counting:$}}return{page:N.page,pageSize:N.pageSize,total:N.total,pageCount:N.pageCount,counting:$||N.total===null&&this.#o.size>0&&this.#r.cache.loadedExtent()===0}}#S(){const N=this.#v(),$=l(this.#$("pageSize",0),this.#$("page",0),N,this.#P());if(!$)return this.#O="",null;const _=`${this.#y}:${$.offset}:${$.length}`;return _!==this.#O&&!this.#p&&(this.#O=_,$.length>0&&!this.#N()&&this.#T($.offset,$.offset+$.length-1)),$}at(N){const $=this.#S();if($){if(N<0||N>=$.length)return;const _=this.#C($.offset+N);return _&&(_.index=N),_}return this.#C(N)}#C(N){const $=this.#N();if($)return $.at(N);if(this.#re(),N<0||N>=this.#v())return;const _=this.#Z(this.#r,N);if(!_)return;const Y=this.#G(_.node,_.local);return Y&&(Y.index=N),Y||this.#l.skeleton(N,_.node.level,_.node.cache.erroredAt(_.local))}byKey(N){const $=this.#N();if($)return $.byKey(N);const _=this.#c.get(N);if(!_)return;const Y=_.lastIndexOf(":"),Z=this.#i.get(_.slice(0,Y));return Z&&this.#G(Z,Number(_.slice(Y+1)))||void 0}loaded(N){const $=this.#S();if($){if(N<0||N>=$.length)return!1;N+=$.offset}const _=this.#N();if(_)return _.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 _=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),_&&this.#h.flush()}#E(N,$){const _=this.#v(),Y=new Map;for(let Z=N;Z<=$&&Z<_;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[_,Y]of this.#E(N,$)){_.cache.protect(Y.min,Y.max);const Z=_.cache.blockOf(Y.min),J=_.cache.blockOf(Y.max);for(let D=Z;D<=J&&!(_.count!==null&&D*_.cache.pageSize>=_.count);D++)_.cache.has(D)||this.#ue(_,D)}}apply(N){const $={added:[],updated:[],removed:[]};if(!N)return $;if(N.update)for(const _ of N.update){const Y=this.#c.get(this.#l.keyOf(_,-1));if(!Y)continue;this.#a.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 re=z;re<z+J.cache.pageSize;re++){const ae=J.cache.rowAt(re);if(ae===void 0)break;X.push(re===D?_:ae)}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.#o.abortAll("reload"),this.#h.cancel(),N&&N.keepExpanded===!1&&this.#s.clear(),this.#pe(),this.#H("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#o.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.#H("group:toggled",{key:N,expanded:!0}),this.#H("model:changed",{reason:"expand",key:N}))}collapse(N){this.#s.delete(N)&&(this.#H("group:toggled",{key:N,expanded:!1}),this.#H("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),_=[...N.keys.entries()].sort((Z,J)=>T(Z[1],J[1],$)),Y=_.map(([Z])=>Z);N.result={keys:_.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}#L(){const N=this.#N();return N?N.display():[]}#_(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 _=this.#e.counts,Y=I(_)?_():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 _=this.#e.grandTotals,Y=I(_)?_():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 $=[],_=this.count();for(let Y=0;Y<_;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:i(this.#$("filters",null),this.#J()),sort:this.#$("sort",[]),context:this.#$("context",null)};N&&($.quick=N);const _=this.#$("where",null);return _&&_.active&&($.where=_),$}#ge(){const N=this.#$("groupBy",[]).length,$=[];for(const _ of this.#i.values())if(!(_.level!==N&&!_.flat))for(const Y of _.cache.ids()){if(!_.cache.loaded(Y))continue;const{start:Z,end:J}=_.cache.rangeOf(Y);for(let D=Z;D<J&&_.cache.rowLoaded(D);D++){const te=this.#G(_,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 _=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"&&(_+=J)}return _}residentRows(){const N=this.#N();return N?N.display():this.#$("groupBy",[]).length>0?null:(this.#re(),this.#ge())}#se(N,$,_){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:i(this.#$("filters",null),this.#J()),sort:this.#$("sort",[]),context:this.#$("context",null),signal:_};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 _=this.#o.begin(`${N.key}:${$}`);N.cache.begin($,_);const Y=this.#d,{start:Z}=N.cache.rangeOf($);try{const J=await this.#e.fetch(this.#se(N,$,_.signal));if(!_.current||Y!==this.#d||this.#p)return;_.settle();const D=J&&J.rows||[];if(!!(J&&J[G])&&!N.flat){N.flat=!0,N.children.clear();for(const[ne,re]of[...this.#c])re.startsWith(`${N.key}:`)&&(this.#a.delete(re),this.#c.delete(ne))}N.cache.fill($,D),N.failed=!1;for(let ne=0;ne<D.length;ne++)this.#a.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.#_e(J.pivotFields),J&&J.pivot&&typeof J.pivot=="object"&&this.#ae(J.pivot),this.#H("model:changed",{reason:"page",groupPath:N.path,block:$}),this.#H("rows:changed",{companion:!0,reason:"page",groupPath:N.path,block:$}),this.#fe(N),X&&this.#Me(N,X,Y)}catch(J){if(_.settle(),O(J))return;N.cache.failed($,J),N.failed=!0;const{end:D}=N.cache.rangeOf($);for(let te=Z;te<D;te++)this.#a.delete(`${N.key}:${te}`);this.#H("model:changed",{reason:"page-error",groupPath:N.path,block:$}),this.#H("source:error",{error:J,groupPath:N.path,block:$})}}async#Me(N,$,_){let Y;try{Y=await $}catch(Z){if(_!==this.#d||this.#p)return;N.counting=!1,O(Z)||(N.failed=!0),O(Z)||this.#H("source:error",{error:Z,groupPath:N.path});return}_!==this.#d||this.#p||(N.counting=!1,typeof Y=="number"&&(N.count=Y,N.complete=!0,this.#fe(N),this.#H("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.#H("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(!$&&!_)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,H)});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}#_e(N){N.length===this.#u.length&&N.every(($,_)=>$===this.#u[_])||(this.#u=N,this.#H("column:pivoted",{pivotFields:N,remote:!0}))}#Le(){const N=this.#t.config||{};return N.pivot&&N.pivot.separator||v}#Ce(N){const $=this.#Le(),_=this.#ve();if(!_.length)return N.slice();const Y=[];for(const Z of N)for(const J of _)Y.push(`${Z}${$}${J}`);return Y}#ae(N){const $=this.#Le();this.#f||(this.#f={keys:new Map,cells:new Map,result:null});const _=this.#f;let Y=!1;const Z=D=>{const te=Array.isArray(D)?D:[D],z=w(te,$);return _.keys.has(z)||(_.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||{}))_.cells.set(d(z,te,X),ne)}_.result=null,Y&&this.#_e((this.pivot()||{fields:[]}).fields)}#Ae(N){let $=this.#le(N);for(const _ of N.children.values())this.#Te(_.key,this.#we(_))&&($+=this.#Ae(_));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 _=$,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(_<z)return{node:N,local:Y+_};_-=z,Y=D+1;const X=this.#Ae(te);if(_<X)return this.#Z(te,_);_-=X}const J=this.#le(N);return Y+_<J?{node:N,local:Y+_}:null}#G(N,$){const _=`${N.key}:${$}`,Y=this.#a.get(_);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,re=[...N.path,ne?"":String(X)],ae=[...N.keyPath,ne?null:String(X)];if(D=this.#l.group({path:re,keyPath:ae,column:te,value:X,level:N.level,parent:N.row,leafCount:Number(Z.leafCount)||0,expanded:z?!1:this.#Te(r(ae),{key:r(ae),column:te,value:X,level:N.level,path:re}),...z?{hasChildren:!1}:{}}),D.totals=this.#ne(Z),D.data=Z,!z){let fe=this.#i.get(D.key);fe?fe.row=D:(fe=new S(re,N.level+1,this.#n,ae),fe.row=D,this.#i.set(fe.key,fe)),fe.values=[...N.values,X],N.children.set($,fe)}}else D=this.#l.leaf(Z,$,N.level,N.row);return this.#a.set(_,D),this.#c.set(D.key,_),D}#ne(N){const $=N||{};if($.totals&&typeof $.totals=="object")return $.totals;const _={};for(const Y of this.#ve())Object.hasOwn($,Y)&&(_[Y]=$[Y]);return _}#U(N){const $=this.#i.get(N.key);if(!$||$.row!==N||N.hasChildren===!1)return N;const _=this.#Te(N.key,this.#we($));return N.expanded!==_&&(N.expanded=_),N}#Ee(N,$){const{start:_,end:Y}=N.cache.rangeOf($);for(let Z=_;Z<Y;Z++){const J=`${N.key}:${Z}`,D=this.#a.peek(J);D&&this.#c.delete(D.key),this.#a.delete(J)}}#re(){const N=this.#be();return N===this.#d?!1:(this.#d=N,this.#o.abortAll("query"),this.#pe(),this.#m=!1,this.#H("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.#a.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 _=this.#$("expanded",null);return _?I(_.has)?_.has(N,$):Array.prototype.includes.call(_,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(_=>!!_.total).map(_=>_.id)}#Se(N){const $=this.#t.columns,_={};if(!$||!I($.get))return _;for(const Y of N){const Z=$.get(Y);if(!Z)continue;const J=Z.groupTotal!=null?Z.groupTotal:Z.total;typeof J=="string"?_[Y]=J:J&&typeof J=="object"&&typeof J.fn=="string"&&(_[Y]={...J})}return _}#ye(N,$){const _=this.#t.columns,Y=_&&I(_.get)?_.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 _=this.#t.state;if(_&&I(_[N])){const Y=_[N]();return Y??$}return $}#H(N,$){const _=this.#t.emit;I(_)&&_(N,$)}}}),He("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,x=ie){const Q=new E(I.length+Math.max(1,x));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,x){const Q=I<0?0:I>this.length?this.length:I;this.#r(Q),this.#t===this.#n&&this.#i(),this.#e[this.#t++]=x}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 x=this.#t-I;this.#e.copyWithin(this.#n-x,I,this.#t),this.#t=I,this.#n-=x}else{const x=I-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+x),this.#t=I,this.#n+=x}}#i(){const I=this.#e.length-this.#n,x=new Uint32Array(Math.max(this.#e.length*2,this.#e.length+ie));x.set(this.#e.subarray(0,this.#t),0),x.set(this.#e.subarray(this.#n),x.length-I),this.#e=x,this.#n=x.length-I}}}),He("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 a}}),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 r}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return i}});const ie=F("packages/core/src/internal/schedule.js"),E=ie.now,W=ie.nextFrame,I=F("packages/core/src/internal/warn.js"),x=I.infoOnce,Q=I.warnOnce,L=F("packages/core/src/internal/predicates.js").isFunction,M=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 a(n,m={}){if(m.multi)return"multi";if(n.length===0)return"object";let c=0,l=0,u=0,f=0,p=0;for(let h=0;h<n.length;h++){const d=n[h];typeof d=="number"?c++:typeof d=="boolean"?l++:typeof d=="string"?u++:d instanceof Date?f++:Array.isArray(d)&&p++}const y=n.length;return c===y?"float64":l===y?"bitset":f===y?"float64":u===y?"text":p===y?"multi":"object"}function g(n,m,c){return m<=0||n<c*m?"dictionary":"object"}function o(n,m,c){const l=new Map,u=new Map;for(const V of n){if(V.computed)continue;const K=L(V.read)?V.read:M(V.field||V.id);u.set(V.id,K),l.set(V.id,K)}const f=m?.order??[],p=m?.fns??{},y=m?.deps??{},h=m?.wrapDeps??null,d=f.filter(V=>L(p[V])),w=d.some(V=>y[V]==="*");let v=new WeakMap;const P=V=>{const K={};if(w)for(const[H,T]of u)K[H]=T(V);for(const H of d){const T=y[H];let A;if(T==="*")A=K;else{A={};const S=T||[];for(let R=0;R<S.length;R++){const j=S[R];A[j]=j in K?K[j]:u.get(j)?.(V)}}K[H]=p[H](h?h(A,H):A,{data:V,row:null,column:null,grid:null,context:c})}return K},G=V=>{if(V===null||typeof V!="object"&&typeof V!="function")return P(V);let K=v.get(V);return K===void 0&&(K=P(V),v.set(V,K)),K};for(const V of d)l.set(V,K=>G(K)[V]);return{readers:l,reset(){v=new WeakMap}}}class t{spec;read;kind;inferred;nullable;candidate=!1;distinct=null;change=null;reason="";constructor(m,c){this.spec=m,this.read=c,this.kind="object",this.inferred=!1,this.nullable=m.nullable!==!1}}class r{#e;#t=[];#n=null;#r;#i=0;#s;#o=!1;#l=!1;#a=0;#c;constructor(m,c={},l={}){this.#e=Array.isArray(m)?m:Array.from(m||[]),this.#s={...b,...l};const u=c.columns??[];this.#r=o(u,c.computed??null,c.context),this.#c=this.#e.length>=this.#s.columnarBelow,this.#u(u,c.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.#o||this.#l}get progress(){return this.#i}slice(){if(this.done)return!1;if(this.#s.signal?.aborted)return this.#l=!0,!1;const m=E(),{chunkMs:c,chunkRows:l}=this.#s,u=this.#e.length;do{const f=Math.min(this.#i+l,u);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<u&&E()-m<c);return this.#a+=E()-m,this.#s.onProgress?.({loaded:this.#i,total:u}),this.#i>=u?(this.#h(!0),this.#o=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(m=>({id:m.spec.id,kind:m.kind,nullable:m.nullable,read:m.read,dictionary:m.spec.dictionary})),decisions:this.#t.map(m=>({id:m.spec.id,kind:m.kind,nullable:m.nullable,inferred:m.inferred,distinct:m.candidate||m.change?this.#d(m):null,change:m.change,reason:m.reason})),count:this.#n.count,elapsed:this.#a,cancelled:this.#l}}#u(m,c){const l=this.#e,u=Math.min(this.#s.sampleSize,l.length),f=this.#s.dictionaryRatio,p=c?.pure instanceof Set?c.pure:new Set(c?.pure??c?.order??[]);for(const y of m){if(!y||!y.id)continue;if(y.computed&&(y.pure===!1||c&&!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)??(L(y.read)?y.read:M(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<u&&w.length<this.#s.sampleSize;P++){const G=h(l[P]);G!=null&&w.push(G)}d.inferred=!0;const v=a(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&&x(`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,c){const l=this.#e;for(const u of this.#t){if(!u.candidate||!u.distinct)continue;const f=u.distinct;for(let p=m;p<c;p++){const y=u.read(l[p]);y!=null&&f.add(y)}}}#d(m){if(m.distinct)return m.distinct.size;const c=this.#n.column(m.spec.id);return c?.dict?c.dict.size:0}#h(m){const c=this.#s.dictionaryRatio,l=this.#e.length;for(const u of this.#t){if(!u.candidate)continue;const f=this.#d(u);if(u.kind==="dictionary"&&f>=c*l){const p=this.#n.column(u.spec.id);u.distinct=new Set(p?.dict?p.dict.values():[]),this.#n.convert(u.spec.id,"object"),u.kind="object",u.change="demoted",u.reason=`${f} distinct values is at or above ${c*100}% of ${l} rows`;continue}if(u.kind==="object"&&f>=c*l){u.candidate=!1,u.distinct=null,u.reason=`${f} distinct values is at or above ${c*100}% of ${l} rows`;continue}m&&u.kind==="object"&&f<c*l&&(this.#n.convert(u.spec.id,"dictionary"),u.kind="dictionary",u.change=u.change==="demoted"?null:"promoted",u.reason=`${f} distinct values is below ${c*100}% of ${l} rows`,u.distinct=null),m&&(u.candidate=!1)}}}async function s(n,m={},c={}){const l=new r(n,m,c),u=c.scheduler?.frame??W;for(;l.slice();)await new Promise(f=>{u(f)});return l.result()}function i(n,m={},c={}){const l=new r(n,m,{...c,chunkMs:1/0});for(;l.slice(););return l.result()}}),He("packages/core/src/store/columnpack.js",function(e,F){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return g}});const E=F("packages/core/src/internal/paths.js").pathGetter,W=F("packages/core/src/store/ingest.js"),I=W.inferKind,x=W.decideText,Q=W.INGEST_DEFAULTS,L=F("packages/core/src/store/columnstore.js").toFloat,q=new Set(["float64","int32","bitset","dictionary","object","multi"]);function M(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 O(o){const t=L(o);return Number.isFinite(t)?t|0:0}function k(o){return o==null?[]:Array.isArray(o)?o:[o]}function b(o,t,r,s){if(o.kind)return o.kind;const i=[];for(let c=0;c<t.length&&i.length<Q.sampleSize;c++){const l=t[c];l!=null&&i.push(l)}const n=I(i,{multi:o.multi});if(n!=="text")return n;const m=new Set(i).size;return x(m,i.length,s)}function a(o,t,r={}){const s=t.length|0,i=r.dictionaryRatio??Q.dictionaryRatio,n=[];for(const m of o){const c=E(m.field||m.id),l=m.nullable!==!1,u=new Array(s);for(let d=0;d<s;d++){const w=c(t[d]);u[d]=w===void 0?null:w}const f=b(m,u,s,i),p=l?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=u[w],P=v===null;P||y(w),d[w]=P?NaN:L(v)}h={id:m.id,kind:f,nullable:l,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=u[w],P=v===null;P||y(w),d[w]=P?0:O(v)}h={id:m.id,kind:f,nullable:l,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=u[w],P=v===null;P||y(w),!P&&v&&(d[w>>3]|=1<<(w&7))}h={id:m.id,kind:f,nullable:l,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 G=u[P];if(G===null){d[P]=0;continue}y(P);let V=v.get(G);V===void 0&&(V=w.length,w.push(G),v.set(G,V)),d[P]=V}h={id:m.id,kind:f,nullable:l,values:d,presence:p,offsets:null,table:w};break}case"multi":{const d=[],w=new Map,v=new Uint32Array(s+1),P=[];for(let G=0;G<s;G++){const V=u[G];v[G]=P.length,V===null||y(G);const H=k(V);for(let T=0;T<H.length;T++){const A=H[T];let S=w.get(A);S===void 0&&(S=d.length,d.push(A),w.set(A,S)),P.push(S)}}v[s]=P.length,h={id:m.id,kind:f,nullable:l,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=u[w];v!==null&&y(w),d[w]=v}h={id:m.id,kind:"object",nullable:l,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 r=s=>{ArrayBuffer.isView(s)&&s.buffer&&!t.includes(s.buffer)&&t.push(s.buffer)};for(const s of o.columns)r(s.values),r(s.presence),r(s.offsets);return t}}),He("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 A}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return S}});const E=F("packages/core/src/internal/lru.js").Lru,I=F("packages/core/src/internal/predicates.js").isFunction,x=F("packages/core/src/internal/schedule.js"),Q=x.now,U=x.nextFrame,L=x.cancelFrame,q=x.whenIdle,O=F("packages/core/src/internal/compare.js").defaultCompare,k=F("packages/core/src/internal/warn.js"),b=k.warnOnce,a=k.infoOnce,o=F("packages/core/src/internal/paths.js").getPath,t=F("packages/core/src/source/abort.js"),r=t.createAbortScope,s=t.isAbortError,i=F("packages/core/src/source/rows.js"),n=i.createRowFactory,m=i.lazyRowView,l=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,G=.1,V=1e3,K=50;function H(R){return Math.min(V,Math.max(K,Math.floor(R/4)))}function T(R){if(R instanceof Date)return R.getTime();if(typeof R=="number")return Number.isFinite(R)?R:NaN;if(typeof R=="string"){const j=R.trim();if(!j)return NaN;const N=Date.parse(j);return Number.isNaN(N)?Number(j):N}return NaN}function A(R,j){return new S(R,j)}class S{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#i=[];#s=null;#o;#l;#a=new Map;#c=r();#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;#L=!1;#_=0;#F=0;#X=!1;constructor(j,N){this.#e=j||{mode:"stream"},this.#t=N||{},this.#o=n(this.#t),this.#l=new E(4096),this.#P=this.#qe();const $=(this.#t.config||{}).ingest;this.#L=!!$&&$.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 _=Number(this.#e.poll);Number.isFinite(_)&&_>0&&(this.#Y=setInterval(()=>{this.#v||this.reload()},_),this.#Y&&I(this.#Y.unref)&&this.#Y.unref()),this.#B()}#V(){const j=Number(this.#e.maxAge);return Number.isFinite(j)&&j>0?j:0}#B(){const j=this.#V();if(!j)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.#H())},H(j)),this.#R&&I(this.#R.unref)&&this.#R.unref()}#W(){const j=this.#V();return!j||!this.#T?!1:this.#N?!0:this.#M<Date.now()-j*(1+G)}#ge(j,N){if(!this.#T)return;const $=this.#D?T(this.#D(N)):Date.now();this.#T[j]=$,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 j=this.#se();if(j&&!this.#b){this.#b=f({mode:"memory",rows:this.#n},this.#Me()),this.#O=!1;return}!j&&this.#b&&(this.#b.destroy(),this.#b=null)}#Me(){if(this.#y)return this.#y;const j=this,N={liveIndices:()=>j.#fe(),live:$=>j.#n[$]!==void 0,source:$=>j.#ee($),get physical(){return j.#n.length}};return this.#L&&(N.column=$=>{const _=j.#t.store;return _&&I(_.column)?_.column($):void 0}),this.#y=Object.create(this.#t,{store:{value:N,enumerable:!0,configurable:!0}}),this.#y}#fe(){const j=new Uint32Array(this.#n.length);let N=0;for(let $=0;$<this.#n.length;$++)this.#n[$]!==void 0&&(j[N++]=$);return j.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(j="filter"){if(this.#g){this.#g.invalidate(j);return}this.#ue(),this.#b&&this.#b.invalidate(j),(j==="filter"||j==="sort")&&this.#Te()}count(){const j=this.#oe();return j?j.count():this.#r?this.#r.length:this.#S}matchCount(){const j=this.#oe();return j&&I(j.matchCount)?j.matchCount():this.#r?this.#r.length:this.#S}totalCount(){const j=this.#oe();return j&&I(j.totalCount)?j.totalCount():this.#S}unfilteredRows(){const j=this.#oe();if(j&&I(j.unfilteredRows))return j.unfilteredRows();const N=[];for(let $=0;$<this.#n.length;$++){if(!this.#n[$])continue;const _=this.#je($);_&&N.push(_)}return N}at(j){const N=this.#oe();if(N)return N.at(j);if(j<0||j>=this.count())return;const $=this.#r?this.#r.at(j):j,_=this.#je($);return _.index=j,_}byKey(j){const N=this.#oe();if(N)return N.byKey(j);const $=this.#a.get(j);return $===void 0?void 0:this.#je($)}leavesOf(j){const N=this.#oe();return N&&I(N.leavesOf)?N.leavesOf(j):[]}loaded(j){return j>=0&&j<this.count()}hint(j,N){if(this.#g){this.#g.hint(j,N);return}this.#_e(),this.#p=Math.max(0,Math.floor(j))}#_e(){this.#v||this.#qe()===this.#P||this.reload()}display(){const j=this.#oe();return j?j.display():m(()=>this.count(),N=>this.at(N))}apply(j){if(this.#g)return this.#g.apply(j);const N={added:[],updated:[],removed:[]};if(!j)return N;if(j.update){let $=!1;for(const _ of j.update){const Y=this.#a.get(this.#o.keyOf(_,-1));if(Y===void 0)continue;const Z=this.#Se(Y);this.#L?this.#xe(Y,_):this.#n[Y]=_,this.#l.delete(Y),this.#ye(Y,Z),this.#T&&(this.#ge(Y,_),$=!0),this.#O=!0,N.updated.push(this.#je(Y))}$&&this.#Ee()}if(j.add&&j.add.length){const $=this.#ne(j.add);for(const _ of $)N.added.push(this.#je(_))}return j.remove&&j.remove.length&&b("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#H(),N}reload(j){this.#c.abortAll("reload"),this.#Ye(),this.#b&&(this.#b.destroy(),this.#b=null),this.#O=!1,this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear(),this.#g=null,this.#S=0,this.#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.#a.clear(),this.#l.clear()}async start(){if(this.#A||this.#v||!I(this.#e.open))return;this.#A=!0;const j=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:j.signal})}catch(_){this.#Pe("source:error",{error:_});return}const $=I(N[Symbol.asyncIterator])?N[Symbol.asyncIterator]():N[Symbol.iterator]();this.#K=$;try{for(;;){const _=await $.next();if(!j.current||this.#v)return;if(_.done){this.#$();return}if(await this.#Le(_.value,j),!j.current||this.#v)return;if(_.value&&_.value.done){this.#$();return}if(await this.#he(),!j.current||this.#v)return}}catch(_){if(s(_))return;this.#Pe("source:error",{error:_})}finally{j.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 j=this.#oe();j&&(I(j.invalidateHandles)&&j.invalidateHandles(),I(j.invalidate)&&j.invalidate("sort"))}renderCount(){return this.#d}ingestStats(){return{worker:this.#_,inline:this.#F,storeBacked:this.#L}}#Le(j,N){if(!j)return;const $=j.rows;if($&&$.length&&this.#ae($))return this.#le(j,N);const _=Q();$&&$.length&&(this.#ne($),this.#F++),this.#Ce(j),this.#h+=Q()-_,this.#H()}#Ce(j){this.#u.loaded=j.progress&&typeof j.progress.loaded=="number"?j.progress.loaded:this.#n.length,j.progress&&typeof j.progress.estimated=="number"&&(this.#u.estimated=j.progress.estimated)}#ae(j){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 _=this.#G();return!_||!d(_)?(this.#X=!0,a("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):j.length<N.threshold?!1:!this.#Ae(j)}#Ae(j){if(!this.#o.keyed)return!1;const N=new Set;for(let $=0;$<j.length;$++){const _=this.#o.keyOf(j[$],this.#n.length+$);if(_!=null){if(N.has(_)||this.#a.has(_))return!0;N.add(_)}}return!1}async#le(j,N){const $=j.rows,_=this.#Z(),Y=this.#G();let Z;try{Z=await _.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(j),this.#H();return}if(N&&(!N.current||this.#v))return;const J=this.#t.store,D=this.#L?void 0:$,{from:te}=J.appendPacked(Z,D),z=Z.count|0;for(let X=0;X<z;X++){const ne=te+X,re=$[X],ae=this.#o.keyed?this.#o.keyOf(re,ne):null;if(this.#n[ne]=this.#L?v:re,this.#S++,this.#ge(ne,re),ae!==null&&this.#a.set(ae,ne),!this.#r||!this.#we(ne))continue;const fe=this.#de(ne);this.#r.insert(fe,ne),fe<=this.#p&&this.#m++}this.#O=!0,this.#Ee(),this.#_++,this.#Ce(j),this.#H()}#Z(){const j=this.#t.ingestWorker;return I(j)?j():null}#G(){const j=this.#t.storeSchema;return I(j)?j():null}#ne(j){const N=[],$=this.#t.store,_=new Array(j.length),Y=[],Z=new Set;for(let D=0;D<j.length;D++){const te=this.#o.keyed?this.#o.keyOf(j[D],this.#n.length+Y.length):null;_[D]=te,!(te!==null&&(this.#a.has(te)||Z.has(te)))&&(te!==null&&Z.add(te),Y.push(j[D]))}let J=Y.length&&$&&I($.append)?$.append(Y).from:this.#n.length;for(let D=0;D<j.length;D++){const te=j[D],z=_[D];if(z!==null&&this.#a.has(z)){const re=this.#a.get(z),ae=this.#Se(re);this.#L||(this.#n[re]=te,$&&I($.setSource)&&$.setSource(re,te)),this.#xe(re,te),this.#l.delete(re),this.#ge(re,te),this.#ye(re,ae);continue}const X=J++;if(this.#n[X]=this.#L?v:te,this.#S++,this.#ge(X,te),z!==null&&this.#a.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(j){const N=this.#n[j];let $=!1;if(this.#r){const J=this.#be(j);J>=0&&J<=this.#p&&($=!0)}else j<=this.#p&&($=!0);const _=N===v?this.#ee(j):N,Y=this.#o.keyed?this.#o.keyOf(_,j):null;Y!==null&&this.#a.get(Y)===j&&this.#a.delete(Y),this.#n[j]=void 0,this.#T&&(this.#T[j]=NaN),this.#l.delete(j);const Z=this.#t.store;return Z&&I(Z.remove)&&Z.remove(j),this.#S--,$}#Ee(){let j=0,N=0;const $=this.#pe();j+=$.dropped,N+=$.aboveAnchor;const _=this.#re();j+=_.dropped,N+=_.aboveAnchor,j&&(this.#O=!0,this.#C+=j,this.#Te(),this.#m-=N,this.#Pe("stream:evicted",{evicted:j,total:this.#C,live:this.#S}))}#re(){const j=this.#e.maxRows;if(!Number.isFinite(j)||j<=0||this.#S<=j)return{dropped:0,aboveAnchor:0};const N=Math.max(1,Math.floor(j*(1-G)));let $=0,_=0;for(;this.#S>N&&this.#E<this.#n.length;){const Y=this.#E++;this.#n[Y]!==void 0&&(this.#U(Y)&&_++,$++)}return{dropped:$,aboveAnchor:_}}#pe(){const j=this.#V();if(!j||!this.#T||!this.#W())return{dropped:0,aboveAnchor:0};const N=Date.now()-j;let $=0,_=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)&&_++,$++}}for(this.#M=Y,this.#N=!1;this.#E<this.#n.length&&this.#n[this.#E]===void 0;)this.#E++;return{dropped:$,aboveAnchor:_}}#be(j){if(!this.#r)return j;for(let N=0;N<this.#r.length;N++)if(this.#r.at(N)===j)return N;return-1}#Te(){this.#i=this.#Oe("sort",[]),this.#s=this.#Oe("filters",null);const j=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#V()>0,N=this.#Oe("where",null),$=(this.#t.config||{}).hostFilter,_=!!(N&&N.active)||!!($&&I($.active)&&$.active());if(!(j||this.#i.length>0||!!this.#s||!!this.#Oe("quick","")||_)){this.#r=null;return}this.#r=new l(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(j){const N=this.#ee(j);if(this.#s&&!this.#ve(this.#s,N))return!1;const $=String(this.#Oe("quick","")||"").toLowerCase();if($&&!this.#k(N).includes($))return!1;const _=(this.#t.config||{}).hostFilter;if(_&&I(_.active)&&_.active()&&!_.passes(this.#je(j)))return!1;const Y=this.#Oe("where",null);if(Y&&Y.active){const Z=this.#je(j);if(!Y.passes(Z.data,Z.key))return!1}return!0}#ve(j,N){if(!j)return!0;const $=j;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 _=j,Y=(this.#t.compute||{}).testValue;return I(Y)?!!Y(this.#Ve(N,_.col),_,(this.#t.config||{}).locale):(b("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#Se(j){if(!this.#r)return-1;if(!this.#i.length)return this.#be(j);let N=0,$=this.#r.length;for(;N<$;){const _=N+$>>>1;this.#J(this.#r.at(_),j)<0?N=_+1:$=_}for(let _=N;_<this.#r.length;_++){const Y=this.#r.at(_);if(Y===j)return _;if(this.#J(Y,j)>0)break}return this.#be(j)}#ye(j,N){if(!this.#r||!this.#i.length)return;const $=this.#we(j);if(N>=0&&this.#r.at(N)===j)this.#r.removeAt(N),N<=this.#p&&this.#m--;else if(N>=0)return;if(!$)return;const _=this.#de(j);this.#r.insert(_,j),_<=this.#p&&this.#m++}#de(j){if(!this.#r||!this.#i.length)return this.#r?this.#r.length:0;let N=0,$=this.#r.length;for(;N<$;){const _=N+$>>>1;this.#J(j,this.#r.at(_))<0?$=_:N=_+1}return N}#J(j,N){const $=this.#ee(j),_=this.#ee(N);for(const Y of this.#i){const Z=this.#Ie(Y.col),J=this.#Ve($,Y.col),D=this.#Ve(_,Y.col),z=(Z&&Z.value&&I(Z.value.compare)?Z.value.compare:O)(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 j=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:w;!this.#L&&this.#n.length<j&&(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.#H(),this.#Pe("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:j})}#H(){this.#f!==null||this.#v||(this.#f=this.#I(()=>{this.#f=null,this.#d++;const j=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:j,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(j=>{const N=(this.#t.scheduler||{}).idle;I(N)?N(()=>j()):q(()=>j())}))}#ie(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:P}#I(j){const N=this.#t.scheduler||{};return I(N.frame)?N.frame(j):U(j)}#ke(j){const N=this.#t.scheduler||{};I(N.cancel)?N.cancel(j):L(j)}#ee(j){const N=this.#n[j];if(N!==void 0&&N!==v)return N;if(N===void 0)return;const $=this.#t.store;return $&&I($.source)?$.source(j):void 0}#xe(j,N){const $=this.#t.store;if(!$||!I($.set))return;const _=this.#G();if(Array.isArray(_))for(const Y of _){if(!Y||!Y.id)continue;const Z=I(Y.read)?Y.read:J=>o(J,Y.field||Y.id);$.set(Y.id,j,Z(N))}}#je(j){let N=this.#l.get(j);return N||(N=this.#o.leaf(this.#ee(j),j),this.#l.set(j,N)),N}#Ve(j,N){const $=this.#Ie(N);return $&&I($.getValue)?$.getValue(j):j?.[N]}#k(j){const N=this.#t.columns,$=N&&I(N.all)?N.all():[],_=[];for(const Y of $){const Z=I(Y.getValue)?Y.getValue(j):void 0;Z!=null&&Z!==""&&_.push(String(Z))}return _.join(" ").toLowerCase()}#Ie(j){const N=this.#t.columns;return N&&I(N.get)?N.get(j):void 0}#Ye(){const j=this.#K;if(this.#K=null,j&&I(j.return))try{j.return()}catch{}}#qe(){return y({context:this.#Oe("context",null)})}#Oe(j,N){const $=this.#t.state;if($&&I($[j])){const _=$[j]();return _??N}return N}#Pe(j,N){const $=this.#t.emit;I($)&&$(j,N)}}}),He("packages/core/src/source/url.js",function(e,F){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return b}});const E=F("packages/core/src/internal/warn.js").warnOnce,W=F("packages/core/src/internal/predicates.js"),I=W.isObject,x=W.isFunction,U=F("packages/core/src/internal/paths.js").getPath,q=F("packages/core/src/source/abort.js").isAbortError,M=500,O=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=x(h.fetch)?h.fetch:typeof globalThis<"u"&&x(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=x(h.map)?h.map:void 0,G=I(h.headers)?h.headers:void 0,V=Number.isFinite(h.batchSize)&&h.batchSize>0?Math.floor(h.batchSize):M,K=h.lenient===!0,H=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*A(R={}){if(!T)return;if(!d)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const j=R&&R.signal;let N;try{N=await d(p,G?{signal:j,headers:G}:{signal:j})}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 $=a(p,w,N),_=N.body&&x(N.body.getReader)?N.body.getReader():null;try{if(!_){const J=await N.text();($||t(J,p))==="ndjson"?yield*c(null,null,J,0,N,p,V,K):yield*m(J,p,v,P);return}const Y=new TextDecoder("utf-8");if($==="json"){yield*m(await n(_,Y,""),p,v,P);return}if($==="ndjson"){yield*c(_,Y,"",0,N,p,V,K);return}const Z=await r(_,Y,p);Z.format==="json"?yield*m(await n(_,Y,Z.seed),p,v,P):yield*c(_,Y,Z.seed,Z.bytes,N,p,V,K)}finally{if(_&&x(_.cancel))try{await _.cancel()}catch{}}}const S={mode:"stream",open:A,autoStart:h.autoStart!==!1};return H!==void 0&&(S.poll=H),Number.isFinite(h.maxRows)&&(S.maxRows=h.maxRows),Number.isFinite(h.maxAge)&&(S.maxAge=h.maxAge),(typeof h.ageBy=="string"||x(h.ageBy))&&(S.ageBy=h.ageBy),Number.isFinite(h.coalesceMs)&&(S.coalesceMs=h.coalesceMs),Number.isFinite(h.promoteToMemoryBelow)&&(S.promoteToMemoryBelow=h.promoteToMemoryBelow),S}function a(p,y,h){if(y)return y;const d=g(p);if(d)return d;const w=h&&h.headers&&x(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(O.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 r(p,y,h){let d="",w=0;for(;;){const{value:P,done:G}=await p.read();if(P&&(w+=P.byteLength,d+=y.decode(P,{stream:!0})),G){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)),i(h)?"ndjson":"json"}function i(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*c(p,y,h,d,w,v,P,G){const V=f(w);let K=h||"",H=d||0,T=0,A=0,S=[];function*R(){let N;for(;(N=K.indexOf(`
|
|
10
10
|
`))!==-1;){const $=K.slice(0,N);K=K.slice(N+1),A++;const _=l($,A,v,G);_!==k&&(S.push(_),S.length>=P&&(T+=S.length,yield u(S,T,V,H),S=[]))}}if(p){for(;;){const{value:N,done:$}=await p.read();if(N&&(H+=N.byteLength,K+=y.decode(N,{stream:!0}),yield*R()),$)break}K+=y.decode()}yield*R(),A++;const j=l(K,A,v,G);j!==k&&S.push(j),S.length&&(T+=S.length,yield u(S,T,V,H))}function l(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 u(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&&x(p.headers.get)?p.headers.get("content-length"):null,h=y!=null?Number(y):NaN;return Number.isFinite(h)&&h>0?h:void 0}}),He("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 L}}),Object.defineProperty(e,"DERIVED_SOURCE_KEY",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"UNION_KEY_SEP",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"readPath",{enumerable:!0,get:function(){return O}}),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 i}}),Object.defineProperty(e,"groupRows",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"finishGroups",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"derive",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"normalizeUnionSource",{enumerable:!0,get:function(){return u}}),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,W=ie.isObject,x=F("packages/core/src/compute/total.js").TOTAL_FNS,Q=Object.freeze(["filtered","all","selected","grouped"]),U=Object.freeze(["day","week","month","quarter","year"]),L="__key",q="__source",M="";function O(v,P){if(!W(v)||typeof P!="string")return;if(!P.includes("."))return v[P];let G=v;for(const V of P.split(".")){if(!W(G))return;G=G[V]}return G}function k(v,P){const G=[];for(const V of v){const K=O(V,P);if(!(!Array.isArray(K)||!K.length))for(const H of K)G.push({...V,[P]:H})}return G}function b(v,P){const G=v instanceof Date?v:new Date(v),V=G.getTime();if(!Number.isFinite(V))return null;const K=G.getUTCFullYear(),H=G.getUTCMonth(),T=G.getUTCDate(),A=S=>S.toISOString().slice(0,10);switch(P){case"year":return A(new Date(Date.UTC(K,0,1)));case"quarter":return A(new Date(Date.UTC(K,Math.floor(H/3)*3,1)));case"month":return A(new Date(Date.UTC(K,H,1)));case"week":{const S=(G.getUTCDay()+6)%7;return A(new Date(Date.UTC(K,H,T-S)))}default:return A(new Date(Date.UTC(K,H,T)))}}function a(v,P,G){const V=P.map(K=>G&&G.of===K?b(O(v,K),G.by):O(v,K));return{key:V.map(K=>K==null?"\0":String(K)).join(""),values:V}}function g(v,P){const G=x[P];return G?G({get:V=>v[V]},r(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 G={},V=r(v.length);for(const[K,H]of Object.entries(P)){const T=H.fn||"count",A=x[T];if(!A){G[K]=null;continue}const S=H.of?v.map(R=>O(R,H.of)):[];G[K]=A({get:R=>S[R]},V)}return G}const r=(()=>{const v=new Map;return P=>{let G=v.get(P);if(!G){G=new Uint32Array(P);for(let V=0;V<P;V++)G[V]=V;v.size<512&&v.set(P,G)}return G}})();function s(v,P,G){if(!Number.isFinite(P)||P<=0)return v;if(!G)return v.slice(0,P);const V=new Map,K=[];for(const H of v){const T=String(O(H,G)),A=V.get(T)||0;A>=P||(V.set(T,A+1),K.push(H))}return K}function i(v,P){const G=v.reduce((T,A)=>T+(Number(O(A,P.of))||0),0);if(!G)return v;const V=G*P.upTo;let K=0;const H=[];for(const T of v)if(H.push(T),K+=Number(O(T,P.of))||0,K>=V)break;return H}function n(v,P){return!Array.isArray(P)||!P.length?v:[...v].sort((G,V)=>{for(const K of P){const H=O(G,K.col),T=O(V,K.col);if(H===T)continue;return H==null?1:T==null?-1:((typeof H=="number"&&typeof T=="number"?H<T:String(H)<String(T))?-1:1)*(K.dir==="desc"?-1:1)}return 0})}function m(v,P,G){const V=P.groupBy?Array.isArray(P.groupBy)?P.groupBy:[P.groupBy]:null,K=W(P.bucket)?P.bucket:null,H=o(V,K),T=new Map,A=new Map;if(!H)return{groups:T,rowGroup:A};for(const S of v){const{key:R,values:j}=a(S,H,K);let N=T.get(R);N||(N={values:j,rows:new Map},T.set(R,N));const $=G(S);N.rows.set($,S),A.set($,R)}return{groups:T,rowGroup:A}}function c(v,P,G=null,V=null){const K=P.groupBy?Array.isArray(P.groupBy)?P.groupBy:[P.groupBy]:null,H=W(P.bucket)?P.bucket:null,T=o(K,H);let A=[...v.entries()].map(([S,R])=>{if(G&&V&&!V.has(S)){const N=G.get(S);if(N)return N}const j={[L]:S};return T.forEach((N,$)=>{j[N.includes(".")?N.split(".").pop():N]=R.values[$]}),Object.assign(j,t([...R.rows.values()],P.select||{})),G&&G.set(S,j),j});return A=n(A,P.sort),W(P.cumulative)&&(A=i(A,P.cumulative)),s(A,P.limit,P.limitPer||null)}function l(v,P){const G=y(v,P),V=P.groupBy?Array.isArray(P.groupBy)?P.groupBy:[P.groupBy]:null,K=W(P.bucket)?P.bucket:null,H=o(V,K);let T;if(!H)T=G.map((A,S)=>({...A,[L]:String(O(A,P.rowKey||"id")??S)}));else{const A=new Map;for(const S of G){const{key:R,values:j}=a(S,H,K);let N=A.get(R);N||(N={values:j,rows:[]},A.set(R,N)),N.rows.push(S)}T=[...A.entries()].map(([S,R])=>{const j={[L]:S};return H.forEach((N,$)=>{j[N.includes(".")?N.split(".").pop():N]=R.values[$]}),Object.assign(j,t(R.rows,P.select||{})),j})}return T=n(T,P.sort),W(P.cumulative)&&(T=i(T,P.cumulative)),s(T,P.limit,P.limitPer||null)}function u(v,P){const V=W(v)&&W(v.grid)?v:{grid:v};return{grid:W(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 G=P[q];G!==void 0&&(P[L]=`${G}${M}${P[L]}`)}return v}function p(v,P){const G=P.on,V=W(G)?String(G.left||G.right||""):String(G||""),K=W(G)?String(G.right||G.left||""):String(G||"");if(!V||!K)return v;const H=P.index instanceof Map?P.index:h(Array.isArray(P.rows)?P.rows:[],K),T=Array.isArray(P.select)?P.select.map(String):null,A=P.prefix?String(P.prefix):"",S=String(P.type||"inner")==="left",R=[];for(const j of v){const N=O(j,V),$=N==null?void 0:H.get(String(N));if(!$){S&&R.push(j);continue}const _={...j},Y=T||Object.keys($);for(const Z of Y)!A&&Z===V||(_[A?A+Z:Z]=O($,Z));R.push(_)}return R}function y(v,P){let G=Array.isArray(v)?v:[];return P.unnest&&(G=k(G,P.unnest)),W(P.join)&&(Array.isArray(P.join.rows)||P.join.index instanceof Map)&&(G=p(G,P.join)),E(P.where)&&(G=G.filter(V=>!!P.where(V))),G}function h(v,P){const G=new Map;for(const V of v){const K=O(V,P);if(K==null)continue;const H=String(K);G.has(H)||G.set(H,V)}return G}function d(v,P){const G=P.on,V=W(G)?String(G.left||G.right||""):String(G||""),K=W(G)?String(G.right||G.left||""):String(G||"");if(!V||!K)return v;const H=P.index instanceof Map?P.index:new Map,T=O(v,V),A=T==null?void 0:H.get(String(T));if(!A)return String(P.type||"inner")==="left"?v:null;const S=Array.isArray(P.select)?P.select.map(String):null,R=P.prefix?String(P.prefix):"",j={...v};for(const N of S||Object.keys(A))!R&&N===V||(j[R?R+N:N]=O(A,N));return j}function w(v,P){const G=O(v,P);return G==null?null:String(G)}}),He("packages/core/src/source/derived.js",function(e,F){"use strict";Object.defineProperty(e,"IDLE_REFRESH_MS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"PROFILE_FIELDS",{enumerable:!0,get:function(){return u}}),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 K}});const ie=F("packages/core/src/internal/predicates.js"),E=ie.isFunction,W=ie.isObject,x=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,M=F("packages/core/src/source/derive.js"),O=M.derive,k=M.preGroup,b=M.groupRows,a=M.finishGroups,g=M.readPath,o=M.buildJoinIndex,t=M.joinOne,r=M.joinKeyOf,s=M.FOLLOW_MODES,i=M.DERIVED_ROW_KEY,n=M.DERIVED_SOURCE_KEY,m=M.normalizeUnionSource,c=M.namespaceUnionKeys,l=16,u=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(H,T={}){const A={...f,...W(T)?T:{}},S=z=>typeof z=="number"&&Number.isFinite(z)?z:null,R=S(H.rows)??0,j=S(H.numeric)??0,N=S(H.missing)??0,$=S(H.distinct),_=S(H.mean),Y=S(H.median),Z=S(H.stddev),J=S(Array.isArray(H.outliers)?H.outliers.length:H.outliers),D=j>0,te=[];return $===0?["empty"]:($===1&&te.push("constant"),R>0&&N/R>=A.missing&&te.push("high-missing"),!D&&$!==null&&R>1&&$===R&&N===0?te.push("unique"):$!==null&&R>0&&$/R>=A.cardinality&&te.push("high-cardinality"),D&&_!==null&&Y!==null&&Z!==null&&Z>0&&Math.abs(3*(_-Y)/Z)>=A.skew&&te.push("skewed"),D&&J!==null&&J/j>=A.outliers&&te.push("outliers"),te)}class w extends U{#e=null;#t={};#n=[];#r=null;#i=!1;#s={};#o=!1;#l=null;#a=null;#c=!1;#u=null;#f=!1;#d=null;constructor(T,A){super({mode:"memory",rows:[]},A),this.#s=A||{},this.#t=W(T)?T:{};const S=this.#t.from;if(Array.isArray(S)){if(this.#e=null,this.#d=this.#g(S),!this.#d.length){x("source.derived.from",'source.mode "derived" needs `from`: at least one grid to derive from.');return}this.#t.follow!==void 0&&x("source.derived.union.follow",'source.mode "derived": `follow` is ignored when `from` is a union of several grids (BACKLOG-0001045) — each entry carries its own `follow` instead.'),this.#t.crossFilter&&x("source.derived.union.crossfilter",'source.mode "derived": `crossFilter` is not supported when `from` is a union of several grids (BACKLOG-0001045) — it has no single target once there is more than one parent. Push a filter onto the individual source grid you mean instead.'),this.#t.statistics!==void 0&&(x("source.derived.union.statistics",'source.mode "derived": `statistics` is not supported when `from` is a union of several grids (BACKLOG-0001046) — a relational statistic reduces one grid\'s own columns, and a union has no single set of them. Derive the statistics of a single grid instead.'),this.#f=!0),this.#m(),this.#b(),this.refresh();return}if(this.#e=S||null,!this.#e){x("source.derived.from",'source.mode "derived" needs `from`: the grid to derive from.');return}this.#t.follow&&!s.includes(String(this.#t.follow))&&x(`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 x("source.derived.producer.conflict",'source.mode "derived": `profile` and `statistics` are both terminal producers and cannot be used together — each replaces the pipeline with its own output builder. Declare one, or chain a second derived grid whose `from` is the first.'),!1;if(!W(T))return x("source.derived.statistics.shape",`source.mode "derived": \`statistics\` needs an object naming the statistic, e.g. \`{ fn: 'correlation', columns: ['a', 'b'] }\`. Known fn: ${p.join(", ")}.`),!1;const A=String(T.fn||"");return p.includes(A)?this.#p(A,T):(x(`source.derived.statistics.fn.${A}`,`source.mode "derived": unknown \`statistics.fn\` "${A}". Known: ${p.join(", ")}. Every *single-column* statistic is reached through \`select\` instead, e.g. \`select: { p95: { of: 'amount', fn: 'p95' } }\`.`),!1)}#p(T,A){if(T==="correlation"){if((Array.isArray(A.columns)?A.columns.filter(Boolean):[]).length<2)return x("source.derived.statistics.columns","source.mode \"derived\": `statistics: { fn: 'correlation' }` needs `columns`: at least two column ids to correlate pairwise."),!1;const R=A.orient===void 0?"pairs":String(A.orient);return R!=="pairs"&&R!=="matrix"&&x(`source.derived.statistics.orient.${R}`,`source.mode "derived": unknown \`statistics.orient\` "${R}" for \`fn: 'correlation'\`; using "pairs". Known: pairs, matrix.`),!0}return T==="series"?!A.of||!A.by?(x("source.derived.statistics.series","source.mode \"derived\": `statistics: { fn: 'series' }` needs both `of` (the column to summarise) and `by` (the column that orders it). `by` is never guessed — kernels see rows in arrival order, which is not the grid's sort."),!1):!0:W(A.with)?!0:(x("source.derived.statistics.with","source.mode \"derived\": `statistics: { fn: 'datasetVsDataset' }` needs `with`: the second grid to compare this one against."),!1)}#m(){const T=this.#t.statistics!==void 0?"statistics":this.#t.profile!==void 0?"profile":null;if(!T)return;const A=h.filter(S=>this.#t[S]!==void 0);A.length&&x(`source.derived.producer.ignored.${T}`,`source.mode "derived": \`${T}\` is a terminal producer and replaces the pipeline, so ${A.map(S=>`\`${S}\``).join(", ")} ${A.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 A=this.#s&&this.#s.grid,S=new Set,R=[];return T.forEach((j,N)=>{const $=m(j,N);if(S.has($.label)&&x(`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.`),S.add($.label),!$.grid){x(`source.derived.union.missing.${$.label}`,`source.mode "derived": union source "${$.label}" has no grid and was skipped.`),R.push($);return}if(A&&E($.grid.on)){const _=P(A,$.grid,[$.label]);if(_){x(`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 (${_.join(" → ")}). Remove it from \`from\`.`),R.push({...$,grid:null});return}}R.push($)}),R}#b(){if(this.#d){this.#O(),this.#w();return}const T=this.#e;if(!T||!E(T.on))return;const A=String(this.#t.follow||"filtered"),S=["rows:changed"];(A==="filtered"||A==="grouped")&&S.push("filter:changed","model:changed"),A==="selected"&&S.push("selection:changed"),A==="grouped"&&S.push("column:grouped");for(const R of S){const j=N=>{R==="rows:changed"&&v(N)||R==="model:changed"&&!q(N)||this.schedule(R==="rows:changed"?N:null)};T.on(R,j),this.#n.push(()=>E(T.off)&&T.off(R,j))}this.#w(),this.#y()}#y(){const T=this.#t.statistics,A=W(T)?T.with:null;if(!W(A)||!E(A.on))return;const S=A;for(const R of["rows:changed","filter:changed","model:changed"]){const j=N=>{R==="rows:changed"&&v(N)||R==="model:changed"&&!q(N)||this.schedule(null)};S.on(R,j),this.#n.push(()=>E(S.off)&&S.off(R,j))}}#O(){for(const T of this.#d){const A=T.grid;if(!A||!E(A.on))continue;const S=s.includes(String(T.follow))?String(T.follow):"filtered",R=["rows:changed"];(S==="filtered"||S==="grouped")&&R.push("filter:changed","model:changed"),S==="selected"&&R.push("selection:changed"),S==="grouped"&&R.push("column:grouped");for(const j of R){const N=$=>{j==="rows:changed"&&v($)||j==="model:changed"&&!q($)||this.schedule(null)};A.on(j,N),this.#n.push(()=>E(A.off)&&A.off(j,N))}}}#w(){const T=this.#t.join,A=T&&T.with;if(!A||!E(A.on))return;const R=String(T.follow||"all")==="all"?["rows:changed"]:["rows:changed","filter:changed","model:changed"];for(const j of R){const N=$=>{j==="rows:changed"&&v($)||j==="model:changed"&&!q($)||this.schedule({partner:!0})};A.on(j,N),this.#n.push(()=>E(A.off)&&A.off(j,N))}}#A(){const T=this.#t.join;if(!T||!T.with)return null;const A=T.on,S=W(A)?String(A.left||A.right||""):String(A||""),R=W(A)?String(A.right||A.left||""):String(A||"");return S&&R?{left:S,right:R}:null}#v(){const T=this.#A();if(!T)return this.#u=null,null;const A=this.#u;if(this.#u=o(this.#C(),T.right),!A)return null;const S=this.#t.join||{},R=Array.isArray(S.select)?S.select.map(String):null,j=_=>_?(R||Object.keys(_)).map(Z=>String(g(_,Z))).join(""):null,N=new Set,$=new Set;for(const[_,Y]of this.#u)j(Y)!==j(A.get(_))&&(N.add(_),A.has(_)||$.add(_));for(const _ of A.keys())this.#u.has(_)||N.add(_);return{affected:N,gained:$}}#P(T,A){const S=this.#l;if(!S||!S.leftByJoinKey)return null;const R=[];for(const j of T){const N=S.leftByJoinKey.get(j);if(N)for(const $ of N){const _=S.rowData.get($);_!==void 0&&R.push({key:$,data:_})}}return this.#M({updated:R,added:[],removed:[]},A)}#S(T,A){if(!this.#l||!this.#l.leftByJoinKey||T.unnest||T.where||String(T.follow||"filtered")==="grouped")return!1;const S=T.join||{};return String(S.type||"inner")==="left"?!0:A.size===0}#C(){const T=this.#t.join,A=T&&T.with;if(!A||!A.rows)return[];const S=[],R=j=>{j.group||S.push(G(j))};return String(T.follow||"all")==="filtered"&&E(A.rows.forEach)?A.rows.forEach(R):E(A.rows.forEachAll)&&A.rows.forEachAll(R),S}schedule(T){const A=this.#t.refresh===void 0?"idle":this.#t.refresh;if(A==="manual")return;if(A==="live"){this.refresh(T);return}const S=typeof A=="number"&&Number.isFinite(A)?A:l;if(this.#r){this.#c=!0;return}this.#c=!1,this.#r=setTimeout(()=>{this.#r=null,this.refresh(this.#c?null:T)},S)}refresh(T){if(!(this.#i||!this.#e&&!this.#d)){if(this.#o){x("source.derived.cycle","a derived grid is deriving from itself, directly or through a chain. The cycle was refused; check the `from` of each grid in the chain.");return}this.#o=!0;try{const A=this.#f?[]:this.#d?this.#t.profile?this.#_():this.#L():this.#t.statistics!==void 0?this.#ge():this.#t.profile?this.#fe():this.#E(T);this.setRows(A),this.invalidate("filter"),E(this.#s.emit)&&this.#s.emit("rows:changed",{derived:!0},"derived")}finally{this.#o=!1}}}#E(T){const S=W(T)&&T.partner===!0?this.#v():null,R=this.#D();if(S&&this.#l){if(!S.affected.size)return a(this.#l.groups,R,this.#l.reduced,new Set);if(this.#S(R,S.gained)){const X=this.#P(S.affected,R);if(X)return a(this.#l.groups,R,this.#l.reduced,X)}}const j=this.#T(R,T);if(j&&this.#l){const X=this.#M(j,R);return a(this.#l.groups,R,this.#l.reduced,X)}const N=k(this.#F(),R);if(this.#a=this.#R(),!R.groupBy)return this.#l=null,O(N,R);const $=this.#N(),{groups:_,rowGroup:Y}=b(N,R,$),Z=new Map;for(const[X,ne]of Y){const re=_.get(ne);re&&Z.set(X,re.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 re=r(ne,D.left);if(re===null)continue;te.set(X,re);let ae=z.get(re);ae||(ae=new Set,z.set(re,ae)),ae.add(X)}return this.#l={groups:_,rowGroup:Y,rowData:Z,reduced:J,leftJoinKey:te,leftByJoinKey:z},a(_,R,J,null)}#T(T,A){if(!this.#l||!T.groupBy||T.unnest||T.where||String(T.follow||"filtered")==="grouped"||W(T.join)&&T.join.with&&!(T.join.index instanceof Map)||!W(A))return null;const S=Array.isArray(A.updated)?A.updated:null,R=Array.isArray(A.added)?A.added:null,j=Array.isArray(A.removed)?A.removed:null;if(!S&&!R&&!j)return null;const N=this.#a;if(N&&N.size&&String(T.follow||"filtered")!=="all"){if(A.edit===!0&&Array.isArray(A.columns)){for(const $ of A.columns)if(N.has(String($)))return null}for(const $ of S||[]){const _=$&&$.key,Y=_===void 0?void 0:this.#l.rowData.get(String(_)),Z=G($);for(const J of N)if(g(Y,J)!==g(Z,J))return null}}return{updated:S||[],added:R||[],removed:j||[]}}#M(T,A){const S=this.#l,R=this.#N(),j=new Set,N=W(A.join)&&A.join.index instanceof Map?A.join:null,$=this.#A(),_=Z=>{const J=S.rowGroup.get(Z);if(J===void 0)return;j.add(J);const D=S.groups.get(J);if(D&&(D.rows.delete(Z),D.rows.size||S.groups.delete(J)),S.rowGroup.delete(Z),S.rowData.delete(Z),S.leftJoinKey){const te=S.leftJoinKey.get(Z);if(te!==void 0){const z=S.leftByJoinKey.get(te);z&&(z.delete(Z),z.size||S.leftByJoinKey.delete(te)),S.leftJoinKey.delete(Z)}}},Y=Z=>{const J=N?t(Z,N):Z;if(!J)return;const D=R(J),te=b([J],A,R);for(const[z,X]of te.groups){let ne=S.groups.get(z);ne||(ne={values:X.values,rows:new Map},S.groups.set(z,ne)),ne.rows.set(D,J),S.rowGroup.set(D,z),j.add(z)}if(S.rowData.set(D,J),$&&S.leftByJoinKey){const z=r(J,$.left);if(z!==null){S.leftJoinKey.set(D,z);let X=S.leftByJoinKey.get(z);X||(X=new Set,S.leftByJoinKey.set(z,X)),X.add(D)}}};for(const Z of T.removed)_(String(Z));for(const Z of T.updated)_(String(Z.key)),Y(G(Z));for(const Z of T.added)Y(G(Z));return j}#N(){const T=this.#e,A=T&&T.config&&T.config.rowKey||"id";return S=>String(g(S,typeof A=="string"?A:"id")??"")}#R(){const T=this.#e,A=T&&T.state&&E(T.state.get)?T.state.get():null,S=new Set,R=j=>{if(j){if(Array.isArray(j.conditions)){j.conditions.forEach(R);return}j.col&&S.add(String(j.col))}};return A&&R(A.filters),S}#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 A=this.#e,S=A&&A.state&&E(A.state.get)?A.state.get():null,R=S&&Array.isArray(S.group)?S.group:[];return R.length?{...T,groupBy:[...R]}:T}#K(){const T=[];for(const A of this.#d)if(A.grid)try{const S=s.includes(String(A.follow))?String(A.follow):"filtered",R=this.#Y(A.grid,S);for(const j of R){const N=A.map?A.map(j):j;W(N)&&T.push({...N,[n]:A.label})}}catch(S){x(`source.derived.union.failed.${A.label}`,`source.mode "derived": union source "${A.label}" failed to read (${S&&S.message?S.message:S}) and was skipped this pass.`)}return T}#Y(T,A){if(!T||!T.rows)return[];if(A==="all"){const R=[];return E(T.rows.forEachAll)&&T.rows.forEachAll(j=>{j.group||R.push(G(j))}),R}if(A==="selected")return(T.selection&&E(T.selection.rows)?T.selection.rows():[]).filter(Boolean).map(G);const S=[];return E(T.rows.forEach)&&T.rows.forEach(R=>{R.group||S.push(G(R))}),S}#L(){const T=this.#D(),A=this.#K(),S=O(A,T);return T.groupBy?S:c(S)}#_(){return x("source.derived.union.profile",'source.mode "derived": `profile` is not supported when `from` is a union of several grids (BACKLOG-0001045); profile a single grid instead.'),[]}#F(){const T=this.#e,A=String(this.#t.follow||"filtered");if(!T||!T.rows)return[];if(A==="all"){const j=[];return E(T.rows.forEachAll)&&T.rows.forEachAll(N=>{N.group||j.push(G(N))}),j}if(A==="selected")return(T.selection&&E(T.selection.rows)?T.selection.rows():[]).filter(Boolean).map(G);const S=this.#X(),R=[];return S&&this.#V().length&&E(T.rows.forEachExcept)?(T.rows.forEachExcept(S,j=>{j.group||R.push(G(j))}),R):(E(T.rows.forEach)&&T.rows.forEach(j=>{j.group||R.push(G(j))}),R)}#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 A=this.#t.groupBy,S=Array.isArray(A)?A[0]:A;return S?String(S):null}#V(){const T=this.#X(),A=this.#e;if(!T||!A||!A.filters||!E(A.filters.get))return[];const S=V(A.filters.get(),T);return S?S.op==="in"&&Array.isArray(S.value)?S.value.map(String):S.op==="eq"&&S.value!==void 0?[String(S.value)]:[]:[]}#B(T){const A=this.#X(),S=this.#e;if(!A||!S||!S.filters||!E(S.filters.set))return;const R=this.#s.compute||{},j=E(S.filters.get)?S.filters.get():null,N=E(R.pruneColumn)?R.pruneColumn(j,A):null;if(!T.length){S.filters.set(N||null);return}const $=T.length===1?{col:A,op:"eq",value:T[0]}:{col:A,op:"in",value:T.slice()},_=N?N.conditions&&N.op?N.conditions:[N]:[];S.filters.set(_.length?{op:"and",conditions:[..._,$]}:$)}crossFilter(){const T=this;return{enabled(){return!!T.#X()},column(){return T.#X()},get(){return T.#V()},set(A){const S=A==null?[]:(Array.isArray(A)?A:[A]).map(R=>String(R));T.#B(S)},toggle(A){const S=String(A),R=T.#V(),N=R.indexOf(S)>=0?R.filter($=>$!==S):[...R,S];T.#B(N)},clear(){T.#B([])}}}#W(T){const A=T&&T.rows;if(A&&E(A.matchCount)){const S=A.matchCount(),R=Number(S);if(S!==null&&Number.isFinite(R))return R}if(A&&E(A.count)){const S=Number(A.count());if(Number.isFinite(S))return S}return 0}#ge(){const T=this.#e,A=this.#t.statistics;if(!T||!T.statistics||!W(A))return[];switch(String(A.fn)){case"correlation":return this.#se(T,A);case"series":return this.#ue(T,A);case"datasetVsDataset":return this.#Me(T,A);default:return[]}}#se(T,A){const S=A.columns.filter(Boolean).map(String),R=this.#W(T),j=(N,$)=>{const _=T.statistics.correlation(N,$);return typeof _=="number"&&Number.isFinite(_)?_:null};if(String(A.orient||"pairs")!=="matrix"){const N=[];for(let $=0;$<S.length;$++)for(let _=$+1;_<S.length;_++)N.push({[i]:`${S[$]}${S[_]}`,a:S[$],b:S[_],coefficient:j(S[$],S[_]),n:R});return N}return S.map(N=>{const $={[i]:N,column:N};for(const _ of S)$[_]=N===_?1:j(N,_);return $.n=R,$})}#ue(T,A){const S=this.#W(T),R={by:String(A.by)};A.periodsPerYear!==void 0&&(R.periodsPerYear=Number(A.periodsPerYear));const j=T.statistics.series(String(A.of),R)||{};return y.map(N=>({[i]:N,metric:N,value:j[N]??null,n:S}))}#Me(T,A){const S=A.with,R=Array.isArray(A.columns)?{columns:A.columns.map(String)}:void 0,j=T.statistics.datasetVsDataset(S,R);if(!W(j))return[];const $=(Array.isArray(j.ranked)?j.ranked:[]).map(Z=>({[i]: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:""})),_=j.unmatched,Y=[["A",_&&_.onlyA],["B",_&&_.onlyB]];for(const[Z,J]of Y)for(const D of J||[])$.push({[i]:`${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 S=(Array.isArray(this.#t.profile)?this.#t.profile:[this.#t.profile]).filter(Boolean).map(j=>{const N=T.statistics.profile(String(j))||{},$={[i]:String(j)};for(const Y of u)$[Y]=Y==="column"?String(j):N[Y]??null;$.outliers=Array.isArray(N.outliers)?N.outliers.length:N.outliers??null;const _=d({...N,rows:$.rows,outliers:$.outliers,numeric:N.numeric},this.#t.alerts);return $.alerts=_.join(", "),$.alertCount=_.length,$});if(this.#t.orient!=="metrics")return S;const R=S[0];return R?u.filter(j=>j!=="column").map(j=>({[i]:j,metric:j,value:R[j]})):[]}apply(T){const A=["add","update","remove"],S=[];for(const R of A)for(const j of T&&T[R]||[])S.push({operation:R,id:j&&j.id,reason:"derived-read-only"});return S.length&&x("source.derived.readonly","a derived grid is read-only: its rows are computed from another grid. Write to the source grid instead, and the derived one follows."),{added:[],updated:[],removed:[],rejected:S}}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(H){return W(H)&&H.companion===!0}function P(H,T,A,S=new Set){if(T===H)return A;if(S.has(T))return null;S.add(T);let R=null;try{R=E(T.config)?T.config():null}catch{R=null}const j=R&&W(R.source)?R.source:null;if(!j||j.mode!=="derived")return null;const N=j.from;if(Array.isArray(N)){for(let $=0;$<N.length;$++){const _=m(N[$],$);if(!_.grid||!E(_.grid.on))continue;const Y=P(H,_.grid,[...A,_.label],S);if(Y)return Y}return null}return W(N)&&E(N.on)?P(H,N,[...A,"(from)"],S):null}function G(H){return W(H)&&"data"in H?H.data:H}function V(H,T){if(!H||typeof H!="object")return null;if(Array.isArray(H.conditions)){for(const S of H.conditions){const R=V(S,T);if(R)return R}return null}return H.col===T?H:null}function K(H,T){return new w(H,T)}}),He("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 l}}),Object.defineProperty(e,"odataAdapter",{enumerable:!0,get:function(){return u}});const E=F("packages/core/src/internal/warn.js").warnOnce,I=F("packages/core/src/source/filterwire.js").isGroup,x=Object.freeze(["eq","ne","gt","gte","lt","lte","contains","startsWith","endsWith","blank","notBlank","between","notBetween"]),Q=/^\d{4}-\d{2}-\d{2}$/,U=/^\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/,L=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;function q(f){const p=f instanceof Date?f:typeof f=="number"&&Number.isFinite(f)?new Date(f):typeof f=="string"&&L.test(f)?new Date(f):null;return p&&!Number.isNaN(p.getTime())?p:null}const M=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function O(f,p){throw typeof p=="string"&&M.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||O("DateTimeOffset",f),p.toISOString()}function b(f){if(typeof f=="string"&&Q.test(f))return f;const p=q(f);return p||O("Date",f),p.toISOString().slice(0,10)}function a(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:a}),o=200,t=1e3,r=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 i(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=i(f.col),y=String(f.op),h=f.type;if(r[y])return`${p} ${r[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,G=`(${p} ${v} ${s(d[0],h)} and ${p} ${P} ${s(d[1],h)})`;return y==="between"?G:`(${p} eq null or not ${G})`}return null}function c(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 l(f){if(!f)return"";if(!I(f)){const h=m(f);return h===null?c(f):h}const p=String(f.op)==="or"?" or ":" and ",y=(f.conditions||[]).map(h=>{if(I(h))return l(h);const d=m(h);return d===null?c(h):d}).filter(Boolean);return y.length?y.length===1?y[0]:`(${y.join(p)})`:""}function u(f={}){const p=String(f.url||""),y=f.fetch||(typeof fetch=="function"?fetch:null),h=f.count!==!1,d=i(f.key||"id"),w=f.edit===!0;return{name:"odata",capabilities:{filter:"tree",operators:x,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=[],G=(K,H)=>P.push(`${K}=${encodeURIComponent(H)}`),V=l(v.filters);return V&&G("$filter",V),v.sort&&v.sort.length&&G("$orderby",v.sort.map(K=>`${i(K.col)}${K.dir==="desc"?" desc":" asc"}`).join(",")),v.range&&(G("$skip",String(v.range.start)),G("$top",String(v.range.end-v.range.start))),v.quick&&G("$search",`"${String(v.quick).replace(/"/g,"")}"`),h&&G("$count","true"),P.length?`${p}?${P.join("&")}`:p},async execute(v,P){if(!y)throw new Error("odataAdapter needs a fetch implementation");const G={Accept:"application/json",...f.headers||{}},V=P&&P.signal,K=async S=>{const R=await y(S,{headers:G,signal:V});if(!R.ok)throw new Error(`OData request failed: ${R.status}`);return R.json()};let H=await K(this.urlFor(v)),T=H.value||H.rows||[];const A=H["@odata.count"]??H.count;if(!v.range){let S=H["@odata.nextLink"];for(;S&&T.length<o*t;)H=await K(S),T=T.concat(H.value||H.rows||[]),S=H["@odata.nextLink"]}return A==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(A)}},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 G={Accept:"application/json","Content-Type":"application/json",...f.headers||{}},V=P&&P.signal;if(v.kind==="delete"){const S=Array.isArray(v.keys)&&v.keys.length?v.keys[0]:v.key;if(S==null)throw new Error("odataAdapter: a delete needs a row key");const R=await y(this.urlForKey(S),{method:"DELETE",headers:G,signal:V});if(!R.ok)throw new Error(`OData delete failed: ${R.status}`);return{ok:!0}}if(v.kind==="append"){const S=Array.isArray(v.rows)?v.rows.filter(_=>_&&typeof _=="object"):[];if(S.length!==1)throw new Error("odataAdapter: an append needs exactly one row object (OData creates one entity per POST)");const R=await y(p,{method:"POST",headers:G,signal:V,body:JSON.stringify(S[0])});if(!R.ok)throw new Error(`OData add-row failed: ${R.status}`);const j=R.status===204?null:await R.json().catch(()=>null),N=j&&typeof j=="object"&&"value"in j?j.value:j;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 K=this.urlForKey(v.key),H=await y(K,{method:"PATCH",headers:G,signal:V,body:JSON.stringify(v.patch||{})});if(!H.ok)throw new Error(`OData update failed: ${H.status}`);if(H.status===204)return{ok:!0};const T=await H.json(),A=T&&typeof T=="object"&&"value"in T?T.value:T;return A==null?{ok:!0}:{ok:!0,rows:[A]}}}}}),He("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 W}});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 W(I={}){const x=String(I.url||""),Q=I.fetch||(typeof fetch=="function"?fetch:null),U={...ie,...I.params||{}},L=I.encodeFilter||(t=>JSON.stringify(t)),q=I.rows||(t=>Array.isArray(t)?t:t.rows||t.data||[]),M=I.total||((t,r)=>Array.isArray(t)?r.length:t.total??t.count??r.length),O=I.edit===!0,k=I.returning==="row"?"row":I.returning==="key"?"key":"none",b=I.keyField||"id",a=I.writeUrlFor||(t=>`${x}/${encodeURIComponent(String(t.key??(t.keys&&t.keys[0])))}`),g=I.encodeMutation||(t=>{const r=E[t.kind];if(t.kind==="update")return{method:r,url:a(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:r,url:x,headers:{"Content-Type":"application/json"},body:JSON.stringify(s.length===1?s[0]:s)}}return{method:r,url:a(t)}}),o=I.writeRow||(t=>{if(t===null||typeof t!="object")return null;if(Array.isArray(t))return t.length?t[0]:null;const r=t;return r.row??r.data??t});return{name:"rest",capabilities:{range:!0,total:!0,sort:"multi",filter:!1,quick:!1,mutate:O?{update:!0,delete:!0,append:!0,returning:k}:!1,...I.capabilities||{},...I.operators?{filter:"tree",operators:I.operators}:{}},urlFor(t){const r=new URLSearchParams;t.range&&(r.set(U.offset,String(t.range.start)),r.set(U.limit,String(t.range.end-t.range.start))),t.sort&&t.sort.length&&(r.set(U.sort,t.sort.map(i=>i.col).join(",")),r.set(U.order,t.sort.map(i=>i.dir||"asc").join(","))),t.filters&&r.set(U.filter,L(t.filters)),t.quick&&r.set(U.search,String(t.quick));const s=r.toString();return s?`${x}?${s}`:x},async execute(t,r){if(!Q)throw new Error("restAdapter needs a fetch implementation");const s=await Q(this.urlFor(t),{headers:{Accept:"application/json",...I.headers||{}},signal:r&&r.signal});if(!s.ok)throw new Error(`request failed: ${s.status}`);const i=await s.json(),n=q(i);return{rows:n,total:M(i,n)}},writeUrlFor(t){return a(t)},encodeMutation(t){return g(t)},async mutate(t,r){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 i={Accept:"application/json",...I.headers||{},...s.headers||{}},n=await Q(s.url,{method:s.method,headers:i,signal:r&&r.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 l=await n.json(),u=o(l),f=u&&typeof u=="object"?u[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:[u]}:{ok:!0,keys:[String(f)]}}if(k!=="row"||n.status===204)return{ok:!0};const m=await n.json(),c=o(m);return c==null?{ok:!0}:{ok:!0,rows:[c]}}}}}),He("packages/core/src/source/adapters/dfql.js",function(e,F){"use strict";Object.defineProperty(e,"DFQL_BASE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DFQL_WRITE_URL",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"dfqlAdapter",{enumerable:!0,get:function(){return O}});const E=F("packages/core/src/internal/predicates.js").isFunction,I=F("packages/core/src/internal/warn.js").warnOnce,x="https://rest.demandflow.com",Q="https://stream.demandflow.com/dfql",U=Object.freeze(["id","created","updated","ownerId","entity"]);function L(k){const b={},a=[];for(const[g,o]of Object.entries(k||{})){if(U.includes(g)){a.push(g);continue}b[g]=o}return a.length&&I("source.dfql.protected",`a DFQL update tried to write protected field(s) ${a.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,a=[];return(typeof b.entity!="string"||!b.entity)&&a.push("entity (uppercase code)"),Number.isFinite(Number(b.level))||a.push("level (numeric)"),(typeof b.comboKey!="string"||!b.comboKey.endsWith("|ENT:"))&&a.push("comboKey (a string ending '|ENT:')"),a}async function M(k){const b=[],a=r=>{const s=r.trim();if(s)try{b.push(JSON.parse(s))}catch{}};if(!k.body||typeof k.body.getReader!="function")return(await k.text()).split(`
|