@toclocoinc/lattice-grid 1.88.2 → 1.88.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/angular/fesm2022/toclocoinc-lattice-grid-angular.mjs +6 -2
- package/angular/package.json +1 -1
- package/angular/types/toclocoinc-lattice-grid-angular.d.ts +3 -1
- package/docs/API.html +62 -6
- 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/deckgl.html +1 -1
- package/docs/api/gantt.html +58 -2
- package/docs/api/geometry.html +1 -1
- package/docs/api/grid.html +2 -2
- package/docs/api/index.html +2 -2
- 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/mapview.html +1 -1
- package/docs/api/mock-socket.html +1 -1
- package/docs/api/presets.html +1 -1
- package/docs/api/tabs.html +1 -1
- package/docs/api/types.html +2 -2
- 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 +3 -3
- package/lattice-grid.min.cjs +3 -3
- package/lattice-grid.min.js +3 -3
- package/modules/ai.d.ts +1 -1
- package/modules/ai.esm.min.js +2 -2
- package/modules/ai.min.cjs +2 -2
- package/modules/ai.min.js +2 -2
- package/modules/alarms.d.ts +1 -1
- package/modules/alarms.esm.min.js +2 -2
- package/modules/alarms.min.cjs +2 -2
- package/modules/alarms.min.js +2 -2
- package/modules/angular.d.ts +1 -1
- package/modules/angular.esm.min.js +2 -2
- package/modules/angular.min.cjs +2 -2
- package/modules/angular.min.js +2 -2
- package/modules/calendar.d.ts +1 -1
- package/modules/calendar.esm.min.js +2 -2
- package/modules/calendar.min.cjs +2 -2
- package/modules/calendar.min.js +2 -2
- 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-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 +2 -2
- package/modules/charts.min.cjs +2 -2
- package/modules/charts.min.js +2 -2
- package/modules/dashboard.d.ts +1 -1
- package/modules/dashboard.esm.min.js +2 -2
- package/modules/dashboard.min.cjs +2 -2
- package/modules/dashboard.min.js +2 -2
- package/modules/data-router.d.ts +1 -1
- package/modules/data-router.esm.min.js +2 -2
- package/modules/data-router.min.cjs +2 -2
- package/modules/data-router.min.js +2 -2
- package/modules/deckgl.d.ts +1 -1
- package/modules/deckgl.esm.min.js +2 -2
- package/modules/deckgl.min.cjs +2 -2
- package/modules/deckgl.min.js +2 -2
- 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 +2 -2
- package/modules/dhtmlx-compat.min.cjs +2 -2
- package/modules/dhtmlx-compat.min.js +2 -2
- package/modules/gantt.d.ts +58 -3
- package/modules/gantt.esm.min.js +223 -217
- package/modules/gantt.esm.min.js.map +2 -2
- package/modules/gantt.min.cjs +222 -216
- package/modules/gantt.min.js +222 -216
- package/modules/gantt.min.js.map +2 -2
- 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 +2 -2
- package/modules/geometry.min.cjs +2 -2
- package/modules/geometry.min.js +2 -2
- package/modules/htmx.d.ts +1 -1
- package/modules/htmx.esm.min.js +3 -3
- package/modules/htmx.min.cjs +3 -3
- package/modules/htmx.min.js +3 -3
- package/modules/kanban.d.ts +1 -1
- package/modules/kanban.esm.min.js +2 -2
- package/modules/kanban.min.cjs +2 -2
- package/modules/kanban.min.js +2 -2
- package/modules/kpi.d.ts +1 -1
- package/modules/kpi.esm.min.js +2 -2
- package/modules/kpi.min.cjs +2 -2
- package/modules/kpi.min.js +2 -2
- package/modules/layout.d.ts +1 -1
- package/modules/layout.esm.min.js +2 -2
- package/modules/layout.min.cjs +2 -2
- package/modules/layout.min.js +2 -2
- package/modules/leaflet.d.ts +1 -1
- package/modules/leaflet.esm.min.js +2 -2
- package/modules/leaflet.min.cjs +2 -2
- package/modules/leaflet.min.js +2 -2
- package/modules/list.d.ts +1 -1
- package/modules/list.esm.min.js +2 -2
- package/modules/list.min.cjs +2 -2
- package/modules/list.min.js +2 -2
- package/modules/mapview.d.ts +1 -1
- package/modules/mapview.esm.min.js +2 -2
- package/modules/mapview.min.cjs +2 -2
- package/modules/mapview.min.js +2 -2
- package/modules/mock-socket.d.ts +1 -1
- package/modules/mock-socket.esm.min.js +1 -1
- package/modules/mock-socket.min.cjs +1 -1
- package/modules/mock-socket.min.js +1 -1
- package/modules/presets.d.ts +1 -1
- package/modules/presets.esm.min.js +2 -2
- package/modules/presets.min.cjs +2 -2
- package/modules/presets.min.js +2 -2
- package/modules/react.d.ts +1 -1
- package/modules/react.esm.min.js +2 -2
- package/modules/react.esm.min.js.map +1 -1
- package/modules/react.min.cjs +2 -2
- package/modules/react.min.js +2 -2
- package/modules/react.min.js.map +1 -1
- package/modules/svelte.d.ts +1 -1
- package/modules/svelte.esm.min.js +3 -3
- package/modules/svelte.esm.min.js.map +1 -1
- package/modules/svelte.min.cjs +2 -2
- package/modules/svelte.min.js +2 -2
- package/modules/svelte.min.js.map +1 -1
- package/modules/tabs.d.ts +1 -1
- package/modules/tabs.esm.min.js +2 -2
- package/modules/tabs.min.cjs +2 -2
- package/modules/tabs.min.js +2 -2
- package/modules/vue.d.ts +1 -1
- package/modules/vue.esm.min.js +2 -2
- package/modules/vue.esm.min.js.map +1 -1
- package/modules/vue.min.cjs +2 -2
- package/modules/vue.min.js +2 -2
- package/modules/vue.min.js.map +1 -1
- package/modules/webcomponent.d.ts +1 -1
- package/modules/webcomponent.esm.min.js +4 -4
- package/modules/webcomponent.esm.min.js.map +1 -1
- package/modules/webcomponent.min.cjs +4 -4
- package/modules/webcomponent.min.js +4 -4
- package/modules/webcomponent.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.88.
|
|
2
|
+
* Lattice Grid 1.88.3, mapview module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
6
|
-
var On=Object.create(null),$n=Object.create(null);function Xe(r,me){On[r]=me}function Nn(r){var me=$n[r];if(me)return me;var we=Object.create(null);$n[r]=we;var X=On[r];if(!X)throw new Error("[lattice] missing module: "+r);return X(we,Nn),we}Xe("packages/core/src/internal/util.js",function(r,me){"use strict";Object.defineProperty(r,"VERSION",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"reportedWarnings",{enumerable:!0,get:function(){return S}}),Object.defineProperty(r,"warnOnce",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"infoOnce",{enumerable:!0,get:function(){return R}}),Object.defineProperty(r,"resetWarnings",{enumerable:!0,get:function(){return M}}),Object.defineProperty(r,"fail",{enumerable:!0,get:function(){return c}}),Object.defineProperty(r,"invariant",{enumerable:!0,get:function(){return l}}),Object.defineProperty(r,"DEV",{enumerable:!0,get:function(){return i}}),Object.defineProperty(r,"isObject",{enumerable:!0,get:function(){return a}}),Object.defineProperty(r,"isFunction",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"isNil",{enumerable:!0,get:function(){return b}}),Object.defineProperty(r,"isBlank",{enumerable:!0,get:function(){return o}}),Object.defineProperty(r,"isCtor",{enumerable:!0,get:function(){return O}}),Object.defineProperty(r,"pathGetter",{enumerable:!0,get:function(){return x}}),Object.defineProperty(r,"pathSetter",{enumerable:!0,get:function(){return B}}),Object.defineProperty(r,"getPath",{enumerable:!0,get:function(){return q}}),Object.defineProperty(r,"setPath",{enumerable:!0,get:function(){return J}}),Object.defineProperty(r,"humanise",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(r,"escapeHtml",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(r,"titleCase",{enumerable:!0,get:function(){return de}}),Object.defineProperty(r,"expand",{enumerable:!0,get:function(){return U}}),Object.defineProperty(r,"toArray",{enumerable:!0,get:function(){return A}}),Object.defineProperty(r,"merge",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"mergeRow",{enumerable:!0,get:function(){return t}}),Object.defineProperty(r,"Lru",{enumerable:!0,get:function(){return k}}),Object.defineProperty(r,"collator",{enumerable:!0,get:function(){return F}}),Object.defineProperty(r,"defaultCompare",{enumerable:!0,get:function(){return E}}),Object.defineProperty(r,"now",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(r,"nextFrame",{enumerable:!0,get:function(){return N}}),Object.defineProperty(r,"cancelFrame",{enumerable:!0,get:function(){return K}}),Object.defineProperty(r,"frameBatched",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(r,"settleDebounce",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(r,"whenIdle",{enumerable:!0,get:function(){return re}}),Object.defineProperty(r,"uid",{enumerable:!0,get:function(){return Q}});const we="1.88.2";async function X(){return we}const s="1.88.2",ye=new Set,se=2e3;function he(g){if(ye.add(g),ye.size>se){const h=ye.values().next().value;h!==void 0&&ye.delete(h)}}const _=[],G=500;function ie(g,h,I){_.push({key:g,level:h,message:I.map(f=>typeof f=="string"?f:W(f)).join(" "),at:Date.now()}),_.length>G&&_.shift()}function W(g){if(g instanceof Error)return g.message;try{return JSON.stringify(g)}catch{return String(g)}}function S(){return _.map(g=>({...g}))}function T(g){if(g.length===0||typeof g[0]!="string")return g;const h=g[0].replace(/^\[lattice\]\s*/,"");return h===g[0]?g:[h,...g.slice(1)]}function p(g,...h){if(ye.has(g))return;he(g);const I=T(h);ie(g,"warn",I),console.warn("[lattice]",...I)}function R(g,...h){if(ye.has(g))return;he(g);const I=T(h);ie(g,"info",I),console.info("[lattice]",...I)}function M(){ye.clear(),_.length=0}function c(g,h){const I=new Error(`[lattice] ${g}`);throw h!==void 0&&(I.cause=h),I}function l(g,h){g||c(h)}const i=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function a(g){return g!==null&&typeof g=="object"&&!Array.isArray(g)}function w(g){return typeof g=="function"}function b(g){return g==null}function o(g){return g==null||g===""}function O(g){return typeof g!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(g))?!0:!!(g.prototype&&Object.getOwnPropertyNames(g.prototype).length>1)}const n=new Map;function x(g){let h=n.get(g);if(h)return h;if(!g.includes("."))h=I=>I?.[g];else{const I=g.split("."),f=I.length;h=z=>{let e=z;for(let y=0;y<f;y++){if(e==null)return;e=e[I[y]]}return e}}return n.set(g,h),h}const D=new Map;function B(g){let h=D.get(g);if(h)return h;if(!g.includes("."))h=(I,f)=>{I!=null&&(I[g]=f)};else{const I=g.split("."),f=I.length-1;h=(z,e)=>{let y=z;for(let u=0;u<f;u++){if(y==null)return;const C=I[u];y[C]==null&&(y[C]={}),y=y[C]}y!=null&&(y[I[f]]=e)}}return D.set(g,h),h}function q(g,h){return x(h)(g)}function J(g,h,I){B(h)(g,I)}function ee(g){return g?(g.includes(".")?g.slice(g.lastIndexOf(".")+1):g).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(/^./,I=>I.toUpperCase()):""}const ue={"&":"&","<":"<",">":">",'"':""","'":"'"};function fe(g){const h=g==null?"":String(g);return/[&<>"']/.test(h)?h.replace(/[&<>"']/g,I=>ue[I]):h}function de(g){return String(g).replace(/\w\S*/g,h=>h[0].toUpperCase()+h.slice(1).toLowerCase())}function U(g,h,I){if(g!==void 0)return g===!0?{enabled:!0,...I}:g===!1?{enabled:!1}:a(g)?g:{[h]:g,enabled:!0}}function A(g){return g==null?[]:Array.isArray(g)?g:[g]}const ae=Object.freeze(new Set(["__proto__","constructor","prototype"]));function d(g,h){if(!a(g))return a(h)?{...h}:h;if(!a(h))return h===void 0?g:h;const I={...g};for(const f of Object.keys(h)){if(ae.has(f))continue;const z=h[f];z!==void 0&&(I[f]=a(z)&&a(I[f])?d(I[f],z):z)}return I}function t(g,h){if(!a(g)||!a(h)||g===h)return h;const I=Object.create(Object.getPrototypeOf(g));return Object.assign(I,g,h),I}class k{#e;#t=new Map;#n;constructor(h=256,I=null){this.#e=h,this.#n=I}get size(){return this.#t.size}get max(){return this.#e}set max(h){this.#e=h,this.#r()}has(h){return this.#t.has(h)}get(h){const I=this.#t;if(!I.has(h))return;const f=I.get(h);return I.delete(h),I.set(h,f),f}peek(h){return this.#t.get(h)}set(h,I){const f=this.#t;return f.has(h)&&f.delete(h),f.set(h,I),this.#r(),I}delete(h){const I=this.#t.get(h);return this.#t.delete(h)&&this.#n&&this.#n(I,h),I}clear(){if(this.#n)for(const[h,I]of this.#t)this.#n(I,h);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const h=this.#t;for(;h.size>this.#e;){const I=h.keys().next().value,f=h.get(I);h.delete(I),this.#n&&this.#n(f,I)}}}const v=new Map;function F(g,h){const I=`${g||""}|${h?JSON.stringify(h):""}`;let f=v.get(I);return f||(f=new Intl.Collator(g||void 0,{numeric:!0,sensitivity:"variant",...h}),v.set(I,f)),f}function E(g,h){if(g===h)return 0;if(g==null)return 1;if(h==null)return-1;if(typeof g=="number"&&typeof h=="number")return Number.isNaN(g)?Number.isNaN(h)?0:1:Number.isNaN(h)||g<h?-1:g>h?1:0;const I=String(g),f=String(h);return I<f?-1:I>f?1:0}function oe(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const te=typeof requestAnimationFrame=="function";function N(g){return te?requestAnimationFrame(g):setTimeout(()=>g(oe()),16)}function K(g){g!=null&&(te?cancelAnimationFrame(g):clearTimeout(g))}function ne(g){let h=null,I=null;const f=()=>{h=null;const e=I;I=null,g(...e||[])},z=(...e)=>{I=e,h===null&&(h=N(f))};return z.cancel=()=>{K(h),h=null,I=null},z.flush=()=>{h!==null&&(K(h),f())},z}function ge(g,h){let I=null,f=null;const z=()=>{if(I=null,f===null)return;const u=f;f=null,g(...u),e()},e=()=>{I=setTimeout(z,h),typeof I?.unref=="function"&&I.unref()},y=(...u)=>{I===null?(g(...u),e()):(f=u,clearTimeout(I),e())};return y.flush=()=>{if(I!==null&&clearTimeout(I),I=null,f===null)return;const u=f;f=null,g(...u)},y.cancel=()=>{I!==null&&clearTimeout(I),I=null,f=null},y.pending=()=>I!==null||f!==null,y}function re(g,h=50){return typeof requestIdleCallback=="function"?requestIdleCallback(g,{timeout:h}):setTimeout(()=>g({timeRemaining:()=>0,didTimeout:!0}),1)}let L=0;function Q(g="l"){return`${g}${(++L).toString(36)}`}}),Xe("packages/modules/geometry/geodata.js",function(r,me){"use strict";Object.defineProperty(r,"GEOMETRY_KINDS",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"SPATIAL_OPERATORS",{enumerable:!0,get:function(){return he}}),Object.defineProperty(r,"GEOMETRY_OPERATORS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(r,"EARTH_RADIUS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"toWkt",{enumerable:!0,get:function(){return J}}),Object.defineProperty(r,"toWkb",{enumerable:!0,get:function(){return de}}),Object.defineProperty(r,"readGeometry",{enumerable:!0,get:function(){return F}}),Object.defineProperty(r,"parseGeometry",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(r,"haversine",{enumerable:!0,get:function(){return N}}),Object.defineProperty(r,"geometryInfo",{enumerable:!0,get:function(){return I}}),Object.defineProperty(r,"geometryKind",{enumerable:!0,get:function(){return f}}),Object.defineProperty(r,"spatialOperand",{enumerable:!0,get:function(){return e}}),Object.defineProperty(r,"spatialPredicate",{enumerable:!0,get:function(){return $e}});const we=me("packages/core/src/internal/util.js"),X=we.isNil,s=we.isObject,ye=we.warnOnce,se=Object.freeze(["Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"]),he=Object.freeze(["withinBbox","withinPolygon","intersects","withinDistance"]),_=Object.freeze([...he,"blank","notBlank"]),G=63710088e-1,ie=Math.PI/180,W=16,S=1e-12;class T extends Error{}function p($){throw new T($)}function R($){(!Array.isArray($)||$.length<2)&&p("a position needs at least two numbers");const j=Number($[0]),V=Number($[1]);return(typeof $[0]!="number"||typeof $[1]!="number"||!Number.isFinite(j)||!Number.isFinite(V))&&p("a coordinate is not a finite number"),[j,V]}function M($,j,V){Array.isArray($)||p(`${V} is not an array of positions`);const le=$.map(R);return le.length<j&&p(`${V} needs at least ${j} positions, found ${le.length}`),le}function c($){const j=M($,3,"a polygon ring"),V=j[0],le=j[j.length-1];return(V[0]!==le[0]||V[1]!==le[1])&&j.push([V[0],V[1]]),j.length<4&&p(`a polygon ring needs at least 3 distinct corners, found ${j.length-1}`),j}function l($){return(!Array.isArray($)||$.length===0)&&p("a polygon needs at least an outer ring"),$.map(c)}function i($,j){switch(j>W&&p("geometry collections nest too deeply"),s($)||p("GeoJSON must be an object"),$.type){case"Feature":return $.geometry==null?null:i($.geometry,j+1);case"FeatureCollection":return p("a FeatureCollection holds many rows, not one value; load its features as rows");case"Point":return{type:"Point",coordinates:R($.coordinates)};case"MultiPoint":return{type:"MultiPoint",coordinates:M($.coordinates,1,"a MultiPoint")};case"LineString":return{type:"LineString",coordinates:M($.coordinates,2,"a LineString")};case"MultiLineString":return(!Array.isArray($.coordinates)||!$.coordinates.length)&&p("a MultiLineString needs at least one line"),{type:"MultiLineString",coordinates:$.coordinates.map(V=>M(V,2,"a LineString"))};case"Polygon":return{type:"Polygon",coordinates:l($.coordinates)};case"MultiPolygon":return(!Array.isArray($.coordinates)||!$.coordinates.length)&&p("a MultiPolygon needs at least one polygon"),{type:"MultiPolygon",coordinates:$.coordinates.map(l)};case"GeometryCollection":{(!Array.isArray($.geometries)||!$.geometries.length)&&p("a GeometryCollection needs at least one geometry");const V=$.geometries.map(le=>i(le,j+1)).filter(Boolean);return V.length?{type:"GeometryCollection",geometries:V}:null}default:return p(`"${String($.type)}" is not a GeoJSON geometry type`)}}const a=Object.freeze({POINT:"Point",LINESTRING:"LineString",POLYGON:"Polygon",MULTIPOINT:"MultiPoint",MULTILINESTRING:"MultiLineString",MULTIPOLYGON:"MultiPolygon",GEOMETRYCOLLECTION:"GeometryCollection"}),w=/[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/y,b=/[A-Za-z]+/y,o=/^\s*(?:SRID\s*=\s*\d+\s*;\s*)?[A-Za-z]+\s*(?:ZM|Z|M)?\s*(?:\(|EMPTY\b)/i;class O{text;at=0;constructor(j){this.text=j}space(){for(;this.at<this.text.length&&/\s/.test(this.text[this.at]);)this.at++}expect(j){this.space(),this.text[this.at]!==j&&p(`WKT expected "${j}" at character ${this.at+1}, found "${this.text[this.at]??"the end"}"`),this.at++}accept(j){return this.space(),this.text[this.at]===j?(this.at++,!0):!1}word(){this.space(),b.lastIndex=this.at;const j=b.exec(this.text);return j?(this.at+=j[0].length,j[0].toUpperCase()):""}numberNext(){return this.space(),w.lastIndex=this.at,w.test(this.text)}number(){this.space(),w.lastIndex=this.at;const j=w.exec(this.text);return j||p(`WKT expected a number at character ${this.at+1}`),this.at+=j[0].length,Number(j[0])}position(){const j=this.number(),V=this.number();for(;this.numberNext();)this.number();return[j,V]}positionList(){this.expect("(");const j=[this.position()];for(;this.accept(",");)j.push(this.position());return this.expect(")"),j}empty(){const j=this.at;return this.word()==="EMPTY"?!0:(this.at=j,!1)}geometry(j){j>W&&p("geometry collections nest too deeply");const V=this.word(),le=a[V];le||p(V?`"${V}" is not a WKT geometry type`:"WKT expected a geometry type");const Se=this.at,ve=this.word();return ve!=="Z"&&ve!=="M"&&ve!=="ZM"&&(this.at=Se),this.empty()?null:this.body(le,j)}body(j,V){switch(j){case"Point":{this.expect("(");const le=this.position();return this.expect(")"),{type:"Point",coordinates:le}}case"LineString":return{type:"LineString",coordinates:M(this.positionList(),2,"a LineString")};case"Polygon":return{type:"Polygon",coordinates:this.polygonBody()};case"MultiPoint":{this.expect("(");const le=[];do this.empty()||(this.accept("(")?(le.push(this.position()),this.expect(")")):le.push(this.position()));while(this.accept(","));return this.expect(")"),le.length?{type:"MultiPoint",coordinates:le}:null}case"MultiLineString":{const le=this.parts(()=>M(this.positionList(),2,"a LineString"));return le.length?{type:"MultiLineString",coordinates:le}:null}case"MultiPolygon":{const le=this.parts(()=>this.polygonBody());return le.length?{type:"MultiPolygon",coordinates:le}:null}default:{this.expect("(");const le=[];do{const Se=this.geometry(V+1);Se&&le.push(Se)}while(this.accept(","));return this.expect(")"),le.length?{type:"GeometryCollection",geometries:le}:null}}}parts(j){this.expect("(");const V=[];do this.empty()||V.push(j());while(this.accept(","));return this.expect(")"),V}polygonBody(){return l(this.parts(()=>this.positionList()))}}function n($){const j=new O(String($).replace(/^\s*SRID\s*=\s*\d+\s*;/i,"")),V=j.geometry(0);return j.space(),j.at<j.text.length&&p(`WKT has unexpected text after the geometry at character ${j.at+1}`),V}function x($){return Object.is($,-0)?"0":String($)}function D($){return`${x($[0])} ${x($[1])}`}function B($){return`(${$.map(D).join(", ")})`}function q($){return`(${$.map(B).join(", ")})`}function J($){const j=oe($);return j?ee(j):""}function ee($){switch($.type){case"Point":return`POINT (${D($.coordinates)})`;case"LineString":return`LINESTRING ${B($.coordinates)}`;case"Polygon":return`POLYGON ${q($.coordinates)}`;case"MultiPoint":return`MULTIPOINT (${$.coordinates.map(j=>`(${D(j)})`).join(", ")})`;case"MultiLineString":return`MULTILINESTRING (${$.coordinates.map(B).join(", ")})`;case"MultiPolygon":return`MULTIPOLYGON (${$.coordinates.map(q).join(", ")})`;default:return`GEOMETRYCOLLECTION (${$.geometries.map(ee).join(", ")})`}}class ue{view;at=0;constructor(j){this.view=new DataView(j.buffer,j.byteOffset,j.byteLength)}need(j){this.at+j>this.view.byteLength&&p(`WKB ends after ${this.view.byteLength} bytes, in the middle of a geometry`)}u8(){return this.need(1),this.view.getUint8(this.at++)}u32(j){this.need(4);const V=this.view.getUint32(this.at,j);return this.at+=4,V}f64(j){this.need(8);const V=this.view.getFloat64(this.at,j);return this.at+=8,V}count(j,V){const le=this.u32(j);return le*V>this.view.byteLength-this.at&&p(`WKB claims ${le} elements, more than its bytes can hold`),le}position(j,V){const le=this.f64(j),Se=this.f64(j);for(let ve=2;ve<V;ve++)this.f64(j);return[le,Se]}positions(j,V){const le=this.count(j,8*V),Se=new Array(le);for(let ve=0;ve<le;ve++)Se[ve]=this.position(j,V);return Se}geometry(j,V){j>W&&p("geometry collections nest too deeply");const le=this.u8();le!==0&&le!==1&&p(`WKB byte-order mark is ${le}, not 0 or 1`);const Se=le===1,ve=this.u32(Se);let Me=2;ve&2147483648&&Me++,ve&1073741824&&Me++,ve&536870912&&this.u32(Se);let Le=ve&268435455;if(Le>=1e3){const We=Math.floor(Le/1e3);We>3&&p(`WKB geometry type ${Le} is not one this reads`),Me=2+(We===3?2:1),Le%=1e3}const Be=se[Le-1];switch(Be||p(`WKB geometry type ${Le} is not one this reads`),V&&Be!==V&&p(`a part of a WKB Multi${V} is a ${Be}`),Be){case"Point":{const We=this.position(Se,Me);return Number.isNaN(We[0])&&Number.isNaN(We[1])?null:{type:"Point",coordinates:R(We)}}case"LineString":return{type:"LineString",coordinates:M(this.positions(Se,Me),2,"a LineString")};case"Polygon":{const We=this.count(Se,4),ze=[];for(let Ke=0;Ke<We;Ke++)ze.push(this.positions(Se,Me));return We?{type:"Polygon",coordinates:l(ze)}:null}default:{const We=this.count(Se,5),ze=Be==="GeometryCollection"?void 0:Be.slice(5),Ke=[];for(let Ue=0;Ue<We;Ue++){const vt=this.geometry(j+1,ze);vt&&Ke.push(vt)}return Ke.length?Be==="GeometryCollection"?{type:Be,geometries:Ke}:{type:Be,coordinates:Ke.map(Ue=>Ue.coordinates)}:null}}}}function fe($){const j=new ue($),V=j.geometry(0);return j.at!==$.byteLength&&p(`WKB has ${$.byteLength-j.at} bytes left over after the geometry`),V}function de($){const j=oe($);if(!j)return null;const V=[];let le=0;const Se=ze=>{const Ke=new DataView(new ArrayBuffer(5));Ke.setUint8(0,1),Ke.setUint32(1,se.indexOf(ze)+1,!0),V.push(Ke),le+=5},ve=ze=>{const Ke=new DataView(new ArrayBuffer(4));Ke.setUint32(0,ze,!0),V.push(Ke),le+=4},Me=ze=>{const Ke=new DataView(new ArrayBuffer(16*ze.length));ze.forEach((Ue,vt)=>{Ke.setFloat64(vt*16,Ue[0],!0),Ke.setFloat64(vt*16+8,Ue[1],!0)}),V.push(Ke),le+=16*ze.length},Le=ze=>{switch(Se(ze.type),ze.type){case"Point":Me([ze.coordinates]);break;case"LineString":ve(ze.coordinates.length),Me(ze.coordinates);break;case"Polygon":ve(ze.coordinates.length);for(const Ke of ze.coordinates)ve(Ke.length),Me(Ke);break;case"GeometryCollection":ve(ze.geometries.length);for(const Ke of ze.geometries)Le(Ke);break;default:{const Ke=ze.type.slice(5);ve(ze.coordinates.length);for(const Ue of ze.coordinates)Le({type:Ke,coordinates:Ue})}}};Le(j);const Be=new Uint8Array(le);let We=0;for(const ze of V)Be.set(new Uint8Array(ze.buffer),We),We+=ze.byteLength;return Be}const U=/^0[01](?:[0-9a-fA-F]{2})+$/,A=/^[A-Za-z0-9+/_-]+={0,2}$/,ae=(()=>{const $=new Int16Array(128).fill(-1),j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let V=0;V<j.length;V++)$[j.charCodeAt(V)]=V;return $[45]=62,$[95]=63,$})();function d($){const j=new Uint8Array($.length/2);for(let V=0;V<j.length;V++)j[V]=parseInt($.slice(V*2,V*2+2),16);return j}function t($){const j=$.replace(/=+$/,""),V=new Uint8Array(Math.floor(j.length*3/4));let le=0,Se=0,ve=0;for(let Me=0;Me<j.length;Me++)Se=Se<<6|ae[j.charCodeAt(Me)],le+=6,le>=8&&(le-=8,V[ve++]=Se>>le&255);return V.subarray(0,ve)}function k($){const j=$.trim();if(j==="")return null;if(j[0]==="{"){let V;try{V=JSON.parse(j)}catch{return p("the text starts like GeoJSON but is not valid JSON")}return i(V,0)}if(U.test(j))return fe(d(j));if(o.test(j))return n(j);if(A.test(j)){const V=t(j);if(V.length>=5&&(V[0]===0||V[0]===1))return fe(V)}return p("the text is not WKT, GeoJSON, or hex or base64 WKB")}const v=new WeakSet;function F($){if(X($))return{geometry:null,reason:null};if(typeof $=="object"&&v.has($))return{geometry:$,reason:null};try{let j;return typeof $=="string"?j=k($):$ instanceof Uint8Array?j=fe($):$ instanceof ArrayBuffer?j=fe(new Uint8Array($)):ArrayBuffer.isView($)?j=fe(new Uint8Array($.buffer,$.byteOffset,$.byteLength)):s($)?j=i($,0):p(`${Array.isArray($)?"an array":`a ${typeof $}`} is not a geometry`),j&&E(j),{geometry:j||null,reason:null}}catch(j){if(j instanceof T)return{geometry:null,reason:j.message};throw j}}function E($){if(v.add($),$.type==="GeometryCollection")for(const j of $.geometries)E(j)}function oe($){return F($).geometry}function te($,j){switch($.type){case"Point":j($.coordinates);break;case"MultiPoint":case"LineString":$.coordinates.forEach(j);break;case"MultiLineString":case"Polygon":for(const V of $.coordinates)V.forEach(j);break;case"MultiPolygon":for(const V of $.coordinates)for(const le of V)le.forEach(j);break;default:for(const V of $.geometries)te(V,j)}}function N($,j){const V=$[1]*ie,le=j[1]*ie,Se=le-V,ve=(j[0]-$[0])*ie,Me=Math.sin(Se/2)**2+Math.cos(V)*Math.cos(le)*Math.sin(ve/2)**2;return 2*G*Math.asin(Math.min(1,Math.sqrt(Me)))}function K($){let j=0;for(let V=1;V<$.length;V++)j+=N($[V-1],$[V]);return j}function ne($){const j=$.length-1;if(j<3)return 0;let V=0;for(let le=0;le<j;le++){const Se=$[(le-1+j)%j],ve=$[(le+1)%j];V+=(ve[0]-Se[0])*ie*Math.sin($[le][1]*ie)}return Math.abs(V)*G*G/2}function ge($){let j=ne($[0]);for(let V=1;V<$.length;V++)j-=ne($[V]);return Math.max(0,j)}function re($){let j=0,V=0,le=0;for(let Se=0;Se<$.length-1;Se++){const[ve,Me]=$[Se],[Le,Be]=$[Se+1],We=ve*Be-Le*Me;j+=We,V+=(ve+Le)*We,le+=(Me+Be)*We}return{a:j,cx:V,cy:le}}function L(){let $=0,j=0,V=0;return{add(le,Se,ve){$+=le*ve,j+=Se*ve,V+=ve},get(){return V>0?[$/V,j/V]:null}}}function Q($){let j=0,V=0;for(const le of $)j+=le[0],V+=le[1];return[j/$.length,V/$.length]}function g($,j){switch($.type){case"Point":j[0].add($.coordinates[0],$.coordinates[1],1);break;case"MultiPoint":for(const V of $.coordinates)j[0].add(V[0],V[1],1);break;case"LineString":case"MultiLineString":{const V=$.type==="LineString"?[$.coordinates]:$.coordinates;for(const le of V){for(let Se=1;Se<le.length;Se++){const[ve,Me]=le[Se-1],[Le,Be]=le[Se],We=Math.hypot(Le-ve,Be-Me);j[1].add((ve+Le)/2,(Me+Be)/2,We)}for(const Se of le)j[0].add(Se[0],Se[1],1)}break}case"Polygon":case"MultiPolygon":{const V=$.type==="Polygon"?[$.coordinates]:$.coordinates;for(const le of V){let Se=0,ve=0,Me=0;le.forEach((Be,We)=>{const ze=re(Be),Ke=(We===0?1:-1)*(ze.a<0?-1:1);Se+=Ke*ze.a,ve+=Ke*ze.cx,Me+=Ke*ze.cy}),Math.abs(Se)>S&&j[2].add(ve/(3*Se),Me/(3*Se),Math.abs(Se)/2);const Le=le[0].slice(0,-1);for(const Be of Le)j[0].add(Be[0],Be[1],1)}break}default:for(const V of $.geometries)g(V,j)}}const h=new WeakMap;function I($){const j=oe($);if(!j)return null;const V=h.get(j);if(V)return V;const le=[1/0,1/0,-1/0,-1/0];te(j,ze=>{ze[0]<le[0]&&(le[0]=ze[0]),ze[1]<le[1]&&(le[1]=ze[1]),ze[0]>le[2]&&(le[2]=ze[0]),ze[1]>le[3]&&(le[3]=ze[1])});const Se=[L(),L(),L()];g(j,Se);const ve=Se[2].get()||Se[1].get()||Se[0].get()||Q([[le[0],le[1]],[le[2],le[3]]]);let Me=0,Le=0;const Be=ze=>{switch(ze.type){case"LineString":Me+=K(ze.coordinates);break;case"MultiLineString":for(const Ke of ze.coordinates)Me+=K(Ke);break;case"Polygon":Le+=ge(ze.coordinates);for(const Ke of ze.coordinates)Me+=K(Ke);break;case"MultiPolygon":for(const Ke of ze.coordinates){Le+=ge(Ke);for(const Ue of Ke)Me+=K(Ue)}break;case"GeometryCollection":for(const Ke of ze.geometries)Be(Ke);break;default:break}};Be(j);const We=Object.freeze({kind:j.type,bbox:Object.freeze(le),centroid:Object.freeze(ve),length:Me,area:Le});return h.set(j,We),We}function f($){const j=I($);return j?j.kind:null}function z($,j){const V=typeof $=="string"?$.split(/[\s,;]+/).filter(Boolean):$;if(!Array.isArray(V)||V.length!==j)return null;const le=V.map(Se=>typeof Se=="number"?Se:typeof Se=="string"?Number(Se):NaN);return le.every(Number.isFinite)?le:null}function e($,j){if($==="withinBbox"){const V=z(j,4);return V?V[0]>V[2]?{reason:'the box crosses the antimeridian (its west edge is east of its east edge), which is not supported; split it into two withinBbox conditions joined by "or"'}:V[1]>V[3]?{reason:"the box's minLat is above its maxLat"}:{operand:V}:{reason:"withinBbox needs [minLon, minLat, maxLon, maxLat]"}}if($==="withinDistance"){let V=null;if(s(j)&&!Array.isArray(j)){const le=j;V=z([le.lon,le.lat,le.metres],3)}else V=z(j,3);return!V||V[2]<0?{reason:"withinDistance needs { lon, lat, metres } with metres of 0 or more"}:{operand:{lon:V[0],lat:V[1],metres:V[2]}}}if($==="withinPolygon"||$==="intersects"){const V=$==="intersects"?z(j,4):null;if(V){if(V[0]>V[2]||V[1]>V[3])return{reason:"the box's minimum is above its maximum"};const[ve,Me,Le,Be]=V;return{operand:{type:"Polygon",coordinates:[[[ve,Me],[Le,Me],[Le,Be],[ve,Be],[ve,Me]]]}}}const{geometry:le,reason:Se}=F(j);return le?$==="withinPolygon"&&le.type!=="Polygon"&&le.type!=="MultiPolygon"?{reason:`withinPolygon needs a Polygon or MultiPolygon, not a ${le.type}`}:{operand:le}:{reason:`${$} needs a geometry: ${Se||"none was given"}`}}return{reason:`"${$}" is not a spatial operator`}}function y($,j){const[V,le]=$;let Se=!1;for(let ve=0,Me=j.length-2;ve<j.length-1;Me=ve++){const[Le,Be]=j[ve],[We,ze]=j[Me];Be>le!=ze>le&&V<(We-Le)*(le-Be)/(ze-Be)+Le&&(Se=!Se)}return Se}function u($,j){if(!y($,j[0]))return!1;for(let V=1;V<j.length;V++)if(y($,j[V]))return!1;return!0}function C($,j={points:[],segments:[],polygons:[]}){const V=le=>{for(let Se=1;Se<le.length;Se++)j.segments.push([le[Se-1],le[Se]]);for(const Se of le)j.points.push(Se)};switch($.type){case"Point":j.points.push($.coordinates);break;case"MultiPoint":for(const le of $.coordinates)j.points.push(le);break;case"LineString":V($.coordinates);break;case"MultiLineString":$.coordinates.forEach(V);break;case"Polygon":j.polygons.push($.coordinates),$.coordinates.forEach(V);break;case"MultiPolygon":for(const le of $.coordinates)j.polygons.push(le),le.forEach(V);break;default:for(const le of $.geometries)C(le,j)}return j}function Y($,j,V){const le=(j[0]-$[0])*(V[1]-$[1])-(j[1]-$[1])*(V[0]-$[0]);return Math.abs(le)<=S?0:Math.sign(le)}function H($,j,V){return $[0]>=Math.min(j[0],V[0])-S&&$[0]<=Math.max(j[0],V[0])+S&&$[1]>=Math.min(j[1],V[1])-S&&$[1]<=Math.max(j[1],V[1])+S}function P($,j){const[V,le]=$,[Se,ve]=j,Me=Y(V,le,Se),Le=Y(V,le,ve),Be=Y(Se,ve,V),We=Y(Se,ve,le);return Me!==Le&&Be!==We?!0:Me===0&&H(Se,V,le)||Le===0&&H(ve,V,le)||Be===0&&H(V,Se,ve)||We===0&&H(le,Se,ve)}function Z($,j){return $[0]<=j[2]&&j[0]<=$[2]&&$[1]<=j[3]&&j[1]<=$[3]}function pe($,j){const V=I($),le=I(j);if(!Z(V.bbox,le.bbox))return!1;const Se=C($),ve=C(j);for(const Me of ve.polygons)for(const Le of Se.points)if(u(Le,Me))return!0;for(const Me of Se.polygons)for(const Le of ve.points)if(u(Le,Me))return!0;for(const Me of Se.segments)for(const Le of ve.segments)if(P(Me,Le))return!0;for(const Me of Se.points){for(const Le of ve.points)if(Math.abs(Me[0]-Le[0])<=S&&Math.abs(Me[1]-Le[1])<=S)return!0;for(const Le of ve.segments)if(Y(Le[0],Le[1],Me)===0&&H(Me,Le[0],Le[1]))return!0}for(const Me of ve.points)for(const Le of Se.segments)if(Y(Le[0],Le[1],Me)===0&&H(Me,Le[0],Le[1]))return!0;return!1}function $e($,j){const{operand:V,reason:le}=e($,j);if(le)return ye(`filter:geometry:${$}`,`a "${$}" condition was refused: ${le}. It matches no row rather than guessing.`),()=>!1;switch($){case"withinBbox":return Se=>{const ve=I(Se);if(!ve)return!1;const Me=ve.bbox;return Me[0]>=V[0]&&Me[1]>=V[1]&&Me[2]<=V[2]&&Me[3]<=V[3]};case"withinPolygon":{const Se=V.type==="Polygon"?[V.coordinates]:V.coordinates,ve=Me=>Se.some(Le=>u(Me,Le));return Me=>{const Le=oe(Me);return Le?Le.type==="Point"?ve(Le.coordinates):Le.type==="MultiPoint"?Le.coordinates.every(ve):ve(I(Le).centroid):!1}}case"intersects":return Se=>{const ve=oe(Se);return!!ve&&pe(ve,V)};default:{const Se=[V.lon,V.lat];return ve=>{const Me=I(ve);return!!Me&&N(Me.centroid,Se)<=V.metres}}}}}),Xe("packages/core/src/source/filterwire.js",function(r,me){"use strict";Object.defineProperty(r,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(r,"warnWherePageRelative",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return he}}),Object.defineProperty(r,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return _}}),Object.defineProperty(r,"warnWhereNotApplied",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"warnWhereOverThreshold",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(r,"parseRelativeToken",{enumerable:!0,get:function(){return a}}),Object.defineProperty(r,"resolveRelativeRange",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"relativeTokenOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(r,"relativeTokenHelp",{enumerable:!0,get:function(){return o}}),Object.defineProperty(r,"isResolvableRelative",{enumerable:!0,get:function(){return O}}),Object.defineProperty(r,"resolveRelativeCondition",{enumerable:!0,get:function(){return n}}),Object.defineProperty(r,"isGroup",{enumerable:!0,get:function(){return x}}),Object.defineProperty(r,"forEachCondition",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"mapConditions",{enumerable:!0,get:function(){return B}}),Object.defineProperty(r,"normaliseFilterSet",{enumerable:!0,get:function(){return J}}),Object.defineProperty(r,"buildFilterSet",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(r,"wireFilters",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(r,"querySignature",{enumerable:!0,get:function(){return fe}});const X=me("packages/core/src/internal/util.js").warnOnce,s="source.remote.hostFilter",ye="source.where.pageRelative";function se(A,ae){!Array.isArray(A)||!A.length||X(ye,`filters.where (${A.join(", ")}) runs over the rows the ${ae} 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 he(A){const ae=(A||{}).config;!ae||!ae.hostFilter||X(s,"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 _="source.where.notApplied";function G(A,ae){X(`${_}:${A}`,`filters.where("${A}") is registered but the ${ae} 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 ie="source.where.overThreshold";function W(A,ae,d,t){!Array.isArray(A)||!A.length||X(`${ie}:${ae}`,`filters.where (${A.join(", ")}) is not applied to the ${ae} pushdown source:`,d===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${d.toLocaleString()} rows, at or past the whereRowLimit of ${t.toLocaleString()}.`,"Running the predicate needs every matching row fetched and held here, which is the whole","download a pushdown source exists to avoid, so it is refused and the rows the predicate","would exclude stay on screen.","Give the predicate a { condition } twin so the engine narrows the fetch itself — that is the","route that works at any size — or raise `whereRowLimit` on the source config if you want the","download.")}const S=new Map;function T(A){let ae=S.get(A);return ae||(ae=new Intl.DateTimeFormat("en-US",{timeZone:A,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),S.set(A,ae)),ae}function p(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function R(A,ae){const d=T(ae).formatToParts(new Date(A)),t={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const k of d)k.type==="year"?t.y=+k.value:k.type==="month"?t.m=+k.value:k.type==="day"?t.d=+k.value:k.type==="hour"?t.h=+k.value%24:k.type==="minute"?t.mi=+k.value:k.type==="second"&&(t.s=+k.value);return t}function M(A,ae){const d=R(A,ae);return Date.UTC(d.y,d.m-1,d.d,d.h,d.mi,d.s)-Math.floor(A/1e3)*1e3}function c(A,ae,d,t){const k=Date.UTC(A,ae-1,d),v=k-M(k,t);return k-M(v,t)}function l(A,ae,d){const t=new Date(Date.UTC(A.y,A.m-1,A.d+ae));return c(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate(),d)}const i=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function a(A,ae){if(typeof A!="string")return null;const d=A.trim().toLowerCase().replace(/[\s_-]+/g,""),t=/^last(\d*|n)days?$/.exec(d);if(t){const k=t[1]==="n"?"":t[1],v=Number(k||ae);return!Number.isFinite(v)||v<=0?null:{kind:"lastNDays",n:Math.floor(v)}}switch(d){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 w(A,ae={}){const d=a(A,ae.n);if(!d)return null;const t=ae.tz||p(),k=ae.now instanceof Date?ae.now.getTime():typeof ae.now=="number"?ae.now:Date.now(),v=R(k,t),F=c(v.y,v.m,v.d,t),E=l(v,1,t);let oe=F,te=E;switch(d.kind){case"today":break;case"yesterday":oe=l(v,-1,t),te=F;break;case"lastNDays":te=ae.includeToday?E:F,oe=l(v,ae.includeToday?-(d.n-1):-d.n,t);break;case"thisWeek":{const N=Number.isFinite(ae.weekStartsOn)?Number(ae.weekStartsOn):1,ne=(new Date(Date.UTC(v.y,v.m-1,v.d)).getUTCDay()-N+7)%7;oe=l(v,-ne,t),te=l(v,-ne+7,t);break}case"thisMonth":oe=c(v.y,v.m,1,t),te=c(v.m===12?v.y+1:v.y,v.m===12?1:v.m+1,1,t);break;case"thisQuarter":case"quarterToDate":{const N=Math.floor((v.m-1)/3)*3+1;oe=c(v.y,N,1,t),te=d.kind==="quarterToDate"?E:N===10?c(v.y+1,1,1,t):c(v.y,N+3,1,t);break}case"thisYear":case"yearToDate":oe=c(v.y,1,1,t),te=d.kind==="yearToDate"?E:c(v.y+1,1,1,t);break;default:return null}return{from:new Date(oe).toISOString(),to:new Date(te).toISOString(),bounds:"[)",tz:t,relative:d.kind==="lastNDays"?`last${d.n}Days`:d.kind,n:d.n}}function b(A){if(!A||typeof A!="object")return null;const ae=A.value;if(ae&&typeof ae=="object"&&!Array.isArray(ae)&&"relative"in ae)return{token:String(ae.relative),n:typeof ae.n=="number"?ae.n:void 0};if(A.op==="relative"&&typeof A.value=="string")return{token:A.value,n:void 0};const d=A.meta;return d&&typeof d.relative=="string"&&A.value===void 0?{token:d.relative,n:typeof d.n=="number"?d.n:void 0}:null}function o(){return`Known tokens: ${i.filter(ae=>ae!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function O(A){const ae=b(A);return ae?a(ae.token,ae.n)!==null:!1}function n(A,ae={}){const d=b(A);if(!d)return A;const t=w(d.token,{...ae,n:d.n});return t?{...A,type:A.type||"date",op:"between",value:[t.from,t.to],bounds:A.bounds||t.bounds,meta:{...A.meta||{},relative:t.relative,tz:t.tz}}:(X(`source.relative.${d.token}`,`unknown relative date token "${d.token}"; sending the condition unresolved.`,o()),A)}function x(A){return!!A&&typeof A=="object"&&Array.isArray(A.conditions)}function D(A,ae){if(A){if(x(A)){for(const d of A.conditions)D(d,ae);return}ae(A)}}function B(A,ae){if(!A)return null;if(!x(A))return ae(A);const d=A;let t=!1;const k=[];for(const v of d.conditions){const F=B(v,ae);F!==v&&(t=!0),F&&k.push(F)}return!t&&k.length===d.conditions.length?A:k.length?{...d,conditions:k}:null}function q(A){if(!A)return null;if(!x(A))return A;const ae=A,d=[];for(const t of ae.conditions){const k=q(t);k&&d.push(k)}return d.length?{op:ae.op,conditions:d}:null}function J(A){const ae=q(A);return ae?x(ae)&&ae.op==="and"?ae:{op:"and",conditions:[ae]}:null}function ee(A){const ae=(A||[]).filter(Boolean);return ae.length?{op:"and",conditions:ae}:null}function ue(A,ae={}){const d=B(A,t=>n(t,ae));return J(d)}function fe(A){const ae=de(A.filters??null);return JSON.stringify([ae,A.sort??null,A.quick??"",A.groupBy??null,A.pivotBy??null,U(A.context)])}function de(A){if(!A)return null;if(x(A)){const t=A;return{op:t.op,conditions:t.conditions.map(de)}}const ae=A,d=ae.meta&&typeof ae.meta.relative=="string"?ae.meta.relative:b(ae)?.token;return{col:ae.col,op:ae.op,bounds:ae.bounds??null,caseSensitive:ae.caseSensitive??!1,value:d?`rel:${d}`:ae.value??null}}function U(A){if(A==null)return null;try{return JSON.parse(JSON.stringify(A))}catch{return X("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),Xe("packages/core/src/source/aggregates.js",function(r,me){"use strict";Object.defineProperty(r,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"pushableAggregates",{enumerable:!0,get:function(){return X}}),Object.defineProperty(r,"fillAggregateSql",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"resolveAggregatesConfig",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(r,"routeAggregate",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"resolveAggregatePlan",{enumerable:!0,get:function(){return he}}),Object.defineProperty(r,"groupKeysPushable",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"pushdownDocRows",{enumerable:!0,get:function(){return ie}});const we=Object.freeze({sum:{pushable:!0,class:"identical",sql:"sum(%c)"},avg:{pushable:!0,class:"identical",sql:"avg(%c)"},min:{pushable:!0,class:"identical",sql:"min(%c)"},max:{pushable:!0,class:"identical",sql:"max(%c)"},count:{pushable:!0,class:"identical",sql:"count(*)"},countValues:{pushable:!0,class:"identical",sql:"count(%c)",blankAware:!0},range:{pushable:!0,class:"identical",sql:"(max(%c) - min(%c))"},variance:{pushable:!0,class:"identical",sql:"var_samp(%c)"},varianceP:{pushable:!0,class:"identical",sql:"var_pop(%c)"},stddev:{pushable:!0,class:"identical",sql:"stddev_samp(%c)"},stddevP:{pushable:!0,class:"identical",sql:"stddev_pop(%c)"},sumSquares:{pushable:!0,class:"identical",sql:"sum(%c * %c)"},median:{pushable:!0,class:"identical",sql:"median(%c)"},p25:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.25)"},p75:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.75)"},p90:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.9)"},p95:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.95)"},p99:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.99)"},iqr:{pushable:!0,class:"identical",sql:"(quantile_cont(%c, 0.75) - quantile_cont(%c, 0.25))"},mad:{pushable:!0,class:"identical",sql:"mad(%c)"},distinct:{pushable:!0,class:"identical",sql:"count(DISTINCT %c)",blankAware:!0},skewness:{pushable:!0,class:"identical",sql:"skewness(%c)"},kurtosis:{pushable:!0,class:"identical",sql:"kurtosis(%c)"},geomean:{pushable:!0,class:"identical",sql:"exp(avg(ln(%c)))"},harmean:{pushable:!0,class:"identical",sql:"(count(%c) / sum(1.0 / %c))"},entropy:{pushable:!0,class:"identical",sql:"entropy(%c)",blankAware:!0},correlation:{pushable:!0,class:"identical",sql:"corr(%w, %c)",twoColumn:!0},hhi:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_transform(map_values(histogram(%c)), lambda v: (v::DOUBLE/count(%c))*(v::DOUBLE/count(%c)))) END"},evenness:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL WHEN count(DISTINCT %c)<2 THEN 1.0 ELSE entropy(%c)/log2(count(DISTINCT %c)) END"},top3Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,3))::DOUBLE/count(%c) END"},top10Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,10))::DOUBLE/count(%c) END"},gini:{pushable:!0,class:"identical",sql:"CASE WHEN list_min(list(%c) FILTER (WHERE isfinite(%c)))<0 THEN NULL WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL WHEN list_sum(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN 0 ELSE 2.0*list_sum(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v, i: i*v))/(len(list(%c) FILTER (WHERE isfinite(%c)))*list_sum(list(%c) FILTER (WHERE isfinite(%c))))-(len(list(%c) FILTER (WHERE isfinite(%c)))+1.0)/len(list(%c) FILTER (WHERE isfinite(%c))) END"},trimmedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_slice(list_sort(list(%c) FILTER (WHERE isfinite(%c))), floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1, len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT)) END"},winsorizedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v: least(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT], greatest(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1], v)))) END"},robustOutliers:{pushable:!0,class:"identical",sql:"(SELECT CASE WHEN len(d.a)=0 THEN NULL WHEN d.mad=0 THEN NULL ELSE len(list_filter(d.a, lambda v: abs(0.6745*(v-d.med)/d.mad)>3.5)) END FROM (SELECT xs AS a, list_median(xs) AS med, list_median(list_transform(xs, lambda w: abs(w-list_median(xs)))) AS mad FROM (SELECT list(%c) FILTER (WHERE isfinite(%c)) AS xs)) d)"},jarqueBera:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))<8 THEN NULL WHEN list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2)))=0 THEN NULL ELSE (len(list(%c) FILTER (WHERE isfinite(%c)))/6.0)*(power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),3)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),1.5),2)+power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),4)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),2)-3,2)/4.0) END"},weightedAvg:{pushable:!0,class:"identical",twoColumn:!0,sql:"sum(%c*%w) FILTER (WHERE isfinite(%c) AND isfinite(%w))/nullif(sum(%w) FILTER (WHERE isfinite(%c) AND isfinite(%w)),0)"},mode:{pushable:!0,class:"may-differ",sql:"mode(%c)",note:"DuckDB returns a modal value even for an all-distinct column; the grid returns null. Tie-breaking can also differ, and on a text column an empty string counts as a value. Under pushdown you will see a value."},weightedQuantile:{pushable:!1,class:"fallback",note:"No SQL equivalent for the grid's weighted-quantile midpoint convention; always computed client-side (needs a full-dataset pull for a correct figure over a remote source)."}});function X(){const W=new Set;for(const[S,T]of Object.entries(we))T.pushable&&W.add(S);return W}function s(W,S,T){let p=W.split("%c").join(S);return T!==void 0&&(p=p.split("%w").join(T)),p}function ye(W){const S=W||{},T=S.default==="engine"||S.default==="engine-if-identical"?S.default:"client",p={};if(S.overrides&&typeof S.overrides=="object")for(const[R,M]of Object.entries(S.overrides))(M==="engine"||M==="client")&&(p[R]=M);return{default:T,overrides:p}}function se(W,S){const T=we[W];if(!T||!T.pushable)return"client";const p=S.overrides[W];return p==="engine"||p==="client"?p:S.default==="client"?"client":S.default==="engine-if-identical"?T.class==="identical"?"engine":"client":"engine"}function he(W,S){const T=ye(S),p=[],R=[];for(const M of W||[]){const c=we[M.fn],l=se(M.fn,T),i={id:M.id,col:M.col,fn:M.fn,class:c?c.class:"fallback"};M.weight!==void 0&&(i.weight=M.weight),M.params!==void 0&&(i.params=M.params),l==="engine"?p.push(i):(i.reason=c&&!c.pushable?c.note||"the engine cannot express this stat":"client by config",R.push(i))}return{engine:p,client:R,config:T}}const _=/^[A-Za-z_][A-Za-z0-9_$]*$/;function G(W,S=[]){return(W||[]).every(p=>{if(typeof p=="string")return _.test(p);if(!p||typeof p!="object")return!1;const R=p;return Array.isArray(S)&&S.includes(R.bucket)&&typeof R.col=="string"&&_.test(R.col)&&typeof R.size=="number"&&Number.isFinite(R.size)&&R.size>0})}function ie(){return Object.entries(we).map(([W,S])=>({stat:W,class:S.class,sql:S.sql?s(S.sql,"col",S.twoColumn?"weight":void 0):"",note:S.note||(S.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),Xe("packages/core/src/source/abort.js",function(r,me){"use strict";Object.defineProperty(r,"SupersededError",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"RequestToken",{enumerable:!0,get:function(){return X}}),Object.defineProperty(r,"AbortScope",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"createAbortScope",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(r,"isAbortError",{enumerable:!0,get:function(){return se}});class we extends Error{constructor(_,G="superseded"){super(`[lattice] request ${_?`"${_}" `:""}${G}`),this.name="SupersededError",this.superseded=!0,this.key=_}}class X{#e;constructor(_,G,ie,W){this.#e=_,this.key=G,this.controller=ie,this.signal=ie.signal,this.seq=W}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(_){this.signal.aborted||this.controller.abort(new we(this.key,_)),this.#e.settle(this)}}class s{#e=new Map;#t=0;begin(_="",G="superseded"){const ie=this.#e.get(_);ie&&!ie.signal.aborted&&ie.controller.abort(new we(_,G));const W=new X(this,_,new AbortController,++this.#t);return this.#e.set(_,W),W}tokenFor(_){return this.#e.get(_)}pending(_=""){const G=this.#e.get(_);return!!G&&!G.signal.aborted}get size(){return this.#e.size}settle(_){this.#e.get(_.key)===_&&this.#e.delete(_.key)}abort(_="",G="superseded"){const ie=this.#e.get(_);ie&&ie.abort(G)}abortAll(_="superseded"){for(const G of[...this.#e.values()])G.abort(_);this.#e.clear()}}function ye(){return new s}function se(he){if(!he||typeof he!="object")return!1;const _=he;return _.superseded===!0||_.name==="AbortError"||_.name==="SupersededError"}}),Xe("packages/core/src/source/pushdown.js",function(r,me){"use strict";Object.defineProperty(r,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(r,"NO_CAPABILITIES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(r,"resolveMutate",{enumerable:!0,get:function(){return a}}),Object.defineProperty(r,"capabilitiesOf",{enumerable:!0,get:function(){return o}}),Object.defineProperty(r,"splitFilters",{enumerable:!0,get:function(){return n}}),Object.defineProperty(r,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return x}}),Object.defineProperty(r,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return J}}),Object.defineProperty(r,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(r,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(r,"planQuery",{enumerable:!0,get:function(){return de}}),Object.defineProperty(r,"applyResidual",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(r,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return v}}),Object.defineProperty(r,"createPushdownSource",{enumerable:!0,get:function(){return te}});const we=me("packages/core/src/internal/util.js"),X=we.defaultCompare,s=we.isFunction,ye=we.toArray,se=we.warnOnce,he=me("packages/core/src/source/filterwire.js"),_=he.isGroup,G=he.warnWherePageRelative,ie=he.warnWhereOverThreshold,W=me("packages/core/src/source/aggregates.js"),S=W.resolveAggregatePlan,T=W.groupKeysPushable,p=W.STAT_PUSHDOWN,M=me("packages/core/src/source/abort.js").SupersededError,c=1e3;function l(N){const K=N&&N.signal;if(!K||!K.aborted)return;const ne=K.reason;throw ne instanceof Error?ne:new M("","superseded before it was sent")}const i=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function a(N){if(!N||typeof N!="object")return!1;const K=N.returning==="row"||N.returning==="key"?N.returning:"none";return{append:N.append===!0,update:N.update===!0,delete:N.delete===!0,returning:K}}function w(N,K){if(!N||typeof K!="string")return;if(!K.includes("."))return N[K];let ne=N;for(const ge of K.split(".")){if(ne===null||typeof ne!="object")return;ne=ne[ge]}return ne}function b(N){if(N===!0)return!0;if(!N||typeof N!="object")return!1;const K=N;return K.enabled===!1?!1:K.enabled===!0||s(K.commit)}function o(N){const K={...i,...N||{}};return K.operators=new Set(K.operators||[]),K.mutate=a(K.mutate),K}function O(N,K){return!N||!N.op||!K.operators.size?!1:K.operators.has(N.op)}function n(N,K){if(!N)return{pushed:null,residual:null};if(!K.filter)return{pushed:null,residual:N};if(K.filter==="term"){if(_(N)){const L=N.conditions||[];if(String(N.op)!=="and")return{pushed:null,residual:N};const Q=L.findIndex(h=>!_(h)&&O(h,K));if(Q<0)return{pushed:null,residual:N};const g=L.filter((h,I)=>I!==Q);return{pushed:L[Q],residual:g.length?{op:"and",conditions:g}:null}}return O(N,K)?{pushed:N,residual:null}:{pushed:null,residual:N}}if(!_(N))return O(N,K)?{pushed:N,residual:null}:{pushed:null,residual:N};if(String(N.op)!=="and")return(N.conditions||[]).every(Q=>_(Q)?n(Q,K).residual===null:O(Q,K))?{pushed:N,residual:null}:{pushed:null,residual:N};const ne=[],ge=[];for(const L of N.conditions||[]){if(_(L)){if(K.filter==="flat"){ge.push(L);continue}const Q=n(L,K);Q.pushed&&ne.push(Q.pushed),Q.residual&&ge.push(Q.residual);continue}(O(L,K)?ne:ge).push(L)}const re=L=>L.length===0?null:L.length===1?L[0]:{op:"and",conditions:L};return{pushed:re(ne),residual:re(ge)}}const x="__lattice_leaves";function D(N){return N.aggregates?N.aggregates instanceof Set?N.aggregates:new Set(ye(N.aggregates)):new Set}function B(N){const K=D(N);return K.size?K.has("count")?N.filter!=="tree"||!N.operators||!N.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 q(N,K,ne,ge,re,L,Q){const g=Array.isArray(N.groupBy)?N.groupBy:[],h=Array.isArray(N.groupPath)?N.groupPath:[],I=Array.isArray(N.groupValues)?N.groupValues:null;if(!K.group){const f=B(K);if(f)return f}return T(g)?ne.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":ge?re?L?"a host `where` predicate can only run in the browser, over rows the engine grouped":Q?"fullDataset holds the whole matching set, so the grid groups it itself":!I||I.length!==h.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 J="pushdown:pivot-unsupported",ee="pushdown:group-unsupported",ue=Symbol("lattice.remote.ungroupedLevel");function fe(N,K,ne,ge,re,L){const Q=Array.isArray(N.pivotBy)?N.pivotBy:[],g=Array.isArray(N.groupBy)?N.groupBy:[],h=Array.isArray(N.groupPath)?N.groupPath:[],I=Array.isArray(N.groupValues)?N.groupValues:null;return K.pivot?T(Q)?g.length&&!T(g)?"a grouping key is not a plain column the engine can name in a GROUP BY":ne.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":ge?re?L?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!I||I.length!==h.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 de(N,K,ne=!1){const ge=n(N.filters||null,K),re=[];ge.residual&&re.push("filter");const L=N.sort||[],Q=L.length===0||K.sort==="multi"&&L.length>=1||K.sort==="single"&&L.length===1;!Q&&L.length&&re.push("sort");const g=N.quick?String(N.quick):"",h=!g||!!K.quick;h||re.push("quick");const I=N.where&&N.where.active?N.where:null;I&&re.push("where");const f={filters:ge.residual,sort:Q?null:L,quick:h?"":g,where:I},z=!!ne,e=Array.isArray(N.groupBy)&&N.groupBy.length>0,y=e?q(N,K,ge,Q,h,I,z):"",u=N.pivotMode!==!1&&Array.isArray(N.pivotBy)&&N.pivotBy.length>0,C=u?fe(N,K,ge,Q,h,I):"",Y=u&&C==="";u&&!Y&&re.push("pivot");const H=u?Y&&e:e&&y==="";e&&!u&&!H&&re.push("group");const P=(H||Y)&&Array.isArray(N.groupValues)?N.groupValues.length:0,Z=H||u?!1:z||!!(f.filters||f.sort||f.quick||f.where)||!K.range;return{pushed:{...N,filters:ge.pushed,sort:Q?L:[],quick:h?g:"",range:Z?null:N.range},residual:f,needsAll:Z,unpushed:re,full:z,grouped:H,groupLevel:P,groupReason:u?"":y,pivoted:Y,pivotReason:C}}function U(N){const K=Array.isArray(N.totals)?N.totals:[],ne=N.totalFns&&typeof N.totalFns=="object"?N.totalFns:{},ge=[],re=[];for(const L of K){const Q=String(L),g=typeof ne[Q]=="string"?ne[Q]:null,h=g?p[g]:null;g?!h||!h.pushable||!h.sql?re.push({id:Q,fn:g,class:h?h.class:"fallback",reason:h&&h.note?h.note:`the pushdown map cannot express "${g}"`}):h.twoColumn?re.push({id:Q,fn:g,class:h.class,reason:`"${g}" reduces two columns, and a grouped request carries no weight column`}):ge.push({id:Q,col:Q,fn:g,class:h.class}):re.push({id:Q,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:ge,client:re}}const A=Object.freeze({items:N=>N==null?[]:Array.isArray(N)?N:[N]});function ae(N,K,ne){if(!K)return N;let ge=N;if(K.filters&&s(ne.evaluateFilters)){const re=ge,L={count:ge.length,handle:h=>({id:h,get:I=>w(re[I],h)}),itemwise:h=>re.some(I=>Array.isArray(w(I,h)))?A:null},Q=ne.evaluateFilters(K.filters,L),g=[];for(let h=0;h<ge.length;h++)Q[h]&&g.push(ge[h]);ge=g}if(K.where&&K.where.active&&(K.whole||G(K.where.names,"pushdown"),ge=ge.filter(re=>K.where.passes(re))),K.quick){const re=K.quick.toLowerCase();ge=ge.filter(L=>{if(!L||typeof L!="object")return!1;for(const Q of Object.values(L))if(Q!=null&&String(Q).toLowerCase().includes(re))return!0;return!1})}if(K.sort&&K.sort.length&&s(ne.sortMulti)){const re=[...new Set(K.sort.map(h=>h.col))],L=ge,Q=re.map(h=>({id:h,get:I=>w(L[I],h)})),g=ne.sortMulti(Q,K.sort.map(h=>({col:h.col,dir:h.dir})),Uint32Array.from({length:ge.length},(h,I)=>I),{});ge=Array.from(g,h=>L[h])}return ge}function d(N){return JSON.stringify({filters:N.filters||null,sort:N.sort||[],quick:N.quick||"",groupBy:N.groupBy||[],groupPath:N.groupPath||[],context:N.context??null})}function t(N){if(!N||typeof N!="object")return 16;let K="";try{K=JSON.stringify(N)}catch{return 200}return K.length*2+64}function k(N){const K=N||{};return{enabled:!!K.enabled,maxRows:Number.isFinite(K.maxRows)?K.maxRows:1e6,maxBytesEstimate:Number.isFinite(K.maxBytesEstimate)?K.maxBytesEstimate:512*1024*1024}}const v=5e4;function F(N){return Number.isFinite(N)&&N>=0?N:v}function E(N){return!!N&&s(N.then)}async function oe(N){if(!N||N.total!==void 0||!E(N.pendingTotal))return N;const K=await N.pendingTotal,{pendingTotal:ne,...ge}=N;return typeof K=="number"?{...ge,total:K}:ge}function te(N={}){const K=N.adapter;if(!K||!s(K.execute))return se("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...N,mode:"remote",fetch:async()=>({rows:[],total:0})};const ne=o(K.capabilities),ge=K.capabilities&&Object.getOwnPropertyDescriptor(K.capabilities,"operators");ge&&s(ge.get)&&Object.defineProperty(ne,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(K.capabilities.operators||[]),set:()=>{}});const re=K.name||"adapter";let L=null;const Q=()=>s(K.ready)?(L||(L=Promise.resolve(K.ready()).then(()=>{Object.assign(ne,o(K.capabilities))},Ie=>{throw L=null,Ie})),L):null,g=k(N.fullDataset),h=!!N.allowPartialResults,I=F(N.whereRowLimit);let f=null;const z=N.aggregates;let e=null,y=null,u=null,C=null,Y=null,H,P=null,Z=0,pe=null;const $e=()=>!g.enabled||!e?null:(pe!==e.key&&(Z++,pe=e.key),{rows:e.rows,version:Z}),$=async Ie=>{const Te=Ie.where&&Ie.where.active?Ie.where:null;if(!Te)return{request:Ie,probe:null};const{where:qe,...He}=Ie,Re=de(He,ne,g.enabled);if(Re.needsAll)return{request:Ie,probe:null};const et=d(Re.pushed);let tt=null;return(!f||f.key!==et)&&(ne.total?(l(Ie),tt=await oe(await K.execute(Re.pushed,Ie)),f={key:et,size:tt&&typeof tt.total=="number"?tt.total:null}):f={key:et,size:null}),f.size!==null&&f.size<I?{request:Ie,probe:null}:(ie(Te.names,re,f.size,I),{request:He,probe:tt})},j=async(Ie,Te)=>{P=null;const qe=U(Ie.pushed);u={engine:qe.engine,client:qe.client,groupBy:Ie.pushed.groupBy},qe.client.length&&se(`source.pushdown.group.totals.${re}.${qe.client.map(et=>et.id).join(".")}`,`the ${re} adapter cannot compute the group subtotal for ${qe.client.map(et=>`"${et.id}" (${et.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 He=await K.executeGroupLevel(Ie.pushed,qe.engine,Te)||{};let Re=He.rows||[];return!ne.range&&Te.range&&(Re=Re.slice(Te.range.start,Te.range.end)),ve(He),He.total===void 0?{rows:Re}:{rows:Re,total:He.total}},V=new Map,le=64,Se=async(Ie,Te)=>{P=null;const qe=Ie.pushed,He=qe.groupBy,Re=Array.isArray(qe.groupValues)?qe.groupValues:[],et=Re.length,tt=[...qe.filters?[qe.filters]:[],...He.slice(0,et).map((Pe,Ge)=>({col:Pe,op:"eq",value:Re[Ge]===void 0?null:Re[Ge],caseSensitive:!0}))],at=tt.length===0?null:tt.length===1?tt[0]:{op:"and",conditions:tt},ct=Te.range?Te.range.start:0;if(et>=He.length){const Pe={...qe,filters:at,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},Ge=await oe(await K.execute(Pe,Te))||{};let Ce=Ge.rows||[];return!ne.range&&Te.range&&(Ce=Ce.slice(Te.range.start,Te.range.end)),typeof Ge.total=="number"?{rows:Ce,total:Ge.total}:{rows:Ce}}const st=He[et],wt=U(qe),pt=D(ne),kt=wt.engine.filter(Pe=>pt.has(Pe.fn)),Nt=[...wt.engine.filter(Pe=>!pt.has(Pe.fn)).map(Pe=>({id:Pe.id,fn:Pe.fn,class:Pe.class,reason:`the ${re} adapter does not compute "${Pe.fn}"`})),...wt.client];u={engine:kt,client:Nt,groupBy:He},Nt.length&&se(`source.pushdown.group.totals.${re}.${Nt.map(Pe=>Pe.id).join(".")}`,`the ${re} adapter cannot compute the group subtotal for ${Nt.map(Pe=>`"${Pe.id}" (${Pe.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 lt=[...kt.map(Pe=>({id:Pe.id,col:Pe.col,fn:Pe.fn})),{id:x,col:st,fn:"count"}],ht={...qe,filters:at,range:null},Tt=JSON.stringify([d(ht),Re,st,lt]);let Lt=ct>0?V.get(Tt):void 0;if(!Lt){for(Lt=Promise.resolve(K.executeGroupedAggregates(ht,[st],lt)),V.delete(Tt),V.set(Tt,Lt);V.size>le;)V.delete(V.keys().next().value);Lt.catch(()=>{V.get(Tt)===Lt&&V.delete(Tt)})}const Wt=await Lt||[];l(Te);const Gt=Pe=>{const Ge={};for(const Ce of kt)Ge[Ce.id]=Pe?Pe[Ce.id]:void 0;return Ge},Qt=(qe.sort||[]).find(Pe=>Pe&&Pe.col===st),en=Qt&&Qt.dir==="desc"?-1:1,Ut=Wt.filter(Pe=>Pe&&Pe.level===1).map(Pe=>({[st]:Pe.keys[0]===void 0?null:Pe.keys[0],leafCount:Number(Pe.values&&Pe.values[x])||0,totals:Gt(Pe.values)})).sort((Pe,Ge)=>en*X(Pe[st],Ge[st]));if(et===0){const Pe=Wt.find(Ce=>Ce&&Ce.level===0),Ge=Pe?Number(Pe.values&&Pe.values[x]):NaN;ve({matchCount:Number.isFinite(Ge)?Ge:Ut.reduce((Ce,Je)=>Ce+Je.leafCount,0),...Pe?{grand:Gt(Pe.values)}:{}})}const Ne=Te.range?Te.range.end:Ut.length;return{rows:Ut.slice(ct,Ne),total:Ut.length}},ve=Ie=>{typeof Ie.matchCount=="number"&&(C=Ie.matchCount,Y=Ie.grand?{totals:Ie.grand,leafCount:Ie.matchCount}:null,H===void 0&&s(K.unfilteredCount)&&(H=null,Promise.resolve(K.unfilteredCount()).then(Te=>{H=typeof Te=="number"?Te:null}).catch(Te=>{se(`source.pushdown.group.unfiltered.${re}`,`the ${re} adapter could not count the unfiltered set (${Te&&Te.message?Te.message:Te}), so "N of M" falls back to the display count for its denominator.`)})))},Me=async(Ie,Te)=>{P=null;const qe=U(Ie.pushed);u={engine:qe.engine,client:qe.client,groupBy:Ie.pushed.groupBy,pivotBy:Ie.pushed.pivotBy},qe.client.length&&se(`source.pushdown.pivot.totals.${re}.${qe.client.map(at=>at.id).join(".")}`,`the ${re} adapter cannot compute the pivot cells for ${qe.client.map(at=>`"${at.id}" (${at.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 He=await K.executePivotLevel(Ie.pushed,qe.engine,Te)||{};let Re=He.rows||[];!ne.range&&Te.range&&(Re=Re.slice(Te.range.start,Te.range.end)),ve(He);const et=He.pivot&&typeof He.pivot=="object"?He.pivot:{},tt={cells:Array.isArray(et.cells)?et.cells:[],...Array.isArray(et.axis)?{axis:et.axis}:{}};return He.total===void 0?{rows:Re,pivot:tt}:{rows:Re,total:He.total,pivot:tt}},Le=Ie=>{se(`source.pushdown.pivot.${re}.${Ie}`,`pushdown:pivot-unsupported: the ${re} adapter cannot pivot this query because ${Ie}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const Te=new Error(`[lattice] ${J}: the ${re} adapter cannot pivot this query because ${Ie}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw Te.code=J,Te.reason=Ie,Te},Be=(Ie,Te)=>{const qe={key:Te,state:"pending",value:null};return P=qe,Ie.then(He=>(P===qe&&(P={key:Te,state:"settled",value:typeof He=="number"?He:null}),He),He=>{throw P===qe&&(P={key:Te,state:"failed",value:null}),He})};let We=0,ze=[];const Ke=()=>We===0?null:new Promise(Ie=>{const Te=setTimeout(Ie,c);ze.push(()=>{clearTimeout(Te),Ie()})});let Ue;const vt=async Ie=>{const Te=Q();Te&&await Te;const He=Ie&&Ie.pivotMode!==!1&&Array.isArray(Ie.pivotBy)&&Ie.pivotBy.length>0?{request:Ie,probe:null}:await $(Ie);l(Ie);let Re=de(He.request,ne,g.enabled);if(ne.group&&Re.grouped&&!Re.pivoted&&!s(K.executeGroupLevel)&&(se(`source.pushdown.group.method.${re}`,`the ${re} adapter declares the \`group\` capability but has no \`executeGroupLevel(query, aggregates, request)\`, so grouping is not pushed and the grid stays ungrouped unless it holds the whole matching set. Implement the method or drop the capability.`),Re=de(He.request,{...ne,group:!1,aggregates:null},g.enabled)),Re.pivoted&&!s(K.executePivotLevel)&&(Re=de(He.request,{...ne,pivot:!1},g.enabled),Re.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Re.grouped&&!Re.pivoted&&!ne.group&&!s(K.executeGroupedAggregates)&&(se(`source.pushdown.group.aggregates.method.${re}`,`the ${re} adapter declares \`aggregates\` but has no \`executeGroupedAggregates(query, groupBy, aggregates)\`, so the grouped view cannot be built from grouped aggregates and the grid stays ungrouped unless it holds the whole matching set. Implement the method, or declare \`group\` and implement \`executeGroupLevel\`.`),Re=de(He.request,{...ne,aggregates:null},g.enabled)),y=Re,Re.pivoted)return Me(Re,Ie);if(Re.pivotReason&&Le(Re.pivotReason),Re.grouped)return ne.group?j(Re,Ie):Se(Re,Ie);const tt=!!Re.groupReason&&!Re.full;tt?se(`source.pushdown.group-unsupported.${re}.${Re.groupReason}`,`pushdown:group-unsupported: the ${re} adapter was not asked to group this query because ${Re.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.`):Re.groupReason&&se(`source.pushdown.group.${re}.${Re.groupReason}`,`the ${re} adapter was not asked to group this query because ${Re.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 at=lt=>tt?{...lt,[ue]:!0}:lt;if(!Re.needsAll){const lt=He.probe||await K.execute(Re.pushed,Ie),ht=lt.rows||[];return E(lt.pendingTotal)&<.total===void 0?at({rows:ht,pendingTotal:Be(lt.pendingTotal,d(Re.pushed))}):(P=null,!ne.total&<.total===void 0?at({rows:ht}):at({rows:ht,total:lt.total??ht.length}))}Re.unpushed.length&&se(`source.pushdown.residual.${re}.${Re.unpushed.join(".")}`,`the ${re} adapter cannot push ${Re.unpushed.join(" or ")}, so every matching row is fetched and the rest is applied in the browser. Correct, and slower than it needs to be: widening the adapter is the fix.`);const ct=d(Re.pushed);if(!e||e.key!==ct){const lt=await oe(await K.execute(Re.pushed,Ie));P=null;const ht=lt.rows||[];if(Re.full){const Tt=typeof lt.total=="number"?Math.max(lt.total,ht.length):ht.length;if(Tt>g.maxRows)throw new Error(`[lattice] fullDataset refused: the ${re} adapter's matching set is ${Tt.toLocaleString()} rows, past the configured maxRows of ${g.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 Lt=ht.length*t(ht[0]);if(Lt>g.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${re} adapter's matching set is an estimated ${Math.round(Lt/(1024*1024)).toLocaleString()} MB across ${ht.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(g.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 lt.total=="number"&&ht.length<lt.total){const Tt=!!(Re.residual.filters||Re.residual.quick||Re.residual.sort&&Re.residual.sort.length);if(Tt&&!h)throw new Error(`[lattice] the ${re} adapter returned ${ht.length} of ${lt.total} matching rows when asked for the whole result, and the query has residual ${Re.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.`);Tt?se(`source.pushdown.partial.residual.${re}`,`the ${re} adapter returned ${ht.length} of ${lt.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.`):se(`source.pushdown.partial.${re}`,`the ${re} adapter returned ${ht.length} of ${lt.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}e={key:ct,rows:ht,total:typeof lt.total=="number"?lt.total:null}}let st=Re;if(Re.residual.where){const lt=e.total??e.rows.length;if(lt>=I){ie(Re.residual.where.names,re,lt,I);const{where:ht,...Tt}=He.request;st=de(Tt,ne,g.enabled),y=st}}const wt=e.total!==null&&e.rows.length>=e.total,pt=ae(e.rows,{...st.residual,whole:wt},N.compute||{}),kt=Ie.range?Ie.range.start:0,Nt=Ie.range?Ie.range.end:pt.length;return at({rows:pt.slice(kt,Nt),total:pt.length})},At=async(Ie,Te,qe)=>{const Re=qe&&qe.waitForPage&&Ue&&s(Ue.pageForegroundIdle)?Ue.pageForegroundIdle():Ke();Re&&await Re;const et=Q();et&&await et;const tt=de(Ie,ne,g.enabled);y=tt;const at=S(Te,z),ct=Array.isArray(Ie.groupBy)?Ie.groupBy:[],st=ct.length>0,wt=!tt.residual.filters&&!tt.residual.quick,pt=!st||T(ct,ne.buckets);let kt=at.engine,Nt=at.client;if(ne.aggregates&&kt.length){const Lt=ne.aggregates instanceof Set?ne.aggregates:new Set(ye(ne.aggregates)),Wt=kt.filter(Gt=>!Lt.has(Gt.fn));Wt.length&&(kt=kt.filter(Gt=>Lt.has(Gt.fn)),Nt=[...Wt.map(Gt=>({...Gt,reason:`the ${re} adapter does not compute "${Gt.fn}"`})),...Nt])}const lt=Lt=>{Nt=[...kt.map(Wt=>({...Wt,reason:Lt})),...Nt],kt=[]};kt.length&&!wt?lt(tt.residual.quick&&!tt.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):kt.length&&!pt&<("a grouping key the engine cannot form forces all-client (no mixed provenance)");let ht={},Tt;return kt.length&&(s(st?K.executeGroupedAggregates:K.executeAggregates)?st?Tt=await K.executeGroupedAggregates(tt.pushed,ct,kt)||[]:ht=await K.executeAggregates(tt.pushed,kt)||{}:(se(`source.pushdown.aggregates.${re}${st?".grouped":""}`,`the ${re} adapter cannot compute ${st?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),lt(`adapter cannot compute ${st?"grouped ":""}aggregates`))),u={engine:kt,client:Nt,...st?{groupBy:ct}:{}},{values:ht,engine:kt,client:Nt,...Tt!==void 0?{groups:Tt}:{}}},Mt=async Ie=>{We++;try{return await vt(Ie)}finally{if(We--,We===0&&ze.length){const Te=ze;ze=[];for(const qe of Te)qe()}}},ut=b(N.edit),ft=N.edit&&typeof N.edit=="object"&&s(N.edit.commit);let zt=N.edit;if(ut&&!ft)if(ne.mutate&&ne.mutate.update){const Ie=Te=>{if(!ne.mutate||!ne.mutate.update)throw new Error(`[lattice] the ${re} adapter cannot update rows (mutate.update is not declared), so this edit cannot be persisted. The cell is reverted rather than left looking saved.`);const qe={kind:"update",key:String(Te.key),patch:{[Te.colId]:Te.value}};return K.mutate(qe,Te.request||{})};zt={...N.edit===!0?{}:N.edit,commit:Ie}}else se(`source.pushdown.readonly.${re}`,`edit is enabled but the ${re} adapter declares mutate: ${ne.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 Ft=ut&&ne.mutate&&(ne.mutate.append||ne.mutate.delete)?{append:ne.mutate.append===!0,remove:ne.mutate.delete===!0,returning:ne.mutate.returning,mutate:(Ie,Te)=>K.mutate(Ie,Te||{})}:null,yt=async Ie=>{const Te=Q();Te&&await Te;const{range:qe,signal:He,export:Re,...et}=Ie||{},tt={...et,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:de(tt,ne,g.enabled),signal:He}};async function*dt(Ie,Te={}){const{plan:qe,signal:He}=await yt(Ie),Re=Math.max(1,Math.floor(Number(Te.pageSize))||5e3),et={signal:He,stream:!0};if(!qe.needsAll)for(let ct=0;;ct+=Re){l(et);const st=await K.execute({...qe.pushed,range:{start:ct,end:ct+Re}},et);st&&E(st.pendingTotal)&&st.pendingTotal.then(null,()=>{});const wt=st&&st.rows||[];if(wt.length&&(yield wt),wt.length<Re)return}l(et);const tt=await oe(await K.execute({...qe.pushed,range:void 0},et)),at=ae(tt&&tt.rows||[],{...qe.residual,whole:!0},N.compute||{});for(let ct=0;ct<at.length;ct+=Re)yield at.slice(ct,ct+Re)}return Ue={...N,edit:zt,rowMutate:Ft,mode:"remote",fetch:Mt,foregroundIdle:Ke,aggregate:At,countMatching:async Ie=>{const{plan:Te,signal:qe}=await yt(Ie);if(!Te.needsAll&&ne.total){l({signal:qe});const Re=await oe(await K.execute({...Te.pushed,range:{start:0,end:0}},{signal:qe}));if(Re&&typeof Re.total=="number")return Re.total}let He=0;for await(const Re of dt(Ie))He+=Re.length;return He},streamMatching:dt,lastPlan:()=>y?{...y,...u?{aggregates:u}:{},...P?{total:{deferred:!0,state:P.state,value:P.value}}:{}}:null,fullFrame:$e,counts:()=>({match:C,total:H??null,pending:!!P&&P.state==="pending"}),grandTotals:()=>Y},Ue}}),Xe("packages/modules/shared/engine.js",function(r,me){"use strict";Object.defineProperty(r,"sourceId",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"engineSource",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"gridPivoted",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"loadedAndMatching",{enumerable:!0,get:function(){return S}}),Object.defineProperty(r,"gridHoldsWindow",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"gridEngineRequest",{enumerable:!0,get:function(){return R}}),Object.defineProperty(r,"EngineFlight",{enumerable:!0,get:function(){return M}});const we=me("packages/core/src/source/pushdown.js"),X=we.capabilitiesOf,s=we.planQuery,se=me("packages/core/src/source/filterwire.js").wireFilters,he=new WeakMap;let _=0;function G(c){let l=he.get(c);return l===void 0&&(l=++_,he.set(c,l)),l}function ie(c){const l=c&&typeof c.config=="function"?c.config():null,i=l&&l.source&&typeof l.source=="object"?l.source:null;if(!i||typeof i.aggregate!="function")return{reason:"the grid's source has no aggregate() — it is not a pushdown source"};const a=X(i.adapter&&i.adapter.capabilities);return{source:i,caps:a,config:l}}function W(c){const l=c&&typeof c.config=="function"?c.config():null,i=l&&l.source&&typeof l.source=="object"?l.source:null;if(!i||typeof i.lastPlan!="function")return!1;const a=c&&c.state&&typeof c.state.get=="function"?c.state.get():null,w=a&&a.pivot;return!!(w&&w.enabled&&Array.isArray(w.columns)&&w.columns.length>0)}function S(c){const l=c.rows&&typeof c.rows.residentCount=="function"?c.rows.residentCount():0,i=typeof c.rows.matchCount=="function"?c.rows.matchCount():NaN;return{loaded:l,total:Number.isFinite(i)?i:NaN}}function T(c){const l=c&&typeof c.config=="function"?c.config():null,i=l&&l.source&&typeof l.source=="object"?l.source:null;if(!i||i.mode!=="remote"&&i.mode!=="paged")return!1;if(typeof c.rows.matchCount=="function"&&c.rows.matchCount()===null)return!0;const{loaded:a,total:w}=S(c);return Number.isFinite(w)&&a<w}function p(c,l){return l?c?{op:"and",conditions:[c,l]}:l:c||null}function R(c,l,i=null){const a=c.filters&&typeof c.filters.where=="function"?c.filters.where():[];if(Array.isArray(a)&&a.length)return{reason:`a \`where\` predicate is in force (${a.join(", ")}), which only the browser can run`};const w=c.filters&&typeof c.filters.quickState=="function"?c.filters.quickState():{text:""},b=w&&w.text?String(w.text):"",{config:o,caps:O}=l,n={filters:se(p(c.filters.get(),i),{tz:o.timeZone,weekStartsOn:o.weekStartsOn}),sort:[],range:null,context:o.context??null,...b?{quick:b}:{}},x=s(n,O);return x.unpushed.includes("filter")?{reason:i?"the grid's filter, or the viewport condition, did not fully push to the engine":"the grid's filter did not fully push to the engine"}:x.unpushed.includes("quick")?{reason:"the quick search did not push to the engine"}:{request:n,quick:b}}class M{#e=null;#t=null;#n=!1;answer(l){return this.#t&&this.#t.key===l?this.#t:null}last(){return this.#t}get busy(){return this.#e!==null}ask(l,i,a){const w=this.#e;if(w){w.key!==l&&w.controller&&w.controller.abort();return}const b=globalThis.AbortController,o=typeof b=="function"?new b:null,O={key:l,controller:o};this.#e=O;let n;Promise.resolve().then(()=>i(o?o.signal:null)).then(x=>{n={key:l,result:x}},x=>{n={key:l,error:x}}).then(()=>{this.#e===O&&(this.#e=null),!this.#n&&(o&&o.signal.aborted||(this.#t=n),a())})}abort(){const l=this.#e;l&&l.controller&&l.controller.abort()}close(){this.#n=!0,this.abort()}}}),Xe("packages/modules/charts/scale.js",function(r,me){"use strict";Object.defineProperty(r,"isNumber",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"toNumber",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"toTime",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"extent",{enumerable:!0,get:function(){return S}}),Object.defineProperty(r,"niceStep",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"niceDomain",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"measureDomain",{enumerable:!0,get:function(){return R}}),Object.defineProperty(r,"linearTicks",{enumerable:!0,get:function(){return M}}),Object.defineProperty(r,"timeStepFor",{enumerable:!0,get:function(){return c}}),Object.defineProperty(r,"timeTicks",{enumerable:!0,get:function(){return i}}),Object.defineProperty(r,"linearScale",{enumerable:!0,get:function(){return a}}),Object.defineProperty(r,"timeScale",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"key",{enumerable:!0,get:function(){return b}}),Object.defineProperty(r,"bandScale",{enumerable:!0,get:function(){return o}}),Object.defineProperty(r,"sqrtScale",{enumerable:!0,get:function(){return O}});const we=[1,2,2.5,5,10],X=6e4,s=36e5,ye=864e5,se=365.25*ye,he=[1,2,5,10,20,25,50,100],_=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,X,5*X,15*X,30*X,s,3*s,6*s,12*s,ye,2*ye,7*ye,14*ye,30*ye,90*ye,180*ye,...he.map(n=>n*se)];function G(n){return typeof n=="number"&&Number.isFinite(n)}function ie(n){if(n==null||n==="")return null;if(n instanceof Date){const D=n.getTime();return Number.isFinite(D)?D:null}if(typeof n=="boolean")return n?1:0;const x=Number(n);return Number.isFinite(x)?x:null}function W(n){if(n==null||n==="")return null;if(n instanceof Date){const D=n.getTime();return Number.isFinite(D)?D:null}if(typeof n=="number")return Number.isFinite(n)?n:null;const x=Date.parse(String(n));return Number.isFinite(x)?x:null}function S(n){let x=1/0,D=-1/0;for(let B=0;B<n.length;B++){const q=n[B];G(q)&&(q<x&&(x=q),q>D&&(D=q))}return x===1/0?null:{min:x,max:D}}function T(n){if(!(n>0))return 1;const x=10**Math.floor(Math.log10(n));for(const D of we)if(n<=D*x)return D*x;return 10*x}function p(n,x=5){const D=T((n.max-n.min)/Math.max(1,x));return{min:Math.floor(n.min/D)*D,max:Math.ceil(n.max/D)*D,step:D}}function R(n,x={}){const D=S(n)||{min:0,max:1};let{min:B,max:q}=D;if(x.zero&&(B>0&&(B=0),q<0&&(q=0)),B===q){const J=Math.abs(B)>0?Math.abs(B)/10:1;B-=J,q+=J}if(x.nice!==!1){const J=p({min:B,max:q},x.ticks||5);B=J.min,q=J.max}return G(x.min)&&(B=x.min),G(x.max)&&(q=x.max),B===q&&(q=B+1),{min:B,max:q}}function M(n,x=5){const D=T((n.max-n.min)/Math.max(1,x)),B=Math.ceil(n.min/D),q=Math.floor(n.max/D),J=[];for(let ee=B;ee<=q;ee++){const ue=ee*D;J.push(Math.abs(ue)<D/1e6?0:Number(ue.toPrecision(12)))}return J}function c(n,x=5){const D=Math.max(1,x),B=n/D;let q=_[_.length-1];for(const ue of _)if(ue>=B){q=ue;break}if(q<se)return q;let J=q,ee=Math.abs(n/q-D);for(const ue of _){if(ue<se)continue;const fe=Math.abs(n/ue-D);fe<ee&&(ee=fe,J=ue)}return J}function l(n,x){const D=new Date(n.min).getUTCFullYear();let B=Math.ceil(D/x)*x;Date.UTC(B,0,1)<n.min&&(B+=x);const q=[];for(;Date.UTC(B,0,1)<=n.max;B+=x)q.push(Date.UTC(B,0,1));return q}function i(n,x=5){const D=c(n.max-n.min,x);if(D>=se)return l(n,Math.round(D/se));const B=[],q=Math.ceil(n.min/D)*D;for(let J=q;J<=n.max;J+=D)B.push(J);return B}function a(n,x){const D=n.max-n.min||1,[B,q]=x;return{kind:"linear",domain:n,range:x,of(J){return B+(J-n.min)/D*(q-B)},invert(J){return n.min+(J-B)/(q-B||1)*D},ticks(J=5){return M(n,J)}}}function w(n,x){return{...a(n,x),kind:"time",ticks(B=5){return i(n,B)}}}function b(n){if(n==null)return" null";if(n instanceof Date)return` date:${n.getTime()}`;if(typeof n=="object"){const x=n,D=x.id??x.key??x.value;return D!==void 0&&typeof D!="object"?` obj:${String(D)}`:` obj:${String(n)}`}return String(n)}function o(n,x,D=.2){const B=Math.min(.9,Math.max(0,D)),[q,J]=x,ee=new Map;for(let de=0;de<n.length;de++){const U=b(n[de]);ee.has(U)||ee.set(U,de)}const ue=n.length?(J-q)/n.length:J-q,fe=Math.max(0,ue*(1-B));return{kind:"band",domain:n,range:x,bandwidth:fe,step:ue,of(de){const U=ee.get(b(de));return U===void 0?NaN:q+U*ue+(ue-fe)/2},centre(de){const U=this.of(de);return Number.isNaN(U)?NaN:U+fe/2},ticks(){return n}}}function O(n,x){const[D,B]=x,q=Math.max(Math.abs(n.max),Math.abs(n.min),0)||1;return{kind:"sqrt",domain:n,range:x,of(J){const ee=Math.sqrt(Math.abs(J)/q);return D+ee*(B-D)}}}}),Xe("packages/modules/charts/svg.js",function(r,me){"use strict";Object.defineProperty(r,"SVG_NS",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"el",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"svg",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(r,"attr",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"attrs",{enumerable:!0,get:function(){return he}}),Object.defineProperty(r,"setText",{enumerable:!0,get:function(){return _}}),Object.defineProperty(r,"clear",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"append",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"path",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"ribbonPath",{enumerable:!0,get:function(){return S}}),Object.defineProperty(r,"round",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"pathRings",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"insideRings",{enumerable:!0,get:function(){return R}});const we="http://www.w3.org/2000/svg";function X(M){const c=M.indexOf(")");return c<0?M:M.slice(c+1).trim()||"#0072b2"}function s(M,c,l){const i=M.createElement(c);return l&&i.setAttribute("class",l),i}function ye(M,c,l){const i=M.createElementNS(we,c);if(l)for(const a of Object.keys(l))i.setAttribute(a,String(l[a]));return i}function se(M,c,l){if(!M)return;if(l==null){M.removeAttribute(c);return}let i=String(l);i.startsWith("url(#")&&(c==="stroke"||c==="fill"&&M.localName==="text")&&(i=X(i)),M.setAttribute(c,i)}function he(M,c){if(M)for(const l of Object.keys(c))se(M,l,c[l])}function _(M,c){M&&(M.textContent=c==null?"":String(c))}function G(M){if(M)for(;M.firstChild;)M.removeChild(M.firstChild)}function ie(M,c){for(const l of c)l&&M.appendChild(l);return M}function W(M){return M.join(" ")}function S(M){if(!M||M.length<2)return"";const c=["M",M[0].x,M[0].upper];for(let l=1;l<M.length;l++)c.push("L",M[l].x,M[l].upper);for(let l=M.length-1;l>=0;l--)c.push("L",M[l].x,M[l].lower);return c.push("Z"),W(c)}function T(M){return Math.round(M*100)/100}function p(M){const c=[];let l=[];const i=String(M||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let a="",w=[];const b=()=>{if(!a||!w.length){w=[];return}if(a==="M"||a==="L")for(let o=0;o+1<w.length;o+=2)l.push([w[o],w[o+1]]);else a!=="Z"&&w.length>=2&&l.push([w[w.length-2],w[w.length-1]]);w=[]};for(const o of i){if(/[A-Za-z]/.test(o)){if(b(),o==="Z"||o==="z"){l.length>2&&c.push(l),l=[],a="";continue}o==="M"&&l.length>2&&(c.push(l),l=[]),a=o;continue}w.push(Number(o))}return b(),l.length>2&&c.push(l),c}function R(M,c,l){let i=!1;for(const a of M)for(let w=0,b=a.length-1;w<a.length;b=w++){const[o,O]=a[w],[n,x]=a[b];O>l!=x>l&&c<(n-o)*(l-O)/(x-O||1e-12)+o&&(i=!i)}return i}}),Xe("packages/modules/charts/typography.js",function(r,me){"use strict";Object.defineProperty(r,"BASE_SIZE",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"BASE_FAMILY",{enumerable:!0,get:function(){return X}}),Object.defineProperty(r,"CHAR_RATIO",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"resolveType",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(r,"textWidth",{enumerable:!0,get:function(){return he}}),Object.defineProperty(r,"widestLabel",{enumerable:!0,get:function(){return _}}),Object.defineProperty(r,"truncateTo",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"applySize",{enumerable:!0,get:function(){return ie}});const we=12,X="var(--lattice-font-family, system-ui, -apple-system, sans-serif)",s=.62;function ye(W){const S=W&&W.font,T=typeof S=="number"?{size:S}:S||{},p=se(T.size,we);return{family:T.family||X,size:p,small:se(T.small??T.tickSize,Math.max(9,p-1)),title:se(T.title,Math.round(p*1.15)),axisTitle:se(T.axisTitle,Math.max(10,p-1)),weight:T.weight||"inherit"}}function se(W,S){const T=Number(W);return Number.isFinite(T)&&T>0?T:S}function he(W,S){return String(W??"").length*S*s}function _(W,S){let T=0;for(const p of W||[]){const R=he(p,S);R>T&&(T=R)}return T}function G(W,S,T){const p=String(W??""),R=Math.floor(S/(T*s));return R<=0?"":p.length<=R?p:R===1?"…":`${p.slice(0,R-1)}…`}function ie(W,S){!W||!Number.isFinite(S)||(W.style?W.style.fontSize=`${S}px`:W.setAttribute("style",`font-size:${S}px`))}}),Xe("packages/modules/charts/frame.js",function(r,me){"use strict";Object.defineProperty(r,"LABEL_GAP",{enumerable:!0,get:function(){return _}}),Object.defineProperty(r,"LABEL_GUTTER_SHARE",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"resolveMargin",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"plotRect",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"shouldRotate",{enumerable:!0,get:function(){return S}}),Object.defineProperty(r,"Pool",{enumerable:!0,get:function(){return T}});const X=me("packages/modules/charts/svg.js").SVG_NS,s=me("packages/modules/charts/typography.js"),ye=s.textWidth,se=s.widestLabel,he=8,_=6,G=.4;function ie(p,R){const M=typeof p=="number"?p:R,c=p&&typeof p=="object"?p:{},l=i=>Number.isFinite(i)&&i>=0?Number(i):M;return{base:M,top:l(c.top),right:l(c.right),bottom:l(c.bottom),left:l(c.left)}}function W(p){const R=ie(p.margin,typeof p.padding=="number"?p.padding:8),M=R.base,c=p.fontSize||12,l=p.yLabels||[],i=p.xLabels||[],a=p.ySide==="right"?"right":"left",w=a==="right"?"left":"right",b=p.titles||{},o=p.titleSize||c,O=U=>U?o+_:0,n=se(l,c),x=l.length?Math.min(p.width*G,R[a]+n+_):Math.max(he,R[a]),D=R[w]+(p.rightGutter||0),B=(a==="left"?x:D)+O(b.left),q=se(i.map(U=>String(U).slice(0,14)),c),J=(i.length?p.rotated?Math.min(p.height*G,_+q):c+_+R.bottom:Math.max(he,R.bottom))+O(b.bottom),ee=(a==="right"?x:D)+O(b.right),ue=R.top+(p.topGutter||0),fe=Math.max(0,p.width-B-ee),de=Math.max(0,p.height-ue-J);return{left:B,top:ue,width:fe,height:de,right:B+fe,bottom:ue+de,gutter:{left:B,bottom:J,right:ee,top:ue}}}function S(p,R,M,c){if(!p.length||R<=0)return!1;const l=Number.isFinite(c)&&c>0?Number(c):1;return se(p,M)>R*l-4}class T{#e;#t=0;static#n="data-pool-key";constructor(R,M=0){this.#e=R,this.#t=M>0?M:0}next(R,M,c){if(c!=null)return this.#r(R,M,String(c));const l=this.#e.childNodes[this.#t],i=l&&l.tagName,a=/(^|\s)\S*__axis-title(\s|$)/,w=i&&a.test(String(l.getAttribute("class")||"")),b=!!M&&a.test(String(M));if(i&&(!w||b)&&String(i).toLowerCase()===R.toLowerCase())return M&&l.setAttribute("class",M),this.#t++,l;const o=this.#e.ownerDocument.createElementNS(X,R);return M&&o.setAttribute("class",M),l?this.#e.insertBefore(o,l):this.#e.appendChild(o),this.#t++,o}#r(R,M,c){const l=R.toLowerCase();for(let w=this.#t;w<this.#e.childNodes.length;w++){const b=this.#e.childNodes[w],o=b&&b.tagName;if(o&&String(o).toLowerCase()===l&&b.getAttribute(T.#n)===c)return w!==this.#t&&this.#e.insertBefore(b,this.#e.childNodes[this.#t]),M&&b.setAttribute("class",M),this.#t++,b}const i=this.#e.ownerDocument.createElementNS(X,R);i.setAttribute(T.#n,c),M&&i.setAttribute("class",M);const a=this.#e.childNodes[this.#t];return a?this.#e.insertBefore(i,a):this.#e.appendChild(i),this.#t++,i}finish(){for(;this.#e.childNodes.length>this.#t;)this.#e.removeChild(this.#e.lastChild);this.#t=0}}}),Xe("packages/modules/charts/fills.js",function(r,me){"use strict";Object.defineProperty(r,"PATTERNS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"GRADIENTS",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(r,"isFill",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"isPaintRef",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"paintFallback",{enumerable:!0,get:function(){return S}}),Object.defineProperty(r,"normaliseFill",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"swatchCss",{enumerable:!0,get:function(){return M}}),Object.defineProperty(r,"createFillRegistry",{enumerable:!0,get:function(){return c}}),Object.defineProperty(r,"rowPaint",{enumerable:!0,get:function(){return l}}),Object.defineProperty(r,"patternSeries",{enumerable:!0,get:function(){return i}}),Object.defineProperty(r,"paintSolid",{enumerable:!0,get:function(){return a}}),Object.defineProperty(r,"rowFillSource",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"nodePaint",{enumerable:!0,get:function(){return b}});const X=me("packages/core/src/internal/util.js").warnOnce,s=Object.freeze(["hatch","crosshatch","dots","grid"]),ye=Object.freeze(["linear","radial"]),se=8,he="#0072b2";let _=0;const G=new Map;function ie(o){return!!o&&typeof o=="object"&&!Array.isArray(o)&&(typeof o.gradient=="string"||typeof o.pattern=="string")}function W(o){return typeof o=="string"&&o.startsWith("url(#")}function S(o){if(typeof o!="string")return o==null?"":String(o);if(!o.startsWith("url("))return o;const O=o.indexOf(")");return(O<0?"":o.slice(O+1).trim())||he}function T(o,O){X(`chart:fill:invalid:${o}`,`a chart fill object was ignored: ${O} The mark was drawn in a solid colour instead. A fill is a gradient object (gradient: "linear" or "radial", with stops of [offset, colour]) or a pattern object (pattern: "hatch", "crosshatch", "dots" or "grid", with a colour).`)}function p(o,O){if(!ie(o))return null;const n=O||he;if(typeof o.gradient=="string"){if(!ye.includes(o.gradient))return T("gradient",`the gradient "${o.gradient}" is not one of ${ye.join(", ")}.`),null;const q=Array.isArray(o.stops)?o.stops:[],J=[];for(const ue of q){const fe=Array.isArray(ue)?Number(ue[0]):Number(ue&&ue.offset),de=Array.isArray(ue)?ue[1]:ue&&ue.colour;!Number.isFinite(fe)||typeof de!="string"||!de||J.push({offset:Math.min(1,Math.max(0,fe)),colour:de})}if(J.length<2)return T("stops","a gradient needs at least two [offset, colour] stops."),null;J.sort((ue,fe)=>ue.offset-fe.offset);const ee=Number.isFinite(Number(o.angle))?Number(o.angle):180;return{kind:o.gradient,angle:ee,stops:J,solid:J[0].colour}}if(!s.includes(o.pattern))return T("pattern",`the pattern "${o.pattern}" is not one of ${s.join(", ")}.`),null;const x=Number(o.size),D=Number(o.angle),B=typeof o.colour=="string"&&o.colour?o.colour:n;return{kind:"pattern",pattern:o.pattern,colour:B,background:typeof o.background=="string"&&o.background?o.background:null,size:Number.isFinite(x)&&x>=2?x:se,angle:Number.isFinite(D)?D:o.pattern==="grid"||o.pattern==="dots"?0:45,solid:B}}function R(o){if(o.kind==="pattern"){const n=o.colour,x=o.size,D=Math.max(1,x/5),B=o.background||"transparent",q=J=>`repeating-linear-gradient(${J+90}deg,${n} 0 ${D}px,transparent ${D}px ${x}px)`;return o.pattern==="hatch"?`${q(o.angle)},${B}`:o.pattern==="crosshatch"?`${q(o.angle)},${q(o.angle+90)},${B}`:o.pattern==="grid"?`${q(o.angle)},${q(o.angle+90)},${B}`:`radial-gradient(circle at 50% 50%,${n} ${x/6}px,transparent ${x/6+.5}px) 0 0/${x}px ${x}px,${B}`}const O=o.stops.map(n=>`${n.colour} ${Math.round(n.offset*100)}%`).join(",");return o.kind==="radial"?`radial-gradient(circle,${O})`:`linear-gradient(${o.angle}deg,${O})`}function M(o){if(!W(o))return typeof o=="string"?o:"";const O=String(o).indexOf(")"),n=String(o).slice(5,O),x=G.get(n);return x?R(x):S(o)}function c(o){const O=`lattice-fill-${++_}`;let n=new Map,x=0;const D=(q,J)=>{const ee=o.ownerDocument.createElementNS("http://www.w3.org/2000/svg",q);for(const ue of Object.keys(J))ee.setAttribute(ue,String(J[ue]));return ee},B=(q,J)=>{if(J.kind==="pattern"){const ue=J.size,fe=Math.max(1,ue/5),de=D("pattern",{id:q,width:ue,height:ue,patternUnits:"userSpaceOnUse"});J.angle&&de.setAttribute("patternTransform",`rotate(${J.angle})`),J.background&&de.appendChild(D("rect",{width:ue,height:ue,fill:J.background}));const U={stroke:J.colour,"stroke-width":fe};J.pattern==="dots"?de.appendChild(D("circle",{cx:ue/2,cy:ue/2,r:Math.max(1,ue/6),fill:J.colour})):(de.appendChild(D("line",{x1:ue/2,y1:0,x2:ue/2,y2:ue,...U})),J.pattern!=="hatch"&&de.appendChild(D("line",{x1:0,y1:ue/2,x2:ue,y2:ue/2,...U}))),o.appendChild(de);return}let ee;if(J.kind==="radial")ee=D("radialGradient",{id:q,cx:.5,cy:.5,r:.5});else{const ue=J.angle*Math.PI/180,fe=Math.sin(ue)/2,de=-Math.cos(ue)/2;ee=D("linearGradient",{id:q,x1:+(.5-fe).toFixed(4),y1:+(.5-de).toFixed(4),x2:+(.5+fe).toFixed(4),y2:+(.5+de).toFixed(4)})}for(const ue of J.stops)ee.appendChild(D("stop",{offset:ue.offset,"stop-color":ue.colour}));o.appendChild(ee)};return{prefix:O,paint(q,J){const ee=p(q,J);if(!ee)return J||he;if(!o||!o.ownerDocument)return ee.solid;const ue=JSON.stringify(ee);let fe=n.get(ue);if(!fe){const de=`${O}-${x++}`;B(de,ee),G.set(de,ee),fe=`url(#${de}) ${ee.solid}`,n.set(ue,fe)}return fe},reset(){for(const q of n.values())G.delete(q.slice(5,q.indexOf(")")));if(n=new Map,x=0,o)for(;o.firstChild;)o.removeChild(o.firstChild)},ids(){return[...n.values()].map(q=>q.slice(5,q.indexOf(")")))}}}function l(o,O,n){if(o==null||o==="")return null;const x=S(n);if(ie(o))return O?O.paint(o,x):(p(o,x)||{}).solid||null;if(typeof o=="string"){if(s.includes(o)){const D={pattern:o,colour:x};return O?O.paint(D,x):x}return o}return null}function i(o){const O=[{pattern:"hatch",angle:45},{pattern:"dots"},{pattern:"crosshatch",angle:45},{pattern:"hatch",angle:135},{pattern:"grid"},{pattern:"dots",size:5},{pattern:"hatch",angle:0},{pattern:"crosshatch",angle:0,size:6}];return o.map((n,x)=>({...O[x%O.length],colour:n,background:"var(--lattice-background, #fff)"}))}function a(o){return W(o)?String(o).replace(/^url\([^)]*\)\s*/,""):o}function w(o,O){const n=o.fill;if(ie(n))return(D,B)=>l(n,O.fills,a(B));if(typeof n=="function")return(D,B)=>{let q=null;try{q=n({label:D.label,x:D.x,y:D.y,rowKey:D.rowKey})}catch{q=null}return l(q,O.fills,a(B))};const x=typeof n=="string"?n:n&&typeof n=="object"&&typeof n.col=="string"?n.col:null;return x?(D,B)=>D.rowKey===void 0||D.rowKey===null?null:l(o.grid.rows.value(D.rowKey,x),O.fills,a(B)):null}function b(o,O,n){return o&&o({label:O.label,x:O.value,y:O.total,rowKey:O.rowKey},n)||n}}),Xe("packages/modules/charts/scheme.js",function(r,me){"use strict";Object.defineProperty(r,"PALETTE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(r,"SCHEMES",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"registerScheme",{enumerable:!0,get:function(){return S}}),Object.defineProperty(r,"setDefaultScheme",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"schemeNames",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"resolveScheme",{enumerable:!0,get:function(){return l}}),Object.defineProperty(r,"RAMP_SCALES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(r,"toRgb",{enumerable:!0,get:function(){return o}}),Object.defineProperty(r,"rampStops",{enumerable:!0,get:function(){return O}});const X=me("packages/core/src/internal/util.js").warnOnce,s=me("packages/modules/charts/fills.js"),ye=s.isFill,se=s.patternSeries,he=s.rowPaint,_=Object.freeze(["#0072b2","#e69f00","#009e73","#cc79a7","#56b4e9","#d55e00","#7a5195","#6b7d8c"]),G=Object.freeze({default:{series:_,sequential:["#ecf3f9","#005280"],diverging:["#b04a00","#f7f7f7","#005280"],positive:"#009e73",negative:"#d55e00"},bright:{series:["#1f77d0","#ff7f0e","#2ca02c","#d62728","#9467bd","#17becf","#e377c2","#7f7f7f"],sequential:["#eef4fb","#1f77d0"],diverging:["#d62728","#f7f7f7","#1f77d0"],positive:"#2ca02c",negative:"#d62728"},earth:{series:["#5b7c6f","#c08b52","#7a6a53","#a4553f","#4e6a83","#8f8259","#6d5566","#8c9196"],sequential:["#f2efe9","#4e6a83"],diverging:["#a4553f","#f2efe9","#4e6a83"],positive:"#5b7c6f",negative:"#a4553f"},mono:{series:["#0b2a3d","#17475f","#2c6480","#4a82a0","#6da0bd","#94bcd6","#bcd7e9","#dfecf5"],sequential:["#eef3f7","#0b2a3d"],diverging:["#7a5c00","#f5f5f5","#0b2a3d"],positive:"#17475f",negative:"#7a5c00"},patterns:{series:se(_),sequential:["#ecf3f9","#005280"],diverging:["#b04a00","#f7f7f7","#005280"],positive:"#009e73",negative:"#d55e00"}}),ie=new Map;let W="default";function S(n,x){!n||!x||ie.set(String(n),x)}function T(n){if(typeof n=="string"){W=n;return}n&&typeof n=="object"&&(ie.set("__default__",n),W="__default__")}function p(){return[...Object.keys(G),...ie.keys()].filter(n=>!n.startsWith("__"))}function R(n){return ie.has(n)?ie.get(n):G[n]||null}const M=["series","sequential","diverging","positive","negative"];function c(n){return!n||typeof n!="object"||Array.isArray(n)?!1:!M.some(x=>x in n)}function l(n,x){const D=x&&x.fills||null,B=R(W)||G.default,q=n&&n.scheme,J=c(q)?q:null,ee=Array.isArray(q)&&q.length?q:null,ue=typeof q=="string"?R(q):J||Array.isArray(q)?null:q||null,fe=(n&&Array.isArray(n.palette)&&n.palette.length?n.palette:null)||ee;J&&fe&&X("chart:scheme:array-and-map",'chart "scheme" was given as a name map together with a "palette" array; the two do not combine. Colours came from the map and the array was ignored. Pass one or the other.');const de=J?null:fe,U={...G.default,...B,...ue||{}};de&&(U.series=de);const A=n&&n.ramp&&typeof n.ramp=="object"&&!Array.isArray(n.ramp)?n.ramp:null,ae=A?A.colours:n&&n.ramp,d=Array.isArray(ae)&&ae.length>=2?ae:null;d&&(U.sequential=d);const t=A?w(A.scale):null,k=!!(ue||de||J),v=U.series&&U.series.length?U.series:_,F=new Map;let E=0;return{...U,series:(te,N)=>{if(J&&N!==void 0&&N!==null){const K=String(N);return Object.prototype.hasOwnProperty.call(J,K)?i(J[K],D,te):(F.has(K)||F.set(K,E++),i(b(v,F.get(K),!0),D,F.get(K)))}return i(b(v,te,k),D,te)},explicit:k,nameMap:!!J,rampScale:t,fills:D}}function i(n,x,D){if(!ye(n))return n;const B=_[(D%_.length+_.length)%_.length];return he(n,x,B)||B}const a=Object.freeze(["linear","log","quantile"]);function w(n){return n==null?null:a.includes(n)?n:(X(`chart:ramp:scale:${String(n)}`,`chart "ramp.scale" was "${String(n)}", which is not a ramp scale; the chart chose one from its values instead. Use "linear", "log" or "quantile".`),null)}function b(n,x,D){const B=(x%n.length+n.length)%n.length;return D||typeof n[B]!="string"?n[B]:`var(--lattice-chart-${B+1}, ${n[B]})`}function o(n){if(typeof n!="string")return null;const x=n.trim(),D=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(x);if(D){const J=D[1];return J.length===3?[0,1,2].map(ee=>parseInt(J[ee]+J[ee],16)):[0,2,4].map(ee=>parseInt(J.slice(ee,ee+2),16))}const B=/^rgba?\(([^)]+)\)$/i.exec(x);if(!B)return null;const q=B[1].split(/[\s,/]+/).filter(Boolean).slice(0,3).map(Number);return q.length===3&&q.every(J=>Number.isFinite(J))?q:null}function O(n,x){const D=x?n.diverging:n.sequential,B=x?G.default.diverging:G.default.sequential,q=(Array.isArray(D)?D:B).map((J,ee)=>o(J)||o(B[ee])||[0,0,0]);return q.length>=2?q:B.map(J=>o(J))}}),Xe("packages/modules/charts/styles.js",function(r,me){"use strict";Object.defineProperty(r,"NS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"seriesColour",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"css",{enumerable:!0,get:function(){return he}}),Object.defineProperty(r,"injectStyles",{enumerable:!0,get:function(){return _}});const X=me("packages/modules/charts/scheme.js").PALETTE,s="lat-chartview",ye="data-lattice-chartview";function se(G){const ie=(G%X.length+X.length)%X.length;return`var(--lattice-chart-${ie+1}, ${X[ie]})`}function he(){return`
|
|
6
|
+
var On=Object.create(null),$n=Object.create(null);function Xe(r,me){On[r]=me}function Nn(r){var me=$n[r];if(me)return me;var we=Object.create(null);$n[r]=we;var X=On[r];if(!X)throw new Error("[lattice] missing module: "+r);return X(we,Nn),we}Xe("packages/core/src/internal/util.js",function(r,me){"use strict";Object.defineProperty(r,"VERSION",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"reportedWarnings",{enumerable:!0,get:function(){return S}}),Object.defineProperty(r,"warnOnce",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"infoOnce",{enumerable:!0,get:function(){return R}}),Object.defineProperty(r,"resetWarnings",{enumerable:!0,get:function(){return M}}),Object.defineProperty(r,"fail",{enumerable:!0,get:function(){return c}}),Object.defineProperty(r,"invariant",{enumerable:!0,get:function(){return l}}),Object.defineProperty(r,"DEV",{enumerable:!0,get:function(){return i}}),Object.defineProperty(r,"isObject",{enumerable:!0,get:function(){return a}}),Object.defineProperty(r,"isFunction",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"isNil",{enumerable:!0,get:function(){return b}}),Object.defineProperty(r,"isBlank",{enumerable:!0,get:function(){return o}}),Object.defineProperty(r,"isCtor",{enumerable:!0,get:function(){return O}}),Object.defineProperty(r,"pathGetter",{enumerable:!0,get:function(){return x}}),Object.defineProperty(r,"pathSetter",{enumerable:!0,get:function(){return B}}),Object.defineProperty(r,"getPath",{enumerable:!0,get:function(){return q}}),Object.defineProperty(r,"setPath",{enumerable:!0,get:function(){return J}}),Object.defineProperty(r,"humanise",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(r,"escapeHtml",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(r,"titleCase",{enumerable:!0,get:function(){return de}}),Object.defineProperty(r,"expand",{enumerable:!0,get:function(){return U}}),Object.defineProperty(r,"toArray",{enumerable:!0,get:function(){return A}}),Object.defineProperty(r,"merge",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"mergeRow",{enumerable:!0,get:function(){return t}}),Object.defineProperty(r,"Lru",{enumerable:!0,get:function(){return k}}),Object.defineProperty(r,"collator",{enumerable:!0,get:function(){return F}}),Object.defineProperty(r,"defaultCompare",{enumerable:!0,get:function(){return E}}),Object.defineProperty(r,"now",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(r,"nextFrame",{enumerable:!0,get:function(){return N}}),Object.defineProperty(r,"cancelFrame",{enumerable:!0,get:function(){return K}}),Object.defineProperty(r,"frameBatched",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(r,"settleDebounce",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(r,"whenIdle",{enumerable:!0,get:function(){return re}}),Object.defineProperty(r,"uid",{enumerable:!0,get:function(){return Q}});const we="1.88.3";async function X(){return we}const s="1.88.3",ye=new Set,se=2e3;function he(g){if(ye.add(g),ye.size>se){const h=ye.values().next().value;h!==void 0&&ye.delete(h)}}const _=[],G=500;function ie(g,h,I){_.push({key:g,level:h,message:I.map(f=>typeof f=="string"?f:W(f)).join(" "),at:Date.now()}),_.length>G&&_.shift()}function W(g){if(g instanceof Error)return g.message;try{return JSON.stringify(g)}catch{return String(g)}}function S(){return _.map(g=>({...g}))}function T(g){if(g.length===0||typeof g[0]!="string")return g;const h=g[0].replace(/^\[lattice\]\s*/,"");return h===g[0]?g:[h,...g.slice(1)]}function p(g,...h){if(ye.has(g))return;he(g);const I=T(h);ie(g,"warn",I),console.warn("[lattice]",...I)}function R(g,...h){if(ye.has(g))return;he(g);const I=T(h);ie(g,"info",I),console.info("[lattice]",...I)}function M(){ye.clear(),_.length=0}function c(g,h){const I=new Error(`[lattice] ${g}`);throw h!==void 0&&(I.cause=h),I}function l(g,h){g||c(h)}const i=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function a(g){return g!==null&&typeof g=="object"&&!Array.isArray(g)}function w(g){return typeof g=="function"}function b(g){return g==null}function o(g){return g==null||g===""}function O(g){return typeof g!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(g))?!0:!!(g.prototype&&Object.getOwnPropertyNames(g.prototype).length>1)}const n=new Map;function x(g){let h=n.get(g);if(h)return h;if(!g.includes("."))h=I=>I?.[g];else{const I=g.split("."),f=I.length;h=z=>{let e=z;for(let y=0;y<f;y++){if(e==null)return;e=e[I[y]]}return e}}return n.set(g,h),h}const D=new Map;function B(g){let h=D.get(g);if(h)return h;if(!g.includes("."))h=(I,f)=>{I!=null&&(I[g]=f)};else{const I=g.split("."),f=I.length-1;h=(z,e)=>{let y=z;for(let u=0;u<f;u++){if(y==null)return;const C=I[u];y[C]==null&&(y[C]={}),y=y[C]}y!=null&&(y[I[f]]=e)}}return D.set(g,h),h}function q(g,h){return x(h)(g)}function J(g,h,I){B(h)(g,I)}function ee(g){return g?(g.includes(".")?g.slice(g.lastIndexOf(".")+1):g).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(/^./,I=>I.toUpperCase()):""}const ue={"&":"&","<":"<",">":">",'"':""","'":"'"};function fe(g){const h=g==null?"":String(g);return/[&<>"']/.test(h)?h.replace(/[&<>"']/g,I=>ue[I]):h}function de(g){return String(g).replace(/\w\S*/g,h=>h[0].toUpperCase()+h.slice(1).toLowerCase())}function U(g,h,I){if(g!==void 0)return g===!0?{enabled:!0,...I}:g===!1?{enabled:!1}:a(g)?g:{[h]:g,enabled:!0}}function A(g){return g==null?[]:Array.isArray(g)?g:[g]}const ae=Object.freeze(new Set(["__proto__","constructor","prototype"]));function d(g,h){if(!a(g))return a(h)?{...h}:h;if(!a(h))return h===void 0?g:h;const I={...g};for(const f of Object.keys(h)){if(ae.has(f))continue;const z=h[f];z!==void 0&&(I[f]=a(z)&&a(I[f])?d(I[f],z):z)}return I}function t(g,h){if(!a(g)||!a(h)||g===h)return h;const I=Object.create(Object.getPrototypeOf(g));return Object.assign(I,g,h),I}class k{#e;#t=new Map;#n;constructor(h=256,I=null){this.#e=h,this.#n=I}get size(){return this.#t.size}get max(){return this.#e}set max(h){this.#e=h,this.#r()}has(h){return this.#t.has(h)}get(h){const I=this.#t;if(!I.has(h))return;const f=I.get(h);return I.delete(h),I.set(h,f),f}peek(h){return this.#t.get(h)}set(h,I){const f=this.#t;return f.has(h)&&f.delete(h),f.set(h,I),this.#r(),I}delete(h){const I=this.#t.get(h);return this.#t.delete(h)&&this.#n&&this.#n(I,h),I}clear(){if(this.#n)for(const[h,I]of this.#t)this.#n(I,h);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const h=this.#t;for(;h.size>this.#e;){const I=h.keys().next().value,f=h.get(I);h.delete(I),this.#n&&this.#n(f,I)}}}const v=new Map;function F(g,h){const I=`${g||""}|${h?JSON.stringify(h):""}`;let f=v.get(I);return f||(f=new Intl.Collator(g||void 0,{numeric:!0,sensitivity:"variant",...h}),v.set(I,f)),f}function E(g,h){if(g===h)return 0;if(g==null)return 1;if(h==null)return-1;if(typeof g=="number"&&typeof h=="number")return Number.isNaN(g)?Number.isNaN(h)?0:1:Number.isNaN(h)||g<h?-1:g>h?1:0;const I=String(g),f=String(h);return I<f?-1:I>f?1:0}function oe(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const te=typeof requestAnimationFrame=="function";function N(g){return te?requestAnimationFrame(g):setTimeout(()=>g(oe()),16)}function K(g){g!=null&&(te?cancelAnimationFrame(g):clearTimeout(g))}function ne(g){let h=null,I=null;const f=()=>{h=null;const e=I;I=null,g(...e||[])},z=(...e)=>{I=e,h===null&&(h=N(f))};return z.cancel=()=>{K(h),h=null,I=null},z.flush=()=>{h!==null&&(K(h),f())},z}function ge(g,h){let I=null,f=null;const z=()=>{if(I=null,f===null)return;const u=f;f=null,g(...u),e()},e=()=>{I=setTimeout(z,h),typeof I?.unref=="function"&&I.unref()},y=(...u)=>{I===null?(g(...u),e()):(f=u,clearTimeout(I),e())};return y.flush=()=>{if(I!==null&&clearTimeout(I),I=null,f===null)return;const u=f;f=null,g(...u)},y.cancel=()=>{I!==null&&clearTimeout(I),I=null,f=null},y.pending=()=>I!==null||f!==null,y}function re(g,h=50){return typeof requestIdleCallback=="function"?requestIdleCallback(g,{timeout:h}):setTimeout(()=>g({timeRemaining:()=>0,didTimeout:!0}),1)}let L=0;function Q(g="l"){return`${g}${(++L).toString(36)}`}}),Xe("packages/modules/geometry/geodata.js",function(r,me){"use strict";Object.defineProperty(r,"GEOMETRY_KINDS",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"SPATIAL_OPERATORS",{enumerable:!0,get:function(){return he}}),Object.defineProperty(r,"GEOMETRY_OPERATORS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(r,"EARTH_RADIUS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"toWkt",{enumerable:!0,get:function(){return J}}),Object.defineProperty(r,"toWkb",{enumerable:!0,get:function(){return de}}),Object.defineProperty(r,"readGeometry",{enumerable:!0,get:function(){return F}}),Object.defineProperty(r,"parseGeometry",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(r,"haversine",{enumerable:!0,get:function(){return N}}),Object.defineProperty(r,"geometryInfo",{enumerable:!0,get:function(){return I}}),Object.defineProperty(r,"geometryKind",{enumerable:!0,get:function(){return f}}),Object.defineProperty(r,"spatialOperand",{enumerable:!0,get:function(){return e}}),Object.defineProperty(r,"spatialPredicate",{enumerable:!0,get:function(){return $e}});const we=me("packages/core/src/internal/util.js"),X=we.isNil,s=we.isObject,ye=we.warnOnce,se=Object.freeze(["Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"]),he=Object.freeze(["withinBbox","withinPolygon","intersects","withinDistance"]),_=Object.freeze([...he,"blank","notBlank"]),G=63710088e-1,ie=Math.PI/180,W=16,S=1e-12;class T extends Error{}function p($){throw new T($)}function R($){(!Array.isArray($)||$.length<2)&&p("a position needs at least two numbers");const j=Number($[0]),V=Number($[1]);return(typeof $[0]!="number"||typeof $[1]!="number"||!Number.isFinite(j)||!Number.isFinite(V))&&p("a coordinate is not a finite number"),[j,V]}function M($,j,V){Array.isArray($)||p(`${V} is not an array of positions`);const le=$.map(R);return le.length<j&&p(`${V} needs at least ${j} positions, found ${le.length}`),le}function c($){const j=M($,3,"a polygon ring"),V=j[0],le=j[j.length-1];return(V[0]!==le[0]||V[1]!==le[1])&&j.push([V[0],V[1]]),j.length<4&&p(`a polygon ring needs at least 3 distinct corners, found ${j.length-1}`),j}function l($){return(!Array.isArray($)||$.length===0)&&p("a polygon needs at least an outer ring"),$.map(c)}function i($,j){switch(j>W&&p("geometry collections nest too deeply"),s($)||p("GeoJSON must be an object"),$.type){case"Feature":return $.geometry==null?null:i($.geometry,j+1);case"FeatureCollection":return p("a FeatureCollection holds many rows, not one value; load its features as rows");case"Point":return{type:"Point",coordinates:R($.coordinates)};case"MultiPoint":return{type:"MultiPoint",coordinates:M($.coordinates,1,"a MultiPoint")};case"LineString":return{type:"LineString",coordinates:M($.coordinates,2,"a LineString")};case"MultiLineString":return(!Array.isArray($.coordinates)||!$.coordinates.length)&&p("a MultiLineString needs at least one line"),{type:"MultiLineString",coordinates:$.coordinates.map(V=>M(V,2,"a LineString"))};case"Polygon":return{type:"Polygon",coordinates:l($.coordinates)};case"MultiPolygon":return(!Array.isArray($.coordinates)||!$.coordinates.length)&&p("a MultiPolygon needs at least one polygon"),{type:"MultiPolygon",coordinates:$.coordinates.map(l)};case"GeometryCollection":{(!Array.isArray($.geometries)||!$.geometries.length)&&p("a GeometryCollection needs at least one geometry");const V=$.geometries.map(le=>i(le,j+1)).filter(Boolean);return V.length?{type:"GeometryCollection",geometries:V}:null}default:return p(`"${String($.type)}" is not a GeoJSON geometry type`)}}const a=Object.freeze({POINT:"Point",LINESTRING:"LineString",POLYGON:"Polygon",MULTIPOINT:"MultiPoint",MULTILINESTRING:"MultiLineString",MULTIPOLYGON:"MultiPolygon",GEOMETRYCOLLECTION:"GeometryCollection"}),w=/[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/y,b=/[A-Za-z]+/y,o=/^\s*(?:SRID\s*=\s*\d+\s*;\s*)?[A-Za-z]+\s*(?:ZM|Z|M)?\s*(?:\(|EMPTY\b)/i;class O{text;at=0;constructor(j){this.text=j}space(){for(;this.at<this.text.length&&/\s/.test(this.text[this.at]);)this.at++}expect(j){this.space(),this.text[this.at]!==j&&p(`WKT expected "${j}" at character ${this.at+1}, found "${this.text[this.at]??"the end"}"`),this.at++}accept(j){return this.space(),this.text[this.at]===j?(this.at++,!0):!1}word(){this.space(),b.lastIndex=this.at;const j=b.exec(this.text);return j?(this.at+=j[0].length,j[0].toUpperCase()):""}numberNext(){return this.space(),w.lastIndex=this.at,w.test(this.text)}number(){this.space(),w.lastIndex=this.at;const j=w.exec(this.text);return j||p(`WKT expected a number at character ${this.at+1}`),this.at+=j[0].length,Number(j[0])}position(){const j=this.number(),V=this.number();for(;this.numberNext();)this.number();return[j,V]}positionList(){this.expect("(");const j=[this.position()];for(;this.accept(",");)j.push(this.position());return this.expect(")"),j}empty(){const j=this.at;return this.word()==="EMPTY"?!0:(this.at=j,!1)}geometry(j){j>W&&p("geometry collections nest too deeply");const V=this.word(),le=a[V];le||p(V?`"${V}" is not a WKT geometry type`:"WKT expected a geometry type");const Se=this.at,ve=this.word();return ve!=="Z"&&ve!=="M"&&ve!=="ZM"&&(this.at=Se),this.empty()?null:this.body(le,j)}body(j,V){switch(j){case"Point":{this.expect("(");const le=this.position();return this.expect(")"),{type:"Point",coordinates:le}}case"LineString":return{type:"LineString",coordinates:M(this.positionList(),2,"a LineString")};case"Polygon":return{type:"Polygon",coordinates:this.polygonBody()};case"MultiPoint":{this.expect("(");const le=[];do this.empty()||(this.accept("(")?(le.push(this.position()),this.expect(")")):le.push(this.position()));while(this.accept(","));return this.expect(")"),le.length?{type:"MultiPoint",coordinates:le}:null}case"MultiLineString":{const le=this.parts(()=>M(this.positionList(),2,"a LineString"));return le.length?{type:"MultiLineString",coordinates:le}:null}case"MultiPolygon":{const le=this.parts(()=>this.polygonBody());return le.length?{type:"MultiPolygon",coordinates:le}:null}default:{this.expect("(");const le=[];do{const Se=this.geometry(V+1);Se&&le.push(Se)}while(this.accept(","));return this.expect(")"),le.length?{type:"GeometryCollection",geometries:le}:null}}}parts(j){this.expect("(");const V=[];do this.empty()||V.push(j());while(this.accept(","));return this.expect(")"),V}polygonBody(){return l(this.parts(()=>this.positionList()))}}function n($){const j=new O(String($).replace(/^\s*SRID\s*=\s*\d+\s*;/i,"")),V=j.geometry(0);return j.space(),j.at<j.text.length&&p(`WKT has unexpected text after the geometry at character ${j.at+1}`),V}function x($){return Object.is($,-0)?"0":String($)}function D($){return`${x($[0])} ${x($[1])}`}function B($){return`(${$.map(D).join(", ")})`}function q($){return`(${$.map(B).join(", ")})`}function J($){const j=oe($);return j?ee(j):""}function ee($){switch($.type){case"Point":return`POINT (${D($.coordinates)})`;case"LineString":return`LINESTRING ${B($.coordinates)}`;case"Polygon":return`POLYGON ${q($.coordinates)}`;case"MultiPoint":return`MULTIPOINT (${$.coordinates.map(j=>`(${D(j)})`).join(", ")})`;case"MultiLineString":return`MULTILINESTRING (${$.coordinates.map(B).join(", ")})`;case"MultiPolygon":return`MULTIPOLYGON (${$.coordinates.map(q).join(", ")})`;default:return`GEOMETRYCOLLECTION (${$.geometries.map(ee).join(", ")})`}}class ue{view;at=0;constructor(j){this.view=new DataView(j.buffer,j.byteOffset,j.byteLength)}need(j){this.at+j>this.view.byteLength&&p(`WKB ends after ${this.view.byteLength} bytes, in the middle of a geometry`)}u8(){return this.need(1),this.view.getUint8(this.at++)}u32(j){this.need(4);const V=this.view.getUint32(this.at,j);return this.at+=4,V}f64(j){this.need(8);const V=this.view.getFloat64(this.at,j);return this.at+=8,V}count(j,V){const le=this.u32(j);return le*V>this.view.byteLength-this.at&&p(`WKB claims ${le} elements, more than its bytes can hold`),le}position(j,V){const le=this.f64(j),Se=this.f64(j);for(let ve=2;ve<V;ve++)this.f64(j);return[le,Se]}positions(j,V){const le=this.count(j,8*V),Se=new Array(le);for(let ve=0;ve<le;ve++)Se[ve]=this.position(j,V);return Se}geometry(j,V){j>W&&p("geometry collections nest too deeply");const le=this.u8();le!==0&&le!==1&&p(`WKB byte-order mark is ${le}, not 0 or 1`);const Se=le===1,ve=this.u32(Se);let Me=2;ve&2147483648&&Me++,ve&1073741824&&Me++,ve&536870912&&this.u32(Se);let Le=ve&268435455;if(Le>=1e3){const We=Math.floor(Le/1e3);We>3&&p(`WKB geometry type ${Le} is not one this reads`),Me=2+(We===3?2:1),Le%=1e3}const Be=se[Le-1];switch(Be||p(`WKB geometry type ${Le} is not one this reads`),V&&Be!==V&&p(`a part of a WKB Multi${V} is a ${Be}`),Be){case"Point":{const We=this.position(Se,Me);return Number.isNaN(We[0])&&Number.isNaN(We[1])?null:{type:"Point",coordinates:R(We)}}case"LineString":return{type:"LineString",coordinates:M(this.positions(Se,Me),2,"a LineString")};case"Polygon":{const We=this.count(Se,4),ze=[];for(let Ke=0;Ke<We;Ke++)ze.push(this.positions(Se,Me));return We?{type:"Polygon",coordinates:l(ze)}:null}default:{const We=this.count(Se,5),ze=Be==="GeometryCollection"?void 0:Be.slice(5),Ke=[];for(let Ue=0;Ue<We;Ue++){const vt=this.geometry(j+1,ze);vt&&Ke.push(vt)}return Ke.length?Be==="GeometryCollection"?{type:Be,geometries:Ke}:{type:Be,coordinates:Ke.map(Ue=>Ue.coordinates)}:null}}}}function fe($){const j=new ue($),V=j.geometry(0);return j.at!==$.byteLength&&p(`WKB has ${$.byteLength-j.at} bytes left over after the geometry`),V}function de($){const j=oe($);if(!j)return null;const V=[];let le=0;const Se=ze=>{const Ke=new DataView(new ArrayBuffer(5));Ke.setUint8(0,1),Ke.setUint32(1,se.indexOf(ze)+1,!0),V.push(Ke),le+=5},ve=ze=>{const Ke=new DataView(new ArrayBuffer(4));Ke.setUint32(0,ze,!0),V.push(Ke),le+=4},Me=ze=>{const Ke=new DataView(new ArrayBuffer(16*ze.length));ze.forEach((Ue,vt)=>{Ke.setFloat64(vt*16,Ue[0],!0),Ke.setFloat64(vt*16+8,Ue[1],!0)}),V.push(Ke),le+=16*ze.length},Le=ze=>{switch(Se(ze.type),ze.type){case"Point":Me([ze.coordinates]);break;case"LineString":ve(ze.coordinates.length),Me(ze.coordinates);break;case"Polygon":ve(ze.coordinates.length);for(const Ke of ze.coordinates)ve(Ke.length),Me(Ke);break;case"GeometryCollection":ve(ze.geometries.length);for(const Ke of ze.geometries)Le(Ke);break;default:{const Ke=ze.type.slice(5);ve(ze.coordinates.length);for(const Ue of ze.coordinates)Le({type:Ke,coordinates:Ue})}}};Le(j);const Be=new Uint8Array(le);let We=0;for(const ze of V)Be.set(new Uint8Array(ze.buffer),We),We+=ze.byteLength;return Be}const U=/^0[01](?:[0-9a-fA-F]{2})+$/,A=/^[A-Za-z0-9+/_-]+={0,2}$/,ae=(()=>{const $=new Int16Array(128).fill(-1),j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let V=0;V<j.length;V++)$[j.charCodeAt(V)]=V;return $[45]=62,$[95]=63,$})();function d($){const j=new Uint8Array($.length/2);for(let V=0;V<j.length;V++)j[V]=parseInt($.slice(V*2,V*2+2),16);return j}function t($){const j=$.replace(/=+$/,""),V=new Uint8Array(Math.floor(j.length*3/4));let le=0,Se=0,ve=0;for(let Me=0;Me<j.length;Me++)Se=Se<<6|ae[j.charCodeAt(Me)],le+=6,le>=8&&(le-=8,V[ve++]=Se>>le&255);return V.subarray(0,ve)}function k($){const j=$.trim();if(j==="")return null;if(j[0]==="{"){let V;try{V=JSON.parse(j)}catch{return p("the text starts like GeoJSON but is not valid JSON")}return i(V,0)}if(U.test(j))return fe(d(j));if(o.test(j))return n(j);if(A.test(j)){const V=t(j);if(V.length>=5&&(V[0]===0||V[0]===1))return fe(V)}return p("the text is not WKT, GeoJSON, or hex or base64 WKB")}const v=new WeakSet;function F($){if(X($))return{geometry:null,reason:null};if(typeof $=="object"&&v.has($))return{geometry:$,reason:null};try{let j;return typeof $=="string"?j=k($):$ instanceof Uint8Array?j=fe($):$ instanceof ArrayBuffer?j=fe(new Uint8Array($)):ArrayBuffer.isView($)?j=fe(new Uint8Array($.buffer,$.byteOffset,$.byteLength)):s($)?j=i($,0):p(`${Array.isArray($)?"an array":`a ${typeof $}`} is not a geometry`),j&&E(j),{geometry:j||null,reason:null}}catch(j){if(j instanceof T)return{geometry:null,reason:j.message};throw j}}function E($){if(v.add($),$.type==="GeometryCollection")for(const j of $.geometries)E(j)}function oe($){return F($).geometry}function te($,j){switch($.type){case"Point":j($.coordinates);break;case"MultiPoint":case"LineString":$.coordinates.forEach(j);break;case"MultiLineString":case"Polygon":for(const V of $.coordinates)V.forEach(j);break;case"MultiPolygon":for(const V of $.coordinates)for(const le of V)le.forEach(j);break;default:for(const V of $.geometries)te(V,j)}}function N($,j){const V=$[1]*ie,le=j[1]*ie,Se=le-V,ve=(j[0]-$[0])*ie,Me=Math.sin(Se/2)**2+Math.cos(V)*Math.cos(le)*Math.sin(ve/2)**2;return 2*G*Math.asin(Math.min(1,Math.sqrt(Me)))}function K($){let j=0;for(let V=1;V<$.length;V++)j+=N($[V-1],$[V]);return j}function ne($){const j=$.length-1;if(j<3)return 0;let V=0;for(let le=0;le<j;le++){const Se=$[(le-1+j)%j],ve=$[(le+1)%j];V+=(ve[0]-Se[0])*ie*Math.sin($[le][1]*ie)}return Math.abs(V)*G*G/2}function ge($){let j=ne($[0]);for(let V=1;V<$.length;V++)j-=ne($[V]);return Math.max(0,j)}function re($){let j=0,V=0,le=0;for(let Se=0;Se<$.length-1;Se++){const[ve,Me]=$[Se],[Le,Be]=$[Se+1],We=ve*Be-Le*Me;j+=We,V+=(ve+Le)*We,le+=(Me+Be)*We}return{a:j,cx:V,cy:le}}function L(){let $=0,j=0,V=0;return{add(le,Se,ve){$+=le*ve,j+=Se*ve,V+=ve},get(){return V>0?[$/V,j/V]:null}}}function Q($){let j=0,V=0;for(const le of $)j+=le[0],V+=le[1];return[j/$.length,V/$.length]}function g($,j){switch($.type){case"Point":j[0].add($.coordinates[0],$.coordinates[1],1);break;case"MultiPoint":for(const V of $.coordinates)j[0].add(V[0],V[1],1);break;case"LineString":case"MultiLineString":{const V=$.type==="LineString"?[$.coordinates]:$.coordinates;for(const le of V){for(let Se=1;Se<le.length;Se++){const[ve,Me]=le[Se-1],[Le,Be]=le[Se],We=Math.hypot(Le-ve,Be-Me);j[1].add((ve+Le)/2,(Me+Be)/2,We)}for(const Se of le)j[0].add(Se[0],Se[1],1)}break}case"Polygon":case"MultiPolygon":{const V=$.type==="Polygon"?[$.coordinates]:$.coordinates;for(const le of V){let Se=0,ve=0,Me=0;le.forEach((Be,We)=>{const ze=re(Be),Ke=(We===0?1:-1)*(ze.a<0?-1:1);Se+=Ke*ze.a,ve+=Ke*ze.cx,Me+=Ke*ze.cy}),Math.abs(Se)>S&&j[2].add(ve/(3*Se),Me/(3*Se),Math.abs(Se)/2);const Le=le[0].slice(0,-1);for(const Be of Le)j[0].add(Be[0],Be[1],1)}break}default:for(const V of $.geometries)g(V,j)}}const h=new WeakMap;function I($){const j=oe($);if(!j)return null;const V=h.get(j);if(V)return V;const le=[1/0,1/0,-1/0,-1/0];te(j,ze=>{ze[0]<le[0]&&(le[0]=ze[0]),ze[1]<le[1]&&(le[1]=ze[1]),ze[0]>le[2]&&(le[2]=ze[0]),ze[1]>le[3]&&(le[3]=ze[1])});const Se=[L(),L(),L()];g(j,Se);const ve=Se[2].get()||Se[1].get()||Se[0].get()||Q([[le[0],le[1]],[le[2],le[3]]]);let Me=0,Le=0;const Be=ze=>{switch(ze.type){case"LineString":Me+=K(ze.coordinates);break;case"MultiLineString":for(const Ke of ze.coordinates)Me+=K(Ke);break;case"Polygon":Le+=ge(ze.coordinates);for(const Ke of ze.coordinates)Me+=K(Ke);break;case"MultiPolygon":for(const Ke of ze.coordinates){Le+=ge(Ke);for(const Ue of Ke)Me+=K(Ue)}break;case"GeometryCollection":for(const Ke of ze.geometries)Be(Ke);break;default:break}};Be(j);const We=Object.freeze({kind:j.type,bbox:Object.freeze(le),centroid:Object.freeze(ve),length:Me,area:Le});return h.set(j,We),We}function f($){const j=I($);return j?j.kind:null}function z($,j){const V=typeof $=="string"?$.split(/[\s,;]+/).filter(Boolean):$;if(!Array.isArray(V)||V.length!==j)return null;const le=V.map(Se=>typeof Se=="number"?Se:typeof Se=="string"?Number(Se):NaN);return le.every(Number.isFinite)?le:null}function e($,j){if($==="withinBbox"){const V=z(j,4);return V?V[0]>V[2]?{reason:'the box crosses the antimeridian (its west edge is east of its east edge), which is not supported; split it into two withinBbox conditions joined by "or"'}:V[1]>V[3]?{reason:"the box's minLat is above its maxLat"}:{operand:V}:{reason:"withinBbox needs [minLon, minLat, maxLon, maxLat]"}}if($==="withinDistance"){let V=null;if(s(j)&&!Array.isArray(j)){const le=j;V=z([le.lon,le.lat,le.metres],3)}else V=z(j,3);return!V||V[2]<0?{reason:"withinDistance needs { lon, lat, metres } with metres of 0 or more"}:{operand:{lon:V[0],lat:V[1],metres:V[2]}}}if($==="withinPolygon"||$==="intersects"){const V=$==="intersects"?z(j,4):null;if(V){if(V[0]>V[2]||V[1]>V[3])return{reason:"the box's minimum is above its maximum"};const[ve,Me,Le,Be]=V;return{operand:{type:"Polygon",coordinates:[[[ve,Me],[Le,Me],[Le,Be],[ve,Be],[ve,Me]]]}}}const{geometry:le,reason:Se}=F(j);return le?$==="withinPolygon"&&le.type!=="Polygon"&&le.type!=="MultiPolygon"?{reason:`withinPolygon needs a Polygon or MultiPolygon, not a ${le.type}`}:{operand:le}:{reason:`${$} needs a geometry: ${Se||"none was given"}`}}return{reason:`"${$}" is not a spatial operator`}}function y($,j){const[V,le]=$;let Se=!1;for(let ve=0,Me=j.length-2;ve<j.length-1;Me=ve++){const[Le,Be]=j[ve],[We,ze]=j[Me];Be>le!=ze>le&&V<(We-Le)*(le-Be)/(ze-Be)+Le&&(Se=!Se)}return Se}function u($,j){if(!y($,j[0]))return!1;for(let V=1;V<j.length;V++)if(y($,j[V]))return!1;return!0}function C($,j={points:[],segments:[],polygons:[]}){const V=le=>{for(let Se=1;Se<le.length;Se++)j.segments.push([le[Se-1],le[Se]]);for(const Se of le)j.points.push(Se)};switch($.type){case"Point":j.points.push($.coordinates);break;case"MultiPoint":for(const le of $.coordinates)j.points.push(le);break;case"LineString":V($.coordinates);break;case"MultiLineString":$.coordinates.forEach(V);break;case"Polygon":j.polygons.push($.coordinates),$.coordinates.forEach(V);break;case"MultiPolygon":for(const le of $.coordinates)j.polygons.push(le),le.forEach(V);break;default:for(const le of $.geometries)C(le,j)}return j}function Y($,j,V){const le=(j[0]-$[0])*(V[1]-$[1])-(j[1]-$[1])*(V[0]-$[0]);return Math.abs(le)<=S?0:Math.sign(le)}function H($,j,V){return $[0]>=Math.min(j[0],V[0])-S&&$[0]<=Math.max(j[0],V[0])+S&&$[1]>=Math.min(j[1],V[1])-S&&$[1]<=Math.max(j[1],V[1])+S}function P($,j){const[V,le]=$,[Se,ve]=j,Me=Y(V,le,Se),Le=Y(V,le,ve),Be=Y(Se,ve,V),We=Y(Se,ve,le);return Me!==Le&&Be!==We?!0:Me===0&&H(Se,V,le)||Le===0&&H(ve,V,le)||Be===0&&H(V,Se,ve)||We===0&&H(le,Se,ve)}function Z($,j){return $[0]<=j[2]&&j[0]<=$[2]&&$[1]<=j[3]&&j[1]<=$[3]}function pe($,j){const V=I($),le=I(j);if(!Z(V.bbox,le.bbox))return!1;const Se=C($),ve=C(j);for(const Me of ve.polygons)for(const Le of Se.points)if(u(Le,Me))return!0;for(const Me of Se.polygons)for(const Le of ve.points)if(u(Le,Me))return!0;for(const Me of Se.segments)for(const Le of ve.segments)if(P(Me,Le))return!0;for(const Me of Se.points){for(const Le of ve.points)if(Math.abs(Me[0]-Le[0])<=S&&Math.abs(Me[1]-Le[1])<=S)return!0;for(const Le of ve.segments)if(Y(Le[0],Le[1],Me)===0&&H(Me,Le[0],Le[1]))return!0}for(const Me of ve.points)for(const Le of Se.segments)if(Y(Le[0],Le[1],Me)===0&&H(Me,Le[0],Le[1]))return!0;return!1}function $e($,j){const{operand:V,reason:le}=e($,j);if(le)return ye(`filter:geometry:${$}`,`a "${$}" condition was refused: ${le}. It matches no row rather than guessing.`),()=>!1;switch($){case"withinBbox":return Se=>{const ve=I(Se);if(!ve)return!1;const Me=ve.bbox;return Me[0]>=V[0]&&Me[1]>=V[1]&&Me[2]<=V[2]&&Me[3]<=V[3]};case"withinPolygon":{const Se=V.type==="Polygon"?[V.coordinates]:V.coordinates,ve=Me=>Se.some(Le=>u(Me,Le));return Me=>{const Le=oe(Me);return Le?Le.type==="Point"?ve(Le.coordinates):Le.type==="MultiPoint"?Le.coordinates.every(ve):ve(I(Le).centroid):!1}}case"intersects":return Se=>{const ve=oe(Se);return!!ve&&pe(ve,V)};default:{const Se=[V.lon,V.lat];return ve=>{const Me=I(ve);return!!Me&&N(Me.centroid,Se)<=V.metres}}}}}),Xe("packages/core/src/source/filterwire.js",function(r,me){"use strict";Object.defineProperty(r,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(r,"warnWherePageRelative",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return he}}),Object.defineProperty(r,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return _}}),Object.defineProperty(r,"warnWhereNotApplied",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"warnWhereOverThreshold",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(r,"parseRelativeToken",{enumerable:!0,get:function(){return a}}),Object.defineProperty(r,"resolveRelativeRange",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"relativeTokenOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(r,"relativeTokenHelp",{enumerable:!0,get:function(){return o}}),Object.defineProperty(r,"isResolvableRelative",{enumerable:!0,get:function(){return O}}),Object.defineProperty(r,"resolveRelativeCondition",{enumerable:!0,get:function(){return n}}),Object.defineProperty(r,"isGroup",{enumerable:!0,get:function(){return x}}),Object.defineProperty(r,"forEachCondition",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"mapConditions",{enumerable:!0,get:function(){return B}}),Object.defineProperty(r,"normaliseFilterSet",{enumerable:!0,get:function(){return J}}),Object.defineProperty(r,"buildFilterSet",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(r,"wireFilters",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(r,"querySignature",{enumerable:!0,get:function(){return fe}});const X=me("packages/core/src/internal/util.js").warnOnce,s="source.remote.hostFilter",ye="source.where.pageRelative";function se(A,ae){!Array.isArray(A)||!A.length||X(ye,`filters.where (${A.join(", ")}) runs over the rows the ${ae} 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 he(A){const ae=(A||{}).config;!ae||!ae.hostFilter||X(s,"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 _="source.where.notApplied";function G(A,ae){X(`${_}:${A}`,`filters.where("${A}") is registered but the ${ae} 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 ie="source.where.overThreshold";function W(A,ae,d,t){!Array.isArray(A)||!A.length||X(`${ie}:${ae}`,`filters.where (${A.join(", ")}) is not applied to the ${ae} pushdown source:`,d===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${d.toLocaleString()} rows, at or past the whereRowLimit of ${t.toLocaleString()}.`,"Running the predicate needs every matching row fetched and held here, which is the whole","download a pushdown source exists to avoid, so it is refused and the rows the predicate","would exclude stay on screen.","Give the predicate a { condition } twin so the engine narrows the fetch itself — that is the","route that works at any size — or raise `whereRowLimit` on the source config if you want the","download.")}const S=new Map;function T(A){let ae=S.get(A);return ae||(ae=new Intl.DateTimeFormat("en-US",{timeZone:A,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),S.set(A,ae)),ae}function p(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function R(A,ae){const d=T(ae).formatToParts(new Date(A)),t={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const k of d)k.type==="year"?t.y=+k.value:k.type==="month"?t.m=+k.value:k.type==="day"?t.d=+k.value:k.type==="hour"?t.h=+k.value%24:k.type==="minute"?t.mi=+k.value:k.type==="second"&&(t.s=+k.value);return t}function M(A,ae){const d=R(A,ae);return Date.UTC(d.y,d.m-1,d.d,d.h,d.mi,d.s)-Math.floor(A/1e3)*1e3}function c(A,ae,d,t){const k=Date.UTC(A,ae-1,d),v=k-M(k,t);return k-M(v,t)}function l(A,ae,d){const t=new Date(Date.UTC(A.y,A.m-1,A.d+ae));return c(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate(),d)}const i=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function a(A,ae){if(typeof A!="string")return null;const d=A.trim().toLowerCase().replace(/[\s_-]+/g,""),t=/^last(\d*|n)days?$/.exec(d);if(t){const k=t[1]==="n"?"":t[1],v=Number(k||ae);return!Number.isFinite(v)||v<=0?null:{kind:"lastNDays",n:Math.floor(v)}}switch(d){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 w(A,ae={}){const d=a(A,ae.n);if(!d)return null;const t=ae.tz||p(),k=ae.now instanceof Date?ae.now.getTime():typeof ae.now=="number"?ae.now:Date.now(),v=R(k,t),F=c(v.y,v.m,v.d,t),E=l(v,1,t);let oe=F,te=E;switch(d.kind){case"today":break;case"yesterday":oe=l(v,-1,t),te=F;break;case"lastNDays":te=ae.includeToday?E:F,oe=l(v,ae.includeToday?-(d.n-1):-d.n,t);break;case"thisWeek":{const N=Number.isFinite(ae.weekStartsOn)?Number(ae.weekStartsOn):1,ne=(new Date(Date.UTC(v.y,v.m-1,v.d)).getUTCDay()-N+7)%7;oe=l(v,-ne,t),te=l(v,-ne+7,t);break}case"thisMonth":oe=c(v.y,v.m,1,t),te=c(v.m===12?v.y+1:v.y,v.m===12?1:v.m+1,1,t);break;case"thisQuarter":case"quarterToDate":{const N=Math.floor((v.m-1)/3)*3+1;oe=c(v.y,N,1,t),te=d.kind==="quarterToDate"?E:N===10?c(v.y+1,1,1,t):c(v.y,N+3,1,t);break}case"thisYear":case"yearToDate":oe=c(v.y,1,1,t),te=d.kind==="yearToDate"?E:c(v.y+1,1,1,t);break;default:return null}return{from:new Date(oe).toISOString(),to:new Date(te).toISOString(),bounds:"[)",tz:t,relative:d.kind==="lastNDays"?`last${d.n}Days`:d.kind,n:d.n}}function b(A){if(!A||typeof A!="object")return null;const ae=A.value;if(ae&&typeof ae=="object"&&!Array.isArray(ae)&&"relative"in ae)return{token:String(ae.relative),n:typeof ae.n=="number"?ae.n:void 0};if(A.op==="relative"&&typeof A.value=="string")return{token:A.value,n:void 0};const d=A.meta;return d&&typeof d.relative=="string"&&A.value===void 0?{token:d.relative,n:typeof d.n=="number"?d.n:void 0}:null}function o(){return`Known tokens: ${i.filter(ae=>ae!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function O(A){const ae=b(A);return ae?a(ae.token,ae.n)!==null:!1}function n(A,ae={}){const d=b(A);if(!d)return A;const t=w(d.token,{...ae,n:d.n});return t?{...A,type:A.type||"date",op:"between",value:[t.from,t.to],bounds:A.bounds||t.bounds,meta:{...A.meta||{},relative:t.relative,tz:t.tz}}:(X(`source.relative.${d.token}`,`unknown relative date token "${d.token}"; sending the condition unresolved.`,o()),A)}function x(A){return!!A&&typeof A=="object"&&Array.isArray(A.conditions)}function D(A,ae){if(A){if(x(A)){for(const d of A.conditions)D(d,ae);return}ae(A)}}function B(A,ae){if(!A)return null;if(!x(A))return ae(A);const d=A;let t=!1;const k=[];for(const v of d.conditions){const F=B(v,ae);F!==v&&(t=!0),F&&k.push(F)}return!t&&k.length===d.conditions.length?A:k.length?{...d,conditions:k}:null}function q(A){if(!A)return null;if(!x(A))return A;const ae=A,d=[];for(const t of ae.conditions){const k=q(t);k&&d.push(k)}return d.length?{op:ae.op,conditions:d}:null}function J(A){const ae=q(A);return ae?x(ae)&&ae.op==="and"?ae:{op:"and",conditions:[ae]}:null}function ee(A){const ae=(A||[]).filter(Boolean);return ae.length?{op:"and",conditions:ae}:null}function ue(A,ae={}){const d=B(A,t=>n(t,ae));return J(d)}function fe(A){const ae=de(A.filters??null);return JSON.stringify([ae,A.sort??null,A.quick??"",A.groupBy??null,A.pivotBy??null,U(A.context)])}function de(A){if(!A)return null;if(x(A)){const t=A;return{op:t.op,conditions:t.conditions.map(de)}}const ae=A,d=ae.meta&&typeof ae.meta.relative=="string"?ae.meta.relative:b(ae)?.token;return{col:ae.col,op:ae.op,bounds:ae.bounds??null,caseSensitive:ae.caseSensitive??!1,value:d?`rel:${d}`:ae.value??null}}function U(A){if(A==null)return null;try{return JSON.parse(JSON.stringify(A))}catch{return X("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),Xe("packages/core/src/source/aggregates.js",function(r,me){"use strict";Object.defineProperty(r,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"pushableAggregates",{enumerable:!0,get:function(){return X}}),Object.defineProperty(r,"fillAggregateSql",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"resolveAggregatesConfig",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(r,"routeAggregate",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"resolveAggregatePlan",{enumerable:!0,get:function(){return he}}),Object.defineProperty(r,"groupKeysPushable",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"pushdownDocRows",{enumerable:!0,get:function(){return ie}});const we=Object.freeze({sum:{pushable:!0,class:"identical",sql:"sum(%c)"},avg:{pushable:!0,class:"identical",sql:"avg(%c)"},min:{pushable:!0,class:"identical",sql:"min(%c)"},max:{pushable:!0,class:"identical",sql:"max(%c)"},count:{pushable:!0,class:"identical",sql:"count(*)"},countValues:{pushable:!0,class:"identical",sql:"count(%c)",blankAware:!0},range:{pushable:!0,class:"identical",sql:"(max(%c) - min(%c))"},variance:{pushable:!0,class:"identical",sql:"var_samp(%c)"},varianceP:{pushable:!0,class:"identical",sql:"var_pop(%c)"},stddev:{pushable:!0,class:"identical",sql:"stddev_samp(%c)"},stddevP:{pushable:!0,class:"identical",sql:"stddev_pop(%c)"},sumSquares:{pushable:!0,class:"identical",sql:"sum(%c * %c)"},median:{pushable:!0,class:"identical",sql:"median(%c)"},p25:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.25)"},p75:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.75)"},p90:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.9)"},p95:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.95)"},p99:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.99)"},iqr:{pushable:!0,class:"identical",sql:"(quantile_cont(%c, 0.75) - quantile_cont(%c, 0.25))"},mad:{pushable:!0,class:"identical",sql:"mad(%c)"},distinct:{pushable:!0,class:"identical",sql:"count(DISTINCT %c)",blankAware:!0},skewness:{pushable:!0,class:"identical",sql:"skewness(%c)"},kurtosis:{pushable:!0,class:"identical",sql:"kurtosis(%c)"},geomean:{pushable:!0,class:"identical",sql:"exp(avg(ln(%c)))"},harmean:{pushable:!0,class:"identical",sql:"(count(%c) / sum(1.0 / %c))"},entropy:{pushable:!0,class:"identical",sql:"entropy(%c)",blankAware:!0},correlation:{pushable:!0,class:"identical",sql:"corr(%w, %c)",twoColumn:!0},hhi:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_transform(map_values(histogram(%c)), lambda v: (v::DOUBLE/count(%c))*(v::DOUBLE/count(%c)))) END"},evenness:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL WHEN count(DISTINCT %c)<2 THEN 1.0 ELSE entropy(%c)/log2(count(DISTINCT %c)) END"},top3Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,3))::DOUBLE/count(%c) END"},top10Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,10))::DOUBLE/count(%c) END"},gini:{pushable:!0,class:"identical",sql:"CASE WHEN list_min(list(%c) FILTER (WHERE isfinite(%c)))<0 THEN NULL WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL WHEN list_sum(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN 0 ELSE 2.0*list_sum(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v, i: i*v))/(len(list(%c) FILTER (WHERE isfinite(%c)))*list_sum(list(%c) FILTER (WHERE isfinite(%c))))-(len(list(%c) FILTER (WHERE isfinite(%c)))+1.0)/len(list(%c) FILTER (WHERE isfinite(%c))) END"},trimmedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_slice(list_sort(list(%c) FILTER (WHERE isfinite(%c))), floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1, len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT)) END"},winsorizedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v: least(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT], greatest(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1], v)))) END"},robustOutliers:{pushable:!0,class:"identical",sql:"(SELECT CASE WHEN len(d.a)=0 THEN NULL WHEN d.mad=0 THEN NULL ELSE len(list_filter(d.a, lambda v: abs(0.6745*(v-d.med)/d.mad)>3.5)) END FROM (SELECT xs AS a, list_median(xs) AS med, list_median(list_transform(xs, lambda w: abs(w-list_median(xs)))) AS mad FROM (SELECT list(%c) FILTER (WHERE isfinite(%c)) AS xs)) d)"},jarqueBera:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))<8 THEN NULL WHEN list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2)))=0 THEN NULL ELSE (len(list(%c) FILTER (WHERE isfinite(%c)))/6.0)*(power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),3)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),1.5),2)+power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),4)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),2)-3,2)/4.0) END"},weightedAvg:{pushable:!0,class:"identical",twoColumn:!0,sql:"sum(%c*%w) FILTER (WHERE isfinite(%c) AND isfinite(%w))/nullif(sum(%w) FILTER (WHERE isfinite(%c) AND isfinite(%w)),0)"},mode:{pushable:!0,class:"may-differ",sql:"mode(%c)",note:"DuckDB returns a modal value even for an all-distinct column; the grid returns null. Tie-breaking can also differ, and on a text column an empty string counts as a value. Under pushdown you will see a value."},weightedQuantile:{pushable:!1,class:"fallback",note:"No SQL equivalent for the grid's weighted-quantile midpoint convention; always computed client-side (needs a full-dataset pull for a correct figure over a remote source)."}});function X(){const W=new Set;for(const[S,T]of Object.entries(we))T.pushable&&W.add(S);return W}function s(W,S,T){let p=W.split("%c").join(S);return T!==void 0&&(p=p.split("%w").join(T)),p}function ye(W){const S=W||{},T=S.default==="engine"||S.default==="engine-if-identical"?S.default:"client",p={};if(S.overrides&&typeof S.overrides=="object")for(const[R,M]of Object.entries(S.overrides))(M==="engine"||M==="client")&&(p[R]=M);return{default:T,overrides:p}}function se(W,S){const T=we[W];if(!T||!T.pushable)return"client";const p=S.overrides[W];return p==="engine"||p==="client"?p:S.default==="client"?"client":S.default==="engine-if-identical"?T.class==="identical"?"engine":"client":"engine"}function he(W,S){const T=ye(S),p=[],R=[];for(const M of W||[]){const c=we[M.fn],l=se(M.fn,T),i={id:M.id,col:M.col,fn:M.fn,class:c?c.class:"fallback"};M.weight!==void 0&&(i.weight=M.weight),M.params!==void 0&&(i.params=M.params),l==="engine"?p.push(i):(i.reason=c&&!c.pushable?c.note||"the engine cannot express this stat":"client by config",R.push(i))}return{engine:p,client:R,config:T}}const _=/^[A-Za-z_][A-Za-z0-9_$]*$/;function G(W,S=[]){return(W||[]).every(p=>{if(typeof p=="string")return _.test(p);if(!p||typeof p!="object")return!1;const R=p;return Array.isArray(S)&&S.includes(R.bucket)&&typeof R.col=="string"&&_.test(R.col)&&typeof R.size=="number"&&Number.isFinite(R.size)&&R.size>0})}function ie(){return Object.entries(we).map(([W,S])=>({stat:W,class:S.class,sql:S.sql?s(S.sql,"col",S.twoColumn?"weight":void 0):"",note:S.note||(S.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),Xe("packages/core/src/source/abort.js",function(r,me){"use strict";Object.defineProperty(r,"SupersededError",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"RequestToken",{enumerable:!0,get:function(){return X}}),Object.defineProperty(r,"AbortScope",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"createAbortScope",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(r,"isAbortError",{enumerable:!0,get:function(){return se}});class we extends Error{constructor(_,G="superseded"){super(`[lattice] request ${_?`"${_}" `:""}${G}`),this.name="SupersededError",this.superseded=!0,this.key=_}}class X{#e;constructor(_,G,ie,W){this.#e=_,this.key=G,this.controller=ie,this.signal=ie.signal,this.seq=W}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(_){this.signal.aborted||this.controller.abort(new we(this.key,_)),this.#e.settle(this)}}class s{#e=new Map;#t=0;begin(_="",G="superseded"){const ie=this.#e.get(_);ie&&!ie.signal.aborted&&ie.controller.abort(new we(_,G));const W=new X(this,_,new AbortController,++this.#t);return this.#e.set(_,W),W}tokenFor(_){return this.#e.get(_)}pending(_=""){const G=this.#e.get(_);return!!G&&!G.signal.aborted}get size(){return this.#e.size}settle(_){this.#e.get(_.key)===_&&this.#e.delete(_.key)}abort(_="",G="superseded"){const ie=this.#e.get(_);ie&&ie.abort(G)}abortAll(_="superseded"){for(const G of[...this.#e.values()])G.abort(_);this.#e.clear()}}function ye(){return new s}function se(he){if(!he||typeof he!="object")return!1;const _=he;return _.superseded===!0||_.name==="AbortError"||_.name==="SupersededError"}}),Xe("packages/core/src/source/pushdown.js",function(r,me){"use strict";Object.defineProperty(r,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(r,"NO_CAPABILITIES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(r,"resolveMutate",{enumerable:!0,get:function(){return a}}),Object.defineProperty(r,"capabilitiesOf",{enumerable:!0,get:function(){return o}}),Object.defineProperty(r,"splitFilters",{enumerable:!0,get:function(){return n}}),Object.defineProperty(r,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return x}}),Object.defineProperty(r,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return J}}),Object.defineProperty(r,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(r,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(r,"planQuery",{enumerable:!0,get:function(){return de}}),Object.defineProperty(r,"applyResidual",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(r,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return v}}),Object.defineProperty(r,"createPushdownSource",{enumerable:!0,get:function(){return te}});const we=me("packages/core/src/internal/util.js"),X=we.defaultCompare,s=we.isFunction,ye=we.toArray,se=we.warnOnce,he=me("packages/core/src/source/filterwire.js"),_=he.isGroup,G=he.warnWherePageRelative,ie=he.warnWhereOverThreshold,W=me("packages/core/src/source/aggregates.js"),S=W.resolveAggregatePlan,T=W.groupKeysPushable,p=W.STAT_PUSHDOWN,M=me("packages/core/src/source/abort.js").SupersededError,c=1e3;function l(N){const K=N&&N.signal;if(!K||!K.aborted)return;const ne=K.reason;throw ne instanceof Error?ne:new M("","superseded before it was sent")}const i=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function a(N){if(!N||typeof N!="object")return!1;const K=N.returning==="row"||N.returning==="key"?N.returning:"none";return{append:N.append===!0,update:N.update===!0,delete:N.delete===!0,returning:K}}function w(N,K){if(!N||typeof K!="string")return;if(!K.includes("."))return N[K];let ne=N;for(const ge of K.split(".")){if(ne===null||typeof ne!="object")return;ne=ne[ge]}return ne}function b(N){if(N===!0)return!0;if(!N||typeof N!="object")return!1;const K=N;return K.enabled===!1?!1:K.enabled===!0||s(K.commit)}function o(N){const K={...i,...N||{}};return K.operators=new Set(K.operators||[]),K.mutate=a(K.mutate),K}function O(N,K){return!N||!N.op||!K.operators.size?!1:K.operators.has(N.op)}function n(N,K){if(!N)return{pushed:null,residual:null};if(!K.filter)return{pushed:null,residual:N};if(K.filter==="term"){if(_(N)){const L=N.conditions||[];if(String(N.op)!=="and")return{pushed:null,residual:N};const Q=L.findIndex(h=>!_(h)&&O(h,K));if(Q<0)return{pushed:null,residual:N};const g=L.filter((h,I)=>I!==Q);return{pushed:L[Q],residual:g.length?{op:"and",conditions:g}:null}}return O(N,K)?{pushed:N,residual:null}:{pushed:null,residual:N}}if(!_(N))return O(N,K)?{pushed:N,residual:null}:{pushed:null,residual:N};if(String(N.op)!=="and")return(N.conditions||[]).every(Q=>_(Q)?n(Q,K).residual===null:O(Q,K))?{pushed:N,residual:null}:{pushed:null,residual:N};const ne=[],ge=[];for(const L of N.conditions||[]){if(_(L)){if(K.filter==="flat"){ge.push(L);continue}const Q=n(L,K);Q.pushed&&ne.push(Q.pushed),Q.residual&&ge.push(Q.residual);continue}(O(L,K)?ne:ge).push(L)}const re=L=>L.length===0?null:L.length===1?L[0]:{op:"and",conditions:L};return{pushed:re(ne),residual:re(ge)}}const x="__lattice_leaves";function D(N){return N.aggregates?N.aggregates instanceof Set?N.aggregates:new Set(ye(N.aggregates)):new Set}function B(N){const K=D(N);return K.size?K.has("count")?N.filter!=="tree"||!N.operators||!N.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 q(N,K,ne,ge,re,L,Q){const g=Array.isArray(N.groupBy)?N.groupBy:[],h=Array.isArray(N.groupPath)?N.groupPath:[],I=Array.isArray(N.groupValues)?N.groupValues:null;if(!K.group){const f=B(K);if(f)return f}return T(g)?ne.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":ge?re?L?"a host `where` predicate can only run in the browser, over rows the engine grouped":Q?"fullDataset holds the whole matching set, so the grid groups it itself":!I||I.length!==h.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 J="pushdown:pivot-unsupported",ee="pushdown:group-unsupported",ue=Symbol("lattice.remote.ungroupedLevel");function fe(N,K,ne,ge,re,L){const Q=Array.isArray(N.pivotBy)?N.pivotBy:[],g=Array.isArray(N.groupBy)?N.groupBy:[],h=Array.isArray(N.groupPath)?N.groupPath:[],I=Array.isArray(N.groupValues)?N.groupValues:null;return K.pivot?T(Q)?g.length&&!T(g)?"a grouping key is not a plain column the engine can name in a GROUP BY":ne.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":ge?re?L?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!I||I.length!==h.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 de(N,K,ne=!1){const ge=n(N.filters||null,K),re=[];ge.residual&&re.push("filter");const L=N.sort||[],Q=L.length===0||K.sort==="multi"&&L.length>=1||K.sort==="single"&&L.length===1;!Q&&L.length&&re.push("sort");const g=N.quick?String(N.quick):"",h=!g||!!K.quick;h||re.push("quick");const I=N.where&&N.where.active?N.where:null;I&&re.push("where");const f={filters:ge.residual,sort:Q?null:L,quick:h?"":g,where:I},z=!!ne,e=Array.isArray(N.groupBy)&&N.groupBy.length>0,y=e?q(N,K,ge,Q,h,I,z):"",u=N.pivotMode!==!1&&Array.isArray(N.pivotBy)&&N.pivotBy.length>0,C=u?fe(N,K,ge,Q,h,I):"",Y=u&&C==="";u&&!Y&&re.push("pivot");const H=u?Y&&e:e&&y==="";e&&!u&&!H&&re.push("group");const P=(H||Y)&&Array.isArray(N.groupValues)?N.groupValues.length:0,Z=H||u?!1:z||!!(f.filters||f.sort||f.quick||f.where)||!K.range;return{pushed:{...N,filters:ge.pushed,sort:Q?L:[],quick:h?g:"",range:Z?null:N.range},residual:f,needsAll:Z,unpushed:re,full:z,grouped:H,groupLevel:P,groupReason:u?"":y,pivoted:Y,pivotReason:C}}function U(N){const K=Array.isArray(N.totals)?N.totals:[],ne=N.totalFns&&typeof N.totalFns=="object"?N.totalFns:{},ge=[],re=[];for(const L of K){const Q=String(L),g=typeof ne[Q]=="string"?ne[Q]:null,h=g?p[g]:null;g?!h||!h.pushable||!h.sql?re.push({id:Q,fn:g,class:h?h.class:"fallback",reason:h&&h.note?h.note:`the pushdown map cannot express "${g}"`}):h.twoColumn?re.push({id:Q,fn:g,class:h.class,reason:`"${g}" reduces two columns, and a grouped request carries no weight column`}):ge.push({id:Q,col:Q,fn:g,class:h.class}):re.push({id:Q,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:ge,client:re}}const A=Object.freeze({items:N=>N==null?[]:Array.isArray(N)?N:[N]});function ae(N,K,ne){if(!K)return N;let ge=N;if(K.filters&&s(ne.evaluateFilters)){const re=ge,L={count:ge.length,handle:h=>({id:h,get:I=>w(re[I],h)}),itemwise:h=>re.some(I=>Array.isArray(w(I,h)))?A:null},Q=ne.evaluateFilters(K.filters,L),g=[];for(let h=0;h<ge.length;h++)Q[h]&&g.push(ge[h]);ge=g}if(K.where&&K.where.active&&(K.whole||G(K.where.names,"pushdown"),ge=ge.filter(re=>K.where.passes(re))),K.quick){const re=K.quick.toLowerCase();ge=ge.filter(L=>{if(!L||typeof L!="object")return!1;for(const Q of Object.values(L))if(Q!=null&&String(Q).toLowerCase().includes(re))return!0;return!1})}if(K.sort&&K.sort.length&&s(ne.sortMulti)){const re=[...new Set(K.sort.map(h=>h.col))],L=ge,Q=re.map(h=>({id:h,get:I=>w(L[I],h)})),g=ne.sortMulti(Q,K.sort.map(h=>({col:h.col,dir:h.dir})),Uint32Array.from({length:ge.length},(h,I)=>I),{});ge=Array.from(g,h=>L[h])}return ge}function d(N){return JSON.stringify({filters:N.filters||null,sort:N.sort||[],quick:N.quick||"",groupBy:N.groupBy||[],groupPath:N.groupPath||[],context:N.context??null})}function t(N){if(!N||typeof N!="object")return 16;let K="";try{K=JSON.stringify(N)}catch{return 200}return K.length*2+64}function k(N){const K=N||{};return{enabled:!!K.enabled,maxRows:Number.isFinite(K.maxRows)?K.maxRows:1e6,maxBytesEstimate:Number.isFinite(K.maxBytesEstimate)?K.maxBytesEstimate:512*1024*1024}}const v=5e4;function F(N){return Number.isFinite(N)&&N>=0?N:v}function E(N){return!!N&&s(N.then)}async function oe(N){if(!N||N.total!==void 0||!E(N.pendingTotal))return N;const K=await N.pendingTotal,{pendingTotal:ne,...ge}=N;return typeof K=="number"?{...ge,total:K}:ge}function te(N={}){const K=N.adapter;if(!K||!s(K.execute))return se("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...N,mode:"remote",fetch:async()=>({rows:[],total:0})};const ne=o(K.capabilities),ge=K.capabilities&&Object.getOwnPropertyDescriptor(K.capabilities,"operators");ge&&s(ge.get)&&Object.defineProperty(ne,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(K.capabilities.operators||[]),set:()=>{}});const re=K.name||"adapter";let L=null;const Q=()=>s(K.ready)?(L||(L=Promise.resolve(K.ready()).then(()=>{Object.assign(ne,o(K.capabilities))},Ie=>{throw L=null,Ie})),L):null,g=k(N.fullDataset),h=!!N.allowPartialResults,I=F(N.whereRowLimit);let f=null;const z=N.aggregates;let e=null,y=null,u=null,C=null,Y=null,H,P=null,Z=0,pe=null;const $e=()=>!g.enabled||!e?null:(pe!==e.key&&(Z++,pe=e.key),{rows:e.rows,version:Z}),$=async Ie=>{const Te=Ie.where&&Ie.where.active?Ie.where:null;if(!Te)return{request:Ie,probe:null};const{where:qe,...He}=Ie,Re=de(He,ne,g.enabled);if(Re.needsAll)return{request:Ie,probe:null};const et=d(Re.pushed);let tt=null;return(!f||f.key!==et)&&(ne.total?(l(Ie),tt=await oe(await K.execute(Re.pushed,Ie)),f={key:et,size:tt&&typeof tt.total=="number"?tt.total:null}):f={key:et,size:null}),f.size!==null&&f.size<I?{request:Ie,probe:null}:(ie(Te.names,re,f.size,I),{request:He,probe:tt})},j=async(Ie,Te)=>{P=null;const qe=U(Ie.pushed);u={engine:qe.engine,client:qe.client,groupBy:Ie.pushed.groupBy},qe.client.length&&se(`source.pushdown.group.totals.${re}.${qe.client.map(et=>et.id).join(".")}`,`the ${re} adapter cannot compute the group subtotal for ${qe.client.map(et=>`"${et.id}" (${et.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 He=await K.executeGroupLevel(Ie.pushed,qe.engine,Te)||{};let Re=He.rows||[];return!ne.range&&Te.range&&(Re=Re.slice(Te.range.start,Te.range.end)),ve(He),He.total===void 0?{rows:Re}:{rows:Re,total:He.total}},V=new Map,le=64,Se=async(Ie,Te)=>{P=null;const qe=Ie.pushed,He=qe.groupBy,Re=Array.isArray(qe.groupValues)?qe.groupValues:[],et=Re.length,tt=[...qe.filters?[qe.filters]:[],...He.slice(0,et).map((Pe,Ge)=>({col:Pe,op:"eq",value:Re[Ge]===void 0?null:Re[Ge],caseSensitive:!0}))],at=tt.length===0?null:tt.length===1?tt[0]:{op:"and",conditions:tt},ct=Te.range?Te.range.start:0;if(et>=He.length){const Pe={...qe,filters:at,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},Ge=await oe(await K.execute(Pe,Te))||{};let Ce=Ge.rows||[];return!ne.range&&Te.range&&(Ce=Ce.slice(Te.range.start,Te.range.end)),typeof Ge.total=="number"?{rows:Ce,total:Ge.total}:{rows:Ce}}const st=He[et],wt=U(qe),pt=D(ne),kt=wt.engine.filter(Pe=>pt.has(Pe.fn)),Nt=[...wt.engine.filter(Pe=>!pt.has(Pe.fn)).map(Pe=>({id:Pe.id,fn:Pe.fn,class:Pe.class,reason:`the ${re} adapter does not compute "${Pe.fn}"`})),...wt.client];u={engine:kt,client:Nt,groupBy:He},Nt.length&&se(`source.pushdown.group.totals.${re}.${Nt.map(Pe=>Pe.id).join(".")}`,`the ${re} adapter cannot compute the group subtotal for ${Nt.map(Pe=>`"${Pe.id}" (${Pe.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 lt=[...kt.map(Pe=>({id:Pe.id,col:Pe.col,fn:Pe.fn})),{id:x,col:st,fn:"count"}],ht={...qe,filters:at,range:null},Tt=JSON.stringify([d(ht),Re,st,lt]);let Lt=ct>0?V.get(Tt):void 0;if(!Lt){for(Lt=Promise.resolve(K.executeGroupedAggregates(ht,[st],lt)),V.delete(Tt),V.set(Tt,Lt);V.size>le;)V.delete(V.keys().next().value);Lt.catch(()=>{V.get(Tt)===Lt&&V.delete(Tt)})}const Wt=await Lt||[];l(Te);const Gt=Pe=>{const Ge={};for(const Ce of kt)Ge[Ce.id]=Pe?Pe[Ce.id]:void 0;return Ge},Qt=(qe.sort||[]).find(Pe=>Pe&&Pe.col===st),en=Qt&&Qt.dir==="desc"?-1:1,Ut=Wt.filter(Pe=>Pe&&Pe.level===1).map(Pe=>({[st]:Pe.keys[0]===void 0?null:Pe.keys[0],leafCount:Number(Pe.values&&Pe.values[x])||0,totals:Gt(Pe.values)})).sort((Pe,Ge)=>en*X(Pe[st],Ge[st]));if(et===0){const Pe=Wt.find(Ce=>Ce&&Ce.level===0),Ge=Pe?Number(Pe.values&&Pe.values[x]):NaN;ve({matchCount:Number.isFinite(Ge)?Ge:Ut.reduce((Ce,Je)=>Ce+Je.leafCount,0),...Pe?{grand:Gt(Pe.values)}:{}})}const Ne=Te.range?Te.range.end:Ut.length;return{rows:Ut.slice(ct,Ne),total:Ut.length}},ve=Ie=>{typeof Ie.matchCount=="number"&&(C=Ie.matchCount,Y=Ie.grand?{totals:Ie.grand,leafCount:Ie.matchCount}:null,H===void 0&&s(K.unfilteredCount)&&(H=null,Promise.resolve(K.unfilteredCount()).then(Te=>{H=typeof Te=="number"?Te:null}).catch(Te=>{se(`source.pushdown.group.unfiltered.${re}`,`the ${re} adapter could not count the unfiltered set (${Te&&Te.message?Te.message:Te}), so "N of M" falls back to the display count for its denominator.`)})))},Me=async(Ie,Te)=>{P=null;const qe=U(Ie.pushed);u={engine:qe.engine,client:qe.client,groupBy:Ie.pushed.groupBy,pivotBy:Ie.pushed.pivotBy},qe.client.length&&se(`source.pushdown.pivot.totals.${re}.${qe.client.map(at=>at.id).join(".")}`,`the ${re} adapter cannot compute the pivot cells for ${qe.client.map(at=>`"${at.id}" (${at.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 He=await K.executePivotLevel(Ie.pushed,qe.engine,Te)||{};let Re=He.rows||[];!ne.range&&Te.range&&(Re=Re.slice(Te.range.start,Te.range.end)),ve(He);const et=He.pivot&&typeof He.pivot=="object"?He.pivot:{},tt={cells:Array.isArray(et.cells)?et.cells:[],...Array.isArray(et.axis)?{axis:et.axis}:{}};return He.total===void 0?{rows:Re,pivot:tt}:{rows:Re,total:He.total,pivot:tt}},Le=Ie=>{se(`source.pushdown.pivot.${re}.${Ie}`,`pushdown:pivot-unsupported: the ${re} adapter cannot pivot this query because ${Ie}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const Te=new Error(`[lattice] ${J}: the ${re} adapter cannot pivot this query because ${Ie}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw Te.code=J,Te.reason=Ie,Te},Be=(Ie,Te)=>{const qe={key:Te,state:"pending",value:null};return P=qe,Ie.then(He=>(P===qe&&(P={key:Te,state:"settled",value:typeof He=="number"?He:null}),He),He=>{throw P===qe&&(P={key:Te,state:"failed",value:null}),He})};let We=0,ze=[];const Ke=()=>We===0?null:new Promise(Ie=>{const Te=setTimeout(Ie,c);ze.push(()=>{clearTimeout(Te),Ie()})});let Ue;const vt=async Ie=>{const Te=Q();Te&&await Te;const He=Ie&&Ie.pivotMode!==!1&&Array.isArray(Ie.pivotBy)&&Ie.pivotBy.length>0?{request:Ie,probe:null}:await $(Ie);l(Ie);let Re=de(He.request,ne,g.enabled);if(ne.group&&Re.grouped&&!Re.pivoted&&!s(K.executeGroupLevel)&&(se(`source.pushdown.group.method.${re}`,`the ${re} adapter declares the \`group\` capability but has no \`executeGroupLevel(query, aggregates, request)\`, so grouping is not pushed and the grid stays ungrouped unless it holds the whole matching set. Implement the method or drop the capability.`),Re=de(He.request,{...ne,group:!1,aggregates:null},g.enabled)),Re.pivoted&&!s(K.executePivotLevel)&&(Re=de(He.request,{...ne,pivot:!1},g.enabled),Re.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Re.grouped&&!Re.pivoted&&!ne.group&&!s(K.executeGroupedAggregates)&&(se(`source.pushdown.group.aggregates.method.${re}`,`the ${re} adapter declares \`aggregates\` but has no \`executeGroupedAggregates(query, groupBy, aggregates)\`, so the grouped view cannot be built from grouped aggregates and the grid stays ungrouped unless it holds the whole matching set. Implement the method, or declare \`group\` and implement \`executeGroupLevel\`.`),Re=de(He.request,{...ne,aggregates:null},g.enabled)),y=Re,Re.pivoted)return Me(Re,Ie);if(Re.pivotReason&&Le(Re.pivotReason),Re.grouped)return ne.group?j(Re,Ie):Se(Re,Ie);const tt=!!Re.groupReason&&!Re.full;tt?se(`source.pushdown.group-unsupported.${re}.${Re.groupReason}`,`pushdown:group-unsupported: the ${re} adapter was not asked to group this query because ${Re.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.`):Re.groupReason&&se(`source.pushdown.group.${re}.${Re.groupReason}`,`the ${re} adapter was not asked to group this query because ${Re.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 at=lt=>tt?{...lt,[ue]:!0}:lt;if(!Re.needsAll){const lt=He.probe||await K.execute(Re.pushed,Ie),ht=lt.rows||[];return E(lt.pendingTotal)&<.total===void 0?at({rows:ht,pendingTotal:Be(lt.pendingTotal,d(Re.pushed))}):(P=null,!ne.total&<.total===void 0?at({rows:ht}):at({rows:ht,total:lt.total??ht.length}))}Re.unpushed.length&&se(`source.pushdown.residual.${re}.${Re.unpushed.join(".")}`,`the ${re} adapter cannot push ${Re.unpushed.join(" or ")}, so every matching row is fetched and the rest is applied in the browser. Correct, and slower than it needs to be: widening the adapter is the fix.`);const ct=d(Re.pushed);if(!e||e.key!==ct){const lt=await oe(await K.execute(Re.pushed,Ie));P=null;const ht=lt.rows||[];if(Re.full){const Tt=typeof lt.total=="number"?Math.max(lt.total,ht.length):ht.length;if(Tt>g.maxRows)throw new Error(`[lattice] fullDataset refused: the ${re} adapter's matching set is ${Tt.toLocaleString()} rows, past the configured maxRows of ${g.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 Lt=ht.length*t(ht[0]);if(Lt>g.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${re} adapter's matching set is an estimated ${Math.round(Lt/(1024*1024)).toLocaleString()} MB across ${ht.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(g.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 lt.total=="number"&&ht.length<lt.total){const Tt=!!(Re.residual.filters||Re.residual.quick||Re.residual.sort&&Re.residual.sort.length);if(Tt&&!h)throw new Error(`[lattice] the ${re} adapter returned ${ht.length} of ${lt.total} matching rows when asked for the whole result, and the query has residual ${Re.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.`);Tt?se(`source.pushdown.partial.residual.${re}`,`the ${re} adapter returned ${ht.length} of ${lt.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.`):se(`source.pushdown.partial.${re}`,`the ${re} adapter returned ${ht.length} of ${lt.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}e={key:ct,rows:ht,total:typeof lt.total=="number"?lt.total:null}}let st=Re;if(Re.residual.where){const lt=e.total??e.rows.length;if(lt>=I){ie(Re.residual.where.names,re,lt,I);const{where:ht,...Tt}=He.request;st=de(Tt,ne,g.enabled),y=st}}const wt=e.total!==null&&e.rows.length>=e.total,pt=ae(e.rows,{...st.residual,whole:wt},N.compute||{}),kt=Ie.range?Ie.range.start:0,Nt=Ie.range?Ie.range.end:pt.length;return at({rows:pt.slice(kt,Nt),total:pt.length})},At=async(Ie,Te,qe)=>{const Re=qe&&qe.waitForPage&&Ue&&s(Ue.pageForegroundIdle)?Ue.pageForegroundIdle():Ke();Re&&await Re;const et=Q();et&&await et;const tt=de(Ie,ne,g.enabled);y=tt;const at=S(Te,z),ct=Array.isArray(Ie.groupBy)?Ie.groupBy:[],st=ct.length>0,wt=!tt.residual.filters&&!tt.residual.quick,pt=!st||T(ct,ne.buckets);let kt=at.engine,Nt=at.client;if(ne.aggregates&&kt.length){const Lt=ne.aggregates instanceof Set?ne.aggregates:new Set(ye(ne.aggregates)),Wt=kt.filter(Gt=>!Lt.has(Gt.fn));Wt.length&&(kt=kt.filter(Gt=>Lt.has(Gt.fn)),Nt=[...Wt.map(Gt=>({...Gt,reason:`the ${re} adapter does not compute "${Gt.fn}"`})),...Nt])}const lt=Lt=>{Nt=[...kt.map(Wt=>({...Wt,reason:Lt})),...Nt],kt=[]};kt.length&&!wt?lt(tt.residual.quick&&!tt.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):kt.length&&!pt&<("a grouping key the engine cannot form forces all-client (no mixed provenance)");let ht={},Tt;return kt.length&&(s(st?K.executeGroupedAggregates:K.executeAggregates)?st?Tt=await K.executeGroupedAggregates(tt.pushed,ct,kt)||[]:ht=await K.executeAggregates(tt.pushed,kt)||{}:(se(`source.pushdown.aggregates.${re}${st?".grouped":""}`,`the ${re} adapter cannot compute ${st?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),lt(`adapter cannot compute ${st?"grouped ":""}aggregates`))),u={engine:kt,client:Nt,...st?{groupBy:ct}:{}},{values:ht,engine:kt,client:Nt,...Tt!==void 0?{groups:Tt}:{}}},Mt=async Ie=>{We++;try{return await vt(Ie)}finally{if(We--,We===0&&ze.length){const Te=ze;ze=[];for(const qe of Te)qe()}}},ut=b(N.edit),ft=N.edit&&typeof N.edit=="object"&&s(N.edit.commit);let zt=N.edit;if(ut&&!ft)if(ne.mutate&&ne.mutate.update){const Ie=Te=>{if(!ne.mutate||!ne.mutate.update)throw new Error(`[lattice] the ${re} adapter cannot update rows (mutate.update is not declared), so this edit cannot be persisted. The cell is reverted rather than left looking saved.`);const qe={kind:"update",key:String(Te.key),patch:{[Te.colId]:Te.value}};return K.mutate(qe,Te.request||{})};zt={...N.edit===!0?{}:N.edit,commit:Ie}}else se(`source.pushdown.readonly.${re}`,`edit is enabled but the ${re} adapter declares mutate: ${ne.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 Ft=ut&&ne.mutate&&(ne.mutate.append||ne.mutate.delete)?{append:ne.mutate.append===!0,remove:ne.mutate.delete===!0,returning:ne.mutate.returning,mutate:(Ie,Te)=>K.mutate(Ie,Te||{})}:null,yt=async Ie=>{const Te=Q();Te&&await Te;const{range:qe,signal:He,export:Re,...et}=Ie||{},tt={...et,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:de(tt,ne,g.enabled),signal:He}};async function*dt(Ie,Te={}){const{plan:qe,signal:He}=await yt(Ie),Re=Math.max(1,Math.floor(Number(Te.pageSize))||5e3),et={signal:He,stream:!0};if(!qe.needsAll)for(let ct=0;;ct+=Re){l(et);const st=await K.execute({...qe.pushed,range:{start:ct,end:ct+Re}},et);st&&E(st.pendingTotal)&&st.pendingTotal.then(null,()=>{});const wt=st&&st.rows||[];if(wt.length&&(yield wt),wt.length<Re)return}l(et);const tt=await oe(await K.execute({...qe.pushed,range:void 0},et)),at=ae(tt&&tt.rows||[],{...qe.residual,whole:!0},N.compute||{});for(let ct=0;ct<at.length;ct+=Re)yield at.slice(ct,ct+Re)}return Ue={...N,edit:zt,rowMutate:Ft,mode:"remote",fetch:Mt,foregroundIdle:Ke,aggregate:At,countMatching:async Ie=>{const{plan:Te,signal:qe}=await yt(Ie);if(!Te.needsAll&&ne.total){l({signal:qe});const Re=await oe(await K.execute({...Te.pushed,range:{start:0,end:0}},{signal:qe}));if(Re&&typeof Re.total=="number")return Re.total}let He=0;for await(const Re of dt(Ie))He+=Re.length;return He},streamMatching:dt,lastPlan:()=>y?{...y,...u?{aggregates:u}:{},...P?{total:{deferred:!0,state:P.state,value:P.value}}:{}}:null,fullFrame:$e,counts:()=>({match:C,total:H??null,pending:!!P&&P.state==="pending"}),grandTotals:()=>Y},Ue}}),Xe("packages/modules/shared/engine.js",function(r,me){"use strict";Object.defineProperty(r,"sourceId",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"engineSource",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"gridPivoted",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"loadedAndMatching",{enumerable:!0,get:function(){return S}}),Object.defineProperty(r,"gridHoldsWindow",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"gridEngineRequest",{enumerable:!0,get:function(){return R}}),Object.defineProperty(r,"EngineFlight",{enumerable:!0,get:function(){return M}});const we=me("packages/core/src/source/pushdown.js"),X=we.capabilitiesOf,s=we.planQuery,se=me("packages/core/src/source/filterwire.js").wireFilters,he=new WeakMap;let _=0;function G(c){let l=he.get(c);return l===void 0&&(l=++_,he.set(c,l)),l}function ie(c){const l=c&&typeof c.config=="function"?c.config():null,i=l&&l.source&&typeof l.source=="object"?l.source:null;if(!i||typeof i.aggregate!="function")return{reason:"the grid's source has no aggregate() — it is not a pushdown source"};const a=X(i.adapter&&i.adapter.capabilities);return{source:i,caps:a,config:l}}function W(c){const l=c&&typeof c.config=="function"?c.config():null,i=l&&l.source&&typeof l.source=="object"?l.source:null;if(!i||typeof i.lastPlan!="function")return!1;const a=c&&c.state&&typeof c.state.get=="function"?c.state.get():null,w=a&&a.pivot;return!!(w&&w.enabled&&Array.isArray(w.columns)&&w.columns.length>0)}function S(c){const l=c.rows&&typeof c.rows.residentCount=="function"?c.rows.residentCount():0,i=typeof c.rows.matchCount=="function"?c.rows.matchCount():NaN;return{loaded:l,total:Number.isFinite(i)?i:NaN}}function T(c){const l=c&&typeof c.config=="function"?c.config():null,i=l&&l.source&&typeof l.source=="object"?l.source:null;if(!i||i.mode!=="remote"&&i.mode!=="paged")return!1;if(typeof c.rows.matchCount=="function"&&c.rows.matchCount()===null)return!0;const{loaded:a,total:w}=S(c);return Number.isFinite(w)&&a<w}function p(c,l){return l?c?{op:"and",conditions:[c,l]}:l:c||null}function R(c,l,i=null){const a=c.filters&&typeof c.filters.where=="function"?c.filters.where():[];if(Array.isArray(a)&&a.length)return{reason:`a \`where\` predicate is in force (${a.join(", ")}), which only the browser can run`};const w=c.filters&&typeof c.filters.quickState=="function"?c.filters.quickState():{text:""},b=w&&w.text?String(w.text):"",{config:o,caps:O}=l,n={filters:se(p(c.filters.get(),i),{tz:o.timeZone,weekStartsOn:o.weekStartsOn}),sort:[],range:null,context:o.context??null,...b?{quick:b}:{}},x=s(n,O);return x.unpushed.includes("filter")?{reason:i?"the grid's filter, or the viewport condition, did not fully push to the engine":"the grid's filter did not fully push to the engine"}:x.unpushed.includes("quick")?{reason:"the quick search did not push to the engine"}:{request:n,quick:b}}class M{#e=null;#t=null;#n=!1;answer(l){return this.#t&&this.#t.key===l?this.#t:null}last(){return this.#t}get busy(){return this.#e!==null}ask(l,i,a){const w=this.#e;if(w){w.key!==l&&w.controller&&w.controller.abort();return}const b=globalThis.AbortController,o=typeof b=="function"?new b:null,O={key:l,controller:o};this.#e=O;let n;Promise.resolve().then(()=>i(o?o.signal:null)).then(x=>{n={key:l,result:x}},x=>{n={key:l,error:x}}).then(()=>{this.#e===O&&(this.#e=null),!this.#n&&(o&&o.signal.aborted||(this.#t=n),a())})}abort(){const l=this.#e;l&&l.controller&&l.controller.abort()}close(){this.#n=!0,this.abort()}}}),Xe("packages/modules/charts/scale.js",function(r,me){"use strict";Object.defineProperty(r,"isNumber",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"toNumber",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"toTime",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"extent",{enumerable:!0,get:function(){return S}}),Object.defineProperty(r,"niceStep",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"niceDomain",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"measureDomain",{enumerable:!0,get:function(){return R}}),Object.defineProperty(r,"linearTicks",{enumerable:!0,get:function(){return M}}),Object.defineProperty(r,"timeStepFor",{enumerable:!0,get:function(){return c}}),Object.defineProperty(r,"timeTicks",{enumerable:!0,get:function(){return i}}),Object.defineProperty(r,"linearScale",{enumerable:!0,get:function(){return a}}),Object.defineProperty(r,"timeScale",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"key",{enumerable:!0,get:function(){return b}}),Object.defineProperty(r,"bandScale",{enumerable:!0,get:function(){return o}}),Object.defineProperty(r,"sqrtScale",{enumerable:!0,get:function(){return O}});const we=[1,2,2.5,5,10],X=6e4,s=36e5,ye=864e5,se=365.25*ye,he=[1,2,5,10,20,25,50,100],_=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,X,5*X,15*X,30*X,s,3*s,6*s,12*s,ye,2*ye,7*ye,14*ye,30*ye,90*ye,180*ye,...he.map(n=>n*se)];function G(n){return typeof n=="number"&&Number.isFinite(n)}function ie(n){if(n==null||n==="")return null;if(n instanceof Date){const D=n.getTime();return Number.isFinite(D)?D:null}if(typeof n=="boolean")return n?1:0;const x=Number(n);return Number.isFinite(x)?x:null}function W(n){if(n==null||n==="")return null;if(n instanceof Date){const D=n.getTime();return Number.isFinite(D)?D:null}if(typeof n=="number")return Number.isFinite(n)?n:null;const x=Date.parse(String(n));return Number.isFinite(x)?x:null}function S(n){let x=1/0,D=-1/0;for(let B=0;B<n.length;B++){const q=n[B];G(q)&&(q<x&&(x=q),q>D&&(D=q))}return x===1/0?null:{min:x,max:D}}function T(n){if(!(n>0))return 1;const x=10**Math.floor(Math.log10(n));for(const D of we)if(n<=D*x)return D*x;return 10*x}function p(n,x=5){const D=T((n.max-n.min)/Math.max(1,x));return{min:Math.floor(n.min/D)*D,max:Math.ceil(n.max/D)*D,step:D}}function R(n,x={}){const D=S(n)||{min:0,max:1};let{min:B,max:q}=D;if(x.zero&&(B>0&&(B=0),q<0&&(q=0)),B===q){const J=Math.abs(B)>0?Math.abs(B)/10:1;B-=J,q+=J}if(x.nice!==!1){const J=p({min:B,max:q},x.ticks||5);B=J.min,q=J.max}return G(x.min)&&(B=x.min),G(x.max)&&(q=x.max),B===q&&(q=B+1),{min:B,max:q}}function M(n,x=5){const D=T((n.max-n.min)/Math.max(1,x)),B=Math.ceil(n.min/D),q=Math.floor(n.max/D),J=[];for(let ee=B;ee<=q;ee++){const ue=ee*D;J.push(Math.abs(ue)<D/1e6?0:Number(ue.toPrecision(12)))}return J}function c(n,x=5){const D=Math.max(1,x),B=n/D;let q=_[_.length-1];for(const ue of _)if(ue>=B){q=ue;break}if(q<se)return q;let J=q,ee=Math.abs(n/q-D);for(const ue of _){if(ue<se)continue;const fe=Math.abs(n/ue-D);fe<ee&&(ee=fe,J=ue)}return J}function l(n,x){const D=new Date(n.min).getUTCFullYear();let B=Math.ceil(D/x)*x;Date.UTC(B,0,1)<n.min&&(B+=x);const q=[];for(;Date.UTC(B,0,1)<=n.max;B+=x)q.push(Date.UTC(B,0,1));return q}function i(n,x=5){const D=c(n.max-n.min,x);if(D>=se)return l(n,Math.round(D/se));const B=[],q=Math.ceil(n.min/D)*D;for(let J=q;J<=n.max;J+=D)B.push(J);return B}function a(n,x){const D=n.max-n.min||1,[B,q]=x;return{kind:"linear",domain:n,range:x,of(J){return B+(J-n.min)/D*(q-B)},invert(J){return n.min+(J-B)/(q-B||1)*D},ticks(J=5){return M(n,J)}}}function w(n,x){return{...a(n,x),kind:"time",ticks(B=5){return i(n,B)}}}function b(n){if(n==null)return" null";if(n instanceof Date)return` date:${n.getTime()}`;if(typeof n=="object"){const x=n,D=x.id??x.key??x.value;return D!==void 0&&typeof D!="object"?` obj:${String(D)}`:` obj:${String(n)}`}return String(n)}function o(n,x,D=.2){const B=Math.min(.9,Math.max(0,D)),[q,J]=x,ee=new Map;for(let de=0;de<n.length;de++){const U=b(n[de]);ee.has(U)||ee.set(U,de)}const ue=n.length?(J-q)/n.length:J-q,fe=Math.max(0,ue*(1-B));return{kind:"band",domain:n,range:x,bandwidth:fe,step:ue,of(de){const U=ee.get(b(de));return U===void 0?NaN:q+U*ue+(ue-fe)/2},centre(de){const U=this.of(de);return Number.isNaN(U)?NaN:U+fe/2},ticks(){return n}}}function O(n,x){const[D,B]=x,q=Math.max(Math.abs(n.max),Math.abs(n.min),0)||1;return{kind:"sqrt",domain:n,range:x,of(J){const ee=Math.sqrt(Math.abs(J)/q);return D+ee*(B-D)}}}}),Xe("packages/modules/charts/svg.js",function(r,me){"use strict";Object.defineProperty(r,"SVG_NS",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"el",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"svg",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(r,"attr",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"attrs",{enumerable:!0,get:function(){return he}}),Object.defineProperty(r,"setText",{enumerable:!0,get:function(){return _}}),Object.defineProperty(r,"clear",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"append",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"path",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"ribbonPath",{enumerable:!0,get:function(){return S}}),Object.defineProperty(r,"round",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"pathRings",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"insideRings",{enumerable:!0,get:function(){return R}});const we="http://www.w3.org/2000/svg";function X(M){const c=M.indexOf(")");return c<0?M:M.slice(c+1).trim()||"#0072b2"}function s(M,c,l){const i=M.createElement(c);return l&&i.setAttribute("class",l),i}function ye(M,c,l){const i=M.createElementNS(we,c);if(l)for(const a of Object.keys(l))i.setAttribute(a,String(l[a]));return i}function se(M,c,l){if(!M)return;if(l==null){M.removeAttribute(c);return}let i=String(l);i.startsWith("url(#")&&(c==="stroke"||c==="fill"&&M.localName==="text")&&(i=X(i)),M.setAttribute(c,i)}function he(M,c){if(M)for(const l of Object.keys(c))se(M,l,c[l])}function _(M,c){M&&(M.textContent=c==null?"":String(c))}function G(M){if(M)for(;M.firstChild;)M.removeChild(M.firstChild)}function ie(M,c){for(const l of c)l&&M.appendChild(l);return M}function W(M){return M.join(" ")}function S(M){if(!M||M.length<2)return"";const c=["M",M[0].x,M[0].upper];for(let l=1;l<M.length;l++)c.push("L",M[l].x,M[l].upper);for(let l=M.length-1;l>=0;l--)c.push("L",M[l].x,M[l].lower);return c.push("Z"),W(c)}function T(M){return Math.round(M*100)/100}function p(M){const c=[];let l=[];const i=String(M||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let a="",w=[];const b=()=>{if(!a||!w.length){w=[];return}if(a==="M"||a==="L")for(let o=0;o+1<w.length;o+=2)l.push([w[o],w[o+1]]);else a!=="Z"&&w.length>=2&&l.push([w[w.length-2],w[w.length-1]]);w=[]};for(const o of i){if(/[A-Za-z]/.test(o)){if(b(),o==="Z"||o==="z"){l.length>2&&c.push(l),l=[],a="";continue}o==="M"&&l.length>2&&(c.push(l),l=[]),a=o;continue}w.push(Number(o))}return b(),l.length>2&&c.push(l),c}function R(M,c,l){let i=!1;for(const a of M)for(let w=0,b=a.length-1;w<a.length;b=w++){const[o,O]=a[w],[n,x]=a[b];O>l!=x>l&&c<(n-o)*(l-O)/(x-O||1e-12)+o&&(i=!i)}return i}}),Xe("packages/modules/charts/typography.js",function(r,me){"use strict";Object.defineProperty(r,"BASE_SIZE",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"BASE_FAMILY",{enumerable:!0,get:function(){return X}}),Object.defineProperty(r,"CHAR_RATIO",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"resolveType",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(r,"textWidth",{enumerable:!0,get:function(){return he}}),Object.defineProperty(r,"widestLabel",{enumerable:!0,get:function(){return _}}),Object.defineProperty(r,"truncateTo",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"applySize",{enumerable:!0,get:function(){return ie}});const we=12,X="var(--lattice-font-family, system-ui, -apple-system, sans-serif)",s=.62;function ye(W){const S=W&&W.font,T=typeof S=="number"?{size:S}:S||{},p=se(T.size,we);return{family:T.family||X,size:p,small:se(T.small??T.tickSize,Math.max(9,p-1)),title:se(T.title,Math.round(p*1.15)),axisTitle:se(T.axisTitle,Math.max(10,p-1)),weight:T.weight||"inherit"}}function se(W,S){const T=Number(W);return Number.isFinite(T)&&T>0?T:S}function he(W,S){return String(W??"").length*S*s}function _(W,S){let T=0;for(const p of W||[]){const R=he(p,S);R>T&&(T=R)}return T}function G(W,S,T){const p=String(W??""),R=Math.floor(S/(T*s));return R<=0?"":p.length<=R?p:R===1?"…":`${p.slice(0,R-1)}…`}function ie(W,S){!W||!Number.isFinite(S)||(W.style?W.style.fontSize=`${S}px`:W.setAttribute("style",`font-size:${S}px`))}}),Xe("packages/modules/charts/frame.js",function(r,me){"use strict";Object.defineProperty(r,"LABEL_GAP",{enumerable:!0,get:function(){return _}}),Object.defineProperty(r,"LABEL_GUTTER_SHARE",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"resolveMargin",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"plotRect",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"shouldRotate",{enumerable:!0,get:function(){return S}}),Object.defineProperty(r,"Pool",{enumerable:!0,get:function(){return T}});const X=me("packages/modules/charts/svg.js").SVG_NS,s=me("packages/modules/charts/typography.js"),ye=s.textWidth,se=s.widestLabel,he=8,_=6,G=.4;function ie(p,R){const M=typeof p=="number"?p:R,c=p&&typeof p=="object"?p:{},l=i=>Number.isFinite(i)&&i>=0?Number(i):M;return{base:M,top:l(c.top),right:l(c.right),bottom:l(c.bottom),left:l(c.left)}}function W(p){const R=ie(p.margin,typeof p.padding=="number"?p.padding:8),M=R.base,c=p.fontSize||12,l=p.yLabels||[],i=p.xLabels||[],a=p.ySide==="right"?"right":"left",w=a==="right"?"left":"right",b=p.titles||{},o=p.titleSize||c,O=U=>U?o+_:0,n=se(l,c),x=l.length?Math.min(p.width*G,R[a]+n+_):Math.max(he,R[a]),D=R[w]+(p.rightGutter||0),B=(a==="left"?x:D)+O(b.left),q=se(i.map(U=>String(U).slice(0,14)),c),J=(i.length?p.rotated?Math.min(p.height*G,_+q):c+_+R.bottom:Math.max(he,R.bottom))+O(b.bottom),ee=(a==="right"?x:D)+O(b.right),ue=R.top+(p.topGutter||0),fe=Math.max(0,p.width-B-ee),de=Math.max(0,p.height-ue-J);return{left:B,top:ue,width:fe,height:de,right:B+fe,bottom:ue+de,gutter:{left:B,bottom:J,right:ee,top:ue}}}function S(p,R,M,c){if(!p.length||R<=0)return!1;const l=Number.isFinite(c)&&c>0?Number(c):1;return se(p,M)>R*l-4}class T{#e;#t=0;static#n="data-pool-key";constructor(R,M=0){this.#e=R,this.#t=M>0?M:0}next(R,M,c){if(c!=null)return this.#r(R,M,String(c));const l=this.#e.childNodes[this.#t],i=l&&l.tagName,a=/(^|\s)\S*__axis-title(\s|$)/,w=i&&a.test(String(l.getAttribute("class")||"")),b=!!M&&a.test(String(M));if(i&&(!w||b)&&String(i).toLowerCase()===R.toLowerCase())return M&&l.setAttribute("class",M),this.#t++,l;const o=this.#e.ownerDocument.createElementNS(X,R);return M&&o.setAttribute("class",M),l?this.#e.insertBefore(o,l):this.#e.appendChild(o),this.#t++,o}#r(R,M,c){const l=R.toLowerCase();for(let w=this.#t;w<this.#e.childNodes.length;w++){const b=this.#e.childNodes[w],o=b&&b.tagName;if(o&&String(o).toLowerCase()===l&&b.getAttribute(T.#n)===c)return w!==this.#t&&this.#e.insertBefore(b,this.#e.childNodes[this.#t]),M&&b.setAttribute("class",M),this.#t++,b}const i=this.#e.ownerDocument.createElementNS(X,R);i.setAttribute(T.#n,c),M&&i.setAttribute("class",M);const a=this.#e.childNodes[this.#t];return a?this.#e.insertBefore(i,a):this.#e.appendChild(i),this.#t++,i}finish(){for(;this.#e.childNodes.length>this.#t;)this.#e.removeChild(this.#e.lastChild);this.#t=0}}}),Xe("packages/modules/charts/fills.js",function(r,me){"use strict";Object.defineProperty(r,"PATTERNS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"GRADIENTS",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(r,"isFill",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"isPaintRef",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"paintFallback",{enumerable:!0,get:function(){return S}}),Object.defineProperty(r,"normaliseFill",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"swatchCss",{enumerable:!0,get:function(){return M}}),Object.defineProperty(r,"createFillRegistry",{enumerable:!0,get:function(){return c}}),Object.defineProperty(r,"rowPaint",{enumerable:!0,get:function(){return l}}),Object.defineProperty(r,"patternSeries",{enumerable:!0,get:function(){return i}}),Object.defineProperty(r,"paintSolid",{enumerable:!0,get:function(){return a}}),Object.defineProperty(r,"rowFillSource",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"nodePaint",{enumerable:!0,get:function(){return b}});const X=me("packages/core/src/internal/util.js").warnOnce,s=Object.freeze(["hatch","crosshatch","dots","grid"]),ye=Object.freeze(["linear","radial"]),se=8,he="#0072b2";let _=0;const G=new Map;function ie(o){return!!o&&typeof o=="object"&&!Array.isArray(o)&&(typeof o.gradient=="string"||typeof o.pattern=="string")}function W(o){return typeof o=="string"&&o.startsWith("url(#")}function S(o){if(typeof o!="string")return o==null?"":String(o);if(!o.startsWith("url("))return o;const O=o.indexOf(")");return(O<0?"":o.slice(O+1).trim())||he}function T(o,O){X(`chart:fill:invalid:${o}`,`a chart fill object was ignored: ${O} The mark was drawn in a solid colour instead. A fill is a gradient object (gradient: "linear" or "radial", with stops of [offset, colour]) or a pattern object (pattern: "hatch", "crosshatch", "dots" or "grid", with a colour).`)}function p(o,O){if(!ie(o))return null;const n=O||he;if(typeof o.gradient=="string"){if(!ye.includes(o.gradient))return T("gradient",`the gradient "${o.gradient}" is not one of ${ye.join(", ")}.`),null;const q=Array.isArray(o.stops)?o.stops:[],J=[];for(const ue of q){const fe=Array.isArray(ue)?Number(ue[0]):Number(ue&&ue.offset),de=Array.isArray(ue)?ue[1]:ue&&ue.colour;!Number.isFinite(fe)||typeof de!="string"||!de||J.push({offset:Math.min(1,Math.max(0,fe)),colour:de})}if(J.length<2)return T("stops","a gradient needs at least two [offset, colour] stops."),null;J.sort((ue,fe)=>ue.offset-fe.offset);const ee=Number.isFinite(Number(o.angle))?Number(o.angle):180;return{kind:o.gradient,angle:ee,stops:J,solid:J[0].colour}}if(!s.includes(o.pattern))return T("pattern",`the pattern "${o.pattern}" is not one of ${s.join(", ")}.`),null;const x=Number(o.size),D=Number(o.angle),B=typeof o.colour=="string"&&o.colour?o.colour:n;return{kind:"pattern",pattern:o.pattern,colour:B,background:typeof o.background=="string"&&o.background?o.background:null,size:Number.isFinite(x)&&x>=2?x:se,angle:Number.isFinite(D)?D:o.pattern==="grid"||o.pattern==="dots"?0:45,solid:B}}function R(o){if(o.kind==="pattern"){const n=o.colour,x=o.size,D=Math.max(1,x/5),B=o.background||"transparent",q=J=>`repeating-linear-gradient(${J+90}deg,${n} 0 ${D}px,transparent ${D}px ${x}px)`;return o.pattern==="hatch"?`${q(o.angle)},${B}`:o.pattern==="crosshatch"?`${q(o.angle)},${q(o.angle+90)},${B}`:o.pattern==="grid"?`${q(o.angle)},${q(o.angle+90)},${B}`:`radial-gradient(circle at 50% 50%,${n} ${x/6}px,transparent ${x/6+.5}px) 0 0/${x}px ${x}px,${B}`}const O=o.stops.map(n=>`${n.colour} ${Math.round(n.offset*100)}%`).join(",");return o.kind==="radial"?`radial-gradient(circle,${O})`:`linear-gradient(${o.angle}deg,${O})`}function M(o){if(!W(o))return typeof o=="string"?o:"";const O=String(o).indexOf(")"),n=String(o).slice(5,O),x=G.get(n);return x?R(x):S(o)}function c(o){const O=`lattice-fill-${++_}`;let n=new Map,x=0;const D=(q,J)=>{const ee=o.ownerDocument.createElementNS("http://www.w3.org/2000/svg",q);for(const ue of Object.keys(J))ee.setAttribute(ue,String(J[ue]));return ee},B=(q,J)=>{if(J.kind==="pattern"){const ue=J.size,fe=Math.max(1,ue/5),de=D("pattern",{id:q,width:ue,height:ue,patternUnits:"userSpaceOnUse"});J.angle&&de.setAttribute("patternTransform",`rotate(${J.angle})`),J.background&&de.appendChild(D("rect",{width:ue,height:ue,fill:J.background}));const U={stroke:J.colour,"stroke-width":fe};J.pattern==="dots"?de.appendChild(D("circle",{cx:ue/2,cy:ue/2,r:Math.max(1,ue/6),fill:J.colour})):(de.appendChild(D("line",{x1:ue/2,y1:0,x2:ue/2,y2:ue,...U})),J.pattern!=="hatch"&&de.appendChild(D("line",{x1:0,y1:ue/2,x2:ue,y2:ue/2,...U}))),o.appendChild(de);return}let ee;if(J.kind==="radial")ee=D("radialGradient",{id:q,cx:.5,cy:.5,r:.5});else{const ue=J.angle*Math.PI/180,fe=Math.sin(ue)/2,de=-Math.cos(ue)/2;ee=D("linearGradient",{id:q,x1:+(.5-fe).toFixed(4),y1:+(.5-de).toFixed(4),x2:+(.5+fe).toFixed(4),y2:+(.5+de).toFixed(4)})}for(const ue of J.stops)ee.appendChild(D("stop",{offset:ue.offset,"stop-color":ue.colour}));o.appendChild(ee)};return{prefix:O,paint(q,J){const ee=p(q,J);if(!ee)return J||he;if(!o||!o.ownerDocument)return ee.solid;const ue=JSON.stringify(ee);let fe=n.get(ue);if(!fe){const de=`${O}-${x++}`;B(de,ee),G.set(de,ee),fe=`url(#${de}) ${ee.solid}`,n.set(ue,fe)}return fe},reset(){for(const q of n.values())G.delete(q.slice(5,q.indexOf(")")));if(n=new Map,x=0,o)for(;o.firstChild;)o.removeChild(o.firstChild)},ids(){return[...n.values()].map(q=>q.slice(5,q.indexOf(")")))}}}function l(o,O,n){if(o==null||o==="")return null;const x=S(n);if(ie(o))return O?O.paint(o,x):(p(o,x)||{}).solid||null;if(typeof o=="string"){if(s.includes(o)){const D={pattern:o,colour:x};return O?O.paint(D,x):x}return o}return null}function i(o){const O=[{pattern:"hatch",angle:45},{pattern:"dots"},{pattern:"crosshatch",angle:45},{pattern:"hatch",angle:135},{pattern:"grid"},{pattern:"dots",size:5},{pattern:"hatch",angle:0},{pattern:"crosshatch",angle:0,size:6}];return o.map((n,x)=>({...O[x%O.length],colour:n,background:"var(--lattice-background, #fff)"}))}function a(o){return W(o)?String(o).replace(/^url\([^)]*\)\s*/,""):o}function w(o,O){const n=o.fill;if(ie(n))return(D,B)=>l(n,O.fills,a(B));if(typeof n=="function")return(D,B)=>{let q=null;try{q=n({label:D.label,x:D.x,y:D.y,rowKey:D.rowKey})}catch{q=null}return l(q,O.fills,a(B))};const x=typeof n=="string"?n:n&&typeof n=="object"&&typeof n.col=="string"?n.col:null;return x?(D,B)=>D.rowKey===void 0||D.rowKey===null?null:l(o.grid.rows.value(D.rowKey,x),O.fills,a(B)):null}function b(o,O,n){return o&&o({label:O.label,x:O.value,y:O.total,rowKey:O.rowKey},n)||n}}),Xe("packages/modules/charts/scheme.js",function(r,me){"use strict";Object.defineProperty(r,"PALETTE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(r,"SCHEMES",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"registerScheme",{enumerable:!0,get:function(){return S}}),Object.defineProperty(r,"setDefaultScheme",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"schemeNames",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"resolveScheme",{enumerable:!0,get:function(){return l}}),Object.defineProperty(r,"RAMP_SCALES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(r,"toRgb",{enumerable:!0,get:function(){return o}}),Object.defineProperty(r,"rampStops",{enumerable:!0,get:function(){return O}});const X=me("packages/core/src/internal/util.js").warnOnce,s=me("packages/modules/charts/fills.js"),ye=s.isFill,se=s.patternSeries,he=s.rowPaint,_=Object.freeze(["#0072b2","#e69f00","#009e73","#cc79a7","#56b4e9","#d55e00","#7a5195","#6b7d8c"]),G=Object.freeze({default:{series:_,sequential:["#ecf3f9","#005280"],diverging:["#b04a00","#f7f7f7","#005280"],positive:"#009e73",negative:"#d55e00"},bright:{series:["#1f77d0","#ff7f0e","#2ca02c","#d62728","#9467bd","#17becf","#e377c2","#7f7f7f"],sequential:["#eef4fb","#1f77d0"],diverging:["#d62728","#f7f7f7","#1f77d0"],positive:"#2ca02c",negative:"#d62728"},earth:{series:["#5b7c6f","#c08b52","#7a6a53","#a4553f","#4e6a83","#8f8259","#6d5566","#8c9196"],sequential:["#f2efe9","#4e6a83"],diverging:["#a4553f","#f2efe9","#4e6a83"],positive:"#5b7c6f",negative:"#a4553f"},mono:{series:["#0b2a3d","#17475f","#2c6480","#4a82a0","#6da0bd","#94bcd6","#bcd7e9","#dfecf5"],sequential:["#eef3f7","#0b2a3d"],diverging:["#7a5c00","#f5f5f5","#0b2a3d"],positive:"#17475f",negative:"#7a5c00"},patterns:{series:se(_),sequential:["#ecf3f9","#005280"],diverging:["#b04a00","#f7f7f7","#005280"],positive:"#009e73",negative:"#d55e00"}}),ie=new Map;let W="default";function S(n,x){!n||!x||ie.set(String(n),x)}function T(n){if(typeof n=="string"){W=n;return}n&&typeof n=="object"&&(ie.set("__default__",n),W="__default__")}function p(){return[...Object.keys(G),...ie.keys()].filter(n=>!n.startsWith("__"))}function R(n){return ie.has(n)?ie.get(n):G[n]||null}const M=["series","sequential","diverging","positive","negative"];function c(n){return!n||typeof n!="object"||Array.isArray(n)?!1:!M.some(x=>x in n)}function l(n,x){const D=x&&x.fills||null,B=R(W)||G.default,q=n&&n.scheme,J=c(q)?q:null,ee=Array.isArray(q)&&q.length?q:null,ue=typeof q=="string"?R(q):J||Array.isArray(q)?null:q||null,fe=(n&&Array.isArray(n.palette)&&n.palette.length?n.palette:null)||ee;J&&fe&&X("chart:scheme:array-and-map",'chart "scheme" was given as a name map together with a "palette" array; the two do not combine. Colours came from the map and the array was ignored. Pass one or the other.');const de=J?null:fe,U={...G.default,...B,...ue||{}};de&&(U.series=de);const A=n&&n.ramp&&typeof n.ramp=="object"&&!Array.isArray(n.ramp)?n.ramp:null,ae=A?A.colours:n&&n.ramp,d=Array.isArray(ae)&&ae.length>=2?ae:null;d&&(U.sequential=d);const t=A?w(A.scale):null,k=!!(ue||de||J),v=U.series&&U.series.length?U.series:_,F=new Map;let E=0;return{...U,series:(te,N)=>{if(J&&N!==void 0&&N!==null){const K=String(N);return Object.prototype.hasOwnProperty.call(J,K)?i(J[K],D,te):(F.has(K)||F.set(K,E++),i(b(v,F.get(K),!0),D,F.get(K)))}return i(b(v,te,k),D,te)},explicit:k,nameMap:!!J,rampScale:t,fills:D}}function i(n,x,D){if(!ye(n))return n;const B=_[(D%_.length+_.length)%_.length];return he(n,x,B)||B}const a=Object.freeze(["linear","log","quantile"]);function w(n){return n==null?null:a.includes(n)?n:(X(`chart:ramp:scale:${String(n)}`,`chart "ramp.scale" was "${String(n)}", which is not a ramp scale; the chart chose one from its values instead. Use "linear", "log" or "quantile".`),null)}function b(n,x,D){const B=(x%n.length+n.length)%n.length;return D||typeof n[B]!="string"?n[B]:`var(--lattice-chart-${B+1}, ${n[B]})`}function o(n){if(typeof n!="string")return null;const x=n.trim(),D=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(x);if(D){const J=D[1];return J.length===3?[0,1,2].map(ee=>parseInt(J[ee]+J[ee],16)):[0,2,4].map(ee=>parseInt(J.slice(ee,ee+2),16))}const B=/^rgba?\(([^)]+)\)$/i.exec(x);if(!B)return null;const q=B[1].split(/[\s,/]+/).filter(Boolean).slice(0,3).map(Number);return q.length===3&&q.every(J=>Number.isFinite(J))?q:null}function O(n,x){const D=x?n.diverging:n.sequential,B=x?G.default.diverging:G.default.sequential,q=(Array.isArray(D)?D:B).map((J,ee)=>o(J)||o(B[ee])||[0,0,0]);return q.length>=2?q:B.map(J=>o(J))}}),Xe("packages/modules/charts/styles.js",function(r,me){"use strict";Object.defineProperty(r,"NS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"seriesColour",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"css",{enumerable:!0,get:function(){return he}}),Object.defineProperty(r,"injectStyles",{enumerable:!0,get:function(){return _}});const X=me("packages/modules/charts/scheme.js").PALETTE,s="lat-chartview",ye="data-lattice-chartview";function se(G){const ie=(G%X.length+X.length)%X.length;return`var(--lattice-chart-${ie+1}, ${X[ie]})`}function he(){return`
|
|
7
7
|
.${s}{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;
|
|
8
8
|
width:100%;height:100%;box-sizing:border-box;
|
|
9
9
|
font-family:var(--lattice-font-family,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif);
|