@toclocoinc/lattice-grid 1.117.2 → 1.117.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/angular/package.json +1 -1
- package/docs/API.html +4 -4
- package/docs/api/adapters.html +1 -1
- package/docs/api/ai.html +1 -1
- package/docs/api/alarms.html +1 -1
- package/docs/api/calendar.html +1 -1
- package/docs/api/charts.html +1 -1
- package/docs/api/dashboard.html +1 -1
- package/docs/api/data-router.html +1 -1
- package/docs/api/dataview.html +1 -1
- package/docs/api/deckgl.html +1 -1
- package/docs/api/designer.html +1 -1
- package/docs/api/form.html +1 -1
- package/docs/api/gantt.html +1 -1
- package/docs/api/geometry.html +1 -1
- package/docs/api/grid.html +2 -2
- package/docs/api/index.html +1 -1
- package/docs/api/kanban.html +1 -1
- package/docs/api/kpi.html +1 -1
- package/docs/api/layout.html +1 -1
- package/docs/api/leaflet.html +1 -1
- package/docs/api/list.html +1 -1
- package/docs/api/listview.html +1 -1
- package/docs/api/mapview.html +1 -1
- package/docs/api/mock-socket.html +1 -1
- package/docs/api/presets.html +1 -1
- package/docs/api/scheduler.html +1 -1
- package/docs/api/shell.html +1 -1
- package/docs/api/tabs.html +1 -1
- package/docs/api/tree.html +1 -1
- package/docs/api/types.html +1 -1
- package/docs/api-detail.html +4 -4
- package/docs/warnings.json +1 -1
- package/lattice-grid.d.ts +1 -1
- package/lattice-grid.esm.min.js +2 -2
- package/lattice-grid.min.cjs +2 -2
- package/lattice-grid.min.js +2 -2
- package/locales/all.d.ts +1 -1
- package/locales/all.esm.min.js +1 -1
- package/locales/all.min.cjs +1 -1
- package/locales/all.min.js +1 -1
- package/locales/ar.d.ts +1 -1
- package/locales/ar.esm.min.js +1 -1
- package/locales/ar.min.cjs +1 -1
- package/locales/ar.min.js +1 -1
- package/locales/cs-CZ.d.ts +1 -1
- package/locales/cs-CZ.esm.min.js +1 -1
- package/locales/cs-CZ.min.cjs +1 -1
- package/locales/cs-CZ.min.js +1 -1
- package/locales/da-DK.d.ts +1 -1
- package/locales/da-DK.esm.min.js +1 -1
- package/locales/da-DK.min.cjs +1 -1
- package/locales/da-DK.min.js +1 -1
- package/locales/de-DE.d.ts +1 -1
- package/locales/de-DE.esm.min.js +1 -1
- package/locales/de-DE.min.cjs +1 -1
- package/locales/de-DE.min.js +1 -1
- package/locales/el-GR.d.ts +1 -1
- package/locales/el-GR.esm.min.js +1 -1
- package/locales/el-GR.min.cjs +1 -1
- package/locales/el-GR.min.js +1 -1
- package/locales/en-US.d.ts +1 -1
- package/locales/en-US.esm.min.js +1 -1
- package/locales/en-US.min.cjs +1 -1
- package/locales/en-US.min.js +1 -1
- package/locales/es-ES.d.ts +1 -1
- package/locales/es-ES.esm.min.js +1 -1
- package/locales/es-ES.min.cjs +1 -1
- package/locales/es-ES.min.js +1 -1
- package/locales/fi-FI.d.ts +1 -1
- package/locales/fi-FI.esm.min.js +1 -1
- package/locales/fi-FI.min.cjs +1 -1
- package/locales/fi-FI.min.js +1 -1
- package/locales/fr-CA.d.ts +1 -1
- package/locales/fr-CA.esm.min.js +1 -1
- package/locales/fr-CA.min.cjs +1 -1
- package/locales/fr-CA.min.js +1 -1
- package/locales/fr-FR.d.ts +1 -1
- package/locales/fr-FR.esm.min.js +1 -1
- package/locales/fr-FR.min.cjs +1 -1
- package/locales/fr-FR.min.js +1 -1
- package/locales/hu-HU.d.ts +1 -1
- package/locales/hu-HU.esm.min.js +1 -1
- package/locales/hu-HU.min.cjs +1 -1
- package/locales/hu-HU.min.js +1 -1
- package/locales/it-IT.d.ts +1 -1
- package/locales/it-IT.esm.min.js +1 -1
- package/locales/it-IT.min.cjs +1 -1
- package/locales/it-IT.min.js +1 -1
- package/locales/ja-JP.d.ts +1 -1
- package/locales/ja-JP.esm.min.js +1 -1
- package/locales/ja-JP.min.cjs +1 -1
- package/locales/ja-JP.min.js +1 -1
- package/locales/nb-NO.d.ts +1 -1
- package/locales/nb-NO.esm.min.js +1 -1
- package/locales/nb-NO.min.cjs +1 -1
- package/locales/nb-NO.min.js +1 -1
- package/locales/nl-NL.d.ts +1 -1
- package/locales/nl-NL.esm.min.js +1 -1
- package/locales/nl-NL.min.cjs +1 -1
- package/locales/nl-NL.min.js +1 -1
- package/locales/pl-PL.d.ts +1 -1
- package/locales/pl-PL.esm.min.js +1 -1
- package/locales/pl-PL.min.cjs +1 -1
- package/locales/pl-PL.min.js +1 -1
- package/locales/pt-BR.d.ts +1 -1
- package/locales/pt-BR.esm.min.js +1 -1
- package/locales/pt-BR.min.cjs +1 -1
- package/locales/pt-BR.min.js +1 -1
- package/locales/ro-RO.d.ts +1 -1
- package/locales/ro-RO.esm.min.js +1 -1
- package/locales/ro-RO.min.cjs +1 -1
- package/locales/ro-RO.min.js +1 -1
- package/locales/sv-SE.d.ts +1 -1
- package/locales/sv-SE.esm.min.js +1 -1
- package/locales/sv-SE.min.cjs +1 -1
- package/locales/sv-SE.min.js +1 -1
- package/locales/uk-UA.d.ts +1 -1
- package/locales/uk-UA.esm.min.js +1 -1
- package/locales/uk-UA.min.cjs +1 -1
- package/locales/uk-UA.min.js +1 -1
- package/modules/ai.d.ts +1 -1
- package/modules/ai.esm.min.js +1 -1
- package/modules/ai.min.cjs +1 -1
- package/modules/ai.min.js +1 -1
- package/modules/alarms.d.ts +1 -1
- package/modules/alarms.esm.min.js +1 -1
- package/modules/alarms.min.cjs +1 -1
- package/modules/alarms.min.js +1 -1
- package/modules/angular.d.ts +1 -1
- package/modules/angular.esm.min.js +1 -1
- package/modules/angular.min.cjs +1 -1
- package/modules/angular.min.js +1 -1
- package/modules/calendar.d.ts +1 -1
- package/modules/calendar.esm.min.js +1 -1
- package/modules/calendar.min.cjs +1 -1
- package/modules/calendar.min.js +1 -1
- package/modules/chart-alluvial.d.ts +1 -1
- package/modules/chart-alluvial.esm.min.js +1 -1
- package/modules/chart-alluvial.min.cjs +1 -1
- package/modules/chart-alluvial.min.js +1 -1
- package/modules/chart-arc.d.ts +1 -1
- package/modules/chart-arc.esm.min.js +1 -1
- package/modules/chart-arc.min.cjs +1 -1
- package/modules/chart-arc.min.js +1 -1
- package/modules/chart-barrace.d.ts +1 -1
- package/modules/chart-barrace.esm.min.js +1 -1
- package/modules/chart-barrace.min.cjs +1 -1
- package/modules/chart-barrace.min.js +1 -1
- package/modules/chart-bubblemap.d.ts +1 -1
- package/modules/chart-bubblemap.esm.min.js +1 -1
- package/modules/chart-bubblemap.min.cjs +1 -1
- package/modules/chart-bubblemap.min.js +1 -1
- package/modules/chart-bump.d.ts +1 -1
- package/modules/chart-bump.esm.min.js +1 -1
- package/modules/chart-bump.min.cjs +1 -1
- package/modules/chart-bump.min.js +1 -1
- package/modules/chart-calendar.d.ts +1 -1
- package/modules/chart-calendar.esm.min.js +1 -1
- package/modules/chart-calendar.min.cjs +1 -1
- package/modules/chart-calendar.min.js +1 -1
- package/modules/chart-choropleth.d.ts +1 -1
- package/modules/chart-choropleth.esm.min.js +1 -1
- package/modules/chart-choropleth.min.cjs +1 -1
- package/modules/chart-choropleth.min.js +1 -1
- package/modules/chart-decomposition.d.ts +1 -1
- package/modules/chart-decomposition.esm.min.js +1 -1
- package/modules/chart-decomposition.min.cjs +1 -1
- package/modules/chart-decomposition.min.js +1 -1
- package/modules/chart-diverging.d.ts +1 -1
- package/modules/chart-diverging.esm.min.js +1 -1
- package/modules/chart-diverging.min.cjs +1 -1
- package/modules/chart-diverging.min.js +1 -1
- package/modules/chart-dumbbell.d.ts +1 -1
- package/modules/chart-dumbbell.esm.min.js +1 -1
- package/modules/chart-dumbbell.min.cjs +1 -1
- package/modules/chart-dumbbell.min.js +1 -1
- package/modules/chart-fan.d.ts +1 -1
- package/modules/chart-fan.esm.min.js +1 -1
- package/modules/chart-fan.min.cjs +1 -1
- package/modules/chart-fan.min.js +1 -1
- package/modules/chart-forcetree.d.ts +1 -1
- package/modules/chart-forcetree.esm.min.js +1 -1
- package/modules/chart-forcetree.min.cjs +1 -1
- package/modules/chart-forcetree.min.js +1 -1
- package/modules/chart-hexbin.d.ts +1 -1
- package/modules/chart-hexbin.esm.min.js +1 -1
- package/modules/chart-hexbin.min.cjs +1 -1
- package/modules/chart-hexbin.min.js +1 -1
- package/modules/chart-hexmap.d.ts +1 -1
- package/modules/chart-hexmap.esm.min.js +1 -1
- package/modules/chart-hexmap.min.cjs +1 -1
- package/modules/chart-hexmap.min.js +1 -1
- package/modules/chart-icicle.d.ts +1 -1
- package/modules/chart-icicle.esm.min.js +1 -1
- package/modules/chart-icicle.min.cjs +1 -1
- package/modules/chart-icicle.min.js +1 -1
- package/modules/chart-markermap.d.ts +1 -1
- package/modules/chart-markermap.esm.min.js +1 -1
- package/modules/chart-markermap.min.cjs +1 -1
- package/modules/chart-markermap.min.js +1 -1
- package/modules/chart-motion.d.ts +1 -1
- package/modules/chart-motion.esm.min.js +1 -1
- package/modules/chart-motion.min.cjs +1 -1
- package/modules/chart-motion.min.js +1 -1
- package/modules/chart-pack.d.ts +1 -1
- package/modules/chart-pack.esm.min.js +1 -1
- package/modules/chart-pack.min.cjs +1 -1
- package/modules/chart-pack.min.js +1 -1
- package/modules/chart-parallel.d.ts +1 -1
- package/modules/chart-parallel.esm.min.js +1 -1
- package/modules/chart-parallel.min.cjs +1 -1
- package/modules/chart-parallel.min.js +1 -1
- package/modules/chart-pictorial.d.ts +1 -1
- package/modules/chart-pictorial.esm.min.js +1 -1
- package/modules/chart-pictorial.min.cjs +1 -1
- package/modules/chart-pictorial.min.js +1 -1
- package/modules/chart-polararea.d.ts +1 -1
- package/modules/chart-polararea.esm.min.js +1 -1
- package/modules/chart-polararea.min.cjs +1 -1
- package/modules/chart-polararea.min.js +1 -1
- package/modules/chart-polarscatter.d.ts +1 -1
- package/modules/chart-polarscatter.esm.min.js +1 -1
- package/modules/chart-polarscatter.min.cjs +1 -1
- package/modules/chart-polarscatter.min.js +1 -1
- package/modules/chart-pyramid.d.ts +1 -1
- package/modules/chart-pyramid.esm.min.js +1 -1
- package/modules/chart-pyramid.min.cjs +1 -1
- package/modules/chart-pyramid.min.js +1 -1
- package/modules/chart-radialbar.d.ts +1 -1
- package/modules/chart-radialbar.esm.min.js +1 -1
- package/modules/chart-radialbar.min.cjs +1 -1
- package/modules/chart-radialbar.min.js +1 -1
- package/modules/chart-ridgeline.d.ts +1 -1
- package/modules/chart-ridgeline.esm.min.js +1 -1
- package/modules/chart-ridgeline.min.cjs +1 -1
- package/modules/chart-ridgeline.min.js +1 -1
- package/modules/chart-roc.d.ts +1 -1
- package/modules/chart-roc.esm.min.js +1 -1
- package/modules/chart-roc.min.cjs +1 -1
- package/modules/chart-roc.min.js +1 -1
- package/modules/chart-scatter3d.d.ts +1 -1
- package/modules/chart-scatter3d.esm.min.js +1 -1
- package/modules/chart-scatter3d.min.cjs +1 -1
- package/modules/chart-scatter3d.min.js +1 -1
- package/modules/chart-serpentine.d.ts +1 -1
- package/modules/chart-serpentine.esm.min.js +1 -1
- package/modules/chart-serpentine.min.cjs +1 -1
- package/modules/chart-serpentine.min.js +1 -1
- package/modules/chart-slope.d.ts +1 -1
- package/modules/chart-slope.esm.min.js +1 -1
- package/modules/chart-slope.min.cjs +1 -1
- package/modules/chart-slope.min.js +1 -1
- package/modules/chart-spiral.d.ts +1 -1
- package/modules/chart-spiral.esm.min.js +1 -1
- package/modules/chart-spiral.min.cjs +1 -1
- package/modules/chart-spiral.min.js +1 -1
- package/modules/chart-splom.d.ts +1 -1
- package/modules/chart-splom.esm.min.js +1 -1
- package/modules/chart-splom.min.cjs +1 -1
- package/modules/chart-splom.min.js +1 -1
- package/modules/chart-tree.d.ts +1 -1
- package/modules/chart-tree.esm.min.js +1 -1
- package/modules/chart-tree.min.cjs +1 -1
- package/modules/chart-tree.min.js +1 -1
- package/modules/chart-venn.d.ts +1 -1
- package/modules/chart-venn.esm.min.js +1 -1
- package/modules/chart-venn.min.cjs +1 -1
- package/modules/chart-venn.min.js +1 -1
- package/modules/chart-voronoi.d.ts +1 -1
- package/modules/chart-voronoi.esm.min.js +1 -1
- package/modules/chart-voronoi.min.cjs +1 -1
- package/modules/chart-voronoi.min.js +1 -1
- package/modules/chart-waffle.d.ts +1 -1
- package/modules/chart-waffle.esm.min.js +1 -1
- package/modules/chart-waffle.min.cjs +1 -1
- package/modules/chart-waffle.min.js +1 -1
- package/modules/chart-wordcloud.d.ts +1 -1
- package/modules/chart-wordcloud.esm.min.js +1 -1
- package/modules/chart-wordcloud.min.cjs +1 -1
- package/modules/chart-wordcloud.min.js +1 -1
- package/modules/charts.d.ts +1 -1
- package/modules/charts.esm.min.js +1 -1
- package/modules/charts.min.cjs +1 -1
- package/modules/charts.min.js +1 -1
- package/modules/contextmenu.d.ts +1 -1
- package/modules/contextmenu.esm.min.js +1 -1
- package/modules/contextmenu.min.cjs +1 -1
- package/modules/contextmenu.min.js +1 -1
- package/modules/dashboard.d.ts +1 -1
- package/modules/dashboard.esm.min.js +1 -1
- package/modules/dashboard.min.cjs +1 -1
- package/modules/dashboard.min.js +1 -1
- package/modules/data-router.d.ts +1 -1
- package/modules/data-router.esm.min.js +1 -1
- package/modules/data-router.min.cjs +1 -1
- package/modules/data-router.min.js +1 -1
- package/modules/dataview.d.ts +1 -1
- package/modules/dataview.esm.min.js +1 -1
- package/modules/dataview.min.cjs +1 -1
- package/modules/dataview.min.js +1 -1
- package/modules/deckgl.d.ts +1 -1
- package/modules/deckgl.esm.min.js +1 -1
- package/modules/deckgl.min.cjs +1 -1
- package/modules/deckgl.min.js +1 -1
- package/modules/designer.d.ts +1 -1
- package/modules/designer.esm.min.js +1 -1
- package/modules/designer.min.cjs +1 -1
- package/modules/designer.min.js +1 -1
- package/modules/devtools.d.ts +1 -1
- package/modules/devtools.esm.min.js +1 -1
- package/modules/devtools.min.cjs +1 -1
- package/modules/devtools.min.js +1 -1
- package/modules/dhtmlx-compat.d.ts +1 -1
- package/modules/dhtmlx-compat.esm.min.js +1 -1
- package/modules/dhtmlx-compat.min.cjs +1 -1
- package/modules/dhtmlx-compat.min.js +1 -1
- package/modules/form.d.ts +1 -1
- package/modules/form.esm.min.js +17 -17
- package/modules/form.esm.min.js.map +2 -2
- package/modules/form.min.cjs +17 -17
- package/modules/form.min.js +17 -17
- package/modules/form.min.js.map +2 -2
- package/modules/gantt.d.ts +1 -1
- package/modules/gantt.esm.min.js +1 -1
- package/modules/gantt.min.cjs +1 -1
- package/modules/gantt.min.js +1 -1
- package/modules/geo-europe-nuts.d.ts +1 -1
- package/modules/geo-europe-nuts.esm.min.js +1 -1
- package/modules/geo-europe-nuts.min.cjs +1 -1
- package/modules/geo-europe-nuts.min.js +1 -1
- package/modules/geo-uk.d.ts +1 -1
- package/modules/geo-uk.esm.min.js +1 -1
- package/modules/geo-uk.min.cjs +1 -1
- package/modules/geo-uk.min.js +1 -1
- package/modules/geo-us-states.d.ts +1 -1
- package/modules/geo-us-states.esm.min.js +1 -1
- package/modules/geo-us-states.min.cjs +1 -1
- package/modules/geo-us-states.min.js +1 -1
- package/modules/geo-world-110m.d.ts +1 -1
- package/modules/geo-world-110m.esm.min.js +1 -1
- package/modules/geo-world-110m.min.cjs +1 -1
- package/modules/geo-world-110m.min.js +1 -1
- package/modules/geo-world-50m.d.ts +1 -1
- package/modules/geo-world-50m.esm.min.js +1 -1
- package/modules/geo-world-50m.min.cjs +1 -1
- package/modules/geo-world-50m.min.js +1 -1
- package/modules/geometry.d.ts +1 -1
- package/modules/geometry.esm.min.js +1 -1
- package/modules/geometry.min.cjs +1 -1
- package/modules/geometry.min.js +1 -1
- package/modules/htmx.d.ts +1 -1
- package/modules/htmx.esm.min.js +2 -2
- package/modules/htmx.min.cjs +2 -2
- package/modules/htmx.min.js +2 -2
- package/modules/htmx.shared.esm.min.js +1 -1
- package/modules/htmx.shared.min.cjs +1 -1
- package/modules/htmx.shared.min.js +1 -1
- package/modules/kanban.d.ts +1 -1
- package/modules/kanban.esm.min.js +1 -1
- package/modules/kanban.min.cjs +1 -1
- package/modules/kanban.min.js +1 -1
- package/modules/kpi.d.ts +1 -1
- package/modules/kpi.esm.min.js +1 -1
- package/modules/kpi.min.cjs +1 -1
- package/modules/kpi.min.js +1 -1
- package/modules/layout.d.ts +1 -1
- package/modules/layout.esm.min.js +1 -1
- package/modules/layout.min.cjs +1 -1
- package/modules/layout.min.js +1 -1
- package/modules/leaflet.d.ts +1 -1
- package/modules/leaflet.esm.min.js +1 -1
- package/modules/leaflet.min.cjs +1 -1
- package/modules/leaflet.min.js +1 -1
- package/modules/list.d.ts +1 -1
- package/modules/list.esm.min.js +1 -1
- package/modules/list.min.cjs +1 -1
- package/modules/list.min.js +1 -1
- package/modules/listview.d.ts +1 -1
- package/modules/listview.esm.min.js +1 -1
- package/modules/listview.min.cjs +1 -1
- package/modules/listview.min.js +1 -1
- package/modules/mapview.d.ts +1 -1
- package/modules/mapview.esm.min.js +1 -1
- package/modules/mapview.min.cjs +1 -1
- package/modules/mapview.min.js +1 -1
- package/modules/mock-socket.d.ts +1 -1
- package/modules/mock-socket.esm.min.js +1 -1
- package/modules/mock-socket.min.cjs +1 -1
- package/modules/mock-socket.min.js +1 -1
- package/modules/presets.d.ts +1 -1
- package/modules/presets.esm.min.js +1 -1
- package/modules/presets.min.cjs +1 -1
- package/modules/presets.min.js +1 -1
- package/modules/react.d.ts +1 -1
- package/modules/react.esm.min.js +1 -1
- package/modules/react.min.cjs +1 -1
- package/modules/react.min.js +1 -1
- package/modules/recordeditor.d.ts +1 -1
- package/modules/recordeditor.esm.min.js +1 -1
- package/modules/recordeditor.min.cjs +1 -1
- package/modules/recordeditor.min.js +1 -1
- package/modules/scheduler.d.ts +1 -1
- package/modules/scheduler.esm.min.js +1 -1
- package/modules/scheduler.min.cjs +1 -1
- package/modules/scheduler.min.js +1 -1
- package/modules/shell.d.ts +1 -1
- package/modules/shell.esm.min.js +1 -1
- package/modules/shell.min.cjs +1 -1
- package/modules/shell.min.js +1 -1
- package/modules/sidebar.d.ts +1 -1
- package/modules/sidebar.esm.min.js +1 -1
- package/modules/sidebar.min.cjs +1 -1
- package/modules/sidebar.min.js +1 -1
- package/modules/svelte.d.ts +1 -1
- package/modules/svelte.esm.min.js +1 -1
- package/modules/svelte.min.cjs +1 -1
- package/modules/svelte.min.js +1 -1
- package/modules/tabs.d.ts +1 -1
- package/modules/tabs.esm.min.js +1 -1
- package/modules/tabs.min.cjs +1 -1
- package/modules/tabs.min.js +1 -1
- package/modules/toolbar.d.ts +1 -1
- package/modules/toolbar.esm.min.js +1 -1
- package/modules/toolbar.min.cjs +1 -1
- package/modules/toolbar.min.js +1 -1
- package/modules/tree.d.ts +1 -1
- package/modules/tree.esm.min.js +1 -1
- package/modules/tree.min.cjs +1 -1
- package/modules/tree.min.js +1 -1
- package/modules/vue.d.ts +1 -1
- package/modules/vue.esm.min.js +1 -1
- package/modules/vue.min.cjs +1 -1
- package/modules/vue.min.js +1 -1
- package/modules/webcomponent.d.ts +1 -1
- package/modules/webcomponent.esm.min.js +2 -2
- package/modules/webcomponent.min.cjs +2 -2
- package/modules/webcomponent.min.js +2 -2
- package/package.json +1 -1
package/modules/htmx.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.117.
|
|
2
|
+
* Lattice Grid 1.117.3, htmx module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
6
6
|
(function(xr){"use strict";var gs=!0,ar=Object.create(null),lr=Object.create(null);function Ve(e,D){ar[e]=D}function Kn(e){var D=lr[e];if(D)return D;var re=Object.create(null);lr[e]=re;var A=ar[e];if(!A)throw new Error("[lattice] missing module: "+e);return A(re,Kn),re}Ve("packages/core/src/internal/predicates.js",function(e,D){"use strict";Object.defineProperty(e,"isObject",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"isFunction",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"isNil",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"isBlank",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"isCtor",{enumerable:!0,get:function(){return L}});function re(Q){return Q!==null&&typeof Q=="object"&&!Array.isArray(Q)}function A(Q){return typeof Q=="function"}function Y(Q){return Q==null}function I(Q){return Q==null||Q===""}function L(Q){return typeof Q!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(Q))?!0:!!(Q.prototype&&Object.getOwnPropertyNames(Q.prototype).length>1)}}),Ve("packages/core/src/internal/warn.js",function(e,D){"use strict";Object.defineProperty(e,"reportedWarnings",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"warnOnce",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"infoOnce",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resetWarnings",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"fail",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"invariant",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"DEV",{enumerable:!0,get:function(){return g}});const re=new Set,A=2e3;function Y(o){if(re.add(o),re.size>A){const t=re.values().next().value;t!==void 0&&re.delete(t)}}const I=[],L=500;function Q(o,t,s){I.push({key:o,level:t,message:s.map(r=>typeof r=="string"?r:H(r)).join(" "),at:Date.now()}),I.length>L&&I.shift()}function H(o){if(o instanceof Error)return o.message;try{return JSON.stringify(o)}catch{return String(o)}}function $(){return I.map(o=>({...o}))}function X(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 F(o,...t){if(re.has(o))return;Y(o);const s=X(t);Q(o,"warn",s),console.warn("[lattice]",...s)}function j(o,...t){if(re.has(o))return;Y(o);const s=X(t);Q(o,"info",s),console.info("[lattice]",...s)}function v(){re.clear(),I.length=0}function b(o,t){const s=new Error(`[lattice] ${o}`);throw t!==void 0&&(s.cause=t),s}function l(o,t){o||b(t)}const g=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})()}),Ve("packages/core/src/formatting/rules.js",function(e,D){"use strict";Object.defineProperty(e,"RULE_OPS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"DISTRIBUTION_OPS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"DISTRIBUTION_LABELS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"testRule",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"mixColour",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"summariseColumn",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"quantileOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"needsDistribution",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"resolveDistribution",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"ICON_SETS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"compileRules",{enumerable:!0,get:function(){return G}});const A=D("packages/core/src/internal/predicates.js").isFunction,I=D("packages/core/src/internal/warn.js").warnOnce,L=Object.freeze(["eq","ne","gt","gte","lt","lte","between","outside","contains","notContains","startsWith","endsWith","blank","notBlank","true","false"]),Q=Object.freeze(["topPercent","bottomPercent","topN","bottomN","aboveMean","belowMean","aboveMedian","belowMedian","zAbove","zBelow","outlier"]),H=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 $(S,C){const N=Number(S),O=Number(C);if(S!==null&&S!==""&&C!==null&&C!==""&&Number.isFinite(N)&&Number.isFinite(O))return N<O?-1:N>O?1:0;const R=String(S??"").toLowerCase(),x=String(C??"").toLowerCase();return R<x?-1:R>x?1:0}function X(S){return S==null||S===""}function F(S,C){if(!C||typeof C!="object")return!1;const{op:N}=C,O=C.value,T=C.value2;switch(N){case"blank":return X(S);case"notBlank":return!X(S);case"true":return S===!0;case"false":return S===!1;default:break}if(X(S))return!1;switch(N){case"eq":return $(S,O)===0;case"ne":return $(S,O)!==0;case"gt":return $(S,O)>0;case"gte":return $(S,O)>=0;case"lt":return $(S,O)<0;case"lte":return $(S,O)<=0;case"between":return $(S,O)>=0&&$(S,T)<=0;case"outside":return $(S,O)<0||$(S,T)>0;case"contains":return String(S).toLowerCase().includes(String(O??"").toLowerCase());case"notContains":return!String(S).toLowerCase().includes(String(O??"").toLowerCase());case"startsWith":return String(S).toLowerCase().startsWith(String(O??"").toLowerCase());case"endsWith":return String(S).toLowerCase().endsWith(String(O??"").toLowerCase());default:return!1}}function j(S,C,N){const O=W=>{const Z=String(W).replace("#",""),ne=Z.length===3?Z.split("").map(ie=>ie+ie).join(""):Z;return[0,2,4].map(ie=>parseInt(ne.slice(ie,ie+2),16)||0)},[T,R,x]=O(S),[U,V,J]=O(C),_=Math.max(0,Math.min(1,N)),ee=(W,Z)=>Math.round(W+(Z-W)*_);return`#${[ee(T,U),ee(R,V),ee(x,J)].map(W=>W.toString(16).padStart(2,"0")).join("")}`}function v(S){const C=[];for(const U of S||[]){if(U==null||U==="")continue;const V=U instanceof Date?U.getTime():Number(U);Number.isFinite(V)&&C.push(V)}if(!C.length)return null;C.sort((U,V)=>U-V);let N=0,O=0,T=0;for(const U of C){N++;const V=U-O;O+=V/N,T+=V*(U-O)}const R=b(C,.25),x=b(C,.75);return{n:C.length,min:C[0],max:C[C.length-1],mean:O,stddev:C.length>1?Math.sqrt(T/(C.length-1)):0,median:b(C,.5),q1:R,q3:x,iqr:x-R,sorted:C}}function b(S,C){if(!S.length)return 0;const N=(S.length-1)*Math.max(0,Math.min(1,C)),O=Math.floor(N),T=Math.ceil(N);return O===T?S[O]:S[O]+(N-O)*(S[T]-S[O])}function l(S){for(const C of Array.isArray(S)?S:[])if(!(!C||typeof C!="object")&&(C.when&&Q.includes(C.when.op)||C.scale&&C.scale.from||C.dataBar&&!(Number.isFinite(Number(C.dataBar.min))&&Number.isFinite(Number(C.dataBar.max)))||C.iconSet&&!Array.isArray(C.iconSet.thresholds)))return!0;return!1}function g(S,C){const N=Number(S.value),O=T=>b(C.sorted,T);switch(S.op){case"topPercent":{const T=o(N,10);return{op:"gte",value:O(1-T)}}case"bottomPercent":{const T=o(N,10);return{op:"lte",value:O(T)}}case"topN":{const T=Math.max(1,Math.floor(N)||1),R=Math.max(0,C.sorted.length-T);return{op:"gte",value:C.sorted[R]}}case"bottomN":{const T=Math.max(1,Math.floor(N)||1),R=Math.min(C.sorted.length-1,T-1);return{op:"lte",value:C.sorted[R]}}case"aboveMean":return{op:"gt",value:C.mean};case"belowMean":return{op:"lt",value:C.mean};case"aboveMedian":return{op:"gt",value:C.median};case"belowMedian":return{op:"lt",value:C.median};case"zAbove":return C.stddev?{op:"gte",value:C.mean+(Number.isFinite(N)?N:2)*C.stddev}:null;case"zBelow":return C.stddev?{op:"lte",value:C.mean-(Number.isFinite(N)?N:2)*C.stddev}:null;case"outlier":{const T=(Number.isFinite(N)&&N>0?N:1.5)*C.iqr;return C.iqr?{op:"outside",value:C.q1-T,value2:C.q3+T}:null}default:return null}}function o(S,C){const N=Number.isFinite(S)?S:C,O=N>1?N/100:N;return Math.max(0,Math.min(1,O))}function t(S,C){if(S.from==="minmax")return{...S,min:C.min,max:C.max};if(S.from==="quantile")return{...S,min:b(C.sorted,o(Number(S.low),5)),max:b(C.sorted,o(Number(S.high),95))};if(S.from==="stddev"){const N=Number.isFinite(Number(S.deviations))?Number(S.deviations):2;return{...S,min:C.mean-N*C.stddev,max:C.mean+N*C.stddev}}return S}function s(S,C){const N=Array.isArray(S)?S:[];return!C||!C.n?N.map(O=>O&&l([O])?{...O,enabled:!1}:O):N.map(O=>{if(!O||typeof O!="object")return O;if(O.scale&&O.scale.from)return{...O,scale:t(O.scale,C)};if(O.dataBar)return{...O,dataBar:r(O.dataBar,C)};if(O.iconSet)return{...O,iconSet:i(O.iconSet,C)};if(!O.when||!Q.includes(O.when.op))return O;const T=g(O.when,C);return T?{...O,when:T}:{...O,enabled:!1}})}function r(S,C){const N=Number.isFinite(Number(S.min))?Number(S.min):void 0,O=Number.isFinite(Number(S.max))?Number(S.max):void 0;if(N!==void 0&&O!==void 0)return{...S,min:N,max:O};if(S.from==="quantile")return{...S,min:N??b(C.sorted,o(Number(S.low),5)),max:O??b(C.sorted,o(Number(S.high),95))};if(S.from==="stddev"){const T=Number.isFinite(Number(S.deviations))?Number(S.deviations):2;return{...S,min:N??C.mean-T*C.stddev,max:O??C.mean+T*C.stddev}}return{...S,min:N??C.min,max:O??C.max}}function i(S,C){if(Array.isArray(S.thresholds))return S;const N=n(S),O=[];for(let T=1;T<N;T++)O.push(b(C.sorted,T/N));return{...S,thresholds:O}}function n(S){if(Array.isArray(S.icons)&&S.icons.length>=2)return S.icons.length;if(Number.isFinite(Number(S.count))&&Number(S.count)>=2)return Math.floor(Number(S.count));const C=y[S.set];return C?C.length:3}function m(S){return`url("data:image/svg+xml,${encodeURIComponent(S)}")`}function c(S){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="${S}"/></svg>`}function a(S,C){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><polygon points="${C==="up"?"8,2 14,13 2,13":C==="down"?"2,3 14,3 8,14":"4,2 14,8 4,14"}" fill="${S}"/></svg>`}function u(S,C){const N="M8 1l1.9 3.9 4.3.6-3.1 3 .7 4.3L8 13.8 4.2 15.8l.7-4.3-3.1-3 4.3-.6z";let O=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${C*16} 16">`;for(let T=0;T<C;T++){const R=T<S?"#f5a623":"#d0d0d0";O+=`<path transform="translate(${T*16},0)" d="${N}" fill="${R}"/>`}return`${O}</svg>`}const h=Object.freeze([a("#c0392b","down"),a("#e0a800","right"),a("#2e7d32","up")]),p=Object.freeze([c("#d13438"),c("#f5a623"),c("#2e9e44")]),y=Object.freeze({arrows:h,trafficLights:p,ratings:Object.freeze([1,2,3,4,5].map(S=>u(S,5)))}),d=Object.freeze({arrows:"Arrows",trafficLights:"Traffic lights",ratings:"Ratings"});function f(S){if(Array.isArray(S.icons)&&S.icons.length>=2)return S.icons.map(O=>/^\s*(url\(|data:|<)/.test(String(O))&&String(O).trim().startsWith("<")?m(String(O)):String(O));const C=S.set||"arrows";if(C==="ratings"){const O=n(S),T=[];for(let R=1;R<=O;R++)T.push(m(u(R,O)));return T}const N=y[C];return N?N.map(m):(I(`iconSet:${C}`,`unknown icon set '${C}'; falling back to arrows.`),h.map(m))}function w(S){const C=Number(S.min),O=Number(S.max)-C,T=S.colour||S.color||"#5b9bd5",R=S.negativeColour||S.negativeColor||"#d13438",x=S.direction==="rtl"?"left":"right",U=J=>Math.max(0,Math.min(1,(J-C)/O))*100,V=O?Math.max(0,Math.min(100,(0-C)/O*100)):0;return J=>{if(X(J))return null;const _=Number(J);if(!Number.isFinite(_)||!O)return null;const ee=U(_),W=Math.min(ee,V),Z=Math.max(ee,V),ne=_>=0?T:R;return{backgroundImage:`linear-gradient(to ${x}, transparent ${W}%, ${ne} ${W}%, ${ne} ${Z}%, transparent ${Z}%)`,backgroundRepeat:"no-repeat",backgroundPosition:"0 0"}}}function k(S){const C=f(S),N=S.reverse?[...C].reverse():C,O=(Array.isArray(S.thresholds)?S.thresholds:[]).map(Number).filter(Number.isFinite),T=Number.isFinite(Number(S.size))?Number(S.size):16,R=S.set==="ratings"?T*n(S):T;return x=>{if(X(x))return null;const U=Number(x);if(!Number.isFinite(U))return null;let V=0;for(const _ of O)U>=_&&V++;const J=N[Math.min(V,N.length-1)];return J?{backgroundImage:J,backgroundRepeat:"no-repeat",backgroundPosition:"left center",backgroundSize:`${R}px ${T}px`,paddingLeft:`${R+4}px`}:null}}function P(S){const C=Array.isArray(S.colours)&&S.colours.length>=2?S.colours:["#f8f9fa","#1a6bc7"],N=Number(S.min),O=Number(S.max),T=O-N,R=C.length-1,x=[];for(let V=0;V<=R;V++)x.push(R?V/R:0);const U=Number(S.mid);if(S.mid!==void 0&&S.mid!==null)if(C.length%2===0)I("formatting.scale.mid.even",`a scale's "mid" needs an odd number of colours (a middle stop to pin); ${C.length} were given, so "mid" was ignored.`);else if(Number.isFinite(U)&&T&&U>Math.min(N,O)&&U<Math.max(N,O)){const V=R/2,J=Math.max(0,Math.min(1,(U-N)/T));for(let _=0;_<=R;_++)x[_]=_<=V?V?_/V*J:J:J+(_-V)/(R-V)*(1-J)}else Number.isFinite(U)&&I("formatting.scale.mid.range",`a scale's "mid" (${U}) is outside its min..max range, so it was ignored.`);return V=>{const J=Number(V);if(!Number.isFinite(J)||!T)return null;const _=Math.max(0,Math.min(1,(J-N)/T));let ee=0;for(;ee<R-1&&_>x[ee+1];)ee++;const W=x[ee+1]-x[ee],Z=W>0?(_-x[ee])/W:0;return{background:j(C[ee],C[ee+1],Math.max(0,Math.min(1,Z)))}}}function G(S,C=null){const N=l(S)?s(S,C):S,O=(Array.isArray(N)?N:[]).filter(x=>x&&typeof x=="object");if(!O.length)return()=>null;const T=O.map(x=>x.scale?{scale:P(x.scale),enabled:x.enabled!==!1}:x.dataBar?{scale:w(x.dataBar),enabled:x.enabled!==!1}:x.iconSet?{scale:k(x.iconSet),enabled:x.enabled!==!1}:{when:x.when,style:x.style,stop:x.stopIfTrue!==!1,enabled:x.enabled!==!1}),R=K(T)?E():null;return(x,U)=>{const V=x?x.value:void 0;let J=null;U&&(U.mode=0);for(const _ of T){if(!_.enabled)continue;if(_.scale){const Z=_.scale(V);Z&&(J={...J||{},...Z});continue}if(!F(V,_.when))continue;let ee;const W=A(_.style);if(W?U&&R?(ee=_.style(R.enter(x)),R.mode>U.mode&&(U.mode=R.mode)):ee=_.style(x):ee=_.style,ee&&(J=J?{...J,...ee}:W?ee:{...ee}),_.stop)break}return J}}function K(S){return S.some(C=>C.enabled&&!C.scale&&A(C.style))}const q=new Set(["value","colId","column"]),B=new Set(["row","data","index"]);function E(){let S={};const C={mode:0,enter(T){return S=T||{},C.mode=0,O}},N=T=>{if(q.has(T))return;const R=B.has(T)?1:2;R>C.mode&&(C.mode=R)},O=new Proxy({},{get(T,R){return N(R),S[R]},has(T,R){return N(R),R in S},set(T,R,x){return C.mode=2,S[R]=x,!0},ownKeys(){return C.mode=2,Reflect.ownKeys(S)},getOwnPropertyDescriptor(T,R){C.mode=2;const x=Object.getOwnPropertyDescriptor(S,R);return x?{value:S[R],enumerable:x.enumerable,configurable:!0,writable:!0}:void 0}});return C}}),Ve("packages/core/src/formula/parse.js",function(e,D){"use strict";Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return F}}),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 s}});const re="num",A="str",Y="ref",I="name",L="op",Q="end",H=["<=",">=","<>","!="],$="+-*/^%(),<>=";class X extends Error{constructor(i,n){super(i),this.name="FormulaError",this.at=n}}function F(r){const i=[];let n=0;for(;n<r.length;){const m=r[n];if(m===" "||m===" "||m===`
|
|
7
|
-
`||m==="\r"){n++;continue}if(m>="0"&&m<="9"){n=v(r,n,i);continue}if(m==="."&&r[n+1]>="0"&&r[n+1]<="9"){n=v(r,n,i);continue}if(m==='"'||m==="'"){n=b(r,n,i);continue}if(m==="["){const a=r.indexOf("]",n+1);if(a<0)throw new X("a [column reference] was opened and never closed",n);i.push({kind:Y,value:r.slice(n+1,a).trim(),at:n}),n=a+1;continue}if(j(m)){n=l(r,n,i);continue}const c=r.slice(n,n+2);if(H.includes(c)){i.push({kind:L,value:c==="!="?"<>":c,at:n}),n+=2;continue}if($.includes(m)){i.push({kind:L,value:m,at:n}),n++;continue}throw new X(`unexpected character ${JSON.stringify(m)}`,n)}return i.push({kind:Q,value:null,at:r.length}),i}function j(r){return/[A-Za-z_À-]/.test(r)}function v(r,i,n){let m=i,c=!1;for(;m<r.length;){const a=r[m];if(a>="0"&&a<="9"){m++;continue}if(a==="."&&!c){c=!0,m++;continue}if((a==="e"||a==="E")&&/[0-9+-]/.test(r[m+1]||"")){for(m+=2;m<r.length&&r[m]>="0"&&r[m]<="9";)m++;break}break}return n.push({kind:re,value:Number(r.slice(i,m)),at:i}),m}function b(r,i,n){const m=r[i];let c=i+1,a="";for(;c<r.length;){if(r[c]===m){if(r[c+1]===m){a+=m,c+=2;continue}return n.push({kind:A,value:a,at:i}),c+1}a+=r[c],c++}throw new X("a string was opened and never closed",i)}function l(r,i,n){let m=i;for(;m<r.length&&/[A-Za-z0-9_.À-]/.test(r[m]);)m++;const c=r.slice(i,m);let a=m;for(;a<r.length&&r[a]===" ";)a++;return n.push({kind:r[a]==="("?I:Y,value:c,at:i}),m}const g={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function o(r){const i=String(r??"").replace(/^\s*=/,"");if(!i.trim())throw new X("the formula is empty");const n=F(i);let m=0;const c=()=>n[m],a=()=>n[m++],u=k=>{const P=c();if(P.kind!==L||P.value!==k)throw new X(`expected ${JSON.stringify(k)}`,P.at);m++},h=k=>{let P=p();for(;;){const G=c();if(G.kind!==L)break;const K=g[G.value];if(!K||K<k)break;m++;const q=h(G.value==="^"?K:K+1);P={kind:"bin",op:G.value,left:P,right:q}}return P},p=()=>{const k=c();return k.kind===L&&(k.value==="-"||k.value==="+")?(m++,{kind:"unary",op:k.value,arg:p()}):y()},y=()=>{let k=d();for(;c().kind===L&&c().value==="%";)m++,k={kind:"unary",op:"%",arg:k};return k},d=()=>{const k=a();if(k.kind===re)return{kind:"num",value:k.value};if(k.kind===A)return{kind:"str",value:k.value};if(k.kind===Y)return{kind:"ref",name:k.value};if(k.kind===I){u("(");const P=[];if(!(c().kind===L&&c().value===")"))for(;;){if(P.push(h(1)),c().kind===L&&c().value===","){m++;continue}break}return u(")"),{kind:"call",name:String(k.value).toUpperCase(),args:P}}if(k.kind===L&&k.value==="("){const P=h(1);return u(")"),P}throw k.kind===Q?new X("the formula ends unexpectedly",k.at):new X(`unexpected ${JSON.stringify(k.value)}`,k.at)},f=h(1),w=c();if(w.kind!==Q)throw new X(`unexpected ${JSON.stringify(w.value)}: is an operator missing?`,w.at);return f}function t(r){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(r),[...i]}function s(r){return typeof r=="string"&&/^\s*=/.test(r)&&r.trim()!=="="}}),Ve("packages/core/src/formula/evaluate.js",function(e,D){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return v}});const A=D("packages/core/src/formula/parse.js").FormulaError;function Y(b){if(b==null||b==="")return 0;if(typeof b=="boolean")return b?1:0;if(b instanceof Date)return b.getTime();const l=typeof b=="number"?b:Number(String(b).replace(/[,\s]/g,""));if(!Number.isFinite(l))throw new A(`${JSON.stringify(b)} is not a number`);return l}function I(b){return b==null?"":String(b)}function L(b){if(typeof b=="boolean")return b;if(b==null||b==="")return!1;if(typeof b=="number")return b!==0;const l=String(b).trim().toLowerCase();return l==="false"||l==="no"||l==="0"?!1:l!==""}function Q(b){const l=[];for(const g of b){if(Array.isArray(g)){for(const o of g)o!=null&&o!==""&&l.push(Y(o));continue}g==null||g===""||l.push(Y(g))}return l}function H(b,l){const g=10**l,o=b*g;return Math.sign(o)*Math.round(Math.abs(o)+Number.EPSILON*Math.abs(o))/g}function $(b,l){if(!b.length)return 0;const g=b.slice().sort((r,i)=>r-i),o=(g.length-1)*Math.min(1,Math.max(0,l)),t=Math.floor(o),s=Math.ceil(o);return t===s?g[t]:g[t]+(o-t)*(g[s]-g[t])}function X(b,l){let g=0,o=0,t=0;for(const r of b){g++;const i=r-o;o+=i/g,t+=i*(r-o)}const s=l?g-1:g;return s>0?Math.sqrt(t/s):0}const F={SUM:b=>Q(b).reduce((l,g)=>l+g,0),AVERAGE:b=>{const l=Q(b);return l.length?l.reduce((g,o)=>g+o,0)/l.length:0},MIN:b=>{const l=Q(b);return l.length?Math.min(...l):0},MAX:b=>{const l=Q(b);return l.length?Math.max(...l):0},COUNT:b=>Q(b).length,PRODUCT:b=>Q(b).reduce((l,g)=>l*g,1),ROUND:b=>H(Y(b[0]),b.length>1?Y(b[1]):0),ROUNDDOWN:b=>{const l=10**(b.length>1?Y(b[1]):0),g=Y(b[0])*l;return(g<0?Math.ceil(g):Math.floor(g))/l},ROUNDUP:b=>{const l=10**(b.length>1?Y(b[1]):0),g=Y(b[0])*l;return(g<0?Math.floor(g):Math.ceil(g))/l},ABS:b=>Math.abs(Y(b[0])),FLOOR:b=>Math.floor(Y(b[0])),CEILING:b=>Math.ceil(Y(b[0])),SQRT:b=>Math.sqrt(Y(b[0])),POWER:b=>Y(b[0])**Y(b[1]),MOD:b=>{const l=Y(b[1]);if(l===0)throw new A("MOD by zero");return(Y(b[0])%l+l)%l},IF:b=>L(b[0])?b[1]:b.length>2?b[2]:!1,AND:b=>b.every(L),OR:b=>b.some(L),NOT:b=>!L(b[0]),COALESCE:b=>b.find(l=>l!=null&&l!=="")??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?Y(b[1]):1),RIGHT:b=>{const l=b.length>1?Y(b[1]):1;return l<=0?"":I(b[0]).slice(-l)},MEDIAN:b=>$(Q(b),.5),PERCENTILE:b=>{const l=Y(b[b.length-1]);return $(Q(b.slice(0,-1)),l>1?l/100:l)},QUARTILE1:b=>$(Q(b),.25),QUARTILE3:b=>$(Q(b),.75),STDEV:b=>X(Q(b),!0),STDEVP:b=>X(Q(b),!1),VAR:b=>{const l=X(Q(b),!0);return l*l},VARP:b=>{const l=X(Q(b),!1);return l*l},COUNTDISTINCT:b=>{const l=new Set;for(const g of b){const o=Array.isArray(g)?g:[g];for(const t of o)t!=null&&t!==""&&l.add(t)}return l.size},IQR:b=>{const l=Q(b);return $(l,.75)-$(l,.25)}};F.AVG=F.AVERAGE,F.CEIL=F.CEILING,F.POW=F.POWER,F.STDEVS=F.STDEV,F.PERCENTILEINC=F.PERCENTILE;function j(b,l){const g=Number(b),o=Number(l);if(b!==null&&b!==""&&l!==null&&l!==""&&Number.isFinite(g)&&Number.isFinite(o))return g<o?-1:g>o?1:0;const s=I(b).toLowerCase(),r=I(l).toLowerCase();return s<r?-1:s>r?1:0}function v(b,l={}){const g=typeof l.lookup=="function"?l.lookup:null,o=l.functions?{...F,...l.functions}:F,t=s=>{switch(s.kind){case"num":return s.value;case"str":return s.value;case"ref":{if(!g)throw new A(`there is no column called ${JSON.stringify(s.name)} here`);const r=g(String(s.name));if(r===void 0)throw new A(`there is no column called ${JSON.stringify(s.name)}`);return r}case"unary":{if(s.op==="%")return Y(t(s.arg))/100;const r=Y(t(s.arg));return s.op==="-"?-r:r}case"bin":{const r=s.op;if(r==="=")return j(t(s.left),t(s.right))===0;if(r==="<>")return j(t(s.left),t(s.right))!==0;if(r==="<")return j(t(s.left),t(s.right))<0;if(r==="<=")return j(t(s.left),t(s.right))<=0;if(r===">")return j(t(s.left),t(s.right))>0;if(r===">=")return j(t(s.left),t(s.right))>=0;const i=Y(t(s.left)),n=Y(t(s.right));if(r==="+")return i+n;if(r==="-")return i-n;if(r==="*")return i*n;if(r==="^")return i**n;if(r==="/"){if(n===0)throw new A("division by zero");return i/n}throw new A(`unknown operator ${JSON.stringify(r)}`)}case"call":{const r=l.lazy&&l.lazy[s.name];if(typeof r=="function")return r(s.args,t,l);const i=o[s.name];if(typeof i!="function")throw new A(`there is no function called ${s.name}`);return i(s.args.map(t),l)}default:throw new A("the formula could not be read")}};return t(b)}}),Ve("packages/core/src/formula/index.js",function(e,D){"use strict";Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return j}});const re=D("packages/core/src/formula/parse.js"),A=re.parseFormula,Y=re.referencesOf,I=re.looksLikeFormula,L=re.FormulaError,Q=re.tokenise,H=D("packages/core/src/formula/evaluate.js"),$=H.evaluateAst,X=H.FUNCTIONS;function F(v){const{grid:b,row:l,data:g}=v||{},o=n=>String(n).toLowerCase().replace(/[\s_-]/g,""),t=b&&b.columns&&typeof b.columns.all=="function"?b.columns.all():[],s=b&&b.permissions,r=s&&typeof s.isReadable=="function"?n=>s.isReadable(n):()=>!0,i=new Set;for(const n of t)r(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 L(`"${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 l&&b.rows&&typeof b.rows.value=="function"?b.rows.value(l.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(!r(c))throw new L(`"${n}" cannot be read`);return g[c]}}}}function j(v,b={}){try{const l=A(v);return{ok:!0,value:$(l,{lookup:F(b),functions:b.formulaFunctions}),references:Y(l)}}catch(l){return{ok:!1,error:l instanceof L?l.message:"the formula could not be read",at:l instanceof L?l.at:void 0}}}}),Ve("packages/core/src/internal/version.js",function(e,D){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return Y}});const re="1.117.2";async function A(){return re}const Y="1.117.2"}),Ve("packages/core/src/internal/merge.js",function(e,D){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return Y}}),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 H}});const A=D("packages/core/src/internal/predicates.js").isObject;function Y($,X,F){if($!==void 0)return $===!0?{enabled:!0,...F}:$===!1?{enabled:!1}:A($)?$:{[X]:$,enabled:!0}}function I($){return $==null?[]:Array.isArray($)?$:[$]}const L=Object.freeze(new Set(["__proto__","constructor","prototype"]));function Q($,X){if(!A($))return A(X)?{...X}:X;if(!A(X))return X===void 0?$:X;const F={...$};for(const j of Object.keys(X)){if(L.has(j))continue;const v=X[j];v!==void 0&&(F[j]=A(v)&&A(F[j])?Q(F[j],v):v)}return F}function H($,X){if(!A($)||!A(X)||$===X)return X;const F=Object.create(Object.getPrototypeOf($));return Object.assign(F,$,X),F}}),Ve("packages/core/src/internal/schedule.js",function(e,D){"use strict";Object.defineProperty(e,"now",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"nextFrame",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return H}});function re(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const A=typeof requestAnimationFrame=="function";function Y($){return A?requestAnimationFrame($):setTimeout(()=>$(re()),16)}function I($){$!=null&&(A?cancelAnimationFrame($):clearTimeout($))}function L($){let X=null,F=null;const j=()=>{X=null;const b=F;F=null,$(...b||[])},v=(...b)=>{F=b,X===null&&(X=Y(j))};return v.cancel=()=>{I(X),X=null,F=null},v.flush=()=>{X!==null&&(I(X),j())},v}function Q($,X){let F=null,j=null;const v=()=>{if(F=null,j===null)return;const g=j;j=null,$(...g),b()},b=()=>{F=setTimeout(v,X),typeof F?.unref=="function"&&F.unref()},l=(...g)=>{F===null?($(...g),b()):(j=g,clearTimeout(F),b())};return l.flush=()=>{if(F!==null&&clearTimeout(F),F=null,j===null)return;const g=j;j=null,$(...g)},l.cancel=()=>{F!==null&&clearTimeout(F),F=null,j=null},l.pending=()=>F!==null||j!==null,l}function H($,X=50){return typeof requestIdleCallback=="function"?requestIdleCallback($,{timeout:X}):setTimeout(()=>$({timeRemaining:()=>0,didTimeout:!0}),1)}}),Ve("packages/core/src/internal/paths.js",function(e,D){"use strict";Object.defineProperty(e,"pathGetter",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"pathSetter",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"getPath",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return Q}});const re=new Map;function A(H){let $=re.get(H);if($)return $;if(!H.includes("."))$=X=>X?.[H];else{const X=H.split("."),F=X.length;$=j=>{let v=j;for(let b=0;b<F;b++){if(v==null)return;v=v[X[b]]}return v}}return re.set(H,$),$}const Y=new Map;function I(H){let $=Y.get(H);if($)return $;if(!H.includes("."))$=(X,F)=>{X!=null&&(X[H]=F)};else{const X=H.split("."),F=X.length-1;$=(j,v)=>{let b=j;for(let l=0;l<F;l++){if(b==null)return;const g=X[l];b[g]==null&&(b[g]={}),b=b[g]}b!=null&&(b[X[F]]=v)}}return Y.set(H,$),$}function L(H,$){return A($)(H)}function Q(H,$,X){I($)(H,X)}}),Ve("packages/core/src/internal/compare.js",function(e,D){"use strict";Object.defineProperty(e,"collator",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"defaultCompare",{enumerable:!0,get:function(){return Y}});const re=new Map;function A(I,L){const Q=`${I||""}|${L?JSON.stringify(L):""}`;let H=re.get(Q);return H||(H=new Intl.Collator(I||void 0,{numeric:!0,sensitivity:"variant",...L}),re.set(Q,H)),H}function Y(I,L){if(I===L)return 0;if(I==null)return 1;if(L==null)return-1;if(typeof I=="number"&&typeof L=="number")return Number.isNaN(I)?Number.isNaN(L)?0:1:Number.isNaN(L)||I<L?-1:I>L?1:0;const Q=String(I),H=String(L);return Q<H?-1:Q>H?1:0}}),Ve("packages/core/src/defaults.js",function(e,D){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return j}});const A=D("packages/core/src/internal/predicates.js").isObject,I=D("packages/core/src/internal/merge.js").merge,Q=D("packages/core/src/internal/warn.js").warnOnce;let H=null;class $ extends Error{}function X(v,b=new Set){if(Array.isArray(v)){if(b.has(v))throw new $;b.add(v);const g=v.map(o=>X(o,b));return b.delete(v),g}if(!A(v)||Object.getPrototypeOf(v)!==Object.prototype&&Object.getPrototypeOf(v)!==null)return v;if(b.has(v))throw new $;b.add(v);const l={};for(const[g,o]of Object.entries(v))l[g]=X(o,b);return b.delete(v),l}function F(v){if(v===void 0)return X(H??{});if(v===null)return H=null,{};if(!A(v))return Q("defaults:type",`defaults() expects a configuration object, or null to clear it, but got ${Array.isArray(v)?"an array":typeof v}. The call was ignored and the defaults are unchanged.`),X(H??{});try{H=X(v)}catch(b){if(!(b instanceof $))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."),X(H??{})}return X(H)}function j(v){return H===null?v:I(X(H),v)}}),Ve("packages/core/src/internal/uid.js",function(e,D){"use strict";Object.defineProperty(e,"uid",{enumerable:!0,get:function(){return A}});let re=0;function A(Y="l"){return`${Y}${(++re).toString(36)}`}}),Ve("packages/core/src/events/names.js",function(e,D){"use strict";Object.defineProperty(e,"EVENT_NAMES",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"isKnownEvent",{enumerable:!0,get:function(){return Y}});const re=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"]),A=new Set(re);function Y(I){return I==="*"||A.has(I)}}),Ve("packages/core/src/events/bus.js",function(e,D){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return g}});const re=D("packages/core/src/internal/warn.js"),A=re.warnOnce,Y=re.DEV,L=D("packages/core/src/internal/uid.js").uid,H=D("packages/core/src/events/names.js").isKnownEvent,$="*";function X(o,t){!Y||H(t)||A(`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 F=new Set(["api","user","init","ai"]),j=new WeakMap;function v(o){let t=j.get(o);return t||(t=L("h"),j.set(o,t)),t}function b(){return typeof performance=="object"&&performance?performance.now():Date.now()}function l(o){if(!o||typeof o!="object")return{};const t={};for(const[s,r]of Object.entries(o))s!=="grid"&&(r==null?t[s]=String(r):Array.isArray(r)?t[s]=`[${r.length}]`:typeof r=="object"?t[s]=r.key?`row ${r.key}`:"{…}":typeof r=="function"?t[s]="[function]":t[s]=String(r).slice(0,60));return t}class g{#e=new Map;#t=!1;#n=[];#r=200;#s=new Map;#i=null;#a=!1;#l=0;constructor(t=null){this.#i=t}attach(t){this.#i=t}get grid(){return this.#i}get destroyed(){return this.#a}on(t,s){if(typeof s!="function")return A(`bus.handler:${t}`,`on('${t}') needs a function; ignored.`),()=>{};X("on",t);let r=this.#e.get(t);return r||(r=[],this.#e.set(t,r)),r.push(s),()=>this.off(t,s)}once(t,s){if(typeof s!="function")return A(`bus.handler:${t}`,`once('${t}') needs a function; ignored.`),()=>{};X("once",t);const r=i=>{this.off(t,s),s(i)};return this.#s.set(s,r),this.on(t,r)}off(t,s){if(s===void 0){this.#e.delete(t);return}const r=this.#e.get(t);if(!r)return;const i=this.#s.get(s),n=i&&r.includes(i)?i:s,m=r.indexOf(n);m>=0&&r.splice(m,1),i&&n===i&&this.#s.delete(s),r.length===0&&this.#e.delete(t)}count(t){const s=this.#e.get(t),r=t===$?null:this.#e.get($);return(s?s.length:0)+(r?r.length:0)}#o(t,s,r,i,n){this.#n.push({type:t,origin:s,listeners:(i?i.length:0)+(n?n.length:0),payload:l(r),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(t,s){this.#t=!!t,Number.isFinite(s)&&s>0&&(this.#r=Math.floor(s)),t||(this.#n=[])}eventLog(){return this.#n.map(t=>({...t}))}clearEventLog(){this.#n=[]}counts(){const t={};for(const[s,r]of this.#e)t[s]=r.length;return t}emit(t,s,r){const i=r??(s&&s.origin),n=F.has(i)?i:"api",m={...s||null,type:t,origin:n,grid:this.#i};if(this.#a)return m;const c=this.#e.get(t),a=t===$?void 0:this.#e.get($);if(this.#t&&this.#o(t,n,s,c,a),!c&&!a)return m;const u=this.#t?b():0;this.#l++;try{c&&this.#c(c.slice(),m,t),a&&this.#c(a.slice(),m,$)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=b()-u)}return m}emitBefore(t,s,r){const i=r??(s&&s.origin),n=F.has(i)?i:"user";let m=!1,c=null;const a=f=>{m=!0,f!=null&&c===null&&(c=String(f))},u={...s||null,type:t,origin:n,grid:this.#i,get defaultPrevented(){return m},get reason(){return c},preventDefault(f){a(f)}};if(this.#a)return!0;const h=this.#e.get(t);this.#t&&this.#o(t,n,s,h,void 0);const p=h?h.slice():[];if(p.length===0)return!0;const y=()=>(m&&c===null&&(c="prevented"),m&&s&&typeof s=="object"&&(s.reason=c),!m),d=[];for(const f of p)try{const w=f(u);w&&typeof w.then=="function"?d.push(w):w===!1&&a("prevented")}catch(w){a("error"),A(`bus.beforeThrow:${t}:${v(f)}`,`a '${t}' before-handler threw; the action was cancelled.`,w)}return d.length===0?y():Promise.allSettled(d).then(f=>{for(const w of f)w.status==="rejected"?(a("error"),A(`bus.beforeReject:${t}`,`a '${t}' before-handler rejected; the action was cancelled.`,w.reason)):w.value===!1&&a("prevented");return y()})}#c(t,s,r){for(let i=0;i<t.length;i++)try{t[i](s)}catch(n){A(`bus.throw:${r}:${v(t[i])}`,`a '${r}' handler threw; other handlers were unaffected.`,n)}}clear(){this.#e.clear(),this.#s.clear()}destroy(){this.clear(),this.#a=!0,this.#i=null}}}),Ve("packages/core/src/registry/free-tier-notice.js",function(e,D){"use strict";Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"WATERMARK_TEXT",{enumerable:!0,get:function(){return A}});const re="Free for non-commercial use: latticegrid.dev/free",A="Unlicensed: Lattice Grid trial"}),Ve("packages/core/src/registry/licence.js",function(e,D){"use strict";Object.defineProperty(e,"PRODUCT",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"LICENCE_VERSION",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"fromBase64Url",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"toBase64Url",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"asciiBytes",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"parseLicence",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"hasEd25519",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"verifyLicence",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"isLocalHost",{enumerable:!0,get:function(){return h}}),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 f}}),Object.defineProperty(e,"setLicence",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return E}});const A=D("packages/core/src/internal/warn.js").warnOnce,Y=D("packages/core/src/registry/free-tier-notice.js"),I=Y.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return Y.FREE_TIER_NOTICE}});const L="lattice-grid",Q=1,H="LG1",$=64,X="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",F="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",j=(()=>{const S=new Int16Array(128).fill(-1);for(let C=0;C<F.length;C++)S[F.charCodeAt(C)]=C;return S[43]=62,S[47]=63,S})();function v(S){if(typeof S!="string")return null;let C="";for(let U=0;U<S.length;U++){const V=S.charCodeAt(U);if(V!==61){if(V>127||j[V]<0)return null;C+=S[U]}}const N=C.length;if(N%4===1)return null;const O=new Uint8Array(Math.floor(N*3/4));let T=0,R=0,x=0;for(let U=0;U<N;U++)T=T<<6|j[C.charCodeAt(U)],R+=6,R>=8&&(R-=8,O[x++]=T>>R&255);return x===O.length?O:O.subarray(0,x)}function b(S){let C="",N=0;for(;N+2<S.length;N+=3){const T=S[N]<<16|S[N+1]<<8|S[N+2];C+=F[T>>18&63]+F[T>>12&63]+F[T>>6&63]+F[T&63]}const O=S.length-N;if(O===1){const T=S[N]<<16;C+=F[T>>18&63]+F[T>>12&63]}else if(O===2){const T=S[N]<<16|S[N+1]<<8;C+=F[T>>18&63]+F[T>>12&63]+F[T>>6&63]}return C}function l(S){const C=new Uint8Array(S.length);for(let N=0;N<S.length;N++)C[N]=S.charCodeAt(N)&127;return C}function g(S){if(typeof TextDecoder=="function")return new TextDecoder().decode(S);let C="";for(let N=0;N<S.length;N++)C+=String.fromCharCode(S[N]);return C}function o(S){const C={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof S=="string"?S:""};if(typeof S!="string"||S.length===0)return{...C,reason:"missing"};const N=S.trim(),O=N.split(".");if(O.length!==3)return C;const[T,R,x]=O;if(T!==H)return{...C,reason:"prefix"};const U=v(R),V=v(x);if(!U||!V)return C;let J;try{J=JSON.parse(g(U))}catch{return C}return J===null||typeof J!="object"?C:{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:l(R),signature:V,raw:N}}function t(S,C){if(!S)return!1;const N=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(S)?`${S}T23:59:59.999Z`:S);return Number.isNaN(N)?!0:C>N}function s(S){return S==="non-commercial"?"non-commercial":"commercial"}let r=null,i=null,n=null;function m(){const S=globalThis.crypto;return S&&S.subtle?S.subtle:null}async function c(S){if(r&&i===S)return r;const C=m();if(!C)return null;const N=v(S);if(!N)return null;try{const O=await C.importKey("raw",N,{name:"Ed25519"},!1,["verify"]);return r=O,i=S,O}catch{return null}}async function a(){return n!==null||(n=await c(X)!==null),n}async function u(S,C={}){const N=C.warn!==!1,O=C.product||L,T=C.publicKey||X,R=C.now??Date.now(),x=C.host??p(),U=h(x)?"":` ${I}`,V=o(S);if(!V.ok){const Z=V.reason==="missing"?"missing":"malformed";return N&&A(`licence.${Z}`,Z==="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.${U}`:`licence key could not be read. The grid will render with a watermark.${U}`),{valid:!1,reason:Z,terms:"commercial"}}const J={product:V.product||void 0,issuedTo:V.issuedTo||void 0,expires:V.expires||void 0,terms:s(V.terms)};if(V.product!==O)return N&&A("licence.product",`licence key is for '${V.product}', not '${O}'. The grid will render with a watermark.`),{valid:!1,...J,reason:"product"};if(t(V.expires,R))return N&&A("licence.expired",`licence expired on ${V.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,...J,reason:"expired"};const _=V.deployments||[];if(_.length&&x&&!h(x)&&!y(x,_))return N&&A("licence.domain",`licence key is not valid for ${x}; it covers ${_.join(", ")}. The grid will render with a watermark.`),{valid:!1,...J,reason:"domain"};const ee=await c(T);if(!ee){const Z=!!V.signature&&V.signature.length===$;return N&&A("licence.algorithm","this host does not provide crypto.subtle Ed25519, so the licence signature could not be verified. A structural check was used instead."),Z?{valid:!0,...J,reason:"unverified"}:{valid:!1,...J,reason:"signature"}}let W=!1;try{W=await m().verify({name:"Ed25519"},ee,V.signature,V.message)}catch{W=!1}return W?{valid:!0,...J}:(N&&A("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...J,reason:"signature"})}function h(S){const C=String(S??p()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!C||C==="localhost"||C.endsWith(".localhost")||C==="::1"||C==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(C)}function p(){const S=globalThis.location;return S&&typeof S.hostname=="string"?S.hostname:null}function y(S,C){const N=d(S);return!N||!Array.isArray(C)?!1:C.some(O=>{const T=d(O);if(!T)return!1;if(T==="*")return!0;if(T.startsWith("*.")){const R=T.slice(2);return N===R||N.endsWith(`.${R}`)}return N===T})}function d(S){return String(S??"").trim().toLowerCase().replace(/\.$/,"")}class f{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#s;#i=new Set;constructor(C={}){this.#s=C}set(C){this.#e=typeof C=="string"?C.trim():"";const N=o(this.#e);return this.#t=N.ok?{valid:!t(N.expires,Date.now())&&N.product===(this.#s.product||L),product:N.product||void 0,issuedTo:N.issuedTo||void 0,expires:N.expires||void 0,terms:s(N.terms),reason:"pending"}:{valid:!1,reason:N.reason||"malformed",terms:"commercial"},this.#n=null,this.#e&&this.verify(),this.#t}verify(){if(this.#n)return this.#n;const C=this.#e;return this.#n=u(C,this.#s).then(N=>{if(this.#e===C){this.#t=N;for(const O of this.#i)O(N)}return N}),this.#n}onSettled(C){return this.#i.add(C),()=>this.#i.delete(C)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!h(this.#r)}setHost(C){this.#r=C}state(){return this.#t.valid?"licensed":h(this.#r)?"localhost":"trial"}reset(){this.#e="",this.#t={valid:!1,reason:"missing",terms:"commercial"},this.#n=null,this.#i.clear()}}const w=Symbol.for("lattice-grid/licence/holder");function k(){const S=globalThis,C=S&&S[w];if(C&&typeof C.set=="function"&&typeof C.watermark=="function")return C;const N=new f;if(S)try{S[w]=N}catch{}return N}const P=k();function G(S){return P.set(S)}function K(){return P.info()}function q(){return P.watermark()}function B(){return P.state()}function E(){return P}}),Ve("packages/core/src/registry/registry.js",function(e,D){"use strict";Object.defineProperty(e,"KINDS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"REGIONS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return r}});const re=D("packages/core/src/internal/warn.js"),A=re.warnOnce,Y=re.DEV,L=D("packages/core/src/internal/predicates.js").isFunction,Q=D("packages/core/src/registry/licence.js"),H=Q.LicenceHolder,$=Q.sharedLicence,X=["renderer","editor","filter","dataType","totalFn","pipe","component"],F=["all","header","body","totals","panels"];class j{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#s;#i=null;#a=null;#l=new Set;#o=new Map;constructor(n={}){for(const m of X)this.#t.set(m,new Map);this.#s=n.holder||$(),this.#a=n.grid??null,this.#i=this.#s.onSettled(()=>{this.#f({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),n.licence&&this.setLicence(n.licence)}registerModules(n,m={}){m.licence&&this.setLicence(m.licence),m.grid!==void 0&&(this.#a=m.grid);const c=Array.isArray(n)?n:[n],a=[];for(const u of c){if(!u||typeof u!="object"||typeof u.name!="string"||!u.name){A("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(u.name)){Y&&this.#u(this.#e.get(u.name),u);continue}if(!L(u.install)){A(`registry.module.install:${u.name}`,`module '${u.name}' has no install() and was ignored.`);continue}const h={registry:this,grid:this.#a};try{u.install(h)}catch(p){A(`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 v(u))this.#n.add(p);a.push(u.name),this.#f({reason:"module",name:u.name,capabilities:this.capabilities(),regions:g(u)})}return a}unregisterModule(n){const m=this.#e.get(n);if(!m)return!1;if(L(m.uninstall))try{m.uninstall({registry:this,grid:this.#a})}catch(c){A(`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 v(n))this.#n.add(m)}#u(n,m){!n||n===m||b(n,m)||A(`registry.module.reconfigure:${m.name}`,`module '${m.name}' was re-registered with different options; the first registration is kept and this call was ignored. Unregister it first if you mean to replace it.`)}capabilities(){return[...this.#n].sort()}can(n){return this.#n.has(n)}onChange(n){return L(n)?(this.#r.add(n),this.#o.set(n,this.#a),()=>{this.#r.delete(n),this.#o.delete(n)}):()=>{}}#f(n){for(const m of[...this.#r])try{m(n)}catch(c){A("registry.onChange.throw","a registry change handler threw.",c)}}register(n,m,c){const a=this.#t.get(n);if(!a){A(`registry.kind:${n}`,`unknown registry kind '${n}'; expected one of ${X.join(", ")}.`);return}if(!m||typeof m!="string"){A(`registry.name:${n}`,`register('${n}', ...) needs a name.`);return}a.has(m)&&a.get(m)!==c&&A(`registry.replace:${n}:${m}`,`'${m}' was already registered as a ${n} and has been replaced.`),a.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.#s.set(n)}licence(){return this.#s.info()}licenceVerified(){return this.#s.verify()}watermark(){return this.#s.watermark()}attach(n){n!=null&&(this.#l.add(n),this.#a=n)}detach(n){if(n!=null){this.#l.delete(n);for(const[m,c]of[...this.#o])c===n&&(this.#r.delete(m),this.#o.delete(m));if(this.#a===n){const m=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#a=m}this.#l.size===0&&this.#i&&(this.#i(),this.#i=null)}}destroy(n){if(n!=null){this.detach(n);return}for(const m of[...this.#e.keys()])this.unregisterModule(m);this.#r.clear(),this.#o.clear(),this.#l.clear(),this.#i&&this.#i(),this.#i=null,this.#a=null}}function v(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:l(v(i),v(n))&&l(g(i),g(n))}function l(i,n){const m=new Set(i),c=new Set(n);if(m.size!==c.size)return!1;for(const a of m)if(!c.has(a))return!1;return!0}function g(i){const n=i.regions;return!Array.isArray(n)||n.length===0?["all"]:n.filter(m=>F.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 j;function s(){return t}function r(i,n={}){return t.registerModules(i,n)}}),Ve("packages/core/src/internal/text.js",function(e,D){"use strict";Object.defineProperty(e,"humanise",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"escapeHtml",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return I}});function re(L){return L?(L.includes(".")?L.slice(L.lastIndexOf(".")+1):L).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,H=>H.toUpperCase()):""}const A={"&":"&","<":"<",">":">",'"':""","'":"'"};function Y(L){const Q=L==null?"":String(L);return/[&<>"']/.test(Q)?Q.replace(/[&<>"']/g,H=>A[H]):Q}function I(L){return String(L).replace(/\w\S*/g,Q=>Q[0].toUpperCase()+Q.slice(1).toLowerCase())}}),Ve("packages/core/src/format/mask.js",function(e,D){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return Q}});const re=new Set(["0","#","?",",","."]),A="\0";function Y($){const X=[];let F="",j=!1;for(let v=0;v<$.length;v++){const b=$[v];if(b==="\\"){F+=b+($[v+1]??""),v+=1;continue}if(b==='"'){j=!j,F+=b;continue}if(b===";"&&!j){X.push(F),F="";continue}F+=b}return X.push(F),X}function I($){let X="",F="",j="",v=1,b=!1,l=!1;const g=a=>{l?F+=a:X+=a};for(let a=0;a<$.length;a++){const u=$[a];if(u==="\\"){g($[a+1]??""),a+=1;continue}if(u==='"'){const h=$.indexOf('"',a+1);g(h===-1?$.slice(a+1):$.slice(a+1,h)),a=h===-1?$.length:h;continue}if(u==="%"){v*=100,g("%");continue}if(u==="@"){b=!0,g("\0");continue}if(re.has(u)){j+=u,l=!0;continue}g(u)}let o=-1;for(let a=j.length-1;a>=0;a--){const u=j[a];if(u==="0"||u==="#"||u==="?"){o=a;break}}let t=!1,s="";for(let a=0;a<j.length;a++){const u=j[a];if(u===","){a>o?v/=1e3:t=!0;continue}s+=u}const r=s.indexOf("."),i=r===-1?s:s.slice(0,r),n=r===-1?"":s.slice(r+1);let m=0;for(const a of i)a==="0"&&(m+=1);let c=0;for(const a of n)a==="0"&&(c+=1);return{prefix:X,suffix:F,minInt:m,minDec:c,maxDec:n.length,grouping:t,scale:v,hasNumber:o!==-1,isText:b}}function L($,X){const F=new Intl.NumberFormat(X,{minimumIntegerDigits:Math.max($.minInt,1),minimumFractionDigits:$.minDec,maximumFractionDigits:Math.max($.maxDec,$.minDec),useGrouping:$.grouping}),{prefix:j,suffix:v,scale:b,hasNumber:l}=$;return g=>{if(!l)return j+v;const o=b===1?g:g*b;return j+F.format(o)+v}}function Q($,X){const j=Y(String($)).map(I),v=j.map(s=>L(s,X)),b=0,l=j.length>1?1:-1,g=j.length>2?2:-1,o=j.length>3?3:-1,t=s=>{if(s==null||s==="")return"";if(typeof s!="number"||Number.isNaN(s)){const r=Number(s);if(Number.isNaN(r))return o===-1?String(s):(j[o].prefix+j[o].suffix).split("\0").join(String(s));s=r}return s===0&&g!==-1?v[g](0):s<0&&l!==-1?v[l](-s):v[b](s)};return t.spec={mask:$},{format:t,ooxml:H(String($))}}function H($){return $.trim()}}),Ve("packages/core/src/format/pattern.js",function(e,D){"use strict";Object.defineProperty(e,"parseNumberPattern",{enumerable:!0,get:function(){return L}});const A=D("packages/core/src/format/mask.js").splitSections;function Y(Q){let H="",$="",X="",F="",j=!1,v=!1,b=!1,l=!1;const g=t=>{b?$+=t:H+=t};for(let t=0;t<Q.length;t++){const s=Q[t];if(s==="\\"){g(Q[t+1]??""),t+=1;continue}if(s==='"'){const r=Q.indexOf('"',t+1);g(r===-1?Q.slice(t+1):Q.slice(t+1,r)),t=r===-1?Q.length:r;continue}if(s==="%"){v=!0;continue}if(s==="0"||s==="#"){b=!0,l?F+=s:X+=s;continue}if(s===","){l||(j=!0);continue}if(s==="."&&!l){l=!0;continue}g(s)}if(!b)return{hasDigit:!1,prefix:H,suffix:$,minDec:0,maxDec:0,grouping:!1,percent:v};let o=0;for(const t of F)t==="0"&&(o+=1);return{hasDigit:!0,prefix:H,suffix:$,minDec:o,maxDec:F.length,grouping:j,percent:v}}function I(Q,H){const $=H.trim(),X=Q.trim();return $.startsWith("(")&&$.endsWith(")")&&$.slice(1,-1).trim()===X?"parentheses":$.endsWith("-")?"suffix":"minus"}function L(Q){if(typeof Q!="string")return null;const H=A(Q);if(H.length===0)return null;const $=Y(H[0]);if(!$.hasDigit)return null;const X={style:$.percent?"percent":"decimal",prefix:$.prefix,suffix:$.suffix,minDecimals:$.minDec,maxDecimals:Math.max($.maxDec,$.minDec),thousandsSeparator:$.grouping?void 0:!1};if(H.length>1&&(X.negative=I(H[0],H[1])),H.length>2){const F=Y(H[2]);F.hasDigit||(X.zeroDisplay=F.prefix+F.suffix)}return X}}),Ve("packages/core/src/format/number.js",function(e,D){"use strict";Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return H}});const A=D("packages/core/src/internal/predicates.js").isNil,I=D("packages/core/src/internal/warn.js").warnOnce,Q=D("packages/core/src/format/pattern.js").parseNumberPattern;function H($,X){const F=typeof $=="string"?{pattern:$}:$||{};let j=F;if(typeof F.pattern=="string"){const k=Q(F.pattern);if(k){const{pattern:P,...G}=F;j={...k,...G}}else I(`format:pattern:${F.pattern}`,`invalid number format pattern "${F.pattern}"; the value will use the default number format`)}const v=j.locale||X||void 0,b=j.style||"decimal",l=typeof j.scale=="number"?j.scale:1,g=j.nullDisplay??"",o=j.zeroDisplay,t=j.prefix||"",s=j.suffix||"",r=j.negative||"minus",i=j.signed===!0,n={style:b,notation:j.notation||"standard"};b==="currency"&&(n.currency=j.currency||"USD",j.currencyDisplay&&(n.currencyDisplay=j.currencyDisplay)),typeof j.decimals=="number"?(n.minimumFractionDigits=j.decimals,n.maximumFractionDigits=j.decimals):(typeof j.minDecimals=="number"&&(n.minimumFractionDigits=j.minDecimals),typeof j.maxDecimals=="number"&&(n.maximumFractionDigits=j.maxDecimals),n.minimumFractionDigits>(n.maximumFractionDigits??20)&&(n.maximumFractionDigits=n.minimumFractionDigits)),j.thousandsSeparator===!1&&(n.useGrouping=!1),n.notation==="compact"&&(n.compactDisplay=j.compactDisplay||"short");const m=new Intl.NumberFormat(v,n),c=typeof j.thousandsSeparator=="string"?j.thousandsSeparator:null,a=typeof j.decimalSeparator=="string"?j.decimalSeparator:null;let u=",",h=".";if(c||a)for(const k of m.formatToParts(12345.6))k.type==="group"?u=k.value:k.type==="decimal"&&(h=k.value);const p=k=>{let P=k;return c&&(P=P.split(u).join("")),a&&(P=P.split(h).join("")),c&&(P=P.split("").join(c)),a&&(P=P.split("").join(a)),P},y=!!(c||a),d=t!==""&&b==="currency",f=k=>{let P;if(d){const G=m.formatToParts(k);let K=!1;P="";for(const q of G)P+=q.value,!K&&q.type==="currency"&&(P+=t,K=!0);K||(P=t+P)}else P=t+m.format(k);return y&&(P=p(P)),P+s},w=k=>{if(A(k)||k==="")return g;const P=typeof k=="number"?k:Number(k);if(Number.isNaN(P))return g;const G=l===1?P:P*l;return G===0&&o!==void 0?o:G<0?r==="parentheses"?`(${f(-G)})`:r==="suffix"?`${f(-G)}-`:f(G):i&&G>0?`+${f(G)}`:f(G)};return w.negativeClass=j.negativeClass||null,w.spec=j,w}}),Ve("packages/core/src/format/date.js",function(e,D){"use strict";Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return s}});const A=D("packages/core/src/internal/predicates.js").isNil,I=D("packages/core/src/internal/warn.js").warnOnce,L=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function Q(r){const i=[];let n=0,m="";const c=()=>{m&&(i.push({token:null,text:m}),m="")};for(;n<r.length;){const a=r[n];if(a==="'"){if(r[n+1]==="'"){m+="'",n+=2;continue}const h=r.indexOf("'",n+1);if(h===-1){m+=r.slice(n+1),n=r.length;continue}m+=r.slice(n+1,h),n=h+1;continue}const u=L.find(h=>r.startsWith(h,n));if(u){c(),i.push({token:u,text:u}),n+=u.length;continue}/[A-Za-z]/.test(a)&&I(`date.pattern.token:${a}`,`the date pattern "${r}" contains '${a}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${L.join(" ")}.`),m+=a,n+=1}return c(),i}const H=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function $(r){if(A(r)||r==="")return null;if(r instanceof Date)return Number.isNaN(r.getTime())?null:r;if(typeof r=="number")return Number.isNaN(r)?null:new Date(r);if(typeof r=="string"){const i=H.exec(r.trim());if(i){const[,m,c,a,u="0",h="0",p="0"]=i;return new Date(+m,+c-1,+a,+u,+h,+p)}const n=new Date(r);return Number.isNaN(n.getTime())?null:n}return null}function X(r,i){return String(r).padStart(i,"0")}function F(r){if(!r)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:r,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 a of i.formatToParts(m))switch(a.type){case"year":c.year=Number(a.value);break;case"month":c.month=Number(a.value);break;case"day":c.day=Number(a.value);break;case"hour":c.hour=Number(a.value)%24;break;case"minute":c.minute=Number(a.value);break;case"second":c.second=Number(a.value);break;case"weekday":c.weekday=n[a.value]??0;break;default:break}return c}}function j(r,i,n){const m=Q(r),c=F(n),a=new Set(m.filter(d=>d.token).map(d=>d.token)),u=a.has("MMM")?new Intl.DateTimeFormat(i,{month:"short",timeZone:n}):null,h=a.has("MMMM")?new Intl.DateTimeFormat(i,{month:"long",timeZone:n}):null,p=a.has("EEE")?new Intl.DateTimeFormat(i,{weekday:"short",timeZone:n}):null,y=a.has("EEEE")?new Intl.DateTimeFormat(i,{weekday:"long",timeZone:n}):null;return d=>{const f=c(d);let w="";for(const k of m){if(!k.token){w+=k.text;continue}switch(k.token){case"yyyy":w+=X(f.year,4);break;case"yy":w+=X(f.year%100,2);break;case"MMMM":w+=h.format(d);break;case"MMM":w+=u.format(d);break;case"MM":w+=X(f.month,2);break;case"M":w+=String(f.month);break;case"dd":w+=X(f.day,2);break;case"d":w+=String(f.day);break;case"EEEE":w+=y.format(d);break;case"EEE":w+=p.format(d);break;case"HH":w+=X(f.hour,2);break;case"H":w+=String(f.hour);break;case"hh":w+=X(f.hour%12===0?12:f.hour%12,2);break;case"h":w+=String(f.hour%12===0?12:f.hour%12);break;case"mm":w+=X(f.minute,2);break;case"m":w+=String(f.minute);break;case"ss":w+=X(f.second,2);break;case"s":w+=String(f.second);break;case"SSS":w+=X(f.ms,3);break;case"a":w+=f.hour<12?"AM":"PM";break;default:w+=k.text;break}}return w}}const v=[["year",365*24*36e5],["month",720*36e5],["week",168*36e5],["day",24*36e5],["hour",36e5],["minute",6e4],["second",1e3]];function b(r,i){const n=r||{},m=n.locale||i||void 0,c=n.nullDisplay??"",a=n.timeZone;let u;if(n.pattern)u=j(n.pattern,m,a);else if(n.dateStyle||n.timeStyle){const f={timeZone:a};n.dateStyle&&(f.dateStyle=n.dateStyle),n.timeStyle&&(f.timeStyle=n.timeStyle);const w=new Intl.DateTimeFormat(m,f);u=k=>w.format(k)}else{const f=new Intl.DateTimeFormat(m,{dateStyle:"medium",timeZone:a});u=w=>f.format(w)}const h=n.relative?new Intl.RelativeTimeFormat(m,{numeric:"auto"}):null,y=(typeof n.relative=="object"&&n.relative?n.relative.threshold??7:7)*24*36e5,d=(f,w)=>{const k=$(f);if(!k)return c;if(h){const P=w&&typeof w.now=="number"?w.now:Date.now(),G=k.getTime()-P;if(Math.abs(G)<y){for(const[K,q]of v)if(Math.abs(G)>=q||K==="second")return h.format(Math.round(G/q),K)}}return u(k)};return d.spec=n,d}function l(r){if(A(r)||r==="")return null;if(typeof r=="string"){const m=/^(\d{4}-\d{2}-\d{2})/.exec(r.trim());if(m)return m[1];const c=$(r);return c?l(c):null}const i=$(r);if(!i)return null;const n=m=>String(m).padStart(2,"0");return`${i.getFullYear()}-${n(i.getMonth()+1)}-${n(i.getDate())}`}function g(r,i){if(A(r)||r==="")return null;if(typeof r=="string"){const m=r.trim();if(o.test(m)){const u=$(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,h,p,y]=c;return`${u}T${h}:${p}${y&&y!=="00"?`:${y}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(m))return`${m}T00:00`;const a=$(m);return a?g(a):null}const n=$(r);return n?t(n,i):null}const o=/(?:Z|[+-]\d{2}:?\d{2})$/i;function t(r,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(r).reduce((y,d)=>(d.type!=="literal"&&(y[d.type]=d.value),y),{}),h=u.hour==="24"?"00":u.hour,p=Number(u.second);return`${u.year}-${u.month}-${u.day}T${h}:${u.minute}`+(p?`:${u.second}`:"")}catch{}const m=`${r.getFullYear()}-${n(r.getMonth()+1)}-${n(r.getDate())}`,c=r.getSeconds(),a=`${n(r.getHours())}:${n(r.getMinutes())}${c?`:${n(c)}`:""}`;return`${m}T${a}`}function s(r,i){const n=A(r)||r===""?null:String(r),m=A(i)||i===""?null:String(i);return n===null?m===null?0:1:m===null||n<m?-1:n>m?1:0}}),Ve("packages/core/src/format/boolean.js",function(e,D){"use strict";Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return Q}});const A=D("packages/core/src/internal/predicates.js").isNil,Y={true:"☑",false:"☐",null:""},I={true:"◉",false:"◯",null:""};function L(H){if(A(H)||H==="")return null;if(typeof H=="boolean")return H;if(typeof H=="number")return H!==0;const $=String(H).trim().toLowerCase();return $==="true"||$==="yes"||$==="y"||$==="1"?!0:$==="false"||$==="no"||$==="n"||$==="0"?!1:null}function Q(H,$){const X=H||{},F=X.display||"text",j=X.trueLabel??"Yes",v=X.falseLabel??"No",b=X.nullLabel??"";let l=j,g=v;const o=b;F==="checkbox"?(l=Y.true,g=Y.false):F==="switch"?(l=I.true,g=I.false):F==="icon"&&(l=X.trueIcon??j,g=X.falseIcon??v);const t=s=>{const r=L(s);return r===null?o:r?l:g};return t.display=F,t.labels={true:j,false:v,null:b},t.locale=$,t.spec=X,t}}),Ve("packages/core/src/format/text.js",function(e,D){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return L}});const A=D("packages/core/src/internal/predicates.js").isNil,I=D("packages/core/src/internal/text.js").titleCase;function L(Q,H){const $=Q||{},X=$.locale||H||void 0,F=$.nullDisplay??"",j=$.emptyDisplay??"",v=$.transform||"none",b=typeof $.truncate=="number"?{chars:$.truncate}:$.truncate||null,l=b?b.chars:0,g=b?b.ellipsis??"…":"",o=s=>{switch(v){case"upper":return X?s.toLocaleUpperCase(X):s.toUpperCase();case"lower":return X?s.toLocaleLowerCase(X):s.toLowerCase();case"title":return I(s);default:return s}},t=s=>{if(A(s))return F;let r=typeof s=="string"?s:String(s);return r===""?j:(v!=="none"&&(r=o(r)),l>0&&r.length>l&&(r=r.slice(0,l)+g),r)};return t.spec=$,t}}),Ve("packages/core/src/format/shorthand.js",function(e,D){"use strict";Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return H}});const re=["currency","number","percent","date","boolean","text","relative"],A=/[#0?@;"\\]/,Y=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function I($){return typeof $!="string"||$===""||Q($)?!1:A.test($)}function L($){return typeof $!="string"||$===""||Q($)?!1:Y.test($)}function Q($){const X=$.indexOf(":"),F=X===-1?$:$.slice(0,X);return re.includes(F)?F:null}function H($){const X=Q($);if(!X)return null;const F=$.indexOf(":"),j=F===-1?"":$.slice(F+1),v=j===""?[]:j.split(":");switch(X){case"currency":{const b={type:"number",style:"currency",currency:v[0]||"USD"};return v[1]!==void 0&&v[1]!==""&&(b.decimals=Number(v[1])),b}case"number":{const b={type:"number",style:"decimal"};return v[0]!==void 0&&v[0]!==""&&(b.decimals=Number(v[0])),b}case"percent":{const b={type:"number",style:"percent"};return v[0]!==void 0&&v[0]!==""&&(b.decimals=Number(v[0])),b}case"date":return{type:"date",pattern:j||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const b=j.split("/"),l={type:"boolean",display:"text"};return b[0]!==void 0&&b[0]!==""&&(l.trueLabel=b[0]),b[1]!==void 0&&b[1]!==""&&(l.falseLabel=b[1]),b[2]!==void 0&&(l.nullLabel=b[2]),l}case"text":{const b={type:"text"};return v[0]&&(b.transform=v[0]),v[1]!==void 0&&v[1]!==""&&(b.truncate=Number(v[1])),b}default:return null}}}),Ve("packages/core/src/format/index.js",function(e,D){"use strict";Object.defineProperty(e,"compileFormat",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"specToOoxml",{enumerable:!0,get:function(){return P}});const re=D("packages/core/src/internal/predicates.js"),A=re.isFunction,Y=re.isObject,L=D("packages/core/src/internal/warn.js").warnOnce,Q=D("packages/core/src/format/number.js"),H=Q.compileNumber,$=D("packages/core/src/format/date.js"),X=$.compileDate,F=$.scanPattern,j=D("packages/core/src/format/boolean.js"),v=j.compileBoolean,b=D("packages/core/src/format/text.js"),l=b.compileText,g=D("packages/core/src/format/mask.js"),o=g.compileMask,t=D("packages/core/src/format/shorthand.js"),s=t.parseShorthand,r=t.looksLikeMask,i=t.looksLikeDatePattern,m=D("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 $.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return $.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return $.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return $.toDate}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return j.compileBoolean}}),Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return j.toTriState}}),Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return b.compileText}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return g.compileMask}}),Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return g.splitSections}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return g.parseSection}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return t.parseShorthand}}),Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return t.looksLikeMask}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return t.looksLikeDatePattern}});const c=new Set(["decimal","currency","percent","unit"]),a=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"])},h=new Set(["number","date","boolean","text"]);function p(B,E){const S=B.type;if(S===void 0||h.has(S)||!c.has(String(S)))return;const C=E?`"${E}"`:"with no id";L(`format:unknown-style-key:${E||""}:${S}`,`column ${C} has format: { type: "${S}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${S}" instead?`)}function y(B,E,S){const C=u[E],N=S?`"${S}"`:"with no id";for(const O of B){if(a.has(O)||C.has(O))continue;const T=Object.keys(u).find(R=>R!==E&&u[R].has(O));T?L(`format:inapplicable:${S||""}:${O}`,`column ${N} has format key "${O}", which applies to a ${T} column, not the ${E} column it was applied to; it is ignored.`):L(`format:unknown:${S||""}:${O}`,`column ${N} has an unrecognised format key "${O}" for its ${E} format; it is ignored.`)}}function d(B){if(B.type==="number"||B.type==="date"||B.type==="boolean"||B.type==="text")return!0;const E=c.has(String(B.style));return!!(B.pattern||B.dateStyle||B.timeStyle||B.relative||B.timeZone||B.trueLabel||B.falseLabel||B.display||B.trueIcon||B.falseIcon||B.transform||B.truncate||B.emptyDisplay||E||B.currency||B.decimals!==void 0||B.minDecimals!==void 0||B.maxDecimals!==void 0||B.notation||B.negative||B.scale!==void 0||B.prefix||B.suffix||B.zeroDisplay!==void 0)}function f(B,E){if(B.type==="number"||B.type==="date"||B.type==="boolean"||B.type==="text")return B.type;if(B.pattern){if(r(B.pattern))return"number";if(i(B.pattern))return"date"}if(B.dateStyle||B.timeStyle||B.relative||B.timeZone)return"date";if(B.trueLabel||B.falseLabel||B.display||B.trueIcon||B.falseIcon)return"boolean";if(B.transform||B.truncate||B.emptyDisplay)return"text";if(B.style||B.currency||B.decimals!==void 0||B.minDecimals!==void 0||B.maxDecimals!==void 0||B.notation||B.negative||B.scale!==void 0||B.prefix||B.suffix||B.zeroDisplay!==void 0)return"number";const S=E&&E.base;return S==="number"?"number":S==="date"||S==="dateString"?"date":S==="boolean"?"boolean":"text"}function w(B,E=null,S=void 0,C=void 0,N=void 0){if(B==null||B==="")return null;const O=Y(B)?Object.keys(B):null;if(typeof B=="function"){const x=(U,V)=>String(B({...V||{},value:U,locale:S})??"");return x.ooxml=E&&E.excel||"General",x}if(typeof B=="string"){if(r(B)){const{format:U,ooxml:V}=o(B,S);return U.ooxml=V,U}const x=s(B)||(i(B)?{type:"date",pattern:B}:null);return x?w(x,E,S,C,N):(L(`format:${B}`,`unrecognised format string "${B}"; the value will be stringified`),null)}if(!Y(B))return L("format:shape","format must be a spec object or a string; ignoring",B),null;if(E&&A(E.format)&&!d(B)||E&&A(E.format)&&Array.isArray(E.formatPatterns)&&B.type===void 0)return null;const T=f(B,E);T==="date"&&C&&B.timeZone===void 0&&(B={...B,timeZone:C}),p(B,N),y(O||Object.keys(B),T,N);let R;switch(T){case"number":R=H(B,S);break;case"date":R=X(B,S);break;case"boolean":R=v(B,S);break;default:R=l(B,S);break}return R.ooxml=P(B,T,S,E),R.kind=T,R}const k={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(B,E,S=void 0,C=null){if(E==="date"){if(B.pattern){let x="";for(const U of F(B.pattern))x+=U.token?k[U.token]??U.text:U.text;return x}return C&&C.excel||"yyyy-mm-dd"}if(E==="boolean")return"General";if(E==="text")return"@";if(typeof B.pattern=="string"&&m(B.pattern))return String(B.pattern).trim();if(B.notation==="compact"||B.notation==="scientific")return"General";const N=typeof B.decimals=="number"?B.decimals:typeof B.minDecimals=="number"?B.minDecimals:B.style==="currency"?2:0;let T=`${B.thousandsSeparator===!1?"":"#,#"}#0${N>0?`.${"0".repeat(N)}`:""}`,R="";return B.style==="currency"&&(R+=G(q(B.currency||"USD",S))),B.prefix&&(R+=G(B.prefix)),T=R+T,B.style==="percent"&&(T=`${T}%`),B.suffix&&(T+=G(B.suffix)),B.negative==="parentheses"?`${T};(${T})`:B.negative==="suffix"?`${T};${T}-`:T}function G(B){return`"${String(B).split('"').join("")}"`}const K=new Map;function q(B,E){const S=`${B}|${E||""}`;let C=K.get(S);if(C!==void 0)return C;C=B;try{const O=new Intl.NumberFormat(E,{style:"currency",currency:B}).formatToParts(0).find(T=>T.type==="currency");O&&(C=O.value)}catch{}return K.set(S,C),C}}),Ve("packages/core/src/columns/types/temporal.js",function(e,D){"use strict";Object.defineProperty(e,"MS_SECOND",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"MS_MINUTE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"MS_HOUR",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"MS_DAY",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"MS_WEEK",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return a}}),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 K}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"toEpochMs",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"toDurationMs",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"resolveZoneName",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(e,"zoneLabel",{enumerable:!0,get:function(){return he}}),Object.defineProperty(e,"formatInstant",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"timestampGroupProjector",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"TEMPORAL_INFERENCE_ORDER",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return je}});const re=D("packages/core/src/internal/predicates.js"),A=re.isNil,Y=re.isFunction,I=D("packages/core/src/format/date.js"),L=I.toDate,Q=I.compilePattern,H=I.compileDate,$=I.toIsoDateTime,X=I.compareIso,F=864e5,j=Object.freeze({}),v=1e3,b=60*v,l=60*b,g=24*l,o=7*g,t=new WeakMap;function s(ye,He){const Me=ye&&ye.locale||"",Re=ye&&ye.column;if(!Re)return Me?{locale:Me}:j;const Ee=t.get(Re);if(Ee&&Ee.locale===Me)return Ee.bag;const $e=Re.typeOptions||Re[He]||(r(Re.format)?Re.format:null),Ie={...$e||j,locale:$e&&$e.locale||Me||void 0};return t.set(Re,{locale:Me,bag:Ie}),Ie}function r(ye){return ye!==null&&typeof ye=="object"&&!Array.isArray(ye)&&!(ye instanceof Date)}function i(ye,He){const Me=ye===null||Number.isNaN(ye)?null:ye,Re=He===null||Number.isNaN(He)?null:He;return Me===null?Re===null?0:1:Re===null||Me<Re?-1:Me>Re?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(ye,He,Me,Re){return!(ye>=0&&ye<=23)||!(He>=0&&He<=59)||!(Me>=0&&Me<=59)||!(Re>=0&&Re<=999)?null:ye*l+He*b+Me*v+Re}function a(ye){if(A(ye))return null;const He=String(ye).trim();if(He==="")return null;const Me=m.exec(He);if(Me){const nt=Me[1];if(nt.length===5)return null;const Qe=nt.length===3?1:2;return c(Number(nt.slice(0,Qe)),Number(nt.slice(Qe,Qe+2)),Number(nt.slice(Qe+2,Qe+4)||0),0)}const Re=n.exec(He);if(!Re)return null;let Ee=Number(Re[1]);const $e=Number(Re[2]||0),Ie=Number(Re[3]||0),We=Re[4]?Number(Re[4].padEnd(3,"0")):0,Ye=Re[5]?Re[5][0].toLowerCase():null;if(Ye){if(Ee<1||Ee>12)return null;Ee=Ee%12,Ye==="p"&&(Ee+=12)}return c(Ee,$e,Ie,We)}function u(ye){return A(ye)||ye===""?null:typeof ye=="number"?Number.isFinite(ye)?(ye%g+g)%g:null:ye instanceof Date?Number.isNaN(ye.getTime())?null:ye.getHours()*l+ye.getMinutes()*b+ye.getSeconds()*v+ye.getMilliseconds():a(ye)}const h=new Map;function p(ye){const He=ye.pattern||"",Me=ye.timeStyle||(ye.seconds?"medium":"short"),Re=`${ye.locale||""}|${He}|${Me}`;let Ee=h.get(Re);if(Ee)return Ee;if(He)Ee=Q(He,ye.locale||void 0,"UTC");else{const $e=new Intl.DateTimeFormat(ye.locale||void 0,{timeStyle:Me,timeZone:"UTC"});Ee=Ie=>$e.format(Ie)}return h.set(Re,Ee),Ee}function y(ye,He){const Me=He||j;if(ye==null||typeof ye!="number"||!Number.isFinite(ye))return Me.nullDisplay??"";const Re=(ye%g+g)%g;return p(Me)(new Date(Re))}function d(ye){return ye instanceof Date?!Number.isNaN(ye.getTime()):typeof ye=="number"?Number.isFinite(ye)&&ye>=0&&ye<g:typeof ye!="string"||!ye.includes(":")?!1:a(ye)!==null}function f(ye){const He=u(ye);return He==null?"":y(He,{pattern:He%v===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const w=new Map;function k(ye){const He=ye||"";let Me=w.get(He);return Me||(Me=new Intl.DateTimeFormat("en-GB",{timeZone:ye||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),w.set(He,Me)),Me}function P(ye,He){const Me={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const Re of k(He).formatToParts(new Date(ye)))Re.type==="year"?Me.year=Number(Re.value):Re.type==="month"?Me.month=Number(Re.value):Re.type==="day"?Me.day=Number(Re.value):Re.type==="hour"?Me.hour=Number(Re.value)%24:Re.type==="minute"?Me.minute=Number(Re.value):Re.type==="second"&&(Me.second=Number(Re.value));return Me}function G(ye,He){const Me=P(ye,He);return Date.UTC(Me.year,Me.month-1,Me.day,Me.hour,Me.minute,Me.second,0)-Math.floor(ye/1e3)*1e3}function K(ye,He){const Me=ye.hour||0,Re=ye.minute||0,Ee=ye.second||0,$e=ye.ms||0;if(!He)return new Date(ye.year,ye.month-1,ye.day,Me,Re,Ee,$e).getTime();const Ie=Date.UTC(ye.year,ye.month-1,ye.day,Me,Re,Ee,$e);let We=Ie-G(Ie,He);return We=Ie-G(We,He),We}const q=/(?:Z|[+-]\d{2}:?\d{2})$/i,B=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function E(ye,He){if(A(ye))return null;const Me=String(ye).trim();if(Me==="")return null;const Re=He&&He.timeZone||void 0;if(!q.test(Me)){const Ee=B.exec(Me);if(Ee){const $e=(Ee[4]||"").trim(),Ie=$e===""?0:a($e);if(Ie===null)return null;const We=K({year:Number(Ee[1]),month:Number(Ee[2]),day:Number(Ee[3]),hour:Math.floor(Ie/l),minute:Math.floor(Ie/b)%60,second:Math.floor(Ie/v)%60,ms:Ie%v},Re);return Number.isNaN(We)?null:new Date(We)}}return L(Me)}function S(ye){if(typeof ye=="number")return Number.isFinite(ye)?ye:null;const He=L(ye);return He?He.getTime():null}const C=new Map;function N(ye){const He=[ye.locale||"",ye.pattern||"",ye.dateStyle||"",ye.timeStyle||"",ye.timeZone||"",ye.seconds?"1":""].join("|");let Me=C.get(He);if(Me)return Me;const Re=ye.pattern?{type:"date",pattern:ye.pattern,timeZone:ye.timeZone}:{type:"date",dateStyle:ye.dateStyle||"medium",timeStyle:ye.timeStyle||(ye.seconds?"medium":"short"),timeZone:ye.timeZone};return Me=H(Re,ye.locale||void 0),C.set(He,Me),Me}function O(ye,He){const Me=He||j,Re=S(ye);return Re==null?Me.nullDisplay??"":N(Me)(Re)}function T(ye){return ye instanceof Date?!Number.isNaN(ye.getTime()):typeof ye!="string"||!B.test(ye.trim())?!1:E(ye)!==null}const R=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:l,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:v,intl:"second",long:["second","seconds"],names:["s","sec","secs","second","seconds"]},{key:"ms",ms:1,intl:"millisecond",long:["millisecond","milliseconds"],names:["ms","msec","msecs","milli","millis","millisecond","milliseconds"]}]),x=new Map;for(const ye of R)for(const He of ye.names)x.set(He,ye);const U=Object.freeze(R.filter(ye=>ye.key!=="w")),V=/^(\d+(?:\.\d+)?)\s*([a-z]+)\s*(?:,\s*)?/,J=/^\d+(?:\.\d+)?$/,_=/^(\d+):([0-5]?\d)(?::([0-5]?\d))?(?:\.(\d{1,3}))?$/;function ee(ye){const He=ye&&ye.defaultUnit?x.get(String(ye.defaultUnit).toLowerCase()):null;return He?He.ms:b}function W(ye){return(ye&&ye.defaultUnit?x.get(String(ye.defaultUnit).toLowerCase()):null)||x.get("m")}function Z(ye,He){if(A(ye))return null;let Me=String(ye).trim().toLowerCase();if(Me==="")return null;let Re=1;if(Me[0]==="-"?(Re=-1,Me=Me.slice(1).trim()):Me[0]==="+"&&(Me=Me.slice(1).trim()),Me==="")return null;const Ee=_.exec(Me);if(Ee){const Ye=Ee[3]!==void 0,nt=Number(Ee[1])*l+Number(Ee[2])*b+(Ye?Number(Ee[3])*v:0)+(Ee[4]?Number(Ee[4].padEnd(3,"0")):0);return Re*nt}if(J.test(Me))return Math.round(Re*Number(Me)*ee(He||j));let $e=Me,Ie=0,We=0;for(;$e!=="";){const Ye=V.exec($e);if(!Ye)return null;const nt=x.get(Ye[2]);if(!nt)return null;Ie+=Number(Ye[1])*nt.ms,$e=$e.slice(Ye[0].length),We++}return We===0?null:Math.round(Re*Ie)}function ne(ye){return A(ye)||ye===""?null:typeof ye=="number"?Number.isFinite(ye)?ye:null:Z(ye)}const ie=new Map;function ce(ye,He,Me){const Re=`${Me||""}|${He.intl}`;let Ee=ie.get(Re);if(Ee===void 0){try{Ee=new Intl.NumberFormat(Me||void 0,{style:"unit",unit:He.intl,unitDisplay:"long"})}catch{Ee=null}ie.set(Re,Ee)}return Ee?Ee.format(ye):`${ye} ${ye===1?He.long[0]:He.long[1]}`}function me(ye,He){return String(ye).padStart(He,"0")}function Ce(ye,He){const Me=He||j;if(ye==null||typeof ye!="number"||!Number.isFinite(ye))return Me.nullDisplay??"";const Re=Me.style||"short",Ee=ye<0;let $e=Math.round(Math.abs(ye));const Ie=Ee?"-":"";if($e===0&&Me.zeroDisplay!=null)return Me.zeroDisplay;if(Re==="clock"){const Qe=Math.floor($e/l),dt=Math.floor($e/b)%60,jt=Math.floor($e/v)%60;return`${Ie}${me(Qe,2)}:${me(dt,2)}:${me(jt,2)}`}if($e===0){const Qe=W(Me);return Re==="long"?ce(0,Qe,Me.locale):`0${Qe.key}`}const We=Me.weeks===!0?R:U,Ye=typeof Me.maxUnits=="number"&&Me.maxUnits>0?Me.maxUnits:Me.maxUnits===void 0?2:1/0,nt=[];for(const Qe of We){if(nt.length>=Ye)break;const dt=Math.floor($e/Qe.ms);dt!==0&&($e-=dt*Qe.ms,nt.push(Re==="long"?ce(dt,Qe,Me.locale):`${dt}${Qe.key}`))}return Ie+nt.join(" ")}function Pe(ye){if(typeof ye!="string")return!1;const He=ye.trim();return He===""||_.test(He)||!/[a-z]/i.test(He)?!1:Z(He)!==null}const xe=Date.UTC(1899,11,30),_e=new Map;function ve(ye,He){const Me=ye||"";let Re=_e.get(Me);Re||(Re=new Intl.DateTimeFormat("en-GB",{timeZone:ye||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),_e.set(Me,Re));const Ee=typeof He=="number"?He:Date.now();for(const $e of Re.formatToParts(new Date(Ee)))if($e.type==="timeZoneName")return $e.value;return""}function oe(ye){if(ye)return ye;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function he(ye,He){const Me=oe(ye),Re=ve(ye,He);return Re?`${Me} (${Re})`:Me}function ae(ye,He){if(ye&&ye.timeZone)return ye.timeZone;const Me=He&&He.grid;return(Me&&Y(Me.get)?Me.get("timeZone"):void 0)||void 0}function se(ye,He){const Me=He||j,Re=S(ye);if(Re==null)return Me.nullDisplay??"";const Ee=N(Me)(Re);if(!Me.showOrigin)return Ee;const $e=Me.originZone;return $e?$e===(Me.timeZone||oe(Me.timeZone))?Ee:`${Ee} (${he($e,Re)})`:`${Ee} (no origin recorded)`}function de(ye,He,Me,Re){if(He==="instant"||!He)return ye;const Ee=P(ye,Me);if(He==="month")return K({year:Ee.year,month:Ee.month,day:1},Me);if(He==="week"){const $e=Re>=1&&Re<=7?Re:1,We=((new Date(Date.UTC(Ee.year,Ee.month-1,Ee.day)).getUTCDay()+6)%7+1-$e+7)%7,Ye=new Date(Date.UTC(Ee.year,Ee.month-1,Ee.day-We));return K({year:Ye.getUTCFullYear(),month:Ye.getUTCMonth()+1,day:Ye.getUTCDate()},Me)}return K({year:Ee.year,month:Ee.month,day:Ee.day},Me)}function ke(ye,He){const Me=ye&&ye.group,Re=Me&&Me.granularity||"day";if(Re==="instant")return null;const Ee=Me&&Me.weekStart;return $e=>typeof $e=="number"?de($e,Re,He,Ee):$e}const Ae={time:{base:"number",storage:"float64",matches:d,format:ye=>y(u(ye.value),s(ye,"time")),parse:ye=>a(ye.text),compare:(ye,He)=>i(u(ye),u(He)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:ye=>{const He=u(ye);return He===null?null:He/F},toStorage:ye=>u(ye),toClipboard:f,fromClipboard:a},datetime:{base:"dateString",storage:"dictionary",matches:T,format:ye=>O(ye.value,s(ye,"datetime")),parse:ye=>$(E(ye.text,s(ye,"datetime"))??ye.text),compare:X,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(ye,He)=>$(ye,He&&He.timeZone),toClipboard:ye=>A(ye)?"":String(ye),fromClipboard:ye=>$(ye)},duration:{base:"number",storage:"float64",matches:Pe,format:ye=>Ce(ne(ye.value),s(ye,"duration")),parse:ye=>Z(ye.text,s(ye,"duration")),compare:(ye,He)=>i(ne(ye),ne(He)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:ye=>{const He=ne(ye);return He===null?null:He/F},toStorage:ye=>ne(ye),toClipboard:ye=>Ce(ne(ye),{style:"short",maxUnits:-1}),fromClipboard:ye=>Z(ye)},timestamp:{base:"number",storage:"float64",format:ye=>{const He=s(ye,"timestamp");return se(ye.value,{...He,timeZone:ae(He,ye)})},parse:ye=>{const He=s(ye,"timestamp"),Me=E(ye.text,{timeZone:ae(He,ye)});return Me?Me.getTime():null},compare:(ye,He)=>i(S(ye),S(He)),groupProjector:(ye,He)=>ke(ye,He),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(ye,He)=>{const Me=S(ye);if(Me==null)return null;const Re=P(Me,He&&He.timeZone||void 0);return(Date.UTC(Re.year,Re.month-1,Re.day,Re.hour,Re.minute,Re.second)-xe)/F},toStorage:ye=>S(ye),toClipboard:ye=>{const He=S(ye);return He==null?"":new Date(He).toISOString()},fromClipboard:ye=>S(ye)}},Te=["datetime","time","duration"],je=Ae}),Ve("packages/core/src/internal/lru.js",function(e,D){"use strict";Object.defineProperty(e,"Lru",{enumerable:!0,get:function(){return re}});class re{#e;#t=new Map;#n;constructor(Y=256,I=null){this.#e=Y,this.#n=I}get size(){return this.#t.size}get max(){return this.#e}set max(Y){this.#e=Y,this.#r()}has(Y){return this.#t.has(Y)}get(Y){const I=this.#t;if(!I.has(Y))return;const L=I.get(Y);return I.delete(Y),I.set(Y,L),L}peek(Y){return this.#t.get(Y)}set(Y,I){const L=this.#t;return L.has(Y)&&L.delete(Y),L.set(Y,I),this.#r(),I}delete(Y){const I=this.#t.get(Y);return this.#t.delete(Y)&&this.#n&&this.#n(I,Y),I}clear(){if(this.#n)for(const[Y,I]of this.#t)this.#n(I,Y);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const Y=this.#t;for(;Y.size>this.#e;){const I=Y.keys().next().value,L=Y.get(I);Y.delete(I),this.#n&&this.#n(L,I)}}}}),Ve("packages/core/src/columns/types/network.js",function(e,D){"use strict";Object.defineProperty(e,"toUint32",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"compareIpv4",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"packCidr",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"cidrParts",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"cidrNetworkOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"storeNumberOf",{enumerable:!0,get:function(){return s}}),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 a}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return h}}),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 d}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ipv6Groups",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"macValue",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"parseMac",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"formatMac",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"macHex",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(e,"macContains",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"compareMac",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"MAC_OPERATORS",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return he}});const A=D("packages/core/src/internal/predicates.js").isNil,I=D("packages/core/src/internal/lru.js").Lru,L=4294967295,Q=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function H(ae){if(A(ae))return null;if(typeof ae=="string")return $(ae);const se=Number(ae);return Number.isFinite(se)?se<0?se<-2147483648?null:se>>>0:se>L?null:Math.trunc(se)>>>0:null}function $(ae){if(A(ae))return null;const se=String(ae).trim();if(se==="")return null;const de=Q.exec(se);if(!de)return null;let ke=0;for(let Ae=1;Ae<=4;Ae++){const Te=de[Ae];if(Te.length>1&&Te.charCodeAt(0)===48)return null;const je=Number(Te);if(je>255)return null;ke=ke*256+je}return ke}function X(ae){const se=H(ae);return se===null?"":`${se>>>24&255}.${se>>>16&255}.${se>>>8&255}.${se&255}`}function F(ae){return typeof ae=="string"&&$(ae)!==null}function j(ae,se){const de=H(ae),ke=H(se);return de===null?ke===null?0:1:ke===null||de<ke?-1:de>ke?1:0}const v=64,b=L*v+32,l=/^(?:0|[1-9]\d?)$/;function g(ae,se){return ae*v+se}function o(ae){if(A(ae))return null;if(typeof ae=="string"){const ke=i(ae);return ke===null?null:o(ke)}if(typeof ae=="object"){const ke=H(ae.address),Ae=Number(ae.prefix);return ke===null||!Number.isInteger(Ae)||Ae<0||Ae>32?null:{address:ke,prefix:Ae}}const se=Number(ae);if(!Number.isInteger(se)||se<0||se>b)return null;const de=se%v;return de>32?null:{address:(se-de)/v,prefix:de}}function t(ae){return!!(ae&&ae.typeOptions&&ae.typeOptions.cidrNetwork)}function s(ae){return!!(ae&&ae.typeOptions&&ae.typeOptions.storeNumber)}function r(ae,se,de){return ae==null?null:s(se)?ae:de(ae)}function i(ae,se){if(A(ae))return null;const de=String(ae).trim();if(de==="")return null;const ke=de.indexOf("/");if(ke<0)return null;const Ae=$(de.slice(0,ke));if(Ae===null)return null;const Te=de.slice(ke+1).trim();if(!l.test(Te))return null;const je=Number(Te);if(je>32)return null;const ye=se&&se.network?(Ae&a(je))>>>0:Ae;return g(ye,je)}function n(ae){const se=o(ae);return se?`${X(se.address)}/${se.prefix}`:""}function m(ae){return typeof ae=="string"&&i(ae)!==null}function c(ae,se){const de=o(ae),ke=o(se);return de?ke?de.address!==ke.address?de.address<ke.address?-1:1:de.prefix-ke.prefix:-1:ke?1:0}function a(ae){return ae===0?0:4294967295<<32-ae>>>0}function u(ae){const se=o(ae);return se?(se.address&a(se.prefix))>>>0:null}function h(ae){const se=o(ae);return se?(se.address&a(se.prefix)|~a(se.prefix)>>>0)>>>0:null}function p(ae){const se=o(ae);return se?2**(32-se.prefix):null}function y(ae){const se=o(ae);return se?se.prefix===32?1:se.prefix===31?2:2**(32-se.prefix)-2:null}function d(ae,se){const de=o(ae);if(!de)return!1;const ke=H(se);if(ke===null)return!1;const Ae=a(de.prefix);return(ke&Ae)>>>0===(de.address&Ae)>>>0}function f(ae,se){const de=u(ae),ke=u(se);return de===null||ke===null?!1:de<=h(se)&&ke<=h(ae)}const w=/^[0-9a-fA-F]{1,4}$/,k=new I(512);function P(ae){if(A(ae))return null;let se=String(ae).trim();if(se==="")return null;const de=se.indexOf("%");if(de>=0&&(se=se.slice(0,de)),se==="")return null;if(se.indexOf(".")>=0){const He=se.lastIndexOf(":");if(He<0)return null;const Me=$(se.slice(He+1));if(Me===null)return null;se=`${se.slice(0,He+1)}${(Me>>>16&65535).toString(16)}:${(Me&65535).toString(16)}`}const ke=se.split("::");if(ke.length>2)return null;const Ae=G(ke[0]);if(Ae===null)return null;if(ke.length===1)return Ae.length===8?Ae:null;const Te=G(ke[1]);if(Te===null)return null;const je=8-Ae.length-Te.length;if(je<1)return null;const ye=Ae.slice();for(let He=0;He<je;He++)ye.push(0);for(const He of Te)ye.push(He);return ye}function G(ae){if(ae==="")return[];const se=[];for(const de of ae.split(":")){if(!w.test(de))return null;se.push(parseInt(de,16))}return se}function K(ae){if(typeof ae!="string")return P(ae);if(k.has(ae))return k.get(ae);const se=P(ae);return k.set(ae,se),se}function q(ae){if(ae[0]===0&&ae[1]===0&&ae[2]===0&&ae[3]===0&&ae[4]===0&&ae[5]===65535)return`::ffff:${X((ae[6]<<16|ae[7])>>>0)}`;let se=-1,de=0,ke=-1,Ae=0;for(let ye=0;ye<8;ye++)ae[ye]===0?(ke<0?(ke=ye,Ae=1):Ae++,Ae>de&&(de=Ae,se=ke)):(ke=-1,Ae=0);if(de<2)return ae.map(ye=>ye.toString(16)).join(":");const Te=ae.slice(0,se).map(ye=>ye.toString(16)).join(":"),je=ae.slice(se+de).map(ye=>ye.toString(16)).join(":");return`${Te}::${je}`}function B(ae){const se=P(ae);return se===null?null:q(se)}function E(ae){return B(ae)??""}function S(ae){return typeof ae=="string"&&ae.indexOf(":")>=0&&P(ae)!==null}function C(ae,se){const de=K(ae),ke=K(se);if(!de)return ke?1:0;if(!ke)return-1;for(let Ae=0;Ae<8;Ae++)if(de[Ae]!==ke[Ae])return de[Ae]<ke[Ae]?-1:1;return 0}const N=/^[0-9a-fA-F]{12}$/,O=/^[0-9a-fA-F]{4}\.[0-9a-fA-F]{4}\.[0-9a-fA-F]{4}$/,T=/^[0-9a-fA-F]{2}$/;function R(ae){const se=[];for(let de=0;de<12;de+=2)se.push(parseInt(ae.slice(de,de+2),16));return se}function x(ae){if(A(ae))return null;if(typeof ae=="number"){if(!Number.isInteger(ae)||ae<0||ae>0xffffffffffff)return null;const Ae=[];for(let Te=5;Te>=0;Te--)Ae.push(Math.floor(ae/256**Te)%256);return Ae}const se=String(ae).trim();if(se==="")return null;if(N.test(se))return R(se);if(se.indexOf(".")>=0)return O.test(se)?R(se.split(".").join("")):null;const de=se.indexOf(":")>=0?":":se.indexOf("-")>=0?"-":null;if(de===null)return null;const ke=se.split(de);if(ke.length!==6)return null;for(const Ae of ke)if(!T.test(Ae))return null;return ke.map(Ae=>parseInt(Ae,16))}function U(ae){const se=x(ae);if(!se)return null;let de=0;for(const ke of se)de=de*256+ke;return de}function V(ae){const se=x(ae);return se?se.map(de=>de.toString(16).padStart(2,"0")).join(":"):null}function J(ae,se="colon"){const de=x(ae);if(!de)return"";const ke=de.map(Ae=>Ae.toString(16).padStart(2,"0"));switch(se){case"hyphen":return ke.join("-");case"colon-upper":return ke.map(Ae=>Ae.toUpperCase()).join(":");case"cisco":return`${ke[0]}${ke[1]}.${ke[2]}${ke[3]}.${ke[4]}${ke[5]}`;default:return ke.join(":")}}function _(ae){return typeof ae=="string"&&x(ae)!==null}function ee(ae){if(A(ae))return null;const se=String(ae).trim();if(se==="")return null;const de=se.replace(/[:-]/g,"").replace(/\./g,"").toLowerCase();return/^[0-9a-f]+$/.test(de)?de:null}function W(ae,se){const de=ee(ae),ke=ee(se);return!!(de&&ke&&de.includes(ke))}function Z(ae,se){const de=U(ae),ke=U(se);return de===null?ke===null?0:1:ke===null||de<ke?-1:de>ke?1:0}const ne=Object.freeze(["macEquals","macInRange","macContains"]),ie=Object.freeze(["eq","ne","contains","notContains","startsWith","endsWith"]);function ce(ae){switch(ae){case"macEquals":return{compile:se=>{const de=U(se);return de===null?()=>!1:ke=>U(ke)===de},check:se=>U(se)===null?"the operand is not a MAC address":null};case"macInRange":return{compile:se=>{const de=Array.isArray(se)?se:[se,se],ke=U(de[0]),Ae=U(de[1]);return ke===null||Ae===null||ke>Ae?()=>!1:Te=>{const je=U(Te);return je!==null&&je>=ke&&je<=Ae}},check:se=>{const de=Array.isArray(se)?se:[];if(de.length!==2)return"the operand must be two MAC addresses, the low and high ends of the range";const ke=U(de[0]),Ae=U(de[1]);return ke===null||Ae===null?"an end of the range is not a MAC address":ke>Ae?"the low end of the range is above the high end":null}};case"macContains":return{compile:se=>de=>W(de,se),check:se=>ee(se)===null?"the operand is not hex":null};default:return{compile:()=>()=>!1,check:()=>"unknown MAC operator"}}}function me(ae){switch(ae){case"eq":return{compile:se=>{const de=U(se);return de===null?()=>!1:ke=>U(ke)===de},check:se=>U(se)===null?"the operand is not a MAC address":null};case"ne":return{compile:se=>{const de=U(se);return de===null?()=>!1:ke=>U(ke)!==de},check:se=>U(se)===null?"the operand is not a MAC address":null};case"contains":return{compile:se=>de=>W(de,se),check:se=>ee(se)===null?"the operand is not hex":null};case"notContains":return{compile:se=>de=>!W(de,se),check:se=>ee(se)===null?"the operand is not hex":null};case"startsWith":return{compile:se=>{const de=String(se??"").toLowerCase();return ke=>ke==null?!1:String(ke).toLowerCase().startsWith(de)}};case"endsWith":return{compile:se=>{const de=String(se??"").toLowerCase();return ke=>ke==null?!1:String(ke).toLowerCase().endsWith(de)}};default:return{compile:()=>()=>!1,check:()=>"unknown MAC text operator"}}}const Ce=Object.freeze(["lt","lte","gt","gte","between","notBetween","in","notIn","matches"]);function Pe(ae){const se=o(ae);return se===null?null:g(se.address,se.prefix)}function xe(ae,se,de){const ke=ye=>String(ye??"").trim().toLowerCase(),Ae=ye=>{if(ye==null)return null;const He=se(ye);return He===""?null:He.toLowerCase()},Te=ye=>ae(ye)===null?`the operand is not ${de}`:null,je=(ye,He)=>({compile:Me=>{const Re=ke(Me);return Ee=>{const $e=Ae(Ee);return $e===null?He:He?!ye($e,Re):ye($e,Re)}}});return Object.freeze({eq:{compile:ye=>{const He=ae(ye);return He===null?()=>!1:Me=>ae(Me)===He},check:Te},ne:{compile:ye=>{const He=ae(ye);return He===null?()=>!0:Me=>ae(Me)!==He},check:Te},contains:je((ye,He)=>ye.includes(He),!1),notContains:je((ye,He)=>ye.includes(He),!0),startsWith:je((ye,He)=>ye.startsWith(He),!1),endsWith:je((ye,He)=>ye.endsWith(He),!1),...Object.fromEntries(Ce.map(ye=>[ye,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"}),ve=(ae,se)=>de=>{const ke=de&&typeof de.text=="string"?de.text:"";return ke.trim()!==""&&ae(ke)===null?se:null},oe=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:F,parse:ae=>$(ae.text),parseError:ve($,_e.ipv4),compare:j,format:ae=>X(ae.value),operators:xe(H,X,"an IPv4 address"),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:ae=>H(ae),toRow:(ae,se)=>r(ae,se,X),toClipboard:ae=>X(ae),fromClipboard:ae=>$(ae)},cidr:{base:"number",storage:"float64",matches:m,parse:ae=>i(ae.text,{network:t(ae.column)}),parseError:ve(i,_e.cidr),compare:c,format:ae=>n(ae.value),operators:xe(Pe,n,"a network in CIDR form"),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:ae=>{const se=o(ae);return se===null?null:g(se.address,se.prefix)},toRow:(ae,se)=>r(ae,se,n),toClipboard:ae=>n(ae),fromClipboard:(ae,se)=>i(ae,{network:t(se&&se.column)})},ipv6:{base:"text",storage:"dictionary",matches:S,parse:ae=>B(ae.text),parseError:ve(B,_e.ipv6),compare:C,format:ae=>E(ae.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:ae=>B(ae),toClipboard:ae=>E(ae),fromClipboard:ae=>B(ae)},mac:{base:"text",storage:"dictionary",matches:_,parse:ae=>V(ae.text),parseError:ve(V,_e.mac),compare:Z,format:ae=>J(ae.value,ae.column&&ae.column.typeOptions&&ae.column.typeOptions.macFormat),operators:Object.freeze({...Object.fromEntries(ne.map(ae=>[ae,ce(ae)])),...Object.fromEntries(ie.map(ae=>[ae,me(ae)]))}),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:ae=>V(ae),fromClipboard:ae=>V(ae)}}),he=oe}),Ve("packages/core/src/columns/types/vlan.js",function(e,D){"use strict";Object.defineProperty(e,"vlanError",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseVlans",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"formatVlans",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"vlanContains",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"vlanOverlaps",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"vlanCount",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"isVlan",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"compareVlans",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"VLAN_TYPES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}});const re=1,A=4094,Y=/^\d+$/;function I(t,s){const r=!!(s&&s.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 a=c.trim();if(a==="")return{ids:null,error:`"${i}" has an empty entry`};const u=a.indexOf("-");if(u>=0){if(r)return{ids:null,error:"a single-ID VLAN column holds one ID, not a list or range"};const h=a.slice(0,u).trim(),p=a.slice(u+1).trim();if(!Y.test(h)||!Y.test(p))return{ids:null,error:`"${a}" is not a VLAN range like 20-30`};let y=Number(h),d=Number(p);if(y<re||y>A||d<re||d>A)return{ids:null,error:`VLAN IDs are between ${re} and ${A}`};if(y>d){const f=y;y=d,d=f}for(let f=y;f<=d;f++)m.add(f)}else{if(!Y.test(a))return{ids:null,error:`"${a}" is not a VLAN ID (a whole number ${re}-${A})`};const h=Number(a);if(h<re||h>A)return{ids:null,error:`VLAN IDs are between ${re} and ${A}`};if(r&&n.length>1)return{ids:null,error:"a single-ID VLAN column holds one ID, not a list or range"};m.add(h)}}return r&&m.size>1?{ids:null,error:"a single-ID VLAN column holds one ID, not a list or range"}:{ids:[...m].sort((c,a)=>c-a),error:null}}function L(t,s){return I(t,s).error}function Q(t){const s=[];let r=0;for(;r<t.length;){let i=r;for(;i+1<t.length&&t[i+1]===t[i]+1;)i++;s.push(i===r?String(t[r]):`${t[r]}-${t[i]}`),r=i+1}return s.join(",")}function H(t){if(t==null||t==="")return null;if(typeof t=="string")return I(t,{}).ids;if(Array.isArray(t)){const s=new Set;for(const r of t){if(typeof r!="number"||!Number.isInteger(r)||r<re||r>A)return null;s.add(r)}return s.size?[...s].sort((r,i)=>r-i):null}return typeof t=="number"&&Number.isInteger(t)&&t>=re&&t<=A?[t]:null}function $(t,s){const r=I(t,s);return r.ids===null?null:Q(r.ids)}function X(t){const s=H(t);return s===null?"":Q(s)}function F(t,s){const r=H(t);if(r===null)return!1;const i=Number(s);return Number.isInteger(i)&&r.includes(i)}function j(t,s){const r=H(t);if(r===null)return!1;const i=new Set(r),n=Array.isArray(s)?s:typeof s=="string"?s.split(","):[s];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 v(t){const s=H(t);return s===null?0:s.length}function b(t){return typeof t=="string"&&$(t)!==null}function l(t,s){const r=H(t),i=H(s);return r===null?i===null?0:1:i===null?-1:r[0]!==i[0]?r[0]<i[0]?-1:1:r.length<i.length?-1:r.length>i.length?1:0}const g=Object.freeze({vlan:{base:"text",storage:"dictionary",matches:b,parse:t=>$(t.text,{single:!!(t.column&&t.column.typeOptions&&t.column.typeOptions.vlanSingle)}),parseError:t=>L(t.text,{single:!!(t.column&&t.column.typeOptions&&t.column.typeOptions.vlanSingle)}),compare:l,format:t=>X(t.value),defaults:{filter:"text",editor:"vlan",align:"start"},excel:"@",operators:Object.freeze({contains:{compile:t=>s=>F(s,t),check:t=>{const s=Number(typeof t=="string"?t.trim():t);return!Number.isInteger(s)||s<re||s>A?`contains needs one VLAN ID ${re}-${A}`:null}},overlaps:{compile:t=>s=>j(s,t),check:t=>{const s=Array.isArray(t)?t:typeof t=="string"?t.split(","):[t];for(const r of s){const i=Number(typeof r=="string"?r.trim():r);if(!Number.isInteger(i)||i<re||i>A)return`overlaps needs VLAN IDs ${re}-${A}`}return null}}}),toStorage:t=>$(t),toClipboard:t=>X(t),fromClipboard:t=>$(t)}}),o=g}),Ve("packages/core/src/i18n/catalogue.js",function(e,D){"use strict";Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return L}});const re=D("packages/core/src/registry/free-tier-notice.js"),A=re.FREE_TIER_NOTICE,Y=re.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":Y,"licence.watermark.free":A,"filter.op.contains":"Contains","filter.op.notContains":"Does not contain","filter.op.equals":"Equals","filter.op.notEqual":"Does not equal","filter.op.startsWith":"Starts with","filter.op.endsWith":"Ends with","filter.op.blank":"Is blank","filter.op.notBlank":"Is not blank","filter.op.lessThan":"Less than","filter.op.lessThanOrEqual":"Less than or equal","filter.op.greaterThan":"Greater than","filter.op.greaterThanOrEqual":"Greater than or equal","filter.op.inRange":"In range","filter.op.matches":"Matches","filter.op.before":"Before","filter.op.beforeOrEqual":"Before or equal","filter.op.after":"After","filter.op.afterOrEqual":"After or equal","filter.op.relative":"Relative to today","filter.rel.today":"Today","filter.rel.yesterday":"Yesterday","filter.rel.tomorrow":"Tomorrow","filter.rel.lastNDays":"Last N days","filter.rel.nextNDays":"Next N days","filter.rel.thisWeek":"This week","filter.rel.lastWeek":"Last week","filter.rel.thisMonth":"This month","filter.rel.lastMonth":"Last month","filter.rel.thisQuarter":"This quarter","filter.rel.quarterToDate":"Quarter to date","filter.rel.thisYear":"This year","filter.rel.yearToDate":"Year to date","filter.operator":"Operator","filter.operatorNamed":"Operator: {name}","filter.join":"Join","filter.value":"Value","filter.from":"From","filter.to":"To","filter.addCondition":"Add condition","filter.noConditions":"No conditions","filter.removeCondition":"Remove condition","filter.search":"Search","filter.searchValues":"Search values","filter.noMatches":"No values match","filter.selectAll":"Select all","filter.clear":"Clear","filter.order":"Order values","filter.orderAz":"A to Z","filter.orderCount":"Count","filter.all":"All","filter.allExcept":"All but {count}","filter.loadingValues":"Loading values…","filter.topValues":"Top {shown} of {total} values","filter.valuesFailed":"Values could not be loaded: {error}","filter.valuesUnsupported":"This source cannot list the values of {column}; filter by condition instead.","filter.true":"True","filter.false":"False","filter.expression":"Filter expression","filter.column":"Column","filter.relativePeriod":"Relative period","filter.days":"Number of days","filter.tab.set":"Values","filter.tab.text":"Text","filter.tab.number":"Number","filter.tab.date":"Date","filter.tab.advanced":"Advanced","filterRow.label":"Filter row","filterRow.conditions":{one:"{count} condition",other:"{count} conditions"},"chart.empty":"Nothing to chart","chart.summary":"{type} chart of {measure} by {dimension}","chart.summaryShare":"{type} chart of {measure}","chart.summaryType":"{type} chart","chart.summaryGauge":"{type} chart of {measure}, {fn}: {value}","chart.waterfallTotal":"Total","chart.summaryEngine":"Figures computed by the data engine over every matching row","chart.summaryEngineViewport":"{count} points in this view, fetched from the data engine","chart.summaryEngineDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells counted by the data engine","chart.summaryClientDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells computed in the browser","chart.viewportOverCap":"{count} rows in this view, more than the {cap} this map draws; zoom in or narrow the filter","chart.dataTable":"Chart data","chart.viewportFilter.label":"Map view","chart.annotate.rail":"Drawing tools","chart.annotate.select":"Select and move a drawing","chart.annotate.trendLine":"Trend line","chart.annotate.horizontalLine":"Horizontal line","chart.annotate.verticalLine":"Vertical line","chart.annotate.channel":"Parallel channel","chart.annotate.fibonacci":"Fibonacci retracement","chart.annotate.arrow":"Arrow","chart.annotate.pen":"Freehand pen","chart.annotate.pen.described":"Freehand drawing from {from} to {to}","chart.annotate.measure-x":"Date range","chart.annotate.measure-y":"Price range","chart.annotate.measure-xy":"Date and price range","chart.annotate.measure.bars":{one:"{count} bar",other:"{count} bars"},"chart.annotate.measure.points":{one:"{count} point",other:"{count} points"},"chart.annotate.measure.volume":"Vol {value}","chart.annotate.measure.seconds":"{count}s","chart.annotate.measure.minutes":"{count}m","chart.annotate.measure.hours":"{count}h","chart.annotate.measure.days":"{count}d","chart.annotate.measure.weeks":"{count}w","chart.annotate.measure.months":"{count}mo","chart.annotate.measure.years":"{count}y","chart.annotate.measure":"Measure","chart.annotate.measure.dx":"Δx {value}","chart.annotate.measure.dy":"Δy {value}","chart.annotate.measure.pct":"{value}%","chart.annotate.measure.categories":{one:"{count} category",other:"{count} categories"},"chart.annotate.measure.slope.perDay":"Slope {value} per day","chart.annotate.measure.slope.perCategory":"Slope {value} per category","chart.annotate.measure.slope.perUnit":"Slope {value} per unit","chart.annotate.measure.dur.d":"{count} d","chart.annotate.measure.dur.h":"{count} h","chart.annotate.measure.dur.min":"{count} min","chart.annotate.measure.dur.s":"{count} s","chart.annotate.measure.dur.ms":"{count} ms","chart.annotate.measure.announce":"Measurement: {readout}","chart.annotate.measure.start":"Measure start: {x}, {y}","chart.annotate.text":"Text","chart.annotate.callout":"Callout","chart.annotate.note":"Note","chart.annotate.delete":"Delete the selected drawing","chart.annotate.editLabel":"Annotation text","chart.zoom.toolbar":"Zoom controls","chart.zoom.in":"Zoom in","chart.zoom.out":"Zoom out","chart.zoom.left":"Pan left","chart.zoom.right":"Pan right","chart.zoom.reset":"Reset the zoom","chart.legendMore":{one:"+{count} more",other:"+{count} more"},"chart.type.line":"Line","chart.type.area":"Area","chart.type.bar":"Bar","chart.type.pie":"Pie","chart.type.donut":"Donut","chart.type.sunburst":"Sunburst","chart.type.scatter":"Scatter","chart.type.step":"Step","chart.type.rangeArea":"Range","chart.type.horizontalBar":"Horizontal bar","chart.type.waterfall":"Waterfall","chart.type.floatingBar":"Floating bar","chart.type.horizontalFloatingBar":"Horizontal floating bar","chart.type.populationPyramid":"Population pyramid","chart.type.bullet":"Bullet","chart.type.bubble":"Bubble","chart.type.histogram":"Histogram","chart.type.boxplot":"Box plot","chart.type.forest":"Forest plot","chart.type.qq":"QQ plot","chart.type.ecdf":"ECDF","chart.type.lorenz":"Lorenz","chart.type.correlogram":"Correlogram","chart.type.control":"Control","chart.type.capability":"Capability","chart.type.movingRange":"Moving range","chart.type.treemap":"Treemap","chart.type.combo":"Combination","chart.type.pareto":"Pareto","chart.type.heatmap":"Heat map","chart.type.radar":"Radar","chart.type.gauge":"Gauge","chart.type.funnel":"Funnel","chart.type.candlestick":"Candlestick","chart.type.ohlc":"OHLC","chart.type.polarArea":"Polar area","chart.type.nightingale":"Nightingale rose","chart.type.rose":"Rose","chart.type.radialBar":"Radial bar","chart.type.polarScatter":"Polar scatter","chart.type.geomap":"Map","chart.type.sankey":"Sankey","chart.type.chord":"Chord","chart.type.pyramid":"Pyramid","chart.type.pictorial":"Pictorial","chart.type.serpentine":"Serpentine timeline","chart.type.spiral":"Spiral timeline","chart.edit.aggregated":"This value is a total of several rows, so it cannot be dragged.","chart.edit.refused":"That change was not applied.","chart.edit.refusedWhy":"That change was not applied: {reason}","chart.type.network":"Network","chart.type.stream":"Stream","chart.type.marimekko":"Marimekko","chart.type.violin":"Violin","chart.type.gantt":"Gantt","chart.type.forceTree":"Force-directed tree","chart.type.pack":"Packed circles","chart.type.tree":"Tree","chart.type.voronoiTreemap":"Voronoi treemap","chart.type.alluvial":"Alluvial","chart.type.arc":"Arc diagram","chart.type.barRace":"Bar chart race","chart.type.bubblemap":"Bubble map","chart.type.bump":"Bump chart","chart.type.calendar":"Calendar heat map","chart.type.choropleth":"Choropleth map","chart.type.decomposition":"Decomposition tree","chart.type.diverging":"Diverging bar","chart.type.dumbbell":"Dumbbell","chart.type.fan":"Fan chart","chart.type.hexbin":"Hexagonal bin","chart.type.hexmap":"Hex map","chart.type.icicle":"Icicle","chart.type.markermap":"Marker map","chart.type.motion":"Motion chart","chart.type.parallel":"Parallel coordinates","chart.type.ridgeline":"Ridgeline","chart.type.roc":"ROC curve","chart.type.scatter3d":"3D scatter","chart.type.slope":"Slope chart","chart.type.splom":"Scatter plot matrix","chart.type.venn":"Venn diagram","chart.type.waffle":"Waffle","chart.type.wordCloud":"Word cloud","chart.tasksDropped":{one:"{count} more task not shown",other:"{count} more tasks not shown"},"chart.geoUnmatched":{one:"{count} row could not be placed on the map",other:"{count} rows could not be placed on the map"},"chart.r2":"R² {value}","ai.insights":"Insights","ai.explainView":"Explain this view","ai.explain":"Explain","ai.ask":"Ask","ai.apply":"Apply","ai.discard":"Discard","ai.propose":"Propose","ai.approve":"Approve","ai.thinking":"Thinking…","ai.applying":"Applying…","ai.applied":"Applied: {what}","ai.couldNotApply":"Could not apply: {why}","ai.applyFailed":"it failed","ai.discarded":"Discarded.","ai.discardedNothingWritten":"Discarded. Nothing was written.","ai.nothingWritten":"Nothing was written.","ai.nothingWrittenVetoed":"Nothing was written — a before-handler vetoed it.","ai.scope":"Scope: {scope}","ai.unsafeQuery":"I could not turn that into a safe query: {why}","ai.nothingToDo":"nothing to do","ai.insightsFailed":"Could not generate insights right now. The grid is unaffected.","ai.modelUnreachable":"Could not reach the model right now. The grid is unaffected.","ai.flagged":{one:"{count} unverified figure was removed as ungrounded.",other:"{count} unverified figures were removed as ungrounded."},"ai.askPlaceholder":"Ask your data: “EMEA deals over 50k, biggest first”","ai.askLabel":"Ask your data","ai.actorPlaceholder":"Ask AI to change data: “set the Network Upgrade project to In Progress”","ai.actorLabel":"Ask AI to change data","editor.password.show":"Show value","editor.password.hide":"Hide value","editor.password.showField":"Show {column}","editor.password.hideField":"Hide {column}","facets.computing":"Computing…","facets.suppressed.cardinality":"Too many distinct values to chart","facets.suppressed.rows":"Too many rows to chart","facets.suppressed.streaming":"Paused while live data is streaming","facets.suppressed.noProvider":"No distribution available for this data source","facets.suppressed.type":"This column has no chartable distribution","facets.suppressed.unavailable":"Histogram unavailable","facets.bucketOf":"{count} of {whole} rows","history.undo":"Undo","history.redo":"Redo","history.described":"{action} {label}","history.nothingToUndo":"Nothing to undo","history.nothingToRedo":"Nothing to redo","history.undoDisabled":"Undo (nothing to undo)","history.redoDisabled":"Redo (nothing to redo)","a11y.presence.joined":"{name} joined","a11y.presence.left":"{name} left","prompt.asking":"Asking…","prompt.moreNotes":{one:"and {count} more",other:"and {count} more"},"shortcuts.key.cmd":"Cmd","timeline.live":"Live","timeline.recording":"recording…","panel.zoneHint.group":"Drag a column here to group rows by its values","panel.zoneHint.values":"Drag a column here to total it","panel.zoneHint.pivot":"Drag a column here to pivot across its values","panel.zoneHint.any":"Drag a column here","panel.rowsOf":"{shown} of {total} rows","views.empty":"No saved views yet. Set the grid up as you want it, then save it below.","views.applied":"Applied","views.matchesGrid":"Matches the grid as it is","views.delete":"Delete","views.confirmDelete":"Delete {name}?","views.confirmDeleteLabel":"Confirm deleting {name}","views.shared":"View copied to the clipboard","views.sharedDownload":"Clipboard unavailable; the view was downloaded as {name}","views.sharedFailed":"The view could not be copied or downloaded","views.rename":"Rename","views.ownedBy":"Owned by {name}","views.ownerOnlyReason":"Only {name} or an admin can do that","views.noOwnerReason":"Only an admin can do that — this view has no recorded owner","views.unshare":"Unshare","views.unshareTitle":"Stop sharing {name}","views.duplicate":"Duplicate","views.duplicateTitle":"Duplicate {name}","views.copyName":"{name} (copy)","gantt.row.expand":"Expand {name}","gantt.row.collapse":"Collapse {name}","gantt.resource.over":"{name} — over-allocated","kanban.board":"Board","kanban.requiredTitle":"Required fields","kanban.requiredSave":"Save","kanban.requiredCancel":"Cancel","kanban.moveRefused":'Move refused: a card in "{from}" cannot move to "{to}".',"kpi.status.good":"good","kpi.status.warn":"warn","kpi.status.critical":"critical","kpi.status.unknown":"No data","kpi.node.item":"{count} item","kpi.node.items":"{count} items","kpi.node.worst":"worst status {status}","kpi.node.unknown":"{count} unknown","sidebar.nav":"Main navigation","sidebar.search":"Search","sidebar.collapse":"Collapse sidebar","sidebar.expand":"Expand sidebar","toolbar.more":"More"}),L=Object.freeze(Object.keys(I))}),Ve("packages/core/src/i18n/format.js",function(e,D){"use strict";Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"formatMessage",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return v}});const A=D("packages/core/src/internal/predicates.js").isFunction,Y=/\{(\w+)\}/g,I=new Map,L=new Map;function Q(b){const l=b||"";if(I.has(l))return I.get(l);let g=null;try{g=new Intl.PluralRules(b||void 0)}catch{g=null}return I.set(l,g),g}function H(b,l,g="conjunction"){const o=Array.isArray(b)?b.filter(r=>r!=null&&r!==""):[];if(o.length===0)return"";if(o.length===1)return String(o[0]);const t=`${l||""}|${g}`;let s=L.get(t);if(s===void 0){try{s=new Intl.ListFormat(l||void 0,{style:"long",type:g})}catch{s=null}L.set(t,s)}return s?s.format(o.map(String)):o.map(String).join(", ")}function $(b,l){return b==null?"":typeof b=="number"?Number.isFinite(b)?b.toLocaleString(l||void 0,{maximumFractionDigits:20}):"":String(b)}function X(b,l,g){if(typeof b=="string")return b;if(!b||typeof b!="object")return"";const o=l&&typeof l.count=="number"?l.count:null;if(o===null)return b.other??"";const t=Q(g),s=t?t.select(o):o===1?"one":"other";return b[s]??b.other??""}function F(b,l={},g){const o=X(b,l,g);return o?o.replace(Y,(t,s)=>Object.prototype.hasOwnProperty.call(l,s)?$(l[s],g):t):""}function j(b,l,g="en-GB"){return typeof b=="string"&&b?b:typeof l=="string"&&l?l:g}function v(b,l){const g=b?b[l]:void 0;return g==null||A(g)?l:g}}),Ve("packages/core/src/i18n/registry.js",function(e,D){"use strict";Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"localeCatalogue",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return Q}});const A=D("packages/core/src/i18n/catalogue.js").EN_GB,Y=new Map([["en-gb",A]]);function I(H,$){const X=typeof H=="string"?H.toLowerCase():"";return!X||!$||typeof $!="object"?!1:(Y.set(X,$),!0)}function L(H){if(typeof H!="string"||!H)return null;const $=H.toLowerCase(),X=Y.get($);if(X)return X;const F=$.split("-")[0],j=Y.get(F);if(j)return j;for(const[v,b]of Y)if(v.split("-")[0]===F)return b;return null}function Q(){return[...Y.keys()]}}),Ve("packages/core/src/i18n/index.js",function(e,D){"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 s}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return i}});const re=D("packages/core/src/i18n/catalogue.js"),A=re.EN_GB,Y=re.MESSAGE_KEYS,I=D("packages/core/src/i18n/format.js"),L=I.formatMessage,Q=I.formatList,H=I.lookup,$=I.resolveLocale,F=D("packages/core/src/internal/predicates.js").isFunction,v=D("packages/core/src/internal/warn.js").warnOnce,b=D("packages/core/src/i18n/registry.js"),l=b.registerLocale,g=b.localeCatalogue;Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return re.EN_GB}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return re.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=A;constructor(m={}){this.configure(m)}configure(m={}){this.#e=$(m.locale,m.declared,o);const c=m.messages,a=g(this.#e);if(!a&&this.#e.toLowerCase()!=="en-gb"&&(!c||typeof c!="object")&&v(`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=a?{...A,...a}:A;return}const h=Object.keys(c).filter(p=>!(p in A));h.length&&v(`i18n:unknown:${h[0]}`,`message keys not in the catalogue and so ignored: ${h.slice(0,5).join(", ")}${h.length>5?`, and ${h.length-5} more`:""}`),this.#t={...A,...a||{},...c}}get locale(){return this.#e}t(m,c){return L(H(this.#t,m),c||{},this.#e)}list(m,c){return Q(m,this.#e,c)}number(m,c){const a=Number(m);return Number.isFinite(a)?a.toLocaleString(this.#e,c||{maximumFractionDigits:20}):""}}const s=new t;function r(n){return n instanceof t?n:new t(n||{})}function i(n){const m=n&&typeof n=="object"?n:{},c=Y.filter(u=>{const h=m[u];return h==null||h===""||F(h)}),a=Object.keys(m).filter(u=>!(u in A));return{missing:c,unknown:a}}}),Ve("packages/core/src/columns/types/structured.js",function(e,D){"use strict";Object.defineProperty(e,"MASK_DEFAULTS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"parseJsonText",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}});const re=D("packages/core/src/internal/predicates.js"),A=re.isNil,Y=re.isObject,L=D("packages/core/src/i18n/index.js").defaultMessages,Q=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function H(t,s){const r=s||{},i=r.emptyDisplay??Q.emptyDisplay;if(A(t)||t==="")return i;const m=[...typeof r.char=="string"&&r.char!==""?r.char:Q.char][0]||Q.char,c=r.fixedLength??Q.fixedLength,a=Number.isFinite(r.length)&&Number(r.length)>0?Math.floor(Number(r.length)):Q.length,u=typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):null;let h=0;if(u!==null){const p=Number.isFinite(r.lastVisible)?Math.floor(Number(r.lastVisible)):Q.lastVisible,y=[...u];if(h=p>0&&p<y.length?p:0,h>0){const d=y.slice(y.length-h).join(""),f=Math.max(1,(c?a:y.length)-h);return m.repeat(f)+d}return m.repeat(c?a:Math.max(1,y.length))}return m.repeat(a)}const $=48;function X(t){try{const s=JSON.stringify(t);return s===void 0?null:s}catch{return null}}function F(t,s){if(A(t))return"";const r=Number.isFinite(s&&s.inlineLimit)?Number(s.inlineLimit):$;if(typeof t=="string")return t.length>r?`${t.slice(0,r-1)}…`:t;if(typeof t!="object")return String(t);const i=X(t);if(i!==null&&i.length<=r)return i;if(Array.isArray(t)){const m=t.length;return`[${L.t("count.items",{count:m})}]`}const n=Object.keys(t).length;return`{${L.t("count.keys",{count:n})}}`}function j(t,s){if(t==null)return"null";const r=typeof t;if(r==="number"||r==="boolean"||r==="bigint")return String(t);if(r==="string")return JSON.stringify(t);if(r!=="object")return JSON.stringify(String(t));const i=s||new WeakSet;return i.has(t)?'"[circular]"':(i.add(t),t instanceof Date?JSON.stringify(t.toISOString()):Array.isArray(t)?`[${t.map(c=>j(c,i)).join(",")}]`:`{${Object.keys(t).sort().map(c=>`${JSON.stringify(c)}:${j(t[c],i)}`).join(",")}}`)}function v(t,s){if(A(t))return A(s)?0:1;if(A(s))return-1;const r=j(t),i=j(s);return r<i?-1:r>i?1:0}function b(t){if(A(t))return null;const s=String(t);if(s.trim()==="")return null;try{return JSON.parse(s)}catch{return s}}function l(t){const s=t&&t.cell&&t.cell.props;return Y(s)?s:{}}const g=Object.freeze({json:{base:"object",storage:"object",format:t=>F(t&&t.value,l(t&&t.column)),parse:t=>b(t&&t.text),compare:v,defaults:{editor:"code",filter:"text",align:"start"},excel:"@",toClipboard:t=>{if(A(t))return"";if(typeof t=="string")return t;try{const s=JSON.stringify(t,null,2);return s===void 0?String(t):s}catch{return String(t)}},fromClipboard:t=>b(t)},secret:{base:"text",storage:"object",format:t=>H(t&&t.value,l(t&&t.column)),parse:t=>{const s=t&&t.text;return A(s)||String(s)===""?null:String(s)},compare:(t,s)=>{const r=A(t)||t==="",i=A(s)||s==="";return r===i?0:r?1:-1},defaults:{editor:"password",filter:"none",align:"start"},excel:"@",export:{csv:!1,excel:!1},toClipboard:t=>H(t),fromClipboard:t=>A(t)||String(t)===""?null:String(t)}}),o=g}),Ve("packages/core/src/columns/types/unit.js",function(e,D){"use strict";Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return v}}),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 S}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return T}});const A=D("packages/core/src/internal/predicates.js").isNil,I=D("packages/core/src/internal/warn.js").warnOnce;function L(R,x,U,V){return Object.freeze({symbol:R,factor:x,aliases:Object.freeze(U||[]),binary:!!(V&&V.binary),prefix:V&&V.prefix||null,auto:!(V&&V.auto===!1)})}function Q(R,x,U,V){return L(R,x,U,V)}const H=Object.freeze({data:Object.freeze([L("B",1,["byte","bytes"]),L("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),L("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),L("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),L("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),L("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),L("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),L("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),L("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),L("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([L("bps",1,["bit","bits","bit/s","b/s"]),L("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),L("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),L("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),L("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([L("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),L("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),L("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),L("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),L("in",.0254,["inch","inches"],{auto:!1}),L("ft",.3048,["foot","feet"],{auto:!1}),L("yd",.9144,["yard","yards"],{auto:!1}),L("m",1,["metre","metres","meter","meters"]),L("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),L("mi",1609.344,["mile","miles"],{auto:!1}),L("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([L("mg",.001,["milligram","milligrams"]),L("g",1,["gram","grams"]),L("oz",28.349523125,["ounce","ounces"],{auto:!1}),L("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),L("kg",1e3,["kilogram","kilograms"]),L("st",6350.29318,["stone"],{auto:!1}),L("t",1e6,["tonne","tonnes","ton"],{auto:!1}),L("ton (US)",907184.74,["ton","shortton"],{auto:!1}),L("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([L("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),L("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),L("ms",.001,["msec","msecs","millisecond","milliseconds"]),L("s",1,["sec","secs","second","seconds"]),L("m",60,["min","mins","minute","minutes"]),L("h",3600,["hr","hrs","hour","hours"]),L("d",86400,["day","days"])]),speed:Object.freeze([L("mm/s",.001,["millimetre/s","millimeter/s"]),L("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),L("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),L("mph",.44704,["mile/h","miles/h"],{auto:!1}),L("kn",1852/3600,["knot","knots"],{auto:!1}),L("m/s",1,["metre/s","meter/s","mps"]),L("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([L("mm/s²",.001,["mm/s2"]),L("ft/s²",.3048,["ft/s2"],{auto:!1}),L("m/s²",1,["m/s2","metre/s2","meter/s2"]),L("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([L("mm²",1e-6,["mm2"]),L("cm²",1e-4,["cm2"]),L("in²",64516e-8,["in2","sqin"],{auto:!1}),L("ft²",.09290304,["ft2","sqft"],{auto:!1}),L("yd²",.83612736,["yd2","sqyd"],{auto:!1}),L("m²",1,["m2","sqm"]),L("ha",1e4,["hectare","hectares"],{auto:!1}),L("ac",4046.8564224,["acre","acres"],{auto:!1}),L("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([L("µL",1e-6,["ul","microlitre","microliter"]),L("mL",.001,["millilitre","milliliter"]),L("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),L("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),L("L",1,["litre","litres","liter","liters"]),L("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),L("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),L("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),L("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([L("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),L("J",1,["joule","joules"]),L("cal",4.184,["calorie","calories"],{auto:!1}),L("kJ",1e3,["kilojoule","kilojoules"]),L("BTU",1055.05585262,["btu"],{auto:!1}),L("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),L("MJ",1e6,["megajoule","megajoules"]),L("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),L("GJ",1e9,["gigajoule","gigajoules"]),L("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([L("mW",.001,["milliwatt","milliwatts"]),L("W",1,["watt","watts"]),L("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),L("kW",1e3,["kilowatt","kilowatts"]),L("hp",745.6998715822702,["horsepower"],{auto:!1}),L("MW",1e6,["megawatt","megawatts"]),L("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([L("mN",.001,["millinewton","millinewtons"]),L("N",1,["newton","newtons"]),L("lbf",4.4482216152605,["poundforce"],{auto:!1}),L("kgf",9.80665,["kilogramforce"],{auto:!1}),L("kN",1e3,["kilonewton","kilonewtons"]),L("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([L("Pa",1,["pascal","pascals"]),L("mbar",100,["millibar"],{auto:!1}),L("inH₂O",249.0889,["inh2o"],{auto:!1}),L("mmHg",133.322387415,["torr"],{auto:!1}),L("kPa",1e3,["kilopascal","kilopascals"]),L("inHg",3386.388640341,["inhg"],{auto:!1}),L("psi",6894.757293168361,["lbf/in2"],{auto:!1}),L("bar",1e5,[],{auto:!1}),L("atm",101325,["atmosphere","atmospheres"],{auto:!1}),L("MPa",1e6,["megapascal","megapascals"]),L("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([L("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),L("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),L("kN·m",1e3,["knm","kn.m"],{auto:!1}),L("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([L("kg/m³",1,["kg/m3"]),L("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),L("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),L("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([L("L/min",1/6e4,["lpm","l/min"],{auto:!1}),L("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),L("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),L("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),L("cfm",.0004719474432,["ft3/min"],{auto:!1}),L("L/s",.001,["lps","l/s"],{auto:!1}),L("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([L("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),L("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),L("mrad",.001,["milliradian","milliradians"],{auto:!1}),L("mil",Math.PI/3200,["nato-mil"],{auto:!1}),L("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),L("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),L("rad",1,["radian","radians"]),L("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([L("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),L("rad/s",1,["radps","radians/s"]),L("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),L("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([L("ppt",1e-12,["partspertrillion"],{auto:!1}),L("ppb",1e-9,["partsperbillion"]),L("ppm",1e-6,["partspermillion"]),L("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),L("‰",.001,["permille","permil"],{auto:!1}),L("%",.01,["pct","percent"]),L("×",1,["x","ratio","times"])]),molarity:Object.freeze([L("pM",1e-12,["picomolar","picomolarity"]),L("nM",1e-9,["nanomolar","nanomolarity"]),L("µM",1e-6,["um-molar","micromolar","micromolarity"]),L("mM",.001,["millimolar","millimolarity"]),L("M",1,["molar","mol/l","mol/L","molarity"]),L("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([L("mg/s",1e-6,["milligrams/s"]),L("g/s",.001,["grams/s"]),L("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),L("kg/s",1,["kilograms/s","kgps"]),L("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),L("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),L("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([L("µPa·s",1e-6,["upas","micropascalsecond"]),L("cP",.001,["centipoise"],{auto:!1}),L("mPa·s",.001,["mpas","millipascalsecond"]),L("P",.1,["poise"],{auto:!1}),L("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([L("cSt",1e-6,["centistokes","centistoke"]),L("mm²/s",1e-6,["mm2/s"],{auto:!1}),L("St",1e-4,["stokes","stoke"],{auto:!1}),L("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([L("mW/(m·K)",.001,["mw/mk"]),L("W/(m·K)",1,["w/mk","wmk"]),L("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),L("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([L("J/(kg·K)",1,["j/kgk","jkgk"]),L("kJ/(kg·K)",1e3,["kj/kgk"]),L("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([L("nSv/h",1e-9,["nsvh"]),L("µSv/h",1e-6,["usv/h","usvh"]),L("mSv/h",.001,["msvh"]),L("Sv/h",1,["svh"]),L("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),$=Symbol("ambiguous"),X=new Map,F=new Map;function j(R,x){const U=String(R||"").trim();if(!U)throw new Error("[lattice] a unit system needs a name");if(H[U]||F.has(U))throw new Error(`[lattice] unit system "${U}" already exists`);const V=[...x||[]];if(!V.length)throw new Error(`[lattice] unit system "${U}" has no units`);if(!V.some(_=>_.factor===1))throw new Error(`[lattice] unit system "${U}" has no base unit (none with factor 1)`);const J=new Set;for(const _ of V){if(J.has(_.symbol))throw new Error(`[lattice] unit system "${U}" declares "${_.symbol}" twice`);J.add(_.symbol)}return F.set(U,Object.freeze(V)),X.delete(U),U}function v(){return[...Object.keys(H),...F.keys()]}function b(R){const x=l(R);return x?x.units:[]}function l(R){const x=String(R||""),U=X.get(x);if(U!==void 0)return U;const V=H[x]||F.get(x);if(!V)return X.set(x,null),null;const J=Object.freeze([...V].sort((ne,ie)=>ne.factor-ie.factor)),_=new Map,ee=new Map,W=(ne,ie)=>{const ce=_.get(ne);ce===void 0?_.set(ne,ie):ce!==ie&&_.set(ne,$)};for(const ne of J){W(ne.symbol.toLowerCase(),ne);for(const ie of ne.aliases)W(ie.toLowerCase(),ne);if(ne.prefix){const ie=ee.get(ne.prefix)||[];ie.push(ne),ee.set(ne.prefix,ie)}}const Z={units:J,byToken:_,byPrefix:ee,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 X.set(x,Z),Z}function g(R,x){return x&&R.binary||R.decimal}function o(R,x){const U=l(R);if(!U||A(x))return null;const V=U.units.find(_=>_.symbol===String(x));if(V)return V;const J=U.byToken.get(String(x).trim().toLowerCase());return J&&J!==$?J:null}const t=new WeakMap;function s(R){const x=R||{};if(typeof x=="object"&&x!==null){const _=t.get(x);if(_!==void 0)return _}const U=x.system||"data",V=l(U);let J=null;if(!V)I(`unit:system:${U}`,`unknown unit system "${U}"; known systems are ${v().join(", ")}`);else{let _=x.unit?o(U,x.unit):null;_||(x.unit&&I(`unit:unit:${U}:${x.unit}`,`unknown unit "${x.unit}" in system "${U}"; falling back to ${V.units[0].symbol}`),_=V.units.find(ee=>ee.factor===1)||V.units[0]),J={index:V,base:_,binary:x.binary===!0}}return typeof x=="object"&&x!==null&&t.set(x,J),J}const r=new WeakMap;function i(R,x){if(!R||!x||!Array.isArray(R.compound)||R.compound.length===0)return null;const U=r.get(R);if(U!==void 0)return U;const V=new Set,J=[];for(const ee of R.compound){const W=o(R.system||"data",ee);if(!W){I(`unit:compound:${R.system}:${ee}`,`unknown compound unit "${ee}" in system "${R.system||"data"}"; ignoring it`);continue}V.has(W.symbol)||(V.add(W.symbol),J.push(W))}J.sort((ee,W)=>W.factor-ee.factor);const _=J.length>=2?J:null;return r.set(R,_),_}function n(R,x,U){return x===U||x.factor===U.factor?R:R*x.factor/U.factor}const m=new Map;function c(R){const x=R||"",U=m.get(x);if(U)return U;const V={group:",",decimal:"."};try{for(const J of new Intl.NumberFormat(R||void 0).formatToParts(12345.6))J.type==="group"?V.group=J.value:J.type==="decimal"&&(V.decimal=J.value)}catch{}return m.set(x,V),V}const a=/[\s ]/g,u=/^[+-]?[\d '’ .,]*(?:[eE][+-]?\d+)?/,h=/^[^\d+\-(.,\s]+\s*/,p=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function y(R,x){const{group:U,decimal:V}=c(x);let J=String(R).replace(a,"");if(J==="")return null;const _=V?J.indexOf(V):-1;if(U&&U!==V){if(_>=0&&J.indexOf(U,_+V.length)>=0)return null;J=J.split(U).join("")}if(V&&V!=="."&&(J=J.split(V).join(".")),!p.test(J))return null;const ee=Number(J);return Number.isFinite(ee)?ee:null}function d(R,x,U){const V=String(R).trim().replace(/\.$/,"");if(V==="")return null;const J=x.units.find(ie=>ie.symbol===V);if(J)return J;const _=V.toLowerCase(),ee=x.byToken.get(_);if(ee===$)return null;if(ee)return ee;const W=x.byPrefix.get(_);if(!W||!W.length)return null;const Z=g(x,U),ne=W.filter(ie=>Z.includes(ie));return ne.length===1?ne[0]:null}function f(R,x,U,V){let J=R,_=0,ee=!1,W=!1;for(;J!=="";){const Z=u.exec(J)[0];if(Z==="")return null;const ne=y(Z,V&&V.locale);if(ne===null)return null;J=J.slice(Z.length).trim();const ie=J.search(/[+-]?[\d]/),ce=(ie>=0?J.slice(0,ie):J).trim();if(J=ie>=0?J.slice(ie).trim():"",ce===""){if(ee)return null;W=!0,_+=n(ne,U[0],x.base)}else{const me=d(ce,x.index,x.binary);if(!me)return null;_+=n(ne,me,x.base)}if(ee=!0,W&&J!=="")return null}return ee?_:null}function w(R,x){if(A(R))return null;if(typeof R=="number")return Number.isFinite(R)?R:null;const U=s(x);if(!U)return null;let V=String(R).trim();if(V==="")return null;let J=!1;V.startsWith("(")&&V.endsWith(")")&&(J=!0,V=V.slice(1,-1).trim());const _=i(x,U);if(_){V.startsWith("-")&&(J=!0,V=V.slice(1).trim());const Ce=f(V,U,_,x);return Ce===null?null:J?-Ce:Ce}let ee=null;const W=h.exec(V);if(W&&W[0]){const Ce=d(W[0].trim(),U.index,U.binary);Ce&&(ee=Ce,V=V.slice(W[0].length).trim())}const Z=u.exec(V)[0],ne=y(Z,x&&x.locale);if(ne===null)return null;const ie=V.slice(Z.length).trim();if(ee&&ie!=="")return null;const ce=ee||(ie===""?U.base:d(ie,U.index,U.binary));if(!ce)return null;const me=n(ne,ce,U.base);return J?-me:me}const k=new Map;function P(R,x,U,V){const J=`${R||""}|${x}|${U}|${V?1:0}`;let _=k.get(J);return _||(_=new Intl.NumberFormat(R||void 0,{minimumFractionDigits:x,maximumFractionDigits:U,useGrouping:V}),k.set(J,_)),_}function G(R,x){if(!Number.isFinite(R)||R===0)return Math.max(0,x-1);const U=Math.floor(Math.log10(Math.abs(R)));return Math.min(20,Math.max(0,x-1-U))}function K(R,x){if(!Number.isFinite(R)||R===0)return R;const U=Math.ceil(Math.log10(Math.abs(R))),V=10**(x-U);return Math.round(R*V)/V}function q(R,x,U){if(!U||U===x.base.symbol)return x.base;if(U!=="auto")return B(x,U);if(R===0||!Number.isFinite(R))return x.base;const V=Math.abs(R)*x.base.factor,J=g(x.index,x.binary);let _=J[0];for(const Z of J)V>=Z.factor&&(_=Z);if(V>=_.factor)return _;let ee=_;for(const Z of x.index.units)Z.binary!==x.binary&&Z.factor!==1||Z.factor<=V&&Z.factor>(ee===_?0:ee.factor)&&(ee=Z);if(ee!==_)return ee;let W=_;for(const Z of x.index.units)Z.binary!==x.binary&&Z.factor!==1||Z.factor<W.factor&&(W=Z);return W.factor<x.base.factor?W:x.base}function B(R,x){const U=R.index.units.find(J=>J.symbol===x);if(U)return U;const V=R.index.byToken.get(String(x).toLowerCase());return V&&V!==$?V:(I(`unit:display:${x}`,`unknown display unit "${x}"; rendering in ${R.base.symbol}`),R.base)}function E(R,x,U,V){const J=R<0;let _=Math.abs(R)*x.base.factor;const ee=typeof V.decimals=="number"?V.decimals:V.minDecimals??0,W=typeof V.decimals=="number"?V.decimals:V.maxDecimals??Math.max(ee,2),Z=V.space??" ",ne=[];for(let ce=0;ce<U.length;ce++){const me=U[ce],Ce=ce===U.length-1;let Pe=Ce?_/me.factor:Math.floor(_/me.factor);if(_-=Pe*me.factor,Ce){const _e=10**W;Pe=Math.round(Pe*_e)/_e+0}const xe=Ce?P(V.locale,ee,W,V.group!==!1):P(V.locale,0,0,V.group!==!1);ne.push(`${xe.format(Pe)}${Z}${me.symbol}`)}const ie=ne.join(" ");return J?`-${ie}`:ie}function S(R,x){const U=x||{},V=U.nullDisplay??"";if(A(R)||R==="")return V;const J=typeof R=="number"?R:Number(R);if(!Number.isFinite(J))return V;const _=s(U);if(!_)return String(J);const ee=i(U,_);if(ee)return E(J,_,ee,U);const W=typeof U.significantFigures=="number"&&U.significantFigures>0?U.significantFigures:0,Z=W?K(J,W):J,ne=q(Z,_,U.display),ie=n(Z,_.base,ne);let ce=typeof U.decimals=="number"?U.decimals:U.minDecimals??0,me=typeof U.decimals=="number"?U.decimals:U.maxDecimals??Math.max(ce,2);W&&(ce=G(ie,W),me=ce);const Ce=P(U.locale,ce,me,U.group!==!1).format(ie),Pe=U.space??" ";return U.placement==="prefix"?`${ne.symbol}${U.space??""}${Ce}`:`${Ce}${Pe}${ne.symbol}`}function C(R,x){const U=A(R)||Number.isNaN(R)?null:Number(R),V=A(x)||Number.isNaN(x)?null:Number(x);return U===null||Number.isNaN(U)?V===null||Number.isNaN(V)?0:1:V===null||Number.isNaN(V)||U<V?-1:U>V?1:0}function N(R){const x=typeof R.decimals=="number"&&R.decimals>0?`.${"0".repeat(R.decimals)}`:"";return`${typeof R.decimals=="number"?`#,##0${x}`:"#,##0.##"}" ${R.symbol}"`}function O(R){const x={system:"data",...R||{}},U=s(x),V=U?U.base.symbol:String(x.unit||""),J=Object.freeze({...x,unit:V}),_=Object.freeze({...J,display:V,decimals:void 0,minDecimals:0,maxDecimals:20,group:!1}),ee=new Map([[J.locale||"",J]]),W=Z=>{const ne=Z||"";let ie=ee.get(ne);return ie||(ie=Object.freeze({...J,locale:Z||void 0}),ee.set(ne,ie)),ie};return{base:"number",extends:"number",storage:"float64",unitConfig:J,format:Z=>S(Z.value,Z.locale?W(Z.locale):J),parse:Z=>w(Z.text,Z.locale?W(Z.locale):J),compare:C,defaults:{filter:"number",editor:"unit",align:"end",total:x.total||"sum"},...x.totals?{totals:x.totals}:{},excel:x.excel||N({decimals:x.decimals,symbol:V}),toStorage:Z=>typeof Z=="number"?Number.isFinite(Z)?Z:null:typeof Z=="string"?w(Z,J):A(Z)?null:w(String(Z),J),toClipboard:Z=>S(Z,_),fromClipboard:Z=>w(Z,J)}}const T=O}),Ve("packages/core/src/columns/types/engineering.js",function(e,D){"use strict";Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return L}});const A=D("packages/core/src/internal/predicates.js").isNil,I=D("packages/core/src/columns/types/unit.js").createUnitType;function L($){const X=2*Math.PI/$;return F=>{let j=0,v=0,b=0;for(const g of F||[]){if(A(g))continue;const o=Number(g);Number.isFinite(o)&&(j+=Math.cos(o*X),v+=Math.sin(o*X),b+=1)}return!b||Math.hypot(j,v)/b<1e-12?null:(Math.atan2(v,j)/X%$+$)%$}}function Q($){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:L($)}}}const H=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})})}),Ve("packages/core/src/columns/types/si.js",function(e,D){"use strict";Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return j}});const re=D("packages/core/src/columns/types/unit.js"),A=re.defineUnit,Y=re.registerUnitSystem,I=re.createUnitType,L=Object.freeze([Object.freeze({symbol:"f",name:"femto",factor:1e-15}),Object.freeze({symbol:"p",name:"pico",factor:1e-12}),Object.freeze({symbol:"n",name:"nano",factor:1e-9}),Object.freeze({symbol:"µ",name:"micro",factor:1e-6}),Object.freeze({symbol:"m",name:"milli",factor:.001}),Object.freeze({symbol:"c",name:"centi",factor:.01}),Object.freeze({symbol:"",name:"",factor:1}),Object.freeze({symbol:"k",name:"kilo",factor:1e3}),Object.freeze({symbol:"M",name:"mega",factor:1e6}),Object.freeze({symbol:"G",name:"giga",factor:1e9}),Object.freeze({symbol:"T",name:"tera",factor:1e12}),Object.freeze({symbol:"P",name:"peta",factor:1e15})]),Q=Object.freeze(["p","n","µ","m","","k","M","G"]);function H(v){const b=String(v.base),l=new Set([...v.prefixes||Q,""]),g=[];for(const o of L){if(!l.has(o.symbol))continue;const t=`${o.symbol}${b}`,s=[];if(v.name){s.push(`${o.name}${v.name}`,`${o.name}${v.name}s`);const r=o.name.slice(-1);if(r&&v.name.startsWith(r)){const i=`${o.name.slice(0,-1)}${v.name}`;s.push(i,`${i}s`)}}o.symbol==="µ"&&s.push(`u${b}`),o.factor===1&&v.aliases&&s.push(...v.aliases),g.push(A(t,o.factor,s))}for(const o of v.extra||[])g.push(o);return g}function $(v,b){const l=H(b);return Y(v,l)}function X(v,b,l){return $(v,b),I({system:v,unit:b.base,display:"auto",maxDecimals:3,...l||{}})}const F=Object.freeze({voltage:X("voltage",{base:"V",name:"volt"}),current:X("current",{base:"A",name:"amp",aliases:["ampere","amperes"]}),resistance:X("resistance",{base:"Ω",name:"ohm",aliases:["ohm","ohms","R"],prefixes:["m","","k","M","G"]}),capacitance:X("capacitance",{base:"F",name:"farad",prefixes:["f","p","n","µ","m",""]}),inductance:X("inductance",{base:"H",name:"henry",prefixes:["p","n","µ","m",""]}),charge:X("charge",{base:"C",name:"coulomb",prefixes:["p","n","µ","m",""],extra:[A("mAh",3.6,["milliamphour","milliamphours"],{auto:!1}),A("Ah",3600,["amphour","amphours"],{auto:!1})]}),conductance:X("conductance",{base:"S",name:"siemens",prefixes:["n","µ","m","","k"]}),fluxDensity:X("fluxDensity",{base:"T",name:"tesla",prefixes:["n","µ","m",""],extra:[A("G",1e-4,["gauss"],{auto:!1})]}),luminousFlux:X("luminousFlux",{base:"lm",name:"lumen",prefixes:["m","","k"]}),illuminance:X("illuminance",{base:"lx",name:"lux",prefixes:["m","","k"]}),luminousIntensity:X("luminousIntensity",{base:"cd",name:"candela",prefixes:["m","","k"]}),substance:X("substance",{base:"mol",name:"mole",prefixes:["n","µ","m","","k"]}),absorbedDose:X("absorbedDose",{base:"Gy",name:"gray",prefixes:["µ","m",""]}),equivalentDose:X("equivalentDose",{base:"Sv",name:"sievert",prefixes:["n","µ","m",""]}),radioactivity:X("radioactivity",{base:"Bq",name:"becquerel",prefixes:["","k","M","G","T"],extra:[A("Ci",37e9,["curie","curies"],{auto:!1})]}),frequency:X("frequency",{base:"Hz",name:"hertz",prefixes:["m","","k","M","G","T"]})}),j=X}),Ve("packages/core/src/columns/types/temperature.js",function(e,D){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});const A=D("packages/core/src/internal/predicates.js").isNil,Y=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(A(g))return null;const o=String(g).trim();if(o==="")return null;for(const[s,r]of Object.entries(Y))if(o===s||o===r.symbol)return{key:s,scale:r};const t=o.toLowerCase();for(const[s,r]of Object.entries(Y))if(r.aliases.includes(t))return{key:s,scale:r};return null}function L(g,o,t){const s=I(o),r=I(t);return!s||!r||!Number.isFinite(Number(g))?null:s.key===r.key?Number(g):r.scale.fromKelvin(s.scale.toKelvin(Number(g)))}const Q=new Map;function H(g,o,t){const s=`${g||""}|${o}|${t}`;let r=Q.get(s);return r||(r=new Intl.NumberFormat(g||void 0,{minimumFractionDigits:o,maximumFractionDigits:t}),Q.set(s,r)),r}function $(g,o){const t=o||{},s=t.nullDisplay??"";if(A(g)||g==="")return s;const r=Number(g);if(!Number.isFinite(r))return s;const i=I(t.scale||"C");if(!i)return String(r);const n=I(t.display||t.scale||"C")||i,m=n.key===i.key?r:n.scale.fromKelvin(i.scale.toKelvin(r)),c=typeof t.decimals=="number"?t.decimals:null,a=c??t.minDecimals??0,u=c??t.maxDecimals??1;return`${H(t.locale,a,u).format(m)}${t.space??" "}${n.scale.symbol}`}const X=/^[+-]?[\d\s., ]*\d/;function F(g,o){const t=String(g).trim();if(t==="")return null;const s=new Intl.NumberFormat(o||void 0).formatToParts(1.1).find(m=>m.type==="decimal")?.value||".",r=s===","?".":",",i=t.split(r).join("").split(/[\s ]/).join("").replace(s,"."),n=Number(i);return Number.isFinite(n)?n:null}function j(g,o){if(A(g))return null;const t=o||{},s=I(t.scale||"C");if(!s)return null;if(typeof g=="number")return Number.isFinite(g)?g:null;let r=String(g).trim();if(r==="")return null;let i=!1;r.startsWith("(")&&r.endsWith(")")&&(i=!0,r=r.slice(1,-1).trim());const n=X.exec(r);if(!n)return null;const m=F(n[0],t.locale);if(m===null)return null;const c=r.slice(n[0].length).trim();if(c==="")return i?-m:m;const a=I(c);if(!a)return null;const u=a.key===s.key?m:s.scale.fromKelvin(a.scale.toKelvin(m));return i?-u:u}function v(g){const o=Object.freeze({scale:"C",...g||{}}),s=(I(o.scale)||I("C")).scale.symbol,r=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 a=i.get(c);return a||(a=Object.freeze({...o,locale:m||void 0}),i.set(c,a)),a};return{base:"number",extends:"number",storage:"float64",temperatureConfig:o,format:m=>$(m.value,m.locale?n(m.locale):o),parse:m=>j(m.text,m.locale?n(m.locale):o),defaults:{filter:"number",editor:"temperature",align:"end",total:"avg"},totals:{supported:["avg","min","max","count","countValues"]},excel:o.excel||`#,##0${typeof o.decimals=="number"&&o.decimals>0?`.${"0".repeat(o.decimals)}`:".#"}" ${s}"`,toStorage:m=>typeof m=="number"?Number.isFinite(m)?m:null:typeof m=="string"?j(m,o):A(m)?null:j(String(m),o),toClipboard:m=>$(m,r),fromClipboard:m=>j(m,o)}}const b=Object.freeze({celsius:v({scale:"C"}),fahrenheit:v({scale:"F"}),kelvin:v({scale:"K"})}),l=v}),Ve("packages/core/src/columns/types/radix.js",function(e,D){"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 a}}),Object.defineProperty(e,"normaliseRadixOptions",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"compileRadixFormat",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"compileRadixParse",{enumerable:!0,get:function(){return k}}),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 B}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return E}});const A=D("packages/core/src/internal/predicates.js").isNil,I=D("packages/core/src/internal/warn.js").warnOnce,L=Object.freeze({2:2,8:8,16:16,bin:2,binary:2,base2:2,oct:8,octal:8,base8:8,hex:16,hexadecimal:16,base16:16}),Q=Object.freeze({2:1,8:3,16:4}),H=Object.freeze({2:"0b",8:"0o",16:"0x"}),$=Object.freeze({2:4,8:3,16:2}),X=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),F=Object.freeze({2:"binary",8:"octal",16:"hexadecimal"}),j=Object.freeze([[/^0x/i,16],[/^0b/i,2],[/^0o/i,8],[/^#/,16]]),v=/[\s\u00a0\u202f_,']/g,b=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,l=Object.freeze([8,16,32,53]),g=new WeakSet,o=new WeakMap,t=new Map,s=new WeakMap,r=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(S){if(S==null)return 16;const C=typeof S=="string"?S.toLowerCase():S,N=L[C];return N||(I(`radix:base:${String(S)}`,`unsupported radix ${String(S)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function m(S,C){return Math.ceil(S/Q[C])}function c(S,C){if(!S)return C?{min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}:{min:0,max:Number.MAX_SAFE_INTEGER};if(!C)return{min:0,max:2**S-1};const N=2**(S-1);return{min:-N,max:N-1}}function a(S){return F[S]||"hexadecimal"}function u(S){if(typeof S=="string"){const C=i[S];return C||I(`radix:preset:${S}`,`unknown radix preset "${S}"; known presets are ${Object.keys(i).join(", ")}`),{...C||{}}}if(S&&typeof S.preset=="string"){const C=i[S.preset];return C||I(`radix:preset:${S.preset}`,`unknown radix preset "${S.preset}"; known presets are ${Object.keys(i).join(", ")}`),{...C||{},...S}}return S||{}}function h(S){const C=u(S),N=n(C.radix),O=Q[N];let T=null;if(C.bitWidth!==void 0&&C.bitWidth!==null&&C.bitWidth!==!1){const Z=Number(C.bitWidth);l.includes(Z)?T=Z:I(`radix:width:${String(C.bitWidth)}`,`unsupported bitWidth ${String(C.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let R=C.signed!==!1;!R&&T===null&&(I("radix:unsigned:width","signed: false needs a bitWidth to render a two's-complement pattern; defaulting to 32"),T=32);const x=C.prefix===void 0||C.prefix===!0?H[N]:C.prefix===!1?"":String(C.prefix);let U=0;C.pad===!0?U=T?m(T,N):0:typeof C.pad=="number"&&C.pad>0&&(U=Math.floor(C.pad));let V=0;C.group===!0?V=$[N]:typeof C.group=="number"&&C.group>0&&(V=Math.floor(C.group));const J=c(T,R),_=typeof C.min=="number"?Math.max(J.min,C.min):J.min,ee=typeof C.max=="number"?Math.min(J.max,C.max):J.max,W=Object.freeze({radix:N,bits:O,prefix:x,uppercase:C.uppercase!==!1,pad:U,group:V,groupSeparator:typeof C.groupSeparator=="string"?C.groupSeparator:" ",bitWidth:T,signed:R,min:_,max:ee<_?_:ee,nullDisplay:typeof C.nullDisplay=="string"?C.nullDisplay:"",name:a(N)});return g.add(W),W}function p(S){if(S&&g.has(S))return S;if(typeof S=="string"){let C=t.get(S);return C||(C=h(S),t.set(S,C)),C}if(S&&typeof S=="object"){let C=o.get(S);return C||(C=h(S),o.set(S,C)),C}return p("hex")}function y(S){return S<0?-Math.round(-S):Math.round(S)}function d(S,C,N){if(C<=0||S.length<=C)return S;const O=S.length%C||C,T=[S.slice(0,O)];for(let R=O;R<S.length;R+=C)T.push(S.slice(R,R+C));return T.join(N)}function f(S){const C=p(S),{radix:N,prefix:O,uppercase:T,pad:R,group:x,groupSeparator:U,signed:V,bitWidth:J,nullDisplay:_}=C,ee=J?2**J:0,W=Z=>{if(A(Z)||Z==="")return _;const ne=typeof Z=="number"?Z:Number(Z);if(!Number.isFinite(ne))return _;const ie=y(ne);let ce="",me=ie;ie<0&&(V?(ce="-",me=-ie):me=(ie%ee+ee)%ee);let Ce=me.toString(N);return Ce=T?Ce.toUpperCase():Ce.toLowerCase(),R>0&&Ce.length<R&&(Ce=Ce.padStart(R,"0")),x>0&&(Ce=d(Ce,x,U)),ce+O+Ce};return W.options=C,W}function w(S,C){const N=p(C);let O=s.get(N);return O||(O=f(N),s.set(N,O)),O(S)}function k(S){const C=p(S),{radix:N,groupSeparator:O,signed:T,min:R,max:x}=C,U=X[N],V=J=>{if(A(J))return{ok:!0,value:null,reason:"blank"};let _=String(J);if(O&&O!==""&&(_=_.split(O).join("")),_=_.replace(v,""),_==="")return{ok:!0,value:null,reason:"blank"};let ee=!1;if((_[0]==="-"||_[0]==="+")&&(ee=_[0]==="-",_=_.slice(1)),_==="")return{ok:!1,value:null,reason:"digits"};let W=null;for(const[ne,ie]of j){const ce=ne.exec(_);if(!ce)continue;const me=_.slice(ce[0].length);if(me==="")break;if(!X[ie].test(me))return{ok:!1,value:null,reason:"digits"};W=parseInt(me,ie);break}if(W===null)if(U.test(_))W=parseInt(_,N);else if(b.test(_))W=Number(_);else return{ok:!1,value:null,reason:"digits"};if(!Number.isFinite(W))return{ok:!1,value:null,reason:"digits"};const Z=y(ee?-W:W);return!T&&Z<0?{ok:!1,value:Z,reason:"negative"}:Z<R||Z>x?{ok:!1,value:Z,reason:"range"}:{ok:!0,value:Z,reason:"ok"}};return V.options=C,V}function P(S,C){const N=p(C);let O=r.get(N);return O||(O=k(N),r.set(N,O)),O(S)}function G(S,C){const N=P(S,C);return N.ok?N.value:null}function K(S,C){const N=A(S)||Number.isNaN(S)?null:Number(S),O=A(C)||Number.isNaN(C)?null:Number(C);return N===null?O===null?0:1:O===null||N<O?-1:N>O?1:0}function q(S){const C=S.min>=-2147483648&&S.max<=2147483647;return S.bitWidth&&C?"int32":"float64"}function B(S){const C=h(S),N=f(C),O=k(C);return{base:"number",extends:"number",storage:q(C),matches:null,format:T=>N(T.value),parse:T=>{const R=O(T.text);return R.ok?R.value:null},compare:K,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:T=>N(T),fromClipboard:T=>{const R=O(T);return R.ok?R.value:null},radix:C,formatValue:N,parseText:O}}const E=B}),Ve("packages/core/src/columns/types/aggregable.js",function(e,D){"use strict";Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"weightedMean",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"logarithmicSum",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"logarithmicMean",{enumerable:!0,get:function(){return L}});const A=D("packages/core/src/internal/predicates.js").isNil;function Y(F){const j=[];for(const v of F||[]){if(A(v))continue;const b=Number(v);Number.isFinite(b)&&j.push(b)}return j}function I(F){return j=>{const v=Y(j);if(!v.length)return null;let b=0;for(const l of v)b+=10**(l/F);return F*Math.log10(b)}}function L(F){return j=>{const v=Y(j);if(!v.length)return null;let b=0;for(const l of v)b+=10**(l/F);return F*Math.log10(b/v.length)}}function Q(F,j){const v=j&&j.column,l=(v&&v.typeOptions||{}).weight,g=j&&j.valueAt;if(!l||typeof g!="function")return null;let o=0,t=0;for(let s=0;s<F.length;s++){if(A(F[s]))continue;const r=Number(F[s]);if(!Number.isFinite(r))continue;const i=g(l,s);if(A(i))continue;const n=Number(i);!Number.isFinite(n)||n<=0||(o+=r*n,t+=n)}return t===0?null:o/t}function H(F={}){const j=F.factor===20?20:10,v=typeof F.suffix=="string"?F.suffix:"",b=Number.isInteger(F.decimals)?F.decimals:1;return{base:"number",storage:"float64",name:F.name||"logarithmic",format:l=>{const g=l&&l.value;return A(g)||!Number.isFinite(Number(g))?"":`${Number(g).toFixed(b)}${v}`},parse:l=>{const g=String((l&&l.text)??"").replace(v,"").trim();if(!g)return null;const o=Number(g);return Number.isFinite(o)?o:null},defaults:{align:"end",filter:"number"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:{sum:I(j),avg:L(j)}}}}function $(F={}){const j=Number.isInteger(F.decimals)?F.decimals:1,v=F.percent===!0;return{base:"number",storage:"float64",name:F.name||"ratio",format:b=>{const l=b&&b.value;return A(l)||!Number.isFinite(Number(l))?"":v?`${Number(l).toFixed(j)}%`:Number(l).toFixed(j)},parse:b=>{const l=String((b&&b.text)??"").replace("%","").trim();if(!l)return null;const g=Number(l);return Number.isFinite(g)?g:null},defaults:{align:"end",filter:"number"},totals:{supported:["avg","min","max","count","countValues"],implement:{avg:Q}}}}const X=Object.freeze({decibel:H({name:"decibel",factor:10,suffix:" dB"}),decibelAmplitude:H({name:"decibelAmplitude",factor:20,suffix:" dB"}),ratio:$({name:"ratio"}),percentRate:$({name:"percentRate",percent:!0})})}),Ve("packages/core/src/columns/types/currency.js",function(e,D){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return v}}),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 r}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});const A=D("packages/core/src/internal/predicates.js").isNil,Y="⚠ no rate";function I(m){if(A(m))return null;const c=String(m).trim().toUpperCase();return c===""?null:c}function L(m){if(A(m))return null;if(typeof m=="object"&&!Array.isArray(m)){const c=Number(m.amount),a=I(m.code);return!a||!Number.isFinite(c)?null:{amount:c,code:a}}if(Array.isArray(m)&&m.length===2){const c=Number(m[0]),a=I(m[1]);return!a||!Number.isFinite(c)?null:{amount:c,code:a}}return null}const Q=Object.freeze({$:"USD","€":"EUR","£":"GBP","¥":"JPY","₹":"INR","₩":"KRW","₽":"RUB","₺":"TRY","₴":"UAH","₪":"ILS"}),H=Object.freeze({USD:"$",EUR:"€",GBP:"£",JPY:"¥",INR:"₹",KRW:"₩",RUB:"₽",TRY:"₺",UAH:"₴",ILS:"₪"}),$=/[+-]?[\d\s., ]*\d/;function X(m,c){const a=String(m).trim();if(a==="")return null;const u=new Intl.NumberFormat(c||void 0).formatToParts(1.1).find(d=>d.type==="decimal")?.value||".",h=u===","?".":",",p=a.split(h).join("").split(/[\s ]/).join("").replace(u,"."),y=Number(p);return Number.isFinite(y)?y:null}function F(m,c){const a=c||{},u=I(a.code);if(A(m))return null;const h=L(m);if(h)return h;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 d=null;for(const[K,q]of Object.entries(Q)){if(p.startsWith(K)){d=q,p=p.slice(K.length).trim();break}if(p.endsWith(K)){d=q,p=p.slice(0,-K.length).trim();break}}const f=$.exec(p);if(!f)return null;const w=X(f[0],a.locale);if(w===null)return null;const k=(p.slice(0,f.index)+" "+p.slice(f.index+f[0].length)).trim();!d&&k!==""&&(d=I(k));const P=d||u;return P?{amount:y?-w:w,code:P}:null}function j(m,c){if(typeof m=="function")return(a,u)=>{if(a===u)return 1;const h=m(a,u);return typeof h=="number"&&Number.isFinite(h)&&h>0?h:null};if(m&&typeof m=="object"){const a=m;return(u,h)=>{if(u===h)return 1;const p=Number(a[u]),y=Number(a[h]);return!Number.isFinite(p)||!Number.isFinite(y)||p<=0||y<=0?null:y/p}}return(a,u)=>a===u?1:null}function v(m,c,a){if(!m)return null;if(m.code===c)return m.amount;const u=a(m.code,c);return u===null?null:m.amount*u}const b=new Map;function l(m,c,a){const u=`${m||""}|${c}|${a??""}`;let h=b.get(u);if(!h){const p={style:"currency",currency:c};typeof a=="number"&&(p.minimumFractionDigits=a,p.maximumFractionDigits=a);try{h={fmt:new Intl.NumberFormat(m||void 0,p),currency:!0}}catch{h={fmt:new Intl.NumberFormat(m||void 0,typeof a=="number"?{minimumFractionDigits:a,maximumFractionDigits:a}:{}),currency:!1}}b.set(u,h)}return h}function g(m,c){const a=c||{},u=a.nullDisplay??"",h=L(m);if(!h)return u;const p=I(a.display)||h.code;let y=h.amount,d=h.code;if(p!==h.code){const k=a.rateFn||j(a.rates,a.rateBase),P=v(h,p,k);if(P===null)return`${a.missingRate??Y} ${h.code}→${p}`;y=P,d=p}const{fmt:f,currency:w}=l(a.locale,d,a.decimals);return w?f.format(y):`${f.format(y)} ${d}`}function o(m){const c=L(m);return c?`${c.amount} ${c.code}`:""}function t(m){const c=m||{},a=I(c.display),u=c.rateFn||j(c.rates,c.rateBase);return(h,p)=>{const y=L(h),d=L(p);if(!y&&!d)return 0;if(!y)return 1;if(!d)return-1;if(a){const f=v(y,a,u),w=v(d,a,u);if(f!==null&&w!==null)return f===w?0:f<w?-1:1}return y.code===d.code?y.amount===d.amount?0:y.amount<d.amount?-1:1:y.code<d.code?-1:1}}function s(m){const c=m||{},a=(h,p)=>{const y=[];for(const P of h||[]){const G=L(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 f=I(c.display);if(!f)return`${c.missingRate??Y}: mixed currencies, no display currency set`;const w=c.rateFn||j(c.rates,c.rateBase),k=[];for(const P of y){const G=v(P,f,w);if(G===null)return`${c.missingRate??Y}: ${P.code}→${f}`;k.push(G)}return{amount:p(k),code:f}},u=h=>h.reduce((p,y)=>p+y,0);return{sum:h=>a(h,u),avg:h=>a(h,p=>u(p)/p.length),min:h=>a(h,p=>Math.min(...p)),max:h=>a(h,p=>Math.max(...p))}}function r(m){const c=Object.freeze({code:"USD",...m||{}}),a=j(c.rates,c.rateBase),u=Object.freeze({...c,rateFn:a}),h=s(u),p=t(u),y=new Map([[c.locale||"",u]]),d=k=>{const P=k||"";let G=y.get(P);return G||(G=Object.freeze({...u,locale:k||void 0}),y.set(P,G)),G},f=H[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:k=>g(k.value,k.locale?d(k.locale):u),parse:k=>F(k.text,k.locale?d(k.locale):u),compare:p,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:h},excel:c.excel||(f?`"${f}"#,##0${w}`:`#,##0${w}`),toStorage:k=>{const P=L(k);return P||(typeof k=="string"||typeof k=="number"?F(k,u):null)},toClipboard:k=>o(k),fromClipboard:k=>F(k,u)}}const i=Object.freeze({currency:r({code:"USD"}),usd:r({code:"USD"}),eur:r({code:"EUR"}),gbp:r({code:"GBP"}),jpy:r({code:"JPY",decimals:0})}),n=r}),Ve("packages/core/src/columns/types/index.js",function(e,D){"use strict";Object.defineProperty(e,"EXTENDED_TYPES",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return l}}),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 a}}),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 K}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return B}});const re=D("packages/core/src/columns/types/temporal.js"),A=re.TEMPORAL_TYPES,Y=D("packages/core/src/columns/types/network.js"),I=Y.NETWORK_TYPES,L=D("packages/core/src/columns/types/vlan.js"),Q=L.VLAN_TYPES,H=D("packages/core/src/columns/types/structured.js"),$=H.STRUCTURED_TYPES,X=D("packages/core/src/columns/types/unit.js"),F=X.createUnitType,j=X.UNIT_SYSTEMS,v=X.parseUnit,b=X.formatUnit,l=X.registerUnitSystem,g=X.unitSystemNames,o=X.unitsOf,t=X.defineUnit,s=D("packages/core/src/columns/types/engineering.js"),r=s.ENGINEERING_TYPES,i=D("packages/core/src/columns/types/si.js"),n=i.SI_TYPES,m=i.createSiType,c=i.createSiSystem,a=i.siUnits,u=i.SI_PREFIXES,h=D("packages/core/src/columns/types/temperature.js"),p=h.TEMPERATURE_TYPES,y=h.createTemperatureType,d=h.convertTemperature,f=h.formatTemperature,w=h.parseTemperature,k=h.TEMPERATURE_SCALES,P=D("packages/core/src/columns/types/radix.js"),G=P.createRadixType,K=P.RADIX_PRESETS,q=P.parseRadix,B=P.formatRadix,E=D("packages/core/src/columns/types/aggregable.js"),S=E.AGGREGABLE_TYPES,C=D("packages/core/src/columns/types/currency.js"),N=C.CURRENCY_TYPES,O=C.createCurrencyType,T=C.parseMoney,R=C.formatMoney,x=C.convertMoney,U=C.toMoney,V=C.rateFunction,J=C.moneyComparator,_=C.normaliseCode,ee=C.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return X.findUnit}}),Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return s.ENGINEERING_TYPES}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return s.circularMean}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return h.TEMPERATURE_TYPES}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return h.createTemperatureType}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return h.convertTemperature}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return h.formatTemperature}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return h.parseTemperature}}),Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return h.TEMPERATURE_SCALES}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return h.findScale}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return C.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return C.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return C.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return C.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return C.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return C.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return C.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return C.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return C.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return C.MISSING_RATE}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return re.TEMPORAL_TYPES}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return Y.NETWORK_TYPES}}),Object.defineProperty(e,"VLAN_TYPES",{enumerable:!0,get:function(){return L.VLAN_TYPES}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return H.STRUCTURED_TYPES}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return E.AGGREGABLE_TYPES}}),Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return E.createLogarithmicType}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return E.createRatioType}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return re.parseTime}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return re.formatTime}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return re.parseDateTime}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return re.formatDateTime}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return re.parseDuration}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return re.formatDuration}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return Y.parseIpv4}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return Y.formatIpv4}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return Y.parseCidr}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return Y.formatCidr}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return Y.parseIpv6}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return Y.formatIpv6}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return Y.networkAddress}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return Y.broadcastAddress}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return Y.hostCount}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return Y.containsAddress}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return Y.overlaps}}),Object.defineProperty(e,"parseMac",{enumerable:!0,get:function(){return Y.parseMac}}),Object.defineProperty(e,"formatMac",{enumerable:!0,get:function(){return Y.formatMac}}),Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return Y.isMac}}),Object.defineProperty(e,"compareMac",{enumerable:!0,get:function(){return Y.compareMac}}),Object.defineProperty(e,"macValue",{enumerable:!0,get:function(){return Y.macValue}}),Object.defineProperty(e,"macHex",{enumerable:!0,get:function(){return Y.macHex}}),Object.defineProperty(e,"macContains",{enumerable:!0,get:function(){return Y.macContains}}),Object.defineProperty(e,"MAC_OPERATORS",{enumerable:!0,get:function(){return Y.MAC_OPERATORS}}),Object.defineProperty(e,"parseVlans",{enumerable:!0,get:function(){return L.parseVlans}}),Object.defineProperty(e,"formatVlans",{enumerable:!0,get:function(){return L.formatVlans}}),Object.defineProperty(e,"vlanContains",{enumerable:!0,get:function(){return L.vlanContains}}),Object.defineProperty(e,"vlanOverlaps",{enumerable:!0,get:function(){return L.vlanOverlaps}}),Object.defineProperty(e,"vlanCount",{enumerable:!0,get:function(){return L.vlanCount}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return H.maskValue}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return H.summariseJson}});const W=Object.freeze({...A,...I,...Q,...$,...S,hex:G(K.hex),hex8:G(K.hex8),hex16:G(K.hex16),hex32:G(K.hex32),binary:G(K.binary),binary8:G(K.binary8),octal:G(K.octal),bytes:F({system:"data",unit:"B",display:"auto"}),megabytes:F({system:"data",unit:"MB"}),gigabytes:F({system:"data",unit:"GB"}),bitrate:F({system:"bitrate",unit:"Mbps"}),gigabits:F({system:"bitrate",unit:"Gbps"}),...r,...n,...p,...N});{const Z=new Set;for(const ne of[A,I,Q,$,S,r,n,p,N])for(const ie of Object.keys(ne)){if(Z.has(ie))throw new Error(`[lattice] data type "${ie}" is declared twice`);Z.add(ie)}}}),Ve("packages/core/src/compute/handle.js",function(e,D){"use strict";Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return r}});const re=D("packages/core/src/internal/compare.js"),A=re.collator,Y=re.defaultCompare,L=D("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 H(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:(L(`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 $=new WeakMap;function X(i){const n=i.constructor;if(!n)return"unknown";const m=$.get(n);if(m)return m;let c="unknown";try{let a=null;typeof n.from=="function"?a=n.from([!1,!0]):(a=new n(8),a.set(1));const u=a&&a.words;u&&u.length&&(u[0]===2?c="lsb":u[0]===64&&(c="msb"))}catch{c="unknown"}return $.set(n,c),c}function F(i){if(!i)return()=>0;const n=i instanceof Uint8Array?i:i.words;if(n instanceof Uint8Array){const m=i instanceof Uint8Array?"lsb":X(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 j(i){return!i||!i.presence?null:F(i.presence)}function v(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 l(i,n){const m=i.offsets,c=i.values;if(!m||!c)return[];const a=m[n],u=m[n+1];if(!(u>a))return[];const h=i.dict,p=new Array(u-a);for(let y=a;y<u;y++)p[y-a]=h?b(h,c[y]):c[y];return p}function g(i){if(!i)return()=>{};const n=i.values,m=j(i),c=i.kind;if(c==="dictionary"){const a=i.dict;return m?u=>m(u)?b(a,n[u]):null:u=>b(a,n[u])}if(c==="bitset"){const a=F(n);return m?u=>m(u)?a(u)===1:null:u=>a(u)===1}if(c==="multi")return m?a=>m(a)?l(i,a):null:a=>l(i,a);if(!n&&typeof i.get=="function"){const a=i.get.bind(i);return u=>{const h=a(u);return h===void 0?null:h}}return m?a=>{if(!m(a))return null;const u=n[a];return u===void 0?null:u}:a=>{const u=n[a];return u===void 0?null:u}}function o(i,n){if(i<n)return-1;if(i>n)return 1;if(i===n){const a=Object.is(i,-0),u=Object.is(n,-0);return a===u?0:a?-1:1}const m=Number.isNaN(i),c=Number.isNaN(n);return m&&c?0:m?1:-1}function t(i){const n=A(i);return(m,c)=>{if(m===c)return 0;const a=typeof m,u=typeof c;if(a==="string"&&u==="string")return n.compare(m,c);if(a==="number"&&u==="number")return o(m,c);if(a==="boolean"&&u==="boolean")return m===c?0:m?1:-1;if(m instanceof Date||c instanceof Date){const h=m instanceof Date?m.getTime():Number(m),p=c instanceof Date?c.getTime():Number(c);return o(h,p)}return Y(m,c)}}function s(i,n){if(i&&typeof i.ranks=="function")return i.ranks(n);const m=i&&typeof i.values=="function"?i.values():[],c=m.length,a=t(n),u=new Array(c);for(let p=0;p<c;p++)u[p]=p;u.sort((p,y)=>a(m[p],m[y])||p-y);const h=new Uint32Array(c);for(let p=0;p<c;p++)h[u[p]]=p;return h}function r(i){return i==null||typeof i=="number"&&Number.isNaN(i)}}),Ve("packages/core/src/compute/filter.js",function(e,D){"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 q}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(e,"declaredOperatorFor",{enumerable:!0,get:function(){return ve}});const A=D("packages/core/src/internal/predicates.js").isBlank,I=D("packages/core/src/internal/merge.js").toArray,Q=D("packages/core/src/internal/warn.js").warnOnce,H=D("packages/core/src/format/date.js"),$=H.toDate,X=H.toIsoDate,F=D("packages/core/src/compute/handle.js"),j=F.bitReader,v=F.dictSize,b=F.dictValue,l=F.presenceReader,g=F.valueComparator,o=F.valueReader,t=/^\d{4}-\d{2}-\d{2}$/,s="\0null\0";function r(oe,he){const ae=oe&&oe.pool;if(ae){const se=ae.mask||ae.acquireMask||ae.acquire||ae.take;if(typeof se=="function"){const de=se.call(ae,he);if(de&&de.length>=he)return de}}return new Uint8Array(he)}function i(oe,he){const ae=oe&&oe.pool;if(!ae||!he)return;const se=ae.release||ae.releaseMask||ae.free||ae.recycle;typeof se=="function"&&se.call(ae,he)}function n(oe,he,ae){return oe.fill(ae,0,he),oe}function m(oe){return oe==null||typeof oe=="number"&&Number.isNaN(oe)}function c(oe,he){if(oe==null)return oe;if(he==="number")return typeof oe=="number"?oe:Number(oe);if(he==="date"||he==="dateString"){const ae=X(oe);return ae===null?a(oe):ae}return he==="boolean"?typeof oe=="boolean"?oe:oe==="true"||oe===1?!0:oe==="false"||oe===0?!1:!!oe:oe}function a(oe){return oe instanceof Date?oe.getTime():typeof oe=="number"?oe:Date.parse(String(oe))}function u(oe){return typeof oe=="number"?oe:oe instanceof Date?oe.getTime():oe==null||oe===""?NaN:Number(oe)}function h(oe,he){const ae=typeof oe=="string"?oe:String(oe);return he?ae:ae.toLowerCase()}function p(oe,he){return oe==null?s:typeof oe=="string"?he?oe:oe.toLowerCase():oe instanceof Date?oe.getTime():oe}function y(oe,he,ae){const se=new Set;for(const de of I(oe)){const ke=c(de,ae);se.add(p(ke,he)),typeof ke=="string"&&ke!==""&&Number.isFinite(Number(ke))?se.add(Number(ke)):typeof ke=="number"&&Number.isFinite(ke)&&se.add(p(String(ke),he))}return se}function d(oe,he,ae){if(oe==null||he===null||he===void 0)return oe==null&&he==null;const se=typeof oe,de=typeof he;return se==="string"&&de==="string"?ae?oe===he:oe.toLowerCase()===he.toLowerCase():oe instanceof Date||he instanceof Date?a(oe)===a(he):se==="number"&&de==="number"?oe===he||Number.isNaN(oe)&&Number.isNaN(he):se==="number"&&de==="string"?oe===Number(he):se==="string"&&de==="number"?Number(oe)===he:se==="boolean"||de==="boolean"?oe===he:Array.isArray(oe)&&Array.isArray(he)?oe.length===he.length&&oe.every((ke,Ae)=>d(ke,he[Ae],ae)):oe===he}function f(oe,he){try{if(oe instanceof RegExp){const ae=oe.flags.replace(/[gy]/g,"");return new RegExp(oe.source,he||ae.includes("i")?ae:`${ae}i`)}return new RegExp(String(oe),he?"":"i")}catch(ae){return Q(`regex:${String(oe)}`,`filter operator "matches" received an invalid pattern: ${String(oe)}`,ae),null}}function w(oe,he){if(oe&&oe.type==="datetime"&&k.has(oe.op))return B(oe,he);const ae=E(oe,he),se=oe&&oe.type;return se!=="date"&&se!=="dateString"?ae:de=>ae(typeof de=="string"&&t.test(de)?de:X(de)??de)}const k=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 K(oe,he){let ae=G.get(he);if(ae===void 0){try{ae=new Intl.DateTimeFormat("en-CA",{timeZone:he,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{ae=null}G.set(he,ae)}if(!ae)return null;const se={};for(const de of ae.formatToParts(oe))de.type!=="literal"&&(se[de.type]=de.value);return se}function q(oe,he){if(oe==null||oe==="")return null;if(typeof oe=="string"){const ke=P.exec(oe.trim());if(ke)return Date.UTC(+ke[1],+ke[2]-1,+ke[3],+(ke[4]||0),+(ke[5]||0),+(ke[6]||0),+(ke[7]||"0").padEnd(3,"0"))}const ae=$(oe);if(!ae)return null;const se=ae.getUTCMilliseconds(),de=he?K(ae,he):null;return de?Date.UTC(+de.year,+de.month-1,+de.day,de.hour==="24"?0:+de.hour,+de.minute,+de.second,se):Date.UTC(ae.getFullYear(),ae.getMonth(),ae.getDate(),ae.getHours(),ae.getMinutes(),ae.getSeconds(),se)}function B(oe,he){const ae=typeof oe.timeZone=="string"&&oe.timeZone?oe.timeZone:void 0,se=Ae=>q(Ae,ae),de=Array.isArray(oe.value)?oe.value.map(se):se(oe.value),ke=E({...oe,type:"number",value:de},he);return Ae=>ke(q(Ae))}function E(oe,he){const ae=oe&&oe.op,se=!!(oe&&oe.caseSensitive),de=oe&&oe.type,ke=g(he),Ae=Te=>je=>!Te(je);switch(ae){case"eq":{const Te=ve(de,"eq");if(Te)return Te.compile(oe.value);const je=c(oe.value,de);return ye=>d(ye,je,se)}case"ne":{const Te=ve(de,"ne");if(Te)return Te.compile(oe.value);const je=c(oe.value,de);return ye=>!d(ye,je,se)}case"lt":case"lte":case"gt":case"gte":{const Te=c(oe.value,de);if(m(Te))return()=>!1;const je=ae==="lt"?-1:ae==="lte"?0:ae==="gt"?1:2;return ye=>{if(m(ye))return!1;const He=ke(ye,Te);return je===-1?He<0:je===0?He<=0:je===1?He>0:He>=0}}case"between":case"notBetween":{const Te=I(oe.value),je=c(Te[0],de),ye=c(Te[1],de),He=oe.bounds||"[]",Me=He.charAt(0)!=="(",Re=He.charAt(1)!==")";if(m(je)||m(ye))return ae==="between"?()=>!1:()=>!0;const Ee=$e=>{if(m($e))return!1;const Ie=ke($e,je),We=ke($e,ye);return(Me?Ie>=0:Ie>0)&&(Re?We<=0:We<0)};return ae==="between"?Ee:Ae(Ee)}case"in":case"notIn":{const Te=y(oe.value,se,de),je=ye=>Te.has(p(ye,se));return ae==="in"?je:Ae(je)}case"contains":case"notContains":{const Te=ve(de,ae);if(Te)return Te.compile(oe.value);const je=h(c(oe.value,de),se),ye=He=>He==null?!1:h(He,se).includes(je);return ae==="contains"?ye:Ae(ye)}case"startsWith":{const Te=ve(de,"startsWith");if(Te)return Te.compile(oe.value);const je=h(c(oe.value,de),se);return ye=>ye==null?!1:h(ye,se).startsWith(je)}case"endsWith":{const Te=ve(de,"endsWith");if(Te)return Te.compile(oe.value);const je=h(c(oe.value,de),se);return ye=>ye==null?!1:h(ye,se).endsWith(je)}case"matches":{const Te=f(oe.value,se);return Te?je=>je==null?!1:Te.test(String(je)):()=>!1}case"blank":case"notBlank":{const Te=oe.trim===!0,je=ye=>A(ye)||Array.isArray(ye)&&ye.length===0||Te&&typeof ye=="string"&&ye.trim()==="";return ae==="blank"?je:ye=>!je(ye)}case"containsAny":case"containsNone":{const Te=y(oe.value,se,de),je=ye=>{const He=ye==null?[]:I(ye);for(let Me=0;Me<He.length;Me++)if(Te.has(p(He[Me],se)))return!0;return!1};return ae==="containsAny"?je:Ae(je)}case"containsAll":{const Te=I(oe.value).map(je=>p(c(je,de),se));return je=>{const ye=je==null?[]:I(je);if(Te.length===0)return!0;const He=new Set(ye.map(Me=>p(Me,se)));for(let Me=0;Me<Te.length;Me++)if(!He.has(Te[Me]))return!1;return!0}}default:{const Te=_e(ae);return Te?Te.compile(oe.value):(Q(`op:${String(ae)}`,`unknown filter operator "${String(ae)}"; the condition is refused rather than matching every row`),()=>!1)}}}function S(oe,he,ae){return w(he,ae)(oe)}const C=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),N=new Set(["containsAny","containsAll","containsNone"]);function O(oe,he,ae){const se=oe&&oe.op,de=C[se]||se,ke=w({...oe,op:de,type:he.type},ae),Ae=he.items,Te=je=>{const ye=Ae(je);if(!ye)return!1;for(let He=0;He<ye.length;He++)if(ke(ye[He]))return!0;return!1};return C[se]?je=>!Te(je):Te}function T(oe,he,ae,se,de){const ke=de?null:l(oe);if(ke){const je=he?1:0;for(let ye=0;ye<se;ye++)ae[ye]=ke(ye)===je?1:0;return ae}const Ae=oe.kind;if(Ae==="float64"||Ae==="int32"||Ae==="bitset")return n(ae,se,he?1:0);const Te=o(oe);for(let je=0;je<se;je++){const ye=Te(je),He=A(ye)||Array.isArray(ye)&&ye.length===0||de&&typeof ye=="string"&&ye.trim()==="";ae[je]=He===he?0:1}return ae}function R(oe,he,ae,se){const de=oe.dict,ke=v(de),Ae=new Uint8Array(ke);for(let He=0;He<ke;He++)Ae[He]=he(b(de,He))?1:0;const Te=oe.values,je=l(oe);if(!je){for(let He=0;He<se;He++)ae[He]=Ae[Te[He]];return ae}const ye=he(null)?1:0;for(let He=0;He<se;He++)ae[He]=je(He)===1?Ae[Te[He]]:ye;return ae}function x(oe,he,ae,se){const de=j(oe.values),ke=he(!0)?1:0,Ae=he(!1)?1:0,Te=l(oe);if(!Te){for(let ye=0;ye<se;ye++)ae[ye]=de(ye)===1?ke:Ae;return ae}const je=he(null)?1:0;for(let ye=0;ye<se;ye++)ae[ye]=Te(ye)===0?je:de(ye)===1?ke:Ae;return ae}function U(oe,he,ae,se,de){const ke=oe.values,Ae=he.type,Te=he.op;let je=!0;switch(Te){case"eq":case"ne":{const He=u(c(he.value,Ae)),Me=typeof he.value=="number"&&Number.isNaN(he.value),Re=Te==="ne"?1:0;if(Me)for(let Ee=0;Ee<de;Ee++)se[Ee]=(Number.isNaN(ke[Ee])?1:0)^Re;else for(let Ee=0;Ee<de;Ee++)se[Ee]=(ke[Ee]===He?1:0)^Re;break}case"lt":{const He=u(c(he.value,Ae));for(let Me=0;Me<de;Me++)se[Me]=ke[Me]<He?1:0;break}case"lte":{const He=u(c(he.value,Ae));for(let Me=0;Me<de;Me++)se[Me]=ke[Me]<=He?1:0;break}case"gt":{const He=u(c(he.value,Ae));for(let Me=0;Me<de;Me++)se[Me]=ke[Me]>He?1:0;break}case"gte":{const He=u(c(he.value,Ae));for(let Me=0;Me<de;Me++)se[Me]=ke[Me]>=He?1:0;break}case"between":case"notBetween":{const He=I(he.value),Me=u(c(He[0],Ae)),Re=u(c(He[1],Ae)),Ee=he.bounds||"[]",$e=Ee.charAt(0)!=="(",Ie=Ee.charAt(1)!==")",We=Te==="notBetween"?1:0;if($e&&Ie)for(let Ye=0;Ye<de;Ye++)se[Ye]=(ke[Ye]>=Me&ke[Ye]<=Re?1:0)^We;else if($e)for(let Ye=0;Ye<de;Ye++)se[Ye]=(ke[Ye]>=Me&ke[Ye]<Re?1:0)^We;else if(Ie)for(let Ye=0;Ye<de;Ye++)se[Ye]=(ke[Ye]>Me&ke[Ye]<=Re?1:0)^We;else for(let Ye=0;Ye<de;Ye++)se[Ye]=(ke[Ye]>Me&ke[Ye]<Re?1:0)^We;break}case"in":case"notIn":{const He=new Set;for(const Re of I(he.value)){const Ee=u(c(Re,Ae));Number.isNaN(Ee)||He.add(Ee)}const Me=Te==="notIn"?1:0;for(let Re=0;Re<de;Re++)se[Re]=(He.has(ke[Re])?1:0)^Me;break}default:je=!1;break}if(!je)return!1;const ye=l(oe);if(ye){const He=ae(null)?1:0;for(let Me=0;Me<de;Me++)ye(Me)===0&&(se[Me]=He)}return!0}function V(oe,he,ae,se){const de=o(oe);for(let ke=0;ke<se;ke++)ae[ke]=he(de(ke))?1:0;return ae}function J(oe,he){if(!oe||!Ce.has(oe.op))return oe;const ae=he&&he.typeOf;if(typeof ae!="function")return oe;const se=ae(oe.col);return typeof se!="string"||!se||se===oe.type?oe:{...oe,type:se}}function _(oe,he,ae){const se=he.count|0,de=ae||r(he,se);if(!oe)return n(de,se,1);const ke=typeof he.handle=="function"?he.handle(oe.col):void 0,Ae=typeof he.custom=="function"?he.custom:null;if(!ke){if(Ae){for(let He=0;He<se;He++)de[He]=Ae(oe,He)?1:0;return de}return Q(`filter:col:${String(oe.col)}`,`filter references unknown column "${String(oe.col)}"; the condition is refused rather than matching every row`),n(de,se,0)}const Te=oe.op;if(Te==="blank"||Te==="notBlank")return T(ke,Te==="notBlank",de,se,oe.trim===!0);const je=typeof he.itemwise=="function"?he.itemwise(oe.col):null;if(je&&!_e(Te)&&!N.has(Te))return V(ke,O(oe,je,he.locale),de,se);const ye=w(J(oe,he),he.locale);switch(ke.kind){case"dictionary":return R(ke,ye,de,se);case"bitset":return x(ke,ye,de,se);case"float64":case"int32":return U(ke,oe,ye,de,se)?de:V(ke,ye,de,se);default:return V(ke,ye,de,se)}}function ee(oe,he,ae){if(!oe)return n(r(he,ae),ae,1);if(Array.isArray(oe.conditions)){const se=oe.conditions.filter(Ae=>Ae!=null),de=oe.op==="or"?"or":oe.op==="not"?"not":"and";if(se.length===0)return n(r(he,ae),ae,1);const ke=ee(se[0],he,ae);for(let Ae=1;Ae<se.length;Ae++){const Te=ee(se[Ae],he,ae);if(de==="or")for(let je=0;je<ae;je++)ke[je]|=Te[je];else for(let je=0;je<ae;je++)ke[je]&=Te[je];i(he,Te)}if(de==="not")for(let Ae=0;Ae<ae;Ae++)ke[Ae]^=1;return ke}return _(oe,he,r(he,ae))}function W(oe,he){return ee(oe,he,he.count|0)}function Z(oe,he){if(!oe||!he)return oe||null;const ae=oe;if(Array.isArray(ae.conditions)){if((ae.op==="or"?"or":ae.op==="not"?"not":"and")!=="and")return ne(ae,he)?null:oe;const de=[];for(const ke of ae.conditions){const Ae=Z(ke,he);Ae&&de.push(Ae)}return de.length?{...ae,op:"and",conditions:de}:null}return ae.col===he?null:oe}function ne(oe,he){if(!oe||typeof oe!="object")return!1;const ae=oe;if(ae.col===he)return!0;if(Array.isArray(ae.conditions)){for(const se of ae.conditions)if(ne(se,he))return!0}return!1}function ie(oe,he,ae){if(ae&&ae.length>=he){let Ae=0;for(let Te=0;Te<he;Te++)oe[Te]&&(ae[Ae++]=Te);return ae.subarray(0,Ae)}let se=0;for(let Ae=0;Ae<he;Ae++)se+=oe[Ae]?1:0;const de=new Uint32Array(se);let ke=0;for(let Ae=0;Ae<he;Ae++)oe[Ae]&&(de[ke++]=Ae);return de}const ce=new Map,me=new Map,Ce=new Set,Pe=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn","contains","notContains","startsWith","endsWith","matches","blank","notBlank","containsAny","containsAll","containsNone"]);function xe(oe,he){if(!oe||typeof oe!="object")return;const ae=Object.entries(oe).filter(([,se])=>se&&typeof se.compile=="function");if(typeof he=="string"&&he){let se=me.get(he);se||(se=new Map,me.set(he,se));for(const[de,ke]of ae)se.set(de,ke)}for(const[se,de]of ae)Pe.has(se)?Ce.add(se):ce.set(se,de)}function _e(oe){return typeof oe=="string"?ce.get(oe):void 0}function ve(oe,he){if(typeof oe!="string"||typeof he!="string")return;const ae=me.get(oe);return ae?ae.get(he):void 0}}),Ve("packages/core/src/columns/datatypes.js",function(e,D){"use strict";Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"parseNumberText",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"BUILTIN_TYPES",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return T}});const re=D("packages/core/src/internal/compare.js"),A=re.collator,Y=re.defaultCompare,I=D("packages/core/src/internal/predicates.js"),L=I.isNil,Q=I.isObject,H=I.isFunction,$=D("packages/core/src/internal/warn.js"),X=$.fail,F=$.infoOnce,v=D("packages/core/src/internal/text.js").titleCase,b=D("packages/core/src/format/date.js"),l=b.toDate,g=b.toIsoDate,o=b.compareIso,s=D("packages/core/src/format/boolean.js").toTriState,i=D("packages/core/src/columns/types/index.js").EXTENDED_TYPES,n=D("packages/core/src/formula/index.js"),m=n.evaluateFormula,c=n.looksLikeFormula,u=D("packages/core/src/compute/filter.js").declareOperators,h=/^\d{4}-\d{2}-\d{2}$/;function p(R){return R.getHours()===0&&R.getMinutes()===0&&R.getSeconds()===0&&R.getMilliseconds()===0}const y=new Map;function d(R){const x=R||"",U=y.get(x);if(U)return U;const V={group:",",decimal:"."};try{for(const J of new Intl.NumberFormat(R||void 0).formatToParts(12345.6))J.type==="group"?V.group=J.value:J.type==="decimal"&&(V.decimal=J.value)}catch{}return y.set(x,V),V}const f=/\d\s*[*/^]\s*[\d.(]/;function w(R,x){if(L(R))return null;let U=String(R).trim();if(U===""||U.startsWith("=")||f.test(U))return null;let V=1;U.startsWith("(")&&U.endsWith(")")&&(V=-1,U=U.slice(1,-1));const J=U.endsWith("%"),{group:_,decimal:ee}=d(x);if(U=U.replace(/[\s\u00a0\u202f\u2009']/g,""),_&&_!=="."&&_!==","&&(U=U.split(_).join("")),U=U.replace(/[^0-9eE+\-.,]/g,""),ee===","?U=U.split(".").join("").replace(",","."):U=U.split(",").join(""),U===""||U==="-"||U==="+")return null;const W=Number(U);return Number.isNaN(W)?null:V*(J?W/100:W)}function k(R,x){const U=L(R)||Number.isNaN(R)?null:Number(R),V=L(x)||Number.isNaN(x)?null:Number(x);return U===null?V===null?0:1:V===null||U<V?-1:U>V?1:0}function P(R,x){const U=s(R),V=s(x);return U===null?V===null?0:1:V===null?-1:U===V?0:U?1:-1}function G(R,x){const U=l(R),V=l(x);if(!U)return V?1:0;if(!V)return-1;const J=U.getTime(),_=V.getTime();return J<_?-1:J>_?1:0}const K=new Map;function q(R){const x=l(R.value);if(!x)return"";const U=R.locale||"";let V=K.get(U);return V||(V=new Intl.DateTimeFormat(R.locale||void 0,{dateStyle:"medium"}),K.set(U,V)),V.format(x)}const B={boolean:{base:"boolean",storage:"bitset",matches:R=>typeof R=="boolean",parse:R=>s(R.text),compare:P,format:R=>s(R.value)===null?"":s(R.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:R=>s(R)===null?"":String(s(R)),fromClipboard:R=>s(R)},number:{base:"number",storage:"float64",matches:R=>typeof R=="number"&&!Number.isNaN(R),parse:R=>{if(c(R.text)){const x=m(R.text,R);if(!x.ok)return null;const U=Number(x.value);return Number.isFinite(U)?U:null}return w(R.text,R.locale)},compare:k,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:R=>L(R)?"":String(R),fromClipboard:(R,x)=>w(R,x&&x.locale),toStorage:(R,x)=>{if(typeof R!="string")return R;const U=w(R,x&&x.locale);return U!==null?U:(F(`type.number.unparsed.${x&&x.colId||""}`,`column "${x&&x.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:R=>typeof R=="string"&&h.test(R)&&!Number.isNaN(Date.parse(R))||R instanceof Date&&!Number.isNaN(R.getTime())&&p(R),parse:R=>g(R.text),compare:o,format:q,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:R=>g(R),toClipboard:R=>L(R)?"":String(R),fromClipboard:R=>g(R)},dateString:{base:"dateString",storage:"dictionary",matches:R=>typeof R=="string"&&h.test(R)&&!Number.isNaN(Date.parse(R)),parse:R=>g(R.text),compare:o,format:q,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:R=>g(R),toClipboard:R=>L(R)?"":String(R),fromClipboard:R=>g(R)},text:{base:"text",storage:"dictionary",matches:R=>typeof R=="string",parse:R=>R.text===""?null:String(R.text),compare:(R,x)=>L(R)?L(x)?0:1:L(x)?-1:A().compare(String(R),String(x)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:R=>L(R)?"":String(R),fromClipboard:R=>R},image:{base:"text",storage:"dictionary",parse:R=>R.text===""||R.text==null?null:String(R.text).trim(),compare:(R,x)=>L(R)?L(x)?0:1:L(x)?-1:A().compare(String(R),String(x)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:R=>L(R)?"":String(R),fromClipboard:R=>R},lookup:{base:"text",storage:"dictionary",parse:R=>{if(R.text===""||R.text==null)return null;const x=R.column&&R.column.lookup,U=x&&H(x.options)?x.options():null;if(!U)return R.text;const V=String(R.text),J=U.find(W=>String(W.id)===V);if(J)return J.id;const _=V.trim().toLowerCase(),ee=U.find(W=>String(W.label).toLowerCase()===_);return ee?ee.id:R.text},compare:Y,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:R=>L(R)?"":String(R),fromClipboard:R=>R},object:{base:"object",storage:"object",matches:R=>R!==null&&typeof R=="object"&&!(R instanceof Date),parse:R=>{try{return R.text===""?null:JSON.parse(R.text)}catch{return R.text}},compare:(R,x)=>Y(R,x),format:R=>{const x=R.value;if(L(x))return"";if(typeof x=="string")return x;try{return JSON.stringify(x)}catch{return String(x)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:R=>L(R)?"":typeof R=="string"?R:JSON.stringify(R),fromClipboard:R=>R}},E=["boolean","number","date","dateString","datetime","text","object"];function S(R,x,U,V){const J=U.get(R);if(J)return J;V.includes(R)&&X(`circular data type extends chain: ${[...V,R].join(" → ")}`);const _=x[R];_||X(`unknown data type "${R}"`);let ee=null;_.extends&&(ee=S(_.extends,x,U,[...V,R]));const W={...ee||{},..._,name:R,defaults:{...ee&&ee.defaults||{},..._.defaults||{}}};return W.base||(W.base=ee&&ee.base||"text"),W.storage||(W.storage=ee&&ee.storage||"object"),U.set(R,W),W}function C(R,x){const U={...B,...i};if(x&&typeof x.dataType=="function"&&typeof x.names=="function")for(const J of x.names("dataType")){const _=x.dataType(J);_&&(U[J]=_)}if(Q(R))for(const[J,_]of Object.entries(R))U[J]=_;const V=new Map;for(const J of E)S(J,U,V,[]);S("lookup",U,V,[]);for(const J of Object.keys(U))S(J,U,V,[]);for(const J of V.values())u(J.operators,J.name);return V}function N(R,x){if(R.base==="text"&&(!R.compare||R.compare===B.text.compare)){const U=A(x);return(V,J)=>L(V)?L(J)?0:1:L(J)?-1:U.compare(String(V),String(J))}return R.compare||Y}function O(R,x){return x?R.multiStorage||"multi":R.storage||"object"}function T(R){return v(String(R).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),Ve("packages/core/src/columns/infer.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_SAMPLE",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"inferFromValues",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return H}});const A=D("packages/core/src/internal/warn.js").infoOnce,I=D("packages/core/src/internal/predicates.js").isNil,L=100;function Q($,X,F={}){const j=F.sampleSize??L,v=[];for(let b=0;b<$.length&&v.length<j;b++){const l=$[b];I(l)||typeof l=="number"&&Number.isNaN(l)||v.push(l)}if(v.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[b,l]of X){if(typeof l.matches!="function")continue;let g=!0;for(let o=0;o<v.length;o++)if(!l.matches(v[o])){g=!1;break}if(g)return{type:b,unanimous:!0,sampled:v.length}}return F.quiet||A(`infer:${F.colId||"?"}`,`column "${F.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:v.length}}function H($,X,F,j,v={}){const b=v.sampleSize??L,l=[];for(let g=0;g<X.length&&l.length<b;g++){const o=F(X[g]);I(o)||typeof o=="number"&&Number.isNaN(o)||l.push(o)}return Q(l,j,{...v,colId:$}).type}}),Ve("packages/core/src/columns/graph.js",function(e,D){"use strict";Object.defineProperty(e,"WHOLE_ROW",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"declarationOf",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return j}});const re=D("packages/core/src/internal/warn.js"),A=re.DEV,Y=re.fail,I=re.warnOnce,Q=D("packages/core/src/internal/predicates.js").isFunction,H="*";function $(v){const b=v.value||{};if(!Q(b.compute))return{computed:!1,wholeRow:!1,deps:[],pure:!0};const g=b.pure!==!1;return b.deps===H?{computed:!0,wholeRow:!0,deps:[],pure:g}:Array.isArray(b.deps)?{computed:!0,wholeRow:!1,deps:b.deps.slice(),pure:g}:(I(`deps:missing:${v.id}`,`computed column "${v.id}" declares no \`value.deps\`; treating it as \`deps: '*'\` (a whole-row dependency). Declare the dependencies to get precise invalidation.`),{computed:!0,wholeRow:!0,deps:[],pure:g})}function X(v){const b=new Map;for(const u of v)b.set(u.id,u);const l=new Map,g=new Map,o=new Set,t=new Set,s=new Set,r=new Set;for(const u of v){const h=$(u);if(!h.computed){l.set(u.id,[]);continue}t.add(u.id),(h.pure?s:r).add(u.id),h.wholeRow&&o.add(u.id);const p=[],y=[];for(const d of h.deps)(b.has(d)?p:y).push(d);l.set(u.id,p),y.length&&g.set(u.id,y)}for(const u of s)for(const h of l.get(u))r.has(h)&&Y(`pure computed column "${u}" depends on impure column "${h}". Mark it \`value.pure: false\` or make the dependency pure.`);const i=[],n=new Map,m=[],c=u=>{const h=n.get(u);if(h!=="done"){if(h==="open"){const p=m.indexOf(u);Y(`circular column dependency: ${[...m.slice(p),u].join(" → ")}`)}n.set(u,"open"),m.push(u);for(const p of l.get(u)||[])b.has(p)&&c(p);m.pop(),n.set(u,"done"),i.push(u)}};for(const u of v)c(u.id);const a=new Map;for(const u of v)a.set(u.id,[]);for(const u of v)for(const h of l.get(u.id)||[]){const p=a.get(h);p&&!p.includes(u.id)&&p.push(u.id)}if(o.size)for(const u of v){if(t.has(u.id))continue;const h=a.get(u.id);for(const p of o)h.includes(p)||h.push(p)}return{order:i,dependents:a,pure:s,impure:r,computed:t,deps:l,wholeRow:o,external:g,index:b}}function F(v,b){const l=Array.isArray(b)?b:[b],g=new Set,o=[...l];for(;o.length;){const t=o.shift();for(const s of v.dependents.get(t)||[])g.has(s)||(g.add(s),o.push(s))}for(const t of l)g.delete(t);return v.order.filter(t=>g.has(t))}function j(v,b,l){if(!A)return v;const g=b instanceof Set?b:new Set(b);return new Proxy(v,{get(o,t){return typeof t=="string"&&!g.has(t)&&!Object.hasOwn(o,t)&&I(`undeclared:${l}:${t}`,`computed column "${l}" read undeclared dependency "${t}". Add it to \`value.deps\` or the value will go stale.`),o[t]}})}}),Ve("packages/core/src/model/rowkey.js",function(e,D){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"compositeKey",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createRowKey",{enumerable:!0,get:function(){return v}}),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 A=D("packages/core/src/internal/warn.js").warnOnce,I=D("packages/core/src/internal/paths.js").pathGetter,L=D("packages/core/src/internal/predicates.js"),Q=L.isFunction,H=L.isBlank,$=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],X="";function F(s){if(s===null)return"\0n";if(s===void 0)return"\0u";const r=typeof s;if(r==="string")return s;if(r==="number"||r==="bigint"||r==="boolean")return String(s);if(s instanceof Date)return`\0d${s.getTime()}`;try{return`\0o${JSON.stringify(s)}`}catch{return"\0o?"}}function j(s){if(s.length===1)return F(s[0]);let r="";for(let i=0;i<s.length;i++)i&&(r+=X),r+=F(s[i]);return r}function v(s,r={}){const i=r.warn!==!1;if(Q(s)){const n=s;return{stable:!0,fields:[],disabled:[],key(m,c){try{const a=n(m);return Array.isArray(a)?j(a):F(a)}catch(a){return A("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",a),`#${c??-1}`}},keyEmpty(m){try{const c=n(m);return Array.isArray(c)?c.length===0||c.some(H):H(c)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(s)&&s.length>0){const n=s.filter(a=>typeof a=="string"),m=n.map(a=>I(a)),c=m.length;return{stable:!0,fields:n,disabled:[],key(a){const u=new Array(c);for(let h=0;h<c;h++)u[h]=m[h](a);return j(u)},keyEmpty(a){for(let u=0;u<c;u++)if(H(m[u](a)))return!0;return!1},missingFields(a){const u=[];for(let h=0;h<c;h++)H(m[h](a))&&u.push(n[h]);return u}}}if(typeof s=="string"&&s.length>0){const n=I(s);return{stable:!0,fields:[s],disabled:[],key(m){return F(n(m))},keyEmpty(m){return H(n(m))},missingFields(m){return H(n(m))?[s]:[]}}}return i&&A("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${$.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:$.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=`#${l++}`,b.set(n,c)),c}}}const b=new WeakMap;let l=0;function g(s,r){if(!s||s.stable===!1||!Q(s.keyEmpty)||!Array.isArray(r)||r.length===0)return;let i=0,n=null,m;for(let h=0;h<r.length;h++){const p=r[h];s.keyEmpty(p)&&(i++,n===null&&(n=Q(s.missingFields)?s.missingFields(p):[],m=p))}if(i===0)return;const c=s.fields.length?s.fields.join(","):"(function)",a=n&&n.length?n.join(", "):s.fields.length?s.fields.join(", "):"the rowKey function",u=m!==null&&typeof m=="object"?Object.keys(m).join(", ")||"(no fields)":String(m);A(`rowKey.emptyValue:${c}`,`rowKey ${a} is missing on ${i} of ${r.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(s){return j(s)}function t(s){return s.split(X)}}),Ve("packages/core/src/columns/lookup.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_SEPARATOR",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"normaliseOption",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return l}}),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 s}});const re=D("packages/core/src/internal/compare.js"),A=re.collator,Y=re.defaultCompare,I=D("packages/core/src/internal/predicates.js"),L=I.isFunction,Q=I.isNil,$=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/model/rowkey.js").compositeKey,j=", ",v="";function b(r,i,n,m){if(r===null||typeof r!="object")return{id:r,label:r==null?"":String(r)};const c=r[i],a=r[n],u={id:c,label:a==null?String(c??""):String(a)};r.disabled&&(u.disabled=!0),r.variant&&(u.variant=r.variant),r.icon&&(u.icon=r.icon);const h=m?r[m]:r.group;return h!==void 0&&(u.group=h),u}function l(r,i,n=0,m=[],c=[]){for(const a of r||[]){const u=a&&typeof a=="object"?a[i]:null;if(c.push({raw:a,depth:n,path:m}),Array.isArray(u)&&u.length){const h=String(a&&typeof a=="object"?a.label??a.name??a.id??"":a);l(u,i,n+1,[...m,h],c)}}return c}function g(r){return!!r&&typeof r=="object"&&!Array.isArray(r)&&L(r.router&&r.router.subscribe)}class o{#e;#t;#n;#r;#s=[];#i=new Map;#a=new Map;#l=0;#o="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=A(this.#n),Array.isArray(this.#e.options)?this.#h(this.#e.options):this.#e.options===void 0&&(this.#o="ready")}get colId(){return this.#t}get version(){return this.#l}get state(){return this.#o}get ready(){return this.#o==="ready"}get multiple(){return this.#e.multiple===!0}get separator(){return this.#e.separator??j}get allowCustom(){return this.#e.allowCustom===!0}get sortBy(){return this.#e.sortBy||"label"}get spec(){return this.#e}options(){return this.#s}setLocale(i){this.#n=i,this.#u=A(i)}#h(i){const n=this.#e,m=n.valueKey||"id",c=n.labelKey||"label",a=n.childrenKey||"children";this.#s=l(i,a).map(u=>{const h=b(u.raw,m,c,n.groupKey);return u.depth&&(h.depth=u.depth,h.path=u.path),h}),this.#i=new Map,this.#a=new Map,this.#s.forEach((u,h)=>{this.#i.set(u.id,u),this.#a.set(u.id,h)}),this.#o="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.#s),this.#c;if(g(i))return this.#c=this.#p(i),this.#c;if(!L(i))return $(`lookup:options:${this.#t}`,`column "${this.#t}" has an invalid \`lookup.options\`; expected an array, a function, or a router route`),this.#o="ready",this.#c=Promise.resolve([]),this.#c;this.#o="loading";let n;try{n=i()}catch(m){return this.#o="error",$(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,m),this.#c=Promise.resolve([]),this.#c}return!n||!L(n.then)?(this.#h(n),this.#c=Promise.resolve(this.#s),this.#r&&this.#r(this),this.#c):(this.#c=n.then(m=>(this.#h(m),this.#r&&this.#r(this),this.#s),m=>(this.#o="error",$(`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.#s)):this.load()}#p(i){if(this.#f)return Promise.resolve(this.#s);const n=this.#e,m=n.valueKey||"id",c=n.labelKey||"label",a=n.groupKey,u=L(i.map)?i.map:null,h=y=>b(u?u(y):y,m,c,a).id,p=y=>this.#m(y,u,m,c,a);return i.router.subscribe(i.predicate,p,{rowKey:h}),this.#f=()=>{L(i.router.detach)&&i.router.detach(p)},this.#o="ready",Promise.resolve(this.#s)}#m(i,n,m,c,a){const u=i&&i.add||[],h=i&&i.update||[],p=i&&i.remove||[];if(!(!u.length&&!h.length&&!p.length)){for(const y of u)this.#g(y,n,m,c,a);for(const y of h)this.#g(y,n,m,c,a);for(const y of p){if(!this.#d.has(y))continue;const d=this.#d.get(y);this.#d.delete(y),this.#i.delete(d);const f=this.#s.findIndex(w=>w.id===d);f>=0&&this.#s.splice(f,1)}this.#a=new Map(this.#s.map((y,d)=>[y.id,d])),this.#o="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(i,n,m,c,a){const u=b(n?n(i):i,m,c,a);this.#d.set(F([u.id]),u.id);const h=this.#s.findIndex(p=>p.id===u.id);h>=0?this.#s[h]=u:this.#s.push(u),this.#i.set(u.id,u)}destroy(){this.#f&&(this.#f(),this.#f=null)}search(i,n){const m=this.#e;if(!L(m.search)){const u=String(i||"").toLowerCase();return Promise.resolve(u===""?this.#s:this.#s.filter(h=>h.label.toLowerCase().includes(u)))}const c=m.valueKey||"id",a=m.labelKey||"label";return Promise.resolve(m.search(i,n)).then(u=>(u||[]).map(h=>b(h,c,a,m.groupKey)))}option(i){return this.#i.get(i)}has(i){return this.#i.has(i)}label(i){if(Q(i)||i==="")return"";const n=this.#i.get(i);if(n)return n.label;if(this.#o==="loading"||this.#o==="idle")return"";this.allowCustom||$(`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 L(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.#s.map(i=>i.id)}sorted(){const i=this.sortBy;if(i==="optionOrder"||i==="count")return this.#s.slice();if(i==="value")return this.#s.slice().sort((m,c)=>Y(m.id,c.id));const n=this.#u;return this.#s.slice().sort((m,c)=>n.compare(m.label,c.label))}comparator(){const i=this.sortBy,n=this.multiple,m=this.#u,c=this.#a;if(n&&i==="count")return(u,h)=>t(u).length-t(h).length;const a=n?u=>t(u)[0]:u=>u;return i==="value"?(u,h)=>Y(a(u),a(h)):i==="optionOrder"?(u,h)=>{const p=c.has(a(u))?c.get(a(u)):Number.MAX_SAFE_INTEGER,y=c.has(a(h))?c.get(a(h)):Number.MAX_SAFE_INTEGER;return p-y}:(u,h)=>{const p=a(u),y=a(h);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(v):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],a=Array.isArray(n)?n:[n];switch(m){case"containsAll":return a.every(u=>c.includes(u));case"containsNone":return!a.some(u=>c.includes(u));default:return a.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.#s.map(n=>({id:n.id,label:n.label,has:m=>i?t(m).includes(n.id):m===n.id}))}}function t(r){return Array.isArray(r)?r:Q(r)||r===""?[]:[r]}function s(r,i={}){const n=r.lookup;if(!n)return null;const m=new o(n,{colId:r.id,locale:i.locale,onChange:i.onChange});return!Array.isArray(n.options)&&n.options!==void 0&&m.load(),m}}),Ve("packages/core/src/columns/value.js",function(e,D){"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 s}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return r}});const A=D("packages/core/src/internal/paths.js").getPath,Y=D("packages/core/src/internal/predicates.js"),I=Y.isFunction,L=Y.isNil,Q=Y.isObject,$=D("packages/core/src/internal/lru.js").Lru,F=D("packages/core/src/internal/warn.js").warnOnce,v=D("packages/core/src/format/number.js").compileNumber,l=D("packages/core/src/columns/graph.js").depsProxy,g="\0";function o(c,a={}){const u=a.locale,h=a.grid??null,p=a.context,y=c.value&&c.value.format,d=c.formatter||null,f=c.dataType&&c.dataType.format,w=c.lookup||null,k=(P,G,K)=>({value:P,data:K,row:G,column:c,colId:c.id,grid:h,context:p,locale:u});if(I(y))return(P,G,K)=>{const q=y(k(P,G,K));return q==null?"":String(q)};if(d){if(w){const P=d.kind==="text";return(G,K,q)=>d(P?w.text(G):G,k(G,K,q))}return(P,G,K)=>d(P,k(P,G,K))}if(I(f))return(P,G,K)=>{const q=f(k(P,G,K));return q==null?"":String(q)};if(c.dataType&&c.dataType.base==="number"&&Q(c.typeOptions)&&typeof c.typeOptions.decimals=="number"){const P=v({decimals:c.typeOptions.decimals},u);return G=>P(G)}return w?P=>w.text(P):P=>L(P)?"":typeof P=="string"?P:String(P)}function t(c,a){!c||!c.value||c.value.pure!==!1||F(`impure:${a}:${c.id}`,`column "${c.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${a}. The result is not stable across passes.`)}class s{#e;#t;#n;#r;#s;#i;#a=new $(4096);constructor(a){this.#e=a.columns instanceof Map?a.columns:new Map((a.columns||[]).map(u=>[u.id,u])),this.#t=a.graph,this.#n=a.grid??null,this.#r=a.context,this.#i=a.stored||null,this.#s=a.rowKey||r}get graph(){return this.#t}setGraph(a){this.#t=a,this.#a.clear()}beginPass(){this.#a.clear()}endPass(){this.#a.clear()}invalidate(a){if(this.#a.size===0)return;const u=a&&a.rows?new Set([...a.rows].map(String)):null,h=a&&a.columns?[...a.columns]:null;if(!u&&!h){this.#a.clear();return}const p=h?this.#l(h):null;for(const y of[...this.#a.keys()]){const d=String(y).split(g);d.length===3&&(u&&!u.has(d[0])||p&&!p.has(d[2])||this.#a.delete(y))}}#l(a){const u=new Set,h=this.#t,p=[...a];for(;p.length;){const y=p.pop();if(!u.has(y)){u.add(y);for(const d of h?h.dependents.get(y)||[]:[])p.push(d)}}return u}value(a,u,h){const p=typeof a=="string"?this.#e.get(a):a;if(!p)return;if(!p.computed)return this.#c(p,u,h);if(p.value.pure!==!1&&this.#i&&h&&h.physical!=null&&this.#i.has(p.id))return this.#i.get(p.id,h.physical);if(p.volatile)return this.compute(p,u,h);if(p.value.pure===!1)return this.compute(p,u,h);const y=`${this.#o(u,h)}${g}${p.id}`;if(this.#a.has(y))return this.#a.get(y);const d=this.compute(p,u,h);return this.#a.set(y,d),d}#o(a,u){return`${this.#s(a,u)}${g}${i(a)}`}#c(a,u,h){if(this.#i&&h&&h.physical!=null&&this.#i.has(a.id))return this.#i.get(a.id,h.physical);if(a.field)return a.read?a.read(u):A(u,a.field)}compute(a,u,h){const p=this.#t,y=p&&p.wholeRow.has(a.id);let d;if(y)d=u??{};else{d={};const w=p&&p.deps.get(a.id)||[];for(const P of w)d[P]=this.value(P,u,h);const k=p&&p.external.get(a.id)||[];for(const P of k)d[P]=A(u,P);d=l(d,[...w,...k],a.id)}const f={data:u,row:h,column:a,grid:this.#n,context:this.#r};return a.value.compute(d,f)}values(a,u){const h={},p=this.#t?this.#t.order:[...this.#e.keys()];for(const y of p)h[y]=this.value(y,a,u);return h}text(a,u,h){const p=typeof a=="string"?this.#e.get(a):a;return p?p.formatValue(this.value(p,u,h),h,u):""}key(a,u,h){const p=typeof a=="string"?this.#e.get(a):a;if(!p)return"";const y=this.value(p,u,h);return I(p.value.key)?String(p.value.key(this.#u(p,y,u,h))):p.lookup?p.lookup.groupKey(y):L(y)?"":String(y)}quickFilterText(a,u,h){const p=typeof a=="string"?this.#e.get(a):a;if(!p)return"";if(I(p.value.quickFilterText)){const y=this.value(p,u,h);return String(p.value.quickFilterText(this.#u(p,y,u,h))??"")}return this.text(p,u,h)}#u(a,u,h,p){return{value:u,data:h,row:p,column:a,colId:a.id,grid:this.#n,context:this.#r}}parse(a,u,h,p){const y=typeof a=="string"?this.#e.get(a):a;if(!y)return u;const d={text:u,value:this.value(y,h,p),data:h,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(d):y.dataType&&I(y.dataType.parse)?y.dataType.parse(d):u}validate(a,u,h,p,y){const d=typeof a=="string"?this.#e.get(a):a;if(!d||!I(d.edit.validate))return!0;const f=d.edit.validate({value:u,oldValue:h,data:p,row:y,column:d,grid:this.#n,context:this.#r});return f===!0||f===void 0?!0:String(f)}apply(a,u,h,p){const y=typeof a=="string"?this.#e.get(a):a;if(!y)return!1;const d=this.value(y,h,p);if(I(y.value.apply)){const f=y.value.apply({value:u,oldValue:d,data:h,row:p,column:y,grid:this.#n,context:this.#r});return this.#f(y,h,p),f!==!1}return y.field?d===u?!1:(y.write(h,u),this.#f(y,h,p),!0):(F(`apply:${y.id}`,`column "${y.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(a,u,h,p){const y=typeof a=="string"?this.#e.get(a):a;if(!y)return{ok:!1,value:void 0,oldValue:void 0,changed:!1,error:"unknown column"};const d=this.value(y,h,p),f=this.parse(y,u,h,p),w=this.validate(y,f,d,h,p);if(w!==!0)return{ok:!1,value:f,oldValue:d,changed:!1,error:w};const k=this.apply(y,f,h,p);return{ok:!0,value:f,oldValue:d,changed:k}}#f(a,u,h){if(this.#a.size===0)return;const p=this.#o(u,h);this.#a.delete(`${p}${g}${a.id}`);for(const y of this.#t?this.#t.dependents.get(a.id)||[]:[])this.#a.delete(`${p}${g}${y}`)}}function r(c,a){return a&&a.key!=null?String(a.key):i(c)}function i(c){if(c&&typeof c=="object"){let a=n.get(c);return a===void 0&&(a=`#${m++}`,n.set(c,a)),a}return String(c)}const n=new WeakMap;let m=0}),Ve("packages/core/src/model/shadow.js",function(e,D){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"HISTORY_TICK_MAX_MS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"HISTORY_TICK_MIN_MS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"CLUSTER_SHADOW_KINDS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"DEFAULT_ANOMALY_THRESHOLD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"SPEC_STATUS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"POSITIONAL_KINDS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"SHADOW_LABELS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"specStatusOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ShadowTracker",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"shadowsIn",{enumerable:!0,get:function(){return a}});const A=D("packages/core/src/internal/warn.js").warnOnce,Y=2e5,I=20,L=1e3,Q=50;function H(u){return Math.min(L,Math.max(Q,Math.floor(u)))}const $=Object.freeze(["updates","updatedAt","sinceUpdate","delta","deltaPercent","rate","history","firstValue","streak","rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag","specStatus","rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta","fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD","cluster","clusterDistance"]),X=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),F=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),j=Object.freeze(["cluster","clusterDistance"]),v=.6745,b=3.5,l=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,h){if(!h)return null;const p=Number.isFinite(Number(h.lower))?Number(h.lower):null,y=Number.isFinite(Number(h.upper))?Number(h.upper):null;if(p===null&&y===null||!Number.isFinite(u))return null;if(p!==null&&u<p||y!==null&&u>y)return l.FAIL;const d=Number.isFinite(Number(h.warnLower))?Number(h.warnLower):null,f=Number.isFinite(Number(h.warnUpper))?Number(h.warnUpper):null;return d!==null&&u<d||f!==null&&u>f?l.WARN:l.PASS}function s(u,h,p){if(!h||typeof h!="object")return null;if(h.kind!=="time")return h.kind!==void 0&&A(`shadow.history.window.kind:${u}`,`a 'history' shadow's 'window' only accepts {kind: 'time', span}; '${h.kind}' is not honoured (a plain count is already what 'depth' means, and a session has no span to divide into buckets), so it reported the original, unwindowed history.`),null;const y=h.minutes!=null?Number(h.minutes)*6e4:Number(h.span);if(!(y>0))return A(`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 d=Math.max(2,Math.floor(p)||I);return{span:y,bucketMs:Math.max(1,Math.floor(y/d))}}class r{#e;#t=new Map;#n=new Map;#r=new Map;#s=new Map;#i=new Map;#a=new Map;#l=0;#o;#c;#u;#f;#d=new Map;#h=null;#p=null;#m=null;constructor(h){this.#e=h.colId,this.#o=Math.max(2,h.depth||I),this.#c=Math.max(1,h.max||Y),this.#u=h.now||(()=>Date.now()),this.#f=s(this.#e,h.historyWindow,this.#o),this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#f}observe(h,p){const y=c(p);if(y===null)return;if(!this.#n.has(h)){this.#p=null,this.#m=null,this.#g(),this.#t.set(h,y),this.#n.set(h,y),this.#r.set(h,0),this.#s.set(h,this.#u()),this.#i.set(h,[y]),this.#f&&this.#d.set(h,[y]),this.#a.set(h,0);return}const d=this.#n.get(h);if(d===y)return;this.#p=null,this.#m=null,this.#n.set(h,y),this.#r.set(h,(this.#r.get(h)||0)+1),this.#s.set(h,this.#u());const f=this.#i.get(h)||[];f.push(y),f.length>this.#o&&f.splice(0,f.length-this.#o),this.#i.set(h,f);const w=Math.sign(y-d),k=this.#a.get(h)||0;this.#a.set(h,Math.sign(k)===w?k+w:w)}#g(){if(this.#n.size<this.#c)return;const h=this.#n.keys().next().value;h!==void 0&&(this.#t.delete(h),this.#n.delete(h),this.#r.delete(h),this.#s.delete(h),this.#i.delete(h),this.#d.delete(h),this.#a.delete(h),this.#l++)}rebase(){for(const[h,p]of this.#n)this.#t.set(h,p);this.#p=null,this.#m=null}reset(){this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#s.clear(),this.#i.clear(),this.#d.clear(),this.#a.clear(),this.#l=0,this.#p=null,this.#m=null,this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}retain(h){const p=h instanceof Set?h:new Set(h);let y=0;for(const d of[...this.#n.keys()])p.has(d)||(this.#t.delete(d),this.#n.delete(d),this.#r.delete(d),this.#s.delete(d),this.#i.delete(d),this.#d.delete(d),this.#a.delete(d),y++);return y&&(this.#p=null,this.#m=null),y}advanceHistoryWindow(h=this.#u()){const p=this.#f;if(!p)return 0;const y=Math.floor(h/p.bucketMs),d=y-this.#h;if(!(d>0))return 0;const f=Math.min(d,this.#o);for(const[w,k]of this.#d){const P=this.#n.get(w);for(let G=0;G<f;G++)k.push(P);k.length>this.#o&&k.splice(0,k.length-this.#o)}return this.#h=y,d}read(h,p,y,d){switch(h){case"updates":return this.#r.has(p)?this.#r.get(p):0;case"updatedAt":{const f=this.#s.get(p);return f===void 0?null:new Date(f)}case"sinceUpdate":{const f=this.#s.get(p);return f===void 0?null:this.#u()-f}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 f=this.#t.get(p);return f?(this.#n.get(p)-f)/Math.abs(f)*100:null}case"rate":{const f=this.#i.get(p),w=this.#s.get(p);if(!f||f.length<2||w===void 0)return null;const k=this.#u()-w,P=f[f.length-1]-f[f.length-2];return k>0?P/k*1e3:P}case"history":return this.#f?this.#d.has(p)?[...this.#d.get(p)]:null:this.#i.has(p)?[...this.#i.get(p)]:null;case"streak":return this.#a.has(p)?this.#a.get(p):0;case"specStatus":return this.#n.has(p)?t(this.#n.get(p),d):null;default:return g.includes(h)?this.#O(h,p,y,d):null}}#b(h){if(h){if(this.#m&&this.#m.only===h)return this.#m.view;const p=this.#y(h);return this.#m={only:h,view:p},p}return this.#p?this.#p:(this.#p=this.#y(null),this.#p)}#y(h){const p=[];for(const[B,E]of this.#n)h&&!h.has(B)||p.push(E);const y=p.sort((B,E)=>B-E);let d=0,f=0,w=0,k=0;for(const B of y){k+=B,d++;const E=B-f;f+=E/d,w+=E*(B-f)}const P=[];for(const[B,E]of this.#t)h&&!h.has(B)||P.push(E);const G=d?i(y):0,K=y.map(B=>Math.abs(B-G)).sort((B,E)=>B-E),q=d?i(K):0;return{sorted:y,baseline:P.sort((B,E)=>B-E),sum:k,mean:d?f:0,sd:d>1?Math.sqrt(w/(d-1)):0,median:G,mad:q}}#O(h,p,y,d){if(!this.#n.has(p)||y&&!y.has(p))return null;const f=this.#n.get(p),w=this.#b(y),k=w.sorted.length;if(!k)return null;switch(h){case"rank":return k-m(w.sorted,f)+1;case"rankAsc":return n(w.sorted,f)+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=k-m(w.sorted,f)+1;return P-G}case"percentile":return m(w.sorted,f)/k*100;case"quartile":{const P=m(w.sorted,f)/k;return Math.min(4,Math.max(1,Math.ceil(P*4)))}case"zScore":return w.sd?(f-w.mean)/w.sd:null;case"anomalyScore":return w.mad?v*(f-w.median)/w.mad:null;case"anomalyFlag":{if(!w.mad)return null;const P=d&&Number.isFinite(Number(d.threshold))?Number(d.threshold):b;return Math.abs(v*(f-w.median)/w.mad)>P}case"shareOfTotal":return w.sum?f/w.sum*100:null;default:return null}}}function i(u){const h=u.length;if(!h)return 0;const p=(h-1)*.5,y=Math.floor(p),d=Math.ceil(p);return y===d?u[y]:u[y]+(p-y)*(u[d]-u[y])}function n(u,h){let p=0,y=u.length;for(;p<y;){const d=p+y>>1;u[d]<h?p=d+1:y=d}return p}function m(u,h){let p=0,y=u.length;for(;p<y;){const d=p+y>>1;u[d]<=h?p=d+1:y=d}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 h=typeof u=="number"?u:Number(u);return Number.isFinite(h)?h:null}function a(u){const h=[];for(const p of u||[]){const y=p.shadow;if(!y)continue;const d=typeof y=="string"?{kind:y}:y,f=d.kind;$.includes(f)&&(X.includes(f)||F.includes(f)||j.includes(f)||h.push({colId:p.id||p.field,of:d.of||p.field||p.id,kind:f,depth:d.depth,historyWindow:f==="history"?d.window:void 0}))}return h}}),Ve("packages/core/src/columns/model.js",function(e,D){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return xe}});const re=D("packages/core/src/internal/merge.js"),A=re.expand,Y=re.merge,I=re.toArray,L=D("packages/core/src/internal/warn.js"),Q=L.fail,H=L.warnOnce,$=D("packages/core/src/internal/paths.js"),X=$.getPath,F=$.pathGetter,j=$.pathSetter,b=D("packages/core/src/internal/text.js").humanise,l=D("packages/core/src/internal/predicates.js"),g=l.isFunction,o=l.isObject,s=D("packages/core/src/internal/uid.js").uid,i=D("packages/core/src/format/index.js").compileFormat,n=D("packages/core/src/columns/datatypes.js"),m=n.comparatorFor,c=n.createTypeRegistry,a=n.storageKind,u=D("packages/core/src/columns/infer.js"),h=u.inferColumnType,p=u.DEFAULT_SAMPLE,y=D("packages/core/src/columns/graph.js"),d=y.buildGraph,f=y.affectedBy,k=D("packages/core/src/columns/lookup.js").createLookup,P=D("packages/core/src/columns/value.js"),G=P.compileDisplay,K=P.ValuePipeline,q=P.warnImpureUse,B=D("packages/core/src/model/shadow.js"),E=B.FIT_SHADOW_KINDS,S=B.CLUSTER_SHADOW_KINDS,C=Object.freeze({geometry:"geometry",list:"list"}),N={value:{pure:!0},cell:{},edit:{enabled:!1},sort:{enabled:!0,direction:null,order:0,nullsFirst:!1},filter:{enabled:!0,type:"text"},group:{enabled:!1,index:-1,explode:!1},pivot:{enabled:!1,index:-1},total:null,layout:{width:150,min:40,max:null,flex:0,pin:null,hidden:!1,resizable:!0,movable:!0,lockVisible:!1,lockPosition:!1},header:{},facet:{},export:{lookup:"label",csv:!0,excel:!0},allowGroup:!0,allowPivot:!0,allowTotal:!0,nullable:!0,quickFilter:!0},O={centre:"center"},T=new Set(["start","center","end","left","right"]);function R(ve){if(typeof ve!="string")return;const oe=ve.toLowerCase();return O[oe]?O[oe]:T.has(oe)?oe:void 0}function x(ve){if(typeof ve!="string")return;const oe=ve.toLowerCase();return oe==="center"||oe==="centre"?"middle":oe==="top"||oe==="middle"||oe==="bottom"?oe:void 0}const U=["cell","layout","header"];function V(ve){if(!o(ve))return{};const oe={...ve},he=(ae,se)=>{if(ve[ae]===void 0)return;const de=A(ve[ae],se);de&&U.includes(ae)&&!o(ve[ae])&&delete de.enabled,oe[ae]=de};return he("sort","direction"),he("filter","type"),he("cell","render"),he("edit","editor"),he("layout","width"),he("group","index"),he("pivot","index"),he("header","render"),he("facet","strategy"),oe}function J(ve,oe){const he={...ve||{}},ae=o(oe)&&o(oe.layout)&&oe.layout.width!==void 0;return he.fit==="content"&&!ae&&delete he.width,he}const _=new Set(["allowGroup","allowPivot","allowTotal","cell","colSpan","contextMenu","diff","edit","export","facet","field","filter","filterRow","format","grandTotal","group","groupTotal","header","headerControls","id","layout","lookup","nullable","pivot","preset","quickFilter","rowSpan","running","shadow","showWhen","sort","spec","tags","title","total","type","typeOptions","validation","value","verticalAlign"]),ee=new Set(["collapsible","columns","facet","header","id","marryChildren","openByDefault","showWhen","title"]);function W(ve,oe,he,ae){const se=he==="columnGroup"?"column group":"column";for(const de of Object.keys(ve))if(!oe.has(de)){if(de==="timeZone"&&he==="column"){H("column.timeZone",`\`timeZone\` is not a column option, so it had no effect on column "${ae}". 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}H(`${he}.unknown:${de}`,`'${de}' is not a configuration key this grid recognises, so it had no effect on ${se} "${ae}". Check the spelling against the reference.`)}}function Z(ve){o(ve.cell)&&ve.cell.autoHeight!==void 0&&H("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${ve.id||ve.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function ne(ve,oe){const he=oe&&g(ve.defaultsFor)?ve.defaultsFor(oe):null,ae={...ve.defaults||{},...o(he)?he:{}},se={};return ae.align&&(se.align=ae.align,se.cell={align:ae.align},se.header={align:ae.align}),ae.filter&&(se.filter=ae.filter==="none"?{enabled:!1,type:"none"}:{enabled:!0,type:ae.filter}),ae.editor&&(se.edit=ae.editor==="none"?{editor:null}:{editor:ae.editor}),ae.total&&(se.total=ae.total),ae.render&&(se.cell={...se.cell||{},render:ae.render}),ve.export&&(se.export={...ve.export}),se}function ie(ve){if(typeof ve=="string")return ve.trim()?[ve.trim()]:[];if(!Array.isArray(ve))return[];const oe=[];for(const he of ve){if(typeof he!="string")continue;const ae=he.trim();ae&&!oe.includes(ae)&&oe.push(ae)}return oe}class ce{#e=new Map;#t=[];#n=[];#r=new WeakMap;#s;#i;#a;#l;#o;#c;#u(oe,he,ae){if(oe&&typeof oe=="object"&&!g(oe)){const Ae=oe;return(typeof Ae.fn!="string"||!Ae.fn)&&Q(`column "${ae}": a total given as an object needs a \`fn\` name, such as { fn: 'percentile', p: 0.9 }.`),Ae.fn==="percentile"&&!(typeof Ae.p=="number"&&Ae.p>=0&&Ae.p<=1)&&Q(`column "${ae}": { fn: 'percentile' } needs \`p\`, a number from 0 to 1 (0.9 for the 90th percentile).`),this.#f(Ae.fn,he,ae),Object.freeze({...Ae})}const se=this.#f(oe,he,ae);if(typeof se!="string"||!this.#d)return se??null;const de=he&&he.totals&&he.totals.implement;if(de&&g(de[se])){const Ae=de[se];return Ae.totalName=se,Ae}const ke=this.#d.totalFn?.(se);return g(ke)?ke:se}#f(oe,he,ae){if(typeof oe!="string")return oe;const se=he&&he.totals&&he.totals.supported;if(!Array.isArray(se)||se.includes(oe))return oe;const de=se.length?se.join(", "):"none";return Q(`column "${ae}" is typed ${he.name||"a type"}, for which the total "${oe}" is not meaningful. Supported: ${de}. Aggregating it anyway would produce a confident wrong number.`),oe}#d;#h;#p;#m;#g;#b;#y=!1;#O;#w;constructor(oe={}){this.#i=V(oe.columnDefaults||{}),this.#a=oe.columnPresets||{},this.#o=oe.locale,this.#l=oe.timeZone,this.#c=x(oe.verticalAlign),this.#d=oe.registry||null,this.#h=oe.grid||null,this.#p=oe.context,this.#O=oe.sampleSize??p,this.#w=oe.onChange||null,this.#b=g(oe.rowKey)?oe.rowKey:void 0,this.#s=c(oe.dataTypes,this.#d);const{leaves:he,groups:ae}=xe(oe.columns||[]);this.#n=ae;for(const se of he){se.facet!==void 0&&this.#r.set(se.def,se.facet);const de=this.#A(se.def,null);if(de.groupPath=se.path,this.#e.has(de.id)){H(`columns.duplicate:${de.id}`,`two columns resolve to the id '${de.id}', so the second is ignored. An id defaults to the column's field, so declare an explicit \`id\` when two columns read the same field.`);continue}se.column=de,this.#e.set(de.id,de),this.#t.push(de.id)}this.#P(oe.stored||null)}#A(oe,he){W(oe,_,"column",oe.id||oe.field||"(unnamed)"),Z(oe);const ae=V(oe),se=I(oe.preset),de=se.map(Ie=>{const We=this.#a[Ie];return We?V(We):(H(`preset:${Ie}`,`unknown column preset "${Ie}"; ignoring`),{})}),ke=this.#S(ae,de,he),Ae=this.#s.get(ke)||this.#s.get("text");if(!this.#s.has(ke)&&oe.type){const Ie=C[ke];H(`type:${ke}`,`unknown data type "${ke}"; falling back to "text"`+(Ie?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${Ie}'.`:""))}const Te=g(Ae.items)?this.#C(ae,de,oe.id||oe.field||"(unnamed)"):null;let je=N;je=Y(je,this.#i),oe.type!==!1&&(je=Y(je,ne(Ae,Te)));for(const Ie of de)je=Y(je,Ie);this.#r.has(oe)&&(je=Y(je,V({facet:this.#r.get(oe)}))),je=Y(je,ae);const ye=je.edit;ye&&ye.editor&&ye.enabled!==!0&&!g(ye.enabled)&&(oe.edit||{}).editor&&H(`column.editor-not-enabled:${oe.id||oe.field}`,`column '${oe.id||oe.field}' names the editor '${ye.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const He=oe.id||oe.field||s("col");if(oe.shadow&&!g(je.value&&je.value.compute)){const Ie=typeof oe.shadow=="string"?{kind:oe.shadow}:oe.shadow,We=Ie.of||oe.field||He,Ye=E.includes(Ie.kind),nt=S.includes(Ie.kind),Qe=Ye?Ie.model||Ie:null,dt=Ye&&Qe?[...Array.isArray(Qe.predictors)?Qe.predictors:[],Qe.response].filter(Boolean):null,jt=nt?(Array.isArray(Ie.columns)?Ie.columns:[]).filter(Boolean):null;je.value={...je.value||{},deps:jt&&jt.length?jt:dt&&dt.length?dt:Ie.orderBy&&Ie.orderBy!==We?[We,Ie.orderBy]:[We],pure:!1,compute:(Et,it)=>{const ft=it.grid&&it.grid.statistics;if(!ft)return null;const pt=it.row&&it.row.key||ft.keyOf(it.data);if(!pt)return null;if(Ye){if(!g(ft.fitShadow))return null;const Tt=Ie.model?{...Ie.model,threshold:Ie.threshold}:Ie;return ft.fitShadow(Ie.kind,pt,Tt)}return nt?g(ft.clusterShadow)?ft.clusterShadow(Ie.kind,pt,Ie):null:ft.shadow(We,Ie.kind,pt,Ie.scope,Ie)}}}if(oe.running&&!g(je.value&&je.value.compute)){const Ie=typeof oe.running=="string"?{kind:oe.running}:oe.running,We=Ie.of||oe.field||He;je.value={...je.value||{},deps:[We],pure:!1,compute:(Ye,nt)=>{const Qe=nt.grid&&nt.grid.statistics;if(!Qe||!g(Qe.running))return null;const dt=nt.row&&nt.row.key||Qe.keyOf(nt.data);return dt?Qe.running(We,Ie.kind||"total",dt):null}},oe.sort===void 0&&(je.sort={...je.sort||{},enabled:!1})}const Me=oe.field??(g(je.value&&je.value.compute)?null:oe.id??null),Re=g(je.value&&je.value.compute),Ee={id:He,field:Me,shadow:oe.shadow||null,running:oe.running||null,spec:oe.spec||null,validation:oe.validation||null,volatile:!!(oe.shadow||oe.running),title:je.title??b(Me||He),type:Ae.name,dataType:Ae,itemType:Te,nullable:je.nullable!==!1,align:R(ae.cell&&ae.cell.align||ae.align||je.cell&&je.cell.align||je.align||Ae.defaults&&Ae.defaults.align)||"start",verticalAlign:x(ae.cell&&ae.cell.verticalAlign||ae.verticalAlign||je.cell&&je.cell.verticalAlign||je.verticalAlign)||this.#c,rowSpan:g(je.rowSpan)?je.rowSpan:null,colSpan:g(je.colSpan)?je.colSpan:null,value:{pure:!0,...je.value||{}},cell:{...je.cell||{}},edit:{...je.edit||{}},sort:{...je.sort||{}},filter:{...je.filter||{}},group:{enabled:!1,index:-1,explode:!1,...je.group||{}},pivot:{enabled:!1,index:-1,...je.pivot||{}},total:this.#u(je.total,Ae,oe.id||oe.field||"(unnamed)"),groupTotal:je.groupTotal===void 0?null:this.#u(je.groupTotal,Ae,oe.id||oe.field||"(unnamed)"),grandTotal:je.grandTotal===void 0?null:this.#u(je.grandTotal,Ae,oe.id||oe.field||"(unnamed)"),tags:ie(je.tags),typeOptions:je.typeOptions??null,...o(je[ke])?{[ke]:je[ke]}:{},layout:J(je.layout,ae),header:{...je.header||{}},contextMenu:je.contextMenu===void 0?null:je.contextMenu,facet:{...je.facet||{}},export:{...je.export||{}},allowGroup:je.allowGroup!==!1,allowPivot:je.allowPivot!==!1,allowTotal:je.allowTotal!==!1,quickFilter:je.quickFilter!==!1,def:oe,format:je.format,presets:se,inferred:he!=null&&!oe.type,computed:Re,diff:oe.diff===void 0?void 0:!!oe.diff,read:Me?F(Me):null,write:Me?j(Me):null};Ee.cell.align=R(ae.cell&&ae.cell.align)||Ee.align,Ee.header.align=R(ae.header&&ae.header.align)||Ee.align;const $e=je.lookup||null;return Ee.lookup=$e?k({id:He,lookup:$e},{locale:this.#o,onChange:()=>{this.#w&&this.#w("lookup",{colId:He})}}):null,Ee.group.explode&&Ee.lookup&&Ee.lookup.multiple&&H(`explode:${He}`,`column "${He}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(Ee),Ee}#v(oe){oe.formatter=i(oe.format,oe.dataType,this.#o,this.#l,oe.id),oe.formatValue=G(oe,{locale:this.#o,grid:this.#h,context:this.#p}),oe.itemCompare=oe.itemType?m(oe.itemType,this.#o):null,oe.compare=g(oe.value.compare)?oe.value.compare:oe.lookup?oe.lookup.comparator():g(oe.dataType.compareFor)?oe.dataType.compareFor(oe):m(oe.dataType,this.#o),oe.excel=oe.formatter&&oe.formatter.ooxml||oe.dataType&&oe.dataType.excel||"General",oe.storeKind=a(oe.dataType,!!(oe.lookup&&oe.lookup.multiple))}#C(oe,he,ae){let se=o(oe.typeOptions)?oe.typeOptions:null;for(let Te=he.length-1;!se&&Te>=0;Te--)o(he[Te].typeOptions)&&(se=he[Te].typeOptions);!se&&o(this.#i.typeOptions)&&(se=this.#i.typeOptions);const de=se&&se.of!==void 0?se.of:"text",ke=typeof de=="string"?this.#s.get(de):void 0;return ke&&!g(ke.items)&&ke.storage!=="object"?ke:(H(`type:of:${String(de)}`,`column "${ae}" names "${String(de)}" as its item type (typeOptions.of), which is not ${ke?"a scalar data type":"a known data type"}; its items are read as text.`),this.#s.get("text"))}#S(oe,he,ae){if(oe.type===!1)return"text";if(oe.type)return oe.type;for(let se=he.length-1;se>=0;se--)if(he[se].type)return he[se].type;if(this.#i.type)return this.#i.type;if(oe.shadow){const se=typeof oe.shadow=="string"?oe.shadow:oe.shadow.kind;if(se==="fitInfluence")return"boolean";if(se==="fitPredicted"||se==="fitResidual"||se==="fitStdResidual"||se==="fitLeverage"||se==="fitCooksD"||se==="tsTrend"||se==="tsSeasonal"||se==="tsResidual"||se==="tsCoverage"||se==="tsSmoothed"||se==="tsSmoothingAlpha"||se==="tsSmoothingBeta"||se==="cluster"||se==="clusterDistance")return"number"}return ae||(oe.lookup?"lookup":"text")}#P(oe){const he=this.all();this.#m=d(he),this.#g?this.#g.setGraph(this.#m):this.#g=new K({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:oe||null,rowKey:this.#b});const ae=this.#g;for(const se of he)se.getValue=(de,ke)=>ae.value(se,de,ke)}all(){return this.#t.map(oe=>this.#e.get(oe))}visible(){return this.all().filter(oe=>!oe.layout.hidden)}get(oe){return this.#e.get(oe)}groups(){const oe=he=>{const ae=[];for(const se of he)Array.isArray(se.columns)?ae.push({...se,columns:oe(se.columns)}):se.column&&ae.push(se.column);return ae};return oe(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#s}affectedBy(oe){return f(this.#m,oe)}value(oe,he,ae){return this.#g.value(oe,he,ae)}text(oe,he,ae){return this.#g.text(oe,he,ae)}checkImpure(oe,he){q(this.#e.get(oe),he)}setLocale(oe){this.#o=oe;for(const he of this.all())he.lookup&&he.lookup.setLocale(oe),this.#v(he);this.#w&&this.#w("locale",{locale:oe})}infer(oe){const he={};if(this.#y||!Array.isArray(oe)||oe.length===0)return he;this.#y=!0;let ae=!1;for(const se of this.all()){const de=se.def;if(de.type!==void 0||!se.field||se.computed||se.lookup||this.#E(se))continue;const ke=se.read||(je=>X(je,se.field)),Ae=h(se.id,oe,ke,this.#s,{sampleSize:this.#O});if(Ae===se.type)continue;he[se.id]=Ae;const Te=this.#A(de,Ae);Te.groupPath=se.groupPath,Te.layout={...Te.layout,...me(se.layout)},this.#e.set(se.id,Te),_e(this.#n,se.id,Te),ae=!0}return ae&&this.#P(null),he}redecorate(oe,he,ae={}){const se=this.#e.get(oe);if(!se){H(`redecorate:${oe}`,`columns.decorate('${oe}', …): no column with id '${oe}'.`);return}const de=se.def||{},ke={...o(de.cell)?de.cell:{}};ke.decoration=he??void 0,ae&&"variant"in ae&&(ke.variant=ae.variant);const Ae={...de,cell:ke};this.#r.has(de)&&this.#r.set(Ae,this.#r.get(de));const Te=this.#A(Ae,se.type);return Te.groupPath=se.groupPath,Te.layout={...Te.layout,...me(se.layout)},se.lookup&&se.lookup!==Te.lookup&&g(se.lookup.destroy)&&se.lookup.destroy(),this.#e.set(oe,Te),_e(this.#n,oe,Te),this.#P(null),this.#w&&this.#w("decorate",{colId:oe}),Te}destroy(){for(const oe of this.#e.values())oe.lookup&&g(oe.lookup.destroy)&&oe.lookup.destroy()}#E(oe){for(const he of oe.presets){const ae=this.#a[he];if(ae&&ae.type)return!0}return!!this.#i.type}#T(oe){return!oe.computed&&g(oe.dataType&&oe.dataType.toStorage)}storeReader(oe){if(oe.computed)return he=>this.#g.value(oe,he,null);if(this.#T(oe)){const he=oe.dataType.toStorage,ae=oe.format&&typeof oe.format=="object"&&!Array.isArray(oe.format)?oe.format.locale:void 0,se={timeZone:this.#l,colId:oe.id,itemType:oe.itemType||null,locale:ae||this.#o};return de=>he(oe.read(de),se)}return oe.read}storeValue(oe,he){if(!(!oe||oe.computed)&&g(oe.read))return this.storeReader(oe)(he)}storeSchema(){const oe=[];for(const he of this.all()){if(he.computed&&he.value.pure===!1||!he.computed&&!he.field)continue;const ae=this.storeReader(he);let se=null;!he.computed&&!this.#T(he)&&typeof he.field=="string"&&!he.lookup&&(se=he.field);const de={id:he.id,kind:he.storeKind,nullable:he.nullable,read:ae};se!==null&&(de.field=se),he.lookup&&(de.dictionary=he.lookup.dictionary()),oe.push(de)}return oe}state(){return this.all().map(oe=>({id:oe.id,width:oe.layout.width,flex:oe.layout.flex||void 0,hidden:!!oe.layout.hidden,headerWrap:oe.header?.wrap===!0?!0:void 0,headerOrientation:oe.header?.orientation==="vertical"?"vertical":void 0,pin:oe.layout.pin??null,sort:oe.sort.direction??null,sortIndex:oe.sort.direction?oe.sort.order??0:null,groupIndex:oe.group.enabled?oe.group.index??0:null,pivotIndex:oe.pivot.enabled?oe.pivot.index??0:null,total:typeof oe.total=="string"?oe.total:null,groupTotal:typeof oe.groupTotal=="string"?oe.groupTotal:void 0,grandTotal:typeof oe.grandTotal=="string"?oe.grandTotal:void 0,decoration:oe.cell&&oe.cell.decoration!=null?Ce(oe.cell.decoration):void 0,variant:oe.cell&&oe.cell.variant!=null?Ce(oe.cell.variant):void 0}))}applyState(oe,he={}){const ae={applied:[],skipped:[]},se=Array.isArray(oe)?oe:oe&&oe.columns||[],de=!Array.isArray(oe)&&oe&&oe.columnOrder||null;for(const Ae of se){if(!Ae||!Ae.id){ae.skipped.push({key:"?",reason:"no id"});continue}let Te=this.#e.get(Ae.id);if(!Te){ae.skipped.push({key:Ae.id,reason:"unknown column"});continue}if(Object.hasOwn(Ae,"decoration")||Object.hasOwn(Ae,"variant")){const je=Te.cell?Te.cell.decoration:void 0,ye=Ae.decoration??null,He=Object.hasOwn(Ae,"variant"),Me=He&&!Pe(Te.cell?Te.cell.variant:void 0,Ae.variant);(!Pe(je,ye)||Me)&&(this.redecorate(Ae.id,ye,He?{variant:Ae.variant??void 0}:{}),Te=this.#e.get(Ae.id)||Te)}Ae.width!=null&&(Te.layout.width=Ae.width),Ae.flex!=null&&(Te.layout.flex=Ae.flex),Ae.hidden!=null&&(Te.layout.hidden=!!Ae.hidden),Ae.headerWrap!==void 0&&(Te.header.wrap=!!Ae.headerWrap),Ae.headerOrientation!==void 0&&(Te.header.orientation=Ae.headerOrientation==="vertical"?"vertical":"horizontal"),Ae.pin!==void 0&&(Te.layout.pin=Ae.pin),Ae.sort!==void 0&&(Te.sort.direction=Ae.sort),Ae.sortIndex!=null&&(Te.sort.order=Ae.sortIndex),Ae.groupIndex!=null&&(Te.group.enabled=!0,Te.group.index=Ae.groupIndex),Ae.pivotIndex!=null&&(Te.pivot.enabled=!0,Te.pivot.index=Ae.pivotIndex),Ae.total!==void 0&&(Te.total=Ae.total),Ae.groupTotal!==void 0&&(Te.groupTotal=Ae.groupTotal),Ae.grandTotal!==void 0&&(Te.grandTotal=Ae.grandTotal),ae.applied.push(Ae.id)}const ke=de||(he&&he.keepOrder?[]:se.map(Ae=>Ae&&Ae.id).filter(Boolean));if(ke.length){const Ae=ke.filter(je=>this.#e.has(je)),Te=this.#t.filter(je=>!Ae.includes(je));this.#t=[...Ae,...Te]}return this.#w&&this.#w("state",ae),ae}move(oe,he){this.#M(oe,he)&&(this.#R(),this.#w&&this.#w("move",{id:oe,to:he}))}reorder(oe){const he={applied:[],skipped:[]},ae=[];let se=0;for(const de of Array.isArray(oe)?oe:[]){const ke=se++;this.#M(de,ke)&&(he.applied.push(de),ae.push({id:de,to:ke}))}if(!ae.length)return he;if(this.#R(),this.#w)for(const de of ae)this.#w("move",de);return he}#M(oe,he){const ae=this.#t.indexOf(oe);if(ae===-1||Math.max(0,Math.min(Number(he)||0,this.#t.length-1))===ae)return!1;const de=this.#e.get(oe);if(de.layout.movable===!1||de.layout.lockPosition)return H(`move:${oe}`,`column "${oe}" is not movable; the move was ignored`),!1;const ke=this.#N(oe,he);return ke?(H(`move.married:${ke}`,`band "${ke}" declares marryChildren, so its columns stay together; the move was ignored`),!1):(this.#t.splice(ae,1),this.#t.splice(Math.max(0,Math.min(he,this.#t.length)),0,oe),!0)}#N(oe,he){if(!this.#n||!this.#n.length)return null;const ae=this.#t.filter(Ae=>Ae!==oe),se=Math.max(0,Math.min(he,ae.length)),de=(Ae,Te)=>{if(Array.isArray(Ae.columns)){for(const ye of Ae.columns)de(ye,Te);return Te}const je=Ae.column?Ae.column.id:Ae.id;return je&&Te.push(je),Te},ke=Ae=>{for(const Te of Ae){if(!Array.isArray(Te.columns))continue;if(Te.marryChildren===!0){const ye=de(Te,[]),He=ye.includes(oe),Me=ye.map(Re=>ae.indexOf(Re)).filter(Re=>Re>=0);if(Me.length){const Re=Math.min(...Me),Ee=Math.max(...Me);if(He?se<Re||se>Ee+1:se>Re&&se<=Ee)return Te.id}}const je=ke(Te.columns);if(je)return je}return null};return ke(this.#n)}#R(){const oe=new Map(this.#t.map((se,de)=>[se,de])),he=se=>{if(!Array.isArray(se.columns)){const ke=se.column?se.column.id:se.id;return oe.has(ke)?oe.get(ke):1/0}let de=1/0;for(const ke of se.columns)de=Math.min(de,he(ke));return de},ae=se=>{se.sort((de,ke)=>he(de)-he(ke));for(const de of se)Array.isArray(de.columns)&&ae(de.columns)};ae(this.#n)}#I(oe){const he=ae=>{for(let se=0;se<ae.length;se++){const de=ae[se];if(Array.isArray(de.columns)){const ke=he(de.columns);if(ke)return ke}else if(de.column&&de.column.id===oe)return ae.splice(se,1)[0]}return null};return he(this.#n)}#K(oe){const he=[];for(let ae=oe.length-1;ae>=0;ae--){const se=oe[ae];Array.isArray(se.columns)&&(he.push(...this.#K(se.columns)),se.columns.length===0&&(he.push(se.id),oe.splice(ae,1)))}return he}#Y(){const oe=(he,ae,se)=>{for(const de of he)Array.isArray(de.columns)?oe(de.columns,[...ae,de.id]):de.column&&(de.column.groupPath=ae)};oe(this.#n,[])}#x(oe){const he=new Set(oe),ae=this.#t.filter(Ae=>he.has(Ae));if(!ae.length)return;const se=Math.min(...ae.map(Ae=>this.#t.indexOf(Ae))),de=this.#t.slice(0,se).filter(Ae=>!he.has(Ae)),ke=this.#t.slice(se).filter(Ae=>!he.has(Ae));this.#t=[...de,...ae,...ke]}#U(oe){const he=[],ae=se=>{if(Array.isArray(se.columns))for(const de of se.columns)ae(de);else se.column&&he.push(se.column.id)};return ae(oe),he}#D(oe){const he=ae=>{for(const se of ae){if(!Array.isArray(se.columns))continue;if(se.id===oe)return{node:se,parent:ae};const de=he(se.columns);if(de)return de}return null};return he(this.#n)}groupColumns(oe,he={}){const ae=I(oe).filter(Te=>this.#e.has(Te));if(!ae.length)return H("columns.group.empty","groupColumns was given no known column ids; nothing was grouped."),null;for(const Te of ae)if(this.#e.get(Te).layout.lockPosition)return H(`columns.group.locked:${Te}`,`column "${Te}" is position-locked and cannot be grouped.`),null;const se=he.groupId?this.#D(he.groupId):null;if(he.groupId&&!se)return H(`columns.group.unknown:${he.groupId}`,`no band "${he.groupId}" to add to; nothing was grouped.`),null;let de=null;if(!se&&he.id!=null&&(de=String(he.id),this.#D(de)||this.#e.has(de)))return H(`columns.group.idtaken:${de}`,`band id "${de}" is already in use; nothing was grouped.`),null;const ke=ae.map(Te=>this.#I(Te)).filter(Boolean);if(!ke.length)return null;let Ae;if(se)se.node.columns.push(...ke),Ae=se.node.id;else{const Te={id:de||s("grp"),title:he.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:ke},je=Number.isInteger(he.at)?Math.max(0,Math.min(he.at,this.#n.length)):this.#n.length;this.#n.splice(je,0,Te),Ae=Te.id}return this.#K(this.#n),this.#x(ae),this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"formed",groupId:Ae,ids:ae}),Ae}ungroupColumn(oe){const he=this.#e.get(oe);if(!he){H(`columns.ungroup.unknown:${oe}`,`no column "${oe}" to ungroup.`);return}const ae=he.groupPath||[];if(!ae.length)return;const se=ae[ae.length-1],de=this.#D(se);if(!de)return;const ke=this.#I(oe);if(!ke)return;const Ae=de.parent.indexOf(de.node);de.parent.splice(Ae+1,0,ke);const Te=this.#K(this.#n),je=this.#U(de.node);if(je.length){this.#x(je);const ye=Math.max(...je.map(Me=>this.#t.indexOf(Me))),He=this.#t.filter(Me=>Me!==oe);He.splice(ye+1,0,oe),this.#t=He}this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"removed",id:oe,dissolved:Te})}renameGroup(oe,he){const ae=this.#D(oe);if(!ae){H(`columns.group.rename:${oe}`,`no band "${oe}" to rename.`);return}ae.node.title=String(he??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:oe,title:ae.node.title})}dissolveGroup(oe){const he=this.#D(oe);if(!he){H(`columns.group.dissolve:${oe}`,`no band "${oe}" to dissolve.`);return}const ae=he.parent.indexOf(he.node);he.parent.splice(ae,1,...he.node.columns),this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:oe})}moveGroup(oe,he){const ae=this.#D(oe);if(!ae){H(`columns.group.move:${oe}`,`no band "${oe}" to move.`);return}const se=ae.parent,de=se.indexOf(ae.node);de!==-1&&(se.splice(de,1),se.splice(Math.max(0,Math.min(he,se.length)),0,ae.node),this.#X(),this.#Y(),this.#w&&this.#w("columngroup",{action:"moved",groupId:oe,to:he}))}#X(){const oe=[],he=se=>{for(const de of se)Array.isArray(de.columns)?he(de.columns):de.column&&oe.push(de.column.id)};he(this.#n);const ae=new Set(oe);this.#t=[...oe,...this.#t.filter(se=>!ae.has(se))]}groupTree(){const oe=ae=>ae.map(se=>Array.isArray(se.columns)?{id:se.id,title:se.title||"",collapsible:!!se.collapsible,openByDefault:se.openByDefault!==!1,columns:oe(se.columns)}:se.column?se.column.id:null).filter(se=>se!==null),he=oe(this.#n);return he.some(ae=>ae&&typeof ae=="object")?he:[]}applyGroupTree(oe){if(!Array.isArray(oe))return;const he=new Set,ae=de=>{const ke=[];for(const Ae of de)if(Ae&&typeof Ae=="object"&&Array.isArray(Ae.columns)){const Te=ae(Ae.columns);if(!Te.length)continue;ke.push({id:Ae.id||s("grp"),title:Ae.title||"",collapsible:Ae.collapsible===!0,openByDefault:Ae.openByDefault!==!1,showWhen:"always",marryChildren:!1,header:{},def:{},columns:Te})}else if(typeof Ae=="string"){const Te=this.#e.get(Ae);Te&&!he.has(Ae)&&(he.add(Ae),ke.push({column:Te,path:[]}))}return ke},se=ae(oe);for(const de of this.#t){if(he.has(de))continue;const ke=this.#e.get(de);ke&&se.push({column:ke,path:[]})}this.#n=se,this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"applied"})}show(oe){this.#V(oe,!1)}hide(oe){this.#V(oe,!0)}#V(oe,he){const ae=[];for(const se of I(oe)){const de=this.#e.get(se);if(de){if(he&&de.layout.lockVisible){H(`lockVisible:${se}`,`column "${se}" is \`layout.lockVisible\` and cannot be hidden`);continue}de.layout.hidden!==he&&(de.layout.hidden=he,ae.push(se))}}ae.length&&this.#w&&this.#w("visible",{ids:ae,hidden:he})}pin(oe,he){const ae=this.#e.get(oe);ae&&(ae.layout.pin=he??null,this.#w&&this.#w("pin",{id:oe,side:ae.layout.pin}))}pinMany(oe){const he={};for(const[se,de]of oe){const ke=this.#e.get(se);ke&&(ke.layout.pin=de??null,he[se]=ke.layout.pin)}const ae=Object.keys(he);ae.length&&this.#w&&this.#w("pin",{ids:ae,pins:he})}#_(oe,he){const ae=oe.layout.min??0,se=oe.layout.max;let de=Math.max(ae,he);return se!=null&&(de=Math.min(se,de)),oe.layout.width=de,oe.layout.flex=0,de}resize(oe,he){const ae=this.#e.get(oe);if(!ae)return;if(ae.layout.resizable===!1){H(`resize:${oe}`,`column "${oe}" is not resizable; the resize was ignored`);return}const se=this.#_(ae,he);this.#w&&this.#w("resize",{id:oe,width:se})}resizeMany(oe){const he={};for(const[se,de]of oe){const ke=this.#e.get(se);if(ke){if(ke.layout.resizable===!1){H(`resize:${se}`,`column "${se}" is not resizable; the resize was ignored`);continue}he[se]=this.#_(ke,de)}}const ae=Object.keys(he);ae.length&&this.#w&&this.#w("resize",{ids:ae,widths:he})}}function me(ve){const oe={};return ve.width!=null&&(oe.width=ve.width),ve.hidden!=null&&(oe.hidden=ve.hidden),ve.pin!==void 0&&(oe.pin=ve.pin),oe}function Ce(ve){if(ve===null||typeof ve!="object")return ve;try{return structuredClone(ve)}catch{}try{return JSON.parse(JSON.stringify(ve))}catch{return ve}}function Pe(ve,oe){const he=ve??null,ae=oe??null;if(he===ae)return!0;if(he===null||ae===null)return!1;if(typeof he!="object"||typeof ae!="object")return he===ae;try{return JSON.stringify(he)===JSON.stringify(ae)}catch{return!1}}function xe(ve){const oe=[],he=(se,de,ke)=>{const Ae=[];for(const Te of se){if(!o(Te)){Q("a column definition must be an object");continue}if(Array.isArray(Te.columns)){W(Te,ee,"columnGroup",Te.title||Te.id||"(unnamed)");const je={id:Te.id||s("grp"),title:Te.title||"",collapsible:Te.collapsible===!0,openByDefault:Te.openByDefault!==!1,showWhen:Te.showWhen||"always",marryChildren:Te.marryChildren===!0,header:Te.header||{},def:Te,columns:[]};je.columns=he(Te.columns,[...de,je.id],Te.facet!==void 0?Te.facet:ke),Ae.push(je)}else{const je={def:Te,path:de,facet:ke};oe.push(je),Ae.push(je)}}return Ae},ae=he(ve,[],void 0);return{leaves:oe,groups:ae}}function _e(ve,oe,he){for(const ae of ve){if(ae.columns){if(_e(ae.columns,oe,he))return!0;continue}if(ae.column&&ae.column.id===oe)return ae.column=he,!0}return!1}}),Ve("packages/core/src/columns/autogroup.js",function(e,D){"use strict";Object.defineProperty(e,"AUTO_GROUP_ID",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"createAutoGroupColumn",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"warnOnAbsurdGrouping",{enumerable:!0,get:function(){return X}});const A=D("packages/core/src/internal/warn.js").warnOnce,Y="__lattice_group",I=240,L=.5;function Q(F){const j=F.def&&F.def.layout;return(typeof j=="number"||j&&j.width!=null||F.def&&F.def.width!=null)&&Number.isFinite(F.layout.width)?F.layout.width:null}function H(F){const j=F.def&&F.def.layout;return!!(j&&j.min!=null)||F.def&&F.def.minWidth!=null}function $(F){const{columns:j,groupBy:v}=F,b=v.map(r=>j.get(r)).filter(Boolean),l=b.length?b.map(r=>r.title||r.id).join(" > "):"Group",g=b.find(r=>Q(r)!=null),o=F.config&&F.config.autoGroupColumnWidth||(g?Q(g):I);let t=g&&H(g)?g.layout.min:120;g&&!H(g)&&(t=Math.min(t,o));const s=g&&g.layout.max!=null?g.layout.max:null;return{id:Y,field:null,title:l,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group"},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!0},groupedIds:v.slice(),group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:o,min:t,max:s,pin:F.config&&F.config.autoGroupColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(r,i){return i&&i.group?i.groupValue:null},formatValue(r,i){if(!i||!i.group)return"";if(i.grandTotal)return F.config&&F.config.grandTotalLabel||"Total";const n=b[Math.min(i.level||0,b.length-1)];return n&&typeof n.formatValue=="function"?n.formatValue(r,i):r==null?"":String(r)}}}function X(F,j,v){!F.length||v<100||j<v*L||A(`grouping.cardinality:${F.join(",")}`,`grouping by ${F.join(", ")} produced ${j} groups for ${v} 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.`)}}),Ve("packages/core/src/columns/selectcolumn.js",function(e,D){"use strict";Object.defineProperty(e,"SELECT_COLUMN_ID",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"createSelectionColumn",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return I}});const re="__lattice_select",A=44;function Y(L){const Q=L.selection||{},H=L.config&&L.config.selectionColumnWidth||A;return{id:re,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:H,min:H,max:H,pin:L.config&&L.config.selectionColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,headerCheckbox:Q.headerCheckbox===!0,def:{},getValue($,X){return X?X.selected:!1},formatValue(){return""}}}const I=Y}),Ve("packages/core/src/columns/rownumbercolumn.js",function(e,D){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"createRowNumberColumn",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return X}});const A=D("packages/core/src/internal/predicates.js").isFunction,Y="__lattice_rownumber",I=40,L=9,Q=22;function H(F){const j=String(Math.max(1,Math.trunc(Math.abs(F))||1)).length;return Math.max(I,j*L+Q)}function $(F){const j=F.rowNumbers,v=j&&typeof j=="object"?j:{},b=Number.isFinite(v.start)?v.start:1,l=Number.isFinite(v.width)?v.width:H((F.maxNumber||0)+b),g=A(F.rank)?F.rank:()=>null;return{id:Y,field:null,title:typeof v.title=="string"?v.title:"",type:"number",dataType:{base:"number"},nullable:!0,align:"end",generated:!0,control:!0,value:{pure:!0},cell:{align:"end"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:l,min:l,max:l,pin:"start",hidden:!1,resizable:v.width==null,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(o,t){const s=g(t);return s==null?null:s-1+b},formatValue(o){return o==null?"":String(o)}}}const X=$}),Ve("packages/core/src/model/detail.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_DETAIL_HEIGHT",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"DEFAULT_CACHE_LIMIT",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"DetailModel",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return X}});const A=D("packages/core/src/internal/predicates.js").isFunction,I=D("packages/core/src/internal/warn.js").warnOnce,L=240,Q=10;function H(F){if(!F)return null;const j=F===!0?{}:F;return j.enabled===!1?null:!A(j.rows)&&!j.render?(I("detail.rows","detail is enabled but neither `rows` nor `render` was supplied; expanding a master would show an empty region, so it stays off."),null):{render:j.render||null,config:j.config||null,rows:A(j.rows)?j.rows:null,height:j.height??L,maxHeight:j.maxHeight??null,cacheLimit:Number.isFinite(j.cacheLimit)?Math.max(0,j.cacheLimit):Q,isMaster:A(j.isMaster)?j.isMaster:null,target:j.target||null,onCreate:A(j.onCreate)?j.onCreate:null,path:typeof j.path=="string"?j.path:null}}class ${#e;#t=new Set;#n;#r=0;constructor(j){this.#e=j.config,this.#n=A(j.onChange)?j.onChange:()=>{}}get config(){return this.#e}get inline(){return!this.#e.target}isMaster(j){if(!j||j.group||j.detail)return!1;const v=this.#e.isMaster;return v?!!v(j.data,j):!0}isOpen(j){return this.#t.has(j)}keys(){return[...this.#t]}activeKey(){for(const j of this.#t)return j;return null}heightOf(j){const v=this.#e.height;return A(v)?Number(v(j))||L:v==="auto"?L:Number(v)||L}open(j){return this.#t.has(j)?!1:(this.inline||this.#t.clear(),this.#t.add(j),this.#s(),!0)}close(j){return this.#t.delete(j)?(this.#s(),!0):!1}toggle(j){return this.#t.has(j)?(this.close(j),!1):(this.open(j),!0)}closeAll(){this.#t.size&&(this.#t.clear(),this.#s())}prune(j){if(!this.#t.size||!A(j))return;let v=!1;for(const b of[...this.#t])j(b)||(this.#t.delete(b),v=!0);v&&this.#s()}signature(){return`${this.#r}`}set(j){this.#t.clear();const v=Array.isArray(j)?j:[];for(const b of this.inline?v:v.slice(0,1))this.#t.add(b);this.#s()}#s(){this.#r++,this.#n()}}const X=$}),Ve("packages/core/src/compute/special.js",function(e,D){"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 H}}),Object.defineProperty(e,"normalCdf",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"studentT",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"chiSquareUpperTail",{enumerable:!0,get:function(){return o}});const re=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),A=3e-12,Y=1e-300;function I(t){if(t<.5)return Math.log(Math.PI/Math.sin(Math.PI*t))-I(1-t);const s=t-1;let r=.9999999999998099;const i=s+7.5;for(let n=0;n<re.length;n++)r+=re[n]/(s+n+1);return .5*Math.log(2*Math.PI)+(s+.5)*Math.log(i)-i+Math.log(r)}function L(t,s,r){const i=t+s,n=t+1,m=t-1;let c=1,a=1-i*r/n;Math.abs(a)<Y&&(a=Y),a=1/a;let u=a;for(let h=1;h<=300;h++){const p=2*h;let y=h*(s-h)*r/((m+p)*(t+p));a=1+y*a,Math.abs(a)<Y&&(a=Y),c=1+y/c,Math.abs(c)<Y&&(c=Y),a=1/a,u*=a*c,y=-(t+h)*(i+h)*r/((t+p)*(n+p)),a=1+y*a,Math.abs(a)<Y&&(a=Y),c=1+y/c,Math.abs(c)<Y&&(c=Y),a=1/a;const d=a*c;if(u*=d,Math.abs(d-1)<A)break}return u}function Q(t,s,r){if(!(t>0)||!(s>0)||!Number.isFinite(r))return Number.NaN;if(r<=0)return 0;if(r>=1)return 1;const i=Math.exp(I(t+s)-I(t)-I(s)+t*Math.log(r)+s*Math.log(1-r));return r<(t+1)/(t+s+2)?i*L(t,s,r)/t:1-i*L(s,t,1-r)/s}function H(t){if(!(t>0)||!(t<1))return t===0?-1/0:t===1?1/0:Number.NaN;const s=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],r=[-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,a,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,a=c*c,u=(((((s[0]*a+s[1])*a+s[2])*a+s[3])*a+s[4])*a+s[5])*c/(((((r[0]*a+r[1])*a+r[2])*a+r[3])*a+r[4])*a+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*$(-u/Math.SQRT2)-t)*Math.sqrt(2*Math.PI)*Math.exp(u*u/2);return u-p/(1+u*p/2)}function $(t){const s=Math.abs(t),r=2/(2+s),i=4*r-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,a;for(let h=n.length-1;h>0;h--)a=c,c=i*c-m+n[h],m=a;const u=r*Math.exp(-s*s+.5*(n[0]+i*c)-m);return t>=0?u:2-u}function X(t){return .5*$(-t/Math.SQRT2)}function F(t,s){if(!(s>0)||!Number.isFinite(t))return Number.NaN;const r=.5*Q(s/2,.5,s/(s+t*t));return t>0?1-r:r}function j(t,s){if(!(t>0)||!(t<1)||!(s>0))return Number.NaN;if(s>1e7)return H(t);let r=-1e4,i=1e4,n=H(t);const m=I(s/2)+I(.5)-I((s+1)/2);for(let c=0;c<60;c++){const a=F(n,s);a<t?r=n:i=n;const u=Math.exp(-((s+1)/2)*Math.log(1+n*n/s)-m)/Math.sqrt(s),h=u>0?(a-t)/u:0;if(Math.abs(h)<1e-12)break;const p=n-h;if(n=p>r&&p<i&&Number.isFinite(p)?p:(r+i)/2,i-r<1e-12)break}return n}function v(t,s){let r=t,i=1/t,n=i;for(let m=0;m<300&&(r+=1,n*=s/r,i+=n,!(Math.abs(n)<Math.abs(i)*A));m++);return i*Math.exp(-s+t*Math.log(s)-I(t))}function b(t,s){let r=s+1-t,i=1/Y,n=1/r,m=n;for(let c=1;c<=300;c++){const a=-c*(c-t);r+=2,n=a*n+r,Math.abs(n)<Y&&(n=Y),i=r+a/i,Math.abs(i)<Y&&(i=Y),n=1/n;const u=n*i;if(m*=u,Math.abs(u-1)<A)break}return Math.exp(-s+t*Math.log(s)-I(t))*m}function l(t,s){return!(t>0)||!(s>=0)||!Number.isFinite(s)?Number.NaN:s===0?0:s<t+1?v(t,s):1-b(t,s)}function g(t,s){return s>0?l(s/2,t/2):Number.NaN}function o(t,s){const r=g(t,s);return Number.isNaN(r)?Number.NaN:Math.min(1,Math.max(0,1-r))}}),Ve("packages/core/src/compute/linalg.js",function(e,D){"use strict";Object.defineProperty(e,"cholesky",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"choleskySolve",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"choleskyInverse",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"normalEquations",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return Q}});function re(H){const $=H.length,X=Array.from({length:$},()=>new Array($).fill(0));for(let F=0;F<$;F++)for(let j=0;j<=F;j++){let v=H[F][j];for(let b=0;b<j;b++)v-=X[F][b]*X[j][b];if(F===j){if(!(v>0))return null;X[F][j]=Math.sqrt(v)}else X[F][j]=v/X[j][j]}return X}function A(H,$){const X=H.length,F=new Array(X).fill(0);for(let v=0;v<X;v++){let b=$[v];for(let l=0;l<v;l++)b-=H[v][l]*F[l];F[v]=b/H[v][v]}const j=new Array(X).fill(0);for(let v=X-1;v>=0;v--){let b=F[v];for(let l=v+1;l<X;l++)b-=H[l][v]*j[l];j[v]=b/H[v][v]}return j}function Y(H){const $=H.length,X=Array.from({length:$},()=>new Array($).fill(0));for(let F=0;F<$;F++){const j=new Array($).fill(0);j[F]=1;const v=A(H,j);for(let b=0;b<$;b++)X[b][F]=v[b]}return X}function I(H,$,X){const F=H.length,j=F?H[0].length:0,v=Array.from({length:j},()=>new Array(j).fill(0)),b=new Array(j).fill(0);for(let l=0;l<F;l++){const g=X?X[l]:1,o=H[l];for(let t=0;t<j;t++){const s=g*o[t];b[t]+=s*$[l];for(let r=t;r<j;r++)v[t][r]+=s*o[r]}}for(let l=0;l<j;l++)for(let g=0;g<l;g++)v[l][g]=v[g][l];return{xtwx:v,xtwy:b}}function L(H,$){return H.map(X=>X.reduce((F,j,v)=>F+j*$[v],0))}function Q(H,$){let X=0;for(let F=0;F<H.length;F++){let j=0;for(let v=0;v<H.length;v++)j+=$[F][v]*H[v];X+=H[F]*j}return X}}),Ve("packages/core/src/compute/sketch.js",function(e,D){"use strict";Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return v}});class re{#e=0;#t=0;#n=0;static get errorBound(){return Object.freeze({kind:"exact",metric:"none",value:0,statement:"mean and variance match a full recompute to float rounding"})}get count(){return this.#e}add(l){if(!Number.isFinite(l))return;this.#e++;const g=l-this.#t;this.#t+=g/this.#e,this.#n+=g*(l-this.#t)}merge(l){if(l.#e===0)return;if(this.#e===0){this.#e=l.#e,this.#t=l.#t,this.#n=l.#n;return}const g=this.#e+l.#e,o=l.#t-this.#t;this.#t+=o*(l.#e/g),this.#n+=l.#n+o*o*(this.#e*l.#e/g),this.#e=g}mean(){return this.#e?this.#t:null}variance(){return this.#e>1?this.#n/(this.#e-1):null}varianceP(){return this.#e?this.#n/this.#e:null}stddev(){const l=this.variance();return l===null?null:Math.sqrt(l)}stddevP(){const l=this.varianceP();return l===null?null:Math.sqrt(l)}}class A{#e=[];#t=0;#n;#r;constructor(l,g=Math.random){if(!(l>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(l),this.#r=g}static get errorBound(){return Object.freeze({kind:"probabilistic",metric:"none",value:0,statement:"uniform sample: each element included with probability capacity/n; sample statistics are unbiased estimators"})}get seen(){return this.#t}get size(){return this.#e.length}add(l){if(!Number.isFinite(l))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(l);return}const g=Math.floor(this.#r()*this.#t);g<this.#n&&(this.#e[g]=l)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let l=0;for(const g of this.#e)l+=g;return l/this.#e.length}quantile(l){const g=this.#e.length;if(!g)return null;const 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,l)),s=Math.floor(t),r=Math.ceil(t);return s===r?o[s]:o[s]+(t-s)*(o[r]-o[s])}}function Y(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),Y(o.getUint32(0)^o.getUint32(4))}const l=typeof b=="string"?b:String(b);let g=2166136261;for(let o=0;o<l.length;o++)g^=l.charCodeAt(o),g=Math.imul(g,16777619);return Y(g)}class L{#e;#t;#n;constructor(l=14){const g=Math.floor(l);if(g<4||g>16)throw new RangeError("HLL precision must be 4..16");this.#e=g,this.#t=1<<g,this.#n=new Uint8Array(this.#t)}static errorBoundFor(l=14){const g=1<<Math.floor(l),o=1.04/Math.sqrt(g);return Object.freeze({kind:"probabilistic",metric:"relative",value:o,statement:`distinct count within ~${(o*100).toFixed(2)}% relative standard error (m=${g} buckets)`})}errorBound(){return L.errorBoundFor(this.#e)}add(l){const g=I(l),o=g&this.#t-1,t=g>>>this.#e|1<<32-this.#e;let s=1,r=t;for(;(r&1)===0;)s++,r>>>=1;s>this.#n[o]&&(this.#n[o]=s)}count(){const l=this.#t,g=32-this.#e,o=new Float64Array(g+2);for(let r=0;r<l;r++)o[this.#n[r]]++;let t=l*$(1-o[g+1]/l);for(let r=g;r>=1;r--)t=.5*(t+o[r]);t+=l*H(o[0]/l);const s=Q*l*l/t;return Math.round(s)}}const Q=.5/Math.log(2);function H(b){if(b===1)return 1/0;let l=1,g=b,o;do b*=b,o=g,g+=b*l,l+=l;while(g!==o);return g}function $(b){if(b===0||b===1)return 0;let l=1,g=1-b,o;do b=Math.sqrt(b),o=g,l*=.5,g-=(1-b)**2*l;while(g!==o);return g/3}class X{#e=new Map;#t;#n=0;constructor(l){if(!(l>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(l)}errorBoundFor(l){const g=l/this.#t;return Object.freeze({kind:"deterministic",metric:"absolute",value:g,statement:`each count overestimates the truth by at most N/m = ${g.toFixed(2)} (N=${l}, m=${this.#t})`})}get seen(){return this.#n}add(l){this.#n++;const g=this.#e.get(l);if(g){g.count++;return}if(this.#e.size<this.#t){this.#e.set(l,{count:1,error:0});return}let o,t=1/0;for(const[s,r]of this.#e)r.count<t&&(t=r.count,o=s);this.#e.delete(o),this.#e.set(l,{count:t+1,error:t})}top(l=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(l)))}}class F{#e;#t=[[]];#n=0;#r;#s;constructor(l=200,g=Math.random){this.#e=Math.max(8,Math.floor(l)),this.#r=g,this.#s=2/3}static errorBoundFor(l=200){const g=1/Math.max(8,Math.floor(l));return Object.freeze({kind:"probabilistic",metric:"rank",value:g,statement:`queried quantile's true rank within ~${(g*100).toFixed(2)}% of N of the requested rank (k=${l})`})}errorBound(){return F.errorBoundFor(this.#e)}get count(){return this.#n}#i(l){const o=this.#t.length-1-l,t=Math.ceil(this.#e*this.#s**o);return Math.max(2,t)}add(l){Number.isFinite(l)&&(this.#n++,this.#t[0].push(l),this.#t[0].length>=this.#i(0)&&this.#a(0))}#a(l){const g=this.#t[l];g.sort((s,r)=>s-r),l+1>=this.#t.length&&this.#t.push([]);const o=this.#t[l+1],t=this.#r()<.5?0:1;for(let s=t;s<g.length;s+=2)o.push(g[s]);this.#t[l]=[];for(let s=0;s<this.#t.length;s++)if(this.#t[s].length>=this.#i(s)){this.#a(s);return}}#l(){const l=[];for(let g=0;g<this.#t.length;g++){const o=1<<g;for(const t of this.#t[g])l.push({v:t,w:o})}return l}quantile(l){const g=this.#l();if(!g.length)return null;g.sort((r,i)=>r.v-i.v);let o=0;for(const r of g)o+=r.w;const t=Math.min(1,Math.max(0,l))*o;let s=0;for(const r of g)if(s+=r.w,s>=t)return r.v;return g[g.length-1].v}rank(l){let g=0;for(let o=0;o<this.#t.length;o++){const t=1<<o;for(const s of this.#t[o])s<=l&&(g+=t)}return g}}const j=Object.freeze({distinct:L.errorBoundFor(14),median:F.errorBoundFor(200),p25:F.errorBoundFor(200),p75:F.errorBoundFor(200),p90:F.errorBoundFor(200),p95:F.errorBoundFor(200),p99:F.errorBoundFor(200),iqr:F.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"})}),v={Welford:re,Reservoir:A,HyperLogLog:L,SpaceSaving:X,KLL:F,hash32:I,SKETCH_BOUNDS:j}}),Ve("packages/core/src/compute/statistics.js",function(e,D){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return r}}),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 h}}),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 d}}),Object.defineProperty(e,"moments",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"quantileSorted",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"quantile",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"STAT_FNS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"modifiedZOutliers",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"jarqueBera",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"weightedQuantile",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"covariance",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"autocorrelations",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(e,"spearman",{enumerable:!0,get:function(){return he}}),Object.defineProperty(e,"kendall",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"seriesStats",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"D2_N2",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"D4_N2",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"movingRanges",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"withinSigma",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return He}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(e,"countOutside",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(e,"histogram",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(e,"DEFAULT_CONFIDENCE",{enumerable:!0,get:function(){return We}}),Object.defineProperty(e,"meanInterval",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(e,"proportionInterval",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(e,"slopeInterval",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(e,"capabilityInterval",{enumerable:!0,get:function(){return jt}}),Object.defineProperty(e,"standardizedMeanDifference",{enumerable:!0,get:function(){return Et}}),Object.defineProperty(e,"normalTotalVariation",{enumerable:!0,get:function(){return it}}),Object.defineProperty(e,"frequencyMap",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(e,"categoricalDistance",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(e,"SUBSET_RELIABILITY_FLOOR",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(e,"compareColumn",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(e,"isNumericColumn",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(e,"populationRead",{enumerable:!0,get:function(){return Je}});const re=D("packages/core/src/compute/handle.js"),A=re.presenceReader,Y=re.valueReader,I=D("packages/core/src/compute/special.js"),L=I.studentTQuantile,Q=I.studentT,H=I.normalQuantile,$=I.normalCdf,X=I.chiSquareUpperTail,F=D("packages/core/src/compute/linalg.js"),j=F.cholesky,v=F.choleskySolve,b=F.choleskyInverse,l=F.normalEquations,g=F.quadForm,t=D("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,s=5e3,r=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 be=le==="sum"||le==="avg"||le==="countValues"||le==="min"||le==="max"?"maintained":Object.prototype.hasOwnProperty.call(r,le)?r[le]:null,Oe=Object.prototype.hasOwnProperty.call(i,le)?i[le]:null;return{stat:le,exact:be,approximate:Oe}}function m(le,be){const Oe=be.length,Le=new Float64Array(Oe);let Fe=0;if(le&&(le.kind==="float64"||le.kind==="int32")){const Se=le.values,Ne=A(le);for(let De=0;De<Oe;De++){const Ue=be[De];if(Ne&&Ne(Ue)!==1)continue;const qe=Se[Ue];Number.isNaN(qe)||(Le[Fe++]=qe)}return Le.subarray(0,Fe)}const pe=Y(le);for(let Se=0;Se<Oe;Se++){const Ne=pe(be[Se]);if(Ne==null||Ne==="")continue;const De=typeof Ne=="number"?Ne:Number(Ne);Number.isFinite(De)&&(Le[Fe++]=De)}return Le.subarray(0,Fe)}function c(le,be){const Oe=new Map,Le=Y(le);let Fe=0;for(let pe=0;pe<be.length;pe++){const Se=Le(be[pe]);if(Se==null||Se===""||typeof Se=="number"&&Number.isNaN(Se))continue;const Ne=typeof Se=="object"?String(Se):Se;Oe.set(Ne,(Oe.get(Ne)||0)+1),Fe++}const ue=[...Oe.values()].sort((pe,Se)=>Se-pe);return{counts:ue,total:Fe,distinct:ue.length}}function a(le){return le.total>0?le.counts.map(be=>be/le.total):[]}function u(le,be){const Oe=c(le,be);if(!Oe.total)return null;let Le=0;for(const Fe of a(Oe))Le+=Fe*Fe;return Le}function h(le,be){const Oe=c(le,be);if(!Oe.total)return null;let Le=0;for(const Fe of a(Oe))Fe>0&&(Le-=Fe*Math.log2(Fe));return Le}function p(le,be){const Oe=c(le,be);if(!Oe.total||Oe.distinct<2)return Oe.total?1:null;let Le=0;for(const Fe of a(Oe))Fe>0&&(Le-=Fe*Math.log2(Fe));return Le/Math.log2(Oe.distinct)}function y(le,be,Oe=3){const Le=c(le,be);if(!Le.total)return null;const Fe=Math.max(1,Math.floor(Oe));let ue=0;for(let pe=0;pe<Math.min(Fe,Le.counts.length);pe++)ue+=Le.counts[pe];return ue/Le.total}function d(le,be){const Oe=m(le,be),Le=Oe.length;if(!Le)return null;const Fe=Oe.slice().sort();if(Fe[0]<0)return null;let ue=0,pe=0;for(let Se=0;Se<Le;Se++)ue+=Fe[Se],pe+=(Se+1)*Fe[Se];return ue===0?0:2*pe/(Le*ue)-(Le+1)/Le}function f(le){let be=0,Oe=0,Le=0;for(let Fe=0;Fe<le.length;Fe++){const ue=le[Fe];be++;const pe=ue-Oe;Oe+=pe/be,Le+=pe*(ue-Oe)}return{n:be,mean:Oe,m2:Le}}function w(le,be){const Oe=le.length;if(!Oe)return NaN;if(Oe===1)return le[0];const Le=(Oe-1)*Math.min(1,Math.max(0,be)),Fe=Math.floor(Le),ue=Math.ceil(Le);return Fe===ue?le[Fe]:le[Fe]+(Le-Fe)*(le[ue]-le[Fe])}function k(le,be){if(!le.length)return NaN;const Oe=le.slice().sort();return w(Oe,be)}function P(le,be){const Oe=Y(le);let Le=0,Fe=0,ue=0;for(let pe=0;pe<be.length;pe++){const Se=Oe(be[pe]);if(Se==null||Se==="")continue;const Ne=String(Se).toUpperCase();Ne==="PASS"?Le++:Ne==="FAIL"?Fe++:Ne==="WARN"&&ue++}return{pass:Le+ue,fail:Fe,warn:ue,judged:Le+ue+Fe}}const G=Object.freeze({hhi:(le,be)=>u(le,be),entropy:(le,be)=>h(le,be),evenness:(le,be)=>p(le,be),top3Share:(le,be)=>y(le,be,3),top10Share:(le,be)=>y(le,be,10),gini:(le,be)=>d(le,be),trimmedMean:(le,be)=>S(m(le,be),.1),winsorizedMean:(le,be)=>C(m(le,be),.1),robustOutliers:(le,be)=>N(m(le,be),3.5),jarqueBera:(le,be)=>O(m(le,be)),variance:(le,be)=>{const{n:Oe,m2:Le}=f(m(le,be));return Oe>1?Le/(Oe-1):null},varianceP:(le,be)=>{const{n:Oe,m2:Le}=f(m(le,be));return Oe>0?Le/Oe:null},stddev:(le,be)=>{const{n:Oe,m2:Le}=f(m(le,be));return Oe>1?Math.sqrt(Le/(Oe-1)):null},stddevP:(le,be)=>{const{n:Oe,m2:Le}=f(m(le,be));return Oe>0?Math.sqrt(Le/Oe):null},median:(le,be)=>{const Oe=m(le,be);return Oe.length?k(Oe,.5):null},percentile:(le,be,Oe)=>{const Le=Oe?Oe.p:void 0;if(typeof Le!="number"||!(Le>=0&&Le<=1))return null;const Fe=m(le,be);return Fe.length?k(Fe,Le):null},p25:(le,be)=>{const Oe=m(le,be);return Oe.length?k(Oe,.25):null},p75:(le,be)=>{const Oe=m(le,be);return Oe.length?k(Oe,.75):null},p90:(le,be)=>{const Oe=m(le,be);return Oe.length?k(Oe,.9):null},p95:(le,be)=>{const Oe=m(le,be);return Oe.length?k(Oe,.95):null},p99:(le,be)=>{const Oe=m(le,be);return Oe.length?k(Oe,.99):null},iqr:(le,be)=>{const Oe=m(le,be);if(!Oe.length)return null;const Le=Oe.slice().sort();return w(Le,.75)-w(Le,.25)},mad:(le,be)=>{const Oe=m(le,be);if(!Oe.length)return null;const Le=k(Oe,.5),Fe=new Float64Array(Oe.length);for(let ue=0;ue<Oe.length;ue++)Fe[ue]=Math.abs(Oe[ue]-Le);return k(Fe,.5)},range:(le,be)=>{const Oe=m(le,be);if(!Oe.length)return null;let Le=1/0,Fe=-1/0;for(let ue=0;ue<Oe.length;ue++)Oe[ue]<Le&&(Le=Oe[ue]),Oe[ue]>Fe&&(Fe=Oe[ue]);return Fe-Le},distinct:(le,be)=>{const Oe=Y(le),Le=new Set;for(let Fe=0;Fe<be.length;Fe++){const ue=Oe(be[Fe]);ue==null||ue===""||Le.add(ue instanceof Date?ue.getTime():ue)}return Le.size},mode:(le,be)=>{const Oe=Y(le),Le=new Map;for(let pe=0;pe<be.length;pe++){const Se=Oe(be[pe]);if(Se==null||Se==="")continue;const Ne=Se instanceof Date?Se.getTime():Se;Le.set(Ne,(Le.get(Ne)||0)+1)}let Fe=null,ue=1;for(const[pe,Se]of Le)Se>ue&&(ue=Se,Fe=pe);return Fe},skewness:(le,be)=>{const Oe=m(le,be),{n:Le,mean:Fe,m2:ue}=f(Oe);if(Le<3||ue<=0)return null;const pe=Math.sqrt(ue/(Le-1));let Se=0;for(let Ne=0;Ne<Oe.length;Ne++)Se+=((Oe[Ne]-Fe)/pe)**3;return Le/((Le-1)*(Le-2))*Se},kurtosis:(le,be)=>{const Oe=m(le,be),{n:Le,mean:Fe,m2:ue}=f(Oe);if(Le<4||ue<=0)return null;const pe=Math.sqrt(ue/(Le-1));let Se=0;for(let Ue=0;Ue<Oe.length;Ue++)Se+=((Oe[Ue]-Fe)/pe)**4;const Ne=Le*(Le+1)/((Le-1)*(Le-2)*(Le-3)),De=3*(Le-1)**2/((Le-2)*(Le-3));return Ne*Se-De},geomean:(le,be)=>{const Oe=m(le,be);if(!Oe.length)return null;let Le=0;for(let Fe=0;Fe<Oe.length;Fe++){if(Oe[Fe]<=0)return null;Le+=Math.log(Oe[Fe])}return Math.exp(Le/Oe.length)},harmean:(le,be)=>{const Oe=m(le,be);if(!Oe.length)return null;let Le=0;for(let Fe=0;Fe<Oe.length;Fe++){if(Oe[Fe]===0)return null;Le+=1/Oe[Fe]}return Oe.length/Le},sumSquares:(le,be)=>{const Oe=m(le,be);let Le=0;for(let Fe=0;Fe<Oe.length;Fe++)Le+=Oe[Fe]*Oe[Fe];return Le},passRate:(le,be)=>{const{pass:Oe,judged:Le}=P(le,be);return Le?Oe/Le:null},failureCount:(le,be)=>P(le,be).fail}),K=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 q(le,be,Oe){const Le=Y(le),Fe=Y(be);let ue=0,pe=0;for(let Se=0;Se<Oe.length;Se++){const Ne=Oe[Se],De=Number(Le(Ne)),Ue=Number(Fe(Ne));!Number.isFinite(De)||!Number.isFinite(Ue)||(ue+=De*Ue,pe+=Ue)}return pe===0?null:ue/pe}function B(le,be,Oe){const Le=Y(le);let Fe=null,ue=Oe?-1/0:1/0;for(let pe=0;pe<be.length;pe++){const Se=be[pe],Ne=Number(Le(Se));Number.isFinite(Ne)&&(Oe?Ne>ue:Ne<ue)&&(ue=Ne,Fe=Se)}return Fe}function E(le,be,Oe){const Le=Y(le),Fe=Y(be);let ue=0,pe=0,Se=0,Ne=0,De=0,Ue=0;for(let at=0;at<Oe.length;at++){const kt=Oe[at],Rt=Number(Le(kt)),At=Number(Fe(kt));!Number.isFinite(Rt)||!Number.isFinite(At)||(ue++,pe+=Rt,Se+=At,Ne+=Rt*Rt,De+=At*At,Ue+=Rt*At)}if(ue<2)return null;const qe=ue*Ue-pe*Se,rt=Math.sqrt((ue*Ne-pe*pe)*(ue*De-Se*Se));if(rt===0)return null;const ut=qe/rt;return Math.max(-1,Math.min(1,ut))}function S(le,be=.1){const Oe=le.length;if(!Oe)return null;const Le=Array.from(le).sort((Se,Ne)=>Se-Ne),Fe=Math.floor(Oe*Math.min(.49,Math.max(0,be))),ue=Le.slice(Fe,Oe-Fe);if(!ue.length)return w(Le,.5);let pe=0;for(const Se of ue)pe+=Se;return pe/ue.length}function C(le,be=.1){const Oe=le.length;if(!Oe)return null;const Le=Array.from(le).sort((Ne,De)=>Ne-De),Fe=Math.floor(Oe*Math.min(.49,Math.max(0,be))),ue=Le[Fe],pe=Le[Oe-1-Fe];let Se=0;for(const Ne of Le)Se+=Math.min(pe,Math.max(ue,Ne));return Se/Oe}function N(le,be=3.5){if(!le.length)return null;const Le=Array.from(le).sort((Ne,De)=>Ne-De),Fe=w(Le,.5),ue=Le.map(Ne=>Math.abs(Ne-Fe)).sort((Ne,De)=>Ne-De),pe=w(ue,.5);if(pe===0)return null;let Se=0;for(const Ne of Le)Math.abs(.6745*(Ne-Fe)/pe)>be&&Se++;return Se}function O(le){const be=le.length;if(be<8)return null;let Oe=0;for(const Ne of le)Oe+=Ne;Oe/=be;let Le=0,Fe=0,ue=0;for(const Ne of le){const De=Ne-Oe;Le+=De*De,Fe+=De*De*De,ue+=De*De*De*De}if(Le/=be,Fe/=be,ue/=be,Le===0)return null;const pe=Fe/Le**1.5,Se=ue/(Le*Le)-3;return be/6*(pe*pe+Se*Se/4)}function T(le,be,Oe){const Le=[];let Fe=0;for(let Ne=0;Ne<le.length;Ne++){const De=Number(le[Ne]),Ue=Number(be[Ne]);!Number.isFinite(De)||!Number.isFinite(Ue)||Ue<=0||(Le.push([De,Ue]),Fe+=Ue)}if(!Le.length||Fe<=0)return null;if(Le.sort((Ne,De)=>Ne[0]-De[0]),Le.length===1)return Le[0][0];const ue=[];let pe=0;for(const[,Ne]of Le)ue.push((pe+Ne/2)/Fe),pe+=Ne;const Se=Math.max(0,Math.min(1,Oe));if(Se<=ue[0])return Le[0][0];if(Se>=ue[ue.length-1])return Le[Le.length-1][0];for(let Ne=1;Ne<ue.length;Ne++){if(Se>ue[Ne])continue;const De=ue[Ne]-ue[Ne-1],Ue=De>0?(Se-ue[Ne-1])/De:0;return Le[Ne-1][0]+(Le[Ne][0]-Le[Ne-1][0])*Ue}return Le[Le.length-1][0]}function R(le,be,Oe){const Le=Y(le),Fe=Y(be),ue=new Float64Array(Oe.length),pe=new Float64Array(Oe.length);let Se=0;for(let Ne=0;Ne<Oe.length;Ne++){const De=Oe[Ne],Ue=Number(Le(De)),qe=Number(Fe(De));!Number.isFinite(Ue)||!Number.isFinite(qe)||(ue[Se]=Ue,pe[Se]=qe,Se++)}return{xs:ue.subarray(0,Se),ys:pe.subarray(0,Se),n:Se}}function x(le,be,Oe,Le=!1){const{xs:Fe,ys:ue,n:pe}=R(le,be,Oe);if(pe<2)return null;let Se=0,Ne=0;for(let Ue=0;Ue<pe;Ue++)Se+=Fe[Ue],Ne+=ue[Ue];Se/=pe,Ne/=pe;let De=0;for(let Ue=0;Ue<pe;Ue++)De+=(Fe[Ue]-Se)*(ue[Ue]-Ne);return De/(Le?pe:pe-1)}function U(le,be,Oe){const{xs:Le,ys:Fe,n:ue}=R(le,be,Oe);if(ue<2)return null;let pe=0,Se=0;for(let Rt=0;Rt<ue;Rt++)pe+=Le[Rt],Se+=Fe[Rt];pe/=ue,Se/=ue;let Ne=0,De=0,Ue=0;for(let Rt=0;Rt<ue;Rt++){const At=Le[Rt]-pe,_t=Fe[Rt]-Se;Ne+=At*At,De+=At*_t,Ue+=_t*_t}if(Ne===0)return null;const qe=De/Ne,rt=Se-qe*pe,ut=Ue===0?1:Math.max(0,Math.min(1,De*De/(Ne*Ue))),at=Math.max(0,Ue-qe*De),kt=ue>2?Math.sqrt(at/(ue-2)/Ne):0;return{slope:qe,intercept:rt,r2:ut,stdError:kt,n:ue}}const V=new Set(["ols","wls","robust"]),J=new Set(["quantile"]),_=new Set(["ridge","lasso","elasticnet","mixed","gls"]),ee=1.345;function W(le,be,Oe){const{xtwx:Le,xtwy:Fe}=l(le,be,Oe),ue=j(Le);if(!ue)return null;const pe=v(ue,Fe),Se=b(ue),Ne=Z(le,pe),De=be.map((Ue,qe)=>Ue-Ne[qe]);return{beta:pe,cov:Se,fitted:Ne,residuals:De}}function Z(le,be){return le.map(Oe=>Oe.reduce((Le,Fe,ue)=>Le+Fe*be[ue],0))}function ne(le,be){const Oe=le.length,Le=le.map(De=>De[be]),Fe=le.map(De=>[1,...De.filter((Ue,qe)=>qe!==be)]),ue=W(Fe,Le,null);if(!ue)return 1;const pe=Le.reduce((De,Ue)=>De+Ue,0)/Oe;let Se=0,Ne=0;for(let De=0;De<Oe;De++)Se+=ue.residuals[De]**2,Ne+=(Le[De]-pe)**2;return Ne===0?1:Math.max(0,Math.min(1,1-Se/Ne))}function ie(le){const be=[...le].sort((Fe,ue)=>Fe-ue),Oe=ce(be),Le=le.map(Fe=>Math.abs(Fe-Oe)).sort((Fe,ue)=>Fe-ue);return ce(Le)/.6745}function ce(le){const be=le.length;if(!be)return 0;const Oe=Math.floor(be/2);return be%2?le[Oe]:(le[Oe-1]+le[Oe])/2}function me(le,be,Oe={}){const Le=Oe.method||"ols";if(_.has(Le))throw new Error(`[lattice] regression method "${Le}" is out of scope; use ols, wls or robust.`);if(J.has(Le))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!V.has(Le))throw new Error(`[lattice] unknown regression method "${Le}"; use ols, wls or robust.`);const Fe=Array.isArray(be)?be.length:0,ue=Fe&&Array.isArray(le[0])?le[0].length:0,pe=ue+1;if(!(Fe>pe))return null;for(let Ct=0;Ct<Fe;Ct++){if(!Number.isFinite(be[Ct])||!Array.isArray(le[Ct])||le[Ct].length!==ue)return null;for(let $t=0;$t<ue;$t++)if(!Number.isFinite(le[Ct][$t]))return null}let Se=null;if(Le==="wls"){if(Se=Oe.weights,!Array.isArray(Se)||Se.length!==Fe)return null;for(let Ct=0;Ct<Fe;Ct++)if(!(Se[Ct]>0)||!Number.isFinite(Se[Ct]))return null}const Ne=le.map(Ct=>[1,...Ct]);let De,Ue=null;if(Le==="robust"){if(De=W(Ne,be,null),!De)return null;for(let Ct=0;Ct<50;Ct++){const $t=ie(De.residuals);if(!($t>0))break;const Wt=De.residuals.map(Ut=>{const Gt=Math.abs(Ut/$t);return Gt<=ee?1:ee/Gt}),zt=W(Ne,be,Wt);if(!zt)return null;const Vt=zt.beta.reduce((Ut,Gt,It)=>Math.max(Ut,Math.abs(Gt-De.beta[It])),0);if(De=zt,Ue=Wt,Vt<1e-10)break}}else if(De=W(Ne,be,Se),!De)return null;const qe=Le==="robust"?Ue:Se,{beta:rt,cov:ut,fitted:at,residuals:kt}=De;let Rt=0,At=0,_t=0;for(let Ct=0;Ct<Fe;Ct++){const $t=qe?qe[Ct]:1;Rt+=$t*kt[Ct]**2,At+=$t,_t+=$t*be[Ct]}const tn=_t/At;let Ht=0;for(let Ct=0;Ct<Fe;Ct++){const $t=qe?qe[Ct]:1;Ht+=$t*(be[Ct]-tn)**2}const Xt=Fe-pe,Ze=Rt/Xt,ct=Ht===0?1:Math.max(0,Math.min(1,1-Rt/Ht)),Ot=1-(1-ct)*(Fe-1)/Xt,bt=Array.isArray(Oe.names)&&Oe.names.length===ue?Oe.names:le[0].map((Ct,$t)=>`x${$t+1}`),wt=Ye(Oe.confidence),Ke=Xt>0?L(1-(1-wt)/2,Xt):1/0,ht=rt.map((Ct,$t)=>{const Wt=Math.sqrt(Math.max(0,Ze*ut[$t][$t])),zt=Wt>0?Ct/Wt:Ct===0?0:1/0,Vt=Number.isFinite(zt)?2*(1-Q(Math.abs(zt),Xt)):0,Ut=Number.isFinite(Ke)?Ke*Wt:null;return{name:$t===0?"(intercept)":bt[$t-1],estimate:Ct,stdError:Wt,t:zt,p:Math.max(0,Math.min(1,Vt)),lower:Ut===null?null:Ct-Ut,upper:Ut===null?null:Ct+Ut}}),lt=new Array(Fe),mt=new Array(Fe);for(let Ct=0;Ct<Fe;Ct++){const $t=qe?qe[Ct]:1,Wt=Math.max(0,Math.min(1,$t*g(Ne[Ct],ut)));lt[Ct]=Wt;const zt=(1-Wt)**2;mt[Ct]=zt>0&&Ze>0?kt[Ct]**2/(pe*Ze)*(Wt/zt):null}const xt=le[0].map((Ct,$t)=>{if(ue<2)return 1;const Wt=ne(le,$t);return Wt>=1?1/0:1/(1-Wt)});let Ft=null;{const Ct=kt.map(Wt=>Wt*Wt),$t=W(Ne,Ct,null);if($t){const Wt=Ct.reduce((Jt,ln)=>Jt+ln,0)/Fe;let zt=0,Vt=0;for(let Jt=0;Jt<Fe;Jt++)zt+=$t.residuals[Jt]**2,Vt+=(Ct[Jt]-Wt)**2;const Ut=Vt===0?0:Math.max(0,Math.min(1,1-zt/Vt)),Gt=Fe*Ut,It=X(Gt,ue);Ft={statistic:Gt,df:ue,p:It,heteroscedastic:It<.05}}}let yt=null;if(ue===1){const Ct=le.map(($t,Wt)=>Wt).sort(($t,Wt)=>le[$t][0]-le[Wt][0]);yt={confidence:wt,points:Ct.map($t=>{const Wt=Ne[$t],zt=Math.sqrt(Math.max(0,Ze*g(Wt,ut)));return{x:le[$t][0],yhat:at[$t],lower:at[$t]-Ke*zt,upper:at[$t]+Ke*zt}})}}return{method:Le,coefficients:ht,r2:ct,adjR2:Ot,n:Fe,df:Xt,sigma2:Ze,fitted:at,residuals:kt,leverage:lt,cooksD:mt,vif:xt,heteroscedasticity:Ft,band:yt,weights:qe?[...qe]:null}}function Ce(le){const be=le.length,Oe=Array.from({length:be},(ue,pe)=>pe).sort((ue,pe)=>le[ue]-le[pe]),Le=new Float64Array(be);let Fe=0;for(;Fe<be;){let ue=Fe;for(;ue+1<be&&le[Oe[ue+1]]===le[Oe[Fe]];)ue++;const pe=(Fe+ue)/2+1;for(let Se=Fe;Se<=ue;Se++)Le[Oe[Se]]=pe;Fe=ue+1}return Le}const Pe=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function xe(le){const be=[.01,.05,.1],Oe=[Pe["1%"],Pe["5%"],Pe["10%"]];if(le<=Oe[0]){const ue=(Math.log(be[1])-Math.log(be[0]))/(Oe[1]-Oe[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(be[0])+ue*(le-Oe[0]))))}if(le>=Oe[2]){const ue=(Math.log(be[2])-Math.log(be[1]))/(Oe[2]-Oe[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(be[2])+ue*(le-Oe[2]))))}const Le=le<Oe[1]?0:1,Fe=(le-Oe[Le])/(Oe[Le+1]-Oe[Le]);return Math.exp(Math.log(be[Le])+Fe*(Math.log(be[Le+1])-Math.log(be[Le])))}function _e(le,be,Oe,Le){const Fe=Oe-Le,ue=Le+3,pe=new Array(Fe),Se=new Array(Fe);let Ne=!0,De=Le;for(let at=0;at<Fe;at++){const kt=Le+at,Rt=new Float64Array(ue);Rt[0]=1,Rt[1]=at+1,Rt[2]=le[kt];for(let At=1;At<=Le;At++)Rt[2+At]=be[kt-At];for(let At=1;At<ue;At++)Number.isFinite(Rt[At])||(De=Math.min(De,At-3));pe[at]=Rt,Se[at]=be[kt],Number.isFinite(Se[at])||(Ne=!1)}if(!Ne)return 0;const{xtwx:Ue,xtwy:qe}=l(pe,Se,null);let rt=0,ut=1/0;for(let at=0;at<=De;at++){const kt=at+3;if(!(Fe>kt))continue;const Rt=new Array(kt);for(let ct=0;ct<kt;ct++)Rt[ct]=Ue[ct].slice(0,kt);const At=j(Rt);if(!At)continue;const _t=v(At,qe.slice(0,kt));let tn=0;for(let ct=0;ct<Fe;ct++){const Ot=pe[ct];let bt=0;for(let wt=0;wt<kt;wt++)bt+=Ot[wt]*_t[wt];tn+=(Se[ct]-bt)**2}const Xt=tn/(Fe-kt)*(Fe-kt);if(!(Xt>0))continue;const Ze=Fe*Math.log(Xt/Fe)+2*kt;Ze<ut&&(ut=Ze,rt=at)}return rt}function ve(le,be={}){const Oe=[];for(let ut=0;ut<le.length;ut++){const at=Number(le[ut]);Number.isFinite(at)&&Oe.push(at)}const Le=Oe.length,Fe=Le-1;if(Le<8||Fe<6)return null;const ue=new Array(Fe);for(let ut=0;ut<Fe;ut++)ue[ut]=Oe[ut+1]-Oe[ut];let pe=Number.isFinite(be.maxlag)?Math.floor(be.maxlag):Math.ceil(12*(Le/100)**.25);pe=Math.max(0,Math.min(pe,Math.floor((Fe-5)/2)));const Se=(ut,at)=>{const kt=[],Rt=[];for(let At=at;At<Fe;At++){const _t=[At-at+1,Oe[At]];for(let tn=1;tn<=ut;tn++)_t.push(ue[At-tn]);kt.push(_t),Rt.push(ue[At])}return me(kt,Rt,{method:"ols"})},Ne=_e(Oe,ue,Fe,pe),De=Se(Ne,Ne);if(!De||!De.coefficients[2])return null;const Ue=De.coefficients[2].t,qe=xe(Ue),rt=Ue<Pe["5%"];return{statistic:Ue,usedLag:Ne,nobs:Fe-Ne,criticalValues:{...Pe},pValue:qe,pApproximate:!0,stationary:rt,verdict:rt?"stationary":"non-stationary",regression:"ct"}}function oe(le,be={}){const Oe=[];for(let rt=0;rt<le.length;rt++){const ut=Number(le[rt]);Number.isFinite(ut)&&Oe.push(ut)}const Le=Oe.length;if(Le<3)return null;let Fe=Number.isFinite(be.maxlag)?Math.floor(be.maxlag):Math.min(10,Le-1);Fe=Math.max(1,Math.min(Fe,Le-1));let ue=0;for(const rt of Oe)ue+=rt;ue/=Le;const pe=Oe.map(rt=>rt-ue);let Se=0;for(const rt of pe)Se+=rt*rt;Se/=Le;const Ne=new Array(Fe+1).fill(0);Ne[0]=1;for(let rt=1;rt<=Fe;rt++){let ut=0;for(let at=rt;at<Le;at++)ut+=pe[at]*pe[at-rt];Ne[rt]=Se>0?ut/Le/Se:0}const De=new Array(Fe+1).fill(0);De[0]=1;let Ue=[];for(let rt=1;rt<=Fe;rt++){let ut=Ne[rt];for(let At=1;At<rt;At++)ut-=Ue[At-1]*Ne[rt-At];let at=1;for(let At=1;At<rt;At++)at-=Ue[At-1]*Ne[At];const kt=at!==0?ut/at:0,Rt=new Array(rt);for(let At=1;At<rt;At++)Rt[At-1]=Ue[At-1]-kt*Ue[rt-1-At];Rt[rt-1]=kt,De[rt]=kt,Ue=Rt}const qe=1.96/Math.sqrt(Le);return{acf:Ne,pacf:De,bounds:{upper:qe,lower:-qe},n:Le,nlags:Fe,approximate:!0}}function he(le,be,Oe){const{xs:Le,ys:Fe,n:ue}=R(le,be,Oe);if(ue<2)return null;const pe=Ce(Le),Se=Ce(Fe);let Ne=0,De=0;for(let ut=0;ut<ue;ut++)Ne+=pe[ut],De+=Se[ut];Ne/=ue,De/=ue;let Ue=0,qe=0,rt=0;for(let ut=0;ut<ue;ut++){const at=pe[ut]-Ne,kt=Se[ut]-De;Ue+=at*kt,qe+=at*at,rt+=kt*kt}return qe===0||rt===0?null:Math.max(-1,Math.min(1,Ue/Math.sqrt(qe*rt)))}function ae(le,be,Oe){const{xs:Le,ys:Fe,n:ue}=R(le,be,Oe);if(ue<2||ue>s)return null;let pe=0,Se=0,Ne=0,De=0;for(let rt=0;rt<ue;rt++)for(let ut=rt+1;ut<ue;ut++){const at=Math.sign(Le[rt]-Le[ut]),kt=Math.sign(Fe[rt]-Fe[ut]),Rt=at*kt;Rt>0?pe++:Rt<0?Se++:at===0&&kt===0||(at===0?Ne++:De++)}const Ue=pe+Se+De,qe=pe+Se+Ne;return Ue===0||qe===0?null:(pe-Se)/Math.sqrt(Ue*qe)}function se(le,be={}){const Oe=le.length;if(Oe<2)return null;const Le=le[0],Fe=le[Oe-1],ue=[];for(let At=1;At<Oe;At++){const _t=le[At-1];_t!==0&&ue.push((le[At]-_t)/Math.abs(_t))}let pe=null;if(ue.length>1){let At=0;for(const tn of ue)At+=tn;At/=ue.length;let _t=0;for(const tn of ue)_t+=(tn-At)**2;pe=Math.sqrt(_t/(ue.length-1))}const Se=Number(be.periodsPerYear)>0?Number(be.periodsPerYear):null;let Ne=le[0],De=0,Ue=0,qe=0,rt=0;for(let At=1;At<Oe;At++){if(le[At]>Ne){Ne=le[At],De=At;continue}if(Ne<=0)continue;const _t=(Ne-le[At])/Ne;_t>Ue&&(Ue=_t,qe=De,rt=At)}let ut=null;if(Oe>2){let At=0;for(let Ht=0;Ht<Oe;Ht++)At+=le[Ht];At/=Oe;let _t=0,tn=0;for(let Ht=0;Ht<Oe;Ht++){const Xt=le[Ht]-At;tn+=Xt*Xt,Ht>0&&(_t+=Xt*(le[Ht-1]-At))}ut=tn>0?_t/tn:null}let at=0,kt=0;for(const At of ue)At>0?at++:At<0&&kt++;let Rt=null;if(Le>0&&Fe>0){const At=(Fe/Le)**(1/(Oe-1))-1;Rt=Se?(1+At)**Se-1:At}return{n:Oe,first:Le,last:Fe,change:Fe-Le,changePercent:Le===0?null:(Fe-Le)/Math.abs(Le)*100,volatility:pe,annualisedVolatility:pe!==null&&Se?pe*Math.sqrt(Se):null,growth:Rt,maxDrawdown:Ue,maxDrawdownFrom:qe,maxDrawdownTo:rt,autocorrelation:ut,upDays:at,downDays:kt}}const de=1.128,ke=3.267;function Ae(le){const be=le.length;if(be<2)return null;const Oe=[];for(let Fe=1;Fe<be;Fe++)Oe.push(Math.abs(le[Fe]-le[Fe-1]));const Le=Oe.reduce((Fe,ue)=>Fe+ue,0)/Oe.length;return{ranges:Oe,centre:Le,upper:ke*Le,lower:0}}function Te(le){const be=le.length;if(be<2)return null;let Oe=0;for(let Fe=1;Fe<be;Fe++)Oe+=Math.abs(le[Fe]-le[Fe-1]);const Le=Oe/(be-1);return{sigma:Le/de,meanRange:Le}}function je(le,be){const Oe=le.length;if(Oe<2||!be)return null;const Le=Number.isFinite(Number(be.lower))?Number(be.lower):null,Fe=Number.isFinite(Number(be.upper))?Number(be.upper):null;if(Le===null&&Fe===null)return null;let ue=0;for(let at=0;at<Oe;at++)ue+=le[at];ue/=Oe;let pe=0;for(let at=0;at<Oe;at++)pe+=(le[at]-ue)**2;const Se=Math.sqrt(pe/(Oe-1)),Ne=Te(le),De=Ne?Ne.sigma:null,Ue=at=>{if(!at||at<=0)return{index:null,k:null};const Rt=Le!==null&&Fe!==null?(Fe-Le)/(6*at):null,At=Fe!==null?(Fe-ue)/(3*at):1/0,_t=Le!==null?(ue-Le)/(3*at):1/0;return{index:Rt,k:Math.min(At,_t)}},qe=Ue(De),rt=Ue(Se);let ut=0;for(let at=0;at<Oe;at++){if(Le!==null&&le[at]<Le){ut++;continue}Fe!==null&&le[at]>Fe&&ut++}return{n:Oe,mean:ue,lower:Le,upper:Fe,target:Number.isFinite(Number(be.target))?Number(be.target):null,sigmaWithin:De,sigmaOverall:Se,cp:qe.index,cpk:qe.k,pp:rt.index,ppk:rt.k,outOfSpec:ut,defectRate:Oe?ut/Oe:null}}function ye(le){const be=le.length;if(be<2)return null;const Oe=Te(le);if(!Oe||!(Oe.sigma>0))return null;let Le=0;for(let Fe=0;Fe<be;Fe++)Le+=le[Fe];return Le/=be,{centre:Le,sigma:Oe.sigma,upper:Le+3*Oe.sigma,lower:Le-3*Oe.sigma}}function He(le,be){if(!be||!(be.sigma>0))return[];const Oe=le.length,{centre:Le,sigma:Fe}=be,ue=Se=>(le[Se]-Le)/Fe,pe=[];for(let Se=0;Se<Oe;Se++){if(Math.abs(ue(Se))>3&&pe.push({index:Se,rule:1,description:"beyond three sigma"}),Se>=2)for(const Ne of[1,-1]){let De=0;for(let Ue=Se-2;Ue<=Se;Ue++)ue(Ue)*Ne>2&&De++;if(De>=2){pe.push({index:Se,rule:2,description:"two of three past two sigma"});break}}if(Se>=4)for(const Ne of[1,-1]){let De=0;for(let Ue=Se-4;Ue<=Se;Ue++)ue(Ue)*Ne>1&&De++;if(De>=4){pe.push({index:Se,rule:3,description:"four of five past one sigma"});break}}if(Se>=7)for(const Ne of[1,-1]){let De=!0;for(let Ue=Se-7;Ue<=Se;Ue++)if(ue(Ue)*Ne<=0){De=!1;break}if(De){pe.push({index:Se,rule:4,description:"eight in a row on one side"});break}}}return pe}function Me(le,be){if(!be||!(be.sigma>0))return[];const Oe=le.length,{centre:Le,sigma:Fe}=be,ue=Ne=>(le[Ne]-Le)/Fe,pe=(Ne,De,Ue,qe)=>{for(const rt of[1,-1]){let ut=0;for(let at=Ne;at<=De;at++)ue(at)*rt>Ue&&ut++;if(ut>=qe)return!0}return!1},Se=[];for(let Ne=0;Ne<Oe;Ne++){if(Math.abs(ue(Ne))>3&&Se.push({index:Ne,rule:1,description:"beyond three sigma"}),Ne>=8)for(const De of[1,-1]){let Ue=!0;for(let qe=Ne-8;qe<=Ne;qe++)if(ue(qe)*De<=0){Ue=!1;break}if(Ue){Se.push({index:Ne,rule:2,description:"nine in a row on one side"});break}}if(Ne>=5)for(const De of[1,-1]){let Ue=!0;for(let qe=Ne-4;qe<=Ne;qe++)if((le[qe]-le[qe-1])*De<=0){Ue=!1;break}if(Ue){Se.push({index:Ne,rule:3,description:De>0?"six rising":"six falling"});break}}if(Ne>=13){let De=!0;for(let Ue=Ne-12;Ue<=Ne;Ue++){const qe=le[Ue]-le[Ue-1],rt=le[Ue+1<=Ne?Ue+1:Ue]-le[Ue];if(Ue+1>Ne)break;if(qe===0||rt===0||qe>0==rt>0){De=!1;break}}De&&Se.push({index:Ne,rule:4,description:"fourteen alternating"})}if(Ne>=2&&pe(Ne-2,Ne,2,2)&&Se.push({index:Ne,rule:5,description:"two of three past two sigma"}),Ne>=4&&pe(Ne-4,Ne,1,4)&&Se.push({index:Ne,rule:6,description:"four of five past one sigma"}),Ne>=14){let De=!0;for(let Ue=Ne-14;Ue<=Ne;Ue++)if(Math.abs(ue(Ue))>=1){De=!1;break}De&&Se.push({index:Ne,rule:7,description:"fifteen within one sigma"})}if(Ne>=7){let De=!0;for(let Ue=Ne-7;Ue<=Ne;Ue++)if(Math.abs(ue(Ue))<=1){De=!1;break}De&&Se.push({index:Ne,rule:8,description:"eight beyond one sigma"})}}return Se}const Re=Object.freeze(["westernElectric","nelson"]);function Ee(le,be,Oe="westernElectric"){return String(Oe)==="nelson"?Me(le,be):He(le,be)}function $e(le,be,Oe){let Le=0;for(let Fe=0;Fe<le.length;Fe++)(le[Fe]<be||le[Fe]>Oe)&&Le++;return Le}function Ie(le,be,Oe,Le=20){const Fe=le.length;if(!Fe)return[];const ue=le[0],pe=le[Fe-1];if(pe===ue)return[{from:ue,to:pe,count:Fe}];const Se=Oe-be,Ne=1.5*Se;let De=Se>0?Math.max(ue,be-Ne):ue,Ue=Se>0?Math.min(pe,Oe+Ne):pe;Ue>De||(De=ue,Ue=pe);const qe=Se>0?2*Se/Math.cbrt(Fe):(Ue-De)/(Math.ceil(Math.log2(Fe))+1),rt=qe>0?Math.min(Le,Math.max(1,Math.ceil((Ue-De)/qe))):1,ut=(Ue-De)/rt,at=[];for(let kt=0;kt<rt;kt++)at.push({from:De+kt*ut,to:De+(kt+1)*ut,count:0});for(let kt=0;kt<Fe;kt++){const Rt=Math.min(rt-1,Math.max(0,Math.floor((le[kt]-De)/ut)));at[Rt].count++}return at[0].from=ue,at[rt-1].to=pe,at}const We=.95;function Ye(le){const be=Number(le);return Number.isFinite(be)&&be>0&&be<1?be:We}function nt(le,be=We){const Oe=le.length;if(Oe<2)return null;let Le=0;for(let Ue=0;Ue<Oe;Ue++)Le+=le[Ue];const Fe=Le/Oe;let ue=0;for(let Ue=0;Ue<Oe;Ue++){const qe=le[Ue]-Fe;ue+=qe*qe}const pe=Math.sqrt(ue/(Oe-1)),Se=Ye(be),De=L(1-(1-Se)/2,Oe-1)*pe/Math.sqrt(Oe);return{mean:Fe,lower:Fe-De,upper:Fe+De,margin:De,n:Oe,confidence:Se}}function Qe(le,be,Oe=We){const Le=Number(le),Fe=Number(be);if(!(Fe>0)||!(Le>=0)||Le>Fe)return null;const ue=Ye(Oe),pe=H(1-(1-ue)/2),Se=Le/Fe,Ne=pe*pe,De=1+Ne/Fe,Ue=(Se+Ne/(2*Fe))/De,qe=pe/De*Math.sqrt(Se*(1-Se)/Fe+Ne/(4*Fe*Fe));return{proportion:Se,lower:Math.max(0,Ue-qe),upper:Math.min(1,Ue+qe),n:Fe,confidence:ue}}function dt(le,be=We){if(!le||!(le.n>2)||!Number.isFinite(le.stdError))return null;const Oe=Ye(be),Fe=L(1-(1-Oe)/2,le.n-2)*le.stdError;return{slope:le.slope,lower:le.slope-Fe,upper:le.slope+Fe,margin:Fe,confidence:Oe}}function jt(le,be,Oe=We){const Le=Number(le),Fe=Number(be);if(!Number.isFinite(Le)||!(Fe>1))return null;const ue=Ye(Oe),Se=H(1-(1-ue)/2)*Math.sqrt(1/(9*Fe)+Le*Le/(2*(Fe-1)));return{index:Le,lower:Le-Se,upper:Le+Se,margin:Se,n:Fe,confidence:ue}}function Et(le,be){return!le||!(le.sd>0)||!Number.isFinite(be)||!Number.isFinite(le.mean)?null:(be-le.mean)/le.sd}function it(le){return Number.isFinite(le)?Math.min(1,Math.max(0,2*$(Math.abs(le)/2)-1)):0}function ft(le,be){const Oe=new Map,Le=Y(le);let Fe=0;for(let ue=0;ue<be.length;ue++){const pe=Le(be[ue]);if(pe==null||pe===""||typeof pe=="number"&&Number.isNaN(pe))continue;const Se=pe instanceof Date?pe.getTime():typeof pe=="object"?String(pe):pe;Oe.set(Se,(Oe.get(Se)||0)+1),Fe++}return{map:Oe,total:Fe}}function pt(le,be,Oe,Le){if(!(be>0)||!(Le>0))return null;let Fe=0;const ue=new Set(le.keys());for(const pe of Oe.keys())ue.add(pe);for(const pe of ue){const Se=(le.get(pe)||0)/be,Ne=(Oe.get(pe)||0)/Le;Fe+=Math.abs(Se-Ne)}return Fe/2}const Tt=10;function Mt(le,be,Oe){if(Oe&&Oe.numeric){const Se=m(le,be),{n:Ne,mean:De}=f(Se),Ue=Ne>0?Et({mean:Oe.mean,sd:Oe.sd},De):null;return{measure:"standardizedMeanDifference",magnitude:Ue,distance:Ue===null?0:it(Ue),direction:Ue===null?0:Math.sign(Ue),subsetN:Ne,populationN:Oe.n||0,reliable:Ne>=Tt}}const{map:Fe,total:ue}=ft(le,be),pe=pt(Fe,ue,Oe.map,Oe.total);return{measure:"categoricalTotalVariation",magnitude:pe,distance:pe===null?0:pe,direction:0,subsetN:ue,populationN:Oe.total||0,reliable:ue>=Tt}}function Lt(le,be){if(le&&(le.kind==="float64"||le.kind==="int32"))return!0;const Oe=Y(le);let Le=0,Fe=0;for(let ue=0;ue<be.length&&Le<200;ue++){const pe=Oe(be[ue]);if(pe==null||pe==="")continue;if(pe instanceof Date)return!1;Le++;const Se=typeof pe=="number"?pe:Number(pe);Number.isFinite(Se)&&Fe++}return Le===0?!1:Fe/Le>=.9}function Je(le,be){if(Lt(le,be)){const Fe=m(le,be),{n:ue,mean:pe,m2:Se}=f(Fe);return{numeric:!0,mean:pe,sd:ue>0?Math.sqrt(Se/ue):0,n:ue}}const{map:Oe,total:Le}=ft(le,be);return{numeric:!1,map:Oe,total:Le}}}),Ve("packages/core/src/compute/total.js",function(e,D){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return a}}),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 d}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return f}});const A=D("packages/core/src/internal/predicates.js").isFunction,I=D("packages/core/src/internal/warn.js").warnOnce,L=D("packages/core/src/compute/handle.js"),Q=L.presenceReader,H=L.valueComparator,$=L.valueReader,X=D("packages/core/src/compute/statistics.js"),F=X.STAT_FNS,j=X.STAT_LABELS;function v(w){return!!w&&(w.kind==="float64"||w.kind==="int32")}function b(w,k){const P=k.length;let G=0;if(v(w)){const q=w.values,B=Q(w);if(!B){for(let E=0;E<P;E++){const S=q[k[E]];Number.isNaN(S)||(G+=S)}return G}for(let E=0;E<P;E++){const S=k[E];if(B(S)===1){const C=q[S];Number.isNaN(C)||(G+=C)}}return G}const K=$(w);for(let q=0;q<P;q++){const B=m(K(k[q]));B!==null&&(G+=B)}return G}b.kernel=!0;function l(w,k){const P=k.length;let G=0;if(v(w)){const q=w.values,B=Q(w);if(!B){for(let E=0;E<P;E++)Number.isNaN(q[k[E]])||G++;return G}for(let E=0;E<P;E++){const S=k[E];B(S)===1&&!Number.isNaN(q[S])&&G++}return G}const K=$(w);for(let q=0;q<P;q++){const B=K(k[q]);B!=null&&!(typeof B=="number"&&Number.isNaN(B))&&G++}return G}l.kernel=!0;function g(w,k){return k.length}g.kernel=!0;function o(w,k){const P=l(w,k);return P===0?null:b(w,k)/P}o.kernel=!0;function t(w,k,P,G){const K=k.length;if(v(w)){const S=w.values,C=Q(w);let N=null;if(!C){for(let O=0;O<K;O++){const T=S[k[O]];Number.isNaN(T)||(N===null||(P<0?T<N:T>N))&&(N=T)}return N}for(let O=0;O<K;O++){const T=k[O];if(C(T)===0)continue;const R=S[T];Number.isNaN(R)||(N===null||(P<0?R<N:R>N))&&(N=R)}return N}const q=$(w),B=H(G);let E=null;for(let S=0;S<K;S++){const C=q(k[S]);C==null||typeof C=="number"&&Number.isNaN(C)||(E===null||(P<0?B(C,E)<0:B(C,E)>0))&&(E=C)}return E}function s(w,k,P){return t(w,k,-1,P&&P.locale)}s.kernel=!0;function r(w,k,P){return t(w,k,1,P&&P.locale)}r.kernel=!0;function i(w,k){return k.length===0?null:$(w)(k[0])}i.kernel=!0;function n(w,k){return k.length===0?null:$(w)(k[k.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 k=Number(w);return Number.isNaN(k)?null:k}const c={sum:b,min:s,max:r,avg:o,count:g,first:i,last:n,countValues:l,...F},a=Object.freeze({...j,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"?a[w]||w:"Total":""}const h=Object.freeze(["sum","avg","min","max","count","countValues","first","last"]);function p(w){const k=w&&w.dataType&&w.dataType.totals&&w.dataType.totals.supported;if(Array.isArray(k))return k.slice();const P=h.filter(G=>G in c);for(const G of Object.keys(c))P.includes(G)||P.push(G);return P}function y(w,k){return typeof k!="string"?!0:p(w).includes(k)}function d(w,k){const P=$(w),G=[];for(let K=0;K<k.length;K++){const q=P(k[K]);q!=null&&G.push(q)}return G}function f(w,k,P,G){const K=k||[];if(P&&typeof P=="object"&&typeof P.fn=="string"){const{fn:q,...B}=P,E=c[q];return E?E(w,K,{...G,...B}):(I(`total:${q}`,`unknown total function "${q}"; register it in config.totalFns`),null)}if(typeof P=="string"){const q=c[P];return q?q(w,K,G):(I(`total:${P}`,`unknown total function "${P}"; register it in config.totalFns`),null)}return A(P)?P.kernel===!0?P(w,K,G):P(d(w,K),G||{}):null}}),Ve("packages/core/src/compute/windowed.js",function(e,D){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Q}});const A=D("packages/core/src/compute/sketch.js").Welford;class Y{#e;#t;#n=[];#r;#s;constructor($,X=0,F=Date.now){if($!=="count"&&$!=="time"&&$!=="session")throw new RangeError(`unknown window kind: ${$}`);if(($==="count"||$==="time")&&!(X>0))throw new RangeError(`a ${$} window needs a positive span`);this.#e=$,this.#t=Math.floor(X),this.#r=F,this.#s=F()}get size(){return this.#n.length}push($,X=this.#r()){Number.isFinite($)&&(this.#n.push({t:X,v:$}),this.#i(X))}#i($){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const X=$-this.#t;for(;this.#n.length&&this.#n[0].t<X;)this.#n.shift()}}spec(){const $=this.#e==="session"?this.#r()-this.#s:this.#t;return{kind:this.#e,span:$,size:this.#n.length}}values(){return this.#n.map($=>$.v)}aggregate(){const $=this.spec();if(!this.#n.length)return{over:$,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const X=new A;let F=0,j=1/0,v=-1/0;for(const{v:b}of this.#n)F+=b,b<j&&(j=b),b>v&&(v=b),X.add(b);return{over:$,count:this.#n.length,sum:F,mean:X.mean(),min:j,max:v,variance:X.variance(),stddev:X.stddev()}}reduce($){const X=this.aggregate(),F={sum:X.sum,avg:X.mean,mean:X.mean,min:X.min,max:X.max,count:X.count,variance:X.variance,stddev:X.stddev};if(!($ in F))throw new RangeError(`unknown windowed aggregate: ${$}`);return{value:F[$],over:X.over}}}const I=Object.freeze(["count","time","session"]);function L(H,$=Date.now){const X=H.kind==="time"&&H.minutes!=null?H.minutes*6e4:H.span??0;return new Y(H.kind,X,$)}const Q={Window:Y,WINDOW_KINDS:I,openWindow:L}}),Ve("packages/core/src/compute/rolling.js",function(e,D){"use strict";Object.defineProperty(e,"ROLLING_WINDOW_FIELDS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"rollingWindow",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return F}}),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 A=D("packages/core/src/compute/windowed.js").openWindow,I=D("packages/core/src/compute/sketch.js").KLL,L=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function Q(c,a,u,h){if(c.kind==="count"){const p=Math.max(1,Math.floor(c.span||0));return{coverage:Math.min(1,a/p),partial:a<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-h;return{coverage:Math.min(1,y/p),partial:y<p}}return{coverage:null,partial:!1}}function H(c,a){const u=A(a),h=new Map,p=c.length?c[0].at:0;for(let y=0;y<c.length;y++){const{key:d,at:f,value:w}=c[y];Number.isFinite(w)&&u.push(w,f);const k=u.aggregate(),P=Q(a,k.count,f,p);d!=null&&h.set(String(d),{sum:k.sum,avg:k.mean,min:k.min,max:k.max,count:k.count,coverage:P.coverage,partial:P.partial})}return h}function $(c){const a=new Map;let u=0;for(const{key:h,value:p}of c)Number.isFinite(p)&&(u+=p),h!=null&&a.set(String(h),u);return a}function X(c,a=1){const u=new Map,h=Math.max(1,Math.floor(a));for(let p=0;p<c.length;p++){const{key:y,value:d}=c[p];if(y==null)continue;const f=p>=h?c[p-h].value:null,w=Number.isFinite(d)?d:null,k=Number.isFinite(f)?f:null;u.set(String(y),w!==null&&k!==null?w-k:null)}return u}const F=4096;function j(c){let a=c>>>0;return()=>{a+=1831565813;let u=a;return u=Math.imul(u^u>>>15,u|1),u^=u+Math.imul(u^u>>>7,u|61),((u^u>>>14)>>>0)/4294967296}}function v(c,a){const u=c.length;if(u===1)return c[0];const h=(u-1)*a,p=Math.floor(h),y=Math.ceil(h);return p===y?c[p]:c[p]+(h-p)*(c[y]-c[p])}function b(c,a,u={}){const h=Math.min(1,Math.max(0,u.q==null?.5:u.q)),p=Math.max(1,Math.floor(u.cap==null?F:u.cap)),y=j(u.seed==null?2654435769:u.seed),d=new Map,f=c.length?c[0].at:0;if(a.kind==="session"){const k=new I(200,y);let P=0;for(const{key:G,value:K}of c)Number.isFinite(K)&&(k.add(K),P++),G!=null&&d.set(String(G),{value:P?k.quantile(h):null,approx:P>0,count:P,coverage:null,partial:!1});return d}const w=A(a);for(const{key:k,at:P,value:G}of c){Number.isFinite(G)&&w.push(G,P);const K=w.values(),q=K.length;let B=null,E=!1;if(q)if(q<=p)B=v([...K].sort((C,N)=>C-N),h);else{const C=new I(200,y);for(const N of K)C.add(N);B=C.quantile(h),E=!0}const S=Q(a,q,P,f);k!=null&&d.set(String(k),{value:B,approx:E,count:q,coverage:S.coverage,partial:S.partial})}return d}function l(c,a){const u=c.length,h=new Array(u).fill(null),p=Math.floor(a/2),y=a%2===0;for(let d=0;d<u;d++){if(d-p<0||d+p>=u)continue;let f=0,w=!0;if(y)for(let k=-p;k<=p;k++){const P=c[d+k];if(!Number.isFinite(P)){w=!1;break}f+=k===-p||k===p?P*.5:P}else for(let k=-p;k<=p;k++){const P=c[d+k];if(!Number.isFinite(P)){w=!1;break}f+=P}w&&(h[d]=f/a)}return h}function g(c,a){const u=new Map,h=Math.floor(Number(a&&a.period));if(!(h>=2))return u;const p=a&&a.model==="multiplicative",y=c.length,d=c.map(E=>Number.isFinite(E.value)?E.value:null),f=l(d,h),w=new Array(y).fill(null);for(let E=0;E<y;E++){const S=f[E],C=d[E];S===null||C===null||(p?S!==0&&(w[E]=C/S):w[E]=C-S)}const k=new Array(h).fill(0),P=new Array(h).fill(0);for(let E=0;E<y;E++){if(w[E]===null)continue;const S=E%h;k[S]+=w[E],P[S]+=1}const G=p?1:0,K=k.map((E,S)=>P[S]?E/P[S]:G),q=K.reduce((E,S)=>E+S,0)/h,B=p?K.map(E=>q!==0?E/q:1):K.map(E=>E-q);for(let E=0;E<y;E++){const{key:S}=c[E];if(S==null)continue;const C=f[E],N=B[E%h],O=d[E];let T=null;C!==null&&O!==null&&(T=p?C*N!==0?O/(C*N):null:O-C-N),u.set(String(S),{trend:C,seasonal:O===null?null:N,residual:T,coverage:C===null?0:1,partial:C===null})}return u}function o(c,a,u,h=80){const p=(Math.sqrt(5)-1)/2;let y=a,d=u,f=d-p*(d-y),w=y+p*(d-y),k=c(f),P=c(w);for(let G=0;G<h;G++)k<P?(d=w,w=f,P=k,f=d-p*(d-y),k=c(f)):(y=f,f=w,k=P,w=y+p*(d-y),P=c(w));return(y+d)/2}const t=1e-4,s=1-1e-4;function r(c,a){const u=c.length,h=new Array(u).fill(null),p=new Array(u).fill(null);let y=null,d=0;for(let f=0;f<u;f++){const w=c[f];if(!Number.isFinite(w)){y!==null&&(p[f]=y,h[f]=y);continue}if(y===null){y=w,p[f]=w,h[f]=w;continue}p[f]=y,d+=(w-y)**2,y=a*w+(1-a)*y,h[f]=y}return{smoothed:h,fitted:p,sse:d}}function i(c,a,u){const h=c.length,p=new Array(h).fill(null),y=new Array(h).fill(null);let d=null,f=null,w=0;for(let k=0;k<h;k++){const P=c[k];if(!Number.isFinite(P)){d!==null&&(d+=f,p[k]=d);continue}if(d===null){d=P,p[k]=P;continue}if(f===null){f=P-d;const q=d+f;y[k]=q,w+=(P-q)**2;const B=d;d=a*P+(1-a)*(B+f),f=u*(d-B)+(1-u)*f,p[k]=d;continue}const G=d+f;y[k]=G,w+=(P-G)**2;const K=d;d=a*P+(1-a)*(K+f),f=u*(d-K)+(1-u)*f,p[k]=d}return{smoothed:p,fitted:y,sse:w}}function n(c,a={}){const u=new Map,h=a.method==="holt",p=c.map(G=>Number.isFinite(G.value)?G.value:null),y=p.filter(G=>G!==null).length,d=G=>Math.min(s,Math.max(t,G)),f=()=>{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<(h?2:1))return f();let w=Number.isFinite(a.alpha)?d(a.alpha):null,k=h&&Number.isFinite(a.beta)?d(a.beta):null;if(h){if(w===null||k===null){let G=w===null?.5:w,K=k===null?.5:k;for(let q=0;q<6;q++)w===null&&(G=o(B=>i(p,B,K).sse,t,s)),k===null&&(K=o(B=>i(p,G,B).sse,t,s));w=w===null?G:w,k=k===null?K:k}}else w===null&&(w=o(G=>r(p,G).sse,t,s));const P=h?i(p,w,k):r(p,w);for(let G=0;G<c.length;G++){const{key:K}=c[G];K!=null&&u.set(String(K),{smoothed:P.smoothed[G],fitted:P.fitted[G],alpha:w,beta:h?k:null,sse:P.sse})}return u}const m={ROLLING_WINDOW_FIELDS:L,QUANTILE_SPAN_CAP:F,rollingWindow:H,rollingQuantile:b,cumulativeToDate:$,periodOverPeriod:X,seasonalDecompose:g,exponentialSmoothing:n}}),Ve("packages/core/src/compute/cluster.js",function(e,D){"use strict";Object.defineProperty(e,"CLUSTER_ROW_CAP",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"DBSCAN_ROW_CAP",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"DEFAULT_K",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"DEFAULT_MIN_POINTS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"orderByCentre",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"kmeans",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"dbscan",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"autoK",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"standardise",{enumerable:!0,get:function(){return t}});const re=1e5,A=2e4,Y=3,I=5,L=100;function Q(s){let r=s>>>0;return function(){r=r+1831565813|0;let n=Math.imul(r^r>>>15,1|r);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}function H(s,r){let i=0;for(let n=0;n<s.length;n++){const m=s[n]-r[n];i+=m*m}return i}function $(s,r){return Math.sqrt(H(s,r))}function X(s,r){let i=-1,n=1/0;for(let m=0;m<r.length;m++){const c=H(s,r[m]);c<n&&(n=c,i=m)}return i}function F(s,r,i){const n=Q(i),m=s.length,c=[Array.from(s[Math.floor(n()*m)])],a=new Float64Array(m).fill(1/0);for(let u=1;u<r;u++){let h=0;for(let f=0;f<m;f++){const w=H(s[f],c[c.length-1]);w<a[f]&&(a[f]=w),h+=a[f]}const p=n()*(h||m);let y=0,d=m-1;for(let f=0;f<m;f++)if(y+=h?a[f]:1,y>=p){d=f;break}c.push(Array.from(s[d]))}return c}function j(s,r){for(let i=0;i<s.length;i++){const n=s[i]-r[i];if(n!==0)return n}return 0}function v(s,r,i,n){const m=r.map((a,u)=>({centre:a,i:u})).sort((a,u)=>j(a.centre,u.centre)),c=new Int32Array(r.length);for(let a=0;a<m.length;a++)c[m[a].i]=a;for(let a=0;a<s.length;a++)s[a]>=0&&(s[a]=c[s[a]]);return{assignments:s,centres:m.map(a=>a.centre),sizes:m.map(a=>i[a.i]),distances:n}}function b(s,r={}){const i=s.length,n=i?s[0].length:0,m=Math.floor(r.k||Y);if(!(i>=m)||m<1||n<1)return null;let c=F(s,m,r.seed===void 0?1:r.seed);const a=new Int32Array(i);let u=!0;for(let d=0;d<L&&u;d++){u=!1;for(let k=0;k<i;k++){const P=X(s[k],c);a[k]!==P&&(a[k]=P,u=!0)}const f=c.map(()=>new Float64Array(n)),w=new Array(m).fill(0);for(let k=0;k<i;k++){const P=a[k];for(let G=0;G<n;G++)f[P][G]+=s[k][G];w[P]++}for(let k=0;k<m;k++)if(w[k])for(let P=0;P<n;P++)c[k][P]=f[k][P]/w[k];else{let P=0,G=-1/0;for(let K=0;K<i;K++){const q=H(s[K],c[k]);q>G&&(G=q,P=K)}c[k]=Array.from(s[P]),u=!0}}const h=new Array(m).fill(0),p=new Float64Array(i);let y=0;for(let d=0;d<i;d++){const f=a[d];h[f]++;const w=H(s[d],c[f]);p[d]=Math.sqrt(w),y+=w}return{assignments:a,centres:c,sizes:h,inertia:y,distances:p}}function l(s,r={}){const i=s.length,n=i?s[0].length:0,m=Number(r.eps),c=Math.max(1,Math.floor(r.minPoints||I));if(!(m>0)||i===0||n<1)return null;const a=new Array(i);for(let w=0;w<i;w++){const k=[];for(let P=0;P<i;P++)w!==P&&$(s[w],s[P])<=m&&k.push(P);a[w]=k}const u=new Int32Array(i).fill(-1);let h=0;for(let w=0;w<i;w++){if(u[w]!==-1||a[w].length<c)continue;u[w]=h;const k=[...a[w]];for(let P=0;P<k.length;P++){const G=k[P];u[G]===-1&&(u[G]=h,a[G].length>=c&&k.push(...a[G]))}h++}if(!h)return{assignments:u,centres:[],sizes:[],distances:new Float64Array(i).fill(NaN)};const p=[],y=new Array(h).fill(0),d=Array.from({length:h},()=>new Float64Array(n));for(let w=0;w<i;w++){const k=u[w];if(!(k<0)){y[k]++;for(let P=0;P<n;P++)d[k][P]+=s[w][P]}}for(let w=0;w<h;w++){const k=new Array(n);for(let P=0;P<n;P++)k[P]=d[w][P]/y[w];p.push(k)}const f=new Float64Array(i).fill(NaN);for(let w=0;w<i;w++){const k=u[w];k>=0&&(f[w]=$(s[w],p[k]))}return{assignments:u,centres:p,sizes:y,distances:f}}function g(s,r,i){const n=s.length;if(n===0)return 0;const m=new Int32Array(i);for(let a=0;a<n;a++)m[r[a]]++;let c=0;for(let a=0;a<n;a++){const u=r[a],h=new Float64Array(i);for(let d=0;d<n;d++)a!==d&&(h[r[d]]+=$(s[a],s[d]));const p=m[u]>1?h[u]/(m[u]-1):0;let y=1/0;for(let d=0;d<i;d++){if(d===u||m[d]===0)continue;const f=h[d]/m[d];f<y&&(y=f)}y!==1/0&&(c+=(y-p)/Math.max(p,y))}return c/n}function o(s,r={}){const i=s.length;if(!i)return null;const n=r.criterion==="silhouette"?"silhouette":"elbow",m=Math.max(2,Math.floor(r.maxK||8)),c=r.seed===void 0?1:r.seed;if(n==="silhouette"){const w=[],k=[];for(let G=2;G<=Math.min(m,i);G++){const K=b(s,{k:G,seed:c});K&&(w.push(G),k.push(g(s,K.assignments,G)))}if(!w.length)return null;let P=0;for(let G=1;G<k.length;G++)k[G]>k[P]&&(P=G);return{k:w[P],criterion:n,scores:k,ks:w}}const a=[],u=[];for(let w=1;w<=Math.min(m,i);w++){const k=b(s,{k:w,seed:c});k&&(a.push(w),u.push(k.inertia))}if(u.length<2)return null;const h={k:a[0],y:u[0]},p={k:a[a.length-1],y:u[u.length-1]},y=Math.hypot(p.k-h.k,p.y-h.y)||1;let d=0,f=-1/0;for(let w=0;w<u.length;w++){const k=Math.abs((p.k-h.k)*(h.y-u[w])-(h.k-a[w])*(p.y-h.y))/y;k>f&&(f=k,d=w)}return{k:a[d],criterion:n,scores:u,ks:a}}function t(s){const r=s.length,i=r?s[0].length:0;if(!r||!i)return null;const n=new Array(i).fill(0);for(let c=0;c<r;c++)for(let a=0;a<i;a++)n[a]+=s[c][a];for(let c=0;c<i;c++)n[c]/=r;const m=new Array(i).fill(0);for(let c=0;c<r;c++)for(let a=0;a<i;a++){const u=s[c][a]-n[a];m[a]+=u*u}for(let c=0;c<i;c++)m[c]=r>1?Math.sqrt(m[c]/(r-1)):0;for(let c=0;c<r;c++)for(let a=0;a<i;a++)m[a]>0?s[c][a]=(s[c][a]-n[a])/m[a]:s[c][a]=s[c][a]-n[a];return{mean:n,sd:m}}}),Ve("packages/core/src/compute/compare.js",function(e,D){"use strict";Object.defineProperty(e,"COMPARE_MEASURES",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"pooledStandardMeanDifference",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"numericSummary",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"bothNumeric",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"compareColumnAcross",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"compareDatasets",{enumerable:!0,get:function(){return l}});const re=D("packages/core/src/compute/statistics.js"),A=re.numbers,Y=re.moments,I=re.frequencyMap,L=re.categoricalDistance,Q=re.normalTotalVariation,H=re.isNumericColumn,$=re.SUBSET_RELIABILITY_FLOOR,X=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function F(g,o){if(!g||!o||!(g.n>0)||!(o.n>0)||!Number.isFinite(g.mean)||!Number.isFinite(o.mean))return null;const t=(g.n*g.sd*g.sd+o.n*o.sd*o.sd)/(g.n+o.n);return t>0?(g.mean-o.mean)/Math.sqrt(t):null}function j(g,o){const t=A(g,o),{n:s,mean:r,m2:i}=Y(t),n=s>0?Math.sqrt(i/s):0;return{mean:r,sd:n,n:s}}function v(g,o,t,s){return H(g,o)&&H(t,s)}function b(g,o,t,s){if(v(g,o,t,s)){const m=j(g,o),c=j(t,s),a=F(m,c);return{measure:X.numeric,magnitude:a,distance:a===null?0:Q(a),direction:a===null?0:Math.sign(a),nA:m.n,nB:c.n,meanA:m.mean,meanB:c.mean,reliable:m.n>=$&&c.n>=$}}const r=I(g,o),i=I(t,s),n=L(r.map,r.total,i.map,i.total);return{measure:X.categorical,magnitude:n,distance:n===null?0:n,direction:0,nA:r.total,nB:i.total,meanA:null,meanB:null,reliable:r.total>=$&&i.total>=$}}function l(g,o,t={}){const s=new Set(g.columns),r=new Set(o.columns),i=g.columns.filter(u=>r.has(u)),n=Array.isArray(t.columns)&&t.columns.length?i.filter(u=>t.columns.includes(u)):i,m=g.indices(),c=o.indices(),a=[];for(const u of n){const h=g.handle(u),p=o.handle(u);if(!h||!p)continue;const y=b(h,m,p,c);a.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 a.sort((u,h)=>h.distance-u.distance||Math.abs(h.magnitude||0)-Math.abs(u.magnitude||0)),{ranked:a,nA:m.length,nB:c.length,unmatched:{onlyA:g.columns.filter(u=>!r.has(u)),onlyB:o.columns.filter(u=>!s.has(u))},measures:X}}}),Ve("packages/core/src/compute/anomaly.js",function(e,D){"use strict";Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"DEFAULT_MODIFIED_Z_THRESHOLD",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return r}}),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 A=D("packages/core/src/compute/statistics.js").quantileSorted,I=D("packages/core/src/compute/special.js").logGamma,L=.6745,Q=3.5,H=1.5,$=.975,X=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function F(c){if(!c.length)return null;const u=Array.from(c,Number).sort((d,f)=>d-f),h=A(u,.5),p=u.map(d=>Math.abs(d-h)).sort((d,f)=>d-f),y=A(p,.5);return{median:h,mad:y}}function j(c,a={}){const u=Number.isFinite(a.threshold)?a.threshold:Q,h=c.length,p=new Array(h).fill(null),y=new Array(h).fill(!1),d=[];for(let k=0;k<h;k++){const P=Number(c[k]);Number.isFinite(P)&&d.push(P)}if(!d.length)return{median:null,mad:null,threshold:u,scores:p,flags:y,flagged:0};const f=F(d);if(f.mad===0)return{median:f.median,mad:0,threshold:u,scores:p,flags:y,flagged:0};let w=0;for(let k=0;k<h;k++){const P=Number(c[k]);if(!Number.isFinite(P))continue;const G=L*(P-f.median)/f.mad;p[k]=G,Math.abs(G)>u&&(y[k]=!0,w++)}return{median:f.median,mad:f.mad,threshold:u,scores:p,flags:y,flagged:w}}function v(c,a={}){const u=Number.isFinite(a.k)?a.k:H,h=[];for(let w=0;w<c.length;w++){const k=Number(c[w]);Number.isFinite(k)&&h.push(k)}if(!h.length)return null;const p=h.sort((w,k)=>w-k),y=A(p,.25),d=A(p,.75),f=d-y;return{q1:y,q3:d,iqr:f,lower:y-u*f,upper:d+u*f,k:u}}function b(c,a){if(a<=0)return 0;const u=I(c);if(a<c+1){let k=c,P=1/c,G=P;for(let K=0;K<1e3&&(k+=1,G*=a/k,P+=G,!(Math.abs(G)<Math.abs(P)*1e-15));K++);return P*Math.exp(-a+c*Math.log(a)-u)}const h=1e-300;let p=a+1-c,y=1/h,d=1/p,f=d;for(let k=1;k<1e3;k++){const P=-k*(k-c);p+=2,d=P*d+p,Math.abs(d)<h&&(d=h),y=p+P/y,Math.abs(y)<h&&(y=h),d=1/d;const G=d*y;if(f*=G,Math.abs(G-1)<1e-15)break}return 1-Math.exp(-a+c*Math.log(a)-u)*f}function l(c,a){return c<=0?0:b(a/2,c/2)}function g(c,a=$){if(!(a>0)||!(a<1))return NaN;let u=0,h=Math.max(1,c);for(;l(h,c)<a;)h*=2;for(let p=0;p<200;p++){const y=(u+h)/2;if(l(y,c)<a?u=y:h=y,h-u<1e-10)break}return(u+h)/2}function o(c){const a=c.length,u=c.map((h,p)=>{const y=h.slice();for(let d=0;d<a;d++)y.push(p===d?1:0);return y});for(let h=0;h<a;h++){let p=h;for(let d=h+1;d<a;d++)Math.abs(u[d][h])>Math.abs(u[p][h])&&(p=d);if(Math.abs(u[p][h])<1e-12)return null;if(p!==h){const d=u[p];u[p]=u[h],u[h]=d}const y=u[h][h];for(let d=0;d<2*a;d++)u[h][d]/=y;for(let d=0;d<a;d++){if(d===h)continue;const f=u[d][h];if(f!==0)for(let w=0;w<2*a;w++)u[d][w]-=f*u[h][w]}}return u.map(h=>h.slice(a))}function t(c,a){const u=c.length,h=new Array(a).fill(0);for(const d of c)for(let f=0;f<a;f++)h[f]+=d[f];for(let d=0;d<a;d++)h[d]/=u;const p=Array.from({length:a},()=>new Array(a).fill(0));for(const d of c)for(let f=0;f<a;f++){const w=d[f]-h[f];for(let k=f;k<a;k++)p[f][k]+=w*(d[k]-h[k])}const y=u>1?u-1:1;for(let d=0;d<a;d++)for(let f=d;f<a;f++)p[d][f]/=y,p[f][d]=p[d][f];return{mean:h,cov:p}}function s(c,a={}){const u=Number.isFinite(a.p)?a.p:$,h=Number.isFinite(a.ridge)?a.ridge:1e-6,p=c.length;if(!p)return null;const y=c[0].length;if(!y)return null;const d=new Array(p).fill(null),f=new Array(p).fill(null),w=new Array(p).fill(!1),k=[],P=[];for(let N=0;N<p;N++){const O=c[N];let T=O.length===y;const R=new Array(y);for(let x=0;T&&x<y;x++){const U=Number(O[x]);Number.isFinite(U)?R[x]=U:T=!1}T&&(k.push(N),P.push(R))}const G=y,K=g(G,u);if(P.length<=y)return{center:[],df:G,cutoff:K,singular:!0,used:P.length,distances:d,squared:f,flags:w,flagged:0};const{mean:q,cov:B}=t(P,y);let E=o(B),S=!1;if(!E){S=!0;let N=0;for(let R=0;R<y;R++)N+=B[R][R];const O=N/y*h||h,T=B.map((R,x)=>R.map((U,V)=>x===V?U+O:U));if(E=o(T),!E)return{center:q,df:G,cutoff:K,singular:!0,used:P.length,distances:d,squared:f,flags:w,flagged:0}}let C=0;for(let N=0;N<P.length;N++){const O=P[N],T=new Array(y);for(let U=0;U<y;U++)T[U]=O[U]-q[U];let R=0;for(let U=0;U<y;U++){let V=0;for(let J=0;J<y;J++)V+=E[U][J]*T[J];R+=T[U]*V}R<0&&(R=0);const x=k[N];f[x]=R,d[x]=Math.sqrt(R),R>K&&(w[x]=!0,C++)}return{center:q,df:G,cutoff:K,singular:S,used:P.length,distances:d,squared:f,flags:w,flagged:C}}const r=20,i=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function n(c,a={}){const u=a.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",h=Number.isFinite(a.windowLen)&&a.windowLen>=1?Math.floor(a.windowLen):r,p=Number.isFinite(a.threshold)?a.threshold:Q,y=Number.isFinite(a.k)?a.k:H,d=Number.isFinite(a.minPeriods)&&a.minPeriods>=1?Math.floor(a.minPeriods):h,f=c.length,w=new Array(f).fill(null),k=new Array(f).fill(!1);let P=0;for(let G=0;G<f;G++){const K=Number(c[G]);if(!Number.isFinite(K))continue;const q=Math.max(0,G-h+1),B=[];for(let E=q;E<=G;E++){const S=Number(c[E]);Number.isFinite(S)&&B.push(S)}if(!(B.length<d))if(u==="rollingIqr"){const E=v(B,{k:y});if(!E)continue;(K<E.lower||K>E.upper)&&(k[G]=!0,P++)}else{const E=F(B);if(!E||E.mad===0)continue;const S=L*(K-E.median)/E.mad;w[G]=S,Math.abs(S)>p&&(k[G]=!0,P++)}}return{method:u,windowLen:h,minPeriods:d,threshold:p,k:y,scores:w,flags:k,flagged:P}}function m(c={}){const a=c||{},u=a.field;if(typeof u!="string"||!u)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const h=a.method||"modifiedZScore";if(!(X.includes(h)||i.includes(h))||h==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${h}'`);const y=typeof a.orderBy=="string"?a.orderBy:null,d=a.latest===!0,f=i.includes(h),w=k=>Number(k==null?NaN:k[u]);return k=>{const P=Array.isArray(k)?k.slice():[...k];y&&P.sort((E,S)=>{const C=E?.[y],N=S?.[y];return C===N?0:C==null?-1:N==null?1:C<N?-1:1});const G=P.map(w);let K,q;if(f)({flags:K,scores:q}=n(G,{method:h,windowLen:a.windowLen,threshold:a.threshold,k:a.k,minPeriods:a.minPeriods}));else if(h==="iqr"){const E=v(G,{k:a.k});K=G.map(S=>E?Number.isFinite(S)&&(S<E.lower||S>E.upper):!1),q=G.map(()=>null)}else({flags:K,scores:q}=j(G,{threshold:a.threshold}));if(d){const E=K.length-1;return E<0||!K[E]?!1:{method:h,field:u,flagged:[{row:P[E],score:q[E]}]}}const B=[];for(let E=0;E<K.length;E++)K[E]&&B.push({row:P[E],score:q[E]});return B.length?{method:h,field:u,flagged:B}:!1}}}),Ve("packages/core/src/compute/forecast.js",function(e,D){"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 re=D("packages/core/src/compute/special.js"),A=re.normalQuantile,Y=re.studentTQuantile,L=D("packages/core/src/internal/warn.js").warnOnce,Q=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),H=1e-4,$=1-1e-4;function X(a){const u=[];for(let h=0;h<a.length;h++){const p=a[h];if(p!==null&&typeof p=="object"){const y=Number.isFinite(p.at)?p.at:h,d=Number.isFinite(p.value)?p.value:null;u.push({at:y,value:d})}else u.push({at:h,value:Number.isFinite(p)?Number(p):null})}return u}function F(a){const u=a.filter(f=>f.value!==null),h=u[0],p=u[u.length-1],y=p.at-h.at,d=u.length>1&&y>0?y/(u.length-1):1;return{lastAt:p.at,step:d}}function j(a){return Math.min($,Math.max(H,a))}function v(a,u=H,h=$,p=80){const y=(Math.sqrt(5)-1)/2;let d=u,f=h,w=f-y*(f-d),k=d+y*(f-d),P=a(w),G=a(k);for(let K=0;K<p;K++)P<G?(f=k,k=w,G=P,w=f-y*(f-d),P=a(w)):(d=w,w=k,P=G,k=d+y*(f-d),G=a(k));return(d+f)/2}function b(a,u){let h=null,p=0,y=0;for(let d=0;d<a.length;d++){const f=a[d];if(f!==null){if(h===null){h=f;continue}p+=(f-h)**2,y+=1,h=u*f+(1-u)*h}}return{level:h,sse:p,m:y}}function l(a,u,h){let p=null,y=null,d=0,f=0;for(let w=0;w<a.length;w++){const k=a[w];if(k===null){p!==null&&y!==null&&(p+=y);continue}if(p===null){p=k;continue}y===null&&(y=k-p);const P=p+y;d+=(k-P)**2,f+=1;const G=p;p=u*k+(1-u)*(G+y),y=h*(p-G)+(1-h)*y}return{level:p,trend:y,sse:d,m:f}}function g(a,u,h,p,y){const d=a.length;if(d<2*u)return null;const f=S=>{let C=0,N=0;for(let O=S;O<S+u&&O<d;O++)a[O]!==null&&(C+=a[O],N+=1);return N?C/N:null},w=f(0),k=f(u);if(w===null||k===null)return null;let P=w,G=(k-w)/u;const K=new Array(u).fill(0);for(let S=0;S<u;S++)K[S]=a[S]===null?0:a[S]-P;const q=K.reduce((S,C)=>S+C,0)/u;for(let S=0;S<u;S++)K[S]-=q;let B=0,E=0;for(let S=u;S<d;S++){const C=S%u,N=K[C],O=a[S];if(O===null){P+=G;continue}const T=P+G+N;B+=(O-T)**2,E+=1;const R=P;P=h*(O-N)+(1-h)*(P+G),G=p*(P-R)+(1-p)*G,K[C]=y*(O-P)+(1-y)*N}return{level:P,trend:G,season:K,phase:(d-1)%u,sse:B,count:E}}function o(a,u,h){let p=1;for(const d of u)p+=d*d;const y=Math.sqrt(a*p);return{se:y,margin:h*y}}function t(a,u={}){if(!a||typeof a.length!="number"||a.length===0)return null;const h=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,d=1-(1-y)/2,f=X(a),w=f.map(B=>B.value),k=w.filter(B=>B!==null),P=k.length,{lastAt:G,step:K}=P?F(f):{lastAt:0,step:1},q=B=>G+B*K;return h==="linear"?s(f,P,p,y,d,q):h==="movingAverage"?r(k,P,p,y,d,u,q):h==="ses"?i(w,P,p,y,d,u,q):h==="holt"?n(w,P,p,y,d,u,q):m(w,P,p,y,d,u,q)}function s(a,u,h,p,y,d){if(u<2)return null;let f=0,w=0;for(const O of a)O.value!==null&&(f+=O.at,w+=O.value);f/=u,w/=u;let k=0,P=0,G=0;for(const O of a){if(O.value===null)continue;const T=O.at-f,R=O.value-w;k+=T*T,P+=T*R,G+=R*R}if(k===0)return null;const K=P/k,q=w-K*f,B=G===0?1:Math.max(0,Math.min(1,P*P/(k*G))),E=Math.max(0,G-K*P),S=u>2?Math.sqrt(E/(u-2)):null,C=u>2?Y(y,u-2):null,N=[];for(let O=1;O<=h;O++){const T=d(O),R=q+K*T;let x=null,U=null,V=null,J=null,_=null;if(S!==null){const ee=1/u+(T-f)**2/k,W=S*Math.sqrt(1+ee),Z=S*Math.sqrt(ee);_=W,x=R-C*W,U=R+C*W,V=R-C*Z,J=R+C*Z}N.push({step:O,at:T,mean:R,lower:x,upper:U,lowerMean:V,upperMean:J,se:_})}return{method:"linear",horizon:h,confidence:p,n:u,sigma:S,r2:B,params:{slope:K,intercept:q},points:N}}function r(a,u,h,p,y,d,f){if(u<1)return null;const w=Math.max(1,Math.min(u,Math.floor(Number(d.windowLen)||u))),k=a.slice(u-w);let P=0;for(const S of k)P+=S;const G=P/w;let K=null,q=null;if(w>1){let S=0;for(const N of k)S+=(N-G)**2;K=Math.sqrt(S/(w-1))*Math.sqrt(1+1/w),q=Y(y,w-1)}const B=K===null?null:q*K,E=[];for(let S=1;S<=h;S++)E.push({step:S,at:f(S),mean:G,lower:B===null?null:G-B,upper:B===null?null:G+B,se:K});return{method:"movingAverage",horizon:h,confidence:p,n:u,sigma:K===null?null:K,params:{windowLen:w},points:E}}function i(a,u,h,p,y,d,f){if(u<1)return null;let w=Number.isFinite(d.alpha)?j(d.alpha):null;w===null&&(w=v(q=>b(a,q).sse));const k=b(a,w),P=A(y),G=k.m>0?k.sse/k.m:null,K=[];for(let q=1;q<=h;q++){const B=k.level;let E=null,S=null,C=null;if(G!==null){const N=[];for(let T=1;T<q;T++)N.push(w);const O=o(G,N,P);C=O.se,E=B-O.margin,S=B+O.margin}K.push({step:q,at:f(q),mean:B,lower:E,upper:S,se:C})}return{method:"ses",horizon:h,confidence:p,n:u,sigma:G===null?null:Math.sqrt(G),params:{alpha:w},points:K}}function n(a,u,h,p,y,d,f){if(u<2)return null;let w=Number.isFinite(d.alpha)?j(d.alpha):null,k=Number.isFinite(d.beta)?j(d.beta):null;if(w===null||k===null){let E=w===null?.5:w,S=k===null?.5:k;for(let C=0;C<6;C++)w===null&&(E=v(N=>l(a,N,S).sse)),k===null&&(S=v(N=>l(a,E,N).sse));w=w===null?E:w,k=k===null?S:k}const P=l(a,w,k),G=A(y),K=P.m>0?P.sse/P.m:null,q=w*k,B=[];for(let E=1;E<=h;E++){const S=P.level+E*P.trend;let C=null,N=null,O=null;if(K!==null){const T=[];for(let x=1;x<E;x++)T.push(w+x*q);const R=o(K,T,G);O=R.se,C=S-R.margin,N=S+R.margin}B.push({step:E,at:f(E),mean:S,lower:C,upper:N,se:O})}return{method:"holt",horizon:h,confidence:p,n:u,sigma:K===null?null:Math.sqrt(K),params:{alpha:w,beta:k},points:B}}function m(a,u,h,p,y,d,f){const w=Math.floor(Number(d.period));if(!(w>=2))return L("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(u<2*w)return null;let k=Number.isFinite(d.alpha)?j(d.alpha):null,P=Number.isFinite(d.beta)?j(d.beta):null,G=Number.isFinite(d.gamma)?j(d.gamma):null;const K=(O,T,R)=>{const x=g(a,w,O,T,R);return x?x.sse:1/0};if(k===null||P===null||G===null){let O=k===null?.5:k,T=P===null?.5:P,R=G===null?.5:G;for(let x=0;x<8;x++)k===null&&(O=v(U=>K(U,T,R))),P===null&&(T=v(U=>K(O,U,R))),G===null&&(R=v(U=>K(O,T,U)));k=k===null?O:k,P=P===null?T:P,G=G===null?R:G}const q=g(a,w,k,P,G);if(!q)return null;const B=A(y),E=q.count>0?q.sse/q.count:null,S=k*P,C=G*(1-k),N=[];for(let O=1;O<=h;O++){const T=q.season[(q.phase+O)%w],R=q.level+O*q.trend+T;let x=null,U=null,V=null;if(E!==null){const J=[];for(let ee=1;ee<O;ee++)J.push(k+ee*S+(ee%w===0?C:0));const _=o(E,J,B);V=_.se,x=R-_.margin,U=R+_.margin}N.push({step:O,at:f(O),mean:R,lower:x,upper:U,se:V})}return{method:"holtWinters",horizon:h,confidence:p,n:u,sigma:E===null?null:Math.sqrt(E),params:{alpha:k,beta:P,gamma:G,period:w},points:N}}const c={FORECAST_METHODS:Q,forecast:t}}),Ve("packages/core/src/compute/hypothesis.js",function(e,D){"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 a}}),Object.defineProperty(e,"welchTTest",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"mannWhitneyUTest",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"chiSquareTest",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return B}});const A=D("packages/core/src/internal/warn.js").warnOnce,I=D("packages/core/src/compute/handle.js").valueReader,L=D("packages/core/src/compute/statistics.js"),Q=L.numbers,H=L.moments,$=L.frequencyMap,X=L.categoricalDistance,F=L.isNumericColumn,j=L.jarqueBera,v=L.proportionInterval,b=L.SUBSET_RELIABILITY_FLOOR,g=D("packages/core/src/compute/compare.js").pooledStandardMeanDifference,o=D("packages/core/src/compute/special.js"),t=o.studentT,s=o.studentTQuantile,r=o.normalCdf,i=o.normalQuantile,n=o.chiSquareUpperTail,m=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),c=.05,a=2e6;function u(E){const S=Number(E);return Number.isFinite(S)&&S>0&&S<1?S:.95}function h(E){const{n:S,mean:C,m2:N}=H(E);return{mean:C,sd:S>0?Math.sqrt(N/S):0,n:S}}function p(E,S){const C=E.length;if(C<2)return 0;let N=0;for(let O=0;O<C;O++){const T=E[O]-S;N+=T*T}return N/(C-1)}function y(E,S){return{name:"pooledStandardMeanDifference",value:g(h(E),h(S))}}function d(E,S,C){const N=E.length,O=S.length;if(N<2||O<2)return null;const T=u(C),{mean:R}=H(E),{mean:x}=H(S),U=p(E,R),V=p(S,x),J=U/N+V/O;if(!(J>0))return null;const _=Math.sqrt(J),ee=(R-x)/_,W=U/N*(U/N)/(N-1),Z=V/O*(V/O)/(O-1),ne=J*J/(W+Z),ie=Math.min(1,Math.max(0,2*(1-t(Math.abs(ee),ne)))),ce=R-x,me=s(1-(1-T)/2,ne)*_;return{test:m.WELCH,statistic:ee,statisticName:"t",df:ne,pValue:ie,interval:{estimate:ce,lower:ce-me,upper:ce+me,confidence:T,method:"welch-t (difference of means)"},effectSize:y(E,S),nA:N,nB:O,reliable:N>=b&&O>=b,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function f(E){const S=E.length;if(S===0)return Number.NaN;const C=S>>1;return S%2?E[C]:(E[C-1]+E[C])/2}function w(E,S,C){const N=E.length,O=S.length,T=N*O;if(T===0||T>a)return null;const R=new Float64Array(T);let x=0;for(let W=0;W<N;W++)for(let Z=0;Z<O;Z++)R[x++]=E[W]-S[Z];R.sort();const U=f(R),V=Math.sqrt(N*O*(N+O+1)/12),J=i(1-(1-C)/2);let _=Math.round(T/2-J*V);_>=0||(_=0);const ee=Math.floor((T-1)/2);return _>ee&&(_=ee),{estimate:U,lower:R[_],upper:R[T-1-_],confidence:C,method:"hodges-lehmann (normal approximation)"}}function k(E,S,C){const N=E.length,O=S.length;if(N<1||O<1)return null;const T=u(C),R=N+O,x=new Array(R);for(let ie=0;ie<N;ie++)x[ie]={v:E[ie],g:0};for(let ie=0;ie<O;ie++)x[N+ie]={v:S[ie],g:1};x.sort((ie,ce)=>ie.v-ce.v);let U=0,V=0,J=0;for(;J<R;){let ie=J;for(;ie<R&&x[ie].v===x[J].v;)ie++;const ce=ie-J,me=(J+1+ie)/2;for(let Ce=J;Ce<ie;Ce++)x[Ce].g===0&&(U+=me);V+=ce*ce*ce-ce,J=ie}const _=U-N*(N+1)/2,ee=N*O/2,W=N*O/12*(R+1-V/(R*(R-1)));let Z=1;if(W>0){const ie=Math.max(0,Math.abs(_-ee)-.5);Z=Math.min(1,2*r(-ie/Math.sqrt(W)))}const ne=w(E,S,T);return{test:m.MANN_WHITNEY,statistic:_,statisticName:"U",df:null,pValue:Z,interval:ne,effectSize:y(E,S),nA:N,nB:O,reliable:N>=b&&O>=b,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function P(E,S,C,N,O){const T=v(E,S,O),R=v(C,N,O);if(!T||!R)return null;const x=T.proportion-R.proportion,U=x-Math.sqrt((T.proportion-T.lower)**2+(R.upper-R.proportion)**2),V=x+Math.sqrt((T.upper-T.proportion)**2+(R.proportion-R.lower)**2);return{lower:U,upper:V}}function G(E,S,C,N,O,T={}){if(!(S>0)||!(N>0))return null;const R=new Set([...E.keys(),...C.keys()]),x=R.size;if(x<2)return null;const U=S+N;let V=0;for(const Z of R){const ne=E.get(Z)||0,ie=C.get(Z)||0,ce=ne+ie,me=S*ce/U,Ce=N*ce/U;me>0&&(V+=(ne-me)*(ne-me)/me),Ce>0&&(V+=(ie-Ce)*(ie-Ce)/Ce)}const J=x-1,_=n(V,J);let ee=null;T.category!==void 0&&R.has(T.category)?ee=T.category:x===2&&([ee]=[...R]);let W=null;if(ee!==null){const Z=P(E.get(ee)||0,S,C.get(ee)||0,N,u(O));Z&&(W={estimate:(E.get(ee)||0)/S-(C.get(ee)||0)/N,lower:Z.lower,upper:Z.upper,confidence:u(O),method:"newcombe (difference in this category's share)",category:ee})}return{test:m.CHI_SQUARE,statistic:V,statisticName:"chiSquare",df:J,pValue:_,interval:W,effectSize:{name:"categoricalTotalVariation",value:X(E,S,C,N)},nA:S,nB:N,reliable:S>=b&&N>=b,method:"Pearson chi-square test of independence (2×k, no continuity correction)"}}function K(E){return E==null||E===""||typeof E=="number"&&Number.isNaN(E)?null:E instanceof Date?E.getTime():typeof E=="object"?String(E):E}function q(E,S,C){if(C===m.WELCH||C===m.MANN_WHITNEY)return{test:C,chosenBy:"override",reason:`caller override: ${C}`};const N=j(E),O=j(S),T=N===null?null:Math.exp(-N/2),R=O===null?null:Math.exp(-O/2);return T!==null&&T<c||R!==null&&R<c?{test:m.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${c})`}:{test:m.WELCH,chosenBy:"auto",reason:T!==null||R!==null?"column family: numeric, no departure from normality detected":"column family: numeric (too few rows to screen normality)"}}function B(E,S,C,N={}){if(!E||!S)return null;const O=u(N.confidence),T=I(S);let R;if(Array.isArray(N.groups)&&N.groups.length===2)R=[K(N.groups[0]),K(N.groups[1])];else{const{map:ie}=$(S,C),ce=[...ie.entries()].sort((me,Ce)=>Ce[1]-me[1]).slice(0,2).map(me=>me[0]);if(ce.length<2)return A("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;R=ce}const[x,U]=R;if(x===null||U===null||x===U)return A("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const V=[],J=[];for(let ie=0;ie<C.length;ie++){const ce=K(T(C[ie]));ce===x?V.push(C[ie]):ce===U&&J.push(C[ie])}if(V.length===0||J.length===0)return A("compareGroups:empty","[lattice] compareGroups: one of the two groups has no rows in the current set."),null;const _=N.test&&N.test!=="auto"?String(N.test):null,ee=F(E,V.concat(J));let W,Z,ne;if(_===m.CHI_SQUARE||!_&&!ee){Z=_?"override":"auto",ne=_?"caller override: chiSquare":"column family: categorical";const ie=$(E,V),ce=$(E,J);W=G(ie.map,ie.total,ce.map,ce.total,O,{category:N.category})}else{if((_===m.WELCH||_===m.MANN_WHITNEY)&&!ee)return A("compareGroups:numeric-override",`[lattice] compareGroups: ${_} needs a numeric column, but the column is not numeric.`),null;const ie=Q(E,V),ce=Q(E,J),me=q(ie,ce,_);Z=me.chosenBy,ne=me.reason,W=me.test===m.MANN_WHITNEY?k(ie,ce,O):d(ie,ce,O)}return W?{...W,chosenBy:Z,reason:ne,groups:[x,U]}:(A("compareGroups:degenerate","[lattice] compareGroups: the chosen test had too little to work with (too few values, or no variation)."),null)}}),Ve("packages/core/src/compute/significance.js",function(e,D){"use strict";Object.defineProperty(e,"COMPARE_TESTS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"compare",{enumerable:!0,get:function(){return Pe}});const A=D("packages/core/src/internal/warn.js").warnOnce,I=D("packages/core/src/compute/handle.js").valueReader,L=D("packages/core/src/compute/statistics.js"),Q=L.numbers,H=L.moments,$=L.frequencyMap,X=L.isNumericColumn,F=L.jarqueBera,j=L.proportionInterval,v=D("packages/core/src/compute/special.js"),b=v.studentT,l=v.studentTQuantile,g=v.normalCdf,o=v.normalQuantile,t=v.chiSquareUpperTail,s=v.incompleteBeta,r=Object.freeze({T:"t",WELCH:"welch",MANN_WHITNEY:"mannWhitney",ANOVA:"anova",KRUSKAL:"kruskal",CHI_SQUARE:"chiSquare",PROPORTIONS:"proportions"}),i=new Set([r.T,r.WELCH,r.MANN_WHITNEY]),n=new Set([r.ANOVA,r.KRUSKAL]),m=new Set([r.CHI_SQUARE,r.PROPORTIONS]),c=.05,a=[.2,.5,.8],u=[.147,.33,.474],h=[.01,.06,.14],p=[[.1,.3,.5],[.07,.21,.35],[.06,.17,.29],[.05,.15,.25]];function y(ve){const oe=Number(ve);return Number.isFinite(oe)&&oe>0&&oe<1?oe:.05}function d(ve){return ve==null||ve===""||typeof ve=="number"&&Number.isNaN(ve)?null:ve instanceof Date?ve.getTime():typeof ve=="object"?String(ve):ve}function f(ve,oe){const he=I(ve),ae=[],se=new Map;for(let de=0;de<oe.length;de++){const ke=d(he(oe[de]));if(ke===null)continue;let Ae=se.get(ke);Ae||(Ae={value:ke,rows:[]},se.set(ke,Ae),ae.push(Ae)),Ae.rows.push(oe[de])}return ae}function w(ve){const{n:oe,mean:he,m2:ae}=H(ve),se=oe>1?ae/(oe-1):0;return{n:oe,mean:he,sd:Math.sqrt(se),variance:se}}function k(ve,oe,he){if(!(oe>0)||!(he>0)||!(ve>=0)||!Number.isFinite(ve))return Number.NaN;if(ve===0)return 1;const ae=oe*ve/(oe*ve+he);return 1-s(oe/2,he/2,ae)}function P(ve,oe){const he=Math.abs(ve);return Number.isFinite(he)?he>=oe[2]?"large":he>=oe[1]?"medium":he>=oe[0]?"small":"negligible":"negligible"}function G(ve,oe,he){if(ve==="cohensD")return P(oe,a);if(ve==="cliffsDelta")return P(oe,u);if(ve==="etaSquared")return P(oe,h);const ae=Math.max(1,Math.min(p.length,Math.floor(he||1)));return P(oe,p[ae-1])}function K(ve,oe){if(!(ve.n>1)||!(oe.n>1))return null;const he=((ve.n-1)*ve.variance+(oe.n-1)*oe.variance)/(ve.n+oe.n-2);return he>0?(ve.mean-oe.mean)/Math.sqrt(he):null}function q(ve,oe){const he=ve.length,ae=oe.length;if(!he||!ae)return null;const se=Array.from(oe).sort((Ae,Te)=>Ae-Te);let de=0,ke=0;for(let Ae=0;Ae<he;Ae++){const Te=ve[Ae];let je=0,ye=ae;for(;je<ye;){const Ee=je+ye>>1;se[Ee]<Te?je=Ee+1:ye=Ee}const He=je;let Me=je;for(;Me<ae&&se[Me]===Te;)Me++;const Re=Me-je;de+=He,ke+=ae-Me}return(de-ke)/(he*ae)}function B(ve,oe,he,ae){const se=Math.min(he-1,ae-1);return!(oe>0)||!(se>0)?null:Math.sqrt(ve/(oe*se))}function E(ve){return Number.isFinite(ve)?ve<.001?"p < 0.001":ve>=.995?"p > 0.995":`p = ${ve.toFixed(3)}`:"p = —"}function S(ve){if(!Number.isFinite(ve))return"0";const oe=Math.abs(ve);return oe===0?"0":oe>=1e3?String(Math.round(ve)):oe>=100?String(Number(ve.toFixed(0))):oe>=10?String(Number(ve.toFixed(1))):oe>=1?String(Number(ve.toFixed(2))):String(Number(ve.toPrecision(2)))}const C=new Set(["cohensD","cliffsDelta"]);function N(ve){if(ve.difference!=null&&Math.abs(ve.difference)>=1e-12)return Math.sign(ve.difference);const oe=ve.effectSize;if(oe&&C.has(oe.name)&&Number.isFinite(oe.value)&&Math.abs(oe.value)>=1e-12)return Math.sign(oe.value);const[he,ae]=ve.groups;return Number.isFinite(he.mean)&&Number.isFinite(ae.mean)&&he.mean!==ae.mean?Math.sign(he.mean-ae.mean):0}function O(ve){const oe=ve.measureName||"values";return{subject:oe.charAt(0).toUpperCase()+oe.slice(1),be:oe==="values"?"are":"is",name:oe}}function T(ve,oe){const he=oe.unit?` ${oe.unit}`:"",{subject:ae,be:se}=O(oe),de=ve.groups[0].label,ke=ve.groups[1].label,Ae=ve.effectSize?ve.effectSize.label:"negligible",Te=ve.pValue<ve.alpha,je=Te?"unlikely to be chance":"consistent with chance";if(!Te&&Ae==="negligible")return`${ae} ${se} essentially the same for ${de} and ${ke} (${E(ve.pValue)}); the effect is ${Ae}.`;const ye=N(ve),He=`the difference is ${je} (${E(ve.pValue)}) and the effect is ${Ae}.`;if(ye===0)return`${ae} ${se} different between ${de} and ${ke}; ${He}`;const Me=ye>0?de:ke,Re=ye>0?ke:de,Ee=ve.difference!=null&&Math.abs(ve.difference)>=1e-12,$e=Math.abs(ve.difference),Ie=Ee?typeof oe.formatValue=="function"?` by about ${oe.formatValue($e)}${he}`:` by about ${S($e)}${he}`:"";return`${ae} ${se} higher for ${Me} than for ${Re}${Ie}; ${He}`}function R(ve,oe){const{name:he}=O(oe),ae=ve.effectSize?ve.effectSize.label:"negligible",se=E(ve.pValue);return ve.pValue<ve.alpha?`The groups differ in ${he}; the difference is unlikely to be chance (${se}) and the effect is ${ae}.`:ae==="negligible"?`The groups are essentially the same in ${he} (${se}); the effect is ${ae}.`:`The groups show a ${ae} effect in ${he}, but the difference is consistent with chance (${se}).`}function x(ve,oe){const he=ve.length;if(he<2)return null;const{mean:ae,m2:se}=H(ve),de=se/(he-1);if(!(de>0))return null;const ke=Math.sqrt(de),Ae=ke/Math.sqrt(he),Te=ae/Ae,je=he-1,ye=Math.min(1,Math.max(0,2*(1-b(Math.abs(Te),je)))),He=l(1-oe/2,je)*Ae,Me=ae/ke;return{test:r.T,statistic:Te,statisticName:"t",df:je,pValue:ye,difference:ae,interval:{estimate:ae,lower:ae-He,upper:ae+He,confidence:1-oe,method:"paired-t (mean of the pair differences)"},effectSize:{name:"cohensD",label:P(Me,a),value:Me}}}function U(ve,oe){const he=Array.from(ve).filter($e=>$e!==0),ae=he.length;if(!ae)return null;const se=Array.from({length:ae},($e,Ie)=>Ie).sort(($e,Ie)=>Math.abs(he[$e])-Math.abs(he[Ie])),de=new Array(ae);let ke=0;for(;ke<ae;){let $e=ke;for(;$e+1<ae&&Math.abs(he[se[$e+1]])===Math.abs(he[se[ke]]);)$e++;const Ie=(ke+$e)/2+1;for(let We=ke;We<=$e;We++)de[se[We]]=Ie;ke=$e+1}let Ae=0,Te=0;for(let $e=0;$e<ae;$e++)Te+=de[$e],he[$e]>0&&(Ae+=de[$e]);const je=Te-Ae,ye=ae*(ae+1)/4,He=Math.sqrt(ae*(ae+1)*(2*ae+1)/24),Me=He>0?(Math.abs(Ae-ye)-.5)/He:0,Re=Math.min(1,Math.max(0,2*g(-Math.max(0,Me)))),Ee=Te>0?(Ae-je)/Te:0;return{test:r.MANN_WHITNEY,statistic:Ae,statisticName:"W",df:null,pValue:Re,difference:null,interval:null,effectSize:{name:"cliffsDelta",label:P(Ee,u),value:Ee}}}function V(ve,oe,he){const ae=w(ve),se=w(oe);if(ae.n<2||se.n<2)return null;const de=((ae.n-1)*ae.variance+(se.n-1)*se.variance)/(ae.n+se.n-2);if(!(de>0))return null;const ke=Math.sqrt(de*(1/ae.n+1/se.n)),Ae=(ae.mean-se.mean)/ke,Te=ae.n+se.n-2,je=Math.min(1,Math.max(0,2*(1-b(Math.abs(Ae),Te)))),ye=ae.mean-se.mean,He=l(1-he/2,Te)*ke,Me=K(ae,se);return{test:r.T,statistic:Ae,statisticName:"t",df:Te,pValue:je,difference:ye,interval:{estimate:ye,lower:ye-He,upper:ye+He,confidence:1-he,method:"student-t (pooled variance, difference of means)"},effectSize:{name:"cohensD",label:P(Me,a),value:Me},summaries:[ae,se]}}function J(ve,oe,he){const ae=w(ve),se=w(oe);if(ae.n<2||se.n<2)return null;const de=ae.variance/ae.n+se.variance/se.n;if(!(de>0))return null;const ke=Math.sqrt(de),Ae=(ae.mean-se.mean)/ke,Te=ae.variance/ae.n*(ae.variance/ae.n)/(ae.n-1),je=se.variance/se.n*(se.variance/se.n)/(se.n-1),ye=de*de/(Te+je),He=Math.min(1,Math.max(0,2*(1-b(Math.abs(Ae),ye)))),Me=ae.mean-se.mean,Re=l(1-he/2,ye)*ke,Ee=K(ae,se);return{test:r.WELCH,statistic:Ae,statisticName:"t",df:ye,pValue:He,difference:Me,interval:{estimate:Me,lower:Me-Re,upper:Me+Re,confidence:1-he,method:"welch-t (unequal variances, difference of means)"},effectSize:{name:"cohensD",label:P(Ee,a),value:Ee},summaries:[ae,se]}}function _(ve,oe,he){const ae=ve.length,se=oe.length;if(ae<1||se<1)return null;const de=w(ve),ke=w(oe),Ae=ae+se,Te=new Array(Ae);for(let We=0;We<ae;We++)Te[We]={v:ve[We],g:0};for(let We=0;We<se;We++)Te[ae+We]={v:oe[We],g:1};Te.sort((We,Ye)=>We.v-Ye.v);let je=0,ye=0,He=0;for(;He<Ae;){let We=He;for(;We<Ae&&Te[We].v===Te[He].v;)We++;const Ye=(He+1+We)/2;for(let Qe=He;Qe<We;Qe++)Te[Qe].g===0&&(je+=Ye);const nt=We-He;ye+=nt*nt*nt-nt,He=We}const Me=je-ae*(ae+1)/2,Re=ae*se/2,Ee=ae*se/12*(Ae+1-ye/(Ae*(Ae-1)));let $e=1;if(Ee>0){const We=Math.max(0,Math.abs(Me-Re)-.5);$e=Math.min(1,2*g(-We/Math.sqrt(Ee)))}const Ie=q(ve,oe);return{test:r.MANN_WHITNEY,statistic:Me,statisticName:"U",df:null,pValue:$e,difference:null,interval:ee(ve,oe,1-he),effectSize:{name:"cliffsDelta",label:P(Ie,u),value:Ie},summaries:[de,ke]}}function ee(ve,oe,he){const ae=ve.length,se=oe.length,de=ae*se;if(de===0||de>2e6)return null;const ke=new Float64Array(de);let Ae=0;for(let Ee=0;Ee<ae;Ee++)for(let $e=0;$e<se;$e++)ke[Ae++]=ve[Ee]-oe[$e];ke.sort();const Te=de>>1,je=de%2?ke[Te]:(ke[Te-1]+ke[Te])/2,ye=Math.sqrt(ae*se*(ae+se+1)/12),He=o(1-(1-he)/2);let Me=Math.round(de/2-He*ye);Me>=0||(Me=0);const Re=Math.floor((de-1)/2);return Me>Re&&(Me=Re),{estimate:je,lower:ke[Me],upper:ke[de-1-Me],confidence:he,method:"hodges-lehmann (location shift)"}}function W(ve,oe){const he=ve.length,ae=ve.map(w);if(ae.some($e=>$e.n<2))return null;const se=ae.reduce(($e,Ie)=>$e+Ie.n,0),de=ae.reduce(($e,Ie)=>$e+Ie.mean*Ie.n,0)/se;let ke=0,Ae=0;for(let $e=0;$e<he;$e++)ke+=ae[$e].n*(ae[$e].mean-de)**2,Ae+=(ae[$e].n-1)*ae[$e].variance;const Te=he-1,je=se-he;if(!(Ae>0)||je<1)return null;const ye=ke/Te,He=Ae/je,Me=ye/He,Re=Math.min(1,Math.max(0,k(Me,Te,je))),Ee=ke/(ke+Ae);return{test:r.ANOVA,statistic:Me,statisticName:"F",df:{between:Te,within:je},pValue:Re,difference:null,interval:null,effectSize:{name:"etaSquared",label:P(Ee,h),value:Ee},summaries:ae}}function Z(ve,oe){const he=ve.length,ae=ve.map(w);if(he<2)return null;const se=ae.reduce((Ie,We)=>Ie+We.n,0),de=[];for(let Ie=0;Ie<he;Ie++)for(let We=0;We<ve[Ie].length;We++)de.push({v:ve[Ie][We],g:Ie});de.sort((Ie,We)=>Ie.v-We.v);const ke=new Array(de.length);let Ae=0,Te=0;for(;Te<de.length;){let Ie=Te;for(;Ie<de.length&&de[Ie].v===de[Te].v;)Ie++;const We=(Te+1+Ie)/2;for(let nt=Te;nt<Ie;nt++)ke[nt]=We;const Ye=Ie-Te;Ae+=Ye*Ye*Ye-Ye,Te=Ie}const je=new Array(he).fill(0);for(let Ie=0;Ie<de.length;Ie++)je[de[Ie].g]+=ke[Ie];let ye=0;for(let Ie=0;Ie<he;Ie++)ye+=je[Ie]*je[Ie]/ae[Ie].n;ye=12/(se*(se+1))*ye-3*(se+1);const He=1-Ae/(se*se*se-se),Me=He>0?ye/He:ye,Re=he-1,Ee=Math.min(1,Math.max(0,t(Me,Re))),$e=(Me-he+1)/(se-he);return{test:r.KRUSKAL,statistic:Me,statisticName:"H",df:Re,pValue:Ee,difference:null,interval:null,effectSize:{name:"etaSquared",label:P($e,h),value:Math.max(0,$e)},summaries:ae}}function ne(ve,oe,he,ae,se){const de=j(ve,oe,se),ke=j(he,ae,se);if(!de||!ke)return null;const Ae=de.proportion-ke.proportion,Te=Ae-Math.sqrt((de.proportion-de.lower)**2+(ke.upper-ke.proportion)**2),je=Ae+Math.sqrt((de.upper-de.proportion)**2+(ke.proportion-ke.lower)**2);return{estimate:Ae,lower:Te,upper:je}}function ie(ve,oe,he,ae){const se=I(oe),de=new Set,ke=[];for(const We of ve){const Ye=new Map;let nt=0;for(const Qe of We.rows){const dt=d(se(Qe));dt!==null&&(Ye.set(dt,(Ye.get(dt)||0)+1),nt++,de.add(dt))}ke.push(Ye),We.total=nt}const Ae=[...de];if(Ae.length<2)return null;const Te=ve.reduce((We,Ye)=>We+Ye.total,0);if(!(Te>0))return null;let je=0;for(const We of ve)for(const Ye of Ae){const nt=ke[ve.indexOf(We)].get(Ye)||0,Qe=ve.reduce((jt,Et)=>jt+(ke[ve.indexOf(Et)].get(Ye)||0),0),dt=We.total*Qe/Te;dt>0&&(je+=(nt-dt)*(nt-dt)/dt)}const ye=ve.length,He=Ae.length,Me=(ye-1)*(He-1),Re=Math.min(1,Math.max(0,t(je,Me))),Ee=B(je,Te,ye,He);let $e=null;if(ye===2&&He===2){const[We]=Ae,Ye=ke[0].get(We)||0,nt=ke[1].get(We)||0,Qe=ne(Ye,ve[0].total,nt,ve[1].total,ae);Qe&&($e={...Qe,confidence:ae,method:"newcombe (difference in this category's share)",category:We})}const Ie=ve.map((We,Ye)=>{const nt={};for(const Qe of Ae)nt[String(Qe)]=(ke[Ye].get(Qe)||0)/We.total;return nt});return{test:r.CHI_SQUARE,statistic:je,statisticName:"chiSquare",df:Me,pValue:Re,difference:null,interval:$e,effectSize:{name:"cramersV",label:G("cramersV",Ee,Math.min(ye-1,He-1)),value:Ee},proportions:Ie}}function ce(ve,oe,he,ae){const se=I(oe),de=new Set;for(const Qe of ve)for(const dt of Qe.rows){const jt=d(se(dt));jt!==null&&de.add(jt)}if(de.size!==2)return null;const[ke]=[...de],Ae=ve[0].rows.reduce((Qe,dt)=>Qe+(d(se(dt))===ke?1:0),0),Te=ve[1].rows.reduce((Qe,dt)=>Qe+(d(se(dt))===ke?1:0),0),je=ve[0].rows.length,ye=ve[1].rows.length;if(!(je>0)||!(ye>0))return null;const He=Ae/je,Me=Te/ye,Re=(Ae+Te)/(je+ye);if(!(Re>0)||!(Re<1))return null;const Ee=Math.sqrt(Re*(1-Re)*(1/je+1/ye)),$e=(He-Me)/Ee,Ie=Math.min(1,Math.max(0,2*g(-Math.abs($e)))),We=He-Me,Ye=ne(Ae,je,Te,ye,ae),nt=B($e*$e,je+ye,2,2);return{test:r.PROPORTIONS,statistic:$e,statisticName:"z",df:null,pValue:Ie,difference:We,interval:Ye?{...Ye,confidence:ae,method:"newcombe (difference in proportions)",category:ke}:null,effectSize:{name:"cramersV",label:G("cramersV",nt,1),value:nt},proportions:[{[String(ke)]:He},{[String(ke)]:Me}],focalCategory:ke}}function me(ve,oe,he,ae){if(he&&i.has(he))return{test:he,reason:`caller override: ${he}`};const se=F(ve),de=F(oe),ke=se===null?null:Math.exp(-se/2),Ae=de===null?null:Math.exp(-de/2);if(ke!==null&&ke<c||Ae!==null&&Ae<c)return{test:r.MANN_WHITNEY,reason:"two numeric groups, non-normal by Jarque-Bera"};const Te=w(ve),je=w(oe);if(Te.n>=3&&je.n>=3&&Te.variance>0&&je.variance>0){const ye=Math.max(Te.variance,je.variance)/Math.min(Te.variance,je.variance),He=Te.variance>=je.variance?Te.n-1:je.n-1,Me=Te.variance>=je.variance?je.n-1:Te.n-1;if(2*Math.min(k(ye,He,Me),1-k(ye,He,Me))<ae)return{test:r.WELCH,reason:"two numeric groups, unequal variances (F-test)"}}return{test:r.T,reason:ke!==null||Ae!==null?"two numeric groups, equal variances and no departure from normality":"two numeric groups (too few rows to screen normality)"}}function Ce(ve,oe){if(oe&&n.has(oe))return{test:oe,reason:`caller override: ${oe}`};for(const he of ve){const ae=F(he),se=ae===null?null:Math.exp(-ae/2);if(se!==null&&se<c)return{test:r.KRUSKAL,reason:"three or more numeric groups, non-normal by Jarque-Bera"}}return{test:r.ANOVA,reason:"three or more numeric groups, no departure from normality detected"}}function Pe(ve,oe,he,ae={},se=null){if(!ve||!oe)return null;const de=y(ae.alpha),ke=1-de,Ae=ae.test&&ae.test!=="auto"?String(ae.test):null,Te=f(oe,he);if(Te.length<2)return A("compare:groups",'[lattice] statistics.compare: the "by" column has fewer than two distinct values to group by.'),null;let je;if(Array.isArray(ae.groups)&&ae.groups.length===2){const Ye=[d(ae.groups[0]),d(ae.groups[1])];if(Ye[0]===null||Ye[1]===null||Ye[0]===Ye[1])return A("compare:distinct","[lattice] statistics.compare: the two groups must be two distinct, present values."),null;if(je=Te.filter(nt=>nt.value===Ye[0]||nt.value===Ye[1]),je.length!==2)return A("compare:empty","[lattice] statistics.compare: one of the two groups has no rows in the current set."),null;je.sort((nt,Qe)=>nt.value===Ye[0]?-1:1)}else Te.length===2||Ae&&i.has(Ae)||Ae&&m.has(Ae)?je=Te.slice(0,2):(Ae&&n.has(Ae),je=Te);const He=X(ve,he),Me=!!ae.paired&&se&&je.length===2&&He;let Re,Ee,$e;if(He)if(je.length===2&&!(Ae&&n.has(Ae))){const Ye=Q(ve,je[0].rows),nt=Q(ve,je[1].rows);if(Ye.length<3||nt.length<3)return A("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;if(w(Ye).variance===0||w(nt).variance===0)return A("compare:zero-variance","[lattice] statistics.compare: a group has zero variance, so the difference has no scale to test."),null;if(Me){const dt=_e(ve,se,je[0].rows,je[1].rows);return dt?(Ee=Ae?"override":"auto",$e=Ae?`caller override: ${Ae} (paired)`:"two numeric groups, paired",Re=Ae===r.MANN_WHITNEY?U(dt.diffs,de):x(dt.diffs,de),Re?(Re.paired=!0,Re.chosenBy=Ee,Re.reason=$e,Re.groups=[{value:je[0].value,label:String(je[0].value),n:dt.n},{value:je[1].value,label:String(je[1].value),n:dt.n}],Re.alpha=de,Re.method=Re.test===r.MANN_WHITNEY?"Wilcoxon signed-rank test (paired)":"Student's paired t-test (difference of pairs)",Re.verdict=T(Re,ae),Re.categorical=!1,Re):(A("compare:degenerate","[lattice] statistics.compare: the paired test had too little to work with."),null)):(A("compare:paired","[lattice] statistics.compare: not enough matched pairs to run a paired test."),null)}const Qe=me(Ye,nt,Ae,de);Ee=Ae?"override":"auto",$e=Qe.reason,Qe.test===r.MANN_WHITNEY?Re=_(Ye,nt,de):Qe.test===r.WELCH?Re=J(Ye,nt,de):Re=V(Ye,nt,de),Re&&Re.interval&&Re.difference===null&&(Re.difference=Re.interval.estimate)}else{const Ye=je.map(Qe=>Q(ve,Qe.rows));if(Ye.some(Qe=>Qe.length<3))return A("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;const nt=Ce(Ye,Ae);Ee=Ae?"override":"auto",$e=nt.reason,Re=nt.test===r.KRUSKAL?Z(Ye,de):W(Ye,de)}else if(je.length===2){const Ye=xe(ve,je).size===2;if(Ae===r.PROPORTIONS||Ye&&!Ae)Ee=Ae?"override":"auto",$e=Ae?"caller override: proportions":"categorical measure with two categories (binary)",Re=ce(je,ve,de,ke);else if(Ae===r.CHI_SQUARE||!Ye&&!Ae)Ee=Ae?"override":"auto",$e=Ae?"caller override: chiSquare":`categorical measure with ${xe(ve,je).size} categories`,Re=ie(je,ve,de,ke);else return A("compare:numeric-needed",`[lattice] statistics.compare: ${Ae} needs a numeric measure, but the column is categorical.`),null}else Ee=Ae?"override":"auto",$e=Ae?`caller override: ${Ae}`:`categorical measure with ${xe(ve,je).size} categories`,Re=ie(je,ve,de,ke);if(!Re)return A("compare:degenerate","[lattice] statistics.compare: the chosen test had too little to work with (too few values, or no variation)."),null;const Ie=Re.summaries,We=Re.proportions;return{test:Re.test,chosenBy:Ee,reason:$e,statistic:Re.statistic,statisticName:Re.statisticName,df:Re.df===void 0?null:Re.df,pValue:Re.pValue,alpha:de,paired:!1,interval:Re.interval||null,effectSize:Re.effectSize,groups:je.map((Ye,nt)=>({value:Ye.value,label:String(Ye.value),n:Ie?Ie[nt].n:Ye.total,...Ie?{mean:Ie[nt].mean,sd:Ie[nt].sd}:{},...We?{proportions:We[nt]}:{}})),difference:Re.difference===void 0?null:Re.difference,method:Re.test,categorical:!He,verdict:je.length===2?T({...Re,alpha:de,groups:[{value:je[0].value,label:String(je[0].value),mean:Ie?Ie[0].mean:void 0},{value:je[1].value,label:String(je[1].value),mean:Ie?Ie[1].mean:void 0}],categorical:!He,difference:Re.difference===void 0?null:Re.difference},ae):R({...Re,alpha:de},ae)}}function xe(ve,oe){const he=I(ve),ae=new Set;for(const se of oe)for(const de of se.rows){const ke=d(he(de));ke!==null&&ae.add(ke)}return ae}function _e(ve,oe,he,ae){const se=I(oe),de=I(ve),ke=new Map;for(const Te of ae){const je=d(se(Te));je!==null&&ke.set(je,de(Te))}const Ae=[];for(const Te of he){const je=d(se(Te));if(je===null||!ke.has(je))continue;const ye=Number(de(Te)),He=Number(ke.get(je));!Number.isFinite(ye)||!Number.isFinite(He)||Ae.push(ye-He)}return Ae.length<2?null:{diffs:Float64Array.from(Ae),n:Ae.length}}}),Ve("packages/core/src/columns/detailcolumn.js",function(e,D){"use strict";Object.defineProperty(e,"DETAIL_COLUMN_ID",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"createDetailColumn",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return I}});const re="__lattice_detail",A=36;function Y(L){const Q=L.config&&L.config.detailColumnWidth||A;return{id:re,field:null,title:"",type:"text",dataType:{base:"text"},nullable:!0,align:"center",generated:!0,control:!0,detailExpander:!0,value:{pure:!0},cell:{render:"detailExpander",align:"center"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:Q,min:Q,max:Q,pin:L.config&&L.config.detailColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(H,$){return!!($&&$.expanded)},formatValue(){return""}}}const I=Y}),Ve("packages/core/src/columns/treecolumn.js",function(e,D){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"createTreeColumn",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Q}});const A=D("packages/core/src/internal/predicates.js").isFunction,Y="__lattice_tree",I=260;function L(H){const $=H.tree||{},X=H.config&&H.config.treeColumnWidth||I,F=!!(H.config&&H.config.treeColumnFlex),j=()=>(H.columns&&A(H.columns.visible)?H.columns.visible():[]).find(g=>!g.generated)||null,v=(l,g)=>{if(g&&g.group)return g.groupValue;if(A($.label))return $.label(l,g);if(typeof $.label=="string")return l==null?null:l[$.label];const o=j();return o&&A(o.getValue)?o.getValue(l,g):null},b=()=>{if($.title)return $.title;const l=typeof $.label=="string"?H.columns&&A(H.columns.get)?H.columns.get($.label):null:j();return l&&(l.title||l.id)||"Hierarchy"};return{id:Y,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:$.icon,iconClass:$.iconClass,content:$.content,checkbox:$.checkbox,onCheck:$.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:F?{flex:1,min:0,pin:H.config&&H.config.treeColumnPin||null,hidden:!1,resizable:!1,movable:!1,lockPosition:!0}:{width:X,min:140,pin:H.config&&H.config.treeColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(l,g){return v(l,g)},formatValue(l,g){if(g&&g.grandTotal)return H.config&&H.config.grandTotalLabel||"Total";if(l==null)return"";if(!$.label){const o=j();if(o&&A(o.formatValue))return o.formatValue(l,g)}return String(l)}}}const Q=L}),Ve("packages/core/src/columns/pivotcolumns.js",function(e,D){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return L}});const A=D("packages/core/src/internal/warn.js").warnOnce,Y="__lattice_pivot",I=500;function L(X){const{pivot:F,valueColumns:j,config:v}=X,b=F&&F.paths||[],l=X.separator||v&&v.pivot&&v.pivot.separator||" | ",g=v&&v.pivot&&v.pivot.maxColumns||I;if(!b.length||!j.length)return{tree:[],leaves:[],error:null};const o=Q(v),t=b.length*j.length+(o?j.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 A(`pivot.maxColumns:${t}`,i),{tree:[],leaves:[],error:i}}const s=[],r=[];for(const i of b){const n=[];for(const m of j){const c=$(i,m,l);n.push(c),r.push(c)}n.length===1?(n[0].title=String(i),s.push(n[0])):s.push({id:`${Y}:group:${i}`,title:String(i),columns:n,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(o){const i=j.map(m=>H(m,v));r.push(...i);const n=v&&v.pivot&&v.pivot.totalsLabel||"Total";if(i.length===1)i[0].title=n,o==="before"?s.unshift(i[0]):s.push(i[0]);else{const m={id:`${Y}:group:__totals`,title:n,columns:i,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};o==="before"?s.unshift(m):s.push(m)}}return{tree:s,leaves:r,error:null}}function Q(X){const F=X&&X.pivot&&X.pivot.groupTotals;return F==="before"||F==="after"?F:null}function H(X,F){return{id:`${Y}:__total${F&&F.pivot&&F.pivot.separator||" | "}${X.id}`,field:null,title:X.title||X.id,type:X.type,dataType:X.dataType,nullable:!0,align:X.align,generated:!0,pivot:{enabled:!1,index:0,sourceId:X.id,total:!0},value:{pure:!0},cell:{align:X.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:X.total,lookup:null,layout:{width:X.layout&&X.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(j,v){const b=v&&v.totals;return b&&Object.hasOwn(b,X.id)?b[X.id]:null},formatValue(j,v){return j==null?"":X.formatValue?X.formatValue(j,v):String(j)}}}function $(X,F,j){return{id:`${Y}:${X}${j}${F.id}`,field:null,title:F.title||F.id,type:F.type,dataType:F.dataType,nullable:!0,align:F.align,generated:!0,pivot:{enabled:!1,index:0,path:X,sourceId:F.id},value:{pure:!0},cell:{align:F.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:F.total,lookup:null,layout:{width:F.layout&&F.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(v,b){return v==null?"":F.formatValue?F.formatValue(v,b):String(v)}}}}),Ve("packages/core/src/compute/group.js",function(e,D){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return v}});const re=D("packages/core/src/compute/handle.js"),A=re.dictSize,Y=re.identity,I=re.presenceReader,L=re.rowCount,Q=re.valueReader,H="",$="\0",X=1<<20;function F(b,l,g,o){const t=b.length,s=b.map(a=>Q(a)),r=Array.isArray(o)&&o.some(Boolean),i=r?s.map((a,u)=>o[u]?h=>o[u](a(h)):a):s;if(!r&&t>0&&b.every(a=>a&&a.kind==="dictionary"&&a.dict)){const a=b.map(h=>A(h.dict)+1);let u=1;for(let h=0;h<t;h++)u*=a[h];if(u<=Number.MAX_SAFE_INTEGER){const h=b.map(f=>f.values),p=b.map(f=>I(f)),y=f=>{let w=0;for(let k=0;k<t;k++){const P=p[k],G=P&&P(f)===0?a[k]-1:h[k][f];w=w*a[k]+G}return w},d=new Float64Array(g);for(let f=0;f<g;f++)d[f]=y(l[f]);return{packed:d,strings:null,product:u,readers:i,keyOf:y}}}const m=a=>{let u="";for(let h=0;h<t;h++){const p=i[h](a);u+=(h===0?"":H)+(p==null?$:String(p))}return u},c=new Array(g);for(let a=0;a<g;a++)c[a]=m(l[a]);return{packed:null,strings:c,product:1/0,readers:i,keyOf:m}}function j(b,l,g,o){const t=new Uint32Array(o+1);for(let n=0;n<g;n++)t[l[n]+1]++;for(let n=0;n<o;n++)t[n+1]+=t[n];const s=new Uint32Array(g),r=t.slice(0,o);for(let n=0;n<g;n++)s[r[l[n]]++]=b[n];const i=new Array(o);for(let n=0;n<o;n++)i[n]=s.subarray(t[n],t[n+1]);return i}function v(b,l,g={}){const o=b||[],t=l||Y(L(o[0],g)),s=t.length;if(o.length===0||s===0)return{keys:[],buckets:[]};const{packed:r,strings:i,product:n,readers:m}=F(o,t,s,g.project),c=new Uint32Array(s);let a=0,u=null;if(r&&n<=Math.max(1024,Math.min(X,s*4))){const d=n,f=new Int32Array(d).fill(-1);for(let w=0;w<s;w++)f[r[w]]=0;for(let w=0;w<d;w++)f[w]===0&&(f[w]=a++);for(let w=0;w<s;w++)c[w]=f[r[w]];u=new Float64Array(a);for(let w=0;w<d;w++)f[w]>=0&&(u[f[w]]=w)}else if(r){const d=new Map;for(let f=0;f<s;f++){const w=r[f];let k=d.get(w);k===void 0&&(k=a++,d.set(w,k)),c[f]=k}u=new Float64Array(a);for(const[f,w]of d)u[w]=f}else{const d=new Map;for(let f=0;f<s;f++){const w=i[f];let k=d.get(w);k===void 0&&(k=a++,d.set(w,k)),c[f]=k}}const h=j(t,c,s,a),p=new Array(a);for(let d=0;d<a;d++){const f=h[d][0],w=new Array(m.length);for(let k=0;k<m.length;k++)w[k]=m[k](f);p[d]=w}const y={keys:p,buckets:h};return u&&(y.packed=u),y}}),Ve("packages/core/src/compute/pivot.js",function(e,D){"use strict";Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return s}});const A=D("packages/core/src/internal/warn.js").warnOnce,I=D("packages/core/src/compute/handle.js").valueComparator,Q=D("packages/core/src/compute/group.js").packKeys,$=D("packages/core/src/compute/total.js").total,X="|",F="/",j=2e3;function v(n,m,c){return`${n}${X}${m}${X}${c}`}function b(n,m){let c="";for(let a=0;a<n.length;a++){const u=n[a];c+=(a===0?"":m)+(u==null?"":String(u))}return c}function l(n,m,c={}){const a=c.separator||F,u=m.length,{keyOf:h,readers:p}=Q(n,m,0),y=new Map,d=[],f=[];for(let B=0;B<u;B++){const E=m[B],S=h(E);if(y.has(S))continue;y.set(S,d.length),f.push(S);const C=new Array(p.length);for(let N=0;N<p.length;N++)C[N]=p[N](E);d.push(C)}const w=I(c.locale),k=d.map((B,E)=>E);k.sort((B,E)=>{const S=d[B],C=d[E];for(let N=0;N<S.length;N++){const O=g(S[N],C[N],w);if(O!==0)return O}return B-E});const P=new Array(k.length),G=new Array(k.length),K=new Map;for(let B=0;B<k.length;B++){const E=k[B];P[B]=d[E],G[B]=b(d[E],a),K.set(f[E],B)}return{keys:P,paths:G,idOf:B=>{const E=K.get(h(B));return E===void 0?-1:E}}}function g(n,m,c){const a=n==null,u=m==null;return a||u?a&&u?0:a?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(h=>h&&h.handle);const c=typeof n.handle=="function"?n.handle:null;if(!c)return m.length&&A("pivot:handles","pivot was given total column ids but no handle(colId) resolver, so no cell values were reduced. Pass values: [{ colId, handle, fn }] or opts.handle."),[];const a=typeof n.totalOf=="function"?n.totalOf:null,u=[];for(const h of m){const p=c(h);p&&u.push({colId:h,handle:p,fn:a?a(h):"sum"})}return u}function t(n,m,c){if(Array.isArray(n)){const a=c||{};return{...a,pivotHandles:n,order:m||null,groups:a.groups||null}}return n||{}}function s(n,m,c){const a=t(n,m,c),u=a.separator||F,h=o(a),p=a.maxColumns===void 0?j:a.maxColumns,y=a.groups&&a.groups.buckets?a.groups:null,d=y?y.buckets:[a.order||new Uint32Array(0)],f=a.groupPaths||(y?y.keys.map(S=>b(S,u)):[""]),w=i(d),{keys:k,paths:P,idOf:G}=l(a.pivotHandles||[],w,a),K=P.length*Math.max(1,h.length),q=r(P,h,u);if(p&&K>p){const S=new Map;return{keys:k,paths:P,fields:q,groupPaths:f,columns:K,values:S,cells:S,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${K} columns, above pivot.maxColumns of ${p}. Narrow the pivot columns or raise the limit.`,columns:K,maxColumns:p}}}const B=new Map,E=P.length;for(let S=0;S<d.length;S++){const C=d[S],N=f[S]===void 0?"":f[S],O=C.length;if(O===0)continue;const T=new Int32Array(O),R=new Uint32Array(E+1);for(let V=0;V<O;V++){const J=G(C[V]);T[V]=J,J>=0&&R[J+1]++}for(let V=0;V<E;V++)R[V+1]+=R[V];const x=new Uint32Array(O),U=R.slice(0,E);for(let V=0;V<O;V++){const J=T[V];J>=0&&(x[U[J]++]=C[V])}for(let V=0;V<E;V++){const J=R[V],_=R[V+1];if(_===J)continue;const ee=x.subarray(J,_);for(let W=0;W<h.length;W++){const Z=h[W],ne=$(Z.handle,ee,Z.fn,a.totalContext||{locale:a.locale});B.set(v(N,P[V],Z.colId),ne)}}}return{keys:k,paths:P,fields:q,groupPaths:f,columns:K,values:B,cells:B,error:null}}function r(n,m,c){if(m.length===0)return n.slice();const a=[];for(const u of n)for(const h of m)a.push(`${u}${c}${h.colId}`);return a}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 a=0;for(const u of n)!u||u.length===0||(c.set(u,a),a+=u.length);return c}}),Ve("packages/core/src/compute/explain.js",function(e,D){"use strict";Object.defineProperty(e,"explainContributors",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"explainChange",{enumerable:!0,get:function(){return v}});const A=D("packages/core/src/compute/total.js").total,I=D("packages/core/src/compute/group.js").groupByColumns,L=new Set(["sum","count","countValues"]),Q=new Set(["min","max"]),H=new Set(["avg"]);function $(b){return typeof b=="string"?b:typeof b=="function"&&b.totalName?b.totalName:null}function X(b,l,g,o){return A(b,l,g,o||{})}function F(b,l){if(l)try{return l(b)}catch{}return b==null?"":String(b)}function j(b){const{handle:l,fn:g,leaves:o,by:t,labelOf:s,rowLabel:r}=b,i={locale:b.locale},n=o&&o.length?o:[],m=$(g),c=X(l,n,g,i),a=Q.has(m);let u;if(a){let y=-1;for(let d=0;d<n.length;d++){const f=X(l,[n[d]],g,i);if(Object.is(f,c)){y=n[d];break}}u=y<0?[]:[{key:y,indices:[y],label:r?r(y):String(y)}]}else if(t){const y=I([t],n);u=y.keys.map((d,f)=>({key:d[0],indices:y.buckets[f],label:F(d[0],s)}))}else u=Array.from({length:n.length},(y,d)=>{const f=n[d];return{key:f,indices:[f],label:r?r(f):String(f)}});const h=n.length,p=[];for(const y of u){const d=X(l,y.indices,g,i),f=y.indices.length;let w,k;if(m==="avg")w=((typeof d=="number"?d:0)-(typeof c=="number"?c:0))*f,k=h?f/h:0;else if(a)w=typeof d=="number"?d:0,k=1;else{w=typeof d=="number"?d:0;const P=typeof c=="number"?c:0;k=P?w/P:0}p.push({key:y.key,label:y.label,count:f,value:d,contribution:w,share:k})}return p.sort((y,d)=>Math.abs(d.contribution)-Math.abs(y.contribution)||(y.label<d.label?-1:y.label>d.label?1:0)),{total:c,fn:m,weighted:H.has(m),single:a,contributors:p}}function v(b){const l=j({...b,leaves:b.after}),g=j({...b,leaves:b.before}),o=typeof l.total=="number"?l.total:0,t=typeof g.total=="number"?g.total:0,s=new Map;for(const n of l.contributors)s.set(n.key,n);const r=[],i=new Set;for(const n of g.contributors){i.add(n.key);const m=s.get(n.key);if(m===void 0)r.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&&r.push({key:n.key,label:n.label,before:n.value,after:m.value,effect:c,kind:"changed",count:m.count})}}for(const n of l.contributors)i.has(n.key)||r.push({key:n.key,label:n.label,before:null,after:n.value,effect:n.contribution,kind:"new",count:n.count});return r.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:l.total,delta:o-t,weighted:l.weighted||g.weighted,single:l.single||g.single,drivers:r}}}),Ve("packages/core/src/store/bitset.js",function(e,D){"use strict";Object.defineProperty(e,"Bitset",{enumerable:!0,get:function(){return A}});const re=8;class A{static#e=new Uint8Array(256);static{for(let I=1;I<256;I++)A.#e[I]=A.#e[I>>1]+(I&1)}#t;#n;constructor(I=0){const L=Math.max(0,I|0);this.#n=L,this.#t=new Uint8Array(Math.ceil(L/re))}get size(){return this.#n}get words(){return this.#t}get bytes(){return this.#t?this.#t.byteLength:0}get(I){return I<0||I>=this.#n?0:this.#t[I>>3]>>(I&7)&1}set(I){return I>=0&&I<this.#n&&(this.#t[I>>3]|=1<<(I&7)),this}clear(I){return I>=0&&I<this.#n&&(this.#t[I>>3]&=~(1<<(I&7))),this}assign(I,L){return L?this.set(I):this.clear(I)}fill(I=!1){return this.#t.fill(I?255:0),I&&this.#r(),this}grow(I){const L=Math.max(0,I|0);if(L<=this.#n)return this;const Q=Math.ceil(L/re);if(Q>this.#t.length){const H=new Uint8Array(Q);H.set(this.#t),this.#t=H}return this.#n=L,this}count(){const I=this.#t,L=A.#e;let Q=0;for(let H=0;H<I.length;H++)Q+=L[I[H]];return Q}and(I){const L=I instanceof A?I.words:I,Q=this.#t,H=Math.min(Q.length,L.length);for(let $=0;$<H;$++)Q[$]&=L[$];for(let $=H;$<Q.length;$++)Q[$]=0;return this}or(I){const L=I instanceof A?I.words:I,Q=this.#t,H=Math.min(Q.length,L.length);for(let $=0;$<H;$++)Q[$]|=L[$];return this}not(){const I=this.#t;for(let L=0;L<I.length;L++)I[L]=~I[L]&255;return this.#r(),this}clone(){const I=new A(this.#n);return I.words.set(this.#t.subarray(0,I.words.length)),I}release(){this.#t=new Uint8Array(0),this.#n=0}#r(){const I=this.#n&7;if(I===0)return;const L=this.#n>>3;L<this.#t.length&&(this.#t[L]&=(1<<I)-1)}static from(I){const L=Array.isArray(I)?I:Array.from(I),Q=new A(L.length);for(let H=0;H<L.length;H++)L[H]&&Q.set(H);return Q}}}),Ve("packages/core/src/store/dictionary.js",function(e,D){"use strict";Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return I}});const re=D("packages/core/src/internal/compare.js"),A=re.collator,Y=re.defaultCompare;class I{#e;#t=new Map;#n=0;#r=null;#s=-1;#i="\0";constructor(Q=[]){this.#e=[];for(let H=0;H<Q.length;H++){const $=Q[H];this.#t.has($)||(this.#t.set($,this.#e.length),this.#e.push($))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let Q=this.#e.length*8;for(let H=0;H<this.#e.length;H++){const $=this.#e[H];typeof $=="string"&&(Q+=$.length*2),Q+=16}return Q}codeOf(Q){const H=this.#t.get(Q);if(H!==void 0)return H;const $=this.#e.length;return this.#e.push(Q),this.#t.set(Q,$),this.#n++,$}lookup(Q){const H=this.#t.get(Q);return H===void 0?-1:H}has(Q){return this.#t.has(Q)}valueOf(Q){return this.#e[Q]}values(){return this.#e}ranks(Q){const H=Q||"";if(this.#r&&this.#s===this.#n&&this.#i===H)return this.#r;const $=this.#e.length,X=new Array($);for(let b=0;b<$;b++)X[b]=b;const F=A(Q).compare,j=this.#e;X.sort((b,l)=>this.#a(j[b],j[l],F));const v=new Uint32Array($);for(let b=0;b<$;b++)v[X[b]]=b;return this.#r=v,this.#s=this.#n,this.#i=H,v}#a(Q,H,$){return typeof Q=="string"&&typeof H=="string"?$(Q,H):Y(Q,H)}}}),Ve("packages/core/src/store/multivalue.js",function(e,D){"use strict";Object.defineProperty(e,"MultiValue",{enumerable:!0,get:function(){return re}});class re{#e;#t;#n=0;#r=0;constructor(Y={}){const I=Math.max(1,Y.rows??16),L=Math.max(1,Y.values??I);this.#e=new Int32Array(L),this.#t=new Uint32Array(I+1)}get values(){return this.#e}get offsets(){return this.#t}get rows(){return this.#n}get length(){return this.#r}get bytes(){return this.#e.byteLength+this.#t.byteLength}count(Y){return Y<0||Y>=this.#n?0:this.#t[Y+1]-this.#t[Y]}at(Y){return Y<0||Y>=this.#n?this.#e.subarray(0,0):this.#e.subarray(this.#t[Y],this.#t[Y+1])}has(Y,I){if(Y<0||Y>=this.#n)return!1;const L=this.#e,Q=this.#t[Y+1];for(let H=this.#t[Y];H<Q;H++)if(L[H]===I)return!0;return!1}hasAny(Y,I){for(let L=0;L<I.length;L++)if(this.has(Y,I[L]))return!0;return!1}hasAll(Y,I){for(let L=0;L<I.length;L++)if(!this.has(Y,I[L]))return!1;return!0}hasNone(Y,I){return!this.hasAny(Y,I)}push(Y){const I=this.#n,L=Y.length;this.#s(I+1),this.#i(this.#r+L);const Q=this.#r;for(let H=0;H<L;H++)this.#e[Q+H]=Y[H]|0;return this.#r+=L,this.#n=I+1,this.#t[I]=Q,this.#t[I+1]=this.#r,I}write(Y,I){if(Y===this.#n){this.push(I);return}if(Y<0||Y>this.#n)return;const L=this.#t[Y],Q=this.#t[Y+1],H=I.length;if(Q-L===H){for(let $=0;$<H;$++)this.#e[L+$]=I[$]|0;return}this.#a(Y,I)}compact(Y,I,L){const Q=this.#e,H=this.#t,$=this.#n,X=new Int32Array(Math.max(1,this.#r)),F=new Uint32Array(I+1);let j=0;for(let v=0;v<$;v++){if(Y[v]===L)continue;const b=H[v],l=H[v+1];F[Y[v]]=j;for(let g=b;g<l;g++)X[j++]=Q[g];F[Y[v]+1]=j}this.#e=X,this.#t=F,this.#n=I,this.#r=j}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#s(Y){if(Y+1<=this.#t.length)return;let I=this.#t.length-1;for(;I<Y;)I=I*2||16;const L=new Uint32Array(I+1);L.set(this.#t),this.#t=L}#i(Y){if(Y<=this.#e.length)return;let I=this.#e.length;for(;I<Y;)I=I*2||16;const L=new Int32Array(I);L.set(this.#e),this.#e=L}#a(Y,I){const L=this.#e,Q=this.#t,H=this.#n,$=I.length-(Q[Y+1]-Q[Y]),X=new Int32Array(Math.max(1,this.#r+$)),F=new Uint32Array(Q.length);let j=0;for(let v=0;v<H;v++){if(F[v]=j,v===Y)for(let b=0;b<I.length;b++)X[j++]=I[b]|0;else for(let b=Q[v];b<Q[v+1];b++)X[j++]=L[b];F[v+1]=j}this.#e=X,this.#t=F,this.#r=j}}}),Ve("packages/core/src/compute/sort.js",function(e,D){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return E}});const re=D("packages/core/src/compute/handle.js"),A=re.bitReader,Y=re.dictRanks,I=re.dictSize,L=re.identity,Q=re.isMissing,H=re.presenceReader,$=re.rowCount,X=re.valueComparator,F=re.valueReader,j=new Uint32Array(0),v=new ArrayBuffer(8),b=new Float64Array(v),l=new Uint32Array(v),g=(b[0]=-1,(l[1]&2147483648)!==0?1:0),o=g===1?0:1;function t(C,N){b[0]=C;let O=l[g],T=l[o];(O&2147483648)!==0?(O=~O>>>0,T=~T>>>0):O=(O^2147483648)>>>0,N[0]=T,N[1]=O}function s(C,N,O,T){if(T<2)return C;const R=new Uint32Array(256*8);for(let Z=0;Z<T;Z++){const ne=N[Z],ie=O[Z];R[ne&255]++,R[256+(ne>>>8&255)]++,R[512+(ne>>>16&255)]++,R[768+(ne>>>24&255)]++,R[1024+(ie&255)]++,R[1280+(ie>>>8&255)]++,R[1536+(ie>>>16&255)]++,R[1792+(ie>>>24&255)]++}let x=C,U=N,V=O,J=new Uint32Array(T),_=new Uint32Array(T),ee=new Uint32Array(T);const W=new Uint32Array(256);for(let Z=0;Z<8;Z++){const ne=Z<<8,ie=(Z&3)<<3,ce=Z>=4;let me=!1;for(let xe=0;xe<256;xe++)if(R[ne+xe]===T){me=!0;break}if(me)continue;let Ce=0;for(let xe=0;xe<256;xe++)W[xe]=Ce,Ce+=R[ne+xe];for(let xe=0;xe<T;xe++){const _e=U[xe],ve=V[xe],oe=(ce?ve:_e)>>>ie&255,he=W[oe]++;J[he]=x[xe],_[he]=_e,ee[he]=ve}let Pe=x;x=J,J=Pe,Pe=U,U=_,_=Pe,Pe=V,V=ee,ee=Pe}return x}function r(C,N,O){if(O<2)return C;const T=new Uint32Array(256*4);for(let _=0;_<O;_++){const ee=N[_];T[ee&255]++,T[256+(ee>>>8&255)]++,T[512+(ee>>>16&255)]++,T[768+(ee>>>24&255)]++}let R=C,x=N,U=new Uint32Array(O),V=new Uint32Array(O);const J=new Uint32Array(256);for(let _=0;_<4;_++){const ee=_<<8,W=_<<3;let Z=!1;for(let ce=0;ce<256;ce++)if(T[ee+ce]===O){Z=!0;break}if(Z)continue;let ne=0;for(let ce=0;ce<256;ce++)J[ce]=ne,ne+=T[ee+ce];for(let ce=0;ce<O;ce++){const me=x[ce],Ce=J[me>>>W&255]++;U[Ce]=R[ce],V[Ce]=me}let ie=R;R=U,U=ie,ie=x,x=V,V=ie}return R}function i(C,N,O,T){const R=new Uint32Array(T+1);for(let V=0;V<O;V++)R[N[V]]++;let x=0;for(let V=0;V<=T;V++){const J=R[V];R[V]=x,x+=J}const U=new Uint32Array(O);for(let V=0;V<O;V++)U[R[N[V]]++]=C[V];return U}function n(C,N,O,T){return O<2?C:T<=65536||T<=O*2?i(C,N,O,T):r(C,N,O)}function m(C,N){return C.length===N&&C.byteOffset===0?C:Uint32Array.prototype.slice.call(C,0,N)}function c(C,N,O=!1){const T=N||L(C.length),R=T.length;if(R<2)return Uint32Array.from(T);const x=new Uint32Array(R),U=new Uint32Array(R),V=new Uint32Array(R),J=new Uint32Array(R),_=new Uint32Array(2);let ee=0,W=0;for(let ie=0;ie<R;ie++){const ce=T[ie],me=C[ce];if(Number.isNaN(me)){J[W++]=ce;continue}t(me,_),O?(U[ee]=~_[0]>>>0,V[ee]=~_[1]>>>0):(U[ee]=_[0],V[ee]=_[1]),x[ee++]=ce}const Z=s(x.subarray(0,ee),U.subarray(0,ee),V.subarray(0,ee),ee);if(W===0)return m(Z,ee);const ne=new Uint32Array(R);return ne.set(Z.subarray(0,ee),0),ne.set(J.subarray(0,W),ee),ne}function a(C,N,O=!1){const T=N||L(C.length),R=T.length;if(R<2)return Uint32Array.from(T);const x=Uint32Array.from(T),U=new Uint32Array(R);for(let V=0;V<R;V++){const J=(C[x[V]]^2147483648)>>>0;U[V]=O?~J>>>0:J}return m(r(x,U,R),R)}function u(C,N,O={}){const T=N||L($(C,O)),R=T.length;if(R<2)return Uint32Array.from(T);const x=Y(C.dict,O.locale),U=C.values,V=H(C),J=Math.max(I(C.dict),x.length),_=J,ee=Uint32Array.from(T),W=new Uint32Array(R),Z=!!O.descending;for(let ne=0;ne<R;ne++){const ie=ee[ne];let ce=V&&V(ie)===0?_:x[U[ie]];ce===void 0&&(ce=_),W[ne]=Z?_-ce:ce}return m(n(ee,W,R,J+1),R)}function h(C,N,O){const T=N.length;let R=Uint32Array.from(N);if(T<2)return R;let x=new Uint32Array(T);for(let U=1;U<T;U<<=1){for(let J=0;J<T;J+=U<<1){const _=Math.min(J+U,T),ee=Math.min(J+(U<<1),T);let W=J,Z=_,ne=J;for(;W<_&&Z<ee;)x[ne++]=O(C[R[W]],C[R[Z]])<=0?R[W++]:R[Z++];for(;W<_;)x[ne++]=R[W++];for(;Z<ee;)x[ne++]=R[Z++]}const V=R;R=x,x=V}return R}function p(C,N,O){const T=A(C.values),R=N.length,x=new Uint32Array(R),U=O?1:0;let V=0;for(let J=0;J<R;J++)T(N[J])===U&&(x[V++]=N[J]);for(let J=0;J<R;J++)T(N[J])!==U&&(x[V++]=N[J]);return x}function y(C,N){const O=C.values,T=C.kind;if((T==="object"||T===void 0)&&(Array.isArray(O)||ArrayBuffer.isView(O))&&!C.presence)return O;const x=F(C),U=new Array($(C)||0);for(let V=0;V<N.length;V++){const J=N[V];U[J]=x(J)}return U}function d(C,N){for(let O=0;O<N.length;O++)if(typeof C[N[O]]!="string")return!1;return!0}function f(C,N,O,T,R){const x=C.length,U=Uint32Array.from(C);if(x<2||T<1)return U;const V=new Uint32Array(x),J=T-1;for(let _=0;_<x;_++){const ee=O[N[_]];V[_]=R?J-ee:ee}return m(n(U,V,x,T),x)}function w(C,N,O){const T=X(O),R=new Array(N);for(let U=0;U<N;U++)R[U]=U;R.sort((U,V)=>T(C[U],C[V])||U-V);const x=new Uint32Array(N);for(let U=0;U<N;U++)x[R[U]]=U;return x}function k(C,N,O){const T=N.length,R=new Map,x=[],U=new Uint32Array(T);for(let _=0;_<T;_++){const ee=C[N[_]];let W=R.get(ee);W===void 0&&(W=x.length,R.set(ee,W),x.push(ee)),U[_]=W}const V=x.length,J=w(x,V,O.locale);return f(N,U,J,V,!!O.descending)}function P(C,N,O){const T=y(C,N);if(N.length>=2&&d(T,N)){const U=C.stringRank;return U&&U.version===C.version&&U.usable(N,T,O.locale)?U.sort(N,O):k(T,N,O)}const R=X(O.locale),x=O.descending?(U,V)=>R(V,U):R;return h(T,N,x)}function G(C,N,O){const T=y(C,N),R=O.compare,U=!!O.descending?(V,J)=>-R(V,J,void 0,void 0,!0):(V,J)=>R(V,J,void 0,void 0,!1);return h(T,N,U)}function K(C,N){const O=N.length,T=H(C),R=C.values,x=C.kind==="float64"&&!!R,U=C.kind==="object"||C.kind==="multi"||C.kind===void 0;if(!T&&!x&&!U)return{present:N,absent:j};const V=new Uint32Array(O),J=new Uint32Array(O);let _=0,ee=0;if(T&&x)for(let W=0;W<O;W++){const Z=N[W];T(Z)===1&&!Number.isNaN(R[Z])?V[_++]=Z:J[ee++]=Z}else if(x&&!T)for(let W=0;W<O;W++){const Z=N[W];Number.isNaN(R[Z])?J[ee++]=Z:V[_++]=Z}else if(T&&!U)for(let W=0;W<O;W++){const Z=N[W];T(Z)===1?V[_++]=Z:J[ee++]=Z}else{const W=F(C);for(let Z=0;Z<O;Z++){const ne=N[Z];Q(W(ne))?J[ee++]=ne:V[_++]=ne}}return ee===0?{present:N,absent:j}:{present:V.subarray(0,_),absent:J.subarray(0,ee)}}function q(C,N,O){if(N.length===0)return C;const T=new Uint32Array(C.length+N.length);return O?(T.set(N,0),T.set(C,N.length)):(T.set(C,0),T.set(N,C.length)),T}function B(C,N,O={}){const T=N||L($(C,O));if(!C||T.length<2)return Uint32Array.from(T);const{present:R,absent:x}=K(C,T);if(R.length===0)return Uint32Array.from(T);const U=!!O.descending;let V;if(typeof O.compare=="function")V=G(C,R,O);else switch(C.kind){case"float64":V=c(C.values,R,U);break;case"int32":V=a(C.values,R,U);break;case"dictionary":V=u(C,R,O);break;case"bitset":V=p(C,R,U);break;default:V=P(C,R,O);break}return q(V,x,!!O.nullsFirst)}function E(C,N,O,T={}){const R=N||[],x=R.length&&(R[0].handle||S(C,R[0].col))||C&&C[0];let U=O||L($(x,T));for(let V=R.length-1;V>=0;V--){const J=R[V],_=J.handle||S(C,J.col)||C&&C[V];_&&(U=B(_,U,{descending:J.descending!==void 0?!!J.descending:J.dir==="desc",nullsFirst:!!J.nullsFirst,locale:J.locale!==void 0?J.locale:T.locale,compare:J.compare}))}return U instanceof Uint32Array?U:Uint32Array.from(U)}function S(C,N){if(!(!C||N===void 0)){for(let O=0;O<C.length;O++)if(C[O]&&C[O].id===N)return C[O]}}}),Ve("packages/core/src/store/stringrank.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_MAX_DISTINCT",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"StringRankIndex",{enumerable:!0,get:function(){return L}});const re=D("packages/core/src/compute/sort.js"),A=re.collateStringRanks,Y=re.rankSortStrings,I=1e5;class L{#e=[];#t=new Map;#n;#r=0;#s=0;#i=-1;#a;#l=!1;#o=null;#c=-1;#u="\0";constructor(H=I){this.#a=H>0?H:I,this.#n=new Uint32Array(0)}get version(){return this.#i}set version(H){this.#i=H}get generation(){return this.#s}get size(){return this.#e.length}get capped(){return this.#l}get length(){return this.#r}get bytes(){let H=this.#n.byteLength;const $=this.#e;for(let X=0;X<$.length;X++)H+=$[X].length*2+24;return H}#f(H,$){const X=this.#t.get(H);if(X!==void 0)return X;if(this.#l)return-1;if($&&this.#e.length>=this.#a)return this.#l=!0,-1;const F=this.#e.length;return this.#e.push(H),this.#t.set(H,F),this.#s++,F}build(H,$){const X=$|0;this.#e=[],this.#t=new Map,this.#s=0,this.#l=!1,this.#o=null,this.#c=-1,this.#n=new Uint32Array(X);for(let F=0;F<X;F++){const j=H[F],v=typeof j=="string"?this.#f(j,!1):-1;this.#n[F]=v<0?0:v}this.#r=X}append(H,$,X){const F=($|0)+(X|0);if(F>this.#n.length){const j=new Uint32Array(F);j.set(this.#n.subarray(0,this.#r)),this.#n=j}for(let j=$|0;j<F;j++){const v=H[j],b=typeof v=="string"?this.#f(v,!0):-1;this.#n[j]=b<0?0:b}this.#r=Math.max(this.#r,F)}ranks(H){const $=H||"";if(this.#o&&this.#c===this.#s&&this.#u===$)return this.#o;const X=A(this.#e,this.#e.length,H);return this.#o=X,this.#c=this.#s,this.#u=$,X}usable(H,$,X){if(this.#l||this.#e.length===0)return!1;const F=this.#n,j=this.#e,v=this.#r;for(let b=0;b<H.length;b++){const l=H[b];if(l>=v||j[F[l]]!==$[l])return!1}return!0}sort(H,$){const X=this.ranks($.locale),F=this.#e.length,j=H.length,v=new Uint32Array(j),b=this.#n;for(let l=0;l<j;l++)v[l]=b[H[l]];return Y(H,v,X,F,!!$.descending)}}}),Ve("packages/core/src/store/columnstore.js",function(e,D){"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 h}}),Object.defineProperty(e,"ColumnStore",{enumerable:!0,get:function(){return p}});const A=D("packages/core/src/internal/warn.js").warnOnce,I=D("packages/core/src/internal/predicates.js").isFunction,Q=D("packages/core/src/internal/paths.js").pathGetter,$=D("packages/core/src/store/bitset.js").Bitset,F=D("packages/core/src/store/dictionary.js").Dictionary,v=D("packages/core/src/store/multivalue.js").MultiValue,l=D("packages/core/src/store/stringrank.js").StringRankIndex,g=4294967295,o=1024,t=5e3,s=.2,r=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 d=n(y);return Number.isFinite(d)?d|0:0}function c(y){return i(y)?[]:Array.isArray(y)?y:[y]}function a(y,d){switch(y.kind){case"float64":case"int32":return y.buf[d];case"bitset":return y.bits.get(d)===1;case"dictionary":return y.dict.valueOf(y.buf[d]);case"multi":{const f=y.mv.at(d),w=new Array(f.length);for(let k=0;k<f.length;k++)w[k]=y.dict.valueOf(f[k]);return w}default:return y.buf[d]}}function u(y,d){switch(y.kind){case"float64":case"int32":return y.values[d];case"bitset":return(y.values[d>>3]&1<<(d&7))!==0;case"dictionary":return(y.table||[])[y.values[d]];case"multi":{const f=y.offsets[d],w=y.offsets[d+1],k=y.table||[],P=new Array(w-f);for(let G=f;G<w;G++)P[G-f]=k[y.values[G]];return P}default:return y.values[d]}}class h{#e;#t;#n;#r;#s;#i;#a;#l=!1;#o=null;#c=null;#u=null;#f=null;#d=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#O=null;#w=null;#A=!1;constructor(d,f){this.#e=d.id;const w=r.has(d.kind)?d.kind:"object";d.kind&&!r.has(d.kind)&&A(`store.kind.${d.id}`,`column "${d.id}" declares unknown storage kind "${d.kind}"; falling back to object`),this.#n=w,this.#t=w,this.#r=d.nullable!==!1,this.#a=d.dictionary??null,this.#i=f,this.#s=I(d.read)?d.read:Q(d.field||d.id),this.#h=d.stringRankIndex!=="off",this.#p=typeof d.stringRankMaxDistinct=="number"?d.stringRankMaxDistinct:0,this.#O=new Map}get id(){return this.#e}get kind(){return this.#l?this.#t:"object"}get target(){return this.#n}get nullable(){return this.#r}get values(){return this.#A?null:this.#l?this.#t==="bitset"?this.#c.words:this.#t==="multi"?this.#u.values:this.#o:this.#T().values}get presence(){return this.#A||!this.#r?null:this.#l?this.#g:this.#T().presence}get dict(){return this.#A||!this.#l?null:this.#t==="dictionary"||this.#t==="multi"?this.#f:null}get stringRank(){if(this.#A||!this.#h||this.kind!=="object")return null;const d=this.values,f=this.#i.physical();if(!d||f===0)return null;if(this.#d===null){if(typeof d[0]!="string")return null;const w=new l(this.#v());return w.build(d,f),w.version=this.#y,this.#d=w,this.#m=this.#y,w.capped?null:w}return this.#d.length<f&&this.#d.append(d,this.#d.length,f-this.#d.length),this.#d.version=this.#y,this.#m=this.#y,this.#d.capped?null:this.#d}#v(){return this.#p}#C(){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 d=0;return this.#o&&(d+=this.#o.byteLength??this.#o.length*8),this.#c&&(d+=this.#c.bytes),this.#u&&(d+=this.#u.bytes),this.#g&&(d+=this.#g.bytes),this.#f&&(d+=this.#f.bytes),this.#O&&(d+=this.#O.size*24),d}get(d){if(!this.#A&&!(d<0||d>=this.#i.physical())){if(!this.#l)return this.#E(d);if(this.#r&&this.#g.get(d)===0)return null;switch(this.#t){case"float64":case"int32":return this.#o[d];case"bitset":return this.#c.get(d)===1;case"dictionary":return this.#f.valueOf(this.#o[d]);case"multi":{const f=this.#u.at(d),w=new Array(f.length);for(let k=0;k<f.length;k++)w[k]=this.#f.valueOf(f[k]);return w}default:return this.#o[d]}}}set(d,f){this.#A||(this.#l?this.#P(d,f):this.#O.set(d,f===void 0?null:f),this.#d&&this.#C(),this.#y++)}read(d){return this.#s(d)}appendColumn(d,f,w){if(this.#A||w<=0)return;if(!this.#l){this.#y++;return}const k=this.#s,P=this.#r,G=this.#g;let K=!1;switch(this.#t){case"float64":{const q=this.#o;for(let B=0;B<w;B++){const E=k(d[B]);if(typeof E=="number"){P&&G.set(f+B),q[f+B]=E;continue}const S=E==null;P?G.assign(f+B,!S):S&&(K=!0),q[f+B]=S?NaN:n(E)}break}case"int32":{const q=this.#o;for(let B=0;B<w;B++){const E=k(d[B]),S=E==null;P?G.assign(f+B,!S):S&&(K=!0),q[f+B]=S?0:m(E)}break}case"bitset":{const q=this.#c;for(let B=0;B<w;B++){const E=k(d[B]),S=E==null;P?G.assign(f+B,!S):S&&(K=!0),q.assign(f+B,!S&&!!E)}break}case"dictionary":{const q=this.#o,B=this.#f;for(let E=0;E<w;E++){const S=k(d[E]),C=S==null;P?G.assign(f+E,!C):C&&(K=!0),q[f+E]=C?0:B.codeOf(S)}break}case"multi":{const q=this.#u,B=this.#f;for(let E=0;E<w;E++){const S=k(d[E]),C=S==null;P?G.assign(f+E,!C):C&&(K=!0);const N=c(S),O=new Array(N.length);for(let T=0;T<N.length;T++)O[T]=B.codeOf(N[T]);q.write(f+E,O)}break}default:{const q=this.#o;for(let B=0;B<w;B++){const E=k(d[B]),S=E==null;P?G.assign(f+B,!S):S&&(K=!0),q[f+B]=S?null:E}break}}K&&A(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#d&&this.#t==="object"&&(this.#d.append(this.#o,f,w),this.#d.version=this.#y+1,this.#m=this.#y+1),this.#y++}appendPacked(d,f,w){if(this.#A||w<=0||!d)return;if(!this.#l){this.#y++;return}const k=this.#g,P=d.presence;if(k)if(P)for(let K=0;K<w;K++)k.assign(f+K,(P[K>>3]&1<<(K&7))!==0);else for(let K=0;K<w;K++)k.set(f+K);const G=d.kind===this.#t;if(G&&(this.#t==="float64"||this.#t==="int32")){this.#o.set(d.values,f),this.#y++;return}if(G&&this.#t==="bitset"){const K=d.values;for(let q=0;q<w;q++)this.#c.assign(f+q,(K[q>>3]&1<<(q&7))!==0);this.#y++;return}if(G&&this.#t==="dictionary"){const K=d.table||[],q=new Uint32Array(K.length);for(let C=0;C<K.length;C++)q[C]=this.#f.codeOf(K[C]);const B=d.values,E=this.#o,S=k;for(let C=0;C<w;C++){if(S&&(P&&(P[C>>3]&1<<(C&7))===0)){E[f+C]=0;continue}E[f+C]=q[B[C]]??0}this.#y++;return}if(G&&this.#t==="multi"){const K=d.table||[],q=new Uint32Array(K.length);for(let S=0;S<K.length;S++)q[S]=this.#f.codeOf(K[S]);const B=d.values,E=d.offsets;for(let S=0;S<w;S++){const C=E[S],N=E[S+1],O=new Array(N-C);for(let T=C;T<N;T++)O[T-C]=q[B[T]]??0;this.#u.write(f+S,O)}this.#y++;return}for(let K=0;K<w;K++){const q=P?(P[K>>3]&1<<(K&7))===0:d.kind==="object"?d.values[K]===null:!1;this.#P(f+K,q?null:u(d,K))}this.#y++}touch(){this.#y++}columnarise(d,f){if(this.#l||this.#A)return;const w=new Array(f);for(let k=0;k<f;k++)w[k]=this.#E(k);this.#t=this.#n,this.#l=!0,this.#S(d);for(let k=0;k<f;k++)this.#P(k,w[k]);this.#O.clear(),this.#w=null,this.#C(),this.#y++}grow(d){if(!(!this.#l||this.#A||d<=this.#b)){switch(this.#t){case"float64":case"int32":case"dictionary":{const f=new this.#o.constructor(d);f.set(this.#o),this.#o=f;break}case"bitset":this.#c.grow(d);break;case"multi":break;default:this.#o.length=d;break}this.#g&&this.#g.grow(d),this.#b=d,this.#y++}}convert(d){if(this.#A||!r.has(d)||(this.#n=d,!this.#l||d===this.#t))return!1;const f={kind:this.#t,buf:this.#o,bits:this.#c,mv:this.#u,dict:this.#f},w=this.#i.physical(),k=this.#g;this.#t=d,this.#S(this.#b);for(let P=0;P<w;P++){const G=k!==null&&k.get(P)===0;G&&d!=="multi"||this.#P(P,G?null:a(f,P))}return this.#C(),this.#y++,!0}compact(d,f,w){if(!this.#A){if(this.#C(),!this.#l){const k=this.#O;if(k.size){const P=new Map;for(const[G,K]of k)d[G]!==g&&P.set(d[G],K);this.#O=P}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const k=this.#o;for(let P=0;P<f;P++)d[P]!==g&&(k[d[P]]=k[P]);if(this.#t==="object")for(let P=w;P<f;P++)k[P]=void 0;break}case"bitset":{const k=this.#c;for(let P=0;P<f;P++)d[P]!==g&&k.assign(d[P],k.get(P)===1);for(let P=w;P<f;P++)k.clear(P);break}case"multi":this.#u.compact(d,w,g);break;default:break}if(this.#g){const k=this.#g;for(let P=0;P<f;P++)d[P]!==g&&k.assign(d[P],k.get(P)===1);for(let P=w;P<f;P++)k.clear(P)}this.#y++}}release(){this.#A||(this.#A=!0,this.#o=null,this.#c&&this.#c.release(),this.#c=null,this.#u&&this.#u.release(),this.#u=null,this.#g&&this.#g.release(),this.#g=null,this.#f=null,this.#d=null,this.#O=new Map,this.#w=null,this.#b=0,this.#y++)}#S(d){const f=Math.max(1,d);switch(this.#o=null,this.#c=null,this.#u=null,this.#t){case"float64":this.#o=new Float64Array(f);break;case"int32":this.#o=new Int32Array(f);break;case"bitset":this.#c=new $(f);break;case"dictionary":this.#o=new Uint32Array(f),this.#f=this.#f??new F(this.#a??[]);break;case"multi":this.#u=new v({rows:f,values:f}),this.#f=this.#f??new F(this.#a??[]);break;default:this.#o=new Array(f);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#f=null),this.#r&&(this.#g?this.#g.grow(f):this.#g=new $(f)),this.#b=f}#P(d,f){const w=i(f);switch(this.#r?this.#g.assign(d,!w):w&&A(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#t){case"float64":this.#o[d]=w?NaN:n(f);break;case"int32":this.#o[d]=w?0:m(f);break;case"bitset":this.#c.assign(d,!w&&!!f);break;case"dictionary":this.#o[d]=w?0:this.#f.codeOf(f);break;case"multi":{const k=c(f),P=new Array(k.length);for(let G=0;G<k.length;G++)P[G]=this.#f.codeOf(k[G]);this.#u.write(d,P);break}default:this.#o[d]=w?null:f;break}}#E(d){if(this.#O.has(d))return this.#O.get(d);const f=this.#s(this.#i.rowAt(d));return f===void 0?null:f}#T(){if(this.#w&&this.#w.version===this.#y)return this.#w;const d=this.#i.physical(),f=new Array(d),w=this.#r?new $(d):null;for(let k=0;k<d;k++){const P=this.#E(k);f[k]=P,w&&!i(P)&&w.set(k)}return this.#w={version:this.#y,values:f,presence:w},this.#w}}class p{#e;#t=new Map;#n=[];#r=[];#s=0;#i=0;#a=0;#l=0;#o=new $(0);#c=!1;#u=!0;#f;#d;#h;#p=!1;constructor(d,f={}){this.#e=Array.isArray(d)?d:[],this.#d=Math.max(1,f.initialCapacity??o),this.#u=f.retainSource!==!1,this.#f=this.#u?f.columnarBelow??t:0,this.#h=f.compactRatio??s;const w={rowAt:k=>this.#r[k],physical:()=>this.#s};for(const k of this.#e){if(!k||!k.id)continue;if(this.#t.has(k.id)){A(`store.dup.${k.id}`,`duplicate column id "${k.id}" in the store schema; ignoring the second`);continue}const P=new h(k,w);this.#t.set(k.id,P),this.#n.push(P)}this.#f<=0&&this.#b()}get count(){return this.#a}get physical(){return this.#s}get capacity(){return this.#c?this.#i:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let d=this.#o.bytes+this.#r.length*8;for(const f of this.#n)d+=f.bytes;return d}append(d){const f=this.#s;if(this.#p||!d)return{from:f,to:f};const w=d.length|0;if(w===0)return{from:f,to:f};if(this.#u)for(let P=0;P<w;P++)this.#r[f+P]=d[P];if(this.#s=f+w,this.#a+=w,this.#o.grow(this.#s),!this.#c){if(this.#s>=this.#f)this.#b();else for(const P of this.#n)P.touch();return{from:f,to:this.#s}}this.#m(this.#s);const k=this.#n;for(let P=0;P<k.length;P++)k[P].appendColumn(d,f,w);return{from:f,to:this.#s}}appendPacked(d,f){const w=this.#s;if(this.#p||!d)return{from:w,to:w};const k=d.count|0;if(k===0)return{from:w,to:w};if(this.#u&&f)for(let G=0;G<k;G++)this.#r[w+G]=f[G];this.#s=w+k,this.#a+=k,this.#o.grow(this.#s),this.#c||this.#b(),this.#m(this.#s);const P=new Map;for(const G of d.columns)P.set(G.id,G);for(const G of this.#n){const K=P.get(G.id);K?G.appendPacked(K,w,k):G.grow(this.#i)}return{from:w,to:this.#s}}source(d){if(this.#u)return this.#r[d];if(!(d<0||d>=this.#s))return this.#g(d)}setSource(d,f){this.#p||d<0||d>=this.#s||this.#u&&(this.#r[d]=f)}get(d,f){const w=this.#t.get(d);return w?w.get(f):void 0}set(d,f,w){if(this.#p||f<0||f>=this.#s)return;const k=this.#t.get(d);if(!k){A(`store.set.${d}`,`set() on unknown column "${d}"`);return}k.set(f,w)}remove(d){return this.#p||d<0||d>=this.#s||this.#o.get(d)===1?!1:(this.#o.set(d),this.#l++,this.#a--,!0)}live(d){return d<0||d>=this.#s?!1:this.#o.get(d)===0}compact(d={}){if(this.#p||this.#l===0||!d.force&&this.#l/this.#s<this.#h)return null;const f=this.#s,w=new Uint32Array(f);let k=0;for(let P=0;P<f;P++)w[P]=this.#o.get(P)===1?g:k++;for(const P of this.#n)P.compact(w,f,k);if(this.#u){const P=this.#r;for(let G=0;G<f;G++)w[G]!==g&&(P[w[G]]=P[G]);P.length=k}return this.#s=k,this.#a=k,this.#l=0,this.#o=new $(Math.max(this.#i,k)),w}column(d){return this.#t.get(d)}columns(){return this.#n.slice()}liveIndices(){const d=new Uint32Array(this.#a);if(this.#l===0){for(let w=0;w<this.#s;w++)d[w]=w;return d}let f=0;for(let w=0;w<this.#s;w++)this.#o.get(w)===0&&(d[f++]=w);return d}convert(d,f){const w=this.#t.get(d);return w?w.convert(f):!1}destroy(){if(!this.#p){this.#p=!0;for(const d of this.#n)d.release();this.#t.clear(),this.#n.length=0,this.#r.length=0,this.#o.release(),this.#s=0,this.#a=0,this.#l=0,this.#i=0}}#m(d){if(d<=this.#i)return;let f=this.#i||this.#d;for(;f<d;)f*=2;for(const w of this.#n)w.grow(f);this.#o.grow(f),this.#i=f}#g(d){const f={};for(const w of this.#n)f[w.id]=w.get(d);return f}#b(){if(this.#c)return;let d=this.#d;for(;d<this.#s;)d*=2;this.#c=!0,this.#i=d,this.#o.grow(d);for(const f of this.#n)f.columnarise(d,this.#s)}}}),Ve("packages/core/src/store/pool.js",function(e,D){"use strict";Object.defineProperty(e,"MaskPool",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"sharedPool",{enumerable:!0,get:function(){return L}});const re=64,A=8;function Y(H){let $=re;for(;$<H;)$*=2;return $}class I{#e=new Map;#t=new WeakSet;#n;#r=0;#s={acquired:0,reused:0,released:0};constructor($={}){this.#n=$.limit??A}get bytes(){return this.#r}mask($){const X=new Uint8Array(this.#i($),0,$);return X.fill(0),X}indices($){return new Uint32Array(this.#i($*4),0,$)}release($){if(!$||!$.buffer)return!1;const X=$.buffer;if(!this.#t.has(X))return!1;this.#t.delete(X),this.#s.released++;const F=X.byteLength;let j=this.#e.get(F);return j||this.#e.set(F,j=[]),j.length>=this.#n||(j.push(X),this.#r+=F),!0}releaseAll($){for(const X of $)this.release(X)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#s,retained:this.#r}}#i($){const X=Y($),F=this.#e.get(X);this.#s.acquired++;let j;return F&&F.length?(j=F.pop(),this.#r-=X,this.#s.reused++):j=new ArrayBuffer(X),this.#t.add(j),j}}function L(){return Q??=new I,Q}let Q=null}),Ve("packages/core/src/compute/sortspec.js",function(e,D){"use strict";Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return L}});function re(Q){return{locale:Q===void 0?void 0:String(Q),numeric:!0,sensitivity:"variant"}}function A(Q){return!!Q&&typeof Q.compare!="function"}function Y(Q){if(!Q)return!0;for(let H=0;H<Q.length;H++)if(!A(Q[H]))return!1;return!0}function I(Q,H){const $=Q.col!==void 0?Q.col:Q.handle&&Q.handle.id,X=Q.locale!==void 0?Q.locale:H;return{col:$,descending:Q.descending!==void 0?!!Q.descending:Q.dir==="desc",nullsFirst:!!Q.nullsFirst,collation:re(X)}}function L(Q,H){const $=Q||[],X=new Array($.length);for(let F=0;F<$.length;F++)X[F]=I($[F],H);return X}}),Ve("packages/core/src/compute/facet.js",function(e,D){"use strict";Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"orderedReader",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"toNumeric",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return r}}),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 d}}),Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return w}});const re=D("packages/core/src/compute/handle.js"),A=re.presenceReader,Y=re.valueReader,I=re.dictSize,L=re.dictValue,Q=Object.freeze(["equal","quantile","log"]),H=Object.freeze(["hour","day","week","month","quarter","year"]),$=20,X=50,F=1e4;function j(k,P){if(!k)return"none";const G=P;if(G&&(G.multi===!0||typeof G.items=="function"))return"category";const K=P&&P.base;if(K==="date"||K==="datetime"||K==="time"||K==="dateString")return"date";switch(k.kind){case"bitset":return"boolean";case"float64":case"int32":return"numeric";case"dictionary":return"category";case"multi":return"category";default:return K==="number"?"numeric":K==="boolean"?"boolean":K==="text"?"category":"none"}}function v(k){const P=k.values,G=k.kind;if((G==="float64"||G==="int32")&&P)return q=>P[q];const K=Y(k);return q=>b(K(q))}function b(k){if(typeof k=="number")return k;if(k instanceof Date)return k.getTime();if(k==null||k==="")return NaN;if(typeof k=="boolean")return k?1:0;if(typeof k=="string"){const P=Number(k);if(Number.isFinite(P))return P;const G=Date.parse(k);return Number.isFinite(G)?G:NaN}return NaN}function l(k,P,G,K=X){if(!k)return{cardinality:0,exact:!0};if(k.dict)return{cardinality:I(k.dict),exact:!0};if(k.kind==="bitset")return{cardinality:2,exact:!0};const q=Y(k),B=P?P.length:G,E=new Set;for(let S=0;S<B;S++){const C=q(P?P[S]:S);if(C!=null&&(E.add(C),E.size>K))return{cardinality:E.size,exact:!1}}return{cardinality:E.size,exact:!0}}const g=36e5,o=864e5;function t(k,P=$){const G=Number.isFinite(k)&&k>0?k:0,K=Math.max(1,P)*2;return G/g<=K?"hour":G/o<=K?"day":G/(7*o)<=K?"week":G/(30*o)<=K?"month":G/(91*o)<=K?"quarter":"year"}function s(k,P){if(!Number.isFinite(k))return NaN;const G=new Date(k);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 K=(G.getDay()+6)%7;return G.setDate(G.getDate()-K),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 r(k,P){const G=new Date(k);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(k,P,G){const K=v(k),q=A(k),B=P?P.length:G;let E=1/0,S=-1/0,C=0,N=0;for(let O=0;O<B;O++){const T=P?P[O]:O;if(q&&!q(T)){C++;continue}const R=K(T);if(!Number.isFinite(R)){C++;continue}R<E&&(E=R),R>S&&(S=R),N++}return{min:E,max:S,nulls:C,finite:N}}function n(k,P,G,K){const q=v(k),B=A(k),E=P?P.length:G,S=E>K?E/K:1,C=[];for(let O=0;O<E;O+=S){const T=P?P[Math.floor(O)]:Math.floor(O);if(B&&!B(T))continue;const R=q(T);Number.isFinite(R)&&C.push(R)}const N=Float64Array.from(C);return N.sort(),N}function m(k,P,G,K={}){const q=K.kind||j(k,K.type);return q==="none"||!k?{kind:"none",buckets:[],suppressed:"type"}:q==="boolean"?c(k,P,G,K):q==="category"?a(k,P,G,K):h(k,P,G,q,K)}function c(k,P,G,K={}){const q=A(k);let B=0;if(q){const S=P?P.length:G;for(let C=0;C<S;C++)q(P?P[C]:C)||B++}const E=[{value:!1,label:"false"},{value:!0,label:"true"}];return B>0&&K.blanks!==!1&&E.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:E}}function a(k,P,G,K){const q=K.cardinalityLimit??X,{cardinality:B}=l(k,P,G,q);if(B>q&&(K.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:B};const E=Y(k),S=P?P.length:G,C=new Map;let N=0;for(let U=0;U<S;U++){const V=E(P?P[U]:U);if(V==null||V===""){N++;continue}if(Array.isArray(V)){if(!V.length){N++;continue}for(const J of V)C.set(J,(C.get(J)||0)+1);continue}C.set(V,(C.get(V)||0)+1)}let O=[...C.entries()];K.order==="alpha"?O.sort((U,V)=>String(U[0]).localeCompare(String(V[0]))):O.sort((U,V)=>V[1]-U[1]);let T=0,R=0;if(O.length>q){R=O.length-q;for(let U=q;U<O.length;U++)T+=O[U][1];O=O.slice(0,q)}const x=O.map(([U])=>({value:U,label:String(U)}));return T>0&&x.push({remainder:!0,label:`Other (${R} values)`}),N>0&&K.blanks!==!1&&x.push({null:!0,label:"Empty"}),{kind:"category",buckets:x,cardinality:B}}function u(k,P,G,K,q){const B=n(k,P,G,F),E=B.length;if(E<100)return null;const S=B[Math.floor(.01*E)],C=B[Math.ceil(.99*E)-1];return!(C>S)||q-K<=2*(C-S)?null:{lo:S,hi:C}}function h(k,P,G,K,q){const{min:B,max:E,nulls:S,finite:C}=i(k,P,G);if(!C)return{kind:K,buckets:S&&q.blanks!==!1?[{null:!0,label:"Empty"}]:[],empty:!0};const N=Math.max(1,Math.floor(q.buckets||$));let O=[];if(K==="date"){const R=H.includes(q.granularity)?q.granularity:t(E-B,N);let x=s(B,R);for(;x<=E&&O.length<4096;){const U=r(x,R);if(!(U>x))break;O.push({from:x,to:U}),x=U}return{kind:K,buckets:p(O,q.blanks===!1?0:S),granularity:R}}const T=Q.includes(q.strategy)?q.strategy:"equal";if(T==="quantile"){const R=n(k,P,G,F);if(R.length){const x=[R[0]];for(let U=1;U<N;U++){const V=R[Math.min(R.length-1,Math.floor(U/N*R.length))];V>x[x.length-1]&&x.push(V)}x.push(E);for(let U=0;U<x.length-1;U++)O.push({from:x[U],to:x[U+1]})}}else if(T==="log"&&B>0){const R=Math.log10(B),U=(Math.log10(E)-R)/N||1;for(let V=0;V<N;V++)O.push({from:10**(R+V*U),to:10**(R+(V+1)*U)})}if(!O.length&&T==="equal"){const R=u(k,P,G,B,E);if(R){const x=(R.hi-R.lo)/N;R.lo>B&&O.push({from:B,to:R.lo,overflow:"low"});for(let U=0;U<N;U++)O.push({from:R.lo+U*x,to:R.lo+(U+1)*x});O[O.length-1].to=R.hi,R.hi<E&&O.push({from:R.hi,to:E,overflow:"high"})}}if(!O.length){const R=(E-B)/N||1;for(let x=0;x<N;x++)O.push({from:B+x*R,to:B+(x+1)*R})}return O[O.length-1].to=E,{kind:K,buckets:p(O,q.blanks===!1?0:S),strategy:T,min:B,max:E}}function p(k,P){return P>0?[...k,{null:!0,label:"Empty"}]:k}function y(k,P,G,K,q){const B=K&&K.buckets||[],E=q&&q.length>=B.length?q.subarray(0,B.length):new Uint32Array(B.length);if(E.fill(0),!k||!B.length)return E;const S=B.length-1,C=!!B[S]&&B[S].null===!0,N=P?P.length:G;if(K.kind==="boolean"){const U=Y(k);for(let V=0;V<N;V++){const J=U(P?P[V]:V);if(J==null){C&&E[S]++;continue}E[J?1:0]++}return E}if(K.kind==="category"){const U=new Map;for(let _=0;_<B.length;_++)!B[_].null&&!B[_].remainder&&U.set(B[_].value,_);const V=B.findIndex(_=>_.remainder),J=Y(k);for(let _=0;_<N;_++){const ee=J(P?P[_]:_);if(ee==null||ee===""){C&&E[S]++;continue}if(Array.isArray(ee)){if(!ee.length){C&&E[S]++;continue}for(const Z of ee){const ne=U.get(Z);ne!==void 0?E[ne]++:V>=0&&E[V]++}continue}const W=U.get(ee);W!==void 0?E[W]++:V>=0&&E[V]++}return E}const O=C?B.length-1:B.length,T=new Float64Array(O+1);for(let U=0;U<O;U++)T[U]=B[U].from;T[O]=O?B[O-1].to:0;const R=v(k),x=A(k);for(let U=0;U<N;U++){const V=P?P[U]:U;if(x&&!x(V)){C&&E[S]++;continue}const J=R(V);if(!Number.isFinite(J)){C&&E[S]++;continue}const _=d(T,O,J);_>=0&&E[_]++}return E}function d(k,P,G){if(!P||G<k[0])return-1;if(G>=k[P])return G===k[P]?P-1:-1;let K=0,q=P-1;for(;K<q;){const B=K+q+1>>>1;G>=k[B]?K=B:q=B-1}return K}function f(k,P,G,K={}){const q=K.bounds||m(k,K.boundsIndices??P,G,K);return{bounds:q,counts:y(k,P,G,q)}}const w=f}),Ve("packages/core/src/compute/pivotmatrix.js",function(e,D){"use strict";Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return v}}),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 s}});const A=D("packages/core/src/compute/handle.js").valueComparator,I=D("packages/core/src/compute/total.js").total,Q=D("packages/core/src/compute/group.js").packKeys,H=D("packages/core/src/compute/pivot.js"),$=H.joinPath,X=H.DEFAULT_PATH_SEPARATOR,F=H.DEFAULT_MAX_COLUMNS,j="";function v(r,i,n={}){const m=n.separator||X,c=r||[],a=i instanceof Uint32Array?i:Uint32Array.from(i||[]),u=a.length;if(c.length===0)return{tuples:[[]],paths:[j],buckets:[a]};const{keyOf:h,readers:p}=Q(c,a,0),y=new Map,d=[],f=[],w=[];for(let B=0;B<u;B++){const E=a[B],S=h(E);let C=y.get(S);if(C===void 0){C=d.length,y.set(S,C),f.push(S);const N=new Array(p.length);for(let O=0;O<p.length;O++)N[O]=p[O](E);d.push(N),w.push([])}w[C].push(E)}const k=A(n.locale),P=d.map((B,E)=>E);P.sort((B,E)=>{const S=d[B],C=d[E];for(let N=0;N<S.length;N++){const O=b(S[N],C[N],k);if(O!==0)return O}return B-E});const G=new Array(P.length),K=new Array(P.length),q=new Array(P.length);for(let B=0;B<P.length;B++){const E=P[B];G[B]=d[E],K[B]=$(d[E],m),q[B]=Uint32Array.from(w[E])}return{tuples:G,paths:K,buckets:q}}function b(r,i,n){const m=r==null,c=i==null;return m||c?m&&c?0:m?1:-1:n(r,i)}function l(r,i,n){const m=[];for(let c=0;c<r.length;c++)n.has(r[c])&&m.push(r[c]);return Uint32Array.from(m)}function g(r,i,n,m){return{value:i.length?I(r,i,n,m):null,leaves:i,count:i.length}}function o(r){const i=r&&r.opts||{},n=i.separator||X,m=i.totalContext||{locale:i.locale},c=(r.measures||[]).filter(K=>K&&K.handle),a=r.leaves instanceof Uint32Array?r.leaves:Uint32Array.from(r.leaves||[]),u=v(r.rowHandles||[],a,{...i,separator:n}),h=v(r.columnHandles||[],a,{...i,separator:n}),p=i.maxColumns===void 0?F:i.maxColumns,y=h.paths.length*Math.max(1,c.length),d=new Map;if(p&&y>p)return{rowAxis:u,columnAxis:h,measures:c.map(K=>({colId:K.colId,fn:K.fn})),body:d,rowMargin:d,columnMargin:d,grand:d,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 f=new Map,w=new Map,k=new Map,P=new Map,G=h.buckets.map(K=>new Set(K));for(let K=0;K<h.paths.length;K++){const q=h.buckets[K],B=h.paths[K];for(const E of c)k.set(s(B,E.colId),g(E.handle,q,E.fn,m))}for(let K=0;K<u.paths.length;K++){const q=u.buckets[K],B=u.paths[K];for(const E of c)w.set(s(B,E.colId),g(E.handle,q,E.fn,m));for(let E=0;E<h.paths.length;E++){const S=l(q,h.buckets[E],G[E]);if(S.length===0)continue;const C=h.paths[E];for(const N of c)f.set(t(B,C,N.colId),g(N.handle,S,N.fn,m))}}for(const K of c)P.set(K.colId,g(K.handle,a,K.fn,m));return{rowAxis:u,columnAxis:h,measures:c.map(K=>({colId:K.colId,fn:K.fn})),body:f,rowMargin:w,columnMargin:k,grand:P,columns:y,error:null}}function t(r,i,n){return`${r}\0${i}\0${n}`}function s(r,i){return`${r}\0${i}`}}),Ve("packages/core/src/compute/reference.js",function(e,D){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return o}});const A=D("packages/core/src/internal/paths.js").getPath,Y=D("packages/core/src/compute/handle.js"),I=Y.isMissing,L=Y.valueComparator,H=D("packages/core/src/compute/filter.js").testValue,$="",X="\0";function F(r,i){const n=i.includes(".")?A(r,i):r?.[i];return n===void 0?null:n}function j(r,i,n={}){const m=i||[];let c=r.map((a,u)=>u);if(m.length===0)return c;for(let a=m.length-1;a>=0;a--)c=v(r,c,m[a],n);return c}function v(r,i,n,m){const c=n.locale!==void 0?n.locale:m.locale,a=L(c),u=n.descending!==void 0?!!n.descending:n.dir==="desc",h=[],p=[];for(const f of i){const w=F(r[f],n.col);I(w)?p.push(f):h.push(f)}const y=new Map;for(let f=0;f<h.length;f++)y.set(h[f],f);const d=(f,w)=>{const k=F(r[f],n.col),P=F(r[w],n.col);let G;return typeof n.compare=="function"?(G=n.compare(k,P,r[f],r[w],u),u&&(G=-G)):G=u?a(P,k):a(k,P),G!==0?G:y.get(f)-y.get(w)};return h.sort(d),n.nullsFirst?p.concat(h):h.concat(p)}function b(r,i,n={}){const m=[];for(let c=0;c<r.length;c++)l(r[c],i,n,c)&&m.push(c);return m}function l(r,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=>l(r,u,n,m));const a=c.every(u=>l(r,u,n,m));return i.op==="not"?!a:a}return i.col===void 0&&typeof n.custom=="function"?!!n.custom(i,r,m):H(F(r,i.col),i,n.locale)}function g(r,i,n,m){const c=n||r.map((p,y)=>y),a=new Map,u=[],h=[];for(const p of c){const y=i.map((w,k)=>{const P=F(r[p],w);return m&&m[k]?m[k](P):P}),d=y.map(w=>w==null?X:String(w)).join($);let f=a.get(d);f===void 0&&(f=u.length,a.set(d,f),u.push(y),h.push([])),h[f].push(p)}return{keys:u,buckets:h}}function o(r,i,n={}){const m=L(n.locale),c=r.filter(u=>!I(u)),a=c.map(t).filter(u=>u!==null);switch(i){case"count":return r.length;case"countValues":return c.length;case"sum":return a.reduce((u,h)=>u+h,0);case"avg":return c.length===0?null:a.reduce((u,h)=>u+h,0)/c.length;case"min":return c.length===0?null:c.reduce((u,h)=>m(h,u)<0?h:u);case"max":return c.length===0?null:c.reduce((u,h)=>m(h,u)>0?h:u);case"first":return r.length===0?null:s(r[0]);case"last":return r.length===0?null:s(r[r.length-1]);default:return null}}function t(r){if(typeof r=="number")return Number.isNaN(r)?null:r;if(r==null||r===""||typeof r=="boolean")return null;if(r instanceof Date)return r.getTime();const i=Number(r);return Number.isNaN(i)?null:i}function s(r){return r===void 0?null:r}}),Ve("packages/core/src/compute/index.js",function(e,D){"use strict";const re=D("packages/core/src/compute/sort.js");Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return re.sortColumn}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return re.sortMulti}}),Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return re.radixSortFloat64}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return re.radixSortInt32}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return re.rankSortDictionary}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return re.mergeSortComparator}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return re.collateStringRanks}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return re.rankSortStrings}});const A=D("packages/core/src/compute/sortspec.js");Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return A.collationDescriptor}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return A.isPortableSort}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return A.isPortableSortSet}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return A.describeSortEntry}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return A.describeSort}});const Y=D("packages/core/src/compute/filter.js");Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return Y.evaluateFilters}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return Y.evaluateCondition}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return Y.compact}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return Y.testValue}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return Y.compilePredicate}}),Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return Y.releaseMask}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return Y.pruneColumn}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return Y.mentionsColumn}});const I=D("packages/core/src/compute/group.js");Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return I.groupByColumns}}),Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return I.packKeys}});const L=D("packages/core/src/compute/facet.js");Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return L.facet}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return L.computeBounds}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return L.countInto}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return L.bucketOf}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return L.facetKind}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return L.cardinalityOf}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return L.pickGranularity}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return L.floorTo}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return L.advance}}),Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return L.STRATEGIES}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return L.GRANULARITIES}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return L.DEFAULT_BUCKETS}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return L.DEFAULT_CARDINALITY_LIMIT}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return L.QUANTILE_SAMPLE}});const Q=D("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 H=D("packages/core/src/compute/pivot.js");Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return H.pivot}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return H.resolvePivotKeys}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return H.pivotKey}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return H.joinPath}}),Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return H.KEY_DELIMITER}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return H.DEFAULT_PATH_SEPARATOR}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return H.DEFAULT_MAX_COLUMNS}});const $=D("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return $.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return $.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return $.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return $.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return $.GRAND_PATH}});const X=D("packages/core/src/compute/reference.js");Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return X.referenceSort}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return X.referenceFilter}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return X.referenceGroup}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return X.referenceTotal}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return X.referencePasses}}),Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return X.referenceValue}});const F=D("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return F.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return F.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return F.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return F.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return F.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return F.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return F.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return F.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return F.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return F.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return F.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return F.isMissing}});const j=D("packages/core/src/compute/sketch.js");Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return j.Welford}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return j.Reservoir}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return j.HyperLogLog}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return j.SpaceSaving}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return j.KLL}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return j.hash32}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j.SKETCH_BOUNDS}});const v=D("packages/core/src/compute/windowed.js");Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return v.Window}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return v.WINDOW_KINDS}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return v.openWindow}});const b=D("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 l=D("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return l.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return l.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return l.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return l.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return l.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return l.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return l.anomalyCondition}});const g=D("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}})}),Ve("packages/core/src/source/rows.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_ROW_HEIGHT",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"KEY_SEP",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"groupPrefixKeys",{enumerable:!0,get:function(){return g}});const A=D("packages/core/src/internal/warn.js").warnOnce,I=D("packages/core/src/internal/predicates.js").isFunction,L=32,Q="\0";function H(o){return new $(o)}class ${#e;#t;constructor(t){this.#e=I(t&&t.rowKey)?t.rowKey:null;const s=t&&t.config?t.config.rowHeight:void 0;this.#t=typeof s=="number"||I(s)?s:L}get keyed(){return this.#e!==null}keyOf(t,s){if(this.#e){const r=this.#e(t);if(r!=null)return String(r)}else A("source.rowKey.missing","no config.rowKey; falling back to index identity.","Row changes, streaming dedupe, selection persistence and remote reload are disabled.");return`#${s}`}heightOf(t){return I(this.#t)?Number(this.#t(t))||L:this.#t}leaf(t,s,r=0,i=null){const n={key:this.keyOf(t,s),data:t,level:r,parent:i,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:s};return n.height=this.heightOf(n),n}group(t){const s={key:l(t.keyPath||t.path),data:null,level:t.level,parent:t.parent||null,children:[],group:!0,expanded:t.expanded!==!1,leafCount:t.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:t.column,groupValue:t.value,groupPath:t.path,hasChildren:t.hasChildren!==!1};return t.totals&&(s.totals=t.totals),s.height=this.heightOf(s),s}footer(t){const s={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 s.height=this.heightOf(s),s}detail(t,s){return{key:`${t.key}${Q}detail`,data:t.data,level:t.level+1,parent:t,group:!1,detail:!0,expanded:!1,leafCount:0,height:s,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:t.key}}grandTotal(t,s){const r={key:`${Q}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:s,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:t};return r.height=this.heightOf(r),r}skeleton(t,s=0,r=!1){const i={key:`${Q}pending${Q}${t}`,data:null,level:s,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:t,selected:!1,physical:null,pending:!0};return r&&(i.loadError=!0),i.height=this.heightOf(i),i}}function X(o,t,s,r){return{key:`${Q}pinned${Q}${s}${Q}${t}`,data:o,level:0,parent:null,group:!1,expanded:!1,leafCount:0,height:r,index:null,selected:!1,physical:null,hasChildren:!1,pinned:s}}function F(o,t){return new Proxy([],{get(s,r,i){if(r==="length")return o();if(typeof r=="string"){const n=Number(r);if(Number.isInteger(n)&&n>=0)return t(n)}return Reflect.get(s,r,i)},has(s,r){if(typeof r=="string"){const i=Number(r);if(Number.isInteger(i)&&i>=0)return i<o()}return Reflect.has(s,r)}})}function j(o){return o==null?"":String(o)}const v="";function b(o){if(o==null)return v;const t=String(o);return t.startsWith(v)?v+t:t}function l(o){const t=o||[];let s="g";for(let r=0;r<t.length;r++)s+=Q+b(t[r]);return s}function g(o){const t=new Array(o.length),s=[];for(let r=0;r<o.length;r++)s.push(o[r]),t[r]=l(s);return t}}),Ve("packages/core/src/source/handles.js",function(e,D){"use strict";Object.defineProperty(e,"HandleProvider",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"createHandleProvider",{enumerable:!0,get:function(){return Q}});const A=D("packages/core/src/internal/predicates.js").isFunction,I=D("packages/core/src/internal/warn.js").warnOnce;class L{#e;#t;#n;#r=new Map;#s=0;constructor($,X,F){this.#e=$,this.#t=X,this.#n=A(F)?F:()=>!1}get store(){const $=this.#e.store;return $&&A($.column)?$:null}invalidate(){this.#s++}handle($){const X=this.store;if(X){const b=X.column($);if(b)return b}const F=this.#r.get($);if(F&&F.builtAt===this.#s)return F.handle;const j=this.#i($);if(!j)return;if(X&&this.#n()){I(`source.dropped.${$}`,`column "${$}" 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 v=this.#a(j);return this.#r.set($,{handle:v,builtAt:this.#s}),v}#i($){const X=this.#e.columns;return X&&A(X.get)?X.get($):void 0}#a($){const X=this.#t()||[],F=X.length,j=new Array(F),v=A($.getValue)?l=>$.getValue(l):l=>l?.[$.field||$.id];for(let l=0;l<F;l++)j[l]=X[l]===void 0?void 0:v(X[l]);const b=this.#s;return{id:$.id,kind:"object",nullable:!1,values:j,presence:null,dict:null,offsets:null,get(l){return j[l]},version:b}}}function Q(H,$,X){return new L(H,$,X)}}),Ve("packages/core/src/compute/incremental.js",function(e,D){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return X}});const A=D("packages/core/src/store/columnstore.js").toFloat,Y=Object.freeze(["sum","avg","countValues","min","max"]),I=Object.freeze(["float64"]),L=1e15;function Q(F,j){return typeof F!="string"||!Y.includes(F)?!1:!!j&&I.includes(j.kind)}function H(F){if(F==null)return null;const j=A(F);return Number.isNaN(j)?null:j}class ${#e;#t=0;#n=0;#r=0;#s=1/0;#i=-1/0;#a=!1;#l=!1;constructor(j){this.#e=j}get valid(){return this.#a&&!this.#l}get fn(){return this.#e}seed(j){this.#o();for(let v=0;v<j.length;v++){const b=H(j[v]);b!==null&&this.#c(b)}this.#a=!0}seedColumn(j,v,b){this.#o();for(let l=0;l<b.length;l++){const g=b[l];if(v&&v(g)===0)continue;const o=j[g];Number.isNaN(o)||this.#c(o)}this.#a=!0}#o(){this.#t=0,this.#n=0,this.#r=0,this.#s=1/0,this.#i=-1/0,this.#l=!1}#c(j){if(!Number.isFinite(j)){this.#l=!0;return}const v=this.#t+j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-v+j:j-v+this.#t,this.#t=v,this.#r++,j<this.#s&&(this.#s=j),j>this.#i&&(this.#i=j)}#u(j){const v=this.#t-j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-v-j:-j-v+this.#t,this.#t=v,this.#r--}update(j,v){if(!this.#a)return!1;const b=H(j),l=H(v);return b===null&&l===null?!0:b!==null&&!Number.isFinite(b)||l!==null&&!Number.isFinite(l)?!1:this.#e==="min"||this.#e==="max"?b===null||l===null?!1:this.#e==="min"?l<this.#s?(this.#s=l,!0):b>this.#s:l>this.#i?(this.#i=l,!0):b<this.#i:Math.abs(this.#t)>L?!1:(b!==null&&this.#u(b),l!==null&&this.#c(l),!0)}value(){switch(this.#e){case"countValues":return this.#r;case"avg":return this.#r?(this.#t+this.#n)/this.#r:null;case"min":return this.#r?this.#s:null;case"max":return this.#r?this.#i:null;default:return this.#t+this.#n}}invalidate(){this.#a=!1}}const X=$}),Ve("packages/core/src/source/filterwire.js",function(e,D){"use strict";Object.defineProperty(e,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return r}}),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 a}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"forEachCondition",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"mapConditions",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"normaliseFilterSet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"buildFilterSet",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"wireFilters",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"querySignature",{enumerable:!0,get:function(){return k}});const A=D("packages/core/src/internal/warn.js").warnOnce,Y="source.remote.hostFilter",I="source.where.pageRelative";function L(K,q){!Array.isArray(K)||!K.length||A(I,`filters.where (${K.join(", ")}) runs over the rows the ${q} 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(K){const q=(K||{}).config;!q||!q.hostFilter||A(Y,"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 H="source.where.notApplied";function $(K,q){A(`${H}:${K}`,`filters.where("${K}") is registered but the ${q} source holds only its fetched window`,"and cannot run the predicate over it: the predicate is not applied there, and rows it would","exclude stay on screen.","Give it a { condition } twin so the engine can narrow the fetch itself — that is the","supported route for a paged or remote source.")}const X="source.where.overThreshold";function F(K,q,B,E){!Array.isArray(K)||!K.length||A(`${X}:${q}`,`filters.where (${K.join(", ")}) is not applied to the ${q} pushdown source:`,B===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${B.toLocaleString()} rows, at or past the whereRowLimit of ${E.toLocaleString()}.`,"Running the predicate needs every matching row fetched and held here, which is the whole","download a pushdown source exists to avoid, so it is refused and the rows the predicate","would exclude stay on screen.","Give the predicate a { condition } twin so the engine narrows the fetch itself — that is the","route that works at any size — or raise `whereRowLimit` on the source config if you want the","download.")}const j=new Map;function v(K){let q=j.get(K);return q||(q=new Intl.DateTimeFormat("en-US",{timeZone:K,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),j.set(K,q)),q}function b(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function l(K,q){const B=v(q).formatToParts(new Date(K)),E={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const S of B)S.type==="year"?E.y=+S.value:S.type==="month"?E.m=+S.value:S.type==="day"?E.d=+S.value:S.type==="hour"?E.h=+S.value%24:S.type==="minute"?E.mi=+S.value:S.type==="second"&&(E.s=+S.value);return E}function g(K,q){const B=l(K,q);return Date.UTC(B.y,B.m-1,B.d,B.h,B.mi,B.s)-Math.floor(K/1e3)*1e3}function o(K,q,B,E){const S=Date.UTC(K,q-1,B),C=S-g(S,E);return S-g(C,E)}function t(K,q,B){const E=new Date(Date.UTC(K.y,K.m-1,K.d+q));return o(E.getUTCFullYear(),E.getUTCMonth()+1,E.getUTCDate(),B)}const s=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function r(K,q){if(typeof K!="string")return null;const B=K.trim().toLowerCase().replace(/[\s_-]+/g,""),E=/^last(\d*|n)days?$/.exec(B);if(E){const S=E[1]==="n"?"":E[1],C=Number(S||q);return!Number.isFinite(C)||C<=0?null:{kind:"lastNDays",n:Math.floor(C)}}switch(B){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(K,q={}){const B=r(K,q.n);if(!B)return null;const E=q.tz||b(),S=q.now instanceof Date?q.now.getTime():typeof q.now=="number"?q.now:Date.now(),C=l(S,E),N=o(C.y,C.m,C.d,E),O=t(C,1,E);let T=N,R=O;switch(B.kind){case"today":break;case"yesterday":T=t(C,-1,E),R=N;break;case"lastNDays":R=q.includeToday?O:N,T=t(C,q.includeToday?-(B.n-1):-B.n,E);break;case"thisWeek":{const x=Number.isFinite(q.weekStartsOn)?Number(q.weekStartsOn):1,V=(new Date(Date.UTC(C.y,C.m-1,C.d)).getUTCDay()-x+7)%7;T=t(C,-V,E),R=t(C,-V+7,E);break}case"thisMonth":T=o(C.y,C.m,1,E),R=o(C.m===12?C.y+1:C.y,C.m===12?1:C.m+1,1,E);break;case"thisQuarter":case"quarterToDate":{const x=Math.floor((C.m-1)/3)*3+1;T=o(C.y,x,1,E),R=B.kind==="quarterToDate"?O:x===10?o(C.y+1,1,1,E):o(C.y,x+3,1,E);break}case"thisYear":case"yearToDate":T=o(C.y,1,1,E),R=B.kind==="yearToDate"?O:o(C.y+1,1,1,E);break;default:return null}return{from:new Date(T).toISOString(),to:new Date(R).toISOString(),bounds:"[)",tz:E,relative:B.kind==="lastNDays"?`last${B.n}Days`:B.kind,n:B.n}}function n(K){if(!K||typeof K!="object")return null;const q=K.value;if(q&&typeof q=="object"&&!Array.isArray(q)&&"relative"in q)return{token:String(q.relative),n:typeof q.n=="number"?q.n:void 0};if(K.op==="relative"&&typeof K.value=="string")return{token:K.value,n:void 0};const B=K.meta;return B&&typeof B.relative=="string"&&K.value===void 0?{token:B.relative,n:typeof B.n=="number"?B.n:void 0}:null}function m(){return`Known tokens: ${s.filter(q=>q!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function c(K){const q=n(K);return q?r(q.token,q.n)!==null:!1}function a(K,q={}){const B=n(K);if(!B)return K;const E=i(B.token,{...q,n:B.n});return E?{...K,type:K.type||"date",op:"between",value:[E.from,E.to],bounds:K.bounds||E.bounds,meta:{...K.meta||{},relative:E.relative,tz:E.tz}}:(A(`source.relative.${B.token}`,`unknown relative date token "${B.token}"; sending the condition unresolved.`,m()),K)}function u(K){return!!K&&typeof K=="object"&&Array.isArray(K.conditions)}function h(K,q){if(K){if(u(K)){for(const B of K.conditions)h(B,q);return}q(K)}}function p(K,q){if(!K)return null;if(!u(K))return q(K);const B=K;let E=!1;const S=[];for(const C of B.conditions){const N=p(C,q);N!==C&&(E=!0),N&&S.push(N)}return!E&&S.length===B.conditions.length?K:S.length?{...B,conditions:S}:null}function y(K){if(!K)return null;if(!u(K))return K;const q=K,B=[];for(const E of q.conditions){const S=y(E);S&&B.push(S)}return B.length?{op:q.op,conditions:B}:null}function d(K){const q=y(K);return q?u(q)&&q.op==="and"?q:{op:"and",conditions:[q]}:null}function f(K){const q=(K||[]).filter(Boolean);return q.length?{op:"and",conditions:q}:null}function w(K,q={}){const B=p(K,E=>a(E,q));return d(B)}function k(K){const q=P(K.filters??null);return JSON.stringify([q,K.sort??null,K.quick??"",K.groupBy??null,K.pivotBy??null,G(K.context)])}function P(K){if(!K)return null;if(u(K)){const E=K;return{op:E.op,conditions:E.conditions.map(P)}}const q=K,B=q.meta&&typeof q.meta.relative=="string"?q.meta.relative:n(q)?.token;return{col:q.col,op:q.op,bounds:q.bounds??null,caseSensitive:q.caseSensitive??!1,value:B?`rel:${B}`:q.value??null}}function G(K){if(K==null)return null;try{return JSON.parse(JSON.stringify(K))}catch{return A("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),Ve("packages/core/src/source/tree.js",function(e,D){"use strict";Object.defineProperty(e,"SYNTHETIC",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"buildFromPath",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"assignLevels",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resolveTree",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"buildTree",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"indexTree",{enumerable:!0,get:function(){return l}});const A=D("packages/core/src/internal/predicates.js").isFunction,I=D("packages/core/src/internal/warn.js").warnOnce,L="",Q="\0tree:";function H(g,o){return{physical:g,key:o,level:0,children:[],value:void 0}}function $(g,o){const t=[],s=new Map;for(let r=0;r<g.length;r++){const i=g[r],n=o.pathOf(i),m=Array.isArray(n)?n.map(a=>String(a)):[];if(!m.length){const a=H(i,o.keyOf(i));t.push(a);continue}let c=null;for(let a=0;a<m.length;a++){const u=m.slice(0,a+1).join(L),h=a===m.length-1;let p=s.get(u);p&&h&&p.physical===-1&&(p.physical=i,p.key=o.keyOf(i)),p||(p=H(h?i:-1,h?o.keyOf(i):Q+u),p.level=a,p.value=m[a],s.set(u,p),c?c.children.push(p):t.push(p)),c=p}}return{roots:t,nodes:s}}function X(g,o){const t=new Map,s=[];for(let m=0;m<g.length;m++){const c=g[m],a=o.keyOf(c),u=H(c,a);t.set(a,u);const h=o.parentOf(c);h!=null&&h!==""&&s.push({node:u,parent:String(h)})}let r=null;const i=new Map;for(const{node:m,parent:c}of s){const a=t.get(c);if(a){i.set(m.key,a);continue}o.orphans&&o.orphans!=="root"&&(r||(r=H(-1,`${Q}orphans`),r.value=o.orphans),i.set(m.key,r))}const n=[];for(const m of t.values()){const c=i.get(m.key);c?c.children.push(m):n.push(m)}return r&&r.children.length&&n.push(r),{roots:F(n,t,o.orphans,r),nodes:t}}function F(g,o,t,s){const r=new Set,i=[...g];for(;i.length;){const u=i.pop();if(!r.has(u.key)){r.add(u.key);for(const h of u.children)i.push(h)}}const n=[];for(const u of o.values())r.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(h=>r.has(h.key));if(!m)return[...g,...n];let c=s;const a=[...g];return c||(c=H(-1,`${Q}orphans`),c.value=t,a.push(c)),c.children.push(...n),a}function j(g){let o=0;const t=(s,r)=>{for(const i of s)i.level=r,r>o&&(o=r),i.children.length&&t(i.children,r+1)};return t(g,0),o}function v(g,o){if(!g||typeof g!="object")return null;const t=g.path,s=g.parentKey,r=A(g.hasChildren)?i=>!!g.hasChildren(o.dataAt(i)):null;if(A(t))return{mode:"path",pathOf:i=>t(o.dataAt(i)),keyOf:o.keyOf,declaresChildren:r};if(s!=null){const i=A(s)?s:n=>n?.[s];return{mode:"parentKey",parentOf:n=>i(o.dataAt(n)),keyOf:o.keyOf,orphans:g.orphans||"root",declaresChildren:r}}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"?$(g,o):X(g,o),s=j(t.roots);return{...t,depth:s}}function l(g,o){const t=new Map,s=r=>{for(let i=0;i<r.length;i++){const n=r[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:r.length,hasChildren:n.children.length>0||m,lazy:c})}n.children.length&&s(n.children)}};return s(g),t}}),Ve("packages/core/src/source/settle.js",function(e,D){"use strict";Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"ARRIVAL_REASONS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"isArrival",{enumerable:!0,get:function(){return I}});const re=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function A(L){const Q=L&&typeof L=="object"?L.reason:null;return typeof Q=="string"&&re.includes(Q)}const Y=Object.freeze(["page","total"]);function I(L){const Q=L&&typeof L=="object"?L.reason:null;return typeof Q=="string"&&Y.includes(Q)}}),Ve("packages/core/src/source/memory.js",function(e,D){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"quickMatcher",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"MemorySource",{enumerable:!0,get:function(){return V}});const A=D("packages/core/src/internal/lru.js").Lru,Y=D("packages/core/src/internal/warn.js"),I=Y.warnOnce,L=Y.fail,H=D("packages/core/src/internal/predicates.js").isFunction,X=D("packages/core/src/internal/compare.js").defaultCompare,j=D("packages/core/src/internal/merge.js").mergeRow,v=D("packages/core/src/source/rows.js"),b=v.createRowFactory,l=v.groupKey,g=v.groupPathElement,o=v.groupPrefixKeys,t=v.lazyRowView,r=D("packages/core/src/source/handles.js").createHandleProvider,i=D("packages/core/src/compute/incremental.js"),n=i.RunningTotal,m=i.isIncremental,a=D("packages/core/src/compute/handle.js").presenceReader,u=D("packages/core/src/source/filterwire.js"),h=u.querySignature,p=u.mapConditions,y=u.resolveRelativeCondition,d=D("packages/core/src/source/tree.js"),f=d.buildTree,w=d.resolveTree,k=d.indexTree,P=D("packages/core/src/source/settle.js"),G=P.PIPELINE_SETTLE_REASONS,K=P.isPipelineSettle,q=Object.freeze(["filter","sort","group","total","pivot","flatten"]),B=Object.freeze([]);function E(J,_){if(!J)return null;const ee=_==="grand"?J.grandTotal:J.groupTotal;return ee??J.total}function S(J){return!!J&&!J.running}function C(J){if(J)return J.value&&H(J.value.compare)?J.value.compare:H(J.compare)?J.compare:void 0}function N(J){const _=J&&J.dataType;return!_||!H(_.items)?null:{items:_.items,type:J.itemType&&J.itemType.name||"text"}}function O(J){return!!J&&(typeof J=="object"||typeof J=="function")&&H(J.then)}const T=new Uint32Array(0),R=4096;function x(J,_){return new V(J,_)}function U(J,_){if(_==="regex")try{const ee=new RegExp(J,"iu");return W=>ee.test(W)}catch{return ee=>ee.includes(J)}if(_==="fuzzy"){const ee=[...J].filter(W=>W!==" ");return ee.length?W=>{let Z=0;for(let ne=0;ne<W.length&&Z<ee.length;ne++)W[ne]===ee[Z]&&Z++;return Z===ee.length}:()=>!0}if(_==="words"){const ee=J.split(/\s+/).filter(Boolean);return ee.length?W=>ee.every(Z=>W.includes(Z)):()=>!0}return ee=>ee.includes(J)}class V{mode="memory";#e;#t;#n;#r=!1;#s=null;#i;#a;#l=new Map;#o=!1;#c=0;#u=0;#f=new Map;#d=new Map;#h;#p=null;#m=V.#g();static#g(){return{slots:[],groupHeadings:B,unnumbered:B,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;#C=-1;#S=[];#P=null;#E=null;#T=null;#M=null;#N=null;#R=null;#I=null;#K=null;#Y=Symbol("unset");#x=new Map;#U=null;get#D(){return this.#m.slots}set#D(_){this.#m.slots=_}get#X(){return this.#m.inlineLeaves}set#X(_){this.#m.inlineLeaves=_}get#V(){return this.#m.groupHeadings}set#V(_){this.#m.groupHeadings=_}get#_(){return this.#m.unnumbered}set#_(_){this.#m.unnumbered=_}get#W(){return this.#m.pivot}set#W(_){this.#m.pivot=_}constructor(_,ee){this.#t=_||{mode:"memory"},this.#e=ee||{};const W=this.#e.config||{};this.#n=this.#t.rows||W.rows||[],this.#i=b(this.#e),this.#a=r(this.#e,()=>this.#n,()=>this.#r),this.#h=new A(Number(W.rowCacheSize)||R);for(const Z of q)this.#l.set(Z,{key:null,result:null,id:0,computed:!1})}count(){this.#B();const _=this.#ge();return _?_.length:this.#D.length}#ge(){const _=Number(this.#z("pageSize",0))||0;if(_<=0)return null;const ee=this.#D.length,W=Math.max(1,Math.ceil(ee/_)),ne=Math.min(Math.max(0,Number(this.#z("page",0))||0),W-1)*_;return{offset:ne,length:Math.max(0,Math.min(_,ee-ne))}}pageInfo(){this.#B();const _=Number(this.#z("pageSize",0))||0,ee=this.#D.length;if(_<=0)return{page:0,pageSize:0,total:ee,pageCount:1};const W=Math.max(1,Math.ceil(ee/_));return{page:Math.min(Math.max(0,Number(this.#z("page",0))||0),W-1),pageSize:_,total:ee,pageCount:W}}totalCount(){return this.#et().length}matchCount(){return this.#B(),this.#m.matchCount}at(_){this.#B();const ee=this.#ge();if(ee)return _<0||_>=ee.length?void 0:this.#He(ee.offset+_,_);if(!(_<0||_>=this.#D.length))return this.#He(_,_)}byKey(_){this.#B(),this.#p||this.#Ae();const ee=this.#p.get(_);if(ee!==void 0)return this.#ce(ee);for(let W=0;W<this.#D.length;W++){const Z=this.#D[W];if(typeof Z!="number"&&Z&&Z.key===_)return this.#He(W)}}loaded(_){return _>=0&&_<this.count()}hint(_,ee){}display(){return this.#B(),this.#U||(this.#U=this.#$e()),this.#U}invalidateQuickText(){this.#x.clear(),this.invalidate("filter")}invalidate(_){const ee=q.indexOf(_);ee<0&&L(`unknown pipeline stage "${_}"; expected one of ${q.join(", ")}`);for(let W=ee;W<q.length;W++){const Z=this.#l.get(q[W]);Z.key=null,Z.computed=!1}this.#U=null}apply(_){const ee=[],W={added:[],updated:[],removed:[],rejected:ee};if(!_)return W;let Z=!1;const ne=new Set;if(_.remove&&_.remove.length)for(const ie of _.remove){const ce=this.#Pe(ie);if(ce===void 0){ee.push({operation:"remove",id:this.#Ue(ie),reason:"unknown-id"});continue}W.removed.push(this.#i.keyOf(this.#r?this.#Je(ce):this.#n[ce],ce)),this.#r||(this.#n[ce]=void 0),this.#h.delete(ce),this.#x.delete(ce),Z=!0}if(_.update&&_.update.length){const ie=this.#O.size||this.#at()?this.#Ke():null,ce=this.#v.size?this.#ht():null,me=ce&&ce.length?this.#Ke():null;for(const Ce of _.update){const Pe=this.#Pe(Ce);if(Pe===void 0){ee.push({operation:"update",id:this.#xe(Ce),reason:"unknown-id"});continue}const xe=this.#r?this.#s&&this.#s.has(Pe)?this.#s.get(Pe):this.#Je(Pe):this.#n[Pe],_e=j(xe,Ce);for(const ve of this.#le(xe,_e))ne.add(ve);if(this.#r||(this.#n[Pe]=_e),ie&&this.#Qe(ie,Pe,xe,_e),me&&this.#We(ce,me,Pe,xe,_e),this.#p){const ve=this.#i.keyOf(xe,Pe),oe=this.#i.keyOf(_e,Pe);ve!==oe&&(this.#p.delete(ve),this.#p.set(oe,Pe))}this.#h.delete(Pe),this.#x.delete(Pe),W.updated.push(this.#ce(Pe))}}if(_.add&&_.add.length&&this.#r){typeof _.at=="number"&&_.at<this.#j()&&(this.#h.clear(),this.#x.clear()),this.#p=null;for(const ie of _.add){const ce=this.#ae(this.#xe(ie));ce!==void 0&&W.added.push(this.#ce(ce))}Z=!0}else if(_.add&&_.add.length){let ie=typeof _.at=="number"?_.at:this.#n.length;if(ie<this.#n.length){let Ce=0;for(let Pe=0;Pe<this.#n.length;Pe++)this.#n[Pe]!==void 0&&Ce++;if(Ce!==this.#n.length){let Pe=0;for(let xe=0;xe<this.#n.length;xe++)this.#n[xe]!==void 0&&(this.#n[Pe++]=this.#n[xe]);this.#n.length=Pe,this.#p=null,this.#h.clear(),this.#x.clear()}}const ce=this.#n.length;ie=Math.max(0,ie);let me=_.add===this.#n?_.add.slice():_.add;if(this.#i.keyed){const Ce=[];for(const Pe of me){const xe=this.#xe(Pe);if(this.#Pe(xe)!==void 0){ee.push({operation:"add",id:xe,reason:"duplicate-id"});continue}Ce.push(Pe)}Ce.length!==me.length&&(me=Ce)}if(!me.length)return W;if(ie>=ce)for(let Ce=0;Ce<me.length;Ce++)this.#n.push(me[Ce]);else this.#n.splice(ie,0,...me),this.#h.clear(),this.#x.clear();for(let Ce=0;Ce<me.length;Ce++)W.added.push(this.#ce(ie>=ce?ce+Ce:ie+Ce));Z=!0}return this.#c++,Z&&(this.#p=null,this.#lt()),this.#a.invalidate(),this.#U=null,Z||this.#ne(ne)?(this.#u++,this.invalidate("filter")):this.invalidate("total"),this.#bt("rows:changed",{companion:!0,added:W.added.length,updated:W.updated.length,removed:W.removed.length}),this.#s=null,W}groupHeadingsAt(_){this.#B();const ee=this.#V;if(!ee.length||!Number.isInteger(_)||_<0)return B;let W=0,Z=ee.length-1,ne=-1;for(;W<=Z;){const ce=W+Z>>1;ee[ce].at<=_?(ne=ce,W=ce+1):Z=ce-1}if(ne<0)return B;const ie=[];for(let ce=ee[ne].row;ce;ce=ce.parent)ie.push(ce);return ie.reverse(),ie}unnumberedRowCount(_){this.#B();const ee=this.#_;if(!ee.length||!Number.isInteger(_)||_<0)return 0;let W=0,Z=ee.length-1,ne=-1;for(;W<=Z;){const ie=W+Z>>1;ee[ie].at<=_?(ne=ie,W=ie+1):Z=ie-1}return ne+1}moveRow(_,ee){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 W=this.#n;if(!Number.isInteger(_)||!Number.isInteger(ee))return!1;let Z=0;for(let ce=0;ce<W.length;ce++)W[ce]!==void 0&&Z++;if(_<0||_>=Z)return!1;const ne=Math.max(0,Math.min(Z-1,ee));if(ne===_)return!1;if(Z!==W.length){let ce=0;for(let me=0;me<W.length;me++)W[me]!==void 0&&(W[ce++]=W[me]);W.length=ce}const[ie]=W.splice(_,1);return W.splice(ne,0,ie),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#x.clear(),this.#lt(),this.#a.invalidate(),this.#U=null,this.invalidate("filter"),this.#bt("rows:changed",{companion:!0,added:0,updated:0,removed:0,moved:1}),!0}reload(_){this.#ue(),this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#lt(),this.#a.invalidate(),this.invalidate("filter"),this.#bt("model:changed",{reason:"reload"})}destroy(){this.#ue(),this.#h.clear(),this.#x.clear(),this.#p=null,this.#D=[],this.#X=null,this.#U=null,this.#lt();for(const _ of q)this.#l.set(_,{key:null,result:null,id:0,computed:!1})}#ie(_){const ee=this.#e.sortPending;H(ee)&&ee(_)}#ue(){this.#b.has("sort")&&this.#ie(!1);for(const{controller:_}of this.#b.values())try{_.abort()}catch{}this.#b.clear()}setRows(_){this.#n=_||[],this.#r=!1,this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#lt(),this.#a.invalidate(),this.invalidate("filter")}notePriorRows(_){this.#s=_||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#x.clear(),this.#a.invalidate()}data(){if(!this.#r)return this.#n;const _=this.#e.store;if(!_||!H(_.source))return this.#n;const ee=_.physical||0,W=new Array(ee);for(let Z=0;Z<ee;Z++)W[Z]=_.live&&!_.live(Z)?void 0:_.source(Z);return W}#Me(){const _=this.#z("detail",null);return!_||!H(_.isOpen)||_.inline===!1?null:_}#fe(){const _=(this.#e.config||{}).tree;return this.#Y!==_&&(this.#Y=_,this.#K=w(_,{dataAt:ee=>this.#Je(ee),keyOf:ee=>this.#i.keyOf(this.#Je(ee),ee)})),this.#K}#oe(){return(this.#e.config||{}).grandTotalRow==="bottom"}grandTotalRow(){if(!this.#oe())return null;this.#B();const _=this.#m.grand;return _?this.#i.grandTotal(_,this.#te(this.#m.grandLeaves)):null}pivot(){return this.#B(),this.#W}pivotMatrix(){this.#B();const _=this.#m.groupLeaves,ee=(this.#e.compute||{}).pivotMatrix;if(!H(ee))return null;const W=this.#z("groupBy",[]),Z=this.#z("pivotBy",[]);if(!W.length&&!Z.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(ce=>({colId:ce.id,handle:this.#a.handle(ce.id),fn:E(ce,"group")})).filter(ce=>ce.handle&&ce.fn),ie=this.#e.config||{};return ee({rowHandles:W.map(ce=>this.#a.handle(ce)).filter(Boolean),columnHandles:Z.map(ce=>this.#a.handle(ce)).filter(Boolean),measures:ne,leaves:_||new Uint32Array(0),opts:{locale:ie.locale,separator:(ie.pivot||{}).separator,maxColumns:(ie.pivot||{}).maxColumns}})}keysForLeaves(_){const ee=[];if(!_)return ee;for(let W=0;W<_.length;W++){const Z=this.#ce(_[W]);Z&&Z.key!=null&&ee.push(String(Z.key))}return ee}leavesOf(_){this.#B();const ee=this.#l.get("group"),W=ee&&ee.result;if(!W||!W.nodes)return[];const Z=W.nodes.get(_);if(!Z)return[];const ne=[],ie=ce=>{const me=ce.row&&ce.row.children;if(me&&me.length){for(const Ce of me){const Pe=W.nodes.get(Ce.key);Pe&&ie(Pe)}return}if(ce.leaves)for(let Ce=0;Ce<ce.leaves.length;Ce++)ne.push(this.#ce(ce.leaves[Ce]))};return ie(Z),ne}#Ue(_){return typeof _=="string"?_:this.#xe(_)}#xe(_){try{return this.#i.keyOf(_,-1)}catch{return"(unkeyed)"}}#Pe(_){if(typeof _=="string")return this.#ae(_);if(this.#i.keyed){const W=this.#i.keyOf(_,-1),Z=this.#ae(W);if(Z!==void 0)return Z}if(this.#r)return;const ee=this.#n.indexOf(_);return ee>=0?ee:void 0}#ae(_){return this.#p||this.#Ae(),this.#p.get(_)}#Ae(){this.#p=new Map;const _=this.#j(),ee=this.#e.store,W=ee&&H(ee.live)?Z=>ee.live(Z):null;for(let Z=0;Z<_;Z++){if(W&&!W(Z))continue;const ne=this.#Je(Z);ne!==void 0&&this.#p.set(this.#i.keyOf(ne,Z),Z)}}#le(_,ee){const W=[];for(const Z of this.#G())this.#De(Z)&&this.#Z(Z,_,ee,new Set)&&W.push(Z);return W}#Z(_,ee,W,Z){if(Z.has(_))return!1;Z.add(_);const ne=this.#De(_);if(!ne)return!1;const ie=ne.value&&ne.value.deps;return Array.isArray(ie)&&ie.length?ie.some(ce=>this.#Z(String(ce),ee,W,Z)):H(ne.getValue)?!Object.is(ne.getValue(ee),ne.getValue(W)):!1}#G(){const _=new Set;for(const W of this.#z("sort",[]))_.add(W.col);for(const W of this.#z("groupBy",[]))_.add(W);const ee=W=>{if(W){if(Array.isArray(W.conditions)){W.conditions.forEach(ee);return}W.col&&_.add(W.col)}};return ee(this.#z("filters",null)),[..._]}#ne(_){if(!_.size)return!1;if(this.#z("quick",""))return!0;for(const ee of this.#G())if(_.has(ee))return!0;return!1}#B(){if(!this.#o){this.#o=!0;try{this.#Ee()}finally{this.#o=!1}}}pipelineRunning(){return this.#o}#Ee(){const _=this.#de("filter",()=>this.#$(),()=>this.#Ve()),ee=this.#re(_),W=this.#de("group",()=>this.#F(),()=>this.#Fe(ee)),Z=this.#de("total",()=>this.#ke(),()=>this.#qe(W));this.#de("pivot",()=>this.#ee(),()=>this.#Ge(W)),this.#de("flatten",()=>this.#Le(),()=>this.#kt(W)),this.#ye(W,Z)}#re(_){const ee=this.#l.get("sort"),W=this.#H();if(ee.computed&&ee.key===W&&!this.#b.has("sort"))return ee.result;const Z=this.#b.get("sort");return Z&&Z.key===W?ee.result:ee.result&&this.#Te(_)?(this.#we(_,W),ee.result):this.#de("sort",()=>W,()=>this.#k(_))}#pe(){if(this.#y===null){const _=this.#e.pipelineWorker,ee=H(_)?_():null;this.#y=ee||!1}return this.#y||null}#be(){const _=this.#z("sort",[]);if(!Array.isArray(_)||!_.length)return null;const ee=(this.#e.config||{}).locale,W=[],Z=[];for(const ne of _){const ie=this.#De(ne.col);if(ie&&ie.running)continue;if(ie&&ie.value&&H(ie.value.compare))return null;const ce=this.#a.handle(ne.col);if(!ce)return null;W.push({col:ne.col,descending:ne.dir==="desc",nullsFirst:!!ne.nullsFirst,locale:ee}),Z.push(ce)}return W.length?{entries:W,handles:Z,locale:ee}:null}#Te(_){if(this.#he())return!1;const ee=this.#pe();if(!ee)return!1;const W=Number(ee.threshold);return Number.isFinite(W)&&_.length<W?!1:!!this.#be()}#we(_,ee){const W=this.#pe(),Z=W&&this.#be();if(!Z){this.#de("sort",()=>ee,()=>this.#k(_));return}const ne=new AbortController;this.#b.set("sort",{key:ee,controller:ne});const ie=Z.entries.length===1?W.sortColumn(Z.handles[0],_,{descending:Z.entries[0].descending,nullsFirst:Z.entries[0].nullsFirst,locale:Z.locale,signal:ne.signal,key:"sort"}):W.sortMulti(Z.handles,Z.entries.map((ce,me)=>({...ce,handle:Z.handles[me]})),_,{signal:ne.signal,key:"sort"});if(!O(ie)){this.#b.delete("sort"),this.#de("sort",()=>ee,()=>ie),this.#ie(!1);return}this.#ie(!0),ie.then(ce=>this.#ve(ee,ce),ce=>this.#Se("sort",ee,ce))}#ve(_,ee){const W=this.#b.get("sort");if(!(!W||W.key!==_)){if(this.#H()!==_){this.#b.delete("sort"),this.#ie(!1);return}this.#b.delete("sort"),this.#de("sort",()=>_,()=>ee),this.#U=null,this.#B(),this.#bt("model:changed",{reason:G[0]}),this.#ie(!1)}}#Se(_,ee,W){const Z=this.#b.get(_);if(!(!Z||Z.key!==ee)){if(this.#b.delete(_),W&&W.name==="AbortError"){_==="sort"&&this.#ie(!1);return}if(_==="sort"&&this.#H()===ee){const ne=this.#de("filter",()=>this.#$(),()=>this.#Ve());this.#de("sort",()=>ee,()=>this.#k(ne)),this.#U=null,this.#B(),I("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",W),this.#bt("model:changed",{reason:G[1]})}_==="sort"&&this.#ie(!1)}}#ye(_,ee){const W=_&&_.leaves?_.leaves.length:this.#m.slots.length;this.#m.matchCount=W,this.#m.grand=ee&&ee.grand||null,this.#m.grandLeaves=_&&_.leaves?_.leaves.length:0,this.#m.groupLeaves=_&&_.leaves?_.leaves:null}#de(_,ee,W){const Z=this.#l.get(_),ne=ee();return Z.computed&&Z.key===ne||(Z.result=W(),Z.key=ne,Z.computed=!0,Z.id++,_==="flatten"&&(this.#U=null)),Z.result}#Q(_){return this.#l.get(_).id}#$(){const _=(this.#e.config||{}).hostFilter,ee=_&&H(_.active)&&_.active()?1:0,W=this.#z("where",null),Z=W?W.version:0,ne=this.#st("filter.sig",`${this.#St()}`,()=>h({filters:this.#z("filters",null),quick:this.#z("quick",""),quickMode:this.#z("quickMode","contains")}));return`${this.#u}|${ne}|${ee}|${Z}`}#H(){const _=this.#he();return`${this.#Q("filter")}|${JSON.stringify(this.#z("sort",[]))}`+(_?`|manual:${_.version}`:"")}#he(){const _=this.#z("rowOrder",null);return _&&Array.isArray(_.keys)?_:null}#se(_,ee){this.#p||this.#Ae();const W=this.#p,Z=this.#j(),ne=ee.keys.length,ie=new Float64Array(Z);for(let ce=0;ce<Z;ce++)ie[ce]=ne+ce;for(let ce=0;ce<ne;ce++){const me=W.get(ee.keys[ce]);me!==void 0&&(ie[me]=ce)}return Uint32Array.from(_).sort((ce,me)=>ie[ce]-ie[me])}orderedKeys(){this.#p||this.#Ae();const _=this.#p,ee=new Map;for(const[ce,me]of _)ee.set(me,ce);const W=Uint32Array.from([...ee.keys()]).sort(),Z=this.#he(),ne=Z?this.#se(W,Z):this.#k(W),ie=new Array(ne.length);for(let ce=0;ce<ne.length;ce++)ie[ce]=ee.get(ne[ce]);return ie}#F(){const _=this.#z("pivotBy",[]).length>0?"p":"u";return`${this.#Q("sort")}|${JSON.stringify(this.#z("groupBy",[]))}|${_}`}#ke(){const _=this.#rt()?"f":"a",ee=(this.#e.config||{}).totalOnlyChangedColumns?"n":"w";return`${this.#Q("group")}|${JSON.stringify(this.#z("totals",[]))}|${_}${ee}|${this.#c}`}#ee(){return`${this.#Q("group")}|${JSON.stringify(this.#z("pivotBy",[]))}`}#Le(){const ee=this.#je()||!this.#oe()?this.#Q("total"):"x",W=`${this.#St()}`,Z=this.#st("flatten.keys",W,()=>{const ie=this.#z("expanded",null);return ie?[...ie].sort().join(""):"*"}),ne=this.#st("flatten.detail",W,()=>{const ie=this.#z("detail",null);return ie&&H(ie.signature)?ie.signature():""});return`${ee}|${this.#Q("pivot")}|${Z}|${ne}`}#je(){const _=this.#z("groupBy",[]);return Array.isArray(_)&&_.length>0}stageState(){const _=[];for(const[ee,W]of this.#l){const Z=W.result;_.push({stage:ee,materialised:!!W.computed,bytes:Z&&typeof Z.byteLength=="number"?Z.byteLength:null,rows:Z&&typeof Z.length=="number"?Z.length:null,rebuilds:W.id})}return _}facetIndices(_){return this.#Ve(_||null)}facetRows(_){const ee=this.facetIndices(_),W=[];for(let Z=0;Z<ee.length;Z++){const ne=this.#ce(ee[Z]);ne&&W.push(ne)}return W}invalidateRows(){this.#h.clear(),this.#x.clear(),this.#U=null}invalidateHandles(){this.#a.invalidate()}rows(){return this.#n}unfilteredIndices(){return this.#et()}filteredIndices(){const _=this.#l.get("filter");if(_&&_.computed&&_.key===this.#$())return _.result||this.#et();this.#B();const ee=this.#l.get("filter");return(ee&&ee.computed?ee.result:null)||this.#et()}unfilteredRows(){const _=this.#et(),ee=[];for(let W=0;W<_.length;W++){const Z=this.#ce(_[W]);Z&&ee.push(Z)}return ee}#Ve(_=null){const ee=this.#et(),W=this.#z("filters",null),Z=_?this.#ft("pruneColumn")(W,_):W,ne=this.#mt(Z),ie=String(this.#z("quick","")||"").trim().toLowerCase(),ce=ie?U(ie,String(this.#z("quickMode","contains")||"contains")):null,me=(this.#e.config||{}).hostFilter,Ce=!!(me&&H(me.active)&&me.active()),Pe=this.#z("where",null),xe=!!(Pe&&Pe.active);if(!ne&&!ie&&!Ce&&!xe)return ee;let _e=null;ne&&(_e=this.#ft("evaluateFilters")(ne,{handle:ae=>this.#a.handle(ae),count:this.#j(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:ae=>N(this.#De(ae)),typeOf:ae=>{const se=this.#De(ae);return se?se.type:void 0}}));const ve=new Uint32Array(ee.length);let oe=0;for(let he=0;he<ee.length;he++){const ae=ee[he];if(!(_e&&!_e[ae])&&!(ce&&!this.#_e(ae,ce))){if(Ce||xe){const se=this.#ce(ae);if(Ce&&!me.passes(se)||xe&&!Pe.passes(se.data,se.key))continue}ve[oe++]=ae}}if(_e){const he=(this.#e.compute||{}).releaseMask;H(he)&&he({pool:this.#e.pool},_e)}return ve.subarray(0,oe)}handleFor(_){return this.#a.handle(_)}#k(_){const ee=this.#he();if(ee)return this.#se(_,ee);const W=this.#z("sort",[]).filter(ie=>{const ce=this.#De(ie.col);return!ce||!ce.running?!0:(I(`source.sort.running.${ie.col}`,`sort ignores "${ie.col}": a running total is a function of the sort order, so it cannot also decide it. Sort by the column it runs over instead.`),!1)});if(!W.length)return _;const Z=(this.#e.config||{}).locale;if(W.length===1){const ie=W[0],ce=this.#a.handle(ie.col);if(!ce)return I(`source.sort.${ie.col}`,`sort ignores unknown column "${ie.col}".`),_;const me=this.#De(ie.col);return this.#ft("sortColumn")(ce,_,{descending:ie.dir==="desc",nullsFirst:ie.nullsFirst,locale:Z,compare:C(me)})}const ne=[];for(const ie of W){const ce=this.#a.handle(ie.col);if(!ce){I(`source.sort.${ie.col}`,`sort ignores unknown column "${ie.col}".`);continue}ne.push({handle:ce,descending:ie.dir==="desc",nullsFirst:ie.nullsFirst,locale:Z,compare:C(this.#De(ie.col))})}return ne.length?this.#ft("sortMulti")(ne.map(ie=>ie.handle),ne,_):_}#Fe(_){const ee=this.#z("groupBy",[]),W=this.#fe();if(W&&!ee.length){const he=f(_,W);return this.#R=k(he.roots,W.declaresChildren),{roots:null,leaves:_,nodes:new Map,tree:he}}if(this.#R=null,W&&ee.length&&I("tree.grouped","grouping is active on a grid configured with `tree`; the grouping wins and the hierarchy is not shown."),!ee.length)return{roots:null,leaves:_,nodes:new Map};const Z=(this.#e.config||{}).timeZone,ne=[],ie=[];let ce=!1;for(const he of ee){const ae=this.#a.handle(he);if(!ae){I(`source.group.${he}`,`grouping ignores unknown column "${he}".`);continue}ne.push(ae);const se=this.#De(he),de=se&&se.dataType;if(de&&H(de.groupProjector)){const ke=se.typeOptions&&se.typeOptions.timeZone||Z||void 0,Ae=de.groupProjector(se,ke);ie.push(Ae||null),Ae&&(ce=!0)}else ie.push(null)}if(!ne.length)return{roots:null,leaves:_,nodes:new Map};const{keys:me,buckets:Ce}=this.#ft("groupByColumns")(ne,_,{locale:(this.#e.config||{}).locale,project:ce?ie:void 0}),Pe=this.#z("pivotBy",[]).length>0,xe=[],_e=new Map;for(let he=0;he<Ce.length;he++){const ae=me[he];let se=null;const de=[];for(let ke=0;ke<ae.length;ke++){de.push(g(ae[ke]));const Ae=l(de),Te=ke===ae.length-1;let je=_e.get(Ae);if(!je){const ye=this.#i.group({path:[...de],column:ee[ke],value:ae[ke],level:ke,parent:se,expanded:Pe&&Te?!1:this.#gt(Ae,{key:Ae,column:ee[ke],value:ae[ke],level:ke,path:[...de]}),hasChildren:!(Pe&&Te)});je={row:ye,leaves:null},_e.set(Ae,je),se?se.children.push(ye):xe.push(ye)}je.row.leafCount+=Ce[he].length,ke===ae.length-1&&(je.leaves=Ce[he]),se=je.row}}const ve=this.#z("sort",[])||[],oe=(he,ae)=>{if(!he||he.length<2){if(he)for(const Ae of he)oe(Ae.children,ae+1);return}const se=ee[ae],de=ve.find(Ae=>Ae.col===se),ke=de&&de.dir==="desc"?-1:1;he.sort((Ae,Te)=>ke*X(Ae.groupValue,Te.groupValue));for(const Ae of he)oe(Ae.children,ae+1)};return oe(xe,0),{roots:xe,leaves:_,nodes:_e,keys:me,buckets:Ce}}#Ye(_,ee){const W=new Map,Z=new Map,ne=ie=>{const ce=ie.physical>=0?[ie.physical]:[];for(const me of ie.children)ce.push(...ne(me));if(ie.children.length){const me=this.#Xe(ee,Uint32Array.from(ce),null);ie.physical>=0?W.set(ie.physical,me):Z.set(ie.key,me)}return ce};for(const ie of _.roots)ne(ie);return{byPhysical:W,byKey:Z}}#qe(_){const ee=this.#Ke();if(!ee.length)return this.#E=null,this.#T=null,{grand:null};const W={id:this.#Q("group"),columns:ee.map(ve=>ve.id).join("")},Z=this.#E&&this.#E.id===W.id&&this.#E.columns===W.columns,ne=this.#at()&&Z?this.#P:null,ie=ne?ee.filter(ve=>ne.has(ve.id)):ee,ce=Z?this.#T:null,me=this.#rt()?null:this.#Tt(),Ce=this.#Ce(ee),Pe=ve=>{const oe=_.nodes.get(ve.key);let he=oe&&oe.leaves?oe.leaves:null;if(ve.children&&ve.children.length){const de=ve.children.map(Pe);let ke=0;for(const je of de)ke+=je.length;const Ae=new Uint32Array(ke);let Te=0;for(const je of de)Ae.set(je,Te),Te+=je.length;he=Ae}he=he||new Uint32Array(0);const ae=me?me.get(ve.key)||T:he,se=this.#Ze(ve,ne?ie:ee,ae,Ce);return ve.totals=ne?{...ve.totals,...se}:se,he};if(_.roots&&ie.length)for(const ve of _.roots)Pe(ve);if(this.#I=_.tree?this.#Ye(_.tree,ee):null,this.#E=W,this.#P=this.#at()?new Set:null,!(this.#e.config||{}).grandTotalRow)return this.#A.length=0,this.#T=null,{grand:null};const _e=me?this.#it():_.leaves;return this.#T=this.#Oe(ee,_e,ne,ce),{grand:this.#T}}#Oe(_,ee,W,Z){const ne={},ie=this.#Q("group");ie!==this.#w&&(this.#ct(),this.#w=ie);const ce=this.#A;this.#A=[];for(const me of _){if(!S(me))continue;const Ce=this.#a.handle(me.id);if(!Ce)continue;const Pe=E(me,"grand");if(!m(Pe,Ce)){if(W&&!W.has(me.id)&&Z&&me.id in Z){ne[me.id]=Z[me.id];continue}ne[me.id]=this.#Xe([me],ee,null,"grand")[me.id];continue}let xe=this.#O.get(me.id);if((!xe||xe.fn!==Pe)&&(xe=new n(Pe),this.#O.set(me.id,xe)),xe.valid){let _e=!0;for(const ve of ce)if(ve.colId===me.id&&!xe.update(ve.before,ve.after)){_e=!1;break}if(_e){ne[me.id]=xe.value();continue}xe.invalidate()}xe.seedColumn(Ce.values,a(Ce),ee),ne[me.id]=xe.valid?xe.value():this.#Xe([me],ee,null,"grand")[me.id]}return ne}#Ce(_){const ee=this.#Q("group");ee!==this.#C&&(this.#v.clear(),this.#C=ee);const W=new Map;for(const ne of _){if(!S(ne))continue;const ie=this.#a.handle(ne.id),ce=E(ne,"group");m(ce,ie)&&W.set(ne.id,{fn:ce})}if(!W.size)return this.#S.length=0,W;const Z=this.#S;this.#S=[];for(const ne of Z){const{beforeKeys:ie,afterKeys:ce,colDeltas:me}=ne,Ce=ie.length?new Set(ie):null,Pe=ce.length?new Set(ce):null;for(const{colId:xe,before:_e,after:ve}of me)if(W.has(xe)){for(const oe of ie)Pe&&Pe.has(oe)||this.#dt(oe,xe,_e,null);for(const oe of ce)Ce&&Ce.has(oe)||this.#dt(oe,xe,null,ve);for(const oe of ie)Pe&&!Pe.has(oe)||this.#dt(oe,xe,_e,ve)}}return W}#dt(_,ee,W,Z){const ne=this.#v.get(_),ie=ne&&ne.get(ee);!ie||!ie.valid||ie.update(W,Z)||ie.invalidate()}#Ze(_,ee,W,Z){if(!Z||!Z.size)return this.#Xe(ee,W,_);const ne={};let ie=null,ce=this.#v.get(_.key);for(const me of ee){const Ce=Z.get(me.id);if(!Ce){(ie||(ie=[])).push(me);continue}const Pe=this.#a.handle(me.id);if(!Pe)continue;ce||(ce=new Map,this.#v.set(_.key,ce));let xe=ce.get(me.id);if((!xe||xe.fn!==Ce.fn)&&(xe=new n(Ce.fn),ce.set(me.id,xe)),xe.valid||xe.seedColumn(Pe.values,a(Pe),W),xe.valid){ne[me.id]=xe.value();continue}(ie||(ie=[])).push(me)}return ie&&Object.assign(ne,this.#Xe(ie,W,_)),ne}#Qe(_,ee,W,Z){const ne=!this.#rt()||this.#Et(ee);for(const ie of _){const ce=ie.getValue;if(!H(ce))continue;const me=ce(W),Ce=ce(Z);Object.is(me,Ce)||(this.#P&&this.#P.add(ie.id),ne&&this.#O.has(ie.id)&&this.#A.push({colId:ie.id,before:me,after:Ce}))}}#ht(){const _=this.#z("groupBy",[]),ee=[];for(const W of _){const Z=this.#De(W);Z&&ee.push(Z)}return ee}#pt(_,ee){const W=new Array(_.length);for(let Z=0;Z<_.length;Z++){const ne=_[Z].getValue;W[Z]=g(H(ne)?ne(ee):void 0)}return W}#We(_,ee,W,Z,ne){if(this.#rt()&&!this.#Et(W))return;const ie=o(this.#pt(_,Z)),ce=o(this.#pt(_,ne)),me=ie.length!==ce.length||ie.some((Pe,xe)=>Pe!==ce[xe]),Ce=[];for(const Pe of ee){const xe=Pe.getValue;if(!H(xe))continue;const _e=xe(Z),ve=xe(ne);!me&&Object.is(_e,ve)||Ce.push({colId:Pe.id,before:_e,after:ve})}!Ce.length&&!me||this.#S.push({beforeKeys:ie,afterKeys:ce,colDeltas:Ce})}#Et(_){const ee=this.#l.get("filter"),W=ee&&ee.computed?ee.result:null;if(!W)return!0;let Z=0,ne=W.length-1;for(;Z<=ne;){const ie=Z+ne>>1,ce=W[ie];if(ce===_)return!0;ce<_?Z=ie+1:ne=ie-1}return!1}#rt(){return(this.#e.config||{}).totalFilteredOnly!==!1}#te(_){return this.#rt()?_:this.#it().length}#it(){return(!this.#M||this.#M.version!==this.#u)&&(this.#M={version:this.#u,indices:this.#et()}),this.#M.indices}#Tt(){const _=this.#z("groupBy",[]),ee=`${this.#u}|${JSON.stringify(_)}`;if(this.#N&&this.#N.key===ee)return this.#N.map;const W=new Map,Z=[];for(const ne of _){const ie=this.#a.handle(ne);ie&&Z.push(ie)}if(Z.length){const ne=this.#it(),{keys:ie,buckets:ce}=this.#ft("groupByColumns")(Z,ne,{locale:(this.#e.config||{}).locale}),me=new Map;for(let Ce=0;Ce<ce.length;Ce++){const Pe=ie[Ce],xe=[];for(let _e=0;_e<Pe.length;_e++){xe.push(g(Pe[_e]));const ve=l(xe);let oe=me.get(ve);oe||(oe=[],me.set(ve,oe));for(let he=0;he<ce[Ce].length;he++)oe.push(ce[Ce][he])}}for(const[Ce,Pe]of me)W.set(Ce,Uint32Array.from(Pe))}return this.#N={key:ee,map:W},W}#at(){return!!(this.#e.config||{}).totalOnlyChangedColumns}#lt(){this.#ct(),this.#vt(),this.#P=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.#C=-1}#Ge(_){const ee=this.#z("pivotBy",[]);if(!ee.length)return this.#W=null,null;const W=(this.#e.compute||{}).pivot;if(!H(W))return I("source.pivot.kernel","pivot requested but ctx.compute.pivot is not available; showing unpivoted rows."),this.#W=null,null;const Z=ee.map(ie=>this.#a.handle(ie)).filter(Boolean),ne=this.#Ke();return this.#W=W(Z,_.leaves,{groups:_.keys&&_.buckets?{keys:_.keys,buckets:_.buckets}:null,totals:ne.map(ie=>ie.id),handle:ie=>this.#a.handle(ie),totalOf:ie=>E(ne.find(ce=>ce.id===ie),"group"),separator:((this.#e.config||{}).pivot||{}).separator,maxColumns:((this.#e.config||{}).pivot||{}).maxColumns})||null,this.#W}#kt(_){const ee=this.#l.get("total").result,W=!!(this.#e.config||{}).groupFooter,Z=this.#Me();if(_.tree)return this.#Re(_,ee,Z);if(!_.roots&&!Z){if(ee&&ee.grand&&!this.#oe()){const Pe=this.#i.grandTotal(ee.grand,this.#te(_.leaves.length));if(this.#X===_.leaves&&Array.isArray(this.#D))this.#D[this.#D.length-1]=Pe;else{const xe=Array.from(_.leaves);xe.push(Pe),this.#D=xe,this.#X=_.leaves}this.#_=[{at:this.#D.length-1}]}else this.#X=null,this.#D=_.leaves,this.#_=B;return this.#V=B,this.#D}const ne=[],ie=[],ce=[],me=Pe=>{if(ne.push(Pe),!Z)return;const xe=this.#ce(Pe);!xe||!Z.isOpen(xe.key)||(xe.master=!0,xe.expanded=!0,ce.push({at:ne.length}),ne.push(this.#i.detail(xe,Z.heightOf(xe))))};if(!_.roots){for(let Pe=0;Pe<_.leaves.length;Pe++)me(_.leaves[Pe]);return ee&&ee.grand&&!this.#oe()&&(ce.push({at:ne.length}),ne.push(this.#i.grandTotal(ee.grand,this.#te(_.leaves.length)))),this.#X=null,this.#V=B,this.#_=ce.length?ce:B,this.#D=ne,ne}const Ce=(Pe,xe,_e)=>{if(Pe.expanded=Pe.hasChildren===!1?!1:this.#gt(Pe.key,{key:Pe.key,column:Pe.groupColumn,value:Pe.groupValue,level:Pe.level,path:Pe.groupPath}),Pe.posinset=xe+1,Pe.setsize=_e,ie.push({at:ne.length,row:Pe}),ce.push({at:ne.length}),ne.push(Pe),!!Pe.expanded){if(Pe.children&&Pe.children.length)for(let ve=0;ve<Pe.children.length;ve++)Ce(Pe.children[ve],ve,Pe.children.length);else{const ve=_.nodes.get(Pe.key),oe=ve&&ve.leaves?ve.leaves:null;if(oe)for(let he=0;he<oe.length;he++)me(oe[he])}W&&Pe.totals&&(ce.push({at:ne.length}),ne.push(this.#i.footer(Pe)))}};for(let Pe=0;Pe<_.roots.length;Pe++)Ce(_.roots[Pe],Pe,_.roots.length);return ee&&ee.grand&&!this.#oe()&&(ce.push({at:ne.length}),ne.push(this.#i.grandTotal(ee.grand,this.#te(_.leaves.length)))),this.#V=ie,this.#_=ce,this.#D=ne,ne}#et(){const _=this.#e.store;if(_&&H(_.liveIndices))return _.liveIndices();const ee=new Uint32Array(this.#n.length);let W=0;for(let Z=0;Z<this.#n.length;Z++)this.#n[Z]!==void 0&&(ee[W++]=Z);return ee.subarray(0,W)}#j(){const _=this.#e.store;return _&&typeof _.physical=="number"?_.physical:this.#n.length}#Je(_){const ee=this.#e.store;return ee&&H(ee.source)?ee.source(_):this.#n[_]}#He(_,ee=_){const W=this.#D[_];if(typeof W!="number")return W.index=ee,W;const Z=this.#ce(W);return Z.index=ee,Z}#ce(_){let ee=this.#h.get(_);ee||(ee=this.#i.leaf(this.#Je(_),_),this.#h.set(_,ee));const W=this.#R?this.#R.get(_):null;if(W){ee.level=W.level,ee.posinset=W.posinset,ee.setsize=W.setsize,ee.hasChildren=W.hasChildren,ee.expanded=W.hasChildren&&!W.lazy&&this.#gt(ee.key);const Z=this.#I?this.#I.byPhysical.get(_):void 0;Z?ee.totals=Z:ee.totals&&(ee.totals=null)}else ee.hasChildren&&(ee.level=0,ee.hasChildren=!1,ee.expanded=!1,ee.posinset=void 0,ee.setsize=void 0);return ee}#Re(_,ee,W){const Z=[],ne=[],ie=me=>{if(me.leafCount!==void 0)return me.leafCount;let Ce=me.physical>=0?1:0;for(const Pe of me.children)Ce+=ie(Pe);return me.leafCount=Ce,Ce},ce=me=>{const Ce=this.#gt(me.key);if(me.physical>=0){if(Z.push(me.physical),W&&W.isOpen(this.#ce(me.physical).key)){const Pe=this.#ce(me.physical);ne.push({at:Z.length}),Z.push(this.#i.detail(Pe,W.heightOf(Pe)))}}else Z.push(this.#i.group({path:[me.key],column:null,value:me.value,level:me.level,parent:null,expanded:Ce,hasChildren:me.children.length>0,leafCount:ie(me),totals:this.#I?this.#I.byKey.get(me.key):void 0}));if(Ce)for(const Pe of me.children)ce(Pe)};for(const me of _.tree.roots)ce(me);return ee&&ee.grand&&!this.#oe()&&(ne.push({at:Z.length}),Z.push(this.#i.grandTotal(ee.grand,this.#te(_.leaves.length)))),this.#X=null,this.#V=B,this.#_=ne.length?ne:B,this.#D=Z,Z}#$e(){return t(()=>this.count(),_=>this.at(_))}#_e(_,ee){let W=this.#x.get(_);if(W===void 0){const Z=this.#Je(_),ne=this.#At(),ie=[],ce=this.#e.columnHidden;for(const me of ne){if(me.quickFilter===!1||H(ce)&&ce(me.id))continue;const Ce=me.value&&H(me.value.quickFilterText)?me.value.quickFilterText({value:void 0,data:Z,row:null,column:me,colId:me.id,grid:null,context:this.#z("context",null)}):null,Pe=Ce??(H(me.formatValue)?me.formatValue(H(me.getValue)?me.getValue(Z):void 0):"");Pe!=null&&Pe!==""&&ie.push(String(Pe))}W=ie.join(" ").toLowerCase(),this.#x.set(_,W)}return ee(W)}#Ke(){const _=this.#z("totals",[]),ee=_&&_.length?new Set(_):null;return this.#At().filter(W=>ee?ee.has(W.id):!!(W.total||W.groupTotal||W.grandTotal))}#Xe(_,ee,W,Z="group"){const ne={},ie=(this.#e.compute||{}).total;for(const ce of _){if(!S(ce))continue;const me=this.#a.handle(ce.id);if(!me)continue;const Ce=E(ce,Z);if(Ce)if(H(Ce)){const Pe=new Array(ee.length);for(let xe=0;xe<ee.length;xe++)Pe[xe]=me.get(ee[xe]);ne[ce.id]=Ce(Pe,{row:W,column:ce,grid:this.#e.grid||null,context:this.#z("context",null),valueAt:(xe,_e)=>{const ve=this.#a.handle(xe);return ve&&_e>=0&&_e<ee.length?ve.get(ee[_e]):null}})}else H(ie)&&(ne[ce.id]=ie(me,ee,Ce))}return ne}#mt(_){if(!_)return _;const ee=this.#e.config||{},W={tz:ee.timeZone,weekStartsOn:ee.weekStartsOn};return p(_,Z=>{const ne=y(Z,W),ie=this.#De(ne&&ne.col),ce=ie&&ie.type==="datetime";if(ne&&ne.type)return ne.type==="datetime"&&!ne.timeZone&&ie?{...ne,timeZone:ee.timeZone||void 0}:ne;if(ce)return{...ne,type:"datetime",timeZone:ee.timeZone||void 0};const me=ie&&(ie.dataType?.base||ie.type);return me?{...ne,type:me}:ne})}#gt(_,ee){const W=this.#z("expanded",null);return W?H(W.has)?W.has(_,ee):Array.prototype.includes.call(W,_):!0}#z(_,ee){if(_==="context"||!H(this.#e.stateVersion))return this.#Ot(_,ee);const W=this.#_t(_),Z=this.#f.get(_);if(Z&&Z.version===W)return Z.value;const ne=this.#Ot(_,ee);return this.#f.set(_,{version:W,value:ne}),ne}#Ot(_,ee){const W=this.#e.state;if(W&&H(W[_])){const Z=W[_]();return Z??ee}return ee}#St(){const _=this.#e.stateVersion;return H(_)?_():0}#ut(){const _=this.#e.columnsVersion,ee=this.#e.permissionsVersion;return`${H(_)?_():0}|${H(ee)?ee():0}`}#_t(_){return _==="totals"?this.#ut():`${this.#St()}`}#st(_,ee,W){if(!H(this.#e.stateVersion))return W();const Z=this.#d.get(_);if(Z&&Z.version===ee)return Z.key;const ne=W();return this.#d.set(_,{version:ee,key:ne}),ne}#ft(_){const ee=(this.#e.compute||{})[_];return H(ee)||L(`ctx.compute.${_} is required by the memory source pipeline`),ee}#At(){const _=this.#e.columns;return _&&H(_.all)?_.all():[]}#De(_){const ee=this.#e.columns;return ee&&H(ee.get)?ee.get(_):void 0}#bt(_,ee){const W=this.#e.emit;H(W)&&W(_,ee)}}}),Ve("packages/core/src/source/abort.js",function(e,D){"use strict";Object.defineProperty(e,"SupersededError",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"RequestToken",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"AbortScope",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"createAbortScope",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return L}});class re extends Error{constructor(H,$="superseded"){super(`[lattice] request ${H?`"${H}" `:""}${$}`),this.name="SupersededError",this.superseded=!0,this.key=H}}class A{#e;constructor(H,$,X,F){this.#e=H,this.key=$,this.controller=X,this.signal=X.signal,this.seq=F}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(H){this.signal.aborted||this.controller.abort(new re(this.key,H)),this.#e.settle(this)}}class Y{#e=new Map;#t=0;begin(H="",$="superseded"){const X=this.#e.get(H);X&&!X.signal.aborted&&X.controller.abort(new re(H,$));const F=new A(this,H,new AbortController,++this.#t);return this.#e.set(H,F),F}tokenFor(H){return this.#e.get(H)}pending(H=""){const $=this.#e.get(H);return!!$&&!$.signal.aborted}get size(){return this.#e.size}settle(H){this.#e.get(H.key)===H&&this.#e.delete(H.key)}abort(H="",$="superseded"){const X=this.#e.get(H);X&&X.abort($)}abortAll(H="superseded"){for(const $ of[...this.#e.values()])$.abort(H);this.#e.clear()}}function I(){return new Y}function L(Q){if(!Q||typeof Q!="object")return!1;const H=Q;return H.superseded===!0||H.name==="AbortError"||H.name==="SupersededError"}}),Ve("packages/core/src/source/blockcache.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_PAGE_SIZE",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"DEFAULT_MAX_CACHED_PAGES",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"BlockCache",{enumerable:!0,get:function(){return I}});const re=100,A=32;class Y{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;#s=-1;constructor(Q={}){this.#t=Math.max(1,Math.floor(Number(Q.pageSize)||re)),this.#n=Math.max(1,Math.floor(Number(Q.maxCachedPages)||A))}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 H=this.#e.get(Q);return!!H&&H.state==="pending"}loaded(Q){const H=this.#e.get(Q);return!!H&&H.state==="loaded"}begin(Q,H){let $=this.#e.get(Q);return $||($=new Y(Q)),$.state="pending",$.token=H,$.error=null,this.#i(Q,$),$}fill(Q,H){const $=this.#e.get(Q)||new Y(Q);$.rows=H,$.state="loaded",$.token=null,this.#i(Q,$)}failed(Q,H){const $=this.#e.get(Q)||new Y(Q);$.state="error",$.error=H,$.token=null,this.#i(Q,$)}delete(Q){return this.#e.delete(Q)}rowAt(Q){const H=this.blockOf(Q),$=this.#e.get(H);if(!(!$||$.state!=="loaded"||!$.rows))return this.#i(H,$),$.rows[Q-H*this.#t]}rowLoaded(Q){const H=this.blockOf(Q),$=this.#e.get(H);return!!$&&$.state==="loaded"&&!!$.rows&&Q-H*this.#t<$.rows.length}erroredAt(Q){const H=this.#e.get(this.blockOf(Q));return!!H&&H.state==="error"}loadedExtent(){let Q=0;for(const H of this.#e.values()){if(H.state!=="loaded"||!H.rows)continue;const $=H.id*this.#t+H.rows.length;$>Q&&(Q=$)}return Q}fillOf(Q){const H=this.#e.get(Q);return H&&H.state==="loaded"&&H.rows?H.rows.length:null}protect(Q,H){this.#r=this.blockOf(Math.max(0,Q)),this.#s=this.blockOf(Math.max(0,H))}evict(){const Q=[];if(this.#e.size<=this.#n)return Q;for(const[H,$]of this.#e){if(this.#e.size-Q.length<=this.#n)break;H>=this.#r&&H<=this.#s||$.state!=="pending"&&Q.push(H)}for(const H of Q)this.#e.delete(H);return Q}ids(){return[...this.#e.keys()]}clear(){this.#e.clear()}#i(Q,H){this.#e.delete(Q),this.#e.set(Q,H)}}}),Ve("packages/core/src/source/pagewindow.js",function(e,D){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return re}});function re(A,Y,I,L){const Q=Math.floor(Number(A)||0);if(Q<=0)return null;const H=Math.max(0,Math.floor(Number(Y)||0)),$=Math.max(0,Math.floor(Number(I)||0));if(L){const X=Math.max(1,Math.ceil($/Q)),F=Math.min(H,X-1),j=F*Q;return{page:F,pageSize:Q,offset:j,length:Math.max(0,Math.min(Q,$-j)),pageCount:X,total:$}}return{page:H,pageSize:Q,offset:H*Q,length:Q,pageCount:Math.max(H+2,Math.ceil($/Q)),total:null}}}),Ve("packages/core/src/source/paged.js",function(e,D){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"PagedSource",{enumerable:!0,get:function(){return h}});const A=D("packages/core/src/internal/lru.js").Lru,I=D("packages/core/src/internal/predicates.js").isFunction,Q=D("packages/core/src/internal/warn.js").warnOnce,$=D("packages/core/src/internal/schedule.js").settleDebounce,X=D("packages/core/src/source/abort.js"),F=X.createAbortScope,j=X.isAbortError,v=D("packages/core/src/source/blockcache.js"),b=v.BlockCache,l=v.DEFAULT_PAGE_SIZE,g=v.DEFAULT_MAX_CACHED_PAGES,t=D("packages/core/src/source/rows.js").createRowFactory,s=D("packages/core/src/source/filterwire.js"),r=s.wireFilters,i=s.querySignature,n=s.warnHostFilterNotApplied,c=D("packages/core/src/source/pagewindow.js").pageWindow,a=120;function u(p,y){return new h(p,y)}class h{mode="paged";#e;#t;#n;#r=F();#s;#i;#a=new Map;#l=null;#o=null;#c=!1;#u=0;#f="";#d={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(y,d){this.#e=y||{mode:"paged"},this.#t=d||{},this.#n=new b({pageSize:this.#e.pageSize||l,maxCachedPages:this.#e.maxCachedPages||g}),this.#s=t(this.#t),this.#i=new A(this.#n.pageSize*4),this.#h=$((f,w)=>this.#w(f,w),a),this.#f=this.#P(),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.#C(),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 d=this.#b();return{page:0,pageSize:0,total:this.exact()?d: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(),d=c(this.#T("pageSize",0),this.#T("page",0),y,this.exact());if(!d)return this.#g="",null;const f=`${this.#m}:${d.offset}:${d.length}`;if(f!==this.#g&&!this.#p&&(this.#g=f,d.length>0)){const w=d.offset+d.length-1;this.#d={start:d.offset,end:w},this.#w(d.offset,w)}return d}at(y){const d=this.#y();if(d){if(y<0||y>=d.length)return;const f=this.#O(d.offset+y);return f&&(f.index=y),f}return this.#O(y)}#O(y){if(y<0||y>=this.#b())return;const d=this.#i.get(y);if(d&&(d.data!==null||!this.#n.rowLoaded(y)))return d;const f=this.#n.rowAt(y);if(f===void 0){const k=this.#s.skeleton(y,0,this.#n.erroredAt(y));return this.#i.set(y,k),k}const w=this.#s.leaf(f,y);return w.index=y,this.#i.set(y,w),this.#a.set(w.key,y),w}byKey(y){const d=this.#a.get(y);return d===void 0?void 0:this.#O(d)}loaded(y){const d=this.#y();return d?y>=0&&y<d.length&&this.#n.rowLoaded(d.offset+y):this.#n.rowLoaded(y)}loadedCount(){this.#C();let y=0;for(const d of this.#n.ids()){if(!this.#n.loaded(d))continue;const f=this.#n.fillOf(d);typeof f=="number"&&(y+=f)}return y}residentRows(){this.#C();const y=this.#y(),d=y?y.offset:0,f=y?y.offset+y.length:1/0,w=[],k=this.#n.ids().sort((P,G)=>P-G);for(const P of k){if(!this.#n.loaded(P))continue;const{start:G}=this.#n.rangeOf(P),K=this.#n.fillOf(P)||0;for(let q=G;q<G+K;q++){if(q<d||q>=f)continue;const B=this.#i.peek(q);if(B&&B.data!==null&&B.data!==void 0){w.push(B);continue}const E=this.#n.rowAt(q);if(E===void 0)continue;const S=this.#s.leaf(E,q);S.index=q,this.#i.set(q,S),this.#a.set(S.key,q),w.push(S)}}return w}hint(y,d){if(this.#p)return;const f=this.#C();let w=Math.max(0,Math.floor(y)),k=Math.max(w,Math.floor(d));const P=this.#y();if(P){if(P.length===0)return;w=P.offset,k=P.offset+P.length-1}this.#d={start:w,end:k},this.#n.protect(w,k);for(const G of this.#n.evict())this.#v(G);this.#h(w,k),f&&this.#h.flush()}#w(y,d){if(this.#p)return;this.#n.protect(y,d);const f=this.#n.blockOf(y),w=this.#n.blockOf(d);for(let k=f;k<=w&&!(this.#l!==null&&k*this.#n.pageSize>=this.#l);k++)this.#n.has(k)||this.#A(k)}apply(y){const d={added:[],updated:[],removed:[]};if(!y)return d;if(y.update)for(const f of y.update){const w=this.#s.keyOf(f,-1),k=this.#a.get(w);if(k===void 0)continue;const P=this.#s.leaf(f,k);P.index=k,this.#i.set(k,P),d.updated.push(P)}return(y.add&&y.add.length||y.remove&&y.remove.length)&&this.reload(),d}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.#i.clear(),this.#a.clear()}exact(){return this.#l!==null||this.#c}pending(){return this.#r.size}async#A(y){if(!I(this.#e.fetch))return;const d=this.#r.begin(`block:${y}`);this.#n.begin(y,d);const{start:f,end:w}=this.#n.rangeOf(y),k=this.#f;try{const P=await this.#e.fetch({range:{start:f,end:w},sort:this.#T("sort",[]),filters:r(this.#T("filters",null),this.#E()),quick:this.#T("quick","")||void 0,context:this.#T("context",null),signal:d.signal});if(!d.current||k!==this.#f||this.#p)return;d.settle();const G=P&&P.rows||[];this.#n.fill(y,G);for(let q=0;q<G.length;q++)this.#i.delete(f+q);const K=P&&typeof P.total=="number"?P.total:P&&typeof P.count=="number"?P.count:null;K!==null?(this.#l=K,this.#c=!0):G.length<this.#n.pageSize?(this.#c=!0,this.#l=f+G.length):this.#u=Math.max(this.#u,f+G.length),this.#M("model:changed",{reason:"page",block:y,from:f,to:f+G.length}),this.#M("rows:changed",{companion:!0,reason:"page",block:y,from:f,to:f+G.length}),this.#l!==null&&this.#l!==this.#o&&(this.#o=this.#l,this.#M("source:total",{total:this.#l,groupPath:[]}))}catch(P){if(d.settle(),j(P))return;this.#n.failed(y,P);for(let G=f;G<w;G++)this.#i.delete(G);this.#M("model:changed",{reason:"page-error",block:y,range:{start:f,end:w}}),this.#M("source:error",{error:P,block:y,range:{start:f,end:w}})}}#v(y){const{start:d,end:f}=this.#n.rangeOf(y);for(let w=d;w<f;w++){const k=this.#i.peek(w);k&&this.#a.delete(k.key),this.#i.delete(w)}}#C(){const y=this.#P();return y===this.#f?!1:(this.#f=y,this.#S("query"),!0)}#S(y){this.#r.abortAll(y),this.#n.clear(),this.#i.clear(),this.#a.clear(),this.#l=null,this.#o=null,this.#c=!1,this.#u=0,this.#m++,this.#M("model:changed",{reason:y})}#P(){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,d){const f=this.#t.state;if(f&&I(f[y])){const w=f[y]();return w??d}return d}#M(y,d){const f=this.#t.emit;I(f)&&f(y,d)}}}),Ve("packages/core/src/source/aggregates.js",function(e,D){"use strict";Object.defineProperty(e,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"pushableAggregates",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"fillAggregateSql",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"aggregateP",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"routeAggregate",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"resolveAggregatePlan",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"groupKeysPushable",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"pushdownDocRows",{enumerable:!0,get:function(){return F}});const re=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 A(){const j=new Set;for(const[v,b]of Object.entries(re))b.pushable&&j.add(v);return j}function Y(j,v,b,l="?"){let g=j.split("%c").join(v);return b!==void 0&&(g=g.split("%w").join(b)),g.split("%p").join(l)}function I(j){const v=j&&(j.p!==void 0?j.p:j.params&&j.params.p);return typeof v=="number"&&v>=0&&v<=1?v:void 0}function L(j){const v=j||{},b=v.default==="engine"||v.default==="engine-if-identical"?v.default:"client",l={};if(v.overrides&&typeof v.overrides=="object")for(const[g,o]of Object.entries(v.overrides))(o==="engine"||o==="client")&&(l[g]=o);return{default:b,overrides:l}}function Q(j,v){const b=re[j];if(!b||!b.pushable)return"client";const l=v.overrides[j];return l==="engine"||l==="client"?l:v.default==="client"?"client":v.default==="engine-if-identical"?b.class==="identical"?"engine":"client":"engine"}function H(j,v){const b=L(v),l=[],g=[];for(const o of j||[]){const t=re[o.fn],s=Q(o.fn,b),r={id:o.id,col:o.col,fn:o.fn,class:t?t.class:"fallback"};if(o.weight!==void 0&&(r.weight=o.weight),o.params!==void 0&&(r.params=o.params),t&&t.parametric){const i=I(o);i!==void 0&&(r.p=i)}if(s==="engine"&&t&&t.parametric&&r.p===void 0){g.push({...r,reason:`"${o.fn}" needs \`p\`, a number from 0 to 1`});continue}s==="engine"?l.push(r):(r.reason=t&&!t.pushable?t.note||"the engine cannot express this stat":"client by config",g.push(r))}return{engine:l,client:g,config:b}}const $=/^[A-Za-z_][A-Za-z0-9_$]*$/;function X(j,v=[]){return(j||[]).every(l=>{if(typeof l=="string")return $.test(l);if(!l||typeof l!="object")return!1;const g=l;return Array.isArray(v)&&v.includes(g.bucket)&&typeof g.col=="string"&&$.test(g.col)&&typeof g.size=="number"&&Number.isFinite(g.size)&&g.size>0})}function F(){return Object.entries(re).map(([j,v])=>({stat:j,class:v.class,sql:v.sql?Y(v.sql,"col",v.twoColumn?"weight":void 0):"",note:v.note||(v.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),Ve("packages/core/src/source/pushdown.js",function(e,D){"use strict";Object.defineProperty(e,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"NO_CAPABILITIES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"capabilitiesOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"splitFilters",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"applyResidual",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"createPushdownSource",{enumerable:!0,get:function(){return W}});const A=D("packages/core/src/internal/compare.js").defaultCompare,I=D("packages/core/src/internal/predicates.js").isFunction,Q=D("packages/core/src/internal/merge.js").toArray,$=D("packages/core/src/internal/warn.js").warnOnce,X=D("packages/core/src/source/filterwire.js"),F=X.isGroup,j=X.warnWherePageRelative,v=X.warnWhereOverThreshold,b=X.wireFilters,l=D("packages/core/src/source/aggregates.js"),g=l.resolveAggregatePlan,o=l.groupKeysPushable,t=l.STAT_PUSHDOWN,s=l.aggregateP,r=l.fillAggregateSql,n=D("packages/core/src/source/abort.js").SupersededError,m=1e3;function c(Z){const ne=Z&&Z.signal;if(!ne||!ne.aborted)return;const ie=ne.reason;throw ie instanceof Error?ie:new n("","superseded before it was sent")}const a=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function u(Z){if(!Z||typeof Z!="object")return!1;const ne=Z.returning==="row"||Z.returning==="key"?Z.returning:"none";return{append:Z.append===!0,update:Z.update===!0,delete:Z.delete===!0,returning:ne}}function h(Z,ne){if(!Z||typeof ne!="string")return;if(!ne.includes("."))return Z[ne];let ie=Z;for(const ce of ne.split(".")){if(ie===null||typeof ie!="object")return;ie=ie[ce]}return ie}function p(Z){if(Z===!0)return!0;if(!Z||typeof Z!="object")return!1;const ne=Z;return ne.enabled===!1?!1:ne.enabled===!0||I(ne.commit)}function y(Z){const ne={...a,...Z||{}};return ne.operators=new Set(ne.operators||[]),ne.mutate=u(ne.mutate),ne}function d(Z,ne){return!Z||!Z.op||!ne.operators.size?!1:ne.operators.has(Z.op)}function f(Z,ne){if(!Z)return{pushed:null,residual:null};if(!ne.filter)return{pushed:null,residual:Z};if(ne.filter==="term"){if(F(Z)){const Ce=Z.conditions||[];if(String(Z.op)!=="and")return{pushed:null,residual:Z};const Pe=Ce.findIndex(_e=>!F(_e)&&d(_e,ne));if(Pe<0)return{pushed:null,residual:Z};const xe=Ce.filter((_e,ve)=>ve!==Pe);return{pushed:Ce[Pe],residual:xe.length?{op:"and",conditions:xe}:null}}return d(Z,ne)?{pushed:Z,residual:null}:{pushed:null,residual:Z}}if(!F(Z))return d(Z,ne)?{pushed:Z,residual:null}:{pushed:null,residual:Z};if(String(Z.op)!=="and")return(Z.conditions||[]).every(Pe=>F(Pe)?f(Pe,ne).residual===null:d(Pe,ne))?{pushed:Z,residual:null}:{pushed:null,residual:Z};const ie=[],ce=[];for(const Ce of Z.conditions||[]){if(F(Ce)){if(ne.filter==="flat"){ce.push(Ce);continue}const Pe=f(Ce,ne);Pe.pushed&&ie.push(Pe.pushed),Pe.residual&&ce.push(Pe.residual);continue}(d(Ce,ne)?ie:ce).push(Ce)}const me=Ce=>Ce.length===0?null:Ce.length===1?Ce[0]:{op:"and",conditions:Ce};return{pushed:me(ie),residual:me(ce)}}const w="__lattice_leaves";function k(Z){return Z.aggregates?Z.aggregates instanceof Set?Z.aggregates:new Set(Q(Z.aggregates)):new Set}function P(Z){const ne=k(Z);return ne.size?ne.has("count")?Z.filter!=="tree"||!Z.operators||!Z.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(Z,ne,ie,ce,me,Ce,Pe){const xe=Array.isArray(Z.groupBy)?Z.groupBy:[],_e=Array.isArray(Z.groupPath)?Z.groupPath:[],ve=Array.isArray(Z.groupValues)?Z.groupValues:null;if(!ne.group){const oe=P(ne);if(oe)return oe}return o(xe)?ie.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":ce?me?Ce&&!Ce.conditioned?"a host `where` predicate can only run in the browser, over rows the engine grouped":Pe?"fullDataset holds the whole matching set, so the grid groups it itself":!ve||ve.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 K="pushdown:pivot-unsupported",q="pushdown:group-unsupported",B=Symbol("lattice.remote.ungroupedLevel");function E(Z,ne,ie,ce,me,Ce){const Pe=Array.isArray(Z.pivotBy)?Z.pivotBy:[],xe=Array.isArray(Z.groupBy)?Z.groupBy:[],_e=Array.isArray(Z.groupPath)?Z.groupPath:[],ve=Array.isArray(Z.groupValues)?Z.groupValues:null;return ne.pivot?o(Pe)?xe.length&&!o(xe)?"a grouping key is not a plain column the engine can name in a GROUP BY":ie.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":ce?me?Ce&&!Ce.conditioned?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!ve||ve.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 S(Z,ne,ie=!1){const ce=f(Z.filters||null,ne),me=[];ce.residual&&me.push("filter");const Ce=Z.sort||[],Pe=Ce.length===0||ne.sort==="multi"&&Ce.length>=1||ne.sort==="single"&&Ce.length===1;!Pe&&Ce.length&&me.push("sort");const xe=Z.quick?String(Z.quick):"",_e=!xe||!!ne.quick;_e||me.push("quick");const ve=Z.where&&Z.where.active?Z.where:null;ve&&me.push("where");const oe={filters:ce.residual,sort:Pe?null:Ce,quick:_e?"":xe,where:ve},he=!!ie,ae=Array.isArray(Z.groupBy)&&Z.groupBy.length>0,se=ae?G(Z,ne,ce,Pe,_e,ve,he):"",de=Z.pivotMode!==!1&&Array.isArray(Z.pivotBy)&&Z.pivotBy.length>0,ke=de?E(Z,ne,ce,Pe,_e,ve):"",Ae=de&&ke==="";de&&!Ae&&me.push("pivot");const Te=de?Ae&&ae:ae&&se==="";ae&&!de&&!Te&&me.push("group");const je=(Te||Ae)&&Array.isArray(Z.groupValues)?Z.groupValues.length:0;ve&&ve.conditioned&&(Te||Ae)&&(oe.where=null,me.splice(me.indexOf("where"),1));const ye=Te||de?!1:he||!!(oe.filters||oe.sort||oe.quick||oe.where)||!ne.range;return{pushed:{...Z,filters:ce.pushed,sort:Pe?Ce:[],quick:_e?xe:"",range:ye?null:Z.range},residual:oe,needsAll:ye,unpushed:me,full:he,grouped:Te,groupLevel:je,groupReason:de?"":se,pivoted:Ae,pivotReason:ke}}function C(Z){const ne=Array.isArray(Z.totals)?Z.totals:[],ie=Z.totalFns&&typeof Z.totalFns=="object"?Z.totalFns:{},ce=[],me=[];for(const Ce of ne){const Pe=String(Ce),xe=ie[Pe],_e=typeof xe=="string"?xe:xe&&typeof xe.fn=="string"?xe.fn:null,ve=xe&&typeof xe=="object"?s(xe):void 0,oe=_e?t[_e]:null;oe&&oe.parametric&&ve===void 0?me.push({id:Pe,fn:_e,class:oe.class,reason:`"${_e}" needs \`p\`, a number from 0 to 1`}):_e?!oe||!oe.pushable||!oe.sql?me.push({id:Pe,fn:_e,class:oe?oe.class:"fallback",reason:oe&&oe.note?oe.note:`the pushdown map cannot express "${_e}"`}):oe.twoColumn?me.push({id:Pe,fn:_e,class:oe.class,reason:`"${_e}" reduces two columns, and a grouped request carries no weight column`}):ce.push({id:Pe,col:Pe,fn:_e,class:oe.class,...ve!==void 0?{p:ve}:{}}):me.push({id:Pe,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:ce,client:me}}function N(Z){return{...Z,engine:Z.engine.map(ne=>{const ie=t[ne.fn];if(!ie||!ie.sql)return ne;const ce=me=>`"${me}"`;return{...ne,sql:r(ie.sql,ce(ne.col),ne.weight!==void 0?ce(ne.weight):void 0)}})}}const O=Object.freeze({items:Z=>Z==null?[]:Array.isArray(Z)?Z:[Z]});function T(Z,ne,ie){if(!ne)return Z;let ce=Z;if(ne.filters&&I(ie.evaluateFilters)){const me=ce,Ce={count:ce.length,handle:_e=>({id:_e,get:ve=>h(me[ve],_e)}),itemwise:_e=>me.some(ve=>Array.isArray(h(ve,_e)))?O:null},Pe=ie.evaluateFilters(ne.filters,Ce),xe=[];for(let _e=0;_e<ce.length;_e++)Pe[_e]&&xe.push(ce[_e]);ce=xe}if(ne.where&&ne.where.active&&(ne.whole||j(ne.where.names,"pushdown"),ce=ce.filter(me=>ne.where.passes(me))),ne.quick){const me=ne.quick.toLowerCase();ce=ce.filter(Ce=>{if(!Ce||typeof Ce!="object")return!1;for(const Pe of Object.values(Ce))if(Pe!=null&&String(Pe).toLowerCase().includes(me))return!0;return!1})}if(ne.sort&&ne.sort.length&&I(ie.sortMulti)){const me=[...new Set(ne.sort.map(_e=>_e.col))],Ce=ce,Pe=me.map(_e=>({id:_e,get:ve=>h(Ce[ve],_e)})),xe=ie.sortMulti(Pe,ne.sort.map(_e=>({col:_e.col,dir:_e.dir})),Uint32Array.from({length:ce.length},(_e,ve)=>ve),{});ce=Array.from(xe,_e=>Ce[_e])}return ce}function R(Z){return JSON.stringify({filters:Z.filters||null,sort:Z.sort||[],quick:Z.quick||"",groupBy:Z.groupBy||[],groupPath:Z.groupPath||[],context:Z.context??null})}function x(Z){if(!Z||typeof Z!="object")return 16;let ne="";try{ne=JSON.stringify(Z)}catch{return 200}return ne.length*2+64}function U(Z){const ne=Z||{};return{enabled:!!ne.enabled,maxRows:Number.isFinite(ne.maxRows)?ne.maxRows:1e6,maxBytesEstimate:Number.isFinite(ne.maxBytesEstimate)?ne.maxBytesEstimate:512*1024*1024}}const V=5e4;function J(Z){return Number.isFinite(Z)&&Z>=0?Z:V}function _(Z){return!!Z&&I(Z.then)}async function ee(Z){if(!Z||Z.total!==void 0||!_(Z.pendingTotal))return Z;const ne=await Z.pendingTotal,{pendingTotal:ie,...ce}=Z;return typeof ne=="number"?{...ce,total:ne}:ce}function W(Z={}){const ne=Z.adapter;if(!ne||!I(ne.execute))return $("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...Z,mode:"remote",fetch:async()=>({rows:[],total:0})};const ie=y(ne.capabilities),ce=ne.capabilities&&Object.getOwnPropertyDescriptor(ne.capabilities,"operators");ce&&I(ce.get)&&Object.defineProperty(ie,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(ne.capabilities.operators||[]),set:()=>{}});const me=ne.name||"adapter";let Ce=null;const Pe=()=>I(ne.ready)?(Ce||(Ce=Promise.resolve(ne.ready()).then(()=>{Object.assign(ie,y(ne.capabilities))},ue=>{throw Ce=null,ue})),Ce):null,xe=U(Z.fullDataset),_e=!!Z.allowPartialResults,ve=J(Z.whereRowLimit);let oe=null;const he=Z.aggregates;let ae=null,se=null,de=null,ke=null,Ae=null,Te=null,je=0,ye=null;const He=()=>!xe.enabled||!ae?null:(ye!==ae.key&&(je++,ye=ae.key),{rows:ae.rows,version:je}),Me=async ue=>{const pe=ue.where&&ue.where.active?ue.where:null;if(!pe)return{request:ue,probe:null};if(pe.conditioned){const rt=S(ue,ie,xe.enabled);if(rt.grouped||rt.pivoted)return{request:ue,probe:null}}const{where:Se,...Ne}=ue,De=S(Ne,ie,xe.enabled);if(De.needsAll)return{request:ue,probe:null};const Ue=R(De.pushed);let qe=null;return(!oe||oe.key!==Ue)&&(ie.total?(c(ue),qe=await ee(await ne.execute(De.pushed,ue)),oe={key:Ue,size:qe&&typeof qe.total=="number"?qe.total:null}):oe={key:Ue,size:null}),oe.size!==null&&oe.size<ve?{request:ue,probe:null}:(v(pe.names,me,oe.size,ve),{request:Ne,probe:qe})},Re=async(ue,pe)=>{Te=null;const Se=C(ue.pushed);de={engine:Se.engine,client:Se.client,groupBy:ue.pushed.groupBy},Se.client.length&&$(`source.pushdown.group.totals.${me}.${Se.client.map(Ue=>Ue.id).join(".")}`,`the ${me} adapter cannot compute the group subtotal for ${Se.client.map(Ue=>`"${Ue.id}" (${Ue.reason})`).join(", ")}, so those group rows carry no value for that column. A figure computed over anything other than the group would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const Ne=await ne.executeGroupLevel(ue.pushed,Se.engine,pe)||{};let De=Ne.rows||[];return!ie.range&&pe.range&&(De=De.slice(pe.range.start,pe.range.end)),We(Ne),Ne.total===void 0?{rows:De}:{rows:De,total:Ne.total}},Ee=new Map,$e=64,Ie=async(ue,pe)=>{Te=null;const Se=ue.pushed,Ne=Se.groupBy,De=Array.isArray(Se.groupValues)?Se.groupValues:[],Ue=De.length,qe=[...Se.filters?[Se.filters]:[],...Ne.slice(0,Ue).map((lt,mt)=>({col:lt,op:"eq",value:De[mt]===void 0?null:De[mt],caseSensitive:!0}))],rt=qe.length===0?null:qe.length===1?qe[0]:{op:"and",conditions:qe},ut=pe.range?pe.range.start:0;if(Ue>=Ne.length){const lt={...Se,filters:rt,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},mt=await ee(await ne.execute(lt,pe))||{};let xt=mt.rows||[];return!ie.range&&pe.range&&(xt=xt.slice(pe.range.start,pe.range.end)),typeof mt.total=="number"?{rows:xt,total:mt.total}:{rows:xt}}const at=Ne[Ue],kt=C(Se),Rt=k(ie),At=kt.engine.filter(lt=>Rt.has(lt.fn)),_t=[...kt.engine.filter(lt=>!Rt.has(lt.fn)).map(lt=>({id:lt.id,fn:lt.fn,class:lt.class,reason:`the ${me} adapter does not compute "${lt.fn}"`})),...kt.client];de={engine:At,client:_t,groupBy:Ne},_t.length&&$(`source.pushdown.group.totals.${me}.${_t.map(lt=>lt.id).join(".")}`,`the ${me} adapter cannot compute the group subtotal for ${_t.map(lt=>`"${lt.id}" (${lt.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 tn=[...At.map(lt=>({id:lt.id,col:lt.col,fn:lt.fn,...lt.p!==void 0?{p:lt.p}:{}})),{id:w,col:at,fn:"count"}],Ht={...Se,filters:rt,range:null},Xt=JSON.stringify([R(Ht),De,at,tn]);let Ze=ut>0?Ee.get(Xt):void 0;if(!Ze){for(Ze=Promise.resolve(ne.executeGroupedAggregates(Ht,[at],tn)),Ee.delete(Xt),Ee.set(Xt,Ze);Ee.size>$e;)Ee.delete(Ee.keys().next().value);Ze.catch(()=>{Ee.get(Xt)===Ze&&Ee.delete(Xt)})}const ct=await Ze||[];c(pe);const Ot=lt=>{const mt={};for(const xt of At)mt[xt.id]=lt?lt[xt.id]:void 0;return mt},bt=(Se.sort||[]).find(lt=>lt&<.col===at),wt=bt&&bt.dir==="desc"?-1:1,Ke=ct.filter(lt=>lt&<.level===1).map(lt=>({[at]:lt.keys[0]===void 0?null:lt.keys[0],leafCount:Number(lt.values&<.values[w])||0,totals:Ot(lt.values)})).sort((lt,mt)=>wt*A(lt[at],mt[at]));if(Ue===0){const lt=ct.find(xt=>xt&&xt.level===0),mt=lt?Number(lt.values&<.values[w]):NaN;We({matchCount:Number.isFinite(mt)?mt:Ke.reduce((xt,Ft)=>xt+Ft.leafCount,0),...lt?{grand:Ot(lt.values)}:{}})}const ht=pe.range?pe.range.end:Ke.length;return{rows:Ke.slice(ut,ht),total:Ke.length}},We=ue=>{typeof ue.matchCount=="number"&&(ke=ue.matchCount,Ae=ue.grand?{totals:ue.grand,leafCount:ue.matchCount}:null)},Ye=async(ue,pe)=>{Te=null;const Se=C(ue.pushed);de={engine:Se.engine,client:Se.client,groupBy:ue.pushed.groupBy,pivotBy:ue.pushed.pivotBy},Se.client.length&&$(`source.pushdown.pivot.totals.${me}.${Se.client.map(rt=>rt.id).join(".")}`,`the ${me} adapter cannot compute the pivot cells for ${Se.client.map(rt=>`"${rt.id}" (${rt.reason})`).join(", ")}, so those cells are empty. A figure computed over anything other than the cell would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const Ne=await ne.executePivotLevel(ue.pushed,Se.engine,pe)||{};let De=Ne.rows||[];!ie.range&&pe.range&&(De=De.slice(pe.range.start,pe.range.end)),We(Ne);const Ue=Ne.pivot&&typeof Ne.pivot=="object"?Ne.pivot:{},qe={cells:Array.isArray(Ue.cells)?Ue.cells:[],...Array.isArray(Ue.axis)?{axis:Ue.axis}:{}};return Ne.total===void 0?{rows:De,pivot:qe}:{rows:De,total:Ne.total,pivot:qe}},nt=ue=>{$(`source.pushdown.pivot.${me}.${ue}`,`pushdown:pivot-unsupported: the ${me} adapter cannot pivot this query because ${ue}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const pe=new Error(`[lattice] ${K}: the ${me} adapter cannot pivot this query because ${ue}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw pe.code=K,pe.reason=ue,pe},Qe=(ue,pe)=>{const Se={key:pe,state:"pending",value:null};return Te=Se,ue.then(Ne=>(Te===Se&&(Te={key:pe,state:"settled",value:typeof Ne=="number"?Ne:null}),Ne),Ne=>{throw Te===Se&&(Te={key:pe,state:"failed",value:null}),Ne})};let dt=0,jt=[];const Et=()=>dt===0?null:new Promise(ue=>{const pe=setTimeout(ue,m);jt.push(()=>{clearTimeout(pe),ue()})});let it;const ft=async ue=>{const pe=Pe();pe&&await pe;const Ne=ue&&ue.pivotMode!==!1&&Array.isArray(ue.pivotBy)&&ue.pivotBy.length>0?{request:ue,probe:null}:await Me(ue);c(ue);let De=S(Ne.request,ie,xe.enabled);if(ie.group&&De.grouped&&!De.pivoted&&!I(ne.executeGroupLevel)&&($(`source.pushdown.group.method.${me}`,`the ${me} 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.`),De=S(Ne.request,{...ie,group:!1,aggregates:null},xe.enabled)),De.pivoted&&!I(ne.executePivotLevel)&&(De=S(Ne.request,{...ie,pivot:!1},xe.enabled),De.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),De.grouped&&!De.pivoted&&!ie.group&&!I(ne.executeGroupedAggregates)&&($(`source.pushdown.group.aggregates.method.${me}`,`the ${me} 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\`.`),De=S(Ne.request,{...ie,aggregates:null},xe.enabled)),se=De,De.pivoted)return Ye(De,ue);if(De.pivotReason&&nt(De.pivotReason),De.grouped)return ie.group?Re(De,ue):Ie(De,ue);const qe=!!De.groupReason&&!De.full;qe?$(`source.pushdown.group-unsupported.${me}.${De.groupReason}`,`pushdown:group-unsupported: the ${me} adapter was not asked to group this query because ${De.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.`):De.groupReason&&$(`source.pushdown.group.${me}.${De.groupReason}`,`the ${me} adapter was not asked to group this query because ${De.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 rt=Ht=>qe?{...Ht,[B]:!0}:Ht;if(!De.needsAll){const Ht=Ne.probe||await ne.execute(De.pushed,ue),Xt=Ht.rows||[];return _(Ht.pendingTotal)&&Ht.total===void 0?rt({rows:Xt,pendingTotal:Qe(Ht.pendingTotal,R(De.pushed))}):(Te=null,!ie.total&&Ht.total===void 0?rt({rows:Xt}):rt({rows:Xt,total:Ht.total??Xt.length}))}const ut=De.unpushed.filter(Ht=>!(Ht==="where"&&De.residual.where&&De.residual.where.anyConditioned));ut.length&&$(`source.pushdown.residual.${me}.${ut.join(".")}`,`the ${me} adapter cannot push ${ut.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 at=R(De.pushed);if(!ae||ae.key!==at){const Ht=await ee(await ne.execute(De.pushed,ue));Te=null;const Xt=Ht.rows||[];if(De.full){const Ze=typeof Ht.total=="number"?Math.max(Ht.total,Xt.length):Xt.length;if(Ze>xe.maxRows)throw new Error(`[lattice] fullDataset refused: the ${me} adapter's matching set is ${Ze.toLocaleString()} rows, past the configured maxRows of ${xe.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 ct=Xt.length*x(Xt[0]);if(ct>xe.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${me} adapter's matching set is an estimated ${Math.round(ct/(1024*1024)).toLocaleString()} MB across ${Xt.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(xe.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 Ht.total=="number"&&Xt.length<Ht.total){const Ze=!!(De.residual.filters||De.residual.quick||De.residual.sort&&De.residual.sort.length);if(Ze&&!_e)throw new Error(`[lattice] the ${me} adapter returned ${Xt.length} of ${Ht.total} matching rows when asked for the whole result, and the query has residual ${De.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.`);Ze?$(`source.pushdown.partial.residual.${me}`,`the ${me} adapter returned ${Xt.length} of ${Ht.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.`):$(`source.pushdown.partial.${me}`,`the ${me} adapter returned ${Xt.length} of ${Ht.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}ae={key:at,rows:Xt,total:typeof Ht.total=="number"?Ht.total:null}}let kt=De;if(De.residual.where){const Ht=ae.total??ae.rows.length;if(Ht>=ve){v(De.residual.where.names,me,Ht,ve);const{where:Xt,...Ze}=Ne.request;kt=S(Ze,ie,xe.enabled),se=kt}}const Rt=ae.total!==null&&ae.rows.length>=ae.total,At=T(ae.rows,{...kt.residual,whole:Rt},Z.compute||{}),_t=ue.range?ue.range.start:0,tn=ue.range?ue.range.end:At.length;return rt({rows:At.slice(_t,tn),total:At.length})},pt=async(ue,pe,Se)=>{const De=Se&&Se.waitForPage&&it&&I(it.pageForegroundIdle)?it.pageForegroundIdle():Et();De&&await De;const Ue=Pe();Ue&&await Ue;const qe=S(ue,ie,xe.enabled);se=qe;const rt=g(pe,Se&&Se.engine?{default:"engine"}:he),ut=Array.isArray(ue.groupBy)?ue.groupBy:[],at=ut.length>0,kt=!qe.residual.filters&&!qe.residual.quick,Rt=!at||o(ut,ie.buckets);let At=rt.engine,_t=rt.client;if(ie.aggregates&&At.length){const ct=ie.aggregates instanceof Set?ie.aggregates:new Set(Q(ie.aggregates)),Ot=At.filter(bt=>!ct.has(bt.fn));Ot.length&&(At=At.filter(bt=>ct.has(bt.fn)),_t=[...Ot.map(bt=>({...bt,reason:`the ${me} adapter does not compute "${bt.fn}"`})),..._t])}const tn=ct=>{_t=[...At.map(Ot=>({...Ot,reason:ct})),..._t],At=[]};let Ht="";if(At.length&&!kt){const ct=qe.residual.quick&&!qe.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)";tn(ct),at&&(Ht=ct)}else if(At.length&&!Rt){const ct="a grouping key the engine cannot form forces all-client (no mixed provenance)";tn(ct),Ht=ct}let Xt={},Ze;if(At.length&&(I(at?ne.executeGroupedAggregates:ne.executeAggregates)?at?Ze=await ne.executeGroupedAggregates(qe.pushed,ut,At)||[]:Xt=await ne.executeAggregates(qe.pushed,At)||{}:($(`source.pushdown.aggregates.${me}${at?".grouped":""}`,`the ${me} adapter cannot compute ${at?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),tn(`adapter cannot compute ${at?"grouped ":""}aggregates`),at&&(Ht=`the ${me} adapter cannot compute grouped aggregates`))),at){const ct=Ze!==void 0;ct!==qe.grouped&&(se={...qe,grouped:ct,groupReason:ct?"":Ht||qe.groupReason,unpushed:ct?qe.unpushed.filter(Ot=>Ot!=="group"):qe.unpushed.includes("group")?qe.unpushed:[...qe.unpushed,"group"]})}return de={engine:At,client:_t,...at?{groupBy:ut}:{}},{values:Xt,engine:At,client:_t,...Ze!==void 0?{groups:Ze}:{}}},Tt=async ue=>{dt++;try{return await ft(ue)}finally{if(dt--,dt===0&&jt.length){const pe=jt;jt=[];for(const Se of pe)Se()}}},Mt=p(Z.edit),Lt=Z.edit&&typeof Z.edit=="object"&&I(Z.edit.commit);let Je=Z.edit;if(Mt&&!Lt)if(ie.mutate&&ie.mutate.update){const ue=pe=>{if(!ie.mutate||!ie.mutate.update)throw new Error(`[lattice] the ${me} adapter cannot update rows (mutate.update is not declared), so this edit cannot be persisted. The cell is reverted rather than left looking saved.`);const Se={kind:"update",key:String(pe.key),patch:{[pe.colId]:pe.value}};return ne.mutate(Se,pe.request||{})};Je={...Z.edit===!0?{}:Z.edit,commit:ue}}else $(`source.pushdown.readonly.${me}`,`edit is enabled but the ${me} adapter declares mutate: ${ie.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=Mt&&ie.mutate&&(ie.mutate.append||ie.mutate.delete)?{append:ie.mutate.append===!0,remove:ie.mutate.delete===!0,returning:ie.mutate.returning,mutate:(ue,pe)=>ne.mutate(ue,pe||{})}:null,be=async ue=>{const pe=Pe();pe&&await pe;const{range:Se,signal:Ne,export:De,...Ue}=ue||{},qe={...Ue,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:S(qe,ie,xe.enabled),signal:Ne}};async function*Oe(ue,pe={}){const{plan:Se,signal:Ne}=await be(ue),De=Math.max(1,Math.floor(Number(pe.pageSize))||5e3),Ue={signal:Ne,stream:!0},qe=ue&&ue.range&&Number.isFinite(Number(ue.range.start))&&Number.isFinite(Number(ue.range.end))?{start:Math.max(0,Number(ue.range.start)),end:Math.max(0,Number(ue.range.end))}:null;if(!Se.needsAll){const at=qe?qe.start:0,kt=qe?qe.end:1/0;for(let Rt=at;Rt<kt;Rt+=De){c(Ue);const At=Math.min(Rt+De,kt),_t=await ne.execute({...Se.pushed,range:{start:Rt,end:At}},Ue);_t&&_(_t.pendingTotal)&&_t.pendingTotal.then(null,()=>{});const tn=_t&&_t.rows||[];if(tn.length&&(yield tn),tn.length<At-Rt)return}return}c(Ue);const rt=await ee(await ne.execute({...Se.pushed,range:void 0},Ue));let ut=T(rt&&rt.rows||[],{...Se.residual,whole:!0},Z.compute||{});qe&&(ut=ut.slice(qe.start,qe.end));for(let at=0;at<ut.length;at+=De)yield ut.slice(at,at+De)}const Le=async ue=>{const{plan:pe,signal:Se}=await be(ue);if(!pe.needsAll&&ie.total){c({signal:Se});const De=await ee(await ne.execute({...pe.pushed,range:{start:0,end:0}},{signal:Se}));if(De&&typeof De.total=="number")return De.total}let Ne=0;for await(const De of Oe({...ue,range:void 0}))Ne+=De.length;return Ne},Fe=async ue=>{await Pe();const pe=b(ue.filters||null,{tz:Z.timeZone,weekStartsOn:Z.weekStartsOn}),Se=ue.quick?String(ue.quick):"";return f(pe,ie).residual||Se&&!ie.quick?null:ne.facets({...ue,filters:pe,quick:Se})};return it={...Z,edit:Je,rowMutate:le,mode:"remote",fetch:Tt,foregroundIdle:Et,facetProvider:I(ne.facets)?Fe:void 0,aggregate:pt,countMatching:Le,streamMatching:Oe,capabilitiesOf:y,planQuery:S,wireFilters:b,resolveAggregatePlan:(ue,pe)=>g(ue,pe&&pe.engine?{default:"engine"}:he),STAT_PUSHDOWN:t,lastPlan:()=>se?{...se,...de?{aggregates:N(de)}:{},...Te?{total:{deferred:!0,state:Te.state,value:Te.value}}:{}}:null,fullFrame:He,counts:()=>({match:ke,total:ke,pending:!!Te&&Te.state==="pending"}),grandTotals:()=>Ae},it}}),Ve("packages/core/src/source/remote.js",function(e,D){"use strict";Object.defineProperty(e,"PROTOCOL",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return N}});const A=D("packages/core/src/internal/lru.js").Lru,I=D("packages/core/src/internal/predicates.js").isFunction,Q=D("packages/core/src/internal/warn.js").warnOnce,$=D("packages/core/src/internal/schedule.js").settleDebounce,X=D("packages/core/src/source/abort.js"),F=X.createAbortScope,j=X.isAbortError,v=D("packages/core/src/source/blockcache.js"),b=v.BlockCache,l=v.DEFAULT_PAGE_SIZE,g=v.DEFAULT_MAX_CACHED_PAGES,o=D("packages/core/src/source/rows.js"),t=o.createRowFactory,s=o.groupKey,r=D("packages/core/src/source/filterwire.js"),i=r.wireFilters,n=r.querySignature,m=r.warnHostFilterNotApplied,a=D("packages/core/src/source/pagewindow.js").pageWindow,h=D("packages/core/src/source/memory.js").MemorySource,y=D("packages/core/src/compute/handle.js").valueComparator,d=D("packages/core/src/compute/pivot.js"),f=d.pivotKey,w=d.joinPath,k=d.DEFAULT_PATH_SEPARATOR,G=D("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,K=1,q=120,B=1e3;function E(O,T,R){for(let x=0;x<Math.max(O.length,T.length);x++){const U=O[x],V=T[x],J=U==null,_=V==null;if(J||_){if(J&&_)continue;return J?1:-1}const ee=R(U,V);if(ee!==0)return ee}return 0}function S(O,T){return new N(O,T)}class C{constructor(T,R,x,U){this.path=T,this.keyPath=U||T,this.values=[],this.level=R,this.key=s(this.keyPath),this.cache=new b(x),this.count=null,this.complete=!1,this.announced=null,this.counting=!1,this.failed=!1,this.children=new Map,this.row=null,this.flat=!1}}class N{mode="remote";#e;#t;#n;#r;#s=new Map;#i=new Set;#a=F();#l;#o;#c=new Map;#u=[];#f=null;#d="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#O="";#w=null;#A=-1;constructor(T,R){this.#e=T||{mode:"remote"},this.#t=R||{},I(this.#e.fullFrame)&&(this.filteredIndices=()=>this.#I(),this.unfilteredIndices=()=>this.#K(),this.handleFor=ee=>this.#Y(ee),this.display=()=>this.#x(),this.grandTotalRow=()=>this.#D(),this.unfilteredRows=()=>this.#_(),this.facetIndices=ee=>this.#U(ee));const x=this.#e.counts;I(x)&&(this.matchCount=()=>this.#X("match"),this.totalCount=()=>this.#X("total"));const U=this.#e.grandTotals;I(U)&&(this.grandTotalRow=()=>this.#V());const V=this.#e.foregroundIdle;I(V)&&(this.foregroundIdle=()=>this.#oe(V),this.#e.pageForegroundIdle=()=>this.#b?this.#oe(V):null);const J=this.#e.facetProvider;I(J)&&(this.facetProvider=J);const _=this.#e;I(_.countMatching)&&I(_.streamMatching)&&(this.selectionQuery=()=>this.#W(),this.countMatching=ee=>_.countMatching(ee),this.streamMatching=(ee,W)=>_.streamMatching(ee,W),this.loadedRows=()=>this.#ge(),this.resident=()=>this.#N()!==null),this.#n={pageSize:this.#e.pageSize||l,maxCachedPages:this.#e.maxCachedPages||g},this.#l=t(this.#t),this.#o=new A(this.#n.pageSize*4),this.#h=$((ee,W)=>this.#T(ee,W),q),this.#r=new C([],0,this.#n),this.#s.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 T=this.#S();return T?T.length:this.#v()}#v(){const T=this.#N();return T?T.count():(this.#re(),this.#Ae(this.#r))}#C(){if(this.#N())return!0;const T=R=>{if(R.count===null&&!R.complete)return!1;for(const x of R.children.values())if(this.#Te(x.key,this.#we(x))&&!T(x))return!1;return!0};return T(this.#r)}pageInfo(){const T=this.#S(),R=this.totalPending();if(!T){const x=this.#v();return{page:0,pageSize:0,total:this.#C()?x:null,pageCount:1,counting:R}}return{page:T.page,pageSize:T.pageSize,total:T.total,pageCount:T.pageCount,counting:R||T.total===null&&this.#a.size>0&&this.#r.cache.loadedExtent()===0}}#S(){const T=this.#v(),R=a(this.#$("pageSize",0),this.#$("page",0),T,this.#C());if(!R)return this.#O="",null;const x=`${this.#y}:${R.offset}:${R.length}`;return x!==this.#O&&!this.#p&&(this.#O=x,R.length>0&&!this.#N()&&this.#T(R.offset,R.offset+R.length-1)),R}at(T){const R=this.#S();if(R){if(T<0||T>=R.length)return;const x=this.#P(R.offset+T);return x&&(x.index=T),x}return this.#P(T)}#P(T){const R=this.#N();if(R)return R.at(T);if(this.#re(),T<0||T>=this.#v())return;const x=this.#Z(this.#r,T);if(!x)return;const U=this.#G(x.node,x.local);return U&&(U.index=T),U||this.#l.skeleton(T,x.node.level,x.node.cache.erroredAt(x.local))}byKey(T){const R=this.#N();if(R)return R.byKey(T);const x=this.#c.get(T);if(!x)return;const U=x.lastIndexOf(":"),V=this.#s.get(x.slice(0,U));return V&&this.#G(V,Number(x.slice(U+1)))||void 0}loaded(T){const R=this.#S();if(R){if(T<0||T>=R.length)return!1;T+=R.offset}const x=this.#N();if(x)return x.loaded(T);if(T<0||T>=this.#v())return!1;const U=this.#Z(this.#r,T);return!!U&&U.node.cache.rowLoaded(U.local)}hint(T,R){if(this.#p)return;this.#b=!0;const x=this.#re();let U=Math.max(0,Math.floor(T)),V=Math.max(U,Math.floor(R));const J=this.#S();if(J){if(J.length===0)return;U=J.offset,V=J.offset+J.length-1}for(const[_,ee]of this.#E(U,V)){_.cache.protect(ee.min,ee.max);for(const W of _.cache.evict())this.#Ee(_,W)}this.#h(U,V),x&&this.#h.flush()}#E(T,R){const x=this.#v(),U=new Map;for(let V=T;V<=R&&V<x;V++){const J=this.#Z(this.#r,V);if(!J)continue;const _=U.get(J.node);_?(_.min=Math.min(_.min,J.local),_.max=Math.max(_.max,J.local)):U.set(J.node,{min:J.local,max:J.local})}return U.size||U.set(this.#r,{min:T,max:T}),U}#T(T,R){if(!this.#p)for(const[x,U]of this.#E(T,R)){x.cache.protect(U.min,U.max);const V=x.cache.blockOf(U.min),J=x.cache.blockOf(U.max);for(let _=V;_<=J&&!(x.count!==null&&_*x.cache.pageSize>=x.count);_++)x.cache.has(_)||this.#ue(x,_)}}apply(T){const R={added:[],updated:[],removed:[]};if(!T)return R;if(T.update)for(const x of T.update){const U=this.#c.get(this.#l.keyOf(x,-1));if(!U)continue;this.#o.delete(U);const V=U.lastIndexOf(":"),J=this.#s.get(U.slice(0,V));if(!J)continue;const _=Number(U.slice(V+1)),ee=J.cache.blockOf(_);if(!J.cache.loaded(ee))continue;const{start:W}=J.cache.rangeOf(ee),Z=[];for(let ie=W;ie<W+J.cache.pageSize;ie++){const ce=J.cache.rowAt(ie);if(ce===void 0)break;Z.push(ie===_?x:ce)}J.cache.fill(ee,Z);const ne=this.#G(J,_);ne&&R.updated.push(ne)}return(T.add&&T.add.length||T.remove&&T.remove.length)&&this.reload({keepExpanded:!0}),R}reload(T){this.#a.abortAll("reload"),this.#h.cancel(),T&&T.keepExpanded===!1&&this.#i.clear(),this.#pe(),this.#H("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#a.abortAll("destroyed"),this.#pe(),this.#s.clear(),this.#i.clear(),this.#w&&I(this.#w.destroy)&&this.#w.destroy(),this.#w=null}expand(T){this.#i.has(T)||(this.#i.add(T),this.#H("group:toggled",{key:T,expanded:!0}),this.#H("model:changed",{reason:"expand",key:T}))}collapse(T){this.#i.delete(T)&&(this.#H("group:toggled",{key:T,expanded:!1}),this.#H("model:changed",{reason:"collapse",key:T}))}expandedKeys(){return[...this.#i]}pivotFields(){return this.#u}pivot(){this.#re();const T=this.#f;if(!T||!T.keys.size||!this.#$("pivotBy",[]).length)return null;if(!T.result){const R=y((this.#t.config||{}).locale),x=[...T.keys.entries()].sort((V,J)=>E(V[1],J[1],R)),U=x.map(([V])=>V);T.result={keys:x.map(([,V])=>V),paths:U,fields:this.#Pe(U),groupPaths:[],columns:U.length*Math.max(1,this.#ve().length),values:T.cells,cells:T.cells,error:null}}return T.result}invalidateHandles(){this.#w&&(I(this.#w.invalidateHandles)&&this.#w.invalidateHandles(),I(this.#w.invalidate)&&this.#w.invalidate("filter"))}#M(){const T=this.#e.fullFrame;return I(T)?T():null}#N(){const T=this.#M();return T?(this.#w||(this.#w=new h({mode:"memory"},this.#R())),T.version!==this.#A&&(this.#w.setRows(T.rows),this.#A=T.version),this.#w):null}#R(){const T=this.#t,R=T.state||{};return{...T,state:{...R,page:()=>0,pageSize:()=>0}}}#I(){const T=this.#N();return T?T.filteredIndices():new Uint32Array(0)}#K(){const T=this.#N();return T?T.unfilteredIndices():new Uint32Array(0)}#Y(T){const R=this.#N();return R?R.handleFor(T):void 0}#x(){const T=this.#N();return T?T.display():[]}#U(T){const R=this.#N();return R&&I(R.facetIndices)?R.facetIndices(T):new Uint32Array(0)}#D(){const T=this.#N();return T&&I(T.grandTotalRow)?T.grandTotalRow():null}#X(T){const R=this.#N();if(R){const J=T==="match"?R.matchCount:R.totalCount;if(I(J))return J.call(R)}const x=this.#e.counts,U=I(x)?x():null,V=U?U[T]:null;return typeof V=="number"?V:this.#v()}#V(){const T=this.#N();if(T&&I(T.grandTotalRow))return T.grandTotalRow();if((this.#t.config||{}).grandTotalRow!=="bottom")return null;const x=this.#e.grandTotals,U=I(x)?x():null;return!U||!U.totals?null:this.#l.grandTotal(U.totals,U.leafCount||0)}#_(){const T=this.#N();if(T&&I(T.unfilteredRows))return T.unfilteredRows();const R=[],x=this.count();for(let U=0;U<x;U++){const V=this.at(U);V&&R.push(V)}return R}#W(){const T=this.#$("quick",""),R={protocol:K,groupPath:[],groupValues:[],groupBy:[],totals:[],totalFns:{},pivotBy:[],pivotMode:!1,filters:i(this.#$("filters",null),this.#Q()),sort:this.#$("sort",[]),context:this.#$("context",null)};T&&(R.quick=T);const x=this.#$("where",null);return x&&x.active&&(R.where=x),R}#ge(){const T=this.#$("groupBy",[]).length,R=[];for(const x of this.#s.values())if(!(x.level!==T&&!x.flat))for(const U of x.cache.ids()){if(!x.cache.loaded(U))continue;const{start:V,end:J}=x.cache.rangeOf(U);for(let _=V;_<J&&x.cache.rowLoaded(_);_++){const ee=this.#G(x,_);ee&&!ee.group&&R.push(ee)}}return R}loadedCount(){const T=this.#N();if(T){const U=T.matchCount();return typeof U=="number"?U:T.count()}this.#re();const R=this.#$("groupBy",[]).length;let x=0;for(const U of this.#s.values())if(!(U.level!==R&&!U.flat))for(const V of U.cache.ids()){if(!U.cache.loaded(V))continue;const J=U.cache.fillOf(V);typeof J=="number"&&(x+=J)}return x}residentRows(){const T=this.#N();return T?T.display():this.#$("groupBy",[]).length>0?null:(this.#re(),this.#ge())}#ie(T,R,x){const{start:U,end:V}=T.cache.rangeOf(R),J=this.#$("groupBy",[]),_=this.#$("pivotBy",[]),ee=this.#$("quick",""),W=this.#ve(),Z={protocol:K,range:{start:U,end:V},groupPath:T.path,groupValues:T.values,groupBy:J,totals:W,totalFns:this.#Se(W),pivotBy:_,pivotMode:_.length>0,filters:i(this.#$("filters",null),this.#Q()),sort:this.#$("sort",[]),context:this.#$("context",null),signal:x};ee&&(Z.quick=ee);const ne=this.#$("where",null);return ne&&ne.active&&(Z.where=ne),Z}async#ue(T,R){if(!I(this.#e.fetch))return;if(!this.#m){this.#m=!0;const J=this.#g;this.#g=[],queueMicrotask(()=>{for(const _ of J)_()})}const x=this.#a.begin(`${T.key}:${R}`);T.cache.begin(R,x);const U=this.#d,{start:V}=T.cache.rangeOf(R);try{const J=await this.#e.fetch(this.#ie(T,R,x.signal));if(!x.current||U!==this.#d||this.#p)return;x.settle();const _=J&&J.rows||[];if(!!(J&&J[G])&&!T.flat){T.flat=!0,T.children.clear();for(const[ne,ie]of[...this.#c])ie.startsWith(`${T.key}:`)&&(this.#o.delete(ie),this.#c.delete(ne))}T.cache.fill(R,_),T.failed=!1;for(let ne=0;ne<_.length;ne++)this.#o.delete(`${T.key}:${V+ne}`);const W=J&&typeof J.count=="number"?J.count:J&&typeof J.total=="number"?J.total:null,Z=J&&I(J.pendingTotal?.then)?J.pendingTotal:null;W!==null?(T.count=W,T.complete=!0):_.length<T.cache.pageSize?(T.count=V+_.length,T.complete=!0):Z&&(T.counting=!0,T.announced=null),J&&Array.isArray(J.pivotFields)&&this.#Ue(J.pivotFields),J&&J.pivot&&typeof J.pivot=="object"&&this.#ae(J.pivot),this.#H("model:changed",{reason:"page",groupPath:T.path,block:R}),this.#H("rows:changed",{companion:!0,reason:"page",groupPath:T.path,block:R}),this.#fe(T),Z&&this.#Me(T,Z,U)}catch(J){if(x.settle(),j(J))return;T.cache.failed(R,J),T.failed=!0;const{end:_}=T.cache.rangeOf(R);for(let ee=V;ee<_;ee++)this.#o.delete(`${T.key}:${ee}`);this.#H("model:changed",{reason:"page-error",groupPath:T.path,block:R}),this.#H("source:error",{error:J,groupPath:T.path,block:R})}}async#Me(T,R,x){let U;try{U=await R}catch(V){if(x!==this.#d||this.#p)return;T.counting=!1,j(V)||(T.failed=!0),j(V)||this.#H("source:error",{error:V,groupPath:T.path});return}x!==this.#d||this.#p||(T.counting=!1,typeof U=="number"&&(T.count=U,T.complete=!0,this.#fe(T),this.#H("model:changed",{reason:"total",count:U,groupPath:T.path})))}#fe(T){typeof T.count!="number"||!T.complete||T.announced!==T.count&&(T.announced=T.count,this.#H("source:total",{total:T.count,groupPath:T.path}))}#oe(T){if(this.#p)return null;this.#re();const R=this.#m?null:new Promise(_=>{this.#g.push(_),setTimeout(_,B)}),x=T();if(!R&&!x)return null;const U=(async()=>{R&&await R;for(let _=T();_;_=T())await _})();let V;const J=new Promise(_=>{V=setTimeout(_,B)});return Promise.race([U,J]).then(()=>clearTimeout(V))}totalPending(){if(this.#r.failed)return!1;if(this.#r.counting===!0)return!0;if(this.#N())return!1;this.#re();const T=this.#r;return T.count===null&&!T.complete&&T.cache.loadedExtent()===0}totalFailed(){return this.#r.failed===!0}#Ue(T){T.length===this.#u.length&&T.every((R,x)=>R===this.#u[x])||(this.#u=T,this.#H("column:pivoted",{pivotFields:T,remote:!0}))}#xe(){const T=this.#t.config||{};return T.pivot&&T.pivot.separator||k}#Pe(T){const R=this.#xe(),x=this.#ve();if(!x.length)return T.slice();const U=[];for(const V of T)for(const J of x)U.push(`${V}${R}${J}`);return U}#ae(T){const R=this.#xe();this.#f||(this.#f={keys:new Map,cells:new Map,result:null});const x=this.#f;let U=!1;const V=_=>{const ee=Array.isArray(_)?_:[_],W=w(ee,R);return x.keys.has(W)||(x.keys.set(W,ee),U=!0),W},J=this.#$("groupBy",[]).length>0;for(const _ of Array.isArray(T.axis)?T.axis:[])V(_);for(const _ of Array.isArray(T.cells)?T.cells:[]){if(!_||typeof _!="object")continue;const ee=V(_.pivot);if(J&&!(Array.isArray(_.group)&&_.group.length))continue;const W=w(Array.isArray(_.group)?_.group:[],R);for(const[Z,ne]of Object.entries(_.values||{}))x.cells.set(f(W,ee,Z),ne)}x.result=null,U&&this.#Ue((this.pivot()||{fields:[]}).fields)}#Ae(T){let R=this.#le(T);for(const x of T.children.values())this.#Te(x.key,this.#we(x))&&(R+=this.#Ae(x));return R}#le(T){if(T.count!==null)return T.count;const R=T.cache.loadedExtent();return T.complete?R:T.row&&T.row.leafCount>0?T.level>=this.#$("groupBy",[]).length?Math.max(R,T.row.leafCount):R===0?1:Math.min(R+T.cache.pageSize,Math.max(R,T.row.leafCount)):R+T.cache.pageSize}#Z(T,R){let x=R,U=0;const V=[...T.children.entries()].filter(([,_])=>this.#Te(_.key,this.#we(_))).sort((_,ee)=>_[0]-ee[0]);for(const[_,ee]of V){const W=_-U+1;if(x<W)return{node:T,local:U+x};x-=W,U=_+1;const Z=this.#Ae(ee);if(x<Z)return this.#Z(ee,x);x-=Z}const J=this.#le(T);return U+x<J?{node:T,local:U+x}:null}#G(T,R){const x=`${T.key}:${R}`,U=this.#o.get(x);if(U)return U.group===!0?this.#B(U):U;const V=T.cache.rowAt(R);if(V===void 0)return null;const J=this.#$("groupBy",[]);let _;if(T.level<J.length&&!T.flat){const ee=J[T.level],W=this.#f!==null&&T.level===J.length-1&&this.#$("pivotBy",[]).length>0,Z=this.#ye(V,ee),ne=Z==null,ie=[...T.path,ne?"":String(Z)],ce=[...T.keyPath,ne?null:String(Z)];if(_=this.#l.group({path:ie,keyPath:ce,column:ee,value:Z,level:T.level,parent:T.row,leafCount:Number(V.leafCount)||0,expanded:W?!1:this.#Te(s(ce),{key:s(ce),column:ee,value:Z,level:T.level,path:ie}),...W?{hasChildren:!1}:{}}),_.totals=this.#ne(V),_.data=V,!W){let me=this.#s.get(_.key);me?me.row=_:(me=new C(ie,T.level+1,this.#n,ce),me.row=_,this.#s.set(me.key,me)),me.values=[...T.values,Z],T.children.set(R,me)}}else _=this.#l.leaf(V,R,T.level,T.row);return this.#o.set(x,_),this.#c.set(_.key,x),_}#ne(T){const R=T||{};if(R.totals&&typeof R.totals=="object")return R.totals;const x={};for(const U of this.#ve())Object.hasOwn(R,U)&&(x[U]=R[U]);return x}#B(T){const R=this.#s.get(T.key);if(!R||R.row!==T||T.hasChildren===!1)return T;const x=this.#Te(T.key,this.#we(R));return T.expanded!==x&&(T.expanded=x),T}#Ee(T,R){const{start:x,end:U}=T.cache.rangeOf(R);for(let V=x;V<U;V++){const J=`${T.key}:${V}`,_=this.#o.peek(J);_&&this.#c.delete(_.key),this.#o.delete(J)}}#re(){const T=this.#be();return T===this.#d?!1:(this.#d=T,this.#a.abortAll("query"),this.#pe(),this.#m=!1,this.#H("model:changed",{reason:"query"}),!0)}#pe(){for(const T of this.#s.values())T.cache.clear(),T.count=null,T.complete=!1,T.announced=null,T.counting=!1,T.failed=!1,T.children.clear(),T.flat=!1;this.#o.clear(),this.#c.clear(),this.#y++,this.#f=null}#be(){const T=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)})}|${T?T.version:0}`}#Te(T,R){const x=this.#$("expanded",null);return x?I(x.has)?x.has(T,R):Array.prototype.includes.call(x,T):this.#i.has(T)}#we(T){if(T.row)return{key:T.key,column:T.row.column,value:T.row.value,level:T.level-1,path:T.path}}#ve(){const T=this.#$("totals",[]);if(T&&T.length)return[...T];const R=this.#t.columns;return!R||!I(R.all)?[]:R.all().filter(x=>!!x.total).map(x=>x.id)}#Se(T){const R=this.#t.columns,x={};if(!R||!I(R.get))return x;for(const U of T){const V=R.get(U);if(!V)continue;const J=V.groupTotal!=null?V.groupTotal:V.total;typeof J=="string"?x[U]=J:J&&typeof J=="object"&&typeof J.fn=="string"&&(x[U]={...J})}return x}#ye(T,R){const x=this.#t.columns,U=x&&I(x.get)?x.get(R):void 0;return U&&I(U.getValue)?U.getValue(T):T?.[R]}#de(){m(this.#t)}#Q(){const T=this.#t.config||{};return{tz:T.timeZone,weekStartsOn:T.weekStartsOn}}#$(T,R){const x=this.#t.state;if(x&&I(x[T])){const U=x[T]();return U??R}return R}#H(T,R){const x=this.#t.emit;I(x)&&x(T,R)}}}),Ve("packages/core/src/source/gapbuffer.js",function(e,D){"use strict";Object.defineProperty(e,"GapBuffer",{enumerable:!0,get:function(){return A}});const re=64;class A{#e;#t=0;#n=0;constructor(I=re){this.#e=new Uint32Array(Math.max(1,I)),this.#n=this.#e.length}static from(I,L=re){const Q=new A(I.length+Math.max(1,L));return Q.#e.set(I,0),Q.#t=I.length,Q.#n=Q.#e.length,Q}get length(){return this.#t+(this.#e.length-this.#n)}get capacity(){return this.#e.length}at(I){return I<0||I>=this.length?0:I<this.#t?this.#e[I]:this.#e[I+(this.#n-this.#t)]}insert(I,L){const Q=I<0?0:I>this.length?this.length:I;this.#r(Q),this.#t===this.#n&&this.#s(),this.#e[this.#t++]=L}push(I){this.insert(this.length,I)}removeAt(I){return!Number.isInteger(I)||I<0||I>=this.length?!1:(this.#r(I),this.#n++,!0)}toArray(){const I=new Uint32Array(this.length);return I.set(this.#e.subarray(0,this.#t),0),I.set(this.#e.subarray(this.#n),this.#t),I}clear(){this.#t=0,this.#n=this.#e.length}#r(I){if(I!==this.#t)if(I<this.#t){const L=this.#t-I;this.#e.copyWithin(this.#n-L,I,this.#t),this.#t=I,this.#n-=L}else{const L=I-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+L),this.#t=I,this.#n+=L}}#s(){const I=this.#e.length-this.#n,L=new Uint32Array(Math.max(this.#e.length*2,this.#e.length+re));L.set(this.#e.subarray(0,this.#t),0),L.set(this.#e.subarray(this.#n),L.length-I),this.#e=L,this.#n=L.length-I}}}),Ve("packages/core/src/store/ingest.js",function(e,D){"use strict";Object.defineProperty(e,"INGEST_DEFAULTS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"inferKind",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"decideText",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"createReaders",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"Ingest",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return i}});const re=D("packages/core/src/internal/schedule.js"),A=re.now,Y=re.nextFrame,I=D("packages/core/src/internal/warn.js"),L=I.infoOnce,Q=I.warnOnce,$=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/paths.js").pathGetter,v=D("packages/core/src/store/columnstore.js").ColumnStore,b=Object.freeze({chunkMs:8,chunkRows:512,sampleSize:100,dictionaryRatio:.1,columnarBelow:5e3,initialCapacity:1024});function l(n,m={}){if(m.multi)return"multi";if(n.length===0)return"object";let c=0,a=0,u=0,h=0,p=0;for(let d=0;d<n.length;d++){const f=n[d];typeof f=="number"?c++:typeof f=="boolean"?a++:typeof f=="string"?u++:f instanceof Date?h++:Array.isArray(f)&&p++}const y=n.length;return c===y?"float64":a===y?"bitset":h===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 a=new Map,u=new Map;for(const K of n){if(K.computed)continue;const q=$(K.read)?K.read:F(K.field||K.id);u.set(K.id,q),a.set(K.id,q)}const h=m?.order??[],p=m?.fns??{},y=m?.deps??{},d=m?.wrapDeps??null,f=h.filter(K=>$(p[K])),w=f.some(K=>y[K]==="*");let k=new WeakMap;const P=K=>{const q={};if(w)for(const[B,E]of u)q[B]=E(K);for(const B of f){const E=y[B];let S;if(E==="*")S=q;else{S={};const C=E||[];for(let N=0;N<C.length;N++){const O=C[N];S[O]=O in q?q[O]:u.get(O)?.(K)}}q[B]=p[B](d?d(S,B):S,{data:K,row:null,column:null,grid:null,context:c})}return q},G=K=>{if(K===null||typeof K!="object"&&typeof K!="function")return P(K);let q=k.get(K);return q===void 0&&(q=P(K),k.set(K,q)),q};for(const K of f)a.set(K,q=>G(q)[K]);return{readers:a,reset(){k=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 s{#e;#t=[];#n=null;#r;#s=0;#i;#a=!1;#l=!1;#o=0;#c;constructor(m,c={},a={}){this.#e=Array.isArray(m)?m:Array.from(m||[]),this.#i={...b,...a};const u=c.columns??[];this.#r=o(u,c.computed??null,c.context),this.#c=this.#e.length>=this.#i.columnarBelow,this.#u(u,c.computed??null),this.#n=new v(this.#t.map(h=>({id:h.spec.id,kind:h.kind,nullable:h.nullable,read:h.read,dictionary:h.spec.dictionary})),{initialCapacity:this.#i.initialCapacity,columnarBelow:this.#i.columnarBelow})}get store(){return this.#n}get done(){return this.#a||this.#l}get progress(){return this.#s}slice(){if(this.done)return!1;if(this.#i.signal?.aborted)return this.#l=!0,!1;const m=A(),{chunkMs:c,chunkRows:a}=this.#i,u=this.#e.length;do{const h=Math.min(this.#s+a,u);this.#n.append(this.#e.slice(this.#s,h)),this.#f(this.#s,h),this.#s=h,this.#r.reset(),this.#h(!1)}while(this.#s<u&&A()-m<c);return this.#o+=A()-m,this.#i.onProgress?.({loaded:this.#s,total:u}),this.#s>=u?(this.#h(!0),this.#a=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(m=>({id:m.spec.id,kind:m.kind,nullable:m.nullable,read:m.read,dictionary:m.spec.dictionary})),decisions:this.#t.map(m=>({id:m.spec.id,kind:m.kind,nullable:m.nullable,inferred:m.inferred,distinct:m.candidate||m.change?this.#d(m):null,change:m.change,reason:m.reason})),count:this.#n.count,elapsed:this.#o,cancelled:this.#l}}#u(m,c){const a=this.#e,u=Math.min(this.#i.sampleSize,a.length),h=this.#i.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 d=this.#r.readers.get(y.id)??($(y.read)?y.read:F(y.field||y.id)),f=new t(y,d);if(y.kind)f.kind=y.kind,f.reason="declared by the caller";else if(y.dictionary)f.kind=y.multi?"multi":"dictionary",f.reason="value table supplied (lookup column)";else{const w=[];for(let P=0;P<u&&w.length<this.#i.sampleSize;P++){const G=d(a[P]);G!=null&&w.push(G)}f.inferred=!0;const k=l(w,{multi:y.multi});if(k==="text"){const P=new Set(w).size;f.kind=g(P,w.length,h),f.candidate=this.#c,f.reason=`sampled ${P} distinct in ${w.length}`}else f.kind=k,f.reason=`inferred from ${w.length} sampled values`,k==="object"&&w.length&&L(`ingest.mixed.${y.id}`,`column "${y.id}" holds mixed or unrecognised value types; storing as an object array. Declare a type to avoid this.`);f.kind==="object"&&f.candidate&&(f.distinct=new Set(w))}this.#t.push(f)}}#f(m,c){const a=this.#e;for(const u of this.#t){if(!u.candidate||!u.distinct)continue;const h=u.distinct;for(let p=m;p<c;p++){const y=u.read(a[p]);y!=null&&h.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.#i.dictionaryRatio,a=this.#e.length;for(const u of this.#t){if(!u.candidate)continue;const h=this.#d(u);if(u.kind==="dictionary"&&h>=c*a){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=`${h} distinct values is at or above ${c*100}% of ${a} rows`;continue}if(u.kind==="object"&&h>=c*a){u.candidate=!1,u.distinct=null,u.reason=`${h} distinct values is at or above ${c*100}% of ${a} rows`;continue}m&&u.kind==="object"&&h<c*a&&(this.#n.convert(u.spec.id,"dictionary"),u.kind="dictionary",u.change=u.change==="demoted"?null:"promoted",u.reason=`${h} distinct values is below ${c*100}% of ${a} rows`,u.distinct=null),m&&(u.candidate=!1)}}}async function r(n,m={},c={}){const a=new s(n,m,c),u=c.scheduler?.frame??Y;for(;a.slice();)await new Promise(h=>{u(h)});return a.result()}function i(n,m={},c={}){const a=new s(n,m,{...c,chunkMs:1/0});for(;a.slice(););return a.result()}}),Ve("packages/core/src/store/columnpack.js",function(e,D){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return g}});const A=D("packages/core/src/internal/paths.js").pathGetter,Y=D("packages/core/src/store/ingest.js"),I=Y.inferKind,L=Y.decideText,Q=Y.INGEST_DEFAULTS,$=D("packages/core/src/store/columnstore.js").toFloat,X=new Set(["float64","int32","bitset","dictionary","object","multi"]);function F(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&&!X.has(t.kind))return!1;return!0}function j(o){const t=$(o);return Number.isFinite(t)?t|0:0}function v(o){return o==null?[]:Array.isArray(o)?o:[o]}function b(o,t,s,r){if(o.kind)return o.kind;const i=[];for(let c=0;c<t.length&&i.length<Q.sampleSize;c++){const a=t[c];a!=null&&i.push(a)}const n=I(i,{multi:o.multi});if(n!=="text")return n;const m=new Set(i).size;return L(m,i.length,r)}function l(o,t,s={}){const r=t.length|0,i=s.dictionaryRatio??Q.dictionaryRatio,n=[];for(const m of o){const c=A(m.field||m.id),a=m.nullable!==!1,u=new Array(r);for(let f=0;f<r;f++){const w=c(t[f]);u[f]=w===void 0?null:w}const h=b(m,u,r,i),p=a?new Uint8Array(r+7>>3):null,y=f=>{p&&(p[f>>3]|=1<<(f&7))};let d;switch(h){case"float64":{const f=new Float64Array(r);for(let w=0;w<r;w++){const k=u[w],P=k===null;P||y(w),f[w]=P?NaN:$(k)}d={id:m.id,kind:h,nullable:a,values:f,presence:p,offsets:null,table:null};break}case"int32":{const f=new Int32Array(r);for(let w=0;w<r;w++){const k=u[w],P=k===null;P||y(w),f[w]=P?0:j(k)}d={id:m.id,kind:h,nullable:a,values:f,presence:p,offsets:null,table:null};break}case"bitset":{const f=new Uint8Array(r+7>>3);for(let w=0;w<r;w++){const k=u[w],P=k===null;P||y(w),!P&&k&&(f[w>>3]|=1<<(w&7))}d={id:m.id,kind:h,nullable:a,values:f,presence:p,offsets:null,table:null};break}case"dictionary":{const f=new Uint32Array(r),w=[],k=new Map;for(let P=0;P<r;P++){const G=u[P];if(G===null){f[P]=0;continue}y(P);let K=k.get(G);K===void 0&&(K=w.length,w.push(G),k.set(G,K)),f[P]=K}d={id:m.id,kind:h,nullable:a,values:f,presence:p,offsets:null,table:w};break}case"multi":{const f=[],w=new Map,k=new Uint32Array(r+1),P=[];for(let G=0;G<r;G++){const K=u[G];k[G]=P.length,K===null||y(G);const B=v(K);for(let E=0;E<B.length;E++){const S=B[E];let C=w.get(S);C===void 0&&(C=f.length,f.push(S),w.set(S,C)),P.push(C)}}k[r]=P.length,d={id:m.id,kind:h,nullable:a,values:Int32Array.from(P),presence:p,offsets:k,table:f};break}default:{const f=new Array(r);for(let w=0;w<r;w++){const k=u[w];k!==null&&y(w),f[w]=k}d={id:m.id,kind:"object",nullable:a,values:f,presence:p,offsets:null,table:null};break}}n.push(d)}return{count:r,columns:n}}function g(o){const t=[];if(!o||!Array.isArray(o.columns))return t;const s=r=>{ArrayBuffer.isView(r)&&r.buffer&&!t.includes(r.buffer)&&t.push(r.buffer)};for(const r of o.columns)s(r.values),s(r.presence),s(r.offsets);return t}}),Ve("packages/core/src/source/stream.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_PROMOTE_BELOW",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"createStreamSource",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return C}});const A=D("packages/core/src/internal/lru.js").Lru,I=D("packages/core/src/internal/predicates.js").isFunction,L=D("packages/core/src/internal/schedule.js"),Q=L.now,H=L.nextFrame,$=L.cancelFrame,X=L.whenIdle,j=D("packages/core/src/internal/compare.js").defaultCompare,v=D("packages/core/src/internal/warn.js"),b=v.warnOnce,l=v.infoOnce,o=D("packages/core/src/internal/paths.js").getPath,t=D("packages/core/src/source/abort.js"),s=t.createAbortScope,r=t.isAbortError,i=D("packages/core/src/source/rows.js"),n=i.createRowFactory,m=i.lazyRowView,a=D("packages/core/src/source/gapbuffer.js").GapBuffer,h=D("packages/core/src/source/memory.js").createMemorySource,y=D("packages/core/src/source/filterwire.js").querySignature,f=D("packages/core/src/store/columnpack.js").isPortableSchema,w=25e4,k=Symbol("lattice.stream.storeBacked"),P=8,G=.1,K=1e3,q=50;function B(N){return Math.min(K,Math.max(q,Math.floor(N/4)))}function E(N){if(N instanceof Date)return N.getTime();if(typeof N=="number")return Number.isFinite(N)?N:NaN;if(typeof N=="string"){const O=N.trim();if(!O)return NaN;const T=Date.parse(O);return Number.isNaN(T)?Number(O):T}return NaN}function S(N,O){return new C(N,O)}class C{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#s=[];#i=null;#a;#l;#o=new Map;#c=s();#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;#C="";#S=0;#P=0;#E=0;#T=null;#M=1/0;#N=!1;#R=null;#I=null;#K=null;#Y=null;#x=!1;#U=0;#D=0;#X=!1;constructor(O,T){this.#e=O||{mode:"stream"},this.#t=T||{},this.#a=n(this.#t),this.#l=new A(4096),this.#C=this.#qe();const R=(this.#t.config||{}).ingest;this.#x=!!R&&R.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 x=Number(this.#e.poll);Number.isFinite(x)&&x>0&&(this.#Y=setInterval(()=>{this.#v||this.reload()},x),this.#Y&&I(this.#Y.unref)&&this.#Y.unref()),this.#_()}#V(){const O=Number(this.#e.maxAge);return Number.isFinite(O)&&O>0?O:0}#_(){const O=this.#V();if(!O)return;const T=this.#e.ageBy;I(T)?this.#I=T:typeof T=="string"&&T?this.#I=R=>o(R,T):this.#I=null,this.#T=[],this.#R=setInterval(()=>{this.#v||this.#W()&&(this.#Ee(),this.#H())},B(O)),this.#R&&I(this.#R.unref)&&this.#R.unref()}#W(){const O=this.#V();return!O||!this.#T?!1:this.#N?!0:this.#M<Date.now()-O*(1+G)}#ge(O,T){if(!this.#T)return;const R=this.#I?E(this.#I(T)):Date.now();this.#T[O]=R,Number.isNaN(R)||(R<this.#M&&(this.#M=R),R<Date.now()-this.#V()&&(this.#N=!0))}#ie(){return this.#Oe("groupBy",[]).length>0?!0:!!this.#Oe("pivotMode",!1)&&this.#Oe("pivotBy",[]).length>0}#ue(){if(this.#g||this.#v)return;const O=this.#ie();if(O&&!this.#b){this.#b=h({mode:"memory",rows:this.#n},this.#Me()),this.#O=!1;return}!O&&this.#b&&(this.#b.destroy(),this.#b=null)}#Me(){if(this.#y)return this.#y;const O=this,T={liveIndices:()=>O.#fe(),live:R=>O.#n[R]!==void 0,source:R=>O.#ee(R),get physical(){return O.#n.length}};return this.#x&&(T.column=R=>{const x=O.#t.store;return x&&I(x.column)?x.column(R):void 0}),this.#y=Object.create(this.#t,{store:{value:T,enumerable:!0,configurable:!0}}),this.#y}#fe(){const O=new Uint32Array(this.#n.length);let T=0;for(let R=0;R<this.#n.length;R++)this.#n[R]!==void 0&&(O[T++]=R);return O.subarray(0,T)}#oe(){return this.#g?this.#g:this.#b?(this.#O&&(this.#O=!1,this.#b.setRows(this.#n)),this.#b):null}invalidate(O="filter"){if(this.#g){this.#g.invalidate(O);return}this.#ue(),this.#b&&this.#b.invalidate(O),(O==="filter"||O==="sort")&&this.#Te()}count(){const O=this.#oe();return O?O.count():this.#r?this.#r.length:this.#S}matchCount(){const O=this.#oe();return O&&I(O.matchCount)?O.matchCount():this.#r?this.#r.length:this.#S}totalCount(){const O=this.#oe();return O&&I(O.totalCount)?O.totalCount():this.#S}unfilteredRows(){const O=this.#oe();if(O&&I(O.unfilteredRows))return O.unfilteredRows();const T=[];for(let R=0;R<this.#n.length;R++){if(!this.#n[R])continue;const x=this.#je(R);x&&T.push(x)}return T}at(O){const T=this.#oe();if(T)return T.at(O);if(O<0||O>=this.count())return;const R=this.#r?this.#r.at(O):O,x=this.#je(R);return x.index=O,x}byKey(O){const T=this.#oe();if(T)return T.byKey(O);const R=this.#o.get(O);return R===void 0?void 0:this.#je(R)}leavesOf(O){const T=this.#oe();return T&&I(T.leavesOf)?T.leavesOf(O):[]}loaded(O){return O>=0&&O<this.count()}hint(O,T){if(this.#g){this.#g.hint(O,T);return}this.#Ue(),this.#p=Math.max(0,Math.floor(O))}#Ue(){this.#v||this.#qe()===this.#C||this.reload()}display(){const O=this.#oe();return O?O.display():m(()=>this.count(),T=>this.at(T))}apply(O){if(this.#g)return this.#g.apply(O);const T={added:[],updated:[],removed:[]};if(!O)return T;if(O.update){let R=!1;for(const x of O.update){const U=this.#o.get(this.#a.keyOf(x,-1));if(U===void 0)continue;const V=this.#Se(U);this.#x?this.#Le(U,x):this.#n[U]=x,this.#l.delete(U),this.#ye(U,V),this.#T&&(this.#ge(U,x),R=!0),this.#O=!0,T.updated.push(this.#je(U))}R&&this.#Ee()}if(O.add&&O.add.length){const R=this.#ne(O.add);for(const x of R)T.added.push(this.#je(x))}return O.remove&&O.remove.length&&b("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#H(),T}reload(O){this.#c.abortAll("reload"),this.#Ye(),this.#b&&(this.#b.destroy(),this.#b=null),this.#O=!1,this.#n=[],this.#r=null,this.#o.clear(),this.#l.clear(),this.#g=null,this.#S=0,this.#P=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.#C=this.#qe(),this.#Ce("model:changed",{reason:"reload"}),this.start()}destroy(){this.#v=!0,this.#Y!==null&&(clearInterval(this.#Y),this.#Y=null),this.#R!==null&&(clearInterval(this.#R),this.#R=null),this.#T=null,this.#c.abortAll("destroyed"),this.#Ye(),this.#f!==null&&(this.#ke(this.#f),this.#f=null),this.#b&&(this.#b.destroy(),this.#b=null),this.#g&&this.#g.destroy(),this.#n=[],this.#r=null,this.#o.clear(),this.#l.clear()}async start(){if(this.#A||this.#v||!I(this.#e.open))return;this.#A=!0;const O=this.#c.begin("stream");this.#Te(),this.#ue();let T;try{T=this.#e.open({sort:this.#Oe("sort",[]),filters:this.#Oe("filters",null),quick:this.#Oe("quick","")||void 0,context:this.#Oe("context",null),signal:O.signal})}catch(x){this.#Ce("source:error",{error:x});return}const R=I(T[Symbol.asyncIterator])?T[Symbol.asyncIterator]():T[Symbol.iterator]();this.#K=R;try{for(;;){const x=await R.next();if(!O.current||this.#v)return;if(x.done){this.#$();return}if(await this.#xe(x.value,O),!O.current||this.#v)return;if(x.value&&x.value.done){this.#$();return}if(await this.#he(),!O.current||this.#v)return}}catch(x){if(r(x))return;this.#Ce("source:error",{error:x})}finally{O.settle()}}progress(){return{loaded:this.#u.loaded,estimated:this.#u.estimated,done:this.#w,live:this.#S,evicted:this.#P}}promoted(){return this.#g!==null}memorySource(){return this.#g}invalidateHandles(){const O=this.#oe();O&&(I(O.invalidateHandles)&&O.invalidateHandles(),I(O.invalidate)&&O.invalidate("sort"))}renderCount(){return this.#d}ingestStats(){return{worker:this.#U,inline:this.#D,storeBacked:this.#x}}#xe(O,T){if(!O)return;const R=O.rows;if(R&&R.length&&this.#ae(R))return this.#le(O,T);const x=Q();R&&R.length&&(this.#ne(R),this.#D++),this.#Pe(O),this.#h+=Q()-x,this.#H()}#Pe(O){this.#u.loaded=O.progress&&typeof O.progress.loaded=="number"?O.progress.loaded:this.#n.length,O.progress&&typeof O.progress.estimated=="number"&&(this.#u.estimated=O.progress.estimated)}#ae(O){if(this.#X||this.#g)return!1;const T=this.#Z();if(!T)return!1;const R=this.#t.store;if(!R||!I(R.appendPacked))return!1;const x=this.#G();return!x||!f(x)?(this.#X=!0,l("source.stream.ingest-worker","stream ingest.useWorker is on but a column reads through a closure (a computed or date column); columnizing on the main thread instead."),!1):O.length<T.threshold?!1:!this.#Ae(O)}#Ae(O){if(!this.#a.keyed)return!1;const T=new Set;for(let R=0;R<O.length;R++){const x=this.#a.keyOf(O[R],this.#n.length+R);if(x!=null){if(T.has(x)||this.#o.has(x))return!0;T.add(x)}}return!1}async#le(O,T){const R=O.rows,x=this.#Z(),U=this.#G();let V;try{V=await x.columnize(U,R,{key:"ingest:stream",signal:T&&T.signal})}catch(Z){if(r(Z)||(b("source.stream.columnize","worker columnization failed; columnizing on the main thread",Z),this.#X=!0,T&&(!T.current||this.#v)))return;this.#ne(R),this.#D++,this.#Pe(O),this.#H();return}if(T&&(!T.current||this.#v))return;const J=this.#t.store,_=this.#x?void 0:R,{from:ee}=J.appendPacked(V,_),W=V.count|0;for(let Z=0;Z<W;Z++){const ne=ee+Z,ie=R[Z],ce=this.#a.keyed?this.#a.keyOf(ie,ne):null;if(this.#n[ne]=this.#x?k:ie,this.#S++,this.#ge(ne,ie),ce!==null&&this.#o.set(ce,ne),!this.#r||!this.#we(ne))continue;const me=this.#de(ne);this.#r.insert(me,ne),me<=this.#p&&this.#m++}this.#O=!0,this.#Ee(),this.#U++,this.#Pe(O),this.#H()}#Z(){const O=this.#t.ingestWorker;return I(O)?O():null}#G(){const O=this.#t.storeSchema;return I(O)?O():null}#ne(O){const T=[],R=this.#t.store,x=new Array(O.length),U=[],V=new Set;for(let _=0;_<O.length;_++){const ee=this.#a.keyed?this.#a.keyOf(O[_],this.#n.length+U.length):null;x[_]=ee,!(ee!==null&&(this.#o.has(ee)||V.has(ee)))&&(ee!==null&&V.add(ee),U.push(O[_]))}let J=U.length&&R&&I(R.append)?R.append(U).from:this.#n.length;for(let _=0;_<O.length;_++){const ee=O[_],W=x[_];if(W!==null&&this.#o.has(W)){const ie=this.#o.get(W),ce=this.#Se(ie);this.#x||(this.#n[ie]=ee,R&&I(R.setSource)&&R.setSource(ie,ee)),this.#Le(ie,ee),this.#l.delete(ie),this.#ge(ie,ee),this.#ye(ie,ce);continue}const Z=J++;if(this.#n[Z]=this.#x?k:ee,this.#S++,this.#ge(Z,ee),W!==null&&this.#o.set(W,Z),T.push(Z),!this.#r||!this.#we(Z))continue;const ne=this.#de(Z);this.#r.insert(ne,Z),ne<=this.#p&&this.#m++}return this.#O=!0,this.#Ee(),T}#B(O){const T=this.#n[O];let R=!1;if(this.#r){const J=this.#be(O);J>=0&&J<=this.#p&&(R=!0)}else O<=this.#p&&(R=!0);const x=T===k?this.#ee(O):T,U=this.#a.keyed?this.#a.keyOf(x,O):null;U!==null&&this.#o.get(U)===O&&this.#o.delete(U),this.#n[O]=void 0,this.#T&&(this.#T[O]=NaN),this.#l.delete(O);const V=this.#t.store;return V&&I(V.remove)&&V.remove(O),this.#S--,R}#Ee(){let O=0,T=0;const R=this.#pe();O+=R.dropped,T+=R.aboveAnchor;const x=this.#re();O+=x.dropped,T+=x.aboveAnchor,O&&(this.#O=!0,this.#P+=O,this.#Te(),this.#m-=T,this.#Ce("stream:evicted",{evicted:O,total:this.#P,live:this.#S}))}#re(){const O=this.#e.maxRows;if(!Number.isFinite(O)||O<=0||this.#S<=O)return{dropped:0,aboveAnchor:0};const T=Math.max(1,Math.floor(O*(1-G)));let R=0,x=0;for(;this.#S>T&&this.#E<this.#n.length;){const U=this.#E++;this.#n[U]!==void 0&&(this.#B(U)&&x++,R++)}return{dropped:R,aboveAnchor:x}}#pe(){const O=this.#V();if(!O||!this.#T||!this.#W())return{dropped:0,aboveAnchor:0};const T=Date.now()-O;let R=0,x=0,U=1/0;for(let V=this.#E;V<this.#n.length;V++){if(this.#n[V]===void 0)continue;const J=this.#T[V];if(!(Number.isNaN(J)||J===void 0)){if(J>=T){J<U&&(U=J);continue}this.#B(V)&&x++,R++}}for(this.#M=U,this.#N=!1;this.#E<this.#n.length&&this.#n[this.#E]===void 0;)this.#E++;return{dropped:R,aboveAnchor:x}}#be(O){if(!this.#r)return O;for(let T=0;T<this.#r.length;T++)if(this.#r.at(T)===O)return T;return-1}#Te(){this.#s=this.#Oe("sort",[]),this.#i=this.#Oe("filters",null);const O=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#V()>0,T=this.#Oe("where",null),R=(this.#t.config||{}).hostFilter,x=!!(T&&T.active)||!!(R&&I(R.active)&&R.active());if(!(O||this.#s.length>0||!!this.#i||!!this.#Oe("quick","")||x)){this.#r=null;return}this.#r=new a(Math.max(64,this.#n.length+64));for(let V=0;V<this.#n.length;V++)this.#n[V]!==void 0&&this.#we(V)&&this.#r.insert(this.#de(V),V)}#we(O){const T=this.#ee(O);if(this.#i&&!this.#ve(this.#i,T))return!1;const R=String(this.#Oe("quick","")||"").toLowerCase();if(R&&!this.#k(T).includes(R))return!1;const x=(this.#t.config||{}).hostFilter;if(x&&I(x.active)&&x.active()&&!x.passes(this.#je(O)))return!1;const U=this.#Oe("where",null);if(U&&U.active){const V=this.#je(O);if(!U.passes(V.data,V.key))return!1}return!0}#ve(O,T){if(!O)return!0;const R=O;if(Array.isArray(R.conditions))return R.op==="or"?R.conditions.some(V=>this.#ve(V,T)):R.op==="not"?!R.conditions.some(V=>this.#ve(V,T)):R.conditions.every(V=>this.#ve(V,T));const x=O,U=(this.#t.compute||{}).testValue;return I(U)?!!U(this.#Ve(T,x.col),x,(this.#t.config||{}).locale):(b("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#Se(O){if(!this.#r)return-1;if(!this.#s.length)return this.#be(O);let T=0,R=this.#r.length;for(;T<R;){const x=T+R>>>1;this.#Q(this.#r.at(x),O)<0?T=x+1:R=x}for(let x=T;x<this.#r.length;x++){const U=this.#r.at(x);if(U===O)return x;if(this.#Q(U,O)>0)break}return this.#be(O)}#ye(O,T){if(!this.#r||!this.#s.length)return;const R=this.#we(O);if(T>=0&&this.#r.at(T)===O)this.#r.removeAt(T),T<=this.#p&&this.#m--;else if(T>=0)return;if(!R)return;const x=this.#de(O);this.#r.insert(x,O),x<=this.#p&&this.#m++}#de(O){if(!this.#r||!this.#s.length)return this.#r?this.#r.length:0;let T=0,R=this.#r.length;for(;T<R;){const x=T+R>>>1;this.#Q(O,this.#r.at(x))<0?R=x:T=x+1}return T}#Q(O,T){const R=this.#ee(O),x=this.#ee(T);for(const U of this.#s){const V=this.#Fe(U.col),J=this.#Ve(R,U.col),_=this.#Ve(x,U.col),W=(V&&V.value&&I(V.value.compare)?V.value.compare:j)(J,_);if(W!==0)return U.dir==="desc"?-W:W}return 0}#$(){this.#w=!0,this.#u.loaded=this.#u.loaded||this.#n.length;const O=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:w;!this.#x&&this.#n.length<O&&(this.#g=h({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.#Ce("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:O})}#H(){this.#f!==null||this.#v||(this.#f=this.#F(()=>{this.#f=null,this.#d++;const O=this.#m;this.#m=0,this.#h=0,this.#Ce("stream:chunk",{loaded:this.#u.loaded,estimated:this.#u.estimated,count:this.count(),renders:this.#d}),this.#Ce("model:changed",{reason:"stream",shiftAboveViewport:O,anchor:this.#p}),this.#Ce("rows:changed",{companion:!0,reason:"stream"})}))}#he(){return this.#d===0||this.#h<this.#se()?Promise.resolve():(this.#h=0,new Promise(O=>{const T=(this.#t.scheduler||{}).idle;I(T)?T(()=>O()):X(()=>O())}))}#se(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:P}#F(O){const T=this.#t.scheduler||{};return I(T.frame)?T.frame(O):H(O)}#ke(O){const T=this.#t.scheduler||{};I(T.cancel)?T.cancel(O):$(O)}#ee(O){const T=this.#n[O];if(T!==void 0&&T!==k)return T;if(T===void 0)return;const R=this.#t.store;return R&&I(R.source)?R.source(O):void 0}#Le(O,T){const R=this.#t.store;if(!R||!I(R.set))return;const x=this.#G();if(Array.isArray(x))for(const U of x){if(!U||!U.id)continue;const V=I(U.read)?U.read:J=>o(J,U.field||U.id);R.set(U.id,O,V(T))}}#je(O){let T=this.#l.get(O);return T||(T=this.#a.leaf(this.#ee(O),O),this.#l.set(O,T)),T}#Ve(O,T){const R=this.#Fe(T);return R&&I(R.getValue)?R.getValue(O):O?.[T]}#k(O){const T=this.#t.columns,R=T&&I(T.all)?T.all():[],x=[];for(const U of R){const V=I(U.getValue)?U.getValue(O):void 0;V!=null&&V!==""&&x.push(String(V))}return x.join(" ").toLowerCase()}#Fe(O){const T=this.#t.columns;return T&&I(T.get)?T.get(O):void 0}#Ye(){const O=this.#K;if(this.#K=null,O&&I(O.return))try{O.return()}catch{}}#qe(){return y({context:this.#Oe("context",null)})}#Oe(O,T){const R=this.#t.state;if(R&&I(R[O])){const x=R[O]();return x??T}return T}#Ce(O,T){const R=this.#t.emit;I(R)&&R(O,T)}}}),Ve("packages/core/src/source/url.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return b}});const A=D("packages/core/src/internal/warn.js").warnOnce,Y=D("packages/core/src/internal/predicates.js"),I=Y.isObject,L=Y.isFunction,H=D("packages/core/src/internal/paths.js").getPath,X=D("packages/core/src/source/abort.js").isAbortError,F=500,j=new Set(["application/x-ndjson","application/ndjson","application/jsonlines","application/jsonl","application/x-jsonlines","text/x-ndjson"]),v=Symbol("lattice.url.skip");function b(p,y={}){const d=I(y)?y:{},f=L(d.fetch)?d.fetch:typeof globalThis<"u"&&L(globalThis.fetch)?globalThis.fetch:null,w=d.format==="json"||d.format==="ndjson"?d.format:void 0,k=typeof d.rowsPath=="string"&&d.rowsPath?d.rowsPath:void 0,P=L(d.map)?d.map:void 0,G=I(d.headers)?d.headers:void 0,K=Number.isFinite(d.batchSize)&&d.batchSize>0?Math.floor(d.batchSize):F,q=d.lenient===!0,B=Number.isFinite(d.poll)&&d.poll>0?Math.floor(d.poll):void 0,E=typeof p=="string"&&p.length>0;E||A("source.url.url","createUrlSource needs a URL string; the grid will stay empty.");async function*S(N={}){if(!E)return;if(!f)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const O=N&&N.signal;let T;try{T=await f(p,G?{signal:O,headers:G}:{signal:O})}catch(U){throw X(U)?U:new Error(`[lattice] createUrlSource: request to ${p} failed — ${U&&U.message||U}`)}if(!T||!T.ok){const U=T?T.status:"no response";throw new Error(`[lattice] createUrlSource: ${U} for ${p}`)}const R=l(p,w,T),x=T.body&&L(T.body.getReader)?T.body.getReader():null;try{if(!x){const J=await T.text();(R||t(J,p))==="ndjson"?yield*c(null,null,J,0,T,p,K,q):yield*m(J,p,k,P);return}const U=new TextDecoder("utf-8");if(R==="json"){yield*m(await n(x,U,""),p,k,P);return}if(R==="ndjson"){yield*c(x,U,"",0,T,p,K,q);return}const V=await s(x,U,p);V.format==="json"?yield*m(await n(x,U,V.seed),p,k,P):yield*c(x,U,V.seed,V.bytes,T,p,K,q)}finally{if(x&&L(x.cancel))try{await x.cancel()}catch{}}}const C={mode:"stream",open:S,autoStart:d.autoStart!==!1};return B!==void 0&&(C.poll=B),Number.isFinite(d.maxRows)&&(C.maxRows=d.maxRows),Number.isFinite(d.maxAge)&&(C.maxAge=d.maxAge),(typeof d.ageBy=="string"||L(d.ageBy))&&(C.ageBy=d.ageBy),Number.isFinite(d.coalesceMs)&&(C.coalesceMs=d.coalesceMs),Number.isFinite(d.promoteToMemoryBelow)&&(C.promoteToMemoryBelow=d.promoteToMemoryBelow),C}function l(p,y,d){if(y)return y;const f=g(p);if(f)return f;const w=d&&d.headers&&L(d.headers.get)?d.headers.get("content-type"):null;return o(w)}function g(p){const y=String(p).split(/[?#]/)[0].toLowerCase();if(y.endsWith(".ndjson")||y.endsWith(".jsonl"))return"ndjson";if(y.endsWith(".json"))return"json"}function o(p){if(!p)return;const y=p.split(";")[0].trim().toLowerCase();if(j.has(y))return"ndjson";if(y==="application/json"||y==="text/json"||y.endsWith("+json"))return"json"}function t(p,y){const d=p.replace(/^\s+/,""),f=r(d);if(f==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${y} — pass opts.format: 'json' | 'ndjson'.`);return f}async function s(p,y,d){let f="",w=0;for(;;){const{value:P,done:G}=await p.read();if(P&&(w+=P.byteLength,f+=y.decode(P,{stream:!0})),G){f+=y.decode();break}const K=f.replace(/^\s+/,"");if(K){if(K[0]==="[")return{format:"json",seed:f,bytes:w};if(K[0]!=="{"||f.indexOf(`
|
|
7
|
+
`||m==="\r"){n++;continue}if(m>="0"&&m<="9"){n=v(r,n,i);continue}if(m==="."&&r[n+1]>="0"&&r[n+1]<="9"){n=v(r,n,i);continue}if(m==='"'||m==="'"){n=b(r,n,i);continue}if(m==="["){const a=r.indexOf("]",n+1);if(a<0)throw new X("a [column reference] was opened and never closed",n);i.push({kind:Y,value:r.slice(n+1,a).trim(),at:n}),n=a+1;continue}if(j(m)){n=l(r,n,i);continue}const c=r.slice(n,n+2);if(H.includes(c)){i.push({kind:L,value:c==="!="?"<>":c,at:n}),n+=2;continue}if($.includes(m)){i.push({kind:L,value:m,at:n}),n++;continue}throw new X(`unexpected character ${JSON.stringify(m)}`,n)}return i.push({kind:Q,value:null,at:r.length}),i}function j(r){return/[A-Za-z_À-]/.test(r)}function v(r,i,n){let m=i,c=!1;for(;m<r.length;){const a=r[m];if(a>="0"&&a<="9"){m++;continue}if(a==="."&&!c){c=!0,m++;continue}if((a==="e"||a==="E")&&/[0-9+-]/.test(r[m+1]||"")){for(m+=2;m<r.length&&r[m]>="0"&&r[m]<="9";)m++;break}break}return n.push({kind:re,value:Number(r.slice(i,m)),at:i}),m}function b(r,i,n){const m=r[i];let c=i+1,a="";for(;c<r.length;){if(r[c]===m){if(r[c+1]===m){a+=m,c+=2;continue}return n.push({kind:A,value:a,at:i}),c+1}a+=r[c],c++}throw new X("a string was opened and never closed",i)}function l(r,i,n){let m=i;for(;m<r.length&&/[A-Za-z0-9_.À-]/.test(r[m]);)m++;const c=r.slice(i,m);let a=m;for(;a<r.length&&r[a]===" ";)a++;return n.push({kind:r[a]==="("?I:Y,value:c,at:i}),m}const g={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function o(r){const i=String(r??"").replace(/^\s*=/,"");if(!i.trim())throw new X("the formula is empty");const n=F(i);let m=0;const c=()=>n[m],a=()=>n[m++],u=k=>{const P=c();if(P.kind!==L||P.value!==k)throw new X(`expected ${JSON.stringify(k)}`,P.at);m++},h=k=>{let P=p();for(;;){const G=c();if(G.kind!==L)break;const K=g[G.value];if(!K||K<k)break;m++;const q=h(G.value==="^"?K:K+1);P={kind:"bin",op:G.value,left:P,right:q}}return P},p=()=>{const k=c();return k.kind===L&&(k.value==="-"||k.value==="+")?(m++,{kind:"unary",op:k.value,arg:p()}):y()},y=()=>{let k=d();for(;c().kind===L&&c().value==="%";)m++,k={kind:"unary",op:"%",arg:k};return k},d=()=>{const k=a();if(k.kind===re)return{kind:"num",value:k.value};if(k.kind===A)return{kind:"str",value:k.value};if(k.kind===Y)return{kind:"ref",name:k.value};if(k.kind===I){u("(");const P=[];if(!(c().kind===L&&c().value===")"))for(;;){if(P.push(h(1)),c().kind===L&&c().value===","){m++;continue}break}return u(")"),{kind:"call",name:String(k.value).toUpperCase(),args:P}}if(k.kind===L&&k.value==="("){const P=h(1);return u(")"),P}throw k.kind===Q?new X("the formula ends unexpectedly",k.at):new X(`unexpected ${JSON.stringify(k.value)}`,k.at)},f=h(1),w=c();if(w.kind!==Q)throw new X(`unexpected ${JSON.stringify(w.value)}: is an operator missing?`,w.at);return f}function t(r){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(r),[...i]}function s(r){return typeof r=="string"&&/^\s*=/.test(r)&&r.trim()!=="="}}),Ve("packages/core/src/formula/evaluate.js",function(e,D){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return v}});const A=D("packages/core/src/formula/parse.js").FormulaError;function Y(b){if(b==null||b==="")return 0;if(typeof b=="boolean")return b?1:0;if(b instanceof Date)return b.getTime();const l=typeof b=="number"?b:Number(String(b).replace(/[,\s]/g,""));if(!Number.isFinite(l))throw new A(`${JSON.stringify(b)} is not a number`);return l}function I(b){return b==null?"":String(b)}function L(b){if(typeof b=="boolean")return b;if(b==null||b==="")return!1;if(typeof b=="number")return b!==0;const l=String(b).trim().toLowerCase();return l==="false"||l==="no"||l==="0"?!1:l!==""}function Q(b){const l=[];for(const g of b){if(Array.isArray(g)){for(const o of g)o!=null&&o!==""&&l.push(Y(o));continue}g==null||g===""||l.push(Y(g))}return l}function H(b,l){const g=10**l,o=b*g;return Math.sign(o)*Math.round(Math.abs(o)+Number.EPSILON*Math.abs(o))/g}function $(b,l){if(!b.length)return 0;const g=b.slice().sort((r,i)=>r-i),o=(g.length-1)*Math.min(1,Math.max(0,l)),t=Math.floor(o),s=Math.ceil(o);return t===s?g[t]:g[t]+(o-t)*(g[s]-g[t])}function X(b,l){let g=0,o=0,t=0;for(const r of b){g++;const i=r-o;o+=i/g,t+=i*(r-o)}const s=l?g-1:g;return s>0?Math.sqrt(t/s):0}const F={SUM:b=>Q(b).reduce((l,g)=>l+g,0),AVERAGE:b=>{const l=Q(b);return l.length?l.reduce((g,o)=>g+o,0)/l.length:0},MIN:b=>{const l=Q(b);return l.length?Math.min(...l):0},MAX:b=>{const l=Q(b);return l.length?Math.max(...l):0},COUNT:b=>Q(b).length,PRODUCT:b=>Q(b).reduce((l,g)=>l*g,1),ROUND:b=>H(Y(b[0]),b.length>1?Y(b[1]):0),ROUNDDOWN:b=>{const l=10**(b.length>1?Y(b[1]):0),g=Y(b[0])*l;return(g<0?Math.ceil(g):Math.floor(g))/l},ROUNDUP:b=>{const l=10**(b.length>1?Y(b[1]):0),g=Y(b[0])*l;return(g<0?Math.floor(g):Math.ceil(g))/l},ABS:b=>Math.abs(Y(b[0])),FLOOR:b=>Math.floor(Y(b[0])),CEILING:b=>Math.ceil(Y(b[0])),SQRT:b=>Math.sqrt(Y(b[0])),POWER:b=>Y(b[0])**Y(b[1]),MOD:b=>{const l=Y(b[1]);if(l===0)throw new A("MOD by zero");return(Y(b[0])%l+l)%l},IF:b=>L(b[0])?b[1]:b.length>2?b[2]:!1,AND:b=>b.every(L),OR:b=>b.some(L),NOT:b=>!L(b[0]),COALESCE:b=>b.find(l=>l!=null&&l!=="")??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?Y(b[1]):1),RIGHT:b=>{const l=b.length>1?Y(b[1]):1;return l<=0?"":I(b[0]).slice(-l)},MEDIAN:b=>$(Q(b),.5),PERCENTILE:b=>{const l=Y(b[b.length-1]);return $(Q(b.slice(0,-1)),l>1?l/100:l)},QUARTILE1:b=>$(Q(b),.25),QUARTILE3:b=>$(Q(b),.75),STDEV:b=>X(Q(b),!0),STDEVP:b=>X(Q(b),!1),VAR:b=>{const l=X(Q(b),!0);return l*l},VARP:b=>{const l=X(Q(b),!1);return l*l},COUNTDISTINCT:b=>{const l=new Set;for(const g of b){const o=Array.isArray(g)?g:[g];for(const t of o)t!=null&&t!==""&&l.add(t)}return l.size},IQR:b=>{const l=Q(b);return $(l,.75)-$(l,.25)}};F.AVG=F.AVERAGE,F.CEIL=F.CEILING,F.POW=F.POWER,F.STDEVS=F.STDEV,F.PERCENTILEINC=F.PERCENTILE;function j(b,l){const g=Number(b),o=Number(l);if(b!==null&&b!==""&&l!==null&&l!==""&&Number.isFinite(g)&&Number.isFinite(o))return g<o?-1:g>o?1:0;const s=I(b).toLowerCase(),r=I(l).toLowerCase();return s<r?-1:s>r?1:0}function v(b,l={}){const g=typeof l.lookup=="function"?l.lookup:null,o=l.functions?{...F,...l.functions}:F,t=s=>{switch(s.kind){case"num":return s.value;case"str":return s.value;case"ref":{if(!g)throw new A(`there is no column called ${JSON.stringify(s.name)} here`);const r=g(String(s.name));if(r===void 0)throw new A(`there is no column called ${JSON.stringify(s.name)}`);return r}case"unary":{if(s.op==="%")return Y(t(s.arg))/100;const r=Y(t(s.arg));return s.op==="-"?-r:r}case"bin":{const r=s.op;if(r==="=")return j(t(s.left),t(s.right))===0;if(r==="<>")return j(t(s.left),t(s.right))!==0;if(r==="<")return j(t(s.left),t(s.right))<0;if(r==="<=")return j(t(s.left),t(s.right))<=0;if(r===">")return j(t(s.left),t(s.right))>0;if(r===">=")return j(t(s.left),t(s.right))>=0;const i=Y(t(s.left)),n=Y(t(s.right));if(r==="+")return i+n;if(r==="-")return i-n;if(r==="*")return i*n;if(r==="^")return i**n;if(r==="/"){if(n===0)throw new A("division by zero");return i/n}throw new A(`unknown operator ${JSON.stringify(r)}`)}case"call":{const r=l.lazy&&l.lazy[s.name];if(typeof r=="function")return r(s.args,t,l);const i=o[s.name];if(typeof i!="function")throw new A(`there is no function called ${s.name}`);return i(s.args.map(t),l)}default:throw new A("the formula could not be read")}};return t(b)}}),Ve("packages/core/src/formula/index.js",function(e,D){"use strict";Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return j}});const re=D("packages/core/src/formula/parse.js"),A=re.parseFormula,Y=re.referencesOf,I=re.looksLikeFormula,L=re.FormulaError,Q=re.tokenise,H=D("packages/core/src/formula/evaluate.js"),$=H.evaluateAst,X=H.FUNCTIONS;function F(v){const{grid:b,row:l,data:g}=v||{},o=n=>String(n).toLowerCase().replace(/[\s_-]/g,""),t=b&&b.columns&&typeof b.columns.all=="function"?b.columns.all():[],s=b&&b.permissions,r=s&&typeof s.isReadable=="function"?n=>s.isReadable(n):()=>!0,i=new Set;for(const n of t)r(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 L(`"${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 l&&b.rows&&typeof b.rows.value=="function"?b.rows.value(l.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(!r(c))throw new L(`"${n}" cannot be read`);return g[c]}}}}function j(v,b={}){try{const l=A(v);return{ok:!0,value:$(l,{lookup:F(b),functions:b.formulaFunctions}),references:Y(l)}}catch(l){return{ok:!1,error:l instanceof L?l.message:"the formula could not be read",at:l instanceof L?l.at:void 0}}}}),Ve("packages/core/src/internal/version.js",function(e,D){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return Y}});const re="1.117.3";async function A(){return re}const Y="1.117.3"}),Ve("packages/core/src/internal/merge.js",function(e,D){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return Y}}),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 H}});const A=D("packages/core/src/internal/predicates.js").isObject;function Y($,X,F){if($!==void 0)return $===!0?{enabled:!0,...F}:$===!1?{enabled:!1}:A($)?$:{[X]:$,enabled:!0}}function I($){return $==null?[]:Array.isArray($)?$:[$]}const L=Object.freeze(new Set(["__proto__","constructor","prototype"]));function Q($,X){if(!A($))return A(X)?{...X}:X;if(!A(X))return X===void 0?$:X;const F={...$};for(const j of Object.keys(X)){if(L.has(j))continue;const v=X[j];v!==void 0&&(F[j]=A(v)&&A(F[j])?Q(F[j],v):v)}return F}function H($,X){if(!A($)||!A(X)||$===X)return X;const F=Object.create(Object.getPrototypeOf($));return Object.assign(F,$,X),F}}),Ve("packages/core/src/internal/schedule.js",function(e,D){"use strict";Object.defineProperty(e,"now",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"nextFrame",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return H}});function re(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const A=typeof requestAnimationFrame=="function";function Y($){return A?requestAnimationFrame($):setTimeout(()=>$(re()),16)}function I($){$!=null&&(A?cancelAnimationFrame($):clearTimeout($))}function L($){let X=null,F=null;const j=()=>{X=null;const b=F;F=null,$(...b||[])},v=(...b)=>{F=b,X===null&&(X=Y(j))};return v.cancel=()=>{I(X),X=null,F=null},v.flush=()=>{X!==null&&(I(X),j())},v}function Q($,X){let F=null,j=null;const v=()=>{if(F=null,j===null)return;const g=j;j=null,$(...g),b()},b=()=>{F=setTimeout(v,X),typeof F?.unref=="function"&&F.unref()},l=(...g)=>{F===null?($(...g),b()):(j=g,clearTimeout(F),b())};return l.flush=()=>{if(F!==null&&clearTimeout(F),F=null,j===null)return;const g=j;j=null,$(...g)},l.cancel=()=>{F!==null&&clearTimeout(F),F=null,j=null},l.pending=()=>F!==null||j!==null,l}function H($,X=50){return typeof requestIdleCallback=="function"?requestIdleCallback($,{timeout:X}):setTimeout(()=>$({timeRemaining:()=>0,didTimeout:!0}),1)}}),Ve("packages/core/src/internal/paths.js",function(e,D){"use strict";Object.defineProperty(e,"pathGetter",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"pathSetter",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"getPath",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return Q}});const re=new Map;function A(H){let $=re.get(H);if($)return $;if(!H.includes("."))$=X=>X?.[H];else{const X=H.split("."),F=X.length;$=j=>{let v=j;for(let b=0;b<F;b++){if(v==null)return;v=v[X[b]]}return v}}return re.set(H,$),$}const Y=new Map;function I(H){let $=Y.get(H);if($)return $;if(!H.includes("."))$=(X,F)=>{X!=null&&(X[H]=F)};else{const X=H.split("."),F=X.length-1;$=(j,v)=>{let b=j;for(let l=0;l<F;l++){if(b==null)return;const g=X[l];b[g]==null&&(b[g]={}),b=b[g]}b!=null&&(b[X[F]]=v)}}return Y.set(H,$),$}function L(H,$){return A($)(H)}function Q(H,$,X){I($)(H,X)}}),Ve("packages/core/src/internal/compare.js",function(e,D){"use strict";Object.defineProperty(e,"collator",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"defaultCompare",{enumerable:!0,get:function(){return Y}});const re=new Map;function A(I,L){const Q=`${I||""}|${L?JSON.stringify(L):""}`;let H=re.get(Q);return H||(H=new Intl.Collator(I||void 0,{numeric:!0,sensitivity:"variant",...L}),re.set(Q,H)),H}function Y(I,L){if(I===L)return 0;if(I==null)return 1;if(L==null)return-1;if(typeof I=="number"&&typeof L=="number")return Number.isNaN(I)?Number.isNaN(L)?0:1:Number.isNaN(L)||I<L?-1:I>L?1:0;const Q=String(I),H=String(L);return Q<H?-1:Q>H?1:0}}),Ve("packages/core/src/defaults.js",function(e,D){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return j}});const A=D("packages/core/src/internal/predicates.js").isObject,I=D("packages/core/src/internal/merge.js").merge,Q=D("packages/core/src/internal/warn.js").warnOnce;let H=null;class $ extends Error{}function X(v,b=new Set){if(Array.isArray(v)){if(b.has(v))throw new $;b.add(v);const g=v.map(o=>X(o,b));return b.delete(v),g}if(!A(v)||Object.getPrototypeOf(v)!==Object.prototype&&Object.getPrototypeOf(v)!==null)return v;if(b.has(v))throw new $;b.add(v);const l={};for(const[g,o]of Object.entries(v))l[g]=X(o,b);return b.delete(v),l}function F(v){if(v===void 0)return X(H??{});if(v===null)return H=null,{};if(!A(v))return Q("defaults:type",`defaults() expects a configuration object, or null to clear it, but got ${Array.isArray(v)?"an array":typeof v}. The call was ignored and the defaults are unchanged.`),X(H??{});try{H=X(v)}catch(b){if(!(b instanceof $))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."),X(H??{})}return X(H)}function j(v){return H===null?v:I(X(H),v)}}),Ve("packages/core/src/internal/uid.js",function(e,D){"use strict";Object.defineProperty(e,"uid",{enumerable:!0,get:function(){return A}});let re=0;function A(Y="l"){return`${Y}${(++re).toString(36)}`}}),Ve("packages/core/src/events/names.js",function(e,D){"use strict";Object.defineProperty(e,"EVENT_NAMES",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"isKnownEvent",{enumerable:!0,get:function(){return Y}});const re=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"]),A=new Set(re);function Y(I){return I==="*"||A.has(I)}}),Ve("packages/core/src/events/bus.js",function(e,D){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return g}});const re=D("packages/core/src/internal/warn.js"),A=re.warnOnce,Y=re.DEV,L=D("packages/core/src/internal/uid.js").uid,H=D("packages/core/src/events/names.js").isKnownEvent,$="*";function X(o,t){!Y||H(t)||A(`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 F=new Set(["api","user","init","ai"]),j=new WeakMap;function v(o){let t=j.get(o);return t||(t=L("h"),j.set(o,t)),t}function b(){return typeof performance=="object"&&performance?performance.now():Date.now()}function l(o){if(!o||typeof o!="object")return{};const t={};for(const[s,r]of Object.entries(o))s!=="grid"&&(r==null?t[s]=String(r):Array.isArray(r)?t[s]=`[${r.length}]`:typeof r=="object"?t[s]=r.key?`row ${r.key}`:"{…}":typeof r=="function"?t[s]="[function]":t[s]=String(r).slice(0,60));return t}class g{#e=new Map;#t=!1;#n=[];#r=200;#s=new Map;#i=null;#a=!1;#l=0;constructor(t=null){this.#i=t}attach(t){this.#i=t}get grid(){return this.#i}get destroyed(){return this.#a}on(t,s){if(typeof s!="function")return A(`bus.handler:${t}`,`on('${t}') needs a function; ignored.`),()=>{};X("on",t);let r=this.#e.get(t);return r||(r=[],this.#e.set(t,r)),r.push(s),()=>this.off(t,s)}once(t,s){if(typeof s!="function")return A(`bus.handler:${t}`,`once('${t}') needs a function; ignored.`),()=>{};X("once",t);const r=i=>{this.off(t,s),s(i)};return this.#s.set(s,r),this.on(t,r)}off(t,s){if(s===void 0){this.#e.delete(t);return}const r=this.#e.get(t);if(!r)return;const i=this.#s.get(s),n=i&&r.includes(i)?i:s,m=r.indexOf(n);m>=0&&r.splice(m,1),i&&n===i&&this.#s.delete(s),r.length===0&&this.#e.delete(t)}count(t){const s=this.#e.get(t),r=t===$?null:this.#e.get($);return(s?s.length:0)+(r?r.length:0)}#o(t,s,r,i,n){this.#n.push({type:t,origin:s,listeners:(i?i.length:0)+(n?n.length:0),payload:l(r),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(t,s){this.#t=!!t,Number.isFinite(s)&&s>0&&(this.#r=Math.floor(s)),t||(this.#n=[])}eventLog(){return this.#n.map(t=>({...t}))}clearEventLog(){this.#n=[]}counts(){const t={};for(const[s,r]of this.#e)t[s]=r.length;return t}emit(t,s,r){const i=r??(s&&s.origin),n=F.has(i)?i:"api",m={...s||null,type:t,origin:n,grid:this.#i};if(this.#a)return m;const c=this.#e.get(t),a=t===$?void 0:this.#e.get($);if(this.#t&&this.#o(t,n,s,c,a),!c&&!a)return m;const u=this.#t?b():0;this.#l++;try{c&&this.#c(c.slice(),m,t),a&&this.#c(a.slice(),m,$)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=b()-u)}return m}emitBefore(t,s,r){const i=r??(s&&s.origin),n=F.has(i)?i:"user";let m=!1,c=null;const a=f=>{m=!0,f!=null&&c===null&&(c=String(f))},u={...s||null,type:t,origin:n,grid:this.#i,get defaultPrevented(){return m},get reason(){return c},preventDefault(f){a(f)}};if(this.#a)return!0;const h=this.#e.get(t);this.#t&&this.#o(t,n,s,h,void 0);const p=h?h.slice():[];if(p.length===0)return!0;const y=()=>(m&&c===null&&(c="prevented"),m&&s&&typeof s=="object"&&(s.reason=c),!m),d=[];for(const f of p)try{const w=f(u);w&&typeof w.then=="function"?d.push(w):w===!1&&a("prevented")}catch(w){a("error"),A(`bus.beforeThrow:${t}:${v(f)}`,`a '${t}' before-handler threw; the action was cancelled.`,w)}return d.length===0?y():Promise.allSettled(d).then(f=>{for(const w of f)w.status==="rejected"?(a("error"),A(`bus.beforeReject:${t}`,`a '${t}' before-handler rejected; the action was cancelled.`,w.reason)):w.value===!1&&a("prevented");return y()})}#c(t,s,r){for(let i=0;i<t.length;i++)try{t[i](s)}catch(n){A(`bus.throw:${r}:${v(t[i])}`,`a '${r}' handler threw; other handlers were unaffected.`,n)}}clear(){this.#e.clear(),this.#s.clear()}destroy(){this.clear(),this.#a=!0,this.#i=null}}}),Ve("packages/core/src/registry/free-tier-notice.js",function(e,D){"use strict";Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"WATERMARK_TEXT",{enumerable:!0,get:function(){return A}});const re="Free for non-commercial use: latticegrid.dev/free",A="Unlicensed: Lattice Grid trial"}),Ve("packages/core/src/registry/licence.js",function(e,D){"use strict";Object.defineProperty(e,"PRODUCT",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"LICENCE_VERSION",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"fromBase64Url",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"toBase64Url",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"asciiBytes",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"parseLicence",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"hasEd25519",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"verifyLicence",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"isLocalHost",{enumerable:!0,get:function(){return h}}),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 f}}),Object.defineProperty(e,"setLicence",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return E}});const A=D("packages/core/src/internal/warn.js").warnOnce,Y=D("packages/core/src/registry/free-tier-notice.js"),I=Y.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return Y.FREE_TIER_NOTICE}});const L="lattice-grid",Q=1,H="LG1",$=64,X="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",F="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",j=(()=>{const S=new Int16Array(128).fill(-1);for(let C=0;C<F.length;C++)S[F.charCodeAt(C)]=C;return S[43]=62,S[47]=63,S})();function v(S){if(typeof S!="string")return null;let C="";for(let U=0;U<S.length;U++){const V=S.charCodeAt(U);if(V!==61){if(V>127||j[V]<0)return null;C+=S[U]}}const N=C.length;if(N%4===1)return null;const O=new Uint8Array(Math.floor(N*3/4));let T=0,R=0,x=0;for(let U=0;U<N;U++)T=T<<6|j[C.charCodeAt(U)],R+=6,R>=8&&(R-=8,O[x++]=T>>R&255);return x===O.length?O:O.subarray(0,x)}function b(S){let C="",N=0;for(;N+2<S.length;N+=3){const T=S[N]<<16|S[N+1]<<8|S[N+2];C+=F[T>>18&63]+F[T>>12&63]+F[T>>6&63]+F[T&63]}const O=S.length-N;if(O===1){const T=S[N]<<16;C+=F[T>>18&63]+F[T>>12&63]}else if(O===2){const T=S[N]<<16|S[N+1]<<8;C+=F[T>>18&63]+F[T>>12&63]+F[T>>6&63]}return C}function l(S){const C=new Uint8Array(S.length);for(let N=0;N<S.length;N++)C[N]=S.charCodeAt(N)&127;return C}function g(S){if(typeof TextDecoder=="function")return new TextDecoder().decode(S);let C="";for(let N=0;N<S.length;N++)C+=String.fromCharCode(S[N]);return C}function o(S){const C={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof S=="string"?S:""};if(typeof S!="string"||S.length===0)return{...C,reason:"missing"};const N=S.trim(),O=N.split(".");if(O.length!==3)return C;const[T,R,x]=O;if(T!==H)return{...C,reason:"prefix"};const U=v(R),V=v(x);if(!U||!V)return C;let J;try{J=JSON.parse(g(U))}catch{return C}return J===null||typeof J!="object"?C:{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:l(R),signature:V,raw:N}}function t(S,C){if(!S)return!1;const N=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(S)?`${S}T23:59:59.999Z`:S);return Number.isNaN(N)?!0:C>N}function s(S){return S==="non-commercial"?"non-commercial":"commercial"}let r=null,i=null,n=null;function m(){const S=globalThis.crypto;return S&&S.subtle?S.subtle:null}async function c(S){if(r&&i===S)return r;const C=m();if(!C)return null;const N=v(S);if(!N)return null;try{const O=await C.importKey("raw",N,{name:"Ed25519"},!1,["verify"]);return r=O,i=S,O}catch{return null}}async function a(){return n!==null||(n=await c(X)!==null),n}async function u(S,C={}){const N=C.warn!==!1,O=C.product||L,T=C.publicKey||X,R=C.now??Date.now(),x=C.host??p(),U=h(x)?"":` ${I}`,V=o(S);if(!V.ok){const Z=V.reason==="missing"?"missing":"malformed";return N&&A(`licence.${Z}`,Z==="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.${U}`:`licence key could not be read. The grid will render with a watermark.${U}`),{valid:!1,reason:Z,terms:"commercial"}}const J={product:V.product||void 0,issuedTo:V.issuedTo||void 0,expires:V.expires||void 0,terms:s(V.terms)};if(V.product!==O)return N&&A("licence.product",`licence key is for '${V.product}', not '${O}'. The grid will render with a watermark.`),{valid:!1,...J,reason:"product"};if(t(V.expires,R))return N&&A("licence.expired",`licence expired on ${V.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,...J,reason:"expired"};const _=V.deployments||[];if(_.length&&x&&!h(x)&&!y(x,_))return N&&A("licence.domain",`licence key is not valid for ${x}; it covers ${_.join(", ")}. The grid will render with a watermark.`),{valid:!1,...J,reason:"domain"};const ee=await c(T);if(!ee){const Z=!!V.signature&&V.signature.length===$;return N&&A("licence.algorithm","this host does not provide crypto.subtle Ed25519, so the licence signature could not be verified. A structural check was used instead."),Z?{valid:!0,...J,reason:"unverified"}:{valid:!1,...J,reason:"signature"}}let W=!1;try{W=await m().verify({name:"Ed25519"},ee,V.signature,V.message)}catch{W=!1}return W?{valid:!0,...J}:(N&&A("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...J,reason:"signature"})}function h(S){const C=String(S??p()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!C||C==="localhost"||C.endsWith(".localhost")||C==="::1"||C==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(C)}function p(){const S=globalThis.location;return S&&typeof S.hostname=="string"?S.hostname:null}function y(S,C){const N=d(S);return!N||!Array.isArray(C)?!1:C.some(O=>{const T=d(O);if(!T)return!1;if(T==="*")return!0;if(T.startsWith("*.")){const R=T.slice(2);return N===R||N.endsWith(`.${R}`)}return N===T})}function d(S){return String(S??"").trim().toLowerCase().replace(/\.$/,"")}class f{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#s;#i=new Set;constructor(C={}){this.#s=C}set(C){this.#e=typeof C=="string"?C.trim():"";const N=o(this.#e);return this.#t=N.ok?{valid:!t(N.expires,Date.now())&&N.product===(this.#s.product||L),product:N.product||void 0,issuedTo:N.issuedTo||void 0,expires:N.expires||void 0,terms:s(N.terms),reason:"pending"}:{valid:!1,reason:N.reason||"malformed",terms:"commercial"},this.#n=null,this.#e&&this.verify(),this.#t}verify(){if(this.#n)return this.#n;const C=this.#e;return this.#n=u(C,this.#s).then(N=>{if(this.#e===C){this.#t=N;for(const O of this.#i)O(N)}return N}),this.#n}onSettled(C){return this.#i.add(C),()=>this.#i.delete(C)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!h(this.#r)}setHost(C){this.#r=C}state(){return this.#t.valid?"licensed":h(this.#r)?"localhost":"trial"}reset(){this.#e="",this.#t={valid:!1,reason:"missing",terms:"commercial"},this.#n=null,this.#i.clear()}}const w=Symbol.for("lattice-grid/licence/holder");function k(){const S=globalThis,C=S&&S[w];if(C&&typeof C.set=="function"&&typeof C.watermark=="function")return C;const N=new f;if(S)try{S[w]=N}catch{}return N}const P=k();function G(S){return P.set(S)}function K(){return P.info()}function q(){return P.watermark()}function B(){return P.state()}function E(){return P}}),Ve("packages/core/src/registry/registry.js",function(e,D){"use strict";Object.defineProperty(e,"KINDS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"REGIONS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return r}});const re=D("packages/core/src/internal/warn.js"),A=re.warnOnce,Y=re.DEV,L=D("packages/core/src/internal/predicates.js").isFunction,Q=D("packages/core/src/registry/licence.js"),H=Q.LicenceHolder,$=Q.sharedLicence,X=["renderer","editor","filter","dataType","totalFn","pipe","component"],F=["all","header","body","totals","panels"];class j{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#s;#i=null;#a=null;#l=new Set;#o=new Map;constructor(n={}){for(const m of X)this.#t.set(m,new Map);this.#s=n.holder||$(),this.#a=n.grid??null,this.#i=this.#s.onSettled(()=>{this.#f({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),n.licence&&this.setLicence(n.licence)}registerModules(n,m={}){m.licence&&this.setLicence(m.licence),m.grid!==void 0&&(this.#a=m.grid);const c=Array.isArray(n)?n:[n],a=[];for(const u of c){if(!u||typeof u!="object"||typeof u.name!="string"||!u.name){A("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(u.name)){Y&&this.#u(this.#e.get(u.name),u);continue}if(!L(u.install)){A(`registry.module.install:${u.name}`,`module '${u.name}' has no install() and was ignored.`);continue}const h={registry:this,grid:this.#a};try{u.install(h)}catch(p){A(`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 v(u))this.#n.add(p);a.push(u.name),this.#f({reason:"module",name:u.name,capabilities:this.capabilities(),regions:g(u)})}return a}unregisterModule(n){const m=this.#e.get(n);if(!m)return!1;if(L(m.uninstall))try{m.uninstall({registry:this,grid:this.#a})}catch(c){A(`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 v(n))this.#n.add(m)}#u(n,m){!n||n===m||b(n,m)||A(`registry.module.reconfigure:${m.name}`,`module '${m.name}' was re-registered with different options; the first registration is kept and this call was ignored. Unregister it first if you mean to replace it.`)}capabilities(){return[...this.#n].sort()}can(n){return this.#n.has(n)}onChange(n){return L(n)?(this.#r.add(n),this.#o.set(n,this.#a),()=>{this.#r.delete(n),this.#o.delete(n)}):()=>{}}#f(n){for(const m of[...this.#r])try{m(n)}catch(c){A("registry.onChange.throw","a registry change handler threw.",c)}}register(n,m,c){const a=this.#t.get(n);if(!a){A(`registry.kind:${n}`,`unknown registry kind '${n}'; expected one of ${X.join(", ")}.`);return}if(!m||typeof m!="string"){A(`registry.name:${n}`,`register('${n}', ...) needs a name.`);return}a.has(m)&&a.get(m)!==c&&A(`registry.replace:${n}:${m}`,`'${m}' was already registered as a ${n} and has been replaced.`),a.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.#s.set(n)}licence(){return this.#s.info()}licenceVerified(){return this.#s.verify()}watermark(){return this.#s.watermark()}attach(n){n!=null&&(this.#l.add(n),this.#a=n)}detach(n){if(n!=null){this.#l.delete(n);for(const[m,c]of[...this.#o])c===n&&(this.#r.delete(m),this.#o.delete(m));if(this.#a===n){const m=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#a=m}this.#l.size===0&&this.#i&&(this.#i(),this.#i=null)}}destroy(n){if(n!=null){this.detach(n);return}for(const m of[...this.#e.keys()])this.unregisterModule(m);this.#r.clear(),this.#o.clear(),this.#l.clear(),this.#i&&this.#i(),this.#i=null,this.#a=null}}function v(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:l(v(i),v(n))&&l(g(i),g(n))}function l(i,n){const m=new Set(i),c=new Set(n);if(m.size!==c.size)return!1;for(const a of m)if(!c.has(a))return!1;return!0}function g(i){const n=i.regions;return!Array.isArray(n)||n.length===0?["all"]:n.filter(m=>F.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 j;function s(){return t}function r(i,n={}){return t.registerModules(i,n)}}),Ve("packages/core/src/internal/text.js",function(e,D){"use strict";Object.defineProperty(e,"humanise",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"escapeHtml",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return I}});function re(L){return L?(L.includes(".")?L.slice(L.lastIndexOf(".")+1):L).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,H=>H.toUpperCase()):""}const A={"&":"&","<":"<",">":">",'"':""","'":"'"};function Y(L){const Q=L==null?"":String(L);return/[&<>"']/.test(Q)?Q.replace(/[&<>"']/g,H=>A[H]):Q}function I(L){return String(L).replace(/\w\S*/g,Q=>Q[0].toUpperCase()+Q.slice(1).toLowerCase())}}),Ve("packages/core/src/format/mask.js",function(e,D){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return Q}});const re=new Set(["0","#","?",",","."]),A="\0";function Y($){const X=[];let F="",j=!1;for(let v=0;v<$.length;v++){const b=$[v];if(b==="\\"){F+=b+($[v+1]??""),v+=1;continue}if(b==='"'){j=!j,F+=b;continue}if(b===";"&&!j){X.push(F),F="";continue}F+=b}return X.push(F),X}function I($){let X="",F="",j="",v=1,b=!1,l=!1;const g=a=>{l?F+=a:X+=a};for(let a=0;a<$.length;a++){const u=$[a];if(u==="\\"){g($[a+1]??""),a+=1;continue}if(u==='"'){const h=$.indexOf('"',a+1);g(h===-1?$.slice(a+1):$.slice(a+1,h)),a=h===-1?$.length:h;continue}if(u==="%"){v*=100,g("%");continue}if(u==="@"){b=!0,g("\0");continue}if(re.has(u)){j+=u,l=!0;continue}g(u)}let o=-1;for(let a=j.length-1;a>=0;a--){const u=j[a];if(u==="0"||u==="#"||u==="?"){o=a;break}}let t=!1,s="";for(let a=0;a<j.length;a++){const u=j[a];if(u===","){a>o?v/=1e3:t=!0;continue}s+=u}const r=s.indexOf("."),i=r===-1?s:s.slice(0,r),n=r===-1?"":s.slice(r+1);let m=0;for(const a of i)a==="0"&&(m+=1);let c=0;for(const a of n)a==="0"&&(c+=1);return{prefix:X,suffix:F,minInt:m,minDec:c,maxDec:n.length,grouping:t,scale:v,hasNumber:o!==-1,isText:b}}function L($,X){const F=new Intl.NumberFormat(X,{minimumIntegerDigits:Math.max($.minInt,1),minimumFractionDigits:$.minDec,maximumFractionDigits:Math.max($.maxDec,$.minDec),useGrouping:$.grouping}),{prefix:j,suffix:v,scale:b,hasNumber:l}=$;return g=>{if(!l)return j+v;const o=b===1?g:g*b;return j+F.format(o)+v}}function Q($,X){const j=Y(String($)).map(I),v=j.map(s=>L(s,X)),b=0,l=j.length>1?1:-1,g=j.length>2?2:-1,o=j.length>3?3:-1,t=s=>{if(s==null||s==="")return"";if(typeof s!="number"||Number.isNaN(s)){const r=Number(s);if(Number.isNaN(r))return o===-1?String(s):(j[o].prefix+j[o].suffix).split("\0").join(String(s));s=r}return s===0&&g!==-1?v[g](0):s<0&&l!==-1?v[l](-s):v[b](s)};return t.spec={mask:$},{format:t,ooxml:H(String($))}}function H($){return $.trim()}}),Ve("packages/core/src/format/pattern.js",function(e,D){"use strict";Object.defineProperty(e,"parseNumberPattern",{enumerable:!0,get:function(){return L}});const A=D("packages/core/src/format/mask.js").splitSections;function Y(Q){let H="",$="",X="",F="",j=!1,v=!1,b=!1,l=!1;const g=t=>{b?$+=t:H+=t};for(let t=0;t<Q.length;t++){const s=Q[t];if(s==="\\"){g(Q[t+1]??""),t+=1;continue}if(s==='"'){const r=Q.indexOf('"',t+1);g(r===-1?Q.slice(t+1):Q.slice(t+1,r)),t=r===-1?Q.length:r;continue}if(s==="%"){v=!0;continue}if(s==="0"||s==="#"){b=!0,l?F+=s:X+=s;continue}if(s===","){l||(j=!0);continue}if(s==="."&&!l){l=!0;continue}g(s)}if(!b)return{hasDigit:!1,prefix:H,suffix:$,minDec:0,maxDec:0,grouping:!1,percent:v};let o=0;for(const t of F)t==="0"&&(o+=1);return{hasDigit:!0,prefix:H,suffix:$,minDec:o,maxDec:F.length,grouping:j,percent:v}}function I(Q,H){const $=H.trim(),X=Q.trim();return $.startsWith("(")&&$.endsWith(")")&&$.slice(1,-1).trim()===X?"parentheses":$.endsWith("-")?"suffix":"minus"}function L(Q){if(typeof Q!="string")return null;const H=A(Q);if(H.length===0)return null;const $=Y(H[0]);if(!$.hasDigit)return null;const X={style:$.percent?"percent":"decimal",prefix:$.prefix,suffix:$.suffix,minDecimals:$.minDec,maxDecimals:Math.max($.maxDec,$.minDec),thousandsSeparator:$.grouping?void 0:!1};if(H.length>1&&(X.negative=I(H[0],H[1])),H.length>2){const F=Y(H[2]);F.hasDigit||(X.zeroDisplay=F.prefix+F.suffix)}return X}}),Ve("packages/core/src/format/number.js",function(e,D){"use strict";Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return H}});const A=D("packages/core/src/internal/predicates.js").isNil,I=D("packages/core/src/internal/warn.js").warnOnce,Q=D("packages/core/src/format/pattern.js").parseNumberPattern;function H($,X){const F=typeof $=="string"?{pattern:$}:$||{};let j=F;if(typeof F.pattern=="string"){const k=Q(F.pattern);if(k){const{pattern:P,...G}=F;j={...k,...G}}else I(`format:pattern:${F.pattern}`,`invalid number format pattern "${F.pattern}"; the value will use the default number format`)}const v=j.locale||X||void 0,b=j.style||"decimal",l=typeof j.scale=="number"?j.scale:1,g=j.nullDisplay??"",o=j.zeroDisplay,t=j.prefix||"",s=j.suffix||"",r=j.negative||"minus",i=j.signed===!0,n={style:b,notation:j.notation||"standard"};b==="currency"&&(n.currency=j.currency||"USD",j.currencyDisplay&&(n.currencyDisplay=j.currencyDisplay)),typeof j.decimals=="number"?(n.minimumFractionDigits=j.decimals,n.maximumFractionDigits=j.decimals):(typeof j.minDecimals=="number"&&(n.minimumFractionDigits=j.minDecimals),typeof j.maxDecimals=="number"&&(n.maximumFractionDigits=j.maxDecimals),n.minimumFractionDigits>(n.maximumFractionDigits??20)&&(n.maximumFractionDigits=n.minimumFractionDigits)),j.thousandsSeparator===!1&&(n.useGrouping=!1),n.notation==="compact"&&(n.compactDisplay=j.compactDisplay||"short");const m=new Intl.NumberFormat(v,n),c=typeof j.thousandsSeparator=="string"?j.thousandsSeparator:null,a=typeof j.decimalSeparator=="string"?j.decimalSeparator:null;let u=",",h=".";if(c||a)for(const k of m.formatToParts(12345.6))k.type==="group"?u=k.value:k.type==="decimal"&&(h=k.value);const p=k=>{let P=k;return c&&(P=P.split(u).join("")),a&&(P=P.split(h).join("")),c&&(P=P.split("").join(c)),a&&(P=P.split("").join(a)),P},y=!!(c||a),d=t!==""&&b==="currency",f=k=>{let P;if(d){const G=m.formatToParts(k);let K=!1;P="";for(const q of G)P+=q.value,!K&&q.type==="currency"&&(P+=t,K=!0);K||(P=t+P)}else P=t+m.format(k);return y&&(P=p(P)),P+s},w=k=>{if(A(k)||k==="")return g;const P=typeof k=="number"?k:Number(k);if(Number.isNaN(P))return g;const G=l===1?P:P*l;return G===0&&o!==void 0?o:G<0?r==="parentheses"?`(${f(-G)})`:r==="suffix"?`${f(-G)}-`:f(G):i&&G>0?`+${f(G)}`:f(G)};return w.negativeClass=j.negativeClass||null,w.spec=j,w}}),Ve("packages/core/src/format/date.js",function(e,D){"use strict";Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return s}});const A=D("packages/core/src/internal/predicates.js").isNil,I=D("packages/core/src/internal/warn.js").warnOnce,L=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function Q(r){const i=[];let n=0,m="";const c=()=>{m&&(i.push({token:null,text:m}),m="")};for(;n<r.length;){const a=r[n];if(a==="'"){if(r[n+1]==="'"){m+="'",n+=2;continue}const h=r.indexOf("'",n+1);if(h===-1){m+=r.slice(n+1),n=r.length;continue}m+=r.slice(n+1,h),n=h+1;continue}const u=L.find(h=>r.startsWith(h,n));if(u){c(),i.push({token:u,text:u}),n+=u.length;continue}/[A-Za-z]/.test(a)&&I(`date.pattern.token:${a}`,`the date pattern "${r}" contains '${a}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${L.join(" ")}.`),m+=a,n+=1}return c(),i}const H=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function $(r){if(A(r)||r==="")return null;if(r instanceof Date)return Number.isNaN(r.getTime())?null:r;if(typeof r=="number")return Number.isNaN(r)?null:new Date(r);if(typeof r=="string"){const i=H.exec(r.trim());if(i){const[,m,c,a,u="0",h="0",p="0"]=i;return new Date(+m,+c-1,+a,+u,+h,+p)}const n=new Date(r);return Number.isNaN(n.getTime())?null:n}return null}function X(r,i){return String(r).padStart(i,"0")}function F(r){if(!r)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:r,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 a of i.formatToParts(m))switch(a.type){case"year":c.year=Number(a.value);break;case"month":c.month=Number(a.value);break;case"day":c.day=Number(a.value);break;case"hour":c.hour=Number(a.value)%24;break;case"minute":c.minute=Number(a.value);break;case"second":c.second=Number(a.value);break;case"weekday":c.weekday=n[a.value]??0;break;default:break}return c}}function j(r,i,n){const m=Q(r),c=F(n),a=new Set(m.filter(d=>d.token).map(d=>d.token)),u=a.has("MMM")?new Intl.DateTimeFormat(i,{month:"short",timeZone:n}):null,h=a.has("MMMM")?new Intl.DateTimeFormat(i,{month:"long",timeZone:n}):null,p=a.has("EEE")?new Intl.DateTimeFormat(i,{weekday:"short",timeZone:n}):null,y=a.has("EEEE")?new Intl.DateTimeFormat(i,{weekday:"long",timeZone:n}):null;return d=>{const f=c(d);let w="";for(const k of m){if(!k.token){w+=k.text;continue}switch(k.token){case"yyyy":w+=X(f.year,4);break;case"yy":w+=X(f.year%100,2);break;case"MMMM":w+=h.format(d);break;case"MMM":w+=u.format(d);break;case"MM":w+=X(f.month,2);break;case"M":w+=String(f.month);break;case"dd":w+=X(f.day,2);break;case"d":w+=String(f.day);break;case"EEEE":w+=y.format(d);break;case"EEE":w+=p.format(d);break;case"HH":w+=X(f.hour,2);break;case"H":w+=String(f.hour);break;case"hh":w+=X(f.hour%12===0?12:f.hour%12,2);break;case"h":w+=String(f.hour%12===0?12:f.hour%12);break;case"mm":w+=X(f.minute,2);break;case"m":w+=String(f.minute);break;case"ss":w+=X(f.second,2);break;case"s":w+=String(f.second);break;case"SSS":w+=X(f.ms,3);break;case"a":w+=f.hour<12?"AM":"PM";break;default:w+=k.text;break}}return w}}const v=[["year",365*24*36e5],["month",720*36e5],["week",168*36e5],["day",24*36e5],["hour",36e5],["minute",6e4],["second",1e3]];function b(r,i){const n=r||{},m=n.locale||i||void 0,c=n.nullDisplay??"",a=n.timeZone;let u;if(n.pattern)u=j(n.pattern,m,a);else if(n.dateStyle||n.timeStyle){const f={timeZone:a};n.dateStyle&&(f.dateStyle=n.dateStyle),n.timeStyle&&(f.timeStyle=n.timeStyle);const w=new Intl.DateTimeFormat(m,f);u=k=>w.format(k)}else{const f=new Intl.DateTimeFormat(m,{dateStyle:"medium",timeZone:a});u=w=>f.format(w)}const h=n.relative?new Intl.RelativeTimeFormat(m,{numeric:"auto"}):null,y=(typeof n.relative=="object"&&n.relative?n.relative.threshold??7:7)*24*36e5,d=(f,w)=>{const k=$(f);if(!k)return c;if(h){const P=w&&typeof w.now=="number"?w.now:Date.now(),G=k.getTime()-P;if(Math.abs(G)<y){for(const[K,q]of v)if(Math.abs(G)>=q||K==="second")return h.format(Math.round(G/q),K)}}return u(k)};return d.spec=n,d}function l(r){if(A(r)||r==="")return null;if(typeof r=="string"){const m=/^(\d{4}-\d{2}-\d{2})/.exec(r.trim());if(m)return m[1];const c=$(r);return c?l(c):null}const i=$(r);if(!i)return null;const n=m=>String(m).padStart(2,"0");return`${i.getFullYear()}-${n(i.getMonth()+1)}-${n(i.getDate())}`}function g(r,i){if(A(r)||r==="")return null;if(typeof r=="string"){const m=r.trim();if(o.test(m)){const u=$(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,h,p,y]=c;return`${u}T${h}:${p}${y&&y!=="00"?`:${y}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(m))return`${m}T00:00`;const a=$(m);return a?g(a):null}const n=$(r);return n?t(n,i):null}const o=/(?:Z|[+-]\d{2}:?\d{2})$/i;function t(r,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(r).reduce((y,d)=>(d.type!=="literal"&&(y[d.type]=d.value),y),{}),h=u.hour==="24"?"00":u.hour,p=Number(u.second);return`${u.year}-${u.month}-${u.day}T${h}:${u.minute}`+(p?`:${u.second}`:"")}catch{}const m=`${r.getFullYear()}-${n(r.getMonth()+1)}-${n(r.getDate())}`,c=r.getSeconds(),a=`${n(r.getHours())}:${n(r.getMinutes())}${c?`:${n(c)}`:""}`;return`${m}T${a}`}function s(r,i){const n=A(r)||r===""?null:String(r),m=A(i)||i===""?null:String(i);return n===null?m===null?0:1:m===null||n<m?-1:n>m?1:0}}),Ve("packages/core/src/format/boolean.js",function(e,D){"use strict";Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return Q}});const A=D("packages/core/src/internal/predicates.js").isNil,Y={true:"☑",false:"☐",null:""},I={true:"◉",false:"◯",null:""};function L(H){if(A(H)||H==="")return null;if(typeof H=="boolean")return H;if(typeof H=="number")return H!==0;const $=String(H).trim().toLowerCase();return $==="true"||$==="yes"||$==="y"||$==="1"?!0:$==="false"||$==="no"||$==="n"||$==="0"?!1:null}function Q(H,$){const X=H||{},F=X.display||"text",j=X.trueLabel??"Yes",v=X.falseLabel??"No",b=X.nullLabel??"";let l=j,g=v;const o=b;F==="checkbox"?(l=Y.true,g=Y.false):F==="switch"?(l=I.true,g=I.false):F==="icon"&&(l=X.trueIcon??j,g=X.falseIcon??v);const t=s=>{const r=L(s);return r===null?o:r?l:g};return t.display=F,t.labels={true:j,false:v,null:b},t.locale=$,t.spec=X,t}}),Ve("packages/core/src/format/text.js",function(e,D){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return L}});const A=D("packages/core/src/internal/predicates.js").isNil,I=D("packages/core/src/internal/text.js").titleCase;function L(Q,H){const $=Q||{},X=$.locale||H||void 0,F=$.nullDisplay??"",j=$.emptyDisplay??"",v=$.transform||"none",b=typeof $.truncate=="number"?{chars:$.truncate}:$.truncate||null,l=b?b.chars:0,g=b?b.ellipsis??"…":"",o=s=>{switch(v){case"upper":return X?s.toLocaleUpperCase(X):s.toUpperCase();case"lower":return X?s.toLocaleLowerCase(X):s.toLowerCase();case"title":return I(s);default:return s}},t=s=>{if(A(s))return F;let r=typeof s=="string"?s:String(s);return r===""?j:(v!=="none"&&(r=o(r)),l>0&&r.length>l&&(r=r.slice(0,l)+g),r)};return t.spec=$,t}}),Ve("packages/core/src/format/shorthand.js",function(e,D){"use strict";Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return H}});const re=["currency","number","percent","date","boolean","text","relative"],A=/[#0?@;"\\]/,Y=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function I($){return typeof $!="string"||$===""||Q($)?!1:A.test($)}function L($){return typeof $!="string"||$===""||Q($)?!1:Y.test($)}function Q($){const X=$.indexOf(":"),F=X===-1?$:$.slice(0,X);return re.includes(F)?F:null}function H($){const X=Q($);if(!X)return null;const F=$.indexOf(":"),j=F===-1?"":$.slice(F+1),v=j===""?[]:j.split(":");switch(X){case"currency":{const b={type:"number",style:"currency",currency:v[0]||"USD"};return v[1]!==void 0&&v[1]!==""&&(b.decimals=Number(v[1])),b}case"number":{const b={type:"number",style:"decimal"};return v[0]!==void 0&&v[0]!==""&&(b.decimals=Number(v[0])),b}case"percent":{const b={type:"number",style:"percent"};return v[0]!==void 0&&v[0]!==""&&(b.decimals=Number(v[0])),b}case"date":return{type:"date",pattern:j||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const b=j.split("/"),l={type:"boolean",display:"text"};return b[0]!==void 0&&b[0]!==""&&(l.trueLabel=b[0]),b[1]!==void 0&&b[1]!==""&&(l.falseLabel=b[1]),b[2]!==void 0&&(l.nullLabel=b[2]),l}case"text":{const b={type:"text"};return v[0]&&(b.transform=v[0]),v[1]!==void 0&&v[1]!==""&&(b.truncate=Number(v[1])),b}default:return null}}}),Ve("packages/core/src/format/index.js",function(e,D){"use strict";Object.defineProperty(e,"compileFormat",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"specToOoxml",{enumerable:!0,get:function(){return P}});const re=D("packages/core/src/internal/predicates.js"),A=re.isFunction,Y=re.isObject,L=D("packages/core/src/internal/warn.js").warnOnce,Q=D("packages/core/src/format/number.js"),H=Q.compileNumber,$=D("packages/core/src/format/date.js"),X=$.compileDate,F=$.scanPattern,j=D("packages/core/src/format/boolean.js"),v=j.compileBoolean,b=D("packages/core/src/format/text.js"),l=b.compileText,g=D("packages/core/src/format/mask.js"),o=g.compileMask,t=D("packages/core/src/format/shorthand.js"),s=t.parseShorthand,r=t.looksLikeMask,i=t.looksLikeDatePattern,m=D("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 $.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return $.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return $.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return $.toDate}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return j.compileBoolean}}),Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return j.toTriState}}),Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return b.compileText}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return g.compileMask}}),Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return g.splitSections}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return g.parseSection}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return t.parseShorthand}}),Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return t.looksLikeMask}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return t.looksLikeDatePattern}});const c=new Set(["decimal","currency","percent","unit"]),a=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"])},h=new Set(["number","date","boolean","text"]);function p(B,E){const S=B.type;if(S===void 0||h.has(S)||!c.has(String(S)))return;const C=E?`"${E}"`:"with no id";L(`format:unknown-style-key:${E||""}:${S}`,`column ${C} has format: { type: "${S}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${S}" instead?`)}function y(B,E,S){const C=u[E],N=S?`"${S}"`:"with no id";for(const O of B){if(a.has(O)||C.has(O))continue;const T=Object.keys(u).find(R=>R!==E&&u[R].has(O));T?L(`format:inapplicable:${S||""}:${O}`,`column ${N} has format key "${O}", which applies to a ${T} column, not the ${E} column it was applied to; it is ignored.`):L(`format:unknown:${S||""}:${O}`,`column ${N} has an unrecognised format key "${O}" for its ${E} format; it is ignored.`)}}function d(B){if(B.type==="number"||B.type==="date"||B.type==="boolean"||B.type==="text")return!0;const E=c.has(String(B.style));return!!(B.pattern||B.dateStyle||B.timeStyle||B.relative||B.timeZone||B.trueLabel||B.falseLabel||B.display||B.trueIcon||B.falseIcon||B.transform||B.truncate||B.emptyDisplay||E||B.currency||B.decimals!==void 0||B.minDecimals!==void 0||B.maxDecimals!==void 0||B.notation||B.negative||B.scale!==void 0||B.prefix||B.suffix||B.zeroDisplay!==void 0)}function f(B,E){if(B.type==="number"||B.type==="date"||B.type==="boolean"||B.type==="text")return B.type;if(B.pattern){if(r(B.pattern))return"number";if(i(B.pattern))return"date"}if(B.dateStyle||B.timeStyle||B.relative||B.timeZone)return"date";if(B.trueLabel||B.falseLabel||B.display||B.trueIcon||B.falseIcon)return"boolean";if(B.transform||B.truncate||B.emptyDisplay)return"text";if(B.style||B.currency||B.decimals!==void 0||B.minDecimals!==void 0||B.maxDecimals!==void 0||B.notation||B.negative||B.scale!==void 0||B.prefix||B.suffix||B.zeroDisplay!==void 0)return"number";const S=E&&E.base;return S==="number"?"number":S==="date"||S==="dateString"?"date":S==="boolean"?"boolean":"text"}function w(B,E=null,S=void 0,C=void 0,N=void 0){if(B==null||B==="")return null;const O=Y(B)?Object.keys(B):null;if(typeof B=="function"){const x=(U,V)=>String(B({...V||{},value:U,locale:S})??"");return x.ooxml=E&&E.excel||"General",x}if(typeof B=="string"){if(r(B)){const{format:U,ooxml:V}=o(B,S);return U.ooxml=V,U}const x=s(B)||(i(B)?{type:"date",pattern:B}:null);return x?w(x,E,S,C,N):(L(`format:${B}`,`unrecognised format string "${B}"; the value will be stringified`),null)}if(!Y(B))return L("format:shape","format must be a spec object or a string; ignoring",B),null;if(E&&A(E.format)&&!d(B)||E&&A(E.format)&&Array.isArray(E.formatPatterns)&&B.type===void 0)return null;const T=f(B,E);T==="date"&&C&&B.timeZone===void 0&&(B={...B,timeZone:C}),p(B,N),y(O||Object.keys(B),T,N);let R;switch(T){case"number":R=H(B,S);break;case"date":R=X(B,S);break;case"boolean":R=v(B,S);break;default:R=l(B,S);break}return R.ooxml=P(B,T,S,E),R.kind=T,R}const k={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(B,E,S=void 0,C=null){if(E==="date"){if(B.pattern){let x="";for(const U of F(B.pattern))x+=U.token?k[U.token]??U.text:U.text;return x}return C&&C.excel||"yyyy-mm-dd"}if(E==="boolean")return"General";if(E==="text")return"@";if(typeof B.pattern=="string"&&m(B.pattern))return String(B.pattern).trim();if(B.notation==="compact"||B.notation==="scientific")return"General";const N=typeof B.decimals=="number"?B.decimals:typeof B.minDecimals=="number"?B.minDecimals:B.style==="currency"?2:0;let T=`${B.thousandsSeparator===!1?"":"#,#"}#0${N>0?`.${"0".repeat(N)}`:""}`,R="";return B.style==="currency"&&(R+=G(q(B.currency||"USD",S))),B.prefix&&(R+=G(B.prefix)),T=R+T,B.style==="percent"&&(T=`${T}%`),B.suffix&&(T+=G(B.suffix)),B.negative==="parentheses"?`${T};(${T})`:B.negative==="suffix"?`${T};${T}-`:T}function G(B){return`"${String(B).split('"').join("")}"`}const K=new Map;function q(B,E){const S=`${B}|${E||""}`;let C=K.get(S);if(C!==void 0)return C;C=B;try{const O=new Intl.NumberFormat(E,{style:"currency",currency:B}).formatToParts(0).find(T=>T.type==="currency");O&&(C=O.value)}catch{}return K.set(S,C),C}}),Ve("packages/core/src/columns/types/temporal.js",function(e,D){"use strict";Object.defineProperty(e,"MS_SECOND",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"MS_MINUTE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"MS_HOUR",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"MS_DAY",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"MS_WEEK",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return a}}),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 K}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"toEpochMs",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"toDurationMs",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"resolveZoneName",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(e,"zoneLabel",{enumerable:!0,get:function(){return he}}),Object.defineProperty(e,"formatInstant",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"timestampGroupProjector",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"TEMPORAL_INFERENCE_ORDER",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return je}});const re=D("packages/core/src/internal/predicates.js"),A=re.isNil,Y=re.isFunction,I=D("packages/core/src/format/date.js"),L=I.toDate,Q=I.compilePattern,H=I.compileDate,$=I.toIsoDateTime,X=I.compareIso,F=864e5,j=Object.freeze({}),v=1e3,b=60*v,l=60*b,g=24*l,o=7*g,t=new WeakMap;function s(ye,He){const Me=ye&&ye.locale||"",Re=ye&&ye.column;if(!Re)return Me?{locale:Me}:j;const Ee=t.get(Re);if(Ee&&Ee.locale===Me)return Ee.bag;const $e=Re.typeOptions||Re[He]||(r(Re.format)?Re.format:null),Ie={...$e||j,locale:$e&&$e.locale||Me||void 0};return t.set(Re,{locale:Me,bag:Ie}),Ie}function r(ye){return ye!==null&&typeof ye=="object"&&!Array.isArray(ye)&&!(ye instanceof Date)}function i(ye,He){const Me=ye===null||Number.isNaN(ye)?null:ye,Re=He===null||Number.isNaN(He)?null:He;return Me===null?Re===null?0:1:Re===null||Me<Re?-1:Me>Re?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(ye,He,Me,Re){return!(ye>=0&&ye<=23)||!(He>=0&&He<=59)||!(Me>=0&&Me<=59)||!(Re>=0&&Re<=999)?null:ye*l+He*b+Me*v+Re}function a(ye){if(A(ye))return null;const He=String(ye).trim();if(He==="")return null;const Me=m.exec(He);if(Me){const nt=Me[1];if(nt.length===5)return null;const Qe=nt.length===3?1:2;return c(Number(nt.slice(0,Qe)),Number(nt.slice(Qe,Qe+2)),Number(nt.slice(Qe+2,Qe+4)||0),0)}const Re=n.exec(He);if(!Re)return null;let Ee=Number(Re[1]);const $e=Number(Re[2]||0),Ie=Number(Re[3]||0),We=Re[4]?Number(Re[4].padEnd(3,"0")):0,Ye=Re[5]?Re[5][0].toLowerCase():null;if(Ye){if(Ee<1||Ee>12)return null;Ee=Ee%12,Ye==="p"&&(Ee+=12)}return c(Ee,$e,Ie,We)}function u(ye){return A(ye)||ye===""?null:typeof ye=="number"?Number.isFinite(ye)?(ye%g+g)%g:null:ye instanceof Date?Number.isNaN(ye.getTime())?null:ye.getHours()*l+ye.getMinutes()*b+ye.getSeconds()*v+ye.getMilliseconds():a(ye)}const h=new Map;function p(ye){const He=ye.pattern||"",Me=ye.timeStyle||(ye.seconds?"medium":"short"),Re=`${ye.locale||""}|${He}|${Me}`;let Ee=h.get(Re);if(Ee)return Ee;if(He)Ee=Q(He,ye.locale||void 0,"UTC");else{const $e=new Intl.DateTimeFormat(ye.locale||void 0,{timeStyle:Me,timeZone:"UTC"});Ee=Ie=>$e.format(Ie)}return h.set(Re,Ee),Ee}function y(ye,He){const Me=He||j;if(ye==null||typeof ye!="number"||!Number.isFinite(ye))return Me.nullDisplay??"";const Re=(ye%g+g)%g;return p(Me)(new Date(Re))}function d(ye){return ye instanceof Date?!Number.isNaN(ye.getTime()):typeof ye=="number"?Number.isFinite(ye)&&ye>=0&&ye<g:typeof ye!="string"||!ye.includes(":")?!1:a(ye)!==null}function f(ye){const He=u(ye);return He==null?"":y(He,{pattern:He%v===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const w=new Map;function k(ye){const He=ye||"";let Me=w.get(He);return Me||(Me=new Intl.DateTimeFormat("en-GB",{timeZone:ye||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),w.set(He,Me)),Me}function P(ye,He){const Me={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const Re of k(He).formatToParts(new Date(ye)))Re.type==="year"?Me.year=Number(Re.value):Re.type==="month"?Me.month=Number(Re.value):Re.type==="day"?Me.day=Number(Re.value):Re.type==="hour"?Me.hour=Number(Re.value)%24:Re.type==="minute"?Me.minute=Number(Re.value):Re.type==="second"&&(Me.second=Number(Re.value));return Me}function G(ye,He){const Me=P(ye,He);return Date.UTC(Me.year,Me.month-1,Me.day,Me.hour,Me.minute,Me.second,0)-Math.floor(ye/1e3)*1e3}function K(ye,He){const Me=ye.hour||0,Re=ye.minute||0,Ee=ye.second||0,$e=ye.ms||0;if(!He)return new Date(ye.year,ye.month-1,ye.day,Me,Re,Ee,$e).getTime();const Ie=Date.UTC(ye.year,ye.month-1,ye.day,Me,Re,Ee,$e);let We=Ie-G(Ie,He);return We=Ie-G(We,He),We}const q=/(?:Z|[+-]\d{2}:?\d{2})$/i,B=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function E(ye,He){if(A(ye))return null;const Me=String(ye).trim();if(Me==="")return null;const Re=He&&He.timeZone||void 0;if(!q.test(Me)){const Ee=B.exec(Me);if(Ee){const $e=(Ee[4]||"").trim(),Ie=$e===""?0:a($e);if(Ie===null)return null;const We=K({year:Number(Ee[1]),month:Number(Ee[2]),day:Number(Ee[3]),hour:Math.floor(Ie/l),minute:Math.floor(Ie/b)%60,second:Math.floor(Ie/v)%60,ms:Ie%v},Re);return Number.isNaN(We)?null:new Date(We)}}return L(Me)}function S(ye){if(typeof ye=="number")return Number.isFinite(ye)?ye:null;const He=L(ye);return He?He.getTime():null}const C=new Map;function N(ye){const He=[ye.locale||"",ye.pattern||"",ye.dateStyle||"",ye.timeStyle||"",ye.timeZone||"",ye.seconds?"1":""].join("|");let Me=C.get(He);if(Me)return Me;const Re=ye.pattern?{type:"date",pattern:ye.pattern,timeZone:ye.timeZone}:{type:"date",dateStyle:ye.dateStyle||"medium",timeStyle:ye.timeStyle||(ye.seconds?"medium":"short"),timeZone:ye.timeZone};return Me=H(Re,ye.locale||void 0),C.set(He,Me),Me}function O(ye,He){const Me=He||j,Re=S(ye);return Re==null?Me.nullDisplay??"":N(Me)(Re)}function T(ye){return ye instanceof Date?!Number.isNaN(ye.getTime()):typeof ye!="string"||!B.test(ye.trim())?!1:E(ye)!==null}const R=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:l,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:v,intl:"second",long:["second","seconds"],names:["s","sec","secs","second","seconds"]},{key:"ms",ms:1,intl:"millisecond",long:["millisecond","milliseconds"],names:["ms","msec","msecs","milli","millis","millisecond","milliseconds"]}]),x=new Map;for(const ye of R)for(const He of ye.names)x.set(He,ye);const U=Object.freeze(R.filter(ye=>ye.key!=="w")),V=/^(\d+(?:\.\d+)?)\s*([a-z]+)\s*(?:,\s*)?/,J=/^\d+(?:\.\d+)?$/,_=/^(\d+):([0-5]?\d)(?::([0-5]?\d))?(?:\.(\d{1,3}))?$/;function ee(ye){const He=ye&&ye.defaultUnit?x.get(String(ye.defaultUnit).toLowerCase()):null;return He?He.ms:b}function W(ye){return(ye&&ye.defaultUnit?x.get(String(ye.defaultUnit).toLowerCase()):null)||x.get("m")}function Z(ye,He){if(A(ye))return null;let Me=String(ye).trim().toLowerCase();if(Me==="")return null;let Re=1;if(Me[0]==="-"?(Re=-1,Me=Me.slice(1).trim()):Me[0]==="+"&&(Me=Me.slice(1).trim()),Me==="")return null;const Ee=_.exec(Me);if(Ee){const Ye=Ee[3]!==void 0,nt=Number(Ee[1])*l+Number(Ee[2])*b+(Ye?Number(Ee[3])*v:0)+(Ee[4]?Number(Ee[4].padEnd(3,"0")):0);return Re*nt}if(J.test(Me))return Math.round(Re*Number(Me)*ee(He||j));let $e=Me,Ie=0,We=0;for(;$e!=="";){const Ye=V.exec($e);if(!Ye)return null;const nt=x.get(Ye[2]);if(!nt)return null;Ie+=Number(Ye[1])*nt.ms,$e=$e.slice(Ye[0].length),We++}return We===0?null:Math.round(Re*Ie)}function ne(ye){return A(ye)||ye===""?null:typeof ye=="number"?Number.isFinite(ye)?ye:null:Z(ye)}const ie=new Map;function ce(ye,He,Me){const Re=`${Me||""}|${He.intl}`;let Ee=ie.get(Re);if(Ee===void 0){try{Ee=new Intl.NumberFormat(Me||void 0,{style:"unit",unit:He.intl,unitDisplay:"long"})}catch{Ee=null}ie.set(Re,Ee)}return Ee?Ee.format(ye):`${ye} ${ye===1?He.long[0]:He.long[1]}`}function me(ye,He){return String(ye).padStart(He,"0")}function Ce(ye,He){const Me=He||j;if(ye==null||typeof ye!="number"||!Number.isFinite(ye))return Me.nullDisplay??"";const Re=Me.style||"short",Ee=ye<0;let $e=Math.round(Math.abs(ye));const Ie=Ee?"-":"";if($e===0&&Me.zeroDisplay!=null)return Me.zeroDisplay;if(Re==="clock"){const Qe=Math.floor($e/l),dt=Math.floor($e/b)%60,jt=Math.floor($e/v)%60;return`${Ie}${me(Qe,2)}:${me(dt,2)}:${me(jt,2)}`}if($e===0){const Qe=W(Me);return Re==="long"?ce(0,Qe,Me.locale):`0${Qe.key}`}const We=Me.weeks===!0?R:U,Ye=typeof Me.maxUnits=="number"&&Me.maxUnits>0?Me.maxUnits:Me.maxUnits===void 0?2:1/0,nt=[];for(const Qe of We){if(nt.length>=Ye)break;const dt=Math.floor($e/Qe.ms);dt!==0&&($e-=dt*Qe.ms,nt.push(Re==="long"?ce(dt,Qe,Me.locale):`${dt}${Qe.key}`))}return Ie+nt.join(" ")}function Pe(ye){if(typeof ye!="string")return!1;const He=ye.trim();return He===""||_.test(He)||!/[a-z]/i.test(He)?!1:Z(He)!==null}const xe=Date.UTC(1899,11,30),_e=new Map;function ve(ye,He){const Me=ye||"";let Re=_e.get(Me);Re||(Re=new Intl.DateTimeFormat("en-GB",{timeZone:ye||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),_e.set(Me,Re));const Ee=typeof He=="number"?He:Date.now();for(const $e of Re.formatToParts(new Date(Ee)))if($e.type==="timeZoneName")return $e.value;return""}function oe(ye){if(ye)return ye;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function he(ye,He){const Me=oe(ye),Re=ve(ye,He);return Re?`${Me} (${Re})`:Me}function ae(ye,He){if(ye&&ye.timeZone)return ye.timeZone;const Me=He&&He.grid;return(Me&&Y(Me.get)?Me.get("timeZone"):void 0)||void 0}function se(ye,He){const Me=He||j,Re=S(ye);if(Re==null)return Me.nullDisplay??"";const Ee=N(Me)(Re);if(!Me.showOrigin)return Ee;const $e=Me.originZone;return $e?$e===(Me.timeZone||oe(Me.timeZone))?Ee:`${Ee} (${he($e,Re)})`:`${Ee} (no origin recorded)`}function de(ye,He,Me,Re){if(He==="instant"||!He)return ye;const Ee=P(ye,Me);if(He==="month")return K({year:Ee.year,month:Ee.month,day:1},Me);if(He==="week"){const $e=Re>=1&&Re<=7?Re:1,We=((new Date(Date.UTC(Ee.year,Ee.month-1,Ee.day)).getUTCDay()+6)%7+1-$e+7)%7,Ye=new Date(Date.UTC(Ee.year,Ee.month-1,Ee.day-We));return K({year:Ye.getUTCFullYear(),month:Ye.getUTCMonth()+1,day:Ye.getUTCDate()},Me)}return K({year:Ee.year,month:Ee.month,day:Ee.day},Me)}function ke(ye,He){const Me=ye&&ye.group,Re=Me&&Me.granularity||"day";if(Re==="instant")return null;const Ee=Me&&Me.weekStart;return $e=>typeof $e=="number"?de($e,Re,He,Ee):$e}const Ae={time:{base:"number",storage:"float64",matches:d,format:ye=>y(u(ye.value),s(ye,"time")),parse:ye=>a(ye.text),compare:(ye,He)=>i(u(ye),u(He)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:ye=>{const He=u(ye);return He===null?null:He/F},toStorage:ye=>u(ye),toClipboard:f,fromClipboard:a},datetime:{base:"dateString",storage:"dictionary",matches:T,format:ye=>O(ye.value,s(ye,"datetime")),parse:ye=>$(E(ye.text,s(ye,"datetime"))??ye.text),compare:X,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(ye,He)=>$(ye,He&&He.timeZone),toClipboard:ye=>A(ye)?"":String(ye),fromClipboard:ye=>$(ye)},duration:{base:"number",storage:"float64",matches:Pe,format:ye=>Ce(ne(ye.value),s(ye,"duration")),parse:ye=>Z(ye.text,s(ye,"duration")),compare:(ye,He)=>i(ne(ye),ne(He)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:ye=>{const He=ne(ye);return He===null?null:He/F},toStorage:ye=>ne(ye),toClipboard:ye=>Ce(ne(ye),{style:"short",maxUnits:-1}),fromClipboard:ye=>Z(ye)},timestamp:{base:"number",storage:"float64",format:ye=>{const He=s(ye,"timestamp");return se(ye.value,{...He,timeZone:ae(He,ye)})},parse:ye=>{const He=s(ye,"timestamp"),Me=E(ye.text,{timeZone:ae(He,ye)});return Me?Me.getTime():null},compare:(ye,He)=>i(S(ye),S(He)),groupProjector:(ye,He)=>ke(ye,He),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(ye,He)=>{const Me=S(ye);if(Me==null)return null;const Re=P(Me,He&&He.timeZone||void 0);return(Date.UTC(Re.year,Re.month-1,Re.day,Re.hour,Re.minute,Re.second)-xe)/F},toStorage:ye=>S(ye),toClipboard:ye=>{const He=S(ye);return He==null?"":new Date(He).toISOString()},fromClipboard:ye=>S(ye)}},Te=["datetime","time","duration"],je=Ae}),Ve("packages/core/src/internal/lru.js",function(e,D){"use strict";Object.defineProperty(e,"Lru",{enumerable:!0,get:function(){return re}});class re{#e;#t=new Map;#n;constructor(Y=256,I=null){this.#e=Y,this.#n=I}get size(){return this.#t.size}get max(){return this.#e}set max(Y){this.#e=Y,this.#r()}has(Y){return this.#t.has(Y)}get(Y){const I=this.#t;if(!I.has(Y))return;const L=I.get(Y);return I.delete(Y),I.set(Y,L),L}peek(Y){return this.#t.get(Y)}set(Y,I){const L=this.#t;return L.has(Y)&&L.delete(Y),L.set(Y,I),this.#r(),I}delete(Y){const I=this.#t.get(Y);return this.#t.delete(Y)&&this.#n&&this.#n(I,Y),I}clear(){if(this.#n)for(const[Y,I]of this.#t)this.#n(I,Y);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const Y=this.#t;for(;Y.size>this.#e;){const I=Y.keys().next().value,L=Y.get(I);Y.delete(I),this.#n&&this.#n(L,I)}}}}),Ve("packages/core/src/columns/types/network.js",function(e,D){"use strict";Object.defineProperty(e,"toUint32",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"compareIpv4",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"packCidr",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"cidrParts",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"cidrNetworkOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"storeNumberOf",{enumerable:!0,get:function(){return s}}),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 a}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return h}}),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 d}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ipv6Groups",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"macValue",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"parseMac",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"formatMac",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"macHex",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(e,"macContains",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"compareMac",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"MAC_OPERATORS",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return he}});const A=D("packages/core/src/internal/predicates.js").isNil,I=D("packages/core/src/internal/lru.js").Lru,L=4294967295,Q=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function H(ae){if(A(ae))return null;if(typeof ae=="string")return $(ae);const se=Number(ae);return Number.isFinite(se)?se<0?se<-2147483648?null:se>>>0:se>L?null:Math.trunc(se)>>>0:null}function $(ae){if(A(ae))return null;const se=String(ae).trim();if(se==="")return null;const de=Q.exec(se);if(!de)return null;let ke=0;for(let Ae=1;Ae<=4;Ae++){const Te=de[Ae];if(Te.length>1&&Te.charCodeAt(0)===48)return null;const je=Number(Te);if(je>255)return null;ke=ke*256+je}return ke}function X(ae){const se=H(ae);return se===null?"":`${se>>>24&255}.${se>>>16&255}.${se>>>8&255}.${se&255}`}function F(ae){return typeof ae=="string"&&$(ae)!==null}function j(ae,se){const de=H(ae),ke=H(se);return de===null?ke===null?0:1:ke===null||de<ke?-1:de>ke?1:0}const v=64,b=L*v+32,l=/^(?:0|[1-9]\d?)$/;function g(ae,se){return ae*v+se}function o(ae){if(A(ae))return null;if(typeof ae=="string"){const ke=i(ae);return ke===null?null:o(ke)}if(typeof ae=="object"){const ke=H(ae.address),Ae=Number(ae.prefix);return ke===null||!Number.isInteger(Ae)||Ae<0||Ae>32?null:{address:ke,prefix:Ae}}const se=Number(ae);if(!Number.isInteger(se)||se<0||se>b)return null;const de=se%v;return de>32?null:{address:(se-de)/v,prefix:de}}function t(ae){return!!(ae&&ae.typeOptions&&ae.typeOptions.cidrNetwork)}function s(ae){return!!(ae&&ae.typeOptions&&ae.typeOptions.storeNumber)}function r(ae,se,de){return ae==null?null:s(se)?ae:de(ae)}function i(ae,se){if(A(ae))return null;const de=String(ae).trim();if(de==="")return null;const ke=de.indexOf("/");if(ke<0)return null;const Ae=$(de.slice(0,ke));if(Ae===null)return null;const Te=de.slice(ke+1).trim();if(!l.test(Te))return null;const je=Number(Te);if(je>32)return null;const ye=se&&se.network?(Ae&a(je))>>>0:Ae;return g(ye,je)}function n(ae){const se=o(ae);return se?`${X(se.address)}/${se.prefix}`:""}function m(ae){return typeof ae=="string"&&i(ae)!==null}function c(ae,se){const de=o(ae),ke=o(se);return de?ke?de.address!==ke.address?de.address<ke.address?-1:1:de.prefix-ke.prefix:-1:ke?1:0}function a(ae){return ae===0?0:4294967295<<32-ae>>>0}function u(ae){const se=o(ae);return se?(se.address&a(se.prefix))>>>0:null}function h(ae){const se=o(ae);return se?(se.address&a(se.prefix)|~a(se.prefix)>>>0)>>>0:null}function p(ae){const se=o(ae);return se?2**(32-se.prefix):null}function y(ae){const se=o(ae);return se?se.prefix===32?1:se.prefix===31?2:2**(32-se.prefix)-2:null}function d(ae,se){const de=o(ae);if(!de)return!1;const ke=H(se);if(ke===null)return!1;const Ae=a(de.prefix);return(ke&Ae)>>>0===(de.address&Ae)>>>0}function f(ae,se){const de=u(ae),ke=u(se);return de===null||ke===null?!1:de<=h(se)&&ke<=h(ae)}const w=/^[0-9a-fA-F]{1,4}$/,k=new I(512);function P(ae){if(A(ae))return null;let se=String(ae).trim();if(se==="")return null;const de=se.indexOf("%");if(de>=0&&(se=se.slice(0,de)),se==="")return null;if(se.indexOf(".")>=0){const He=se.lastIndexOf(":");if(He<0)return null;const Me=$(se.slice(He+1));if(Me===null)return null;se=`${se.slice(0,He+1)}${(Me>>>16&65535).toString(16)}:${(Me&65535).toString(16)}`}const ke=se.split("::");if(ke.length>2)return null;const Ae=G(ke[0]);if(Ae===null)return null;if(ke.length===1)return Ae.length===8?Ae:null;const Te=G(ke[1]);if(Te===null)return null;const je=8-Ae.length-Te.length;if(je<1)return null;const ye=Ae.slice();for(let He=0;He<je;He++)ye.push(0);for(const He of Te)ye.push(He);return ye}function G(ae){if(ae==="")return[];const se=[];for(const de of ae.split(":")){if(!w.test(de))return null;se.push(parseInt(de,16))}return se}function K(ae){if(typeof ae!="string")return P(ae);if(k.has(ae))return k.get(ae);const se=P(ae);return k.set(ae,se),se}function q(ae){if(ae[0]===0&&ae[1]===0&&ae[2]===0&&ae[3]===0&&ae[4]===0&&ae[5]===65535)return`::ffff:${X((ae[6]<<16|ae[7])>>>0)}`;let se=-1,de=0,ke=-1,Ae=0;for(let ye=0;ye<8;ye++)ae[ye]===0?(ke<0?(ke=ye,Ae=1):Ae++,Ae>de&&(de=Ae,se=ke)):(ke=-1,Ae=0);if(de<2)return ae.map(ye=>ye.toString(16)).join(":");const Te=ae.slice(0,se).map(ye=>ye.toString(16)).join(":"),je=ae.slice(se+de).map(ye=>ye.toString(16)).join(":");return`${Te}::${je}`}function B(ae){const se=P(ae);return se===null?null:q(se)}function E(ae){return B(ae)??""}function S(ae){return typeof ae=="string"&&ae.indexOf(":")>=0&&P(ae)!==null}function C(ae,se){const de=K(ae),ke=K(se);if(!de)return ke?1:0;if(!ke)return-1;for(let Ae=0;Ae<8;Ae++)if(de[Ae]!==ke[Ae])return de[Ae]<ke[Ae]?-1:1;return 0}const N=/^[0-9a-fA-F]{12}$/,O=/^[0-9a-fA-F]{4}\.[0-9a-fA-F]{4}\.[0-9a-fA-F]{4}$/,T=/^[0-9a-fA-F]{2}$/;function R(ae){const se=[];for(let de=0;de<12;de+=2)se.push(parseInt(ae.slice(de,de+2),16));return se}function x(ae){if(A(ae))return null;if(typeof ae=="number"){if(!Number.isInteger(ae)||ae<0||ae>0xffffffffffff)return null;const Ae=[];for(let Te=5;Te>=0;Te--)Ae.push(Math.floor(ae/256**Te)%256);return Ae}const se=String(ae).trim();if(se==="")return null;if(N.test(se))return R(se);if(se.indexOf(".")>=0)return O.test(se)?R(se.split(".").join("")):null;const de=se.indexOf(":")>=0?":":se.indexOf("-")>=0?"-":null;if(de===null)return null;const ke=se.split(de);if(ke.length!==6)return null;for(const Ae of ke)if(!T.test(Ae))return null;return ke.map(Ae=>parseInt(Ae,16))}function U(ae){const se=x(ae);if(!se)return null;let de=0;for(const ke of se)de=de*256+ke;return de}function V(ae){const se=x(ae);return se?se.map(de=>de.toString(16).padStart(2,"0")).join(":"):null}function J(ae,se="colon"){const de=x(ae);if(!de)return"";const ke=de.map(Ae=>Ae.toString(16).padStart(2,"0"));switch(se){case"hyphen":return ke.join("-");case"colon-upper":return ke.map(Ae=>Ae.toUpperCase()).join(":");case"cisco":return`${ke[0]}${ke[1]}.${ke[2]}${ke[3]}.${ke[4]}${ke[5]}`;default:return ke.join(":")}}function _(ae){return typeof ae=="string"&&x(ae)!==null}function ee(ae){if(A(ae))return null;const se=String(ae).trim();if(se==="")return null;const de=se.replace(/[:-]/g,"").replace(/\./g,"").toLowerCase();return/^[0-9a-f]+$/.test(de)?de:null}function W(ae,se){const de=ee(ae),ke=ee(se);return!!(de&&ke&&de.includes(ke))}function Z(ae,se){const de=U(ae),ke=U(se);return de===null?ke===null?0:1:ke===null||de<ke?-1:de>ke?1:0}const ne=Object.freeze(["macEquals","macInRange","macContains"]),ie=Object.freeze(["eq","ne","contains","notContains","startsWith","endsWith"]);function ce(ae){switch(ae){case"macEquals":return{compile:se=>{const de=U(se);return de===null?()=>!1:ke=>U(ke)===de},check:se=>U(se)===null?"the operand is not a MAC address":null};case"macInRange":return{compile:se=>{const de=Array.isArray(se)?se:[se,se],ke=U(de[0]),Ae=U(de[1]);return ke===null||Ae===null||ke>Ae?()=>!1:Te=>{const je=U(Te);return je!==null&&je>=ke&&je<=Ae}},check:se=>{const de=Array.isArray(se)?se:[];if(de.length!==2)return"the operand must be two MAC addresses, the low and high ends of the range";const ke=U(de[0]),Ae=U(de[1]);return ke===null||Ae===null?"an end of the range is not a MAC address":ke>Ae?"the low end of the range is above the high end":null}};case"macContains":return{compile:se=>de=>W(de,se),check:se=>ee(se)===null?"the operand is not hex":null};default:return{compile:()=>()=>!1,check:()=>"unknown MAC operator"}}}function me(ae){switch(ae){case"eq":return{compile:se=>{const de=U(se);return de===null?()=>!1:ke=>U(ke)===de},check:se=>U(se)===null?"the operand is not a MAC address":null};case"ne":return{compile:se=>{const de=U(se);return de===null?()=>!1:ke=>U(ke)!==de},check:se=>U(se)===null?"the operand is not a MAC address":null};case"contains":return{compile:se=>de=>W(de,se),check:se=>ee(se)===null?"the operand is not hex":null};case"notContains":return{compile:se=>de=>!W(de,se),check:se=>ee(se)===null?"the operand is not hex":null};case"startsWith":return{compile:se=>{const de=String(se??"").toLowerCase();return ke=>ke==null?!1:String(ke).toLowerCase().startsWith(de)}};case"endsWith":return{compile:se=>{const de=String(se??"").toLowerCase();return ke=>ke==null?!1:String(ke).toLowerCase().endsWith(de)}};default:return{compile:()=>()=>!1,check:()=>"unknown MAC text operator"}}}const Ce=Object.freeze(["lt","lte","gt","gte","between","notBetween","in","notIn","matches"]);function Pe(ae){const se=o(ae);return se===null?null:g(se.address,se.prefix)}function xe(ae,se,de){const ke=ye=>String(ye??"").trim().toLowerCase(),Ae=ye=>{if(ye==null)return null;const He=se(ye);return He===""?null:He.toLowerCase()},Te=ye=>ae(ye)===null?`the operand is not ${de}`:null,je=(ye,He)=>({compile:Me=>{const Re=ke(Me);return Ee=>{const $e=Ae(Ee);return $e===null?He:He?!ye($e,Re):ye($e,Re)}}});return Object.freeze({eq:{compile:ye=>{const He=ae(ye);return He===null?()=>!1:Me=>ae(Me)===He},check:Te},ne:{compile:ye=>{const He=ae(ye);return He===null?()=>!0:Me=>ae(Me)!==He},check:Te},contains:je((ye,He)=>ye.includes(He),!1),notContains:je((ye,He)=>ye.includes(He),!0),startsWith:je((ye,He)=>ye.startsWith(He),!1),endsWith:je((ye,He)=>ye.endsWith(He),!1),...Object.fromEntries(Ce.map(ye=>[ye,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"}),ve=(ae,se)=>de=>{const ke=de&&typeof de.text=="string"?de.text:"";return ke.trim()!==""&&ae(ke)===null?se:null},oe=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:F,parse:ae=>$(ae.text),parseError:ve($,_e.ipv4),compare:j,format:ae=>X(ae.value),operators:xe(H,X,"an IPv4 address"),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:ae=>H(ae),toRow:(ae,se)=>r(ae,se,X),toClipboard:ae=>X(ae),fromClipboard:ae=>$(ae)},cidr:{base:"number",storage:"float64",matches:m,parse:ae=>i(ae.text,{network:t(ae.column)}),parseError:ve(i,_e.cidr),compare:c,format:ae=>n(ae.value),operators:xe(Pe,n,"a network in CIDR form"),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:ae=>{const se=o(ae);return se===null?null:g(se.address,se.prefix)},toRow:(ae,se)=>r(ae,se,n),toClipboard:ae=>n(ae),fromClipboard:(ae,se)=>i(ae,{network:t(se&&se.column)})},ipv6:{base:"text",storage:"dictionary",matches:S,parse:ae=>B(ae.text),parseError:ve(B,_e.ipv6),compare:C,format:ae=>E(ae.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:ae=>B(ae),toClipboard:ae=>E(ae),fromClipboard:ae=>B(ae)},mac:{base:"text",storage:"dictionary",matches:_,parse:ae=>V(ae.text),parseError:ve(V,_e.mac),compare:Z,format:ae=>J(ae.value,ae.column&&ae.column.typeOptions&&ae.column.typeOptions.macFormat),operators:Object.freeze({...Object.fromEntries(ne.map(ae=>[ae,ce(ae)])),...Object.fromEntries(ie.map(ae=>[ae,me(ae)]))}),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:ae=>V(ae),fromClipboard:ae=>V(ae)}}),he=oe}),Ve("packages/core/src/columns/types/vlan.js",function(e,D){"use strict";Object.defineProperty(e,"vlanError",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseVlans",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"formatVlans",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"vlanContains",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"vlanOverlaps",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"vlanCount",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"isVlan",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"compareVlans",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"VLAN_TYPES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}});const re=1,A=4094,Y=/^\d+$/;function I(t,s){const r=!!(s&&s.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 a=c.trim();if(a==="")return{ids:null,error:`"${i}" has an empty entry`};const u=a.indexOf("-");if(u>=0){if(r)return{ids:null,error:"a single-ID VLAN column holds one ID, not a list or range"};const h=a.slice(0,u).trim(),p=a.slice(u+1).trim();if(!Y.test(h)||!Y.test(p))return{ids:null,error:`"${a}" is not a VLAN range like 20-30`};let y=Number(h),d=Number(p);if(y<re||y>A||d<re||d>A)return{ids:null,error:`VLAN IDs are between ${re} and ${A}`};if(y>d){const f=y;y=d,d=f}for(let f=y;f<=d;f++)m.add(f)}else{if(!Y.test(a))return{ids:null,error:`"${a}" is not a VLAN ID (a whole number ${re}-${A})`};const h=Number(a);if(h<re||h>A)return{ids:null,error:`VLAN IDs are between ${re} and ${A}`};if(r&&n.length>1)return{ids:null,error:"a single-ID VLAN column holds one ID, not a list or range"};m.add(h)}}return r&&m.size>1?{ids:null,error:"a single-ID VLAN column holds one ID, not a list or range"}:{ids:[...m].sort((c,a)=>c-a),error:null}}function L(t,s){return I(t,s).error}function Q(t){const s=[];let r=0;for(;r<t.length;){let i=r;for(;i+1<t.length&&t[i+1]===t[i]+1;)i++;s.push(i===r?String(t[r]):`${t[r]}-${t[i]}`),r=i+1}return s.join(",")}function H(t){if(t==null||t==="")return null;if(typeof t=="string")return I(t,{}).ids;if(Array.isArray(t)){const s=new Set;for(const r of t){if(typeof r!="number"||!Number.isInteger(r)||r<re||r>A)return null;s.add(r)}return s.size?[...s].sort((r,i)=>r-i):null}return typeof t=="number"&&Number.isInteger(t)&&t>=re&&t<=A?[t]:null}function $(t,s){const r=I(t,s);return r.ids===null?null:Q(r.ids)}function X(t){const s=H(t);return s===null?"":Q(s)}function F(t,s){const r=H(t);if(r===null)return!1;const i=Number(s);return Number.isInteger(i)&&r.includes(i)}function j(t,s){const r=H(t);if(r===null)return!1;const i=new Set(r),n=Array.isArray(s)?s:typeof s=="string"?s.split(","):[s];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 v(t){const s=H(t);return s===null?0:s.length}function b(t){return typeof t=="string"&&$(t)!==null}function l(t,s){const r=H(t),i=H(s);return r===null?i===null?0:1:i===null?-1:r[0]!==i[0]?r[0]<i[0]?-1:1:r.length<i.length?-1:r.length>i.length?1:0}const g=Object.freeze({vlan:{base:"text",storage:"dictionary",matches:b,parse:t=>$(t.text,{single:!!(t.column&&t.column.typeOptions&&t.column.typeOptions.vlanSingle)}),parseError:t=>L(t.text,{single:!!(t.column&&t.column.typeOptions&&t.column.typeOptions.vlanSingle)}),compare:l,format:t=>X(t.value),defaults:{filter:"text",editor:"vlan",align:"start"},excel:"@",operators:Object.freeze({contains:{compile:t=>s=>F(s,t),check:t=>{const s=Number(typeof t=="string"?t.trim():t);return!Number.isInteger(s)||s<re||s>A?`contains needs one VLAN ID ${re}-${A}`:null}},overlaps:{compile:t=>s=>j(s,t),check:t=>{const s=Array.isArray(t)?t:typeof t=="string"?t.split(","):[t];for(const r of s){const i=Number(typeof r=="string"?r.trim():r);if(!Number.isInteger(i)||i<re||i>A)return`overlaps needs VLAN IDs ${re}-${A}`}return null}}}),toStorage:t=>$(t),toClipboard:t=>X(t),fromClipboard:t=>$(t)}}),o=g}),Ve("packages/core/src/i18n/catalogue.js",function(e,D){"use strict";Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return L}});const re=D("packages/core/src/registry/free-tier-notice.js"),A=re.FREE_TIER_NOTICE,Y=re.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":Y,"licence.watermark.free":A,"filter.op.contains":"Contains","filter.op.notContains":"Does not contain","filter.op.equals":"Equals","filter.op.notEqual":"Does not equal","filter.op.startsWith":"Starts with","filter.op.endsWith":"Ends with","filter.op.blank":"Is blank","filter.op.notBlank":"Is not blank","filter.op.lessThan":"Less than","filter.op.lessThanOrEqual":"Less than or equal","filter.op.greaterThan":"Greater than","filter.op.greaterThanOrEqual":"Greater than or equal","filter.op.inRange":"In range","filter.op.matches":"Matches","filter.op.before":"Before","filter.op.beforeOrEqual":"Before or equal","filter.op.after":"After","filter.op.afterOrEqual":"After or equal","filter.op.relative":"Relative to today","filter.rel.today":"Today","filter.rel.yesterday":"Yesterday","filter.rel.tomorrow":"Tomorrow","filter.rel.lastNDays":"Last N days","filter.rel.nextNDays":"Next N days","filter.rel.thisWeek":"This week","filter.rel.lastWeek":"Last week","filter.rel.thisMonth":"This month","filter.rel.lastMonth":"Last month","filter.rel.thisQuarter":"This quarter","filter.rel.quarterToDate":"Quarter to date","filter.rel.thisYear":"This year","filter.rel.yearToDate":"Year to date","filter.operator":"Operator","filter.operatorNamed":"Operator: {name}","filter.join":"Join","filter.value":"Value","filter.from":"From","filter.to":"To","filter.addCondition":"Add condition","filter.noConditions":"No conditions","filter.removeCondition":"Remove condition","filter.search":"Search","filter.searchValues":"Search values","filter.noMatches":"No values match","filter.selectAll":"Select all","filter.clear":"Clear","filter.order":"Order values","filter.orderAz":"A to Z","filter.orderCount":"Count","filter.all":"All","filter.allExcept":"All but {count}","filter.loadingValues":"Loading values…","filter.topValues":"Top {shown} of {total} values","filter.valuesFailed":"Values could not be loaded: {error}","filter.valuesUnsupported":"This source cannot list the values of {column}; filter by condition instead.","filter.true":"True","filter.false":"False","filter.expression":"Filter expression","filter.column":"Column","filter.relativePeriod":"Relative period","filter.days":"Number of days","filter.tab.set":"Values","filter.tab.text":"Text","filter.tab.number":"Number","filter.tab.date":"Date","filter.tab.advanced":"Advanced","filterRow.label":"Filter row","filterRow.conditions":{one:"{count} condition",other:"{count} conditions"},"chart.empty":"Nothing to chart","chart.summary":"{type} chart of {measure} by {dimension}","chart.summaryShare":"{type} chart of {measure}","chart.summaryType":"{type} chart","chart.summaryGauge":"{type} chart of {measure}, {fn}: {value}","chart.waterfallTotal":"Total","chart.summaryEngine":"Figures computed by the data engine over every matching row","chart.summaryEngineViewport":"{count} points in this view, fetched from the data engine","chart.summaryEngineDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells counted by the data engine","chart.summaryClientDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells computed in the browser","chart.viewportOverCap":"{count} rows in this view, more than the {cap} this map draws; zoom in or narrow the filter","chart.dataTable":"Chart data","chart.viewportFilter.label":"Map view","chart.annotate.rail":"Drawing tools","chart.annotate.select":"Select and move a drawing","chart.annotate.trendLine":"Trend line","chart.annotate.horizontalLine":"Horizontal line","chart.annotate.verticalLine":"Vertical line","chart.annotate.channel":"Parallel channel","chart.annotate.fibonacci":"Fibonacci retracement","chart.annotate.arrow":"Arrow","chart.annotate.pen":"Freehand pen","chart.annotate.pen.described":"Freehand drawing from {from} to {to}","chart.annotate.measure-x":"Date range","chart.annotate.measure-y":"Price range","chart.annotate.measure-xy":"Date and price range","chart.annotate.measure.bars":{one:"{count} bar",other:"{count} bars"},"chart.annotate.measure.points":{one:"{count} point",other:"{count} points"},"chart.annotate.measure.volume":"Vol {value}","chart.annotate.measure.seconds":"{count}s","chart.annotate.measure.minutes":"{count}m","chart.annotate.measure.hours":"{count}h","chart.annotate.measure.days":"{count}d","chart.annotate.measure.weeks":"{count}w","chart.annotate.measure.months":"{count}mo","chart.annotate.measure.years":"{count}y","chart.annotate.measure":"Measure","chart.annotate.measure.dx":"Δx {value}","chart.annotate.measure.dy":"Δy {value}","chart.annotate.measure.pct":"{value}%","chart.annotate.measure.categories":{one:"{count} category",other:"{count} categories"},"chart.annotate.measure.slope.perDay":"Slope {value} per day","chart.annotate.measure.slope.perCategory":"Slope {value} per category","chart.annotate.measure.slope.perUnit":"Slope {value} per unit","chart.annotate.measure.dur.d":"{count} d","chart.annotate.measure.dur.h":"{count} h","chart.annotate.measure.dur.min":"{count} min","chart.annotate.measure.dur.s":"{count} s","chart.annotate.measure.dur.ms":"{count} ms","chart.annotate.measure.announce":"Measurement: {readout}","chart.annotate.measure.start":"Measure start: {x}, {y}","chart.annotate.text":"Text","chart.annotate.callout":"Callout","chart.annotate.note":"Note","chart.annotate.delete":"Delete the selected drawing","chart.annotate.editLabel":"Annotation text","chart.zoom.toolbar":"Zoom controls","chart.zoom.in":"Zoom in","chart.zoom.out":"Zoom out","chart.zoom.left":"Pan left","chart.zoom.right":"Pan right","chart.zoom.reset":"Reset the zoom","chart.legendMore":{one:"+{count} more",other:"+{count} more"},"chart.type.line":"Line","chart.type.area":"Area","chart.type.bar":"Bar","chart.type.pie":"Pie","chart.type.donut":"Donut","chart.type.sunburst":"Sunburst","chart.type.scatter":"Scatter","chart.type.step":"Step","chart.type.rangeArea":"Range","chart.type.horizontalBar":"Horizontal bar","chart.type.waterfall":"Waterfall","chart.type.floatingBar":"Floating bar","chart.type.horizontalFloatingBar":"Horizontal floating bar","chart.type.populationPyramid":"Population pyramid","chart.type.bullet":"Bullet","chart.type.bubble":"Bubble","chart.type.histogram":"Histogram","chart.type.boxplot":"Box plot","chart.type.forest":"Forest plot","chart.type.qq":"QQ plot","chart.type.ecdf":"ECDF","chart.type.lorenz":"Lorenz","chart.type.correlogram":"Correlogram","chart.type.control":"Control","chart.type.capability":"Capability","chart.type.movingRange":"Moving range","chart.type.treemap":"Treemap","chart.type.combo":"Combination","chart.type.pareto":"Pareto","chart.type.heatmap":"Heat map","chart.type.radar":"Radar","chart.type.gauge":"Gauge","chart.type.funnel":"Funnel","chart.type.candlestick":"Candlestick","chart.type.ohlc":"OHLC","chart.type.polarArea":"Polar area","chart.type.nightingale":"Nightingale rose","chart.type.rose":"Rose","chart.type.radialBar":"Radial bar","chart.type.polarScatter":"Polar scatter","chart.type.geomap":"Map","chart.type.sankey":"Sankey","chart.type.chord":"Chord","chart.type.pyramid":"Pyramid","chart.type.pictorial":"Pictorial","chart.type.serpentine":"Serpentine timeline","chart.type.spiral":"Spiral timeline","chart.edit.aggregated":"This value is a total of several rows, so it cannot be dragged.","chart.edit.refused":"That change was not applied.","chart.edit.refusedWhy":"That change was not applied: {reason}","chart.type.network":"Network","chart.type.stream":"Stream","chart.type.marimekko":"Marimekko","chart.type.violin":"Violin","chart.type.gantt":"Gantt","chart.type.forceTree":"Force-directed tree","chart.type.pack":"Packed circles","chart.type.tree":"Tree","chart.type.voronoiTreemap":"Voronoi treemap","chart.type.alluvial":"Alluvial","chart.type.arc":"Arc diagram","chart.type.barRace":"Bar chart race","chart.type.bubblemap":"Bubble map","chart.type.bump":"Bump chart","chart.type.calendar":"Calendar heat map","chart.type.choropleth":"Choropleth map","chart.type.decomposition":"Decomposition tree","chart.type.diverging":"Diverging bar","chart.type.dumbbell":"Dumbbell","chart.type.fan":"Fan chart","chart.type.hexbin":"Hexagonal bin","chart.type.hexmap":"Hex map","chart.type.icicle":"Icicle","chart.type.markermap":"Marker map","chart.type.motion":"Motion chart","chart.type.parallel":"Parallel coordinates","chart.type.ridgeline":"Ridgeline","chart.type.roc":"ROC curve","chart.type.scatter3d":"3D scatter","chart.type.slope":"Slope chart","chart.type.splom":"Scatter plot matrix","chart.type.venn":"Venn diagram","chart.type.waffle":"Waffle","chart.type.wordCloud":"Word cloud","chart.tasksDropped":{one:"{count} more task not shown",other:"{count} more tasks not shown"},"chart.geoUnmatched":{one:"{count} row could not be placed on the map",other:"{count} rows could not be placed on the map"},"chart.r2":"R² {value}","ai.insights":"Insights","ai.explainView":"Explain this view","ai.explain":"Explain","ai.ask":"Ask","ai.apply":"Apply","ai.discard":"Discard","ai.propose":"Propose","ai.approve":"Approve","ai.thinking":"Thinking…","ai.applying":"Applying…","ai.applied":"Applied: {what}","ai.couldNotApply":"Could not apply: {why}","ai.applyFailed":"it failed","ai.discarded":"Discarded.","ai.discardedNothingWritten":"Discarded. Nothing was written.","ai.nothingWritten":"Nothing was written.","ai.nothingWrittenVetoed":"Nothing was written — a before-handler vetoed it.","ai.scope":"Scope: {scope}","ai.unsafeQuery":"I could not turn that into a safe query: {why}","ai.nothingToDo":"nothing to do","ai.insightsFailed":"Could not generate insights right now. The grid is unaffected.","ai.modelUnreachable":"Could not reach the model right now. The grid is unaffected.","ai.flagged":{one:"{count} unverified figure was removed as ungrounded.",other:"{count} unverified figures were removed as ungrounded."},"ai.askPlaceholder":"Ask your data: “EMEA deals over 50k, biggest first”","ai.askLabel":"Ask your data","ai.actorPlaceholder":"Ask AI to change data: “set the Network Upgrade project to In Progress”","ai.actorLabel":"Ask AI to change data","editor.password.show":"Show value","editor.password.hide":"Hide value","editor.password.showField":"Show {column}","editor.password.hideField":"Hide {column}","facets.computing":"Computing…","facets.suppressed.cardinality":"Too many distinct values to chart","facets.suppressed.rows":"Too many rows to chart","facets.suppressed.streaming":"Paused while live data is streaming","facets.suppressed.noProvider":"No distribution available for this data source","facets.suppressed.type":"This column has no chartable distribution","facets.suppressed.unavailable":"Histogram unavailable","facets.bucketOf":"{count} of {whole} rows","history.undo":"Undo","history.redo":"Redo","history.described":"{action} {label}","history.nothingToUndo":"Nothing to undo","history.nothingToRedo":"Nothing to redo","history.undoDisabled":"Undo (nothing to undo)","history.redoDisabled":"Redo (nothing to redo)","a11y.presence.joined":"{name} joined","a11y.presence.left":"{name} left","prompt.asking":"Asking…","prompt.moreNotes":{one:"and {count} more",other:"and {count} more"},"shortcuts.key.cmd":"Cmd","timeline.live":"Live","timeline.recording":"recording…","panel.zoneHint.group":"Drag a column here to group rows by its values","panel.zoneHint.values":"Drag a column here to total it","panel.zoneHint.pivot":"Drag a column here to pivot across its values","panel.zoneHint.any":"Drag a column here","panel.rowsOf":"{shown} of {total} rows","views.empty":"No saved views yet. Set the grid up as you want it, then save it below.","views.applied":"Applied","views.matchesGrid":"Matches the grid as it is","views.delete":"Delete","views.confirmDelete":"Delete {name}?","views.confirmDeleteLabel":"Confirm deleting {name}","views.shared":"View copied to the clipboard","views.sharedDownload":"Clipboard unavailable; the view was downloaded as {name}","views.sharedFailed":"The view could not be copied or downloaded","views.rename":"Rename","views.ownedBy":"Owned by {name}","views.ownerOnlyReason":"Only {name} or an admin can do that","views.noOwnerReason":"Only an admin can do that — this view has no recorded owner","views.unshare":"Unshare","views.unshareTitle":"Stop sharing {name}","views.duplicate":"Duplicate","views.duplicateTitle":"Duplicate {name}","views.copyName":"{name} (copy)","gantt.row.expand":"Expand {name}","gantt.row.collapse":"Collapse {name}","gantt.resource.over":"{name} — over-allocated","kanban.board":"Board","kanban.requiredTitle":"Required fields","kanban.requiredSave":"Save","kanban.requiredCancel":"Cancel","kanban.moveRefused":'Move refused: a card in "{from}" cannot move to "{to}".',"kpi.status.good":"good","kpi.status.warn":"warn","kpi.status.critical":"critical","kpi.status.unknown":"No data","kpi.node.item":"{count} item","kpi.node.items":"{count} items","kpi.node.worst":"worst status {status}","kpi.node.unknown":"{count} unknown","sidebar.nav":"Main navigation","sidebar.search":"Search","sidebar.collapse":"Collapse sidebar","sidebar.expand":"Expand sidebar","toolbar.more":"More"}),L=Object.freeze(Object.keys(I))}),Ve("packages/core/src/i18n/format.js",function(e,D){"use strict";Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"formatMessage",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return v}});const A=D("packages/core/src/internal/predicates.js").isFunction,Y=/\{(\w+)\}/g,I=new Map,L=new Map;function Q(b){const l=b||"";if(I.has(l))return I.get(l);let g=null;try{g=new Intl.PluralRules(b||void 0)}catch{g=null}return I.set(l,g),g}function H(b,l,g="conjunction"){const o=Array.isArray(b)?b.filter(r=>r!=null&&r!==""):[];if(o.length===0)return"";if(o.length===1)return String(o[0]);const t=`${l||""}|${g}`;let s=L.get(t);if(s===void 0){try{s=new Intl.ListFormat(l||void 0,{style:"long",type:g})}catch{s=null}L.set(t,s)}return s?s.format(o.map(String)):o.map(String).join(", ")}function $(b,l){return b==null?"":typeof b=="number"?Number.isFinite(b)?b.toLocaleString(l||void 0,{maximumFractionDigits:20}):"":String(b)}function X(b,l,g){if(typeof b=="string")return b;if(!b||typeof b!="object")return"";const o=l&&typeof l.count=="number"?l.count:null;if(o===null)return b.other??"";const t=Q(g),s=t?t.select(o):o===1?"one":"other";return b[s]??b.other??""}function F(b,l={},g){const o=X(b,l,g);return o?o.replace(Y,(t,s)=>Object.prototype.hasOwnProperty.call(l,s)?$(l[s],g):t):""}function j(b,l,g="en-GB"){return typeof b=="string"&&b?b:typeof l=="string"&&l?l:g}function v(b,l){const g=b?b[l]:void 0;return g==null||A(g)?l:g}}),Ve("packages/core/src/i18n/registry.js",function(e,D){"use strict";Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"localeCatalogue",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return Q}});const A=D("packages/core/src/i18n/catalogue.js").EN_GB,Y=new Map([["en-gb",A]]);function I(H,$){const X=typeof H=="string"?H.toLowerCase():"";return!X||!$||typeof $!="object"?!1:(Y.set(X,$),!0)}function L(H){if(typeof H!="string"||!H)return null;const $=H.toLowerCase(),X=Y.get($);if(X)return X;const F=$.split("-")[0],j=Y.get(F);if(j)return j;for(const[v,b]of Y)if(v.split("-")[0]===F)return b;return null}function Q(){return[...Y.keys()]}}),Ve("packages/core/src/i18n/index.js",function(e,D){"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 s}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return i}});const re=D("packages/core/src/i18n/catalogue.js"),A=re.EN_GB,Y=re.MESSAGE_KEYS,I=D("packages/core/src/i18n/format.js"),L=I.formatMessage,Q=I.formatList,H=I.lookup,$=I.resolveLocale,F=D("packages/core/src/internal/predicates.js").isFunction,v=D("packages/core/src/internal/warn.js").warnOnce,b=D("packages/core/src/i18n/registry.js"),l=b.registerLocale,g=b.localeCatalogue;Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return re.EN_GB}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return re.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=A;constructor(m={}){this.configure(m)}configure(m={}){this.#e=$(m.locale,m.declared,o);const c=m.messages,a=g(this.#e);if(!a&&this.#e.toLowerCase()!=="en-gb"&&(!c||typeof c!="object")&&v(`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=a?{...A,...a}:A;return}const h=Object.keys(c).filter(p=>!(p in A));h.length&&v(`i18n:unknown:${h[0]}`,`message keys not in the catalogue and so ignored: ${h.slice(0,5).join(", ")}${h.length>5?`, and ${h.length-5} more`:""}`),this.#t={...A,...a||{},...c}}get locale(){return this.#e}t(m,c){return L(H(this.#t,m),c||{},this.#e)}list(m,c){return Q(m,this.#e,c)}number(m,c){const a=Number(m);return Number.isFinite(a)?a.toLocaleString(this.#e,c||{maximumFractionDigits:20}):""}}const s=new t;function r(n){return n instanceof t?n:new t(n||{})}function i(n){const m=n&&typeof n=="object"?n:{},c=Y.filter(u=>{const h=m[u];return h==null||h===""||F(h)}),a=Object.keys(m).filter(u=>!(u in A));return{missing:c,unknown:a}}}),Ve("packages/core/src/columns/types/structured.js",function(e,D){"use strict";Object.defineProperty(e,"MASK_DEFAULTS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"parseJsonText",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}});const re=D("packages/core/src/internal/predicates.js"),A=re.isNil,Y=re.isObject,L=D("packages/core/src/i18n/index.js").defaultMessages,Q=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function H(t,s){const r=s||{},i=r.emptyDisplay??Q.emptyDisplay;if(A(t)||t==="")return i;const m=[...typeof r.char=="string"&&r.char!==""?r.char:Q.char][0]||Q.char,c=r.fixedLength??Q.fixedLength,a=Number.isFinite(r.length)&&Number(r.length)>0?Math.floor(Number(r.length)):Q.length,u=typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):null;let h=0;if(u!==null){const p=Number.isFinite(r.lastVisible)?Math.floor(Number(r.lastVisible)):Q.lastVisible,y=[...u];if(h=p>0&&p<y.length?p:0,h>0){const d=y.slice(y.length-h).join(""),f=Math.max(1,(c?a:y.length)-h);return m.repeat(f)+d}return m.repeat(c?a:Math.max(1,y.length))}return m.repeat(a)}const $=48;function X(t){try{const s=JSON.stringify(t);return s===void 0?null:s}catch{return null}}function F(t,s){if(A(t))return"";const r=Number.isFinite(s&&s.inlineLimit)?Number(s.inlineLimit):$;if(typeof t=="string")return t.length>r?`${t.slice(0,r-1)}…`:t;if(typeof t!="object")return String(t);const i=X(t);if(i!==null&&i.length<=r)return i;if(Array.isArray(t)){const m=t.length;return`[${L.t("count.items",{count:m})}]`}const n=Object.keys(t).length;return`{${L.t("count.keys",{count:n})}}`}function j(t,s){if(t==null)return"null";const r=typeof t;if(r==="number"||r==="boolean"||r==="bigint")return String(t);if(r==="string")return JSON.stringify(t);if(r!=="object")return JSON.stringify(String(t));const i=s||new WeakSet;return i.has(t)?'"[circular]"':(i.add(t),t instanceof Date?JSON.stringify(t.toISOString()):Array.isArray(t)?`[${t.map(c=>j(c,i)).join(",")}]`:`{${Object.keys(t).sort().map(c=>`${JSON.stringify(c)}:${j(t[c],i)}`).join(",")}}`)}function v(t,s){if(A(t))return A(s)?0:1;if(A(s))return-1;const r=j(t),i=j(s);return r<i?-1:r>i?1:0}function b(t){if(A(t))return null;const s=String(t);if(s.trim()==="")return null;try{return JSON.parse(s)}catch{return s}}function l(t){const s=t&&t.cell&&t.cell.props;return Y(s)?s:{}}const g=Object.freeze({json:{base:"object",storage:"object",format:t=>F(t&&t.value,l(t&&t.column)),parse:t=>b(t&&t.text),compare:v,defaults:{editor:"code",filter:"text",align:"start"},excel:"@",toClipboard:t=>{if(A(t))return"";if(typeof t=="string")return t;try{const s=JSON.stringify(t,null,2);return s===void 0?String(t):s}catch{return String(t)}},fromClipboard:t=>b(t)},secret:{base:"text",storage:"object",format:t=>H(t&&t.value,l(t&&t.column)),parse:t=>{const s=t&&t.text;return A(s)||String(s)===""?null:String(s)},compare:(t,s)=>{const r=A(t)||t==="",i=A(s)||s==="";return r===i?0:r?1:-1},defaults:{editor:"password",filter:"none",align:"start"},excel:"@",export:{csv:!1,excel:!1},toClipboard:t=>H(t),fromClipboard:t=>A(t)||String(t)===""?null:String(t)}}),o=g}),Ve("packages/core/src/columns/types/unit.js",function(e,D){"use strict";Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return v}}),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 S}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return T}});const A=D("packages/core/src/internal/predicates.js").isNil,I=D("packages/core/src/internal/warn.js").warnOnce;function L(R,x,U,V){return Object.freeze({symbol:R,factor:x,aliases:Object.freeze(U||[]),binary:!!(V&&V.binary),prefix:V&&V.prefix||null,auto:!(V&&V.auto===!1)})}function Q(R,x,U,V){return L(R,x,U,V)}const H=Object.freeze({data:Object.freeze([L("B",1,["byte","bytes"]),L("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),L("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),L("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),L("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),L("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),L("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),L("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),L("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),L("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([L("bps",1,["bit","bits","bit/s","b/s"]),L("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),L("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),L("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),L("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([L("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),L("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),L("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),L("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),L("in",.0254,["inch","inches"],{auto:!1}),L("ft",.3048,["foot","feet"],{auto:!1}),L("yd",.9144,["yard","yards"],{auto:!1}),L("m",1,["metre","metres","meter","meters"]),L("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),L("mi",1609.344,["mile","miles"],{auto:!1}),L("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([L("mg",.001,["milligram","milligrams"]),L("g",1,["gram","grams"]),L("oz",28.349523125,["ounce","ounces"],{auto:!1}),L("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),L("kg",1e3,["kilogram","kilograms"]),L("st",6350.29318,["stone"],{auto:!1}),L("t",1e6,["tonne","tonnes","ton"],{auto:!1}),L("ton (US)",907184.74,["ton","shortton"],{auto:!1}),L("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([L("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),L("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),L("ms",.001,["msec","msecs","millisecond","milliseconds"]),L("s",1,["sec","secs","second","seconds"]),L("m",60,["min","mins","minute","minutes"]),L("h",3600,["hr","hrs","hour","hours"]),L("d",86400,["day","days"])]),speed:Object.freeze([L("mm/s",.001,["millimetre/s","millimeter/s"]),L("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),L("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),L("mph",.44704,["mile/h","miles/h"],{auto:!1}),L("kn",1852/3600,["knot","knots"],{auto:!1}),L("m/s",1,["metre/s","meter/s","mps"]),L("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([L("mm/s²",.001,["mm/s2"]),L("ft/s²",.3048,["ft/s2"],{auto:!1}),L("m/s²",1,["m/s2","metre/s2","meter/s2"]),L("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([L("mm²",1e-6,["mm2"]),L("cm²",1e-4,["cm2"]),L("in²",64516e-8,["in2","sqin"],{auto:!1}),L("ft²",.09290304,["ft2","sqft"],{auto:!1}),L("yd²",.83612736,["yd2","sqyd"],{auto:!1}),L("m²",1,["m2","sqm"]),L("ha",1e4,["hectare","hectares"],{auto:!1}),L("ac",4046.8564224,["acre","acres"],{auto:!1}),L("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([L("µL",1e-6,["ul","microlitre","microliter"]),L("mL",.001,["millilitre","milliliter"]),L("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),L("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),L("L",1,["litre","litres","liter","liters"]),L("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),L("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),L("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),L("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([L("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),L("J",1,["joule","joules"]),L("cal",4.184,["calorie","calories"],{auto:!1}),L("kJ",1e3,["kilojoule","kilojoules"]),L("BTU",1055.05585262,["btu"],{auto:!1}),L("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),L("MJ",1e6,["megajoule","megajoules"]),L("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),L("GJ",1e9,["gigajoule","gigajoules"]),L("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([L("mW",.001,["milliwatt","milliwatts"]),L("W",1,["watt","watts"]),L("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),L("kW",1e3,["kilowatt","kilowatts"]),L("hp",745.6998715822702,["horsepower"],{auto:!1}),L("MW",1e6,["megawatt","megawatts"]),L("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([L("mN",.001,["millinewton","millinewtons"]),L("N",1,["newton","newtons"]),L("lbf",4.4482216152605,["poundforce"],{auto:!1}),L("kgf",9.80665,["kilogramforce"],{auto:!1}),L("kN",1e3,["kilonewton","kilonewtons"]),L("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([L("Pa",1,["pascal","pascals"]),L("mbar",100,["millibar"],{auto:!1}),L("inH₂O",249.0889,["inh2o"],{auto:!1}),L("mmHg",133.322387415,["torr"],{auto:!1}),L("kPa",1e3,["kilopascal","kilopascals"]),L("inHg",3386.388640341,["inhg"],{auto:!1}),L("psi",6894.757293168361,["lbf/in2"],{auto:!1}),L("bar",1e5,[],{auto:!1}),L("atm",101325,["atmosphere","atmospheres"],{auto:!1}),L("MPa",1e6,["megapascal","megapascals"]),L("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([L("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),L("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),L("kN·m",1e3,["knm","kn.m"],{auto:!1}),L("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([L("kg/m³",1,["kg/m3"]),L("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),L("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),L("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([L("L/min",1/6e4,["lpm","l/min"],{auto:!1}),L("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),L("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),L("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),L("cfm",.0004719474432,["ft3/min"],{auto:!1}),L("L/s",.001,["lps","l/s"],{auto:!1}),L("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([L("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),L("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),L("mrad",.001,["milliradian","milliradians"],{auto:!1}),L("mil",Math.PI/3200,["nato-mil"],{auto:!1}),L("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),L("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),L("rad",1,["radian","radians"]),L("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([L("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),L("rad/s",1,["radps","radians/s"]),L("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),L("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([L("ppt",1e-12,["partspertrillion"],{auto:!1}),L("ppb",1e-9,["partsperbillion"]),L("ppm",1e-6,["partspermillion"]),L("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),L("‰",.001,["permille","permil"],{auto:!1}),L("%",.01,["pct","percent"]),L("×",1,["x","ratio","times"])]),molarity:Object.freeze([L("pM",1e-12,["picomolar","picomolarity"]),L("nM",1e-9,["nanomolar","nanomolarity"]),L("µM",1e-6,["um-molar","micromolar","micromolarity"]),L("mM",.001,["millimolar","millimolarity"]),L("M",1,["molar","mol/l","mol/L","molarity"]),L("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([L("mg/s",1e-6,["milligrams/s"]),L("g/s",.001,["grams/s"]),L("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),L("kg/s",1,["kilograms/s","kgps"]),L("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),L("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),L("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([L("µPa·s",1e-6,["upas","micropascalsecond"]),L("cP",.001,["centipoise"],{auto:!1}),L("mPa·s",.001,["mpas","millipascalsecond"]),L("P",.1,["poise"],{auto:!1}),L("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([L("cSt",1e-6,["centistokes","centistoke"]),L("mm²/s",1e-6,["mm2/s"],{auto:!1}),L("St",1e-4,["stokes","stoke"],{auto:!1}),L("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([L("mW/(m·K)",.001,["mw/mk"]),L("W/(m·K)",1,["w/mk","wmk"]),L("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),L("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([L("J/(kg·K)",1,["j/kgk","jkgk"]),L("kJ/(kg·K)",1e3,["kj/kgk"]),L("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([L("nSv/h",1e-9,["nsvh"]),L("µSv/h",1e-6,["usv/h","usvh"]),L("mSv/h",.001,["msvh"]),L("Sv/h",1,["svh"]),L("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),$=Symbol("ambiguous"),X=new Map,F=new Map;function j(R,x){const U=String(R||"").trim();if(!U)throw new Error("[lattice] a unit system needs a name");if(H[U]||F.has(U))throw new Error(`[lattice] unit system "${U}" already exists`);const V=[...x||[]];if(!V.length)throw new Error(`[lattice] unit system "${U}" has no units`);if(!V.some(_=>_.factor===1))throw new Error(`[lattice] unit system "${U}" has no base unit (none with factor 1)`);const J=new Set;for(const _ of V){if(J.has(_.symbol))throw new Error(`[lattice] unit system "${U}" declares "${_.symbol}" twice`);J.add(_.symbol)}return F.set(U,Object.freeze(V)),X.delete(U),U}function v(){return[...Object.keys(H),...F.keys()]}function b(R){const x=l(R);return x?x.units:[]}function l(R){const x=String(R||""),U=X.get(x);if(U!==void 0)return U;const V=H[x]||F.get(x);if(!V)return X.set(x,null),null;const J=Object.freeze([...V].sort((ne,ie)=>ne.factor-ie.factor)),_=new Map,ee=new Map,W=(ne,ie)=>{const ce=_.get(ne);ce===void 0?_.set(ne,ie):ce!==ie&&_.set(ne,$)};for(const ne of J){W(ne.symbol.toLowerCase(),ne);for(const ie of ne.aliases)W(ie.toLowerCase(),ne);if(ne.prefix){const ie=ee.get(ne.prefix)||[];ie.push(ne),ee.set(ne.prefix,ie)}}const Z={units:J,byToken:_,byPrefix:ee,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 X.set(x,Z),Z}function g(R,x){return x&&R.binary||R.decimal}function o(R,x){const U=l(R);if(!U||A(x))return null;const V=U.units.find(_=>_.symbol===String(x));if(V)return V;const J=U.byToken.get(String(x).trim().toLowerCase());return J&&J!==$?J:null}const t=new WeakMap;function s(R){const x=R||{};if(typeof x=="object"&&x!==null){const _=t.get(x);if(_!==void 0)return _}const U=x.system||"data",V=l(U);let J=null;if(!V)I(`unit:system:${U}`,`unknown unit system "${U}"; known systems are ${v().join(", ")}`);else{let _=x.unit?o(U,x.unit):null;_||(x.unit&&I(`unit:unit:${U}:${x.unit}`,`unknown unit "${x.unit}" in system "${U}"; falling back to ${V.units[0].symbol}`),_=V.units.find(ee=>ee.factor===1)||V.units[0]),J={index:V,base:_,binary:x.binary===!0}}return typeof x=="object"&&x!==null&&t.set(x,J),J}const r=new WeakMap;function i(R,x){if(!R||!x||!Array.isArray(R.compound)||R.compound.length===0)return null;const U=r.get(R);if(U!==void 0)return U;const V=new Set,J=[];for(const ee of R.compound){const W=o(R.system||"data",ee);if(!W){I(`unit:compound:${R.system}:${ee}`,`unknown compound unit "${ee}" in system "${R.system||"data"}"; ignoring it`);continue}V.has(W.symbol)||(V.add(W.symbol),J.push(W))}J.sort((ee,W)=>W.factor-ee.factor);const _=J.length>=2?J:null;return r.set(R,_),_}function n(R,x,U){return x===U||x.factor===U.factor?R:R*x.factor/U.factor}const m=new Map;function c(R){const x=R||"",U=m.get(x);if(U)return U;const V={group:",",decimal:"."};try{for(const J of new Intl.NumberFormat(R||void 0).formatToParts(12345.6))J.type==="group"?V.group=J.value:J.type==="decimal"&&(V.decimal=J.value)}catch{}return m.set(x,V),V}const a=/[\s ]/g,u=/^[+-]?[\d '’ .,]*(?:[eE][+-]?\d+)?/,h=/^[^\d+\-(.,\s]+\s*/,p=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function y(R,x){const{group:U,decimal:V}=c(x);let J=String(R).replace(a,"");if(J==="")return null;const _=V?J.indexOf(V):-1;if(U&&U!==V){if(_>=0&&J.indexOf(U,_+V.length)>=0)return null;J=J.split(U).join("")}if(V&&V!=="."&&(J=J.split(V).join(".")),!p.test(J))return null;const ee=Number(J);return Number.isFinite(ee)?ee:null}function d(R,x,U){const V=String(R).trim().replace(/\.$/,"");if(V==="")return null;const J=x.units.find(ie=>ie.symbol===V);if(J)return J;const _=V.toLowerCase(),ee=x.byToken.get(_);if(ee===$)return null;if(ee)return ee;const W=x.byPrefix.get(_);if(!W||!W.length)return null;const Z=g(x,U),ne=W.filter(ie=>Z.includes(ie));return ne.length===1?ne[0]:null}function f(R,x,U,V){let J=R,_=0,ee=!1,W=!1;for(;J!=="";){const Z=u.exec(J)[0];if(Z==="")return null;const ne=y(Z,V&&V.locale);if(ne===null)return null;J=J.slice(Z.length).trim();const ie=J.search(/[+-]?[\d]/),ce=(ie>=0?J.slice(0,ie):J).trim();if(J=ie>=0?J.slice(ie).trim():"",ce===""){if(ee)return null;W=!0,_+=n(ne,U[0],x.base)}else{const me=d(ce,x.index,x.binary);if(!me)return null;_+=n(ne,me,x.base)}if(ee=!0,W&&J!=="")return null}return ee?_:null}function w(R,x){if(A(R))return null;if(typeof R=="number")return Number.isFinite(R)?R:null;const U=s(x);if(!U)return null;let V=String(R).trim();if(V==="")return null;let J=!1;V.startsWith("(")&&V.endsWith(")")&&(J=!0,V=V.slice(1,-1).trim());const _=i(x,U);if(_){V.startsWith("-")&&(J=!0,V=V.slice(1).trim());const Ce=f(V,U,_,x);return Ce===null?null:J?-Ce:Ce}let ee=null;const W=h.exec(V);if(W&&W[0]){const Ce=d(W[0].trim(),U.index,U.binary);Ce&&(ee=Ce,V=V.slice(W[0].length).trim())}const Z=u.exec(V)[0],ne=y(Z,x&&x.locale);if(ne===null)return null;const ie=V.slice(Z.length).trim();if(ee&&ie!=="")return null;const ce=ee||(ie===""?U.base:d(ie,U.index,U.binary));if(!ce)return null;const me=n(ne,ce,U.base);return J?-me:me}const k=new Map;function P(R,x,U,V){const J=`${R||""}|${x}|${U}|${V?1:0}`;let _=k.get(J);return _||(_=new Intl.NumberFormat(R||void 0,{minimumFractionDigits:x,maximumFractionDigits:U,useGrouping:V}),k.set(J,_)),_}function G(R,x){if(!Number.isFinite(R)||R===0)return Math.max(0,x-1);const U=Math.floor(Math.log10(Math.abs(R)));return Math.min(20,Math.max(0,x-1-U))}function K(R,x){if(!Number.isFinite(R)||R===0)return R;const U=Math.ceil(Math.log10(Math.abs(R))),V=10**(x-U);return Math.round(R*V)/V}function q(R,x,U){if(!U||U===x.base.symbol)return x.base;if(U!=="auto")return B(x,U);if(R===0||!Number.isFinite(R))return x.base;const V=Math.abs(R)*x.base.factor,J=g(x.index,x.binary);let _=J[0];for(const Z of J)V>=Z.factor&&(_=Z);if(V>=_.factor)return _;let ee=_;for(const Z of x.index.units)Z.binary!==x.binary&&Z.factor!==1||Z.factor<=V&&Z.factor>(ee===_?0:ee.factor)&&(ee=Z);if(ee!==_)return ee;let W=_;for(const Z of x.index.units)Z.binary!==x.binary&&Z.factor!==1||Z.factor<W.factor&&(W=Z);return W.factor<x.base.factor?W:x.base}function B(R,x){const U=R.index.units.find(J=>J.symbol===x);if(U)return U;const V=R.index.byToken.get(String(x).toLowerCase());return V&&V!==$?V:(I(`unit:display:${x}`,`unknown display unit "${x}"; rendering in ${R.base.symbol}`),R.base)}function E(R,x,U,V){const J=R<0;let _=Math.abs(R)*x.base.factor;const ee=typeof V.decimals=="number"?V.decimals:V.minDecimals??0,W=typeof V.decimals=="number"?V.decimals:V.maxDecimals??Math.max(ee,2),Z=V.space??" ",ne=[];for(let ce=0;ce<U.length;ce++){const me=U[ce],Ce=ce===U.length-1;let Pe=Ce?_/me.factor:Math.floor(_/me.factor);if(_-=Pe*me.factor,Ce){const _e=10**W;Pe=Math.round(Pe*_e)/_e+0}const xe=Ce?P(V.locale,ee,W,V.group!==!1):P(V.locale,0,0,V.group!==!1);ne.push(`${xe.format(Pe)}${Z}${me.symbol}`)}const ie=ne.join(" ");return J?`-${ie}`:ie}function S(R,x){const U=x||{},V=U.nullDisplay??"";if(A(R)||R==="")return V;const J=typeof R=="number"?R:Number(R);if(!Number.isFinite(J))return V;const _=s(U);if(!_)return String(J);const ee=i(U,_);if(ee)return E(J,_,ee,U);const W=typeof U.significantFigures=="number"&&U.significantFigures>0?U.significantFigures:0,Z=W?K(J,W):J,ne=q(Z,_,U.display),ie=n(Z,_.base,ne);let ce=typeof U.decimals=="number"?U.decimals:U.minDecimals??0,me=typeof U.decimals=="number"?U.decimals:U.maxDecimals??Math.max(ce,2);W&&(ce=G(ie,W),me=ce);const Ce=P(U.locale,ce,me,U.group!==!1).format(ie),Pe=U.space??" ";return U.placement==="prefix"?`${ne.symbol}${U.space??""}${Ce}`:`${Ce}${Pe}${ne.symbol}`}function C(R,x){const U=A(R)||Number.isNaN(R)?null:Number(R),V=A(x)||Number.isNaN(x)?null:Number(x);return U===null||Number.isNaN(U)?V===null||Number.isNaN(V)?0:1:V===null||Number.isNaN(V)||U<V?-1:U>V?1:0}function N(R){const x=typeof R.decimals=="number"&&R.decimals>0?`.${"0".repeat(R.decimals)}`:"";return`${typeof R.decimals=="number"?`#,##0${x}`:"#,##0.##"}" ${R.symbol}"`}function O(R){const x={system:"data",...R||{}},U=s(x),V=U?U.base.symbol:String(x.unit||""),J=Object.freeze({...x,unit:V}),_=Object.freeze({...J,display:V,decimals:void 0,minDecimals:0,maxDecimals:20,group:!1}),ee=new Map([[J.locale||"",J]]),W=Z=>{const ne=Z||"";let ie=ee.get(ne);return ie||(ie=Object.freeze({...J,locale:Z||void 0}),ee.set(ne,ie)),ie};return{base:"number",extends:"number",storage:"float64",unitConfig:J,format:Z=>S(Z.value,Z.locale?W(Z.locale):J),parse:Z=>w(Z.text,Z.locale?W(Z.locale):J),compare:C,defaults:{filter:"number",editor:"unit",align:"end",total:x.total||"sum"},...x.totals?{totals:x.totals}:{},excel:x.excel||N({decimals:x.decimals,symbol:V}),toStorage:Z=>typeof Z=="number"?Number.isFinite(Z)?Z:null:typeof Z=="string"?w(Z,J):A(Z)?null:w(String(Z),J),toClipboard:Z=>S(Z,_),fromClipboard:Z=>w(Z,J)}}const T=O}),Ve("packages/core/src/columns/types/engineering.js",function(e,D){"use strict";Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return L}});const A=D("packages/core/src/internal/predicates.js").isNil,I=D("packages/core/src/columns/types/unit.js").createUnitType;function L($){const X=2*Math.PI/$;return F=>{let j=0,v=0,b=0;for(const g of F||[]){if(A(g))continue;const o=Number(g);Number.isFinite(o)&&(j+=Math.cos(o*X),v+=Math.sin(o*X),b+=1)}return!b||Math.hypot(j,v)/b<1e-12?null:(Math.atan2(v,j)/X%$+$)%$}}function Q($){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:L($)}}}const H=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})})}),Ve("packages/core/src/columns/types/si.js",function(e,D){"use strict";Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return j}});const re=D("packages/core/src/columns/types/unit.js"),A=re.defineUnit,Y=re.registerUnitSystem,I=re.createUnitType,L=Object.freeze([Object.freeze({symbol:"f",name:"femto",factor:1e-15}),Object.freeze({symbol:"p",name:"pico",factor:1e-12}),Object.freeze({symbol:"n",name:"nano",factor:1e-9}),Object.freeze({symbol:"µ",name:"micro",factor:1e-6}),Object.freeze({symbol:"m",name:"milli",factor:.001}),Object.freeze({symbol:"c",name:"centi",factor:.01}),Object.freeze({symbol:"",name:"",factor:1}),Object.freeze({symbol:"k",name:"kilo",factor:1e3}),Object.freeze({symbol:"M",name:"mega",factor:1e6}),Object.freeze({symbol:"G",name:"giga",factor:1e9}),Object.freeze({symbol:"T",name:"tera",factor:1e12}),Object.freeze({symbol:"P",name:"peta",factor:1e15})]),Q=Object.freeze(["p","n","µ","m","","k","M","G"]);function H(v){const b=String(v.base),l=new Set([...v.prefixes||Q,""]),g=[];for(const o of L){if(!l.has(o.symbol))continue;const t=`${o.symbol}${b}`,s=[];if(v.name){s.push(`${o.name}${v.name}`,`${o.name}${v.name}s`);const r=o.name.slice(-1);if(r&&v.name.startsWith(r)){const i=`${o.name.slice(0,-1)}${v.name}`;s.push(i,`${i}s`)}}o.symbol==="µ"&&s.push(`u${b}`),o.factor===1&&v.aliases&&s.push(...v.aliases),g.push(A(t,o.factor,s))}for(const o of v.extra||[])g.push(o);return g}function $(v,b){const l=H(b);return Y(v,l)}function X(v,b,l){return $(v,b),I({system:v,unit:b.base,display:"auto",maxDecimals:3,...l||{}})}const F=Object.freeze({voltage:X("voltage",{base:"V",name:"volt"}),current:X("current",{base:"A",name:"amp",aliases:["ampere","amperes"]}),resistance:X("resistance",{base:"Ω",name:"ohm",aliases:["ohm","ohms","R"],prefixes:["m","","k","M","G"]}),capacitance:X("capacitance",{base:"F",name:"farad",prefixes:["f","p","n","µ","m",""]}),inductance:X("inductance",{base:"H",name:"henry",prefixes:["p","n","µ","m",""]}),charge:X("charge",{base:"C",name:"coulomb",prefixes:["p","n","µ","m",""],extra:[A("mAh",3.6,["milliamphour","milliamphours"],{auto:!1}),A("Ah",3600,["amphour","amphours"],{auto:!1})]}),conductance:X("conductance",{base:"S",name:"siemens",prefixes:["n","µ","m","","k"]}),fluxDensity:X("fluxDensity",{base:"T",name:"tesla",prefixes:["n","µ","m",""],extra:[A("G",1e-4,["gauss"],{auto:!1})]}),luminousFlux:X("luminousFlux",{base:"lm",name:"lumen",prefixes:["m","","k"]}),illuminance:X("illuminance",{base:"lx",name:"lux",prefixes:["m","","k"]}),luminousIntensity:X("luminousIntensity",{base:"cd",name:"candela",prefixes:["m","","k"]}),substance:X("substance",{base:"mol",name:"mole",prefixes:["n","µ","m","","k"]}),absorbedDose:X("absorbedDose",{base:"Gy",name:"gray",prefixes:["µ","m",""]}),equivalentDose:X("equivalentDose",{base:"Sv",name:"sievert",prefixes:["n","µ","m",""]}),radioactivity:X("radioactivity",{base:"Bq",name:"becquerel",prefixes:["","k","M","G","T"],extra:[A("Ci",37e9,["curie","curies"],{auto:!1})]}),frequency:X("frequency",{base:"Hz",name:"hertz",prefixes:["m","","k","M","G","T"]})}),j=X}),Ve("packages/core/src/columns/types/temperature.js",function(e,D){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});const A=D("packages/core/src/internal/predicates.js").isNil,Y=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(A(g))return null;const o=String(g).trim();if(o==="")return null;for(const[s,r]of Object.entries(Y))if(o===s||o===r.symbol)return{key:s,scale:r};const t=o.toLowerCase();for(const[s,r]of Object.entries(Y))if(r.aliases.includes(t))return{key:s,scale:r};return null}function L(g,o,t){const s=I(o),r=I(t);return!s||!r||!Number.isFinite(Number(g))?null:s.key===r.key?Number(g):r.scale.fromKelvin(s.scale.toKelvin(Number(g)))}const Q=new Map;function H(g,o,t){const s=`${g||""}|${o}|${t}`;let r=Q.get(s);return r||(r=new Intl.NumberFormat(g||void 0,{minimumFractionDigits:o,maximumFractionDigits:t}),Q.set(s,r)),r}function $(g,o){const t=o||{},s=t.nullDisplay??"";if(A(g)||g==="")return s;const r=Number(g);if(!Number.isFinite(r))return s;const i=I(t.scale||"C");if(!i)return String(r);const n=I(t.display||t.scale||"C")||i,m=n.key===i.key?r:n.scale.fromKelvin(i.scale.toKelvin(r)),c=typeof t.decimals=="number"?t.decimals:null,a=c??t.minDecimals??0,u=c??t.maxDecimals??1;return`${H(t.locale,a,u).format(m)}${t.space??" "}${n.scale.symbol}`}const X=/^[+-]?[\d\s., ]*\d/;function F(g,o){const t=String(g).trim();if(t==="")return null;const s=new Intl.NumberFormat(o||void 0).formatToParts(1.1).find(m=>m.type==="decimal")?.value||".",r=s===","?".":",",i=t.split(r).join("").split(/[\s ]/).join("").replace(s,"."),n=Number(i);return Number.isFinite(n)?n:null}function j(g,o){if(A(g))return null;const t=o||{},s=I(t.scale||"C");if(!s)return null;if(typeof g=="number")return Number.isFinite(g)?g:null;let r=String(g).trim();if(r==="")return null;let i=!1;r.startsWith("(")&&r.endsWith(")")&&(i=!0,r=r.slice(1,-1).trim());const n=X.exec(r);if(!n)return null;const m=F(n[0],t.locale);if(m===null)return null;const c=r.slice(n[0].length).trim();if(c==="")return i?-m:m;const a=I(c);if(!a)return null;const u=a.key===s.key?m:s.scale.fromKelvin(a.scale.toKelvin(m));return i?-u:u}function v(g){const o=Object.freeze({scale:"C",...g||{}}),s=(I(o.scale)||I("C")).scale.symbol,r=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 a=i.get(c);return a||(a=Object.freeze({...o,locale:m||void 0}),i.set(c,a)),a};return{base:"number",extends:"number",storage:"float64",temperatureConfig:o,format:m=>$(m.value,m.locale?n(m.locale):o),parse:m=>j(m.text,m.locale?n(m.locale):o),defaults:{filter:"number",editor:"temperature",align:"end",total:"avg"},totals:{supported:["avg","min","max","count","countValues"]},excel:o.excel||`#,##0${typeof o.decimals=="number"&&o.decimals>0?`.${"0".repeat(o.decimals)}`:".#"}" ${s}"`,toStorage:m=>typeof m=="number"?Number.isFinite(m)?m:null:typeof m=="string"?j(m,o):A(m)?null:j(String(m),o),toClipboard:m=>$(m,r),fromClipboard:m=>j(m,o)}}const b=Object.freeze({celsius:v({scale:"C"}),fahrenheit:v({scale:"F"}),kelvin:v({scale:"K"})}),l=v}),Ve("packages/core/src/columns/types/radix.js",function(e,D){"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 a}}),Object.defineProperty(e,"normaliseRadixOptions",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"compileRadixFormat",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"compileRadixParse",{enumerable:!0,get:function(){return k}}),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 B}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return E}});const A=D("packages/core/src/internal/predicates.js").isNil,I=D("packages/core/src/internal/warn.js").warnOnce,L=Object.freeze({2:2,8:8,16:16,bin:2,binary:2,base2:2,oct:8,octal:8,base8:8,hex:16,hexadecimal:16,base16:16}),Q=Object.freeze({2:1,8:3,16:4}),H=Object.freeze({2:"0b",8:"0o",16:"0x"}),$=Object.freeze({2:4,8:3,16:2}),X=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),F=Object.freeze({2:"binary",8:"octal",16:"hexadecimal"}),j=Object.freeze([[/^0x/i,16],[/^0b/i,2],[/^0o/i,8],[/^#/,16]]),v=/[\s\u00a0\u202f_,']/g,b=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,l=Object.freeze([8,16,32,53]),g=new WeakSet,o=new WeakMap,t=new Map,s=new WeakMap,r=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(S){if(S==null)return 16;const C=typeof S=="string"?S.toLowerCase():S,N=L[C];return N||(I(`radix:base:${String(S)}`,`unsupported radix ${String(S)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function m(S,C){return Math.ceil(S/Q[C])}function c(S,C){if(!S)return C?{min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}:{min:0,max:Number.MAX_SAFE_INTEGER};if(!C)return{min:0,max:2**S-1};const N=2**(S-1);return{min:-N,max:N-1}}function a(S){return F[S]||"hexadecimal"}function u(S){if(typeof S=="string"){const C=i[S];return C||I(`radix:preset:${S}`,`unknown radix preset "${S}"; known presets are ${Object.keys(i).join(", ")}`),{...C||{}}}if(S&&typeof S.preset=="string"){const C=i[S.preset];return C||I(`radix:preset:${S.preset}`,`unknown radix preset "${S.preset}"; known presets are ${Object.keys(i).join(", ")}`),{...C||{},...S}}return S||{}}function h(S){const C=u(S),N=n(C.radix),O=Q[N];let T=null;if(C.bitWidth!==void 0&&C.bitWidth!==null&&C.bitWidth!==!1){const Z=Number(C.bitWidth);l.includes(Z)?T=Z:I(`radix:width:${String(C.bitWidth)}`,`unsupported bitWidth ${String(C.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let R=C.signed!==!1;!R&&T===null&&(I("radix:unsigned:width","signed: false needs a bitWidth to render a two's-complement pattern; defaulting to 32"),T=32);const x=C.prefix===void 0||C.prefix===!0?H[N]:C.prefix===!1?"":String(C.prefix);let U=0;C.pad===!0?U=T?m(T,N):0:typeof C.pad=="number"&&C.pad>0&&(U=Math.floor(C.pad));let V=0;C.group===!0?V=$[N]:typeof C.group=="number"&&C.group>0&&(V=Math.floor(C.group));const J=c(T,R),_=typeof C.min=="number"?Math.max(J.min,C.min):J.min,ee=typeof C.max=="number"?Math.min(J.max,C.max):J.max,W=Object.freeze({radix:N,bits:O,prefix:x,uppercase:C.uppercase!==!1,pad:U,group:V,groupSeparator:typeof C.groupSeparator=="string"?C.groupSeparator:" ",bitWidth:T,signed:R,min:_,max:ee<_?_:ee,nullDisplay:typeof C.nullDisplay=="string"?C.nullDisplay:"",name:a(N)});return g.add(W),W}function p(S){if(S&&g.has(S))return S;if(typeof S=="string"){let C=t.get(S);return C||(C=h(S),t.set(S,C)),C}if(S&&typeof S=="object"){let C=o.get(S);return C||(C=h(S),o.set(S,C)),C}return p("hex")}function y(S){return S<0?-Math.round(-S):Math.round(S)}function d(S,C,N){if(C<=0||S.length<=C)return S;const O=S.length%C||C,T=[S.slice(0,O)];for(let R=O;R<S.length;R+=C)T.push(S.slice(R,R+C));return T.join(N)}function f(S){const C=p(S),{radix:N,prefix:O,uppercase:T,pad:R,group:x,groupSeparator:U,signed:V,bitWidth:J,nullDisplay:_}=C,ee=J?2**J:0,W=Z=>{if(A(Z)||Z==="")return _;const ne=typeof Z=="number"?Z:Number(Z);if(!Number.isFinite(ne))return _;const ie=y(ne);let ce="",me=ie;ie<0&&(V?(ce="-",me=-ie):me=(ie%ee+ee)%ee);let Ce=me.toString(N);return Ce=T?Ce.toUpperCase():Ce.toLowerCase(),R>0&&Ce.length<R&&(Ce=Ce.padStart(R,"0")),x>0&&(Ce=d(Ce,x,U)),ce+O+Ce};return W.options=C,W}function w(S,C){const N=p(C);let O=s.get(N);return O||(O=f(N),s.set(N,O)),O(S)}function k(S){const C=p(S),{radix:N,groupSeparator:O,signed:T,min:R,max:x}=C,U=X[N],V=J=>{if(A(J))return{ok:!0,value:null,reason:"blank"};let _=String(J);if(O&&O!==""&&(_=_.split(O).join("")),_=_.replace(v,""),_==="")return{ok:!0,value:null,reason:"blank"};let ee=!1;if((_[0]==="-"||_[0]==="+")&&(ee=_[0]==="-",_=_.slice(1)),_==="")return{ok:!1,value:null,reason:"digits"};let W=null;for(const[ne,ie]of j){const ce=ne.exec(_);if(!ce)continue;const me=_.slice(ce[0].length);if(me==="")break;if(!X[ie].test(me))return{ok:!1,value:null,reason:"digits"};W=parseInt(me,ie);break}if(W===null)if(U.test(_))W=parseInt(_,N);else if(b.test(_))W=Number(_);else return{ok:!1,value:null,reason:"digits"};if(!Number.isFinite(W))return{ok:!1,value:null,reason:"digits"};const Z=y(ee?-W:W);return!T&&Z<0?{ok:!1,value:Z,reason:"negative"}:Z<R||Z>x?{ok:!1,value:Z,reason:"range"}:{ok:!0,value:Z,reason:"ok"}};return V.options=C,V}function P(S,C){const N=p(C);let O=r.get(N);return O||(O=k(N),r.set(N,O)),O(S)}function G(S,C){const N=P(S,C);return N.ok?N.value:null}function K(S,C){const N=A(S)||Number.isNaN(S)?null:Number(S),O=A(C)||Number.isNaN(C)?null:Number(C);return N===null?O===null?0:1:O===null||N<O?-1:N>O?1:0}function q(S){const C=S.min>=-2147483648&&S.max<=2147483647;return S.bitWidth&&C?"int32":"float64"}function B(S){const C=h(S),N=f(C),O=k(C);return{base:"number",extends:"number",storage:q(C),matches:null,format:T=>N(T.value),parse:T=>{const R=O(T.text);return R.ok?R.value:null},compare:K,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:T=>N(T),fromClipboard:T=>{const R=O(T);return R.ok?R.value:null},radix:C,formatValue:N,parseText:O}}const E=B}),Ve("packages/core/src/columns/types/aggregable.js",function(e,D){"use strict";Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"weightedMean",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"logarithmicSum",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"logarithmicMean",{enumerable:!0,get:function(){return L}});const A=D("packages/core/src/internal/predicates.js").isNil;function Y(F){const j=[];for(const v of F||[]){if(A(v))continue;const b=Number(v);Number.isFinite(b)&&j.push(b)}return j}function I(F){return j=>{const v=Y(j);if(!v.length)return null;let b=0;for(const l of v)b+=10**(l/F);return F*Math.log10(b)}}function L(F){return j=>{const v=Y(j);if(!v.length)return null;let b=0;for(const l of v)b+=10**(l/F);return F*Math.log10(b/v.length)}}function Q(F,j){const v=j&&j.column,l=(v&&v.typeOptions||{}).weight,g=j&&j.valueAt;if(!l||typeof g!="function")return null;let o=0,t=0;for(let s=0;s<F.length;s++){if(A(F[s]))continue;const r=Number(F[s]);if(!Number.isFinite(r))continue;const i=g(l,s);if(A(i))continue;const n=Number(i);!Number.isFinite(n)||n<=0||(o+=r*n,t+=n)}return t===0?null:o/t}function H(F={}){const j=F.factor===20?20:10,v=typeof F.suffix=="string"?F.suffix:"",b=Number.isInteger(F.decimals)?F.decimals:1;return{base:"number",storage:"float64",name:F.name||"logarithmic",format:l=>{const g=l&&l.value;return A(g)||!Number.isFinite(Number(g))?"":`${Number(g).toFixed(b)}${v}`},parse:l=>{const g=String((l&&l.text)??"").replace(v,"").trim();if(!g)return null;const o=Number(g);return Number.isFinite(o)?o:null},defaults:{align:"end",filter:"number"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:{sum:I(j),avg:L(j)}}}}function $(F={}){const j=Number.isInteger(F.decimals)?F.decimals:1,v=F.percent===!0;return{base:"number",storage:"float64",name:F.name||"ratio",format:b=>{const l=b&&b.value;return A(l)||!Number.isFinite(Number(l))?"":v?`${Number(l).toFixed(j)}%`:Number(l).toFixed(j)},parse:b=>{const l=String((b&&b.text)??"").replace("%","").trim();if(!l)return null;const g=Number(l);return Number.isFinite(g)?g:null},defaults:{align:"end",filter:"number"},totals:{supported:["avg","min","max","count","countValues"],implement:{avg:Q}}}}const X=Object.freeze({decibel:H({name:"decibel",factor:10,suffix:" dB"}),decibelAmplitude:H({name:"decibelAmplitude",factor:20,suffix:" dB"}),ratio:$({name:"ratio"}),percentRate:$({name:"percentRate",percent:!0})})}),Ve("packages/core/src/columns/types/currency.js",function(e,D){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return v}}),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 r}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});const A=D("packages/core/src/internal/predicates.js").isNil,Y="⚠ no rate";function I(m){if(A(m))return null;const c=String(m).trim().toUpperCase();return c===""?null:c}function L(m){if(A(m))return null;if(typeof m=="object"&&!Array.isArray(m)){const c=Number(m.amount),a=I(m.code);return!a||!Number.isFinite(c)?null:{amount:c,code:a}}if(Array.isArray(m)&&m.length===2){const c=Number(m[0]),a=I(m[1]);return!a||!Number.isFinite(c)?null:{amount:c,code:a}}return null}const Q=Object.freeze({$:"USD","€":"EUR","£":"GBP","¥":"JPY","₹":"INR","₩":"KRW","₽":"RUB","₺":"TRY","₴":"UAH","₪":"ILS"}),H=Object.freeze({USD:"$",EUR:"€",GBP:"£",JPY:"¥",INR:"₹",KRW:"₩",RUB:"₽",TRY:"₺",UAH:"₴",ILS:"₪"}),$=/[+-]?[\d\s., ]*\d/;function X(m,c){const a=String(m).trim();if(a==="")return null;const u=new Intl.NumberFormat(c||void 0).formatToParts(1.1).find(d=>d.type==="decimal")?.value||".",h=u===","?".":",",p=a.split(h).join("").split(/[\s ]/).join("").replace(u,"."),y=Number(p);return Number.isFinite(y)?y:null}function F(m,c){const a=c||{},u=I(a.code);if(A(m))return null;const h=L(m);if(h)return h;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 d=null;for(const[K,q]of Object.entries(Q)){if(p.startsWith(K)){d=q,p=p.slice(K.length).trim();break}if(p.endsWith(K)){d=q,p=p.slice(0,-K.length).trim();break}}const f=$.exec(p);if(!f)return null;const w=X(f[0],a.locale);if(w===null)return null;const k=(p.slice(0,f.index)+" "+p.slice(f.index+f[0].length)).trim();!d&&k!==""&&(d=I(k));const P=d||u;return P?{amount:y?-w:w,code:P}:null}function j(m,c){if(typeof m=="function")return(a,u)=>{if(a===u)return 1;const h=m(a,u);return typeof h=="number"&&Number.isFinite(h)&&h>0?h:null};if(m&&typeof m=="object"){const a=m;return(u,h)=>{if(u===h)return 1;const p=Number(a[u]),y=Number(a[h]);return!Number.isFinite(p)||!Number.isFinite(y)||p<=0||y<=0?null:y/p}}return(a,u)=>a===u?1:null}function v(m,c,a){if(!m)return null;if(m.code===c)return m.amount;const u=a(m.code,c);return u===null?null:m.amount*u}const b=new Map;function l(m,c,a){const u=`${m||""}|${c}|${a??""}`;let h=b.get(u);if(!h){const p={style:"currency",currency:c};typeof a=="number"&&(p.minimumFractionDigits=a,p.maximumFractionDigits=a);try{h={fmt:new Intl.NumberFormat(m||void 0,p),currency:!0}}catch{h={fmt:new Intl.NumberFormat(m||void 0,typeof a=="number"?{minimumFractionDigits:a,maximumFractionDigits:a}:{}),currency:!1}}b.set(u,h)}return h}function g(m,c){const a=c||{},u=a.nullDisplay??"",h=L(m);if(!h)return u;const p=I(a.display)||h.code;let y=h.amount,d=h.code;if(p!==h.code){const k=a.rateFn||j(a.rates,a.rateBase),P=v(h,p,k);if(P===null)return`${a.missingRate??Y} ${h.code}→${p}`;y=P,d=p}const{fmt:f,currency:w}=l(a.locale,d,a.decimals);return w?f.format(y):`${f.format(y)} ${d}`}function o(m){const c=L(m);return c?`${c.amount} ${c.code}`:""}function t(m){const c=m||{},a=I(c.display),u=c.rateFn||j(c.rates,c.rateBase);return(h,p)=>{const y=L(h),d=L(p);if(!y&&!d)return 0;if(!y)return 1;if(!d)return-1;if(a){const f=v(y,a,u),w=v(d,a,u);if(f!==null&&w!==null)return f===w?0:f<w?-1:1}return y.code===d.code?y.amount===d.amount?0:y.amount<d.amount?-1:1:y.code<d.code?-1:1}}function s(m){const c=m||{},a=(h,p)=>{const y=[];for(const P of h||[]){const G=L(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 f=I(c.display);if(!f)return`${c.missingRate??Y}: mixed currencies, no display currency set`;const w=c.rateFn||j(c.rates,c.rateBase),k=[];for(const P of y){const G=v(P,f,w);if(G===null)return`${c.missingRate??Y}: ${P.code}→${f}`;k.push(G)}return{amount:p(k),code:f}},u=h=>h.reduce((p,y)=>p+y,0);return{sum:h=>a(h,u),avg:h=>a(h,p=>u(p)/p.length),min:h=>a(h,p=>Math.min(...p)),max:h=>a(h,p=>Math.max(...p))}}function r(m){const c=Object.freeze({code:"USD",...m||{}}),a=j(c.rates,c.rateBase),u=Object.freeze({...c,rateFn:a}),h=s(u),p=t(u),y=new Map([[c.locale||"",u]]),d=k=>{const P=k||"";let G=y.get(P);return G||(G=Object.freeze({...u,locale:k||void 0}),y.set(P,G)),G},f=H[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:k=>g(k.value,k.locale?d(k.locale):u),parse:k=>F(k.text,k.locale?d(k.locale):u),compare:p,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:h},excel:c.excel||(f?`"${f}"#,##0${w}`:`#,##0${w}`),toStorage:k=>{const P=L(k);return P||(typeof k=="string"||typeof k=="number"?F(k,u):null)},toClipboard:k=>o(k),fromClipboard:k=>F(k,u)}}const i=Object.freeze({currency:r({code:"USD"}),usd:r({code:"USD"}),eur:r({code:"EUR"}),gbp:r({code:"GBP"}),jpy:r({code:"JPY",decimals:0})}),n=r}),Ve("packages/core/src/columns/types/index.js",function(e,D){"use strict";Object.defineProperty(e,"EXTENDED_TYPES",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return l}}),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 a}}),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 K}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return B}});const re=D("packages/core/src/columns/types/temporal.js"),A=re.TEMPORAL_TYPES,Y=D("packages/core/src/columns/types/network.js"),I=Y.NETWORK_TYPES,L=D("packages/core/src/columns/types/vlan.js"),Q=L.VLAN_TYPES,H=D("packages/core/src/columns/types/structured.js"),$=H.STRUCTURED_TYPES,X=D("packages/core/src/columns/types/unit.js"),F=X.createUnitType,j=X.UNIT_SYSTEMS,v=X.parseUnit,b=X.formatUnit,l=X.registerUnitSystem,g=X.unitSystemNames,o=X.unitsOf,t=X.defineUnit,s=D("packages/core/src/columns/types/engineering.js"),r=s.ENGINEERING_TYPES,i=D("packages/core/src/columns/types/si.js"),n=i.SI_TYPES,m=i.createSiType,c=i.createSiSystem,a=i.siUnits,u=i.SI_PREFIXES,h=D("packages/core/src/columns/types/temperature.js"),p=h.TEMPERATURE_TYPES,y=h.createTemperatureType,d=h.convertTemperature,f=h.formatTemperature,w=h.parseTemperature,k=h.TEMPERATURE_SCALES,P=D("packages/core/src/columns/types/radix.js"),G=P.createRadixType,K=P.RADIX_PRESETS,q=P.parseRadix,B=P.formatRadix,E=D("packages/core/src/columns/types/aggregable.js"),S=E.AGGREGABLE_TYPES,C=D("packages/core/src/columns/types/currency.js"),N=C.CURRENCY_TYPES,O=C.createCurrencyType,T=C.parseMoney,R=C.formatMoney,x=C.convertMoney,U=C.toMoney,V=C.rateFunction,J=C.moneyComparator,_=C.normaliseCode,ee=C.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return X.findUnit}}),Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return s.ENGINEERING_TYPES}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return s.circularMean}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return h.TEMPERATURE_TYPES}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return h.createTemperatureType}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return h.convertTemperature}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return h.formatTemperature}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return h.parseTemperature}}),Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return h.TEMPERATURE_SCALES}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return h.findScale}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return C.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return C.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return C.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return C.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return C.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return C.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return C.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return C.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return C.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return C.MISSING_RATE}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return re.TEMPORAL_TYPES}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return Y.NETWORK_TYPES}}),Object.defineProperty(e,"VLAN_TYPES",{enumerable:!0,get:function(){return L.VLAN_TYPES}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return H.STRUCTURED_TYPES}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return E.AGGREGABLE_TYPES}}),Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return E.createLogarithmicType}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return E.createRatioType}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return re.parseTime}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return re.formatTime}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return re.parseDateTime}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return re.formatDateTime}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return re.parseDuration}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return re.formatDuration}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return Y.parseIpv4}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return Y.formatIpv4}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return Y.parseCidr}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return Y.formatCidr}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return Y.parseIpv6}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return Y.formatIpv6}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return Y.networkAddress}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return Y.broadcastAddress}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return Y.hostCount}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return Y.containsAddress}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return Y.overlaps}}),Object.defineProperty(e,"parseMac",{enumerable:!0,get:function(){return Y.parseMac}}),Object.defineProperty(e,"formatMac",{enumerable:!0,get:function(){return Y.formatMac}}),Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return Y.isMac}}),Object.defineProperty(e,"compareMac",{enumerable:!0,get:function(){return Y.compareMac}}),Object.defineProperty(e,"macValue",{enumerable:!0,get:function(){return Y.macValue}}),Object.defineProperty(e,"macHex",{enumerable:!0,get:function(){return Y.macHex}}),Object.defineProperty(e,"macContains",{enumerable:!0,get:function(){return Y.macContains}}),Object.defineProperty(e,"MAC_OPERATORS",{enumerable:!0,get:function(){return Y.MAC_OPERATORS}}),Object.defineProperty(e,"parseVlans",{enumerable:!0,get:function(){return L.parseVlans}}),Object.defineProperty(e,"formatVlans",{enumerable:!0,get:function(){return L.formatVlans}}),Object.defineProperty(e,"vlanContains",{enumerable:!0,get:function(){return L.vlanContains}}),Object.defineProperty(e,"vlanOverlaps",{enumerable:!0,get:function(){return L.vlanOverlaps}}),Object.defineProperty(e,"vlanCount",{enumerable:!0,get:function(){return L.vlanCount}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return H.maskValue}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return H.summariseJson}});const W=Object.freeze({...A,...I,...Q,...$,...S,hex:G(K.hex),hex8:G(K.hex8),hex16:G(K.hex16),hex32:G(K.hex32),binary:G(K.binary),binary8:G(K.binary8),octal:G(K.octal),bytes:F({system:"data",unit:"B",display:"auto"}),megabytes:F({system:"data",unit:"MB"}),gigabytes:F({system:"data",unit:"GB"}),bitrate:F({system:"bitrate",unit:"Mbps"}),gigabits:F({system:"bitrate",unit:"Gbps"}),...r,...n,...p,...N});{const Z=new Set;for(const ne of[A,I,Q,$,S,r,n,p,N])for(const ie of Object.keys(ne)){if(Z.has(ie))throw new Error(`[lattice] data type "${ie}" is declared twice`);Z.add(ie)}}}),Ve("packages/core/src/compute/handle.js",function(e,D){"use strict";Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return r}});const re=D("packages/core/src/internal/compare.js"),A=re.collator,Y=re.defaultCompare,L=D("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 H(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:(L(`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 $=new WeakMap;function X(i){const n=i.constructor;if(!n)return"unknown";const m=$.get(n);if(m)return m;let c="unknown";try{let a=null;typeof n.from=="function"?a=n.from([!1,!0]):(a=new n(8),a.set(1));const u=a&&a.words;u&&u.length&&(u[0]===2?c="lsb":u[0]===64&&(c="msb"))}catch{c="unknown"}return $.set(n,c),c}function F(i){if(!i)return()=>0;const n=i instanceof Uint8Array?i:i.words;if(n instanceof Uint8Array){const m=i instanceof Uint8Array?"lsb":X(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 j(i){return!i||!i.presence?null:F(i.presence)}function v(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 l(i,n){const m=i.offsets,c=i.values;if(!m||!c)return[];const a=m[n],u=m[n+1];if(!(u>a))return[];const h=i.dict,p=new Array(u-a);for(let y=a;y<u;y++)p[y-a]=h?b(h,c[y]):c[y];return p}function g(i){if(!i)return()=>{};const n=i.values,m=j(i),c=i.kind;if(c==="dictionary"){const a=i.dict;return m?u=>m(u)?b(a,n[u]):null:u=>b(a,n[u])}if(c==="bitset"){const a=F(n);return m?u=>m(u)?a(u)===1:null:u=>a(u)===1}if(c==="multi")return m?a=>m(a)?l(i,a):null:a=>l(i,a);if(!n&&typeof i.get=="function"){const a=i.get.bind(i);return u=>{const h=a(u);return h===void 0?null:h}}return m?a=>{if(!m(a))return null;const u=n[a];return u===void 0?null:u}:a=>{const u=n[a];return u===void 0?null:u}}function o(i,n){if(i<n)return-1;if(i>n)return 1;if(i===n){const a=Object.is(i,-0),u=Object.is(n,-0);return a===u?0:a?-1:1}const m=Number.isNaN(i),c=Number.isNaN(n);return m&&c?0:m?1:-1}function t(i){const n=A(i);return(m,c)=>{if(m===c)return 0;const a=typeof m,u=typeof c;if(a==="string"&&u==="string")return n.compare(m,c);if(a==="number"&&u==="number")return o(m,c);if(a==="boolean"&&u==="boolean")return m===c?0:m?1:-1;if(m instanceof Date||c instanceof Date){const h=m instanceof Date?m.getTime():Number(m),p=c instanceof Date?c.getTime():Number(c);return o(h,p)}return Y(m,c)}}function s(i,n){if(i&&typeof i.ranks=="function")return i.ranks(n);const m=i&&typeof i.values=="function"?i.values():[],c=m.length,a=t(n),u=new Array(c);for(let p=0;p<c;p++)u[p]=p;u.sort((p,y)=>a(m[p],m[y])||p-y);const h=new Uint32Array(c);for(let p=0;p<c;p++)h[u[p]]=p;return h}function r(i){return i==null||typeof i=="number"&&Number.isNaN(i)}}),Ve("packages/core/src/compute/filter.js",function(e,D){"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 q}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(e,"declaredOperatorFor",{enumerable:!0,get:function(){return ve}});const A=D("packages/core/src/internal/predicates.js").isBlank,I=D("packages/core/src/internal/merge.js").toArray,Q=D("packages/core/src/internal/warn.js").warnOnce,H=D("packages/core/src/format/date.js"),$=H.toDate,X=H.toIsoDate,F=D("packages/core/src/compute/handle.js"),j=F.bitReader,v=F.dictSize,b=F.dictValue,l=F.presenceReader,g=F.valueComparator,o=F.valueReader,t=/^\d{4}-\d{2}-\d{2}$/,s="\0null\0";function r(oe,he){const ae=oe&&oe.pool;if(ae){const se=ae.mask||ae.acquireMask||ae.acquire||ae.take;if(typeof se=="function"){const de=se.call(ae,he);if(de&&de.length>=he)return de}}return new Uint8Array(he)}function i(oe,he){const ae=oe&&oe.pool;if(!ae||!he)return;const se=ae.release||ae.releaseMask||ae.free||ae.recycle;typeof se=="function"&&se.call(ae,he)}function n(oe,he,ae){return oe.fill(ae,0,he),oe}function m(oe){return oe==null||typeof oe=="number"&&Number.isNaN(oe)}function c(oe,he){if(oe==null)return oe;if(he==="number")return typeof oe=="number"?oe:Number(oe);if(he==="date"||he==="dateString"){const ae=X(oe);return ae===null?a(oe):ae}return he==="boolean"?typeof oe=="boolean"?oe:oe==="true"||oe===1?!0:oe==="false"||oe===0?!1:!!oe:oe}function a(oe){return oe instanceof Date?oe.getTime():typeof oe=="number"?oe:Date.parse(String(oe))}function u(oe){return typeof oe=="number"?oe:oe instanceof Date?oe.getTime():oe==null||oe===""?NaN:Number(oe)}function h(oe,he){const ae=typeof oe=="string"?oe:String(oe);return he?ae:ae.toLowerCase()}function p(oe,he){return oe==null?s:typeof oe=="string"?he?oe:oe.toLowerCase():oe instanceof Date?oe.getTime():oe}function y(oe,he,ae){const se=new Set;for(const de of I(oe)){const ke=c(de,ae);se.add(p(ke,he)),typeof ke=="string"&&ke!==""&&Number.isFinite(Number(ke))?se.add(Number(ke)):typeof ke=="number"&&Number.isFinite(ke)&&se.add(p(String(ke),he))}return se}function d(oe,he,ae){if(oe==null||he===null||he===void 0)return oe==null&&he==null;const se=typeof oe,de=typeof he;return se==="string"&&de==="string"?ae?oe===he:oe.toLowerCase()===he.toLowerCase():oe instanceof Date||he instanceof Date?a(oe)===a(he):se==="number"&&de==="number"?oe===he||Number.isNaN(oe)&&Number.isNaN(he):se==="number"&&de==="string"?oe===Number(he):se==="string"&&de==="number"?Number(oe)===he:se==="boolean"||de==="boolean"?oe===he:Array.isArray(oe)&&Array.isArray(he)?oe.length===he.length&&oe.every((ke,Ae)=>d(ke,he[Ae],ae)):oe===he}function f(oe,he){try{if(oe instanceof RegExp){const ae=oe.flags.replace(/[gy]/g,"");return new RegExp(oe.source,he||ae.includes("i")?ae:`${ae}i`)}return new RegExp(String(oe),he?"":"i")}catch(ae){return Q(`regex:${String(oe)}`,`filter operator "matches" received an invalid pattern: ${String(oe)}`,ae),null}}function w(oe,he){if(oe&&oe.type==="datetime"&&k.has(oe.op))return B(oe,he);const ae=E(oe,he),se=oe&&oe.type;return se!=="date"&&se!=="dateString"?ae:de=>ae(typeof de=="string"&&t.test(de)?de:X(de)??de)}const k=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 K(oe,he){let ae=G.get(he);if(ae===void 0){try{ae=new Intl.DateTimeFormat("en-CA",{timeZone:he,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{ae=null}G.set(he,ae)}if(!ae)return null;const se={};for(const de of ae.formatToParts(oe))de.type!=="literal"&&(se[de.type]=de.value);return se}function q(oe,he){if(oe==null||oe==="")return null;if(typeof oe=="string"){const ke=P.exec(oe.trim());if(ke)return Date.UTC(+ke[1],+ke[2]-1,+ke[3],+(ke[4]||0),+(ke[5]||0),+(ke[6]||0),+(ke[7]||"0").padEnd(3,"0"))}const ae=$(oe);if(!ae)return null;const se=ae.getUTCMilliseconds(),de=he?K(ae,he):null;return de?Date.UTC(+de.year,+de.month-1,+de.day,de.hour==="24"?0:+de.hour,+de.minute,+de.second,se):Date.UTC(ae.getFullYear(),ae.getMonth(),ae.getDate(),ae.getHours(),ae.getMinutes(),ae.getSeconds(),se)}function B(oe,he){const ae=typeof oe.timeZone=="string"&&oe.timeZone?oe.timeZone:void 0,se=Ae=>q(Ae,ae),de=Array.isArray(oe.value)?oe.value.map(se):se(oe.value),ke=E({...oe,type:"number",value:de},he);return Ae=>ke(q(Ae))}function E(oe,he){const ae=oe&&oe.op,se=!!(oe&&oe.caseSensitive),de=oe&&oe.type,ke=g(he),Ae=Te=>je=>!Te(je);switch(ae){case"eq":{const Te=ve(de,"eq");if(Te)return Te.compile(oe.value);const je=c(oe.value,de);return ye=>d(ye,je,se)}case"ne":{const Te=ve(de,"ne");if(Te)return Te.compile(oe.value);const je=c(oe.value,de);return ye=>!d(ye,je,se)}case"lt":case"lte":case"gt":case"gte":{const Te=c(oe.value,de);if(m(Te))return()=>!1;const je=ae==="lt"?-1:ae==="lte"?0:ae==="gt"?1:2;return ye=>{if(m(ye))return!1;const He=ke(ye,Te);return je===-1?He<0:je===0?He<=0:je===1?He>0:He>=0}}case"between":case"notBetween":{const Te=I(oe.value),je=c(Te[0],de),ye=c(Te[1],de),He=oe.bounds||"[]",Me=He.charAt(0)!=="(",Re=He.charAt(1)!==")";if(m(je)||m(ye))return ae==="between"?()=>!1:()=>!0;const Ee=$e=>{if(m($e))return!1;const Ie=ke($e,je),We=ke($e,ye);return(Me?Ie>=0:Ie>0)&&(Re?We<=0:We<0)};return ae==="between"?Ee:Ae(Ee)}case"in":case"notIn":{const Te=y(oe.value,se,de),je=ye=>Te.has(p(ye,se));return ae==="in"?je:Ae(je)}case"contains":case"notContains":{const Te=ve(de,ae);if(Te)return Te.compile(oe.value);const je=h(c(oe.value,de),se),ye=He=>He==null?!1:h(He,se).includes(je);return ae==="contains"?ye:Ae(ye)}case"startsWith":{const Te=ve(de,"startsWith");if(Te)return Te.compile(oe.value);const je=h(c(oe.value,de),se);return ye=>ye==null?!1:h(ye,se).startsWith(je)}case"endsWith":{const Te=ve(de,"endsWith");if(Te)return Te.compile(oe.value);const je=h(c(oe.value,de),se);return ye=>ye==null?!1:h(ye,se).endsWith(je)}case"matches":{const Te=f(oe.value,se);return Te?je=>je==null?!1:Te.test(String(je)):()=>!1}case"blank":case"notBlank":{const Te=oe.trim===!0,je=ye=>A(ye)||Array.isArray(ye)&&ye.length===0||Te&&typeof ye=="string"&&ye.trim()==="";return ae==="blank"?je:ye=>!je(ye)}case"containsAny":case"containsNone":{const Te=y(oe.value,se,de),je=ye=>{const He=ye==null?[]:I(ye);for(let Me=0;Me<He.length;Me++)if(Te.has(p(He[Me],se)))return!0;return!1};return ae==="containsAny"?je:Ae(je)}case"containsAll":{const Te=I(oe.value).map(je=>p(c(je,de),se));return je=>{const ye=je==null?[]:I(je);if(Te.length===0)return!0;const He=new Set(ye.map(Me=>p(Me,se)));for(let Me=0;Me<Te.length;Me++)if(!He.has(Te[Me]))return!1;return!0}}default:{const Te=_e(ae);return Te?Te.compile(oe.value):(Q(`op:${String(ae)}`,`unknown filter operator "${String(ae)}"; the condition is refused rather than matching every row`),()=>!1)}}}function S(oe,he,ae){return w(he,ae)(oe)}const C=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),N=new Set(["containsAny","containsAll","containsNone"]);function O(oe,he,ae){const se=oe&&oe.op,de=C[se]||se,ke=w({...oe,op:de,type:he.type},ae),Ae=he.items,Te=je=>{const ye=Ae(je);if(!ye)return!1;for(let He=0;He<ye.length;He++)if(ke(ye[He]))return!0;return!1};return C[se]?je=>!Te(je):Te}function T(oe,he,ae,se,de){const ke=de?null:l(oe);if(ke){const je=he?1:0;for(let ye=0;ye<se;ye++)ae[ye]=ke(ye)===je?1:0;return ae}const Ae=oe.kind;if(Ae==="float64"||Ae==="int32"||Ae==="bitset")return n(ae,se,he?1:0);const Te=o(oe);for(let je=0;je<se;je++){const ye=Te(je),He=A(ye)||Array.isArray(ye)&&ye.length===0||de&&typeof ye=="string"&&ye.trim()==="";ae[je]=He===he?0:1}return ae}function R(oe,he,ae,se){const de=oe.dict,ke=v(de),Ae=new Uint8Array(ke);for(let He=0;He<ke;He++)Ae[He]=he(b(de,He))?1:0;const Te=oe.values,je=l(oe);if(!je){for(let He=0;He<se;He++)ae[He]=Ae[Te[He]];return ae}const ye=he(null)?1:0;for(let He=0;He<se;He++)ae[He]=je(He)===1?Ae[Te[He]]:ye;return ae}function x(oe,he,ae,se){const de=j(oe.values),ke=he(!0)?1:0,Ae=he(!1)?1:0,Te=l(oe);if(!Te){for(let ye=0;ye<se;ye++)ae[ye]=de(ye)===1?ke:Ae;return ae}const je=he(null)?1:0;for(let ye=0;ye<se;ye++)ae[ye]=Te(ye)===0?je:de(ye)===1?ke:Ae;return ae}function U(oe,he,ae,se,de){const ke=oe.values,Ae=he.type,Te=he.op;let je=!0;switch(Te){case"eq":case"ne":{const He=u(c(he.value,Ae)),Me=typeof he.value=="number"&&Number.isNaN(he.value),Re=Te==="ne"?1:0;if(Me)for(let Ee=0;Ee<de;Ee++)se[Ee]=(Number.isNaN(ke[Ee])?1:0)^Re;else for(let Ee=0;Ee<de;Ee++)se[Ee]=(ke[Ee]===He?1:0)^Re;break}case"lt":{const He=u(c(he.value,Ae));for(let Me=0;Me<de;Me++)se[Me]=ke[Me]<He?1:0;break}case"lte":{const He=u(c(he.value,Ae));for(let Me=0;Me<de;Me++)se[Me]=ke[Me]<=He?1:0;break}case"gt":{const He=u(c(he.value,Ae));for(let Me=0;Me<de;Me++)se[Me]=ke[Me]>He?1:0;break}case"gte":{const He=u(c(he.value,Ae));for(let Me=0;Me<de;Me++)se[Me]=ke[Me]>=He?1:0;break}case"between":case"notBetween":{const He=I(he.value),Me=u(c(He[0],Ae)),Re=u(c(He[1],Ae)),Ee=he.bounds||"[]",$e=Ee.charAt(0)!=="(",Ie=Ee.charAt(1)!==")",We=Te==="notBetween"?1:0;if($e&&Ie)for(let Ye=0;Ye<de;Ye++)se[Ye]=(ke[Ye]>=Me&ke[Ye]<=Re?1:0)^We;else if($e)for(let Ye=0;Ye<de;Ye++)se[Ye]=(ke[Ye]>=Me&ke[Ye]<Re?1:0)^We;else if(Ie)for(let Ye=0;Ye<de;Ye++)se[Ye]=(ke[Ye]>Me&ke[Ye]<=Re?1:0)^We;else for(let Ye=0;Ye<de;Ye++)se[Ye]=(ke[Ye]>Me&ke[Ye]<Re?1:0)^We;break}case"in":case"notIn":{const He=new Set;for(const Re of I(he.value)){const Ee=u(c(Re,Ae));Number.isNaN(Ee)||He.add(Ee)}const Me=Te==="notIn"?1:0;for(let Re=0;Re<de;Re++)se[Re]=(He.has(ke[Re])?1:0)^Me;break}default:je=!1;break}if(!je)return!1;const ye=l(oe);if(ye){const He=ae(null)?1:0;for(let Me=0;Me<de;Me++)ye(Me)===0&&(se[Me]=He)}return!0}function V(oe,he,ae,se){const de=o(oe);for(let ke=0;ke<se;ke++)ae[ke]=he(de(ke))?1:0;return ae}function J(oe,he){if(!oe||!Ce.has(oe.op))return oe;const ae=he&&he.typeOf;if(typeof ae!="function")return oe;const se=ae(oe.col);return typeof se!="string"||!se||se===oe.type?oe:{...oe,type:se}}function _(oe,he,ae){const se=he.count|0,de=ae||r(he,se);if(!oe)return n(de,se,1);const ke=typeof he.handle=="function"?he.handle(oe.col):void 0,Ae=typeof he.custom=="function"?he.custom:null;if(!ke){if(Ae){for(let He=0;He<se;He++)de[He]=Ae(oe,He)?1:0;return de}return Q(`filter:col:${String(oe.col)}`,`filter references unknown column "${String(oe.col)}"; the condition is refused rather than matching every row`),n(de,se,0)}const Te=oe.op;if(Te==="blank"||Te==="notBlank")return T(ke,Te==="notBlank",de,se,oe.trim===!0);const je=typeof he.itemwise=="function"?he.itemwise(oe.col):null;if(je&&!_e(Te)&&!N.has(Te))return V(ke,O(oe,je,he.locale),de,se);const ye=w(J(oe,he),he.locale);switch(ke.kind){case"dictionary":return R(ke,ye,de,se);case"bitset":return x(ke,ye,de,se);case"float64":case"int32":return U(ke,oe,ye,de,se)?de:V(ke,ye,de,se);default:return V(ke,ye,de,se)}}function ee(oe,he,ae){if(!oe)return n(r(he,ae),ae,1);if(Array.isArray(oe.conditions)){const se=oe.conditions.filter(Ae=>Ae!=null),de=oe.op==="or"?"or":oe.op==="not"?"not":"and";if(se.length===0)return n(r(he,ae),ae,1);const ke=ee(se[0],he,ae);for(let Ae=1;Ae<se.length;Ae++){const Te=ee(se[Ae],he,ae);if(de==="or")for(let je=0;je<ae;je++)ke[je]|=Te[je];else for(let je=0;je<ae;je++)ke[je]&=Te[je];i(he,Te)}if(de==="not")for(let Ae=0;Ae<ae;Ae++)ke[Ae]^=1;return ke}return _(oe,he,r(he,ae))}function W(oe,he){return ee(oe,he,he.count|0)}function Z(oe,he){if(!oe||!he)return oe||null;const ae=oe;if(Array.isArray(ae.conditions)){if((ae.op==="or"?"or":ae.op==="not"?"not":"and")!=="and")return ne(ae,he)?null:oe;const de=[];for(const ke of ae.conditions){const Ae=Z(ke,he);Ae&&de.push(Ae)}return de.length?{...ae,op:"and",conditions:de}:null}return ae.col===he?null:oe}function ne(oe,he){if(!oe||typeof oe!="object")return!1;const ae=oe;if(ae.col===he)return!0;if(Array.isArray(ae.conditions)){for(const se of ae.conditions)if(ne(se,he))return!0}return!1}function ie(oe,he,ae){if(ae&&ae.length>=he){let Ae=0;for(let Te=0;Te<he;Te++)oe[Te]&&(ae[Ae++]=Te);return ae.subarray(0,Ae)}let se=0;for(let Ae=0;Ae<he;Ae++)se+=oe[Ae]?1:0;const de=new Uint32Array(se);let ke=0;for(let Ae=0;Ae<he;Ae++)oe[Ae]&&(de[ke++]=Ae);return de}const ce=new Map,me=new Map,Ce=new Set,Pe=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn","contains","notContains","startsWith","endsWith","matches","blank","notBlank","containsAny","containsAll","containsNone"]);function xe(oe,he){if(!oe||typeof oe!="object")return;const ae=Object.entries(oe).filter(([,se])=>se&&typeof se.compile=="function");if(typeof he=="string"&&he){let se=me.get(he);se||(se=new Map,me.set(he,se));for(const[de,ke]of ae)se.set(de,ke)}for(const[se,de]of ae)Pe.has(se)?Ce.add(se):ce.set(se,de)}function _e(oe){return typeof oe=="string"?ce.get(oe):void 0}function ve(oe,he){if(typeof oe!="string"||typeof he!="string")return;const ae=me.get(oe);return ae?ae.get(he):void 0}}),Ve("packages/core/src/columns/datatypes.js",function(e,D){"use strict";Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"parseNumberText",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"BUILTIN_TYPES",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return T}});const re=D("packages/core/src/internal/compare.js"),A=re.collator,Y=re.defaultCompare,I=D("packages/core/src/internal/predicates.js"),L=I.isNil,Q=I.isObject,H=I.isFunction,$=D("packages/core/src/internal/warn.js"),X=$.fail,F=$.infoOnce,v=D("packages/core/src/internal/text.js").titleCase,b=D("packages/core/src/format/date.js"),l=b.toDate,g=b.toIsoDate,o=b.compareIso,s=D("packages/core/src/format/boolean.js").toTriState,i=D("packages/core/src/columns/types/index.js").EXTENDED_TYPES,n=D("packages/core/src/formula/index.js"),m=n.evaluateFormula,c=n.looksLikeFormula,u=D("packages/core/src/compute/filter.js").declareOperators,h=/^\d{4}-\d{2}-\d{2}$/;function p(R){return R.getHours()===0&&R.getMinutes()===0&&R.getSeconds()===0&&R.getMilliseconds()===0}const y=new Map;function d(R){const x=R||"",U=y.get(x);if(U)return U;const V={group:",",decimal:"."};try{for(const J of new Intl.NumberFormat(R||void 0).formatToParts(12345.6))J.type==="group"?V.group=J.value:J.type==="decimal"&&(V.decimal=J.value)}catch{}return y.set(x,V),V}const f=/\d\s*[*/^]\s*[\d.(]/;function w(R,x){if(L(R))return null;let U=String(R).trim();if(U===""||U.startsWith("=")||f.test(U))return null;let V=1;U.startsWith("(")&&U.endsWith(")")&&(V=-1,U=U.slice(1,-1));const J=U.endsWith("%"),{group:_,decimal:ee}=d(x);if(U=U.replace(/[\s\u00a0\u202f\u2009']/g,""),_&&_!=="."&&_!==","&&(U=U.split(_).join("")),U=U.replace(/[^0-9eE+\-.,]/g,""),ee===","?U=U.split(".").join("").replace(",","."):U=U.split(",").join(""),U===""||U==="-"||U==="+")return null;const W=Number(U);return Number.isNaN(W)?null:V*(J?W/100:W)}function k(R,x){const U=L(R)||Number.isNaN(R)?null:Number(R),V=L(x)||Number.isNaN(x)?null:Number(x);return U===null?V===null?0:1:V===null||U<V?-1:U>V?1:0}function P(R,x){const U=s(R),V=s(x);return U===null?V===null?0:1:V===null?-1:U===V?0:U?1:-1}function G(R,x){const U=l(R),V=l(x);if(!U)return V?1:0;if(!V)return-1;const J=U.getTime(),_=V.getTime();return J<_?-1:J>_?1:0}const K=new Map;function q(R){const x=l(R.value);if(!x)return"";const U=R.locale||"";let V=K.get(U);return V||(V=new Intl.DateTimeFormat(R.locale||void 0,{dateStyle:"medium"}),K.set(U,V)),V.format(x)}const B={boolean:{base:"boolean",storage:"bitset",matches:R=>typeof R=="boolean",parse:R=>s(R.text),compare:P,format:R=>s(R.value)===null?"":s(R.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:R=>s(R)===null?"":String(s(R)),fromClipboard:R=>s(R)},number:{base:"number",storage:"float64",matches:R=>typeof R=="number"&&!Number.isNaN(R),parse:R=>{if(c(R.text)){const x=m(R.text,R);if(!x.ok)return null;const U=Number(x.value);return Number.isFinite(U)?U:null}return w(R.text,R.locale)},compare:k,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:R=>L(R)?"":String(R),fromClipboard:(R,x)=>w(R,x&&x.locale),toStorage:(R,x)=>{if(typeof R!="string")return R;const U=w(R,x&&x.locale);return U!==null?U:(F(`type.number.unparsed.${x&&x.colId||""}`,`column "${x&&x.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:R=>typeof R=="string"&&h.test(R)&&!Number.isNaN(Date.parse(R))||R instanceof Date&&!Number.isNaN(R.getTime())&&p(R),parse:R=>g(R.text),compare:o,format:q,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:R=>g(R),toClipboard:R=>L(R)?"":String(R),fromClipboard:R=>g(R)},dateString:{base:"dateString",storage:"dictionary",matches:R=>typeof R=="string"&&h.test(R)&&!Number.isNaN(Date.parse(R)),parse:R=>g(R.text),compare:o,format:q,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:R=>g(R),toClipboard:R=>L(R)?"":String(R),fromClipboard:R=>g(R)},text:{base:"text",storage:"dictionary",matches:R=>typeof R=="string",parse:R=>R.text===""?null:String(R.text),compare:(R,x)=>L(R)?L(x)?0:1:L(x)?-1:A().compare(String(R),String(x)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:R=>L(R)?"":String(R),fromClipboard:R=>R},image:{base:"text",storage:"dictionary",parse:R=>R.text===""||R.text==null?null:String(R.text).trim(),compare:(R,x)=>L(R)?L(x)?0:1:L(x)?-1:A().compare(String(R),String(x)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:R=>L(R)?"":String(R),fromClipboard:R=>R},lookup:{base:"text",storage:"dictionary",parse:R=>{if(R.text===""||R.text==null)return null;const x=R.column&&R.column.lookup,U=x&&H(x.options)?x.options():null;if(!U)return R.text;const V=String(R.text),J=U.find(W=>String(W.id)===V);if(J)return J.id;const _=V.trim().toLowerCase(),ee=U.find(W=>String(W.label).toLowerCase()===_);return ee?ee.id:R.text},compare:Y,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:R=>L(R)?"":String(R),fromClipboard:R=>R},object:{base:"object",storage:"object",matches:R=>R!==null&&typeof R=="object"&&!(R instanceof Date),parse:R=>{try{return R.text===""?null:JSON.parse(R.text)}catch{return R.text}},compare:(R,x)=>Y(R,x),format:R=>{const x=R.value;if(L(x))return"";if(typeof x=="string")return x;try{return JSON.stringify(x)}catch{return String(x)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:R=>L(R)?"":typeof R=="string"?R:JSON.stringify(R),fromClipboard:R=>R}},E=["boolean","number","date","dateString","datetime","text","object"];function S(R,x,U,V){const J=U.get(R);if(J)return J;V.includes(R)&&X(`circular data type extends chain: ${[...V,R].join(" → ")}`);const _=x[R];_||X(`unknown data type "${R}"`);let ee=null;_.extends&&(ee=S(_.extends,x,U,[...V,R]));const W={...ee||{},..._,name:R,defaults:{...ee&&ee.defaults||{},..._.defaults||{}}};return W.base||(W.base=ee&&ee.base||"text"),W.storage||(W.storage=ee&&ee.storage||"object"),U.set(R,W),W}function C(R,x){const U={...B,...i};if(x&&typeof x.dataType=="function"&&typeof x.names=="function")for(const J of x.names("dataType")){const _=x.dataType(J);_&&(U[J]=_)}if(Q(R))for(const[J,_]of Object.entries(R))U[J]=_;const V=new Map;for(const J of E)S(J,U,V,[]);S("lookup",U,V,[]);for(const J of Object.keys(U))S(J,U,V,[]);for(const J of V.values())u(J.operators,J.name);return V}function N(R,x){if(R.base==="text"&&(!R.compare||R.compare===B.text.compare)){const U=A(x);return(V,J)=>L(V)?L(J)?0:1:L(J)?-1:U.compare(String(V),String(J))}return R.compare||Y}function O(R,x){return x?R.multiStorage||"multi":R.storage||"object"}function T(R){return v(String(R).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),Ve("packages/core/src/columns/infer.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_SAMPLE",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"inferFromValues",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return H}});const A=D("packages/core/src/internal/warn.js").infoOnce,I=D("packages/core/src/internal/predicates.js").isNil,L=100;function Q($,X,F={}){const j=F.sampleSize??L,v=[];for(let b=0;b<$.length&&v.length<j;b++){const l=$[b];I(l)||typeof l=="number"&&Number.isNaN(l)||v.push(l)}if(v.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[b,l]of X){if(typeof l.matches!="function")continue;let g=!0;for(let o=0;o<v.length;o++)if(!l.matches(v[o])){g=!1;break}if(g)return{type:b,unanimous:!0,sampled:v.length}}return F.quiet||A(`infer:${F.colId||"?"}`,`column "${F.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:v.length}}function H($,X,F,j,v={}){const b=v.sampleSize??L,l=[];for(let g=0;g<X.length&&l.length<b;g++){const o=F(X[g]);I(o)||typeof o=="number"&&Number.isNaN(o)||l.push(o)}return Q(l,j,{...v,colId:$}).type}}),Ve("packages/core/src/columns/graph.js",function(e,D){"use strict";Object.defineProperty(e,"WHOLE_ROW",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"declarationOf",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return j}});const re=D("packages/core/src/internal/warn.js"),A=re.DEV,Y=re.fail,I=re.warnOnce,Q=D("packages/core/src/internal/predicates.js").isFunction,H="*";function $(v){const b=v.value||{};if(!Q(b.compute))return{computed:!1,wholeRow:!1,deps:[],pure:!0};const g=b.pure!==!1;return b.deps===H?{computed:!0,wholeRow:!0,deps:[],pure:g}:Array.isArray(b.deps)?{computed:!0,wholeRow:!1,deps:b.deps.slice(),pure:g}:(I(`deps:missing:${v.id}`,`computed column "${v.id}" declares no \`value.deps\`; treating it as \`deps: '*'\` (a whole-row dependency). Declare the dependencies to get precise invalidation.`),{computed:!0,wholeRow:!0,deps:[],pure:g})}function X(v){const b=new Map;for(const u of v)b.set(u.id,u);const l=new Map,g=new Map,o=new Set,t=new Set,s=new Set,r=new Set;for(const u of v){const h=$(u);if(!h.computed){l.set(u.id,[]);continue}t.add(u.id),(h.pure?s:r).add(u.id),h.wholeRow&&o.add(u.id);const p=[],y=[];for(const d of h.deps)(b.has(d)?p:y).push(d);l.set(u.id,p),y.length&&g.set(u.id,y)}for(const u of s)for(const h of l.get(u))r.has(h)&&Y(`pure computed column "${u}" depends on impure column "${h}". Mark it \`value.pure: false\` or make the dependency pure.`);const i=[],n=new Map,m=[],c=u=>{const h=n.get(u);if(h!=="done"){if(h==="open"){const p=m.indexOf(u);Y(`circular column dependency: ${[...m.slice(p),u].join(" → ")}`)}n.set(u,"open"),m.push(u);for(const p of l.get(u)||[])b.has(p)&&c(p);m.pop(),n.set(u,"done"),i.push(u)}};for(const u of v)c(u.id);const a=new Map;for(const u of v)a.set(u.id,[]);for(const u of v)for(const h of l.get(u.id)||[]){const p=a.get(h);p&&!p.includes(u.id)&&p.push(u.id)}if(o.size)for(const u of v){if(t.has(u.id))continue;const h=a.get(u.id);for(const p of o)h.includes(p)||h.push(p)}return{order:i,dependents:a,pure:s,impure:r,computed:t,deps:l,wholeRow:o,external:g,index:b}}function F(v,b){const l=Array.isArray(b)?b:[b],g=new Set,o=[...l];for(;o.length;){const t=o.shift();for(const s of v.dependents.get(t)||[])g.has(s)||(g.add(s),o.push(s))}for(const t of l)g.delete(t);return v.order.filter(t=>g.has(t))}function j(v,b,l){if(!A)return v;const g=b instanceof Set?b:new Set(b);return new Proxy(v,{get(o,t){return typeof t=="string"&&!g.has(t)&&!Object.hasOwn(o,t)&&I(`undeclared:${l}:${t}`,`computed column "${l}" read undeclared dependency "${t}". Add it to \`value.deps\` or the value will go stale.`),o[t]}})}}),Ve("packages/core/src/model/rowkey.js",function(e,D){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"compositeKey",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createRowKey",{enumerable:!0,get:function(){return v}}),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 A=D("packages/core/src/internal/warn.js").warnOnce,I=D("packages/core/src/internal/paths.js").pathGetter,L=D("packages/core/src/internal/predicates.js"),Q=L.isFunction,H=L.isBlank,$=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],X="";function F(s){if(s===null)return"\0n";if(s===void 0)return"\0u";const r=typeof s;if(r==="string")return s;if(r==="number"||r==="bigint"||r==="boolean")return String(s);if(s instanceof Date)return`\0d${s.getTime()}`;try{return`\0o${JSON.stringify(s)}`}catch{return"\0o?"}}function j(s){if(s.length===1)return F(s[0]);let r="";for(let i=0;i<s.length;i++)i&&(r+=X),r+=F(s[i]);return r}function v(s,r={}){const i=r.warn!==!1;if(Q(s)){const n=s;return{stable:!0,fields:[],disabled:[],key(m,c){try{const a=n(m);return Array.isArray(a)?j(a):F(a)}catch(a){return A("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",a),`#${c??-1}`}},keyEmpty(m){try{const c=n(m);return Array.isArray(c)?c.length===0||c.some(H):H(c)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(s)&&s.length>0){const n=s.filter(a=>typeof a=="string"),m=n.map(a=>I(a)),c=m.length;return{stable:!0,fields:n,disabled:[],key(a){const u=new Array(c);for(let h=0;h<c;h++)u[h]=m[h](a);return j(u)},keyEmpty(a){for(let u=0;u<c;u++)if(H(m[u](a)))return!0;return!1},missingFields(a){const u=[];for(let h=0;h<c;h++)H(m[h](a))&&u.push(n[h]);return u}}}if(typeof s=="string"&&s.length>0){const n=I(s);return{stable:!0,fields:[s],disabled:[],key(m){return F(n(m))},keyEmpty(m){return H(n(m))},missingFields(m){return H(n(m))?[s]:[]}}}return i&&A("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${$.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:$.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=`#${l++}`,b.set(n,c)),c}}}const b=new WeakMap;let l=0;function g(s,r){if(!s||s.stable===!1||!Q(s.keyEmpty)||!Array.isArray(r)||r.length===0)return;let i=0,n=null,m;for(let h=0;h<r.length;h++){const p=r[h];s.keyEmpty(p)&&(i++,n===null&&(n=Q(s.missingFields)?s.missingFields(p):[],m=p))}if(i===0)return;const c=s.fields.length?s.fields.join(","):"(function)",a=n&&n.length?n.join(", "):s.fields.length?s.fields.join(", "):"the rowKey function",u=m!==null&&typeof m=="object"?Object.keys(m).join(", ")||"(no fields)":String(m);A(`rowKey.emptyValue:${c}`,`rowKey ${a} is missing on ${i} of ${r.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(s){return j(s)}function t(s){return s.split(X)}}),Ve("packages/core/src/columns/lookup.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_SEPARATOR",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"normaliseOption",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return l}}),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 s}});const re=D("packages/core/src/internal/compare.js"),A=re.collator,Y=re.defaultCompare,I=D("packages/core/src/internal/predicates.js"),L=I.isFunction,Q=I.isNil,$=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/model/rowkey.js").compositeKey,j=", ",v="";function b(r,i,n,m){if(r===null||typeof r!="object")return{id:r,label:r==null?"":String(r)};const c=r[i],a=r[n],u={id:c,label:a==null?String(c??""):String(a)};r.disabled&&(u.disabled=!0),r.variant&&(u.variant=r.variant),r.icon&&(u.icon=r.icon);const h=m?r[m]:r.group;return h!==void 0&&(u.group=h),u}function l(r,i,n=0,m=[],c=[]){for(const a of r||[]){const u=a&&typeof a=="object"?a[i]:null;if(c.push({raw:a,depth:n,path:m}),Array.isArray(u)&&u.length){const h=String(a&&typeof a=="object"?a.label??a.name??a.id??"":a);l(u,i,n+1,[...m,h],c)}}return c}function g(r){return!!r&&typeof r=="object"&&!Array.isArray(r)&&L(r.router&&r.router.subscribe)}class o{#e;#t;#n;#r;#s=[];#i=new Map;#a=new Map;#l=0;#o="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=A(this.#n),Array.isArray(this.#e.options)?this.#h(this.#e.options):this.#e.options===void 0&&(this.#o="ready")}get colId(){return this.#t}get version(){return this.#l}get state(){return this.#o}get ready(){return this.#o==="ready"}get multiple(){return this.#e.multiple===!0}get separator(){return this.#e.separator??j}get allowCustom(){return this.#e.allowCustom===!0}get sortBy(){return this.#e.sortBy||"label"}get spec(){return this.#e}options(){return this.#s}setLocale(i){this.#n=i,this.#u=A(i)}#h(i){const n=this.#e,m=n.valueKey||"id",c=n.labelKey||"label",a=n.childrenKey||"children";this.#s=l(i,a).map(u=>{const h=b(u.raw,m,c,n.groupKey);return u.depth&&(h.depth=u.depth,h.path=u.path),h}),this.#i=new Map,this.#a=new Map,this.#s.forEach((u,h)=>{this.#i.set(u.id,u),this.#a.set(u.id,h)}),this.#o="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.#s),this.#c;if(g(i))return this.#c=this.#p(i),this.#c;if(!L(i))return $(`lookup:options:${this.#t}`,`column "${this.#t}" has an invalid \`lookup.options\`; expected an array, a function, or a router route`),this.#o="ready",this.#c=Promise.resolve([]),this.#c;this.#o="loading";let n;try{n=i()}catch(m){return this.#o="error",$(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,m),this.#c=Promise.resolve([]),this.#c}return!n||!L(n.then)?(this.#h(n),this.#c=Promise.resolve(this.#s),this.#r&&this.#r(this),this.#c):(this.#c=n.then(m=>(this.#h(m),this.#r&&this.#r(this),this.#s),m=>(this.#o="error",$(`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.#s)):this.load()}#p(i){if(this.#f)return Promise.resolve(this.#s);const n=this.#e,m=n.valueKey||"id",c=n.labelKey||"label",a=n.groupKey,u=L(i.map)?i.map:null,h=y=>b(u?u(y):y,m,c,a).id,p=y=>this.#m(y,u,m,c,a);return i.router.subscribe(i.predicate,p,{rowKey:h}),this.#f=()=>{L(i.router.detach)&&i.router.detach(p)},this.#o="ready",Promise.resolve(this.#s)}#m(i,n,m,c,a){const u=i&&i.add||[],h=i&&i.update||[],p=i&&i.remove||[];if(!(!u.length&&!h.length&&!p.length)){for(const y of u)this.#g(y,n,m,c,a);for(const y of h)this.#g(y,n,m,c,a);for(const y of p){if(!this.#d.has(y))continue;const d=this.#d.get(y);this.#d.delete(y),this.#i.delete(d);const f=this.#s.findIndex(w=>w.id===d);f>=0&&this.#s.splice(f,1)}this.#a=new Map(this.#s.map((y,d)=>[y.id,d])),this.#o="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(i,n,m,c,a){const u=b(n?n(i):i,m,c,a);this.#d.set(F([u.id]),u.id);const h=this.#s.findIndex(p=>p.id===u.id);h>=0?this.#s[h]=u:this.#s.push(u),this.#i.set(u.id,u)}destroy(){this.#f&&(this.#f(),this.#f=null)}search(i,n){const m=this.#e;if(!L(m.search)){const u=String(i||"").toLowerCase();return Promise.resolve(u===""?this.#s:this.#s.filter(h=>h.label.toLowerCase().includes(u)))}const c=m.valueKey||"id",a=m.labelKey||"label";return Promise.resolve(m.search(i,n)).then(u=>(u||[]).map(h=>b(h,c,a,m.groupKey)))}option(i){return this.#i.get(i)}has(i){return this.#i.has(i)}label(i){if(Q(i)||i==="")return"";const n=this.#i.get(i);if(n)return n.label;if(this.#o==="loading"||this.#o==="idle")return"";this.allowCustom||$(`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 L(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.#s.map(i=>i.id)}sorted(){const i=this.sortBy;if(i==="optionOrder"||i==="count")return this.#s.slice();if(i==="value")return this.#s.slice().sort((m,c)=>Y(m.id,c.id));const n=this.#u;return this.#s.slice().sort((m,c)=>n.compare(m.label,c.label))}comparator(){const i=this.sortBy,n=this.multiple,m=this.#u,c=this.#a;if(n&&i==="count")return(u,h)=>t(u).length-t(h).length;const a=n?u=>t(u)[0]:u=>u;return i==="value"?(u,h)=>Y(a(u),a(h)):i==="optionOrder"?(u,h)=>{const p=c.has(a(u))?c.get(a(u)):Number.MAX_SAFE_INTEGER,y=c.has(a(h))?c.get(a(h)):Number.MAX_SAFE_INTEGER;return p-y}:(u,h)=>{const p=a(u),y=a(h);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(v):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],a=Array.isArray(n)?n:[n];switch(m){case"containsAll":return a.every(u=>c.includes(u));case"containsNone":return!a.some(u=>c.includes(u));default:return a.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.#s.map(n=>({id:n.id,label:n.label,has:m=>i?t(m).includes(n.id):m===n.id}))}}function t(r){return Array.isArray(r)?r:Q(r)||r===""?[]:[r]}function s(r,i={}){const n=r.lookup;if(!n)return null;const m=new o(n,{colId:r.id,locale:i.locale,onChange:i.onChange});return!Array.isArray(n.options)&&n.options!==void 0&&m.load(),m}}),Ve("packages/core/src/columns/value.js",function(e,D){"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 s}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return r}});const A=D("packages/core/src/internal/paths.js").getPath,Y=D("packages/core/src/internal/predicates.js"),I=Y.isFunction,L=Y.isNil,Q=Y.isObject,$=D("packages/core/src/internal/lru.js").Lru,F=D("packages/core/src/internal/warn.js").warnOnce,v=D("packages/core/src/format/number.js").compileNumber,l=D("packages/core/src/columns/graph.js").depsProxy,g="\0";function o(c,a={}){const u=a.locale,h=a.grid??null,p=a.context,y=c.value&&c.value.format,d=c.formatter||null,f=c.dataType&&c.dataType.format,w=c.lookup||null,k=(P,G,K)=>({value:P,data:K,row:G,column:c,colId:c.id,grid:h,context:p,locale:u});if(I(y))return(P,G,K)=>{const q=y(k(P,G,K));return q==null?"":String(q)};if(d){if(w){const P=d.kind==="text";return(G,K,q)=>d(P?w.text(G):G,k(G,K,q))}return(P,G,K)=>d(P,k(P,G,K))}if(I(f))return(P,G,K)=>{const q=f(k(P,G,K));return q==null?"":String(q)};if(c.dataType&&c.dataType.base==="number"&&Q(c.typeOptions)&&typeof c.typeOptions.decimals=="number"){const P=v({decimals:c.typeOptions.decimals},u);return G=>P(G)}return w?P=>w.text(P):P=>L(P)?"":typeof P=="string"?P:String(P)}function t(c,a){!c||!c.value||c.value.pure!==!1||F(`impure:${a}:${c.id}`,`column "${c.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${a}. The result is not stable across passes.`)}class s{#e;#t;#n;#r;#s;#i;#a=new $(4096);constructor(a){this.#e=a.columns instanceof Map?a.columns:new Map((a.columns||[]).map(u=>[u.id,u])),this.#t=a.graph,this.#n=a.grid??null,this.#r=a.context,this.#i=a.stored||null,this.#s=a.rowKey||r}get graph(){return this.#t}setGraph(a){this.#t=a,this.#a.clear()}beginPass(){this.#a.clear()}endPass(){this.#a.clear()}invalidate(a){if(this.#a.size===0)return;const u=a&&a.rows?new Set([...a.rows].map(String)):null,h=a&&a.columns?[...a.columns]:null;if(!u&&!h){this.#a.clear();return}const p=h?this.#l(h):null;for(const y of[...this.#a.keys()]){const d=String(y).split(g);d.length===3&&(u&&!u.has(d[0])||p&&!p.has(d[2])||this.#a.delete(y))}}#l(a){const u=new Set,h=this.#t,p=[...a];for(;p.length;){const y=p.pop();if(!u.has(y)){u.add(y);for(const d of h?h.dependents.get(y)||[]:[])p.push(d)}}return u}value(a,u,h){const p=typeof a=="string"?this.#e.get(a):a;if(!p)return;if(!p.computed)return this.#c(p,u,h);if(p.value.pure!==!1&&this.#i&&h&&h.physical!=null&&this.#i.has(p.id))return this.#i.get(p.id,h.physical);if(p.volatile)return this.compute(p,u,h);if(p.value.pure===!1)return this.compute(p,u,h);const y=`${this.#o(u,h)}${g}${p.id}`;if(this.#a.has(y))return this.#a.get(y);const d=this.compute(p,u,h);return this.#a.set(y,d),d}#o(a,u){return`${this.#s(a,u)}${g}${i(a)}`}#c(a,u,h){if(this.#i&&h&&h.physical!=null&&this.#i.has(a.id))return this.#i.get(a.id,h.physical);if(a.field)return a.read?a.read(u):A(u,a.field)}compute(a,u,h){const p=this.#t,y=p&&p.wholeRow.has(a.id);let d;if(y)d=u??{};else{d={};const w=p&&p.deps.get(a.id)||[];for(const P of w)d[P]=this.value(P,u,h);const k=p&&p.external.get(a.id)||[];for(const P of k)d[P]=A(u,P);d=l(d,[...w,...k],a.id)}const f={data:u,row:h,column:a,grid:this.#n,context:this.#r};return a.value.compute(d,f)}values(a,u){const h={},p=this.#t?this.#t.order:[...this.#e.keys()];for(const y of p)h[y]=this.value(y,a,u);return h}text(a,u,h){const p=typeof a=="string"?this.#e.get(a):a;return p?p.formatValue(this.value(p,u,h),h,u):""}key(a,u,h){const p=typeof a=="string"?this.#e.get(a):a;if(!p)return"";const y=this.value(p,u,h);return I(p.value.key)?String(p.value.key(this.#u(p,y,u,h))):p.lookup?p.lookup.groupKey(y):L(y)?"":String(y)}quickFilterText(a,u,h){const p=typeof a=="string"?this.#e.get(a):a;if(!p)return"";if(I(p.value.quickFilterText)){const y=this.value(p,u,h);return String(p.value.quickFilterText(this.#u(p,y,u,h))??"")}return this.text(p,u,h)}#u(a,u,h,p){return{value:u,data:h,row:p,column:a,colId:a.id,grid:this.#n,context:this.#r}}parse(a,u,h,p){const y=typeof a=="string"?this.#e.get(a):a;if(!y)return u;const d={text:u,value:this.value(y,h,p),data:h,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(d):y.dataType&&I(y.dataType.parse)?y.dataType.parse(d):u}validate(a,u,h,p,y){const d=typeof a=="string"?this.#e.get(a):a;if(!d||!I(d.edit.validate))return!0;const f=d.edit.validate({value:u,oldValue:h,data:p,row:y,column:d,grid:this.#n,context:this.#r});return f===!0||f===void 0?!0:String(f)}apply(a,u,h,p){const y=typeof a=="string"?this.#e.get(a):a;if(!y)return!1;const d=this.value(y,h,p);if(I(y.value.apply)){const f=y.value.apply({value:u,oldValue:d,data:h,row:p,column:y,grid:this.#n,context:this.#r});return this.#f(y,h,p),f!==!1}return y.field?d===u?!1:(y.write(h,u),this.#f(y,h,p),!0):(F(`apply:${y.id}`,`column "${y.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(a,u,h,p){const y=typeof a=="string"?this.#e.get(a):a;if(!y)return{ok:!1,value:void 0,oldValue:void 0,changed:!1,error:"unknown column"};const d=this.value(y,h,p),f=this.parse(y,u,h,p),w=this.validate(y,f,d,h,p);if(w!==!0)return{ok:!1,value:f,oldValue:d,changed:!1,error:w};const k=this.apply(y,f,h,p);return{ok:!0,value:f,oldValue:d,changed:k}}#f(a,u,h){if(this.#a.size===0)return;const p=this.#o(u,h);this.#a.delete(`${p}${g}${a.id}`);for(const y of this.#t?this.#t.dependents.get(a.id)||[]:[])this.#a.delete(`${p}${g}${y}`)}}function r(c,a){return a&&a.key!=null?String(a.key):i(c)}function i(c){if(c&&typeof c=="object"){let a=n.get(c);return a===void 0&&(a=`#${m++}`,n.set(c,a)),a}return String(c)}const n=new WeakMap;let m=0}),Ve("packages/core/src/model/shadow.js",function(e,D){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"HISTORY_TICK_MAX_MS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"HISTORY_TICK_MIN_MS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"CLUSTER_SHADOW_KINDS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"DEFAULT_ANOMALY_THRESHOLD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"SPEC_STATUS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"POSITIONAL_KINDS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"SHADOW_LABELS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"specStatusOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ShadowTracker",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"shadowsIn",{enumerable:!0,get:function(){return a}});const A=D("packages/core/src/internal/warn.js").warnOnce,Y=2e5,I=20,L=1e3,Q=50;function H(u){return Math.min(L,Math.max(Q,Math.floor(u)))}const $=Object.freeze(["updates","updatedAt","sinceUpdate","delta","deltaPercent","rate","history","firstValue","streak","rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag","specStatus","rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta","fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD","cluster","clusterDistance"]),X=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),F=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),j=Object.freeze(["cluster","clusterDistance"]),v=.6745,b=3.5,l=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,h){if(!h)return null;const p=Number.isFinite(Number(h.lower))?Number(h.lower):null,y=Number.isFinite(Number(h.upper))?Number(h.upper):null;if(p===null&&y===null||!Number.isFinite(u))return null;if(p!==null&&u<p||y!==null&&u>y)return l.FAIL;const d=Number.isFinite(Number(h.warnLower))?Number(h.warnLower):null,f=Number.isFinite(Number(h.warnUpper))?Number(h.warnUpper):null;return d!==null&&u<d||f!==null&&u>f?l.WARN:l.PASS}function s(u,h,p){if(!h||typeof h!="object")return null;if(h.kind!=="time")return h.kind!==void 0&&A(`shadow.history.window.kind:${u}`,`a 'history' shadow's 'window' only accepts {kind: 'time', span}; '${h.kind}' is not honoured (a plain count is already what 'depth' means, and a session has no span to divide into buckets), so it reported the original, unwindowed history.`),null;const y=h.minutes!=null?Number(h.minutes)*6e4:Number(h.span);if(!(y>0))return A(`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 d=Math.max(2,Math.floor(p)||I);return{span:y,bucketMs:Math.max(1,Math.floor(y/d))}}class r{#e;#t=new Map;#n=new Map;#r=new Map;#s=new Map;#i=new Map;#a=new Map;#l=0;#o;#c;#u;#f;#d=new Map;#h=null;#p=null;#m=null;constructor(h){this.#e=h.colId,this.#o=Math.max(2,h.depth||I),this.#c=Math.max(1,h.max||Y),this.#u=h.now||(()=>Date.now()),this.#f=s(this.#e,h.historyWindow,this.#o),this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#f}observe(h,p){const y=c(p);if(y===null)return;if(!this.#n.has(h)){this.#p=null,this.#m=null,this.#g(),this.#t.set(h,y),this.#n.set(h,y),this.#r.set(h,0),this.#s.set(h,this.#u()),this.#i.set(h,[y]),this.#f&&this.#d.set(h,[y]),this.#a.set(h,0);return}const d=this.#n.get(h);if(d===y)return;this.#p=null,this.#m=null,this.#n.set(h,y),this.#r.set(h,(this.#r.get(h)||0)+1),this.#s.set(h,this.#u());const f=this.#i.get(h)||[];f.push(y),f.length>this.#o&&f.splice(0,f.length-this.#o),this.#i.set(h,f);const w=Math.sign(y-d),k=this.#a.get(h)||0;this.#a.set(h,Math.sign(k)===w?k+w:w)}#g(){if(this.#n.size<this.#c)return;const h=this.#n.keys().next().value;h!==void 0&&(this.#t.delete(h),this.#n.delete(h),this.#r.delete(h),this.#s.delete(h),this.#i.delete(h),this.#d.delete(h),this.#a.delete(h),this.#l++)}rebase(){for(const[h,p]of this.#n)this.#t.set(h,p);this.#p=null,this.#m=null}reset(){this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#s.clear(),this.#i.clear(),this.#d.clear(),this.#a.clear(),this.#l=0,this.#p=null,this.#m=null,this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}retain(h){const p=h instanceof Set?h:new Set(h);let y=0;for(const d of[...this.#n.keys()])p.has(d)||(this.#t.delete(d),this.#n.delete(d),this.#r.delete(d),this.#s.delete(d),this.#i.delete(d),this.#d.delete(d),this.#a.delete(d),y++);return y&&(this.#p=null,this.#m=null),y}advanceHistoryWindow(h=this.#u()){const p=this.#f;if(!p)return 0;const y=Math.floor(h/p.bucketMs),d=y-this.#h;if(!(d>0))return 0;const f=Math.min(d,this.#o);for(const[w,k]of this.#d){const P=this.#n.get(w);for(let G=0;G<f;G++)k.push(P);k.length>this.#o&&k.splice(0,k.length-this.#o)}return this.#h=y,d}read(h,p,y,d){switch(h){case"updates":return this.#r.has(p)?this.#r.get(p):0;case"updatedAt":{const f=this.#s.get(p);return f===void 0?null:new Date(f)}case"sinceUpdate":{const f=this.#s.get(p);return f===void 0?null:this.#u()-f}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 f=this.#t.get(p);return f?(this.#n.get(p)-f)/Math.abs(f)*100:null}case"rate":{const f=this.#i.get(p),w=this.#s.get(p);if(!f||f.length<2||w===void 0)return null;const k=this.#u()-w,P=f[f.length-1]-f[f.length-2];return k>0?P/k*1e3:P}case"history":return this.#f?this.#d.has(p)?[...this.#d.get(p)]:null:this.#i.has(p)?[...this.#i.get(p)]:null;case"streak":return this.#a.has(p)?this.#a.get(p):0;case"specStatus":return this.#n.has(p)?t(this.#n.get(p),d):null;default:return g.includes(h)?this.#O(h,p,y,d):null}}#b(h){if(h){if(this.#m&&this.#m.only===h)return this.#m.view;const p=this.#y(h);return this.#m={only:h,view:p},p}return this.#p?this.#p:(this.#p=this.#y(null),this.#p)}#y(h){const p=[];for(const[B,E]of this.#n)h&&!h.has(B)||p.push(E);const y=p.sort((B,E)=>B-E);let d=0,f=0,w=0,k=0;for(const B of y){k+=B,d++;const E=B-f;f+=E/d,w+=E*(B-f)}const P=[];for(const[B,E]of this.#t)h&&!h.has(B)||P.push(E);const G=d?i(y):0,K=y.map(B=>Math.abs(B-G)).sort((B,E)=>B-E),q=d?i(K):0;return{sorted:y,baseline:P.sort((B,E)=>B-E),sum:k,mean:d?f:0,sd:d>1?Math.sqrt(w/(d-1)):0,median:G,mad:q}}#O(h,p,y,d){if(!this.#n.has(p)||y&&!y.has(p))return null;const f=this.#n.get(p),w=this.#b(y),k=w.sorted.length;if(!k)return null;switch(h){case"rank":return k-m(w.sorted,f)+1;case"rankAsc":return n(w.sorted,f)+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=k-m(w.sorted,f)+1;return P-G}case"percentile":return m(w.sorted,f)/k*100;case"quartile":{const P=m(w.sorted,f)/k;return Math.min(4,Math.max(1,Math.ceil(P*4)))}case"zScore":return w.sd?(f-w.mean)/w.sd:null;case"anomalyScore":return w.mad?v*(f-w.median)/w.mad:null;case"anomalyFlag":{if(!w.mad)return null;const P=d&&Number.isFinite(Number(d.threshold))?Number(d.threshold):b;return Math.abs(v*(f-w.median)/w.mad)>P}case"shareOfTotal":return w.sum?f/w.sum*100:null;default:return null}}}function i(u){const h=u.length;if(!h)return 0;const p=(h-1)*.5,y=Math.floor(p),d=Math.ceil(p);return y===d?u[y]:u[y]+(p-y)*(u[d]-u[y])}function n(u,h){let p=0,y=u.length;for(;p<y;){const d=p+y>>1;u[d]<h?p=d+1:y=d}return p}function m(u,h){let p=0,y=u.length;for(;p<y;){const d=p+y>>1;u[d]<=h?p=d+1:y=d}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 h=typeof u=="number"?u:Number(u);return Number.isFinite(h)?h:null}function a(u){const h=[];for(const p of u||[]){const y=p.shadow;if(!y)continue;const d=typeof y=="string"?{kind:y}:y,f=d.kind;$.includes(f)&&(X.includes(f)||F.includes(f)||j.includes(f)||h.push({colId:p.id||p.field,of:d.of||p.field||p.id,kind:f,depth:d.depth,historyWindow:f==="history"?d.window:void 0}))}return h}}),Ve("packages/core/src/columns/model.js",function(e,D){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return xe}});const re=D("packages/core/src/internal/merge.js"),A=re.expand,Y=re.merge,I=re.toArray,L=D("packages/core/src/internal/warn.js"),Q=L.fail,H=L.warnOnce,$=D("packages/core/src/internal/paths.js"),X=$.getPath,F=$.pathGetter,j=$.pathSetter,b=D("packages/core/src/internal/text.js").humanise,l=D("packages/core/src/internal/predicates.js"),g=l.isFunction,o=l.isObject,s=D("packages/core/src/internal/uid.js").uid,i=D("packages/core/src/format/index.js").compileFormat,n=D("packages/core/src/columns/datatypes.js"),m=n.comparatorFor,c=n.createTypeRegistry,a=n.storageKind,u=D("packages/core/src/columns/infer.js"),h=u.inferColumnType,p=u.DEFAULT_SAMPLE,y=D("packages/core/src/columns/graph.js"),d=y.buildGraph,f=y.affectedBy,k=D("packages/core/src/columns/lookup.js").createLookup,P=D("packages/core/src/columns/value.js"),G=P.compileDisplay,K=P.ValuePipeline,q=P.warnImpureUse,B=D("packages/core/src/model/shadow.js"),E=B.FIT_SHADOW_KINDS,S=B.CLUSTER_SHADOW_KINDS,C=Object.freeze({geometry:"geometry",list:"list"}),N={value:{pure:!0},cell:{},edit:{enabled:!1},sort:{enabled:!0,direction:null,order:0,nullsFirst:!1},filter:{enabled:!0,type:"text"},group:{enabled:!1,index:-1,explode:!1},pivot:{enabled:!1,index:-1},total:null,layout:{width:150,min:40,max:null,flex:0,pin:null,hidden:!1,resizable:!0,movable:!0,lockVisible:!1,lockPosition:!1},header:{},facet:{},export:{lookup:"label",csv:!0,excel:!0},allowGroup:!0,allowPivot:!0,allowTotal:!0,nullable:!0,quickFilter:!0},O={centre:"center"},T=new Set(["start","center","end","left","right"]);function R(ve){if(typeof ve!="string")return;const oe=ve.toLowerCase();return O[oe]?O[oe]:T.has(oe)?oe:void 0}function x(ve){if(typeof ve!="string")return;const oe=ve.toLowerCase();return oe==="center"||oe==="centre"?"middle":oe==="top"||oe==="middle"||oe==="bottom"?oe:void 0}const U=["cell","layout","header"];function V(ve){if(!o(ve))return{};const oe={...ve},he=(ae,se)=>{if(ve[ae]===void 0)return;const de=A(ve[ae],se);de&&U.includes(ae)&&!o(ve[ae])&&delete de.enabled,oe[ae]=de};return he("sort","direction"),he("filter","type"),he("cell","render"),he("edit","editor"),he("layout","width"),he("group","index"),he("pivot","index"),he("header","render"),he("facet","strategy"),oe}function J(ve,oe){const he={...ve||{}},ae=o(oe)&&o(oe.layout)&&oe.layout.width!==void 0;return he.fit==="content"&&!ae&&delete he.width,he}const _=new Set(["allowGroup","allowPivot","allowTotal","cell","colSpan","contextMenu","diff","edit","export","facet","field","filter","filterRow","format","grandTotal","group","groupTotal","header","headerControls","id","layout","lookup","nullable","pivot","preset","quickFilter","rowSpan","running","shadow","showWhen","sort","spec","tags","title","total","type","typeOptions","validation","value","verticalAlign"]),ee=new Set(["collapsible","columns","facet","header","id","marryChildren","openByDefault","showWhen","title"]);function W(ve,oe,he,ae){const se=he==="columnGroup"?"column group":"column";for(const de of Object.keys(ve))if(!oe.has(de)){if(de==="timeZone"&&he==="column"){H("column.timeZone",`\`timeZone\` is not a column option, so it had no effect on column "${ae}". 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}H(`${he}.unknown:${de}`,`'${de}' is not a configuration key this grid recognises, so it had no effect on ${se} "${ae}". Check the spelling against the reference.`)}}function Z(ve){o(ve.cell)&&ve.cell.autoHeight!==void 0&&H("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${ve.id||ve.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function ne(ve,oe){const he=oe&&g(ve.defaultsFor)?ve.defaultsFor(oe):null,ae={...ve.defaults||{},...o(he)?he:{}},se={};return ae.align&&(se.align=ae.align,se.cell={align:ae.align},se.header={align:ae.align}),ae.filter&&(se.filter=ae.filter==="none"?{enabled:!1,type:"none"}:{enabled:!0,type:ae.filter}),ae.editor&&(se.edit=ae.editor==="none"?{editor:null}:{editor:ae.editor}),ae.total&&(se.total=ae.total),ae.render&&(se.cell={...se.cell||{},render:ae.render}),ve.export&&(se.export={...ve.export}),se}function ie(ve){if(typeof ve=="string")return ve.trim()?[ve.trim()]:[];if(!Array.isArray(ve))return[];const oe=[];for(const he of ve){if(typeof he!="string")continue;const ae=he.trim();ae&&!oe.includes(ae)&&oe.push(ae)}return oe}class ce{#e=new Map;#t=[];#n=[];#r=new WeakMap;#s;#i;#a;#l;#o;#c;#u(oe,he,ae){if(oe&&typeof oe=="object"&&!g(oe)){const Ae=oe;return(typeof Ae.fn!="string"||!Ae.fn)&&Q(`column "${ae}": a total given as an object needs a \`fn\` name, such as { fn: 'percentile', p: 0.9 }.`),Ae.fn==="percentile"&&!(typeof Ae.p=="number"&&Ae.p>=0&&Ae.p<=1)&&Q(`column "${ae}": { fn: 'percentile' } needs \`p\`, a number from 0 to 1 (0.9 for the 90th percentile).`),this.#f(Ae.fn,he,ae),Object.freeze({...Ae})}const se=this.#f(oe,he,ae);if(typeof se!="string"||!this.#d)return se??null;const de=he&&he.totals&&he.totals.implement;if(de&&g(de[se])){const Ae=de[se];return Ae.totalName=se,Ae}const ke=this.#d.totalFn?.(se);return g(ke)?ke:se}#f(oe,he,ae){if(typeof oe!="string")return oe;const se=he&&he.totals&&he.totals.supported;if(!Array.isArray(se)||se.includes(oe))return oe;const de=se.length?se.join(", "):"none";return Q(`column "${ae}" is typed ${he.name||"a type"}, for which the total "${oe}" is not meaningful. Supported: ${de}. Aggregating it anyway would produce a confident wrong number.`),oe}#d;#h;#p;#m;#g;#b;#y=!1;#O;#w;constructor(oe={}){this.#i=V(oe.columnDefaults||{}),this.#a=oe.columnPresets||{},this.#o=oe.locale,this.#l=oe.timeZone,this.#c=x(oe.verticalAlign),this.#d=oe.registry||null,this.#h=oe.grid||null,this.#p=oe.context,this.#O=oe.sampleSize??p,this.#w=oe.onChange||null,this.#b=g(oe.rowKey)?oe.rowKey:void 0,this.#s=c(oe.dataTypes,this.#d);const{leaves:he,groups:ae}=xe(oe.columns||[]);this.#n=ae;for(const se of he){se.facet!==void 0&&this.#r.set(se.def,se.facet);const de=this.#A(se.def,null);if(de.groupPath=se.path,this.#e.has(de.id)){H(`columns.duplicate:${de.id}`,`two columns resolve to the id '${de.id}', so the second is ignored. An id defaults to the column's field, so declare an explicit \`id\` when two columns read the same field.`);continue}se.column=de,this.#e.set(de.id,de),this.#t.push(de.id)}this.#P(oe.stored||null)}#A(oe,he){W(oe,_,"column",oe.id||oe.field||"(unnamed)"),Z(oe);const ae=V(oe),se=I(oe.preset),de=se.map(Ie=>{const We=this.#a[Ie];return We?V(We):(H(`preset:${Ie}`,`unknown column preset "${Ie}"; ignoring`),{})}),ke=this.#S(ae,de,he),Ae=this.#s.get(ke)||this.#s.get("text");if(!this.#s.has(ke)&&oe.type){const Ie=C[ke];H(`type:${ke}`,`unknown data type "${ke}"; falling back to "text"`+(Ie?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${Ie}'.`:""))}const Te=g(Ae.items)?this.#C(ae,de,oe.id||oe.field||"(unnamed)"):null;let je=N;je=Y(je,this.#i),oe.type!==!1&&(je=Y(je,ne(Ae,Te)));for(const Ie of de)je=Y(je,Ie);this.#r.has(oe)&&(je=Y(je,V({facet:this.#r.get(oe)}))),je=Y(je,ae);const ye=je.edit;ye&&ye.editor&&ye.enabled!==!0&&!g(ye.enabled)&&(oe.edit||{}).editor&&H(`column.editor-not-enabled:${oe.id||oe.field}`,`column '${oe.id||oe.field}' names the editor '${ye.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const He=oe.id||oe.field||s("col");if(oe.shadow&&!g(je.value&&je.value.compute)){const Ie=typeof oe.shadow=="string"?{kind:oe.shadow}:oe.shadow,We=Ie.of||oe.field||He,Ye=E.includes(Ie.kind),nt=S.includes(Ie.kind),Qe=Ye?Ie.model||Ie:null,dt=Ye&&Qe?[...Array.isArray(Qe.predictors)?Qe.predictors:[],Qe.response].filter(Boolean):null,jt=nt?(Array.isArray(Ie.columns)?Ie.columns:[]).filter(Boolean):null;je.value={...je.value||{},deps:jt&&jt.length?jt:dt&&dt.length?dt:Ie.orderBy&&Ie.orderBy!==We?[We,Ie.orderBy]:[We],pure:!1,compute:(Et,it)=>{const ft=it.grid&&it.grid.statistics;if(!ft)return null;const pt=it.row&&it.row.key||ft.keyOf(it.data);if(!pt)return null;if(Ye){if(!g(ft.fitShadow))return null;const Tt=Ie.model?{...Ie.model,threshold:Ie.threshold}:Ie;return ft.fitShadow(Ie.kind,pt,Tt)}return nt?g(ft.clusterShadow)?ft.clusterShadow(Ie.kind,pt,Ie):null:ft.shadow(We,Ie.kind,pt,Ie.scope,Ie)}}}if(oe.running&&!g(je.value&&je.value.compute)){const Ie=typeof oe.running=="string"?{kind:oe.running}:oe.running,We=Ie.of||oe.field||He;je.value={...je.value||{},deps:[We],pure:!1,compute:(Ye,nt)=>{const Qe=nt.grid&&nt.grid.statistics;if(!Qe||!g(Qe.running))return null;const dt=nt.row&&nt.row.key||Qe.keyOf(nt.data);return dt?Qe.running(We,Ie.kind||"total",dt):null}},oe.sort===void 0&&(je.sort={...je.sort||{},enabled:!1})}const Me=oe.field??(g(je.value&&je.value.compute)?null:oe.id??null),Re=g(je.value&&je.value.compute),Ee={id:He,field:Me,shadow:oe.shadow||null,running:oe.running||null,spec:oe.spec||null,validation:oe.validation||null,volatile:!!(oe.shadow||oe.running),title:je.title??b(Me||He),type:Ae.name,dataType:Ae,itemType:Te,nullable:je.nullable!==!1,align:R(ae.cell&&ae.cell.align||ae.align||je.cell&&je.cell.align||je.align||Ae.defaults&&Ae.defaults.align)||"start",verticalAlign:x(ae.cell&&ae.cell.verticalAlign||ae.verticalAlign||je.cell&&je.cell.verticalAlign||je.verticalAlign)||this.#c,rowSpan:g(je.rowSpan)?je.rowSpan:null,colSpan:g(je.colSpan)?je.colSpan:null,value:{pure:!0,...je.value||{}},cell:{...je.cell||{}},edit:{...je.edit||{}},sort:{...je.sort||{}},filter:{...je.filter||{}},group:{enabled:!1,index:-1,explode:!1,...je.group||{}},pivot:{enabled:!1,index:-1,...je.pivot||{}},total:this.#u(je.total,Ae,oe.id||oe.field||"(unnamed)"),groupTotal:je.groupTotal===void 0?null:this.#u(je.groupTotal,Ae,oe.id||oe.field||"(unnamed)"),grandTotal:je.grandTotal===void 0?null:this.#u(je.grandTotal,Ae,oe.id||oe.field||"(unnamed)"),tags:ie(je.tags),typeOptions:je.typeOptions??null,...o(je[ke])?{[ke]:je[ke]}:{},layout:J(je.layout,ae),header:{...je.header||{}},contextMenu:je.contextMenu===void 0?null:je.contextMenu,facet:{...je.facet||{}},export:{...je.export||{}},allowGroup:je.allowGroup!==!1,allowPivot:je.allowPivot!==!1,allowTotal:je.allowTotal!==!1,quickFilter:je.quickFilter!==!1,def:oe,format:je.format,presets:se,inferred:he!=null&&!oe.type,computed:Re,diff:oe.diff===void 0?void 0:!!oe.diff,read:Me?F(Me):null,write:Me?j(Me):null};Ee.cell.align=R(ae.cell&&ae.cell.align)||Ee.align,Ee.header.align=R(ae.header&&ae.header.align)||Ee.align;const $e=je.lookup||null;return Ee.lookup=$e?k({id:He,lookup:$e},{locale:this.#o,onChange:()=>{this.#w&&this.#w("lookup",{colId:He})}}):null,Ee.group.explode&&Ee.lookup&&Ee.lookup.multiple&&H(`explode:${He}`,`column "${He}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(Ee),Ee}#v(oe){oe.formatter=i(oe.format,oe.dataType,this.#o,this.#l,oe.id),oe.formatValue=G(oe,{locale:this.#o,grid:this.#h,context:this.#p}),oe.itemCompare=oe.itemType?m(oe.itemType,this.#o):null,oe.compare=g(oe.value.compare)?oe.value.compare:oe.lookup?oe.lookup.comparator():g(oe.dataType.compareFor)?oe.dataType.compareFor(oe):m(oe.dataType,this.#o),oe.excel=oe.formatter&&oe.formatter.ooxml||oe.dataType&&oe.dataType.excel||"General",oe.storeKind=a(oe.dataType,!!(oe.lookup&&oe.lookup.multiple))}#C(oe,he,ae){let se=o(oe.typeOptions)?oe.typeOptions:null;for(let Te=he.length-1;!se&&Te>=0;Te--)o(he[Te].typeOptions)&&(se=he[Te].typeOptions);!se&&o(this.#i.typeOptions)&&(se=this.#i.typeOptions);const de=se&&se.of!==void 0?se.of:"text",ke=typeof de=="string"?this.#s.get(de):void 0;return ke&&!g(ke.items)&&ke.storage!=="object"?ke:(H(`type:of:${String(de)}`,`column "${ae}" names "${String(de)}" as its item type (typeOptions.of), which is not ${ke?"a scalar data type":"a known data type"}; its items are read as text.`),this.#s.get("text"))}#S(oe,he,ae){if(oe.type===!1)return"text";if(oe.type)return oe.type;for(let se=he.length-1;se>=0;se--)if(he[se].type)return he[se].type;if(this.#i.type)return this.#i.type;if(oe.shadow){const se=typeof oe.shadow=="string"?oe.shadow:oe.shadow.kind;if(se==="fitInfluence")return"boolean";if(se==="fitPredicted"||se==="fitResidual"||se==="fitStdResidual"||se==="fitLeverage"||se==="fitCooksD"||se==="tsTrend"||se==="tsSeasonal"||se==="tsResidual"||se==="tsCoverage"||se==="tsSmoothed"||se==="tsSmoothingAlpha"||se==="tsSmoothingBeta"||se==="cluster"||se==="clusterDistance")return"number"}return ae||(oe.lookup?"lookup":"text")}#P(oe){const he=this.all();this.#m=d(he),this.#g?this.#g.setGraph(this.#m):this.#g=new K({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:oe||null,rowKey:this.#b});const ae=this.#g;for(const se of he)se.getValue=(de,ke)=>ae.value(se,de,ke)}all(){return this.#t.map(oe=>this.#e.get(oe))}visible(){return this.all().filter(oe=>!oe.layout.hidden)}get(oe){return this.#e.get(oe)}groups(){const oe=he=>{const ae=[];for(const se of he)Array.isArray(se.columns)?ae.push({...se,columns:oe(se.columns)}):se.column&&ae.push(se.column);return ae};return oe(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#s}affectedBy(oe){return f(this.#m,oe)}value(oe,he,ae){return this.#g.value(oe,he,ae)}text(oe,he,ae){return this.#g.text(oe,he,ae)}checkImpure(oe,he){q(this.#e.get(oe),he)}setLocale(oe){this.#o=oe;for(const he of this.all())he.lookup&&he.lookup.setLocale(oe),this.#v(he);this.#w&&this.#w("locale",{locale:oe})}infer(oe){const he={};if(this.#y||!Array.isArray(oe)||oe.length===0)return he;this.#y=!0;let ae=!1;for(const se of this.all()){const de=se.def;if(de.type!==void 0||!se.field||se.computed||se.lookup||this.#E(se))continue;const ke=se.read||(je=>X(je,se.field)),Ae=h(se.id,oe,ke,this.#s,{sampleSize:this.#O});if(Ae===se.type)continue;he[se.id]=Ae;const Te=this.#A(de,Ae);Te.groupPath=se.groupPath,Te.layout={...Te.layout,...me(se.layout)},this.#e.set(se.id,Te),_e(this.#n,se.id,Te),ae=!0}return ae&&this.#P(null),he}redecorate(oe,he,ae={}){const se=this.#e.get(oe);if(!se){H(`redecorate:${oe}`,`columns.decorate('${oe}', …): no column with id '${oe}'.`);return}const de=se.def||{},ke={...o(de.cell)?de.cell:{}};ke.decoration=he??void 0,ae&&"variant"in ae&&(ke.variant=ae.variant);const Ae={...de,cell:ke};this.#r.has(de)&&this.#r.set(Ae,this.#r.get(de));const Te=this.#A(Ae,se.type);return Te.groupPath=se.groupPath,Te.layout={...Te.layout,...me(se.layout)},se.lookup&&se.lookup!==Te.lookup&&g(se.lookup.destroy)&&se.lookup.destroy(),this.#e.set(oe,Te),_e(this.#n,oe,Te),this.#P(null),this.#w&&this.#w("decorate",{colId:oe}),Te}destroy(){for(const oe of this.#e.values())oe.lookup&&g(oe.lookup.destroy)&&oe.lookup.destroy()}#E(oe){for(const he of oe.presets){const ae=this.#a[he];if(ae&&ae.type)return!0}return!!this.#i.type}#T(oe){return!oe.computed&&g(oe.dataType&&oe.dataType.toStorage)}storeReader(oe){if(oe.computed)return he=>this.#g.value(oe,he,null);if(this.#T(oe)){const he=oe.dataType.toStorage,ae=oe.format&&typeof oe.format=="object"&&!Array.isArray(oe.format)?oe.format.locale:void 0,se={timeZone:this.#l,colId:oe.id,itemType:oe.itemType||null,locale:ae||this.#o};return de=>he(oe.read(de),se)}return oe.read}storeValue(oe,he){if(!(!oe||oe.computed)&&g(oe.read))return this.storeReader(oe)(he)}storeSchema(){const oe=[];for(const he of this.all()){if(he.computed&&he.value.pure===!1||!he.computed&&!he.field)continue;const ae=this.storeReader(he);let se=null;!he.computed&&!this.#T(he)&&typeof he.field=="string"&&!he.lookup&&(se=he.field);const de={id:he.id,kind:he.storeKind,nullable:he.nullable,read:ae};se!==null&&(de.field=se),he.lookup&&(de.dictionary=he.lookup.dictionary()),oe.push(de)}return oe}state(){return this.all().map(oe=>({id:oe.id,width:oe.layout.width,flex:oe.layout.flex||void 0,hidden:!!oe.layout.hidden,headerWrap:oe.header?.wrap===!0?!0:void 0,headerOrientation:oe.header?.orientation==="vertical"?"vertical":void 0,pin:oe.layout.pin??null,sort:oe.sort.direction??null,sortIndex:oe.sort.direction?oe.sort.order??0:null,groupIndex:oe.group.enabled?oe.group.index??0:null,pivotIndex:oe.pivot.enabled?oe.pivot.index??0:null,total:typeof oe.total=="string"?oe.total:null,groupTotal:typeof oe.groupTotal=="string"?oe.groupTotal:void 0,grandTotal:typeof oe.grandTotal=="string"?oe.grandTotal:void 0,decoration:oe.cell&&oe.cell.decoration!=null?Ce(oe.cell.decoration):void 0,variant:oe.cell&&oe.cell.variant!=null?Ce(oe.cell.variant):void 0}))}applyState(oe,he={}){const ae={applied:[],skipped:[]},se=Array.isArray(oe)?oe:oe&&oe.columns||[],de=!Array.isArray(oe)&&oe&&oe.columnOrder||null;for(const Ae of se){if(!Ae||!Ae.id){ae.skipped.push({key:"?",reason:"no id"});continue}let Te=this.#e.get(Ae.id);if(!Te){ae.skipped.push({key:Ae.id,reason:"unknown column"});continue}if(Object.hasOwn(Ae,"decoration")||Object.hasOwn(Ae,"variant")){const je=Te.cell?Te.cell.decoration:void 0,ye=Ae.decoration??null,He=Object.hasOwn(Ae,"variant"),Me=He&&!Pe(Te.cell?Te.cell.variant:void 0,Ae.variant);(!Pe(je,ye)||Me)&&(this.redecorate(Ae.id,ye,He?{variant:Ae.variant??void 0}:{}),Te=this.#e.get(Ae.id)||Te)}Ae.width!=null&&(Te.layout.width=Ae.width),Ae.flex!=null&&(Te.layout.flex=Ae.flex),Ae.hidden!=null&&(Te.layout.hidden=!!Ae.hidden),Ae.headerWrap!==void 0&&(Te.header.wrap=!!Ae.headerWrap),Ae.headerOrientation!==void 0&&(Te.header.orientation=Ae.headerOrientation==="vertical"?"vertical":"horizontal"),Ae.pin!==void 0&&(Te.layout.pin=Ae.pin),Ae.sort!==void 0&&(Te.sort.direction=Ae.sort),Ae.sortIndex!=null&&(Te.sort.order=Ae.sortIndex),Ae.groupIndex!=null&&(Te.group.enabled=!0,Te.group.index=Ae.groupIndex),Ae.pivotIndex!=null&&(Te.pivot.enabled=!0,Te.pivot.index=Ae.pivotIndex),Ae.total!==void 0&&(Te.total=Ae.total),Ae.groupTotal!==void 0&&(Te.groupTotal=Ae.groupTotal),Ae.grandTotal!==void 0&&(Te.grandTotal=Ae.grandTotal),ae.applied.push(Ae.id)}const ke=de||(he&&he.keepOrder?[]:se.map(Ae=>Ae&&Ae.id).filter(Boolean));if(ke.length){const Ae=ke.filter(je=>this.#e.has(je)),Te=this.#t.filter(je=>!Ae.includes(je));this.#t=[...Ae,...Te]}return this.#w&&this.#w("state",ae),ae}move(oe,he){this.#M(oe,he)&&(this.#R(),this.#w&&this.#w("move",{id:oe,to:he}))}reorder(oe){const he={applied:[],skipped:[]},ae=[];let se=0;for(const de of Array.isArray(oe)?oe:[]){const ke=se++;this.#M(de,ke)&&(he.applied.push(de),ae.push({id:de,to:ke}))}if(!ae.length)return he;if(this.#R(),this.#w)for(const de of ae)this.#w("move",de);return he}#M(oe,he){const ae=this.#t.indexOf(oe);if(ae===-1||Math.max(0,Math.min(Number(he)||0,this.#t.length-1))===ae)return!1;const de=this.#e.get(oe);if(de.layout.movable===!1||de.layout.lockPosition)return H(`move:${oe}`,`column "${oe}" is not movable; the move was ignored`),!1;const ke=this.#N(oe,he);return ke?(H(`move.married:${ke}`,`band "${ke}" declares marryChildren, so its columns stay together; the move was ignored`),!1):(this.#t.splice(ae,1),this.#t.splice(Math.max(0,Math.min(he,this.#t.length)),0,oe),!0)}#N(oe,he){if(!this.#n||!this.#n.length)return null;const ae=this.#t.filter(Ae=>Ae!==oe),se=Math.max(0,Math.min(he,ae.length)),de=(Ae,Te)=>{if(Array.isArray(Ae.columns)){for(const ye of Ae.columns)de(ye,Te);return Te}const je=Ae.column?Ae.column.id:Ae.id;return je&&Te.push(je),Te},ke=Ae=>{for(const Te of Ae){if(!Array.isArray(Te.columns))continue;if(Te.marryChildren===!0){const ye=de(Te,[]),He=ye.includes(oe),Me=ye.map(Re=>ae.indexOf(Re)).filter(Re=>Re>=0);if(Me.length){const Re=Math.min(...Me),Ee=Math.max(...Me);if(He?se<Re||se>Ee+1:se>Re&&se<=Ee)return Te.id}}const je=ke(Te.columns);if(je)return je}return null};return ke(this.#n)}#R(){const oe=new Map(this.#t.map((se,de)=>[se,de])),he=se=>{if(!Array.isArray(se.columns)){const ke=se.column?se.column.id:se.id;return oe.has(ke)?oe.get(ke):1/0}let de=1/0;for(const ke of se.columns)de=Math.min(de,he(ke));return de},ae=se=>{se.sort((de,ke)=>he(de)-he(ke));for(const de of se)Array.isArray(de.columns)&&ae(de.columns)};ae(this.#n)}#I(oe){const he=ae=>{for(let se=0;se<ae.length;se++){const de=ae[se];if(Array.isArray(de.columns)){const ke=he(de.columns);if(ke)return ke}else if(de.column&&de.column.id===oe)return ae.splice(se,1)[0]}return null};return he(this.#n)}#K(oe){const he=[];for(let ae=oe.length-1;ae>=0;ae--){const se=oe[ae];Array.isArray(se.columns)&&(he.push(...this.#K(se.columns)),se.columns.length===0&&(he.push(se.id),oe.splice(ae,1)))}return he}#Y(){const oe=(he,ae,se)=>{for(const de of he)Array.isArray(de.columns)?oe(de.columns,[...ae,de.id]):de.column&&(de.column.groupPath=ae)};oe(this.#n,[])}#x(oe){const he=new Set(oe),ae=this.#t.filter(Ae=>he.has(Ae));if(!ae.length)return;const se=Math.min(...ae.map(Ae=>this.#t.indexOf(Ae))),de=this.#t.slice(0,se).filter(Ae=>!he.has(Ae)),ke=this.#t.slice(se).filter(Ae=>!he.has(Ae));this.#t=[...de,...ae,...ke]}#U(oe){const he=[],ae=se=>{if(Array.isArray(se.columns))for(const de of se.columns)ae(de);else se.column&&he.push(se.column.id)};return ae(oe),he}#D(oe){const he=ae=>{for(const se of ae){if(!Array.isArray(se.columns))continue;if(se.id===oe)return{node:se,parent:ae};const de=he(se.columns);if(de)return de}return null};return he(this.#n)}groupColumns(oe,he={}){const ae=I(oe).filter(Te=>this.#e.has(Te));if(!ae.length)return H("columns.group.empty","groupColumns was given no known column ids; nothing was grouped."),null;for(const Te of ae)if(this.#e.get(Te).layout.lockPosition)return H(`columns.group.locked:${Te}`,`column "${Te}" is position-locked and cannot be grouped.`),null;const se=he.groupId?this.#D(he.groupId):null;if(he.groupId&&!se)return H(`columns.group.unknown:${he.groupId}`,`no band "${he.groupId}" to add to; nothing was grouped.`),null;let de=null;if(!se&&he.id!=null&&(de=String(he.id),this.#D(de)||this.#e.has(de)))return H(`columns.group.idtaken:${de}`,`band id "${de}" is already in use; nothing was grouped.`),null;const ke=ae.map(Te=>this.#I(Te)).filter(Boolean);if(!ke.length)return null;let Ae;if(se)se.node.columns.push(...ke),Ae=se.node.id;else{const Te={id:de||s("grp"),title:he.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:ke},je=Number.isInteger(he.at)?Math.max(0,Math.min(he.at,this.#n.length)):this.#n.length;this.#n.splice(je,0,Te),Ae=Te.id}return this.#K(this.#n),this.#x(ae),this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"formed",groupId:Ae,ids:ae}),Ae}ungroupColumn(oe){const he=this.#e.get(oe);if(!he){H(`columns.ungroup.unknown:${oe}`,`no column "${oe}" to ungroup.`);return}const ae=he.groupPath||[];if(!ae.length)return;const se=ae[ae.length-1],de=this.#D(se);if(!de)return;const ke=this.#I(oe);if(!ke)return;const Ae=de.parent.indexOf(de.node);de.parent.splice(Ae+1,0,ke);const Te=this.#K(this.#n),je=this.#U(de.node);if(je.length){this.#x(je);const ye=Math.max(...je.map(Me=>this.#t.indexOf(Me))),He=this.#t.filter(Me=>Me!==oe);He.splice(ye+1,0,oe),this.#t=He}this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"removed",id:oe,dissolved:Te})}renameGroup(oe,he){const ae=this.#D(oe);if(!ae){H(`columns.group.rename:${oe}`,`no band "${oe}" to rename.`);return}ae.node.title=String(he??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:oe,title:ae.node.title})}dissolveGroup(oe){const he=this.#D(oe);if(!he){H(`columns.group.dissolve:${oe}`,`no band "${oe}" to dissolve.`);return}const ae=he.parent.indexOf(he.node);he.parent.splice(ae,1,...he.node.columns),this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:oe})}moveGroup(oe,he){const ae=this.#D(oe);if(!ae){H(`columns.group.move:${oe}`,`no band "${oe}" to move.`);return}const se=ae.parent,de=se.indexOf(ae.node);de!==-1&&(se.splice(de,1),se.splice(Math.max(0,Math.min(he,se.length)),0,ae.node),this.#X(),this.#Y(),this.#w&&this.#w("columngroup",{action:"moved",groupId:oe,to:he}))}#X(){const oe=[],he=se=>{for(const de of se)Array.isArray(de.columns)?he(de.columns):de.column&&oe.push(de.column.id)};he(this.#n);const ae=new Set(oe);this.#t=[...oe,...this.#t.filter(se=>!ae.has(se))]}groupTree(){const oe=ae=>ae.map(se=>Array.isArray(se.columns)?{id:se.id,title:se.title||"",collapsible:!!se.collapsible,openByDefault:se.openByDefault!==!1,columns:oe(se.columns)}:se.column?se.column.id:null).filter(se=>se!==null),he=oe(this.#n);return he.some(ae=>ae&&typeof ae=="object")?he:[]}applyGroupTree(oe){if(!Array.isArray(oe))return;const he=new Set,ae=de=>{const ke=[];for(const Ae of de)if(Ae&&typeof Ae=="object"&&Array.isArray(Ae.columns)){const Te=ae(Ae.columns);if(!Te.length)continue;ke.push({id:Ae.id||s("grp"),title:Ae.title||"",collapsible:Ae.collapsible===!0,openByDefault:Ae.openByDefault!==!1,showWhen:"always",marryChildren:!1,header:{},def:{},columns:Te})}else if(typeof Ae=="string"){const Te=this.#e.get(Ae);Te&&!he.has(Ae)&&(he.add(Ae),ke.push({column:Te,path:[]}))}return ke},se=ae(oe);for(const de of this.#t){if(he.has(de))continue;const ke=this.#e.get(de);ke&&se.push({column:ke,path:[]})}this.#n=se,this.#Y(),this.#R(),this.#w&&this.#w("columngroup",{action:"applied"})}show(oe){this.#V(oe,!1)}hide(oe){this.#V(oe,!0)}#V(oe,he){const ae=[];for(const se of I(oe)){const de=this.#e.get(se);if(de){if(he&&de.layout.lockVisible){H(`lockVisible:${se}`,`column "${se}" is \`layout.lockVisible\` and cannot be hidden`);continue}de.layout.hidden!==he&&(de.layout.hidden=he,ae.push(se))}}ae.length&&this.#w&&this.#w("visible",{ids:ae,hidden:he})}pin(oe,he){const ae=this.#e.get(oe);ae&&(ae.layout.pin=he??null,this.#w&&this.#w("pin",{id:oe,side:ae.layout.pin}))}pinMany(oe){const he={};for(const[se,de]of oe){const ke=this.#e.get(se);ke&&(ke.layout.pin=de??null,he[se]=ke.layout.pin)}const ae=Object.keys(he);ae.length&&this.#w&&this.#w("pin",{ids:ae,pins:he})}#_(oe,he){const ae=oe.layout.min??0,se=oe.layout.max;let de=Math.max(ae,he);return se!=null&&(de=Math.min(se,de)),oe.layout.width=de,oe.layout.flex=0,de}resize(oe,he){const ae=this.#e.get(oe);if(!ae)return;if(ae.layout.resizable===!1){H(`resize:${oe}`,`column "${oe}" is not resizable; the resize was ignored`);return}const se=this.#_(ae,he);this.#w&&this.#w("resize",{id:oe,width:se})}resizeMany(oe){const he={};for(const[se,de]of oe){const ke=this.#e.get(se);if(ke){if(ke.layout.resizable===!1){H(`resize:${se}`,`column "${se}" is not resizable; the resize was ignored`);continue}he[se]=this.#_(ke,de)}}const ae=Object.keys(he);ae.length&&this.#w&&this.#w("resize",{ids:ae,widths:he})}}function me(ve){const oe={};return ve.width!=null&&(oe.width=ve.width),ve.hidden!=null&&(oe.hidden=ve.hidden),ve.pin!==void 0&&(oe.pin=ve.pin),oe}function Ce(ve){if(ve===null||typeof ve!="object")return ve;try{return structuredClone(ve)}catch{}try{return JSON.parse(JSON.stringify(ve))}catch{return ve}}function Pe(ve,oe){const he=ve??null,ae=oe??null;if(he===ae)return!0;if(he===null||ae===null)return!1;if(typeof he!="object"||typeof ae!="object")return he===ae;try{return JSON.stringify(he)===JSON.stringify(ae)}catch{return!1}}function xe(ve){const oe=[],he=(se,de,ke)=>{const Ae=[];for(const Te of se){if(!o(Te)){Q("a column definition must be an object");continue}if(Array.isArray(Te.columns)){W(Te,ee,"columnGroup",Te.title||Te.id||"(unnamed)");const je={id:Te.id||s("grp"),title:Te.title||"",collapsible:Te.collapsible===!0,openByDefault:Te.openByDefault!==!1,showWhen:Te.showWhen||"always",marryChildren:Te.marryChildren===!0,header:Te.header||{},def:Te,columns:[]};je.columns=he(Te.columns,[...de,je.id],Te.facet!==void 0?Te.facet:ke),Ae.push(je)}else{const je={def:Te,path:de,facet:ke};oe.push(je),Ae.push(je)}}return Ae},ae=he(ve,[],void 0);return{leaves:oe,groups:ae}}function _e(ve,oe,he){for(const ae of ve){if(ae.columns){if(_e(ae.columns,oe,he))return!0;continue}if(ae.column&&ae.column.id===oe)return ae.column=he,!0}return!1}}),Ve("packages/core/src/columns/autogroup.js",function(e,D){"use strict";Object.defineProperty(e,"AUTO_GROUP_ID",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"createAutoGroupColumn",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"warnOnAbsurdGrouping",{enumerable:!0,get:function(){return X}});const A=D("packages/core/src/internal/warn.js").warnOnce,Y="__lattice_group",I=240,L=.5;function Q(F){const j=F.def&&F.def.layout;return(typeof j=="number"||j&&j.width!=null||F.def&&F.def.width!=null)&&Number.isFinite(F.layout.width)?F.layout.width:null}function H(F){const j=F.def&&F.def.layout;return!!(j&&j.min!=null)||F.def&&F.def.minWidth!=null}function $(F){const{columns:j,groupBy:v}=F,b=v.map(r=>j.get(r)).filter(Boolean),l=b.length?b.map(r=>r.title||r.id).join(" > "):"Group",g=b.find(r=>Q(r)!=null),o=F.config&&F.config.autoGroupColumnWidth||(g?Q(g):I);let t=g&&H(g)?g.layout.min:120;g&&!H(g)&&(t=Math.min(t,o));const s=g&&g.layout.max!=null?g.layout.max:null;return{id:Y,field:null,title:l,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group"},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!0},groupedIds:v.slice(),group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:o,min:t,max:s,pin:F.config&&F.config.autoGroupColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(r,i){return i&&i.group?i.groupValue:null},formatValue(r,i){if(!i||!i.group)return"";if(i.grandTotal)return F.config&&F.config.grandTotalLabel||"Total";const n=b[Math.min(i.level||0,b.length-1)];return n&&typeof n.formatValue=="function"?n.formatValue(r,i):r==null?"":String(r)}}}function X(F,j,v){!F.length||v<100||j<v*L||A(`grouping.cardinality:${F.join(",")}`,`grouping by ${F.join(", ")} produced ${j} groups for ${v} 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.`)}}),Ve("packages/core/src/columns/selectcolumn.js",function(e,D){"use strict";Object.defineProperty(e,"SELECT_COLUMN_ID",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"createSelectionColumn",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return I}});const re="__lattice_select",A=44;function Y(L){const Q=L.selection||{},H=L.config&&L.config.selectionColumnWidth||A;return{id:re,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:H,min:H,max:H,pin:L.config&&L.config.selectionColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,headerCheckbox:Q.headerCheckbox===!0,def:{},getValue($,X){return X?X.selected:!1},formatValue(){return""}}}const I=Y}),Ve("packages/core/src/columns/rownumbercolumn.js",function(e,D){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"createRowNumberColumn",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return X}});const A=D("packages/core/src/internal/predicates.js").isFunction,Y="__lattice_rownumber",I=40,L=9,Q=22;function H(F){const j=String(Math.max(1,Math.trunc(Math.abs(F))||1)).length;return Math.max(I,j*L+Q)}function $(F){const j=F.rowNumbers,v=j&&typeof j=="object"?j:{},b=Number.isFinite(v.start)?v.start:1,l=Number.isFinite(v.width)?v.width:H((F.maxNumber||0)+b),g=A(F.rank)?F.rank:()=>null;return{id:Y,field:null,title:typeof v.title=="string"?v.title:"",type:"number",dataType:{base:"number"},nullable:!0,align:"end",generated:!0,control:!0,value:{pure:!0},cell:{align:"end"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:l,min:l,max:l,pin:"start",hidden:!1,resizable:v.width==null,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(o,t){const s=g(t);return s==null?null:s-1+b},formatValue(o){return o==null?"":String(o)}}}const X=$}),Ve("packages/core/src/model/detail.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_DETAIL_HEIGHT",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"DEFAULT_CACHE_LIMIT",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"DetailModel",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return X}});const A=D("packages/core/src/internal/predicates.js").isFunction,I=D("packages/core/src/internal/warn.js").warnOnce,L=240,Q=10;function H(F){if(!F)return null;const j=F===!0?{}:F;return j.enabled===!1?null:!A(j.rows)&&!j.render?(I("detail.rows","detail is enabled but neither `rows` nor `render` was supplied; expanding a master would show an empty region, so it stays off."),null):{render:j.render||null,config:j.config||null,rows:A(j.rows)?j.rows:null,height:j.height??L,maxHeight:j.maxHeight??null,cacheLimit:Number.isFinite(j.cacheLimit)?Math.max(0,j.cacheLimit):Q,isMaster:A(j.isMaster)?j.isMaster:null,target:j.target||null,onCreate:A(j.onCreate)?j.onCreate:null,path:typeof j.path=="string"?j.path:null}}class ${#e;#t=new Set;#n;#r=0;constructor(j){this.#e=j.config,this.#n=A(j.onChange)?j.onChange:()=>{}}get config(){return this.#e}get inline(){return!this.#e.target}isMaster(j){if(!j||j.group||j.detail)return!1;const v=this.#e.isMaster;return v?!!v(j.data,j):!0}isOpen(j){return this.#t.has(j)}keys(){return[...this.#t]}activeKey(){for(const j of this.#t)return j;return null}heightOf(j){const v=this.#e.height;return A(v)?Number(v(j))||L:v==="auto"?L:Number(v)||L}open(j){return this.#t.has(j)?!1:(this.inline||this.#t.clear(),this.#t.add(j),this.#s(),!0)}close(j){return this.#t.delete(j)?(this.#s(),!0):!1}toggle(j){return this.#t.has(j)?(this.close(j),!1):(this.open(j),!0)}closeAll(){this.#t.size&&(this.#t.clear(),this.#s())}prune(j){if(!this.#t.size||!A(j))return;let v=!1;for(const b of[...this.#t])j(b)||(this.#t.delete(b),v=!0);v&&this.#s()}signature(){return`${this.#r}`}set(j){this.#t.clear();const v=Array.isArray(j)?j:[];for(const b of this.inline?v:v.slice(0,1))this.#t.add(b);this.#s()}#s(){this.#r++,this.#n()}}const X=$}),Ve("packages/core/src/compute/special.js",function(e,D){"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 H}}),Object.defineProperty(e,"normalCdf",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"studentT",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"chiSquareUpperTail",{enumerable:!0,get:function(){return o}});const re=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),A=3e-12,Y=1e-300;function I(t){if(t<.5)return Math.log(Math.PI/Math.sin(Math.PI*t))-I(1-t);const s=t-1;let r=.9999999999998099;const i=s+7.5;for(let n=0;n<re.length;n++)r+=re[n]/(s+n+1);return .5*Math.log(2*Math.PI)+(s+.5)*Math.log(i)-i+Math.log(r)}function L(t,s,r){const i=t+s,n=t+1,m=t-1;let c=1,a=1-i*r/n;Math.abs(a)<Y&&(a=Y),a=1/a;let u=a;for(let h=1;h<=300;h++){const p=2*h;let y=h*(s-h)*r/((m+p)*(t+p));a=1+y*a,Math.abs(a)<Y&&(a=Y),c=1+y/c,Math.abs(c)<Y&&(c=Y),a=1/a,u*=a*c,y=-(t+h)*(i+h)*r/((t+p)*(n+p)),a=1+y*a,Math.abs(a)<Y&&(a=Y),c=1+y/c,Math.abs(c)<Y&&(c=Y),a=1/a;const d=a*c;if(u*=d,Math.abs(d-1)<A)break}return u}function Q(t,s,r){if(!(t>0)||!(s>0)||!Number.isFinite(r))return Number.NaN;if(r<=0)return 0;if(r>=1)return 1;const i=Math.exp(I(t+s)-I(t)-I(s)+t*Math.log(r)+s*Math.log(1-r));return r<(t+1)/(t+s+2)?i*L(t,s,r)/t:1-i*L(s,t,1-r)/s}function H(t){if(!(t>0)||!(t<1))return t===0?-1/0:t===1?1/0:Number.NaN;const s=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],r=[-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,a,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,a=c*c,u=(((((s[0]*a+s[1])*a+s[2])*a+s[3])*a+s[4])*a+s[5])*c/(((((r[0]*a+r[1])*a+r[2])*a+r[3])*a+r[4])*a+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*$(-u/Math.SQRT2)-t)*Math.sqrt(2*Math.PI)*Math.exp(u*u/2);return u-p/(1+u*p/2)}function $(t){const s=Math.abs(t),r=2/(2+s),i=4*r-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,a;for(let h=n.length-1;h>0;h--)a=c,c=i*c-m+n[h],m=a;const u=r*Math.exp(-s*s+.5*(n[0]+i*c)-m);return t>=0?u:2-u}function X(t){return .5*$(-t/Math.SQRT2)}function F(t,s){if(!(s>0)||!Number.isFinite(t))return Number.NaN;const r=.5*Q(s/2,.5,s/(s+t*t));return t>0?1-r:r}function j(t,s){if(!(t>0)||!(t<1)||!(s>0))return Number.NaN;if(s>1e7)return H(t);let r=-1e4,i=1e4,n=H(t);const m=I(s/2)+I(.5)-I((s+1)/2);for(let c=0;c<60;c++){const a=F(n,s);a<t?r=n:i=n;const u=Math.exp(-((s+1)/2)*Math.log(1+n*n/s)-m)/Math.sqrt(s),h=u>0?(a-t)/u:0;if(Math.abs(h)<1e-12)break;const p=n-h;if(n=p>r&&p<i&&Number.isFinite(p)?p:(r+i)/2,i-r<1e-12)break}return n}function v(t,s){let r=t,i=1/t,n=i;for(let m=0;m<300&&(r+=1,n*=s/r,i+=n,!(Math.abs(n)<Math.abs(i)*A));m++);return i*Math.exp(-s+t*Math.log(s)-I(t))}function b(t,s){let r=s+1-t,i=1/Y,n=1/r,m=n;for(let c=1;c<=300;c++){const a=-c*(c-t);r+=2,n=a*n+r,Math.abs(n)<Y&&(n=Y),i=r+a/i,Math.abs(i)<Y&&(i=Y),n=1/n;const u=n*i;if(m*=u,Math.abs(u-1)<A)break}return Math.exp(-s+t*Math.log(s)-I(t))*m}function l(t,s){return!(t>0)||!(s>=0)||!Number.isFinite(s)?Number.NaN:s===0?0:s<t+1?v(t,s):1-b(t,s)}function g(t,s){return s>0?l(s/2,t/2):Number.NaN}function o(t,s){const r=g(t,s);return Number.isNaN(r)?Number.NaN:Math.min(1,Math.max(0,1-r))}}),Ve("packages/core/src/compute/linalg.js",function(e,D){"use strict";Object.defineProperty(e,"cholesky",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"choleskySolve",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"choleskyInverse",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"normalEquations",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return Q}});function re(H){const $=H.length,X=Array.from({length:$},()=>new Array($).fill(0));for(let F=0;F<$;F++)for(let j=0;j<=F;j++){let v=H[F][j];for(let b=0;b<j;b++)v-=X[F][b]*X[j][b];if(F===j){if(!(v>0))return null;X[F][j]=Math.sqrt(v)}else X[F][j]=v/X[j][j]}return X}function A(H,$){const X=H.length,F=new Array(X).fill(0);for(let v=0;v<X;v++){let b=$[v];for(let l=0;l<v;l++)b-=H[v][l]*F[l];F[v]=b/H[v][v]}const j=new Array(X).fill(0);for(let v=X-1;v>=0;v--){let b=F[v];for(let l=v+1;l<X;l++)b-=H[l][v]*j[l];j[v]=b/H[v][v]}return j}function Y(H){const $=H.length,X=Array.from({length:$},()=>new Array($).fill(0));for(let F=0;F<$;F++){const j=new Array($).fill(0);j[F]=1;const v=A(H,j);for(let b=0;b<$;b++)X[b][F]=v[b]}return X}function I(H,$,X){const F=H.length,j=F?H[0].length:0,v=Array.from({length:j},()=>new Array(j).fill(0)),b=new Array(j).fill(0);for(let l=0;l<F;l++){const g=X?X[l]:1,o=H[l];for(let t=0;t<j;t++){const s=g*o[t];b[t]+=s*$[l];for(let r=t;r<j;r++)v[t][r]+=s*o[r]}}for(let l=0;l<j;l++)for(let g=0;g<l;g++)v[l][g]=v[g][l];return{xtwx:v,xtwy:b}}function L(H,$){return H.map(X=>X.reduce((F,j,v)=>F+j*$[v],0))}function Q(H,$){let X=0;for(let F=0;F<H.length;F++){let j=0;for(let v=0;v<H.length;v++)j+=$[F][v]*H[v];X+=H[F]*j}return X}}),Ve("packages/core/src/compute/sketch.js",function(e,D){"use strict";Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return v}});class re{#e=0;#t=0;#n=0;static get errorBound(){return Object.freeze({kind:"exact",metric:"none",value:0,statement:"mean and variance match a full recompute to float rounding"})}get count(){return this.#e}add(l){if(!Number.isFinite(l))return;this.#e++;const g=l-this.#t;this.#t+=g/this.#e,this.#n+=g*(l-this.#t)}merge(l){if(l.#e===0)return;if(this.#e===0){this.#e=l.#e,this.#t=l.#t,this.#n=l.#n;return}const g=this.#e+l.#e,o=l.#t-this.#t;this.#t+=o*(l.#e/g),this.#n+=l.#n+o*o*(this.#e*l.#e/g),this.#e=g}mean(){return this.#e?this.#t:null}variance(){return this.#e>1?this.#n/(this.#e-1):null}varianceP(){return this.#e?this.#n/this.#e:null}stddev(){const l=this.variance();return l===null?null:Math.sqrt(l)}stddevP(){const l=this.varianceP();return l===null?null:Math.sqrt(l)}}class A{#e=[];#t=0;#n;#r;constructor(l,g=Math.random){if(!(l>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(l),this.#r=g}static get errorBound(){return Object.freeze({kind:"probabilistic",metric:"none",value:0,statement:"uniform sample: each element included with probability capacity/n; sample statistics are unbiased estimators"})}get seen(){return this.#t}get size(){return this.#e.length}add(l){if(!Number.isFinite(l))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(l);return}const g=Math.floor(this.#r()*this.#t);g<this.#n&&(this.#e[g]=l)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let l=0;for(const g of this.#e)l+=g;return l/this.#e.length}quantile(l){const g=this.#e.length;if(!g)return null;const 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,l)),s=Math.floor(t),r=Math.ceil(t);return s===r?o[s]:o[s]+(t-s)*(o[r]-o[s])}}function Y(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),Y(o.getUint32(0)^o.getUint32(4))}const l=typeof b=="string"?b:String(b);let g=2166136261;for(let o=0;o<l.length;o++)g^=l.charCodeAt(o),g=Math.imul(g,16777619);return Y(g)}class L{#e;#t;#n;constructor(l=14){const g=Math.floor(l);if(g<4||g>16)throw new RangeError("HLL precision must be 4..16");this.#e=g,this.#t=1<<g,this.#n=new Uint8Array(this.#t)}static errorBoundFor(l=14){const g=1<<Math.floor(l),o=1.04/Math.sqrt(g);return Object.freeze({kind:"probabilistic",metric:"relative",value:o,statement:`distinct count within ~${(o*100).toFixed(2)}% relative standard error (m=${g} buckets)`})}errorBound(){return L.errorBoundFor(this.#e)}add(l){const g=I(l),o=g&this.#t-1,t=g>>>this.#e|1<<32-this.#e;let s=1,r=t;for(;(r&1)===0;)s++,r>>>=1;s>this.#n[o]&&(this.#n[o]=s)}count(){const l=this.#t,g=32-this.#e,o=new Float64Array(g+2);for(let r=0;r<l;r++)o[this.#n[r]]++;let t=l*$(1-o[g+1]/l);for(let r=g;r>=1;r--)t=.5*(t+o[r]);t+=l*H(o[0]/l);const s=Q*l*l/t;return Math.round(s)}}const Q=.5/Math.log(2);function H(b){if(b===1)return 1/0;let l=1,g=b,o;do b*=b,o=g,g+=b*l,l+=l;while(g!==o);return g}function $(b){if(b===0||b===1)return 0;let l=1,g=1-b,o;do b=Math.sqrt(b),o=g,l*=.5,g-=(1-b)**2*l;while(g!==o);return g/3}class X{#e=new Map;#t;#n=0;constructor(l){if(!(l>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(l)}errorBoundFor(l){const g=l/this.#t;return Object.freeze({kind:"deterministic",metric:"absolute",value:g,statement:`each count overestimates the truth by at most N/m = ${g.toFixed(2)} (N=${l}, m=${this.#t})`})}get seen(){return this.#n}add(l){this.#n++;const g=this.#e.get(l);if(g){g.count++;return}if(this.#e.size<this.#t){this.#e.set(l,{count:1,error:0});return}let o,t=1/0;for(const[s,r]of this.#e)r.count<t&&(t=r.count,o=s);this.#e.delete(o),this.#e.set(l,{count:t+1,error:t})}top(l=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(l)))}}class F{#e;#t=[[]];#n=0;#r;#s;constructor(l=200,g=Math.random){this.#e=Math.max(8,Math.floor(l)),this.#r=g,this.#s=2/3}static errorBoundFor(l=200){const g=1/Math.max(8,Math.floor(l));return Object.freeze({kind:"probabilistic",metric:"rank",value:g,statement:`queried quantile's true rank within ~${(g*100).toFixed(2)}% of N of the requested rank (k=${l})`})}errorBound(){return F.errorBoundFor(this.#e)}get count(){return this.#n}#i(l){const o=this.#t.length-1-l,t=Math.ceil(this.#e*this.#s**o);return Math.max(2,t)}add(l){Number.isFinite(l)&&(this.#n++,this.#t[0].push(l),this.#t[0].length>=this.#i(0)&&this.#a(0))}#a(l){const g=this.#t[l];g.sort((s,r)=>s-r),l+1>=this.#t.length&&this.#t.push([]);const o=this.#t[l+1],t=this.#r()<.5?0:1;for(let s=t;s<g.length;s+=2)o.push(g[s]);this.#t[l]=[];for(let s=0;s<this.#t.length;s++)if(this.#t[s].length>=this.#i(s)){this.#a(s);return}}#l(){const l=[];for(let g=0;g<this.#t.length;g++){const o=1<<g;for(const t of this.#t[g])l.push({v:t,w:o})}return l}quantile(l){const g=this.#l();if(!g.length)return null;g.sort((r,i)=>r.v-i.v);let o=0;for(const r of g)o+=r.w;const t=Math.min(1,Math.max(0,l))*o;let s=0;for(const r of g)if(s+=r.w,s>=t)return r.v;return g[g.length-1].v}rank(l){let g=0;for(let o=0;o<this.#t.length;o++){const t=1<<o;for(const s of this.#t[o])s<=l&&(g+=t)}return g}}const j=Object.freeze({distinct:L.errorBoundFor(14),median:F.errorBoundFor(200),p25:F.errorBoundFor(200),p75:F.errorBoundFor(200),p90:F.errorBoundFor(200),p95:F.errorBoundFor(200),p99:F.errorBoundFor(200),iqr:F.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"})}),v={Welford:re,Reservoir:A,HyperLogLog:L,SpaceSaving:X,KLL:F,hash32:I,SKETCH_BOUNDS:j}}),Ve("packages/core/src/compute/statistics.js",function(e,D){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return r}}),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 h}}),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 d}}),Object.defineProperty(e,"moments",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"quantileSorted",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"quantile",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"STAT_FNS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"modifiedZOutliers",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"jarqueBera",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"weightedQuantile",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"covariance",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"autocorrelations",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(e,"spearman",{enumerable:!0,get:function(){return he}}),Object.defineProperty(e,"kendall",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"seriesStats",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"D2_N2",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"D4_N2",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"movingRanges",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"withinSigma",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return He}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(e,"countOutside",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(e,"histogram",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(e,"DEFAULT_CONFIDENCE",{enumerable:!0,get:function(){return We}}),Object.defineProperty(e,"meanInterval",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(e,"proportionInterval",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(e,"slopeInterval",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(e,"capabilityInterval",{enumerable:!0,get:function(){return jt}}),Object.defineProperty(e,"standardizedMeanDifference",{enumerable:!0,get:function(){return Et}}),Object.defineProperty(e,"normalTotalVariation",{enumerable:!0,get:function(){return it}}),Object.defineProperty(e,"frequencyMap",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(e,"categoricalDistance",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(e,"SUBSET_RELIABILITY_FLOOR",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(e,"compareColumn",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(e,"isNumericColumn",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(e,"populationRead",{enumerable:!0,get:function(){return Je}});const re=D("packages/core/src/compute/handle.js"),A=re.presenceReader,Y=re.valueReader,I=D("packages/core/src/compute/special.js"),L=I.studentTQuantile,Q=I.studentT,H=I.normalQuantile,$=I.normalCdf,X=I.chiSquareUpperTail,F=D("packages/core/src/compute/linalg.js"),j=F.cholesky,v=F.choleskySolve,b=F.choleskyInverse,l=F.normalEquations,g=F.quadForm,t=D("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,s=5e3,r=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 be=le==="sum"||le==="avg"||le==="countValues"||le==="min"||le==="max"?"maintained":Object.prototype.hasOwnProperty.call(r,le)?r[le]:null,Oe=Object.prototype.hasOwnProperty.call(i,le)?i[le]:null;return{stat:le,exact:be,approximate:Oe}}function m(le,be){const Oe=be.length,Le=new Float64Array(Oe);let Fe=0;if(le&&(le.kind==="float64"||le.kind==="int32")){const Se=le.values,Ne=A(le);for(let De=0;De<Oe;De++){const Ue=be[De];if(Ne&&Ne(Ue)!==1)continue;const qe=Se[Ue];Number.isNaN(qe)||(Le[Fe++]=qe)}return Le.subarray(0,Fe)}const pe=Y(le);for(let Se=0;Se<Oe;Se++){const Ne=pe(be[Se]);if(Ne==null||Ne==="")continue;const De=typeof Ne=="number"?Ne:Number(Ne);Number.isFinite(De)&&(Le[Fe++]=De)}return Le.subarray(0,Fe)}function c(le,be){const Oe=new Map,Le=Y(le);let Fe=0;for(let pe=0;pe<be.length;pe++){const Se=Le(be[pe]);if(Se==null||Se===""||typeof Se=="number"&&Number.isNaN(Se))continue;const Ne=typeof Se=="object"?String(Se):Se;Oe.set(Ne,(Oe.get(Ne)||0)+1),Fe++}const ue=[...Oe.values()].sort((pe,Se)=>Se-pe);return{counts:ue,total:Fe,distinct:ue.length}}function a(le){return le.total>0?le.counts.map(be=>be/le.total):[]}function u(le,be){const Oe=c(le,be);if(!Oe.total)return null;let Le=0;for(const Fe of a(Oe))Le+=Fe*Fe;return Le}function h(le,be){const Oe=c(le,be);if(!Oe.total)return null;let Le=0;for(const Fe of a(Oe))Fe>0&&(Le-=Fe*Math.log2(Fe));return Le}function p(le,be){const Oe=c(le,be);if(!Oe.total||Oe.distinct<2)return Oe.total?1:null;let Le=0;for(const Fe of a(Oe))Fe>0&&(Le-=Fe*Math.log2(Fe));return Le/Math.log2(Oe.distinct)}function y(le,be,Oe=3){const Le=c(le,be);if(!Le.total)return null;const Fe=Math.max(1,Math.floor(Oe));let ue=0;for(let pe=0;pe<Math.min(Fe,Le.counts.length);pe++)ue+=Le.counts[pe];return ue/Le.total}function d(le,be){const Oe=m(le,be),Le=Oe.length;if(!Le)return null;const Fe=Oe.slice().sort();if(Fe[0]<0)return null;let ue=0,pe=0;for(let Se=0;Se<Le;Se++)ue+=Fe[Se],pe+=(Se+1)*Fe[Se];return ue===0?0:2*pe/(Le*ue)-(Le+1)/Le}function f(le){let be=0,Oe=0,Le=0;for(let Fe=0;Fe<le.length;Fe++){const ue=le[Fe];be++;const pe=ue-Oe;Oe+=pe/be,Le+=pe*(ue-Oe)}return{n:be,mean:Oe,m2:Le}}function w(le,be){const Oe=le.length;if(!Oe)return NaN;if(Oe===1)return le[0];const Le=(Oe-1)*Math.min(1,Math.max(0,be)),Fe=Math.floor(Le),ue=Math.ceil(Le);return Fe===ue?le[Fe]:le[Fe]+(Le-Fe)*(le[ue]-le[Fe])}function k(le,be){if(!le.length)return NaN;const Oe=le.slice().sort();return w(Oe,be)}function P(le,be){const Oe=Y(le);let Le=0,Fe=0,ue=0;for(let pe=0;pe<be.length;pe++){const Se=Oe(be[pe]);if(Se==null||Se==="")continue;const Ne=String(Se).toUpperCase();Ne==="PASS"?Le++:Ne==="FAIL"?Fe++:Ne==="WARN"&&ue++}return{pass:Le+ue,fail:Fe,warn:ue,judged:Le+ue+Fe}}const G=Object.freeze({hhi:(le,be)=>u(le,be),entropy:(le,be)=>h(le,be),evenness:(le,be)=>p(le,be),top3Share:(le,be)=>y(le,be,3),top10Share:(le,be)=>y(le,be,10),gini:(le,be)=>d(le,be),trimmedMean:(le,be)=>S(m(le,be),.1),winsorizedMean:(le,be)=>C(m(le,be),.1),robustOutliers:(le,be)=>N(m(le,be),3.5),jarqueBera:(le,be)=>O(m(le,be)),variance:(le,be)=>{const{n:Oe,m2:Le}=f(m(le,be));return Oe>1?Le/(Oe-1):null},varianceP:(le,be)=>{const{n:Oe,m2:Le}=f(m(le,be));return Oe>0?Le/Oe:null},stddev:(le,be)=>{const{n:Oe,m2:Le}=f(m(le,be));return Oe>1?Math.sqrt(Le/(Oe-1)):null},stddevP:(le,be)=>{const{n:Oe,m2:Le}=f(m(le,be));return Oe>0?Math.sqrt(Le/Oe):null},median:(le,be)=>{const Oe=m(le,be);return Oe.length?k(Oe,.5):null},percentile:(le,be,Oe)=>{const Le=Oe?Oe.p:void 0;if(typeof Le!="number"||!(Le>=0&&Le<=1))return null;const Fe=m(le,be);return Fe.length?k(Fe,Le):null},p25:(le,be)=>{const Oe=m(le,be);return Oe.length?k(Oe,.25):null},p75:(le,be)=>{const Oe=m(le,be);return Oe.length?k(Oe,.75):null},p90:(le,be)=>{const Oe=m(le,be);return Oe.length?k(Oe,.9):null},p95:(le,be)=>{const Oe=m(le,be);return Oe.length?k(Oe,.95):null},p99:(le,be)=>{const Oe=m(le,be);return Oe.length?k(Oe,.99):null},iqr:(le,be)=>{const Oe=m(le,be);if(!Oe.length)return null;const Le=Oe.slice().sort();return w(Le,.75)-w(Le,.25)},mad:(le,be)=>{const Oe=m(le,be);if(!Oe.length)return null;const Le=k(Oe,.5),Fe=new Float64Array(Oe.length);for(let ue=0;ue<Oe.length;ue++)Fe[ue]=Math.abs(Oe[ue]-Le);return k(Fe,.5)},range:(le,be)=>{const Oe=m(le,be);if(!Oe.length)return null;let Le=1/0,Fe=-1/0;for(let ue=0;ue<Oe.length;ue++)Oe[ue]<Le&&(Le=Oe[ue]),Oe[ue]>Fe&&(Fe=Oe[ue]);return Fe-Le},distinct:(le,be)=>{const Oe=Y(le),Le=new Set;for(let Fe=0;Fe<be.length;Fe++){const ue=Oe(be[Fe]);ue==null||ue===""||Le.add(ue instanceof Date?ue.getTime():ue)}return Le.size},mode:(le,be)=>{const Oe=Y(le),Le=new Map;for(let pe=0;pe<be.length;pe++){const Se=Oe(be[pe]);if(Se==null||Se==="")continue;const Ne=Se instanceof Date?Se.getTime():Se;Le.set(Ne,(Le.get(Ne)||0)+1)}let Fe=null,ue=1;for(const[pe,Se]of Le)Se>ue&&(ue=Se,Fe=pe);return Fe},skewness:(le,be)=>{const Oe=m(le,be),{n:Le,mean:Fe,m2:ue}=f(Oe);if(Le<3||ue<=0)return null;const pe=Math.sqrt(ue/(Le-1));let Se=0;for(let Ne=0;Ne<Oe.length;Ne++)Se+=((Oe[Ne]-Fe)/pe)**3;return Le/((Le-1)*(Le-2))*Se},kurtosis:(le,be)=>{const Oe=m(le,be),{n:Le,mean:Fe,m2:ue}=f(Oe);if(Le<4||ue<=0)return null;const pe=Math.sqrt(ue/(Le-1));let Se=0;for(let Ue=0;Ue<Oe.length;Ue++)Se+=((Oe[Ue]-Fe)/pe)**4;const Ne=Le*(Le+1)/((Le-1)*(Le-2)*(Le-3)),De=3*(Le-1)**2/((Le-2)*(Le-3));return Ne*Se-De},geomean:(le,be)=>{const Oe=m(le,be);if(!Oe.length)return null;let Le=0;for(let Fe=0;Fe<Oe.length;Fe++){if(Oe[Fe]<=0)return null;Le+=Math.log(Oe[Fe])}return Math.exp(Le/Oe.length)},harmean:(le,be)=>{const Oe=m(le,be);if(!Oe.length)return null;let Le=0;for(let Fe=0;Fe<Oe.length;Fe++){if(Oe[Fe]===0)return null;Le+=1/Oe[Fe]}return Oe.length/Le},sumSquares:(le,be)=>{const Oe=m(le,be);let Le=0;for(let Fe=0;Fe<Oe.length;Fe++)Le+=Oe[Fe]*Oe[Fe];return Le},passRate:(le,be)=>{const{pass:Oe,judged:Le}=P(le,be);return Le?Oe/Le:null},failureCount:(le,be)=>P(le,be).fail}),K=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 q(le,be,Oe){const Le=Y(le),Fe=Y(be);let ue=0,pe=0;for(let Se=0;Se<Oe.length;Se++){const Ne=Oe[Se],De=Number(Le(Ne)),Ue=Number(Fe(Ne));!Number.isFinite(De)||!Number.isFinite(Ue)||(ue+=De*Ue,pe+=Ue)}return pe===0?null:ue/pe}function B(le,be,Oe){const Le=Y(le);let Fe=null,ue=Oe?-1/0:1/0;for(let pe=0;pe<be.length;pe++){const Se=be[pe],Ne=Number(Le(Se));Number.isFinite(Ne)&&(Oe?Ne>ue:Ne<ue)&&(ue=Ne,Fe=Se)}return Fe}function E(le,be,Oe){const Le=Y(le),Fe=Y(be);let ue=0,pe=0,Se=0,Ne=0,De=0,Ue=0;for(let at=0;at<Oe.length;at++){const kt=Oe[at],Rt=Number(Le(kt)),At=Number(Fe(kt));!Number.isFinite(Rt)||!Number.isFinite(At)||(ue++,pe+=Rt,Se+=At,Ne+=Rt*Rt,De+=At*At,Ue+=Rt*At)}if(ue<2)return null;const qe=ue*Ue-pe*Se,rt=Math.sqrt((ue*Ne-pe*pe)*(ue*De-Se*Se));if(rt===0)return null;const ut=qe/rt;return Math.max(-1,Math.min(1,ut))}function S(le,be=.1){const Oe=le.length;if(!Oe)return null;const Le=Array.from(le).sort((Se,Ne)=>Se-Ne),Fe=Math.floor(Oe*Math.min(.49,Math.max(0,be))),ue=Le.slice(Fe,Oe-Fe);if(!ue.length)return w(Le,.5);let pe=0;for(const Se of ue)pe+=Se;return pe/ue.length}function C(le,be=.1){const Oe=le.length;if(!Oe)return null;const Le=Array.from(le).sort((Ne,De)=>Ne-De),Fe=Math.floor(Oe*Math.min(.49,Math.max(0,be))),ue=Le[Fe],pe=Le[Oe-1-Fe];let Se=0;for(const Ne of Le)Se+=Math.min(pe,Math.max(ue,Ne));return Se/Oe}function N(le,be=3.5){if(!le.length)return null;const Le=Array.from(le).sort((Ne,De)=>Ne-De),Fe=w(Le,.5),ue=Le.map(Ne=>Math.abs(Ne-Fe)).sort((Ne,De)=>Ne-De),pe=w(ue,.5);if(pe===0)return null;let Se=0;for(const Ne of Le)Math.abs(.6745*(Ne-Fe)/pe)>be&&Se++;return Se}function O(le){const be=le.length;if(be<8)return null;let Oe=0;for(const Ne of le)Oe+=Ne;Oe/=be;let Le=0,Fe=0,ue=0;for(const Ne of le){const De=Ne-Oe;Le+=De*De,Fe+=De*De*De,ue+=De*De*De*De}if(Le/=be,Fe/=be,ue/=be,Le===0)return null;const pe=Fe/Le**1.5,Se=ue/(Le*Le)-3;return be/6*(pe*pe+Se*Se/4)}function T(le,be,Oe){const Le=[];let Fe=0;for(let Ne=0;Ne<le.length;Ne++){const De=Number(le[Ne]),Ue=Number(be[Ne]);!Number.isFinite(De)||!Number.isFinite(Ue)||Ue<=0||(Le.push([De,Ue]),Fe+=Ue)}if(!Le.length||Fe<=0)return null;if(Le.sort((Ne,De)=>Ne[0]-De[0]),Le.length===1)return Le[0][0];const ue=[];let pe=0;for(const[,Ne]of Le)ue.push((pe+Ne/2)/Fe),pe+=Ne;const Se=Math.max(0,Math.min(1,Oe));if(Se<=ue[0])return Le[0][0];if(Se>=ue[ue.length-1])return Le[Le.length-1][0];for(let Ne=1;Ne<ue.length;Ne++){if(Se>ue[Ne])continue;const De=ue[Ne]-ue[Ne-1],Ue=De>0?(Se-ue[Ne-1])/De:0;return Le[Ne-1][0]+(Le[Ne][0]-Le[Ne-1][0])*Ue}return Le[Le.length-1][0]}function R(le,be,Oe){const Le=Y(le),Fe=Y(be),ue=new Float64Array(Oe.length),pe=new Float64Array(Oe.length);let Se=0;for(let Ne=0;Ne<Oe.length;Ne++){const De=Oe[Ne],Ue=Number(Le(De)),qe=Number(Fe(De));!Number.isFinite(Ue)||!Number.isFinite(qe)||(ue[Se]=Ue,pe[Se]=qe,Se++)}return{xs:ue.subarray(0,Se),ys:pe.subarray(0,Se),n:Se}}function x(le,be,Oe,Le=!1){const{xs:Fe,ys:ue,n:pe}=R(le,be,Oe);if(pe<2)return null;let Se=0,Ne=0;for(let Ue=0;Ue<pe;Ue++)Se+=Fe[Ue],Ne+=ue[Ue];Se/=pe,Ne/=pe;let De=0;for(let Ue=0;Ue<pe;Ue++)De+=(Fe[Ue]-Se)*(ue[Ue]-Ne);return De/(Le?pe:pe-1)}function U(le,be,Oe){const{xs:Le,ys:Fe,n:ue}=R(le,be,Oe);if(ue<2)return null;let pe=0,Se=0;for(let Rt=0;Rt<ue;Rt++)pe+=Le[Rt],Se+=Fe[Rt];pe/=ue,Se/=ue;let Ne=0,De=0,Ue=0;for(let Rt=0;Rt<ue;Rt++){const At=Le[Rt]-pe,_t=Fe[Rt]-Se;Ne+=At*At,De+=At*_t,Ue+=_t*_t}if(Ne===0)return null;const qe=De/Ne,rt=Se-qe*pe,ut=Ue===0?1:Math.max(0,Math.min(1,De*De/(Ne*Ue))),at=Math.max(0,Ue-qe*De),kt=ue>2?Math.sqrt(at/(ue-2)/Ne):0;return{slope:qe,intercept:rt,r2:ut,stdError:kt,n:ue}}const V=new Set(["ols","wls","robust"]),J=new Set(["quantile"]),_=new Set(["ridge","lasso","elasticnet","mixed","gls"]),ee=1.345;function W(le,be,Oe){const{xtwx:Le,xtwy:Fe}=l(le,be,Oe),ue=j(Le);if(!ue)return null;const pe=v(ue,Fe),Se=b(ue),Ne=Z(le,pe),De=be.map((Ue,qe)=>Ue-Ne[qe]);return{beta:pe,cov:Se,fitted:Ne,residuals:De}}function Z(le,be){return le.map(Oe=>Oe.reduce((Le,Fe,ue)=>Le+Fe*be[ue],0))}function ne(le,be){const Oe=le.length,Le=le.map(De=>De[be]),Fe=le.map(De=>[1,...De.filter((Ue,qe)=>qe!==be)]),ue=W(Fe,Le,null);if(!ue)return 1;const pe=Le.reduce((De,Ue)=>De+Ue,0)/Oe;let Se=0,Ne=0;for(let De=0;De<Oe;De++)Se+=ue.residuals[De]**2,Ne+=(Le[De]-pe)**2;return Ne===0?1:Math.max(0,Math.min(1,1-Se/Ne))}function ie(le){const be=[...le].sort((Fe,ue)=>Fe-ue),Oe=ce(be),Le=le.map(Fe=>Math.abs(Fe-Oe)).sort((Fe,ue)=>Fe-ue);return ce(Le)/.6745}function ce(le){const be=le.length;if(!be)return 0;const Oe=Math.floor(be/2);return be%2?le[Oe]:(le[Oe-1]+le[Oe])/2}function me(le,be,Oe={}){const Le=Oe.method||"ols";if(_.has(Le))throw new Error(`[lattice] regression method "${Le}" is out of scope; use ols, wls or robust.`);if(J.has(Le))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!V.has(Le))throw new Error(`[lattice] unknown regression method "${Le}"; use ols, wls or robust.`);const Fe=Array.isArray(be)?be.length:0,ue=Fe&&Array.isArray(le[0])?le[0].length:0,pe=ue+1;if(!(Fe>pe))return null;for(let Ct=0;Ct<Fe;Ct++){if(!Number.isFinite(be[Ct])||!Array.isArray(le[Ct])||le[Ct].length!==ue)return null;for(let $t=0;$t<ue;$t++)if(!Number.isFinite(le[Ct][$t]))return null}let Se=null;if(Le==="wls"){if(Se=Oe.weights,!Array.isArray(Se)||Se.length!==Fe)return null;for(let Ct=0;Ct<Fe;Ct++)if(!(Se[Ct]>0)||!Number.isFinite(Se[Ct]))return null}const Ne=le.map(Ct=>[1,...Ct]);let De,Ue=null;if(Le==="robust"){if(De=W(Ne,be,null),!De)return null;for(let Ct=0;Ct<50;Ct++){const $t=ie(De.residuals);if(!($t>0))break;const Wt=De.residuals.map(Ut=>{const Gt=Math.abs(Ut/$t);return Gt<=ee?1:ee/Gt}),zt=W(Ne,be,Wt);if(!zt)return null;const Vt=zt.beta.reduce((Ut,Gt,It)=>Math.max(Ut,Math.abs(Gt-De.beta[It])),0);if(De=zt,Ue=Wt,Vt<1e-10)break}}else if(De=W(Ne,be,Se),!De)return null;const qe=Le==="robust"?Ue:Se,{beta:rt,cov:ut,fitted:at,residuals:kt}=De;let Rt=0,At=0,_t=0;for(let Ct=0;Ct<Fe;Ct++){const $t=qe?qe[Ct]:1;Rt+=$t*kt[Ct]**2,At+=$t,_t+=$t*be[Ct]}const tn=_t/At;let Ht=0;for(let Ct=0;Ct<Fe;Ct++){const $t=qe?qe[Ct]:1;Ht+=$t*(be[Ct]-tn)**2}const Xt=Fe-pe,Ze=Rt/Xt,ct=Ht===0?1:Math.max(0,Math.min(1,1-Rt/Ht)),Ot=1-(1-ct)*(Fe-1)/Xt,bt=Array.isArray(Oe.names)&&Oe.names.length===ue?Oe.names:le[0].map((Ct,$t)=>`x${$t+1}`),wt=Ye(Oe.confidence),Ke=Xt>0?L(1-(1-wt)/2,Xt):1/0,ht=rt.map((Ct,$t)=>{const Wt=Math.sqrt(Math.max(0,Ze*ut[$t][$t])),zt=Wt>0?Ct/Wt:Ct===0?0:1/0,Vt=Number.isFinite(zt)?2*(1-Q(Math.abs(zt),Xt)):0,Ut=Number.isFinite(Ke)?Ke*Wt:null;return{name:$t===0?"(intercept)":bt[$t-1],estimate:Ct,stdError:Wt,t:zt,p:Math.max(0,Math.min(1,Vt)),lower:Ut===null?null:Ct-Ut,upper:Ut===null?null:Ct+Ut}}),lt=new Array(Fe),mt=new Array(Fe);for(let Ct=0;Ct<Fe;Ct++){const $t=qe?qe[Ct]:1,Wt=Math.max(0,Math.min(1,$t*g(Ne[Ct],ut)));lt[Ct]=Wt;const zt=(1-Wt)**2;mt[Ct]=zt>0&&Ze>0?kt[Ct]**2/(pe*Ze)*(Wt/zt):null}const xt=le[0].map((Ct,$t)=>{if(ue<2)return 1;const Wt=ne(le,$t);return Wt>=1?1/0:1/(1-Wt)});let Ft=null;{const Ct=kt.map(Wt=>Wt*Wt),$t=W(Ne,Ct,null);if($t){const Wt=Ct.reduce((Jt,ln)=>Jt+ln,0)/Fe;let zt=0,Vt=0;for(let Jt=0;Jt<Fe;Jt++)zt+=$t.residuals[Jt]**2,Vt+=(Ct[Jt]-Wt)**2;const Ut=Vt===0?0:Math.max(0,Math.min(1,1-zt/Vt)),Gt=Fe*Ut,It=X(Gt,ue);Ft={statistic:Gt,df:ue,p:It,heteroscedastic:It<.05}}}let yt=null;if(ue===1){const Ct=le.map(($t,Wt)=>Wt).sort(($t,Wt)=>le[$t][0]-le[Wt][0]);yt={confidence:wt,points:Ct.map($t=>{const Wt=Ne[$t],zt=Math.sqrt(Math.max(0,Ze*g(Wt,ut)));return{x:le[$t][0],yhat:at[$t],lower:at[$t]-Ke*zt,upper:at[$t]+Ke*zt}})}}return{method:Le,coefficients:ht,r2:ct,adjR2:Ot,n:Fe,df:Xt,sigma2:Ze,fitted:at,residuals:kt,leverage:lt,cooksD:mt,vif:xt,heteroscedasticity:Ft,band:yt,weights:qe?[...qe]:null}}function Ce(le){const be=le.length,Oe=Array.from({length:be},(ue,pe)=>pe).sort((ue,pe)=>le[ue]-le[pe]),Le=new Float64Array(be);let Fe=0;for(;Fe<be;){let ue=Fe;for(;ue+1<be&&le[Oe[ue+1]]===le[Oe[Fe]];)ue++;const pe=(Fe+ue)/2+1;for(let Se=Fe;Se<=ue;Se++)Le[Oe[Se]]=pe;Fe=ue+1}return Le}const Pe=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function xe(le){const be=[.01,.05,.1],Oe=[Pe["1%"],Pe["5%"],Pe["10%"]];if(le<=Oe[0]){const ue=(Math.log(be[1])-Math.log(be[0]))/(Oe[1]-Oe[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(be[0])+ue*(le-Oe[0]))))}if(le>=Oe[2]){const ue=(Math.log(be[2])-Math.log(be[1]))/(Oe[2]-Oe[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(be[2])+ue*(le-Oe[2]))))}const Le=le<Oe[1]?0:1,Fe=(le-Oe[Le])/(Oe[Le+1]-Oe[Le]);return Math.exp(Math.log(be[Le])+Fe*(Math.log(be[Le+1])-Math.log(be[Le])))}function _e(le,be,Oe,Le){const Fe=Oe-Le,ue=Le+3,pe=new Array(Fe),Se=new Array(Fe);let Ne=!0,De=Le;for(let at=0;at<Fe;at++){const kt=Le+at,Rt=new Float64Array(ue);Rt[0]=1,Rt[1]=at+1,Rt[2]=le[kt];for(let At=1;At<=Le;At++)Rt[2+At]=be[kt-At];for(let At=1;At<ue;At++)Number.isFinite(Rt[At])||(De=Math.min(De,At-3));pe[at]=Rt,Se[at]=be[kt],Number.isFinite(Se[at])||(Ne=!1)}if(!Ne)return 0;const{xtwx:Ue,xtwy:qe}=l(pe,Se,null);let rt=0,ut=1/0;for(let at=0;at<=De;at++){const kt=at+3;if(!(Fe>kt))continue;const Rt=new Array(kt);for(let ct=0;ct<kt;ct++)Rt[ct]=Ue[ct].slice(0,kt);const At=j(Rt);if(!At)continue;const _t=v(At,qe.slice(0,kt));let tn=0;for(let ct=0;ct<Fe;ct++){const Ot=pe[ct];let bt=0;for(let wt=0;wt<kt;wt++)bt+=Ot[wt]*_t[wt];tn+=(Se[ct]-bt)**2}const Xt=tn/(Fe-kt)*(Fe-kt);if(!(Xt>0))continue;const Ze=Fe*Math.log(Xt/Fe)+2*kt;Ze<ut&&(ut=Ze,rt=at)}return rt}function ve(le,be={}){const Oe=[];for(let ut=0;ut<le.length;ut++){const at=Number(le[ut]);Number.isFinite(at)&&Oe.push(at)}const Le=Oe.length,Fe=Le-1;if(Le<8||Fe<6)return null;const ue=new Array(Fe);for(let ut=0;ut<Fe;ut++)ue[ut]=Oe[ut+1]-Oe[ut];let pe=Number.isFinite(be.maxlag)?Math.floor(be.maxlag):Math.ceil(12*(Le/100)**.25);pe=Math.max(0,Math.min(pe,Math.floor((Fe-5)/2)));const Se=(ut,at)=>{const kt=[],Rt=[];for(let At=at;At<Fe;At++){const _t=[At-at+1,Oe[At]];for(let tn=1;tn<=ut;tn++)_t.push(ue[At-tn]);kt.push(_t),Rt.push(ue[At])}return me(kt,Rt,{method:"ols"})},Ne=_e(Oe,ue,Fe,pe),De=Se(Ne,Ne);if(!De||!De.coefficients[2])return null;const Ue=De.coefficients[2].t,qe=xe(Ue),rt=Ue<Pe["5%"];return{statistic:Ue,usedLag:Ne,nobs:Fe-Ne,criticalValues:{...Pe},pValue:qe,pApproximate:!0,stationary:rt,verdict:rt?"stationary":"non-stationary",regression:"ct"}}function oe(le,be={}){const Oe=[];for(let rt=0;rt<le.length;rt++){const ut=Number(le[rt]);Number.isFinite(ut)&&Oe.push(ut)}const Le=Oe.length;if(Le<3)return null;let Fe=Number.isFinite(be.maxlag)?Math.floor(be.maxlag):Math.min(10,Le-1);Fe=Math.max(1,Math.min(Fe,Le-1));let ue=0;for(const rt of Oe)ue+=rt;ue/=Le;const pe=Oe.map(rt=>rt-ue);let Se=0;for(const rt of pe)Se+=rt*rt;Se/=Le;const Ne=new Array(Fe+1).fill(0);Ne[0]=1;for(let rt=1;rt<=Fe;rt++){let ut=0;for(let at=rt;at<Le;at++)ut+=pe[at]*pe[at-rt];Ne[rt]=Se>0?ut/Le/Se:0}const De=new Array(Fe+1).fill(0);De[0]=1;let Ue=[];for(let rt=1;rt<=Fe;rt++){let ut=Ne[rt];for(let At=1;At<rt;At++)ut-=Ue[At-1]*Ne[rt-At];let at=1;for(let At=1;At<rt;At++)at-=Ue[At-1]*Ne[At];const kt=at!==0?ut/at:0,Rt=new Array(rt);for(let At=1;At<rt;At++)Rt[At-1]=Ue[At-1]-kt*Ue[rt-1-At];Rt[rt-1]=kt,De[rt]=kt,Ue=Rt}const qe=1.96/Math.sqrt(Le);return{acf:Ne,pacf:De,bounds:{upper:qe,lower:-qe},n:Le,nlags:Fe,approximate:!0}}function he(le,be,Oe){const{xs:Le,ys:Fe,n:ue}=R(le,be,Oe);if(ue<2)return null;const pe=Ce(Le),Se=Ce(Fe);let Ne=0,De=0;for(let ut=0;ut<ue;ut++)Ne+=pe[ut],De+=Se[ut];Ne/=ue,De/=ue;let Ue=0,qe=0,rt=0;for(let ut=0;ut<ue;ut++){const at=pe[ut]-Ne,kt=Se[ut]-De;Ue+=at*kt,qe+=at*at,rt+=kt*kt}return qe===0||rt===0?null:Math.max(-1,Math.min(1,Ue/Math.sqrt(qe*rt)))}function ae(le,be,Oe){const{xs:Le,ys:Fe,n:ue}=R(le,be,Oe);if(ue<2||ue>s)return null;let pe=0,Se=0,Ne=0,De=0;for(let rt=0;rt<ue;rt++)for(let ut=rt+1;ut<ue;ut++){const at=Math.sign(Le[rt]-Le[ut]),kt=Math.sign(Fe[rt]-Fe[ut]),Rt=at*kt;Rt>0?pe++:Rt<0?Se++:at===0&&kt===0||(at===0?Ne++:De++)}const Ue=pe+Se+De,qe=pe+Se+Ne;return Ue===0||qe===0?null:(pe-Se)/Math.sqrt(Ue*qe)}function se(le,be={}){const Oe=le.length;if(Oe<2)return null;const Le=le[0],Fe=le[Oe-1],ue=[];for(let At=1;At<Oe;At++){const _t=le[At-1];_t!==0&&ue.push((le[At]-_t)/Math.abs(_t))}let pe=null;if(ue.length>1){let At=0;for(const tn of ue)At+=tn;At/=ue.length;let _t=0;for(const tn of ue)_t+=(tn-At)**2;pe=Math.sqrt(_t/(ue.length-1))}const Se=Number(be.periodsPerYear)>0?Number(be.periodsPerYear):null;let Ne=le[0],De=0,Ue=0,qe=0,rt=0;for(let At=1;At<Oe;At++){if(le[At]>Ne){Ne=le[At],De=At;continue}if(Ne<=0)continue;const _t=(Ne-le[At])/Ne;_t>Ue&&(Ue=_t,qe=De,rt=At)}let ut=null;if(Oe>2){let At=0;for(let Ht=0;Ht<Oe;Ht++)At+=le[Ht];At/=Oe;let _t=0,tn=0;for(let Ht=0;Ht<Oe;Ht++){const Xt=le[Ht]-At;tn+=Xt*Xt,Ht>0&&(_t+=Xt*(le[Ht-1]-At))}ut=tn>0?_t/tn:null}let at=0,kt=0;for(const At of ue)At>0?at++:At<0&&kt++;let Rt=null;if(Le>0&&Fe>0){const At=(Fe/Le)**(1/(Oe-1))-1;Rt=Se?(1+At)**Se-1:At}return{n:Oe,first:Le,last:Fe,change:Fe-Le,changePercent:Le===0?null:(Fe-Le)/Math.abs(Le)*100,volatility:pe,annualisedVolatility:pe!==null&&Se?pe*Math.sqrt(Se):null,growth:Rt,maxDrawdown:Ue,maxDrawdownFrom:qe,maxDrawdownTo:rt,autocorrelation:ut,upDays:at,downDays:kt}}const de=1.128,ke=3.267;function Ae(le){const be=le.length;if(be<2)return null;const Oe=[];for(let Fe=1;Fe<be;Fe++)Oe.push(Math.abs(le[Fe]-le[Fe-1]));const Le=Oe.reduce((Fe,ue)=>Fe+ue,0)/Oe.length;return{ranges:Oe,centre:Le,upper:ke*Le,lower:0}}function Te(le){const be=le.length;if(be<2)return null;let Oe=0;for(let Fe=1;Fe<be;Fe++)Oe+=Math.abs(le[Fe]-le[Fe-1]);const Le=Oe/(be-1);return{sigma:Le/de,meanRange:Le}}function je(le,be){const Oe=le.length;if(Oe<2||!be)return null;const Le=Number.isFinite(Number(be.lower))?Number(be.lower):null,Fe=Number.isFinite(Number(be.upper))?Number(be.upper):null;if(Le===null&&Fe===null)return null;let ue=0;for(let at=0;at<Oe;at++)ue+=le[at];ue/=Oe;let pe=0;for(let at=0;at<Oe;at++)pe+=(le[at]-ue)**2;const Se=Math.sqrt(pe/(Oe-1)),Ne=Te(le),De=Ne?Ne.sigma:null,Ue=at=>{if(!at||at<=0)return{index:null,k:null};const Rt=Le!==null&&Fe!==null?(Fe-Le)/(6*at):null,At=Fe!==null?(Fe-ue)/(3*at):1/0,_t=Le!==null?(ue-Le)/(3*at):1/0;return{index:Rt,k:Math.min(At,_t)}},qe=Ue(De),rt=Ue(Se);let ut=0;for(let at=0;at<Oe;at++){if(Le!==null&&le[at]<Le){ut++;continue}Fe!==null&&le[at]>Fe&&ut++}return{n:Oe,mean:ue,lower:Le,upper:Fe,target:Number.isFinite(Number(be.target))?Number(be.target):null,sigmaWithin:De,sigmaOverall:Se,cp:qe.index,cpk:qe.k,pp:rt.index,ppk:rt.k,outOfSpec:ut,defectRate:Oe?ut/Oe:null}}function ye(le){const be=le.length;if(be<2)return null;const Oe=Te(le);if(!Oe||!(Oe.sigma>0))return null;let Le=0;for(let Fe=0;Fe<be;Fe++)Le+=le[Fe];return Le/=be,{centre:Le,sigma:Oe.sigma,upper:Le+3*Oe.sigma,lower:Le-3*Oe.sigma}}function He(le,be){if(!be||!(be.sigma>0))return[];const Oe=le.length,{centre:Le,sigma:Fe}=be,ue=Se=>(le[Se]-Le)/Fe,pe=[];for(let Se=0;Se<Oe;Se++){if(Math.abs(ue(Se))>3&&pe.push({index:Se,rule:1,description:"beyond three sigma"}),Se>=2)for(const Ne of[1,-1]){let De=0;for(let Ue=Se-2;Ue<=Se;Ue++)ue(Ue)*Ne>2&&De++;if(De>=2){pe.push({index:Se,rule:2,description:"two of three past two sigma"});break}}if(Se>=4)for(const Ne of[1,-1]){let De=0;for(let Ue=Se-4;Ue<=Se;Ue++)ue(Ue)*Ne>1&&De++;if(De>=4){pe.push({index:Se,rule:3,description:"four of five past one sigma"});break}}if(Se>=7)for(const Ne of[1,-1]){let De=!0;for(let Ue=Se-7;Ue<=Se;Ue++)if(ue(Ue)*Ne<=0){De=!1;break}if(De){pe.push({index:Se,rule:4,description:"eight in a row on one side"});break}}}return pe}function Me(le,be){if(!be||!(be.sigma>0))return[];const Oe=le.length,{centre:Le,sigma:Fe}=be,ue=Ne=>(le[Ne]-Le)/Fe,pe=(Ne,De,Ue,qe)=>{for(const rt of[1,-1]){let ut=0;for(let at=Ne;at<=De;at++)ue(at)*rt>Ue&&ut++;if(ut>=qe)return!0}return!1},Se=[];for(let Ne=0;Ne<Oe;Ne++){if(Math.abs(ue(Ne))>3&&Se.push({index:Ne,rule:1,description:"beyond three sigma"}),Ne>=8)for(const De of[1,-1]){let Ue=!0;for(let qe=Ne-8;qe<=Ne;qe++)if(ue(qe)*De<=0){Ue=!1;break}if(Ue){Se.push({index:Ne,rule:2,description:"nine in a row on one side"});break}}if(Ne>=5)for(const De of[1,-1]){let Ue=!0;for(let qe=Ne-4;qe<=Ne;qe++)if((le[qe]-le[qe-1])*De<=0){Ue=!1;break}if(Ue){Se.push({index:Ne,rule:3,description:De>0?"six rising":"six falling"});break}}if(Ne>=13){let De=!0;for(let Ue=Ne-12;Ue<=Ne;Ue++){const qe=le[Ue]-le[Ue-1],rt=le[Ue+1<=Ne?Ue+1:Ue]-le[Ue];if(Ue+1>Ne)break;if(qe===0||rt===0||qe>0==rt>0){De=!1;break}}De&&Se.push({index:Ne,rule:4,description:"fourteen alternating"})}if(Ne>=2&&pe(Ne-2,Ne,2,2)&&Se.push({index:Ne,rule:5,description:"two of three past two sigma"}),Ne>=4&&pe(Ne-4,Ne,1,4)&&Se.push({index:Ne,rule:6,description:"four of five past one sigma"}),Ne>=14){let De=!0;for(let Ue=Ne-14;Ue<=Ne;Ue++)if(Math.abs(ue(Ue))>=1){De=!1;break}De&&Se.push({index:Ne,rule:7,description:"fifteen within one sigma"})}if(Ne>=7){let De=!0;for(let Ue=Ne-7;Ue<=Ne;Ue++)if(Math.abs(ue(Ue))<=1){De=!1;break}De&&Se.push({index:Ne,rule:8,description:"eight beyond one sigma"})}}return Se}const Re=Object.freeze(["westernElectric","nelson"]);function Ee(le,be,Oe="westernElectric"){return String(Oe)==="nelson"?Me(le,be):He(le,be)}function $e(le,be,Oe){let Le=0;for(let Fe=0;Fe<le.length;Fe++)(le[Fe]<be||le[Fe]>Oe)&&Le++;return Le}function Ie(le,be,Oe,Le=20){const Fe=le.length;if(!Fe)return[];const ue=le[0],pe=le[Fe-1];if(pe===ue)return[{from:ue,to:pe,count:Fe}];const Se=Oe-be,Ne=1.5*Se;let De=Se>0?Math.max(ue,be-Ne):ue,Ue=Se>0?Math.min(pe,Oe+Ne):pe;Ue>De||(De=ue,Ue=pe);const qe=Se>0?2*Se/Math.cbrt(Fe):(Ue-De)/(Math.ceil(Math.log2(Fe))+1),rt=qe>0?Math.min(Le,Math.max(1,Math.ceil((Ue-De)/qe))):1,ut=(Ue-De)/rt,at=[];for(let kt=0;kt<rt;kt++)at.push({from:De+kt*ut,to:De+(kt+1)*ut,count:0});for(let kt=0;kt<Fe;kt++){const Rt=Math.min(rt-1,Math.max(0,Math.floor((le[kt]-De)/ut)));at[Rt].count++}return at[0].from=ue,at[rt-1].to=pe,at}const We=.95;function Ye(le){const be=Number(le);return Number.isFinite(be)&&be>0&&be<1?be:We}function nt(le,be=We){const Oe=le.length;if(Oe<2)return null;let Le=0;for(let Ue=0;Ue<Oe;Ue++)Le+=le[Ue];const Fe=Le/Oe;let ue=0;for(let Ue=0;Ue<Oe;Ue++){const qe=le[Ue]-Fe;ue+=qe*qe}const pe=Math.sqrt(ue/(Oe-1)),Se=Ye(be),De=L(1-(1-Se)/2,Oe-1)*pe/Math.sqrt(Oe);return{mean:Fe,lower:Fe-De,upper:Fe+De,margin:De,n:Oe,confidence:Se}}function Qe(le,be,Oe=We){const Le=Number(le),Fe=Number(be);if(!(Fe>0)||!(Le>=0)||Le>Fe)return null;const ue=Ye(Oe),pe=H(1-(1-ue)/2),Se=Le/Fe,Ne=pe*pe,De=1+Ne/Fe,Ue=(Se+Ne/(2*Fe))/De,qe=pe/De*Math.sqrt(Se*(1-Se)/Fe+Ne/(4*Fe*Fe));return{proportion:Se,lower:Math.max(0,Ue-qe),upper:Math.min(1,Ue+qe),n:Fe,confidence:ue}}function dt(le,be=We){if(!le||!(le.n>2)||!Number.isFinite(le.stdError))return null;const Oe=Ye(be),Fe=L(1-(1-Oe)/2,le.n-2)*le.stdError;return{slope:le.slope,lower:le.slope-Fe,upper:le.slope+Fe,margin:Fe,confidence:Oe}}function jt(le,be,Oe=We){const Le=Number(le),Fe=Number(be);if(!Number.isFinite(Le)||!(Fe>1))return null;const ue=Ye(Oe),Se=H(1-(1-ue)/2)*Math.sqrt(1/(9*Fe)+Le*Le/(2*(Fe-1)));return{index:Le,lower:Le-Se,upper:Le+Se,margin:Se,n:Fe,confidence:ue}}function Et(le,be){return!le||!(le.sd>0)||!Number.isFinite(be)||!Number.isFinite(le.mean)?null:(be-le.mean)/le.sd}function it(le){return Number.isFinite(le)?Math.min(1,Math.max(0,2*$(Math.abs(le)/2)-1)):0}function ft(le,be){const Oe=new Map,Le=Y(le);let Fe=0;for(let ue=0;ue<be.length;ue++){const pe=Le(be[ue]);if(pe==null||pe===""||typeof pe=="number"&&Number.isNaN(pe))continue;const Se=pe instanceof Date?pe.getTime():typeof pe=="object"?String(pe):pe;Oe.set(Se,(Oe.get(Se)||0)+1),Fe++}return{map:Oe,total:Fe}}function pt(le,be,Oe,Le){if(!(be>0)||!(Le>0))return null;let Fe=0;const ue=new Set(le.keys());for(const pe of Oe.keys())ue.add(pe);for(const pe of ue){const Se=(le.get(pe)||0)/be,Ne=(Oe.get(pe)||0)/Le;Fe+=Math.abs(Se-Ne)}return Fe/2}const Tt=10;function Mt(le,be,Oe){if(Oe&&Oe.numeric){const Se=m(le,be),{n:Ne,mean:De}=f(Se),Ue=Ne>0?Et({mean:Oe.mean,sd:Oe.sd},De):null;return{measure:"standardizedMeanDifference",magnitude:Ue,distance:Ue===null?0:it(Ue),direction:Ue===null?0:Math.sign(Ue),subsetN:Ne,populationN:Oe.n||0,reliable:Ne>=Tt}}const{map:Fe,total:ue}=ft(le,be),pe=pt(Fe,ue,Oe.map,Oe.total);return{measure:"categoricalTotalVariation",magnitude:pe,distance:pe===null?0:pe,direction:0,subsetN:ue,populationN:Oe.total||0,reliable:ue>=Tt}}function Lt(le,be){if(le&&(le.kind==="float64"||le.kind==="int32"))return!0;const Oe=Y(le);let Le=0,Fe=0;for(let ue=0;ue<be.length&&Le<200;ue++){const pe=Oe(be[ue]);if(pe==null||pe==="")continue;if(pe instanceof Date)return!1;Le++;const Se=typeof pe=="number"?pe:Number(pe);Number.isFinite(Se)&&Fe++}return Le===0?!1:Fe/Le>=.9}function Je(le,be){if(Lt(le,be)){const Fe=m(le,be),{n:ue,mean:pe,m2:Se}=f(Fe);return{numeric:!0,mean:pe,sd:ue>0?Math.sqrt(Se/ue):0,n:ue}}const{map:Oe,total:Le}=ft(le,be);return{numeric:!1,map:Oe,total:Le}}}),Ve("packages/core/src/compute/total.js",function(e,D){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return a}}),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 d}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return f}});const A=D("packages/core/src/internal/predicates.js").isFunction,I=D("packages/core/src/internal/warn.js").warnOnce,L=D("packages/core/src/compute/handle.js"),Q=L.presenceReader,H=L.valueComparator,$=L.valueReader,X=D("packages/core/src/compute/statistics.js"),F=X.STAT_FNS,j=X.STAT_LABELS;function v(w){return!!w&&(w.kind==="float64"||w.kind==="int32")}function b(w,k){const P=k.length;let G=0;if(v(w)){const q=w.values,B=Q(w);if(!B){for(let E=0;E<P;E++){const S=q[k[E]];Number.isNaN(S)||(G+=S)}return G}for(let E=0;E<P;E++){const S=k[E];if(B(S)===1){const C=q[S];Number.isNaN(C)||(G+=C)}}return G}const K=$(w);for(let q=0;q<P;q++){const B=m(K(k[q]));B!==null&&(G+=B)}return G}b.kernel=!0;function l(w,k){const P=k.length;let G=0;if(v(w)){const q=w.values,B=Q(w);if(!B){for(let E=0;E<P;E++)Number.isNaN(q[k[E]])||G++;return G}for(let E=0;E<P;E++){const S=k[E];B(S)===1&&!Number.isNaN(q[S])&&G++}return G}const K=$(w);for(let q=0;q<P;q++){const B=K(k[q]);B!=null&&!(typeof B=="number"&&Number.isNaN(B))&&G++}return G}l.kernel=!0;function g(w,k){return k.length}g.kernel=!0;function o(w,k){const P=l(w,k);return P===0?null:b(w,k)/P}o.kernel=!0;function t(w,k,P,G){const K=k.length;if(v(w)){const S=w.values,C=Q(w);let N=null;if(!C){for(let O=0;O<K;O++){const T=S[k[O]];Number.isNaN(T)||(N===null||(P<0?T<N:T>N))&&(N=T)}return N}for(let O=0;O<K;O++){const T=k[O];if(C(T)===0)continue;const R=S[T];Number.isNaN(R)||(N===null||(P<0?R<N:R>N))&&(N=R)}return N}const q=$(w),B=H(G);let E=null;for(let S=0;S<K;S++){const C=q(k[S]);C==null||typeof C=="number"&&Number.isNaN(C)||(E===null||(P<0?B(C,E)<0:B(C,E)>0))&&(E=C)}return E}function s(w,k,P){return t(w,k,-1,P&&P.locale)}s.kernel=!0;function r(w,k,P){return t(w,k,1,P&&P.locale)}r.kernel=!0;function i(w,k){return k.length===0?null:$(w)(k[0])}i.kernel=!0;function n(w,k){return k.length===0?null:$(w)(k[k.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 k=Number(w);return Number.isNaN(k)?null:k}const c={sum:b,min:s,max:r,avg:o,count:g,first:i,last:n,countValues:l,...F},a=Object.freeze({...j,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"?a[w]||w:"Total":""}const h=Object.freeze(["sum","avg","min","max","count","countValues","first","last"]);function p(w){const k=w&&w.dataType&&w.dataType.totals&&w.dataType.totals.supported;if(Array.isArray(k))return k.slice();const P=h.filter(G=>G in c);for(const G of Object.keys(c))P.includes(G)||P.push(G);return P}function y(w,k){return typeof k!="string"?!0:p(w).includes(k)}function d(w,k){const P=$(w),G=[];for(let K=0;K<k.length;K++){const q=P(k[K]);q!=null&&G.push(q)}return G}function f(w,k,P,G){const K=k||[];if(P&&typeof P=="object"&&typeof P.fn=="string"){const{fn:q,...B}=P,E=c[q];return E?E(w,K,{...G,...B}):(I(`total:${q}`,`unknown total function "${q}"; register it in config.totalFns`),null)}if(typeof P=="string"){const q=c[P];return q?q(w,K,G):(I(`total:${P}`,`unknown total function "${P}"; register it in config.totalFns`),null)}return A(P)?P.kernel===!0?P(w,K,G):P(d(w,K),G||{}):null}}),Ve("packages/core/src/compute/windowed.js",function(e,D){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Q}});const A=D("packages/core/src/compute/sketch.js").Welford;class Y{#e;#t;#n=[];#r;#s;constructor($,X=0,F=Date.now){if($!=="count"&&$!=="time"&&$!=="session")throw new RangeError(`unknown window kind: ${$}`);if(($==="count"||$==="time")&&!(X>0))throw new RangeError(`a ${$} window needs a positive span`);this.#e=$,this.#t=Math.floor(X),this.#r=F,this.#s=F()}get size(){return this.#n.length}push($,X=this.#r()){Number.isFinite($)&&(this.#n.push({t:X,v:$}),this.#i(X))}#i($){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const X=$-this.#t;for(;this.#n.length&&this.#n[0].t<X;)this.#n.shift()}}spec(){const $=this.#e==="session"?this.#r()-this.#s:this.#t;return{kind:this.#e,span:$,size:this.#n.length}}values(){return this.#n.map($=>$.v)}aggregate(){const $=this.spec();if(!this.#n.length)return{over:$,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const X=new A;let F=0,j=1/0,v=-1/0;for(const{v:b}of this.#n)F+=b,b<j&&(j=b),b>v&&(v=b),X.add(b);return{over:$,count:this.#n.length,sum:F,mean:X.mean(),min:j,max:v,variance:X.variance(),stddev:X.stddev()}}reduce($){const X=this.aggregate(),F={sum:X.sum,avg:X.mean,mean:X.mean,min:X.min,max:X.max,count:X.count,variance:X.variance,stddev:X.stddev};if(!($ in F))throw new RangeError(`unknown windowed aggregate: ${$}`);return{value:F[$],over:X.over}}}const I=Object.freeze(["count","time","session"]);function L(H,$=Date.now){const X=H.kind==="time"&&H.minutes!=null?H.minutes*6e4:H.span??0;return new Y(H.kind,X,$)}const Q={Window:Y,WINDOW_KINDS:I,openWindow:L}}),Ve("packages/core/src/compute/rolling.js",function(e,D){"use strict";Object.defineProperty(e,"ROLLING_WINDOW_FIELDS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"rollingWindow",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return F}}),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 A=D("packages/core/src/compute/windowed.js").openWindow,I=D("packages/core/src/compute/sketch.js").KLL,L=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function Q(c,a,u,h){if(c.kind==="count"){const p=Math.max(1,Math.floor(c.span||0));return{coverage:Math.min(1,a/p),partial:a<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-h;return{coverage:Math.min(1,y/p),partial:y<p}}return{coverage:null,partial:!1}}function H(c,a){const u=A(a),h=new Map,p=c.length?c[0].at:0;for(let y=0;y<c.length;y++){const{key:d,at:f,value:w}=c[y];Number.isFinite(w)&&u.push(w,f);const k=u.aggregate(),P=Q(a,k.count,f,p);d!=null&&h.set(String(d),{sum:k.sum,avg:k.mean,min:k.min,max:k.max,count:k.count,coverage:P.coverage,partial:P.partial})}return h}function $(c){const a=new Map;let u=0;for(const{key:h,value:p}of c)Number.isFinite(p)&&(u+=p),h!=null&&a.set(String(h),u);return a}function X(c,a=1){const u=new Map,h=Math.max(1,Math.floor(a));for(let p=0;p<c.length;p++){const{key:y,value:d}=c[p];if(y==null)continue;const f=p>=h?c[p-h].value:null,w=Number.isFinite(d)?d:null,k=Number.isFinite(f)?f:null;u.set(String(y),w!==null&&k!==null?w-k:null)}return u}const F=4096;function j(c){let a=c>>>0;return()=>{a+=1831565813;let u=a;return u=Math.imul(u^u>>>15,u|1),u^=u+Math.imul(u^u>>>7,u|61),((u^u>>>14)>>>0)/4294967296}}function v(c,a){const u=c.length;if(u===1)return c[0];const h=(u-1)*a,p=Math.floor(h),y=Math.ceil(h);return p===y?c[p]:c[p]+(h-p)*(c[y]-c[p])}function b(c,a,u={}){const h=Math.min(1,Math.max(0,u.q==null?.5:u.q)),p=Math.max(1,Math.floor(u.cap==null?F:u.cap)),y=j(u.seed==null?2654435769:u.seed),d=new Map,f=c.length?c[0].at:0;if(a.kind==="session"){const k=new I(200,y);let P=0;for(const{key:G,value:K}of c)Number.isFinite(K)&&(k.add(K),P++),G!=null&&d.set(String(G),{value:P?k.quantile(h):null,approx:P>0,count:P,coverage:null,partial:!1});return d}const w=A(a);for(const{key:k,at:P,value:G}of c){Number.isFinite(G)&&w.push(G,P);const K=w.values(),q=K.length;let B=null,E=!1;if(q)if(q<=p)B=v([...K].sort((C,N)=>C-N),h);else{const C=new I(200,y);for(const N of K)C.add(N);B=C.quantile(h),E=!0}const S=Q(a,q,P,f);k!=null&&d.set(String(k),{value:B,approx:E,count:q,coverage:S.coverage,partial:S.partial})}return d}function l(c,a){const u=c.length,h=new Array(u).fill(null),p=Math.floor(a/2),y=a%2===0;for(let d=0;d<u;d++){if(d-p<0||d+p>=u)continue;let f=0,w=!0;if(y)for(let k=-p;k<=p;k++){const P=c[d+k];if(!Number.isFinite(P)){w=!1;break}f+=k===-p||k===p?P*.5:P}else for(let k=-p;k<=p;k++){const P=c[d+k];if(!Number.isFinite(P)){w=!1;break}f+=P}w&&(h[d]=f/a)}return h}function g(c,a){const u=new Map,h=Math.floor(Number(a&&a.period));if(!(h>=2))return u;const p=a&&a.model==="multiplicative",y=c.length,d=c.map(E=>Number.isFinite(E.value)?E.value:null),f=l(d,h),w=new Array(y).fill(null);for(let E=0;E<y;E++){const S=f[E],C=d[E];S===null||C===null||(p?S!==0&&(w[E]=C/S):w[E]=C-S)}const k=new Array(h).fill(0),P=new Array(h).fill(0);for(let E=0;E<y;E++){if(w[E]===null)continue;const S=E%h;k[S]+=w[E],P[S]+=1}const G=p?1:0,K=k.map((E,S)=>P[S]?E/P[S]:G),q=K.reduce((E,S)=>E+S,0)/h,B=p?K.map(E=>q!==0?E/q:1):K.map(E=>E-q);for(let E=0;E<y;E++){const{key:S}=c[E];if(S==null)continue;const C=f[E],N=B[E%h],O=d[E];let T=null;C!==null&&O!==null&&(T=p?C*N!==0?O/(C*N):null:O-C-N),u.set(String(S),{trend:C,seasonal:O===null?null:N,residual:T,coverage:C===null?0:1,partial:C===null})}return u}function o(c,a,u,h=80){const p=(Math.sqrt(5)-1)/2;let y=a,d=u,f=d-p*(d-y),w=y+p*(d-y),k=c(f),P=c(w);for(let G=0;G<h;G++)k<P?(d=w,w=f,P=k,f=d-p*(d-y),k=c(f)):(y=f,f=w,k=P,w=y+p*(d-y),P=c(w));return(y+d)/2}const t=1e-4,s=1-1e-4;function r(c,a){const u=c.length,h=new Array(u).fill(null),p=new Array(u).fill(null);let y=null,d=0;for(let f=0;f<u;f++){const w=c[f];if(!Number.isFinite(w)){y!==null&&(p[f]=y,h[f]=y);continue}if(y===null){y=w,p[f]=w,h[f]=w;continue}p[f]=y,d+=(w-y)**2,y=a*w+(1-a)*y,h[f]=y}return{smoothed:h,fitted:p,sse:d}}function i(c,a,u){const h=c.length,p=new Array(h).fill(null),y=new Array(h).fill(null);let d=null,f=null,w=0;for(let k=0;k<h;k++){const P=c[k];if(!Number.isFinite(P)){d!==null&&(d+=f,p[k]=d);continue}if(d===null){d=P,p[k]=P;continue}if(f===null){f=P-d;const q=d+f;y[k]=q,w+=(P-q)**2;const B=d;d=a*P+(1-a)*(B+f),f=u*(d-B)+(1-u)*f,p[k]=d;continue}const G=d+f;y[k]=G,w+=(P-G)**2;const K=d;d=a*P+(1-a)*(K+f),f=u*(d-K)+(1-u)*f,p[k]=d}return{smoothed:p,fitted:y,sse:w}}function n(c,a={}){const u=new Map,h=a.method==="holt",p=c.map(G=>Number.isFinite(G.value)?G.value:null),y=p.filter(G=>G!==null).length,d=G=>Math.min(s,Math.max(t,G)),f=()=>{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<(h?2:1))return f();let w=Number.isFinite(a.alpha)?d(a.alpha):null,k=h&&Number.isFinite(a.beta)?d(a.beta):null;if(h){if(w===null||k===null){let G=w===null?.5:w,K=k===null?.5:k;for(let q=0;q<6;q++)w===null&&(G=o(B=>i(p,B,K).sse,t,s)),k===null&&(K=o(B=>i(p,G,B).sse,t,s));w=w===null?G:w,k=k===null?K:k}}else w===null&&(w=o(G=>r(p,G).sse,t,s));const P=h?i(p,w,k):r(p,w);for(let G=0;G<c.length;G++){const{key:K}=c[G];K!=null&&u.set(String(K),{smoothed:P.smoothed[G],fitted:P.fitted[G],alpha:w,beta:h?k:null,sse:P.sse})}return u}const m={ROLLING_WINDOW_FIELDS:L,QUANTILE_SPAN_CAP:F,rollingWindow:H,rollingQuantile:b,cumulativeToDate:$,periodOverPeriod:X,seasonalDecompose:g,exponentialSmoothing:n}}),Ve("packages/core/src/compute/cluster.js",function(e,D){"use strict";Object.defineProperty(e,"CLUSTER_ROW_CAP",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"DBSCAN_ROW_CAP",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"DEFAULT_K",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"DEFAULT_MIN_POINTS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"orderByCentre",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"kmeans",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"dbscan",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"autoK",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"standardise",{enumerable:!0,get:function(){return t}});const re=1e5,A=2e4,Y=3,I=5,L=100;function Q(s){let r=s>>>0;return function(){r=r+1831565813|0;let n=Math.imul(r^r>>>15,1|r);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}function H(s,r){let i=0;for(let n=0;n<s.length;n++){const m=s[n]-r[n];i+=m*m}return i}function $(s,r){return Math.sqrt(H(s,r))}function X(s,r){let i=-1,n=1/0;for(let m=0;m<r.length;m++){const c=H(s,r[m]);c<n&&(n=c,i=m)}return i}function F(s,r,i){const n=Q(i),m=s.length,c=[Array.from(s[Math.floor(n()*m)])],a=new Float64Array(m).fill(1/0);for(let u=1;u<r;u++){let h=0;for(let f=0;f<m;f++){const w=H(s[f],c[c.length-1]);w<a[f]&&(a[f]=w),h+=a[f]}const p=n()*(h||m);let y=0,d=m-1;for(let f=0;f<m;f++)if(y+=h?a[f]:1,y>=p){d=f;break}c.push(Array.from(s[d]))}return c}function j(s,r){for(let i=0;i<s.length;i++){const n=s[i]-r[i];if(n!==0)return n}return 0}function v(s,r,i,n){const m=r.map((a,u)=>({centre:a,i:u})).sort((a,u)=>j(a.centre,u.centre)),c=new Int32Array(r.length);for(let a=0;a<m.length;a++)c[m[a].i]=a;for(let a=0;a<s.length;a++)s[a]>=0&&(s[a]=c[s[a]]);return{assignments:s,centres:m.map(a=>a.centre),sizes:m.map(a=>i[a.i]),distances:n}}function b(s,r={}){const i=s.length,n=i?s[0].length:0,m=Math.floor(r.k||Y);if(!(i>=m)||m<1||n<1)return null;let c=F(s,m,r.seed===void 0?1:r.seed);const a=new Int32Array(i);let u=!0;for(let d=0;d<L&&u;d++){u=!1;for(let k=0;k<i;k++){const P=X(s[k],c);a[k]!==P&&(a[k]=P,u=!0)}const f=c.map(()=>new Float64Array(n)),w=new Array(m).fill(0);for(let k=0;k<i;k++){const P=a[k];for(let G=0;G<n;G++)f[P][G]+=s[k][G];w[P]++}for(let k=0;k<m;k++)if(w[k])for(let P=0;P<n;P++)c[k][P]=f[k][P]/w[k];else{let P=0,G=-1/0;for(let K=0;K<i;K++){const q=H(s[K],c[k]);q>G&&(G=q,P=K)}c[k]=Array.from(s[P]),u=!0}}const h=new Array(m).fill(0),p=new Float64Array(i);let y=0;for(let d=0;d<i;d++){const f=a[d];h[f]++;const w=H(s[d],c[f]);p[d]=Math.sqrt(w),y+=w}return{assignments:a,centres:c,sizes:h,inertia:y,distances:p}}function l(s,r={}){const i=s.length,n=i?s[0].length:0,m=Number(r.eps),c=Math.max(1,Math.floor(r.minPoints||I));if(!(m>0)||i===0||n<1)return null;const a=new Array(i);for(let w=0;w<i;w++){const k=[];for(let P=0;P<i;P++)w!==P&&$(s[w],s[P])<=m&&k.push(P);a[w]=k}const u=new Int32Array(i).fill(-1);let h=0;for(let w=0;w<i;w++){if(u[w]!==-1||a[w].length<c)continue;u[w]=h;const k=[...a[w]];for(let P=0;P<k.length;P++){const G=k[P];u[G]===-1&&(u[G]=h,a[G].length>=c&&k.push(...a[G]))}h++}if(!h)return{assignments:u,centres:[],sizes:[],distances:new Float64Array(i).fill(NaN)};const p=[],y=new Array(h).fill(0),d=Array.from({length:h},()=>new Float64Array(n));for(let w=0;w<i;w++){const k=u[w];if(!(k<0)){y[k]++;for(let P=0;P<n;P++)d[k][P]+=s[w][P]}}for(let w=0;w<h;w++){const k=new Array(n);for(let P=0;P<n;P++)k[P]=d[w][P]/y[w];p.push(k)}const f=new Float64Array(i).fill(NaN);for(let w=0;w<i;w++){const k=u[w];k>=0&&(f[w]=$(s[w],p[k]))}return{assignments:u,centres:p,sizes:y,distances:f}}function g(s,r,i){const n=s.length;if(n===0)return 0;const m=new Int32Array(i);for(let a=0;a<n;a++)m[r[a]]++;let c=0;for(let a=0;a<n;a++){const u=r[a],h=new Float64Array(i);for(let d=0;d<n;d++)a!==d&&(h[r[d]]+=$(s[a],s[d]));const p=m[u]>1?h[u]/(m[u]-1):0;let y=1/0;for(let d=0;d<i;d++){if(d===u||m[d]===0)continue;const f=h[d]/m[d];f<y&&(y=f)}y!==1/0&&(c+=(y-p)/Math.max(p,y))}return c/n}function o(s,r={}){const i=s.length;if(!i)return null;const n=r.criterion==="silhouette"?"silhouette":"elbow",m=Math.max(2,Math.floor(r.maxK||8)),c=r.seed===void 0?1:r.seed;if(n==="silhouette"){const w=[],k=[];for(let G=2;G<=Math.min(m,i);G++){const K=b(s,{k:G,seed:c});K&&(w.push(G),k.push(g(s,K.assignments,G)))}if(!w.length)return null;let P=0;for(let G=1;G<k.length;G++)k[G]>k[P]&&(P=G);return{k:w[P],criterion:n,scores:k,ks:w}}const a=[],u=[];for(let w=1;w<=Math.min(m,i);w++){const k=b(s,{k:w,seed:c});k&&(a.push(w),u.push(k.inertia))}if(u.length<2)return null;const h={k:a[0],y:u[0]},p={k:a[a.length-1],y:u[u.length-1]},y=Math.hypot(p.k-h.k,p.y-h.y)||1;let d=0,f=-1/0;for(let w=0;w<u.length;w++){const k=Math.abs((p.k-h.k)*(h.y-u[w])-(h.k-a[w])*(p.y-h.y))/y;k>f&&(f=k,d=w)}return{k:a[d],criterion:n,scores:u,ks:a}}function t(s){const r=s.length,i=r?s[0].length:0;if(!r||!i)return null;const n=new Array(i).fill(0);for(let c=0;c<r;c++)for(let a=0;a<i;a++)n[a]+=s[c][a];for(let c=0;c<i;c++)n[c]/=r;const m=new Array(i).fill(0);for(let c=0;c<r;c++)for(let a=0;a<i;a++){const u=s[c][a]-n[a];m[a]+=u*u}for(let c=0;c<i;c++)m[c]=r>1?Math.sqrt(m[c]/(r-1)):0;for(let c=0;c<r;c++)for(let a=0;a<i;a++)m[a]>0?s[c][a]=(s[c][a]-n[a])/m[a]:s[c][a]=s[c][a]-n[a];return{mean:n,sd:m}}}),Ve("packages/core/src/compute/compare.js",function(e,D){"use strict";Object.defineProperty(e,"COMPARE_MEASURES",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"pooledStandardMeanDifference",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"numericSummary",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"bothNumeric",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"compareColumnAcross",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"compareDatasets",{enumerable:!0,get:function(){return l}});const re=D("packages/core/src/compute/statistics.js"),A=re.numbers,Y=re.moments,I=re.frequencyMap,L=re.categoricalDistance,Q=re.normalTotalVariation,H=re.isNumericColumn,$=re.SUBSET_RELIABILITY_FLOOR,X=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function F(g,o){if(!g||!o||!(g.n>0)||!(o.n>0)||!Number.isFinite(g.mean)||!Number.isFinite(o.mean))return null;const t=(g.n*g.sd*g.sd+o.n*o.sd*o.sd)/(g.n+o.n);return t>0?(g.mean-o.mean)/Math.sqrt(t):null}function j(g,o){const t=A(g,o),{n:s,mean:r,m2:i}=Y(t),n=s>0?Math.sqrt(i/s):0;return{mean:r,sd:n,n:s}}function v(g,o,t,s){return H(g,o)&&H(t,s)}function b(g,o,t,s){if(v(g,o,t,s)){const m=j(g,o),c=j(t,s),a=F(m,c);return{measure:X.numeric,magnitude:a,distance:a===null?0:Q(a),direction:a===null?0:Math.sign(a),nA:m.n,nB:c.n,meanA:m.mean,meanB:c.mean,reliable:m.n>=$&&c.n>=$}}const r=I(g,o),i=I(t,s),n=L(r.map,r.total,i.map,i.total);return{measure:X.categorical,magnitude:n,distance:n===null?0:n,direction:0,nA:r.total,nB:i.total,meanA:null,meanB:null,reliable:r.total>=$&&i.total>=$}}function l(g,o,t={}){const s=new Set(g.columns),r=new Set(o.columns),i=g.columns.filter(u=>r.has(u)),n=Array.isArray(t.columns)&&t.columns.length?i.filter(u=>t.columns.includes(u)):i,m=g.indices(),c=o.indices(),a=[];for(const u of n){const h=g.handle(u),p=o.handle(u);if(!h||!p)continue;const y=b(h,m,p,c);a.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 a.sort((u,h)=>h.distance-u.distance||Math.abs(h.magnitude||0)-Math.abs(u.magnitude||0)),{ranked:a,nA:m.length,nB:c.length,unmatched:{onlyA:g.columns.filter(u=>!r.has(u)),onlyB:o.columns.filter(u=>!s.has(u))},measures:X}}}),Ve("packages/core/src/compute/anomaly.js",function(e,D){"use strict";Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"DEFAULT_MODIFIED_Z_THRESHOLD",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return r}}),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 A=D("packages/core/src/compute/statistics.js").quantileSorted,I=D("packages/core/src/compute/special.js").logGamma,L=.6745,Q=3.5,H=1.5,$=.975,X=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function F(c){if(!c.length)return null;const u=Array.from(c,Number).sort((d,f)=>d-f),h=A(u,.5),p=u.map(d=>Math.abs(d-h)).sort((d,f)=>d-f),y=A(p,.5);return{median:h,mad:y}}function j(c,a={}){const u=Number.isFinite(a.threshold)?a.threshold:Q,h=c.length,p=new Array(h).fill(null),y=new Array(h).fill(!1),d=[];for(let k=0;k<h;k++){const P=Number(c[k]);Number.isFinite(P)&&d.push(P)}if(!d.length)return{median:null,mad:null,threshold:u,scores:p,flags:y,flagged:0};const f=F(d);if(f.mad===0)return{median:f.median,mad:0,threshold:u,scores:p,flags:y,flagged:0};let w=0;for(let k=0;k<h;k++){const P=Number(c[k]);if(!Number.isFinite(P))continue;const G=L*(P-f.median)/f.mad;p[k]=G,Math.abs(G)>u&&(y[k]=!0,w++)}return{median:f.median,mad:f.mad,threshold:u,scores:p,flags:y,flagged:w}}function v(c,a={}){const u=Number.isFinite(a.k)?a.k:H,h=[];for(let w=0;w<c.length;w++){const k=Number(c[w]);Number.isFinite(k)&&h.push(k)}if(!h.length)return null;const p=h.sort((w,k)=>w-k),y=A(p,.25),d=A(p,.75),f=d-y;return{q1:y,q3:d,iqr:f,lower:y-u*f,upper:d+u*f,k:u}}function b(c,a){if(a<=0)return 0;const u=I(c);if(a<c+1){let k=c,P=1/c,G=P;for(let K=0;K<1e3&&(k+=1,G*=a/k,P+=G,!(Math.abs(G)<Math.abs(P)*1e-15));K++);return P*Math.exp(-a+c*Math.log(a)-u)}const h=1e-300;let p=a+1-c,y=1/h,d=1/p,f=d;for(let k=1;k<1e3;k++){const P=-k*(k-c);p+=2,d=P*d+p,Math.abs(d)<h&&(d=h),y=p+P/y,Math.abs(y)<h&&(y=h),d=1/d;const G=d*y;if(f*=G,Math.abs(G-1)<1e-15)break}return 1-Math.exp(-a+c*Math.log(a)-u)*f}function l(c,a){return c<=0?0:b(a/2,c/2)}function g(c,a=$){if(!(a>0)||!(a<1))return NaN;let u=0,h=Math.max(1,c);for(;l(h,c)<a;)h*=2;for(let p=0;p<200;p++){const y=(u+h)/2;if(l(y,c)<a?u=y:h=y,h-u<1e-10)break}return(u+h)/2}function o(c){const a=c.length,u=c.map((h,p)=>{const y=h.slice();for(let d=0;d<a;d++)y.push(p===d?1:0);return y});for(let h=0;h<a;h++){let p=h;for(let d=h+1;d<a;d++)Math.abs(u[d][h])>Math.abs(u[p][h])&&(p=d);if(Math.abs(u[p][h])<1e-12)return null;if(p!==h){const d=u[p];u[p]=u[h],u[h]=d}const y=u[h][h];for(let d=0;d<2*a;d++)u[h][d]/=y;for(let d=0;d<a;d++){if(d===h)continue;const f=u[d][h];if(f!==0)for(let w=0;w<2*a;w++)u[d][w]-=f*u[h][w]}}return u.map(h=>h.slice(a))}function t(c,a){const u=c.length,h=new Array(a).fill(0);for(const d of c)for(let f=0;f<a;f++)h[f]+=d[f];for(let d=0;d<a;d++)h[d]/=u;const p=Array.from({length:a},()=>new Array(a).fill(0));for(const d of c)for(let f=0;f<a;f++){const w=d[f]-h[f];for(let k=f;k<a;k++)p[f][k]+=w*(d[k]-h[k])}const y=u>1?u-1:1;for(let d=0;d<a;d++)for(let f=d;f<a;f++)p[d][f]/=y,p[f][d]=p[d][f];return{mean:h,cov:p}}function s(c,a={}){const u=Number.isFinite(a.p)?a.p:$,h=Number.isFinite(a.ridge)?a.ridge:1e-6,p=c.length;if(!p)return null;const y=c[0].length;if(!y)return null;const d=new Array(p).fill(null),f=new Array(p).fill(null),w=new Array(p).fill(!1),k=[],P=[];for(let N=0;N<p;N++){const O=c[N];let T=O.length===y;const R=new Array(y);for(let x=0;T&&x<y;x++){const U=Number(O[x]);Number.isFinite(U)?R[x]=U:T=!1}T&&(k.push(N),P.push(R))}const G=y,K=g(G,u);if(P.length<=y)return{center:[],df:G,cutoff:K,singular:!0,used:P.length,distances:d,squared:f,flags:w,flagged:0};const{mean:q,cov:B}=t(P,y);let E=o(B),S=!1;if(!E){S=!0;let N=0;for(let R=0;R<y;R++)N+=B[R][R];const O=N/y*h||h,T=B.map((R,x)=>R.map((U,V)=>x===V?U+O:U));if(E=o(T),!E)return{center:q,df:G,cutoff:K,singular:!0,used:P.length,distances:d,squared:f,flags:w,flagged:0}}let C=0;for(let N=0;N<P.length;N++){const O=P[N],T=new Array(y);for(let U=0;U<y;U++)T[U]=O[U]-q[U];let R=0;for(let U=0;U<y;U++){let V=0;for(let J=0;J<y;J++)V+=E[U][J]*T[J];R+=T[U]*V}R<0&&(R=0);const x=k[N];f[x]=R,d[x]=Math.sqrt(R),R>K&&(w[x]=!0,C++)}return{center:q,df:G,cutoff:K,singular:S,used:P.length,distances:d,squared:f,flags:w,flagged:C}}const r=20,i=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function n(c,a={}){const u=a.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",h=Number.isFinite(a.windowLen)&&a.windowLen>=1?Math.floor(a.windowLen):r,p=Number.isFinite(a.threshold)?a.threshold:Q,y=Number.isFinite(a.k)?a.k:H,d=Number.isFinite(a.minPeriods)&&a.minPeriods>=1?Math.floor(a.minPeriods):h,f=c.length,w=new Array(f).fill(null),k=new Array(f).fill(!1);let P=0;for(let G=0;G<f;G++){const K=Number(c[G]);if(!Number.isFinite(K))continue;const q=Math.max(0,G-h+1),B=[];for(let E=q;E<=G;E++){const S=Number(c[E]);Number.isFinite(S)&&B.push(S)}if(!(B.length<d))if(u==="rollingIqr"){const E=v(B,{k:y});if(!E)continue;(K<E.lower||K>E.upper)&&(k[G]=!0,P++)}else{const E=F(B);if(!E||E.mad===0)continue;const S=L*(K-E.median)/E.mad;w[G]=S,Math.abs(S)>p&&(k[G]=!0,P++)}}return{method:u,windowLen:h,minPeriods:d,threshold:p,k:y,scores:w,flags:k,flagged:P}}function m(c={}){const a=c||{},u=a.field;if(typeof u!="string"||!u)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const h=a.method||"modifiedZScore";if(!(X.includes(h)||i.includes(h))||h==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${h}'`);const y=typeof a.orderBy=="string"?a.orderBy:null,d=a.latest===!0,f=i.includes(h),w=k=>Number(k==null?NaN:k[u]);return k=>{const P=Array.isArray(k)?k.slice():[...k];y&&P.sort((E,S)=>{const C=E?.[y],N=S?.[y];return C===N?0:C==null?-1:N==null?1:C<N?-1:1});const G=P.map(w);let K,q;if(f)({flags:K,scores:q}=n(G,{method:h,windowLen:a.windowLen,threshold:a.threshold,k:a.k,minPeriods:a.minPeriods}));else if(h==="iqr"){const E=v(G,{k:a.k});K=G.map(S=>E?Number.isFinite(S)&&(S<E.lower||S>E.upper):!1),q=G.map(()=>null)}else({flags:K,scores:q}=j(G,{threshold:a.threshold}));if(d){const E=K.length-1;return E<0||!K[E]?!1:{method:h,field:u,flagged:[{row:P[E],score:q[E]}]}}const B=[];for(let E=0;E<K.length;E++)K[E]&&B.push({row:P[E],score:q[E]});return B.length?{method:h,field:u,flagged:B}:!1}}}),Ve("packages/core/src/compute/forecast.js",function(e,D){"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 re=D("packages/core/src/compute/special.js"),A=re.normalQuantile,Y=re.studentTQuantile,L=D("packages/core/src/internal/warn.js").warnOnce,Q=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),H=1e-4,$=1-1e-4;function X(a){const u=[];for(let h=0;h<a.length;h++){const p=a[h];if(p!==null&&typeof p=="object"){const y=Number.isFinite(p.at)?p.at:h,d=Number.isFinite(p.value)?p.value:null;u.push({at:y,value:d})}else u.push({at:h,value:Number.isFinite(p)?Number(p):null})}return u}function F(a){const u=a.filter(f=>f.value!==null),h=u[0],p=u[u.length-1],y=p.at-h.at,d=u.length>1&&y>0?y/(u.length-1):1;return{lastAt:p.at,step:d}}function j(a){return Math.min($,Math.max(H,a))}function v(a,u=H,h=$,p=80){const y=(Math.sqrt(5)-1)/2;let d=u,f=h,w=f-y*(f-d),k=d+y*(f-d),P=a(w),G=a(k);for(let K=0;K<p;K++)P<G?(f=k,k=w,G=P,w=f-y*(f-d),P=a(w)):(d=w,w=k,P=G,k=d+y*(f-d),G=a(k));return(d+f)/2}function b(a,u){let h=null,p=0,y=0;for(let d=0;d<a.length;d++){const f=a[d];if(f!==null){if(h===null){h=f;continue}p+=(f-h)**2,y+=1,h=u*f+(1-u)*h}}return{level:h,sse:p,m:y}}function l(a,u,h){let p=null,y=null,d=0,f=0;for(let w=0;w<a.length;w++){const k=a[w];if(k===null){p!==null&&y!==null&&(p+=y);continue}if(p===null){p=k;continue}y===null&&(y=k-p);const P=p+y;d+=(k-P)**2,f+=1;const G=p;p=u*k+(1-u)*(G+y),y=h*(p-G)+(1-h)*y}return{level:p,trend:y,sse:d,m:f}}function g(a,u,h,p,y){const d=a.length;if(d<2*u)return null;const f=S=>{let C=0,N=0;for(let O=S;O<S+u&&O<d;O++)a[O]!==null&&(C+=a[O],N+=1);return N?C/N:null},w=f(0),k=f(u);if(w===null||k===null)return null;let P=w,G=(k-w)/u;const K=new Array(u).fill(0);for(let S=0;S<u;S++)K[S]=a[S]===null?0:a[S]-P;const q=K.reduce((S,C)=>S+C,0)/u;for(let S=0;S<u;S++)K[S]-=q;let B=0,E=0;for(let S=u;S<d;S++){const C=S%u,N=K[C],O=a[S];if(O===null){P+=G;continue}const T=P+G+N;B+=(O-T)**2,E+=1;const R=P;P=h*(O-N)+(1-h)*(P+G),G=p*(P-R)+(1-p)*G,K[C]=y*(O-P)+(1-y)*N}return{level:P,trend:G,season:K,phase:(d-1)%u,sse:B,count:E}}function o(a,u,h){let p=1;for(const d of u)p+=d*d;const y=Math.sqrt(a*p);return{se:y,margin:h*y}}function t(a,u={}){if(!a||typeof a.length!="number"||a.length===0)return null;const h=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,d=1-(1-y)/2,f=X(a),w=f.map(B=>B.value),k=w.filter(B=>B!==null),P=k.length,{lastAt:G,step:K}=P?F(f):{lastAt:0,step:1},q=B=>G+B*K;return h==="linear"?s(f,P,p,y,d,q):h==="movingAverage"?r(k,P,p,y,d,u,q):h==="ses"?i(w,P,p,y,d,u,q):h==="holt"?n(w,P,p,y,d,u,q):m(w,P,p,y,d,u,q)}function s(a,u,h,p,y,d){if(u<2)return null;let f=0,w=0;for(const O of a)O.value!==null&&(f+=O.at,w+=O.value);f/=u,w/=u;let k=0,P=0,G=0;for(const O of a){if(O.value===null)continue;const T=O.at-f,R=O.value-w;k+=T*T,P+=T*R,G+=R*R}if(k===0)return null;const K=P/k,q=w-K*f,B=G===0?1:Math.max(0,Math.min(1,P*P/(k*G))),E=Math.max(0,G-K*P),S=u>2?Math.sqrt(E/(u-2)):null,C=u>2?Y(y,u-2):null,N=[];for(let O=1;O<=h;O++){const T=d(O),R=q+K*T;let x=null,U=null,V=null,J=null,_=null;if(S!==null){const ee=1/u+(T-f)**2/k,W=S*Math.sqrt(1+ee),Z=S*Math.sqrt(ee);_=W,x=R-C*W,U=R+C*W,V=R-C*Z,J=R+C*Z}N.push({step:O,at:T,mean:R,lower:x,upper:U,lowerMean:V,upperMean:J,se:_})}return{method:"linear",horizon:h,confidence:p,n:u,sigma:S,r2:B,params:{slope:K,intercept:q},points:N}}function r(a,u,h,p,y,d,f){if(u<1)return null;const w=Math.max(1,Math.min(u,Math.floor(Number(d.windowLen)||u))),k=a.slice(u-w);let P=0;for(const S of k)P+=S;const G=P/w;let K=null,q=null;if(w>1){let S=0;for(const N of k)S+=(N-G)**2;K=Math.sqrt(S/(w-1))*Math.sqrt(1+1/w),q=Y(y,w-1)}const B=K===null?null:q*K,E=[];for(let S=1;S<=h;S++)E.push({step:S,at:f(S),mean:G,lower:B===null?null:G-B,upper:B===null?null:G+B,se:K});return{method:"movingAverage",horizon:h,confidence:p,n:u,sigma:K===null?null:K,params:{windowLen:w},points:E}}function i(a,u,h,p,y,d,f){if(u<1)return null;let w=Number.isFinite(d.alpha)?j(d.alpha):null;w===null&&(w=v(q=>b(a,q).sse));const k=b(a,w),P=A(y),G=k.m>0?k.sse/k.m:null,K=[];for(let q=1;q<=h;q++){const B=k.level;let E=null,S=null,C=null;if(G!==null){const N=[];for(let T=1;T<q;T++)N.push(w);const O=o(G,N,P);C=O.se,E=B-O.margin,S=B+O.margin}K.push({step:q,at:f(q),mean:B,lower:E,upper:S,se:C})}return{method:"ses",horizon:h,confidence:p,n:u,sigma:G===null?null:Math.sqrt(G),params:{alpha:w},points:K}}function n(a,u,h,p,y,d,f){if(u<2)return null;let w=Number.isFinite(d.alpha)?j(d.alpha):null,k=Number.isFinite(d.beta)?j(d.beta):null;if(w===null||k===null){let E=w===null?.5:w,S=k===null?.5:k;for(let C=0;C<6;C++)w===null&&(E=v(N=>l(a,N,S).sse)),k===null&&(S=v(N=>l(a,E,N).sse));w=w===null?E:w,k=k===null?S:k}const P=l(a,w,k),G=A(y),K=P.m>0?P.sse/P.m:null,q=w*k,B=[];for(let E=1;E<=h;E++){const S=P.level+E*P.trend;let C=null,N=null,O=null;if(K!==null){const T=[];for(let x=1;x<E;x++)T.push(w+x*q);const R=o(K,T,G);O=R.se,C=S-R.margin,N=S+R.margin}B.push({step:E,at:f(E),mean:S,lower:C,upper:N,se:O})}return{method:"holt",horizon:h,confidence:p,n:u,sigma:K===null?null:Math.sqrt(K),params:{alpha:w,beta:k},points:B}}function m(a,u,h,p,y,d,f){const w=Math.floor(Number(d.period));if(!(w>=2))return L("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(u<2*w)return null;let k=Number.isFinite(d.alpha)?j(d.alpha):null,P=Number.isFinite(d.beta)?j(d.beta):null,G=Number.isFinite(d.gamma)?j(d.gamma):null;const K=(O,T,R)=>{const x=g(a,w,O,T,R);return x?x.sse:1/0};if(k===null||P===null||G===null){let O=k===null?.5:k,T=P===null?.5:P,R=G===null?.5:G;for(let x=0;x<8;x++)k===null&&(O=v(U=>K(U,T,R))),P===null&&(T=v(U=>K(O,U,R))),G===null&&(R=v(U=>K(O,T,U)));k=k===null?O:k,P=P===null?T:P,G=G===null?R:G}const q=g(a,w,k,P,G);if(!q)return null;const B=A(y),E=q.count>0?q.sse/q.count:null,S=k*P,C=G*(1-k),N=[];for(let O=1;O<=h;O++){const T=q.season[(q.phase+O)%w],R=q.level+O*q.trend+T;let x=null,U=null,V=null;if(E!==null){const J=[];for(let ee=1;ee<O;ee++)J.push(k+ee*S+(ee%w===0?C:0));const _=o(E,J,B);V=_.se,x=R-_.margin,U=R+_.margin}N.push({step:O,at:f(O),mean:R,lower:x,upper:U,se:V})}return{method:"holtWinters",horizon:h,confidence:p,n:u,sigma:E===null?null:Math.sqrt(E),params:{alpha:k,beta:P,gamma:G,period:w},points:N}}const c={FORECAST_METHODS:Q,forecast:t}}),Ve("packages/core/src/compute/hypothesis.js",function(e,D){"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 a}}),Object.defineProperty(e,"welchTTest",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"mannWhitneyUTest",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"chiSquareTest",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return B}});const A=D("packages/core/src/internal/warn.js").warnOnce,I=D("packages/core/src/compute/handle.js").valueReader,L=D("packages/core/src/compute/statistics.js"),Q=L.numbers,H=L.moments,$=L.frequencyMap,X=L.categoricalDistance,F=L.isNumericColumn,j=L.jarqueBera,v=L.proportionInterval,b=L.SUBSET_RELIABILITY_FLOOR,g=D("packages/core/src/compute/compare.js").pooledStandardMeanDifference,o=D("packages/core/src/compute/special.js"),t=o.studentT,s=o.studentTQuantile,r=o.normalCdf,i=o.normalQuantile,n=o.chiSquareUpperTail,m=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),c=.05,a=2e6;function u(E){const S=Number(E);return Number.isFinite(S)&&S>0&&S<1?S:.95}function h(E){const{n:S,mean:C,m2:N}=H(E);return{mean:C,sd:S>0?Math.sqrt(N/S):0,n:S}}function p(E,S){const C=E.length;if(C<2)return 0;let N=0;for(let O=0;O<C;O++){const T=E[O]-S;N+=T*T}return N/(C-1)}function y(E,S){return{name:"pooledStandardMeanDifference",value:g(h(E),h(S))}}function d(E,S,C){const N=E.length,O=S.length;if(N<2||O<2)return null;const T=u(C),{mean:R}=H(E),{mean:x}=H(S),U=p(E,R),V=p(S,x),J=U/N+V/O;if(!(J>0))return null;const _=Math.sqrt(J),ee=(R-x)/_,W=U/N*(U/N)/(N-1),Z=V/O*(V/O)/(O-1),ne=J*J/(W+Z),ie=Math.min(1,Math.max(0,2*(1-t(Math.abs(ee),ne)))),ce=R-x,me=s(1-(1-T)/2,ne)*_;return{test:m.WELCH,statistic:ee,statisticName:"t",df:ne,pValue:ie,interval:{estimate:ce,lower:ce-me,upper:ce+me,confidence:T,method:"welch-t (difference of means)"},effectSize:y(E,S),nA:N,nB:O,reliable:N>=b&&O>=b,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function f(E){const S=E.length;if(S===0)return Number.NaN;const C=S>>1;return S%2?E[C]:(E[C-1]+E[C])/2}function w(E,S,C){const N=E.length,O=S.length,T=N*O;if(T===0||T>a)return null;const R=new Float64Array(T);let x=0;for(let W=0;W<N;W++)for(let Z=0;Z<O;Z++)R[x++]=E[W]-S[Z];R.sort();const U=f(R),V=Math.sqrt(N*O*(N+O+1)/12),J=i(1-(1-C)/2);let _=Math.round(T/2-J*V);_>=0||(_=0);const ee=Math.floor((T-1)/2);return _>ee&&(_=ee),{estimate:U,lower:R[_],upper:R[T-1-_],confidence:C,method:"hodges-lehmann (normal approximation)"}}function k(E,S,C){const N=E.length,O=S.length;if(N<1||O<1)return null;const T=u(C),R=N+O,x=new Array(R);for(let ie=0;ie<N;ie++)x[ie]={v:E[ie],g:0};for(let ie=0;ie<O;ie++)x[N+ie]={v:S[ie],g:1};x.sort((ie,ce)=>ie.v-ce.v);let U=0,V=0,J=0;for(;J<R;){let ie=J;for(;ie<R&&x[ie].v===x[J].v;)ie++;const ce=ie-J,me=(J+1+ie)/2;for(let Ce=J;Ce<ie;Ce++)x[Ce].g===0&&(U+=me);V+=ce*ce*ce-ce,J=ie}const _=U-N*(N+1)/2,ee=N*O/2,W=N*O/12*(R+1-V/(R*(R-1)));let Z=1;if(W>0){const ie=Math.max(0,Math.abs(_-ee)-.5);Z=Math.min(1,2*r(-ie/Math.sqrt(W)))}const ne=w(E,S,T);return{test:m.MANN_WHITNEY,statistic:_,statisticName:"U",df:null,pValue:Z,interval:ne,effectSize:y(E,S),nA:N,nB:O,reliable:N>=b&&O>=b,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function P(E,S,C,N,O){const T=v(E,S,O),R=v(C,N,O);if(!T||!R)return null;const x=T.proportion-R.proportion,U=x-Math.sqrt((T.proportion-T.lower)**2+(R.upper-R.proportion)**2),V=x+Math.sqrt((T.upper-T.proportion)**2+(R.proportion-R.lower)**2);return{lower:U,upper:V}}function G(E,S,C,N,O,T={}){if(!(S>0)||!(N>0))return null;const R=new Set([...E.keys(),...C.keys()]),x=R.size;if(x<2)return null;const U=S+N;let V=0;for(const Z of R){const ne=E.get(Z)||0,ie=C.get(Z)||0,ce=ne+ie,me=S*ce/U,Ce=N*ce/U;me>0&&(V+=(ne-me)*(ne-me)/me),Ce>0&&(V+=(ie-Ce)*(ie-Ce)/Ce)}const J=x-1,_=n(V,J);let ee=null;T.category!==void 0&&R.has(T.category)?ee=T.category:x===2&&([ee]=[...R]);let W=null;if(ee!==null){const Z=P(E.get(ee)||0,S,C.get(ee)||0,N,u(O));Z&&(W={estimate:(E.get(ee)||0)/S-(C.get(ee)||0)/N,lower:Z.lower,upper:Z.upper,confidence:u(O),method:"newcombe (difference in this category's share)",category:ee})}return{test:m.CHI_SQUARE,statistic:V,statisticName:"chiSquare",df:J,pValue:_,interval:W,effectSize:{name:"categoricalTotalVariation",value:X(E,S,C,N)},nA:S,nB:N,reliable:S>=b&&N>=b,method:"Pearson chi-square test of independence (2×k, no continuity correction)"}}function K(E){return E==null||E===""||typeof E=="number"&&Number.isNaN(E)?null:E instanceof Date?E.getTime():typeof E=="object"?String(E):E}function q(E,S,C){if(C===m.WELCH||C===m.MANN_WHITNEY)return{test:C,chosenBy:"override",reason:`caller override: ${C}`};const N=j(E),O=j(S),T=N===null?null:Math.exp(-N/2),R=O===null?null:Math.exp(-O/2);return T!==null&&T<c||R!==null&&R<c?{test:m.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${c})`}:{test:m.WELCH,chosenBy:"auto",reason:T!==null||R!==null?"column family: numeric, no departure from normality detected":"column family: numeric (too few rows to screen normality)"}}function B(E,S,C,N={}){if(!E||!S)return null;const O=u(N.confidence),T=I(S);let R;if(Array.isArray(N.groups)&&N.groups.length===2)R=[K(N.groups[0]),K(N.groups[1])];else{const{map:ie}=$(S,C),ce=[...ie.entries()].sort((me,Ce)=>Ce[1]-me[1]).slice(0,2).map(me=>me[0]);if(ce.length<2)return A("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;R=ce}const[x,U]=R;if(x===null||U===null||x===U)return A("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const V=[],J=[];for(let ie=0;ie<C.length;ie++){const ce=K(T(C[ie]));ce===x?V.push(C[ie]):ce===U&&J.push(C[ie])}if(V.length===0||J.length===0)return A("compareGroups:empty","[lattice] compareGroups: one of the two groups has no rows in the current set."),null;const _=N.test&&N.test!=="auto"?String(N.test):null,ee=F(E,V.concat(J));let W,Z,ne;if(_===m.CHI_SQUARE||!_&&!ee){Z=_?"override":"auto",ne=_?"caller override: chiSquare":"column family: categorical";const ie=$(E,V),ce=$(E,J);W=G(ie.map,ie.total,ce.map,ce.total,O,{category:N.category})}else{if((_===m.WELCH||_===m.MANN_WHITNEY)&&!ee)return A("compareGroups:numeric-override",`[lattice] compareGroups: ${_} needs a numeric column, but the column is not numeric.`),null;const ie=Q(E,V),ce=Q(E,J),me=q(ie,ce,_);Z=me.chosenBy,ne=me.reason,W=me.test===m.MANN_WHITNEY?k(ie,ce,O):d(ie,ce,O)}return W?{...W,chosenBy:Z,reason:ne,groups:[x,U]}:(A("compareGroups:degenerate","[lattice] compareGroups: the chosen test had too little to work with (too few values, or no variation)."),null)}}),Ve("packages/core/src/compute/significance.js",function(e,D){"use strict";Object.defineProperty(e,"COMPARE_TESTS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"compare",{enumerable:!0,get:function(){return Pe}});const A=D("packages/core/src/internal/warn.js").warnOnce,I=D("packages/core/src/compute/handle.js").valueReader,L=D("packages/core/src/compute/statistics.js"),Q=L.numbers,H=L.moments,$=L.frequencyMap,X=L.isNumericColumn,F=L.jarqueBera,j=L.proportionInterval,v=D("packages/core/src/compute/special.js"),b=v.studentT,l=v.studentTQuantile,g=v.normalCdf,o=v.normalQuantile,t=v.chiSquareUpperTail,s=v.incompleteBeta,r=Object.freeze({T:"t",WELCH:"welch",MANN_WHITNEY:"mannWhitney",ANOVA:"anova",KRUSKAL:"kruskal",CHI_SQUARE:"chiSquare",PROPORTIONS:"proportions"}),i=new Set([r.T,r.WELCH,r.MANN_WHITNEY]),n=new Set([r.ANOVA,r.KRUSKAL]),m=new Set([r.CHI_SQUARE,r.PROPORTIONS]),c=.05,a=[.2,.5,.8],u=[.147,.33,.474],h=[.01,.06,.14],p=[[.1,.3,.5],[.07,.21,.35],[.06,.17,.29],[.05,.15,.25]];function y(ve){const oe=Number(ve);return Number.isFinite(oe)&&oe>0&&oe<1?oe:.05}function d(ve){return ve==null||ve===""||typeof ve=="number"&&Number.isNaN(ve)?null:ve instanceof Date?ve.getTime():typeof ve=="object"?String(ve):ve}function f(ve,oe){const he=I(ve),ae=[],se=new Map;for(let de=0;de<oe.length;de++){const ke=d(he(oe[de]));if(ke===null)continue;let Ae=se.get(ke);Ae||(Ae={value:ke,rows:[]},se.set(ke,Ae),ae.push(Ae)),Ae.rows.push(oe[de])}return ae}function w(ve){const{n:oe,mean:he,m2:ae}=H(ve),se=oe>1?ae/(oe-1):0;return{n:oe,mean:he,sd:Math.sqrt(se),variance:se}}function k(ve,oe,he){if(!(oe>0)||!(he>0)||!(ve>=0)||!Number.isFinite(ve))return Number.NaN;if(ve===0)return 1;const ae=oe*ve/(oe*ve+he);return 1-s(oe/2,he/2,ae)}function P(ve,oe){const he=Math.abs(ve);return Number.isFinite(he)?he>=oe[2]?"large":he>=oe[1]?"medium":he>=oe[0]?"small":"negligible":"negligible"}function G(ve,oe,he){if(ve==="cohensD")return P(oe,a);if(ve==="cliffsDelta")return P(oe,u);if(ve==="etaSquared")return P(oe,h);const ae=Math.max(1,Math.min(p.length,Math.floor(he||1)));return P(oe,p[ae-1])}function K(ve,oe){if(!(ve.n>1)||!(oe.n>1))return null;const he=((ve.n-1)*ve.variance+(oe.n-1)*oe.variance)/(ve.n+oe.n-2);return he>0?(ve.mean-oe.mean)/Math.sqrt(he):null}function q(ve,oe){const he=ve.length,ae=oe.length;if(!he||!ae)return null;const se=Array.from(oe).sort((Ae,Te)=>Ae-Te);let de=0,ke=0;for(let Ae=0;Ae<he;Ae++){const Te=ve[Ae];let je=0,ye=ae;for(;je<ye;){const Ee=je+ye>>1;se[Ee]<Te?je=Ee+1:ye=Ee}const He=je;let Me=je;for(;Me<ae&&se[Me]===Te;)Me++;const Re=Me-je;de+=He,ke+=ae-Me}return(de-ke)/(he*ae)}function B(ve,oe,he,ae){const se=Math.min(he-1,ae-1);return!(oe>0)||!(se>0)?null:Math.sqrt(ve/(oe*se))}function E(ve){return Number.isFinite(ve)?ve<.001?"p < 0.001":ve>=.995?"p > 0.995":`p = ${ve.toFixed(3)}`:"p = —"}function S(ve){if(!Number.isFinite(ve))return"0";const oe=Math.abs(ve);return oe===0?"0":oe>=1e3?String(Math.round(ve)):oe>=100?String(Number(ve.toFixed(0))):oe>=10?String(Number(ve.toFixed(1))):oe>=1?String(Number(ve.toFixed(2))):String(Number(ve.toPrecision(2)))}const C=new Set(["cohensD","cliffsDelta"]);function N(ve){if(ve.difference!=null&&Math.abs(ve.difference)>=1e-12)return Math.sign(ve.difference);const oe=ve.effectSize;if(oe&&C.has(oe.name)&&Number.isFinite(oe.value)&&Math.abs(oe.value)>=1e-12)return Math.sign(oe.value);const[he,ae]=ve.groups;return Number.isFinite(he.mean)&&Number.isFinite(ae.mean)&&he.mean!==ae.mean?Math.sign(he.mean-ae.mean):0}function O(ve){const oe=ve.measureName||"values";return{subject:oe.charAt(0).toUpperCase()+oe.slice(1),be:oe==="values"?"are":"is",name:oe}}function T(ve,oe){const he=oe.unit?` ${oe.unit}`:"",{subject:ae,be:se}=O(oe),de=ve.groups[0].label,ke=ve.groups[1].label,Ae=ve.effectSize?ve.effectSize.label:"negligible",Te=ve.pValue<ve.alpha,je=Te?"unlikely to be chance":"consistent with chance";if(!Te&&Ae==="negligible")return`${ae} ${se} essentially the same for ${de} and ${ke} (${E(ve.pValue)}); the effect is ${Ae}.`;const ye=N(ve),He=`the difference is ${je} (${E(ve.pValue)}) and the effect is ${Ae}.`;if(ye===0)return`${ae} ${se} different between ${de} and ${ke}; ${He}`;const Me=ye>0?de:ke,Re=ye>0?ke:de,Ee=ve.difference!=null&&Math.abs(ve.difference)>=1e-12,$e=Math.abs(ve.difference),Ie=Ee?typeof oe.formatValue=="function"?` by about ${oe.formatValue($e)}${he}`:` by about ${S($e)}${he}`:"";return`${ae} ${se} higher for ${Me} than for ${Re}${Ie}; ${He}`}function R(ve,oe){const{name:he}=O(oe),ae=ve.effectSize?ve.effectSize.label:"negligible",se=E(ve.pValue);return ve.pValue<ve.alpha?`The groups differ in ${he}; the difference is unlikely to be chance (${se}) and the effect is ${ae}.`:ae==="negligible"?`The groups are essentially the same in ${he} (${se}); the effect is ${ae}.`:`The groups show a ${ae} effect in ${he}, but the difference is consistent with chance (${se}).`}function x(ve,oe){const he=ve.length;if(he<2)return null;const{mean:ae,m2:se}=H(ve),de=se/(he-1);if(!(de>0))return null;const ke=Math.sqrt(de),Ae=ke/Math.sqrt(he),Te=ae/Ae,je=he-1,ye=Math.min(1,Math.max(0,2*(1-b(Math.abs(Te),je)))),He=l(1-oe/2,je)*Ae,Me=ae/ke;return{test:r.T,statistic:Te,statisticName:"t",df:je,pValue:ye,difference:ae,interval:{estimate:ae,lower:ae-He,upper:ae+He,confidence:1-oe,method:"paired-t (mean of the pair differences)"},effectSize:{name:"cohensD",label:P(Me,a),value:Me}}}function U(ve,oe){const he=Array.from(ve).filter($e=>$e!==0),ae=he.length;if(!ae)return null;const se=Array.from({length:ae},($e,Ie)=>Ie).sort(($e,Ie)=>Math.abs(he[$e])-Math.abs(he[Ie])),de=new Array(ae);let ke=0;for(;ke<ae;){let $e=ke;for(;$e+1<ae&&Math.abs(he[se[$e+1]])===Math.abs(he[se[ke]]);)$e++;const Ie=(ke+$e)/2+1;for(let We=ke;We<=$e;We++)de[se[We]]=Ie;ke=$e+1}let Ae=0,Te=0;for(let $e=0;$e<ae;$e++)Te+=de[$e],he[$e]>0&&(Ae+=de[$e]);const je=Te-Ae,ye=ae*(ae+1)/4,He=Math.sqrt(ae*(ae+1)*(2*ae+1)/24),Me=He>0?(Math.abs(Ae-ye)-.5)/He:0,Re=Math.min(1,Math.max(0,2*g(-Math.max(0,Me)))),Ee=Te>0?(Ae-je)/Te:0;return{test:r.MANN_WHITNEY,statistic:Ae,statisticName:"W",df:null,pValue:Re,difference:null,interval:null,effectSize:{name:"cliffsDelta",label:P(Ee,u),value:Ee}}}function V(ve,oe,he){const ae=w(ve),se=w(oe);if(ae.n<2||se.n<2)return null;const de=((ae.n-1)*ae.variance+(se.n-1)*se.variance)/(ae.n+se.n-2);if(!(de>0))return null;const ke=Math.sqrt(de*(1/ae.n+1/se.n)),Ae=(ae.mean-se.mean)/ke,Te=ae.n+se.n-2,je=Math.min(1,Math.max(0,2*(1-b(Math.abs(Ae),Te)))),ye=ae.mean-se.mean,He=l(1-he/2,Te)*ke,Me=K(ae,se);return{test:r.T,statistic:Ae,statisticName:"t",df:Te,pValue:je,difference:ye,interval:{estimate:ye,lower:ye-He,upper:ye+He,confidence:1-he,method:"student-t (pooled variance, difference of means)"},effectSize:{name:"cohensD",label:P(Me,a),value:Me},summaries:[ae,se]}}function J(ve,oe,he){const ae=w(ve),se=w(oe);if(ae.n<2||se.n<2)return null;const de=ae.variance/ae.n+se.variance/se.n;if(!(de>0))return null;const ke=Math.sqrt(de),Ae=(ae.mean-se.mean)/ke,Te=ae.variance/ae.n*(ae.variance/ae.n)/(ae.n-1),je=se.variance/se.n*(se.variance/se.n)/(se.n-1),ye=de*de/(Te+je),He=Math.min(1,Math.max(0,2*(1-b(Math.abs(Ae),ye)))),Me=ae.mean-se.mean,Re=l(1-he/2,ye)*ke,Ee=K(ae,se);return{test:r.WELCH,statistic:Ae,statisticName:"t",df:ye,pValue:He,difference:Me,interval:{estimate:Me,lower:Me-Re,upper:Me+Re,confidence:1-he,method:"welch-t (unequal variances, difference of means)"},effectSize:{name:"cohensD",label:P(Ee,a),value:Ee},summaries:[ae,se]}}function _(ve,oe,he){const ae=ve.length,se=oe.length;if(ae<1||se<1)return null;const de=w(ve),ke=w(oe),Ae=ae+se,Te=new Array(Ae);for(let We=0;We<ae;We++)Te[We]={v:ve[We],g:0};for(let We=0;We<se;We++)Te[ae+We]={v:oe[We],g:1};Te.sort((We,Ye)=>We.v-Ye.v);let je=0,ye=0,He=0;for(;He<Ae;){let We=He;for(;We<Ae&&Te[We].v===Te[He].v;)We++;const Ye=(He+1+We)/2;for(let Qe=He;Qe<We;Qe++)Te[Qe].g===0&&(je+=Ye);const nt=We-He;ye+=nt*nt*nt-nt,He=We}const Me=je-ae*(ae+1)/2,Re=ae*se/2,Ee=ae*se/12*(Ae+1-ye/(Ae*(Ae-1)));let $e=1;if(Ee>0){const We=Math.max(0,Math.abs(Me-Re)-.5);$e=Math.min(1,2*g(-We/Math.sqrt(Ee)))}const Ie=q(ve,oe);return{test:r.MANN_WHITNEY,statistic:Me,statisticName:"U",df:null,pValue:$e,difference:null,interval:ee(ve,oe,1-he),effectSize:{name:"cliffsDelta",label:P(Ie,u),value:Ie},summaries:[de,ke]}}function ee(ve,oe,he){const ae=ve.length,se=oe.length,de=ae*se;if(de===0||de>2e6)return null;const ke=new Float64Array(de);let Ae=0;for(let Ee=0;Ee<ae;Ee++)for(let $e=0;$e<se;$e++)ke[Ae++]=ve[Ee]-oe[$e];ke.sort();const Te=de>>1,je=de%2?ke[Te]:(ke[Te-1]+ke[Te])/2,ye=Math.sqrt(ae*se*(ae+se+1)/12),He=o(1-(1-he)/2);let Me=Math.round(de/2-He*ye);Me>=0||(Me=0);const Re=Math.floor((de-1)/2);return Me>Re&&(Me=Re),{estimate:je,lower:ke[Me],upper:ke[de-1-Me],confidence:he,method:"hodges-lehmann (location shift)"}}function W(ve,oe){const he=ve.length,ae=ve.map(w);if(ae.some($e=>$e.n<2))return null;const se=ae.reduce(($e,Ie)=>$e+Ie.n,0),de=ae.reduce(($e,Ie)=>$e+Ie.mean*Ie.n,0)/se;let ke=0,Ae=0;for(let $e=0;$e<he;$e++)ke+=ae[$e].n*(ae[$e].mean-de)**2,Ae+=(ae[$e].n-1)*ae[$e].variance;const Te=he-1,je=se-he;if(!(Ae>0)||je<1)return null;const ye=ke/Te,He=Ae/je,Me=ye/He,Re=Math.min(1,Math.max(0,k(Me,Te,je))),Ee=ke/(ke+Ae);return{test:r.ANOVA,statistic:Me,statisticName:"F",df:{between:Te,within:je},pValue:Re,difference:null,interval:null,effectSize:{name:"etaSquared",label:P(Ee,h),value:Ee},summaries:ae}}function Z(ve,oe){const he=ve.length,ae=ve.map(w);if(he<2)return null;const se=ae.reduce((Ie,We)=>Ie+We.n,0),de=[];for(let Ie=0;Ie<he;Ie++)for(let We=0;We<ve[Ie].length;We++)de.push({v:ve[Ie][We],g:Ie});de.sort((Ie,We)=>Ie.v-We.v);const ke=new Array(de.length);let Ae=0,Te=0;for(;Te<de.length;){let Ie=Te;for(;Ie<de.length&&de[Ie].v===de[Te].v;)Ie++;const We=(Te+1+Ie)/2;for(let nt=Te;nt<Ie;nt++)ke[nt]=We;const Ye=Ie-Te;Ae+=Ye*Ye*Ye-Ye,Te=Ie}const je=new Array(he).fill(0);for(let Ie=0;Ie<de.length;Ie++)je[de[Ie].g]+=ke[Ie];let ye=0;for(let Ie=0;Ie<he;Ie++)ye+=je[Ie]*je[Ie]/ae[Ie].n;ye=12/(se*(se+1))*ye-3*(se+1);const He=1-Ae/(se*se*se-se),Me=He>0?ye/He:ye,Re=he-1,Ee=Math.min(1,Math.max(0,t(Me,Re))),$e=(Me-he+1)/(se-he);return{test:r.KRUSKAL,statistic:Me,statisticName:"H",df:Re,pValue:Ee,difference:null,interval:null,effectSize:{name:"etaSquared",label:P($e,h),value:Math.max(0,$e)},summaries:ae}}function ne(ve,oe,he,ae,se){const de=j(ve,oe,se),ke=j(he,ae,se);if(!de||!ke)return null;const Ae=de.proportion-ke.proportion,Te=Ae-Math.sqrt((de.proportion-de.lower)**2+(ke.upper-ke.proportion)**2),je=Ae+Math.sqrt((de.upper-de.proportion)**2+(ke.proportion-ke.lower)**2);return{estimate:Ae,lower:Te,upper:je}}function ie(ve,oe,he,ae){const se=I(oe),de=new Set,ke=[];for(const We of ve){const Ye=new Map;let nt=0;for(const Qe of We.rows){const dt=d(se(Qe));dt!==null&&(Ye.set(dt,(Ye.get(dt)||0)+1),nt++,de.add(dt))}ke.push(Ye),We.total=nt}const Ae=[...de];if(Ae.length<2)return null;const Te=ve.reduce((We,Ye)=>We+Ye.total,0);if(!(Te>0))return null;let je=0;for(const We of ve)for(const Ye of Ae){const nt=ke[ve.indexOf(We)].get(Ye)||0,Qe=ve.reduce((jt,Et)=>jt+(ke[ve.indexOf(Et)].get(Ye)||0),0),dt=We.total*Qe/Te;dt>0&&(je+=(nt-dt)*(nt-dt)/dt)}const ye=ve.length,He=Ae.length,Me=(ye-1)*(He-1),Re=Math.min(1,Math.max(0,t(je,Me))),Ee=B(je,Te,ye,He);let $e=null;if(ye===2&&He===2){const[We]=Ae,Ye=ke[0].get(We)||0,nt=ke[1].get(We)||0,Qe=ne(Ye,ve[0].total,nt,ve[1].total,ae);Qe&&($e={...Qe,confidence:ae,method:"newcombe (difference in this category's share)",category:We})}const Ie=ve.map((We,Ye)=>{const nt={};for(const Qe of Ae)nt[String(Qe)]=(ke[Ye].get(Qe)||0)/We.total;return nt});return{test:r.CHI_SQUARE,statistic:je,statisticName:"chiSquare",df:Me,pValue:Re,difference:null,interval:$e,effectSize:{name:"cramersV",label:G("cramersV",Ee,Math.min(ye-1,He-1)),value:Ee},proportions:Ie}}function ce(ve,oe,he,ae){const se=I(oe),de=new Set;for(const Qe of ve)for(const dt of Qe.rows){const jt=d(se(dt));jt!==null&&de.add(jt)}if(de.size!==2)return null;const[ke]=[...de],Ae=ve[0].rows.reduce((Qe,dt)=>Qe+(d(se(dt))===ke?1:0),0),Te=ve[1].rows.reduce((Qe,dt)=>Qe+(d(se(dt))===ke?1:0),0),je=ve[0].rows.length,ye=ve[1].rows.length;if(!(je>0)||!(ye>0))return null;const He=Ae/je,Me=Te/ye,Re=(Ae+Te)/(je+ye);if(!(Re>0)||!(Re<1))return null;const Ee=Math.sqrt(Re*(1-Re)*(1/je+1/ye)),$e=(He-Me)/Ee,Ie=Math.min(1,Math.max(0,2*g(-Math.abs($e)))),We=He-Me,Ye=ne(Ae,je,Te,ye,ae),nt=B($e*$e,je+ye,2,2);return{test:r.PROPORTIONS,statistic:$e,statisticName:"z",df:null,pValue:Ie,difference:We,interval:Ye?{...Ye,confidence:ae,method:"newcombe (difference in proportions)",category:ke}:null,effectSize:{name:"cramersV",label:G("cramersV",nt,1),value:nt},proportions:[{[String(ke)]:He},{[String(ke)]:Me}],focalCategory:ke}}function me(ve,oe,he,ae){if(he&&i.has(he))return{test:he,reason:`caller override: ${he}`};const se=F(ve),de=F(oe),ke=se===null?null:Math.exp(-se/2),Ae=de===null?null:Math.exp(-de/2);if(ke!==null&&ke<c||Ae!==null&&Ae<c)return{test:r.MANN_WHITNEY,reason:"two numeric groups, non-normal by Jarque-Bera"};const Te=w(ve),je=w(oe);if(Te.n>=3&&je.n>=3&&Te.variance>0&&je.variance>0){const ye=Math.max(Te.variance,je.variance)/Math.min(Te.variance,je.variance),He=Te.variance>=je.variance?Te.n-1:je.n-1,Me=Te.variance>=je.variance?je.n-1:Te.n-1;if(2*Math.min(k(ye,He,Me),1-k(ye,He,Me))<ae)return{test:r.WELCH,reason:"two numeric groups, unequal variances (F-test)"}}return{test:r.T,reason:ke!==null||Ae!==null?"two numeric groups, equal variances and no departure from normality":"two numeric groups (too few rows to screen normality)"}}function Ce(ve,oe){if(oe&&n.has(oe))return{test:oe,reason:`caller override: ${oe}`};for(const he of ve){const ae=F(he),se=ae===null?null:Math.exp(-ae/2);if(se!==null&&se<c)return{test:r.KRUSKAL,reason:"three or more numeric groups, non-normal by Jarque-Bera"}}return{test:r.ANOVA,reason:"three or more numeric groups, no departure from normality detected"}}function Pe(ve,oe,he,ae={},se=null){if(!ve||!oe)return null;const de=y(ae.alpha),ke=1-de,Ae=ae.test&&ae.test!=="auto"?String(ae.test):null,Te=f(oe,he);if(Te.length<2)return A("compare:groups",'[lattice] statistics.compare: the "by" column has fewer than two distinct values to group by.'),null;let je;if(Array.isArray(ae.groups)&&ae.groups.length===2){const Ye=[d(ae.groups[0]),d(ae.groups[1])];if(Ye[0]===null||Ye[1]===null||Ye[0]===Ye[1])return A("compare:distinct","[lattice] statistics.compare: the two groups must be two distinct, present values."),null;if(je=Te.filter(nt=>nt.value===Ye[0]||nt.value===Ye[1]),je.length!==2)return A("compare:empty","[lattice] statistics.compare: one of the two groups has no rows in the current set."),null;je.sort((nt,Qe)=>nt.value===Ye[0]?-1:1)}else Te.length===2||Ae&&i.has(Ae)||Ae&&m.has(Ae)?je=Te.slice(0,2):(Ae&&n.has(Ae),je=Te);const He=X(ve,he),Me=!!ae.paired&&se&&je.length===2&&He;let Re,Ee,$e;if(He)if(je.length===2&&!(Ae&&n.has(Ae))){const Ye=Q(ve,je[0].rows),nt=Q(ve,je[1].rows);if(Ye.length<3||nt.length<3)return A("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;if(w(Ye).variance===0||w(nt).variance===0)return A("compare:zero-variance","[lattice] statistics.compare: a group has zero variance, so the difference has no scale to test."),null;if(Me){const dt=_e(ve,se,je[0].rows,je[1].rows);return dt?(Ee=Ae?"override":"auto",$e=Ae?`caller override: ${Ae} (paired)`:"two numeric groups, paired",Re=Ae===r.MANN_WHITNEY?U(dt.diffs,de):x(dt.diffs,de),Re?(Re.paired=!0,Re.chosenBy=Ee,Re.reason=$e,Re.groups=[{value:je[0].value,label:String(je[0].value),n:dt.n},{value:je[1].value,label:String(je[1].value),n:dt.n}],Re.alpha=de,Re.method=Re.test===r.MANN_WHITNEY?"Wilcoxon signed-rank test (paired)":"Student's paired t-test (difference of pairs)",Re.verdict=T(Re,ae),Re.categorical=!1,Re):(A("compare:degenerate","[lattice] statistics.compare: the paired test had too little to work with."),null)):(A("compare:paired","[lattice] statistics.compare: not enough matched pairs to run a paired test."),null)}const Qe=me(Ye,nt,Ae,de);Ee=Ae?"override":"auto",$e=Qe.reason,Qe.test===r.MANN_WHITNEY?Re=_(Ye,nt,de):Qe.test===r.WELCH?Re=J(Ye,nt,de):Re=V(Ye,nt,de),Re&&Re.interval&&Re.difference===null&&(Re.difference=Re.interval.estimate)}else{const Ye=je.map(Qe=>Q(ve,Qe.rows));if(Ye.some(Qe=>Qe.length<3))return A("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;const nt=Ce(Ye,Ae);Ee=Ae?"override":"auto",$e=nt.reason,Re=nt.test===r.KRUSKAL?Z(Ye,de):W(Ye,de)}else if(je.length===2){const Ye=xe(ve,je).size===2;if(Ae===r.PROPORTIONS||Ye&&!Ae)Ee=Ae?"override":"auto",$e=Ae?"caller override: proportions":"categorical measure with two categories (binary)",Re=ce(je,ve,de,ke);else if(Ae===r.CHI_SQUARE||!Ye&&!Ae)Ee=Ae?"override":"auto",$e=Ae?"caller override: chiSquare":`categorical measure with ${xe(ve,je).size} categories`,Re=ie(je,ve,de,ke);else return A("compare:numeric-needed",`[lattice] statistics.compare: ${Ae} needs a numeric measure, but the column is categorical.`),null}else Ee=Ae?"override":"auto",$e=Ae?`caller override: ${Ae}`:`categorical measure with ${xe(ve,je).size} categories`,Re=ie(je,ve,de,ke);if(!Re)return A("compare:degenerate","[lattice] statistics.compare: the chosen test had too little to work with (too few values, or no variation)."),null;const Ie=Re.summaries,We=Re.proportions;return{test:Re.test,chosenBy:Ee,reason:$e,statistic:Re.statistic,statisticName:Re.statisticName,df:Re.df===void 0?null:Re.df,pValue:Re.pValue,alpha:de,paired:!1,interval:Re.interval||null,effectSize:Re.effectSize,groups:je.map((Ye,nt)=>({value:Ye.value,label:String(Ye.value),n:Ie?Ie[nt].n:Ye.total,...Ie?{mean:Ie[nt].mean,sd:Ie[nt].sd}:{},...We?{proportions:We[nt]}:{}})),difference:Re.difference===void 0?null:Re.difference,method:Re.test,categorical:!He,verdict:je.length===2?T({...Re,alpha:de,groups:[{value:je[0].value,label:String(je[0].value),mean:Ie?Ie[0].mean:void 0},{value:je[1].value,label:String(je[1].value),mean:Ie?Ie[1].mean:void 0}],categorical:!He,difference:Re.difference===void 0?null:Re.difference},ae):R({...Re,alpha:de},ae)}}function xe(ve,oe){const he=I(ve),ae=new Set;for(const se of oe)for(const de of se.rows){const ke=d(he(de));ke!==null&&ae.add(ke)}return ae}function _e(ve,oe,he,ae){const se=I(oe),de=I(ve),ke=new Map;for(const Te of ae){const je=d(se(Te));je!==null&&ke.set(je,de(Te))}const Ae=[];for(const Te of he){const je=d(se(Te));if(je===null||!ke.has(je))continue;const ye=Number(de(Te)),He=Number(ke.get(je));!Number.isFinite(ye)||!Number.isFinite(He)||Ae.push(ye-He)}return Ae.length<2?null:{diffs:Float64Array.from(Ae),n:Ae.length}}}),Ve("packages/core/src/columns/detailcolumn.js",function(e,D){"use strict";Object.defineProperty(e,"DETAIL_COLUMN_ID",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"createDetailColumn",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return I}});const re="__lattice_detail",A=36;function Y(L){const Q=L.config&&L.config.detailColumnWidth||A;return{id:re,field:null,title:"",type:"text",dataType:{base:"text"},nullable:!0,align:"center",generated:!0,control:!0,detailExpander:!0,value:{pure:!0},cell:{render:"detailExpander",align:"center"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:Q,min:Q,max:Q,pin:L.config&&L.config.detailColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(H,$){return!!($&&$.expanded)},formatValue(){return""}}}const I=Y}),Ve("packages/core/src/columns/treecolumn.js",function(e,D){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"createTreeColumn",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Q}});const A=D("packages/core/src/internal/predicates.js").isFunction,Y="__lattice_tree",I=260;function L(H){const $=H.tree||{},X=H.config&&H.config.treeColumnWidth||I,F=!!(H.config&&H.config.treeColumnFlex),j=()=>(H.columns&&A(H.columns.visible)?H.columns.visible():[]).find(g=>!g.generated)||null,v=(l,g)=>{if(g&&g.group)return g.groupValue;if(A($.label))return $.label(l,g);if(typeof $.label=="string")return l==null?null:l[$.label];const o=j();return o&&A(o.getValue)?o.getValue(l,g):null},b=()=>{if($.title)return $.title;const l=typeof $.label=="string"?H.columns&&A(H.columns.get)?H.columns.get($.label):null:j();return l&&(l.title||l.id)||"Hierarchy"};return{id:Y,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:$.icon,iconClass:$.iconClass,content:$.content,checkbox:$.checkbox,onCheck:$.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:F?{flex:1,min:0,pin:H.config&&H.config.treeColumnPin||null,hidden:!1,resizable:!1,movable:!1,lockPosition:!0}:{width:X,min:140,pin:H.config&&H.config.treeColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(l,g){return v(l,g)},formatValue(l,g){if(g&&g.grandTotal)return H.config&&H.config.grandTotalLabel||"Total";if(l==null)return"";if(!$.label){const o=j();if(o&&A(o.formatValue))return o.formatValue(l,g)}return String(l)}}}const Q=L}),Ve("packages/core/src/columns/pivotcolumns.js",function(e,D){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return L}});const A=D("packages/core/src/internal/warn.js").warnOnce,Y="__lattice_pivot",I=500;function L(X){const{pivot:F,valueColumns:j,config:v}=X,b=F&&F.paths||[],l=X.separator||v&&v.pivot&&v.pivot.separator||" | ",g=v&&v.pivot&&v.pivot.maxColumns||I;if(!b.length||!j.length)return{tree:[],leaves:[],error:null};const o=Q(v),t=b.length*j.length+(o?j.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 A(`pivot.maxColumns:${t}`,i),{tree:[],leaves:[],error:i}}const s=[],r=[];for(const i of b){const n=[];for(const m of j){const c=$(i,m,l);n.push(c),r.push(c)}n.length===1?(n[0].title=String(i),s.push(n[0])):s.push({id:`${Y}:group:${i}`,title:String(i),columns:n,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(o){const i=j.map(m=>H(m,v));r.push(...i);const n=v&&v.pivot&&v.pivot.totalsLabel||"Total";if(i.length===1)i[0].title=n,o==="before"?s.unshift(i[0]):s.push(i[0]);else{const m={id:`${Y}:group:__totals`,title:n,columns:i,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};o==="before"?s.unshift(m):s.push(m)}}return{tree:s,leaves:r,error:null}}function Q(X){const F=X&&X.pivot&&X.pivot.groupTotals;return F==="before"||F==="after"?F:null}function H(X,F){return{id:`${Y}:__total${F&&F.pivot&&F.pivot.separator||" | "}${X.id}`,field:null,title:X.title||X.id,type:X.type,dataType:X.dataType,nullable:!0,align:X.align,generated:!0,pivot:{enabled:!1,index:0,sourceId:X.id,total:!0},value:{pure:!0},cell:{align:X.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:X.total,lookup:null,layout:{width:X.layout&&X.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(j,v){const b=v&&v.totals;return b&&Object.hasOwn(b,X.id)?b[X.id]:null},formatValue(j,v){return j==null?"":X.formatValue?X.formatValue(j,v):String(j)}}}function $(X,F,j){return{id:`${Y}:${X}${j}${F.id}`,field:null,title:F.title||F.id,type:F.type,dataType:F.dataType,nullable:!0,align:F.align,generated:!0,pivot:{enabled:!1,index:0,path:X,sourceId:F.id},value:{pure:!0},cell:{align:F.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:F.total,lookup:null,layout:{width:F.layout&&F.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(v,b){return v==null?"":F.formatValue?F.formatValue(v,b):String(v)}}}}),Ve("packages/core/src/compute/group.js",function(e,D){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return v}});const re=D("packages/core/src/compute/handle.js"),A=re.dictSize,Y=re.identity,I=re.presenceReader,L=re.rowCount,Q=re.valueReader,H="",$="\0",X=1<<20;function F(b,l,g,o){const t=b.length,s=b.map(a=>Q(a)),r=Array.isArray(o)&&o.some(Boolean),i=r?s.map((a,u)=>o[u]?h=>o[u](a(h)):a):s;if(!r&&t>0&&b.every(a=>a&&a.kind==="dictionary"&&a.dict)){const a=b.map(h=>A(h.dict)+1);let u=1;for(let h=0;h<t;h++)u*=a[h];if(u<=Number.MAX_SAFE_INTEGER){const h=b.map(f=>f.values),p=b.map(f=>I(f)),y=f=>{let w=0;for(let k=0;k<t;k++){const P=p[k],G=P&&P(f)===0?a[k]-1:h[k][f];w=w*a[k]+G}return w},d=new Float64Array(g);for(let f=0;f<g;f++)d[f]=y(l[f]);return{packed:d,strings:null,product:u,readers:i,keyOf:y}}}const m=a=>{let u="";for(let h=0;h<t;h++){const p=i[h](a);u+=(h===0?"":H)+(p==null?$:String(p))}return u},c=new Array(g);for(let a=0;a<g;a++)c[a]=m(l[a]);return{packed:null,strings:c,product:1/0,readers:i,keyOf:m}}function j(b,l,g,o){const t=new Uint32Array(o+1);for(let n=0;n<g;n++)t[l[n]+1]++;for(let n=0;n<o;n++)t[n+1]+=t[n];const s=new Uint32Array(g),r=t.slice(0,o);for(let n=0;n<g;n++)s[r[l[n]]++]=b[n];const i=new Array(o);for(let n=0;n<o;n++)i[n]=s.subarray(t[n],t[n+1]);return i}function v(b,l,g={}){const o=b||[],t=l||Y(L(o[0],g)),s=t.length;if(o.length===0||s===0)return{keys:[],buckets:[]};const{packed:r,strings:i,product:n,readers:m}=F(o,t,s,g.project),c=new Uint32Array(s);let a=0,u=null;if(r&&n<=Math.max(1024,Math.min(X,s*4))){const d=n,f=new Int32Array(d).fill(-1);for(let w=0;w<s;w++)f[r[w]]=0;for(let w=0;w<d;w++)f[w]===0&&(f[w]=a++);for(let w=0;w<s;w++)c[w]=f[r[w]];u=new Float64Array(a);for(let w=0;w<d;w++)f[w]>=0&&(u[f[w]]=w)}else if(r){const d=new Map;for(let f=0;f<s;f++){const w=r[f];let k=d.get(w);k===void 0&&(k=a++,d.set(w,k)),c[f]=k}u=new Float64Array(a);for(const[f,w]of d)u[w]=f}else{const d=new Map;for(let f=0;f<s;f++){const w=i[f];let k=d.get(w);k===void 0&&(k=a++,d.set(w,k)),c[f]=k}}const h=j(t,c,s,a),p=new Array(a);for(let d=0;d<a;d++){const f=h[d][0],w=new Array(m.length);for(let k=0;k<m.length;k++)w[k]=m[k](f);p[d]=w}const y={keys:p,buckets:h};return u&&(y.packed=u),y}}),Ve("packages/core/src/compute/pivot.js",function(e,D){"use strict";Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return s}});const A=D("packages/core/src/internal/warn.js").warnOnce,I=D("packages/core/src/compute/handle.js").valueComparator,Q=D("packages/core/src/compute/group.js").packKeys,$=D("packages/core/src/compute/total.js").total,X="|",F="/",j=2e3;function v(n,m,c){return`${n}${X}${m}${X}${c}`}function b(n,m){let c="";for(let a=0;a<n.length;a++){const u=n[a];c+=(a===0?"":m)+(u==null?"":String(u))}return c}function l(n,m,c={}){const a=c.separator||F,u=m.length,{keyOf:h,readers:p}=Q(n,m,0),y=new Map,d=[],f=[];for(let B=0;B<u;B++){const E=m[B],S=h(E);if(y.has(S))continue;y.set(S,d.length),f.push(S);const C=new Array(p.length);for(let N=0;N<p.length;N++)C[N]=p[N](E);d.push(C)}const w=I(c.locale),k=d.map((B,E)=>E);k.sort((B,E)=>{const S=d[B],C=d[E];for(let N=0;N<S.length;N++){const O=g(S[N],C[N],w);if(O!==0)return O}return B-E});const P=new Array(k.length),G=new Array(k.length),K=new Map;for(let B=0;B<k.length;B++){const E=k[B];P[B]=d[E],G[B]=b(d[E],a),K.set(f[E],B)}return{keys:P,paths:G,idOf:B=>{const E=K.get(h(B));return E===void 0?-1:E}}}function g(n,m,c){const a=n==null,u=m==null;return a||u?a&&u?0:a?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(h=>h&&h.handle);const c=typeof n.handle=="function"?n.handle:null;if(!c)return m.length&&A("pivot:handles","pivot was given total column ids but no handle(colId) resolver, so no cell values were reduced. Pass values: [{ colId, handle, fn }] or opts.handle."),[];const a=typeof n.totalOf=="function"?n.totalOf:null,u=[];for(const h of m){const p=c(h);p&&u.push({colId:h,handle:p,fn:a?a(h):"sum"})}return u}function t(n,m,c){if(Array.isArray(n)){const a=c||{};return{...a,pivotHandles:n,order:m||null,groups:a.groups||null}}return n||{}}function s(n,m,c){const a=t(n,m,c),u=a.separator||F,h=o(a),p=a.maxColumns===void 0?j:a.maxColumns,y=a.groups&&a.groups.buckets?a.groups:null,d=y?y.buckets:[a.order||new Uint32Array(0)],f=a.groupPaths||(y?y.keys.map(S=>b(S,u)):[""]),w=i(d),{keys:k,paths:P,idOf:G}=l(a.pivotHandles||[],w,a),K=P.length*Math.max(1,h.length),q=r(P,h,u);if(p&&K>p){const S=new Map;return{keys:k,paths:P,fields:q,groupPaths:f,columns:K,values:S,cells:S,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${K} columns, above pivot.maxColumns of ${p}. Narrow the pivot columns or raise the limit.`,columns:K,maxColumns:p}}}const B=new Map,E=P.length;for(let S=0;S<d.length;S++){const C=d[S],N=f[S]===void 0?"":f[S],O=C.length;if(O===0)continue;const T=new Int32Array(O),R=new Uint32Array(E+1);for(let V=0;V<O;V++){const J=G(C[V]);T[V]=J,J>=0&&R[J+1]++}for(let V=0;V<E;V++)R[V+1]+=R[V];const x=new Uint32Array(O),U=R.slice(0,E);for(let V=0;V<O;V++){const J=T[V];J>=0&&(x[U[J]++]=C[V])}for(let V=0;V<E;V++){const J=R[V],_=R[V+1];if(_===J)continue;const ee=x.subarray(J,_);for(let W=0;W<h.length;W++){const Z=h[W],ne=$(Z.handle,ee,Z.fn,a.totalContext||{locale:a.locale});B.set(v(N,P[V],Z.colId),ne)}}}return{keys:k,paths:P,fields:q,groupPaths:f,columns:K,values:B,cells:B,error:null}}function r(n,m,c){if(m.length===0)return n.slice();const a=[];for(const u of n)for(const h of m)a.push(`${u}${c}${h.colId}`);return a}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 a=0;for(const u of n)!u||u.length===0||(c.set(u,a),a+=u.length);return c}}),Ve("packages/core/src/compute/explain.js",function(e,D){"use strict";Object.defineProperty(e,"explainContributors",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"explainChange",{enumerable:!0,get:function(){return v}});const A=D("packages/core/src/compute/total.js").total,I=D("packages/core/src/compute/group.js").groupByColumns,L=new Set(["sum","count","countValues"]),Q=new Set(["min","max"]),H=new Set(["avg"]);function $(b){return typeof b=="string"?b:typeof b=="function"&&b.totalName?b.totalName:null}function X(b,l,g,o){return A(b,l,g,o||{})}function F(b,l){if(l)try{return l(b)}catch{}return b==null?"":String(b)}function j(b){const{handle:l,fn:g,leaves:o,by:t,labelOf:s,rowLabel:r}=b,i={locale:b.locale},n=o&&o.length?o:[],m=$(g),c=X(l,n,g,i),a=Q.has(m);let u;if(a){let y=-1;for(let d=0;d<n.length;d++){const f=X(l,[n[d]],g,i);if(Object.is(f,c)){y=n[d];break}}u=y<0?[]:[{key:y,indices:[y],label:r?r(y):String(y)}]}else if(t){const y=I([t],n);u=y.keys.map((d,f)=>({key:d[0],indices:y.buckets[f],label:F(d[0],s)}))}else u=Array.from({length:n.length},(y,d)=>{const f=n[d];return{key:f,indices:[f],label:r?r(f):String(f)}});const h=n.length,p=[];for(const y of u){const d=X(l,y.indices,g,i),f=y.indices.length;let w,k;if(m==="avg")w=((typeof d=="number"?d:0)-(typeof c=="number"?c:0))*f,k=h?f/h:0;else if(a)w=typeof d=="number"?d:0,k=1;else{w=typeof d=="number"?d:0;const P=typeof c=="number"?c:0;k=P?w/P:0}p.push({key:y.key,label:y.label,count:f,value:d,contribution:w,share:k})}return p.sort((y,d)=>Math.abs(d.contribution)-Math.abs(y.contribution)||(y.label<d.label?-1:y.label>d.label?1:0)),{total:c,fn:m,weighted:H.has(m),single:a,contributors:p}}function v(b){const l=j({...b,leaves:b.after}),g=j({...b,leaves:b.before}),o=typeof l.total=="number"?l.total:0,t=typeof g.total=="number"?g.total:0,s=new Map;for(const n of l.contributors)s.set(n.key,n);const r=[],i=new Set;for(const n of g.contributors){i.add(n.key);const m=s.get(n.key);if(m===void 0)r.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&&r.push({key:n.key,label:n.label,before:n.value,after:m.value,effect:c,kind:"changed",count:m.count})}}for(const n of l.contributors)i.has(n.key)||r.push({key:n.key,label:n.label,before:null,after:n.value,effect:n.contribution,kind:"new",count:n.count});return r.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:l.total,delta:o-t,weighted:l.weighted||g.weighted,single:l.single||g.single,drivers:r}}}),Ve("packages/core/src/store/bitset.js",function(e,D){"use strict";Object.defineProperty(e,"Bitset",{enumerable:!0,get:function(){return A}});const re=8;class A{static#e=new Uint8Array(256);static{for(let I=1;I<256;I++)A.#e[I]=A.#e[I>>1]+(I&1)}#t;#n;constructor(I=0){const L=Math.max(0,I|0);this.#n=L,this.#t=new Uint8Array(Math.ceil(L/re))}get size(){return this.#n}get words(){return this.#t}get bytes(){return this.#t?this.#t.byteLength:0}get(I){return I<0||I>=this.#n?0:this.#t[I>>3]>>(I&7)&1}set(I){return I>=0&&I<this.#n&&(this.#t[I>>3]|=1<<(I&7)),this}clear(I){return I>=0&&I<this.#n&&(this.#t[I>>3]&=~(1<<(I&7))),this}assign(I,L){return L?this.set(I):this.clear(I)}fill(I=!1){return this.#t.fill(I?255:0),I&&this.#r(),this}grow(I){const L=Math.max(0,I|0);if(L<=this.#n)return this;const Q=Math.ceil(L/re);if(Q>this.#t.length){const H=new Uint8Array(Q);H.set(this.#t),this.#t=H}return this.#n=L,this}count(){const I=this.#t,L=A.#e;let Q=0;for(let H=0;H<I.length;H++)Q+=L[I[H]];return Q}and(I){const L=I instanceof A?I.words:I,Q=this.#t,H=Math.min(Q.length,L.length);for(let $=0;$<H;$++)Q[$]&=L[$];for(let $=H;$<Q.length;$++)Q[$]=0;return this}or(I){const L=I instanceof A?I.words:I,Q=this.#t,H=Math.min(Q.length,L.length);for(let $=0;$<H;$++)Q[$]|=L[$];return this}not(){const I=this.#t;for(let L=0;L<I.length;L++)I[L]=~I[L]&255;return this.#r(),this}clone(){const I=new A(this.#n);return I.words.set(this.#t.subarray(0,I.words.length)),I}release(){this.#t=new Uint8Array(0),this.#n=0}#r(){const I=this.#n&7;if(I===0)return;const L=this.#n>>3;L<this.#t.length&&(this.#t[L]&=(1<<I)-1)}static from(I){const L=Array.isArray(I)?I:Array.from(I),Q=new A(L.length);for(let H=0;H<L.length;H++)L[H]&&Q.set(H);return Q}}}),Ve("packages/core/src/store/dictionary.js",function(e,D){"use strict";Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return I}});const re=D("packages/core/src/internal/compare.js"),A=re.collator,Y=re.defaultCompare;class I{#e;#t=new Map;#n=0;#r=null;#s=-1;#i="\0";constructor(Q=[]){this.#e=[];for(let H=0;H<Q.length;H++){const $=Q[H];this.#t.has($)||(this.#t.set($,this.#e.length),this.#e.push($))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let Q=this.#e.length*8;for(let H=0;H<this.#e.length;H++){const $=this.#e[H];typeof $=="string"&&(Q+=$.length*2),Q+=16}return Q}codeOf(Q){const H=this.#t.get(Q);if(H!==void 0)return H;const $=this.#e.length;return this.#e.push(Q),this.#t.set(Q,$),this.#n++,$}lookup(Q){const H=this.#t.get(Q);return H===void 0?-1:H}has(Q){return this.#t.has(Q)}valueOf(Q){return this.#e[Q]}values(){return this.#e}ranks(Q){const H=Q||"";if(this.#r&&this.#s===this.#n&&this.#i===H)return this.#r;const $=this.#e.length,X=new Array($);for(let b=0;b<$;b++)X[b]=b;const F=A(Q).compare,j=this.#e;X.sort((b,l)=>this.#a(j[b],j[l],F));const v=new Uint32Array($);for(let b=0;b<$;b++)v[X[b]]=b;return this.#r=v,this.#s=this.#n,this.#i=H,v}#a(Q,H,$){return typeof Q=="string"&&typeof H=="string"?$(Q,H):Y(Q,H)}}}),Ve("packages/core/src/store/multivalue.js",function(e,D){"use strict";Object.defineProperty(e,"MultiValue",{enumerable:!0,get:function(){return re}});class re{#e;#t;#n=0;#r=0;constructor(Y={}){const I=Math.max(1,Y.rows??16),L=Math.max(1,Y.values??I);this.#e=new Int32Array(L),this.#t=new Uint32Array(I+1)}get values(){return this.#e}get offsets(){return this.#t}get rows(){return this.#n}get length(){return this.#r}get bytes(){return this.#e.byteLength+this.#t.byteLength}count(Y){return Y<0||Y>=this.#n?0:this.#t[Y+1]-this.#t[Y]}at(Y){return Y<0||Y>=this.#n?this.#e.subarray(0,0):this.#e.subarray(this.#t[Y],this.#t[Y+1])}has(Y,I){if(Y<0||Y>=this.#n)return!1;const L=this.#e,Q=this.#t[Y+1];for(let H=this.#t[Y];H<Q;H++)if(L[H]===I)return!0;return!1}hasAny(Y,I){for(let L=0;L<I.length;L++)if(this.has(Y,I[L]))return!0;return!1}hasAll(Y,I){for(let L=0;L<I.length;L++)if(!this.has(Y,I[L]))return!1;return!0}hasNone(Y,I){return!this.hasAny(Y,I)}push(Y){const I=this.#n,L=Y.length;this.#s(I+1),this.#i(this.#r+L);const Q=this.#r;for(let H=0;H<L;H++)this.#e[Q+H]=Y[H]|0;return this.#r+=L,this.#n=I+1,this.#t[I]=Q,this.#t[I+1]=this.#r,I}write(Y,I){if(Y===this.#n){this.push(I);return}if(Y<0||Y>this.#n)return;const L=this.#t[Y],Q=this.#t[Y+1],H=I.length;if(Q-L===H){for(let $=0;$<H;$++)this.#e[L+$]=I[$]|0;return}this.#a(Y,I)}compact(Y,I,L){const Q=this.#e,H=this.#t,$=this.#n,X=new Int32Array(Math.max(1,this.#r)),F=new Uint32Array(I+1);let j=0;for(let v=0;v<$;v++){if(Y[v]===L)continue;const b=H[v],l=H[v+1];F[Y[v]]=j;for(let g=b;g<l;g++)X[j++]=Q[g];F[Y[v]+1]=j}this.#e=X,this.#t=F,this.#n=I,this.#r=j}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#s(Y){if(Y+1<=this.#t.length)return;let I=this.#t.length-1;for(;I<Y;)I=I*2||16;const L=new Uint32Array(I+1);L.set(this.#t),this.#t=L}#i(Y){if(Y<=this.#e.length)return;let I=this.#e.length;for(;I<Y;)I=I*2||16;const L=new Int32Array(I);L.set(this.#e),this.#e=L}#a(Y,I){const L=this.#e,Q=this.#t,H=this.#n,$=I.length-(Q[Y+1]-Q[Y]),X=new Int32Array(Math.max(1,this.#r+$)),F=new Uint32Array(Q.length);let j=0;for(let v=0;v<H;v++){if(F[v]=j,v===Y)for(let b=0;b<I.length;b++)X[j++]=I[b]|0;else for(let b=Q[v];b<Q[v+1];b++)X[j++]=L[b];F[v+1]=j}this.#e=X,this.#t=F,this.#r=j}}}),Ve("packages/core/src/compute/sort.js",function(e,D){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return E}});const re=D("packages/core/src/compute/handle.js"),A=re.bitReader,Y=re.dictRanks,I=re.dictSize,L=re.identity,Q=re.isMissing,H=re.presenceReader,$=re.rowCount,X=re.valueComparator,F=re.valueReader,j=new Uint32Array(0),v=new ArrayBuffer(8),b=new Float64Array(v),l=new Uint32Array(v),g=(b[0]=-1,(l[1]&2147483648)!==0?1:0),o=g===1?0:1;function t(C,N){b[0]=C;let O=l[g],T=l[o];(O&2147483648)!==0?(O=~O>>>0,T=~T>>>0):O=(O^2147483648)>>>0,N[0]=T,N[1]=O}function s(C,N,O,T){if(T<2)return C;const R=new Uint32Array(256*8);for(let Z=0;Z<T;Z++){const ne=N[Z],ie=O[Z];R[ne&255]++,R[256+(ne>>>8&255)]++,R[512+(ne>>>16&255)]++,R[768+(ne>>>24&255)]++,R[1024+(ie&255)]++,R[1280+(ie>>>8&255)]++,R[1536+(ie>>>16&255)]++,R[1792+(ie>>>24&255)]++}let x=C,U=N,V=O,J=new Uint32Array(T),_=new Uint32Array(T),ee=new Uint32Array(T);const W=new Uint32Array(256);for(let Z=0;Z<8;Z++){const ne=Z<<8,ie=(Z&3)<<3,ce=Z>=4;let me=!1;for(let xe=0;xe<256;xe++)if(R[ne+xe]===T){me=!0;break}if(me)continue;let Ce=0;for(let xe=0;xe<256;xe++)W[xe]=Ce,Ce+=R[ne+xe];for(let xe=0;xe<T;xe++){const _e=U[xe],ve=V[xe],oe=(ce?ve:_e)>>>ie&255,he=W[oe]++;J[he]=x[xe],_[he]=_e,ee[he]=ve}let Pe=x;x=J,J=Pe,Pe=U,U=_,_=Pe,Pe=V,V=ee,ee=Pe}return x}function r(C,N,O){if(O<2)return C;const T=new Uint32Array(256*4);for(let _=0;_<O;_++){const ee=N[_];T[ee&255]++,T[256+(ee>>>8&255)]++,T[512+(ee>>>16&255)]++,T[768+(ee>>>24&255)]++}let R=C,x=N,U=new Uint32Array(O),V=new Uint32Array(O);const J=new Uint32Array(256);for(let _=0;_<4;_++){const ee=_<<8,W=_<<3;let Z=!1;for(let ce=0;ce<256;ce++)if(T[ee+ce]===O){Z=!0;break}if(Z)continue;let ne=0;for(let ce=0;ce<256;ce++)J[ce]=ne,ne+=T[ee+ce];for(let ce=0;ce<O;ce++){const me=x[ce],Ce=J[me>>>W&255]++;U[Ce]=R[ce],V[Ce]=me}let ie=R;R=U,U=ie,ie=x,x=V,V=ie}return R}function i(C,N,O,T){const R=new Uint32Array(T+1);for(let V=0;V<O;V++)R[N[V]]++;let x=0;for(let V=0;V<=T;V++){const J=R[V];R[V]=x,x+=J}const U=new Uint32Array(O);for(let V=0;V<O;V++)U[R[N[V]]++]=C[V];return U}function n(C,N,O,T){return O<2?C:T<=65536||T<=O*2?i(C,N,O,T):r(C,N,O)}function m(C,N){return C.length===N&&C.byteOffset===0?C:Uint32Array.prototype.slice.call(C,0,N)}function c(C,N,O=!1){const T=N||L(C.length),R=T.length;if(R<2)return Uint32Array.from(T);const x=new Uint32Array(R),U=new Uint32Array(R),V=new Uint32Array(R),J=new Uint32Array(R),_=new Uint32Array(2);let ee=0,W=0;for(let ie=0;ie<R;ie++){const ce=T[ie],me=C[ce];if(Number.isNaN(me)){J[W++]=ce;continue}t(me,_),O?(U[ee]=~_[0]>>>0,V[ee]=~_[1]>>>0):(U[ee]=_[0],V[ee]=_[1]),x[ee++]=ce}const Z=s(x.subarray(0,ee),U.subarray(0,ee),V.subarray(0,ee),ee);if(W===0)return m(Z,ee);const ne=new Uint32Array(R);return ne.set(Z.subarray(0,ee),0),ne.set(J.subarray(0,W),ee),ne}function a(C,N,O=!1){const T=N||L(C.length),R=T.length;if(R<2)return Uint32Array.from(T);const x=Uint32Array.from(T),U=new Uint32Array(R);for(let V=0;V<R;V++){const J=(C[x[V]]^2147483648)>>>0;U[V]=O?~J>>>0:J}return m(r(x,U,R),R)}function u(C,N,O={}){const T=N||L($(C,O)),R=T.length;if(R<2)return Uint32Array.from(T);const x=Y(C.dict,O.locale),U=C.values,V=H(C),J=Math.max(I(C.dict),x.length),_=J,ee=Uint32Array.from(T),W=new Uint32Array(R),Z=!!O.descending;for(let ne=0;ne<R;ne++){const ie=ee[ne];let ce=V&&V(ie)===0?_:x[U[ie]];ce===void 0&&(ce=_),W[ne]=Z?_-ce:ce}return m(n(ee,W,R,J+1),R)}function h(C,N,O){const T=N.length;let R=Uint32Array.from(N);if(T<2)return R;let x=new Uint32Array(T);for(let U=1;U<T;U<<=1){for(let J=0;J<T;J+=U<<1){const _=Math.min(J+U,T),ee=Math.min(J+(U<<1),T);let W=J,Z=_,ne=J;for(;W<_&&Z<ee;)x[ne++]=O(C[R[W]],C[R[Z]])<=0?R[W++]:R[Z++];for(;W<_;)x[ne++]=R[W++];for(;Z<ee;)x[ne++]=R[Z++]}const V=R;R=x,x=V}return R}function p(C,N,O){const T=A(C.values),R=N.length,x=new Uint32Array(R),U=O?1:0;let V=0;for(let J=0;J<R;J++)T(N[J])===U&&(x[V++]=N[J]);for(let J=0;J<R;J++)T(N[J])!==U&&(x[V++]=N[J]);return x}function y(C,N){const O=C.values,T=C.kind;if((T==="object"||T===void 0)&&(Array.isArray(O)||ArrayBuffer.isView(O))&&!C.presence)return O;const x=F(C),U=new Array($(C)||0);for(let V=0;V<N.length;V++){const J=N[V];U[J]=x(J)}return U}function d(C,N){for(let O=0;O<N.length;O++)if(typeof C[N[O]]!="string")return!1;return!0}function f(C,N,O,T,R){const x=C.length,U=Uint32Array.from(C);if(x<2||T<1)return U;const V=new Uint32Array(x),J=T-1;for(let _=0;_<x;_++){const ee=O[N[_]];V[_]=R?J-ee:ee}return m(n(U,V,x,T),x)}function w(C,N,O){const T=X(O),R=new Array(N);for(let U=0;U<N;U++)R[U]=U;R.sort((U,V)=>T(C[U],C[V])||U-V);const x=new Uint32Array(N);for(let U=0;U<N;U++)x[R[U]]=U;return x}function k(C,N,O){const T=N.length,R=new Map,x=[],U=new Uint32Array(T);for(let _=0;_<T;_++){const ee=C[N[_]];let W=R.get(ee);W===void 0&&(W=x.length,R.set(ee,W),x.push(ee)),U[_]=W}const V=x.length,J=w(x,V,O.locale);return f(N,U,J,V,!!O.descending)}function P(C,N,O){const T=y(C,N);if(N.length>=2&&d(T,N)){const U=C.stringRank;return U&&U.version===C.version&&U.usable(N,T,O.locale)?U.sort(N,O):k(T,N,O)}const R=X(O.locale),x=O.descending?(U,V)=>R(V,U):R;return h(T,N,x)}function G(C,N,O){const T=y(C,N),R=O.compare,U=!!O.descending?(V,J)=>-R(V,J,void 0,void 0,!0):(V,J)=>R(V,J,void 0,void 0,!1);return h(T,N,U)}function K(C,N){const O=N.length,T=H(C),R=C.values,x=C.kind==="float64"&&!!R,U=C.kind==="object"||C.kind==="multi"||C.kind===void 0;if(!T&&!x&&!U)return{present:N,absent:j};const V=new Uint32Array(O),J=new Uint32Array(O);let _=0,ee=0;if(T&&x)for(let W=0;W<O;W++){const Z=N[W];T(Z)===1&&!Number.isNaN(R[Z])?V[_++]=Z:J[ee++]=Z}else if(x&&!T)for(let W=0;W<O;W++){const Z=N[W];Number.isNaN(R[Z])?J[ee++]=Z:V[_++]=Z}else if(T&&!U)for(let W=0;W<O;W++){const Z=N[W];T(Z)===1?V[_++]=Z:J[ee++]=Z}else{const W=F(C);for(let Z=0;Z<O;Z++){const ne=N[Z];Q(W(ne))?J[ee++]=ne:V[_++]=ne}}return ee===0?{present:N,absent:j}:{present:V.subarray(0,_),absent:J.subarray(0,ee)}}function q(C,N,O){if(N.length===0)return C;const T=new Uint32Array(C.length+N.length);return O?(T.set(N,0),T.set(C,N.length)):(T.set(C,0),T.set(N,C.length)),T}function B(C,N,O={}){const T=N||L($(C,O));if(!C||T.length<2)return Uint32Array.from(T);const{present:R,absent:x}=K(C,T);if(R.length===0)return Uint32Array.from(T);const U=!!O.descending;let V;if(typeof O.compare=="function")V=G(C,R,O);else switch(C.kind){case"float64":V=c(C.values,R,U);break;case"int32":V=a(C.values,R,U);break;case"dictionary":V=u(C,R,O);break;case"bitset":V=p(C,R,U);break;default:V=P(C,R,O);break}return q(V,x,!!O.nullsFirst)}function E(C,N,O,T={}){const R=N||[],x=R.length&&(R[0].handle||S(C,R[0].col))||C&&C[0];let U=O||L($(x,T));for(let V=R.length-1;V>=0;V--){const J=R[V],_=J.handle||S(C,J.col)||C&&C[V];_&&(U=B(_,U,{descending:J.descending!==void 0?!!J.descending:J.dir==="desc",nullsFirst:!!J.nullsFirst,locale:J.locale!==void 0?J.locale:T.locale,compare:J.compare}))}return U instanceof Uint32Array?U:Uint32Array.from(U)}function S(C,N){if(!(!C||N===void 0)){for(let O=0;O<C.length;O++)if(C[O]&&C[O].id===N)return C[O]}}}),Ve("packages/core/src/store/stringrank.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_MAX_DISTINCT",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"StringRankIndex",{enumerable:!0,get:function(){return L}});const re=D("packages/core/src/compute/sort.js"),A=re.collateStringRanks,Y=re.rankSortStrings,I=1e5;class L{#e=[];#t=new Map;#n;#r=0;#s=0;#i=-1;#a;#l=!1;#o=null;#c=-1;#u="\0";constructor(H=I){this.#a=H>0?H:I,this.#n=new Uint32Array(0)}get version(){return this.#i}set version(H){this.#i=H}get generation(){return this.#s}get size(){return this.#e.length}get capped(){return this.#l}get length(){return this.#r}get bytes(){let H=this.#n.byteLength;const $=this.#e;for(let X=0;X<$.length;X++)H+=$[X].length*2+24;return H}#f(H,$){const X=this.#t.get(H);if(X!==void 0)return X;if(this.#l)return-1;if($&&this.#e.length>=this.#a)return this.#l=!0,-1;const F=this.#e.length;return this.#e.push(H),this.#t.set(H,F),this.#s++,F}build(H,$){const X=$|0;this.#e=[],this.#t=new Map,this.#s=0,this.#l=!1,this.#o=null,this.#c=-1,this.#n=new Uint32Array(X);for(let F=0;F<X;F++){const j=H[F],v=typeof j=="string"?this.#f(j,!1):-1;this.#n[F]=v<0?0:v}this.#r=X}append(H,$,X){const F=($|0)+(X|0);if(F>this.#n.length){const j=new Uint32Array(F);j.set(this.#n.subarray(0,this.#r)),this.#n=j}for(let j=$|0;j<F;j++){const v=H[j],b=typeof v=="string"?this.#f(v,!0):-1;this.#n[j]=b<0?0:b}this.#r=Math.max(this.#r,F)}ranks(H){const $=H||"";if(this.#o&&this.#c===this.#s&&this.#u===$)return this.#o;const X=A(this.#e,this.#e.length,H);return this.#o=X,this.#c=this.#s,this.#u=$,X}usable(H,$,X){if(this.#l||this.#e.length===0)return!1;const F=this.#n,j=this.#e,v=this.#r;for(let b=0;b<H.length;b++){const l=H[b];if(l>=v||j[F[l]]!==$[l])return!1}return!0}sort(H,$){const X=this.ranks($.locale),F=this.#e.length,j=H.length,v=new Uint32Array(j),b=this.#n;for(let l=0;l<j;l++)v[l]=b[H[l]];return Y(H,v,X,F,!!$.descending)}}}),Ve("packages/core/src/store/columnstore.js",function(e,D){"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 h}}),Object.defineProperty(e,"ColumnStore",{enumerable:!0,get:function(){return p}});const A=D("packages/core/src/internal/warn.js").warnOnce,I=D("packages/core/src/internal/predicates.js").isFunction,Q=D("packages/core/src/internal/paths.js").pathGetter,$=D("packages/core/src/store/bitset.js").Bitset,F=D("packages/core/src/store/dictionary.js").Dictionary,v=D("packages/core/src/store/multivalue.js").MultiValue,l=D("packages/core/src/store/stringrank.js").StringRankIndex,g=4294967295,o=1024,t=5e3,s=.2,r=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 d=n(y);return Number.isFinite(d)?d|0:0}function c(y){return i(y)?[]:Array.isArray(y)?y:[y]}function a(y,d){switch(y.kind){case"float64":case"int32":return y.buf[d];case"bitset":return y.bits.get(d)===1;case"dictionary":return y.dict.valueOf(y.buf[d]);case"multi":{const f=y.mv.at(d),w=new Array(f.length);for(let k=0;k<f.length;k++)w[k]=y.dict.valueOf(f[k]);return w}default:return y.buf[d]}}function u(y,d){switch(y.kind){case"float64":case"int32":return y.values[d];case"bitset":return(y.values[d>>3]&1<<(d&7))!==0;case"dictionary":return(y.table||[])[y.values[d]];case"multi":{const f=y.offsets[d],w=y.offsets[d+1],k=y.table||[],P=new Array(w-f);for(let G=f;G<w;G++)P[G-f]=k[y.values[G]];return P}default:return y.values[d]}}class h{#e;#t;#n;#r;#s;#i;#a;#l=!1;#o=null;#c=null;#u=null;#f=null;#d=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#O=null;#w=null;#A=!1;constructor(d,f){this.#e=d.id;const w=r.has(d.kind)?d.kind:"object";d.kind&&!r.has(d.kind)&&A(`store.kind.${d.id}`,`column "${d.id}" declares unknown storage kind "${d.kind}"; falling back to object`),this.#n=w,this.#t=w,this.#r=d.nullable!==!1,this.#a=d.dictionary??null,this.#i=f,this.#s=I(d.read)?d.read:Q(d.field||d.id),this.#h=d.stringRankIndex!=="off",this.#p=typeof d.stringRankMaxDistinct=="number"?d.stringRankMaxDistinct:0,this.#O=new Map}get id(){return this.#e}get kind(){return this.#l?this.#t:"object"}get target(){return this.#n}get nullable(){return this.#r}get values(){return this.#A?null:this.#l?this.#t==="bitset"?this.#c.words:this.#t==="multi"?this.#u.values:this.#o:this.#T().values}get presence(){return this.#A||!this.#r?null:this.#l?this.#g:this.#T().presence}get dict(){return this.#A||!this.#l?null:this.#t==="dictionary"||this.#t==="multi"?this.#f:null}get stringRank(){if(this.#A||!this.#h||this.kind!=="object")return null;const d=this.values,f=this.#i.physical();if(!d||f===0)return null;if(this.#d===null){if(typeof d[0]!="string")return null;const w=new l(this.#v());return w.build(d,f),w.version=this.#y,this.#d=w,this.#m=this.#y,w.capped?null:w}return this.#d.length<f&&this.#d.append(d,this.#d.length,f-this.#d.length),this.#d.version=this.#y,this.#m=this.#y,this.#d.capped?null:this.#d}#v(){return this.#p}#C(){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 d=0;return this.#o&&(d+=this.#o.byteLength??this.#o.length*8),this.#c&&(d+=this.#c.bytes),this.#u&&(d+=this.#u.bytes),this.#g&&(d+=this.#g.bytes),this.#f&&(d+=this.#f.bytes),this.#O&&(d+=this.#O.size*24),d}get(d){if(!this.#A&&!(d<0||d>=this.#i.physical())){if(!this.#l)return this.#E(d);if(this.#r&&this.#g.get(d)===0)return null;switch(this.#t){case"float64":case"int32":return this.#o[d];case"bitset":return this.#c.get(d)===1;case"dictionary":return this.#f.valueOf(this.#o[d]);case"multi":{const f=this.#u.at(d),w=new Array(f.length);for(let k=0;k<f.length;k++)w[k]=this.#f.valueOf(f[k]);return w}default:return this.#o[d]}}}set(d,f){this.#A||(this.#l?this.#P(d,f):this.#O.set(d,f===void 0?null:f),this.#d&&this.#C(),this.#y++)}read(d){return this.#s(d)}appendColumn(d,f,w){if(this.#A||w<=0)return;if(!this.#l){this.#y++;return}const k=this.#s,P=this.#r,G=this.#g;let K=!1;switch(this.#t){case"float64":{const q=this.#o;for(let B=0;B<w;B++){const E=k(d[B]);if(typeof E=="number"){P&&G.set(f+B),q[f+B]=E;continue}const S=E==null;P?G.assign(f+B,!S):S&&(K=!0),q[f+B]=S?NaN:n(E)}break}case"int32":{const q=this.#o;for(let B=0;B<w;B++){const E=k(d[B]),S=E==null;P?G.assign(f+B,!S):S&&(K=!0),q[f+B]=S?0:m(E)}break}case"bitset":{const q=this.#c;for(let B=0;B<w;B++){const E=k(d[B]),S=E==null;P?G.assign(f+B,!S):S&&(K=!0),q.assign(f+B,!S&&!!E)}break}case"dictionary":{const q=this.#o,B=this.#f;for(let E=0;E<w;E++){const S=k(d[E]),C=S==null;P?G.assign(f+E,!C):C&&(K=!0),q[f+E]=C?0:B.codeOf(S)}break}case"multi":{const q=this.#u,B=this.#f;for(let E=0;E<w;E++){const S=k(d[E]),C=S==null;P?G.assign(f+E,!C):C&&(K=!0);const N=c(S),O=new Array(N.length);for(let T=0;T<N.length;T++)O[T]=B.codeOf(N[T]);q.write(f+E,O)}break}default:{const q=this.#o;for(let B=0;B<w;B++){const E=k(d[B]),S=E==null;P?G.assign(f+B,!S):S&&(K=!0),q[f+B]=S?null:E}break}}K&&A(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#d&&this.#t==="object"&&(this.#d.append(this.#o,f,w),this.#d.version=this.#y+1,this.#m=this.#y+1),this.#y++}appendPacked(d,f,w){if(this.#A||w<=0||!d)return;if(!this.#l){this.#y++;return}const k=this.#g,P=d.presence;if(k)if(P)for(let K=0;K<w;K++)k.assign(f+K,(P[K>>3]&1<<(K&7))!==0);else for(let K=0;K<w;K++)k.set(f+K);const G=d.kind===this.#t;if(G&&(this.#t==="float64"||this.#t==="int32")){this.#o.set(d.values,f),this.#y++;return}if(G&&this.#t==="bitset"){const K=d.values;for(let q=0;q<w;q++)this.#c.assign(f+q,(K[q>>3]&1<<(q&7))!==0);this.#y++;return}if(G&&this.#t==="dictionary"){const K=d.table||[],q=new Uint32Array(K.length);for(let C=0;C<K.length;C++)q[C]=this.#f.codeOf(K[C]);const B=d.values,E=this.#o,S=k;for(let C=0;C<w;C++){if(S&&(P&&(P[C>>3]&1<<(C&7))===0)){E[f+C]=0;continue}E[f+C]=q[B[C]]??0}this.#y++;return}if(G&&this.#t==="multi"){const K=d.table||[],q=new Uint32Array(K.length);for(let S=0;S<K.length;S++)q[S]=this.#f.codeOf(K[S]);const B=d.values,E=d.offsets;for(let S=0;S<w;S++){const C=E[S],N=E[S+1],O=new Array(N-C);for(let T=C;T<N;T++)O[T-C]=q[B[T]]??0;this.#u.write(f+S,O)}this.#y++;return}for(let K=0;K<w;K++){const q=P?(P[K>>3]&1<<(K&7))===0:d.kind==="object"?d.values[K]===null:!1;this.#P(f+K,q?null:u(d,K))}this.#y++}touch(){this.#y++}columnarise(d,f){if(this.#l||this.#A)return;const w=new Array(f);for(let k=0;k<f;k++)w[k]=this.#E(k);this.#t=this.#n,this.#l=!0,this.#S(d);for(let k=0;k<f;k++)this.#P(k,w[k]);this.#O.clear(),this.#w=null,this.#C(),this.#y++}grow(d){if(!(!this.#l||this.#A||d<=this.#b)){switch(this.#t){case"float64":case"int32":case"dictionary":{const f=new this.#o.constructor(d);f.set(this.#o),this.#o=f;break}case"bitset":this.#c.grow(d);break;case"multi":break;default:this.#o.length=d;break}this.#g&&this.#g.grow(d),this.#b=d,this.#y++}}convert(d){if(this.#A||!r.has(d)||(this.#n=d,!this.#l||d===this.#t))return!1;const f={kind:this.#t,buf:this.#o,bits:this.#c,mv:this.#u,dict:this.#f},w=this.#i.physical(),k=this.#g;this.#t=d,this.#S(this.#b);for(let P=0;P<w;P++){const G=k!==null&&k.get(P)===0;G&&d!=="multi"||this.#P(P,G?null:a(f,P))}return this.#C(),this.#y++,!0}compact(d,f,w){if(!this.#A){if(this.#C(),!this.#l){const k=this.#O;if(k.size){const P=new Map;for(const[G,K]of k)d[G]!==g&&P.set(d[G],K);this.#O=P}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const k=this.#o;for(let P=0;P<f;P++)d[P]!==g&&(k[d[P]]=k[P]);if(this.#t==="object")for(let P=w;P<f;P++)k[P]=void 0;break}case"bitset":{const k=this.#c;for(let P=0;P<f;P++)d[P]!==g&&k.assign(d[P],k.get(P)===1);for(let P=w;P<f;P++)k.clear(P);break}case"multi":this.#u.compact(d,w,g);break;default:break}if(this.#g){const k=this.#g;for(let P=0;P<f;P++)d[P]!==g&&k.assign(d[P],k.get(P)===1);for(let P=w;P<f;P++)k.clear(P)}this.#y++}}release(){this.#A||(this.#A=!0,this.#o=null,this.#c&&this.#c.release(),this.#c=null,this.#u&&this.#u.release(),this.#u=null,this.#g&&this.#g.release(),this.#g=null,this.#f=null,this.#d=null,this.#O=new Map,this.#w=null,this.#b=0,this.#y++)}#S(d){const f=Math.max(1,d);switch(this.#o=null,this.#c=null,this.#u=null,this.#t){case"float64":this.#o=new Float64Array(f);break;case"int32":this.#o=new Int32Array(f);break;case"bitset":this.#c=new $(f);break;case"dictionary":this.#o=new Uint32Array(f),this.#f=this.#f??new F(this.#a??[]);break;case"multi":this.#u=new v({rows:f,values:f}),this.#f=this.#f??new F(this.#a??[]);break;default:this.#o=new Array(f);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#f=null),this.#r&&(this.#g?this.#g.grow(f):this.#g=new $(f)),this.#b=f}#P(d,f){const w=i(f);switch(this.#r?this.#g.assign(d,!w):w&&A(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#t){case"float64":this.#o[d]=w?NaN:n(f);break;case"int32":this.#o[d]=w?0:m(f);break;case"bitset":this.#c.assign(d,!w&&!!f);break;case"dictionary":this.#o[d]=w?0:this.#f.codeOf(f);break;case"multi":{const k=c(f),P=new Array(k.length);for(let G=0;G<k.length;G++)P[G]=this.#f.codeOf(k[G]);this.#u.write(d,P);break}default:this.#o[d]=w?null:f;break}}#E(d){if(this.#O.has(d))return this.#O.get(d);const f=this.#s(this.#i.rowAt(d));return f===void 0?null:f}#T(){if(this.#w&&this.#w.version===this.#y)return this.#w;const d=this.#i.physical(),f=new Array(d),w=this.#r?new $(d):null;for(let k=0;k<d;k++){const P=this.#E(k);f[k]=P,w&&!i(P)&&w.set(k)}return this.#w={version:this.#y,values:f,presence:w},this.#w}}class p{#e;#t=new Map;#n=[];#r=[];#s=0;#i=0;#a=0;#l=0;#o=new $(0);#c=!1;#u=!0;#f;#d;#h;#p=!1;constructor(d,f={}){this.#e=Array.isArray(d)?d:[],this.#d=Math.max(1,f.initialCapacity??o),this.#u=f.retainSource!==!1,this.#f=this.#u?f.columnarBelow??t:0,this.#h=f.compactRatio??s;const w={rowAt:k=>this.#r[k],physical:()=>this.#s};for(const k of this.#e){if(!k||!k.id)continue;if(this.#t.has(k.id)){A(`store.dup.${k.id}`,`duplicate column id "${k.id}" in the store schema; ignoring the second`);continue}const P=new h(k,w);this.#t.set(k.id,P),this.#n.push(P)}this.#f<=0&&this.#b()}get count(){return this.#a}get physical(){return this.#s}get capacity(){return this.#c?this.#i:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let d=this.#o.bytes+this.#r.length*8;for(const f of this.#n)d+=f.bytes;return d}append(d){const f=this.#s;if(this.#p||!d)return{from:f,to:f};const w=d.length|0;if(w===0)return{from:f,to:f};if(this.#u)for(let P=0;P<w;P++)this.#r[f+P]=d[P];if(this.#s=f+w,this.#a+=w,this.#o.grow(this.#s),!this.#c){if(this.#s>=this.#f)this.#b();else for(const P of this.#n)P.touch();return{from:f,to:this.#s}}this.#m(this.#s);const k=this.#n;for(let P=0;P<k.length;P++)k[P].appendColumn(d,f,w);return{from:f,to:this.#s}}appendPacked(d,f){const w=this.#s;if(this.#p||!d)return{from:w,to:w};const k=d.count|0;if(k===0)return{from:w,to:w};if(this.#u&&f)for(let G=0;G<k;G++)this.#r[w+G]=f[G];this.#s=w+k,this.#a+=k,this.#o.grow(this.#s),this.#c||this.#b(),this.#m(this.#s);const P=new Map;for(const G of d.columns)P.set(G.id,G);for(const G of this.#n){const K=P.get(G.id);K?G.appendPacked(K,w,k):G.grow(this.#i)}return{from:w,to:this.#s}}source(d){if(this.#u)return this.#r[d];if(!(d<0||d>=this.#s))return this.#g(d)}setSource(d,f){this.#p||d<0||d>=this.#s||this.#u&&(this.#r[d]=f)}get(d,f){const w=this.#t.get(d);return w?w.get(f):void 0}set(d,f,w){if(this.#p||f<0||f>=this.#s)return;const k=this.#t.get(d);if(!k){A(`store.set.${d}`,`set() on unknown column "${d}"`);return}k.set(f,w)}remove(d){return this.#p||d<0||d>=this.#s||this.#o.get(d)===1?!1:(this.#o.set(d),this.#l++,this.#a--,!0)}live(d){return d<0||d>=this.#s?!1:this.#o.get(d)===0}compact(d={}){if(this.#p||this.#l===0||!d.force&&this.#l/this.#s<this.#h)return null;const f=this.#s,w=new Uint32Array(f);let k=0;for(let P=0;P<f;P++)w[P]=this.#o.get(P)===1?g:k++;for(const P of this.#n)P.compact(w,f,k);if(this.#u){const P=this.#r;for(let G=0;G<f;G++)w[G]!==g&&(P[w[G]]=P[G]);P.length=k}return this.#s=k,this.#a=k,this.#l=0,this.#o=new $(Math.max(this.#i,k)),w}column(d){return this.#t.get(d)}columns(){return this.#n.slice()}liveIndices(){const d=new Uint32Array(this.#a);if(this.#l===0){for(let w=0;w<this.#s;w++)d[w]=w;return d}let f=0;for(let w=0;w<this.#s;w++)this.#o.get(w)===0&&(d[f++]=w);return d}convert(d,f){const w=this.#t.get(d);return w?w.convert(f):!1}destroy(){if(!this.#p){this.#p=!0;for(const d of this.#n)d.release();this.#t.clear(),this.#n.length=0,this.#r.length=0,this.#o.release(),this.#s=0,this.#a=0,this.#l=0,this.#i=0}}#m(d){if(d<=this.#i)return;let f=this.#i||this.#d;for(;f<d;)f*=2;for(const w of this.#n)w.grow(f);this.#o.grow(f),this.#i=f}#g(d){const f={};for(const w of this.#n)f[w.id]=w.get(d);return f}#b(){if(this.#c)return;let d=this.#d;for(;d<this.#s;)d*=2;this.#c=!0,this.#i=d,this.#o.grow(d);for(const f of this.#n)f.columnarise(d,this.#s)}}}),Ve("packages/core/src/store/pool.js",function(e,D){"use strict";Object.defineProperty(e,"MaskPool",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"sharedPool",{enumerable:!0,get:function(){return L}});const re=64,A=8;function Y(H){let $=re;for(;$<H;)$*=2;return $}class I{#e=new Map;#t=new WeakSet;#n;#r=0;#s={acquired:0,reused:0,released:0};constructor($={}){this.#n=$.limit??A}get bytes(){return this.#r}mask($){const X=new Uint8Array(this.#i($),0,$);return X.fill(0),X}indices($){return new Uint32Array(this.#i($*4),0,$)}release($){if(!$||!$.buffer)return!1;const X=$.buffer;if(!this.#t.has(X))return!1;this.#t.delete(X),this.#s.released++;const F=X.byteLength;let j=this.#e.get(F);return j||this.#e.set(F,j=[]),j.length>=this.#n||(j.push(X),this.#r+=F),!0}releaseAll($){for(const X of $)this.release(X)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#s,retained:this.#r}}#i($){const X=Y($),F=this.#e.get(X);this.#s.acquired++;let j;return F&&F.length?(j=F.pop(),this.#r-=X,this.#s.reused++):j=new ArrayBuffer(X),this.#t.add(j),j}}function L(){return Q??=new I,Q}let Q=null}),Ve("packages/core/src/compute/sortspec.js",function(e,D){"use strict";Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return L}});function re(Q){return{locale:Q===void 0?void 0:String(Q),numeric:!0,sensitivity:"variant"}}function A(Q){return!!Q&&typeof Q.compare!="function"}function Y(Q){if(!Q)return!0;for(let H=0;H<Q.length;H++)if(!A(Q[H]))return!1;return!0}function I(Q,H){const $=Q.col!==void 0?Q.col:Q.handle&&Q.handle.id,X=Q.locale!==void 0?Q.locale:H;return{col:$,descending:Q.descending!==void 0?!!Q.descending:Q.dir==="desc",nullsFirst:!!Q.nullsFirst,collation:re(X)}}function L(Q,H){const $=Q||[],X=new Array($.length);for(let F=0;F<$.length;F++)X[F]=I($[F],H);return X}}),Ve("packages/core/src/compute/facet.js",function(e,D){"use strict";Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"orderedReader",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"toNumeric",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return r}}),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 d}}),Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return w}});const re=D("packages/core/src/compute/handle.js"),A=re.presenceReader,Y=re.valueReader,I=re.dictSize,L=re.dictValue,Q=Object.freeze(["equal","quantile","log"]),H=Object.freeze(["hour","day","week","month","quarter","year"]),$=20,X=50,F=1e4;function j(k,P){if(!k)return"none";const G=P;if(G&&(G.multi===!0||typeof G.items=="function"))return"category";const K=P&&P.base;if(K==="date"||K==="datetime"||K==="time"||K==="dateString")return"date";switch(k.kind){case"bitset":return"boolean";case"float64":case"int32":return"numeric";case"dictionary":return"category";case"multi":return"category";default:return K==="number"?"numeric":K==="boolean"?"boolean":K==="text"?"category":"none"}}function v(k){const P=k.values,G=k.kind;if((G==="float64"||G==="int32")&&P)return q=>P[q];const K=Y(k);return q=>b(K(q))}function b(k){if(typeof k=="number")return k;if(k instanceof Date)return k.getTime();if(k==null||k==="")return NaN;if(typeof k=="boolean")return k?1:0;if(typeof k=="string"){const P=Number(k);if(Number.isFinite(P))return P;const G=Date.parse(k);return Number.isFinite(G)?G:NaN}return NaN}function l(k,P,G,K=X){if(!k)return{cardinality:0,exact:!0};if(k.dict)return{cardinality:I(k.dict),exact:!0};if(k.kind==="bitset")return{cardinality:2,exact:!0};const q=Y(k),B=P?P.length:G,E=new Set;for(let S=0;S<B;S++){const C=q(P?P[S]:S);if(C!=null&&(E.add(C),E.size>K))return{cardinality:E.size,exact:!1}}return{cardinality:E.size,exact:!0}}const g=36e5,o=864e5;function t(k,P=$){const G=Number.isFinite(k)&&k>0?k:0,K=Math.max(1,P)*2;return G/g<=K?"hour":G/o<=K?"day":G/(7*o)<=K?"week":G/(30*o)<=K?"month":G/(91*o)<=K?"quarter":"year"}function s(k,P){if(!Number.isFinite(k))return NaN;const G=new Date(k);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 K=(G.getDay()+6)%7;return G.setDate(G.getDate()-K),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 r(k,P){const G=new Date(k);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(k,P,G){const K=v(k),q=A(k),B=P?P.length:G;let E=1/0,S=-1/0,C=0,N=0;for(let O=0;O<B;O++){const T=P?P[O]:O;if(q&&!q(T)){C++;continue}const R=K(T);if(!Number.isFinite(R)){C++;continue}R<E&&(E=R),R>S&&(S=R),N++}return{min:E,max:S,nulls:C,finite:N}}function n(k,P,G,K){const q=v(k),B=A(k),E=P?P.length:G,S=E>K?E/K:1,C=[];for(let O=0;O<E;O+=S){const T=P?P[Math.floor(O)]:Math.floor(O);if(B&&!B(T))continue;const R=q(T);Number.isFinite(R)&&C.push(R)}const N=Float64Array.from(C);return N.sort(),N}function m(k,P,G,K={}){const q=K.kind||j(k,K.type);return q==="none"||!k?{kind:"none",buckets:[],suppressed:"type"}:q==="boolean"?c(k,P,G,K):q==="category"?a(k,P,G,K):h(k,P,G,q,K)}function c(k,P,G,K={}){const q=A(k);let B=0;if(q){const S=P?P.length:G;for(let C=0;C<S;C++)q(P?P[C]:C)||B++}const E=[{value:!1,label:"false"},{value:!0,label:"true"}];return B>0&&K.blanks!==!1&&E.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:E}}function a(k,P,G,K){const q=K.cardinalityLimit??X,{cardinality:B}=l(k,P,G,q);if(B>q&&(K.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:B};const E=Y(k),S=P?P.length:G,C=new Map;let N=0;for(let U=0;U<S;U++){const V=E(P?P[U]:U);if(V==null||V===""){N++;continue}if(Array.isArray(V)){if(!V.length){N++;continue}for(const J of V)C.set(J,(C.get(J)||0)+1);continue}C.set(V,(C.get(V)||0)+1)}let O=[...C.entries()];K.order==="alpha"?O.sort((U,V)=>String(U[0]).localeCompare(String(V[0]))):O.sort((U,V)=>V[1]-U[1]);let T=0,R=0;if(O.length>q){R=O.length-q;for(let U=q;U<O.length;U++)T+=O[U][1];O=O.slice(0,q)}const x=O.map(([U])=>({value:U,label:String(U)}));return T>0&&x.push({remainder:!0,label:`Other (${R} values)`}),N>0&&K.blanks!==!1&&x.push({null:!0,label:"Empty"}),{kind:"category",buckets:x,cardinality:B}}function u(k,P,G,K,q){const B=n(k,P,G,F),E=B.length;if(E<100)return null;const S=B[Math.floor(.01*E)],C=B[Math.ceil(.99*E)-1];return!(C>S)||q-K<=2*(C-S)?null:{lo:S,hi:C}}function h(k,P,G,K,q){const{min:B,max:E,nulls:S,finite:C}=i(k,P,G);if(!C)return{kind:K,buckets:S&&q.blanks!==!1?[{null:!0,label:"Empty"}]:[],empty:!0};const N=Math.max(1,Math.floor(q.buckets||$));let O=[];if(K==="date"){const R=H.includes(q.granularity)?q.granularity:t(E-B,N);let x=s(B,R);for(;x<=E&&O.length<4096;){const U=r(x,R);if(!(U>x))break;O.push({from:x,to:U}),x=U}return{kind:K,buckets:p(O,q.blanks===!1?0:S),granularity:R}}const T=Q.includes(q.strategy)?q.strategy:"equal";if(T==="quantile"){const R=n(k,P,G,F);if(R.length){const x=[R[0]];for(let U=1;U<N;U++){const V=R[Math.min(R.length-1,Math.floor(U/N*R.length))];V>x[x.length-1]&&x.push(V)}x.push(E);for(let U=0;U<x.length-1;U++)O.push({from:x[U],to:x[U+1]})}}else if(T==="log"&&B>0){const R=Math.log10(B),U=(Math.log10(E)-R)/N||1;for(let V=0;V<N;V++)O.push({from:10**(R+V*U),to:10**(R+(V+1)*U)})}if(!O.length&&T==="equal"){const R=u(k,P,G,B,E);if(R){const x=(R.hi-R.lo)/N;R.lo>B&&O.push({from:B,to:R.lo,overflow:"low"});for(let U=0;U<N;U++)O.push({from:R.lo+U*x,to:R.lo+(U+1)*x});O[O.length-1].to=R.hi,R.hi<E&&O.push({from:R.hi,to:E,overflow:"high"})}}if(!O.length){const R=(E-B)/N||1;for(let x=0;x<N;x++)O.push({from:B+x*R,to:B+(x+1)*R})}return O[O.length-1].to=E,{kind:K,buckets:p(O,q.blanks===!1?0:S),strategy:T,min:B,max:E}}function p(k,P){return P>0?[...k,{null:!0,label:"Empty"}]:k}function y(k,P,G,K,q){const B=K&&K.buckets||[],E=q&&q.length>=B.length?q.subarray(0,B.length):new Uint32Array(B.length);if(E.fill(0),!k||!B.length)return E;const S=B.length-1,C=!!B[S]&&B[S].null===!0,N=P?P.length:G;if(K.kind==="boolean"){const U=Y(k);for(let V=0;V<N;V++){const J=U(P?P[V]:V);if(J==null){C&&E[S]++;continue}E[J?1:0]++}return E}if(K.kind==="category"){const U=new Map;for(let _=0;_<B.length;_++)!B[_].null&&!B[_].remainder&&U.set(B[_].value,_);const V=B.findIndex(_=>_.remainder),J=Y(k);for(let _=0;_<N;_++){const ee=J(P?P[_]:_);if(ee==null||ee===""){C&&E[S]++;continue}if(Array.isArray(ee)){if(!ee.length){C&&E[S]++;continue}for(const Z of ee){const ne=U.get(Z);ne!==void 0?E[ne]++:V>=0&&E[V]++}continue}const W=U.get(ee);W!==void 0?E[W]++:V>=0&&E[V]++}return E}const O=C?B.length-1:B.length,T=new Float64Array(O+1);for(let U=0;U<O;U++)T[U]=B[U].from;T[O]=O?B[O-1].to:0;const R=v(k),x=A(k);for(let U=0;U<N;U++){const V=P?P[U]:U;if(x&&!x(V)){C&&E[S]++;continue}const J=R(V);if(!Number.isFinite(J)){C&&E[S]++;continue}const _=d(T,O,J);_>=0&&E[_]++}return E}function d(k,P,G){if(!P||G<k[0])return-1;if(G>=k[P])return G===k[P]?P-1:-1;let K=0,q=P-1;for(;K<q;){const B=K+q+1>>>1;G>=k[B]?K=B:q=B-1}return K}function f(k,P,G,K={}){const q=K.bounds||m(k,K.boundsIndices??P,G,K);return{bounds:q,counts:y(k,P,G,q)}}const w=f}),Ve("packages/core/src/compute/pivotmatrix.js",function(e,D){"use strict";Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return v}}),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 s}});const A=D("packages/core/src/compute/handle.js").valueComparator,I=D("packages/core/src/compute/total.js").total,Q=D("packages/core/src/compute/group.js").packKeys,H=D("packages/core/src/compute/pivot.js"),$=H.joinPath,X=H.DEFAULT_PATH_SEPARATOR,F=H.DEFAULT_MAX_COLUMNS,j="";function v(r,i,n={}){const m=n.separator||X,c=r||[],a=i instanceof Uint32Array?i:Uint32Array.from(i||[]),u=a.length;if(c.length===0)return{tuples:[[]],paths:[j],buckets:[a]};const{keyOf:h,readers:p}=Q(c,a,0),y=new Map,d=[],f=[],w=[];for(let B=0;B<u;B++){const E=a[B],S=h(E);let C=y.get(S);if(C===void 0){C=d.length,y.set(S,C),f.push(S);const N=new Array(p.length);for(let O=0;O<p.length;O++)N[O]=p[O](E);d.push(N),w.push([])}w[C].push(E)}const k=A(n.locale),P=d.map((B,E)=>E);P.sort((B,E)=>{const S=d[B],C=d[E];for(let N=0;N<S.length;N++){const O=b(S[N],C[N],k);if(O!==0)return O}return B-E});const G=new Array(P.length),K=new Array(P.length),q=new Array(P.length);for(let B=0;B<P.length;B++){const E=P[B];G[B]=d[E],K[B]=$(d[E],m),q[B]=Uint32Array.from(w[E])}return{tuples:G,paths:K,buckets:q}}function b(r,i,n){const m=r==null,c=i==null;return m||c?m&&c?0:m?1:-1:n(r,i)}function l(r,i,n){const m=[];for(let c=0;c<r.length;c++)n.has(r[c])&&m.push(r[c]);return Uint32Array.from(m)}function g(r,i,n,m){return{value:i.length?I(r,i,n,m):null,leaves:i,count:i.length}}function o(r){const i=r&&r.opts||{},n=i.separator||X,m=i.totalContext||{locale:i.locale},c=(r.measures||[]).filter(K=>K&&K.handle),a=r.leaves instanceof Uint32Array?r.leaves:Uint32Array.from(r.leaves||[]),u=v(r.rowHandles||[],a,{...i,separator:n}),h=v(r.columnHandles||[],a,{...i,separator:n}),p=i.maxColumns===void 0?F:i.maxColumns,y=h.paths.length*Math.max(1,c.length),d=new Map;if(p&&y>p)return{rowAxis:u,columnAxis:h,measures:c.map(K=>({colId:K.colId,fn:K.fn})),body:d,rowMargin:d,columnMargin:d,grand:d,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 f=new Map,w=new Map,k=new Map,P=new Map,G=h.buckets.map(K=>new Set(K));for(let K=0;K<h.paths.length;K++){const q=h.buckets[K],B=h.paths[K];for(const E of c)k.set(s(B,E.colId),g(E.handle,q,E.fn,m))}for(let K=0;K<u.paths.length;K++){const q=u.buckets[K],B=u.paths[K];for(const E of c)w.set(s(B,E.colId),g(E.handle,q,E.fn,m));for(let E=0;E<h.paths.length;E++){const S=l(q,h.buckets[E],G[E]);if(S.length===0)continue;const C=h.paths[E];for(const N of c)f.set(t(B,C,N.colId),g(N.handle,S,N.fn,m))}}for(const K of c)P.set(K.colId,g(K.handle,a,K.fn,m));return{rowAxis:u,columnAxis:h,measures:c.map(K=>({colId:K.colId,fn:K.fn})),body:f,rowMargin:w,columnMargin:k,grand:P,columns:y,error:null}}function t(r,i,n){return`${r}\0${i}\0${n}`}function s(r,i){return`${r}\0${i}`}}),Ve("packages/core/src/compute/reference.js",function(e,D){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return o}});const A=D("packages/core/src/internal/paths.js").getPath,Y=D("packages/core/src/compute/handle.js"),I=Y.isMissing,L=Y.valueComparator,H=D("packages/core/src/compute/filter.js").testValue,$="",X="\0";function F(r,i){const n=i.includes(".")?A(r,i):r?.[i];return n===void 0?null:n}function j(r,i,n={}){const m=i||[];let c=r.map((a,u)=>u);if(m.length===0)return c;for(let a=m.length-1;a>=0;a--)c=v(r,c,m[a],n);return c}function v(r,i,n,m){const c=n.locale!==void 0?n.locale:m.locale,a=L(c),u=n.descending!==void 0?!!n.descending:n.dir==="desc",h=[],p=[];for(const f of i){const w=F(r[f],n.col);I(w)?p.push(f):h.push(f)}const y=new Map;for(let f=0;f<h.length;f++)y.set(h[f],f);const d=(f,w)=>{const k=F(r[f],n.col),P=F(r[w],n.col);let G;return typeof n.compare=="function"?(G=n.compare(k,P,r[f],r[w],u),u&&(G=-G)):G=u?a(P,k):a(k,P),G!==0?G:y.get(f)-y.get(w)};return h.sort(d),n.nullsFirst?p.concat(h):h.concat(p)}function b(r,i,n={}){const m=[];for(let c=0;c<r.length;c++)l(r[c],i,n,c)&&m.push(c);return m}function l(r,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=>l(r,u,n,m));const a=c.every(u=>l(r,u,n,m));return i.op==="not"?!a:a}return i.col===void 0&&typeof n.custom=="function"?!!n.custom(i,r,m):H(F(r,i.col),i,n.locale)}function g(r,i,n,m){const c=n||r.map((p,y)=>y),a=new Map,u=[],h=[];for(const p of c){const y=i.map((w,k)=>{const P=F(r[p],w);return m&&m[k]?m[k](P):P}),d=y.map(w=>w==null?X:String(w)).join($);let f=a.get(d);f===void 0&&(f=u.length,a.set(d,f),u.push(y),h.push([])),h[f].push(p)}return{keys:u,buckets:h}}function o(r,i,n={}){const m=L(n.locale),c=r.filter(u=>!I(u)),a=c.map(t).filter(u=>u!==null);switch(i){case"count":return r.length;case"countValues":return c.length;case"sum":return a.reduce((u,h)=>u+h,0);case"avg":return c.length===0?null:a.reduce((u,h)=>u+h,0)/c.length;case"min":return c.length===0?null:c.reduce((u,h)=>m(h,u)<0?h:u);case"max":return c.length===0?null:c.reduce((u,h)=>m(h,u)>0?h:u);case"first":return r.length===0?null:s(r[0]);case"last":return r.length===0?null:s(r[r.length-1]);default:return null}}function t(r){if(typeof r=="number")return Number.isNaN(r)?null:r;if(r==null||r===""||typeof r=="boolean")return null;if(r instanceof Date)return r.getTime();const i=Number(r);return Number.isNaN(i)?null:i}function s(r){return r===void 0?null:r}}),Ve("packages/core/src/compute/index.js",function(e,D){"use strict";const re=D("packages/core/src/compute/sort.js");Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return re.sortColumn}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return re.sortMulti}}),Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return re.radixSortFloat64}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return re.radixSortInt32}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return re.rankSortDictionary}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return re.mergeSortComparator}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return re.collateStringRanks}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return re.rankSortStrings}});const A=D("packages/core/src/compute/sortspec.js");Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return A.collationDescriptor}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return A.isPortableSort}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return A.isPortableSortSet}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return A.describeSortEntry}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return A.describeSort}});const Y=D("packages/core/src/compute/filter.js");Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return Y.evaluateFilters}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return Y.evaluateCondition}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return Y.compact}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return Y.testValue}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return Y.compilePredicate}}),Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return Y.releaseMask}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return Y.pruneColumn}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return Y.mentionsColumn}});const I=D("packages/core/src/compute/group.js");Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return I.groupByColumns}}),Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return I.packKeys}});const L=D("packages/core/src/compute/facet.js");Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return L.facet}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return L.computeBounds}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return L.countInto}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return L.bucketOf}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return L.facetKind}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return L.cardinalityOf}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return L.pickGranularity}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return L.floorTo}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return L.advance}}),Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return L.STRATEGIES}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return L.GRANULARITIES}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return L.DEFAULT_BUCKETS}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return L.DEFAULT_CARDINALITY_LIMIT}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return L.QUANTILE_SAMPLE}});const Q=D("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 H=D("packages/core/src/compute/pivot.js");Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return H.pivot}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return H.resolvePivotKeys}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return H.pivotKey}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return H.joinPath}}),Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return H.KEY_DELIMITER}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return H.DEFAULT_PATH_SEPARATOR}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return H.DEFAULT_MAX_COLUMNS}});const $=D("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return $.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return $.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return $.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return $.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return $.GRAND_PATH}});const X=D("packages/core/src/compute/reference.js");Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return X.referenceSort}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return X.referenceFilter}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return X.referenceGroup}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return X.referenceTotal}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return X.referencePasses}}),Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return X.referenceValue}});const F=D("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return F.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return F.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return F.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return F.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return F.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return F.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return F.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return F.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return F.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return F.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return F.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return F.isMissing}});const j=D("packages/core/src/compute/sketch.js");Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return j.Welford}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return j.Reservoir}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return j.HyperLogLog}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return j.SpaceSaving}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return j.KLL}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return j.hash32}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j.SKETCH_BOUNDS}});const v=D("packages/core/src/compute/windowed.js");Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return v.Window}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return v.WINDOW_KINDS}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return v.openWindow}});const b=D("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 l=D("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return l.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return l.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return l.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return l.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return l.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return l.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return l.anomalyCondition}});const g=D("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}})}),Ve("packages/core/src/source/rows.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_ROW_HEIGHT",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"KEY_SEP",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"groupPrefixKeys",{enumerable:!0,get:function(){return g}});const A=D("packages/core/src/internal/warn.js").warnOnce,I=D("packages/core/src/internal/predicates.js").isFunction,L=32,Q="\0";function H(o){return new $(o)}class ${#e;#t;constructor(t){this.#e=I(t&&t.rowKey)?t.rowKey:null;const s=t&&t.config?t.config.rowHeight:void 0;this.#t=typeof s=="number"||I(s)?s:L}get keyed(){return this.#e!==null}keyOf(t,s){if(this.#e){const r=this.#e(t);if(r!=null)return String(r)}else A("source.rowKey.missing","no config.rowKey; falling back to index identity.","Row changes, streaming dedupe, selection persistence and remote reload are disabled.");return`#${s}`}heightOf(t){return I(this.#t)?Number(this.#t(t))||L:this.#t}leaf(t,s,r=0,i=null){const n={key:this.keyOf(t,s),data:t,level:r,parent:i,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:s};return n.height=this.heightOf(n),n}group(t){const s={key:l(t.keyPath||t.path),data:null,level:t.level,parent:t.parent||null,children:[],group:!0,expanded:t.expanded!==!1,leafCount:t.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:t.column,groupValue:t.value,groupPath:t.path,hasChildren:t.hasChildren!==!1};return t.totals&&(s.totals=t.totals),s.height=this.heightOf(s),s}footer(t){const s={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 s.height=this.heightOf(s),s}detail(t,s){return{key:`${t.key}${Q}detail`,data:t.data,level:t.level+1,parent:t,group:!1,detail:!0,expanded:!1,leafCount:0,height:s,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:t.key}}grandTotal(t,s){const r={key:`${Q}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:s,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:t};return r.height=this.heightOf(r),r}skeleton(t,s=0,r=!1){const i={key:`${Q}pending${Q}${t}`,data:null,level:s,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:t,selected:!1,physical:null,pending:!0};return r&&(i.loadError=!0),i.height=this.heightOf(i),i}}function X(o,t,s,r){return{key:`${Q}pinned${Q}${s}${Q}${t}`,data:o,level:0,parent:null,group:!1,expanded:!1,leafCount:0,height:r,index:null,selected:!1,physical:null,hasChildren:!1,pinned:s}}function F(o,t){return new Proxy([],{get(s,r,i){if(r==="length")return o();if(typeof r=="string"){const n=Number(r);if(Number.isInteger(n)&&n>=0)return t(n)}return Reflect.get(s,r,i)},has(s,r){if(typeof r=="string"){const i=Number(r);if(Number.isInteger(i)&&i>=0)return i<o()}return Reflect.has(s,r)}})}function j(o){return o==null?"":String(o)}const v="";function b(o){if(o==null)return v;const t=String(o);return t.startsWith(v)?v+t:t}function l(o){const t=o||[];let s="g";for(let r=0;r<t.length;r++)s+=Q+b(t[r]);return s}function g(o){const t=new Array(o.length),s=[];for(let r=0;r<o.length;r++)s.push(o[r]),t[r]=l(s);return t}}),Ve("packages/core/src/source/handles.js",function(e,D){"use strict";Object.defineProperty(e,"HandleProvider",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"createHandleProvider",{enumerable:!0,get:function(){return Q}});const A=D("packages/core/src/internal/predicates.js").isFunction,I=D("packages/core/src/internal/warn.js").warnOnce;class L{#e;#t;#n;#r=new Map;#s=0;constructor($,X,F){this.#e=$,this.#t=X,this.#n=A(F)?F:()=>!1}get store(){const $=this.#e.store;return $&&A($.column)?$:null}invalidate(){this.#s++}handle($){const X=this.store;if(X){const b=X.column($);if(b)return b}const F=this.#r.get($);if(F&&F.builtAt===this.#s)return F.handle;const j=this.#i($);if(!j)return;if(X&&this.#n()){I(`source.dropped.${$}`,`column "${$}" 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 v=this.#a(j);return this.#r.set($,{handle:v,builtAt:this.#s}),v}#i($){const X=this.#e.columns;return X&&A(X.get)?X.get($):void 0}#a($){const X=this.#t()||[],F=X.length,j=new Array(F),v=A($.getValue)?l=>$.getValue(l):l=>l?.[$.field||$.id];for(let l=0;l<F;l++)j[l]=X[l]===void 0?void 0:v(X[l]);const b=this.#s;return{id:$.id,kind:"object",nullable:!1,values:j,presence:null,dict:null,offsets:null,get(l){return j[l]},version:b}}}function Q(H,$,X){return new L(H,$,X)}}),Ve("packages/core/src/compute/incremental.js",function(e,D){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return X}});const A=D("packages/core/src/store/columnstore.js").toFloat,Y=Object.freeze(["sum","avg","countValues","min","max"]),I=Object.freeze(["float64"]),L=1e15;function Q(F,j){return typeof F!="string"||!Y.includes(F)?!1:!!j&&I.includes(j.kind)}function H(F){if(F==null)return null;const j=A(F);return Number.isNaN(j)?null:j}class ${#e;#t=0;#n=0;#r=0;#s=1/0;#i=-1/0;#a=!1;#l=!1;constructor(j){this.#e=j}get valid(){return this.#a&&!this.#l}get fn(){return this.#e}seed(j){this.#o();for(let v=0;v<j.length;v++){const b=H(j[v]);b!==null&&this.#c(b)}this.#a=!0}seedColumn(j,v,b){this.#o();for(let l=0;l<b.length;l++){const g=b[l];if(v&&v(g)===0)continue;const o=j[g];Number.isNaN(o)||this.#c(o)}this.#a=!0}#o(){this.#t=0,this.#n=0,this.#r=0,this.#s=1/0,this.#i=-1/0,this.#l=!1}#c(j){if(!Number.isFinite(j)){this.#l=!0;return}const v=this.#t+j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-v+j:j-v+this.#t,this.#t=v,this.#r++,j<this.#s&&(this.#s=j),j>this.#i&&(this.#i=j)}#u(j){const v=this.#t-j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-v-j:-j-v+this.#t,this.#t=v,this.#r--}update(j,v){if(!this.#a)return!1;const b=H(j),l=H(v);return b===null&&l===null?!0:b!==null&&!Number.isFinite(b)||l!==null&&!Number.isFinite(l)?!1:this.#e==="min"||this.#e==="max"?b===null||l===null?!1:this.#e==="min"?l<this.#s?(this.#s=l,!0):b>this.#s:l>this.#i?(this.#i=l,!0):b<this.#i:Math.abs(this.#t)>L?!1:(b!==null&&this.#u(b),l!==null&&this.#c(l),!0)}value(){switch(this.#e){case"countValues":return this.#r;case"avg":return this.#r?(this.#t+this.#n)/this.#r:null;case"min":return this.#r?this.#s:null;case"max":return this.#r?this.#i:null;default:return this.#t+this.#n}}invalidate(){this.#a=!1}}const X=$}),Ve("packages/core/src/source/filterwire.js",function(e,D){"use strict";Object.defineProperty(e,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return r}}),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 a}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"forEachCondition",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"mapConditions",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"normaliseFilterSet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"buildFilterSet",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"wireFilters",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"querySignature",{enumerable:!0,get:function(){return k}});const A=D("packages/core/src/internal/warn.js").warnOnce,Y="source.remote.hostFilter",I="source.where.pageRelative";function L(K,q){!Array.isArray(K)||!K.length||A(I,`filters.where (${K.join(", ")}) runs over the rows the ${q} 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(K){const q=(K||{}).config;!q||!q.hostFilter||A(Y,"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 H="source.where.notApplied";function $(K,q){A(`${H}:${K}`,`filters.where("${K}") is registered but the ${q} source holds only its fetched window`,"and cannot run the predicate over it: the predicate is not applied there, and rows it would","exclude stay on screen.","Give it a { condition } twin so the engine can narrow the fetch itself — that is the","supported route for a paged or remote source.")}const X="source.where.overThreshold";function F(K,q,B,E){!Array.isArray(K)||!K.length||A(`${X}:${q}`,`filters.where (${K.join(", ")}) is not applied to the ${q} pushdown source:`,B===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${B.toLocaleString()} rows, at or past the whereRowLimit of ${E.toLocaleString()}.`,"Running the predicate needs every matching row fetched and held here, which is the whole","download a pushdown source exists to avoid, so it is refused and the rows the predicate","would exclude stay on screen.","Give the predicate a { condition } twin so the engine narrows the fetch itself — that is the","route that works at any size — or raise `whereRowLimit` on the source config if you want the","download.")}const j=new Map;function v(K){let q=j.get(K);return q||(q=new Intl.DateTimeFormat("en-US",{timeZone:K,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),j.set(K,q)),q}function b(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function l(K,q){const B=v(q).formatToParts(new Date(K)),E={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const S of B)S.type==="year"?E.y=+S.value:S.type==="month"?E.m=+S.value:S.type==="day"?E.d=+S.value:S.type==="hour"?E.h=+S.value%24:S.type==="minute"?E.mi=+S.value:S.type==="second"&&(E.s=+S.value);return E}function g(K,q){const B=l(K,q);return Date.UTC(B.y,B.m-1,B.d,B.h,B.mi,B.s)-Math.floor(K/1e3)*1e3}function o(K,q,B,E){const S=Date.UTC(K,q-1,B),C=S-g(S,E);return S-g(C,E)}function t(K,q,B){const E=new Date(Date.UTC(K.y,K.m-1,K.d+q));return o(E.getUTCFullYear(),E.getUTCMonth()+1,E.getUTCDate(),B)}const s=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function r(K,q){if(typeof K!="string")return null;const B=K.trim().toLowerCase().replace(/[\s_-]+/g,""),E=/^last(\d*|n)days?$/.exec(B);if(E){const S=E[1]==="n"?"":E[1],C=Number(S||q);return!Number.isFinite(C)||C<=0?null:{kind:"lastNDays",n:Math.floor(C)}}switch(B){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(K,q={}){const B=r(K,q.n);if(!B)return null;const E=q.tz||b(),S=q.now instanceof Date?q.now.getTime():typeof q.now=="number"?q.now:Date.now(),C=l(S,E),N=o(C.y,C.m,C.d,E),O=t(C,1,E);let T=N,R=O;switch(B.kind){case"today":break;case"yesterday":T=t(C,-1,E),R=N;break;case"lastNDays":R=q.includeToday?O:N,T=t(C,q.includeToday?-(B.n-1):-B.n,E);break;case"thisWeek":{const x=Number.isFinite(q.weekStartsOn)?Number(q.weekStartsOn):1,V=(new Date(Date.UTC(C.y,C.m-1,C.d)).getUTCDay()-x+7)%7;T=t(C,-V,E),R=t(C,-V+7,E);break}case"thisMonth":T=o(C.y,C.m,1,E),R=o(C.m===12?C.y+1:C.y,C.m===12?1:C.m+1,1,E);break;case"thisQuarter":case"quarterToDate":{const x=Math.floor((C.m-1)/3)*3+1;T=o(C.y,x,1,E),R=B.kind==="quarterToDate"?O:x===10?o(C.y+1,1,1,E):o(C.y,x+3,1,E);break}case"thisYear":case"yearToDate":T=o(C.y,1,1,E),R=B.kind==="yearToDate"?O:o(C.y+1,1,1,E);break;default:return null}return{from:new Date(T).toISOString(),to:new Date(R).toISOString(),bounds:"[)",tz:E,relative:B.kind==="lastNDays"?`last${B.n}Days`:B.kind,n:B.n}}function n(K){if(!K||typeof K!="object")return null;const q=K.value;if(q&&typeof q=="object"&&!Array.isArray(q)&&"relative"in q)return{token:String(q.relative),n:typeof q.n=="number"?q.n:void 0};if(K.op==="relative"&&typeof K.value=="string")return{token:K.value,n:void 0};const B=K.meta;return B&&typeof B.relative=="string"&&K.value===void 0?{token:B.relative,n:typeof B.n=="number"?B.n:void 0}:null}function m(){return`Known tokens: ${s.filter(q=>q!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function c(K){const q=n(K);return q?r(q.token,q.n)!==null:!1}function a(K,q={}){const B=n(K);if(!B)return K;const E=i(B.token,{...q,n:B.n});return E?{...K,type:K.type||"date",op:"between",value:[E.from,E.to],bounds:K.bounds||E.bounds,meta:{...K.meta||{},relative:E.relative,tz:E.tz}}:(A(`source.relative.${B.token}`,`unknown relative date token "${B.token}"; sending the condition unresolved.`,m()),K)}function u(K){return!!K&&typeof K=="object"&&Array.isArray(K.conditions)}function h(K,q){if(K){if(u(K)){for(const B of K.conditions)h(B,q);return}q(K)}}function p(K,q){if(!K)return null;if(!u(K))return q(K);const B=K;let E=!1;const S=[];for(const C of B.conditions){const N=p(C,q);N!==C&&(E=!0),N&&S.push(N)}return!E&&S.length===B.conditions.length?K:S.length?{...B,conditions:S}:null}function y(K){if(!K)return null;if(!u(K))return K;const q=K,B=[];for(const E of q.conditions){const S=y(E);S&&B.push(S)}return B.length?{op:q.op,conditions:B}:null}function d(K){const q=y(K);return q?u(q)&&q.op==="and"?q:{op:"and",conditions:[q]}:null}function f(K){const q=(K||[]).filter(Boolean);return q.length?{op:"and",conditions:q}:null}function w(K,q={}){const B=p(K,E=>a(E,q));return d(B)}function k(K){const q=P(K.filters??null);return JSON.stringify([q,K.sort??null,K.quick??"",K.groupBy??null,K.pivotBy??null,G(K.context)])}function P(K){if(!K)return null;if(u(K)){const E=K;return{op:E.op,conditions:E.conditions.map(P)}}const q=K,B=q.meta&&typeof q.meta.relative=="string"?q.meta.relative:n(q)?.token;return{col:q.col,op:q.op,bounds:q.bounds??null,caseSensitive:q.caseSensitive??!1,value:B?`rel:${B}`:q.value??null}}function G(K){if(K==null)return null;try{return JSON.parse(JSON.stringify(K))}catch{return A("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),Ve("packages/core/src/source/tree.js",function(e,D){"use strict";Object.defineProperty(e,"SYNTHETIC",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"buildFromPath",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"assignLevels",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resolveTree",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"buildTree",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"indexTree",{enumerable:!0,get:function(){return l}});const A=D("packages/core/src/internal/predicates.js").isFunction,I=D("packages/core/src/internal/warn.js").warnOnce,L="",Q="\0tree:";function H(g,o){return{physical:g,key:o,level:0,children:[],value:void 0}}function $(g,o){const t=[],s=new Map;for(let r=0;r<g.length;r++){const i=g[r],n=o.pathOf(i),m=Array.isArray(n)?n.map(a=>String(a)):[];if(!m.length){const a=H(i,o.keyOf(i));t.push(a);continue}let c=null;for(let a=0;a<m.length;a++){const u=m.slice(0,a+1).join(L),h=a===m.length-1;let p=s.get(u);p&&h&&p.physical===-1&&(p.physical=i,p.key=o.keyOf(i)),p||(p=H(h?i:-1,h?o.keyOf(i):Q+u),p.level=a,p.value=m[a],s.set(u,p),c?c.children.push(p):t.push(p)),c=p}}return{roots:t,nodes:s}}function X(g,o){const t=new Map,s=[];for(let m=0;m<g.length;m++){const c=g[m],a=o.keyOf(c),u=H(c,a);t.set(a,u);const h=o.parentOf(c);h!=null&&h!==""&&s.push({node:u,parent:String(h)})}let r=null;const i=new Map;for(const{node:m,parent:c}of s){const a=t.get(c);if(a){i.set(m.key,a);continue}o.orphans&&o.orphans!=="root"&&(r||(r=H(-1,`${Q}orphans`),r.value=o.orphans),i.set(m.key,r))}const n=[];for(const m of t.values()){const c=i.get(m.key);c?c.children.push(m):n.push(m)}return r&&r.children.length&&n.push(r),{roots:F(n,t,o.orphans,r),nodes:t}}function F(g,o,t,s){const r=new Set,i=[...g];for(;i.length;){const u=i.pop();if(!r.has(u.key)){r.add(u.key);for(const h of u.children)i.push(h)}}const n=[];for(const u of o.values())r.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(h=>r.has(h.key));if(!m)return[...g,...n];let c=s;const a=[...g];return c||(c=H(-1,`${Q}orphans`),c.value=t,a.push(c)),c.children.push(...n),a}function j(g){let o=0;const t=(s,r)=>{for(const i of s)i.level=r,r>o&&(o=r),i.children.length&&t(i.children,r+1)};return t(g,0),o}function v(g,o){if(!g||typeof g!="object")return null;const t=g.path,s=g.parentKey,r=A(g.hasChildren)?i=>!!g.hasChildren(o.dataAt(i)):null;if(A(t))return{mode:"path",pathOf:i=>t(o.dataAt(i)),keyOf:o.keyOf,declaresChildren:r};if(s!=null){const i=A(s)?s:n=>n?.[s];return{mode:"parentKey",parentOf:n=>i(o.dataAt(n)),keyOf:o.keyOf,orphans:g.orphans||"root",declaresChildren:r}}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"?$(g,o):X(g,o),s=j(t.roots);return{...t,depth:s}}function l(g,o){const t=new Map,s=r=>{for(let i=0;i<r.length;i++){const n=r[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:r.length,hasChildren:n.children.length>0||m,lazy:c})}n.children.length&&s(n.children)}};return s(g),t}}),Ve("packages/core/src/source/settle.js",function(e,D){"use strict";Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"ARRIVAL_REASONS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"isArrival",{enumerable:!0,get:function(){return I}});const re=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function A(L){const Q=L&&typeof L=="object"?L.reason:null;return typeof Q=="string"&&re.includes(Q)}const Y=Object.freeze(["page","total"]);function I(L){const Q=L&&typeof L=="object"?L.reason:null;return typeof Q=="string"&&Y.includes(Q)}}),Ve("packages/core/src/source/memory.js",function(e,D){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"quickMatcher",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"MemorySource",{enumerable:!0,get:function(){return V}});const A=D("packages/core/src/internal/lru.js").Lru,Y=D("packages/core/src/internal/warn.js"),I=Y.warnOnce,L=Y.fail,H=D("packages/core/src/internal/predicates.js").isFunction,X=D("packages/core/src/internal/compare.js").defaultCompare,j=D("packages/core/src/internal/merge.js").mergeRow,v=D("packages/core/src/source/rows.js"),b=v.createRowFactory,l=v.groupKey,g=v.groupPathElement,o=v.groupPrefixKeys,t=v.lazyRowView,r=D("packages/core/src/source/handles.js").createHandleProvider,i=D("packages/core/src/compute/incremental.js"),n=i.RunningTotal,m=i.isIncremental,a=D("packages/core/src/compute/handle.js").presenceReader,u=D("packages/core/src/source/filterwire.js"),h=u.querySignature,p=u.mapConditions,y=u.resolveRelativeCondition,d=D("packages/core/src/source/tree.js"),f=d.buildTree,w=d.resolveTree,k=d.indexTree,P=D("packages/core/src/source/settle.js"),G=P.PIPELINE_SETTLE_REASONS,K=P.isPipelineSettle,q=Object.freeze(["filter","sort","group","total","pivot","flatten"]),B=Object.freeze([]);function E(J,_){if(!J)return null;const ee=_==="grand"?J.grandTotal:J.groupTotal;return ee??J.total}function S(J){return!!J&&!J.running}function C(J){if(J)return J.value&&H(J.value.compare)?J.value.compare:H(J.compare)?J.compare:void 0}function N(J){const _=J&&J.dataType;return!_||!H(_.items)?null:{items:_.items,type:J.itemType&&J.itemType.name||"text"}}function O(J){return!!J&&(typeof J=="object"||typeof J=="function")&&H(J.then)}const T=new Uint32Array(0),R=4096;function x(J,_){return new V(J,_)}function U(J,_){if(_==="regex")try{const ee=new RegExp(J,"iu");return W=>ee.test(W)}catch{return ee=>ee.includes(J)}if(_==="fuzzy"){const ee=[...J].filter(W=>W!==" ");return ee.length?W=>{let Z=0;for(let ne=0;ne<W.length&&Z<ee.length;ne++)W[ne]===ee[Z]&&Z++;return Z===ee.length}:()=>!0}if(_==="words"){const ee=J.split(/\s+/).filter(Boolean);return ee.length?W=>ee.every(Z=>W.includes(Z)):()=>!0}return ee=>ee.includes(J)}class V{mode="memory";#e;#t;#n;#r=!1;#s=null;#i;#a;#l=new Map;#o=!1;#c=0;#u=0;#f=new Map;#d=new Map;#h;#p=null;#m=V.#g();static#g(){return{slots:[],groupHeadings:B,unnumbered:B,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;#C=-1;#S=[];#P=null;#E=null;#T=null;#M=null;#N=null;#R=null;#I=null;#K=null;#Y=Symbol("unset");#x=new Map;#U=null;get#D(){return this.#m.slots}set#D(_){this.#m.slots=_}get#X(){return this.#m.inlineLeaves}set#X(_){this.#m.inlineLeaves=_}get#V(){return this.#m.groupHeadings}set#V(_){this.#m.groupHeadings=_}get#_(){return this.#m.unnumbered}set#_(_){this.#m.unnumbered=_}get#W(){return this.#m.pivot}set#W(_){this.#m.pivot=_}constructor(_,ee){this.#t=_||{mode:"memory"},this.#e=ee||{};const W=this.#e.config||{};this.#n=this.#t.rows||W.rows||[],this.#i=b(this.#e),this.#a=r(this.#e,()=>this.#n,()=>this.#r),this.#h=new A(Number(W.rowCacheSize)||R);for(const Z of q)this.#l.set(Z,{key:null,result:null,id:0,computed:!1})}count(){this.#B();const _=this.#ge();return _?_.length:this.#D.length}#ge(){const _=Number(this.#z("pageSize",0))||0;if(_<=0)return null;const ee=this.#D.length,W=Math.max(1,Math.ceil(ee/_)),ne=Math.min(Math.max(0,Number(this.#z("page",0))||0),W-1)*_;return{offset:ne,length:Math.max(0,Math.min(_,ee-ne))}}pageInfo(){this.#B();const _=Number(this.#z("pageSize",0))||0,ee=this.#D.length;if(_<=0)return{page:0,pageSize:0,total:ee,pageCount:1};const W=Math.max(1,Math.ceil(ee/_));return{page:Math.min(Math.max(0,Number(this.#z("page",0))||0),W-1),pageSize:_,total:ee,pageCount:W}}totalCount(){return this.#et().length}matchCount(){return this.#B(),this.#m.matchCount}at(_){this.#B();const ee=this.#ge();if(ee)return _<0||_>=ee.length?void 0:this.#He(ee.offset+_,_);if(!(_<0||_>=this.#D.length))return this.#He(_,_)}byKey(_){this.#B(),this.#p||this.#Ae();const ee=this.#p.get(_);if(ee!==void 0)return this.#ce(ee);for(let W=0;W<this.#D.length;W++){const Z=this.#D[W];if(typeof Z!="number"&&Z&&Z.key===_)return this.#He(W)}}loaded(_){return _>=0&&_<this.count()}hint(_,ee){}display(){return this.#B(),this.#U||(this.#U=this.#$e()),this.#U}invalidateQuickText(){this.#x.clear(),this.invalidate("filter")}invalidate(_){const ee=q.indexOf(_);ee<0&&L(`unknown pipeline stage "${_}"; expected one of ${q.join(", ")}`);for(let W=ee;W<q.length;W++){const Z=this.#l.get(q[W]);Z.key=null,Z.computed=!1}this.#U=null}apply(_){const ee=[],W={added:[],updated:[],removed:[],rejected:ee};if(!_)return W;let Z=!1;const ne=new Set;if(_.remove&&_.remove.length)for(const ie of _.remove){const ce=this.#Pe(ie);if(ce===void 0){ee.push({operation:"remove",id:this.#Ue(ie),reason:"unknown-id"});continue}W.removed.push(this.#i.keyOf(this.#r?this.#Je(ce):this.#n[ce],ce)),this.#r||(this.#n[ce]=void 0),this.#h.delete(ce),this.#x.delete(ce),Z=!0}if(_.update&&_.update.length){const ie=this.#O.size||this.#at()?this.#Ke():null,ce=this.#v.size?this.#ht():null,me=ce&&ce.length?this.#Ke():null;for(const Ce of _.update){const Pe=this.#Pe(Ce);if(Pe===void 0){ee.push({operation:"update",id:this.#xe(Ce),reason:"unknown-id"});continue}const xe=this.#r?this.#s&&this.#s.has(Pe)?this.#s.get(Pe):this.#Je(Pe):this.#n[Pe],_e=j(xe,Ce);for(const ve of this.#le(xe,_e))ne.add(ve);if(this.#r||(this.#n[Pe]=_e),ie&&this.#Qe(ie,Pe,xe,_e),me&&this.#We(ce,me,Pe,xe,_e),this.#p){const ve=this.#i.keyOf(xe,Pe),oe=this.#i.keyOf(_e,Pe);ve!==oe&&(this.#p.delete(ve),this.#p.set(oe,Pe))}this.#h.delete(Pe),this.#x.delete(Pe),W.updated.push(this.#ce(Pe))}}if(_.add&&_.add.length&&this.#r){typeof _.at=="number"&&_.at<this.#j()&&(this.#h.clear(),this.#x.clear()),this.#p=null;for(const ie of _.add){const ce=this.#ae(this.#xe(ie));ce!==void 0&&W.added.push(this.#ce(ce))}Z=!0}else if(_.add&&_.add.length){let ie=typeof _.at=="number"?_.at:this.#n.length;if(ie<this.#n.length){let Ce=0;for(let Pe=0;Pe<this.#n.length;Pe++)this.#n[Pe]!==void 0&&Ce++;if(Ce!==this.#n.length){let Pe=0;for(let xe=0;xe<this.#n.length;xe++)this.#n[xe]!==void 0&&(this.#n[Pe++]=this.#n[xe]);this.#n.length=Pe,this.#p=null,this.#h.clear(),this.#x.clear()}}const ce=this.#n.length;ie=Math.max(0,ie);let me=_.add===this.#n?_.add.slice():_.add;if(this.#i.keyed){const Ce=[];for(const Pe of me){const xe=this.#xe(Pe);if(this.#Pe(xe)!==void 0){ee.push({operation:"add",id:xe,reason:"duplicate-id"});continue}Ce.push(Pe)}Ce.length!==me.length&&(me=Ce)}if(!me.length)return W;if(ie>=ce)for(let Ce=0;Ce<me.length;Ce++)this.#n.push(me[Ce]);else this.#n.splice(ie,0,...me),this.#h.clear(),this.#x.clear();for(let Ce=0;Ce<me.length;Ce++)W.added.push(this.#ce(ie>=ce?ce+Ce:ie+Ce));Z=!0}return this.#c++,Z&&(this.#p=null,this.#lt()),this.#a.invalidate(),this.#U=null,Z||this.#ne(ne)?(this.#u++,this.invalidate("filter")):this.invalidate("total"),this.#bt("rows:changed",{companion:!0,added:W.added.length,updated:W.updated.length,removed:W.removed.length}),this.#s=null,W}groupHeadingsAt(_){this.#B();const ee=this.#V;if(!ee.length||!Number.isInteger(_)||_<0)return B;let W=0,Z=ee.length-1,ne=-1;for(;W<=Z;){const ce=W+Z>>1;ee[ce].at<=_?(ne=ce,W=ce+1):Z=ce-1}if(ne<0)return B;const ie=[];for(let ce=ee[ne].row;ce;ce=ce.parent)ie.push(ce);return ie.reverse(),ie}unnumberedRowCount(_){this.#B();const ee=this.#_;if(!ee.length||!Number.isInteger(_)||_<0)return 0;let W=0,Z=ee.length-1,ne=-1;for(;W<=Z;){const ie=W+Z>>1;ee[ie].at<=_?(ne=ie,W=ie+1):Z=ie-1}return ne+1}moveRow(_,ee){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 W=this.#n;if(!Number.isInteger(_)||!Number.isInteger(ee))return!1;let Z=0;for(let ce=0;ce<W.length;ce++)W[ce]!==void 0&&Z++;if(_<0||_>=Z)return!1;const ne=Math.max(0,Math.min(Z-1,ee));if(ne===_)return!1;if(Z!==W.length){let ce=0;for(let me=0;me<W.length;me++)W[me]!==void 0&&(W[ce++]=W[me]);W.length=ce}const[ie]=W.splice(_,1);return W.splice(ne,0,ie),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#x.clear(),this.#lt(),this.#a.invalidate(),this.#U=null,this.invalidate("filter"),this.#bt("rows:changed",{companion:!0,added:0,updated:0,removed:0,moved:1}),!0}reload(_){this.#ue(),this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#lt(),this.#a.invalidate(),this.invalidate("filter"),this.#bt("model:changed",{reason:"reload"})}destroy(){this.#ue(),this.#h.clear(),this.#x.clear(),this.#p=null,this.#D=[],this.#X=null,this.#U=null,this.#lt();for(const _ of q)this.#l.set(_,{key:null,result:null,id:0,computed:!1})}#ie(_){const ee=this.#e.sortPending;H(ee)&&ee(_)}#ue(){this.#b.has("sort")&&this.#ie(!1);for(const{controller:_}of this.#b.values())try{_.abort()}catch{}this.#b.clear()}setRows(_){this.#n=_||[],this.#r=!1,this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#lt(),this.#a.invalidate(),this.invalidate("filter")}notePriorRows(_){this.#s=_||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#x.clear(),this.#a.invalidate()}data(){if(!this.#r)return this.#n;const _=this.#e.store;if(!_||!H(_.source))return this.#n;const ee=_.physical||0,W=new Array(ee);for(let Z=0;Z<ee;Z++)W[Z]=_.live&&!_.live(Z)?void 0:_.source(Z);return W}#Me(){const _=this.#z("detail",null);return!_||!H(_.isOpen)||_.inline===!1?null:_}#fe(){const _=(this.#e.config||{}).tree;return this.#Y!==_&&(this.#Y=_,this.#K=w(_,{dataAt:ee=>this.#Je(ee),keyOf:ee=>this.#i.keyOf(this.#Je(ee),ee)})),this.#K}#oe(){return(this.#e.config||{}).grandTotalRow==="bottom"}grandTotalRow(){if(!this.#oe())return null;this.#B();const _=this.#m.grand;return _?this.#i.grandTotal(_,this.#te(this.#m.grandLeaves)):null}pivot(){return this.#B(),this.#W}pivotMatrix(){this.#B();const _=this.#m.groupLeaves,ee=(this.#e.compute||{}).pivotMatrix;if(!H(ee))return null;const W=this.#z("groupBy",[]),Z=this.#z("pivotBy",[]);if(!W.length&&!Z.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(ce=>({colId:ce.id,handle:this.#a.handle(ce.id),fn:E(ce,"group")})).filter(ce=>ce.handle&&ce.fn),ie=this.#e.config||{};return ee({rowHandles:W.map(ce=>this.#a.handle(ce)).filter(Boolean),columnHandles:Z.map(ce=>this.#a.handle(ce)).filter(Boolean),measures:ne,leaves:_||new Uint32Array(0),opts:{locale:ie.locale,separator:(ie.pivot||{}).separator,maxColumns:(ie.pivot||{}).maxColumns}})}keysForLeaves(_){const ee=[];if(!_)return ee;for(let W=0;W<_.length;W++){const Z=this.#ce(_[W]);Z&&Z.key!=null&&ee.push(String(Z.key))}return ee}leavesOf(_){this.#B();const ee=this.#l.get("group"),W=ee&&ee.result;if(!W||!W.nodes)return[];const Z=W.nodes.get(_);if(!Z)return[];const ne=[],ie=ce=>{const me=ce.row&&ce.row.children;if(me&&me.length){for(const Ce of me){const Pe=W.nodes.get(Ce.key);Pe&&ie(Pe)}return}if(ce.leaves)for(let Ce=0;Ce<ce.leaves.length;Ce++)ne.push(this.#ce(ce.leaves[Ce]))};return ie(Z),ne}#Ue(_){return typeof _=="string"?_:this.#xe(_)}#xe(_){try{return this.#i.keyOf(_,-1)}catch{return"(unkeyed)"}}#Pe(_){if(typeof _=="string")return this.#ae(_);if(this.#i.keyed){const W=this.#i.keyOf(_,-1),Z=this.#ae(W);if(Z!==void 0)return Z}if(this.#r)return;const ee=this.#n.indexOf(_);return ee>=0?ee:void 0}#ae(_){return this.#p||this.#Ae(),this.#p.get(_)}#Ae(){this.#p=new Map;const _=this.#j(),ee=this.#e.store,W=ee&&H(ee.live)?Z=>ee.live(Z):null;for(let Z=0;Z<_;Z++){if(W&&!W(Z))continue;const ne=this.#Je(Z);ne!==void 0&&this.#p.set(this.#i.keyOf(ne,Z),Z)}}#le(_,ee){const W=[];for(const Z of this.#G())this.#De(Z)&&this.#Z(Z,_,ee,new Set)&&W.push(Z);return W}#Z(_,ee,W,Z){if(Z.has(_))return!1;Z.add(_);const ne=this.#De(_);if(!ne)return!1;const ie=ne.value&&ne.value.deps;return Array.isArray(ie)&&ie.length?ie.some(ce=>this.#Z(String(ce),ee,W,Z)):H(ne.getValue)?!Object.is(ne.getValue(ee),ne.getValue(W)):!1}#G(){const _=new Set;for(const W of this.#z("sort",[]))_.add(W.col);for(const W of this.#z("groupBy",[]))_.add(W);const ee=W=>{if(W){if(Array.isArray(W.conditions)){W.conditions.forEach(ee);return}W.col&&_.add(W.col)}};return ee(this.#z("filters",null)),[..._]}#ne(_){if(!_.size)return!1;if(this.#z("quick",""))return!0;for(const ee of this.#G())if(_.has(ee))return!0;return!1}#B(){if(!this.#o){this.#o=!0;try{this.#Ee()}finally{this.#o=!1}}}pipelineRunning(){return this.#o}#Ee(){const _=this.#de("filter",()=>this.#$(),()=>this.#Ve()),ee=this.#re(_),W=this.#de("group",()=>this.#F(),()=>this.#Fe(ee)),Z=this.#de("total",()=>this.#ke(),()=>this.#qe(W));this.#de("pivot",()=>this.#ee(),()=>this.#Ge(W)),this.#de("flatten",()=>this.#Le(),()=>this.#kt(W)),this.#ye(W,Z)}#re(_){const ee=this.#l.get("sort"),W=this.#H();if(ee.computed&&ee.key===W&&!this.#b.has("sort"))return ee.result;const Z=this.#b.get("sort");return Z&&Z.key===W?ee.result:ee.result&&this.#Te(_)?(this.#we(_,W),ee.result):this.#de("sort",()=>W,()=>this.#k(_))}#pe(){if(this.#y===null){const _=this.#e.pipelineWorker,ee=H(_)?_():null;this.#y=ee||!1}return this.#y||null}#be(){const _=this.#z("sort",[]);if(!Array.isArray(_)||!_.length)return null;const ee=(this.#e.config||{}).locale,W=[],Z=[];for(const ne of _){const ie=this.#De(ne.col);if(ie&&ie.running)continue;if(ie&&ie.value&&H(ie.value.compare))return null;const ce=this.#a.handle(ne.col);if(!ce)return null;W.push({col:ne.col,descending:ne.dir==="desc",nullsFirst:!!ne.nullsFirst,locale:ee}),Z.push(ce)}return W.length?{entries:W,handles:Z,locale:ee}:null}#Te(_){if(this.#he())return!1;const ee=this.#pe();if(!ee)return!1;const W=Number(ee.threshold);return Number.isFinite(W)&&_.length<W?!1:!!this.#be()}#we(_,ee){const W=this.#pe(),Z=W&&this.#be();if(!Z){this.#de("sort",()=>ee,()=>this.#k(_));return}const ne=new AbortController;this.#b.set("sort",{key:ee,controller:ne});const ie=Z.entries.length===1?W.sortColumn(Z.handles[0],_,{descending:Z.entries[0].descending,nullsFirst:Z.entries[0].nullsFirst,locale:Z.locale,signal:ne.signal,key:"sort"}):W.sortMulti(Z.handles,Z.entries.map((ce,me)=>({...ce,handle:Z.handles[me]})),_,{signal:ne.signal,key:"sort"});if(!O(ie)){this.#b.delete("sort"),this.#de("sort",()=>ee,()=>ie),this.#ie(!1);return}this.#ie(!0),ie.then(ce=>this.#ve(ee,ce),ce=>this.#Se("sort",ee,ce))}#ve(_,ee){const W=this.#b.get("sort");if(!(!W||W.key!==_)){if(this.#H()!==_){this.#b.delete("sort"),this.#ie(!1);return}this.#b.delete("sort"),this.#de("sort",()=>_,()=>ee),this.#U=null,this.#B(),this.#bt("model:changed",{reason:G[0]}),this.#ie(!1)}}#Se(_,ee,W){const Z=this.#b.get(_);if(!(!Z||Z.key!==ee)){if(this.#b.delete(_),W&&W.name==="AbortError"){_==="sort"&&this.#ie(!1);return}if(_==="sort"&&this.#H()===ee){const ne=this.#de("filter",()=>this.#$(),()=>this.#Ve());this.#de("sort",()=>ee,()=>this.#k(ne)),this.#U=null,this.#B(),I("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",W),this.#bt("model:changed",{reason:G[1]})}_==="sort"&&this.#ie(!1)}}#ye(_,ee){const W=_&&_.leaves?_.leaves.length:this.#m.slots.length;this.#m.matchCount=W,this.#m.grand=ee&&ee.grand||null,this.#m.grandLeaves=_&&_.leaves?_.leaves.length:0,this.#m.groupLeaves=_&&_.leaves?_.leaves:null}#de(_,ee,W){const Z=this.#l.get(_),ne=ee();return Z.computed&&Z.key===ne||(Z.result=W(),Z.key=ne,Z.computed=!0,Z.id++,_==="flatten"&&(this.#U=null)),Z.result}#Q(_){return this.#l.get(_).id}#$(){const _=(this.#e.config||{}).hostFilter,ee=_&&H(_.active)&&_.active()?1:0,W=this.#z("where",null),Z=W?W.version:0,ne=this.#st("filter.sig",`${this.#St()}`,()=>h({filters:this.#z("filters",null),quick:this.#z("quick",""),quickMode:this.#z("quickMode","contains")}));return`${this.#u}|${ne}|${ee}|${Z}`}#H(){const _=this.#he();return`${this.#Q("filter")}|${JSON.stringify(this.#z("sort",[]))}`+(_?`|manual:${_.version}`:"")}#he(){const _=this.#z("rowOrder",null);return _&&Array.isArray(_.keys)?_:null}#se(_,ee){this.#p||this.#Ae();const W=this.#p,Z=this.#j(),ne=ee.keys.length,ie=new Float64Array(Z);for(let ce=0;ce<Z;ce++)ie[ce]=ne+ce;for(let ce=0;ce<ne;ce++){const me=W.get(ee.keys[ce]);me!==void 0&&(ie[me]=ce)}return Uint32Array.from(_).sort((ce,me)=>ie[ce]-ie[me])}orderedKeys(){this.#p||this.#Ae();const _=this.#p,ee=new Map;for(const[ce,me]of _)ee.set(me,ce);const W=Uint32Array.from([...ee.keys()]).sort(),Z=this.#he(),ne=Z?this.#se(W,Z):this.#k(W),ie=new Array(ne.length);for(let ce=0;ce<ne.length;ce++)ie[ce]=ee.get(ne[ce]);return ie}#F(){const _=this.#z("pivotBy",[]).length>0?"p":"u";return`${this.#Q("sort")}|${JSON.stringify(this.#z("groupBy",[]))}|${_}`}#ke(){const _=this.#rt()?"f":"a",ee=(this.#e.config||{}).totalOnlyChangedColumns?"n":"w";return`${this.#Q("group")}|${JSON.stringify(this.#z("totals",[]))}|${_}${ee}|${this.#c}`}#ee(){return`${this.#Q("group")}|${JSON.stringify(this.#z("pivotBy",[]))}`}#Le(){const ee=this.#je()||!this.#oe()?this.#Q("total"):"x",W=`${this.#St()}`,Z=this.#st("flatten.keys",W,()=>{const ie=this.#z("expanded",null);return ie?[...ie].sort().join(""):"*"}),ne=this.#st("flatten.detail",W,()=>{const ie=this.#z("detail",null);return ie&&H(ie.signature)?ie.signature():""});return`${ee}|${this.#Q("pivot")}|${Z}|${ne}`}#je(){const _=this.#z("groupBy",[]);return Array.isArray(_)&&_.length>0}stageState(){const _=[];for(const[ee,W]of this.#l){const Z=W.result;_.push({stage:ee,materialised:!!W.computed,bytes:Z&&typeof Z.byteLength=="number"?Z.byteLength:null,rows:Z&&typeof Z.length=="number"?Z.length:null,rebuilds:W.id})}return _}facetIndices(_){return this.#Ve(_||null)}facetRows(_){const ee=this.facetIndices(_),W=[];for(let Z=0;Z<ee.length;Z++){const ne=this.#ce(ee[Z]);ne&&W.push(ne)}return W}invalidateRows(){this.#h.clear(),this.#x.clear(),this.#U=null}invalidateHandles(){this.#a.invalidate()}rows(){return this.#n}unfilteredIndices(){return this.#et()}filteredIndices(){const _=this.#l.get("filter");if(_&&_.computed&&_.key===this.#$())return _.result||this.#et();this.#B();const ee=this.#l.get("filter");return(ee&&ee.computed?ee.result:null)||this.#et()}unfilteredRows(){const _=this.#et(),ee=[];for(let W=0;W<_.length;W++){const Z=this.#ce(_[W]);Z&&ee.push(Z)}return ee}#Ve(_=null){const ee=this.#et(),W=this.#z("filters",null),Z=_?this.#ft("pruneColumn")(W,_):W,ne=this.#mt(Z),ie=String(this.#z("quick","")||"").trim().toLowerCase(),ce=ie?U(ie,String(this.#z("quickMode","contains")||"contains")):null,me=(this.#e.config||{}).hostFilter,Ce=!!(me&&H(me.active)&&me.active()),Pe=this.#z("where",null),xe=!!(Pe&&Pe.active);if(!ne&&!ie&&!Ce&&!xe)return ee;let _e=null;ne&&(_e=this.#ft("evaluateFilters")(ne,{handle:ae=>this.#a.handle(ae),count:this.#j(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:ae=>N(this.#De(ae)),typeOf:ae=>{const se=this.#De(ae);return se?se.type:void 0}}));const ve=new Uint32Array(ee.length);let oe=0;for(let he=0;he<ee.length;he++){const ae=ee[he];if(!(_e&&!_e[ae])&&!(ce&&!this.#_e(ae,ce))){if(Ce||xe){const se=this.#ce(ae);if(Ce&&!me.passes(se)||xe&&!Pe.passes(se.data,se.key))continue}ve[oe++]=ae}}if(_e){const he=(this.#e.compute||{}).releaseMask;H(he)&&he({pool:this.#e.pool},_e)}return ve.subarray(0,oe)}handleFor(_){return this.#a.handle(_)}#k(_){const ee=this.#he();if(ee)return this.#se(_,ee);const W=this.#z("sort",[]).filter(ie=>{const ce=this.#De(ie.col);return!ce||!ce.running?!0:(I(`source.sort.running.${ie.col}`,`sort ignores "${ie.col}": a running total is a function of the sort order, so it cannot also decide it. Sort by the column it runs over instead.`),!1)});if(!W.length)return _;const Z=(this.#e.config||{}).locale;if(W.length===1){const ie=W[0],ce=this.#a.handle(ie.col);if(!ce)return I(`source.sort.${ie.col}`,`sort ignores unknown column "${ie.col}".`),_;const me=this.#De(ie.col);return this.#ft("sortColumn")(ce,_,{descending:ie.dir==="desc",nullsFirst:ie.nullsFirst,locale:Z,compare:C(me)})}const ne=[];for(const ie of W){const ce=this.#a.handle(ie.col);if(!ce){I(`source.sort.${ie.col}`,`sort ignores unknown column "${ie.col}".`);continue}ne.push({handle:ce,descending:ie.dir==="desc",nullsFirst:ie.nullsFirst,locale:Z,compare:C(this.#De(ie.col))})}return ne.length?this.#ft("sortMulti")(ne.map(ie=>ie.handle),ne,_):_}#Fe(_){const ee=this.#z("groupBy",[]),W=this.#fe();if(W&&!ee.length){const he=f(_,W);return this.#R=k(he.roots,W.declaresChildren),{roots:null,leaves:_,nodes:new Map,tree:he}}if(this.#R=null,W&&ee.length&&I("tree.grouped","grouping is active on a grid configured with `tree`; the grouping wins and the hierarchy is not shown."),!ee.length)return{roots:null,leaves:_,nodes:new Map};const Z=(this.#e.config||{}).timeZone,ne=[],ie=[];let ce=!1;for(const he of ee){const ae=this.#a.handle(he);if(!ae){I(`source.group.${he}`,`grouping ignores unknown column "${he}".`);continue}ne.push(ae);const se=this.#De(he),de=se&&se.dataType;if(de&&H(de.groupProjector)){const ke=se.typeOptions&&se.typeOptions.timeZone||Z||void 0,Ae=de.groupProjector(se,ke);ie.push(Ae||null),Ae&&(ce=!0)}else ie.push(null)}if(!ne.length)return{roots:null,leaves:_,nodes:new Map};const{keys:me,buckets:Ce}=this.#ft("groupByColumns")(ne,_,{locale:(this.#e.config||{}).locale,project:ce?ie:void 0}),Pe=this.#z("pivotBy",[]).length>0,xe=[],_e=new Map;for(let he=0;he<Ce.length;he++){const ae=me[he];let se=null;const de=[];for(let ke=0;ke<ae.length;ke++){de.push(g(ae[ke]));const Ae=l(de),Te=ke===ae.length-1;let je=_e.get(Ae);if(!je){const ye=this.#i.group({path:[...de],column:ee[ke],value:ae[ke],level:ke,parent:se,expanded:Pe&&Te?!1:this.#gt(Ae,{key:Ae,column:ee[ke],value:ae[ke],level:ke,path:[...de]}),hasChildren:!(Pe&&Te)});je={row:ye,leaves:null},_e.set(Ae,je),se?se.children.push(ye):xe.push(ye)}je.row.leafCount+=Ce[he].length,ke===ae.length-1&&(je.leaves=Ce[he]),se=je.row}}const ve=this.#z("sort",[])||[],oe=(he,ae)=>{if(!he||he.length<2){if(he)for(const Ae of he)oe(Ae.children,ae+1);return}const se=ee[ae],de=ve.find(Ae=>Ae.col===se),ke=de&&de.dir==="desc"?-1:1;he.sort((Ae,Te)=>ke*X(Ae.groupValue,Te.groupValue));for(const Ae of he)oe(Ae.children,ae+1)};return oe(xe,0),{roots:xe,leaves:_,nodes:_e,keys:me,buckets:Ce}}#Ye(_,ee){const W=new Map,Z=new Map,ne=ie=>{const ce=ie.physical>=0?[ie.physical]:[];for(const me of ie.children)ce.push(...ne(me));if(ie.children.length){const me=this.#Xe(ee,Uint32Array.from(ce),null);ie.physical>=0?W.set(ie.physical,me):Z.set(ie.key,me)}return ce};for(const ie of _.roots)ne(ie);return{byPhysical:W,byKey:Z}}#qe(_){const ee=this.#Ke();if(!ee.length)return this.#E=null,this.#T=null,{grand:null};const W={id:this.#Q("group"),columns:ee.map(ve=>ve.id).join("")},Z=this.#E&&this.#E.id===W.id&&this.#E.columns===W.columns,ne=this.#at()&&Z?this.#P:null,ie=ne?ee.filter(ve=>ne.has(ve.id)):ee,ce=Z?this.#T:null,me=this.#rt()?null:this.#Tt(),Ce=this.#Ce(ee),Pe=ve=>{const oe=_.nodes.get(ve.key);let he=oe&&oe.leaves?oe.leaves:null;if(ve.children&&ve.children.length){const de=ve.children.map(Pe);let ke=0;for(const je of de)ke+=je.length;const Ae=new Uint32Array(ke);let Te=0;for(const je of de)Ae.set(je,Te),Te+=je.length;he=Ae}he=he||new Uint32Array(0);const ae=me?me.get(ve.key)||T:he,se=this.#Ze(ve,ne?ie:ee,ae,Ce);return ve.totals=ne?{...ve.totals,...se}:se,he};if(_.roots&&ie.length)for(const ve of _.roots)Pe(ve);if(this.#I=_.tree?this.#Ye(_.tree,ee):null,this.#E=W,this.#P=this.#at()?new Set:null,!(this.#e.config||{}).grandTotalRow)return this.#A.length=0,this.#T=null,{grand:null};const _e=me?this.#it():_.leaves;return this.#T=this.#Oe(ee,_e,ne,ce),{grand:this.#T}}#Oe(_,ee,W,Z){const ne={},ie=this.#Q("group");ie!==this.#w&&(this.#ct(),this.#w=ie);const ce=this.#A;this.#A=[];for(const me of _){if(!S(me))continue;const Ce=this.#a.handle(me.id);if(!Ce)continue;const Pe=E(me,"grand");if(!m(Pe,Ce)){if(W&&!W.has(me.id)&&Z&&me.id in Z){ne[me.id]=Z[me.id];continue}ne[me.id]=this.#Xe([me],ee,null,"grand")[me.id];continue}let xe=this.#O.get(me.id);if((!xe||xe.fn!==Pe)&&(xe=new n(Pe),this.#O.set(me.id,xe)),xe.valid){let _e=!0;for(const ve of ce)if(ve.colId===me.id&&!xe.update(ve.before,ve.after)){_e=!1;break}if(_e){ne[me.id]=xe.value();continue}xe.invalidate()}xe.seedColumn(Ce.values,a(Ce),ee),ne[me.id]=xe.valid?xe.value():this.#Xe([me],ee,null,"grand")[me.id]}return ne}#Ce(_){const ee=this.#Q("group");ee!==this.#C&&(this.#v.clear(),this.#C=ee);const W=new Map;for(const ne of _){if(!S(ne))continue;const ie=this.#a.handle(ne.id),ce=E(ne,"group");m(ce,ie)&&W.set(ne.id,{fn:ce})}if(!W.size)return this.#S.length=0,W;const Z=this.#S;this.#S=[];for(const ne of Z){const{beforeKeys:ie,afterKeys:ce,colDeltas:me}=ne,Ce=ie.length?new Set(ie):null,Pe=ce.length?new Set(ce):null;for(const{colId:xe,before:_e,after:ve}of me)if(W.has(xe)){for(const oe of ie)Pe&&Pe.has(oe)||this.#dt(oe,xe,_e,null);for(const oe of ce)Ce&&Ce.has(oe)||this.#dt(oe,xe,null,ve);for(const oe of ie)Pe&&!Pe.has(oe)||this.#dt(oe,xe,_e,ve)}}return W}#dt(_,ee,W,Z){const ne=this.#v.get(_),ie=ne&&ne.get(ee);!ie||!ie.valid||ie.update(W,Z)||ie.invalidate()}#Ze(_,ee,W,Z){if(!Z||!Z.size)return this.#Xe(ee,W,_);const ne={};let ie=null,ce=this.#v.get(_.key);for(const me of ee){const Ce=Z.get(me.id);if(!Ce){(ie||(ie=[])).push(me);continue}const Pe=this.#a.handle(me.id);if(!Pe)continue;ce||(ce=new Map,this.#v.set(_.key,ce));let xe=ce.get(me.id);if((!xe||xe.fn!==Ce.fn)&&(xe=new n(Ce.fn),ce.set(me.id,xe)),xe.valid||xe.seedColumn(Pe.values,a(Pe),W),xe.valid){ne[me.id]=xe.value();continue}(ie||(ie=[])).push(me)}return ie&&Object.assign(ne,this.#Xe(ie,W,_)),ne}#Qe(_,ee,W,Z){const ne=!this.#rt()||this.#Et(ee);for(const ie of _){const ce=ie.getValue;if(!H(ce))continue;const me=ce(W),Ce=ce(Z);Object.is(me,Ce)||(this.#P&&this.#P.add(ie.id),ne&&this.#O.has(ie.id)&&this.#A.push({colId:ie.id,before:me,after:Ce}))}}#ht(){const _=this.#z("groupBy",[]),ee=[];for(const W of _){const Z=this.#De(W);Z&&ee.push(Z)}return ee}#pt(_,ee){const W=new Array(_.length);for(let Z=0;Z<_.length;Z++){const ne=_[Z].getValue;W[Z]=g(H(ne)?ne(ee):void 0)}return W}#We(_,ee,W,Z,ne){if(this.#rt()&&!this.#Et(W))return;const ie=o(this.#pt(_,Z)),ce=o(this.#pt(_,ne)),me=ie.length!==ce.length||ie.some((Pe,xe)=>Pe!==ce[xe]),Ce=[];for(const Pe of ee){const xe=Pe.getValue;if(!H(xe))continue;const _e=xe(Z),ve=xe(ne);!me&&Object.is(_e,ve)||Ce.push({colId:Pe.id,before:_e,after:ve})}!Ce.length&&!me||this.#S.push({beforeKeys:ie,afterKeys:ce,colDeltas:Ce})}#Et(_){const ee=this.#l.get("filter"),W=ee&&ee.computed?ee.result:null;if(!W)return!0;let Z=0,ne=W.length-1;for(;Z<=ne;){const ie=Z+ne>>1,ce=W[ie];if(ce===_)return!0;ce<_?Z=ie+1:ne=ie-1}return!1}#rt(){return(this.#e.config||{}).totalFilteredOnly!==!1}#te(_){return this.#rt()?_:this.#it().length}#it(){return(!this.#M||this.#M.version!==this.#u)&&(this.#M={version:this.#u,indices:this.#et()}),this.#M.indices}#Tt(){const _=this.#z("groupBy",[]),ee=`${this.#u}|${JSON.stringify(_)}`;if(this.#N&&this.#N.key===ee)return this.#N.map;const W=new Map,Z=[];for(const ne of _){const ie=this.#a.handle(ne);ie&&Z.push(ie)}if(Z.length){const ne=this.#it(),{keys:ie,buckets:ce}=this.#ft("groupByColumns")(Z,ne,{locale:(this.#e.config||{}).locale}),me=new Map;for(let Ce=0;Ce<ce.length;Ce++){const Pe=ie[Ce],xe=[];for(let _e=0;_e<Pe.length;_e++){xe.push(g(Pe[_e]));const ve=l(xe);let oe=me.get(ve);oe||(oe=[],me.set(ve,oe));for(let he=0;he<ce[Ce].length;he++)oe.push(ce[Ce][he])}}for(const[Ce,Pe]of me)W.set(Ce,Uint32Array.from(Pe))}return this.#N={key:ee,map:W},W}#at(){return!!(this.#e.config||{}).totalOnlyChangedColumns}#lt(){this.#ct(),this.#vt(),this.#P=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.#C=-1}#Ge(_){const ee=this.#z("pivotBy",[]);if(!ee.length)return this.#W=null,null;const W=(this.#e.compute||{}).pivot;if(!H(W))return I("source.pivot.kernel","pivot requested but ctx.compute.pivot is not available; showing unpivoted rows."),this.#W=null,null;const Z=ee.map(ie=>this.#a.handle(ie)).filter(Boolean),ne=this.#Ke();return this.#W=W(Z,_.leaves,{groups:_.keys&&_.buckets?{keys:_.keys,buckets:_.buckets}:null,totals:ne.map(ie=>ie.id),handle:ie=>this.#a.handle(ie),totalOf:ie=>E(ne.find(ce=>ce.id===ie),"group"),separator:((this.#e.config||{}).pivot||{}).separator,maxColumns:((this.#e.config||{}).pivot||{}).maxColumns})||null,this.#W}#kt(_){const ee=this.#l.get("total").result,W=!!(this.#e.config||{}).groupFooter,Z=this.#Me();if(_.tree)return this.#Re(_,ee,Z);if(!_.roots&&!Z){if(ee&&ee.grand&&!this.#oe()){const Pe=this.#i.grandTotal(ee.grand,this.#te(_.leaves.length));if(this.#X===_.leaves&&Array.isArray(this.#D))this.#D[this.#D.length-1]=Pe;else{const xe=Array.from(_.leaves);xe.push(Pe),this.#D=xe,this.#X=_.leaves}this.#_=[{at:this.#D.length-1}]}else this.#X=null,this.#D=_.leaves,this.#_=B;return this.#V=B,this.#D}const ne=[],ie=[],ce=[],me=Pe=>{if(ne.push(Pe),!Z)return;const xe=this.#ce(Pe);!xe||!Z.isOpen(xe.key)||(xe.master=!0,xe.expanded=!0,ce.push({at:ne.length}),ne.push(this.#i.detail(xe,Z.heightOf(xe))))};if(!_.roots){for(let Pe=0;Pe<_.leaves.length;Pe++)me(_.leaves[Pe]);return ee&&ee.grand&&!this.#oe()&&(ce.push({at:ne.length}),ne.push(this.#i.grandTotal(ee.grand,this.#te(_.leaves.length)))),this.#X=null,this.#V=B,this.#_=ce.length?ce:B,this.#D=ne,ne}const Ce=(Pe,xe,_e)=>{if(Pe.expanded=Pe.hasChildren===!1?!1:this.#gt(Pe.key,{key:Pe.key,column:Pe.groupColumn,value:Pe.groupValue,level:Pe.level,path:Pe.groupPath}),Pe.posinset=xe+1,Pe.setsize=_e,ie.push({at:ne.length,row:Pe}),ce.push({at:ne.length}),ne.push(Pe),!!Pe.expanded){if(Pe.children&&Pe.children.length)for(let ve=0;ve<Pe.children.length;ve++)Ce(Pe.children[ve],ve,Pe.children.length);else{const ve=_.nodes.get(Pe.key),oe=ve&&ve.leaves?ve.leaves:null;if(oe)for(let he=0;he<oe.length;he++)me(oe[he])}W&&Pe.totals&&(ce.push({at:ne.length}),ne.push(this.#i.footer(Pe)))}};for(let Pe=0;Pe<_.roots.length;Pe++)Ce(_.roots[Pe],Pe,_.roots.length);return ee&&ee.grand&&!this.#oe()&&(ce.push({at:ne.length}),ne.push(this.#i.grandTotal(ee.grand,this.#te(_.leaves.length)))),this.#V=ie,this.#_=ce,this.#D=ne,ne}#et(){const _=this.#e.store;if(_&&H(_.liveIndices))return _.liveIndices();const ee=new Uint32Array(this.#n.length);let W=0;for(let Z=0;Z<this.#n.length;Z++)this.#n[Z]!==void 0&&(ee[W++]=Z);return ee.subarray(0,W)}#j(){const _=this.#e.store;return _&&typeof _.physical=="number"?_.physical:this.#n.length}#Je(_){const ee=this.#e.store;return ee&&H(ee.source)?ee.source(_):this.#n[_]}#He(_,ee=_){const W=this.#D[_];if(typeof W!="number")return W.index=ee,W;const Z=this.#ce(W);return Z.index=ee,Z}#ce(_){let ee=this.#h.get(_);ee||(ee=this.#i.leaf(this.#Je(_),_),this.#h.set(_,ee));const W=this.#R?this.#R.get(_):null;if(W){ee.level=W.level,ee.posinset=W.posinset,ee.setsize=W.setsize,ee.hasChildren=W.hasChildren,ee.expanded=W.hasChildren&&!W.lazy&&this.#gt(ee.key);const Z=this.#I?this.#I.byPhysical.get(_):void 0;Z?ee.totals=Z:ee.totals&&(ee.totals=null)}else ee.hasChildren&&(ee.level=0,ee.hasChildren=!1,ee.expanded=!1,ee.posinset=void 0,ee.setsize=void 0);return ee}#Re(_,ee,W){const Z=[],ne=[],ie=me=>{if(me.leafCount!==void 0)return me.leafCount;let Ce=me.physical>=0?1:0;for(const Pe of me.children)Ce+=ie(Pe);return me.leafCount=Ce,Ce},ce=me=>{const Ce=this.#gt(me.key);if(me.physical>=0){if(Z.push(me.physical),W&&W.isOpen(this.#ce(me.physical).key)){const Pe=this.#ce(me.physical);ne.push({at:Z.length}),Z.push(this.#i.detail(Pe,W.heightOf(Pe)))}}else Z.push(this.#i.group({path:[me.key],column:null,value:me.value,level:me.level,parent:null,expanded:Ce,hasChildren:me.children.length>0,leafCount:ie(me),totals:this.#I?this.#I.byKey.get(me.key):void 0}));if(Ce)for(const Pe of me.children)ce(Pe)};for(const me of _.tree.roots)ce(me);return ee&&ee.grand&&!this.#oe()&&(ne.push({at:Z.length}),Z.push(this.#i.grandTotal(ee.grand,this.#te(_.leaves.length)))),this.#X=null,this.#V=B,this.#_=ne.length?ne:B,this.#D=Z,Z}#$e(){return t(()=>this.count(),_=>this.at(_))}#_e(_,ee){let W=this.#x.get(_);if(W===void 0){const Z=this.#Je(_),ne=this.#At(),ie=[],ce=this.#e.columnHidden;for(const me of ne){if(me.quickFilter===!1||H(ce)&&ce(me.id))continue;const Ce=me.value&&H(me.value.quickFilterText)?me.value.quickFilterText({value:void 0,data:Z,row:null,column:me,colId:me.id,grid:null,context:this.#z("context",null)}):null,Pe=Ce??(H(me.formatValue)?me.formatValue(H(me.getValue)?me.getValue(Z):void 0):"");Pe!=null&&Pe!==""&&ie.push(String(Pe))}W=ie.join(" ").toLowerCase(),this.#x.set(_,W)}return ee(W)}#Ke(){const _=this.#z("totals",[]),ee=_&&_.length?new Set(_):null;return this.#At().filter(W=>ee?ee.has(W.id):!!(W.total||W.groupTotal||W.grandTotal))}#Xe(_,ee,W,Z="group"){const ne={},ie=(this.#e.compute||{}).total;for(const ce of _){if(!S(ce))continue;const me=this.#a.handle(ce.id);if(!me)continue;const Ce=E(ce,Z);if(Ce)if(H(Ce)){const Pe=new Array(ee.length);for(let xe=0;xe<ee.length;xe++)Pe[xe]=me.get(ee[xe]);ne[ce.id]=Ce(Pe,{row:W,column:ce,grid:this.#e.grid||null,context:this.#z("context",null),valueAt:(xe,_e)=>{const ve=this.#a.handle(xe);return ve&&_e>=0&&_e<ee.length?ve.get(ee[_e]):null}})}else H(ie)&&(ne[ce.id]=ie(me,ee,Ce))}return ne}#mt(_){if(!_)return _;const ee=this.#e.config||{},W={tz:ee.timeZone,weekStartsOn:ee.weekStartsOn};return p(_,Z=>{const ne=y(Z,W),ie=this.#De(ne&&ne.col),ce=ie&&ie.type==="datetime";if(ne&&ne.type)return ne.type==="datetime"&&!ne.timeZone&&ie?{...ne,timeZone:ee.timeZone||void 0}:ne;if(ce)return{...ne,type:"datetime",timeZone:ee.timeZone||void 0};const me=ie&&(ie.dataType?.base||ie.type);return me?{...ne,type:me}:ne})}#gt(_,ee){const W=this.#z("expanded",null);return W?H(W.has)?W.has(_,ee):Array.prototype.includes.call(W,_):!0}#z(_,ee){if(_==="context"||!H(this.#e.stateVersion))return this.#Ot(_,ee);const W=this.#_t(_),Z=this.#f.get(_);if(Z&&Z.version===W)return Z.value;const ne=this.#Ot(_,ee);return this.#f.set(_,{version:W,value:ne}),ne}#Ot(_,ee){const W=this.#e.state;if(W&&H(W[_])){const Z=W[_]();return Z??ee}return ee}#St(){const _=this.#e.stateVersion;return H(_)?_():0}#ut(){const _=this.#e.columnsVersion,ee=this.#e.permissionsVersion;return`${H(_)?_():0}|${H(ee)?ee():0}`}#_t(_){return _==="totals"?this.#ut():`${this.#St()}`}#st(_,ee,W){if(!H(this.#e.stateVersion))return W();const Z=this.#d.get(_);if(Z&&Z.version===ee)return Z.key;const ne=W();return this.#d.set(_,{version:ee,key:ne}),ne}#ft(_){const ee=(this.#e.compute||{})[_];return H(ee)||L(`ctx.compute.${_} is required by the memory source pipeline`),ee}#At(){const _=this.#e.columns;return _&&H(_.all)?_.all():[]}#De(_){const ee=this.#e.columns;return ee&&H(ee.get)?ee.get(_):void 0}#bt(_,ee){const W=this.#e.emit;H(W)&&W(_,ee)}}}),Ve("packages/core/src/source/abort.js",function(e,D){"use strict";Object.defineProperty(e,"SupersededError",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"RequestToken",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"AbortScope",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"createAbortScope",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return L}});class re extends Error{constructor(H,$="superseded"){super(`[lattice] request ${H?`"${H}" `:""}${$}`),this.name="SupersededError",this.superseded=!0,this.key=H}}class A{#e;constructor(H,$,X,F){this.#e=H,this.key=$,this.controller=X,this.signal=X.signal,this.seq=F}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(H){this.signal.aborted||this.controller.abort(new re(this.key,H)),this.#e.settle(this)}}class Y{#e=new Map;#t=0;begin(H="",$="superseded"){const X=this.#e.get(H);X&&!X.signal.aborted&&X.controller.abort(new re(H,$));const F=new A(this,H,new AbortController,++this.#t);return this.#e.set(H,F),F}tokenFor(H){return this.#e.get(H)}pending(H=""){const $=this.#e.get(H);return!!$&&!$.signal.aborted}get size(){return this.#e.size}settle(H){this.#e.get(H.key)===H&&this.#e.delete(H.key)}abort(H="",$="superseded"){const X=this.#e.get(H);X&&X.abort($)}abortAll(H="superseded"){for(const $ of[...this.#e.values()])$.abort(H);this.#e.clear()}}function I(){return new Y}function L(Q){if(!Q||typeof Q!="object")return!1;const H=Q;return H.superseded===!0||H.name==="AbortError"||H.name==="SupersededError"}}),Ve("packages/core/src/source/blockcache.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_PAGE_SIZE",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"DEFAULT_MAX_CACHED_PAGES",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"BlockCache",{enumerable:!0,get:function(){return I}});const re=100,A=32;class Y{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;#s=-1;constructor(Q={}){this.#t=Math.max(1,Math.floor(Number(Q.pageSize)||re)),this.#n=Math.max(1,Math.floor(Number(Q.maxCachedPages)||A))}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 H=this.#e.get(Q);return!!H&&H.state==="pending"}loaded(Q){const H=this.#e.get(Q);return!!H&&H.state==="loaded"}begin(Q,H){let $=this.#e.get(Q);return $||($=new Y(Q)),$.state="pending",$.token=H,$.error=null,this.#i(Q,$),$}fill(Q,H){const $=this.#e.get(Q)||new Y(Q);$.rows=H,$.state="loaded",$.token=null,this.#i(Q,$)}failed(Q,H){const $=this.#e.get(Q)||new Y(Q);$.state="error",$.error=H,$.token=null,this.#i(Q,$)}delete(Q){return this.#e.delete(Q)}rowAt(Q){const H=this.blockOf(Q),$=this.#e.get(H);if(!(!$||$.state!=="loaded"||!$.rows))return this.#i(H,$),$.rows[Q-H*this.#t]}rowLoaded(Q){const H=this.blockOf(Q),$=this.#e.get(H);return!!$&&$.state==="loaded"&&!!$.rows&&Q-H*this.#t<$.rows.length}erroredAt(Q){const H=this.#e.get(this.blockOf(Q));return!!H&&H.state==="error"}loadedExtent(){let Q=0;for(const H of this.#e.values()){if(H.state!=="loaded"||!H.rows)continue;const $=H.id*this.#t+H.rows.length;$>Q&&(Q=$)}return Q}fillOf(Q){const H=this.#e.get(Q);return H&&H.state==="loaded"&&H.rows?H.rows.length:null}protect(Q,H){this.#r=this.blockOf(Math.max(0,Q)),this.#s=this.blockOf(Math.max(0,H))}evict(){const Q=[];if(this.#e.size<=this.#n)return Q;for(const[H,$]of this.#e){if(this.#e.size-Q.length<=this.#n)break;H>=this.#r&&H<=this.#s||$.state!=="pending"&&Q.push(H)}for(const H of Q)this.#e.delete(H);return Q}ids(){return[...this.#e.keys()]}clear(){this.#e.clear()}#i(Q,H){this.#e.delete(Q),this.#e.set(Q,H)}}}),Ve("packages/core/src/source/pagewindow.js",function(e,D){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return re}});function re(A,Y,I,L){const Q=Math.floor(Number(A)||0);if(Q<=0)return null;const H=Math.max(0,Math.floor(Number(Y)||0)),$=Math.max(0,Math.floor(Number(I)||0));if(L){const X=Math.max(1,Math.ceil($/Q)),F=Math.min(H,X-1),j=F*Q;return{page:F,pageSize:Q,offset:j,length:Math.max(0,Math.min(Q,$-j)),pageCount:X,total:$}}return{page:H,pageSize:Q,offset:H*Q,length:Q,pageCount:Math.max(H+2,Math.ceil($/Q)),total:null}}}),Ve("packages/core/src/source/paged.js",function(e,D){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"PagedSource",{enumerable:!0,get:function(){return h}});const A=D("packages/core/src/internal/lru.js").Lru,I=D("packages/core/src/internal/predicates.js").isFunction,Q=D("packages/core/src/internal/warn.js").warnOnce,$=D("packages/core/src/internal/schedule.js").settleDebounce,X=D("packages/core/src/source/abort.js"),F=X.createAbortScope,j=X.isAbortError,v=D("packages/core/src/source/blockcache.js"),b=v.BlockCache,l=v.DEFAULT_PAGE_SIZE,g=v.DEFAULT_MAX_CACHED_PAGES,t=D("packages/core/src/source/rows.js").createRowFactory,s=D("packages/core/src/source/filterwire.js"),r=s.wireFilters,i=s.querySignature,n=s.warnHostFilterNotApplied,c=D("packages/core/src/source/pagewindow.js").pageWindow,a=120;function u(p,y){return new h(p,y)}class h{mode="paged";#e;#t;#n;#r=F();#s;#i;#a=new Map;#l=null;#o=null;#c=!1;#u=0;#f="";#d={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(y,d){this.#e=y||{mode:"paged"},this.#t=d||{},this.#n=new b({pageSize:this.#e.pageSize||l,maxCachedPages:this.#e.maxCachedPages||g}),this.#s=t(this.#t),this.#i=new A(this.#n.pageSize*4),this.#h=$((f,w)=>this.#w(f,w),a),this.#f=this.#P(),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.#C(),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 d=this.#b();return{page:0,pageSize:0,total:this.exact()?d: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(),d=c(this.#T("pageSize",0),this.#T("page",0),y,this.exact());if(!d)return this.#g="",null;const f=`${this.#m}:${d.offset}:${d.length}`;if(f!==this.#g&&!this.#p&&(this.#g=f,d.length>0)){const w=d.offset+d.length-1;this.#d={start:d.offset,end:w},this.#w(d.offset,w)}return d}at(y){const d=this.#y();if(d){if(y<0||y>=d.length)return;const f=this.#O(d.offset+y);return f&&(f.index=y),f}return this.#O(y)}#O(y){if(y<0||y>=this.#b())return;const d=this.#i.get(y);if(d&&(d.data!==null||!this.#n.rowLoaded(y)))return d;const f=this.#n.rowAt(y);if(f===void 0){const k=this.#s.skeleton(y,0,this.#n.erroredAt(y));return this.#i.set(y,k),k}const w=this.#s.leaf(f,y);return w.index=y,this.#i.set(y,w),this.#a.set(w.key,y),w}byKey(y){const d=this.#a.get(y);return d===void 0?void 0:this.#O(d)}loaded(y){const d=this.#y();return d?y>=0&&y<d.length&&this.#n.rowLoaded(d.offset+y):this.#n.rowLoaded(y)}loadedCount(){this.#C();let y=0;for(const d of this.#n.ids()){if(!this.#n.loaded(d))continue;const f=this.#n.fillOf(d);typeof f=="number"&&(y+=f)}return y}residentRows(){this.#C();const y=this.#y(),d=y?y.offset:0,f=y?y.offset+y.length:1/0,w=[],k=this.#n.ids().sort((P,G)=>P-G);for(const P of k){if(!this.#n.loaded(P))continue;const{start:G}=this.#n.rangeOf(P),K=this.#n.fillOf(P)||0;for(let q=G;q<G+K;q++){if(q<d||q>=f)continue;const B=this.#i.peek(q);if(B&&B.data!==null&&B.data!==void 0){w.push(B);continue}const E=this.#n.rowAt(q);if(E===void 0)continue;const S=this.#s.leaf(E,q);S.index=q,this.#i.set(q,S),this.#a.set(S.key,q),w.push(S)}}return w}hint(y,d){if(this.#p)return;const f=this.#C();let w=Math.max(0,Math.floor(y)),k=Math.max(w,Math.floor(d));const P=this.#y();if(P){if(P.length===0)return;w=P.offset,k=P.offset+P.length-1}this.#d={start:w,end:k},this.#n.protect(w,k);for(const G of this.#n.evict())this.#v(G);this.#h(w,k),f&&this.#h.flush()}#w(y,d){if(this.#p)return;this.#n.protect(y,d);const f=this.#n.blockOf(y),w=this.#n.blockOf(d);for(let k=f;k<=w&&!(this.#l!==null&&k*this.#n.pageSize>=this.#l);k++)this.#n.has(k)||this.#A(k)}apply(y){const d={added:[],updated:[],removed:[]};if(!y)return d;if(y.update)for(const f of y.update){const w=this.#s.keyOf(f,-1),k=this.#a.get(w);if(k===void 0)continue;const P=this.#s.leaf(f,k);P.index=k,this.#i.set(k,P),d.updated.push(P)}return(y.add&&y.add.length||y.remove&&y.remove.length)&&this.reload(),d}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.#i.clear(),this.#a.clear()}exact(){return this.#l!==null||this.#c}pending(){return this.#r.size}async#A(y){if(!I(this.#e.fetch))return;const d=this.#r.begin(`block:${y}`);this.#n.begin(y,d);const{start:f,end:w}=this.#n.rangeOf(y),k=this.#f;try{const P=await this.#e.fetch({range:{start:f,end:w},sort:this.#T("sort",[]),filters:r(this.#T("filters",null),this.#E()),quick:this.#T("quick","")||void 0,context:this.#T("context",null),signal:d.signal});if(!d.current||k!==this.#f||this.#p)return;d.settle();const G=P&&P.rows||[];this.#n.fill(y,G);for(let q=0;q<G.length;q++)this.#i.delete(f+q);const K=P&&typeof P.total=="number"?P.total:P&&typeof P.count=="number"?P.count:null;K!==null?(this.#l=K,this.#c=!0):G.length<this.#n.pageSize?(this.#c=!0,this.#l=f+G.length):this.#u=Math.max(this.#u,f+G.length),this.#M("model:changed",{reason:"page",block:y,from:f,to:f+G.length}),this.#M("rows:changed",{companion:!0,reason:"page",block:y,from:f,to:f+G.length}),this.#l!==null&&this.#l!==this.#o&&(this.#o=this.#l,this.#M("source:total",{total:this.#l,groupPath:[]}))}catch(P){if(d.settle(),j(P))return;this.#n.failed(y,P);for(let G=f;G<w;G++)this.#i.delete(G);this.#M("model:changed",{reason:"page-error",block:y,range:{start:f,end:w}}),this.#M("source:error",{error:P,block:y,range:{start:f,end:w}})}}#v(y){const{start:d,end:f}=this.#n.rangeOf(y);for(let w=d;w<f;w++){const k=this.#i.peek(w);k&&this.#a.delete(k.key),this.#i.delete(w)}}#C(){const y=this.#P();return y===this.#f?!1:(this.#f=y,this.#S("query"),!0)}#S(y){this.#r.abortAll(y),this.#n.clear(),this.#i.clear(),this.#a.clear(),this.#l=null,this.#o=null,this.#c=!1,this.#u=0,this.#m++,this.#M("model:changed",{reason:y})}#P(){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,d){const f=this.#t.state;if(f&&I(f[y])){const w=f[y]();return w??d}return d}#M(y,d){const f=this.#t.emit;I(f)&&f(y,d)}}}),Ve("packages/core/src/source/aggregates.js",function(e,D){"use strict";Object.defineProperty(e,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"pushableAggregates",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"fillAggregateSql",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"aggregateP",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"routeAggregate",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"resolveAggregatePlan",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"groupKeysPushable",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"pushdownDocRows",{enumerable:!0,get:function(){return F}});const re=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 A(){const j=new Set;for(const[v,b]of Object.entries(re))b.pushable&&j.add(v);return j}function Y(j,v,b,l="?"){let g=j.split("%c").join(v);return b!==void 0&&(g=g.split("%w").join(b)),g.split("%p").join(l)}function I(j){const v=j&&(j.p!==void 0?j.p:j.params&&j.params.p);return typeof v=="number"&&v>=0&&v<=1?v:void 0}function L(j){const v=j||{},b=v.default==="engine"||v.default==="engine-if-identical"?v.default:"client",l={};if(v.overrides&&typeof v.overrides=="object")for(const[g,o]of Object.entries(v.overrides))(o==="engine"||o==="client")&&(l[g]=o);return{default:b,overrides:l}}function Q(j,v){const b=re[j];if(!b||!b.pushable)return"client";const l=v.overrides[j];return l==="engine"||l==="client"?l:v.default==="client"?"client":v.default==="engine-if-identical"?b.class==="identical"?"engine":"client":"engine"}function H(j,v){const b=L(v),l=[],g=[];for(const o of j||[]){const t=re[o.fn],s=Q(o.fn,b),r={id:o.id,col:o.col,fn:o.fn,class:t?t.class:"fallback"};if(o.weight!==void 0&&(r.weight=o.weight),o.params!==void 0&&(r.params=o.params),t&&t.parametric){const i=I(o);i!==void 0&&(r.p=i)}if(s==="engine"&&t&&t.parametric&&r.p===void 0){g.push({...r,reason:`"${o.fn}" needs \`p\`, a number from 0 to 1`});continue}s==="engine"?l.push(r):(r.reason=t&&!t.pushable?t.note||"the engine cannot express this stat":"client by config",g.push(r))}return{engine:l,client:g,config:b}}const $=/^[A-Za-z_][A-Za-z0-9_$]*$/;function X(j,v=[]){return(j||[]).every(l=>{if(typeof l=="string")return $.test(l);if(!l||typeof l!="object")return!1;const g=l;return Array.isArray(v)&&v.includes(g.bucket)&&typeof g.col=="string"&&$.test(g.col)&&typeof g.size=="number"&&Number.isFinite(g.size)&&g.size>0})}function F(){return Object.entries(re).map(([j,v])=>({stat:j,class:v.class,sql:v.sql?Y(v.sql,"col",v.twoColumn?"weight":void 0):"",note:v.note||(v.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),Ve("packages/core/src/source/pushdown.js",function(e,D){"use strict";Object.defineProperty(e,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"NO_CAPABILITIES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"capabilitiesOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"splitFilters",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"applyResidual",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"createPushdownSource",{enumerable:!0,get:function(){return W}});const A=D("packages/core/src/internal/compare.js").defaultCompare,I=D("packages/core/src/internal/predicates.js").isFunction,Q=D("packages/core/src/internal/merge.js").toArray,$=D("packages/core/src/internal/warn.js").warnOnce,X=D("packages/core/src/source/filterwire.js"),F=X.isGroup,j=X.warnWherePageRelative,v=X.warnWhereOverThreshold,b=X.wireFilters,l=D("packages/core/src/source/aggregates.js"),g=l.resolveAggregatePlan,o=l.groupKeysPushable,t=l.STAT_PUSHDOWN,s=l.aggregateP,r=l.fillAggregateSql,n=D("packages/core/src/source/abort.js").SupersededError,m=1e3;function c(Z){const ne=Z&&Z.signal;if(!ne||!ne.aborted)return;const ie=ne.reason;throw ie instanceof Error?ie:new n("","superseded before it was sent")}const a=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function u(Z){if(!Z||typeof Z!="object")return!1;const ne=Z.returning==="row"||Z.returning==="key"?Z.returning:"none";return{append:Z.append===!0,update:Z.update===!0,delete:Z.delete===!0,returning:ne}}function h(Z,ne){if(!Z||typeof ne!="string")return;if(!ne.includes("."))return Z[ne];let ie=Z;for(const ce of ne.split(".")){if(ie===null||typeof ie!="object")return;ie=ie[ce]}return ie}function p(Z){if(Z===!0)return!0;if(!Z||typeof Z!="object")return!1;const ne=Z;return ne.enabled===!1?!1:ne.enabled===!0||I(ne.commit)}function y(Z){const ne={...a,...Z||{}};return ne.operators=new Set(ne.operators||[]),ne.mutate=u(ne.mutate),ne}function d(Z,ne){return!Z||!Z.op||!ne.operators.size?!1:ne.operators.has(Z.op)}function f(Z,ne){if(!Z)return{pushed:null,residual:null};if(!ne.filter)return{pushed:null,residual:Z};if(ne.filter==="term"){if(F(Z)){const Ce=Z.conditions||[];if(String(Z.op)!=="and")return{pushed:null,residual:Z};const Pe=Ce.findIndex(_e=>!F(_e)&&d(_e,ne));if(Pe<0)return{pushed:null,residual:Z};const xe=Ce.filter((_e,ve)=>ve!==Pe);return{pushed:Ce[Pe],residual:xe.length?{op:"and",conditions:xe}:null}}return d(Z,ne)?{pushed:Z,residual:null}:{pushed:null,residual:Z}}if(!F(Z))return d(Z,ne)?{pushed:Z,residual:null}:{pushed:null,residual:Z};if(String(Z.op)!=="and")return(Z.conditions||[]).every(Pe=>F(Pe)?f(Pe,ne).residual===null:d(Pe,ne))?{pushed:Z,residual:null}:{pushed:null,residual:Z};const ie=[],ce=[];for(const Ce of Z.conditions||[]){if(F(Ce)){if(ne.filter==="flat"){ce.push(Ce);continue}const Pe=f(Ce,ne);Pe.pushed&&ie.push(Pe.pushed),Pe.residual&&ce.push(Pe.residual);continue}(d(Ce,ne)?ie:ce).push(Ce)}const me=Ce=>Ce.length===0?null:Ce.length===1?Ce[0]:{op:"and",conditions:Ce};return{pushed:me(ie),residual:me(ce)}}const w="__lattice_leaves";function k(Z){return Z.aggregates?Z.aggregates instanceof Set?Z.aggregates:new Set(Q(Z.aggregates)):new Set}function P(Z){const ne=k(Z);return ne.size?ne.has("count")?Z.filter!=="tree"||!Z.operators||!Z.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(Z,ne,ie,ce,me,Ce,Pe){const xe=Array.isArray(Z.groupBy)?Z.groupBy:[],_e=Array.isArray(Z.groupPath)?Z.groupPath:[],ve=Array.isArray(Z.groupValues)?Z.groupValues:null;if(!ne.group){const oe=P(ne);if(oe)return oe}return o(xe)?ie.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":ce?me?Ce&&!Ce.conditioned?"a host `where` predicate can only run in the browser, over rows the engine grouped":Pe?"fullDataset holds the whole matching set, so the grid groups it itself":!ve||ve.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 K="pushdown:pivot-unsupported",q="pushdown:group-unsupported",B=Symbol("lattice.remote.ungroupedLevel");function E(Z,ne,ie,ce,me,Ce){const Pe=Array.isArray(Z.pivotBy)?Z.pivotBy:[],xe=Array.isArray(Z.groupBy)?Z.groupBy:[],_e=Array.isArray(Z.groupPath)?Z.groupPath:[],ve=Array.isArray(Z.groupValues)?Z.groupValues:null;return ne.pivot?o(Pe)?xe.length&&!o(xe)?"a grouping key is not a plain column the engine can name in a GROUP BY":ie.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":ce?me?Ce&&!Ce.conditioned?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!ve||ve.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 S(Z,ne,ie=!1){const ce=f(Z.filters||null,ne),me=[];ce.residual&&me.push("filter");const Ce=Z.sort||[],Pe=Ce.length===0||ne.sort==="multi"&&Ce.length>=1||ne.sort==="single"&&Ce.length===1;!Pe&&Ce.length&&me.push("sort");const xe=Z.quick?String(Z.quick):"",_e=!xe||!!ne.quick;_e||me.push("quick");const ve=Z.where&&Z.where.active?Z.where:null;ve&&me.push("where");const oe={filters:ce.residual,sort:Pe?null:Ce,quick:_e?"":xe,where:ve},he=!!ie,ae=Array.isArray(Z.groupBy)&&Z.groupBy.length>0,se=ae?G(Z,ne,ce,Pe,_e,ve,he):"",de=Z.pivotMode!==!1&&Array.isArray(Z.pivotBy)&&Z.pivotBy.length>0,ke=de?E(Z,ne,ce,Pe,_e,ve):"",Ae=de&&ke==="";de&&!Ae&&me.push("pivot");const Te=de?Ae&&ae:ae&&se==="";ae&&!de&&!Te&&me.push("group");const je=(Te||Ae)&&Array.isArray(Z.groupValues)?Z.groupValues.length:0;ve&&ve.conditioned&&(Te||Ae)&&(oe.where=null,me.splice(me.indexOf("where"),1));const ye=Te||de?!1:he||!!(oe.filters||oe.sort||oe.quick||oe.where)||!ne.range;return{pushed:{...Z,filters:ce.pushed,sort:Pe?Ce:[],quick:_e?xe:"",range:ye?null:Z.range},residual:oe,needsAll:ye,unpushed:me,full:he,grouped:Te,groupLevel:je,groupReason:de?"":se,pivoted:Ae,pivotReason:ke}}function C(Z){const ne=Array.isArray(Z.totals)?Z.totals:[],ie=Z.totalFns&&typeof Z.totalFns=="object"?Z.totalFns:{},ce=[],me=[];for(const Ce of ne){const Pe=String(Ce),xe=ie[Pe],_e=typeof xe=="string"?xe:xe&&typeof xe.fn=="string"?xe.fn:null,ve=xe&&typeof xe=="object"?s(xe):void 0,oe=_e?t[_e]:null;oe&&oe.parametric&&ve===void 0?me.push({id:Pe,fn:_e,class:oe.class,reason:`"${_e}" needs \`p\`, a number from 0 to 1`}):_e?!oe||!oe.pushable||!oe.sql?me.push({id:Pe,fn:_e,class:oe?oe.class:"fallback",reason:oe&&oe.note?oe.note:`the pushdown map cannot express "${_e}"`}):oe.twoColumn?me.push({id:Pe,fn:_e,class:oe.class,reason:`"${_e}" reduces two columns, and a grouped request carries no weight column`}):ce.push({id:Pe,col:Pe,fn:_e,class:oe.class,...ve!==void 0?{p:ve}:{}}):me.push({id:Pe,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:ce,client:me}}function N(Z){return{...Z,engine:Z.engine.map(ne=>{const ie=t[ne.fn];if(!ie||!ie.sql)return ne;const ce=me=>`"${me}"`;return{...ne,sql:r(ie.sql,ce(ne.col),ne.weight!==void 0?ce(ne.weight):void 0)}})}}const O=Object.freeze({items:Z=>Z==null?[]:Array.isArray(Z)?Z:[Z]});function T(Z,ne,ie){if(!ne)return Z;let ce=Z;if(ne.filters&&I(ie.evaluateFilters)){const me=ce,Ce={count:ce.length,handle:_e=>({id:_e,get:ve=>h(me[ve],_e)}),itemwise:_e=>me.some(ve=>Array.isArray(h(ve,_e)))?O:null},Pe=ie.evaluateFilters(ne.filters,Ce),xe=[];for(let _e=0;_e<ce.length;_e++)Pe[_e]&&xe.push(ce[_e]);ce=xe}if(ne.where&&ne.where.active&&(ne.whole||j(ne.where.names,"pushdown"),ce=ce.filter(me=>ne.where.passes(me))),ne.quick){const me=ne.quick.toLowerCase();ce=ce.filter(Ce=>{if(!Ce||typeof Ce!="object")return!1;for(const Pe of Object.values(Ce))if(Pe!=null&&String(Pe).toLowerCase().includes(me))return!0;return!1})}if(ne.sort&&ne.sort.length&&I(ie.sortMulti)){const me=[...new Set(ne.sort.map(_e=>_e.col))],Ce=ce,Pe=me.map(_e=>({id:_e,get:ve=>h(Ce[ve],_e)})),xe=ie.sortMulti(Pe,ne.sort.map(_e=>({col:_e.col,dir:_e.dir})),Uint32Array.from({length:ce.length},(_e,ve)=>ve),{});ce=Array.from(xe,_e=>Ce[_e])}return ce}function R(Z){return JSON.stringify({filters:Z.filters||null,sort:Z.sort||[],quick:Z.quick||"",groupBy:Z.groupBy||[],groupPath:Z.groupPath||[],context:Z.context??null})}function x(Z){if(!Z||typeof Z!="object")return 16;let ne="";try{ne=JSON.stringify(Z)}catch{return 200}return ne.length*2+64}function U(Z){const ne=Z||{};return{enabled:!!ne.enabled,maxRows:Number.isFinite(ne.maxRows)?ne.maxRows:1e6,maxBytesEstimate:Number.isFinite(ne.maxBytesEstimate)?ne.maxBytesEstimate:512*1024*1024}}const V=5e4;function J(Z){return Number.isFinite(Z)&&Z>=0?Z:V}function _(Z){return!!Z&&I(Z.then)}async function ee(Z){if(!Z||Z.total!==void 0||!_(Z.pendingTotal))return Z;const ne=await Z.pendingTotal,{pendingTotal:ie,...ce}=Z;return typeof ne=="number"?{...ce,total:ne}:ce}function W(Z={}){const ne=Z.adapter;if(!ne||!I(ne.execute))return $("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...Z,mode:"remote",fetch:async()=>({rows:[],total:0})};const ie=y(ne.capabilities),ce=ne.capabilities&&Object.getOwnPropertyDescriptor(ne.capabilities,"operators");ce&&I(ce.get)&&Object.defineProperty(ie,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(ne.capabilities.operators||[]),set:()=>{}});const me=ne.name||"adapter";let Ce=null;const Pe=()=>I(ne.ready)?(Ce||(Ce=Promise.resolve(ne.ready()).then(()=>{Object.assign(ie,y(ne.capabilities))},ue=>{throw Ce=null,ue})),Ce):null,xe=U(Z.fullDataset),_e=!!Z.allowPartialResults,ve=J(Z.whereRowLimit);let oe=null;const he=Z.aggregates;let ae=null,se=null,de=null,ke=null,Ae=null,Te=null,je=0,ye=null;const He=()=>!xe.enabled||!ae?null:(ye!==ae.key&&(je++,ye=ae.key),{rows:ae.rows,version:je}),Me=async ue=>{const pe=ue.where&&ue.where.active?ue.where:null;if(!pe)return{request:ue,probe:null};if(pe.conditioned){const rt=S(ue,ie,xe.enabled);if(rt.grouped||rt.pivoted)return{request:ue,probe:null}}const{where:Se,...Ne}=ue,De=S(Ne,ie,xe.enabled);if(De.needsAll)return{request:ue,probe:null};const Ue=R(De.pushed);let qe=null;return(!oe||oe.key!==Ue)&&(ie.total?(c(ue),qe=await ee(await ne.execute(De.pushed,ue)),oe={key:Ue,size:qe&&typeof qe.total=="number"?qe.total:null}):oe={key:Ue,size:null}),oe.size!==null&&oe.size<ve?{request:ue,probe:null}:(v(pe.names,me,oe.size,ve),{request:Ne,probe:qe})},Re=async(ue,pe)=>{Te=null;const Se=C(ue.pushed);de={engine:Se.engine,client:Se.client,groupBy:ue.pushed.groupBy},Se.client.length&&$(`source.pushdown.group.totals.${me}.${Se.client.map(Ue=>Ue.id).join(".")}`,`the ${me} adapter cannot compute the group subtotal for ${Se.client.map(Ue=>`"${Ue.id}" (${Ue.reason})`).join(", ")}, so those group rows carry no value for that column. A figure computed over anything other than the group would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const Ne=await ne.executeGroupLevel(ue.pushed,Se.engine,pe)||{};let De=Ne.rows||[];return!ie.range&&pe.range&&(De=De.slice(pe.range.start,pe.range.end)),We(Ne),Ne.total===void 0?{rows:De}:{rows:De,total:Ne.total}},Ee=new Map,$e=64,Ie=async(ue,pe)=>{Te=null;const Se=ue.pushed,Ne=Se.groupBy,De=Array.isArray(Se.groupValues)?Se.groupValues:[],Ue=De.length,qe=[...Se.filters?[Se.filters]:[],...Ne.slice(0,Ue).map((lt,mt)=>({col:lt,op:"eq",value:De[mt]===void 0?null:De[mt],caseSensitive:!0}))],rt=qe.length===0?null:qe.length===1?qe[0]:{op:"and",conditions:qe},ut=pe.range?pe.range.start:0;if(Ue>=Ne.length){const lt={...Se,filters:rt,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},mt=await ee(await ne.execute(lt,pe))||{};let xt=mt.rows||[];return!ie.range&&pe.range&&(xt=xt.slice(pe.range.start,pe.range.end)),typeof mt.total=="number"?{rows:xt,total:mt.total}:{rows:xt}}const at=Ne[Ue],kt=C(Se),Rt=k(ie),At=kt.engine.filter(lt=>Rt.has(lt.fn)),_t=[...kt.engine.filter(lt=>!Rt.has(lt.fn)).map(lt=>({id:lt.id,fn:lt.fn,class:lt.class,reason:`the ${me} adapter does not compute "${lt.fn}"`})),...kt.client];de={engine:At,client:_t,groupBy:Ne},_t.length&&$(`source.pushdown.group.totals.${me}.${_t.map(lt=>lt.id).join(".")}`,`the ${me} adapter cannot compute the group subtotal for ${_t.map(lt=>`"${lt.id}" (${lt.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 tn=[...At.map(lt=>({id:lt.id,col:lt.col,fn:lt.fn,...lt.p!==void 0?{p:lt.p}:{}})),{id:w,col:at,fn:"count"}],Ht={...Se,filters:rt,range:null},Xt=JSON.stringify([R(Ht),De,at,tn]);let Ze=ut>0?Ee.get(Xt):void 0;if(!Ze){for(Ze=Promise.resolve(ne.executeGroupedAggregates(Ht,[at],tn)),Ee.delete(Xt),Ee.set(Xt,Ze);Ee.size>$e;)Ee.delete(Ee.keys().next().value);Ze.catch(()=>{Ee.get(Xt)===Ze&&Ee.delete(Xt)})}const ct=await Ze||[];c(pe);const Ot=lt=>{const mt={};for(const xt of At)mt[xt.id]=lt?lt[xt.id]:void 0;return mt},bt=(Se.sort||[]).find(lt=>lt&<.col===at),wt=bt&&bt.dir==="desc"?-1:1,Ke=ct.filter(lt=>lt&<.level===1).map(lt=>({[at]:lt.keys[0]===void 0?null:lt.keys[0],leafCount:Number(lt.values&<.values[w])||0,totals:Ot(lt.values)})).sort((lt,mt)=>wt*A(lt[at],mt[at]));if(Ue===0){const lt=ct.find(xt=>xt&&xt.level===0),mt=lt?Number(lt.values&<.values[w]):NaN;We({matchCount:Number.isFinite(mt)?mt:Ke.reduce((xt,Ft)=>xt+Ft.leafCount,0),...lt?{grand:Ot(lt.values)}:{}})}const ht=pe.range?pe.range.end:Ke.length;return{rows:Ke.slice(ut,ht),total:Ke.length}},We=ue=>{typeof ue.matchCount=="number"&&(ke=ue.matchCount,Ae=ue.grand?{totals:ue.grand,leafCount:ue.matchCount}:null)},Ye=async(ue,pe)=>{Te=null;const Se=C(ue.pushed);de={engine:Se.engine,client:Se.client,groupBy:ue.pushed.groupBy,pivotBy:ue.pushed.pivotBy},Se.client.length&&$(`source.pushdown.pivot.totals.${me}.${Se.client.map(rt=>rt.id).join(".")}`,`the ${me} adapter cannot compute the pivot cells for ${Se.client.map(rt=>`"${rt.id}" (${rt.reason})`).join(", ")}, so those cells are empty. A figure computed over anything other than the cell would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const Ne=await ne.executePivotLevel(ue.pushed,Se.engine,pe)||{};let De=Ne.rows||[];!ie.range&&pe.range&&(De=De.slice(pe.range.start,pe.range.end)),We(Ne);const Ue=Ne.pivot&&typeof Ne.pivot=="object"?Ne.pivot:{},qe={cells:Array.isArray(Ue.cells)?Ue.cells:[],...Array.isArray(Ue.axis)?{axis:Ue.axis}:{}};return Ne.total===void 0?{rows:De,pivot:qe}:{rows:De,total:Ne.total,pivot:qe}},nt=ue=>{$(`source.pushdown.pivot.${me}.${ue}`,`pushdown:pivot-unsupported: the ${me} adapter cannot pivot this query because ${ue}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const pe=new Error(`[lattice] ${K}: the ${me} adapter cannot pivot this query because ${ue}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw pe.code=K,pe.reason=ue,pe},Qe=(ue,pe)=>{const Se={key:pe,state:"pending",value:null};return Te=Se,ue.then(Ne=>(Te===Se&&(Te={key:pe,state:"settled",value:typeof Ne=="number"?Ne:null}),Ne),Ne=>{throw Te===Se&&(Te={key:pe,state:"failed",value:null}),Ne})};let dt=0,jt=[];const Et=()=>dt===0?null:new Promise(ue=>{const pe=setTimeout(ue,m);jt.push(()=>{clearTimeout(pe),ue()})});let it;const ft=async ue=>{const pe=Pe();pe&&await pe;const Ne=ue&&ue.pivotMode!==!1&&Array.isArray(ue.pivotBy)&&ue.pivotBy.length>0?{request:ue,probe:null}:await Me(ue);c(ue);let De=S(Ne.request,ie,xe.enabled);if(ie.group&&De.grouped&&!De.pivoted&&!I(ne.executeGroupLevel)&&($(`source.pushdown.group.method.${me}`,`the ${me} 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.`),De=S(Ne.request,{...ie,group:!1,aggregates:null},xe.enabled)),De.pivoted&&!I(ne.executePivotLevel)&&(De=S(Ne.request,{...ie,pivot:!1},xe.enabled),De.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),De.grouped&&!De.pivoted&&!ie.group&&!I(ne.executeGroupedAggregates)&&($(`source.pushdown.group.aggregates.method.${me}`,`the ${me} 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\`.`),De=S(Ne.request,{...ie,aggregates:null},xe.enabled)),se=De,De.pivoted)return Ye(De,ue);if(De.pivotReason&&nt(De.pivotReason),De.grouped)return ie.group?Re(De,ue):Ie(De,ue);const qe=!!De.groupReason&&!De.full;qe?$(`source.pushdown.group-unsupported.${me}.${De.groupReason}`,`pushdown:group-unsupported: the ${me} adapter was not asked to group this query because ${De.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.`):De.groupReason&&$(`source.pushdown.group.${me}.${De.groupReason}`,`the ${me} adapter was not asked to group this query because ${De.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 rt=Ht=>qe?{...Ht,[B]:!0}:Ht;if(!De.needsAll){const Ht=Ne.probe||await ne.execute(De.pushed,ue),Xt=Ht.rows||[];return _(Ht.pendingTotal)&&Ht.total===void 0?rt({rows:Xt,pendingTotal:Qe(Ht.pendingTotal,R(De.pushed))}):(Te=null,!ie.total&&Ht.total===void 0?rt({rows:Xt}):rt({rows:Xt,total:Ht.total??Xt.length}))}const ut=De.unpushed.filter(Ht=>!(Ht==="where"&&De.residual.where&&De.residual.where.anyConditioned));ut.length&&$(`source.pushdown.residual.${me}.${ut.join(".")}`,`the ${me} adapter cannot push ${ut.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 at=R(De.pushed);if(!ae||ae.key!==at){const Ht=await ee(await ne.execute(De.pushed,ue));Te=null;const Xt=Ht.rows||[];if(De.full){const Ze=typeof Ht.total=="number"?Math.max(Ht.total,Xt.length):Xt.length;if(Ze>xe.maxRows)throw new Error(`[lattice] fullDataset refused: the ${me} adapter's matching set is ${Ze.toLocaleString()} rows, past the configured maxRows of ${xe.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 ct=Xt.length*x(Xt[0]);if(ct>xe.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${me} adapter's matching set is an estimated ${Math.round(ct/(1024*1024)).toLocaleString()} MB across ${Xt.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(xe.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 Ht.total=="number"&&Xt.length<Ht.total){const Ze=!!(De.residual.filters||De.residual.quick||De.residual.sort&&De.residual.sort.length);if(Ze&&!_e)throw new Error(`[lattice] the ${me} adapter returned ${Xt.length} of ${Ht.total} matching rows when asked for the whole result, and the query has residual ${De.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.`);Ze?$(`source.pushdown.partial.residual.${me}`,`the ${me} adapter returned ${Xt.length} of ${Ht.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.`):$(`source.pushdown.partial.${me}`,`the ${me} adapter returned ${Xt.length} of ${Ht.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}ae={key:at,rows:Xt,total:typeof Ht.total=="number"?Ht.total:null}}let kt=De;if(De.residual.where){const Ht=ae.total??ae.rows.length;if(Ht>=ve){v(De.residual.where.names,me,Ht,ve);const{where:Xt,...Ze}=Ne.request;kt=S(Ze,ie,xe.enabled),se=kt}}const Rt=ae.total!==null&&ae.rows.length>=ae.total,At=T(ae.rows,{...kt.residual,whole:Rt},Z.compute||{}),_t=ue.range?ue.range.start:0,tn=ue.range?ue.range.end:At.length;return rt({rows:At.slice(_t,tn),total:At.length})},pt=async(ue,pe,Se)=>{const De=Se&&Se.waitForPage&&it&&I(it.pageForegroundIdle)?it.pageForegroundIdle():Et();De&&await De;const Ue=Pe();Ue&&await Ue;const qe=S(ue,ie,xe.enabled);se=qe;const rt=g(pe,Se&&Se.engine?{default:"engine"}:he),ut=Array.isArray(ue.groupBy)?ue.groupBy:[],at=ut.length>0,kt=!qe.residual.filters&&!qe.residual.quick,Rt=!at||o(ut,ie.buckets);let At=rt.engine,_t=rt.client;if(ie.aggregates&&At.length){const ct=ie.aggregates instanceof Set?ie.aggregates:new Set(Q(ie.aggregates)),Ot=At.filter(bt=>!ct.has(bt.fn));Ot.length&&(At=At.filter(bt=>ct.has(bt.fn)),_t=[...Ot.map(bt=>({...bt,reason:`the ${me} adapter does not compute "${bt.fn}"`})),..._t])}const tn=ct=>{_t=[...At.map(Ot=>({...Ot,reason:ct})),..._t],At=[]};let Ht="";if(At.length&&!kt){const ct=qe.residual.quick&&!qe.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)";tn(ct),at&&(Ht=ct)}else if(At.length&&!Rt){const ct="a grouping key the engine cannot form forces all-client (no mixed provenance)";tn(ct),Ht=ct}let Xt={},Ze;if(At.length&&(I(at?ne.executeGroupedAggregates:ne.executeAggregates)?at?Ze=await ne.executeGroupedAggregates(qe.pushed,ut,At)||[]:Xt=await ne.executeAggregates(qe.pushed,At)||{}:($(`source.pushdown.aggregates.${me}${at?".grouped":""}`,`the ${me} adapter cannot compute ${at?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),tn(`adapter cannot compute ${at?"grouped ":""}aggregates`),at&&(Ht=`the ${me} adapter cannot compute grouped aggregates`))),at){const ct=Ze!==void 0;ct!==qe.grouped&&(se={...qe,grouped:ct,groupReason:ct?"":Ht||qe.groupReason,unpushed:ct?qe.unpushed.filter(Ot=>Ot!=="group"):qe.unpushed.includes("group")?qe.unpushed:[...qe.unpushed,"group"]})}return de={engine:At,client:_t,...at?{groupBy:ut}:{}},{values:Xt,engine:At,client:_t,...Ze!==void 0?{groups:Ze}:{}}},Tt=async ue=>{dt++;try{return await ft(ue)}finally{if(dt--,dt===0&&jt.length){const pe=jt;jt=[];for(const Se of pe)Se()}}},Mt=p(Z.edit),Lt=Z.edit&&typeof Z.edit=="object"&&I(Z.edit.commit);let Je=Z.edit;if(Mt&&!Lt)if(ie.mutate&&ie.mutate.update){const ue=pe=>{if(!ie.mutate||!ie.mutate.update)throw new Error(`[lattice] the ${me} adapter cannot update rows (mutate.update is not declared), so this edit cannot be persisted. The cell is reverted rather than left looking saved.`);const Se={kind:"update",key:String(pe.key),patch:{[pe.colId]:pe.value}};return ne.mutate(Se,pe.request||{})};Je={...Z.edit===!0?{}:Z.edit,commit:ue}}else $(`source.pushdown.readonly.${me}`,`edit is enabled but the ${me} adapter declares mutate: ${ie.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=Mt&&ie.mutate&&(ie.mutate.append||ie.mutate.delete)?{append:ie.mutate.append===!0,remove:ie.mutate.delete===!0,returning:ie.mutate.returning,mutate:(ue,pe)=>ne.mutate(ue,pe||{})}:null,be=async ue=>{const pe=Pe();pe&&await pe;const{range:Se,signal:Ne,export:De,...Ue}=ue||{},qe={...Ue,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:S(qe,ie,xe.enabled),signal:Ne}};async function*Oe(ue,pe={}){const{plan:Se,signal:Ne}=await be(ue),De=Math.max(1,Math.floor(Number(pe.pageSize))||5e3),Ue={signal:Ne,stream:!0},qe=ue&&ue.range&&Number.isFinite(Number(ue.range.start))&&Number.isFinite(Number(ue.range.end))?{start:Math.max(0,Number(ue.range.start)),end:Math.max(0,Number(ue.range.end))}:null;if(!Se.needsAll){const at=qe?qe.start:0,kt=qe?qe.end:1/0;for(let Rt=at;Rt<kt;Rt+=De){c(Ue);const At=Math.min(Rt+De,kt),_t=await ne.execute({...Se.pushed,range:{start:Rt,end:At}},Ue);_t&&_(_t.pendingTotal)&&_t.pendingTotal.then(null,()=>{});const tn=_t&&_t.rows||[];if(tn.length&&(yield tn),tn.length<At-Rt)return}return}c(Ue);const rt=await ee(await ne.execute({...Se.pushed,range:void 0},Ue));let ut=T(rt&&rt.rows||[],{...Se.residual,whole:!0},Z.compute||{});qe&&(ut=ut.slice(qe.start,qe.end));for(let at=0;at<ut.length;at+=De)yield ut.slice(at,at+De)}const Le=async ue=>{const{plan:pe,signal:Se}=await be(ue);if(!pe.needsAll&&ie.total){c({signal:Se});const De=await ee(await ne.execute({...pe.pushed,range:{start:0,end:0}},{signal:Se}));if(De&&typeof De.total=="number")return De.total}let Ne=0;for await(const De of Oe({...ue,range:void 0}))Ne+=De.length;return Ne},Fe=async ue=>{await Pe();const pe=b(ue.filters||null,{tz:Z.timeZone,weekStartsOn:Z.weekStartsOn}),Se=ue.quick?String(ue.quick):"";return f(pe,ie).residual||Se&&!ie.quick?null:ne.facets({...ue,filters:pe,quick:Se})};return it={...Z,edit:Je,rowMutate:le,mode:"remote",fetch:Tt,foregroundIdle:Et,facetProvider:I(ne.facets)?Fe:void 0,aggregate:pt,countMatching:Le,streamMatching:Oe,capabilitiesOf:y,planQuery:S,wireFilters:b,resolveAggregatePlan:(ue,pe)=>g(ue,pe&&pe.engine?{default:"engine"}:he),STAT_PUSHDOWN:t,lastPlan:()=>se?{...se,...de?{aggregates:N(de)}:{},...Te?{total:{deferred:!0,state:Te.state,value:Te.value}}:{}}:null,fullFrame:He,counts:()=>({match:ke,total:ke,pending:!!Te&&Te.state==="pending"}),grandTotals:()=>Ae},it}}),Ve("packages/core/src/source/remote.js",function(e,D){"use strict";Object.defineProperty(e,"PROTOCOL",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return N}});const A=D("packages/core/src/internal/lru.js").Lru,I=D("packages/core/src/internal/predicates.js").isFunction,Q=D("packages/core/src/internal/warn.js").warnOnce,$=D("packages/core/src/internal/schedule.js").settleDebounce,X=D("packages/core/src/source/abort.js"),F=X.createAbortScope,j=X.isAbortError,v=D("packages/core/src/source/blockcache.js"),b=v.BlockCache,l=v.DEFAULT_PAGE_SIZE,g=v.DEFAULT_MAX_CACHED_PAGES,o=D("packages/core/src/source/rows.js"),t=o.createRowFactory,s=o.groupKey,r=D("packages/core/src/source/filterwire.js"),i=r.wireFilters,n=r.querySignature,m=r.warnHostFilterNotApplied,a=D("packages/core/src/source/pagewindow.js").pageWindow,h=D("packages/core/src/source/memory.js").MemorySource,y=D("packages/core/src/compute/handle.js").valueComparator,d=D("packages/core/src/compute/pivot.js"),f=d.pivotKey,w=d.joinPath,k=d.DEFAULT_PATH_SEPARATOR,G=D("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,K=1,q=120,B=1e3;function E(O,T,R){for(let x=0;x<Math.max(O.length,T.length);x++){const U=O[x],V=T[x],J=U==null,_=V==null;if(J||_){if(J&&_)continue;return J?1:-1}const ee=R(U,V);if(ee!==0)return ee}return 0}function S(O,T){return new N(O,T)}class C{constructor(T,R,x,U){this.path=T,this.keyPath=U||T,this.values=[],this.level=R,this.key=s(this.keyPath),this.cache=new b(x),this.count=null,this.complete=!1,this.announced=null,this.counting=!1,this.failed=!1,this.children=new Map,this.row=null,this.flat=!1}}class N{mode="remote";#e;#t;#n;#r;#s=new Map;#i=new Set;#a=F();#l;#o;#c=new Map;#u=[];#f=null;#d="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#O="";#w=null;#A=-1;constructor(T,R){this.#e=T||{mode:"remote"},this.#t=R||{},I(this.#e.fullFrame)&&(this.filteredIndices=()=>this.#I(),this.unfilteredIndices=()=>this.#K(),this.handleFor=ee=>this.#Y(ee),this.display=()=>this.#x(),this.grandTotalRow=()=>this.#D(),this.unfilteredRows=()=>this.#_(),this.facetIndices=ee=>this.#U(ee));const x=this.#e.counts;I(x)&&(this.matchCount=()=>this.#X("match"),this.totalCount=()=>this.#X("total"));const U=this.#e.grandTotals;I(U)&&(this.grandTotalRow=()=>this.#V());const V=this.#e.foregroundIdle;I(V)&&(this.foregroundIdle=()=>this.#oe(V),this.#e.pageForegroundIdle=()=>this.#b?this.#oe(V):null);const J=this.#e.facetProvider;I(J)&&(this.facetProvider=J);const _=this.#e;I(_.countMatching)&&I(_.streamMatching)&&(this.selectionQuery=()=>this.#W(),this.countMatching=ee=>_.countMatching(ee),this.streamMatching=(ee,W)=>_.streamMatching(ee,W),this.loadedRows=()=>this.#ge(),this.resident=()=>this.#N()!==null),this.#n={pageSize:this.#e.pageSize||l,maxCachedPages:this.#e.maxCachedPages||g},this.#l=t(this.#t),this.#o=new A(this.#n.pageSize*4),this.#h=$((ee,W)=>this.#T(ee,W),q),this.#r=new C([],0,this.#n),this.#s.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 T=this.#S();return T?T.length:this.#v()}#v(){const T=this.#N();return T?T.count():(this.#re(),this.#Ae(this.#r))}#C(){if(this.#N())return!0;const T=R=>{if(R.count===null&&!R.complete)return!1;for(const x of R.children.values())if(this.#Te(x.key,this.#we(x))&&!T(x))return!1;return!0};return T(this.#r)}pageInfo(){const T=this.#S(),R=this.totalPending();if(!T){const x=this.#v();return{page:0,pageSize:0,total:this.#C()?x:null,pageCount:1,counting:R}}return{page:T.page,pageSize:T.pageSize,total:T.total,pageCount:T.pageCount,counting:R||T.total===null&&this.#a.size>0&&this.#r.cache.loadedExtent()===0}}#S(){const T=this.#v(),R=a(this.#$("pageSize",0),this.#$("page",0),T,this.#C());if(!R)return this.#O="",null;const x=`${this.#y}:${R.offset}:${R.length}`;return x!==this.#O&&!this.#p&&(this.#O=x,R.length>0&&!this.#N()&&this.#T(R.offset,R.offset+R.length-1)),R}at(T){const R=this.#S();if(R){if(T<0||T>=R.length)return;const x=this.#P(R.offset+T);return x&&(x.index=T),x}return this.#P(T)}#P(T){const R=this.#N();if(R)return R.at(T);if(this.#re(),T<0||T>=this.#v())return;const x=this.#Z(this.#r,T);if(!x)return;const U=this.#G(x.node,x.local);return U&&(U.index=T),U||this.#l.skeleton(T,x.node.level,x.node.cache.erroredAt(x.local))}byKey(T){const R=this.#N();if(R)return R.byKey(T);const x=this.#c.get(T);if(!x)return;const U=x.lastIndexOf(":"),V=this.#s.get(x.slice(0,U));return V&&this.#G(V,Number(x.slice(U+1)))||void 0}loaded(T){const R=this.#S();if(R){if(T<0||T>=R.length)return!1;T+=R.offset}const x=this.#N();if(x)return x.loaded(T);if(T<0||T>=this.#v())return!1;const U=this.#Z(this.#r,T);return!!U&&U.node.cache.rowLoaded(U.local)}hint(T,R){if(this.#p)return;this.#b=!0;const x=this.#re();let U=Math.max(0,Math.floor(T)),V=Math.max(U,Math.floor(R));const J=this.#S();if(J){if(J.length===0)return;U=J.offset,V=J.offset+J.length-1}for(const[_,ee]of this.#E(U,V)){_.cache.protect(ee.min,ee.max);for(const W of _.cache.evict())this.#Ee(_,W)}this.#h(U,V),x&&this.#h.flush()}#E(T,R){const x=this.#v(),U=new Map;for(let V=T;V<=R&&V<x;V++){const J=this.#Z(this.#r,V);if(!J)continue;const _=U.get(J.node);_?(_.min=Math.min(_.min,J.local),_.max=Math.max(_.max,J.local)):U.set(J.node,{min:J.local,max:J.local})}return U.size||U.set(this.#r,{min:T,max:T}),U}#T(T,R){if(!this.#p)for(const[x,U]of this.#E(T,R)){x.cache.protect(U.min,U.max);const V=x.cache.blockOf(U.min),J=x.cache.blockOf(U.max);for(let _=V;_<=J&&!(x.count!==null&&_*x.cache.pageSize>=x.count);_++)x.cache.has(_)||this.#ue(x,_)}}apply(T){const R={added:[],updated:[],removed:[]};if(!T)return R;if(T.update)for(const x of T.update){const U=this.#c.get(this.#l.keyOf(x,-1));if(!U)continue;this.#o.delete(U);const V=U.lastIndexOf(":"),J=this.#s.get(U.slice(0,V));if(!J)continue;const _=Number(U.slice(V+1)),ee=J.cache.blockOf(_);if(!J.cache.loaded(ee))continue;const{start:W}=J.cache.rangeOf(ee),Z=[];for(let ie=W;ie<W+J.cache.pageSize;ie++){const ce=J.cache.rowAt(ie);if(ce===void 0)break;Z.push(ie===_?x:ce)}J.cache.fill(ee,Z);const ne=this.#G(J,_);ne&&R.updated.push(ne)}return(T.add&&T.add.length||T.remove&&T.remove.length)&&this.reload({keepExpanded:!0}),R}reload(T){this.#a.abortAll("reload"),this.#h.cancel(),T&&T.keepExpanded===!1&&this.#i.clear(),this.#pe(),this.#H("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#a.abortAll("destroyed"),this.#pe(),this.#s.clear(),this.#i.clear(),this.#w&&I(this.#w.destroy)&&this.#w.destroy(),this.#w=null}expand(T){this.#i.has(T)||(this.#i.add(T),this.#H("group:toggled",{key:T,expanded:!0}),this.#H("model:changed",{reason:"expand",key:T}))}collapse(T){this.#i.delete(T)&&(this.#H("group:toggled",{key:T,expanded:!1}),this.#H("model:changed",{reason:"collapse",key:T}))}expandedKeys(){return[...this.#i]}pivotFields(){return this.#u}pivot(){this.#re();const T=this.#f;if(!T||!T.keys.size||!this.#$("pivotBy",[]).length)return null;if(!T.result){const R=y((this.#t.config||{}).locale),x=[...T.keys.entries()].sort((V,J)=>E(V[1],J[1],R)),U=x.map(([V])=>V);T.result={keys:x.map(([,V])=>V),paths:U,fields:this.#Pe(U),groupPaths:[],columns:U.length*Math.max(1,this.#ve().length),values:T.cells,cells:T.cells,error:null}}return T.result}invalidateHandles(){this.#w&&(I(this.#w.invalidateHandles)&&this.#w.invalidateHandles(),I(this.#w.invalidate)&&this.#w.invalidate("filter"))}#M(){const T=this.#e.fullFrame;return I(T)?T():null}#N(){const T=this.#M();return T?(this.#w||(this.#w=new h({mode:"memory"},this.#R())),T.version!==this.#A&&(this.#w.setRows(T.rows),this.#A=T.version),this.#w):null}#R(){const T=this.#t,R=T.state||{};return{...T,state:{...R,page:()=>0,pageSize:()=>0}}}#I(){const T=this.#N();return T?T.filteredIndices():new Uint32Array(0)}#K(){const T=this.#N();return T?T.unfilteredIndices():new Uint32Array(0)}#Y(T){const R=this.#N();return R?R.handleFor(T):void 0}#x(){const T=this.#N();return T?T.display():[]}#U(T){const R=this.#N();return R&&I(R.facetIndices)?R.facetIndices(T):new Uint32Array(0)}#D(){const T=this.#N();return T&&I(T.grandTotalRow)?T.grandTotalRow():null}#X(T){const R=this.#N();if(R){const J=T==="match"?R.matchCount:R.totalCount;if(I(J))return J.call(R)}const x=this.#e.counts,U=I(x)?x():null,V=U?U[T]:null;return typeof V=="number"?V:this.#v()}#V(){const T=this.#N();if(T&&I(T.grandTotalRow))return T.grandTotalRow();if((this.#t.config||{}).grandTotalRow!=="bottom")return null;const x=this.#e.grandTotals,U=I(x)?x():null;return!U||!U.totals?null:this.#l.grandTotal(U.totals,U.leafCount||0)}#_(){const T=this.#N();if(T&&I(T.unfilteredRows))return T.unfilteredRows();const R=[],x=this.count();for(let U=0;U<x;U++){const V=this.at(U);V&&R.push(V)}return R}#W(){const T=this.#$("quick",""),R={protocol:K,groupPath:[],groupValues:[],groupBy:[],totals:[],totalFns:{},pivotBy:[],pivotMode:!1,filters:i(this.#$("filters",null),this.#Q()),sort:this.#$("sort",[]),context:this.#$("context",null)};T&&(R.quick=T);const x=this.#$("where",null);return x&&x.active&&(R.where=x),R}#ge(){const T=this.#$("groupBy",[]).length,R=[];for(const x of this.#s.values())if(!(x.level!==T&&!x.flat))for(const U of x.cache.ids()){if(!x.cache.loaded(U))continue;const{start:V,end:J}=x.cache.rangeOf(U);for(let _=V;_<J&&x.cache.rowLoaded(_);_++){const ee=this.#G(x,_);ee&&!ee.group&&R.push(ee)}}return R}loadedCount(){const T=this.#N();if(T){const U=T.matchCount();return typeof U=="number"?U:T.count()}this.#re();const R=this.#$("groupBy",[]).length;let x=0;for(const U of this.#s.values())if(!(U.level!==R&&!U.flat))for(const V of U.cache.ids()){if(!U.cache.loaded(V))continue;const J=U.cache.fillOf(V);typeof J=="number"&&(x+=J)}return x}residentRows(){const T=this.#N();return T?T.display():this.#$("groupBy",[]).length>0?null:(this.#re(),this.#ge())}#ie(T,R,x){const{start:U,end:V}=T.cache.rangeOf(R),J=this.#$("groupBy",[]),_=this.#$("pivotBy",[]),ee=this.#$("quick",""),W=this.#ve(),Z={protocol:K,range:{start:U,end:V},groupPath:T.path,groupValues:T.values,groupBy:J,totals:W,totalFns:this.#Se(W),pivotBy:_,pivotMode:_.length>0,filters:i(this.#$("filters",null),this.#Q()),sort:this.#$("sort",[]),context:this.#$("context",null),signal:x};ee&&(Z.quick=ee);const ne=this.#$("where",null);return ne&&ne.active&&(Z.where=ne),Z}async#ue(T,R){if(!I(this.#e.fetch))return;if(!this.#m){this.#m=!0;const J=this.#g;this.#g=[],queueMicrotask(()=>{for(const _ of J)_()})}const x=this.#a.begin(`${T.key}:${R}`);T.cache.begin(R,x);const U=this.#d,{start:V}=T.cache.rangeOf(R);try{const J=await this.#e.fetch(this.#ie(T,R,x.signal));if(!x.current||U!==this.#d||this.#p)return;x.settle();const _=J&&J.rows||[];if(!!(J&&J[G])&&!T.flat){T.flat=!0,T.children.clear();for(const[ne,ie]of[...this.#c])ie.startsWith(`${T.key}:`)&&(this.#o.delete(ie),this.#c.delete(ne))}T.cache.fill(R,_),T.failed=!1;for(let ne=0;ne<_.length;ne++)this.#o.delete(`${T.key}:${V+ne}`);const W=J&&typeof J.count=="number"?J.count:J&&typeof J.total=="number"?J.total:null,Z=J&&I(J.pendingTotal?.then)?J.pendingTotal:null;W!==null?(T.count=W,T.complete=!0):_.length<T.cache.pageSize?(T.count=V+_.length,T.complete=!0):Z&&(T.counting=!0,T.announced=null),J&&Array.isArray(J.pivotFields)&&this.#Ue(J.pivotFields),J&&J.pivot&&typeof J.pivot=="object"&&this.#ae(J.pivot),this.#H("model:changed",{reason:"page",groupPath:T.path,block:R}),this.#H("rows:changed",{companion:!0,reason:"page",groupPath:T.path,block:R}),this.#fe(T),Z&&this.#Me(T,Z,U)}catch(J){if(x.settle(),j(J))return;T.cache.failed(R,J),T.failed=!0;const{end:_}=T.cache.rangeOf(R);for(let ee=V;ee<_;ee++)this.#o.delete(`${T.key}:${ee}`);this.#H("model:changed",{reason:"page-error",groupPath:T.path,block:R}),this.#H("source:error",{error:J,groupPath:T.path,block:R})}}async#Me(T,R,x){let U;try{U=await R}catch(V){if(x!==this.#d||this.#p)return;T.counting=!1,j(V)||(T.failed=!0),j(V)||this.#H("source:error",{error:V,groupPath:T.path});return}x!==this.#d||this.#p||(T.counting=!1,typeof U=="number"&&(T.count=U,T.complete=!0,this.#fe(T),this.#H("model:changed",{reason:"total",count:U,groupPath:T.path})))}#fe(T){typeof T.count!="number"||!T.complete||T.announced!==T.count&&(T.announced=T.count,this.#H("source:total",{total:T.count,groupPath:T.path}))}#oe(T){if(this.#p)return null;this.#re();const R=this.#m?null:new Promise(_=>{this.#g.push(_),setTimeout(_,B)}),x=T();if(!R&&!x)return null;const U=(async()=>{R&&await R;for(let _=T();_;_=T())await _})();let V;const J=new Promise(_=>{V=setTimeout(_,B)});return Promise.race([U,J]).then(()=>clearTimeout(V))}totalPending(){if(this.#r.failed)return!1;if(this.#r.counting===!0)return!0;if(this.#N())return!1;this.#re();const T=this.#r;return T.count===null&&!T.complete&&T.cache.loadedExtent()===0}totalFailed(){return this.#r.failed===!0}#Ue(T){T.length===this.#u.length&&T.every((R,x)=>R===this.#u[x])||(this.#u=T,this.#H("column:pivoted",{pivotFields:T,remote:!0}))}#xe(){const T=this.#t.config||{};return T.pivot&&T.pivot.separator||k}#Pe(T){const R=this.#xe(),x=this.#ve();if(!x.length)return T.slice();const U=[];for(const V of T)for(const J of x)U.push(`${V}${R}${J}`);return U}#ae(T){const R=this.#xe();this.#f||(this.#f={keys:new Map,cells:new Map,result:null});const x=this.#f;let U=!1;const V=_=>{const ee=Array.isArray(_)?_:[_],W=w(ee,R);return x.keys.has(W)||(x.keys.set(W,ee),U=!0),W},J=this.#$("groupBy",[]).length>0;for(const _ of Array.isArray(T.axis)?T.axis:[])V(_);for(const _ of Array.isArray(T.cells)?T.cells:[]){if(!_||typeof _!="object")continue;const ee=V(_.pivot);if(J&&!(Array.isArray(_.group)&&_.group.length))continue;const W=w(Array.isArray(_.group)?_.group:[],R);for(const[Z,ne]of Object.entries(_.values||{}))x.cells.set(f(W,ee,Z),ne)}x.result=null,U&&this.#Ue((this.pivot()||{fields:[]}).fields)}#Ae(T){let R=this.#le(T);for(const x of T.children.values())this.#Te(x.key,this.#we(x))&&(R+=this.#Ae(x));return R}#le(T){if(T.count!==null)return T.count;const R=T.cache.loadedExtent();return T.complete?R:T.row&&T.row.leafCount>0?T.level>=this.#$("groupBy",[]).length?Math.max(R,T.row.leafCount):R===0?1:Math.min(R+T.cache.pageSize,Math.max(R,T.row.leafCount)):R+T.cache.pageSize}#Z(T,R){let x=R,U=0;const V=[...T.children.entries()].filter(([,_])=>this.#Te(_.key,this.#we(_))).sort((_,ee)=>_[0]-ee[0]);for(const[_,ee]of V){const W=_-U+1;if(x<W)return{node:T,local:U+x};x-=W,U=_+1;const Z=this.#Ae(ee);if(x<Z)return this.#Z(ee,x);x-=Z}const J=this.#le(T);return U+x<J?{node:T,local:U+x}:null}#G(T,R){const x=`${T.key}:${R}`,U=this.#o.get(x);if(U)return U.group===!0?this.#B(U):U;const V=T.cache.rowAt(R);if(V===void 0)return null;const J=this.#$("groupBy",[]);let _;if(T.level<J.length&&!T.flat){const ee=J[T.level],W=this.#f!==null&&T.level===J.length-1&&this.#$("pivotBy",[]).length>0,Z=this.#ye(V,ee),ne=Z==null,ie=[...T.path,ne?"":String(Z)],ce=[...T.keyPath,ne?null:String(Z)];if(_=this.#l.group({path:ie,keyPath:ce,column:ee,value:Z,level:T.level,parent:T.row,leafCount:Number(V.leafCount)||0,expanded:W?!1:this.#Te(s(ce),{key:s(ce),column:ee,value:Z,level:T.level,path:ie}),...W?{hasChildren:!1}:{}}),_.totals=this.#ne(V),_.data=V,!W){let me=this.#s.get(_.key);me?me.row=_:(me=new C(ie,T.level+1,this.#n,ce),me.row=_,this.#s.set(me.key,me)),me.values=[...T.values,Z],T.children.set(R,me)}}else _=this.#l.leaf(V,R,T.level,T.row);return this.#o.set(x,_),this.#c.set(_.key,x),_}#ne(T){const R=T||{};if(R.totals&&typeof R.totals=="object")return R.totals;const x={};for(const U of this.#ve())Object.hasOwn(R,U)&&(x[U]=R[U]);return x}#B(T){const R=this.#s.get(T.key);if(!R||R.row!==T||T.hasChildren===!1)return T;const x=this.#Te(T.key,this.#we(R));return T.expanded!==x&&(T.expanded=x),T}#Ee(T,R){const{start:x,end:U}=T.cache.rangeOf(R);for(let V=x;V<U;V++){const J=`${T.key}:${V}`,_=this.#o.peek(J);_&&this.#c.delete(_.key),this.#o.delete(J)}}#re(){const T=this.#be();return T===this.#d?!1:(this.#d=T,this.#a.abortAll("query"),this.#pe(),this.#m=!1,this.#H("model:changed",{reason:"query"}),!0)}#pe(){for(const T of this.#s.values())T.cache.clear(),T.count=null,T.complete=!1,T.announced=null,T.counting=!1,T.failed=!1,T.children.clear(),T.flat=!1;this.#o.clear(),this.#c.clear(),this.#y++,this.#f=null}#be(){const T=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)})}|${T?T.version:0}`}#Te(T,R){const x=this.#$("expanded",null);return x?I(x.has)?x.has(T,R):Array.prototype.includes.call(x,T):this.#i.has(T)}#we(T){if(T.row)return{key:T.key,column:T.row.column,value:T.row.value,level:T.level-1,path:T.path}}#ve(){const T=this.#$("totals",[]);if(T&&T.length)return[...T];const R=this.#t.columns;return!R||!I(R.all)?[]:R.all().filter(x=>!!x.total).map(x=>x.id)}#Se(T){const R=this.#t.columns,x={};if(!R||!I(R.get))return x;for(const U of T){const V=R.get(U);if(!V)continue;const J=V.groupTotal!=null?V.groupTotal:V.total;typeof J=="string"?x[U]=J:J&&typeof J=="object"&&typeof J.fn=="string"&&(x[U]={...J})}return x}#ye(T,R){const x=this.#t.columns,U=x&&I(x.get)?x.get(R):void 0;return U&&I(U.getValue)?U.getValue(T):T?.[R]}#de(){m(this.#t)}#Q(){const T=this.#t.config||{};return{tz:T.timeZone,weekStartsOn:T.weekStartsOn}}#$(T,R){const x=this.#t.state;if(x&&I(x[T])){const U=x[T]();return U??R}return R}#H(T,R){const x=this.#t.emit;I(x)&&x(T,R)}}}),Ve("packages/core/src/source/gapbuffer.js",function(e,D){"use strict";Object.defineProperty(e,"GapBuffer",{enumerable:!0,get:function(){return A}});const re=64;class A{#e;#t=0;#n=0;constructor(I=re){this.#e=new Uint32Array(Math.max(1,I)),this.#n=this.#e.length}static from(I,L=re){const Q=new A(I.length+Math.max(1,L));return Q.#e.set(I,0),Q.#t=I.length,Q.#n=Q.#e.length,Q}get length(){return this.#t+(this.#e.length-this.#n)}get capacity(){return this.#e.length}at(I){return I<0||I>=this.length?0:I<this.#t?this.#e[I]:this.#e[I+(this.#n-this.#t)]}insert(I,L){const Q=I<0?0:I>this.length?this.length:I;this.#r(Q),this.#t===this.#n&&this.#s(),this.#e[this.#t++]=L}push(I){this.insert(this.length,I)}removeAt(I){return!Number.isInteger(I)||I<0||I>=this.length?!1:(this.#r(I),this.#n++,!0)}toArray(){const I=new Uint32Array(this.length);return I.set(this.#e.subarray(0,this.#t),0),I.set(this.#e.subarray(this.#n),this.#t),I}clear(){this.#t=0,this.#n=this.#e.length}#r(I){if(I!==this.#t)if(I<this.#t){const L=this.#t-I;this.#e.copyWithin(this.#n-L,I,this.#t),this.#t=I,this.#n-=L}else{const L=I-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+L),this.#t=I,this.#n+=L}}#s(){const I=this.#e.length-this.#n,L=new Uint32Array(Math.max(this.#e.length*2,this.#e.length+re));L.set(this.#e.subarray(0,this.#t),0),L.set(this.#e.subarray(this.#n),L.length-I),this.#e=L,this.#n=L.length-I}}}),Ve("packages/core/src/store/ingest.js",function(e,D){"use strict";Object.defineProperty(e,"INGEST_DEFAULTS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"inferKind",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"decideText",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"createReaders",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"Ingest",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return i}});const re=D("packages/core/src/internal/schedule.js"),A=re.now,Y=re.nextFrame,I=D("packages/core/src/internal/warn.js"),L=I.infoOnce,Q=I.warnOnce,$=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/paths.js").pathGetter,v=D("packages/core/src/store/columnstore.js").ColumnStore,b=Object.freeze({chunkMs:8,chunkRows:512,sampleSize:100,dictionaryRatio:.1,columnarBelow:5e3,initialCapacity:1024});function l(n,m={}){if(m.multi)return"multi";if(n.length===0)return"object";let c=0,a=0,u=0,h=0,p=0;for(let d=0;d<n.length;d++){const f=n[d];typeof f=="number"?c++:typeof f=="boolean"?a++:typeof f=="string"?u++:f instanceof Date?h++:Array.isArray(f)&&p++}const y=n.length;return c===y?"float64":a===y?"bitset":h===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 a=new Map,u=new Map;for(const K of n){if(K.computed)continue;const q=$(K.read)?K.read:F(K.field||K.id);u.set(K.id,q),a.set(K.id,q)}const h=m?.order??[],p=m?.fns??{},y=m?.deps??{},d=m?.wrapDeps??null,f=h.filter(K=>$(p[K])),w=f.some(K=>y[K]==="*");let k=new WeakMap;const P=K=>{const q={};if(w)for(const[B,E]of u)q[B]=E(K);for(const B of f){const E=y[B];let S;if(E==="*")S=q;else{S={};const C=E||[];for(let N=0;N<C.length;N++){const O=C[N];S[O]=O in q?q[O]:u.get(O)?.(K)}}q[B]=p[B](d?d(S,B):S,{data:K,row:null,column:null,grid:null,context:c})}return q},G=K=>{if(K===null||typeof K!="object"&&typeof K!="function")return P(K);let q=k.get(K);return q===void 0&&(q=P(K),k.set(K,q)),q};for(const K of f)a.set(K,q=>G(q)[K]);return{readers:a,reset(){k=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 s{#e;#t=[];#n=null;#r;#s=0;#i;#a=!1;#l=!1;#o=0;#c;constructor(m,c={},a={}){this.#e=Array.isArray(m)?m:Array.from(m||[]),this.#i={...b,...a};const u=c.columns??[];this.#r=o(u,c.computed??null,c.context),this.#c=this.#e.length>=this.#i.columnarBelow,this.#u(u,c.computed??null),this.#n=new v(this.#t.map(h=>({id:h.spec.id,kind:h.kind,nullable:h.nullable,read:h.read,dictionary:h.spec.dictionary})),{initialCapacity:this.#i.initialCapacity,columnarBelow:this.#i.columnarBelow})}get store(){return this.#n}get done(){return this.#a||this.#l}get progress(){return this.#s}slice(){if(this.done)return!1;if(this.#i.signal?.aborted)return this.#l=!0,!1;const m=A(),{chunkMs:c,chunkRows:a}=this.#i,u=this.#e.length;do{const h=Math.min(this.#s+a,u);this.#n.append(this.#e.slice(this.#s,h)),this.#f(this.#s,h),this.#s=h,this.#r.reset(),this.#h(!1)}while(this.#s<u&&A()-m<c);return this.#o+=A()-m,this.#i.onProgress?.({loaded:this.#s,total:u}),this.#s>=u?(this.#h(!0),this.#a=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(m=>({id:m.spec.id,kind:m.kind,nullable:m.nullable,read:m.read,dictionary:m.spec.dictionary})),decisions:this.#t.map(m=>({id:m.spec.id,kind:m.kind,nullable:m.nullable,inferred:m.inferred,distinct:m.candidate||m.change?this.#d(m):null,change:m.change,reason:m.reason})),count:this.#n.count,elapsed:this.#o,cancelled:this.#l}}#u(m,c){const a=this.#e,u=Math.min(this.#i.sampleSize,a.length),h=this.#i.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 d=this.#r.readers.get(y.id)??($(y.read)?y.read:F(y.field||y.id)),f=new t(y,d);if(y.kind)f.kind=y.kind,f.reason="declared by the caller";else if(y.dictionary)f.kind=y.multi?"multi":"dictionary",f.reason="value table supplied (lookup column)";else{const w=[];for(let P=0;P<u&&w.length<this.#i.sampleSize;P++){const G=d(a[P]);G!=null&&w.push(G)}f.inferred=!0;const k=l(w,{multi:y.multi});if(k==="text"){const P=new Set(w).size;f.kind=g(P,w.length,h),f.candidate=this.#c,f.reason=`sampled ${P} distinct in ${w.length}`}else f.kind=k,f.reason=`inferred from ${w.length} sampled values`,k==="object"&&w.length&&L(`ingest.mixed.${y.id}`,`column "${y.id}" holds mixed or unrecognised value types; storing as an object array. Declare a type to avoid this.`);f.kind==="object"&&f.candidate&&(f.distinct=new Set(w))}this.#t.push(f)}}#f(m,c){const a=this.#e;for(const u of this.#t){if(!u.candidate||!u.distinct)continue;const h=u.distinct;for(let p=m;p<c;p++){const y=u.read(a[p]);y!=null&&h.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.#i.dictionaryRatio,a=this.#e.length;for(const u of this.#t){if(!u.candidate)continue;const h=this.#d(u);if(u.kind==="dictionary"&&h>=c*a){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=`${h} distinct values is at or above ${c*100}% of ${a} rows`;continue}if(u.kind==="object"&&h>=c*a){u.candidate=!1,u.distinct=null,u.reason=`${h} distinct values is at or above ${c*100}% of ${a} rows`;continue}m&&u.kind==="object"&&h<c*a&&(this.#n.convert(u.spec.id,"dictionary"),u.kind="dictionary",u.change=u.change==="demoted"?null:"promoted",u.reason=`${h} distinct values is below ${c*100}% of ${a} rows`,u.distinct=null),m&&(u.candidate=!1)}}}async function r(n,m={},c={}){const a=new s(n,m,c),u=c.scheduler?.frame??Y;for(;a.slice();)await new Promise(h=>{u(h)});return a.result()}function i(n,m={},c={}){const a=new s(n,m,{...c,chunkMs:1/0});for(;a.slice(););return a.result()}}),Ve("packages/core/src/store/columnpack.js",function(e,D){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return g}});const A=D("packages/core/src/internal/paths.js").pathGetter,Y=D("packages/core/src/store/ingest.js"),I=Y.inferKind,L=Y.decideText,Q=Y.INGEST_DEFAULTS,$=D("packages/core/src/store/columnstore.js").toFloat,X=new Set(["float64","int32","bitset","dictionary","object","multi"]);function F(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&&!X.has(t.kind))return!1;return!0}function j(o){const t=$(o);return Number.isFinite(t)?t|0:0}function v(o){return o==null?[]:Array.isArray(o)?o:[o]}function b(o,t,s,r){if(o.kind)return o.kind;const i=[];for(let c=0;c<t.length&&i.length<Q.sampleSize;c++){const a=t[c];a!=null&&i.push(a)}const n=I(i,{multi:o.multi});if(n!=="text")return n;const m=new Set(i).size;return L(m,i.length,r)}function l(o,t,s={}){const r=t.length|0,i=s.dictionaryRatio??Q.dictionaryRatio,n=[];for(const m of o){const c=A(m.field||m.id),a=m.nullable!==!1,u=new Array(r);for(let f=0;f<r;f++){const w=c(t[f]);u[f]=w===void 0?null:w}const h=b(m,u,r,i),p=a?new Uint8Array(r+7>>3):null,y=f=>{p&&(p[f>>3]|=1<<(f&7))};let d;switch(h){case"float64":{const f=new Float64Array(r);for(let w=0;w<r;w++){const k=u[w],P=k===null;P||y(w),f[w]=P?NaN:$(k)}d={id:m.id,kind:h,nullable:a,values:f,presence:p,offsets:null,table:null};break}case"int32":{const f=new Int32Array(r);for(let w=0;w<r;w++){const k=u[w],P=k===null;P||y(w),f[w]=P?0:j(k)}d={id:m.id,kind:h,nullable:a,values:f,presence:p,offsets:null,table:null};break}case"bitset":{const f=new Uint8Array(r+7>>3);for(let w=0;w<r;w++){const k=u[w],P=k===null;P||y(w),!P&&k&&(f[w>>3]|=1<<(w&7))}d={id:m.id,kind:h,nullable:a,values:f,presence:p,offsets:null,table:null};break}case"dictionary":{const f=new Uint32Array(r),w=[],k=new Map;for(let P=0;P<r;P++){const G=u[P];if(G===null){f[P]=0;continue}y(P);let K=k.get(G);K===void 0&&(K=w.length,w.push(G),k.set(G,K)),f[P]=K}d={id:m.id,kind:h,nullable:a,values:f,presence:p,offsets:null,table:w};break}case"multi":{const f=[],w=new Map,k=new Uint32Array(r+1),P=[];for(let G=0;G<r;G++){const K=u[G];k[G]=P.length,K===null||y(G);const B=v(K);for(let E=0;E<B.length;E++){const S=B[E];let C=w.get(S);C===void 0&&(C=f.length,f.push(S),w.set(S,C)),P.push(C)}}k[r]=P.length,d={id:m.id,kind:h,nullable:a,values:Int32Array.from(P),presence:p,offsets:k,table:f};break}default:{const f=new Array(r);for(let w=0;w<r;w++){const k=u[w];k!==null&&y(w),f[w]=k}d={id:m.id,kind:"object",nullable:a,values:f,presence:p,offsets:null,table:null};break}}n.push(d)}return{count:r,columns:n}}function g(o){const t=[];if(!o||!Array.isArray(o.columns))return t;const s=r=>{ArrayBuffer.isView(r)&&r.buffer&&!t.includes(r.buffer)&&t.push(r.buffer)};for(const r of o.columns)s(r.values),s(r.presence),s(r.offsets);return t}}),Ve("packages/core/src/source/stream.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_PROMOTE_BELOW",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"createStreamSource",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return C}});const A=D("packages/core/src/internal/lru.js").Lru,I=D("packages/core/src/internal/predicates.js").isFunction,L=D("packages/core/src/internal/schedule.js"),Q=L.now,H=L.nextFrame,$=L.cancelFrame,X=L.whenIdle,j=D("packages/core/src/internal/compare.js").defaultCompare,v=D("packages/core/src/internal/warn.js"),b=v.warnOnce,l=v.infoOnce,o=D("packages/core/src/internal/paths.js").getPath,t=D("packages/core/src/source/abort.js"),s=t.createAbortScope,r=t.isAbortError,i=D("packages/core/src/source/rows.js"),n=i.createRowFactory,m=i.lazyRowView,a=D("packages/core/src/source/gapbuffer.js").GapBuffer,h=D("packages/core/src/source/memory.js").createMemorySource,y=D("packages/core/src/source/filterwire.js").querySignature,f=D("packages/core/src/store/columnpack.js").isPortableSchema,w=25e4,k=Symbol("lattice.stream.storeBacked"),P=8,G=.1,K=1e3,q=50;function B(N){return Math.min(K,Math.max(q,Math.floor(N/4)))}function E(N){if(N instanceof Date)return N.getTime();if(typeof N=="number")return Number.isFinite(N)?N:NaN;if(typeof N=="string"){const O=N.trim();if(!O)return NaN;const T=Date.parse(O);return Number.isNaN(T)?Number(O):T}return NaN}function S(N,O){return new C(N,O)}class C{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#s=[];#i=null;#a;#l;#o=new Map;#c=s();#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;#C="";#S=0;#P=0;#E=0;#T=null;#M=1/0;#N=!1;#R=null;#I=null;#K=null;#Y=null;#x=!1;#U=0;#D=0;#X=!1;constructor(O,T){this.#e=O||{mode:"stream"},this.#t=T||{},this.#a=n(this.#t),this.#l=new A(4096),this.#C=this.#qe();const R=(this.#t.config||{}).ingest;this.#x=!!R&&R.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 x=Number(this.#e.poll);Number.isFinite(x)&&x>0&&(this.#Y=setInterval(()=>{this.#v||this.reload()},x),this.#Y&&I(this.#Y.unref)&&this.#Y.unref()),this.#_()}#V(){const O=Number(this.#e.maxAge);return Number.isFinite(O)&&O>0?O:0}#_(){const O=this.#V();if(!O)return;const T=this.#e.ageBy;I(T)?this.#I=T:typeof T=="string"&&T?this.#I=R=>o(R,T):this.#I=null,this.#T=[],this.#R=setInterval(()=>{this.#v||this.#W()&&(this.#Ee(),this.#H())},B(O)),this.#R&&I(this.#R.unref)&&this.#R.unref()}#W(){const O=this.#V();return!O||!this.#T?!1:this.#N?!0:this.#M<Date.now()-O*(1+G)}#ge(O,T){if(!this.#T)return;const R=this.#I?E(this.#I(T)):Date.now();this.#T[O]=R,Number.isNaN(R)||(R<this.#M&&(this.#M=R),R<Date.now()-this.#V()&&(this.#N=!0))}#ie(){return this.#Oe("groupBy",[]).length>0?!0:!!this.#Oe("pivotMode",!1)&&this.#Oe("pivotBy",[]).length>0}#ue(){if(this.#g||this.#v)return;const O=this.#ie();if(O&&!this.#b){this.#b=h({mode:"memory",rows:this.#n},this.#Me()),this.#O=!1;return}!O&&this.#b&&(this.#b.destroy(),this.#b=null)}#Me(){if(this.#y)return this.#y;const O=this,T={liveIndices:()=>O.#fe(),live:R=>O.#n[R]!==void 0,source:R=>O.#ee(R),get physical(){return O.#n.length}};return this.#x&&(T.column=R=>{const x=O.#t.store;return x&&I(x.column)?x.column(R):void 0}),this.#y=Object.create(this.#t,{store:{value:T,enumerable:!0,configurable:!0}}),this.#y}#fe(){const O=new Uint32Array(this.#n.length);let T=0;for(let R=0;R<this.#n.length;R++)this.#n[R]!==void 0&&(O[T++]=R);return O.subarray(0,T)}#oe(){return this.#g?this.#g:this.#b?(this.#O&&(this.#O=!1,this.#b.setRows(this.#n)),this.#b):null}invalidate(O="filter"){if(this.#g){this.#g.invalidate(O);return}this.#ue(),this.#b&&this.#b.invalidate(O),(O==="filter"||O==="sort")&&this.#Te()}count(){const O=this.#oe();return O?O.count():this.#r?this.#r.length:this.#S}matchCount(){const O=this.#oe();return O&&I(O.matchCount)?O.matchCount():this.#r?this.#r.length:this.#S}totalCount(){const O=this.#oe();return O&&I(O.totalCount)?O.totalCount():this.#S}unfilteredRows(){const O=this.#oe();if(O&&I(O.unfilteredRows))return O.unfilteredRows();const T=[];for(let R=0;R<this.#n.length;R++){if(!this.#n[R])continue;const x=this.#je(R);x&&T.push(x)}return T}at(O){const T=this.#oe();if(T)return T.at(O);if(O<0||O>=this.count())return;const R=this.#r?this.#r.at(O):O,x=this.#je(R);return x.index=O,x}byKey(O){const T=this.#oe();if(T)return T.byKey(O);const R=this.#o.get(O);return R===void 0?void 0:this.#je(R)}leavesOf(O){const T=this.#oe();return T&&I(T.leavesOf)?T.leavesOf(O):[]}loaded(O){return O>=0&&O<this.count()}hint(O,T){if(this.#g){this.#g.hint(O,T);return}this.#Ue(),this.#p=Math.max(0,Math.floor(O))}#Ue(){this.#v||this.#qe()===this.#C||this.reload()}display(){const O=this.#oe();return O?O.display():m(()=>this.count(),T=>this.at(T))}apply(O){if(this.#g)return this.#g.apply(O);const T={added:[],updated:[],removed:[]};if(!O)return T;if(O.update){let R=!1;for(const x of O.update){const U=this.#o.get(this.#a.keyOf(x,-1));if(U===void 0)continue;const V=this.#Se(U);this.#x?this.#Le(U,x):this.#n[U]=x,this.#l.delete(U),this.#ye(U,V),this.#T&&(this.#ge(U,x),R=!0),this.#O=!0,T.updated.push(this.#je(U))}R&&this.#Ee()}if(O.add&&O.add.length){const R=this.#ne(O.add);for(const x of R)T.added.push(this.#je(x))}return O.remove&&O.remove.length&&b("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#H(),T}reload(O){this.#c.abortAll("reload"),this.#Ye(),this.#b&&(this.#b.destroy(),this.#b=null),this.#O=!1,this.#n=[],this.#r=null,this.#o.clear(),this.#l.clear(),this.#g=null,this.#S=0,this.#P=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.#C=this.#qe(),this.#Ce("model:changed",{reason:"reload"}),this.start()}destroy(){this.#v=!0,this.#Y!==null&&(clearInterval(this.#Y),this.#Y=null),this.#R!==null&&(clearInterval(this.#R),this.#R=null),this.#T=null,this.#c.abortAll("destroyed"),this.#Ye(),this.#f!==null&&(this.#ke(this.#f),this.#f=null),this.#b&&(this.#b.destroy(),this.#b=null),this.#g&&this.#g.destroy(),this.#n=[],this.#r=null,this.#o.clear(),this.#l.clear()}async start(){if(this.#A||this.#v||!I(this.#e.open))return;this.#A=!0;const O=this.#c.begin("stream");this.#Te(),this.#ue();let T;try{T=this.#e.open({sort:this.#Oe("sort",[]),filters:this.#Oe("filters",null),quick:this.#Oe("quick","")||void 0,context:this.#Oe("context",null),signal:O.signal})}catch(x){this.#Ce("source:error",{error:x});return}const R=I(T[Symbol.asyncIterator])?T[Symbol.asyncIterator]():T[Symbol.iterator]();this.#K=R;try{for(;;){const x=await R.next();if(!O.current||this.#v)return;if(x.done){this.#$();return}if(await this.#xe(x.value,O),!O.current||this.#v)return;if(x.value&&x.value.done){this.#$();return}if(await this.#he(),!O.current||this.#v)return}}catch(x){if(r(x))return;this.#Ce("source:error",{error:x})}finally{O.settle()}}progress(){return{loaded:this.#u.loaded,estimated:this.#u.estimated,done:this.#w,live:this.#S,evicted:this.#P}}promoted(){return this.#g!==null}memorySource(){return this.#g}invalidateHandles(){const O=this.#oe();O&&(I(O.invalidateHandles)&&O.invalidateHandles(),I(O.invalidate)&&O.invalidate("sort"))}renderCount(){return this.#d}ingestStats(){return{worker:this.#U,inline:this.#D,storeBacked:this.#x}}#xe(O,T){if(!O)return;const R=O.rows;if(R&&R.length&&this.#ae(R))return this.#le(O,T);const x=Q();R&&R.length&&(this.#ne(R),this.#D++),this.#Pe(O),this.#h+=Q()-x,this.#H()}#Pe(O){this.#u.loaded=O.progress&&typeof O.progress.loaded=="number"?O.progress.loaded:this.#n.length,O.progress&&typeof O.progress.estimated=="number"&&(this.#u.estimated=O.progress.estimated)}#ae(O){if(this.#X||this.#g)return!1;const T=this.#Z();if(!T)return!1;const R=this.#t.store;if(!R||!I(R.appendPacked))return!1;const x=this.#G();return!x||!f(x)?(this.#X=!0,l("source.stream.ingest-worker","stream ingest.useWorker is on but a column reads through a closure (a computed or date column); columnizing on the main thread instead."),!1):O.length<T.threshold?!1:!this.#Ae(O)}#Ae(O){if(!this.#a.keyed)return!1;const T=new Set;for(let R=0;R<O.length;R++){const x=this.#a.keyOf(O[R],this.#n.length+R);if(x!=null){if(T.has(x)||this.#o.has(x))return!0;T.add(x)}}return!1}async#le(O,T){const R=O.rows,x=this.#Z(),U=this.#G();let V;try{V=await x.columnize(U,R,{key:"ingest:stream",signal:T&&T.signal})}catch(Z){if(r(Z)||(b("source.stream.columnize","worker columnization failed; columnizing on the main thread",Z),this.#X=!0,T&&(!T.current||this.#v)))return;this.#ne(R),this.#D++,this.#Pe(O),this.#H();return}if(T&&(!T.current||this.#v))return;const J=this.#t.store,_=this.#x?void 0:R,{from:ee}=J.appendPacked(V,_),W=V.count|0;for(let Z=0;Z<W;Z++){const ne=ee+Z,ie=R[Z],ce=this.#a.keyed?this.#a.keyOf(ie,ne):null;if(this.#n[ne]=this.#x?k:ie,this.#S++,this.#ge(ne,ie),ce!==null&&this.#o.set(ce,ne),!this.#r||!this.#we(ne))continue;const me=this.#de(ne);this.#r.insert(me,ne),me<=this.#p&&this.#m++}this.#O=!0,this.#Ee(),this.#U++,this.#Pe(O),this.#H()}#Z(){const O=this.#t.ingestWorker;return I(O)?O():null}#G(){const O=this.#t.storeSchema;return I(O)?O():null}#ne(O){const T=[],R=this.#t.store,x=new Array(O.length),U=[],V=new Set;for(let _=0;_<O.length;_++){const ee=this.#a.keyed?this.#a.keyOf(O[_],this.#n.length+U.length):null;x[_]=ee,!(ee!==null&&(this.#o.has(ee)||V.has(ee)))&&(ee!==null&&V.add(ee),U.push(O[_]))}let J=U.length&&R&&I(R.append)?R.append(U).from:this.#n.length;for(let _=0;_<O.length;_++){const ee=O[_],W=x[_];if(W!==null&&this.#o.has(W)){const ie=this.#o.get(W),ce=this.#Se(ie);this.#x||(this.#n[ie]=ee,R&&I(R.setSource)&&R.setSource(ie,ee)),this.#Le(ie,ee),this.#l.delete(ie),this.#ge(ie,ee),this.#ye(ie,ce);continue}const Z=J++;if(this.#n[Z]=this.#x?k:ee,this.#S++,this.#ge(Z,ee),W!==null&&this.#o.set(W,Z),T.push(Z),!this.#r||!this.#we(Z))continue;const ne=this.#de(Z);this.#r.insert(ne,Z),ne<=this.#p&&this.#m++}return this.#O=!0,this.#Ee(),T}#B(O){const T=this.#n[O];let R=!1;if(this.#r){const J=this.#be(O);J>=0&&J<=this.#p&&(R=!0)}else O<=this.#p&&(R=!0);const x=T===k?this.#ee(O):T,U=this.#a.keyed?this.#a.keyOf(x,O):null;U!==null&&this.#o.get(U)===O&&this.#o.delete(U),this.#n[O]=void 0,this.#T&&(this.#T[O]=NaN),this.#l.delete(O);const V=this.#t.store;return V&&I(V.remove)&&V.remove(O),this.#S--,R}#Ee(){let O=0,T=0;const R=this.#pe();O+=R.dropped,T+=R.aboveAnchor;const x=this.#re();O+=x.dropped,T+=x.aboveAnchor,O&&(this.#O=!0,this.#P+=O,this.#Te(),this.#m-=T,this.#Ce("stream:evicted",{evicted:O,total:this.#P,live:this.#S}))}#re(){const O=this.#e.maxRows;if(!Number.isFinite(O)||O<=0||this.#S<=O)return{dropped:0,aboveAnchor:0};const T=Math.max(1,Math.floor(O*(1-G)));let R=0,x=0;for(;this.#S>T&&this.#E<this.#n.length;){const U=this.#E++;this.#n[U]!==void 0&&(this.#B(U)&&x++,R++)}return{dropped:R,aboveAnchor:x}}#pe(){const O=this.#V();if(!O||!this.#T||!this.#W())return{dropped:0,aboveAnchor:0};const T=Date.now()-O;let R=0,x=0,U=1/0;for(let V=this.#E;V<this.#n.length;V++){if(this.#n[V]===void 0)continue;const J=this.#T[V];if(!(Number.isNaN(J)||J===void 0)){if(J>=T){J<U&&(U=J);continue}this.#B(V)&&x++,R++}}for(this.#M=U,this.#N=!1;this.#E<this.#n.length&&this.#n[this.#E]===void 0;)this.#E++;return{dropped:R,aboveAnchor:x}}#be(O){if(!this.#r)return O;for(let T=0;T<this.#r.length;T++)if(this.#r.at(T)===O)return T;return-1}#Te(){this.#s=this.#Oe("sort",[]),this.#i=this.#Oe("filters",null);const O=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#V()>0,T=this.#Oe("where",null),R=(this.#t.config||{}).hostFilter,x=!!(T&&T.active)||!!(R&&I(R.active)&&R.active());if(!(O||this.#s.length>0||!!this.#i||!!this.#Oe("quick","")||x)){this.#r=null;return}this.#r=new a(Math.max(64,this.#n.length+64));for(let V=0;V<this.#n.length;V++)this.#n[V]!==void 0&&this.#we(V)&&this.#r.insert(this.#de(V),V)}#we(O){const T=this.#ee(O);if(this.#i&&!this.#ve(this.#i,T))return!1;const R=String(this.#Oe("quick","")||"").toLowerCase();if(R&&!this.#k(T).includes(R))return!1;const x=(this.#t.config||{}).hostFilter;if(x&&I(x.active)&&x.active()&&!x.passes(this.#je(O)))return!1;const U=this.#Oe("where",null);if(U&&U.active){const V=this.#je(O);if(!U.passes(V.data,V.key))return!1}return!0}#ve(O,T){if(!O)return!0;const R=O;if(Array.isArray(R.conditions))return R.op==="or"?R.conditions.some(V=>this.#ve(V,T)):R.op==="not"?!R.conditions.some(V=>this.#ve(V,T)):R.conditions.every(V=>this.#ve(V,T));const x=O,U=(this.#t.compute||{}).testValue;return I(U)?!!U(this.#Ve(T,x.col),x,(this.#t.config||{}).locale):(b("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#Se(O){if(!this.#r)return-1;if(!this.#s.length)return this.#be(O);let T=0,R=this.#r.length;for(;T<R;){const x=T+R>>>1;this.#Q(this.#r.at(x),O)<0?T=x+1:R=x}for(let x=T;x<this.#r.length;x++){const U=this.#r.at(x);if(U===O)return x;if(this.#Q(U,O)>0)break}return this.#be(O)}#ye(O,T){if(!this.#r||!this.#s.length)return;const R=this.#we(O);if(T>=0&&this.#r.at(T)===O)this.#r.removeAt(T),T<=this.#p&&this.#m--;else if(T>=0)return;if(!R)return;const x=this.#de(O);this.#r.insert(x,O),x<=this.#p&&this.#m++}#de(O){if(!this.#r||!this.#s.length)return this.#r?this.#r.length:0;let T=0,R=this.#r.length;for(;T<R;){const x=T+R>>>1;this.#Q(O,this.#r.at(x))<0?R=x:T=x+1}return T}#Q(O,T){const R=this.#ee(O),x=this.#ee(T);for(const U of this.#s){const V=this.#Fe(U.col),J=this.#Ve(R,U.col),_=this.#Ve(x,U.col),W=(V&&V.value&&I(V.value.compare)?V.value.compare:j)(J,_);if(W!==0)return U.dir==="desc"?-W:W}return 0}#$(){this.#w=!0,this.#u.loaded=this.#u.loaded||this.#n.length;const O=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:w;!this.#x&&this.#n.length<O&&(this.#g=h({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.#Ce("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:O})}#H(){this.#f!==null||this.#v||(this.#f=this.#F(()=>{this.#f=null,this.#d++;const O=this.#m;this.#m=0,this.#h=0,this.#Ce("stream:chunk",{loaded:this.#u.loaded,estimated:this.#u.estimated,count:this.count(),renders:this.#d}),this.#Ce("model:changed",{reason:"stream",shiftAboveViewport:O,anchor:this.#p}),this.#Ce("rows:changed",{companion:!0,reason:"stream"})}))}#he(){return this.#d===0||this.#h<this.#se()?Promise.resolve():(this.#h=0,new Promise(O=>{const T=(this.#t.scheduler||{}).idle;I(T)?T(()=>O()):X(()=>O())}))}#se(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:P}#F(O){const T=this.#t.scheduler||{};return I(T.frame)?T.frame(O):H(O)}#ke(O){const T=this.#t.scheduler||{};I(T.cancel)?T.cancel(O):$(O)}#ee(O){const T=this.#n[O];if(T!==void 0&&T!==k)return T;if(T===void 0)return;const R=this.#t.store;return R&&I(R.source)?R.source(O):void 0}#Le(O,T){const R=this.#t.store;if(!R||!I(R.set))return;const x=this.#G();if(Array.isArray(x))for(const U of x){if(!U||!U.id)continue;const V=I(U.read)?U.read:J=>o(J,U.field||U.id);R.set(U.id,O,V(T))}}#je(O){let T=this.#l.get(O);return T||(T=this.#a.leaf(this.#ee(O),O),this.#l.set(O,T)),T}#Ve(O,T){const R=this.#Fe(T);return R&&I(R.getValue)?R.getValue(O):O?.[T]}#k(O){const T=this.#t.columns,R=T&&I(T.all)?T.all():[],x=[];for(const U of R){const V=I(U.getValue)?U.getValue(O):void 0;V!=null&&V!==""&&x.push(String(V))}return x.join(" ").toLowerCase()}#Fe(O){const T=this.#t.columns;return T&&I(T.get)?T.get(O):void 0}#Ye(){const O=this.#K;if(this.#K=null,O&&I(O.return))try{O.return()}catch{}}#qe(){return y({context:this.#Oe("context",null)})}#Oe(O,T){const R=this.#t.state;if(R&&I(R[O])){const x=R[O]();return x??T}return T}#Ce(O,T){const R=this.#t.emit;I(R)&&R(O,T)}}}),Ve("packages/core/src/source/url.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return b}});const A=D("packages/core/src/internal/warn.js").warnOnce,Y=D("packages/core/src/internal/predicates.js"),I=Y.isObject,L=Y.isFunction,H=D("packages/core/src/internal/paths.js").getPath,X=D("packages/core/src/source/abort.js").isAbortError,F=500,j=new Set(["application/x-ndjson","application/ndjson","application/jsonlines","application/jsonl","application/x-jsonlines","text/x-ndjson"]),v=Symbol("lattice.url.skip");function b(p,y={}){const d=I(y)?y:{},f=L(d.fetch)?d.fetch:typeof globalThis<"u"&&L(globalThis.fetch)?globalThis.fetch:null,w=d.format==="json"||d.format==="ndjson"?d.format:void 0,k=typeof d.rowsPath=="string"&&d.rowsPath?d.rowsPath:void 0,P=L(d.map)?d.map:void 0,G=I(d.headers)?d.headers:void 0,K=Number.isFinite(d.batchSize)&&d.batchSize>0?Math.floor(d.batchSize):F,q=d.lenient===!0,B=Number.isFinite(d.poll)&&d.poll>0?Math.floor(d.poll):void 0,E=typeof p=="string"&&p.length>0;E||A("source.url.url","createUrlSource needs a URL string; the grid will stay empty.");async function*S(N={}){if(!E)return;if(!f)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const O=N&&N.signal;let T;try{T=await f(p,G?{signal:O,headers:G}:{signal:O})}catch(U){throw X(U)?U:new Error(`[lattice] createUrlSource: request to ${p} failed — ${U&&U.message||U}`)}if(!T||!T.ok){const U=T?T.status:"no response";throw new Error(`[lattice] createUrlSource: ${U} for ${p}`)}const R=l(p,w,T),x=T.body&&L(T.body.getReader)?T.body.getReader():null;try{if(!x){const J=await T.text();(R||t(J,p))==="ndjson"?yield*c(null,null,J,0,T,p,K,q):yield*m(J,p,k,P);return}const U=new TextDecoder("utf-8");if(R==="json"){yield*m(await n(x,U,""),p,k,P);return}if(R==="ndjson"){yield*c(x,U,"",0,T,p,K,q);return}const V=await s(x,U,p);V.format==="json"?yield*m(await n(x,U,V.seed),p,k,P):yield*c(x,U,V.seed,V.bytes,T,p,K,q)}finally{if(x&&L(x.cancel))try{await x.cancel()}catch{}}}const C={mode:"stream",open:S,autoStart:d.autoStart!==!1};return B!==void 0&&(C.poll=B),Number.isFinite(d.maxRows)&&(C.maxRows=d.maxRows),Number.isFinite(d.maxAge)&&(C.maxAge=d.maxAge),(typeof d.ageBy=="string"||L(d.ageBy))&&(C.ageBy=d.ageBy),Number.isFinite(d.coalesceMs)&&(C.coalesceMs=d.coalesceMs),Number.isFinite(d.promoteToMemoryBelow)&&(C.promoteToMemoryBelow=d.promoteToMemoryBelow),C}function l(p,y,d){if(y)return y;const f=g(p);if(f)return f;const w=d&&d.headers&&L(d.headers.get)?d.headers.get("content-type"):null;return o(w)}function g(p){const y=String(p).split(/[?#]/)[0].toLowerCase();if(y.endsWith(".ndjson")||y.endsWith(".jsonl"))return"ndjson";if(y.endsWith(".json"))return"json"}function o(p){if(!p)return;const y=p.split(";")[0].trim().toLowerCase();if(j.has(y))return"ndjson";if(y==="application/json"||y==="text/json"||y.endsWith("+json"))return"json"}function t(p,y){const d=p.replace(/^\s+/,""),f=r(d);if(f==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${y} — pass opts.format: 'json' | 'ndjson'.`);return f}async function s(p,y,d){let f="",w=0;for(;;){const{value:P,done:G}=await p.read();if(P&&(w+=P.byteLength,f+=y.decode(P,{stream:!0})),G){f+=y.decode();break}const K=f.replace(/^\s+/,"");if(K){if(K[0]==="[")return{format:"json",seed:f,bytes:w};if(K[0]!=="{"||f.indexOf(`
|
|
8
8
|
`)!==-1)break}}const k=r(f.replace(/^\s+/,""));if(k==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${d} — pass opts.format: 'json' | 'ndjson'.`);return{format:k,seed:f,bytes:w}}function r(p){if(!p||p[0]==="[")return"json";if(p[0]!=="{")return"error";const y=p.indexOf(`
|
|
9
9
|
`);if(y===-1)return"json";let d=p.slice(0,y);return d.endsWith("\r")&&(d=d.slice(0,-1)),i(d)?"ndjson":"json"}function i(p){try{return JSON.parse(p),!0}catch{return!1}}async function n(p,y,d){let f=d;for(;;){const{value:w,done:k}=await p.read();if(w&&(f+=y.decode(w,{stream:!0})),k)break}return f+=y.decode(),f}function*m(p,y,d,f){let w;try{w=JSON.parse(p)}catch(P){throw new Error(`[lattice] createUrlSource: ${y} is not valid JSON — ${P.message}`)}let k=d!==void 0?H(w,d):w;if(f&&(k=f(k)),!Array.isArray(k)){const P=d!==void 0||f?"":"; 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:k,progress:{loaded:k.length,estimated:k.length}}}async function*c(p,y,d,f,w,k,P,G){const K=h(w);let q=d||"",B=f||0,E=0,S=0,C=[];function*N(){let T;for(;(T=q.indexOf(`
|
|
10
10
|
`))!==-1;){const R=q.slice(0,T);q=q.slice(T+1),S++;const x=a(R,S,k,G);x!==v&&(C.push(x),C.length>=P&&(E+=C.length,yield u(C,E,K,B),C=[]))}}if(p){for(;;){const{value:T,done:R}=await p.read();if(T&&(B+=T.byteLength,q+=y.decode(T,{stream:!0}),yield*N()),R)break}q+=y.decode()}yield*N(),S++;const O=a(q,S,k,G);O!==v&&C.push(O),C.length&&(E+=C.length,yield u(C,E,K,B))}function a(p,y,d,f){let w=p;if(w.endsWith("\r")&&(w=w.slice(0,-1)),!w.trim())return v;try{return JSON.parse(w)}catch(k){if(f)return A(`source.url.badline.${d}`,`skipping a malformed NDJSON line (line ${y}) from ${d} — ${k.message}`),v;throw new Error(`[lattice] createUrlSource: malformed NDJSON at line ${y} of ${d} — ${k.message}`)}}function u(p,y,d,f){const w=d&&f>0&&y>0?Math.max(y,Math.round(d/(f/y))):void 0;return{rows:p,progress:{loaded:y,estimated:w}}}function h(p){const y=p&&p.headers&&L(p.headers.get)?p.headers.get("content-length"):null,d=y!=null?Number(y):NaN;return Number.isFinite(d)&&d>0?d:void 0}}),Ve("packages/core/src/source/derive.js",function(e,D){"use strict";Object.defineProperty(e,"FOLLOW_MODES",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"BUCKETS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"DERIVED_ROW_KEY",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"DERIVED_SOURCE_KEY",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"UNION_KEY_SEP",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"readPath",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"unnest",{enumerable:!0,get:function(){return v}}),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 r}}),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 a}}),Object.defineProperty(e,"normalizeUnionSource",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"namespaceUnionKeys",{enumerable:!0,get:function(){return h}}),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 d}}),Object.defineProperty(e,"joinOne",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"joinKeyOf",{enumerable:!0,get:function(){return w}});const re=D("packages/core/src/internal/predicates.js"),A=re.isFunction,Y=re.isObject,L=D("packages/core/src/compute/total.js").TOTAL_FNS,Q=Object.freeze(["filtered","all","selected","grouped"]),H=Object.freeze(["day","week","month","quarter","year"]),$="__key",X="__source",F="";function j(k,P){if(!Y(k)||typeof P!="string")return;if(!P.includes("."))return k[P];let G=k;for(const K of P.split(".")){if(!Y(G))return;G=G[K]}return G}function v(k,P){const G=[];for(const K of k){const q=j(K,P);if(!(!Array.isArray(q)||!q.length))for(const B of q)G.push({...K,[P]:B})}return G}function b(k,P){const G=k instanceof Date?k:new Date(k),K=G.getTime();if(!Number.isFinite(K))return null;const q=G.getUTCFullYear(),B=G.getUTCMonth(),E=G.getUTCDate(),S=C=>C.toISOString().slice(0,10);switch(P){case"year":return S(new Date(Date.UTC(q,0,1)));case"quarter":return S(new Date(Date.UTC(q,Math.floor(B/3)*3,1)));case"month":return S(new Date(Date.UTC(q,B,1)));case"week":{const C=(G.getUTCDay()+6)%7;return S(new Date(Date.UTC(q,B,E-C)))}default:return S(new Date(Date.UTC(q,B,E)))}}function l(k,P,G){const K=P.map(q=>G&&G.of===q?b(j(k,q),G.by):j(k,q));return{key:K.map(q=>q==null?"\0":String(q)).join(""),values:K}}function g(k,P){const G=L[P];return G?G({get:K=>k[K]},s(k.length)):null}function o(k,P){return!P||typeof P.of!="string"||P.of===""||k&&k.includes(P.of)?k:[P.of,...k||[]]}function t(k,P){const G={},K=s(k.length);for(const[q,B]of Object.entries(P)){const E=B.fn||"count",S=L[E];if(!S){G[q]=null;continue}const C=B.of?k.map(N=>j(N,B.of)):[];G[q]=S({get:N=>C[N]},K)}return G}const s=(()=>{const k=new Map;return P=>{let G=k.get(P);if(!G){G=new Uint32Array(P);for(let K=0;K<P;K++)G[K]=K;k.size<512&&k.set(P,G)}return G}})();function r(k,P,G){if(!Number.isFinite(P)||P<=0)return k;if(!G)return k.slice(0,P);const K=new Map,q=[];for(const B of k){const E=String(j(B,G)),S=K.get(E)||0;S>=P||(K.set(E,S+1),q.push(B))}return q}function i(k,P){const G=k.reduce((E,S)=>E+(Number(j(S,P.of))||0),0);if(!G)return k;const K=G*P.upTo;let q=0;const B=[];for(const E of k)if(B.push(E),q+=Number(j(E,P.of))||0,q>=K)break;return B}function n(k,P){return!Array.isArray(P)||!P.length?k:[...k].sort((G,K)=>{for(const q of P){const B=j(G,q.col),E=j(K,q.col);if(B===E)continue;return B==null?1:E==null?-1:((typeof B=="number"&&typeof E=="number"?B<E:String(B)<String(E))?-1:1)*(q.dir==="desc"?-1:1)}return 0})}function m(k,P,G){const K=P.groupBy?Array.isArray(P.groupBy)?P.groupBy:[P.groupBy]:null,q=Y(P.bucket)?P.bucket:null,B=o(K,q),E=new Map,S=new Map;if(!B)return{groups:E,rowGroup:S};for(const C of k){const{key:N,values:O}=l(C,B,q);let T=E.get(N);T||(T={values:O,rows:new Map},E.set(N,T));const R=G(C);T.rows.set(R,C),S.set(R,N)}return{groups:E,rowGroup:S}}function c(k,P,G=null,K=null){const q=P.groupBy?Array.isArray(P.groupBy)?P.groupBy:[P.groupBy]:null,B=Y(P.bucket)?P.bucket:null,E=o(q,B);let S=[...k.entries()].map(([C,N])=>{if(G&&K&&!K.has(C)){const T=G.get(C);if(T)return T}const O={[$]:C};return E.forEach((T,R)=>{O[T.includes(".")?T.split(".").pop():T]=N.values[R]}),Object.assign(O,t([...N.rows.values()],P.select||{})),G&&G.set(C,O),O});return S=n(S,P.sort),Y(P.cumulative)&&(S=i(S,P.cumulative)),r(S,P.limit,P.limitPer||null)}function a(k,P){const G=y(k,P),K=P.groupBy?Array.isArray(P.groupBy)?P.groupBy:[P.groupBy]:null,q=Y(P.bucket)?P.bucket:null,B=o(K,q);let E;if(!B)E=G.map((S,C)=>({...S,[$]:String(j(S,P.rowKey||"id")??C)}));else{const S=new Map;for(const C of G){const{key:N,values:O}=l(C,B,q);let T=S.get(N);T||(T={values:O,rows:[]},S.set(N,T)),T.rows.push(C)}E=[...S.entries()].map(([C,N])=>{const O={[$]:C};return B.forEach((T,R)=>{O[T.includes(".")?T.split(".").pop():T]=N.values[R]}),Object.assign(O,t(N.rows,P.select||{})),O})}return E=n(E,P.sort),Y(P.cumulative)&&(E=i(E,P.cumulative)),r(E,P.limit,P.limitPer||null)}function u(k,P){const K=Y(k)&&Y(k.grid)?k:{grid:k};return{grid:Y(K.grid)?K.grid:null,label:K.label!=null&&K.label!==""?String(K.label):String(P),follow:typeof K.follow=="string"?K.follow:void 0,map:A(K.map)?K.map:null}}function h(k){for(const P of k){const G=P[X];G!==void 0&&(P[$]=`${G}${F}${P[$]}`)}return k}function p(k,P){const G=P.on,K=Y(G)?String(G.left||G.right||""):String(G||""),q=Y(G)?String(G.right||G.left||""):String(G||"");if(!K||!q)return k;const B=P.index instanceof Map?P.index:d(Array.isArray(P.rows)?P.rows:[],q),E=Array.isArray(P.select)?P.select.map(String):null,S=P.prefix?String(P.prefix):"",C=String(P.type||"inner")==="left",N=[];for(const O of k){const T=j(O,K),R=T==null?void 0:B.get(String(T));if(!R){C&&N.push(O);continue}const x={...O},U=E||Object.keys(R);for(const V of U)!S&&V===K||(x[S?S+V:V]=j(R,V));N.push(x)}return N}function y(k,P){let G=Array.isArray(k)?k:[];return P.unnest&&(G=v(G,P.unnest)),Y(P.join)&&(Array.isArray(P.join.rows)||P.join.index instanceof Map)&&(G=p(G,P.join)),A(P.where)&&(G=G.filter(K=>!!P.where(K))),G}function d(k,P){const G=new Map;for(const K of k){const q=j(K,P);if(q==null)continue;const B=String(q);G.has(B)||G.set(B,K)}return G}function f(k,P){const G=P.on,K=Y(G)?String(G.left||G.right||""):String(G||""),q=Y(G)?String(G.right||G.left||""):String(G||"");if(!K||!q)return k;const B=P.index instanceof Map?P.index:new Map,E=j(k,K),S=E==null?void 0:B.get(String(E));if(!S)return String(P.type||"inner")==="left"?k:null;const C=Array.isArray(P.select)?P.select.map(String):null,N=P.prefix?String(P.prefix):"",O={...k};for(const T of C||Object.keys(S))!N&&T===K||(O[N?N+T:T]=j(S,T));return O}function w(k,P){const G=j(k,P);return G==null?null:String(G)}}),Ve("packages/core/src/source/derived.js",function(e,D){"use strict";Object.defineProperty(e,"IDLE_REFRESH_MS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"PROFILE_FIELDS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"ALERT_THRESHOLDS",{enumerable:!0,get:function(){return h}}),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 d}}),Object.defineProperty(e,"profileAlerts",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"DerivedSource",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"createDerivedSource",{enumerable:!0,get:function(){return q}});const re=D("packages/core/src/internal/predicates.js"),A=re.isFunction,Y=re.isObject,L=D("packages/core/src/internal/warn.js").warnOnce,H=D("packages/core/src/source/memory.js").MemorySource,X=D("packages/core/src/source/settle.js").isPipelineSettle,F=D("packages/core/src/source/derive.js"),j=F.derive,v=F.preGroup,b=F.groupRows,l=F.finishGroups,g=F.readPath,o=F.buildJoinIndex,t=F.joinOne,s=F.joinKeyOf,r=F.FOLLOW_MODES,i=F.DERIVED_ROW_KEY,n=F.DERIVED_SOURCE_KEY,m=F.normalizeUnionSource,c=F.namespaceUnionKeys,a=16,u=Object.freeze(["column","rows","present","missing","numeric","distinct","min","max","mean","median","q1","q3","iqr","stddev","outliers","alerts","alertCount"]),h=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"]),d=Object.freeze(["unnest","join","where","bucket","groupBy","select","sort","limit","limitPer","cumulative"]);function f(B,E={}){const S={...h,...Y(E)?E:{}},C=W=>typeof W=="number"&&Number.isFinite(W)?W:null,N=C(B.rows)??0,O=C(B.numeric)??0,T=C(B.missing)??0,R=C(B.distinct),x=C(B.mean),U=C(B.median),V=C(B.stddev),J=C(Array.isArray(B.outliers)?B.outliers.length:B.outliers),_=O>0,ee=[];return R===0?["empty"]:(R===1&&ee.push("constant"),N>0&&T/N>=S.missing&&ee.push("high-missing"),!_&&R!==null&&N>1&&R===N&&T===0?ee.push("unique"):R!==null&&N>0&&R/N>=S.cardinality&&ee.push("high-cardinality"),_&&x!==null&&U!==null&&V!==null&&V>0&&Math.abs(3*(x-U)/V)>=S.skew&&ee.push("skewed"),_&&J!==null&&J/O>=S.outliers&&ee.push("outliers"),ee)}class w extends H{#e=null;#t={};#n=[];#r=null;#s=!1;#i={};#a=!1;#l=null;#o=null;#c=!1;#u=null;#f=!1;#d=null;constructor(E,S){super({mode:"memory",rows:[]},S),this.#i=S||{},this.#t=Y(E)?E:{};const C=this.#t.from;if(Array.isArray(C)){if(this.#e=null,this.#d=this.#g(C),!this.#d.length){L("source.derived.from",'source.mode "derived" needs `from`: at least one grid to derive from.');return}this.#t.follow!==void 0&&L("source.derived.union.follow",'source.mode "derived": `follow` is ignored when `from` is a union of several grids (BACKLOG-0001045) — each entry carries its own `follow` instead.'),this.#t.crossFilter&&L("source.derived.union.crossfilter",'source.mode "derived": `crossFilter` is not supported when `from` is a union of several grids (BACKLOG-0001045) — it has no single target once there is more than one parent. Push a filter onto the individual source grid you mean instead.'),this.#t.statistics!==void 0&&(L("source.derived.union.statistics",'source.mode "derived": `statistics` is not supported when `from` is a union of several grids (BACKLOG-0001046) — a relational statistic reduces one grid\'s own columns, and a union has no single set of them. Derive the statistics of a single grid instead.'),this.#f=!0),this.#m(),this.#b(),this.refresh();return}if(this.#e=C||null,!this.#e){L("source.derived.from",'source.mode "derived" needs `from`: the grid to derive from.');return}this.#t.follow&&!r.includes(String(this.#t.follow))&&L(`source.derived.follow.${this.#t.follow}`,`unknown follow "${this.#t.follow}"; using "filtered". Known: ${r.join(", ")}.`),this.#h()||(this.#f=!0),this.#m(),this.#b(),this.refresh()}#h(){const E=this.#t.statistics;if(E===void 0)return!0;if(this.#t.profile!==void 0)return L("source.derived.producer.conflict",'source.mode "derived": `profile` and `statistics` are both terminal producers and cannot be used together — each replaces the pipeline with its own output builder. Declare one, or chain a second derived grid whose `from` is the first.'),!1;if(!Y(E))return L("source.derived.statistics.shape",`source.mode "derived": \`statistics\` needs an object naming the statistic, e.g. \`{ fn: 'correlation', columns: ['a', 'b'] }\`. Known fn: ${p.join(", ")}.`),!1;const S=String(E.fn||"");return p.includes(S)?this.#p(S,E):(L(`source.derived.statistics.fn.${S}`,`source.mode "derived": unknown \`statistics.fn\` "${S}". Known: ${p.join(", ")}. Every *single-column* statistic is reached through \`select\` instead, e.g. \`select: { p95: { of: 'amount', fn: 'p95' } }\`.`),!1)}#p(E,S){if(E==="correlation"){if((Array.isArray(S.columns)?S.columns.filter(Boolean):[]).length<2)return L("source.derived.statistics.columns","source.mode \"derived\": `statistics: { fn: 'correlation' }` needs `columns`: at least two column ids to correlate pairwise."),!1;const N=S.orient===void 0?"pairs":String(S.orient);return N!=="pairs"&&N!=="matrix"&&L(`source.derived.statistics.orient.${N}`,`source.mode "derived": unknown \`statistics.orient\` "${N}" for \`fn: 'correlation'\`; using "pairs". Known: pairs, matrix.`),!0}return E==="series"?!S.of||!S.by?(L("source.derived.statistics.series","source.mode \"derived\": `statistics: { fn: 'series' }` needs both `of` (the column to summarise) and `by` (the column that orders it). `by` is never guessed — kernels see rows in arrival order, which is not the grid's sort."),!1):!0:Y(S.with)?!0:(L("source.derived.statistics.with","source.mode \"derived\": `statistics: { fn: 'datasetVsDataset' }` needs `with`: the second grid to compare this one against."),!1)}#m(){const E=this.#t.statistics!==void 0?"statistics":this.#t.profile!==void 0?"profile":null;if(!E)return;const S=d.filter(C=>this.#t[C]!==void 0);S.length&&L(`source.derived.producer.ignored.${E}`,`source.mode "derived": \`${E}\` is a terminal producer and replaces the pipeline, so ${S.map(C=>`\`${C}\``).join(", ")} ${S.length>1?"are":"is"} ignored. Sort, filter or limit the derived grid itself, or chain a second derived grid whose \`from\` is this one.`)}#g(E){const S=this.#i&&this.#i.grid,C=new Set,N=[];return E.forEach((O,T)=>{const R=m(O,T);if(C.has(R.label)&&L(`source.derived.union.label.${R.label}`,`source.mode "derived": two union sources share the label "${R.label}"; give each a distinct \`label\` or __source/__key will not distinguish them.`),C.add(R.label),!R.grid){L(`source.derived.union.missing.${R.label}`,`source.mode "derived": union source "${R.label}" has no grid and was skipped.`),N.push(R);return}if(S&&A(R.grid.on)){const x=P(S,R.grid,[R.label]);if(x){L(`source.derived.union.cycle.${R.label}`,`source.mode "derived": union source "${R.label}" was refused — it derives from the grid being derived, directly or through a chain (${x.join(" → ")}). Remove it from \`from\`.`),N.push({...R,grid:null});return}}N.push(R)}),N}#b(){if(this.#d){this.#O(),this.#w();return}const E=this.#e;if(!E||!A(E.on))return;const S=String(this.#t.follow||"filtered"),C=["rows:changed"];(S==="filtered"||S==="grouped")&&C.push("filter:changed","model:changed"),S==="selected"&&C.push("selection:changed"),S==="grouped"&&C.push("column:grouped");for(const N of C){const O=T=>{N==="rows:changed"&&k(T)||N==="model:changed"&&!X(T)||this.schedule(N==="rows:changed"?T:null)};E.on(N,O),this.#n.push(()=>A(E.off)&&E.off(N,O))}this.#w(),this.#y()}#y(){const E=this.#t.statistics,S=Y(E)?E.with:null;if(!Y(S)||!A(S.on))return;const C=S;for(const N of["rows:changed","filter:changed","model:changed"]){const O=T=>{N==="rows:changed"&&k(T)||N==="model:changed"&&!X(T)||this.schedule(null)};C.on(N,O),this.#n.push(()=>A(C.off)&&C.off(N,O))}}#O(){for(const E of this.#d){const S=E.grid;if(!S||!A(S.on))continue;const C=r.includes(String(E.follow))?String(E.follow):"filtered",N=["rows:changed"];(C==="filtered"||C==="grouped")&&N.push("filter:changed","model:changed"),C==="selected"&&N.push("selection:changed"),C==="grouped"&&N.push("column:grouped");for(const O of N){const T=R=>{O==="rows:changed"&&k(R)||O==="model:changed"&&!X(R)||this.schedule(null)};S.on(O,T),this.#n.push(()=>A(S.off)&&S.off(O,T))}}}#w(){const E=this.#t.join,S=E&&E.with;if(!S||!A(S.on))return;const N=String(E.follow||"all")==="all"?["rows:changed"]:["rows:changed","filter:changed","model:changed"];for(const O of N){const T=R=>{O==="rows:changed"&&k(R)||O==="model:changed"&&!X(R)||this.schedule({partner:!0})};S.on(O,T),this.#n.push(()=>A(S.off)&&S.off(O,T))}}#A(){const E=this.#t.join;if(!E||!E.with)return null;const S=E.on,C=Y(S)?String(S.left||S.right||""):String(S||""),N=Y(S)?String(S.right||S.left||""):String(S||"");return C&&N?{left:C,right:N}:null}#v(){const E=this.#A();if(!E)return this.#u=null,null;const S=this.#u;if(this.#u=o(this.#P(),E.right),!S)return null;const C=this.#t.join||{},N=Array.isArray(C.select)?C.select.map(String):null,O=x=>x?(N||Object.keys(x)).map(V=>String(g(x,V))).join(""):null,T=new Set,R=new Set;for(const[x,U]of this.#u)O(U)!==O(S.get(x))&&(T.add(x),S.has(x)||R.add(x));for(const x of S.keys())this.#u.has(x)||T.add(x);return{affected:T,gained:R}}#C(E,S){const C=this.#l;if(!C||!C.leftByJoinKey)return null;const N=[];for(const O of E){const T=C.leftByJoinKey.get(O);if(T)for(const R of T){const x=C.rowData.get(R);x!==void 0&&N.push({key:R,data:x})}}return this.#M({updated:N,added:[],removed:[]},S)}#S(E,S){if(!this.#l||!this.#l.leftByJoinKey||E.unnest||E.where||String(E.follow||"filtered")==="grouped")return!1;const C=E.join||{};return String(C.type||"inner")==="left"?!0:S.size===0}#P(){const E=this.#t.join,S=E&&E.with;if(!S||!S.rows)return[];const C=[],N=O=>{O.group||C.push(G(O))};return String(E.follow||"all")==="filtered"&&A(S.rows.forEach)?S.rows.forEach(N):A(S.rows.forEachAll)&&S.rows.forEachAll(N),C}schedule(E){const S=this.#t.refresh===void 0?"idle":this.#t.refresh;if(S==="manual")return;if(S==="live"){this.refresh(E);return}const C=typeof S=="number"&&Number.isFinite(S)?S:a;if(this.#r){this.#c=!0;return}this.#c=!1,this.#r=setTimeout(()=>{this.#r=null,this.refresh(this.#c?null:E)},C)}refresh(E){if(!(this.#s||!this.#e&&!this.#d)){if(this.#a){L("source.derived.cycle","a derived grid is deriving from itself, directly or through a chain. The cycle was refused; check the `from` of each grid in the chain.");return}this.#a=!0;try{const S=this.#f?[]:this.#d?this.#t.profile?this.#U():this.#x():this.#t.statistics!==void 0?this.#ge():this.#t.profile?this.#fe():this.#E(E);this.setRows(S),this.invalidate("filter"),A(this.#i.emit)&&this.#i.emit("rows:changed",{derived:!0},"derived")}finally{this.#a=!1}}}#E(E){const C=Y(E)&&E.partner===!0?this.#v():null,N=this.#I();if(C&&this.#l){if(!C.affected.size)return l(this.#l.groups,N,this.#l.reduced,new Set);if(this.#S(N,C.gained)){const Z=this.#C(C.affected,N);if(Z)return l(this.#l.groups,N,this.#l.reduced,Z)}}const O=this.#T(N,E);if(O&&this.#l){const Z=this.#M(O,N);return l(this.#l.groups,N,this.#l.reduced,Z)}const T=v(this.#D(),N);if(this.#o=this.#R(),!N.groupBy)return this.#l=null,j(T,N);const R=this.#N(),{groups:x,rowGroup:U}=b(T,N,R),V=new Map;for(const[Z,ne]of U){const ie=x.get(ne);ie&&V.set(Z,ie.rows.get(Z))}const J=new Map,_=this.#A(),ee=new Map,W=new Map;if(_)for(const[Z,ne]of V){const ie=s(ne,_.left);if(ie===null)continue;ee.set(Z,ie);let ce=W.get(ie);ce||(ce=new Set,W.set(ie,ce)),ce.add(Z)}return this.#l={groups:x,rowGroup:U,rowData:V,reduced:J,leftJoinKey:ee,leftByJoinKey:W},l(x,N,J,null)}#T(E,S){if(!this.#l||!E.groupBy||E.unnest||E.where||String(E.follow||"filtered")==="grouped"||Y(E.join)&&E.join.with&&!(E.join.index instanceof Map)||!Y(S))return null;const C=Array.isArray(S.updated)?S.updated:null,N=Array.isArray(S.added)?S.added:null,O=Array.isArray(S.removed)?S.removed:null;if(!C&&!N&&!O)return null;const T=this.#o;if(T&&T.size&&String(E.follow||"filtered")!=="all"){if(S.edit===!0&&Array.isArray(S.columns)){for(const R of S.columns)if(T.has(String(R)))return null}for(const R of C||[]){const x=R&&R.key,U=x===void 0?void 0:this.#l.rowData.get(String(x)),V=G(R);for(const J of T)if(g(U,J)!==g(V,J))return null}}return{updated:C||[],added:N||[],removed:O||[]}}#M(E,S){const C=this.#l,N=this.#N(),O=new Set,T=Y(S.join)&&S.join.index instanceof Map?S.join:null,R=this.#A(),x=V=>{const J=C.rowGroup.get(V);if(J===void 0)return;O.add(J);const _=C.groups.get(J);if(_&&(_.rows.delete(V),_.rows.size||C.groups.delete(J)),C.rowGroup.delete(V),C.rowData.delete(V),C.leftJoinKey){const ee=C.leftJoinKey.get(V);if(ee!==void 0){const W=C.leftByJoinKey.get(ee);W&&(W.delete(V),W.size||C.leftByJoinKey.delete(ee)),C.leftJoinKey.delete(V)}}},U=V=>{const J=T?t(V,T):V;if(!J)return;const _=N(J),ee=b([J],S,N);for(const[W,Z]of ee.groups){let ne=C.groups.get(W);ne||(ne={values:Z.values,rows:new Map},C.groups.set(W,ne)),ne.rows.set(_,J),C.rowGroup.set(_,W),O.add(W)}if(C.rowData.set(_,J),R&&C.leftByJoinKey){const W=s(J,R.left);if(W!==null){C.leftJoinKey.set(_,W);let Z=C.leftByJoinKey.get(W);Z||(Z=new Set,C.leftByJoinKey.set(W,Z)),Z.add(_)}}};for(const V of E.removed)x(String(V));for(const V of E.updated)x(String(V.key)),U(G(V));for(const V of E.added)U(G(V));return O}#N(){const E=this.#e,S=E&&E.config&&E.config.rowKey||"id";return C=>String(g(C,typeof S=="string"?S:"id")??"")}#R(){const E=this.#e,S=E&&E.state&&A(E.state.get)?E.state.get():null,C=new Set,N=O=>{if(O){if(Array.isArray(O.conditions)){O.conditions.forEach(N);return}O.col&&C.add(String(O.col))}};return S&&N(S.filters),C}#I(){let E=this.#t;if(E.join&&E.join.with&&(this.#u||this.#v(),E={...E,join:{...E.join,index:this.#u}}),this.#d||String(E.follow||"filtered")!=="grouped")return E;const S=this.#e,C=S&&S.state&&A(S.state.get)?S.state.get():null,N=C&&Array.isArray(C.group)?C.group:[];return N.length?{...E,groupBy:[...N]}:E}#K(){const E=[];for(const S of this.#d)if(S.grid)try{const C=r.includes(String(S.follow))?String(S.follow):"filtered",N=this.#Y(S.grid,C);for(const O of N){const T=S.map?S.map(O):O;Y(T)&&E.push({...T,[n]:S.label})}}catch(C){L(`source.derived.union.failed.${S.label}`,`source.mode "derived": union source "${S.label}" failed to read (${C&&C.message?C.message:C}) and was skipped this pass.`)}return E}#Y(E,S){if(!E||!E.rows)return[];if(S==="all"){const N=[];return A(E.rows.forEachAll)&&E.rows.forEachAll(O=>{O.group||N.push(G(O))}),N}if(S==="selected")return(E.selection&&A(E.selection.rows)?E.selection.rows():[]).filter(Boolean).map(G);const C=[];return A(E.rows.forEach)&&E.rows.forEach(N=>{N.group||C.push(G(N))}),C}#x(){const E=this.#I(),S=this.#K(),C=j(S,E);return E.groupBy?C:c(C)}#U(){return L("source.derived.union.profile",'source.mode "derived": `profile` is not supported when `from` is a union of several grids (BACKLOG-0001045); profile a single grid instead.'),[]}#D(){const E=this.#e,S=String(this.#t.follow||"filtered");if(!E||!E.rows)return[];if(S==="all"){const O=[];return A(E.rows.forEachAll)&&E.rows.forEachAll(T=>{T.group||O.push(G(T))}),O}if(S==="selected")return(E.selection&&A(E.selection.rows)?E.selection.rows():[]).filter(Boolean).map(G);const C=this.#X(),N=[];return C&&this.#V().length&&A(E.rows.forEachExcept)?(E.rows.forEachExcept(C,O=>{O.group||N.push(G(O))}),N):(A(E.rows.forEach)&&E.rows.forEach(O=>{O.group||N.push(G(O))}),N)}#X(){const E=this.#t.crossFilter;if(!E||this.#d)return null;if(typeof E=="string")return E;if(E.col)return String(E.col);const S=this.#t.groupBy,C=Array.isArray(S)?S[0]:S;return C?String(C):null}#V(){const E=this.#X(),S=this.#e;if(!E||!S||!S.filters||!A(S.filters.get))return[];const C=K(S.filters.get(),E);return C?C.op==="in"&&Array.isArray(C.value)?C.value.map(String):C.op==="eq"&&C.value!==void 0?[String(C.value)]:[]:[]}#_(E){const S=this.#X(),C=this.#e;if(!S||!C||!C.filters||!A(C.filters.set))return;const N=this.#i.compute||{},O=A(C.filters.get)?C.filters.get():null,T=A(N.pruneColumn)?N.pruneColumn(O,S):null;if(!E.length){C.filters.set(T||null);return}const R=E.length===1?{col:S,op:"eq",value:E[0]}:{col:S,op:"in",value:E.slice()},x=T?T.conditions&&T.op?T.conditions:[T]:[];C.filters.set(x.length?{op:"and",conditions:[...x,R]}:R)}crossFilter(){const E=this;return{enabled(){return!!E.#X()},column(){return E.#X()},get(){return E.#V()},set(S){const C=S==null?[]:(Array.isArray(S)?S:[S]).map(N=>String(N));E.#_(C)},toggle(S){const C=String(S),N=E.#V(),T=N.indexOf(C)>=0?N.filter(R=>R!==C):[...N,C];E.#_(T)},clear(){E.#_([])}}}#W(E){const S=E&&E.rows;if(S&&A(S.matchCount)){const C=S.matchCount(),N=Number(C);if(C!==null&&Number.isFinite(N))return N}if(S&&A(S.count)){const C=Number(S.count());if(Number.isFinite(C))return C}return 0}#ge(){const E=this.#e,S=this.#t.statistics;if(!E||!E.statistics||!Y(S))return[];switch(String(S.fn)){case"correlation":return this.#ie(E,S);case"series":return this.#ue(E,S);case"datasetVsDataset":return this.#Me(E,S);default:return[]}}#ie(E,S){const C=S.columns.filter(Boolean).map(String),N=this.#W(E),O=(T,R)=>{const x=E.statistics.correlation(T,R);return typeof x=="number"&&Number.isFinite(x)?x:null};if(String(S.orient||"pairs")!=="matrix"){const T=[];for(let R=0;R<C.length;R++)for(let x=R+1;x<C.length;x++)T.push({[i]:`${C[R]}${C[x]}`,a:C[R],b:C[x],coefficient:O(C[R],C[x]),n:N});return T}return C.map(T=>{const R={[i]:T,column:T};for(const x of C)R[x]=T===x?1:O(T,x);return R.n=N,R})}#ue(E,S){const C=this.#W(E),N={by:String(S.by)};S.periodsPerYear!==void 0&&(N.periodsPerYear=Number(S.periodsPerYear));const O=E.statistics.series(String(S.of),N)||{};return y.map(T=>({[i]:T,metric:T,value:O[T]??null,n:C}))}#Me(E,S){const C=S.with,N=Array.isArray(S.columns)?{columns:S.columns.map(String)}:void 0,O=E.statistics.datasetVsDataset(C,N);if(!Y(O))return[];const R=(Array.isArray(O.ranked)?O.ranked:[]).map(V=>({[i]:String(V.column),column:V.column,measure:V.measure??null,magnitude:V.magnitude??null,distance:V.distance??null,direction:V.direction??null,nA:V.nA??null,nB:V.nB??null,meanA:V.meanA??null,meanB:V.meanB??null,reliable:V.reliable??null,unmatched:""})),x=O.unmatched,U=[["A",x&&x.onlyA],["B",x&&x.onlyB]];for(const[V,J]of U)for(const _ of J||[])R.push({[i]:`${V}${_}`,column:_,measure:null,magnitude:null,distance:null,direction:null,nA:null,nB:null,meanA:null,meanB:null,reliable:!1,unmatched:V});return R}#fe(){const E=this.#e;if(!E||!E.statistics||!A(E.statistics.profile))return[];const C=(Array.isArray(this.#t.profile)?this.#t.profile:[this.#t.profile]).filter(Boolean).map(O=>{const T=E.statistics.profile(String(O))||{},R={[i]:String(O)};for(const U of u)R[U]=U==="column"?String(O):T[U]??null;R.outliers=Array.isArray(T.outliers)?T.outliers.length:T.outliers??null;const x=f({...T,rows:R.rows,outliers:R.outliers,numeric:T.numeric},this.#t.alerts);return R.alerts=x.join(", "),R.alertCount=x.length,R});if(this.#t.orient!=="metrics")return C;const N=C[0];return N?u.filter(O=>O!=="column").map(O=>({[i]:O,metric:O,value:N[O]})):[]}apply(E){const S=["add","update","remove"],C=[];for(const N of S)for(const O of E&&E[N]||[])C.push({operation:N,id:O&&O.id,reason:"derived-read-only"});return C.length&&L("source.derived.readonly","a derived grid is read-only: its rows are computed from another grid. Write to the source grid instead, and the derived one follows."),{added:[],updated:[],removed:[],rejected:C}}destroy(){this.#s=!0,this.#r&&(clearTimeout(this.#r),this.#r=null),this.#X()&&this.#V().length&&this.#_([]);for(const E of this.#n)try{E()}catch{}this.#n=[],this.#e=null,this.#d=null,super.destroy()}}function k(B){return Y(B)&&B.companion===!0}function P(B,E,S,C=new Set){if(E===B)return S;if(C.has(E))return null;C.add(E);let N=null;try{N=A(E.config)?E.config():null}catch{N=null}const O=N&&Y(N.source)?N.source:null;if(!O||O.mode!=="derived")return null;const T=O.from;if(Array.isArray(T)){for(let R=0;R<T.length;R++){const x=m(T[R],R);if(!x.grid||!A(x.grid.on))continue;const U=P(B,x.grid,[...S,x.label],C);if(U)return U}return null}return Y(T)&&A(T.on)?P(B,T,[...S,"(from)"],C):null}function G(B){return Y(B)&&"data"in B?B.data:B}function K(B,E){if(!B||typeof B!="object")return null;if(Array.isArray(B.conditions)){for(const C of B.conditions){const N=K(C,E);if(N)return N}return null}return B.col===E?B:null}function q(B,E){return new w(B,E)}}),Ve("packages/core/src/source/adapters/odata.js",function(e,D){"use strict";Object.defineProperty(e,"conditionToOData",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"filtersToOData",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"odataAdapter",{enumerable:!0,get:function(){return u}});const A=D("packages/core/src/internal/warn.js").warnOnce,I=D("packages/core/src/source/filterwire.js").isGroup,L=Object.freeze(["eq","ne","gt","gte","lt","lte","contains","startsWith","endsWith","blank","notBlank","between","notBetween"]),Q=/^\d{4}-\d{2}-\d{2}$/,H=/^\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/,$=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;function X(h){const p=h instanceof Date?h:typeof h=="number"&&Number.isFinite(h)?new Date(h):typeof h=="string"&&$.test(h)?new Date(h):null;return p&&!Number.isNaN(p.getTime())?p:null}const F=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function j(h,p){throw typeof p=="string"&&F.test(p)?new Error(`odataAdapter: "${p}" needs a zone designator to be used as a ${h} 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 ${h} value`)}function v(h){const p=X(h);return p||j("DateTimeOffset",h),p.toISOString()}function b(h){if(typeof h=="string"&&Q.test(h))return h;const p=X(h);return p||j("Date",h),p.toISOString().slice(0,10)}function l(h){if(typeof h=="string"&&H.test(h))return h.length===5?`${h}:00`:h;if(typeof h=="number"&&Number.isFinite(h)&&h>=0&&h<864e5){const p=Math.floor(h),y=d=>String(d).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(h)}" is not a usable TimeOfDay value`)}const g=Object.freeze({timestamp:v,datetime:v,date:b,dateString:b,time:l}),o=200,t=1e3,s=Object.freeze({eq:"eq",ne:"ne",gt:"gt",gte:"ge",lt:"lt",lte:"le"});function r(h,p){if(h==null)return"null";const y=p&&g[String(p)];return y?y(h):typeof h=="number"||typeof h=="boolean"?String(h):h instanceof Date?h.toISOString():`'${String(h).replace(/'/g,"''")}'`}function i(h){const p=String(h),y=/^[A-Za-z_][A-Za-z0-9_]*$/;if(!p||!p.split("/").every(d=>y.test(d)))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(h){const p=i(h.col),y=String(h.op),d=h.type;if(s[y])return`${p} ${s[y]} ${r(h.value,d)}`;if(y==="contains")return`contains(${p},${r(h.value,d)})`;if(y==="startsWith")return`startswith(${p},${r(h.value,d)})`;if(y==="endsWith")return`endswith(${p},${r(h.value,d)})`;if(y==="blank")return`(${p} eq null)`;if(y==="notBlank")return`(${p} ne null)`;if(y==="between"||y==="notBetween"){const f=Array.isArray(h.value)?h.value:[h.value,h.value],w=String(h.bounds||"[]"),k=w.charAt(0)==="("?n.lo.excl:n.lo.incl,P=w.charAt(1)===")"?n.hi.excl:n.hi.incl,G=`(${p} ${k} ${r(f[0],d)} and ${p} ${P} ${r(f[1],d)})`;return y==="between"?G:`(${p} eq null or not ${G})`}return null}function c(h){const p=String(h&&h.op);throw A(`source.odata.filter.refuse.${p}`,`a "${p}" filter condition cannot be written as an OData $filter expression, so the request was refused rather than sent without it — silently dropping it would have matched more or fewer rows than the filter asked for. Route this condition through a source that can pushdown-split it as residual (source.filter capability), or drop it from the tree before building the URL.`),new Error(`odataAdapter: a "${p}" filter condition cannot be expressed in OData and was refused`)}function a(h){if(!h)return"";if(!I(h)){const d=m(h);return d===null?c(h):d}const p=String(h.op)==="or"?" or ":" and ",y=(h.conditions||[]).map(d=>{if(I(d))return a(d);const f=m(d);return f===null?c(d):f}).filter(Boolean);return y.length?y.length===1?y[0]:`(${y.join(p)})`:""}function u(h={}){const p=String(h.url||""),y=h.fetch||(typeof fetch=="function"?fetch:null),d=h.count!==!1,f=i(h.key||"id"),w=h.edit===!0;return{name:"odata",capabilities:{filter:"tree",operators:L,sort:"multi",quick:h.search===!0,range:!0,total:d,mutate:w?{update:!0,delete:!0,append:!0,returning:"row"}:!1},urlFor(k){const P=[],G=(q,B)=>P.push(`${q}=${encodeURIComponent(B)}`),K=a(k.filters);return K&&G("$filter",K),k.sort&&k.sort.length&&G("$orderby",k.sort.map(q=>`${i(q.col)}${q.dir==="desc"?" desc":" asc"}`).join(",")),k.range&&(G("$skip",String(k.range.start)),G("$top",String(k.range.end-k.range.start))),k.quick&&G("$search",`"${String(k.quick).replace(/"/g,"")}"`),d&&G("$count","true"),P.length?`${p}?${P.join("&")}`:p},async execute(k,P){if(!y)throw new Error("odataAdapter needs a fetch implementation");const G={Accept:"application/json",...h.headers||{}},K=P&&P.signal,q=async C=>{const N=await y(C,{headers:G,signal:K});if(!N.ok)throw new Error(`OData request failed: ${N.status}`);return N.json()};let B=await q(this.urlFor(k)),E=B.value||B.rows||[];const S=B["@odata.count"]??B.count;if(!k.range){let C=B["@odata.nextLink"];for(;C&&E.length<o*t;)B=await q(C),E=E.concat(B.value||B.rows||[]),C=B["@odata.nextLink"]}return S==null?(d&&A("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:E}):{rows:E,total:Number(S)}},urlForKey(k){return`${p}(${r(k)})`},async mutate(k,P){if(!y)throw new Error("odataAdapter needs a fetch implementation");if(!k||k.kind!=="update"&&k.kind!=="delete"&&k.kind!=="append")throw new Error(`odataAdapter: mutation kind "${k&&k.kind}" is not supported (update, delete and append are wired)`);const G={Accept:"application/json","Content-Type":"application/json",...h.headers||{}},K=P&&P.signal;if(k.kind==="delete"){const C=Array.isArray(k.keys)&&k.keys.length?k.keys[0]:k.key;if(C==null)throw new Error("odataAdapter: a delete needs a row key");const N=await y(this.urlForKey(C),{method:"DELETE",headers:G,signal:K});if(!N.ok)throw new Error(`OData delete failed: ${N.status}`);return{ok:!0}}if(k.kind==="append"){const C=Array.isArray(k.rows)?k.rows.filter(x=>x&&typeof x=="object"):[];if(C.length!==1)throw new Error("odataAdapter: an append needs exactly one row object (OData creates one entity per POST)");const N=await y(p,{method:"POST",headers:G,signal:K,body:JSON.stringify(C[0])});if(!N.ok)throw new Error(`OData add-row failed: ${N.status}`);const O=N.status===204?null:await N.json().catch(()=>null),T=O&&typeof O=="object"&&"value"in O?O.value:O;if(!T||typeof T!="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 R=T[f];if(R==null)throw new Error(`odataAdapter: the created entity carried no ${f} to rekey the appended row by.`);return{ok:!0,keys:[String(R)],rows:[T]}}const q=this.urlForKey(k.key),B=await y(q,{method:"PATCH",headers:G,signal:K,body:JSON.stringify(k.patch||{})});if(!B.ok)throw new Error(`OData update failed: ${B.status}`);if(B.status===204)return{ok:!0};const E=await B.json(),S=E&&typeof E=="object"&&"value"in E?E.value:E;return S==null?{ok:!0}:{ok:!0,rows:[S]}}}}}),Ve("packages/core/src/source/adapters/rest.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_PARAMS",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"DEFAULT_VERBS",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"restAdapter",{enumerable:!0,get:function(){return Y}});const re=Object.freeze({offset:"offset",limit:"limit",sort:"sort",order:"order",filter:"filter",search:"q"}),A=Object.freeze({update:"PATCH",delete:"DELETE",append:"POST"});function Y(I={}){const L=String(I.url||""),Q=I.fetch||(typeof fetch=="function"?fetch:null),H={...re,...I.params||{}},$=I.encodeFilter||(t=>JSON.stringify(t)),X=I.rows||(t=>Array.isArray(t)?t:t.rows||t.data||[]),F=I.total||((t,s)=>Array.isArray(t)?s.length:t.total??t.count??s.length),j=I.edit===!0,v=I.returning==="row"?"row":I.returning==="key"?"key":"none",b=I.keyField||"id",l=I.writeUrlFor||(t=>`${L}/${encodeURIComponent(String(t.key??(t.keys&&t.keys[0])))}`),g=I.encodeMutation||(t=>{const s=A[t.kind];if(t.kind==="update")return{method:s,url:l(t),headers:{"Content-Type":"application/json"},body:JSON.stringify(t.patch||{})};if(t.kind==="append"){const r=Array.isArray(t.rows)?t.rows:t.rows?[t.rows]:[];return{method:s,url:L,headers:{"Content-Type":"application/json"},body:JSON.stringify(r.length===1?r[0]:r)}}return{method:s,url:l(t)}}),o=I.writeRow||(t=>{if(t===null||typeof t!="object")return null;if(Array.isArray(t))return t.length?t[0]:null;const s=t;return s.row??s.data??t});return{name:"rest",capabilities:{range:!0,total:!0,sort:"multi",filter:!1,quick:!1,mutate:j?{update:!0,delete:!0,append:!0,returning:v}:!1,...I.capabilities||{},...I.operators?{filter:"tree",operators:I.operators}:{}},urlFor(t){const s=new URLSearchParams;t.range&&(s.set(H.offset,String(t.range.start)),s.set(H.limit,String(t.range.end-t.range.start))),t.sort&&t.sort.length&&(s.set(H.sort,t.sort.map(i=>i.col).join(",")),s.set(H.order,t.sort.map(i=>i.dir||"asc").join(","))),t.filters&&s.set(H.filter,$(t.filters)),t.quick&&s.set(H.search,String(t.quick));const r=s.toString();return r?`${L}?${r}`:L},async execute(t,s){if(!Q)throw new Error("restAdapter needs a fetch implementation");const r=await Q(this.urlFor(t),{headers:{Accept:"application/json",...I.headers||{}},signal:s&&s.signal});if(!r.ok)throw new Error(`request failed: ${r.status}`);const i=await r.json(),n=X(i);return{rows:n,total:F(i,n)}},writeUrlFor(t){return l(t)},encodeMutation(t){return g(t)},async mutate(t,s){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 r=g(t);if(!r||!r.url||!r.method)throw new Error("restAdapter: encodeMutation must return { method, url }");const i={Accept:"application/json",...I.headers||{},...r.headers||{}},n=await Q(r.url,{method:r.method,headers:i,signal:s&&s.signal,...r.body!==void 0?{body:r.body}:{}});if(!n.ok)throw new Error(`REST ${t.kind} failed: ${n.status}`);if(t.kind==="append"){if(v==="none")return{ok:!0};if(n.status===204)throw new Error("restAdapter: the add-row POST returned 204 with no body, so the appended row has no server key to rekey by. Declare returning: 'row'/'key' and have the endpoint return the created row.");const a=await n.json(),u=o(a),h=u&&typeof u=="object"?u[b]:void 0;if(h==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 v==="row"?{ok:!0,keys:[String(h)],rows:[u]}:{ok:!0,keys:[String(h)]}}if(v!=="row"||n.status===204)return{ok:!0};const m=await n.json(),c=o(m);return c==null?{ok:!0}:{ok:!0,rows:[c]}}}}}),Ve("packages/core/src/source/adapters/dfql.js",function(e,D){"use strict";Object.defineProperty(e,"DFQL_BASE",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"DFQL_WRITE_URL",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"dfqlAdapter",{enumerable:!0,get:function(){return j}});const A=D("packages/core/src/internal/predicates.js").isFunction,I=D("packages/core/src/internal/warn.js").warnOnce,L="https://rest.demandflow.com",Q="https://stream.demandflow.com/dfql",H=Object.freeze(["id","created","updated","ownerId","entity"]);function $(v){const b={},l=[];for(const[g,o]of Object.entries(v||{})){if(H.includes(g)){l.push(g);continue}b[g]=o}return l.length&&I("source.dfql.protected",`a DFQL update tried to write protected field(s) ${l.join(", ")}; they are server-assigned and immutable, so they were dropped from the PATCH.`),b}function X(v){if(!v||typeof v!="object"||Array.isArray(v))return["fields (must be an object)"];const b=v,l=[];return(typeof b.entity!="string"||!b.entity)&&l.push("entity (uppercase code)"),Number.isFinite(Number(b.level))||l.push("level (numeric)"),(typeof b.comboKey!="string"||!b.comboKey.endsWith("|ENT:"))&&l.push("comboKey (a string ending '|ENT:')"),l}async function F(v){const b=[],l=s=>{const r=s.trim();if(r)try{b.push(JSON.parse(r))}catch{}};if(!v.body||typeof v.body.getReader!="function")return(await v.text()).split(`
|