@toclocoinc/lattice-grid 1.111.5 → 1.111.6
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 +9 -2
- package/modules/form.esm.min.js.map +1 -1
- package/modules/form.min.cjs +9 -2
- package/modules/form.min.js +9 -2
- package/modules/form.min.js.map +1 -1
- package/modules/gantt.d.ts +1 -1
- package/modules/gantt.esm.min.js +1 -1
- package/modules/gantt.min.cjs +1 -1
- package/modules/gantt.min.js +1 -1
- package/modules/geo-europe-nuts.d.ts +1 -1
- package/modules/geo-europe-nuts.esm.min.js +1 -1
- package/modules/geo-europe-nuts.min.cjs +1 -1
- package/modules/geo-europe-nuts.min.js +1 -1
- package/modules/geo-uk.d.ts +1 -1
- package/modules/geo-uk.esm.min.js +1 -1
- package/modules/geo-uk.min.cjs +1 -1
- package/modules/geo-uk.min.js +1 -1
- package/modules/geo-us-states.d.ts +1 -1
- package/modules/geo-us-states.esm.min.js +1 -1
- package/modules/geo-us-states.min.cjs +1 -1
- package/modules/geo-us-states.min.js +1 -1
- package/modules/geo-world-110m.d.ts +1 -1
- package/modules/geo-world-110m.esm.min.js +1 -1
- package/modules/geo-world-110m.min.cjs +1 -1
- package/modules/geo-world-110m.min.js +1 -1
- package/modules/geo-world-50m.d.ts +1 -1
- package/modules/geo-world-50m.esm.min.js +1 -1
- package/modules/geo-world-50m.min.cjs +1 -1
- package/modules/geo-world-50m.min.js +1 -1
- package/modules/geometry.d.ts +1 -1
- package/modules/geometry.esm.min.js +1 -1
- package/modules/geometry.min.cjs +1 -1
- package/modules/geometry.min.js +1 -1
- package/modules/htmx.d.ts +1 -1
- package/modules/htmx.esm.min.js +2 -2
- package/modules/htmx.min.cjs +2 -2
- package/modules/htmx.min.js +2 -2
- package/modules/htmx.shared.esm.min.js +1 -1
- package/modules/htmx.shared.min.cjs +1 -1
- package/modules/htmx.shared.min.js +1 -1
- package/modules/kanban.d.ts +1 -1
- package/modules/kanban.esm.min.js +1 -1
- package/modules/kanban.min.cjs +1 -1
- package/modules/kanban.min.js +1 -1
- package/modules/kpi.d.ts +1 -1
- package/modules/kpi.esm.min.js +1 -1
- package/modules/kpi.min.cjs +1 -1
- package/modules/kpi.min.js +1 -1
- package/modules/layout.d.ts +1 -1
- package/modules/layout.esm.min.js +1 -1
- package/modules/layout.min.cjs +1 -1
- package/modules/layout.min.js +1 -1
- package/modules/leaflet.d.ts +1 -1
- package/modules/leaflet.esm.min.js +1 -1
- package/modules/leaflet.min.cjs +1 -1
- package/modules/leaflet.min.js +1 -1
- package/modules/list.d.ts +1 -1
- package/modules/list.esm.min.js +1 -1
- package/modules/list.min.cjs +1 -1
- package/modules/list.min.js +1 -1
- package/modules/listview.d.ts +1 -1
- package/modules/listview.esm.min.js +1 -1
- package/modules/listview.min.cjs +1 -1
- package/modules/listview.min.js +1 -1
- package/modules/mapview.d.ts +1 -1
- package/modules/mapview.esm.min.js +1 -1
- package/modules/mapview.min.cjs +1 -1
- package/modules/mapview.min.js +1 -1
- package/modules/mock-socket.d.ts +1 -1
- package/modules/mock-socket.esm.min.js +1 -1
- package/modules/mock-socket.min.cjs +1 -1
- package/modules/mock-socket.min.js +1 -1
- package/modules/presets.d.ts +1 -1
- package/modules/presets.esm.min.js +1 -1
- package/modules/presets.min.cjs +1 -1
- package/modules/presets.min.js +1 -1
- package/modules/react.d.ts +1 -1
- package/modules/react.esm.min.js +1 -1
- package/modules/react.min.cjs +1 -1
- package/modules/react.min.js +1 -1
- package/modules/recordeditor.d.ts +1 -1
- package/modules/recordeditor.esm.min.js +1 -1
- package/modules/recordeditor.min.cjs +1 -1
- package/modules/recordeditor.min.js +1 -1
- package/modules/scheduler.d.ts +1 -1
- package/modules/scheduler.esm.min.js +1 -1
- package/modules/scheduler.min.cjs +1 -1
- package/modules/scheduler.min.js +1 -1
- package/modules/shell.d.ts +1 -1
- package/modules/shell.esm.min.js +1 -1
- package/modules/shell.min.cjs +1 -1
- package/modules/shell.min.js +1 -1
- package/modules/sidebar.d.ts +1 -1
- package/modules/sidebar.esm.min.js +1 -1
- package/modules/sidebar.min.cjs +1 -1
- package/modules/sidebar.min.js +1 -1
- package/modules/svelte.d.ts +1 -1
- package/modules/svelte.esm.min.js +1 -1
- package/modules/svelte.min.cjs +1 -1
- package/modules/svelte.min.js +1 -1
- package/modules/tabs.d.ts +1 -1
- package/modules/tabs.esm.min.js +1 -1
- package/modules/tabs.min.cjs +1 -1
- package/modules/tabs.min.js +1 -1
- package/modules/toolbar.d.ts +1 -1
- package/modules/toolbar.esm.min.js +1 -1
- package/modules/toolbar.min.cjs +1 -1
- package/modules/toolbar.min.js +1 -1
- package/modules/tree.d.ts +1 -1
- package/modules/tree.esm.min.js +1 -1
- package/modules/tree.min.cjs +1 -1
- package/modules/tree.min.js +1 -1
- package/modules/vue.d.ts +1 -1
- package/modules/vue.esm.min.js +1 -1
- package/modules/vue.min.cjs +1 -1
- package/modules/vue.min.js +1 -1
- package/modules/webcomponent.d.ts +1 -1
- package/modules/webcomponent.esm.min.js +2 -2
- package/modules/webcomponent.min.cjs +2 -2
- package/modules/webcomponent.min.js +2 -2
- package/package.json +1 -1
package/lattice-grid.esm.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.111.
|
|
2
|
+
* Lattice Grid 1.111.6, core + DOM renderer
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
6
6
|
var Rr=Object.create(null),$r=Object.create(null);function He(e,D){Rr[e]=D}function or(e){var D=$r[e];if(D)return D;var re=Object.create(null);$r[e]=re;var N=Rr[e];if(!N)throw new Error("[lattice] missing module: "+e);return N(re,or),re}He("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 N}}),Object.defineProperty(e,"isNil",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"isBlank",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"isCtor",{enumerable:!0,get:function(){return L}});function re(Z){return Z!==null&&typeof Z=="object"&&!Array.isArray(Z)}function N(Z){return typeof Z=="function"}function G(Z){return Z==null}function F(Z){return Z==null||Z===""}function L(Z){return typeof Z!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(Z))?!0:!!(Z.prototype&&Object.getOwnPropertyNames(Z.prototype).length>1)}}),He("packages/core/src/internal/warn.js",function(e,D){"use strict";Object.defineProperty(e,"reportedWarnings",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"warnOnce",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"infoOnce",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resetWarnings",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"fail",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"invariant",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEV",{enumerable:!0,get:function(){return m}});const re=new Set,N=2e3;function G(s){if(re.add(s),re.size>N){const t=re.values().next().value;t!==void 0&&re.delete(t)}}const F=[],L=500;function Z(s,t,o){F.push({key:s,level:t,message:o.map(u=>typeof u=="string"?u:z(u)).join(" "),at:Date.now()}),F.length>L&&F.shift()}function z(s){if(s instanceof Error)return s.message;try{return JSON.stringify(s)}catch{return String(s)}}function x(){return F.map(s=>({...s}))}function Y(s){if(s.length===0||typeof s[0]!="string")return s;const t=s[0].replace(/^\[lattice\]\s*/,"");return t===s[0]?s:[t,...s.slice(1)]}function $(s,...t){if(re.has(s))return;G(s);const o=Y(t);Z(s,"warn",o),console.warn("[lattice]",...o)}function j(s,...t){if(re.has(s))return;G(s);const o=Y(t);Z(s,"info",o),console.info("[lattice]",...o)}function k(){re.clear(),F.length=0}function y(s,t){const o=new Error(`[lattice] ${s}`);throw t!==void 0&&(o.cause=t),o}function c(s,t){s||y(t)}const m=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})()}),He("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 Z}}),Object.defineProperty(e,"DISTRIBUTION_LABELS",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"testRule",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"mixColour",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"summariseColumn",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"quantileOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"needsDistribution",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"resolveDistribution",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ICON_SETS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"compileRules",{enumerable:!0,get:function(){return V}});const N=D("packages/core/src/internal/predicates.js").isFunction,F=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"]),Z=Object.freeze(["topPercent","bottomPercent","topN","bottomN","aboveMean","belowMean","aboveMedian","belowMedian","zAbove","zBelow","outlier"]),z=Object.freeze({topPercent:"In the top %",bottomPercent:"In the bottom %",topN:"In the top N",bottomN:"In the bottom N",aboveMean:"Above average",belowMean:"Below average",aboveMedian:"Above the median",belowMedian:"Below the median",zAbove:"Standard deviations above the mean",zBelow:"Standard deviations below the mean",outlier:"An outlier"});function x(E,O){const M=Number(E),T=Number(O);if(E!==null&&E!==""&&O!==null&&O!==""&&Number.isFinite(M)&&Number.isFinite(T))return M<T?-1:M>T?1:0;const I=String(E??"").toLowerCase(),U=String(O??"").toLowerCase();return I<U?-1:I>U?1:0}function Y(E){return E==null||E===""}function $(E,O){if(!O||typeof O!="object")return!1;const{op:M}=O,T=O.value,A=O.value2;switch(M){case"blank":return Y(E);case"notBlank":return!Y(E);case"true":return E===!0;case"false":return E===!1;default:break}if(Y(E))return!1;switch(M){case"eq":return x(E,T)===0;case"ne":return x(E,T)!==0;case"gt":return x(E,T)>0;case"gte":return x(E,T)>=0;case"lt":return x(E,T)<0;case"lte":return x(E,T)<=0;case"between":return x(E,T)>=0&&x(E,A)<=0;case"outside":return x(E,T)<0||x(E,A)>0;case"contains":return String(E).toLowerCase().includes(String(T??"").toLowerCase());case"notContains":return!String(E).toLowerCase().includes(String(T??"").toLowerCase());case"startsWith":return String(E).toLowerCase().startsWith(String(T??"").toLowerCase());case"endsWith":return String(E).toLowerCase().endsWith(String(T??"").toLowerCase());default:return!1}}function j(E,O,M){const T=te=>{const J=String(te).replace("#",""),ne=J.length===3?J.split("").map(se=>se+se).join(""):J;return[0,2,4].map(se=>parseInt(ne.slice(se,se+2),16)||0)},[A,I,U]=T(E),[X,q,_]=T(O),H=Math.max(0,Math.min(1,M)),ee=(te,J)=>Math.round(te+(J-te)*H);return`#${[ee(A,X),ee(I,q),ee(U,_)].map(te=>te.toString(16).padStart(2,"0")).join("")}`}function k(E){const O=[];for(const X of E||[]){if(X==null||X==="")continue;const q=X instanceof Date?X.getTime():Number(X);Number.isFinite(q)&&O.push(q)}if(!O.length)return null;O.sort((X,q)=>X-q);let M=0,T=0,A=0;for(const X of O){M++;const q=X-T;T+=q/M,A+=q*(X-T)}const I=y(O,.25),U=y(O,.75);return{n:O.length,min:O[0],max:O[O.length-1],mean:T,stddev:O.length>1?Math.sqrt(A/(O.length-1)):0,median:y(O,.5),q1:I,q3:U,iqr:U-I,sorted:O}}function y(E,O){if(!E.length)return 0;const M=(E.length-1)*Math.max(0,Math.min(1,O)),T=Math.floor(M),A=Math.ceil(M);return T===A?E[T]:E[T]+(M-T)*(E[A]-E[T])}function c(E){for(const O of Array.isArray(E)?E:[])if(!(!O||typeof O!="object")&&(O.when&&Z.includes(O.when.op)||O.scale&&O.scale.from||O.dataBar&&!(Number.isFinite(Number(O.dataBar.min))&&Number.isFinite(Number(O.dataBar.max)))||O.iconSet&&!Array.isArray(O.iconSet.thresholds)))return!0;return!1}function m(E,O){const M=Number(E.value),T=A=>y(O.sorted,A);switch(E.op){case"topPercent":{const A=s(M,10);return{op:"gte",value:T(1-A)}}case"bottomPercent":{const A=s(M,10);return{op:"lte",value:T(A)}}case"topN":{const A=Math.max(1,Math.floor(M)||1),I=Math.max(0,O.sorted.length-A);return{op:"gte",value:O.sorted[I]}}case"bottomN":{const A=Math.max(1,Math.floor(M)||1),I=Math.min(O.sorted.length-1,A-1);return{op:"lte",value:O.sorted[I]}}case"aboveMean":return{op:"gt",value:O.mean};case"belowMean":return{op:"lt",value:O.mean};case"aboveMedian":return{op:"gt",value:O.median};case"belowMedian":return{op:"lt",value:O.median};case"zAbove":return O.stddev?{op:"gte",value:O.mean+(Number.isFinite(M)?M:2)*O.stddev}:null;case"zBelow":return O.stddev?{op:"lte",value:O.mean-(Number.isFinite(M)?M:2)*O.stddev}:null;case"outlier":{const A=(Number.isFinite(M)&&M>0?M:1.5)*O.iqr;return O.iqr?{op:"outside",value:O.q1-A,value2:O.q3+A}:null}default:return null}}function s(E,O){const M=Number.isFinite(E)?E:O,T=M>1?M/100:M;return Math.max(0,Math.min(1,T))}function t(E,O){if(E.from==="minmax")return{...E,min:O.min,max:O.max};if(E.from==="quantile")return{...E,min:y(O.sorted,s(Number(E.low),5)),max:y(O.sorted,s(Number(E.high),95))};if(E.from==="stddev"){const M=Number.isFinite(Number(E.deviations))?Number(E.deviations):2;return{...E,min:O.mean-M*O.stddev,max:O.mean+M*O.stddev}}return E}function o(E,O){const M=Array.isArray(E)?E:[];return!O||!O.n?M.map(T=>T&&c([T])?{...T,enabled:!1}:T):M.map(T=>{if(!T||typeof T!="object")return T;if(T.scale&&T.scale.from)return{...T,scale:t(T.scale,O)};if(T.dataBar)return{...T,dataBar:u(T.dataBar,O)};if(T.iconSet)return{...T,iconSet:d(T.iconSet,O)};if(!T.when||!Z.includes(T.when.op))return T;const A=m(T.when,O);return A?{...T,when:A}:{...T,enabled:!1}})}function u(E,O){const M=Number.isFinite(Number(E.min))?Number(E.min):void 0,T=Number.isFinite(Number(E.max))?Number(E.max):void 0;if(M!==void 0&&T!==void 0)return{...E,min:M,max:T};if(E.from==="quantile")return{...E,min:M??y(O.sorted,s(Number(E.low),5)),max:T??y(O.sorted,s(Number(E.high),95))};if(E.from==="stddev"){const A=Number.isFinite(Number(E.deviations))?Number(E.deviations):2;return{...E,min:M??O.mean-A*O.stddev,max:T??O.mean+A*O.stddev}}return{...E,min:M??O.min,max:T??O.max}}function d(E,O){if(Array.isArray(E.thresholds))return E;const M=i(E),T=[];for(let A=1;A<M;A++)T.push(y(O.sorted,A/M));return{...E,thresholds:T}}function i(E){if(Array.isArray(E.icons)&&E.icons.length>=2)return E.icons.length;if(Number.isFinite(Number(E.count))&&Number(E.count)>=2)return Math.floor(Number(E.count));const O=b[E.set];return O?O.length:3}function g(E){return`url("data:image/svg+xml,${encodeURIComponent(E)}")`}function r(E){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="${E}"/></svg>`}function n(E,O){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><polygon points="${O==="up"?"8,2 14,13 2,13":O==="down"?"2,3 14,3 8,14":"4,2 14,8 4,14"}" fill="${E}"/></svg>`}function f(E,O){const M="M8 1l1.9 3.9 4.3.6-3.1 3 .7 4.3L8 13.8 4.2 15.8l.7-4.3-3.1-3 4.3-.6z";let T=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${O*16} 16">`;for(let A=0;A<O;A++){const I=A<E?"#f5a623":"#d0d0d0";T+=`<path transform="translate(${A*16},0)" d="${M}" fill="${I}"/>`}return`${T}</svg>`}const h=Object.freeze([n("#c0392b","down"),n("#e0a800","right"),n("#2e7d32","up")]),l=Object.freeze([r("#d13438"),r("#f5a623"),r("#2e9e44")]),b=Object.freeze({arrows:h,trafficLights:l,ratings:Object.freeze([1,2,3,4,5].map(E=>f(E,5)))}),a=Object.freeze({arrows:"Arrows",trafficLights:"Traffic lights",ratings:"Ratings"});function p(E){if(Array.isArray(E.icons)&&E.icons.length>=2)return E.icons.map(T=>/^\s*(url\(|data:|<)/.test(String(T))&&String(T).trim().startsWith("<")?g(String(T)):String(T));const O=E.set||"arrows";if(O==="ratings"){const T=i(E),A=[];for(let I=1;I<=T;I++)A.push(g(f(I,T)));return A}const M=b[O];return M?M.map(g):(F(`iconSet:${O}`,`unknown icon set '${O}'; falling back to arrows.`),h.map(g))}function w(E){const O=Number(E.min),T=Number(E.max)-O,A=E.colour||E.color||"#5b9bd5",I=E.negativeColour||E.negativeColor||"#d13438",U=E.direction==="rtl"?"left":"right",X=_=>Math.max(0,Math.min(1,(_-O)/T))*100,q=T?Math.max(0,Math.min(100,(0-O)/T*100)):0;return _=>{if(Y(_))return null;const H=Number(_);if(!Number.isFinite(H)||!T)return null;const ee=X(H),te=Math.min(ee,q),J=Math.max(ee,q),ne=H>=0?A:I;return{backgroundImage:`linear-gradient(to ${U}, transparent ${te}%, ${ne} ${te}%, ${ne} ${J}%, transparent ${J}%)`,backgroundRepeat:"no-repeat",backgroundPosition:"0 0"}}}function v(E){const O=p(E),M=E.reverse?[...O].reverse():O,T=(Array.isArray(E.thresholds)?E.thresholds:[]).map(Number).filter(Number.isFinite),A=Number.isFinite(Number(E.size))?Number(E.size):16,I=E.set==="ratings"?A*i(E):A;return U=>{if(Y(U))return null;const X=Number(U);if(!Number.isFinite(X))return null;let q=0;for(const H of T)X>=H&&q++;const _=M[Math.min(q,M.length-1)];return _?{backgroundImage:_,backgroundRepeat:"no-repeat",backgroundPosition:"left center",backgroundSize:`${I}px ${A}px`,paddingLeft:`${I+4}px`}:null}}function P(E){const O=Array.isArray(E.colours)&&E.colours.length>=2?E.colours:["#f8f9fa","#1a6bc7"],M=Number(E.min),T=Number(E.max),A=T-M,I=O.length-1,U=[];for(let q=0;q<=I;q++)U.push(I?q/I:0);const X=Number(E.mid);if(E.mid!==void 0&&E.mid!==null)if(O.length%2===0)F("formatting.scale.mid.even",`a scale's "mid" needs an odd number of colours (a middle stop to pin); ${O.length} were given, so "mid" was ignored.`);else if(Number.isFinite(X)&&A&&X>Math.min(M,T)&&X<Math.max(M,T)){const q=I/2,_=Math.max(0,Math.min(1,(X-M)/A));for(let H=0;H<=I;H++)U[H]=H<=q?q?H/q*_:_:_+(H-q)/(I-q)*(1-_)}else Number.isFinite(X)&&F("formatting.scale.mid.range",`a scale's "mid" (${X}) is outside its min..max range, so it was ignored.`);return q=>{const _=Number(q);if(!Number.isFinite(_)||!A)return null;const H=Math.max(0,Math.min(1,(_-M)/A));let ee=0;for(;ee<I-1&&H>U[ee+1];)ee++;const te=U[ee+1]-U[ee],J=te>0?(H-U[ee])/te:0;return{background:j(O[ee],O[ee+1],Math.max(0,Math.min(1,J)))}}}function V(E,O=null){const M=c(E)?o(E,O):E,T=(Array.isArray(M)?M:[]).filter(U=>U&&typeof U=="object");if(!T.length)return()=>null;const A=T.map(U=>U.scale?{scale:P(U.scale),enabled:U.enabled!==!1}:U.dataBar?{scale:w(U.dataBar),enabled:U.enabled!==!1}:U.iconSet?{scale:v(U.iconSet),enabled:U.enabled!==!1}:{when:U.when,style:U.style,stop:U.stopIfTrue!==!1,enabled:U.enabled!==!1}),I=W(A)?S():null;return(U,X)=>{const q=U?U.value:void 0;let _=null;X&&(X.mode=0);for(const H of A){if(!H.enabled)continue;if(H.scale){const J=H.scale(q);J&&(_={..._||{},...J});continue}if(!$(q,H.when))continue;let ee;const te=N(H.style);if(te?X&&I?(ee=H.style(I.enter(U)),I.mode>X.mode&&(X.mode=I.mode)):ee=H.style(U):ee=H.style,ee&&(_=_?{..._,...ee}:te?ee:{...ee}),H.stop)break}return _}}function W(E){return E.some(O=>O.enabled&&!O.scale&&N(O.style))}const K=new Set(["value","colId","column"]),R=new Set(["row","data","index"]);function S(){let E={};const O={mode:0,enter(A){return E=A||{},O.mode=0,T}},M=A=>{if(K.has(A))return;const I=R.has(A)?1:2;I>O.mode&&(O.mode=I)},T=new Proxy({},{get(A,I){return M(I),E[I]},has(A,I){return M(I),I in E},set(A,I,U){return O.mode=2,E[I]=U,!0},ownKeys(){return O.mode=2,Reflect.ownKeys(E)},getOwnPropertyDescriptor(A,I){O.mode=2;const U=Object.getOwnPropertyDescriptor(E,I);return U?{value:E[I],enumerable:U.enumerable,configurable:!0,writable:!0}:void 0}});return O}}),He("packages/core/src/formula/parse.js",function(e,D){"use strict";Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return o}});const re="num",N="str",G="ref",F="name",L="op",Z="end",z=["<=",">=","<>","!="],x="+-*/^%(),<>=";class Y extends Error{constructor(d,i){super(d),this.name="FormulaError",this.at=i}}function $(u){const d=[];let i=0;for(;i<u.length;){const g=u[i];if(g===" "||g===" "||g===`
|
|
7
|
-
`||g==="\r"){i++;continue}if(g>="0"&&g<="9"){i=k(u,i,d);continue}if(g==="."&&u[i+1]>="0"&&u[i+1]<="9"){i=k(u,i,d);continue}if(g==='"'||g==="'"){i=y(u,i,d);continue}if(g==="["){const n=u.indexOf("]",i+1);if(n<0)throw new Y("a [column reference] was opened and never closed",i);d.push({kind:G,value:u.slice(i+1,n).trim(),at:i}),i=n+1;continue}if(j(g)){i=c(u,i,d);continue}const r=u.slice(i,i+2);if(z.includes(r)){d.push({kind:L,value:r==="!="?"<>":r,at:i}),i+=2;continue}if(x.includes(g)){d.push({kind:L,value:g,at:i}),i++;continue}throw new Y(`unexpected character ${JSON.stringify(g)}`,i)}return d.push({kind:Z,value:null,at:u.length}),d}function j(u){return/[A-Za-z_À-]/.test(u)}function k(u,d,i){let g=d,r=!1;for(;g<u.length;){const n=u[g];if(n>="0"&&n<="9"){g++;continue}if(n==="."&&!r){r=!0,g++;continue}if((n==="e"||n==="E")&&/[0-9+-]/.test(u[g+1]||"")){for(g+=2;g<u.length&&u[g]>="0"&&u[g]<="9";)g++;break}break}return i.push({kind:re,value:Number(u.slice(d,g)),at:d}),g}function y(u,d,i){const g=u[d];let r=d+1,n="";for(;r<u.length;){if(u[r]===g){if(u[r+1]===g){n+=g,r+=2;continue}return i.push({kind:N,value:n,at:d}),r+1}n+=u[r],r++}throw new Y("a string was opened and never closed",d)}function c(u,d,i){let g=d;for(;g<u.length&&/[A-Za-z0-9_.À-]/.test(u[g]);)g++;const r=u.slice(d,g);let n=g;for(;n<u.length&&u[n]===" ";)n++;return i.push({kind:u[n]==="("?F:G,value:r,at:d}),g}const m={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function s(u){const d=String(u??"").replace(/^\s*=/,"");if(!d.trim())throw new Y("the formula is empty");const i=$(d);let g=0;const r=()=>i[g],n=()=>i[g++],f=v=>{const P=r();if(P.kind!==L||P.value!==v)throw new Y(`expected ${JSON.stringify(v)}`,P.at);g++},h=v=>{let P=l();for(;;){const V=r();if(V.kind!==L)break;const W=m[V.value];if(!W||W<v)break;g++;const K=h(V.value==="^"?W:W+1);P={kind:"bin",op:V.value,left:P,right:K}}return P},l=()=>{const v=r();return v.kind===L&&(v.value==="-"||v.value==="+")?(g++,{kind:"unary",op:v.value,arg:l()}):b()},b=()=>{let v=a();for(;r().kind===L&&r().value==="%";)g++,v={kind:"unary",op:"%",arg:v};return v},a=()=>{const v=n();if(v.kind===re)return{kind:"num",value:v.value};if(v.kind===N)return{kind:"str",value:v.value};if(v.kind===G)return{kind:"ref",name:v.value};if(v.kind===F){f("(");const P=[];if(!(r().kind===L&&r().value===")"))for(;;){if(P.push(h(1)),r().kind===L&&r().value===","){g++;continue}break}return f(")"),{kind:"call",name:String(v.value).toUpperCase(),args:P}}if(v.kind===L&&v.value==="("){const P=h(1);return f(")"),P}throw v.kind===Z?new Y("the formula ends unexpectedly",v.at):new Y(`unexpected ${JSON.stringify(v.value)}`,v.at)},p=h(1),w=r();if(w.kind!==Z)throw new Y(`unexpected ${JSON.stringify(w.value)}: is an operator missing?`,w.at);return p}function t(u){const d=new Set,i=g=>{if(!(!g||typeof g!="object")){if(g.kind==="ref"){d.add(String(g.name));return}if(g.kind==="bin"){i(g.left),i(g.right);return}if(g.kind==="unary"){i(g.arg);return}if(g.kind==="call")for(const r of g.args)i(r)}};return i(u),[...d]}function o(u){return typeof u=="string"&&/^\s*=/.test(u)&&u.trim()!=="="}}),He("packages/core/src/formula/evaluate.js",function(e,D){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return k}});const N=D("packages/core/src/formula/parse.js").FormulaError;function G(y){if(y==null||y==="")return 0;if(typeof y=="boolean")return y?1:0;if(y instanceof Date)return y.getTime();const c=typeof y=="number"?y:Number(String(y).replace(/[,\s]/g,""));if(!Number.isFinite(c))throw new N(`${JSON.stringify(y)} is not a number`);return c}function F(y){return y==null?"":String(y)}function L(y){if(typeof y=="boolean")return y;if(y==null||y==="")return!1;if(typeof y=="number")return y!==0;const c=String(y).trim().toLowerCase();return c==="false"||c==="no"||c==="0"?!1:c!==""}function Z(y){const c=[];for(const m of y){if(Array.isArray(m)){for(const s of m)s!=null&&s!==""&&c.push(G(s));continue}m==null||m===""||c.push(G(m))}return c}function z(y,c){const m=10**c,s=y*m;return Math.sign(s)*Math.round(Math.abs(s)+Number.EPSILON*Math.abs(s))/m}function x(y,c){if(!y.length)return 0;const m=y.slice().sort((u,d)=>u-d),s=(m.length-1)*Math.min(1,Math.max(0,c)),t=Math.floor(s),o=Math.ceil(s);return t===o?m[t]:m[t]+(s-t)*(m[o]-m[t])}function Y(y,c){let m=0,s=0,t=0;for(const u of y){m++;const d=u-s;s+=d/m,t+=d*(u-s)}const o=c?m-1:m;return o>0?Math.sqrt(t/o):0}const $={SUM:y=>Z(y).reduce((c,m)=>c+m,0),AVERAGE:y=>{const c=Z(y);return c.length?c.reduce((m,s)=>m+s,0)/c.length:0},MIN:y=>{const c=Z(y);return c.length?Math.min(...c):0},MAX:y=>{const c=Z(y);return c.length?Math.max(...c):0},COUNT:y=>Z(y).length,PRODUCT:y=>Z(y).reduce((c,m)=>c*m,1),ROUND:y=>z(G(y[0]),y.length>1?G(y[1]):0),ROUNDDOWN:y=>{const c=10**(y.length>1?G(y[1]):0),m=G(y[0])*c;return(m<0?Math.ceil(m):Math.floor(m))/c},ROUNDUP:y=>{const c=10**(y.length>1?G(y[1]):0),m=G(y[0])*c;return(m<0?Math.floor(m):Math.ceil(m))/c},ABS:y=>Math.abs(G(y[0])),FLOOR:y=>Math.floor(G(y[0])),CEILING:y=>Math.ceil(G(y[0])),SQRT:y=>Math.sqrt(G(y[0])),POWER:y=>G(y[0])**G(y[1]),MOD:y=>{const c=G(y[1]);if(c===0)throw new N("MOD by zero");return(G(y[0])%c+c)%c},IF:y=>L(y[0])?y[1]:y.length>2?y[2]:!1,AND:y=>y.every(L),OR:y=>y.some(L),NOT:y=>!L(y[0]),COALESCE:y=>y.find(c=>c!=null&&c!=="")??null,CONCAT:y=>y.map(F).join(""),LEN:y=>F(y[0]).length,UPPER:y=>F(y[0]).toUpperCase(),LOWER:y=>F(y[0]).toLowerCase(),TRIM:y=>F(y[0]).trim(),LEFT:y=>F(y[0]).slice(0,y.length>1?G(y[1]):1),RIGHT:y=>{const c=y.length>1?G(y[1]):1;return c<=0?"":F(y[0]).slice(-c)},MEDIAN:y=>x(Z(y),.5),PERCENTILE:y=>{const c=G(y[y.length-1]);return x(Z(y.slice(0,-1)),c>1?c/100:c)},QUARTILE1:y=>x(Z(y),.25),QUARTILE3:y=>x(Z(y),.75),STDEV:y=>Y(Z(y),!0),STDEVP:y=>Y(Z(y),!1),VAR:y=>{const c=Y(Z(y),!0);return c*c},VARP:y=>{const c=Y(Z(y),!1);return c*c},COUNTDISTINCT:y=>{const c=new Set;for(const m of y){const s=Array.isArray(m)?m:[m];for(const t of s)t!=null&&t!==""&&c.add(t)}return c.size},IQR:y=>{const c=Z(y);return x(c,.75)-x(c,.25)}};$.AVG=$.AVERAGE,$.CEIL=$.CEILING,$.POW=$.POWER,$.STDEVS=$.STDEV,$.PERCENTILEINC=$.PERCENTILE;function j(y,c){const m=Number(y),s=Number(c);if(y!==null&&y!==""&&c!==null&&c!==""&&Number.isFinite(m)&&Number.isFinite(s))return m<s?-1:m>s?1:0;const o=F(y).toLowerCase(),u=F(c).toLowerCase();return o<u?-1:o>u?1:0}function k(y,c={}){const m=typeof c.lookup=="function"?c.lookup:null,s=c.functions?{...$,...c.functions}:$,t=o=>{switch(o.kind){case"num":return o.value;case"str":return o.value;case"ref":{if(!m)throw new N(`there is no column called ${JSON.stringify(o.name)} here`);const u=m(String(o.name));if(u===void 0)throw new N(`there is no column called ${JSON.stringify(o.name)}`);return u}case"unary":{if(o.op==="%")return G(t(o.arg))/100;const u=G(t(o.arg));return o.op==="-"?-u:u}case"bin":{const u=o.op;if(u==="=")return j(t(o.left),t(o.right))===0;if(u==="<>")return j(t(o.left),t(o.right))!==0;if(u==="<")return j(t(o.left),t(o.right))<0;if(u==="<=")return j(t(o.left),t(o.right))<=0;if(u===">")return j(t(o.left),t(o.right))>0;if(u===">=")return j(t(o.left),t(o.right))>=0;const d=G(t(o.left)),i=G(t(o.right));if(u==="+")return d+i;if(u==="-")return d-i;if(u==="*")return d*i;if(u==="^")return d**i;if(u==="/"){if(i===0)throw new N("division by zero");return d/i}throw new N(`unknown operator ${JSON.stringify(u)}`)}case"call":{const u=c.lazy&&c.lazy[o.name];if(typeof u=="function")return u(o.args,t,c);const d=s[o.name];if(typeof d!="function")throw new N(`there is no function called ${o.name}`);return d(o.args.map(t),c)}default:throw new N("the formula could not be read")}};return t(y)}}),He("packages/core/src/formula/index.js",function(e,D){"use strict";Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return j}});const re=D("packages/core/src/formula/parse.js"),N=re.parseFormula,G=re.referencesOf,F=re.looksLikeFormula,L=re.FormulaError,Z=re.tokenise,z=D("packages/core/src/formula/evaluate.js"),x=z.evaluateAst,Y=z.FUNCTIONS;function $(k){const{grid:y,row:c,data:m}=k||{},s=i=>String(i).toLowerCase().replace(/[\s_-]/g,""),t=y&&y.columns&&typeof y.columns.all=="function"?y.columns.all():[],o=y&&y.permissions,u=o&&typeof o.isReadable=="function"?i=>o.isReadable(i):()=>!0,d=new Set;for(const i of t)u(i)||(d.add(s(i.id)),i.field&&d.add(s(i.field)),i.title&&d.add(s(i.title)));return i=>{const g=s(i);if(d.has(g))throw new L(`"${i}" cannot be read`);for(const r of t)if(s(r.id)===g||r.field&&s(r.field)===g||r.title&&s(r.title)===g)return c&&y.rows&&typeof y.rows.value=="function"?y.rows.value(c.key,r.id):m?m[r.field||r.id]:void 0;if(m&&typeof m=="object"){for(const r of Object.keys(m))if(s(r)===g){if(!u(r))throw new L(`"${i}" cannot be read`);return m[r]}}}}function j(k,y={}){try{const c=N(k);return{ok:!0,value:x(c,{lookup:$(y),functions:y.formulaFunctions}),references:G(c)}}catch(c){return{ok:!1,error:c instanceof L?c.message:"the formula could not be read",at:c instanceof L?c.at:void 0}}}}),He("packages/core/src/internal/version.js",function(e,D){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return G}});const re="1.111.5";async function N(){return re}const G="1.111.5"}),He("packages/core/src/internal/merge.js",function(e,D){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"mergeRow",{enumerable:!0,get:function(){return z}});const N=D("packages/core/src/internal/predicates.js").isObject;function G(x,Y,$){if(x!==void 0)return x===!0?{enabled:!0,...$}:x===!1?{enabled:!1}:N(x)?x:{[Y]:x,enabled:!0}}function F(x){return x==null?[]:Array.isArray(x)?x:[x]}const L=Object.freeze(new Set(["__proto__","constructor","prototype"]));function Z(x,Y){if(!N(x))return N(Y)?{...Y}:Y;if(!N(Y))return Y===void 0?x:Y;const $={...x};for(const j of Object.keys(Y)){if(L.has(j))continue;const k=Y[j];k!==void 0&&($[j]=N(k)&&N($[j])?Z($[j],k):k)}return $}function z(x,Y){if(!N(x)||!N(Y)||x===Y)return Y;const $=Object.create(Object.getPrototypeOf(x));return Object.assign($,x,Y),$}}),He("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 G}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return z}});function re(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const N=typeof requestAnimationFrame=="function";function G(x){return N?requestAnimationFrame(x):setTimeout(()=>x(re()),16)}function F(x){x!=null&&(N?cancelAnimationFrame(x):clearTimeout(x))}function L(x){let Y=null,$=null;const j=()=>{Y=null;const y=$;$=null,x(...y||[])},k=(...y)=>{$=y,Y===null&&(Y=G(j))};return k.cancel=()=>{F(Y),Y=null,$=null},k.flush=()=>{Y!==null&&(F(Y),j())},k}function Z(x,Y){let $=null,j=null;const k=()=>{if($=null,j===null)return;const m=j;j=null,x(...m),y()},y=()=>{$=setTimeout(k,Y),typeof $?.unref=="function"&&$.unref()},c=(...m)=>{$===null?(x(...m),y()):(j=m,clearTimeout($),y())};return c.flush=()=>{if($!==null&&clearTimeout($),$=null,j===null)return;const m=j;j=null,x(...m)},c.cancel=()=>{$!==null&&clearTimeout($),$=null,j=null},c.pending=()=>$!==null||j!==null,c}function z(x,Y=50){return typeof requestIdleCallback=="function"?requestIdleCallback(x,{timeout:Y}):setTimeout(()=>x({timeRemaining:()=>0,didTimeout:!0}),1)}}),He("packages/core/src/internal/paths.js",function(e,D){"use strict";Object.defineProperty(e,"pathGetter",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"pathSetter",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"getPath",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return Z}});const re=new Map;function N(z){let x=re.get(z);if(x)return x;if(!z.includes("."))x=Y=>Y?.[z];else{const Y=z.split("."),$=Y.length;x=j=>{let k=j;for(let y=0;y<$;y++){if(k==null)return;k=k[Y[y]]}return k}}return re.set(z,x),x}const G=new Map;function F(z){let x=G.get(z);if(x)return x;if(!z.includes("."))x=(Y,$)=>{Y!=null&&(Y[z]=$)};else{const Y=z.split("."),$=Y.length-1;x=(j,k)=>{let y=j;for(let c=0;c<$;c++){if(y==null)return;const m=Y[c];y[m]==null&&(y[m]={}),y=y[m]}y!=null&&(y[Y[$]]=k)}}return G.set(z,x),x}function L(z,x){return N(x)(z)}function Z(z,x,Y){F(x)(z,Y)}}),He("packages/core/src/internal/compare.js",function(e,D){"use strict";Object.defineProperty(e,"collator",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"defaultCompare",{enumerable:!0,get:function(){return G}});const re=new Map;function N(F,L){const Z=`${F||""}|${L?JSON.stringify(L):""}`;let z=re.get(Z);return z||(z=new Intl.Collator(F||void 0,{numeric:!0,sensitivity:"variant",...L}),re.set(Z,z)),z}function G(F,L){if(F===L)return 0;if(F==null)return 1;if(L==null)return-1;if(typeof F=="number"&&typeof L=="number")return Number.isNaN(F)?Number.isNaN(L)?0:1:Number.isNaN(L)||F<L?-1:F>L?1:0;const Z=String(F),z=String(L);return Z<z?-1:Z>z?1:0}}),He("packages/core/src/defaults.js",function(e,D){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return j}});const N=D("packages/core/src/internal/predicates.js").isObject,F=D("packages/core/src/internal/merge.js").merge,Z=D("packages/core/src/internal/warn.js").warnOnce;let z=null;class x extends Error{}function Y(k,y=new Set){if(Array.isArray(k)){if(y.has(k))throw new x;y.add(k);const m=k.map(s=>Y(s,y));return y.delete(k),m}if(!N(k)||Object.getPrototypeOf(k)!==Object.prototype&&Object.getPrototypeOf(k)!==null)return k;if(y.has(k))throw new x;y.add(k);const c={};for(const[m,s]of Object.entries(k))c[m]=Y(s,y);return y.delete(k),c}function $(k){if(k===void 0)return Y(z??{});if(k===null)return z=null,{};if(!N(k))return Z("defaults:type",`defaults() expects a configuration object, or null to clear it, but got ${Array.isArray(k)?"an array":typeof k}. The call was ignored and the defaults are unchanged.`),Y(z??{});try{z=Y(k)}catch(y){if(!(y instanceof x))throw y;return Z("defaults:cyclic","defaults() expects a configuration object with no circular references, but the object passed refers back to itself. The call was ignored and the defaults are unchanged."),Y(z??{})}return Y(z)}function j(k){return z===null?k:F(Y(z),k)}}),He("packages/core/src/internal/uid.js",function(e,D){"use strict";Object.defineProperty(e,"uid",{enumerable:!0,get:function(){return N}});let re=0;function N(G="l"){return`${G}${(++re).toString(36)}`}}),He("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 G}});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"]),N=new Set(re);function G(F){return F==="*"||N.has(F)}}),He("packages/core/src/events/bus.js",function(e,D){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return m}});const re=D("packages/core/src/internal/warn.js"),N=re.warnOnce,G=re.DEV,L=D("packages/core/src/internal/uid.js").uid,z=D("packages/core/src/events/names.js").isKnownEvent,x="*";function Y(s,t){!G||z(t)||N(`bus.unknown:${t}`,`${s}('${t}') subscribes to an event the grid never raises, so the handler will never fire. Check the name against the EventName list — a common cause is a near miss such as 'row:click' for 'row:clicked'.`)}const $=new Set(["api","user","init","ai"]),j=new WeakMap;function k(s){let t=j.get(s);return t||(t=L("h"),j.set(s,t)),t}function y(){return typeof performance=="object"&&performance?performance.now():Date.now()}function c(s){if(!s||typeof s!="object")return{};const t={};for(const[o,u]of Object.entries(s))o!=="grid"&&(u==null?t[o]=String(u):Array.isArray(u)?t[o]=`[${u.length}]`:typeof u=="object"?t[o]=u.key?`row ${u.key}`:"{…}":typeof u=="function"?t[o]="[function]":t[o]=String(u).slice(0,60));return t}class m{#e=new Map;#t=!1;#n=[];#r=200;#i=new Map;#s=null;#o=!1;#l=0;constructor(t=null){this.#s=t}attach(t){this.#s=t}get grid(){return this.#s}get destroyed(){return this.#o}on(t,o){if(typeof o!="function")return N(`bus.handler:${t}`,`on('${t}') needs a function; ignored.`),()=>{};Y("on",t);let u=this.#e.get(t);return u||(u=[],this.#e.set(t,u)),u.push(o),()=>this.off(t,o)}once(t,o){if(typeof o!="function")return N(`bus.handler:${t}`,`once('${t}') needs a function; ignored.`),()=>{};Y("once",t);const u=d=>{this.off(t,o),o(d)};return this.#i.set(o,u),this.on(t,u)}off(t,o){if(o===void 0){this.#e.delete(t);return}const u=this.#e.get(t);if(!u)return;const d=this.#i.get(o),i=d&&u.includes(d)?d:o,g=u.indexOf(i);g>=0&&u.splice(g,1),d&&i===d&&this.#i.delete(o),u.length===0&&this.#e.delete(t)}count(t){const o=this.#e.get(t),u=t===x?null:this.#e.get(x);return(o?o.length:0)+(u?u.length:0)}#a(t,o,u,d,i){this.#n.push({type:t,origin:o,listeners:(d?d.length:0)+(i?i.length:0),payload:c(u),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(t,o){this.#t=!!t,Number.isFinite(o)&&o>0&&(this.#r=Math.floor(o)),t||(this.#n=[])}eventLog(){return this.#n.map(t=>({...t}))}clearEventLog(){this.#n=[]}counts(){const t={};for(const[o,u]of this.#e)t[o]=u.length;return t}emit(t,o,u){const d=u??(o&&o.origin),i=$.has(d)?d:"api",g={...o||null,type:t,origin:i,grid:this.#s};if(this.#o)return g;const r=this.#e.get(t),n=t===x?void 0:this.#e.get(x);if(this.#t&&this.#a(t,i,o,r,n),!r&&!n)return g;const f=this.#t?y():0;this.#l++;try{r&&this.#c(r.slice(),g,t),n&&this.#c(n.slice(),g,x)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=y()-f)}return g}emitBefore(t,o,u){const d=u??(o&&o.origin),i=$.has(d)?d:"user";let g=!1,r=null;const n=p=>{g=!0,p!=null&&r===null&&(r=String(p))},f={...o||null,type:t,origin:i,grid:this.#s,get defaultPrevented(){return g},get reason(){return r},preventDefault(p){n(p)}};if(this.#o)return!0;const h=this.#e.get(t);this.#t&&this.#a(t,i,o,h,void 0);const l=h?h.slice():[];if(l.length===0)return!0;const b=()=>(g&&r===null&&(r="prevented"),g&&o&&typeof o=="object"&&(o.reason=r),!g),a=[];for(const p of l)try{const w=p(f);w&&typeof w.then=="function"?a.push(w):w===!1&&n("prevented")}catch(w){n("error"),N(`bus.beforeThrow:${t}:${k(p)}`,`a '${t}' before-handler threw; the action was cancelled.`,w)}return a.length===0?b():Promise.allSettled(a).then(p=>{for(const w of p)w.status==="rejected"?(n("error"),N(`bus.beforeReject:${t}`,`a '${t}' before-handler rejected; the action was cancelled.`,w.reason)):w.value===!1&&n("prevented");return b()})}#c(t,o,u){for(let d=0;d<t.length;d++)try{t[d](o)}catch(i){N(`bus.throw:${u}:${k(t[d])}`,`a '${u}' handler threw; other handlers were unaffected.`,i)}}clear(){this.#e.clear(),this.#i.clear()}destroy(){this.clear(),this.#o=!0,this.#s=null}}}),He("packages/core/src/registry/free-tier-notice.js",function(e,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 N}});const re="Free for non-commercial use: latticegrid.dev/free",N="Unlicensed: Lattice Grid trial"}),He("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 Z}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"fromBase64Url",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"toBase64Url",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"asciiBytes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"parseLicence",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"hasEd25519",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"verifyLicence",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isLocalHost",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"currentHost",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"matchesDomain",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LicenceHolder",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"setLicence",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return S}});const N=D("packages/core/src/internal/warn.js").warnOnce,G=D("packages/core/src/registry/free-tier-notice.js"),F=G.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return G.FREE_TIER_NOTICE}});const L="lattice-grid",Z=1,z="LG1",x=64,Y="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",j=(()=>{const E=new Int16Array(128).fill(-1);for(let O=0;O<$.length;O++)E[$.charCodeAt(O)]=O;return E[43]=62,E[47]=63,E})();function k(E){if(typeof E!="string")return null;let O="";for(let X=0;X<E.length;X++){const q=E.charCodeAt(X);if(q!==61){if(q>127||j[q]<0)return null;O+=E[X]}}const M=O.length;if(M%4===1)return null;const T=new Uint8Array(Math.floor(M*3/4));let A=0,I=0,U=0;for(let X=0;X<M;X++)A=A<<6|j[O.charCodeAt(X)],I+=6,I>=8&&(I-=8,T[U++]=A>>I&255);return U===T.length?T:T.subarray(0,U)}function y(E){let O="",M=0;for(;M+2<E.length;M+=3){const A=E[M]<<16|E[M+1]<<8|E[M+2];O+=$[A>>18&63]+$[A>>12&63]+$[A>>6&63]+$[A&63]}const T=E.length-M;if(T===1){const A=E[M]<<16;O+=$[A>>18&63]+$[A>>12&63]}else if(T===2){const A=E[M]<<16|E[M+1]<<8;O+=$[A>>18&63]+$[A>>12&63]+$[A>>6&63]}return O}function c(E){const O=new Uint8Array(E.length);for(let M=0;M<E.length;M++)O[M]=E.charCodeAt(M)&127;return O}function m(E){if(typeof TextDecoder=="function")return new TextDecoder().decode(E);let O="";for(let M=0;M<E.length;M++)O+=String.fromCharCode(E[M]);return O}function s(E){const O={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof E=="string"?E:""};if(typeof E!="string"||E.length===0)return{...O,reason:"missing"};const M=E.trim(),T=M.split(".");if(T.length!==3)return O;const[A,I,U]=T;if(A!==z)return{...O,reason:"prefix"};const X=k(I),q=k(U);if(!X||!q)return O;let _;try{_=JSON.parse(m(X))}catch{return O}return _===null||typeof _!="object"?O:{ok:!0,reason:null,product:typeof _.p=="string"?_.p:null,issuedTo:typeof _.t=="string"?_.t:null,expires:typeof _.e=="string"?_.e:null,terms:typeof _.terms=="string"?_.terms:null,features:Array.isArray(_.f)?_.f.slice():[],deployments:Array.isArray(_.d)?_.d.slice():[],version:typeof _.v=="number"?_.v:0,message:c(I),signature:q,raw:M}}function t(E,O){if(!E)return!1;const M=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(E)?`${E}T23:59:59.999Z`:E);return Number.isNaN(M)?!0:O>M}function o(E){return E==="non-commercial"?"non-commercial":"commercial"}let u=null,d=null,i=null;function g(){const E=globalThis.crypto;return E&&E.subtle?E.subtle:null}async function r(E){if(u&&d===E)return u;const O=g();if(!O)return null;const M=k(E);if(!M)return null;try{const T=await O.importKey("raw",M,{name:"Ed25519"},!1,["verify"]);return u=T,d=E,T}catch{return null}}async function n(){return i!==null||(i=await r(Y)!==null),i}async function f(E,O={}){const M=O.warn!==!1,T=O.product||L,A=O.publicKey||Y,I=O.now??Date.now(),U=O.host??l(),X=h(U)?"":` ${F}`,q=s(E);if(!q.ok){const J=q.reason==="missing"?"missing":"malformed";return M&&N(`licence.${J}`,J==="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.${X}`:`licence key could not be read. The grid will render with a watermark.${X}`),{valid:!1,reason:J,terms:"commercial"}}const _={product:q.product||void 0,issuedTo:q.issuedTo||void 0,expires:q.expires||void 0,terms:o(q.terms)};if(q.product!==T)return M&&N("licence.product",`licence key is for '${q.product}', not '${T}'. The grid will render with a watermark.`),{valid:!1,..._,reason:"product"};if(t(q.expires,I))return M&&N("licence.expired",`licence expired on ${q.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,..._,reason:"expired"};const H=q.deployments||[];if(H.length&&U&&!h(U)&&!b(U,H))return M&&N("licence.domain",`licence key is not valid for ${U}; it covers ${H.join(", ")}. The grid will render with a watermark.`),{valid:!1,..._,reason:"domain"};const ee=await r(A);if(!ee){const J=!!q.signature&&q.signature.length===x;return M&&N("licence.algorithm","this host does not provide crypto.subtle Ed25519, so the licence signature could not be verified. A structural check was used instead."),J?{valid:!0,..._,reason:"unverified"}:{valid:!1,..._,reason:"signature"}}let te=!1;try{te=await g().verify({name:"Ed25519"},ee,q.signature,q.message)}catch{te=!1}return te?{valid:!0,..._}:(M&&N("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,..._,reason:"signature"})}function h(E){const O=String(E??l()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!O||O==="localhost"||O.endsWith(".localhost")||O==="::1"||O==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(O)}function l(){const E=globalThis.location;return E&&typeof E.hostname=="string"?E.hostname:null}function b(E,O){const M=a(E);return!M||!Array.isArray(O)?!1:O.some(T=>{const A=a(T);if(!A)return!1;if(A==="*")return!0;if(A.startsWith("*.")){const I=A.slice(2);return M===I||M.endsWith(`.${I}`)}return M===A})}function a(E){return String(E??"").trim().toLowerCase().replace(/\.$/,"")}class p{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#i;#s=new Set;constructor(O={}){this.#i=O}set(O){this.#e=typeof O=="string"?O.trim():"";const M=s(this.#e);return this.#t=M.ok?{valid:!t(M.expires,Date.now())&&M.product===(this.#i.product||L),product:M.product||void 0,issuedTo:M.issuedTo||void 0,expires:M.expires||void 0,terms:o(M.terms),reason:"pending"}:{valid:!1,reason:M.reason||"malformed",terms:"commercial"},this.#n=null,this.#e&&this.verify(),this.#t}verify(){if(this.#n)return this.#n;const O=this.#e;return this.#n=f(O,this.#i).then(M=>{if(this.#e===O){this.#t=M;for(const T of this.#s)T(M)}return M}),this.#n}onSettled(O){return this.#s.add(O),()=>this.#s.delete(O)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!h(this.#r)}setHost(O){this.#r=O}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.#s.clear()}}const w=Symbol.for("lattice-grid/licence/holder");function v(){const E=globalThis,O=E&&E[w];if(O&&typeof O.set=="function"&&typeof O.watermark=="function")return O;const M=new p;if(E)try{E[w]=M}catch{}return M}const P=v();function V(E){return P.set(E)}function W(){return P.info()}function K(){return P.watermark()}function R(){return P.state()}function S(){return P}}),He("packages/core/src/registry/registry.js",function(e,D){"use strict";Object.defineProperty(e,"KINDS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"REGIONS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return u}});const re=D("packages/core/src/internal/warn.js"),N=re.warnOnce,G=re.DEV,L=D("packages/core/src/internal/predicates.js").isFunction,Z=D("packages/core/src/registry/licence.js"),z=Z.LicenceHolder,x=Z.sharedLicence,Y=["renderer","editor","filter","dataType","totalFn","pipe","component"],$=["all","header","body","totals","panels"];class j{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#i;#s=null;#o=null;#l=new Set;#a=new Map;constructor(i={}){for(const g of Y)this.#t.set(g,new Map);this.#i=i.holder||x(),this.#o=i.grid??null,this.#s=this.#i.onSettled(()=>{this.#f({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),i.licence&&this.setLicence(i.licence)}registerModules(i,g={}){g.licence&&this.setLicence(g.licence),g.grid!==void 0&&(this.#o=g.grid);const r=Array.isArray(i)?i:[i],n=[];for(const f of r){if(!f||typeof f!="object"||typeof f.name!="string"||!f.name){N("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(f.name)){G&&this.#u(this.#e.get(f.name),f);continue}if(!L(f.install)){N(`registry.module.install:${f.name}`,`module '${f.name}' has no install() and was ignored.`);continue}const h={registry:this,grid:this.#o};try{f.install(h)}catch(l){N(`registry.module.throw:${f.name}`,`module '${f.name}' threw during install; it was not registered.`,l);continue}this.#e.set(f.name,f);for(const l of k(f))this.#n.add(l);n.push(f.name),this.#f({reason:"module",name:f.name,capabilities:this.capabilities(),regions:m(f)})}return n}unregisterModule(i){const g=this.#e.get(i);if(!g)return!1;if(L(g.uninstall))try{g.uninstall({registry:this,grid:this.#o})}catch(r){N(`registry.module.uninstall:${i}`,`module '${i}' threw during uninstall.`,r)}return this.#e.delete(i),this.#c(),this.#f({reason:"unmodule",name:i,capabilities:this.capabilities(),regions:m(g)}),!0}modules(){return[...this.#e.values()]}has(i){return this.#e.has(i)}#c(){this.#n.clear();for(const i of this.#e.values())for(const g of k(i))this.#n.add(g)}#u(i,g){!i||i===g||y(i,g)||N(`registry.module.reconfigure:${g.name}`,`module '${g.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(i){return this.#n.has(i)}onChange(i){return L(i)?(this.#r.add(i),this.#a.set(i,this.#o),()=>{this.#r.delete(i),this.#a.delete(i)}):()=>{}}#f(i){for(const g of[...this.#r])try{g(i)}catch(r){N("registry.onChange.throw","a registry change handler threw.",r)}}register(i,g,r){const n=this.#t.get(i);if(!n){N(`registry.kind:${i}`,`unknown registry kind '${i}'; expected one of ${Y.join(", ")}.`);return}if(!g||typeof g!="string"){N(`registry.name:${i}`,`register('${i}', ...) needs a name.`);return}n.has(g)&&n.get(g)!==r&&N(`registry.replace:${i}:${g}`,`'${g}' was already registered as a ${i} and has been replaced.`),n.set(g,r),this.#f({reason:"register",name:g,kind:i,capabilities:this.capabilities(),regions:s(i)})}registerAll(i,g){if(g)for(const r of Object.keys(g))this.register(i,r,g[r])}get(i,g){const r=this.#t.get(i);return r?r.get(g):void 0}names(i){const g=this.#t.get(i);return g?[...g.keys()]:[]}#d(i,g){const r=this.#t.get(i).get(g);return r!==void 0?r:this.#t.get("component").get(g)}renderer(i){return this.#d("renderer",i)}editor(i){return this.#d("editor",i)}filter(i){return this.#d("filter",i)}dataType(i){return this.get("dataType",i)}totalFn(i){return this.get("totalFn",i)}pipe(i){return this.get("pipe",i)}setLicence(i){return this.#i.set(i)}licence(){return this.#i.info()}licenceVerified(){return this.#i.verify()}watermark(){return this.#i.watermark()}attach(i){i!=null&&(this.#l.add(i),this.#o=i)}detach(i){if(i!=null){this.#l.delete(i);for(const[g,r]of[...this.#a])r===i&&(this.#r.delete(g),this.#a.delete(g));if(this.#o===i){const g=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#o=g}this.#l.size===0&&this.#s&&(this.#s(),this.#s=null)}}destroy(i){if(i!=null){this.detach(i);return}for(const g of[...this.#e.keys()])this.unregisterModule(g);this.#r.clear(),this.#a.clear(),this.#l.clear(),this.#s&&this.#s(),this.#s=null,this.#o=null}}function k(d){const i=d.capabilities,g=Array.isArray(i)?i.filter(r=>typeof r=="string"):[];return[d.name,...g]}function y(d,i){return d.install!==i.install||d.uninstall!==i.uninstall||(d.version||"")!==(i.version||"")?!1:c(k(d),k(i))&&c(m(d),m(i))}function c(d,i){const g=new Set(d),r=new Set(i);if(g.size!==r.size)return!1;for(const n of g)if(!r.has(n))return!1;return!0}function m(d){const i=d.regions;return!Array.isArray(i)||i.length===0?["all"]:i.filter(g=>$.includes(g))}function s(d){switch(d){case"filter":return["header"];case"totalFn":return["totals"];case"renderer":case"editor":case"pipe":return["body"];default:return["all"]}}const t=new j;function o(){return t}function u(d,i={}){return t.registerModules(d,i)}}),He("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 G}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return F}});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(/^./,z=>z.toUpperCase()):""}const N={"&":"&","<":"<",">":">",'"':""","'":"'"};function G(L){const Z=L==null?"":String(L);return/[&<>"']/.test(Z)?Z.replace(/[&<>"']/g,z=>N[z]):Z}function F(L){return String(L).replace(/\w\S*/g,Z=>Z[0].toUpperCase()+Z.slice(1).toLowerCase())}}),He("packages/core/src/format/mask.js",function(e,D){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return Z}});const re=new Set(["0","#","?",",","."]),N="\0";function G(x){const Y=[];let $="",j=!1;for(let k=0;k<x.length;k++){const y=x[k];if(y==="\\"){$+=y+(x[k+1]??""),k+=1;continue}if(y==='"'){j=!j,$+=y;continue}if(y===";"&&!j){Y.push($),$="";continue}$+=y}return Y.push($),Y}function F(x){let Y="",$="",j="",k=1,y=!1,c=!1;const m=n=>{c?$+=n:Y+=n};for(let n=0;n<x.length;n++){const f=x[n];if(f==="\\"){m(x[n+1]??""),n+=1;continue}if(f==='"'){const h=x.indexOf('"',n+1);m(h===-1?x.slice(n+1):x.slice(n+1,h)),n=h===-1?x.length:h;continue}if(f==="%"){k*=100,m("%");continue}if(f==="@"){y=!0,m("\0");continue}if(re.has(f)){j+=f,c=!0;continue}m(f)}let s=-1;for(let n=j.length-1;n>=0;n--){const f=j[n];if(f==="0"||f==="#"||f==="?"){s=n;break}}let t=!1,o="";for(let n=0;n<j.length;n++){const f=j[n];if(f===","){n>s?k/=1e3:t=!0;continue}o+=f}const u=o.indexOf("."),d=u===-1?o:o.slice(0,u),i=u===-1?"":o.slice(u+1);let g=0;for(const n of d)n==="0"&&(g+=1);let r=0;for(const n of i)n==="0"&&(r+=1);return{prefix:Y,suffix:$,minInt:g,minDec:r,maxDec:i.length,grouping:t,scale:k,hasNumber:s!==-1,isText:y}}function L(x,Y){const $=new Intl.NumberFormat(Y,{minimumIntegerDigits:Math.max(x.minInt,1),minimumFractionDigits:x.minDec,maximumFractionDigits:Math.max(x.maxDec,x.minDec),useGrouping:x.grouping}),{prefix:j,suffix:k,scale:y,hasNumber:c}=x;return m=>{if(!c)return j+k;const s=y===1?m:m*y;return j+$.format(s)+k}}function Z(x,Y){const j=G(String(x)).map(F),k=j.map(o=>L(o,Y)),y=0,c=j.length>1?1:-1,m=j.length>2?2:-1,s=j.length>3?3:-1,t=o=>{if(o==null||o==="")return"";if(typeof o!="number"||Number.isNaN(o)){const u=Number(o);if(Number.isNaN(u))return s===-1?String(o):(j[s].prefix+j[s].suffix).split("\0").join(String(o));o=u}return o===0&&m!==-1?k[m](0):o<0&&c!==-1?k[c](-o):k[y](o)};return t.spec={mask:x},{format:t,ooxml:z(String(x))}}function z(x){return x.trim()}}),He("packages/core/src/format/pattern.js",function(e,D){"use strict";Object.defineProperty(e,"parseNumberPattern",{enumerable:!0,get:function(){return L}});const N=D("packages/core/src/format/mask.js").splitSections;function G(Z){let z="",x="",Y="",$="",j=!1,k=!1,y=!1,c=!1;const m=t=>{y?x+=t:z+=t};for(let t=0;t<Z.length;t++){const o=Z[t];if(o==="\\"){m(Z[t+1]??""),t+=1;continue}if(o==='"'){const u=Z.indexOf('"',t+1);m(u===-1?Z.slice(t+1):Z.slice(t+1,u)),t=u===-1?Z.length:u;continue}if(o==="%"){k=!0;continue}if(o==="0"||o==="#"){y=!0,c?$+=o:Y+=o;continue}if(o===","){c||(j=!0);continue}if(o==="."&&!c){c=!0;continue}m(o)}if(!y)return{hasDigit:!1,prefix:z,suffix:x,minDec:0,maxDec:0,grouping:!1,percent:k};let s=0;for(const t of $)t==="0"&&(s+=1);return{hasDigit:!0,prefix:z,suffix:x,minDec:s,maxDec:$.length,grouping:j,percent:k}}function F(Z,z){const x=z.trim(),Y=Z.trim();return x.startsWith("(")&&x.endsWith(")")&&x.slice(1,-1).trim()===Y?"parentheses":x.endsWith("-")?"suffix":"minus"}function L(Z){if(typeof Z!="string")return null;const z=N(Z);if(z.length===0)return null;const x=G(z[0]);if(!x.hasDigit)return null;const Y={style:x.percent?"percent":"decimal",prefix:x.prefix,suffix:x.suffix,minDecimals:x.minDec,maxDecimals:Math.max(x.maxDec,x.minDec),thousandsSeparator:x.grouping?void 0:!1};if(z.length>1&&(Y.negative=F(z[0],z[1])),z.length>2){const $=G(z[2]);$.hasDigit||(Y.zeroDisplay=$.prefix+$.suffix)}return Y}}),He("packages/core/src/format/number.js",function(e,D){"use strict";Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return z}});const N=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/warn.js").warnOnce,Z=D("packages/core/src/format/pattern.js").parseNumberPattern;function z(x,Y){const $=typeof x=="string"?{pattern:x}:x||{};let j=$;if(typeof $.pattern=="string"){const v=Z($.pattern);if(v){const{pattern:P,...V}=$;j={...v,...V}}else F(`format:pattern:${$.pattern}`,`invalid number format pattern "${$.pattern}"; the value will use the default number format`)}const k=j.locale||Y||void 0,y=j.style||"decimal",c=typeof j.scale=="number"?j.scale:1,m=j.nullDisplay??"",s=j.zeroDisplay,t=j.prefix||"",o=j.suffix||"",u=j.negative||"minus",d=j.signed===!0,i={style:y,notation:j.notation||"standard"};y==="currency"&&(i.currency=j.currency||"USD",j.currencyDisplay&&(i.currencyDisplay=j.currencyDisplay)),typeof j.decimals=="number"?(i.minimumFractionDigits=j.decimals,i.maximumFractionDigits=j.decimals):(typeof j.minDecimals=="number"&&(i.minimumFractionDigits=j.minDecimals),typeof j.maxDecimals=="number"&&(i.maximumFractionDigits=j.maxDecimals),i.minimumFractionDigits>(i.maximumFractionDigits??20)&&(i.maximumFractionDigits=i.minimumFractionDigits)),j.thousandsSeparator===!1&&(i.useGrouping=!1),i.notation==="compact"&&(i.compactDisplay=j.compactDisplay||"short");const g=new Intl.NumberFormat(k,i),r=typeof j.thousandsSeparator=="string"?j.thousandsSeparator:null,n=typeof j.decimalSeparator=="string"?j.decimalSeparator:null;let f=",",h=".";if(r||n)for(const v of g.formatToParts(12345.6))v.type==="group"?f=v.value:v.type==="decimal"&&(h=v.value);const l=v=>{let P=v;return r&&(P=P.split(f).join("")),n&&(P=P.split(h).join("")),r&&(P=P.split("").join(r)),n&&(P=P.split("").join(n)),P},b=!!(r||n),a=t!==""&&y==="currency",p=v=>{let P;if(a){const V=g.formatToParts(v);let W=!1;P="";for(const K of V)P+=K.value,!W&&K.type==="currency"&&(P+=t,W=!0);W||(P=t+P)}else P=t+g.format(v);return b&&(P=l(P)),P+o},w=v=>{if(N(v)||v==="")return m;const P=typeof v=="number"?v:Number(v);if(Number.isNaN(P))return m;const V=c===1?P:P*c;return V===0&&s!==void 0?s:V<0?u==="parentheses"?`(${p(-V)})`:u==="suffix"?`${p(-V)}-`:p(V):d&&V>0?`+${p(V)}`:p(V)};return w.negativeClass=j.negativeClass||null,w.spec=j,w}}),He("packages/core/src/format/date.js",function(e,D){"use strict";Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return o}});const N=D("packages/core/src/internal/predicates.js").isNil,F=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 Z(u){const d=[];let i=0,g="";const r=()=>{g&&(d.push({token:null,text:g}),g="")};for(;i<u.length;){const n=u[i];if(n==="'"){if(u[i+1]==="'"){g+="'",i+=2;continue}const h=u.indexOf("'",i+1);if(h===-1){g+=u.slice(i+1),i=u.length;continue}g+=u.slice(i+1,h),i=h+1;continue}const f=L.find(h=>u.startsWith(h,i));if(f){r(),d.push({token:f,text:f}),i+=f.length;continue}/[A-Za-z]/.test(n)&&F(`date.pattern.token:${n}`,`the date pattern "${u}" contains '${n}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${L.join(" ")}.`),g+=n,i+=1}return r(),d}const z=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function x(u){if(N(u)||u==="")return null;if(u instanceof Date)return Number.isNaN(u.getTime())?null:u;if(typeof u=="number")return Number.isNaN(u)?null:new Date(u);if(typeof u=="string"){const d=z.exec(u.trim());if(d){const[,g,r,n,f="0",h="0",l="0"]=d;return new Date(+g,+r-1,+n,+f,+h,+l)}const i=new Date(u);return Number.isNaN(i.getTime())?null:i}return null}function Y(u,d){return String(u).padStart(d,"0")}function $(u){if(!u)return g=>({year:g.getFullYear(),month:g.getMonth()+1,day:g.getDate(),hour:g.getHours(),minute:g.getMinutes(),second:g.getSeconds(),ms:g.getMilliseconds(),weekday:g.getDay()});const d=new Intl.DateTimeFormat("en-US",{timeZone:u,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,weekday:"short"}),i={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};return g=>{const r={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:g.getMilliseconds(),weekday:0};for(const n of d.formatToParts(g))switch(n.type){case"year":r.year=Number(n.value);break;case"month":r.month=Number(n.value);break;case"day":r.day=Number(n.value);break;case"hour":r.hour=Number(n.value)%24;break;case"minute":r.minute=Number(n.value);break;case"second":r.second=Number(n.value);break;case"weekday":r.weekday=i[n.value]??0;break;default:break}return r}}function j(u,d,i){const g=Z(u),r=$(i),n=new Set(g.filter(a=>a.token).map(a=>a.token)),f=n.has("MMM")?new Intl.DateTimeFormat(d,{month:"short",timeZone:i}):null,h=n.has("MMMM")?new Intl.DateTimeFormat(d,{month:"long",timeZone:i}):null,l=n.has("EEE")?new Intl.DateTimeFormat(d,{weekday:"short",timeZone:i}):null,b=n.has("EEEE")?new Intl.DateTimeFormat(d,{weekday:"long",timeZone:i}):null;return a=>{const p=r(a);let w="";for(const v of g){if(!v.token){w+=v.text;continue}switch(v.token){case"yyyy":w+=Y(p.year,4);break;case"yy":w+=Y(p.year%100,2);break;case"MMMM":w+=h.format(a);break;case"MMM":w+=f.format(a);break;case"MM":w+=Y(p.month,2);break;case"M":w+=String(p.month);break;case"dd":w+=Y(p.day,2);break;case"d":w+=String(p.day);break;case"EEEE":w+=b.format(a);break;case"EEE":w+=l.format(a);break;case"HH":w+=Y(p.hour,2);break;case"H":w+=String(p.hour);break;case"hh":w+=Y(p.hour%12===0?12:p.hour%12,2);break;case"h":w+=String(p.hour%12===0?12:p.hour%12);break;case"mm":w+=Y(p.minute,2);break;case"m":w+=String(p.minute);break;case"ss":w+=Y(p.second,2);break;case"s":w+=String(p.second);break;case"SSS":w+=Y(p.ms,3);break;case"a":w+=p.hour<12?"AM":"PM";break;default:w+=v.text;break}}return w}}const k=[["year",365*24*36e5],["month",720*36e5],["week",168*36e5],["day",24*36e5],["hour",36e5],["minute",6e4],["second",1e3]];function y(u,d){const i=u||{},g=i.locale||d||void 0,r=i.nullDisplay??"",n=i.timeZone;let f;if(i.pattern)f=j(i.pattern,g,n);else if(i.dateStyle||i.timeStyle){const p={timeZone:n};i.dateStyle&&(p.dateStyle=i.dateStyle),i.timeStyle&&(p.timeStyle=i.timeStyle);const w=new Intl.DateTimeFormat(g,p);f=v=>w.format(v)}else{const p=new Intl.DateTimeFormat(g,{dateStyle:"medium",timeZone:n});f=w=>p.format(w)}const h=i.relative?new Intl.RelativeTimeFormat(g,{numeric:"auto"}):null,b=(typeof i.relative=="object"&&i.relative?i.relative.threshold??7:7)*24*36e5,a=(p,w)=>{const v=x(p);if(!v)return r;if(h){const P=w&&typeof w.now=="number"?w.now:Date.now(),V=v.getTime()-P;if(Math.abs(V)<b){for(const[W,K]of k)if(Math.abs(V)>=K||W==="second")return h.format(Math.round(V/K),W)}}return f(v)};return a.spec=i,a}function c(u){if(N(u)||u==="")return null;if(typeof u=="string"){const g=/^(\d{4}-\d{2}-\d{2})/.exec(u.trim());if(g)return g[1];const r=x(u);return r?c(r):null}const d=x(u);if(!d)return null;const i=g=>String(g).padStart(2,"0");return`${d.getFullYear()}-${i(d.getMonth()+1)}-${i(d.getDate())}`}function m(u,d){if(N(u)||u==="")return null;if(typeof u=="string"){const g=u.trim();if(s.test(g)){const f=x(g);return f?t(f,d):null}const r=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(g);if(r){const[,f,h,l,b]=r;return`${f}T${h}:${l}${b&&b!=="00"?`:${b}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(g))return`${g}T00:00`;const n=x(g);return n?m(n):null}const i=x(u);return i?t(i,d):null}const s=/(?:Z|[+-]\d{2}:?\d{2})$/i;function t(u,d){const i=f=>String(f).padStart(2,"0");if(d)try{const f=new Intl.DateTimeFormat("en-CA",{timeZone:d,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(u).reduce((b,a)=>(a.type!=="literal"&&(b[a.type]=a.value),b),{}),h=f.hour==="24"?"00":f.hour,l=Number(f.second);return`${f.year}-${f.month}-${f.day}T${h}:${f.minute}`+(l?`:${f.second}`:"")}catch{}const g=`${u.getFullYear()}-${i(u.getMonth()+1)}-${i(u.getDate())}`,r=u.getSeconds(),n=`${i(u.getHours())}:${i(u.getMinutes())}${r?`:${i(r)}`:""}`;return`${g}T${n}`}function o(u,d){const i=N(u)||u===""?null:String(u),g=N(d)||d===""?null:String(d);return i===null?g===null?0:1:g===null||i<g?-1:i>g?1:0}}),He("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 Z}});const N=D("packages/core/src/internal/predicates.js").isNil,G={true:"☑",false:"☐",null:""},F={true:"◉",false:"◯",null:""};function L(z){if(N(z)||z==="")return null;if(typeof z=="boolean")return z;if(typeof z=="number")return z!==0;const x=String(z).trim().toLowerCase();return x==="true"||x==="yes"||x==="y"||x==="1"?!0:x==="false"||x==="no"||x==="n"||x==="0"?!1:null}function Z(z,x){const Y=z||{},$=Y.display||"text",j=Y.trueLabel??"Yes",k=Y.falseLabel??"No",y=Y.nullLabel??"";let c=j,m=k;const s=y;$==="checkbox"?(c=G.true,m=G.false):$==="switch"?(c=F.true,m=F.false):$==="icon"&&(c=Y.trueIcon??j,m=Y.falseIcon??k);const t=o=>{const u=L(o);return u===null?s:u?c:m};return t.display=$,t.labels={true:j,false:k,null:y},t.locale=x,t.spec=Y,t}}),He("packages/core/src/format/text.js",function(e,D){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return L}});const N=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/text.js").titleCase;function L(Z,z){const x=Z||{},Y=x.locale||z||void 0,$=x.nullDisplay??"",j=x.emptyDisplay??"",k=x.transform||"none",y=typeof x.truncate=="number"?{chars:x.truncate}:x.truncate||null,c=y?y.chars:0,m=y?y.ellipsis??"…":"",s=o=>{switch(k){case"upper":return Y?o.toLocaleUpperCase(Y):o.toUpperCase();case"lower":return Y?o.toLocaleLowerCase(Y):o.toLowerCase();case"title":return F(o);default:return o}},t=o=>{if(N(o))return $;let u=typeof o=="string"?o:String(o);return u===""?j:(k!=="none"&&(u=s(u)),c>0&&u.length>c&&(u=u.slice(0,c)+m),u)};return t.spec=x,t}}),He("packages/core/src/format/shorthand.js",function(e,D){"use strict";Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return z}});const re=["currency","number","percent","date","boolean","text","relative"],N=/[#0?@;"\\]/,G=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function F(x){return typeof x!="string"||x===""||Z(x)?!1:N.test(x)}function L(x){return typeof x!="string"||x===""||Z(x)?!1:G.test(x)}function Z(x){const Y=x.indexOf(":"),$=Y===-1?x:x.slice(0,Y);return re.includes($)?$:null}function z(x){const Y=Z(x);if(!Y)return null;const $=x.indexOf(":"),j=$===-1?"":x.slice($+1),k=j===""?[]:j.split(":");switch(Y){case"currency":{const y={type:"number",style:"currency",currency:k[0]||"USD"};return k[1]!==void 0&&k[1]!==""&&(y.decimals=Number(k[1])),y}case"number":{const y={type:"number",style:"decimal"};return k[0]!==void 0&&k[0]!==""&&(y.decimals=Number(k[0])),y}case"percent":{const y={type:"number",style:"percent"};return k[0]!==void 0&&k[0]!==""&&(y.decimals=Number(k[0])),y}case"date":return{type:"date",pattern:j||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const y=j.split("/"),c={type:"boolean",display:"text"};return y[0]!==void 0&&y[0]!==""&&(c.trueLabel=y[0]),y[1]!==void 0&&y[1]!==""&&(c.falseLabel=y[1]),y[2]!==void 0&&(c.nullLabel=y[2]),c}case"text":{const y={type:"text"};return k[0]&&(y.transform=k[0]),k[1]!==void 0&&k[1]!==""&&(y.truncate=Number(k[1])),y}default:return null}}}),He("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"),N=re.isFunction,G=re.isObject,L=D("packages/core/src/internal/warn.js").warnOnce,Z=D("packages/core/src/format/number.js"),z=Z.compileNumber,x=D("packages/core/src/format/date.js"),Y=x.compileDate,$=x.scanPattern,j=D("packages/core/src/format/boolean.js"),k=j.compileBoolean,y=D("packages/core/src/format/text.js"),c=y.compileText,m=D("packages/core/src/format/mask.js"),s=m.compileMask,t=D("packages/core/src/format/shorthand.js"),o=t.parseShorthand,u=t.looksLikeMask,d=t.looksLikeDatePattern,g=D("packages/core/src/format/pattern.js").parseNumberPattern;Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return Z.compileNumber}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return x.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return x.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return x.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return x.toDate}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return j.compileBoolean}}),Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return j.toTriState}}),Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return y.compileText}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return m.compileMask}}),Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return m.splitSections}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return m.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 r=new Set(["decimal","currency","percent","unit"]),n=new Set(["type","locale"]),f={number:new Set(["style","currency","currencyDisplay","decimals","minDecimals","maxDecimals","thousandsSeparator","decimalSeparator","notation","compactDisplay","negative","negativeClass","signed","prefix","suffix","zeroDisplay","nullDisplay","messages","scale","pattern"]),date:new Set(["pattern","dateStyle","timeStyle","timeZone","relative","nullDisplay"]),boolean:new Set(["display","trueLabel","falseLabel","nullLabel","trueIcon","falseIcon"]),text:new Set(["transform","truncate","nullDisplay","emptyDisplay"])},h=new Set(["number","date","boolean","text"]);function l(R,S){const E=R.type;if(E===void 0||h.has(E)||!r.has(String(E)))return;const O=S?`"${S}"`:"with no id";L(`format:unknown-style-key:${S||""}:${E}`,`column ${O} has format: { type: "${E}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${E}" instead?`)}function b(R,S,E){const O=f[S],M=E?`"${E}"`:"with no id";for(const T of R){if(n.has(T)||O.has(T))continue;const A=Object.keys(f).find(I=>I!==S&&f[I].has(T));A?L(`format:inapplicable:${E||""}:${T}`,`column ${M} has format key "${T}", which applies to a ${A} column, not the ${S} column it was applied to; it is ignored.`):L(`format:unknown:${E||""}:${T}`,`column ${M} has an unrecognised format key "${T}" for its ${S} format; it is ignored.`)}}function a(R){if(R.type==="number"||R.type==="date"||R.type==="boolean"||R.type==="text")return!0;const S=r.has(String(R.style));return!!(R.pattern||R.dateStyle||R.timeStyle||R.relative||R.timeZone||R.trueLabel||R.falseLabel||R.display||R.trueIcon||R.falseIcon||R.transform||R.truncate||R.emptyDisplay||S||R.currency||R.decimals!==void 0||R.minDecimals!==void 0||R.maxDecimals!==void 0||R.notation||R.negative||R.scale!==void 0||R.prefix||R.suffix||R.zeroDisplay!==void 0)}function p(R,S){if(R.type==="number"||R.type==="date"||R.type==="boolean"||R.type==="text")return R.type;if(R.pattern){if(u(R.pattern))return"number";if(d(R.pattern))return"date"}if(R.dateStyle||R.timeStyle||R.relative||R.timeZone)return"date";if(R.trueLabel||R.falseLabel||R.display||R.trueIcon||R.falseIcon)return"boolean";if(R.transform||R.truncate||R.emptyDisplay)return"text";if(R.style||R.currency||R.decimals!==void 0||R.minDecimals!==void 0||R.maxDecimals!==void 0||R.notation||R.negative||R.scale!==void 0||R.prefix||R.suffix||R.zeroDisplay!==void 0)return"number";const E=S&&S.base;return E==="number"?"number":E==="date"||E==="dateString"?"date":E==="boolean"?"boolean":"text"}function w(R,S=null,E=void 0,O=void 0,M=void 0){if(R==null||R==="")return null;const T=G(R)?Object.keys(R):null;if(typeof R=="function"){const U=(X,q)=>String(R({...q||{},value:X,locale:E})??"");return U.ooxml=S&&S.excel||"General",U}if(typeof R=="string"){if(u(R)){const{format:X,ooxml:q}=s(R,E);return X.ooxml=q,X}const U=o(R)||(d(R)?{type:"date",pattern:R}:null);return U?w(U,S,E,O,M):(L(`format:${R}`,`unrecognised format string "${R}"; the value will be stringified`),null)}if(!G(R))return L("format:shape","format must be a spec object or a string; ignoring",R),null;if(S&&N(S.format)&&!a(R)||S&&N(S.format)&&Array.isArray(S.formatPatterns)&&R.type===void 0)return null;const A=p(R,S);A==="date"&&O&&R.timeZone===void 0&&(R={...R,timeZone:O}),l(R,M),b(T||Object.keys(R),A,M);let I;switch(A){case"number":I=z(R,E);break;case"date":I=Y(R,E);break;case"boolean":I=k(R,E);break;default:I=c(R,E);break}return I.ooxml=P(R,A,E,S),I.kind=A,I}const v={yyyy:"yyyy",yy:"yy",MMMM:"mmmm",MMM:"mmm",MM:"mm",M:"m",dd:"dd",d:"d",EEEE:"dddd",EEE:"ddd",HH:"hh",H:"h",hh:"hh",h:"h",mm:"mm",m:"m",ss:"ss",s:"s",SSS:"000",a:"AM/PM"};function P(R,S,E=void 0,O=null){if(S==="date"){if(R.pattern){let U="";for(const X of $(R.pattern))U+=X.token?v[X.token]??X.text:X.text;return U}return O&&O.excel||"yyyy-mm-dd"}if(S==="boolean")return"General";if(S==="text")return"@";if(typeof R.pattern=="string"&&g(R.pattern))return String(R.pattern).trim();if(R.notation==="compact"||R.notation==="scientific")return"General";const M=typeof R.decimals=="number"?R.decimals:typeof R.minDecimals=="number"?R.minDecimals:R.style==="currency"?2:0;let A=`${R.thousandsSeparator===!1?"":"#,#"}#0${M>0?`.${"0".repeat(M)}`:""}`,I="";return R.style==="currency"&&(I+=V(K(R.currency||"USD",E))),R.prefix&&(I+=V(R.prefix)),A=I+A,R.style==="percent"&&(A=`${A}%`),R.suffix&&(A+=V(R.suffix)),R.negative==="parentheses"?`${A};(${A})`:R.negative==="suffix"?`${A};${A}-`:A}function V(R){return`"${String(R).split('"').join("")}"`}const W=new Map;function K(R,S){const E=`${R}|${S||""}`;let O=W.get(E);if(O!==void 0)return O;O=R;try{const T=new Intl.NumberFormat(S,{style:"currency",currency:R}).formatToParts(0).find(A=>A.type==="currency");T&&(O=T.value)}catch{}return W.set(E,O),O}}),He("packages/core/src/columns/types/temporal.js",function(e,D){"use strict";Object.defineProperty(e,"MS_SECOND",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"MS_MINUTE",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"MS_HOUR",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MS_DAY",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"MS_WEEK",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"toTimeMs",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"zonedParts",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"zoneOffsetAt",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"instantFromParts",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"toEpochMs",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"toDurationMs",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return de}}),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 me}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(e,"timestampGroupProjector",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"TEMPORAL_INFERENCE_ORDER",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Be}});const re=D("packages/core/src/internal/predicates.js"),N=re.isNil,G=re.isFunction,F=D("packages/core/src/format/date.js"),L=F.toDate,Z=F.compilePattern,z=F.compileDate,x=F.toIsoDateTime,Y=F.compareIso,$=864e5,j=Object.freeze({}),k=1e3,y=60*k,c=60*y,m=24*c,s=7*m,t=new WeakMap;function o(Ee,Ge){const Ne=Ee&&Ee.locale||"",ke=Ee&&Ee.column;if(!ke)return Ne?{locale:Ne}:j;const Oe=t.get(ke);if(Oe&&Oe.locale===Ne)return Oe.bag;const Re=ke.typeOptions||ke[Ge]||(u(ke.format)?ke.format:null),Le={...Re||j,locale:Re&&Re.locale||Ne||void 0};return t.set(ke,{locale:Ne,bag:Le}),Le}function u(Ee){return Ee!==null&&typeof Ee=="object"&&!Array.isArray(Ee)&&!(Ee instanceof Date)}function d(Ee,Ge){const Ne=Ee===null||Number.isNaN(Ee)?null:Ee,ke=Ge===null||Number.isNaN(Ge)?null:Ge;return Ne===null?ke===null?0:1:ke===null||Ne<ke?-1:Ne>ke?1:0}const i=/^(\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,g=/^(\d{3,6})$/;function r(Ee,Ge,Ne,ke){return!(Ee>=0&&Ee<=23)||!(Ge>=0&&Ge<=59)||!(Ne>=0&&Ne<=59)||!(ke>=0&&ke<=999)?null:Ee*c+Ge*y+Ne*k+ke}function n(Ee){if(N(Ee))return null;const Ge=String(Ee).trim();if(Ge==="")return null;const Ne=g.exec(Ge);if(Ne){const et=Ne[1];if(et.length===5)return null;const tt=et.length===3?1:2;return r(Number(et.slice(0,tt)),Number(et.slice(tt,tt+2)),Number(et.slice(tt+2,tt+4)||0),0)}const ke=i.exec(Ge);if(!ke)return null;let Oe=Number(ke[1]);const Re=Number(ke[2]||0),Le=Number(ke[3]||0),ze=ke[4]?Number(ke[4].padEnd(3,"0")):0,Ye=ke[5]?ke[5][0].toLowerCase():null;if(Ye){if(Oe<1||Oe>12)return null;Oe=Oe%12,Ye==="p"&&(Oe+=12)}return r(Oe,Re,Le,ze)}function f(Ee){return N(Ee)||Ee===""?null:typeof Ee=="number"?Number.isFinite(Ee)?(Ee%m+m)%m:null:Ee instanceof Date?Number.isNaN(Ee.getTime())?null:Ee.getHours()*c+Ee.getMinutes()*y+Ee.getSeconds()*k+Ee.getMilliseconds():n(Ee)}const h=new Map;function l(Ee){const Ge=Ee.pattern||"",Ne=Ee.timeStyle||(Ee.seconds?"medium":"short"),ke=`${Ee.locale||""}|${Ge}|${Ne}`;let Oe=h.get(ke);if(Oe)return Oe;if(Ge)Oe=Z(Ge,Ee.locale||void 0,"UTC");else{const Re=new Intl.DateTimeFormat(Ee.locale||void 0,{timeStyle:Ne,timeZone:"UTC"});Oe=Le=>Re.format(Le)}return h.set(ke,Oe),Oe}function b(Ee,Ge){const Ne=Ge||j;if(Ee==null||typeof Ee!="number"||!Number.isFinite(Ee))return Ne.nullDisplay??"";const ke=(Ee%m+m)%m;return l(Ne)(new Date(ke))}function a(Ee){return Ee instanceof Date?!Number.isNaN(Ee.getTime()):typeof Ee=="number"?Number.isFinite(Ee)&&Ee>=0&&Ee<m:typeof Ee!="string"||!Ee.includes(":")?!1:n(Ee)!==null}function p(Ee){const Ge=f(Ee);return Ge==null?"":b(Ge,{pattern:Ge%k===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const w=new Map;function v(Ee){const Ge=Ee||"";let Ne=w.get(Ge);return Ne||(Ne=new Intl.DateTimeFormat("en-GB",{timeZone:Ee||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),w.set(Ge,Ne)),Ne}function P(Ee,Ge){const Ne={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const ke of v(Ge).formatToParts(new Date(Ee)))ke.type==="year"?Ne.year=Number(ke.value):ke.type==="month"?Ne.month=Number(ke.value):ke.type==="day"?Ne.day=Number(ke.value):ke.type==="hour"?Ne.hour=Number(ke.value)%24:ke.type==="minute"?Ne.minute=Number(ke.value):ke.type==="second"&&(Ne.second=Number(ke.value));return Ne}function V(Ee,Ge){const Ne=P(Ee,Ge);return Date.UTC(Ne.year,Ne.month-1,Ne.day,Ne.hour,Ne.minute,Ne.second,0)-Math.floor(Ee/1e3)*1e3}function W(Ee,Ge){const Ne=Ee.hour||0,ke=Ee.minute||0,Oe=Ee.second||0,Re=Ee.ms||0;if(!Ge)return new Date(Ee.year,Ee.month-1,Ee.day,Ne,ke,Oe,Re).getTime();const Le=Date.UTC(Ee.year,Ee.month-1,Ee.day,Ne,ke,Oe,Re);let ze=Le-V(Le,Ge);return ze=Le-V(ze,Ge),ze}const K=/(?:Z|[+-]\d{2}:?\d{2})$/i,R=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function S(Ee,Ge){if(N(Ee))return null;const Ne=String(Ee).trim();if(Ne==="")return null;const ke=Ge&&Ge.timeZone||void 0;if(!K.test(Ne)){const Oe=R.exec(Ne);if(Oe){const Re=(Oe[4]||"").trim(),Le=Re===""?0:n(Re);if(Le===null)return null;const ze=W({year:Number(Oe[1]),month:Number(Oe[2]),day:Number(Oe[3]),hour:Math.floor(Le/c),minute:Math.floor(Le/y)%60,second:Math.floor(Le/k)%60,ms:Le%k},ke);return Number.isNaN(ze)?null:new Date(ze)}}return L(Ne)}function E(Ee){if(typeof Ee=="number")return Number.isFinite(Ee)?Ee:null;const Ge=L(Ee);return Ge?Ge.getTime():null}const O=new Map;function M(Ee){const Ge=[Ee.locale||"",Ee.pattern||"",Ee.dateStyle||"",Ee.timeStyle||"",Ee.timeZone||"",Ee.seconds?"1":""].join("|");let Ne=O.get(Ge);if(Ne)return Ne;const ke=Ee.pattern?{type:"date",pattern:Ee.pattern,timeZone:Ee.timeZone}:{type:"date",dateStyle:Ee.dateStyle||"medium",timeStyle:Ee.timeStyle||(Ee.seconds?"medium":"short"),timeZone:Ee.timeZone};return Ne=z(ke,Ee.locale||void 0),O.set(Ge,Ne),Ne}function T(Ee,Ge){const Ne=Ge||j,ke=E(Ee);return ke==null?Ne.nullDisplay??"":M(Ne)(ke)}function A(Ee){return Ee instanceof Date?!Number.isNaN(Ee.getTime()):typeof Ee!="string"||!R.test(Ee.trim())?!1:S(Ee)!==null}const I=Object.freeze([{key:"w",ms:s,intl:"week",long:["week","weeks"],names:["w","wk","wks","week","weeks"]},{key:"d",ms:m,intl:"day",long:["day","days"],names:["d","dy","day","days"]},{key:"h",ms:c,intl:"hour",long:["hour","hours"],names:["h","hr","hrs","hour","hours"]},{key:"m",ms:y,intl:"minute",long:["minute","minutes"],names:["m","min","mins","minute","minutes"]},{key:"s",ms:k,intl:"second",long:["second","seconds"],names:["s","sec","secs","second","seconds"]},{key:"ms",ms:1,intl:"millisecond",long:["millisecond","milliseconds"],names:["ms","msec","msecs","milli","millis","millisecond","milliseconds"]}]),U=new Map;for(const Ee of I)for(const Ge of Ee.names)U.set(Ge,Ee);const X=Object.freeze(I.filter(Ee=>Ee.key!=="w")),q=/^(\d+(?:\.\d+)?)\s*([a-z]+)\s*(?:,\s*)?/,_=/^\d+(?:\.\d+)?$/,H=/^(\d+):([0-5]?\d)(?::([0-5]?\d))?(?:\.(\d{1,3}))?$/;function ee(Ee){const Ge=Ee&&Ee.defaultUnit?U.get(String(Ee.defaultUnit).toLowerCase()):null;return Ge?Ge.ms:y}function te(Ee){return(Ee&&Ee.defaultUnit?U.get(String(Ee.defaultUnit).toLowerCase()):null)||U.get("m")}function J(Ee,Ge){if(N(Ee))return null;let Ne=String(Ee).trim().toLowerCase();if(Ne==="")return null;let ke=1;if(Ne[0]==="-"?(ke=-1,Ne=Ne.slice(1).trim()):Ne[0]==="+"&&(Ne=Ne.slice(1).trim()),Ne==="")return null;const Oe=H.exec(Ne);if(Oe){const Ye=Oe[3]!==void 0,et=Number(Oe[1])*c+Number(Oe[2])*y+(Ye?Number(Oe[3])*k:0)+(Oe[4]?Number(Oe[4].padEnd(3,"0")):0);return ke*et}if(_.test(Ne))return Math.round(ke*Number(Ne)*ee(Ge||j));let Re=Ne,Le=0,ze=0;for(;Re!=="";){const Ye=q.exec(Re);if(!Ye)return null;const et=U.get(Ye[2]);if(!et)return null;Le+=Number(Ye[1])*et.ms,Re=Re.slice(Ye[0].length),ze++}return ze===0?null:Math.round(ke*Le)}function ne(Ee){return N(Ee)||Ee===""?null:typeof Ee=="number"?Number.isFinite(Ee)?Ee:null:J(Ee)}const se=new Map;function ae(Ee,Ge,Ne){const ke=`${Ne||""}|${Ge.intl}`;let Oe=se.get(ke);if(Oe===void 0){try{Oe=new Intl.NumberFormat(Ne||void 0,{style:"unit",unit:Ge.intl,unitDisplay:"long"})}catch{Oe=null}se.set(ke,Oe)}return Oe?Oe.format(Ee):`${Ee} ${Ee===1?Ge.long[0]:Ge.long[1]}`}function we(Ee,Ge){return String(Ee).padStart(Ge,"0")}function fe(Ee,Ge){const Ne=Ge||j;if(Ee==null||typeof Ee!="number"||!Number.isFinite(Ee))return Ne.nullDisplay??"";const ke=Ne.style||"short",Oe=Ee<0;let Re=Math.round(Math.abs(Ee));const Le=Oe?"-":"";if(Re===0&&Ne.zeroDisplay!=null)return Ne.zeroDisplay;if(ke==="clock"){const tt=Math.floor(Re/c),pt=Math.floor(Re/y)%60,Tt=Math.floor(Re/k)%60;return`${Le}${we(tt,2)}:${we(pt,2)}:${we(Tt,2)}`}if(Re===0){const tt=te(Ne);return ke==="long"?ae(0,tt,Ne.locale):`0${tt.key}`}const ze=Ne.weeks===!0?I:X,Ye=typeof Ne.maxUnits=="number"&&Ne.maxUnits>0?Ne.maxUnits:Ne.maxUnits===void 0?2:1/0,et=[];for(const tt of ze){if(et.length>=Ye)break;const pt=Math.floor(Re/tt.ms);pt!==0&&(Re-=pt*tt.ms,et.push(ke==="long"?ae(pt,tt,Ne.locale):`${pt}${tt.key}`))}return Le+et.join(" ")}function ge(Ee){if(typeof Ee!="string")return!1;const Ge=Ee.trim();return Ge===""||H.test(Ge)||!/[a-z]/i.test(Ge)?!1:J(Ge)!==null}const je=Date.UTC(1899,11,30),Pe=new Map;function de(Ee,Ge){const Ne=Ee||"";let ke=Pe.get(Ne);ke||(ke=new Intl.DateTimeFormat("en-GB",{timeZone:Ee||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),Pe.set(Ne,ke));const Oe=typeof Ge=="number"?Ge:Date.now();for(const Re of ke.formatToParts(new Date(Oe)))if(Re.type==="timeZoneName")return Re.value;return""}function oe(Ee){if(Ee)return Ee;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function he(Ee,Ge){const Ne=oe(Ee),ke=de(Ee,Ge);return ke?`${Ne} (${ke})`:Ne}function ce(Ee,Ge){if(Ee&&Ee.timeZone)return Ee.timeZone;const Ne=Ge&&Ge.grid;return(Ne&&G(Ne.get)?Ne.get("timeZone"):void 0)||void 0}function me(Ee,Ge){const Ne=Ge||j,ke=E(Ee);if(ke==null)return Ne.nullDisplay??"";const Oe=M(Ne)(ke);if(!Ne.showOrigin)return Oe;const Re=Ne.originZone;return Re?Re===(Ne.timeZone||oe(Ne.timeZone))?Oe:`${Oe} (${he(Re,ke)})`:`${Oe} (no origin recorded)`}function ye(Ee,Ge,Ne,ke){if(Ge==="instant"||!Ge)return Ee;const Oe=P(Ee,Ne);if(Ge==="month")return W({year:Oe.year,month:Oe.month,day:1},Ne);if(Ge==="week"){const Re=ke>=1&&ke<=7?ke:1,ze=((new Date(Date.UTC(Oe.year,Oe.month-1,Oe.day)).getUTCDay()+6)%7+1-Re+7)%7,Ye=new Date(Date.UTC(Oe.year,Oe.month-1,Oe.day-ze));return W({year:Ye.getUTCFullYear(),month:Ye.getUTCMonth()+1,day:Ye.getUTCDate()},Ne)}return W({year:Oe.year,month:Oe.month,day:Oe.day},Ne)}function xe(Ee,Ge){const Ne=Ee&&Ee.group,ke=Ne&&Ne.granularity||"day";if(ke==="instant")return null;const Oe=Ne&&Ne.weekStart;return Re=>typeof Re=="number"?ye(Re,ke,Ge,Oe):Re}const Se={time:{base:"number",storage:"float64",matches:a,format:Ee=>b(f(Ee.value),o(Ee,"time")),parse:Ee=>n(Ee.text),compare:(Ee,Ge)=>d(f(Ee),f(Ge)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:Ee=>{const Ge=f(Ee);return Ge===null?null:Ge/$},toStorage:Ee=>f(Ee),toClipboard:p,fromClipboard:n},datetime:{base:"dateString",storage:"dictionary",matches:A,format:Ee=>T(Ee.value,o(Ee,"datetime")),parse:Ee=>x(S(Ee.text,o(Ee,"datetime"))??Ee.text),compare:Y,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(Ee,Ge)=>x(Ee,Ge&&Ge.timeZone),toClipboard:Ee=>N(Ee)?"":String(Ee),fromClipboard:Ee=>x(Ee)},duration:{base:"number",storage:"float64",matches:ge,format:Ee=>fe(ne(Ee.value),o(Ee,"duration")),parse:Ee=>J(Ee.text,o(Ee,"duration")),compare:(Ee,Ge)=>d(ne(Ee),ne(Ge)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:Ee=>{const Ge=ne(Ee);return Ge===null?null:Ge/$},toStorage:Ee=>ne(Ee),toClipboard:Ee=>fe(ne(Ee),{style:"short",maxUnits:-1}),fromClipboard:Ee=>J(Ee)},timestamp:{base:"number",storage:"float64",format:Ee=>{const Ge=o(Ee,"timestamp");return me(Ee.value,{...Ge,timeZone:ce(Ge,Ee)})},parse:Ee=>{const Ge=o(Ee,"timestamp"),Ne=S(Ee.text,{timeZone:ce(Ge,Ee)});return Ne?Ne.getTime():null},compare:(Ee,Ge)=>d(E(Ee),E(Ge)),groupProjector:(Ee,Ge)=>xe(Ee,Ge),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(Ee,Ge)=>{const Ne=E(Ee);if(Ne==null)return null;const ke=P(Ne,Ge&&Ge.timeZone||void 0);return(Date.UTC(ke.year,ke.month-1,ke.day,ke.hour,ke.minute,ke.second)-je)/$},toStorage:Ee=>E(Ee),toClipboard:Ee=>{const Ge=E(Ee);return Ge==null?"":new Date(Ge).toISOString()},fromClipboard:Ee=>E(Ee)}},Te=["datetime","time","duration"],Be=Se}),He("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(G=256,F=null){this.#e=G,this.#n=F}get size(){return this.#t.size}get max(){return this.#e}set max(G){this.#e=G,this.#r()}has(G){return this.#t.has(G)}get(G){const F=this.#t;if(!F.has(G))return;const L=F.get(G);return F.delete(G),F.set(G,L),L}peek(G){return this.#t.get(G)}set(G,F){const L=this.#t;return L.has(G)&&L.delete(G),L.set(G,F),this.#r(),F}delete(G){const F=this.#t.get(G);return this.#t.delete(G)&&this.#n&&this.#n(F,G),F}clear(){if(this.#n)for(const[G,F]of this.#t)this.#n(F,G);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const G=this.#t;for(;G.size>this.#e;){const F=G.keys().next().value,L=G.get(F);G.delete(F),this.#n&&this.#n(L,F)}}}}),He("packages/core/src/columns/types/network.js",function(e,D){"use strict";Object.defineProperty(e,"toUint32",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"compareIpv4",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"packCidr",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"cidrParts",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isCidr",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"compareCidr",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"netmask",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"addressCount",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"ipv6Groups",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return E}});const N=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/lru.js").Lru,L=4294967295,Z=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function z(O){if(N(O))return null;if(typeof O=="string")return x(O);const M=Number(O);return Number.isFinite(M)?M<0?M<-2147483648?null:M>>>0:M>L?null:Math.trunc(M)>>>0:null}function x(O){if(N(O))return null;const M=String(O).trim();if(M==="")return null;const T=Z.exec(M);if(!T)return null;let A=0;for(let I=1;I<=4;I++){const U=T[I];if(U.length>1&&U.charCodeAt(0)===48)return null;const X=Number(U);if(X>255)return null;A=A*256+X}return A}function Y(O){const M=z(O);return M===null?"":`${M>>>24&255}.${M>>>16&255}.${M>>>8&255}.${M&255}`}function $(O){return typeof O=="string"&&x(O)!==null}function j(O,M){const T=z(O),A=z(M);return T===null?A===null?0:1:A===null||T<A?-1:T>A?1:0}const k=64,y=L*k+32,c=/^(?:0|[1-9]\d?)$/;function m(O,M){return O*k+M}function s(O){if(N(O))return null;if(typeof O=="string"){const A=t(O);return A===null?null:s(A)}if(typeof O=="object"){const A=z(O.address),I=Number(O.prefix);return A===null||!Number.isInteger(I)||I<0||I>32?null:{address:A,prefix:I}}const M=Number(O);if(!Number.isInteger(M)||M<0||M>y)return null;const T=M%k;return T>32?null:{address:(M-T)/k,prefix:T}}function t(O){if(N(O))return null;const M=String(O).trim();if(M==="")return null;const T=M.indexOf("/");if(T<0)return null;const A=x(M.slice(0,T));if(A===null)return null;const I=M.slice(T+1).trim();if(!c.test(I))return null;const U=Number(I);return U>32?null:m(A,U)}function o(O){const M=s(O);return M?`${Y(M.address)}/${M.prefix}`:""}function u(O){return typeof O=="string"&&t(O)!==null}function d(O,M){const T=s(O),A=s(M);return T?A?T.address!==A.address?T.address<A.address?-1:1:T.prefix-A.prefix:-1:A?1:0}function i(O){return O===0?0:4294967295<<32-O>>>0}function g(O){const M=s(O);return M?(M.address&i(M.prefix))>>>0:null}function r(O){const M=s(O);return M?(M.address&i(M.prefix)|~i(M.prefix)>>>0)>>>0:null}function n(O){const M=s(O);return M?2**(32-M.prefix):null}function f(O){const M=s(O);return M?M.prefix===32?1:M.prefix===31?2:2**(32-M.prefix)-2:null}function h(O,M){const T=s(O);if(!T)return!1;const A=z(M);if(A===null)return!1;const I=i(T.prefix);return(A&I)>>>0===(T.address&I)>>>0}function l(O,M){const T=g(O),A=g(M);return T===null||A===null?!1:T<=r(M)&&A<=r(O)}const b=/^[0-9a-fA-F]{1,4}$/,a=new F(512);function p(O){if(N(O))return null;let M=String(O).trim();if(M==="")return null;const T=M.indexOf("%");if(T>=0&&(M=M.slice(0,T)),M==="")return null;if(M.indexOf(".")>=0){const _=M.lastIndexOf(":");if(_<0)return null;const H=x(M.slice(_+1));if(H===null)return null;M=`${M.slice(0,_+1)}${(H>>>16&65535).toString(16)}:${(H&65535).toString(16)}`}const A=M.split("::");if(A.length>2)return null;const I=w(A[0]);if(I===null)return null;if(A.length===1)return I.length===8?I:null;const U=w(A[1]);if(U===null)return null;const X=8-I.length-U.length;if(X<1)return null;const q=I.slice();for(let _=0;_<X;_++)q.push(0);for(const _ of U)q.push(_);return q}function w(O){if(O==="")return[];const M=[];for(const T of O.split(":")){if(!b.test(T))return null;M.push(parseInt(T,16))}return M}function v(O){if(typeof O!="string")return p(O);if(a.has(O))return a.get(O);const M=p(O);return a.set(O,M),M}function P(O){if(O[0]===0&&O[1]===0&&O[2]===0&&O[3]===0&&O[4]===0&&O[5]===65535)return`::ffff:${Y((O[6]<<16|O[7])>>>0)}`;let M=-1,T=0,A=-1,I=0;for(let q=0;q<8;q++)O[q]===0?(A<0?(A=q,I=1):I++,I>T&&(T=I,M=A)):(A=-1,I=0);if(T<2)return O.map(q=>q.toString(16)).join(":");const U=O.slice(0,M).map(q=>q.toString(16)).join(":"),X=O.slice(M+T).map(q=>q.toString(16)).join(":");return`${U}::${X}`}function V(O){const M=p(O);return M===null?null:P(M)}function W(O){return V(O)??""}function K(O){return typeof O=="string"&&O.indexOf(":")>=0&&p(O)!==null}function R(O,M){const T=v(O),A=v(M);if(!T)return A?1:0;if(!A)return-1;for(let I=0;I<8;I++)if(T[I]!==A[I])return T[I]<A[I]?-1:1;return 0}const S=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:$,parse:O=>x(O.text),compare:j,format:O=>Y(O.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:O=>z(O),toClipboard:O=>Y(O),fromClipboard:O=>x(O)},cidr:{base:"number",storage:"float64",matches:u,parse:O=>t(O.text),compare:d,format:O=>o(O.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:O=>{const M=s(O);return M===null?null:m(M.address,M.prefix)},toClipboard:O=>o(O),fromClipboard:O=>t(O)},ipv6:{base:"text",storage:"dictionary",matches:K,parse:O=>V(O.text),compare:R,format:O=>W(O.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:O=>V(O),toClipboard:O=>W(O),fromClipboard:O=>V(O)}}),E=S}),He("packages/core/src/i18n/catalogue.js",function(e,D){"use strict";Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return L}});const re=D("packages/core/src/registry/free-tier-notice.js"),N=re.FREE_TIER_NOTICE,G=re.WATERMARK_TEXT,F=Object.freeze({"count.rows":{one:"{count} row",other:"{count} rows"},"count.comments":{one:"{count} comment",other:"{count} comments"},"comments.someUnresolved":"{comments}, {unresolved} unresolved","comments.allResolved":"{comments}, all resolved","count.unresolvedComments":{one:"{count} unresolved comment",other:"{count} unresolved comments"},"count.items":{one:"{count} item",other:"{count} items"},"count.keys":{one:"{count} key",other:"{count} keys"},"count.values":{one:"value",other:"values"},"count.waiting":{one:"{count} waiting",other:"{count} waiting"},"count.rowsAdded":{one:"{count} row added",other:"{count} rows added"},"count.rowsRemoved":{one:"{count} row removed",other:"{count} rows removed"},"value.empty":"empty","a11y.sort.cleared":"Sort cleared","a11y.sort.by":"Sorted by {columns}","a11y.sort.column":"{column} {direction}","a11y.sort.ascending":"ascending","a11y.sort.descending":"descending","a11y.filter.cleared":"Filter cleared, {rows}","a11y.filter.applied":"Filtered to {shown} of {total}","a11y.find.count":{one:"{current} of {count} match",other:"{current} of {count} matches"},"a11y.find.countLoaded":{one:"{current} of {count} match in loaded rows",other:"{current} of {count} matches in loaded rows"},"a11y.find.none":"No matches","a11y.find.noneLoaded":"No matches in loaded rows","a11y.selection.cleared":"Selection cleared","a11y.selection.count":{one:"{count} row selected",other:"{count} rows selected"},"tabs.tablist":"Tabs","a11y.tabs.selected":"{label} tab selected","a11y.scrollbar.horizontal":"Horizontal scrollbar","a11y.scrollbar.vertical":"Vertical scrollbar","designer.canvas":"Dashboard canvas","designer.chrome":"Designer tools","designer.page":"Page {n}","a11y.designer.edit":"Edit mode","a11y.designer.view":"View mode","layout.region":"Dashboard layout","layout.move":"Move {title}","layout.resize":"Resize {title}","layout.close":"Close {title}","a11y.layout.grabbed":"{title} grabbed, column {x} of {columns}, row {y}","a11y.layout.position":"{title}, column {x} of {columns}, row {y}","a11y.layout.dropped":"{title} dropped, column {x} of {columns}, row {y}","a11y.layout.cancelled":"{title} move cancelled","a11y.layout.resizeCancelled":"{title} resize cancelled","a11y.layout.reverted":"{title} returned to column {x}, row {y}","a11y.layout.resizeGrabbed":"{title} resize grabbed, {w} by {h} cells","a11y.layout.resizeStep":"{title}, {w} by {h} cells","a11y.layout.resized":"{title} resized to {w} by {h} cells","a11y.layout.closed":"{title} closed","layout.maximise":"Maximise {title}","layout.minimise":"Minimise {title}","layout.restore":"Restore {title}","a11y.layout.maximised":"{title} maximised, filling the dashboard; press Escape to restore it","a11y.layout.minimised":"{title} minimised","a11y.layout.restored":"{title} restored to column {x}, row {y}","a11y.group.cleared":"Grouping cleared","a11y.group.by":"Grouped by {columns}","a11y.group.expanded":"{label} expanded, {rows} shown","a11y.group.collapsed":"{label} collapsed, {rows} shown","a11y.page.position":"Page {page} of {pages}","a11y.updates.paused":"Updates paused","a11y.updates.resumed":"Updates resumed","a11y.edit.refusedOne":"Edit to {column} was refused and put back to {value}{reason}","a11y.edit.refusedMany":{one:"{count} edit was refused and put back{reason}",other:"{count} edits were refused and put back{reason}"},"a11y.edit.reason":", {reason}","a11y.history.undo":"Undid {label}","a11y.history.redo":"Redid {label}","a11y.history.undoLast":"Undid the last change","a11y.history.redoLast":"Redid the last change","a11y.column.cannotResize":"{column} cannot be resized","a11y.column.resized":"{column} is {width} pixels wide","a11y.column.atMinimum":"{column} is at its narrowest, {width} pixels","a11y.column.atMaximum":"{column} is at its widest, {width} pixels","a11y.column.cannotMove":"{column} cannot be moved","a11y.column.alreadyFirst":"{column} is already first in its group","a11y.column.alreadyLast":"{column} is already last in its group","a11y.column.cannotMoveThere":"{column} cannot be moved there","a11y.column.moved":"{column} moved to position {at} of {of}","a11y.group.formed":"{column} grouped with {other} in a new band","a11y.group.dissolved":"band {group} dissolved","a11y.group.renamed":"band renamed to {group}","a11y.group.moved":"band {group} moved to position {at} of {of}","a11y.column.addedToGroup":"{column} added to band {group}","a11y.column.removedFromGroup":"{column} removed from its band","a11y.column.notInGroup":"{column} is not in a band","a11y.column.cannotGroup":"{column} cannot be grouped","a11y.group.cannotMove":"band {group} cannot be moved there","columngroup.newGroup":"New group","columngroup.rename":"Rename band","columngroup.dissolve":"Dissolve band","columngroup.group":"Group with adjacent column","columngroup.untitled":"Untitled band","panel.bandCollapse":"Collapse band {band}","panel.bandExpand":"Expand band {band}","panel.bandVisible":"Show or hide every column in band {band}","panel.bandRenameFor":"Rename band {band}","panel.bandDissolveFor":"Dissolve band {band}","header.filter":"Filter {column}","header.menu":"Column menu for {column}","header.toggleGroup":"Toggle {group}","header.dragHint":"Drag {column} to reorder, or onto another column to group","header.dragRole":"draggable column header","header.group":"group","header.selectAllRows":"Select all rows","header.clearSelection":"Clear selection","cell.selectRow":"Select row","cell.detail.show":"Show detail","cell.detail.hide":"Hide detail","cell.detail.showInPane":"Show in the detail pane","cell.detail.showingInPane":"Showing in the detail pane","cell.group.expand":"Expand","cell.group.collapse":"Collapse","cell.delta.up":"up","cell.delta.down":"down","cell.delta.unchanged":"unchanged","cell.delta.moved":"{direction} {magnitude}","cell.delta.describedUnchanged":"{label}, unchanged","cell.delta.described":"{label}, {direction} by {magnitude}","cell.qr.of":"QR code for {text}","cell.qr.empty":"No QR code","cell.barcode.of":"Barcode for {text}","cell.barcode.empty":"No barcode","cell.barcode.invalid":"Invalid value for this barcode","cell.rating.of":"{rating} of {max}","cell.rating.empty":"Not rated","cell.stage.of":"Stage {current} of {total}: {label}","cell.stage.empty":"No stage","a11y.panel.cannotMove":"{column} cannot be moved","a11y.panel.alreadyFirst":"{column} is already first","a11y.panel.alreadyLast":"{column} is already last","a11y.panel.moved":"{column} moved to position {at} of {of}","a11y.panel.removedFrom":"{column} removed from {list}","a11y.panel.addedTo":"{column} added to {list}","a11y.panel.cannotAddTo":"{column} cannot be added to {list}","a11y.annotate.erased":"Annotation removed","a11y.annotate.noMarks":"No annotations to erase","a11y.annotate.focusedMark":"Mark {at} of {of} selected","a11y.annotate.confirmClear":"Clear all annotations? Choose Clear or Keep.","a11y.annotate.cleared":"All annotations cleared","a11y.range.written":{one:"{count} cell updated",other:"{count} cells updated"},"a11y.range.cleared":{one:"{count} cell cleared",other:"{count} cells cleared"},"paste.preview.title":"Review paste","paste.preview.summary":{one:"{changes} cell will change, {rejected} rejected.",other:"{changes} cells will change, {rejected} rejected."},"paste.preview.changesHeading":{one:"{count} change",other:"{count} changes"},"paste.preview.rejectedHeading":{one:"{count} rejected",other:"{count} rejected"},"paste.preview.colOld":"Current","paste.preview.colNew":"New","paste.preview.colCell":"Cell","paste.preview.colReason":"Reason","paste.preview.empty":"This paste would change nothing.","paste.preview.confirm":"Apply","paste.preview.cancel":"Cancel","paste.preview.reason.permission":"Not permitted","paste.preview.reason.readOnly":"Read-only","paste.preview.reason.validation":"Invalid value","paste.preview.reason.locked":"Being edited","paste.preview.reason.missing":"No such cell","a11y.paste.previewOpened":{one:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel.",other:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel."},"a11y.paste.cancelled":"Paste cancelled; nothing changed","status.total":"{rows}","status.counting":"Counting rows…","status.shownOfTotal":"{shown} of {total}","status.selected":"{count} selected","status.selectedAcrossSource":"{count} selected across the source","status.selectedAcrossSourceCounting":"All matching rows selected, counting…","status.count":"Count {count}","status.loading":"Loading {count}…","status.loadingOf":"Loading {loaded} of {total} ({percent}%)","status.stat.sum":"Sum","status.stat.min":"Min","status.stat.max":"Max","status.stat.avg":"Avg","status.paused":"Paused","status.pausedWaiting":"Paused · {waiting}","status.coalesced":"{count} coalesced","status.hiddenComments":"{comments} on hidden rows","pagination.label":"Pagination","pagination.first":"First page","pagination.previous":"Previous page","pagination.next":"Next page","pagination.last":"Last page","pagination.page":"Page","pagination.ofPages":"of {pages}","pagination.summary":"{from}–{to} of {total}","pagination.pageSize":"Rows per page","pagination.range":"{from}–{to}","pagination.counting":"{from}–{to}, counting…","pagination.jump":"Page number, press Enter to jump","pagination.jumpBounded":"Page number, 1 to {pages}, press Enter to jump","panel.columns":"Columns","panel.filters":"Filters","panel.views":"Views","panel.quickFilter":"Quick filter","find.label":"Find in grid","find.placeholder":"Find in grid","find.next":"Next match","find.previous":"Previous match","find.close":"Close find","find.matchCase":"Match case","find.wholeCell":"Whole cell","find.columnScope":"Search in","find.allColumns":"All columns","find.count":"{current} of {total}","find.countPartial":"{current} of {total} so far","find.none":"No matches","find.searching":"Searching…","find.loadedRows":"in loaded rows","rowCap.more":"+ {count} more","panel.formatting":"Formatting","panel.statistics":"Statistics","stat.noData":"No data","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.blockedBy":{one:"blocked by {count} card",other:"blocked by {count} cards"},"kanban.card.assignedTo":"Assigned to {names}","kanban.card.overdue":"Overdue","kanban.card.dueSoon":"Due soon","kanban.card.progress":"{percent}% complete","kanban.card.checklist":"{done} of {total} done","gantt.lag":"+{days}d","gantt.lead":"{days}d","gantt.a11y.moved":"{name} moved to {date}","gantt.a11y.day":"day {day}","gantt.a11y.resized":"{name} resized to {days} days","gantt.a11y.linkFrom":"Linking from {name}. Focus the successor and press L.","gantt.a11y.linked":"Linked {from} to {to}, finish to start.","gantt.a11y.linkCancelled":"Link cancelled.","gantt.a11y.deleted":"{name} deleted.","gantt.a11y.readOnly":"Read-only.","gantt.row.moveHandle":"Drag to reorder or re-parent {name}","gantt.a11y.rowMoved":"{name} moved.","gantt.a11y.rowReparented":"{name} moved under {parent}.","gantt.a11y.rowPromoted":"{name} moved to the top level.","gantt.a11y.rowMoveCancelled":"Move cancelled.","gantt.a11y.copied":"{count} tasks copied.","gantt.a11y.cut":"{count} tasks cut.","gantt.a11y.pasted":"{count} tasks pasted.","gantt.task.newName":"New task","gantt.a11y.taskAdded":"{name} added.","gantt.menu.addAbove":"Add task above","gantt.menu.addBelow":"Add task below","gantt.menu.addChild":"Add subtask","gantt.menu.addSuccessor":"Add successor","gantt.menu.addPredecessor":"Add predecessor","gantt.menu.toMilestone":"Convert to milestone","gantt.menu.toTask":"Convert to task","gantt.menu.delete":"Delete task","gantt.a11y.linkCycle":"Linking {from} to {to} would create a cycle; link not created.","gantt.a11y.linkCreated":"{from} linked to {to}, {type}.","gantt.a11y.linkDeleted":"Link from {from} to {to} deleted.","gantt.a11y.linkLabel":"Link, {from} to {to}, {type}","gantt.linkEditor.title":"Edit link from {from} to {to}","gantt.linkEditor.type":"Link type","gantt.linkEditor.lag":"Lag, in days","gantt.linkEditor.apply":"Apply","gantt.linkEditor.delete":"Delete link","gantt.linkEditor.cancel":"Cancel","gantt.a11y.undone":"Undone.","gantt.a11y.redone":"Redone.","gantt.a11y.nothingToUndo":"Nothing to undo.","gantt.a11y.nothingToRedo":"Nothing to redo.","gantt.workload.title":"Resource workload","gantt.workload.resource":"Resource","gantt.workload.total":"Total","gantt.workload.unassigned":"Unassigned","gantt.workload.ungrouped":"No group","gantt.workload.cell":"{hours} h from {date}","gantt.workload.over":"{hours} h from {date}, over a capacity of {capacity} h","gantt.workload.expand":"Show {name}’s tasks","gantt.workload.collapse":"Hide {name}’s tasks","gantt.workload.expandGroup":"Show the {name} group","gantt.workload.collapseGroup":"Hide the {name} group","gantt.workload.unitToggle":"Hours / % / Cost","gantt.workload.unitHours":"Showing hours","gantt.workload.unitPercent":"Showing percent of capacity","gantt.workload.unitCost":"Showing cost","gantt.workload.cellPercent":"{percent}% from {date}","gantt.workload.overPercent":"{percent}% from {date}, over capacity","gantt.workload.cellNoCapacity":"No available hours from {date}","gantt.workload.cellCost":"{cost} from {date}","gantt.workload.otherProjectLabel":"{name} (other project)","gantt.workload.external":"External booking","gantt.a11y.hoursSet":"{name}: {hours} h from {date}","gantt.a11y.hoursCleared":"{name}: no hours from {date}","gantt.a11y.hoursRefused":"{date} is not a working day; {name} was not changed.","gantt.histogram.title":"Resource histogram","gantt.histogram.tableTitle":"Resource histogram data","gantt.histogram.resource":"Resource","gantt.histogram.period":"Period","gantt.histogram.hours":"Hours","gantt.histogram.percent":"Percent of capacity","gantt.histogram.cost":"Cost","gantt.histogram.capacity":"Capacity","gantt.histogram.overAllocated":"Over-allocated","gantt.histogram.yes":"Yes","gantt.histogram.no":"No","gantt.histogram.tip":"{name}, {from} to {to}: {value}{capacity}{tasks}","gantt.histogram.tipHours":"{hours} h","gantt.histogram.tipPercent":"{percent}% of capacity","gantt.histogram.tipCost":"{cost}","gantt.histogram.tipCapacity":", capacity {hours} h","gantt.histogram.tipTasks":" ({tasks})","gantt.histogram.tipOver":", over capacity","gantt.histogram.tipNoCapacity":"no available hours","gantt.picker.title":"Assign resources to {name}","gantt.picker.open":"Edit assignments for {name}","gantt.picker.search":"Search resources","gantt.picker.list":"Resources","gantt.picker.selected":"Assigned resources","gantt.picker.load":"{load}% booked of {capacity}% over these dates","gantt.picker.none":"No matching resources","gantt.picker.units":"{name}, units in percent","gantt.picker.remove":"Remove {name}","gantt.picker.apply":"Apply","gantt.picker.cancel":"Cancel","gantt.picker.warn":"{name} would be over-allocated: {load}% booked of {capacity}%","gantt.picker.ok":"No resource would be over-allocated","gantt.picker.assign":"Assign","gantt.col.effort":"Effort","gantt.col.units":"Units","gantt.unscheduled":"Unscheduled","gantt.col.unscheduled":"Unscheduled","gantt.inactive":"Inactive","gantt.col.inactive":"Inactive","gantt.col.slack":"Slack","gantt.col.deadline":"Deadline","gantt.col.constraint":"Constraint","gantt.col.constraintDate":"Constraint date","gantt.col.earlyStart":"Early start","gantt.col.lateStart":"Late start","gantt.col.lateFinish":"Late finish","gantt.col.baselineStart":"Baseline start","gantt.col.baselineEnd":"Baseline finish","gantt.col.variance":"Variance","gantt.col.note":"Note","gantt.col.sequence":"#","gantt.col.predecessors":"Predecessors","gantt.col.successors":"Successors","gantt.link.invalid":"Cannot read “{token}” as a link. Write a task number, a type and a lag, like 3FS+2; links not changed.","gantt.link.unknownRef":"No task is numbered “{token}”; links not changed.","gantt.link.self":"“{token}” links a task to itself; links not changed.","gantt.link.duplicate":"“{token}” repeats a link already listed; links not changed.","gantt.link.cycle":"“{token}” would create a cycle; links not changed.","gantt.constraint.ASAP":"As soon as possible","gantt.constraint.MSO":"Must start on","gantt.constraint.MFO":"Must finish on","gantt.constraint.ALAP":"As late as possible","gantt.constraint.SNET":"Start no earlier than","gantt.constraint.SNLT":"Start no later than","gantt.constraint.FNET":"Finish no earlier than","gantt.constraint.FNLT":"Finish no later than","gantt.row.ancestor":"Shown because a task inside it matches the filter","gantt.progress.handle":"Drag to set the progress of {name}","gantt.a11y.progress":"{name} {percent}% complete","gantt.col.name":"Task name","gantt.col.start":"Start","gantt.col.end":"Finish","gantt.col.duration":"Duration","gantt.col.assignee":"Assignee","gantt.col.progress":"%","gantt.col.wbs":"WBS","gantt.zoom.label":"Zoom","gantt.zoom.day":"Day","gantt.zoom.week":"Week","gantt.zoom.month":"Month","gantt.zoom.quarter":"Quarter","gantt.zoom.fit":"Fit to plan","gantt.tip.range":"{from} to {to}","gantt.tip.duration":"{days}d","gantt.tip.slack":"slack {days}d","gantt.tip.effort":"{hours}h","gantt.tip.row":"{label}: {value}","gantt.tip.start":"Start","gantt.tip.end":"End","gantt.tip.date":"Date","gantt.tip.durationLabel":"Duration","gantt.tip.durationValue":"{days} days","gantt.tip.complete":"Complete","gantt.tip.effortLabel":"Effort","gantt.tip.effortValue":"{hours} h","gantt.tip.assigned":"Assigned","gantt.tip.cost":"Cost","gantt.tip.slackLabel":"Slack","gantt.tip.slackValue":"{days} days","gantt.tip.deadline":"Deadline","gantt.mode.fixedDuration":"Fixed duration","gantt.mode.fixedEffort":"Fixed effort","gantt.mode.fixedUnits":"Fixed units","gantt.scurve.spi":"SPI {index}","gantt.scurve.cpi":"CPI {index}","gantt.print.page":"Page {page} of {pages}","gantt.print.printed":"Printed {date}","gantt.dataBand.title":"Data band","gantt.dataBand.name":"Task","gantt.dataBand.resource":"Resource","gantt.dataBand.total":"Total","gantt.dataBand.unassigned":"Unassigned","gantt.dataBand.collapse":"Collapse {name}","gantt.dataBand.expand":"Expand {name}","gantt.dataBand.cell":"{name}, {date}: {value}","gantt.issues.title":"Scheduling conflicts","gantt.issues.empty":"No scheduling conflicts","gantt.issues.count":"{count} scheduling conflicts","gantt.issues.toggle":"Toggle the conflicts panel","gantt.issues.cycle":"Circular dependency: {tasks}","gantt.issues.constraint":"{task} cannot meet its {constraint} constraint of {date}","gantt.issues.lock":"{task} is locked but a dependency would move it","gantt.issues.deadline":"{task} finishes after its deadline of {date}","gantt.issues.fixRemoveLink":"Remove link","gantt.issues.fixAsap":"Set as soon as possible","gantt.issues.fixUnlock":"Unlock task","gantt.issues.fixClearDeadline":"Clear deadline","gantt.resize.startHandle":"Drag to change the start of {name}","gantt.a11y.resizedStart":"{name} start moved to {date}, now {days} days","gantt.a11y.startEdge":"Start edge can be resized: drag the left edge, or press Ctrl+Shift+Left or Right.","gantt.a11y.chain":"Dependency chain highlighted: {preds} predecessors, {succs} successors.","timeline.scrub":"Scrub through recent changes","timeline.goLive":"Go live","timeline.returnToPresent":"Return to the present","a11y.fillHandle":"Drag to fill","panel.icons":"Icons","value.tooLong":"Too long","dataview.label":"Items","dataview.empty":"No items","dataview.reorder.sorted":"Items cannot be reordered while the view is sorted","dataview.reorder.filtered":"Items cannot be reordered while a filter is applied","shortcuts.title":"Keyboard shortcuts","shortcuts.close":"Close keyboard shortcuts","shortcuts.hint":"Press Escape to close.","shortcuts.or":"or","a11y.reorder.moved":"Moved to position {position} of {total}","a11y.reorder.sorted":"Rows cannot be reordered while the grid is sorted","a11y.reorder.filtered":"Rows cannot be reordered while a filter is applied","a11y.reorder.grouped":"Rows cannot be reordered while the grid is grouped","a11y.reorder.grab":"Reorder row","a11y.reorder.sortedManual":"Rows cannot be reordered while the grid is sorted. Press Alt+Shift+M, or the Manual order button in the heading, to order them by hand","a11y.reorder.groupDerived":"The row cannot join that group: the group is worked out from the value, so there is no single value to give it","a11y.reorder.groupReadOnly":"The row cannot join that group: its grouping value cannot be edited","a11y.reorder.invalid":"The row cannot join that group: the new value was not valid","a11y.reorder.vetoed":"The move was declined; the row stays where it was","a11y.reorder.vetoedBecause":"The move was declined ({reason}); the row stays where it was","a11y.reorder.refused":"The row cannot be moved there","a11y.reorder.regrouped":"Moved into {group}","a11y.tree.dropRefusedDescendant":"A row cannot be dropped into one of its own descendants; the row stays where it was","a11y.rowOrder.entered":"Manual order: the rows keep their places and can be moved by hand","a11y.rowOrder.exited":"Manual order ended; the rows follow the sort","rowOrder.button":"Manual order","rowOrder.enter":"Order the rows by hand instead of by the sort","rowOrder.exit":"Return to the sorted order","a11y.transfer.moved":"Row moved to the other grid","a11y.transfer.copied":"Row copied to the other grid","a11y.transfer.refused":"That grid does not accept this row","a11y.transfer.declined":"The drop was declined; the row stays where it was","a11y.transfer.stale":"The drop target changed while it was being confirmed; the row stays where it was","shortcuts.group.grid":"In the data","shortcuts.group.header":"On a column heading","shortcuts.group.panel":"In the column list","shortcut.moveCell":"Move the focused cell","shortcut.rowEnds":"First / last cell of the row","shortcut.gridEnds":"First cell of the first row / last cell of the last row","shortcut.pageRows":"Move one viewport of rows","shortcut.nextCell":"Leave the grid for the next / previous focusable element (arrows move between cells)","shortcut.undo":"Undo the last edit, paste, fill or clear","shortcut.redo":"Redo the step that was undone","shortcut.startEdit":"Start editing the focused cell","shortcut.toggleRow":"Toggle selection of the focused row","shortcut.cancel":"Cancel the current edit or drag","shortcut.expandCollapse":"Expand / collapse a group or tree row","shortcut.focusHeader":"Move focus to the column header","shortcut.focusPanel":"Move focus to the tool panel","shortcut.explain":"Explain the focused column","shortcut.contextMenu":"Open the context menu for the focused cell","shortcut.moveRow":"Move the focused row, when row reorder is enabled","shortcut.manualOrder":"Order the rows by hand, or return to the sort, when row reorder allows a manual order","shortcut.headingMove":"Move between headings","shortcut.headingEnds":"First / last heading","shortcut.headingSort":"Sort by the column, Shift to add to the sort","shortcut.headingResize":"Resize the column, Ctrl for a coarse step","shortcut.headingAutosize":"Size the column to its content","shortcut.headingReorder":"Move the column","shortcut.headingMenu":"Open the column menu","shortcut.headingExit":"Return focus to the data","shortcut.listGroup":"Group by the column, or stop grouping by it","shortcut.listValues":"Add the column to values, or take it out","shortcut.listPivot":"Pivot by the column, or stop pivoting by it","shortcut.listMove":"Move the column","shortcut.find":"Find in the grid","tags.label":"Show columns","tags.all":"All columns","tags.showing":"Showing {tag}","form.title":"Edit row","form.save":"Save","form.cancel":"Cancel","form.loading":"Loading…","form.loadFailed":"Could not load this record.","form.loadTimeout":"The record did not arrive in time.","form.retry":"Try again","form.choose":"Choose…","form.newTitle":"New row","form.createFailed":"Could not add this record.","form.grid.cellInvalid":"Row {row}, {column}: {message}","form.grid.required":"Add at least one row.","form.grid.addRow":"Add row","form.grid.deleteRow":"Delete row","form.grid.total":"Total","form.grid.rowControls":"Row controls","presentation.cards":"Showing records as cards","presentation.table":"Showing records as a table","editor.format":"Format","editor.codeHint":"Tab indents · Esc cancels · Ctrl+Enter saves","editor.colours":"Colours","editor.customColour":"Custom colour","editor.hexValue":"Hex value","editor.hexPlaceholder":"#rrggbb","editor.clearColour":"Clear colour","editor.time":"Time","editor.noIcon":"No icon","editor.selectAll":"Select all","editor.passwordHint":"Enter the value twice to save it.","editor.clearRating":"Clear rating","editor.clear":"Clear","editor.value":"Value","editor.currency":"Currency","editor.richtext.formatting":"Formatting","editor.richtext.richText":"Rich text","editor.richtext.placeholder":"Start writing…","editor.richtext.linkLabel":"Link address","editor.richtext.linkPlaceholder":"https://","editor.richtext.linkAdd":"Add link","editor.richtext.bold":"Bold (Ctrl+B)","editor.richtext.italic":"Italic (Ctrl+I)","editor.richtext.underline":"Underline (Ctrl+U)","editor.richtext.strike":"Strikethrough","editor.richtext.heading":"Paragraph style","editor.richtext.alignLeft":"Align left","editor.richtext.alignCenter":"Align centre","editor.richtext.alignRight":"Align right","editor.richtext.ul":"Bulleted list","editor.richtext.ol":"Numbered list","editor.richtext.color":"Text colour","editor.richtext.link":"Link (Ctrl+K)","editor.richtext.image":"Insert image","editor.richtext.clear":"Clear formatting","editor.richtext.source":"HTML source","editor.richtext.undo":"Undo (Ctrl+Z)","editor.richtext.redo":"Redo (Ctrl+Y)","formatting.format":"Format","formatting.noRules":"No rules yet. The first one that matches a cell wins.","formatting.clearAll":"Clear all","formatting.addRule":"Add rule","formatting.condition":"Condition","formatting.value":"Value","formatting.secondValue":"Second value","formatting.moveEarlier":"Move earlier","formatting.moveLater":"Move later","formatting.ruleKind":"Rule type","formatting.aCondition":"A condition","formatting.aColourScale":"A colour scale","formatting.compare":"Compare a value","formatting.distribution":"By the distribution","formatting.colourScale":"Colour scale","formatting.scaleBounds":"Scale bounds","formatting.preview":"Preview","formatting.livePreview":"Live preview","history.title":"History","history.show":"Show history","history.empty":"Nothing to undo yet.","prompt.ask":"Ask","prompt.apply":"Apply","prompt.discard":"Discard","panel.searchColumns":"Search columns","panel.searchColumnsPlaceholder":"Search columns…","panel.searchColumnsToFilter":"Search columns to filter","panel.showAll":"Show all","panel.hideAll":"Hide all","panel.clearAll":"Clear all","panel.clear":"Clear","panel.filterAllColumns":"Filter all columns","panel.columnFiltered":"This column is filtered","panel.clearFilterOn":"Clear the filter on {column}","panel.clearFilter":"Clear this filter","panel.filterEmptyNoMatch":"No column matches “{query}”.","panel.filterEmptyNone":"No column on this grid can be filtered.","panel.filterSummaryActive":"{active} of {total} columns filtered","panel.filterSummaryNone":"No filters · {total} columns available","panel.filterBy":"Filter by {column}","panel.filteredBy":"Filtered by {column}","panel.columnDragHint":"Drag {column} into a zone above, or onto another column to reorder","panel.gridActions":"Grid actions","panel.tabActiveCount":{one:"{title}, {count} active",other:"{title}, {count} active"},"panel.tabActive":"{title}, active","views.default":"Default","views.namePlaceholder":"Name this view…","views.nameLabel":"Name for the current layout","views.save":"Save view","licence.watermark":G,"licence.watermark.free":N,"filter.op.contains":"Contains","filter.op.notContains":"Does not contain","filter.op.equals":"Equals","filter.op.notEqual":"Does not equal","filter.op.startsWith":"Starts with","filter.op.endsWith":"Ends with","filter.op.blank":"Is blank","filter.op.notBlank":"Is not blank","filter.op.lessThan":"Less than","filter.op.lessThanOrEqual":"Less than or equal","filter.op.greaterThan":"Greater than","filter.op.greaterThanOrEqual":"Greater than or equal","filter.op.inRange":"In range","filter.op.matches":"Matches","filter.op.before":"Before","filter.op.after":"After","filter.op.relative":"Relative to today","filter.rel.today":"Today","filter.rel.yesterday":"Yesterday","filter.rel.tomorrow":"Tomorrow","filter.rel.lastNDays":"Last N days","filter.rel.nextNDays":"Next N days","filter.rel.thisWeek":"This week","filter.rel.lastWeek":"Last week","filter.rel.thisMonth":"This month","filter.rel.lastMonth":"Last month","filter.rel.thisQuarter":"This quarter","filter.rel.quarterToDate":"Quarter to date","filter.rel.thisYear":"This year","filter.rel.yearToDate":"Year to date","filter.operator":"Operator","filter.join":"Join","filter.value":"Value","filter.from":"From","filter.to":"To","filter.addCondition":"Add condition","filter.noConditions":"No conditions","filter.removeCondition":"Remove condition","filter.search":"Search","filter.searchValues":"Search values","filter.noMatches":"No values match","filter.selectAll":"Select all","filter.clear":"Clear","filter.all":"All","filter.allExcept":"All but {count}","filter.loadingValues":"Loading values…","filter.topValues":"Top {shown} of {total} values","filter.valuesFailed":"Values could not be loaded: {error}","filter.valuesUnsupported":"This source cannot list the values of {column}; filter by condition instead.","filter.true":"True","filter.false":"False","filter.expression":"Filter expression","filter.column":"Column","filter.relativePeriod":"Relative period","filter.days":"Number of days","filter.tab.set":"Values","filter.tab.text":"Text","filter.tab.number":"Number","filter.tab.date":"Date","filter.tab.advanced":"Advanced","filterRow.label":"Filter row","filterRow.conditions":{one:"{count} condition",other:"{count} conditions"},"chart.empty":"Nothing to chart","chart.summary":"{type} chart of {measure} by {dimension}","chart.summaryShare":"{type} chart of {measure}","chart.summaryType":"{type} chart","chart.summaryGauge":"{type} chart of {measure}, {fn}: {value}","chart.waterfallTotal":"Total","chart.summaryEngine":"Figures computed by the data engine over every matching row","chart.summaryEngineViewport":"{count} points in this view, fetched from the data engine","chart.summaryEngineDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells counted by the data engine","chart.summaryClientDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells computed in the browser","chart.viewportOverCap":"{count} rows in this view, more than the {cap} this map draws; zoom in or narrow the filter","chart.dataTable":"Chart data","chart.viewportFilter.label":"Map view","chart.annotate.rail":"Drawing tools","chart.annotate.select":"Select and move a drawing","chart.annotate.trendLine":"Trend line","chart.annotate.horizontalLine":"Horizontal line","chart.annotate.verticalLine":"Vertical line","chart.annotate.channel":"Parallel channel","chart.annotate.fibonacci":"Fibonacci retracement","chart.annotate.arrow":"Arrow","chart.annotate.pen":"Freehand pen","chart.annotate.pen.described":"Freehand drawing from {from} to {to}","chart.annotate.measure-x":"Date range","chart.annotate.measure-y":"Price range","chart.annotate.measure-xy":"Date and price range","chart.annotate.measure.bars":{one:"{count} bar",other:"{count} bars"},"chart.annotate.measure.points":{one:"{count} point",other:"{count} points"},"chart.annotate.measure.volume":"Vol {value}","chart.annotate.measure.seconds":"{count}s","chart.annotate.measure.minutes":"{count}m","chart.annotate.measure.hours":"{count}h","chart.annotate.measure.days":"{count}d","chart.annotate.measure.weeks":"{count}w","chart.annotate.measure.months":"{count}mo","chart.annotate.measure.years":"{count}y","chart.annotate.measure":"Measure","chart.annotate.measure.dx":"Δx {value}","chart.annotate.measure.dy":"Δy {value}","chart.annotate.measure.pct":"{value}%","chart.annotate.measure.categories":{one:"{count} category",other:"{count} categories"},"chart.annotate.measure.slope.perDay":"Slope {value} per day","chart.annotate.measure.slope.perCategory":"Slope {value} per category","chart.annotate.measure.slope.perUnit":"Slope {value} per unit","chart.annotate.measure.dur.d":"{count} d","chart.annotate.measure.dur.h":"{count} h","chart.annotate.measure.dur.min":"{count} min","chart.annotate.measure.dur.s":"{count} s","chart.annotate.measure.dur.ms":"{count} ms","chart.annotate.measure.announce":"Measurement: {readout}","chart.annotate.measure.start":"Measure start: {x}, {y}","chart.annotate.text":"Text","chart.annotate.callout":"Callout","chart.annotate.note":"Note","chart.annotate.delete":"Delete the selected drawing","chart.annotate.editLabel":"Annotation text","chart.zoom.toolbar":"Zoom controls","chart.zoom.in":"Zoom in","chart.zoom.out":"Zoom out","chart.zoom.left":"Pan left","chart.zoom.right":"Pan right","chart.zoom.reset":"Reset the zoom","chart.legendMore":{one:"+{count} more",other:"+{count} more"},"chart.type.line":"Line","chart.type.area":"Area","chart.type.bar":"Bar","chart.type.pie":"Pie","chart.type.donut":"Donut","chart.type.sunburst":"Sunburst","chart.type.scatter":"Scatter","chart.type.step":"Step","chart.type.rangeArea":"Range","chart.type.horizontalBar":"Horizontal bar","chart.type.waterfall":"Waterfall","chart.type.floatingBar":"Floating bar","chart.type.horizontalFloatingBar":"Horizontal floating bar","chart.type.populationPyramid":"Population pyramid","chart.type.bullet":"Bullet","chart.type.bubble":"Bubble","chart.type.histogram":"Histogram","chart.type.boxplot":"Box plot","chart.type.forest":"Forest plot","chart.type.qq":"QQ plot","chart.type.ecdf":"ECDF","chart.type.lorenz":"Lorenz","chart.type.correlogram":"Correlogram","chart.type.control":"Control","chart.type.capability":"Capability","chart.type.movingRange":"Moving range","chart.type.treemap":"Treemap","chart.type.combo":"Combination","chart.type.pareto":"Pareto","chart.type.heatmap":"Heat map","chart.type.radar":"Radar","chart.type.gauge":"Gauge","chart.type.funnel":"Funnel","chart.type.candlestick":"Candlestick","chart.type.ohlc":"OHLC","chart.type.polarArea":"Polar area","chart.type.nightingale":"Nightingale rose","chart.type.rose":"Rose","chart.type.radialBar":"Radial bar","chart.type.polarScatter":"Polar scatter","chart.type.geomap":"Map","chart.type.sankey":"Sankey","chart.type.chord":"Chord","chart.type.pyramid":"Pyramid","chart.type.pictorial":"Pictorial","chart.type.serpentine":"Serpentine timeline","chart.type.spiral":"Spiral timeline","chart.edit.aggregated":"This value is a total of several rows, so it cannot be dragged.","chart.edit.refused":"That change was not applied.","chart.edit.refusedWhy":"That change was not applied: {reason}","chart.type.network":"Network","chart.type.stream":"Stream","chart.type.marimekko":"Marimekko","chart.type.violin":"Violin","chart.type.gantt":"Gantt","chart.type.forceTree":"Force-directed tree","chart.type.pack":"Packed circles","chart.type.tree":"Tree","chart.type.voronoiTreemap":"Voronoi treemap","chart.type.alluvial":"Alluvial","chart.type.arc":"Arc diagram","chart.type.barRace":"Bar chart race","chart.type.bubblemap":"Bubble map","chart.type.bump":"Bump chart","chart.type.calendar":"Calendar heat map","chart.type.choropleth":"Choropleth map","chart.type.decomposition":"Decomposition tree","chart.type.diverging":"Diverging bar","chart.type.dumbbell":"Dumbbell","chart.type.fan":"Fan chart","chart.type.hexbin":"Hexagonal bin","chart.type.hexmap":"Hex map","chart.type.icicle":"Icicle","chart.type.markermap":"Marker map","chart.type.motion":"Motion chart","chart.type.parallel":"Parallel coordinates","chart.type.ridgeline":"Ridgeline","chart.type.roc":"ROC curve","chart.type.scatter3d":"3D scatter","chart.type.slope":"Slope chart","chart.type.splom":"Scatter plot matrix","chart.type.venn":"Venn diagram","chart.type.waffle":"Waffle","chart.type.wordCloud":"Word cloud","chart.tasksDropped":{one:"{count} more task not shown",other:"{count} more tasks not shown"},"chart.geoUnmatched":{one:"{count} row could not be placed on the map",other:"{count} rows could not be placed on the map"},"chart.r2":"R² {value}","ai.insights":"Insights","ai.explainView":"Explain this view","ai.explain":"Explain","ai.ask":"Ask","ai.apply":"Apply","ai.discard":"Discard","ai.propose":"Propose","ai.approve":"Approve","ai.thinking":"Thinking…","ai.applying":"Applying…","ai.applied":"Applied: {what}","ai.couldNotApply":"Could not apply: {why}","ai.applyFailed":"it failed","ai.discarded":"Discarded.","ai.discardedNothingWritten":"Discarded. Nothing was written.","ai.nothingWritten":"Nothing was written.","ai.nothingWrittenVetoed":"Nothing was written — a before-handler vetoed it.","ai.scope":"Scope: {scope}","ai.unsafeQuery":"I could not turn that into a safe query: {why}","ai.nothingToDo":"nothing to do","ai.insightsFailed":"Could not generate insights right now. The grid is unaffected.","ai.modelUnreachable":"Could not reach the model right now. The grid is unaffected.","ai.flagged":{one:"{count} unverified figure was removed as ungrounded.",other:"{count} unverified figures were removed as ungrounded."},"ai.askPlaceholder":"Ask your data: “EMEA deals over 50k, biggest first”","ai.askLabel":"Ask your data","ai.actorPlaceholder":"Ask AI to change data: “set the Network Upgrade project to In Progress”","ai.actorLabel":"Ask AI to change data","editor.password.show":"Show value","editor.password.hide":"Hide value","editor.password.showField":"Show {column}","editor.password.hideField":"Hide {column}","facets.computing":"Computing…","facets.suppressed.cardinality":"Too many distinct values to chart","facets.suppressed.rows":"Too many rows to chart","facets.suppressed.streaming":"Paused while live data is streaming","facets.suppressed.noProvider":"No distribution available for this data source","facets.suppressed.type":"This column has no chartable distribution","facets.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(F))}),He("packages/core/src/i18n/format.js",function(e,D){"use strict";Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"formatMessage",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return k}});const N=D("packages/core/src/internal/predicates.js").isFunction,G=/\{(\w+)\}/g,F=new Map,L=new Map;function Z(y){const c=y||"";if(F.has(c))return F.get(c);let m=null;try{m=new Intl.PluralRules(y||void 0)}catch{m=null}return F.set(c,m),m}function z(y,c,m="conjunction"){const s=Array.isArray(y)?y.filter(u=>u!=null&&u!==""):[];if(s.length===0)return"";if(s.length===1)return String(s[0]);const t=`${c||""}|${m}`;let o=L.get(t);if(o===void 0){try{o=new Intl.ListFormat(c||void 0,{style:"long",type:m})}catch{o=null}L.set(t,o)}return o?o.format(s.map(String)):s.map(String).join(", ")}function x(y,c){return y==null?"":typeof y=="number"?Number.isFinite(y)?y.toLocaleString(c||void 0,{maximumFractionDigits:20}):"":String(y)}function Y(y,c,m){if(typeof y=="string")return y;if(!y||typeof y!="object")return"";const s=c&&typeof c.count=="number"?c.count:null;if(s===null)return y.other??"";const t=Z(m),o=t?t.select(s):s===1?"one":"other";return y[o]??y.other??""}function $(y,c={},m){const s=Y(y,c,m);return s?s.replace(G,(t,o)=>Object.prototype.hasOwnProperty.call(c,o)?x(c[o],m):t):""}function j(y,c,m="en-GB"){return typeof y=="string"&&y?y:typeof c=="string"&&c?c:m}function k(y,c){const m=y?y[c]:void 0;return m==null||N(m)?c:m}}),He("packages/core/src/i18n/registry.js",function(e,D){"use strict";Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"localeCatalogue",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return Z}});const N=D("packages/core/src/i18n/catalogue.js").EN_GB,G=new Map([["en-gb",N]]);function F(z,x){const Y=typeof z=="string"?z.toLowerCase():"";return!Y||!x||typeof x!="object"?!1:(G.set(Y,x),!0)}function L(z){if(typeof z!="string"||!z)return null;const x=z.toLowerCase(),Y=G.get(x);if(Y)return Y;const $=x.split("-")[0],j=G.get($);if(j)return j;for(const[k,y]of G)if(k.split("-")[0]===$)return y;return null}function Z(){return[...G.keys()]}}),He("packages/core/src/i18n/index.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_LOCALE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"Messages",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"defaultMessages",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return d}});const re=D("packages/core/src/i18n/catalogue.js"),N=re.EN_GB,G=re.MESSAGE_KEYS,F=D("packages/core/src/i18n/format.js"),L=F.formatMessage,Z=F.formatList,z=F.lookup,x=F.resolveLocale,$=D("packages/core/src/internal/predicates.js").isFunction,k=D("packages/core/src/internal/warn.js").warnOnce,y=D("packages/core/src/i18n/registry.js"),c=y.registerLocale,m=y.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 F.formatList}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return F.resolveLocale}}),Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return y.registerLocale}});const s="en-GB";class t{#e=s;#t=N;constructor(g={}){this.configure(g)}configure(g={}){this.#e=x(g.locale,g.declared,s);const r=g.messages,n=m(this.#e);if(!n&&this.#e.toLowerCase()!=="en-gb"&&(!r||typeof r!="object")&&k(`i18n:locale:not-loaded:${this.#e.toLowerCase()}`,`locale "${this.#e}" is not loaded: import "@toclocoinc/lattice-grid/locales/${this.#e}" to add its text; English is used until then.`),!r||typeof r!="object"){this.#t=n?{...N,...n}:N;return}const h=Object.keys(r).filter(l=>!(l in N));h.length&&k(`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={...N,...n||{},...r}}get locale(){return this.#e}t(g,r){return L(z(this.#t,g),r||{},this.#e)}list(g,r){return Z(g,this.#e,r)}number(g,r){const n=Number(g);return Number.isFinite(n)?n.toLocaleString(this.#e,r||{maximumFractionDigits:20}):""}}const o=new t;function u(i){return i instanceof t?i:new t(i||{})}function d(i){const g=i&&typeof i=="object"?i:{},r=G.filter(f=>{const h=g[f];return h==null||h===""||$(h)}),n=Object.keys(g).filter(f=>!(f in N));return{missing:r,unknown:n}}}),He("packages/core/src/columns/types/structured.js",function(e,D){"use strict";Object.defineProperty(e,"MASK_DEFAULTS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"parseJsonText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});const re=D("packages/core/src/internal/predicates.js"),N=re.isNil,G=re.isObject,L=D("packages/core/src/i18n/index.js").defaultMessages,Z=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function z(t,o){const u=o||{},d=u.emptyDisplay??Z.emptyDisplay;if(N(t)||t==="")return d;const g=[...typeof u.char=="string"&&u.char!==""?u.char:Z.char][0]||Z.char,r=u.fixedLength??Z.fixedLength,n=Number.isFinite(u.length)&&Number(u.length)>0?Math.floor(Number(u.length)):Z.length,f=typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):null;let h=0;if(f!==null){const l=Number.isFinite(u.lastVisible)?Math.floor(Number(u.lastVisible)):Z.lastVisible,b=[...f];if(h=l>0&&l<b.length?l:0,h>0){const a=b.slice(b.length-h).join(""),p=Math.max(1,(r?n:b.length)-h);return g.repeat(p)+a}return g.repeat(r?n:Math.max(1,b.length))}return g.repeat(n)}const x=48;function Y(t){try{const o=JSON.stringify(t);return o===void 0?null:o}catch{return null}}function $(t,o){if(N(t))return"";const u=Number.isFinite(o&&o.inlineLimit)?Number(o.inlineLimit):x;if(typeof t=="string")return t.length>u?`${t.slice(0,u-1)}…`:t;if(typeof t!="object")return String(t);const d=Y(t);if(d!==null&&d.length<=u)return d;if(Array.isArray(t)){const g=t.length;return`[${L.t("count.items",{count:g})}]`}const i=Object.keys(t).length;return`{${L.t("count.keys",{count:i})}}`}function j(t,o){if(t==null)return"null";const u=typeof t;if(u==="number"||u==="boolean"||u==="bigint")return String(t);if(u==="string")return JSON.stringify(t);if(u!=="object")return JSON.stringify(String(t));const d=o||new WeakSet;return d.has(t)?'"[circular]"':(d.add(t),t instanceof Date?JSON.stringify(t.toISOString()):Array.isArray(t)?`[${t.map(r=>j(r,d)).join(",")}]`:`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${j(t[r],d)}`).join(",")}}`)}function k(t,o){if(N(t))return N(o)?0:1;if(N(o))return-1;const u=j(t),d=j(o);return u<d?-1:u>d?1:0}function y(t){if(N(t))return null;const o=String(t);if(o.trim()==="")return null;try{return JSON.parse(o)}catch{return o}}function c(t){const o=t&&t.cell&&t.cell.props;return G(o)?o:{}}const m=Object.freeze({json:{base:"object",storage:"object",format:t=>$(t&&t.value,c(t&&t.column)),parse:t=>y(t&&t.text),compare:k,defaults:{editor:"code",filter:"text",align:"start"},excel:"@",toClipboard:t=>{if(N(t))return"";if(typeof t=="string")return t;try{const o=JSON.stringify(t,null,2);return o===void 0?String(t):o}catch{return String(t)}},fromClipboard:t=>y(t)},secret:{base:"text",storage:"object",format:t=>z(t&&t.value,c(t&&t.column)),parse:t=>{const o=t&&t.text;return N(o)||String(o)===""?null:String(o)},compare:(t,o)=>{const u=N(t)||t==="",d=N(o)||o==="";return u===d?0:u?1:-1},defaults:{editor:"password",filter:"none",align:"start"},excel:"@",export:{csv:!1,excel:!1},toClipboard:t=>z(t),fromClipboard:t=>N(t)||String(t)===""?null:String(t)}}),s=m}),He("packages/core/src/columns/types/unit.js",function(e,D){"use strict";Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return A}});const N=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/warn.js").warnOnce;function L(I,U,X,q){return Object.freeze({symbol:I,factor:U,aliases:Object.freeze(X||[]),binary:!!(q&&q.binary),prefix:q&&q.prefix||null,auto:!(q&&q.auto===!1)})}function Z(I,U,X,q){return L(I,U,X,q)}const z=Object.freeze({data:Object.freeze([L("B",1,["byte","bytes"]),L("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),L("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),L("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),L("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),L("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),L("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),L("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),L("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),L("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([L("bps",1,["bit","bits","bit/s","b/s"]),L("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),L("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),L("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),L("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([L("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),L("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),L("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),L("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),L("in",.0254,["inch","inches"],{auto:!1}),L("ft",.3048,["foot","feet"],{auto:!1}),L("yd",.9144,["yard","yards"],{auto:!1}),L("m",1,["metre","metres","meter","meters"]),L("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),L("mi",1609.344,["mile","miles"],{auto:!1}),L("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([L("mg",.001,["milligram","milligrams"]),L("g",1,["gram","grams"]),L("oz",28.349523125,["ounce","ounces"],{auto:!1}),L("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),L("kg",1e3,["kilogram","kilograms"]),L("st",6350.29318,["stone"],{auto:!1}),L("t",1e6,["tonne","tonnes","ton"],{auto:!1}),L("ton (US)",907184.74,["ton","shortton"],{auto:!1}),L("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([L("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),L("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),L("ms",.001,["msec","msecs","millisecond","milliseconds"]),L("s",1,["sec","secs","second","seconds"]),L("m",60,["min","mins","minute","minutes"]),L("h",3600,["hr","hrs","hour","hours"]),L("d",86400,["day","days"])]),speed:Object.freeze([L("mm/s",.001,["millimetre/s","millimeter/s"]),L("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),L("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),L("mph",.44704,["mile/h","miles/h"],{auto:!1}),L("kn",1852/3600,["knot","knots"],{auto:!1}),L("m/s",1,["metre/s","meter/s","mps"]),L("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([L("mm/s²",.001,["mm/s2"]),L("ft/s²",.3048,["ft/s2"],{auto:!1}),L("m/s²",1,["m/s2","metre/s2","meter/s2"]),L("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([L("mm²",1e-6,["mm2"]),L("cm²",1e-4,["cm2"]),L("in²",64516e-8,["in2","sqin"],{auto:!1}),L("ft²",.09290304,["ft2","sqft"],{auto:!1}),L("yd²",.83612736,["yd2","sqyd"],{auto:!1}),L("m²",1,["m2","sqm"]),L("ha",1e4,["hectare","hectares"],{auto:!1}),L("ac",4046.8564224,["acre","acres"],{auto:!1}),L("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([L("µL",1e-6,["ul","microlitre","microliter"]),L("mL",.001,["millilitre","milliliter"]),L("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),L("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),L("L",1,["litre","litres","liter","liters"]),L("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),L("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),L("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),L("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([L("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),L("J",1,["joule","joules"]),L("cal",4.184,["calorie","calories"],{auto:!1}),L("kJ",1e3,["kilojoule","kilojoules"]),L("BTU",1055.05585262,["btu"],{auto:!1}),L("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),L("MJ",1e6,["megajoule","megajoules"]),L("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),L("GJ",1e9,["gigajoule","gigajoules"]),L("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([L("mW",.001,["milliwatt","milliwatts"]),L("W",1,["watt","watts"]),L("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),L("kW",1e3,["kilowatt","kilowatts"]),L("hp",745.6998715822702,["horsepower"],{auto:!1}),L("MW",1e6,["megawatt","megawatts"]),L("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([L("mN",.001,["millinewton","millinewtons"]),L("N",1,["newton","newtons"]),L("lbf",4.4482216152605,["poundforce"],{auto:!1}),L("kgf",9.80665,["kilogramforce"],{auto:!1}),L("kN",1e3,["kilonewton","kilonewtons"]),L("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([L("Pa",1,["pascal","pascals"]),L("mbar",100,["millibar"],{auto:!1}),L("inH₂O",249.0889,["inh2o"],{auto:!1}),L("mmHg",133.322387415,["torr"],{auto:!1}),L("kPa",1e3,["kilopascal","kilopascals"]),L("inHg",3386.388640341,["inhg"],{auto:!1}),L("psi",6894.757293168361,["lbf/in2"],{auto:!1}),L("bar",1e5,[],{auto:!1}),L("atm",101325,["atmosphere","atmospheres"],{auto:!1}),L("MPa",1e6,["megapascal","megapascals"]),L("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([L("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),L("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),L("kN·m",1e3,["knm","kn.m"],{auto:!1}),L("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([L("kg/m³",1,["kg/m3"]),L("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),L("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),L("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([L("L/min",1/6e4,["lpm","l/min"],{auto:!1}),L("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),L("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),L("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),L("cfm",.0004719474432,["ft3/min"],{auto:!1}),L("L/s",.001,["lps","l/s"],{auto:!1}),L("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([L("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),L("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),L("mrad",.001,["milliradian","milliradians"],{auto:!1}),L("mil",Math.PI/3200,["nato-mil"],{auto:!1}),L("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),L("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),L("rad",1,["radian","radians"]),L("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([L("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),L("rad/s",1,["radps","radians/s"]),L("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),L("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([L("ppt",1e-12,["partspertrillion"],{auto:!1}),L("ppb",1e-9,["partsperbillion"]),L("ppm",1e-6,["partspermillion"]),L("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),L("‰",.001,["permille","permil"],{auto:!1}),L("%",.01,["pct","percent"]),L("×",1,["x","ratio","times"])]),molarity:Object.freeze([L("pM",1e-12,["picomolar","picomolarity"]),L("nM",1e-9,["nanomolar","nanomolarity"]),L("µM",1e-6,["um-molar","micromolar","micromolarity"]),L("mM",.001,["millimolar","millimolarity"]),L("M",1,["molar","mol/l","mol/L","molarity"]),L("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([L("mg/s",1e-6,["milligrams/s"]),L("g/s",.001,["grams/s"]),L("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),L("kg/s",1,["kilograms/s","kgps"]),L("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),L("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),L("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([L("µPa·s",1e-6,["upas","micropascalsecond"]),L("cP",.001,["centipoise"],{auto:!1}),L("mPa·s",.001,["mpas","millipascalsecond"]),L("P",.1,["poise"],{auto:!1}),L("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([L("cSt",1e-6,["centistokes","centistoke"]),L("mm²/s",1e-6,["mm2/s"],{auto:!1}),L("St",1e-4,["stokes","stoke"],{auto:!1}),L("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([L("mW/(m·K)",.001,["mw/mk"]),L("W/(m·K)",1,["w/mk","wmk"]),L("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),L("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([L("J/(kg·K)",1,["j/kgk","jkgk"]),L("kJ/(kg·K)",1e3,["kj/kgk"]),L("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([L("nSv/h",1e-9,["nsvh"]),L("µSv/h",1e-6,["usv/h","usvh"]),L("mSv/h",.001,["msvh"]),L("Sv/h",1,["svh"]),L("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),x=Symbol("ambiguous"),Y=new Map,$=new Map;function j(I,U){const X=String(I||"").trim();if(!X)throw new Error("[lattice] a unit system needs a name");if(z[X]||$.has(X))throw new Error(`[lattice] unit system "${X}" already exists`);const q=[...U||[]];if(!q.length)throw new Error(`[lattice] unit system "${X}" has no units`);if(!q.some(H=>H.factor===1))throw new Error(`[lattice] unit system "${X}" has no base unit (none with factor 1)`);const _=new Set;for(const H of q){if(_.has(H.symbol))throw new Error(`[lattice] unit system "${X}" declares "${H.symbol}" twice`);_.add(H.symbol)}return $.set(X,Object.freeze(q)),Y.delete(X),X}function k(){return[...Object.keys(z),...$.keys()]}function y(I){const U=c(I);return U?U.units:[]}function c(I){const U=String(I||""),X=Y.get(U);if(X!==void 0)return X;const q=z[U]||$.get(U);if(!q)return Y.set(U,null),null;const _=Object.freeze([...q].sort((ne,se)=>ne.factor-se.factor)),H=new Map,ee=new Map,te=(ne,se)=>{const ae=H.get(ne);ae===void 0?H.set(ne,se):ae!==se&&H.set(ne,x)};for(const ne of _){te(ne.symbol.toLowerCase(),ne);for(const se of ne.aliases)te(se.toLowerCase(),ne);if(ne.prefix){const se=ee.get(ne.prefix)||[];se.push(ne),ee.set(ne.prefix,se)}}const J={units:_,byToken:H,byPrefix:ee,decimal:_.filter(ne=>!ne.binary&&ne.auto),binary:_.some(ne=>ne.binary)?_.filter(ne=>(ne.binary||ne.factor===1)&&ne.auto):null};return Y.set(U,J),J}function m(I,U){return U&&I.binary||I.decimal}function s(I,U){const X=c(I);if(!X||N(U))return null;const q=X.units.find(H=>H.symbol===String(U));if(q)return q;const _=X.byToken.get(String(U).trim().toLowerCase());return _&&_!==x?_:null}const t=new WeakMap;function o(I){const U=I||{};if(typeof U=="object"&&U!==null){const H=t.get(U);if(H!==void 0)return H}const X=U.system||"data",q=c(X);let _=null;if(!q)F(`unit:system:${X}`,`unknown unit system "${X}"; known systems are ${k().join(", ")}`);else{let H=U.unit?s(X,U.unit):null;H||(U.unit&&F(`unit:unit:${X}:${U.unit}`,`unknown unit "${U.unit}" in system "${X}"; falling back to ${q.units[0].symbol}`),H=q.units.find(ee=>ee.factor===1)||q.units[0]),_={index:q,base:H,binary:U.binary===!0}}return typeof U=="object"&&U!==null&&t.set(U,_),_}const u=new WeakMap;function d(I,U){if(!I||!U||!Array.isArray(I.compound)||I.compound.length===0)return null;const X=u.get(I);if(X!==void 0)return X;const q=new Set,_=[];for(const ee of I.compound){const te=s(I.system||"data",ee);if(!te){F(`unit:compound:${I.system}:${ee}`,`unknown compound unit "${ee}" in system "${I.system||"data"}"; ignoring it`);continue}q.has(te.symbol)||(q.add(te.symbol),_.push(te))}_.sort((ee,te)=>te.factor-ee.factor);const H=_.length>=2?_:null;return u.set(I,H),H}function i(I,U,X){return U===X||U.factor===X.factor?I:I*U.factor/X.factor}const g=new Map;function r(I){const U=I||"",X=g.get(U);if(X)return X;const q={group:",",decimal:"."};try{for(const _ of new Intl.NumberFormat(I||void 0).formatToParts(12345.6))_.type==="group"?q.group=_.value:_.type==="decimal"&&(q.decimal=_.value)}catch{}return g.set(U,q),q}const n=/[\s ]/g,f=/^[+-]?[\d '’ .,]*(?:[eE][+-]?\d+)?/,h=/^[^\d+\-(.,\s]+\s*/,l=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function b(I,U){const{group:X,decimal:q}=r(U);let _=String(I).replace(n,"");if(_==="")return null;const H=q?_.indexOf(q):-1;if(X&&X!==q){if(H>=0&&_.indexOf(X,H+q.length)>=0)return null;_=_.split(X).join("")}if(q&&q!=="."&&(_=_.split(q).join(".")),!l.test(_))return null;const ee=Number(_);return Number.isFinite(ee)?ee:null}function a(I,U,X){const q=String(I).trim().replace(/\.$/,"");if(q==="")return null;const _=U.units.find(se=>se.symbol===q);if(_)return _;const H=q.toLowerCase(),ee=U.byToken.get(H);if(ee===x)return null;if(ee)return ee;const te=U.byPrefix.get(H);if(!te||!te.length)return null;const J=m(U,X),ne=te.filter(se=>J.includes(se));return ne.length===1?ne[0]:null}function p(I,U,X,q){let _=I,H=0,ee=!1,te=!1;for(;_!=="";){const J=f.exec(_)[0];if(J==="")return null;const ne=b(J,q&&q.locale);if(ne===null)return null;_=_.slice(J.length).trim();const se=_.search(/[+-]?[\d]/),ae=(se>=0?_.slice(0,se):_).trim();if(_=se>=0?_.slice(se).trim():"",ae===""){if(ee)return null;te=!0,H+=i(ne,X[0],U.base)}else{const we=a(ae,U.index,U.binary);if(!we)return null;H+=i(ne,we,U.base)}if(ee=!0,te&&_!=="")return null}return ee?H:null}function w(I,U){if(N(I))return null;if(typeof I=="number")return Number.isFinite(I)?I:null;const X=o(U);if(!X)return null;let q=String(I).trim();if(q==="")return null;let _=!1;q.startsWith("(")&&q.endsWith(")")&&(_=!0,q=q.slice(1,-1).trim());const H=d(U,X);if(H){q.startsWith("-")&&(_=!0,q=q.slice(1).trim());const fe=p(q,X,H,U);return fe===null?null:_?-fe:fe}let ee=null;const te=h.exec(q);if(te&&te[0]){const fe=a(te[0].trim(),X.index,X.binary);fe&&(ee=fe,q=q.slice(te[0].length).trim())}const J=f.exec(q)[0],ne=b(J,U&&U.locale);if(ne===null)return null;const se=q.slice(J.length).trim();if(ee&&se!=="")return null;const ae=ee||(se===""?X.base:a(se,X.index,X.binary));if(!ae)return null;const we=i(ne,ae,X.base);return _?-we:we}const v=new Map;function P(I,U,X,q){const _=`${I||""}|${U}|${X}|${q?1:0}`;let H=v.get(_);return H||(H=new Intl.NumberFormat(I||void 0,{minimumFractionDigits:U,maximumFractionDigits:X,useGrouping:q}),v.set(_,H)),H}function V(I,U){if(!Number.isFinite(I)||I===0)return Math.max(0,U-1);const X=Math.floor(Math.log10(Math.abs(I)));return Math.min(20,Math.max(0,U-1-X))}function W(I,U){if(!Number.isFinite(I)||I===0)return I;const X=Math.ceil(Math.log10(Math.abs(I))),q=10**(U-X);return Math.round(I*q)/q}function K(I,U,X){if(!X||X===U.base.symbol)return U.base;if(X!=="auto")return R(U,X);if(I===0||!Number.isFinite(I))return U.base;const q=Math.abs(I)*U.base.factor,_=m(U.index,U.binary);let H=_[0];for(const J of _)q>=J.factor&&(H=J);if(q>=H.factor)return H;let ee=H;for(const J of U.index.units)J.binary!==U.binary&&J.factor!==1||J.factor<=q&&J.factor>(ee===H?0:ee.factor)&&(ee=J);if(ee!==H)return ee;let te=H;for(const J of U.index.units)J.binary!==U.binary&&J.factor!==1||J.factor<te.factor&&(te=J);return te.factor<U.base.factor?te:U.base}function R(I,U){const X=I.index.units.find(_=>_.symbol===U);if(X)return X;const q=I.index.byToken.get(String(U).toLowerCase());return q&&q!==x?q:(F(`unit:display:${U}`,`unknown display unit "${U}"; rendering in ${I.base.symbol}`),I.base)}function S(I,U,X,q){const _=I<0;let H=Math.abs(I)*U.base.factor;const ee=typeof q.decimals=="number"?q.decimals:q.minDecimals??0,te=typeof q.decimals=="number"?q.decimals:q.maxDecimals??Math.max(ee,2),J=q.space??" ",ne=[];for(let ae=0;ae<X.length;ae++){const we=X[ae],fe=ae===X.length-1;let ge=fe?H/we.factor:Math.floor(H/we.factor);if(H-=ge*we.factor,fe){const Pe=10**te;ge=Math.round(ge*Pe)/Pe+0}const je=fe?P(q.locale,ee,te,q.group!==!1):P(q.locale,0,0,q.group!==!1);ne.push(`${je.format(ge)}${J}${we.symbol}`)}const se=ne.join(" ");return _?`-${se}`:se}function E(I,U){const X=U||{},q=X.nullDisplay??"";if(N(I)||I==="")return q;const _=typeof I=="number"?I:Number(I);if(!Number.isFinite(_))return q;const H=o(X);if(!H)return String(_);const ee=d(X,H);if(ee)return S(_,H,ee,X);const te=typeof X.significantFigures=="number"&&X.significantFigures>0?X.significantFigures:0,J=te?W(_,te):_,ne=K(J,H,X.display),se=i(J,H.base,ne);let ae=typeof X.decimals=="number"?X.decimals:X.minDecimals??0,we=typeof X.decimals=="number"?X.decimals:X.maxDecimals??Math.max(ae,2);te&&(ae=V(se,te),we=ae);const fe=P(X.locale,ae,we,X.group!==!1).format(se),ge=X.space??" ";return X.placement==="prefix"?`${ne.symbol}${X.space??""}${fe}`:`${fe}${ge}${ne.symbol}`}function O(I,U){const X=N(I)||Number.isNaN(I)?null:Number(I),q=N(U)||Number.isNaN(U)?null:Number(U);return X===null||Number.isNaN(X)?q===null||Number.isNaN(q)?0:1:q===null||Number.isNaN(q)||X<q?-1:X>q?1:0}function M(I){const U=typeof I.decimals=="number"&&I.decimals>0?`.${"0".repeat(I.decimals)}`:"";return`${typeof I.decimals=="number"?`#,##0${U}`:"#,##0.##"}" ${I.symbol}"`}function T(I){const U={system:"data",...I||{}},X=o(U),q=X?X.base.symbol:String(U.unit||""),_=Object.freeze({...U,unit:q}),H=Object.freeze({..._,display:q,decimals:void 0,minDecimals:0,maxDecimals:20,group:!1}),ee=new Map([[_.locale||"",_]]),te=J=>{const ne=J||"";let se=ee.get(ne);return se||(se=Object.freeze({..._,locale:J||void 0}),ee.set(ne,se)),se};return{base:"number",extends:"number",storage:"float64",unitConfig:_,format:J=>E(J.value,J.locale?te(J.locale):_),parse:J=>w(J.text,J.locale?te(J.locale):_),compare:O,defaults:{filter:"number",editor:"unit",align:"end",total:U.total||"sum"},...U.totals?{totals:U.totals}:{},excel:U.excel||M({decimals:U.decimals,symbol:q}),toStorage:J=>typeof J=="number"?Number.isFinite(J)?J:null:typeof J=="string"?w(J,_):N(J)?null:w(String(J),_),toClipboard:J=>E(J,H),fromClipboard:J=>w(J,_)}}const A=T}),He("packages/core/src/columns/types/engineering.js",function(e,D){"use strict";Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return L}});const N=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/columns/types/unit.js").createUnitType;function L(x){const Y=2*Math.PI/x;return $=>{let j=0,k=0,y=0;for(const m of $||[]){if(N(m))continue;const s=Number(m);Number.isFinite(s)&&(j+=Math.cos(s*Y),k+=Math.sin(s*Y),y+=1)}return!y||Math.hypot(j,k)/y<1e-12?null:(Math.atan2(k,j)/Y%x+x)%x}}function Z(x){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:L(x)}}}const z=Object.freeze({metres:F({system:"length",unit:"m",display:"auto",maxDecimals:3}),millimetres:F({system:"length",unit:"mm",maxDecimals:2}),kilometres:F({system:"length",unit:"km",maxDecimals:3}),grams:F({system:"mass",unit:"g",display:"auto",maxDecimals:3}),kilograms:F({system:"mass",unit:"kg",maxDecimals:3}),tonnes:F({system:"mass",unit:"t",maxDecimals:3}),seconds:F({system:"duration",unit:"s",display:"auto",maxDecimals:3}),milliseconds:F({system:"duration",unit:"ms",maxDecimals:3}),hours:F({system:"duration",unit:"h",maxDecimals:2}),speed:F({system:"speed",unit:"m/s",display:"auto",maxDecimals:2}),kph:F({system:"speed",unit:"km/h",maxDecimals:1}),mph:F({system:"speed",unit:"mph",maxDecimals:1}),knots:F({system:"speed",unit:"kn",maxDecimals:1}),acceleration:F({system:"acceleration",unit:"m/s²",maxDecimals:3}),area:F({system:"area",unit:"m²",display:"auto",maxDecimals:2}),hectares:F({system:"area",unit:"ha",maxDecimals:4}),volume:F({system:"volume",unit:"L",display:"auto",maxDecimals:3}),cubicMetres:F({system:"volume",unit:"m³",maxDecimals:3}),energy:F({system:"energy",unit:"J",display:"auto",maxDecimals:3}),kilowattHours:F({system:"energy",unit:"kWh",maxDecimals:2}),power:F({system:"power",unit:"W",display:"auto",maxDecimals:2}),kilowatts:F({system:"power",unit:"kW",maxDecimals:2}),force:F({system:"force",unit:"N",display:"auto",maxDecimals:2}),pressure:F({system:"pressure",unit:"Pa",display:"auto",maxDecimals:2}),bar:F({system:"pressure",unit:"bar",maxDecimals:3}),psi:F({system:"pressure",unit:"psi",maxDecimals:1}),torque:F({system:"torque",unit:"N·m",maxDecimals:2}),density:F({system:"density",unit:"kg/m³",maxDecimals:2}),flow:F({system:"flow",unit:"m³/s",maxDecimals:4}),litresPerMinute:F({system:"flow",unit:"L/min",maxDecimals:1}),radians:F({system:"angle",unit:"rad",maxDecimals:4,totals:Z(2*Math.PI)}),degrees:F({system:"angle",unit:"°",maxDecimals:2,totals:Z(360)}),rpm:F({system:"angularVelocity",unit:"rpm",maxDecimals:0}),angularVelocity:F({system:"angularVelocity",unit:"rad/s",maxDecimals:3}),ppm:F({system:"fraction",unit:"ppm",maxDecimals:2}),ppb:F({system:"fraction",unit:"ppb",maxDecimals:2}),basisPoints:F({system:"fraction",unit:"bp",maxDecimals:1}),molarity:F({system:"molarity",unit:"M",display:"auto",maxDecimals:3}),massFlow:F({system:"massFlow",unit:"kg/s",maxDecimals:3}),tonnesPerHour:F({system:"massFlow",unit:"t/h",maxDecimals:2}),viscosity:F({system:"viscosity",unit:"Pa·s",display:"auto",maxDecimals:3}),kinematicViscosity:F({system:"kinematicViscosity",unit:"cSt",maxDecimals:2}),thermalConductivity:F({system:"thermalConductivity",unit:"W/(m·K)",maxDecimals:3}),specificHeat:F({system:"specificHeat",unit:"J/(kg·K)",maxDecimals:1}),doseRate:F({system:"doseRate",unit:"µSv/h",display:"auto",maxDecimals:2})})}),He("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 z}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return j}});const re=D("packages/core/src/columns/types/unit.js"),N=re.defineUnit,G=re.registerUnitSystem,F=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})]),Z=Object.freeze(["p","n","µ","m","","k","M","G"]);function z(k){const y=String(k.base),c=new Set([...k.prefixes||Z,""]),m=[];for(const s of L){if(!c.has(s.symbol))continue;const t=`${s.symbol}${y}`,o=[];if(k.name){o.push(`${s.name}${k.name}`,`${s.name}${k.name}s`);const u=s.name.slice(-1);if(u&&k.name.startsWith(u)){const d=`${s.name.slice(0,-1)}${k.name}`;o.push(d,`${d}s`)}}s.symbol==="µ"&&o.push(`u${y}`),s.factor===1&&k.aliases&&o.push(...k.aliases),m.push(N(t,s.factor,o))}for(const s of k.extra||[])m.push(s);return m}function x(k,y){const c=z(y);return G(k,c)}function Y(k,y,c){return x(k,y),F({system:k,unit:y.base,display:"auto",maxDecimals:3,...c||{}})}const $=Object.freeze({voltage:Y("voltage",{base:"V",name:"volt"}),current:Y("current",{base:"A",name:"amp",aliases:["ampere","amperes"]}),resistance:Y("resistance",{base:"Ω",name:"ohm",aliases:["ohm","ohms","R"],prefixes:["m","","k","M","G"]}),capacitance:Y("capacitance",{base:"F",name:"farad",prefixes:["f","p","n","µ","m",""]}),inductance:Y("inductance",{base:"H",name:"henry",prefixes:["p","n","µ","m",""]}),charge:Y("charge",{base:"C",name:"coulomb",prefixes:["p","n","µ","m",""],extra:[N("mAh",3.6,["milliamphour","milliamphours"],{auto:!1}),N("Ah",3600,["amphour","amphours"],{auto:!1})]}),conductance:Y("conductance",{base:"S",name:"siemens",prefixes:["n","µ","m","","k"]}),fluxDensity:Y("fluxDensity",{base:"T",name:"tesla",prefixes:["n","µ","m",""],extra:[N("G",1e-4,["gauss"],{auto:!1})]}),luminousFlux:Y("luminousFlux",{base:"lm",name:"lumen",prefixes:["m","","k"]}),illuminance:Y("illuminance",{base:"lx",name:"lux",prefixes:["m","","k"]}),luminousIntensity:Y("luminousIntensity",{base:"cd",name:"candela",prefixes:["m","","k"]}),substance:Y("substance",{base:"mol",name:"mole",prefixes:["n","µ","m","","k"]}),absorbedDose:Y("absorbedDose",{base:"Gy",name:"gray",prefixes:["µ","m",""]}),equivalentDose:Y("equivalentDose",{base:"Sv",name:"sievert",prefixes:["n","µ","m",""]}),radioactivity:Y("radioactivity",{base:"Bq",name:"becquerel",prefixes:["","k","M","G","T"],extra:[N("Ci",37e9,["curie","curies"],{auto:!1})]}),frequency:Y("frequency",{base:"Hz",name:"hertz",prefixes:["m","","k","M","G","T"]})}),j=Y}),He("packages/core/src/columns/types/temperature.js",function(e,D){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});const N=D("packages/core/src/internal/predicates.js").isNil,G=Object.freeze({C:Object.freeze({symbol:"°C",aliases:["c","°c","celsius","centigrade"],toKelvin:m=>m+273.15,fromKelvin:m=>m-273.15}),F:Object.freeze({symbol:"°F",aliases:["f","°f","fahrenheit"],toKelvin:m=>(m+459.67)*(5/9),fromKelvin:m=>m*(9/5)-459.67}),K:Object.freeze({symbol:"K",aliases:["k","kelvin"],toKelvin:m=>m,fromKelvin:m=>m}),R:Object.freeze({symbol:"°R",aliases:["r","°r","rankine"],toKelvin:m=>m*(5/9),fromKelvin:m=>m*(9/5)})});function F(m){if(N(m))return null;const s=String(m).trim();if(s==="")return null;for(const[o,u]of Object.entries(G))if(s===o||s===u.symbol)return{key:o,scale:u};const t=s.toLowerCase();for(const[o,u]of Object.entries(G))if(u.aliases.includes(t))return{key:o,scale:u};return null}function L(m,s,t){const o=F(s),u=F(t);return!o||!u||!Number.isFinite(Number(m))?null:o.key===u.key?Number(m):u.scale.fromKelvin(o.scale.toKelvin(Number(m)))}const Z=new Map;function z(m,s,t){const o=`${m||""}|${s}|${t}`;let u=Z.get(o);return u||(u=new Intl.NumberFormat(m||void 0,{minimumFractionDigits:s,maximumFractionDigits:t}),Z.set(o,u)),u}function x(m,s){const t=s||{},o=t.nullDisplay??"";if(N(m)||m==="")return o;const u=Number(m);if(!Number.isFinite(u))return o;const d=F(t.scale||"C");if(!d)return String(u);const i=F(t.display||t.scale||"C")||d,g=i.key===d.key?u:i.scale.fromKelvin(d.scale.toKelvin(u)),r=typeof t.decimals=="number"?t.decimals:null,n=r??t.minDecimals??0,f=r??t.maxDecimals??1;return`${z(t.locale,n,f).format(g)}${t.space??" "}${i.scale.symbol}`}const Y=/^[+-]?[\d\s., ]*\d/;function $(m,s){const t=String(m).trim();if(t==="")return null;const o=new Intl.NumberFormat(s||void 0).formatToParts(1.1).find(g=>g.type==="decimal")?.value||".",u=o===","?".":",",d=t.split(u).join("").split(/[\s ]/).join("").replace(o,"."),i=Number(d);return Number.isFinite(i)?i:null}function j(m,s){if(N(m))return null;const t=s||{},o=F(t.scale||"C");if(!o)return null;if(typeof m=="number")return Number.isFinite(m)?m:null;let u=String(m).trim();if(u==="")return null;let d=!1;u.startsWith("(")&&u.endsWith(")")&&(d=!0,u=u.slice(1,-1).trim());const i=Y.exec(u);if(!i)return null;const g=$(i[0],t.locale);if(g===null)return null;const r=u.slice(i[0].length).trim();if(r==="")return d?-g:g;const n=F(r);if(!n)return null;const f=n.key===o.key?g:o.scale.fromKelvin(n.scale.toKelvin(g));return d?-f:f}function k(m){const s=Object.freeze({scale:"C",...m||{}}),o=(F(s.scale)||F("C")).scale.symbol,u=Object.freeze({...s,display:s.scale,decimals:void 0,minDecimals:0,maxDecimals:20}),d=new Map([[s.locale||"",s]]),i=g=>{const r=g||"";let n=d.get(r);return n||(n=Object.freeze({...s,locale:g||void 0}),d.set(r,n)),n};return{base:"number",extends:"number",storage:"float64",temperatureConfig:s,format:g=>x(g.value,g.locale?i(g.locale):s),parse:g=>j(g.text,g.locale?i(g.locale):s),defaults:{filter:"number",editor:"temperature",align:"end",total:"avg"},totals:{supported:["avg","min","max","count","countValues"]},excel:s.excel||`#,##0${typeof s.decimals=="number"&&s.decimals>0?`.${"0".repeat(s.decimals)}`:".#"}" ${o}"`,toStorage:g=>typeof g=="number"?Number.isFinite(g)?g:null:typeof g=="string"?j(g,s):N(g)?null:j(String(g),s),toClipboard:g=>x(g,u),fromClipboard:g=>j(g,s)}}const y=Object.freeze({celsius:k({scale:"C"}),fahrenheit:k({scale:"F"}),kelvin:k({scale:"K"})}),c=k}),He("packages/core/src/columns/types/radix.js",function(e,D){"use strict";Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"digitsForWidth",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"radixRange",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"radixName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"normaliseRadixOptions",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"compileRadixFormat",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"compileRadixParse",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"parseRadixResult",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return S}});const N=D("packages/core/src/internal/predicates.js").isNil,F=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}),Z=Object.freeze({2:1,8:3,16:4}),z=Object.freeze({2:"0b",8:"0o",16:"0x"}),x=Object.freeze({2:4,8:3,16:2}),Y=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),$=Object.freeze({2:"binary",8:"octal",16:"hexadecimal"}),j=Object.freeze([[/^0x/i,16],[/^0b/i,2],[/^0o/i,8],[/^#/,16]]),k=/[\s\u00a0\u202f_,']/g,y=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,c=Object.freeze([8,16,32,53]),m=new WeakSet,s=new WeakMap,t=new Map,o=new WeakMap,u=new WeakMap,d=Object.freeze({hex:Object.freeze({radix:16}),hex8:Object.freeze({radix:16,bitWidth:8,pad:!0,signed:!1}),hex16:Object.freeze({radix:16,bitWidth:16,pad:!0,signed:!1}),hex32:Object.freeze({radix:16,bitWidth:32,pad:!0,signed:!1}),binary:Object.freeze({radix:2}),binary8:Object.freeze({radix:2,bitWidth:8,pad:!0,signed:!1,group:4}),octal:Object.freeze({radix:8})});function i(E){if(E==null)return 16;const O=typeof E=="string"?E.toLowerCase():E,M=L[O];return M||(F(`radix:base:${String(E)}`,`unsupported radix ${String(E)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function g(E,O){return Math.ceil(E/Z[O])}function r(E,O){if(!E)return O?{min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}:{min:0,max:Number.MAX_SAFE_INTEGER};if(!O)return{min:0,max:2**E-1};const M=2**(E-1);return{min:-M,max:M-1}}function n(E){return $[E]||"hexadecimal"}function f(E){if(typeof E=="string"){const O=d[E];return O||F(`radix:preset:${E}`,`unknown radix preset "${E}"; known presets are ${Object.keys(d).join(", ")}`),{...O||{}}}if(E&&typeof E.preset=="string"){const O=d[E.preset];return O||F(`radix:preset:${E.preset}`,`unknown radix preset "${E.preset}"; known presets are ${Object.keys(d).join(", ")}`),{...O||{},...E}}return E||{}}function h(E){const O=f(E),M=i(O.radix),T=Z[M];let A=null;if(O.bitWidth!==void 0&&O.bitWidth!==null&&O.bitWidth!==!1){const J=Number(O.bitWidth);c.includes(J)?A=J:F(`radix:width:${String(O.bitWidth)}`,`unsupported bitWidth ${String(O.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let I=O.signed!==!1;!I&&A===null&&(F("radix:unsigned:width","signed: false needs a bitWidth to render a two's-complement pattern; defaulting to 32"),A=32);const U=O.prefix===void 0||O.prefix===!0?z[M]:O.prefix===!1?"":String(O.prefix);let X=0;O.pad===!0?X=A?g(A,M):0:typeof O.pad=="number"&&O.pad>0&&(X=Math.floor(O.pad));let q=0;O.group===!0?q=x[M]:typeof O.group=="number"&&O.group>0&&(q=Math.floor(O.group));const _=r(A,I),H=typeof O.min=="number"?Math.max(_.min,O.min):_.min,ee=typeof O.max=="number"?Math.min(_.max,O.max):_.max,te=Object.freeze({radix:M,bits:T,prefix:U,uppercase:O.uppercase!==!1,pad:X,group:q,groupSeparator:typeof O.groupSeparator=="string"?O.groupSeparator:" ",bitWidth:A,signed:I,min:H,max:ee<H?H:ee,nullDisplay:typeof O.nullDisplay=="string"?O.nullDisplay:"",name:n(M)});return m.add(te),te}function l(E){if(E&&m.has(E))return E;if(typeof E=="string"){let O=t.get(E);return O||(O=h(E),t.set(E,O)),O}if(E&&typeof E=="object"){let O=s.get(E);return O||(O=h(E),s.set(E,O)),O}return l("hex")}function b(E){return E<0?-Math.round(-E):Math.round(E)}function a(E,O,M){if(O<=0||E.length<=O)return E;const T=E.length%O||O,A=[E.slice(0,T)];for(let I=T;I<E.length;I+=O)A.push(E.slice(I,I+O));return A.join(M)}function p(E){const O=l(E),{radix:M,prefix:T,uppercase:A,pad:I,group:U,groupSeparator:X,signed:q,bitWidth:_,nullDisplay:H}=O,ee=_?2**_:0,te=J=>{if(N(J)||J==="")return H;const ne=typeof J=="number"?J:Number(J);if(!Number.isFinite(ne))return H;const se=b(ne);let ae="",we=se;se<0&&(q?(ae="-",we=-se):we=(se%ee+ee)%ee);let fe=we.toString(M);return fe=A?fe.toUpperCase():fe.toLowerCase(),I>0&&fe.length<I&&(fe=fe.padStart(I,"0")),U>0&&(fe=a(fe,U,X)),ae+T+fe};return te.options=O,te}function w(E,O){const M=l(O);let T=o.get(M);return T||(T=p(M),o.set(M,T)),T(E)}function v(E){const O=l(E),{radix:M,groupSeparator:T,signed:A,min:I,max:U}=O,X=Y[M],q=_=>{if(N(_))return{ok:!0,value:null,reason:"blank"};let H=String(_);if(T&&T!==""&&(H=H.split(T).join("")),H=H.replace(k,""),H==="")return{ok:!0,value:null,reason:"blank"};let ee=!1;if((H[0]==="-"||H[0]==="+")&&(ee=H[0]==="-",H=H.slice(1)),H==="")return{ok:!1,value:null,reason:"digits"};let te=null;for(const[ne,se]of j){const ae=ne.exec(H);if(!ae)continue;const we=H.slice(ae[0].length);if(we==="")break;if(!Y[se].test(we))return{ok:!1,value:null,reason:"digits"};te=parseInt(we,se);break}if(te===null)if(X.test(H))te=parseInt(H,M);else if(y.test(H))te=Number(H);else return{ok:!1,value:null,reason:"digits"};if(!Number.isFinite(te))return{ok:!1,value:null,reason:"digits"};const J=b(ee?-te:te);return!A&&J<0?{ok:!1,value:J,reason:"negative"}:J<I||J>U?{ok:!1,value:J,reason:"range"}:{ok:!0,value:J,reason:"ok"}};return q.options=O,q}function P(E,O){const M=l(O);let T=u.get(M);return T||(T=v(M),u.set(M,T)),T(E)}function V(E,O){const M=P(E,O);return M.ok?M.value:null}function W(E,O){const M=N(E)||Number.isNaN(E)?null:Number(E),T=N(O)||Number.isNaN(O)?null:Number(O);return M===null?T===null?0:1:T===null||M<T?-1:M>T?1:0}function K(E){const O=E.min>=-2147483648&&E.max<=2147483647;return E.bitWidth&&O?"int32":"float64"}function R(E){const O=h(E),M=p(O),T=v(O);return{base:"number",extends:"number",storage:K(O),matches:null,format:A=>M(A.value),parse:A=>{const I=T(A.text);return I.ok?I.value:null},compare:W,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:A=>M(A),fromClipboard:A=>{const I=T(A);return I.ok?I.value:null},radix:O,formatValue:M,parseText:T}}const S=R}),He("packages/core/src/columns/types/aggregable.js",function(e,D){"use strict";Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"weightedMean",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"logarithmicSum",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"logarithmicMean",{enumerable:!0,get:function(){return L}});const N=D("packages/core/src/internal/predicates.js").isNil;function G($){const j=[];for(const k of $||[]){if(N(k))continue;const y=Number(k);Number.isFinite(y)&&j.push(y)}return j}function F($){return j=>{const k=G(j);if(!k.length)return null;let y=0;for(const c of k)y+=10**(c/$);return $*Math.log10(y)}}function L($){return j=>{const k=G(j);if(!k.length)return null;let y=0;for(const c of k)y+=10**(c/$);return $*Math.log10(y/k.length)}}function Z($,j){const k=j&&j.column,c=(k&&k.typeOptions||{}).weight,m=j&&j.valueAt;if(!c||typeof m!="function")return null;let s=0,t=0;for(let o=0;o<$.length;o++){if(N($[o]))continue;const u=Number($[o]);if(!Number.isFinite(u))continue;const d=m(c,o);if(N(d))continue;const i=Number(d);!Number.isFinite(i)||i<=0||(s+=u*i,t+=i)}return t===0?null:s/t}function z($={}){const j=$.factor===20?20:10,k=typeof $.suffix=="string"?$.suffix:"",y=Number.isInteger($.decimals)?$.decimals:1;return{base:"number",storage:"float64",name:$.name||"logarithmic",format:c=>{const m=c&&c.value;return N(m)||!Number.isFinite(Number(m))?"":`${Number(m).toFixed(y)}${k}`},parse:c=>{const m=String((c&&c.text)??"").replace(k,"").trim();if(!m)return null;const s=Number(m);return Number.isFinite(s)?s:null},defaults:{align:"end",filter:"number"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:{sum:F(j),avg:L(j)}}}}function x($={}){const j=Number.isInteger($.decimals)?$.decimals:1,k=$.percent===!0;return{base:"number",storage:"float64",name:$.name||"ratio",format:y=>{const c=y&&y.value;return N(c)||!Number.isFinite(Number(c))?"":k?`${Number(c).toFixed(j)}%`:Number(c).toFixed(j)},parse:y=>{const c=String((y&&y.text)??"").replace("%","").trim();if(!c)return null;const m=Number(c);return Number.isFinite(m)?m:null},defaults:{align:"end",filter:"number"},totals:{supported:["avg","min","max","count","countValues"],implement:{avg:Z}}}}const Y=Object.freeze({decibel:z({name:"decibel",factor:10,suffix:" dB"}),decibelAmplitude:z({name:"decibelAmplitude",factor:20,suffix:" dB"}),ratio:x({name:"ratio"}),percentRate:x({name:"percentRate",percent:!0})})}),He("packages/core/src/columns/types/currency.js",function(e,D){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"moneyToText",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return i}});const N=D("packages/core/src/internal/predicates.js").isNil,G="⚠ no rate";function F(g){if(N(g))return null;const r=String(g).trim().toUpperCase();return r===""?null:r}function L(g){if(N(g))return null;if(typeof g=="object"&&!Array.isArray(g)){const r=Number(g.amount),n=F(g.code);return!n||!Number.isFinite(r)?null:{amount:r,code:n}}if(Array.isArray(g)&&g.length===2){const r=Number(g[0]),n=F(g[1]);return!n||!Number.isFinite(r)?null:{amount:r,code:n}}return null}const Z=Object.freeze({$:"USD","€":"EUR","£":"GBP","¥":"JPY","₹":"INR","₩":"KRW","₽":"RUB","₺":"TRY","₴":"UAH","₪":"ILS"}),z=Object.freeze({USD:"$",EUR:"€",GBP:"£",JPY:"¥",INR:"₹",KRW:"₩",RUB:"₽",TRY:"₺",UAH:"₴",ILS:"₪"}),x=/[+-]?[\d\s., ]*\d/;function Y(g,r){const n=String(g).trim();if(n==="")return null;const f=new Intl.NumberFormat(r||void 0).formatToParts(1.1).find(a=>a.type==="decimal")?.value||".",h=f===","?".":",",l=n.split(h).join("").split(/[\s ]/).join("").replace(f,"."),b=Number(l);return Number.isFinite(b)?b:null}function $(g,r){const n=r||{},f=F(n.code);if(N(g))return null;const h=L(g);if(h)return h;if(typeof g=="number")return Number.isFinite(g)&&f?{amount:g,code:f}:null;let l=String(g).trim();if(l==="")return null;let b=!1;l.startsWith("(")&&l.endsWith(")")&&(b=!0,l=l.slice(1,-1).trim());let a=null;for(const[W,K]of Object.entries(Z)){if(l.startsWith(W)){a=K,l=l.slice(W.length).trim();break}if(l.endsWith(W)){a=K,l=l.slice(0,-W.length).trim();break}}const p=x.exec(l);if(!p)return null;const w=Y(p[0],n.locale);if(w===null)return null;const v=(l.slice(0,p.index)+" "+l.slice(p.index+p[0].length)).trim();!a&&v!==""&&(a=F(v));const P=a||f;return P?{amount:b?-w:w,code:P}:null}function j(g,r){if(typeof g=="function")return(n,f)=>{if(n===f)return 1;const h=g(n,f);return typeof h=="number"&&Number.isFinite(h)&&h>0?h:null};if(g&&typeof g=="object"){const n=g;return(f,h)=>{if(f===h)return 1;const l=Number(n[f]),b=Number(n[h]);return!Number.isFinite(l)||!Number.isFinite(b)||l<=0||b<=0?null:b/l}}return(n,f)=>n===f?1:null}function k(g,r,n){if(!g)return null;if(g.code===r)return g.amount;const f=n(g.code,r);return f===null?null:g.amount*f}const y=new Map;function c(g,r,n){const f=`${g||""}|${r}|${n??""}`;let h=y.get(f);if(!h){const l={style:"currency",currency:r};typeof n=="number"&&(l.minimumFractionDigits=n,l.maximumFractionDigits=n);try{h={fmt:new Intl.NumberFormat(g||void 0,l),currency:!0}}catch{h={fmt:new Intl.NumberFormat(g||void 0,typeof n=="number"?{minimumFractionDigits:n,maximumFractionDigits:n}:{}),currency:!1}}y.set(f,h)}return h}function m(g,r){const n=r||{},f=n.nullDisplay??"",h=L(g);if(!h)return f;const l=F(n.display)||h.code;let b=h.amount,a=h.code;if(l!==h.code){const v=n.rateFn||j(n.rates,n.rateBase),P=k(h,l,v);if(P===null)return`${n.missingRate??G} ${h.code}→${l}`;b=P,a=l}const{fmt:p,currency:w}=c(n.locale,a,n.decimals);return w?p.format(b):`${p.format(b)} ${a}`}function s(g){const r=L(g);return r?`${r.amount} ${r.code}`:""}function t(g){const r=g||{},n=F(r.display),f=r.rateFn||j(r.rates,r.rateBase);return(h,l)=>{const b=L(h),a=L(l);if(!b&&!a)return 0;if(!b)return 1;if(!a)return-1;if(n){const p=k(b,n,f),w=k(a,n,f);if(p!==null&&w!==null)return p===w?0:p<w?-1:1}return b.code===a.code?b.amount===a.amount?0:b.amount<a.amount?-1:1:b.code<a.code?-1:1}}function o(g){const r=g||{},n=(h,l)=>{const b=[];for(const P of h||[]){const V=L(P);V&&b.push(V)}if(!b.length)return null;if(new Set(b.map(P=>P.code)).size===1){const P=b[0].code;return{amount:l(b.map(V=>V.amount)),code:P}}const p=F(r.display);if(!p)return`${r.missingRate??G}: mixed currencies, no display currency set`;const w=r.rateFn||j(r.rates,r.rateBase),v=[];for(const P of b){const V=k(P,p,w);if(V===null)return`${r.missingRate??G}: ${P.code}→${p}`;v.push(V)}return{amount:l(v),code:p}},f=h=>h.reduce((l,b)=>l+b,0);return{sum:h=>n(h,f),avg:h=>n(h,l=>f(l)/l.length),min:h=>n(h,l=>Math.min(...l)),max:h=>n(h,l=>Math.max(...l))}}function u(g){const r=Object.freeze({code:"USD",...g||{}}),n=j(r.rates,r.rateBase),f=Object.freeze({...r,rateFn:n}),h=o(f),l=t(f),b=new Map([[r.locale||"",f]]),a=v=>{const P=v||"";let V=b.get(P);return V||(V=Object.freeze({...f,locale:v||void 0}),b.set(P,V)),V},p=z[F(r.display||r.code)]||"",w=typeof r.decimals=="number"&&r.decimals>0?`.${"0".repeat(r.decimals)}`:".00";return{base:"object",extends:"object",storage:"object",name:"currency",currencyConfig:f,format:v=>m(v.value,v.locale?a(v.locale):f),parse:v=>$(v.text,v.locale?a(v.locale):f),compare:l,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:h},excel:r.excel||(p?`"${p}"#,##0${w}`:`#,##0${w}`),toStorage:v=>{const P=L(v);return P||(typeof v=="string"||typeof v=="number"?$(v,f):null)},toClipboard:v=>s(v),fromClipboard:v=>$(v,f)}}const d=Object.freeze({currency:u({code:"USD"}),usd:u({code:"USD"}),eur:u({code:"EUR"}),gbp:u({code:"GBP"}),jpy:u({code:"JPY",decimals:0})}),i=u}),He("packages/core/src/columns/types/index.js",function(e,D){"use strict";Object.defineProperty(e,"EXTENDED_TYPES",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return W}});const re=D("packages/core/src/columns/types/temporal.js"),N=re.TEMPORAL_TYPES,G=D("packages/core/src/columns/types/network.js"),F=G.NETWORK_TYPES,L=D("packages/core/src/columns/types/structured.js"),Z=L.STRUCTURED_TYPES,z=D("packages/core/src/columns/types/unit.js"),x=z.createUnitType,Y=z.UNIT_SYSTEMS,$=z.parseUnit,j=z.formatUnit,k=z.registerUnitSystem,y=z.unitSystemNames,c=z.unitsOf,m=z.defineUnit,s=D("packages/core/src/columns/types/engineering.js"),t=s.ENGINEERING_TYPES,o=D("packages/core/src/columns/types/si.js"),u=o.SI_TYPES,d=o.createSiType,i=o.createSiSystem,g=o.siUnits,r=o.SI_PREFIXES,n=D("packages/core/src/columns/types/temperature.js"),f=n.TEMPERATURE_TYPES,h=n.createTemperatureType,l=n.convertTemperature,b=n.formatTemperature,a=n.parseTemperature,p=n.TEMPERATURE_SCALES,w=D("packages/core/src/columns/types/radix.js"),v=w.createRadixType,P=w.RADIX_PRESETS,V=w.parseRadix,W=w.formatRadix,K=D("packages/core/src/columns/types/aggregable.js"),R=K.AGGREGABLE_TYPES,S=D("packages/core/src/columns/types/currency.js"),E=S.CURRENCY_TYPES,O=S.createCurrencyType,M=S.parseMoney,T=S.formatMoney,A=S.convertMoney,I=S.toMoney,U=S.rateFunction,X=S.moneyComparator,q=S.normaliseCode,_=S.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return z.findUnit}}),Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return s.ENGINEERING_TYPES}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return s.circularMean}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return n.TEMPERATURE_TYPES}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return n.createTemperatureType}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return n.convertTemperature}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return n.formatTemperature}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return n.parseTemperature}}),Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return n.TEMPERATURE_SCALES}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return n.findScale}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return S.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return S.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return S.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return S.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return S.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return S.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return S.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return S.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return S.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return S.MISSING_RATE}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return re.TEMPORAL_TYPES}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return G.NETWORK_TYPES}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return L.STRUCTURED_TYPES}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return K.AGGREGABLE_TYPES}}),Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return K.createLogarithmicType}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return K.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 G.parseIpv4}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return G.formatIpv4}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return G.parseCidr}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return G.formatCidr}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return G.parseIpv6}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return G.formatIpv6}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return G.networkAddress}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return G.broadcastAddress}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return G.hostCount}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return G.containsAddress}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return G.overlaps}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return L.maskValue}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return L.summariseJson}});const H=Object.freeze({...N,...F,...Z,...R,hex:v(P.hex),hex8:v(P.hex8),hex16:v(P.hex16),hex32:v(P.hex32),binary:v(P.binary),binary8:v(P.binary8),octal:v(P.octal),bytes:x({system:"data",unit:"B",display:"auto"}),megabytes:x({system:"data",unit:"MB"}),gigabytes:x({system:"data",unit:"GB"}),bitrate:x({system:"bitrate",unit:"Mbps"}),gigabits:x({system:"bitrate",unit:"Gbps"}),...t,...u,...f,...E});{const ee=new Set;for(const te of[N,F,Z,R,t,u,f,E])for(const J of Object.keys(te)){if(ee.has(J))throw new Error(`[lattice] data type "${J}" is declared twice`);ee.add(J)}}}),He("packages/core/src/compute/handle.js",function(e,D){"use strict";Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return u}});const re=D("packages/core/src/internal/compare.js"),N=re.collator,G=re.defaultCompare,L=D("packages/core/src/internal/warn.js").warnOnce;function Z(d){const i=new Uint32Array(d);for(let g=0;g<d;g++)i[g]=g;return i}function z(d,i){if(i&&typeof i.count=="number")return i.count;if(!d)return 0;if(typeof d.count=="number")return d.count;if(typeof d.length=="number")return d.length;const g=d.values;return d.kind==="multi"&&d.offsets?Math.max(0,d.offsets.length-1):g?d.kind==="bitset"?typeof g.size=="number"?g.size:d.presence&&typeof d.presence.size=="number"?d.presence.size:(L(`count:${d.id}`,`column "${d.id}" is bitset-backed with no declared row count; assuming ${g.length*8}`),g.length*8):g.length:d.presence&&typeof d.presence.size=="number"?d.presence.size:0}const x=new WeakMap;function Y(d){const i=d.constructor;if(!i)return"unknown";const g=x.get(i);if(g)return g;let r="unknown";try{let n=null;typeof i.from=="function"?n=i.from([!1,!0]):(n=new i(8),n.set(1));const f=n&&n.words;f&&f.length&&(f[0]===2?r="lsb":f[0]===64&&(r="msb"))}catch{r="unknown"}return x.set(i,r),r}function $(d){if(!d)return()=>0;const i=d instanceof Uint8Array?d:d.words;if(i instanceof Uint8Array){const g=d instanceof Uint8Array?"lsb":Y(d);if(g==="lsb")return r=>i[r>>>3]>>>(r&7)&1;if(g==="msb")return r=>i[r>>>3]>>>7-(r&7)&1}return typeof d.get=="function"?g=>d.get(g)?1:0:()=>0}function j(d){return!d||!d.presence?null:$(d.presence)}function k(d){return d?typeof d.size=="number"?d.size:typeof d.values=="function"?d.values().length:0:0}function y(d,i){return d?typeof d.valueOf=="function"?d.valueOf(i):typeof d.values=="function"?d.values()[i]:null:null}function c(d,i){const g=d.offsets,r=d.values;if(!g||!r)return[];const n=g[i],f=g[i+1];if(!(f>n))return[];const h=d.dict,l=new Array(f-n);for(let b=n;b<f;b++)l[b-n]=h?y(h,r[b]):r[b];return l}function m(d){if(!d)return()=>{};const i=d.values,g=j(d),r=d.kind;if(r==="dictionary"){const n=d.dict;return g?f=>g(f)?y(n,i[f]):null:f=>y(n,i[f])}if(r==="bitset"){const n=$(i);return g?f=>g(f)?n(f)===1:null:f=>n(f)===1}if(r==="multi")return g?n=>g(n)?c(d,n):null:n=>c(d,n);if(!i&&typeof d.get=="function"){const n=d.get.bind(d);return f=>{const h=n(f);return h===void 0?null:h}}return g?n=>{if(!g(n))return null;const f=i[n];return f===void 0?null:f}:n=>{const f=i[n];return f===void 0?null:f}}function s(d,i){if(d<i)return-1;if(d>i)return 1;if(d===i){const n=Object.is(d,-0),f=Object.is(i,-0);return n===f?0:n?-1:1}const g=Number.isNaN(d),r=Number.isNaN(i);return g&&r?0:g?1:-1}function t(d){const i=N(d);return(g,r)=>{if(g===r)return 0;const n=typeof g,f=typeof r;if(n==="string"&&f==="string")return i.compare(g,r);if(n==="number"&&f==="number")return s(g,r);if(n==="boolean"&&f==="boolean")return g===r?0:g?1:-1;if(g instanceof Date||r instanceof Date){const h=g instanceof Date?g.getTime():Number(g),l=r instanceof Date?r.getTime():Number(r);return s(h,l)}return G(g,r)}}function o(d,i){if(d&&typeof d.ranks=="function")return d.ranks(i);const g=d&&typeof d.values=="function"?d.values():[],r=g.length,n=t(i),f=new Array(r);for(let l=0;l<r;l++)f[l]=l;f.sort((l,b)=>n(g[l],g[b])||l-b);const h=new Uint32Array(r);for(let l=0;l<r;l++)h[f[l]]=l;return h}function u(d){return d==null||typeof d=="number"&&Number.isNaN(d)}}),He("packages/core/src/compute/filter.js",function(e,D){"use strict";Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"wallMs",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return we}});const N=D("packages/core/src/internal/predicates.js").isBlank,F=D("packages/core/src/internal/merge.js").toArray,Z=D("packages/core/src/internal/warn.js").warnOnce,z=D("packages/core/src/format/date.js"),x=z.toDate,Y=z.toIsoDate,$=D("packages/core/src/compute/handle.js"),j=$.bitReader,k=$.dictSize,y=$.dictValue,c=$.presenceReader,m=$.valueComparator,s=$.valueReader,t=/^\d{4}-\d{2}-\d{2}$/,o="\0null\0";function u(fe,ge){const je=fe&&fe.pool;if(je){const Pe=je.mask||je.acquireMask||je.acquire||je.take;if(typeof Pe=="function"){const de=Pe.call(je,ge);if(de&&de.length>=ge)return de}}return new Uint8Array(ge)}function d(fe,ge){const je=fe&&fe.pool;if(!je||!ge)return;const Pe=je.release||je.releaseMask||je.free||je.recycle;typeof Pe=="function"&&Pe.call(je,ge)}function i(fe,ge,je){return fe.fill(je,0,ge),fe}function g(fe){return fe==null||typeof fe=="number"&&Number.isNaN(fe)}function r(fe,ge){if(fe==null)return fe;if(ge==="number")return typeof fe=="number"?fe:Number(fe);if(ge==="date"||ge==="dateString"){const je=Y(fe);return je===null?n(fe):je}return ge==="boolean"?typeof fe=="boolean"?fe:fe==="true"||fe===1?!0:fe==="false"||fe===0?!1:!!fe:fe}function n(fe){return fe instanceof Date?fe.getTime():typeof fe=="number"?fe:Date.parse(String(fe))}function f(fe){return typeof fe=="number"?fe:fe instanceof Date?fe.getTime():fe==null||fe===""?NaN:Number(fe)}function h(fe,ge){const je=typeof fe=="string"?fe:String(fe);return ge?je:je.toLowerCase()}function l(fe,ge){return fe==null?o:typeof fe=="string"?ge?fe:fe.toLowerCase():fe instanceof Date?fe.getTime():fe}function b(fe,ge,je){const Pe=new Set;for(const de of F(fe)){const oe=r(de,je);Pe.add(l(oe,ge)),typeof oe=="string"&&oe!==""&&Number.isFinite(Number(oe))?Pe.add(Number(oe)):typeof oe=="number"&&Number.isFinite(oe)&&Pe.add(l(String(oe),ge))}return Pe}function a(fe,ge,je){if(fe==null||ge===null||ge===void 0)return fe==null&&ge==null;const Pe=typeof fe,de=typeof ge;return Pe==="string"&&de==="string"?je?fe===ge:fe.toLowerCase()===ge.toLowerCase():fe instanceof Date||ge instanceof Date?n(fe)===n(ge):Pe==="number"&&de==="number"?fe===ge||Number.isNaN(fe)&&Number.isNaN(ge):Pe==="number"&&de==="string"?fe===Number(ge):Pe==="string"&&de==="number"?Number(fe)===ge:Pe==="boolean"||de==="boolean"?fe===ge:Array.isArray(fe)&&Array.isArray(ge)?fe.length===ge.length&&fe.every((oe,he)=>a(oe,ge[he],je)):fe===ge}function p(fe,ge){try{if(fe instanceof RegExp){const je=fe.flags.replace(/[gy]/g,"");return new RegExp(fe.source,ge||je.includes("i")?je:`${je}i`)}return new RegExp(String(fe),ge?"":"i")}catch(je){return Z(`regex:${String(fe)}`,`filter operator "matches" received an invalid pattern: ${String(fe)}`,je),null}}function w(fe,ge){if(fe&&fe.type==="datetime"&&v.has(fe.op))return R(fe,ge);const je=S(fe,ge),Pe=fe&&fe.type;return Pe!=="date"&&Pe!=="dateString"?je:de=>je(typeof de=="string"&&t.test(de)?de:Y(de)??de)}const v=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn"]),P=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3})\d*)?)?)?$/,V=new Map;function W(fe,ge){let je=V.get(ge);if(je===void 0){try{je=new Intl.DateTimeFormat("en-CA",{timeZone:ge,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{je=null}V.set(ge,je)}if(!je)return null;const Pe={};for(const de of je.formatToParts(fe))de.type!=="literal"&&(Pe[de.type]=de.value);return Pe}function K(fe,ge){if(fe==null||fe==="")return null;if(typeof fe=="string"){const oe=P.exec(fe.trim());if(oe)return Date.UTC(+oe[1],+oe[2]-1,+oe[3],+(oe[4]||0),+(oe[5]||0),+(oe[6]||0),+(oe[7]||"0").padEnd(3,"0"))}const je=x(fe);if(!je)return null;const Pe=je.getUTCMilliseconds(),de=ge?W(je,ge):null;return de?Date.UTC(+de.year,+de.month-1,+de.day,de.hour==="24"?0:+de.hour,+de.minute,+de.second,Pe):Date.UTC(je.getFullYear(),je.getMonth(),je.getDate(),je.getHours(),je.getMinutes(),je.getSeconds(),Pe)}function R(fe,ge){const je=typeof fe.timeZone=="string"&&fe.timeZone?fe.timeZone:void 0,Pe=he=>K(he,je),de=Array.isArray(fe.value)?fe.value.map(Pe):Pe(fe.value),oe=S({...fe,type:"number",value:de},ge);return he=>oe(K(he))}function S(fe,ge){const je=fe&&fe.op,Pe=!!(fe&&fe.caseSensitive),de=fe&&fe.type,oe=m(ge),he=ce=>me=>!ce(me);switch(je){case"eq":{const ce=r(fe.value,de);return me=>a(me,ce,Pe)}case"ne":{const ce=r(fe.value,de);return me=>!a(me,ce,Pe)}case"lt":case"lte":case"gt":case"gte":{const ce=r(fe.value,de);if(g(ce))return()=>!1;const me=je==="lt"?-1:je==="lte"?0:je==="gt"?1:2;return ye=>{if(g(ye))return!1;const xe=oe(ye,ce);return me===-1?xe<0:me===0?xe<=0:me===1?xe>0:xe>=0}}case"between":case"notBetween":{const ce=F(fe.value),me=r(ce[0],de),ye=r(ce[1],de),xe=fe.bounds||"[]",Se=xe.charAt(0)!=="(",Te=xe.charAt(1)!==")";if(g(me)||g(ye))return je==="between"?()=>!1:()=>!0;const Be=Ee=>{if(g(Ee))return!1;const Ge=oe(Ee,me),Ne=oe(Ee,ye);return(Se?Ge>=0:Ge>0)&&(Te?Ne<=0:Ne<0)};return je==="between"?Be:he(Be)}case"in":case"notIn":{const ce=b(fe.value,Pe,de),me=ye=>ce.has(l(ye,Pe));return je==="in"?me:he(me)}case"contains":case"notContains":{const ce=h(r(fe.value,de),Pe),me=ye=>ye==null?!1:h(ye,Pe).includes(ce);return je==="contains"?me:he(me)}case"startsWith":{const ce=h(r(fe.value,de),Pe);return me=>me==null?!1:h(me,Pe).startsWith(ce)}case"endsWith":{const ce=h(r(fe.value,de),Pe);return me=>me==null?!1:h(me,Pe).endsWith(ce)}case"matches":{const ce=p(fe.value,Pe);return ce?me=>me==null?!1:ce.test(String(me)):()=>!1}case"blank":case"notBlank":{const ce=fe.trim===!0,me=ye=>N(ye)||Array.isArray(ye)&&ye.length===0||ce&&typeof ye=="string"&&ye.trim()==="";return je==="blank"?me:ye=>!me(ye)}case"containsAny":case"containsNone":{const ce=b(fe.value,Pe,de),me=ye=>{const xe=ye==null?[]:F(ye);for(let Se=0;Se<xe.length;Se++)if(ce.has(l(xe[Se],Pe)))return!0;return!1};return je==="containsAny"?me:he(me)}case"containsAll":{const ce=F(fe.value).map(me=>l(r(me,de),Pe));return me=>{const ye=me==null?[]:F(me);if(ce.length===0)return!0;const xe=new Set(ye.map(Se=>l(Se,Pe)));for(let Se=0;Se<ce.length;Se++)if(!xe.has(ce[Se]))return!1;return!0}}default:{const ce=we(je);return ce?ce.compile(fe.value):(Z(`op:${String(je)}`,`unknown filter operator "${String(je)}"; the condition is refused rather than matching every row`),()=>!1)}}}function E(fe,ge,je){return w(ge,je)(fe)}const O=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),M=new Set(["containsAny","containsAll","containsNone"]);function T(fe,ge,je){const Pe=fe&&fe.op,de=O[Pe]||Pe,oe=w({...fe,op:de,type:ge.type},je),he=ge.items,ce=me=>{const ye=he(me);if(!ye)return!1;for(let xe=0;xe<ye.length;xe++)if(oe(ye[xe]))return!0;return!1};return O[Pe]?me=>!ce(me):ce}function A(fe,ge,je,Pe,de){const oe=de?null:c(fe);if(oe){const me=ge?1:0;for(let ye=0;ye<Pe;ye++)je[ye]=oe(ye)===me?1:0;return je}const he=fe.kind;if(he==="float64"||he==="int32"||he==="bitset")return i(je,Pe,ge?1:0);const ce=s(fe);for(let me=0;me<Pe;me++){const ye=ce(me),xe=N(ye)||Array.isArray(ye)&&ye.length===0||de&&typeof ye=="string"&&ye.trim()==="";je[me]=xe===ge?0:1}return je}function I(fe,ge,je,Pe){const de=fe.dict,oe=k(de),he=new Uint8Array(oe);for(let xe=0;xe<oe;xe++)he[xe]=ge(y(de,xe))?1:0;const ce=fe.values,me=c(fe);if(!me){for(let xe=0;xe<Pe;xe++)je[xe]=he[ce[xe]];return je}const ye=ge(null)?1:0;for(let xe=0;xe<Pe;xe++)je[xe]=me(xe)===1?he[ce[xe]]:ye;return je}function U(fe,ge,je,Pe){const de=j(fe.values),oe=ge(!0)?1:0,he=ge(!1)?1:0,ce=c(fe);if(!ce){for(let ye=0;ye<Pe;ye++)je[ye]=de(ye)===1?oe:he;return je}const me=ge(null)?1:0;for(let ye=0;ye<Pe;ye++)je[ye]=ce(ye)===0?me:de(ye)===1?oe:he;return je}function X(fe,ge,je,Pe,de){const oe=fe.values,he=ge.type,ce=ge.op;let me=!0;switch(ce){case"eq":case"ne":{const xe=f(r(ge.value,he)),Se=typeof ge.value=="number"&&Number.isNaN(ge.value),Te=ce==="ne"?1:0;if(Se)for(let Be=0;Be<de;Be++)Pe[Be]=(Number.isNaN(oe[Be])?1:0)^Te;else for(let Be=0;Be<de;Be++)Pe[Be]=(oe[Be]===xe?1:0)^Te;break}case"lt":{const xe=f(r(ge.value,he));for(let Se=0;Se<de;Se++)Pe[Se]=oe[Se]<xe?1:0;break}case"lte":{const xe=f(r(ge.value,he));for(let Se=0;Se<de;Se++)Pe[Se]=oe[Se]<=xe?1:0;break}case"gt":{const xe=f(r(ge.value,he));for(let Se=0;Se<de;Se++)Pe[Se]=oe[Se]>xe?1:0;break}case"gte":{const xe=f(r(ge.value,he));for(let Se=0;Se<de;Se++)Pe[Se]=oe[Se]>=xe?1:0;break}case"between":case"notBetween":{const xe=F(ge.value),Se=f(r(xe[0],he)),Te=f(r(xe[1],he)),Be=ge.bounds||"[]",Ee=Be.charAt(0)!=="(",Ge=Be.charAt(1)!==")",Ne=ce==="notBetween"?1:0;if(Ee&&Ge)for(let ke=0;ke<de;ke++)Pe[ke]=(oe[ke]>=Se&oe[ke]<=Te?1:0)^Ne;else if(Ee)for(let ke=0;ke<de;ke++)Pe[ke]=(oe[ke]>=Se&oe[ke]<Te?1:0)^Ne;else if(Ge)for(let ke=0;ke<de;ke++)Pe[ke]=(oe[ke]>Se&oe[ke]<=Te?1:0)^Ne;else for(let ke=0;ke<de;ke++)Pe[ke]=(oe[ke]>Se&oe[ke]<Te?1:0)^Ne;break}case"in":case"notIn":{const xe=new Set;for(const Te of F(ge.value)){const Be=f(r(Te,he));Number.isNaN(Be)||xe.add(Be)}const Se=ce==="notIn"?1:0;for(let Te=0;Te<de;Te++)Pe[Te]=(xe.has(oe[Te])?1:0)^Se;break}default:me=!1;break}if(!me)return!1;const ye=c(fe);if(ye){const xe=je(null)?1:0;for(let Se=0;Se<de;Se++)ye(Se)===0&&(Pe[Se]=xe)}return!0}function q(fe,ge,je,Pe){const de=s(fe);for(let oe=0;oe<Pe;oe++)je[oe]=ge(de(oe))?1:0;return je}function _(fe,ge,je){const Pe=ge.count|0,de=je||u(ge,Pe);if(!fe)return i(de,Pe,1);const oe=typeof ge.handle=="function"?ge.handle(fe.col):void 0,he=typeof ge.custom=="function"?ge.custom:null;if(!oe){if(he){for(let xe=0;xe<Pe;xe++)de[xe]=he(fe,xe)?1:0;return de}return Z(`filter:col:${String(fe.col)}`,`filter references unknown column "${String(fe.col)}"; the condition is refused rather than matching every row`),i(de,Pe,0)}const ce=fe.op;if(ce==="blank"||ce==="notBlank")return A(oe,ce==="notBlank",de,Pe,fe.trim===!0);const me=typeof ge.itemwise=="function"?ge.itemwise(fe.col):null;if(me&&!we(ce)&&!M.has(ce))return q(oe,T(fe,me,ge.locale),de,Pe);const ye=w(fe,ge.locale);switch(oe.kind){case"dictionary":return I(oe,ye,de,Pe);case"bitset":return U(oe,ye,de,Pe);case"float64":case"int32":return X(oe,fe,ye,de,Pe)?de:q(oe,ye,de,Pe);default:return q(oe,ye,de,Pe)}}function H(fe,ge,je){if(!fe)return i(u(ge,je),je,1);if(Array.isArray(fe.conditions)){const Pe=fe.conditions.filter(he=>he!=null),de=fe.op==="or"?"or":fe.op==="not"?"not":"and";if(Pe.length===0)return i(u(ge,je),je,1);const oe=H(Pe[0],ge,je);for(let he=1;he<Pe.length;he++){const ce=H(Pe[he],ge,je);if(de==="or")for(let me=0;me<je;me++)oe[me]|=ce[me];else for(let me=0;me<je;me++)oe[me]&=ce[me];d(ge,ce)}if(de==="not")for(let he=0;he<je;he++)oe[he]^=1;return oe}return _(fe,ge,u(ge,je))}function ee(fe,ge){return H(fe,ge,ge.count|0)}function te(fe,ge){if(!fe||!ge)return fe||null;const je=fe;if(Array.isArray(je.conditions)){if((je.op==="or"?"or":je.op==="not"?"not":"and")!=="and")return J(je,ge)?null:fe;const de=[];for(const oe of je.conditions){const he=te(oe,ge);he&&de.push(he)}return de.length?{...je,op:"and",conditions:de}:null}return je.col===ge?null:fe}function J(fe,ge){if(!fe||typeof fe!="object")return!1;const je=fe;if(je.col===ge)return!0;if(Array.isArray(je.conditions)){for(const Pe of je.conditions)if(J(Pe,ge))return!0}return!1}function ne(fe,ge,je){if(je&&je.length>=ge){let he=0;for(let ce=0;ce<ge;ce++)fe[ce]&&(je[he++]=ce);return je.subarray(0,he)}let Pe=0;for(let he=0;he<ge;he++)Pe+=fe[he]?1:0;const de=new Uint32Array(Pe);let oe=0;for(let he=0;he<ge;he++)fe[he]&&(de[oe++]=he);return de}const se=new Map;function ae(fe){if(!(!fe||typeof fe!="object"))for(const[ge,je]of Object.entries(fe))je&&typeof je.compile=="function"&&se.set(ge,je)}function we(fe){return typeof fe=="string"?se.get(fe):void 0}}),He("packages/core/src/columns/datatypes.js",function(e,D){"use strict";Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"parseNumberText",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"BUILTIN_TYPES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return T}});const re=D("packages/core/src/internal/compare.js"),N=re.collator,G=re.defaultCompare,F=D("packages/core/src/internal/predicates.js"),L=F.isNil,Z=F.isObject,z=F.isFunction,Y=D("packages/core/src/internal/warn.js").fail,j=D("packages/core/src/internal/text.js").titleCase,k=D("packages/core/src/format/date.js"),y=k.toDate,c=k.toIsoDate,m=k.compareIso,t=D("packages/core/src/format/boolean.js").toTriState,u=D("packages/core/src/columns/types/index.js").EXTENDED_TYPES,d=D("packages/core/src/formula/index.js"),i=d.evaluateFormula,g=d.looksLikeFormula,n=D("packages/core/src/compute/filter.js").declareOperators,f=/^\d{4}-\d{2}-\d{2}$/;function h(A){return A.getHours()===0&&A.getMinutes()===0&&A.getSeconds()===0&&A.getMilliseconds()===0}const l=new Map;function b(A){const I=A||"",U=l.get(I);if(U)return U;const X={group:",",decimal:"."};try{for(const q of new Intl.NumberFormat(A||void 0).formatToParts(12345.6))q.type==="group"?X.group=q.value:q.type==="decimal"&&(X.decimal=q.value)}catch{}return l.set(I,X),X}const a=/\d\s*[*/^]\s*[\d.(]/;function p(A,I){if(L(A))return null;let U=String(A).trim();if(U===""||U.startsWith("=")||a.test(U))return null;let X=1;U.startsWith("(")&&U.endsWith(")")&&(X=-1,U=U.slice(1,-1));const q=U.endsWith("%"),{group:_,decimal:H}=b(I);if(U=U.replace(/[\s\u00a0\u202f\u2009']/g,""),_&&_!=="."&&_!==","&&(U=U.split(_).join("")),U=U.replace(/[^0-9eE+\-.,]/g,""),H===","?U=U.split(".").join("").replace(",","."):U=U.split(",").join(""),U===""||U==="-"||U==="+")return null;const ee=Number(U);return Number.isNaN(ee)?null:X*(q?ee/100:ee)}function w(A,I){const U=L(A)||Number.isNaN(A)?null:Number(A),X=L(I)||Number.isNaN(I)?null:Number(I);return U===null?X===null?0:1:X===null||U<X?-1:U>X?1:0}function v(A,I){const U=t(A),X=t(I);return U===null?X===null?0:1:X===null?-1:U===X?0:U?1:-1}function P(A,I){const U=y(A),X=y(I);if(!U)return X?1:0;if(!X)return-1;const q=U.getTime(),_=X.getTime();return q<_?-1:q>_?1:0}const V=new Map;function W(A){const I=y(A.value);if(!I)return"";const U=A.locale||"";let X=V.get(U);return X||(X=new Intl.DateTimeFormat(A.locale||void 0,{dateStyle:"medium"}),V.set(U,X)),X.format(I)}const K={boolean:{base:"boolean",storage:"bitset",matches:A=>typeof A=="boolean",parse:A=>t(A.text),compare:v,format:A=>t(A.value)===null?"":t(A.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:A=>t(A)===null?"":String(t(A)),fromClipboard:A=>t(A)},number:{base:"number",storage:"float64",matches:A=>typeof A=="number"&&!Number.isNaN(A),parse:A=>{if(g(A.text)){const I=i(A.text,A);if(!I.ok)return null;const U=Number(I.value);return Number.isFinite(U)?U:null}return p(A.text,A.locale)},compare:w,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:A=>L(A)?"":String(A),fromClipboard:(A,I)=>p(A,I&&I.locale)},date:{base:"dateString",storage:"dictionary",matches:A=>typeof A=="string"&&f.test(A)&&!Number.isNaN(Date.parse(A))||A instanceof Date&&!Number.isNaN(A.getTime())&&h(A),parse:A=>c(A.text),compare:m,format:W,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:A=>c(A),toClipboard:A=>L(A)?"":String(A),fromClipboard:A=>c(A)},dateString:{base:"dateString",storage:"dictionary",matches:A=>typeof A=="string"&&f.test(A)&&!Number.isNaN(Date.parse(A)),parse:A=>c(A.text),compare:m,format:W,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:A=>c(A),toClipboard:A=>L(A)?"":String(A),fromClipboard:A=>c(A)},text:{base:"text",storage:"dictionary",matches:A=>typeof A=="string",parse:A=>A.text===""?null:String(A.text),compare:(A,I)=>L(A)?L(I)?0:1:L(I)?-1:N().compare(String(A),String(I)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:A=>L(A)?"":String(A),fromClipboard:A=>A},image:{base:"text",storage:"dictionary",parse:A=>A.text===""||A.text==null?null:String(A.text).trim(),compare:(A,I)=>L(A)?L(I)?0:1:L(I)?-1:N().compare(String(A),String(I)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:A=>L(A)?"":String(A),fromClipboard:A=>A},lookup:{base:"text",storage:"dictionary",parse:A=>{if(A.text===""||A.text==null)return null;const I=A.column&&A.column.lookup,U=I&&z(I.options)?I.options():null;if(!U)return A.text;const X=String(A.text),q=U.find(ee=>String(ee.id)===X);if(q)return q.id;const _=X.trim().toLowerCase(),H=U.find(ee=>String(ee.label).toLowerCase()===_);return H?H.id:A.text},compare:G,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:A=>L(A)?"":String(A),fromClipboard:A=>A},object:{base:"object",storage:"object",matches:A=>A!==null&&typeof A=="object"&&!(A instanceof Date),parse:A=>{try{return A.text===""?null:JSON.parse(A.text)}catch{return A.text}},compare:(A,I)=>G(A,I),format:A=>{const I=A.value;if(L(I))return"";if(typeof I=="string")return I;try{return JSON.stringify(I)}catch{return String(I)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:A=>L(A)?"":typeof A=="string"?A:JSON.stringify(A),fromClipboard:A=>A}},R=["boolean","number","date","dateString","datetime","text","object"];function S(A,I,U,X){const q=U.get(A);if(q)return q;X.includes(A)&&Y(`circular data type extends chain: ${[...X,A].join(" → ")}`);const _=I[A];_||Y(`unknown data type "${A}"`);let H=null;_.extends&&(H=S(_.extends,I,U,[...X,A]));const ee={...H||{},..._,name:A,defaults:{...H&&H.defaults||{},..._.defaults||{}}};return ee.base||(ee.base=H&&H.base||"text"),ee.storage||(ee.storage=H&&H.storage||"object"),U.set(A,ee),ee}function E(A,I){const U={...K,...u};if(I&&typeof I.dataType=="function"&&typeof I.names=="function")for(const q of I.names("dataType")){const _=I.dataType(q);_&&(U[q]=_)}if(Z(A))for(const[q,_]of Object.entries(A))U[q]=_;const X=new Map;for(const q of R)S(q,U,X,[]);S("lookup",U,X,[]);for(const q of Object.keys(U))S(q,U,X,[]);for(const q of X.values())n(q.operators);return X}function O(A,I){if(A.base==="text"&&(!A.compare||A.compare===K.text.compare)){const U=N(I);return(X,q)=>L(X)?L(q)?0:1:L(q)?-1:U.compare(String(X),String(q))}return A.compare||G}function M(A,I){return I?A.multiStorage||"multi":A.storage||"object"}function T(A){return j(String(A).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),He("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 Z}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return z}});const N=D("packages/core/src/internal/warn.js").infoOnce,F=D("packages/core/src/internal/predicates.js").isNil,L=100;function Z(x,Y,$={}){const j=$.sampleSize??L,k=[];for(let y=0;y<x.length&&k.length<j;y++){const c=x[y];F(c)||typeof c=="number"&&Number.isNaN(c)||k.push(c)}if(k.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[y,c]of Y){if(typeof c.matches!="function")continue;let m=!0;for(let s=0;s<k.length;s++)if(!c.matches(k[s])){m=!1;break}if(m)return{type:y,unanimous:!0,sampled:k.length}}return $.quiet||N(`infer:${$.colId||"?"}`,`column "${$.colId||"?"}" has mixed or ambiguous values and was inferred as "text". Declare \`type\` on the column to get correct sorting, filtering and export.`),{type:"text",unanimous:!1,sampled:k.length}}function z(x,Y,$,j,k={}){const y=k.sampleSize??L,c=[];for(let m=0;m<Y.length&&c.length<y;m++){const s=$(Y[m]);F(s)||typeof s=="number"&&Number.isNaN(s)||c.push(s)}return Z(c,j,{...k,colId:x}).type}}),He("packages/core/src/columns/graph.js",function(e,D){"use strict";Object.defineProperty(e,"WHOLE_ROW",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"declarationOf",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return j}});const re=D("packages/core/src/internal/warn.js"),N=re.DEV,G=re.fail,F=re.warnOnce,Z=D("packages/core/src/internal/predicates.js").isFunction,z="*";function x(k){const y=k.value||{};if(!Z(y.compute))return{computed:!1,wholeRow:!1,deps:[],pure:!0};const m=y.pure!==!1;return y.deps===z?{computed:!0,wholeRow:!0,deps:[],pure:m}:Array.isArray(y.deps)?{computed:!0,wholeRow:!1,deps:y.deps.slice(),pure:m}:(F(`deps:missing:${k.id}`,`computed column "${k.id}" declares no \`value.deps\`; treating it as \`deps: '*'\` (a whole-row dependency). Declare the dependencies to get precise invalidation.`),{computed:!0,wholeRow:!0,deps:[],pure:m})}function Y(k){const y=new Map;for(const f of k)y.set(f.id,f);const c=new Map,m=new Map,s=new Set,t=new Set,o=new Set,u=new Set;for(const f of k){const h=x(f);if(!h.computed){c.set(f.id,[]);continue}t.add(f.id),(h.pure?o:u).add(f.id),h.wholeRow&&s.add(f.id);const l=[],b=[];for(const a of h.deps)(y.has(a)?l:b).push(a);c.set(f.id,l),b.length&&m.set(f.id,b)}for(const f of o)for(const h of c.get(f))u.has(h)&&G(`pure computed column "${f}" depends on impure column "${h}". Mark it \`value.pure: false\` or make the dependency pure.`);const d=[],i=new Map,g=[],r=f=>{const h=i.get(f);if(h!=="done"){if(h==="open"){const l=g.indexOf(f);G(`circular column dependency: ${[...g.slice(l),f].join(" → ")}`)}i.set(f,"open"),g.push(f);for(const l of c.get(f)||[])y.has(l)&&r(l);g.pop(),i.set(f,"done"),d.push(f)}};for(const f of k)r(f.id);const n=new Map;for(const f of k)n.set(f.id,[]);for(const f of k)for(const h of c.get(f.id)||[]){const l=n.get(h);l&&!l.includes(f.id)&&l.push(f.id)}if(s.size)for(const f of k){if(t.has(f.id))continue;const h=n.get(f.id);for(const l of s)h.includes(l)||h.push(l)}return{order:d,dependents:n,pure:o,impure:u,computed:t,deps:c,wholeRow:s,external:m,index:y}}function $(k,y){const c=Array.isArray(y)?y:[y],m=new Set,s=[...c];for(;s.length;){const t=s.shift();for(const o of k.dependents.get(t)||[])m.has(o)||(m.add(o),s.push(o))}for(const t of c)m.delete(t);return k.order.filter(t=>m.has(t))}function j(k,y,c){if(!N)return k;const m=y instanceof Set?y:new Set(y);return new Proxy(k,{get(s,t){return typeof t=="string"&&!m.has(t)&&!Object.hasOwn(s,t)&&F(`undeclared:${c}:${t}`,`computed column "${c}" read undeclared dependency "${t}". Add it to \`value.deps\` or the value will go stale.`),s[t]}})}}),He("packages/core/src/model/rowkey.js",function(e,D){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"compositeKey",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createRowKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"warnMissingKeys",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"groupPathKey",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"splitPathKey",{enumerable:!0,get:function(){return t}});const N=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/internal/paths.js").pathGetter,L=D("packages/core/src/internal/predicates.js"),Z=L.isFunction,z=L.isBlank,x=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],Y="";function $(o){if(o===null)return"\0n";if(o===void 0)return"\0u";const u=typeof o;if(u==="string")return o;if(u==="number"||u==="bigint"||u==="boolean")return String(o);if(o instanceof Date)return`\0d${o.getTime()}`;try{return`\0o${JSON.stringify(o)}`}catch{return"\0o?"}}function j(o){if(o.length===1)return $(o[0]);let u="";for(let d=0;d<o.length;d++)d&&(u+=Y),u+=$(o[d]);return u}function k(o,u={}){const d=u.warn!==!1;if(Z(o)){const i=o;return{stable:!0,fields:[],disabled:[],key(g,r){try{const n=i(g);return Array.isArray(n)?j(n):$(n)}catch(n){return N("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",n),`#${r??-1}`}},keyEmpty(g){try{const r=i(g);return Array.isArray(r)?r.length===0||r.some(z):z(r)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(o)&&o.length>0){const i=o.filter(n=>typeof n=="string"),g=i.map(n=>F(n)),r=g.length;return{stable:!0,fields:i,disabled:[],key(n){const f=new Array(r);for(let h=0;h<r;h++)f[h]=g[h](n);return j(f)},keyEmpty(n){for(let f=0;f<r;f++)if(z(g[f](n)))return!0;return!1},missingFields(n){const f=[];for(let h=0;h<r;h++)z(g[h](n))&&f.push(i[h]);return f}}}if(typeof o=="string"&&o.length>0){const i=F(o);return{stable:!0,fields:[o],disabled:[],key(g){return $(i(g))},keyEmpty(g){return z(i(g))},missingFields(g){return z(i(g))?[o]:[]}}}return d&&N("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${x.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:x.slice(),key(i,g){if(i===null||typeof i!="object")return`#${g??0}:${String(i)}`;let r=y.get(i);return r===void 0&&(r=`#${c++}`,y.set(i,r)),r}}}const y=new WeakMap;let c=0;function m(o,u){if(!o||o.stable===!1||!Z(o.keyEmpty)||!Array.isArray(u)||u.length===0)return;let d=0,i=null,g;for(let h=0;h<u.length;h++){const l=u[h];o.keyEmpty(l)&&(d++,i===null&&(i=Z(o.missingFields)?o.missingFields(l):[],g=l))}if(d===0)return;const r=o.fields.length?o.fields.join(","):"(function)",n=i&&i.length?i.join(", "):o.fields.length?o.fields.join(", "):"the rowKey function",f=g!==null&&typeof g=="object"?Object.keys(g).join(", ")||"(no fields)":String(g);N(`rowKey.emptyValue:${r}`,`rowKey ${n} is missing on ${d} of ${u.length} rows; the first such row has: ${f}. Rows without a key value collapse onto one key, so selection, edits and rows.apply updates land on whichever row now shares it. Set rowKey to a field present on every row, or fix the source data.`)}function s(o){return j(o)}function t(o){return o.split(Y)}}),He("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 y}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"Lookup",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"toValueArray",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createLookup",{enumerable:!0,get:function(){return o}});const re=D("packages/core/src/internal/compare.js"),N=re.collator,G=re.defaultCompare,F=D("packages/core/src/internal/predicates.js"),L=F.isFunction,Z=F.isNil,x=D("packages/core/src/internal/warn.js").warnOnce,$=D("packages/core/src/model/rowkey.js").compositeKey,j=", ",k="";function y(u,d,i,g){if(u===null||typeof u!="object")return{id:u,label:u==null?"":String(u)};const r=u[d],n=u[i],f={id:r,label:n==null?String(r??""):String(n)};u.disabled&&(f.disabled=!0),u.variant&&(f.variant=u.variant),u.icon&&(f.icon=u.icon);const h=g?u[g]:u.group;return h!==void 0&&(f.group=h),f}function c(u,d,i=0,g=[],r=[]){for(const n of u||[]){const f=n&&typeof n=="object"?n[d]:null;if(r.push({raw:n,depth:i,path:g}),Array.isArray(f)&&f.length){const h=String(n&&typeof n=="object"?n.label??n.name??n.id??"":n);c(f,d,i+1,[...g,h],r)}}return r}function m(u){return!!u&&typeof u=="object"&&!Array.isArray(u)&&L(u.router&&u.router.subscribe)}class s{#e;#t;#n;#r;#i=[];#s=new Map;#o=new Map;#l=0;#a="idle";#c=null;#u;#f=null;#d=new Map;constructor(d,i={}){this.#e=d||{},this.#t=i.colId||"?",this.#n=i.locale,this.#r=i.onChange||null,this.#u=N(this.#n),Array.isArray(this.#e.options)?this.#h(this.#e.options):this.#e.options===void 0&&(this.#a="ready")}get colId(){return this.#t}get version(){return this.#l}get state(){return this.#a}get ready(){return this.#a==="ready"}get multiple(){return this.#e.multiple===!0}get separator(){return this.#e.separator??j}get allowCustom(){return this.#e.allowCustom===!0}get sortBy(){return this.#e.sortBy||"label"}get spec(){return this.#e}options(){return this.#i}setLocale(d){this.#n=d,this.#u=N(d)}#h(d){const i=this.#e,g=i.valueKey||"id",r=i.labelKey||"label",n=i.childrenKey||"children";this.#i=c(d,n).map(f=>{const h=y(f.raw,g,r,i.groupKey);return f.depth&&(h.depth=f.depth,h.path=f.path),h}),this.#s=new Map,this.#o=new Map,this.#i.forEach((f,h)=>{this.#s.set(f.id,f),this.#o.set(f.id,h)}),this.#a="ready",this.#l+=1}load(){if(this.#c)return this.#c;const d=this.#e.options;if(Array.isArray(d)||d===void 0)return this.#c=Promise.resolve(this.#i),this.#c;if(m(d))return this.#c=this.#p(d),this.#c;if(!L(d))return x(`lookup:options:${this.#t}`,`column "${this.#t}" has an invalid \`lookup.options\`; expected an array, a function, or a router route`),this.#a="ready",this.#c=Promise.resolve([]),this.#c;this.#a="loading";let i;try{i=d()}catch(g){return this.#a="error",x(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,g),this.#c=Promise.resolve([]),this.#c}return!i||!L(i.then)?(this.#h(i),this.#c=Promise.resolve(this.#i),this.#r&&this.#r(this),this.#c):(this.#c=i.then(g=>(this.#h(g),this.#r&&this.#r(this),this.#i),g=>(this.#a="error",x(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,g),[])),this.#c)}refresh(){return this.#c=null,Array.isArray(this.#e.options)?(this.#h(this.#e.options),this.#r&&this.#r(this),Promise.resolve(this.#i)):this.load()}#p(d){if(this.#f)return Promise.resolve(this.#i);const i=this.#e,g=i.valueKey||"id",r=i.labelKey||"label",n=i.groupKey,f=L(d.map)?d.map:null,h=b=>y(f?f(b):b,g,r,n).id,l=b=>this.#m(b,f,g,r,n);return d.router.subscribe(d.predicate,l,{rowKey:h}),this.#f=()=>{L(d.router.detach)&&d.router.detach(l)},this.#a="ready",Promise.resolve(this.#i)}#m(d,i,g,r,n){const f=d&&d.add||[],h=d&&d.update||[],l=d&&d.remove||[];if(!(!f.length&&!h.length&&!l.length)){for(const b of f)this.#g(b,i,g,r,n);for(const b of h)this.#g(b,i,g,r,n);for(const b of l){if(!this.#d.has(b))continue;const a=this.#d.get(b);this.#d.delete(b),this.#s.delete(a);const p=this.#i.findIndex(w=>w.id===a);p>=0&&this.#i.splice(p,1)}this.#o=new Map(this.#i.map((b,a)=>[b.id,a])),this.#a="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(d,i,g,r,n){const f=y(i?i(d):d,g,r,n);this.#d.set($([f.id]),f.id);const h=this.#i.findIndex(l=>l.id===f.id);h>=0?this.#i[h]=f:this.#i.push(f),this.#s.set(f.id,f)}destroy(){this.#f&&(this.#f(),this.#f=null)}search(d,i){const g=this.#e;if(!L(g.search)){const f=String(d||"").toLowerCase();return Promise.resolve(f===""?this.#i:this.#i.filter(h=>h.label.toLowerCase().includes(f)))}const r=g.valueKey||"id",n=g.labelKey||"label";return Promise.resolve(g.search(d,i)).then(f=>(f||[]).map(h=>y(h,r,n,g.groupKey)))}option(d){return this.#s.get(d)}has(d){return this.#s.has(d)}label(d){if(Z(d)||d==="")return"";const i=this.#s.get(d);if(i)return i.label;if(this.#a==="loading"||this.#a==="idle")return"";this.allowCustom||x(`lookup:unknown:${this.#t}`,`column "${this.#t}" holds value ${JSON.stringify(d)} which is not in its lookup options. Showing the raw value; set \`lookup.unknownLabel\` or \`lookup.allowCustom\` to change that.`);const g=this.#e.unknownLabel;return L(g)?String(g(d)??""):typeof g=="string"?g:String(d)}text(d){if(this.multiple){const i=t(d);return i.length===0?"":i.map(g=>this.label(g)).join(this.separator)}return this.label(d)}dictionary(){return this.#i.map(d=>d.id)}sorted(){const d=this.sortBy;if(d==="optionOrder"||d==="count")return this.#i.slice();if(d==="value")return this.#i.slice().sort((g,r)=>G(g.id,r.id));const i=this.#u;return this.#i.slice().sort((g,r)=>i.compare(g.label,r.label))}comparator(){const d=this.sortBy,i=this.multiple,g=this.#u,r=this.#o;if(i&&d==="count")return(f,h)=>t(f).length-t(h).length;const n=i?f=>t(f)[0]:f=>f;return d==="value"?(f,h)=>G(n(f),n(h)):d==="optionOrder"?(f,h)=>{const l=r.has(n(f))?r.get(n(f)):Number.MAX_SAFE_INTEGER,b=r.has(n(h))?r.get(n(h)):Number.MAX_SAFE_INTEGER;return l-b}:(f,h)=>{const l=n(f),b=n(h);return Z(l)?Z(b)?0:1:Z(b)?-1:g.compare(this.label(l),this.label(b))}}groupKey(d){return this.multiple?t(d).map(g=>String(g)).sort().join(k):Z(d)?"":String(d)}countValues(d){return this.multiple?t(d).length:Z(d)?0:1}contains(d,i,g){const r=this.multiple?t(d):Z(d)?[]:[d],n=Array.isArray(i)?i:[i];switch(g){case"containsAll":return n.every(f=>r.includes(f));case"containsNone":return!n.some(f=>r.includes(f));default:return n.some(f=>r.includes(f))}}exportText(d,i="label"){return i==="value"?this.multiple?t(d).join(this.separator):Z(d)?"":String(d):this.text(d)}exportColumns(){const d=this.multiple;return this.#i.map(i=>({id:i.id,label:i.label,has:g=>d?t(g).includes(i.id):g===i.id}))}}function t(u){return Array.isArray(u)?u:Z(u)||u===""?[]:[u]}function o(u,d={}){const i=u.lookup;if(!i)return null;const g=new s(i,{colId:u.id,locale:d.locale,onChange:d.onChange});return!Array.isArray(i.options)&&i.options!==void 0&&g.load(),g}}),He("packages/core/src/columns/value.js",function(e,D){"use strict";Object.defineProperty(e,"compileDisplay",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"warnImpureUse",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ValuePipeline",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return u}});const N=D("packages/core/src/internal/paths.js").getPath,G=D("packages/core/src/internal/predicates.js"),F=G.isFunction,L=G.isNil,Z=G.isObject,x=D("packages/core/src/internal/lru.js").Lru,$=D("packages/core/src/internal/warn.js").warnOnce,k=D("packages/core/src/format/number.js").compileNumber,c=D("packages/core/src/columns/graph.js").depsProxy,m="\0";function s(r,n={}){const f=n.locale,h=n.grid??null,l=n.context,b=r.value&&r.value.format,a=r.formatter||null,p=r.dataType&&r.dataType.format,w=r.lookup||null,v=(P,V,W)=>({value:P,data:W,row:V,column:r,colId:r.id,grid:h,context:l,locale:f});if(F(b))return(P,V,W)=>{const K=b(v(P,V,W));return K==null?"":String(K)};if(a){if(w){const P=a.kind==="text";return(V,W,K)=>a(P?w.text(V):V,v(V,W,K))}return(P,V,W)=>a(P,v(P,V,W))}if(F(p))return(P,V,W)=>{const K=p(v(P,V,W));return K==null?"":String(K)};if(r.dataType&&r.dataType.base==="number"&&Z(r.typeOptions)&&typeof r.typeOptions.decimals=="number"){const P=k({decimals:r.typeOptions.decimals},f);return V=>P(V)}return w?P=>w.text(P):P=>L(P)?"":typeof P=="string"?P:String(P)}function t(r,n){!r||!r.value||r.value.pure!==!1||$(`impure:${n}:${r.id}`,`column "${r.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${n}. The result is not stable across passes.`)}class o{#e;#t;#n;#r;#i;#s;#o=new x(4096);constructor(n){this.#e=n.columns instanceof Map?n.columns:new Map((n.columns||[]).map(f=>[f.id,f])),this.#t=n.graph,this.#n=n.grid??null,this.#r=n.context,this.#s=n.stored||null,this.#i=n.rowKey||u}get graph(){return this.#t}setGraph(n){this.#t=n,this.#o.clear()}beginPass(){this.#o.clear()}endPass(){this.#o.clear()}invalidate(n){if(this.#o.size===0)return;const f=n&&n.rows?new Set([...n.rows].map(String)):null,h=n&&n.columns?[...n.columns]:null;if(!f&&!h){this.#o.clear();return}const l=h?this.#l(h):null;for(const b of[...this.#o.keys()]){const a=String(b).split(m);a.length===3&&(f&&!f.has(a[0])||l&&!l.has(a[2])||this.#o.delete(b))}}#l(n){const f=new Set,h=this.#t,l=[...n];for(;l.length;){const b=l.pop();if(!f.has(b)){f.add(b);for(const a of h?h.dependents.get(b)||[]:[])l.push(a)}}return f}value(n,f,h){const l=typeof n=="string"?this.#e.get(n):n;if(!l)return;if(!l.computed)return this.#c(l,f,h);if(l.value.pure!==!1&&this.#s&&h&&h.physical!=null&&this.#s.has(l.id))return this.#s.get(l.id,h.physical);if(l.volatile)return this.compute(l,f,h);if(l.value.pure===!1)return this.compute(l,f,h);const b=`${this.#a(f,h)}${m}${l.id}`;if(this.#o.has(b))return this.#o.get(b);const a=this.compute(l,f,h);return this.#o.set(b,a),a}#a(n,f){return`${this.#i(n,f)}${m}${d(n)}`}#c(n,f,h){if(this.#s&&h&&h.physical!=null&&this.#s.has(n.id))return this.#s.get(n.id,h.physical);if(n.field)return n.read?n.read(f):N(f,n.field)}compute(n,f,h){const l=this.#t,b=l&&l.wholeRow.has(n.id);let a;if(b)a=f??{};else{a={};const w=l&&l.deps.get(n.id)||[];for(const P of w)a[P]=this.value(P,f,h);const v=l&&l.external.get(n.id)||[];for(const P of v)a[P]=N(f,P);a=c(a,[...w,...v],n.id)}const p={data:f,row:h,column:n,grid:this.#n,context:this.#r};return n.value.compute(a,p)}values(n,f){const h={},l=this.#t?this.#t.order:[...this.#e.keys()];for(const b of l)h[b]=this.value(b,n,f);return h}text(n,f,h){const l=typeof n=="string"?this.#e.get(n):n;return l?l.formatValue(this.value(l,f,h),h,f):""}key(n,f,h){const l=typeof n=="string"?this.#e.get(n):n;if(!l)return"";const b=this.value(l,f,h);return F(l.value.key)?String(l.value.key(this.#u(l,b,f,h))):l.lookup?l.lookup.groupKey(b):L(b)?"":String(b)}quickFilterText(n,f,h){const l=typeof n=="string"?this.#e.get(n):n;if(!l)return"";if(F(l.value.quickFilterText)){const b=this.value(l,f,h);return String(l.value.quickFilterText(this.#u(l,b,f,h))??"")}return this.text(l,f,h)}#u(n,f,h,l){return{value:f,data:h,row:l,column:n,colId:n.id,grid:this.#n,context:this.#r}}parse(n,f,h,l){const b=typeof n=="string"?this.#e.get(n):n;if(!b)return f;const a={text:f,value:this.value(b,h,l),data:h,row:l,column:b,grid:this.#n,context:this.#r,locale:this.#n&&F(this.#n.get)?this.#n.get("locale"):void 0,formulaFunctions:this.#n&&F(this.#n.get)?this.#n.get("formulaFunctions"):void 0};return F(b.value.parse)?b.value.parse(a):b.dataType&&F(b.dataType.parse)?b.dataType.parse(a):f}validate(n,f,h,l,b){const a=typeof n=="string"?this.#e.get(n):n;if(!a||!F(a.edit.validate))return!0;const p=a.edit.validate({value:f,oldValue:h,data:l,row:b,column:a,grid:this.#n,context:this.#r});return p===!0||p===void 0?!0:String(p)}apply(n,f,h,l){const b=typeof n=="string"?this.#e.get(n):n;if(!b)return!1;const a=this.value(b,h,l);if(F(b.value.apply)){const p=b.value.apply({value:f,oldValue:a,data:h,row:l,column:b,grid:this.#n,context:this.#r});return this.#f(b,h,l),p!==!1}return b.field?a===f?!1:(b.write(h,f),this.#f(b,h,l),!0):($(`apply:${b.id}`,`column "${b.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(n,f,h,l){const b=typeof n=="string"?this.#e.get(n):n;if(!b)return{ok:!1,value:void 0,oldValue:void 0,changed:!1,error:"unknown column"};const a=this.value(b,h,l),p=this.parse(b,f,h,l),w=this.validate(b,p,a,h,l);if(w!==!0)return{ok:!1,value:p,oldValue:a,changed:!1,error:w};const v=this.apply(b,p,h,l);return{ok:!0,value:p,oldValue:a,changed:v}}#f(n,f,h){if(this.#o.size===0)return;const l=this.#a(f,h);this.#o.delete(`${l}${m}${n.id}`);for(const b of this.#t?this.#t.dependents.get(n.id)||[]:[])this.#o.delete(`${l}${m}${b}`)}}function u(r,n){return n&&n.key!=null?String(n.key):d(r)}function d(r){if(r&&typeof r=="object"){let n=i.get(r);return n===void 0&&(n=`#${g++}`,i.set(r,n)),n}return String(r)}const i=new WeakMap;let g=0}),He("packages/core/src/model/shadow.js",function(e,D){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return F}}),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 Z}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"CLUSTER_SHADOW_KINDS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"DEFAULT_ANOMALY_THRESHOLD",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"SPEC_STATUS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"POSITIONAL_KINDS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"SHADOW_LABELS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"specStatusOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ShadowTracker",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"shadowsIn",{enumerable:!0,get:function(){return n}});const N=D("packages/core/src/internal/warn.js").warnOnce,G=2e5,F=20,L=1e3,Z=50;function z(f){return Math.min(L,Math.max(Z,Math.floor(f)))}const x=Object.freeze(["updates","updatedAt","sinceUpdate","delta","deltaPercent","rate","history","firstValue","streak","rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag","specStatus","rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta","fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD","cluster","clusterDistance"]),Y=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),$=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),j=Object.freeze(["cluster","clusterDistance"]),k=.6745,y=3.5,c=Object.freeze({PASS:"PASS",WARN:"WARN",FAIL:"FAIL"}),m=Object.freeze(["rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag"]),s=Object.freeze({updates:"Updates",updatedAt:"Updated at",sinceUpdate:"Since update",delta:"Change",deltaPercent:"Change %",rate:"Rate of change",history:"History",firstValue:"Baseline",streak:"Streak",rank:"Rank",rankAsc:"Rank, ascending",rankChange:"Rank change",percentile:"Percentile",quartile:"Quartile",zScore:"Z-score",shareOfTotal:"Share of total",anomalyScore:"Anomaly score",anomalyFlag:"Anomaly",specStatus:"Spec status",rollingSum:"Rolling sum",rollingAvg:"Rolling average",rollingMin:"Rolling minimum",rollingMax:"Rolling maximum",windowCoverage:"Window coverage",cumulativeToDate:"Cumulative to date",periodOverPeriod:"Period over period",rollingQuantile:"Rolling quantile",windowApproximate:"Window approximate",tsTrend:"Trend",tsSeasonal:"Seasonal",tsResidual:"Seasonal residual",tsCoverage:"Decomposition coverage",tsSmoothed:"Smoothed",tsSmoothingAlpha:"Smoothing α",tsSmoothingBeta:"Smoothing β",fitPredicted:"Predicted",fitResidual:"Residual",fitInfluence:"Influence",fitStdResidual:"Std. residual",fitLeverage:"Leverage",fitCooksD:"Cook's D",cluster:"Cluster",clusterDistance:"Cluster distance"});function t(f,h){if(!h)return null;const l=Number.isFinite(Number(h.lower))?Number(h.lower):null,b=Number.isFinite(Number(h.upper))?Number(h.upper):null;if(l===null&&b===null||!Number.isFinite(f))return null;if(l!==null&&f<l||b!==null&&f>b)return c.FAIL;const a=Number.isFinite(Number(h.warnLower))?Number(h.warnLower):null,p=Number.isFinite(Number(h.warnUpper))?Number(h.warnUpper):null;return a!==null&&f<a||p!==null&&f>p?c.WARN:c.PASS}function o(f,h,l){if(!h||typeof h!="object")return null;if(h.kind!=="time")return h.kind!==void 0&&N(`shadow.history.window.kind:${f}`,`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 b=h.minutes!=null?Number(h.minutes)*6e4:Number(h.span);if(!(b>0))return N(`shadow.history.window.span:${f}`,"a 'history' shadow's time window needs a positive 'span' (ms) or 'minutes'; it had none, so it reported the original, unwindowed history."),null;const a=Math.max(2,Math.floor(l)||F);return{span:b,bucketMs:Math.max(1,Math.floor(b/a))}}class u{#e;#t=new Map;#n=new Map;#r=new Map;#i=new Map;#s=new Map;#o=new Map;#l=0;#a;#c;#u;#f;#d=new Map;#h=null;#p=null;#m=null;constructor(h){this.#e=h.colId,this.#a=Math.max(2,h.depth||F),this.#c=Math.max(1,h.max||G),this.#u=h.now||(()=>Date.now()),this.#f=o(this.#e,h.historyWindow,this.#a),this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#f}observe(h,l){const b=r(l);if(b===null)return;if(!this.#n.has(h)){this.#p=null,this.#m=null,this.#g(),this.#t.set(h,b),this.#n.set(h,b),this.#r.set(h,0),this.#i.set(h,this.#u()),this.#s.set(h,[b]),this.#f&&this.#d.set(h,[b]),this.#o.set(h,0);return}const a=this.#n.get(h);if(a===b)return;this.#p=null,this.#m=null,this.#n.set(h,b),this.#r.set(h,(this.#r.get(h)||0)+1),this.#i.set(h,this.#u());const p=this.#s.get(h)||[];p.push(b),p.length>this.#a&&p.splice(0,p.length-this.#a),this.#s.set(h,p);const w=Math.sign(b-a),v=this.#o.get(h)||0;this.#o.set(h,Math.sign(v)===w?v+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.#i.delete(h),this.#s.delete(h),this.#d.delete(h),this.#o.delete(h),this.#l++)}rebase(){for(const[h,l]of this.#n)this.#t.set(h,l);this.#p=null,this.#m=null}reset(){this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#i.clear(),this.#s.clear(),this.#d.clear(),this.#o.clear(),this.#l=0,this.#p=null,this.#m=null,this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}retain(h){const l=h instanceof Set?h:new Set(h);let b=0;for(const a of[...this.#n.keys()])l.has(a)||(this.#t.delete(a),this.#n.delete(a),this.#r.delete(a),this.#i.delete(a),this.#s.delete(a),this.#d.delete(a),this.#o.delete(a),b++);return b&&(this.#p=null,this.#m=null),b}advanceHistoryWindow(h=this.#u()){const l=this.#f;if(!l)return 0;const b=Math.floor(h/l.bucketMs),a=b-this.#h;if(!(a>0))return 0;const p=Math.min(a,this.#a);for(const[w,v]of this.#d){const P=this.#n.get(w);for(let V=0;V<p;V++)v.push(P);v.length>this.#a&&v.splice(0,v.length-this.#a)}return this.#h=b,a}read(h,l,b,a){switch(h){case"updates":return this.#r.has(l)?this.#r.get(l):0;case"updatedAt":{const p=this.#i.get(l);return p===void 0?null:new Date(p)}case"sinceUpdate":{const p=this.#i.get(l);return p===void 0?null:this.#u()-p}case"firstValue":return this.#t.has(l)?this.#t.get(l):null;case"delta":return this.#n.has(l)?this.#n.get(l)-this.#t.get(l):null;case"deltaPercent":{if(!this.#n.has(l))return null;const p=this.#t.get(l);return p?(this.#n.get(l)-p)/Math.abs(p)*100:null}case"rate":{const p=this.#s.get(l),w=this.#i.get(l);if(!p||p.length<2||w===void 0)return null;const v=this.#u()-w,P=p[p.length-1]-p[p.length-2];return v>0?P/v*1e3:P}case"history":return this.#f?this.#d.has(l)?[...this.#d.get(l)]:null:this.#s.has(l)?[...this.#s.get(l)]:null;case"streak":return this.#o.has(l)?this.#o.get(l):0;case"specStatus":return this.#n.has(l)?t(this.#n.get(l),a):null;default:return m.includes(h)?this.#O(h,l,b,a):null}}#b(h){if(h){if(this.#m&&this.#m.only===h)return this.#m.view;const l=this.#y(h);return this.#m={only:h,view:l},l}return this.#p?this.#p:(this.#p=this.#y(null),this.#p)}#y(h){const l=[];for(const[R,S]of this.#n)h&&!h.has(R)||l.push(S);const b=l.sort((R,S)=>R-S);let a=0,p=0,w=0,v=0;for(const R of b){v+=R,a++;const S=R-p;p+=S/a,w+=S*(R-p)}const P=[];for(const[R,S]of this.#t)h&&!h.has(R)||P.push(S);const V=a?d(b):0,W=b.map(R=>Math.abs(R-V)).sort((R,S)=>R-S),K=a?d(W):0;return{sorted:b,baseline:P.sort((R,S)=>R-S),sum:v,mean:a?p:0,sd:a>1?Math.sqrt(w/(a-1)):0,median:V,mad:K}}#O(h,l,b,a){if(!this.#n.has(l)||b&&!b.has(l))return null;const p=this.#n.get(l),w=this.#b(b),v=w.sorted.length;if(!v)return null;switch(h){case"rank":return v-g(w.sorted,p)+1;case"rankAsc":return i(w.sorted,p)+1;case"rankChange":{if(!this.#t.has(l)||!w.baseline.length)return null;const P=w.baseline.length-g(w.baseline,this.#t.get(l))+1,V=v-g(w.sorted,p)+1;return P-V}case"percentile":return g(w.sorted,p)/v*100;case"quartile":{const P=g(w.sorted,p)/v;return Math.min(4,Math.max(1,Math.ceil(P*4)))}case"zScore":return w.sd?(p-w.mean)/w.sd:null;case"anomalyScore":return w.mad?k*(p-w.median)/w.mad:null;case"anomalyFlag":{if(!w.mad)return null;const P=a&&Number.isFinite(Number(a.threshold))?Number(a.threshold):y;return Math.abs(k*(p-w.median)/w.mad)>P}case"shareOfTotal":return w.sum?p/w.sum*100:null;default:return null}}}function d(f){const h=f.length;if(!h)return 0;const l=(h-1)*.5,b=Math.floor(l),a=Math.ceil(l);return b===a?f[b]:f[b]+(l-b)*(f[a]-f[b])}function i(f,h){let l=0,b=f.length;for(;l<b;){const a=l+b>>1;f[a]<h?l=a+1:b=a}return l}function g(f,h){let l=0,b=f.length;for(;l<b;){const a=l+b>>1;f[a]<=h?l=a+1:b=a}return l}function r(f){if(f==null||f==="")return null;if(f instanceof Date){const l=f.getTime();return Number.isFinite(l)?l:null}const h=typeof f=="number"?f:Number(f);return Number.isFinite(h)?h:null}function n(f){const h=[];for(const l of f||[]){const b=l.shadow;if(!b)continue;const a=typeof b=="string"?{kind:b}:b,p=a.kind;x.includes(p)&&(Y.includes(p)||$.includes(p)||j.includes(p)||h.push({colId:l.id||l.field,of:a.of||l.field||l.id,kind:p,depth:a.depth,historyWindow:p==="history"?a.window:void 0}))}return h}}),He("packages/core/src/columns/model.js",function(e,D){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return je}});const re=D("packages/core/src/internal/merge.js"),N=re.expand,G=re.merge,F=re.toArray,L=D("packages/core/src/internal/warn.js"),Z=L.fail,z=L.warnOnce,x=D("packages/core/src/internal/paths.js"),Y=x.getPath,$=x.pathGetter,j=x.pathSetter,y=D("packages/core/src/internal/text.js").humanise,c=D("packages/core/src/internal/predicates.js"),m=c.isFunction,s=c.isObject,o=D("packages/core/src/internal/uid.js").uid,d=D("packages/core/src/format/index.js").compileFormat,i=D("packages/core/src/columns/datatypes.js"),g=i.comparatorFor,r=i.createTypeRegistry,n=i.storageKind,f=D("packages/core/src/columns/infer.js"),h=f.inferColumnType,l=f.DEFAULT_SAMPLE,b=D("packages/core/src/columns/graph.js"),a=b.buildGraph,p=b.affectedBy,v=D("packages/core/src/columns/lookup.js").createLookup,P=D("packages/core/src/columns/value.js"),V=P.compileDisplay,W=P.ValuePipeline,K=P.warnImpureUse,R=D("packages/core/src/model/shadow.js"),S=R.FIT_SHADOW_KINDS,E=R.CLUSTER_SHADOW_KINDS,O=Object.freeze({geometry:"geometry",list:"list"}),M={value:{pure:!0},cell:{},edit:{enabled:!1},sort:{enabled:!0,direction:null,order:0,nullsFirst:!1},filter:{enabled:!0,type:"text"},group:{enabled:!1,index:-1,explode:!1},pivot:{enabled:!1,index:-1},total:null,layout:{width:150,min:40,max:null,flex:0,pin:null,hidden:!1,resizable:!0,movable:!0,lockVisible:!1,lockPosition:!1},header:{},facet:{},export:{lookup:"label",csv:!0,excel:!0},allowGroup:!0,allowPivot:!0,allowTotal:!0,nullable:!0,quickFilter:!0},T={centre:"center"},A=new Set(["start","center","end","left","right"]);function I(de){if(typeof de!="string")return;const oe=de.toLowerCase();return T[oe]?T[oe]:A.has(oe)?oe:void 0}function U(de){if(typeof de!="string")return;const oe=de.toLowerCase();return oe==="center"||oe==="centre"?"middle":oe==="top"||oe==="middle"||oe==="bottom"?oe:void 0}const X=["cell","layout","header"];function q(de){if(!s(de))return{};const oe={...de},he=(ce,me)=>{if(de[ce]===void 0)return;const ye=N(de[ce],me);ye&&X.includes(ce)&&!s(de[ce])&&delete ye.enabled,oe[ce]=ye};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 _(de,oe){const he={...de||{}},ce=s(oe)&&s(oe.layout)&&oe.layout.width!==void 0;return he.fit==="content"&&!ce&&delete he.width,he}const H=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 te(de,oe,he,ce){const me=he==="columnGroup"?"column group":"column";for(const ye of Object.keys(de))if(!oe.has(ye)){if(ye==="timeZone"&&he==="column"){z("column.timeZone",`\`timeZone\` is not a column option, so it had no effect on column "${ce}". A date column stores, displays, sorts and filters in the grid-level \`timeZone\` (else the viewer's); set \`timeZone\` on the grid, not the column.`);continue}z(`${he}.unknown:${ye}`,`'${ye}' is not a configuration key this grid recognises, so it had no effect on ${me} "${ce}". Check the spelling against the reference.`)}}function J(de){s(de.cell)&&de.cell.autoHeight!==void 0&&z("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${de.id||de.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function ne(de,oe){const he=oe&&m(de.defaultsFor)?de.defaultsFor(oe):null,ce={...de.defaults||{},...s(he)?he:{}},me={};return ce.align&&(me.align=ce.align,me.cell={align:ce.align},me.header={align:ce.align}),ce.filter&&(me.filter=ce.filter==="none"?{enabled:!1,type:"none"}:{enabled:!0,type:ce.filter}),ce.editor&&(me.edit=ce.editor==="none"?{editor:null}:{editor:ce.editor}),ce.total&&(me.total=ce.total),ce.render&&(me.cell={...me.cell||{},render:ce.render}),de.export&&(me.export={...de.export}),me}function se(de){if(typeof de=="string")return de.trim()?[de.trim()]:[];if(!Array.isArray(de))return[];const oe=[];for(const he of de){if(typeof he!="string")continue;const ce=he.trim();ce&&!oe.includes(ce)&&oe.push(ce)}return oe}class ae{#e=new Map;#t=[];#n=[];#r=new WeakMap;#i;#s;#o;#l;#a;#c;#u(oe,he,ce){if(oe&&typeof oe=="object"&&!m(oe)){const Se=oe;return(typeof Se.fn!="string"||!Se.fn)&&Z(`column "${ce}": a total given as an object needs a \`fn\` name, such as { fn: 'percentile', p: 0.9 }.`),Se.fn==="percentile"&&!(typeof Se.p=="number"&&Se.p>=0&&Se.p<=1)&&Z(`column "${ce}": { fn: 'percentile' } needs \`p\`, a number from 0 to 1 (0.9 for the 90th percentile).`),this.#f(Se.fn,he,ce),Object.freeze({...Se})}const me=this.#f(oe,he,ce);if(typeof me!="string"||!this.#d)return me??null;const ye=he&&he.totals&&he.totals.implement;if(ye&&m(ye[me])){const Se=ye[me];return Se.totalName=me,Se}const xe=this.#d.totalFn?.(me);return m(xe)?xe:me}#f(oe,he,ce){if(typeof oe!="string")return oe;const me=he&&he.totals&&he.totals.supported;if(!Array.isArray(me)||me.includes(oe))return oe;const ye=me.length?me.join(", "):"none";return Z(`column "${ce}" is typed ${he.name||"a type"}, for which the total "${oe}" is not meaningful. Supported: ${ye}. Aggregating it anyway would produce a confident wrong number.`),oe}#d;#h;#p;#m;#g;#b;#y=!1;#O;#w;constructor(oe={}){this.#s=q(oe.columnDefaults||{}),this.#o=oe.columnPresets||{},this.#a=oe.locale,this.#l=oe.timeZone,this.#c=U(oe.verticalAlign),this.#d=oe.registry||null,this.#h=oe.grid||null,this.#p=oe.context,this.#O=oe.sampleSize??l,this.#w=oe.onChange||null,this.#b=m(oe.rowKey)?oe.rowKey:void 0,this.#i=r(oe.dataTypes,this.#d);const{leaves:he,groups:ce}=je(oe.columns||[]);this.#n=ce;for(const me of he){me.facet!==void 0&&this.#r.set(me.def,me.facet);const ye=this.#A(me.def,null);if(ye.groupPath=me.path,this.#e.has(ye.id)){z(`columns.duplicate:${ye.id}`,`two columns resolve to the id '${ye.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}me.column=ye,this.#e.set(ye.id,ye),this.#t.push(ye.id)}this.#P(oe.stored||null)}#A(oe,he){te(oe,H,"column",oe.id||oe.field||"(unnamed)"),J(oe);const ce=q(oe),me=F(oe.preset),ye=me.map(Le=>{const ze=this.#o[Le];return ze?q(ze):(z(`preset:${Le}`,`unknown column preset "${Le}"; ignoring`),{})}),xe=this.#S(ce,ye,he),Se=this.#i.get(xe)||this.#i.get("text");if(!this.#i.has(xe)&&oe.type){const Le=O[xe];z(`type:${xe}`,`unknown data type "${xe}"; falling back to "text"`+(Le?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${Le}'.`:""))}const Te=m(Se.items)?this.#C(ce,ye,oe.id||oe.field||"(unnamed)"):null;let Be=M;Be=G(Be,this.#s),oe.type!==!1&&(Be=G(Be,ne(Se,Te)));for(const Le of ye)Be=G(Be,Le);this.#r.has(oe)&&(Be=G(Be,q({facet:this.#r.get(oe)}))),Be=G(Be,ce);const Ee=Be.edit;Ee&&Ee.editor&&Ee.enabled!==!0&&!m(Ee.enabled)&&(oe.edit||{}).editor&&z(`column.editor-not-enabled:${oe.id||oe.field}`,`column '${oe.id||oe.field}' names the editor '${Ee.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const Ge=oe.id||oe.field||o("col");if(oe.shadow&&!m(Be.value&&Be.value.compute)){const Le=typeof oe.shadow=="string"?{kind:oe.shadow}:oe.shadow,ze=Le.of||oe.field||Ge,Ye=S.includes(Le.kind),et=E.includes(Le.kind),tt=Ye?Le.model||Le:null,pt=Ye&&tt?[...Array.isArray(tt.predictors)?tt.predictors:[],tt.response].filter(Boolean):null,Tt=et?(Array.isArray(Le.columns)?Le.columns:[]).filter(Boolean):null;Be.value={...Be.value||{},deps:Tt&&Tt.length?Tt:pt&&pt.length?pt:Le.orderBy&&Le.orderBy!==ze?[ze,Le.orderBy]:[ze],pure:!1,compute:(Rt,ot)=>{const lt=ot.grid&&ot.grid.statistics;if(!lt)return null;const ht=ot.row&&ot.row.key||lt.keyOf(ot.data);if(!ht)return null;if(Ye){if(!m(lt.fitShadow))return null;const Nt=Le.model?{...Le.model,threshold:Le.threshold}:Le;return lt.fitShadow(Le.kind,ht,Nt)}return et?m(lt.clusterShadow)?lt.clusterShadow(Le.kind,ht,Le):null:lt.shadow(ze,Le.kind,ht,Le.scope,Le)}}}if(oe.running&&!m(Be.value&&Be.value.compute)){const Le=typeof oe.running=="string"?{kind:oe.running}:oe.running,ze=Le.of||oe.field||Ge;Be.value={...Be.value||{},deps:[ze],pure:!1,compute:(Ye,et)=>{const tt=et.grid&&et.grid.statistics;if(!tt||!m(tt.running))return null;const pt=et.row&&et.row.key||tt.keyOf(et.data);return pt?tt.running(ze,Le.kind||"total",pt):null}},oe.sort===void 0&&(Be.sort={...Be.sort||{},enabled:!1})}const Ne=oe.field??(m(Be.value&&Be.value.compute)?null:oe.id??null),ke=m(Be.value&&Be.value.compute),Oe={id:Ge,field:Ne,shadow:oe.shadow||null,running:oe.running||null,spec:oe.spec||null,validation:oe.validation||null,volatile:!!(oe.shadow||oe.running),title:Be.title??y(Ne||Ge),type:Se.name,dataType:Se,itemType:Te,nullable:Be.nullable!==!1,align:I(ce.cell&&ce.cell.align||ce.align||Be.cell&&Be.cell.align||Be.align||Se.defaults&&Se.defaults.align)||"start",verticalAlign:U(ce.cell&&ce.cell.verticalAlign||ce.verticalAlign||Be.cell&&Be.cell.verticalAlign||Be.verticalAlign)||this.#c,rowSpan:m(Be.rowSpan)?Be.rowSpan:null,colSpan:m(Be.colSpan)?Be.colSpan:null,value:{pure:!0,...Be.value||{}},cell:{...Be.cell||{}},edit:{...Be.edit||{}},sort:{...Be.sort||{}},filter:{...Be.filter||{}},group:{enabled:!1,index:-1,explode:!1,...Be.group||{}},pivot:{enabled:!1,index:-1,...Be.pivot||{}},total:this.#u(Be.total,Se,oe.id||oe.field||"(unnamed)"),groupTotal:Be.groupTotal===void 0?null:this.#u(Be.groupTotal,Se,oe.id||oe.field||"(unnamed)"),grandTotal:Be.grandTotal===void 0?null:this.#u(Be.grandTotal,Se,oe.id||oe.field||"(unnamed)"),tags:se(Be.tags),typeOptions:Be.typeOptions??null,...s(Be[xe])?{[xe]:Be[xe]}:{},layout:_(Be.layout,ce),header:{...Be.header||{}},contextMenu:Be.contextMenu===void 0?null:Be.contextMenu,facet:{...Be.facet||{}},export:{...Be.export||{}},allowGroup:Be.allowGroup!==!1,allowPivot:Be.allowPivot!==!1,allowTotal:Be.allowTotal!==!1,quickFilter:Be.quickFilter!==!1,def:oe,format:Be.format,presets:me,inferred:he!=null&&!oe.type,computed:ke,diff:oe.diff===void 0?void 0:!!oe.diff,read:Ne?$(Ne):null,write:Ne?j(Ne):null};Oe.cell.align=I(ce.cell&&ce.cell.align)||Oe.align,Oe.header.align=I(ce.header&&ce.header.align)||Oe.align;const Re=Be.lookup||null;return Oe.lookup=Re?v({id:Ge,lookup:Re},{locale:this.#a,onChange:()=>{this.#w&&this.#w("lookup",{colId:Ge})}}):null,Oe.group.explode&&Oe.lookup&&Oe.lookup.multiple&&z(`explode:${Ge}`,`column "${Ge}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(Oe),Oe}#v(oe){oe.formatter=d(oe.format,oe.dataType,this.#a,this.#l,oe.id),oe.formatValue=V(oe,{locale:this.#a,grid:this.#h,context:this.#p}),oe.itemCompare=oe.itemType?g(oe.itemType,this.#a):null,oe.compare=m(oe.value.compare)?oe.value.compare:oe.lookup?oe.lookup.comparator():m(oe.dataType.compareFor)?oe.dataType.compareFor(oe):g(oe.dataType,this.#a),oe.excel=oe.formatter&&oe.formatter.ooxml||oe.dataType&&oe.dataType.excel||"General",oe.storeKind=n(oe.dataType,!!(oe.lookup&&oe.lookup.multiple))}#C(oe,he,ce){let me=s(oe.typeOptions)?oe.typeOptions:null;for(let Te=he.length-1;!me&&Te>=0;Te--)s(he[Te].typeOptions)&&(me=he[Te].typeOptions);!me&&s(this.#s.typeOptions)&&(me=this.#s.typeOptions);const ye=me&&me.of!==void 0?me.of:"text",xe=typeof ye=="string"?this.#i.get(ye):void 0;return xe&&!m(xe.items)&&xe.storage!=="object"?xe:(z(`type:of:${String(ye)}`,`column "${ce}" names "${String(ye)}" as its item type (typeOptions.of), which is not ${xe?"a scalar data type":"a known data type"}; its items are read as text.`),this.#i.get("text"))}#S(oe,he,ce){if(oe.type===!1)return"text";if(oe.type)return oe.type;for(let me=he.length-1;me>=0;me--)if(he[me].type)return he[me].type;if(this.#s.type)return this.#s.type;if(oe.shadow){const me=typeof oe.shadow=="string"?oe.shadow:oe.shadow.kind;if(me==="fitInfluence")return"boolean";if(me==="fitPredicted"||me==="fitResidual"||me==="fitStdResidual"||me==="fitLeverage"||me==="fitCooksD"||me==="tsTrend"||me==="tsSeasonal"||me==="tsResidual"||me==="tsCoverage"||me==="tsSmoothed"||me==="tsSmoothingAlpha"||me==="tsSmoothingBeta"||me==="cluster"||me==="clusterDistance")return"number"}return ce||(oe.lookup?"lookup":"text")}#P(oe){const he=this.all();this.#m=a(he),this.#g?this.#g.setGraph(this.#m):this.#g=new W({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:oe||null,rowKey:this.#b});const ce=this.#g;for(const me of he)me.getValue=(ye,xe)=>ce.value(me,ye,xe)}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 ce=[];for(const me of he)Array.isArray(me.columns)?ce.push({...me,columns:oe(me.columns)}):me.column&&ce.push(me.column);return ce};return oe(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#i}affectedBy(oe){return p(this.#m,oe)}value(oe,he,ce){return this.#g.value(oe,he,ce)}text(oe,he,ce){return this.#g.text(oe,he,ce)}checkImpure(oe,he){K(this.#e.get(oe),he)}setLocale(oe){this.#a=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 ce=!1;for(const me of this.all()){const ye=me.def;if(ye.type!==void 0||!me.field||me.computed||me.lookup||this.#E(me))continue;const xe=me.read||(Be=>Y(Be,me.field)),Se=h(me.id,oe,xe,this.#i,{sampleSize:this.#O});if(Se===me.type)continue;he[me.id]=Se;const Te=this.#A(ye,Se);Te.groupPath=me.groupPath,Te.layout={...Te.layout,...we(me.layout)},this.#e.set(me.id,Te),Pe(this.#n,me.id,Te),ce=!0}return ce&&this.#P(null),he}redecorate(oe,he,ce={}){const me=this.#e.get(oe);if(!me){z(`redecorate:${oe}`,`columns.decorate('${oe}', …): no column with id '${oe}'.`);return}const ye=me.def||{},xe={...s(ye.cell)?ye.cell:{}};xe.decoration=he??void 0,ce&&"variant"in ce&&(xe.variant=ce.variant);const Se={...ye,cell:xe};this.#r.has(ye)&&this.#r.set(Se,this.#r.get(ye));const Te=this.#A(Se,me.type);return Te.groupPath=me.groupPath,Te.layout={...Te.layout,...we(me.layout)},me.lookup&&me.lookup!==Te.lookup&&m(me.lookup.destroy)&&me.lookup.destroy(),this.#e.set(oe,Te),Pe(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&&m(oe.lookup.destroy)&&oe.lookup.destroy()}#E(oe){for(const he of oe.presets){const ce=this.#o[he];if(ce&&ce.type)return!0}return!!this.#s.type}#T(oe){return!oe.computed&&m(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,ce={timeZone:this.#l,colId:oe.id,itemType:oe.itemType||null};return me=>he(oe.read(me),ce)}return oe.read}storeValue(oe,he){if(!(!oe||oe.computed)&&m(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 ce=this.storeReader(he);let me=null;!he.computed&&!this.#T(he)&&typeof he.field=="string"&&!he.lookup&&(me=he.field);const ye={id:he.id,kind:he.storeKind,nullable:he.nullable,read:ce};me!==null&&(ye.field=me),he.lookup&&(ye.dictionary=he.lookup.dictionary()),oe.push(ye)}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?fe(oe.cell.decoration):void 0,variant:oe.cell&&oe.cell.variant!=null?fe(oe.cell.variant):void 0}))}applyState(oe,he={}){const ce={applied:[],skipped:[]},me=Array.isArray(oe)?oe:oe&&oe.columns||[],ye=!Array.isArray(oe)&&oe&&oe.columnOrder||null;for(const Se of me){if(!Se||!Se.id){ce.skipped.push({key:"?",reason:"no id"});continue}let Te=this.#e.get(Se.id);if(!Te){ce.skipped.push({key:Se.id,reason:"unknown column"});continue}if(Object.hasOwn(Se,"decoration")||Object.hasOwn(Se,"variant")){const Be=Te.cell?Te.cell.decoration:void 0,Ee=Se.decoration??null,Ge=Object.hasOwn(Se,"variant"),Ne=Ge&&!ge(Te.cell?Te.cell.variant:void 0,Se.variant);(!ge(Be,Ee)||Ne)&&(this.redecorate(Se.id,Ee,Ge?{variant:Se.variant??void 0}:{}),Te=this.#e.get(Se.id)||Te)}Se.width!=null&&(Te.layout.width=Se.width),Se.flex!=null&&(Te.layout.flex=Se.flex),Se.hidden!=null&&(Te.layout.hidden=!!Se.hidden),Se.headerWrap!==void 0&&(Te.header.wrap=!!Se.headerWrap),Se.headerOrientation!==void 0&&(Te.header.orientation=Se.headerOrientation==="vertical"?"vertical":"horizontal"),Se.pin!==void 0&&(Te.layout.pin=Se.pin),Se.sort!==void 0&&(Te.sort.direction=Se.sort),Se.sortIndex!=null&&(Te.sort.order=Se.sortIndex),Se.groupIndex!=null&&(Te.group.enabled=!0,Te.group.index=Se.groupIndex),Se.pivotIndex!=null&&(Te.pivot.enabled=!0,Te.pivot.index=Se.pivotIndex),Se.total!==void 0&&(Te.total=Se.total),Se.groupTotal!==void 0&&(Te.groupTotal=Se.groupTotal),Se.grandTotal!==void 0&&(Te.grandTotal=Se.grandTotal),ce.applied.push(Se.id)}const xe=ye||(he&&he.keepOrder?[]:me.map(Se=>Se&&Se.id).filter(Boolean));if(xe.length){const Se=xe.filter(Be=>this.#e.has(Be)),Te=this.#t.filter(Be=>!Se.includes(Be));this.#t=[...Se,...Te]}return this.#w&&this.#w("state",ce),ce}move(oe,he){this.#N(oe,he)&&(this.#R(),this.#w&&this.#w("move",{id:oe,to:he}))}reorder(oe){const he={applied:[],skipped:[]},ce=[];let me=0;for(const ye of Array.isArray(oe)?oe:[]){const xe=me++;this.#N(ye,xe)&&(he.applied.push(ye),ce.push({id:ye,to:xe}))}if(!ce.length)return he;if(this.#R(),this.#w)for(const ye of ce)this.#w("move",ye);return he}#N(oe,he){const ce=this.#t.indexOf(oe);if(ce===-1||Math.max(0,Math.min(Number(he)||0,this.#t.length-1))===ce)return!1;const ye=this.#e.get(oe);if(ye.layout.movable===!1||ye.layout.lockPosition)return z(`move:${oe}`,`column "${oe}" is not movable; the move was ignored`),!1;const xe=this.#M(oe,he);return xe?(z(`move.married:${xe}`,`band "${xe}" declares marryChildren, so its columns stay together; the move was ignored`),!1):(this.#t.splice(ce,1),this.#t.splice(Math.max(0,Math.min(he,this.#t.length)),0,oe),!0)}#M(oe,he){if(!this.#n||!this.#n.length)return null;const ce=this.#t.filter(Se=>Se!==oe),me=Math.max(0,Math.min(he,ce.length)),ye=(Se,Te)=>{if(Array.isArray(Se.columns)){for(const Ee of Se.columns)ye(Ee,Te);return Te}const Be=Se.column?Se.column.id:Se.id;return Be&&Te.push(Be),Te},xe=Se=>{for(const Te of Se){if(!Array.isArray(Te.columns))continue;if(Te.marryChildren===!0){const Ee=ye(Te,[]),Ge=Ee.includes(oe),Ne=Ee.map(ke=>ce.indexOf(ke)).filter(ke=>ke>=0);if(Ne.length){const ke=Math.min(...Ne),Oe=Math.max(...Ne);if(Ge?me<ke||me>Oe+1:me>ke&&me<=Oe)return Te.id}}const Be=xe(Te.columns);if(Be)return Be}return null};return xe(this.#n)}#R(){const oe=new Map(this.#t.map((me,ye)=>[me,ye])),he=me=>{if(!Array.isArray(me.columns)){const xe=me.column?me.column.id:me.id;return oe.has(xe)?oe.get(xe):1/0}let ye=1/0;for(const xe of me.columns)ye=Math.min(ye,he(xe));return ye},ce=me=>{me.sort((ye,xe)=>he(ye)-he(xe));for(const ye of me)Array.isArray(ye.columns)&&ce(ye.columns)};ce(this.#n)}#I(oe){const he=ce=>{for(let me=0;me<ce.length;me++){const ye=ce[me];if(Array.isArray(ye.columns)){const xe=he(ye.columns);if(xe)return xe}else if(ye.column&&ye.column.id===oe)return ce.splice(me,1)[0]}return null};return he(this.#n)}#V(oe){const he=[];for(let ce=oe.length-1;ce>=0;ce--){const me=oe[ce];Array.isArray(me.columns)&&(he.push(...this.#V(me.columns)),me.columns.length===0&&(he.push(me.id),oe.splice(ce,1)))}return he}#W(){const oe=(he,ce,me)=>{for(const ye of he)Array.isArray(ye.columns)?oe(ye.columns,[...ce,ye.id]):ye.column&&(ye.column.groupPath=ce)};oe(this.#n,[])}#x(oe){const he=new Set(oe),ce=this.#t.filter(Se=>he.has(Se));if(!ce.length)return;const me=Math.min(...ce.map(Se=>this.#t.indexOf(Se))),ye=this.#t.slice(0,me).filter(Se=>!he.has(Se)),xe=this.#t.slice(me).filter(Se=>!he.has(Se));this.#t=[...ye,...ce,...xe]}#q(oe){const he=[],ce=me=>{if(Array.isArray(me.columns))for(const ye of me.columns)ce(ye);else me.column&&he.push(me.column.id)};return ce(oe),he}#U(oe){const he=ce=>{for(const me of ce){if(!Array.isArray(me.columns))continue;if(me.id===oe)return{node:me,parent:ce};const ye=he(me.columns);if(ye)return ye}return null};return he(this.#n)}groupColumns(oe,he={}){const ce=F(oe).filter(Te=>this.#e.has(Te));if(!ce.length)return z("columns.group.empty","groupColumns was given no known column ids; nothing was grouped."),null;for(const Te of ce)if(this.#e.get(Te).layout.lockPosition)return z(`columns.group.locked:${Te}`,`column "${Te}" is position-locked and cannot be grouped.`),null;const me=he.groupId?this.#U(he.groupId):null;if(he.groupId&&!me)return z(`columns.group.unknown:${he.groupId}`,`no band "${he.groupId}" to add to; nothing was grouped.`),null;let ye=null;if(!me&&he.id!=null&&(ye=String(he.id),this.#U(ye)||this.#e.has(ye)))return z(`columns.group.idtaken:${ye}`,`band id "${ye}" is already in use; nothing was grouped.`),null;const xe=ce.map(Te=>this.#I(Te)).filter(Boolean);if(!xe.length)return null;let Se;if(me)me.node.columns.push(...xe),Se=me.node.id;else{const Te={id:ye||o("grp"),title:he.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:xe},Be=Number.isInteger(he.at)?Math.max(0,Math.min(he.at,this.#n.length)):this.#n.length;this.#n.splice(Be,0,Te),Se=Te.id}return this.#V(this.#n),this.#x(ce),this.#W(),this.#R(),this.#w&&this.#w("columngroup",{action:"formed",groupId:Se,ids:ce}),Se}ungroupColumn(oe){const he=this.#e.get(oe);if(!he){z(`columns.ungroup.unknown:${oe}`,`no column "${oe}" to ungroup.`);return}const ce=he.groupPath||[];if(!ce.length)return;const me=ce[ce.length-1],ye=this.#U(me);if(!ye)return;const xe=this.#I(oe);if(!xe)return;const Se=ye.parent.indexOf(ye.node);ye.parent.splice(Se+1,0,xe);const Te=this.#V(this.#n),Be=this.#q(ye.node);if(Be.length){this.#x(Be);const Ee=Math.max(...Be.map(Ne=>this.#t.indexOf(Ne))),Ge=this.#t.filter(Ne=>Ne!==oe);Ge.splice(Ee+1,0,oe),this.#t=Ge}this.#W(),this.#R(),this.#w&&this.#w("columngroup",{action:"removed",id:oe,dissolved:Te})}renameGroup(oe,he){const ce=this.#U(oe);if(!ce){z(`columns.group.rename:${oe}`,`no band "${oe}" to rename.`);return}ce.node.title=String(he??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:oe,title:ce.node.title})}dissolveGroup(oe){const he=this.#U(oe);if(!he){z(`columns.group.dissolve:${oe}`,`no band "${oe}" to dissolve.`);return}const ce=he.parent.indexOf(he.node);he.parent.splice(ce,1,...he.node.columns),this.#W(),this.#R(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:oe})}moveGroup(oe,he){const ce=this.#U(oe);if(!ce){z(`columns.group.move:${oe}`,`no band "${oe}" to move.`);return}const me=ce.parent,ye=me.indexOf(ce.node);ye!==-1&&(me.splice(ye,1),me.splice(Math.max(0,Math.min(he,me.length)),0,ce.node),this.#Y(),this.#W(),this.#w&&this.#w("columngroup",{action:"moved",groupId:oe,to:he}))}#Y(){const oe=[],he=me=>{for(const ye of me)Array.isArray(ye.columns)?he(ye.columns):ye.column&&oe.push(ye.column.id)};he(this.#n);const ce=new Set(oe);this.#t=[...oe,...this.#t.filter(me=>!ce.has(me))]}groupTree(){const oe=ce=>ce.map(me=>Array.isArray(me.columns)?{id:me.id,title:me.title||"",collapsible:!!me.collapsible,openByDefault:me.openByDefault!==!1,columns:oe(me.columns)}:me.column?me.column.id:null).filter(me=>me!==null),he=oe(this.#n);return he.some(ce=>ce&&typeof ce=="object")?he:[]}applyGroupTree(oe){if(!Array.isArray(oe))return;const he=new Set,ce=ye=>{const xe=[];for(const Se of ye)if(Se&&typeof Se=="object"&&Array.isArray(Se.columns)){const Te=ce(Se.columns);if(!Te.length)continue;xe.push({id:Se.id||o("grp"),title:Se.title||"",collapsible:Se.collapsible===!0,openByDefault:Se.openByDefault!==!1,showWhen:"always",marryChildren:!1,header:{},def:{},columns:Te})}else if(typeof Se=="string"){const Te=this.#e.get(Se);Te&&!he.has(Se)&&(he.add(Se),xe.push({column:Te,path:[]}))}return xe},me=ce(oe);for(const ye of this.#t){if(he.has(ye))continue;const xe=this.#e.get(ye);xe&&me.push({column:xe,path:[]})}this.#n=me,this.#W(),this.#R(),this.#w&&this.#w("columngroup",{action:"applied"})}show(oe){this.#G(oe,!1)}hide(oe){this.#G(oe,!0)}#G(oe,he){const ce=[];for(const me of F(oe)){const ye=this.#e.get(me);if(ye){if(he&&ye.layout.lockVisible){z(`lockVisible:${me}`,`column "${me}" is \`layout.lockVisible\` and cannot be hidden`);continue}ye.layout.hidden!==he&&(ye.layout.hidden=he,ce.push(me))}}ce.length&&this.#w&&this.#w("visible",{ids:ce,hidden:he})}pin(oe,he){const ce=this.#e.get(oe);ce&&(ce.layout.pin=he??null,this.#w&&this.#w("pin",{id:oe,side:ce.layout.pin}))}pinMany(oe){const he={};for(const[me,ye]of oe){const xe=this.#e.get(me);xe&&(xe.layout.pin=ye??null,he[me]=xe.layout.pin)}const ce=Object.keys(he);ce.length&&this.#w&&this.#w("pin",{ids:ce,pins:he})}#D(oe,he){const ce=oe.layout.min??0,me=oe.layout.max;let ye=Math.max(ce,he);return me!=null&&(ye=Math.min(me,ye)),oe.layout.width=ye,oe.layout.flex=0,ye}resize(oe,he){const ce=this.#e.get(oe);if(!ce)return;if(ce.layout.resizable===!1){z(`resize:${oe}`,`column "${oe}" is not resizable; the resize was ignored`);return}const me=this.#D(ce,he);this.#w&&this.#w("resize",{id:oe,width:me})}resizeMany(oe){const he={};for(const[me,ye]of oe){const xe=this.#e.get(me);if(xe){if(xe.layout.resizable===!1){z(`resize:${me}`,`column "${me}" is not resizable; the resize was ignored`);continue}he[me]=this.#D(xe,ye)}}const ce=Object.keys(he);ce.length&&this.#w&&this.#w("resize",{ids:ce,widths:he})}}function we(de){const oe={};return de.width!=null&&(oe.width=de.width),de.hidden!=null&&(oe.hidden=de.hidden),de.pin!==void 0&&(oe.pin=de.pin),oe}function fe(de){if(de===null||typeof de!="object")return de;try{return structuredClone(de)}catch{}try{return JSON.parse(JSON.stringify(de))}catch{return de}}function ge(de,oe){const he=de??null,ce=oe??null;if(he===ce)return!0;if(he===null||ce===null)return!1;if(typeof he!="object"||typeof ce!="object")return he===ce;try{return JSON.stringify(he)===JSON.stringify(ce)}catch{return!1}}function je(de){const oe=[],he=(me,ye,xe)=>{const Se=[];for(const Te of me){if(!s(Te)){Z("a column definition must be an object");continue}if(Array.isArray(Te.columns)){te(Te,ee,"columnGroup",Te.title||Te.id||"(unnamed)");const Be={id:Te.id||o("grp"),title:Te.title||"",collapsible:Te.collapsible===!0,openByDefault:Te.openByDefault!==!1,showWhen:Te.showWhen||"always",marryChildren:Te.marryChildren===!0,header:Te.header||{},def:Te,columns:[]};Be.columns=he(Te.columns,[...ye,Be.id],Te.facet!==void 0?Te.facet:xe),Se.push(Be)}else{const Be={def:Te,path:ye,facet:xe};oe.push(Be),Se.push(Be)}}return Se},ce=he(de,[],void 0);return{leaves:oe,groups:ce}}function Pe(de,oe,he){for(const ce of de){if(ce.columns){if(Pe(ce.columns,oe,he))return!0;continue}if(ce.column&&ce.column.id===oe)return ce.column=he,!0}return!1}}),He("packages/core/src/columns/autogroup.js",function(e,D){"use strict";Object.defineProperty(e,"AUTO_GROUP_ID",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createAutoGroupColumn",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"warnOnAbsurdGrouping",{enumerable:!0,get:function(){return Y}});const N=D("packages/core/src/internal/warn.js").warnOnce,G="__lattice_group",F=240,L=.5;function Z($){const j=$.def&&$.def.layout;return(typeof j=="number"||j&&j.width!=null||$.def&&$.def.width!=null)&&Number.isFinite($.layout.width)?$.layout.width:null}function z($){const j=$.def&&$.def.layout;return!!(j&&j.min!=null)||$.def&&$.def.minWidth!=null}function x($){const{columns:j,groupBy:k}=$,y=k.map(u=>j.get(u)).filter(Boolean),c=y.length?y.map(u=>u.title||u.id).join(" > "):"Group",m=y.find(u=>Z(u)!=null),s=$.config&&$.config.autoGroupColumnWidth||(m?Z(m):F);let t=m&&z(m)?m.layout.min:120;m&&!z(m)&&(t=Math.min(t,s));const o=m&&m.layout.max!=null?m.layout.max:null;return{id:G,field:null,title:c,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group"},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!0},groupedIds:k.slice(),group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:s,min:t,max:o,pin:$.config&&$.config.autoGroupColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(u,d){return d&&d.group?d.groupValue:null},formatValue(u,d){if(!d||!d.group)return"";if(d.grandTotal)return $.config&&$.config.grandTotalLabel||"Total";const i=y[Math.min(d.level||0,y.length-1)];return i&&typeof i.formatValue=="function"?i.formatValue(u,d):u==null?"":String(u)}}}function Y($,j,k){!$.length||k<100||j<k*L||N(`grouping.cardinality:${$.join(",")}`,`grouping by ${$.join(", ")} produced ${j} groups for ${k} rows: nearly one group per row. Grouping a continuous value such as a percentage or a timestamp rarely reads usefully; consider a computed banding column.`)}}),He("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 G}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return F}});const re="__lattice_select",N=44;function G(L){const Z=L.selection||{},z=L.config&&L.config.selectionColumnWidth||N;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:z,min:z,max:z,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:Z.headerCheckbox===!0,def:{},getValue(x,Y){return Y?Y.selected:!1},formatValue(){return""}}}const F=G}),He("packages/core/src/columns/rownumbercolumn.js",function(e,D){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createRowNumberColumn",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Y}});const N=D("packages/core/src/internal/predicates.js").isFunction,G="__lattice_rownumber",F=40,L=9,Z=22;function z($){const j=String(Math.max(1,Math.trunc(Math.abs($))||1)).length;return Math.max(F,j*L+Z)}function x($){const j=$.rowNumbers,k=j&&typeof j=="object"?j:{},y=Number.isFinite(k.start)?k.start:1,c=Number.isFinite(k.width)?k.width:z(($.maxNumber||0)+y),m=N($.rank)?$.rank:()=>null;return{id:G,field:null,title:typeof k.title=="string"?k.title:"",type:"number",dataType:{base:"number"},nullable:!0,align:"end",generated:!0,control:!0,value:{pure:!0},cell:{align:"end"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:c,min:c,max:c,pin:"start",hidden:!1,resizable:k.width==null,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(s,t){const o=m(t);return o==null?null:o-1+y},formatValue(s){return s==null?"":String(s)}}}const Y=x}),He("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 Z}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"DetailModel",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Y}});const N=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/warn.js").warnOnce,L=240,Z=10;function z($){if(!$)return null;const j=$===!0?{}:$;return j.enabled===!1?null:!N(j.rows)&&!j.render?(F("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:N(j.rows)?j.rows:null,height:j.height??L,maxHeight:j.maxHeight??null,cacheLimit:Number.isFinite(j.cacheLimit)?Math.max(0,j.cacheLimit):Z,isMaster:N(j.isMaster)?j.isMaster:null,target:j.target||null,onCreate:N(j.onCreate)?j.onCreate:null,path:typeof j.path=="string"?j.path:null}}class x{#e;#t=new Set;#n;#r=0;constructor(j){this.#e=j.config,this.#n=N(j.onChange)?j.onChange:()=>{}}get config(){return this.#e}get inline(){return!this.#e.target}isMaster(j){if(!j||j.group||j.detail)return!1;const k=this.#e.isMaster;return k?!!k(j.data,j):!0}isOpen(j){return this.#t.has(j)}keys(){return[...this.#t]}activeKey(){for(const j of this.#t)return j;return null}heightOf(j){const k=this.#e.height;return N(k)?Number(k(j))||L:k==="auto"?L:Number(k)||L}open(j){return this.#t.has(j)?!1:(this.inline||this.#t.clear(),this.#t.add(j),this.#i(),!0)}close(j){return this.#t.delete(j)?(this.#i(),!0):!1}toggle(j){return this.#t.has(j)?(this.close(j),!1):(this.open(j),!0)}closeAll(){this.#t.size&&(this.#t.clear(),this.#i())}prune(j){if(!this.#t.size||!N(j))return;let k=!1;for(const y of[...this.#t])j(y)||(this.#t.delete(y),k=!0);k&&this.#i()}signature(){return`${this.#r}`}set(j){this.#t.clear();const k=Array.isArray(j)?j:[];for(const y of this.inline?k:k.slice(0,1))this.#t.add(y);this.#i()}#i(){this.#r++,this.#n()}}const Y=x}),He("packages/core/src/compute/special.js",function(e,D){"use strict";Object.defineProperty(e,"logGamma",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"incompleteBeta",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"normalQuantile",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"normalCdf",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"studentT",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"chiSquareUpperTail",{enumerable:!0,get:function(){return s}});const re=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),N=3e-12,G=1e-300;function F(t){if(t<.5)return Math.log(Math.PI/Math.sin(Math.PI*t))-F(1-t);const o=t-1;let u=.9999999999998099;const d=o+7.5;for(let i=0;i<re.length;i++)u+=re[i]/(o+i+1);return .5*Math.log(2*Math.PI)+(o+.5)*Math.log(d)-d+Math.log(u)}function L(t,o,u){const d=t+o,i=t+1,g=t-1;let r=1,n=1-d*u/i;Math.abs(n)<G&&(n=G),n=1/n;let f=n;for(let h=1;h<=300;h++){const l=2*h;let b=h*(o-h)*u/((g+l)*(t+l));n=1+b*n,Math.abs(n)<G&&(n=G),r=1+b/r,Math.abs(r)<G&&(r=G),n=1/n,f*=n*r,b=-(t+h)*(d+h)*u/((t+l)*(i+l)),n=1+b*n,Math.abs(n)<G&&(n=G),r=1+b/r,Math.abs(r)<G&&(r=G),n=1/n;const a=n*r;if(f*=a,Math.abs(a-1)<N)break}return f}function Z(t,o,u){if(!(t>0)||!(o>0)||!Number.isFinite(u))return Number.NaN;if(u<=0)return 0;if(u>=1)return 1;const d=Math.exp(F(t+o)-F(t)-F(o)+t*Math.log(u)+o*Math.log(1-u));return u<(t+1)/(t+o+2)?d*L(t,o,u)/t:1-d*L(o,t,1-u)/o}function z(t){if(!(t>0)||!(t<1))return t===0?-1/0:t===1?1/0:Number.NaN;const o=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],u=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],d=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],i=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],g=.02425;let r,n,f;t<g?(r=Math.sqrt(-2*Math.log(t)),f=(((((d[0]*r+d[1])*r+d[2])*r+d[3])*r+d[4])*r+d[5])/((((i[0]*r+i[1])*r+i[2])*r+i[3])*r+1)):t<=1-g?(r=t-.5,n=r*r,f=(((((o[0]*n+o[1])*n+o[2])*n+o[3])*n+o[4])*n+o[5])*r/(((((u[0]*n+u[1])*n+u[2])*n+u[3])*n+u[4])*n+1)):(r=Math.sqrt(-2*Math.log(1-t)),f=-(((((d[0]*r+d[1])*r+d[2])*r+d[3])*r+d[4])*r+d[5])/((((i[0]*r+i[1])*r+i[2])*r+i[3])*r+1));const l=(.5*x(-f/Math.SQRT2)-t)*Math.sqrt(2*Math.PI)*Math.exp(f*f/2);return f-l/(1+f*l/2)}function x(t){const o=Math.abs(t),u=2/(2+o),d=4*u-2,i=[-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 g=0,r=0,n;for(let h=i.length-1;h>0;h--)n=r,r=d*r-g+i[h],g=n;const f=u*Math.exp(-o*o+.5*(i[0]+d*r)-g);return t>=0?f:2-f}function Y(t){return .5*x(-t/Math.SQRT2)}function $(t,o){if(!(o>0)||!Number.isFinite(t))return Number.NaN;const u=.5*Z(o/2,.5,o/(o+t*t));return t>0?1-u:u}function j(t,o){if(!(t>0)||!(t<1)||!(o>0))return Number.NaN;if(o>1e7)return z(t);let u=-1e4,d=1e4,i=z(t);const g=F(o/2)+F(.5)-F((o+1)/2);for(let r=0;r<60;r++){const n=$(i,o);n<t?u=i:d=i;const f=Math.exp(-((o+1)/2)*Math.log(1+i*i/o)-g)/Math.sqrt(o),h=f>0?(n-t)/f:0;if(Math.abs(h)<1e-12)break;const l=i-h;if(i=l>u&&l<d&&Number.isFinite(l)?l:(u+d)/2,d-u<1e-12)break}return i}function k(t,o){let u=t,d=1/t,i=d;for(let g=0;g<300&&(u+=1,i*=o/u,d+=i,!(Math.abs(i)<Math.abs(d)*N));g++);return d*Math.exp(-o+t*Math.log(o)-F(t))}function y(t,o){let u=o+1-t,d=1/G,i=1/u,g=i;for(let r=1;r<=300;r++){const n=-r*(r-t);u+=2,i=n*i+u,Math.abs(i)<G&&(i=G),d=u+n/d,Math.abs(d)<G&&(d=G),i=1/i;const f=i*d;if(g*=f,Math.abs(f-1)<N)break}return Math.exp(-o+t*Math.log(o)-F(t))*g}function c(t,o){return!(t>0)||!(o>=0)||!Number.isFinite(o)?Number.NaN:o===0?0:o<t+1?k(t,o):1-y(t,o)}function m(t,o){return o>0?c(o/2,t/2):Number.NaN}function s(t,o){const u=m(t,o);return Number.isNaN(u)?Number.NaN:Math.min(1,Math.max(0,1-u))}}),He("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 N}}),Object.defineProperty(e,"choleskyInverse",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"normalEquations",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return Z}});function re(z){const x=z.length,Y=Array.from({length:x},()=>new Array(x).fill(0));for(let $=0;$<x;$++)for(let j=0;j<=$;j++){let k=z[$][j];for(let y=0;y<j;y++)k-=Y[$][y]*Y[j][y];if($===j){if(!(k>0))return null;Y[$][j]=Math.sqrt(k)}else Y[$][j]=k/Y[j][j]}return Y}function N(z,x){const Y=z.length,$=new Array(Y).fill(0);for(let k=0;k<Y;k++){let y=x[k];for(let c=0;c<k;c++)y-=z[k][c]*$[c];$[k]=y/z[k][k]}const j=new Array(Y).fill(0);for(let k=Y-1;k>=0;k--){let y=$[k];for(let c=k+1;c<Y;c++)y-=z[c][k]*j[c];j[k]=y/z[k][k]}return j}function G(z){const x=z.length,Y=Array.from({length:x},()=>new Array(x).fill(0));for(let $=0;$<x;$++){const j=new Array(x).fill(0);j[$]=1;const k=N(z,j);for(let y=0;y<x;y++)Y[y][$]=k[y]}return Y}function F(z,x,Y){const $=z.length,j=$?z[0].length:0,k=Array.from({length:j},()=>new Array(j).fill(0)),y=new Array(j).fill(0);for(let c=0;c<$;c++){const m=Y?Y[c]:1,s=z[c];for(let t=0;t<j;t++){const o=m*s[t];y[t]+=o*x[c];for(let u=t;u<j;u++)k[t][u]+=o*s[u]}}for(let c=0;c<j;c++)for(let m=0;m<c;m++)k[c][m]=k[m][c];return{xtwx:k,xtwy:y}}function L(z,x){return z.map(Y=>Y.reduce(($,j,k)=>$+j*x[k],0))}function Z(z,x){let Y=0;for(let $=0;$<z.length;$++){let j=0;for(let k=0;k<z.length;k++)j+=x[$][k]*z[k];Y+=z[$]*j}return Y}}),He("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 N}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return k}});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(c){if(!Number.isFinite(c))return;this.#e++;const m=c-this.#t;this.#t+=m/this.#e,this.#n+=m*(c-this.#t)}merge(c){if(c.#e===0)return;if(this.#e===0){this.#e=c.#e,this.#t=c.#t,this.#n=c.#n;return}const m=this.#e+c.#e,s=c.#t-this.#t;this.#t+=s*(c.#e/m),this.#n+=c.#n+s*s*(this.#e*c.#e/m),this.#e=m}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 c=this.variance();return c===null?null:Math.sqrt(c)}stddevP(){const c=this.varianceP();return c===null?null:Math.sqrt(c)}}class N{#e=[];#t=0;#n;#r;constructor(c,m=Math.random){if(!(c>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(c),this.#r=m}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(c){if(!Number.isFinite(c))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(c);return}const m=Math.floor(this.#r()*this.#t);m<this.#n&&(this.#e[m]=c)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let c=0;for(const m of this.#e)c+=m;return c/this.#e.length}quantile(c){const m=this.#e.length;if(!m)return null;const s=this.#e.slice().sort((d,i)=>d-i);if(m===1)return s[0];const t=(m-1)*Math.min(1,Math.max(0,c)),o=Math.floor(t),u=Math.ceil(t);return o===u?s[o]:s[o]+(t-o)*(s[u]-s[o])}}function G(y){return y^=y>>>16,y=Math.imul(y,2246822507),y^=y>>>13,y=Math.imul(y,3266489909),y^=y>>>15,y>>>0}function F(y){if(typeof y=="number"){const s=new DataView(new ArrayBuffer(8));return s.setFloat64(0,y===0?0:y),G(s.getUint32(0)^s.getUint32(4))}const c=typeof y=="string"?y:String(y);let m=2166136261;for(let s=0;s<c.length;s++)m^=c.charCodeAt(s),m=Math.imul(m,16777619);return G(m)}class L{#e;#t;#n;constructor(c=14){const m=Math.floor(c);if(m<4||m>16)throw new RangeError("HLL precision must be 4..16");this.#e=m,this.#t=1<<m,this.#n=new Uint8Array(this.#t)}static errorBoundFor(c=14){const m=1<<Math.floor(c),s=1.04/Math.sqrt(m);return Object.freeze({kind:"probabilistic",metric:"relative",value:s,statement:`distinct count within ~${(s*100).toFixed(2)}% relative standard error (m=${m} buckets)`})}errorBound(){return L.errorBoundFor(this.#e)}add(c){const m=F(c),s=m&this.#t-1,t=m>>>this.#e|1<<32-this.#e;let o=1,u=t;for(;(u&1)===0;)o++,u>>>=1;o>this.#n[s]&&(this.#n[s]=o)}count(){const c=this.#t,m=32-this.#e,s=new Float64Array(m+2);for(let u=0;u<c;u++)s[this.#n[u]]++;let t=c*x(1-s[m+1]/c);for(let u=m;u>=1;u--)t=.5*(t+s[u]);t+=c*z(s[0]/c);const o=Z*c*c/t;return Math.round(o)}}const Z=.5/Math.log(2);function z(y){if(y===1)return 1/0;let c=1,m=y,s;do y*=y,s=m,m+=y*c,c+=c;while(m!==s);return m}function x(y){if(y===0||y===1)return 0;let c=1,m=1-y,s;do y=Math.sqrt(y),s=m,c*=.5,m-=(1-y)**2*c;while(m!==s);return m/3}class Y{#e=new Map;#t;#n=0;constructor(c){if(!(c>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(c)}errorBoundFor(c){const m=c/this.#t;return Object.freeze({kind:"deterministic",metric:"absolute",value:m,statement:`each count overestimates the truth by at most N/m = ${m.toFixed(2)} (N=${c}, m=${this.#t})`})}get seen(){return this.#n}add(c){this.#n++;const m=this.#e.get(c);if(m){m.count++;return}if(this.#e.size<this.#t){this.#e.set(c,{count:1,error:0});return}let s,t=1/0;for(const[o,u]of this.#e)u.count<t&&(t=u.count,s=o);this.#e.delete(s),this.#e.set(c,{count:t+1,error:t})}top(c=this.#t){return[...this.#e.entries()].map(([s,t])=>({item:s,count:t.count,error:t.error})).sort((s,t)=>t.count-s.count).slice(0,Math.max(0,Math.floor(c)))}}class ${#e;#t=[[]];#n=0;#r;#i;constructor(c=200,m=Math.random){this.#e=Math.max(8,Math.floor(c)),this.#r=m,this.#i=2/3}static errorBoundFor(c=200){const m=1/Math.max(8,Math.floor(c));return Object.freeze({kind:"probabilistic",metric:"rank",value:m,statement:`queried quantile's true rank within ~${(m*100).toFixed(2)}% of N of the requested rank (k=${c})`})}errorBound(){return $.errorBoundFor(this.#e)}get count(){return this.#n}#s(c){const s=this.#t.length-1-c,t=Math.ceil(this.#e*this.#i**s);return Math.max(2,t)}add(c){Number.isFinite(c)&&(this.#n++,this.#t[0].push(c),this.#t[0].length>=this.#s(0)&&this.#o(0))}#o(c){const m=this.#t[c];m.sort((o,u)=>o-u),c+1>=this.#t.length&&this.#t.push([]);const s=this.#t[c+1],t=this.#r()<.5?0:1;for(let o=t;o<m.length;o+=2)s.push(m[o]);this.#t[c]=[];for(let o=0;o<this.#t.length;o++)if(this.#t[o].length>=this.#s(o)){this.#o(o);return}}#l(){const c=[];for(let m=0;m<this.#t.length;m++){const s=1<<m;for(const t of this.#t[m])c.push({v:t,w:s})}return c}quantile(c){const m=this.#l();if(!m.length)return null;m.sort((u,d)=>u.v-d.v);let s=0;for(const u of m)s+=u.w;const t=Math.min(1,Math.max(0,c))*s;let o=0;for(const u of m)if(o+=u.w,o>=t)return u.v;return m[m.length-1].v}rank(c){let m=0;for(let s=0;s<this.#t.length;s++){const t=1<<s;for(const o of this.#t[s])o<=c&&(m+=t)}return m}}const j=Object.freeze({distinct:L.errorBoundFor(14),median:$.errorBoundFor(200),p25:$.errorBoundFor(200),p75:$.errorBoundFor(200),p90:$.errorBoundFor(200),p95:$.errorBoundFor(200),p99:$.errorBoundFor(200),iqr:$.errorBoundFor(200),topK:Object.freeze({kind:"deterministic",metric:"absolute",value:0,statement:"each count overestimates the truth by at most N/m; top-K exact when the K-th item exceeds N/m"})}),k={Welford:re,Reservoir:N,HyperLogLog:L,SpaceSaving:Y,KLL:$,hash32:F,SKETCH_BOUNDS:j}}),He("packages/core/src/compute/statistics.js",function(e,D){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"numbers",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"frequencies",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"herfindahl",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"entropy",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"evenness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"topShare",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"gini",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"moments",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"quantileSorted",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"quantile",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"STAT_FNS",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"modifiedZOutliers",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"jarqueBera",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"weightedQuantile",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"covariance",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return de}}),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 ce}}),Object.defineProperty(e,"seriesStats",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"D2_N2",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(e,"D4_N2",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(e,"movingRanges",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"withinSigma",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"countOutside",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(e,"histogram",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(e,"DEFAULT_CONFIDENCE",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(e,"meanInterval",{enumerable:!0,get:function(){return et}}),Object.defineProperty(e,"proportionInterval",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(e,"slopeInterval",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(e,"capabilityInterval",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(e,"standardizedMeanDifference",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(e,"normalTotalVariation",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(e,"frequencyMap",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(e,"categoricalDistance",{enumerable:!0,get:function(){return ht}}),Object.defineProperty(e,"SUBSET_RELIABILITY_FLOOR",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(e,"compareColumn",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(e,"isNumericColumn",{enumerable:!0,get:function(){return be}}),Object.defineProperty(e,"populationRead",{enumerable:!0,get:function(){return Me}});const re=D("packages/core/src/compute/handle.js"),N=re.presenceReader,G=re.valueReader,F=D("packages/core/src/compute/special.js"),L=F.studentTQuantile,Z=F.studentT,z=F.normalQuantile,x=F.normalCdf,Y=F.chiSquareUpperTail,$=D("packages/core/src/compute/linalg.js"),j=$.cholesky,k=$.choleskySolve,y=$.choleskyInverse,c=$.normalEquations,m=$.quadForm,t=D("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,o=5e3,u=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"}),d=Object.freeze({distinct:Object.freeze({sketch:"HyperLogLog",bound:t.distinct}),median:Object.freeze({sketch:"KLL",bound:t.median}),p25:Object.freeze({sketch:"KLL",bound:t.p25}),p75:Object.freeze({sketch:"KLL",bound:t.p75}),p90:Object.freeze({sketch:"KLL",bound:t.p90}),p95:Object.freeze({sketch:"KLL",bound:t.p95}),p99:Object.freeze({sketch:"KLL",bound:t.p99}),iqr:Object.freeze({sketch:"KLL",bound:t.iqr}),top3Share:Object.freeze({sketch:"SpaceSaving",bound:t.topK}),top10Share:Object.freeze({sketch:"SpaceSaving",bound:t.topK})});function i(pe){const Ae=pe==="sum"||pe==="avg"||pe==="countValues"||pe==="min"||pe==="max"?"maintained":Object.prototype.hasOwnProperty.call(u,pe)?u[pe]:null,ve=Object.prototype.hasOwnProperty.call(d,pe)?d[pe]:null;return{stat:pe,exact:Ae,approximate:ve}}function g(pe,Ae){const ve=Ae.length,Ie=new Float64Array(ve);let De=0;if(pe&&(pe.kind==="float64"||pe.kind==="int32")){const _e=pe.values,Ke=N(pe);for(let qe=0;qe<ve;qe++){const st=Ae[qe];if(Ke&&Ke(st)!==1)continue;const ut=_e[st];Number.isNaN(ut)||(Ie[De++]=ut)}return Ie.subarray(0,De)}const Ve=G(pe);for(let _e=0;_e<ve;_e++){const Ke=Ve(Ae[_e]);if(Ke==null||Ke==="")continue;const qe=typeof Ke=="number"?Ke:Number(Ke);Number.isFinite(qe)&&(Ie[De++]=qe)}return Ie.subarray(0,De)}function r(pe,Ae){const ve=new Map,Ie=G(pe);let De=0;for(let Ve=0;Ve<Ae.length;Ve++){const _e=Ie(Ae[Ve]);if(_e==null||_e===""||typeof _e=="number"&&Number.isNaN(_e))continue;const Ke=typeof _e=="object"?String(_e):_e;ve.set(Ke,(ve.get(Ke)||0)+1),De++}const Ce=[...ve.values()].sort((Ve,_e)=>_e-Ve);return{counts:Ce,total:De,distinct:Ce.length}}function n(pe){return pe.total>0?pe.counts.map(Ae=>Ae/pe.total):[]}function f(pe,Ae){const ve=r(pe,Ae);if(!ve.total)return null;let Ie=0;for(const De of n(ve))Ie+=De*De;return Ie}function h(pe,Ae){const ve=r(pe,Ae);if(!ve.total)return null;let Ie=0;for(const De of n(ve))De>0&&(Ie-=De*Math.log2(De));return Ie}function l(pe,Ae){const ve=r(pe,Ae);if(!ve.total||ve.distinct<2)return ve.total?1:null;let Ie=0;for(const De of n(ve))De>0&&(Ie-=De*Math.log2(De));return Ie/Math.log2(ve.distinct)}function b(pe,Ae,ve=3){const Ie=r(pe,Ae);if(!Ie.total)return null;const De=Math.max(1,Math.floor(ve));let Ce=0;for(let Ve=0;Ve<Math.min(De,Ie.counts.length);Ve++)Ce+=Ie.counts[Ve];return Ce/Ie.total}function a(pe,Ae){const ve=g(pe,Ae),Ie=ve.length;if(!Ie)return null;const De=ve.slice().sort();if(De[0]<0)return null;let Ce=0,Ve=0;for(let _e=0;_e<Ie;_e++)Ce+=De[_e],Ve+=(_e+1)*De[_e];return Ce===0?0:2*Ve/(Ie*Ce)-(Ie+1)/Ie}function p(pe){let Ae=0,ve=0,Ie=0;for(let De=0;De<pe.length;De++){const Ce=pe[De];Ae++;const Ve=Ce-ve;ve+=Ve/Ae,Ie+=Ve*(Ce-ve)}return{n:Ae,mean:ve,m2:Ie}}function w(pe,Ae){const ve=pe.length;if(!ve)return NaN;if(ve===1)return pe[0];const Ie=(ve-1)*Math.min(1,Math.max(0,Ae)),De=Math.floor(Ie),Ce=Math.ceil(Ie);return De===Ce?pe[De]:pe[De]+(Ie-De)*(pe[Ce]-pe[De])}function v(pe,Ae){if(!pe.length)return NaN;const ve=pe.slice().sort();return w(ve,Ae)}function P(pe,Ae){const ve=G(pe);let Ie=0,De=0,Ce=0;for(let Ve=0;Ve<Ae.length;Ve++){const _e=ve(Ae[Ve]);if(_e==null||_e==="")continue;const Ke=String(_e).toUpperCase();Ke==="PASS"?Ie++:Ke==="FAIL"?De++:Ke==="WARN"&&Ce++}return{pass:Ie+Ce,fail:De,warn:Ce,judged:Ie+Ce+De}}const V=Object.freeze({hhi:(pe,Ae)=>f(pe,Ae),entropy:(pe,Ae)=>h(pe,Ae),evenness:(pe,Ae)=>l(pe,Ae),top3Share:(pe,Ae)=>b(pe,Ae,3),top10Share:(pe,Ae)=>b(pe,Ae,10),gini:(pe,Ae)=>a(pe,Ae),trimmedMean:(pe,Ae)=>E(g(pe,Ae),.1),winsorizedMean:(pe,Ae)=>O(g(pe,Ae),.1),robustOutliers:(pe,Ae)=>M(g(pe,Ae),3.5),jarqueBera:(pe,Ae)=>T(g(pe,Ae)),variance:(pe,Ae)=>{const{n:ve,m2:Ie}=p(g(pe,Ae));return ve>1?Ie/(ve-1):null},varianceP:(pe,Ae)=>{const{n:ve,m2:Ie}=p(g(pe,Ae));return ve>0?Ie/ve:null},stddev:(pe,Ae)=>{const{n:ve,m2:Ie}=p(g(pe,Ae));return ve>1?Math.sqrt(Ie/(ve-1)):null},stddevP:(pe,Ae)=>{const{n:ve,m2:Ie}=p(g(pe,Ae));return ve>0?Math.sqrt(Ie/ve):null},median:(pe,Ae)=>{const ve=g(pe,Ae);return ve.length?v(ve,.5):null},percentile:(pe,Ae,ve)=>{const Ie=ve?ve.p:void 0;if(typeof Ie!="number"||!(Ie>=0&&Ie<=1))return null;const De=g(pe,Ae);return De.length?v(De,Ie):null},p25:(pe,Ae)=>{const ve=g(pe,Ae);return ve.length?v(ve,.25):null},p75:(pe,Ae)=>{const ve=g(pe,Ae);return ve.length?v(ve,.75):null},p90:(pe,Ae)=>{const ve=g(pe,Ae);return ve.length?v(ve,.9):null},p95:(pe,Ae)=>{const ve=g(pe,Ae);return ve.length?v(ve,.95):null},p99:(pe,Ae)=>{const ve=g(pe,Ae);return ve.length?v(ve,.99):null},iqr:(pe,Ae)=>{const ve=g(pe,Ae);if(!ve.length)return null;const Ie=ve.slice().sort();return w(Ie,.75)-w(Ie,.25)},mad:(pe,Ae)=>{const ve=g(pe,Ae);if(!ve.length)return null;const Ie=v(ve,.5),De=new Float64Array(ve.length);for(let Ce=0;Ce<ve.length;Ce++)De[Ce]=Math.abs(ve[Ce]-Ie);return v(De,.5)},range:(pe,Ae)=>{const ve=g(pe,Ae);if(!ve.length)return null;let Ie=1/0,De=-1/0;for(let Ce=0;Ce<ve.length;Ce++)ve[Ce]<Ie&&(Ie=ve[Ce]),ve[Ce]>De&&(De=ve[Ce]);return De-Ie},distinct:(pe,Ae)=>{const ve=G(pe),Ie=new Set;for(let De=0;De<Ae.length;De++){const Ce=ve(Ae[De]);Ce==null||Ce===""||Ie.add(Ce instanceof Date?Ce.getTime():Ce)}return Ie.size},mode:(pe,Ae)=>{const ve=G(pe),Ie=new Map;for(let Ve=0;Ve<Ae.length;Ve++){const _e=ve(Ae[Ve]);if(_e==null||_e==="")continue;const Ke=_e instanceof Date?_e.getTime():_e;Ie.set(Ke,(Ie.get(Ke)||0)+1)}let De=null,Ce=1;for(const[Ve,_e]of Ie)_e>Ce&&(Ce=_e,De=Ve);return De},skewness:(pe,Ae)=>{const ve=g(pe,Ae),{n:Ie,mean:De,m2:Ce}=p(ve);if(Ie<3||Ce<=0)return null;const Ve=Math.sqrt(Ce/(Ie-1));let _e=0;for(let Ke=0;Ke<ve.length;Ke++)_e+=((ve[Ke]-De)/Ve)**3;return Ie/((Ie-1)*(Ie-2))*_e},kurtosis:(pe,Ae)=>{const ve=g(pe,Ae),{n:Ie,mean:De,m2:Ce}=p(ve);if(Ie<4||Ce<=0)return null;const Ve=Math.sqrt(Ce/(Ie-1));let _e=0;for(let st=0;st<ve.length;st++)_e+=((ve[st]-De)/Ve)**4;const Ke=Ie*(Ie+1)/((Ie-1)*(Ie-2)*(Ie-3)),qe=3*(Ie-1)**2/((Ie-2)*(Ie-3));return Ke*_e-qe},geomean:(pe,Ae)=>{const ve=g(pe,Ae);if(!ve.length)return null;let Ie=0;for(let De=0;De<ve.length;De++){if(ve[De]<=0)return null;Ie+=Math.log(ve[De])}return Math.exp(Ie/ve.length)},harmean:(pe,Ae)=>{const ve=g(pe,Ae);if(!ve.length)return null;let Ie=0;for(let De=0;De<ve.length;De++){if(ve[De]===0)return null;Ie+=1/ve[De]}return ve.length/Ie},sumSquares:(pe,Ae)=>{const ve=g(pe,Ae);let Ie=0;for(let De=0;De<ve.length;De++)Ie+=ve[De]*ve[De];return Ie},passRate:(pe,Ae)=>{const{pass:ve,judged:Ie}=P(pe,Ae);return Ie?ve/Ie:null},failureCount:(pe,Ae)=>P(pe,Ae).fail}),W=Object.freeze({hhi:"Concentration (HHI)",entropy:"Entropy",evenness:"Evenness",top3Share:"Top 3 share",top10Share:"Top 10 share",gini:"Gini coefficient",trimmedMean:"Trimmed mean",winsorizedMean:"Winsorized mean",robustOutliers:"Outliers (robust)",jarqueBera:"Jarque–Bera",median:"Median",percentile:"Percentile",p25:"25th percentile",p75:"75th percentile",p90:"90th percentile",p95:"95th percentile",p99:"99th percentile",iqr:"Interquartile range",mad:"Median absolute deviation",variance:"Variance",varianceP:"Variance (population)",stddev:"Standard deviation",stddevP:"Standard deviation (population)",range:"Range",distinct:"Distinct",mode:"Mode",skewness:"Skewness",kurtosis:"Kurtosis",geomean:"Geometric mean",harmean:"Harmonic mean",sumSquares:"Sum of squares",weightedAvg:"Weighted average",argmin:"Lowest by",argmax:"Highest by",passRate:"Pass rate",failureCount:"Failures"});function K(pe,Ae,ve){const Ie=G(pe),De=G(Ae);let Ce=0,Ve=0;for(let _e=0;_e<ve.length;_e++){const Ke=ve[_e],qe=Number(Ie(Ke)),st=Number(De(Ke));!Number.isFinite(qe)||!Number.isFinite(st)||(Ce+=qe*st,Ve+=st)}return Ve===0?null:Ce/Ve}function R(pe,Ae,ve){const Ie=G(pe);let De=null,Ce=ve?-1/0:1/0;for(let Ve=0;Ve<Ae.length;Ve++){const _e=Ae[Ve],Ke=Number(Ie(_e));Number.isFinite(Ke)&&(ve?Ke>Ce:Ke<Ce)&&(Ce=Ke,De=_e)}return De}function S(pe,Ae,ve){const Ie=G(pe),De=G(Ae);let Ce=0,Ve=0,_e=0,Ke=0,qe=0,st=0;for(let Ot=0;Ot<ve.length;Ot++){const Lt=ve[Ot],Bt=Number(Ie(Lt)),Ct=Number(De(Lt));!Number.isFinite(Bt)||!Number.isFinite(Ct)||(Ce++,Ve+=Bt,_e+=Ct,Ke+=Bt*Bt,qe+=Ct*Ct,st+=Bt*Ct)}if(Ce<2)return null;const ut=Ce*st-Ve*_e,kt=Math.sqrt((Ce*Ke-Ve*Ve)*(Ce*qe-_e*_e));if(kt===0)return null;const Pt=ut/kt;return Math.max(-1,Math.min(1,Pt))}function E(pe,Ae=.1){const ve=pe.length;if(!ve)return null;const Ie=Array.from(pe).sort((_e,Ke)=>_e-Ke),De=Math.floor(ve*Math.min(.49,Math.max(0,Ae))),Ce=Ie.slice(De,ve-De);if(!Ce.length)return w(Ie,.5);let Ve=0;for(const _e of Ce)Ve+=_e;return Ve/Ce.length}function O(pe,Ae=.1){const ve=pe.length;if(!ve)return null;const Ie=Array.from(pe).sort((Ke,qe)=>Ke-qe),De=Math.floor(ve*Math.min(.49,Math.max(0,Ae))),Ce=Ie[De],Ve=Ie[ve-1-De];let _e=0;for(const Ke of Ie)_e+=Math.min(Ve,Math.max(Ce,Ke));return _e/ve}function M(pe,Ae=3.5){if(!pe.length)return null;const Ie=Array.from(pe).sort((Ke,qe)=>Ke-qe),De=w(Ie,.5),Ce=Ie.map(Ke=>Math.abs(Ke-De)).sort((Ke,qe)=>Ke-qe),Ve=w(Ce,.5);if(Ve===0)return null;let _e=0;for(const Ke of Ie)Math.abs(.6745*(Ke-De)/Ve)>Ae&&_e++;return _e}function T(pe){const Ae=pe.length;if(Ae<8)return null;let ve=0;for(const Ke of pe)ve+=Ke;ve/=Ae;let Ie=0,De=0,Ce=0;for(const Ke of pe){const qe=Ke-ve;Ie+=qe*qe,De+=qe*qe*qe,Ce+=qe*qe*qe*qe}if(Ie/=Ae,De/=Ae,Ce/=Ae,Ie===0)return null;const Ve=De/Ie**1.5,_e=Ce/(Ie*Ie)-3;return Ae/6*(Ve*Ve+_e*_e/4)}function A(pe,Ae,ve){const Ie=[];let De=0;for(let Ke=0;Ke<pe.length;Ke++){const qe=Number(pe[Ke]),st=Number(Ae[Ke]);!Number.isFinite(qe)||!Number.isFinite(st)||st<=0||(Ie.push([qe,st]),De+=st)}if(!Ie.length||De<=0)return null;if(Ie.sort((Ke,qe)=>Ke[0]-qe[0]),Ie.length===1)return Ie[0][0];const Ce=[];let Ve=0;for(const[,Ke]of Ie)Ce.push((Ve+Ke/2)/De),Ve+=Ke;const _e=Math.max(0,Math.min(1,ve));if(_e<=Ce[0])return Ie[0][0];if(_e>=Ce[Ce.length-1])return Ie[Ie.length-1][0];for(let Ke=1;Ke<Ce.length;Ke++){if(_e>Ce[Ke])continue;const qe=Ce[Ke]-Ce[Ke-1],st=qe>0?(_e-Ce[Ke-1])/qe:0;return Ie[Ke-1][0]+(Ie[Ke][0]-Ie[Ke-1][0])*st}return Ie[Ie.length-1][0]}function I(pe,Ae,ve){const Ie=G(pe),De=G(Ae),Ce=new Float64Array(ve.length),Ve=new Float64Array(ve.length);let _e=0;for(let Ke=0;Ke<ve.length;Ke++){const qe=ve[Ke],st=Number(Ie(qe)),ut=Number(De(qe));!Number.isFinite(st)||!Number.isFinite(ut)||(Ce[_e]=st,Ve[_e]=ut,_e++)}return{xs:Ce.subarray(0,_e),ys:Ve.subarray(0,_e),n:_e}}function U(pe,Ae,ve,Ie=!1){const{xs:De,ys:Ce,n:Ve}=I(pe,Ae,ve);if(Ve<2)return null;let _e=0,Ke=0;for(let st=0;st<Ve;st++)_e+=De[st],Ke+=Ce[st];_e/=Ve,Ke/=Ve;let qe=0;for(let st=0;st<Ve;st++)qe+=(De[st]-_e)*(Ce[st]-Ke);return qe/(Ie?Ve:Ve-1)}function X(pe,Ae,ve){const{xs:Ie,ys:De,n:Ce}=I(pe,Ae,ve);if(Ce<2)return null;let Ve=0,_e=0;for(let Bt=0;Bt<Ce;Bt++)Ve+=Ie[Bt],_e+=De[Bt];Ve/=Ce,_e/=Ce;let Ke=0,qe=0,st=0;for(let Bt=0;Bt<Ce;Bt++){const Ct=Ie[Bt]-Ve,Ut=De[Bt]-_e;Ke+=Ct*Ct,qe+=Ct*Ut,st+=Ut*Ut}if(Ke===0)return null;const ut=qe/Ke,kt=_e-ut*Ve,Pt=st===0?1:Math.max(0,Math.min(1,qe*qe/(Ke*st))),Ot=Math.max(0,st-ut*qe),Lt=Ce>2?Math.sqrt(Ot/(Ce-2)/Ke):0;return{slope:ut,intercept:kt,r2:Pt,stdError:Lt,n:Ce}}const q=new Set(["ols","wls","robust"]),_=new Set(["quantile"]),H=new Set(["ridge","lasso","elasticnet","mixed","gls"]),ee=1.345;function te(pe,Ae,ve){const{xtwx:Ie,xtwy:De}=c(pe,Ae,ve),Ce=j(Ie);if(!Ce)return null;const Ve=k(Ce,De),_e=y(Ce),Ke=J(pe,Ve),qe=Ae.map((st,ut)=>st-Ke[ut]);return{beta:Ve,cov:_e,fitted:Ke,residuals:qe}}function J(pe,Ae){return pe.map(ve=>ve.reduce((Ie,De,Ce)=>Ie+De*Ae[Ce],0))}function ne(pe,Ae){const ve=pe.length,Ie=pe.map(qe=>qe[Ae]),De=pe.map(qe=>[1,...qe.filter((st,ut)=>ut!==Ae)]),Ce=te(De,Ie,null);if(!Ce)return 1;const Ve=Ie.reduce((qe,st)=>qe+st,0)/ve;let _e=0,Ke=0;for(let qe=0;qe<ve;qe++)_e+=Ce.residuals[qe]**2,Ke+=(Ie[qe]-Ve)**2;return Ke===0?1:Math.max(0,Math.min(1,1-_e/Ke))}function se(pe){const Ae=[...pe].sort((De,Ce)=>De-Ce),ve=ae(Ae),Ie=pe.map(De=>Math.abs(De-ve)).sort((De,Ce)=>De-Ce);return ae(Ie)/.6745}function ae(pe){const Ae=pe.length;if(!Ae)return 0;const ve=Math.floor(Ae/2);return Ae%2?pe[ve]:(pe[ve-1]+pe[ve])/2}function we(pe,Ae,ve={}){const Ie=ve.method||"ols";if(H.has(Ie))throw new Error(`[lattice] regression method "${Ie}" is out of scope; use ols, wls or robust.`);if(_.has(Ie))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!q.has(Ie))throw new Error(`[lattice] unknown regression method "${Ie}"; use ols, wls or robust.`);const De=Array.isArray(Ae)?Ae.length:0,Ce=De&&Array.isArray(pe[0])?pe[0].length:0,Ve=Ce+1;if(!(De>Ve))return null;for(let jt=0;jt<De;jt++){if(!Number.isFinite(Ae[jt])||!Array.isArray(pe[jt])||pe[jt].length!==Ce)return null;for(let $t=0;$t<Ce;$t++)if(!Number.isFinite(pe[jt][$t]))return null}let _e=null;if(Ie==="wls"){if(_e=ve.weights,!Array.isArray(_e)||_e.length!==De)return null;for(let jt=0;jt<De;jt++)if(!(_e[jt]>0)||!Number.isFinite(_e[jt]))return null}const Ke=pe.map(jt=>[1,...jt]);let qe,st=null;if(Ie==="robust"){if(qe=te(Ke,Ae,null),!qe)return null;for(let jt=0;jt<50;jt++){const $t=se(qe.residuals);if(!($t>0))break;const Gt=qe.residuals.map(_t=>{const Kt=Math.abs(_t/$t);return Kt<=ee?1:ee/Kt}),zt=te(Ke,Ae,Gt);if(!zt)return null;const Vt=zt.beta.reduce((_t,Kt,Dt)=>Math.max(_t,Math.abs(Kt-qe.beta[Dt])),0);if(qe=zt,st=Gt,Vt<1e-10)break}}else if(qe=te(Ke,Ae,_e),!qe)return null;const ut=Ie==="robust"?st:_e,{beta:kt,cov:Pt,fitted:Ot,residuals:Lt}=qe;let Bt=0,Ct=0,Ut=0;for(let jt=0;jt<De;jt++){const $t=ut?ut[jt]:1;Bt+=$t*Lt[jt]**2,Ct+=$t,Ut+=$t*Ae[jt]}const rn=Ut/Ct;let Wt=0;for(let jt=0;jt<De;jt++){const $t=ut?ut[jt]:1;Wt+=$t*(Ae[jt]-rn)**2}const Qt=De-Ve,Ze=Bt/Qt,ct=Wt===0?1:Math.max(0,Math.min(1,1-Bt/Wt)),St=1-(1-ct)*(De-1)/Qt,bt=Array.isArray(ve.names)&&ve.names.length===Ce?ve.names:pe[0].map((jt,$t)=>`x${$t+1}`),yt=Ye(ve.confidence),We=Qt>0?L(1-(1-yt)/2,Qt):1/0,ft=kt.map((jt,$t)=>{const Gt=Math.sqrt(Math.max(0,Ze*Pt[$t][$t])),zt=Gt>0?jt/Gt:jt===0?0:1/0,Vt=Number.isFinite(zt)?2*(1-Z(Math.abs(zt),Qt)):0,_t=Number.isFinite(We)?We*Gt:null;return{name:$t===0?"(intercept)":bt[$t-1],estimate:jt,stdError:Gt,t:zt,p:Math.max(0,Math.min(1,Vt)),lower:_t===null?null:jt-_t,upper:_t===null?null:jt+_t}}),rt=new Array(De),dt=new Array(De);for(let jt=0;jt<De;jt++){const $t=ut?ut[jt]:1,Gt=Math.max(0,Math.min(1,$t*m(Ke[jt],Pt)));rt[jt]=Gt;const zt=(1-Gt)**2;dt[jt]=zt>0&&Ze>0?Lt[jt]**2/(Ve*Ze)*(Gt/zt):null}const xt=pe[0].map((jt,$t)=>{if(Ce<2)return 1;const Gt=ne(pe,$t);return Gt>=1?1/0:1/(1-Gt)});let Ft=null;{const jt=Lt.map(Gt=>Gt*Gt),$t=te(Ke,jt,null);if($t){const Gt=jt.reduce((Jt,cn)=>Jt+cn,0)/De;let zt=0,Vt=0;for(let Jt=0;Jt<De;Jt++)zt+=$t.residuals[Jt]**2,Vt+=(jt[Jt]-Gt)**2;const _t=Vt===0?0:Math.max(0,Math.min(1,1-zt/Vt)),Kt=De*_t,Dt=Y(Kt,Ce);Ft={statistic:Kt,df:Ce,p:Dt,heteroscedastic:Dt<.05}}}let wt=null;if(Ce===1){const jt=pe.map(($t,Gt)=>Gt).sort(($t,Gt)=>pe[$t][0]-pe[Gt][0]);wt={confidence:yt,points:jt.map($t=>{const Gt=Ke[$t],zt=Math.sqrt(Math.max(0,Ze*m(Gt,Pt)));return{x:pe[$t][0],yhat:Ot[$t],lower:Ot[$t]-We*zt,upper:Ot[$t]+We*zt}})}}return{method:Ie,coefficients:ft,r2:ct,adjR2:St,n:De,df:Qt,sigma2:Ze,fitted:Ot,residuals:Lt,leverage:rt,cooksD:dt,vif:xt,heteroscedasticity:Ft,band:wt,weights:ut?[...ut]:null}}function fe(pe){const Ae=pe.length,ve=Array.from({length:Ae},(Ce,Ve)=>Ve).sort((Ce,Ve)=>pe[Ce]-pe[Ve]),Ie=new Float64Array(Ae);let De=0;for(;De<Ae;){let Ce=De;for(;Ce+1<Ae&&pe[ve[Ce+1]]===pe[ve[De]];)Ce++;const Ve=(De+Ce)/2+1;for(let _e=De;_e<=Ce;_e++)Ie[ve[_e]]=Ve;De=Ce+1}return Ie}const ge=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function je(pe){const Ae=[.01,.05,.1],ve=[ge["1%"],ge["5%"],ge["10%"]];if(pe<=ve[0]){const Ce=(Math.log(Ae[1])-Math.log(Ae[0]))/(ve[1]-ve[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(Ae[0])+Ce*(pe-ve[0]))))}if(pe>=ve[2]){const Ce=(Math.log(Ae[2])-Math.log(Ae[1]))/(ve[2]-ve[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(Ae[2])+Ce*(pe-ve[2]))))}const Ie=pe<ve[1]?0:1,De=(pe-ve[Ie])/(ve[Ie+1]-ve[Ie]);return Math.exp(Math.log(Ae[Ie])+De*(Math.log(Ae[Ie+1])-Math.log(Ae[Ie])))}function Pe(pe,Ae,ve,Ie){const De=ve-Ie,Ce=Ie+3,Ve=new Array(De),_e=new Array(De);let Ke=!0,qe=Ie;for(let Ot=0;Ot<De;Ot++){const Lt=Ie+Ot,Bt=new Float64Array(Ce);Bt[0]=1,Bt[1]=Ot+1,Bt[2]=pe[Lt];for(let Ct=1;Ct<=Ie;Ct++)Bt[2+Ct]=Ae[Lt-Ct];for(let Ct=1;Ct<Ce;Ct++)Number.isFinite(Bt[Ct])||(qe=Math.min(qe,Ct-3));Ve[Ot]=Bt,_e[Ot]=Ae[Lt],Number.isFinite(_e[Ot])||(Ke=!1)}if(!Ke)return 0;const{xtwx:st,xtwy:ut}=c(Ve,_e,null);let kt=0,Pt=1/0;for(let Ot=0;Ot<=qe;Ot++){const Lt=Ot+3;if(!(De>Lt))continue;const Bt=new Array(Lt);for(let ct=0;ct<Lt;ct++)Bt[ct]=st[ct].slice(0,Lt);const Ct=j(Bt);if(!Ct)continue;const Ut=k(Ct,ut.slice(0,Lt));let rn=0;for(let ct=0;ct<De;ct++){const St=Ve[ct];let bt=0;for(let yt=0;yt<Lt;yt++)bt+=St[yt]*Ut[yt];rn+=(_e[ct]-bt)**2}const Qt=rn/(De-Lt)*(De-Lt);if(!(Qt>0))continue;const Ze=De*Math.log(Qt/De)+2*Lt;Ze<Pt&&(Pt=Ze,kt=Ot)}return kt}function de(pe,Ae={}){const ve=[];for(let Pt=0;Pt<pe.length;Pt++){const Ot=Number(pe[Pt]);Number.isFinite(Ot)&&ve.push(Ot)}const Ie=ve.length,De=Ie-1;if(Ie<8||De<6)return null;const Ce=new Array(De);for(let Pt=0;Pt<De;Pt++)Ce[Pt]=ve[Pt+1]-ve[Pt];let Ve=Number.isFinite(Ae.maxlag)?Math.floor(Ae.maxlag):Math.ceil(12*(Ie/100)**.25);Ve=Math.max(0,Math.min(Ve,Math.floor((De-5)/2)));const _e=(Pt,Ot)=>{const Lt=[],Bt=[];for(let Ct=Ot;Ct<De;Ct++){const Ut=[Ct-Ot+1,ve[Ct]];for(let rn=1;rn<=Pt;rn++)Ut.push(Ce[Ct-rn]);Lt.push(Ut),Bt.push(Ce[Ct])}return we(Lt,Bt,{method:"ols"})},Ke=Pe(ve,Ce,De,Ve),qe=_e(Ke,Ke);if(!qe||!qe.coefficients[2])return null;const st=qe.coefficients[2].t,ut=je(st),kt=st<ge["5%"];return{statistic:st,usedLag:Ke,nobs:De-Ke,criticalValues:{...ge},pValue:ut,pApproximate:!0,stationary:kt,verdict:kt?"stationary":"non-stationary",regression:"ct"}}function oe(pe,Ae={}){const ve=[];for(let kt=0;kt<pe.length;kt++){const Pt=Number(pe[kt]);Number.isFinite(Pt)&&ve.push(Pt)}const Ie=ve.length;if(Ie<3)return null;let De=Number.isFinite(Ae.maxlag)?Math.floor(Ae.maxlag):Math.min(10,Ie-1);De=Math.max(1,Math.min(De,Ie-1));let Ce=0;for(const kt of ve)Ce+=kt;Ce/=Ie;const Ve=ve.map(kt=>kt-Ce);let _e=0;for(const kt of Ve)_e+=kt*kt;_e/=Ie;const Ke=new Array(De+1).fill(0);Ke[0]=1;for(let kt=1;kt<=De;kt++){let Pt=0;for(let Ot=kt;Ot<Ie;Ot++)Pt+=Ve[Ot]*Ve[Ot-kt];Ke[kt]=_e>0?Pt/Ie/_e:0}const qe=new Array(De+1).fill(0);qe[0]=1;let st=[];for(let kt=1;kt<=De;kt++){let Pt=Ke[kt];for(let Ct=1;Ct<kt;Ct++)Pt-=st[Ct-1]*Ke[kt-Ct];let Ot=1;for(let Ct=1;Ct<kt;Ct++)Ot-=st[Ct-1]*Ke[Ct];const Lt=Ot!==0?Pt/Ot:0,Bt=new Array(kt);for(let Ct=1;Ct<kt;Ct++)Bt[Ct-1]=st[Ct-1]-Lt*st[kt-1-Ct];Bt[kt-1]=Lt,qe[kt]=Lt,st=Bt}const ut=1.96/Math.sqrt(Ie);return{acf:Ke,pacf:qe,bounds:{upper:ut,lower:-ut},n:Ie,nlags:De,approximate:!0}}function he(pe,Ae,ve){const{xs:Ie,ys:De,n:Ce}=I(pe,Ae,ve);if(Ce<2)return null;const Ve=fe(Ie),_e=fe(De);let Ke=0,qe=0;for(let Pt=0;Pt<Ce;Pt++)Ke+=Ve[Pt],qe+=_e[Pt];Ke/=Ce,qe/=Ce;let st=0,ut=0,kt=0;for(let Pt=0;Pt<Ce;Pt++){const Ot=Ve[Pt]-Ke,Lt=_e[Pt]-qe;st+=Ot*Lt,ut+=Ot*Ot,kt+=Lt*Lt}return ut===0||kt===0?null:Math.max(-1,Math.min(1,st/Math.sqrt(ut*kt)))}function ce(pe,Ae,ve){const{xs:Ie,ys:De,n:Ce}=I(pe,Ae,ve);if(Ce<2||Ce>o)return null;let Ve=0,_e=0,Ke=0,qe=0;for(let kt=0;kt<Ce;kt++)for(let Pt=kt+1;Pt<Ce;Pt++){const Ot=Math.sign(Ie[kt]-Ie[Pt]),Lt=Math.sign(De[kt]-De[Pt]),Bt=Ot*Lt;Bt>0?Ve++:Bt<0?_e++:Ot===0&&Lt===0||(Ot===0?Ke++:qe++)}const st=Ve+_e+qe,ut=Ve+_e+Ke;return st===0||ut===0?null:(Ve-_e)/Math.sqrt(st*ut)}function me(pe,Ae={}){const ve=pe.length;if(ve<2)return null;const Ie=pe[0],De=pe[ve-1],Ce=[];for(let Ct=1;Ct<ve;Ct++){const Ut=pe[Ct-1];Ut!==0&&Ce.push((pe[Ct]-Ut)/Math.abs(Ut))}let Ve=null;if(Ce.length>1){let Ct=0;for(const rn of Ce)Ct+=rn;Ct/=Ce.length;let Ut=0;for(const rn of Ce)Ut+=(rn-Ct)**2;Ve=Math.sqrt(Ut/(Ce.length-1))}const _e=Number(Ae.periodsPerYear)>0?Number(Ae.periodsPerYear):null;let Ke=pe[0],qe=0,st=0,ut=0,kt=0;for(let Ct=1;Ct<ve;Ct++){if(pe[Ct]>Ke){Ke=pe[Ct],qe=Ct;continue}if(Ke<=0)continue;const Ut=(Ke-pe[Ct])/Ke;Ut>st&&(st=Ut,ut=qe,kt=Ct)}let Pt=null;if(ve>2){let Ct=0;for(let Wt=0;Wt<ve;Wt++)Ct+=pe[Wt];Ct/=ve;let Ut=0,rn=0;for(let Wt=0;Wt<ve;Wt++){const Qt=pe[Wt]-Ct;rn+=Qt*Qt,Wt>0&&(Ut+=Qt*(pe[Wt-1]-Ct))}Pt=rn>0?Ut/rn:null}let Ot=0,Lt=0;for(const Ct of Ce)Ct>0?Ot++:Ct<0&&Lt++;let Bt=null;if(Ie>0&&De>0){const Ct=(De/Ie)**(1/(ve-1))-1;Bt=_e?(1+Ct)**_e-1:Ct}return{n:ve,first:Ie,last:De,change:De-Ie,changePercent:Ie===0?null:(De-Ie)/Math.abs(Ie)*100,volatility:Ve,annualisedVolatility:Ve!==null&&_e?Ve*Math.sqrt(_e):null,growth:Bt,maxDrawdown:st,maxDrawdownFrom:ut,maxDrawdownTo:kt,autocorrelation:Pt,upDays:Ot,downDays:Lt}}const ye=1.128,xe=3.267;function Se(pe){const Ae=pe.length;if(Ae<2)return null;const ve=[];for(let De=1;De<Ae;De++)ve.push(Math.abs(pe[De]-pe[De-1]));const Ie=ve.reduce((De,Ce)=>De+Ce,0)/ve.length;return{ranges:ve,centre:Ie,upper:xe*Ie,lower:0}}function Te(pe){const Ae=pe.length;if(Ae<2)return null;let ve=0;for(let De=1;De<Ae;De++)ve+=Math.abs(pe[De]-pe[De-1]);const Ie=ve/(Ae-1);return{sigma:Ie/ye,meanRange:Ie}}function Be(pe,Ae){const ve=pe.length;if(ve<2||!Ae)return null;const Ie=Number.isFinite(Number(Ae.lower))?Number(Ae.lower):null,De=Number.isFinite(Number(Ae.upper))?Number(Ae.upper):null;if(Ie===null&&De===null)return null;let Ce=0;for(let Ot=0;Ot<ve;Ot++)Ce+=pe[Ot];Ce/=ve;let Ve=0;for(let Ot=0;Ot<ve;Ot++)Ve+=(pe[Ot]-Ce)**2;const _e=Math.sqrt(Ve/(ve-1)),Ke=Te(pe),qe=Ke?Ke.sigma:null,st=Ot=>{if(!Ot||Ot<=0)return{index:null,k:null};const Bt=Ie!==null&&De!==null?(De-Ie)/(6*Ot):null,Ct=De!==null?(De-Ce)/(3*Ot):1/0,Ut=Ie!==null?(Ce-Ie)/(3*Ot):1/0;return{index:Bt,k:Math.min(Ct,Ut)}},ut=st(qe),kt=st(_e);let Pt=0;for(let Ot=0;Ot<ve;Ot++){if(Ie!==null&&pe[Ot]<Ie){Pt++;continue}De!==null&&pe[Ot]>De&&Pt++}return{n:ve,mean:Ce,lower:Ie,upper:De,target:Number.isFinite(Number(Ae.target))?Number(Ae.target):null,sigmaWithin:qe,sigmaOverall:_e,cp:ut.index,cpk:ut.k,pp:kt.index,ppk:kt.k,outOfSpec:Pt,defectRate:ve?Pt/ve:null}}function Ee(pe){const Ae=pe.length;if(Ae<2)return null;const ve=Te(pe);if(!ve||!(ve.sigma>0))return null;let Ie=0;for(let De=0;De<Ae;De++)Ie+=pe[De];return Ie/=Ae,{centre:Ie,sigma:ve.sigma,upper:Ie+3*ve.sigma,lower:Ie-3*ve.sigma}}function Ge(pe,Ae){if(!Ae||!(Ae.sigma>0))return[];const ve=pe.length,{centre:Ie,sigma:De}=Ae,Ce=_e=>(pe[_e]-Ie)/De,Ve=[];for(let _e=0;_e<ve;_e++){if(Math.abs(Ce(_e))>3&&Ve.push({index:_e,rule:1,description:"beyond three sigma"}),_e>=2)for(const Ke of[1,-1]){let qe=0;for(let st=_e-2;st<=_e;st++)Ce(st)*Ke>2&&qe++;if(qe>=2){Ve.push({index:_e,rule:2,description:"two of three past two sigma"});break}}if(_e>=4)for(const Ke of[1,-1]){let qe=0;for(let st=_e-4;st<=_e;st++)Ce(st)*Ke>1&&qe++;if(qe>=4){Ve.push({index:_e,rule:3,description:"four of five past one sigma"});break}}if(_e>=7)for(const Ke of[1,-1]){let qe=!0;for(let st=_e-7;st<=_e;st++)if(Ce(st)*Ke<=0){qe=!1;break}if(qe){Ve.push({index:_e,rule:4,description:"eight in a row on one side"});break}}}return Ve}function Ne(pe,Ae){if(!Ae||!(Ae.sigma>0))return[];const ve=pe.length,{centre:Ie,sigma:De}=Ae,Ce=Ke=>(pe[Ke]-Ie)/De,Ve=(Ke,qe,st,ut)=>{for(const kt of[1,-1]){let Pt=0;for(let Ot=Ke;Ot<=qe;Ot++)Ce(Ot)*kt>st&&Pt++;if(Pt>=ut)return!0}return!1},_e=[];for(let Ke=0;Ke<ve;Ke++){if(Math.abs(Ce(Ke))>3&&_e.push({index:Ke,rule:1,description:"beyond three sigma"}),Ke>=8)for(const qe of[1,-1]){let st=!0;for(let ut=Ke-8;ut<=Ke;ut++)if(Ce(ut)*qe<=0){st=!1;break}if(st){_e.push({index:Ke,rule:2,description:"nine in a row on one side"});break}}if(Ke>=5)for(const qe of[1,-1]){let st=!0;for(let ut=Ke-4;ut<=Ke;ut++)if((pe[ut]-pe[ut-1])*qe<=0){st=!1;break}if(st){_e.push({index:Ke,rule:3,description:qe>0?"six rising":"six falling"});break}}if(Ke>=13){let qe=!0;for(let st=Ke-12;st<=Ke;st++){const ut=pe[st]-pe[st-1],kt=pe[st+1<=Ke?st+1:st]-pe[st];if(st+1>Ke)break;if(ut===0||kt===0||ut>0==kt>0){qe=!1;break}}qe&&_e.push({index:Ke,rule:4,description:"fourteen alternating"})}if(Ke>=2&&Ve(Ke-2,Ke,2,2)&&_e.push({index:Ke,rule:5,description:"two of three past two sigma"}),Ke>=4&&Ve(Ke-4,Ke,1,4)&&_e.push({index:Ke,rule:6,description:"four of five past one sigma"}),Ke>=14){let qe=!0;for(let st=Ke-14;st<=Ke;st++)if(Math.abs(Ce(st))>=1){qe=!1;break}qe&&_e.push({index:Ke,rule:7,description:"fifteen within one sigma"})}if(Ke>=7){let qe=!0;for(let st=Ke-7;st<=Ke;st++)if(Math.abs(Ce(st))<=1){qe=!1;break}qe&&_e.push({index:Ke,rule:8,description:"eight beyond one sigma"})}}return _e}const ke=Object.freeze(["westernElectric","nelson"]);function Oe(pe,Ae,ve="westernElectric"){return String(ve)==="nelson"?Ne(pe,Ae):Ge(pe,Ae)}function Re(pe,Ae,ve){let Ie=0;for(let De=0;De<pe.length;De++)(pe[De]<Ae||pe[De]>ve)&&Ie++;return Ie}function Le(pe,Ae,ve,Ie=20){const De=pe.length;if(!De)return[];const Ce=pe[0],Ve=pe[De-1];if(Ve===Ce)return[{from:Ce,to:Ve,count:De}];const _e=ve-Ae,Ke=1.5*_e;let qe=_e>0?Math.max(Ce,Ae-Ke):Ce,st=_e>0?Math.min(Ve,ve+Ke):Ve;st>qe||(qe=Ce,st=Ve);const ut=_e>0?2*_e/Math.cbrt(De):(st-qe)/(Math.ceil(Math.log2(De))+1),kt=ut>0?Math.min(Ie,Math.max(1,Math.ceil((st-qe)/ut))):1,Pt=(st-qe)/kt,Ot=[];for(let Lt=0;Lt<kt;Lt++)Ot.push({from:qe+Lt*Pt,to:qe+(Lt+1)*Pt,count:0});for(let Lt=0;Lt<De;Lt++){const Bt=Math.min(kt-1,Math.max(0,Math.floor((pe[Lt]-qe)/Pt)));Ot[Bt].count++}return Ot[0].from=Ce,Ot[kt-1].to=Ve,Ot}const ze=.95;function Ye(pe){const Ae=Number(pe);return Number.isFinite(Ae)&&Ae>0&&Ae<1?Ae:ze}function et(pe,Ae=ze){const ve=pe.length;if(ve<2)return null;let Ie=0;for(let st=0;st<ve;st++)Ie+=pe[st];const De=Ie/ve;let Ce=0;for(let st=0;st<ve;st++){const ut=pe[st]-De;Ce+=ut*ut}const Ve=Math.sqrt(Ce/(ve-1)),_e=Ye(Ae),qe=L(1-(1-_e)/2,ve-1)*Ve/Math.sqrt(ve);return{mean:De,lower:De-qe,upper:De+qe,margin:qe,n:ve,confidence:_e}}function tt(pe,Ae,ve=ze){const Ie=Number(pe),De=Number(Ae);if(!(De>0)||!(Ie>=0)||Ie>De)return null;const Ce=Ye(ve),Ve=z(1-(1-Ce)/2),_e=Ie/De,Ke=Ve*Ve,qe=1+Ke/De,st=(_e+Ke/(2*De))/qe,ut=Ve/qe*Math.sqrt(_e*(1-_e)/De+Ke/(4*De*De));return{proportion:_e,lower:Math.max(0,st-ut),upper:Math.min(1,st+ut),n:De,confidence:Ce}}function pt(pe,Ae=ze){if(!pe||!(pe.n>2)||!Number.isFinite(pe.stdError))return null;const ve=Ye(Ae),De=L(1-(1-ve)/2,pe.n-2)*pe.stdError;return{slope:pe.slope,lower:pe.slope-De,upper:pe.slope+De,margin:De,confidence:ve}}function Tt(pe,Ae,ve=ze){const Ie=Number(pe),De=Number(Ae);if(!Number.isFinite(Ie)||!(De>1))return null;const Ce=Ye(ve),_e=z(1-(1-Ce)/2)*Math.sqrt(1/(9*De)+Ie*Ie/(2*(De-1)));return{index:Ie,lower:Ie-_e,upper:Ie+_e,margin:_e,n:De,confidence:Ce}}function Rt(pe,Ae){return!pe||!(pe.sd>0)||!Number.isFinite(Ae)||!Number.isFinite(pe.mean)?null:(Ae-pe.mean)/pe.sd}function ot(pe){return Number.isFinite(pe)?Math.min(1,Math.max(0,2*x(Math.abs(pe)/2)-1)):0}function lt(pe,Ae){const ve=new Map,Ie=G(pe);let De=0;for(let Ce=0;Ce<Ae.length;Ce++){const Ve=Ie(Ae[Ce]);if(Ve==null||Ve===""||typeof Ve=="number"&&Number.isNaN(Ve))continue;const _e=Ve instanceof Date?Ve.getTime():typeof Ve=="object"?String(Ve):Ve;ve.set(_e,(ve.get(_e)||0)+1),De++}return{map:ve,total:De}}function ht(pe,Ae,ve,Ie){if(!(Ae>0)||!(Ie>0))return null;let De=0;const Ce=new Set(pe.keys());for(const Ve of ve.keys())Ce.add(Ve);for(const Ve of Ce){const _e=(pe.get(Ve)||0)/Ae,Ke=(ve.get(Ve)||0)/Ie;De+=Math.abs(_e-Ke)}return De/2}const Nt=10;function mt(pe,Ae,ve){if(ve&&ve.numeric){const _e=g(pe,Ae),{n:Ke,mean:qe}=p(_e),st=Ke>0?Rt({mean:ve.mean,sd:ve.sd},qe):null;return{measure:"standardizedMeanDifference",magnitude:st,distance:st===null?0:ot(st),direction:st===null?0:Math.sign(st),subsetN:Ke,populationN:ve.n||0,reliable:Ke>=Nt}}const{map:De,total:Ce}=lt(pe,Ae),Ve=ht(De,Ce,ve.map,ve.total);return{measure:"categoricalTotalVariation",magnitude:Ve,distance:Ve===null?0:Ve,direction:0,subsetN:Ce,populationN:ve.total||0,reliable:Ce>=Nt}}function be(pe,Ae){if(pe&&(pe.kind==="float64"||pe.kind==="int32"))return!0;const ve=G(pe);let Ie=0,De=0;for(let Ce=0;Ce<Ae.length&&Ie<200;Ce++){const Ve=ve(Ae[Ce]);if(Ve==null||Ve==="")continue;if(Ve instanceof Date)return!1;Ie++;const _e=typeof Ve=="number"?Ve:Number(Ve);Number.isFinite(_e)&&De++}return Ie===0?!1:De/Ie>=.9}function Me(pe,Ae){if(be(pe,Ae)){const De=g(pe,Ae),{n:Ce,mean:Ve,m2:_e}=p(De);return{numeric:!0,mean:Ve,sd:Ce>0?Math.sqrt(_e/Ce):0,n:Ce}}const{map:ve,total:Ie}=lt(pe,Ae);return{numeric:!1,map:ve,total:Ie}}}),He("packages/core/src/compute/total.js",function(e,D){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"aggregatesFor",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"aggregateAllowed",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return p}});const N=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/warn.js").warnOnce,L=D("packages/core/src/compute/handle.js"),Z=L.presenceReader,z=L.valueComparator,x=L.valueReader,Y=D("packages/core/src/compute/statistics.js"),$=Y.STAT_FNS,j=Y.STAT_LABELS;function k(w){return!!w&&(w.kind==="float64"||w.kind==="int32")}function y(w,v){const P=v.length;let V=0;if(k(w)){const K=w.values,R=Z(w);if(!R){for(let S=0;S<P;S++){const E=K[v[S]];Number.isNaN(E)||(V+=E)}return V}for(let S=0;S<P;S++){const E=v[S];if(R(E)===1){const O=K[E];Number.isNaN(O)||(V+=O)}}return V}const W=x(w);for(let K=0;K<P;K++){const R=g(W(v[K]));R!==null&&(V+=R)}return V}y.kernel=!0;function c(w,v){const P=v.length;let V=0;if(k(w)){const K=w.values,R=Z(w);if(!R){for(let S=0;S<P;S++)Number.isNaN(K[v[S]])||V++;return V}for(let S=0;S<P;S++){const E=v[S];R(E)===1&&!Number.isNaN(K[E])&&V++}return V}const W=x(w);for(let K=0;K<P;K++){const R=W(v[K]);R!=null&&!(typeof R=="number"&&Number.isNaN(R))&&V++}return V}c.kernel=!0;function m(w,v){return v.length}m.kernel=!0;function s(w,v){const P=c(w,v);return P===0?null:y(w,v)/P}s.kernel=!0;function t(w,v,P,V){const W=v.length;if(k(w)){const E=w.values,O=Z(w);let M=null;if(!O){for(let T=0;T<W;T++){const A=E[v[T]];Number.isNaN(A)||(M===null||(P<0?A<M:A>M))&&(M=A)}return M}for(let T=0;T<W;T++){const A=v[T];if(O(A)===0)continue;const I=E[A];Number.isNaN(I)||(M===null||(P<0?I<M:I>M))&&(M=I)}return M}const K=x(w),R=z(V);let S=null;for(let E=0;E<W;E++){const O=K(v[E]);O==null||typeof O=="number"&&Number.isNaN(O)||(S===null||(P<0?R(O,S)<0:R(O,S)>0))&&(S=O)}return S}function o(w,v,P){return t(w,v,-1,P&&P.locale)}o.kernel=!0;function u(w,v,P){return t(w,v,1,P&&P.locale)}u.kernel=!0;function d(w,v){return v.length===0?null:x(w)(v[0])}d.kernel=!0;function i(w,v){return v.length===0?null:x(w)(v[v.length-1])}i.kernel=!0;function g(w){if(typeof w=="number")return Number.isNaN(w)?null:w;if(w==null||w===""||typeof w=="boolean")return null;if(w instanceof Date)return w.getTime();const v=Number(w);return Number.isNaN(v)?null:v}const r={sum:y,min:o,max:u,avg:s,count:m,first:d,last:i,countValues:c,...$},n=Object.freeze({...j,sum:"Sum",avg:"Average",min:"Min",max:"Max",count:"Count",countValues:"Count of values",first:"First",last:"Last"});function f(w){return w?typeof w=="string"?n[w]||w:"Total":""}const h=Object.freeze(["sum","avg","min","max","count","countValues","first","last"]);function l(w){const v=w&&w.dataType&&w.dataType.totals&&w.dataType.totals.supported;if(Array.isArray(v))return v.slice();const P=h.filter(V=>V in r);for(const V of Object.keys(r))P.includes(V)||P.push(V);return P}function b(w,v){return typeof v!="string"?!0:l(w).includes(v)}function a(w,v){const P=x(w),V=[];for(let W=0;W<v.length;W++){const K=P(v[W]);K!=null&&V.push(K)}return V}function p(w,v,P,V){const W=v||[];if(P&&typeof P=="object"&&typeof P.fn=="string"){const{fn:K,...R}=P,S=r[K];return S?S(w,W,{...V,...R}):(F(`total:${K}`,`unknown total function "${K}"; register it in config.totalFns`),null)}if(typeof P=="string"){const K=r[P];return K?K(w,W,V):(F(`total:${P}`,`unknown total function "${P}"; register it in config.totalFns`),null)}return N(P)?P.kernel===!0?P(w,W,V):P(a(w,W),V||{}):null}}),He("packages/core/src/compute/windowed.js",function(e,D){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const N=D("packages/core/src/compute/sketch.js").Welford;class G{#e;#t;#n=[];#r;#i;constructor(x,Y=0,$=Date.now){if(x!=="count"&&x!=="time"&&x!=="session")throw new RangeError(`unknown window kind: ${x}`);if((x==="count"||x==="time")&&!(Y>0))throw new RangeError(`a ${x} window needs a positive span`);this.#e=x,this.#t=Math.floor(Y),this.#r=$,this.#i=$()}get size(){return this.#n.length}push(x,Y=this.#r()){Number.isFinite(x)&&(this.#n.push({t:Y,v:x}),this.#s(Y))}#s(x){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const Y=x-this.#t;for(;this.#n.length&&this.#n[0].t<Y;)this.#n.shift()}}spec(){const x=this.#e==="session"?this.#r()-this.#i:this.#t;return{kind:this.#e,span:x,size:this.#n.length}}values(){return this.#n.map(x=>x.v)}aggregate(){const x=this.spec();if(!this.#n.length)return{over:x,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const Y=new N;let $=0,j=1/0,k=-1/0;for(const{v:y}of this.#n)$+=y,y<j&&(j=y),y>k&&(k=y),Y.add(y);return{over:x,count:this.#n.length,sum:$,mean:Y.mean(),min:j,max:k,variance:Y.variance(),stddev:Y.stddev()}}reduce(x){const Y=this.aggregate(),$={sum:Y.sum,avg:Y.mean,mean:Y.mean,min:Y.min,max:Y.max,count:Y.count,variance:Y.variance,stddev:Y.stddev};if(!(x in $))throw new RangeError(`unknown windowed aggregate: ${x}`);return{value:$[x],over:Y.over}}}const F=Object.freeze(["count","time","session"]);function L(z,x=Date.now){const Y=z.kind==="time"&&z.minutes!=null?z.minutes*6e4:z.span??0;return new G(z.kind,Y,x)}const Z={Window:G,WINDOW_KINDS:F,openWindow:L}}),He("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 z}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"rollingQuantile",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"seasonalDecompose",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"exponentialSmoothing",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return g}});const N=D("packages/core/src/compute/windowed.js").openWindow,F=D("packages/core/src/compute/sketch.js").KLL,L=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function Z(r,n,f,h){if(r.kind==="count"){const l=Math.max(1,Math.floor(r.span||0));return{coverage:Math.min(1,n/l),partial:n<l}}if(r.kind==="time"){const l=r.minutes!=null?r.minutes*6e4:r.span||0;if(!(l>0))return{coverage:1,partial:!1};const b=f-h;return{coverage:Math.min(1,b/l),partial:b<l}}return{coverage:null,partial:!1}}function z(r,n){const f=N(n),h=new Map,l=r.length?r[0].at:0;for(let b=0;b<r.length;b++){const{key:a,at:p,value:w}=r[b];Number.isFinite(w)&&f.push(w,p);const v=f.aggregate(),P=Z(n,v.count,p,l);a!=null&&h.set(String(a),{sum:v.sum,avg:v.mean,min:v.min,max:v.max,count:v.count,coverage:P.coverage,partial:P.partial})}return h}function x(r){const n=new Map;let f=0;for(const{key:h,value:l}of r)Number.isFinite(l)&&(f+=l),h!=null&&n.set(String(h),f);return n}function Y(r,n=1){const f=new Map,h=Math.max(1,Math.floor(n));for(let l=0;l<r.length;l++){const{key:b,value:a}=r[l];if(b==null)continue;const p=l>=h?r[l-h].value:null,w=Number.isFinite(a)?a:null,v=Number.isFinite(p)?p:null;f.set(String(b),w!==null&&v!==null?w-v:null)}return f}const $=4096;function j(r){let n=r>>>0;return()=>{n+=1831565813;let f=n;return f=Math.imul(f^f>>>15,f|1),f^=f+Math.imul(f^f>>>7,f|61),((f^f>>>14)>>>0)/4294967296}}function k(r,n){const f=r.length;if(f===1)return r[0];const h=(f-1)*n,l=Math.floor(h),b=Math.ceil(h);return l===b?r[l]:r[l]+(h-l)*(r[b]-r[l])}function y(r,n,f={}){const h=Math.min(1,Math.max(0,f.q==null?.5:f.q)),l=Math.max(1,Math.floor(f.cap==null?$:f.cap)),b=j(f.seed==null?2654435769:f.seed),a=new Map,p=r.length?r[0].at:0;if(n.kind==="session"){const v=new F(200,b);let P=0;for(const{key:V,value:W}of r)Number.isFinite(W)&&(v.add(W),P++),V!=null&&a.set(String(V),{value:P?v.quantile(h):null,approx:P>0,count:P,coverage:null,partial:!1});return a}const w=N(n);for(const{key:v,at:P,value:V}of r){Number.isFinite(V)&&w.push(V,P);const W=w.values(),K=W.length;let R=null,S=!1;if(K)if(K<=l)R=k([...W].sort((O,M)=>O-M),h);else{const O=new F(200,b);for(const M of W)O.add(M);R=O.quantile(h),S=!0}const E=Z(n,K,P,p);v!=null&&a.set(String(v),{value:R,approx:S,count:K,coverage:E.coverage,partial:E.partial})}return a}function c(r,n){const f=r.length,h=new Array(f).fill(null),l=Math.floor(n/2),b=n%2===0;for(let a=0;a<f;a++){if(a-l<0||a+l>=f)continue;let p=0,w=!0;if(b)for(let v=-l;v<=l;v++){const P=r[a+v];if(!Number.isFinite(P)){w=!1;break}p+=v===-l||v===l?P*.5:P}else for(let v=-l;v<=l;v++){const P=r[a+v];if(!Number.isFinite(P)){w=!1;break}p+=P}w&&(h[a]=p/n)}return h}function m(r,n){const f=new Map,h=Math.floor(Number(n&&n.period));if(!(h>=2))return f;const l=n&&n.model==="multiplicative",b=r.length,a=r.map(S=>Number.isFinite(S.value)?S.value:null),p=c(a,h),w=new Array(b).fill(null);for(let S=0;S<b;S++){const E=p[S],O=a[S];E===null||O===null||(l?E!==0&&(w[S]=O/E):w[S]=O-E)}const v=new Array(h).fill(0),P=new Array(h).fill(0);for(let S=0;S<b;S++){if(w[S]===null)continue;const E=S%h;v[E]+=w[S],P[E]+=1}const V=l?1:0,W=v.map((S,E)=>P[E]?S/P[E]:V),K=W.reduce((S,E)=>S+E,0)/h,R=l?W.map(S=>K!==0?S/K:1):W.map(S=>S-K);for(let S=0;S<b;S++){const{key:E}=r[S];if(E==null)continue;const O=p[S],M=R[S%h],T=a[S];let A=null;O!==null&&T!==null&&(A=l?O*M!==0?T/(O*M):null:T-O-M),f.set(String(E),{trend:O,seasonal:T===null?null:M,residual:A,coverage:O===null?0:1,partial:O===null})}return f}function s(r,n,f,h=80){const l=(Math.sqrt(5)-1)/2;let b=n,a=f,p=a-l*(a-b),w=b+l*(a-b),v=r(p),P=r(w);for(let V=0;V<h;V++)v<P?(a=w,w=p,P=v,p=a-l*(a-b),v=r(p)):(b=p,p=w,v=P,w=b+l*(a-b),P=r(w));return(b+a)/2}const t=1e-4,o=1-1e-4;function u(r,n){const f=r.length,h=new Array(f).fill(null),l=new Array(f).fill(null);let b=null,a=0;for(let p=0;p<f;p++){const w=r[p];if(!Number.isFinite(w)){b!==null&&(l[p]=b,h[p]=b);continue}if(b===null){b=w,l[p]=w,h[p]=w;continue}l[p]=b,a+=(w-b)**2,b=n*w+(1-n)*b,h[p]=b}return{smoothed:h,fitted:l,sse:a}}function d(r,n,f){const h=r.length,l=new Array(h).fill(null),b=new Array(h).fill(null);let a=null,p=null,w=0;for(let v=0;v<h;v++){const P=r[v];if(!Number.isFinite(P)){a!==null&&(a+=p,l[v]=a);continue}if(a===null){a=P,l[v]=P;continue}if(p===null){p=P-a;const K=a+p;b[v]=K,w+=(P-K)**2;const R=a;a=n*P+(1-n)*(R+p),p=f*(a-R)+(1-f)*p,l[v]=a;continue}const V=a+p;b[v]=V,w+=(P-V)**2;const W=a;a=n*P+(1-n)*(W+p),p=f*(a-W)+(1-f)*p,l[v]=a}return{smoothed:l,fitted:b,sse:w}}function i(r,n={}){const f=new Map,h=n.method==="holt",l=r.map(V=>Number.isFinite(V.value)?V.value:null),b=l.filter(V=>V!==null).length,a=V=>Math.min(o,Math.max(t,V)),p=()=>{for(const{key:V}of r)V!=null&&f.set(String(V),{smoothed:null,fitted:null,alpha:null,beta:null,sse:null});return f};if(b<(h?2:1))return p();let w=Number.isFinite(n.alpha)?a(n.alpha):null,v=h&&Number.isFinite(n.beta)?a(n.beta):null;if(h){if(w===null||v===null){let V=w===null?.5:w,W=v===null?.5:v;for(let K=0;K<6;K++)w===null&&(V=s(R=>d(l,R,W).sse,t,o)),v===null&&(W=s(R=>d(l,V,R).sse,t,o));w=w===null?V:w,v=v===null?W:v}}else w===null&&(w=s(V=>u(l,V).sse,t,o));const P=h?d(l,w,v):u(l,w);for(let V=0;V<r.length;V++){const{key:W}=r[V];W!=null&&f.set(String(W),{smoothed:P.smoothed[V],fitted:P.fitted[V],alpha:w,beta:h?v:null,sse:P.sse})}return f}const g={ROLLING_WINDOW_FIELDS:L,QUANTILE_SPAN_CAP:$,rollingWindow:z,rollingQuantile:y,cumulativeToDate:x,periodOverPeriod:Y,seasonalDecompose:m,exponentialSmoothing:i}}),He("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 N}}),Object.defineProperty(e,"DEFAULT_K",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"DEFAULT_MIN_POINTS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"orderByCentre",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"kmeans",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"dbscan",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"autoK",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"standardise",{enumerable:!0,get:function(){return t}});const re=1e5,N=2e4,G=3,F=5,L=100;function Z(o){let u=o>>>0;return function(){u=u+1831565813|0;let i=Math.imul(u^u>>>15,1|u);return i=i+Math.imul(i^i>>>7,61|i)^i,((i^i>>>14)>>>0)/4294967296}}function z(o,u){let d=0;for(let i=0;i<o.length;i++){const g=o[i]-u[i];d+=g*g}return d}function x(o,u){return Math.sqrt(z(o,u))}function Y(o,u){let d=-1,i=1/0;for(let g=0;g<u.length;g++){const r=z(o,u[g]);r<i&&(i=r,d=g)}return d}function $(o,u,d){const i=Z(d),g=o.length,r=[Array.from(o[Math.floor(i()*g)])],n=new Float64Array(g).fill(1/0);for(let f=1;f<u;f++){let h=0;for(let p=0;p<g;p++){const w=z(o[p],r[r.length-1]);w<n[p]&&(n[p]=w),h+=n[p]}const l=i()*(h||g);let b=0,a=g-1;for(let p=0;p<g;p++)if(b+=h?n[p]:1,b>=l){a=p;break}r.push(Array.from(o[a]))}return r}function j(o,u){for(let d=0;d<o.length;d++){const i=o[d]-u[d];if(i!==0)return i}return 0}function k(o,u,d,i){const g=u.map((n,f)=>({centre:n,i:f})).sort((n,f)=>j(n.centre,f.centre)),r=new Int32Array(u.length);for(let n=0;n<g.length;n++)r[g[n].i]=n;for(let n=0;n<o.length;n++)o[n]>=0&&(o[n]=r[o[n]]);return{assignments:o,centres:g.map(n=>n.centre),sizes:g.map(n=>d[n.i]),distances:i}}function y(o,u={}){const d=o.length,i=d?o[0].length:0,g=Math.floor(u.k||G);if(!(d>=g)||g<1||i<1)return null;let r=$(o,g,u.seed===void 0?1:u.seed);const n=new Int32Array(d);let f=!0;for(let a=0;a<L&&f;a++){f=!1;for(let v=0;v<d;v++){const P=Y(o[v],r);n[v]!==P&&(n[v]=P,f=!0)}const p=r.map(()=>new Float64Array(i)),w=new Array(g).fill(0);for(let v=0;v<d;v++){const P=n[v];for(let V=0;V<i;V++)p[P][V]+=o[v][V];w[P]++}for(let v=0;v<g;v++)if(w[v])for(let P=0;P<i;P++)r[v][P]=p[v][P]/w[v];else{let P=0,V=-1/0;for(let W=0;W<d;W++){const K=z(o[W],r[v]);K>V&&(V=K,P=W)}r[v]=Array.from(o[P]),f=!0}}const h=new Array(g).fill(0),l=new Float64Array(d);let b=0;for(let a=0;a<d;a++){const p=n[a];h[p]++;const w=z(o[a],r[p]);l[a]=Math.sqrt(w),b+=w}return{assignments:n,centres:r,sizes:h,inertia:b,distances:l}}function c(o,u={}){const d=o.length,i=d?o[0].length:0,g=Number(u.eps),r=Math.max(1,Math.floor(u.minPoints||F));if(!(g>0)||d===0||i<1)return null;const n=new Array(d);for(let w=0;w<d;w++){const v=[];for(let P=0;P<d;P++)w!==P&&x(o[w],o[P])<=g&&v.push(P);n[w]=v}const f=new Int32Array(d).fill(-1);let h=0;for(let w=0;w<d;w++){if(f[w]!==-1||n[w].length<r)continue;f[w]=h;const v=[...n[w]];for(let P=0;P<v.length;P++){const V=v[P];f[V]===-1&&(f[V]=h,n[V].length>=r&&v.push(...n[V]))}h++}if(!h)return{assignments:f,centres:[],sizes:[],distances:new Float64Array(d).fill(NaN)};const l=[],b=new Array(h).fill(0),a=Array.from({length:h},()=>new Float64Array(i));for(let w=0;w<d;w++){const v=f[w];if(!(v<0)){b[v]++;for(let P=0;P<i;P++)a[v][P]+=o[w][P]}}for(let w=0;w<h;w++){const v=new Array(i);for(let P=0;P<i;P++)v[P]=a[w][P]/b[w];l.push(v)}const p=new Float64Array(d).fill(NaN);for(let w=0;w<d;w++){const v=f[w];v>=0&&(p[w]=x(o[w],l[v]))}return{assignments:f,centres:l,sizes:b,distances:p}}function m(o,u,d){const i=o.length;if(i===0)return 0;const g=new Int32Array(d);for(let n=0;n<i;n++)g[u[n]]++;let r=0;for(let n=0;n<i;n++){const f=u[n],h=new Float64Array(d);for(let a=0;a<i;a++)n!==a&&(h[u[a]]+=x(o[n],o[a]));const l=g[f]>1?h[f]/(g[f]-1):0;let b=1/0;for(let a=0;a<d;a++){if(a===f||g[a]===0)continue;const p=h[a]/g[a];p<b&&(b=p)}b!==1/0&&(r+=(b-l)/Math.max(l,b))}return r/i}function s(o,u={}){const d=o.length;if(!d)return null;const i=u.criterion==="silhouette"?"silhouette":"elbow",g=Math.max(2,Math.floor(u.maxK||8)),r=u.seed===void 0?1:u.seed;if(i==="silhouette"){const w=[],v=[];for(let V=2;V<=Math.min(g,d);V++){const W=y(o,{k:V,seed:r});W&&(w.push(V),v.push(m(o,W.assignments,V)))}if(!w.length)return null;let P=0;for(let V=1;V<v.length;V++)v[V]>v[P]&&(P=V);return{k:w[P],criterion:i,scores:v,ks:w}}const n=[],f=[];for(let w=1;w<=Math.min(g,d);w++){const v=y(o,{k:w,seed:r});v&&(n.push(w),f.push(v.inertia))}if(f.length<2)return null;const h={k:n[0],y:f[0]},l={k:n[n.length-1],y:f[f.length-1]},b=Math.hypot(l.k-h.k,l.y-h.y)||1;let a=0,p=-1/0;for(let w=0;w<f.length;w++){const v=Math.abs((l.k-h.k)*(h.y-f[w])-(h.k-n[w])*(l.y-h.y))/b;v>p&&(p=v,a=w)}return{k:n[a],criterion:i,scores:f,ks:n}}function t(o){const u=o.length,d=u?o[0].length:0;if(!u||!d)return null;const i=new Array(d).fill(0);for(let r=0;r<u;r++)for(let n=0;n<d;n++)i[n]+=o[r][n];for(let r=0;r<d;r++)i[r]/=u;const g=new Array(d).fill(0);for(let r=0;r<u;r++)for(let n=0;n<d;n++){const f=o[r][n]-i[n];g[n]+=f*f}for(let r=0;r<d;r++)g[r]=u>1?Math.sqrt(g[r]/(u-1)):0;for(let r=0;r<u;r++)for(let n=0;n<d;n++)g[n]>0?o[r][n]=(o[r][n]-i[n])/g[n]:o[r][n]=o[r][n]-i[n];return{mean:i,sd:g}}}),He("packages/core/src/compute/compare.js",function(e,D){"use strict";Object.defineProperty(e,"COMPARE_MEASURES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"pooledStandardMeanDifference",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"numericSummary",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"bothNumeric",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"compareColumnAcross",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"compareDatasets",{enumerable:!0,get:function(){return c}});const re=D("packages/core/src/compute/statistics.js"),N=re.numbers,G=re.moments,F=re.frequencyMap,L=re.categoricalDistance,Z=re.normalTotalVariation,z=re.isNumericColumn,x=re.SUBSET_RELIABILITY_FLOOR,Y=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function $(m,s){if(!m||!s||!(m.n>0)||!(s.n>0)||!Number.isFinite(m.mean)||!Number.isFinite(s.mean))return null;const t=(m.n*m.sd*m.sd+s.n*s.sd*s.sd)/(m.n+s.n);return t>0?(m.mean-s.mean)/Math.sqrt(t):null}function j(m,s){const t=N(m,s),{n:o,mean:u,m2:d}=G(t),i=o>0?Math.sqrt(d/o):0;return{mean:u,sd:i,n:o}}function k(m,s,t,o){return z(m,s)&&z(t,o)}function y(m,s,t,o){if(k(m,s,t,o)){const g=j(m,s),r=j(t,o),n=$(g,r);return{measure:Y.numeric,magnitude:n,distance:n===null?0:Z(n),direction:n===null?0:Math.sign(n),nA:g.n,nB:r.n,meanA:g.mean,meanB:r.mean,reliable:g.n>=x&&r.n>=x}}const u=F(m,s),d=F(t,o),i=L(u.map,u.total,d.map,d.total);return{measure:Y.categorical,magnitude:i,distance:i===null?0:i,direction:0,nA:u.total,nB:d.total,meanA:null,meanB:null,reliable:u.total>=x&&d.total>=x}}function c(m,s,t={}){const o=new Set(m.columns),u=new Set(s.columns),d=m.columns.filter(f=>u.has(f)),i=Array.isArray(t.columns)&&t.columns.length?d.filter(f=>t.columns.includes(f)):d,g=m.indices(),r=s.indices(),n=[];for(const f of i){const h=m.handle(f),l=s.handle(f);if(!h||!l)continue;const b=y(h,g,l,r);n.push({column:f,name:m.name&&m.name(f)||s.name&&s.name(f)||f,measure:b.measure,magnitude:b.magnitude,distance:b.distance,direction:b.direction,nA:b.nA,nB:b.nB,meanA:b.meanA,meanB:b.meanB,reliable:b.reliable})}return n.sort((f,h)=>h.distance-f.distance||Math.abs(h.magnitude||0)-Math.abs(f.magnitude||0)),{ranked:n,nA:g.length,nB:r.length,unmatched:{onlyA:m.columns.filter(f=>!u.has(f)),onlyB:s.columns.filter(f=>!o.has(f))},measures:Y}}}),He("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 Z}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return g}});const N=D("packages/core/src/compute/statistics.js").quantileSorted,F=D("packages/core/src/compute/special.js").logGamma,L=.6745,Z=3.5,z=1.5,x=.975,Y=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function $(r){if(!r.length)return null;const f=Array.from(r,Number).sort((a,p)=>a-p),h=N(f,.5),l=f.map(a=>Math.abs(a-h)).sort((a,p)=>a-p),b=N(l,.5);return{median:h,mad:b}}function j(r,n={}){const f=Number.isFinite(n.threshold)?n.threshold:Z,h=r.length,l=new Array(h).fill(null),b=new Array(h).fill(!1),a=[];for(let v=0;v<h;v++){const P=Number(r[v]);Number.isFinite(P)&&a.push(P)}if(!a.length)return{median:null,mad:null,threshold:f,scores:l,flags:b,flagged:0};const p=$(a);if(p.mad===0)return{median:p.median,mad:0,threshold:f,scores:l,flags:b,flagged:0};let w=0;for(let v=0;v<h;v++){const P=Number(r[v]);if(!Number.isFinite(P))continue;const V=L*(P-p.median)/p.mad;l[v]=V,Math.abs(V)>f&&(b[v]=!0,w++)}return{median:p.median,mad:p.mad,threshold:f,scores:l,flags:b,flagged:w}}function k(r,n={}){const f=Number.isFinite(n.k)?n.k:z,h=[];for(let w=0;w<r.length;w++){const v=Number(r[w]);Number.isFinite(v)&&h.push(v)}if(!h.length)return null;const l=h.sort((w,v)=>w-v),b=N(l,.25),a=N(l,.75),p=a-b;return{q1:b,q3:a,iqr:p,lower:b-f*p,upper:a+f*p,k:f}}function y(r,n){if(n<=0)return 0;const f=F(r);if(n<r+1){let v=r,P=1/r,V=P;for(let W=0;W<1e3&&(v+=1,V*=n/v,P+=V,!(Math.abs(V)<Math.abs(P)*1e-15));W++);return P*Math.exp(-n+r*Math.log(n)-f)}const h=1e-300;let l=n+1-r,b=1/h,a=1/l,p=a;for(let v=1;v<1e3;v++){const P=-v*(v-r);l+=2,a=P*a+l,Math.abs(a)<h&&(a=h),b=l+P/b,Math.abs(b)<h&&(b=h),a=1/a;const V=a*b;if(p*=V,Math.abs(V-1)<1e-15)break}return 1-Math.exp(-n+r*Math.log(n)-f)*p}function c(r,n){return r<=0?0:y(n/2,r/2)}function m(r,n=x){if(!(n>0)||!(n<1))return NaN;let f=0,h=Math.max(1,r);for(;c(h,r)<n;)h*=2;for(let l=0;l<200;l++){const b=(f+h)/2;if(c(b,r)<n?f=b:h=b,h-f<1e-10)break}return(f+h)/2}function s(r){const n=r.length,f=r.map((h,l)=>{const b=h.slice();for(let a=0;a<n;a++)b.push(l===a?1:0);return b});for(let h=0;h<n;h++){let l=h;for(let a=h+1;a<n;a++)Math.abs(f[a][h])>Math.abs(f[l][h])&&(l=a);if(Math.abs(f[l][h])<1e-12)return null;if(l!==h){const a=f[l];f[l]=f[h],f[h]=a}const b=f[h][h];for(let a=0;a<2*n;a++)f[h][a]/=b;for(let a=0;a<n;a++){if(a===h)continue;const p=f[a][h];if(p!==0)for(let w=0;w<2*n;w++)f[a][w]-=p*f[h][w]}}return f.map(h=>h.slice(n))}function t(r,n){const f=r.length,h=new Array(n).fill(0);for(const a of r)for(let p=0;p<n;p++)h[p]+=a[p];for(let a=0;a<n;a++)h[a]/=f;const l=Array.from({length:n},()=>new Array(n).fill(0));for(const a of r)for(let p=0;p<n;p++){const w=a[p]-h[p];for(let v=p;v<n;v++)l[p][v]+=w*(a[v]-h[v])}const b=f>1?f-1:1;for(let a=0;a<n;a++)for(let p=a;p<n;p++)l[a][p]/=b,l[p][a]=l[a][p];return{mean:h,cov:l}}function o(r,n={}){const f=Number.isFinite(n.p)?n.p:x,h=Number.isFinite(n.ridge)?n.ridge:1e-6,l=r.length;if(!l)return null;const b=r[0].length;if(!b)return null;const a=new Array(l).fill(null),p=new Array(l).fill(null),w=new Array(l).fill(!1),v=[],P=[];for(let M=0;M<l;M++){const T=r[M];let A=T.length===b;const I=new Array(b);for(let U=0;A&&U<b;U++){const X=Number(T[U]);Number.isFinite(X)?I[U]=X:A=!1}A&&(v.push(M),P.push(I))}const V=b,W=m(V,f);if(P.length<=b)return{center:[],df:V,cutoff:W,singular:!0,used:P.length,distances:a,squared:p,flags:w,flagged:0};const{mean:K,cov:R}=t(P,b);let S=s(R),E=!1;if(!S){E=!0;let M=0;for(let I=0;I<b;I++)M+=R[I][I];const T=M/b*h||h,A=R.map((I,U)=>I.map((X,q)=>U===q?X+T:X));if(S=s(A),!S)return{center:K,df:V,cutoff:W,singular:!0,used:P.length,distances:a,squared:p,flags:w,flagged:0}}let O=0;for(let M=0;M<P.length;M++){const T=P[M],A=new Array(b);for(let X=0;X<b;X++)A[X]=T[X]-K[X];let I=0;for(let X=0;X<b;X++){let q=0;for(let _=0;_<b;_++)q+=S[X][_]*A[_];I+=A[X]*q}I<0&&(I=0);const U=v[M];p[U]=I,a[U]=Math.sqrt(I),I>W&&(w[U]=!0,O++)}return{center:K,df:V,cutoff:W,singular:E,used:P.length,distances:a,squared:p,flags:w,flagged:O}}const u=20,d=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function i(r,n={}){const f=n.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",h=Number.isFinite(n.windowLen)&&n.windowLen>=1?Math.floor(n.windowLen):u,l=Number.isFinite(n.threshold)?n.threshold:Z,b=Number.isFinite(n.k)?n.k:z,a=Number.isFinite(n.minPeriods)&&n.minPeriods>=1?Math.floor(n.minPeriods):h,p=r.length,w=new Array(p).fill(null),v=new Array(p).fill(!1);let P=0;for(let V=0;V<p;V++){const W=Number(r[V]);if(!Number.isFinite(W))continue;const K=Math.max(0,V-h+1),R=[];for(let S=K;S<=V;S++){const E=Number(r[S]);Number.isFinite(E)&&R.push(E)}if(!(R.length<a))if(f==="rollingIqr"){const S=k(R,{k:b});if(!S)continue;(W<S.lower||W>S.upper)&&(v[V]=!0,P++)}else{const S=$(R);if(!S||S.mad===0)continue;const E=L*(W-S.median)/S.mad;w[V]=E,Math.abs(E)>l&&(v[V]=!0,P++)}}return{method:f,windowLen:h,minPeriods:a,threshold:l,k:b,scores:w,flags:v,flagged:P}}function g(r={}){const n=r||{},f=n.field;if(typeof f!="string"||!f)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const h=n.method||"modifiedZScore";if(!(Y.includes(h)||d.includes(h))||h==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${h}'`);const b=typeof n.orderBy=="string"?n.orderBy:null,a=n.latest===!0,p=d.includes(h),w=v=>Number(v==null?NaN:v[f]);return v=>{const P=Array.isArray(v)?v.slice():[...v];b&&P.sort((S,E)=>{const O=S?.[b],M=E?.[b];return O===M?0:O==null?-1:M==null?1:O<M?-1:1});const V=P.map(w);let W,K;if(p)({flags:W,scores:K}=i(V,{method:h,windowLen:n.windowLen,threshold:n.threshold,k:n.k,minPeriods:n.minPeriods}));else if(h==="iqr"){const S=k(V,{k:n.k});W=V.map(E=>S?Number.isFinite(E)&&(E<S.lower||E>S.upper):!1),K=V.map(()=>null)}else({flags:W,scores:K}=j(V,{threshold:n.threshold}));if(a){const S=W.length-1;return S<0||!W[S]?!1:{method:h,field:f,flagged:[{row:P[S],score:K[S]}]}}const R=[];for(let S=0;S<W.length;S++)W[S]&&R.push({row:P[S],score:K[S]});return R.length?{method:h,field:f,flagged:R}:!1}}}),He("packages/core/src/compute/forecast.js",function(e,D){"use strict";Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r}});const re=D("packages/core/src/compute/special.js"),N=re.normalQuantile,G=re.studentTQuantile,L=D("packages/core/src/internal/warn.js").warnOnce,Z=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),z=1e-4,x=1-1e-4;function Y(n){const f=[];for(let h=0;h<n.length;h++){const l=n[h];if(l!==null&&typeof l=="object"){const b=Number.isFinite(l.at)?l.at:h,a=Number.isFinite(l.value)?l.value:null;f.push({at:b,value:a})}else f.push({at:h,value:Number.isFinite(l)?Number(l):null})}return f}function $(n){const f=n.filter(p=>p.value!==null),h=f[0],l=f[f.length-1],b=l.at-h.at,a=f.length>1&&b>0?b/(f.length-1):1;return{lastAt:l.at,step:a}}function j(n){return Math.min(x,Math.max(z,n))}function k(n,f=z,h=x,l=80){const b=(Math.sqrt(5)-1)/2;let a=f,p=h,w=p-b*(p-a),v=a+b*(p-a),P=n(w),V=n(v);for(let W=0;W<l;W++)P<V?(p=v,v=w,V=P,w=p-b*(p-a),P=n(w)):(a=w,w=v,P=V,v=a+b*(p-a),V=n(v));return(a+p)/2}function y(n,f){let h=null,l=0,b=0;for(let a=0;a<n.length;a++){const p=n[a];if(p!==null){if(h===null){h=p;continue}l+=(p-h)**2,b+=1,h=f*p+(1-f)*h}}return{level:h,sse:l,m:b}}function c(n,f,h){let l=null,b=null,a=0,p=0;for(let w=0;w<n.length;w++){const v=n[w];if(v===null){l!==null&&b!==null&&(l+=b);continue}if(l===null){l=v;continue}b===null&&(b=v-l);const P=l+b;a+=(v-P)**2,p+=1;const V=l;l=f*v+(1-f)*(V+b),b=h*(l-V)+(1-h)*b}return{level:l,trend:b,sse:a,m:p}}function m(n,f,h,l,b){const a=n.length;if(a<2*f)return null;const p=E=>{let O=0,M=0;for(let T=E;T<E+f&&T<a;T++)n[T]!==null&&(O+=n[T],M+=1);return M?O/M:null},w=p(0),v=p(f);if(w===null||v===null)return null;let P=w,V=(v-w)/f;const W=new Array(f).fill(0);for(let E=0;E<f;E++)W[E]=n[E]===null?0:n[E]-P;const K=W.reduce((E,O)=>E+O,0)/f;for(let E=0;E<f;E++)W[E]-=K;let R=0,S=0;for(let E=f;E<a;E++){const O=E%f,M=W[O],T=n[E];if(T===null){P+=V;continue}const A=P+V+M;R+=(T-A)**2,S+=1;const I=P;P=h*(T-M)+(1-h)*(P+V),V=l*(P-I)+(1-l)*V,W[O]=b*(T-P)+(1-b)*M}return{level:P,trend:V,season:W,phase:(a-1)%f,sse:R,count:S}}function s(n,f,h){let l=1;for(const a of f)l+=a*a;const b=Math.sqrt(n*l);return{se:b,margin:h*b}}function t(n,f={}){if(!n||typeof n.length!="number"||n.length===0)return null;const h=Z.includes(f.method)?f.method:"linear",l=Math.max(1,Math.floor(Number(f.horizon)||1)),b=Number.isFinite(f.confidence)&&f.confidence>0&&f.confidence<1?f.confidence:.95,a=1-(1-b)/2,p=Y(n),w=p.map(R=>R.value),v=w.filter(R=>R!==null),P=v.length,{lastAt:V,step:W}=P?$(p):{lastAt:0,step:1},K=R=>V+R*W;return h==="linear"?o(p,P,l,b,a,K):h==="movingAverage"?u(v,P,l,b,a,f,K):h==="ses"?d(w,P,l,b,a,f,K):h==="holt"?i(w,P,l,b,a,f,K):g(w,P,l,b,a,f,K)}function o(n,f,h,l,b,a){if(f<2)return null;let p=0,w=0;for(const T of n)T.value!==null&&(p+=T.at,w+=T.value);p/=f,w/=f;let v=0,P=0,V=0;for(const T of n){if(T.value===null)continue;const A=T.at-p,I=T.value-w;v+=A*A,P+=A*I,V+=I*I}if(v===0)return null;const W=P/v,K=w-W*p,R=V===0?1:Math.max(0,Math.min(1,P*P/(v*V))),S=Math.max(0,V-W*P),E=f>2?Math.sqrt(S/(f-2)):null,O=f>2?G(b,f-2):null,M=[];for(let T=1;T<=h;T++){const A=a(T),I=K+W*A;let U=null,X=null,q=null,_=null,H=null;if(E!==null){const ee=1/f+(A-p)**2/v,te=E*Math.sqrt(1+ee),J=E*Math.sqrt(ee);H=te,U=I-O*te,X=I+O*te,q=I-O*J,_=I+O*J}M.push({step:T,at:A,mean:I,lower:U,upper:X,lowerMean:q,upperMean:_,se:H})}return{method:"linear",horizon:h,confidence:l,n:f,sigma:E,r2:R,params:{slope:W,intercept:K},points:M}}function u(n,f,h,l,b,a,p){if(f<1)return null;const w=Math.max(1,Math.min(f,Math.floor(Number(a.windowLen)||f))),v=n.slice(f-w);let P=0;for(const E of v)P+=E;const V=P/w;let W=null,K=null;if(w>1){let E=0;for(const M of v)E+=(M-V)**2;W=Math.sqrt(E/(w-1))*Math.sqrt(1+1/w),K=G(b,w-1)}const R=W===null?null:K*W,S=[];for(let E=1;E<=h;E++)S.push({step:E,at:p(E),mean:V,lower:R===null?null:V-R,upper:R===null?null:V+R,se:W});return{method:"movingAverage",horizon:h,confidence:l,n:f,sigma:W===null?null:W,params:{windowLen:w},points:S}}function d(n,f,h,l,b,a,p){if(f<1)return null;let w=Number.isFinite(a.alpha)?j(a.alpha):null;w===null&&(w=k(K=>y(n,K).sse));const v=y(n,w),P=N(b),V=v.m>0?v.sse/v.m:null,W=[];for(let K=1;K<=h;K++){const R=v.level;let S=null,E=null,O=null;if(V!==null){const M=[];for(let A=1;A<K;A++)M.push(w);const T=s(V,M,P);O=T.se,S=R-T.margin,E=R+T.margin}W.push({step:K,at:p(K),mean:R,lower:S,upper:E,se:O})}return{method:"ses",horizon:h,confidence:l,n:f,sigma:V===null?null:Math.sqrt(V),params:{alpha:w},points:W}}function i(n,f,h,l,b,a,p){if(f<2)return null;let w=Number.isFinite(a.alpha)?j(a.alpha):null,v=Number.isFinite(a.beta)?j(a.beta):null;if(w===null||v===null){let S=w===null?.5:w,E=v===null?.5:v;for(let O=0;O<6;O++)w===null&&(S=k(M=>c(n,M,E).sse)),v===null&&(E=k(M=>c(n,S,M).sse));w=w===null?S:w,v=v===null?E:v}const P=c(n,w,v),V=N(b),W=P.m>0?P.sse/P.m:null,K=w*v,R=[];for(let S=1;S<=h;S++){const E=P.level+S*P.trend;let O=null,M=null,T=null;if(W!==null){const A=[];for(let U=1;U<S;U++)A.push(w+U*K);const I=s(W,A,V);T=I.se,O=E-I.margin,M=E+I.margin}R.push({step:S,at:p(S),mean:E,lower:O,upper:M,se:T})}return{method:"holt",horizon:h,confidence:l,n:f,sigma:W===null?null:Math.sqrt(W),params:{alpha:w,beta:v},points:R}}function g(n,f,h,l,b,a,p){const w=Math.floor(Number(a.period));if(!(w>=2))return L("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(f<2*w)return null;let v=Number.isFinite(a.alpha)?j(a.alpha):null,P=Number.isFinite(a.beta)?j(a.beta):null,V=Number.isFinite(a.gamma)?j(a.gamma):null;const W=(T,A,I)=>{const U=m(n,w,T,A,I);return U?U.sse:1/0};if(v===null||P===null||V===null){let T=v===null?.5:v,A=P===null?.5:P,I=V===null?.5:V;for(let U=0;U<8;U++)v===null&&(T=k(X=>W(X,A,I))),P===null&&(A=k(X=>W(T,X,I))),V===null&&(I=k(X=>W(T,A,X)));v=v===null?T:v,P=P===null?A:P,V=V===null?I:V}const K=m(n,w,v,P,V);if(!K)return null;const R=N(b),S=K.count>0?K.sse/K.count:null,E=v*P,O=V*(1-v),M=[];for(let T=1;T<=h;T++){const A=K.season[(K.phase+T)%w],I=K.level+T*K.trend+A;let U=null,X=null,q=null;if(S!==null){const _=[];for(let ee=1;ee<T;ee++)_.push(v+ee*E+(ee%w===0?O:0));const H=s(S,_,R);q=H.se,U=I-H.margin,X=I+H.margin}M.push({step:T,at:p(T),mean:I,lower:U,upper:X,se:q})}return{method:"holtWinters",horizon:h,confidence:l,n:f,sigma:S===null?null:Math.sqrt(S),params:{alpha:v,beta:P,gamma:V,period:w},points:M}}const r={FORECAST_METHODS:Z,forecast:t}}),He("packages/core/src/compute/hypothesis.js",function(e,D){"use strict";Object.defineProperty(e,"GROUP_TESTS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"NORMALITY_ALPHA",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"HL_PAIR_LIMIT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"welchTTest",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"mannWhitneyUTest",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"chiSquareTest",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return R}});const N=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/compute/handle.js").valueReader,L=D("packages/core/src/compute/statistics.js"),Z=L.numbers,z=L.moments,x=L.frequencyMap,Y=L.categoricalDistance,$=L.isNumericColumn,j=L.jarqueBera,k=L.proportionInterval,y=L.SUBSET_RELIABILITY_FLOOR,m=D("packages/core/src/compute/compare.js").pooledStandardMeanDifference,s=D("packages/core/src/compute/special.js"),t=s.studentT,o=s.studentTQuantile,u=s.normalCdf,d=s.normalQuantile,i=s.chiSquareUpperTail,g=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),r=.05,n=2e6;function f(S){const E=Number(S);return Number.isFinite(E)&&E>0&&E<1?E:.95}function h(S){const{n:E,mean:O,m2:M}=z(S);return{mean:O,sd:E>0?Math.sqrt(M/E):0,n:E}}function l(S,E){const O=S.length;if(O<2)return 0;let M=0;for(let T=0;T<O;T++){const A=S[T]-E;M+=A*A}return M/(O-1)}function b(S,E){return{name:"pooledStandardMeanDifference",value:m(h(S),h(E))}}function a(S,E,O){const M=S.length,T=E.length;if(M<2||T<2)return null;const A=f(O),{mean:I}=z(S),{mean:U}=z(E),X=l(S,I),q=l(E,U),_=X/M+q/T;if(!(_>0))return null;const H=Math.sqrt(_),ee=(I-U)/H,te=X/M*(X/M)/(M-1),J=q/T*(q/T)/(T-1),ne=_*_/(te+J),se=Math.min(1,Math.max(0,2*(1-t(Math.abs(ee),ne)))),ae=I-U,we=o(1-(1-A)/2,ne)*H;return{test:g.WELCH,statistic:ee,statisticName:"t",df:ne,pValue:se,interval:{estimate:ae,lower:ae-we,upper:ae+we,confidence:A,method:"welch-t (difference of means)"},effectSize:b(S,E),nA:M,nB:T,reliable:M>=y&&T>=y,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function p(S){const E=S.length;if(E===0)return Number.NaN;const O=E>>1;return E%2?S[O]:(S[O-1]+S[O])/2}function w(S,E,O){const M=S.length,T=E.length,A=M*T;if(A===0||A>n)return null;const I=new Float64Array(A);let U=0;for(let te=0;te<M;te++)for(let J=0;J<T;J++)I[U++]=S[te]-E[J];I.sort();const X=p(I),q=Math.sqrt(M*T*(M+T+1)/12),_=d(1-(1-O)/2);let H=Math.round(A/2-_*q);H>=0||(H=0);const ee=Math.floor((A-1)/2);return H>ee&&(H=ee),{estimate:X,lower:I[H],upper:I[A-1-H],confidence:O,method:"hodges-lehmann (normal approximation)"}}function v(S,E,O){const M=S.length,T=E.length;if(M<1||T<1)return null;const A=f(O),I=M+T,U=new Array(I);for(let se=0;se<M;se++)U[se]={v:S[se],g:0};for(let se=0;se<T;se++)U[M+se]={v:E[se],g:1};U.sort((se,ae)=>se.v-ae.v);let X=0,q=0,_=0;for(;_<I;){let se=_;for(;se<I&&U[se].v===U[_].v;)se++;const ae=se-_,we=(_+1+se)/2;for(let fe=_;fe<se;fe++)U[fe].g===0&&(X+=we);q+=ae*ae*ae-ae,_=se}const H=X-M*(M+1)/2,ee=M*T/2,te=M*T/12*(I+1-q/(I*(I-1)));let J=1;if(te>0){const se=Math.max(0,Math.abs(H-ee)-.5);J=Math.min(1,2*u(-se/Math.sqrt(te)))}const ne=w(S,E,A);return{test:g.MANN_WHITNEY,statistic:H,statisticName:"U",df:null,pValue:J,interval:ne,effectSize:b(S,E),nA:M,nB:T,reliable:M>=y&&T>=y,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function P(S,E,O,M,T){const A=k(S,E,T),I=k(O,M,T);if(!A||!I)return null;const U=A.proportion-I.proportion,X=U-Math.sqrt((A.proportion-A.lower)**2+(I.upper-I.proportion)**2),q=U+Math.sqrt((A.upper-A.proportion)**2+(I.proportion-I.lower)**2);return{lower:X,upper:q}}function V(S,E,O,M,T,A={}){if(!(E>0)||!(M>0))return null;const I=new Set([...S.keys(),...O.keys()]),U=I.size;if(U<2)return null;const X=E+M;let q=0;for(const J of I){const ne=S.get(J)||0,se=O.get(J)||0,ae=ne+se,we=E*ae/X,fe=M*ae/X;we>0&&(q+=(ne-we)*(ne-we)/we),fe>0&&(q+=(se-fe)*(se-fe)/fe)}const _=U-1,H=i(q,_);let ee=null;A.category!==void 0&&I.has(A.category)?ee=A.category:U===2&&([ee]=[...I]);let te=null;if(ee!==null){const J=P(S.get(ee)||0,E,O.get(ee)||0,M,f(T));J&&(te={estimate:(S.get(ee)||0)/E-(O.get(ee)||0)/M,lower:J.lower,upper:J.upper,confidence:f(T),method:"newcombe (difference in this category's share)",category:ee})}return{test:g.CHI_SQUARE,statistic:q,statisticName:"chiSquare",df:_,pValue:H,interval:te,effectSize:{name:"categoricalTotalVariation",value:Y(S,E,O,M)},nA:E,nB:M,reliable:E>=y&&M>=y,method:"Pearson chi-square test of independence (2×k, no continuity correction)"}}function W(S){return S==null||S===""||typeof S=="number"&&Number.isNaN(S)?null:S instanceof Date?S.getTime():typeof S=="object"?String(S):S}function K(S,E,O){if(O===g.WELCH||O===g.MANN_WHITNEY)return{test:O,chosenBy:"override",reason:`caller override: ${O}`};const M=j(S),T=j(E),A=M===null?null:Math.exp(-M/2),I=T===null?null:Math.exp(-T/2);return A!==null&&A<r||I!==null&&I<r?{test:g.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${r})`}:{test:g.WELCH,chosenBy:"auto",reason:A!==null||I!==null?"column family: numeric, no departure from normality detected":"column family: numeric (too few rows to screen normality)"}}function R(S,E,O,M={}){if(!S||!E)return null;const T=f(M.confidence),A=F(E);let I;if(Array.isArray(M.groups)&&M.groups.length===2)I=[W(M.groups[0]),W(M.groups[1])];else{const{map:se}=x(E,O),ae=[...se.entries()].sort((we,fe)=>fe[1]-we[1]).slice(0,2).map(we=>we[0]);if(ae.length<2)return N("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;I=ae}const[U,X]=I;if(U===null||X===null||U===X)return N("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const q=[],_=[];for(let se=0;se<O.length;se++){const ae=W(A(O[se]));ae===U?q.push(O[se]):ae===X&&_.push(O[se])}if(q.length===0||_.length===0)return N("compareGroups:empty","[lattice] compareGroups: one of the two groups has no rows in the current set."),null;const H=M.test&&M.test!=="auto"?String(M.test):null,ee=$(S,q.concat(_));let te,J,ne;if(H===g.CHI_SQUARE||!H&&!ee){J=H?"override":"auto",ne=H?"caller override: chiSquare":"column family: categorical";const se=x(S,q),ae=x(S,_);te=V(se.map,se.total,ae.map,ae.total,T,{category:M.category})}else{if((H===g.WELCH||H===g.MANN_WHITNEY)&&!ee)return N("compareGroups:numeric-override",`[lattice] compareGroups: ${H} needs a numeric column, but the column is not numeric.`),null;const se=Z(S,q),ae=Z(S,_),we=K(se,ae,H);J=we.chosenBy,ne=we.reason,te=we.test===g.MANN_WHITNEY?v(se,ae,T):a(se,ae,T)}return te?{...te,chosenBy:J,reason:ne,groups:[U,X]}:(N("compareGroups:degenerate","[lattice] compareGroups: the chosen test had too little to work with (too few values, or no variation)."),null)}}),He("packages/core/src/compute/significance.js",function(e,D){"use strict";Object.defineProperty(e,"COMPARE_TESTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"compare",{enumerable:!0,get:function(){return ge}});const N=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/compute/handle.js").valueReader,L=D("packages/core/src/compute/statistics.js"),Z=L.numbers,z=L.moments,x=L.frequencyMap,Y=L.isNumericColumn,$=L.jarqueBera,j=L.proportionInterval,k=D("packages/core/src/compute/special.js"),y=k.studentT,c=k.studentTQuantile,m=k.normalCdf,s=k.normalQuantile,t=k.chiSquareUpperTail,o=k.incompleteBeta,u=Object.freeze({T:"t",WELCH:"welch",MANN_WHITNEY:"mannWhitney",ANOVA:"anova",KRUSKAL:"kruskal",CHI_SQUARE:"chiSquare",PROPORTIONS:"proportions"}),d=new Set([u.T,u.WELCH,u.MANN_WHITNEY]),i=new Set([u.ANOVA,u.KRUSKAL]),g=new Set([u.CHI_SQUARE,u.PROPORTIONS]),r=.05,n=[.2,.5,.8],f=[.147,.33,.474],h=[.01,.06,.14],l=[[.1,.3,.5],[.07,.21,.35],[.06,.17,.29],[.05,.15,.25]];function b(de){const oe=Number(de);return Number.isFinite(oe)&&oe>0&&oe<1?oe:.05}function a(de){return de==null||de===""||typeof de=="number"&&Number.isNaN(de)?null:de instanceof Date?de.getTime():typeof de=="object"?String(de):de}function p(de,oe){const he=F(de),ce=[],me=new Map;for(let ye=0;ye<oe.length;ye++){const xe=a(he(oe[ye]));if(xe===null)continue;let Se=me.get(xe);Se||(Se={value:xe,rows:[]},me.set(xe,Se),ce.push(Se)),Se.rows.push(oe[ye])}return ce}function w(de){const{n:oe,mean:he,m2:ce}=z(de),me=oe>1?ce/(oe-1):0;return{n:oe,mean:he,sd:Math.sqrt(me),variance:me}}function v(de,oe,he){if(!(oe>0)||!(he>0)||!(de>=0)||!Number.isFinite(de))return Number.NaN;if(de===0)return 1;const ce=oe*de/(oe*de+he);return 1-o(oe/2,he/2,ce)}function P(de,oe){const he=Math.abs(de);return Number.isFinite(he)?he>=oe[2]?"large":he>=oe[1]?"medium":he>=oe[0]?"small":"negligible":"negligible"}function V(de,oe,he){if(de==="cohensD")return P(oe,n);if(de==="cliffsDelta")return P(oe,f);if(de==="etaSquared")return P(oe,h);const ce=Math.max(1,Math.min(l.length,Math.floor(he||1)));return P(oe,l[ce-1])}function W(de,oe){if(!(de.n>1)||!(oe.n>1))return null;const he=((de.n-1)*de.variance+(oe.n-1)*oe.variance)/(de.n+oe.n-2);return he>0?(de.mean-oe.mean)/Math.sqrt(he):null}function K(de,oe){const he=de.length,ce=oe.length;if(!he||!ce)return null;const me=Array.from(oe).sort((Se,Te)=>Se-Te);let ye=0,xe=0;for(let Se=0;Se<he;Se++){const Te=de[Se];let Be=0,Ee=ce;for(;Be<Ee;){const Oe=Be+Ee>>1;me[Oe]<Te?Be=Oe+1:Ee=Oe}const Ge=Be;let Ne=Be;for(;Ne<ce&&me[Ne]===Te;)Ne++;const ke=Ne-Be;ye+=Ge,xe+=ce-Ne}return(ye-xe)/(he*ce)}function R(de,oe,he,ce){const me=Math.min(he-1,ce-1);return!(oe>0)||!(me>0)?null:Math.sqrt(de/(oe*me))}function S(de){return Number.isFinite(de)?de<.001?"p < 0.001":de>=.995?"p > 0.995":`p = ${de.toFixed(3)}`:"p = —"}function E(de){if(!Number.isFinite(de))return"0";const oe=Math.abs(de);return oe===0?"0":oe>=1e3?String(Math.round(de)):oe>=100?String(Number(de.toFixed(0))):oe>=10?String(Number(de.toFixed(1))):oe>=1?String(Number(de.toFixed(2))):String(Number(de.toPrecision(2)))}const O=new Set(["cohensD","cliffsDelta"]);function M(de){if(de.difference!=null&&Math.abs(de.difference)>=1e-12)return Math.sign(de.difference);const oe=de.effectSize;if(oe&&O.has(oe.name)&&Number.isFinite(oe.value)&&Math.abs(oe.value)>=1e-12)return Math.sign(oe.value);const[he,ce]=de.groups;return Number.isFinite(he.mean)&&Number.isFinite(ce.mean)&&he.mean!==ce.mean?Math.sign(he.mean-ce.mean):0}function T(de){const oe=de.measureName||"values";return{subject:oe.charAt(0).toUpperCase()+oe.slice(1),be:oe==="values"?"are":"is",name:oe}}function A(de,oe){const he=oe.unit?` ${oe.unit}`:"",{subject:ce,be:me}=T(oe),ye=de.groups[0].label,xe=de.groups[1].label,Se=de.effectSize?de.effectSize.label:"negligible",Te=de.pValue<de.alpha,Be=Te?"unlikely to be chance":"consistent with chance";if(!Te&&Se==="negligible")return`${ce} ${me} essentially the same for ${ye} and ${xe} (${S(de.pValue)}); the effect is ${Se}.`;const Ee=M(de),Ge=`the difference is ${Be} (${S(de.pValue)}) and the effect is ${Se}.`;if(Ee===0)return`${ce} ${me} different between ${ye} and ${xe}; ${Ge}`;const Ne=Ee>0?ye:xe,ke=Ee>0?xe:ye,Re=de.difference!=null&&Math.abs(de.difference)>=1e-12?` by about ${E(Math.abs(de.difference))}${he}`:"";return`${ce} ${me} higher for ${Ne} than for ${ke}${Re}; ${Ge}`}function I(de,oe){const{name:he}=T(oe),ce=de.effectSize?de.effectSize.label:"negligible",me=S(de.pValue);return de.pValue<de.alpha?`The groups differ in ${he}; the difference is unlikely to be chance (${me}) and the effect is ${ce}.`:ce==="negligible"?`The groups are essentially the same in ${he} (${me}); the effect is ${ce}.`:`The groups show a ${ce} effect in ${he}, but the difference is consistent with chance (${me}).`}function U(de,oe){const he=de.length;if(he<2)return null;const{mean:ce,m2:me}=z(de),ye=me/(he-1);if(!(ye>0))return null;const xe=Math.sqrt(ye),Se=xe/Math.sqrt(he),Te=ce/Se,Be=he-1,Ee=Math.min(1,Math.max(0,2*(1-y(Math.abs(Te),Be)))),Ge=c(1-oe/2,Be)*Se,Ne=ce/xe;return{test:u.T,statistic:Te,statisticName:"t",df:Be,pValue:Ee,difference:ce,interval:{estimate:ce,lower:ce-Ge,upper:ce+Ge,confidence:1-oe,method:"paired-t (mean of the pair differences)"},effectSize:{name:"cohensD",label:P(Ne,n),value:Ne}}}function X(de,oe){const he=Array.from(de).filter(Re=>Re!==0),ce=he.length;if(!ce)return null;const me=Array.from({length:ce},(Re,Le)=>Le).sort((Re,Le)=>Math.abs(he[Re])-Math.abs(he[Le])),ye=new Array(ce);let xe=0;for(;xe<ce;){let Re=xe;for(;Re+1<ce&&Math.abs(he[me[Re+1]])===Math.abs(he[me[xe]]);)Re++;const Le=(xe+Re)/2+1;for(let ze=xe;ze<=Re;ze++)ye[me[ze]]=Le;xe=Re+1}let Se=0,Te=0;for(let Re=0;Re<ce;Re++)Te+=ye[Re],he[Re]>0&&(Se+=ye[Re]);const Be=Te-Se,Ee=ce*(ce+1)/4,Ge=Math.sqrt(ce*(ce+1)*(2*ce+1)/24),Ne=Ge>0?(Math.abs(Se-Ee)-.5)/Ge:0,ke=Math.min(1,Math.max(0,2*m(-Math.max(0,Ne)))),Oe=Te>0?(Se-Be)/Te:0;return{test:u.MANN_WHITNEY,statistic:Se,statisticName:"W",df:null,pValue:ke,difference:null,interval:null,effectSize:{name:"cliffsDelta",label:P(Oe,f),value:Oe}}}function q(de,oe,he){const ce=w(de),me=w(oe);if(ce.n<2||me.n<2)return null;const ye=((ce.n-1)*ce.variance+(me.n-1)*me.variance)/(ce.n+me.n-2);if(!(ye>0))return null;const xe=Math.sqrt(ye*(1/ce.n+1/me.n)),Se=(ce.mean-me.mean)/xe,Te=ce.n+me.n-2,Be=Math.min(1,Math.max(0,2*(1-y(Math.abs(Se),Te)))),Ee=ce.mean-me.mean,Ge=c(1-he/2,Te)*xe,Ne=W(ce,me);return{test:u.T,statistic:Se,statisticName:"t",df:Te,pValue:Be,difference:Ee,interval:{estimate:Ee,lower:Ee-Ge,upper:Ee+Ge,confidence:1-he,method:"student-t (pooled variance, difference of means)"},effectSize:{name:"cohensD",label:P(Ne,n),value:Ne},summaries:[ce,me]}}function _(de,oe,he){const ce=w(de),me=w(oe);if(ce.n<2||me.n<2)return null;const ye=ce.variance/ce.n+me.variance/me.n;if(!(ye>0))return null;const xe=Math.sqrt(ye),Se=(ce.mean-me.mean)/xe,Te=ce.variance/ce.n*(ce.variance/ce.n)/(ce.n-1),Be=me.variance/me.n*(me.variance/me.n)/(me.n-1),Ee=ye*ye/(Te+Be),Ge=Math.min(1,Math.max(0,2*(1-y(Math.abs(Se),Ee)))),Ne=ce.mean-me.mean,ke=c(1-he/2,Ee)*xe,Oe=W(ce,me);return{test:u.WELCH,statistic:Se,statisticName:"t",df:Ee,pValue:Ge,difference:Ne,interval:{estimate:Ne,lower:Ne-ke,upper:Ne+ke,confidence:1-he,method:"welch-t (unequal variances, difference of means)"},effectSize:{name:"cohensD",label:P(Oe,n),value:Oe},summaries:[ce,me]}}function H(de,oe,he){const ce=de.length,me=oe.length;if(ce<1||me<1)return null;const ye=w(de),xe=w(oe),Se=ce+me,Te=new Array(Se);for(let ze=0;ze<ce;ze++)Te[ze]={v:de[ze],g:0};for(let ze=0;ze<me;ze++)Te[ce+ze]={v:oe[ze],g:1};Te.sort((ze,Ye)=>ze.v-Ye.v);let Be=0,Ee=0,Ge=0;for(;Ge<Se;){let ze=Ge;for(;ze<Se&&Te[ze].v===Te[Ge].v;)ze++;const Ye=(Ge+1+ze)/2;for(let tt=Ge;tt<ze;tt++)Te[tt].g===0&&(Be+=Ye);const et=ze-Ge;Ee+=et*et*et-et,Ge=ze}const Ne=Be-ce*(ce+1)/2,ke=ce*me/2,Oe=ce*me/12*(Se+1-Ee/(Se*(Se-1)));let Re=1;if(Oe>0){const ze=Math.max(0,Math.abs(Ne-ke)-.5);Re=Math.min(1,2*m(-ze/Math.sqrt(Oe)))}const Le=K(de,oe);return{test:u.MANN_WHITNEY,statistic:Ne,statisticName:"U",df:null,pValue:Re,difference:null,interval:ee(de,oe,1-he),effectSize:{name:"cliffsDelta",label:P(Le,f),value:Le},summaries:[ye,xe]}}function ee(de,oe,he){const ce=de.length,me=oe.length,ye=ce*me;if(ye===0||ye>2e6)return null;const xe=new Float64Array(ye);let Se=0;for(let Oe=0;Oe<ce;Oe++)for(let Re=0;Re<me;Re++)xe[Se++]=de[Oe]-oe[Re];xe.sort();const Te=ye>>1,Be=ye%2?xe[Te]:(xe[Te-1]+xe[Te])/2,Ee=Math.sqrt(ce*me*(ce+me+1)/12),Ge=s(1-(1-he)/2);let Ne=Math.round(ye/2-Ge*Ee);Ne>=0||(Ne=0);const ke=Math.floor((ye-1)/2);return Ne>ke&&(Ne=ke),{estimate:Be,lower:xe[Ne],upper:xe[ye-1-Ne],confidence:he,method:"hodges-lehmann (location shift)"}}function te(de,oe){const he=de.length,ce=de.map(w);if(ce.some(Re=>Re.n<2))return null;const me=ce.reduce((Re,Le)=>Re+Le.n,0),ye=ce.reduce((Re,Le)=>Re+Le.mean*Le.n,0)/me;let xe=0,Se=0;for(let Re=0;Re<he;Re++)xe+=ce[Re].n*(ce[Re].mean-ye)**2,Se+=(ce[Re].n-1)*ce[Re].variance;const Te=he-1,Be=me-he;if(!(Se>0)||Be<1)return null;const Ee=xe/Te,Ge=Se/Be,Ne=Ee/Ge,ke=Math.min(1,Math.max(0,v(Ne,Te,Be))),Oe=xe/(xe+Se);return{test:u.ANOVA,statistic:Ne,statisticName:"F",df:{between:Te,within:Be},pValue:ke,difference:null,interval:null,effectSize:{name:"etaSquared",label:P(Oe,h),value:Oe},summaries:ce}}function J(de,oe){const he=de.length,ce=de.map(w);if(he<2)return null;const me=ce.reduce((Le,ze)=>Le+ze.n,0),ye=[];for(let Le=0;Le<he;Le++)for(let ze=0;ze<de[Le].length;ze++)ye.push({v:de[Le][ze],g:Le});ye.sort((Le,ze)=>Le.v-ze.v);const xe=new Array(ye.length);let Se=0,Te=0;for(;Te<ye.length;){let Le=Te;for(;Le<ye.length&&ye[Le].v===ye[Te].v;)Le++;const ze=(Te+1+Le)/2;for(let et=Te;et<Le;et++)xe[et]=ze;const Ye=Le-Te;Se+=Ye*Ye*Ye-Ye,Te=Le}const Be=new Array(he).fill(0);for(let Le=0;Le<ye.length;Le++)Be[ye[Le].g]+=xe[Le];let Ee=0;for(let Le=0;Le<he;Le++)Ee+=Be[Le]*Be[Le]/ce[Le].n;Ee=12/(me*(me+1))*Ee-3*(me+1);const Ge=1-Se/(me*me*me-me),Ne=Ge>0?Ee/Ge:Ee,ke=he-1,Oe=Math.min(1,Math.max(0,t(Ne,ke))),Re=(Ne-he+1)/(me-he);return{test:u.KRUSKAL,statistic:Ne,statisticName:"H",df:ke,pValue:Oe,difference:null,interval:null,effectSize:{name:"etaSquared",label:P(Re,h),value:Math.max(0,Re)},summaries:ce}}function ne(de,oe,he,ce,me){const ye=j(de,oe,me),xe=j(he,ce,me);if(!ye||!xe)return null;const Se=ye.proportion-xe.proportion,Te=Se-Math.sqrt((ye.proportion-ye.lower)**2+(xe.upper-xe.proportion)**2),Be=Se+Math.sqrt((ye.upper-ye.proportion)**2+(xe.proportion-xe.lower)**2);return{estimate:Se,lower:Te,upper:Be}}function se(de,oe,he,ce){const me=F(oe),ye=new Set,xe=[];for(const ze of de){const Ye=new Map;let et=0;for(const tt of ze.rows){const pt=a(me(tt));pt!==null&&(Ye.set(pt,(Ye.get(pt)||0)+1),et++,ye.add(pt))}xe.push(Ye),ze.total=et}const Se=[...ye];if(Se.length<2)return null;const Te=de.reduce((ze,Ye)=>ze+Ye.total,0);if(!(Te>0))return null;let Be=0;for(const ze of de)for(const Ye of Se){const et=xe[de.indexOf(ze)].get(Ye)||0,tt=de.reduce((Tt,Rt)=>Tt+(xe[de.indexOf(Rt)].get(Ye)||0),0),pt=ze.total*tt/Te;pt>0&&(Be+=(et-pt)*(et-pt)/pt)}const Ee=de.length,Ge=Se.length,Ne=(Ee-1)*(Ge-1),ke=Math.min(1,Math.max(0,t(Be,Ne))),Oe=R(Be,Te,Ee,Ge);let Re=null;if(Ee===2&&Ge===2){const[ze]=Se,Ye=xe[0].get(ze)||0,et=xe[1].get(ze)||0,tt=ne(Ye,de[0].total,et,de[1].total,ce);tt&&(Re={...tt,confidence:ce,method:"newcombe (difference in this category's share)",category:ze})}const Le=de.map((ze,Ye)=>{const et={};for(const tt of Se)et[String(tt)]=(xe[Ye].get(tt)||0)/ze.total;return et});return{test:u.CHI_SQUARE,statistic:Be,statisticName:"chiSquare",df:Ne,pValue:ke,difference:null,interval:Re,effectSize:{name:"cramersV",label:V("cramersV",Oe,Math.min(Ee-1,Ge-1)),value:Oe},proportions:Le}}function ae(de,oe,he,ce){const me=F(oe),ye=new Set;for(const tt of de)for(const pt of tt.rows){const Tt=a(me(pt));Tt!==null&&ye.add(Tt)}if(ye.size!==2)return null;const[xe]=[...ye],Se=de[0].rows.reduce((tt,pt)=>tt+(a(me(pt))===xe?1:0),0),Te=de[1].rows.reduce((tt,pt)=>tt+(a(me(pt))===xe?1:0),0),Be=de[0].rows.length,Ee=de[1].rows.length;if(!(Be>0)||!(Ee>0))return null;const Ge=Se/Be,Ne=Te/Ee,ke=(Se+Te)/(Be+Ee);if(!(ke>0)||!(ke<1))return null;const Oe=Math.sqrt(ke*(1-ke)*(1/Be+1/Ee)),Re=(Ge-Ne)/Oe,Le=Math.min(1,Math.max(0,2*m(-Math.abs(Re)))),ze=Ge-Ne,Ye=ne(Se,Be,Te,Ee,ce),et=R(Re*Re,Be+Ee,2,2);return{test:u.PROPORTIONS,statistic:Re,statisticName:"z",df:null,pValue:Le,difference:ze,interval:Ye?{...Ye,confidence:ce,method:"newcombe (difference in proportions)",category:xe}:null,effectSize:{name:"cramersV",label:V("cramersV",et,1),value:et},proportions:[{[String(xe)]:Ge},{[String(xe)]:Ne}],focalCategory:xe}}function we(de,oe,he,ce){if(he&&d.has(he))return{test:he,reason:`caller override: ${he}`};const me=$(de),ye=$(oe),xe=me===null?null:Math.exp(-me/2),Se=ye===null?null:Math.exp(-ye/2);if(xe!==null&&xe<r||Se!==null&&Se<r)return{test:u.MANN_WHITNEY,reason:"two numeric groups, non-normal by Jarque-Bera"};const Te=w(de),Be=w(oe);if(Te.n>=3&&Be.n>=3&&Te.variance>0&&Be.variance>0){const Ee=Math.max(Te.variance,Be.variance)/Math.min(Te.variance,Be.variance),Ge=Te.variance>=Be.variance?Te.n-1:Be.n-1,Ne=Te.variance>=Be.variance?Be.n-1:Te.n-1;if(2*Math.min(v(Ee,Ge,Ne),1-v(Ee,Ge,Ne))<ce)return{test:u.WELCH,reason:"two numeric groups, unequal variances (F-test)"}}return{test:u.T,reason:xe!==null||Se!==null?"two numeric groups, equal variances and no departure from normality":"two numeric groups (too few rows to screen normality)"}}function fe(de,oe){if(oe&&i.has(oe))return{test:oe,reason:`caller override: ${oe}`};for(const he of de){const ce=$(he),me=ce===null?null:Math.exp(-ce/2);if(me!==null&&me<r)return{test:u.KRUSKAL,reason:"three or more numeric groups, non-normal by Jarque-Bera"}}return{test:u.ANOVA,reason:"three or more numeric groups, no departure from normality detected"}}function ge(de,oe,he,ce={},me=null){if(!de||!oe)return null;const ye=b(ce.alpha),xe=1-ye,Se=ce.test&&ce.test!=="auto"?String(ce.test):null,Te=p(oe,he);if(Te.length<2)return N("compare:groups",'[lattice] statistics.compare: the "by" column has fewer than two distinct values to group by.'),null;let Be;if(Array.isArray(ce.groups)&&ce.groups.length===2){const Ye=[a(ce.groups[0]),a(ce.groups[1])];if(Ye[0]===null||Ye[1]===null||Ye[0]===Ye[1])return N("compare:distinct","[lattice] statistics.compare: the two groups must be two distinct, present values."),null;if(Be=Te.filter(et=>et.value===Ye[0]||et.value===Ye[1]),Be.length!==2)return N("compare:empty","[lattice] statistics.compare: one of the two groups has no rows in the current set."),null;Be.sort((et,tt)=>et.value===Ye[0]?-1:1)}else Te.length===2||Se&&d.has(Se)||Se&&g.has(Se)?Be=Te.slice(0,2):(Se&&i.has(Se),Be=Te);const Ge=Y(de,he),Ne=!!ce.paired&&me&&Be.length===2&&Ge;let ke,Oe,Re;if(Ge)if(Be.length===2&&!(Se&&i.has(Se))){const Ye=Z(de,Be[0].rows),et=Z(de,Be[1].rows);if(Ye.length<3||et.length<3)return N("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;if(w(Ye).variance===0||w(et).variance===0)return N("compare:zero-variance","[lattice] statistics.compare: a group has zero variance, so the difference has no scale to test."),null;if(Ne){const pt=Pe(de,me,Be[0].rows,Be[1].rows);return pt?(Oe=Se?"override":"auto",Re=Se?`caller override: ${Se} (paired)`:"two numeric groups, paired",ke=Se===u.MANN_WHITNEY?X(pt.diffs,ye):U(pt.diffs,ye),ke?(ke.paired=!0,ke.chosenBy=Oe,ke.reason=Re,ke.groups=[{value:Be[0].value,label:String(Be[0].value),n:pt.n},{value:Be[1].value,label:String(Be[1].value),n:pt.n}],ke.alpha=ye,ke.method=ke.test===u.MANN_WHITNEY?"Wilcoxon signed-rank test (paired)":"Student's paired t-test (difference of pairs)",ke.verdict=A(ke,ce),ke.categorical=!1,ke):(N("compare:degenerate","[lattice] statistics.compare: the paired test had too little to work with."),null)):(N("compare:paired","[lattice] statistics.compare: not enough matched pairs to run a paired test."),null)}const tt=we(Ye,et,Se,ye);Oe=Se?"override":"auto",Re=tt.reason,tt.test===u.MANN_WHITNEY?ke=H(Ye,et,ye):tt.test===u.WELCH?ke=_(Ye,et,ye):ke=q(Ye,et,ye),ke&&ke.interval&&ke.difference===null&&(ke.difference=ke.interval.estimate)}else{const Ye=Be.map(tt=>Z(de,tt.rows));if(Ye.some(tt=>tt.length<3))return N("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;const et=fe(Ye,Se);Oe=Se?"override":"auto",Re=et.reason,ke=et.test===u.KRUSKAL?J(Ye,ye):te(Ye,ye)}else if(Be.length===2){const Ye=je(de,Be).size===2;if(Se===u.PROPORTIONS||Ye&&!Se)Oe=Se?"override":"auto",Re=Se?"caller override: proportions":"categorical measure with two categories (binary)",ke=ae(Be,de,ye,xe);else if(Se===u.CHI_SQUARE||!Ye&&!Se)Oe=Se?"override":"auto",Re=Se?"caller override: chiSquare":`categorical measure with ${je(de,Be).size} categories`,ke=se(Be,de,ye,xe);else return N("compare:numeric-needed",`[lattice] statistics.compare: ${Se} needs a numeric measure, but the column is categorical.`),null}else Oe=Se?"override":"auto",Re=Se?`caller override: ${Se}`:`categorical measure with ${je(de,Be).size} categories`,ke=se(Be,de,ye,xe);if(!ke)return N("compare:degenerate","[lattice] statistics.compare: the chosen test had too little to work with (too few values, or no variation)."),null;const Le=ke.summaries,ze=ke.proportions;return{test:ke.test,chosenBy:Oe,reason:Re,statistic:ke.statistic,statisticName:ke.statisticName,df:ke.df===void 0?null:ke.df,pValue:ke.pValue,alpha:ye,paired:!1,interval:ke.interval||null,effectSize:ke.effectSize,groups:Be.map((Ye,et)=>({value:Ye.value,label:String(Ye.value),n:Le?Le[et].n:Ye.total,...Le?{mean:Le[et].mean,sd:Le[et].sd}:{},...ze?{proportions:ze[et]}:{}})),difference:ke.difference===void 0?null:ke.difference,method:ke.test,categorical:!Ge,verdict:Be.length===2?A({...ke,alpha:ye,groups:[{value:Be[0].value,label:String(Be[0].value),mean:Le?Le[0].mean:void 0},{value:Be[1].value,label:String(Be[1].value),mean:Le?Le[1].mean:void 0}],categorical:!Ge,difference:ke.difference===void 0?null:ke.difference},ce):I({...ke,alpha:ye},ce)}}function je(de,oe){const he=F(de),ce=new Set;for(const me of oe)for(const ye of me.rows){const xe=a(he(ye));xe!==null&&ce.add(xe)}return ce}function Pe(de,oe,he,ce){const me=F(oe),ye=F(de),xe=new Map;for(const Te of ce){const Be=a(me(Te));Be!==null&&xe.set(Be,ye(Te))}const Se=[];for(const Te of he){const Be=a(me(Te));if(Be===null||!xe.has(Be))continue;const Ee=Number(ye(Te)),Ge=Number(xe.get(Be));!Number.isFinite(Ee)||!Number.isFinite(Ge)||Se.push(Ee-Ge)}return Se.length<2?null:{diffs:Float64Array.from(Se),n:Se.length}}}),He("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 G}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return F}});const re="__lattice_detail",N=36;function G(L){const Z=L.config&&L.config.detailColumnWidth||N;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:Z,min:Z,max:Z,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(z,x){return!!(x&&x.expanded)},formatValue(){return""}}}const F=G}),He("packages/core/src/columns/treecolumn.js",function(e,D){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createTreeColumn",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const N=D("packages/core/src/internal/predicates.js").isFunction,G="__lattice_tree",F=260;function L(z){const x=z.tree||{},Y=z.config&&z.config.treeColumnWidth||F,$=!!(z.config&&z.config.treeColumnFlex),j=()=>(z.columns&&N(z.columns.visible)?z.columns.visible():[]).find(m=>!m.generated)||null,k=(c,m)=>{if(m&&m.group)return m.groupValue;if(N(x.label))return x.label(c,m);if(typeof x.label=="string")return c==null?null:c[x.label];const s=j();return s&&N(s.getValue)?s.getValue(c,m):null},y=()=>{if(x.title)return x.title;const c=typeof x.label=="string"?z.columns&&N(z.columns.get)?z.columns.get(x.label):null:j();return c&&(c.title||c.id)||"Hierarchy"};return{id:G,get title(){return y()},field:null,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group",props:{icon:x.icon,iconClass:x.iconClass,content:x.content,checkbox:x.checkbox,onCheck:x.onCheck}},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:$?{flex:1,min:0,pin:z.config&&z.config.treeColumnPin||null,hidden:!1,resizable:!1,movable:!1,lockPosition:!0}:{width:Y,min:140,pin:z.config&&z.config.treeColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(c,m){return k(c,m)},formatValue(c,m){if(m&&m.grandTotal)return z.config&&z.config.grandTotalLabel||"Total";if(c==null)return"";if(!x.label){const s=j();if(s&&N(s.formatValue))return s.formatValue(c,m)}return String(c)}}}const Z=L}),He("packages/core/src/columns/pivotcolumns.js",function(e,D){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return L}});const N=D("packages/core/src/internal/warn.js").warnOnce,G="__lattice_pivot",F=500;function L(Y){const{pivot:$,valueColumns:j,config:k}=Y,y=$&&$.paths||[],c=Y.separator||k&&k.pivot&&k.pivot.separator||" | ",m=k&&k.pivot&&k.pivot.maxColumns||F;if(!y.length||!j.length)return{tree:[],leaves:[],error:null};const s=Z(k),t=y.length*j.length+(s?j.length:0);if(t>m){const d=`pivot would generate ${t} columns, above the limit of ${m}. Pivot on a lower-cardinality column, or raise pivot.maxColumns.`;return N(`pivot.maxColumns:${t}`,d),{tree:[],leaves:[],error:d}}const o=[],u=[];for(const d of y){const i=[];for(const g of j){const r=x(d,g,c);i.push(r),u.push(r)}i.length===1?(i[0].title=String(d),o.push(i[0])):o.push({id:`${G}:group:${d}`,title:String(d),columns:i,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(s){const d=j.map(g=>z(g,k));u.push(...d);const i=k&&k.pivot&&k.pivot.totalsLabel||"Total";if(d.length===1)d[0].title=i,s==="before"?o.unshift(d[0]):o.push(d[0]);else{const g={id:`${G}:group:__totals`,title:i,columns:d,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};s==="before"?o.unshift(g):o.push(g)}}return{tree:o,leaves:u,error:null}}function Z(Y){const $=Y&&Y.pivot&&Y.pivot.groupTotals;return $==="before"||$==="after"?$:null}function z(Y,$){return{id:`${G}:__total${$&&$.pivot&&$.pivot.separator||" | "}${Y.id}`,field:null,title:Y.title||Y.id,type:Y.type,dataType:Y.dataType,nullable:!0,align:Y.align,generated:!0,pivot:{enabled:!1,index:0,sourceId:Y.id,total:!0},value:{pure:!0},cell:{align:Y.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:Y.total,lookup:null,layout:{width:Y.layout&&Y.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(j,k){const y=k&&k.totals;return y&&Object.hasOwn(y,Y.id)?y[Y.id]:null},formatValue(j,k){return j==null?"":Y.formatValue?Y.formatValue(j,k):String(j)}}}function x(Y,$,j){return{id:`${G}:${Y}${j}${$.id}`,field:null,title:$.title||$.id,type:$.type,dataType:$.dataType,nullable:!0,align:$.align,generated:!0,pivot:{enabled:!1,index:0,path:Y,sourceId:$.id},value:{pure:!0},cell:{align:$.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:$.total,lookup:null,layout:{width:$.layout&&$.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(){return null},formatValue(k,y){return k==null?"":$.formatValue?$.formatValue(k,y):String(k)}}}}),He("packages/core/src/compute/group.js",function(e,D){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return k}});const re=D("packages/core/src/compute/handle.js"),N=re.dictSize,G=re.identity,F=re.presenceReader,L=re.rowCount,Z=re.valueReader,z="",x="\0",Y=1<<20;function $(y,c,m,s){const t=y.length,o=y.map(n=>Z(n)),u=Array.isArray(s)&&s.some(Boolean),d=u?o.map((n,f)=>s[f]?h=>s[f](n(h)):n):o;if(!u&&t>0&&y.every(n=>n&&n.kind==="dictionary"&&n.dict)){const n=y.map(h=>N(h.dict)+1);let f=1;for(let h=0;h<t;h++)f*=n[h];if(f<=Number.MAX_SAFE_INTEGER){const h=y.map(p=>p.values),l=y.map(p=>F(p)),b=p=>{let w=0;for(let v=0;v<t;v++){const P=l[v],V=P&&P(p)===0?n[v]-1:h[v][p];w=w*n[v]+V}return w},a=new Float64Array(m);for(let p=0;p<m;p++)a[p]=b(c[p]);return{packed:a,strings:null,product:f,readers:d,keyOf:b}}}const g=n=>{let f="";for(let h=0;h<t;h++){const l=d[h](n);f+=(h===0?"":z)+(l==null?x:String(l))}return f},r=new Array(m);for(let n=0;n<m;n++)r[n]=g(c[n]);return{packed:null,strings:r,product:1/0,readers:d,keyOf:g}}function j(y,c,m,s){const t=new Uint32Array(s+1);for(let i=0;i<m;i++)t[c[i]+1]++;for(let i=0;i<s;i++)t[i+1]+=t[i];const o=new Uint32Array(m),u=t.slice(0,s);for(let i=0;i<m;i++)o[u[c[i]]++]=y[i];const d=new Array(s);for(let i=0;i<s;i++)d[i]=o.subarray(t[i],t[i+1]);return d}function k(y,c,m={}){const s=y||[],t=c||G(L(s[0],m)),o=t.length;if(s.length===0||o===0)return{keys:[],buckets:[]};const{packed:u,strings:d,product:i,readers:g}=$(s,t,o,m.project),r=new Uint32Array(o);let n=0,f=null;if(u&&i<=Math.max(1024,Math.min(Y,o*4))){const a=i,p=new Int32Array(a).fill(-1);for(let w=0;w<o;w++)p[u[w]]=0;for(let w=0;w<a;w++)p[w]===0&&(p[w]=n++);for(let w=0;w<o;w++)r[w]=p[u[w]];f=new Float64Array(n);for(let w=0;w<a;w++)p[w]>=0&&(f[p[w]]=w)}else if(u){const a=new Map;for(let p=0;p<o;p++){const w=u[p];let v=a.get(w);v===void 0&&(v=n++,a.set(w,v)),r[p]=v}f=new Float64Array(n);for(const[p,w]of a)f[w]=p}else{const a=new Map;for(let p=0;p<o;p++){const w=d[p];let v=a.get(w);v===void 0&&(v=n++,a.set(w,v)),r[p]=v}}const h=j(t,r,o,n),l=new Array(n);for(let a=0;a<n;a++){const p=h[a][0],w=new Array(g.length);for(let v=0;v<g.length;v++)w[v]=g[v](p);l[a]=w}const b={keys:l,buckets:h};return f&&(b.packed=f),b}}),He("packages/core/src/compute/pivot.js",function(e,D){"use strict";Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return o}});const N=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/compute/handle.js").valueComparator,Z=D("packages/core/src/compute/group.js").packKeys,x=D("packages/core/src/compute/total.js").total,Y="|",$="/",j=2e3;function k(i,g,r){return`${i}${Y}${g}${Y}${r}`}function y(i,g){let r="";for(let n=0;n<i.length;n++){const f=i[n];r+=(n===0?"":g)+(f==null?"":String(f))}return r}function c(i,g,r={}){const n=r.separator||$,f=g.length,{keyOf:h,readers:l}=Z(i,g,0),b=new Map,a=[],p=[];for(let R=0;R<f;R++){const S=g[R],E=h(S);if(b.has(E))continue;b.set(E,a.length),p.push(E);const O=new Array(l.length);for(let M=0;M<l.length;M++)O[M]=l[M](S);a.push(O)}const w=F(r.locale),v=a.map((R,S)=>S);v.sort((R,S)=>{const E=a[R],O=a[S];for(let M=0;M<E.length;M++){const T=m(E[M],O[M],w);if(T!==0)return T}return R-S});const P=new Array(v.length),V=new Array(v.length),W=new Map;for(let R=0;R<v.length;R++){const S=v[R];P[R]=a[S],V[R]=y(a[S],n),W.set(p[S],R)}return{keys:P,paths:V,idOf:R=>{const S=W.get(h(R));return S===void 0?-1:S}}}function m(i,g,r){const n=i==null,f=g==null;return n||f?n&&f?0:n?1:-1:r(i,g)}function s(i){const g=i.values||i.totals||[];if(g.length&&typeof g[0]=="object"&&g[0]!==null)return g.filter(h=>h&&h.handle);const r=typeof i.handle=="function"?i.handle:null;if(!r)return g.length&&N("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 n=typeof i.totalOf=="function"?i.totalOf:null,f=[];for(const h of g){const l=r(h);l&&f.push({colId:h,handle:l,fn:n?n(h):"sum"})}return f}function t(i,g,r){if(Array.isArray(i)){const n=r||{};return{...n,pivotHandles:i,order:g||null,groups:n.groups||null}}return i||{}}function o(i,g,r){const n=t(i,g,r),f=n.separator||$,h=s(n),l=n.maxColumns===void 0?j:n.maxColumns,b=n.groups&&n.groups.buckets?n.groups:null,a=b?b.buckets:[n.order||new Uint32Array(0)],p=n.groupPaths||(b?b.keys.map(E=>y(E,f)):[""]),w=d(a),{keys:v,paths:P,idOf:V}=c(n.pivotHandles||[],w,n),W=P.length*Math.max(1,h.length),K=u(P,h,f);if(l&&W>l){const E=new Map;return{keys:v,paths:P,fields:K,groupPaths:p,columns:W,values:E,cells:E,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${W} columns, above pivot.maxColumns of ${l}. Narrow the pivot columns or raise the limit.`,columns:W,maxColumns:l}}}const R=new Map,S=P.length;for(let E=0;E<a.length;E++){const O=a[E],M=p[E]===void 0?"":p[E],T=O.length;if(T===0)continue;const A=new Int32Array(T),I=new Uint32Array(S+1);for(let q=0;q<T;q++){const _=V(O[q]);A[q]=_,_>=0&&I[_+1]++}for(let q=0;q<S;q++)I[q+1]+=I[q];const U=new Uint32Array(T),X=I.slice(0,S);for(let q=0;q<T;q++){const _=A[q];_>=0&&(U[X[_]++]=O[q])}for(let q=0;q<S;q++){const _=I[q],H=I[q+1];if(H===_)continue;const ee=U.subarray(_,H);for(let te=0;te<h.length;te++){const J=h[te],ne=x(J.handle,ee,J.fn,n.totalContext||{locale:n.locale});R.set(k(M,P[q],J.colId),ne)}}}return{keys:v,paths:P,fields:K,groupPaths:p,columns:W,values:R,cells:R,error:null}}function u(i,g,r){if(g.length===0)return i.slice();const n=[];for(const f of i)for(const h of g)n.push(`${f}${r}${h.colId}`);return n}function d(i){if(i.length===1)return i[0]||new Uint32Array(0);let g=0;for(const f of i)g+=f?f.length:0;const r=new Uint32Array(g);let n=0;for(const f of i)!f||f.length===0||(r.set(f,n),n+=f.length);return r}}),He("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 k}});const N=D("packages/core/src/compute/total.js").total,F=D("packages/core/src/compute/group.js").groupByColumns,L=new Set(["sum","count","countValues"]),Z=new Set(["min","max"]),z=new Set(["avg"]);function x(y){return typeof y=="string"?y:typeof y=="function"&&y.totalName?y.totalName:null}function Y(y,c,m,s){return N(y,c,m,s||{})}function $(y,c){if(c)try{return c(y)}catch{}return y==null?"":String(y)}function j(y){const{handle:c,fn:m,leaves:s,by:t,labelOf:o,rowLabel:u}=y,d={locale:y.locale},i=s&&s.length?s:[],g=x(m),r=Y(c,i,m,d),n=Z.has(g);let f;if(n){let b=-1;for(let a=0;a<i.length;a++){const p=Y(c,[i[a]],m,d);if(Object.is(p,r)){b=i[a];break}}f=b<0?[]:[{key:b,indices:[b],label:u?u(b):String(b)}]}else if(t){const b=F([t],i);f=b.keys.map((a,p)=>({key:a[0],indices:b.buckets[p],label:$(a[0],o)}))}else f=Array.from({length:i.length},(b,a)=>{const p=i[a];return{key:p,indices:[p],label:u?u(p):String(p)}});const h=i.length,l=[];for(const b of f){const a=Y(c,b.indices,m,d),p=b.indices.length;let w,v;if(g==="avg")w=((typeof a=="number"?a:0)-(typeof r=="number"?r:0))*p,v=h?p/h:0;else if(n)w=typeof a=="number"?a:0,v=1;else{w=typeof a=="number"?a:0;const P=typeof r=="number"?r:0;v=P?w/P:0}l.push({key:b.key,label:b.label,count:p,value:a,contribution:w,share:v})}return l.sort((b,a)=>Math.abs(a.contribution)-Math.abs(b.contribution)||(b.label<a.label?-1:b.label>a.label?1:0)),{total:r,fn:g,weighted:z.has(g),single:n,contributors:l}}function k(y){const c=j({...y,leaves:y.after}),m=j({...y,leaves:y.before}),s=typeof c.total=="number"?c.total:0,t=typeof m.total=="number"?m.total:0,o=new Map;for(const i of c.contributors)o.set(i.key,i);const u=[],d=new Set;for(const i of m.contributors){d.add(i.key);const g=o.get(i.key);if(g===void 0)u.push({key:i.key,label:i.label,before:i.value,after:null,effect:-i.contribution,kind:"dropped",count:i.count});else{const r=g.contribution-i.contribution;r!==0&&u.push({key:i.key,label:i.label,before:i.value,after:g.value,effect:r,kind:"changed",count:g.count})}}for(const i of c.contributors)d.has(i.key)||u.push({key:i.key,label:i.label,before:null,after:i.value,effect:i.contribution,kind:"new",count:i.count});return u.sort((i,g)=>Math.abs(g.effect)-Math.abs(i.effect)||(i.label<g.label?-1:i.label>g.label?1:0)),{before:m.total,after:c.total,delta:s-t,weighted:c.weighted||m.weighted,single:c.single||m.single,drivers:u}}}),He("packages/core/src/store/bitset.js",function(e,D){"use strict";Object.defineProperty(e,"Bitset",{enumerable:!0,get:function(){return N}});const re=8;class N{static#e=new Uint8Array(256);static{for(let F=1;F<256;F++)N.#e[F]=N.#e[F>>1]+(F&1)}#t;#n;constructor(F=0){const L=Math.max(0,F|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(F){return F<0||F>=this.#n?0:this.#t[F>>3]>>(F&7)&1}set(F){return F>=0&&F<this.#n&&(this.#t[F>>3]|=1<<(F&7)),this}clear(F){return F>=0&&F<this.#n&&(this.#t[F>>3]&=~(1<<(F&7))),this}assign(F,L){return L?this.set(F):this.clear(F)}fill(F=!1){return this.#t.fill(F?255:0),F&&this.#r(),this}grow(F){const L=Math.max(0,F|0);if(L<=this.#n)return this;const Z=Math.ceil(L/re);if(Z>this.#t.length){const z=new Uint8Array(Z);z.set(this.#t),this.#t=z}return this.#n=L,this}count(){const F=this.#t,L=N.#e;let Z=0;for(let z=0;z<F.length;z++)Z+=L[F[z]];return Z}and(F){const L=F instanceof N?F.words:F,Z=this.#t,z=Math.min(Z.length,L.length);for(let x=0;x<z;x++)Z[x]&=L[x];for(let x=z;x<Z.length;x++)Z[x]=0;return this}or(F){const L=F instanceof N?F.words:F,Z=this.#t,z=Math.min(Z.length,L.length);for(let x=0;x<z;x++)Z[x]|=L[x];return this}not(){const F=this.#t;for(let L=0;L<F.length;L++)F[L]=~F[L]&255;return this.#r(),this}clone(){const F=new N(this.#n);return F.words.set(this.#t.subarray(0,F.words.length)),F}release(){this.#t=new Uint8Array(0),this.#n=0}#r(){const F=this.#n&7;if(F===0)return;const L=this.#n>>3;L<this.#t.length&&(this.#t[L]&=(1<<F)-1)}static from(F){const L=Array.isArray(F)?F:Array.from(F),Z=new N(L.length);for(let z=0;z<L.length;z++)L[z]&&Z.set(z);return Z}}}),He("packages/core/src/store/dictionary.js",function(e,D){"use strict";Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return F}});const re=D("packages/core/src/internal/compare.js"),N=re.collator,G=re.defaultCompare;class F{#e;#t=new Map;#n=0;#r=null;#i=-1;#s="\0";constructor(Z=[]){this.#e=[];for(let z=0;z<Z.length;z++){const x=Z[z];this.#t.has(x)||(this.#t.set(x,this.#e.length),this.#e.push(x))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let Z=this.#e.length*8;for(let z=0;z<this.#e.length;z++){const x=this.#e[z];typeof x=="string"&&(Z+=x.length*2),Z+=16}return Z}codeOf(Z){const z=this.#t.get(Z);if(z!==void 0)return z;const x=this.#e.length;return this.#e.push(Z),this.#t.set(Z,x),this.#n++,x}lookup(Z){const z=this.#t.get(Z);return z===void 0?-1:z}has(Z){return this.#t.has(Z)}valueOf(Z){return this.#e[Z]}values(){return this.#e}ranks(Z){const z=Z||"";if(this.#r&&this.#i===this.#n&&this.#s===z)return this.#r;const x=this.#e.length,Y=new Array(x);for(let y=0;y<x;y++)Y[y]=y;const $=N(Z).compare,j=this.#e;Y.sort((y,c)=>this.#o(j[y],j[c],$));const k=new Uint32Array(x);for(let y=0;y<x;y++)k[Y[y]]=y;return this.#r=k,this.#i=this.#n,this.#s=z,k}#o(Z,z,x){return typeof Z=="string"&&typeof z=="string"?x(Z,z):G(Z,z)}}}),He("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(G={}){const F=Math.max(1,G.rows??16),L=Math.max(1,G.values??F);this.#e=new Int32Array(L),this.#t=new Uint32Array(F+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(G){return G<0||G>=this.#n?0:this.#t[G+1]-this.#t[G]}at(G){return G<0||G>=this.#n?this.#e.subarray(0,0):this.#e.subarray(this.#t[G],this.#t[G+1])}has(G,F){if(G<0||G>=this.#n)return!1;const L=this.#e,Z=this.#t[G+1];for(let z=this.#t[G];z<Z;z++)if(L[z]===F)return!0;return!1}hasAny(G,F){for(let L=0;L<F.length;L++)if(this.has(G,F[L]))return!0;return!1}hasAll(G,F){for(let L=0;L<F.length;L++)if(!this.has(G,F[L]))return!1;return!0}hasNone(G,F){return!this.hasAny(G,F)}push(G){const F=this.#n,L=G.length;this.#i(F+1),this.#s(this.#r+L);const Z=this.#r;for(let z=0;z<L;z++)this.#e[Z+z]=G[z]|0;return this.#r+=L,this.#n=F+1,this.#t[F]=Z,this.#t[F+1]=this.#r,F}write(G,F){if(G===this.#n){this.push(F);return}if(G<0||G>this.#n)return;const L=this.#t[G],Z=this.#t[G+1],z=F.length;if(Z-L===z){for(let x=0;x<z;x++)this.#e[L+x]=F[x]|0;return}this.#o(G,F)}compact(G,F,L){const Z=this.#e,z=this.#t,x=this.#n,Y=new Int32Array(Math.max(1,this.#r)),$=new Uint32Array(F+1);let j=0;for(let k=0;k<x;k++){if(G[k]===L)continue;const y=z[k],c=z[k+1];$[G[k]]=j;for(let m=y;m<c;m++)Y[j++]=Z[m];$[G[k]+1]=j}this.#e=Y,this.#t=$,this.#n=F,this.#r=j}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#i(G){if(G+1<=this.#t.length)return;let F=this.#t.length-1;for(;F<G;)F=F*2||16;const L=new Uint32Array(F+1);L.set(this.#t),this.#t=L}#s(G){if(G<=this.#e.length)return;let F=this.#e.length;for(;F<G;)F=F*2||16;const L=new Int32Array(F);L.set(this.#e),this.#e=L}#o(G,F){const L=this.#e,Z=this.#t,z=this.#n,x=F.length-(Z[G+1]-Z[G]),Y=new Int32Array(Math.max(1,this.#r+x)),$=new Uint32Array(Z.length);let j=0;for(let k=0;k<z;k++){if($[k]=j,k===G)for(let y=0;y<F.length;y++)Y[j++]=F[y]|0;else for(let y=Z[k];y<Z[k+1];y++)Y[j++]=L[y];$[k+1]=j}this.#e=Y,this.#t=$,this.#r=j}}}),He("packages/core/src/compute/sort.js",function(e,D){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return S}});const re=D("packages/core/src/compute/handle.js"),N=re.bitReader,G=re.dictRanks,F=re.dictSize,L=re.identity,Z=re.isMissing,z=re.presenceReader,x=re.rowCount,Y=re.valueComparator,$=re.valueReader,j=new Uint32Array(0),k=new ArrayBuffer(8),y=new Float64Array(k),c=new Uint32Array(k),m=(y[0]=-1,(c[1]&2147483648)!==0?1:0),s=m===1?0:1;function t(O,M){y[0]=O;let T=c[m],A=c[s];(T&2147483648)!==0?(T=~T>>>0,A=~A>>>0):T=(T^2147483648)>>>0,M[0]=A,M[1]=T}function o(O,M,T,A){if(A<2)return O;const I=new Uint32Array(256*8);for(let J=0;J<A;J++){const ne=M[J],se=T[J];I[ne&255]++,I[256+(ne>>>8&255)]++,I[512+(ne>>>16&255)]++,I[768+(ne>>>24&255)]++,I[1024+(se&255)]++,I[1280+(se>>>8&255)]++,I[1536+(se>>>16&255)]++,I[1792+(se>>>24&255)]++}let U=O,X=M,q=T,_=new Uint32Array(A),H=new Uint32Array(A),ee=new Uint32Array(A);const te=new Uint32Array(256);for(let J=0;J<8;J++){const ne=J<<8,se=(J&3)<<3,ae=J>=4;let we=!1;for(let je=0;je<256;je++)if(I[ne+je]===A){we=!0;break}if(we)continue;let fe=0;for(let je=0;je<256;je++)te[je]=fe,fe+=I[ne+je];for(let je=0;je<A;je++){const Pe=X[je],de=q[je],oe=(ae?de:Pe)>>>se&255,he=te[oe]++;_[he]=U[je],H[he]=Pe,ee[he]=de}let ge=U;U=_,_=ge,ge=X,X=H,H=ge,ge=q,q=ee,ee=ge}return U}function u(O,M,T){if(T<2)return O;const A=new Uint32Array(256*4);for(let H=0;H<T;H++){const ee=M[H];A[ee&255]++,A[256+(ee>>>8&255)]++,A[512+(ee>>>16&255)]++,A[768+(ee>>>24&255)]++}let I=O,U=M,X=new Uint32Array(T),q=new Uint32Array(T);const _=new Uint32Array(256);for(let H=0;H<4;H++){const ee=H<<8,te=H<<3;let J=!1;for(let ae=0;ae<256;ae++)if(A[ee+ae]===T){J=!0;break}if(J)continue;let ne=0;for(let ae=0;ae<256;ae++)_[ae]=ne,ne+=A[ee+ae];for(let ae=0;ae<T;ae++){const we=U[ae],fe=_[we>>>te&255]++;X[fe]=I[ae],q[fe]=we}let se=I;I=X,X=se,se=U,U=q,q=se}return I}function d(O,M,T,A){const I=new Uint32Array(A+1);for(let q=0;q<T;q++)I[M[q]]++;let U=0;for(let q=0;q<=A;q++){const _=I[q];I[q]=U,U+=_}const X=new Uint32Array(T);for(let q=0;q<T;q++)X[I[M[q]]++]=O[q];return X}function i(O,M,T,A){return T<2?O:A<=65536||A<=T*2?d(O,M,T,A):u(O,M,T)}function g(O,M){return O.length===M&&O.byteOffset===0?O:Uint32Array.prototype.slice.call(O,0,M)}function r(O,M,T=!1){const A=M||L(O.length),I=A.length;if(I<2)return Uint32Array.from(A);const U=new Uint32Array(I),X=new Uint32Array(I),q=new Uint32Array(I),_=new Uint32Array(I),H=new Uint32Array(2);let ee=0,te=0;for(let se=0;se<I;se++){const ae=A[se],we=O[ae];if(Number.isNaN(we)){_[te++]=ae;continue}t(we,H),T?(X[ee]=~H[0]>>>0,q[ee]=~H[1]>>>0):(X[ee]=H[0],q[ee]=H[1]),U[ee++]=ae}const J=o(U.subarray(0,ee),X.subarray(0,ee),q.subarray(0,ee),ee);if(te===0)return g(J,ee);const ne=new Uint32Array(I);return ne.set(J.subarray(0,ee),0),ne.set(_.subarray(0,te),ee),ne}function n(O,M,T=!1){const A=M||L(O.length),I=A.length;if(I<2)return Uint32Array.from(A);const U=Uint32Array.from(A),X=new Uint32Array(I);for(let q=0;q<I;q++){const _=(O[U[q]]^2147483648)>>>0;X[q]=T?~_>>>0:_}return g(u(U,X,I),I)}function f(O,M,T={}){const A=M||L(x(O,T)),I=A.length;if(I<2)return Uint32Array.from(A);const U=G(O.dict,T.locale),X=O.values,q=z(O),_=Math.max(F(O.dict),U.length),H=_,ee=Uint32Array.from(A),te=new Uint32Array(I),J=!!T.descending;for(let ne=0;ne<I;ne++){const se=ee[ne];let ae=q&&q(se)===0?H:U[X[se]];ae===void 0&&(ae=H),te[ne]=J?H-ae:ae}return g(i(ee,te,I,_+1),I)}function h(O,M,T){const A=M.length;let I=Uint32Array.from(M);if(A<2)return I;let U=new Uint32Array(A);for(let X=1;X<A;X<<=1){for(let _=0;_<A;_+=X<<1){const H=Math.min(_+X,A),ee=Math.min(_+(X<<1),A);let te=_,J=H,ne=_;for(;te<H&&J<ee;)U[ne++]=T(O[I[te]],O[I[J]])<=0?I[te++]:I[J++];for(;te<H;)U[ne++]=I[te++];for(;J<ee;)U[ne++]=I[J++]}const q=I;I=U,U=q}return I}function l(O,M,T){const A=N(O.values),I=M.length,U=new Uint32Array(I),X=T?1:0;let q=0;for(let _=0;_<I;_++)A(M[_])===X&&(U[q++]=M[_]);for(let _=0;_<I;_++)A(M[_])!==X&&(U[q++]=M[_]);return U}function b(O,M){const T=O.values,A=O.kind;if((A==="object"||A===void 0)&&(Array.isArray(T)||ArrayBuffer.isView(T))&&!O.presence)return T;const U=$(O),X=new Array(x(O)||0);for(let q=0;q<M.length;q++){const _=M[q];X[_]=U(_)}return X}function a(O,M){for(let T=0;T<M.length;T++)if(typeof O[M[T]]!="string")return!1;return!0}function p(O,M,T,A,I){const U=O.length,X=Uint32Array.from(O);if(U<2||A<1)return X;const q=new Uint32Array(U),_=A-1;for(let H=0;H<U;H++){const ee=T[M[H]];q[H]=I?_-ee:ee}return g(i(X,q,U,A),U)}function w(O,M,T){const A=Y(T),I=new Array(M);for(let X=0;X<M;X++)I[X]=X;I.sort((X,q)=>A(O[X],O[q])||X-q);const U=new Uint32Array(M);for(let X=0;X<M;X++)U[I[X]]=X;return U}function v(O,M,T){const A=M.length,I=new Map,U=[],X=new Uint32Array(A);for(let H=0;H<A;H++){const ee=O[M[H]];let te=I.get(ee);te===void 0&&(te=U.length,I.set(ee,te),U.push(ee)),X[H]=te}const q=U.length,_=w(U,q,T.locale);return p(M,X,_,q,!!T.descending)}function P(O,M,T){const A=b(O,M);if(M.length>=2&&a(A,M)){const X=O.stringRank;return X&&X.version===O.version&&X.usable(M,A,T.locale)?X.sort(M,T):v(A,M,T)}const I=Y(T.locale),U=T.descending?(X,q)=>I(q,X):I;return h(A,M,U)}function V(O,M,T){const A=b(O,M),I=T.compare,X=!!T.descending?(q,_)=>-I(q,_,void 0,void 0,!0):(q,_)=>I(q,_,void 0,void 0,!1);return h(A,M,X)}function W(O,M){const T=M.length,A=z(O),I=O.values,U=O.kind==="float64"&&!!I,X=O.kind==="object"||O.kind==="multi"||O.kind===void 0;if(!A&&!U&&!X)return{present:M,absent:j};const q=new Uint32Array(T),_=new Uint32Array(T);let H=0,ee=0;if(A&&U)for(let te=0;te<T;te++){const J=M[te];A(J)===1&&!Number.isNaN(I[J])?q[H++]=J:_[ee++]=J}else if(U&&!A)for(let te=0;te<T;te++){const J=M[te];Number.isNaN(I[J])?_[ee++]=J:q[H++]=J}else if(A&&!X)for(let te=0;te<T;te++){const J=M[te];A(J)===1?q[H++]=J:_[ee++]=J}else{const te=$(O);for(let J=0;J<T;J++){const ne=M[J];Z(te(ne))?_[ee++]=ne:q[H++]=ne}}return ee===0?{present:M,absent:j}:{present:q.subarray(0,H),absent:_.subarray(0,ee)}}function K(O,M,T){if(M.length===0)return O;const A=new Uint32Array(O.length+M.length);return T?(A.set(M,0),A.set(O,M.length)):(A.set(O,0),A.set(M,O.length)),A}function R(O,M,T={}){const A=M||L(x(O,T));if(!O||A.length<2)return Uint32Array.from(A);const{present:I,absent:U}=W(O,A);if(I.length===0)return Uint32Array.from(A);const X=!!T.descending;let q;if(typeof T.compare=="function")q=V(O,I,T);else switch(O.kind){case"float64":q=r(O.values,I,X);break;case"int32":q=n(O.values,I,X);break;case"dictionary":q=f(O,I,T);break;case"bitset":q=l(O,I,X);break;default:q=P(O,I,T);break}return K(q,U,!!T.nullsFirst)}function S(O,M,T,A={}){const I=M||[],U=I.length&&(I[0].handle||E(O,I[0].col))||O&&O[0];let X=T||L(x(U,A));for(let q=I.length-1;q>=0;q--){const _=I[q],H=_.handle||E(O,_.col)||O&&O[q];H&&(X=R(H,X,{descending:_.descending!==void 0?!!_.descending:_.dir==="desc",nullsFirst:!!_.nullsFirst,locale:_.locale!==void 0?_.locale:A.locale,compare:_.compare}))}return X instanceof Uint32Array?X:Uint32Array.from(X)}function E(O,M){if(!(!O||M===void 0)){for(let T=0;T<O.length;T++)if(O[T]&&O[T].id===M)return O[T]}}}),He("packages/core/src/store/stringrank.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_MAX_DISTINCT",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"StringRankIndex",{enumerable:!0,get:function(){return L}});const re=D("packages/core/src/compute/sort.js"),N=re.collateStringRanks,G=re.rankSortStrings,F=1e5;class L{#e=[];#t=new Map;#n;#r=0;#i=0;#s=-1;#o;#l=!1;#a=null;#c=-1;#u="\0";constructor(z=F){this.#o=z>0?z:F,this.#n=new Uint32Array(0)}get version(){return this.#s}set version(z){this.#s=z}get generation(){return this.#i}get size(){return this.#e.length}get capped(){return this.#l}get length(){return this.#r}get bytes(){let z=this.#n.byteLength;const x=this.#e;for(let Y=0;Y<x.length;Y++)z+=x[Y].length*2+24;return z}#f(z,x){const Y=this.#t.get(z);if(Y!==void 0)return Y;if(this.#l)return-1;if(x&&this.#e.length>=this.#o)return this.#l=!0,-1;const $=this.#e.length;return this.#e.push(z),this.#t.set(z,$),this.#i++,$}build(z,x){const Y=x|0;this.#e=[],this.#t=new Map,this.#i=0,this.#l=!1,this.#a=null,this.#c=-1,this.#n=new Uint32Array(Y);for(let $=0;$<Y;$++){const j=z[$],k=typeof j=="string"?this.#f(j,!1):-1;this.#n[$]=k<0?0:k}this.#r=Y}append(z,x,Y){const $=(x|0)+(Y|0);if($>this.#n.length){const j=new Uint32Array($);j.set(this.#n.subarray(0,this.#r)),this.#n=j}for(let j=x|0;j<$;j++){const k=z[j],y=typeof k=="string"?this.#f(k,!0):-1;this.#n[j]=y<0?0:y}this.#r=Math.max(this.#r,$)}ranks(z){const x=z||"";if(this.#a&&this.#c===this.#i&&this.#u===x)return this.#a;const Y=N(this.#e,this.#e.length,z);return this.#a=Y,this.#c=this.#i,this.#u=x,Y}usable(z,x,Y){if(this.#l||this.#e.length===0)return!1;const $=this.#n,j=this.#e,k=this.#r;for(let y=0;y<z.length;y++){const c=z[y];if(c>=k||j[$[c]]!==x[c])return!1}return!0}sort(z,x){const Y=this.ranks(x.locale),$=this.#e.length,j=z.length,k=new Uint32Array(j),y=this.#n;for(let c=0;c<j;c++)k[c]=y[z[c]];return G(z,k,Y,$,!!x.descending)}}}),He("packages/core/src/store/columnstore.js",function(e,D){"use strict";Object.defineProperty(e,"REMOVED",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"toFloat",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ColumnHandle",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ColumnStore",{enumerable:!0,get:function(){return l}});const N=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/internal/predicates.js").isFunction,Z=D("packages/core/src/internal/paths.js").pathGetter,x=D("packages/core/src/store/bitset.js").Bitset,$=D("packages/core/src/store/dictionary.js").Dictionary,k=D("packages/core/src/store/multivalue.js").MultiValue,c=D("packages/core/src/store/stringrank.js").StringRankIndex,m=4294967295,s=1024,t=5e3,o=.2,u=new Set(["float64","int32","bitset","dictionary","object","multi"]);function d(b){return b==null}function i(b){if(typeof b=="number")return b;if(b instanceof Date)return b.getTime();if(typeof b=="boolean")return b?1:0;const a=Number(b);return Number.isNaN(a)&&typeof b=="string"?Date.parse(b):a}function g(b){const a=i(b);return Number.isFinite(a)?a|0:0}function r(b){return d(b)?[]:Array.isArray(b)?b:[b]}function n(b,a){switch(b.kind){case"float64":case"int32":return b.buf[a];case"bitset":return b.bits.get(a)===1;case"dictionary":return b.dict.valueOf(b.buf[a]);case"multi":{const p=b.mv.at(a),w=new Array(p.length);for(let v=0;v<p.length;v++)w[v]=b.dict.valueOf(p[v]);return w}default:return b.buf[a]}}function f(b,a){switch(b.kind){case"float64":case"int32":return b.values[a];case"bitset":return(b.values[a>>3]&1<<(a&7))!==0;case"dictionary":return(b.table||[])[b.values[a]];case"multi":{const p=b.offsets[a],w=b.offsets[a+1],v=b.table||[],P=new Array(w-p);for(let V=p;V<w;V++)P[V-p]=v[b.values[V]];return P}default:return b.values[a]}}class h{#e;#t;#n;#r;#i;#s;#o;#l=!1;#a=null;#c=null;#u=null;#f=null;#d=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#O=null;#w=null;#A=!1;constructor(a,p){this.#e=a.id;const w=u.has(a.kind)?a.kind:"object";a.kind&&!u.has(a.kind)&&N(`store.kind.${a.id}`,`column "${a.id}" declares unknown storage kind "${a.kind}"; falling back to object`),this.#n=w,this.#t=w,this.#r=a.nullable!==!1,this.#o=a.dictionary??null,this.#s=p,this.#i=F(a.read)?a.read:Z(a.field||a.id),this.#h=a.stringRankIndex!=="off",this.#p=typeof a.stringRankMaxDistinct=="number"?a.stringRankMaxDistinct:0,this.#O=new Map}get id(){return this.#e}get kind(){return this.#l?this.#t:"object"}get target(){return this.#n}get nullable(){return this.#r}get values(){return this.#A?null:this.#l?this.#t==="bitset"?this.#c.words:this.#t==="multi"?this.#u.values:this.#a:this.#T().values}get presence(){return this.#A||!this.#r?null:this.#l?this.#g:this.#T().presence}get dict(){return this.#A||!this.#l?null:this.#t==="dictionary"||this.#t==="multi"?this.#f:null}get stringRank(){if(this.#A||!this.#h||this.kind!=="object")return null;const a=this.values,p=this.#s.physical();if(!a||p===0)return null;if(this.#d===null){if(typeof a[0]!="string")return null;const w=new c(this.#v());return w.build(a,p),w.version=this.#y,this.#d=w,this.#m=this.#y,w.capped?null:w}return this.#d.length<p&&this.#d.append(a,this.#d.length,p-this.#d.length),this.#d.version=this.#y,this.#m=this.#y,this.#d.capped?null:this.#d}#v(){return this.#p}#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 a=0;return this.#a&&(a+=this.#a.byteLength??this.#a.length*8),this.#c&&(a+=this.#c.bytes),this.#u&&(a+=this.#u.bytes),this.#g&&(a+=this.#g.bytes),this.#f&&(a+=this.#f.bytes),this.#O&&(a+=this.#O.size*24),a}get(a){if(!this.#A&&!(a<0||a>=this.#s.physical())){if(!this.#l)return this.#E(a);if(this.#r&&this.#g.get(a)===0)return null;switch(this.#t){case"float64":case"int32":return this.#a[a];case"bitset":return this.#c.get(a)===1;case"dictionary":return this.#f.valueOf(this.#a[a]);case"multi":{const p=this.#u.at(a),w=new Array(p.length);for(let v=0;v<p.length;v++)w[v]=this.#f.valueOf(p[v]);return w}default:return this.#a[a]}}}set(a,p){this.#A||(this.#l?this.#P(a,p):this.#O.set(a,p===void 0?null:p),this.#d&&this.#C(),this.#y++)}read(a){return this.#i(a)}appendColumn(a,p,w){if(this.#A||w<=0)return;if(!this.#l){this.#y++;return}const v=this.#i,P=this.#r,V=this.#g;let W=!1;switch(this.#t){case"float64":{const K=this.#a;for(let R=0;R<w;R++){const S=v(a[R]);if(typeof S=="number"){P&&V.set(p+R),K[p+R]=S;continue}const E=S==null;P?V.assign(p+R,!E):E&&(W=!0),K[p+R]=E?NaN:i(S)}break}case"int32":{const K=this.#a;for(let R=0;R<w;R++){const S=v(a[R]),E=S==null;P?V.assign(p+R,!E):E&&(W=!0),K[p+R]=E?0:g(S)}break}case"bitset":{const K=this.#c;for(let R=0;R<w;R++){const S=v(a[R]),E=S==null;P?V.assign(p+R,!E):E&&(W=!0),K.assign(p+R,!E&&!!S)}break}case"dictionary":{const K=this.#a,R=this.#f;for(let S=0;S<w;S++){const E=v(a[S]),O=E==null;P?V.assign(p+S,!O):O&&(W=!0),K[p+S]=O?0:R.codeOf(E)}break}case"multi":{const K=this.#u,R=this.#f;for(let S=0;S<w;S++){const E=v(a[S]),O=E==null;P?V.assign(p+S,!O):O&&(W=!0);const M=r(E),T=new Array(M.length);for(let A=0;A<M.length;A++)T[A]=R.codeOf(M[A]);K.write(p+S,T)}break}default:{const K=this.#a;for(let R=0;R<w;R++){const S=v(a[R]),E=S==null;P?V.assign(p+R,!E):E&&(W=!0),K[p+R]=E?null:S}break}}W&&N(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#d&&this.#t==="object"&&(this.#d.append(this.#a,p,w),this.#d.version=this.#y+1,this.#m=this.#y+1),this.#y++}appendPacked(a,p,w){if(this.#A||w<=0||!a)return;if(!this.#l){this.#y++;return}const v=this.#g,P=a.presence;if(v)if(P)for(let W=0;W<w;W++)v.assign(p+W,(P[W>>3]&1<<(W&7))!==0);else for(let W=0;W<w;W++)v.set(p+W);const V=a.kind===this.#t;if(V&&(this.#t==="float64"||this.#t==="int32")){this.#a.set(a.values,p),this.#y++;return}if(V&&this.#t==="bitset"){const W=a.values;for(let K=0;K<w;K++)this.#c.assign(p+K,(W[K>>3]&1<<(K&7))!==0);this.#y++;return}if(V&&this.#t==="dictionary"){const W=a.table||[],K=new Uint32Array(W.length);for(let O=0;O<W.length;O++)K[O]=this.#f.codeOf(W[O]);const R=a.values,S=this.#a,E=v;for(let O=0;O<w;O++){if(E&&(P&&(P[O>>3]&1<<(O&7))===0)){S[p+O]=0;continue}S[p+O]=K[R[O]]??0}this.#y++;return}if(V&&this.#t==="multi"){const W=a.table||[],K=new Uint32Array(W.length);for(let E=0;E<W.length;E++)K[E]=this.#f.codeOf(W[E]);const R=a.values,S=a.offsets;for(let E=0;E<w;E++){const O=S[E],M=S[E+1],T=new Array(M-O);for(let A=O;A<M;A++)T[A-O]=K[R[A]]??0;this.#u.write(p+E,T)}this.#y++;return}for(let W=0;W<w;W++){const K=P?(P[W>>3]&1<<(W&7))===0:a.kind==="object"?a.values[W]===null:!1;this.#P(p+W,K?null:f(a,W))}this.#y++}touch(){this.#y++}columnarise(a,p){if(this.#l||this.#A)return;const w=new Array(p);for(let v=0;v<p;v++)w[v]=this.#E(v);this.#t=this.#n,this.#l=!0,this.#S(a);for(let v=0;v<p;v++)this.#P(v,w[v]);this.#O.clear(),this.#w=null,this.#C(),this.#y++}grow(a){if(!(!this.#l||this.#A||a<=this.#b)){switch(this.#t){case"float64":case"int32":case"dictionary":{const p=new this.#a.constructor(a);p.set(this.#a),this.#a=p;break}case"bitset":this.#c.grow(a);break;case"multi":break;default:this.#a.length=a;break}this.#g&&this.#g.grow(a),this.#b=a,this.#y++}}convert(a){if(this.#A||!u.has(a)||(this.#n=a,!this.#l||a===this.#t))return!1;const p={kind:this.#t,buf:this.#a,bits:this.#c,mv:this.#u,dict:this.#f},w=this.#s.physical(),v=this.#g;this.#t=a,this.#S(this.#b);for(let P=0;P<w;P++){const V=v!==null&&v.get(P)===0;V&&a!=="multi"||this.#P(P,V?null:n(p,P))}return this.#C(),this.#y++,!0}compact(a,p,w){if(!this.#A){if(this.#C(),!this.#l){const v=this.#O;if(v.size){const P=new Map;for(const[V,W]of v)a[V]!==m&&P.set(a[V],W);this.#O=P}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const v=this.#a;for(let P=0;P<p;P++)a[P]!==m&&(v[a[P]]=v[P]);if(this.#t==="object")for(let P=w;P<p;P++)v[P]=void 0;break}case"bitset":{const v=this.#c;for(let P=0;P<p;P++)a[P]!==m&&v.assign(a[P],v.get(P)===1);for(let P=w;P<p;P++)v.clear(P);break}case"multi":this.#u.compact(a,w,m);break;default:break}if(this.#g){const v=this.#g;for(let P=0;P<p;P++)a[P]!==m&&v.assign(a[P],v.get(P)===1);for(let P=w;P<p;P++)v.clear(P)}this.#y++}}release(){this.#A||(this.#A=!0,this.#a=null,this.#c&&this.#c.release(),this.#c=null,this.#u&&this.#u.release(),this.#u=null,this.#g&&this.#g.release(),this.#g=null,this.#f=null,this.#d=null,this.#O=new Map,this.#w=null,this.#b=0,this.#y++)}#S(a){const p=Math.max(1,a);switch(this.#a=null,this.#c=null,this.#u=null,this.#t){case"float64":this.#a=new Float64Array(p);break;case"int32":this.#a=new Int32Array(p);break;case"bitset":this.#c=new x(p);break;case"dictionary":this.#a=new Uint32Array(p),this.#f=this.#f??new $(this.#o??[]);break;case"multi":this.#u=new k({rows:p,values:p}),this.#f=this.#f??new $(this.#o??[]);break;default:this.#a=new Array(p);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#f=null),this.#r&&(this.#g?this.#g.grow(p):this.#g=new x(p)),this.#b=p}#P(a,p){const w=d(p);switch(this.#r?this.#g.assign(a,!w):w&&N(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#t){case"float64":this.#a[a]=w?NaN:i(p);break;case"int32":this.#a[a]=w?0:g(p);break;case"bitset":this.#c.assign(a,!w&&!!p);break;case"dictionary":this.#a[a]=w?0:this.#f.codeOf(p);break;case"multi":{const v=r(p),P=new Array(v.length);for(let V=0;V<v.length;V++)P[V]=this.#f.codeOf(v[V]);this.#u.write(a,P);break}default:this.#a[a]=w?null:p;break}}#E(a){if(this.#O.has(a))return this.#O.get(a);const p=this.#i(this.#s.rowAt(a));return p===void 0?null:p}#T(){if(this.#w&&this.#w.version===this.#y)return this.#w;const a=this.#s.physical(),p=new Array(a),w=this.#r?new x(a):null;for(let v=0;v<a;v++){const P=this.#E(v);p[v]=P,w&&!d(P)&&w.set(v)}return this.#w={version:this.#y,values:p,presence:w},this.#w}}class l{#e;#t=new Map;#n=[];#r=[];#i=0;#s=0;#o=0;#l=0;#a=new x(0);#c=!1;#u=!0;#f;#d;#h;#p=!1;constructor(a,p={}){this.#e=Array.isArray(a)?a:[],this.#d=Math.max(1,p.initialCapacity??s),this.#u=p.retainSource!==!1,this.#f=this.#u?p.columnarBelow??t:0,this.#h=p.compactRatio??o;const w={rowAt:v=>this.#r[v],physical:()=>this.#i};for(const v of this.#e){if(!v||!v.id)continue;if(this.#t.has(v.id)){N(`store.dup.${v.id}`,`duplicate column id "${v.id}" in the store schema; ignoring the second`);continue}const P=new h(v,w);this.#t.set(v.id,P),this.#n.push(P)}this.#f<=0&&this.#b()}get count(){return this.#o}get physical(){return this.#i}get capacity(){return this.#c?this.#s:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let a=this.#a.bytes+this.#r.length*8;for(const p of this.#n)a+=p.bytes;return a}append(a){const p=this.#i;if(this.#p||!a)return{from:p,to:p};const w=a.length|0;if(w===0)return{from:p,to:p};if(this.#u)for(let P=0;P<w;P++)this.#r[p+P]=a[P];if(this.#i=p+w,this.#o+=w,this.#a.grow(this.#i),!this.#c){if(this.#i>=this.#f)this.#b();else for(const P of this.#n)P.touch();return{from:p,to:this.#i}}this.#m(this.#i);const v=this.#n;for(let P=0;P<v.length;P++)v[P].appendColumn(a,p,w);return{from:p,to:this.#i}}appendPacked(a,p){const w=this.#i;if(this.#p||!a)return{from:w,to:w};const v=a.count|0;if(v===0)return{from:w,to:w};if(this.#u&&p)for(let V=0;V<v;V++)this.#r[w+V]=p[V];this.#i=w+v,this.#o+=v,this.#a.grow(this.#i),this.#c||this.#b(),this.#m(this.#i);const P=new Map;for(const V of a.columns)P.set(V.id,V);for(const V of this.#n){const W=P.get(V.id);W?V.appendPacked(W,w,v):V.grow(this.#s)}return{from:w,to:this.#i}}source(a){if(this.#u)return this.#r[a];if(!(a<0||a>=this.#i))return this.#g(a)}setSource(a,p){this.#p||a<0||a>=this.#i||this.#u&&(this.#r[a]=p)}get(a,p){const w=this.#t.get(a);return w?w.get(p):void 0}set(a,p,w){if(this.#p||p<0||p>=this.#i)return;const v=this.#t.get(a);if(!v){N(`store.set.${a}`,`set() on unknown column "${a}"`);return}v.set(p,w)}remove(a){return this.#p||a<0||a>=this.#i||this.#a.get(a)===1?!1:(this.#a.set(a),this.#l++,this.#o--,!0)}live(a){return a<0||a>=this.#i?!1:this.#a.get(a)===0}compact(a={}){if(this.#p||this.#l===0||!a.force&&this.#l/this.#i<this.#h)return null;const p=this.#i,w=new Uint32Array(p);let v=0;for(let P=0;P<p;P++)w[P]=this.#a.get(P)===1?m:v++;for(const P of this.#n)P.compact(w,p,v);if(this.#u){const P=this.#r;for(let V=0;V<p;V++)w[V]!==m&&(P[w[V]]=P[V]);P.length=v}return this.#i=v,this.#o=v,this.#l=0,this.#a=new x(Math.max(this.#s,v)),w}column(a){return this.#t.get(a)}columns(){return this.#n.slice()}liveIndices(){const a=new Uint32Array(this.#o);if(this.#l===0){for(let w=0;w<this.#i;w++)a[w]=w;return a}let p=0;for(let w=0;w<this.#i;w++)this.#a.get(w)===0&&(a[p++]=w);return a}convert(a,p){const w=this.#t.get(a);return w?w.convert(p):!1}destroy(){if(!this.#p){this.#p=!0;for(const a of this.#n)a.release();this.#t.clear(),this.#n.length=0,this.#r.length=0,this.#a.release(),this.#i=0,this.#o=0,this.#l=0,this.#s=0}}#m(a){if(a<=this.#s)return;let p=this.#s||this.#d;for(;p<a;)p*=2;for(const w of this.#n)w.grow(p);this.#a.grow(p),this.#s=p}#g(a){const p={};for(const w of this.#n)p[w.id]=w.get(a);return p}#b(){if(this.#c)return;let a=this.#d;for(;a<this.#i;)a*=2;this.#c=!0,this.#s=a,this.#a.grow(a);for(const p of this.#n)p.columnarise(a,this.#i)}}}),He("packages/core/src/store/pool.js",function(e,D){"use strict";Object.defineProperty(e,"MaskPool",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"sharedPool",{enumerable:!0,get:function(){return L}});const re=64,N=8;function G(z){let x=re;for(;x<z;)x*=2;return x}class F{#e=new Map;#t=new WeakSet;#n;#r=0;#i={acquired:0,reused:0,released:0};constructor(x={}){this.#n=x.limit??N}get bytes(){return this.#r}mask(x){const Y=new Uint8Array(this.#s(x),0,x);return Y.fill(0),Y}indices(x){return new Uint32Array(this.#s(x*4),0,x)}release(x){if(!x||!x.buffer)return!1;const Y=x.buffer;if(!this.#t.has(Y))return!1;this.#t.delete(Y),this.#i.released++;const $=Y.byteLength;let j=this.#e.get($);return j||this.#e.set($,j=[]),j.length>=this.#n||(j.push(Y),this.#r+=$),!0}releaseAll(x){for(const Y of x)this.release(Y)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#i,retained:this.#r}}#s(x){const Y=G(x),$=this.#e.get(Y);this.#i.acquired++;let j;return $&&$.length?(j=$.pop(),this.#r-=Y,this.#i.reused++):j=new ArrayBuffer(Y),this.#t.add(j),j}}function L(){return Z??=new F,Z}let Z=null}),He("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 N}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return L}});function re(Z){return{locale:Z===void 0?void 0:String(Z),numeric:!0,sensitivity:"variant"}}function N(Z){return!!Z&&typeof Z.compare!="function"}function G(Z){if(!Z)return!0;for(let z=0;z<Z.length;z++)if(!N(Z[z]))return!1;return!0}function F(Z,z){const x=Z.col!==void 0?Z.col:Z.handle&&Z.handle.id,Y=Z.locale!==void 0?Z.locale:z;return{col:x,descending:Z.descending!==void 0?!!Z.descending:Z.dir==="desc",nullsFirst:!!Z.nullsFirst,collation:re(Y)}}function L(Z,z){const x=Z||[],Y=new Array(x.length);for(let $=0;$<x.length;$++)Y[$]=F(x[$],z);return Y}}),He("packages/core/src/compute/facet.js",function(e,D){"use strict";Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"orderedReader",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"toNumeric",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return w}});const re=D("packages/core/src/compute/handle.js"),N=re.presenceReader,G=re.valueReader,F=re.dictSize,L=re.dictValue,Z=Object.freeze(["equal","quantile","log"]),z=Object.freeze(["hour","day","week","month","quarter","year"]),x=20,Y=50,$=1e4;function j(v,P){if(!v)return"none";const V=P;if(V&&(V.multi===!0||typeof V.items=="function"))return"category";const W=P&&P.base;if(W==="date"||W==="datetime"||W==="time"||W==="dateString")return"date";switch(v.kind){case"bitset":return"boolean";case"float64":case"int32":return"numeric";case"dictionary":return"category";case"multi":return"category";default:return W==="number"?"numeric":W==="boolean"?"boolean":W==="text"?"category":"none"}}function k(v){const P=v.values,V=v.kind;if((V==="float64"||V==="int32")&&P)return K=>P[K];const W=G(v);return K=>y(W(K))}function y(v){if(typeof v=="number")return v;if(v instanceof Date)return v.getTime();if(v==null||v==="")return NaN;if(typeof v=="boolean")return v?1:0;if(typeof v=="string"){const P=Number(v);if(Number.isFinite(P))return P;const V=Date.parse(v);return Number.isFinite(V)?V:NaN}return NaN}function c(v,P,V,W=Y){if(!v)return{cardinality:0,exact:!0};if(v.dict)return{cardinality:F(v.dict),exact:!0};if(v.kind==="bitset")return{cardinality:2,exact:!0};const K=G(v),R=P?P.length:V,S=new Set;for(let E=0;E<R;E++){const O=K(P?P[E]:E);if(O!=null&&(S.add(O),S.size>W))return{cardinality:S.size,exact:!1}}return{cardinality:S.size,exact:!0}}const m=36e5,s=864e5;function t(v,P=x){const V=Number.isFinite(v)&&v>0?v:0,W=Math.max(1,P)*2;return V/m<=W?"hour":V/s<=W?"day":V/(7*s)<=W?"week":V/(30*s)<=W?"month":V/(91*s)<=W?"quarter":"year"}function o(v,P){if(!Number.isFinite(v))return NaN;const V=new Date(v);switch(P){case"hour":return V.setMinutes(0,0,0),V.getTime();case"day":return V.setHours(0,0,0,0),V.getTime();case"week":{V.setHours(0,0,0,0);const W=(V.getDay()+6)%7;return V.setDate(V.getDate()-W),V.getTime()}case"month":return V.setDate(1),V.setHours(0,0,0,0),V.getTime();case"quarter":return V.setMonth(Math.floor(V.getMonth()/3)*3,1),V.setHours(0,0,0,0),V.getTime();default:return V.setMonth(0,1),V.setHours(0,0,0,0),V.getTime()}}function u(v,P){const V=new Date(v);switch(P){case"hour":V.setHours(V.getHours()+1);break;case"day":V.setDate(V.getDate()+1);break;case"week":V.setDate(V.getDate()+7);break;case"month":V.setMonth(V.getMonth()+1);break;case"quarter":V.setMonth(V.getMonth()+3);break;default:V.setFullYear(V.getFullYear()+1);break}return V.getTime()}function d(v,P,V){const W=k(v),K=N(v),R=P?P.length:V;let S=1/0,E=-1/0,O=0,M=0;for(let T=0;T<R;T++){const A=P?P[T]:T;if(K&&!K(A)){O++;continue}const I=W(A);if(!Number.isFinite(I)){O++;continue}I<S&&(S=I),I>E&&(E=I),M++}return{min:S,max:E,nulls:O,finite:M}}function i(v,P,V,W){const K=k(v),R=N(v),S=P?P.length:V,E=S>W?S/W:1,O=[];for(let T=0;T<S;T+=E){const A=P?P[Math.floor(T)]:Math.floor(T);if(R&&!R(A))continue;const I=K(A);Number.isFinite(I)&&O.push(I)}const M=Float64Array.from(O);return M.sort(),M}function g(v,P,V,W={}){const K=W.kind||j(v,W.type);return K==="none"||!v?{kind:"none",buckets:[],suppressed:"type"}:K==="boolean"?r(v,P,V,W):K==="category"?n(v,P,V,W):h(v,P,V,K,W)}function r(v,P,V,W={}){const K=N(v);let R=0;if(K){const E=P?P.length:V;for(let O=0;O<E;O++)K(P?P[O]:O)||R++}const S=[{value:!1,label:"false"},{value:!0,label:"true"}];return R>0&&W.blanks!==!1&&S.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:S}}function n(v,P,V,W){const K=W.cardinalityLimit??Y,{cardinality:R}=c(v,P,V,K);if(R>K&&(W.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:R};const S=G(v),E=P?P.length:V,O=new Map;let M=0;for(let X=0;X<E;X++){const q=S(P?P[X]:X);if(q==null||q===""){M++;continue}if(Array.isArray(q)){if(!q.length){M++;continue}for(const _ of q)O.set(_,(O.get(_)||0)+1);continue}O.set(q,(O.get(q)||0)+1)}let T=[...O.entries()];W.order==="alpha"?T.sort((X,q)=>String(X[0]).localeCompare(String(q[0]))):T.sort((X,q)=>q[1]-X[1]);let A=0,I=0;if(T.length>K){I=T.length-K;for(let X=K;X<T.length;X++)A+=T[X][1];T=T.slice(0,K)}const U=T.map(([X])=>({value:X,label:String(X)}));return A>0&&U.push({remainder:!0,label:`Other (${I} values)`}),M>0&&W.blanks!==!1&&U.push({null:!0,label:"Empty"}),{kind:"category",buckets:U,cardinality:R}}function f(v,P,V,W,K){const R=i(v,P,V,$),S=R.length;if(S<100)return null;const E=R[Math.floor(.01*S)],O=R[Math.ceil(.99*S)-1];return!(O>E)||K-W<=2*(O-E)?null:{lo:E,hi:O}}function h(v,P,V,W,K){const{min:R,max:S,nulls:E,finite:O}=d(v,P,V);if(!O)return{kind:W,buckets:E&&K.blanks!==!1?[{null:!0,label:"Empty"}]:[],empty:!0};const M=Math.max(1,Math.floor(K.buckets||x));let T=[];if(W==="date"){const I=z.includes(K.granularity)?K.granularity:t(S-R,M);let U=o(R,I);for(;U<=S&&T.length<4096;){const X=u(U,I);if(!(X>U))break;T.push({from:U,to:X}),U=X}return{kind:W,buckets:l(T,K.blanks===!1?0:E),granularity:I}}const A=Z.includes(K.strategy)?K.strategy:"equal";if(A==="quantile"){const I=i(v,P,V,$);if(I.length){const U=[I[0]];for(let X=1;X<M;X++){const q=I[Math.min(I.length-1,Math.floor(X/M*I.length))];q>U[U.length-1]&&U.push(q)}U.push(S);for(let X=0;X<U.length-1;X++)T.push({from:U[X],to:U[X+1]})}}else if(A==="log"&&R>0){const I=Math.log10(R),X=(Math.log10(S)-I)/M||1;for(let q=0;q<M;q++)T.push({from:10**(I+q*X),to:10**(I+(q+1)*X)})}if(!T.length&&A==="equal"){const I=f(v,P,V,R,S);if(I){const U=(I.hi-I.lo)/M;I.lo>R&&T.push({from:R,to:I.lo,overflow:"low"});for(let X=0;X<M;X++)T.push({from:I.lo+X*U,to:I.lo+(X+1)*U});T[T.length-1].to=I.hi,I.hi<S&&T.push({from:I.hi,to:S,overflow:"high"})}}if(!T.length){const I=(S-R)/M||1;for(let U=0;U<M;U++)T.push({from:R+U*I,to:R+(U+1)*I})}return T[T.length-1].to=S,{kind:W,buckets:l(T,K.blanks===!1?0:E),strategy:A,min:R,max:S}}function l(v,P){return P>0?[...v,{null:!0,label:"Empty"}]:v}function b(v,P,V,W,K){const R=W&&W.buckets||[],S=K&&K.length>=R.length?K.subarray(0,R.length):new Uint32Array(R.length);if(S.fill(0),!v||!R.length)return S;const E=R.length-1,O=!!R[E]&&R[E].null===!0,M=P?P.length:V;if(W.kind==="boolean"){const X=G(v);for(let q=0;q<M;q++){const _=X(P?P[q]:q);if(_==null){O&&S[E]++;continue}S[_?1:0]++}return S}if(W.kind==="category"){const X=new Map;for(let H=0;H<R.length;H++)!R[H].null&&!R[H].remainder&&X.set(R[H].value,H);const q=R.findIndex(H=>H.remainder),_=G(v);for(let H=0;H<M;H++){const ee=_(P?P[H]:H);if(ee==null||ee===""){O&&S[E]++;continue}if(Array.isArray(ee)){if(!ee.length){O&&S[E]++;continue}for(const J of ee){const ne=X.get(J);ne!==void 0?S[ne]++:q>=0&&S[q]++}continue}const te=X.get(ee);te!==void 0?S[te]++:q>=0&&S[q]++}return S}const T=O?R.length-1:R.length,A=new Float64Array(T+1);for(let X=0;X<T;X++)A[X]=R[X].from;A[T]=T?R[T-1].to:0;const I=k(v),U=N(v);for(let X=0;X<M;X++){const q=P?P[X]:X;if(U&&!U(q)){O&&S[E]++;continue}const _=I(q);if(!Number.isFinite(_)){O&&S[E]++;continue}const H=a(A,T,_);H>=0&&S[H]++}return S}function a(v,P,V){if(!P||V<v[0])return-1;if(V>=v[P])return V===v[P]?P-1:-1;let W=0,K=P-1;for(;W<K;){const R=W+K+1>>>1;V>=v[R]?W=R:K=R-1}return W}function p(v,P,V,W={}){const K=W.bounds||g(v,W.boundsIndices??P,V,W);return{bounds:K,counts:b(v,P,V,K)}}const w=p}),He("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 k}}),Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return o}});const N=D("packages/core/src/compute/handle.js").valueComparator,F=D("packages/core/src/compute/total.js").total,Z=D("packages/core/src/compute/group.js").packKeys,z=D("packages/core/src/compute/pivot.js"),x=z.joinPath,Y=z.DEFAULT_PATH_SEPARATOR,$=z.DEFAULT_MAX_COLUMNS,j="";function k(u,d,i={}){const g=i.separator||Y,r=u||[],n=d instanceof Uint32Array?d:Uint32Array.from(d||[]),f=n.length;if(r.length===0)return{tuples:[[]],paths:[j],buckets:[n]};const{keyOf:h,readers:l}=Z(r,n,0),b=new Map,a=[],p=[],w=[];for(let R=0;R<f;R++){const S=n[R],E=h(S);let O=b.get(E);if(O===void 0){O=a.length,b.set(E,O),p.push(E);const M=new Array(l.length);for(let T=0;T<l.length;T++)M[T]=l[T](S);a.push(M),w.push([])}w[O].push(S)}const v=N(i.locale),P=a.map((R,S)=>S);P.sort((R,S)=>{const E=a[R],O=a[S];for(let M=0;M<E.length;M++){const T=y(E[M],O[M],v);if(T!==0)return T}return R-S});const V=new Array(P.length),W=new Array(P.length),K=new Array(P.length);for(let R=0;R<P.length;R++){const S=P[R];V[R]=a[S],W[R]=x(a[S],g),K[R]=Uint32Array.from(w[S])}return{tuples:V,paths:W,buckets:K}}function y(u,d,i){const g=u==null,r=d==null;return g||r?g&&r?0:g?1:-1:i(u,d)}function c(u,d,i){const g=[];for(let r=0;r<u.length;r++)i.has(u[r])&&g.push(u[r]);return Uint32Array.from(g)}function m(u,d,i,g){return{value:d.length?F(u,d,i,g):null,leaves:d,count:d.length}}function s(u){const d=u&&u.opts||{},i=d.separator||Y,g=d.totalContext||{locale:d.locale},r=(u.measures||[]).filter(W=>W&&W.handle),n=u.leaves instanceof Uint32Array?u.leaves:Uint32Array.from(u.leaves||[]),f=k(u.rowHandles||[],n,{...d,separator:i}),h=k(u.columnHandles||[],n,{...d,separator:i}),l=d.maxColumns===void 0?$:d.maxColumns,b=h.paths.length*Math.max(1,r.length),a=new Map;if(l&&b>l)return{rowAxis:f,columnAxis:h,measures:r.map(W=>({colId:W.colId,fn:W.fn})),body:a,rowMargin:a,columnMargin:a,grand:a,columns:b,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${b} columns, above pivot.maxColumns of ${l}. Narrow the pivot columns or raise the limit.`,columns:b,maxColumns:l}};const p=new Map,w=new Map,v=new Map,P=new Map,V=h.buckets.map(W=>new Set(W));for(let W=0;W<h.paths.length;W++){const K=h.buckets[W],R=h.paths[W];for(const S of r)v.set(o(R,S.colId),m(S.handle,K,S.fn,g))}for(let W=0;W<f.paths.length;W++){const K=f.buckets[W],R=f.paths[W];for(const S of r)w.set(o(R,S.colId),m(S.handle,K,S.fn,g));for(let S=0;S<h.paths.length;S++){const E=c(K,h.buckets[S],V[S]);if(E.length===0)continue;const O=h.paths[S];for(const M of r)p.set(t(R,O,M.colId),m(M.handle,E,M.fn,g))}}for(const W of r)P.set(W.colId,m(W.handle,n,W.fn,g));return{rowAxis:f,columnAxis:h,measures:r.map(W=>({colId:W.colId,fn:W.fn})),body:p,rowMargin:w,columnMargin:v,grand:P,columns:b,error:null}}function t(u,d,i){return`${u}\0${d}\0${i}`}function o(u,d){return`${u}\0${d}`}}),He("packages/core/src/compute/reference.js",function(e,D){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return s}});const N=D("packages/core/src/internal/paths.js").getPath,G=D("packages/core/src/compute/handle.js"),F=G.isMissing,L=G.valueComparator,z=D("packages/core/src/compute/filter.js").testValue,x="",Y="\0";function $(u,d){const i=d.includes(".")?N(u,d):u?.[d];return i===void 0?null:i}function j(u,d,i={}){const g=d||[];let r=u.map((n,f)=>f);if(g.length===0)return r;for(let n=g.length-1;n>=0;n--)r=k(u,r,g[n],i);return r}function k(u,d,i,g){const r=i.locale!==void 0?i.locale:g.locale,n=L(r),f=i.descending!==void 0?!!i.descending:i.dir==="desc",h=[],l=[];for(const p of d){const w=$(u[p],i.col);F(w)?l.push(p):h.push(p)}const b=new Map;for(let p=0;p<h.length;p++)b.set(h[p],p);const a=(p,w)=>{const v=$(u[p],i.col),P=$(u[w],i.col);let V;return typeof i.compare=="function"?(V=i.compare(v,P,u[p],u[w],f),f&&(V=-V)):V=f?n(P,v):n(v,P),V!==0?V:b.get(p)-b.get(w)};return h.sort(a),i.nullsFirst?l.concat(h):h.concat(l)}function y(u,d,i={}){const g=[];for(let r=0;r<u.length;r++)c(u[r],d,i,r)&&g.push(r);return g}function c(u,d,i,g){if(!d)return!0;if(Array.isArray(d.conditions)){const r=d.conditions.filter(f=>f!=null);if(r.length===0)return!0;if(d.op==="or")return r.some(f=>c(u,f,i,g));const n=r.every(f=>c(u,f,i,g));return d.op==="not"?!n:n}return d.col===void 0&&typeof i.custom=="function"?!!i.custom(d,u,g):z($(u,d.col),d,i.locale)}function m(u,d,i,g){const r=i||u.map((l,b)=>b),n=new Map,f=[],h=[];for(const l of r){const b=d.map((w,v)=>{const P=$(u[l],w);return g&&g[v]?g[v](P):P}),a=b.map(w=>w==null?Y:String(w)).join(x);let p=n.get(a);p===void 0&&(p=f.length,n.set(a,p),f.push(b),h.push([])),h[p].push(l)}return{keys:f,buckets:h}}function s(u,d,i={}){const g=L(i.locale),r=u.filter(f=>!F(f)),n=r.map(t).filter(f=>f!==null);switch(d){case"count":return u.length;case"countValues":return r.length;case"sum":return n.reduce((f,h)=>f+h,0);case"avg":return r.length===0?null:n.reduce((f,h)=>f+h,0)/r.length;case"min":return r.length===0?null:r.reduce((f,h)=>g(h,f)<0?h:f);case"max":return r.length===0?null:r.reduce((f,h)=>g(h,f)>0?h:f);case"first":return u.length===0?null:o(u[0]);case"last":return u.length===0?null:o(u[u.length-1]);default:return null}}function t(u){if(typeof u=="number")return Number.isNaN(u)?null:u;if(u==null||u===""||typeof u=="boolean")return null;if(u instanceof Date)return u.getTime();const d=Number(u);return Number.isNaN(d)?null:d}function o(u){return u===void 0?null:u}}),He("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 N=D("packages/core/src/compute/sortspec.js");Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return N.collationDescriptor}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return N.isPortableSort}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return N.isPortableSortSet}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return N.describeSortEntry}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return N.describeSort}});const G=D("packages/core/src/compute/filter.js");Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return G.evaluateFilters}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return G.evaluateCondition}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return G.compact}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return G.testValue}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return G.compilePredicate}}),Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return G.releaseMask}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return G.pruneColumn}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return G.mentionsColumn}});const F=D("packages/core/src/compute/group.js");Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return F.groupByColumns}}),Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return F.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 Z=D("packages/core/src/compute/total.js");Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return Z.TOTAL_FNS}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return Z.TOTAL_LABELS}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return Z.totalLabel}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return Z.total}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return Z.collectValues}});const z=D("packages/core/src/compute/pivot.js");Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return z.pivot}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return z.resolvePivotKeys}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return z.pivotKey}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return z.joinPath}}),Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return z.KEY_DELIMITER}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return z.DEFAULT_PATH_SEPARATOR}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return z.DEFAULT_MAX_COLUMNS}});const x=D("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return x.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return x.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return x.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return x.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return x.GRAND_PATH}});const Y=D("packages/core/src/compute/reference.js");Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return Y.referenceSort}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return Y.referenceFilter}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return Y.referenceGroup}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return Y.referenceTotal}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return Y.referencePasses}}),Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return Y.referenceValue}});const $=D("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return $.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return $.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return $.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return $.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return $.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return $.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return $.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return $.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return $.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return $.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return $.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return $.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 k=D("packages/core/src/compute/windowed.js");Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return k.Window}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return k.WINDOW_KINDS}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return k.openWindow}});const y=D("packages/core/src/compute/statistics.js");Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return y.MAINTENANCE}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return y.APPROXIMATE}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return y.maintenanceOf}});const c=D("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return c.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return c.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return c.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return c.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return c.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return c.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return c.anomalyCondition}});const m=D("packages/core/src/compute/forecast.js");Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return m.FORECAST_METHODS}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return m.forecast}})}),He("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 Z}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"groupPrefixKeys",{enumerable:!0,get:function(){return m}});const N=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/internal/predicates.js").isFunction,L=32,Z="\0";function z(s){return new x(s)}class x{#e;#t;constructor(t){this.#e=F(t&&t.rowKey)?t.rowKey:null;const o=t&&t.config?t.config.rowHeight:void 0;this.#t=typeof o=="number"||F(o)?o:L}get keyed(){return this.#e!==null}keyOf(t,o){if(this.#e){const u=this.#e(t);if(u!=null)return String(u)}else N("source.rowKey.missing","no config.rowKey; falling back to index identity.","Row changes, streaming dedupe, selection persistence and remote reload are disabled.");return`#${o}`}heightOf(t){return F(this.#t)?Number(this.#t(t))||L:this.#t}leaf(t,o,u=0,d=null){const i={key:this.keyOf(t,o),data:t,level:u,parent:d,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:o};return i.height=this.heightOf(i),i}group(t){const o={key:c(t.keyPath||t.path),data:null,level:t.level,parent:t.parent||null,children:[],group:!0,expanded:t.expanded!==!1,leafCount:t.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:t.column,groupValue:t.value,groupPath:t.path,hasChildren:t.hasChildren!==!1};return t.totals&&(o.totals=t.totals),o.height=this.heightOf(o),o}footer(t){const o={key:`${t.key}${Z}footer`,data:null,level:t.level,parent:t,group:!0,footer:!0,expanded:!1,leafCount:t.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:t.groupColumn,groupValue:t.groupValue,groupPath:t.groupPath,hasChildren:!1,totals:t.totals};return o.height=this.heightOf(o),o}detail(t,o){return{key:`${t.key}${Z}detail`,data:t.data,level:t.level+1,parent:t,group:!1,detail:!0,expanded:!1,leafCount:0,height:o,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:t.key}}grandTotal(t,o){const u={key:`${Z}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:o,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:t};return u.height=this.heightOf(u),u}skeleton(t,o=0,u=!1){const d={key:`${Z}pending${Z}${t}`,data:null,level:o,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:t,selected:!1,physical:null,pending:!0};return u&&(d.loadError=!0),d.height=this.heightOf(d),d}}function Y(s,t,o,u){return{key:`${Z}pinned${Z}${o}${Z}${t}`,data:s,level:0,parent:null,group:!1,expanded:!1,leafCount:0,height:u,index:null,selected:!1,physical:null,hasChildren:!1,pinned:o}}function $(s,t){return new Proxy([],{get(o,u,d){if(u==="length")return s();if(typeof u=="string"){const i=Number(u);if(Number.isInteger(i)&&i>=0)return t(i)}return Reflect.get(o,u,d)},has(o,u){if(typeof u=="string"){const d=Number(u);if(Number.isInteger(d)&&d>=0)return d<s()}return Reflect.has(o,u)}})}function j(s){return s==null?"":String(s)}const k="";function y(s){if(s==null)return k;const t=String(s);return t.startsWith(k)?k+t:t}function c(s){const t=s||[];let o="g";for(let u=0;u<t.length;u++)o+=Z+y(t[u]);return o}function m(s){const t=new Array(s.length),o=[];for(let u=0;u<s.length;u++)o.push(s[u]),t[u]=c(o);return t}}),He("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 Z}});const N=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/warn.js").warnOnce;class L{#e;#t;#n;#r=new Map;#i=0;constructor(x,Y,$){this.#e=x,this.#t=Y,this.#n=N($)?$:()=>!1}get store(){const x=this.#e.store;return x&&N(x.column)?x:null}invalidate(){this.#i++}handle(x){const Y=this.store;if(Y){const y=Y.column(x);if(y)return y}const $=this.#r.get(x);if($&&$.builtAt===this.#i)return $.handle;const j=this.#s(x);if(!j)return;if(Y&&this.#n()){F(`source.dropped.${x}`,`column "${x}" cannot be served under ingest.dropSourceRows: it is an impure computed column (a shadow or a positional/rank column) that is never stored, so it can only be read from the caller's row objects — which dropSourceRows has released. Do not sort, filter, group or total on such a column with dropSourceRows enabled.`);return}const k=this.#o(j);return this.#r.set(x,{handle:k,builtAt:this.#i}),k}#s(x){const Y=this.#e.columns;return Y&&N(Y.get)?Y.get(x):void 0}#o(x){const Y=this.#t()||[],$=Y.length,j=new Array($),k=N(x.getValue)?c=>x.getValue(c):c=>c?.[x.field||x.id];for(let c=0;c<$;c++)j[c]=Y[c]===void 0?void 0:k(Y[c]);const y=this.#i;return{id:x.id,kind:"object",nullable:!1,values:j,presence:null,dict:null,offsets:null,get(c){return j[c]},version:y}}}function Z(z,x,Y){return new L(z,x,Y)}}),He("packages/core/src/compute/incremental.js",function(e,D){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Y}});const N=D("packages/core/src/store/columnstore.js").toFloat,G=Object.freeze(["sum","avg","countValues","min","max"]),F=Object.freeze(["float64"]),L=1e15;function Z($,j){return typeof $!="string"||!G.includes($)?!1:!!j&&F.includes(j.kind)}function z($){if($==null)return null;const j=N($);return Number.isNaN(j)?null:j}class x{#e;#t=0;#n=0;#r=0;#i=1/0;#s=-1/0;#o=!1;#l=!1;constructor(j){this.#e=j}get valid(){return this.#o&&!this.#l}get fn(){return this.#e}seed(j){this.#a();for(let k=0;k<j.length;k++){const y=z(j[k]);y!==null&&this.#c(y)}this.#o=!0}seedColumn(j,k,y){this.#a();for(let c=0;c<y.length;c++){const m=y[c];if(k&&k(m)===0)continue;const s=j[m];Number.isNaN(s)||this.#c(s)}this.#o=!0}#a(){this.#t=0,this.#n=0,this.#r=0,this.#i=1/0,this.#s=-1/0,this.#l=!1}#c(j){if(!Number.isFinite(j)){this.#l=!0;return}const k=this.#t+j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-k+j:j-k+this.#t,this.#t=k,this.#r++,j<this.#i&&(this.#i=j),j>this.#s&&(this.#s=j)}#u(j){const k=this.#t-j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-k-j:-j-k+this.#t,this.#t=k,this.#r--}update(j,k){if(!this.#o)return!1;const y=z(j),c=z(k);return y===null&&c===null?!0:y!==null&&!Number.isFinite(y)||c!==null&&!Number.isFinite(c)?!1:this.#e==="min"||this.#e==="max"?y===null||c===null?!1:this.#e==="min"?c<this.#i?(this.#i=c,!0):y>this.#i:c>this.#s?(this.#s=c,!0):y<this.#s:Math.abs(this.#t)>L?!1:(y!==null&&this.#u(y),c!==null&&this.#c(c),!0)}value(){switch(this.#e){case"countValues":return this.#r;case"avg":return this.#r?(this.#t+this.#n)/this.#r:null;case"min":return this.#r?this.#i:null;case"max":return this.#r?this.#s:null;default:return this.#t+this.#n}}invalidate(){this.#o=!1}}const Y=x}),He("packages/core/src/source/filterwire.js",function(e,D){"use strict";Object.defineProperty(e,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"resolveRelativeRange",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"relativeTokenOf",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"relativeTokenHelp",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"isResolvableRelative",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"resolveRelativeCondition",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"forEachCondition",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"mapConditions",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"normaliseFilterSet",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"buildFilterSet",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"wireFilters",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"querySignature",{enumerable:!0,get:function(){return v}});const N=D("packages/core/src/internal/warn.js").warnOnce,G="source.remote.hostFilter",F="source.where.pageRelative";function L(W,K){!Array.isArray(W)||!W.length||N(F,`filters.where (${W.join(", ")}) runs over the rows the ${K} source fetched,`,"not the whole dataset: match counts and totals are page-relative.","Give the predicate a { condition } twin so the engine can narrow the fetch itself.")}function Z(W){const K=(W||{}).config;!K||!K.hostFilter||N(G,"config.hostFilter is not sent to a server-delegated source (paged/remote) and is not applied:","filtering only the fetched window would give wrong counts and totals.","Express the filter as a FilterSet condition, or send it through config.context.")}const z="source.where.notApplied";function x(W,K){N(`${z}:${W}`,`filters.where("${W}") is registered but the ${K} source holds only its fetched window`,"and cannot run the predicate over it: the predicate is not applied there, and rows it would","exclude stay on screen.","Give it a { condition } twin so the engine can narrow the fetch itself — that is the","supported route for a paged or remote source.")}const Y="source.where.overThreshold";function $(W,K,R,S){!Array.isArray(W)||!W.length||N(`${Y}:${K}`,`filters.where (${W.join(", ")}) is not applied to the ${K} pushdown source:`,R===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${R.toLocaleString()} rows, at or past the whereRowLimit of ${S.toLocaleString()}.`,"Running the predicate needs every matching row fetched and held here, which is the whole","download a pushdown source exists to avoid, so it is refused and the rows the predicate","would exclude stay on screen.","Give the predicate a { condition } twin so the engine narrows the fetch itself — that is the","route that works at any size — or raise `whereRowLimit` on the source config if you want the","download.")}const j=new Map;function k(W){let K=j.get(W);return K||(K=new Intl.DateTimeFormat("en-US",{timeZone:W,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),j.set(W,K)),K}function y(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function c(W,K){const R=k(K).formatToParts(new Date(W)),S={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const E of R)E.type==="year"?S.y=+E.value:E.type==="month"?S.m=+E.value:E.type==="day"?S.d=+E.value:E.type==="hour"?S.h=+E.value%24:E.type==="minute"?S.mi=+E.value:E.type==="second"&&(S.s=+E.value);return S}function m(W,K){const R=c(W,K);return Date.UTC(R.y,R.m-1,R.d,R.h,R.mi,R.s)-Math.floor(W/1e3)*1e3}function s(W,K,R,S){const E=Date.UTC(W,K-1,R),O=E-m(E,S);return E-m(O,S)}function t(W,K,R){const S=new Date(Date.UTC(W.y,W.m-1,W.d+K));return s(S.getUTCFullYear(),S.getUTCMonth()+1,S.getUTCDate(),R)}const o=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function u(W,K){if(typeof W!="string")return null;const R=W.trim().toLowerCase().replace(/[\s_-]+/g,""),S=/^last(\d*|n)days?$/.exec(R);if(S){const E=S[1]==="n"?"":S[1],O=Number(E||K);return!Number.isFinite(O)||O<=0?null:{kind:"lastNDays",n:Math.floor(O)}}switch(R){case"today":return{kind:"today",n:0};case"yesterday":return{kind:"yesterday",n:0};case"thisweek":return{kind:"thisWeek",n:0};case"thismonth":return{kind:"thisMonth",n:0};case"thisquarter":return{kind:"thisQuarter",n:0};case"thisyear":return{kind:"thisYear",n:0};case"quartertodate":case"qtd":return{kind:"quarterToDate",n:0};case"yeartodate":case"ytd":return{kind:"yearToDate",n:0};default:return null}}function d(W,K={}){const R=u(W,K.n);if(!R)return null;const S=K.tz||y(),E=K.now instanceof Date?K.now.getTime():typeof K.now=="number"?K.now:Date.now(),O=c(E,S),M=s(O.y,O.m,O.d,S),T=t(O,1,S);let A=M,I=T;switch(R.kind){case"today":break;case"yesterday":A=t(O,-1,S),I=M;break;case"lastNDays":I=K.includeToday?T:M,A=t(O,K.includeToday?-(R.n-1):-R.n,S);break;case"thisWeek":{const U=Number.isFinite(K.weekStartsOn)?Number(K.weekStartsOn):1,q=(new Date(Date.UTC(O.y,O.m-1,O.d)).getUTCDay()-U+7)%7;A=t(O,-q,S),I=t(O,-q+7,S);break}case"thisMonth":A=s(O.y,O.m,1,S),I=s(O.m===12?O.y+1:O.y,O.m===12?1:O.m+1,1,S);break;case"thisQuarter":case"quarterToDate":{const U=Math.floor((O.m-1)/3)*3+1;A=s(O.y,U,1,S),I=R.kind==="quarterToDate"?T:U===10?s(O.y+1,1,1,S):s(O.y,U+3,1,S);break}case"thisYear":case"yearToDate":A=s(O.y,1,1,S),I=R.kind==="yearToDate"?T:s(O.y+1,1,1,S);break;default:return null}return{from:new Date(A).toISOString(),to:new Date(I).toISOString(),bounds:"[)",tz:S,relative:R.kind==="lastNDays"?`last${R.n}Days`:R.kind,n:R.n}}function i(W){if(!W||typeof W!="object")return null;const K=W.value;if(K&&typeof K=="object"&&!Array.isArray(K)&&"relative"in K)return{token:String(K.relative),n:typeof K.n=="number"?K.n:void 0};if(W.op==="relative"&&typeof W.value=="string")return{token:W.value,n:void 0};const R=W.meta;return R&&typeof R.relative=="string"&&W.value===void 0?{token:R.relative,n:typeof R.n=="number"?R.n:void 0}:null}function g(){return`Known tokens: ${o.filter(K=>K!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function r(W){const K=i(W);return K?u(K.token,K.n)!==null:!1}function n(W,K={}){const R=i(W);if(!R)return W;const S=d(R.token,{...K,n:R.n});return S?{...W,type:W.type||"date",op:"between",value:[S.from,S.to],bounds:W.bounds||S.bounds,meta:{...W.meta||{},relative:S.relative,tz:S.tz}}:(N(`source.relative.${R.token}`,`unknown relative date token "${R.token}"; sending the condition unresolved.`,g()),W)}function f(W){return!!W&&typeof W=="object"&&Array.isArray(W.conditions)}function h(W,K){if(W){if(f(W)){for(const R of W.conditions)h(R,K);return}K(W)}}function l(W,K){if(!W)return null;if(!f(W))return K(W);const R=W;let S=!1;const E=[];for(const O of R.conditions){const M=l(O,K);M!==O&&(S=!0),M&&E.push(M)}return!S&&E.length===R.conditions.length?W:E.length?{...R,conditions:E}:null}function b(W){if(!W)return null;if(!f(W))return W;const K=W,R=[];for(const S of K.conditions){const E=b(S);E&&R.push(E)}return R.length?{op:K.op,conditions:R}:null}function a(W){const K=b(W);return K?f(K)&&K.op==="and"?K:{op:"and",conditions:[K]}:null}function p(W){const K=(W||[]).filter(Boolean);return K.length?{op:"and",conditions:K}:null}function w(W,K={}){const R=l(W,S=>n(S,K));return a(R)}function v(W){const K=P(W.filters??null);return JSON.stringify([K,W.sort??null,W.quick??"",W.groupBy??null,W.pivotBy??null,V(W.context)])}function P(W){if(!W)return null;if(f(W)){const S=W;return{op:S.op,conditions:S.conditions.map(P)}}const K=W,R=K.meta&&typeof K.meta.relative=="string"?K.meta.relative:i(K)?.token;return{col:K.col,op:K.op,bounds:K.bounds??null,caseSensitive:K.caseSensitive??!1,value:R?`rel:${R}`:K.value??null}}function V(W){if(W==null)return null;try{return JSON.parse(JSON.stringify(W))}catch{return N("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),He("packages/core/src/source/tree.js",function(e,D){"use strict";Object.defineProperty(e,"SYNTHETIC",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"buildFromPath",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"assignLevels",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resolveTree",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"buildTree",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"indexTree",{enumerable:!0,get:function(){return c}});const N=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/warn.js").warnOnce,L="",Z="\0tree:";function z(m,s){return{physical:m,key:s,level:0,children:[],value:void 0}}function x(m,s){const t=[],o=new Map;for(let u=0;u<m.length;u++){const d=m[u],i=s.pathOf(d),g=Array.isArray(i)?i.map(n=>String(n)):[];if(!g.length){const n=z(d,s.keyOf(d));t.push(n);continue}let r=null;for(let n=0;n<g.length;n++){const f=g.slice(0,n+1).join(L),h=n===g.length-1;let l=o.get(f);l&&h&&l.physical===-1&&(l.physical=d,l.key=s.keyOf(d)),l||(l=z(h?d:-1,h?s.keyOf(d):Z+f),l.level=n,l.value=g[n],o.set(f,l),r?r.children.push(l):t.push(l)),r=l}}return{roots:t,nodes:o}}function Y(m,s){const t=new Map,o=[];for(let g=0;g<m.length;g++){const r=m[g],n=s.keyOf(r),f=z(r,n);t.set(n,f);const h=s.parentOf(r);h!=null&&h!==""&&o.push({node:f,parent:String(h)})}let u=null;const d=new Map;for(const{node:g,parent:r}of o){const n=t.get(r);if(n){d.set(g.key,n);continue}s.orphans&&s.orphans!=="root"&&(u||(u=z(-1,`${Z}orphans`),u.value=s.orphans),d.set(g.key,u))}const i=[];for(const g of t.values()){const r=d.get(g.key);r?r.children.push(g):i.push(g)}return u&&u.children.length&&i.push(u),{roots:$(i,t,s.orphans,u),nodes:t}}function $(m,s,t,o){const u=new Set,d=[...m];for(;d.length;){const f=d.pop();if(!u.has(f.key)){u.add(f.key);for(const h of f.children)d.push(h)}}const i=[];for(const f of s.values())u.has(f.key)||i.push(f);if(!i.length)return m;const g=!!t&&t!=="root";F("tree.cycle",`tree.parentKey produced ${i.length} row(s) inside a parent cycle; `+(g?`they are shown under "${t}".`:"they are shown at the root."));for(const f of i)f.children=f.children.filter(h=>u.has(h.key));if(!g)return[...m,...i];let r=o;const n=[...m];return r||(r=z(-1,`${Z}orphans`),r.value=t,n.push(r)),r.children.push(...i),n}function j(m){let s=0;const t=(o,u)=>{for(const d of o)d.level=u,u>s&&(s=u),d.children.length&&t(d.children,u+1)};return t(m,0),s}function k(m,s){if(!m||typeof m!="object")return null;const t=m.path,o=m.parentKey,u=N(m.hasChildren)?d=>!!m.hasChildren(s.dataAt(d)):null;if(N(t))return{mode:"path",pathOf:d=>t(s.dataAt(d)),keyOf:s.keyOf,declaresChildren:u};if(o!=null){const d=N(o)?o:i=>i?.[o];return{mode:"parentKey",parentOf:i=>d(s.dataAt(i)),keyOf:s.keyOf,orphans:m.orphans||"root",declaresChildren:u}}return F("tree.shape","tree is configured with neither `path` nor `parentKey`; rows stay flat."),null}function y(m,s){const t=s.mode==="path"?x(m,s):Y(m,s),o=j(t.roots);return{...t,depth:o}}function c(m,s){const t=new Map,o=u=>{for(let d=0;d<u.length;d++){const i=u[d];if(i.physical>=0){const g=s?s(i.physical):!1,r=g&&i.children.length===0;t.set(i.physical,{level:i.level,posinset:d+1,setsize:u.length,hasChildren:i.children.length>0||g,lazy:r})}i.children.length&&o(i.children)}};return o(m),t}}),He("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 N}});const re=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function N(G){const F=G&&typeof G=="object"?G.reason:null;return typeof F=="string"&&re.includes(F)}}),He("packages/core/src/source/memory.js",function(e,D){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"quickMatcher",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"MemorySource",{enumerable:!0,get:function(){return q}});const N=D("packages/core/src/internal/lru.js").Lru,G=D("packages/core/src/internal/warn.js"),F=G.warnOnce,L=G.fail,z=D("packages/core/src/internal/predicates.js").isFunction,Y=D("packages/core/src/internal/compare.js").defaultCompare,j=D("packages/core/src/internal/merge.js").mergeRow,k=D("packages/core/src/source/rows.js"),y=k.createRowFactory,c=k.groupKey,m=k.groupPathElement,s=k.groupPrefixKeys,t=k.lazyRowView,u=D("packages/core/src/source/handles.js").createHandleProvider,d=D("packages/core/src/compute/incremental.js"),i=d.RunningTotal,g=d.isIncremental,n=D("packages/core/src/compute/handle.js").presenceReader,f=D("packages/core/src/source/filterwire.js"),h=f.querySignature,l=f.mapConditions,b=f.resolveRelativeCondition,a=D("packages/core/src/source/tree.js"),p=a.buildTree,w=a.resolveTree,v=a.indexTree,P=D("packages/core/src/source/settle.js"),V=P.PIPELINE_SETTLE_REASONS,W=P.isPipelineSettle,K=Object.freeze(["filter","sort","group","total","pivot","flatten"]),R=Object.freeze([]);function S(_,H){if(!_)return null;const ee=H==="grand"?_.grandTotal:_.groupTotal;return ee??_.total}function E(_){return!!_&&!_.running}function O(_){if(_)return _.value&&z(_.value.compare)?_.value.compare:z(_.compare)?_.compare:void 0}function M(_){const H=_&&_.dataType;return!H||!z(H.items)?null:{items:H.items,type:_.itemType&&_.itemType.name||"text"}}function T(_){return!!_&&(typeof _=="object"||typeof _=="function")&&z(_.then)}const A=new Uint32Array(0),I=4096;function U(_,H){return new q(_,H)}function X(_,H){if(H==="regex")try{const ee=new RegExp(_,"iu");return te=>ee.test(te)}catch{return ee=>ee.includes(_)}if(H==="fuzzy"){const ee=[..._].filter(te=>te!==" ");return ee.length?te=>{let J=0;for(let ne=0;ne<te.length&&J<ee.length;ne++)te[ne]===ee[J]&&J++;return J===ee.length}:()=>!0}if(H==="words"){const ee=_.split(/\s+/).filter(Boolean);return ee.length?te=>ee.every(J=>te.includes(J)):()=>!0}return ee=>ee.includes(_)}class q{mode="memory";#e;#t;#n;#r=!1;#i=null;#s;#o;#l=new Map;#a=!1;#c=0;#u=0;#f=new Map;#d=new Map;#h;#p=null;#m=q.#g();static#g(){return{slots:[],groupHeadings:R,unnumbered:R,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;#N=null;#M=null;#R=null;#I=null;#V=null;#W=Symbol("unset");#x=new Map;#q=null;get#U(){return this.#m.slots}set#U(H){this.#m.slots=H}get#Y(){return this.#m.inlineLeaves}set#Y(H){this.#m.inlineLeaves=H}get#G(){return this.#m.groupHeadings}set#G(H){this.#m.groupHeadings=H}get#D(){return this.#m.unnumbered}set#D(H){this.#m.unnumbered=H}get#_(){return this.#m.pivot}set#_(H){this.#m.pivot=H}constructor(H,ee){this.#t=H||{mode:"memory"},this.#e=ee||{};const te=this.#e.config||{};this.#n=this.#t.rows||te.rows||[],this.#s=y(this.#e),this.#o=u(this.#e,()=>this.#n,()=>this.#r),this.#h=new N(Number(te.rowCacheSize)||I);for(const J of K)this.#l.set(J,{key:null,result:null,id:0,computed:!1})}count(){this.#H();const H=this.#be();return H?H.length:this.#U.length}#be(){const H=Number(this.#K("pageSize",0))||0;if(H<=0)return null;const ee=this.#U.length,te=Math.max(1,Math.ceil(ee/H)),ne=Math.min(Math.max(0,Number(this.#K("page",0))||0),te-1)*H;return{offset:ne,length:Math.max(0,Math.min(H,ee-ne))}}pageInfo(){this.#H();const H=Number(this.#K("pageSize",0))||0,ee=this.#U.length;if(H<=0)return{page:0,pageSize:0,total:ee,pageCount:1};const te=Math.max(1,Math.ceil(ee/H));return{page:Math.min(Math.max(0,Number(this.#K("page",0))||0),te-1),pageSize:H,total:ee,pageCount:te}}totalCount(){return this.#Ke().length}matchCount(){return this.#H(),this.#m.matchCount}at(H){this.#H();const ee=this.#be();if(ee)return H<0||H>=ee.length?void 0:this.#dt(ee.offset+H,H);if(!(H<0||H>=this.#U.length))return this.#dt(H,H)}byKey(H){this.#H(),this.#p||this.#ie();const ee=this.#p.get(H);if(ee!==void 0)return this.#le(ee);for(let te=0;te<this.#U.length;te++){const J=this.#U[te];if(typeof J!="number"&&J&&J.key===H)return this.#dt(te)}}loaded(H){return H>=0&&H<this.count()}hint(H,ee){}display(){return this.#H(),this.#q||(this.#q=this.#$e()),this.#q}invalidateQuickText(){this.#x.clear(),this.invalidate("filter")}invalidate(H){const ee=K.indexOf(H);ee<0&&L(`unknown pipeline stage "${H}"; expected one of ${K.join(", ")}`);for(let te=ee;te<K.length;te++){const J=this.#l.get(K[te]);J.key=null,J.computed=!1}this.#q=null}apply(H){const ee=[],te={added:[],updated:[],removed:[],rejected:ee};if(!H)return te;let J=!1;const ne=new Set;if(H.remove&&H.remove.length)for(const se of H.remove){const ae=this.#Be(se);if(ae===void 0){ee.push({operation:"remove",id:this.#he(se),reason:"unknown-id"});continue}te.removed.push(this.#s.keyOf(this.#r?this.#j(ae):this.#n[ae],ae)),this.#r||(this.#n[ae]=void 0),this.#h.delete(ae),this.#x.delete(ae),J=!0}if(H.update&&H.update.length){const se=this.#O.size||this.#kt()?this.#Ie():null,ae=this.#v.size?this.#et():null,we=ae&&ae.length?this.#Ie():null;for(const fe of H.update){const ge=this.#Be(fe);if(ge===void 0){ee.push({operation:"update",id:this.#Re(fe),reason:"unknown-id"});continue}const je=this.#r?this.#i&&this.#i.has(ge)?this.#i.get(ge):this.#j(ge):this.#n[ge],Pe=j(je,fe);for(const de of this.#xe(je,Pe))ne.add(de);if(this.#r||(this.#n[ge]=Pe),se&&this.#Je(se,ge,je,Pe),we&&this.#wt(ae,we,ge,je,Pe),this.#p){const de=this.#s.keyOf(je,ge),oe=this.#s.keyOf(Pe,ge);de!==oe&&(this.#p.delete(de),this.#p.set(oe,ge))}this.#h.delete(ge),this.#x.delete(ge),te.updated.push(this.#le(ge))}}if(H.add&&H.add.length&&this.#r){typeof H.at=="number"&&H.at<this.#ft()&&(this.#h.clear(),this.#x.clear()),this.#p=null;for(const se of H.add){const ae=this.#Ce(this.#Re(se));ae!==void 0&&te.added.push(this.#le(ae))}J=!0}else if(H.add&&H.add.length){let se=typeof H.at=="number"?H.at:this.#n.length;if(se<this.#n.length){let fe=0;for(let ge=0;ge<this.#n.length;ge++)this.#n[ge]!==void 0&&fe++;if(fe!==this.#n.length){let ge=0;for(let je=0;je<this.#n.length;je++)this.#n[je]!==void 0&&(this.#n[ge++]=this.#n[je]);this.#n.length=ge,this.#p=null,this.#h.clear(),this.#x.clear()}}const ae=this.#n.length;se=Math.max(0,se);let we=H.add===this.#n?H.add.slice():H.add;if(this.#s.keyed){const fe=[];for(const ge of we){const je=this.#Re(ge);if(this.#Be(je)!==void 0){ee.push({operation:"add",id:je,reason:"duplicate-id"});continue}fe.push(ge)}fe.length!==we.length&&(we=fe)}if(!we.length)return te;if(se>=ae)for(let fe=0;fe<we.length;fe++)this.#n.push(we[fe]);else this.#n.splice(se,0,...we),this.#h.clear(),this.#x.clear();for(let fe=0;fe<we.length;fe++)te.added.push(this.#le(se>=ae?ae+fe:se+fe));J=!0}return this.#c++,J&&(this.#p=null,this.#rt()),this.#o.invalidate(),this.#q=null,J||this.#z(ne)?(this.#u++,this.invalidate("filter")):this.invalidate("total"),this.#gt("rows:changed",{companion:!0,added:te.added.length,updated:te.updated.length,removed:te.removed.length}),this.#i=null,te}groupHeadingsAt(H){this.#H();const ee=this.#G;if(!ee.length||!Number.isInteger(H)||H<0)return R;let te=0,J=ee.length-1,ne=-1;for(;te<=J;){const ae=te+J>>1;ee[ae].at<=H?(ne=ae,te=ae+1):J=ae-1}if(ne<0)return R;const se=[];for(let ae=ee[ne].row;ae;ae=ae.parent)se.push(ae);return se.reverse(),se}unnumberedRowCount(H){this.#H();const ee=this.#D;if(!ee.length||!Number.isInteger(H)||H<0)return 0;let te=0,J=ee.length-1,ne=-1;for(;te<=J;){const se=te+J>>1;ee[se].at<=H?(ne=se,te=se+1):J=se-1}return ne+1}moveRow(H,ee){if(this.#r)return F("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 te=this.#n;if(!Number.isInteger(H)||!Number.isInteger(ee))return!1;let J=0;for(let ae=0;ae<te.length;ae++)te[ae]!==void 0&&J++;if(H<0||H>=J)return!1;const ne=Math.max(0,Math.min(J-1,ee));if(ne===H)return!1;if(J!==te.length){let ae=0;for(let we=0;we<te.length;we++)te[we]!==void 0&&(te[ae++]=te[we]);te.length=ae}const[se]=te.splice(H,1);return te.splice(ne,0,se),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#x.clear(),this.#rt(),this.#o.invalidate(),this.#q=null,this.invalidate("filter"),this.#gt("rows:changed",{companion:!0,added:0,updated:0,removed:0,moved:1}),!0}reload(H){this.#ce(),this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#rt(),this.#o.invalidate(),this.invalidate("filter"),this.#gt("model:changed",{reason:"reload"})}destroy(){this.#ce(),this.#h.clear(),this.#x.clear(),this.#p=null,this.#U=[],this.#Y=null,this.#q=null,this.#rt();for(const H of K)this.#l.set(H,{key:null,result:null,id:0,computed:!1})}#ce(){for(const{controller:H}of this.#b.values())try{H.abort()}catch{}this.#b.clear()}setRows(H){this.#n=H||[],this.#r=!1,this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#rt(),this.#o.invalidate(),this.invalidate("filter")}notePriorRows(H){this.#i=H||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#x.clear(),this.#o.invalidate()}data(){if(!this.#r)return this.#n;const H=this.#e.store;if(!H||!z(H.source))return this.#n;const ee=H.physical||0,te=new Array(ee);for(let J=0;J<ee;J++)te[J]=H.live&&!H.live(J)?void 0:H.source(J);return te}#fe(){const H=this.#K("detail",null);return!H||!z(H.isOpen)||H.inline===!1?null:H}#Ne(){const H=(this.#e.config||{}).tree;return this.#W!==H&&(this.#W=H,this.#V=w(H,{dataAt:ee=>this.#j(ee),keyOf:ee=>this.#s.keyOf(this.#j(ee),ee)})),this.#V}#re(){return(this.#e.config||{}).grandTotalRow==="bottom"}grandTotalRow(){if(!this.#re())return null;this.#H();const H=this.#m.grand;return H?this.#s.grandTotal(H,this.#nt(this.#m.grandLeaves)):null}pivot(){return this.#H(),this.#_}pivotMatrix(){this.#H();const H=this.#m.groupLeaves,ee=(this.#e.compute||{}).pivotMatrix;if(!z(ee))return null;const te=this.#K("groupBy",[]),J=this.#K("pivotBy",[]);if(!te.length&&!J.length)return F("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.#Ie().map(ae=>({colId:ae.id,handle:this.#o.handle(ae.id),fn:S(ae,"group")})).filter(ae=>ae.handle&&ae.fn),se=this.#e.config||{};return ee({rowHandles:te.map(ae=>this.#o.handle(ae)).filter(Boolean),columnHandles:J.map(ae=>this.#o.handle(ae)).filter(Boolean),measures:ne,leaves:H||new Uint32Array(0),opts:{locale:se.locale,separator:(se.pivot||{}).separator,maxColumns:(se.pivot||{}).maxColumns}})}keysForLeaves(H){const ee=[];if(!H)return ee;for(let te=0;te<H.length;te++){const J=this.#le(H[te]);J&&J.key!=null&&ee.push(String(J.key))}return ee}leavesOf(H){this.#H();const ee=this.#l.get("group"),te=ee&&ee.result;if(!te||!te.nodes)return[];const J=te.nodes.get(H);if(!J)return[];const ne=[],se=ae=>{const we=ae.row&&ae.row.children;if(we&&we.length){for(const fe of we){const ge=te.nodes.get(fe.key);ge&&se(ge)}return}if(ae.leaves)for(let fe=0;fe<ae.leaves.length;fe++)ne.push(this.#le(ae.leaves[fe]))};return se(J),ne}#he(H){return typeof H=="string"?H:this.#Re(H)}#Re(H){try{return this.#s.keyOf(H,-1)}catch{return"(unkeyed)"}}#Be(H){if(typeof H=="string")return this.#Ce(H);if(this.#s.keyed){const te=this.#s.keyOf(H,-1),J=this.#Ce(te);if(J!==void 0)return J}if(this.#r)return;const ee=this.#n.indexOf(H);return ee>=0?ee:void 0}#Ce(H){return this.#p||this.#ie(),this.#p.get(H)}#ie(){this.#p=new Map;const H=this.#ft(),ee=this.#e.store,te=ee&&z(ee.live)?J=>ee.live(J):null;for(let J=0;J<H;J++){if(te&&!te(J))continue;const ne=this.#j(J);ne!==void 0&&this.#p.set(this.#s.keyOf(ne,J),J)}}#xe(H,ee){const te=[];for(const J of this.#Z())this.#_e(J)&&this.#oe(J,H,ee,new Set)&&te.push(J);return te}#oe(H,ee,te,J){if(J.has(H))return!1;J.add(H);const ne=this.#_e(H);if(!ne)return!1;const se=ne.value&&ne.value.deps;return Array.isArray(se)&&se.length?se.some(ae=>this.#oe(String(ae),ee,te,J)):z(ne.getValue)?!Object.is(ne.getValue(ee),ne.getValue(te)):!1}#Z(){const H=new Set;for(const te of this.#K("sort",[]))H.add(te.col);for(const te of this.#K("groupBy",[]))H.add(te);const ee=te=>{if(te){if(Array.isArray(te.conditions)){te.conditions.forEach(ee);return}te.col&&H.add(te.col)}};return ee(this.#K("filters",null)),[...H]}#z(H){if(!H.size)return!1;if(this.#K("quick",""))return!0;for(const ee of this.#Z())if(H.has(ee))return!0;return!1}#H(){if(!this.#a){this.#a=!0;try{this.#Q()}finally{this.#a=!1}}}pipelineRunning(){return this.#a}#Q(){const H=this.#te("filter",()=>this.#de(),()=>this.#je()),ee=this.#Ee(H),te=this.#te("group",()=>this.#ae(),()=>this.#k(ee)),J=this.#te("total",()=>this.#F(),()=>this.#We(te));this.#te("pivot",()=>this.#we(),()=>this.#Ot(te)),this.#te("flatten",()=>this.#se(),()=>this.#qe(te)),this.#Ae(te,J)}#Ee(H){const ee=this.#l.get("sort"),te=this.#$();if(ee.computed&&ee.key===te&&!this.#b.has("sort"))return ee.result;const J=this.#b.get("sort");return J&&J.key===te?ee.result:ee.result&&this.#ve(H)?(this.#ke(H,te),ee.result):this.#te("sort",()=>te,()=>this.#He(H))}#ee(){if(this.#y===null){const H=this.#e.pipelineWorker,ee=z(H)?H():null;this.#y=ee||!1}return this.#y||null}#pe(){const H=this.#K("sort",[]);if(!Array.isArray(H)||!H.length)return null;const ee=(this.#e.config||{}).locale,te=[],J=[];for(const ne of H){const se=this.#_e(ne.col);if(se&&se.running)continue;if(se&&se.value&&z(se.value.compare))return null;const ae=this.#o.handle(ne.col);if(!ae)return null;te.push({col:ne.col,descending:ne.dir==="desc",nullsFirst:!!ne.nullsFirst,locale:ee}),J.push(ae)}return te.length?{entries:te,handles:J,locale:ee}:null}#ve(H){if(this.#B())return!1;const ee=this.#ee();if(!ee)return!1;const te=Number(ee.threshold);return Number.isFinite(te)&&H.length<te?!1:!!this.#pe()}#ke(H,ee){const te=this.#ee(),J=te&&this.#pe();if(!J){this.#te("sort",()=>ee,()=>this.#He(H));return}const ne=new AbortController;this.#b.set("sort",{key:ee,controller:ne});const se=J.entries.length===1?te.sortColumn(J.handles[0],H,{descending:J.entries[0].descending,nullsFirst:J.entries[0].nullsFirst,locale:J.locale,signal:ne.signal,key:"sort"}):te.sortMulti(J.handles,J.entries.map((ae,we)=>({...ae,handle:J.handles[we]})),H,{signal:ne.signal,key:"sort"});if(!T(se)){this.#b.delete("sort"),this.#te("sort",()=>ee,()=>se);return}se.then(ae=>this.#Te(ee,ae),ae=>this.#ye("sort",ee,ae))}#Te(H,ee){const te=this.#b.get("sort");if(!(!te||te.key!==H)){if(this.#$()!==H){this.#b.delete("sort");return}this.#b.delete("sort"),this.#te("sort",()=>H,()=>ee),this.#q=null,this.#H(),this.#gt("model:changed",{reason:V[0]})}}#ye(H,ee,te){const J=this.#b.get(H);if(!(!J||J.key!==ee)&&(this.#b.delete(H),!(te&&te.name==="AbortError")&&H==="sort"&&this.#$()===ee)){const ne=this.#te("filter",()=>this.#de(),()=>this.#je());this.#te("sort",()=>ee,()=>this.#He(ne)),this.#q=null,this.#H(),F("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",te),this.#gt("model:changed",{reason:V[1]})}}#Ae(H,ee){const te=H&&H.leaves?H.leaves.length:this.#m.slots.length;this.#m.matchCount=te,this.#m.grand=ee&&ee.grand||null,this.#m.grandLeaves=H&&H.leaves?H.leaves.length:0,this.#m.groupLeaves=H&&H.leaves?H.leaves:null}#te(H,ee,te){const J=this.#l.get(H),ne=ee();return J.computed&&J.key===ne||(J.result=te(),J.key=ne,J.computed=!0,J.id++,H==="flatten"&&(this.#q=null)),J.result}#me(H){return this.#l.get(H).id}#de(){const H=(this.#e.config||{}).hostFilter,ee=H&&z(H.active)&&H.active()?1:0,te=this.#K("where",null),J=te?te.version:0,ne=this.#Et("filter.sig",`${this.#pt()}`,()=>h({filters:this.#K("filters",null),quick:this.#K("quick",""),quickMode:this.#K("quickMode","contains")}));return`${this.#u}|${ne}|${ee}|${J}`}#$(){const H=this.#B();return`${this.#me("filter")}|${JSON.stringify(this.#K("sort",[]))}`+(H?`|manual:${H.version}`:"")}#B(){const H=this.#K("rowOrder",null);return H&&Array.isArray(H.keys)?H:null}#ue(H,ee){this.#p||this.#ie();const te=this.#p,J=this.#ft(),ne=ee.keys.length,se=new Float64Array(J);for(let ae=0;ae<J;ae++)se[ae]=ne+ae;for(let ae=0;ae<ne;ae++){const we=te.get(ee.keys[ae]);we!==void 0&&(se[we]=ae)}return Uint32Array.from(H).sort((ae,we)=>se[ae]-se[we])}orderedKeys(){this.#p||this.#ie();const H=this.#p,ee=new Map;for(const[ae,we]of H)ee.set(we,ae);const te=Uint32Array.from([...ee.keys()]).sort(),J=this.#B(),ne=J?this.#ue(te,J):this.#He(te),se=new Array(ne.length);for(let ae=0;ae<ne.length;ae++)se[ae]=ee.get(ne[ae]);return se}#ae(){const H=this.#K("pivotBy",[]).length>0?"p":"u";return`${this.#me("sort")}|${JSON.stringify(this.#K("groupBy",[]))}|${H}`}#F(){const H=this.#at()?"f":"a",ee=(this.#e.config||{}).totalOnlyChangedColumns?"n":"w";return`${this.#me("group")}|${JSON.stringify(this.#K("totals",[]))}|${H}${ee}|${this.#c}`}#we(){return`${this.#me("group")}|${JSON.stringify(this.#K("pivotBy",[]))}`}#se(){const ee=this.#Ve()||!this.#re()?this.#me("total"):"x",te=`${this.#pt()}`,J=this.#Et("flatten.keys",te,()=>{const se=this.#K("expanded",null);return se?[...se].sort().join(""):"*"}),ne=this.#Et("flatten.detail",te,()=>{const se=this.#K("detail",null);return se&&z(se.signature)?se.signature():""});return`${ee}|${this.#me("pivot")}|${J}|${ne}`}#Ve(){const H=this.#K("groupBy",[]);return Array.isArray(H)&&H.length>0}stageState(){const H=[];for(const[ee,te]of this.#l){const J=te.result;H.push({stage:ee,materialised:!!te.computed,bytes:J&&typeof J.byteLength=="number"?J.byteLength:null,rows:J&&typeof J.length=="number"?J.length:null,rebuilds:te.id})}return H}facetIndices(H){return this.#je(H||null)}facetRows(H){const ee=this.facetIndices(H),te=[];for(let J=0;J<ee.length;J++){const ne=this.#le(ee[J]);ne&&te.push(ne)}return te}invalidateRows(){this.#h.clear(),this.#x.clear(),this.#q=null}invalidateHandles(){this.#o.invalidate()}rows(){return this.#n}unfilteredIndices(){return this.#Ke()}filteredIndices(){const H=this.#l.get("filter");if(H&&H.computed&&H.key===this.#de())return H.result||this.#Ke();this.#H();const ee=this.#l.get("filter");return(ee&&ee.computed?ee.result:null)||this.#Ke()}unfilteredRows(){const H=this.#Ke(),ee=[];for(let te=0;te<H.length;te++){const J=this.#le(H[te]);J&&ee.push(J)}return ee}#je(H=null){const ee=this.#Ke(),te=this.#K("filters",null),J=H?this.#Ye("pruneColumn")(te,H):te,ne=this.#lt(J),se=String(this.#K("quick","")||"").trim().toLowerCase(),ae=se?X(se,String(this.#K("quickMode","contains")||"contains")):null,we=(this.#e.config||{}).hostFilter,fe=!!(we&&z(we.active)&&we.active()),ge=this.#K("where",null),je=!!(ge&&ge.active);if(!ne&&!se&&!fe&&!je)return ee;let Pe=null;ne&&(Pe=this.#Ye("evaluateFilters")(ne,{handle:ce=>this.#o.handle(ce),count:this.#ft(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:ce=>M(this.#_e(ce))}));const de=new Uint32Array(ee.length);let oe=0;for(let he=0;he<ee.length;he++){const ce=ee[he];if(!(Pe&&!Pe[ce])&&!(ae&&!this.#Pe(ce,ae))){if(fe||je){const me=this.#le(ce);if(fe&&!we.passes(me)||je&&!ge.passes(me.data,me.key))continue}de[oe++]=ce}}if(Pe){const he=(this.#e.compute||{}).releaseMask;z(he)&&he({pool:this.#e.pool},Pe)}return de.subarray(0,oe)}handleFor(H){return this.#o.handle(H)}#He(H){const ee=this.#B();if(ee)return this.#ue(H,ee);const te=this.#K("sort",[]).filter(se=>{const ae=this.#_e(se.col);return!ae||!ae.running?!0:(F(`source.sort.running.${se.col}`,`sort ignores "${se.col}": a running total is a function of the sort order, so it cannot also decide it. Sort by the column it runs over instead.`),!1)});if(!te.length)return H;const J=(this.#e.config||{}).locale;if(te.length===1){const se=te[0],ae=this.#o.handle(se.col);if(!ae)return F(`source.sort.${se.col}`,`sort ignores unknown column "${se.col}".`),H;const we=this.#_e(se.col);return this.#Ye("sortColumn")(ae,H,{descending:se.dir==="desc",nullsFirst:se.nullsFirst,locale:J,compare:O(we)})}const ne=[];for(const se of te){const ae=this.#o.handle(se.col);if(!ae){F(`source.sort.${se.col}`,`sort ignores unknown column "${se.col}".`);continue}ne.push({handle:ae,descending:se.dir==="desc",nullsFirst:se.nullsFirst,locale:J,compare:O(this.#_e(se.col))})}return ne.length?this.#Ye("sortMulti")(ne.map(se=>se.handle),ne,H):H}#k(H){const ee=this.#K("groupBy",[]),te=this.#Ne();if(te&&!ee.length){const he=p(H,te);return this.#R=v(he.roots,te.declaresChildren),{roots:null,leaves:H,nodes:new Map,tree:he}}if(this.#R=null,te&&ee.length&&F("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:H,nodes:new Map};const J=(this.#e.config||{}).timeZone,ne=[],se=[];let ae=!1;for(const he of ee){const ce=this.#o.handle(he);if(!ce){F(`source.group.${he}`,`grouping ignores unknown column "${he}".`);continue}ne.push(ce);const me=this.#_e(he),ye=me&&me.dataType;if(ye&&z(ye.groupProjector)){const xe=me.typeOptions&&me.typeOptions.timeZone||J||void 0,Se=ye.groupProjector(me,xe);se.push(Se||null),Se&&(ae=!0)}else se.push(null)}if(!ne.length)return{roots:null,leaves:H,nodes:new Map};const{keys:we,buckets:fe}=this.#Ye("groupByColumns")(ne,H,{locale:(this.#e.config||{}).locale,project:ae?se:void 0}),ge=this.#K("pivotBy",[]).length>0,je=[],Pe=new Map;for(let he=0;he<fe.length;he++){const ce=we[he];let me=null;const ye=[];for(let xe=0;xe<ce.length;xe++){ye.push(m(ce[xe]));const Se=c(ye),Te=xe===ce.length-1;let Be=Pe.get(Se);if(!Be){const Ee=this.#s.group({path:[...ye],column:ee[xe],value:ce[xe],level:xe,parent:me,expanded:ge&&Te?!1:this.#Qe(Se,{key:Se,column:ee[xe],value:ce[xe],level:xe,path:[...ye]}),hasChildren:!(ge&&Te)});Be={row:Ee,leaves:null},Pe.set(Se,Be),me?me.children.push(Ee):je.push(Ee)}Be.row.leafCount+=fe[he].length,xe===ce.length-1&&(Be.leaves=fe[he]),me=Be.row}}const de=this.#K("sort",[])||[],oe=(he,ce)=>{if(!he||he.length<2){if(he)for(const Se of he)oe(Se.children,ce+1);return}const me=ee[ce],ye=de.find(Se=>Se.col===me),xe=ye&&ye.dir==="desc"?-1:1;he.sort((Se,Te)=>xe*Y(Se.groupValue,Te.groupValue));for(const Se of he)oe(Se.children,ce+1)};return oe(je,0),{roots:je,leaves:H,nodes:Pe,keys:we,buckets:fe}}#Le(H,ee){const te=new Map,J=new Map,ne=se=>{const ae=se.physical>=0?[se.physical]:[];for(const we of se.children)ae.push(...ne(we));if(se.children.length){const we=this.#Ze(ee,Uint32Array.from(ae),null);se.physical>=0?te.set(se.physical,we):J.set(se.key,we)}return ae};for(const se of H.roots)ne(se);return{byPhysical:te,byKey:J}}#We(H){const ee=this.#Ie();if(!ee.length)return this.#E=null,this.#T=null,{grand:null};const te={id:this.#me("group"),columns:ee.map(de=>de.id).join("")},J=this.#E&&this.#E.id===te.id&&this.#E.columns===te.columns,ne=this.#kt()&&J?this.#P:null,se=ne?ee.filter(de=>ne.has(de.id)):ee,ae=J?this.#T:null,we=this.#at()?null:this.#vt(),fe=this.#Oe(ee),ge=de=>{const oe=H.nodes.get(de.key);let he=oe&&oe.leaves?oe.leaves:null;if(de.children&&de.children.length){const ye=de.children.map(ge);let xe=0;for(const Be of ye)xe+=Be.length;const Se=new Uint32Array(xe);let Te=0;for(const Be of ye)Se.set(Be,Te),Te+=Be.length;he=Se}he=he||new Uint32Array(0);const ce=we?we.get(de.key)||A:he,me=this.#Pt(de,ne?se:ee,ce,fe);return de.totals=ne?{...de.totals,...me}:me,he};if(H.roots&&se.length)for(const de of H.roots)ge(de);if(this.#I=H.tree?this.#Le(H.tree,ee):null,this.#E=te,this.#P=this.#kt()?new Set:null,!(this.#e.config||{}).grandTotalRow)return this.#A.length=0,this.#T=null,{grand:null};const Pe=we?this.#ne():H.leaves;return this.#T=this.#Xe(ee,Pe,ne,ae),{grand:this.#T}}#Xe(H,ee,te,J){const ne={},se=this.#me("group");se!==this.#w&&(this.#Ct(),this.#w=se);const ae=this.#A;this.#A=[];for(const we of H){if(!E(we))continue;const fe=this.#o.handle(we.id);if(!fe)continue;const ge=S(we,"grand");if(!g(ge,fe)){if(te&&!te.has(we.id)&&J&&we.id in J){ne[we.id]=J[we.id];continue}ne[we.id]=this.#Ze([we],ee,null,"grand")[we.id];continue}let je=this.#O.get(we.id);if((!je||je.fn!==ge)&&(je=new i(ge),this.#O.set(we.id,je)),je.valid){let Pe=!0;for(const de of ae)if(de.colId===we.id&&!je.update(de.before,de.after)){Pe=!1;break}if(Pe){ne[we.id]=je.value();continue}je.invalidate()}je.seedColumn(fe.values,n(fe),ee),ne[we.id]=je.valid?je.value():this.#Ze([we],ee,null,"grand")[we.id]}return ne}#Oe(H){const ee=this.#me("group");ee!==this.#C&&(this.#v.clear(),this.#C=ee);const te=new Map;for(const ne of H){if(!E(ne))continue;const se=this.#o.handle(ne.id),ae=S(ne,"group");g(ae,se)&&te.set(ne.id,{fn:ae})}if(!te.size)return this.#S.length=0,te;const J=this.#S;this.#S=[];for(const ne of J){const{beforeKeys:se,afterKeys:ae,colDeltas:we}=ne,fe=se.length?new Set(se):null,ge=ae.length?new Set(ae):null;for(const{colId:je,before:Pe,after:de}of we)if(te.has(je)){for(const oe of se)ge&&ge.has(oe)||this.#Se(oe,je,Pe,null);for(const oe of ae)fe&&fe.has(oe)||this.#Se(oe,je,null,de);for(const oe of se)ge&&!ge.has(oe)||this.#Se(oe,je,Pe,de)}}return te}#Se(H,ee,te,J){const ne=this.#v.get(H),se=ne&&ne.get(ee);!se||!se.valid||se.update(te,J)||se.invalidate()}#Pt(H,ee,te,J){if(!J||!J.size)return this.#Ze(ee,te,H);const ne={};let se=null,ae=this.#v.get(H.key);for(const we of ee){const fe=J.get(we.id);if(!fe){(se||(se=[])).push(we);continue}const ge=this.#o.handle(we.id);if(!ge)continue;ae||(ae=new Map,this.#v.set(H.key,ae));let je=ae.get(we.id);if((!je||je.fn!==fe.fn)&&(je=new i(fe.fn),ae.set(we.id,je)),je.valid||je.seedColumn(ge.values,n(ge),te),je.valid){ne[we.id]=je.value();continue}(se||(se=[])).push(we)}return se&&Object.assign(ne,this.#Ze(se,te,H)),ne}#Je(H,ee,te,J){const ne=!this.#at()||this.#Ge(ee);for(const se of H){const ae=se.getValue;if(!z(ae))continue;const we=ae(te),fe=ae(J);Object.is(we,fe)||(this.#P&&this.#P.add(se.id),ne&&this.#O.has(se.id)&&this.#A.push({colId:se.id,before:we,after:fe}))}}#et(){const H=this.#K("groupBy",[]),ee=[];for(const te of H){const J=this.#_e(te);J&&ee.push(J)}return ee}#tt(H,ee){const te=new Array(H.length);for(let J=0;J<H.length;J++){const ne=H[J].getValue;te[J]=m(z(ne)?ne(ee):void 0)}return te}#wt(H,ee,te,J,ne){if(this.#at()&&!this.#Ge(te))return;const se=s(this.#tt(H,J)),ae=s(this.#tt(H,ne)),we=se.length!==ae.length||se.some((ge,je)=>ge!==ae[je]),fe=[];for(const ge of ee){const je=ge.getValue;if(!z(je))continue;const Pe=je(J),de=je(ne);!we&&Object.is(Pe,de)||fe.push({colId:ge.id,before:Pe,after:de})}!fe.length&&!we||this.#S.push({beforeKeys:se,afterKeys:ae,colDeltas:fe})}#Ge(H){const ee=this.#l.get("filter"),te=ee&&ee.computed?ee.result:null;if(!te)return!0;let J=0,ne=te.length-1;for(;J<=ne;){const se=J+ne>>1,ae=te[se];if(ae===H)return!0;ae<H?J=se+1:ne=se-1}return!1}#at(){return(this.#e.config||{}).totalFilteredOnly!==!1}#nt(H){return this.#at()?H:this.#ne().length}#ne(){return(!this.#N||this.#N.version!==this.#u)&&(this.#N={version:this.#u,indices:this.#Ke()}),this.#N.indices}#vt(){const H=this.#K("groupBy",[]),ee=`${this.#u}|${JSON.stringify(H)}`;if(this.#M&&this.#M.key===ee)return this.#M.map;const te=new Map,J=[];for(const ne of H){const se=this.#o.handle(ne);se&&J.push(se)}if(J.length){const ne=this.#ne(),{keys:se,buckets:ae}=this.#Ye("groupByColumns")(J,ne,{locale:(this.#e.config||{}).locale}),we=new Map;for(let fe=0;fe<ae.length;fe++){const ge=se[fe],je=[];for(let Pe=0;Pe<ge.length;Pe++){je.push(m(ge[Pe]));const de=c(je);let oe=we.get(de);oe||(oe=[],we.set(de,oe));for(let he=0;he<ae[fe].length;he++)oe.push(ae[fe][he])}}for(const[fe,ge]of we)te.set(fe,Uint32Array.from(ge))}return this.#M={key:ee,map:te},te}#kt(){return!!(this.#e.config||{}).totalOnlyChangedColumns}#rt(){this.#Ct(),this.#it(),this.#P=null,this.#E=null,this.#T=null}#Ct(){this.#O.clear(),this.#A.length=0,this.#w=-1}#it(){this.#v.clear(),this.#S.length=0,this.#C=-1}#Ot(H){const ee=this.#K("pivotBy",[]);if(!ee.length)return this.#_=null,null;const te=(this.#e.compute||{}).pivot;if(!z(te))return F("source.pivot.kernel","pivot requested but ctx.compute.pivot is not available; showing unpivoted rows."),this.#_=null,null;const J=ee.map(se=>this.#o.handle(se)).filter(Boolean),ne=this.#Ie();return this.#_=te(J,H.leaves,{groups:H.keys&&H.buckets?{keys:H.keys,buckets:H.buckets}:null,totals:ne.map(se=>se.id),handle:se=>this.#o.handle(se),totalOf:se=>S(ne.find(ae=>ae.id===se),"group"),separator:((this.#e.config||{}).pivot||{}).separator,maxColumns:((this.#e.config||{}).pivot||{}).maxColumns})||null,this.#_}#qe(H){const ee=this.#l.get("total").result,te=!!(this.#e.config||{}).groupFooter,J=this.#fe();if(H.tree)return this.#Fe(H,ee,J);if(!H.roots&&!J){if(ee&&ee.grand&&!this.#re()){const ge=this.#s.grandTotal(ee.grand,this.#nt(H.leaves.length));if(this.#Y===H.leaves&&Array.isArray(this.#U))this.#U[this.#U.length-1]=ge;else{const je=Array.from(H.leaves);je.push(ge),this.#U=je,this.#Y=H.leaves}this.#D=[{at:this.#U.length-1}]}else this.#Y=null,this.#U=H.leaves,this.#D=R;return this.#G=R,this.#U}const ne=[],se=[],ae=[],we=ge=>{if(ne.push(ge),!J)return;const je=this.#le(ge);!je||!J.isOpen(je.key)||(je.master=!0,je.expanded=!0,ae.push({at:ne.length}),ne.push(this.#s.detail(je,J.heightOf(je))))};if(!H.roots){for(let ge=0;ge<H.leaves.length;ge++)we(H.leaves[ge]);return ee&&ee.grand&&!this.#re()&&(ae.push({at:ne.length}),ne.push(this.#s.grandTotal(ee.grand,this.#nt(H.leaves.length)))),this.#Y=null,this.#G=R,this.#D=ae.length?ae:R,this.#U=ne,ne}const fe=(ge,je,Pe)=>{if(ge.expanded=ge.hasChildren===!1?!1:this.#Qe(ge.key,{key:ge.key,column:ge.groupColumn,value:ge.groupValue,level:ge.level,path:ge.groupPath}),ge.posinset=je+1,ge.setsize=Pe,se.push({at:ne.length,row:ge}),ae.push({at:ne.length}),ne.push(ge),!!ge.expanded){if(ge.children&&ge.children.length)for(let de=0;de<ge.children.length;de++)fe(ge.children[de],de,ge.children.length);else{const de=H.nodes.get(ge.key),oe=de&&de.leaves?de.leaves:null;if(oe)for(let he=0;he<oe.length;he++)we(oe[he])}te&&ge.totals&&(ae.push({at:ne.length}),ne.push(this.#s.footer(ge)))}};for(let ge=0;ge<H.roots.length;ge++)fe(H.roots[ge],ge,H.roots.length);return ee&&ee.grand&&!this.#re()&&(ae.push({at:ne.length}),ne.push(this.#s.grandTotal(ee.grand,this.#nt(H.leaves.length)))),this.#G=se,this.#D=ae,this.#U=ne,ne}#Ke(){const H=this.#e.store;if(H&&z(H.liveIndices))return H.liveIndices();const ee=new Uint32Array(this.#n.length);let te=0;for(let J=0;J<this.#n.length;J++)this.#n[J]!==void 0&&(ee[te++]=J);return ee.subarray(0,te)}#ft(){const H=this.#e.store;return H&&typeof H.physical=="number"?H.physical:this.#n.length}#j(H){const ee=this.#e.store;return ee&&z(ee.source)?ee.source(H):this.#n[H]}#dt(H,ee=H){const te=this.#U[H];if(typeof te!="number")return te.index=ee,te;const J=this.#le(te);return J.index=ee,J}#le(H){let ee=this.#h.get(H);ee||(ee=this.#s.leaf(this.#j(H),H),this.#h.set(H,ee));const te=this.#R?this.#R.get(H):null;if(te){ee.level=te.level,ee.posinset=te.posinset,ee.setsize=te.setsize,ee.hasChildren=te.hasChildren,ee.expanded=te.hasChildren&&!te.lazy&&this.#Qe(ee.key);const J=this.#I?this.#I.byPhysical.get(H):void 0;J?ee.totals=J: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}#Fe(H,ee,te){const J=[],ne=[],se=we=>{if(we.leafCount!==void 0)return we.leafCount;let fe=we.physical>=0?1:0;for(const ge of we.children)fe+=se(ge);return we.leafCount=fe,fe},ae=we=>{const fe=this.#Qe(we.key);if(we.physical>=0){if(J.push(we.physical),te&&te.isOpen(this.#le(we.physical).key)){const ge=this.#le(we.physical);ne.push({at:J.length}),J.push(this.#s.detail(ge,te.heightOf(ge)))}}else J.push(this.#s.group({path:[we.key],column:null,value:we.value,level:we.level,parent:null,expanded:fe,hasChildren:we.children.length>0,leafCount:se(we),totals:this.#I?this.#I.byKey.get(we.key):void 0}));if(fe)for(const ge of we.children)ae(ge)};for(const we of H.tree.roots)ae(we);return ee&&ee.grand&&!this.#re()&&(ne.push({at:J.length}),J.push(this.#s.grandTotal(ee.grand,this.#nt(H.leaves.length)))),this.#Y=null,this.#G=R,this.#D=ne.length?ne:R,this.#U=J,J}#$e(){return t(()=>this.count(),H=>this.at(H))}#Pe(H,ee){let te=this.#x.get(H);if(te===void 0){const J=this.#j(H),ne=this.#mt(),se=[],ae=this.#e.columnHidden;for(const we of ne){if(we.quickFilter===!1||z(ae)&&ae(we.id))continue;const fe=we.value&&z(we.value.quickFilterText)?we.value.quickFilterText({value:void 0,data:J,row:null,column:we,colId:we.id,grid:null,context:this.#K("context",null)}):null,ge=fe??(z(we.formatValue)?we.formatValue(z(we.getValue)?we.getValue(J):void 0):"");ge!=null&&ge!==""&&se.push(String(ge))}te=se.join(" ").toLowerCase(),this.#x.set(H,te)}return ee(te)}#Ie(){const H=this.#K("totals",[]),ee=H&&H.length?new Set(H):null;return this.#mt().filter(te=>ee?ee.has(te.id):!!(te.total||te.groupTotal||te.grandTotal))}#Ze(H,ee,te,J="group"){const ne={},se=(this.#e.compute||{}).total;for(const ae of H){if(!E(ae))continue;const we=this.#o.handle(ae.id);if(!we)continue;const fe=S(ae,J);if(fe)if(z(fe)){const ge=new Array(ee.length);for(let je=0;je<ee.length;je++)ge[je]=we.get(ee[je]);ne[ae.id]=fe(ge,{row:te,column:ae,grid:this.#e.grid||null,context:this.#K("context",null),valueAt:(je,Pe)=>{const de=this.#o.handle(je);return de&&Pe>=0&&Pe<ee.length?de.get(ee[Pe]):null}})}else z(se)&&(ne[ae.id]=se(we,ee,fe))}return ne}#lt(H){if(!H)return H;const ee=this.#e.config||{},te={tz:ee.timeZone,weekStartsOn:ee.weekStartsOn};return l(H,J=>{const ne=b(J,te),se=this.#_e(ne&&ne.col),ae=se&&se.type==="datetime";if(ne&&ne.type)return ne.type==="datetime"&&!ne.timeZone&&se?{...ne,timeZone:ee.timeZone||void 0}:ne;if(ae)return{...ne,type:"datetime",timeZone:ee.timeZone||void 0};const we=se&&(se.dataType?.base||se.type);return we?{...ne,type:we}:ne})}#Qe(H,ee){const te=this.#K("expanded",null);return te?z(te.has)?te.has(H,ee):Array.prototype.includes.call(te,H):!0}#K(H,ee){if(H==="context"||!z(this.#e.stateVersion))return this.#ht(H,ee);const te=this.#ct(H),J=this.#f.get(H);if(J&&J.version===te)return J.value;const ne=this.#ht(H,ee);return this.#f.set(H,{version:te,value:ne}),ne}#ht(H,ee){const te=this.#e.state;if(te&&z(te[H])){const J=te[H]();return J??ee}return ee}#pt(){const H=this.#e.stateVersion;return z(H)?H():0}#Rt(){const H=this.#e.columnsVersion,ee=this.#e.permissionsVersion;return`${z(H)?H():0}|${z(ee)?ee():0}`}#ct(H){return H==="totals"?this.#Rt():`${this.#pt()}`}#Et(H,ee,te){if(!z(this.#e.stateVersion))return te();const J=this.#d.get(H);if(J&&J.version===ee)return J.key;const ne=te();return this.#d.set(H,{version:ee,key:ne}),ne}#Ye(H){const ee=(this.#e.compute||{})[H];return z(ee)||L(`ctx.compute.${H} is required by the memory source pipeline`),ee}#mt(){const H=this.#e.columns;return H&&z(H.all)?H.all():[]}#_e(H){const ee=this.#e.columns;return ee&&z(ee.get)?ee.get(H):void 0}#gt(H,ee){const te=this.#e.emit;z(te)&&te(H,ee)}}}),He("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 N}}),Object.defineProperty(e,"AbortScope",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createAbortScope",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return L}});class re extends Error{constructor(z,x="superseded"){super(`[lattice] request ${z?`"${z}" `:""}${x}`),this.name="SupersededError",this.superseded=!0,this.key=z}}class N{#e;constructor(z,x,Y,$){this.#e=z,this.key=x,this.controller=Y,this.signal=Y.signal,this.seq=$}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(z){this.signal.aborted||this.controller.abort(new re(this.key,z)),this.#e.settle(this)}}class G{#e=new Map;#t=0;begin(z="",x="superseded"){const Y=this.#e.get(z);Y&&!Y.signal.aborted&&Y.controller.abort(new re(z,x));const $=new N(this,z,new AbortController,++this.#t);return this.#e.set(z,$),$}tokenFor(z){return this.#e.get(z)}pending(z=""){const x=this.#e.get(z);return!!x&&!x.signal.aborted}get size(){return this.#e.size}settle(z){this.#e.get(z.key)===z&&this.#e.delete(z.key)}abort(z="",x="superseded"){const Y=this.#e.get(z);Y&&Y.abort(x)}abortAll(z="superseded"){for(const x of[...this.#e.values()])x.abort(z);this.#e.clear()}}function F(){return new G}function L(Z){if(!Z||typeof Z!="object")return!1;const z=Z;return z.superseded===!0||z.name==="AbortError"||z.name==="SupersededError"}}),He("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 N}}),Object.defineProperty(e,"BlockCache",{enumerable:!0,get:function(){return F}});const re=100,N=32;class G{constructor(Z){this.id=Z,this.rows=null,this.state="pending",this.token=null,this.error=null}}class F{#e=new Map;#t;#n;#r=0;#i=-1;constructor(Z={}){this.#t=Math.max(1,Math.floor(Number(Z.pageSize)||re)),this.#n=Math.max(1,Math.floor(Number(Z.maxCachedPages)||N))}get pageSize(){return this.#t}get maxBlocks(){return this.#n}get size(){return this.#e.size}blockOf(Z){return Math.floor(Z/this.#t)}rangeOf(Z){return{start:Z*this.#t,end:(Z+1)*this.#t}}has(Z){return this.#e.has(Z)}pending(Z){const z=this.#e.get(Z);return!!z&&z.state==="pending"}loaded(Z){const z=this.#e.get(Z);return!!z&&z.state==="loaded"}begin(Z,z){let x=this.#e.get(Z);return x||(x=new G(Z)),x.state="pending",x.token=z,x.error=null,this.#s(Z,x),x}fill(Z,z){const x=this.#e.get(Z)||new G(Z);x.rows=z,x.state="loaded",x.token=null,this.#s(Z,x)}failed(Z,z){const x=this.#e.get(Z)||new G(Z);x.state="error",x.error=z,x.token=null,this.#s(Z,x)}delete(Z){return this.#e.delete(Z)}rowAt(Z){const z=this.blockOf(Z),x=this.#e.get(z);if(!(!x||x.state!=="loaded"||!x.rows))return this.#s(z,x),x.rows[Z-z*this.#t]}rowLoaded(Z){const z=this.blockOf(Z),x=this.#e.get(z);return!!x&&x.state==="loaded"&&!!x.rows&&Z-z*this.#t<x.rows.length}erroredAt(Z){const z=this.#e.get(this.blockOf(Z));return!!z&&z.state==="error"}loadedExtent(){let Z=0;for(const z of this.#e.values()){if(z.state!=="loaded"||!z.rows)continue;const x=z.id*this.#t+z.rows.length;x>Z&&(Z=x)}return Z}fillOf(Z){const z=this.#e.get(Z);return z&&z.state==="loaded"&&z.rows?z.rows.length:null}protect(Z,z){this.#r=this.blockOf(Math.max(0,Z)),this.#i=this.blockOf(Math.max(0,z))}evict(){const Z=[];if(this.#e.size<=this.#n)return Z;for(const[z,x]of this.#e){if(this.#e.size-Z.length<=this.#n)break;z>=this.#r&&z<=this.#i||x.state!=="pending"&&Z.push(z)}for(const z of Z)this.#e.delete(z);return Z}ids(){return[...this.#e.keys()]}clear(){this.#e.clear()}#s(Z,z){this.#e.delete(Z),this.#e.set(Z,z)}}}),He("packages/core/src/source/pagewindow.js",function(e,D){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return re}});function re(N,G,F,L){const Z=Math.floor(Number(N)||0);if(Z<=0)return null;const z=Math.max(0,Math.floor(Number(G)||0)),x=Math.max(0,Math.floor(Number(F)||0));if(L){const Y=Math.max(1,Math.ceil(x/Z)),$=Math.min(z,Y-1),j=$*Z;return{page:$,pageSize:Z,offset:j,length:Math.max(0,Math.min(Z,x-j)),pageCount:Y,total:x}}return{page:z,pageSize:Z,offset:z*Z,length:Z,pageCount:Math.max(z+2,Math.ceil(x/Z)),total:null}}}),He("packages/core/src/source/paged.js",function(e,D){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"PagedSource",{enumerable:!0,get:function(){return h}});const N=D("packages/core/src/internal/lru.js").Lru,F=D("packages/core/src/internal/predicates.js").isFunction,Z=D("packages/core/src/internal/warn.js").warnOnce,x=D("packages/core/src/internal/schedule.js").settleDebounce,Y=D("packages/core/src/source/abort.js"),$=Y.createAbortScope,j=Y.isAbortError,k=D("packages/core/src/source/blockcache.js"),y=k.BlockCache,c=k.DEFAULT_PAGE_SIZE,m=k.DEFAULT_MAX_CACHED_PAGES,t=D("packages/core/src/source/rows.js").createRowFactory,o=D("packages/core/src/source/filterwire.js"),u=o.wireFilters,d=o.querySignature,i=o.warnHostFilterNotApplied,r=D("packages/core/src/source/pagewindow.js").pageWindow,n=120;function f(l,b){return new h(l,b)}class h{mode="paged";#e;#t;#n;#r=$();#i;#s;#o=new Map;#l=null;#a=null;#c=!1;#u=0;#f="";#d={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(b,a){this.#e=b||{mode:"paged"},this.#t=a||{},this.#n=new y({pageSize:this.#e.pageSize||c,maxCachedPages:this.#e.maxCachedPages||m}),this.#i=t(this.#t),this.#s=new N(this.#n.pageSize*4),this.#h=x((p,w)=>this.#w(p,w),n),this.#f=this.#P(),F(this.#e.fetch)||Z("source.paged.fetch",'source.mode "paged" requires a fetch function; the grid will stay empty.'),i(this.#t)}count(){const b=this.#y();return b?b.length:this.#b()}#b(){if(this.#C(),this.#l!==null)return this.#l;const b=Math.max(this.#u,this.#n.loadedExtent());return this.#c?b:b+this.#n.pageSize}matchCount(){return this.#b()}totalCount(){return this.#b()}pageInfo(){const b=this.#y();if(!b){const a=this.#b();return{page:0,pageSize:0,total:this.exact()?a:null,pageCount:1,counting:!1}}return{page:b.page,pageSize:b.pageSize,total:b.total,pageCount:b.pageCount,counting:b.total===null&&this.#r.size>0&&this.#u===0&&this.#n.loadedExtent()===0}}#y(){const b=this.#b(),a=r(this.#T("pageSize",0),this.#T("page",0),b,this.exact());if(!a)return this.#g="",null;const p=`${this.#m}:${a.offset}:${a.length}`;if(p!==this.#g&&!this.#p&&(this.#g=p,a.length>0)){const w=a.offset+a.length-1;this.#d={start:a.offset,end:w},this.#w(a.offset,w)}return a}at(b){const a=this.#y();if(a){if(b<0||b>=a.length)return;const p=this.#O(a.offset+b);return p&&(p.index=b),p}return this.#O(b)}#O(b){if(b<0||b>=this.#b())return;const a=this.#s.get(b);if(a&&(a.data!==null||!this.#n.rowLoaded(b)))return a;const p=this.#n.rowAt(b);if(p===void 0){const v=this.#i.skeleton(b,0,this.#n.erroredAt(b));return this.#s.set(b,v),v}const w=this.#i.leaf(p,b);return w.index=b,this.#s.set(b,w),this.#o.set(w.key,b),w}byKey(b){const a=this.#o.get(b);return a===void 0?void 0:this.#O(a)}loaded(b){const a=this.#y();return a?b>=0&&b<a.length&&this.#n.rowLoaded(a.offset+b):this.#n.rowLoaded(b)}loadedCount(){this.#C();let b=0;for(const a of this.#n.ids()){if(!this.#n.loaded(a))continue;const p=this.#n.fillOf(a);typeof p=="number"&&(b+=p)}return b}residentRows(){this.#C();const b=this.#y(),a=b?b.offset:0,p=b?b.offset+b.length:1/0,w=[],v=this.#n.ids().sort((P,V)=>P-V);for(const P of v){if(!this.#n.loaded(P))continue;const{start:V}=this.#n.rangeOf(P),W=this.#n.fillOf(P)||0;for(let K=V;K<V+W;K++){if(K<a||K>=p)continue;const R=this.#s.peek(K);if(R&&R.data!==null&&R.data!==void 0){w.push(R);continue}const S=this.#n.rowAt(K);if(S===void 0)continue;const E=this.#i.leaf(S,K);E.index=K,this.#s.set(K,E),this.#o.set(E.key,K),w.push(E)}}return w}hint(b,a){if(this.#p)return;const p=this.#C();let w=Math.max(0,Math.floor(b)),v=Math.max(w,Math.floor(a));const P=this.#y();if(P){if(P.length===0)return;w=P.offset,v=P.offset+P.length-1}this.#d={start:w,end:v},this.#n.protect(w,v);for(const V of this.#n.evict())this.#v(V);this.#h(w,v),p&&this.#h.flush()}#w(b,a){if(this.#p)return;this.#n.protect(b,a);const p=this.#n.blockOf(b),w=this.#n.blockOf(a);for(let v=p;v<=w&&!(this.#l!==null&&v*this.#n.pageSize>=this.#l);v++)this.#n.has(v)||this.#A(v)}apply(b){const a={added:[],updated:[],removed:[]};if(!b)return a;if(b.update)for(const p of b.update){const w=this.#i.keyOf(p,-1),v=this.#o.get(w);if(v===void 0)continue;const P=this.#i.leaf(p,v);P.index=v,this.#s.set(v,P),a.updated.push(P)}return(b.add&&b.add.length||b.remove&&b.remove.length)&&this.reload(),a}reload(b){this.#S("reload"),this.#h.cancel(),this.hint(this.#d.start,this.#d.end)}destroy(){this.#p=!0,this.#h.cancel(),this.#r.abortAll("destroyed"),this.#n.clear(),this.#s.clear(),this.#o.clear()}exact(){return this.#l!==null||this.#c}pending(){return this.#r.size}async#A(b){if(!F(this.#e.fetch))return;const a=this.#r.begin(`block:${b}`);this.#n.begin(b,a);const{start:p,end:w}=this.#n.rangeOf(b),v=this.#f;try{const P=await this.#e.fetch({range:{start:p,end:w},sort:this.#T("sort",[]),filters:u(this.#T("filters",null),this.#E()),quick:this.#T("quick","")||void 0,context:this.#T("context",null),signal:a.signal});if(!a.current||v!==this.#f||this.#p)return;a.settle();const V=P&&P.rows||[];this.#n.fill(b,V);for(let K=0;K<V.length;K++)this.#s.delete(p+K);const W=P&&typeof P.total=="number"?P.total:P&&typeof P.count=="number"?P.count:null;W!==null?(this.#l=W,this.#c=!0):V.length<this.#n.pageSize?(this.#c=!0,this.#l=p+V.length):this.#u=Math.max(this.#u,p+V.length),this.#N("model:changed",{reason:"page",block:b,from:p,to:p+V.length}),this.#N("rows:changed",{companion:!0,reason:"page",block:b,from:p,to:p+V.length}),this.#l!==null&&this.#l!==this.#a&&(this.#a=this.#l,this.#N("source:total",{total:this.#l,groupPath:[]}))}catch(P){if(a.settle(),j(P))return;this.#n.failed(b,P);for(let V=p;V<w;V++)this.#s.delete(V);this.#N("model:changed",{reason:"page-error",block:b,range:{start:p,end:w}}),this.#N("source:error",{error:P,block:b,range:{start:p,end:w}})}}#v(b){const{start:a,end:p}=this.#n.rangeOf(b);for(let w=a;w<p;w++){const v=this.#s.peek(w);v&&this.#o.delete(v.key),this.#s.delete(w)}}#C(){const b=this.#P();return b===this.#f?!1:(this.#f=b,this.#S("query"),!0)}#S(b){this.#r.abortAll(b),this.#n.clear(),this.#s.clear(),this.#o.clear(),this.#l=null,this.#a=null,this.#c=!1,this.#u=0,this.#m++,this.#N("model:changed",{reason:b})}#P(){return d({filters:this.#T("filters",null),sort:this.#T("sort",[]),quick:this.#T("quick",""),context:this.#T("context",null)})}#E(){const b=this.#t.config||{};return{tz:b.timeZone,weekStartsOn:b.weekStartsOn}}#T(b,a){const p=this.#t.state;if(p&&F(p[b])){const w=p[b]();return w??a}return a}#N(b,a){const p=this.#t.emit;F(p)&&p(b,a)}}}),He("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 N}}),Object.defineProperty(e,"fillAggregateSql",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"aggregateP",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"routeAggregate",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"resolveAggregatePlan",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"groupKeysPushable",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"pushdownDocRows",{enumerable:!0,get:function(){return $}});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 N(){const j=new Set;for(const[k,y]of Object.entries(re))y.pushable&&j.add(k);return j}function G(j,k,y,c="?"){let m=j.split("%c").join(k);return y!==void 0&&(m=m.split("%w").join(y)),m.split("%p").join(c)}function F(j){const k=j&&(j.p!==void 0?j.p:j.params&&j.params.p);return typeof k=="number"&&k>=0&&k<=1?k:void 0}function L(j){const k=j||{},y=k.default==="engine"||k.default==="engine-if-identical"?k.default:"client",c={};if(k.overrides&&typeof k.overrides=="object")for(const[m,s]of Object.entries(k.overrides))(s==="engine"||s==="client")&&(c[m]=s);return{default:y,overrides:c}}function Z(j,k){const y=re[j];if(!y||!y.pushable)return"client";const c=k.overrides[j];return c==="engine"||c==="client"?c:k.default==="client"?"client":k.default==="engine-if-identical"?y.class==="identical"?"engine":"client":"engine"}function z(j,k){const y=L(k),c=[],m=[];for(const s of j||[]){const t=re[s.fn],o=Z(s.fn,y),u={id:s.id,col:s.col,fn:s.fn,class:t?t.class:"fallback"};if(s.weight!==void 0&&(u.weight=s.weight),s.params!==void 0&&(u.params=s.params),t&&t.parametric){const d=F(s);d!==void 0&&(u.p=d)}if(o==="engine"&&t&&t.parametric&&u.p===void 0){m.push({...u,reason:`"${s.fn}" needs \`p\`, a number from 0 to 1`});continue}o==="engine"?c.push(u):(u.reason=t&&!t.pushable?t.note||"the engine cannot express this stat":"client by config",m.push(u))}return{engine:c,client:m,config:y}}const x=/^[A-Za-z_][A-Za-z0-9_$]*$/;function Y(j,k=[]){return(j||[]).every(c=>{if(typeof c=="string")return x.test(c);if(!c||typeof c!="object")return!1;const m=c;return Array.isArray(k)&&k.includes(m.bucket)&&typeof m.col=="string"&&x.test(m.col)&&typeof m.size=="number"&&Number.isFinite(m.size)&&m.size>0})}function $(){return Object.entries(re).map(([j,k])=>({stat:j,class:k.class,sql:k.sql?G(k.sql,"col",k.twoColumn?"weight":void 0):"",note:k.note||(k.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),He("packages/core/src/source/pushdown.js",function(e,D){"use strict";Object.defineProperty(e,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"NO_CAPABILITIES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"capabilitiesOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"splitFilters",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"applyResidual",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createPushdownSource",{enumerable:!0,get:function(){return te}});const N=D("packages/core/src/internal/compare.js").defaultCompare,F=D("packages/core/src/internal/predicates.js").isFunction,Z=D("packages/core/src/internal/merge.js").toArray,x=D("packages/core/src/internal/warn.js").warnOnce,Y=D("packages/core/src/source/filterwire.js"),$=Y.isGroup,j=Y.warnWherePageRelative,k=Y.warnWhereOverThreshold,y=Y.wireFilters,c=D("packages/core/src/source/aggregates.js"),m=c.resolveAggregatePlan,s=c.groupKeysPushable,t=c.STAT_PUSHDOWN,o=c.aggregateP,u=c.fillAggregateSql,i=D("packages/core/src/source/abort.js").SupersededError,g=1e3;function r(J){const ne=J&&J.signal;if(!ne||!ne.aborted)return;const se=ne.reason;throw se instanceof Error?se:new i("","superseded before it was sent")}const n=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function f(J){if(!J||typeof J!="object")return!1;const ne=J.returning==="row"||J.returning==="key"?J.returning:"none";return{append:J.append===!0,update:J.update===!0,delete:J.delete===!0,returning:ne}}function h(J,ne){if(!J||typeof ne!="string")return;if(!ne.includes("."))return J[ne];let se=J;for(const ae of ne.split(".")){if(se===null||typeof se!="object")return;se=se[ae]}return se}function l(J){if(J===!0)return!0;if(!J||typeof J!="object")return!1;const ne=J;return ne.enabled===!1?!1:ne.enabled===!0||F(ne.commit)}function b(J){const ne={...n,...J||{}};return ne.operators=new Set(ne.operators||[]),ne.mutate=f(ne.mutate),ne}function a(J,ne){return!J||!J.op||!ne.operators.size?!1:ne.operators.has(J.op)}function p(J,ne){if(!J)return{pushed:null,residual:null};if(!ne.filter)return{pushed:null,residual:J};if(ne.filter==="term"){if($(J)){const fe=J.conditions||[];if(String(J.op)!=="and")return{pushed:null,residual:J};const ge=fe.findIndex(Pe=>!$(Pe)&&a(Pe,ne));if(ge<0)return{pushed:null,residual:J};const je=fe.filter((Pe,de)=>de!==ge);return{pushed:fe[ge],residual:je.length?{op:"and",conditions:je}:null}}return a(J,ne)?{pushed:J,residual:null}:{pushed:null,residual:J}}if(!$(J))return a(J,ne)?{pushed:J,residual:null}:{pushed:null,residual:J};if(String(J.op)!=="and")return(J.conditions||[]).every(ge=>$(ge)?p(ge,ne).residual===null:a(ge,ne))?{pushed:J,residual:null}:{pushed:null,residual:J};const se=[],ae=[];for(const fe of J.conditions||[]){if($(fe)){if(ne.filter==="flat"){ae.push(fe);continue}const ge=p(fe,ne);ge.pushed&&se.push(ge.pushed),ge.residual&&ae.push(ge.residual);continue}(a(fe,ne)?se:ae).push(fe)}const we=fe=>fe.length===0?null:fe.length===1?fe[0]:{op:"and",conditions:fe};return{pushed:we(se),residual:we(ae)}}const w="__lattice_leaves";function v(J){return J.aggregates?J.aggregates instanceof Set?J.aggregates:new Set(Z(J.aggregates)):new Set}function P(J){const ne=v(J);return ne.size?ne.has("count")?J.filter!=="tree"||!J.operators||!J.operators.has("eq")?"the adapter does not declare the `group` capability, and cannot narrow a group's rows by its key (that needs a `tree` filter with the `eq` operator)":"":"the adapter does not declare the `group` capability, and its declared aggregates have no `count` to give each group its row count":"the adapter does not declare the `group` capability"}function V(J,ne,se,ae,we,fe,ge){const je=Array.isArray(J.groupBy)?J.groupBy:[],Pe=Array.isArray(J.groupPath)?J.groupPath:[],de=Array.isArray(J.groupValues)?J.groupValues:null;if(!ne.group){const oe=P(ne);if(oe)return oe}return s(je)?se.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":ae?we?fe&&!fe.conditioned?"a host `where` predicate can only run in the browser, over rows the engine grouped":ge?"fullDataset holds the whole matching set, so the grid groups it itself":!de||de.length!==Pe.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 W="pushdown:pivot-unsupported",K="pushdown:group-unsupported",R=Symbol("lattice.remote.ungroupedLevel");function S(J,ne,se,ae,we,fe){const ge=Array.isArray(J.pivotBy)?J.pivotBy:[],je=Array.isArray(J.groupBy)?J.groupBy:[],Pe=Array.isArray(J.groupPath)?J.groupPath:[],de=Array.isArray(J.groupValues)?J.groupValues:null;return ne.pivot?s(ge)?je.length&&!s(je)?"a grouping key is not a plain column the engine can name in a GROUP BY":se.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":ae?we?fe&&!fe.conditioned?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!de||de.length!==Pe.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 E(J,ne,se=!1){const ae=p(J.filters||null,ne),we=[];ae.residual&&we.push("filter");const fe=J.sort||[],ge=fe.length===0||ne.sort==="multi"&&fe.length>=1||ne.sort==="single"&&fe.length===1;!ge&&fe.length&&we.push("sort");const je=J.quick?String(J.quick):"",Pe=!je||!!ne.quick;Pe||we.push("quick");const de=J.where&&J.where.active?J.where:null;de&&we.push("where");const oe={filters:ae.residual,sort:ge?null:fe,quick:Pe?"":je,where:de},he=!!se,ce=Array.isArray(J.groupBy)&&J.groupBy.length>0,me=ce?V(J,ne,ae,ge,Pe,de,he):"",ye=J.pivotMode!==!1&&Array.isArray(J.pivotBy)&&J.pivotBy.length>0,xe=ye?S(J,ne,ae,ge,Pe,de):"",Se=ye&&xe==="";ye&&!Se&&we.push("pivot");const Te=ye?Se&&ce:ce&&me==="";ce&&!ye&&!Te&&we.push("group");const Be=(Te||Se)&&Array.isArray(J.groupValues)?J.groupValues.length:0;de&&de.conditioned&&(Te||Se)&&(oe.where=null,we.splice(we.indexOf("where"),1));const Ee=Te||ye?!1:he||!!(oe.filters||oe.sort||oe.quick||oe.where)||!ne.range;return{pushed:{...J,filters:ae.pushed,sort:ge?fe:[],quick:Pe?je:"",range:Ee?null:J.range},residual:oe,needsAll:Ee,unpushed:we,full:he,grouped:Te,groupLevel:Be,groupReason:ye?"":me,pivoted:Se,pivotReason:xe}}function O(J){const ne=Array.isArray(J.totals)?J.totals:[],se=J.totalFns&&typeof J.totalFns=="object"?J.totalFns:{},ae=[],we=[];for(const fe of ne){const ge=String(fe),je=se[ge],Pe=typeof je=="string"?je:je&&typeof je.fn=="string"?je.fn:null,de=je&&typeof je=="object"?o(je):void 0,oe=Pe?t[Pe]:null;oe&&oe.parametric&&de===void 0?we.push({id:ge,fn:Pe,class:oe.class,reason:`"${Pe}" needs \`p\`, a number from 0 to 1`}):Pe?!oe||!oe.pushable||!oe.sql?we.push({id:ge,fn:Pe,class:oe?oe.class:"fallback",reason:oe&&oe.note?oe.note:`the pushdown map cannot express "${Pe}"`}):oe.twoColumn?we.push({id:ge,fn:Pe,class:oe.class,reason:`"${Pe}" reduces two columns, and a grouped request carries no weight column`}):ae.push({id:ge,col:ge,fn:Pe,class:oe.class,...de!==void 0?{p:de}:{}}):we.push({id:ge,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:ae,client:we}}function M(J){return{...J,engine:J.engine.map(ne=>{const se=t[ne.fn];if(!se||!se.sql)return ne;const ae=we=>`"${we}"`;return{...ne,sql:u(se.sql,ae(ne.col),ne.weight!==void 0?ae(ne.weight):void 0)}})}}const T=Object.freeze({items:J=>J==null?[]:Array.isArray(J)?J:[J]});function A(J,ne,se){if(!ne)return J;let ae=J;if(ne.filters&&F(se.evaluateFilters)){const we=ae,fe={count:ae.length,handle:Pe=>({id:Pe,get:de=>h(we[de],Pe)}),itemwise:Pe=>we.some(de=>Array.isArray(h(de,Pe)))?T:null},ge=se.evaluateFilters(ne.filters,fe),je=[];for(let Pe=0;Pe<ae.length;Pe++)ge[Pe]&&je.push(ae[Pe]);ae=je}if(ne.where&&ne.where.active&&(ne.whole||j(ne.where.names,"pushdown"),ae=ae.filter(we=>ne.where.passes(we))),ne.quick){const we=ne.quick.toLowerCase();ae=ae.filter(fe=>{if(!fe||typeof fe!="object")return!1;for(const ge of Object.values(fe))if(ge!=null&&String(ge).toLowerCase().includes(we))return!0;return!1})}if(ne.sort&&ne.sort.length&&F(se.sortMulti)){const we=[...new Set(ne.sort.map(Pe=>Pe.col))],fe=ae,ge=we.map(Pe=>({id:Pe,get:de=>h(fe[de],Pe)})),je=se.sortMulti(ge,ne.sort.map(Pe=>({col:Pe.col,dir:Pe.dir})),Uint32Array.from({length:ae.length},(Pe,de)=>de),{});ae=Array.from(je,Pe=>fe[Pe])}return ae}function I(J){return JSON.stringify({filters:J.filters||null,sort:J.sort||[],quick:J.quick||"",groupBy:J.groupBy||[],groupPath:J.groupPath||[],context:J.context??null})}function U(J){if(!J||typeof J!="object")return 16;let ne="";try{ne=JSON.stringify(J)}catch{return 200}return ne.length*2+64}function X(J){const ne=J||{};return{enabled:!!ne.enabled,maxRows:Number.isFinite(ne.maxRows)?ne.maxRows:1e6,maxBytesEstimate:Number.isFinite(ne.maxBytesEstimate)?ne.maxBytesEstimate:512*1024*1024}}const q=5e4;function _(J){return Number.isFinite(J)&&J>=0?J:q}function H(J){return!!J&&F(J.then)}async function ee(J){if(!J||J.total!==void 0||!H(J.pendingTotal))return J;const ne=await J.pendingTotal,{pendingTotal:se,...ae}=J;return typeof ne=="number"?{...ae,total:ne}:ae}function te(J={}){const ne=J.adapter;if(!ne||!F(ne.execute))return x("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...J,mode:"remote",fetch:async()=>({rows:[],total:0})};const se=b(ne.capabilities),ae=ne.capabilities&&Object.getOwnPropertyDescriptor(ne.capabilities,"operators");ae&&F(ae.get)&&Object.defineProperty(se,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(ne.capabilities.operators||[]),set:()=>{}});const we=ne.name||"adapter";let fe=null;const ge=()=>F(ne.ready)?(fe||(fe=Promise.resolve(ne.ready()).then(()=>{Object.assign(se,b(ne.capabilities))},Ce=>{throw fe=null,Ce})),fe):null,je=X(J.fullDataset),Pe=!!J.allowPartialResults,de=_(J.whereRowLimit);let oe=null;const he=J.aggregates;let ce=null,me=null,ye=null,xe=null,Se=null,Te=null,Be=0,Ee=null;const Ge=()=>!je.enabled||!ce?null:(Ee!==ce.key&&(Be++,Ee=ce.key),{rows:ce.rows,version:Be}),Ne=async Ce=>{const Ve=Ce.where&&Ce.where.active?Ce.where:null;if(!Ve)return{request:Ce,probe:null};if(Ve.conditioned){const kt=E(Ce,se,je.enabled);if(kt.grouped||kt.pivoted)return{request:Ce,probe:null}}const{where:_e,...Ke}=Ce,qe=E(Ke,se,je.enabled);if(qe.needsAll)return{request:Ce,probe:null};const st=I(qe.pushed);let ut=null;return(!oe||oe.key!==st)&&(se.total?(r(Ce),ut=await ee(await ne.execute(qe.pushed,Ce)),oe={key:st,size:ut&&typeof ut.total=="number"?ut.total:null}):oe={key:st,size:null}),oe.size!==null&&oe.size<de?{request:Ce,probe:null}:(k(Ve.names,we,oe.size,de),{request:Ke,probe:ut})},ke=async(Ce,Ve)=>{Te=null;const _e=O(Ce.pushed);ye={engine:_e.engine,client:_e.client,groupBy:Ce.pushed.groupBy},_e.client.length&&x(`source.pushdown.group.totals.${we}.${_e.client.map(st=>st.id).join(".")}`,`the ${we} adapter cannot compute the group subtotal for ${_e.client.map(st=>`"${st.id}" (${st.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 Ke=await ne.executeGroupLevel(Ce.pushed,_e.engine,Ve)||{};let qe=Ke.rows||[];return!se.range&&Ve.range&&(qe=qe.slice(Ve.range.start,Ve.range.end)),ze(Ke),Ke.total===void 0?{rows:qe}:{rows:qe,total:Ke.total}},Oe=new Map,Re=64,Le=async(Ce,Ve)=>{Te=null;const _e=Ce.pushed,Ke=_e.groupBy,qe=Array.isArray(_e.groupValues)?_e.groupValues:[],st=qe.length,ut=[..._e.filters?[_e.filters]:[],...Ke.slice(0,st).map((rt,dt)=>({col:rt,op:"eq",value:qe[dt]===void 0?null:qe[dt],caseSensitive:!0}))],kt=ut.length===0?null:ut.length===1?ut[0]:{op:"and",conditions:ut},Pt=Ve.range?Ve.range.start:0;if(st>=Ke.length){const rt={..._e,filters:kt,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},dt=await ee(await ne.execute(rt,Ve))||{};let xt=dt.rows||[];return!se.range&&Ve.range&&(xt=xt.slice(Ve.range.start,Ve.range.end)),typeof dt.total=="number"?{rows:xt,total:dt.total}:{rows:xt}}const Ot=Ke[st],Lt=O(_e),Bt=v(se),Ct=Lt.engine.filter(rt=>Bt.has(rt.fn)),Ut=[...Lt.engine.filter(rt=>!Bt.has(rt.fn)).map(rt=>({id:rt.id,fn:rt.fn,class:rt.class,reason:`the ${we} adapter does not compute "${rt.fn}"`})),...Lt.client];ye={engine:Ct,client:Ut,groupBy:Ke},Ut.length&&x(`source.pushdown.group.totals.${we}.${Ut.map(rt=>rt.id).join(".")}`,`the ${we} adapter cannot compute the group subtotal for ${Ut.map(rt=>`"${rt.id}" (${rt.reason})`).join(", ")}, so those group rows carry no value for that column. A figure computed over anything other than the group would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const rn=[...Ct.map(rt=>({id:rt.id,col:rt.col,fn:rt.fn,...rt.p!==void 0?{p:rt.p}:{}})),{id:w,col:Ot,fn:"count"}],Wt={..._e,filters:kt,range:null},Qt=JSON.stringify([I(Wt),qe,Ot,rn]);let Ze=Pt>0?Oe.get(Qt):void 0;if(!Ze){for(Ze=Promise.resolve(ne.executeGroupedAggregates(Wt,[Ot],rn)),Oe.delete(Qt),Oe.set(Qt,Ze);Oe.size>Re;)Oe.delete(Oe.keys().next().value);Ze.catch(()=>{Oe.get(Qt)===Ze&&Oe.delete(Qt)})}const ct=await Ze||[];r(Ve);const St=rt=>{const dt={};for(const xt of Ct)dt[xt.id]=rt?rt[xt.id]:void 0;return dt},bt=(_e.sort||[]).find(rt=>rt&&rt.col===Ot),yt=bt&&bt.dir==="desc"?-1:1,We=ct.filter(rt=>rt&&rt.level===1).map(rt=>({[Ot]:rt.keys[0]===void 0?null:rt.keys[0],leafCount:Number(rt.values&&rt.values[w])||0,totals:St(rt.values)})).sort((rt,dt)=>yt*N(rt[Ot],dt[Ot]));if(st===0){const rt=ct.find(xt=>xt&&xt.level===0),dt=rt?Number(rt.values&&rt.values[w]):NaN;ze({matchCount:Number.isFinite(dt)?dt:We.reduce((xt,Ft)=>xt+Ft.leafCount,0),...rt?{grand:St(rt.values)}:{}})}const ft=Ve.range?Ve.range.end:We.length;return{rows:We.slice(Pt,ft),total:We.length}},ze=Ce=>{typeof Ce.matchCount=="number"&&(xe=Ce.matchCount,Se=Ce.grand?{totals:Ce.grand,leafCount:Ce.matchCount}:null)},Ye=async(Ce,Ve)=>{Te=null;const _e=O(Ce.pushed);ye={engine:_e.engine,client:_e.client,groupBy:Ce.pushed.groupBy,pivotBy:Ce.pushed.pivotBy},_e.client.length&&x(`source.pushdown.pivot.totals.${we}.${_e.client.map(kt=>kt.id).join(".")}`,`the ${we} adapter cannot compute the pivot cells for ${_e.client.map(kt=>`"${kt.id}" (${kt.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 Ke=await ne.executePivotLevel(Ce.pushed,_e.engine,Ve)||{};let qe=Ke.rows||[];!se.range&&Ve.range&&(qe=qe.slice(Ve.range.start,Ve.range.end)),ze(Ke);const st=Ke.pivot&&typeof Ke.pivot=="object"?Ke.pivot:{},ut={cells:Array.isArray(st.cells)?st.cells:[],...Array.isArray(st.axis)?{axis:st.axis}:{}};return Ke.total===void 0?{rows:qe,pivot:ut}:{rows:qe,total:Ke.total,pivot:ut}},et=Ce=>{x(`source.pushdown.pivot.${we}.${Ce}`,`pushdown:pivot-unsupported: the ${we} adapter cannot pivot this query because ${Ce}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const Ve=new Error(`[lattice] ${W}: the ${we} adapter cannot pivot this query because ${Ce}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw Ve.code=W,Ve.reason=Ce,Ve},tt=(Ce,Ve)=>{const _e={key:Ve,state:"pending",value:null};return Te=_e,Ce.then(Ke=>(Te===_e&&(Te={key:Ve,state:"settled",value:typeof Ke=="number"?Ke:null}),Ke),Ke=>{throw Te===_e&&(Te={key:Ve,state:"failed",value:null}),Ke})};let pt=0,Tt=[];const Rt=()=>pt===0?null:new Promise(Ce=>{const Ve=setTimeout(Ce,g);Tt.push(()=>{clearTimeout(Ve),Ce()})});let ot;const lt=async Ce=>{const Ve=ge();Ve&&await Ve;const Ke=Ce&&Ce.pivotMode!==!1&&Array.isArray(Ce.pivotBy)&&Ce.pivotBy.length>0?{request:Ce,probe:null}:await Ne(Ce);r(Ce);let qe=E(Ke.request,se,je.enabled);if(se.group&&qe.grouped&&!qe.pivoted&&!F(ne.executeGroupLevel)&&(x(`source.pushdown.group.method.${we}`,`the ${we} 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.`),qe=E(Ke.request,{...se,group:!1,aggregates:null},je.enabled)),qe.pivoted&&!F(ne.executePivotLevel)&&(qe=E(Ke.request,{...se,pivot:!1},je.enabled),qe.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),qe.grouped&&!qe.pivoted&&!se.group&&!F(ne.executeGroupedAggregates)&&(x(`source.pushdown.group.aggregates.method.${we}`,`the ${we} 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\`.`),qe=E(Ke.request,{...se,aggregates:null},je.enabled)),me=qe,qe.pivoted)return Ye(qe,Ce);if(qe.pivotReason&&et(qe.pivotReason),qe.grouped)return se.group?ke(qe,Ce):Le(qe,Ce);const ut=!!qe.groupReason&&!qe.full;ut?x(`source.pushdown.group-unsupported.${we}.${qe.groupReason}`,`pushdown:group-unsupported: the ${we} adapter was not asked to group this query because ${qe.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.`):qe.groupReason&&x(`source.pushdown.group.${we}.${qe.groupReason}`,`the ${we} adapter was not asked to group this query because ${qe.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 kt=Wt=>ut?{...Wt,[R]:!0}:Wt;if(!qe.needsAll){const Wt=Ke.probe||await ne.execute(qe.pushed,Ce),Qt=Wt.rows||[];return H(Wt.pendingTotal)&&Wt.total===void 0?kt({rows:Qt,pendingTotal:tt(Wt.pendingTotal,I(qe.pushed))}):(Te=null,!se.total&&Wt.total===void 0?kt({rows:Qt}):kt({rows:Qt,total:Wt.total??Qt.length}))}const Pt=qe.unpushed.filter(Wt=>!(Wt==="where"&&qe.residual.where&&qe.residual.where.anyConditioned));Pt.length&&x(`source.pushdown.residual.${we}.${Pt.join(".")}`,`the ${we} adapter cannot push ${Pt.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 Ot=I(qe.pushed);if(!ce||ce.key!==Ot){const Wt=await ee(await ne.execute(qe.pushed,Ce));Te=null;const Qt=Wt.rows||[];if(qe.full){const Ze=typeof Wt.total=="number"?Math.max(Wt.total,Qt.length):Qt.length;if(Ze>je.maxRows)throw new Error(`[lattice] fullDataset refused: the ${we} adapter's matching set is ${Ze.toLocaleString()} rows, past the configured maxRows of ${je.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=Qt.length*U(Qt[0]);if(ct>je.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${we} adapter's matching set is an estimated ${Math.round(ct/(1024*1024)).toLocaleString()} MB across ${Qt.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(je.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 Wt.total=="number"&&Qt.length<Wt.total){const Ze=!!(qe.residual.filters||qe.residual.quick||qe.residual.sort&&qe.residual.sort.length);if(Ze&&!Pe)throw new Error(`[lattice] the ${we} adapter returned ${Qt.length} of ${Wt.total} matching rows when asked for the whole result, and the query has residual ${qe.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?x(`source.pushdown.partial.residual.${we}`,`the ${we} adapter returned ${Qt.length} of ${Wt.total} matching rows when asked for the whole result, and residual work will run over that fraction. allowPartialResults is set, so the result is used as-is — it may be wrong. The adapter must follow the engine's own paging to be correct.`):x(`source.pushdown.partial.${we}`,`the ${we} adapter returned ${Qt.length} of ${Wt.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}ce={key:Ot,rows:Qt,total:typeof Wt.total=="number"?Wt.total:null}}let Lt=qe;if(qe.residual.where){const Wt=ce.total??ce.rows.length;if(Wt>=de){k(qe.residual.where.names,we,Wt,de);const{where:Qt,...Ze}=Ke.request;Lt=E(Ze,se,je.enabled),me=Lt}}const Bt=ce.total!==null&&ce.rows.length>=ce.total,Ct=A(ce.rows,{...Lt.residual,whole:Bt},J.compute||{}),Ut=Ce.range?Ce.range.start:0,rn=Ce.range?Ce.range.end:Ct.length;return kt({rows:Ct.slice(Ut,rn),total:Ct.length})},ht=async(Ce,Ve,_e)=>{const qe=_e&&_e.waitForPage&&ot&&F(ot.pageForegroundIdle)?ot.pageForegroundIdle():Rt();qe&&await qe;const st=ge();st&&await st;const ut=E(Ce,se,je.enabled);me=ut;const kt=m(Ve,he),Pt=Array.isArray(Ce.groupBy)?Ce.groupBy:[],Ot=Pt.length>0,Lt=!ut.residual.filters&&!ut.residual.quick,Bt=!Ot||s(Pt,se.buckets);let Ct=kt.engine,Ut=kt.client;if(se.aggregates&&Ct.length){const ct=se.aggregates instanceof Set?se.aggregates:new Set(Z(se.aggregates)),St=Ct.filter(bt=>!ct.has(bt.fn));St.length&&(Ct=Ct.filter(bt=>ct.has(bt.fn)),Ut=[...St.map(bt=>({...bt,reason:`the ${we} adapter does not compute "${bt.fn}"`})),...Ut])}const rn=ct=>{Ut=[...Ct.map(St=>({...St,reason:ct})),...Ut],Ct=[]};let Wt="";if(Ct.length&&!Lt){const ct=ut.residual.quick&&!ut.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)";rn(ct),Ot&&(Wt=ct)}else if(Ct.length&&!Bt){const ct="a grouping key the engine cannot form forces all-client (no mixed provenance)";rn(ct),Wt=ct}let Qt={},Ze;if(Ct.length&&(F(Ot?ne.executeGroupedAggregates:ne.executeAggregates)?Ot?Ze=await ne.executeGroupedAggregates(ut.pushed,Pt,Ct)||[]:Qt=await ne.executeAggregates(ut.pushed,Ct)||{}:(x(`source.pushdown.aggregates.${we}${Ot?".grouped":""}`,`the ${we} adapter cannot compute ${Ot?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),rn(`adapter cannot compute ${Ot?"grouped ":""}aggregates`),Ot&&(Wt=`the ${we} adapter cannot compute grouped aggregates`))),Ot){const ct=Ze!==void 0;ct!==ut.grouped&&(me={...ut,grouped:ct,groupReason:ct?"":Wt||ut.groupReason,unpushed:ct?ut.unpushed.filter(St=>St!=="group"):ut.unpushed.includes("group")?ut.unpushed:[...ut.unpushed,"group"]})}return ye={engine:Ct,client:Ut,...Ot?{groupBy:Pt}:{}},{values:Qt,engine:Ct,client:Ut,...Ze!==void 0?{groups:Ze}:{}}},Nt=async Ce=>{pt++;try{return await lt(Ce)}finally{if(pt--,pt===0&&Tt.length){const Ve=Tt;Tt=[];for(const _e of Ve)_e()}}},mt=l(J.edit),be=J.edit&&typeof J.edit=="object"&&F(J.edit.commit);let Me=J.edit;if(mt&&!be)if(se.mutate&&se.mutate.update){const Ce=Ve=>{if(!se.mutate||!se.mutate.update)throw new Error(`[lattice] the ${we} 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 _e={kind:"update",key:String(Ve.key),patch:{[Ve.colId]:Ve.value}};return ne.mutate(_e,Ve.request||{})};Me={...J.edit===!0?{}:J.edit,commit:Ce}}else x(`source.pushdown.readonly.${we}`,`edit is enabled but the ${we} adapter declares mutate: ${se.mutate?"without update":"false"} (read-only by declaration), so no commit is synthesised and the grid stays read-only. Declare \`mutate: { update: true }\` on the adapter to allow cell edits.`);const pe=mt&&se.mutate&&(se.mutate.append||se.mutate.delete)?{append:se.mutate.append===!0,remove:se.mutate.delete===!0,returning:se.mutate.returning,mutate:(Ce,Ve)=>ne.mutate(Ce,Ve||{})}:null,Ae=async Ce=>{const Ve=ge();Ve&&await Ve;const{range:_e,signal:Ke,export:qe,...st}=Ce||{},ut={...st,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:E(ut,se,je.enabled),signal:Ke}};async function*ve(Ce,Ve={}){const{plan:_e,signal:Ke}=await Ae(Ce),qe=Math.max(1,Math.floor(Number(Ve.pageSize))||5e3),st={signal:Ke,stream:!0},ut=Ce&&Ce.range&&Number.isFinite(Number(Ce.range.start))&&Number.isFinite(Number(Ce.range.end))?{start:Math.max(0,Number(Ce.range.start)),end:Math.max(0,Number(Ce.range.end))}:null;if(!_e.needsAll){const Ot=ut?ut.start:0,Lt=ut?ut.end:1/0;for(let Bt=Ot;Bt<Lt;Bt+=qe){r(st);const Ct=Math.min(Bt+qe,Lt),Ut=await ne.execute({..._e.pushed,range:{start:Bt,end:Ct}},st);Ut&&H(Ut.pendingTotal)&&Ut.pendingTotal.then(null,()=>{});const rn=Ut&&Ut.rows||[];if(rn.length&&(yield rn),rn.length<Ct-Bt)return}return}r(st);const kt=await ee(await ne.execute({..._e.pushed,range:void 0},st));let Pt=A(kt&&kt.rows||[],{..._e.residual,whole:!0},J.compute||{});ut&&(Pt=Pt.slice(ut.start,ut.end));for(let Ot=0;Ot<Pt.length;Ot+=qe)yield Pt.slice(Ot,Ot+qe)}const Ie=async Ce=>{const{plan:Ve,signal:_e}=await Ae(Ce);if(!Ve.needsAll&&se.total){r({signal:_e});const qe=await ee(await ne.execute({...Ve.pushed,range:{start:0,end:0}},{signal:_e}));if(qe&&typeof qe.total=="number")return qe.total}let Ke=0;for await(const qe of ve({...Ce,range:void 0}))Ke+=qe.length;return Ke},De=async Ce=>{await ge();const Ve=y(Ce.filters||null,{tz:J.timeZone,weekStartsOn:J.weekStartsOn}),_e=Ce.quick?String(Ce.quick):"";return p(Ve,se).residual||_e&&!se.quick?null:ne.facets({...Ce,filters:Ve,quick:_e})};return ot={...J,edit:Me,rowMutate:pe,mode:"remote",fetch:Nt,foregroundIdle:Rt,facetProvider:F(ne.facets)?De:void 0,aggregate:ht,countMatching:Ie,streamMatching:ve,capabilitiesOf:b,planQuery:E,wireFilters:y,resolveAggregatePlan:Ce=>m(Ce,he),STAT_PUSHDOWN:t,lastPlan:()=>me?{...me,...ye?{aggregates:M(ye)}:{},...Te?{total:{deferred:!0,state:Te.state,value:Te.value}}:{}}:null,fullFrame:Ge,counts:()=>({match:xe,total:xe,pending:!!Te&&Te.state==="pending"}),grandTotals:()=>Se},ot}}),He("packages/core/src/source/remote.js",function(e,D){"use strict";Object.defineProperty(e,"PROTOCOL",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return M}});const N=D("packages/core/src/internal/lru.js").Lru,F=D("packages/core/src/internal/predicates.js").isFunction,Z=D("packages/core/src/internal/warn.js").warnOnce,x=D("packages/core/src/internal/schedule.js").settleDebounce,Y=D("packages/core/src/source/abort.js"),$=Y.createAbortScope,j=Y.isAbortError,k=D("packages/core/src/source/blockcache.js"),y=k.BlockCache,c=k.DEFAULT_PAGE_SIZE,m=k.DEFAULT_MAX_CACHED_PAGES,s=D("packages/core/src/source/rows.js"),t=s.createRowFactory,o=s.groupKey,u=D("packages/core/src/source/filterwire.js"),d=u.wireFilters,i=u.querySignature,g=u.warnHostFilterNotApplied,n=D("packages/core/src/source/pagewindow.js").pageWindow,h=D("packages/core/src/source/memory.js").MemorySource,b=D("packages/core/src/compute/handle.js").valueComparator,a=D("packages/core/src/compute/pivot.js"),p=a.pivotKey,w=a.joinPath,v=a.DEFAULT_PATH_SEPARATOR,V=D("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,W=1,K=120,R=1e3;function S(T,A,I){for(let U=0;U<Math.max(T.length,A.length);U++){const X=T[U],q=A[U],_=X==null,H=q==null;if(_||H){if(_&&H)continue;return _?1:-1}const ee=I(X,q);if(ee!==0)return ee}return 0}function E(T,A){return new M(T,A)}class O{constructor(A,I,U,X){this.path=A,this.keyPath=X||A,this.values=[],this.level=I,this.key=o(this.keyPath),this.cache=new y(U),this.count=null,this.complete=!1,this.announced=null,this.counting=!1,this.failed=!1,this.children=new Map,this.row=null,this.flat=!1}}class M{mode="remote";#e;#t;#n;#r;#i=new Map;#s=new Set;#o=$();#l;#a;#c=new Map;#u=[];#f=null;#d="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#O="";#w=null;#A=-1;constructor(A,I){this.#e=A||{mode:"remote"},this.#t=I||{},F(this.#e.fullFrame)&&(this.filteredIndices=()=>this.#I(),this.unfilteredIndices=()=>this.#V(),this.handleFor=ee=>this.#W(ee),this.display=()=>this.#x(),this.grandTotalRow=()=>this.#U(),this.unfilteredRows=()=>this.#D(),this.facetIndices=ee=>this.#q(ee));const U=this.#e.counts;F(U)&&(this.matchCount=()=>this.#Y("match"),this.totalCount=()=>this.#Y("total"));const X=this.#e.grandTotals;F(X)&&(this.grandTotalRow=()=>this.#G());const q=this.#e.foregroundIdle;F(q)&&(this.foregroundIdle=()=>this.#he(q),this.#e.pageForegroundIdle=()=>this.#b?this.#he(q):null);const _=this.#e.facetProvider;F(_)&&(this.facetProvider=_);const H=this.#e;F(H.countMatching)&&F(H.streamMatching)&&(this.selectionQuery=()=>this.#_(),this.countMatching=ee=>H.countMatching(ee),this.streamMatching=(ee,te)=>H.streamMatching(ee,te),this.loadedRows=()=>this.#be(),this.resident=()=>this.#M()!==null),this.#n={pageSize:this.#e.pageSize||c,maxCachedPages:this.#e.maxCachedPages||m},this.#l=t(this.#t),this.#a=new N(this.#n.pageSize*4),this.#h=x((ee,te)=>this.#T(ee,te),K),this.#r=new O([],0,this.#n),this.#i.set(this.#r.key,this.#r),this.#d=this.#ve(),F(this.#e.fetch)||Z("source.remote.fetch",'source.mode "remote" requires a fetch function; the grid will stay empty.'),this.#me()}count(){const A=this.#S();return A?A.length:this.#v()}#v(){const A=this.#M();return A?A.count():(this.#ee(),this.#xe(this.#r))}#C(){if(this.#M())return!0;const A=I=>{if(I.count===null&&!I.complete)return!1;for(const U of I.children.values())if(this.#ke(U.key,this.#Te(U))&&!A(U))return!1;return!0};return A(this.#r)}pageInfo(){const A=this.#S(),I=this.totalPending();if(!A){const U=this.#v();return{page:0,pageSize:0,total:this.#C()?U:null,pageCount:1,counting:I}}return{page:A.page,pageSize:A.pageSize,total:A.total,pageCount:A.pageCount,counting:I||A.total===null&&this.#o.size>0&&this.#r.cache.loadedExtent()===0}}#S(){const A=this.#v(),I=n(this.#$("pageSize",0),this.#$("page",0),A,this.#C());if(!I)return this.#O="",null;const U=`${this.#y}:${I.offset}:${I.length}`;return U!==this.#O&&!this.#p&&(this.#O=U,I.length>0&&!this.#M()&&this.#T(I.offset,I.offset+I.length-1)),I}at(A){const I=this.#S();if(I){if(A<0||A>=I.length)return;const U=this.#P(I.offset+A);return U&&(U.index=A),U}return this.#P(A)}#P(A){const I=this.#M();if(I)return I.at(A);if(this.#ee(),A<0||A>=this.#v())return;const U=this.#Z(this.#r,A);if(!U)return;const X=this.#z(U.node,U.local);return X&&(X.index=A),X||this.#l.skeleton(A,U.node.level,U.node.cache.erroredAt(U.local))}byKey(A){const I=this.#M();if(I)return I.byKey(A);const U=this.#c.get(A);if(!U)return;const X=U.lastIndexOf(":"),q=this.#i.get(U.slice(0,X));return q&&this.#z(q,Number(U.slice(X+1)))||void 0}loaded(A){const I=this.#S();if(I){if(A<0||A>=I.length)return!1;A+=I.offset}const U=this.#M();if(U)return U.loaded(A);if(A<0||A>=this.#v())return!1;const X=this.#Z(this.#r,A);return!!X&&X.node.cache.rowLoaded(X.local)}hint(A,I){if(this.#p)return;this.#b=!0;const U=this.#ee();let X=Math.max(0,Math.floor(A)),q=Math.max(X,Math.floor(I));const _=this.#S();if(_){if(_.length===0)return;X=_.offset,q=_.offset+_.length-1}for(const[H,ee]of this.#E(X,q)){H.cache.protect(ee.min,ee.max);for(const te of H.cache.evict())this.#Ee(H,te)}this.#h(X,q),U&&this.#h.flush()}#E(A,I){const U=this.#v(),X=new Map;for(let q=A;q<=I&&q<U;q++){const _=this.#Z(this.#r,q);if(!_)continue;const H=X.get(_.node);H?(H.min=Math.min(H.min,_.local),H.max=Math.max(H.max,_.local)):X.set(_.node,{min:_.local,max:_.local})}return X.size||X.set(this.#r,{min:A,max:A}),X}#T(A,I){if(!this.#p)for(const[U,X]of this.#E(A,I)){U.cache.protect(X.min,X.max);const q=U.cache.blockOf(X.min),_=U.cache.blockOf(X.max);for(let H=q;H<=_&&!(U.count!==null&&H*U.cache.pageSize>=U.count);H++)U.cache.has(H)||this.#fe(U,H)}}apply(A){const I={added:[],updated:[],removed:[]};if(!A)return I;if(A.update)for(const U of A.update){const X=this.#c.get(this.#l.keyOf(U,-1));if(!X)continue;this.#a.delete(X);const q=X.lastIndexOf(":"),_=this.#i.get(X.slice(0,q));if(!_)continue;const H=Number(X.slice(q+1)),ee=_.cache.blockOf(H);if(!_.cache.loaded(ee))continue;const{start:te}=_.cache.rangeOf(ee),J=[];for(let se=te;se<te+_.cache.pageSize;se++){const ae=_.cache.rowAt(se);if(ae===void 0)break;J.push(se===H?U:ae)}_.cache.fill(ee,J);const ne=this.#z(_,H);ne&&I.updated.push(ne)}return(A.add&&A.add.length||A.remove&&A.remove.length)&&this.reload({keepExpanded:!0}),I}reload(A){this.#o.abortAll("reload"),this.#h.cancel(),A&&A.keepExpanded===!1&&this.#s.clear(),this.#pe(),this.#B("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#o.abortAll("destroyed"),this.#pe(),this.#i.clear(),this.#s.clear(),this.#w&&F(this.#w.destroy)&&this.#w.destroy(),this.#w=null}expand(A){this.#s.has(A)||(this.#s.add(A),this.#B("group:toggled",{key:A,expanded:!0}),this.#B("model:changed",{reason:"expand",key:A}))}collapse(A){this.#s.delete(A)&&(this.#B("group:toggled",{key:A,expanded:!1}),this.#B("model:changed",{reason:"collapse",key:A}))}expandedKeys(){return[...this.#s]}pivotFields(){return this.#u}pivot(){this.#ee();const A=this.#f;if(!A||!A.keys.size||!this.#$("pivotBy",[]).length)return null;if(!A.result){const I=b((this.#t.config||{}).locale),U=[...A.keys.entries()].sort((q,_)=>S(q[1],_[1],I)),X=U.map(([q])=>q);A.result={keys:U.map(([,q])=>q),paths:X,fields:this.#Ce(X),groupPaths:[],columns:X.length*Math.max(1,this.#ye().length),values:A.cells,cells:A.cells,error:null}}return A.result}invalidateHandles(){this.#w&&(F(this.#w.invalidateHandles)&&this.#w.invalidateHandles(),F(this.#w.invalidate)&&this.#w.invalidate("filter"))}#N(){const A=this.#e.fullFrame;return F(A)?A():null}#M(){const A=this.#N();return A?(this.#w||(this.#w=new h({mode:"memory"},this.#R())),A.version!==this.#A&&(this.#w.setRows(A.rows),this.#A=A.version),this.#w):null}#R(){const A=this.#t,I=A.state||{};return{...A,state:{...I,page:()=>0,pageSize:()=>0}}}#I(){const A=this.#M();return A?A.filteredIndices():new Uint32Array(0)}#V(){const A=this.#M();return A?A.unfilteredIndices():new Uint32Array(0)}#W(A){const I=this.#M();return I?I.handleFor(A):void 0}#x(){const A=this.#M();return A?A.display():[]}#q(A){const I=this.#M();return I&&F(I.facetIndices)?I.facetIndices(A):new Uint32Array(0)}#U(){const A=this.#M();return A&&F(A.grandTotalRow)?A.grandTotalRow():null}#Y(A){const I=this.#M();if(I){const _=A==="match"?I.matchCount:I.totalCount;if(F(_))return _.call(I)}const U=this.#e.counts,X=F(U)?U():null,q=X?X[A]:null;return typeof q=="number"?q:this.#v()}#G(){const A=this.#M();if(A&&F(A.grandTotalRow))return A.grandTotalRow();if((this.#t.config||{}).grandTotalRow!=="bottom")return null;const U=this.#e.grandTotals,X=F(U)?U():null;return!X||!X.totals?null:this.#l.grandTotal(X.totals,X.leafCount||0)}#D(){const A=this.#M();if(A&&F(A.unfilteredRows))return A.unfilteredRows();const I=[],U=this.count();for(let X=0;X<U;X++){const q=this.at(X);q&&I.push(q)}return I}#_(){const A=this.#$("quick",""),I={protocol:W,groupPath:[],groupValues:[],groupBy:[],totals:[],totalFns:{},pivotBy:[],pivotMode:!1,filters:d(this.#$("filters",null),this.#de()),sort:this.#$("sort",[]),context:this.#$("context",null)};A&&(I.quick=A);const U=this.#$("where",null);return U&&U.active&&(I.where=U),I}#be(){const A=this.#$("groupBy",[]).length,I=[];for(const U of this.#i.values())if(!(U.level!==A&&!U.flat))for(const X of U.cache.ids()){if(!U.cache.loaded(X))continue;const{start:q,end:_}=U.cache.rangeOf(X);for(let H=q;H<_&&U.cache.rowLoaded(H);H++){const ee=this.#z(U,H);ee&&!ee.group&&I.push(ee)}}return I}loadedCount(){const A=this.#M();if(A){const X=A.matchCount();return typeof X=="number"?X:A.count()}this.#ee();const I=this.#$("groupBy",[]).length;let U=0;for(const X of this.#i.values())if(!(X.level!==I&&!X.flat))for(const q of X.cache.ids()){if(!X.cache.loaded(q))continue;const _=X.cache.fillOf(q);typeof _=="number"&&(U+=_)}return U}residentRows(){const A=this.#M();return A?A.display():this.#$("groupBy",[]).length>0?null:(this.#ee(),this.#be())}#ce(A,I,U){const{start:X,end:q}=A.cache.rangeOf(I),_=this.#$("groupBy",[]),H=this.#$("pivotBy",[]),ee=this.#$("quick",""),te=this.#ye(),J={protocol:W,range:{start:X,end:q},groupPath:A.path,groupValues:A.values,groupBy:_,totals:te,totalFns:this.#Ae(te),pivotBy:H,pivotMode:H.length>0,filters:d(this.#$("filters",null),this.#de()),sort:this.#$("sort",[]),context:this.#$("context",null),signal:U};ee&&(J.quick=ee);const ne=this.#$("where",null);return ne&&ne.active&&(J.where=ne),J}async#fe(A,I){if(!F(this.#e.fetch))return;if(!this.#m){this.#m=!0;const _=this.#g;this.#g=[],queueMicrotask(()=>{for(const H of _)H()})}const U=this.#o.begin(`${A.key}:${I}`);A.cache.begin(I,U);const X=this.#d,{start:q}=A.cache.rangeOf(I);try{const _=await this.#e.fetch(this.#ce(A,I,U.signal));if(!U.current||X!==this.#d||this.#p)return;U.settle();const H=_&&_.rows||[];if(!!(_&&_[V])&&!A.flat){A.flat=!0,A.children.clear();for(const[ne,se]of[...this.#c])se.startsWith(`${A.key}:`)&&(this.#a.delete(se),this.#c.delete(ne))}A.cache.fill(I,H),A.failed=!1;for(let ne=0;ne<H.length;ne++)this.#a.delete(`${A.key}:${q+ne}`);const te=_&&typeof _.count=="number"?_.count:_&&typeof _.total=="number"?_.total:null,J=_&&F(_.pendingTotal?.then)?_.pendingTotal:null;te!==null?(A.count=te,A.complete=!0):H.length<A.cache.pageSize?(A.count=q+H.length,A.complete=!0):J&&(A.counting=!0,A.announced=null),_&&Array.isArray(_.pivotFields)&&this.#Re(_.pivotFields),_&&_.pivot&&typeof _.pivot=="object"&&this.#ie(_.pivot),this.#B("model:changed",{reason:"page",groupPath:A.path,block:I}),this.#B("rows:changed",{companion:!0,reason:"page",groupPath:A.path,block:I}),this.#re(A),J&&this.#Ne(A,J,X)}catch(_){if(U.settle(),j(_))return;A.cache.failed(I,_),A.failed=!0;const{end:H}=A.cache.rangeOf(I);for(let ee=q;ee<H;ee++)this.#a.delete(`${A.key}:${ee}`);this.#B("model:changed",{reason:"page-error",groupPath:A.path,block:I}),this.#B("source:error",{error:_,groupPath:A.path,block:I})}}async#Ne(A,I,U){let X;try{X=await I}catch(q){if(U!==this.#d||this.#p)return;A.counting=!1,j(q)||(A.failed=!0),j(q)||this.#B("source:error",{error:q,groupPath:A.path});return}U!==this.#d||this.#p||(A.counting=!1,typeof X=="number"&&(A.count=X,A.complete=!0,this.#re(A),this.#B("model:changed",{reason:"total",count:X,groupPath:A.path})))}#re(A){typeof A.count!="number"||!A.complete||A.announced!==A.count&&(A.announced=A.count,this.#B("source:total",{total:A.count,groupPath:A.path}))}#he(A){if(this.#p)return null;this.#ee();const I=this.#m?null:new Promise(H=>{this.#g.push(H),setTimeout(H,R)}),U=A();if(!I&&!U)return null;const X=(async()=>{I&&await I;for(let H=A();H;H=A())await H})();let q;const _=new Promise(H=>{q=setTimeout(H,R)});return Promise.race([X,_]).then(()=>clearTimeout(q))}totalPending(){if(this.#r.failed)return!1;if(this.#r.counting===!0)return!0;if(this.#M())return!1;this.#ee();const A=this.#r;return A.count===null&&!A.complete&&A.cache.loadedExtent()===0}totalFailed(){return this.#r.failed===!0}#Re(A){A.length===this.#u.length&&A.every((I,U)=>I===this.#u[U])||(this.#u=A,this.#B("column:pivoted",{pivotFields:A,remote:!0}))}#Be(){const A=this.#t.config||{};return A.pivot&&A.pivot.separator||v}#Ce(A){const I=this.#Be(),U=this.#ye();if(!U.length)return A.slice();const X=[];for(const q of A)for(const _ of U)X.push(`${q}${I}${_}`);return X}#ie(A){const I=this.#Be();this.#f||(this.#f={keys:new Map,cells:new Map,result:null});const U=this.#f;let X=!1;const q=H=>{const ee=Array.isArray(H)?H:[H],te=w(ee,I);return U.keys.has(te)||(U.keys.set(te,ee),X=!0),te},_=this.#$("groupBy",[]).length>0;for(const H of Array.isArray(A.axis)?A.axis:[])q(H);for(const H of Array.isArray(A.cells)?A.cells:[]){if(!H||typeof H!="object")continue;const ee=q(H.pivot);if(_&&!(Array.isArray(H.group)&&H.group.length))continue;const te=w(Array.isArray(H.group)?H.group:[],I);for(const[J,ne]of Object.entries(H.values||{}))U.cells.set(p(te,ee,J),ne)}U.result=null,X&&this.#Re((this.pivot()||{fields:[]}).fields)}#xe(A){let I=this.#oe(A);for(const U of A.children.values())this.#ke(U.key,this.#Te(U))&&(I+=this.#xe(U));return I}#oe(A){if(A.count!==null)return A.count;const I=A.cache.loadedExtent();return A.complete?I:A.row&&A.row.leafCount>0?A.level>=this.#$("groupBy",[]).length?Math.max(I,A.row.leafCount):I===0?1:Math.min(I+A.cache.pageSize,Math.max(I,A.row.leafCount)):I+A.cache.pageSize}#Z(A,I){let U=I,X=0;const q=[...A.children.entries()].filter(([,H])=>this.#ke(H.key,this.#Te(H))).sort((H,ee)=>H[0]-ee[0]);for(const[H,ee]of q){const te=H-X+1;if(U<te)return{node:A,local:X+U};U-=te,X=H+1;const J=this.#xe(ee);if(U<J)return this.#Z(ee,U);U-=J}const _=this.#oe(A);return X+U<_?{node:A,local:X+U}:null}#z(A,I){const U=`${A.key}:${I}`,X=this.#a.get(U);if(X)return X.group===!0?this.#Q(X):X;const q=A.cache.rowAt(I);if(q===void 0)return null;const _=this.#$("groupBy",[]);let H;if(A.level<_.length&&!A.flat){const ee=_[A.level],te=this.#f!==null&&A.level===_.length-1&&this.#$("pivotBy",[]).length>0,J=this.#te(q,ee),ne=J==null,se=[...A.path,ne?"":String(J)],ae=[...A.keyPath,ne?null:String(J)];if(H=this.#l.group({path:se,keyPath:ae,column:ee,value:J,level:A.level,parent:A.row,leafCount:Number(q.leafCount)||0,expanded:te?!1:this.#ke(o(ae),{key:o(ae),column:ee,value:J,level:A.level,path:se}),...te?{hasChildren:!1}:{}}),H.totals=this.#H(q),H.data=q,!te){let we=this.#i.get(H.key);we?we.row=H:(we=new O(se,A.level+1,this.#n,ae),we.row=H,this.#i.set(we.key,we)),we.values=[...A.values,J],A.children.set(I,we)}}else H=this.#l.leaf(q,I,A.level,A.row);return this.#a.set(U,H),this.#c.set(H.key,U),H}#H(A){const I=A||{};if(I.totals&&typeof I.totals=="object")return I.totals;const U={};for(const X of this.#ye())Object.hasOwn(I,X)&&(U[X]=I[X]);return U}#Q(A){const I=this.#i.get(A.key);if(!I||I.row!==A||A.hasChildren===!1)return A;const U=this.#ke(A.key,this.#Te(I));return A.expanded!==U&&(A.expanded=U),A}#Ee(A,I){const{start:U,end:X}=A.cache.rangeOf(I);for(let q=U;q<X;q++){const _=`${A.key}:${q}`,H=this.#a.peek(_);H&&this.#c.delete(H.key),this.#a.delete(_)}}#ee(){const A=this.#ve();return A===this.#d?!1:(this.#d=A,this.#o.abortAll("query"),this.#pe(),this.#m=!1,this.#B("model:changed",{reason:"query"}),!0)}#pe(){for(const A of this.#i.values())A.cache.clear(),A.count=null,A.complete=!1,A.announced=null,A.counting=!1,A.failed=!1,A.children.clear(),A.flat=!1;this.#a.clear(),this.#c.clear(),this.#y++,this.#f=null}#ve(){const A=this.#$("where",null);return`${i({filters:this.#$("filters",null),sort:this.#$("sort",[]),quick:this.#$("quick",""),groupBy:this.#$("groupBy",[]),pivotBy:this.#$("pivotBy",[]),context:this.#$("context",null)})}|${A?A.version:0}`}#ke(A,I){const U=this.#$("expanded",null);return U?F(U.has)?U.has(A,I):Array.prototype.includes.call(U,A):this.#s.has(A)}#Te(A){if(A.row)return{key:A.key,column:A.row.column,value:A.row.value,level:A.level-1,path:A.path}}#ye(){const A=this.#$("totals",[]);if(A&&A.length)return[...A];const I=this.#t.columns;return!I||!F(I.all)?[]:I.all().filter(U=>!!U.total).map(U=>U.id)}#Ae(A){const I=this.#t.columns,U={};if(!I||!F(I.get))return U;for(const X of A){const q=I.get(X);if(!q)continue;const _=q.groupTotal!=null?q.groupTotal:q.total;typeof _=="string"?U[X]=_:_&&typeof _=="object"&&typeof _.fn=="string"&&(U[X]={..._})}return U}#te(A,I){const U=this.#t.columns,X=U&&F(U.get)?U.get(I):void 0;return X&&F(X.getValue)?X.getValue(A):A?.[I]}#me(){g(this.#t)}#de(){const A=this.#t.config||{};return{tz:A.timeZone,weekStartsOn:A.weekStartsOn}}#$(A,I){const U=this.#t.state;if(U&&F(U[A])){const X=U[A]();return X??I}return I}#B(A,I){const U=this.#t.emit;F(U)&&U(A,I)}}}),He("packages/core/src/source/gapbuffer.js",function(e,D){"use strict";Object.defineProperty(e,"GapBuffer",{enumerable:!0,get:function(){return N}});const re=64;class N{#e;#t=0;#n=0;constructor(F=re){this.#e=new Uint32Array(Math.max(1,F)),this.#n=this.#e.length}static from(F,L=re){const Z=new N(F.length+Math.max(1,L));return Z.#e.set(F,0),Z.#t=F.length,Z.#n=Z.#e.length,Z}get length(){return this.#t+(this.#e.length-this.#n)}get capacity(){return this.#e.length}at(F){return F<0||F>=this.length?0:F<this.#t?this.#e[F]:this.#e[F+(this.#n-this.#t)]}insert(F,L){const Z=F<0?0:F>this.length?this.length:F;this.#r(Z),this.#t===this.#n&&this.#i(),this.#e[this.#t++]=L}push(F){this.insert(this.length,F)}removeAt(F){return!Number.isInteger(F)||F<0||F>=this.length?!1:(this.#r(F),this.#n++,!0)}toArray(){const F=new Uint32Array(this.length);return F.set(this.#e.subarray(0,this.#t),0),F.set(this.#e.subarray(this.#n),this.#t),F}clear(){this.#t=0,this.#n=this.#e.length}#r(F){if(F!==this.#t)if(F<this.#t){const L=this.#t-F;this.#e.copyWithin(this.#n-L,F,this.#t),this.#t=F,this.#n-=L}else{const L=F-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+L),this.#t=F,this.#n+=L}}#i(){const F=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-F),this.#e=L,this.#n=L.length-F}}}),He("packages/core/src/store/ingest.js",function(e,D){"use strict";Object.defineProperty(e,"INGEST_DEFAULTS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"inferKind",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"decideText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"createReaders",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"Ingest",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return d}});const re=D("packages/core/src/internal/schedule.js"),N=re.now,G=re.nextFrame,F=D("packages/core/src/internal/warn.js"),L=F.infoOnce,Z=F.warnOnce,x=D("packages/core/src/internal/predicates.js").isFunction,$=D("packages/core/src/internal/paths.js").pathGetter,k=D("packages/core/src/store/columnstore.js").ColumnStore,y=Object.freeze({chunkMs:8,chunkRows:512,sampleSize:100,dictionaryRatio:.1,columnarBelow:5e3,initialCapacity:1024});function c(i,g={}){if(g.multi)return"multi";if(i.length===0)return"object";let r=0,n=0,f=0,h=0,l=0;for(let a=0;a<i.length;a++){const p=i[a];typeof p=="number"?r++:typeof p=="boolean"?n++:typeof p=="string"?f++:p instanceof Date?h++:Array.isArray(p)&&l++}const b=i.length;return r===b?"float64":n===b?"bitset":h===b?"float64":f===b?"text":l===b?"multi":"object"}function m(i,g,r){return g<=0||i<r*g?"dictionary":"object"}function s(i,g,r){const n=new Map,f=new Map;for(const W of i){if(W.computed)continue;const K=x(W.read)?W.read:$(W.field||W.id);f.set(W.id,K),n.set(W.id,K)}const h=g?.order??[],l=g?.fns??{},b=g?.deps??{},a=g?.wrapDeps??null,p=h.filter(W=>x(l[W])),w=p.some(W=>b[W]==="*");let v=new WeakMap;const P=W=>{const K={};if(w)for(const[R,S]of f)K[R]=S(W);for(const R of p){const S=b[R];let E;if(S==="*")E=K;else{E={};const O=S||[];for(let M=0;M<O.length;M++){const T=O[M];E[T]=T in K?K[T]:f.get(T)?.(W)}}K[R]=l[R](a?a(E,R):E,{data:W,row:null,column:null,grid:null,context:r})}return K},V=W=>{if(W===null||typeof W!="object"&&typeof W!="function")return P(W);let K=v.get(W);return K===void 0&&(K=P(W),v.set(W,K)),K};for(const W of p)n.set(W,K=>V(K)[W]);return{readers:n,reset(){v=new WeakMap}}}class t{spec;read;kind;inferred;nullable;candidate=!1;distinct=null;change=null;reason="";constructor(g,r){this.spec=g,this.read=r,this.kind="object",this.inferred=!1,this.nullable=g.nullable!==!1}}class o{#e;#t=[];#n=null;#r;#i=0;#s;#o=!1;#l=!1;#a=0;#c;constructor(g,r={},n={}){this.#e=Array.isArray(g)?g:Array.from(g||[]),this.#s={...y,...n};const f=r.columns??[];this.#r=s(f,r.computed??null,r.context),this.#c=this.#e.length>=this.#s.columnarBelow,this.#u(f,r.computed??null),this.#n=new k(this.#t.map(h=>({id:h.spec.id,kind:h.kind,nullable:h.nullable,read:h.read,dictionary:h.spec.dictionary})),{initialCapacity:this.#s.initialCapacity,columnarBelow:this.#s.columnarBelow})}get store(){return this.#n}get done(){return this.#o||this.#l}get progress(){return this.#i}slice(){if(this.done)return!1;if(this.#s.signal?.aborted)return this.#l=!0,!1;const g=N(),{chunkMs:r,chunkRows:n}=this.#s,f=this.#e.length;do{const h=Math.min(this.#i+n,f);this.#n.append(this.#e.slice(this.#i,h)),this.#f(this.#i,h),this.#i=h,this.#r.reset(),this.#h(!1)}while(this.#i<f&&N()-g<r);return this.#a+=N()-g,this.#s.onProgress?.({loaded:this.#i,total:f}),this.#i>=f?(this.#h(!0),this.#o=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(g=>({id:g.spec.id,kind:g.kind,nullable:g.nullable,read:g.read,dictionary:g.spec.dictionary})),decisions:this.#t.map(g=>({id:g.spec.id,kind:g.kind,nullable:g.nullable,inferred:g.inferred,distinct:g.candidate||g.change?this.#d(g):null,change:g.change,reason:g.reason})),count:this.#n.count,elapsed:this.#a,cancelled:this.#l}}#u(g,r){const n=this.#e,f=Math.min(this.#s.sampleSize,n.length),h=this.#s.dictionaryRatio,l=r?.pure instanceof Set?r.pure:new Set(r?.pure??r?.order??[]);for(const b of g){if(!b||!b.id)continue;if(b.computed&&(b.pure===!1||r&&!l.has(b.id))){Z(`ingest.impure.${b.id}`,`column "${b.id}" is an impure computed column and is not materialised into the store`);continue}const a=this.#r.readers.get(b.id)??(x(b.read)?b.read:$(b.field||b.id)),p=new t(b,a);if(b.kind)p.kind=b.kind,p.reason="declared by the caller";else if(b.dictionary)p.kind=b.multi?"multi":"dictionary",p.reason="value table supplied (lookup column)";else{const w=[];for(let P=0;P<f&&w.length<this.#s.sampleSize;P++){const V=a(n[P]);V!=null&&w.push(V)}p.inferred=!0;const v=c(w,{multi:b.multi});if(v==="text"){const P=new Set(w).size;p.kind=m(P,w.length,h),p.candidate=this.#c,p.reason=`sampled ${P} distinct in ${w.length}`}else p.kind=v,p.reason=`inferred from ${w.length} sampled values`,v==="object"&&w.length&&L(`ingest.mixed.${b.id}`,`column "${b.id}" holds mixed or unrecognised value types; storing as an object array. Declare a type to avoid this.`);p.kind==="object"&&p.candidate&&(p.distinct=new Set(w))}this.#t.push(p)}}#f(g,r){const n=this.#e;for(const f of this.#t){if(!f.candidate||!f.distinct)continue;const h=f.distinct;for(let l=g;l<r;l++){const b=f.read(n[l]);b!=null&&h.add(b)}}}#d(g){if(g.distinct)return g.distinct.size;const r=this.#n.column(g.spec.id);return r?.dict?r.dict.size:0}#h(g){const r=this.#s.dictionaryRatio,n=this.#e.length;for(const f of this.#t){if(!f.candidate)continue;const h=this.#d(f);if(f.kind==="dictionary"&&h>=r*n){const l=this.#n.column(f.spec.id);f.distinct=new Set(l?.dict?l.dict.values():[]),this.#n.convert(f.spec.id,"object"),f.kind="object",f.change="demoted",f.reason=`${h} distinct values is at or above ${r*100}% of ${n} rows`;continue}if(f.kind==="object"&&h>=r*n){f.candidate=!1,f.distinct=null,f.reason=`${h} distinct values is at or above ${r*100}% of ${n} rows`;continue}g&&f.kind==="object"&&h<r*n&&(this.#n.convert(f.spec.id,"dictionary"),f.kind="dictionary",f.change=f.change==="demoted"?null:"promoted",f.reason=`${h} distinct values is below ${r*100}% of ${n} rows`,f.distinct=null),g&&(f.candidate=!1)}}}async function u(i,g={},r={}){const n=new o(i,g,r),f=r.scheduler?.frame??G;for(;n.slice();)await new Promise(h=>{f(h)});return n.result()}function d(i,g={},r={}){const n=new o(i,g,{...r,chunkMs:1/0});for(;n.slice(););return n.result()}}),He("packages/core/src/store/columnpack.js",function(e,D){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return m}});const N=D("packages/core/src/internal/paths.js").pathGetter,G=D("packages/core/src/store/ingest.js"),F=G.inferKind,L=G.decideText,Z=G.INGEST_DEFAULTS,x=D("packages/core/src/store/columnstore.js").toFloat,Y=new Set(["float64","int32","bitset","dictionary","object","multi"]);function $(s){if(!Array.isArray(s)||s.length===0)return!1;for(const t of s)if(!t||typeof t.id!="string"||typeof t.field!="string"||t.field===""||t.kind&&!Y.has(t.kind))return!1;return!0}function j(s){const t=x(s);return Number.isFinite(t)?t|0:0}function k(s){return s==null?[]:Array.isArray(s)?s:[s]}function y(s,t,o,u){if(s.kind)return s.kind;const d=[];for(let r=0;r<t.length&&d.length<Z.sampleSize;r++){const n=t[r];n!=null&&d.push(n)}const i=F(d,{multi:s.multi});if(i!=="text")return i;const g=new Set(d).size;return L(g,d.length,u)}function c(s,t,o={}){const u=t.length|0,d=o.dictionaryRatio??Z.dictionaryRatio,i=[];for(const g of s){const r=N(g.field||g.id),n=g.nullable!==!1,f=new Array(u);for(let p=0;p<u;p++){const w=r(t[p]);f[p]=w===void 0?null:w}const h=y(g,f,u,d),l=n?new Uint8Array(u+7>>3):null,b=p=>{l&&(l[p>>3]|=1<<(p&7))};let a;switch(h){case"float64":{const p=new Float64Array(u);for(let w=0;w<u;w++){const v=f[w],P=v===null;P||b(w),p[w]=P?NaN:x(v)}a={id:g.id,kind:h,nullable:n,values:p,presence:l,offsets:null,table:null};break}case"int32":{const p=new Int32Array(u);for(let w=0;w<u;w++){const v=f[w],P=v===null;P||b(w),p[w]=P?0:j(v)}a={id:g.id,kind:h,nullable:n,values:p,presence:l,offsets:null,table:null};break}case"bitset":{const p=new Uint8Array(u+7>>3);for(let w=0;w<u;w++){const v=f[w],P=v===null;P||b(w),!P&&v&&(p[w>>3]|=1<<(w&7))}a={id:g.id,kind:h,nullable:n,values:p,presence:l,offsets:null,table:null};break}case"dictionary":{const p=new Uint32Array(u),w=[],v=new Map;for(let P=0;P<u;P++){const V=f[P];if(V===null){p[P]=0;continue}b(P);let W=v.get(V);W===void 0&&(W=w.length,w.push(V),v.set(V,W)),p[P]=W}a={id:g.id,kind:h,nullable:n,values:p,presence:l,offsets:null,table:w};break}case"multi":{const p=[],w=new Map,v=new Uint32Array(u+1),P=[];for(let V=0;V<u;V++){const W=f[V];v[V]=P.length,W===null||b(V);const R=k(W);for(let S=0;S<R.length;S++){const E=R[S];let O=w.get(E);O===void 0&&(O=p.length,p.push(E),w.set(E,O)),P.push(O)}}v[u]=P.length,a={id:g.id,kind:h,nullable:n,values:Int32Array.from(P),presence:l,offsets:v,table:p};break}default:{const p=new Array(u);for(let w=0;w<u;w++){const v=f[w];v!==null&&b(w),p[w]=v}a={id:g.id,kind:"object",nullable:n,values:p,presence:l,offsets:null,table:null};break}}i.push(a)}return{count:u,columns:i}}function m(s){const t=[];if(!s||!Array.isArray(s.columns))return t;const o=u=>{ArrayBuffer.isView(u)&&u.buffer&&!t.includes(u.buffer)&&t.push(u.buffer)};for(const u of s.columns)o(u.values),o(u.presence),o(u.offsets);return t}}),He("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 E}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return O}});const N=D("packages/core/src/internal/lru.js").Lru,F=D("packages/core/src/internal/predicates.js").isFunction,L=D("packages/core/src/internal/schedule.js"),Z=L.now,z=L.nextFrame,x=L.cancelFrame,Y=L.whenIdle,j=D("packages/core/src/internal/compare.js").defaultCompare,k=D("packages/core/src/internal/warn.js"),y=k.warnOnce,c=k.infoOnce,s=D("packages/core/src/internal/paths.js").getPath,t=D("packages/core/src/source/abort.js"),o=t.createAbortScope,u=t.isAbortError,d=D("packages/core/src/source/rows.js"),i=d.createRowFactory,g=d.lazyRowView,n=D("packages/core/src/source/gapbuffer.js").GapBuffer,h=D("packages/core/src/source/memory.js").createMemorySource,b=D("packages/core/src/source/filterwire.js").querySignature,p=D("packages/core/src/store/columnpack.js").isPortableSchema,w=25e4,v=Symbol("lattice.stream.storeBacked"),P=8,V=.1,W=1e3,K=50;function R(M){return Math.min(W,Math.max(K,Math.floor(M/4)))}function S(M){if(M instanceof Date)return M.getTime();if(typeof M=="number")return Number.isFinite(M)?M:NaN;if(typeof M=="string"){const T=M.trim();if(!T)return NaN;const A=Date.parse(T);return Number.isNaN(A)?Number(T):A}return NaN}function E(M,T){return new O(M,T)}class O{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#i=[];#s=null;#o;#l;#a=new Map;#c=o();#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;#N=1/0;#M=!1;#R=null;#I=null;#V=null;#W=null;#x=!1;#q=0;#U=0;#Y=!1;constructor(T,A){this.#e=T||{mode:"stream"},this.#t=A||{},this.#o=i(this.#t),this.#l=new N(4096),this.#C=this.#Xe();const I=(this.#t.config||{}).ingest;this.#x=!!I&&I.retainSource===!1,F(this.#e.open)||y("source.stream.open",'source.mode "stream" requires an open function; the grid will stay empty.'),this.#e.autoStart!==!1&&queueMicrotask(()=>this.start());const U=Number(this.#e.poll);Number.isFinite(U)&&U>0&&(this.#W=setInterval(()=>{this.#v||this.reload()},U),this.#W&&F(this.#W.unref)&&this.#W.unref()),this.#D()}#G(){const T=Number(this.#e.maxAge);return Number.isFinite(T)&&T>0?T:0}#D(){const T=this.#G();if(!T)return;const A=this.#e.ageBy;F(A)?this.#I=A:typeof A=="string"&&A?this.#I=I=>s(I,A):this.#I=null,this.#T=[],this.#R=setInterval(()=>{this.#v||this.#_()&&(this.#Ee(),this.#B())},R(T)),this.#R&&F(this.#R.unref)&&this.#R.unref()}#_(){const T=this.#G();return!T||!this.#T?!1:this.#M?!0:this.#N<Date.now()-T*(1+V)}#be(T,A){if(!this.#T)return;const I=this.#I?S(this.#I(A)):Date.now();this.#T[T]=I,Number.isNaN(I)||(I<this.#N&&(this.#N=I),I<Date.now()-this.#G()&&(this.#M=!0))}#ce(){return this.#Oe("groupBy",[]).length>0?!0:!!this.#Oe("pivotMode",!1)&&this.#Oe("pivotBy",[]).length>0}#fe(){if(this.#g||this.#v)return;const T=this.#ce();if(T&&!this.#b){this.#b=h({mode:"memory",rows:this.#n},this.#Ne()),this.#O=!1;return}!T&&this.#b&&(this.#b.destroy(),this.#b=null)}#Ne(){if(this.#y)return this.#y;const T=this,A={liveIndices:()=>T.#re(),live:I=>T.#n[I]!==void 0,source:I=>T.#se(I),get physical(){return T.#n.length}};return this.#x&&(A.column=I=>{const U=T.#t.store;return U&&F(U.column)?U.column(I):void 0}),this.#y=Object.create(this.#t,{store:{value:A,enumerable:!0,configurable:!0}}),this.#y}#re(){const T=new Uint32Array(this.#n.length);let A=0;for(let I=0;I<this.#n.length;I++)this.#n[I]!==void 0&&(T[A++]=I);return T.subarray(0,A)}#he(){return this.#g?this.#g:this.#b?(this.#O&&(this.#O=!1,this.#b.setRows(this.#n)),this.#b):null}invalidate(T="filter"){if(this.#g){this.#g.invalidate(T);return}this.#fe(),this.#b&&this.#b.invalidate(T),(T==="filter"||T==="sort")&&this.#ke()}count(){const T=this.#he();return T?T.count():this.#r?this.#r.length:this.#S}matchCount(){const T=this.#he();return T&&F(T.matchCount)?T.matchCount():this.#r?this.#r.length:this.#S}totalCount(){const T=this.#he();return T&&F(T.totalCount)?T.totalCount():this.#S}unfilteredRows(){const T=this.#he();if(T&&F(T.unfilteredRows))return T.unfilteredRows();const A=[];for(let I=0;I<this.#n.length;I++){if(!this.#n[I])continue;const U=this.#je(I);U&&A.push(U)}return A}at(T){const A=this.#he();if(A)return A.at(T);if(T<0||T>=this.count())return;const I=this.#r?this.#r.at(T):T,U=this.#je(I);return U.index=T,U}byKey(T){const A=this.#he();if(A)return A.byKey(T);const I=this.#a.get(T);return I===void 0?void 0:this.#je(I)}leavesOf(T){const A=this.#he();return A&&F(A.leavesOf)?A.leavesOf(T):[]}loaded(T){return T>=0&&T<this.count()}hint(T,A){if(this.#g){this.#g.hint(T,A);return}this.#Re(),this.#p=Math.max(0,Math.floor(T))}#Re(){this.#v||this.#Xe()===this.#C||this.reload()}display(){const T=this.#he();return T?T.display():g(()=>this.count(),A=>this.at(A))}apply(T){if(this.#g)return this.#g.apply(T);const A={added:[],updated:[],removed:[]};if(!T)return A;if(T.update){let I=!1;for(const U of T.update){const X=this.#a.get(this.#o.keyOf(U,-1));if(X===void 0)continue;const q=this.#Ae(X);this.#x?this.#Ve(X,U):this.#n[X]=U,this.#l.delete(X),this.#te(X,q),this.#T&&(this.#be(X,U),I=!0),this.#O=!0,A.updated.push(this.#je(X))}I&&this.#Ee()}if(T.add&&T.add.length){const I=this.#H(T.add);for(const U of I)A.added.push(this.#je(U))}return T.remove&&T.remove.length&&y("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#B(),A}reload(T){this.#c.abortAll("reload"),this.#We(),this.#b&&(this.#b.destroy(),this.#b=null),this.#O=!1,this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear(),this.#g=null,this.#S=0,this.#P=0,this.#E=0,this.#T&&(this.#T=[]),this.#N=1/0,this.#M=!1,this.#w=!1,this.#A=!1,this.#u={loaded:0,estimated:void 0},this.#C=this.#Xe(),this.#Se("model:changed",{reason:"reload"}),this.start()}destroy(){this.#v=!0,this.#W!==null&&(clearInterval(this.#W),this.#W=null),this.#R!==null&&(clearInterval(this.#R),this.#R=null),this.#T=null,this.#c.abortAll("destroyed"),this.#We(),this.#f!==null&&(this.#we(this.#f),this.#f=null),this.#b&&(this.#b.destroy(),this.#b=null),this.#g&&this.#g.destroy(),this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear()}async start(){if(this.#A||this.#v||!F(this.#e.open))return;this.#A=!0;const T=this.#c.begin("stream");this.#ke(),this.#fe();let A;try{A=this.#e.open({sort:this.#Oe("sort",[]),filters:this.#Oe("filters",null),quick:this.#Oe("quick","")||void 0,context:this.#Oe("context",null),signal:T.signal})}catch(U){this.#Se("source:error",{error:U});return}const I=F(A[Symbol.asyncIterator])?A[Symbol.asyncIterator]():A[Symbol.iterator]();this.#V=I;try{for(;;){const U=await I.next();if(!T.current||this.#v)return;if(U.done){this.#$();return}if(await this.#Be(U.value,T),!T.current||this.#v)return;if(U.value&&U.value.done){this.#$();return}if(await this.#ue(),!T.current||this.#v)return}}catch(U){if(u(U))return;this.#Se("source:error",{error:U})}finally{T.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 T=this.#he();T&&(F(T.invalidateHandles)&&T.invalidateHandles(),F(T.invalidate)&&T.invalidate("sort"))}renderCount(){return this.#d}ingestStats(){return{worker:this.#q,inline:this.#U,storeBacked:this.#x}}#Be(T,A){if(!T)return;const I=T.rows;if(I&&I.length&&this.#ie(I))return this.#oe(T,A);const U=Z();I&&I.length&&(this.#H(I),this.#U++),this.#Ce(T),this.#h+=Z()-U,this.#B()}#Ce(T){this.#u.loaded=T.progress&&typeof T.progress.loaded=="number"?T.progress.loaded:this.#n.length,T.progress&&typeof T.progress.estimated=="number"&&(this.#u.estimated=T.progress.estimated)}#ie(T){if(this.#Y||this.#g)return!1;const A=this.#Z();if(!A)return!1;const I=this.#t.store;if(!I||!F(I.appendPacked))return!1;const U=this.#z();return!U||!p(U)?(this.#Y=!0,c("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):T.length<A.threshold?!1:!this.#xe(T)}#xe(T){if(!this.#o.keyed)return!1;const A=new Set;for(let I=0;I<T.length;I++){const U=this.#o.keyOf(T[I],this.#n.length+I);if(U!=null){if(A.has(U)||this.#a.has(U))return!0;A.add(U)}}return!1}async#oe(T,A){const I=T.rows,U=this.#Z(),X=this.#z();let q;try{q=await U.columnize(X,I,{key:"ingest:stream",signal:A&&A.signal})}catch(J){if(u(J)||(y("source.stream.columnize","worker columnization failed; columnizing on the main thread",J),this.#Y=!0,A&&(!A.current||this.#v)))return;this.#H(I),this.#U++,this.#Ce(T),this.#B();return}if(A&&(!A.current||this.#v))return;const _=this.#t.store,H=this.#x?void 0:I,{from:ee}=_.appendPacked(q,H),te=q.count|0;for(let J=0;J<te;J++){const ne=ee+J,se=I[J],ae=this.#o.keyed?this.#o.keyOf(se,ne):null;if(this.#n[ne]=this.#x?v:se,this.#S++,this.#be(ne,se),ae!==null&&this.#a.set(ae,ne),!this.#r||!this.#Te(ne))continue;const we=this.#me(ne);this.#r.insert(we,ne),we<=this.#p&&this.#m++}this.#O=!0,this.#Ee(),this.#q++,this.#Ce(T),this.#B()}#Z(){const T=this.#t.ingestWorker;return F(T)?T():null}#z(){const T=this.#t.storeSchema;return F(T)?T():null}#H(T){const A=[],I=this.#t.store,U=new Array(T.length),X=[],q=new Set;for(let H=0;H<T.length;H++){const ee=this.#o.keyed?this.#o.keyOf(T[H],this.#n.length+X.length):null;U[H]=ee,!(ee!==null&&(this.#a.has(ee)||q.has(ee)))&&(ee!==null&&q.add(ee),X.push(T[H]))}let _=X.length&&I&&F(I.append)?I.append(X).from:this.#n.length;for(let H=0;H<T.length;H++){const ee=T[H],te=U[H];if(te!==null&&this.#a.has(te)){const se=this.#a.get(te),ae=this.#Ae(se);this.#x||(this.#n[se]=ee,I&&F(I.setSource)&&I.setSource(se,ee)),this.#Ve(se,ee),this.#l.delete(se),this.#be(se,ee),this.#te(se,ae);continue}const J=_++;if(this.#n[J]=this.#x?v:ee,this.#S++,this.#be(J,ee),te!==null&&this.#a.set(te,J),A.push(J),!this.#r||!this.#Te(J))continue;const ne=this.#me(J);this.#r.insert(ne,J),ne<=this.#p&&this.#m++}return this.#O=!0,this.#Ee(),A}#Q(T){const A=this.#n[T];let I=!1;if(this.#r){const _=this.#ve(T);_>=0&&_<=this.#p&&(I=!0)}else T<=this.#p&&(I=!0);const U=A===v?this.#se(T):A,X=this.#o.keyed?this.#o.keyOf(U,T):null;X!==null&&this.#a.get(X)===T&&this.#a.delete(X),this.#n[T]=void 0,this.#T&&(this.#T[T]=NaN),this.#l.delete(T);const q=this.#t.store;return q&&F(q.remove)&&q.remove(T),this.#S--,I}#Ee(){let T=0,A=0;const I=this.#pe();T+=I.dropped,A+=I.aboveAnchor;const U=this.#ee();T+=U.dropped,A+=U.aboveAnchor,T&&(this.#O=!0,this.#P+=T,this.#ke(),this.#m-=A,this.#Se("stream:evicted",{evicted:T,total:this.#P,live:this.#S}))}#ee(){const T=this.#e.maxRows;if(!Number.isFinite(T)||T<=0||this.#S<=T)return{dropped:0,aboveAnchor:0};const A=Math.max(1,Math.floor(T*(1-V)));let I=0,U=0;for(;this.#S>A&&this.#E<this.#n.length;){const X=this.#E++;this.#n[X]!==void 0&&(this.#Q(X)&&U++,I++)}return{dropped:I,aboveAnchor:U}}#pe(){const T=this.#G();if(!T||!this.#T||!this.#_())return{dropped:0,aboveAnchor:0};const A=Date.now()-T;let I=0,U=0,X=1/0;for(let q=this.#E;q<this.#n.length;q++){if(this.#n[q]===void 0)continue;const _=this.#T[q];if(!(Number.isNaN(_)||_===void 0)){if(_>=A){_<X&&(X=_);continue}this.#Q(q)&&U++,I++}}for(this.#N=X,this.#M=!1;this.#E<this.#n.length&&this.#n[this.#E]===void 0;)this.#E++;return{dropped:I,aboveAnchor:U}}#ve(T){if(!this.#r)return T;for(let A=0;A<this.#r.length;A++)if(this.#r.at(A)===T)return A;return-1}#ke(){this.#i=this.#Oe("sort",[]),this.#s=this.#Oe("filters",null);const T=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#G()>0,A=this.#Oe("where",null),I=(this.#t.config||{}).hostFilter,U=!!(A&&A.active)||!!(I&&F(I.active)&&I.active());if(!(T||this.#i.length>0||!!this.#s||!!this.#Oe("quick","")||U)){this.#r=null;return}this.#r=new n(Math.max(64,this.#n.length+64));for(let q=0;q<this.#n.length;q++)this.#n[q]!==void 0&&this.#Te(q)&&this.#r.insert(this.#me(q),q)}#Te(T){const A=this.#se(T);if(this.#s&&!this.#ye(this.#s,A))return!1;const I=String(this.#Oe("quick","")||"").toLowerCase();if(I&&!this.#k(A).includes(I))return!1;const U=(this.#t.config||{}).hostFilter;if(U&&F(U.active)&&U.active()&&!U.passes(this.#je(T)))return!1;const X=this.#Oe("where",null);if(X&&X.active){const q=this.#je(T);if(!X.passes(q.data,q.key))return!1}return!0}#ye(T,A){if(!T)return!0;const I=T;if(Array.isArray(I.conditions))return I.op==="or"?I.conditions.some(q=>this.#ye(q,A)):I.op==="not"?!I.conditions.some(q=>this.#ye(q,A)):I.conditions.every(q=>this.#ye(q,A));const U=T,X=(this.#t.compute||{}).testValue;return F(X)?!!X(this.#He(A,U.col),U,(this.#t.config||{}).locale):(y("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#Ae(T){if(!this.#r)return-1;if(!this.#i.length)return this.#ve(T);let A=0,I=this.#r.length;for(;A<I;){const U=A+I>>>1;this.#de(this.#r.at(U),T)<0?A=U+1:I=U}for(let U=A;U<this.#r.length;U++){const X=this.#r.at(U);if(X===T)return U;if(this.#de(X,T)>0)break}return this.#ve(T)}#te(T,A){if(!this.#r||!this.#i.length)return;const I=this.#Te(T);if(A>=0&&this.#r.at(A)===T)this.#r.removeAt(A),A<=this.#p&&this.#m--;else if(A>=0)return;if(!I)return;const U=this.#me(T);this.#r.insert(U,T),U<=this.#p&&this.#m++}#me(T){if(!this.#r||!this.#i.length)return this.#r?this.#r.length:0;let A=0,I=this.#r.length;for(;A<I;){const U=A+I>>>1;this.#de(T,this.#r.at(U))<0?I=U:A=U+1}return A}#de(T,A){const I=this.#se(T),U=this.#se(A);for(const X of this.#i){const q=this.#Le(X.col),_=this.#He(I,X.col),H=this.#He(U,X.col),te=(q&&q.value&&F(q.value.compare)?q.value.compare:j)(_,H);if(te!==0)return X.dir==="desc"?-te:te}return 0}#$(){this.#w=!0,this.#u.loaded=this.#u.loaded||this.#n.length;const T=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:w;!this.#x&&this.#n.length<T&&(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.#B(),this.#Se("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:T})}#B(){this.#f!==null||this.#v||(this.#f=this.#F(()=>{this.#f=null,this.#d++;const T=this.#m;this.#m=0,this.#h=0,this.#Se("stream:chunk",{loaded:this.#u.loaded,estimated:this.#u.estimated,count:this.count(),renders:this.#d}),this.#Se("model:changed",{reason:"stream",shiftAboveViewport:T,anchor:this.#p}),this.#Se("rows:changed",{companion:!0,reason:"stream"})}))}#ue(){return this.#d===0||this.#h<this.#ae()?Promise.resolve():(this.#h=0,new Promise(T=>{const A=(this.#t.scheduler||{}).idle;F(A)?A(()=>T()):Y(()=>T())}))}#ae(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:P}#F(T){const A=this.#t.scheduler||{};return F(A.frame)?A.frame(T):z(T)}#we(T){const A=this.#t.scheduler||{};F(A.cancel)?A.cancel(T):x(T)}#se(T){const A=this.#n[T];if(A!==void 0&&A!==v)return A;if(A===void 0)return;const I=this.#t.store;return I&&F(I.source)?I.source(T):void 0}#Ve(T,A){const I=this.#t.store;if(!I||!F(I.set))return;const U=this.#z();if(Array.isArray(U))for(const X of U){if(!X||!X.id)continue;const q=F(X.read)?X.read:_=>s(_,X.field||X.id);I.set(X.id,T,q(A))}}#je(T){let A=this.#l.get(T);return A||(A=this.#o.leaf(this.#se(T),T),this.#l.set(T,A)),A}#He(T,A){const I=this.#Le(A);return I&&F(I.getValue)?I.getValue(T):T?.[A]}#k(T){const A=this.#t.columns,I=A&&F(A.all)?A.all():[],U=[];for(const X of I){const q=F(X.getValue)?X.getValue(T):void 0;q!=null&&q!==""&&U.push(String(q))}return U.join(" ").toLowerCase()}#Le(T){const A=this.#t.columns;return A&&F(A.get)?A.get(T):void 0}#We(){const T=this.#V;if(this.#V=null,T&&F(T.return))try{T.return()}catch{}}#Xe(){return b({context:this.#Oe("context",null)})}#Oe(T,A){const I=this.#t.state;if(I&&F(I[T])){const U=I[T]();return U??A}return A}#Se(T,A){const I=this.#t.emit;F(I)&&I(T,A)}}}),He("packages/core/src/source/url.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return y}});const N=D("packages/core/src/internal/warn.js").warnOnce,G=D("packages/core/src/internal/predicates.js"),F=G.isObject,L=G.isFunction,z=D("packages/core/src/internal/paths.js").getPath,Y=D("packages/core/src/source/abort.js").isAbortError,$=500,j=new Set(["application/x-ndjson","application/ndjson","application/jsonlines","application/jsonl","application/x-jsonlines","text/x-ndjson"]),k=Symbol("lattice.url.skip");function y(l,b={}){const a=F(b)?b:{},p=L(a.fetch)?a.fetch:typeof globalThis<"u"&&L(globalThis.fetch)?globalThis.fetch:null,w=a.format==="json"||a.format==="ndjson"?a.format:void 0,v=typeof a.rowsPath=="string"&&a.rowsPath?a.rowsPath:void 0,P=L(a.map)?a.map:void 0,V=F(a.headers)?a.headers:void 0,W=Number.isFinite(a.batchSize)&&a.batchSize>0?Math.floor(a.batchSize):$,K=a.lenient===!0,R=Number.isFinite(a.poll)&&a.poll>0?Math.floor(a.poll):void 0,S=typeof l=="string"&&l.length>0;S||N("source.url.url","createUrlSource needs a URL string; the grid will stay empty.");async function*E(M={}){if(!S)return;if(!p)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const T=M&&M.signal;let A;try{A=await p(l,V?{signal:T,headers:V}:{signal:T})}catch(X){throw Y(X)?X:new Error(`[lattice] createUrlSource: request to ${l} failed — ${X&&X.message||X}`)}if(!A||!A.ok){const X=A?A.status:"no response";throw new Error(`[lattice] createUrlSource: ${X} for ${l}`)}const I=c(l,w,A),U=A.body&&L(A.body.getReader)?A.body.getReader():null;try{if(!U){const _=await A.text();(I||t(_,l))==="ndjson"?yield*r(null,null,_,0,A,l,W,K):yield*g(_,l,v,P);return}const X=new TextDecoder("utf-8");if(I==="json"){yield*g(await i(U,X,""),l,v,P);return}if(I==="ndjson"){yield*r(U,X,"",0,A,l,W,K);return}const q=await o(U,X,l);q.format==="json"?yield*g(await i(U,X,q.seed),l,v,P):yield*r(U,X,q.seed,q.bytes,A,l,W,K)}finally{if(U&&L(U.cancel))try{await U.cancel()}catch{}}}const O={mode:"stream",open:E,autoStart:a.autoStart!==!1};return R!==void 0&&(O.poll=R),Number.isFinite(a.maxRows)&&(O.maxRows=a.maxRows),Number.isFinite(a.maxAge)&&(O.maxAge=a.maxAge),(typeof a.ageBy=="string"||L(a.ageBy))&&(O.ageBy=a.ageBy),Number.isFinite(a.coalesceMs)&&(O.coalesceMs=a.coalesceMs),Number.isFinite(a.promoteToMemoryBelow)&&(O.promoteToMemoryBelow=a.promoteToMemoryBelow),O}function c(l,b,a){if(b)return b;const p=m(l);if(p)return p;const w=a&&a.headers&&L(a.headers.get)?a.headers.get("content-type"):null;return s(w)}function m(l){const b=String(l).split(/[?#]/)[0].toLowerCase();if(b.endsWith(".ndjson")||b.endsWith(".jsonl"))return"ndjson";if(b.endsWith(".json"))return"json"}function s(l){if(!l)return;const b=l.split(";")[0].trim().toLowerCase();if(j.has(b))return"ndjson";if(b==="application/json"||b==="text/json"||b.endsWith("+json"))return"json"}function t(l,b){const a=l.replace(/^\s+/,""),p=u(a);if(p==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${b} — pass opts.format: 'json' | 'ndjson'.`);return p}async function o(l,b,a){let p="",w=0;for(;;){const{value:P,done:V}=await l.read();if(P&&(w+=P.byteLength,p+=b.decode(P,{stream:!0})),V){p+=b.decode();break}const W=p.replace(/^\s+/,"");if(W){if(W[0]==="[")return{format:"json",seed:p,bytes:w};if(W[0]!=="{"||p.indexOf(`
|
|
7
|
+
`||g==="\r"){i++;continue}if(g>="0"&&g<="9"){i=k(u,i,d);continue}if(g==="."&&u[i+1]>="0"&&u[i+1]<="9"){i=k(u,i,d);continue}if(g==='"'||g==="'"){i=y(u,i,d);continue}if(g==="["){const n=u.indexOf("]",i+1);if(n<0)throw new Y("a [column reference] was opened and never closed",i);d.push({kind:G,value:u.slice(i+1,n).trim(),at:i}),i=n+1;continue}if(j(g)){i=c(u,i,d);continue}const r=u.slice(i,i+2);if(z.includes(r)){d.push({kind:L,value:r==="!="?"<>":r,at:i}),i+=2;continue}if(x.includes(g)){d.push({kind:L,value:g,at:i}),i++;continue}throw new Y(`unexpected character ${JSON.stringify(g)}`,i)}return d.push({kind:Z,value:null,at:u.length}),d}function j(u){return/[A-Za-z_À-]/.test(u)}function k(u,d,i){let g=d,r=!1;for(;g<u.length;){const n=u[g];if(n>="0"&&n<="9"){g++;continue}if(n==="."&&!r){r=!0,g++;continue}if((n==="e"||n==="E")&&/[0-9+-]/.test(u[g+1]||"")){for(g+=2;g<u.length&&u[g]>="0"&&u[g]<="9";)g++;break}break}return i.push({kind:re,value:Number(u.slice(d,g)),at:d}),g}function y(u,d,i){const g=u[d];let r=d+1,n="";for(;r<u.length;){if(u[r]===g){if(u[r+1]===g){n+=g,r+=2;continue}return i.push({kind:N,value:n,at:d}),r+1}n+=u[r],r++}throw new Y("a string was opened and never closed",d)}function c(u,d,i){let g=d;for(;g<u.length&&/[A-Za-z0-9_.À-]/.test(u[g]);)g++;const r=u.slice(d,g);let n=g;for(;n<u.length&&u[n]===" ";)n++;return i.push({kind:u[n]==="("?F:G,value:r,at:d}),g}const m={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function s(u){const d=String(u??"").replace(/^\s*=/,"");if(!d.trim())throw new Y("the formula is empty");const i=$(d);let g=0;const r=()=>i[g],n=()=>i[g++],f=v=>{const P=r();if(P.kind!==L||P.value!==v)throw new Y(`expected ${JSON.stringify(v)}`,P.at);g++},h=v=>{let P=l();for(;;){const V=r();if(V.kind!==L)break;const W=m[V.value];if(!W||W<v)break;g++;const K=h(V.value==="^"?W:W+1);P={kind:"bin",op:V.value,left:P,right:K}}return P},l=()=>{const v=r();return v.kind===L&&(v.value==="-"||v.value==="+")?(g++,{kind:"unary",op:v.value,arg:l()}):b()},b=()=>{let v=a();for(;r().kind===L&&r().value==="%";)g++,v={kind:"unary",op:"%",arg:v};return v},a=()=>{const v=n();if(v.kind===re)return{kind:"num",value:v.value};if(v.kind===N)return{kind:"str",value:v.value};if(v.kind===G)return{kind:"ref",name:v.value};if(v.kind===F){f("(");const P=[];if(!(r().kind===L&&r().value===")"))for(;;){if(P.push(h(1)),r().kind===L&&r().value===","){g++;continue}break}return f(")"),{kind:"call",name:String(v.value).toUpperCase(),args:P}}if(v.kind===L&&v.value==="("){const P=h(1);return f(")"),P}throw v.kind===Z?new Y("the formula ends unexpectedly",v.at):new Y(`unexpected ${JSON.stringify(v.value)}`,v.at)},p=h(1),w=r();if(w.kind!==Z)throw new Y(`unexpected ${JSON.stringify(w.value)}: is an operator missing?`,w.at);return p}function t(u){const d=new Set,i=g=>{if(!(!g||typeof g!="object")){if(g.kind==="ref"){d.add(String(g.name));return}if(g.kind==="bin"){i(g.left),i(g.right);return}if(g.kind==="unary"){i(g.arg);return}if(g.kind==="call")for(const r of g.args)i(r)}};return i(u),[...d]}function o(u){return typeof u=="string"&&/^\s*=/.test(u)&&u.trim()!=="="}}),He("packages/core/src/formula/evaluate.js",function(e,D){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return k}});const N=D("packages/core/src/formula/parse.js").FormulaError;function G(y){if(y==null||y==="")return 0;if(typeof y=="boolean")return y?1:0;if(y instanceof Date)return y.getTime();const c=typeof y=="number"?y:Number(String(y).replace(/[,\s]/g,""));if(!Number.isFinite(c))throw new N(`${JSON.stringify(y)} is not a number`);return c}function F(y){return y==null?"":String(y)}function L(y){if(typeof y=="boolean")return y;if(y==null||y==="")return!1;if(typeof y=="number")return y!==0;const c=String(y).trim().toLowerCase();return c==="false"||c==="no"||c==="0"?!1:c!==""}function Z(y){const c=[];for(const m of y){if(Array.isArray(m)){for(const s of m)s!=null&&s!==""&&c.push(G(s));continue}m==null||m===""||c.push(G(m))}return c}function z(y,c){const m=10**c,s=y*m;return Math.sign(s)*Math.round(Math.abs(s)+Number.EPSILON*Math.abs(s))/m}function x(y,c){if(!y.length)return 0;const m=y.slice().sort((u,d)=>u-d),s=(m.length-1)*Math.min(1,Math.max(0,c)),t=Math.floor(s),o=Math.ceil(s);return t===o?m[t]:m[t]+(s-t)*(m[o]-m[t])}function Y(y,c){let m=0,s=0,t=0;for(const u of y){m++;const d=u-s;s+=d/m,t+=d*(u-s)}const o=c?m-1:m;return o>0?Math.sqrt(t/o):0}const $={SUM:y=>Z(y).reduce((c,m)=>c+m,0),AVERAGE:y=>{const c=Z(y);return c.length?c.reduce((m,s)=>m+s,0)/c.length:0},MIN:y=>{const c=Z(y);return c.length?Math.min(...c):0},MAX:y=>{const c=Z(y);return c.length?Math.max(...c):0},COUNT:y=>Z(y).length,PRODUCT:y=>Z(y).reduce((c,m)=>c*m,1),ROUND:y=>z(G(y[0]),y.length>1?G(y[1]):0),ROUNDDOWN:y=>{const c=10**(y.length>1?G(y[1]):0),m=G(y[0])*c;return(m<0?Math.ceil(m):Math.floor(m))/c},ROUNDUP:y=>{const c=10**(y.length>1?G(y[1]):0),m=G(y[0])*c;return(m<0?Math.floor(m):Math.ceil(m))/c},ABS:y=>Math.abs(G(y[0])),FLOOR:y=>Math.floor(G(y[0])),CEILING:y=>Math.ceil(G(y[0])),SQRT:y=>Math.sqrt(G(y[0])),POWER:y=>G(y[0])**G(y[1]),MOD:y=>{const c=G(y[1]);if(c===0)throw new N("MOD by zero");return(G(y[0])%c+c)%c},IF:y=>L(y[0])?y[1]:y.length>2?y[2]:!1,AND:y=>y.every(L),OR:y=>y.some(L),NOT:y=>!L(y[0]),COALESCE:y=>y.find(c=>c!=null&&c!=="")??null,CONCAT:y=>y.map(F).join(""),LEN:y=>F(y[0]).length,UPPER:y=>F(y[0]).toUpperCase(),LOWER:y=>F(y[0]).toLowerCase(),TRIM:y=>F(y[0]).trim(),LEFT:y=>F(y[0]).slice(0,y.length>1?G(y[1]):1),RIGHT:y=>{const c=y.length>1?G(y[1]):1;return c<=0?"":F(y[0]).slice(-c)},MEDIAN:y=>x(Z(y),.5),PERCENTILE:y=>{const c=G(y[y.length-1]);return x(Z(y.slice(0,-1)),c>1?c/100:c)},QUARTILE1:y=>x(Z(y),.25),QUARTILE3:y=>x(Z(y),.75),STDEV:y=>Y(Z(y),!0),STDEVP:y=>Y(Z(y),!1),VAR:y=>{const c=Y(Z(y),!0);return c*c},VARP:y=>{const c=Y(Z(y),!1);return c*c},COUNTDISTINCT:y=>{const c=new Set;for(const m of y){const s=Array.isArray(m)?m:[m];for(const t of s)t!=null&&t!==""&&c.add(t)}return c.size},IQR:y=>{const c=Z(y);return x(c,.75)-x(c,.25)}};$.AVG=$.AVERAGE,$.CEIL=$.CEILING,$.POW=$.POWER,$.STDEVS=$.STDEV,$.PERCENTILEINC=$.PERCENTILE;function j(y,c){const m=Number(y),s=Number(c);if(y!==null&&y!==""&&c!==null&&c!==""&&Number.isFinite(m)&&Number.isFinite(s))return m<s?-1:m>s?1:0;const o=F(y).toLowerCase(),u=F(c).toLowerCase();return o<u?-1:o>u?1:0}function k(y,c={}){const m=typeof c.lookup=="function"?c.lookup:null,s=c.functions?{...$,...c.functions}:$,t=o=>{switch(o.kind){case"num":return o.value;case"str":return o.value;case"ref":{if(!m)throw new N(`there is no column called ${JSON.stringify(o.name)} here`);const u=m(String(o.name));if(u===void 0)throw new N(`there is no column called ${JSON.stringify(o.name)}`);return u}case"unary":{if(o.op==="%")return G(t(o.arg))/100;const u=G(t(o.arg));return o.op==="-"?-u:u}case"bin":{const u=o.op;if(u==="=")return j(t(o.left),t(o.right))===0;if(u==="<>")return j(t(o.left),t(o.right))!==0;if(u==="<")return j(t(o.left),t(o.right))<0;if(u==="<=")return j(t(o.left),t(o.right))<=0;if(u===">")return j(t(o.left),t(o.right))>0;if(u===">=")return j(t(o.left),t(o.right))>=0;const d=G(t(o.left)),i=G(t(o.right));if(u==="+")return d+i;if(u==="-")return d-i;if(u==="*")return d*i;if(u==="^")return d**i;if(u==="/"){if(i===0)throw new N("division by zero");return d/i}throw new N(`unknown operator ${JSON.stringify(u)}`)}case"call":{const u=c.lazy&&c.lazy[o.name];if(typeof u=="function")return u(o.args,t,c);const d=s[o.name];if(typeof d!="function")throw new N(`there is no function called ${o.name}`);return d(o.args.map(t),c)}default:throw new N("the formula could not be read")}};return t(y)}}),He("packages/core/src/formula/index.js",function(e,D){"use strict";Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return j}});const re=D("packages/core/src/formula/parse.js"),N=re.parseFormula,G=re.referencesOf,F=re.looksLikeFormula,L=re.FormulaError,Z=re.tokenise,z=D("packages/core/src/formula/evaluate.js"),x=z.evaluateAst,Y=z.FUNCTIONS;function $(k){const{grid:y,row:c,data:m}=k||{},s=i=>String(i).toLowerCase().replace(/[\s_-]/g,""),t=y&&y.columns&&typeof y.columns.all=="function"?y.columns.all():[],o=y&&y.permissions,u=o&&typeof o.isReadable=="function"?i=>o.isReadable(i):()=>!0,d=new Set;for(const i of t)u(i)||(d.add(s(i.id)),i.field&&d.add(s(i.field)),i.title&&d.add(s(i.title)));return i=>{const g=s(i);if(d.has(g))throw new L(`"${i}" cannot be read`);for(const r of t)if(s(r.id)===g||r.field&&s(r.field)===g||r.title&&s(r.title)===g)return c&&y.rows&&typeof y.rows.value=="function"?y.rows.value(c.key,r.id):m?m[r.field||r.id]:void 0;if(m&&typeof m=="object"){for(const r of Object.keys(m))if(s(r)===g){if(!u(r))throw new L(`"${i}" cannot be read`);return m[r]}}}}function j(k,y={}){try{const c=N(k);return{ok:!0,value:x(c,{lookup:$(y),functions:y.formulaFunctions}),references:G(c)}}catch(c){return{ok:!1,error:c instanceof L?c.message:"the formula could not be read",at:c instanceof L?c.at:void 0}}}}),He("packages/core/src/internal/version.js",function(e,D){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return G}});const re="1.111.6";async function N(){return re}const G="1.111.6"}),He("packages/core/src/internal/merge.js",function(e,D){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"mergeRow",{enumerable:!0,get:function(){return z}});const N=D("packages/core/src/internal/predicates.js").isObject;function G(x,Y,$){if(x!==void 0)return x===!0?{enabled:!0,...$}:x===!1?{enabled:!1}:N(x)?x:{[Y]:x,enabled:!0}}function F(x){return x==null?[]:Array.isArray(x)?x:[x]}const L=Object.freeze(new Set(["__proto__","constructor","prototype"]));function Z(x,Y){if(!N(x))return N(Y)?{...Y}:Y;if(!N(Y))return Y===void 0?x:Y;const $={...x};for(const j of Object.keys(Y)){if(L.has(j))continue;const k=Y[j];k!==void 0&&($[j]=N(k)&&N($[j])?Z($[j],k):k)}return $}function z(x,Y){if(!N(x)||!N(Y)||x===Y)return Y;const $=Object.create(Object.getPrototypeOf(x));return Object.assign($,x,Y),$}}),He("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 G}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return z}});function re(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const N=typeof requestAnimationFrame=="function";function G(x){return N?requestAnimationFrame(x):setTimeout(()=>x(re()),16)}function F(x){x!=null&&(N?cancelAnimationFrame(x):clearTimeout(x))}function L(x){let Y=null,$=null;const j=()=>{Y=null;const y=$;$=null,x(...y||[])},k=(...y)=>{$=y,Y===null&&(Y=G(j))};return k.cancel=()=>{F(Y),Y=null,$=null},k.flush=()=>{Y!==null&&(F(Y),j())},k}function Z(x,Y){let $=null,j=null;const k=()=>{if($=null,j===null)return;const m=j;j=null,x(...m),y()},y=()=>{$=setTimeout(k,Y),typeof $?.unref=="function"&&$.unref()},c=(...m)=>{$===null?(x(...m),y()):(j=m,clearTimeout($),y())};return c.flush=()=>{if($!==null&&clearTimeout($),$=null,j===null)return;const m=j;j=null,x(...m)},c.cancel=()=>{$!==null&&clearTimeout($),$=null,j=null},c.pending=()=>$!==null||j!==null,c}function z(x,Y=50){return typeof requestIdleCallback=="function"?requestIdleCallback(x,{timeout:Y}):setTimeout(()=>x({timeRemaining:()=>0,didTimeout:!0}),1)}}),He("packages/core/src/internal/paths.js",function(e,D){"use strict";Object.defineProperty(e,"pathGetter",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"pathSetter",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"getPath",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return Z}});const re=new Map;function N(z){let x=re.get(z);if(x)return x;if(!z.includes("."))x=Y=>Y?.[z];else{const Y=z.split("."),$=Y.length;x=j=>{let k=j;for(let y=0;y<$;y++){if(k==null)return;k=k[Y[y]]}return k}}return re.set(z,x),x}const G=new Map;function F(z){let x=G.get(z);if(x)return x;if(!z.includes("."))x=(Y,$)=>{Y!=null&&(Y[z]=$)};else{const Y=z.split("."),$=Y.length-1;x=(j,k)=>{let y=j;for(let c=0;c<$;c++){if(y==null)return;const m=Y[c];y[m]==null&&(y[m]={}),y=y[m]}y!=null&&(y[Y[$]]=k)}}return G.set(z,x),x}function L(z,x){return N(x)(z)}function Z(z,x,Y){F(x)(z,Y)}}),He("packages/core/src/internal/compare.js",function(e,D){"use strict";Object.defineProperty(e,"collator",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"defaultCompare",{enumerable:!0,get:function(){return G}});const re=new Map;function N(F,L){const Z=`${F||""}|${L?JSON.stringify(L):""}`;let z=re.get(Z);return z||(z=new Intl.Collator(F||void 0,{numeric:!0,sensitivity:"variant",...L}),re.set(Z,z)),z}function G(F,L){if(F===L)return 0;if(F==null)return 1;if(L==null)return-1;if(typeof F=="number"&&typeof L=="number")return Number.isNaN(F)?Number.isNaN(L)?0:1:Number.isNaN(L)||F<L?-1:F>L?1:0;const Z=String(F),z=String(L);return Z<z?-1:Z>z?1:0}}),He("packages/core/src/defaults.js",function(e,D){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return j}});const N=D("packages/core/src/internal/predicates.js").isObject,F=D("packages/core/src/internal/merge.js").merge,Z=D("packages/core/src/internal/warn.js").warnOnce;let z=null;class x extends Error{}function Y(k,y=new Set){if(Array.isArray(k)){if(y.has(k))throw new x;y.add(k);const m=k.map(s=>Y(s,y));return y.delete(k),m}if(!N(k)||Object.getPrototypeOf(k)!==Object.prototype&&Object.getPrototypeOf(k)!==null)return k;if(y.has(k))throw new x;y.add(k);const c={};for(const[m,s]of Object.entries(k))c[m]=Y(s,y);return y.delete(k),c}function $(k){if(k===void 0)return Y(z??{});if(k===null)return z=null,{};if(!N(k))return Z("defaults:type",`defaults() expects a configuration object, or null to clear it, but got ${Array.isArray(k)?"an array":typeof k}. The call was ignored and the defaults are unchanged.`),Y(z??{});try{z=Y(k)}catch(y){if(!(y instanceof x))throw y;return Z("defaults:cyclic","defaults() expects a configuration object with no circular references, but the object passed refers back to itself. The call was ignored and the defaults are unchanged."),Y(z??{})}return Y(z)}function j(k){return z===null?k:F(Y(z),k)}}),He("packages/core/src/internal/uid.js",function(e,D){"use strict";Object.defineProperty(e,"uid",{enumerable:!0,get:function(){return N}});let re=0;function N(G="l"){return`${G}${(++re).toString(36)}`}}),He("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 G}});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"]),N=new Set(re);function G(F){return F==="*"||N.has(F)}}),He("packages/core/src/events/bus.js",function(e,D){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return m}});const re=D("packages/core/src/internal/warn.js"),N=re.warnOnce,G=re.DEV,L=D("packages/core/src/internal/uid.js").uid,z=D("packages/core/src/events/names.js").isKnownEvent,x="*";function Y(s,t){!G||z(t)||N(`bus.unknown:${t}`,`${s}('${t}') subscribes to an event the grid never raises, so the handler will never fire. Check the name against the EventName list — a common cause is a near miss such as 'row:click' for 'row:clicked'.`)}const $=new Set(["api","user","init","ai"]),j=new WeakMap;function k(s){let t=j.get(s);return t||(t=L("h"),j.set(s,t)),t}function y(){return typeof performance=="object"&&performance?performance.now():Date.now()}function c(s){if(!s||typeof s!="object")return{};const t={};for(const[o,u]of Object.entries(s))o!=="grid"&&(u==null?t[o]=String(u):Array.isArray(u)?t[o]=`[${u.length}]`:typeof u=="object"?t[o]=u.key?`row ${u.key}`:"{…}":typeof u=="function"?t[o]="[function]":t[o]=String(u).slice(0,60));return t}class m{#e=new Map;#t=!1;#n=[];#r=200;#i=new Map;#s=null;#o=!1;#l=0;constructor(t=null){this.#s=t}attach(t){this.#s=t}get grid(){return this.#s}get destroyed(){return this.#o}on(t,o){if(typeof o!="function")return N(`bus.handler:${t}`,`on('${t}') needs a function; ignored.`),()=>{};Y("on",t);let u=this.#e.get(t);return u||(u=[],this.#e.set(t,u)),u.push(o),()=>this.off(t,o)}once(t,o){if(typeof o!="function")return N(`bus.handler:${t}`,`once('${t}') needs a function; ignored.`),()=>{};Y("once",t);const u=d=>{this.off(t,o),o(d)};return this.#i.set(o,u),this.on(t,u)}off(t,o){if(o===void 0){this.#e.delete(t);return}const u=this.#e.get(t);if(!u)return;const d=this.#i.get(o),i=d&&u.includes(d)?d:o,g=u.indexOf(i);g>=0&&u.splice(g,1),d&&i===d&&this.#i.delete(o),u.length===0&&this.#e.delete(t)}count(t){const o=this.#e.get(t),u=t===x?null:this.#e.get(x);return(o?o.length:0)+(u?u.length:0)}#a(t,o,u,d,i){this.#n.push({type:t,origin:o,listeners:(d?d.length:0)+(i?i.length:0),payload:c(u),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(t,o){this.#t=!!t,Number.isFinite(o)&&o>0&&(this.#r=Math.floor(o)),t||(this.#n=[])}eventLog(){return this.#n.map(t=>({...t}))}clearEventLog(){this.#n=[]}counts(){const t={};for(const[o,u]of this.#e)t[o]=u.length;return t}emit(t,o,u){const d=u??(o&&o.origin),i=$.has(d)?d:"api",g={...o||null,type:t,origin:i,grid:this.#s};if(this.#o)return g;const r=this.#e.get(t),n=t===x?void 0:this.#e.get(x);if(this.#t&&this.#a(t,i,o,r,n),!r&&!n)return g;const f=this.#t?y():0;this.#l++;try{r&&this.#c(r.slice(),g,t),n&&this.#c(n.slice(),g,x)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=y()-f)}return g}emitBefore(t,o,u){const d=u??(o&&o.origin),i=$.has(d)?d:"user";let g=!1,r=null;const n=p=>{g=!0,p!=null&&r===null&&(r=String(p))},f={...o||null,type:t,origin:i,grid:this.#s,get defaultPrevented(){return g},get reason(){return r},preventDefault(p){n(p)}};if(this.#o)return!0;const h=this.#e.get(t);this.#t&&this.#a(t,i,o,h,void 0);const l=h?h.slice():[];if(l.length===0)return!0;const b=()=>(g&&r===null&&(r="prevented"),g&&o&&typeof o=="object"&&(o.reason=r),!g),a=[];for(const p of l)try{const w=p(f);w&&typeof w.then=="function"?a.push(w):w===!1&&n("prevented")}catch(w){n("error"),N(`bus.beforeThrow:${t}:${k(p)}`,`a '${t}' before-handler threw; the action was cancelled.`,w)}return a.length===0?b():Promise.allSettled(a).then(p=>{for(const w of p)w.status==="rejected"?(n("error"),N(`bus.beforeReject:${t}`,`a '${t}' before-handler rejected; the action was cancelled.`,w.reason)):w.value===!1&&n("prevented");return b()})}#c(t,o,u){for(let d=0;d<t.length;d++)try{t[d](o)}catch(i){N(`bus.throw:${u}:${k(t[d])}`,`a '${u}' handler threw; other handlers were unaffected.`,i)}}clear(){this.#e.clear(),this.#i.clear()}destroy(){this.clear(),this.#o=!0,this.#s=null}}}),He("packages/core/src/registry/free-tier-notice.js",function(e,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 N}});const re="Free for non-commercial use: latticegrid.dev/free",N="Unlicensed: Lattice Grid trial"}),He("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 Z}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"fromBase64Url",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"toBase64Url",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"asciiBytes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"parseLicence",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"hasEd25519",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"verifyLicence",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isLocalHost",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"currentHost",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"matchesDomain",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LicenceHolder",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"setLicence",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return S}});const N=D("packages/core/src/internal/warn.js").warnOnce,G=D("packages/core/src/registry/free-tier-notice.js"),F=G.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return G.FREE_TIER_NOTICE}});const L="lattice-grid",Z=1,z="LG1",x=64,Y="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",j=(()=>{const E=new Int16Array(128).fill(-1);for(let O=0;O<$.length;O++)E[$.charCodeAt(O)]=O;return E[43]=62,E[47]=63,E})();function k(E){if(typeof E!="string")return null;let O="";for(let X=0;X<E.length;X++){const q=E.charCodeAt(X);if(q!==61){if(q>127||j[q]<0)return null;O+=E[X]}}const M=O.length;if(M%4===1)return null;const T=new Uint8Array(Math.floor(M*3/4));let A=0,I=0,U=0;for(let X=0;X<M;X++)A=A<<6|j[O.charCodeAt(X)],I+=6,I>=8&&(I-=8,T[U++]=A>>I&255);return U===T.length?T:T.subarray(0,U)}function y(E){let O="",M=0;for(;M+2<E.length;M+=3){const A=E[M]<<16|E[M+1]<<8|E[M+2];O+=$[A>>18&63]+$[A>>12&63]+$[A>>6&63]+$[A&63]}const T=E.length-M;if(T===1){const A=E[M]<<16;O+=$[A>>18&63]+$[A>>12&63]}else if(T===2){const A=E[M]<<16|E[M+1]<<8;O+=$[A>>18&63]+$[A>>12&63]+$[A>>6&63]}return O}function c(E){const O=new Uint8Array(E.length);for(let M=0;M<E.length;M++)O[M]=E.charCodeAt(M)&127;return O}function m(E){if(typeof TextDecoder=="function")return new TextDecoder().decode(E);let O="";for(let M=0;M<E.length;M++)O+=String.fromCharCode(E[M]);return O}function s(E){const O={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof E=="string"?E:""};if(typeof E!="string"||E.length===0)return{...O,reason:"missing"};const M=E.trim(),T=M.split(".");if(T.length!==3)return O;const[A,I,U]=T;if(A!==z)return{...O,reason:"prefix"};const X=k(I),q=k(U);if(!X||!q)return O;let _;try{_=JSON.parse(m(X))}catch{return O}return _===null||typeof _!="object"?O:{ok:!0,reason:null,product:typeof _.p=="string"?_.p:null,issuedTo:typeof _.t=="string"?_.t:null,expires:typeof _.e=="string"?_.e:null,terms:typeof _.terms=="string"?_.terms:null,features:Array.isArray(_.f)?_.f.slice():[],deployments:Array.isArray(_.d)?_.d.slice():[],version:typeof _.v=="number"?_.v:0,message:c(I),signature:q,raw:M}}function t(E,O){if(!E)return!1;const M=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(E)?`${E}T23:59:59.999Z`:E);return Number.isNaN(M)?!0:O>M}function o(E){return E==="non-commercial"?"non-commercial":"commercial"}let u=null,d=null,i=null;function g(){const E=globalThis.crypto;return E&&E.subtle?E.subtle:null}async function r(E){if(u&&d===E)return u;const O=g();if(!O)return null;const M=k(E);if(!M)return null;try{const T=await O.importKey("raw",M,{name:"Ed25519"},!1,["verify"]);return u=T,d=E,T}catch{return null}}async function n(){return i!==null||(i=await r(Y)!==null),i}async function f(E,O={}){const M=O.warn!==!1,T=O.product||L,A=O.publicKey||Y,I=O.now??Date.now(),U=O.host??l(),X=h(U)?"":` ${F}`,q=s(E);if(!q.ok){const J=q.reason==="missing"?"missing":"malformed";return M&&N(`licence.${J}`,J==="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.${X}`:`licence key could not be read. The grid will render with a watermark.${X}`),{valid:!1,reason:J,terms:"commercial"}}const _={product:q.product||void 0,issuedTo:q.issuedTo||void 0,expires:q.expires||void 0,terms:o(q.terms)};if(q.product!==T)return M&&N("licence.product",`licence key is for '${q.product}', not '${T}'. The grid will render with a watermark.`),{valid:!1,..._,reason:"product"};if(t(q.expires,I))return M&&N("licence.expired",`licence expired on ${q.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,..._,reason:"expired"};const H=q.deployments||[];if(H.length&&U&&!h(U)&&!b(U,H))return M&&N("licence.domain",`licence key is not valid for ${U}; it covers ${H.join(", ")}. The grid will render with a watermark.`),{valid:!1,..._,reason:"domain"};const ee=await r(A);if(!ee){const J=!!q.signature&&q.signature.length===x;return M&&N("licence.algorithm","this host does not provide crypto.subtle Ed25519, so the licence signature could not be verified. A structural check was used instead."),J?{valid:!0,..._,reason:"unverified"}:{valid:!1,..._,reason:"signature"}}let te=!1;try{te=await g().verify({name:"Ed25519"},ee,q.signature,q.message)}catch{te=!1}return te?{valid:!0,..._}:(M&&N("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,..._,reason:"signature"})}function h(E){const O=String(E??l()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!O||O==="localhost"||O.endsWith(".localhost")||O==="::1"||O==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(O)}function l(){const E=globalThis.location;return E&&typeof E.hostname=="string"?E.hostname:null}function b(E,O){const M=a(E);return!M||!Array.isArray(O)?!1:O.some(T=>{const A=a(T);if(!A)return!1;if(A==="*")return!0;if(A.startsWith("*.")){const I=A.slice(2);return M===I||M.endsWith(`.${I}`)}return M===A})}function a(E){return String(E??"").trim().toLowerCase().replace(/\.$/,"")}class p{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#i;#s=new Set;constructor(O={}){this.#i=O}set(O){this.#e=typeof O=="string"?O.trim():"";const M=s(this.#e);return this.#t=M.ok?{valid:!t(M.expires,Date.now())&&M.product===(this.#i.product||L),product:M.product||void 0,issuedTo:M.issuedTo||void 0,expires:M.expires||void 0,terms:o(M.terms),reason:"pending"}:{valid:!1,reason:M.reason||"malformed",terms:"commercial"},this.#n=null,this.#e&&this.verify(),this.#t}verify(){if(this.#n)return this.#n;const O=this.#e;return this.#n=f(O,this.#i).then(M=>{if(this.#e===O){this.#t=M;for(const T of this.#s)T(M)}return M}),this.#n}onSettled(O){return this.#s.add(O),()=>this.#s.delete(O)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!h(this.#r)}setHost(O){this.#r=O}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.#s.clear()}}const w=Symbol.for("lattice-grid/licence/holder");function v(){const E=globalThis,O=E&&E[w];if(O&&typeof O.set=="function"&&typeof O.watermark=="function")return O;const M=new p;if(E)try{E[w]=M}catch{}return M}const P=v();function V(E){return P.set(E)}function W(){return P.info()}function K(){return P.watermark()}function R(){return P.state()}function S(){return P}}),He("packages/core/src/registry/registry.js",function(e,D){"use strict";Object.defineProperty(e,"KINDS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"REGIONS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return u}});const re=D("packages/core/src/internal/warn.js"),N=re.warnOnce,G=re.DEV,L=D("packages/core/src/internal/predicates.js").isFunction,Z=D("packages/core/src/registry/licence.js"),z=Z.LicenceHolder,x=Z.sharedLicence,Y=["renderer","editor","filter","dataType","totalFn","pipe","component"],$=["all","header","body","totals","panels"];class j{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#i;#s=null;#o=null;#l=new Set;#a=new Map;constructor(i={}){for(const g of Y)this.#t.set(g,new Map);this.#i=i.holder||x(),this.#o=i.grid??null,this.#s=this.#i.onSettled(()=>{this.#f({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),i.licence&&this.setLicence(i.licence)}registerModules(i,g={}){g.licence&&this.setLicence(g.licence),g.grid!==void 0&&(this.#o=g.grid);const r=Array.isArray(i)?i:[i],n=[];for(const f of r){if(!f||typeof f!="object"||typeof f.name!="string"||!f.name){N("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(f.name)){G&&this.#u(this.#e.get(f.name),f);continue}if(!L(f.install)){N(`registry.module.install:${f.name}`,`module '${f.name}' has no install() and was ignored.`);continue}const h={registry:this,grid:this.#o};try{f.install(h)}catch(l){N(`registry.module.throw:${f.name}`,`module '${f.name}' threw during install; it was not registered.`,l);continue}this.#e.set(f.name,f);for(const l of k(f))this.#n.add(l);n.push(f.name),this.#f({reason:"module",name:f.name,capabilities:this.capabilities(),regions:m(f)})}return n}unregisterModule(i){const g=this.#e.get(i);if(!g)return!1;if(L(g.uninstall))try{g.uninstall({registry:this,grid:this.#o})}catch(r){N(`registry.module.uninstall:${i}`,`module '${i}' threw during uninstall.`,r)}return this.#e.delete(i),this.#c(),this.#f({reason:"unmodule",name:i,capabilities:this.capabilities(),regions:m(g)}),!0}modules(){return[...this.#e.values()]}has(i){return this.#e.has(i)}#c(){this.#n.clear();for(const i of this.#e.values())for(const g of k(i))this.#n.add(g)}#u(i,g){!i||i===g||y(i,g)||N(`registry.module.reconfigure:${g.name}`,`module '${g.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(i){return this.#n.has(i)}onChange(i){return L(i)?(this.#r.add(i),this.#a.set(i,this.#o),()=>{this.#r.delete(i),this.#a.delete(i)}):()=>{}}#f(i){for(const g of[...this.#r])try{g(i)}catch(r){N("registry.onChange.throw","a registry change handler threw.",r)}}register(i,g,r){const n=this.#t.get(i);if(!n){N(`registry.kind:${i}`,`unknown registry kind '${i}'; expected one of ${Y.join(", ")}.`);return}if(!g||typeof g!="string"){N(`registry.name:${i}`,`register('${i}', ...) needs a name.`);return}n.has(g)&&n.get(g)!==r&&N(`registry.replace:${i}:${g}`,`'${g}' was already registered as a ${i} and has been replaced.`),n.set(g,r),this.#f({reason:"register",name:g,kind:i,capabilities:this.capabilities(),regions:s(i)})}registerAll(i,g){if(g)for(const r of Object.keys(g))this.register(i,r,g[r])}get(i,g){const r=this.#t.get(i);return r?r.get(g):void 0}names(i){const g=this.#t.get(i);return g?[...g.keys()]:[]}#d(i,g){const r=this.#t.get(i).get(g);return r!==void 0?r:this.#t.get("component").get(g)}renderer(i){return this.#d("renderer",i)}editor(i){return this.#d("editor",i)}filter(i){return this.#d("filter",i)}dataType(i){return this.get("dataType",i)}totalFn(i){return this.get("totalFn",i)}pipe(i){return this.get("pipe",i)}setLicence(i){return this.#i.set(i)}licence(){return this.#i.info()}licenceVerified(){return this.#i.verify()}watermark(){return this.#i.watermark()}attach(i){i!=null&&(this.#l.add(i),this.#o=i)}detach(i){if(i!=null){this.#l.delete(i);for(const[g,r]of[...this.#a])r===i&&(this.#r.delete(g),this.#a.delete(g));if(this.#o===i){const g=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#o=g}this.#l.size===0&&this.#s&&(this.#s(),this.#s=null)}}destroy(i){if(i!=null){this.detach(i);return}for(const g of[...this.#e.keys()])this.unregisterModule(g);this.#r.clear(),this.#a.clear(),this.#l.clear(),this.#s&&this.#s(),this.#s=null,this.#o=null}}function k(d){const i=d.capabilities,g=Array.isArray(i)?i.filter(r=>typeof r=="string"):[];return[d.name,...g]}function y(d,i){return d.install!==i.install||d.uninstall!==i.uninstall||(d.version||"")!==(i.version||"")?!1:c(k(d),k(i))&&c(m(d),m(i))}function c(d,i){const g=new Set(d),r=new Set(i);if(g.size!==r.size)return!1;for(const n of g)if(!r.has(n))return!1;return!0}function m(d){const i=d.regions;return!Array.isArray(i)||i.length===0?["all"]:i.filter(g=>$.includes(g))}function s(d){switch(d){case"filter":return["header"];case"totalFn":return["totals"];case"renderer":case"editor":case"pipe":return["body"];default:return["all"]}}const t=new j;function o(){return t}function u(d,i={}){return t.registerModules(d,i)}}),He("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 G}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return F}});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(/^./,z=>z.toUpperCase()):""}const N={"&":"&","<":"<",">":">",'"':""","'":"'"};function G(L){const Z=L==null?"":String(L);return/[&<>"']/.test(Z)?Z.replace(/[&<>"']/g,z=>N[z]):Z}function F(L){return String(L).replace(/\w\S*/g,Z=>Z[0].toUpperCase()+Z.slice(1).toLowerCase())}}),He("packages/core/src/format/mask.js",function(e,D){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return Z}});const re=new Set(["0","#","?",",","."]),N="\0";function G(x){const Y=[];let $="",j=!1;for(let k=0;k<x.length;k++){const y=x[k];if(y==="\\"){$+=y+(x[k+1]??""),k+=1;continue}if(y==='"'){j=!j,$+=y;continue}if(y===";"&&!j){Y.push($),$="";continue}$+=y}return Y.push($),Y}function F(x){let Y="",$="",j="",k=1,y=!1,c=!1;const m=n=>{c?$+=n:Y+=n};for(let n=0;n<x.length;n++){const f=x[n];if(f==="\\"){m(x[n+1]??""),n+=1;continue}if(f==='"'){const h=x.indexOf('"',n+1);m(h===-1?x.slice(n+1):x.slice(n+1,h)),n=h===-1?x.length:h;continue}if(f==="%"){k*=100,m("%");continue}if(f==="@"){y=!0,m("\0");continue}if(re.has(f)){j+=f,c=!0;continue}m(f)}let s=-1;for(let n=j.length-1;n>=0;n--){const f=j[n];if(f==="0"||f==="#"||f==="?"){s=n;break}}let t=!1,o="";for(let n=0;n<j.length;n++){const f=j[n];if(f===","){n>s?k/=1e3:t=!0;continue}o+=f}const u=o.indexOf("."),d=u===-1?o:o.slice(0,u),i=u===-1?"":o.slice(u+1);let g=0;for(const n of d)n==="0"&&(g+=1);let r=0;for(const n of i)n==="0"&&(r+=1);return{prefix:Y,suffix:$,minInt:g,minDec:r,maxDec:i.length,grouping:t,scale:k,hasNumber:s!==-1,isText:y}}function L(x,Y){const $=new Intl.NumberFormat(Y,{minimumIntegerDigits:Math.max(x.minInt,1),minimumFractionDigits:x.minDec,maximumFractionDigits:Math.max(x.maxDec,x.minDec),useGrouping:x.grouping}),{prefix:j,suffix:k,scale:y,hasNumber:c}=x;return m=>{if(!c)return j+k;const s=y===1?m:m*y;return j+$.format(s)+k}}function Z(x,Y){const j=G(String(x)).map(F),k=j.map(o=>L(o,Y)),y=0,c=j.length>1?1:-1,m=j.length>2?2:-1,s=j.length>3?3:-1,t=o=>{if(o==null||o==="")return"";if(typeof o!="number"||Number.isNaN(o)){const u=Number(o);if(Number.isNaN(u))return s===-1?String(o):(j[s].prefix+j[s].suffix).split("\0").join(String(o));o=u}return o===0&&m!==-1?k[m](0):o<0&&c!==-1?k[c](-o):k[y](o)};return t.spec={mask:x},{format:t,ooxml:z(String(x))}}function z(x){return x.trim()}}),He("packages/core/src/format/pattern.js",function(e,D){"use strict";Object.defineProperty(e,"parseNumberPattern",{enumerable:!0,get:function(){return L}});const N=D("packages/core/src/format/mask.js").splitSections;function G(Z){let z="",x="",Y="",$="",j=!1,k=!1,y=!1,c=!1;const m=t=>{y?x+=t:z+=t};for(let t=0;t<Z.length;t++){const o=Z[t];if(o==="\\"){m(Z[t+1]??""),t+=1;continue}if(o==='"'){const u=Z.indexOf('"',t+1);m(u===-1?Z.slice(t+1):Z.slice(t+1,u)),t=u===-1?Z.length:u;continue}if(o==="%"){k=!0;continue}if(o==="0"||o==="#"){y=!0,c?$+=o:Y+=o;continue}if(o===","){c||(j=!0);continue}if(o==="."&&!c){c=!0;continue}m(o)}if(!y)return{hasDigit:!1,prefix:z,suffix:x,minDec:0,maxDec:0,grouping:!1,percent:k};let s=0;for(const t of $)t==="0"&&(s+=1);return{hasDigit:!0,prefix:z,suffix:x,minDec:s,maxDec:$.length,grouping:j,percent:k}}function F(Z,z){const x=z.trim(),Y=Z.trim();return x.startsWith("(")&&x.endsWith(")")&&x.slice(1,-1).trim()===Y?"parentheses":x.endsWith("-")?"suffix":"minus"}function L(Z){if(typeof Z!="string")return null;const z=N(Z);if(z.length===0)return null;const x=G(z[0]);if(!x.hasDigit)return null;const Y={style:x.percent?"percent":"decimal",prefix:x.prefix,suffix:x.suffix,minDecimals:x.minDec,maxDecimals:Math.max(x.maxDec,x.minDec),thousandsSeparator:x.grouping?void 0:!1};if(z.length>1&&(Y.negative=F(z[0],z[1])),z.length>2){const $=G(z[2]);$.hasDigit||(Y.zeroDisplay=$.prefix+$.suffix)}return Y}}),He("packages/core/src/format/number.js",function(e,D){"use strict";Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return z}});const N=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/warn.js").warnOnce,Z=D("packages/core/src/format/pattern.js").parseNumberPattern;function z(x,Y){const $=typeof x=="string"?{pattern:x}:x||{};let j=$;if(typeof $.pattern=="string"){const v=Z($.pattern);if(v){const{pattern:P,...V}=$;j={...v,...V}}else F(`format:pattern:${$.pattern}`,`invalid number format pattern "${$.pattern}"; the value will use the default number format`)}const k=j.locale||Y||void 0,y=j.style||"decimal",c=typeof j.scale=="number"?j.scale:1,m=j.nullDisplay??"",s=j.zeroDisplay,t=j.prefix||"",o=j.suffix||"",u=j.negative||"minus",d=j.signed===!0,i={style:y,notation:j.notation||"standard"};y==="currency"&&(i.currency=j.currency||"USD",j.currencyDisplay&&(i.currencyDisplay=j.currencyDisplay)),typeof j.decimals=="number"?(i.minimumFractionDigits=j.decimals,i.maximumFractionDigits=j.decimals):(typeof j.minDecimals=="number"&&(i.minimumFractionDigits=j.minDecimals),typeof j.maxDecimals=="number"&&(i.maximumFractionDigits=j.maxDecimals),i.minimumFractionDigits>(i.maximumFractionDigits??20)&&(i.maximumFractionDigits=i.minimumFractionDigits)),j.thousandsSeparator===!1&&(i.useGrouping=!1),i.notation==="compact"&&(i.compactDisplay=j.compactDisplay||"short");const g=new Intl.NumberFormat(k,i),r=typeof j.thousandsSeparator=="string"?j.thousandsSeparator:null,n=typeof j.decimalSeparator=="string"?j.decimalSeparator:null;let f=",",h=".";if(r||n)for(const v of g.formatToParts(12345.6))v.type==="group"?f=v.value:v.type==="decimal"&&(h=v.value);const l=v=>{let P=v;return r&&(P=P.split(f).join("")),n&&(P=P.split(h).join("")),r&&(P=P.split("").join(r)),n&&(P=P.split("").join(n)),P},b=!!(r||n),a=t!==""&&y==="currency",p=v=>{let P;if(a){const V=g.formatToParts(v);let W=!1;P="";for(const K of V)P+=K.value,!W&&K.type==="currency"&&(P+=t,W=!0);W||(P=t+P)}else P=t+g.format(v);return b&&(P=l(P)),P+o},w=v=>{if(N(v)||v==="")return m;const P=typeof v=="number"?v:Number(v);if(Number.isNaN(P))return m;const V=c===1?P:P*c;return V===0&&s!==void 0?s:V<0?u==="parentheses"?`(${p(-V)})`:u==="suffix"?`${p(-V)}-`:p(V):d&&V>0?`+${p(V)}`:p(V)};return w.negativeClass=j.negativeClass||null,w.spec=j,w}}),He("packages/core/src/format/date.js",function(e,D){"use strict";Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return o}});const N=D("packages/core/src/internal/predicates.js").isNil,F=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 Z(u){const d=[];let i=0,g="";const r=()=>{g&&(d.push({token:null,text:g}),g="")};for(;i<u.length;){const n=u[i];if(n==="'"){if(u[i+1]==="'"){g+="'",i+=2;continue}const h=u.indexOf("'",i+1);if(h===-1){g+=u.slice(i+1),i=u.length;continue}g+=u.slice(i+1,h),i=h+1;continue}const f=L.find(h=>u.startsWith(h,i));if(f){r(),d.push({token:f,text:f}),i+=f.length;continue}/[A-Za-z]/.test(n)&&F(`date.pattern.token:${n}`,`the date pattern "${u}" contains '${n}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${L.join(" ")}.`),g+=n,i+=1}return r(),d}const z=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function x(u){if(N(u)||u==="")return null;if(u instanceof Date)return Number.isNaN(u.getTime())?null:u;if(typeof u=="number")return Number.isNaN(u)?null:new Date(u);if(typeof u=="string"){const d=z.exec(u.trim());if(d){const[,g,r,n,f="0",h="0",l="0"]=d;return new Date(+g,+r-1,+n,+f,+h,+l)}const i=new Date(u);return Number.isNaN(i.getTime())?null:i}return null}function Y(u,d){return String(u).padStart(d,"0")}function $(u){if(!u)return g=>({year:g.getFullYear(),month:g.getMonth()+1,day:g.getDate(),hour:g.getHours(),minute:g.getMinutes(),second:g.getSeconds(),ms:g.getMilliseconds(),weekday:g.getDay()});const d=new Intl.DateTimeFormat("en-US",{timeZone:u,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,weekday:"short"}),i={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};return g=>{const r={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:g.getMilliseconds(),weekday:0};for(const n of d.formatToParts(g))switch(n.type){case"year":r.year=Number(n.value);break;case"month":r.month=Number(n.value);break;case"day":r.day=Number(n.value);break;case"hour":r.hour=Number(n.value)%24;break;case"minute":r.minute=Number(n.value);break;case"second":r.second=Number(n.value);break;case"weekday":r.weekday=i[n.value]??0;break;default:break}return r}}function j(u,d,i){const g=Z(u),r=$(i),n=new Set(g.filter(a=>a.token).map(a=>a.token)),f=n.has("MMM")?new Intl.DateTimeFormat(d,{month:"short",timeZone:i}):null,h=n.has("MMMM")?new Intl.DateTimeFormat(d,{month:"long",timeZone:i}):null,l=n.has("EEE")?new Intl.DateTimeFormat(d,{weekday:"short",timeZone:i}):null,b=n.has("EEEE")?new Intl.DateTimeFormat(d,{weekday:"long",timeZone:i}):null;return a=>{const p=r(a);let w="";for(const v of g){if(!v.token){w+=v.text;continue}switch(v.token){case"yyyy":w+=Y(p.year,4);break;case"yy":w+=Y(p.year%100,2);break;case"MMMM":w+=h.format(a);break;case"MMM":w+=f.format(a);break;case"MM":w+=Y(p.month,2);break;case"M":w+=String(p.month);break;case"dd":w+=Y(p.day,2);break;case"d":w+=String(p.day);break;case"EEEE":w+=b.format(a);break;case"EEE":w+=l.format(a);break;case"HH":w+=Y(p.hour,2);break;case"H":w+=String(p.hour);break;case"hh":w+=Y(p.hour%12===0?12:p.hour%12,2);break;case"h":w+=String(p.hour%12===0?12:p.hour%12);break;case"mm":w+=Y(p.minute,2);break;case"m":w+=String(p.minute);break;case"ss":w+=Y(p.second,2);break;case"s":w+=String(p.second);break;case"SSS":w+=Y(p.ms,3);break;case"a":w+=p.hour<12?"AM":"PM";break;default:w+=v.text;break}}return w}}const k=[["year",365*24*36e5],["month",720*36e5],["week",168*36e5],["day",24*36e5],["hour",36e5],["minute",6e4],["second",1e3]];function y(u,d){const i=u||{},g=i.locale||d||void 0,r=i.nullDisplay??"",n=i.timeZone;let f;if(i.pattern)f=j(i.pattern,g,n);else if(i.dateStyle||i.timeStyle){const p={timeZone:n};i.dateStyle&&(p.dateStyle=i.dateStyle),i.timeStyle&&(p.timeStyle=i.timeStyle);const w=new Intl.DateTimeFormat(g,p);f=v=>w.format(v)}else{const p=new Intl.DateTimeFormat(g,{dateStyle:"medium",timeZone:n});f=w=>p.format(w)}const h=i.relative?new Intl.RelativeTimeFormat(g,{numeric:"auto"}):null,b=(typeof i.relative=="object"&&i.relative?i.relative.threshold??7:7)*24*36e5,a=(p,w)=>{const v=x(p);if(!v)return r;if(h){const P=w&&typeof w.now=="number"?w.now:Date.now(),V=v.getTime()-P;if(Math.abs(V)<b){for(const[W,K]of k)if(Math.abs(V)>=K||W==="second")return h.format(Math.round(V/K),W)}}return f(v)};return a.spec=i,a}function c(u){if(N(u)||u==="")return null;if(typeof u=="string"){const g=/^(\d{4}-\d{2}-\d{2})/.exec(u.trim());if(g)return g[1];const r=x(u);return r?c(r):null}const d=x(u);if(!d)return null;const i=g=>String(g).padStart(2,"0");return`${d.getFullYear()}-${i(d.getMonth()+1)}-${i(d.getDate())}`}function m(u,d){if(N(u)||u==="")return null;if(typeof u=="string"){const g=u.trim();if(s.test(g)){const f=x(g);return f?t(f,d):null}const r=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(g);if(r){const[,f,h,l,b]=r;return`${f}T${h}:${l}${b&&b!=="00"?`:${b}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(g))return`${g}T00:00`;const n=x(g);return n?m(n):null}const i=x(u);return i?t(i,d):null}const s=/(?:Z|[+-]\d{2}:?\d{2})$/i;function t(u,d){const i=f=>String(f).padStart(2,"0");if(d)try{const f=new Intl.DateTimeFormat("en-CA",{timeZone:d,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(u).reduce((b,a)=>(a.type!=="literal"&&(b[a.type]=a.value),b),{}),h=f.hour==="24"?"00":f.hour,l=Number(f.second);return`${f.year}-${f.month}-${f.day}T${h}:${f.minute}`+(l?`:${f.second}`:"")}catch{}const g=`${u.getFullYear()}-${i(u.getMonth()+1)}-${i(u.getDate())}`,r=u.getSeconds(),n=`${i(u.getHours())}:${i(u.getMinutes())}${r?`:${i(r)}`:""}`;return`${g}T${n}`}function o(u,d){const i=N(u)||u===""?null:String(u),g=N(d)||d===""?null:String(d);return i===null?g===null?0:1:g===null||i<g?-1:i>g?1:0}}),He("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 Z}});const N=D("packages/core/src/internal/predicates.js").isNil,G={true:"☑",false:"☐",null:""},F={true:"◉",false:"◯",null:""};function L(z){if(N(z)||z==="")return null;if(typeof z=="boolean")return z;if(typeof z=="number")return z!==0;const x=String(z).trim().toLowerCase();return x==="true"||x==="yes"||x==="y"||x==="1"?!0:x==="false"||x==="no"||x==="n"||x==="0"?!1:null}function Z(z,x){const Y=z||{},$=Y.display||"text",j=Y.trueLabel??"Yes",k=Y.falseLabel??"No",y=Y.nullLabel??"";let c=j,m=k;const s=y;$==="checkbox"?(c=G.true,m=G.false):$==="switch"?(c=F.true,m=F.false):$==="icon"&&(c=Y.trueIcon??j,m=Y.falseIcon??k);const t=o=>{const u=L(o);return u===null?s:u?c:m};return t.display=$,t.labels={true:j,false:k,null:y},t.locale=x,t.spec=Y,t}}),He("packages/core/src/format/text.js",function(e,D){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return L}});const N=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/text.js").titleCase;function L(Z,z){const x=Z||{},Y=x.locale||z||void 0,$=x.nullDisplay??"",j=x.emptyDisplay??"",k=x.transform||"none",y=typeof x.truncate=="number"?{chars:x.truncate}:x.truncate||null,c=y?y.chars:0,m=y?y.ellipsis??"…":"",s=o=>{switch(k){case"upper":return Y?o.toLocaleUpperCase(Y):o.toUpperCase();case"lower":return Y?o.toLocaleLowerCase(Y):o.toLowerCase();case"title":return F(o);default:return o}},t=o=>{if(N(o))return $;let u=typeof o=="string"?o:String(o);return u===""?j:(k!=="none"&&(u=s(u)),c>0&&u.length>c&&(u=u.slice(0,c)+m),u)};return t.spec=x,t}}),He("packages/core/src/format/shorthand.js",function(e,D){"use strict";Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return z}});const re=["currency","number","percent","date","boolean","text","relative"],N=/[#0?@;"\\]/,G=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function F(x){return typeof x!="string"||x===""||Z(x)?!1:N.test(x)}function L(x){return typeof x!="string"||x===""||Z(x)?!1:G.test(x)}function Z(x){const Y=x.indexOf(":"),$=Y===-1?x:x.slice(0,Y);return re.includes($)?$:null}function z(x){const Y=Z(x);if(!Y)return null;const $=x.indexOf(":"),j=$===-1?"":x.slice($+1),k=j===""?[]:j.split(":");switch(Y){case"currency":{const y={type:"number",style:"currency",currency:k[0]||"USD"};return k[1]!==void 0&&k[1]!==""&&(y.decimals=Number(k[1])),y}case"number":{const y={type:"number",style:"decimal"};return k[0]!==void 0&&k[0]!==""&&(y.decimals=Number(k[0])),y}case"percent":{const y={type:"number",style:"percent"};return k[0]!==void 0&&k[0]!==""&&(y.decimals=Number(k[0])),y}case"date":return{type:"date",pattern:j||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const y=j.split("/"),c={type:"boolean",display:"text"};return y[0]!==void 0&&y[0]!==""&&(c.trueLabel=y[0]),y[1]!==void 0&&y[1]!==""&&(c.falseLabel=y[1]),y[2]!==void 0&&(c.nullLabel=y[2]),c}case"text":{const y={type:"text"};return k[0]&&(y.transform=k[0]),k[1]!==void 0&&k[1]!==""&&(y.truncate=Number(k[1])),y}default:return null}}}),He("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"),N=re.isFunction,G=re.isObject,L=D("packages/core/src/internal/warn.js").warnOnce,Z=D("packages/core/src/format/number.js"),z=Z.compileNumber,x=D("packages/core/src/format/date.js"),Y=x.compileDate,$=x.scanPattern,j=D("packages/core/src/format/boolean.js"),k=j.compileBoolean,y=D("packages/core/src/format/text.js"),c=y.compileText,m=D("packages/core/src/format/mask.js"),s=m.compileMask,t=D("packages/core/src/format/shorthand.js"),o=t.parseShorthand,u=t.looksLikeMask,d=t.looksLikeDatePattern,g=D("packages/core/src/format/pattern.js").parseNumberPattern;Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return Z.compileNumber}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return x.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return x.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return x.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return x.toDate}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return j.compileBoolean}}),Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return j.toTriState}}),Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return y.compileText}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return m.compileMask}}),Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return m.splitSections}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return m.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 r=new Set(["decimal","currency","percent","unit"]),n=new Set(["type","locale"]),f={number:new Set(["style","currency","currencyDisplay","decimals","minDecimals","maxDecimals","thousandsSeparator","decimalSeparator","notation","compactDisplay","negative","negativeClass","signed","prefix","suffix","zeroDisplay","nullDisplay","messages","scale","pattern"]),date:new Set(["pattern","dateStyle","timeStyle","timeZone","relative","nullDisplay"]),boolean:new Set(["display","trueLabel","falseLabel","nullLabel","trueIcon","falseIcon"]),text:new Set(["transform","truncate","nullDisplay","emptyDisplay"])},h=new Set(["number","date","boolean","text"]);function l(R,S){const E=R.type;if(E===void 0||h.has(E)||!r.has(String(E)))return;const O=S?`"${S}"`:"with no id";L(`format:unknown-style-key:${S||""}:${E}`,`column ${O} has format: { type: "${E}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${E}" instead?`)}function b(R,S,E){const O=f[S],M=E?`"${E}"`:"with no id";for(const T of R){if(n.has(T)||O.has(T))continue;const A=Object.keys(f).find(I=>I!==S&&f[I].has(T));A?L(`format:inapplicable:${E||""}:${T}`,`column ${M} has format key "${T}", which applies to a ${A} column, not the ${S} column it was applied to; it is ignored.`):L(`format:unknown:${E||""}:${T}`,`column ${M} has an unrecognised format key "${T}" for its ${S} format; it is ignored.`)}}function a(R){if(R.type==="number"||R.type==="date"||R.type==="boolean"||R.type==="text")return!0;const S=r.has(String(R.style));return!!(R.pattern||R.dateStyle||R.timeStyle||R.relative||R.timeZone||R.trueLabel||R.falseLabel||R.display||R.trueIcon||R.falseIcon||R.transform||R.truncate||R.emptyDisplay||S||R.currency||R.decimals!==void 0||R.minDecimals!==void 0||R.maxDecimals!==void 0||R.notation||R.negative||R.scale!==void 0||R.prefix||R.suffix||R.zeroDisplay!==void 0)}function p(R,S){if(R.type==="number"||R.type==="date"||R.type==="boolean"||R.type==="text")return R.type;if(R.pattern){if(u(R.pattern))return"number";if(d(R.pattern))return"date"}if(R.dateStyle||R.timeStyle||R.relative||R.timeZone)return"date";if(R.trueLabel||R.falseLabel||R.display||R.trueIcon||R.falseIcon)return"boolean";if(R.transform||R.truncate||R.emptyDisplay)return"text";if(R.style||R.currency||R.decimals!==void 0||R.minDecimals!==void 0||R.maxDecimals!==void 0||R.notation||R.negative||R.scale!==void 0||R.prefix||R.suffix||R.zeroDisplay!==void 0)return"number";const E=S&&S.base;return E==="number"?"number":E==="date"||E==="dateString"?"date":E==="boolean"?"boolean":"text"}function w(R,S=null,E=void 0,O=void 0,M=void 0){if(R==null||R==="")return null;const T=G(R)?Object.keys(R):null;if(typeof R=="function"){const U=(X,q)=>String(R({...q||{},value:X,locale:E})??"");return U.ooxml=S&&S.excel||"General",U}if(typeof R=="string"){if(u(R)){const{format:X,ooxml:q}=s(R,E);return X.ooxml=q,X}const U=o(R)||(d(R)?{type:"date",pattern:R}:null);return U?w(U,S,E,O,M):(L(`format:${R}`,`unrecognised format string "${R}"; the value will be stringified`),null)}if(!G(R))return L("format:shape","format must be a spec object or a string; ignoring",R),null;if(S&&N(S.format)&&!a(R)||S&&N(S.format)&&Array.isArray(S.formatPatterns)&&R.type===void 0)return null;const A=p(R,S);A==="date"&&O&&R.timeZone===void 0&&(R={...R,timeZone:O}),l(R,M),b(T||Object.keys(R),A,M);let I;switch(A){case"number":I=z(R,E);break;case"date":I=Y(R,E);break;case"boolean":I=k(R,E);break;default:I=c(R,E);break}return I.ooxml=P(R,A,E,S),I.kind=A,I}const v={yyyy:"yyyy",yy:"yy",MMMM:"mmmm",MMM:"mmm",MM:"mm",M:"m",dd:"dd",d:"d",EEEE:"dddd",EEE:"ddd",HH:"hh",H:"h",hh:"hh",h:"h",mm:"mm",m:"m",ss:"ss",s:"s",SSS:"000",a:"AM/PM"};function P(R,S,E=void 0,O=null){if(S==="date"){if(R.pattern){let U="";for(const X of $(R.pattern))U+=X.token?v[X.token]??X.text:X.text;return U}return O&&O.excel||"yyyy-mm-dd"}if(S==="boolean")return"General";if(S==="text")return"@";if(typeof R.pattern=="string"&&g(R.pattern))return String(R.pattern).trim();if(R.notation==="compact"||R.notation==="scientific")return"General";const M=typeof R.decimals=="number"?R.decimals:typeof R.minDecimals=="number"?R.minDecimals:R.style==="currency"?2:0;let A=`${R.thousandsSeparator===!1?"":"#,#"}#0${M>0?`.${"0".repeat(M)}`:""}`,I="";return R.style==="currency"&&(I+=V(K(R.currency||"USD",E))),R.prefix&&(I+=V(R.prefix)),A=I+A,R.style==="percent"&&(A=`${A}%`),R.suffix&&(A+=V(R.suffix)),R.negative==="parentheses"?`${A};(${A})`:R.negative==="suffix"?`${A};${A}-`:A}function V(R){return`"${String(R).split('"').join("")}"`}const W=new Map;function K(R,S){const E=`${R}|${S||""}`;let O=W.get(E);if(O!==void 0)return O;O=R;try{const T=new Intl.NumberFormat(S,{style:"currency",currency:R}).formatToParts(0).find(A=>A.type==="currency");T&&(O=T.value)}catch{}return W.set(E,O),O}}),He("packages/core/src/columns/types/temporal.js",function(e,D){"use strict";Object.defineProperty(e,"MS_SECOND",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"MS_MINUTE",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"MS_HOUR",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MS_DAY",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"MS_WEEK",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"toTimeMs",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"zonedParts",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"zoneOffsetAt",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"instantFromParts",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"toEpochMs",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"toDurationMs",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return de}}),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 me}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(e,"timestampGroupProjector",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"TEMPORAL_INFERENCE_ORDER",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Be}});const re=D("packages/core/src/internal/predicates.js"),N=re.isNil,G=re.isFunction,F=D("packages/core/src/format/date.js"),L=F.toDate,Z=F.compilePattern,z=F.compileDate,x=F.toIsoDateTime,Y=F.compareIso,$=864e5,j=Object.freeze({}),k=1e3,y=60*k,c=60*y,m=24*c,s=7*m,t=new WeakMap;function o(Ee,Ge){const Ne=Ee&&Ee.locale||"",ke=Ee&&Ee.column;if(!ke)return Ne?{locale:Ne}:j;const Oe=t.get(ke);if(Oe&&Oe.locale===Ne)return Oe.bag;const Re=ke.typeOptions||ke[Ge]||(u(ke.format)?ke.format:null),Le={...Re||j,locale:Re&&Re.locale||Ne||void 0};return t.set(ke,{locale:Ne,bag:Le}),Le}function u(Ee){return Ee!==null&&typeof Ee=="object"&&!Array.isArray(Ee)&&!(Ee instanceof Date)}function d(Ee,Ge){const Ne=Ee===null||Number.isNaN(Ee)?null:Ee,ke=Ge===null||Number.isNaN(Ge)?null:Ge;return Ne===null?ke===null?0:1:ke===null||Ne<ke?-1:Ne>ke?1:0}const i=/^(\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,g=/^(\d{3,6})$/;function r(Ee,Ge,Ne,ke){return!(Ee>=0&&Ee<=23)||!(Ge>=0&&Ge<=59)||!(Ne>=0&&Ne<=59)||!(ke>=0&&ke<=999)?null:Ee*c+Ge*y+Ne*k+ke}function n(Ee){if(N(Ee))return null;const Ge=String(Ee).trim();if(Ge==="")return null;const Ne=g.exec(Ge);if(Ne){const et=Ne[1];if(et.length===5)return null;const tt=et.length===3?1:2;return r(Number(et.slice(0,tt)),Number(et.slice(tt,tt+2)),Number(et.slice(tt+2,tt+4)||0),0)}const ke=i.exec(Ge);if(!ke)return null;let Oe=Number(ke[1]);const Re=Number(ke[2]||0),Le=Number(ke[3]||0),ze=ke[4]?Number(ke[4].padEnd(3,"0")):0,Ye=ke[5]?ke[5][0].toLowerCase():null;if(Ye){if(Oe<1||Oe>12)return null;Oe=Oe%12,Ye==="p"&&(Oe+=12)}return r(Oe,Re,Le,ze)}function f(Ee){return N(Ee)||Ee===""?null:typeof Ee=="number"?Number.isFinite(Ee)?(Ee%m+m)%m:null:Ee instanceof Date?Number.isNaN(Ee.getTime())?null:Ee.getHours()*c+Ee.getMinutes()*y+Ee.getSeconds()*k+Ee.getMilliseconds():n(Ee)}const h=new Map;function l(Ee){const Ge=Ee.pattern||"",Ne=Ee.timeStyle||(Ee.seconds?"medium":"short"),ke=`${Ee.locale||""}|${Ge}|${Ne}`;let Oe=h.get(ke);if(Oe)return Oe;if(Ge)Oe=Z(Ge,Ee.locale||void 0,"UTC");else{const Re=new Intl.DateTimeFormat(Ee.locale||void 0,{timeStyle:Ne,timeZone:"UTC"});Oe=Le=>Re.format(Le)}return h.set(ke,Oe),Oe}function b(Ee,Ge){const Ne=Ge||j;if(Ee==null||typeof Ee!="number"||!Number.isFinite(Ee))return Ne.nullDisplay??"";const ke=(Ee%m+m)%m;return l(Ne)(new Date(ke))}function a(Ee){return Ee instanceof Date?!Number.isNaN(Ee.getTime()):typeof Ee=="number"?Number.isFinite(Ee)&&Ee>=0&&Ee<m:typeof Ee!="string"||!Ee.includes(":")?!1:n(Ee)!==null}function p(Ee){const Ge=f(Ee);return Ge==null?"":b(Ge,{pattern:Ge%k===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const w=new Map;function v(Ee){const Ge=Ee||"";let Ne=w.get(Ge);return Ne||(Ne=new Intl.DateTimeFormat("en-GB",{timeZone:Ee||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),w.set(Ge,Ne)),Ne}function P(Ee,Ge){const Ne={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const ke of v(Ge).formatToParts(new Date(Ee)))ke.type==="year"?Ne.year=Number(ke.value):ke.type==="month"?Ne.month=Number(ke.value):ke.type==="day"?Ne.day=Number(ke.value):ke.type==="hour"?Ne.hour=Number(ke.value)%24:ke.type==="minute"?Ne.minute=Number(ke.value):ke.type==="second"&&(Ne.second=Number(ke.value));return Ne}function V(Ee,Ge){const Ne=P(Ee,Ge);return Date.UTC(Ne.year,Ne.month-1,Ne.day,Ne.hour,Ne.minute,Ne.second,0)-Math.floor(Ee/1e3)*1e3}function W(Ee,Ge){const Ne=Ee.hour||0,ke=Ee.minute||0,Oe=Ee.second||0,Re=Ee.ms||0;if(!Ge)return new Date(Ee.year,Ee.month-1,Ee.day,Ne,ke,Oe,Re).getTime();const Le=Date.UTC(Ee.year,Ee.month-1,Ee.day,Ne,ke,Oe,Re);let ze=Le-V(Le,Ge);return ze=Le-V(ze,Ge),ze}const K=/(?:Z|[+-]\d{2}:?\d{2})$/i,R=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function S(Ee,Ge){if(N(Ee))return null;const Ne=String(Ee).trim();if(Ne==="")return null;const ke=Ge&&Ge.timeZone||void 0;if(!K.test(Ne)){const Oe=R.exec(Ne);if(Oe){const Re=(Oe[4]||"").trim(),Le=Re===""?0:n(Re);if(Le===null)return null;const ze=W({year:Number(Oe[1]),month:Number(Oe[2]),day:Number(Oe[3]),hour:Math.floor(Le/c),minute:Math.floor(Le/y)%60,second:Math.floor(Le/k)%60,ms:Le%k},ke);return Number.isNaN(ze)?null:new Date(ze)}}return L(Ne)}function E(Ee){if(typeof Ee=="number")return Number.isFinite(Ee)?Ee:null;const Ge=L(Ee);return Ge?Ge.getTime():null}const O=new Map;function M(Ee){const Ge=[Ee.locale||"",Ee.pattern||"",Ee.dateStyle||"",Ee.timeStyle||"",Ee.timeZone||"",Ee.seconds?"1":""].join("|");let Ne=O.get(Ge);if(Ne)return Ne;const ke=Ee.pattern?{type:"date",pattern:Ee.pattern,timeZone:Ee.timeZone}:{type:"date",dateStyle:Ee.dateStyle||"medium",timeStyle:Ee.timeStyle||(Ee.seconds?"medium":"short"),timeZone:Ee.timeZone};return Ne=z(ke,Ee.locale||void 0),O.set(Ge,Ne),Ne}function T(Ee,Ge){const Ne=Ge||j,ke=E(Ee);return ke==null?Ne.nullDisplay??"":M(Ne)(ke)}function A(Ee){return Ee instanceof Date?!Number.isNaN(Ee.getTime()):typeof Ee!="string"||!R.test(Ee.trim())?!1:S(Ee)!==null}const I=Object.freeze([{key:"w",ms:s,intl:"week",long:["week","weeks"],names:["w","wk","wks","week","weeks"]},{key:"d",ms:m,intl:"day",long:["day","days"],names:["d","dy","day","days"]},{key:"h",ms:c,intl:"hour",long:["hour","hours"],names:["h","hr","hrs","hour","hours"]},{key:"m",ms:y,intl:"minute",long:["minute","minutes"],names:["m","min","mins","minute","minutes"]},{key:"s",ms:k,intl:"second",long:["second","seconds"],names:["s","sec","secs","second","seconds"]},{key:"ms",ms:1,intl:"millisecond",long:["millisecond","milliseconds"],names:["ms","msec","msecs","milli","millis","millisecond","milliseconds"]}]),U=new Map;for(const Ee of I)for(const Ge of Ee.names)U.set(Ge,Ee);const X=Object.freeze(I.filter(Ee=>Ee.key!=="w")),q=/^(\d+(?:\.\d+)?)\s*([a-z]+)\s*(?:,\s*)?/,_=/^\d+(?:\.\d+)?$/,H=/^(\d+):([0-5]?\d)(?::([0-5]?\d))?(?:\.(\d{1,3}))?$/;function ee(Ee){const Ge=Ee&&Ee.defaultUnit?U.get(String(Ee.defaultUnit).toLowerCase()):null;return Ge?Ge.ms:y}function te(Ee){return(Ee&&Ee.defaultUnit?U.get(String(Ee.defaultUnit).toLowerCase()):null)||U.get("m")}function J(Ee,Ge){if(N(Ee))return null;let Ne=String(Ee).trim().toLowerCase();if(Ne==="")return null;let ke=1;if(Ne[0]==="-"?(ke=-1,Ne=Ne.slice(1).trim()):Ne[0]==="+"&&(Ne=Ne.slice(1).trim()),Ne==="")return null;const Oe=H.exec(Ne);if(Oe){const Ye=Oe[3]!==void 0,et=Number(Oe[1])*c+Number(Oe[2])*y+(Ye?Number(Oe[3])*k:0)+(Oe[4]?Number(Oe[4].padEnd(3,"0")):0);return ke*et}if(_.test(Ne))return Math.round(ke*Number(Ne)*ee(Ge||j));let Re=Ne,Le=0,ze=0;for(;Re!=="";){const Ye=q.exec(Re);if(!Ye)return null;const et=U.get(Ye[2]);if(!et)return null;Le+=Number(Ye[1])*et.ms,Re=Re.slice(Ye[0].length),ze++}return ze===0?null:Math.round(ke*Le)}function ne(Ee){return N(Ee)||Ee===""?null:typeof Ee=="number"?Number.isFinite(Ee)?Ee:null:J(Ee)}const se=new Map;function ae(Ee,Ge,Ne){const ke=`${Ne||""}|${Ge.intl}`;let Oe=se.get(ke);if(Oe===void 0){try{Oe=new Intl.NumberFormat(Ne||void 0,{style:"unit",unit:Ge.intl,unitDisplay:"long"})}catch{Oe=null}se.set(ke,Oe)}return Oe?Oe.format(Ee):`${Ee} ${Ee===1?Ge.long[0]:Ge.long[1]}`}function we(Ee,Ge){return String(Ee).padStart(Ge,"0")}function fe(Ee,Ge){const Ne=Ge||j;if(Ee==null||typeof Ee!="number"||!Number.isFinite(Ee))return Ne.nullDisplay??"";const ke=Ne.style||"short",Oe=Ee<0;let Re=Math.round(Math.abs(Ee));const Le=Oe?"-":"";if(Re===0&&Ne.zeroDisplay!=null)return Ne.zeroDisplay;if(ke==="clock"){const tt=Math.floor(Re/c),pt=Math.floor(Re/y)%60,Tt=Math.floor(Re/k)%60;return`${Le}${we(tt,2)}:${we(pt,2)}:${we(Tt,2)}`}if(Re===0){const tt=te(Ne);return ke==="long"?ae(0,tt,Ne.locale):`0${tt.key}`}const ze=Ne.weeks===!0?I:X,Ye=typeof Ne.maxUnits=="number"&&Ne.maxUnits>0?Ne.maxUnits:Ne.maxUnits===void 0?2:1/0,et=[];for(const tt of ze){if(et.length>=Ye)break;const pt=Math.floor(Re/tt.ms);pt!==0&&(Re-=pt*tt.ms,et.push(ke==="long"?ae(pt,tt,Ne.locale):`${pt}${tt.key}`))}return Le+et.join(" ")}function ge(Ee){if(typeof Ee!="string")return!1;const Ge=Ee.trim();return Ge===""||H.test(Ge)||!/[a-z]/i.test(Ge)?!1:J(Ge)!==null}const je=Date.UTC(1899,11,30),Pe=new Map;function de(Ee,Ge){const Ne=Ee||"";let ke=Pe.get(Ne);ke||(ke=new Intl.DateTimeFormat("en-GB",{timeZone:Ee||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),Pe.set(Ne,ke));const Oe=typeof Ge=="number"?Ge:Date.now();for(const Re of ke.formatToParts(new Date(Oe)))if(Re.type==="timeZoneName")return Re.value;return""}function oe(Ee){if(Ee)return Ee;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function he(Ee,Ge){const Ne=oe(Ee),ke=de(Ee,Ge);return ke?`${Ne} (${ke})`:Ne}function ce(Ee,Ge){if(Ee&&Ee.timeZone)return Ee.timeZone;const Ne=Ge&&Ge.grid;return(Ne&&G(Ne.get)?Ne.get("timeZone"):void 0)||void 0}function me(Ee,Ge){const Ne=Ge||j,ke=E(Ee);if(ke==null)return Ne.nullDisplay??"";const Oe=M(Ne)(ke);if(!Ne.showOrigin)return Oe;const Re=Ne.originZone;return Re?Re===(Ne.timeZone||oe(Ne.timeZone))?Oe:`${Oe} (${he(Re,ke)})`:`${Oe} (no origin recorded)`}function ye(Ee,Ge,Ne,ke){if(Ge==="instant"||!Ge)return Ee;const Oe=P(Ee,Ne);if(Ge==="month")return W({year:Oe.year,month:Oe.month,day:1},Ne);if(Ge==="week"){const Re=ke>=1&&ke<=7?ke:1,ze=((new Date(Date.UTC(Oe.year,Oe.month-1,Oe.day)).getUTCDay()+6)%7+1-Re+7)%7,Ye=new Date(Date.UTC(Oe.year,Oe.month-1,Oe.day-ze));return W({year:Ye.getUTCFullYear(),month:Ye.getUTCMonth()+1,day:Ye.getUTCDate()},Ne)}return W({year:Oe.year,month:Oe.month,day:Oe.day},Ne)}function xe(Ee,Ge){const Ne=Ee&&Ee.group,ke=Ne&&Ne.granularity||"day";if(ke==="instant")return null;const Oe=Ne&&Ne.weekStart;return Re=>typeof Re=="number"?ye(Re,ke,Ge,Oe):Re}const Se={time:{base:"number",storage:"float64",matches:a,format:Ee=>b(f(Ee.value),o(Ee,"time")),parse:Ee=>n(Ee.text),compare:(Ee,Ge)=>d(f(Ee),f(Ge)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:Ee=>{const Ge=f(Ee);return Ge===null?null:Ge/$},toStorage:Ee=>f(Ee),toClipboard:p,fromClipboard:n},datetime:{base:"dateString",storage:"dictionary",matches:A,format:Ee=>T(Ee.value,o(Ee,"datetime")),parse:Ee=>x(S(Ee.text,o(Ee,"datetime"))??Ee.text),compare:Y,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(Ee,Ge)=>x(Ee,Ge&&Ge.timeZone),toClipboard:Ee=>N(Ee)?"":String(Ee),fromClipboard:Ee=>x(Ee)},duration:{base:"number",storage:"float64",matches:ge,format:Ee=>fe(ne(Ee.value),o(Ee,"duration")),parse:Ee=>J(Ee.text,o(Ee,"duration")),compare:(Ee,Ge)=>d(ne(Ee),ne(Ge)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:Ee=>{const Ge=ne(Ee);return Ge===null?null:Ge/$},toStorage:Ee=>ne(Ee),toClipboard:Ee=>fe(ne(Ee),{style:"short",maxUnits:-1}),fromClipboard:Ee=>J(Ee)},timestamp:{base:"number",storage:"float64",format:Ee=>{const Ge=o(Ee,"timestamp");return me(Ee.value,{...Ge,timeZone:ce(Ge,Ee)})},parse:Ee=>{const Ge=o(Ee,"timestamp"),Ne=S(Ee.text,{timeZone:ce(Ge,Ee)});return Ne?Ne.getTime():null},compare:(Ee,Ge)=>d(E(Ee),E(Ge)),groupProjector:(Ee,Ge)=>xe(Ee,Ge),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(Ee,Ge)=>{const Ne=E(Ee);if(Ne==null)return null;const ke=P(Ne,Ge&&Ge.timeZone||void 0);return(Date.UTC(ke.year,ke.month-1,ke.day,ke.hour,ke.minute,ke.second)-je)/$},toStorage:Ee=>E(Ee),toClipboard:Ee=>{const Ge=E(Ee);return Ge==null?"":new Date(Ge).toISOString()},fromClipboard:Ee=>E(Ee)}},Te=["datetime","time","duration"],Be=Se}),He("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(G=256,F=null){this.#e=G,this.#n=F}get size(){return this.#t.size}get max(){return this.#e}set max(G){this.#e=G,this.#r()}has(G){return this.#t.has(G)}get(G){const F=this.#t;if(!F.has(G))return;const L=F.get(G);return F.delete(G),F.set(G,L),L}peek(G){return this.#t.get(G)}set(G,F){const L=this.#t;return L.has(G)&&L.delete(G),L.set(G,F),this.#r(),F}delete(G){const F=this.#t.get(G);return this.#t.delete(G)&&this.#n&&this.#n(F,G),F}clear(){if(this.#n)for(const[G,F]of this.#t)this.#n(F,G);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const G=this.#t;for(;G.size>this.#e;){const F=G.keys().next().value,L=G.get(F);G.delete(F),this.#n&&this.#n(L,F)}}}}),He("packages/core/src/columns/types/network.js",function(e,D){"use strict";Object.defineProperty(e,"toUint32",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"compareIpv4",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"packCidr",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"cidrParts",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isCidr",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"compareCidr",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"netmask",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"addressCount",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"ipv6Groups",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return E}});const N=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/lru.js").Lru,L=4294967295,Z=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function z(O){if(N(O))return null;if(typeof O=="string")return x(O);const M=Number(O);return Number.isFinite(M)?M<0?M<-2147483648?null:M>>>0:M>L?null:Math.trunc(M)>>>0:null}function x(O){if(N(O))return null;const M=String(O).trim();if(M==="")return null;const T=Z.exec(M);if(!T)return null;let A=0;for(let I=1;I<=4;I++){const U=T[I];if(U.length>1&&U.charCodeAt(0)===48)return null;const X=Number(U);if(X>255)return null;A=A*256+X}return A}function Y(O){const M=z(O);return M===null?"":`${M>>>24&255}.${M>>>16&255}.${M>>>8&255}.${M&255}`}function $(O){return typeof O=="string"&&x(O)!==null}function j(O,M){const T=z(O),A=z(M);return T===null?A===null?0:1:A===null||T<A?-1:T>A?1:0}const k=64,y=L*k+32,c=/^(?:0|[1-9]\d?)$/;function m(O,M){return O*k+M}function s(O){if(N(O))return null;if(typeof O=="string"){const A=t(O);return A===null?null:s(A)}if(typeof O=="object"){const A=z(O.address),I=Number(O.prefix);return A===null||!Number.isInteger(I)||I<0||I>32?null:{address:A,prefix:I}}const M=Number(O);if(!Number.isInteger(M)||M<0||M>y)return null;const T=M%k;return T>32?null:{address:(M-T)/k,prefix:T}}function t(O){if(N(O))return null;const M=String(O).trim();if(M==="")return null;const T=M.indexOf("/");if(T<0)return null;const A=x(M.slice(0,T));if(A===null)return null;const I=M.slice(T+1).trim();if(!c.test(I))return null;const U=Number(I);return U>32?null:m(A,U)}function o(O){const M=s(O);return M?`${Y(M.address)}/${M.prefix}`:""}function u(O){return typeof O=="string"&&t(O)!==null}function d(O,M){const T=s(O),A=s(M);return T?A?T.address!==A.address?T.address<A.address?-1:1:T.prefix-A.prefix:-1:A?1:0}function i(O){return O===0?0:4294967295<<32-O>>>0}function g(O){const M=s(O);return M?(M.address&i(M.prefix))>>>0:null}function r(O){const M=s(O);return M?(M.address&i(M.prefix)|~i(M.prefix)>>>0)>>>0:null}function n(O){const M=s(O);return M?2**(32-M.prefix):null}function f(O){const M=s(O);return M?M.prefix===32?1:M.prefix===31?2:2**(32-M.prefix)-2:null}function h(O,M){const T=s(O);if(!T)return!1;const A=z(M);if(A===null)return!1;const I=i(T.prefix);return(A&I)>>>0===(T.address&I)>>>0}function l(O,M){const T=g(O),A=g(M);return T===null||A===null?!1:T<=r(M)&&A<=r(O)}const b=/^[0-9a-fA-F]{1,4}$/,a=new F(512);function p(O){if(N(O))return null;let M=String(O).trim();if(M==="")return null;const T=M.indexOf("%");if(T>=0&&(M=M.slice(0,T)),M==="")return null;if(M.indexOf(".")>=0){const _=M.lastIndexOf(":");if(_<0)return null;const H=x(M.slice(_+1));if(H===null)return null;M=`${M.slice(0,_+1)}${(H>>>16&65535).toString(16)}:${(H&65535).toString(16)}`}const A=M.split("::");if(A.length>2)return null;const I=w(A[0]);if(I===null)return null;if(A.length===1)return I.length===8?I:null;const U=w(A[1]);if(U===null)return null;const X=8-I.length-U.length;if(X<1)return null;const q=I.slice();for(let _=0;_<X;_++)q.push(0);for(const _ of U)q.push(_);return q}function w(O){if(O==="")return[];const M=[];for(const T of O.split(":")){if(!b.test(T))return null;M.push(parseInt(T,16))}return M}function v(O){if(typeof O!="string")return p(O);if(a.has(O))return a.get(O);const M=p(O);return a.set(O,M),M}function P(O){if(O[0]===0&&O[1]===0&&O[2]===0&&O[3]===0&&O[4]===0&&O[5]===65535)return`::ffff:${Y((O[6]<<16|O[7])>>>0)}`;let M=-1,T=0,A=-1,I=0;for(let q=0;q<8;q++)O[q]===0?(A<0?(A=q,I=1):I++,I>T&&(T=I,M=A)):(A=-1,I=0);if(T<2)return O.map(q=>q.toString(16)).join(":");const U=O.slice(0,M).map(q=>q.toString(16)).join(":"),X=O.slice(M+T).map(q=>q.toString(16)).join(":");return`${U}::${X}`}function V(O){const M=p(O);return M===null?null:P(M)}function W(O){return V(O)??""}function K(O){return typeof O=="string"&&O.indexOf(":")>=0&&p(O)!==null}function R(O,M){const T=v(O),A=v(M);if(!T)return A?1:0;if(!A)return-1;for(let I=0;I<8;I++)if(T[I]!==A[I])return T[I]<A[I]?-1:1;return 0}const S=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:$,parse:O=>x(O.text),compare:j,format:O=>Y(O.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:O=>z(O),toClipboard:O=>Y(O),fromClipboard:O=>x(O)},cidr:{base:"number",storage:"float64",matches:u,parse:O=>t(O.text),compare:d,format:O=>o(O.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:O=>{const M=s(O);return M===null?null:m(M.address,M.prefix)},toClipboard:O=>o(O),fromClipboard:O=>t(O)},ipv6:{base:"text",storage:"dictionary",matches:K,parse:O=>V(O.text),compare:R,format:O=>W(O.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:O=>V(O),toClipboard:O=>W(O),fromClipboard:O=>V(O)}}),E=S}),He("packages/core/src/i18n/catalogue.js",function(e,D){"use strict";Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return L}});const re=D("packages/core/src/registry/free-tier-notice.js"),N=re.FREE_TIER_NOTICE,G=re.WATERMARK_TEXT,F=Object.freeze({"count.rows":{one:"{count} row",other:"{count} rows"},"count.comments":{one:"{count} comment",other:"{count} comments"},"comments.someUnresolved":"{comments}, {unresolved} unresolved","comments.allResolved":"{comments}, all resolved","count.unresolvedComments":{one:"{count} unresolved comment",other:"{count} unresolved comments"},"count.items":{one:"{count} item",other:"{count} items"},"count.keys":{one:"{count} key",other:"{count} keys"},"count.values":{one:"value",other:"values"},"count.waiting":{one:"{count} waiting",other:"{count} waiting"},"count.rowsAdded":{one:"{count} row added",other:"{count} rows added"},"count.rowsRemoved":{one:"{count} row removed",other:"{count} rows removed"},"value.empty":"empty","a11y.sort.cleared":"Sort cleared","a11y.sort.by":"Sorted by {columns}","a11y.sort.column":"{column} {direction}","a11y.sort.ascending":"ascending","a11y.sort.descending":"descending","a11y.filter.cleared":"Filter cleared, {rows}","a11y.filter.applied":"Filtered to {shown} of {total}","a11y.find.count":{one:"{current} of {count} match",other:"{current} of {count} matches"},"a11y.find.countLoaded":{one:"{current} of {count} match in loaded rows",other:"{current} of {count} matches in loaded rows"},"a11y.find.none":"No matches","a11y.find.noneLoaded":"No matches in loaded rows","a11y.selection.cleared":"Selection cleared","a11y.selection.count":{one:"{count} row selected",other:"{count} rows selected"},"tabs.tablist":"Tabs","a11y.tabs.selected":"{label} tab selected","a11y.scrollbar.horizontal":"Horizontal scrollbar","a11y.scrollbar.vertical":"Vertical scrollbar","designer.canvas":"Dashboard canvas","designer.chrome":"Designer tools","designer.page":"Page {n}","a11y.designer.edit":"Edit mode","a11y.designer.view":"View mode","layout.region":"Dashboard layout","layout.move":"Move {title}","layout.resize":"Resize {title}","layout.close":"Close {title}","a11y.layout.grabbed":"{title} grabbed, column {x} of {columns}, row {y}","a11y.layout.position":"{title}, column {x} of {columns}, row {y}","a11y.layout.dropped":"{title} dropped, column {x} of {columns}, row {y}","a11y.layout.cancelled":"{title} move cancelled","a11y.layout.resizeCancelled":"{title} resize cancelled","a11y.layout.reverted":"{title} returned to column {x}, row {y}","a11y.layout.resizeGrabbed":"{title} resize grabbed, {w} by {h} cells","a11y.layout.resizeStep":"{title}, {w} by {h} cells","a11y.layout.resized":"{title} resized to {w} by {h} cells","a11y.layout.closed":"{title} closed","layout.maximise":"Maximise {title}","layout.minimise":"Minimise {title}","layout.restore":"Restore {title}","a11y.layout.maximised":"{title} maximised, filling the dashboard; press Escape to restore it","a11y.layout.minimised":"{title} minimised","a11y.layout.restored":"{title} restored to column {x}, row {y}","a11y.group.cleared":"Grouping cleared","a11y.group.by":"Grouped by {columns}","a11y.group.expanded":"{label} expanded, {rows} shown","a11y.group.collapsed":"{label} collapsed, {rows} shown","a11y.page.position":"Page {page} of {pages}","a11y.updates.paused":"Updates paused","a11y.updates.resumed":"Updates resumed","a11y.edit.refusedOne":"Edit to {column} was refused and put back to {value}{reason}","a11y.edit.refusedMany":{one:"{count} edit was refused and put back{reason}",other:"{count} edits were refused and put back{reason}"},"a11y.edit.reason":", {reason}","a11y.history.undo":"Undid {label}","a11y.history.redo":"Redid {label}","a11y.history.undoLast":"Undid the last change","a11y.history.redoLast":"Redid the last change","a11y.column.cannotResize":"{column} cannot be resized","a11y.column.resized":"{column} is {width} pixels wide","a11y.column.atMinimum":"{column} is at its narrowest, {width} pixels","a11y.column.atMaximum":"{column} is at its widest, {width} pixels","a11y.column.cannotMove":"{column} cannot be moved","a11y.column.alreadyFirst":"{column} is already first in its group","a11y.column.alreadyLast":"{column} is already last in its group","a11y.column.cannotMoveThere":"{column} cannot be moved there","a11y.column.moved":"{column} moved to position {at} of {of}","a11y.group.formed":"{column} grouped with {other} in a new band","a11y.group.dissolved":"band {group} dissolved","a11y.group.renamed":"band renamed to {group}","a11y.group.moved":"band {group} moved to position {at} of {of}","a11y.column.addedToGroup":"{column} added to band {group}","a11y.column.removedFromGroup":"{column} removed from its band","a11y.column.notInGroup":"{column} is not in a band","a11y.column.cannotGroup":"{column} cannot be grouped","a11y.group.cannotMove":"band {group} cannot be moved there","columngroup.newGroup":"New group","columngroup.rename":"Rename band","columngroup.dissolve":"Dissolve band","columngroup.group":"Group with adjacent column","columngroup.untitled":"Untitled band","panel.bandCollapse":"Collapse band {band}","panel.bandExpand":"Expand band {band}","panel.bandVisible":"Show or hide every column in band {band}","panel.bandRenameFor":"Rename band {band}","panel.bandDissolveFor":"Dissolve band {band}","header.filter":"Filter {column}","header.menu":"Column menu for {column}","header.toggleGroup":"Toggle {group}","header.dragHint":"Drag {column} to reorder, or onto another column to group","header.dragRole":"draggable column header","header.group":"group","header.selectAllRows":"Select all rows","header.clearSelection":"Clear selection","cell.selectRow":"Select row","cell.detail.show":"Show detail","cell.detail.hide":"Hide detail","cell.detail.showInPane":"Show in the detail pane","cell.detail.showingInPane":"Showing in the detail pane","cell.group.expand":"Expand","cell.group.collapse":"Collapse","cell.delta.up":"up","cell.delta.down":"down","cell.delta.unchanged":"unchanged","cell.delta.moved":"{direction} {magnitude}","cell.delta.describedUnchanged":"{label}, unchanged","cell.delta.described":"{label}, {direction} by {magnitude}","cell.qr.of":"QR code for {text}","cell.qr.empty":"No QR code","cell.barcode.of":"Barcode for {text}","cell.barcode.empty":"No barcode","cell.barcode.invalid":"Invalid value for this barcode","cell.rating.of":"{rating} of {max}","cell.rating.empty":"Not rated","cell.stage.of":"Stage {current} of {total}: {label}","cell.stage.empty":"No stage","a11y.panel.cannotMove":"{column} cannot be moved","a11y.panel.alreadyFirst":"{column} is already first","a11y.panel.alreadyLast":"{column} is already last","a11y.panel.moved":"{column} moved to position {at} of {of}","a11y.panel.removedFrom":"{column} removed from {list}","a11y.panel.addedTo":"{column} added to {list}","a11y.panel.cannotAddTo":"{column} cannot be added to {list}","a11y.annotate.erased":"Annotation removed","a11y.annotate.noMarks":"No annotations to erase","a11y.annotate.focusedMark":"Mark {at} of {of} selected","a11y.annotate.confirmClear":"Clear all annotations? Choose Clear or Keep.","a11y.annotate.cleared":"All annotations cleared","a11y.range.written":{one:"{count} cell updated",other:"{count} cells updated"},"a11y.range.cleared":{one:"{count} cell cleared",other:"{count} cells cleared"},"paste.preview.title":"Review paste","paste.preview.summary":{one:"{changes} cell will change, {rejected} rejected.",other:"{changes} cells will change, {rejected} rejected."},"paste.preview.changesHeading":{one:"{count} change",other:"{count} changes"},"paste.preview.rejectedHeading":{one:"{count} rejected",other:"{count} rejected"},"paste.preview.colOld":"Current","paste.preview.colNew":"New","paste.preview.colCell":"Cell","paste.preview.colReason":"Reason","paste.preview.empty":"This paste would change nothing.","paste.preview.confirm":"Apply","paste.preview.cancel":"Cancel","paste.preview.reason.permission":"Not permitted","paste.preview.reason.readOnly":"Read-only","paste.preview.reason.validation":"Invalid value","paste.preview.reason.locked":"Being edited","paste.preview.reason.missing":"No such cell","a11y.paste.previewOpened":{one:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel.",other:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel."},"a11y.paste.cancelled":"Paste cancelled; nothing changed","status.total":"{rows}","status.counting":"Counting rows…","status.shownOfTotal":"{shown} of {total}","status.selected":"{count} selected","status.selectedAcrossSource":"{count} selected across the source","status.selectedAcrossSourceCounting":"All matching rows selected, counting…","status.count":"Count {count}","status.loading":"Loading {count}…","status.loadingOf":"Loading {loaded} of {total} ({percent}%)","status.stat.sum":"Sum","status.stat.min":"Min","status.stat.max":"Max","status.stat.avg":"Avg","status.paused":"Paused","status.pausedWaiting":"Paused · {waiting}","status.coalesced":"{count} coalesced","status.hiddenComments":"{comments} on hidden rows","pagination.label":"Pagination","pagination.first":"First page","pagination.previous":"Previous page","pagination.next":"Next page","pagination.last":"Last page","pagination.page":"Page","pagination.ofPages":"of {pages}","pagination.summary":"{from}–{to} of {total}","pagination.pageSize":"Rows per page","pagination.range":"{from}–{to}","pagination.counting":"{from}–{to}, counting…","pagination.jump":"Page number, press Enter to jump","pagination.jumpBounded":"Page number, 1 to {pages}, press Enter to jump","panel.columns":"Columns","panel.filters":"Filters","panel.views":"Views","panel.quickFilter":"Quick filter","find.label":"Find in grid","find.placeholder":"Find in grid","find.next":"Next match","find.previous":"Previous match","find.close":"Close find","find.matchCase":"Match case","find.wholeCell":"Whole cell","find.columnScope":"Search in","find.allColumns":"All columns","find.count":"{current} of {total}","find.countPartial":"{current} of {total} so far","find.none":"No matches","find.searching":"Searching…","find.loadedRows":"in loaded rows","rowCap.more":"+ {count} more","panel.formatting":"Formatting","panel.statistics":"Statistics","stat.noData":"No data","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.blockedBy":{one:"blocked by {count} card",other:"blocked by {count} cards"},"kanban.card.assignedTo":"Assigned to {names}","kanban.card.overdue":"Overdue","kanban.card.dueSoon":"Due soon","kanban.card.progress":"{percent}% complete","kanban.card.checklist":"{done} of {total} done","gantt.lag":"+{days}d","gantt.lead":"{days}d","gantt.a11y.moved":"{name} moved to {date}","gantt.a11y.day":"day {day}","gantt.a11y.resized":"{name} resized to {days} days","gantt.a11y.linkFrom":"Linking from {name}. Focus the successor and press L.","gantt.a11y.linked":"Linked {from} to {to}, finish to start.","gantt.a11y.linkCancelled":"Link cancelled.","gantt.a11y.deleted":"{name} deleted.","gantt.a11y.readOnly":"Read-only.","gantt.row.moveHandle":"Drag to reorder or re-parent {name}","gantt.a11y.rowMoved":"{name} moved.","gantt.a11y.rowReparented":"{name} moved under {parent}.","gantt.a11y.rowPromoted":"{name} moved to the top level.","gantt.a11y.rowMoveCancelled":"Move cancelled.","gantt.a11y.copied":"{count} tasks copied.","gantt.a11y.cut":"{count} tasks cut.","gantt.a11y.pasted":"{count} tasks pasted.","gantt.task.newName":"New task","gantt.a11y.taskAdded":"{name} added.","gantt.menu.addAbove":"Add task above","gantt.menu.addBelow":"Add task below","gantt.menu.addChild":"Add subtask","gantt.menu.addSuccessor":"Add successor","gantt.menu.addPredecessor":"Add predecessor","gantt.menu.toMilestone":"Convert to milestone","gantt.menu.toTask":"Convert to task","gantt.menu.delete":"Delete task","gantt.a11y.linkCycle":"Linking {from} to {to} would create a cycle; link not created.","gantt.a11y.linkCreated":"{from} linked to {to}, {type}.","gantt.a11y.linkDeleted":"Link from {from} to {to} deleted.","gantt.a11y.linkLabel":"Link, {from} to {to}, {type}","gantt.linkEditor.title":"Edit link from {from} to {to}","gantt.linkEditor.type":"Link type","gantt.linkEditor.lag":"Lag, in days","gantt.linkEditor.apply":"Apply","gantt.linkEditor.delete":"Delete link","gantt.linkEditor.cancel":"Cancel","gantt.a11y.undone":"Undone.","gantt.a11y.redone":"Redone.","gantt.a11y.nothingToUndo":"Nothing to undo.","gantt.a11y.nothingToRedo":"Nothing to redo.","gantt.workload.title":"Resource workload","gantt.workload.resource":"Resource","gantt.workload.total":"Total","gantt.workload.unassigned":"Unassigned","gantt.workload.ungrouped":"No group","gantt.workload.cell":"{hours} h from {date}","gantt.workload.over":"{hours} h from {date}, over a capacity of {capacity} h","gantt.workload.expand":"Show {name}’s tasks","gantt.workload.collapse":"Hide {name}’s tasks","gantt.workload.expandGroup":"Show the {name} group","gantt.workload.collapseGroup":"Hide the {name} group","gantt.workload.unitToggle":"Hours / % / Cost","gantt.workload.unitHours":"Showing hours","gantt.workload.unitPercent":"Showing percent of capacity","gantt.workload.unitCost":"Showing cost","gantt.workload.cellPercent":"{percent}% from {date}","gantt.workload.overPercent":"{percent}% from {date}, over capacity","gantt.workload.cellNoCapacity":"No available hours from {date}","gantt.workload.cellCost":"{cost} from {date}","gantt.workload.otherProjectLabel":"{name} (other project)","gantt.workload.external":"External booking","gantt.a11y.hoursSet":"{name}: {hours} h from {date}","gantt.a11y.hoursCleared":"{name}: no hours from {date}","gantt.a11y.hoursRefused":"{date} is not a working day; {name} was not changed.","gantt.histogram.title":"Resource histogram","gantt.histogram.tableTitle":"Resource histogram data","gantt.histogram.resource":"Resource","gantt.histogram.period":"Period","gantt.histogram.hours":"Hours","gantt.histogram.percent":"Percent of capacity","gantt.histogram.cost":"Cost","gantt.histogram.capacity":"Capacity","gantt.histogram.overAllocated":"Over-allocated","gantt.histogram.yes":"Yes","gantt.histogram.no":"No","gantt.histogram.tip":"{name}, {from} to {to}: {value}{capacity}{tasks}","gantt.histogram.tipHours":"{hours} h","gantt.histogram.tipPercent":"{percent}% of capacity","gantt.histogram.tipCost":"{cost}","gantt.histogram.tipCapacity":", capacity {hours} h","gantt.histogram.tipTasks":" ({tasks})","gantt.histogram.tipOver":", over capacity","gantt.histogram.tipNoCapacity":"no available hours","gantt.picker.title":"Assign resources to {name}","gantt.picker.open":"Edit assignments for {name}","gantt.picker.search":"Search resources","gantt.picker.list":"Resources","gantt.picker.selected":"Assigned resources","gantt.picker.load":"{load}% booked of {capacity}% over these dates","gantt.picker.none":"No matching resources","gantt.picker.units":"{name}, units in percent","gantt.picker.remove":"Remove {name}","gantt.picker.apply":"Apply","gantt.picker.cancel":"Cancel","gantt.picker.warn":"{name} would be over-allocated: {load}% booked of {capacity}%","gantt.picker.ok":"No resource would be over-allocated","gantt.picker.assign":"Assign","gantt.col.effort":"Effort","gantt.col.units":"Units","gantt.unscheduled":"Unscheduled","gantt.col.unscheduled":"Unscheduled","gantt.inactive":"Inactive","gantt.col.inactive":"Inactive","gantt.col.slack":"Slack","gantt.col.deadline":"Deadline","gantt.col.constraint":"Constraint","gantt.col.constraintDate":"Constraint date","gantt.col.earlyStart":"Early start","gantt.col.lateStart":"Late start","gantt.col.lateFinish":"Late finish","gantt.col.baselineStart":"Baseline start","gantt.col.baselineEnd":"Baseline finish","gantt.col.variance":"Variance","gantt.col.note":"Note","gantt.col.sequence":"#","gantt.col.predecessors":"Predecessors","gantt.col.successors":"Successors","gantt.link.invalid":"Cannot read “{token}” as a link. Write a task number, a type and a lag, like 3FS+2; links not changed.","gantt.link.unknownRef":"No task is numbered “{token}”; links not changed.","gantt.link.self":"“{token}” links a task to itself; links not changed.","gantt.link.duplicate":"“{token}” repeats a link already listed; links not changed.","gantt.link.cycle":"“{token}” would create a cycle; links not changed.","gantt.constraint.ASAP":"As soon as possible","gantt.constraint.MSO":"Must start on","gantt.constraint.MFO":"Must finish on","gantt.constraint.ALAP":"As late as possible","gantt.constraint.SNET":"Start no earlier than","gantt.constraint.SNLT":"Start no later than","gantt.constraint.FNET":"Finish no earlier than","gantt.constraint.FNLT":"Finish no later than","gantt.row.ancestor":"Shown because a task inside it matches the filter","gantt.progress.handle":"Drag to set the progress of {name}","gantt.a11y.progress":"{name} {percent}% complete","gantt.col.name":"Task name","gantt.col.start":"Start","gantt.col.end":"Finish","gantt.col.duration":"Duration","gantt.col.assignee":"Assignee","gantt.col.progress":"%","gantt.col.wbs":"WBS","gantt.zoom.label":"Zoom","gantt.zoom.day":"Day","gantt.zoom.week":"Week","gantt.zoom.month":"Month","gantt.zoom.quarter":"Quarter","gantt.zoom.fit":"Fit to plan","gantt.tip.range":"{from} to {to}","gantt.tip.duration":"{days}d","gantt.tip.slack":"slack {days}d","gantt.tip.effort":"{hours}h","gantt.tip.row":"{label}: {value}","gantt.tip.start":"Start","gantt.tip.end":"End","gantt.tip.date":"Date","gantt.tip.durationLabel":"Duration","gantt.tip.durationValue":"{days} days","gantt.tip.complete":"Complete","gantt.tip.effortLabel":"Effort","gantt.tip.effortValue":"{hours} h","gantt.tip.assigned":"Assigned","gantt.tip.cost":"Cost","gantt.tip.slackLabel":"Slack","gantt.tip.slackValue":"{days} days","gantt.tip.deadline":"Deadline","gantt.mode.fixedDuration":"Fixed duration","gantt.mode.fixedEffort":"Fixed effort","gantt.mode.fixedUnits":"Fixed units","gantt.scurve.spi":"SPI {index}","gantt.scurve.cpi":"CPI {index}","gantt.print.page":"Page {page} of {pages}","gantt.print.printed":"Printed {date}","gantt.dataBand.title":"Data band","gantt.dataBand.name":"Task","gantt.dataBand.resource":"Resource","gantt.dataBand.total":"Total","gantt.dataBand.unassigned":"Unassigned","gantt.dataBand.collapse":"Collapse {name}","gantt.dataBand.expand":"Expand {name}","gantt.dataBand.cell":"{name}, {date}: {value}","gantt.issues.title":"Scheduling conflicts","gantt.issues.empty":"No scheduling conflicts","gantt.issues.count":"{count} scheduling conflicts","gantt.issues.toggle":"Toggle the conflicts panel","gantt.issues.cycle":"Circular dependency: {tasks}","gantt.issues.constraint":"{task} cannot meet its {constraint} constraint of {date}","gantt.issues.lock":"{task} is locked but a dependency would move it","gantt.issues.deadline":"{task} finishes after its deadline of {date}","gantt.issues.fixRemoveLink":"Remove link","gantt.issues.fixAsap":"Set as soon as possible","gantt.issues.fixUnlock":"Unlock task","gantt.issues.fixClearDeadline":"Clear deadline","gantt.resize.startHandle":"Drag to change the start of {name}","gantt.a11y.resizedStart":"{name} start moved to {date}, now {days} days","gantt.a11y.startEdge":"Start edge can be resized: drag the left edge, or press Ctrl+Shift+Left or Right.","gantt.a11y.chain":"Dependency chain highlighted: {preds} predecessors, {succs} successors.","timeline.scrub":"Scrub through recent changes","timeline.goLive":"Go live","timeline.returnToPresent":"Return to the present","a11y.fillHandle":"Drag to fill","panel.icons":"Icons","value.tooLong":"Too long","dataview.label":"Items","dataview.empty":"No items","dataview.reorder.sorted":"Items cannot be reordered while the view is sorted","dataview.reorder.filtered":"Items cannot be reordered while a filter is applied","shortcuts.title":"Keyboard shortcuts","shortcuts.close":"Close keyboard shortcuts","shortcuts.hint":"Press Escape to close.","shortcuts.or":"or","a11y.reorder.moved":"Moved to position {position} of {total}","a11y.reorder.sorted":"Rows cannot be reordered while the grid is sorted","a11y.reorder.filtered":"Rows cannot be reordered while a filter is applied","a11y.reorder.grouped":"Rows cannot be reordered while the grid is grouped","a11y.reorder.grab":"Reorder row","a11y.reorder.sortedManual":"Rows cannot be reordered while the grid is sorted. Press Alt+Shift+M, or the Manual order button in the heading, to order them by hand","a11y.reorder.groupDerived":"The row cannot join that group: the group is worked out from the value, so there is no single value to give it","a11y.reorder.groupReadOnly":"The row cannot join that group: its grouping value cannot be edited","a11y.reorder.invalid":"The row cannot join that group: the new value was not valid","a11y.reorder.vetoed":"The move was declined; the row stays where it was","a11y.reorder.vetoedBecause":"The move was declined ({reason}); the row stays where it was","a11y.reorder.refused":"The row cannot be moved there","a11y.reorder.regrouped":"Moved into {group}","a11y.tree.dropRefusedDescendant":"A row cannot be dropped into one of its own descendants; the row stays where it was","a11y.rowOrder.entered":"Manual order: the rows keep their places and can be moved by hand","a11y.rowOrder.exited":"Manual order ended; the rows follow the sort","rowOrder.button":"Manual order","rowOrder.enter":"Order the rows by hand instead of by the sort","rowOrder.exit":"Return to the sorted order","a11y.transfer.moved":"Row moved to the other grid","a11y.transfer.copied":"Row copied to the other grid","a11y.transfer.refused":"That grid does not accept this row","a11y.transfer.declined":"The drop was declined; the row stays where it was","a11y.transfer.stale":"The drop target changed while it was being confirmed; the row stays where it was","shortcuts.group.grid":"In the data","shortcuts.group.header":"On a column heading","shortcuts.group.panel":"In the column list","shortcut.moveCell":"Move the focused cell","shortcut.rowEnds":"First / last cell of the row","shortcut.gridEnds":"First cell of the first row / last cell of the last row","shortcut.pageRows":"Move one viewport of rows","shortcut.nextCell":"Leave the grid for the next / previous focusable element (arrows move between cells)","shortcut.undo":"Undo the last edit, paste, fill or clear","shortcut.redo":"Redo the step that was undone","shortcut.startEdit":"Start editing the focused cell","shortcut.toggleRow":"Toggle selection of the focused row","shortcut.cancel":"Cancel the current edit or drag","shortcut.expandCollapse":"Expand / collapse a group or tree row","shortcut.focusHeader":"Move focus to the column header","shortcut.focusPanel":"Move focus to the tool panel","shortcut.explain":"Explain the focused column","shortcut.contextMenu":"Open the context menu for the focused cell","shortcut.moveRow":"Move the focused row, when row reorder is enabled","shortcut.manualOrder":"Order the rows by hand, or return to the sort, when row reorder allows a manual order","shortcut.headingMove":"Move between headings","shortcut.headingEnds":"First / last heading","shortcut.headingSort":"Sort by the column, Shift to add to the sort","shortcut.headingResize":"Resize the column, Ctrl for a coarse step","shortcut.headingAutosize":"Size the column to its content","shortcut.headingReorder":"Move the column","shortcut.headingMenu":"Open the column menu","shortcut.headingExit":"Return focus to the data","shortcut.listGroup":"Group by the column, or stop grouping by it","shortcut.listValues":"Add the column to values, or take it out","shortcut.listPivot":"Pivot by the column, or stop pivoting by it","shortcut.listMove":"Move the column","shortcut.find":"Find in the grid","tags.label":"Show columns","tags.all":"All columns","tags.showing":"Showing {tag}","form.title":"Edit row","form.save":"Save","form.cancel":"Cancel","form.loading":"Loading…","form.loadFailed":"Could not load this record.","form.loadTimeout":"The record did not arrive in time.","form.retry":"Try again","form.choose":"Choose…","form.newTitle":"New row","form.createFailed":"Could not add this record.","form.grid.cellInvalid":"Row {row}, {column}: {message}","form.grid.required":"Add at least one row.","form.grid.addRow":"Add row","form.grid.deleteRow":"Delete row","form.grid.total":"Total","form.grid.rowControls":"Row controls","presentation.cards":"Showing records as cards","presentation.table":"Showing records as a table","editor.format":"Format","editor.codeHint":"Tab indents · Esc cancels · Ctrl+Enter saves","editor.colours":"Colours","editor.customColour":"Custom colour","editor.hexValue":"Hex value","editor.hexPlaceholder":"#rrggbb","editor.clearColour":"Clear colour","editor.time":"Time","editor.noIcon":"No icon","editor.selectAll":"Select all","editor.passwordHint":"Enter the value twice to save it.","editor.clearRating":"Clear rating","editor.clear":"Clear","editor.value":"Value","editor.currency":"Currency","editor.richtext.formatting":"Formatting","editor.richtext.richText":"Rich text","editor.richtext.placeholder":"Start writing…","editor.richtext.linkLabel":"Link address","editor.richtext.linkPlaceholder":"https://","editor.richtext.linkAdd":"Add link","editor.richtext.bold":"Bold (Ctrl+B)","editor.richtext.italic":"Italic (Ctrl+I)","editor.richtext.underline":"Underline (Ctrl+U)","editor.richtext.strike":"Strikethrough","editor.richtext.heading":"Paragraph style","editor.richtext.alignLeft":"Align left","editor.richtext.alignCenter":"Align centre","editor.richtext.alignRight":"Align right","editor.richtext.ul":"Bulleted list","editor.richtext.ol":"Numbered list","editor.richtext.color":"Text colour","editor.richtext.link":"Link (Ctrl+K)","editor.richtext.image":"Insert image","editor.richtext.clear":"Clear formatting","editor.richtext.source":"HTML source","editor.richtext.undo":"Undo (Ctrl+Z)","editor.richtext.redo":"Redo (Ctrl+Y)","formatting.format":"Format","formatting.noRules":"No rules yet. The first one that matches a cell wins.","formatting.clearAll":"Clear all","formatting.addRule":"Add rule","formatting.condition":"Condition","formatting.value":"Value","formatting.secondValue":"Second value","formatting.moveEarlier":"Move earlier","formatting.moveLater":"Move later","formatting.ruleKind":"Rule type","formatting.aCondition":"A condition","formatting.aColourScale":"A colour scale","formatting.compare":"Compare a value","formatting.distribution":"By the distribution","formatting.colourScale":"Colour scale","formatting.scaleBounds":"Scale bounds","formatting.preview":"Preview","formatting.livePreview":"Live preview","history.title":"History","history.show":"Show history","history.empty":"Nothing to undo yet.","prompt.ask":"Ask","prompt.apply":"Apply","prompt.discard":"Discard","panel.searchColumns":"Search columns","panel.searchColumnsPlaceholder":"Search columns…","panel.searchColumnsToFilter":"Search columns to filter","panel.showAll":"Show all","panel.hideAll":"Hide all","panel.clearAll":"Clear all","panel.clear":"Clear","panel.filterAllColumns":"Filter all columns","panel.columnFiltered":"This column is filtered","panel.clearFilterOn":"Clear the filter on {column}","panel.clearFilter":"Clear this filter","panel.filterEmptyNoMatch":"No column matches “{query}”.","panel.filterEmptyNone":"No column on this grid can be filtered.","panel.filterSummaryActive":"{active} of {total} columns filtered","panel.filterSummaryNone":"No filters · {total} columns available","panel.filterBy":"Filter by {column}","panel.filteredBy":"Filtered by {column}","panel.columnDragHint":"Drag {column} into a zone above, or onto another column to reorder","panel.gridActions":"Grid actions","panel.tabActiveCount":{one:"{title}, {count} active",other:"{title}, {count} active"},"panel.tabActive":"{title}, active","views.default":"Default","views.namePlaceholder":"Name this view…","views.nameLabel":"Name for the current layout","views.save":"Save view","licence.watermark":G,"licence.watermark.free":N,"filter.op.contains":"Contains","filter.op.notContains":"Does not contain","filter.op.equals":"Equals","filter.op.notEqual":"Does not equal","filter.op.startsWith":"Starts with","filter.op.endsWith":"Ends with","filter.op.blank":"Is blank","filter.op.notBlank":"Is not blank","filter.op.lessThan":"Less than","filter.op.lessThanOrEqual":"Less than or equal","filter.op.greaterThan":"Greater than","filter.op.greaterThanOrEqual":"Greater than or equal","filter.op.inRange":"In range","filter.op.matches":"Matches","filter.op.before":"Before","filter.op.after":"After","filter.op.relative":"Relative to today","filter.rel.today":"Today","filter.rel.yesterday":"Yesterday","filter.rel.tomorrow":"Tomorrow","filter.rel.lastNDays":"Last N days","filter.rel.nextNDays":"Next N days","filter.rel.thisWeek":"This week","filter.rel.lastWeek":"Last week","filter.rel.thisMonth":"This month","filter.rel.lastMonth":"Last month","filter.rel.thisQuarter":"This quarter","filter.rel.quarterToDate":"Quarter to date","filter.rel.thisYear":"This year","filter.rel.yearToDate":"Year to date","filter.operator":"Operator","filter.join":"Join","filter.value":"Value","filter.from":"From","filter.to":"To","filter.addCondition":"Add condition","filter.noConditions":"No conditions","filter.removeCondition":"Remove condition","filter.search":"Search","filter.searchValues":"Search values","filter.noMatches":"No values match","filter.selectAll":"Select all","filter.clear":"Clear","filter.all":"All","filter.allExcept":"All but {count}","filter.loadingValues":"Loading values…","filter.topValues":"Top {shown} of {total} values","filter.valuesFailed":"Values could not be loaded: {error}","filter.valuesUnsupported":"This source cannot list the values of {column}; filter by condition instead.","filter.true":"True","filter.false":"False","filter.expression":"Filter expression","filter.column":"Column","filter.relativePeriod":"Relative period","filter.days":"Number of days","filter.tab.set":"Values","filter.tab.text":"Text","filter.tab.number":"Number","filter.tab.date":"Date","filter.tab.advanced":"Advanced","filterRow.label":"Filter row","filterRow.conditions":{one:"{count} condition",other:"{count} conditions"},"chart.empty":"Nothing to chart","chart.summary":"{type} chart of {measure} by {dimension}","chart.summaryShare":"{type} chart of {measure}","chart.summaryType":"{type} chart","chart.summaryGauge":"{type} chart of {measure}, {fn}: {value}","chart.waterfallTotal":"Total","chart.summaryEngine":"Figures computed by the data engine over every matching row","chart.summaryEngineViewport":"{count} points in this view, fetched from the data engine","chart.summaryEngineDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells counted by the data engine","chart.summaryClientDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells computed in the browser","chart.viewportOverCap":"{count} rows in this view, more than the {cap} this map draws; zoom in or narrow the filter","chart.dataTable":"Chart data","chart.viewportFilter.label":"Map view","chart.annotate.rail":"Drawing tools","chart.annotate.select":"Select and move a drawing","chart.annotate.trendLine":"Trend line","chart.annotate.horizontalLine":"Horizontal line","chart.annotate.verticalLine":"Vertical line","chart.annotate.channel":"Parallel channel","chart.annotate.fibonacci":"Fibonacci retracement","chart.annotate.arrow":"Arrow","chart.annotate.pen":"Freehand pen","chart.annotate.pen.described":"Freehand drawing from {from} to {to}","chart.annotate.measure-x":"Date range","chart.annotate.measure-y":"Price range","chart.annotate.measure-xy":"Date and price range","chart.annotate.measure.bars":{one:"{count} bar",other:"{count} bars"},"chart.annotate.measure.points":{one:"{count} point",other:"{count} points"},"chart.annotate.measure.volume":"Vol {value}","chart.annotate.measure.seconds":"{count}s","chart.annotate.measure.minutes":"{count}m","chart.annotate.measure.hours":"{count}h","chart.annotate.measure.days":"{count}d","chart.annotate.measure.weeks":"{count}w","chart.annotate.measure.months":"{count}mo","chart.annotate.measure.years":"{count}y","chart.annotate.measure":"Measure","chart.annotate.measure.dx":"Δx {value}","chart.annotate.measure.dy":"Δy {value}","chart.annotate.measure.pct":"{value}%","chart.annotate.measure.categories":{one:"{count} category",other:"{count} categories"},"chart.annotate.measure.slope.perDay":"Slope {value} per day","chart.annotate.measure.slope.perCategory":"Slope {value} per category","chart.annotate.measure.slope.perUnit":"Slope {value} per unit","chart.annotate.measure.dur.d":"{count} d","chart.annotate.measure.dur.h":"{count} h","chart.annotate.measure.dur.min":"{count} min","chart.annotate.measure.dur.s":"{count} s","chart.annotate.measure.dur.ms":"{count} ms","chart.annotate.measure.announce":"Measurement: {readout}","chart.annotate.measure.start":"Measure start: {x}, {y}","chart.annotate.text":"Text","chart.annotate.callout":"Callout","chart.annotate.note":"Note","chart.annotate.delete":"Delete the selected drawing","chart.annotate.editLabel":"Annotation text","chart.zoom.toolbar":"Zoom controls","chart.zoom.in":"Zoom in","chart.zoom.out":"Zoom out","chart.zoom.left":"Pan left","chart.zoom.right":"Pan right","chart.zoom.reset":"Reset the zoom","chart.legendMore":{one:"+{count} more",other:"+{count} more"},"chart.type.line":"Line","chart.type.area":"Area","chart.type.bar":"Bar","chart.type.pie":"Pie","chart.type.donut":"Donut","chart.type.sunburst":"Sunburst","chart.type.scatter":"Scatter","chart.type.step":"Step","chart.type.rangeArea":"Range","chart.type.horizontalBar":"Horizontal bar","chart.type.waterfall":"Waterfall","chart.type.floatingBar":"Floating bar","chart.type.horizontalFloatingBar":"Horizontal floating bar","chart.type.populationPyramid":"Population pyramid","chart.type.bullet":"Bullet","chart.type.bubble":"Bubble","chart.type.histogram":"Histogram","chart.type.boxplot":"Box plot","chart.type.forest":"Forest plot","chart.type.qq":"QQ plot","chart.type.ecdf":"ECDF","chart.type.lorenz":"Lorenz","chart.type.correlogram":"Correlogram","chart.type.control":"Control","chart.type.capability":"Capability","chart.type.movingRange":"Moving range","chart.type.treemap":"Treemap","chart.type.combo":"Combination","chart.type.pareto":"Pareto","chart.type.heatmap":"Heat map","chart.type.radar":"Radar","chart.type.gauge":"Gauge","chart.type.funnel":"Funnel","chart.type.candlestick":"Candlestick","chart.type.ohlc":"OHLC","chart.type.polarArea":"Polar area","chart.type.nightingale":"Nightingale rose","chart.type.rose":"Rose","chart.type.radialBar":"Radial bar","chart.type.polarScatter":"Polar scatter","chart.type.geomap":"Map","chart.type.sankey":"Sankey","chart.type.chord":"Chord","chart.type.pyramid":"Pyramid","chart.type.pictorial":"Pictorial","chart.type.serpentine":"Serpentine timeline","chart.type.spiral":"Spiral timeline","chart.edit.aggregated":"This value is a total of several rows, so it cannot be dragged.","chart.edit.refused":"That change was not applied.","chart.edit.refusedWhy":"That change was not applied: {reason}","chart.type.network":"Network","chart.type.stream":"Stream","chart.type.marimekko":"Marimekko","chart.type.violin":"Violin","chart.type.gantt":"Gantt","chart.type.forceTree":"Force-directed tree","chart.type.pack":"Packed circles","chart.type.tree":"Tree","chart.type.voronoiTreemap":"Voronoi treemap","chart.type.alluvial":"Alluvial","chart.type.arc":"Arc diagram","chart.type.barRace":"Bar chart race","chart.type.bubblemap":"Bubble map","chart.type.bump":"Bump chart","chart.type.calendar":"Calendar heat map","chart.type.choropleth":"Choropleth map","chart.type.decomposition":"Decomposition tree","chart.type.diverging":"Diverging bar","chart.type.dumbbell":"Dumbbell","chart.type.fan":"Fan chart","chart.type.hexbin":"Hexagonal bin","chart.type.hexmap":"Hex map","chart.type.icicle":"Icicle","chart.type.markermap":"Marker map","chart.type.motion":"Motion chart","chart.type.parallel":"Parallel coordinates","chart.type.ridgeline":"Ridgeline","chart.type.roc":"ROC curve","chart.type.scatter3d":"3D scatter","chart.type.slope":"Slope chart","chart.type.splom":"Scatter plot matrix","chart.type.venn":"Venn diagram","chart.type.waffle":"Waffle","chart.type.wordCloud":"Word cloud","chart.tasksDropped":{one:"{count} more task not shown",other:"{count} more tasks not shown"},"chart.geoUnmatched":{one:"{count} row could not be placed on the map",other:"{count} rows could not be placed on the map"},"chart.r2":"R² {value}","ai.insights":"Insights","ai.explainView":"Explain this view","ai.explain":"Explain","ai.ask":"Ask","ai.apply":"Apply","ai.discard":"Discard","ai.propose":"Propose","ai.approve":"Approve","ai.thinking":"Thinking…","ai.applying":"Applying…","ai.applied":"Applied: {what}","ai.couldNotApply":"Could not apply: {why}","ai.applyFailed":"it failed","ai.discarded":"Discarded.","ai.discardedNothingWritten":"Discarded. Nothing was written.","ai.nothingWritten":"Nothing was written.","ai.nothingWrittenVetoed":"Nothing was written — a before-handler vetoed it.","ai.scope":"Scope: {scope}","ai.unsafeQuery":"I could not turn that into a safe query: {why}","ai.nothingToDo":"nothing to do","ai.insightsFailed":"Could not generate insights right now. The grid is unaffected.","ai.modelUnreachable":"Could not reach the model right now. The grid is unaffected.","ai.flagged":{one:"{count} unverified figure was removed as ungrounded.",other:"{count} unverified figures were removed as ungrounded."},"ai.askPlaceholder":"Ask your data: “EMEA deals over 50k, biggest first”","ai.askLabel":"Ask your data","ai.actorPlaceholder":"Ask AI to change data: “set the Network Upgrade project to In Progress”","ai.actorLabel":"Ask AI to change data","editor.password.show":"Show value","editor.password.hide":"Hide value","editor.password.showField":"Show {column}","editor.password.hideField":"Hide {column}","facets.computing":"Computing…","facets.suppressed.cardinality":"Too many distinct values to chart","facets.suppressed.rows":"Too many rows to chart","facets.suppressed.streaming":"Paused while live data is streaming","facets.suppressed.noProvider":"No distribution available for this data source","facets.suppressed.type":"This column has no chartable distribution","facets.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(F))}),He("packages/core/src/i18n/format.js",function(e,D){"use strict";Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"formatMessage",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return k}});const N=D("packages/core/src/internal/predicates.js").isFunction,G=/\{(\w+)\}/g,F=new Map,L=new Map;function Z(y){const c=y||"";if(F.has(c))return F.get(c);let m=null;try{m=new Intl.PluralRules(y||void 0)}catch{m=null}return F.set(c,m),m}function z(y,c,m="conjunction"){const s=Array.isArray(y)?y.filter(u=>u!=null&&u!==""):[];if(s.length===0)return"";if(s.length===1)return String(s[0]);const t=`${c||""}|${m}`;let o=L.get(t);if(o===void 0){try{o=new Intl.ListFormat(c||void 0,{style:"long",type:m})}catch{o=null}L.set(t,o)}return o?o.format(s.map(String)):s.map(String).join(", ")}function x(y,c){return y==null?"":typeof y=="number"?Number.isFinite(y)?y.toLocaleString(c||void 0,{maximumFractionDigits:20}):"":String(y)}function Y(y,c,m){if(typeof y=="string")return y;if(!y||typeof y!="object")return"";const s=c&&typeof c.count=="number"?c.count:null;if(s===null)return y.other??"";const t=Z(m),o=t?t.select(s):s===1?"one":"other";return y[o]??y.other??""}function $(y,c={},m){const s=Y(y,c,m);return s?s.replace(G,(t,o)=>Object.prototype.hasOwnProperty.call(c,o)?x(c[o],m):t):""}function j(y,c,m="en-GB"){return typeof y=="string"&&y?y:typeof c=="string"&&c?c:m}function k(y,c){const m=y?y[c]:void 0;return m==null||N(m)?c:m}}),He("packages/core/src/i18n/registry.js",function(e,D){"use strict";Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"localeCatalogue",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return Z}});const N=D("packages/core/src/i18n/catalogue.js").EN_GB,G=new Map([["en-gb",N]]);function F(z,x){const Y=typeof z=="string"?z.toLowerCase():"";return!Y||!x||typeof x!="object"?!1:(G.set(Y,x),!0)}function L(z){if(typeof z!="string"||!z)return null;const x=z.toLowerCase(),Y=G.get(x);if(Y)return Y;const $=x.split("-")[0],j=G.get($);if(j)return j;for(const[k,y]of G)if(k.split("-")[0]===$)return y;return null}function Z(){return[...G.keys()]}}),He("packages/core/src/i18n/index.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_LOCALE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"Messages",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"defaultMessages",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return d}});const re=D("packages/core/src/i18n/catalogue.js"),N=re.EN_GB,G=re.MESSAGE_KEYS,F=D("packages/core/src/i18n/format.js"),L=F.formatMessage,Z=F.formatList,z=F.lookup,x=F.resolveLocale,$=D("packages/core/src/internal/predicates.js").isFunction,k=D("packages/core/src/internal/warn.js").warnOnce,y=D("packages/core/src/i18n/registry.js"),c=y.registerLocale,m=y.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 F.formatList}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return F.resolveLocale}}),Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return y.registerLocale}});const s="en-GB";class t{#e=s;#t=N;constructor(g={}){this.configure(g)}configure(g={}){this.#e=x(g.locale,g.declared,s);const r=g.messages,n=m(this.#e);if(!n&&this.#e.toLowerCase()!=="en-gb"&&(!r||typeof r!="object")&&k(`i18n:locale:not-loaded:${this.#e.toLowerCase()}`,`locale "${this.#e}" is not loaded: import "@toclocoinc/lattice-grid/locales/${this.#e}" to add its text; English is used until then.`),!r||typeof r!="object"){this.#t=n?{...N,...n}:N;return}const h=Object.keys(r).filter(l=>!(l in N));h.length&&k(`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={...N,...n||{},...r}}get locale(){return this.#e}t(g,r){return L(z(this.#t,g),r||{},this.#e)}list(g,r){return Z(g,this.#e,r)}number(g,r){const n=Number(g);return Number.isFinite(n)?n.toLocaleString(this.#e,r||{maximumFractionDigits:20}):""}}const o=new t;function u(i){return i instanceof t?i:new t(i||{})}function d(i){const g=i&&typeof i=="object"?i:{},r=G.filter(f=>{const h=g[f];return h==null||h===""||$(h)}),n=Object.keys(g).filter(f=>!(f in N));return{missing:r,unknown:n}}}),He("packages/core/src/columns/types/structured.js",function(e,D){"use strict";Object.defineProperty(e,"MASK_DEFAULTS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"parseJsonText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});const re=D("packages/core/src/internal/predicates.js"),N=re.isNil,G=re.isObject,L=D("packages/core/src/i18n/index.js").defaultMessages,Z=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function z(t,o){const u=o||{},d=u.emptyDisplay??Z.emptyDisplay;if(N(t)||t==="")return d;const g=[...typeof u.char=="string"&&u.char!==""?u.char:Z.char][0]||Z.char,r=u.fixedLength??Z.fixedLength,n=Number.isFinite(u.length)&&Number(u.length)>0?Math.floor(Number(u.length)):Z.length,f=typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):null;let h=0;if(f!==null){const l=Number.isFinite(u.lastVisible)?Math.floor(Number(u.lastVisible)):Z.lastVisible,b=[...f];if(h=l>0&&l<b.length?l:0,h>0){const a=b.slice(b.length-h).join(""),p=Math.max(1,(r?n:b.length)-h);return g.repeat(p)+a}return g.repeat(r?n:Math.max(1,b.length))}return g.repeat(n)}const x=48;function Y(t){try{const o=JSON.stringify(t);return o===void 0?null:o}catch{return null}}function $(t,o){if(N(t))return"";const u=Number.isFinite(o&&o.inlineLimit)?Number(o.inlineLimit):x;if(typeof t=="string")return t.length>u?`${t.slice(0,u-1)}…`:t;if(typeof t!="object")return String(t);const d=Y(t);if(d!==null&&d.length<=u)return d;if(Array.isArray(t)){const g=t.length;return`[${L.t("count.items",{count:g})}]`}const i=Object.keys(t).length;return`{${L.t("count.keys",{count:i})}}`}function j(t,o){if(t==null)return"null";const u=typeof t;if(u==="number"||u==="boolean"||u==="bigint")return String(t);if(u==="string")return JSON.stringify(t);if(u!=="object")return JSON.stringify(String(t));const d=o||new WeakSet;return d.has(t)?'"[circular]"':(d.add(t),t instanceof Date?JSON.stringify(t.toISOString()):Array.isArray(t)?`[${t.map(r=>j(r,d)).join(",")}]`:`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${j(t[r],d)}`).join(",")}}`)}function k(t,o){if(N(t))return N(o)?0:1;if(N(o))return-1;const u=j(t),d=j(o);return u<d?-1:u>d?1:0}function y(t){if(N(t))return null;const o=String(t);if(o.trim()==="")return null;try{return JSON.parse(o)}catch{return o}}function c(t){const o=t&&t.cell&&t.cell.props;return G(o)?o:{}}const m=Object.freeze({json:{base:"object",storage:"object",format:t=>$(t&&t.value,c(t&&t.column)),parse:t=>y(t&&t.text),compare:k,defaults:{editor:"code",filter:"text",align:"start"},excel:"@",toClipboard:t=>{if(N(t))return"";if(typeof t=="string")return t;try{const o=JSON.stringify(t,null,2);return o===void 0?String(t):o}catch{return String(t)}},fromClipboard:t=>y(t)},secret:{base:"text",storage:"object",format:t=>z(t&&t.value,c(t&&t.column)),parse:t=>{const o=t&&t.text;return N(o)||String(o)===""?null:String(o)},compare:(t,o)=>{const u=N(t)||t==="",d=N(o)||o==="";return u===d?0:u?1:-1},defaults:{editor:"password",filter:"none",align:"start"},excel:"@",export:{csv:!1,excel:!1},toClipboard:t=>z(t),fromClipboard:t=>N(t)||String(t)===""?null:String(t)}}),s=m}),He("packages/core/src/columns/types/unit.js",function(e,D){"use strict";Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return A}});const N=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/internal/warn.js").warnOnce;function L(I,U,X,q){return Object.freeze({symbol:I,factor:U,aliases:Object.freeze(X||[]),binary:!!(q&&q.binary),prefix:q&&q.prefix||null,auto:!(q&&q.auto===!1)})}function Z(I,U,X,q){return L(I,U,X,q)}const z=Object.freeze({data:Object.freeze([L("B",1,["byte","bytes"]),L("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),L("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),L("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),L("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),L("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),L("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),L("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),L("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),L("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([L("bps",1,["bit","bits","bit/s","b/s"]),L("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),L("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),L("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),L("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([L("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),L("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),L("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),L("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),L("in",.0254,["inch","inches"],{auto:!1}),L("ft",.3048,["foot","feet"],{auto:!1}),L("yd",.9144,["yard","yards"],{auto:!1}),L("m",1,["metre","metres","meter","meters"]),L("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),L("mi",1609.344,["mile","miles"],{auto:!1}),L("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([L("mg",.001,["milligram","milligrams"]),L("g",1,["gram","grams"]),L("oz",28.349523125,["ounce","ounces"],{auto:!1}),L("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),L("kg",1e3,["kilogram","kilograms"]),L("st",6350.29318,["stone"],{auto:!1}),L("t",1e6,["tonne","tonnes","ton"],{auto:!1}),L("ton (US)",907184.74,["ton","shortton"],{auto:!1}),L("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([L("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),L("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),L("ms",.001,["msec","msecs","millisecond","milliseconds"]),L("s",1,["sec","secs","second","seconds"]),L("m",60,["min","mins","minute","minutes"]),L("h",3600,["hr","hrs","hour","hours"]),L("d",86400,["day","days"])]),speed:Object.freeze([L("mm/s",.001,["millimetre/s","millimeter/s"]),L("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),L("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),L("mph",.44704,["mile/h","miles/h"],{auto:!1}),L("kn",1852/3600,["knot","knots"],{auto:!1}),L("m/s",1,["metre/s","meter/s","mps"]),L("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([L("mm/s²",.001,["mm/s2"]),L("ft/s²",.3048,["ft/s2"],{auto:!1}),L("m/s²",1,["m/s2","metre/s2","meter/s2"]),L("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([L("mm²",1e-6,["mm2"]),L("cm²",1e-4,["cm2"]),L("in²",64516e-8,["in2","sqin"],{auto:!1}),L("ft²",.09290304,["ft2","sqft"],{auto:!1}),L("yd²",.83612736,["yd2","sqyd"],{auto:!1}),L("m²",1,["m2","sqm"]),L("ha",1e4,["hectare","hectares"],{auto:!1}),L("ac",4046.8564224,["acre","acres"],{auto:!1}),L("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([L("µL",1e-6,["ul","microlitre","microliter"]),L("mL",.001,["millilitre","milliliter"]),L("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),L("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),L("L",1,["litre","litres","liter","liters"]),L("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),L("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),L("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),L("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([L("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),L("J",1,["joule","joules"]),L("cal",4.184,["calorie","calories"],{auto:!1}),L("kJ",1e3,["kilojoule","kilojoules"]),L("BTU",1055.05585262,["btu"],{auto:!1}),L("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),L("MJ",1e6,["megajoule","megajoules"]),L("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),L("GJ",1e9,["gigajoule","gigajoules"]),L("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([L("mW",.001,["milliwatt","milliwatts"]),L("W",1,["watt","watts"]),L("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),L("kW",1e3,["kilowatt","kilowatts"]),L("hp",745.6998715822702,["horsepower"],{auto:!1}),L("MW",1e6,["megawatt","megawatts"]),L("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([L("mN",.001,["millinewton","millinewtons"]),L("N",1,["newton","newtons"]),L("lbf",4.4482216152605,["poundforce"],{auto:!1}),L("kgf",9.80665,["kilogramforce"],{auto:!1}),L("kN",1e3,["kilonewton","kilonewtons"]),L("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([L("Pa",1,["pascal","pascals"]),L("mbar",100,["millibar"],{auto:!1}),L("inH₂O",249.0889,["inh2o"],{auto:!1}),L("mmHg",133.322387415,["torr"],{auto:!1}),L("kPa",1e3,["kilopascal","kilopascals"]),L("inHg",3386.388640341,["inhg"],{auto:!1}),L("psi",6894.757293168361,["lbf/in2"],{auto:!1}),L("bar",1e5,[],{auto:!1}),L("atm",101325,["atmosphere","atmospheres"],{auto:!1}),L("MPa",1e6,["megapascal","megapascals"]),L("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([L("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),L("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),L("kN·m",1e3,["knm","kn.m"],{auto:!1}),L("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([L("kg/m³",1,["kg/m3"]),L("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),L("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),L("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([L("L/min",1/6e4,["lpm","l/min"],{auto:!1}),L("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),L("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),L("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),L("cfm",.0004719474432,["ft3/min"],{auto:!1}),L("L/s",.001,["lps","l/s"],{auto:!1}),L("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([L("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),L("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),L("mrad",.001,["milliradian","milliradians"],{auto:!1}),L("mil",Math.PI/3200,["nato-mil"],{auto:!1}),L("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),L("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),L("rad",1,["radian","radians"]),L("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([L("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),L("rad/s",1,["radps","radians/s"]),L("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),L("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([L("ppt",1e-12,["partspertrillion"],{auto:!1}),L("ppb",1e-9,["partsperbillion"]),L("ppm",1e-6,["partspermillion"]),L("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),L("‰",.001,["permille","permil"],{auto:!1}),L("%",.01,["pct","percent"]),L("×",1,["x","ratio","times"])]),molarity:Object.freeze([L("pM",1e-12,["picomolar","picomolarity"]),L("nM",1e-9,["nanomolar","nanomolarity"]),L("µM",1e-6,["um-molar","micromolar","micromolarity"]),L("mM",.001,["millimolar","millimolarity"]),L("M",1,["molar","mol/l","mol/L","molarity"]),L("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([L("mg/s",1e-6,["milligrams/s"]),L("g/s",.001,["grams/s"]),L("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),L("kg/s",1,["kilograms/s","kgps"]),L("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),L("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),L("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([L("µPa·s",1e-6,["upas","micropascalsecond"]),L("cP",.001,["centipoise"],{auto:!1}),L("mPa·s",.001,["mpas","millipascalsecond"]),L("P",.1,["poise"],{auto:!1}),L("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([L("cSt",1e-6,["centistokes","centistoke"]),L("mm²/s",1e-6,["mm2/s"],{auto:!1}),L("St",1e-4,["stokes","stoke"],{auto:!1}),L("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([L("mW/(m·K)",.001,["mw/mk"]),L("W/(m·K)",1,["w/mk","wmk"]),L("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),L("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([L("J/(kg·K)",1,["j/kgk","jkgk"]),L("kJ/(kg·K)",1e3,["kj/kgk"]),L("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([L("nSv/h",1e-9,["nsvh"]),L("µSv/h",1e-6,["usv/h","usvh"]),L("mSv/h",.001,["msvh"]),L("Sv/h",1,["svh"]),L("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),x=Symbol("ambiguous"),Y=new Map,$=new Map;function j(I,U){const X=String(I||"").trim();if(!X)throw new Error("[lattice] a unit system needs a name");if(z[X]||$.has(X))throw new Error(`[lattice] unit system "${X}" already exists`);const q=[...U||[]];if(!q.length)throw new Error(`[lattice] unit system "${X}" has no units`);if(!q.some(H=>H.factor===1))throw new Error(`[lattice] unit system "${X}" has no base unit (none with factor 1)`);const _=new Set;for(const H of q){if(_.has(H.symbol))throw new Error(`[lattice] unit system "${X}" declares "${H.symbol}" twice`);_.add(H.symbol)}return $.set(X,Object.freeze(q)),Y.delete(X),X}function k(){return[...Object.keys(z),...$.keys()]}function y(I){const U=c(I);return U?U.units:[]}function c(I){const U=String(I||""),X=Y.get(U);if(X!==void 0)return X;const q=z[U]||$.get(U);if(!q)return Y.set(U,null),null;const _=Object.freeze([...q].sort((ne,se)=>ne.factor-se.factor)),H=new Map,ee=new Map,te=(ne,se)=>{const ae=H.get(ne);ae===void 0?H.set(ne,se):ae!==se&&H.set(ne,x)};for(const ne of _){te(ne.symbol.toLowerCase(),ne);for(const se of ne.aliases)te(se.toLowerCase(),ne);if(ne.prefix){const se=ee.get(ne.prefix)||[];se.push(ne),ee.set(ne.prefix,se)}}const J={units:_,byToken:H,byPrefix:ee,decimal:_.filter(ne=>!ne.binary&&ne.auto),binary:_.some(ne=>ne.binary)?_.filter(ne=>(ne.binary||ne.factor===1)&&ne.auto):null};return Y.set(U,J),J}function m(I,U){return U&&I.binary||I.decimal}function s(I,U){const X=c(I);if(!X||N(U))return null;const q=X.units.find(H=>H.symbol===String(U));if(q)return q;const _=X.byToken.get(String(U).trim().toLowerCase());return _&&_!==x?_:null}const t=new WeakMap;function o(I){const U=I||{};if(typeof U=="object"&&U!==null){const H=t.get(U);if(H!==void 0)return H}const X=U.system||"data",q=c(X);let _=null;if(!q)F(`unit:system:${X}`,`unknown unit system "${X}"; known systems are ${k().join(", ")}`);else{let H=U.unit?s(X,U.unit):null;H||(U.unit&&F(`unit:unit:${X}:${U.unit}`,`unknown unit "${U.unit}" in system "${X}"; falling back to ${q.units[0].symbol}`),H=q.units.find(ee=>ee.factor===1)||q.units[0]),_={index:q,base:H,binary:U.binary===!0}}return typeof U=="object"&&U!==null&&t.set(U,_),_}const u=new WeakMap;function d(I,U){if(!I||!U||!Array.isArray(I.compound)||I.compound.length===0)return null;const X=u.get(I);if(X!==void 0)return X;const q=new Set,_=[];for(const ee of I.compound){const te=s(I.system||"data",ee);if(!te){F(`unit:compound:${I.system}:${ee}`,`unknown compound unit "${ee}" in system "${I.system||"data"}"; ignoring it`);continue}q.has(te.symbol)||(q.add(te.symbol),_.push(te))}_.sort((ee,te)=>te.factor-ee.factor);const H=_.length>=2?_:null;return u.set(I,H),H}function i(I,U,X){return U===X||U.factor===X.factor?I:I*U.factor/X.factor}const g=new Map;function r(I){const U=I||"",X=g.get(U);if(X)return X;const q={group:",",decimal:"."};try{for(const _ of new Intl.NumberFormat(I||void 0).formatToParts(12345.6))_.type==="group"?q.group=_.value:_.type==="decimal"&&(q.decimal=_.value)}catch{}return g.set(U,q),q}const n=/[\s ]/g,f=/^[+-]?[\d '’ .,]*(?:[eE][+-]?\d+)?/,h=/^[^\d+\-(.,\s]+\s*/,l=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function b(I,U){const{group:X,decimal:q}=r(U);let _=String(I).replace(n,"");if(_==="")return null;const H=q?_.indexOf(q):-1;if(X&&X!==q){if(H>=0&&_.indexOf(X,H+q.length)>=0)return null;_=_.split(X).join("")}if(q&&q!=="."&&(_=_.split(q).join(".")),!l.test(_))return null;const ee=Number(_);return Number.isFinite(ee)?ee:null}function a(I,U,X){const q=String(I).trim().replace(/\.$/,"");if(q==="")return null;const _=U.units.find(se=>se.symbol===q);if(_)return _;const H=q.toLowerCase(),ee=U.byToken.get(H);if(ee===x)return null;if(ee)return ee;const te=U.byPrefix.get(H);if(!te||!te.length)return null;const J=m(U,X),ne=te.filter(se=>J.includes(se));return ne.length===1?ne[0]:null}function p(I,U,X,q){let _=I,H=0,ee=!1,te=!1;for(;_!=="";){const J=f.exec(_)[0];if(J==="")return null;const ne=b(J,q&&q.locale);if(ne===null)return null;_=_.slice(J.length).trim();const se=_.search(/[+-]?[\d]/),ae=(se>=0?_.slice(0,se):_).trim();if(_=se>=0?_.slice(se).trim():"",ae===""){if(ee)return null;te=!0,H+=i(ne,X[0],U.base)}else{const we=a(ae,U.index,U.binary);if(!we)return null;H+=i(ne,we,U.base)}if(ee=!0,te&&_!=="")return null}return ee?H:null}function w(I,U){if(N(I))return null;if(typeof I=="number")return Number.isFinite(I)?I:null;const X=o(U);if(!X)return null;let q=String(I).trim();if(q==="")return null;let _=!1;q.startsWith("(")&&q.endsWith(")")&&(_=!0,q=q.slice(1,-1).trim());const H=d(U,X);if(H){q.startsWith("-")&&(_=!0,q=q.slice(1).trim());const fe=p(q,X,H,U);return fe===null?null:_?-fe:fe}let ee=null;const te=h.exec(q);if(te&&te[0]){const fe=a(te[0].trim(),X.index,X.binary);fe&&(ee=fe,q=q.slice(te[0].length).trim())}const J=f.exec(q)[0],ne=b(J,U&&U.locale);if(ne===null)return null;const se=q.slice(J.length).trim();if(ee&&se!=="")return null;const ae=ee||(se===""?X.base:a(se,X.index,X.binary));if(!ae)return null;const we=i(ne,ae,X.base);return _?-we:we}const v=new Map;function P(I,U,X,q){const _=`${I||""}|${U}|${X}|${q?1:0}`;let H=v.get(_);return H||(H=new Intl.NumberFormat(I||void 0,{minimumFractionDigits:U,maximumFractionDigits:X,useGrouping:q}),v.set(_,H)),H}function V(I,U){if(!Number.isFinite(I)||I===0)return Math.max(0,U-1);const X=Math.floor(Math.log10(Math.abs(I)));return Math.min(20,Math.max(0,U-1-X))}function W(I,U){if(!Number.isFinite(I)||I===0)return I;const X=Math.ceil(Math.log10(Math.abs(I))),q=10**(U-X);return Math.round(I*q)/q}function K(I,U,X){if(!X||X===U.base.symbol)return U.base;if(X!=="auto")return R(U,X);if(I===0||!Number.isFinite(I))return U.base;const q=Math.abs(I)*U.base.factor,_=m(U.index,U.binary);let H=_[0];for(const J of _)q>=J.factor&&(H=J);if(q>=H.factor)return H;let ee=H;for(const J of U.index.units)J.binary!==U.binary&&J.factor!==1||J.factor<=q&&J.factor>(ee===H?0:ee.factor)&&(ee=J);if(ee!==H)return ee;let te=H;for(const J of U.index.units)J.binary!==U.binary&&J.factor!==1||J.factor<te.factor&&(te=J);return te.factor<U.base.factor?te:U.base}function R(I,U){const X=I.index.units.find(_=>_.symbol===U);if(X)return X;const q=I.index.byToken.get(String(U).toLowerCase());return q&&q!==x?q:(F(`unit:display:${U}`,`unknown display unit "${U}"; rendering in ${I.base.symbol}`),I.base)}function S(I,U,X,q){const _=I<0;let H=Math.abs(I)*U.base.factor;const ee=typeof q.decimals=="number"?q.decimals:q.minDecimals??0,te=typeof q.decimals=="number"?q.decimals:q.maxDecimals??Math.max(ee,2),J=q.space??" ",ne=[];for(let ae=0;ae<X.length;ae++){const we=X[ae],fe=ae===X.length-1;let ge=fe?H/we.factor:Math.floor(H/we.factor);if(H-=ge*we.factor,fe){const Pe=10**te;ge=Math.round(ge*Pe)/Pe+0}const je=fe?P(q.locale,ee,te,q.group!==!1):P(q.locale,0,0,q.group!==!1);ne.push(`${je.format(ge)}${J}${we.symbol}`)}const se=ne.join(" ");return _?`-${se}`:se}function E(I,U){const X=U||{},q=X.nullDisplay??"";if(N(I)||I==="")return q;const _=typeof I=="number"?I:Number(I);if(!Number.isFinite(_))return q;const H=o(X);if(!H)return String(_);const ee=d(X,H);if(ee)return S(_,H,ee,X);const te=typeof X.significantFigures=="number"&&X.significantFigures>0?X.significantFigures:0,J=te?W(_,te):_,ne=K(J,H,X.display),se=i(J,H.base,ne);let ae=typeof X.decimals=="number"?X.decimals:X.minDecimals??0,we=typeof X.decimals=="number"?X.decimals:X.maxDecimals??Math.max(ae,2);te&&(ae=V(se,te),we=ae);const fe=P(X.locale,ae,we,X.group!==!1).format(se),ge=X.space??" ";return X.placement==="prefix"?`${ne.symbol}${X.space??""}${fe}`:`${fe}${ge}${ne.symbol}`}function O(I,U){const X=N(I)||Number.isNaN(I)?null:Number(I),q=N(U)||Number.isNaN(U)?null:Number(U);return X===null||Number.isNaN(X)?q===null||Number.isNaN(q)?0:1:q===null||Number.isNaN(q)||X<q?-1:X>q?1:0}function M(I){const U=typeof I.decimals=="number"&&I.decimals>0?`.${"0".repeat(I.decimals)}`:"";return`${typeof I.decimals=="number"?`#,##0${U}`:"#,##0.##"}" ${I.symbol}"`}function T(I){const U={system:"data",...I||{}},X=o(U),q=X?X.base.symbol:String(U.unit||""),_=Object.freeze({...U,unit:q}),H=Object.freeze({..._,display:q,decimals:void 0,minDecimals:0,maxDecimals:20,group:!1}),ee=new Map([[_.locale||"",_]]),te=J=>{const ne=J||"";let se=ee.get(ne);return se||(se=Object.freeze({..._,locale:J||void 0}),ee.set(ne,se)),se};return{base:"number",extends:"number",storage:"float64",unitConfig:_,format:J=>E(J.value,J.locale?te(J.locale):_),parse:J=>w(J.text,J.locale?te(J.locale):_),compare:O,defaults:{filter:"number",editor:"unit",align:"end",total:U.total||"sum"},...U.totals?{totals:U.totals}:{},excel:U.excel||M({decimals:U.decimals,symbol:q}),toStorage:J=>typeof J=="number"?Number.isFinite(J)?J:null:typeof J=="string"?w(J,_):N(J)?null:w(String(J),_),toClipboard:J=>E(J,H),fromClipboard:J=>w(J,_)}}const A=T}),He("packages/core/src/columns/types/engineering.js",function(e,D){"use strict";Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return L}});const N=D("packages/core/src/internal/predicates.js").isNil,F=D("packages/core/src/columns/types/unit.js").createUnitType;function L(x){const Y=2*Math.PI/x;return $=>{let j=0,k=0,y=0;for(const m of $||[]){if(N(m))continue;const s=Number(m);Number.isFinite(s)&&(j+=Math.cos(s*Y),k+=Math.sin(s*Y),y+=1)}return!y||Math.hypot(j,k)/y<1e-12?null:(Math.atan2(k,j)/Y%x+x)%x}}function Z(x){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:L(x)}}}const z=Object.freeze({metres:F({system:"length",unit:"m",display:"auto",maxDecimals:3}),millimetres:F({system:"length",unit:"mm",maxDecimals:2}),kilometres:F({system:"length",unit:"km",maxDecimals:3}),grams:F({system:"mass",unit:"g",display:"auto",maxDecimals:3}),kilograms:F({system:"mass",unit:"kg",maxDecimals:3}),tonnes:F({system:"mass",unit:"t",maxDecimals:3}),seconds:F({system:"duration",unit:"s",display:"auto",maxDecimals:3}),milliseconds:F({system:"duration",unit:"ms",maxDecimals:3}),hours:F({system:"duration",unit:"h",maxDecimals:2}),speed:F({system:"speed",unit:"m/s",display:"auto",maxDecimals:2}),kph:F({system:"speed",unit:"km/h",maxDecimals:1}),mph:F({system:"speed",unit:"mph",maxDecimals:1}),knots:F({system:"speed",unit:"kn",maxDecimals:1}),acceleration:F({system:"acceleration",unit:"m/s²",maxDecimals:3}),area:F({system:"area",unit:"m²",display:"auto",maxDecimals:2}),hectares:F({system:"area",unit:"ha",maxDecimals:4}),volume:F({system:"volume",unit:"L",display:"auto",maxDecimals:3}),cubicMetres:F({system:"volume",unit:"m³",maxDecimals:3}),energy:F({system:"energy",unit:"J",display:"auto",maxDecimals:3}),kilowattHours:F({system:"energy",unit:"kWh",maxDecimals:2}),power:F({system:"power",unit:"W",display:"auto",maxDecimals:2}),kilowatts:F({system:"power",unit:"kW",maxDecimals:2}),force:F({system:"force",unit:"N",display:"auto",maxDecimals:2}),pressure:F({system:"pressure",unit:"Pa",display:"auto",maxDecimals:2}),bar:F({system:"pressure",unit:"bar",maxDecimals:3}),psi:F({system:"pressure",unit:"psi",maxDecimals:1}),torque:F({system:"torque",unit:"N·m",maxDecimals:2}),density:F({system:"density",unit:"kg/m³",maxDecimals:2}),flow:F({system:"flow",unit:"m³/s",maxDecimals:4}),litresPerMinute:F({system:"flow",unit:"L/min",maxDecimals:1}),radians:F({system:"angle",unit:"rad",maxDecimals:4,totals:Z(2*Math.PI)}),degrees:F({system:"angle",unit:"°",maxDecimals:2,totals:Z(360)}),rpm:F({system:"angularVelocity",unit:"rpm",maxDecimals:0}),angularVelocity:F({system:"angularVelocity",unit:"rad/s",maxDecimals:3}),ppm:F({system:"fraction",unit:"ppm",maxDecimals:2}),ppb:F({system:"fraction",unit:"ppb",maxDecimals:2}),basisPoints:F({system:"fraction",unit:"bp",maxDecimals:1}),molarity:F({system:"molarity",unit:"M",display:"auto",maxDecimals:3}),massFlow:F({system:"massFlow",unit:"kg/s",maxDecimals:3}),tonnesPerHour:F({system:"massFlow",unit:"t/h",maxDecimals:2}),viscosity:F({system:"viscosity",unit:"Pa·s",display:"auto",maxDecimals:3}),kinematicViscosity:F({system:"kinematicViscosity",unit:"cSt",maxDecimals:2}),thermalConductivity:F({system:"thermalConductivity",unit:"W/(m·K)",maxDecimals:3}),specificHeat:F({system:"specificHeat",unit:"J/(kg·K)",maxDecimals:1}),doseRate:F({system:"doseRate",unit:"µSv/h",display:"auto",maxDecimals:2})})}),He("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 z}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return j}});const re=D("packages/core/src/columns/types/unit.js"),N=re.defineUnit,G=re.registerUnitSystem,F=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})]),Z=Object.freeze(["p","n","µ","m","","k","M","G"]);function z(k){const y=String(k.base),c=new Set([...k.prefixes||Z,""]),m=[];for(const s of L){if(!c.has(s.symbol))continue;const t=`${s.symbol}${y}`,o=[];if(k.name){o.push(`${s.name}${k.name}`,`${s.name}${k.name}s`);const u=s.name.slice(-1);if(u&&k.name.startsWith(u)){const d=`${s.name.slice(0,-1)}${k.name}`;o.push(d,`${d}s`)}}s.symbol==="µ"&&o.push(`u${y}`),s.factor===1&&k.aliases&&o.push(...k.aliases),m.push(N(t,s.factor,o))}for(const s of k.extra||[])m.push(s);return m}function x(k,y){const c=z(y);return G(k,c)}function Y(k,y,c){return x(k,y),F({system:k,unit:y.base,display:"auto",maxDecimals:3,...c||{}})}const $=Object.freeze({voltage:Y("voltage",{base:"V",name:"volt"}),current:Y("current",{base:"A",name:"amp",aliases:["ampere","amperes"]}),resistance:Y("resistance",{base:"Ω",name:"ohm",aliases:["ohm","ohms","R"],prefixes:["m","","k","M","G"]}),capacitance:Y("capacitance",{base:"F",name:"farad",prefixes:["f","p","n","µ","m",""]}),inductance:Y("inductance",{base:"H",name:"henry",prefixes:["p","n","µ","m",""]}),charge:Y("charge",{base:"C",name:"coulomb",prefixes:["p","n","µ","m",""],extra:[N("mAh",3.6,["milliamphour","milliamphours"],{auto:!1}),N("Ah",3600,["amphour","amphours"],{auto:!1})]}),conductance:Y("conductance",{base:"S",name:"siemens",prefixes:["n","µ","m","","k"]}),fluxDensity:Y("fluxDensity",{base:"T",name:"tesla",prefixes:["n","µ","m",""],extra:[N("G",1e-4,["gauss"],{auto:!1})]}),luminousFlux:Y("luminousFlux",{base:"lm",name:"lumen",prefixes:["m","","k"]}),illuminance:Y("illuminance",{base:"lx",name:"lux",prefixes:["m","","k"]}),luminousIntensity:Y("luminousIntensity",{base:"cd",name:"candela",prefixes:["m","","k"]}),substance:Y("substance",{base:"mol",name:"mole",prefixes:["n","µ","m","","k"]}),absorbedDose:Y("absorbedDose",{base:"Gy",name:"gray",prefixes:["µ","m",""]}),equivalentDose:Y("equivalentDose",{base:"Sv",name:"sievert",prefixes:["n","µ","m",""]}),radioactivity:Y("radioactivity",{base:"Bq",name:"becquerel",prefixes:["","k","M","G","T"],extra:[N("Ci",37e9,["curie","curies"],{auto:!1})]}),frequency:Y("frequency",{base:"Hz",name:"hertz",prefixes:["m","","k","M","G","T"]})}),j=Y}),He("packages/core/src/columns/types/temperature.js",function(e,D){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});const N=D("packages/core/src/internal/predicates.js").isNil,G=Object.freeze({C:Object.freeze({symbol:"°C",aliases:["c","°c","celsius","centigrade"],toKelvin:m=>m+273.15,fromKelvin:m=>m-273.15}),F:Object.freeze({symbol:"°F",aliases:["f","°f","fahrenheit"],toKelvin:m=>(m+459.67)*(5/9),fromKelvin:m=>m*(9/5)-459.67}),K:Object.freeze({symbol:"K",aliases:["k","kelvin"],toKelvin:m=>m,fromKelvin:m=>m}),R:Object.freeze({symbol:"°R",aliases:["r","°r","rankine"],toKelvin:m=>m*(5/9),fromKelvin:m=>m*(9/5)})});function F(m){if(N(m))return null;const s=String(m).trim();if(s==="")return null;for(const[o,u]of Object.entries(G))if(s===o||s===u.symbol)return{key:o,scale:u};const t=s.toLowerCase();for(const[o,u]of Object.entries(G))if(u.aliases.includes(t))return{key:o,scale:u};return null}function L(m,s,t){const o=F(s),u=F(t);return!o||!u||!Number.isFinite(Number(m))?null:o.key===u.key?Number(m):u.scale.fromKelvin(o.scale.toKelvin(Number(m)))}const Z=new Map;function z(m,s,t){const o=`${m||""}|${s}|${t}`;let u=Z.get(o);return u||(u=new Intl.NumberFormat(m||void 0,{minimumFractionDigits:s,maximumFractionDigits:t}),Z.set(o,u)),u}function x(m,s){const t=s||{},o=t.nullDisplay??"";if(N(m)||m==="")return o;const u=Number(m);if(!Number.isFinite(u))return o;const d=F(t.scale||"C");if(!d)return String(u);const i=F(t.display||t.scale||"C")||d,g=i.key===d.key?u:i.scale.fromKelvin(d.scale.toKelvin(u)),r=typeof t.decimals=="number"?t.decimals:null,n=r??t.minDecimals??0,f=r??t.maxDecimals??1;return`${z(t.locale,n,f).format(g)}${t.space??" "}${i.scale.symbol}`}const Y=/^[+-]?[\d\s., ]*\d/;function $(m,s){const t=String(m).trim();if(t==="")return null;const o=new Intl.NumberFormat(s||void 0).formatToParts(1.1).find(g=>g.type==="decimal")?.value||".",u=o===","?".":",",d=t.split(u).join("").split(/[\s ]/).join("").replace(o,"."),i=Number(d);return Number.isFinite(i)?i:null}function j(m,s){if(N(m))return null;const t=s||{},o=F(t.scale||"C");if(!o)return null;if(typeof m=="number")return Number.isFinite(m)?m:null;let u=String(m).trim();if(u==="")return null;let d=!1;u.startsWith("(")&&u.endsWith(")")&&(d=!0,u=u.slice(1,-1).trim());const i=Y.exec(u);if(!i)return null;const g=$(i[0],t.locale);if(g===null)return null;const r=u.slice(i[0].length).trim();if(r==="")return d?-g:g;const n=F(r);if(!n)return null;const f=n.key===o.key?g:o.scale.fromKelvin(n.scale.toKelvin(g));return d?-f:f}function k(m){const s=Object.freeze({scale:"C",...m||{}}),o=(F(s.scale)||F("C")).scale.symbol,u=Object.freeze({...s,display:s.scale,decimals:void 0,minDecimals:0,maxDecimals:20}),d=new Map([[s.locale||"",s]]),i=g=>{const r=g||"";let n=d.get(r);return n||(n=Object.freeze({...s,locale:g||void 0}),d.set(r,n)),n};return{base:"number",extends:"number",storage:"float64",temperatureConfig:s,format:g=>x(g.value,g.locale?i(g.locale):s),parse:g=>j(g.text,g.locale?i(g.locale):s),defaults:{filter:"number",editor:"temperature",align:"end",total:"avg"},totals:{supported:["avg","min","max","count","countValues"]},excel:s.excel||`#,##0${typeof s.decimals=="number"&&s.decimals>0?`.${"0".repeat(s.decimals)}`:".#"}" ${o}"`,toStorage:g=>typeof g=="number"?Number.isFinite(g)?g:null:typeof g=="string"?j(g,s):N(g)?null:j(String(g),s),toClipboard:g=>x(g,u),fromClipboard:g=>j(g,s)}}const y=Object.freeze({celsius:k({scale:"C"}),fahrenheit:k({scale:"F"}),kelvin:k({scale:"K"})}),c=k}),He("packages/core/src/columns/types/radix.js",function(e,D){"use strict";Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"digitsForWidth",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"radixRange",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"radixName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"normaliseRadixOptions",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"compileRadixFormat",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"compileRadixParse",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"parseRadixResult",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return S}});const N=D("packages/core/src/internal/predicates.js").isNil,F=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}),Z=Object.freeze({2:1,8:3,16:4}),z=Object.freeze({2:"0b",8:"0o",16:"0x"}),x=Object.freeze({2:4,8:3,16:2}),Y=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),$=Object.freeze({2:"binary",8:"octal",16:"hexadecimal"}),j=Object.freeze([[/^0x/i,16],[/^0b/i,2],[/^0o/i,8],[/^#/,16]]),k=/[\s\u00a0\u202f_,']/g,y=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,c=Object.freeze([8,16,32,53]),m=new WeakSet,s=new WeakMap,t=new Map,o=new WeakMap,u=new WeakMap,d=Object.freeze({hex:Object.freeze({radix:16}),hex8:Object.freeze({radix:16,bitWidth:8,pad:!0,signed:!1}),hex16:Object.freeze({radix:16,bitWidth:16,pad:!0,signed:!1}),hex32:Object.freeze({radix:16,bitWidth:32,pad:!0,signed:!1}),binary:Object.freeze({radix:2}),binary8:Object.freeze({radix:2,bitWidth:8,pad:!0,signed:!1,group:4}),octal:Object.freeze({radix:8})});function i(E){if(E==null)return 16;const O=typeof E=="string"?E.toLowerCase():E,M=L[O];return M||(F(`radix:base:${String(E)}`,`unsupported radix ${String(E)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function g(E,O){return Math.ceil(E/Z[O])}function r(E,O){if(!E)return O?{min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}:{min:0,max:Number.MAX_SAFE_INTEGER};if(!O)return{min:0,max:2**E-1};const M=2**(E-1);return{min:-M,max:M-1}}function n(E){return $[E]||"hexadecimal"}function f(E){if(typeof E=="string"){const O=d[E];return O||F(`radix:preset:${E}`,`unknown radix preset "${E}"; known presets are ${Object.keys(d).join(", ")}`),{...O||{}}}if(E&&typeof E.preset=="string"){const O=d[E.preset];return O||F(`radix:preset:${E.preset}`,`unknown radix preset "${E.preset}"; known presets are ${Object.keys(d).join(", ")}`),{...O||{},...E}}return E||{}}function h(E){const O=f(E),M=i(O.radix),T=Z[M];let A=null;if(O.bitWidth!==void 0&&O.bitWidth!==null&&O.bitWidth!==!1){const J=Number(O.bitWidth);c.includes(J)?A=J:F(`radix:width:${String(O.bitWidth)}`,`unsupported bitWidth ${String(O.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let I=O.signed!==!1;!I&&A===null&&(F("radix:unsigned:width","signed: false needs a bitWidth to render a two's-complement pattern; defaulting to 32"),A=32);const U=O.prefix===void 0||O.prefix===!0?z[M]:O.prefix===!1?"":String(O.prefix);let X=0;O.pad===!0?X=A?g(A,M):0:typeof O.pad=="number"&&O.pad>0&&(X=Math.floor(O.pad));let q=0;O.group===!0?q=x[M]:typeof O.group=="number"&&O.group>0&&(q=Math.floor(O.group));const _=r(A,I),H=typeof O.min=="number"?Math.max(_.min,O.min):_.min,ee=typeof O.max=="number"?Math.min(_.max,O.max):_.max,te=Object.freeze({radix:M,bits:T,prefix:U,uppercase:O.uppercase!==!1,pad:X,group:q,groupSeparator:typeof O.groupSeparator=="string"?O.groupSeparator:" ",bitWidth:A,signed:I,min:H,max:ee<H?H:ee,nullDisplay:typeof O.nullDisplay=="string"?O.nullDisplay:"",name:n(M)});return m.add(te),te}function l(E){if(E&&m.has(E))return E;if(typeof E=="string"){let O=t.get(E);return O||(O=h(E),t.set(E,O)),O}if(E&&typeof E=="object"){let O=s.get(E);return O||(O=h(E),s.set(E,O)),O}return l("hex")}function b(E){return E<0?-Math.round(-E):Math.round(E)}function a(E,O,M){if(O<=0||E.length<=O)return E;const T=E.length%O||O,A=[E.slice(0,T)];for(let I=T;I<E.length;I+=O)A.push(E.slice(I,I+O));return A.join(M)}function p(E){const O=l(E),{radix:M,prefix:T,uppercase:A,pad:I,group:U,groupSeparator:X,signed:q,bitWidth:_,nullDisplay:H}=O,ee=_?2**_:0,te=J=>{if(N(J)||J==="")return H;const ne=typeof J=="number"?J:Number(J);if(!Number.isFinite(ne))return H;const se=b(ne);let ae="",we=se;se<0&&(q?(ae="-",we=-se):we=(se%ee+ee)%ee);let fe=we.toString(M);return fe=A?fe.toUpperCase():fe.toLowerCase(),I>0&&fe.length<I&&(fe=fe.padStart(I,"0")),U>0&&(fe=a(fe,U,X)),ae+T+fe};return te.options=O,te}function w(E,O){const M=l(O);let T=o.get(M);return T||(T=p(M),o.set(M,T)),T(E)}function v(E){const O=l(E),{radix:M,groupSeparator:T,signed:A,min:I,max:U}=O,X=Y[M],q=_=>{if(N(_))return{ok:!0,value:null,reason:"blank"};let H=String(_);if(T&&T!==""&&(H=H.split(T).join("")),H=H.replace(k,""),H==="")return{ok:!0,value:null,reason:"blank"};let ee=!1;if((H[0]==="-"||H[0]==="+")&&(ee=H[0]==="-",H=H.slice(1)),H==="")return{ok:!1,value:null,reason:"digits"};let te=null;for(const[ne,se]of j){const ae=ne.exec(H);if(!ae)continue;const we=H.slice(ae[0].length);if(we==="")break;if(!Y[se].test(we))return{ok:!1,value:null,reason:"digits"};te=parseInt(we,se);break}if(te===null)if(X.test(H))te=parseInt(H,M);else if(y.test(H))te=Number(H);else return{ok:!1,value:null,reason:"digits"};if(!Number.isFinite(te))return{ok:!1,value:null,reason:"digits"};const J=b(ee?-te:te);return!A&&J<0?{ok:!1,value:J,reason:"negative"}:J<I||J>U?{ok:!1,value:J,reason:"range"}:{ok:!0,value:J,reason:"ok"}};return q.options=O,q}function P(E,O){const M=l(O);let T=u.get(M);return T||(T=v(M),u.set(M,T)),T(E)}function V(E,O){const M=P(E,O);return M.ok?M.value:null}function W(E,O){const M=N(E)||Number.isNaN(E)?null:Number(E),T=N(O)||Number.isNaN(O)?null:Number(O);return M===null?T===null?0:1:T===null||M<T?-1:M>T?1:0}function K(E){const O=E.min>=-2147483648&&E.max<=2147483647;return E.bitWidth&&O?"int32":"float64"}function R(E){const O=h(E),M=p(O),T=v(O);return{base:"number",extends:"number",storage:K(O),matches:null,format:A=>M(A.value),parse:A=>{const I=T(A.text);return I.ok?I.value:null},compare:W,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:A=>M(A),fromClipboard:A=>{const I=T(A);return I.ok?I.value:null},radix:O,formatValue:M,parseText:T}}const S=R}),He("packages/core/src/columns/types/aggregable.js",function(e,D){"use strict";Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"weightedMean",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"logarithmicSum",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"logarithmicMean",{enumerable:!0,get:function(){return L}});const N=D("packages/core/src/internal/predicates.js").isNil;function G($){const j=[];for(const k of $||[]){if(N(k))continue;const y=Number(k);Number.isFinite(y)&&j.push(y)}return j}function F($){return j=>{const k=G(j);if(!k.length)return null;let y=0;for(const c of k)y+=10**(c/$);return $*Math.log10(y)}}function L($){return j=>{const k=G(j);if(!k.length)return null;let y=0;for(const c of k)y+=10**(c/$);return $*Math.log10(y/k.length)}}function Z($,j){const k=j&&j.column,c=(k&&k.typeOptions||{}).weight,m=j&&j.valueAt;if(!c||typeof m!="function")return null;let s=0,t=0;for(let o=0;o<$.length;o++){if(N($[o]))continue;const u=Number($[o]);if(!Number.isFinite(u))continue;const d=m(c,o);if(N(d))continue;const i=Number(d);!Number.isFinite(i)||i<=0||(s+=u*i,t+=i)}return t===0?null:s/t}function z($={}){const j=$.factor===20?20:10,k=typeof $.suffix=="string"?$.suffix:"",y=Number.isInteger($.decimals)?$.decimals:1;return{base:"number",storage:"float64",name:$.name||"logarithmic",format:c=>{const m=c&&c.value;return N(m)||!Number.isFinite(Number(m))?"":`${Number(m).toFixed(y)}${k}`},parse:c=>{const m=String((c&&c.text)??"").replace(k,"").trim();if(!m)return null;const s=Number(m);return Number.isFinite(s)?s:null},defaults:{align:"end",filter:"number"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:{sum:F(j),avg:L(j)}}}}function x($={}){const j=Number.isInteger($.decimals)?$.decimals:1,k=$.percent===!0;return{base:"number",storage:"float64",name:$.name||"ratio",format:y=>{const c=y&&y.value;return N(c)||!Number.isFinite(Number(c))?"":k?`${Number(c).toFixed(j)}%`:Number(c).toFixed(j)},parse:y=>{const c=String((y&&y.text)??"").replace("%","").trim();if(!c)return null;const m=Number(c);return Number.isFinite(m)?m:null},defaults:{align:"end",filter:"number"},totals:{supported:["avg","min","max","count","countValues"],implement:{avg:Z}}}}const Y=Object.freeze({decibel:z({name:"decibel",factor:10,suffix:" dB"}),decibelAmplitude:z({name:"decibelAmplitude",factor:20,suffix:" dB"}),ratio:x({name:"ratio"}),percentRate:x({name:"percentRate",percent:!0})})}),He("packages/core/src/columns/types/currency.js",function(e,D){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"moneyToText",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return i}});const N=D("packages/core/src/internal/predicates.js").isNil,G="⚠ no rate";function F(g){if(N(g))return null;const r=String(g).trim().toUpperCase();return r===""?null:r}function L(g){if(N(g))return null;if(typeof g=="object"&&!Array.isArray(g)){const r=Number(g.amount),n=F(g.code);return!n||!Number.isFinite(r)?null:{amount:r,code:n}}if(Array.isArray(g)&&g.length===2){const r=Number(g[0]),n=F(g[1]);return!n||!Number.isFinite(r)?null:{amount:r,code:n}}return null}const Z=Object.freeze({$:"USD","€":"EUR","£":"GBP","¥":"JPY","₹":"INR","₩":"KRW","₽":"RUB","₺":"TRY","₴":"UAH","₪":"ILS"}),z=Object.freeze({USD:"$",EUR:"€",GBP:"£",JPY:"¥",INR:"₹",KRW:"₩",RUB:"₽",TRY:"₺",UAH:"₴",ILS:"₪"}),x=/[+-]?[\d\s., ]*\d/;function Y(g,r){const n=String(g).trim();if(n==="")return null;const f=new Intl.NumberFormat(r||void 0).formatToParts(1.1).find(a=>a.type==="decimal")?.value||".",h=f===","?".":",",l=n.split(h).join("").split(/[\s ]/).join("").replace(f,"."),b=Number(l);return Number.isFinite(b)?b:null}function $(g,r){const n=r||{},f=F(n.code);if(N(g))return null;const h=L(g);if(h)return h;if(typeof g=="number")return Number.isFinite(g)&&f?{amount:g,code:f}:null;let l=String(g).trim();if(l==="")return null;let b=!1;l.startsWith("(")&&l.endsWith(")")&&(b=!0,l=l.slice(1,-1).trim());let a=null;for(const[W,K]of Object.entries(Z)){if(l.startsWith(W)){a=K,l=l.slice(W.length).trim();break}if(l.endsWith(W)){a=K,l=l.slice(0,-W.length).trim();break}}const p=x.exec(l);if(!p)return null;const w=Y(p[0],n.locale);if(w===null)return null;const v=(l.slice(0,p.index)+" "+l.slice(p.index+p[0].length)).trim();!a&&v!==""&&(a=F(v));const P=a||f;return P?{amount:b?-w:w,code:P}:null}function j(g,r){if(typeof g=="function")return(n,f)=>{if(n===f)return 1;const h=g(n,f);return typeof h=="number"&&Number.isFinite(h)&&h>0?h:null};if(g&&typeof g=="object"){const n=g;return(f,h)=>{if(f===h)return 1;const l=Number(n[f]),b=Number(n[h]);return!Number.isFinite(l)||!Number.isFinite(b)||l<=0||b<=0?null:b/l}}return(n,f)=>n===f?1:null}function k(g,r,n){if(!g)return null;if(g.code===r)return g.amount;const f=n(g.code,r);return f===null?null:g.amount*f}const y=new Map;function c(g,r,n){const f=`${g||""}|${r}|${n??""}`;let h=y.get(f);if(!h){const l={style:"currency",currency:r};typeof n=="number"&&(l.minimumFractionDigits=n,l.maximumFractionDigits=n);try{h={fmt:new Intl.NumberFormat(g||void 0,l),currency:!0}}catch{h={fmt:new Intl.NumberFormat(g||void 0,typeof n=="number"?{minimumFractionDigits:n,maximumFractionDigits:n}:{}),currency:!1}}y.set(f,h)}return h}function m(g,r){const n=r||{},f=n.nullDisplay??"",h=L(g);if(!h)return f;const l=F(n.display)||h.code;let b=h.amount,a=h.code;if(l!==h.code){const v=n.rateFn||j(n.rates,n.rateBase),P=k(h,l,v);if(P===null)return`${n.missingRate??G} ${h.code}→${l}`;b=P,a=l}const{fmt:p,currency:w}=c(n.locale,a,n.decimals);return w?p.format(b):`${p.format(b)} ${a}`}function s(g){const r=L(g);return r?`${r.amount} ${r.code}`:""}function t(g){const r=g||{},n=F(r.display),f=r.rateFn||j(r.rates,r.rateBase);return(h,l)=>{const b=L(h),a=L(l);if(!b&&!a)return 0;if(!b)return 1;if(!a)return-1;if(n){const p=k(b,n,f),w=k(a,n,f);if(p!==null&&w!==null)return p===w?0:p<w?-1:1}return b.code===a.code?b.amount===a.amount?0:b.amount<a.amount?-1:1:b.code<a.code?-1:1}}function o(g){const r=g||{},n=(h,l)=>{const b=[];for(const P of h||[]){const V=L(P);V&&b.push(V)}if(!b.length)return null;if(new Set(b.map(P=>P.code)).size===1){const P=b[0].code;return{amount:l(b.map(V=>V.amount)),code:P}}const p=F(r.display);if(!p)return`${r.missingRate??G}: mixed currencies, no display currency set`;const w=r.rateFn||j(r.rates,r.rateBase),v=[];for(const P of b){const V=k(P,p,w);if(V===null)return`${r.missingRate??G}: ${P.code}→${p}`;v.push(V)}return{amount:l(v),code:p}},f=h=>h.reduce((l,b)=>l+b,0);return{sum:h=>n(h,f),avg:h=>n(h,l=>f(l)/l.length),min:h=>n(h,l=>Math.min(...l)),max:h=>n(h,l=>Math.max(...l))}}function u(g){const r=Object.freeze({code:"USD",...g||{}}),n=j(r.rates,r.rateBase),f=Object.freeze({...r,rateFn:n}),h=o(f),l=t(f),b=new Map([[r.locale||"",f]]),a=v=>{const P=v||"";let V=b.get(P);return V||(V=Object.freeze({...f,locale:v||void 0}),b.set(P,V)),V},p=z[F(r.display||r.code)]||"",w=typeof r.decimals=="number"&&r.decimals>0?`.${"0".repeat(r.decimals)}`:".00";return{base:"object",extends:"object",storage:"object",name:"currency",currencyConfig:f,format:v=>m(v.value,v.locale?a(v.locale):f),parse:v=>$(v.text,v.locale?a(v.locale):f),compare:l,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:h},excel:r.excel||(p?`"${p}"#,##0${w}`:`#,##0${w}`),toStorage:v=>{const P=L(v);return P||(typeof v=="string"||typeof v=="number"?$(v,f):null)},toClipboard:v=>s(v),fromClipboard:v=>$(v,f)}}const d=Object.freeze({currency:u({code:"USD"}),usd:u({code:"USD"}),eur:u({code:"EUR"}),gbp:u({code:"GBP"}),jpy:u({code:"JPY",decimals:0})}),i=u}),He("packages/core/src/columns/types/index.js",function(e,D){"use strict";Object.defineProperty(e,"EXTENDED_TYPES",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return W}});const re=D("packages/core/src/columns/types/temporal.js"),N=re.TEMPORAL_TYPES,G=D("packages/core/src/columns/types/network.js"),F=G.NETWORK_TYPES,L=D("packages/core/src/columns/types/structured.js"),Z=L.STRUCTURED_TYPES,z=D("packages/core/src/columns/types/unit.js"),x=z.createUnitType,Y=z.UNIT_SYSTEMS,$=z.parseUnit,j=z.formatUnit,k=z.registerUnitSystem,y=z.unitSystemNames,c=z.unitsOf,m=z.defineUnit,s=D("packages/core/src/columns/types/engineering.js"),t=s.ENGINEERING_TYPES,o=D("packages/core/src/columns/types/si.js"),u=o.SI_TYPES,d=o.createSiType,i=o.createSiSystem,g=o.siUnits,r=o.SI_PREFIXES,n=D("packages/core/src/columns/types/temperature.js"),f=n.TEMPERATURE_TYPES,h=n.createTemperatureType,l=n.convertTemperature,b=n.formatTemperature,a=n.parseTemperature,p=n.TEMPERATURE_SCALES,w=D("packages/core/src/columns/types/radix.js"),v=w.createRadixType,P=w.RADIX_PRESETS,V=w.parseRadix,W=w.formatRadix,K=D("packages/core/src/columns/types/aggregable.js"),R=K.AGGREGABLE_TYPES,S=D("packages/core/src/columns/types/currency.js"),E=S.CURRENCY_TYPES,O=S.createCurrencyType,M=S.parseMoney,T=S.formatMoney,A=S.convertMoney,I=S.toMoney,U=S.rateFunction,X=S.moneyComparator,q=S.normaliseCode,_=S.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return z.findUnit}}),Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return s.ENGINEERING_TYPES}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return s.circularMean}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return n.TEMPERATURE_TYPES}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return n.createTemperatureType}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return n.convertTemperature}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return n.formatTemperature}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return n.parseTemperature}}),Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return n.TEMPERATURE_SCALES}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return n.findScale}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return S.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return S.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return S.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return S.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return S.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return S.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return S.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return S.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return S.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return S.MISSING_RATE}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return re.TEMPORAL_TYPES}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return G.NETWORK_TYPES}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return L.STRUCTURED_TYPES}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return K.AGGREGABLE_TYPES}}),Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return K.createLogarithmicType}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return K.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 G.parseIpv4}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return G.formatIpv4}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return G.parseCidr}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return G.formatCidr}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return G.parseIpv6}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return G.formatIpv6}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return G.networkAddress}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return G.broadcastAddress}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return G.hostCount}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return G.containsAddress}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return G.overlaps}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return L.maskValue}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return L.summariseJson}});const H=Object.freeze({...N,...F,...Z,...R,hex:v(P.hex),hex8:v(P.hex8),hex16:v(P.hex16),hex32:v(P.hex32),binary:v(P.binary),binary8:v(P.binary8),octal:v(P.octal),bytes:x({system:"data",unit:"B",display:"auto"}),megabytes:x({system:"data",unit:"MB"}),gigabytes:x({system:"data",unit:"GB"}),bitrate:x({system:"bitrate",unit:"Mbps"}),gigabits:x({system:"bitrate",unit:"Gbps"}),...t,...u,...f,...E});{const ee=new Set;for(const te of[N,F,Z,R,t,u,f,E])for(const J of Object.keys(te)){if(ee.has(J))throw new Error(`[lattice] data type "${J}" is declared twice`);ee.add(J)}}}),He("packages/core/src/compute/handle.js",function(e,D){"use strict";Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return u}});const re=D("packages/core/src/internal/compare.js"),N=re.collator,G=re.defaultCompare,L=D("packages/core/src/internal/warn.js").warnOnce;function Z(d){const i=new Uint32Array(d);for(let g=0;g<d;g++)i[g]=g;return i}function z(d,i){if(i&&typeof i.count=="number")return i.count;if(!d)return 0;if(typeof d.count=="number")return d.count;if(typeof d.length=="number")return d.length;const g=d.values;return d.kind==="multi"&&d.offsets?Math.max(0,d.offsets.length-1):g?d.kind==="bitset"?typeof g.size=="number"?g.size:d.presence&&typeof d.presence.size=="number"?d.presence.size:(L(`count:${d.id}`,`column "${d.id}" is bitset-backed with no declared row count; assuming ${g.length*8}`),g.length*8):g.length:d.presence&&typeof d.presence.size=="number"?d.presence.size:0}const x=new WeakMap;function Y(d){const i=d.constructor;if(!i)return"unknown";const g=x.get(i);if(g)return g;let r="unknown";try{let n=null;typeof i.from=="function"?n=i.from([!1,!0]):(n=new i(8),n.set(1));const f=n&&n.words;f&&f.length&&(f[0]===2?r="lsb":f[0]===64&&(r="msb"))}catch{r="unknown"}return x.set(i,r),r}function $(d){if(!d)return()=>0;const i=d instanceof Uint8Array?d:d.words;if(i instanceof Uint8Array){const g=d instanceof Uint8Array?"lsb":Y(d);if(g==="lsb")return r=>i[r>>>3]>>>(r&7)&1;if(g==="msb")return r=>i[r>>>3]>>>7-(r&7)&1}return typeof d.get=="function"?g=>d.get(g)?1:0:()=>0}function j(d){return!d||!d.presence?null:$(d.presence)}function k(d){return d?typeof d.size=="number"?d.size:typeof d.values=="function"?d.values().length:0:0}function y(d,i){return d?typeof d.valueOf=="function"?d.valueOf(i):typeof d.values=="function"?d.values()[i]:null:null}function c(d,i){const g=d.offsets,r=d.values;if(!g||!r)return[];const n=g[i],f=g[i+1];if(!(f>n))return[];const h=d.dict,l=new Array(f-n);for(let b=n;b<f;b++)l[b-n]=h?y(h,r[b]):r[b];return l}function m(d){if(!d)return()=>{};const i=d.values,g=j(d),r=d.kind;if(r==="dictionary"){const n=d.dict;return g?f=>g(f)?y(n,i[f]):null:f=>y(n,i[f])}if(r==="bitset"){const n=$(i);return g?f=>g(f)?n(f)===1:null:f=>n(f)===1}if(r==="multi")return g?n=>g(n)?c(d,n):null:n=>c(d,n);if(!i&&typeof d.get=="function"){const n=d.get.bind(d);return f=>{const h=n(f);return h===void 0?null:h}}return g?n=>{if(!g(n))return null;const f=i[n];return f===void 0?null:f}:n=>{const f=i[n];return f===void 0?null:f}}function s(d,i){if(d<i)return-1;if(d>i)return 1;if(d===i){const n=Object.is(d,-0),f=Object.is(i,-0);return n===f?0:n?-1:1}const g=Number.isNaN(d),r=Number.isNaN(i);return g&&r?0:g?1:-1}function t(d){const i=N(d);return(g,r)=>{if(g===r)return 0;const n=typeof g,f=typeof r;if(n==="string"&&f==="string")return i.compare(g,r);if(n==="number"&&f==="number")return s(g,r);if(n==="boolean"&&f==="boolean")return g===r?0:g?1:-1;if(g instanceof Date||r instanceof Date){const h=g instanceof Date?g.getTime():Number(g),l=r instanceof Date?r.getTime():Number(r);return s(h,l)}return G(g,r)}}function o(d,i){if(d&&typeof d.ranks=="function")return d.ranks(i);const g=d&&typeof d.values=="function"?d.values():[],r=g.length,n=t(i),f=new Array(r);for(let l=0;l<r;l++)f[l]=l;f.sort((l,b)=>n(g[l],g[b])||l-b);const h=new Uint32Array(r);for(let l=0;l<r;l++)h[f[l]]=l;return h}function u(d){return d==null||typeof d=="number"&&Number.isNaN(d)}}),He("packages/core/src/compute/filter.js",function(e,D){"use strict";Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"wallMs",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return we}});const N=D("packages/core/src/internal/predicates.js").isBlank,F=D("packages/core/src/internal/merge.js").toArray,Z=D("packages/core/src/internal/warn.js").warnOnce,z=D("packages/core/src/format/date.js"),x=z.toDate,Y=z.toIsoDate,$=D("packages/core/src/compute/handle.js"),j=$.bitReader,k=$.dictSize,y=$.dictValue,c=$.presenceReader,m=$.valueComparator,s=$.valueReader,t=/^\d{4}-\d{2}-\d{2}$/,o="\0null\0";function u(fe,ge){const je=fe&&fe.pool;if(je){const Pe=je.mask||je.acquireMask||je.acquire||je.take;if(typeof Pe=="function"){const de=Pe.call(je,ge);if(de&&de.length>=ge)return de}}return new Uint8Array(ge)}function d(fe,ge){const je=fe&&fe.pool;if(!je||!ge)return;const Pe=je.release||je.releaseMask||je.free||je.recycle;typeof Pe=="function"&&Pe.call(je,ge)}function i(fe,ge,je){return fe.fill(je,0,ge),fe}function g(fe){return fe==null||typeof fe=="number"&&Number.isNaN(fe)}function r(fe,ge){if(fe==null)return fe;if(ge==="number")return typeof fe=="number"?fe:Number(fe);if(ge==="date"||ge==="dateString"){const je=Y(fe);return je===null?n(fe):je}return ge==="boolean"?typeof fe=="boolean"?fe:fe==="true"||fe===1?!0:fe==="false"||fe===0?!1:!!fe:fe}function n(fe){return fe instanceof Date?fe.getTime():typeof fe=="number"?fe:Date.parse(String(fe))}function f(fe){return typeof fe=="number"?fe:fe instanceof Date?fe.getTime():fe==null||fe===""?NaN:Number(fe)}function h(fe,ge){const je=typeof fe=="string"?fe:String(fe);return ge?je:je.toLowerCase()}function l(fe,ge){return fe==null?o:typeof fe=="string"?ge?fe:fe.toLowerCase():fe instanceof Date?fe.getTime():fe}function b(fe,ge,je){const Pe=new Set;for(const de of F(fe)){const oe=r(de,je);Pe.add(l(oe,ge)),typeof oe=="string"&&oe!==""&&Number.isFinite(Number(oe))?Pe.add(Number(oe)):typeof oe=="number"&&Number.isFinite(oe)&&Pe.add(l(String(oe),ge))}return Pe}function a(fe,ge,je){if(fe==null||ge===null||ge===void 0)return fe==null&&ge==null;const Pe=typeof fe,de=typeof ge;return Pe==="string"&&de==="string"?je?fe===ge:fe.toLowerCase()===ge.toLowerCase():fe instanceof Date||ge instanceof Date?n(fe)===n(ge):Pe==="number"&&de==="number"?fe===ge||Number.isNaN(fe)&&Number.isNaN(ge):Pe==="number"&&de==="string"?fe===Number(ge):Pe==="string"&&de==="number"?Number(fe)===ge:Pe==="boolean"||de==="boolean"?fe===ge:Array.isArray(fe)&&Array.isArray(ge)?fe.length===ge.length&&fe.every((oe,he)=>a(oe,ge[he],je)):fe===ge}function p(fe,ge){try{if(fe instanceof RegExp){const je=fe.flags.replace(/[gy]/g,"");return new RegExp(fe.source,ge||je.includes("i")?je:`${je}i`)}return new RegExp(String(fe),ge?"":"i")}catch(je){return Z(`regex:${String(fe)}`,`filter operator "matches" received an invalid pattern: ${String(fe)}`,je),null}}function w(fe,ge){if(fe&&fe.type==="datetime"&&v.has(fe.op))return R(fe,ge);const je=S(fe,ge),Pe=fe&&fe.type;return Pe!=="date"&&Pe!=="dateString"?je:de=>je(typeof de=="string"&&t.test(de)?de:Y(de)??de)}const v=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn"]),P=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3})\d*)?)?)?$/,V=new Map;function W(fe,ge){let je=V.get(ge);if(je===void 0){try{je=new Intl.DateTimeFormat("en-CA",{timeZone:ge,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{je=null}V.set(ge,je)}if(!je)return null;const Pe={};for(const de of je.formatToParts(fe))de.type!=="literal"&&(Pe[de.type]=de.value);return Pe}function K(fe,ge){if(fe==null||fe==="")return null;if(typeof fe=="string"){const oe=P.exec(fe.trim());if(oe)return Date.UTC(+oe[1],+oe[2]-1,+oe[3],+(oe[4]||0),+(oe[5]||0),+(oe[6]||0),+(oe[7]||"0").padEnd(3,"0"))}const je=x(fe);if(!je)return null;const Pe=je.getUTCMilliseconds(),de=ge?W(je,ge):null;return de?Date.UTC(+de.year,+de.month-1,+de.day,de.hour==="24"?0:+de.hour,+de.minute,+de.second,Pe):Date.UTC(je.getFullYear(),je.getMonth(),je.getDate(),je.getHours(),je.getMinutes(),je.getSeconds(),Pe)}function R(fe,ge){const je=typeof fe.timeZone=="string"&&fe.timeZone?fe.timeZone:void 0,Pe=he=>K(he,je),de=Array.isArray(fe.value)?fe.value.map(Pe):Pe(fe.value),oe=S({...fe,type:"number",value:de},ge);return he=>oe(K(he))}function S(fe,ge){const je=fe&&fe.op,Pe=!!(fe&&fe.caseSensitive),de=fe&&fe.type,oe=m(ge),he=ce=>me=>!ce(me);switch(je){case"eq":{const ce=r(fe.value,de);return me=>a(me,ce,Pe)}case"ne":{const ce=r(fe.value,de);return me=>!a(me,ce,Pe)}case"lt":case"lte":case"gt":case"gte":{const ce=r(fe.value,de);if(g(ce))return()=>!1;const me=je==="lt"?-1:je==="lte"?0:je==="gt"?1:2;return ye=>{if(g(ye))return!1;const xe=oe(ye,ce);return me===-1?xe<0:me===0?xe<=0:me===1?xe>0:xe>=0}}case"between":case"notBetween":{const ce=F(fe.value),me=r(ce[0],de),ye=r(ce[1],de),xe=fe.bounds||"[]",Se=xe.charAt(0)!=="(",Te=xe.charAt(1)!==")";if(g(me)||g(ye))return je==="between"?()=>!1:()=>!0;const Be=Ee=>{if(g(Ee))return!1;const Ge=oe(Ee,me),Ne=oe(Ee,ye);return(Se?Ge>=0:Ge>0)&&(Te?Ne<=0:Ne<0)};return je==="between"?Be:he(Be)}case"in":case"notIn":{const ce=b(fe.value,Pe,de),me=ye=>ce.has(l(ye,Pe));return je==="in"?me:he(me)}case"contains":case"notContains":{const ce=h(r(fe.value,de),Pe),me=ye=>ye==null?!1:h(ye,Pe).includes(ce);return je==="contains"?me:he(me)}case"startsWith":{const ce=h(r(fe.value,de),Pe);return me=>me==null?!1:h(me,Pe).startsWith(ce)}case"endsWith":{const ce=h(r(fe.value,de),Pe);return me=>me==null?!1:h(me,Pe).endsWith(ce)}case"matches":{const ce=p(fe.value,Pe);return ce?me=>me==null?!1:ce.test(String(me)):()=>!1}case"blank":case"notBlank":{const ce=fe.trim===!0,me=ye=>N(ye)||Array.isArray(ye)&&ye.length===0||ce&&typeof ye=="string"&&ye.trim()==="";return je==="blank"?me:ye=>!me(ye)}case"containsAny":case"containsNone":{const ce=b(fe.value,Pe,de),me=ye=>{const xe=ye==null?[]:F(ye);for(let Se=0;Se<xe.length;Se++)if(ce.has(l(xe[Se],Pe)))return!0;return!1};return je==="containsAny"?me:he(me)}case"containsAll":{const ce=F(fe.value).map(me=>l(r(me,de),Pe));return me=>{const ye=me==null?[]:F(me);if(ce.length===0)return!0;const xe=new Set(ye.map(Se=>l(Se,Pe)));for(let Se=0;Se<ce.length;Se++)if(!xe.has(ce[Se]))return!1;return!0}}default:{const ce=we(je);return ce?ce.compile(fe.value):(Z(`op:${String(je)}`,`unknown filter operator "${String(je)}"; the condition is refused rather than matching every row`),()=>!1)}}}function E(fe,ge,je){return w(ge,je)(fe)}const O=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),M=new Set(["containsAny","containsAll","containsNone"]);function T(fe,ge,je){const Pe=fe&&fe.op,de=O[Pe]||Pe,oe=w({...fe,op:de,type:ge.type},je),he=ge.items,ce=me=>{const ye=he(me);if(!ye)return!1;for(let xe=0;xe<ye.length;xe++)if(oe(ye[xe]))return!0;return!1};return O[Pe]?me=>!ce(me):ce}function A(fe,ge,je,Pe,de){const oe=de?null:c(fe);if(oe){const me=ge?1:0;for(let ye=0;ye<Pe;ye++)je[ye]=oe(ye)===me?1:0;return je}const he=fe.kind;if(he==="float64"||he==="int32"||he==="bitset")return i(je,Pe,ge?1:0);const ce=s(fe);for(let me=0;me<Pe;me++){const ye=ce(me),xe=N(ye)||Array.isArray(ye)&&ye.length===0||de&&typeof ye=="string"&&ye.trim()==="";je[me]=xe===ge?0:1}return je}function I(fe,ge,je,Pe){const de=fe.dict,oe=k(de),he=new Uint8Array(oe);for(let xe=0;xe<oe;xe++)he[xe]=ge(y(de,xe))?1:0;const ce=fe.values,me=c(fe);if(!me){for(let xe=0;xe<Pe;xe++)je[xe]=he[ce[xe]];return je}const ye=ge(null)?1:0;for(let xe=0;xe<Pe;xe++)je[xe]=me(xe)===1?he[ce[xe]]:ye;return je}function U(fe,ge,je,Pe){const de=j(fe.values),oe=ge(!0)?1:0,he=ge(!1)?1:0,ce=c(fe);if(!ce){for(let ye=0;ye<Pe;ye++)je[ye]=de(ye)===1?oe:he;return je}const me=ge(null)?1:0;for(let ye=0;ye<Pe;ye++)je[ye]=ce(ye)===0?me:de(ye)===1?oe:he;return je}function X(fe,ge,je,Pe,de){const oe=fe.values,he=ge.type,ce=ge.op;let me=!0;switch(ce){case"eq":case"ne":{const xe=f(r(ge.value,he)),Se=typeof ge.value=="number"&&Number.isNaN(ge.value),Te=ce==="ne"?1:0;if(Se)for(let Be=0;Be<de;Be++)Pe[Be]=(Number.isNaN(oe[Be])?1:0)^Te;else for(let Be=0;Be<de;Be++)Pe[Be]=(oe[Be]===xe?1:0)^Te;break}case"lt":{const xe=f(r(ge.value,he));for(let Se=0;Se<de;Se++)Pe[Se]=oe[Se]<xe?1:0;break}case"lte":{const xe=f(r(ge.value,he));for(let Se=0;Se<de;Se++)Pe[Se]=oe[Se]<=xe?1:0;break}case"gt":{const xe=f(r(ge.value,he));for(let Se=0;Se<de;Se++)Pe[Se]=oe[Se]>xe?1:0;break}case"gte":{const xe=f(r(ge.value,he));for(let Se=0;Se<de;Se++)Pe[Se]=oe[Se]>=xe?1:0;break}case"between":case"notBetween":{const xe=F(ge.value),Se=f(r(xe[0],he)),Te=f(r(xe[1],he)),Be=ge.bounds||"[]",Ee=Be.charAt(0)!=="(",Ge=Be.charAt(1)!==")",Ne=ce==="notBetween"?1:0;if(Ee&&Ge)for(let ke=0;ke<de;ke++)Pe[ke]=(oe[ke]>=Se&oe[ke]<=Te?1:0)^Ne;else if(Ee)for(let ke=0;ke<de;ke++)Pe[ke]=(oe[ke]>=Se&oe[ke]<Te?1:0)^Ne;else if(Ge)for(let ke=0;ke<de;ke++)Pe[ke]=(oe[ke]>Se&oe[ke]<=Te?1:0)^Ne;else for(let ke=0;ke<de;ke++)Pe[ke]=(oe[ke]>Se&oe[ke]<Te?1:0)^Ne;break}case"in":case"notIn":{const xe=new Set;for(const Te of F(ge.value)){const Be=f(r(Te,he));Number.isNaN(Be)||xe.add(Be)}const Se=ce==="notIn"?1:0;for(let Te=0;Te<de;Te++)Pe[Te]=(xe.has(oe[Te])?1:0)^Se;break}default:me=!1;break}if(!me)return!1;const ye=c(fe);if(ye){const xe=je(null)?1:0;for(let Se=0;Se<de;Se++)ye(Se)===0&&(Pe[Se]=xe)}return!0}function q(fe,ge,je,Pe){const de=s(fe);for(let oe=0;oe<Pe;oe++)je[oe]=ge(de(oe))?1:0;return je}function _(fe,ge,je){const Pe=ge.count|0,de=je||u(ge,Pe);if(!fe)return i(de,Pe,1);const oe=typeof ge.handle=="function"?ge.handle(fe.col):void 0,he=typeof ge.custom=="function"?ge.custom:null;if(!oe){if(he){for(let xe=0;xe<Pe;xe++)de[xe]=he(fe,xe)?1:0;return de}return Z(`filter:col:${String(fe.col)}`,`filter references unknown column "${String(fe.col)}"; the condition is refused rather than matching every row`),i(de,Pe,0)}const ce=fe.op;if(ce==="blank"||ce==="notBlank")return A(oe,ce==="notBlank",de,Pe,fe.trim===!0);const me=typeof ge.itemwise=="function"?ge.itemwise(fe.col):null;if(me&&!we(ce)&&!M.has(ce))return q(oe,T(fe,me,ge.locale),de,Pe);const ye=w(fe,ge.locale);switch(oe.kind){case"dictionary":return I(oe,ye,de,Pe);case"bitset":return U(oe,ye,de,Pe);case"float64":case"int32":return X(oe,fe,ye,de,Pe)?de:q(oe,ye,de,Pe);default:return q(oe,ye,de,Pe)}}function H(fe,ge,je){if(!fe)return i(u(ge,je),je,1);if(Array.isArray(fe.conditions)){const Pe=fe.conditions.filter(he=>he!=null),de=fe.op==="or"?"or":fe.op==="not"?"not":"and";if(Pe.length===0)return i(u(ge,je),je,1);const oe=H(Pe[0],ge,je);for(let he=1;he<Pe.length;he++){const ce=H(Pe[he],ge,je);if(de==="or")for(let me=0;me<je;me++)oe[me]|=ce[me];else for(let me=0;me<je;me++)oe[me]&=ce[me];d(ge,ce)}if(de==="not")for(let he=0;he<je;he++)oe[he]^=1;return oe}return _(fe,ge,u(ge,je))}function ee(fe,ge){return H(fe,ge,ge.count|0)}function te(fe,ge){if(!fe||!ge)return fe||null;const je=fe;if(Array.isArray(je.conditions)){if((je.op==="or"?"or":je.op==="not"?"not":"and")!=="and")return J(je,ge)?null:fe;const de=[];for(const oe of je.conditions){const he=te(oe,ge);he&&de.push(he)}return de.length?{...je,op:"and",conditions:de}:null}return je.col===ge?null:fe}function J(fe,ge){if(!fe||typeof fe!="object")return!1;const je=fe;if(je.col===ge)return!0;if(Array.isArray(je.conditions)){for(const Pe of je.conditions)if(J(Pe,ge))return!0}return!1}function ne(fe,ge,je){if(je&&je.length>=ge){let he=0;for(let ce=0;ce<ge;ce++)fe[ce]&&(je[he++]=ce);return je.subarray(0,he)}let Pe=0;for(let he=0;he<ge;he++)Pe+=fe[he]?1:0;const de=new Uint32Array(Pe);let oe=0;for(let he=0;he<ge;he++)fe[he]&&(de[oe++]=he);return de}const se=new Map;function ae(fe){if(!(!fe||typeof fe!="object"))for(const[ge,je]of Object.entries(fe))je&&typeof je.compile=="function"&&se.set(ge,je)}function we(fe){return typeof fe=="string"?se.get(fe):void 0}}),He("packages/core/src/columns/datatypes.js",function(e,D){"use strict";Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"parseNumberText",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"BUILTIN_TYPES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return T}});const re=D("packages/core/src/internal/compare.js"),N=re.collator,G=re.defaultCompare,F=D("packages/core/src/internal/predicates.js"),L=F.isNil,Z=F.isObject,z=F.isFunction,Y=D("packages/core/src/internal/warn.js").fail,j=D("packages/core/src/internal/text.js").titleCase,k=D("packages/core/src/format/date.js"),y=k.toDate,c=k.toIsoDate,m=k.compareIso,t=D("packages/core/src/format/boolean.js").toTriState,u=D("packages/core/src/columns/types/index.js").EXTENDED_TYPES,d=D("packages/core/src/formula/index.js"),i=d.evaluateFormula,g=d.looksLikeFormula,n=D("packages/core/src/compute/filter.js").declareOperators,f=/^\d{4}-\d{2}-\d{2}$/;function h(A){return A.getHours()===0&&A.getMinutes()===0&&A.getSeconds()===0&&A.getMilliseconds()===0}const l=new Map;function b(A){const I=A||"",U=l.get(I);if(U)return U;const X={group:",",decimal:"."};try{for(const q of new Intl.NumberFormat(A||void 0).formatToParts(12345.6))q.type==="group"?X.group=q.value:q.type==="decimal"&&(X.decimal=q.value)}catch{}return l.set(I,X),X}const a=/\d\s*[*/^]\s*[\d.(]/;function p(A,I){if(L(A))return null;let U=String(A).trim();if(U===""||U.startsWith("=")||a.test(U))return null;let X=1;U.startsWith("(")&&U.endsWith(")")&&(X=-1,U=U.slice(1,-1));const q=U.endsWith("%"),{group:_,decimal:H}=b(I);if(U=U.replace(/[\s\u00a0\u202f\u2009']/g,""),_&&_!=="."&&_!==","&&(U=U.split(_).join("")),U=U.replace(/[^0-9eE+\-.,]/g,""),H===","?U=U.split(".").join("").replace(",","."):U=U.split(",").join(""),U===""||U==="-"||U==="+")return null;const ee=Number(U);return Number.isNaN(ee)?null:X*(q?ee/100:ee)}function w(A,I){const U=L(A)||Number.isNaN(A)?null:Number(A),X=L(I)||Number.isNaN(I)?null:Number(I);return U===null?X===null?0:1:X===null||U<X?-1:U>X?1:0}function v(A,I){const U=t(A),X=t(I);return U===null?X===null?0:1:X===null?-1:U===X?0:U?1:-1}function P(A,I){const U=y(A),X=y(I);if(!U)return X?1:0;if(!X)return-1;const q=U.getTime(),_=X.getTime();return q<_?-1:q>_?1:0}const V=new Map;function W(A){const I=y(A.value);if(!I)return"";const U=A.locale||"";let X=V.get(U);return X||(X=new Intl.DateTimeFormat(A.locale||void 0,{dateStyle:"medium"}),V.set(U,X)),X.format(I)}const K={boolean:{base:"boolean",storage:"bitset",matches:A=>typeof A=="boolean",parse:A=>t(A.text),compare:v,format:A=>t(A.value)===null?"":t(A.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:A=>t(A)===null?"":String(t(A)),fromClipboard:A=>t(A)},number:{base:"number",storage:"float64",matches:A=>typeof A=="number"&&!Number.isNaN(A),parse:A=>{if(g(A.text)){const I=i(A.text,A);if(!I.ok)return null;const U=Number(I.value);return Number.isFinite(U)?U:null}return p(A.text,A.locale)},compare:w,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:A=>L(A)?"":String(A),fromClipboard:(A,I)=>p(A,I&&I.locale)},date:{base:"dateString",storage:"dictionary",matches:A=>typeof A=="string"&&f.test(A)&&!Number.isNaN(Date.parse(A))||A instanceof Date&&!Number.isNaN(A.getTime())&&h(A),parse:A=>c(A.text),compare:m,format:W,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:A=>c(A),toClipboard:A=>L(A)?"":String(A),fromClipboard:A=>c(A)},dateString:{base:"dateString",storage:"dictionary",matches:A=>typeof A=="string"&&f.test(A)&&!Number.isNaN(Date.parse(A)),parse:A=>c(A.text),compare:m,format:W,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:A=>c(A),toClipboard:A=>L(A)?"":String(A),fromClipboard:A=>c(A)},text:{base:"text",storage:"dictionary",matches:A=>typeof A=="string",parse:A=>A.text===""?null:String(A.text),compare:(A,I)=>L(A)?L(I)?0:1:L(I)?-1:N().compare(String(A),String(I)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:A=>L(A)?"":String(A),fromClipboard:A=>A},image:{base:"text",storage:"dictionary",parse:A=>A.text===""||A.text==null?null:String(A.text).trim(),compare:(A,I)=>L(A)?L(I)?0:1:L(I)?-1:N().compare(String(A),String(I)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:A=>L(A)?"":String(A),fromClipboard:A=>A},lookup:{base:"text",storage:"dictionary",parse:A=>{if(A.text===""||A.text==null)return null;const I=A.column&&A.column.lookup,U=I&&z(I.options)?I.options():null;if(!U)return A.text;const X=String(A.text),q=U.find(ee=>String(ee.id)===X);if(q)return q.id;const _=X.trim().toLowerCase(),H=U.find(ee=>String(ee.label).toLowerCase()===_);return H?H.id:A.text},compare:G,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:A=>L(A)?"":String(A),fromClipboard:A=>A},object:{base:"object",storage:"object",matches:A=>A!==null&&typeof A=="object"&&!(A instanceof Date),parse:A=>{try{return A.text===""?null:JSON.parse(A.text)}catch{return A.text}},compare:(A,I)=>G(A,I),format:A=>{const I=A.value;if(L(I))return"";if(typeof I=="string")return I;try{return JSON.stringify(I)}catch{return String(I)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:A=>L(A)?"":typeof A=="string"?A:JSON.stringify(A),fromClipboard:A=>A}},R=["boolean","number","date","dateString","datetime","text","object"];function S(A,I,U,X){const q=U.get(A);if(q)return q;X.includes(A)&&Y(`circular data type extends chain: ${[...X,A].join(" → ")}`);const _=I[A];_||Y(`unknown data type "${A}"`);let H=null;_.extends&&(H=S(_.extends,I,U,[...X,A]));const ee={...H||{},..._,name:A,defaults:{...H&&H.defaults||{},..._.defaults||{}}};return ee.base||(ee.base=H&&H.base||"text"),ee.storage||(ee.storage=H&&H.storage||"object"),U.set(A,ee),ee}function E(A,I){const U={...K,...u};if(I&&typeof I.dataType=="function"&&typeof I.names=="function")for(const q of I.names("dataType")){const _=I.dataType(q);_&&(U[q]=_)}if(Z(A))for(const[q,_]of Object.entries(A))U[q]=_;const X=new Map;for(const q of R)S(q,U,X,[]);S("lookup",U,X,[]);for(const q of Object.keys(U))S(q,U,X,[]);for(const q of X.values())n(q.operators);return X}function O(A,I){if(A.base==="text"&&(!A.compare||A.compare===K.text.compare)){const U=N(I);return(X,q)=>L(X)?L(q)?0:1:L(q)?-1:U.compare(String(X),String(q))}return A.compare||G}function M(A,I){return I?A.multiStorage||"multi":A.storage||"object"}function T(A){return j(String(A).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),He("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 Z}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return z}});const N=D("packages/core/src/internal/warn.js").infoOnce,F=D("packages/core/src/internal/predicates.js").isNil,L=100;function Z(x,Y,$={}){const j=$.sampleSize??L,k=[];for(let y=0;y<x.length&&k.length<j;y++){const c=x[y];F(c)||typeof c=="number"&&Number.isNaN(c)||k.push(c)}if(k.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[y,c]of Y){if(typeof c.matches!="function")continue;let m=!0;for(let s=0;s<k.length;s++)if(!c.matches(k[s])){m=!1;break}if(m)return{type:y,unanimous:!0,sampled:k.length}}return $.quiet||N(`infer:${$.colId||"?"}`,`column "${$.colId||"?"}" has mixed or ambiguous values and was inferred as "text". Declare \`type\` on the column to get correct sorting, filtering and export.`),{type:"text",unanimous:!1,sampled:k.length}}function z(x,Y,$,j,k={}){const y=k.sampleSize??L,c=[];for(let m=0;m<Y.length&&c.length<y;m++){const s=$(Y[m]);F(s)||typeof s=="number"&&Number.isNaN(s)||c.push(s)}return Z(c,j,{...k,colId:x}).type}}),He("packages/core/src/columns/graph.js",function(e,D){"use strict";Object.defineProperty(e,"WHOLE_ROW",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"declarationOf",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return j}});const re=D("packages/core/src/internal/warn.js"),N=re.DEV,G=re.fail,F=re.warnOnce,Z=D("packages/core/src/internal/predicates.js").isFunction,z="*";function x(k){const y=k.value||{};if(!Z(y.compute))return{computed:!1,wholeRow:!1,deps:[],pure:!0};const m=y.pure!==!1;return y.deps===z?{computed:!0,wholeRow:!0,deps:[],pure:m}:Array.isArray(y.deps)?{computed:!0,wholeRow:!1,deps:y.deps.slice(),pure:m}:(F(`deps:missing:${k.id}`,`computed column "${k.id}" declares no \`value.deps\`; treating it as \`deps: '*'\` (a whole-row dependency). Declare the dependencies to get precise invalidation.`),{computed:!0,wholeRow:!0,deps:[],pure:m})}function Y(k){const y=new Map;for(const f of k)y.set(f.id,f);const c=new Map,m=new Map,s=new Set,t=new Set,o=new Set,u=new Set;for(const f of k){const h=x(f);if(!h.computed){c.set(f.id,[]);continue}t.add(f.id),(h.pure?o:u).add(f.id),h.wholeRow&&s.add(f.id);const l=[],b=[];for(const a of h.deps)(y.has(a)?l:b).push(a);c.set(f.id,l),b.length&&m.set(f.id,b)}for(const f of o)for(const h of c.get(f))u.has(h)&&G(`pure computed column "${f}" depends on impure column "${h}". Mark it \`value.pure: false\` or make the dependency pure.`);const d=[],i=new Map,g=[],r=f=>{const h=i.get(f);if(h!=="done"){if(h==="open"){const l=g.indexOf(f);G(`circular column dependency: ${[...g.slice(l),f].join(" → ")}`)}i.set(f,"open"),g.push(f);for(const l of c.get(f)||[])y.has(l)&&r(l);g.pop(),i.set(f,"done"),d.push(f)}};for(const f of k)r(f.id);const n=new Map;for(const f of k)n.set(f.id,[]);for(const f of k)for(const h of c.get(f.id)||[]){const l=n.get(h);l&&!l.includes(f.id)&&l.push(f.id)}if(s.size)for(const f of k){if(t.has(f.id))continue;const h=n.get(f.id);for(const l of s)h.includes(l)||h.push(l)}return{order:d,dependents:n,pure:o,impure:u,computed:t,deps:c,wholeRow:s,external:m,index:y}}function $(k,y){const c=Array.isArray(y)?y:[y],m=new Set,s=[...c];for(;s.length;){const t=s.shift();for(const o of k.dependents.get(t)||[])m.has(o)||(m.add(o),s.push(o))}for(const t of c)m.delete(t);return k.order.filter(t=>m.has(t))}function j(k,y,c){if(!N)return k;const m=y instanceof Set?y:new Set(y);return new Proxy(k,{get(s,t){return typeof t=="string"&&!m.has(t)&&!Object.hasOwn(s,t)&&F(`undeclared:${c}:${t}`,`computed column "${c}" read undeclared dependency "${t}". Add it to \`value.deps\` or the value will go stale.`),s[t]}})}}),He("packages/core/src/model/rowkey.js",function(e,D){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"compositeKey",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createRowKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"warnMissingKeys",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"groupPathKey",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"splitPathKey",{enumerable:!0,get:function(){return t}});const N=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/internal/paths.js").pathGetter,L=D("packages/core/src/internal/predicates.js"),Z=L.isFunction,z=L.isBlank,x=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],Y="";function $(o){if(o===null)return"\0n";if(o===void 0)return"\0u";const u=typeof o;if(u==="string")return o;if(u==="number"||u==="bigint"||u==="boolean")return String(o);if(o instanceof Date)return`\0d${o.getTime()}`;try{return`\0o${JSON.stringify(o)}`}catch{return"\0o?"}}function j(o){if(o.length===1)return $(o[0]);let u="";for(let d=0;d<o.length;d++)d&&(u+=Y),u+=$(o[d]);return u}function k(o,u={}){const d=u.warn!==!1;if(Z(o)){const i=o;return{stable:!0,fields:[],disabled:[],key(g,r){try{const n=i(g);return Array.isArray(n)?j(n):$(n)}catch(n){return N("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",n),`#${r??-1}`}},keyEmpty(g){try{const r=i(g);return Array.isArray(r)?r.length===0||r.some(z):z(r)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(o)&&o.length>0){const i=o.filter(n=>typeof n=="string"),g=i.map(n=>F(n)),r=g.length;return{stable:!0,fields:i,disabled:[],key(n){const f=new Array(r);for(let h=0;h<r;h++)f[h]=g[h](n);return j(f)},keyEmpty(n){for(let f=0;f<r;f++)if(z(g[f](n)))return!0;return!1},missingFields(n){const f=[];for(let h=0;h<r;h++)z(g[h](n))&&f.push(i[h]);return f}}}if(typeof o=="string"&&o.length>0){const i=F(o);return{stable:!0,fields:[o],disabled:[],key(g){return $(i(g))},keyEmpty(g){return z(i(g))},missingFields(g){return z(i(g))?[o]:[]}}}return d&&N("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${x.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:x.slice(),key(i,g){if(i===null||typeof i!="object")return`#${g??0}:${String(i)}`;let r=y.get(i);return r===void 0&&(r=`#${c++}`,y.set(i,r)),r}}}const y=new WeakMap;let c=0;function m(o,u){if(!o||o.stable===!1||!Z(o.keyEmpty)||!Array.isArray(u)||u.length===0)return;let d=0,i=null,g;for(let h=0;h<u.length;h++){const l=u[h];o.keyEmpty(l)&&(d++,i===null&&(i=Z(o.missingFields)?o.missingFields(l):[],g=l))}if(d===0)return;const r=o.fields.length?o.fields.join(","):"(function)",n=i&&i.length?i.join(", "):o.fields.length?o.fields.join(", "):"the rowKey function",f=g!==null&&typeof g=="object"?Object.keys(g).join(", ")||"(no fields)":String(g);N(`rowKey.emptyValue:${r}`,`rowKey ${n} is missing on ${d} of ${u.length} rows; the first such row has: ${f}. Rows without a key value collapse onto one key, so selection, edits and rows.apply updates land on whichever row now shares it. Set rowKey to a field present on every row, or fix the source data.`)}function s(o){return j(o)}function t(o){return o.split(Y)}}),He("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 y}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"Lookup",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"toValueArray",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createLookup",{enumerable:!0,get:function(){return o}});const re=D("packages/core/src/internal/compare.js"),N=re.collator,G=re.defaultCompare,F=D("packages/core/src/internal/predicates.js"),L=F.isFunction,Z=F.isNil,x=D("packages/core/src/internal/warn.js").warnOnce,$=D("packages/core/src/model/rowkey.js").compositeKey,j=", ",k="";function y(u,d,i,g){if(u===null||typeof u!="object")return{id:u,label:u==null?"":String(u)};const r=u[d],n=u[i],f={id:r,label:n==null?String(r??""):String(n)};u.disabled&&(f.disabled=!0),u.variant&&(f.variant=u.variant),u.icon&&(f.icon=u.icon);const h=g?u[g]:u.group;return h!==void 0&&(f.group=h),f}function c(u,d,i=0,g=[],r=[]){for(const n of u||[]){const f=n&&typeof n=="object"?n[d]:null;if(r.push({raw:n,depth:i,path:g}),Array.isArray(f)&&f.length){const h=String(n&&typeof n=="object"?n.label??n.name??n.id??"":n);c(f,d,i+1,[...g,h],r)}}return r}function m(u){return!!u&&typeof u=="object"&&!Array.isArray(u)&&L(u.router&&u.router.subscribe)}class s{#e;#t;#n;#r;#i=[];#s=new Map;#o=new Map;#l=0;#a="idle";#c=null;#u;#f=null;#d=new Map;constructor(d,i={}){this.#e=d||{},this.#t=i.colId||"?",this.#n=i.locale,this.#r=i.onChange||null,this.#u=N(this.#n),Array.isArray(this.#e.options)?this.#h(this.#e.options):this.#e.options===void 0&&(this.#a="ready")}get colId(){return this.#t}get version(){return this.#l}get state(){return this.#a}get ready(){return this.#a==="ready"}get multiple(){return this.#e.multiple===!0}get separator(){return this.#e.separator??j}get allowCustom(){return this.#e.allowCustom===!0}get sortBy(){return this.#e.sortBy||"label"}get spec(){return this.#e}options(){return this.#i}setLocale(d){this.#n=d,this.#u=N(d)}#h(d){const i=this.#e,g=i.valueKey||"id",r=i.labelKey||"label",n=i.childrenKey||"children";this.#i=c(d,n).map(f=>{const h=y(f.raw,g,r,i.groupKey);return f.depth&&(h.depth=f.depth,h.path=f.path),h}),this.#s=new Map,this.#o=new Map,this.#i.forEach((f,h)=>{this.#s.set(f.id,f),this.#o.set(f.id,h)}),this.#a="ready",this.#l+=1}load(){if(this.#c)return this.#c;const d=this.#e.options;if(Array.isArray(d)||d===void 0)return this.#c=Promise.resolve(this.#i),this.#c;if(m(d))return this.#c=this.#p(d),this.#c;if(!L(d))return x(`lookup:options:${this.#t}`,`column "${this.#t}" has an invalid \`lookup.options\`; expected an array, a function, or a router route`),this.#a="ready",this.#c=Promise.resolve([]),this.#c;this.#a="loading";let i;try{i=d()}catch(g){return this.#a="error",x(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,g),this.#c=Promise.resolve([]),this.#c}return!i||!L(i.then)?(this.#h(i),this.#c=Promise.resolve(this.#i),this.#r&&this.#r(this),this.#c):(this.#c=i.then(g=>(this.#h(g),this.#r&&this.#r(this),this.#i),g=>(this.#a="error",x(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,g),[])),this.#c)}refresh(){return this.#c=null,Array.isArray(this.#e.options)?(this.#h(this.#e.options),this.#r&&this.#r(this),Promise.resolve(this.#i)):this.load()}#p(d){if(this.#f)return Promise.resolve(this.#i);const i=this.#e,g=i.valueKey||"id",r=i.labelKey||"label",n=i.groupKey,f=L(d.map)?d.map:null,h=b=>y(f?f(b):b,g,r,n).id,l=b=>this.#m(b,f,g,r,n);return d.router.subscribe(d.predicate,l,{rowKey:h}),this.#f=()=>{L(d.router.detach)&&d.router.detach(l)},this.#a="ready",Promise.resolve(this.#i)}#m(d,i,g,r,n){const f=d&&d.add||[],h=d&&d.update||[],l=d&&d.remove||[];if(!(!f.length&&!h.length&&!l.length)){for(const b of f)this.#g(b,i,g,r,n);for(const b of h)this.#g(b,i,g,r,n);for(const b of l){if(!this.#d.has(b))continue;const a=this.#d.get(b);this.#d.delete(b),this.#s.delete(a);const p=this.#i.findIndex(w=>w.id===a);p>=0&&this.#i.splice(p,1)}this.#o=new Map(this.#i.map((b,a)=>[b.id,a])),this.#a="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(d,i,g,r,n){const f=y(i?i(d):d,g,r,n);this.#d.set($([f.id]),f.id);const h=this.#i.findIndex(l=>l.id===f.id);h>=0?this.#i[h]=f:this.#i.push(f),this.#s.set(f.id,f)}destroy(){this.#f&&(this.#f(),this.#f=null)}search(d,i){const g=this.#e;if(!L(g.search)){const f=String(d||"").toLowerCase();return Promise.resolve(f===""?this.#i:this.#i.filter(h=>h.label.toLowerCase().includes(f)))}const r=g.valueKey||"id",n=g.labelKey||"label";return Promise.resolve(g.search(d,i)).then(f=>(f||[]).map(h=>y(h,r,n,g.groupKey)))}option(d){return this.#s.get(d)}has(d){return this.#s.has(d)}label(d){if(Z(d)||d==="")return"";const i=this.#s.get(d);if(i)return i.label;if(this.#a==="loading"||this.#a==="idle")return"";this.allowCustom||x(`lookup:unknown:${this.#t}`,`column "${this.#t}" holds value ${JSON.stringify(d)} which is not in its lookup options. Showing the raw value; set \`lookup.unknownLabel\` or \`lookup.allowCustom\` to change that.`);const g=this.#e.unknownLabel;return L(g)?String(g(d)??""):typeof g=="string"?g:String(d)}text(d){if(this.multiple){const i=t(d);return i.length===0?"":i.map(g=>this.label(g)).join(this.separator)}return this.label(d)}dictionary(){return this.#i.map(d=>d.id)}sorted(){const d=this.sortBy;if(d==="optionOrder"||d==="count")return this.#i.slice();if(d==="value")return this.#i.slice().sort((g,r)=>G(g.id,r.id));const i=this.#u;return this.#i.slice().sort((g,r)=>i.compare(g.label,r.label))}comparator(){const d=this.sortBy,i=this.multiple,g=this.#u,r=this.#o;if(i&&d==="count")return(f,h)=>t(f).length-t(h).length;const n=i?f=>t(f)[0]:f=>f;return d==="value"?(f,h)=>G(n(f),n(h)):d==="optionOrder"?(f,h)=>{const l=r.has(n(f))?r.get(n(f)):Number.MAX_SAFE_INTEGER,b=r.has(n(h))?r.get(n(h)):Number.MAX_SAFE_INTEGER;return l-b}:(f,h)=>{const l=n(f),b=n(h);return Z(l)?Z(b)?0:1:Z(b)?-1:g.compare(this.label(l),this.label(b))}}groupKey(d){return this.multiple?t(d).map(g=>String(g)).sort().join(k):Z(d)?"":String(d)}countValues(d){return this.multiple?t(d).length:Z(d)?0:1}contains(d,i,g){const r=this.multiple?t(d):Z(d)?[]:[d],n=Array.isArray(i)?i:[i];switch(g){case"containsAll":return n.every(f=>r.includes(f));case"containsNone":return!n.some(f=>r.includes(f));default:return n.some(f=>r.includes(f))}}exportText(d,i="label"){return i==="value"?this.multiple?t(d).join(this.separator):Z(d)?"":String(d):this.text(d)}exportColumns(){const d=this.multiple;return this.#i.map(i=>({id:i.id,label:i.label,has:g=>d?t(g).includes(i.id):g===i.id}))}}function t(u){return Array.isArray(u)?u:Z(u)||u===""?[]:[u]}function o(u,d={}){const i=u.lookup;if(!i)return null;const g=new s(i,{colId:u.id,locale:d.locale,onChange:d.onChange});return!Array.isArray(i.options)&&i.options!==void 0&&g.load(),g}}),He("packages/core/src/columns/value.js",function(e,D){"use strict";Object.defineProperty(e,"compileDisplay",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"warnImpureUse",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ValuePipeline",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return u}});const N=D("packages/core/src/internal/paths.js").getPath,G=D("packages/core/src/internal/predicates.js"),F=G.isFunction,L=G.isNil,Z=G.isObject,x=D("packages/core/src/internal/lru.js").Lru,$=D("packages/core/src/internal/warn.js").warnOnce,k=D("packages/core/src/format/number.js").compileNumber,c=D("packages/core/src/columns/graph.js").depsProxy,m="\0";function s(r,n={}){const f=n.locale,h=n.grid??null,l=n.context,b=r.value&&r.value.format,a=r.formatter||null,p=r.dataType&&r.dataType.format,w=r.lookup||null,v=(P,V,W)=>({value:P,data:W,row:V,column:r,colId:r.id,grid:h,context:l,locale:f});if(F(b))return(P,V,W)=>{const K=b(v(P,V,W));return K==null?"":String(K)};if(a){if(w){const P=a.kind==="text";return(V,W,K)=>a(P?w.text(V):V,v(V,W,K))}return(P,V,W)=>a(P,v(P,V,W))}if(F(p))return(P,V,W)=>{const K=p(v(P,V,W));return K==null?"":String(K)};if(r.dataType&&r.dataType.base==="number"&&Z(r.typeOptions)&&typeof r.typeOptions.decimals=="number"){const P=k({decimals:r.typeOptions.decimals},f);return V=>P(V)}return w?P=>w.text(P):P=>L(P)?"":typeof P=="string"?P:String(P)}function t(r,n){!r||!r.value||r.value.pure!==!1||$(`impure:${n}:${r.id}`,`column "${r.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${n}. The result is not stable across passes.`)}class o{#e;#t;#n;#r;#i;#s;#o=new x(4096);constructor(n){this.#e=n.columns instanceof Map?n.columns:new Map((n.columns||[]).map(f=>[f.id,f])),this.#t=n.graph,this.#n=n.grid??null,this.#r=n.context,this.#s=n.stored||null,this.#i=n.rowKey||u}get graph(){return this.#t}setGraph(n){this.#t=n,this.#o.clear()}beginPass(){this.#o.clear()}endPass(){this.#o.clear()}invalidate(n){if(this.#o.size===0)return;const f=n&&n.rows?new Set([...n.rows].map(String)):null,h=n&&n.columns?[...n.columns]:null;if(!f&&!h){this.#o.clear();return}const l=h?this.#l(h):null;for(const b of[...this.#o.keys()]){const a=String(b).split(m);a.length===3&&(f&&!f.has(a[0])||l&&!l.has(a[2])||this.#o.delete(b))}}#l(n){const f=new Set,h=this.#t,l=[...n];for(;l.length;){const b=l.pop();if(!f.has(b)){f.add(b);for(const a of h?h.dependents.get(b)||[]:[])l.push(a)}}return f}value(n,f,h){const l=typeof n=="string"?this.#e.get(n):n;if(!l)return;if(!l.computed)return this.#c(l,f,h);if(l.value.pure!==!1&&this.#s&&h&&h.physical!=null&&this.#s.has(l.id))return this.#s.get(l.id,h.physical);if(l.volatile)return this.compute(l,f,h);if(l.value.pure===!1)return this.compute(l,f,h);const b=`${this.#a(f,h)}${m}${l.id}`;if(this.#o.has(b))return this.#o.get(b);const a=this.compute(l,f,h);return this.#o.set(b,a),a}#a(n,f){return`${this.#i(n,f)}${m}${d(n)}`}#c(n,f,h){if(this.#s&&h&&h.physical!=null&&this.#s.has(n.id))return this.#s.get(n.id,h.physical);if(n.field)return n.read?n.read(f):N(f,n.field)}compute(n,f,h){const l=this.#t,b=l&&l.wholeRow.has(n.id);let a;if(b)a=f??{};else{a={};const w=l&&l.deps.get(n.id)||[];for(const P of w)a[P]=this.value(P,f,h);const v=l&&l.external.get(n.id)||[];for(const P of v)a[P]=N(f,P);a=c(a,[...w,...v],n.id)}const p={data:f,row:h,column:n,grid:this.#n,context:this.#r};return n.value.compute(a,p)}values(n,f){const h={},l=this.#t?this.#t.order:[...this.#e.keys()];for(const b of l)h[b]=this.value(b,n,f);return h}text(n,f,h){const l=typeof n=="string"?this.#e.get(n):n;return l?l.formatValue(this.value(l,f,h),h,f):""}key(n,f,h){const l=typeof n=="string"?this.#e.get(n):n;if(!l)return"";const b=this.value(l,f,h);return F(l.value.key)?String(l.value.key(this.#u(l,b,f,h))):l.lookup?l.lookup.groupKey(b):L(b)?"":String(b)}quickFilterText(n,f,h){const l=typeof n=="string"?this.#e.get(n):n;if(!l)return"";if(F(l.value.quickFilterText)){const b=this.value(l,f,h);return String(l.value.quickFilterText(this.#u(l,b,f,h))??"")}return this.text(l,f,h)}#u(n,f,h,l){return{value:f,data:h,row:l,column:n,colId:n.id,grid:this.#n,context:this.#r}}parse(n,f,h,l){const b=typeof n=="string"?this.#e.get(n):n;if(!b)return f;const a={text:f,value:this.value(b,h,l),data:h,row:l,column:b,grid:this.#n,context:this.#r,locale:this.#n&&F(this.#n.get)?this.#n.get("locale"):void 0,formulaFunctions:this.#n&&F(this.#n.get)?this.#n.get("formulaFunctions"):void 0};return F(b.value.parse)?b.value.parse(a):b.dataType&&F(b.dataType.parse)?b.dataType.parse(a):f}validate(n,f,h,l,b){const a=typeof n=="string"?this.#e.get(n):n;if(!a||!F(a.edit.validate))return!0;const p=a.edit.validate({value:f,oldValue:h,data:l,row:b,column:a,grid:this.#n,context:this.#r});return p===!0||p===void 0?!0:String(p)}apply(n,f,h,l){const b=typeof n=="string"?this.#e.get(n):n;if(!b)return!1;const a=this.value(b,h,l);if(F(b.value.apply)){const p=b.value.apply({value:f,oldValue:a,data:h,row:l,column:b,grid:this.#n,context:this.#r});return this.#f(b,h,l),p!==!1}return b.field?a===f?!1:(b.write(h,f),this.#f(b,h,l),!0):($(`apply:${b.id}`,`column "${b.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(n,f,h,l){const b=typeof n=="string"?this.#e.get(n):n;if(!b)return{ok:!1,value:void 0,oldValue:void 0,changed:!1,error:"unknown column"};const a=this.value(b,h,l),p=this.parse(b,f,h,l),w=this.validate(b,p,a,h,l);if(w!==!0)return{ok:!1,value:p,oldValue:a,changed:!1,error:w};const v=this.apply(b,p,h,l);return{ok:!0,value:p,oldValue:a,changed:v}}#f(n,f,h){if(this.#o.size===0)return;const l=this.#a(f,h);this.#o.delete(`${l}${m}${n.id}`);for(const b of this.#t?this.#t.dependents.get(n.id)||[]:[])this.#o.delete(`${l}${m}${b}`)}}function u(r,n){return n&&n.key!=null?String(n.key):d(r)}function d(r){if(r&&typeof r=="object"){let n=i.get(r);return n===void 0&&(n=`#${g++}`,i.set(r,n)),n}return String(r)}const i=new WeakMap;let g=0}),He("packages/core/src/model/shadow.js",function(e,D){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return F}}),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 Z}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"CLUSTER_SHADOW_KINDS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"DEFAULT_ANOMALY_THRESHOLD",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"SPEC_STATUS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"POSITIONAL_KINDS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"SHADOW_LABELS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"specStatusOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ShadowTracker",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"shadowsIn",{enumerable:!0,get:function(){return n}});const N=D("packages/core/src/internal/warn.js").warnOnce,G=2e5,F=20,L=1e3,Z=50;function z(f){return Math.min(L,Math.max(Z,Math.floor(f)))}const x=Object.freeze(["updates","updatedAt","sinceUpdate","delta","deltaPercent","rate","history","firstValue","streak","rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag","specStatus","rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta","fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD","cluster","clusterDistance"]),Y=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),$=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),j=Object.freeze(["cluster","clusterDistance"]),k=.6745,y=3.5,c=Object.freeze({PASS:"PASS",WARN:"WARN",FAIL:"FAIL"}),m=Object.freeze(["rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag"]),s=Object.freeze({updates:"Updates",updatedAt:"Updated at",sinceUpdate:"Since update",delta:"Change",deltaPercent:"Change %",rate:"Rate of change",history:"History",firstValue:"Baseline",streak:"Streak",rank:"Rank",rankAsc:"Rank, ascending",rankChange:"Rank change",percentile:"Percentile",quartile:"Quartile",zScore:"Z-score",shareOfTotal:"Share of total",anomalyScore:"Anomaly score",anomalyFlag:"Anomaly",specStatus:"Spec status",rollingSum:"Rolling sum",rollingAvg:"Rolling average",rollingMin:"Rolling minimum",rollingMax:"Rolling maximum",windowCoverage:"Window coverage",cumulativeToDate:"Cumulative to date",periodOverPeriod:"Period over period",rollingQuantile:"Rolling quantile",windowApproximate:"Window approximate",tsTrend:"Trend",tsSeasonal:"Seasonal",tsResidual:"Seasonal residual",tsCoverage:"Decomposition coverage",tsSmoothed:"Smoothed",tsSmoothingAlpha:"Smoothing α",tsSmoothingBeta:"Smoothing β",fitPredicted:"Predicted",fitResidual:"Residual",fitInfluence:"Influence",fitStdResidual:"Std. residual",fitLeverage:"Leverage",fitCooksD:"Cook's D",cluster:"Cluster",clusterDistance:"Cluster distance"});function t(f,h){if(!h)return null;const l=Number.isFinite(Number(h.lower))?Number(h.lower):null,b=Number.isFinite(Number(h.upper))?Number(h.upper):null;if(l===null&&b===null||!Number.isFinite(f))return null;if(l!==null&&f<l||b!==null&&f>b)return c.FAIL;const a=Number.isFinite(Number(h.warnLower))?Number(h.warnLower):null,p=Number.isFinite(Number(h.warnUpper))?Number(h.warnUpper):null;return a!==null&&f<a||p!==null&&f>p?c.WARN:c.PASS}function o(f,h,l){if(!h||typeof h!="object")return null;if(h.kind!=="time")return h.kind!==void 0&&N(`shadow.history.window.kind:${f}`,`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 b=h.minutes!=null?Number(h.minutes)*6e4:Number(h.span);if(!(b>0))return N(`shadow.history.window.span:${f}`,"a 'history' shadow's time window needs a positive 'span' (ms) or 'minutes'; it had none, so it reported the original, unwindowed history."),null;const a=Math.max(2,Math.floor(l)||F);return{span:b,bucketMs:Math.max(1,Math.floor(b/a))}}class u{#e;#t=new Map;#n=new Map;#r=new Map;#i=new Map;#s=new Map;#o=new Map;#l=0;#a;#c;#u;#f;#d=new Map;#h=null;#p=null;#m=null;constructor(h){this.#e=h.colId,this.#a=Math.max(2,h.depth||F),this.#c=Math.max(1,h.max||G),this.#u=h.now||(()=>Date.now()),this.#f=o(this.#e,h.historyWindow,this.#a),this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#f}observe(h,l){const b=r(l);if(b===null)return;if(!this.#n.has(h)){this.#p=null,this.#m=null,this.#g(),this.#t.set(h,b),this.#n.set(h,b),this.#r.set(h,0),this.#i.set(h,this.#u()),this.#s.set(h,[b]),this.#f&&this.#d.set(h,[b]),this.#o.set(h,0);return}const a=this.#n.get(h);if(a===b)return;this.#p=null,this.#m=null,this.#n.set(h,b),this.#r.set(h,(this.#r.get(h)||0)+1),this.#i.set(h,this.#u());const p=this.#s.get(h)||[];p.push(b),p.length>this.#a&&p.splice(0,p.length-this.#a),this.#s.set(h,p);const w=Math.sign(b-a),v=this.#o.get(h)||0;this.#o.set(h,Math.sign(v)===w?v+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.#i.delete(h),this.#s.delete(h),this.#d.delete(h),this.#o.delete(h),this.#l++)}rebase(){for(const[h,l]of this.#n)this.#t.set(h,l);this.#p=null,this.#m=null}reset(){this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#i.clear(),this.#s.clear(),this.#d.clear(),this.#o.clear(),this.#l=0,this.#p=null,this.#m=null,this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}retain(h){const l=h instanceof Set?h:new Set(h);let b=0;for(const a of[...this.#n.keys()])l.has(a)||(this.#t.delete(a),this.#n.delete(a),this.#r.delete(a),this.#i.delete(a),this.#s.delete(a),this.#d.delete(a),this.#o.delete(a),b++);return b&&(this.#p=null,this.#m=null),b}advanceHistoryWindow(h=this.#u()){const l=this.#f;if(!l)return 0;const b=Math.floor(h/l.bucketMs),a=b-this.#h;if(!(a>0))return 0;const p=Math.min(a,this.#a);for(const[w,v]of this.#d){const P=this.#n.get(w);for(let V=0;V<p;V++)v.push(P);v.length>this.#a&&v.splice(0,v.length-this.#a)}return this.#h=b,a}read(h,l,b,a){switch(h){case"updates":return this.#r.has(l)?this.#r.get(l):0;case"updatedAt":{const p=this.#i.get(l);return p===void 0?null:new Date(p)}case"sinceUpdate":{const p=this.#i.get(l);return p===void 0?null:this.#u()-p}case"firstValue":return this.#t.has(l)?this.#t.get(l):null;case"delta":return this.#n.has(l)?this.#n.get(l)-this.#t.get(l):null;case"deltaPercent":{if(!this.#n.has(l))return null;const p=this.#t.get(l);return p?(this.#n.get(l)-p)/Math.abs(p)*100:null}case"rate":{const p=this.#s.get(l),w=this.#i.get(l);if(!p||p.length<2||w===void 0)return null;const v=this.#u()-w,P=p[p.length-1]-p[p.length-2];return v>0?P/v*1e3:P}case"history":return this.#f?this.#d.has(l)?[...this.#d.get(l)]:null:this.#s.has(l)?[...this.#s.get(l)]:null;case"streak":return this.#o.has(l)?this.#o.get(l):0;case"specStatus":return this.#n.has(l)?t(this.#n.get(l),a):null;default:return m.includes(h)?this.#O(h,l,b,a):null}}#b(h){if(h){if(this.#m&&this.#m.only===h)return this.#m.view;const l=this.#y(h);return this.#m={only:h,view:l},l}return this.#p?this.#p:(this.#p=this.#y(null),this.#p)}#y(h){const l=[];for(const[R,S]of this.#n)h&&!h.has(R)||l.push(S);const b=l.sort((R,S)=>R-S);let a=0,p=0,w=0,v=0;for(const R of b){v+=R,a++;const S=R-p;p+=S/a,w+=S*(R-p)}const P=[];for(const[R,S]of this.#t)h&&!h.has(R)||P.push(S);const V=a?d(b):0,W=b.map(R=>Math.abs(R-V)).sort((R,S)=>R-S),K=a?d(W):0;return{sorted:b,baseline:P.sort((R,S)=>R-S),sum:v,mean:a?p:0,sd:a>1?Math.sqrt(w/(a-1)):0,median:V,mad:K}}#O(h,l,b,a){if(!this.#n.has(l)||b&&!b.has(l))return null;const p=this.#n.get(l),w=this.#b(b),v=w.sorted.length;if(!v)return null;switch(h){case"rank":return v-g(w.sorted,p)+1;case"rankAsc":return i(w.sorted,p)+1;case"rankChange":{if(!this.#t.has(l)||!w.baseline.length)return null;const P=w.baseline.length-g(w.baseline,this.#t.get(l))+1,V=v-g(w.sorted,p)+1;return P-V}case"percentile":return g(w.sorted,p)/v*100;case"quartile":{const P=g(w.sorted,p)/v;return Math.min(4,Math.max(1,Math.ceil(P*4)))}case"zScore":return w.sd?(p-w.mean)/w.sd:null;case"anomalyScore":return w.mad?k*(p-w.median)/w.mad:null;case"anomalyFlag":{if(!w.mad)return null;const P=a&&Number.isFinite(Number(a.threshold))?Number(a.threshold):y;return Math.abs(k*(p-w.median)/w.mad)>P}case"shareOfTotal":return w.sum?p/w.sum*100:null;default:return null}}}function d(f){const h=f.length;if(!h)return 0;const l=(h-1)*.5,b=Math.floor(l),a=Math.ceil(l);return b===a?f[b]:f[b]+(l-b)*(f[a]-f[b])}function i(f,h){let l=0,b=f.length;for(;l<b;){const a=l+b>>1;f[a]<h?l=a+1:b=a}return l}function g(f,h){let l=0,b=f.length;for(;l<b;){const a=l+b>>1;f[a]<=h?l=a+1:b=a}return l}function r(f){if(f==null||f==="")return null;if(f instanceof Date){const l=f.getTime();return Number.isFinite(l)?l:null}const h=typeof f=="number"?f:Number(f);return Number.isFinite(h)?h:null}function n(f){const h=[];for(const l of f||[]){const b=l.shadow;if(!b)continue;const a=typeof b=="string"?{kind:b}:b,p=a.kind;x.includes(p)&&(Y.includes(p)||$.includes(p)||j.includes(p)||h.push({colId:l.id||l.field,of:a.of||l.field||l.id,kind:p,depth:a.depth,historyWindow:p==="history"?a.window:void 0}))}return h}}),He("packages/core/src/columns/model.js",function(e,D){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return je}});const re=D("packages/core/src/internal/merge.js"),N=re.expand,G=re.merge,F=re.toArray,L=D("packages/core/src/internal/warn.js"),Z=L.fail,z=L.warnOnce,x=D("packages/core/src/internal/paths.js"),Y=x.getPath,$=x.pathGetter,j=x.pathSetter,y=D("packages/core/src/internal/text.js").humanise,c=D("packages/core/src/internal/predicates.js"),m=c.isFunction,s=c.isObject,o=D("packages/core/src/internal/uid.js").uid,d=D("packages/core/src/format/index.js").compileFormat,i=D("packages/core/src/columns/datatypes.js"),g=i.comparatorFor,r=i.createTypeRegistry,n=i.storageKind,f=D("packages/core/src/columns/infer.js"),h=f.inferColumnType,l=f.DEFAULT_SAMPLE,b=D("packages/core/src/columns/graph.js"),a=b.buildGraph,p=b.affectedBy,v=D("packages/core/src/columns/lookup.js").createLookup,P=D("packages/core/src/columns/value.js"),V=P.compileDisplay,W=P.ValuePipeline,K=P.warnImpureUse,R=D("packages/core/src/model/shadow.js"),S=R.FIT_SHADOW_KINDS,E=R.CLUSTER_SHADOW_KINDS,O=Object.freeze({geometry:"geometry",list:"list"}),M={value:{pure:!0},cell:{},edit:{enabled:!1},sort:{enabled:!0,direction:null,order:0,nullsFirst:!1},filter:{enabled:!0,type:"text"},group:{enabled:!1,index:-1,explode:!1},pivot:{enabled:!1,index:-1},total:null,layout:{width:150,min:40,max:null,flex:0,pin:null,hidden:!1,resizable:!0,movable:!0,lockVisible:!1,lockPosition:!1},header:{},facet:{},export:{lookup:"label",csv:!0,excel:!0},allowGroup:!0,allowPivot:!0,allowTotal:!0,nullable:!0,quickFilter:!0},T={centre:"center"},A=new Set(["start","center","end","left","right"]);function I(de){if(typeof de!="string")return;const oe=de.toLowerCase();return T[oe]?T[oe]:A.has(oe)?oe:void 0}function U(de){if(typeof de!="string")return;const oe=de.toLowerCase();return oe==="center"||oe==="centre"?"middle":oe==="top"||oe==="middle"||oe==="bottom"?oe:void 0}const X=["cell","layout","header"];function q(de){if(!s(de))return{};const oe={...de},he=(ce,me)=>{if(de[ce]===void 0)return;const ye=N(de[ce],me);ye&&X.includes(ce)&&!s(de[ce])&&delete ye.enabled,oe[ce]=ye};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 _(de,oe){const he={...de||{}},ce=s(oe)&&s(oe.layout)&&oe.layout.width!==void 0;return he.fit==="content"&&!ce&&delete he.width,he}const H=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 te(de,oe,he,ce){const me=he==="columnGroup"?"column group":"column";for(const ye of Object.keys(de))if(!oe.has(ye)){if(ye==="timeZone"&&he==="column"){z("column.timeZone",`\`timeZone\` is not a column option, so it had no effect on column "${ce}". A date column stores, displays, sorts and filters in the grid-level \`timeZone\` (else the viewer's); set \`timeZone\` on the grid, not the column.`);continue}z(`${he}.unknown:${ye}`,`'${ye}' is not a configuration key this grid recognises, so it had no effect on ${me} "${ce}". Check the spelling against the reference.`)}}function J(de){s(de.cell)&&de.cell.autoHeight!==void 0&&z("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${de.id||de.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function ne(de,oe){const he=oe&&m(de.defaultsFor)?de.defaultsFor(oe):null,ce={...de.defaults||{},...s(he)?he:{}},me={};return ce.align&&(me.align=ce.align,me.cell={align:ce.align},me.header={align:ce.align}),ce.filter&&(me.filter=ce.filter==="none"?{enabled:!1,type:"none"}:{enabled:!0,type:ce.filter}),ce.editor&&(me.edit=ce.editor==="none"?{editor:null}:{editor:ce.editor}),ce.total&&(me.total=ce.total),ce.render&&(me.cell={...me.cell||{},render:ce.render}),de.export&&(me.export={...de.export}),me}function se(de){if(typeof de=="string")return de.trim()?[de.trim()]:[];if(!Array.isArray(de))return[];const oe=[];for(const he of de){if(typeof he!="string")continue;const ce=he.trim();ce&&!oe.includes(ce)&&oe.push(ce)}return oe}class ae{#e=new Map;#t=[];#n=[];#r=new WeakMap;#i;#s;#o;#l;#a;#c;#u(oe,he,ce){if(oe&&typeof oe=="object"&&!m(oe)){const Se=oe;return(typeof Se.fn!="string"||!Se.fn)&&Z(`column "${ce}": a total given as an object needs a \`fn\` name, such as { fn: 'percentile', p: 0.9 }.`),Se.fn==="percentile"&&!(typeof Se.p=="number"&&Se.p>=0&&Se.p<=1)&&Z(`column "${ce}": { fn: 'percentile' } needs \`p\`, a number from 0 to 1 (0.9 for the 90th percentile).`),this.#f(Se.fn,he,ce),Object.freeze({...Se})}const me=this.#f(oe,he,ce);if(typeof me!="string"||!this.#d)return me??null;const ye=he&&he.totals&&he.totals.implement;if(ye&&m(ye[me])){const Se=ye[me];return Se.totalName=me,Se}const xe=this.#d.totalFn?.(me);return m(xe)?xe:me}#f(oe,he,ce){if(typeof oe!="string")return oe;const me=he&&he.totals&&he.totals.supported;if(!Array.isArray(me)||me.includes(oe))return oe;const ye=me.length?me.join(", "):"none";return Z(`column "${ce}" is typed ${he.name||"a type"}, for which the total "${oe}" is not meaningful. Supported: ${ye}. Aggregating it anyway would produce a confident wrong number.`),oe}#d;#h;#p;#m;#g;#b;#y=!1;#O;#w;constructor(oe={}){this.#s=q(oe.columnDefaults||{}),this.#o=oe.columnPresets||{},this.#a=oe.locale,this.#l=oe.timeZone,this.#c=U(oe.verticalAlign),this.#d=oe.registry||null,this.#h=oe.grid||null,this.#p=oe.context,this.#O=oe.sampleSize??l,this.#w=oe.onChange||null,this.#b=m(oe.rowKey)?oe.rowKey:void 0,this.#i=r(oe.dataTypes,this.#d);const{leaves:he,groups:ce}=je(oe.columns||[]);this.#n=ce;for(const me of he){me.facet!==void 0&&this.#r.set(me.def,me.facet);const ye=this.#A(me.def,null);if(ye.groupPath=me.path,this.#e.has(ye.id)){z(`columns.duplicate:${ye.id}`,`two columns resolve to the id '${ye.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}me.column=ye,this.#e.set(ye.id,ye),this.#t.push(ye.id)}this.#P(oe.stored||null)}#A(oe,he){te(oe,H,"column",oe.id||oe.field||"(unnamed)"),J(oe);const ce=q(oe),me=F(oe.preset),ye=me.map(Le=>{const ze=this.#o[Le];return ze?q(ze):(z(`preset:${Le}`,`unknown column preset "${Le}"; ignoring`),{})}),xe=this.#S(ce,ye,he),Se=this.#i.get(xe)||this.#i.get("text");if(!this.#i.has(xe)&&oe.type){const Le=O[xe];z(`type:${xe}`,`unknown data type "${xe}"; falling back to "text"`+(Le?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${Le}'.`:""))}const Te=m(Se.items)?this.#C(ce,ye,oe.id||oe.field||"(unnamed)"):null;let Be=M;Be=G(Be,this.#s),oe.type!==!1&&(Be=G(Be,ne(Se,Te)));for(const Le of ye)Be=G(Be,Le);this.#r.has(oe)&&(Be=G(Be,q({facet:this.#r.get(oe)}))),Be=G(Be,ce);const Ee=Be.edit;Ee&&Ee.editor&&Ee.enabled!==!0&&!m(Ee.enabled)&&(oe.edit||{}).editor&&z(`column.editor-not-enabled:${oe.id||oe.field}`,`column '${oe.id||oe.field}' names the editor '${Ee.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const Ge=oe.id||oe.field||o("col");if(oe.shadow&&!m(Be.value&&Be.value.compute)){const Le=typeof oe.shadow=="string"?{kind:oe.shadow}:oe.shadow,ze=Le.of||oe.field||Ge,Ye=S.includes(Le.kind),et=E.includes(Le.kind),tt=Ye?Le.model||Le:null,pt=Ye&&tt?[...Array.isArray(tt.predictors)?tt.predictors:[],tt.response].filter(Boolean):null,Tt=et?(Array.isArray(Le.columns)?Le.columns:[]).filter(Boolean):null;Be.value={...Be.value||{},deps:Tt&&Tt.length?Tt:pt&&pt.length?pt:Le.orderBy&&Le.orderBy!==ze?[ze,Le.orderBy]:[ze],pure:!1,compute:(Rt,ot)=>{const lt=ot.grid&&ot.grid.statistics;if(!lt)return null;const ht=ot.row&&ot.row.key||lt.keyOf(ot.data);if(!ht)return null;if(Ye){if(!m(lt.fitShadow))return null;const Nt=Le.model?{...Le.model,threshold:Le.threshold}:Le;return lt.fitShadow(Le.kind,ht,Nt)}return et?m(lt.clusterShadow)?lt.clusterShadow(Le.kind,ht,Le):null:lt.shadow(ze,Le.kind,ht,Le.scope,Le)}}}if(oe.running&&!m(Be.value&&Be.value.compute)){const Le=typeof oe.running=="string"?{kind:oe.running}:oe.running,ze=Le.of||oe.field||Ge;Be.value={...Be.value||{},deps:[ze],pure:!1,compute:(Ye,et)=>{const tt=et.grid&&et.grid.statistics;if(!tt||!m(tt.running))return null;const pt=et.row&&et.row.key||tt.keyOf(et.data);return pt?tt.running(ze,Le.kind||"total",pt):null}},oe.sort===void 0&&(Be.sort={...Be.sort||{},enabled:!1})}const Ne=oe.field??(m(Be.value&&Be.value.compute)?null:oe.id??null),ke=m(Be.value&&Be.value.compute),Oe={id:Ge,field:Ne,shadow:oe.shadow||null,running:oe.running||null,spec:oe.spec||null,validation:oe.validation||null,volatile:!!(oe.shadow||oe.running),title:Be.title??y(Ne||Ge),type:Se.name,dataType:Se,itemType:Te,nullable:Be.nullable!==!1,align:I(ce.cell&&ce.cell.align||ce.align||Be.cell&&Be.cell.align||Be.align||Se.defaults&&Se.defaults.align)||"start",verticalAlign:U(ce.cell&&ce.cell.verticalAlign||ce.verticalAlign||Be.cell&&Be.cell.verticalAlign||Be.verticalAlign)||this.#c,rowSpan:m(Be.rowSpan)?Be.rowSpan:null,colSpan:m(Be.colSpan)?Be.colSpan:null,value:{pure:!0,...Be.value||{}},cell:{...Be.cell||{}},edit:{...Be.edit||{}},sort:{...Be.sort||{}},filter:{...Be.filter||{}},group:{enabled:!1,index:-1,explode:!1,...Be.group||{}},pivot:{enabled:!1,index:-1,...Be.pivot||{}},total:this.#u(Be.total,Se,oe.id||oe.field||"(unnamed)"),groupTotal:Be.groupTotal===void 0?null:this.#u(Be.groupTotal,Se,oe.id||oe.field||"(unnamed)"),grandTotal:Be.grandTotal===void 0?null:this.#u(Be.grandTotal,Se,oe.id||oe.field||"(unnamed)"),tags:se(Be.tags),typeOptions:Be.typeOptions??null,...s(Be[xe])?{[xe]:Be[xe]}:{},layout:_(Be.layout,ce),header:{...Be.header||{}},contextMenu:Be.contextMenu===void 0?null:Be.contextMenu,facet:{...Be.facet||{}},export:{...Be.export||{}},allowGroup:Be.allowGroup!==!1,allowPivot:Be.allowPivot!==!1,allowTotal:Be.allowTotal!==!1,quickFilter:Be.quickFilter!==!1,def:oe,format:Be.format,presets:me,inferred:he!=null&&!oe.type,computed:ke,diff:oe.diff===void 0?void 0:!!oe.diff,read:Ne?$(Ne):null,write:Ne?j(Ne):null};Oe.cell.align=I(ce.cell&&ce.cell.align)||Oe.align,Oe.header.align=I(ce.header&&ce.header.align)||Oe.align;const Re=Be.lookup||null;return Oe.lookup=Re?v({id:Ge,lookup:Re},{locale:this.#a,onChange:()=>{this.#w&&this.#w("lookup",{colId:Ge})}}):null,Oe.group.explode&&Oe.lookup&&Oe.lookup.multiple&&z(`explode:${Ge}`,`column "${Ge}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(Oe),Oe}#v(oe){oe.formatter=d(oe.format,oe.dataType,this.#a,this.#l,oe.id),oe.formatValue=V(oe,{locale:this.#a,grid:this.#h,context:this.#p}),oe.itemCompare=oe.itemType?g(oe.itemType,this.#a):null,oe.compare=m(oe.value.compare)?oe.value.compare:oe.lookup?oe.lookup.comparator():m(oe.dataType.compareFor)?oe.dataType.compareFor(oe):g(oe.dataType,this.#a),oe.excel=oe.formatter&&oe.formatter.ooxml||oe.dataType&&oe.dataType.excel||"General",oe.storeKind=n(oe.dataType,!!(oe.lookup&&oe.lookup.multiple))}#C(oe,he,ce){let me=s(oe.typeOptions)?oe.typeOptions:null;for(let Te=he.length-1;!me&&Te>=0;Te--)s(he[Te].typeOptions)&&(me=he[Te].typeOptions);!me&&s(this.#s.typeOptions)&&(me=this.#s.typeOptions);const ye=me&&me.of!==void 0?me.of:"text",xe=typeof ye=="string"?this.#i.get(ye):void 0;return xe&&!m(xe.items)&&xe.storage!=="object"?xe:(z(`type:of:${String(ye)}`,`column "${ce}" names "${String(ye)}" as its item type (typeOptions.of), which is not ${xe?"a scalar data type":"a known data type"}; its items are read as text.`),this.#i.get("text"))}#S(oe,he,ce){if(oe.type===!1)return"text";if(oe.type)return oe.type;for(let me=he.length-1;me>=0;me--)if(he[me].type)return he[me].type;if(this.#s.type)return this.#s.type;if(oe.shadow){const me=typeof oe.shadow=="string"?oe.shadow:oe.shadow.kind;if(me==="fitInfluence")return"boolean";if(me==="fitPredicted"||me==="fitResidual"||me==="fitStdResidual"||me==="fitLeverage"||me==="fitCooksD"||me==="tsTrend"||me==="tsSeasonal"||me==="tsResidual"||me==="tsCoverage"||me==="tsSmoothed"||me==="tsSmoothingAlpha"||me==="tsSmoothingBeta"||me==="cluster"||me==="clusterDistance")return"number"}return ce||(oe.lookup?"lookup":"text")}#P(oe){const he=this.all();this.#m=a(he),this.#g?this.#g.setGraph(this.#m):this.#g=new W({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:oe||null,rowKey:this.#b});const ce=this.#g;for(const me of he)me.getValue=(ye,xe)=>ce.value(me,ye,xe)}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 ce=[];for(const me of he)Array.isArray(me.columns)?ce.push({...me,columns:oe(me.columns)}):me.column&&ce.push(me.column);return ce};return oe(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#i}affectedBy(oe){return p(this.#m,oe)}value(oe,he,ce){return this.#g.value(oe,he,ce)}text(oe,he,ce){return this.#g.text(oe,he,ce)}checkImpure(oe,he){K(this.#e.get(oe),he)}setLocale(oe){this.#a=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 ce=!1;for(const me of this.all()){const ye=me.def;if(ye.type!==void 0||!me.field||me.computed||me.lookup||this.#E(me))continue;const xe=me.read||(Be=>Y(Be,me.field)),Se=h(me.id,oe,xe,this.#i,{sampleSize:this.#O});if(Se===me.type)continue;he[me.id]=Se;const Te=this.#A(ye,Se);Te.groupPath=me.groupPath,Te.layout={...Te.layout,...we(me.layout)},this.#e.set(me.id,Te),Pe(this.#n,me.id,Te),ce=!0}return ce&&this.#P(null),he}redecorate(oe,he,ce={}){const me=this.#e.get(oe);if(!me){z(`redecorate:${oe}`,`columns.decorate('${oe}', …): no column with id '${oe}'.`);return}const ye=me.def||{},xe={...s(ye.cell)?ye.cell:{}};xe.decoration=he??void 0,ce&&"variant"in ce&&(xe.variant=ce.variant);const Se={...ye,cell:xe};this.#r.has(ye)&&this.#r.set(Se,this.#r.get(ye));const Te=this.#A(Se,me.type);return Te.groupPath=me.groupPath,Te.layout={...Te.layout,...we(me.layout)},me.lookup&&me.lookup!==Te.lookup&&m(me.lookup.destroy)&&me.lookup.destroy(),this.#e.set(oe,Te),Pe(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&&m(oe.lookup.destroy)&&oe.lookup.destroy()}#E(oe){for(const he of oe.presets){const ce=this.#o[he];if(ce&&ce.type)return!0}return!!this.#s.type}#T(oe){return!oe.computed&&m(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,ce={timeZone:this.#l,colId:oe.id,itemType:oe.itemType||null};return me=>he(oe.read(me),ce)}return oe.read}storeValue(oe,he){if(!(!oe||oe.computed)&&m(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 ce=this.storeReader(he);let me=null;!he.computed&&!this.#T(he)&&typeof he.field=="string"&&!he.lookup&&(me=he.field);const ye={id:he.id,kind:he.storeKind,nullable:he.nullable,read:ce};me!==null&&(ye.field=me),he.lookup&&(ye.dictionary=he.lookup.dictionary()),oe.push(ye)}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?fe(oe.cell.decoration):void 0,variant:oe.cell&&oe.cell.variant!=null?fe(oe.cell.variant):void 0}))}applyState(oe,he={}){const ce={applied:[],skipped:[]},me=Array.isArray(oe)?oe:oe&&oe.columns||[],ye=!Array.isArray(oe)&&oe&&oe.columnOrder||null;for(const Se of me){if(!Se||!Se.id){ce.skipped.push({key:"?",reason:"no id"});continue}let Te=this.#e.get(Se.id);if(!Te){ce.skipped.push({key:Se.id,reason:"unknown column"});continue}if(Object.hasOwn(Se,"decoration")||Object.hasOwn(Se,"variant")){const Be=Te.cell?Te.cell.decoration:void 0,Ee=Se.decoration??null,Ge=Object.hasOwn(Se,"variant"),Ne=Ge&&!ge(Te.cell?Te.cell.variant:void 0,Se.variant);(!ge(Be,Ee)||Ne)&&(this.redecorate(Se.id,Ee,Ge?{variant:Se.variant??void 0}:{}),Te=this.#e.get(Se.id)||Te)}Se.width!=null&&(Te.layout.width=Se.width),Se.flex!=null&&(Te.layout.flex=Se.flex),Se.hidden!=null&&(Te.layout.hidden=!!Se.hidden),Se.headerWrap!==void 0&&(Te.header.wrap=!!Se.headerWrap),Se.headerOrientation!==void 0&&(Te.header.orientation=Se.headerOrientation==="vertical"?"vertical":"horizontal"),Se.pin!==void 0&&(Te.layout.pin=Se.pin),Se.sort!==void 0&&(Te.sort.direction=Se.sort),Se.sortIndex!=null&&(Te.sort.order=Se.sortIndex),Se.groupIndex!=null&&(Te.group.enabled=!0,Te.group.index=Se.groupIndex),Se.pivotIndex!=null&&(Te.pivot.enabled=!0,Te.pivot.index=Se.pivotIndex),Se.total!==void 0&&(Te.total=Se.total),Se.groupTotal!==void 0&&(Te.groupTotal=Se.groupTotal),Se.grandTotal!==void 0&&(Te.grandTotal=Se.grandTotal),ce.applied.push(Se.id)}const xe=ye||(he&&he.keepOrder?[]:me.map(Se=>Se&&Se.id).filter(Boolean));if(xe.length){const Se=xe.filter(Be=>this.#e.has(Be)),Te=this.#t.filter(Be=>!Se.includes(Be));this.#t=[...Se,...Te]}return this.#w&&this.#w("state",ce),ce}move(oe,he){this.#N(oe,he)&&(this.#R(),this.#w&&this.#w("move",{id:oe,to:he}))}reorder(oe){const he={applied:[],skipped:[]},ce=[];let me=0;for(const ye of Array.isArray(oe)?oe:[]){const xe=me++;this.#N(ye,xe)&&(he.applied.push(ye),ce.push({id:ye,to:xe}))}if(!ce.length)return he;if(this.#R(),this.#w)for(const ye of ce)this.#w("move",ye);return he}#N(oe,he){const ce=this.#t.indexOf(oe);if(ce===-1||Math.max(0,Math.min(Number(he)||0,this.#t.length-1))===ce)return!1;const ye=this.#e.get(oe);if(ye.layout.movable===!1||ye.layout.lockPosition)return z(`move:${oe}`,`column "${oe}" is not movable; the move was ignored`),!1;const xe=this.#M(oe,he);return xe?(z(`move.married:${xe}`,`band "${xe}" declares marryChildren, so its columns stay together; the move was ignored`),!1):(this.#t.splice(ce,1),this.#t.splice(Math.max(0,Math.min(he,this.#t.length)),0,oe),!0)}#M(oe,he){if(!this.#n||!this.#n.length)return null;const ce=this.#t.filter(Se=>Se!==oe),me=Math.max(0,Math.min(he,ce.length)),ye=(Se,Te)=>{if(Array.isArray(Se.columns)){for(const Ee of Se.columns)ye(Ee,Te);return Te}const Be=Se.column?Se.column.id:Se.id;return Be&&Te.push(Be),Te},xe=Se=>{for(const Te of Se){if(!Array.isArray(Te.columns))continue;if(Te.marryChildren===!0){const Ee=ye(Te,[]),Ge=Ee.includes(oe),Ne=Ee.map(ke=>ce.indexOf(ke)).filter(ke=>ke>=0);if(Ne.length){const ke=Math.min(...Ne),Oe=Math.max(...Ne);if(Ge?me<ke||me>Oe+1:me>ke&&me<=Oe)return Te.id}}const Be=xe(Te.columns);if(Be)return Be}return null};return xe(this.#n)}#R(){const oe=new Map(this.#t.map((me,ye)=>[me,ye])),he=me=>{if(!Array.isArray(me.columns)){const xe=me.column?me.column.id:me.id;return oe.has(xe)?oe.get(xe):1/0}let ye=1/0;for(const xe of me.columns)ye=Math.min(ye,he(xe));return ye},ce=me=>{me.sort((ye,xe)=>he(ye)-he(xe));for(const ye of me)Array.isArray(ye.columns)&&ce(ye.columns)};ce(this.#n)}#I(oe){const he=ce=>{for(let me=0;me<ce.length;me++){const ye=ce[me];if(Array.isArray(ye.columns)){const xe=he(ye.columns);if(xe)return xe}else if(ye.column&&ye.column.id===oe)return ce.splice(me,1)[0]}return null};return he(this.#n)}#V(oe){const he=[];for(let ce=oe.length-1;ce>=0;ce--){const me=oe[ce];Array.isArray(me.columns)&&(he.push(...this.#V(me.columns)),me.columns.length===0&&(he.push(me.id),oe.splice(ce,1)))}return he}#W(){const oe=(he,ce,me)=>{for(const ye of he)Array.isArray(ye.columns)?oe(ye.columns,[...ce,ye.id]):ye.column&&(ye.column.groupPath=ce)};oe(this.#n,[])}#x(oe){const he=new Set(oe),ce=this.#t.filter(Se=>he.has(Se));if(!ce.length)return;const me=Math.min(...ce.map(Se=>this.#t.indexOf(Se))),ye=this.#t.slice(0,me).filter(Se=>!he.has(Se)),xe=this.#t.slice(me).filter(Se=>!he.has(Se));this.#t=[...ye,...ce,...xe]}#q(oe){const he=[],ce=me=>{if(Array.isArray(me.columns))for(const ye of me.columns)ce(ye);else me.column&&he.push(me.column.id)};return ce(oe),he}#U(oe){const he=ce=>{for(const me of ce){if(!Array.isArray(me.columns))continue;if(me.id===oe)return{node:me,parent:ce};const ye=he(me.columns);if(ye)return ye}return null};return he(this.#n)}groupColumns(oe,he={}){const ce=F(oe).filter(Te=>this.#e.has(Te));if(!ce.length)return z("columns.group.empty","groupColumns was given no known column ids; nothing was grouped."),null;for(const Te of ce)if(this.#e.get(Te).layout.lockPosition)return z(`columns.group.locked:${Te}`,`column "${Te}" is position-locked and cannot be grouped.`),null;const me=he.groupId?this.#U(he.groupId):null;if(he.groupId&&!me)return z(`columns.group.unknown:${he.groupId}`,`no band "${he.groupId}" to add to; nothing was grouped.`),null;let ye=null;if(!me&&he.id!=null&&(ye=String(he.id),this.#U(ye)||this.#e.has(ye)))return z(`columns.group.idtaken:${ye}`,`band id "${ye}" is already in use; nothing was grouped.`),null;const xe=ce.map(Te=>this.#I(Te)).filter(Boolean);if(!xe.length)return null;let Se;if(me)me.node.columns.push(...xe),Se=me.node.id;else{const Te={id:ye||o("grp"),title:he.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:xe},Be=Number.isInteger(he.at)?Math.max(0,Math.min(he.at,this.#n.length)):this.#n.length;this.#n.splice(Be,0,Te),Se=Te.id}return this.#V(this.#n),this.#x(ce),this.#W(),this.#R(),this.#w&&this.#w("columngroup",{action:"formed",groupId:Se,ids:ce}),Se}ungroupColumn(oe){const he=this.#e.get(oe);if(!he){z(`columns.ungroup.unknown:${oe}`,`no column "${oe}" to ungroup.`);return}const ce=he.groupPath||[];if(!ce.length)return;const me=ce[ce.length-1],ye=this.#U(me);if(!ye)return;const xe=this.#I(oe);if(!xe)return;const Se=ye.parent.indexOf(ye.node);ye.parent.splice(Se+1,0,xe);const Te=this.#V(this.#n),Be=this.#q(ye.node);if(Be.length){this.#x(Be);const Ee=Math.max(...Be.map(Ne=>this.#t.indexOf(Ne))),Ge=this.#t.filter(Ne=>Ne!==oe);Ge.splice(Ee+1,0,oe),this.#t=Ge}this.#W(),this.#R(),this.#w&&this.#w("columngroup",{action:"removed",id:oe,dissolved:Te})}renameGroup(oe,he){const ce=this.#U(oe);if(!ce){z(`columns.group.rename:${oe}`,`no band "${oe}" to rename.`);return}ce.node.title=String(he??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:oe,title:ce.node.title})}dissolveGroup(oe){const he=this.#U(oe);if(!he){z(`columns.group.dissolve:${oe}`,`no band "${oe}" to dissolve.`);return}const ce=he.parent.indexOf(he.node);he.parent.splice(ce,1,...he.node.columns),this.#W(),this.#R(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:oe})}moveGroup(oe,he){const ce=this.#U(oe);if(!ce){z(`columns.group.move:${oe}`,`no band "${oe}" to move.`);return}const me=ce.parent,ye=me.indexOf(ce.node);ye!==-1&&(me.splice(ye,1),me.splice(Math.max(0,Math.min(he,me.length)),0,ce.node),this.#Y(),this.#W(),this.#w&&this.#w("columngroup",{action:"moved",groupId:oe,to:he}))}#Y(){const oe=[],he=me=>{for(const ye of me)Array.isArray(ye.columns)?he(ye.columns):ye.column&&oe.push(ye.column.id)};he(this.#n);const ce=new Set(oe);this.#t=[...oe,...this.#t.filter(me=>!ce.has(me))]}groupTree(){const oe=ce=>ce.map(me=>Array.isArray(me.columns)?{id:me.id,title:me.title||"",collapsible:!!me.collapsible,openByDefault:me.openByDefault!==!1,columns:oe(me.columns)}:me.column?me.column.id:null).filter(me=>me!==null),he=oe(this.#n);return he.some(ce=>ce&&typeof ce=="object")?he:[]}applyGroupTree(oe){if(!Array.isArray(oe))return;const he=new Set,ce=ye=>{const xe=[];for(const Se of ye)if(Se&&typeof Se=="object"&&Array.isArray(Se.columns)){const Te=ce(Se.columns);if(!Te.length)continue;xe.push({id:Se.id||o("grp"),title:Se.title||"",collapsible:Se.collapsible===!0,openByDefault:Se.openByDefault!==!1,showWhen:"always",marryChildren:!1,header:{},def:{},columns:Te})}else if(typeof Se=="string"){const Te=this.#e.get(Se);Te&&!he.has(Se)&&(he.add(Se),xe.push({column:Te,path:[]}))}return xe},me=ce(oe);for(const ye of this.#t){if(he.has(ye))continue;const xe=this.#e.get(ye);xe&&me.push({column:xe,path:[]})}this.#n=me,this.#W(),this.#R(),this.#w&&this.#w("columngroup",{action:"applied"})}show(oe){this.#G(oe,!1)}hide(oe){this.#G(oe,!0)}#G(oe,he){const ce=[];for(const me of F(oe)){const ye=this.#e.get(me);if(ye){if(he&&ye.layout.lockVisible){z(`lockVisible:${me}`,`column "${me}" is \`layout.lockVisible\` and cannot be hidden`);continue}ye.layout.hidden!==he&&(ye.layout.hidden=he,ce.push(me))}}ce.length&&this.#w&&this.#w("visible",{ids:ce,hidden:he})}pin(oe,he){const ce=this.#e.get(oe);ce&&(ce.layout.pin=he??null,this.#w&&this.#w("pin",{id:oe,side:ce.layout.pin}))}pinMany(oe){const he={};for(const[me,ye]of oe){const xe=this.#e.get(me);xe&&(xe.layout.pin=ye??null,he[me]=xe.layout.pin)}const ce=Object.keys(he);ce.length&&this.#w&&this.#w("pin",{ids:ce,pins:he})}#D(oe,he){const ce=oe.layout.min??0,me=oe.layout.max;let ye=Math.max(ce,he);return me!=null&&(ye=Math.min(me,ye)),oe.layout.width=ye,oe.layout.flex=0,ye}resize(oe,he){const ce=this.#e.get(oe);if(!ce)return;if(ce.layout.resizable===!1){z(`resize:${oe}`,`column "${oe}" is not resizable; the resize was ignored`);return}const me=this.#D(ce,he);this.#w&&this.#w("resize",{id:oe,width:me})}resizeMany(oe){const he={};for(const[me,ye]of oe){const xe=this.#e.get(me);if(xe){if(xe.layout.resizable===!1){z(`resize:${me}`,`column "${me}" is not resizable; the resize was ignored`);continue}he[me]=this.#D(xe,ye)}}const ce=Object.keys(he);ce.length&&this.#w&&this.#w("resize",{ids:ce,widths:he})}}function we(de){const oe={};return de.width!=null&&(oe.width=de.width),de.hidden!=null&&(oe.hidden=de.hidden),de.pin!==void 0&&(oe.pin=de.pin),oe}function fe(de){if(de===null||typeof de!="object")return de;try{return structuredClone(de)}catch{}try{return JSON.parse(JSON.stringify(de))}catch{return de}}function ge(de,oe){const he=de??null,ce=oe??null;if(he===ce)return!0;if(he===null||ce===null)return!1;if(typeof he!="object"||typeof ce!="object")return he===ce;try{return JSON.stringify(he)===JSON.stringify(ce)}catch{return!1}}function je(de){const oe=[],he=(me,ye,xe)=>{const Se=[];for(const Te of me){if(!s(Te)){Z("a column definition must be an object");continue}if(Array.isArray(Te.columns)){te(Te,ee,"columnGroup",Te.title||Te.id||"(unnamed)");const Be={id:Te.id||o("grp"),title:Te.title||"",collapsible:Te.collapsible===!0,openByDefault:Te.openByDefault!==!1,showWhen:Te.showWhen||"always",marryChildren:Te.marryChildren===!0,header:Te.header||{},def:Te,columns:[]};Be.columns=he(Te.columns,[...ye,Be.id],Te.facet!==void 0?Te.facet:xe),Se.push(Be)}else{const Be={def:Te,path:ye,facet:xe};oe.push(Be),Se.push(Be)}}return Se},ce=he(de,[],void 0);return{leaves:oe,groups:ce}}function Pe(de,oe,he){for(const ce of de){if(ce.columns){if(Pe(ce.columns,oe,he))return!0;continue}if(ce.column&&ce.column.id===oe)return ce.column=he,!0}return!1}}),He("packages/core/src/columns/autogroup.js",function(e,D){"use strict";Object.defineProperty(e,"AUTO_GROUP_ID",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createAutoGroupColumn",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"warnOnAbsurdGrouping",{enumerable:!0,get:function(){return Y}});const N=D("packages/core/src/internal/warn.js").warnOnce,G="__lattice_group",F=240,L=.5;function Z($){const j=$.def&&$.def.layout;return(typeof j=="number"||j&&j.width!=null||$.def&&$.def.width!=null)&&Number.isFinite($.layout.width)?$.layout.width:null}function z($){const j=$.def&&$.def.layout;return!!(j&&j.min!=null)||$.def&&$.def.minWidth!=null}function x($){const{columns:j,groupBy:k}=$,y=k.map(u=>j.get(u)).filter(Boolean),c=y.length?y.map(u=>u.title||u.id).join(" > "):"Group",m=y.find(u=>Z(u)!=null),s=$.config&&$.config.autoGroupColumnWidth||(m?Z(m):F);let t=m&&z(m)?m.layout.min:120;m&&!z(m)&&(t=Math.min(t,s));const o=m&&m.layout.max!=null?m.layout.max:null;return{id:G,field:null,title:c,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group"},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!0},groupedIds:k.slice(),group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:s,min:t,max:o,pin:$.config&&$.config.autoGroupColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(u,d){return d&&d.group?d.groupValue:null},formatValue(u,d){if(!d||!d.group)return"";if(d.grandTotal)return $.config&&$.config.grandTotalLabel||"Total";const i=y[Math.min(d.level||0,y.length-1)];return i&&typeof i.formatValue=="function"?i.formatValue(u,d):u==null?"":String(u)}}}function Y($,j,k){!$.length||k<100||j<k*L||N(`grouping.cardinality:${$.join(",")}`,`grouping by ${$.join(", ")} produced ${j} groups for ${k} rows: nearly one group per row. Grouping a continuous value such as a percentage or a timestamp rarely reads usefully; consider a computed banding column.`)}}),He("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 G}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return F}});const re="__lattice_select",N=44;function G(L){const Z=L.selection||{},z=L.config&&L.config.selectionColumnWidth||N;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:z,min:z,max:z,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:Z.headerCheckbox===!0,def:{},getValue(x,Y){return Y?Y.selected:!1},formatValue(){return""}}}const F=G}),He("packages/core/src/columns/rownumbercolumn.js",function(e,D){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createRowNumberColumn",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Y}});const N=D("packages/core/src/internal/predicates.js").isFunction,G="__lattice_rownumber",F=40,L=9,Z=22;function z($){const j=String(Math.max(1,Math.trunc(Math.abs($))||1)).length;return Math.max(F,j*L+Z)}function x($){const j=$.rowNumbers,k=j&&typeof j=="object"?j:{},y=Number.isFinite(k.start)?k.start:1,c=Number.isFinite(k.width)?k.width:z(($.maxNumber||0)+y),m=N($.rank)?$.rank:()=>null;return{id:G,field:null,title:typeof k.title=="string"?k.title:"",type:"number",dataType:{base:"number"},nullable:!0,align:"end",generated:!0,control:!0,value:{pure:!0},cell:{align:"end"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:c,min:c,max:c,pin:"start",hidden:!1,resizable:k.width==null,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(s,t){const o=m(t);return o==null?null:o-1+y},formatValue(s){return s==null?"":String(s)}}}const Y=x}),He("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 Z}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"DetailModel",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Y}});const N=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/warn.js").warnOnce,L=240,Z=10;function z($){if(!$)return null;const j=$===!0?{}:$;return j.enabled===!1?null:!N(j.rows)&&!j.render?(F("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:N(j.rows)?j.rows:null,height:j.height??L,maxHeight:j.maxHeight??null,cacheLimit:Number.isFinite(j.cacheLimit)?Math.max(0,j.cacheLimit):Z,isMaster:N(j.isMaster)?j.isMaster:null,target:j.target||null,onCreate:N(j.onCreate)?j.onCreate:null,path:typeof j.path=="string"?j.path:null}}class x{#e;#t=new Set;#n;#r=0;constructor(j){this.#e=j.config,this.#n=N(j.onChange)?j.onChange:()=>{}}get config(){return this.#e}get inline(){return!this.#e.target}isMaster(j){if(!j||j.group||j.detail)return!1;const k=this.#e.isMaster;return k?!!k(j.data,j):!0}isOpen(j){return this.#t.has(j)}keys(){return[...this.#t]}activeKey(){for(const j of this.#t)return j;return null}heightOf(j){const k=this.#e.height;return N(k)?Number(k(j))||L:k==="auto"?L:Number(k)||L}open(j){return this.#t.has(j)?!1:(this.inline||this.#t.clear(),this.#t.add(j),this.#i(),!0)}close(j){return this.#t.delete(j)?(this.#i(),!0):!1}toggle(j){return this.#t.has(j)?(this.close(j),!1):(this.open(j),!0)}closeAll(){this.#t.size&&(this.#t.clear(),this.#i())}prune(j){if(!this.#t.size||!N(j))return;let k=!1;for(const y of[...this.#t])j(y)||(this.#t.delete(y),k=!0);k&&this.#i()}signature(){return`${this.#r}`}set(j){this.#t.clear();const k=Array.isArray(j)?j:[];for(const y of this.inline?k:k.slice(0,1))this.#t.add(y);this.#i()}#i(){this.#r++,this.#n()}}const Y=x}),He("packages/core/src/compute/special.js",function(e,D){"use strict";Object.defineProperty(e,"logGamma",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"incompleteBeta",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"normalQuantile",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"normalCdf",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"studentT",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"chiSquareUpperTail",{enumerable:!0,get:function(){return s}});const re=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),N=3e-12,G=1e-300;function F(t){if(t<.5)return Math.log(Math.PI/Math.sin(Math.PI*t))-F(1-t);const o=t-1;let u=.9999999999998099;const d=o+7.5;for(let i=0;i<re.length;i++)u+=re[i]/(o+i+1);return .5*Math.log(2*Math.PI)+(o+.5)*Math.log(d)-d+Math.log(u)}function L(t,o,u){const d=t+o,i=t+1,g=t-1;let r=1,n=1-d*u/i;Math.abs(n)<G&&(n=G),n=1/n;let f=n;for(let h=1;h<=300;h++){const l=2*h;let b=h*(o-h)*u/((g+l)*(t+l));n=1+b*n,Math.abs(n)<G&&(n=G),r=1+b/r,Math.abs(r)<G&&(r=G),n=1/n,f*=n*r,b=-(t+h)*(d+h)*u/((t+l)*(i+l)),n=1+b*n,Math.abs(n)<G&&(n=G),r=1+b/r,Math.abs(r)<G&&(r=G),n=1/n;const a=n*r;if(f*=a,Math.abs(a-1)<N)break}return f}function Z(t,o,u){if(!(t>0)||!(o>0)||!Number.isFinite(u))return Number.NaN;if(u<=0)return 0;if(u>=1)return 1;const d=Math.exp(F(t+o)-F(t)-F(o)+t*Math.log(u)+o*Math.log(1-u));return u<(t+1)/(t+o+2)?d*L(t,o,u)/t:1-d*L(o,t,1-u)/o}function z(t){if(!(t>0)||!(t<1))return t===0?-1/0:t===1?1/0:Number.NaN;const o=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],u=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],d=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],i=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],g=.02425;let r,n,f;t<g?(r=Math.sqrt(-2*Math.log(t)),f=(((((d[0]*r+d[1])*r+d[2])*r+d[3])*r+d[4])*r+d[5])/((((i[0]*r+i[1])*r+i[2])*r+i[3])*r+1)):t<=1-g?(r=t-.5,n=r*r,f=(((((o[0]*n+o[1])*n+o[2])*n+o[3])*n+o[4])*n+o[5])*r/(((((u[0]*n+u[1])*n+u[2])*n+u[3])*n+u[4])*n+1)):(r=Math.sqrt(-2*Math.log(1-t)),f=-(((((d[0]*r+d[1])*r+d[2])*r+d[3])*r+d[4])*r+d[5])/((((i[0]*r+i[1])*r+i[2])*r+i[3])*r+1));const l=(.5*x(-f/Math.SQRT2)-t)*Math.sqrt(2*Math.PI)*Math.exp(f*f/2);return f-l/(1+f*l/2)}function x(t){const o=Math.abs(t),u=2/(2+o),d=4*u-2,i=[-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 g=0,r=0,n;for(let h=i.length-1;h>0;h--)n=r,r=d*r-g+i[h],g=n;const f=u*Math.exp(-o*o+.5*(i[0]+d*r)-g);return t>=0?f:2-f}function Y(t){return .5*x(-t/Math.SQRT2)}function $(t,o){if(!(o>0)||!Number.isFinite(t))return Number.NaN;const u=.5*Z(o/2,.5,o/(o+t*t));return t>0?1-u:u}function j(t,o){if(!(t>0)||!(t<1)||!(o>0))return Number.NaN;if(o>1e7)return z(t);let u=-1e4,d=1e4,i=z(t);const g=F(o/2)+F(.5)-F((o+1)/2);for(let r=0;r<60;r++){const n=$(i,o);n<t?u=i:d=i;const f=Math.exp(-((o+1)/2)*Math.log(1+i*i/o)-g)/Math.sqrt(o),h=f>0?(n-t)/f:0;if(Math.abs(h)<1e-12)break;const l=i-h;if(i=l>u&&l<d&&Number.isFinite(l)?l:(u+d)/2,d-u<1e-12)break}return i}function k(t,o){let u=t,d=1/t,i=d;for(let g=0;g<300&&(u+=1,i*=o/u,d+=i,!(Math.abs(i)<Math.abs(d)*N));g++);return d*Math.exp(-o+t*Math.log(o)-F(t))}function y(t,o){let u=o+1-t,d=1/G,i=1/u,g=i;for(let r=1;r<=300;r++){const n=-r*(r-t);u+=2,i=n*i+u,Math.abs(i)<G&&(i=G),d=u+n/d,Math.abs(d)<G&&(d=G),i=1/i;const f=i*d;if(g*=f,Math.abs(f-1)<N)break}return Math.exp(-o+t*Math.log(o)-F(t))*g}function c(t,o){return!(t>0)||!(o>=0)||!Number.isFinite(o)?Number.NaN:o===0?0:o<t+1?k(t,o):1-y(t,o)}function m(t,o){return o>0?c(o/2,t/2):Number.NaN}function s(t,o){const u=m(t,o);return Number.isNaN(u)?Number.NaN:Math.min(1,Math.max(0,1-u))}}),He("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 N}}),Object.defineProperty(e,"choleskyInverse",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"normalEquations",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return Z}});function re(z){const x=z.length,Y=Array.from({length:x},()=>new Array(x).fill(0));for(let $=0;$<x;$++)for(let j=0;j<=$;j++){let k=z[$][j];for(let y=0;y<j;y++)k-=Y[$][y]*Y[j][y];if($===j){if(!(k>0))return null;Y[$][j]=Math.sqrt(k)}else Y[$][j]=k/Y[j][j]}return Y}function N(z,x){const Y=z.length,$=new Array(Y).fill(0);for(let k=0;k<Y;k++){let y=x[k];for(let c=0;c<k;c++)y-=z[k][c]*$[c];$[k]=y/z[k][k]}const j=new Array(Y).fill(0);for(let k=Y-1;k>=0;k--){let y=$[k];for(let c=k+1;c<Y;c++)y-=z[c][k]*j[c];j[k]=y/z[k][k]}return j}function G(z){const x=z.length,Y=Array.from({length:x},()=>new Array(x).fill(0));for(let $=0;$<x;$++){const j=new Array(x).fill(0);j[$]=1;const k=N(z,j);for(let y=0;y<x;y++)Y[y][$]=k[y]}return Y}function F(z,x,Y){const $=z.length,j=$?z[0].length:0,k=Array.from({length:j},()=>new Array(j).fill(0)),y=new Array(j).fill(0);for(let c=0;c<$;c++){const m=Y?Y[c]:1,s=z[c];for(let t=0;t<j;t++){const o=m*s[t];y[t]+=o*x[c];for(let u=t;u<j;u++)k[t][u]+=o*s[u]}}for(let c=0;c<j;c++)for(let m=0;m<c;m++)k[c][m]=k[m][c];return{xtwx:k,xtwy:y}}function L(z,x){return z.map(Y=>Y.reduce(($,j,k)=>$+j*x[k],0))}function Z(z,x){let Y=0;for(let $=0;$<z.length;$++){let j=0;for(let k=0;k<z.length;k++)j+=x[$][k]*z[k];Y+=z[$]*j}return Y}}),He("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 N}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return k}});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(c){if(!Number.isFinite(c))return;this.#e++;const m=c-this.#t;this.#t+=m/this.#e,this.#n+=m*(c-this.#t)}merge(c){if(c.#e===0)return;if(this.#e===0){this.#e=c.#e,this.#t=c.#t,this.#n=c.#n;return}const m=this.#e+c.#e,s=c.#t-this.#t;this.#t+=s*(c.#e/m),this.#n+=c.#n+s*s*(this.#e*c.#e/m),this.#e=m}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 c=this.variance();return c===null?null:Math.sqrt(c)}stddevP(){const c=this.varianceP();return c===null?null:Math.sqrt(c)}}class N{#e=[];#t=0;#n;#r;constructor(c,m=Math.random){if(!(c>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(c),this.#r=m}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(c){if(!Number.isFinite(c))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(c);return}const m=Math.floor(this.#r()*this.#t);m<this.#n&&(this.#e[m]=c)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let c=0;for(const m of this.#e)c+=m;return c/this.#e.length}quantile(c){const m=this.#e.length;if(!m)return null;const s=this.#e.slice().sort((d,i)=>d-i);if(m===1)return s[0];const t=(m-1)*Math.min(1,Math.max(0,c)),o=Math.floor(t),u=Math.ceil(t);return o===u?s[o]:s[o]+(t-o)*(s[u]-s[o])}}function G(y){return y^=y>>>16,y=Math.imul(y,2246822507),y^=y>>>13,y=Math.imul(y,3266489909),y^=y>>>15,y>>>0}function F(y){if(typeof y=="number"){const s=new DataView(new ArrayBuffer(8));return s.setFloat64(0,y===0?0:y),G(s.getUint32(0)^s.getUint32(4))}const c=typeof y=="string"?y:String(y);let m=2166136261;for(let s=0;s<c.length;s++)m^=c.charCodeAt(s),m=Math.imul(m,16777619);return G(m)}class L{#e;#t;#n;constructor(c=14){const m=Math.floor(c);if(m<4||m>16)throw new RangeError("HLL precision must be 4..16");this.#e=m,this.#t=1<<m,this.#n=new Uint8Array(this.#t)}static errorBoundFor(c=14){const m=1<<Math.floor(c),s=1.04/Math.sqrt(m);return Object.freeze({kind:"probabilistic",metric:"relative",value:s,statement:`distinct count within ~${(s*100).toFixed(2)}% relative standard error (m=${m} buckets)`})}errorBound(){return L.errorBoundFor(this.#e)}add(c){const m=F(c),s=m&this.#t-1,t=m>>>this.#e|1<<32-this.#e;let o=1,u=t;for(;(u&1)===0;)o++,u>>>=1;o>this.#n[s]&&(this.#n[s]=o)}count(){const c=this.#t,m=32-this.#e,s=new Float64Array(m+2);for(let u=0;u<c;u++)s[this.#n[u]]++;let t=c*x(1-s[m+1]/c);for(let u=m;u>=1;u--)t=.5*(t+s[u]);t+=c*z(s[0]/c);const o=Z*c*c/t;return Math.round(o)}}const Z=.5/Math.log(2);function z(y){if(y===1)return 1/0;let c=1,m=y,s;do y*=y,s=m,m+=y*c,c+=c;while(m!==s);return m}function x(y){if(y===0||y===1)return 0;let c=1,m=1-y,s;do y=Math.sqrt(y),s=m,c*=.5,m-=(1-y)**2*c;while(m!==s);return m/3}class Y{#e=new Map;#t;#n=0;constructor(c){if(!(c>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(c)}errorBoundFor(c){const m=c/this.#t;return Object.freeze({kind:"deterministic",metric:"absolute",value:m,statement:`each count overestimates the truth by at most N/m = ${m.toFixed(2)} (N=${c}, m=${this.#t})`})}get seen(){return this.#n}add(c){this.#n++;const m=this.#e.get(c);if(m){m.count++;return}if(this.#e.size<this.#t){this.#e.set(c,{count:1,error:0});return}let s,t=1/0;for(const[o,u]of this.#e)u.count<t&&(t=u.count,s=o);this.#e.delete(s),this.#e.set(c,{count:t+1,error:t})}top(c=this.#t){return[...this.#e.entries()].map(([s,t])=>({item:s,count:t.count,error:t.error})).sort((s,t)=>t.count-s.count).slice(0,Math.max(0,Math.floor(c)))}}class ${#e;#t=[[]];#n=0;#r;#i;constructor(c=200,m=Math.random){this.#e=Math.max(8,Math.floor(c)),this.#r=m,this.#i=2/3}static errorBoundFor(c=200){const m=1/Math.max(8,Math.floor(c));return Object.freeze({kind:"probabilistic",metric:"rank",value:m,statement:`queried quantile's true rank within ~${(m*100).toFixed(2)}% of N of the requested rank (k=${c})`})}errorBound(){return $.errorBoundFor(this.#e)}get count(){return this.#n}#s(c){const s=this.#t.length-1-c,t=Math.ceil(this.#e*this.#i**s);return Math.max(2,t)}add(c){Number.isFinite(c)&&(this.#n++,this.#t[0].push(c),this.#t[0].length>=this.#s(0)&&this.#o(0))}#o(c){const m=this.#t[c];m.sort((o,u)=>o-u),c+1>=this.#t.length&&this.#t.push([]);const s=this.#t[c+1],t=this.#r()<.5?0:1;for(let o=t;o<m.length;o+=2)s.push(m[o]);this.#t[c]=[];for(let o=0;o<this.#t.length;o++)if(this.#t[o].length>=this.#s(o)){this.#o(o);return}}#l(){const c=[];for(let m=0;m<this.#t.length;m++){const s=1<<m;for(const t of this.#t[m])c.push({v:t,w:s})}return c}quantile(c){const m=this.#l();if(!m.length)return null;m.sort((u,d)=>u.v-d.v);let s=0;for(const u of m)s+=u.w;const t=Math.min(1,Math.max(0,c))*s;let o=0;for(const u of m)if(o+=u.w,o>=t)return u.v;return m[m.length-1].v}rank(c){let m=0;for(let s=0;s<this.#t.length;s++){const t=1<<s;for(const o of this.#t[s])o<=c&&(m+=t)}return m}}const j=Object.freeze({distinct:L.errorBoundFor(14),median:$.errorBoundFor(200),p25:$.errorBoundFor(200),p75:$.errorBoundFor(200),p90:$.errorBoundFor(200),p95:$.errorBoundFor(200),p99:$.errorBoundFor(200),iqr:$.errorBoundFor(200),topK:Object.freeze({kind:"deterministic",metric:"absolute",value:0,statement:"each count overestimates the truth by at most N/m; top-K exact when the K-th item exceeds N/m"})}),k={Welford:re,Reservoir:N,HyperLogLog:L,SpaceSaving:Y,KLL:$,hash32:F,SKETCH_BOUNDS:j}}),He("packages/core/src/compute/statistics.js",function(e,D){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"numbers",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"frequencies",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"herfindahl",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"entropy",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"evenness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"topShare",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"gini",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"moments",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"quantileSorted",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"quantile",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"STAT_FNS",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"modifiedZOutliers",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"jarqueBera",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"weightedQuantile",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"covariance",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return de}}),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 ce}}),Object.defineProperty(e,"seriesStats",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"D2_N2",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(e,"D4_N2",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(e,"movingRanges",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"withinSigma",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"countOutside",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(e,"histogram",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(e,"DEFAULT_CONFIDENCE",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(e,"meanInterval",{enumerable:!0,get:function(){return et}}),Object.defineProperty(e,"proportionInterval",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(e,"slopeInterval",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(e,"capabilityInterval",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(e,"standardizedMeanDifference",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(e,"normalTotalVariation",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(e,"frequencyMap",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(e,"categoricalDistance",{enumerable:!0,get:function(){return ht}}),Object.defineProperty(e,"SUBSET_RELIABILITY_FLOOR",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(e,"compareColumn",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(e,"isNumericColumn",{enumerable:!0,get:function(){return be}}),Object.defineProperty(e,"populationRead",{enumerable:!0,get:function(){return Me}});const re=D("packages/core/src/compute/handle.js"),N=re.presenceReader,G=re.valueReader,F=D("packages/core/src/compute/special.js"),L=F.studentTQuantile,Z=F.studentT,z=F.normalQuantile,x=F.normalCdf,Y=F.chiSquareUpperTail,$=D("packages/core/src/compute/linalg.js"),j=$.cholesky,k=$.choleskySolve,y=$.choleskyInverse,c=$.normalEquations,m=$.quadForm,t=D("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,o=5e3,u=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"}),d=Object.freeze({distinct:Object.freeze({sketch:"HyperLogLog",bound:t.distinct}),median:Object.freeze({sketch:"KLL",bound:t.median}),p25:Object.freeze({sketch:"KLL",bound:t.p25}),p75:Object.freeze({sketch:"KLL",bound:t.p75}),p90:Object.freeze({sketch:"KLL",bound:t.p90}),p95:Object.freeze({sketch:"KLL",bound:t.p95}),p99:Object.freeze({sketch:"KLL",bound:t.p99}),iqr:Object.freeze({sketch:"KLL",bound:t.iqr}),top3Share:Object.freeze({sketch:"SpaceSaving",bound:t.topK}),top10Share:Object.freeze({sketch:"SpaceSaving",bound:t.topK})});function i(pe){const Ae=pe==="sum"||pe==="avg"||pe==="countValues"||pe==="min"||pe==="max"?"maintained":Object.prototype.hasOwnProperty.call(u,pe)?u[pe]:null,ve=Object.prototype.hasOwnProperty.call(d,pe)?d[pe]:null;return{stat:pe,exact:Ae,approximate:ve}}function g(pe,Ae){const ve=Ae.length,Ie=new Float64Array(ve);let De=0;if(pe&&(pe.kind==="float64"||pe.kind==="int32")){const _e=pe.values,Ke=N(pe);for(let qe=0;qe<ve;qe++){const st=Ae[qe];if(Ke&&Ke(st)!==1)continue;const ut=_e[st];Number.isNaN(ut)||(Ie[De++]=ut)}return Ie.subarray(0,De)}const Ve=G(pe);for(let _e=0;_e<ve;_e++){const Ke=Ve(Ae[_e]);if(Ke==null||Ke==="")continue;const qe=typeof Ke=="number"?Ke:Number(Ke);Number.isFinite(qe)&&(Ie[De++]=qe)}return Ie.subarray(0,De)}function r(pe,Ae){const ve=new Map,Ie=G(pe);let De=0;for(let Ve=0;Ve<Ae.length;Ve++){const _e=Ie(Ae[Ve]);if(_e==null||_e===""||typeof _e=="number"&&Number.isNaN(_e))continue;const Ke=typeof _e=="object"?String(_e):_e;ve.set(Ke,(ve.get(Ke)||0)+1),De++}const Ce=[...ve.values()].sort((Ve,_e)=>_e-Ve);return{counts:Ce,total:De,distinct:Ce.length}}function n(pe){return pe.total>0?pe.counts.map(Ae=>Ae/pe.total):[]}function f(pe,Ae){const ve=r(pe,Ae);if(!ve.total)return null;let Ie=0;for(const De of n(ve))Ie+=De*De;return Ie}function h(pe,Ae){const ve=r(pe,Ae);if(!ve.total)return null;let Ie=0;for(const De of n(ve))De>0&&(Ie-=De*Math.log2(De));return Ie}function l(pe,Ae){const ve=r(pe,Ae);if(!ve.total||ve.distinct<2)return ve.total?1:null;let Ie=0;for(const De of n(ve))De>0&&(Ie-=De*Math.log2(De));return Ie/Math.log2(ve.distinct)}function b(pe,Ae,ve=3){const Ie=r(pe,Ae);if(!Ie.total)return null;const De=Math.max(1,Math.floor(ve));let Ce=0;for(let Ve=0;Ve<Math.min(De,Ie.counts.length);Ve++)Ce+=Ie.counts[Ve];return Ce/Ie.total}function a(pe,Ae){const ve=g(pe,Ae),Ie=ve.length;if(!Ie)return null;const De=ve.slice().sort();if(De[0]<0)return null;let Ce=0,Ve=0;for(let _e=0;_e<Ie;_e++)Ce+=De[_e],Ve+=(_e+1)*De[_e];return Ce===0?0:2*Ve/(Ie*Ce)-(Ie+1)/Ie}function p(pe){let Ae=0,ve=0,Ie=0;for(let De=0;De<pe.length;De++){const Ce=pe[De];Ae++;const Ve=Ce-ve;ve+=Ve/Ae,Ie+=Ve*(Ce-ve)}return{n:Ae,mean:ve,m2:Ie}}function w(pe,Ae){const ve=pe.length;if(!ve)return NaN;if(ve===1)return pe[0];const Ie=(ve-1)*Math.min(1,Math.max(0,Ae)),De=Math.floor(Ie),Ce=Math.ceil(Ie);return De===Ce?pe[De]:pe[De]+(Ie-De)*(pe[Ce]-pe[De])}function v(pe,Ae){if(!pe.length)return NaN;const ve=pe.slice().sort();return w(ve,Ae)}function P(pe,Ae){const ve=G(pe);let Ie=0,De=0,Ce=0;for(let Ve=0;Ve<Ae.length;Ve++){const _e=ve(Ae[Ve]);if(_e==null||_e==="")continue;const Ke=String(_e).toUpperCase();Ke==="PASS"?Ie++:Ke==="FAIL"?De++:Ke==="WARN"&&Ce++}return{pass:Ie+Ce,fail:De,warn:Ce,judged:Ie+Ce+De}}const V=Object.freeze({hhi:(pe,Ae)=>f(pe,Ae),entropy:(pe,Ae)=>h(pe,Ae),evenness:(pe,Ae)=>l(pe,Ae),top3Share:(pe,Ae)=>b(pe,Ae,3),top10Share:(pe,Ae)=>b(pe,Ae,10),gini:(pe,Ae)=>a(pe,Ae),trimmedMean:(pe,Ae)=>E(g(pe,Ae),.1),winsorizedMean:(pe,Ae)=>O(g(pe,Ae),.1),robustOutliers:(pe,Ae)=>M(g(pe,Ae),3.5),jarqueBera:(pe,Ae)=>T(g(pe,Ae)),variance:(pe,Ae)=>{const{n:ve,m2:Ie}=p(g(pe,Ae));return ve>1?Ie/(ve-1):null},varianceP:(pe,Ae)=>{const{n:ve,m2:Ie}=p(g(pe,Ae));return ve>0?Ie/ve:null},stddev:(pe,Ae)=>{const{n:ve,m2:Ie}=p(g(pe,Ae));return ve>1?Math.sqrt(Ie/(ve-1)):null},stddevP:(pe,Ae)=>{const{n:ve,m2:Ie}=p(g(pe,Ae));return ve>0?Math.sqrt(Ie/ve):null},median:(pe,Ae)=>{const ve=g(pe,Ae);return ve.length?v(ve,.5):null},percentile:(pe,Ae,ve)=>{const Ie=ve?ve.p:void 0;if(typeof Ie!="number"||!(Ie>=0&&Ie<=1))return null;const De=g(pe,Ae);return De.length?v(De,Ie):null},p25:(pe,Ae)=>{const ve=g(pe,Ae);return ve.length?v(ve,.25):null},p75:(pe,Ae)=>{const ve=g(pe,Ae);return ve.length?v(ve,.75):null},p90:(pe,Ae)=>{const ve=g(pe,Ae);return ve.length?v(ve,.9):null},p95:(pe,Ae)=>{const ve=g(pe,Ae);return ve.length?v(ve,.95):null},p99:(pe,Ae)=>{const ve=g(pe,Ae);return ve.length?v(ve,.99):null},iqr:(pe,Ae)=>{const ve=g(pe,Ae);if(!ve.length)return null;const Ie=ve.slice().sort();return w(Ie,.75)-w(Ie,.25)},mad:(pe,Ae)=>{const ve=g(pe,Ae);if(!ve.length)return null;const Ie=v(ve,.5),De=new Float64Array(ve.length);for(let Ce=0;Ce<ve.length;Ce++)De[Ce]=Math.abs(ve[Ce]-Ie);return v(De,.5)},range:(pe,Ae)=>{const ve=g(pe,Ae);if(!ve.length)return null;let Ie=1/0,De=-1/0;for(let Ce=0;Ce<ve.length;Ce++)ve[Ce]<Ie&&(Ie=ve[Ce]),ve[Ce]>De&&(De=ve[Ce]);return De-Ie},distinct:(pe,Ae)=>{const ve=G(pe),Ie=new Set;for(let De=0;De<Ae.length;De++){const Ce=ve(Ae[De]);Ce==null||Ce===""||Ie.add(Ce instanceof Date?Ce.getTime():Ce)}return Ie.size},mode:(pe,Ae)=>{const ve=G(pe),Ie=new Map;for(let Ve=0;Ve<Ae.length;Ve++){const _e=ve(Ae[Ve]);if(_e==null||_e==="")continue;const Ke=_e instanceof Date?_e.getTime():_e;Ie.set(Ke,(Ie.get(Ke)||0)+1)}let De=null,Ce=1;for(const[Ve,_e]of Ie)_e>Ce&&(Ce=_e,De=Ve);return De},skewness:(pe,Ae)=>{const ve=g(pe,Ae),{n:Ie,mean:De,m2:Ce}=p(ve);if(Ie<3||Ce<=0)return null;const Ve=Math.sqrt(Ce/(Ie-1));let _e=0;for(let Ke=0;Ke<ve.length;Ke++)_e+=((ve[Ke]-De)/Ve)**3;return Ie/((Ie-1)*(Ie-2))*_e},kurtosis:(pe,Ae)=>{const ve=g(pe,Ae),{n:Ie,mean:De,m2:Ce}=p(ve);if(Ie<4||Ce<=0)return null;const Ve=Math.sqrt(Ce/(Ie-1));let _e=0;for(let st=0;st<ve.length;st++)_e+=((ve[st]-De)/Ve)**4;const Ke=Ie*(Ie+1)/((Ie-1)*(Ie-2)*(Ie-3)),qe=3*(Ie-1)**2/((Ie-2)*(Ie-3));return Ke*_e-qe},geomean:(pe,Ae)=>{const ve=g(pe,Ae);if(!ve.length)return null;let Ie=0;for(let De=0;De<ve.length;De++){if(ve[De]<=0)return null;Ie+=Math.log(ve[De])}return Math.exp(Ie/ve.length)},harmean:(pe,Ae)=>{const ve=g(pe,Ae);if(!ve.length)return null;let Ie=0;for(let De=0;De<ve.length;De++){if(ve[De]===0)return null;Ie+=1/ve[De]}return ve.length/Ie},sumSquares:(pe,Ae)=>{const ve=g(pe,Ae);let Ie=0;for(let De=0;De<ve.length;De++)Ie+=ve[De]*ve[De];return Ie},passRate:(pe,Ae)=>{const{pass:ve,judged:Ie}=P(pe,Ae);return Ie?ve/Ie:null},failureCount:(pe,Ae)=>P(pe,Ae).fail}),W=Object.freeze({hhi:"Concentration (HHI)",entropy:"Entropy",evenness:"Evenness",top3Share:"Top 3 share",top10Share:"Top 10 share",gini:"Gini coefficient",trimmedMean:"Trimmed mean",winsorizedMean:"Winsorized mean",robustOutliers:"Outliers (robust)",jarqueBera:"Jarque–Bera",median:"Median",percentile:"Percentile",p25:"25th percentile",p75:"75th percentile",p90:"90th percentile",p95:"95th percentile",p99:"99th percentile",iqr:"Interquartile range",mad:"Median absolute deviation",variance:"Variance",varianceP:"Variance (population)",stddev:"Standard deviation",stddevP:"Standard deviation (population)",range:"Range",distinct:"Distinct",mode:"Mode",skewness:"Skewness",kurtosis:"Kurtosis",geomean:"Geometric mean",harmean:"Harmonic mean",sumSquares:"Sum of squares",weightedAvg:"Weighted average",argmin:"Lowest by",argmax:"Highest by",passRate:"Pass rate",failureCount:"Failures"});function K(pe,Ae,ve){const Ie=G(pe),De=G(Ae);let Ce=0,Ve=0;for(let _e=0;_e<ve.length;_e++){const Ke=ve[_e],qe=Number(Ie(Ke)),st=Number(De(Ke));!Number.isFinite(qe)||!Number.isFinite(st)||(Ce+=qe*st,Ve+=st)}return Ve===0?null:Ce/Ve}function R(pe,Ae,ve){const Ie=G(pe);let De=null,Ce=ve?-1/0:1/0;for(let Ve=0;Ve<Ae.length;Ve++){const _e=Ae[Ve],Ke=Number(Ie(_e));Number.isFinite(Ke)&&(ve?Ke>Ce:Ke<Ce)&&(Ce=Ke,De=_e)}return De}function S(pe,Ae,ve){const Ie=G(pe),De=G(Ae);let Ce=0,Ve=0,_e=0,Ke=0,qe=0,st=0;for(let Ot=0;Ot<ve.length;Ot++){const Lt=ve[Ot],Bt=Number(Ie(Lt)),Ct=Number(De(Lt));!Number.isFinite(Bt)||!Number.isFinite(Ct)||(Ce++,Ve+=Bt,_e+=Ct,Ke+=Bt*Bt,qe+=Ct*Ct,st+=Bt*Ct)}if(Ce<2)return null;const ut=Ce*st-Ve*_e,kt=Math.sqrt((Ce*Ke-Ve*Ve)*(Ce*qe-_e*_e));if(kt===0)return null;const Pt=ut/kt;return Math.max(-1,Math.min(1,Pt))}function E(pe,Ae=.1){const ve=pe.length;if(!ve)return null;const Ie=Array.from(pe).sort((_e,Ke)=>_e-Ke),De=Math.floor(ve*Math.min(.49,Math.max(0,Ae))),Ce=Ie.slice(De,ve-De);if(!Ce.length)return w(Ie,.5);let Ve=0;for(const _e of Ce)Ve+=_e;return Ve/Ce.length}function O(pe,Ae=.1){const ve=pe.length;if(!ve)return null;const Ie=Array.from(pe).sort((Ke,qe)=>Ke-qe),De=Math.floor(ve*Math.min(.49,Math.max(0,Ae))),Ce=Ie[De],Ve=Ie[ve-1-De];let _e=0;for(const Ke of Ie)_e+=Math.min(Ve,Math.max(Ce,Ke));return _e/ve}function M(pe,Ae=3.5){if(!pe.length)return null;const Ie=Array.from(pe).sort((Ke,qe)=>Ke-qe),De=w(Ie,.5),Ce=Ie.map(Ke=>Math.abs(Ke-De)).sort((Ke,qe)=>Ke-qe),Ve=w(Ce,.5);if(Ve===0)return null;let _e=0;for(const Ke of Ie)Math.abs(.6745*(Ke-De)/Ve)>Ae&&_e++;return _e}function T(pe){const Ae=pe.length;if(Ae<8)return null;let ve=0;for(const Ke of pe)ve+=Ke;ve/=Ae;let Ie=0,De=0,Ce=0;for(const Ke of pe){const qe=Ke-ve;Ie+=qe*qe,De+=qe*qe*qe,Ce+=qe*qe*qe*qe}if(Ie/=Ae,De/=Ae,Ce/=Ae,Ie===0)return null;const Ve=De/Ie**1.5,_e=Ce/(Ie*Ie)-3;return Ae/6*(Ve*Ve+_e*_e/4)}function A(pe,Ae,ve){const Ie=[];let De=0;for(let Ke=0;Ke<pe.length;Ke++){const qe=Number(pe[Ke]),st=Number(Ae[Ke]);!Number.isFinite(qe)||!Number.isFinite(st)||st<=0||(Ie.push([qe,st]),De+=st)}if(!Ie.length||De<=0)return null;if(Ie.sort((Ke,qe)=>Ke[0]-qe[0]),Ie.length===1)return Ie[0][0];const Ce=[];let Ve=0;for(const[,Ke]of Ie)Ce.push((Ve+Ke/2)/De),Ve+=Ke;const _e=Math.max(0,Math.min(1,ve));if(_e<=Ce[0])return Ie[0][0];if(_e>=Ce[Ce.length-1])return Ie[Ie.length-1][0];for(let Ke=1;Ke<Ce.length;Ke++){if(_e>Ce[Ke])continue;const qe=Ce[Ke]-Ce[Ke-1],st=qe>0?(_e-Ce[Ke-1])/qe:0;return Ie[Ke-1][0]+(Ie[Ke][0]-Ie[Ke-1][0])*st}return Ie[Ie.length-1][0]}function I(pe,Ae,ve){const Ie=G(pe),De=G(Ae),Ce=new Float64Array(ve.length),Ve=new Float64Array(ve.length);let _e=0;for(let Ke=0;Ke<ve.length;Ke++){const qe=ve[Ke],st=Number(Ie(qe)),ut=Number(De(qe));!Number.isFinite(st)||!Number.isFinite(ut)||(Ce[_e]=st,Ve[_e]=ut,_e++)}return{xs:Ce.subarray(0,_e),ys:Ve.subarray(0,_e),n:_e}}function U(pe,Ae,ve,Ie=!1){const{xs:De,ys:Ce,n:Ve}=I(pe,Ae,ve);if(Ve<2)return null;let _e=0,Ke=0;for(let st=0;st<Ve;st++)_e+=De[st],Ke+=Ce[st];_e/=Ve,Ke/=Ve;let qe=0;for(let st=0;st<Ve;st++)qe+=(De[st]-_e)*(Ce[st]-Ke);return qe/(Ie?Ve:Ve-1)}function X(pe,Ae,ve){const{xs:Ie,ys:De,n:Ce}=I(pe,Ae,ve);if(Ce<2)return null;let Ve=0,_e=0;for(let Bt=0;Bt<Ce;Bt++)Ve+=Ie[Bt],_e+=De[Bt];Ve/=Ce,_e/=Ce;let Ke=0,qe=0,st=0;for(let Bt=0;Bt<Ce;Bt++){const Ct=Ie[Bt]-Ve,Ut=De[Bt]-_e;Ke+=Ct*Ct,qe+=Ct*Ut,st+=Ut*Ut}if(Ke===0)return null;const ut=qe/Ke,kt=_e-ut*Ve,Pt=st===0?1:Math.max(0,Math.min(1,qe*qe/(Ke*st))),Ot=Math.max(0,st-ut*qe),Lt=Ce>2?Math.sqrt(Ot/(Ce-2)/Ke):0;return{slope:ut,intercept:kt,r2:Pt,stdError:Lt,n:Ce}}const q=new Set(["ols","wls","robust"]),_=new Set(["quantile"]),H=new Set(["ridge","lasso","elasticnet","mixed","gls"]),ee=1.345;function te(pe,Ae,ve){const{xtwx:Ie,xtwy:De}=c(pe,Ae,ve),Ce=j(Ie);if(!Ce)return null;const Ve=k(Ce,De),_e=y(Ce),Ke=J(pe,Ve),qe=Ae.map((st,ut)=>st-Ke[ut]);return{beta:Ve,cov:_e,fitted:Ke,residuals:qe}}function J(pe,Ae){return pe.map(ve=>ve.reduce((Ie,De,Ce)=>Ie+De*Ae[Ce],0))}function ne(pe,Ae){const ve=pe.length,Ie=pe.map(qe=>qe[Ae]),De=pe.map(qe=>[1,...qe.filter((st,ut)=>ut!==Ae)]),Ce=te(De,Ie,null);if(!Ce)return 1;const Ve=Ie.reduce((qe,st)=>qe+st,0)/ve;let _e=0,Ke=0;for(let qe=0;qe<ve;qe++)_e+=Ce.residuals[qe]**2,Ke+=(Ie[qe]-Ve)**2;return Ke===0?1:Math.max(0,Math.min(1,1-_e/Ke))}function se(pe){const Ae=[...pe].sort((De,Ce)=>De-Ce),ve=ae(Ae),Ie=pe.map(De=>Math.abs(De-ve)).sort((De,Ce)=>De-Ce);return ae(Ie)/.6745}function ae(pe){const Ae=pe.length;if(!Ae)return 0;const ve=Math.floor(Ae/2);return Ae%2?pe[ve]:(pe[ve-1]+pe[ve])/2}function we(pe,Ae,ve={}){const Ie=ve.method||"ols";if(H.has(Ie))throw new Error(`[lattice] regression method "${Ie}" is out of scope; use ols, wls or robust.`);if(_.has(Ie))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!q.has(Ie))throw new Error(`[lattice] unknown regression method "${Ie}"; use ols, wls or robust.`);const De=Array.isArray(Ae)?Ae.length:0,Ce=De&&Array.isArray(pe[0])?pe[0].length:0,Ve=Ce+1;if(!(De>Ve))return null;for(let jt=0;jt<De;jt++){if(!Number.isFinite(Ae[jt])||!Array.isArray(pe[jt])||pe[jt].length!==Ce)return null;for(let $t=0;$t<Ce;$t++)if(!Number.isFinite(pe[jt][$t]))return null}let _e=null;if(Ie==="wls"){if(_e=ve.weights,!Array.isArray(_e)||_e.length!==De)return null;for(let jt=0;jt<De;jt++)if(!(_e[jt]>0)||!Number.isFinite(_e[jt]))return null}const Ke=pe.map(jt=>[1,...jt]);let qe,st=null;if(Ie==="robust"){if(qe=te(Ke,Ae,null),!qe)return null;for(let jt=0;jt<50;jt++){const $t=se(qe.residuals);if(!($t>0))break;const Gt=qe.residuals.map(_t=>{const Kt=Math.abs(_t/$t);return Kt<=ee?1:ee/Kt}),zt=te(Ke,Ae,Gt);if(!zt)return null;const Vt=zt.beta.reduce((_t,Kt,Dt)=>Math.max(_t,Math.abs(Kt-qe.beta[Dt])),0);if(qe=zt,st=Gt,Vt<1e-10)break}}else if(qe=te(Ke,Ae,_e),!qe)return null;const ut=Ie==="robust"?st:_e,{beta:kt,cov:Pt,fitted:Ot,residuals:Lt}=qe;let Bt=0,Ct=0,Ut=0;for(let jt=0;jt<De;jt++){const $t=ut?ut[jt]:1;Bt+=$t*Lt[jt]**2,Ct+=$t,Ut+=$t*Ae[jt]}const rn=Ut/Ct;let Wt=0;for(let jt=0;jt<De;jt++){const $t=ut?ut[jt]:1;Wt+=$t*(Ae[jt]-rn)**2}const Qt=De-Ve,Ze=Bt/Qt,ct=Wt===0?1:Math.max(0,Math.min(1,1-Bt/Wt)),St=1-(1-ct)*(De-1)/Qt,bt=Array.isArray(ve.names)&&ve.names.length===Ce?ve.names:pe[0].map((jt,$t)=>`x${$t+1}`),yt=Ye(ve.confidence),We=Qt>0?L(1-(1-yt)/2,Qt):1/0,ft=kt.map((jt,$t)=>{const Gt=Math.sqrt(Math.max(0,Ze*Pt[$t][$t])),zt=Gt>0?jt/Gt:jt===0?0:1/0,Vt=Number.isFinite(zt)?2*(1-Z(Math.abs(zt),Qt)):0,_t=Number.isFinite(We)?We*Gt:null;return{name:$t===0?"(intercept)":bt[$t-1],estimate:jt,stdError:Gt,t:zt,p:Math.max(0,Math.min(1,Vt)),lower:_t===null?null:jt-_t,upper:_t===null?null:jt+_t}}),rt=new Array(De),dt=new Array(De);for(let jt=0;jt<De;jt++){const $t=ut?ut[jt]:1,Gt=Math.max(0,Math.min(1,$t*m(Ke[jt],Pt)));rt[jt]=Gt;const zt=(1-Gt)**2;dt[jt]=zt>0&&Ze>0?Lt[jt]**2/(Ve*Ze)*(Gt/zt):null}const xt=pe[0].map((jt,$t)=>{if(Ce<2)return 1;const Gt=ne(pe,$t);return Gt>=1?1/0:1/(1-Gt)});let Ft=null;{const jt=Lt.map(Gt=>Gt*Gt),$t=te(Ke,jt,null);if($t){const Gt=jt.reduce((Jt,cn)=>Jt+cn,0)/De;let zt=0,Vt=0;for(let Jt=0;Jt<De;Jt++)zt+=$t.residuals[Jt]**2,Vt+=(jt[Jt]-Gt)**2;const _t=Vt===0?0:Math.max(0,Math.min(1,1-zt/Vt)),Kt=De*_t,Dt=Y(Kt,Ce);Ft={statistic:Kt,df:Ce,p:Dt,heteroscedastic:Dt<.05}}}let wt=null;if(Ce===1){const jt=pe.map(($t,Gt)=>Gt).sort(($t,Gt)=>pe[$t][0]-pe[Gt][0]);wt={confidence:yt,points:jt.map($t=>{const Gt=Ke[$t],zt=Math.sqrt(Math.max(0,Ze*m(Gt,Pt)));return{x:pe[$t][0],yhat:Ot[$t],lower:Ot[$t]-We*zt,upper:Ot[$t]+We*zt}})}}return{method:Ie,coefficients:ft,r2:ct,adjR2:St,n:De,df:Qt,sigma2:Ze,fitted:Ot,residuals:Lt,leverage:rt,cooksD:dt,vif:xt,heteroscedasticity:Ft,band:wt,weights:ut?[...ut]:null}}function fe(pe){const Ae=pe.length,ve=Array.from({length:Ae},(Ce,Ve)=>Ve).sort((Ce,Ve)=>pe[Ce]-pe[Ve]),Ie=new Float64Array(Ae);let De=0;for(;De<Ae;){let Ce=De;for(;Ce+1<Ae&&pe[ve[Ce+1]]===pe[ve[De]];)Ce++;const Ve=(De+Ce)/2+1;for(let _e=De;_e<=Ce;_e++)Ie[ve[_e]]=Ve;De=Ce+1}return Ie}const ge=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function je(pe){const Ae=[.01,.05,.1],ve=[ge["1%"],ge["5%"],ge["10%"]];if(pe<=ve[0]){const Ce=(Math.log(Ae[1])-Math.log(Ae[0]))/(ve[1]-ve[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(Ae[0])+Ce*(pe-ve[0]))))}if(pe>=ve[2]){const Ce=(Math.log(Ae[2])-Math.log(Ae[1]))/(ve[2]-ve[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(Ae[2])+Ce*(pe-ve[2]))))}const Ie=pe<ve[1]?0:1,De=(pe-ve[Ie])/(ve[Ie+1]-ve[Ie]);return Math.exp(Math.log(Ae[Ie])+De*(Math.log(Ae[Ie+1])-Math.log(Ae[Ie])))}function Pe(pe,Ae,ve,Ie){const De=ve-Ie,Ce=Ie+3,Ve=new Array(De),_e=new Array(De);let Ke=!0,qe=Ie;for(let Ot=0;Ot<De;Ot++){const Lt=Ie+Ot,Bt=new Float64Array(Ce);Bt[0]=1,Bt[1]=Ot+1,Bt[2]=pe[Lt];for(let Ct=1;Ct<=Ie;Ct++)Bt[2+Ct]=Ae[Lt-Ct];for(let Ct=1;Ct<Ce;Ct++)Number.isFinite(Bt[Ct])||(qe=Math.min(qe,Ct-3));Ve[Ot]=Bt,_e[Ot]=Ae[Lt],Number.isFinite(_e[Ot])||(Ke=!1)}if(!Ke)return 0;const{xtwx:st,xtwy:ut}=c(Ve,_e,null);let kt=0,Pt=1/0;for(let Ot=0;Ot<=qe;Ot++){const Lt=Ot+3;if(!(De>Lt))continue;const Bt=new Array(Lt);for(let ct=0;ct<Lt;ct++)Bt[ct]=st[ct].slice(0,Lt);const Ct=j(Bt);if(!Ct)continue;const Ut=k(Ct,ut.slice(0,Lt));let rn=0;for(let ct=0;ct<De;ct++){const St=Ve[ct];let bt=0;for(let yt=0;yt<Lt;yt++)bt+=St[yt]*Ut[yt];rn+=(_e[ct]-bt)**2}const Qt=rn/(De-Lt)*(De-Lt);if(!(Qt>0))continue;const Ze=De*Math.log(Qt/De)+2*Lt;Ze<Pt&&(Pt=Ze,kt=Ot)}return kt}function de(pe,Ae={}){const ve=[];for(let Pt=0;Pt<pe.length;Pt++){const Ot=Number(pe[Pt]);Number.isFinite(Ot)&&ve.push(Ot)}const Ie=ve.length,De=Ie-1;if(Ie<8||De<6)return null;const Ce=new Array(De);for(let Pt=0;Pt<De;Pt++)Ce[Pt]=ve[Pt+1]-ve[Pt];let Ve=Number.isFinite(Ae.maxlag)?Math.floor(Ae.maxlag):Math.ceil(12*(Ie/100)**.25);Ve=Math.max(0,Math.min(Ve,Math.floor((De-5)/2)));const _e=(Pt,Ot)=>{const Lt=[],Bt=[];for(let Ct=Ot;Ct<De;Ct++){const Ut=[Ct-Ot+1,ve[Ct]];for(let rn=1;rn<=Pt;rn++)Ut.push(Ce[Ct-rn]);Lt.push(Ut),Bt.push(Ce[Ct])}return we(Lt,Bt,{method:"ols"})},Ke=Pe(ve,Ce,De,Ve),qe=_e(Ke,Ke);if(!qe||!qe.coefficients[2])return null;const st=qe.coefficients[2].t,ut=je(st),kt=st<ge["5%"];return{statistic:st,usedLag:Ke,nobs:De-Ke,criticalValues:{...ge},pValue:ut,pApproximate:!0,stationary:kt,verdict:kt?"stationary":"non-stationary",regression:"ct"}}function oe(pe,Ae={}){const ve=[];for(let kt=0;kt<pe.length;kt++){const Pt=Number(pe[kt]);Number.isFinite(Pt)&&ve.push(Pt)}const Ie=ve.length;if(Ie<3)return null;let De=Number.isFinite(Ae.maxlag)?Math.floor(Ae.maxlag):Math.min(10,Ie-1);De=Math.max(1,Math.min(De,Ie-1));let Ce=0;for(const kt of ve)Ce+=kt;Ce/=Ie;const Ve=ve.map(kt=>kt-Ce);let _e=0;for(const kt of Ve)_e+=kt*kt;_e/=Ie;const Ke=new Array(De+1).fill(0);Ke[0]=1;for(let kt=1;kt<=De;kt++){let Pt=0;for(let Ot=kt;Ot<Ie;Ot++)Pt+=Ve[Ot]*Ve[Ot-kt];Ke[kt]=_e>0?Pt/Ie/_e:0}const qe=new Array(De+1).fill(0);qe[0]=1;let st=[];for(let kt=1;kt<=De;kt++){let Pt=Ke[kt];for(let Ct=1;Ct<kt;Ct++)Pt-=st[Ct-1]*Ke[kt-Ct];let Ot=1;for(let Ct=1;Ct<kt;Ct++)Ot-=st[Ct-1]*Ke[Ct];const Lt=Ot!==0?Pt/Ot:0,Bt=new Array(kt);for(let Ct=1;Ct<kt;Ct++)Bt[Ct-1]=st[Ct-1]-Lt*st[kt-1-Ct];Bt[kt-1]=Lt,qe[kt]=Lt,st=Bt}const ut=1.96/Math.sqrt(Ie);return{acf:Ke,pacf:qe,bounds:{upper:ut,lower:-ut},n:Ie,nlags:De,approximate:!0}}function he(pe,Ae,ve){const{xs:Ie,ys:De,n:Ce}=I(pe,Ae,ve);if(Ce<2)return null;const Ve=fe(Ie),_e=fe(De);let Ke=0,qe=0;for(let Pt=0;Pt<Ce;Pt++)Ke+=Ve[Pt],qe+=_e[Pt];Ke/=Ce,qe/=Ce;let st=0,ut=0,kt=0;for(let Pt=0;Pt<Ce;Pt++){const Ot=Ve[Pt]-Ke,Lt=_e[Pt]-qe;st+=Ot*Lt,ut+=Ot*Ot,kt+=Lt*Lt}return ut===0||kt===0?null:Math.max(-1,Math.min(1,st/Math.sqrt(ut*kt)))}function ce(pe,Ae,ve){const{xs:Ie,ys:De,n:Ce}=I(pe,Ae,ve);if(Ce<2||Ce>o)return null;let Ve=0,_e=0,Ke=0,qe=0;for(let kt=0;kt<Ce;kt++)for(let Pt=kt+1;Pt<Ce;Pt++){const Ot=Math.sign(Ie[kt]-Ie[Pt]),Lt=Math.sign(De[kt]-De[Pt]),Bt=Ot*Lt;Bt>0?Ve++:Bt<0?_e++:Ot===0&&Lt===0||(Ot===0?Ke++:qe++)}const st=Ve+_e+qe,ut=Ve+_e+Ke;return st===0||ut===0?null:(Ve-_e)/Math.sqrt(st*ut)}function me(pe,Ae={}){const ve=pe.length;if(ve<2)return null;const Ie=pe[0],De=pe[ve-1],Ce=[];for(let Ct=1;Ct<ve;Ct++){const Ut=pe[Ct-1];Ut!==0&&Ce.push((pe[Ct]-Ut)/Math.abs(Ut))}let Ve=null;if(Ce.length>1){let Ct=0;for(const rn of Ce)Ct+=rn;Ct/=Ce.length;let Ut=0;for(const rn of Ce)Ut+=(rn-Ct)**2;Ve=Math.sqrt(Ut/(Ce.length-1))}const _e=Number(Ae.periodsPerYear)>0?Number(Ae.periodsPerYear):null;let Ke=pe[0],qe=0,st=0,ut=0,kt=0;for(let Ct=1;Ct<ve;Ct++){if(pe[Ct]>Ke){Ke=pe[Ct],qe=Ct;continue}if(Ke<=0)continue;const Ut=(Ke-pe[Ct])/Ke;Ut>st&&(st=Ut,ut=qe,kt=Ct)}let Pt=null;if(ve>2){let Ct=0;for(let Wt=0;Wt<ve;Wt++)Ct+=pe[Wt];Ct/=ve;let Ut=0,rn=0;for(let Wt=0;Wt<ve;Wt++){const Qt=pe[Wt]-Ct;rn+=Qt*Qt,Wt>0&&(Ut+=Qt*(pe[Wt-1]-Ct))}Pt=rn>0?Ut/rn:null}let Ot=0,Lt=0;for(const Ct of Ce)Ct>0?Ot++:Ct<0&&Lt++;let Bt=null;if(Ie>0&&De>0){const Ct=(De/Ie)**(1/(ve-1))-1;Bt=_e?(1+Ct)**_e-1:Ct}return{n:ve,first:Ie,last:De,change:De-Ie,changePercent:Ie===0?null:(De-Ie)/Math.abs(Ie)*100,volatility:Ve,annualisedVolatility:Ve!==null&&_e?Ve*Math.sqrt(_e):null,growth:Bt,maxDrawdown:st,maxDrawdownFrom:ut,maxDrawdownTo:kt,autocorrelation:Pt,upDays:Ot,downDays:Lt}}const ye=1.128,xe=3.267;function Se(pe){const Ae=pe.length;if(Ae<2)return null;const ve=[];for(let De=1;De<Ae;De++)ve.push(Math.abs(pe[De]-pe[De-1]));const Ie=ve.reduce((De,Ce)=>De+Ce,0)/ve.length;return{ranges:ve,centre:Ie,upper:xe*Ie,lower:0}}function Te(pe){const Ae=pe.length;if(Ae<2)return null;let ve=0;for(let De=1;De<Ae;De++)ve+=Math.abs(pe[De]-pe[De-1]);const Ie=ve/(Ae-1);return{sigma:Ie/ye,meanRange:Ie}}function Be(pe,Ae){const ve=pe.length;if(ve<2||!Ae)return null;const Ie=Number.isFinite(Number(Ae.lower))?Number(Ae.lower):null,De=Number.isFinite(Number(Ae.upper))?Number(Ae.upper):null;if(Ie===null&&De===null)return null;let Ce=0;for(let Ot=0;Ot<ve;Ot++)Ce+=pe[Ot];Ce/=ve;let Ve=0;for(let Ot=0;Ot<ve;Ot++)Ve+=(pe[Ot]-Ce)**2;const _e=Math.sqrt(Ve/(ve-1)),Ke=Te(pe),qe=Ke?Ke.sigma:null,st=Ot=>{if(!Ot||Ot<=0)return{index:null,k:null};const Bt=Ie!==null&&De!==null?(De-Ie)/(6*Ot):null,Ct=De!==null?(De-Ce)/(3*Ot):1/0,Ut=Ie!==null?(Ce-Ie)/(3*Ot):1/0;return{index:Bt,k:Math.min(Ct,Ut)}},ut=st(qe),kt=st(_e);let Pt=0;for(let Ot=0;Ot<ve;Ot++){if(Ie!==null&&pe[Ot]<Ie){Pt++;continue}De!==null&&pe[Ot]>De&&Pt++}return{n:ve,mean:Ce,lower:Ie,upper:De,target:Number.isFinite(Number(Ae.target))?Number(Ae.target):null,sigmaWithin:qe,sigmaOverall:_e,cp:ut.index,cpk:ut.k,pp:kt.index,ppk:kt.k,outOfSpec:Pt,defectRate:ve?Pt/ve:null}}function Ee(pe){const Ae=pe.length;if(Ae<2)return null;const ve=Te(pe);if(!ve||!(ve.sigma>0))return null;let Ie=0;for(let De=0;De<Ae;De++)Ie+=pe[De];return Ie/=Ae,{centre:Ie,sigma:ve.sigma,upper:Ie+3*ve.sigma,lower:Ie-3*ve.sigma}}function Ge(pe,Ae){if(!Ae||!(Ae.sigma>0))return[];const ve=pe.length,{centre:Ie,sigma:De}=Ae,Ce=_e=>(pe[_e]-Ie)/De,Ve=[];for(let _e=0;_e<ve;_e++){if(Math.abs(Ce(_e))>3&&Ve.push({index:_e,rule:1,description:"beyond three sigma"}),_e>=2)for(const Ke of[1,-1]){let qe=0;for(let st=_e-2;st<=_e;st++)Ce(st)*Ke>2&&qe++;if(qe>=2){Ve.push({index:_e,rule:2,description:"two of three past two sigma"});break}}if(_e>=4)for(const Ke of[1,-1]){let qe=0;for(let st=_e-4;st<=_e;st++)Ce(st)*Ke>1&&qe++;if(qe>=4){Ve.push({index:_e,rule:3,description:"four of five past one sigma"});break}}if(_e>=7)for(const Ke of[1,-1]){let qe=!0;for(let st=_e-7;st<=_e;st++)if(Ce(st)*Ke<=0){qe=!1;break}if(qe){Ve.push({index:_e,rule:4,description:"eight in a row on one side"});break}}}return Ve}function Ne(pe,Ae){if(!Ae||!(Ae.sigma>0))return[];const ve=pe.length,{centre:Ie,sigma:De}=Ae,Ce=Ke=>(pe[Ke]-Ie)/De,Ve=(Ke,qe,st,ut)=>{for(const kt of[1,-1]){let Pt=0;for(let Ot=Ke;Ot<=qe;Ot++)Ce(Ot)*kt>st&&Pt++;if(Pt>=ut)return!0}return!1},_e=[];for(let Ke=0;Ke<ve;Ke++){if(Math.abs(Ce(Ke))>3&&_e.push({index:Ke,rule:1,description:"beyond three sigma"}),Ke>=8)for(const qe of[1,-1]){let st=!0;for(let ut=Ke-8;ut<=Ke;ut++)if(Ce(ut)*qe<=0){st=!1;break}if(st){_e.push({index:Ke,rule:2,description:"nine in a row on one side"});break}}if(Ke>=5)for(const qe of[1,-1]){let st=!0;for(let ut=Ke-4;ut<=Ke;ut++)if((pe[ut]-pe[ut-1])*qe<=0){st=!1;break}if(st){_e.push({index:Ke,rule:3,description:qe>0?"six rising":"six falling"});break}}if(Ke>=13){let qe=!0;for(let st=Ke-12;st<=Ke;st++){const ut=pe[st]-pe[st-1],kt=pe[st+1<=Ke?st+1:st]-pe[st];if(st+1>Ke)break;if(ut===0||kt===0||ut>0==kt>0){qe=!1;break}}qe&&_e.push({index:Ke,rule:4,description:"fourteen alternating"})}if(Ke>=2&&Ve(Ke-2,Ke,2,2)&&_e.push({index:Ke,rule:5,description:"two of three past two sigma"}),Ke>=4&&Ve(Ke-4,Ke,1,4)&&_e.push({index:Ke,rule:6,description:"four of five past one sigma"}),Ke>=14){let qe=!0;for(let st=Ke-14;st<=Ke;st++)if(Math.abs(Ce(st))>=1){qe=!1;break}qe&&_e.push({index:Ke,rule:7,description:"fifteen within one sigma"})}if(Ke>=7){let qe=!0;for(let st=Ke-7;st<=Ke;st++)if(Math.abs(Ce(st))<=1){qe=!1;break}qe&&_e.push({index:Ke,rule:8,description:"eight beyond one sigma"})}}return _e}const ke=Object.freeze(["westernElectric","nelson"]);function Oe(pe,Ae,ve="westernElectric"){return String(ve)==="nelson"?Ne(pe,Ae):Ge(pe,Ae)}function Re(pe,Ae,ve){let Ie=0;for(let De=0;De<pe.length;De++)(pe[De]<Ae||pe[De]>ve)&&Ie++;return Ie}function Le(pe,Ae,ve,Ie=20){const De=pe.length;if(!De)return[];const Ce=pe[0],Ve=pe[De-1];if(Ve===Ce)return[{from:Ce,to:Ve,count:De}];const _e=ve-Ae,Ke=1.5*_e;let qe=_e>0?Math.max(Ce,Ae-Ke):Ce,st=_e>0?Math.min(Ve,ve+Ke):Ve;st>qe||(qe=Ce,st=Ve);const ut=_e>0?2*_e/Math.cbrt(De):(st-qe)/(Math.ceil(Math.log2(De))+1),kt=ut>0?Math.min(Ie,Math.max(1,Math.ceil((st-qe)/ut))):1,Pt=(st-qe)/kt,Ot=[];for(let Lt=0;Lt<kt;Lt++)Ot.push({from:qe+Lt*Pt,to:qe+(Lt+1)*Pt,count:0});for(let Lt=0;Lt<De;Lt++){const Bt=Math.min(kt-1,Math.max(0,Math.floor((pe[Lt]-qe)/Pt)));Ot[Bt].count++}return Ot[0].from=Ce,Ot[kt-1].to=Ve,Ot}const ze=.95;function Ye(pe){const Ae=Number(pe);return Number.isFinite(Ae)&&Ae>0&&Ae<1?Ae:ze}function et(pe,Ae=ze){const ve=pe.length;if(ve<2)return null;let Ie=0;for(let st=0;st<ve;st++)Ie+=pe[st];const De=Ie/ve;let Ce=0;for(let st=0;st<ve;st++){const ut=pe[st]-De;Ce+=ut*ut}const Ve=Math.sqrt(Ce/(ve-1)),_e=Ye(Ae),qe=L(1-(1-_e)/2,ve-1)*Ve/Math.sqrt(ve);return{mean:De,lower:De-qe,upper:De+qe,margin:qe,n:ve,confidence:_e}}function tt(pe,Ae,ve=ze){const Ie=Number(pe),De=Number(Ae);if(!(De>0)||!(Ie>=0)||Ie>De)return null;const Ce=Ye(ve),Ve=z(1-(1-Ce)/2),_e=Ie/De,Ke=Ve*Ve,qe=1+Ke/De,st=(_e+Ke/(2*De))/qe,ut=Ve/qe*Math.sqrt(_e*(1-_e)/De+Ke/(4*De*De));return{proportion:_e,lower:Math.max(0,st-ut),upper:Math.min(1,st+ut),n:De,confidence:Ce}}function pt(pe,Ae=ze){if(!pe||!(pe.n>2)||!Number.isFinite(pe.stdError))return null;const ve=Ye(Ae),De=L(1-(1-ve)/2,pe.n-2)*pe.stdError;return{slope:pe.slope,lower:pe.slope-De,upper:pe.slope+De,margin:De,confidence:ve}}function Tt(pe,Ae,ve=ze){const Ie=Number(pe),De=Number(Ae);if(!Number.isFinite(Ie)||!(De>1))return null;const Ce=Ye(ve),_e=z(1-(1-Ce)/2)*Math.sqrt(1/(9*De)+Ie*Ie/(2*(De-1)));return{index:Ie,lower:Ie-_e,upper:Ie+_e,margin:_e,n:De,confidence:Ce}}function Rt(pe,Ae){return!pe||!(pe.sd>0)||!Number.isFinite(Ae)||!Number.isFinite(pe.mean)?null:(Ae-pe.mean)/pe.sd}function ot(pe){return Number.isFinite(pe)?Math.min(1,Math.max(0,2*x(Math.abs(pe)/2)-1)):0}function lt(pe,Ae){const ve=new Map,Ie=G(pe);let De=0;for(let Ce=0;Ce<Ae.length;Ce++){const Ve=Ie(Ae[Ce]);if(Ve==null||Ve===""||typeof Ve=="number"&&Number.isNaN(Ve))continue;const _e=Ve instanceof Date?Ve.getTime():typeof Ve=="object"?String(Ve):Ve;ve.set(_e,(ve.get(_e)||0)+1),De++}return{map:ve,total:De}}function ht(pe,Ae,ve,Ie){if(!(Ae>0)||!(Ie>0))return null;let De=0;const Ce=new Set(pe.keys());for(const Ve of ve.keys())Ce.add(Ve);for(const Ve of Ce){const _e=(pe.get(Ve)||0)/Ae,Ke=(ve.get(Ve)||0)/Ie;De+=Math.abs(_e-Ke)}return De/2}const Nt=10;function mt(pe,Ae,ve){if(ve&&ve.numeric){const _e=g(pe,Ae),{n:Ke,mean:qe}=p(_e),st=Ke>0?Rt({mean:ve.mean,sd:ve.sd},qe):null;return{measure:"standardizedMeanDifference",magnitude:st,distance:st===null?0:ot(st),direction:st===null?0:Math.sign(st),subsetN:Ke,populationN:ve.n||0,reliable:Ke>=Nt}}const{map:De,total:Ce}=lt(pe,Ae),Ve=ht(De,Ce,ve.map,ve.total);return{measure:"categoricalTotalVariation",magnitude:Ve,distance:Ve===null?0:Ve,direction:0,subsetN:Ce,populationN:ve.total||0,reliable:Ce>=Nt}}function be(pe,Ae){if(pe&&(pe.kind==="float64"||pe.kind==="int32"))return!0;const ve=G(pe);let Ie=0,De=0;for(let Ce=0;Ce<Ae.length&&Ie<200;Ce++){const Ve=ve(Ae[Ce]);if(Ve==null||Ve==="")continue;if(Ve instanceof Date)return!1;Ie++;const _e=typeof Ve=="number"?Ve:Number(Ve);Number.isFinite(_e)&&De++}return Ie===0?!1:De/Ie>=.9}function Me(pe,Ae){if(be(pe,Ae)){const De=g(pe,Ae),{n:Ce,mean:Ve,m2:_e}=p(De);return{numeric:!0,mean:Ve,sd:Ce>0?Math.sqrt(_e/Ce):0,n:Ce}}const{map:ve,total:Ie}=lt(pe,Ae);return{numeric:!1,map:ve,total:Ie}}}),He("packages/core/src/compute/total.js",function(e,D){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"aggregatesFor",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"aggregateAllowed",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return p}});const N=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/warn.js").warnOnce,L=D("packages/core/src/compute/handle.js"),Z=L.presenceReader,z=L.valueComparator,x=L.valueReader,Y=D("packages/core/src/compute/statistics.js"),$=Y.STAT_FNS,j=Y.STAT_LABELS;function k(w){return!!w&&(w.kind==="float64"||w.kind==="int32")}function y(w,v){const P=v.length;let V=0;if(k(w)){const K=w.values,R=Z(w);if(!R){for(let S=0;S<P;S++){const E=K[v[S]];Number.isNaN(E)||(V+=E)}return V}for(let S=0;S<P;S++){const E=v[S];if(R(E)===1){const O=K[E];Number.isNaN(O)||(V+=O)}}return V}const W=x(w);for(let K=0;K<P;K++){const R=g(W(v[K]));R!==null&&(V+=R)}return V}y.kernel=!0;function c(w,v){const P=v.length;let V=0;if(k(w)){const K=w.values,R=Z(w);if(!R){for(let S=0;S<P;S++)Number.isNaN(K[v[S]])||V++;return V}for(let S=0;S<P;S++){const E=v[S];R(E)===1&&!Number.isNaN(K[E])&&V++}return V}const W=x(w);for(let K=0;K<P;K++){const R=W(v[K]);R!=null&&!(typeof R=="number"&&Number.isNaN(R))&&V++}return V}c.kernel=!0;function m(w,v){return v.length}m.kernel=!0;function s(w,v){const P=c(w,v);return P===0?null:y(w,v)/P}s.kernel=!0;function t(w,v,P,V){const W=v.length;if(k(w)){const E=w.values,O=Z(w);let M=null;if(!O){for(let T=0;T<W;T++){const A=E[v[T]];Number.isNaN(A)||(M===null||(P<0?A<M:A>M))&&(M=A)}return M}for(let T=0;T<W;T++){const A=v[T];if(O(A)===0)continue;const I=E[A];Number.isNaN(I)||(M===null||(P<0?I<M:I>M))&&(M=I)}return M}const K=x(w),R=z(V);let S=null;for(let E=0;E<W;E++){const O=K(v[E]);O==null||typeof O=="number"&&Number.isNaN(O)||(S===null||(P<0?R(O,S)<0:R(O,S)>0))&&(S=O)}return S}function o(w,v,P){return t(w,v,-1,P&&P.locale)}o.kernel=!0;function u(w,v,P){return t(w,v,1,P&&P.locale)}u.kernel=!0;function d(w,v){return v.length===0?null:x(w)(v[0])}d.kernel=!0;function i(w,v){return v.length===0?null:x(w)(v[v.length-1])}i.kernel=!0;function g(w){if(typeof w=="number")return Number.isNaN(w)?null:w;if(w==null||w===""||typeof w=="boolean")return null;if(w instanceof Date)return w.getTime();const v=Number(w);return Number.isNaN(v)?null:v}const r={sum:y,min:o,max:u,avg:s,count:m,first:d,last:i,countValues:c,...$},n=Object.freeze({...j,sum:"Sum",avg:"Average",min:"Min",max:"Max",count:"Count",countValues:"Count of values",first:"First",last:"Last"});function f(w){return w?typeof w=="string"?n[w]||w:"Total":""}const h=Object.freeze(["sum","avg","min","max","count","countValues","first","last"]);function l(w){const v=w&&w.dataType&&w.dataType.totals&&w.dataType.totals.supported;if(Array.isArray(v))return v.slice();const P=h.filter(V=>V in r);for(const V of Object.keys(r))P.includes(V)||P.push(V);return P}function b(w,v){return typeof v!="string"?!0:l(w).includes(v)}function a(w,v){const P=x(w),V=[];for(let W=0;W<v.length;W++){const K=P(v[W]);K!=null&&V.push(K)}return V}function p(w,v,P,V){const W=v||[];if(P&&typeof P=="object"&&typeof P.fn=="string"){const{fn:K,...R}=P,S=r[K];return S?S(w,W,{...V,...R}):(F(`total:${K}`,`unknown total function "${K}"; register it in config.totalFns`),null)}if(typeof P=="string"){const K=r[P];return K?K(w,W,V):(F(`total:${P}`,`unknown total function "${P}"; register it in config.totalFns`),null)}return N(P)?P.kernel===!0?P(w,W,V):P(a(w,W),V||{}):null}}),He("packages/core/src/compute/windowed.js",function(e,D){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const N=D("packages/core/src/compute/sketch.js").Welford;class G{#e;#t;#n=[];#r;#i;constructor(x,Y=0,$=Date.now){if(x!=="count"&&x!=="time"&&x!=="session")throw new RangeError(`unknown window kind: ${x}`);if((x==="count"||x==="time")&&!(Y>0))throw new RangeError(`a ${x} window needs a positive span`);this.#e=x,this.#t=Math.floor(Y),this.#r=$,this.#i=$()}get size(){return this.#n.length}push(x,Y=this.#r()){Number.isFinite(x)&&(this.#n.push({t:Y,v:x}),this.#s(Y))}#s(x){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const Y=x-this.#t;for(;this.#n.length&&this.#n[0].t<Y;)this.#n.shift()}}spec(){const x=this.#e==="session"?this.#r()-this.#i:this.#t;return{kind:this.#e,span:x,size:this.#n.length}}values(){return this.#n.map(x=>x.v)}aggregate(){const x=this.spec();if(!this.#n.length)return{over:x,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const Y=new N;let $=0,j=1/0,k=-1/0;for(const{v:y}of this.#n)$+=y,y<j&&(j=y),y>k&&(k=y),Y.add(y);return{over:x,count:this.#n.length,sum:$,mean:Y.mean(),min:j,max:k,variance:Y.variance(),stddev:Y.stddev()}}reduce(x){const Y=this.aggregate(),$={sum:Y.sum,avg:Y.mean,mean:Y.mean,min:Y.min,max:Y.max,count:Y.count,variance:Y.variance,stddev:Y.stddev};if(!(x in $))throw new RangeError(`unknown windowed aggregate: ${x}`);return{value:$[x],over:Y.over}}}const F=Object.freeze(["count","time","session"]);function L(z,x=Date.now){const Y=z.kind==="time"&&z.minutes!=null?z.minutes*6e4:z.span??0;return new G(z.kind,Y,x)}const Z={Window:G,WINDOW_KINDS:F,openWindow:L}}),He("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 z}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"rollingQuantile",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"seasonalDecompose",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"exponentialSmoothing",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return g}});const N=D("packages/core/src/compute/windowed.js").openWindow,F=D("packages/core/src/compute/sketch.js").KLL,L=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function Z(r,n,f,h){if(r.kind==="count"){const l=Math.max(1,Math.floor(r.span||0));return{coverage:Math.min(1,n/l),partial:n<l}}if(r.kind==="time"){const l=r.minutes!=null?r.minutes*6e4:r.span||0;if(!(l>0))return{coverage:1,partial:!1};const b=f-h;return{coverage:Math.min(1,b/l),partial:b<l}}return{coverage:null,partial:!1}}function z(r,n){const f=N(n),h=new Map,l=r.length?r[0].at:0;for(let b=0;b<r.length;b++){const{key:a,at:p,value:w}=r[b];Number.isFinite(w)&&f.push(w,p);const v=f.aggregate(),P=Z(n,v.count,p,l);a!=null&&h.set(String(a),{sum:v.sum,avg:v.mean,min:v.min,max:v.max,count:v.count,coverage:P.coverage,partial:P.partial})}return h}function x(r){const n=new Map;let f=0;for(const{key:h,value:l}of r)Number.isFinite(l)&&(f+=l),h!=null&&n.set(String(h),f);return n}function Y(r,n=1){const f=new Map,h=Math.max(1,Math.floor(n));for(let l=0;l<r.length;l++){const{key:b,value:a}=r[l];if(b==null)continue;const p=l>=h?r[l-h].value:null,w=Number.isFinite(a)?a:null,v=Number.isFinite(p)?p:null;f.set(String(b),w!==null&&v!==null?w-v:null)}return f}const $=4096;function j(r){let n=r>>>0;return()=>{n+=1831565813;let f=n;return f=Math.imul(f^f>>>15,f|1),f^=f+Math.imul(f^f>>>7,f|61),((f^f>>>14)>>>0)/4294967296}}function k(r,n){const f=r.length;if(f===1)return r[0];const h=(f-1)*n,l=Math.floor(h),b=Math.ceil(h);return l===b?r[l]:r[l]+(h-l)*(r[b]-r[l])}function y(r,n,f={}){const h=Math.min(1,Math.max(0,f.q==null?.5:f.q)),l=Math.max(1,Math.floor(f.cap==null?$:f.cap)),b=j(f.seed==null?2654435769:f.seed),a=new Map,p=r.length?r[0].at:0;if(n.kind==="session"){const v=new F(200,b);let P=0;for(const{key:V,value:W}of r)Number.isFinite(W)&&(v.add(W),P++),V!=null&&a.set(String(V),{value:P?v.quantile(h):null,approx:P>0,count:P,coverage:null,partial:!1});return a}const w=N(n);for(const{key:v,at:P,value:V}of r){Number.isFinite(V)&&w.push(V,P);const W=w.values(),K=W.length;let R=null,S=!1;if(K)if(K<=l)R=k([...W].sort((O,M)=>O-M),h);else{const O=new F(200,b);for(const M of W)O.add(M);R=O.quantile(h),S=!0}const E=Z(n,K,P,p);v!=null&&a.set(String(v),{value:R,approx:S,count:K,coverage:E.coverage,partial:E.partial})}return a}function c(r,n){const f=r.length,h=new Array(f).fill(null),l=Math.floor(n/2),b=n%2===0;for(let a=0;a<f;a++){if(a-l<0||a+l>=f)continue;let p=0,w=!0;if(b)for(let v=-l;v<=l;v++){const P=r[a+v];if(!Number.isFinite(P)){w=!1;break}p+=v===-l||v===l?P*.5:P}else for(let v=-l;v<=l;v++){const P=r[a+v];if(!Number.isFinite(P)){w=!1;break}p+=P}w&&(h[a]=p/n)}return h}function m(r,n){const f=new Map,h=Math.floor(Number(n&&n.period));if(!(h>=2))return f;const l=n&&n.model==="multiplicative",b=r.length,a=r.map(S=>Number.isFinite(S.value)?S.value:null),p=c(a,h),w=new Array(b).fill(null);for(let S=0;S<b;S++){const E=p[S],O=a[S];E===null||O===null||(l?E!==0&&(w[S]=O/E):w[S]=O-E)}const v=new Array(h).fill(0),P=new Array(h).fill(0);for(let S=0;S<b;S++){if(w[S]===null)continue;const E=S%h;v[E]+=w[S],P[E]+=1}const V=l?1:0,W=v.map((S,E)=>P[E]?S/P[E]:V),K=W.reduce((S,E)=>S+E,0)/h,R=l?W.map(S=>K!==0?S/K:1):W.map(S=>S-K);for(let S=0;S<b;S++){const{key:E}=r[S];if(E==null)continue;const O=p[S],M=R[S%h],T=a[S];let A=null;O!==null&&T!==null&&(A=l?O*M!==0?T/(O*M):null:T-O-M),f.set(String(E),{trend:O,seasonal:T===null?null:M,residual:A,coverage:O===null?0:1,partial:O===null})}return f}function s(r,n,f,h=80){const l=(Math.sqrt(5)-1)/2;let b=n,a=f,p=a-l*(a-b),w=b+l*(a-b),v=r(p),P=r(w);for(let V=0;V<h;V++)v<P?(a=w,w=p,P=v,p=a-l*(a-b),v=r(p)):(b=p,p=w,v=P,w=b+l*(a-b),P=r(w));return(b+a)/2}const t=1e-4,o=1-1e-4;function u(r,n){const f=r.length,h=new Array(f).fill(null),l=new Array(f).fill(null);let b=null,a=0;for(let p=0;p<f;p++){const w=r[p];if(!Number.isFinite(w)){b!==null&&(l[p]=b,h[p]=b);continue}if(b===null){b=w,l[p]=w,h[p]=w;continue}l[p]=b,a+=(w-b)**2,b=n*w+(1-n)*b,h[p]=b}return{smoothed:h,fitted:l,sse:a}}function d(r,n,f){const h=r.length,l=new Array(h).fill(null),b=new Array(h).fill(null);let a=null,p=null,w=0;for(let v=0;v<h;v++){const P=r[v];if(!Number.isFinite(P)){a!==null&&(a+=p,l[v]=a);continue}if(a===null){a=P,l[v]=P;continue}if(p===null){p=P-a;const K=a+p;b[v]=K,w+=(P-K)**2;const R=a;a=n*P+(1-n)*(R+p),p=f*(a-R)+(1-f)*p,l[v]=a;continue}const V=a+p;b[v]=V,w+=(P-V)**2;const W=a;a=n*P+(1-n)*(W+p),p=f*(a-W)+(1-f)*p,l[v]=a}return{smoothed:l,fitted:b,sse:w}}function i(r,n={}){const f=new Map,h=n.method==="holt",l=r.map(V=>Number.isFinite(V.value)?V.value:null),b=l.filter(V=>V!==null).length,a=V=>Math.min(o,Math.max(t,V)),p=()=>{for(const{key:V}of r)V!=null&&f.set(String(V),{smoothed:null,fitted:null,alpha:null,beta:null,sse:null});return f};if(b<(h?2:1))return p();let w=Number.isFinite(n.alpha)?a(n.alpha):null,v=h&&Number.isFinite(n.beta)?a(n.beta):null;if(h){if(w===null||v===null){let V=w===null?.5:w,W=v===null?.5:v;for(let K=0;K<6;K++)w===null&&(V=s(R=>d(l,R,W).sse,t,o)),v===null&&(W=s(R=>d(l,V,R).sse,t,o));w=w===null?V:w,v=v===null?W:v}}else w===null&&(w=s(V=>u(l,V).sse,t,o));const P=h?d(l,w,v):u(l,w);for(let V=0;V<r.length;V++){const{key:W}=r[V];W!=null&&f.set(String(W),{smoothed:P.smoothed[V],fitted:P.fitted[V],alpha:w,beta:h?v:null,sse:P.sse})}return f}const g={ROLLING_WINDOW_FIELDS:L,QUANTILE_SPAN_CAP:$,rollingWindow:z,rollingQuantile:y,cumulativeToDate:x,periodOverPeriod:Y,seasonalDecompose:m,exponentialSmoothing:i}}),He("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 N}}),Object.defineProperty(e,"DEFAULT_K",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"DEFAULT_MIN_POINTS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"orderByCentre",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"kmeans",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"dbscan",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"autoK",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"standardise",{enumerable:!0,get:function(){return t}});const re=1e5,N=2e4,G=3,F=5,L=100;function Z(o){let u=o>>>0;return function(){u=u+1831565813|0;let i=Math.imul(u^u>>>15,1|u);return i=i+Math.imul(i^i>>>7,61|i)^i,((i^i>>>14)>>>0)/4294967296}}function z(o,u){let d=0;for(let i=0;i<o.length;i++){const g=o[i]-u[i];d+=g*g}return d}function x(o,u){return Math.sqrt(z(o,u))}function Y(o,u){let d=-1,i=1/0;for(let g=0;g<u.length;g++){const r=z(o,u[g]);r<i&&(i=r,d=g)}return d}function $(o,u,d){const i=Z(d),g=o.length,r=[Array.from(o[Math.floor(i()*g)])],n=new Float64Array(g).fill(1/0);for(let f=1;f<u;f++){let h=0;for(let p=0;p<g;p++){const w=z(o[p],r[r.length-1]);w<n[p]&&(n[p]=w),h+=n[p]}const l=i()*(h||g);let b=0,a=g-1;for(let p=0;p<g;p++)if(b+=h?n[p]:1,b>=l){a=p;break}r.push(Array.from(o[a]))}return r}function j(o,u){for(let d=0;d<o.length;d++){const i=o[d]-u[d];if(i!==0)return i}return 0}function k(o,u,d,i){const g=u.map((n,f)=>({centre:n,i:f})).sort((n,f)=>j(n.centre,f.centre)),r=new Int32Array(u.length);for(let n=0;n<g.length;n++)r[g[n].i]=n;for(let n=0;n<o.length;n++)o[n]>=0&&(o[n]=r[o[n]]);return{assignments:o,centres:g.map(n=>n.centre),sizes:g.map(n=>d[n.i]),distances:i}}function y(o,u={}){const d=o.length,i=d?o[0].length:0,g=Math.floor(u.k||G);if(!(d>=g)||g<1||i<1)return null;let r=$(o,g,u.seed===void 0?1:u.seed);const n=new Int32Array(d);let f=!0;for(let a=0;a<L&&f;a++){f=!1;for(let v=0;v<d;v++){const P=Y(o[v],r);n[v]!==P&&(n[v]=P,f=!0)}const p=r.map(()=>new Float64Array(i)),w=new Array(g).fill(0);for(let v=0;v<d;v++){const P=n[v];for(let V=0;V<i;V++)p[P][V]+=o[v][V];w[P]++}for(let v=0;v<g;v++)if(w[v])for(let P=0;P<i;P++)r[v][P]=p[v][P]/w[v];else{let P=0,V=-1/0;for(let W=0;W<d;W++){const K=z(o[W],r[v]);K>V&&(V=K,P=W)}r[v]=Array.from(o[P]),f=!0}}const h=new Array(g).fill(0),l=new Float64Array(d);let b=0;for(let a=0;a<d;a++){const p=n[a];h[p]++;const w=z(o[a],r[p]);l[a]=Math.sqrt(w),b+=w}return{assignments:n,centres:r,sizes:h,inertia:b,distances:l}}function c(o,u={}){const d=o.length,i=d?o[0].length:0,g=Number(u.eps),r=Math.max(1,Math.floor(u.minPoints||F));if(!(g>0)||d===0||i<1)return null;const n=new Array(d);for(let w=0;w<d;w++){const v=[];for(let P=0;P<d;P++)w!==P&&x(o[w],o[P])<=g&&v.push(P);n[w]=v}const f=new Int32Array(d).fill(-1);let h=0;for(let w=0;w<d;w++){if(f[w]!==-1||n[w].length<r)continue;f[w]=h;const v=[...n[w]];for(let P=0;P<v.length;P++){const V=v[P];f[V]===-1&&(f[V]=h,n[V].length>=r&&v.push(...n[V]))}h++}if(!h)return{assignments:f,centres:[],sizes:[],distances:new Float64Array(d).fill(NaN)};const l=[],b=new Array(h).fill(0),a=Array.from({length:h},()=>new Float64Array(i));for(let w=0;w<d;w++){const v=f[w];if(!(v<0)){b[v]++;for(let P=0;P<i;P++)a[v][P]+=o[w][P]}}for(let w=0;w<h;w++){const v=new Array(i);for(let P=0;P<i;P++)v[P]=a[w][P]/b[w];l.push(v)}const p=new Float64Array(d).fill(NaN);for(let w=0;w<d;w++){const v=f[w];v>=0&&(p[w]=x(o[w],l[v]))}return{assignments:f,centres:l,sizes:b,distances:p}}function m(o,u,d){const i=o.length;if(i===0)return 0;const g=new Int32Array(d);for(let n=0;n<i;n++)g[u[n]]++;let r=0;for(let n=0;n<i;n++){const f=u[n],h=new Float64Array(d);for(let a=0;a<i;a++)n!==a&&(h[u[a]]+=x(o[n],o[a]));const l=g[f]>1?h[f]/(g[f]-1):0;let b=1/0;for(let a=0;a<d;a++){if(a===f||g[a]===0)continue;const p=h[a]/g[a];p<b&&(b=p)}b!==1/0&&(r+=(b-l)/Math.max(l,b))}return r/i}function s(o,u={}){const d=o.length;if(!d)return null;const i=u.criterion==="silhouette"?"silhouette":"elbow",g=Math.max(2,Math.floor(u.maxK||8)),r=u.seed===void 0?1:u.seed;if(i==="silhouette"){const w=[],v=[];for(let V=2;V<=Math.min(g,d);V++){const W=y(o,{k:V,seed:r});W&&(w.push(V),v.push(m(o,W.assignments,V)))}if(!w.length)return null;let P=0;for(let V=1;V<v.length;V++)v[V]>v[P]&&(P=V);return{k:w[P],criterion:i,scores:v,ks:w}}const n=[],f=[];for(let w=1;w<=Math.min(g,d);w++){const v=y(o,{k:w,seed:r});v&&(n.push(w),f.push(v.inertia))}if(f.length<2)return null;const h={k:n[0],y:f[0]},l={k:n[n.length-1],y:f[f.length-1]},b=Math.hypot(l.k-h.k,l.y-h.y)||1;let a=0,p=-1/0;for(let w=0;w<f.length;w++){const v=Math.abs((l.k-h.k)*(h.y-f[w])-(h.k-n[w])*(l.y-h.y))/b;v>p&&(p=v,a=w)}return{k:n[a],criterion:i,scores:f,ks:n}}function t(o){const u=o.length,d=u?o[0].length:0;if(!u||!d)return null;const i=new Array(d).fill(0);for(let r=0;r<u;r++)for(let n=0;n<d;n++)i[n]+=o[r][n];for(let r=0;r<d;r++)i[r]/=u;const g=new Array(d).fill(0);for(let r=0;r<u;r++)for(let n=0;n<d;n++){const f=o[r][n]-i[n];g[n]+=f*f}for(let r=0;r<d;r++)g[r]=u>1?Math.sqrt(g[r]/(u-1)):0;for(let r=0;r<u;r++)for(let n=0;n<d;n++)g[n]>0?o[r][n]=(o[r][n]-i[n])/g[n]:o[r][n]=o[r][n]-i[n];return{mean:i,sd:g}}}),He("packages/core/src/compute/compare.js",function(e,D){"use strict";Object.defineProperty(e,"COMPARE_MEASURES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"pooledStandardMeanDifference",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"numericSummary",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"bothNumeric",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"compareColumnAcross",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"compareDatasets",{enumerable:!0,get:function(){return c}});const re=D("packages/core/src/compute/statistics.js"),N=re.numbers,G=re.moments,F=re.frequencyMap,L=re.categoricalDistance,Z=re.normalTotalVariation,z=re.isNumericColumn,x=re.SUBSET_RELIABILITY_FLOOR,Y=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function $(m,s){if(!m||!s||!(m.n>0)||!(s.n>0)||!Number.isFinite(m.mean)||!Number.isFinite(s.mean))return null;const t=(m.n*m.sd*m.sd+s.n*s.sd*s.sd)/(m.n+s.n);return t>0?(m.mean-s.mean)/Math.sqrt(t):null}function j(m,s){const t=N(m,s),{n:o,mean:u,m2:d}=G(t),i=o>0?Math.sqrt(d/o):0;return{mean:u,sd:i,n:o}}function k(m,s,t,o){return z(m,s)&&z(t,o)}function y(m,s,t,o){if(k(m,s,t,o)){const g=j(m,s),r=j(t,o),n=$(g,r);return{measure:Y.numeric,magnitude:n,distance:n===null?0:Z(n),direction:n===null?0:Math.sign(n),nA:g.n,nB:r.n,meanA:g.mean,meanB:r.mean,reliable:g.n>=x&&r.n>=x}}const u=F(m,s),d=F(t,o),i=L(u.map,u.total,d.map,d.total);return{measure:Y.categorical,magnitude:i,distance:i===null?0:i,direction:0,nA:u.total,nB:d.total,meanA:null,meanB:null,reliable:u.total>=x&&d.total>=x}}function c(m,s,t={}){const o=new Set(m.columns),u=new Set(s.columns),d=m.columns.filter(f=>u.has(f)),i=Array.isArray(t.columns)&&t.columns.length?d.filter(f=>t.columns.includes(f)):d,g=m.indices(),r=s.indices(),n=[];for(const f of i){const h=m.handle(f),l=s.handle(f);if(!h||!l)continue;const b=y(h,g,l,r);n.push({column:f,name:m.name&&m.name(f)||s.name&&s.name(f)||f,measure:b.measure,magnitude:b.magnitude,distance:b.distance,direction:b.direction,nA:b.nA,nB:b.nB,meanA:b.meanA,meanB:b.meanB,reliable:b.reliable})}return n.sort((f,h)=>h.distance-f.distance||Math.abs(h.magnitude||0)-Math.abs(f.magnitude||0)),{ranked:n,nA:g.length,nB:r.length,unmatched:{onlyA:m.columns.filter(f=>!u.has(f)),onlyB:s.columns.filter(f=>!o.has(f))},measures:Y}}}),He("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 Z}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return g}});const N=D("packages/core/src/compute/statistics.js").quantileSorted,F=D("packages/core/src/compute/special.js").logGamma,L=.6745,Z=3.5,z=1.5,x=.975,Y=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function $(r){if(!r.length)return null;const f=Array.from(r,Number).sort((a,p)=>a-p),h=N(f,.5),l=f.map(a=>Math.abs(a-h)).sort((a,p)=>a-p),b=N(l,.5);return{median:h,mad:b}}function j(r,n={}){const f=Number.isFinite(n.threshold)?n.threshold:Z,h=r.length,l=new Array(h).fill(null),b=new Array(h).fill(!1),a=[];for(let v=0;v<h;v++){const P=Number(r[v]);Number.isFinite(P)&&a.push(P)}if(!a.length)return{median:null,mad:null,threshold:f,scores:l,flags:b,flagged:0};const p=$(a);if(p.mad===0)return{median:p.median,mad:0,threshold:f,scores:l,flags:b,flagged:0};let w=0;for(let v=0;v<h;v++){const P=Number(r[v]);if(!Number.isFinite(P))continue;const V=L*(P-p.median)/p.mad;l[v]=V,Math.abs(V)>f&&(b[v]=!0,w++)}return{median:p.median,mad:p.mad,threshold:f,scores:l,flags:b,flagged:w}}function k(r,n={}){const f=Number.isFinite(n.k)?n.k:z,h=[];for(let w=0;w<r.length;w++){const v=Number(r[w]);Number.isFinite(v)&&h.push(v)}if(!h.length)return null;const l=h.sort((w,v)=>w-v),b=N(l,.25),a=N(l,.75),p=a-b;return{q1:b,q3:a,iqr:p,lower:b-f*p,upper:a+f*p,k:f}}function y(r,n){if(n<=0)return 0;const f=F(r);if(n<r+1){let v=r,P=1/r,V=P;for(let W=0;W<1e3&&(v+=1,V*=n/v,P+=V,!(Math.abs(V)<Math.abs(P)*1e-15));W++);return P*Math.exp(-n+r*Math.log(n)-f)}const h=1e-300;let l=n+1-r,b=1/h,a=1/l,p=a;for(let v=1;v<1e3;v++){const P=-v*(v-r);l+=2,a=P*a+l,Math.abs(a)<h&&(a=h),b=l+P/b,Math.abs(b)<h&&(b=h),a=1/a;const V=a*b;if(p*=V,Math.abs(V-1)<1e-15)break}return 1-Math.exp(-n+r*Math.log(n)-f)*p}function c(r,n){return r<=0?0:y(n/2,r/2)}function m(r,n=x){if(!(n>0)||!(n<1))return NaN;let f=0,h=Math.max(1,r);for(;c(h,r)<n;)h*=2;for(let l=0;l<200;l++){const b=(f+h)/2;if(c(b,r)<n?f=b:h=b,h-f<1e-10)break}return(f+h)/2}function s(r){const n=r.length,f=r.map((h,l)=>{const b=h.slice();for(let a=0;a<n;a++)b.push(l===a?1:0);return b});for(let h=0;h<n;h++){let l=h;for(let a=h+1;a<n;a++)Math.abs(f[a][h])>Math.abs(f[l][h])&&(l=a);if(Math.abs(f[l][h])<1e-12)return null;if(l!==h){const a=f[l];f[l]=f[h],f[h]=a}const b=f[h][h];for(let a=0;a<2*n;a++)f[h][a]/=b;for(let a=0;a<n;a++){if(a===h)continue;const p=f[a][h];if(p!==0)for(let w=0;w<2*n;w++)f[a][w]-=p*f[h][w]}}return f.map(h=>h.slice(n))}function t(r,n){const f=r.length,h=new Array(n).fill(0);for(const a of r)for(let p=0;p<n;p++)h[p]+=a[p];for(let a=0;a<n;a++)h[a]/=f;const l=Array.from({length:n},()=>new Array(n).fill(0));for(const a of r)for(let p=0;p<n;p++){const w=a[p]-h[p];for(let v=p;v<n;v++)l[p][v]+=w*(a[v]-h[v])}const b=f>1?f-1:1;for(let a=0;a<n;a++)for(let p=a;p<n;p++)l[a][p]/=b,l[p][a]=l[a][p];return{mean:h,cov:l}}function o(r,n={}){const f=Number.isFinite(n.p)?n.p:x,h=Number.isFinite(n.ridge)?n.ridge:1e-6,l=r.length;if(!l)return null;const b=r[0].length;if(!b)return null;const a=new Array(l).fill(null),p=new Array(l).fill(null),w=new Array(l).fill(!1),v=[],P=[];for(let M=0;M<l;M++){const T=r[M];let A=T.length===b;const I=new Array(b);for(let U=0;A&&U<b;U++){const X=Number(T[U]);Number.isFinite(X)?I[U]=X:A=!1}A&&(v.push(M),P.push(I))}const V=b,W=m(V,f);if(P.length<=b)return{center:[],df:V,cutoff:W,singular:!0,used:P.length,distances:a,squared:p,flags:w,flagged:0};const{mean:K,cov:R}=t(P,b);let S=s(R),E=!1;if(!S){E=!0;let M=0;for(let I=0;I<b;I++)M+=R[I][I];const T=M/b*h||h,A=R.map((I,U)=>I.map((X,q)=>U===q?X+T:X));if(S=s(A),!S)return{center:K,df:V,cutoff:W,singular:!0,used:P.length,distances:a,squared:p,flags:w,flagged:0}}let O=0;for(let M=0;M<P.length;M++){const T=P[M],A=new Array(b);for(let X=0;X<b;X++)A[X]=T[X]-K[X];let I=0;for(let X=0;X<b;X++){let q=0;for(let _=0;_<b;_++)q+=S[X][_]*A[_];I+=A[X]*q}I<0&&(I=0);const U=v[M];p[U]=I,a[U]=Math.sqrt(I),I>W&&(w[U]=!0,O++)}return{center:K,df:V,cutoff:W,singular:E,used:P.length,distances:a,squared:p,flags:w,flagged:O}}const u=20,d=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function i(r,n={}){const f=n.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",h=Number.isFinite(n.windowLen)&&n.windowLen>=1?Math.floor(n.windowLen):u,l=Number.isFinite(n.threshold)?n.threshold:Z,b=Number.isFinite(n.k)?n.k:z,a=Number.isFinite(n.minPeriods)&&n.minPeriods>=1?Math.floor(n.minPeriods):h,p=r.length,w=new Array(p).fill(null),v=new Array(p).fill(!1);let P=0;for(let V=0;V<p;V++){const W=Number(r[V]);if(!Number.isFinite(W))continue;const K=Math.max(0,V-h+1),R=[];for(let S=K;S<=V;S++){const E=Number(r[S]);Number.isFinite(E)&&R.push(E)}if(!(R.length<a))if(f==="rollingIqr"){const S=k(R,{k:b});if(!S)continue;(W<S.lower||W>S.upper)&&(v[V]=!0,P++)}else{const S=$(R);if(!S||S.mad===0)continue;const E=L*(W-S.median)/S.mad;w[V]=E,Math.abs(E)>l&&(v[V]=!0,P++)}}return{method:f,windowLen:h,minPeriods:a,threshold:l,k:b,scores:w,flags:v,flagged:P}}function g(r={}){const n=r||{},f=n.field;if(typeof f!="string"||!f)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const h=n.method||"modifiedZScore";if(!(Y.includes(h)||d.includes(h))||h==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${h}'`);const b=typeof n.orderBy=="string"?n.orderBy:null,a=n.latest===!0,p=d.includes(h),w=v=>Number(v==null?NaN:v[f]);return v=>{const P=Array.isArray(v)?v.slice():[...v];b&&P.sort((S,E)=>{const O=S?.[b],M=E?.[b];return O===M?0:O==null?-1:M==null?1:O<M?-1:1});const V=P.map(w);let W,K;if(p)({flags:W,scores:K}=i(V,{method:h,windowLen:n.windowLen,threshold:n.threshold,k:n.k,minPeriods:n.minPeriods}));else if(h==="iqr"){const S=k(V,{k:n.k});W=V.map(E=>S?Number.isFinite(E)&&(E<S.lower||E>S.upper):!1),K=V.map(()=>null)}else({flags:W,scores:K}=j(V,{threshold:n.threshold}));if(a){const S=W.length-1;return S<0||!W[S]?!1:{method:h,field:f,flagged:[{row:P[S],score:K[S]}]}}const R=[];for(let S=0;S<W.length;S++)W[S]&&R.push({row:P[S],score:K[S]});return R.length?{method:h,field:f,flagged:R}:!1}}}),He("packages/core/src/compute/forecast.js",function(e,D){"use strict";Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r}});const re=D("packages/core/src/compute/special.js"),N=re.normalQuantile,G=re.studentTQuantile,L=D("packages/core/src/internal/warn.js").warnOnce,Z=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),z=1e-4,x=1-1e-4;function Y(n){const f=[];for(let h=0;h<n.length;h++){const l=n[h];if(l!==null&&typeof l=="object"){const b=Number.isFinite(l.at)?l.at:h,a=Number.isFinite(l.value)?l.value:null;f.push({at:b,value:a})}else f.push({at:h,value:Number.isFinite(l)?Number(l):null})}return f}function $(n){const f=n.filter(p=>p.value!==null),h=f[0],l=f[f.length-1],b=l.at-h.at,a=f.length>1&&b>0?b/(f.length-1):1;return{lastAt:l.at,step:a}}function j(n){return Math.min(x,Math.max(z,n))}function k(n,f=z,h=x,l=80){const b=(Math.sqrt(5)-1)/2;let a=f,p=h,w=p-b*(p-a),v=a+b*(p-a),P=n(w),V=n(v);for(let W=0;W<l;W++)P<V?(p=v,v=w,V=P,w=p-b*(p-a),P=n(w)):(a=w,w=v,P=V,v=a+b*(p-a),V=n(v));return(a+p)/2}function y(n,f){let h=null,l=0,b=0;for(let a=0;a<n.length;a++){const p=n[a];if(p!==null){if(h===null){h=p;continue}l+=(p-h)**2,b+=1,h=f*p+(1-f)*h}}return{level:h,sse:l,m:b}}function c(n,f,h){let l=null,b=null,a=0,p=0;for(let w=0;w<n.length;w++){const v=n[w];if(v===null){l!==null&&b!==null&&(l+=b);continue}if(l===null){l=v;continue}b===null&&(b=v-l);const P=l+b;a+=(v-P)**2,p+=1;const V=l;l=f*v+(1-f)*(V+b),b=h*(l-V)+(1-h)*b}return{level:l,trend:b,sse:a,m:p}}function m(n,f,h,l,b){const a=n.length;if(a<2*f)return null;const p=E=>{let O=0,M=0;for(let T=E;T<E+f&&T<a;T++)n[T]!==null&&(O+=n[T],M+=1);return M?O/M:null},w=p(0),v=p(f);if(w===null||v===null)return null;let P=w,V=(v-w)/f;const W=new Array(f).fill(0);for(let E=0;E<f;E++)W[E]=n[E]===null?0:n[E]-P;const K=W.reduce((E,O)=>E+O,0)/f;for(let E=0;E<f;E++)W[E]-=K;let R=0,S=0;for(let E=f;E<a;E++){const O=E%f,M=W[O],T=n[E];if(T===null){P+=V;continue}const A=P+V+M;R+=(T-A)**2,S+=1;const I=P;P=h*(T-M)+(1-h)*(P+V),V=l*(P-I)+(1-l)*V,W[O]=b*(T-P)+(1-b)*M}return{level:P,trend:V,season:W,phase:(a-1)%f,sse:R,count:S}}function s(n,f,h){let l=1;for(const a of f)l+=a*a;const b=Math.sqrt(n*l);return{se:b,margin:h*b}}function t(n,f={}){if(!n||typeof n.length!="number"||n.length===0)return null;const h=Z.includes(f.method)?f.method:"linear",l=Math.max(1,Math.floor(Number(f.horizon)||1)),b=Number.isFinite(f.confidence)&&f.confidence>0&&f.confidence<1?f.confidence:.95,a=1-(1-b)/2,p=Y(n),w=p.map(R=>R.value),v=w.filter(R=>R!==null),P=v.length,{lastAt:V,step:W}=P?$(p):{lastAt:0,step:1},K=R=>V+R*W;return h==="linear"?o(p,P,l,b,a,K):h==="movingAverage"?u(v,P,l,b,a,f,K):h==="ses"?d(w,P,l,b,a,f,K):h==="holt"?i(w,P,l,b,a,f,K):g(w,P,l,b,a,f,K)}function o(n,f,h,l,b,a){if(f<2)return null;let p=0,w=0;for(const T of n)T.value!==null&&(p+=T.at,w+=T.value);p/=f,w/=f;let v=0,P=0,V=0;for(const T of n){if(T.value===null)continue;const A=T.at-p,I=T.value-w;v+=A*A,P+=A*I,V+=I*I}if(v===0)return null;const W=P/v,K=w-W*p,R=V===0?1:Math.max(0,Math.min(1,P*P/(v*V))),S=Math.max(0,V-W*P),E=f>2?Math.sqrt(S/(f-2)):null,O=f>2?G(b,f-2):null,M=[];for(let T=1;T<=h;T++){const A=a(T),I=K+W*A;let U=null,X=null,q=null,_=null,H=null;if(E!==null){const ee=1/f+(A-p)**2/v,te=E*Math.sqrt(1+ee),J=E*Math.sqrt(ee);H=te,U=I-O*te,X=I+O*te,q=I-O*J,_=I+O*J}M.push({step:T,at:A,mean:I,lower:U,upper:X,lowerMean:q,upperMean:_,se:H})}return{method:"linear",horizon:h,confidence:l,n:f,sigma:E,r2:R,params:{slope:W,intercept:K},points:M}}function u(n,f,h,l,b,a,p){if(f<1)return null;const w=Math.max(1,Math.min(f,Math.floor(Number(a.windowLen)||f))),v=n.slice(f-w);let P=0;for(const E of v)P+=E;const V=P/w;let W=null,K=null;if(w>1){let E=0;for(const M of v)E+=(M-V)**2;W=Math.sqrt(E/(w-1))*Math.sqrt(1+1/w),K=G(b,w-1)}const R=W===null?null:K*W,S=[];for(let E=1;E<=h;E++)S.push({step:E,at:p(E),mean:V,lower:R===null?null:V-R,upper:R===null?null:V+R,se:W});return{method:"movingAverage",horizon:h,confidence:l,n:f,sigma:W===null?null:W,params:{windowLen:w},points:S}}function d(n,f,h,l,b,a,p){if(f<1)return null;let w=Number.isFinite(a.alpha)?j(a.alpha):null;w===null&&(w=k(K=>y(n,K).sse));const v=y(n,w),P=N(b),V=v.m>0?v.sse/v.m:null,W=[];for(let K=1;K<=h;K++){const R=v.level;let S=null,E=null,O=null;if(V!==null){const M=[];for(let A=1;A<K;A++)M.push(w);const T=s(V,M,P);O=T.se,S=R-T.margin,E=R+T.margin}W.push({step:K,at:p(K),mean:R,lower:S,upper:E,se:O})}return{method:"ses",horizon:h,confidence:l,n:f,sigma:V===null?null:Math.sqrt(V),params:{alpha:w},points:W}}function i(n,f,h,l,b,a,p){if(f<2)return null;let w=Number.isFinite(a.alpha)?j(a.alpha):null,v=Number.isFinite(a.beta)?j(a.beta):null;if(w===null||v===null){let S=w===null?.5:w,E=v===null?.5:v;for(let O=0;O<6;O++)w===null&&(S=k(M=>c(n,M,E).sse)),v===null&&(E=k(M=>c(n,S,M).sse));w=w===null?S:w,v=v===null?E:v}const P=c(n,w,v),V=N(b),W=P.m>0?P.sse/P.m:null,K=w*v,R=[];for(let S=1;S<=h;S++){const E=P.level+S*P.trend;let O=null,M=null,T=null;if(W!==null){const A=[];for(let U=1;U<S;U++)A.push(w+U*K);const I=s(W,A,V);T=I.se,O=E-I.margin,M=E+I.margin}R.push({step:S,at:p(S),mean:E,lower:O,upper:M,se:T})}return{method:"holt",horizon:h,confidence:l,n:f,sigma:W===null?null:Math.sqrt(W),params:{alpha:w,beta:v},points:R}}function g(n,f,h,l,b,a,p){const w=Math.floor(Number(a.period));if(!(w>=2))return L("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(f<2*w)return null;let v=Number.isFinite(a.alpha)?j(a.alpha):null,P=Number.isFinite(a.beta)?j(a.beta):null,V=Number.isFinite(a.gamma)?j(a.gamma):null;const W=(T,A,I)=>{const U=m(n,w,T,A,I);return U?U.sse:1/0};if(v===null||P===null||V===null){let T=v===null?.5:v,A=P===null?.5:P,I=V===null?.5:V;for(let U=0;U<8;U++)v===null&&(T=k(X=>W(X,A,I))),P===null&&(A=k(X=>W(T,X,I))),V===null&&(I=k(X=>W(T,A,X)));v=v===null?T:v,P=P===null?A:P,V=V===null?I:V}const K=m(n,w,v,P,V);if(!K)return null;const R=N(b),S=K.count>0?K.sse/K.count:null,E=v*P,O=V*(1-v),M=[];for(let T=1;T<=h;T++){const A=K.season[(K.phase+T)%w],I=K.level+T*K.trend+A;let U=null,X=null,q=null;if(S!==null){const _=[];for(let ee=1;ee<T;ee++)_.push(v+ee*E+(ee%w===0?O:0));const H=s(S,_,R);q=H.se,U=I-H.margin,X=I+H.margin}M.push({step:T,at:p(T),mean:I,lower:U,upper:X,se:q})}return{method:"holtWinters",horizon:h,confidence:l,n:f,sigma:S===null?null:Math.sqrt(S),params:{alpha:v,beta:P,gamma:V,period:w},points:M}}const r={FORECAST_METHODS:Z,forecast:t}}),He("packages/core/src/compute/hypothesis.js",function(e,D){"use strict";Object.defineProperty(e,"GROUP_TESTS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"NORMALITY_ALPHA",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"HL_PAIR_LIMIT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"welchTTest",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"mannWhitneyUTest",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"chiSquareTest",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return R}});const N=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/compute/handle.js").valueReader,L=D("packages/core/src/compute/statistics.js"),Z=L.numbers,z=L.moments,x=L.frequencyMap,Y=L.categoricalDistance,$=L.isNumericColumn,j=L.jarqueBera,k=L.proportionInterval,y=L.SUBSET_RELIABILITY_FLOOR,m=D("packages/core/src/compute/compare.js").pooledStandardMeanDifference,s=D("packages/core/src/compute/special.js"),t=s.studentT,o=s.studentTQuantile,u=s.normalCdf,d=s.normalQuantile,i=s.chiSquareUpperTail,g=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),r=.05,n=2e6;function f(S){const E=Number(S);return Number.isFinite(E)&&E>0&&E<1?E:.95}function h(S){const{n:E,mean:O,m2:M}=z(S);return{mean:O,sd:E>0?Math.sqrt(M/E):0,n:E}}function l(S,E){const O=S.length;if(O<2)return 0;let M=0;for(let T=0;T<O;T++){const A=S[T]-E;M+=A*A}return M/(O-1)}function b(S,E){return{name:"pooledStandardMeanDifference",value:m(h(S),h(E))}}function a(S,E,O){const M=S.length,T=E.length;if(M<2||T<2)return null;const A=f(O),{mean:I}=z(S),{mean:U}=z(E),X=l(S,I),q=l(E,U),_=X/M+q/T;if(!(_>0))return null;const H=Math.sqrt(_),ee=(I-U)/H,te=X/M*(X/M)/(M-1),J=q/T*(q/T)/(T-1),ne=_*_/(te+J),se=Math.min(1,Math.max(0,2*(1-t(Math.abs(ee),ne)))),ae=I-U,we=o(1-(1-A)/2,ne)*H;return{test:g.WELCH,statistic:ee,statisticName:"t",df:ne,pValue:se,interval:{estimate:ae,lower:ae-we,upper:ae+we,confidence:A,method:"welch-t (difference of means)"},effectSize:b(S,E),nA:M,nB:T,reliable:M>=y&&T>=y,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function p(S){const E=S.length;if(E===0)return Number.NaN;const O=E>>1;return E%2?S[O]:(S[O-1]+S[O])/2}function w(S,E,O){const M=S.length,T=E.length,A=M*T;if(A===0||A>n)return null;const I=new Float64Array(A);let U=0;for(let te=0;te<M;te++)for(let J=0;J<T;J++)I[U++]=S[te]-E[J];I.sort();const X=p(I),q=Math.sqrt(M*T*(M+T+1)/12),_=d(1-(1-O)/2);let H=Math.round(A/2-_*q);H>=0||(H=0);const ee=Math.floor((A-1)/2);return H>ee&&(H=ee),{estimate:X,lower:I[H],upper:I[A-1-H],confidence:O,method:"hodges-lehmann (normal approximation)"}}function v(S,E,O){const M=S.length,T=E.length;if(M<1||T<1)return null;const A=f(O),I=M+T,U=new Array(I);for(let se=0;se<M;se++)U[se]={v:S[se],g:0};for(let se=0;se<T;se++)U[M+se]={v:E[se],g:1};U.sort((se,ae)=>se.v-ae.v);let X=0,q=0,_=0;for(;_<I;){let se=_;for(;se<I&&U[se].v===U[_].v;)se++;const ae=se-_,we=(_+1+se)/2;for(let fe=_;fe<se;fe++)U[fe].g===0&&(X+=we);q+=ae*ae*ae-ae,_=se}const H=X-M*(M+1)/2,ee=M*T/2,te=M*T/12*(I+1-q/(I*(I-1)));let J=1;if(te>0){const se=Math.max(0,Math.abs(H-ee)-.5);J=Math.min(1,2*u(-se/Math.sqrt(te)))}const ne=w(S,E,A);return{test:g.MANN_WHITNEY,statistic:H,statisticName:"U",df:null,pValue:J,interval:ne,effectSize:b(S,E),nA:M,nB:T,reliable:M>=y&&T>=y,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function P(S,E,O,M,T){const A=k(S,E,T),I=k(O,M,T);if(!A||!I)return null;const U=A.proportion-I.proportion,X=U-Math.sqrt((A.proportion-A.lower)**2+(I.upper-I.proportion)**2),q=U+Math.sqrt((A.upper-A.proportion)**2+(I.proportion-I.lower)**2);return{lower:X,upper:q}}function V(S,E,O,M,T,A={}){if(!(E>0)||!(M>0))return null;const I=new Set([...S.keys(),...O.keys()]),U=I.size;if(U<2)return null;const X=E+M;let q=0;for(const J of I){const ne=S.get(J)||0,se=O.get(J)||0,ae=ne+se,we=E*ae/X,fe=M*ae/X;we>0&&(q+=(ne-we)*(ne-we)/we),fe>0&&(q+=(se-fe)*(se-fe)/fe)}const _=U-1,H=i(q,_);let ee=null;A.category!==void 0&&I.has(A.category)?ee=A.category:U===2&&([ee]=[...I]);let te=null;if(ee!==null){const J=P(S.get(ee)||0,E,O.get(ee)||0,M,f(T));J&&(te={estimate:(S.get(ee)||0)/E-(O.get(ee)||0)/M,lower:J.lower,upper:J.upper,confidence:f(T),method:"newcombe (difference in this category's share)",category:ee})}return{test:g.CHI_SQUARE,statistic:q,statisticName:"chiSquare",df:_,pValue:H,interval:te,effectSize:{name:"categoricalTotalVariation",value:Y(S,E,O,M)},nA:E,nB:M,reliable:E>=y&&M>=y,method:"Pearson chi-square test of independence (2×k, no continuity correction)"}}function W(S){return S==null||S===""||typeof S=="number"&&Number.isNaN(S)?null:S instanceof Date?S.getTime():typeof S=="object"?String(S):S}function K(S,E,O){if(O===g.WELCH||O===g.MANN_WHITNEY)return{test:O,chosenBy:"override",reason:`caller override: ${O}`};const M=j(S),T=j(E),A=M===null?null:Math.exp(-M/2),I=T===null?null:Math.exp(-T/2);return A!==null&&A<r||I!==null&&I<r?{test:g.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${r})`}:{test:g.WELCH,chosenBy:"auto",reason:A!==null||I!==null?"column family: numeric, no departure from normality detected":"column family: numeric (too few rows to screen normality)"}}function R(S,E,O,M={}){if(!S||!E)return null;const T=f(M.confidence),A=F(E);let I;if(Array.isArray(M.groups)&&M.groups.length===2)I=[W(M.groups[0]),W(M.groups[1])];else{const{map:se}=x(E,O),ae=[...se.entries()].sort((we,fe)=>fe[1]-we[1]).slice(0,2).map(we=>we[0]);if(ae.length<2)return N("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;I=ae}const[U,X]=I;if(U===null||X===null||U===X)return N("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const q=[],_=[];for(let se=0;se<O.length;se++){const ae=W(A(O[se]));ae===U?q.push(O[se]):ae===X&&_.push(O[se])}if(q.length===0||_.length===0)return N("compareGroups:empty","[lattice] compareGroups: one of the two groups has no rows in the current set."),null;const H=M.test&&M.test!=="auto"?String(M.test):null,ee=$(S,q.concat(_));let te,J,ne;if(H===g.CHI_SQUARE||!H&&!ee){J=H?"override":"auto",ne=H?"caller override: chiSquare":"column family: categorical";const se=x(S,q),ae=x(S,_);te=V(se.map,se.total,ae.map,ae.total,T,{category:M.category})}else{if((H===g.WELCH||H===g.MANN_WHITNEY)&&!ee)return N("compareGroups:numeric-override",`[lattice] compareGroups: ${H} needs a numeric column, but the column is not numeric.`),null;const se=Z(S,q),ae=Z(S,_),we=K(se,ae,H);J=we.chosenBy,ne=we.reason,te=we.test===g.MANN_WHITNEY?v(se,ae,T):a(se,ae,T)}return te?{...te,chosenBy:J,reason:ne,groups:[U,X]}:(N("compareGroups:degenerate","[lattice] compareGroups: the chosen test had too little to work with (too few values, or no variation)."),null)}}),He("packages/core/src/compute/significance.js",function(e,D){"use strict";Object.defineProperty(e,"COMPARE_TESTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"compare",{enumerable:!0,get:function(){return ge}});const N=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/compute/handle.js").valueReader,L=D("packages/core/src/compute/statistics.js"),Z=L.numbers,z=L.moments,x=L.frequencyMap,Y=L.isNumericColumn,$=L.jarqueBera,j=L.proportionInterval,k=D("packages/core/src/compute/special.js"),y=k.studentT,c=k.studentTQuantile,m=k.normalCdf,s=k.normalQuantile,t=k.chiSquareUpperTail,o=k.incompleteBeta,u=Object.freeze({T:"t",WELCH:"welch",MANN_WHITNEY:"mannWhitney",ANOVA:"anova",KRUSKAL:"kruskal",CHI_SQUARE:"chiSquare",PROPORTIONS:"proportions"}),d=new Set([u.T,u.WELCH,u.MANN_WHITNEY]),i=new Set([u.ANOVA,u.KRUSKAL]),g=new Set([u.CHI_SQUARE,u.PROPORTIONS]),r=.05,n=[.2,.5,.8],f=[.147,.33,.474],h=[.01,.06,.14],l=[[.1,.3,.5],[.07,.21,.35],[.06,.17,.29],[.05,.15,.25]];function b(de){const oe=Number(de);return Number.isFinite(oe)&&oe>0&&oe<1?oe:.05}function a(de){return de==null||de===""||typeof de=="number"&&Number.isNaN(de)?null:de instanceof Date?de.getTime():typeof de=="object"?String(de):de}function p(de,oe){const he=F(de),ce=[],me=new Map;for(let ye=0;ye<oe.length;ye++){const xe=a(he(oe[ye]));if(xe===null)continue;let Se=me.get(xe);Se||(Se={value:xe,rows:[]},me.set(xe,Se),ce.push(Se)),Se.rows.push(oe[ye])}return ce}function w(de){const{n:oe,mean:he,m2:ce}=z(de),me=oe>1?ce/(oe-1):0;return{n:oe,mean:he,sd:Math.sqrt(me),variance:me}}function v(de,oe,he){if(!(oe>0)||!(he>0)||!(de>=0)||!Number.isFinite(de))return Number.NaN;if(de===0)return 1;const ce=oe*de/(oe*de+he);return 1-o(oe/2,he/2,ce)}function P(de,oe){const he=Math.abs(de);return Number.isFinite(he)?he>=oe[2]?"large":he>=oe[1]?"medium":he>=oe[0]?"small":"negligible":"negligible"}function V(de,oe,he){if(de==="cohensD")return P(oe,n);if(de==="cliffsDelta")return P(oe,f);if(de==="etaSquared")return P(oe,h);const ce=Math.max(1,Math.min(l.length,Math.floor(he||1)));return P(oe,l[ce-1])}function W(de,oe){if(!(de.n>1)||!(oe.n>1))return null;const he=((de.n-1)*de.variance+(oe.n-1)*oe.variance)/(de.n+oe.n-2);return he>0?(de.mean-oe.mean)/Math.sqrt(he):null}function K(de,oe){const he=de.length,ce=oe.length;if(!he||!ce)return null;const me=Array.from(oe).sort((Se,Te)=>Se-Te);let ye=0,xe=0;for(let Se=0;Se<he;Se++){const Te=de[Se];let Be=0,Ee=ce;for(;Be<Ee;){const Oe=Be+Ee>>1;me[Oe]<Te?Be=Oe+1:Ee=Oe}const Ge=Be;let Ne=Be;for(;Ne<ce&&me[Ne]===Te;)Ne++;const ke=Ne-Be;ye+=Ge,xe+=ce-Ne}return(ye-xe)/(he*ce)}function R(de,oe,he,ce){const me=Math.min(he-1,ce-1);return!(oe>0)||!(me>0)?null:Math.sqrt(de/(oe*me))}function S(de){return Number.isFinite(de)?de<.001?"p < 0.001":de>=.995?"p > 0.995":`p = ${de.toFixed(3)}`:"p = —"}function E(de){if(!Number.isFinite(de))return"0";const oe=Math.abs(de);return oe===0?"0":oe>=1e3?String(Math.round(de)):oe>=100?String(Number(de.toFixed(0))):oe>=10?String(Number(de.toFixed(1))):oe>=1?String(Number(de.toFixed(2))):String(Number(de.toPrecision(2)))}const O=new Set(["cohensD","cliffsDelta"]);function M(de){if(de.difference!=null&&Math.abs(de.difference)>=1e-12)return Math.sign(de.difference);const oe=de.effectSize;if(oe&&O.has(oe.name)&&Number.isFinite(oe.value)&&Math.abs(oe.value)>=1e-12)return Math.sign(oe.value);const[he,ce]=de.groups;return Number.isFinite(he.mean)&&Number.isFinite(ce.mean)&&he.mean!==ce.mean?Math.sign(he.mean-ce.mean):0}function T(de){const oe=de.measureName||"values";return{subject:oe.charAt(0).toUpperCase()+oe.slice(1),be:oe==="values"?"are":"is",name:oe}}function A(de,oe){const he=oe.unit?` ${oe.unit}`:"",{subject:ce,be:me}=T(oe),ye=de.groups[0].label,xe=de.groups[1].label,Se=de.effectSize?de.effectSize.label:"negligible",Te=de.pValue<de.alpha,Be=Te?"unlikely to be chance":"consistent with chance";if(!Te&&Se==="negligible")return`${ce} ${me} essentially the same for ${ye} and ${xe} (${S(de.pValue)}); the effect is ${Se}.`;const Ee=M(de),Ge=`the difference is ${Be} (${S(de.pValue)}) and the effect is ${Se}.`;if(Ee===0)return`${ce} ${me} different between ${ye} and ${xe}; ${Ge}`;const Ne=Ee>0?ye:xe,ke=Ee>0?xe:ye,Re=de.difference!=null&&Math.abs(de.difference)>=1e-12?` by about ${E(Math.abs(de.difference))}${he}`:"";return`${ce} ${me} higher for ${Ne} than for ${ke}${Re}; ${Ge}`}function I(de,oe){const{name:he}=T(oe),ce=de.effectSize?de.effectSize.label:"negligible",me=S(de.pValue);return de.pValue<de.alpha?`The groups differ in ${he}; the difference is unlikely to be chance (${me}) and the effect is ${ce}.`:ce==="negligible"?`The groups are essentially the same in ${he} (${me}); the effect is ${ce}.`:`The groups show a ${ce} effect in ${he}, but the difference is consistent with chance (${me}).`}function U(de,oe){const he=de.length;if(he<2)return null;const{mean:ce,m2:me}=z(de),ye=me/(he-1);if(!(ye>0))return null;const xe=Math.sqrt(ye),Se=xe/Math.sqrt(he),Te=ce/Se,Be=he-1,Ee=Math.min(1,Math.max(0,2*(1-y(Math.abs(Te),Be)))),Ge=c(1-oe/2,Be)*Se,Ne=ce/xe;return{test:u.T,statistic:Te,statisticName:"t",df:Be,pValue:Ee,difference:ce,interval:{estimate:ce,lower:ce-Ge,upper:ce+Ge,confidence:1-oe,method:"paired-t (mean of the pair differences)"},effectSize:{name:"cohensD",label:P(Ne,n),value:Ne}}}function X(de,oe){const he=Array.from(de).filter(Re=>Re!==0),ce=he.length;if(!ce)return null;const me=Array.from({length:ce},(Re,Le)=>Le).sort((Re,Le)=>Math.abs(he[Re])-Math.abs(he[Le])),ye=new Array(ce);let xe=0;for(;xe<ce;){let Re=xe;for(;Re+1<ce&&Math.abs(he[me[Re+1]])===Math.abs(he[me[xe]]);)Re++;const Le=(xe+Re)/2+1;for(let ze=xe;ze<=Re;ze++)ye[me[ze]]=Le;xe=Re+1}let Se=0,Te=0;for(let Re=0;Re<ce;Re++)Te+=ye[Re],he[Re]>0&&(Se+=ye[Re]);const Be=Te-Se,Ee=ce*(ce+1)/4,Ge=Math.sqrt(ce*(ce+1)*(2*ce+1)/24),Ne=Ge>0?(Math.abs(Se-Ee)-.5)/Ge:0,ke=Math.min(1,Math.max(0,2*m(-Math.max(0,Ne)))),Oe=Te>0?(Se-Be)/Te:0;return{test:u.MANN_WHITNEY,statistic:Se,statisticName:"W",df:null,pValue:ke,difference:null,interval:null,effectSize:{name:"cliffsDelta",label:P(Oe,f),value:Oe}}}function q(de,oe,he){const ce=w(de),me=w(oe);if(ce.n<2||me.n<2)return null;const ye=((ce.n-1)*ce.variance+(me.n-1)*me.variance)/(ce.n+me.n-2);if(!(ye>0))return null;const xe=Math.sqrt(ye*(1/ce.n+1/me.n)),Se=(ce.mean-me.mean)/xe,Te=ce.n+me.n-2,Be=Math.min(1,Math.max(0,2*(1-y(Math.abs(Se),Te)))),Ee=ce.mean-me.mean,Ge=c(1-he/2,Te)*xe,Ne=W(ce,me);return{test:u.T,statistic:Se,statisticName:"t",df:Te,pValue:Be,difference:Ee,interval:{estimate:Ee,lower:Ee-Ge,upper:Ee+Ge,confidence:1-he,method:"student-t (pooled variance, difference of means)"},effectSize:{name:"cohensD",label:P(Ne,n),value:Ne},summaries:[ce,me]}}function _(de,oe,he){const ce=w(de),me=w(oe);if(ce.n<2||me.n<2)return null;const ye=ce.variance/ce.n+me.variance/me.n;if(!(ye>0))return null;const xe=Math.sqrt(ye),Se=(ce.mean-me.mean)/xe,Te=ce.variance/ce.n*(ce.variance/ce.n)/(ce.n-1),Be=me.variance/me.n*(me.variance/me.n)/(me.n-1),Ee=ye*ye/(Te+Be),Ge=Math.min(1,Math.max(0,2*(1-y(Math.abs(Se),Ee)))),Ne=ce.mean-me.mean,ke=c(1-he/2,Ee)*xe,Oe=W(ce,me);return{test:u.WELCH,statistic:Se,statisticName:"t",df:Ee,pValue:Ge,difference:Ne,interval:{estimate:Ne,lower:Ne-ke,upper:Ne+ke,confidence:1-he,method:"welch-t (unequal variances, difference of means)"},effectSize:{name:"cohensD",label:P(Oe,n),value:Oe},summaries:[ce,me]}}function H(de,oe,he){const ce=de.length,me=oe.length;if(ce<1||me<1)return null;const ye=w(de),xe=w(oe),Se=ce+me,Te=new Array(Se);for(let ze=0;ze<ce;ze++)Te[ze]={v:de[ze],g:0};for(let ze=0;ze<me;ze++)Te[ce+ze]={v:oe[ze],g:1};Te.sort((ze,Ye)=>ze.v-Ye.v);let Be=0,Ee=0,Ge=0;for(;Ge<Se;){let ze=Ge;for(;ze<Se&&Te[ze].v===Te[Ge].v;)ze++;const Ye=(Ge+1+ze)/2;for(let tt=Ge;tt<ze;tt++)Te[tt].g===0&&(Be+=Ye);const et=ze-Ge;Ee+=et*et*et-et,Ge=ze}const Ne=Be-ce*(ce+1)/2,ke=ce*me/2,Oe=ce*me/12*(Se+1-Ee/(Se*(Se-1)));let Re=1;if(Oe>0){const ze=Math.max(0,Math.abs(Ne-ke)-.5);Re=Math.min(1,2*m(-ze/Math.sqrt(Oe)))}const Le=K(de,oe);return{test:u.MANN_WHITNEY,statistic:Ne,statisticName:"U",df:null,pValue:Re,difference:null,interval:ee(de,oe,1-he),effectSize:{name:"cliffsDelta",label:P(Le,f),value:Le},summaries:[ye,xe]}}function ee(de,oe,he){const ce=de.length,me=oe.length,ye=ce*me;if(ye===0||ye>2e6)return null;const xe=new Float64Array(ye);let Se=0;for(let Oe=0;Oe<ce;Oe++)for(let Re=0;Re<me;Re++)xe[Se++]=de[Oe]-oe[Re];xe.sort();const Te=ye>>1,Be=ye%2?xe[Te]:(xe[Te-1]+xe[Te])/2,Ee=Math.sqrt(ce*me*(ce+me+1)/12),Ge=s(1-(1-he)/2);let Ne=Math.round(ye/2-Ge*Ee);Ne>=0||(Ne=0);const ke=Math.floor((ye-1)/2);return Ne>ke&&(Ne=ke),{estimate:Be,lower:xe[Ne],upper:xe[ye-1-Ne],confidence:he,method:"hodges-lehmann (location shift)"}}function te(de,oe){const he=de.length,ce=de.map(w);if(ce.some(Re=>Re.n<2))return null;const me=ce.reduce((Re,Le)=>Re+Le.n,0),ye=ce.reduce((Re,Le)=>Re+Le.mean*Le.n,0)/me;let xe=0,Se=0;for(let Re=0;Re<he;Re++)xe+=ce[Re].n*(ce[Re].mean-ye)**2,Se+=(ce[Re].n-1)*ce[Re].variance;const Te=he-1,Be=me-he;if(!(Se>0)||Be<1)return null;const Ee=xe/Te,Ge=Se/Be,Ne=Ee/Ge,ke=Math.min(1,Math.max(0,v(Ne,Te,Be))),Oe=xe/(xe+Se);return{test:u.ANOVA,statistic:Ne,statisticName:"F",df:{between:Te,within:Be},pValue:ke,difference:null,interval:null,effectSize:{name:"etaSquared",label:P(Oe,h),value:Oe},summaries:ce}}function J(de,oe){const he=de.length,ce=de.map(w);if(he<2)return null;const me=ce.reduce((Le,ze)=>Le+ze.n,0),ye=[];for(let Le=0;Le<he;Le++)for(let ze=0;ze<de[Le].length;ze++)ye.push({v:de[Le][ze],g:Le});ye.sort((Le,ze)=>Le.v-ze.v);const xe=new Array(ye.length);let Se=0,Te=0;for(;Te<ye.length;){let Le=Te;for(;Le<ye.length&&ye[Le].v===ye[Te].v;)Le++;const ze=(Te+1+Le)/2;for(let et=Te;et<Le;et++)xe[et]=ze;const Ye=Le-Te;Se+=Ye*Ye*Ye-Ye,Te=Le}const Be=new Array(he).fill(0);for(let Le=0;Le<ye.length;Le++)Be[ye[Le].g]+=xe[Le];let Ee=0;for(let Le=0;Le<he;Le++)Ee+=Be[Le]*Be[Le]/ce[Le].n;Ee=12/(me*(me+1))*Ee-3*(me+1);const Ge=1-Se/(me*me*me-me),Ne=Ge>0?Ee/Ge:Ee,ke=he-1,Oe=Math.min(1,Math.max(0,t(Ne,ke))),Re=(Ne-he+1)/(me-he);return{test:u.KRUSKAL,statistic:Ne,statisticName:"H",df:ke,pValue:Oe,difference:null,interval:null,effectSize:{name:"etaSquared",label:P(Re,h),value:Math.max(0,Re)},summaries:ce}}function ne(de,oe,he,ce,me){const ye=j(de,oe,me),xe=j(he,ce,me);if(!ye||!xe)return null;const Se=ye.proportion-xe.proportion,Te=Se-Math.sqrt((ye.proportion-ye.lower)**2+(xe.upper-xe.proportion)**2),Be=Se+Math.sqrt((ye.upper-ye.proportion)**2+(xe.proportion-xe.lower)**2);return{estimate:Se,lower:Te,upper:Be}}function se(de,oe,he,ce){const me=F(oe),ye=new Set,xe=[];for(const ze of de){const Ye=new Map;let et=0;for(const tt of ze.rows){const pt=a(me(tt));pt!==null&&(Ye.set(pt,(Ye.get(pt)||0)+1),et++,ye.add(pt))}xe.push(Ye),ze.total=et}const Se=[...ye];if(Se.length<2)return null;const Te=de.reduce((ze,Ye)=>ze+Ye.total,0);if(!(Te>0))return null;let Be=0;for(const ze of de)for(const Ye of Se){const et=xe[de.indexOf(ze)].get(Ye)||0,tt=de.reduce((Tt,Rt)=>Tt+(xe[de.indexOf(Rt)].get(Ye)||0),0),pt=ze.total*tt/Te;pt>0&&(Be+=(et-pt)*(et-pt)/pt)}const Ee=de.length,Ge=Se.length,Ne=(Ee-1)*(Ge-1),ke=Math.min(1,Math.max(0,t(Be,Ne))),Oe=R(Be,Te,Ee,Ge);let Re=null;if(Ee===2&&Ge===2){const[ze]=Se,Ye=xe[0].get(ze)||0,et=xe[1].get(ze)||0,tt=ne(Ye,de[0].total,et,de[1].total,ce);tt&&(Re={...tt,confidence:ce,method:"newcombe (difference in this category's share)",category:ze})}const Le=de.map((ze,Ye)=>{const et={};for(const tt of Se)et[String(tt)]=(xe[Ye].get(tt)||0)/ze.total;return et});return{test:u.CHI_SQUARE,statistic:Be,statisticName:"chiSquare",df:Ne,pValue:ke,difference:null,interval:Re,effectSize:{name:"cramersV",label:V("cramersV",Oe,Math.min(Ee-1,Ge-1)),value:Oe},proportions:Le}}function ae(de,oe,he,ce){const me=F(oe),ye=new Set;for(const tt of de)for(const pt of tt.rows){const Tt=a(me(pt));Tt!==null&&ye.add(Tt)}if(ye.size!==2)return null;const[xe]=[...ye],Se=de[0].rows.reduce((tt,pt)=>tt+(a(me(pt))===xe?1:0),0),Te=de[1].rows.reduce((tt,pt)=>tt+(a(me(pt))===xe?1:0),0),Be=de[0].rows.length,Ee=de[1].rows.length;if(!(Be>0)||!(Ee>0))return null;const Ge=Se/Be,Ne=Te/Ee,ke=(Se+Te)/(Be+Ee);if(!(ke>0)||!(ke<1))return null;const Oe=Math.sqrt(ke*(1-ke)*(1/Be+1/Ee)),Re=(Ge-Ne)/Oe,Le=Math.min(1,Math.max(0,2*m(-Math.abs(Re)))),ze=Ge-Ne,Ye=ne(Se,Be,Te,Ee,ce),et=R(Re*Re,Be+Ee,2,2);return{test:u.PROPORTIONS,statistic:Re,statisticName:"z",df:null,pValue:Le,difference:ze,interval:Ye?{...Ye,confidence:ce,method:"newcombe (difference in proportions)",category:xe}:null,effectSize:{name:"cramersV",label:V("cramersV",et,1),value:et},proportions:[{[String(xe)]:Ge},{[String(xe)]:Ne}],focalCategory:xe}}function we(de,oe,he,ce){if(he&&d.has(he))return{test:he,reason:`caller override: ${he}`};const me=$(de),ye=$(oe),xe=me===null?null:Math.exp(-me/2),Se=ye===null?null:Math.exp(-ye/2);if(xe!==null&&xe<r||Se!==null&&Se<r)return{test:u.MANN_WHITNEY,reason:"two numeric groups, non-normal by Jarque-Bera"};const Te=w(de),Be=w(oe);if(Te.n>=3&&Be.n>=3&&Te.variance>0&&Be.variance>0){const Ee=Math.max(Te.variance,Be.variance)/Math.min(Te.variance,Be.variance),Ge=Te.variance>=Be.variance?Te.n-1:Be.n-1,Ne=Te.variance>=Be.variance?Be.n-1:Te.n-1;if(2*Math.min(v(Ee,Ge,Ne),1-v(Ee,Ge,Ne))<ce)return{test:u.WELCH,reason:"two numeric groups, unequal variances (F-test)"}}return{test:u.T,reason:xe!==null||Se!==null?"two numeric groups, equal variances and no departure from normality":"two numeric groups (too few rows to screen normality)"}}function fe(de,oe){if(oe&&i.has(oe))return{test:oe,reason:`caller override: ${oe}`};for(const he of de){const ce=$(he),me=ce===null?null:Math.exp(-ce/2);if(me!==null&&me<r)return{test:u.KRUSKAL,reason:"three or more numeric groups, non-normal by Jarque-Bera"}}return{test:u.ANOVA,reason:"three or more numeric groups, no departure from normality detected"}}function ge(de,oe,he,ce={},me=null){if(!de||!oe)return null;const ye=b(ce.alpha),xe=1-ye,Se=ce.test&&ce.test!=="auto"?String(ce.test):null,Te=p(oe,he);if(Te.length<2)return N("compare:groups",'[lattice] statistics.compare: the "by" column has fewer than two distinct values to group by.'),null;let Be;if(Array.isArray(ce.groups)&&ce.groups.length===2){const Ye=[a(ce.groups[0]),a(ce.groups[1])];if(Ye[0]===null||Ye[1]===null||Ye[0]===Ye[1])return N("compare:distinct","[lattice] statistics.compare: the two groups must be two distinct, present values."),null;if(Be=Te.filter(et=>et.value===Ye[0]||et.value===Ye[1]),Be.length!==2)return N("compare:empty","[lattice] statistics.compare: one of the two groups has no rows in the current set."),null;Be.sort((et,tt)=>et.value===Ye[0]?-1:1)}else Te.length===2||Se&&d.has(Se)||Se&&g.has(Se)?Be=Te.slice(0,2):(Se&&i.has(Se),Be=Te);const Ge=Y(de,he),Ne=!!ce.paired&&me&&Be.length===2&&Ge;let ke,Oe,Re;if(Ge)if(Be.length===2&&!(Se&&i.has(Se))){const Ye=Z(de,Be[0].rows),et=Z(de,Be[1].rows);if(Ye.length<3||et.length<3)return N("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;if(w(Ye).variance===0||w(et).variance===0)return N("compare:zero-variance","[lattice] statistics.compare: a group has zero variance, so the difference has no scale to test."),null;if(Ne){const pt=Pe(de,me,Be[0].rows,Be[1].rows);return pt?(Oe=Se?"override":"auto",Re=Se?`caller override: ${Se} (paired)`:"two numeric groups, paired",ke=Se===u.MANN_WHITNEY?X(pt.diffs,ye):U(pt.diffs,ye),ke?(ke.paired=!0,ke.chosenBy=Oe,ke.reason=Re,ke.groups=[{value:Be[0].value,label:String(Be[0].value),n:pt.n},{value:Be[1].value,label:String(Be[1].value),n:pt.n}],ke.alpha=ye,ke.method=ke.test===u.MANN_WHITNEY?"Wilcoxon signed-rank test (paired)":"Student's paired t-test (difference of pairs)",ke.verdict=A(ke,ce),ke.categorical=!1,ke):(N("compare:degenerate","[lattice] statistics.compare: the paired test had too little to work with."),null)):(N("compare:paired","[lattice] statistics.compare: not enough matched pairs to run a paired test."),null)}const tt=we(Ye,et,Se,ye);Oe=Se?"override":"auto",Re=tt.reason,tt.test===u.MANN_WHITNEY?ke=H(Ye,et,ye):tt.test===u.WELCH?ke=_(Ye,et,ye):ke=q(Ye,et,ye),ke&&ke.interval&&ke.difference===null&&(ke.difference=ke.interval.estimate)}else{const Ye=Be.map(tt=>Z(de,tt.rows));if(Ye.some(tt=>tt.length<3))return N("compare:small","[lattice] statistics.compare: each group needs at least three readings to compare."),null;const et=fe(Ye,Se);Oe=Se?"override":"auto",Re=et.reason,ke=et.test===u.KRUSKAL?J(Ye,ye):te(Ye,ye)}else if(Be.length===2){const Ye=je(de,Be).size===2;if(Se===u.PROPORTIONS||Ye&&!Se)Oe=Se?"override":"auto",Re=Se?"caller override: proportions":"categorical measure with two categories (binary)",ke=ae(Be,de,ye,xe);else if(Se===u.CHI_SQUARE||!Ye&&!Se)Oe=Se?"override":"auto",Re=Se?"caller override: chiSquare":`categorical measure with ${je(de,Be).size} categories`,ke=se(Be,de,ye,xe);else return N("compare:numeric-needed",`[lattice] statistics.compare: ${Se} needs a numeric measure, but the column is categorical.`),null}else Oe=Se?"override":"auto",Re=Se?`caller override: ${Se}`:`categorical measure with ${je(de,Be).size} categories`,ke=se(Be,de,ye,xe);if(!ke)return N("compare:degenerate","[lattice] statistics.compare: the chosen test had too little to work with (too few values, or no variation)."),null;const Le=ke.summaries,ze=ke.proportions;return{test:ke.test,chosenBy:Oe,reason:Re,statistic:ke.statistic,statisticName:ke.statisticName,df:ke.df===void 0?null:ke.df,pValue:ke.pValue,alpha:ye,paired:!1,interval:ke.interval||null,effectSize:ke.effectSize,groups:Be.map((Ye,et)=>({value:Ye.value,label:String(Ye.value),n:Le?Le[et].n:Ye.total,...Le?{mean:Le[et].mean,sd:Le[et].sd}:{},...ze?{proportions:ze[et]}:{}})),difference:ke.difference===void 0?null:ke.difference,method:ke.test,categorical:!Ge,verdict:Be.length===2?A({...ke,alpha:ye,groups:[{value:Be[0].value,label:String(Be[0].value),mean:Le?Le[0].mean:void 0},{value:Be[1].value,label:String(Be[1].value),mean:Le?Le[1].mean:void 0}],categorical:!Ge,difference:ke.difference===void 0?null:ke.difference},ce):I({...ke,alpha:ye},ce)}}function je(de,oe){const he=F(de),ce=new Set;for(const me of oe)for(const ye of me.rows){const xe=a(he(ye));xe!==null&&ce.add(xe)}return ce}function Pe(de,oe,he,ce){const me=F(oe),ye=F(de),xe=new Map;for(const Te of ce){const Be=a(me(Te));Be!==null&&xe.set(Be,ye(Te))}const Se=[];for(const Te of he){const Be=a(me(Te));if(Be===null||!xe.has(Be))continue;const Ee=Number(ye(Te)),Ge=Number(xe.get(Be));!Number.isFinite(Ee)||!Number.isFinite(Ge)||Se.push(Ee-Ge)}return Se.length<2?null:{diffs:Float64Array.from(Se),n:Se.length}}}),He("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 G}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return F}});const re="__lattice_detail",N=36;function G(L){const Z=L.config&&L.config.detailColumnWidth||N;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:Z,min:Z,max:Z,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(z,x){return!!(x&&x.expanded)},formatValue(){return""}}}const F=G}),He("packages/core/src/columns/treecolumn.js",function(e,D){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createTreeColumn",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const N=D("packages/core/src/internal/predicates.js").isFunction,G="__lattice_tree",F=260;function L(z){const x=z.tree||{},Y=z.config&&z.config.treeColumnWidth||F,$=!!(z.config&&z.config.treeColumnFlex),j=()=>(z.columns&&N(z.columns.visible)?z.columns.visible():[]).find(m=>!m.generated)||null,k=(c,m)=>{if(m&&m.group)return m.groupValue;if(N(x.label))return x.label(c,m);if(typeof x.label=="string")return c==null?null:c[x.label];const s=j();return s&&N(s.getValue)?s.getValue(c,m):null},y=()=>{if(x.title)return x.title;const c=typeof x.label=="string"?z.columns&&N(z.columns.get)?z.columns.get(x.label):null:j();return c&&(c.title||c.id)||"Hierarchy"};return{id:G,get title(){return y()},field:null,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group",props:{icon:x.icon,iconClass:x.iconClass,content:x.content,checkbox:x.checkbox,onCheck:x.onCheck}},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:$?{flex:1,min:0,pin:z.config&&z.config.treeColumnPin||null,hidden:!1,resizable:!1,movable:!1,lockPosition:!0}:{width:Y,min:140,pin:z.config&&z.config.treeColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(c,m){return k(c,m)},formatValue(c,m){if(m&&m.grandTotal)return z.config&&z.config.grandTotalLabel||"Total";if(c==null)return"";if(!x.label){const s=j();if(s&&N(s.formatValue))return s.formatValue(c,m)}return String(c)}}}const Z=L}),He("packages/core/src/columns/pivotcolumns.js",function(e,D){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return L}});const N=D("packages/core/src/internal/warn.js").warnOnce,G="__lattice_pivot",F=500;function L(Y){const{pivot:$,valueColumns:j,config:k}=Y,y=$&&$.paths||[],c=Y.separator||k&&k.pivot&&k.pivot.separator||" | ",m=k&&k.pivot&&k.pivot.maxColumns||F;if(!y.length||!j.length)return{tree:[],leaves:[],error:null};const s=Z(k),t=y.length*j.length+(s?j.length:0);if(t>m){const d=`pivot would generate ${t} columns, above the limit of ${m}. Pivot on a lower-cardinality column, or raise pivot.maxColumns.`;return N(`pivot.maxColumns:${t}`,d),{tree:[],leaves:[],error:d}}const o=[],u=[];for(const d of y){const i=[];for(const g of j){const r=x(d,g,c);i.push(r),u.push(r)}i.length===1?(i[0].title=String(d),o.push(i[0])):o.push({id:`${G}:group:${d}`,title:String(d),columns:i,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(s){const d=j.map(g=>z(g,k));u.push(...d);const i=k&&k.pivot&&k.pivot.totalsLabel||"Total";if(d.length===1)d[0].title=i,s==="before"?o.unshift(d[0]):o.push(d[0]);else{const g={id:`${G}:group:__totals`,title:i,columns:d,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};s==="before"?o.unshift(g):o.push(g)}}return{tree:o,leaves:u,error:null}}function Z(Y){const $=Y&&Y.pivot&&Y.pivot.groupTotals;return $==="before"||$==="after"?$:null}function z(Y,$){return{id:`${G}:__total${$&&$.pivot&&$.pivot.separator||" | "}${Y.id}`,field:null,title:Y.title||Y.id,type:Y.type,dataType:Y.dataType,nullable:!0,align:Y.align,generated:!0,pivot:{enabled:!1,index:0,sourceId:Y.id,total:!0},value:{pure:!0},cell:{align:Y.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:Y.total,lookup:null,layout:{width:Y.layout&&Y.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(j,k){const y=k&&k.totals;return y&&Object.hasOwn(y,Y.id)?y[Y.id]:null},formatValue(j,k){return j==null?"":Y.formatValue?Y.formatValue(j,k):String(j)}}}function x(Y,$,j){return{id:`${G}:${Y}${j}${$.id}`,field:null,title:$.title||$.id,type:$.type,dataType:$.dataType,nullable:!0,align:$.align,generated:!0,pivot:{enabled:!1,index:0,path:Y,sourceId:$.id},value:{pure:!0},cell:{align:$.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:$.total,lookup:null,layout:{width:$.layout&&$.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(){return null},formatValue(k,y){return k==null?"":$.formatValue?$.formatValue(k,y):String(k)}}}}),He("packages/core/src/compute/group.js",function(e,D){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return k}});const re=D("packages/core/src/compute/handle.js"),N=re.dictSize,G=re.identity,F=re.presenceReader,L=re.rowCount,Z=re.valueReader,z="",x="\0",Y=1<<20;function $(y,c,m,s){const t=y.length,o=y.map(n=>Z(n)),u=Array.isArray(s)&&s.some(Boolean),d=u?o.map((n,f)=>s[f]?h=>s[f](n(h)):n):o;if(!u&&t>0&&y.every(n=>n&&n.kind==="dictionary"&&n.dict)){const n=y.map(h=>N(h.dict)+1);let f=1;for(let h=0;h<t;h++)f*=n[h];if(f<=Number.MAX_SAFE_INTEGER){const h=y.map(p=>p.values),l=y.map(p=>F(p)),b=p=>{let w=0;for(let v=0;v<t;v++){const P=l[v],V=P&&P(p)===0?n[v]-1:h[v][p];w=w*n[v]+V}return w},a=new Float64Array(m);for(let p=0;p<m;p++)a[p]=b(c[p]);return{packed:a,strings:null,product:f,readers:d,keyOf:b}}}const g=n=>{let f="";for(let h=0;h<t;h++){const l=d[h](n);f+=(h===0?"":z)+(l==null?x:String(l))}return f},r=new Array(m);for(let n=0;n<m;n++)r[n]=g(c[n]);return{packed:null,strings:r,product:1/0,readers:d,keyOf:g}}function j(y,c,m,s){const t=new Uint32Array(s+1);for(let i=0;i<m;i++)t[c[i]+1]++;for(let i=0;i<s;i++)t[i+1]+=t[i];const o=new Uint32Array(m),u=t.slice(0,s);for(let i=0;i<m;i++)o[u[c[i]]++]=y[i];const d=new Array(s);for(let i=0;i<s;i++)d[i]=o.subarray(t[i],t[i+1]);return d}function k(y,c,m={}){const s=y||[],t=c||G(L(s[0],m)),o=t.length;if(s.length===0||o===0)return{keys:[],buckets:[]};const{packed:u,strings:d,product:i,readers:g}=$(s,t,o,m.project),r=new Uint32Array(o);let n=0,f=null;if(u&&i<=Math.max(1024,Math.min(Y,o*4))){const a=i,p=new Int32Array(a).fill(-1);for(let w=0;w<o;w++)p[u[w]]=0;for(let w=0;w<a;w++)p[w]===0&&(p[w]=n++);for(let w=0;w<o;w++)r[w]=p[u[w]];f=new Float64Array(n);for(let w=0;w<a;w++)p[w]>=0&&(f[p[w]]=w)}else if(u){const a=new Map;for(let p=0;p<o;p++){const w=u[p];let v=a.get(w);v===void 0&&(v=n++,a.set(w,v)),r[p]=v}f=new Float64Array(n);for(const[p,w]of a)f[w]=p}else{const a=new Map;for(let p=0;p<o;p++){const w=d[p];let v=a.get(w);v===void 0&&(v=n++,a.set(w,v)),r[p]=v}}const h=j(t,r,o,n),l=new Array(n);for(let a=0;a<n;a++){const p=h[a][0],w=new Array(g.length);for(let v=0;v<g.length;v++)w[v]=g[v](p);l[a]=w}const b={keys:l,buckets:h};return f&&(b.packed=f),b}}),He("packages/core/src/compute/pivot.js",function(e,D){"use strict";Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return o}});const N=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/compute/handle.js").valueComparator,Z=D("packages/core/src/compute/group.js").packKeys,x=D("packages/core/src/compute/total.js").total,Y="|",$="/",j=2e3;function k(i,g,r){return`${i}${Y}${g}${Y}${r}`}function y(i,g){let r="";for(let n=0;n<i.length;n++){const f=i[n];r+=(n===0?"":g)+(f==null?"":String(f))}return r}function c(i,g,r={}){const n=r.separator||$,f=g.length,{keyOf:h,readers:l}=Z(i,g,0),b=new Map,a=[],p=[];for(let R=0;R<f;R++){const S=g[R],E=h(S);if(b.has(E))continue;b.set(E,a.length),p.push(E);const O=new Array(l.length);for(let M=0;M<l.length;M++)O[M]=l[M](S);a.push(O)}const w=F(r.locale),v=a.map((R,S)=>S);v.sort((R,S)=>{const E=a[R],O=a[S];for(let M=0;M<E.length;M++){const T=m(E[M],O[M],w);if(T!==0)return T}return R-S});const P=new Array(v.length),V=new Array(v.length),W=new Map;for(let R=0;R<v.length;R++){const S=v[R];P[R]=a[S],V[R]=y(a[S],n),W.set(p[S],R)}return{keys:P,paths:V,idOf:R=>{const S=W.get(h(R));return S===void 0?-1:S}}}function m(i,g,r){const n=i==null,f=g==null;return n||f?n&&f?0:n?1:-1:r(i,g)}function s(i){const g=i.values||i.totals||[];if(g.length&&typeof g[0]=="object"&&g[0]!==null)return g.filter(h=>h&&h.handle);const r=typeof i.handle=="function"?i.handle:null;if(!r)return g.length&&N("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 n=typeof i.totalOf=="function"?i.totalOf:null,f=[];for(const h of g){const l=r(h);l&&f.push({colId:h,handle:l,fn:n?n(h):"sum"})}return f}function t(i,g,r){if(Array.isArray(i)){const n=r||{};return{...n,pivotHandles:i,order:g||null,groups:n.groups||null}}return i||{}}function o(i,g,r){const n=t(i,g,r),f=n.separator||$,h=s(n),l=n.maxColumns===void 0?j:n.maxColumns,b=n.groups&&n.groups.buckets?n.groups:null,a=b?b.buckets:[n.order||new Uint32Array(0)],p=n.groupPaths||(b?b.keys.map(E=>y(E,f)):[""]),w=d(a),{keys:v,paths:P,idOf:V}=c(n.pivotHandles||[],w,n),W=P.length*Math.max(1,h.length),K=u(P,h,f);if(l&&W>l){const E=new Map;return{keys:v,paths:P,fields:K,groupPaths:p,columns:W,values:E,cells:E,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${W} columns, above pivot.maxColumns of ${l}. Narrow the pivot columns or raise the limit.`,columns:W,maxColumns:l}}}const R=new Map,S=P.length;for(let E=0;E<a.length;E++){const O=a[E],M=p[E]===void 0?"":p[E],T=O.length;if(T===0)continue;const A=new Int32Array(T),I=new Uint32Array(S+1);for(let q=0;q<T;q++){const _=V(O[q]);A[q]=_,_>=0&&I[_+1]++}for(let q=0;q<S;q++)I[q+1]+=I[q];const U=new Uint32Array(T),X=I.slice(0,S);for(let q=0;q<T;q++){const _=A[q];_>=0&&(U[X[_]++]=O[q])}for(let q=0;q<S;q++){const _=I[q],H=I[q+1];if(H===_)continue;const ee=U.subarray(_,H);for(let te=0;te<h.length;te++){const J=h[te],ne=x(J.handle,ee,J.fn,n.totalContext||{locale:n.locale});R.set(k(M,P[q],J.colId),ne)}}}return{keys:v,paths:P,fields:K,groupPaths:p,columns:W,values:R,cells:R,error:null}}function u(i,g,r){if(g.length===0)return i.slice();const n=[];for(const f of i)for(const h of g)n.push(`${f}${r}${h.colId}`);return n}function d(i){if(i.length===1)return i[0]||new Uint32Array(0);let g=0;for(const f of i)g+=f?f.length:0;const r=new Uint32Array(g);let n=0;for(const f of i)!f||f.length===0||(r.set(f,n),n+=f.length);return r}}),He("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 k}});const N=D("packages/core/src/compute/total.js").total,F=D("packages/core/src/compute/group.js").groupByColumns,L=new Set(["sum","count","countValues"]),Z=new Set(["min","max"]),z=new Set(["avg"]);function x(y){return typeof y=="string"?y:typeof y=="function"&&y.totalName?y.totalName:null}function Y(y,c,m,s){return N(y,c,m,s||{})}function $(y,c){if(c)try{return c(y)}catch{}return y==null?"":String(y)}function j(y){const{handle:c,fn:m,leaves:s,by:t,labelOf:o,rowLabel:u}=y,d={locale:y.locale},i=s&&s.length?s:[],g=x(m),r=Y(c,i,m,d),n=Z.has(g);let f;if(n){let b=-1;for(let a=0;a<i.length;a++){const p=Y(c,[i[a]],m,d);if(Object.is(p,r)){b=i[a];break}}f=b<0?[]:[{key:b,indices:[b],label:u?u(b):String(b)}]}else if(t){const b=F([t],i);f=b.keys.map((a,p)=>({key:a[0],indices:b.buckets[p],label:$(a[0],o)}))}else f=Array.from({length:i.length},(b,a)=>{const p=i[a];return{key:p,indices:[p],label:u?u(p):String(p)}});const h=i.length,l=[];for(const b of f){const a=Y(c,b.indices,m,d),p=b.indices.length;let w,v;if(g==="avg")w=((typeof a=="number"?a:0)-(typeof r=="number"?r:0))*p,v=h?p/h:0;else if(n)w=typeof a=="number"?a:0,v=1;else{w=typeof a=="number"?a:0;const P=typeof r=="number"?r:0;v=P?w/P:0}l.push({key:b.key,label:b.label,count:p,value:a,contribution:w,share:v})}return l.sort((b,a)=>Math.abs(a.contribution)-Math.abs(b.contribution)||(b.label<a.label?-1:b.label>a.label?1:0)),{total:r,fn:g,weighted:z.has(g),single:n,contributors:l}}function k(y){const c=j({...y,leaves:y.after}),m=j({...y,leaves:y.before}),s=typeof c.total=="number"?c.total:0,t=typeof m.total=="number"?m.total:0,o=new Map;for(const i of c.contributors)o.set(i.key,i);const u=[],d=new Set;for(const i of m.contributors){d.add(i.key);const g=o.get(i.key);if(g===void 0)u.push({key:i.key,label:i.label,before:i.value,after:null,effect:-i.contribution,kind:"dropped",count:i.count});else{const r=g.contribution-i.contribution;r!==0&&u.push({key:i.key,label:i.label,before:i.value,after:g.value,effect:r,kind:"changed",count:g.count})}}for(const i of c.contributors)d.has(i.key)||u.push({key:i.key,label:i.label,before:null,after:i.value,effect:i.contribution,kind:"new",count:i.count});return u.sort((i,g)=>Math.abs(g.effect)-Math.abs(i.effect)||(i.label<g.label?-1:i.label>g.label?1:0)),{before:m.total,after:c.total,delta:s-t,weighted:c.weighted||m.weighted,single:c.single||m.single,drivers:u}}}),He("packages/core/src/store/bitset.js",function(e,D){"use strict";Object.defineProperty(e,"Bitset",{enumerable:!0,get:function(){return N}});const re=8;class N{static#e=new Uint8Array(256);static{for(let F=1;F<256;F++)N.#e[F]=N.#e[F>>1]+(F&1)}#t;#n;constructor(F=0){const L=Math.max(0,F|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(F){return F<0||F>=this.#n?0:this.#t[F>>3]>>(F&7)&1}set(F){return F>=0&&F<this.#n&&(this.#t[F>>3]|=1<<(F&7)),this}clear(F){return F>=0&&F<this.#n&&(this.#t[F>>3]&=~(1<<(F&7))),this}assign(F,L){return L?this.set(F):this.clear(F)}fill(F=!1){return this.#t.fill(F?255:0),F&&this.#r(),this}grow(F){const L=Math.max(0,F|0);if(L<=this.#n)return this;const Z=Math.ceil(L/re);if(Z>this.#t.length){const z=new Uint8Array(Z);z.set(this.#t),this.#t=z}return this.#n=L,this}count(){const F=this.#t,L=N.#e;let Z=0;for(let z=0;z<F.length;z++)Z+=L[F[z]];return Z}and(F){const L=F instanceof N?F.words:F,Z=this.#t,z=Math.min(Z.length,L.length);for(let x=0;x<z;x++)Z[x]&=L[x];for(let x=z;x<Z.length;x++)Z[x]=0;return this}or(F){const L=F instanceof N?F.words:F,Z=this.#t,z=Math.min(Z.length,L.length);for(let x=0;x<z;x++)Z[x]|=L[x];return this}not(){const F=this.#t;for(let L=0;L<F.length;L++)F[L]=~F[L]&255;return this.#r(),this}clone(){const F=new N(this.#n);return F.words.set(this.#t.subarray(0,F.words.length)),F}release(){this.#t=new Uint8Array(0),this.#n=0}#r(){const F=this.#n&7;if(F===0)return;const L=this.#n>>3;L<this.#t.length&&(this.#t[L]&=(1<<F)-1)}static from(F){const L=Array.isArray(F)?F:Array.from(F),Z=new N(L.length);for(let z=0;z<L.length;z++)L[z]&&Z.set(z);return Z}}}),He("packages/core/src/store/dictionary.js",function(e,D){"use strict";Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return F}});const re=D("packages/core/src/internal/compare.js"),N=re.collator,G=re.defaultCompare;class F{#e;#t=new Map;#n=0;#r=null;#i=-1;#s="\0";constructor(Z=[]){this.#e=[];for(let z=0;z<Z.length;z++){const x=Z[z];this.#t.has(x)||(this.#t.set(x,this.#e.length),this.#e.push(x))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let Z=this.#e.length*8;for(let z=0;z<this.#e.length;z++){const x=this.#e[z];typeof x=="string"&&(Z+=x.length*2),Z+=16}return Z}codeOf(Z){const z=this.#t.get(Z);if(z!==void 0)return z;const x=this.#e.length;return this.#e.push(Z),this.#t.set(Z,x),this.#n++,x}lookup(Z){const z=this.#t.get(Z);return z===void 0?-1:z}has(Z){return this.#t.has(Z)}valueOf(Z){return this.#e[Z]}values(){return this.#e}ranks(Z){const z=Z||"";if(this.#r&&this.#i===this.#n&&this.#s===z)return this.#r;const x=this.#e.length,Y=new Array(x);for(let y=0;y<x;y++)Y[y]=y;const $=N(Z).compare,j=this.#e;Y.sort((y,c)=>this.#o(j[y],j[c],$));const k=new Uint32Array(x);for(let y=0;y<x;y++)k[Y[y]]=y;return this.#r=k,this.#i=this.#n,this.#s=z,k}#o(Z,z,x){return typeof Z=="string"&&typeof z=="string"?x(Z,z):G(Z,z)}}}),He("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(G={}){const F=Math.max(1,G.rows??16),L=Math.max(1,G.values??F);this.#e=new Int32Array(L),this.#t=new Uint32Array(F+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(G){return G<0||G>=this.#n?0:this.#t[G+1]-this.#t[G]}at(G){return G<0||G>=this.#n?this.#e.subarray(0,0):this.#e.subarray(this.#t[G],this.#t[G+1])}has(G,F){if(G<0||G>=this.#n)return!1;const L=this.#e,Z=this.#t[G+1];for(let z=this.#t[G];z<Z;z++)if(L[z]===F)return!0;return!1}hasAny(G,F){for(let L=0;L<F.length;L++)if(this.has(G,F[L]))return!0;return!1}hasAll(G,F){for(let L=0;L<F.length;L++)if(!this.has(G,F[L]))return!1;return!0}hasNone(G,F){return!this.hasAny(G,F)}push(G){const F=this.#n,L=G.length;this.#i(F+1),this.#s(this.#r+L);const Z=this.#r;for(let z=0;z<L;z++)this.#e[Z+z]=G[z]|0;return this.#r+=L,this.#n=F+1,this.#t[F]=Z,this.#t[F+1]=this.#r,F}write(G,F){if(G===this.#n){this.push(F);return}if(G<0||G>this.#n)return;const L=this.#t[G],Z=this.#t[G+1],z=F.length;if(Z-L===z){for(let x=0;x<z;x++)this.#e[L+x]=F[x]|0;return}this.#o(G,F)}compact(G,F,L){const Z=this.#e,z=this.#t,x=this.#n,Y=new Int32Array(Math.max(1,this.#r)),$=new Uint32Array(F+1);let j=0;for(let k=0;k<x;k++){if(G[k]===L)continue;const y=z[k],c=z[k+1];$[G[k]]=j;for(let m=y;m<c;m++)Y[j++]=Z[m];$[G[k]+1]=j}this.#e=Y,this.#t=$,this.#n=F,this.#r=j}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#i(G){if(G+1<=this.#t.length)return;let F=this.#t.length-1;for(;F<G;)F=F*2||16;const L=new Uint32Array(F+1);L.set(this.#t),this.#t=L}#s(G){if(G<=this.#e.length)return;let F=this.#e.length;for(;F<G;)F=F*2||16;const L=new Int32Array(F);L.set(this.#e),this.#e=L}#o(G,F){const L=this.#e,Z=this.#t,z=this.#n,x=F.length-(Z[G+1]-Z[G]),Y=new Int32Array(Math.max(1,this.#r+x)),$=new Uint32Array(Z.length);let j=0;for(let k=0;k<z;k++){if($[k]=j,k===G)for(let y=0;y<F.length;y++)Y[j++]=F[y]|0;else for(let y=Z[k];y<Z[k+1];y++)Y[j++]=L[y];$[k+1]=j}this.#e=Y,this.#t=$,this.#r=j}}}),He("packages/core/src/compute/sort.js",function(e,D){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return S}});const re=D("packages/core/src/compute/handle.js"),N=re.bitReader,G=re.dictRanks,F=re.dictSize,L=re.identity,Z=re.isMissing,z=re.presenceReader,x=re.rowCount,Y=re.valueComparator,$=re.valueReader,j=new Uint32Array(0),k=new ArrayBuffer(8),y=new Float64Array(k),c=new Uint32Array(k),m=(y[0]=-1,(c[1]&2147483648)!==0?1:0),s=m===1?0:1;function t(O,M){y[0]=O;let T=c[m],A=c[s];(T&2147483648)!==0?(T=~T>>>0,A=~A>>>0):T=(T^2147483648)>>>0,M[0]=A,M[1]=T}function o(O,M,T,A){if(A<2)return O;const I=new Uint32Array(256*8);for(let J=0;J<A;J++){const ne=M[J],se=T[J];I[ne&255]++,I[256+(ne>>>8&255)]++,I[512+(ne>>>16&255)]++,I[768+(ne>>>24&255)]++,I[1024+(se&255)]++,I[1280+(se>>>8&255)]++,I[1536+(se>>>16&255)]++,I[1792+(se>>>24&255)]++}let U=O,X=M,q=T,_=new Uint32Array(A),H=new Uint32Array(A),ee=new Uint32Array(A);const te=new Uint32Array(256);for(let J=0;J<8;J++){const ne=J<<8,se=(J&3)<<3,ae=J>=4;let we=!1;for(let je=0;je<256;je++)if(I[ne+je]===A){we=!0;break}if(we)continue;let fe=0;for(let je=0;je<256;je++)te[je]=fe,fe+=I[ne+je];for(let je=0;je<A;je++){const Pe=X[je],de=q[je],oe=(ae?de:Pe)>>>se&255,he=te[oe]++;_[he]=U[je],H[he]=Pe,ee[he]=de}let ge=U;U=_,_=ge,ge=X,X=H,H=ge,ge=q,q=ee,ee=ge}return U}function u(O,M,T){if(T<2)return O;const A=new Uint32Array(256*4);for(let H=0;H<T;H++){const ee=M[H];A[ee&255]++,A[256+(ee>>>8&255)]++,A[512+(ee>>>16&255)]++,A[768+(ee>>>24&255)]++}let I=O,U=M,X=new Uint32Array(T),q=new Uint32Array(T);const _=new Uint32Array(256);for(let H=0;H<4;H++){const ee=H<<8,te=H<<3;let J=!1;for(let ae=0;ae<256;ae++)if(A[ee+ae]===T){J=!0;break}if(J)continue;let ne=0;for(let ae=0;ae<256;ae++)_[ae]=ne,ne+=A[ee+ae];for(let ae=0;ae<T;ae++){const we=U[ae],fe=_[we>>>te&255]++;X[fe]=I[ae],q[fe]=we}let se=I;I=X,X=se,se=U,U=q,q=se}return I}function d(O,M,T,A){const I=new Uint32Array(A+1);for(let q=0;q<T;q++)I[M[q]]++;let U=0;for(let q=0;q<=A;q++){const _=I[q];I[q]=U,U+=_}const X=new Uint32Array(T);for(let q=0;q<T;q++)X[I[M[q]]++]=O[q];return X}function i(O,M,T,A){return T<2?O:A<=65536||A<=T*2?d(O,M,T,A):u(O,M,T)}function g(O,M){return O.length===M&&O.byteOffset===0?O:Uint32Array.prototype.slice.call(O,0,M)}function r(O,M,T=!1){const A=M||L(O.length),I=A.length;if(I<2)return Uint32Array.from(A);const U=new Uint32Array(I),X=new Uint32Array(I),q=new Uint32Array(I),_=new Uint32Array(I),H=new Uint32Array(2);let ee=0,te=0;for(let se=0;se<I;se++){const ae=A[se],we=O[ae];if(Number.isNaN(we)){_[te++]=ae;continue}t(we,H),T?(X[ee]=~H[0]>>>0,q[ee]=~H[1]>>>0):(X[ee]=H[0],q[ee]=H[1]),U[ee++]=ae}const J=o(U.subarray(0,ee),X.subarray(0,ee),q.subarray(0,ee),ee);if(te===0)return g(J,ee);const ne=new Uint32Array(I);return ne.set(J.subarray(0,ee),0),ne.set(_.subarray(0,te),ee),ne}function n(O,M,T=!1){const A=M||L(O.length),I=A.length;if(I<2)return Uint32Array.from(A);const U=Uint32Array.from(A),X=new Uint32Array(I);for(let q=0;q<I;q++){const _=(O[U[q]]^2147483648)>>>0;X[q]=T?~_>>>0:_}return g(u(U,X,I),I)}function f(O,M,T={}){const A=M||L(x(O,T)),I=A.length;if(I<2)return Uint32Array.from(A);const U=G(O.dict,T.locale),X=O.values,q=z(O),_=Math.max(F(O.dict),U.length),H=_,ee=Uint32Array.from(A),te=new Uint32Array(I),J=!!T.descending;for(let ne=0;ne<I;ne++){const se=ee[ne];let ae=q&&q(se)===0?H:U[X[se]];ae===void 0&&(ae=H),te[ne]=J?H-ae:ae}return g(i(ee,te,I,_+1),I)}function h(O,M,T){const A=M.length;let I=Uint32Array.from(M);if(A<2)return I;let U=new Uint32Array(A);for(let X=1;X<A;X<<=1){for(let _=0;_<A;_+=X<<1){const H=Math.min(_+X,A),ee=Math.min(_+(X<<1),A);let te=_,J=H,ne=_;for(;te<H&&J<ee;)U[ne++]=T(O[I[te]],O[I[J]])<=0?I[te++]:I[J++];for(;te<H;)U[ne++]=I[te++];for(;J<ee;)U[ne++]=I[J++]}const q=I;I=U,U=q}return I}function l(O,M,T){const A=N(O.values),I=M.length,U=new Uint32Array(I),X=T?1:0;let q=0;for(let _=0;_<I;_++)A(M[_])===X&&(U[q++]=M[_]);for(let _=0;_<I;_++)A(M[_])!==X&&(U[q++]=M[_]);return U}function b(O,M){const T=O.values,A=O.kind;if((A==="object"||A===void 0)&&(Array.isArray(T)||ArrayBuffer.isView(T))&&!O.presence)return T;const U=$(O),X=new Array(x(O)||0);for(let q=0;q<M.length;q++){const _=M[q];X[_]=U(_)}return X}function a(O,M){for(let T=0;T<M.length;T++)if(typeof O[M[T]]!="string")return!1;return!0}function p(O,M,T,A,I){const U=O.length,X=Uint32Array.from(O);if(U<2||A<1)return X;const q=new Uint32Array(U),_=A-1;for(let H=0;H<U;H++){const ee=T[M[H]];q[H]=I?_-ee:ee}return g(i(X,q,U,A),U)}function w(O,M,T){const A=Y(T),I=new Array(M);for(let X=0;X<M;X++)I[X]=X;I.sort((X,q)=>A(O[X],O[q])||X-q);const U=new Uint32Array(M);for(let X=0;X<M;X++)U[I[X]]=X;return U}function v(O,M,T){const A=M.length,I=new Map,U=[],X=new Uint32Array(A);for(let H=0;H<A;H++){const ee=O[M[H]];let te=I.get(ee);te===void 0&&(te=U.length,I.set(ee,te),U.push(ee)),X[H]=te}const q=U.length,_=w(U,q,T.locale);return p(M,X,_,q,!!T.descending)}function P(O,M,T){const A=b(O,M);if(M.length>=2&&a(A,M)){const X=O.stringRank;return X&&X.version===O.version&&X.usable(M,A,T.locale)?X.sort(M,T):v(A,M,T)}const I=Y(T.locale),U=T.descending?(X,q)=>I(q,X):I;return h(A,M,U)}function V(O,M,T){const A=b(O,M),I=T.compare,X=!!T.descending?(q,_)=>-I(q,_,void 0,void 0,!0):(q,_)=>I(q,_,void 0,void 0,!1);return h(A,M,X)}function W(O,M){const T=M.length,A=z(O),I=O.values,U=O.kind==="float64"&&!!I,X=O.kind==="object"||O.kind==="multi"||O.kind===void 0;if(!A&&!U&&!X)return{present:M,absent:j};const q=new Uint32Array(T),_=new Uint32Array(T);let H=0,ee=0;if(A&&U)for(let te=0;te<T;te++){const J=M[te];A(J)===1&&!Number.isNaN(I[J])?q[H++]=J:_[ee++]=J}else if(U&&!A)for(let te=0;te<T;te++){const J=M[te];Number.isNaN(I[J])?_[ee++]=J:q[H++]=J}else if(A&&!X)for(let te=0;te<T;te++){const J=M[te];A(J)===1?q[H++]=J:_[ee++]=J}else{const te=$(O);for(let J=0;J<T;J++){const ne=M[J];Z(te(ne))?_[ee++]=ne:q[H++]=ne}}return ee===0?{present:M,absent:j}:{present:q.subarray(0,H),absent:_.subarray(0,ee)}}function K(O,M,T){if(M.length===0)return O;const A=new Uint32Array(O.length+M.length);return T?(A.set(M,0),A.set(O,M.length)):(A.set(O,0),A.set(M,O.length)),A}function R(O,M,T={}){const A=M||L(x(O,T));if(!O||A.length<2)return Uint32Array.from(A);const{present:I,absent:U}=W(O,A);if(I.length===0)return Uint32Array.from(A);const X=!!T.descending;let q;if(typeof T.compare=="function")q=V(O,I,T);else switch(O.kind){case"float64":q=r(O.values,I,X);break;case"int32":q=n(O.values,I,X);break;case"dictionary":q=f(O,I,T);break;case"bitset":q=l(O,I,X);break;default:q=P(O,I,T);break}return K(q,U,!!T.nullsFirst)}function S(O,M,T,A={}){const I=M||[],U=I.length&&(I[0].handle||E(O,I[0].col))||O&&O[0];let X=T||L(x(U,A));for(let q=I.length-1;q>=0;q--){const _=I[q],H=_.handle||E(O,_.col)||O&&O[q];H&&(X=R(H,X,{descending:_.descending!==void 0?!!_.descending:_.dir==="desc",nullsFirst:!!_.nullsFirst,locale:_.locale!==void 0?_.locale:A.locale,compare:_.compare}))}return X instanceof Uint32Array?X:Uint32Array.from(X)}function E(O,M){if(!(!O||M===void 0)){for(let T=0;T<O.length;T++)if(O[T]&&O[T].id===M)return O[T]}}}),He("packages/core/src/store/stringrank.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_MAX_DISTINCT",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"StringRankIndex",{enumerable:!0,get:function(){return L}});const re=D("packages/core/src/compute/sort.js"),N=re.collateStringRanks,G=re.rankSortStrings,F=1e5;class L{#e=[];#t=new Map;#n;#r=0;#i=0;#s=-1;#o;#l=!1;#a=null;#c=-1;#u="\0";constructor(z=F){this.#o=z>0?z:F,this.#n=new Uint32Array(0)}get version(){return this.#s}set version(z){this.#s=z}get generation(){return this.#i}get size(){return this.#e.length}get capped(){return this.#l}get length(){return this.#r}get bytes(){let z=this.#n.byteLength;const x=this.#e;for(let Y=0;Y<x.length;Y++)z+=x[Y].length*2+24;return z}#f(z,x){const Y=this.#t.get(z);if(Y!==void 0)return Y;if(this.#l)return-1;if(x&&this.#e.length>=this.#o)return this.#l=!0,-1;const $=this.#e.length;return this.#e.push(z),this.#t.set(z,$),this.#i++,$}build(z,x){const Y=x|0;this.#e=[],this.#t=new Map,this.#i=0,this.#l=!1,this.#a=null,this.#c=-1,this.#n=new Uint32Array(Y);for(let $=0;$<Y;$++){const j=z[$],k=typeof j=="string"?this.#f(j,!1):-1;this.#n[$]=k<0?0:k}this.#r=Y}append(z,x,Y){const $=(x|0)+(Y|0);if($>this.#n.length){const j=new Uint32Array($);j.set(this.#n.subarray(0,this.#r)),this.#n=j}for(let j=x|0;j<$;j++){const k=z[j],y=typeof k=="string"?this.#f(k,!0):-1;this.#n[j]=y<0?0:y}this.#r=Math.max(this.#r,$)}ranks(z){const x=z||"";if(this.#a&&this.#c===this.#i&&this.#u===x)return this.#a;const Y=N(this.#e,this.#e.length,z);return this.#a=Y,this.#c=this.#i,this.#u=x,Y}usable(z,x,Y){if(this.#l||this.#e.length===0)return!1;const $=this.#n,j=this.#e,k=this.#r;for(let y=0;y<z.length;y++){const c=z[y];if(c>=k||j[$[c]]!==x[c])return!1}return!0}sort(z,x){const Y=this.ranks(x.locale),$=this.#e.length,j=z.length,k=new Uint32Array(j),y=this.#n;for(let c=0;c<j;c++)k[c]=y[z[c]];return G(z,k,Y,$,!!x.descending)}}}),He("packages/core/src/store/columnstore.js",function(e,D){"use strict";Object.defineProperty(e,"REMOVED",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"toFloat",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ColumnHandle",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ColumnStore",{enumerable:!0,get:function(){return l}});const N=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/internal/predicates.js").isFunction,Z=D("packages/core/src/internal/paths.js").pathGetter,x=D("packages/core/src/store/bitset.js").Bitset,$=D("packages/core/src/store/dictionary.js").Dictionary,k=D("packages/core/src/store/multivalue.js").MultiValue,c=D("packages/core/src/store/stringrank.js").StringRankIndex,m=4294967295,s=1024,t=5e3,o=.2,u=new Set(["float64","int32","bitset","dictionary","object","multi"]);function d(b){return b==null}function i(b){if(typeof b=="number")return b;if(b instanceof Date)return b.getTime();if(typeof b=="boolean")return b?1:0;const a=Number(b);return Number.isNaN(a)&&typeof b=="string"?Date.parse(b):a}function g(b){const a=i(b);return Number.isFinite(a)?a|0:0}function r(b){return d(b)?[]:Array.isArray(b)?b:[b]}function n(b,a){switch(b.kind){case"float64":case"int32":return b.buf[a];case"bitset":return b.bits.get(a)===1;case"dictionary":return b.dict.valueOf(b.buf[a]);case"multi":{const p=b.mv.at(a),w=new Array(p.length);for(let v=0;v<p.length;v++)w[v]=b.dict.valueOf(p[v]);return w}default:return b.buf[a]}}function f(b,a){switch(b.kind){case"float64":case"int32":return b.values[a];case"bitset":return(b.values[a>>3]&1<<(a&7))!==0;case"dictionary":return(b.table||[])[b.values[a]];case"multi":{const p=b.offsets[a],w=b.offsets[a+1],v=b.table||[],P=new Array(w-p);for(let V=p;V<w;V++)P[V-p]=v[b.values[V]];return P}default:return b.values[a]}}class h{#e;#t;#n;#r;#i;#s;#o;#l=!1;#a=null;#c=null;#u=null;#f=null;#d=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#O=null;#w=null;#A=!1;constructor(a,p){this.#e=a.id;const w=u.has(a.kind)?a.kind:"object";a.kind&&!u.has(a.kind)&&N(`store.kind.${a.id}`,`column "${a.id}" declares unknown storage kind "${a.kind}"; falling back to object`),this.#n=w,this.#t=w,this.#r=a.nullable!==!1,this.#o=a.dictionary??null,this.#s=p,this.#i=F(a.read)?a.read:Z(a.field||a.id),this.#h=a.stringRankIndex!=="off",this.#p=typeof a.stringRankMaxDistinct=="number"?a.stringRankMaxDistinct:0,this.#O=new Map}get id(){return this.#e}get kind(){return this.#l?this.#t:"object"}get target(){return this.#n}get nullable(){return this.#r}get values(){return this.#A?null:this.#l?this.#t==="bitset"?this.#c.words:this.#t==="multi"?this.#u.values:this.#a:this.#T().values}get presence(){return this.#A||!this.#r?null:this.#l?this.#g:this.#T().presence}get dict(){return this.#A||!this.#l?null:this.#t==="dictionary"||this.#t==="multi"?this.#f:null}get stringRank(){if(this.#A||!this.#h||this.kind!=="object")return null;const a=this.values,p=this.#s.physical();if(!a||p===0)return null;if(this.#d===null){if(typeof a[0]!="string")return null;const w=new c(this.#v());return w.build(a,p),w.version=this.#y,this.#d=w,this.#m=this.#y,w.capped?null:w}return this.#d.length<p&&this.#d.append(a,this.#d.length,p-this.#d.length),this.#d.version=this.#y,this.#m=this.#y,this.#d.capped?null:this.#d}#v(){return this.#p}#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 a=0;return this.#a&&(a+=this.#a.byteLength??this.#a.length*8),this.#c&&(a+=this.#c.bytes),this.#u&&(a+=this.#u.bytes),this.#g&&(a+=this.#g.bytes),this.#f&&(a+=this.#f.bytes),this.#O&&(a+=this.#O.size*24),a}get(a){if(!this.#A&&!(a<0||a>=this.#s.physical())){if(!this.#l)return this.#E(a);if(this.#r&&this.#g.get(a)===0)return null;switch(this.#t){case"float64":case"int32":return this.#a[a];case"bitset":return this.#c.get(a)===1;case"dictionary":return this.#f.valueOf(this.#a[a]);case"multi":{const p=this.#u.at(a),w=new Array(p.length);for(let v=0;v<p.length;v++)w[v]=this.#f.valueOf(p[v]);return w}default:return this.#a[a]}}}set(a,p){this.#A||(this.#l?this.#P(a,p):this.#O.set(a,p===void 0?null:p),this.#d&&this.#C(),this.#y++)}read(a){return this.#i(a)}appendColumn(a,p,w){if(this.#A||w<=0)return;if(!this.#l){this.#y++;return}const v=this.#i,P=this.#r,V=this.#g;let W=!1;switch(this.#t){case"float64":{const K=this.#a;for(let R=0;R<w;R++){const S=v(a[R]);if(typeof S=="number"){P&&V.set(p+R),K[p+R]=S;continue}const E=S==null;P?V.assign(p+R,!E):E&&(W=!0),K[p+R]=E?NaN:i(S)}break}case"int32":{const K=this.#a;for(let R=0;R<w;R++){const S=v(a[R]),E=S==null;P?V.assign(p+R,!E):E&&(W=!0),K[p+R]=E?0:g(S)}break}case"bitset":{const K=this.#c;for(let R=0;R<w;R++){const S=v(a[R]),E=S==null;P?V.assign(p+R,!E):E&&(W=!0),K.assign(p+R,!E&&!!S)}break}case"dictionary":{const K=this.#a,R=this.#f;for(let S=0;S<w;S++){const E=v(a[S]),O=E==null;P?V.assign(p+S,!O):O&&(W=!0),K[p+S]=O?0:R.codeOf(E)}break}case"multi":{const K=this.#u,R=this.#f;for(let S=0;S<w;S++){const E=v(a[S]),O=E==null;P?V.assign(p+S,!O):O&&(W=!0);const M=r(E),T=new Array(M.length);for(let A=0;A<M.length;A++)T[A]=R.codeOf(M[A]);K.write(p+S,T)}break}default:{const K=this.#a;for(let R=0;R<w;R++){const S=v(a[R]),E=S==null;P?V.assign(p+R,!E):E&&(W=!0),K[p+R]=E?null:S}break}}W&&N(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#d&&this.#t==="object"&&(this.#d.append(this.#a,p,w),this.#d.version=this.#y+1,this.#m=this.#y+1),this.#y++}appendPacked(a,p,w){if(this.#A||w<=0||!a)return;if(!this.#l){this.#y++;return}const v=this.#g,P=a.presence;if(v)if(P)for(let W=0;W<w;W++)v.assign(p+W,(P[W>>3]&1<<(W&7))!==0);else for(let W=0;W<w;W++)v.set(p+W);const V=a.kind===this.#t;if(V&&(this.#t==="float64"||this.#t==="int32")){this.#a.set(a.values,p),this.#y++;return}if(V&&this.#t==="bitset"){const W=a.values;for(let K=0;K<w;K++)this.#c.assign(p+K,(W[K>>3]&1<<(K&7))!==0);this.#y++;return}if(V&&this.#t==="dictionary"){const W=a.table||[],K=new Uint32Array(W.length);for(let O=0;O<W.length;O++)K[O]=this.#f.codeOf(W[O]);const R=a.values,S=this.#a,E=v;for(let O=0;O<w;O++){if(E&&(P&&(P[O>>3]&1<<(O&7))===0)){S[p+O]=0;continue}S[p+O]=K[R[O]]??0}this.#y++;return}if(V&&this.#t==="multi"){const W=a.table||[],K=new Uint32Array(W.length);for(let E=0;E<W.length;E++)K[E]=this.#f.codeOf(W[E]);const R=a.values,S=a.offsets;for(let E=0;E<w;E++){const O=S[E],M=S[E+1],T=new Array(M-O);for(let A=O;A<M;A++)T[A-O]=K[R[A]]??0;this.#u.write(p+E,T)}this.#y++;return}for(let W=0;W<w;W++){const K=P?(P[W>>3]&1<<(W&7))===0:a.kind==="object"?a.values[W]===null:!1;this.#P(p+W,K?null:f(a,W))}this.#y++}touch(){this.#y++}columnarise(a,p){if(this.#l||this.#A)return;const w=new Array(p);for(let v=0;v<p;v++)w[v]=this.#E(v);this.#t=this.#n,this.#l=!0,this.#S(a);for(let v=0;v<p;v++)this.#P(v,w[v]);this.#O.clear(),this.#w=null,this.#C(),this.#y++}grow(a){if(!(!this.#l||this.#A||a<=this.#b)){switch(this.#t){case"float64":case"int32":case"dictionary":{const p=new this.#a.constructor(a);p.set(this.#a),this.#a=p;break}case"bitset":this.#c.grow(a);break;case"multi":break;default:this.#a.length=a;break}this.#g&&this.#g.grow(a),this.#b=a,this.#y++}}convert(a){if(this.#A||!u.has(a)||(this.#n=a,!this.#l||a===this.#t))return!1;const p={kind:this.#t,buf:this.#a,bits:this.#c,mv:this.#u,dict:this.#f},w=this.#s.physical(),v=this.#g;this.#t=a,this.#S(this.#b);for(let P=0;P<w;P++){const V=v!==null&&v.get(P)===0;V&&a!=="multi"||this.#P(P,V?null:n(p,P))}return this.#C(),this.#y++,!0}compact(a,p,w){if(!this.#A){if(this.#C(),!this.#l){const v=this.#O;if(v.size){const P=new Map;for(const[V,W]of v)a[V]!==m&&P.set(a[V],W);this.#O=P}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const v=this.#a;for(let P=0;P<p;P++)a[P]!==m&&(v[a[P]]=v[P]);if(this.#t==="object")for(let P=w;P<p;P++)v[P]=void 0;break}case"bitset":{const v=this.#c;for(let P=0;P<p;P++)a[P]!==m&&v.assign(a[P],v.get(P)===1);for(let P=w;P<p;P++)v.clear(P);break}case"multi":this.#u.compact(a,w,m);break;default:break}if(this.#g){const v=this.#g;for(let P=0;P<p;P++)a[P]!==m&&v.assign(a[P],v.get(P)===1);for(let P=w;P<p;P++)v.clear(P)}this.#y++}}release(){this.#A||(this.#A=!0,this.#a=null,this.#c&&this.#c.release(),this.#c=null,this.#u&&this.#u.release(),this.#u=null,this.#g&&this.#g.release(),this.#g=null,this.#f=null,this.#d=null,this.#O=new Map,this.#w=null,this.#b=0,this.#y++)}#S(a){const p=Math.max(1,a);switch(this.#a=null,this.#c=null,this.#u=null,this.#t){case"float64":this.#a=new Float64Array(p);break;case"int32":this.#a=new Int32Array(p);break;case"bitset":this.#c=new x(p);break;case"dictionary":this.#a=new Uint32Array(p),this.#f=this.#f??new $(this.#o??[]);break;case"multi":this.#u=new k({rows:p,values:p}),this.#f=this.#f??new $(this.#o??[]);break;default:this.#a=new Array(p);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#f=null),this.#r&&(this.#g?this.#g.grow(p):this.#g=new x(p)),this.#b=p}#P(a,p){const w=d(p);switch(this.#r?this.#g.assign(a,!w):w&&N(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#t){case"float64":this.#a[a]=w?NaN:i(p);break;case"int32":this.#a[a]=w?0:g(p);break;case"bitset":this.#c.assign(a,!w&&!!p);break;case"dictionary":this.#a[a]=w?0:this.#f.codeOf(p);break;case"multi":{const v=r(p),P=new Array(v.length);for(let V=0;V<v.length;V++)P[V]=this.#f.codeOf(v[V]);this.#u.write(a,P);break}default:this.#a[a]=w?null:p;break}}#E(a){if(this.#O.has(a))return this.#O.get(a);const p=this.#i(this.#s.rowAt(a));return p===void 0?null:p}#T(){if(this.#w&&this.#w.version===this.#y)return this.#w;const a=this.#s.physical(),p=new Array(a),w=this.#r?new x(a):null;for(let v=0;v<a;v++){const P=this.#E(v);p[v]=P,w&&!d(P)&&w.set(v)}return this.#w={version:this.#y,values:p,presence:w},this.#w}}class l{#e;#t=new Map;#n=[];#r=[];#i=0;#s=0;#o=0;#l=0;#a=new x(0);#c=!1;#u=!0;#f;#d;#h;#p=!1;constructor(a,p={}){this.#e=Array.isArray(a)?a:[],this.#d=Math.max(1,p.initialCapacity??s),this.#u=p.retainSource!==!1,this.#f=this.#u?p.columnarBelow??t:0,this.#h=p.compactRatio??o;const w={rowAt:v=>this.#r[v],physical:()=>this.#i};for(const v of this.#e){if(!v||!v.id)continue;if(this.#t.has(v.id)){N(`store.dup.${v.id}`,`duplicate column id "${v.id}" in the store schema; ignoring the second`);continue}const P=new h(v,w);this.#t.set(v.id,P),this.#n.push(P)}this.#f<=0&&this.#b()}get count(){return this.#o}get physical(){return this.#i}get capacity(){return this.#c?this.#s:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let a=this.#a.bytes+this.#r.length*8;for(const p of this.#n)a+=p.bytes;return a}append(a){const p=this.#i;if(this.#p||!a)return{from:p,to:p};const w=a.length|0;if(w===0)return{from:p,to:p};if(this.#u)for(let P=0;P<w;P++)this.#r[p+P]=a[P];if(this.#i=p+w,this.#o+=w,this.#a.grow(this.#i),!this.#c){if(this.#i>=this.#f)this.#b();else for(const P of this.#n)P.touch();return{from:p,to:this.#i}}this.#m(this.#i);const v=this.#n;for(let P=0;P<v.length;P++)v[P].appendColumn(a,p,w);return{from:p,to:this.#i}}appendPacked(a,p){const w=this.#i;if(this.#p||!a)return{from:w,to:w};const v=a.count|0;if(v===0)return{from:w,to:w};if(this.#u&&p)for(let V=0;V<v;V++)this.#r[w+V]=p[V];this.#i=w+v,this.#o+=v,this.#a.grow(this.#i),this.#c||this.#b(),this.#m(this.#i);const P=new Map;for(const V of a.columns)P.set(V.id,V);for(const V of this.#n){const W=P.get(V.id);W?V.appendPacked(W,w,v):V.grow(this.#s)}return{from:w,to:this.#i}}source(a){if(this.#u)return this.#r[a];if(!(a<0||a>=this.#i))return this.#g(a)}setSource(a,p){this.#p||a<0||a>=this.#i||this.#u&&(this.#r[a]=p)}get(a,p){const w=this.#t.get(a);return w?w.get(p):void 0}set(a,p,w){if(this.#p||p<0||p>=this.#i)return;const v=this.#t.get(a);if(!v){N(`store.set.${a}`,`set() on unknown column "${a}"`);return}v.set(p,w)}remove(a){return this.#p||a<0||a>=this.#i||this.#a.get(a)===1?!1:(this.#a.set(a),this.#l++,this.#o--,!0)}live(a){return a<0||a>=this.#i?!1:this.#a.get(a)===0}compact(a={}){if(this.#p||this.#l===0||!a.force&&this.#l/this.#i<this.#h)return null;const p=this.#i,w=new Uint32Array(p);let v=0;for(let P=0;P<p;P++)w[P]=this.#a.get(P)===1?m:v++;for(const P of this.#n)P.compact(w,p,v);if(this.#u){const P=this.#r;for(let V=0;V<p;V++)w[V]!==m&&(P[w[V]]=P[V]);P.length=v}return this.#i=v,this.#o=v,this.#l=0,this.#a=new x(Math.max(this.#s,v)),w}column(a){return this.#t.get(a)}columns(){return this.#n.slice()}liveIndices(){const a=new Uint32Array(this.#o);if(this.#l===0){for(let w=0;w<this.#i;w++)a[w]=w;return a}let p=0;for(let w=0;w<this.#i;w++)this.#a.get(w)===0&&(a[p++]=w);return a}convert(a,p){const w=this.#t.get(a);return w?w.convert(p):!1}destroy(){if(!this.#p){this.#p=!0;for(const a of this.#n)a.release();this.#t.clear(),this.#n.length=0,this.#r.length=0,this.#a.release(),this.#i=0,this.#o=0,this.#l=0,this.#s=0}}#m(a){if(a<=this.#s)return;let p=this.#s||this.#d;for(;p<a;)p*=2;for(const w of this.#n)w.grow(p);this.#a.grow(p),this.#s=p}#g(a){const p={};for(const w of this.#n)p[w.id]=w.get(a);return p}#b(){if(this.#c)return;let a=this.#d;for(;a<this.#i;)a*=2;this.#c=!0,this.#s=a,this.#a.grow(a);for(const p of this.#n)p.columnarise(a,this.#i)}}}),He("packages/core/src/store/pool.js",function(e,D){"use strict";Object.defineProperty(e,"MaskPool",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"sharedPool",{enumerable:!0,get:function(){return L}});const re=64,N=8;function G(z){let x=re;for(;x<z;)x*=2;return x}class F{#e=new Map;#t=new WeakSet;#n;#r=0;#i={acquired:0,reused:0,released:0};constructor(x={}){this.#n=x.limit??N}get bytes(){return this.#r}mask(x){const Y=new Uint8Array(this.#s(x),0,x);return Y.fill(0),Y}indices(x){return new Uint32Array(this.#s(x*4),0,x)}release(x){if(!x||!x.buffer)return!1;const Y=x.buffer;if(!this.#t.has(Y))return!1;this.#t.delete(Y),this.#i.released++;const $=Y.byteLength;let j=this.#e.get($);return j||this.#e.set($,j=[]),j.length>=this.#n||(j.push(Y),this.#r+=$),!0}releaseAll(x){for(const Y of x)this.release(Y)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#i,retained:this.#r}}#s(x){const Y=G(x),$=this.#e.get(Y);this.#i.acquired++;let j;return $&&$.length?(j=$.pop(),this.#r-=Y,this.#i.reused++):j=new ArrayBuffer(Y),this.#t.add(j),j}}function L(){return Z??=new F,Z}let Z=null}),He("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 N}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return L}});function re(Z){return{locale:Z===void 0?void 0:String(Z),numeric:!0,sensitivity:"variant"}}function N(Z){return!!Z&&typeof Z.compare!="function"}function G(Z){if(!Z)return!0;for(let z=0;z<Z.length;z++)if(!N(Z[z]))return!1;return!0}function F(Z,z){const x=Z.col!==void 0?Z.col:Z.handle&&Z.handle.id,Y=Z.locale!==void 0?Z.locale:z;return{col:x,descending:Z.descending!==void 0?!!Z.descending:Z.dir==="desc",nullsFirst:!!Z.nullsFirst,collation:re(Y)}}function L(Z,z){const x=Z||[],Y=new Array(x.length);for(let $=0;$<x.length;$++)Y[$]=F(x[$],z);return Y}}),He("packages/core/src/compute/facet.js",function(e,D){"use strict";Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"orderedReader",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"toNumeric",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return w}});const re=D("packages/core/src/compute/handle.js"),N=re.presenceReader,G=re.valueReader,F=re.dictSize,L=re.dictValue,Z=Object.freeze(["equal","quantile","log"]),z=Object.freeze(["hour","day","week","month","quarter","year"]),x=20,Y=50,$=1e4;function j(v,P){if(!v)return"none";const V=P;if(V&&(V.multi===!0||typeof V.items=="function"))return"category";const W=P&&P.base;if(W==="date"||W==="datetime"||W==="time"||W==="dateString")return"date";switch(v.kind){case"bitset":return"boolean";case"float64":case"int32":return"numeric";case"dictionary":return"category";case"multi":return"category";default:return W==="number"?"numeric":W==="boolean"?"boolean":W==="text"?"category":"none"}}function k(v){const P=v.values,V=v.kind;if((V==="float64"||V==="int32")&&P)return K=>P[K];const W=G(v);return K=>y(W(K))}function y(v){if(typeof v=="number")return v;if(v instanceof Date)return v.getTime();if(v==null||v==="")return NaN;if(typeof v=="boolean")return v?1:0;if(typeof v=="string"){const P=Number(v);if(Number.isFinite(P))return P;const V=Date.parse(v);return Number.isFinite(V)?V:NaN}return NaN}function c(v,P,V,W=Y){if(!v)return{cardinality:0,exact:!0};if(v.dict)return{cardinality:F(v.dict),exact:!0};if(v.kind==="bitset")return{cardinality:2,exact:!0};const K=G(v),R=P?P.length:V,S=new Set;for(let E=0;E<R;E++){const O=K(P?P[E]:E);if(O!=null&&(S.add(O),S.size>W))return{cardinality:S.size,exact:!1}}return{cardinality:S.size,exact:!0}}const m=36e5,s=864e5;function t(v,P=x){const V=Number.isFinite(v)&&v>0?v:0,W=Math.max(1,P)*2;return V/m<=W?"hour":V/s<=W?"day":V/(7*s)<=W?"week":V/(30*s)<=W?"month":V/(91*s)<=W?"quarter":"year"}function o(v,P){if(!Number.isFinite(v))return NaN;const V=new Date(v);switch(P){case"hour":return V.setMinutes(0,0,0),V.getTime();case"day":return V.setHours(0,0,0,0),V.getTime();case"week":{V.setHours(0,0,0,0);const W=(V.getDay()+6)%7;return V.setDate(V.getDate()-W),V.getTime()}case"month":return V.setDate(1),V.setHours(0,0,0,0),V.getTime();case"quarter":return V.setMonth(Math.floor(V.getMonth()/3)*3,1),V.setHours(0,0,0,0),V.getTime();default:return V.setMonth(0,1),V.setHours(0,0,0,0),V.getTime()}}function u(v,P){const V=new Date(v);switch(P){case"hour":V.setHours(V.getHours()+1);break;case"day":V.setDate(V.getDate()+1);break;case"week":V.setDate(V.getDate()+7);break;case"month":V.setMonth(V.getMonth()+1);break;case"quarter":V.setMonth(V.getMonth()+3);break;default:V.setFullYear(V.getFullYear()+1);break}return V.getTime()}function d(v,P,V){const W=k(v),K=N(v),R=P?P.length:V;let S=1/0,E=-1/0,O=0,M=0;for(let T=0;T<R;T++){const A=P?P[T]:T;if(K&&!K(A)){O++;continue}const I=W(A);if(!Number.isFinite(I)){O++;continue}I<S&&(S=I),I>E&&(E=I),M++}return{min:S,max:E,nulls:O,finite:M}}function i(v,P,V,W){const K=k(v),R=N(v),S=P?P.length:V,E=S>W?S/W:1,O=[];for(let T=0;T<S;T+=E){const A=P?P[Math.floor(T)]:Math.floor(T);if(R&&!R(A))continue;const I=K(A);Number.isFinite(I)&&O.push(I)}const M=Float64Array.from(O);return M.sort(),M}function g(v,P,V,W={}){const K=W.kind||j(v,W.type);return K==="none"||!v?{kind:"none",buckets:[],suppressed:"type"}:K==="boolean"?r(v,P,V,W):K==="category"?n(v,P,V,W):h(v,P,V,K,W)}function r(v,P,V,W={}){const K=N(v);let R=0;if(K){const E=P?P.length:V;for(let O=0;O<E;O++)K(P?P[O]:O)||R++}const S=[{value:!1,label:"false"},{value:!0,label:"true"}];return R>0&&W.blanks!==!1&&S.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:S}}function n(v,P,V,W){const K=W.cardinalityLimit??Y,{cardinality:R}=c(v,P,V,K);if(R>K&&(W.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:R};const S=G(v),E=P?P.length:V,O=new Map;let M=0;for(let X=0;X<E;X++){const q=S(P?P[X]:X);if(q==null||q===""){M++;continue}if(Array.isArray(q)){if(!q.length){M++;continue}for(const _ of q)O.set(_,(O.get(_)||0)+1);continue}O.set(q,(O.get(q)||0)+1)}let T=[...O.entries()];W.order==="alpha"?T.sort((X,q)=>String(X[0]).localeCompare(String(q[0]))):T.sort((X,q)=>q[1]-X[1]);let A=0,I=0;if(T.length>K){I=T.length-K;for(let X=K;X<T.length;X++)A+=T[X][1];T=T.slice(0,K)}const U=T.map(([X])=>({value:X,label:String(X)}));return A>0&&U.push({remainder:!0,label:`Other (${I} values)`}),M>0&&W.blanks!==!1&&U.push({null:!0,label:"Empty"}),{kind:"category",buckets:U,cardinality:R}}function f(v,P,V,W,K){const R=i(v,P,V,$),S=R.length;if(S<100)return null;const E=R[Math.floor(.01*S)],O=R[Math.ceil(.99*S)-1];return!(O>E)||K-W<=2*(O-E)?null:{lo:E,hi:O}}function h(v,P,V,W,K){const{min:R,max:S,nulls:E,finite:O}=d(v,P,V);if(!O)return{kind:W,buckets:E&&K.blanks!==!1?[{null:!0,label:"Empty"}]:[],empty:!0};const M=Math.max(1,Math.floor(K.buckets||x));let T=[];if(W==="date"){const I=z.includes(K.granularity)?K.granularity:t(S-R,M);let U=o(R,I);for(;U<=S&&T.length<4096;){const X=u(U,I);if(!(X>U))break;T.push({from:U,to:X}),U=X}return{kind:W,buckets:l(T,K.blanks===!1?0:E),granularity:I}}const A=Z.includes(K.strategy)?K.strategy:"equal";if(A==="quantile"){const I=i(v,P,V,$);if(I.length){const U=[I[0]];for(let X=1;X<M;X++){const q=I[Math.min(I.length-1,Math.floor(X/M*I.length))];q>U[U.length-1]&&U.push(q)}U.push(S);for(let X=0;X<U.length-1;X++)T.push({from:U[X],to:U[X+1]})}}else if(A==="log"&&R>0){const I=Math.log10(R),X=(Math.log10(S)-I)/M||1;for(let q=0;q<M;q++)T.push({from:10**(I+q*X),to:10**(I+(q+1)*X)})}if(!T.length&&A==="equal"){const I=f(v,P,V,R,S);if(I){const U=(I.hi-I.lo)/M;I.lo>R&&T.push({from:R,to:I.lo,overflow:"low"});for(let X=0;X<M;X++)T.push({from:I.lo+X*U,to:I.lo+(X+1)*U});T[T.length-1].to=I.hi,I.hi<S&&T.push({from:I.hi,to:S,overflow:"high"})}}if(!T.length){const I=(S-R)/M||1;for(let U=0;U<M;U++)T.push({from:R+U*I,to:R+(U+1)*I})}return T[T.length-1].to=S,{kind:W,buckets:l(T,K.blanks===!1?0:E),strategy:A,min:R,max:S}}function l(v,P){return P>0?[...v,{null:!0,label:"Empty"}]:v}function b(v,P,V,W,K){const R=W&&W.buckets||[],S=K&&K.length>=R.length?K.subarray(0,R.length):new Uint32Array(R.length);if(S.fill(0),!v||!R.length)return S;const E=R.length-1,O=!!R[E]&&R[E].null===!0,M=P?P.length:V;if(W.kind==="boolean"){const X=G(v);for(let q=0;q<M;q++){const _=X(P?P[q]:q);if(_==null){O&&S[E]++;continue}S[_?1:0]++}return S}if(W.kind==="category"){const X=new Map;for(let H=0;H<R.length;H++)!R[H].null&&!R[H].remainder&&X.set(R[H].value,H);const q=R.findIndex(H=>H.remainder),_=G(v);for(let H=0;H<M;H++){const ee=_(P?P[H]:H);if(ee==null||ee===""){O&&S[E]++;continue}if(Array.isArray(ee)){if(!ee.length){O&&S[E]++;continue}for(const J of ee){const ne=X.get(J);ne!==void 0?S[ne]++:q>=0&&S[q]++}continue}const te=X.get(ee);te!==void 0?S[te]++:q>=0&&S[q]++}return S}const T=O?R.length-1:R.length,A=new Float64Array(T+1);for(let X=0;X<T;X++)A[X]=R[X].from;A[T]=T?R[T-1].to:0;const I=k(v),U=N(v);for(let X=0;X<M;X++){const q=P?P[X]:X;if(U&&!U(q)){O&&S[E]++;continue}const _=I(q);if(!Number.isFinite(_)){O&&S[E]++;continue}const H=a(A,T,_);H>=0&&S[H]++}return S}function a(v,P,V){if(!P||V<v[0])return-1;if(V>=v[P])return V===v[P]?P-1:-1;let W=0,K=P-1;for(;W<K;){const R=W+K+1>>>1;V>=v[R]?W=R:K=R-1}return W}function p(v,P,V,W={}){const K=W.bounds||g(v,W.boundsIndices??P,V,W);return{bounds:K,counts:b(v,P,V,K)}}const w=p}),He("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 k}}),Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return o}});const N=D("packages/core/src/compute/handle.js").valueComparator,F=D("packages/core/src/compute/total.js").total,Z=D("packages/core/src/compute/group.js").packKeys,z=D("packages/core/src/compute/pivot.js"),x=z.joinPath,Y=z.DEFAULT_PATH_SEPARATOR,$=z.DEFAULT_MAX_COLUMNS,j="";function k(u,d,i={}){const g=i.separator||Y,r=u||[],n=d instanceof Uint32Array?d:Uint32Array.from(d||[]),f=n.length;if(r.length===0)return{tuples:[[]],paths:[j],buckets:[n]};const{keyOf:h,readers:l}=Z(r,n,0),b=new Map,a=[],p=[],w=[];for(let R=0;R<f;R++){const S=n[R],E=h(S);let O=b.get(E);if(O===void 0){O=a.length,b.set(E,O),p.push(E);const M=new Array(l.length);for(let T=0;T<l.length;T++)M[T]=l[T](S);a.push(M),w.push([])}w[O].push(S)}const v=N(i.locale),P=a.map((R,S)=>S);P.sort((R,S)=>{const E=a[R],O=a[S];for(let M=0;M<E.length;M++){const T=y(E[M],O[M],v);if(T!==0)return T}return R-S});const V=new Array(P.length),W=new Array(P.length),K=new Array(P.length);for(let R=0;R<P.length;R++){const S=P[R];V[R]=a[S],W[R]=x(a[S],g),K[R]=Uint32Array.from(w[S])}return{tuples:V,paths:W,buckets:K}}function y(u,d,i){const g=u==null,r=d==null;return g||r?g&&r?0:g?1:-1:i(u,d)}function c(u,d,i){const g=[];for(let r=0;r<u.length;r++)i.has(u[r])&&g.push(u[r]);return Uint32Array.from(g)}function m(u,d,i,g){return{value:d.length?F(u,d,i,g):null,leaves:d,count:d.length}}function s(u){const d=u&&u.opts||{},i=d.separator||Y,g=d.totalContext||{locale:d.locale},r=(u.measures||[]).filter(W=>W&&W.handle),n=u.leaves instanceof Uint32Array?u.leaves:Uint32Array.from(u.leaves||[]),f=k(u.rowHandles||[],n,{...d,separator:i}),h=k(u.columnHandles||[],n,{...d,separator:i}),l=d.maxColumns===void 0?$:d.maxColumns,b=h.paths.length*Math.max(1,r.length),a=new Map;if(l&&b>l)return{rowAxis:f,columnAxis:h,measures:r.map(W=>({colId:W.colId,fn:W.fn})),body:a,rowMargin:a,columnMargin:a,grand:a,columns:b,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${b} columns, above pivot.maxColumns of ${l}. Narrow the pivot columns or raise the limit.`,columns:b,maxColumns:l}};const p=new Map,w=new Map,v=new Map,P=new Map,V=h.buckets.map(W=>new Set(W));for(let W=0;W<h.paths.length;W++){const K=h.buckets[W],R=h.paths[W];for(const S of r)v.set(o(R,S.colId),m(S.handle,K,S.fn,g))}for(let W=0;W<f.paths.length;W++){const K=f.buckets[W],R=f.paths[W];for(const S of r)w.set(o(R,S.colId),m(S.handle,K,S.fn,g));for(let S=0;S<h.paths.length;S++){const E=c(K,h.buckets[S],V[S]);if(E.length===0)continue;const O=h.paths[S];for(const M of r)p.set(t(R,O,M.colId),m(M.handle,E,M.fn,g))}}for(const W of r)P.set(W.colId,m(W.handle,n,W.fn,g));return{rowAxis:f,columnAxis:h,measures:r.map(W=>({colId:W.colId,fn:W.fn})),body:p,rowMargin:w,columnMargin:v,grand:P,columns:b,error:null}}function t(u,d,i){return`${u}\0${d}\0${i}`}function o(u,d){return`${u}\0${d}`}}),He("packages/core/src/compute/reference.js",function(e,D){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return s}});const N=D("packages/core/src/internal/paths.js").getPath,G=D("packages/core/src/compute/handle.js"),F=G.isMissing,L=G.valueComparator,z=D("packages/core/src/compute/filter.js").testValue,x="",Y="\0";function $(u,d){const i=d.includes(".")?N(u,d):u?.[d];return i===void 0?null:i}function j(u,d,i={}){const g=d||[];let r=u.map((n,f)=>f);if(g.length===0)return r;for(let n=g.length-1;n>=0;n--)r=k(u,r,g[n],i);return r}function k(u,d,i,g){const r=i.locale!==void 0?i.locale:g.locale,n=L(r),f=i.descending!==void 0?!!i.descending:i.dir==="desc",h=[],l=[];for(const p of d){const w=$(u[p],i.col);F(w)?l.push(p):h.push(p)}const b=new Map;for(let p=0;p<h.length;p++)b.set(h[p],p);const a=(p,w)=>{const v=$(u[p],i.col),P=$(u[w],i.col);let V;return typeof i.compare=="function"?(V=i.compare(v,P,u[p],u[w],f),f&&(V=-V)):V=f?n(P,v):n(v,P),V!==0?V:b.get(p)-b.get(w)};return h.sort(a),i.nullsFirst?l.concat(h):h.concat(l)}function y(u,d,i={}){const g=[];for(let r=0;r<u.length;r++)c(u[r],d,i,r)&&g.push(r);return g}function c(u,d,i,g){if(!d)return!0;if(Array.isArray(d.conditions)){const r=d.conditions.filter(f=>f!=null);if(r.length===0)return!0;if(d.op==="or")return r.some(f=>c(u,f,i,g));const n=r.every(f=>c(u,f,i,g));return d.op==="not"?!n:n}return d.col===void 0&&typeof i.custom=="function"?!!i.custom(d,u,g):z($(u,d.col),d,i.locale)}function m(u,d,i,g){const r=i||u.map((l,b)=>b),n=new Map,f=[],h=[];for(const l of r){const b=d.map((w,v)=>{const P=$(u[l],w);return g&&g[v]?g[v](P):P}),a=b.map(w=>w==null?Y:String(w)).join(x);let p=n.get(a);p===void 0&&(p=f.length,n.set(a,p),f.push(b),h.push([])),h[p].push(l)}return{keys:f,buckets:h}}function s(u,d,i={}){const g=L(i.locale),r=u.filter(f=>!F(f)),n=r.map(t).filter(f=>f!==null);switch(d){case"count":return u.length;case"countValues":return r.length;case"sum":return n.reduce((f,h)=>f+h,0);case"avg":return r.length===0?null:n.reduce((f,h)=>f+h,0)/r.length;case"min":return r.length===0?null:r.reduce((f,h)=>g(h,f)<0?h:f);case"max":return r.length===0?null:r.reduce((f,h)=>g(h,f)>0?h:f);case"first":return u.length===0?null:o(u[0]);case"last":return u.length===0?null:o(u[u.length-1]);default:return null}}function t(u){if(typeof u=="number")return Number.isNaN(u)?null:u;if(u==null||u===""||typeof u=="boolean")return null;if(u instanceof Date)return u.getTime();const d=Number(u);return Number.isNaN(d)?null:d}function o(u){return u===void 0?null:u}}),He("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 N=D("packages/core/src/compute/sortspec.js");Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return N.collationDescriptor}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return N.isPortableSort}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return N.isPortableSortSet}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return N.describeSortEntry}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return N.describeSort}});const G=D("packages/core/src/compute/filter.js");Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return G.evaluateFilters}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return G.evaluateCondition}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return G.compact}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return G.testValue}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return G.compilePredicate}}),Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return G.releaseMask}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return G.pruneColumn}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return G.mentionsColumn}});const F=D("packages/core/src/compute/group.js");Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return F.groupByColumns}}),Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return F.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 Z=D("packages/core/src/compute/total.js");Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return Z.TOTAL_FNS}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return Z.TOTAL_LABELS}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return Z.totalLabel}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return Z.total}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return Z.collectValues}});const z=D("packages/core/src/compute/pivot.js");Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return z.pivot}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return z.resolvePivotKeys}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return z.pivotKey}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return z.joinPath}}),Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return z.KEY_DELIMITER}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return z.DEFAULT_PATH_SEPARATOR}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return z.DEFAULT_MAX_COLUMNS}});const x=D("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return x.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return x.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return x.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return x.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return x.GRAND_PATH}});const Y=D("packages/core/src/compute/reference.js");Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return Y.referenceSort}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return Y.referenceFilter}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return Y.referenceGroup}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return Y.referenceTotal}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return Y.referencePasses}}),Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return Y.referenceValue}});const $=D("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return $.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return $.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return $.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return $.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return $.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return $.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return $.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return $.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return $.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return $.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return $.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return $.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 k=D("packages/core/src/compute/windowed.js");Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return k.Window}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return k.WINDOW_KINDS}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return k.openWindow}});const y=D("packages/core/src/compute/statistics.js");Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return y.MAINTENANCE}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return y.APPROXIMATE}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return y.maintenanceOf}});const c=D("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return c.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return c.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return c.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return c.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return c.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return c.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return c.anomalyCondition}});const m=D("packages/core/src/compute/forecast.js");Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return m.FORECAST_METHODS}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return m.forecast}})}),He("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 Z}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"groupPrefixKeys",{enumerable:!0,get:function(){return m}});const N=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/internal/predicates.js").isFunction,L=32,Z="\0";function z(s){return new x(s)}class x{#e;#t;constructor(t){this.#e=F(t&&t.rowKey)?t.rowKey:null;const o=t&&t.config?t.config.rowHeight:void 0;this.#t=typeof o=="number"||F(o)?o:L}get keyed(){return this.#e!==null}keyOf(t,o){if(this.#e){const u=this.#e(t);if(u!=null)return String(u)}else N("source.rowKey.missing","no config.rowKey; falling back to index identity.","Row changes, streaming dedupe, selection persistence and remote reload are disabled.");return`#${o}`}heightOf(t){return F(this.#t)?Number(this.#t(t))||L:this.#t}leaf(t,o,u=0,d=null){const i={key:this.keyOf(t,o),data:t,level:u,parent:d,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:o};return i.height=this.heightOf(i),i}group(t){const o={key:c(t.keyPath||t.path),data:null,level:t.level,parent:t.parent||null,children:[],group:!0,expanded:t.expanded!==!1,leafCount:t.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:t.column,groupValue:t.value,groupPath:t.path,hasChildren:t.hasChildren!==!1};return t.totals&&(o.totals=t.totals),o.height=this.heightOf(o),o}footer(t){const o={key:`${t.key}${Z}footer`,data:null,level:t.level,parent:t,group:!0,footer:!0,expanded:!1,leafCount:t.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:t.groupColumn,groupValue:t.groupValue,groupPath:t.groupPath,hasChildren:!1,totals:t.totals};return o.height=this.heightOf(o),o}detail(t,o){return{key:`${t.key}${Z}detail`,data:t.data,level:t.level+1,parent:t,group:!1,detail:!0,expanded:!1,leafCount:0,height:o,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:t.key}}grandTotal(t,o){const u={key:`${Z}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:o,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:t};return u.height=this.heightOf(u),u}skeleton(t,o=0,u=!1){const d={key:`${Z}pending${Z}${t}`,data:null,level:o,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:t,selected:!1,physical:null,pending:!0};return u&&(d.loadError=!0),d.height=this.heightOf(d),d}}function Y(s,t,o,u){return{key:`${Z}pinned${Z}${o}${Z}${t}`,data:s,level:0,parent:null,group:!1,expanded:!1,leafCount:0,height:u,index:null,selected:!1,physical:null,hasChildren:!1,pinned:o}}function $(s,t){return new Proxy([],{get(o,u,d){if(u==="length")return s();if(typeof u=="string"){const i=Number(u);if(Number.isInteger(i)&&i>=0)return t(i)}return Reflect.get(o,u,d)},has(o,u){if(typeof u=="string"){const d=Number(u);if(Number.isInteger(d)&&d>=0)return d<s()}return Reflect.has(o,u)}})}function j(s){return s==null?"":String(s)}const k="";function y(s){if(s==null)return k;const t=String(s);return t.startsWith(k)?k+t:t}function c(s){const t=s||[];let o="g";for(let u=0;u<t.length;u++)o+=Z+y(t[u]);return o}function m(s){const t=new Array(s.length),o=[];for(let u=0;u<s.length;u++)o.push(s[u]),t[u]=c(o);return t}}),He("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 Z}});const N=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/warn.js").warnOnce;class L{#e;#t;#n;#r=new Map;#i=0;constructor(x,Y,$){this.#e=x,this.#t=Y,this.#n=N($)?$:()=>!1}get store(){const x=this.#e.store;return x&&N(x.column)?x:null}invalidate(){this.#i++}handle(x){const Y=this.store;if(Y){const y=Y.column(x);if(y)return y}const $=this.#r.get(x);if($&&$.builtAt===this.#i)return $.handle;const j=this.#s(x);if(!j)return;if(Y&&this.#n()){F(`source.dropped.${x}`,`column "${x}" cannot be served under ingest.dropSourceRows: it is an impure computed column (a shadow or a positional/rank column) that is never stored, so it can only be read from the caller's row objects — which dropSourceRows has released. Do not sort, filter, group or total on such a column with dropSourceRows enabled.`);return}const k=this.#o(j);return this.#r.set(x,{handle:k,builtAt:this.#i}),k}#s(x){const Y=this.#e.columns;return Y&&N(Y.get)?Y.get(x):void 0}#o(x){const Y=this.#t()||[],$=Y.length,j=new Array($),k=N(x.getValue)?c=>x.getValue(c):c=>c?.[x.field||x.id];for(let c=0;c<$;c++)j[c]=Y[c]===void 0?void 0:k(Y[c]);const y=this.#i;return{id:x.id,kind:"object",nullable:!1,values:j,presence:null,dict:null,offsets:null,get(c){return j[c]},version:y}}}function Z(z,x,Y){return new L(z,x,Y)}}),He("packages/core/src/compute/incremental.js",function(e,D){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Y}});const N=D("packages/core/src/store/columnstore.js").toFloat,G=Object.freeze(["sum","avg","countValues","min","max"]),F=Object.freeze(["float64"]),L=1e15;function Z($,j){return typeof $!="string"||!G.includes($)?!1:!!j&&F.includes(j.kind)}function z($){if($==null)return null;const j=N($);return Number.isNaN(j)?null:j}class x{#e;#t=0;#n=0;#r=0;#i=1/0;#s=-1/0;#o=!1;#l=!1;constructor(j){this.#e=j}get valid(){return this.#o&&!this.#l}get fn(){return this.#e}seed(j){this.#a();for(let k=0;k<j.length;k++){const y=z(j[k]);y!==null&&this.#c(y)}this.#o=!0}seedColumn(j,k,y){this.#a();for(let c=0;c<y.length;c++){const m=y[c];if(k&&k(m)===0)continue;const s=j[m];Number.isNaN(s)||this.#c(s)}this.#o=!0}#a(){this.#t=0,this.#n=0,this.#r=0,this.#i=1/0,this.#s=-1/0,this.#l=!1}#c(j){if(!Number.isFinite(j)){this.#l=!0;return}const k=this.#t+j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-k+j:j-k+this.#t,this.#t=k,this.#r++,j<this.#i&&(this.#i=j),j>this.#s&&(this.#s=j)}#u(j){const k=this.#t-j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-k-j:-j-k+this.#t,this.#t=k,this.#r--}update(j,k){if(!this.#o)return!1;const y=z(j),c=z(k);return y===null&&c===null?!0:y!==null&&!Number.isFinite(y)||c!==null&&!Number.isFinite(c)?!1:this.#e==="min"||this.#e==="max"?y===null||c===null?!1:this.#e==="min"?c<this.#i?(this.#i=c,!0):y>this.#i:c>this.#s?(this.#s=c,!0):y<this.#s:Math.abs(this.#t)>L?!1:(y!==null&&this.#u(y),c!==null&&this.#c(c),!0)}value(){switch(this.#e){case"countValues":return this.#r;case"avg":return this.#r?(this.#t+this.#n)/this.#r:null;case"min":return this.#r?this.#i:null;case"max":return this.#r?this.#s:null;default:return this.#t+this.#n}}invalidate(){this.#o=!1}}const Y=x}),He("packages/core/src/source/filterwire.js",function(e,D){"use strict";Object.defineProperty(e,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"resolveRelativeRange",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"relativeTokenOf",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"relativeTokenHelp",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"isResolvableRelative",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"resolveRelativeCondition",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"forEachCondition",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"mapConditions",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"normaliseFilterSet",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"buildFilterSet",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"wireFilters",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"querySignature",{enumerable:!0,get:function(){return v}});const N=D("packages/core/src/internal/warn.js").warnOnce,G="source.remote.hostFilter",F="source.where.pageRelative";function L(W,K){!Array.isArray(W)||!W.length||N(F,`filters.where (${W.join(", ")}) runs over the rows the ${K} source fetched,`,"not the whole dataset: match counts and totals are page-relative.","Give the predicate a { condition } twin so the engine can narrow the fetch itself.")}function Z(W){const K=(W||{}).config;!K||!K.hostFilter||N(G,"config.hostFilter is not sent to a server-delegated source (paged/remote) and is not applied:","filtering only the fetched window would give wrong counts and totals.","Express the filter as a FilterSet condition, or send it through config.context.")}const z="source.where.notApplied";function x(W,K){N(`${z}:${W}`,`filters.where("${W}") is registered but the ${K} source holds only its fetched window`,"and cannot run the predicate over it: the predicate is not applied there, and rows it would","exclude stay on screen.","Give it a { condition } twin so the engine can narrow the fetch itself — that is the","supported route for a paged or remote source.")}const Y="source.where.overThreshold";function $(W,K,R,S){!Array.isArray(W)||!W.length||N(`${Y}:${K}`,`filters.where (${W.join(", ")}) is not applied to the ${K} pushdown source:`,R===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${R.toLocaleString()} rows, at or past the whereRowLimit of ${S.toLocaleString()}.`,"Running the predicate needs every matching row fetched and held here, which is the whole","download a pushdown source exists to avoid, so it is refused and the rows the predicate","would exclude stay on screen.","Give the predicate a { condition } twin so the engine narrows the fetch itself — that is the","route that works at any size — or raise `whereRowLimit` on the source config if you want the","download.")}const j=new Map;function k(W){let K=j.get(W);return K||(K=new Intl.DateTimeFormat("en-US",{timeZone:W,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),j.set(W,K)),K}function y(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function c(W,K){const R=k(K).formatToParts(new Date(W)),S={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const E of R)E.type==="year"?S.y=+E.value:E.type==="month"?S.m=+E.value:E.type==="day"?S.d=+E.value:E.type==="hour"?S.h=+E.value%24:E.type==="minute"?S.mi=+E.value:E.type==="second"&&(S.s=+E.value);return S}function m(W,K){const R=c(W,K);return Date.UTC(R.y,R.m-1,R.d,R.h,R.mi,R.s)-Math.floor(W/1e3)*1e3}function s(W,K,R,S){const E=Date.UTC(W,K-1,R),O=E-m(E,S);return E-m(O,S)}function t(W,K,R){const S=new Date(Date.UTC(W.y,W.m-1,W.d+K));return s(S.getUTCFullYear(),S.getUTCMonth()+1,S.getUTCDate(),R)}const o=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function u(W,K){if(typeof W!="string")return null;const R=W.trim().toLowerCase().replace(/[\s_-]+/g,""),S=/^last(\d*|n)days?$/.exec(R);if(S){const E=S[1]==="n"?"":S[1],O=Number(E||K);return!Number.isFinite(O)||O<=0?null:{kind:"lastNDays",n:Math.floor(O)}}switch(R){case"today":return{kind:"today",n:0};case"yesterday":return{kind:"yesterday",n:0};case"thisweek":return{kind:"thisWeek",n:0};case"thismonth":return{kind:"thisMonth",n:0};case"thisquarter":return{kind:"thisQuarter",n:0};case"thisyear":return{kind:"thisYear",n:0};case"quartertodate":case"qtd":return{kind:"quarterToDate",n:0};case"yeartodate":case"ytd":return{kind:"yearToDate",n:0};default:return null}}function d(W,K={}){const R=u(W,K.n);if(!R)return null;const S=K.tz||y(),E=K.now instanceof Date?K.now.getTime():typeof K.now=="number"?K.now:Date.now(),O=c(E,S),M=s(O.y,O.m,O.d,S),T=t(O,1,S);let A=M,I=T;switch(R.kind){case"today":break;case"yesterday":A=t(O,-1,S),I=M;break;case"lastNDays":I=K.includeToday?T:M,A=t(O,K.includeToday?-(R.n-1):-R.n,S);break;case"thisWeek":{const U=Number.isFinite(K.weekStartsOn)?Number(K.weekStartsOn):1,q=(new Date(Date.UTC(O.y,O.m-1,O.d)).getUTCDay()-U+7)%7;A=t(O,-q,S),I=t(O,-q+7,S);break}case"thisMonth":A=s(O.y,O.m,1,S),I=s(O.m===12?O.y+1:O.y,O.m===12?1:O.m+1,1,S);break;case"thisQuarter":case"quarterToDate":{const U=Math.floor((O.m-1)/3)*3+1;A=s(O.y,U,1,S),I=R.kind==="quarterToDate"?T:U===10?s(O.y+1,1,1,S):s(O.y,U+3,1,S);break}case"thisYear":case"yearToDate":A=s(O.y,1,1,S),I=R.kind==="yearToDate"?T:s(O.y+1,1,1,S);break;default:return null}return{from:new Date(A).toISOString(),to:new Date(I).toISOString(),bounds:"[)",tz:S,relative:R.kind==="lastNDays"?`last${R.n}Days`:R.kind,n:R.n}}function i(W){if(!W||typeof W!="object")return null;const K=W.value;if(K&&typeof K=="object"&&!Array.isArray(K)&&"relative"in K)return{token:String(K.relative),n:typeof K.n=="number"?K.n:void 0};if(W.op==="relative"&&typeof W.value=="string")return{token:W.value,n:void 0};const R=W.meta;return R&&typeof R.relative=="string"&&W.value===void 0?{token:R.relative,n:typeof R.n=="number"?R.n:void 0}:null}function g(){return`Known tokens: ${o.filter(K=>K!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function r(W){const K=i(W);return K?u(K.token,K.n)!==null:!1}function n(W,K={}){const R=i(W);if(!R)return W;const S=d(R.token,{...K,n:R.n});return S?{...W,type:W.type||"date",op:"between",value:[S.from,S.to],bounds:W.bounds||S.bounds,meta:{...W.meta||{},relative:S.relative,tz:S.tz}}:(N(`source.relative.${R.token}`,`unknown relative date token "${R.token}"; sending the condition unresolved.`,g()),W)}function f(W){return!!W&&typeof W=="object"&&Array.isArray(W.conditions)}function h(W,K){if(W){if(f(W)){for(const R of W.conditions)h(R,K);return}K(W)}}function l(W,K){if(!W)return null;if(!f(W))return K(W);const R=W;let S=!1;const E=[];for(const O of R.conditions){const M=l(O,K);M!==O&&(S=!0),M&&E.push(M)}return!S&&E.length===R.conditions.length?W:E.length?{...R,conditions:E}:null}function b(W){if(!W)return null;if(!f(W))return W;const K=W,R=[];for(const S of K.conditions){const E=b(S);E&&R.push(E)}return R.length?{op:K.op,conditions:R}:null}function a(W){const K=b(W);return K?f(K)&&K.op==="and"?K:{op:"and",conditions:[K]}:null}function p(W){const K=(W||[]).filter(Boolean);return K.length?{op:"and",conditions:K}:null}function w(W,K={}){const R=l(W,S=>n(S,K));return a(R)}function v(W){const K=P(W.filters??null);return JSON.stringify([K,W.sort??null,W.quick??"",W.groupBy??null,W.pivotBy??null,V(W.context)])}function P(W){if(!W)return null;if(f(W)){const S=W;return{op:S.op,conditions:S.conditions.map(P)}}const K=W,R=K.meta&&typeof K.meta.relative=="string"?K.meta.relative:i(K)?.token;return{col:K.col,op:K.op,bounds:K.bounds??null,caseSensitive:K.caseSensitive??!1,value:R?`rel:${R}`:K.value??null}}function V(W){if(W==null)return null;try{return JSON.parse(JSON.stringify(W))}catch{return N("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),He("packages/core/src/source/tree.js",function(e,D){"use strict";Object.defineProperty(e,"SYNTHETIC",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"buildFromPath",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"assignLevels",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resolveTree",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"buildTree",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"indexTree",{enumerable:!0,get:function(){return c}});const N=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/warn.js").warnOnce,L="",Z="\0tree:";function z(m,s){return{physical:m,key:s,level:0,children:[],value:void 0}}function x(m,s){const t=[],o=new Map;for(let u=0;u<m.length;u++){const d=m[u],i=s.pathOf(d),g=Array.isArray(i)?i.map(n=>String(n)):[];if(!g.length){const n=z(d,s.keyOf(d));t.push(n);continue}let r=null;for(let n=0;n<g.length;n++){const f=g.slice(0,n+1).join(L),h=n===g.length-1;let l=o.get(f);l&&h&&l.physical===-1&&(l.physical=d,l.key=s.keyOf(d)),l||(l=z(h?d:-1,h?s.keyOf(d):Z+f),l.level=n,l.value=g[n],o.set(f,l),r?r.children.push(l):t.push(l)),r=l}}return{roots:t,nodes:o}}function Y(m,s){const t=new Map,o=[];for(let g=0;g<m.length;g++){const r=m[g],n=s.keyOf(r),f=z(r,n);t.set(n,f);const h=s.parentOf(r);h!=null&&h!==""&&o.push({node:f,parent:String(h)})}let u=null;const d=new Map;for(const{node:g,parent:r}of o){const n=t.get(r);if(n){d.set(g.key,n);continue}s.orphans&&s.orphans!=="root"&&(u||(u=z(-1,`${Z}orphans`),u.value=s.orphans),d.set(g.key,u))}const i=[];for(const g of t.values()){const r=d.get(g.key);r?r.children.push(g):i.push(g)}return u&&u.children.length&&i.push(u),{roots:$(i,t,s.orphans,u),nodes:t}}function $(m,s,t,o){const u=new Set,d=[...m];for(;d.length;){const f=d.pop();if(!u.has(f.key)){u.add(f.key);for(const h of f.children)d.push(h)}}const i=[];for(const f of s.values())u.has(f.key)||i.push(f);if(!i.length)return m;const g=!!t&&t!=="root";F("tree.cycle",`tree.parentKey produced ${i.length} row(s) inside a parent cycle; `+(g?`they are shown under "${t}".`:"they are shown at the root."));for(const f of i)f.children=f.children.filter(h=>u.has(h.key));if(!g)return[...m,...i];let r=o;const n=[...m];return r||(r=z(-1,`${Z}orphans`),r.value=t,n.push(r)),r.children.push(...i),n}function j(m){let s=0;const t=(o,u)=>{for(const d of o)d.level=u,u>s&&(s=u),d.children.length&&t(d.children,u+1)};return t(m,0),s}function k(m,s){if(!m||typeof m!="object")return null;const t=m.path,o=m.parentKey,u=N(m.hasChildren)?d=>!!m.hasChildren(s.dataAt(d)):null;if(N(t))return{mode:"path",pathOf:d=>t(s.dataAt(d)),keyOf:s.keyOf,declaresChildren:u};if(o!=null){const d=N(o)?o:i=>i?.[o];return{mode:"parentKey",parentOf:i=>d(s.dataAt(i)),keyOf:s.keyOf,orphans:m.orphans||"root",declaresChildren:u}}return F("tree.shape","tree is configured with neither `path` nor `parentKey`; rows stay flat."),null}function y(m,s){const t=s.mode==="path"?x(m,s):Y(m,s),o=j(t.roots);return{...t,depth:o}}function c(m,s){const t=new Map,o=u=>{for(let d=0;d<u.length;d++){const i=u[d];if(i.physical>=0){const g=s?s(i.physical):!1,r=g&&i.children.length===0;t.set(i.physical,{level:i.level,posinset:d+1,setsize:u.length,hasChildren:i.children.length>0||g,lazy:r})}i.children.length&&o(i.children)}};return o(m),t}}),He("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 N}});const re=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function N(G){const F=G&&typeof G=="object"?G.reason:null;return typeof F=="string"&&re.includes(F)}}),He("packages/core/src/source/memory.js",function(e,D){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"quickMatcher",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"MemorySource",{enumerable:!0,get:function(){return q}});const N=D("packages/core/src/internal/lru.js").Lru,G=D("packages/core/src/internal/warn.js"),F=G.warnOnce,L=G.fail,z=D("packages/core/src/internal/predicates.js").isFunction,Y=D("packages/core/src/internal/compare.js").defaultCompare,j=D("packages/core/src/internal/merge.js").mergeRow,k=D("packages/core/src/source/rows.js"),y=k.createRowFactory,c=k.groupKey,m=k.groupPathElement,s=k.groupPrefixKeys,t=k.lazyRowView,u=D("packages/core/src/source/handles.js").createHandleProvider,d=D("packages/core/src/compute/incremental.js"),i=d.RunningTotal,g=d.isIncremental,n=D("packages/core/src/compute/handle.js").presenceReader,f=D("packages/core/src/source/filterwire.js"),h=f.querySignature,l=f.mapConditions,b=f.resolveRelativeCondition,a=D("packages/core/src/source/tree.js"),p=a.buildTree,w=a.resolveTree,v=a.indexTree,P=D("packages/core/src/source/settle.js"),V=P.PIPELINE_SETTLE_REASONS,W=P.isPipelineSettle,K=Object.freeze(["filter","sort","group","total","pivot","flatten"]),R=Object.freeze([]);function S(_,H){if(!_)return null;const ee=H==="grand"?_.grandTotal:_.groupTotal;return ee??_.total}function E(_){return!!_&&!_.running}function O(_){if(_)return _.value&&z(_.value.compare)?_.value.compare:z(_.compare)?_.compare:void 0}function M(_){const H=_&&_.dataType;return!H||!z(H.items)?null:{items:H.items,type:_.itemType&&_.itemType.name||"text"}}function T(_){return!!_&&(typeof _=="object"||typeof _=="function")&&z(_.then)}const A=new Uint32Array(0),I=4096;function U(_,H){return new q(_,H)}function X(_,H){if(H==="regex")try{const ee=new RegExp(_,"iu");return te=>ee.test(te)}catch{return ee=>ee.includes(_)}if(H==="fuzzy"){const ee=[..._].filter(te=>te!==" ");return ee.length?te=>{let J=0;for(let ne=0;ne<te.length&&J<ee.length;ne++)te[ne]===ee[J]&&J++;return J===ee.length}:()=>!0}if(H==="words"){const ee=_.split(/\s+/).filter(Boolean);return ee.length?te=>ee.every(J=>te.includes(J)):()=>!0}return ee=>ee.includes(_)}class q{mode="memory";#e;#t;#n;#r=!1;#i=null;#s;#o;#l=new Map;#a=!1;#c=0;#u=0;#f=new Map;#d=new Map;#h;#p=null;#m=q.#g();static#g(){return{slots:[],groupHeadings:R,unnumbered:R,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;#N=null;#M=null;#R=null;#I=null;#V=null;#W=Symbol("unset");#x=new Map;#q=null;get#U(){return this.#m.slots}set#U(H){this.#m.slots=H}get#Y(){return this.#m.inlineLeaves}set#Y(H){this.#m.inlineLeaves=H}get#G(){return this.#m.groupHeadings}set#G(H){this.#m.groupHeadings=H}get#D(){return this.#m.unnumbered}set#D(H){this.#m.unnumbered=H}get#_(){return this.#m.pivot}set#_(H){this.#m.pivot=H}constructor(H,ee){this.#t=H||{mode:"memory"},this.#e=ee||{};const te=this.#e.config||{};this.#n=this.#t.rows||te.rows||[],this.#s=y(this.#e),this.#o=u(this.#e,()=>this.#n,()=>this.#r),this.#h=new N(Number(te.rowCacheSize)||I);for(const J of K)this.#l.set(J,{key:null,result:null,id:0,computed:!1})}count(){this.#H();const H=this.#be();return H?H.length:this.#U.length}#be(){const H=Number(this.#K("pageSize",0))||0;if(H<=0)return null;const ee=this.#U.length,te=Math.max(1,Math.ceil(ee/H)),ne=Math.min(Math.max(0,Number(this.#K("page",0))||0),te-1)*H;return{offset:ne,length:Math.max(0,Math.min(H,ee-ne))}}pageInfo(){this.#H();const H=Number(this.#K("pageSize",0))||0,ee=this.#U.length;if(H<=0)return{page:0,pageSize:0,total:ee,pageCount:1};const te=Math.max(1,Math.ceil(ee/H));return{page:Math.min(Math.max(0,Number(this.#K("page",0))||0),te-1),pageSize:H,total:ee,pageCount:te}}totalCount(){return this.#Ke().length}matchCount(){return this.#H(),this.#m.matchCount}at(H){this.#H();const ee=this.#be();if(ee)return H<0||H>=ee.length?void 0:this.#dt(ee.offset+H,H);if(!(H<0||H>=this.#U.length))return this.#dt(H,H)}byKey(H){this.#H(),this.#p||this.#ie();const ee=this.#p.get(H);if(ee!==void 0)return this.#le(ee);for(let te=0;te<this.#U.length;te++){const J=this.#U[te];if(typeof J!="number"&&J&&J.key===H)return this.#dt(te)}}loaded(H){return H>=0&&H<this.count()}hint(H,ee){}display(){return this.#H(),this.#q||(this.#q=this.#$e()),this.#q}invalidateQuickText(){this.#x.clear(),this.invalidate("filter")}invalidate(H){const ee=K.indexOf(H);ee<0&&L(`unknown pipeline stage "${H}"; expected one of ${K.join(", ")}`);for(let te=ee;te<K.length;te++){const J=this.#l.get(K[te]);J.key=null,J.computed=!1}this.#q=null}apply(H){const ee=[],te={added:[],updated:[],removed:[],rejected:ee};if(!H)return te;let J=!1;const ne=new Set;if(H.remove&&H.remove.length)for(const se of H.remove){const ae=this.#Be(se);if(ae===void 0){ee.push({operation:"remove",id:this.#he(se),reason:"unknown-id"});continue}te.removed.push(this.#s.keyOf(this.#r?this.#j(ae):this.#n[ae],ae)),this.#r||(this.#n[ae]=void 0),this.#h.delete(ae),this.#x.delete(ae),J=!0}if(H.update&&H.update.length){const se=this.#O.size||this.#kt()?this.#Ie():null,ae=this.#v.size?this.#et():null,we=ae&&ae.length?this.#Ie():null;for(const fe of H.update){const ge=this.#Be(fe);if(ge===void 0){ee.push({operation:"update",id:this.#Re(fe),reason:"unknown-id"});continue}const je=this.#r?this.#i&&this.#i.has(ge)?this.#i.get(ge):this.#j(ge):this.#n[ge],Pe=j(je,fe);for(const de of this.#xe(je,Pe))ne.add(de);if(this.#r||(this.#n[ge]=Pe),se&&this.#Je(se,ge,je,Pe),we&&this.#wt(ae,we,ge,je,Pe),this.#p){const de=this.#s.keyOf(je,ge),oe=this.#s.keyOf(Pe,ge);de!==oe&&(this.#p.delete(de),this.#p.set(oe,ge))}this.#h.delete(ge),this.#x.delete(ge),te.updated.push(this.#le(ge))}}if(H.add&&H.add.length&&this.#r){typeof H.at=="number"&&H.at<this.#ft()&&(this.#h.clear(),this.#x.clear()),this.#p=null;for(const se of H.add){const ae=this.#Ce(this.#Re(se));ae!==void 0&&te.added.push(this.#le(ae))}J=!0}else if(H.add&&H.add.length){let se=typeof H.at=="number"?H.at:this.#n.length;if(se<this.#n.length){let fe=0;for(let ge=0;ge<this.#n.length;ge++)this.#n[ge]!==void 0&&fe++;if(fe!==this.#n.length){let ge=0;for(let je=0;je<this.#n.length;je++)this.#n[je]!==void 0&&(this.#n[ge++]=this.#n[je]);this.#n.length=ge,this.#p=null,this.#h.clear(),this.#x.clear()}}const ae=this.#n.length;se=Math.max(0,se);let we=H.add===this.#n?H.add.slice():H.add;if(this.#s.keyed){const fe=[];for(const ge of we){const je=this.#Re(ge);if(this.#Be(je)!==void 0){ee.push({operation:"add",id:je,reason:"duplicate-id"});continue}fe.push(ge)}fe.length!==we.length&&(we=fe)}if(!we.length)return te;if(se>=ae)for(let fe=0;fe<we.length;fe++)this.#n.push(we[fe]);else this.#n.splice(se,0,...we),this.#h.clear(),this.#x.clear();for(let fe=0;fe<we.length;fe++)te.added.push(this.#le(se>=ae?ae+fe:se+fe));J=!0}return this.#c++,J&&(this.#p=null,this.#rt()),this.#o.invalidate(),this.#q=null,J||this.#z(ne)?(this.#u++,this.invalidate("filter")):this.invalidate("total"),this.#gt("rows:changed",{companion:!0,added:te.added.length,updated:te.updated.length,removed:te.removed.length}),this.#i=null,te}groupHeadingsAt(H){this.#H();const ee=this.#G;if(!ee.length||!Number.isInteger(H)||H<0)return R;let te=0,J=ee.length-1,ne=-1;for(;te<=J;){const ae=te+J>>1;ee[ae].at<=H?(ne=ae,te=ae+1):J=ae-1}if(ne<0)return R;const se=[];for(let ae=ee[ne].row;ae;ae=ae.parent)se.push(ae);return se.reverse(),se}unnumberedRowCount(H){this.#H();const ee=this.#D;if(!ee.length||!Number.isInteger(H)||H<0)return 0;let te=0,J=ee.length-1,ne=-1;for(;te<=J;){const se=te+J>>1;ee[se].at<=H?(ne=se,te=se+1):J=se-1}return ne+1}moveRow(H,ee){if(this.#r)return F("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 te=this.#n;if(!Number.isInteger(H)||!Number.isInteger(ee))return!1;let J=0;for(let ae=0;ae<te.length;ae++)te[ae]!==void 0&&J++;if(H<0||H>=J)return!1;const ne=Math.max(0,Math.min(J-1,ee));if(ne===H)return!1;if(J!==te.length){let ae=0;for(let we=0;we<te.length;we++)te[we]!==void 0&&(te[ae++]=te[we]);te.length=ae}const[se]=te.splice(H,1);return te.splice(ne,0,se),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#x.clear(),this.#rt(),this.#o.invalidate(),this.#q=null,this.invalidate("filter"),this.#gt("rows:changed",{companion:!0,added:0,updated:0,removed:0,moved:1}),!0}reload(H){this.#ce(),this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#rt(),this.#o.invalidate(),this.invalidate("filter"),this.#gt("model:changed",{reason:"reload"})}destroy(){this.#ce(),this.#h.clear(),this.#x.clear(),this.#p=null,this.#U=[],this.#Y=null,this.#q=null,this.#rt();for(const H of K)this.#l.set(H,{key:null,result:null,id:0,computed:!1})}#ce(){for(const{controller:H}of this.#b.values())try{H.abort()}catch{}this.#b.clear()}setRows(H){this.#n=H||[],this.#r=!1,this.#c++,this.#u++,this.#p=null,this.#x.clear(),this.#h.clear(),this.#rt(),this.#o.invalidate(),this.invalidate("filter")}notePriorRows(H){this.#i=H||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#x.clear(),this.#o.invalidate()}data(){if(!this.#r)return this.#n;const H=this.#e.store;if(!H||!z(H.source))return this.#n;const ee=H.physical||0,te=new Array(ee);for(let J=0;J<ee;J++)te[J]=H.live&&!H.live(J)?void 0:H.source(J);return te}#fe(){const H=this.#K("detail",null);return!H||!z(H.isOpen)||H.inline===!1?null:H}#Ne(){const H=(this.#e.config||{}).tree;return this.#W!==H&&(this.#W=H,this.#V=w(H,{dataAt:ee=>this.#j(ee),keyOf:ee=>this.#s.keyOf(this.#j(ee),ee)})),this.#V}#re(){return(this.#e.config||{}).grandTotalRow==="bottom"}grandTotalRow(){if(!this.#re())return null;this.#H();const H=this.#m.grand;return H?this.#s.grandTotal(H,this.#nt(this.#m.grandLeaves)):null}pivot(){return this.#H(),this.#_}pivotMatrix(){this.#H();const H=this.#m.groupLeaves,ee=(this.#e.compute||{}).pivotMatrix;if(!z(ee))return null;const te=this.#K("groupBy",[]),J=this.#K("pivotBy",[]);if(!te.length&&!J.length)return F("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.#Ie().map(ae=>({colId:ae.id,handle:this.#o.handle(ae.id),fn:S(ae,"group")})).filter(ae=>ae.handle&&ae.fn),se=this.#e.config||{};return ee({rowHandles:te.map(ae=>this.#o.handle(ae)).filter(Boolean),columnHandles:J.map(ae=>this.#o.handle(ae)).filter(Boolean),measures:ne,leaves:H||new Uint32Array(0),opts:{locale:se.locale,separator:(se.pivot||{}).separator,maxColumns:(se.pivot||{}).maxColumns}})}keysForLeaves(H){const ee=[];if(!H)return ee;for(let te=0;te<H.length;te++){const J=this.#le(H[te]);J&&J.key!=null&&ee.push(String(J.key))}return ee}leavesOf(H){this.#H();const ee=this.#l.get("group"),te=ee&&ee.result;if(!te||!te.nodes)return[];const J=te.nodes.get(H);if(!J)return[];const ne=[],se=ae=>{const we=ae.row&&ae.row.children;if(we&&we.length){for(const fe of we){const ge=te.nodes.get(fe.key);ge&&se(ge)}return}if(ae.leaves)for(let fe=0;fe<ae.leaves.length;fe++)ne.push(this.#le(ae.leaves[fe]))};return se(J),ne}#he(H){return typeof H=="string"?H:this.#Re(H)}#Re(H){try{return this.#s.keyOf(H,-1)}catch{return"(unkeyed)"}}#Be(H){if(typeof H=="string")return this.#Ce(H);if(this.#s.keyed){const te=this.#s.keyOf(H,-1),J=this.#Ce(te);if(J!==void 0)return J}if(this.#r)return;const ee=this.#n.indexOf(H);return ee>=0?ee:void 0}#Ce(H){return this.#p||this.#ie(),this.#p.get(H)}#ie(){this.#p=new Map;const H=this.#ft(),ee=this.#e.store,te=ee&&z(ee.live)?J=>ee.live(J):null;for(let J=0;J<H;J++){if(te&&!te(J))continue;const ne=this.#j(J);ne!==void 0&&this.#p.set(this.#s.keyOf(ne,J),J)}}#xe(H,ee){const te=[];for(const J of this.#Z())this.#_e(J)&&this.#oe(J,H,ee,new Set)&&te.push(J);return te}#oe(H,ee,te,J){if(J.has(H))return!1;J.add(H);const ne=this.#_e(H);if(!ne)return!1;const se=ne.value&&ne.value.deps;return Array.isArray(se)&&se.length?se.some(ae=>this.#oe(String(ae),ee,te,J)):z(ne.getValue)?!Object.is(ne.getValue(ee),ne.getValue(te)):!1}#Z(){const H=new Set;for(const te of this.#K("sort",[]))H.add(te.col);for(const te of this.#K("groupBy",[]))H.add(te);const ee=te=>{if(te){if(Array.isArray(te.conditions)){te.conditions.forEach(ee);return}te.col&&H.add(te.col)}};return ee(this.#K("filters",null)),[...H]}#z(H){if(!H.size)return!1;if(this.#K("quick",""))return!0;for(const ee of this.#Z())if(H.has(ee))return!0;return!1}#H(){if(!this.#a){this.#a=!0;try{this.#Q()}finally{this.#a=!1}}}pipelineRunning(){return this.#a}#Q(){const H=this.#te("filter",()=>this.#de(),()=>this.#je()),ee=this.#Ee(H),te=this.#te("group",()=>this.#ae(),()=>this.#k(ee)),J=this.#te("total",()=>this.#F(),()=>this.#We(te));this.#te("pivot",()=>this.#we(),()=>this.#Ot(te)),this.#te("flatten",()=>this.#se(),()=>this.#qe(te)),this.#Ae(te,J)}#Ee(H){const ee=this.#l.get("sort"),te=this.#$();if(ee.computed&&ee.key===te&&!this.#b.has("sort"))return ee.result;const J=this.#b.get("sort");return J&&J.key===te?ee.result:ee.result&&this.#ve(H)?(this.#ke(H,te),ee.result):this.#te("sort",()=>te,()=>this.#He(H))}#ee(){if(this.#y===null){const H=this.#e.pipelineWorker,ee=z(H)?H():null;this.#y=ee||!1}return this.#y||null}#pe(){const H=this.#K("sort",[]);if(!Array.isArray(H)||!H.length)return null;const ee=(this.#e.config||{}).locale,te=[],J=[];for(const ne of H){const se=this.#_e(ne.col);if(se&&se.running)continue;if(se&&se.value&&z(se.value.compare))return null;const ae=this.#o.handle(ne.col);if(!ae)return null;te.push({col:ne.col,descending:ne.dir==="desc",nullsFirst:!!ne.nullsFirst,locale:ee}),J.push(ae)}return te.length?{entries:te,handles:J,locale:ee}:null}#ve(H){if(this.#B())return!1;const ee=this.#ee();if(!ee)return!1;const te=Number(ee.threshold);return Number.isFinite(te)&&H.length<te?!1:!!this.#pe()}#ke(H,ee){const te=this.#ee(),J=te&&this.#pe();if(!J){this.#te("sort",()=>ee,()=>this.#He(H));return}const ne=new AbortController;this.#b.set("sort",{key:ee,controller:ne});const se=J.entries.length===1?te.sortColumn(J.handles[0],H,{descending:J.entries[0].descending,nullsFirst:J.entries[0].nullsFirst,locale:J.locale,signal:ne.signal,key:"sort"}):te.sortMulti(J.handles,J.entries.map((ae,we)=>({...ae,handle:J.handles[we]})),H,{signal:ne.signal,key:"sort"});if(!T(se)){this.#b.delete("sort"),this.#te("sort",()=>ee,()=>se);return}se.then(ae=>this.#Te(ee,ae),ae=>this.#ye("sort",ee,ae))}#Te(H,ee){const te=this.#b.get("sort");if(!(!te||te.key!==H)){if(this.#$()!==H){this.#b.delete("sort");return}this.#b.delete("sort"),this.#te("sort",()=>H,()=>ee),this.#q=null,this.#H(),this.#gt("model:changed",{reason:V[0]})}}#ye(H,ee,te){const J=this.#b.get(H);if(!(!J||J.key!==ee)&&(this.#b.delete(H),!(te&&te.name==="AbortError")&&H==="sort"&&this.#$()===ee)){const ne=this.#te("filter",()=>this.#de(),()=>this.#je());this.#te("sort",()=>ee,()=>this.#He(ne)),this.#q=null,this.#H(),F("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",te),this.#gt("model:changed",{reason:V[1]})}}#Ae(H,ee){const te=H&&H.leaves?H.leaves.length:this.#m.slots.length;this.#m.matchCount=te,this.#m.grand=ee&&ee.grand||null,this.#m.grandLeaves=H&&H.leaves?H.leaves.length:0,this.#m.groupLeaves=H&&H.leaves?H.leaves:null}#te(H,ee,te){const J=this.#l.get(H),ne=ee();return J.computed&&J.key===ne||(J.result=te(),J.key=ne,J.computed=!0,J.id++,H==="flatten"&&(this.#q=null)),J.result}#me(H){return this.#l.get(H).id}#de(){const H=(this.#e.config||{}).hostFilter,ee=H&&z(H.active)&&H.active()?1:0,te=this.#K("where",null),J=te?te.version:0,ne=this.#Et("filter.sig",`${this.#pt()}`,()=>h({filters:this.#K("filters",null),quick:this.#K("quick",""),quickMode:this.#K("quickMode","contains")}));return`${this.#u}|${ne}|${ee}|${J}`}#$(){const H=this.#B();return`${this.#me("filter")}|${JSON.stringify(this.#K("sort",[]))}`+(H?`|manual:${H.version}`:"")}#B(){const H=this.#K("rowOrder",null);return H&&Array.isArray(H.keys)?H:null}#ue(H,ee){this.#p||this.#ie();const te=this.#p,J=this.#ft(),ne=ee.keys.length,se=new Float64Array(J);for(let ae=0;ae<J;ae++)se[ae]=ne+ae;for(let ae=0;ae<ne;ae++){const we=te.get(ee.keys[ae]);we!==void 0&&(se[we]=ae)}return Uint32Array.from(H).sort((ae,we)=>se[ae]-se[we])}orderedKeys(){this.#p||this.#ie();const H=this.#p,ee=new Map;for(const[ae,we]of H)ee.set(we,ae);const te=Uint32Array.from([...ee.keys()]).sort(),J=this.#B(),ne=J?this.#ue(te,J):this.#He(te),se=new Array(ne.length);for(let ae=0;ae<ne.length;ae++)se[ae]=ee.get(ne[ae]);return se}#ae(){const H=this.#K("pivotBy",[]).length>0?"p":"u";return`${this.#me("sort")}|${JSON.stringify(this.#K("groupBy",[]))}|${H}`}#F(){const H=this.#at()?"f":"a",ee=(this.#e.config||{}).totalOnlyChangedColumns?"n":"w";return`${this.#me("group")}|${JSON.stringify(this.#K("totals",[]))}|${H}${ee}|${this.#c}`}#we(){return`${this.#me("group")}|${JSON.stringify(this.#K("pivotBy",[]))}`}#se(){const ee=this.#Ve()||!this.#re()?this.#me("total"):"x",te=`${this.#pt()}`,J=this.#Et("flatten.keys",te,()=>{const se=this.#K("expanded",null);return se?[...se].sort().join(""):"*"}),ne=this.#Et("flatten.detail",te,()=>{const se=this.#K("detail",null);return se&&z(se.signature)?se.signature():""});return`${ee}|${this.#me("pivot")}|${J}|${ne}`}#Ve(){const H=this.#K("groupBy",[]);return Array.isArray(H)&&H.length>0}stageState(){const H=[];for(const[ee,te]of this.#l){const J=te.result;H.push({stage:ee,materialised:!!te.computed,bytes:J&&typeof J.byteLength=="number"?J.byteLength:null,rows:J&&typeof J.length=="number"?J.length:null,rebuilds:te.id})}return H}facetIndices(H){return this.#je(H||null)}facetRows(H){const ee=this.facetIndices(H),te=[];for(let J=0;J<ee.length;J++){const ne=this.#le(ee[J]);ne&&te.push(ne)}return te}invalidateRows(){this.#h.clear(),this.#x.clear(),this.#q=null}invalidateHandles(){this.#o.invalidate()}rows(){return this.#n}unfilteredIndices(){return this.#Ke()}filteredIndices(){const H=this.#l.get("filter");if(H&&H.computed&&H.key===this.#de())return H.result||this.#Ke();this.#H();const ee=this.#l.get("filter");return(ee&&ee.computed?ee.result:null)||this.#Ke()}unfilteredRows(){const H=this.#Ke(),ee=[];for(let te=0;te<H.length;te++){const J=this.#le(H[te]);J&&ee.push(J)}return ee}#je(H=null){const ee=this.#Ke(),te=this.#K("filters",null),J=H?this.#Ye("pruneColumn")(te,H):te,ne=this.#lt(J),se=String(this.#K("quick","")||"").trim().toLowerCase(),ae=se?X(se,String(this.#K("quickMode","contains")||"contains")):null,we=(this.#e.config||{}).hostFilter,fe=!!(we&&z(we.active)&&we.active()),ge=this.#K("where",null),je=!!(ge&&ge.active);if(!ne&&!se&&!fe&&!je)return ee;let Pe=null;ne&&(Pe=this.#Ye("evaluateFilters")(ne,{handle:ce=>this.#o.handle(ce),count:this.#ft(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:ce=>M(this.#_e(ce))}));const de=new Uint32Array(ee.length);let oe=0;for(let he=0;he<ee.length;he++){const ce=ee[he];if(!(Pe&&!Pe[ce])&&!(ae&&!this.#Pe(ce,ae))){if(fe||je){const me=this.#le(ce);if(fe&&!we.passes(me)||je&&!ge.passes(me.data,me.key))continue}de[oe++]=ce}}if(Pe){const he=(this.#e.compute||{}).releaseMask;z(he)&&he({pool:this.#e.pool},Pe)}return de.subarray(0,oe)}handleFor(H){return this.#o.handle(H)}#He(H){const ee=this.#B();if(ee)return this.#ue(H,ee);const te=this.#K("sort",[]).filter(se=>{const ae=this.#_e(se.col);return!ae||!ae.running?!0:(F(`source.sort.running.${se.col}`,`sort ignores "${se.col}": a running total is a function of the sort order, so it cannot also decide it. Sort by the column it runs over instead.`),!1)});if(!te.length)return H;const J=(this.#e.config||{}).locale;if(te.length===1){const se=te[0],ae=this.#o.handle(se.col);if(!ae)return F(`source.sort.${se.col}`,`sort ignores unknown column "${se.col}".`),H;const we=this.#_e(se.col);return this.#Ye("sortColumn")(ae,H,{descending:se.dir==="desc",nullsFirst:se.nullsFirst,locale:J,compare:O(we)})}const ne=[];for(const se of te){const ae=this.#o.handle(se.col);if(!ae){F(`source.sort.${se.col}`,`sort ignores unknown column "${se.col}".`);continue}ne.push({handle:ae,descending:se.dir==="desc",nullsFirst:se.nullsFirst,locale:J,compare:O(this.#_e(se.col))})}return ne.length?this.#Ye("sortMulti")(ne.map(se=>se.handle),ne,H):H}#k(H){const ee=this.#K("groupBy",[]),te=this.#Ne();if(te&&!ee.length){const he=p(H,te);return this.#R=v(he.roots,te.declaresChildren),{roots:null,leaves:H,nodes:new Map,tree:he}}if(this.#R=null,te&&ee.length&&F("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:H,nodes:new Map};const J=(this.#e.config||{}).timeZone,ne=[],se=[];let ae=!1;for(const he of ee){const ce=this.#o.handle(he);if(!ce){F(`source.group.${he}`,`grouping ignores unknown column "${he}".`);continue}ne.push(ce);const me=this.#_e(he),ye=me&&me.dataType;if(ye&&z(ye.groupProjector)){const xe=me.typeOptions&&me.typeOptions.timeZone||J||void 0,Se=ye.groupProjector(me,xe);se.push(Se||null),Se&&(ae=!0)}else se.push(null)}if(!ne.length)return{roots:null,leaves:H,nodes:new Map};const{keys:we,buckets:fe}=this.#Ye("groupByColumns")(ne,H,{locale:(this.#e.config||{}).locale,project:ae?se:void 0}),ge=this.#K("pivotBy",[]).length>0,je=[],Pe=new Map;for(let he=0;he<fe.length;he++){const ce=we[he];let me=null;const ye=[];for(let xe=0;xe<ce.length;xe++){ye.push(m(ce[xe]));const Se=c(ye),Te=xe===ce.length-1;let Be=Pe.get(Se);if(!Be){const Ee=this.#s.group({path:[...ye],column:ee[xe],value:ce[xe],level:xe,parent:me,expanded:ge&&Te?!1:this.#Qe(Se,{key:Se,column:ee[xe],value:ce[xe],level:xe,path:[...ye]}),hasChildren:!(ge&&Te)});Be={row:Ee,leaves:null},Pe.set(Se,Be),me?me.children.push(Ee):je.push(Ee)}Be.row.leafCount+=fe[he].length,xe===ce.length-1&&(Be.leaves=fe[he]),me=Be.row}}const de=this.#K("sort",[])||[],oe=(he,ce)=>{if(!he||he.length<2){if(he)for(const Se of he)oe(Se.children,ce+1);return}const me=ee[ce],ye=de.find(Se=>Se.col===me),xe=ye&&ye.dir==="desc"?-1:1;he.sort((Se,Te)=>xe*Y(Se.groupValue,Te.groupValue));for(const Se of he)oe(Se.children,ce+1)};return oe(je,0),{roots:je,leaves:H,nodes:Pe,keys:we,buckets:fe}}#Le(H,ee){const te=new Map,J=new Map,ne=se=>{const ae=se.physical>=0?[se.physical]:[];for(const we of se.children)ae.push(...ne(we));if(se.children.length){const we=this.#Ze(ee,Uint32Array.from(ae),null);se.physical>=0?te.set(se.physical,we):J.set(se.key,we)}return ae};for(const se of H.roots)ne(se);return{byPhysical:te,byKey:J}}#We(H){const ee=this.#Ie();if(!ee.length)return this.#E=null,this.#T=null,{grand:null};const te={id:this.#me("group"),columns:ee.map(de=>de.id).join("")},J=this.#E&&this.#E.id===te.id&&this.#E.columns===te.columns,ne=this.#kt()&&J?this.#P:null,se=ne?ee.filter(de=>ne.has(de.id)):ee,ae=J?this.#T:null,we=this.#at()?null:this.#vt(),fe=this.#Oe(ee),ge=de=>{const oe=H.nodes.get(de.key);let he=oe&&oe.leaves?oe.leaves:null;if(de.children&&de.children.length){const ye=de.children.map(ge);let xe=0;for(const Be of ye)xe+=Be.length;const Se=new Uint32Array(xe);let Te=0;for(const Be of ye)Se.set(Be,Te),Te+=Be.length;he=Se}he=he||new Uint32Array(0);const ce=we?we.get(de.key)||A:he,me=this.#Pt(de,ne?se:ee,ce,fe);return de.totals=ne?{...de.totals,...me}:me,he};if(H.roots&&se.length)for(const de of H.roots)ge(de);if(this.#I=H.tree?this.#Le(H.tree,ee):null,this.#E=te,this.#P=this.#kt()?new Set:null,!(this.#e.config||{}).grandTotalRow)return this.#A.length=0,this.#T=null,{grand:null};const Pe=we?this.#ne():H.leaves;return this.#T=this.#Xe(ee,Pe,ne,ae),{grand:this.#T}}#Xe(H,ee,te,J){const ne={},se=this.#me("group");se!==this.#w&&(this.#Ct(),this.#w=se);const ae=this.#A;this.#A=[];for(const we of H){if(!E(we))continue;const fe=this.#o.handle(we.id);if(!fe)continue;const ge=S(we,"grand");if(!g(ge,fe)){if(te&&!te.has(we.id)&&J&&we.id in J){ne[we.id]=J[we.id];continue}ne[we.id]=this.#Ze([we],ee,null,"grand")[we.id];continue}let je=this.#O.get(we.id);if((!je||je.fn!==ge)&&(je=new i(ge),this.#O.set(we.id,je)),je.valid){let Pe=!0;for(const de of ae)if(de.colId===we.id&&!je.update(de.before,de.after)){Pe=!1;break}if(Pe){ne[we.id]=je.value();continue}je.invalidate()}je.seedColumn(fe.values,n(fe),ee),ne[we.id]=je.valid?je.value():this.#Ze([we],ee,null,"grand")[we.id]}return ne}#Oe(H){const ee=this.#me("group");ee!==this.#C&&(this.#v.clear(),this.#C=ee);const te=new Map;for(const ne of H){if(!E(ne))continue;const se=this.#o.handle(ne.id),ae=S(ne,"group");g(ae,se)&&te.set(ne.id,{fn:ae})}if(!te.size)return this.#S.length=0,te;const J=this.#S;this.#S=[];for(const ne of J){const{beforeKeys:se,afterKeys:ae,colDeltas:we}=ne,fe=se.length?new Set(se):null,ge=ae.length?new Set(ae):null;for(const{colId:je,before:Pe,after:de}of we)if(te.has(je)){for(const oe of se)ge&&ge.has(oe)||this.#Se(oe,je,Pe,null);for(const oe of ae)fe&&fe.has(oe)||this.#Se(oe,je,null,de);for(const oe of se)ge&&!ge.has(oe)||this.#Se(oe,je,Pe,de)}}return te}#Se(H,ee,te,J){const ne=this.#v.get(H),se=ne&&ne.get(ee);!se||!se.valid||se.update(te,J)||se.invalidate()}#Pt(H,ee,te,J){if(!J||!J.size)return this.#Ze(ee,te,H);const ne={};let se=null,ae=this.#v.get(H.key);for(const we of ee){const fe=J.get(we.id);if(!fe){(se||(se=[])).push(we);continue}const ge=this.#o.handle(we.id);if(!ge)continue;ae||(ae=new Map,this.#v.set(H.key,ae));let je=ae.get(we.id);if((!je||je.fn!==fe.fn)&&(je=new i(fe.fn),ae.set(we.id,je)),je.valid||je.seedColumn(ge.values,n(ge),te),je.valid){ne[we.id]=je.value();continue}(se||(se=[])).push(we)}return se&&Object.assign(ne,this.#Ze(se,te,H)),ne}#Je(H,ee,te,J){const ne=!this.#at()||this.#Ge(ee);for(const se of H){const ae=se.getValue;if(!z(ae))continue;const we=ae(te),fe=ae(J);Object.is(we,fe)||(this.#P&&this.#P.add(se.id),ne&&this.#O.has(se.id)&&this.#A.push({colId:se.id,before:we,after:fe}))}}#et(){const H=this.#K("groupBy",[]),ee=[];for(const te of H){const J=this.#_e(te);J&&ee.push(J)}return ee}#tt(H,ee){const te=new Array(H.length);for(let J=0;J<H.length;J++){const ne=H[J].getValue;te[J]=m(z(ne)?ne(ee):void 0)}return te}#wt(H,ee,te,J,ne){if(this.#at()&&!this.#Ge(te))return;const se=s(this.#tt(H,J)),ae=s(this.#tt(H,ne)),we=se.length!==ae.length||se.some((ge,je)=>ge!==ae[je]),fe=[];for(const ge of ee){const je=ge.getValue;if(!z(je))continue;const Pe=je(J),de=je(ne);!we&&Object.is(Pe,de)||fe.push({colId:ge.id,before:Pe,after:de})}!fe.length&&!we||this.#S.push({beforeKeys:se,afterKeys:ae,colDeltas:fe})}#Ge(H){const ee=this.#l.get("filter"),te=ee&&ee.computed?ee.result:null;if(!te)return!0;let J=0,ne=te.length-1;for(;J<=ne;){const se=J+ne>>1,ae=te[se];if(ae===H)return!0;ae<H?J=se+1:ne=se-1}return!1}#at(){return(this.#e.config||{}).totalFilteredOnly!==!1}#nt(H){return this.#at()?H:this.#ne().length}#ne(){return(!this.#N||this.#N.version!==this.#u)&&(this.#N={version:this.#u,indices:this.#Ke()}),this.#N.indices}#vt(){const H=this.#K("groupBy",[]),ee=`${this.#u}|${JSON.stringify(H)}`;if(this.#M&&this.#M.key===ee)return this.#M.map;const te=new Map,J=[];for(const ne of H){const se=this.#o.handle(ne);se&&J.push(se)}if(J.length){const ne=this.#ne(),{keys:se,buckets:ae}=this.#Ye("groupByColumns")(J,ne,{locale:(this.#e.config||{}).locale}),we=new Map;for(let fe=0;fe<ae.length;fe++){const ge=se[fe],je=[];for(let Pe=0;Pe<ge.length;Pe++){je.push(m(ge[Pe]));const de=c(je);let oe=we.get(de);oe||(oe=[],we.set(de,oe));for(let he=0;he<ae[fe].length;he++)oe.push(ae[fe][he])}}for(const[fe,ge]of we)te.set(fe,Uint32Array.from(ge))}return this.#M={key:ee,map:te},te}#kt(){return!!(this.#e.config||{}).totalOnlyChangedColumns}#rt(){this.#Ct(),this.#it(),this.#P=null,this.#E=null,this.#T=null}#Ct(){this.#O.clear(),this.#A.length=0,this.#w=-1}#it(){this.#v.clear(),this.#S.length=0,this.#C=-1}#Ot(H){const ee=this.#K("pivotBy",[]);if(!ee.length)return this.#_=null,null;const te=(this.#e.compute||{}).pivot;if(!z(te))return F("source.pivot.kernel","pivot requested but ctx.compute.pivot is not available; showing unpivoted rows."),this.#_=null,null;const J=ee.map(se=>this.#o.handle(se)).filter(Boolean),ne=this.#Ie();return this.#_=te(J,H.leaves,{groups:H.keys&&H.buckets?{keys:H.keys,buckets:H.buckets}:null,totals:ne.map(se=>se.id),handle:se=>this.#o.handle(se),totalOf:se=>S(ne.find(ae=>ae.id===se),"group"),separator:((this.#e.config||{}).pivot||{}).separator,maxColumns:((this.#e.config||{}).pivot||{}).maxColumns})||null,this.#_}#qe(H){const ee=this.#l.get("total").result,te=!!(this.#e.config||{}).groupFooter,J=this.#fe();if(H.tree)return this.#Fe(H,ee,J);if(!H.roots&&!J){if(ee&&ee.grand&&!this.#re()){const ge=this.#s.grandTotal(ee.grand,this.#nt(H.leaves.length));if(this.#Y===H.leaves&&Array.isArray(this.#U))this.#U[this.#U.length-1]=ge;else{const je=Array.from(H.leaves);je.push(ge),this.#U=je,this.#Y=H.leaves}this.#D=[{at:this.#U.length-1}]}else this.#Y=null,this.#U=H.leaves,this.#D=R;return this.#G=R,this.#U}const ne=[],se=[],ae=[],we=ge=>{if(ne.push(ge),!J)return;const je=this.#le(ge);!je||!J.isOpen(je.key)||(je.master=!0,je.expanded=!0,ae.push({at:ne.length}),ne.push(this.#s.detail(je,J.heightOf(je))))};if(!H.roots){for(let ge=0;ge<H.leaves.length;ge++)we(H.leaves[ge]);return ee&&ee.grand&&!this.#re()&&(ae.push({at:ne.length}),ne.push(this.#s.grandTotal(ee.grand,this.#nt(H.leaves.length)))),this.#Y=null,this.#G=R,this.#D=ae.length?ae:R,this.#U=ne,ne}const fe=(ge,je,Pe)=>{if(ge.expanded=ge.hasChildren===!1?!1:this.#Qe(ge.key,{key:ge.key,column:ge.groupColumn,value:ge.groupValue,level:ge.level,path:ge.groupPath}),ge.posinset=je+1,ge.setsize=Pe,se.push({at:ne.length,row:ge}),ae.push({at:ne.length}),ne.push(ge),!!ge.expanded){if(ge.children&&ge.children.length)for(let de=0;de<ge.children.length;de++)fe(ge.children[de],de,ge.children.length);else{const de=H.nodes.get(ge.key),oe=de&&de.leaves?de.leaves:null;if(oe)for(let he=0;he<oe.length;he++)we(oe[he])}te&&ge.totals&&(ae.push({at:ne.length}),ne.push(this.#s.footer(ge)))}};for(let ge=0;ge<H.roots.length;ge++)fe(H.roots[ge],ge,H.roots.length);return ee&&ee.grand&&!this.#re()&&(ae.push({at:ne.length}),ne.push(this.#s.grandTotal(ee.grand,this.#nt(H.leaves.length)))),this.#G=se,this.#D=ae,this.#U=ne,ne}#Ke(){const H=this.#e.store;if(H&&z(H.liveIndices))return H.liveIndices();const ee=new Uint32Array(this.#n.length);let te=0;for(let J=0;J<this.#n.length;J++)this.#n[J]!==void 0&&(ee[te++]=J);return ee.subarray(0,te)}#ft(){const H=this.#e.store;return H&&typeof H.physical=="number"?H.physical:this.#n.length}#j(H){const ee=this.#e.store;return ee&&z(ee.source)?ee.source(H):this.#n[H]}#dt(H,ee=H){const te=this.#U[H];if(typeof te!="number")return te.index=ee,te;const J=this.#le(te);return J.index=ee,J}#le(H){let ee=this.#h.get(H);ee||(ee=this.#s.leaf(this.#j(H),H),this.#h.set(H,ee));const te=this.#R?this.#R.get(H):null;if(te){ee.level=te.level,ee.posinset=te.posinset,ee.setsize=te.setsize,ee.hasChildren=te.hasChildren,ee.expanded=te.hasChildren&&!te.lazy&&this.#Qe(ee.key);const J=this.#I?this.#I.byPhysical.get(H):void 0;J?ee.totals=J: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}#Fe(H,ee,te){const J=[],ne=[],se=we=>{if(we.leafCount!==void 0)return we.leafCount;let fe=we.physical>=0?1:0;for(const ge of we.children)fe+=se(ge);return we.leafCount=fe,fe},ae=we=>{const fe=this.#Qe(we.key);if(we.physical>=0){if(J.push(we.physical),te&&te.isOpen(this.#le(we.physical).key)){const ge=this.#le(we.physical);ne.push({at:J.length}),J.push(this.#s.detail(ge,te.heightOf(ge)))}}else J.push(this.#s.group({path:[we.key],column:null,value:we.value,level:we.level,parent:null,expanded:fe,hasChildren:we.children.length>0,leafCount:se(we),totals:this.#I?this.#I.byKey.get(we.key):void 0}));if(fe)for(const ge of we.children)ae(ge)};for(const we of H.tree.roots)ae(we);return ee&&ee.grand&&!this.#re()&&(ne.push({at:J.length}),J.push(this.#s.grandTotal(ee.grand,this.#nt(H.leaves.length)))),this.#Y=null,this.#G=R,this.#D=ne.length?ne:R,this.#U=J,J}#$e(){return t(()=>this.count(),H=>this.at(H))}#Pe(H,ee){let te=this.#x.get(H);if(te===void 0){const J=this.#j(H),ne=this.#mt(),se=[],ae=this.#e.columnHidden;for(const we of ne){if(we.quickFilter===!1||z(ae)&&ae(we.id))continue;const fe=we.value&&z(we.value.quickFilterText)?we.value.quickFilterText({value:void 0,data:J,row:null,column:we,colId:we.id,grid:null,context:this.#K("context",null)}):null,ge=fe??(z(we.formatValue)?we.formatValue(z(we.getValue)?we.getValue(J):void 0):"");ge!=null&&ge!==""&&se.push(String(ge))}te=se.join(" ").toLowerCase(),this.#x.set(H,te)}return ee(te)}#Ie(){const H=this.#K("totals",[]),ee=H&&H.length?new Set(H):null;return this.#mt().filter(te=>ee?ee.has(te.id):!!(te.total||te.groupTotal||te.grandTotal))}#Ze(H,ee,te,J="group"){const ne={},se=(this.#e.compute||{}).total;for(const ae of H){if(!E(ae))continue;const we=this.#o.handle(ae.id);if(!we)continue;const fe=S(ae,J);if(fe)if(z(fe)){const ge=new Array(ee.length);for(let je=0;je<ee.length;je++)ge[je]=we.get(ee[je]);ne[ae.id]=fe(ge,{row:te,column:ae,grid:this.#e.grid||null,context:this.#K("context",null),valueAt:(je,Pe)=>{const de=this.#o.handle(je);return de&&Pe>=0&&Pe<ee.length?de.get(ee[Pe]):null}})}else z(se)&&(ne[ae.id]=se(we,ee,fe))}return ne}#lt(H){if(!H)return H;const ee=this.#e.config||{},te={tz:ee.timeZone,weekStartsOn:ee.weekStartsOn};return l(H,J=>{const ne=b(J,te),se=this.#_e(ne&&ne.col),ae=se&&se.type==="datetime";if(ne&&ne.type)return ne.type==="datetime"&&!ne.timeZone&&se?{...ne,timeZone:ee.timeZone||void 0}:ne;if(ae)return{...ne,type:"datetime",timeZone:ee.timeZone||void 0};const we=se&&(se.dataType?.base||se.type);return we?{...ne,type:we}:ne})}#Qe(H,ee){const te=this.#K("expanded",null);return te?z(te.has)?te.has(H,ee):Array.prototype.includes.call(te,H):!0}#K(H,ee){if(H==="context"||!z(this.#e.stateVersion))return this.#ht(H,ee);const te=this.#ct(H),J=this.#f.get(H);if(J&&J.version===te)return J.value;const ne=this.#ht(H,ee);return this.#f.set(H,{version:te,value:ne}),ne}#ht(H,ee){const te=this.#e.state;if(te&&z(te[H])){const J=te[H]();return J??ee}return ee}#pt(){const H=this.#e.stateVersion;return z(H)?H():0}#Rt(){const H=this.#e.columnsVersion,ee=this.#e.permissionsVersion;return`${z(H)?H():0}|${z(ee)?ee():0}`}#ct(H){return H==="totals"?this.#Rt():`${this.#pt()}`}#Et(H,ee,te){if(!z(this.#e.stateVersion))return te();const J=this.#d.get(H);if(J&&J.version===ee)return J.key;const ne=te();return this.#d.set(H,{version:ee,key:ne}),ne}#Ye(H){const ee=(this.#e.compute||{})[H];return z(ee)||L(`ctx.compute.${H} is required by the memory source pipeline`),ee}#mt(){const H=this.#e.columns;return H&&z(H.all)?H.all():[]}#_e(H){const ee=this.#e.columns;return ee&&z(ee.get)?ee.get(H):void 0}#gt(H,ee){const te=this.#e.emit;z(te)&&te(H,ee)}}}),He("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 N}}),Object.defineProperty(e,"AbortScope",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createAbortScope",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return L}});class re extends Error{constructor(z,x="superseded"){super(`[lattice] request ${z?`"${z}" `:""}${x}`),this.name="SupersededError",this.superseded=!0,this.key=z}}class N{#e;constructor(z,x,Y,$){this.#e=z,this.key=x,this.controller=Y,this.signal=Y.signal,this.seq=$}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(z){this.signal.aborted||this.controller.abort(new re(this.key,z)),this.#e.settle(this)}}class G{#e=new Map;#t=0;begin(z="",x="superseded"){const Y=this.#e.get(z);Y&&!Y.signal.aborted&&Y.controller.abort(new re(z,x));const $=new N(this,z,new AbortController,++this.#t);return this.#e.set(z,$),$}tokenFor(z){return this.#e.get(z)}pending(z=""){const x=this.#e.get(z);return!!x&&!x.signal.aborted}get size(){return this.#e.size}settle(z){this.#e.get(z.key)===z&&this.#e.delete(z.key)}abort(z="",x="superseded"){const Y=this.#e.get(z);Y&&Y.abort(x)}abortAll(z="superseded"){for(const x of[...this.#e.values()])x.abort(z);this.#e.clear()}}function F(){return new G}function L(Z){if(!Z||typeof Z!="object")return!1;const z=Z;return z.superseded===!0||z.name==="AbortError"||z.name==="SupersededError"}}),He("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 N}}),Object.defineProperty(e,"BlockCache",{enumerable:!0,get:function(){return F}});const re=100,N=32;class G{constructor(Z){this.id=Z,this.rows=null,this.state="pending",this.token=null,this.error=null}}class F{#e=new Map;#t;#n;#r=0;#i=-1;constructor(Z={}){this.#t=Math.max(1,Math.floor(Number(Z.pageSize)||re)),this.#n=Math.max(1,Math.floor(Number(Z.maxCachedPages)||N))}get pageSize(){return this.#t}get maxBlocks(){return this.#n}get size(){return this.#e.size}blockOf(Z){return Math.floor(Z/this.#t)}rangeOf(Z){return{start:Z*this.#t,end:(Z+1)*this.#t}}has(Z){return this.#e.has(Z)}pending(Z){const z=this.#e.get(Z);return!!z&&z.state==="pending"}loaded(Z){const z=this.#e.get(Z);return!!z&&z.state==="loaded"}begin(Z,z){let x=this.#e.get(Z);return x||(x=new G(Z)),x.state="pending",x.token=z,x.error=null,this.#s(Z,x),x}fill(Z,z){const x=this.#e.get(Z)||new G(Z);x.rows=z,x.state="loaded",x.token=null,this.#s(Z,x)}failed(Z,z){const x=this.#e.get(Z)||new G(Z);x.state="error",x.error=z,x.token=null,this.#s(Z,x)}delete(Z){return this.#e.delete(Z)}rowAt(Z){const z=this.blockOf(Z),x=this.#e.get(z);if(!(!x||x.state!=="loaded"||!x.rows))return this.#s(z,x),x.rows[Z-z*this.#t]}rowLoaded(Z){const z=this.blockOf(Z),x=this.#e.get(z);return!!x&&x.state==="loaded"&&!!x.rows&&Z-z*this.#t<x.rows.length}erroredAt(Z){const z=this.#e.get(this.blockOf(Z));return!!z&&z.state==="error"}loadedExtent(){let Z=0;for(const z of this.#e.values()){if(z.state!=="loaded"||!z.rows)continue;const x=z.id*this.#t+z.rows.length;x>Z&&(Z=x)}return Z}fillOf(Z){const z=this.#e.get(Z);return z&&z.state==="loaded"&&z.rows?z.rows.length:null}protect(Z,z){this.#r=this.blockOf(Math.max(0,Z)),this.#i=this.blockOf(Math.max(0,z))}evict(){const Z=[];if(this.#e.size<=this.#n)return Z;for(const[z,x]of this.#e){if(this.#e.size-Z.length<=this.#n)break;z>=this.#r&&z<=this.#i||x.state!=="pending"&&Z.push(z)}for(const z of Z)this.#e.delete(z);return Z}ids(){return[...this.#e.keys()]}clear(){this.#e.clear()}#s(Z,z){this.#e.delete(Z),this.#e.set(Z,z)}}}),He("packages/core/src/source/pagewindow.js",function(e,D){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return re}});function re(N,G,F,L){const Z=Math.floor(Number(N)||0);if(Z<=0)return null;const z=Math.max(0,Math.floor(Number(G)||0)),x=Math.max(0,Math.floor(Number(F)||0));if(L){const Y=Math.max(1,Math.ceil(x/Z)),$=Math.min(z,Y-1),j=$*Z;return{page:$,pageSize:Z,offset:j,length:Math.max(0,Math.min(Z,x-j)),pageCount:Y,total:x}}return{page:z,pageSize:Z,offset:z*Z,length:Z,pageCount:Math.max(z+2,Math.ceil(x/Z)),total:null}}}),He("packages/core/src/source/paged.js",function(e,D){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"PagedSource",{enumerable:!0,get:function(){return h}});const N=D("packages/core/src/internal/lru.js").Lru,F=D("packages/core/src/internal/predicates.js").isFunction,Z=D("packages/core/src/internal/warn.js").warnOnce,x=D("packages/core/src/internal/schedule.js").settleDebounce,Y=D("packages/core/src/source/abort.js"),$=Y.createAbortScope,j=Y.isAbortError,k=D("packages/core/src/source/blockcache.js"),y=k.BlockCache,c=k.DEFAULT_PAGE_SIZE,m=k.DEFAULT_MAX_CACHED_PAGES,t=D("packages/core/src/source/rows.js").createRowFactory,o=D("packages/core/src/source/filterwire.js"),u=o.wireFilters,d=o.querySignature,i=o.warnHostFilterNotApplied,r=D("packages/core/src/source/pagewindow.js").pageWindow,n=120;function f(l,b){return new h(l,b)}class h{mode="paged";#e;#t;#n;#r=$();#i;#s;#o=new Map;#l=null;#a=null;#c=!1;#u=0;#f="";#d={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(b,a){this.#e=b||{mode:"paged"},this.#t=a||{},this.#n=new y({pageSize:this.#e.pageSize||c,maxCachedPages:this.#e.maxCachedPages||m}),this.#i=t(this.#t),this.#s=new N(this.#n.pageSize*4),this.#h=x((p,w)=>this.#w(p,w),n),this.#f=this.#P(),F(this.#e.fetch)||Z("source.paged.fetch",'source.mode "paged" requires a fetch function; the grid will stay empty.'),i(this.#t)}count(){const b=this.#y();return b?b.length:this.#b()}#b(){if(this.#C(),this.#l!==null)return this.#l;const b=Math.max(this.#u,this.#n.loadedExtent());return this.#c?b:b+this.#n.pageSize}matchCount(){return this.#b()}totalCount(){return this.#b()}pageInfo(){const b=this.#y();if(!b){const a=this.#b();return{page:0,pageSize:0,total:this.exact()?a:null,pageCount:1,counting:!1}}return{page:b.page,pageSize:b.pageSize,total:b.total,pageCount:b.pageCount,counting:b.total===null&&this.#r.size>0&&this.#u===0&&this.#n.loadedExtent()===0}}#y(){const b=this.#b(),a=r(this.#T("pageSize",0),this.#T("page",0),b,this.exact());if(!a)return this.#g="",null;const p=`${this.#m}:${a.offset}:${a.length}`;if(p!==this.#g&&!this.#p&&(this.#g=p,a.length>0)){const w=a.offset+a.length-1;this.#d={start:a.offset,end:w},this.#w(a.offset,w)}return a}at(b){const a=this.#y();if(a){if(b<0||b>=a.length)return;const p=this.#O(a.offset+b);return p&&(p.index=b),p}return this.#O(b)}#O(b){if(b<0||b>=this.#b())return;const a=this.#s.get(b);if(a&&(a.data!==null||!this.#n.rowLoaded(b)))return a;const p=this.#n.rowAt(b);if(p===void 0){const v=this.#i.skeleton(b,0,this.#n.erroredAt(b));return this.#s.set(b,v),v}const w=this.#i.leaf(p,b);return w.index=b,this.#s.set(b,w),this.#o.set(w.key,b),w}byKey(b){const a=this.#o.get(b);return a===void 0?void 0:this.#O(a)}loaded(b){const a=this.#y();return a?b>=0&&b<a.length&&this.#n.rowLoaded(a.offset+b):this.#n.rowLoaded(b)}loadedCount(){this.#C();let b=0;for(const a of this.#n.ids()){if(!this.#n.loaded(a))continue;const p=this.#n.fillOf(a);typeof p=="number"&&(b+=p)}return b}residentRows(){this.#C();const b=this.#y(),a=b?b.offset:0,p=b?b.offset+b.length:1/0,w=[],v=this.#n.ids().sort((P,V)=>P-V);for(const P of v){if(!this.#n.loaded(P))continue;const{start:V}=this.#n.rangeOf(P),W=this.#n.fillOf(P)||0;for(let K=V;K<V+W;K++){if(K<a||K>=p)continue;const R=this.#s.peek(K);if(R&&R.data!==null&&R.data!==void 0){w.push(R);continue}const S=this.#n.rowAt(K);if(S===void 0)continue;const E=this.#i.leaf(S,K);E.index=K,this.#s.set(K,E),this.#o.set(E.key,K),w.push(E)}}return w}hint(b,a){if(this.#p)return;const p=this.#C();let w=Math.max(0,Math.floor(b)),v=Math.max(w,Math.floor(a));const P=this.#y();if(P){if(P.length===0)return;w=P.offset,v=P.offset+P.length-1}this.#d={start:w,end:v},this.#n.protect(w,v);for(const V of this.#n.evict())this.#v(V);this.#h(w,v),p&&this.#h.flush()}#w(b,a){if(this.#p)return;this.#n.protect(b,a);const p=this.#n.blockOf(b),w=this.#n.blockOf(a);for(let v=p;v<=w&&!(this.#l!==null&&v*this.#n.pageSize>=this.#l);v++)this.#n.has(v)||this.#A(v)}apply(b){const a={added:[],updated:[],removed:[]};if(!b)return a;if(b.update)for(const p of b.update){const w=this.#i.keyOf(p,-1),v=this.#o.get(w);if(v===void 0)continue;const P=this.#i.leaf(p,v);P.index=v,this.#s.set(v,P),a.updated.push(P)}return(b.add&&b.add.length||b.remove&&b.remove.length)&&this.reload(),a}reload(b){this.#S("reload"),this.#h.cancel(),this.hint(this.#d.start,this.#d.end)}destroy(){this.#p=!0,this.#h.cancel(),this.#r.abortAll("destroyed"),this.#n.clear(),this.#s.clear(),this.#o.clear()}exact(){return this.#l!==null||this.#c}pending(){return this.#r.size}async#A(b){if(!F(this.#e.fetch))return;const a=this.#r.begin(`block:${b}`);this.#n.begin(b,a);const{start:p,end:w}=this.#n.rangeOf(b),v=this.#f;try{const P=await this.#e.fetch({range:{start:p,end:w},sort:this.#T("sort",[]),filters:u(this.#T("filters",null),this.#E()),quick:this.#T("quick","")||void 0,context:this.#T("context",null),signal:a.signal});if(!a.current||v!==this.#f||this.#p)return;a.settle();const V=P&&P.rows||[];this.#n.fill(b,V);for(let K=0;K<V.length;K++)this.#s.delete(p+K);const W=P&&typeof P.total=="number"?P.total:P&&typeof P.count=="number"?P.count:null;W!==null?(this.#l=W,this.#c=!0):V.length<this.#n.pageSize?(this.#c=!0,this.#l=p+V.length):this.#u=Math.max(this.#u,p+V.length),this.#N("model:changed",{reason:"page",block:b,from:p,to:p+V.length}),this.#N("rows:changed",{companion:!0,reason:"page",block:b,from:p,to:p+V.length}),this.#l!==null&&this.#l!==this.#a&&(this.#a=this.#l,this.#N("source:total",{total:this.#l,groupPath:[]}))}catch(P){if(a.settle(),j(P))return;this.#n.failed(b,P);for(let V=p;V<w;V++)this.#s.delete(V);this.#N("model:changed",{reason:"page-error",block:b,range:{start:p,end:w}}),this.#N("source:error",{error:P,block:b,range:{start:p,end:w}})}}#v(b){const{start:a,end:p}=this.#n.rangeOf(b);for(let w=a;w<p;w++){const v=this.#s.peek(w);v&&this.#o.delete(v.key),this.#s.delete(w)}}#C(){const b=this.#P();return b===this.#f?!1:(this.#f=b,this.#S("query"),!0)}#S(b){this.#r.abortAll(b),this.#n.clear(),this.#s.clear(),this.#o.clear(),this.#l=null,this.#a=null,this.#c=!1,this.#u=0,this.#m++,this.#N("model:changed",{reason:b})}#P(){return d({filters:this.#T("filters",null),sort:this.#T("sort",[]),quick:this.#T("quick",""),context:this.#T("context",null)})}#E(){const b=this.#t.config||{};return{tz:b.timeZone,weekStartsOn:b.weekStartsOn}}#T(b,a){const p=this.#t.state;if(p&&F(p[b])){const w=p[b]();return w??a}return a}#N(b,a){const p=this.#t.emit;F(p)&&p(b,a)}}}),He("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 N}}),Object.defineProperty(e,"fillAggregateSql",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"aggregateP",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"routeAggregate",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"resolveAggregatePlan",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"groupKeysPushable",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"pushdownDocRows",{enumerable:!0,get:function(){return $}});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 N(){const j=new Set;for(const[k,y]of Object.entries(re))y.pushable&&j.add(k);return j}function G(j,k,y,c="?"){let m=j.split("%c").join(k);return y!==void 0&&(m=m.split("%w").join(y)),m.split("%p").join(c)}function F(j){const k=j&&(j.p!==void 0?j.p:j.params&&j.params.p);return typeof k=="number"&&k>=0&&k<=1?k:void 0}function L(j){const k=j||{},y=k.default==="engine"||k.default==="engine-if-identical"?k.default:"client",c={};if(k.overrides&&typeof k.overrides=="object")for(const[m,s]of Object.entries(k.overrides))(s==="engine"||s==="client")&&(c[m]=s);return{default:y,overrides:c}}function Z(j,k){const y=re[j];if(!y||!y.pushable)return"client";const c=k.overrides[j];return c==="engine"||c==="client"?c:k.default==="client"?"client":k.default==="engine-if-identical"?y.class==="identical"?"engine":"client":"engine"}function z(j,k){const y=L(k),c=[],m=[];for(const s of j||[]){const t=re[s.fn],o=Z(s.fn,y),u={id:s.id,col:s.col,fn:s.fn,class:t?t.class:"fallback"};if(s.weight!==void 0&&(u.weight=s.weight),s.params!==void 0&&(u.params=s.params),t&&t.parametric){const d=F(s);d!==void 0&&(u.p=d)}if(o==="engine"&&t&&t.parametric&&u.p===void 0){m.push({...u,reason:`"${s.fn}" needs \`p\`, a number from 0 to 1`});continue}o==="engine"?c.push(u):(u.reason=t&&!t.pushable?t.note||"the engine cannot express this stat":"client by config",m.push(u))}return{engine:c,client:m,config:y}}const x=/^[A-Za-z_][A-Za-z0-9_$]*$/;function Y(j,k=[]){return(j||[]).every(c=>{if(typeof c=="string")return x.test(c);if(!c||typeof c!="object")return!1;const m=c;return Array.isArray(k)&&k.includes(m.bucket)&&typeof m.col=="string"&&x.test(m.col)&&typeof m.size=="number"&&Number.isFinite(m.size)&&m.size>0})}function $(){return Object.entries(re).map(([j,k])=>({stat:j,class:k.class,sql:k.sql?G(k.sql,"col",k.twoColumn?"weight":void 0):"",note:k.note||(k.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),He("packages/core/src/source/pushdown.js",function(e,D){"use strict";Object.defineProperty(e,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"NO_CAPABILITIES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"capabilitiesOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"splitFilters",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"applyResidual",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createPushdownSource",{enumerable:!0,get:function(){return te}});const N=D("packages/core/src/internal/compare.js").defaultCompare,F=D("packages/core/src/internal/predicates.js").isFunction,Z=D("packages/core/src/internal/merge.js").toArray,x=D("packages/core/src/internal/warn.js").warnOnce,Y=D("packages/core/src/source/filterwire.js"),$=Y.isGroup,j=Y.warnWherePageRelative,k=Y.warnWhereOverThreshold,y=Y.wireFilters,c=D("packages/core/src/source/aggregates.js"),m=c.resolveAggregatePlan,s=c.groupKeysPushable,t=c.STAT_PUSHDOWN,o=c.aggregateP,u=c.fillAggregateSql,i=D("packages/core/src/source/abort.js").SupersededError,g=1e3;function r(J){const ne=J&&J.signal;if(!ne||!ne.aborted)return;const se=ne.reason;throw se instanceof Error?se:new i("","superseded before it was sent")}const n=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function f(J){if(!J||typeof J!="object")return!1;const ne=J.returning==="row"||J.returning==="key"?J.returning:"none";return{append:J.append===!0,update:J.update===!0,delete:J.delete===!0,returning:ne}}function h(J,ne){if(!J||typeof ne!="string")return;if(!ne.includes("."))return J[ne];let se=J;for(const ae of ne.split(".")){if(se===null||typeof se!="object")return;se=se[ae]}return se}function l(J){if(J===!0)return!0;if(!J||typeof J!="object")return!1;const ne=J;return ne.enabled===!1?!1:ne.enabled===!0||F(ne.commit)}function b(J){const ne={...n,...J||{}};return ne.operators=new Set(ne.operators||[]),ne.mutate=f(ne.mutate),ne}function a(J,ne){return!J||!J.op||!ne.operators.size?!1:ne.operators.has(J.op)}function p(J,ne){if(!J)return{pushed:null,residual:null};if(!ne.filter)return{pushed:null,residual:J};if(ne.filter==="term"){if($(J)){const fe=J.conditions||[];if(String(J.op)!=="and")return{pushed:null,residual:J};const ge=fe.findIndex(Pe=>!$(Pe)&&a(Pe,ne));if(ge<0)return{pushed:null,residual:J};const je=fe.filter((Pe,de)=>de!==ge);return{pushed:fe[ge],residual:je.length?{op:"and",conditions:je}:null}}return a(J,ne)?{pushed:J,residual:null}:{pushed:null,residual:J}}if(!$(J))return a(J,ne)?{pushed:J,residual:null}:{pushed:null,residual:J};if(String(J.op)!=="and")return(J.conditions||[]).every(ge=>$(ge)?p(ge,ne).residual===null:a(ge,ne))?{pushed:J,residual:null}:{pushed:null,residual:J};const se=[],ae=[];for(const fe of J.conditions||[]){if($(fe)){if(ne.filter==="flat"){ae.push(fe);continue}const ge=p(fe,ne);ge.pushed&&se.push(ge.pushed),ge.residual&&ae.push(ge.residual);continue}(a(fe,ne)?se:ae).push(fe)}const we=fe=>fe.length===0?null:fe.length===1?fe[0]:{op:"and",conditions:fe};return{pushed:we(se),residual:we(ae)}}const w="__lattice_leaves";function v(J){return J.aggregates?J.aggregates instanceof Set?J.aggregates:new Set(Z(J.aggregates)):new Set}function P(J){const ne=v(J);return ne.size?ne.has("count")?J.filter!=="tree"||!J.operators||!J.operators.has("eq")?"the adapter does not declare the `group` capability, and cannot narrow a group's rows by its key (that needs a `tree` filter with the `eq` operator)":"":"the adapter does not declare the `group` capability, and its declared aggregates have no `count` to give each group its row count":"the adapter does not declare the `group` capability"}function V(J,ne,se,ae,we,fe,ge){const je=Array.isArray(J.groupBy)?J.groupBy:[],Pe=Array.isArray(J.groupPath)?J.groupPath:[],de=Array.isArray(J.groupValues)?J.groupValues:null;if(!ne.group){const oe=P(ne);if(oe)return oe}return s(je)?se.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":ae?we?fe&&!fe.conditioned?"a host `where` predicate can only run in the browser, over rows the engine grouped":ge?"fullDataset holds the whole matching set, so the grid groups it itself":!de||de.length!==Pe.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 W="pushdown:pivot-unsupported",K="pushdown:group-unsupported",R=Symbol("lattice.remote.ungroupedLevel");function S(J,ne,se,ae,we,fe){const ge=Array.isArray(J.pivotBy)?J.pivotBy:[],je=Array.isArray(J.groupBy)?J.groupBy:[],Pe=Array.isArray(J.groupPath)?J.groupPath:[],de=Array.isArray(J.groupValues)?J.groupValues:null;return ne.pivot?s(ge)?je.length&&!s(je)?"a grouping key is not a plain column the engine can name in a GROUP BY":se.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":ae?we?fe&&!fe.conditioned?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!de||de.length!==Pe.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 E(J,ne,se=!1){const ae=p(J.filters||null,ne),we=[];ae.residual&&we.push("filter");const fe=J.sort||[],ge=fe.length===0||ne.sort==="multi"&&fe.length>=1||ne.sort==="single"&&fe.length===1;!ge&&fe.length&&we.push("sort");const je=J.quick?String(J.quick):"",Pe=!je||!!ne.quick;Pe||we.push("quick");const de=J.where&&J.where.active?J.where:null;de&&we.push("where");const oe={filters:ae.residual,sort:ge?null:fe,quick:Pe?"":je,where:de},he=!!se,ce=Array.isArray(J.groupBy)&&J.groupBy.length>0,me=ce?V(J,ne,ae,ge,Pe,de,he):"",ye=J.pivotMode!==!1&&Array.isArray(J.pivotBy)&&J.pivotBy.length>0,xe=ye?S(J,ne,ae,ge,Pe,de):"",Se=ye&&xe==="";ye&&!Se&&we.push("pivot");const Te=ye?Se&&ce:ce&&me==="";ce&&!ye&&!Te&&we.push("group");const Be=(Te||Se)&&Array.isArray(J.groupValues)?J.groupValues.length:0;de&&de.conditioned&&(Te||Se)&&(oe.where=null,we.splice(we.indexOf("where"),1));const Ee=Te||ye?!1:he||!!(oe.filters||oe.sort||oe.quick||oe.where)||!ne.range;return{pushed:{...J,filters:ae.pushed,sort:ge?fe:[],quick:Pe?je:"",range:Ee?null:J.range},residual:oe,needsAll:Ee,unpushed:we,full:he,grouped:Te,groupLevel:Be,groupReason:ye?"":me,pivoted:Se,pivotReason:xe}}function O(J){const ne=Array.isArray(J.totals)?J.totals:[],se=J.totalFns&&typeof J.totalFns=="object"?J.totalFns:{},ae=[],we=[];for(const fe of ne){const ge=String(fe),je=se[ge],Pe=typeof je=="string"?je:je&&typeof je.fn=="string"?je.fn:null,de=je&&typeof je=="object"?o(je):void 0,oe=Pe?t[Pe]:null;oe&&oe.parametric&&de===void 0?we.push({id:ge,fn:Pe,class:oe.class,reason:`"${Pe}" needs \`p\`, a number from 0 to 1`}):Pe?!oe||!oe.pushable||!oe.sql?we.push({id:ge,fn:Pe,class:oe?oe.class:"fallback",reason:oe&&oe.note?oe.note:`the pushdown map cannot express "${Pe}"`}):oe.twoColumn?we.push({id:ge,fn:Pe,class:oe.class,reason:`"${Pe}" reduces two columns, and a grouped request carries no weight column`}):ae.push({id:ge,col:ge,fn:Pe,class:oe.class,...de!==void 0?{p:de}:{}}):we.push({id:ge,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:ae,client:we}}function M(J){return{...J,engine:J.engine.map(ne=>{const se=t[ne.fn];if(!se||!se.sql)return ne;const ae=we=>`"${we}"`;return{...ne,sql:u(se.sql,ae(ne.col),ne.weight!==void 0?ae(ne.weight):void 0)}})}}const T=Object.freeze({items:J=>J==null?[]:Array.isArray(J)?J:[J]});function A(J,ne,se){if(!ne)return J;let ae=J;if(ne.filters&&F(se.evaluateFilters)){const we=ae,fe={count:ae.length,handle:Pe=>({id:Pe,get:de=>h(we[de],Pe)}),itemwise:Pe=>we.some(de=>Array.isArray(h(de,Pe)))?T:null},ge=se.evaluateFilters(ne.filters,fe),je=[];for(let Pe=0;Pe<ae.length;Pe++)ge[Pe]&&je.push(ae[Pe]);ae=je}if(ne.where&&ne.where.active&&(ne.whole||j(ne.where.names,"pushdown"),ae=ae.filter(we=>ne.where.passes(we))),ne.quick){const we=ne.quick.toLowerCase();ae=ae.filter(fe=>{if(!fe||typeof fe!="object")return!1;for(const ge of Object.values(fe))if(ge!=null&&String(ge).toLowerCase().includes(we))return!0;return!1})}if(ne.sort&&ne.sort.length&&F(se.sortMulti)){const we=[...new Set(ne.sort.map(Pe=>Pe.col))],fe=ae,ge=we.map(Pe=>({id:Pe,get:de=>h(fe[de],Pe)})),je=se.sortMulti(ge,ne.sort.map(Pe=>({col:Pe.col,dir:Pe.dir})),Uint32Array.from({length:ae.length},(Pe,de)=>de),{});ae=Array.from(je,Pe=>fe[Pe])}return ae}function I(J){return JSON.stringify({filters:J.filters||null,sort:J.sort||[],quick:J.quick||"",groupBy:J.groupBy||[],groupPath:J.groupPath||[],context:J.context??null})}function U(J){if(!J||typeof J!="object")return 16;let ne="";try{ne=JSON.stringify(J)}catch{return 200}return ne.length*2+64}function X(J){const ne=J||{};return{enabled:!!ne.enabled,maxRows:Number.isFinite(ne.maxRows)?ne.maxRows:1e6,maxBytesEstimate:Number.isFinite(ne.maxBytesEstimate)?ne.maxBytesEstimate:512*1024*1024}}const q=5e4;function _(J){return Number.isFinite(J)&&J>=0?J:q}function H(J){return!!J&&F(J.then)}async function ee(J){if(!J||J.total!==void 0||!H(J.pendingTotal))return J;const ne=await J.pendingTotal,{pendingTotal:se,...ae}=J;return typeof ne=="number"?{...ae,total:ne}:ae}function te(J={}){const ne=J.adapter;if(!ne||!F(ne.execute))return x("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...J,mode:"remote",fetch:async()=>({rows:[],total:0})};const se=b(ne.capabilities),ae=ne.capabilities&&Object.getOwnPropertyDescriptor(ne.capabilities,"operators");ae&&F(ae.get)&&Object.defineProperty(se,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(ne.capabilities.operators||[]),set:()=>{}});const we=ne.name||"adapter";let fe=null;const ge=()=>F(ne.ready)?(fe||(fe=Promise.resolve(ne.ready()).then(()=>{Object.assign(se,b(ne.capabilities))},Ce=>{throw fe=null,Ce})),fe):null,je=X(J.fullDataset),Pe=!!J.allowPartialResults,de=_(J.whereRowLimit);let oe=null;const he=J.aggregates;let ce=null,me=null,ye=null,xe=null,Se=null,Te=null,Be=0,Ee=null;const Ge=()=>!je.enabled||!ce?null:(Ee!==ce.key&&(Be++,Ee=ce.key),{rows:ce.rows,version:Be}),Ne=async Ce=>{const Ve=Ce.where&&Ce.where.active?Ce.where:null;if(!Ve)return{request:Ce,probe:null};if(Ve.conditioned){const kt=E(Ce,se,je.enabled);if(kt.grouped||kt.pivoted)return{request:Ce,probe:null}}const{where:_e,...Ke}=Ce,qe=E(Ke,se,je.enabled);if(qe.needsAll)return{request:Ce,probe:null};const st=I(qe.pushed);let ut=null;return(!oe||oe.key!==st)&&(se.total?(r(Ce),ut=await ee(await ne.execute(qe.pushed,Ce)),oe={key:st,size:ut&&typeof ut.total=="number"?ut.total:null}):oe={key:st,size:null}),oe.size!==null&&oe.size<de?{request:Ce,probe:null}:(k(Ve.names,we,oe.size,de),{request:Ke,probe:ut})},ke=async(Ce,Ve)=>{Te=null;const _e=O(Ce.pushed);ye={engine:_e.engine,client:_e.client,groupBy:Ce.pushed.groupBy},_e.client.length&&x(`source.pushdown.group.totals.${we}.${_e.client.map(st=>st.id).join(".")}`,`the ${we} adapter cannot compute the group subtotal for ${_e.client.map(st=>`"${st.id}" (${st.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 Ke=await ne.executeGroupLevel(Ce.pushed,_e.engine,Ve)||{};let qe=Ke.rows||[];return!se.range&&Ve.range&&(qe=qe.slice(Ve.range.start,Ve.range.end)),ze(Ke),Ke.total===void 0?{rows:qe}:{rows:qe,total:Ke.total}},Oe=new Map,Re=64,Le=async(Ce,Ve)=>{Te=null;const _e=Ce.pushed,Ke=_e.groupBy,qe=Array.isArray(_e.groupValues)?_e.groupValues:[],st=qe.length,ut=[..._e.filters?[_e.filters]:[],...Ke.slice(0,st).map((rt,dt)=>({col:rt,op:"eq",value:qe[dt]===void 0?null:qe[dt],caseSensitive:!0}))],kt=ut.length===0?null:ut.length===1?ut[0]:{op:"and",conditions:ut},Pt=Ve.range?Ve.range.start:0;if(st>=Ke.length){const rt={..._e,filters:kt,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},dt=await ee(await ne.execute(rt,Ve))||{};let xt=dt.rows||[];return!se.range&&Ve.range&&(xt=xt.slice(Ve.range.start,Ve.range.end)),typeof dt.total=="number"?{rows:xt,total:dt.total}:{rows:xt}}const Ot=Ke[st],Lt=O(_e),Bt=v(se),Ct=Lt.engine.filter(rt=>Bt.has(rt.fn)),Ut=[...Lt.engine.filter(rt=>!Bt.has(rt.fn)).map(rt=>({id:rt.id,fn:rt.fn,class:rt.class,reason:`the ${we} adapter does not compute "${rt.fn}"`})),...Lt.client];ye={engine:Ct,client:Ut,groupBy:Ke},Ut.length&&x(`source.pushdown.group.totals.${we}.${Ut.map(rt=>rt.id).join(".")}`,`the ${we} adapter cannot compute the group subtotal for ${Ut.map(rt=>`"${rt.id}" (${rt.reason})`).join(", ")}, so those group rows carry no value for that column. A figure computed over anything other than the group would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const rn=[...Ct.map(rt=>({id:rt.id,col:rt.col,fn:rt.fn,...rt.p!==void 0?{p:rt.p}:{}})),{id:w,col:Ot,fn:"count"}],Wt={..._e,filters:kt,range:null},Qt=JSON.stringify([I(Wt),qe,Ot,rn]);let Ze=Pt>0?Oe.get(Qt):void 0;if(!Ze){for(Ze=Promise.resolve(ne.executeGroupedAggregates(Wt,[Ot],rn)),Oe.delete(Qt),Oe.set(Qt,Ze);Oe.size>Re;)Oe.delete(Oe.keys().next().value);Ze.catch(()=>{Oe.get(Qt)===Ze&&Oe.delete(Qt)})}const ct=await Ze||[];r(Ve);const St=rt=>{const dt={};for(const xt of Ct)dt[xt.id]=rt?rt[xt.id]:void 0;return dt},bt=(_e.sort||[]).find(rt=>rt&&rt.col===Ot),yt=bt&&bt.dir==="desc"?-1:1,We=ct.filter(rt=>rt&&rt.level===1).map(rt=>({[Ot]:rt.keys[0]===void 0?null:rt.keys[0],leafCount:Number(rt.values&&rt.values[w])||0,totals:St(rt.values)})).sort((rt,dt)=>yt*N(rt[Ot],dt[Ot]));if(st===0){const rt=ct.find(xt=>xt&&xt.level===0),dt=rt?Number(rt.values&&rt.values[w]):NaN;ze({matchCount:Number.isFinite(dt)?dt:We.reduce((xt,Ft)=>xt+Ft.leafCount,0),...rt?{grand:St(rt.values)}:{}})}const ft=Ve.range?Ve.range.end:We.length;return{rows:We.slice(Pt,ft),total:We.length}},ze=Ce=>{typeof Ce.matchCount=="number"&&(xe=Ce.matchCount,Se=Ce.grand?{totals:Ce.grand,leafCount:Ce.matchCount}:null)},Ye=async(Ce,Ve)=>{Te=null;const _e=O(Ce.pushed);ye={engine:_e.engine,client:_e.client,groupBy:Ce.pushed.groupBy,pivotBy:Ce.pushed.pivotBy},_e.client.length&&x(`source.pushdown.pivot.totals.${we}.${_e.client.map(kt=>kt.id).join(".")}`,`the ${we} adapter cannot compute the pivot cells for ${_e.client.map(kt=>`"${kt.id}" (${kt.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 Ke=await ne.executePivotLevel(Ce.pushed,_e.engine,Ve)||{};let qe=Ke.rows||[];!se.range&&Ve.range&&(qe=qe.slice(Ve.range.start,Ve.range.end)),ze(Ke);const st=Ke.pivot&&typeof Ke.pivot=="object"?Ke.pivot:{},ut={cells:Array.isArray(st.cells)?st.cells:[],...Array.isArray(st.axis)?{axis:st.axis}:{}};return Ke.total===void 0?{rows:qe,pivot:ut}:{rows:qe,total:Ke.total,pivot:ut}},et=Ce=>{x(`source.pushdown.pivot.${we}.${Ce}`,`pushdown:pivot-unsupported: the ${we} adapter cannot pivot this query because ${Ce}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const Ve=new Error(`[lattice] ${W}: the ${we} adapter cannot pivot this query because ${Ce}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw Ve.code=W,Ve.reason=Ce,Ve},tt=(Ce,Ve)=>{const _e={key:Ve,state:"pending",value:null};return Te=_e,Ce.then(Ke=>(Te===_e&&(Te={key:Ve,state:"settled",value:typeof Ke=="number"?Ke:null}),Ke),Ke=>{throw Te===_e&&(Te={key:Ve,state:"failed",value:null}),Ke})};let pt=0,Tt=[];const Rt=()=>pt===0?null:new Promise(Ce=>{const Ve=setTimeout(Ce,g);Tt.push(()=>{clearTimeout(Ve),Ce()})});let ot;const lt=async Ce=>{const Ve=ge();Ve&&await Ve;const Ke=Ce&&Ce.pivotMode!==!1&&Array.isArray(Ce.pivotBy)&&Ce.pivotBy.length>0?{request:Ce,probe:null}:await Ne(Ce);r(Ce);let qe=E(Ke.request,se,je.enabled);if(se.group&&qe.grouped&&!qe.pivoted&&!F(ne.executeGroupLevel)&&(x(`source.pushdown.group.method.${we}`,`the ${we} 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.`),qe=E(Ke.request,{...se,group:!1,aggregates:null},je.enabled)),qe.pivoted&&!F(ne.executePivotLevel)&&(qe=E(Ke.request,{...se,pivot:!1},je.enabled),qe.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),qe.grouped&&!qe.pivoted&&!se.group&&!F(ne.executeGroupedAggregates)&&(x(`source.pushdown.group.aggregates.method.${we}`,`the ${we} 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\`.`),qe=E(Ke.request,{...se,aggregates:null},je.enabled)),me=qe,qe.pivoted)return Ye(qe,Ce);if(qe.pivotReason&&et(qe.pivotReason),qe.grouped)return se.group?ke(qe,Ce):Le(qe,Ce);const ut=!!qe.groupReason&&!qe.full;ut?x(`source.pushdown.group-unsupported.${we}.${qe.groupReason}`,`pushdown:group-unsupported: the ${we} adapter was not asked to group this query because ${qe.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.`):qe.groupReason&&x(`source.pushdown.group.${we}.${qe.groupReason}`,`the ${we} adapter was not asked to group this query because ${qe.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 kt=Wt=>ut?{...Wt,[R]:!0}:Wt;if(!qe.needsAll){const Wt=Ke.probe||await ne.execute(qe.pushed,Ce),Qt=Wt.rows||[];return H(Wt.pendingTotal)&&Wt.total===void 0?kt({rows:Qt,pendingTotal:tt(Wt.pendingTotal,I(qe.pushed))}):(Te=null,!se.total&&Wt.total===void 0?kt({rows:Qt}):kt({rows:Qt,total:Wt.total??Qt.length}))}const Pt=qe.unpushed.filter(Wt=>!(Wt==="where"&&qe.residual.where&&qe.residual.where.anyConditioned));Pt.length&&x(`source.pushdown.residual.${we}.${Pt.join(".")}`,`the ${we} adapter cannot push ${Pt.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 Ot=I(qe.pushed);if(!ce||ce.key!==Ot){const Wt=await ee(await ne.execute(qe.pushed,Ce));Te=null;const Qt=Wt.rows||[];if(qe.full){const Ze=typeof Wt.total=="number"?Math.max(Wt.total,Qt.length):Qt.length;if(Ze>je.maxRows)throw new Error(`[lattice] fullDataset refused: the ${we} adapter's matching set is ${Ze.toLocaleString()} rows, past the configured maxRows of ${je.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=Qt.length*U(Qt[0]);if(ct>je.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${we} adapter's matching set is an estimated ${Math.round(ct/(1024*1024)).toLocaleString()} MB across ${Qt.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(je.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 Wt.total=="number"&&Qt.length<Wt.total){const Ze=!!(qe.residual.filters||qe.residual.quick||qe.residual.sort&&qe.residual.sort.length);if(Ze&&!Pe)throw new Error(`[lattice] the ${we} adapter returned ${Qt.length} of ${Wt.total} matching rows when asked for the whole result, and the query has residual ${qe.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?x(`source.pushdown.partial.residual.${we}`,`the ${we} adapter returned ${Qt.length} of ${Wt.total} matching rows when asked for the whole result, and residual work will run over that fraction. allowPartialResults is set, so the result is used as-is — it may be wrong. The adapter must follow the engine's own paging to be correct.`):x(`source.pushdown.partial.${we}`,`the ${we} adapter returned ${Qt.length} of ${Wt.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}ce={key:Ot,rows:Qt,total:typeof Wt.total=="number"?Wt.total:null}}let Lt=qe;if(qe.residual.where){const Wt=ce.total??ce.rows.length;if(Wt>=de){k(qe.residual.where.names,we,Wt,de);const{where:Qt,...Ze}=Ke.request;Lt=E(Ze,se,je.enabled),me=Lt}}const Bt=ce.total!==null&&ce.rows.length>=ce.total,Ct=A(ce.rows,{...Lt.residual,whole:Bt},J.compute||{}),Ut=Ce.range?Ce.range.start:0,rn=Ce.range?Ce.range.end:Ct.length;return kt({rows:Ct.slice(Ut,rn),total:Ct.length})},ht=async(Ce,Ve,_e)=>{const qe=_e&&_e.waitForPage&&ot&&F(ot.pageForegroundIdle)?ot.pageForegroundIdle():Rt();qe&&await qe;const st=ge();st&&await st;const ut=E(Ce,se,je.enabled);me=ut;const kt=m(Ve,he),Pt=Array.isArray(Ce.groupBy)?Ce.groupBy:[],Ot=Pt.length>0,Lt=!ut.residual.filters&&!ut.residual.quick,Bt=!Ot||s(Pt,se.buckets);let Ct=kt.engine,Ut=kt.client;if(se.aggregates&&Ct.length){const ct=se.aggregates instanceof Set?se.aggregates:new Set(Z(se.aggregates)),St=Ct.filter(bt=>!ct.has(bt.fn));St.length&&(Ct=Ct.filter(bt=>ct.has(bt.fn)),Ut=[...St.map(bt=>({...bt,reason:`the ${we} adapter does not compute "${bt.fn}"`})),...Ut])}const rn=ct=>{Ut=[...Ct.map(St=>({...St,reason:ct})),...Ut],Ct=[]};let Wt="";if(Ct.length&&!Lt){const ct=ut.residual.quick&&!ut.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)";rn(ct),Ot&&(Wt=ct)}else if(Ct.length&&!Bt){const ct="a grouping key the engine cannot form forces all-client (no mixed provenance)";rn(ct),Wt=ct}let Qt={},Ze;if(Ct.length&&(F(Ot?ne.executeGroupedAggregates:ne.executeAggregates)?Ot?Ze=await ne.executeGroupedAggregates(ut.pushed,Pt,Ct)||[]:Qt=await ne.executeAggregates(ut.pushed,Ct)||{}:(x(`source.pushdown.aggregates.${we}${Ot?".grouped":""}`,`the ${we} adapter cannot compute ${Ot?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),rn(`adapter cannot compute ${Ot?"grouped ":""}aggregates`),Ot&&(Wt=`the ${we} adapter cannot compute grouped aggregates`))),Ot){const ct=Ze!==void 0;ct!==ut.grouped&&(me={...ut,grouped:ct,groupReason:ct?"":Wt||ut.groupReason,unpushed:ct?ut.unpushed.filter(St=>St!=="group"):ut.unpushed.includes("group")?ut.unpushed:[...ut.unpushed,"group"]})}return ye={engine:Ct,client:Ut,...Ot?{groupBy:Pt}:{}},{values:Qt,engine:Ct,client:Ut,...Ze!==void 0?{groups:Ze}:{}}},Nt=async Ce=>{pt++;try{return await lt(Ce)}finally{if(pt--,pt===0&&Tt.length){const Ve=Tt;Tt=[];for(const _e of Ve)_e()}}},mt=l(J.edit),be=J.edit&&typeof J.edit=="object"&&F(J.edit.commit);let Me=J.edit;if(mt&&!be)if(se.mutate&&se.mutate.update){const Ce=Ve=>{if(!se.mutate||!se.mutate.update)throw new Error(`[lattice] the ${we} 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 _e={kind:"update",key:String(Ve.key),patch:{[Ve.colId]:Ve.value}};return ne.mutate(_e,Ve.request||{})};Me={...J.edit===!0?{}:J.edit,commit:Ce}}else x(`source.pushdown.readonly.${we}`,`edit is enabled but the ${we} adapter declares mutate: ${se.mutate?"without update":"false"} (read-only by declaration), so no commit is synthesised and the grid stays read-only. Declare \`mutate: { update: true }\` on the adapter to allow cell edits.`);const pe=mt&&se.mutate&&(se.mutate.append||se.mutate.delete)?{append:se.mutate.append===!0,remove:se.mutate.delete===!0,returning:se.mutate.returning,mutate:(Ce,Ve)=>ne.mutate(Ce,Ve||{})}:null,Ae=async Ce=>{const Ve=ge();Ve&&await Ve;const{range:_e,signal:Ke,export:qe,...st}=Ce||{},ut={...st,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:E(ut,se,je.enabled),signal:Ke}};async function*ve(Ce,Ve={}){const{plan:_e,signal:Ke}=await Ae(Ce),qe=Math.max(1,Math.floor(Number(Ve.pageSize))||5e3),st={signal:Ke,stream:!0},ut=Ce&&Ce.range&&Number.isFinite(Number(Ce.range.start))&&Number.isFinite(Number(Ce.range.end))?{start:Math.max(0,Number(Ce.range.start)),end:Math.max(0,Number(Ce.range.end))}:null;if(!_e.needsAll){const Ot=ut?ut.start:0,Lt=ut?ut.end:1/0;for(let Bt=Ot;Bt<Lt;Bt+=qe){r(st);const Ct=Math.min(Bt+qe,Lt),Ut=await ne.execute({..._e.pushed,range:{start:Bt,end:Ct}},st);Ut&&H(Ut.pendingTotal)&&Ut.pendingTotal.then(null,()=>{});const rn=Ut&&Ut.rows||[];if(rn.length&&(yield rn),rn.length<Ct-Bt)return}return}r(st);const kt=await ee(await ne.execute({..._e.pushed,range:void 0},st));let Pt=A(kt&&kt.rows||[],{..._e.residual,whole:!0},J.compute||{});ut&&(Pt=Pt.slice(ut.start,ut.end));for(let Ot=0;Ot<Pt.length;Ot+=qe)yield Pt.slice(Ot,Ot+qe)}const Ie=async Ce=>{const{plan:Ve,signal:_e}=await Ae(Ce);if(!Ve.needsAll&&se.total){r({signal:_e});const qe=await ee(await ne.execute({...Ve.pushed,range:{start:0,end:0}},{signal:_e}));if(qe&&typeof qe.total=="number")return qe.total}let Ke=0;for await(const qe of ve({...Ce,range:void 0}))Ke+=qe.length;return Ke},De=async Ce=>{await ge();const Ve=y(Ce.filters||null,{tz:J.timeZone,weekStartsOn:J.weekStartsOn}),_e=Ce.quick?String(Ce.quick):"";return p(Ve,se).residual||_e&&!se.quick?null:ne.facets({...Ce,filters:Ve,quick:_e})};return ot={...J,edit:Me,rowMutate:pe,mode:"remote",fetch:Nt,foregroundIdle:Rt,facetProvider:F(ne.facets)?De:void 0,aggregate:ht,countMatching:Ie,streamMatching:ve,capabilitiesOf:b,planQuery:E,wireFilters:y,resolveAggregatePlan:Ce=>m(Ce,he),STAT_PUSHDOWN:t,lastPlan:()=>me?{...me,...ye?{aggregates:M(ye)}:{},...Te?{total:{deferred:!0,state:Te.state,value:Te.value}}:{}}:null,fullFrame:Ge,counts:()=>({match:xe,total:xe,pending:!!Te&&Te.state==="pending"}),grandTotals:()=>Se},ot}}),He("packages/core/src/source/remote.js",function(e,D){"use strict";Object.defineProperty(e,"PROTOCOL",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return M}});const N=D("packages/core/src/internal/lru.js").Lru,F=D("packages/core/src/internal/predicates.js").isFunction,Z=D("packages/core/src/internal/warn.js").warnOnce,x=D("packages/core/src/internal/schedule.js").settleDebounce,Y=D("packages/core/src/source/abort.js"),$=Y.createAbortScope,j=Y.isAbortError,k=D("packages/core/src/source/blockcache.js"),y=k.BlockCache,c=k.DEFAULT_PAGE_SIZE,m=k.DEFAULT_MAX_CACHED_PAGES,s=D("packages/core/src/source/rows.js"),t=s.createRowFactory,o=s.groupKey,u=D("packages/core/src/source/filterwire.js"),d=u.wireFilters,i=u.querySignature,g=u.warnHostFilterNotApplied,n=D("packages/core/src/source/pagewindow.js").pageWindow,h=D("packages/core/src/source/memory.js").MemorySource,b=D("packages/core/src/compute/handle.js").valueComparator,a=D("packages/core/src/compute/pivot.js"),p=a.pivotKey,w=a.joinPath,v=a.DEFAULT_PATH_SEPARATOR,V=D("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,W=1,K=120,R=1e3;function S(T,A,I){for(let U=0;U<Math.max(T.length,A.length);U++){const X=T[U],q=A[U],_=X==null,H=q==null;if(_||H){if(_&&H)continue;return _?1:-1}const ee=I(X,q);if(ee!==0)return ee}return 0}function E(T,A){return new M(T,A)}class O{constructor(A,I,U,X){this.path=A,this.keyPath=X||A,this.values=[],this.level=I,this.key=o(this.keyPath),this.cache=new y(U),this.count=null,this.complete=!1,this.announced=null,this.counting=!1,this.failed=!1,this.children=new Map,this.row=null,this.flat=!1}}class M{mode="remote";#e;#t;#n;#r;#i=new Map;#s=new Set;#o=$();#l;#a;#c=new Map;#u=[];#f=null;#d="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#O="";#w=null;#A=-1;constructor(A,I){this.#e=A||{mode:"remote"},this.#t=I||{},F(this.#e.fullFrame)&&(this.filteredIndices=()=>this.#I(),this.unfilteredIndices=()=>this.#V(),this.handleFor=ee=>this.#W(ee),this.display=()=>this.#x(),this.grandTotalRow=()=>this.#U(),this.unfilteredRows=()=>this.#D(),this.facetIndices=ee=>this.#q(ee));const U=this.#e.counts;F(U)&&(this.matchCount=()=>this.#Y("match"),this.totalCount=()=>this.#Y("total"));const X=this.#e.grandTotals;F(X)&&(this.grandTotalRow=()=>this.#G());const q=this.#e.foregroundIdle;F(q)&&(this.foregroundIdle=()=>this.#he(q),this.#e.pageForegroundIdle=()=>this.#b?this.#he(q):null);const _=this.#e.facetProvider;F(_)&&(this.facetProvider=_);const H=this.#e;F(H.countMatching)&&F(H.streamMatching)&&(this.selectionQuery=()=>this.#_(),this.countMatching=ee=>H.countMatching(ee),this.streamMatching=(ee,te)=>H.streamMatching(ee,te),this.loadedRows=()=>this.#be(),this.resident=()=>this.#M()!==null),this.#n={pageSize:this.#e.pageSize||c,maxCachedPages:this.#e.maxCachedPages||m},this.#l=t(this.#t),this.#a=new N(this.#n.pageSize*4),this.#h=x((ee,te)=>this.#T(ee,te),K),this.#r=new O([],0,this.#n),this.#i.set(this.#r.key,this.#r),this.#d=this.#ve(),F(this.#e.fetch)||Z("source.remote.fetch",'source.mode "remote" requires a fetch function; the grid will stay empty.'),this.#me()}count(){const A=this.#S();return A?A.length:this.#v()}#v(){const A=this.#M();return A?A.count():(this.#ee(),this.#xe(this.#r))}#C(){if(this.#M())return!0;const A=I=>{if(I.count===null&&!I.complete)return!1;for(const U of I.children.values())if(this.#ke(U.key,this.#Te(U))&&!A(U))return!1;return!0};return A(this.#r)}pageInfo(){const A=this.#S(),I=this.totalPending();if(!A){const U=this.#v();return{page:0,pageSize:0,total:this.#C()?U:null,pageCount:1,counting:I}}return{page:A.page,pageSize:A.pageSize,total:A.total,pageCount:A.pageCount,counting:I||A.total===null&&this.#o.size>0&&this.#r.cache.loadedExtent()===0}}#S(){const A=this.#v(),I=n(this.#$("pageSize",0),this.#$("page",0),A,this.#C());if(!I)return this.#O="",null;const U=`${this.#y}:${I.offset}:${I.length}`;return U!==this.#O&&!this.#p&&(this.#O=U,I.length>0&&!this.#M()&&this.#T(I.offset,I.offset+I.length-1)),I}at(A){const I=this.#S();if(I){if(A<0||A>=I.length)return;const U=this.#P(I.offset+A);return U&&(U.index=A),U}return this.#P(A)}#P(A){const I=this.#M();if(I)return I.at(A);if(this.#ee(),A<0||A>=this.#v())return;const U=this.#Z(this.#r,A);if(!U)return;const X=this.#z(U.node,U.local);return X&&(X.index=A),X||this.#l.skeleton(A,U.node.level,U.node.cache.erroredAt(U.local))}byKey(A){const I=this.#M();if(I)return I.byKey(A);const U=this.#c.get(A);if(!U)return;const X=U.lastIndexOf(":"),q=this.#i.get(U.slice(0,X));return q&&this.#z(q,Number(U.slice(X+1)))||void 0}loaded(A){const I=this.#S();if(I){if(A<0||A>=I.length)return!1;A+=I.offset}const U=this.#M();if(U)return U.loaded(A);if(A<0||A>=this.#v())return!1;const X=this.#Z(this.#r,A);return!!X&&X.node.cache.rowLoaded(X.local)}hint(A,I){if(this.#p)return;this.#b=!0;const U=this.#ee();let X=Math.max(0,Math.floor(A)),q=Math.max(X,Math.floor(I));const _=this.#S();if(_){if(_.length===0)return;X=_.offset,q=_.offset+_.length-1}for(const[H,ee]of this.#E(X,q)){H.cache.protect(ee.min,ee.max);for(const te of H.cache.evict())this.#Ee(H,te)}this.#h(X,q),U&&this.#h.flush()}#E(A,I){const U=this.#v(),X=new Map;for(let q=A;q<=I&&q<U;q++){const _=this.#Z(this.#r,q);if(!_)continue;const H=X.get(_.node);H?(H.min=Math.min(H.min,_.local),H.max=Math.max(H.max,_.local)):X.set(_.node,{min:_.local,max:_.local})}return X.size||X.set(this.#r,{min:A,max:A}),X}#T(A,I){if(!this.#p)for(const[U,X]of this.#E(A,I)){U.cache.protect(X.min,X.max);const q=U.cache.blockOf(X.min),_=U.cache.blockOf(X.max);for(let H=q;H<=_&&!(U.count!==null&&H*U.cache.pageSize>=U.count);H++)U.cache.has(H)||this.#fe(U,H)}}apply(A){const I={added:[],updated:[],removed:[]};if(!A)return I;if(A.update)for(const U of A.update){const X=this.#c.get(this.#l.keyOf(U,-1));if(!X)continue;this.#a.delete(X);const q=X.lastIndexOf(":"),_=this.#i.get(X.slice(0,q));if(!_)continue;const H=Number(X.slice(q+1)),ee=_.cache.blockOf(H);if(!_.cache.loaded(ee))continue;const{start:te}=_.cache.rangeOf(ee),J=[];for(let se=te;se<te+_.cache.pageSize;se++){const ae=_.cache.rowAt(se);if(ae===void 0)break;J.push(se===H?U:ae)}_.cache.fill(ee,J);const ne=this.#z(_,H);ne&&I.updated.push(ne)}return(A.add&&A.add.length||A.remove&&A.remove.length)&&this.reload({keepExpanded:!0}),I}reload(A){this.#o.abortAll("reload"),this.#h.cancel(),A&&A.keepExpanded===!1&&this.#s.clear(),this.#pe(),this.#B("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#o.abortAll("destroyed"),this.#pe(),this.#i.clear(),this.#s.clear(),this.#w&&F(this.#w.destroy)&&this.#w.destroy(),this.#w=null}expand(A){this.#s.has(A)||(this.#s.add(A),this.#B("group:toggled",{key:A,expanded:!0}),this.#B("model:changed",{reason:"expand",key:A}))}collapse(A){this.#s.delete(A)&&(this.#B("group:toggled",{key:A,expanded:!1}),this.#B("model:changed",{reason:"collapse",key:A}))}expandedKeys(){return[...this.#s]}pivotFields(){return this.#u}pivot(){this.#ee();const A=this.#f;if(!A||!A.keys.size||!this.#$("pivotBy",[]).length)return null;if(!A.result){const I=b((this.#t.config||{}).locale),U=[...A.keys.entries()].sort((q,_)=>S(q[1],_[1],I)),X=U.map(([q])=>q);A.result={keys:U.map(([,q])=>q),paths:X,fields:this.#Ce(X),groupPaths:[],columns:X.length*Math.max(1,this.#ye().length),values:A.cells,cells:A.cells,error:null}}return A.result}invalidateHandles(){this.#w&&(F(this.#w.invalidateHandles)&&this.#w.invalidateHandles(),F(this.#w.invalidate)&&this.#w.invalidate("filter"))}#N(){const A=this.#e.fullFrame;return F(A)?A():null}#M(){const A=this.#N();return A?(this.#w||(this.#w=new h({mode:"memory"},this.#R())),A.version!==this.#A&&(this.#w.setRows(A.rows),this.#A=A.version),this.#w):null}#R(){const A=this.#t,I=A.state||{};return{...A,state:{...I,page:()=>0,pageSize:()=>0}}}#I(){const A=this.#M();return A?A.filteredIndices():new Uint32Array(0)}#V(){const A=this.#M();return A?A.unfilteredIndices():new Uint32Array(0)}#W(A){const I=this.#M();return I?I.handleFor(A):void 0}#x(){const A=this.#M();return A?A.display():[]}#q(A){const I=this.#M();return I&&F(I.facetIndices)?I.facetIndices(A):new Uint32Array(0)}#U(){const A=this.#M();return A&&F(A.grandTotalRow)?A.grandTotalRow():null}#Y(A){const I=this.#M();if(I){const _=A==="match"?I.matchCount:I.totalCount;if(F(_))return _.call(I)}const U=this.#e.counts,X=F(U)?U():null,q=X?X[A]:null;return typeof q=="number"?q:this.#v()}#G(){const A=this.#M();if(A&&F(A.grandTotalRow))return A.grandTotalRow();if((this.#t.config||{}).grandTotalRow!=="bottom")return null;const U=this.#e.grandTotals,X=F(U)?U():null;return!X||!X.totals?null:this.#l.grandTotal(X.totals,X.leafCount||0)}#D(){const A=this.#M();if(A&&F(A.unfilteredRows))return A.unfilteredRows();const I=[],U=this.count();for(let X=0;X<U;X++){const q=this.at(X);q&&I.push(q)}return I}#_(){const A=this.#$("quick",""),I={protocol:W,groupPath:[],groupValues:[],groupBy:[],totals:[],totalFns:{},pivotBy:[],pivotMode:!1,filters:d(this.#$("filters",null),this.#de()),sort:this.#$("sort",[]),context:this.#$("context",null)};A&&(I.quick=A);const U=this.#$("where",null);return U&&U.active&&(I.where=U),I}#be(){const A=this.#$("groupBy",[]).length,I=[];for(const U of this.#i.values())if(!(U.level!==A&&!U.flat))for(const X of U.cache.ids()){if(!U.cache.loaded(X))continue;const{start:q,end:_}=U.cache.rangeOf(X);for(let H=q;H<_&&U.cache.rowLoaded(H);H++){const ee=this.#z(U,H);ee&&!ee.group&&I.push(ee)}}return I}loadedCount(){const A=this.#M();if(A){const X=A.matchCount();return typeof X=="number"?X:A.count()}this.#ee();const I=this.#$("groupBy",[]).length;let U=0;for(const X of this.#i.values())if(!(X.level!==I&&!X.flat))for(const q of X.cache.ids()){if(!X.cache.loaded(q))continue;const _=X.cache.fillOf(q);typeof _=="number"&&(U+=_)}return U}residentRows(){const A=this.#M();return A?A.display():this.#$("groupBy",[]).length>0?null:(this.#ee(),this.#be())}#ce(A,I,U){const{start:X,end:q}=A.cache.rangeOf(I),_=this.#$("groupBy",[]),H=this.#$("pivotBy",[]),ee=this.#$("quick",""),te=this.#ye(),J={protocol:W,range:{start:X,end:q},groupPath:A.path,groupValues:A.values,groupBy:_,totals:te,totalFns:this.#Ae(te),pivotBy:H,pivotMode:H.length>0,filters:d(this.#$("filters",null),this.#de()),sort:this.#$("sort",[]),context:this.#$("context",null),signal:U};ee&&(J.quick=ee);const ne=this.#$("where",null);return ne&&ne.active&&(J.where=ne),J}async#fe(A,I){if(!F(this.#e.fetch))return;if(!this.#m){this.#m=!0;const _=this.#g;this.#g=[],queueMicrotask(()=>{for(const H of _)H()})}const U=this.#o.begin(`${A.key}:${I}`);A.cache.begin(I,U);const X=this.#d,{start:q}=A.cache.rangeOf(I);try{const _=await this.#e.fetch(this.#ce(A,I,U.signal));if(!U.current||X!==this.#d||this.#p)return;U.settle();const H=_&&_.rows||[];if(!!(_&&_[V])&&!A.flat){A.flat=!0,A.children.clear();for(const[ne,se]of[...this.#c])se.startsWith(`${A.key}:`)&&(this.#a.delete(se),this.#c.delete(ne))}A.cache.fill(I,H),A.failed=!1;for(let ne=0;ne<H.length;ne++)this.#a.delete(`${A.key}:${q+ne}`);const te=_&&typeof _.count=="number"?_.count:_&&typeof _.total=="number"?_.total:null,J=_&&F(_.pendingTotal?.then)?_.pendingTotal:null;te!==null?(A.count=te,A.complete=!0):H.length<A.cache.pageSize?(A.count=q+H.length,A.complete=!0):J&&(A.counting=!0,A.announced=null),_&&Array.isArray(_.pivotFields)&&this.#Re(_.pivotFields),_&&_.pivot&&typeof _.pivot=="object"&&this.#ie(_.pivot),this.#B("model:changed",{reason:"page",groupPath:A.path,block:I}),this.#B("rows:changed",{companion:!0,reason:"page",groupPath:A.path,block:I}),this.#re(A),J&&this.#Ne(A,J,X)}catch(_){if(U.settle(),j(_))return;A.cache.failed(I,_),A.failed=!0;const{end:H}=A.cache.rangeOf(I);for(let ee=q;ee<H;ee++)this.#a.delete(`${A.key}:${ee}`);this.#B("model:changed",{reason:"page-error",groupPath:A.path,block:I}),this.#B("source:error",{error:_,groupPath:A.path,block:I})}}async#Ne(A,I,U){let X;try{X=await I}catch(q){if(U!==this.#d||this.#p)return;A.counting=!1,j(q)||(A.failed=!0),j(q)||this.#B("source:error",{error:q,groupPath:A.path});return}U!==this.#d||this.#p||(A.counting=!1,typeof X=="number"&&(A.count=X,A.complete=!0,this.#re(A),this.#B("model:changed",{reason:"total",count:X,groupPath:A.path})))}#re(A){typeof A.count!="number"||!A.complete||A.announced!==A.count&&(A.announced=A.count,this.#B("source:total",{total:A.count,groupPath:A.path}))}#he(A){if(this.#p)return null;this.#ee();const I=this.#m?null:new Promise(H=>{this.#g.push(H),setTimeout(H,R)}),U=A();if(!I&&!U)return null;const X=(async()=>{I&&await I;for(let H=A();H;H=A())await H})();let q;const _=new Promise(H=>{q=setTimeout(H,R)});return Promise.race([X,_]).then(()=>clearTimeout(q))}totalPending(){if(this.#r.failed)return!1;if(this.#r.counting===!0)return!0;if(this.#M())return!1;this.#ee();const A=this.#r;return A.count===null&&!A.complete&&A.cache.loadedExtent()===0}totalFailed(){return this.#r.failed===!0}#Re(A){A.length===this.#u.length&&A.every((I,U)=>I===this.#u[U])||(this.#u=A,this.#B("column:pivoted",{pivotFields:A,remote:!0}))}#Be(){const A=this.#t.config||{};return A.pivot&&A.pivot.separator||v}#Ce(A){const I=this.#Be(),U=this.#ye();if(!U.length)return A.slice();const X=[];for(const q of A)for(const _ of U)X.push(`${q}${I}${_}`);return X}#ie(A){const I=this.#Be();this.#f||(this.#f={keys:new Map,cells:new Map,result:null});const U=this.#f;let X=!1;const q=H=>{const ee=Array.isArray(H)?H:[H],te=w(ee,I);return U.keys.has(te)||(U.keys.set(te,ee),X=!0),te},_=this.#$("groupBy",[]).length>0;for(const H of Array.isArray(A.axis)?A.axis:[])q(H);for(const H of Array.isArray(A.cells)?A.cells:[]){if(!H||typeof H!="object")continue;const ee=q(H.pivot);if(_&&!(Array.isArray(H.group)&&H.group.length))continue;const te=w(Array.isArray(H.group)?H.group:[],I);for(const[J,ne]of Object.entries(H.values||{}))U.cells.set(p(te,ee,J),ne)}U.result=null,X&&this.#Re((this.pivot()||{fields:[]}).fields)}#xe(A){let I=this.#oe(A);for(const U of A.children.values())this.#ke(U.key,this.#Te(U))&&(I+=this.#xe(U));return I}#oe(A){if(A.count!==null)return A.count;const I=A.cache.loadedExtent();return A.complete?I:A.row&&A.row.leafCount>0?A.level>=this.#$("groupBy",[]).length?Math.max(I,A.row.leafCount):I===0?1:Math.min(I+A.cache.pageSize,Math.max(I,A.row.leafCount)):I+A.cache.pageSize}#Z(A,I){let U=I,X=0;const q=[...A.children.entries()].filter(([,H])=>this.#ke(H.key,this.#Te(H))).sort((H,ee)=>H[0]-ee[0]);for(const[H,ee]of q){const te=H-X+1;if(U<te)return{node:A,local:X+U};U-=te,X=H+1;const J=this.#xe(ee);if(U<J)return this.#Z(ee,U);U-=J}const _=this.#oe(A);return X+U<_?{node:A,local:X+U}:null}#z(A,I){const U=`${A.key}:${I}`,X=this.#a.get(U);if(X)return X.group===!0?this.#Q(X):X;const q=A.cache.rowAt(I);if(q===void 0)return null;const _=this.#$("groupBy",[]);let H;if(A.level<_.length&&!A.flat){const ee=_[A.level],te=this.#f!==null&&A.level===_.length-1&&this.#$("pivotBy",[]).length>0,J=this.#te(q,ee),ne=J==null,se=[...A.path,ne?"":String(J)],ae=[...A.keyPath,ne?null:String(J)];if(H=this.#l.group({path:se,keyPath:ae,column:ee,value:J,level:A.level,parent:A.row,leafCount:Number(q.leafCount)||0,expanded:te?!1:this.#ke(o(ae),{key:o(ae),column:ee,value:J,level:A.level,path:se}),...te?{hasChildren:!1}:{}}),H.totals=this.#H(q),H.data=q,!te){let we=this.#i.get(H.key);we?we.row=H:(we=new O(se,A.level+1,this.#n,ae),we.row=H,this.#i.set(we.key,we)),we.values=[...A.values,J],A.children.set(I,we)}}else H=this.#l.leaf(q,I,A.level,A.row);return this.#a.set(U,H),this.#c.set(H.key,U),H}#H(A){const I=A||{};if(I.totals&&typeof I.totals=="object")return I.totals;const U={};for(const X of this.#ye())Object.hasOwn(I,X)&&(U[X]=I[X]);return U}#Q(A){const I=this.#i.get(A.key);if(!I||I.row!==A||A.hasChildren===!1)return A;const U=this.#ke(A.key,this.#Te(I));return A.expanded!==U&&(A.expanded=U),A}#Ee(A,I){const{start:U,end:X}=A.cache.rangeOf(I);for(let q=U;q<X;q++){const _=`${A.key}:${q}`,H=this.#a.peek(_);H&&this.#c.delete(H.key),this.#a.delete(_)}}#ee(){const A=this.#ve();return A===this.#d?!1:(this.#d=A,this.#o.abortAll("query"),this.#pe(),this.#m=!1,this.#B("model:changed",{reason:"query"}),!0)}#pe(){for(const A of this.#i.values())A.cache.clear(),A.count=null,A.complete=!1,A.announced=null,A.counting=!1,A.failed=!1,A.children.clear(),A.flat=!1;this.#a.clear(),this.#c.clear(),this.#y++,this.#f=null}#ve(){const A=this.#$("where",null);return`${i({filters:this.#$("filters",null),sort:this.#$("sort",[]),quick:this.#$("quick",""),groupBy:this.#$("groupBy",[]),pivotBy:this.#$("pivotBy",[]),context:this.#$("context",null)})}|${A?A.version:0}`}#ke(A,I){const U=this.#$("expanded",null);return U?F(U.has)?U.has(A,I):Array.prototype.includes.call(U,A):this.#s.has(A)}#Te(A){if(A.row)return{key:A.key,column:A.row.column,value:A.row.value,level:A.level-1,path:A.path}}#ye(){const A=this.#$("totals",[]);if(A&&A.length)return[...A];const I=this.#t.columns;return!I||!F(I.all)?[]:I.all().filter(U=>!!U.total).map(U=>U.id)}#Ae(A){const I=this.#t.columns,U={};if(!I||!F(I.get))return U;for(const X of A){const q=I.get(X);if(!q)continue;const _=q.groupTotal!=null?q.groupTotal:q.total;typeof _=="string"?U[X]=_:_&&typeof _=="object"&&typeof _.fn=="string"&&(U[X]={..._})}return U}#te(A,I){const U=this.#t.columns,X=U&&F(U.get)?U.get(I):void 0;return X&&F(X.getValue)?X.getValue(A):A?.[I]}#me(){g(this.#t)}#de(){const A=this.#t.config||{};return{tz:A.timeZone,weekStartsOn:A.weekStartsOn}}#$(A,I){const U=this.#t.state;if(U&&F(U[A])){const X=U[A]();return X??I}return I}#B(A,I){const U=this.#t.emit;F(U)&&U(A,I)}}}),He("packages/core/src/source/gapbuffer.js",function(e,D){"use strict";Object.defineProperty(e,"GapBuffer",{enumerable:!0,get:function(){return N}});const re=64;class N{#e;#t=0;#n=0;constructor(F=re){this.#e=new Uint32Array(Math.max(1,F)),this.#n=this.#e.length}static from(F,L=re){const Z=new N(F.length+Math.max(1,L));return Z.#e.set(F,0),Z.#t=F.length,Z.#n=Z.#e.length,Z}get length(){return this.#t+(this.#e.length-this.#n)}get capacity(){return this.#e.length}at(F){return F<0||F>=this.length?0:F<this.#t?this.#e[F]:this.#e[F+(this.#n-this.#t)]}insert(F,L){const Z=F<0?0:F>this.length?this.length:F;this.#r(Z),this.#t===this.#n&&this.#i(),this.#e[this.#t++]=L}push(F){this.insert(this.length,F)}removeAt(F){return!Number.isInteger(F)||F<0||F>=this.length?!1:(this.#r(F),this.#n++,!0)}toArray(){const F=new Uint32Array(this.length);return F.set(this.#e.subarray(0,this.#t),0),F.set(this.#e.subarray(this.#n),this.#t),F}clear(){this.#t=0,this.#n=this.#e.length}#r(F){if(F!==this.#t)if(F<this.#t){const L=this.#t-F;this.#e.copyWithin(this.#n-L,F,this.#t),this.#t=F,this.#n-=L}else{const L=F-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+L),this.#t=F,this.#n+=L}}#i(){const F=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-F),this.#e=L,this.#n=L.length-F}}}),He("packages/core/src/store/ingest.js",function(e,D){"use strict";Object.defineProperty(e,"INGEST_DEFAULTS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"inferKind",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"decideText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"createReaders",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"Ingest",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return d}});const re=D("packages/core/src/internal/schedule.js"),N=re.now,G=re.nextFrame,F=D("packages/core/src/internal/warn.js"),L=F.infoOnce,Z=F.warnOnce,x=D("packages/core/src/internal/predicates.js").isFunction,$=D("packages/core/src/internal/paths.js").pathGetter,k=D("packages/core/src/store/columnstore.js").ColumnStore,y=Object.freeze({chunkMs:8,chunkRows:512,sampleSize:100,dictionaryRatio:.1,columnarBelow:5e3,initialCapacity:1024});function c(i,g={}){if(g.multi)return"multi";if(i.length===0)return"object";let r=0,n=0,f=0,h=0,l=0;for(let a=0;a<i.length;a++){const p=i[a];typeof p=="number"?r++:typeof p=="boolean"?n++:typeof p=="string"?f++:p instanceof Date?h++:Array.isArray(p)&&l++}const b=i.length;return r===b?"float64":n===b?"bitset":h===b?"float64":f===b?"text":l===b?"multi":"object"}function m(i,g,r){return g<=0||i<r*g?"dictionary":"object"}function s(i,g,r){const n=new Map,f=new Map;for(const W of i){if(W.computed)continue;const K=x(W.read)?W.read:$(W.field||W.id);f.set(W.id,K),n.set(W.id,K)}const h=g?.order??[],l=g?.fns??{},b=g?.deps??{},a=g?.wrapDeps??null,p=h.filter(W=>x(l[W])),w=p.some(W=>b[W]==="*");let v=new WeakMap;const P=W=>{const K={};if(w)for(const[R,S]of f)K[R]=S(W);for(const R of p){const S=b[R];let E;if(S==="*")E=K;else{E={};const O=S||[];for(let M=0;M<O.length;M++){const T=O[M];E[T]=T in K?K[T]:f.get(T)?.(W)}}K[R]=l[R](a?a(E,R):E,{data:W,row:null,column:null,grid:null,context:r})}return K},V=W=>{if(W===null||typeof W!="object"&&typeof W!="function")return P(W);let K=v.get(W);return K===void 0&&(K=P(W),v.set(W,K)),K};for(const W of p)n.set(W,K=>V(K)[W]);return{readers:n,reset(){v=new WeakMap}}}class t{spec;read;kind;inferred;nullable;candidate=!1;distinct=null;change=null;reason="";constructor(g,r){this.spec=g,this.read=r,this.kind="object",this.inferred=!1,this.nullable=g.nullable!==!1}}class o{#e;#t=[];#n=null;#r;#i=0;#s;#o=!1;#l=!1;#a=0;#c;constructor(g,r={},n={}){this.#e=Array.isArray(g)?g:Array.from(g||[]),this.#s={...y,...n};const f=r.columns??[];this.#r=s(f,r.computed??null,r.context),this.#c=this.#e.length>=this.#s.columnarBelow,this.#u(f,r.computed??null),this.#n=new k(this.#t.map(h=>({id:h.spec.id,kind:h.kind,nullable:h.nullable,read:h.read,dictionary:h.spec.dictionary})),{initialCapacity:this.#s.initialCapacity,columnarBelow:this.#s.columnarBelow})}get store(){return this.#n}get done(){return this.#o||this.#l}get progress(){return this.#i}slice(){if(this.done)return!1;if(this.#s.signal?.aborted)return this.#l=!0,!1;const g=N(),{chunkMs:r,chunkRows:n}=this.#s,f=this.#e.length;do{const h=Math.min(this.#i+n,f);this.#n.append(this.#e.slice(this.#i,h)),this.#f(this.#i,h),this.#i=h,this.#r.reset(),this.#h(!1)}while(this.#i<f&&N()-g<r);return this.#a+=N()-g,this.#s.onProgress?.({loaded:this.#i,total:f}),this.#i>=f?(this.#h(!0),this.#o=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(g=>({id:g.spec.id,kind:g.kind,nullable:g.nullable,read:g.read,dictionary:g.spec.dictionary})),decisions:this.#t.map(g=>({id:g.spec.id,kind:g.kind,nullable:g.nullable,inferred:g.inferred,distinct:g.candidate||g.change?this.#d(g):null,change:g.change,reason:g.reason})),count:this.#n.count,elapsed:this.#a,cancelled:this.#l}}#u(g,r){const n=this.#e,f=Math.min(this.#s.sampleSize,n.length),h=this.#s.dictionaryRatio,l=r?.pure instanceof Set?r.pure:new Set(r?.pure??r?.order??[]);for(const b of g){if(!b||!b.id)continue;if(b.computed&&(b.pure===!1||r&&!l.has(b.id))){Z(`ingest.impure.${b.id}`,`column "${b.id}" is an impure computed column and is not materialised into the store`);continue}const a=this.#r.readers.get(b.id)??(x(b.read)?b.read:$(b.field||b.id)),p=new t(b,a);if(b.kind)p.kind=b.kind,p.reason="declared by the caller";else if(b.dictionary)p.kind=b.multi?"multi":"dictionary",p.reason="value table supplied (lookup column)";else{const w=[];for(let P=0;P<f&&w.length<this.#s.sampleSize;P++){const V=a(n[P]);V!=null&&w.push(V)}p.inferred=!0;const v=c(w,{multi:b.multi});if(v==="text"){const P=new Set(w).size;p.kind=m(P,w.length,h),p.candidate=this.#c,p.reason=`sampled ${P} distinct in ${w.length}`}else p.kind=v,p.reason=`inferred from ${w.length} sampled values`,v==="object"&&w.length&&L(`ingest.mixed.${b.id}`,`column "${b.id}" holds mixed or unrecognised value types; storing as an object array. Declare a type to avoid this.`);p.kind==="object"&&p.candidate&&(p.distinct=new Set(w))}this.#t.push(p)}}#f(g,r){const n=this.#e;for(const f of this.#t){if(!f.candidate||!f.distinct)continue;const h=f.distinct;for(let l=g;l<r;l++){const b=f.read(n[l]);b!=null&&h.add(b)}}}#d(g){if(g.distinct)return g.distinct.size;const r=this.#n.column(g.spec.id);return r?.dict?r.dict.size:0}#h(g){const r=this.#s.dictionaryRatio,n=this.#e.length;for(const f of this.#t){if(!f.candidate)continue;const h=this.#d(f);if(f.kind==="dictionary"&&h>=r*n){const l=this.#n.column(f.spec.id);f.distinct=new Set(l?.dict?l.dict.values():[]),this.#n.convert(f.spec.id,"object"),f.kind="object",f.change="demoted",f.reason=`${h} distinct values is at or above ${r*100}% of ${n} rows`;continue}if(f.kind==="object"&&h>=r*n){f.candidate=!1,f.distinct=null,f.reason=`${h} distinct values is at or above ${r*100}% of ${n} rows`;continue}g&&f.kind==="object"&&h<r*n&&(this.#n.convert(f.spec.id,"dictionary"),f.kind="dictionary",f.change=f.change==="demoted"?null:"promoted",f.reason=`${h} distinct values is below ${r*100}% of ${n} rows`,f.distinct=null),g&&(f.candidate=!1)}}}async function u(i,g={},r={}){const n=new o(i,g,r),f=r.scheduler?.frame??G;for(;n.slice();)await new Promise(h=>{f(h)});return n.result()}function d(i,g={},r={}){const n=new o(i,g,{...r,chunkMs:1/0});for(;n.slice(););return n.result()}}),He("packages/core/src/store/columnpack.js",function(e,D){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return m}});const N=D("packages/core/src/internal/paths.js").pathGetter,G=D("packages/core/src/store/ingest.js"),F=G.inferKind,L=G.decideText,Z=G.INGEST_DEFAULTS,x=D("packages/core/src/store/columnstore.js").toFloat,Y=new Set(["float64","int32","bitset","dictionary","object","multi"]);function $(s){if(!Array.isArray(s)||s.length===0)return!1;for(const t of s)if(!t||typeof t.id!="string"||typeof t.field!="string"||t.field===""||t.kind&&!Y.has(t.kind))return!1;return!0}function j(s){const t=x(s);return Number.isFinite(t)?t|0:0}function k(s){return s==null?[]:Array.isArray(s)?s:[s]}function y(s,t,o,u){if(s.kind)return s.kind;const d=[];for(let r=0;r<t.length&&d.length<Z.sampleSize;r++){const n=t[r];n!=null&&d.push(n)}const i=F(d,{multi:s.multi});if(i!=="text")return i;const g=new Set(d).size;return L(g,d.length,u)}function c(s,t,o={}){const u=t.length|0,d=o.dictionaryRatio??Z.dictionaryRatio,i=[];for(const g of s){const r=N(g.field||g.id),n=g.nullable!==!1,f=new Array(u);for(let p=0;p<u;p++){const w=r(t[p]);f[p]=w===void 0?null:w}const h=y(g,f,u,d),l=n?new Uint8Array(u+7>>3):null,b=p=>{l&&(l[p>>3]|=1<<(p&7))};let a;switch(h){case"float64":{const p=new Float64Array(u);for(let w=0;w<u;w++){const v=f[w],P=v===null;P||b(w),p[w]=P?NaN:x(v)}a={id:g.id,kind:h,nullable:n,values:p,presence:l,offsets:null,table:null};break}case"int32":{const p=new Int32Array(u);for(let w=0;w<u;w++){const v=f[w],P=v===null;P||b(w),p[w]=P?0:j(v)}a={id:g.id,kind:h,nullable:n,values:p,presence:l,offsets:null,table:null};break}case"bitset":{const p=new Uint8Array(u+7>>3);for(let w=0;w<u;w++){const v=f[w],P=v===null;P||b(w),!P&&v&&(p[w>>3]|=1<<(w&7))}a={id:g.id,kind:h,nullable:n,values:p,presence:l,offsets:null,table:null};break}case"dictionary":{const p=new Uint32Array(u),w=[],v=new Map;for(let P=0;P<u;P++){const V=f[P];if(V===null){p[P]=0;continue}b(P);let W=v.get(V);W===void 0&&(W=w.length,w.push(V),v.set(V,W)),p[P]=W}a={id:g.id,kind:h,nullable:n,values:p,presence:l,offsets:null,table:w};break}case"multi":{const p=[],w=new Map,v=new Uint32Array(u+1),P=[];for(let V=0;V<u;V++){const W=f[V];v[V]=P.length,W===null||b(V);const R=k(W);for(let S=0;S<R.length;S++){const E=R[S];let O=w.get(E);O===void 0&&(O=p.length,p.push(E),w.set(E,O)),P.push(O)}}v[u]=P.length,a={id:g.id,kind:h,nullable:n,values:Int32Array.from(P),presence:l,offsets:v,table:p};break}default:{const p=new Array(u);for(let w=0;w<u;w++){const v=f[w];v!==null&&b(w),p[w]=v}a={id:g.id,kind:"object",nullable:n,values:p,presence:l,offsets:null,table:null};break}}i.push(a)}return{count:u,columns:i}}function m(s){const t=[];if(!s||!Array.isArray(s.columns))return t;const o=u=>{ArrayBuffer.isView(u)&&u.buffer&&!t.includes(u.buffer)&&t.push(u.buffer)};for(const u of s.columns)o(u.values),o(u.presence),o(u.offsets);return t}}),He("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 E}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return O}});const N=D("packages/core/src/internal/lru.js").Lru,F=D("packages/core/src/internal/predicates.js").isFunction,L=D("packages/core/src/internal/schedule.js"),Z=L.now,z=L.nextFrame,x=L.cancelFrame,Y=L.whenIdle,j=D("packages/core/src/internal/compare.js").defaultCompare,k=D("packages/core/src/internal/warn.js"),y=k.warnOnce,c=k.infoOnce,s=D("packages/core/src/internal/paths.js").getPath,t=D("packages/core/src/source/abort.js"),o=t.createAbortScope,u=t.isAbortError,d=D("packages/core/src/source/rows.js"),i=d.createRowFactory,g=d.lazyRowView,n=D("packages/core/src/source/gapbuffer.js").GapBuffer,h=D("packages/core/src/source/memory.js").createMemorySource,b=D("packages/core/src/source/filterwire.js").querySignature,p=D("packages/core/src/store/columnpack.js").isPortableSchema,w=25e4,v=Symbol("lattice.stream.storeBacked"),P=8,V=.1,W=1e3,K=50;function R(M){return Math.min(W,Math.max(K,Math.floor(M/4)))}function S(M){if(M instanceof Date)return M.getTime();if(typeof M=="number")return Number.isFinite(M)?M:NaN;if(typeof M=="string"){const T=M.trim();if(!T)return NaN;const A=Date.parse(T);return Number.isNaN(A)?Number(T):A}return NaN}function E(M,T){return new O(M,T)}class O{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#i=[];#s=null;#o;#l;#a=new Map;#c=o();#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;#N=1/0;#M=!1;#R=null;#I=null;#V=null;#W=null;#x=!1;#q=0;#U=0;#Y=!1;constructor(T,A){this.#e=T||{mode:"stream"},this.#t=A||{},this.#o=i(this.#t),this.#l=new N(4096),this.#C=this.#Xe();const I=(this.#t.config||{}).ingest;this.#x=!!I&&I.retainSource===!1,F(this.#e.open)||y("source.stream.open",'source.mode "stream" requires an open function; the grid will stay empty.'),this.#e.autoStart!==!1&&queueMicrotask(()=>this.start());const U=Number(this.#e.poll);Number.isFinite(U)&&U>0&&(this.#W=setInterval(()=>{this.#v||this.reload()},U),this.#W&&F(this.#W.unref)&&this.#W.unref()),this.#D()}#G(){const T=Number(this.#e.maxAge);return Number.isFinite(T)&&T>0?T:0}#D(){const T=this.#G();if(!T)return;const A=this.#e.ageBy;F(A)?this.#I=A:typeof A=="string"&&A?this.#I=I=>s(I,A):this.#I=null,this.#T=[],this.#R=setInterval(()=>{this.#v||this.#_()&&(this.#Ee(),this.#B())},R(T)),this.#R&&F(this.#R.unref)&&this.#R.unref()}#_(){const T=this.#G();return!T||!this.#T?!1:this.#M?!0:this.#N<Date.now()-T*(1+V)}#be(T,A){if(!this.#T)return;const I=this.#I?S(this.#I(A)):Date.now();this.#T[T]=I,Number.isNaN(I)||(I<this.#N&&(this.#N=I),I<Date.now()-this.#G()&&(this.#M=!0))}#ce(){return this.#Oe("groupBy",[]).length>0?!0:!!this.#Oe("pivotMode",!1)&&this.#Oe("pivotBy",[]).length>0}#fe(){if(this.#g||this.#v)return;const T=this.#ce();if(T&&!this.#b){this.#b=h({mode:"memory",rows:this.#n},this.#Ne()),this.#O=!1;return}!T&&this.#b&&(this.#b.destroy(),this.#b=null)}#Ne(){if(this.#y)return this.#y;const T=this,A={liveIndices:()=>T.#re(),live:I=>T.#n[I]!==void 0,source:I=>T.#se(I),get physical(){return T.#n.length}};return this.#x&&(A.column=I=>{const U=T.#t.store;return U&&F(U.column)?U.column(I):void 0}),this.#y=Object.create(this.#t,{store:{value:A,enumerable:!0,configurable:!0}}),this.#y}#re(){const T=new Uint32Array(this.#n.length);let A=0;for(let I=0;I<this.#n.length;I++)this.#n[I]!==void 0&&(T[A++]=I);return T.subarray(0,A)}#he(){return this.#g?this.#g:this.#b?(this.#O&&(this.#O=!1,this.#b.setRows(this.#n)),this.#b):null}invalidate(T="filter"){if(this.#g){this.#g.invalidate(T);return}this.#fe(),this.#b&&this.#b.invalidate(T),(T==="filter"||T==="sort")&&this.#ke()}count(){const T=this.#he();return T?T.count():this.#r?this.#r.length:this.#S}matchCount(){const T=this.#he();return T&&F(T.matchCount)?T.matchCount():this.#r?this.#r.length:this.#S}totalCount(){const T=this.#he();return T&&F(T.totalCount)?T.totalCount():this.#S}unfilteredRows(){const T=this.#he();if(T&&F(T.unfilteredRows))return T.unfilteredRows();const A=[];for(let I=0;I<this.#n.length;I++){if(!this.#n[I])continue;const U=this.#je(I);U&&A.push(U)}return A}at(T){const A=this.#he();if(A)return A.at(T);if(T<0||T>=this.count())return;const I=this.#r?this.#r.at(T):T,U=this.#je(I);return U.index=T,U}byKey(T){const A=this.#he();if(A)return A.byKey(T);const I=this.#a.get(T);return I===void 0?void 0:this.#je(I)}leavesOf(T){const A=this.#he();return A&&F(A.leavesOf)?A.leavesOf(T):[]}loaded(T){return T>=0&&T<this.count()}hint(T,A){if(this.#g){this.#g.hint(T,A);return}this.#Re(),this.#p=Math.max(0,Math.floor(T))}#Re(){this.#v||this.#Xe()===this.#C||this.reload()}display(){const T=this.#he();return T?T.display():g(()=>this.count(),A=>this.at(A))}apply(T){if(this.#g)return this.#g.apply(T);const A={added:[],updated:[],removed:[]};if(!T)return A;if(T.update){let I=!1;for(const U of T.update){const X=this.#a.get(this.#o.keyOf(U,-1));if(X===void 0)continue;const q=this.#Ae(X);this.#x?this.#Ve(X,U):this.#n[X]=U,this.#l.delete(X),this.#te(X,q),this.#T&&(this.#be(X,U),I=!0),this.#O=!0,A.updated.push(this.#je(X))}I&&this.#Ee()}if(T.add&&T.add.length){const I=this.#H(T.add);for(const U of I)A.added.push(this.#je(U))}return T.remove&&T.remove.length&&y("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#B(),A}reload(T){this.#c.abortAll("reload"),this.#We(),this.#b&&(this.#b.destroy(),this.#b=null),this.#O=!1,this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear(),this.#g=null,this.#S=0,this.#P=0,this.#E=0,this.#T&&(this.#T=[]),this.#N=1/0,this.#M=!1,this.#w=!1,this.#A=!1,this.#u={loaded:0,estimated:void 0},this.#C=this.#Xe(),this.#Se("model:changed",{reason:"reload"}),this.start()}destroy(){this.#v=!0,this.#W!==null&&(clearInterval(this.#W),this.#W=null),this.#R!==null&&(clearInterval(this.#R),this.#R=null),this.#T=null,this.#c.abortAll("destroyed"),this.#We(),this.#f!==null&&(this.#we(this.#f),this.#f=null),this.#b&&(this.#b.destroy(),this.#b=null),this.#g&&this.#g.destroy(),this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear()}async start(){if(this.#A||this.#v||!F(this.#e.open))return;this.#A=!0;const T=this.#c.begin("stream");this.#ke(),this.#fe();let A;try{A=this.#e.open({sort:this.#Oe("sort",[]),filters:this.#Oe("filters",null),quick:this.#Oe("quick","")||void 0,context:this.#Oe("context",null),signal:T.signal})}catch(U){this.#Se("source:error",{error:U});return}const I=F(A[Symbol.asyncIterator])?A[Symbol.asyncIterator]():A[Symbol.iterator]();this.#V=I;try{for(;;){const U=await I.next();if(!T.current||this.#v)return;if(U.done){this.#$();return}if(await this.#Be(U.value,T),!T.current||this.#v)return;if(U.value&&U.value.done){this.#$();return}if(await this.#ue(),!T.current||this.#v)return}}catch(U){if(u(U))return;this.#Se("source:error",{error:U})}finally{T.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 T=this.#he();T&&(F(T.invalidateHandles)&&T.invalidateHandles(),F(T.invalidate)&&T.invalidate("sort"))}renderCount(){return this.#d}ingestStats(){return{worker:this.#q,inline:this.#U,storeBacked:this.#x}}#Be(T,A){if(!T)return;const I=T.rows;if(I&&I.length&&this.#ie(I))return this.#oe(T,A);const U=Z();I&&I.length&&(this.#H(I),this.#U++),this.#Ce(T),this.#h+=Z()-U,this.#B()}#Ce(T){this.#u.loaded=T.progress&&typeof T.progress.loaded=="number"?T.progress.loaded:this.#n.length,T.progress&&typeof T.progress.estimated=="number"&&(this.#u.estimated=T.progress.estimated)}#ie(T){if(this.#Y||this.#g)return!1;const A=this.#Z();if(!A)return!1;const I=this.#t.store;if(!I||!F(I.appendPacked))return!1;const U=this.#z();return!U||!p(U)?(this.#Y=!0,c("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):T.length<A.threshold?!1:!this.#xe(T)}#xe(T){if(!this.#o.keyed)return!1;const A=new Set;for(let I=0;I<T.length;I++){const U=this.#o.keyOf(T[I],this.#n.length+I);if(U!=null){if(A.has(U)||this.#a.has(U))return!0;A.add(U)}}return!1}async#oe(T,A){const I=T.rows,U=this.#Z(),X=this.#z();let q;try{q=await U.columnize(X,I,{key:"ingest:stream",signal:A&&A.signal})}catch(J){if(u(J)||(y("source.stream.columnize","worker columnization failed; columnizing on the main thread",J),this.#Y=!0,A&&(!A.current||this.#v)))return;this.#H(I),this.#U++,this.#Ce(T),this.#B();return}if(A&&(!A.current||this.#v))return;const _=this.#t.store,H=this.#x?void 0:I,{from:ee}=_.appendPacked(q,H),te=q.count|0;for(let J=0;J<te;J++){const ne=ee+J,se=I[J],ae=this.#o.keyed?this.#o.keyOf(se,ne):null;if(this.#n[ne]=this.#x?v:se,this.#S++,this.#be(ne,se),ae!==null&&this.#a.set(ae,ne),!this.#r||!this.#Te(ne))continue;const we=this.#me(ne);this.#r.insert(we,ne),we<=this.#p&&this.#m++}this.#O=!0,this.#Ee(),this.#q++,this.#Ce(T),this.#B()}#Z(){const T=this.#t.ingestWorker;return F(T)?T():null}#z(){const T=this.#t.storeSchema;return F(T)?T():null}#H(T){const A=[],I=this.#t.store,U=new Array(T.length),X=[],q=new Set;for(let H=0;H<T.length;H++){const ee=this.#o.keyed?this.#o.keyOf(T[H],this.#n.length+X.length):null;U[H]=ee,!(ee!==null&&(this.#a.has(ee)||q.has(ee)))&&(ee!==null&&q.add(ee),X.push(T[H]))}let _=X.length&&I&&F(I.append)?I.append(X).from:this.#n.length;for(let H=0;H<T.length;H++){const ee=T[H],te=U[H];if(te!==null&&this.#a.has(te)){const se=this.#a.get(te),ae=this.#Ae(se);this.#x||(this.#n[se]=ee,I&&F(I.setSource)&&I.setSource(se,ee)),this.#Ve(se,ee),this.#l.delete(se),this.#be(se,ee),this.#te(se,ae);continue}const J=_++;if(this.#n[J]=this.#x?v:ee,this.#S++,this.#be(J,ee),te!==null&&this.#a.set(te,J),A.push(J),!this.#r||!this.#Te(J))continue;const ne=this.#me(J);this.#r.insert(ne,J),ne<=this.#p&&this.#m++}return this.#O=!0,this.#Ee(),A}#Q(T){const A=this.#n[T];let I=!1;if(this.#r){const _=this.#ve(T);_>=0&&_<=this.#p&&(I=!0)}else T<=this.#p&&(I=!0);const U=A===v?this.#se(T):A,X=this.#o.keyed?this.#o.keyOf(U,T):null;X!==null&&this.#a.get(X)===T&&this.#a.delete(X),this.#n[T]=void 0,this.#T&&(this.#T[T]=NaN),this.#l.delete(T);const q=this.#t.store;return q&&F(q.remove)&&q.remove(T),this.#S--,I}#Ee(){let T=0,A=0;const I=this.#pe();T+=I.dropped,A+=I.aboveAnchor;const U=this.#ee();T+=U.dropped,A+=U.aboveAnchor,T&&(this.#O=!0,this.#P+=T,this.#ke(),this.#m-=A,this.#Se("stream:evicted",{evicted:T,total:this.#P,live:this.#S}))}#ee(){const T=this.#e.maxRows;if(!Number.isFinite(T)||T<=0||this.#S<=T)return{dropped:0,aboveAnchor:0};const A=Math.max(1,Math.floor(T*(1-V)));let I=0,U=0;for(;this.#S>A&&this.#E<this.#n.length;){const X=this.#E++;this.#n[X]!==void 0&&(this.#Q(X)&&U++,I++)}return{dropped:I,aboveAnchor:U}}#pe(){const T=this.#G();if(!T||!this.#T||!this.#_())return{dropped:0,aboveAnchor:0};const A=Date.now()-T;let I=0,U=0,X=1/0;for(let q=this.#E;q<this.#n.length;q++){if(this.#n[q]===void 0)continue;const _=this.#T[q];if(!(Number.isNaN(_)||_===void 0)){if(_>=A){_<X&&(X=_);continue}this.#Q(q)&&U++,I++}}for(this.#N=X,this.#M=!1;this.#E<this.#n.length&&this.#n[this.#E]===void 0;)this.#E++;return{dropped:I,aboveAnchor:U}}#ve(T){if(!this.#r)return T;for(let A=0;A<this.#r.length;A++)if(this.#r.at(A)===T)return A;return-1}#ke(){this.#i=this.#Oe("sort",[]),this.#s=this.#Oe("filters",null);const T=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#G()>0,A=this.#Oe("where",null),I=(this.#t.config||{}).hostFilter,U=!!(A&&A.active)||!!(I&&F(I.active)&&I.active());if(!(T||this.#i.length>0||!!this.#s||!!this.#Oe("quick","")||U)){this.#r=null;return}this.#r=new n(Math.max(64,this.#n.length+64));for(let q=0;q<this.#n.length;q++)this.#n[q]!==void 0&&this.#Te(q)&&this.#r.insert(this.#me(q),q)}#Te(T){const A=this.#se(T);if(this.#s&&!this.#ye(this.#s,A))return!1;const I=String(this.#Oe("quick","")||"").toLowerCase();if(I&&!this.#k(A).includes(I))return!1;const U=(this.#t.config||{}).hostFilter;if(U&&F(U.active)&&U.active()&&!U.passes(this.#je(T)))return!1;const X=this.#Oe("where",null);if(X&&X.active){const q=this.#je(T);if(!X.passes(q.data,q.key))return!1}return!0}#ye(T,A){if(!T)return!0;const I=T;if(Array.isArray(I.conditions))return I.op==="or"?I.conditions.some(q=>this.#ye(q,A)):I.op==="not"?!I.conditions.some(q=>this.#ye(q,A)):I.conditions.every(q=>this.#ye(q,A));const U=T,X=(this.#t.compute||{}).testValue;return F(X)?!!X(this.#He(A,U.col),U,(this.#t.config||{}).locale):(y("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#Ae(T){if(!this.#r)return-1;if(!this.#i.length)return this.#ve(T);let A=0,I=this.#r.length;for(;A<I;){const U=A+I>>>1;this.#de(this.#r.at(U),T)<0?A=U+1:I=U}for(let U=A;U<this.#r.length;U++){const X=this.#r.at(U);if(X===T)return U;if(this.#de(X,T)>0)break}return this.#ve(T)}#te(T,A){if(!this.#r||!this.#i.length)return;const I=this.#Te(T);if(A>=0&&this.#r.at(A)===T)this.#r.removeAt(A),A<=this.#p&&this.#m--;else if(A>=0)return;if(!I)return;const U=this.#me(T);this.#r.insert(U,T),U<=this.#p&&this.#m++}#me(T){if(!this.#r||!this.#i.length)return this.#r?this.#r.length:0;let A=0,I=this.#r.length;for(;A<I;){const U=A+I>>>1;this.#de(T,this.#r.at(U))<0?I=U:A=U+1}return A}#de(T,A){const I=this.#se(T),U=this.#se(A);for(const X of this.#i){const q=this.#Le(X.col),_=this.#He(I,X.col),H=this.#He(U,X.col),te=(q&&q.value&&F(q.value.compare)?q.value.compare:j)(_,H);if(te!==0)return X.dir==="desc"?-te:te}return 0}#$(){this.#w=!0,this.#u.loaded=this.#u.loaded||this.#n.length;const T=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:w;!this.#x&&this.#n.length<T&&(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.#B(),this.#Se("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:T})}#B(){this.#f!==null||this.#v||(this.#f=this.#F(()=>{this.#f=null,this.#d++;const T=this.#m;this.#m=0,this.#h=0,this.#Se("stream:chunk",{loaded:this.#u.loaded,estimated:this.#u.estimated,count:this.count(),renders:this.#d}),this.#Se("model:changed",{reason:"stream",shiftAboveViewport:T,anchor:this.#p}),this.#Se("rows:changed",{companion:!0,reason:"stream"})}))}#ue(){return this.#d===0||this.#h<this.#ae()?Promise.resolve():(this.#h=0,new Promise(T=>{const A=(this.#t.scheduler||{}).idle;F(A)?A(()=>T()):Y(()=>T())}))}#ae(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:P}#F(T){const A=this.#t.scheduler||{};return F(A.frame)?A.frame(T):z(T)}#we(T){const A=this.#t.scheduler||{};F(A.cancel)?A.cancel(T):x(T)}#se(T){const A=this.#n[T];if(A!==void 0&&A!==v)return A;if(A===void 0)return;const I=this.#t.store;return I&&F(I.source)?I.source(T):void 0}#Ve(T,A){const I=this.#t.store;if(!I||!F(I.set))return;const U=this.#z();if(Array.isArray(U))for(const X of U){if(!X||!X.id)continue;const q=F(X.read)?X.read:_=>s(_,X.field||X.id);I.set(X.id,T,q(A))}}#je(T){let A=this.#l.get(T);return A||(A=this.#o.leaf(this.#se(T),T),this.#l.set(T,A)),A}#He(T,A){const I=this.#Le(A);return I&&F(I.getValue)?I.getValue(T):T?.[A]}#k(T){const A=this.#t.columns,I=A&&F(A.all)?A.all():[],U=[];for(const X of I){const q=F(X.getValue)?X.getValue(T):void 0;q!=null&&q!==""&&U.push(String(q))}return U.join(" ").toLowerCase()}#Le(T){const A=this.#t.columns;return A&&F(A.get)?A.get(T):void 0}#We(){const T=this.#V;if(this.#V=null,T&&F(T.return))try{T.return()}catch{}}#Xe(){return b({context:this.#Oe("context",null)})}#Oe(T,A){const I=this.#t.state;if(I&&F(I[T])){const U=I[T]();return U??A}return A}#Se(T,A){const I=this.#t.emit;F(I)&&I(T,A)}}}),He("packages/core/src/source/url.js",function(e,D){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return y}});const N=D("packages/core/src/internal/warn.js").warnOnce,G=D("packages/core/src/internal/predicates.js"),F=G.isObject,L=G.isFunction,z=D("packages/core/src/internal/paths.js").getPath,Y=D("packages/core/src/source/abort.js").isAbortError,$=500,j=new Set(["application/x-ndjson","application/ndjson","application/jsonlines","application/jsonl","application/x-jsonlines","text/x-ndjson"]),k=Symbol("lattice.url.skip");function y(l,b={}){const a=F(b)?b:{},p=L(a.fetch)?a.fetch:typeof globalThis<"u"&&L(globalThis.fetch)?globalThis.fetch:null,w=a.format==="json"||a.format==="ndjson"?a.format:void 0,v=typeof a.rowsPath=="string"&&a.rowsPath?a.rowsPath:void 0,P=L(a.map)?a.map:void 0,V=F(a.headers)?a.headers:void 0,W=Number.isFinite(a.batchSize)&&a.batchSize>0?Math.floor(a.batchSize):$,K=a.lenient===!0,R=Number.isFinite(a.poll)&&a.poll>0?Math.floor(a.poll):void 0,S=typeof l=="string"&&l.length>0;S||N("source.url.url","createUrlSource needs a URL string; the grid will stay empty.");async function*E(M={}){if(!S)return;if(!p)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const T=M&&M.signal;let A;try{A=await p(l,V?{signal:T,headers:V}:{signal:T})}catch(X){throw Y(X)?X:new Error(`[lattice] createUrlSource: request to ${l} failed — ${X&&X.message||X}`)}if(!A||!A.ok){const X=A?A.status:"no response";throw new Error(`[lattice] createUrlSource: ${X} for ${l}`)}const I=c(l,w,A),U=A.body&&L(A.body.getReader)?A.body.getReader():null;try{if(!U){const _=await A.text();(I||t(_,l))==="ndjson"?yield*r(null,null,_,0,A,l,W,K):yield*g(_,l,v,P);return}const X=new TextDecoder("utf-8");if(I==="json"){yield*g(await i(U,X,""),l,v,P);return}if(I==="ndjson"){yield*r(U,X,"",0,A,l,W,K);return}const q=await o(U,X,l);q.format==="json"?yield*g(await i(U,X,q.seed),l,v,P):yield*r(U,X,q.seed,q.bytes,A,l,W,K)}finally{if(U&&L(U.cancel))try{await U.cancel()}catch{}}}const O={mode:"stream",open:E,autoStart:a.autoStart!==!1};return R!==void 0&&(O.poll=R),Number.isFinite(a.maxRows)&&(O.maxRows=a.maxRows),Number.isFinite(a.maxAge)&&(O.maxAge=a.maxAge),(typeof a.ageBy=="string"||L(a.ageBy))&&(O.ageBy=a.ageBy),Number.isFinite(a.coalesceMs)&&(O.coalesceMs=a.coalesceMs),Number.isFinite(a.promoteToMemoryBelow)&&(O.promoteToMemoryBelow=a.promoteToMemoryBelow),O}function c(l,b,a){if(b)return b;const p=m(l);if(p)return p;const w=a&&a.headers&&L(a.headers.get)?a.headers.get("content-type"):null;return s(w)}function m(l){const b=String(l).split(/[?#]/)[0].toLowerCase();if(b.endsWith(".ndjson")||b.endsWith(".jsonl"))return"ndjson";if(b.endsWith(".json"))return"json"}function s(l){if(!l)return;const b=l.split(";")[0].trim().toLowerCase();if(j.has(b))return"ndjson";if(b==="application/json"||b==="text/json"||b.endsWith("+json"))return"json"}function t(l,b){const a=l.replace(/^\s+/,""),p=u(a);if(p==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${b} — pass opts.format: 'json' | 'ndjson'.`);return p}async function o(l,b,a){let p="",w=0;for(;;){const{value:P,done:V}=await l.read();if(P&&(w+=P.byteLength,p+=b.decode(P,{stream:!0})),V){p+=b.decode();break}const W=p.replace(/^\s+/,"");if(W){if(W[0]==="[")return{format:"json",seed:p,bytes:w};if(W[0]!=="{"||p.indexOf(`
|
|
8
8
|
`)!==-1)break}}const v=u(p.replace(/^\s+/,""));if(v==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${a} — pass opts.format: 'json' | 'ndjson'.`);return{format:v,seed:p,bytes:w}}function u(l){if(!l||l[0]==="[")return"json";if(l[0]!=="{")return"error";const b=l.indexOf(`
|
|
9
9
|
`);if(b===-1)return"json";let a=l.slice(0,b);return a.endsWith("\r")&&(a=a.slice(0,-1)),d(a)?"ndjson":"json"}function d(l){try{return JSON.parse(l),!0}catch{return!1}}async function i(l,b,a){let p=a;for(;;){const{value:w,done:v}=await l.read();if(w&&(p+=b.decode(w,{stream:!0})),v)break}return p+=b.decode(),p}function*g(l,b,a,p){let w;try{w=JSON.parse(l)}catch(P){throw new Error(`[lattice] createUrlSource: ${b} is not valid JSON — ${P.message}`)}let v=a!==void 0?z(w,a):w;if(p&&(v=p(v)),!Array.isArray(v)){const P=a!==void 0||p?"":"; pass opts.rowsPath or opts.map to select the array";throw new Error(`[lattice] createUrlSource: ${b} did not resolve to an array${P}.`)}yield{rows:v,progress:{loaded:v.length,estimated:v.length}}}async function*r(l,b,a,p,w,v,P,V){const W=h(w);let K=a||"",R=p||0,S=0,E=0,O=[];function*M(){let A;for(;(A=K.indexOf(`
|
|
10
10
|
`))!==-1;){const I=K.slice(0,A);K=K.slice(A+1),E++;const U=n(I,E,v,V);U!==k&&(O.push(U),O.length>=P&&(S+=O.length,yield f(O,S,W,R),O=[]))}}if(l){for(;;){const{value:A,done:I}=await l.read();if(A&&(R+=A.byteLength,K+=b.decode(A,{stream:!0}),yield*M()),I)break}K+=b.decode()}yield*M(),E++;const T=n(K,E,v,V);T!==k&&O.push(T),O.length&&(S+=O.length,yield f(O,S,W,R))}function n(l,b,a,p){let w=l;if(w.endsWith("\r")&&(w=w.slice(0,-1)),!w.trim())return k;try{return JSON.parse(w)}catch(v){if(p)return N(`source.url.badline.${a}`,`skipping a malformed NDJSON line (line ${b}) from ${a} — ${v.message}`),k;throw new Error(`[lattice] createUrlSource: malformed NDJSON at line ${b} of ${a} — ${v.message}`)}}function f(l,b,a,p){const w=a&&p>0&&b>0?Math.max(b,Math.round(a/(p/b))):void 0;return{rows:l,progress:{loaded:b,estimated:w}}}function h(l){const b=l&&l.headers&&L(l.headers.get)?l.headers.get("content-length"):null,a=b!=null?Number(b):NaN;return Number.isFinite(a)&&a>0?a:void 0}}),He("packages/core/src/source/derive.js",function(e,D){"use strict";Object.defineProperty(e,"FOLLOW_MODES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"BUCKETS",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"DERIVED_ROW_KEY",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"DERIVED_SOURCE_KEY",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"UNION_KEY_SEP",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"readPath",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"unnest",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"reduceValues",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"applyLimit",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"applyCumulative",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"groupRows",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"finishGroups",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"derive",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"normalizeUnionSource",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"namespaceUnionKeys",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"joinRows",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"preGroup",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"buildJoinIndex",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"joinOne",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"joinKeyOf",{enumerable:!0,get:function(){return w}});const re=D("packages/core/src/internal/predicates.js"),N=re.isFunction,G=re.isObject,L=D("packages/core/src/compute/total.js").TOTAL_FNS,Z=Object.freeze(["filtered","all","selected","grouped"]),z=Object.freeze(["day","week","month","quarter","year"]),x="__key",Y="__source",$="";function j(v,P){if(!G(v)||typeof P!="string")return;if(!P.includes("."))return v[P];let V=v;for(const W of P.split(".")){if(!G(V))return;V=V[W]}return V}function k(v,P){const V=[];for(const W of v){const K=j(W,P);if(!(!Array.isArray(K)||!K.length))for(const R of K)V.push({...W,[P]:R})}return V}function y(v,P){const V=v instanceof Date?v:new Date(v),W=V.getTime();if(!Number.isFinite(W))return null;const K=V.getUTCFullYear(),R=V.getUTCMonth(),S=V.getUTCDate(),E=O=>O.toISOString().slice(0,10);switch(P){case"year":return E(new Date(Date.UTC(K,0,1)));case"quarter":return E(new Date(Date.UTC(K,Math.floor(R/3)*3,1)));case"month":return E(new Date(Date.UTC(K,R,1)));case"week":{const O=(V.getUTCDay()+6)%7;return E(new Date(Date.UTC(K,R,S-O)))}default:return E(new Date(Date.UTC(K,R,S)))}}function c(v,P,V){const W=P.map(K=>V&&V.of===K?y(j(v,K),V.by):j(v,K));return{key:W.map(K=>K==null?"\0":String(K)).join(""),values:W}}function m(v,P){const V=L[P];return V?V({get:W=>v[W]},o(v.length)):null}function s(v,P){return!P||typeof P.of!="string"||P.of===""||v&&v.includes(P.of)?v:[P.of,...v||[]]}function t(v,P){const V={},W=o(v.length);for(const[K,R]of Object.entries(P)){const S=R.fn||"count",E=L[S];if(!E){V[K]=null;continue}const O=R.of?v.map(M=>j(M,R.of)):[];V[K]=E({get:M=>O[M]},W)}return V}const o=(()=>{const v=new Map;return P=>{let V=v.get(P);if(!V){V=new Uint32Array(P);for(let W=0;W<P;W++)V[W]=W;v.size<512&&v.set(P,V)}return V}})();function u(v,P,V){if(!Number.isFinite(P)||P<=0)return v;if(!V)return v.slice(0,P);const W=new Map,K=[];for(const R of v){const S=String(j(R,V)),E=W.get(S)||0;E>=P||(W.set(S,E+1),K.push(R))}return K}function d(v,P){const V=v.reduce((S,E)=>S+(Number(j(E,P.of))||0),0);if(!V)return v;const W=V*P.upTo;let K=0;const R=[];for(const S of v)if(R.push(S),K+=Number(j(S,P.of))||0,K>=W)break;return R}function i(v,P){return!Array.isArray(P)||!P.length?v:[...v].sort((V,W)=>{for(const K of P){const R=j(V,K.col),S=j(W,K.col);if(R===S)continue;return R==null?1:S==null?-1:((typeof R=="number"&&typeof S=="number"?R<S:String(R)<String(S))?-1:1)*(K.dir==="desc"?-1:1)}return 0})}function g(v,P,V){const W=P.groupBy?Array.isArray(P.groupBy)?P.groupBy:[P.groupBy]:null,K=G(P.bucket)?P.bucket:null,R=s(W,K),S=new Map,E=new Map;if(!R)return{groups:S,rowGroup:E};for(const O of v){const{key:M,values:T}=c(O,R,K);let A=S.get(M);A||(A={values:T,rows:new Map},S.set(M,A));const I=V(O);A.rows.set(I,O),E.set(I,M)}return{groups:S,rowGroup:E}}function r(v,P,V=null,W=null){const K=P.groupBy?Array.isArray(P.groupBy)?P.groupBy:[P.groupBy]:null,R=G(P.bucket)?P.bucket:null,S=s(K,R);let E=[...v.entries()].map(([O,M])=>{if(V&&W&&!W.has(O)){const A=V.get(O);if(A)return A}const T={[x]:O};return S.forEach((A,I)=>{T[A.includes(".")?A.split(".").pop():A]=M.values[I]}),Object.assign(T,t([...M.rows.values()],P.select||{})),V&&V.set(O,T),T});return E=i(E,P.sort),G(P.cumulative)&&(E=d(E,P.cumulative)),u(E,P.limit,P.limitPer||null)}function n(v,P){const V=b(v,P),W=P.groupBy?Array.isArray(P.groupBy)?P.groupBy:[P.groupBy]:null,K=G(P.bucket)?P.bucket:null,R=s(W,K);let S;if(!R)S=V.map((E,O)=>({...E,[x]:String(j(E,P.rowKey||"id")??O)}));else{const E=new Map;for(const O of V){const{key:M,values:T}=c(O,R,K);let A=E.get(M);A||(A={values:T,rows:[]},E.set(M,A)),A.rows.push(O)}S=[...E.entries()].map(([O,M])=>{const T={[x]:O};return R.forEach((A,I)=>{T[A.includes(".")?A.split(".").pop():A]=M.values[I]}),Object.assign(T,t(M.rows,P.select||{})),T})}return S=i(S,P.sort),G(P.cumulative)&&(S=d(S,P.cumulative)),u(S,P.limit,P.limitPer||null)}function f(v,P){const W=G(v)&&G(v.grid)?v:{grid:v};return{grid:G(W.grid)?W.grid:null,label:W.label!=null&&W.label!==""?String(W.label):String(P),follow:typeof W.follow=="string"?W.follow:void 0,map:N(W.map)?W.map:null}}function h(v){for(const P of v){const V=P[Y];V!==void 0&&(P[x]=`${V}${$}${P[x]}`)}return v}function l(v,P){const V=P.on,W=G(V)?String(V.left||V.right||""):String(V||""),K=G(V)?String(V.right||V.left||""):String(V||"");if(!W||!K)return v;const R=P.index instanceof Map?P.index:a(Array.isArray(P.rows)?P.rows:[],K),S=Array.isArray(P.select)?P.select.map(String):null,E=P.prefix?String(P.prefix):"",O=String(P.type||"inner")==="left",M=[];for(const T of v){const A=j(T,W),I=A==null?void 0:R.get(String(A));if(!I){O&&M.push(T);continue}const U={...T},X=S||Object.keys(I);for(const q of X)!E&&q===W||(U[E?E+q:q]=j(I,q));M.push(U)}return M}function b(v,P){let V=Array.isArray(v)?v:[];return P.unnest&&(V=k(V,P.unnest)),G(P.join)&&(Array.isArray(P.join.rows)||P.join.index instanceof Map)&&(V=l(V,P.join)),N(P.where)&&(V=V.filter(W=>!!P.where(W))),V}function a(v,P){const V=new Map;for(const W of v){const K=j(W,P);if(K==null)continue;const R=String(K);V.has(R)||V.set(R,W)}return V}function p(v,P){const V=P.on,W=G(V)?String(V.left||V.right||""):String(V||""),K=G(V)?String(V.right||V.left||""):String(V||"");if(!W||!K)return v;const R=P.index instanceof Map?P.index:new Map,S=j(v,W),E=S==null?void 0:R.get(String(S));if(!E)return String(P.type||"inner")==="left"?v:null;const O=Array.isArray(P.select)?P.select.map(String):null,M=P.prefix?String(P.prefix):"",T={...v};for(const A of O||Object.keys(E))!M&&A===W||(T[M?M+A:A]=j(E,A));return T}function w(v,P){const V=j(v,P);return V==null?null:String(V)}}),He("packages/core/src/source/derived.js",function(e,D){"use strict";Object.defineProperty(e,"IDLE_REFRESH_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PROFILE_FIELDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ALERT_THRESHOLDS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"STATISTICS_FNS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"SERIES_METRICS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"PRODUCER_IGNORED_KEYS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"profileAlerts",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"DerivedSource",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"createDerivedSource",{enumerable:!0,get:function(){return K}});const re=D("packages/core/src/internal/predicates.js"),N=re.isFunction,G=re.isObject,L=D("packages/core/src/internal/warn.js").warnOnce,z=D("packages/core/src/source/memory.js").MemorySource,Y=D("packages/core/src/source/settle.js").isPipelineSettle,$=D("packages/core/src/source/derive.js"),j=$.derive,k=$.preGroup,y=$.groupRows,c=$.finishGroups,m=$.readPath,s=$.buildJoinIndex,t=$.joinOne,o=$.joinKeyOf,u=$.FOLLOW_MODES,d=$.DERIVED_ROW_KEY,i=$.DERIVED_SOURCE_KEY,g=$.normalizeUnionSource,r=$.namespaceUnionKeys,n=16,f=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}),l=Object.freeze(["correlation","series","datasetVsDataset"]),b=Object.freeze(["n","first","last","change","changePercent","volatility","annualisedVolatility","growth","maxDrawdown","maxDrawdownFrom","maxDrawdownTo","autocorrelation","upDays","downDays"]),a=Object.freeze(["unnest","join","where","bucket","groupBy","select","sort","limit","limitPer","cumulative"]);function p(R,S={}){const E={...h,...G(S)?S:{}},O=te=>typeof te=="number"&&Number.isFinite(te)?te:null,M=O(R.rows)??0,T=O(R.numeric)??0,A=O(R.missing)??0,I=O(R.distinct),U=O(R.mean),X=O(R.median),q=O(R.stddev),_=O(Array.isArray(R.outliers)?R.outliers.length:R.outliers),H=T>0,ee=[];return I===0?["empty"]:(I===1&&ee.push("constant"),M>0&&A/M>=E.missing&&ee.push("high-missing"),!H&&I!==null&&M>1&&I===M&&A===0?ee.push("unique"):I!==null&&M>0&&I/M>=E.cardinality&&ee.push("high-cardinality"),H&&U!==null&&X!==null&&q!==null&&q>0&&Math.abs(3*(U-X)/q)>=E.skew&&ee.push("skewed"),H&&_!==null&&_/T>=E.outliers&&ee.push("outliers"),ee)}class w extends z{#e=null;#t={};#n=[];#r=null;#i=!1;#s={};#o=!1;#l=null;#a=null;#c=!1;#u=null;#f=!1;#d=null;constructor(S,E){super({mode:"memory",rows:[]},E),this.#s=E||{},this.#t=G(S)?S:{};const O=this.#t.from;if(Array.isArray(O)){if(this.#e=null,this.#d=this.#g(O),!this.#d.length){L("source.derived.from",'source.mode "derived" needs `from`: at least one grid to derive from.');return}this.#t.follow!==void 0&&L("source.derived.union.follow",'source.mode "derived": `follow` is ignored when `from` is a union of several grids (BACKLOG-0001045) — each entry carries its own `follow` instead.'),this.#t.crossFilter&&L("source.derived.union.crossfilter",'source.mode "derived": `crossFilter` is not supported when `from` is a union of several grids (BACKLOG-0001045) — it has no single target once there is more than one parent. Push a filter onto the individual source grid you mean instead.'),this.#t.statistics!==void 0&&(L("source.derived.union.statistics",'source.mode "derived": `statistics` is not supported when `from` is a union of several grids (BACKLOG-0001046) — a relational statistic reduces one grid\'s own columns, and a union has no single set of them. Derive the statistics of a single grid instead.'),this.#f=!0),this.#m(),this.#b(),this.refresh();return}if(this.#e=O||null,!this.#e){L("source.derived.from",'source.mode "derived" needs `from`: the grid to derive from.');return}this.#t.follow&&!u.includes(String(this.#t.follow))&&L(`source.derived.follow.${this.#t.follow}`,`unknown follow "${this.#t.follow}"; using "filtered". Known: ${u.join(", ")}.`),this.#h()||(this.#f=!0),this.#m(),this.#b(),this.refresh()}#h(){const S=this.#t.statistics;if(S===void 0)return!0;if(this.#t.profile!==void 0)return 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(!G(S))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: ${l.join(", ")}.`),!1;const E=String(S.fn||"");return l.includes(E)?this.#p(E,S):(L(`source.derived.statistics.fn.${E}`,`source.mode "derived": unknown \`statistics.fn\` "${E}". Known: ${l.join(", ")}. Every *single-column* statistic is reached through \`select\` instead, e.g. \`select: { p95: { of: 'amount', fn: 'p95' } }\`.`),!1)}#p(S,E){if(S==="correlation"){if((Array.isArray(E.columns)?E.columns.filter(Boolean):[]).length<2)return L("source.derived.statistics.columns","source.mode \"derived\": `statistics: { fn: 'correlation' }` needs `columns`: at least two column ids to correlate pairwise."),!1;const M=E.orient===void 0?"pairs":String(E.orient);return M!=="pairs"&&M!=="matrix"&&L(`source.derived.statistics.orient.${M}`,`source.mode "derived": unknown \`statistics.orient\` "${M}" for \`fn: 'correlation'\`; using "pairs". Known: pairs, matrix.`),!0}return S==="series"?!E.of||!E.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:G(E.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 S=this.#t.statistics!==void 0?"statistics":this.#t.profile!==void 0?"profile":null;if(!S)return;const E=a.filter(O=>this.#t[O]!==void 0);E.length&&L(`source.derived.producer.ignored.${S}`,`source.mode "derived": \`${S}\` is a terminal producer and replaces the pipeline, so ${E.map(O=>`\`${O}\``).join(", ")} ${E.length>1?"are":"is"} ignored. Sort, filter or limit the derived grid itself, or chain a second derived grid whose \`from\` is this one.`)}#g(S){const E=this.#s&&this.#s.grid,O=new Set,M=[];return S.forEach((T,A)=>{const I=g(T,A);if(O.has(I.label)&&L(`source.derived.union.label.${I.label}`,`source.mode "derived": two union sources share the label "${I.label}"; give each a distinct \`label\` or __source/__key will not distinguish them.`),O.add(I.label),!I.grid){L(`source.derived.union.missing.${I.label}`,`source.mode "derived": union source "${I.label}" has no grid and was skipped.`),M.push(I);return}if(E&&N(I.grid.on)){const U=P(E,I.grid,[I.label]);if(U){L(`source.derived.union.cycle.${I.label}`,`source.mode "derived": union source "${I.label}" was refused — it derives from the grid being derived, directly or through a chain (${U.join(" → ")}). Remove it from \`from\`.`),M.push({...I,grid:null});return}}M.push(I)}),M}#b(){if(this.#d){this.#O(),this.#w();return}const S=this.#e;if(!S||!N(S.on))return;const E=String(this.#t.follow||"filtered"),O=["rows:changed"];(E==="filtered"||E==="grouped")&&O.push("filter:changed","model:changed"),E==="selected"&&O.push("selection:changed"),E==="grouped"&&O.push("column:grouped");for(const M of O){const T=A=>{M==="rows:changed"&&v(A)||M==="model:changed"&&!Y(A)||this.schedule(M==="rows:changed"?A:null)};S.on(M,T),this.#n.push(()=>N(S.off)&&S.off(M,T))}this.#w(),this.#y()}#y(){const S=this.#t.statistics,E=G(S)?S.with:null;if(!G(E)||!N(E.on))return;const O=E;for(const M of["rows:changed","filter:changed","model:changed"]){const T=A=>{M==="rows:changed"&&v(A)||M==="model:changed"&&!Y(A)||this.schedule(null)};O.on(M,T),this.#n.push(()=>N(O.off)&&O.off(M,T))}}#O(){for(const S of this.#d){const E=S.grid;if(!E||!N(E.on))continue;const O=u.includes(String(S.follow))?String(S.follow):"filtered",M=["rows:changed"];(O==="filtered"||O==="grouped")&&M.push("filter:changed","model:changed"),O==="selected"&&M.push("selection:changed"),O==="grouped"&&M.push("column:grouped");for(const T of M){const A=I=>{T==="rows:changed"&&v(I)||T==="model:changed"&&!Y(I)||this.schedule(null)};E.on(T,A),this.#n.push(()=>N(E.off)&&E.off(T,A))}}}#w(){const S=this.#t.join,E=S&&S.with;if(!E||!N(E.on))return;const M=String(S.follow||"all")==="all"?["rows:changed"]:["rows:changed","filter:changed","model:changed"];for(const T of M){const A=I=>{T==="rows:changed"&&v(I)||T==="model:changed"&&!Y(I)||this.schedule({partner:!0})};E.on(T,A),this.#n.push(()=>N(E.off)&&E.off(T,A))}}#A(){const S=this.#t.join;if(!S||!S.with)return null;const E=S.on,O=G(E)?String(E.left||E.right||""):String(E||""),M=G(E)?String(E.right||E.left||""):String(E||"");return O&&M?{left:O,right:M}:null}#v(){const S=this.#A();if(!S)return this.#u=null,null;const E=this.#u;if(this.#u=s(this.#P(),S.right),!E)return null;const O=this.#t.join||{},M=Array.isArray(O.select)?O.select.map(String):null,T=U=>U?(M||Object.keys(U)).map(q=>String(m(U,q))).join(""):null,A=new Set,I=new Set;for(const[U,X]of this.#u)T(X)!==T(E.get(U))&&(A.add(U),E.has(U)||I.add(U));for(const U of E.keys())this.#u.has(U)||A.add(U);return{affected:A,gained:I}}#C(S,E){const O=this.#l;if(!O||!O.leftByJoinKey)return null;const M=[];for(const T of S){const A=O.leftByJoinKey.get(T);if(A)for(const I of A){const U=O.rowData.get(I);U!==void 0&&M.push({key:I,data:U})}}return this.#N({updated:M,added:[],removed:[]},E)}#S(S,E){if(!this.#l||!this.#l.leftByJoinKey||S.unnest||S.where||String(S.follow||"filtered")==="grouped")return!1;const O=S.join||{};return String(O.type||"inner")==="left"?!0:E.size===0}#P(){const S=this.#t.join,E=S&&S.with;if(!E||!E.rows)return[];const O=[],M=T=>{T.group||O.push(V(T))};return String(S.follow||"all")==="filtered"&&N(E.rows.forEach)?E.rows.forEach(M):N(E.rows.forEachAll)&&E.rows.forEachAll(M),O}schedule(S){const E=this.#t.refresh===void 0?"idle":this.#t.refresh;if(E==="manual")return;if(E==="live"){this.refresh(S);return}const O=typeof E=="number"&&Number.isFinite(E)?E:n;if(this.#r){this.#c=!0;return}this.#c=!1,this.#r=setTimeout(()=>{this.#r=null,this.refresh(this.#c?null:S)},O)}refresh(S){if(!(this.#i||!this.#e&&!this.#d)){if(this.#o){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.#o=!0;try{const E=this.#f?[]:this.#d?this.#t.profile?this.#q():this.#x():this.#t.statistics!==void 0?this.#be():this.#t.profile?this.#re():this.#E(S);this.setRows(E),this.invalidate("filter"),N(this.#s.emit)&&this.#s.emit("rows:changed",{derived:!0},"derived")}finally{this.#o=!1}}}#E(S){const O=G(S)&&S.partner===!0?this.#v():null,M=this.#I();if(O&&this.#l){if(!O.affected.size)return c(this.#l.groups,M,this.#l.reduced,new Set);if(this.#S(M,O.gained)){const J=this.#C(O.affected,M);if(J)return c(this.#l.groups,M,this.#l.reduced,J)}}const T=this.#T(M,S);if(T&&this.#l){const J=this.#N(T,M);return c(this.#l.groups,M,this.#l.reduced,J)}const A=k(this.#U(),M);if(this.#a=this.#R(),!M.groupBy)return this.#l=null,j(A,M);const I=this.#M(),{groups:U,rowGroup:X}=y(A,M,I),q=new Map;for(const[J,ne]of X){const se=U.get(ne);se&&q.set(J,se.rows.get(J))}const _=new Map,H=this.#A(),ee=new Map,te=new Map;if(H)for(const[J,ne]of q){const se=o(ne,H.left);if(se===null)continue;ee.set(J,se);let ae=te.get(se);ae||(ae=new Set,te.set(se,ae)),ae.add(J)}return this.#l={groups:U,rowGroup:X,rowData:q,reduced:_,leftJoinKey:ee,leftByJoinKey:te},c(U,M,_,null)}#T(S,E){if(!this.#l||!S.groupBy||S.unnest||S.where||String(S.follow||"filtered")==="grouped"||G(S.join)&&S.join.with&&!(S.join.index instanceof Map)||!G(E))return null;const O=Array.isArray(E.updated)?E.updated:null,M=Array.isArray(E.added)?E.added:null,T=Array.isArray(E.removed)?E.removed:null;if(!O&&!M&&!T)return null;const A=this.#a;if(A&&A.size&&String(S.follow||"filtered")!=="all"){if(E.edit===!0&&Array.isArray(E.columns)){for(const I of E.columns)if(A.has(String(I)))return null}for(const I of O||[]){const U=I&&I.key,X=U===void 0?void 0:this.#l.rowData.get(String(U)),q=V(I);for(const _ of A)if(m(X,_)!==m(q,_))return null}}return{updated:O||[],added:M||[],removed:T||[]}}#N(S,E){const O=this.#l,M=this.#M(),T=new Set,A=G(E.join)&&E.join.index instanceof Map?E.join:null,I=this.#A(),U=q=>{const _=O.rowGroup.get(q);if(_===void 0)return;T.add(_);const H=O.groups.get(_);if(H&&(H.rows.delete(q),H.rows.size||O.groups.delete(_)),O.rowGroup.delete(q),O.rowData.delete(q),O.leftJoinKey){const ee=O.leftJoinKey.get(q);if(ee!==void 0){const te=O.leftByJoinKey.get(ee);te&&(te.delete(q),te.size||O.leftByJoinKey.delete(ee)),O.leftJoinKey.delete(q)}}},X=q=>{const _=A?t(q,A):q;if(!_)return;const H=M(_),ee=y([_],E,M);for(const[te,J]of ee.groups){let ne=O.groups.get(te);ne||(ne={values:J.values,rows:new Map},O.groups.set(te,ne)),ne.rows.set(H,_),O.rowGroup.set(H,te),T.add(te)}if(O.rowData.set(H,_),I&&O.leftByJoinKey){const te=o(_,I.left);if(te!==null){O.leftJoinKey.set(H,te);let J=O.leftByJoinKey.get(te);J||(J=new Set,O.leftByJoinKey.set(te,J)),J.add(H)}}};for(const q of S.removed)U(String(q));for(const q of S.updated)U(String(q.key)),X(V(q));for(const q of S.added)X(V(q));return T}#M(){const S=this.#e,E=S&&S.config&&S.config.rowKey||"id";return O=>String(m(O,typeof E=="string"?E:"id")??"")}#R(){const S=this.#e,E=S&&S.state&&N(S.state.get)?S.state.get():null,O=new Set,M=T=>{if(T){if(Array.isArray(T.conditions)){T.conditions.forEach(M);return}T.col&&O.add(String(T.col))}};return E&&M(E.filters),O}#I(){let S=this.#t;if(S.join&&S.join.with&&(this.#u||this.#v(),S={...S,join:{...S.join,index:this.#u}}),this.#d||String(S.follow||"filtered")!=="grouped")return S;const E=this.#e,O=E&&E.state&&N(E.state.get)?E.state.get():null,M=O&&Array.isArray(O.group)?O.group:[];return M.length?{...S,groupBy:[...M]}:S}#V(){const S=[];for(const E of this.#d)if(E.grid)try{const O=u.includes(String(E.follow))?String(E.follow):"filtered",M=this.#W(E.grid,O);for(const T of M){const A=E.map?E.map(T):T;G(A)&&S.push({...A,[i]:E.label})}}catch(O){L(`source.derived.union.failed.${E.label}`,`source.mode "derived": union source "${E.label}" failed to read (${O&&O.message?O.message:O}) and was skipped this pass.`)}return S}#W(S,E){if(!S||!S.rows)return[];if(E==="all"){const M=[];return N(S.rows.forEachAll)&&S.rows.forEachAll(T=>{T.group||M.push(V(T))}),M}if(E==="selected")return(S.selection&&N(S.selection.rows)?S.selection.rows():[]).filter(Boolean).map(V);const O=[];return N(S.rows.forEach)&&S.rows.forEach(M=>{M.group||O.push(V(M))}),O}#x(){const S=this.#I(),E=this.#V(),O=j(E,S);return S.groupBy?O:r(O)}#q(){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.'),[]}#U(){const S=this.#e,E=String(this.#t.follow||"filtered");if(!S||!S.rows)return[];if(E==="all"){const T=[];return N(S.rows.forEachAll)&&S.rows.forEachAll(A=>{A.group||T.push(V(A))}),T}if(E==="selected")return(S.selection&&N(S.selection.rows)?S.selection.rows():[]).filter(Boolean).map(V);const O=this.#Y(),M=[];return O&&this.#G().length&&N(S.rows.forEachExcept)?(S.rows.forEachExcept(O,T=>{T.group||M.push(V(T))}),M):(N(S.rows.forEach)&&S.rows.forEach(T=>{T.group||M.push(V(T))}),M)}#Y(){const S=this.#t.crossFilter;if(!S||this.#d)return null;if(typeof S=="string")return S;if(S.col)return String(S.col);const E=this.#t.groupBy,O=Array.isArray(E)?E[0]:E;return O?String(O):null}#G(){const S=this.#Y(),E=this.#e;if(!S||!E||!E.filters||!N(E.filters.get))return[];const O=W(E.filters.get(),S);return O?O.op==="in"&&Array.isArray(O.value)?O.value.map(String):O.op==="eq"&&O.value!==void 0?[String(O.value)]:[]:[]}#D(S){const E=this.#Y(),O=this.#e;if(!E||!O||!O.filters||!N(O.filters.set))return;const M=this.#s.compute||{},T=N(O.filters.get)?O.filters.get():null,A=N(M.pruneColumn)?M.pruneColumn(T,E):null;if(!S.length){O.filters.set(A||null);return}const I=S.length===1?{col:E,op:"eq",value:S[0]}:{col:E,op:"in",value:S.slice()},U=A?A.conditions&&A.op?A.conditions:[A]:[];O.filters.set(U.length?{op:"and",conditions:[...U,I]}:I)}crossFilter(){const S=this;return{enabled(){return!!S.#Y()},column(){return S.#Y()},get(){return S.#G()},set(E){const O=E==null?[]:(Array.isArray(E)?E:[E]).map(M=>String(M));S.#D(O)},toggle(E){const O=String(E),M=S.#G(),A=M.indexOf(O)>=0?M.filter(I=>I!==O):[...M,O];S.#D(A)},clear(){S.#D([])}}}#_(S){const E=S&&S.rows;if(E&&N(E.matchCount)){const O=E.matchCount(),M=Number(O);if(O!==null&&Number.isFinite(M))return M}if(E&&N(E.count)){const O=Number(E.count());if(Number.isFinite(O))return O}return 0}#be(){const S=this.#e,E=this.#t.statistics;if(!S||!S.statistics||!G(E))return[];switch(String(E.fn)){case"correlation":return this.#ce(S,E);case"series":return this.#fe(S,E);case"datasetVsDataset":return this.#Ne(S,E);default:return[]}}#ce(S,E){const O=E.columns.filter(Boolean).map(String),M=this.#_(S),T=(A,I)=>{const U=S.statistics.correlation(A,I);return typeof U=="number"&&Number.isFinite(U)?U:null};if(String(E.orient||"pairs")!=="matrix"){const A=[];for(let I=0;I<O.length;I++)for(let U=I+1;U<O.length;U++)A.push({[d]:`${O[I]}${O[U]}`,a:O[I],b:O[U],coefficient:T(O[I],O[U]),n:M});return A}return O.map(A=>{const I={[d]:A,column:A};for(const U of O)I[U]=A===U?1:T(A,U);return I.n=M,I})}#fe(S,E){const O=this.#_(S),M={by:String(E.by)};E.periodsPerYear!==void 0&&(M.periodsPerYear=Number(E.periodsPerYear));const T=S.statistics.series(String(E.of),M)||{};return b.map(A=>({[d]:A,metric:A,value:T[A]??null,n:O}))}#Ne(S,E){const O=E.with,M=Array.isArray(E.columns)?{columns:E.columns.map(String)}:void 0,T=S.statistics.datasetVsDataset(O,M);if(!G(T))return[];const I=(Array.isArray(T.ranked)?T.ranked:[]).map(q=>({[d]:String(q.column),column:q.column,measure:q.measure??null,magnitude:q.magnitude??null,distance:q.distance??null,direction:q.direction??null,nA:q.nA??null,nB:q.nB??null,meanA:q.meanA??null,meanB:q.meanB??null,reliable:q.reliable??null,unmatched:""})),U=T.unmatched,X=[["A",U&&U.onlyA],["B",U&&U.onlyB]];for(const[q,_]of X)for(const H of _||[])I.push({[d]:`${q}${H}`,column:H,measure:null,magnitude:null,distance:null,direction:null,nA:null,nB:null,meanA:null,meanB:null,reliable:!1,unmatched:q});return I}#re(){const S=this.#e;if(!S||!S.statistics||!N(S.statistics.profile))return[];const O=(Array.isArray(this.#t.profile)?this.#t.profile:[this.#t.profile]).filter(Boolean).map(T=>{const A=S.statistics.profile(String(T))||{},I={[d]:String(T)};for(const X of f)I[X]=X==="column"?String(T):A[X]??null;I.outliers=Array.isArray(A.outliers)?A.outliers.length:A.outliers??null;const U=p({...A,rows:I.rows,outliers:I.outliers,numeric:A.numeric},this.#t.alerts);return I.alerts=U.join(", "),I.alertCount=U.length,I});if(this.#t.orient!=="metrics")return O;const M=O[0];return M?f.filter(T=>T!=="column").map(T=>({[d]:T,metric:T,value:M[T]})):[]}apply(S){const E=["add","update","remove"],O=[];for(const M of E)for(const T of S&&S[M]||[])O.push({operation:M,id:T&&T.id,reason:"derived-read-only"});return O.length&&L("source.derived.readonly","a derived grid is read-only: its rows are computed from another grid. Write to the source grid instead, and the derived one follows."),{added:[],updated:[],removed:[],rejected:O}}destroy(){this.#i=!0,this.#r&&(clearTimeout(this.#r),this.#r=null),this.#Y()&&this.#G().length&&this.#D([]);for(const S of this.#n)try{S()}catch{}this.#n=[],this.#e=null,this.#d=null,super.destroy()}}function v(R){return G(R)&&R.companion===!0}function P(R,S,E,O=new Set){if(S===R)return E;if(O.has(S))return null;O.add(S);let M=null;try{M=N(S.config)?S.config():null}catch{M=null}const T=M&&G(M.source)?M.source:null;if(!T||T.mode!=="derived")return null;const A=T.from;if(Array.isArray(A)){for(let I=0;I<A.length;I++){const U=g(A[I],I);if(!U.grid||!N(U.grid.on))continue;const X=P(R,U.grid,[...E,U.label],O);if(X)return X}return null}return G(A)&&N(A.on)?P(R,A,[...E,"(from)"],O):null}function V(R){return G(R)&&"data"in R?R.data:R}function W(R,S){if(!R||typeof R!="object")return null;if(Array.isArray(R.conditions)){for(const O of R.conditions){const M=W(O,S);if(M)return M}return null}return R.col===S?R:null}function K(R,S){return new w(R,S)}}),He("packages/core/src/source/adapters/odata.js",function(e,D){"use strict";Object.defineProperty(e,"conditionToOData",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"filtersToOData",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"odataAdapter",{enumerable:!0,get:function(){return f}});const N=D("packages/core/src/internal/warn.js").warnOnce,F=D("packages/core/src/source/filterwire.js").isGroup,L=Object.freeze(["eq","ne","gt","gte","lt","lte","contains","startsWith","endsWith","blank","notBlank","between","notBetween"]),Z=/^\d{4}-\d{2}-\d{2}$/,z=/^\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/,x=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;function Y(h){const l=h instanceof Date?h:typeof h=="number"&&Number.isFinite(h)?new Date(h):typeof h=="string"&&x.test(h)?new Date(h):null;return l&&!Number.isNaN(l.getTime())?l:null}const $=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function j(h,l){throw typeof l=="string"&&$.test(l)?new Error(`odataAdapter: "${l}" 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(l)}" is not a usable ${h} value`)}function k(h){const l=Y(h);return l||j("DateTimeOffset",h),l.toISOString()}function y(h){if(typeof h=="string"&&Z.test(h))return h;const l=Y(h);return l||j("Date",h),l.toISOString().slice(0,10)}function c(h){if(typeof h=="string"&&z.test(h))return h.length===5?`${h}:00`:h;if(typeof h=="number"&&Number.isFinite(h)&&h>=0&&h<864e5){const l=Math.floor(h),b=a=>String(a).padStart(2,"0");return`${b(Math.floor(l/36e5))}:${b(Math.floor(l%36e5/6e4))}:${b(Math.floor(l%6e4/1e3))}`}throw new Error(`odataAdapter: "${String(h)}" is not a usable TimeOfDay value`)}const m=Object.freeze({timestamp:k,datetime:k,date:y,dateString:y,time:c}),s=200,t=1e3,o=Object.freeze({eq:"eq",ne:"ne",gt:"gt",gte:"ge",lt:"lt",lte:"le"});function u(h,l){if(h==null)return"null";const b=l&&m[String(l)];return b?b(h):typeof h=="number"||typeof h=="boolean"?String(h):h instanceof Date?h.toISOString():`'${String(h).replace(/'/g,"''")}'`}function d(h){const l=String(h),b=/^[A-Za-z_][A-Za-z0-9_]*$/;if(!l||!l.split("/").every(a=>b.test(a)))throw new Error(`odataAdapter: "${l}" is not a usable column name`);return l}const i=Object.freeze({lo:{incl:"ge",excl:"gt"},hi:{incl:"le",excl:"lt"}});function g(h){const l=d(h.col),b=String(h.op),a=h.type;if(o[b])return`${l} ${o[b]} ${u(h.value,a)}`;if(b==="contains")return`contains(${l},${u(h.value,a)})`;if(b==="startsWith")return`startswith(${l},${u(h.value,a)})`;if(b==="endsWith")return`endswith(${l},${u(h.value,a)})`;if(b==="blank")return`(${l} eq null)`;if(b==="notBlank")return`(${l} ne null)`;if(b==="between"||b==="notBetween"){const p=Array.isArray(h.value)?h.value:[h.value,h.value],w=String(h.bounds||"[]"),v=w.charAt(0)==="("?i.lo.excl:i.lo.incl,P=w.charAt(1)===")"?i.hi.excl:i.hi.incl,V=`(${l} ${v} ${u(p[0],a)} and ${l} ${P} ${u(p[1],a)})`;return b==="between"?V:`(${l} eq null or not ${V})`}return null}function r(h){const l=String(h&&h.op);throw N(`source.odata.filter.refuse.${l}`,`a "${l}" 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 "${l}" filter condition cannot be expressed in OData and was refused`)}function n(h){if(!h)return"";if(!F(h)){const a=g(h);return a===null?r(h):a}const l=String(h.op)==="or"?" or ":" and ",b=(h.conditions||[]).map(a=>{if(F(a))return n(a);const p=g(a);return p===null?r(a):p}).filter(Boolean);return b.length?b.length===1?b[0]:`(${b.join(l)})`:""}function f(h={}){const l=String(h.url||""),b=h.fetch||(typeof fetch=="function"?fetch:null),a=h.count!==!1,p=d(h.key||"id"),w=h.edit===!0;return{name:"odata",capabilities:{filter:"tree",operators:L,sort:"multi",quick:h.search===!0,range:!0,total:a,mutate:w?{update:!0,delete:!0,append:!0,returning:"row"}:!1},urlFor(v){const P=[],V=(K,R)=>P.push(`${K}=${encodeURIComponent(R)}`),W=n(v.filters);return W&&V("$filter",W),v.sort&&v.sort.length&&V("$orderby",v.sort.map(K=>`${d(K.col)}${K.dir==="desc"?" desc":" asc"}`).join(",")),v.range&&(V("$skip",String(v.range.start)),V("$top",String(v.range.end-v.range.start))),v.quick&&V("$search",`"${String(v.quick).replace(/"/g,"")}"`),a&&V("$count","true"),P.length?`${l}?${P.join("&")}`:l},async execute(v,P){if(!b)throw new Error("odataAdapter needs a fetch implementation");const V={Accept:"application/json",...h.headers||{}},W=P&&P.signal,K=async O=>{const M=await b(O,{headers:V,signal:W});if(!M.ok)throw new Error(`OData request failed: ${M.status}`);return M.json()};let R=await K(this.urlFor(v)),S=R.value||R.rows||[];const E=R["@odata.count"]??R.count;if(!v.range){let O=R["@odata.nextLink"];for(;O&&S.length<s*t;)R=await K(O),S=S.concat(R.value||R.rows||[]),O=R["@odata.nextLink"]}return E==null?(a&&N("source.odata.nocount",`${l} was asked for $count=true and answered without an @odata.count, so the grid has no total for this query and will scroll open-ended rather than present the page size as the whole. The endpoint does not support $count, or filters it out.`),{rows:S}):{rows:S,total:Number(E)}},urlForKey(v){return`${l}(${u(v)})`},async mutate(v,P){if(!b)throw new Error("odataAdapter needs a fetch implementation");if(!v||v.kind!=="update"&&v.kind!=="delete"&&v.kind!=="append")throw new Error(`odataAdapter: mutation kind "${v&&v.kind}" is not supported (update, delete and append are wired)`);const V={Accept:"application/json","Content-Type":"application/json",...h.headers||{}},W=P&&P.signal;if(v.kind==="delete"){const O=Array.isArray(v.keys)&&v.keys.length?v.keys[0]:v.key;if(O==null)throw new Error("odataAdapter: a delete needs a row key");const M=await b(this.urlForKey(O),{method:"DELETE",headers:V,signal:W});if(!M.ok)throw new Error(`OData delete failed: ${M.status}`);return{ok:!0}}if(v.kind==="append"){const O=Array.isArray(v.rows)?v.rows.filter(U=>U&&typeof U=="object"):[];if(O.length!==1)throw new Error("odataAdapter: an append needs exactly one row object (OData creates one entity per POST)");const M=await b(l,{method:"POST",headers:V,signal:W,body:JSON.stringify(O[0])});if(!M.ok)throw new Error(`OData add-row failed: ${M.status}`);const T=M.status===204?null:await M.json().catch(()=>null),A=T&&typeof T=="object"&&"value"in T?T.value:T;if(!A||typeof A!="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 I=A[p];if(I==null)throw new Error(`odataAdapter: the created entity carried no ${p} to rekey the appended row by.`);return{ok:!0,keys:[String(I)],rows:[A]}}const K=this.urlForKey(v.key),R=await b(K,{method:"PATCH",headers:V,signal:W,body:JSON.stringify(v.patch||{})});if(!R.ok)throw new Error(`OData update failed: ${R.status}`);if(R.status===204)return{ok:!0};const S=await R.json(),E=S&&typeof S=="object"&&"value"in S?S.value:S;return E==null?{ok:!0}:{ok:!0,rows:[E]}}}}}),He("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 N}}),Object.defineProperty(e,"restAdapter",{enumerable:!0,get:function(){return G}});const re=Object.freeze({offset:"offset",limit:"limit",sort:"sort",order:"order",filter:"filter",search:"q"}),N=Object.freeze({update:"PATCH",delete:"DELETE",append:"POST"});function G(F={}){const L=String(F.url||""),Z=F.fetch||(typeof fetch=="function"?fetch:null),z={...re,...F.params||{}},x=F.encodeFilter||(t=>JSON.stringify(t)),Y=F.rows||(t=>Array.isArray(t)?t:t.rows||t.data||[]),$=F.total||((t,o)=>Array.isArray(t)?o.length:t.total??t.count??o.length),j=F.edit===!0,k=F.returning==="row"?"row":F.returning==="key"?"key":"none",y=F.keyField||"id",c=F.writeUrlFor||(t=>`${L}/${encodeURIComponent(String(t.key??(t.keys&&t.keys[0])))}`),m=F.encodeMutation||(t=>{const o=N[t.kind];if(t.kind==="update")return{method:o,url:c(t),headers:{"Content-Type":"application/json"},body:JSON.stringify(t.patch||{})};if(t.kind==="append"){const u=Array.isArray(t.rows)?t.rows:t.rows?[t.rows]:[];return{method:o,url:L,headers:{"Content-Type":"application/json"},body:JSON.stringify(u.length===1?u[0]:u)}}return{method:o,url:c(t)}}),s=F.writeRow||(t=>{if(t===null||typeof t!="object")return null;if(Array.isArray(t))return t.length?t[0]:null;const o=t;return o.row??o.data??t});return{name:"rest",capabilities:{range:!0,total:!0,sort:"multi",filter:!1,quick:!1,mutate:j?{update:!0,delete:!0,append:!0,returning:k}:!1,...F.capabilities||{},...F.operators?{filter:"tree",operators:F.operators}:{}},urlFor(t){const o=new URLSearchParams;t.range&&(o.set(z.offset,String(t.range.start)),o.set(z.limit,String(t.range.end-t.range.start))),t.sort&&t.sort.length&&(o.set(z.sort,t.sort.map(d=>d.col).join(",")),o.set(z.order,t.sort.map(d=>d.dir||"asc").join(","))),t.filters&&o.set(z.filter,x(t.filters)),t.quick&&o.set(z.search,String(t.quick));const u=o.toString();return u?`${L}?${u}`:L},async execute(t,o){if(!Z)throw new Error("restAdapter needs a fetch implementation");const u=await Z(this.urlFor(t),{headers:{Accept:"application/json",...F.headers||{}},signal:o&&o.signal});if(!u.ok)throw new Error(`request failed: ${u.status}`);const d=await u.json(),i=Y(d);return{rows:i,total:$(d,i)}},writeUrlFor(t){return c(t)},encodeMutation(t){return m(t)},async mutate(t,o){if(!Z)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 u=m(t);if(!u||!u.url||!u.method)throw new Error("restAdapter: encodeMutation must return { method, url }");const d={Accept:"application/json",...F.headers||{},...u.headers||{}},i=await Z(u.url,{method:u.method,headers:d,signal:o&&o.signal,...u.body!==void 0?{body:u.body}:{}});if(!i.ok)throw new Error(`REST ${t.kind} failed: ${i.status}`);if(t.kind==="append"){if(k==="none")return{ok:!0};if(i.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 n=await i.json(),f=s(n),h=f&&typeof f=="object"?f[y]:void 0;if(h==null)throw new Error(`restAdapter: the add-row response carried no ${y} to rekey the appended row by. Point \`keyField\` at the primary key the endpoint returns, or override \`writeRow\`.`);return k==="row"?{ok:!0,keys:[String(h)],rows:[f]}:{ok:!0,keys:[String(h)]}}if(k!=="row"||i.status===204)return{ok:!0};const g=await i.json(),r=s(g);return r==null?{ok:!0}:{ok:!0,rows:[r]}}}}}),He("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 Z}}),Object.defineProperty(e,"dfqlAdapter",{enumerable:!0,get:function(){return j}});const N=D("packages/core/src/internal/predicates.js").isFunction,F=D("packages/core/src/internal/warn.js").warnOnce,L="https://rest.demandflow.com",Z="https://stream.demandflow.com/dfql",z=Object.freeze(["id","created","updated","ownerId","entity"]);function x(k){const y={},c=[];for(const[m,s]of Object.entries(k||{})){if(z.includes(m)){c.push(m);continue}y[m]=s}return c.length&&F("source.dfql.protected",`a DFQL update tried to write protected field(s) ${c.join(", ")}; they are server-assigned and immutable, so they were dropped from the PATCH.`),y}function Y(k){if(!k||typeof k!="object"||Array.isArray(k))return["fields (must be an object)"];const y=k,c=[];return(typeof y.entity!="string"||!y.entity)&&c.push("entity (uppercase code)"),Number.isFinite(Number(y.level))||c.push("level (numeric)"),(typeof y.comboKey!="string"||!y.comboKey.endsWith("|ENT:"))&&c.push("comboKey (a string ending '|ENT:')"),c}async function $(k){const y=[],c=o=>{const u=o.trim();if(u)try{y.push(JSON.parse(u))}catch{}};if(!k.body||typeof k.body.getReader!="function")return(await k.text()).split(`
|