@toclocoinc/lattice-grid 1.86.4 → 1.86.5
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 +10 -0
- package/README.md +1 -1
- package/angular/package.json +1 -1
- package/docs/API.html +4 -4
- package/docs/api/adapters.html +1 -1
- package/docs/api/ai.html +1 -1
- package/docs/api/alarms.html +1 -1
- package/docs/api/calendar.html +1 -1
- package/docs/api/charts.html +1 -1
- package/docs/api/dashboard.html +1 -1
- package/docs/api/data-router.html +1 -1
- package/docs/api/deckgl.html +1 -1
- package/docs/api/gantt.html +1 -1
- package/docs/api/geometry.html +1 -1
- package/docs/api/grid.html +2 -2
- package/docs/api/index.html +1 -1
- package/docs/api/kanban.html +1 -1
- package/docs/api/kpi.html +1 -1
- package/docs/api/layout.html +1 -1
- package/docs/api/leaflet.html +1 -1
- package/docs/api/list.html +1 -1
- package/docs/api/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 +1 -1
- package/docs/api-detail.html +4 -4
- package/docs/warnings.json +1 -1
- package/lattice-grid.d.ts +1 -1
- package/lattice-grid.esm.min.js +3 -3
- package/lattice-grid.min.cjs +3 -3
- package/lattice-grid.min.css +1 -1
- 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 +2 -2
- package/modules/chart-forcetree.esm.min.js.map +2 -2
- package/modules/chart-forcetree.min.cjs +2 -2
- package/modules/chart-forcetree.min.js +2 -2
- package/modules/chart-forcetree.min.js.map +2 -2
- package/modules/chart-hexbin.d.ts +1 -1
- package/modules/chart-hexbin.esm.min.js +2 -2
- package/modules/chart-hexbin.esm.min.js.map +1 -1
- package/modules/chart-hexbin.min.cjs +2 -2
- package/modules/chart-hexbin.min.js +2 -2
- package/modules/chart-hexbin.min.js.map +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 +2 -2
- package/modules/chart-tree.esm.min.js.map +2 -2
- package/modules/chart-tree.min.cjs +2 -2
- package/modules/chart-tree.min.js +2 -2
- package/modules/chart-tree.min.js.map +2 -2
- 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 +235 -235
- package/modules/charts.esm.min.js.map +2 -2
- package/modules/charts.min.cjs +235 -235
- package/modules/charts.min.js +235 -235
- package/modules/charts.min.js.map +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 +1 -1
- package/modules/gantt.esm.min.js +2 -2
- package/modules/gantt.min.cjs +2 -2
- package/modules/gantt.min.js +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.min.cjs +2 -2
- package/modules/react.min.js +2 -2
- package/modules/svelte.d.ts +1 -1
- package/modules/svelte.esm.min.js +2 -2
- package/modules/svelte.min.cjs +2 -2
- package/modules/svelte.min.js +2 -2
- 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.min.cjs +2 -2
- package/modules/vue.min.js +2 -2
- package/modules/webcomponent.d.ts +1 -1
- package/modules/webcomponent.esm.min.js +3 -3
- package/modules/webcomponent.min.cjs +3 -3
- package/modules/webcomponent.min.js +3 -3
- package/package.json +1 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.86.
|
|
2
|
+
* Lattice Grid 1.86.5, charts module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
6
|
-
var io=Object.create(null),ao=Object.create(null);function tt(r,oe){io[r]=oe}function lo(r){var oe=ao[r];if(oe)return oe;var Ae=Object.create(null);ao[r]=Ae;var ae=io[r];if(!ae)throw new Error("[lattice] missing module: "+r);return ae(Ae,lo),Ae}tt("packages/modules/charts/svg.js",function(r,oe){"use strict";Object.defineProperty(r,"SVG_NS",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(r,"el",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"svg",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(r,"attr",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"attrs",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"setText",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"clear",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(r,"append",{enumerable:!0,get:function(){return le}}),Object.defineProperty(r,"path",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"ribbonPath",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"round",{enumerable:!0,get:function(){return L}}),Object.defineProperty(r,"pathRings",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"insideRings",{enumerable:!0,get:function(){return W}});const Ae="http://www.w3.org/2000/svg";function ae(G){const A=G.indexOf(")");return A<0?G:G.slice(A+1).trim()||"#0072b2"}function $(G,A,p){const f=G.createElement(A);return p&&f.setAttribute("class",p),f}function ke(G,A,p){const f=G.createElementNS(Ae,A);if(p)for(const w of Object.keys(p))f.setAttribute(w,String(p[w]));return f}function we(G,A,p){if(!G)return;if(p==null){G.removeAttribute(A);return}let f=String(p);f.startsWith("url(#")&&(A==="stroke"||A==="fill"&&G.localName==="text")&&(f=ae(f)),G.setAttribute(A,f)}function se(G,A){if(G)for(const p of Object.keys(A))we(G,p,A[p])}function ie(G,A){G&&(G.textContent=A==null?"":String(A))}function Z(G){if(G)for(;G.firstChild;)G.removeChild(G.firstChild)}function le(G,A){for(const p of A)p&&G.appendChild(p);return G}function D(G){return G.join(" ")}function d(G){if(!G||G.length<2)return"";const A=["M",G[0].x,G[0].upper];for(let p=1;p<G.length;p++)A.push("L",G[p].x,G[p].upper);for(let p=G.length-1;p>=0;p--)A.push("L",G[p].x,G[p].lower);return A.push("Z"),D(A)}function L(G){return Math.round(G*100)/100}function T(G){const A=[];let p=[];const f=String(G||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let w="",N=[];const q=()=>{if(!w||!N.length){N=[];return}if(w==="M"||w==="L")for(let k=0;k+1<N.length;k+=2)p.push([N[k],N[k+1]]);else w!=="Z"&&N.length>=2&&p.push([N[N.length-2],N[N.length-1]]);N=[]};for(const k of f){if(/[A-Za-z]/.test(k)){if(q(),k==="Z"||k==="z"){p.length>2&&A.push(p),p=[],w="";continue}k==="M"&&p.length>2&&(A.push(p),p=[]),w=k;continue}N.push(Number(k))}return q(),p.length>2&&A.push(p),A}function W(G,A,p){let f=!1;for(const w of G)for(let N=0,q=w.length-1;N<w.length;q=N++){const[k,_]=w[N],[c,v]=w[q];_>p!=v>p&&A<(c-k)*(p-_)/(v-_||1e-12)+k&&(f=!f)}return f}}),tt("packages/modules/charts/typography.js",function(r,oe){"use strict";Object.defineProperty(r,"BASE_SIZE",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(r,"BASE_FAMILY",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(r,"CHAR_RATIO",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"resolveType",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(r,"textWidth",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"widestLabel",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"truncateTo",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(r,"applySize",{enumerable:!0,get:function(){return le}});const Ae=12,ae="var(--lattice-font-family, system-ui, -apple-system, sans-serif)",$=.62;function ke(D){const d=D&&D.font,L=typeof d=="number"?{size:d}:d||{},T=we(L.size,Ae);return{family:L.family||ae,size:T,small:we(L.small??L.tickSize,Math.max(9,T-1)),title:we(L.title,Math.round(T*1.15)),axisTitle:we(L.axisTitle,Math.max(10,T-1)),weight:L.weight||"inherit"}}function we(D,d){const L=Number(D);return Number.isFinite(L)&&L>0?L:d}function se(D,d){return String(D??"").length*d*$}function ie(D,d){let L=0;for(const T of D||[]){const W=se(T,d);W>L&&(L=W)}return L}function Z(D,d,L){const T=String(D??""),W=Math.floor(d/(L*$));return W<=0?"":T.length<=W?T:W===1?"…":`${T.slice(0,W-1)}…`}function le(D,d){!D||!Number.isFinite(d)||(D.style?D.style.fontSize=`${d}px`:D.setAttribute("style",`font-size:${d}px`))}}),tt("packages/modules/charts/frame.js",function(r,oe){"use strict";Object.defineProperty(r,"LABEL_GAP",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"LABEL_GUTTER_SHARE",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(r,"resolveMargin",{enumerable:!0,get:function(){return le}}),Object.defineProperty(r,"plotRect",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"shouldRotate",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"Pool",{enumerable:!0,get:function(){return L}});const ae=oe("packages/modules/charts/svg.js").SVG_NS,$=oe("packages/modules/charts/typography.js"),ke=$.textWidth,we=$.widestLabel,se=8,ie=6,Z=.4;function le(T,W){const G=typeof T=="number"?T:W,A=T&&typeof T=="object"?T:{},p=f=>Number.isFinite(f)&&f>=0?Number(f):G;return{base:G,top:p(A.top),right:p(A.right),bottom:p(A.bottom),left:p(A.left)}}function D(T){const W=le(T.margin,typeof T.padding=="number"?T.padding:8),G=W.base,A=T.fontSize||12,p=T.yLabels||[],f=T.xLabels||[],w=T.ySide==="right"?"right":"left",N=w==="right"?"left":"right",q=T.titles||{},k=T.titleSize||A,_=C=>C?k+ie:0,c=we(p,A),v=p.length?Math.min(T.width*Z,W[w]+c+ie):Math.max(se,W[w]),E=W[N]+(T.rightGutter||0),m=(w==="left"?v:E)+_(q.left),y=we(f.map(C=>String(C).slice(0,14)),A),P=(f.length?T.rotated?Math.min(T.height*Z,ie+y):A+ie+W.bottom:Math.max(se,W.bottom))+_(q.bottom),Q=(w==="right"?v:E)+_(q.right),K=W.top+(T.topGutter||0),ge=Math.max(0,T.width-m-Q),re=Math.max(0,T.height-K-P);return{left:m,top:K,width:ge,height:re,right:m+ge,bottom:K+re,gutter:{left:m,bottom:P,right:Q,top:K}}}function d(T,W,G,A){if(!T.length||W<=0)return!1;const p=Number.isFinite(A)&&A>0?Number(A):1;return we(T,G)>W*p-4}class L{#r;#n=0;static#i="data-pool-key";constructor(W,G=0){this.#r=W,this.#n=G>0?G:0}next(W,G,A){if(A!=null)return this.#t(W,G,String(A));const p=this.#r.childNodes[this.#n],f=p&&p.tagName,w=/(^|\s)\S*__axis-title(\s|$)/,N=f&&w.test(String(p.getAttribute("class")||"")),q=!!G&&w.test(String(G));if(f&&(!N||q)&&String(f).toLowerCase()===W.toLowerCase())return G&&p.setAttribute("class",G),this.#n++,p;const k=this.#r.ownerDocument.createElementNS(ae,W);return G&&k.setAttribute("class",G),p?this.#r.insertBefore(k,p):this.#r.appendChild(k),this.#n++,k}#t(W,G,A){const p=W.toLowerCase();for(let N=this.#n;N<this.#r.childNodes.length;N++){const q=this.#r.childNodes[N],k=q&&q.tagName;if(k&&String(k).toLowerCase()===p&&q.getAttribute(L.#i)===A)return N!==this.#n&&this.#r.insertBefore(q,this.#r.childNodes[this.#n]),G&&q.setAttribute("class",G),this.#n++,q}const f=this.#r.ownerDocument.createElementNS(ae,W);f.setAttribute(L.#i,A),G&&f.setAttribute("class",G);const w=this.#r.childNodes[this.#n];return w?this.#r.insertBefore(f,w):this.#r.appendChild(f),this.#n++,f}finish(){for(;this.#r.childNodes.length>this.#n;)this.#r.removeChild(this.#r.lastChild);this.#n=0}}}),tt("packages/core/src/internal/util.js",function(r,oe){"use strict";Object.defineProperty(r,"VERSION",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"reportedWarnings",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"warnOnce",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"infoOnce",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"resetWarnings",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"fail",{enumerable:!0,get:function(){return A}}),Object.defineProperty(r,"invariant",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"DEV",{enumerable:!0,get:function(){return f}}),Object.defineProperty(r,"isObject",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"isFunction",{enumerable:!0,get:function(){return N}}),Object.defineProperty(r,"isNil",{enumerable:!0,get:function(){return q}}),Object.defineProperty(r,"isBlank",{enumerable:!0,get:function(){return k}}),Object.defineProperty(r,"isCtor",{enumerable:!0,get:function(){return _}}),Object.defineProperty(r,"pathGetter",{enumerable:!0,get:function(){return v}}),Object.defineProperty(r,"pathSetter",{enumerable:!0,get:function(){return m}}),Object.defineProperty(r,"getPath",{enumerable:!0,get:function(){return y}}),Object.defineProperty(r,"setPath",{enumerable:!0,get:function(){return P}}),Object.defineProperty(r,"humanise",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(r,"escapeHtml",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(r,"titleCase",{enumerable:!0,get:function(){return re}}),Object.defineProperty(r,"expand",{enumerable:!0,get:function(){return C}}),Object.defineProperty(r,"toArray",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(r,"merge",{enumerable:!0,get:function(){return n}}),Object.defineProperty(r,"mergeRow",{enumerable:!0,get:function(){return e}}),Object.defineProperty(r,"Lru",{enumerable:!0,get:function(){return i}}),Object.defineProperty(r,"collator",{enumerable:!0,get:function(){return b}}),Object.defineProperty(r,"defaultCompare",{enumerable:!0,get:function(){return O}}),Object.defineProperty(r,"now",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(r,"nextFrame",{enumerable:!0,get:function(){return F}}),Object.defineProperty(r,"cancelFrame",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"frameBatched",{enumerable:!0,get:function(){return M}}),Object.defineProperty(r,"settleDebounce",{enumerable:!0,get:function(){return B}}),Object.defineProperty(r,"whenIdle",{enumerable:!0,get:function(){return I}}),Object.defineProperty(r,"uid",{enumerable:!0,get:function(){return fe}});const Ae="1.86.4";async function ae(){return Ae}const $="1.86.4",ke=new Set,we=2e3;function se(a){if(ke.add(a),ke.size>we){const x=ke.values().next().value;x!==void 0&&ke.delete(x)}}const ie=[],Z=500;function le(a,x,R){ie.push({key:a,level:x,message:R.map(o=>typeof o=="string"?o:D(o)).join(" "),at:Date.now()}),ie.length>Z&&ie.shift()}function D(a){if(a instanceof Error)return a.message;try{return JSON.stringify(a)}catch{return String(a)}}function d(){return ie.map(a=>({...a}))}function L(a){if(a.length===0||typeof a[0]!="string")return a;const x=a[0].replace(/^\[lattice\]\s*/,"");return x===a[0]?a:[x,...a.slice(1)]}function T(a,...x){if(ke.has(a))return;se(a);const R=L(x);le(a,"warn",R),console.warn("[lattice]",...R)}function W(a,...x){if(ke.has(a))return;se(a);const R=L(x);le(a,"info",R),console.info("[lattice]",...R)}function G(){ke.clear(),ie.length=0}function A(a,x){const R=new Error(`[lattice] ${a}`);throw x!==void 0&&(R.cause=x),R}function p(a,x){a||A(x)}const f=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function w(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)}function N(a){return typeof a=="function"}function q(a){return a==null}function k(a){return a==null||a===""}function _(a){return typeof a!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(a))?!0:!!(a.prototype&&Object.getOwnPropertyNames(a.prototype).length>1)}const c=new Map;function v(a){let x=c.get(a);if(x)return x;if(!a.includes("."))x=R=>R?.[a];else{const R=a.split("."),o=R.length;x=l=>{let t=l;for(let h=0;h<o;h++){if(t==null)return;t=t[R[h]]}return t}}return c.set(a,x),x}const E=new Map;function m(a){let x=E.get(a);if(x)return x;if(!a.includes("."))x=(R,o)=>{R!=null&&(R[a]=o)};else{const R=a.split("."),o=R.length-1;x=(l,t)=>{let h=l;for(let j=0;j<o;j++){if(h==null)return;const U=R[j];h[U]==null&&(h[U]={}),h=h[U]}h!=null&&(h[R[o]]=t)}}return E.set(a,x),x}function y(a,x){return v(x)(a)}function P(a,x,R){m(x)(a,R)}function Q(a){return a?(a.includes(".")?a.slice(a.lastIndexOf(".")+1):a).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(/^./,R=>R.toUpperCase()):""}const K={"&":"&","<":"<",">":">",'"':""","'":"'"};function ge(a){const x=a==null?"":String(a);return/[&<>"']/.test(x)?x.replace(/[&<>"']/g,R=>K[R]):x}function re(a){return String(a).replace(/\w\S*/g,x=>x[0].toUpperCase()+x.slice(1).toLowerCase())}function C(a,x,R){if(a!==void 0)return a===!0?{enabled:!0,...R}:a===!1?{enabled:!1}:w(a)?a:{[x]:a,enabled:!0}}function ee(a){return a==null?[]:Array.isArray(a)?a:[a]}const z=Object.freeze(new Set(["__proto__","constructor","prototype"]));function n(a,x){if(!w(a))return w(x)?{...x}:x;if(!w(x))return x===void 0?a:x;const R={...a};for(const o of Object.keys(x)){if(z.has(o))continue;const l=x[o];l!==void 0&&(R[o]=w(l)&&w(R[o])?n(R[o],l):l)}return R}function e(a,x){if(!w(a)||!w(x)||a===x)return x;const R=Object.create(Object.getPrototypeOf(a));return Object.assign(R,a,x),R}class i{#r;#n=new Map;#i;constructor(x=256,R=null){this.#r=x,this.#i=R}get size(){return this.#n.size}get max(){return this.#r}set max(x){this.#r=x,this.#t()}has(x){return this.#n.has(x)}get(x){const R=this.#n;if(!R.has(x))return;const o=R.get(x);return R.delete(x),R.set(x,o),o}peek(x){return this.#n.get(x)}set(x,R){const o=this.#n;return o.has(x)&&o.delete(x),o.set(x,R),this.#t(),R}delete(x){const R=this.#n.get(x);return this.#n.delete(x)&&this.#i&&this.#i(R,x),R}clear(){if(this.#i)for(const[x,R]of this.#n)this.#i(R,x);this.#n.clear()}keys(){return this.#n.keys()}values(){return this.#n.values()}#t(){const x=this.#n;for(;x.size>this.#r;){const R=x.keys().next().value,o=x.get(R);x.delete(R),this.#i&&this.#i(o,R)}}}const g=new Map;function b(a,x){const R=`${a||""}|${x?JSON.stringify(x):""}`;let o=g.get(R);return o||(o=new Intl.Collator(a||void 0,{numeric:!0,sensitivity:"variant",...x}),g.set(R,o)),o}function O(a,x){if(a===x)return 0;if(a==null)return 1;if(x==null)return-1;if(typeof a=="number"&&typeof x=="number")return Number.isNaN(a)?Number.isNaN(x)?0:1:Number.isNaN(x)||a<x?-1:a>x?1:0;const R=String(a),o=String(x);return R<o?-1:R>o?1:0}function ne(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const H=typeof requestAnimationFrame=="function";function F(a){return H?requestAnimationFrame(a):setTimeout(()=>a(ne()),16)}function s(a){a!=null&&(H?cancelAnimationFrame(a):clearTimeout(a))}function M(a){let x=null,R=null;const o=()=>{x=null;const t=R;R=null,a(...t||[])},l=(...t)=>{R=t,x===null&&(x=F(o))};return l.cancel=()=>{s(x),x=null,R=null},l.flush=()=>{x!==null&&(s(x),o())},l}function B(a,x){let R=null,o=null;const l=()=>{if(R=null,o===null)return;const j=o;o=null,a(...j),t()},t=()=>{R=setTimeout(l,x),typeof R?.unref=="function"&&R.unref()},h=(...j)=>{R===null?(a(...j),t()):(o=j,clearTimeout(R),t())};return h.flush=()=>{if(R!==null&&clearTimeout(R),R=null,o===null)return;const j=o;o=null,a(...j)},h.cancel=()=>{R!==null&&clearTimeout(R),R=null,o=null},h.pending=()=>R!==null||o!==null,h}function I(a,x=50){return typeof requestIdleCallback=="function"?requestIdleCallback(a,{timeout:x}):setTimeout(()=>a({timeRemaining:()=>0,didTimeout:!0}),1)}let V=0;function fe(a="l"){return`${a}${(++V).toString(36)}`}}),tt("packages/modules/charts/fills.js",function(r,oe){"use strict";Object.defineProperty(r,"PATTERNS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"GRADIENTS",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(r,"isFill",{enumerable:!0,get:function(){return le}}),Object.defineProperty(r,"isPaintRef",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"paintFallback",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"normaliseFill",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"swatchCss",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"createFillRegistry",{enumerable:!0,get:function(){return A}}),Object.defineProperty(r,"rowPaint",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"patternSeries",{enumerable:!0,get:function(){return f}}),Object.defineProperty(r,"paintSolid",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"rowFillSource",{enumerable:!0,get:function(){return N}}),Object.defineProperty(r,"nodePaint",{enumerable:!0,get:function(){return q}});const ae=oe("packages/core/src/internal/util.js").warnOnce,$=Object.freeze(["hatch","crosshatch","dots","grid"]),ke=Object.freeze(["linear","radial"]),we=8,se="#0072b2";let ie=0;const Z=new Map;function le(k){return!!k&&typeof k=="object"&&!Array.isArray(k)&&(typeof k.gradient=="string"||typeof k.pattern=="string")}function D(k){return typeof k=="string"&&k.startsWith("url(#")}function d(k){if(typeof k!="string")return k==null?"":String(k);if(!k.startsWith("url("))return k;const _=k.indexOf(")");return(_<0?"":k.slice(_+1).trim())||se}function L(k,_){ae(`chart:fill:invalid:${k}`,`a chart fill object was ignored: ${_} 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 T(k,_){if(!le(k))return null;const c=_||se;if(typeof k.gradient=="string"){if(!ke.includes(k.gradient))return L("gradient",`the gradient "${k.gradient}" is not one of ${ke.join(", ")}.`),null;const y=Array.isArray(k.stops)?k.stops:[],P=[];for(const K of y){const ge=Array.isArray(K)?Number(K[0]):Number(K&&K.offset),re=Array.isArray(K)?K[1]:K&&K.colour;!Number.isFinite(ge)||typeof re!="string"||!re||P.push({offset:Math.min(1,Math.max(0,ge)),colour:re})}if(P.length<2)return L("stops","a gradient needs at least two [offset, colour] stops."),null;P.sort((K,ge)=>K.offset-ge.offset);const Q=Number.isFinite(Number(k.angle))?Number(k.angle):180;return{kind:k.gradient,angle:Q,stops:P,solid:P[0].colour}}if(!$.includes(k.pattern))return L("pattern",`the pattern "${k.pattern}" is not one of ${$.join(", ")}.`),null;const v=Number(k.size),E=Number(k.angle),m=typeof k.colour=="string"&&k.colour?k.colour:c;return{kind:"pattern",pattern:k.pattern,colour:m,background:typeof k.background=="string"&&k.background?k.background:null,size:Number.isFinite(v)&&v>=2?v:we,angle:Number.isFinite(E)?E:k.pattern==="grid"||k.pattern==="dots"?0:45,solid:m}}function W(k){if(k.kind==="pattern"){const c=k.colour,v=k.size,E=Math.max(1,v/5),m=k.background||"transparent",y=P=>`repeating-linear-gradient(${P+90}deg,${c} 0 ${E}px,transparent ${E}px ${v}px)`;return k.pattern==="hatch"?`${y(k.angle)},${m}`:k.pattern==="crosshatch"?`${y(k.angle)},${y(k.angle+90)},${m}`:k.pattern==="grid"?`${y(k.angle)},${y(k.angle+90)},${m}`:`radial-gradient(circle at 50% 50%,${c} ${v/6}px,transparent ${v/6+.5}px) 0 0/${v}px ${v}px,${m}`}const _=k.stops.map(c=>`${c.colour} ${Math.round(c.offset*100)}%`).join(",");return k.kind==="radial"?`radial-gradient(circle,${_})`:`linear-gradient(${k.angle}deg,${_})`}function G(k){if(!D(k))return typeof k=="string"?k:"";const _=String(k).indexOf(")"),c=String(k).slice(5,_),v=Z.get(c);return v?W(v):d(k)}function A(k){const _=`lattice-fill-${++ie}`;let c=new Map,v=0;const E=(y,P)=>{const Q=k.ownerDocument.createElementNS("http://www.w3.org/2000/svg",y);for(const K of Object.keys(P))Q.setAttribute(K,String(P[K]));return Q},m=(y,P)=>{if(P.kind==="pattern"){const K=P.size,ge=Math.max(1,K/5),re=E("pattern",{id:y,width:K,height:K,patternUnits:"userSpaceOnUse"});P.angle&&re.setAttribute("patternTransform",`rotate(${P.angle})`),P.background&&re.appendChild(E("rect",{width:K,height:K,fill:P.background}));const C={stroke:P.colour,"stroke-width":ge};P.pattern==="dots"?re.appendChild(E("circle",{cx:K/2,cy:K/2,r:Math.max(1,K/6),fill:P.colour})):(re.appendChild(E("line",{x1:K/2,y1:0,x2:K/2,y2:K,...C})),P.pattern!=="hatch"&&re.appendChild(E("line",{x1:0,y1:K/2,x2:K,y2:K/2,...C}))),k.appendChild(re);return}let Q;if(P.kind==="radial")Q=E("radialGradient",{id:y,cx:.5,cy:.5,r:.5});else{const K=P.angle*Math.PI/180,ge=Math.sin(K)/2,re=-Math.cos(K)/2;Q=E("linearGradient",{id:y,x1:+(.5-ge).toFixed(4),y1:+(.5-re).toFixed(4),x2:+(.5+ge).toFixed(4),y2:+(.5+re).toFixed(4)})}for(const K of P.stops)Q.appendChild(E("stop",{offset:K.offset,"stop-color":K.colour}));k.appendChild(Q)};return{prefix:_,paint(y,P){const Q=T(y,P);if(!Q)return P||se;if(!k||!k.ownerDocument)return Q.solid;const K=JSON.stringify(Q);let ge=c.get(K);if(!ge){const re=`${_}-${v++}`;m(re,Q),Z.set(re,Q),ge=`url(#${re}) ${Q.solid}`,c.set(K,ge)}return ge},reset(){for(const y of c.values())Z.delete(y.slice(5,y.indexOf(")")));if(c=new Map,v=0,k)for(;k.firstChild;)k.removeChild(k.firstChild)},ids(){return[...c.values()].map(y=>y.slice(5,y.indexOf(")")))}}}function p(k,_,c){if(k==null||k==="")return null;const v=d(c);if(le(k))return _?_.paint(k,v):(T(k,v)||{}).solid||null;if(typeof k=="string"){if($.includes(k)){const E={pattern:k,colour:v};return _?_.paint(E,v):v}return k}return null}function f(k){const _=[{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 k.map((c,v)=>({..._[v%_.length],colour:c,background:"var(--lattice-background, #fff)"}))}function w(k){return D(k)?String(k).replace(/^url\([^)]*\)\s*/,""):k}function N(k,_){const c=k.fill;if(le(c))return(E,m)=>p(c,_.fills,w(m));if(typeof c=="function")return(E,m)=>{let y=null;try{y=c({label:E.label,x:E.x,y:E.y,rowKey:E.rowKey})}catch{y=null}return p(y,_.fills,w(m))};const v=typeof c=="string"?c:c&&typeof c=="object"&&typeof c.col=="string"?c.col:null;return v?(E,m)=>E.rowKey===void 0||E.rowKey===null?null:p(k.grid.rows.value(E.rowKey,v),_.fills,w(m)):null}function q(k,_,c){return k&&k({label:_.label,x:_.value,y:_.total,rowKey:_.rowKey},c)||c}}),tt("packages/modules/charts/scheme.js",function(r,oe){"use strict";Object.defineProperty(r,"PALETTE",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"SCHEMES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(r,"registerScheme",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"setDefaultScheme",{enumerable:!0,get:function(){return L}}),Object.defineProperty(r,"schemeNames",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"resolveScheme",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"RAMP_SCALES",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"toRgb",{enumerable:!0,get:function(){return k}}),Object.defineProperty(r,"rampStops",{enumerable:!0,get:function(){return _}});const ae=oe("packages/core/src/internal/util.js").warnOnce,$=oe("packages/modules/charts/fills.js"),ke=$.isFill,we=$.patternSeries,se=$.rowPaint,ie=Object.freeze(["#0072b2","#e69f00","#009e73","#cc79a7","#56b4e9","#d55e00","#7a5195","#6b7d8c"]),Z=Object.freeze({default:{series:ie,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:we(ie),sequential:["#ecf3f9","#005280"],diverging:["#b04a00","#f7f7f7","#005280"],positive:"#009e73",negative:"#d55e00"}}),le=new Map;let D="default";function d(c,v){!c||!v||le.set(String(c),v)}function L(c){if(typeof c=="string"){D=c;return}c&&typeof c=="object"&&(le.set("__default__",c),D="__default__")}function T(){return[...Object.keys(Z),...le.keys()].filter(c=>!c.startsWith("__"))}function W(c){return le.has(c)?le.get(c):Z[c]||null}const G=["series","sequential","diverging","positive","negative"];function A(c){return!c||typeof c!="object"||Array.isArray(c)?!1:!G.some(v=>v in c)}function p(c,v){const E=v&&v.fills||null,m=W(D)||Z.default,y=c&&c.scheme,P=A(y)?y:null,Q=Array.isArray(y)&&y.length?y:null,K=typeof y=="string"?W(y):P||Array.isArray(y)?null:y||null,ge=(c&&Array.isArray(c.palette)&&c.palette.length?c.palette:null)||Q;P&&ge&&ae("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 re=P?null:ge,C={...Z.default,...m,...K||{}};re&&(C.series=re);const ee=c&&c.ramp&&typeof c.ramp=="object"&&!Array.isArray(c.ramp)?c.ramp:null,z=ee?ee.colours:c&&c.ramp,n=Array.isArray(z)&&z.length>=2?z:null;n&&(C.sequential=n);const e=ee?N(ee.scale):null,i=!!(K||re||P),g=C.series&&C.series.length?C.series:ie,b=new Map;let O=0;return{...C,series:(H,F)=>{if(P&&F!==void 0&&F!==null){const s=String(F);return Object.prototype.hasOwnProperty.call(P,s)?f(P[s],E,H):(b.has(s)||b.set(s,O++),f(q(g,b.get(s),!0),E,b.get(s)))}return f(q(g,H,i),E,H)},explicit:i,nameMap:!!P,rampScale:e,fills:E}}function f(c,v,E){if(!ke(c))return c;const m=ie[(E%ie.length+ie.length)%ie.length];return se(c,v,m)||m}const w=Object.freeze(["linear","log","quantile"]);function N(c){return c==null?null:w.includes(c)?c:(ae(`chart:ramp:scale:${String(c)}`,`chart "ramp.scale" was "${String(c)}", which is not a ramp scale; the chart chose one from its values instead. Use "linear", "log" or "quantile".`),null)}function q(c,v,E){const m=(v%c.length+c.length)%c.length;return E||typeof c[m]!="string"?c[m]:`var(--lattice-chart-${m+1}, ${c[m]})`}function k(c){if(typeof c!="string")return null;const v=c.trim(),E=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(v);if(E){const P=E[1];return P.length===3?[0,1,2].map(Q=>parseInt(P[Q]+P[Q],16)):[0,2,4].map(Q=>parseInt(P.slice(Q,Q+2),16))}const m=/^rgba?\(([^)]+)\)$/i.exec(v);if(!m)return null;const y=m[1].split(/[\s,/]+/).filter(Boolean).slice(0,3).map(Number);return y.length===3&&y.every(P=>Number.isFinite(P))?y:null}function _(c,v){const E=v?c.diverging:c.sequential,m=v?Z.default.diverging:Z.default.sequential,y=(Array.isArray(E)?E:m).map((P,Q)=>k(P)||k(m[Q])||[0,0,0]);return y.length>=2?y:m.map(P=>k(P))}}),tt("packages/modules/charts/styles.js",function(r,oe){"use strict";Object.defineProperty(r,"NS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"seriesColour",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"css",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"injectStyles",{enumerable:!0,get:function(){return ie}});const ae=oe("packages/modules/charts/scheme.js").PALETTE,$="lat-chartview",ke="data-lattice-chartview";function we(Z){const le=(Z%ae.length+ae.length)%ae.length;return`var(--lattice-chart-${le+1}, ${ae[le]})`}function se(){return`
|
|
7
|
-
.${
|
|
6
|
+
var io=Object.create(null),ao=Object.create(null);function it(n,re){io[n]=re}function lo(n){var re=ao[n];if(re)return re;var Se=Object.create(null);ao[n]=Se;var ce=io[n];if(!ce)throw new Error("[lattice] missing module: "+n);return ce(Se,lo),Se}it("packages/modules/charts/svg.js",function(n,re){"use strict";Object.defineProperty(n,"SVG_NS",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(n,"el",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"svg",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(n,"attr",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"attrs",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"setText",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"clear",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"append",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"path",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"ribbonPath",{enumerable:!0,get:function(){return f}}),Object.defineProperty(n,"round",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"pathRings",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"insideRings",{enumerable:!0,get:function(){return W}});const Se="http://www.w3.org/2000/svg";function ce(U){const v=U.indexOf(")");return v<0?U:U.slice(v+1).trim()||"#0072b2"}function N(U,v,m){const u=U.createElement(v);return m&&u.setAttribute("class",m),u}function ve(U,v,m){const u=U.createElementNS(Se,v);if(m)for(const b of Object.keys(m))u.setAttribute(b,String(m[b]));return u}function xe(U,v,m){if(!U)return;if(m==null){U.removeAttribute(v);return}let u=String(m);u.startsWith("url(#")&&(v==="stroke"||v==="fill"&&U.localName==="text")&&(u=ce(u)),U.setAttribute(v,u)}function ie(U,v){if(U)for(const m of Object.keys(v))xe(U,m,v[m])}function ae(U,v){U&&(U.textContent=v==null?"":String(v))}function J(U){if(U)for(;U.firstChild;)U.removeChild(U.firstChild)}function ue(U,v){for(const m of v)m&&U.appendChild(m);return U}function B(U){return U.join(" ")}function f(U){if(!U||U.length<2)return"";const v=["M",U[0].x,U[0].upper];for(let m=1;m<U.length;m++)v.push("L",U[m].x,U[m].upper);for(let m=U.length-1;m>=0;m--)v.push("L",U[m].x,U[m].lower);return v.push("Z"),B(v)}function L(U){return Math.round(U*100)/100}function P(U){const v=[];let m=[];const u=String(U||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let b="",O=[];const Q=()=>{if(!b||!O.length){O=[];return}if(b==="M"||b==="L")for(let w=0;w+1<O.length;w+=2)m.push([O[w],O[w+1]]);else b!=="Z"&&O.length>=2&&m.push([O[O.length-2],O[O.length-1]]);O=[]};for(const w of u){if(/[A-Za-z]/.test(w)){if(Q(),w==="Z"||w==="z"){m.length>2&&v.push(m),m=[],b="";continue}w==="M"&&m.length>2&&(v.push(m),m=[]),b=w;continue}O.push(Number(w))}return Q(),m.length>2&&v.push(m),v}function W(U,v,m){let u=!1;for(const b of U)for(let O=0,Q=b.length-1;O<b.length;Q=O++){const[w,R]=b[O],[i,x]=b[Q];R>m!=x>m&&v<(i-w)*(m-R)/(x-R||1e-12)+w&&(u=!u)}return u}}),it("packages/modules/charts/typography.js",function(n,re){"use strict";Object.defineProperty(n,"BASE_SIZE",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(n,"BASE_FAMILY",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"CHAR_RATIO",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"resolveType",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(n,"textWidth",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"widestLabel",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"truncateTo",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"applySize",{enumerable:!0,get:function(){return ue}});const Se=12,ce="var(--lattice-font-family, system-ui, -apple-system, sans-serif)",N=.62;function ve(B){const f=B&&B.font,L=typeof f=="number"?{size:f}:f||{},P=xe(L.size,Se);return{family:L.family||ce,size:P,small:xe(L.small??L.tickSize,Math.max(9,P-1)),title:xe(L.title,Math.round(P*1.15)),axisTitle:xe(L.axisTitle,Math.max(10,P-1)),weight:L.weight||"inherit"}}function xe(B,f){const L=Number(B);return Number.isFinite(L)&&L>0?L:f}function ie(B,f){return String(B??"").length*f*N}function ae(B,f){let L=0;for(const P of B||[]){const W=ie(P,f);W>L&&(L=W)}return L}function J(B,f,L){const P=String(B??""),W=Math.floor(f/(L*N));return W<=0?"":P.length<=W?P:W===1?"…":`${P.slice(0,W-1)}…`}function ue(B,f){!B||!Number.isFinite(f)||(B.style?B.style.fontSize=`${f}px`:B.setAttribute("style",`font-size:${f}px`))}}),it("packages/modules/charts/frame.js",function(n,re){"use strict";Object.defineProperty(n,"LABEL_GAP",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"LABEL_GUTTER_SHARE",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"resolveMargin",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"plotRect",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"shouldRotate",{enumerable:!0,get:function(){return f}}),Object.defineProperty(n,"Pool",{enumerable:!0,get:function(){return L}});const ce=re("packages/modules/charts/svg.js").SVG_NS,N=re("packages/modules/charts/typography.js"),ve=N.textWidth,xe=N.widestLabel,ie=8,ae=6,J=.4;function ue(P,W){const U=typeof P=="number"?P:W,v=P&&typeof P=="object"?P:{},m=u=>Number.isFinite(u)&&u>=0?Number(u):U;return{base:U,top:m(v.top),right:m(v.right),bottom:m(v.bottom),left:m(v.left)}}function B(P){const W=ue(P.margin,typeof P.padding=="number"?P.padding:8),U=W.base,v=P.fontSize||12,m=P.yLabels||[],u=P.xLabels||[],b=P.ySide==="right"?"right":"left",O=b==="right"?"left":"right",Q=P.titles||{},w=P.titleSize||v,R=C=>C?w+ae:0,i=xe(m,v),x=m.length?Math.min(P.width*J,W[b]+i+ae):Math.max(ie,W[b]),T=W[O]+(P.rightGutter||0),h=(b==="left"?x:T)+R(Q.left),g=xe(u.map(C=>String(C).slice(0,14)),v),j=(u.length?P.rotated?Math.min(P.height*J,ae+g):v+ae+W.bottom:Math.max(ie,W.bottom))+R(Q.bottom),X=(b==="right"?x:T)+R(Q.right),K=W.top+(P.topGutter||0),pe=Math.max(0,P.width-h-X),ne=Math.max(0,P.height-K-j);return{left:h,top:K,width:pe,height:ne,right:h+pe,bottom:K+ne,gutter:{left:h,bottom:j,right:X,top:K}}}function f(P,W,U,v){if(!P.length||W<=0)return!1;const m=Number.isFinite(v)&&v>0?Number(v):1;return xe(P,U)>W*m-4}class L{#r;#n=0;static#i="data-pool-key";constructor(W,U=0){this.#r=W,this.#n=U>0?U:0}next(W,U,v){if(v!=null)return this.#t(W,U,String(v));const m=this.#r.childNodes[this.#n],u=m&&m.tagName,b=/(^|\s)\S*__axis-title(\s|$)/,O=u&&b.test(String(m.getAttribute("class")||"")),Q=!!U&&b.test(String(U));if(u&&(!O||Q)&&String(u).toLowerCase()===W.toLowerCase())return U&&m.setAttribute("class",U),this.#n++,m;const w=this.#r.ownerDocument.createElementNS(ce,W);return U&&w.setAttribute("class",U),m?this.#r.insertBefore(w,m):this.#r.appendChild(w),this.#n++,w}#t(W,U,v){const m=W.toLowerCase();for(let O=this.#n;O<this.#r.childNodes.length;O++){const Q=this.#r.childNodes[O],w=Q&&Q.tagName;if(w&&String(w).toLowerCase()===m&&Q.getAttribute(L.#i)===v)return O!==this.#n&&this.#r.insertBefore(Q,this.#r.childNodes[this.#n]),U&&Q.setAttribute("class",U),this.#n++,Q}const u=this.#r.ownerDocument.createElementNS(ce,W);u.setAttribute(L.#i,v),U&&u.setAttribute("class",U);const b=this.#r.childNodes[this.#n];return b?this.#r.insertBefore(u,b):this.#r.appendChild(u),this.#n++,u}finish(){for(;this.#r.childNodes.length>this.#n;)this.#r.removeChild(this.#r.lastChild);this.#n=0}}}),it("packages/core/src/internal/util.js",function(n,re){"use strict";Object.defineProperty(n,"VERSION",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"reportedWarnings",{enumerable:!0,get:function(){return f}}),Object.defineProperty(n,"warnOnce",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"infoOnce",{enumerable:!0,get:function(){return W}}),Object.defineProperty(n,"resetWarnings",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"fail",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"invariant",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"DEV",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"isObject",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"isFunction",{enumerable:!0,get:function(){return O}}),Object.defineProperty(n,"isNil",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"isBlank",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"isCtor",{enumerable:!0,get:function(){return R}}),Object.defineProperty(n,"pathGetter",{enumerable:!0,get:function(){return x}}),Object.defineProperty(n,"pathSetter",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"getPath",{enumerable:!0,get:function(){return g}}),Object.defineProperty(n,"setPath",{enumerable:!0,get:function(){return j}}),Object.defineProperty(n,"humanise",{enumerable:!0,get:function(){return X}}),Object.defineProperty(n,"escapeHtml",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(n,"titleCase",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(n,"expand",{enumerable:!0,get:function(){return C}}),Object.defineProperty(n,"toArray",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"merge",{enumerable:!0,get:function(){return t}}),Object.defineProperty(n,"mergeRow",{enumerable:!0,get:function(){return e}}),Object.defineProperty(n,"Lru",{enumerable:!0,get:function(){return s}}),Object.defineProperty(n,"collator",{enumerable:!0,get:function(){return p}}),Object.defineProperty(n,"defaultCompare",{enumerable:!0,get:function(){return M}}),Object.defineProperty(n,"now",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(n,"nextFrame",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"cancelFrame",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"frameBatched",{enumerable:!0,get:function(){return A}}),Object.defineProperty(n,"settleDebounce",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"whenIdle",{enumerable:!0,get:function(){return D}}),Object.defineProperty(n,"uid",{enumerable:!0,get:function(){return de}});const Se="1.86.5";async function ce(){return Se}const N="1.86.5",ve=new Set,xe=2e3;function ie($){if(ve.add($),ve.size>xe){const _=ve.values().next().value;_!==void 0&&ve.delete(_)}}const ae=[],J=500;function ue($,_,oe){ae.push({key:$,level:_,message:oe.map(a=>typeof a=="string"?a:B(a)).join(" "),at:Date.now()}),ae.length>J&&ae.shift()}function B($){if($ instanceof Error)return $.message;try{return JSON.stringify($)}catch{return String($)}}function f(){return ae.map($=>({...$}))}function L($){if($.length===0||typeof $[0]!="string")return $;const _=$[0].replace(/^\[lattice\]\s*/,"");return _===$[0]?$:[_,...$.slice(1)]}function P($,..._){if(ve.has($))return;ie($);const oe=L(_);ue($,"warn",oe),console.warn("[lattice]",...oe)}function W($,..._){if(ve.has($))return;ie($);const oe=L(_);ue($,"info",oe),console.info("[lattice]",...oe)}function U(){ve.clear(),ae.length=0}function v($,_){const oe=new Error(`[lattice] ${$}`);throw _!==void 0&&(oe.cause=_),oe}function m($,_){$||v(_)}const u=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function b($){return $!==null&&typeof $=="object"&&!Array.isArray($)}function O($){return typeof $=="function"}function Q($){return $==null}function w($){return $==null||$===""}function R($){return typeof $!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call($))?!0:!!($.prototype&&Object.getOwnPropertyNames($.prototype).length>1)}const i=new Map;function x($){let _=i.get($);if(_)return _;if(!$.includes("."))_=oe=>oe?.[$];else{const oe=$.split("."),a=oe.length;_=y=>{let r=y;for(let k=0;k<a;k++){if(r==null)return;r=r[oe[k]]}return r}}return i.set($,_),_}const T=new Map;function h($){let _=T.get($);if(_)return _;if(!$.includes("."))_=(oe,a)=>{oe!=null&&(oe[$]=a)};else{const oe=$.split("."),a=oe.length-1;_=(y,r)=>{let k=y;for(let l=0;l<a;l++){if(k==null)return;const I=oe[l];k[I]==null&&(k[I]={}),k=k[I]}k!=null&&(k[oe[a]]=r)}}return T.set($,_),_}function g($,_){return x(_)($)}function j($,_,oe){h(_)($,oe)}function X($){return $?($.includes(".")?$.slice($.lastIndexOf(".")+1):$).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(/^./,oe=>oe.toUpperCase()):""}const K={"&":"&","<":"<",">":">",'"':""","'":"'"};function pe($){const _=$==null?"":String($);return/[&<>"']/.test(_)?_.replace(/[&<>"']/g,oe=>K[oe]):_}function ne($){return String($).replace(/\w\S*/g,_=>_[0].toUpperCase()+_.slice(1).toLowerCase())}function C($,_,oe){if($!==void 0)return $===!0?{enabled:!0,...oe}:$===!1?{enabled:!1}:b($)?$:{[_]:$,enabled:!0}}function q($){return $==null?[]:Array.isArray($)?$:[$]}const z=Object.freeze(new Set(["__proto__","constructor","prototype"]));function t($,_){if(!b($))return b(_)?{..._}:_;if(!b(_))return _===void 0?$:_;const oe={...$};for(const a of Object.keys(_)){if(z.has(a))continue;const y=_[a];y!==void 0&&(oe[a]=b(y)&&b(oe[a])?t(oe[a],y):y)}return oe}function e($,_){if(!b($)||!b(_)||$===_)return _;const oe=Object.create(Object.getPrototypeOf($));return Object.assign(oe,$,_),oe}class s{#r;#n=new Map;#i;constructor(_=256,oe=null){this.#r=_,this.#i=oe}get size(){return this.#n.size}get max(){return this.#r}set max(_){this.#r=_,this.#t()}has(_){return this.#n.has(_)}get(_){const oe=this.#n;if(!oe.has(_))return;const a=oe.get(_);return oe.delete(_),oe.set(_,a),a}peek(_){return this.#n.get(_)}set(_,oe){const a=this.#n;return a.has(_)&&a.delete(_),a.set(_,oe),this.#t(),oe}delete(_){const oe=this.#n.get(_);return this.#n.delete(_)&&this.#i&&this.#i(oe,_),oe}clear(){if(this.#i)for(const[_,oe]of this.#n)this.#i(oe,_);this.#n.clear()}keys(){return this.#n.keys()}values(){return this.#n.values()}#t(){const _=this.#n;for(;_.size>this.#r;){const oe=_.keys().next().value,a=_.get(oe);_.delete(oe),this.#i&&this.#i(a,oe)}}}const d=new Map;function p($,_){const oe=`${$||""}|${_?JSON.stringify(_):""}`;let a=d.get(oe);return a||(a=new Intl.Collator($||void 0,{numeric:!0,sensitivity:"variant",..._}),d.set(oe,a)),a}function M($,_){if($===_)return 0;if($==null)return 1;if(_==null)return-1;if(typeof $=="number"&&typeof _=="number")return Number.isNaN($)?Number.isNaN(_)?0:1:Number.isNaN(_)||$<_?-1:$>_?1:0;const oe=String($),a=String(_);return oe<a?-1:oe>a?1:0}function ee(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const H=typeof requestAnimationFrame=="function";function F($){return H?requestAnimationFrame($):setTimeout(()=>$(ee()),16)}function o($){$!=null&&(H?cancelAnimationFrame($):clearTimeout($))}function A($){let _=null,oe=null;const a=()=>{_=null;const r=oe;oe=null,$(...r||[])},y=(...r)=>{oe=r,_===null&&(_=F(a))};return y.cancel=()=>{o(_),_=null,oe=null},y.flush=()=>{_!==null&&(o(_),a())},y}function G($,_){let oe=null,a=null;const y=()=>{if(oe=null,a===null)return;const l=a;a=null,$(...l),r()},r=()=>{oe=setTimeout(y,_),typeof oe?.unref=="function"&&oe.unref()},k=(...l)=>{oe===null?($(...l),r()):(a=l,clearTimeout(oe),r())};return k.flush=()=>{if(oe!==null&&clearTimeout(oe),oe=null,a===null)return;const l=a;a=null,$(...l)},k.cancel=()=>{oe!==null&&clearTimeout(oe),oe=null,a=null},k.pending=()=>oe!==null||a!==null,k}function D($,_=50){return typeof requestIdleCallback=="function"?requestIdleCallback($,{timeout:_}):setTimeout(()=>$({timeRemaining:()=>0,didTimeout:!0}),1)}let V=0;function de($="l"){return`${$}${(++V).toString(36)}`}}),it("packages/modules/charts/fills.js",function(n,re){"use strict";Object.defineProperty(n,"PATTERNS",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"GRADIENTS",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(n,"isFill",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"isPaintRef",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"paintFallback",{enumerable:!0,get:function(){return f}}),Object.defineProperty(n,"normaliseFill",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"swatchCss",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"createFillRegistry",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"rowPaint",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"patternSeries",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"paintSolid",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"rowFillSource",{enumerable:!0,get:function(){return O}}),Object.defineProperty(n,"nodePaint",{enumerable:!0,get:function(){return Q}});const ce=re("packages/core/src/internal/util.js").warnOnce,N=Object.freeze(["hatch","crosshatch","dots","grid"]),ve=Object.freeze(["linear","radial"]),xe=8,ie="#0072b2";let ae=0;const J=new Map;function ue(w){return!!w&&typeof w=="object"&&!Array.isArray(w)&&(typeof w.gradient=="string"||typeof w.pattern=="string")}function B(w){return typeof w=="string"&&w.startsWith("url(#")}function f(w){if(typeof w!="string")return w==null?"":String(w);if(!w.startsWith("url("))return w;const R=w.indexOf(")");return(R<0?"":w.slice(R+1).trim())||ie}function L(w,R){ce(`chart:fill:invalid:${w}`,`a chart fill object was ignored: ${R} 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(w,R){if(!ue(w))return null;const i=R||ie;if(typeof w.gradient=="string"){if(!ve.includes(w.gradient))return L("gradient",`the gradient "${w.gradient}" is not one of ${ve.join(", ")}.`),null;const g=Array.isArray(w.stops)?w.stops:[],j=[];for(const K of g){const pe=Array.isArray(K)?Number(K[0]):Number(K&&K.offset),ne=Array.isArray(K)?K[1]:K&&K.colour;!Number.isFinite(pe)||typeof ne!="string"||!ne||j.push({offset:Math.min(1,Math.max(0,pe)),colour:ne})}if(j.length<2)return L("stops","a gradient needs at least two [offset, colour] stops."),null;j.sort((K,pe)=>K.offset-pe.offset);const X=Number.isFinite(Number(w.angle))?Number(w.angle):180;return{kind:w.gradient,angle:X,stops:j,solid:j[0].colour}}if(!N.includes(w.pattern))return L("pattern",`the pattern "${w.pattern}" is not one of ${N.join(", ")}.`),null;const x=Number(w.size),T=Number(w.angle),h=typeof w.colour=="string"&&w.colour?w.colour:i;return{kind:"pattern",pattern:w.pattern,colour:h,background:typeof w.background=="string"&&w.background?w.background:null,size:Number.isFinite(x)&&x>=2?x:xe,angle:Number.isFinite(T)?T:w.pattern==="grid"||w.pattern==="dots"?0:45,solid:h}}function W(w){if(w.kind==="pattern"){const i=w.colour,x=w.size,T=Math.max(1,x/5),h=w.background||"transparent",g=j=>`repeating-linear-gradient(${j+90}deg,${i} 0 ${T}px,transparent ${T}px ${x}px)`;return w.pattern==="hatch"?`${g(w.angle)},${h}`:w.pattern==="crosshatch"?`${g(w.angle)},${g(w.angle+90)},${h}`:w.pattern==="grid"?`${g(w.angle)},${g(w.angle+90)},${h}`:`radial-gradient(circle at 50% 50%,${i} ${x/6}px,transparent ${x/6+.5}px) 0 0/${x}px ${x}px,${h}`}const R=w.stops.map(i=>`${i.colour} ${Math.round(i.offset*100)}%`).join(",");return w.kind==="radial"?`radial-gradient(circle,${R})`:`linear-gradient(${w.angle}deg,${R})`}function U(w){if(!B(w))return typeof w=="string"?w:"";const R=String(w).indexOf(")"),i=String(w).slice(5,R),x=J.get(i);return x?W(x):f(w)}function v(w){const R=`lattice-fill-${++ae}`;let i=new Map,x=0;const T=(g,j)=>{const X=w.ownerDocument.createElementNS("http://www.w3.org/2000/svg",g);for(const K of Object.keys(j))X.setAttribute(K,String(j[K]));return X},h=(g,j)=>{if(j.kind==="pattern"){const K=j.size,pe=Math.max(1,K/5),ne=T("pattern",{id:g,width:K,height:K,patternUnits:"userSpaceOnUse"});j.angle&&ne.setAttribute("patternTransform",`rotate(${j.angle})`),j.background&&ne.appendChild(T("rect",{width:K,height:K,fill:j.background}));const C={stroke:j.colour,"stroke-width":pe};j.pattern==="dots"?ne.appendChild(T("circle",{cx:K/2,cy:K/2,r:Math.max(1,K/6),fill:j.colour})):(ne.appendChild(T("line",{x1:K/2,y1:0,x2:K/2,y2:K,...C})),j.pattern!=="hatch"&&ne.appendChild(T("line",{x1:0,y1:K/2,x2:K,y2:K/2,...C}))),w.appendChild(ne);return}let X;if(j.kind==="radial")X=T("radialGradient",{id:g,cx:.5,cy:.5,r:.5});else{const K=j.angle*Math.PI/180,pe=Math.sin(K)/2,ne=-Math.cos(K)/2;X=T("linearGradient",{id:g,x1:+(.5-pe).toFixed(4),y1:+(.5-ne).toFixed(4),x2:+(.5+pe).toFixed(4),y2:+(.5+ne).toFixed(4)})}for(const K of j.stops)X.appendChild(T("stop",{offset:K.offset,"stop-color":K.colour}));w.appendChild(X)};return{prefix:R,paint(g,j){const X=P(g,j);if(!X)return j||ie;if(!w||!w.ownerDocument)return X.solid;const K=JSON.stringify(X);let pe=i.get(K);if(!pe){const ne=`${R}-${x++}`;h(ne,X),J.set(ne,X),pe=`url(#${ne}) ${X.solid}`,i.set(K,pe)}return pe},reset(){for(const g of i.values())J.delete(g.slice(5,g.indexOf(")")));if(i=new Map,x=0,w)for(;w.firstChild;)w.removeChild(w.firstChild)},ids(){return[...i.values()].map(g=>g.slice(5,g.indexOf(")")))}}}function m(w,R,i){if(w==null||w==="")return null;const x=f(i);if(ue(w))return R?R.paint(w,x):(P(w,x)||{}).solid||null;if(typeof w=="string"){if(N.includes(w)){const T={pattern:w,colour:x};return R?R.paint(T,x):x}return w}return null}function u(w){const R=[{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 w.map((i,x)=>({...R[x%R.length],colour:i,background:"var(--lattice-background, #fff)"}))}function b(w){return B(w)?String(w).replace(/^url\([^)]*\)\s*/,""):w}function O(w,R){const i=w.fill;if(ue(i))return(T,h)=>m(i,R.fills,b(h));if(typeof i=="function")return(T,h)=>{let g=null;try{g=i({label:T.label,x:T.x,y:T.y,rowKey:T.rowKey})}catch{g=null}return m(g,R.fills,b(h))};const x=typeof i=="string"?i:i&&typeof i=="object"&&typeof i.col=="string"?i.col:null;return x?(T,h)=>T.rowKey===void 0||T.rowKey===null?null:m(w.grid.rows.value(T.rowKey,x),R.fills,b(h)):null}function Q(w,R,i){return w&&w({label:R.label,x:R.value,y:R.total,rowKey:R.rowKey},i)||i}}),it("packages/modules/charts/scheme.js",function(n,re){"use strict";Object.defineProperty(n,"PALETTE",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"SCHEMES",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"registerScheme",{enumerable:!0,get:function(){return f}}),Object.defineProperty(n,"setDefaultScheme",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"schemeNames",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"resolveScheme",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"RAMP_SCALES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"toRgb",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"rampStops",{enumerable:!0,get:function(){return R}});const ce=re("packages/core/src/internal/util.js").warnOnce,N=re("packages/modules/charts/fills.js"),ve=N.isFill,xe=N.patternSeries,ie=N.rowPaint,ae=Object.freeze(["#0072b2","#e69f00","#009e73","#cc79a7","#56b4e9","#d55e00","#7a5195","#6b7d8c"]),J=Object.freeze({default:{series:ae,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:xe(ae),sequential:["#ecf3f9","#005280"],diverging:["#b04a00","#f7f7f7","#005280"],positive:"#009e73",negative:"#d55e00"}}),ue=new Map;let B="default";function f(i,x){!i||!x||ue.set(String(i),x)}function L(i){if(typeof i=="string"){B=i;return}i&&typeof i=="object"&&(ue.set("__default__",i),B="__default__")}function P(){return[...Object.keys(J),...ue.keys()].filter(i=>!i.startsWith("__"))}function W(i){return ue.has(i)?ue.get(i):J[i]||null}const U=["series","sequential","diverging","positive","negative"];function v(i){return!i||typeof i!="object"||Array.isArray(i)?!1:!U.some(x=>x in i)}function m(i,x){const T=x&&x.fills||null,h=W(B)||J.default,g=i&&i.scheme,j=v(g)?g:null,X=Array.isArray(g)&&g.length?g:null,K=typeof g=="string"?W(g):j||Array.isArray(g)?null:g||null,pe=(i&&Array.isArray(i.palette)&&i.palette.length?i.palette:null)||X;j&&pe&&ce("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 ne=j?null:pe,C={...J.default,...h,...K||{}};ne&&(C.series=ne);const q=i&&i.ramp&&typeof i.ramp=="object"&&!Array.isArray(i.ramp)?i.ramp:null,z=q?q.colours:i&&i.ramp,t=Array.isArray(z)&&z.length>=2?z:null;t&&(C.sequential=t);const e=q?O(q.scale):null,s=!!(K||ne||j),d=C.series&&C.series.length?C.series:ae,p=new Map;let M=0;return{...C,series:(H,F)=>{if(j&&F!==void 0&&F!==null){const o=String(F);return Object.prototype.hasOwnProperty.call(j,o)?u(j[o],T,H):(p.has(o)||p.set(o,M++),u(Q(d,p.get(o),!0),T,p.get(o)))}return u(Q(d,H,s),T,H)},explicit:s,nameMap:!!j,rampScale:e,fills:T}}function u(i,x,T){if(!ve(i))return i;const h=ae[(T%ae.length+ae.length)%ae.length];return ie(i,x,h)||h}const b=Object.freeze(["linear","log","quantile"]);function O(i){return i==null?null:b.includes(i)?i:(ce(`chart:ramp:scale:${String(i)}`,`chart "ramp.scale" was "${String(i)}", which is not a ramp scale; the chart chose one from its values instead. Use "linear", "log" or "quantile".`),null)}function Q(i,x,T){const h=(x%i.length+i.length)%i.length;return T||typeof i[h]!="string"?i[h]:`var(--lattice-chart-${h+1}, ${i[h]})`}function w(i){if(typeof i!="string")return null;const x=i.trim(),T=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(x);if(T){const j=T[1];return j.length===3?[0,1,2].map(X=>parseInt(j[X]+j[X],16)):[0,2,4].map(X=>parseInt(j.slice(X,X+2),16))}const h=/^rgba?\(([^)]+)\)$/i.exec(x);if(!h)return null;const g=h[1].split(/[\s,/]+/).filter(Boolean).slice(0,3).map(Number);return g.length===3&&g.every(j=>Number.isFinite(j))?g:null}function R(i,x){const T=x?i.diverging:i.sequential,h=x?J.default.diverging:J.default.sequential,g=(Array.isArray(T)?T:h).map((j,X)=>w(j)||w(h[X])||[0,0,0]);return g.length>=2?g:h.map(j=>w(j))}}),it("packages/modules/charts/styles.js",function(n,re){"use strict";Object.defineProperty(n,"NS",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"seriesColour",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"css",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"injectStyles",{enumerable:!0,get:function(){return ae}});const ce=re("packages/modules/charts/scheme.js").PALETTE,N="lat-chartview",ve="data-lattice-chartview";function xe(J){const ue=(J%ce.length+ce.length)%ce.length;return`var(--lattice-chart-${ue+1}, ${ce[ue]})`}function ie(){return`
|
|
7
|
+
.${N}{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);
|
|
10
10
|
font-size:var(--lattice-font-size,13px);
|
|
11
11
|
color:var(--lattice-foreground,#1c2126);
|
|
12
12
|
background:var(--lattice-background,#fff);
|
|
13
|
-
--lattice-chart-1:${
|
|
14
|
-
--lattice-chart-3:${
|
|
15
|
-
--lattice-chart-5:${
|
|
16
|
-
--lattice-chart-7:${
|
|
13
|
+
--lattice-chart-1:${ce[0]};--lattice-chart-2:${ce[1]};
|
|
14
|
+
--lattice-chart-3:${ce[2]};--lattice-chart-4:${ce[3]};
|
|
15
|
+
--lattice-chart-5:${ce[4]};--lattice-chart-6:${ce[5]};
|
|
16
|
+
--lattice-chart-7:${ce[6]};--lattice-chart-8:${ce[7]};
|
|
17
17
|
--lattice-chart-grid:var(--lattice-border-color,#dfe3e6);
|
|
18
18
|
--lattice-chart-empty:var(--lattice-surface,#f7f8f9);
|
|
19
19
|
--lattice-chart-axis:var(--lattice-foreground-muted,#5b6670);
|
|
@@ -28,136 +28,136 @@ var io=Object.create(null),ao=Object.create(null);function tt(r,oe){io[r]=oe}fun
|
|
|
28
28
|
--lattice-chart-basemap-fill:#c3cfd6;
|
|
29
29
|
--lattice-chart-basemap-stroke:#456374;
|
|
30
30
|
--lattice-chart-basemap-stroke-width:0.75}
|
|
31
|
-
.${
|
|
31
|
+
.${N}__figure{margin:0;display:flex;flex-direction:column;flex:1 1 auto;min-height:0;
|
|
32
32
|
position:relative}
|
|
33
|
-
.${
|
|
34
|
-
.${
|
|
33
|
+
.${N}__caption{padding:2px 4px 6px;display:flex;flex-direction:column;gap:2px}
|
|
34
|
+
.${N}__title{font-weight:var(--lattice-header-font-weight,600);
|
|
35
35
|
font-size:var(--lattice-font-size,13px)}
|
|
36
|
-
.${
|
|
36
|
+
.${N}__subtitle{color:var(--lattice-foreground-muted,#5b6670);
|
|
37
37
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
38
|
-
.${
|
|
38
|
+
.${N}__footnote{color:var(--lattice-foreground-muted,#5b6670);
|
|
39
39
|
font-size:var(--lattice-font-size-sm,11px);padding:2px 4px 4px}
|
|
40
40
|
/* A label outside its mark sits on the chart's background and takes the axis
|
|
41
41
|
colour; one inside sits on the series colour and needs the contrast the
|
|
42
42
|
background gives it. */
|
|
43
|
-
.${
|
|
44
|
-
.${
|
|
45
|
-
.${
|
|
43
|
+
.${N}__data-label{fill:var(--lattice-chart-axis);pointer-events:none}
|
|
44
|
+
.${N}__data-label[data-inside="true"]{fill:var(--lattice-background,#fff)}
|
|
45
|
+
.${N}__plot{flex:1 1 auto;min-height:0;display:block;width:100%;height:100%;overflow:visible}
|
|
46
46
|
/* The plot is hidden while the empty state is up; the author display:block
|
|
47
47
|
above would otherwise keep an empty frame painted behind the message — the
|
|
48
48
|
mirror of the placeholder's own trap (BACKLOG-0001023). */
|
|
49
|
-
.${
|
|
50
|
-
.${
|
|
51
|
-
.${
|
|
49
|
+
.${N}__plot[hidden]{display:none}
|
|
50
|
+
.${N}__grid line{stroke:var(--lattice-chart-grid);stroke-width:1;shape-rendering:crispEdges}
|
|
51
|
+
.${N}__axis line{stroke:var(--lattice-chart-axis);stroke-width:1;shape-rendering:crispEdges}
|
|
52
52
|
/* Every tick label the axis drawers produce takes this fill regardless of
|
|
53
53
|
which paint group it lands in: a continuous x axis and a banded one both
|
|
54
|
-
draw into ${
|
|
55
|
-
bottom axis), only the measure and band-label axes draw into ${
|
|
54
|
+
draw into ${N}__overlay (BACKLOG-0001481/1470's z-order slot for the
|
|
55
|
+
bottom axis), only the measure and band-label axes draw into ${N}__axis
|
|
56
56
|
itself, and a selector scoped to the group left the overlay ones on the
|
|
57
57
|
SVG default (black) fill under a dark theme — invisible tick text that
|
|
58
58
|
read as "no x axis labels at all" (F-TRADE-P, BACKLOG-0001487). Scoped to
|
|
59
59
|
the class, not the group, so it is honoured wherever a tick is drawn now
|
|
60
60
|
or in the future. */
|
|
61
|
-
.${
|
|
61
|
+
.${N}__tick{fill:var(--lattice-chart-axis);
|
|
62
62
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
63
|
-
.${
|
|
63
|
+
.${N}__axis-title{fill:var(--lattice-chart-axis);
|
|
64
64
|
font-size:var(--lattice-font-size-sm,11px);font-weight:600}
|
|
65
|
-
.${
|
|
66
|
-
.${
|
|
67
|
-
.${
|
|
68
|
-
.${
|
|
69
|
-
.${
|
|
70
|
-
.${
|
|
65
|
+
.${N}__line{fill:none;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
|
|
66
|
+
.${N}__area{stroke:none;opacity:0.18}
|
|
67
|
+
.${N}__bar,.${N}__slice{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
68
|
+
.${N}__point{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
69
|
+
.${N}__mark[data-dim]{opacity:0.18}
|
|
70
|
+
.${N}__brush{fill:var(--lattice-range-background,#e7f1fd);fill-opacity:0.5;
|
|
71
71
|
stroke:var(--lattice-range-border,#1a6bc7);stroke-width:1;pointer-events:none}
|
|
72
|
-
.${
|
|
72
|
+
.${N}__cursor-line{stroke:var(--lattice-chart-axis);stroke-width:1;stroke-dasharray:3 3;
|
|
73
73
|
shape-rendering:crispEdges;pointer-events:none}
|
|
74
|
-
.${
|
|
75
|
-
.${
|
|
76
|
-
.${
|
|
74
|
+
.${N}__cursor-label{fill:var(--lattice-foreground,#1c2126);pointer-events:none}
|
|
75
|
+
.${N}__roc-auc{fill:var(--lattice-foreground,#1c2126);font-weight:600}
|
|
76
|
+
.${N}__cursor-label-text{fill:var(--lattice-background,#fff);
|
|
77
77
|
font-size:var(--lattice-font-size-sm,11px);pointer-events:none}
|
|
78
|
-
.${
|
|
79
|
-
.${
|
|
78
|
+
.${N}__plot:focus{outline:none}
|
|
79
|
+
.${N}__plot:focus-visible{outline:var(--lattice-focus-width,2px) solid var(--lattice-focus-color,#1a6bc7);
|
|
80
80
|
outline-offset:-2px}
|
|
81
|
-
.${
|
|
82
|
-
.${
|
|
81
|
+
.${N}__mark:focus{outline:none}
|
|
82
|
+
.${N}__mark:focus-visible{outline:var(--lattice-focus-width,2px) solid var(--lattice-focus-color,#1a6bc7);
|
|
83
83
|
outline-offset:1px}
|
|
84
|
-
.${
|
|
85
|
-
.${
|
|
86
|
-
.${
|
|
87
|
-
.${
|
|
88
|
-
.${
|
|
89
|
-
.${
|
|
90
|
-
.${
|
|
91
|
-
.${
|
|
92
|
-
.${
|
|
93
|
-
.${
|
|
94
|
-
.${
|
|
95
|
-
.${
|
|
96
|
-
.${
|
|
97
|
-
.${
|
|
98
|
-
.${
|
|
99
|
-
.${
|
|
100
|
-
.${
|
|
101
|
-
.${
|
|
102
|
-
.${
|
|
103
|
-
.${
|
|
104
|
-
.${
|
|
105
|
-
.${
|
|
106
|
-
.${
|
|
107
|
-
.${
|
|
108
|
-
.${
|
|
109
|
-
.${
|
|
84
|
+
.${N}__box{stroke-width:1}
|
|
85
|
+
.${N}__whisker{stroke-width:1;fill:none}
|
|
86
|
+
.${N}__density{stroke-width:1.5;fill:none;opacity:.85}
|
|
87
|
+
.${N}__fit{stroke-width:1.5;fill:none;opacity:.9}
|
|
88
|
+
.${N}__fit-label{font-weight:600;opacity:.9}
|
|
89
|
+
.${N}__trend{stroke-width:1.75;fill:none;opacity:.9}
|
|
90
|
+
.${N}__trend-forecast{stroke-width:1.75;fill:none;opacity:.9;stroke-dasharray:5 4}
|
|
91
|
+
.${N}__trend-label{font-weight:600;opacity:.9}
|
|
92
|
+
.${N}__trend-band{stroke:none;pointer-events:none}
|
|
93
|
+
.${N}__qq-line{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;stroke-dasharray:4 3;fill:none}
|
|
94
|
+
.${N}__ecdf{stroke-width:1.5;fill:none}
|
|
95
|
+
.${N}__control-line{stroke-width:1.25;fill:none}
|
|
96
|
+
.${N}__error-bar{stroke:var(--lattice-foreground,#1a1a1a);stroke-width:1.5;fill:none;stroke-linecap:round}
|
|
97
|
+
.${N}__control-centre{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;fill:none}
|
|
98
|
+
.${N}__control-limit{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;stroke-dasharray:6 3;fill:none}
|
|
99
|
+
.${N}__spec-limit{stroke:var(--lattice-variant-danger-solid,#a4262c);stroke-width:1;stroke-dasharray:2 3;fill:none}
|
|
100
|
+
.${N}__spec-target{stroke:var(--lattice-variant-success-solid,#107c41);stroke-width:1;stroke-dasharray:1 4;fill:none}
|
|
101
|
+
.${N}__control-name{fill:var(--lattice-foreground-muted,#5b6570);font-size:9px;letter-spacing:.04em}
|
|
102
|
+
.${N}__control-rule{fill:var(--lattice-variant-danger-solid,#a4262c);font-size:9px;font-weight:600}
|
|
103
|
+
.${N}__capability-within{stroke:var(--lattice-foreground,#1a1a1a);stroke-width:1.5;fill:none}
|
|
104
|
+
.${N}__capability-overall{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1.5;stroke-dasharray:4 3;fill:none}
|
|
105
|
+
.${N}__lorenz{stroke-width:1.75;fill:none}
|
|
106
|
+
.${N}__lorenz-equality{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;stroke-dasharray:4 3;fill:none}
|
|
107
|
+
.${N}__median{fill:none}
|
|
108
|
+
.${N}__tile{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
109
|
+
.${N}__tile-label{fill:var(--lattice-background,#fff);
|
|
110
110
|
font-size:var(--lattice-font-size-sm,11px);pointer-events:none}
|
|
111
|
-
.${
|
|
112
|
-
.${
|
|
113
|
-
.${
|
|
111
|
+
.${N}__tile-label--branch{fill:var(--lattice-foreground,#1d2733)}
|
|
112
|
+
.${N}__reference{stroke:var(--lattice-chart-axis);stroke-width:1}
|
|
113
|
+
.${N}__reference-label{fill:var(--lattice-chart-axis);
|
|
114
114
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
115
|
-
.${
|
|
116
|
-
.${
|
|
117
|
-
.${
|
|
118
|
-
.${
|
|
119
|
-
.${
|
|
120
|
-
.${
|
|
121
|
-
.${
|
|
115
|
+
.${N}__annotation-line{stroke:var(--lattice-chart-axis);stroke-width:1;stroke-dasharray:4 3;fill:none}
|
|
116
|
+
.${N}__annotation-target{stroke:var(--lattice-variant-success-solid,#107c41);stroke-width:1.5;stroke-dasharray:2 2;fill:none}
|
|
117
|
+
.${N}__annotation-band{stroke:none}
|
|
118
|
+
.${N}__annotation-point{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
119
|
+
.${N}__annotation-event{stroke:var(--lattice-chart-axis);stroke-width:1;fill:none}
|
|
120
|
+
.${N}__annotation-event-flag{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
121
|
+
.${N}__annotation-label{fill:var(--lattice-chart-axis);
|
|
122
122
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
123
|
-
.${
|
|
123
|
+
.${N}__annotation-list{list-style:none;margin:0;padding:0;
|
|
124
124
|
position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
|
|
125
125
|
/* The interactive drawing layer and its rail (BACKLOG-0001474). Every colour is
|
|
126
126
|
a token with a literal fallback, the same rule the rest of this sheet follows,
|
|
127
127
|
so a drawing keeps its contrast when the grid's theme flips to dark: the
|
|
128
128
|
strokes take the foreground rather than a fixed near-black, and the handles
|
|
129
129
|
are knocked out of the background rather than painted white. */
|
|
130
|
-
.${
|
|
131
|
-
.${
|
|
130
|
+
.${N}--annotate-left{flex-direction:row}
|
|
131
|
+
.${N}__annotate-rail{display:flex;gap:2px;padding:3px;align-items:flex-start;
|
|
132
132
|
background:var(--lattice-surface,#f7f8f9);
|
|
133
133
|
border:1px solid var(--lattice-border-color,#dfe3e6);border-radius:4px}
|
|
134
|
-
.${
|
|
135
|
-
.${
|
|
136
|
-
.${
|
|
134
|
+
.${N}__annotate-rail--left{flex-direction:column;margin-right:4px}
|
|
135
|
+
.${N}__annotate-rail--top{flex-direction:row;margin-bottom:4px}
|
|
136
|
+
.${N}__annotate-tool{display:inline-flex;align-items:center;justify-content:center;
|
|
137
137
|
width:22px;height:22px;padding:0;border:1px solid transparent;border-radius:3px;
|
|
138
138
|
background:transparent;color:var(--lattice-foreground,#1c2126);cursor:pointer}
|
|
139
|
-
.${
|
|
140
|
-
.${
|
|
139
|
+
.${N}__annotate-tool:hover{background:var(--lattice-hovered-background,#eef1f4)}
|
|
140
|
+
.${N}__annotate-tool:focus-visible{outline:var(--lattice-focus-width,2px) solid
|
|
141
141
|
var(--lattice-focus-color,#1a6bc7);outline-offset:1px}
|
|
142
|
-
.${
|
|
142
|
+
.${N}__annotate-tool[aria-pressed="true"]{background:var(--lattice-range-background,#e7f1fd);
|
|
143
143
|
border-color:var(--lattice-range-border,#1a6bc7)}
|
|
144
|
-
.${
|
|
144
|
+
.${N}__annotate-icon{width:14px;height:14px;fill:none;stroke:currentColor;
|
|
145
145
|
stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}
|
|
146
|
-
.${
|
|
146
|
+
.${N}__annotate-input{position:absolute;z-index:6;min-width:120px;padding:2px 4px;
|
|
147
147
|
font:inherit;color:var(--lattice-foreground,#1c2126);
|
|
148
148
|
background:var(--lattice-background,#fff);
|
|
149
149
|
border:1px solid var(--lattice-focus-color,#1a6bc7);border-radius:3px}
|
|
150
|
-
.${
|
|
151
|
-
.${
|
|
150
|
+
.${N}__drawn-line{stroke:var(--lattice-foreground,#1c2126);stroke-width:1.5;fill:none}
|
|
151
|
+
.${N}__drawn-pen{stroke:var(--lattice-foreground,#1c2126);stroke-width:2;fill:none;
|
|
152
152
|
stroke-linecap:round;stroke-linejoin:round}
|
|
153
|
-
.${
|
|
154
|
-
.${
|
|
155
|
-
.${
|
|
153
|
+
.${N}__drawn-pen[data-selected="true"]{filter:drop-shadow(0 0 2px var(--lattice-focus-color,#1a6bc7))}
|
|
154
|
+
.${N}__drawn-fill{stroke:none;fill:var(--lattice-foreground,#1c2126);fill-opacity:0.1}
|
|
155
|
+
.${N}__drawn-dot{fill:var(--lattice-foreground,#1c2126);
|
|
156
156
|
stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
157
|
-
.${
|
|
157
|
+
.${N}__drawn-label{fill:var(--lattice-foreground,#1c2126);
|
|
158
158
|
font-size:var(--lattice-font-size-sm,11px);paint-order:stroke;
|
|
159
159
|
stroke:var(--lattice-background,#fff);stroke-width:3px;stroke-linejoin:round}
|
|
160
|
-
.${
|
|
160
|
+
.${N}__drawn-handle{fill:var(--lattice-background,#fff);
|
|
161
161
|
stroke:var(--lattice-focus-color,#1a6bc7);stroke-width:1.5}
|
|
162
162
|
/* The zoom toolbar (BACKLOG-0001473). It floats over the bottom edge of the
|
|
163
163
|
plot rather than taking a row of its own, because a strip that reflowed the
|
|
@@ -165,208 +165,208 @@ var io=Object.create(null),ao=Object.create(null);function tt(r,oe){io[r]=oe}fun
|
|
|
165
165
|
The hover variant fades with opacity, never with visibility or display: a
|
|
166
166
|
hidden button is not focusable, so a keyboard user could never reach the
|
|
167
167
|
control that reveals it, and :focus-within is what shows it to them. */
|
|
168
|
-
.${
|
|
168
|
+
.${N}__zoom-bar{position:absolute;left:50%;transform:translateX(-50%);bottom:2px;
|
|
169
169
|
z-index:5;display:flex;gap:2px;padding:2px;
|
|
170
170
|
background:var(--lattice-surface,#f7f8f9);
|
|
171
171
|
border:1px solid var(--lattice-border-color,#dfe3e6);border-radius:4px}
|
|
172
|
-
.${
|
|
173
|
-
.${
|
|
174
|
-
.${
|
|
175
|
-
@media (prefers-reduced-motion:reduce){.${
|
|
176
|
-
.${
|
|
172
|
+
.${N}__zoom-bar--hover{opacity:0;transition:opacity 120ms ease-in-out}
|
|
173
|
+
.${N}:hover .${N}__zoom-bar--hover,
|
|
174
|
+
.${N}__zoom-bar--hover:focus-within{opacity:1}
|
|
175
|
+
@media (prefers-reduced-motion:reduce){.${N}__zoom-bar--hover{transition:none}}
|
|
176
|
+
.${N}__zoom-button{display:inline-flex;align-items:center;justify-content:center;
|
|
177
177
|
width:22px;height:22px;padding:0;border:1px solid transparent;border-radius:3px;
|
|
178
178
|
background:transparent;color:var(--lattice-foreground,#1c2126);cursor:pointer}
|
|
179
|
-
.${
|
|
180
|
-
.${
|
|
179
|
+
.${N}__zoom-button:hover{background:var(--lattice-hovered-background,#eef1f4)}
|
|
180
|
+
.${N}__zoom-button:focus-visible{outline:var(--lattice-focus-width,2px) solid
|
|
181
181
|
var(--lattice-focus-color,#1a6bc7);outline-offset:1px}
|
|
182
|
-
.${
|
|
183
|
-
.${
|
|
182
|
+
.${N}__zoom-button[disabled]{opacity:0.4;cursor:default}
|
|
183
|
+
.${N}__zoom-icon{width:14px;height:14px;fill:none;stroke:currentColor;
|
|
184
184
|
stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}
|
|
185
|
-
.${
|
|
186
|
-
.${
|
|
187
|
-
.${
|
|
188
|
-
.${
|
|
185
|
+
.${N}__ribbon{stroke:none;fill-opacity:0.62}
|
|
186
|
+
.${N}__ribbon:hover{fill-opacity:0.85}
|
|
187
|
+
.${N}__node{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
188
|
+
.${N}__edge{stroke:var(--lattice-chart-grid);stroke-opacity:0.7}
|
|
189
189
|
/* A node's glyph, knocked out of its disc in the chart's own background colour
|
|
190
190
|
so it takes the theme rather than a colour written into the drawing. Drawn as
|
|
191
191
|
SVG paths from the grid's sprite registry, so it is sharp at any chart size
|
|
192
192
|
and any device pixel ratio. */
|
|
193
|
-
.${
|
|
194
|
-
.${
|
|
193
|
+
.${N}__node-icon{fill:var(--lattice-background,#fff);stroke:none;pointer-events:none}
|
|
194
|
+
.${N}__node-icon--stroke{fill:none;stroke:var(--lattice-background,#fff);
|
|
195
195
|
stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
|
|
196
|
-
.${
|
|
197
|
-
.${
|
|
196
|
+
.${N}__node-icon[data-dim]{opacity:0.18}
|
|
197
|
+
.${N}__flow-label{fill:var(--lattice-chart-axis);pointer-events:none}
|
|
198
198
|
/* The hierarchy chart types (BACKLOG-0001652): a link between a parent and a
|
|
199
199
|
child, a node, and a circle that holds other circles (a packed branch). A
|
|
200
200
|
collapsed node is ringed in the text colour so a closed branch reads as one
|
|
201
201
|
without colour; a branch circle is a faint wash so the circles inside it
|
|
202
202
|
carry the colour. */
|
|
203
|
-
.${
|
|
204
|
-
.${
|
|
205
|
-
.${
|
|
206
|
-
.${
|
|
203
|
+
.${N}__hlink{fill:none;stroke:var(--lattice-chart-axis);stroke-opacity:0.45}
|
|
204
|
+
.${N}__hnode{stroke:var(--lattice-background,#fff);stroke-width:1;cursor:pointer}
|
|
205
|
+
.${N}__hnode[data-collapsed]{stroke:currentColor;stroke-width:2}
|
|
206
|
+
.${N}__hbranch{fill-opacity:0.16;stroke:currentColor;stroke-opacity:0.35}
|
|
207
207
|
/* A name inside a packed circle: dark text with a pale halo, so it reads on every
|
|
208
208
|
colour of the scheme in both themes. */
|
|
209
|
-
.${
|
|
209
|
+
.${N}__hlabel{fill:#111;stroke:#fff;stroke-opacity:0.7;stroke-width:3px;paint-order:stroke;
|
|
210
210
|
pointer-events:none}
|
|
211
|
-
.${
|
|
211
|
+
.${N}__hnode:focus,.${N}__hnode:focus-visible{outline:2px solid var(--lattice-focus-color,#1a6bc7);outline-offset:1px}
|
|
212
212
|
/* A Voronoi treemap (BACKLOG-0001654): a branch's cell is an outline the keyboard
|
|
213
213
|
stops on but nothing paints, and the border drawn over it is the background
|
|
214
214
|
colour, thicker the higher the branch, so the gap between two branches reads
|
|
215
215
|
in both themes. */
|
|
216
|
-
.${
|
|
217
|
-
.${
|
|
218
|
-
.${
|
|
219
|
-
.${
|
|
220
|
-
.${
|
|
221
|
-
.${
|
|
222
|
-
.${
|
|
223
|
-
.${
|
|
224
|
-
.${
|
|
225
|
-
.${
|
|
226
|
-
.${
|
|
227
|
-
.${
|
|
228
|
-
.${
|
|
229
|
-
.${
|
|
230
|
-
.${
|
|
216
|
+
.${N}__vbranch{fill:none;stroke:none}
|
|
217
|
+
.${N}__vcrumb{fill:var(--lattice-chart-axis);cursor:pointer;text-decoration:underline}
|
|
218
|
+
.${N}__vcrumb-here{fill:var(--lattice-chart-axis);font-weight:600;pointer-events:none}
|
|
219
|
+
.${N}__vcrumb-sep{fill:var(--lattice-chart-axis);pointer-events:none}
|
|
220
|
+
.${N}__vborder{fill:none;stroke:var(--lattice-background,#fff);stroke-linejoin:round;pointer-events:none}
|
|
221
|
+
.${N}__stream{stroke:none}
|
|
222
|
+
.${N}__violin{stroke:none;fill-opacity:0.55}
|
|
223
|
+
.${N}__task{stroke:var(--lattice-background,#fff);stroke-width:1;rx:2}
|
|
224
|
+
.${N}__web{stroke:var(--lattice-chart-grid);fill:none}
|
|
225
|
+
.${N}__radar-fill{opacity:0.18;stroke:none}
|
|
226
|
+
.${N}__radar-line{stroke-width:2;fill:none}
|
|
227
|
+
.${N}__gauge-track{fill:var(--lattice-chart-grid)}
|
|
228
|
+
.${N}__gauge-target{stroke:var(--lattice-foreground,#1c2126);stroke-width:2}
|
|
229
|
+
.${N}__gauge-band{stroke:none}
|
|
230
|
+
.${N}__gauge-needle{stroke-linecap:round}
|
|
231
231
|
/* The bullet chart (BACKLOG-0001642): bands in the axis colour at graded
|
|
232
232
|
opacities, the target a foreground-coloured marker; both follow the theme. */
|
|
233
|
-
.${
|
|
234
|
-
.${
|
|
235
|
-
.${
|
|
233
|
+
.${N}__bullet-band{fill:var(--lattice-chart-axis);stroke:none}
|
|
234
|
+
.${N}__bullet-target{stroke:var(--lattice-foreground,#1c2126);stroke-width:2.5;stroke-linecap:butt}
|
|
235
|
+
.${N}__gauge-pin{stroke:none}
|
|
236
236
|
/* A polar chart's ring values sit on the wedges they label (BACKLOG-0001821):
|
|
237
237
|
a halo in the background colour keeps them legible off any wedge fill, in
|
|
238
238
|
either theme, since both colours are theme tokens. */
|
|
239
|
-
.${
|
|
239
|
+
.${N}__polar-tick{paint-order:stroke;stroke:var(--lattice-background,#fff);stroke-width:3px;
|
|
240
240
|
stroke-linejoin:round}
|
|
241
|
-
.${
|
|
242
|
-
.${
|
|
241
|
+
.${N}__gauge-tick{stroke:var(--lattice-foreground,#1c2126);stroke-width:1}
|
|
242
|
+
.${N}__gauge-reading{fill:var(--lattice-foreground,#1c2126);
|
|
243
243
|
font-size:calc(var(--lattice-font-size,13px) * 1.8);font-weight:600}
|
|
244
|
-
.${
|
|
244
|
+
.${N}__gauge-caption{fill:var(--lattice-chart-axis);
|
|
245
245
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
246
|
-
.${
|
|
247
|
-
.${
|
|
248
|
-
.${
|
|
246
|
+
.${N}__cell{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
247
|
+
.${N}__funnel{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
248
|
+
.${N}__funnel-label,.${N}__funnel-value{fill:var(--lattice-foreground,#1c2126);
|
|
249
249
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
250
250
|
/* The shape and timeline extension types (BACKLOG-0001657..0001660). Labels
|
|
251
251
|
read on any slice colour through a halo in the background colour; every
|
|
252
252
|
colour is a theme token, so light and dark are the same rules. */
|
|
253
|
-
.${
|
|
254
|
-
.${
|
|
253
|
+
.${N}__pyramid{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
254
|
+
.${N}__pyramid-label,.${N}__pictorial-label,.${N}__serp-label{fill:var(--lattice-foreground,#1c2126);
|
|
255
255
|
stroke:var(--lattice-background,#fff);stroke-width:3;paint-order:stroke;stroke-linejoin:round;
|
|
256
256
|
font-size:var(--lattice-font-size-sm,11px);pointer-events:none}
|
|
257
|
-
.${
|
|
257
|
+
.${N}__pyramid-leader,.${N}__pictorial-leader{fill:none;stroke:var(--lattice-chart-axis);
|
|
258
258
|
stroke-width:1;pointer-events:none}
|
|
259
|
-
.${
|
|
259
|
+
.${N}__serp-track{fill:none;stroke:var(--lattice-chart-grid,#dfe3e6);stroke-width:2;
|
|
260
260
|
stroke-linecap:round;pointer-events:none}
|
|
261
|
-
.${
|
|
262
|
-
.${
|
|
261
|
+
.${N}__serp-tick{fill:none;stroke:var(--lattice-chart-axis);stroke-width:1;pointer-events:none}
|
|
262
|
+
.${N}__serp-tick-label,.${N}__spiral-label,.${N}__spiral-period{fill:var(--lattice-chart-axis);
|
|
263
263
|
font-size:var(--lattice-font-size-sm,11px);pointer-events:none}
|
|
264
|
-
.${
|
|
265
|
-
.${
|
|
266
|
-
.${
|
|
267
|
-
.${
|
|
268
|
-
.${
|
|
269
|
-
.${
|
|
270
|
-
.${
|
|
271
|
-
.${
|
|
272
|
-
.${
|
|
273
|
-
.${
|
|
274
|
-
.${
|
|
264
|
+
.${N}__serp-marker{stroke:var(--lattice-background,#fff);stroke-width:1.5}
|
|
265
|
+
.${N}__serp-span{stroke-linecap:round}
|
|
266
|
+
.${N}__spiral-band{stroke:none;pointer-events:none}
|
|
267
|
+
.${N}__spiral-band--even{fill:var(--lattice-chart-grid,#dfe3e6);fill-opacity:0.55}
|
|
268
|
+
.${N}__spiral-band--odd{fill:var(--lattice-chart-grid,#dfe3e6);fill-opacity:0.2}
|
|
269
|
+
.${N}__spiral-spoke{fill:none;stroke:var(--lattice-chart-grid,#dfe3e6);stroke-width:1;pointer-events:none}
|
|
270
|
+
.${N}__spiral-dot{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
271
|
+
.${N}__wick{stroke-width:1}
|
|
272
|
+
.${N}__candle{stroke-width:1}
|
|
273
|
+
.${N}__axis-right{stroke-width:1}
|
|
274
|
+
.${N}__panel-title{fill:var(--lattice-chart-axis);
|
|
275
275
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
276
|
-
.${
|
|
276
|
+
.${N}__region{stroke:var(--lattice-chart-map-stroke,var(--lattice-chart-grid,#dfe3e6));
|
|
277
277
|
stroke-width:0.5;vector-effect:non-scaling-stroke}
|
|
278
|
-
.${
|
|
278
|
+
.${N}__graticule{fill:none;stroke:var(--lattice-chart-grid,#dfe3e6);stroke-width:0.5;
|
|
279
279
|
stroke-opacity:0.6;vector-effect:non-scaling-stroke;pointer-events:none}
|
|
280
|
-
.${
|
|
280
|
+
.${N}__sphere{fill:none;stroke:var(--lattice-chart-axis,#5b6670);stroke-width:1;
|
|
281
281
|
vector-effect:non-scaling-stroke;pointer-events:none}
|
|
282
|
-
.${
|
|
282
|
+
.${N}__geo-note{fill:var(--lattice-chart-axis);
|
|
283
283
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
284
|
-
.${
|
|
284
|
+
.${N}__attribution{color:var(--lattice-foreground-muted,#5b6670);
|
|
285
285
|
font-size:var(--lattice-font-size-sm,11px);padding:0 4px 4px}
|
|
286
|
-
.${
|
|
287
|
-
.${
|
|
286
|
+
.${N}__attribution[hidden]{display:none}
|
|
287
|
+
.${N}__slice-label{fill:var(--lattice-background,#fff);font-size:var(--lattice-font-size-sm,11px);
|
|
288
288
|
pointer-events:none;text-anchor:middle}
|
|
289
|
-
.${
|
|
289
|
+
.${N}__donut-centre-value{fill:var(--lattice-foreground,#1c2126);font-weight:600;
|
|
290
290
|
pointer-events:none;text-anchor:middle}
|
|
291
|
-
.${
|
|
291
|
+
.${N}__donut-centre-label{fill:var(--lattice-chart-axis);
|
|
292
292
|
pointer-events:none;text-anchor:middle}
|
|
293
|
-
.${
|
|
293
|
+
.${N}__legend{display:flex;flex-wrap:wrap;gap:2px 12px;padding:6px 4px 2px;
|
|
294
294
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
295
|
-
.${
|
|
295
|
+
.${N}__legend-item{display:inline-flex;align-items:center;gap:5px;border:0;padding:1px 3px;
|
|
296
296
|
background:none;color:inherit;font:inherit;cursor:pointer;border-radius:3px}
|
|
297
|
-
.${
|
|
297
|
+
.${N}__legend-item:focus-visible{outline:var(--lattice-focus-width,2px) solid var(--lattice-focus-color,#1a6bc7);
|
|
298
298
|
outline-offset:1px}
|
|
299
|
-
.${
|
|
300
|
-
.${
|
|
301
|
-
.${
|
|
299
|
+
.${N}__legend-item[aria-pressed="false"]{opacity:0.45}
|
|
300
|
+
.${N}__swatch{width:10px;height:10px;border-radius:2px;flex:0 0 auto}
|
|
301
|
+
.${N}__swatch--circle{border-radius:50%}
|
|
302
302
|
/* A line swatch for a series drawn as a line: the symbol should say which mark
|
|
303
303
|
the reader is looking for, not merely which colour. */
|
|
304
|
-
.${
|
|
305
|
-
.${
|
|
306
|
-
.${
|
|
304
|
+
.${N}__swatch--line{height:3px;border-radius:2px}
|
|
305
|
+
.${N}__legend[data-align="centre"],.${N}__legend[data-align="center"]{justify-content:center}
|
|
306
|
+
.${N}__legend[data-align="end"]{justify-content:flex-end}
|
|
307
307
|
/* Top and bottom are the default row; the sides become a column beside the
|
|
308
308
|
plot, which is why the figure itself changes direction rather than the
|
|
309
309
|
legend floating over the marks. */
|
|
310
|
-
.${
|
|
311
|
-
.${
|
|
312
|
-
.${
|
|
313
|
-
.${
|
|
314
|
-
.${
|
|
310
|
+
.${N}__figure:has(> .${N}__legend[data-position="top"]){flex-direction:column}
|
|
311
|
+
.${N}__legend[data-position="top"]{order:-1}
|
|
312
|
+
.${N}__figure:has(> .${N}__legend[data-position="left"]),
|
|
313
|
+
.${N}__figure:has(> .${N}__legend[data-position="right"]){flex-direction:row;align-items:stretch}
|
|
314
|
+
.${N}__legend[data-position="left"],.${N}__legend[data-position="right"]{
|
|
315
315
|
flex-direction:column;flex:0 0 auto;align-content:flex-start;
|
|
316
316
|
max-width:40%;overflow:auto;padding:4px 8px}
|
|
317
|
-
.${
|
|
318
|
-
.${
|
|
319
|
-
.${
|
|
320
|
-
.${
|
|
321
|
-
.${
|
|
322
|
-
.${
|
|
323
|
-
.${
|
|
324
|
-
.${
|
|
325
|
-
.${
|
|
326
|
-
.${
|
|
327
|
-
.${
|
|
328
|
-
.${
|
|
329
|
-
.${
|
|
330
|
-
.${
|
|
331
|
-
.${
|
|
332
|
-
.${
|
|
333
|
-
.${
|
|
334
|
-
.${
|
|
317
|
+
.${N}__legend[data-position="left"]{order:-1}
|
|
318
|
+
.${N}__legend-more{align-self:center;color:var(--lattice-foreground-muted,#5b6670)}
|
|
319
|
+
.${N}__legend-ramp{display:flex;align-items:center;gap:6px;flex:1 1 auto;min-width:60px}
|
|
320
|
+
.${N}__legend-ramp-bar{flex:1 1 auto;height:10px;min-width:32px;border-radius:2px}
|
|
321
|
+
.${N}__legend-ramp-label{white-space:nowrap;color:var(--lattice-foreground-muted,#5b6670)}
|
|
322
|
+
.${N}__legend-ramp-title{white-space:nowrap;font-weight:600}
|
|
323
|
+
.${N}__legend[data-position="left"] .${N}__legend-ramp,
|
|
324
|
+
.${N}__legend[data-position="right"] .${N}__legend-ramp{flex-direction:column;height:110px}
|
|
325
|
+
.${N}__legend[data-position="left"] .${N}__legend-ramp-bar,
|
|
326
|
+
.${N}__legend[data-position="right"] .${N}__legend-ramp-bar{width:10px;height:auto;min-width:0;min-height:32px}
|
|
327
|
+
.${N}__legend-ramp-bar{position:relative}
|
|
328
|
+
.${N}__legend-ramp[data-ticks]{padding-bottom:14px}
|
|
329
|
+
.${N}__legend-ramp-tick{position:absolute;top:100%;transform:translateX(-50%);padding-top:2px;line-height:1.1;white-space:nowrap;color:var(--lattice-foreground-muted,#5b6670)}
|
|
330
|
+
.${N}__legend[data-position="left"] .${N}__legend-ramp[data-ticks],
|
|
331
|
+
.${N}__legend[data-position="right"] .${N}__legend-ramp[data-ticks]{padding-bottom:0;padding-right:40px}
|
|
332
|
+
.${N}__legend[data-position="left"] .${N}__legend-ramp-tick,
|
|
333
|
+
.${N}__legend[data-position="right"] .${N}__legend-ramp-tick{top:auto;left:100%;transform:translateY(50%);padding:0 0 0 3px}
|
|
334
|
+
.${N}__tooltip{position:fixed;z-index:2147483000;pointer-events:none;max-width:260px;
|
|
335
335
|
padding:5px 8px;border-radius:4px;font-size:var(--lattice-font-size-sm,11px);
|
|
336
336
|
background:var(--lattice-surface,#f7f8f9);color:var(--lattice-foreground,#1c2126);
|
|
337
337
|
border:1px solid var(--lattice-border-color,#dfe3e6);
|
|
338
338
|
box-shadow:var(--lattice-popup-shadow,0 6px 16px -4px rgb(16 20 24/24%))}
|
|
339
|
-
.${
|
|
340
|
-
.${
|
|
339
|
+
.${N}__tooltip[hidden]{display:none}
|
|
340
|
+
.${N}__edit-handle{fill:var(--lattice-surface,#fff);stroke:var(--lattice-accent,#2563eb);stroke-width:2;
|
|
341
341
|
opacity:0;cursor:grab;pointer-events:all;touch-action:none}
|
|
342
|
-
.${
|
|
343
|
-
.${
|
|
344
|
-
.${
|
|
345
|
-
.${
|
|
346
|
-
.${
|
|
347
|
-
@media (hover:none){.${
|
|
348
|
-
@media (prefers-reduced-motion:reduce){.${
|
|
349
|
-
.${
|
|
342
|
+
.${N}__edit-handle:not([data-active]){transition:cx .15s ease-out,cy .15s ease-out}
|
|
343
|
+
.${N}__plot:hover .${N}__edit-handle,.${N}__edit-handle:focus,.${N}__edit-handle[data-active]{opacity:1}
|
|
344
|
+
.${N}__edit-handle[data-active]{cursor:grabbing}
|
|
345
|
+
.${N}__edit-handle[data-editable="false"]{cursor:not-allowed;stroke:var(--lattice-foreground-muted,#5b6670);stroke-dasharray:2 2}
|
|
346
|
+
.${N}__edit-handle:focus-visible{outline:2px solid var(--lattice-accent,#2563eb);outline-offset:2px}
|
|
347
|
+
@media (hover:none){.${N}__edit-handle{opacity:.85}}
|
|
348
|
+
@media (prefers-reduced-motion:reduce){.${N}__edit-handle:not([data-active]){transition:none}}
|
|
349
|
+
.${N}__edit-value{font-size:var(--lattice-font-size-sm,11px);font-weight:600;fill:var(--lattice-foreground,#1c2126);
|
|
350
350
|
paint-order:stroke;stroke:var(--lattice-surface,#fff);stroke-width:3px;pointer-events:none}
|
|
351
|
-
.${
|
|
351
|
+
.${N}__edit-status{position:absolute;inset-inline:0;bottom:0;z-index:4;padding:4px 8px;pointer-events:none;
|
|
352
352
|
font-size:var(--lattice-font-size-sm,11px);color:var(--lattice-danger,#b42318);
|
|
353
353
|
background:var(--lattice-surface,#fff);border-top:1px solid var(--lattice-border-color,#dfe3e6)}
|
|
354
|
-
.${
|
|
355
|
-
.${
|
|
356
|
-
.${
|
|
357
|
-
.${
|
|
354
|
+
.${N}__edit-status[hidden]{display:none}
|
|
355
|
+
.${N}__tooltip-row{display:flex;align-items:center;gap:5px;white-space:nowrap}
|
|
356
|
+
.${N}__tooltip-value{font-weight:600;margin-inline-start:auto;padding-inline-start:10px}
|
|
357
|
+
.${N}__empty{display:flex;align-items:center;justify-content:center;flex:1 1 auto;
|
|
358
358
|
color:var(--lattice-foreground-muted,#5b6670)}
|
|
359
359
|
/* The author display:flex above outranks the browser's own [hidden] rule, so
|
|
360
360
|
without this the placeholder stays painted under a drawn chart whenever the
|
|
361
361
|
pane has a fixed height (BACKLOG-0001023). Same guard as the tooltip. */
|
|
362
|
-
.${
|
|
363
|
-
.${
|
|
362
|
+
.${N}__empty[hidden]{display:none}
|
|
363
|
+
.${N}__watermark{position:absolute;right:4px;bottom:4px;z-index:6;
|
|
364
364
|
font-size:var(--lattice-font-size-sm,11px);pointer-events:auto;
|
|
365
365
|
background:var(--lattice-overlay-background,rgb(255 255 255/72%));
|
|
366
366
|
padding:1px 6px;border-radius:3px}
|
|
367
|
-
.${
|
|
368
|
-
.${
|
|
369
|
-
.${
|
|
367
|
+
.${N}__watermark-link{color:var(--lattice-foreground-muted,#5b6670);text-decoration:none}
|
|
368
|
+
.${N}__watermark-link:hover{text-decoration:underline}
|
|
369
|
+
.${N}__table{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;
|
|
370
370
|
clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}
|
|
371
371
|
|
|
372
372
|
/* The dark series palette, on the NEAREST data-theme (BACKLOG-0001462): the
|
|
@@ -376,22 +376,22 @@ var io=Object.create(null),ao=Object.create(null);function tt(r,oe){io[r]=oe}fun
|
|
|
376
376
|
theme auto. Everything else in this sheet already reads the grid's tokens,
|
|
377
377
|
which the same switch darkens. */
|
|
378
378
|
@scope ([data-theme="dark"]){
|
|
379
|
-
:scope.${
|
|
379
|
+
:scope.${N},.${N}{
|
|
380
380
|
--lattice-chart-1:#4ea6dd;--lattice-chart-2:#f0b429;--lattice-chart-3:#34c79a;
|
|
381
381
|
--lattice-chart-4:#e39ec4;--lattice-chart-5:#7cc7f0;--lattice-chart-6:#f07c3f;
|
|
382
382
|
--lattice-chart-7:#a48ad4;--lattice-chart-8:#93a3b1;
|
|
383
383
|
--lattice-chart-basemap-fill:#3a4a55;--lattice-chart-basemap-stroke:#8fb0c2;color-scheme:dark}
|
|
384
384
|
}
|
|
385
385
|
@scope ([data-theme="light"],[data-theme="auto"]){
|
|
386
|
-
:scope.${
|
|
387
|
-
--lattice-chart-1:${
|
|
388
|
-
--lattice-chart-3:${
|
|
389
|
-
--lattice-chart-5:${
|
|
390
|
-
--lattice-chart-7:${
|
|
386
|
+
:scope.${N},.${N}{
|
|
387
|
+
--lattice-chart-1:${ce[0]};--lattice-chart-2:${ce[1]};
|
|
388
|
+
--lattice-chart-3:${ce[2]};--lattice-chart-4:${ce[3]};
|
|
389
|
+
--lattice-chart-5:${ce[4]};--lattice-chart-6:${ce[5]};
|
|
390
|
+
--lattice-chart-7:${ce[6]};--lattice-chart-8:${ce[7]};color-scheme:light}
|
|
391
391
|
}
|
|
392
392
|
@media (prefers-color-scheme: dark){
|
|
393
393
|
@scope ([data-theme="auto"]){
|
|
394
|
-
:scope.${
|
|
394
|
+
:scope.${N},.${N}{
|
|
395
395
|
--lattice-chart-1:#4ea6dd;--lattice-chart-2:#f0b429;--lattice-chart-3:#34c79a;
|
|
396
396
|
--lattice-chart-4:#e39ec4;--lattice-chart-5:#7cc7f0;--lattice-chart-6:#f07c3f;
|
|
397
397
|
--lattice-chart-7:#a48ad4;--lattice-chart-8:#93a3b1;
|
|
@@ -404,17 +404,17 @@ var io=Object.create(null),ao=Object.create(null);function tt(r,oe){io[r]=oe}fun
|
|
|
404
404
|
meaning entirely. What survives is position, the stroke that separates one
|
|
405
405
|
mark from the next, and the label, which is why the legend carries text
|
|
406
406
|
and the tooltip names its series rather than relying on a swatch. */
|
|
407
|
-
.${
|
|
408
|
-
.${
|
|
409
|
-
.${
|
|
410
|
-
.${
|
|
411
|
-
.${
|
|
407
|
+
.${N}__bar,.${N}__slice,.${N}__point{fill:CanvasText;stroke:Canvas;stroke-width:1}
|
|
408
|
+
.${N}__line{stroke:CanvasText}
|
|
409
|
+
.${N}__area{fill:CanvasText;opacity:0.12}
|
|
410
|
+
.${N}__swatch{border:1px solid CanvasText}
|
|
411
|
+
.${N}__mark[data-dim]{opacity:1;fill:GrayText}
|
|
412
412
|
}
|
|
413
|
-
`}function ie(Z){const le=Z.documentElement;if(!le||le.getAttribute(ke))return;le.setAttribute(ke,"1");const D=Z.createElement("style");D.textContent=se(),(Z.head||Z.body||le).appendChild(D)}}),tt("packages/modules/charts/scale.js",function(r,oe){"use strict";Object.defineProperty(r,"isNumber",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(r,"toNumber",{enumerable:!0,get:function(){return le}}),Object.defineProperty(r,"toTime",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"extent",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"niceStep",{enumerable:!0,get:function(){return L}}),Object.defineProperty(r,"niceDomain",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"measureDomain",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"linearTicks",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"timeStepFor",{enumerable:!0,get:function(){return A}}),Object.defineProperty(r,"timeTicks",{enumerable:!0,get:function(){return f}}),Object.defineProperty(r,"linearScale",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"timeScale",{enumerable:!0,get:function(){return N}}),Object.defineProperty(r,"key",{enumerable:!0,get:function(){return q}}),Object.defineProperty(r,"bandScale",{enumerable:!0,get:function(){return k}}),Object.defineProperty(r,"sqrtScale",{enumerable:!0,get:function(){return _}});const Ae=[1,2,2.5,5,10],ae=6e4,$=36e5,ke=864e5,we=365.25*ke,se=[1,2,5,10,20,25,50,100],ie=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,ae,5*ae,15*ae,30*ae,$,3*$,6*$,12*$,ke,2*ke,7*ke,14*ke,30*ke,90*ke,180*ke,...se.map(c=>c*we)];function Z(c){return typeof c=="number"&&Number.isFinite(c)}function le(c){if(c==null||c==="")return null;if(c instanceof Date){const E=c.getTime();return Number.isFinite(E)?E:null}if(typeof c=="boolean")return c?1:0;const v=Number(c);return Number.isFinite(v)?v:null}function D(c){if(c==null||c==="")return null;if(c instanceof Date){const E=c.getTime();return Number.isFinite(E)?E:null}if(typeof c=="number")return Number.isFinite(c)?c:null;const v=Date.parse(String(c));return Number.isFinite(v)?v:null}function d(c){let v=1/0,E=-1/0;for(let m=0;m<c.length;m++){const y=c[m];Z(y)&&(y<v&&(v=y),y>E&&(E=y))}return v===1/0?null:{min:v,max:E}}function L(c){if(!(c>0))return 1;const v=10**Math.floor(Math.log10(c));for(const E of Ae)if(c<=E*v)return E*v;return 10*v}function T(c,v=5){const E=L((c.max-c.min)/Math.max(1,v));return{min:Math.floor(c.min/E)*E,max:Math.ceil(c.max/E)*E,step:E}}function W(c,v={}){const E=d(c)||{min:0,max:1};let{min:m,max:y}=E;if(v.zero&&(m>0&&(m=0),y<0&&(y=0)),m===y){const P=Math.abs(m)>0?Math.abs(m)/10:1;m-=P,y+=P}if(v.nice!==!1){const P=T({min:m,max:y},v.ticks||5);m=P.min,y=P.max}return Z(v.min)&&(m=v.min),Z(v.max)&&(y=v.max),m===y&&(y=m+1),{min:m,max:y}}function G(c,v=5){const E=L((c.max-c.min)/Math.max(1,v)),m=Math.ceil(c.min/E),y=Math.floor(c.max/E),P=[];for(let Q=m;Q<=y;Q++){const K=Q*E;P.push(Math.abs(K)<E/1e6?0:Number(K.toPrecision(12)))}return P}function A(c,v=5){const E=Math.max(1,v),m=c/E;let y=ie[ie.length-1];for(const K of ie)if(K>=m){y=K;break}if(y<we)return y;let P=y,Q=Math.abs(c/y-E);for(const K of ie){if(K<we)continue;const ge=Math.abs(c/K-E);ge<Q&&(Q=ge,P=K)}return P}function p(c,v){const E=new Date(c.min).getUTCFullYear();let m=Math.ceil(E/v)*v;Date.UTC(m,0,1)<c.min&&(m+=v);const y=[];for(;Date.UTC(m,0,1)<=c.max;m+=v)y.push(Date.UTC(m,0,1));return y}function f(c,v=5){const E=A(c.max-c.min,v);if(E>=we)return p(c,Math.round(E/we));const m=[],y=Math.ceil(c.min/E)*E;for(let P=y;P<=c.max;P+=E)m.push(P);return m}function w(c,v){const E=c.max-c.min||1,[m,y]=v;return{kind:"linear",domain:c,range:v,of(P){return m+(P-c.min)/E*(y-m)},invert(P){return c.min+(P-m)/(y-m||1)*E},ticks(P=5){return G(c,P)}}}function N(c,v){return{...w(c,v),kind:"time",ticks(m=5){return f(c,m)}}}function q(c){if(c==null)return" null";if(c instanceof Date)return` date:${c.getTime()}`;if(typeof c=="object"){const v=c,E=v.id??v.key??v.value;return E!==void 0&&typeof E!="object"?` obj:${String(E)}`:` obj:${String(c)}`}return String(c)}function k(c,v,E=.2){const m=Math.min(.9,Math.max(0,E)),[y,P]=v,Q=new Map;for(let re=0;re<c.length;re++){const C=q(c[re]);Q.has(C)||Q.set(C,re)}const K=c.length?(P-y)/c.length:P-y,ge=Math.max(0,K*(1-m));return{kind:"band",domain:c,range:v,bandwidth:ge,step:K,of(re){const C=Q.get(q(re));return C===void 0?NaN:y+C*K+(K-ge)/2},centre(re){const C=this.of(re);return Number.isNaN(C)?NaN:C+ge/2},ticks(){return c}}}function _(c,v){const[E,m]=v,y=Math.max(Math.abs(c.max),Math.abs(c.min),0)||1;return{kind:"sqrt",domain:c,range:v,of(P){const Q=Math.sqrt(Math.abs(P)/y);return E+Q*(m-E)}}}}),tt("packages/core/src/format/number.js",function(r,oe){"use strict";Object.defineProperty(r,"compileNumber",{enumerable:!0,get:function(){return $}});const ae=oe("packages/core/src/internal/util.js").isNil;function $(ke,we){const se=ke||{},ie=se.locale||we||void 0,Z=se.style||"decimal",le=typeof se.scale=="number"?se.scale:1,D=se.nullDisplay??"",d=se.zeroDisplay,L=se.prefix||"",T=se.suffix||"",W=se.negative||"minus",G=se.signed===!0,A={style:Z,notation:se.notation||"standard"};Z==="currency"&&(A.currency=se.currency||"USD",se.currencyDisplay&&(A.currencyDisplay=se.currencyDisplay)),typeof se.decimals=="number"?(A.minimumFractionDigits=se.decimals,A.maximumFractionDigits=se.decimals):(typeof se.minDecimals=="number"&&(A.minimumFractionDigits=se.minDecimals),typeof se.maxDecimals=="number"&&(A.maximumFractionDigits=se.maxDecimals),A.minimumFractionDigits>(A.maximumFractionDigits??20)&&(A.maximumFractionDigits=A.minimumFractionDigits)),se.thousandsSeparator===!1&&(A.useGrouping=!1),A.notation==="compact"&&(A.compactDisplay=se.compactDisplay||"short");const p=new Intl.NumberFormat(ie,A),f=typeof se.thousandsSeparator=="string"?se.thousandsSeparator:null,w=typeof se.decimalSeparator=="string"?se.decimalSeparator:null;let N=",",q=".";if(f||w)for(const m of p.formatToParts(12345.6))m.type==="group"?N=m.value:m.type==="decimal"&&(q=m.value);const k=m=>{let y=m;return f&&(y=y.split(N).join("")),w&&(y=y.split(q).join("")),f&&(y=y.split("").join(f)),w&&(y=y.split("").join(w)),y},_=!!(f||w),c=L!==""&&Z==="currency",v=m=>{let y;if(c){const P=p.formatToParts(m);let Q=!1;y="";for(const K of P)y+=K.value,!Q&&K.type==="currency"&&(y+=L,Q=!0);Q||(y=L+y)}else y=L+p.format(m);return _&&(y=k(y)),y+T},E=m=>{if(ae(m)||m==="")return D;const y=typeof m=="number"?m:Number(m);if(Number.isNaN(y))return D;const P=le===1?y:y*le;return P===0&&d!==void 0?d:P<0?W==="parentheses"?`(${v(-P)})`:W==="suffix"?`${v(-P)}-`:v(P):G&&P>0?`+${v(P)}`:v(P)};return E.negativeClass=se.negativeClass||null,E.spec=se,E}}),tt("packages/core/src/format/date.js",function(r,oe){"use strict";Object.defineProperty(r,"scanPattern",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"toDate",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"compilePattern",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"compileDate",{enumerable:!0,get:function(){return L}}),Object.defineProperty(r,"toIsoDate",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"toIsoDateTime",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"compareIso",{enumerable:!0,get:function(){return p}});const Ae=oe("packages/core/src/internal/util.js"),ae=Ae.isNil,$=Ae.warnOnce,ke=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function we(f){const w=[];let N=0,q="";const k=()=>{q&&(w.push({token:null,text:q}),q="")};for(;N<f.length;){const _=f[N];if(_==="'"){if(f[N+1]==="'"){q+="'",N+=2;continue}const v=f.indexOf("'",N+1);if(v===-1){q+=f.slice(N+1),N=f.length;continue}q+=f.slice(N+1,v),N=v+1;continue}const c=ke.find(v=>f.startsWith(v,N));if(c){k(),w.push({token:c,text:c}),N+=c.length;continue}/[A-Za-z]/.test(_)&&$(`date.pattern.token:${_}`,`the date pattern "${f}" contains '${_}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${ke.join(" ")}.`),q+=_,N+=1}return k(),w}const se=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function ie(f){if(ae(f)||f==="")return null;if(f instanceof Date)return Number.isNaN(f.getTime())?null:f;if(typeof f=="number")return Number.isNaN(f)?null:new Date(f);if(typeof f=="string"){const w=se.exec(f.trim());if(w){const[,q,k,_,c="0",v="0",E="0"]=w;return new Date(+q,+k-1,+_,+c,+v,+E)}const N=new Date(f);return Number.isNaN(N.getTime())?null:N}return null}function Z(f,w){return String(f).padStart(w,"0")}function le(f){if(!f)return q=>({year:q.getFullYear(),month:q.getMonth()+1,day:q.getDate(),hour:q.getHours(),minute:q.getMinutes(),second:q.getSeconds(),ms:q.getMilliseconds(),weekday:q.getDay()});const w=new Intl.DateTimeFormat("en-US",{timeZone:f,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,weekday:"short"}),N={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};return q=>{const k={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:q.getMilliseconds(),weekday:0};for(const _ of w.formatToParts(q))switch(_.type){case"year":k.year=Number(_.value);break;case"month":k.month=Number(_.value);break;case"day":k.day=Number(_.value);break;case"hour":k.hour=Number(_.value)%24;break;case"minute":k.minute=Number(_.value);break;case"second":k.second=Number(_.value);break;case"weekday":k.weekday=N[_.value]??0;break;default:break}return k}}function D(f,w,N){const q=we(f),k=le(N),_=new Set(q.filter(y=>y.token).map(y=>y.token)),c=_.has("MMM")?new Intl.DateTimeFormat(w,{month:"short",timeZone:N}):null,v=_.has("MMMM")?new Intl.DateTimeFormat(w,{month:"long",timeZone:N}):null,E=_.has("EEE")?new Intl.DateTimeFormat(w,{weekday:"short",timeZone:N}):null,m=_.has("EEEE")?new Intl.DateTimeFormat(w,{weekday:"long",timeZone:N}):null;return y=>{const P=k(y);let Q="";for(const K of q){if(!K.token){Q+=K.text;continue}switch(K.token){case"yyyy":Q+=Z(P.year,4);break;case"yy":Q+=Z(P.year%100,2);break;case"MMMM":Q+=v.format(y);break;case"MMM":Q+=c.format(y);break;case"MM":Q+=Z(P.month,2);break;case"M":Q+=String(P.month);break;case"dd":Q+=Z(P.day,2);break;case"d":Q+=String(P.day);break;case"EEEE":Q+=m.format(y);break;case"EEE":Q+=E.format(y);break;case"HH":Q+=Z(P.hour,2);break;case"H":Q+=String(P.hour);break;case"hh":Q+=Z(P.hour%12===0?12:P.hour%12,2);break;case"h":Q+=String(P.hour%12===0?12:P.hour%12);break;case"mm":Q+=Z(P.minute,2);break;case"m":Q+=String(P.minute);break;case"ss":Q+=Z(P.second,2);break;case"s":Q+=String(P.second);break;case"SSS":Q+=Z(P.ms,3);break;case"a":Q+=P.hour<12?"AM":"PM";break;default:Q+=K.text;break}}return Q}}const d=[["year",365*24*36e5],["month",720*36e5],["week",168*36e5],["day",24*36e5],["hour",36e5],["minute",6e4],["second",1e3]];function L(f,w){const N=f||{},q=N.locale||w||void 0,k=N.nullDisplay??"",_=N.timeZone;let c;if(N.pattern)c=D(N.pattern,q,_);else if(N.dateStyle||N.timeStyle){const P={timeZone:_};N.dateStyle&&(P.dateStyle=N.dateStyle),N.timeStyle&&(P.timeStyle=N.timeStyle);const Q=new Intl.DateTimeFormat(q,P);c=K=>Q.format(K)}else{const P=new Intl.DateTimeFormat(q,{dateStyle:"medium",timeZone:_});c=Q=>P.format(Q)}const v=N.relative?new Intl.RelativeTimeFormat(q,{numeric:"auto"}):null,m=(typeof N.relative=="object"&&N.relative?N.relative.threshold??7:7)*24*36e5,y=(P,Q)=>{const K=ie(P);if(!K)return k;if(v){const ge=Q&&typeof Q.now=="number"?Q.now:Date.now(),re=K.getTime()-ge;if(Math.abs(re)<m){for(const[C,ee]of d)if(Math.abs(re)>=ee||C==="second")return v.format(Math.round(re/ee),C)}}return c(K)};return y.spec=N,y}function T(f){if(ae(f)||f==="")return null;if(typeof f=="string"){const q=/^(\d{4}-\d{2}-\d{2})/.exec(f.trim());if(q)return q[1];const k=ie(f);return k?T(k):null}const w=ie(f);if(!w)return null;const N=q=>String(q).padStart(2,"0");return`${w.getFullYear()}-${N(w.getMonth()+1)}-${N(w.getDate())}`}function W(f,w){if(ae(f)||f==="")return null;if(typeof f=="string"){const q=f.trim();if(G.test(q)){const c=ie(q);return c?A(c,w):null}const k=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(q);if(k){const[,c,v,E,m]=k;return`${c}T${v}:${E}${m&&m!=="00"?`:${m}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(q))return`${q}T00:00`;const _=ie(q);return _?W(_):null}const N=ie(f);return N?A(N,w):null}const G=/(?:Z|[+-]\d{2}:?\d{2})$/i;function A(f,w){const N=c=>String(c).padStart(2,"0");if(w)try{const c=new Intl.DateTimeFormat("en-CA",{timeZone:w,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(f).reduce((m,y)=>(y.type!=="literal"&&(m[y.type]=y.value),m),{}),v=c.hour==="24"?"00":c.hour,E=Number(c.second);return`${c.year}-${c.month}-${c.day}T${v}:${c.minute}`+(E?`:${c.second}`:"")}catch{}const q=`${f.getFullYear()}-${N(f.getMonth()+1)}-${N(f.getDate())}`,k=f.getSeconds(),_=`${N(f.getHours())}:${N(f.getMinutes())}${k?`:${N(k)}`:""}`;return`${q}T${_}`}function p(f,w){const N=ae(f)||f===""?null:String(f),q=ae(w)||w===""?null:String(w);return N===null?q===null?0:1:q===null||N<q?-1:N>q?1:0}}),tt("packages/core/src/format/boolean.js",function(r,oe){"use strict";Object.defineProperty(r,"toTriState",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"compileBoolean",{enumerable:!0,get:function(){return se}});const ae=oe("packages/core/src/internal/util.js").isNil,$={true:"☑",false:"☐",null:""},ke={true:"◉",false:"◯",null:""};function we(ie){if(ae(ie)||ie==="")return null;if(typeof ie=="boolean")return ie;if(typeof ie=="number")return ie!==0;const Z=String(ie).trim().toLowerCase();return Z==="true"||Z==="yes"||Z==="y"||Z==="1"?!0:Z==="false"||Z==="no"||Z==="n"||Z==="0"?!1:null}function se(ie,Z){const le=ie||{},D=le.display||"text",d=le.trueLabel??"Yes",L=le.falseLabel??"No",T=le.nullLabel??"";let W=d,G=L;const A=T;D==="checkbox"?(W=$.true,G=$.false):D==="switch"?(W=ke.true,G=ke.false):D==="icon"&&(W=le.trueIcon??d,G=le.falseIcon??L);const p=f=>{const w=we(f);return w===null?A:w?W:G};return p.display=D,p.labels={true:d,false:L,null:T},p.locale=Z,p.spec=le,p}}),tt("packages/core/src/format/text.js",function(r,oe){"use strict";Object.defineProperty(r,"compileText",{enumerable:!0,get:function(){return ke}});const Ae=oe("packages/core/src/internal/util.js"),ae=Ae.isNil,$=Ae.titleCase;function ke(we,se){const ie=we||{},Z=ie.locale||se||void 0,le=ie.nullDisplay??"",D=ie.emptyDisplay??"",d=ie.transform||"none",L=typeof ie.truncate=="number"?{chars:ie.truncate}:ie.truncate||null,T=L?L.chars:0,W=L?L.ellipsis??"…":"",G=p=>{switch(d){case"upper":return Z?p.toLocaleUpperCase(Z):p.toUpperCase();case"lower":return Z?p.toLocaleLowerCase(Z):p.toLowerCase();case"title":return $(p);default:return p}},A=p=>{if(ae(p))return le;let f=typeof p=="string"?p:String(p);return f===""?D:(d!=="none"&&(f=G(f)),T>0&&f.length>T&&(f=f.slice(0,T)+W),f)};return A.spec=ie,A}}),tt("packages/core/src/format/mask.js",function(r,oe){"use strict";Object.defineProperty(r,"splitSections",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"parseSection",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(r,"compileMask",{enumerable:!0,get:function(){return se}});const Ae=new Set(["0","#","?",",","."]),ae="\0";function $(Z){const le=[];let D="",d=!1;for(let L=0;L<Z.length;L++){const T=Z[L];if(T==="\\"){D+=T+(Z[L+1]??""),L+=1;continue}if(T==='"'){d=!d,D+=T;continue}if(T===";"&&!d){le.push(D),D="";continue}D+=T}return le.push(D),le}function ke(Z){let le="",D="",d="",L=1,T=!1,W=!1;const G=c=>{W?D+=c:le+=c};for(let c=0;c<Z.length;c++){const v=Z[c];if(v==="\\"){G(Z[c+1]??""),c+=1;continue}if(v==='"'){const E=Z.indexOf('"',c+1);G(E===-1?Z.slice(c+1):Z.slice(c+1,E)),c=E===-1?Z.length:E;continue}if(v==="%"){L*=100,G("%");continue}if(v==="@"){T=!0,G("\0");continue}if(Ae.has(v)){d+=v,W=!0;continue}G(v)}let A=-1;for(let c=d.length-1;c>=0;c--){const v=d[c];if(v==="0"||v==="#"||v==="?"){A=c;break}}let p=!1,f="";for(let c=0;c<d.length;c++){const v=d[c];if(v===","){c>A?L/=1e3:p=!0;continue}f+=v}const w=f.indexOf("."),N=w===-1?f:f.slice(0,w),q=w===-1?"":f.slice(w+1);let k=0;for(const c of N)c==="0"&&(k+=1);let _=0;for(const c of q)c==="0"&&(_+=1);return{prefix:le,suffix:D,minInt:k,minDec:_,maxDec:q.length,grouping:p,scale:L,hasNumber:A!==-1,isText:T}}function we(Z,le){const D=new Intl.NumberFormat(le,{minimumIntegerDigits:Math.max(Z.minInt,1),minimumFractionDigits:Z.minDec,maximumFractionDigits:Math.max(Z.maxDec,Z.minDec),useGrouping:Z.grouping}),{prefix:d,suffix:L,scale:T,hasNumber:W}=Z;return G=>{if(!W)return d+L;const A=T===1?G:G*T;return d+D.format(A)+L}}function se(Z,le){const d=$(String(Z)).map(ke),L=d.map(f=>we(f,le)),T=0,W=d.length>1?1:-1,G=d.length>2?2:-1,A=d.length>3?3:-1,p=f=>{if(f==null||f==="")return"";if(typeof f!="number"||Number.isNaN(f)){const w=Number(f);if(Number.isNaN(w))return A===-1?String(f):(d[A].prefix+d[A].suffix).split("\0").join(String(f));f=w}return f===0&&G!==-1?L[G](0):f<0&&W!==-1?L[W](-f):L[T](f)};return p.spec={mask:Z},{format:p,ooxml:ie(String(Z))}}function ie(Z){return Z.trim()}}),tt("packages/core/src/format/shorthand.js",function(r,oe){"use strict";Object.defineProperty(r,"looksLikeMask",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(r,"looksLikeDatePattern",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"parseShorthand",{enumerable:!0,get:function(){return ie}});const Ae=["currency","number","percent","date","boolean","text","relative"],ae=/[#0?@;"\\]/,$=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function ke(Z){return typeof Z!="string"||Z===""||se(Z)?!1:ae.test(Z)}function we(Z){return typeof Z!="string"||Z===""||se(Z)?!1:$.test(Z)}function se(Z){const le=Z.indexOf(":"),D=le===-1?Z:Z.slice(0,le);return Ae.includes(D)?D:null}function ie(Z){const le=se(Z);if(!le)return null;const D=Z.indexOf(":"),d=D===-1?"":Z.slice(D+1),L=d===""?[]:d.split(":");switch(le){case"currency":{const T={type:"number",style:"currency",currency:L[0]||"USD"};return L[1]!==void 0&&L[1]!==""&&(T.decimals=Number(L[1])),T}case"number":{const T={type:"number",style:"decimal"};return L[0]!==void 0&&L[0]!==""&&(T.decimals=Number(L[0])),T}case"percent":{const T={type:"number",style:"percent"};return L[0]!==void 0&&L[0]!==""&&(T.decimals=Number(L[0])),T}case"date":return{type:"date",pattern:d||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const T=d.split("/"),W={type:"boolean",display:"text"};return T[0]!==void 0&&T[0]!==""&&(W.trueLabel=T[0]),T[1]!==void 0&&T[1]!==""&&(W.falseLabel=T[1]),T[2]!==void 0&&(W.nullLabel=T[2]),W}case"text":{const T={type:"text"};return L[0]&&(T.transform=L[0]),L[1]!==void 0&&L[1]!==""&&(T.truncate=Number(L[1])),T}default:return null}}}),tt("packages/core/src/format/index.js",function(r,oe){"use strict";Object.defineProperty(r,"compileFormat",{enumerable:!0,get:function(){return y}}),Object.defineProperty(r,"specToOoxml",{enumerable:!0,get:function(){return Q}});const Ae=oe("packages/core/src/internal/util.js"),ae=Ae.isFunction,$=Ae.isObject,ke=Ae.warnOnce,we=oe("packages/core/src/format/number.js"),se=we.compileNumber,ie=oe("packages/core/src/format/date.js"),Z=ie.compileDate,le=ie.scanPattern,D=oe("packages/core/src/format/boolean.js"),d=D.compileBoolean,L=oe("packages/core/src/format/text.js"),T=L.compileText,W=oe("packages/core/src/format/mask.js"),G=W.compileMask,A=oe("packages/core/src/format/shorthand.js"),p=A.parseShorthand,f=A.looksLikeMask,w=A.looksLikeDatePattern;Object.defineProperty(r,"compileNumber",{enumerable:!0,get:function(){return we.compileNumber}}),Object.defineProperty(r,"compileDate",{enumerable:!0,get:function(){return ie.compileDate}}),Object.defineProperty(r,"compilePattern",{enumerable:!0,get:function(){return ie.compilePattern}}),Object.defineProperty(r,"scanPattern",{enumerable:!0,get:function(){return ie.scanPattern}}),Object.defineProperty(r,"toDate",{enumerable:!0,get:function(){return ie.toDate}}),Object.defineProperty(r,"compileBoolean",{enumerable:!0,get:function(){return D.compileBoolean}}),Object.defineProperty(r,"toTriState",{enumerable:!0,get:function(){return D.toTriState}}),Object.defineProperty(r,"compileText",{enumerable:!0,get:function(){return L.compileText}}),Object.defineProperty(r,"compileMask",{enumerable:!0,get:function(){return W.compileMask}}),Object.defineProperty(r,"splitSections",{enumerable:!0,get:function(){return W.splitSections}}),Object.defineProperty(r,"parseSection",{enumerable:!0,get:function(){return W.parseSection}}),Object.defineProperty(r,"parseShorthand",{enumerable:!0,get:function(){return A.parseShorthand}}),Object.defineProperty(r,"looksLikeMask",{enumerable:!0,get:function(){return A.looksLikeMask}}),Object.defineProperty(r,"looksLikeDatePattern",{enumerable:!0,get:function(){return A.looksLikeDatePattern}});const N=new Set(["decimal","currency","percent","unit"]),q=new Set(["type","locale"]),k={number:new Set(["style","currency","currencyDisplay","decimals","minDecimals","maxDecimals","thousandsSeparator","decimalSeparator","notation","compactDisplay","negative","negativeClass","signed","prefix","suffix","zeroDisplay","nullDisplay","messages","scale"]),date:new Set(["pattern","dateStyle","timeStyle","timeZone","relative","nullDisplay"]),boolean:new Set(["display","trueLabel","falseLabel","nullLabel","trueIcon","falseIcon"]),text:new Set(["transform","truncate","nullDisplay","emptyDisplay"])},_=new Set(["number","date","boolean","text"]);function c(C,ee){const z=C.type;if(z===void 0||_.has(z)||!N.has(String(z)))return;const n=ee?`"${ee}"`:"with no id";ke(`format:unknown-style-key:${ee||""}:${z}`,`column ${n} has format: { type: "${z}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${z}" instead?`)}function v(C,ee,z){const n=k[ee],e=z?`"${z}"`:"with no id";for(const i of C){if(q.has(i)||n.has(i))continue;const g=Object.keys(k).find(b=>b!==ee&&k[b].has(i));g?ke(`format:inapplicable:${z||""}:${i}`,`column ${e} has format key "${i}", which applies to a ${g} column, not the ${ee} column it was applied to; it is ignored.`):ke(`format:unknown:${z||""}:${i}`,`column ${e} has an unrecognised format key "${i}" for its ${ee} format; it is ignored.`)}}function E(C){if(C.type==="number"||C.type==="date"||C.type==="boolean"||C.type==="text")return!0;const ee=N.has(String(C.style));return!!(C.pattern||C.dateStyle||C.timeStyle||C.relative||C.timeZone||C.trueLabel||C.falseLabel||C.display||C.trueIcon||C.falseIcon||C.transform||C.truncate||C.emptyDisplay||ee||C.currency||C.decimals!==void 0||C.minDecimals!==void 0||C.maxDecimals!==void 0||C.notation||C.negative||C.scale!==void 0||C.prefix||C.suffix||C.zeroDisplay!==void 0)}function m(C,ee){if(C.type==="number"||C.type==="date"||C.type==="boolean"||C.type==="text")return C.type;if(C.pattern||C.dateStyle||C.timeStyle||C.relative||C.timeZone)return"date";if(C.trueLabel||C.falseLabel||C.display||C.trueIcon||C.falseIcon)return"boolean";if(C.transform||C.truncate||C.emptyDisplay)return"text";if(C.style||C.currency||C.decimals!==void 0||C.minDecimals!==void 0||C.maxDecimals!==void 0||C.notation||C.negative||C.scale!==void 0||C.prefix||C.suffix||C.zeroDisplay!==void 0)return"number";const z=ee&&ee.base;return z==="number"?"number":z==="date"||z==="dateString"?"date":z==="boolean"?"boolean":"text"}function y(C,ee=null,z=void 0,n=void 0,e=void 0){if(C==null||C==="")return null;const i=$(C)?Object.keys(C):null;if(typeof C=="function"){const O=(ne,H)=>String(C({...H||{},value:ne,locale:z})??"");return O.ooxml=ee&&ee.excel||"General",O}if(typeof C=="string"){if(f(C)){const{format:ne,ooxml:H}=G(C,z);return ne.ooxml=H,ne}const O=p(C)||(w(C)?{type:"date",pattern:C}:null);return O?y(O,ee,z,n,e):(ke(`format:${C}`,`unrecognised format string "${C}"; the value will be stringified`),null)}if(!$(C))return ke("format:shape","format must be a spec object or a string; ignoring",C),null;if(ee&&ae(ee.format)&&!E(C)||ee&&ae(ee.format)&&Array.isArray(ee.formatPatterns)&&C.type===void 0)return null;const g=m(C,ee);g==="date"&&n&&C.timeZone===void 0&&(C={...C,timeZone:n}),c(C,e),v(i||Object.keys(C),g,e);let b;switch(g){case"number":b=se(C,z);break;case"date":b=Z(C,z);break;case"boolean":b=d(C,z);break;default:b=T(C,z);break}return b.ooxml=Q(C,g,z,ee),b.kind=g,b}const P={yyyy:"yyyy",yy:"yy",MMMM:"mmmm",MMM:"mmm",MM:"mm",M:"m",dd:"dd",d:"d",EEEE:"dddd",EEE:"ddd",HH:"hh",H:"h",hh:"hh",h:"h",mm:"mm",m:"m",ss:"ss",s:"s",SSS:"000",a:"AM/PM"};function Q(C,ee,z=void 0,n=null){if(ee==="date"){if(C.pattern){let O="";for(const ne of le(C.pattern))O+=ne.token?P[ne.token]??ne.text:ne.text;return O}return n&&n.excel||"yyyy-mm-dd"}if(ee==="boolean")return"General";if(ee==="text")return"@";if(C.notation==="compact"||C.notation==="scientific")return"General";const e=typeof C.decimals=="number"?C.decimals:typeof C.minDecimals=="number"?C.minDecimals:C.style==="currency"?2:0;let g=`${C.thousandsSeparator===!1?"":"#,#"}#0${e>0?`.${"0".repeat(e)}`:""}`,b="";return C.style==="currency"&&(b+=K(re(C.currency||"USD",z))),C.prefix&&(b+=K(C.prefix)),g=b+g,C.style==="percent"&&(g=`${g}%`),C.suffix&&(g+=K(C.suffix)),C.negative==="parentheses"?`${g};(${g})`:C.negative==="suffix"?`${g};${g}-`:g}function K(C){return`"${String(C).split('"').join("")}"`}const ge=new Map;function re(C,ee){const z=`${C}|${ee||""}`;let n=ge.get(z);if(n!==void 0)return n;n=C;try{const i=new Intl.NumberFormat(ee,{style:"currency",currency:C}).formatToParts(0).find(g=>g.type==="currency");i&&(n=i.value)}catch{}return ge.set(z,n),n}}),tt("packages/modules/charts/format.js",function(r,oe){"use strict";Object.defineProperty(r,"precisionFor",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"axisNumber",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(r,"r2Digits",{enumerable:!0,get:function(){return le}}),Object.defineProperty(r,"dateFormatFor",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"formatters",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"measureText",{enumerable:!0,get:function(){return L}}),Object.defineProperty(r,"measureFormat",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"stringFormatter",{enumerable:!0,get:function(){return G}});const ae=oe("packages/modules/charts/scale.js").timeStepFor,ke=oe("packages/core/src/format/index.js").compileFormat,se=oe("packages/core/src/internal/util.js").warnOnce;function ie(A){if(!Number.isFinite(A)||A<=0)return 0;const p=Math.ceil(-Math.log10(A));return Math.min(6,Math.max(0,p))}function Z(A,p,f=0){return Number.isFinite(A)?Math.abs(A)>=1e4?p.number(A,{notation:"compact",maximumFractionDigits:1}):p.number(A,{minimumFractionDigits:f,maximumFractionDigits:f}):""}function le(A,p){const f=A&&A.messages;return!f||typeof f.number!="function"?Number(p).toFixed(2):f.number(p,{minimumFractionDigits:2,maximumFractionDigits:2})}function D(A){const f=A>0?ae(A):0;return f>0&&f<1e3?{minute:"2-digit",second:"2-digit",fractionalSecondDigits:3}:f>0&&f<6e4?{hour:"2-digit",minute:"2-digit",second:"2-digit"}:A<=864e5?{hour:"2-digit",minute:"2-digit"}:A<=180*864e5?f>0&&f<864e5?{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}:{day:"numeric",month:"short"}:A<=3*365*864e5?{month:"short",year:"numeric"}:{year:"numeric"}}function d(A,p,f){const w=A.messages,N=w.locale,k=f&&f.format&&f.format.timeZone||A.get("timeZone")||void 0;if(p.kind==="time"){const c=D(p.span||0),v=new Intl.DateTimeFormat(N,k?{...c,timeZone:k}:c),E=new Intl.DateTimeFormat(N,k?{dateStyle:"medium",timeStyle:"short",timeZone:k}:{dateStyle:"medium",timeStyle:"short"});return{tick:m=>Number.isFinite(Number(m))?v.format(new Date(Number(m))):"",value:m=>Number.isFinite(Number(m))?E.format(new Date(Number(m))):""}}const _=ie(p.step||0);return{tick:c=>typeof c=="number"?Z(c,w,_):String(c??""),value:c=>typeof c=="number"?w.number(c):String(c??"")}}function L(A,p){if(A==null||!Number.isFinite(A))return"";const f=Math.abs(A)>=1e-6?Number(A.toPrecision(6)):A;return p.number(f)}function T(A,p,f){return A==null||!Number.isFinite(Number(A))?"":p&&p.format&&typeof p.formatValue=="function"?String(p.formatValue(A,null)):L(Number(A),f&&f.messages)}const W=new Map;function G(A,p,f){const w=p&&p.messages&&p.messages.locale,N=`${w}\0${A}`;if(!W.has(N)){let k=null;try{k=ke(A,null,w)}catch{k=null}W.set(N,k)}const q=W.get(N);return q?k=>String(q(k)):(se(`chart.format.string:${f}:${A}`,`${f}: the format string "${A}" is not understood; values are drawn unformatted`),null)}}),tt("packages/modules/charts/axis.js",function(r,oe){"use strict";Object.defineProperty(r,"pinXDomain",{enumerable:!0,get:function(){return q}}),Object.defineProperty(r,"TICK_FLOOR",{enumerable:!0,get:function(){return _}}),Object.defineProperty(r,"tickFloor",{enumerable:!0,get:function(){return c}}),Object.defineProperty(r,"fitBandLabels",{enumerable:!0,get:function(){return v}}),Object.defineProperty(r,"normaliseAxes",{enumerable:!0,get:function(){return y}}),Object.defineProperty(r,"tickValues",{enumerable:!0,get:function(){return P}}),Object.defineProperty(r,"tickLabeller",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(r,"drawAxisTitle",{enumerable:!0,get:function(){return K}}),Object.defineProperty(r,"labelEvery",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(r,"drawMeasureAxis",{enumerable:!0,get:function(){return re}}),Object.defineProperty(r,"heldInside",{enumerable:!0,get:function(){return C}}),Object.defineProperty(r,"drawCategoryAxis",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(r,"leftLabelRoom",{enumerable:!0,get:function(){return z}}),Object.defineProperty(r,"setLabelText",{enumerable:!0,get:function(){return n}}),Object.defineProperty(r,"drawBandLabels",{enumerable:!0,get:function(){return e}}),Object.defineProperty(r,"drawContinuousAxis",{enumerable:!0,get:function(){return i}}),Object.defineProperty(r,"drawAxisLines",{enumerable:!0,get:function(){return g}}),Object.defineProperty(r,"createGroups",{enumerable:!0,get:function(){return O}}),Object.defineProperty(r,"MARK_OVERHANG",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(r,"overhangFor",{enumerable:!0,get:function(){return H}}),Object.defineProperty(r,"setPlotClip",{enumerable:!0,get:function(){return F}});const ae=oe("packages/modules/charts/frame.js").Pool,$=oe("packages/modules/charts/svg.js"),ke=$.attrs,we=$.round,se=$.setText,ie=$.svg,Z=oe("packages/modules/charts/typography.js"),le=Z.applySize,D=Z.CHAR_RATIO,d=Z.truncateTo,T=oe("packages/modules/charts/styles.js").NS,W=oe("packages/modules/charts/scale.js"),G=W.toNumber,A=W.toTime,f=oe("packages/modules/charts/format.js").stringFormatter,N=oe("packages/core/src/internal/util.js").warnOnce;function q(s,M,B){const I=M&&M.kind==="time"?A:G,V=l=>l==null||l===""?null:I(l),fe=V(B&&B.min),a=V(B&&B.max);if(fe===null&&a===null)return s;if(fe!==null&&a!==null)return fe<a?{min:fe,max:a}:(N("chart.axis.x.domain.inverted",`axis.x.min (${fe}) is not below axis.x.max (${a}), which is a mirrored axis rather than a narrow one, so both were ignored and the x domain was taken from the data. On a time axis both are epoch milliseconds.`),s);const x=fe!==null?fe:s.min,R=a!==null?a:s.max;if(x<R)return{min:x,max:R};const o=Math.abs(s.max-s.min)||1;return N("chart.axis.x.domain.beyond",`axis.x.${fe!==null?"min":"max"} is outside the x values entirely, so the plot is empty. The pin was kept and the other edge moved to hold the axis width; check the units (a time axis is pinned in epoch milliseconds).`),fe!==null?{min:x,max:x+o}:{min:R-o,max:R}}const k=6,_=9;function c(s){const M=s&&s.ownerDocument,B=M&&M.defaultView;if(!B||typeof B.getComputedStyle!="function")return _;const I=B.getComputedStyle(s).getPropertyValue("--lattice-chart-tick-min"),V=parseFloat(I);return Number.isFinite(V)&&V>0?V:_}function v(s){const{size:M,floor:B,slot:I,per:V}=s,fe=Number.isFinite(s.every)&&s.every>0?Number(s.every):null;if(fe!==null&&fe!==1)return{size:M,every:fe,thinned:!1};if(!(I>0)||!(V>0))return{size:M,every:1,thinned:!1};const a=Math.min(M,I/V);return a>=B?{size:a,every:1,thinned:!1}:{size:B,every:Math.max(1,Math.ceil(B*V/I)),thinned:!0}}function E(s,M){const B=Math.ceil(s/M),I=s-B;N("chart.axis.band.thinned",`${I} of ${s} band labels were hidden: even the smallest font (--lattice-chart-tick-min) could not make them all fit. Set axis.x.every or axis.y.every to choose which ones show.`)}const m=1.2;function y(s){if(s===!1){const I={labels:!1,grid:!1};return{x:{...I},y:{...I},y2:{...I}}}const M=s&&typeof s=="object"?s:{},B=I=>typeof I=="string"?{title:I}:I&&typeof I=="object"?{...I}:{};return{x:B(M.x),y:B(M.y),y2:B(M.y2||M.right)}}function P(s,M){const B=M&&M.ticks;if(Array.isArray(B)){const V=s.domain;return!V||V.min===void 0?B:B.filter(fe=>Number(fe)>=V.min&&Number(fe)<=V.max)}const I=Number.isFinite(B)&&B>0?Number(B):5;return s.ticks(I)}function Q(s,M,B,I){const V=s&&s.format;if(typeof V=="function")return fe=>String(V(fe));if(typeof V=="string"){const fe=f(V,B,"axis.<x|y|y2>.format");if(fe)return fe}return I&&I.format&&I.format.pattern&&typeof I.formatValue=="function"?fe=>String(I.formatValue(fe,null)):M.tick}function K(s){if(!s.text)return;const M=s.side==="left"||s.side==="right"?s.plot.height:s.plot.width,B=Number.isFinite(M)?d(String(s.text),Math.max(0,M),s.size):String(s.text);if(!B||B==="…")return;const I=ie(s.group.ownerDocument,"text",{class:`${T}__axis-title`});if(le(I,s.size),s.side==="left"){const V=Math.max(s.size*1.15,s.plot.left-s.plot.gutter.left+s.size*1.15),fe=s.plot.top+s.plot.height/2;ke(I,{transform:`translate(${we(V)} ${we(fe)}) rotate(-90)`,"text-anchor":"middle"})}else if(s.side==="right"){const V=s.plot.right+s.plot.gutter.right-s.size*1.15,fe=s.plot.top+s.plot.height/2;ke(I,{transform:`translate(${we(V)} ${we(fe)}) rotate(90)`,"text-anchor":"middle"})}else ke(I,{x:we(s.plot.left+s.plot.width/2),y:we(s.plot.bottom+s.plot.gutter.bottom-2),"text-anchor":"middle"});se(I,B),B!==String(s.text)&&I.setAttribute("aria-label",String(s.text)),s.group.appendChild(I)}function ge(s){const{values:M,scale:B,size:I,horizontal:V,label:fe}=s;if(M.length<2)return 1;let a=1/0;for(let R=1;R<M.length;R++){const o=Math.abs(B.of(M[R])-B.of(M[R-1]));Number.isFinite(o)&&o<a&&(a=o)}if(!Number.isFinite(a))return 1;if(a<=0)return M.length;let x=I*m+2;if(V){let R=0;for(const o of M){const l=String(fe(o)||"").length*I*D;l>R&&(R=l)}x=R+k}return Math.max(1,Math.ceil(x/a))}function re(s){const{gridGroup:M,axisGroup:B,plot:I,scale:V,format:fe}=s,a=s.config||{},x=P(V,a),R=Q(a,fe,s.grid),o=s.size||11,l=ge({values:x,scale:V,size:o,horizontal:!!s.horizontal,label:R}),t=a.grid===!1?null:M,h=t?new ae(t):null,j=new ae(B);for(let U=0;U<x.length;U++){const J=x[U],X=we(V.of(J)),de=J===0,pe=U%l!==0;if(s.horizontal){if(h&&ke(h.next("line",`${T}__gridline`),{x1:X,x2:X,y1:we(I.top),y2:we(I.bottom),"stroke-opacity":de?1:.6,"stroke-width":de?1.5:1}),a.labels===!1||pe)continue;const xe=R(J),ve=String(xe).length*o*D/2,Oe=I.gutter;if(Oe&&(X-ve<I.left-(Oe.left||0)||X+ve>I.right+(Oe.right||0)))continue;const Pe=j.next("text",`${T}__tick`);le(Pe,o),ke(Pe,{x:X,y:we(I.bottom+k),"text-anchor":"middle","dominant-baseline":"hanging"}),se(Pe,xe)}else{if(h&&ke(h.next("line",`${T}__gridline`),{x1:we(I.left),x2:we(I.right),y1:X,y2:X,"stroke-opacity":de?1:.6,"stroke-width":de?1.5:1}),a.labels===!1||pe)continue;const xe=j.next("text",`${T}__tick`);le(xe,o);const ve=s.side==="right";ke(xe,{x:we(ve?I.right+k:I.left-k),y:C(X,I,o),"text-anchor":ve?"start":"end","dominant-baseline":"middle"}),se(xe,R(J))}}return h?h.finish():new ae(M).finish(),j.finish(),x}function C(s,M,B){const I=M&&M.gutter;if(!I)return s;const V=M.top-(Number.isFinite(I.top)?I.top:0)+B*.85+1,fe=M.bottom+(Number.isFinite(I.bottom)?I.bottom:0)-B*.6-1;return we(Math.min(Math.max(s,V),Math.max(V,fe)))}function ee(s){const{group:M,plot:B,scale:I,labels:V}=s,fe=s.config||{};if(fe.labels===!1){new ae(M).finish();return}const a=new ae(M),x=I.domain,R=I.step,o=fe.rotate===void 0||fe.rotate==="auto"?s.rotated:!!fe.rotate,l=o?v({size:s.fontSize,floor:c(M),slot:R,per:Math.SQRT2,every:fe.every}):{size:s.fontSize,every:Number.isFinite(fe.every)&&fe.every>0?Number(fe.every):1,thinned:!1},{size:t,every:h}=l;l.thinned&&E(x.length,h);const j=R*h;for(let U=0;U<x.length;U++){const J=we(I.centre(x[U]));if(Number.isNaN(J)||U%h!==0)continue;const X=a.next("text",`${T}__tick`);le(X,t);const de=V[U]===void 0?"":V[U];o?(ke(X,{x:0,y:0,"text-anchor":"end","dominant-baseline":"middle",transform:`translate(${J} ${we(B.bottom+k)}) rotate(-45)`}),n(X,de,Math.max(0,B.gutter.bottom-k)*Math.SQRT2,t)):(ke(X,{x:J,y:we(B.bottom+k),"text-anchor":"middle","dominant-baseline":"hanging",transform:null}),n(X,de,j,t))}a.finish()}function z(s){return Math.max(0,(s.gutter?s.gutter.left:s.left)-k)}function n(s,M,B,I){const V=String(M??""),fe=d(V,B,I);return se(s,fe),fe!==V?s.setAttribute("aria-label",V):s.removeAttribute("aria-label"),fe}function e(s){const{group:M,plot:B,scale:I,labels:V}=s,fe=s.config||{},a=new ae(M),x=I.domain,R=z(B),o=v({size:s.fontSize,floor:c(M),slot:I.step,per:m,every:fe.every}),{size:l,every:t}=o;o.thinned&&E(x.length,t);for(let h=0;h<x.length;h++){if(h%t!==0)continue;const j=we(I.centre(x[h]));if(Number.isNaN(j))continue;const U=a.next("text",`${T}__tick`);ke(U,{x:we(B.left-k),y:j,"text-anchor":"end","dominant-baseline":"middle"}),le(U,l),n(U,V[h],R,l)}a.finish()}function i(s){const{group:M,plot:B,scale:I,format:V}=s,fe=s.config||{};if(fe.labels===!1){new ae(M).finish();return}const a=Q(fe,V,s.grid,s.column),x=s.size||11,R=B&&B.gutter,o=R&&Number.isFinite(R.left)?B.left-R.left:-1/0,l=R&&Number.isFinite(R.right)?B.right+R.right:1/0,t=new ae(M);for(const h of P(I,fe)){const j=we(I.of(h));if(j<B.left-1||j>B.right+1)continue;const U=a(h),J=String(U).length*x*D/2;if(j-J<o||j+J>l)continue;const X=t.next("text",`${T}__tick`);le(X,x),ke(X,{x:j,y:we(B.bottom+k),"text-anchor":"middle","dominant-baseline":"hanging"}),se(X,U)}t.finish()}function g(s){const{group:M,plot:B}=s,I=s.side==="right"?B.right:B.left,V=new ae(M);ke(V.next("line"),{x1:we(I),x2:we(I),y1:we(B.top),y2:we(B.bottom)}),ke(V.next("line"),{x1:we(B.left),x2:we(B.right),y1:we(B.bottom),y2:we(B.bottom)}),V.finish()}let b=0;function O(s,M){const B=`${T}-plot-clip-${++b}`,I=ie(s,"rect"),V=ie(s,"clipPath",{id:B});V.appendChild(I);const fe=`${T}-box-clip-${b}`,a=ie(s,"clipPath",{id:fe});a.appendChild(ie(s,"rect",{x:0,y:0,width:"100%",height:"100%"}));const x=ie(s,"defs");x.appendChild(V),x.appendChild(a);const R={grid:ie(s,"g",{class:`${T}__grid`}),marks:ie(s,"g",{class:`${T}__marks`}),rules:ie(s,"g",{class:`${T}__axis`}),axis:ie(s,"g",{class:`${T}__axis`}),labels:ie(s,"g",{class:`${T}__labels`}),overlay:ie(s,"g",{class:`${T}__overlay`}),clip:I,clipId:B,boxClipId:fe};M.appendChild(x);for(const o of["grid","marks","rules","axis","labels","overlay"])M.appendChild(R[o]);return R}const ne=30;function H(s){return s==="bubble"?ne:s==="scatter"?6:3}function F(s,M,B){if(!s||!s.marks||!s.clip)return;if(!M||!Number.isFinite(M.width)||!Number.isFinite(M.height)){s.marks.removeAttribute("clip-path");return}const I=Number.isFinite(B)&&B>=0?Number(B):ne;ke(s.clip,{x:we(M.left-I),y:we(M.top-I),width:we(Math.max(0,M.width)+I*2),height:we(Math.max(0,M.height)+I*2)}),s.marks.setAttribute("clip-path",`url(#${s.clipId})`)}}),tt("packages/modules/charts/stack.js",function(r,oe){"use strict";Object.defineProperty(r,"measureValues",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"stacker",{enumerable:!0,get:function(){return ke}});const ae=oe("packages/modules/charts/scale.js").isNumber;function $(we,se,ie){if(ie)return[0,100];if(!se){const d=[];for(const L of we)for(const T of L.points)d.push(T.y);return d}const Z=[],le=[],D=we[0]?we[0].points.length:0;for(let d=0;d<D;d++){let L=0,T=0;for(const W of we){const G=W.points[d]?W.points[d].y:null;ae(G)&&(G>=0?L+=G:T+=G)}Z.push(L),le.push(T)}return[...Z,...le]}function ke(we,se){const ie=new Float64Array(we),Z=new Float64Array(we);return{take(le,D){const d=se?se[le]:0,L=se?d?D/d*100:0:D;if(L>=0){const W=ie[le];return ie[le]+=L,[W,ie[le]]}const T=Z[le];return Z[le]+=L,[T,Z[le]]}}}}),tt("packages/modules/charts/labels.js",function(r,oe){"use strict";Object.defineProperty(r,"resolveLabels",{enumerable:!0,get:function(){return A}}),Object.defineProperty(r,"collides",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"placeLabels",{enumerable:!0,get:function(){return f}}),Object.defineProperty(r,"labelText",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"drawAnchoredLabels",{enumerable:!0,get:function(){return N}}),Object.defineProperty(r,"drawDataLabels",{enumerable:!0,get:function(){return q}});const ae=oe("packages/modules/charts/frame.js").Pool,$=oe("packages/modules/charts/format.js"),ke=$.measureText,we=$.stringFormatter,se=oe("packages/modules/charts/svg.js"),ie=se.attrs,Z=se.round,le=se.setText,d=oe("packages/modules/charts/styles.js").NS,L=oe("packages/modules/charts/typography.js"),T=L.applySize,W=L.textWidth,G=4;function A(k){const _=k&&k.labels;if(!_)return{show:!1,names:_!==!1,position:"outside",format:null,minGap:2,total:!1};const c=typeof _=="object"?_:{};return{show:!0,names:!0,position:["outside","inside","auto"].includes(c.position)?c.position:"outside",format:c.format||null,minGap:Number.isFinite(c.minGap)?Number(c.minGap):2,total:!!c.total}}function p(k,_,c){for(const v of _)if(k.x-c<v.x+v.width&&k.x+k.width+c>v.x&&k.y-c<v.y+v.height&&k.y+k.height+c>v.y)return!0;return!1}function f(k){const{points:_,plot:c,size:v}=k,E=k.minGap===void 0?2:k.minGap,m=[],y=[];for(const P of _){if(P.px===void 0||P.py===void 0)continue;const Q=k.text(P);if(!Q)continue;const K=W(Q,v),ge=v;let re=P.px,C=P.py-G,ee="middle",z=!1;k.horizontal?(re=P.px+G,C=P.py,ee="start",k.position!=="outside"&&P.pbase!==void 0&&Math.abs(P.px-P.pbase)>K+G*2&&(re=P.px-G,ee="end",z=!0)):k.position!=="outside"&&P.pbase!==void 0&&Math.abs(P.pbase-P.py)>ge+G*2&&(C=P.py+ge+G,z=!0);const n=()=>({x:ee==="middle"?re-K/2:ee==="end"?re-K:re,y:C-ge,width:K,height:ge});let e=n();!(e.y>=c.top-1)&&!z&&!k.horizontal&&P.pbase!==void 0&&Math.abs(P.pbase-P.py)>ge+G*2&&(C=P.py+ge+G,z=!0,e=n()),!(e.x+e.width<=c.right+1)&&!z&&k.horizontal&&P.pbase!==void 0&&Math.abs(P.px-P.pbase)>K+G*2&&(re=P.px-G,ee="end",z=!0,e=n()),!(e.x<c.left-1||e.x+e.width>c.right+1)&&(e.y<c.top-1||e.y+e.height>c.bottom+ge||p(e,m,E)||(m.push(e),y.push({x:Z(re),y:Z(C),text:Q,anchor:ee,inside:z})))}return y}function w(k,_,c){if(k==null)return"";if(typeof _.format=="function")return String(_.format(k));if(typeof _.format=="string"){const v=we(_.format,c,"labels.format");if(v)return v(k)}return ke(k,c&&c.messages)}function N(k){const _=new ae(k.group),c=k.minGap===void 0?2:k.minGap,v=k.size,E=[];let m=0;for(const y of k.anchors){if(!y||!y.text)continue;const P=y.width===void 0?W(y.text,k.size):y.width,Q=y.anchor||"middle",ge={x:Q==="end"?y.x-P:Q==="start"?y.x:y.x-P/2,y:y.y-v/2,width:P,height:v};if(k.plot&&(ge.x<k.plot.left-1||ge.x+ge.width>k.plot.right+1||ge.y<k.plot.top-1||ge.y+ge.height>k.plot.bottom+1)||y.width!==void 0&&P>y.width||y.height!==void 0&&v>y.height||p(ge,E,c))continue;E.push(ge);const re=_.next("text",y.className||`${d}__data-label`);T(re,k.size),ie(re,{x:Z(y.x),y:Z(y.y),"text-anchor":Q,"dominant-baseline":y.baseline||"middle","data-inside":y.inside?"true":null}),le(re,y.text),m++}return _.finish(),m}function q(k){const _=new ae(k.group),{options:c}=k;let v=0;const E=m=>typeof c.format=="function"&&m.y!==null&&m.y!==void 0?String(c.format(m.y,m)):w(m.y,c,k.grid);for(const m of k.series){const y=f({points:m.points,plot:k.plot,size:k.size,position:c.position,horizontal:k.horizontal,minGap:c.minGap,text:E});for(const P of y){const Q=_.next("text",`${d}__data-label`);T(Q,k.size),ie(Q,{x:P.x,y:P.y,"text-anchor":P.anchor,"data-inside":P.inside?"true":null}),le(Q,P.text),v++}}return _.finish(),v}}),tt("packages/modules/charts/dense.js",function(r,oe){"use strict";Object.defineProperty(r,"CANVAS_THRESHOLD",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(r,"downsample",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(r,"markCount",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"wantsCanvas",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(r,"paintDense",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"sizeCanvas",{enumerable:!0,get:function(){return se}});const Ae=3e3;function ae(ie,Z){const le=ie.length;if(!Number.isFinite(Z)||Z>=le||Z<3||le<3)return ie;const D=[ie[0]],d=(le-2)/(Z-2);let L=0;for(let T=0;T<Z-2;T++){const W=Math.floor(T*d)+1,G=Math.min(Math.floor((T+1)*d)+1,le-1),A=G,p=Math.min(Math.floor((T+2)*d)+1,le);let f=0,w=0,N=0;for(let c=A;c<p;c++){const v=ie[c];!v||!Number.isFinite(v.y)||(f+=v.x,w+=v.y,N++)}N&&(f/=N,w/=N);const q=ie[L];if(W>=G)continue;let k=W,_=-1;for(let c=W;c<G;c++){const v=ie[c];if(!v||!Number.isFinite(v.y))continue;const E=Math.abs((q.x-f)*(v.y-q.y)-(q.x-v.x)*(w-q.y));E>_&&(_=E,k=c)}k<=L||(D.push(ie[k]),L=k)}return D.push(ie[le-1]),D}function $(ie){let Z=0;for(const le of ie)Z+=le.points.length;return Z}function ke(ie){if(ie.canvas===!0)return!0;if(ie.canvas===!1)return!1;const Z=Number.isFinite(ie.canvas)?Number(ie.canvas):Ae;return $(ie.series)>Z}function we(ie){const{context:Z,series:le,ratio:D}=ie;Z.save(),Z.scale(D,D);for(const d of le){const L=ie.colour(d.index);if(ie.type==="scatter"||ie.type==="bubble"){Z.fillStyle=L;for(const W of d.points)W.px!==void 0&&(Z.beginPath(),Z.arc(W.px,W.py,W.pr||2,0,Math.PI*2),Z.fill());continue}Z.strokeStyle=L,Z.lineWidth=2,Z.lineJoin="round",Z.beginPath();let T=!1;for(const W of d.points){if(W.px===void 0||W.py===void 0){T=!1;continue}T?Z.lineTo(W.px,W.py):Z.moveTo(W.px,W.py),T=!0}Z.stroke()}Z.restore()}function se(ie){const{canvas:Z}=ie;return Z.width=Math.max(1,Math.round(ie.width*ie.ratio)),Z.height=Math.max(1,Math.round(ie.height*ie.ratio)),Z.style&&(Z.style.width=`${ie.width}px`,Z.style.height=`${ie.height}px`),typeof Z.getContext=="function"?Z.getContext("2d"):null}}),tt("packages/modules/charts/annotations.js",function(r,oe){"use strict";Object.defineProperty(r,"overlayLayer",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"annotationValue",{enumerable:!0,get:function(){return v}}),Object.defineProperty(r,"annotationAxis",{enumerable:!0,get:function(){return E}}),Object.defineProperty(r,"annotationText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(r,"drawAnnotations",{enumerable:!0,get:function(){return P}});const ae=oe("packages/modules/charts/frame.js").Pool,$=oe("packages/modules/charts/scale.js"),ke=$.isNumber,we=$.toNumber,se=$.toTime,ie=oe("packages/modules/charts/svg.js"),Z=ie.attrs,le=ie.path,D=ie.round,d=ie.setText,L=ie.SVG_NS,W=oe("packages/modules/charts/styles.js").NS,A=oe("packages/core/src/internal/util.js").warnOnce;function p(Q,K){for(const re of Q.childNodes||[])if(re&&String(re.getAttribute&&re.getAttribute("class"))===K)return re;const ge=Q.ownerDocument.createElementNS(L,"g");return ge.setAttribute("class",K),Q.appendChild(ge),ge}const f=new Set(["line","target","band","callout","event"]);function w(Q,K){return Q.kind==="time"?se(K):we(K)}function N(Q,K,ge){if(Q.kind==="band"){const C=Q.of(K);if(!Number.isFinite(C))return NaN;const ee=Number(Q.bandwidth)||0;return ge==="right"?C+ee:C}const re=w(Q,K);return re===null?NaN:Q.of(re)}function q(Q,K,ge){const re=Q.kind||"line",C=Q.label?` (${JSON.stringify(Q.label)})`:"";A(`chart:annotation:dropped:${re}:${K}:${ge}`,`chart annotation${C} of kind ${JSON.stringify(re)}, reading the ${K} axis, was not drawn: ${ge}.`)}function k(Q,K){if(Q instanceof Date){const re=Q.getTime();return Number.isFinite(re)?Q.toISOString().slice(0,10):String(Q)}if(typeof Q=="number")return Number.isFinite(Q)?K(Q):String(Q);const ge=we(Q);return ge===null||typeof Q=="string"?String(Q):K(ge)}function _(Q,K,ge){const re=[];for(const C of Q)if((C.axis==="right"?"right":"left")===ge&&!(K.series!==void 0&&C.key!==K.series))for(const z of C.points)ke(z.y)&&re.push(Number(z.y));return re}function c(Q,K){if(!Q.length)return null;const ge=[...Q].sort((z,n)=>z-n);if(ge.length===1)return ge[0];const re=Math.min(100,Math.max(0,K))/100*(ge.length-1),C=Math.floor(re),ee=Math.ceil(re);return C===ee?ge[C]:ge[C]+(ge[ee]-ge[C])*(re-C)}function v(Q,K,ge){if(!Q.compute)return we(Q.value);const re=_(K,Q,ge);if(!re.length)return null;const C=String(Q.compute).toLowerCase();if(C==="mean"||C==="avg")return re.reduce((z,n)=>z+n,0)/re.length;if(C==="median"||C==="p50")return c(re,50);if(C==="min")return Math.min(...re);if(C==="max")return Math.max(...re);const ee=/^p(\d+(?:\.\d+)?)$/.exec(C);return ee?c(re,Number(ee[1])):null}function E(Q){return Q.axis==="right"||Q.axis==="y2"?"right":"left"}function m(Q,K,ge,re){const C=Q.label?`${Q.label}: `:"",ee=re?` (${E(Q)==="right"?"right axis":"left axis"})`:"",z=Q.kind||"line";if(z==="band"){if(!Array.isArray(K)||K[0]===null||K[1]===null)return"";const[e,i]=K;return`${C||"Band: "}${ge(Math.min(e,i))} to ${ge(Math.max(e,i))}${ee}`}return K==null?"":`${C||`${z==="target"?"Target":z==="callout"?"Callout":"Reference"}: `}${ge(K)}${ee}`}function y(Q){return(Q.kind||"line")==="band"?0:1}function P(Q){const{group:K,plot:ge,xScale:re,yScale:C,rightScale:ee,series:z,format:n}=Q,e=new ae(p(K,`${W}__annotations`)),i=[],b=[...Array.isArray(Q.annotations)?Q.annotations:[]].sort((O,ne)=>y(O)-y(ne));for(const O of b){const ne=O.kind||"line";if(!f.has(ne))continue;const H=E(O),F=H==="right"&&ee?ee:C;if(ne==="band"){if(O.orient==="vertical"){const x=N(re,O.from,"left"),R=N(re,O.to,"right");if(Number.isNaN(x)||Number.isNaN(R)){const h=Number.isNaN(x)&&Number.isNaN(R)?"from and to":Number.isNaN(x)?"from":"to";q(O,H,`its ${h} value could not be placed on the x scale`);continue}const o=D(Math.min(x,R)),l=D(Math.max(x,R));if(Z(e.next("rect",`${W}__annotation-band ${O.className||""}`.trim()),{x:o,y:D(ge.top),width:Math.max(0,l-o),height:D(Math.max(0,ge.bottom-ge.top)),fill:O.colour||"currentColor","fill-opacity":O.opacity===void 0?.12:O.opacity}),O.label){const h=e.next("text",`${W}__annotation-label`);Z(h,{x:o+4,y:D(ge.top+12),"text-anchor":"start"}),d(h,O.label)}const t=O.label?`${O.label}: `:"Event window: ";i.push({text:`${t}${k(O.from,n)} to ${k(O.to,n)}`});continue}const I=v({...O,value:O.from,compute:O.fromCompute},z,H),V=v({...O,value:O.to,compute:O.toCompute},z,H);if(I===null||V===null){q(O,H,`its ${I===null&&V===null?"from and to":I===null?"from":"to"} value could not be resolved (a number, or a compute that finds values)`);continue}const fe=D(F.of(I)),a=D(F.of(V));if(Z(e.next("rect",`${W}__annotation-band ${O.className||""}`.trim()),{x:D(ge.left),y:Math.min(fe,a),width:D(Math.max(0,ge.right-ge.left)),height:Math.max(0,Math.abs(a-fe)),fill:O.colour||"currentColor","fill-opacity":O.opacity===void 0?.12:O.opacity}),O.label){const x=e.next("text",`${W}__annotation-label`);Z(x,{x:D(ge.left+4),y:Math.min(fe,a)+12,"text-anchor":"start"}),d(x,O.label)}i.push({text:m(O,[I,V],n,Q.dual)});continue}if(ne==="event"){const I=O.x!==void 0?O.x:O.at,V=D(N(re,I,"left")+(re.kind==="band"?(Number(re.bandwidth)||0)/2:0));if(Number.isNaN(V)){q(O,H,"its x value could not be placed on the x scale");continue}if(Z(e.next("path",`${W}__annotation-event`),{d:le(["M",V,D(ge.top),"L",V,D(ge.bottom)]),stroke:O.colour||"currentColor",fill:"none"}),Z(e.next("circle",`${W}__annotation-event-flag`),{cx:V,cy:D(ge.top),r:3,fill:O.colour||"currentColor"}),O.label){const a=e.next("text",`${W}__annotation-label`);Z(a,{x:V+5,y:D(ge.top+10),"text-anchor":"start"}),d(a,O.label)}const fe=O.label?`${O.label} — `:"Event — ";i.push({text:`${fe}at ${k(I,n)}`});continue}if(ne==="callout"){const I=v(O,z,H);if(I===null){q(O,H,"its value could not be resolved (a number, or a compute that finds values)");continue}const V=O.at!==void 0?D(re.kind==="band"?re.centre(O.at):re.of(w(re,O.at)??NaN)):D(ge.right-4),fe=D(F.of(I));if(Number.isNaN(V)){q(O,H,"its x value could not be placed on the x scale");continue}if(Z(e.next("circle",`${W}__annotation-point`),{cx:V,cy:fe,r:3.5,fill:O.colour||"currentColor"}),O.label){const a=e.next("text",`${W}__annotation-label`);Z(a,{x:V+6,y:fe-6,"text-anchor":"start"}),d(a,O.label)}i.push({text:m(O,I,n,Q.dual)});continue}if(O.orient==="vertical"||O.x!==void 0){const I=O.x!==void 0?O.x:O.value,V=re.kind==="band"?D(re.centre(I)):D(re.of(w(re,I)??NaN));if(Number.isNaN(V)){q(O,H,"its x value could not be placed on the x scale");continue}const fe=ne==="target"?`${W}__annotation-target`:`${W}__annotation-line`;if(Z(e.next("path",fe),{d:le(["M",V,D(ge.top),"L",V,D(ge.bottom)]),stroke:O.colour||"currentColor",fill:"none"}),O.label){const a=e.next("text",`${W}__annotation-label`);Z(a,{x:V+4,y:D(ge.top+10),"text-anchor":"start"}),d(a,O.label)}i.push({text:O.label?`${O.label} — at ${k(I,n)}`:""});continue}const s=v(O,z,H);if(s===null){q(O,H,"its value could not be resolved (a number, or a compute that finds values)");continue}const M=D(F.of(s)),B=ne==="target"?`${W}__annotation-target`:`${W}__annotation-line`;if(Z(e.next("path",B),{d:Q.horizontal?le(["M",M,D(ge.top),"L",M,D(ge.bottom)]):le(["M",D(ge.left),M,"L",D(ge.right),M]),stroke:O.colour||"currentColor",fill:"none"}),O.label){const I=e.next("text",`${W}__annotation-label`);Z(I,Q.horizontal?{x:M+4,y:D(ge.top+10),"text-anchor":"start"}:{x:D(ge.right-4),y:M-4,"text-anchor":"end"}),d(I,O.label)}i.push({text:m(O,s,n,Q.dual)})}return e.finish(),i.filter(O=>O.text)}}),tt("packages/modules/charts/curve.js",function(r,oe){"use strict";Object.defineProperty(r,"CURVES",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"STEP_MODES",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(r,"resolveCurve",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"curveCommands",{enumerable:!0,get:function(){return se}});const ae=oe("packages/modules/charts/svg.js").round,$=Object.freeze(["linear","monotone","catmullRom","step"]),ke=Object.freeze(["after","before","middle"]);function we(d,L){let T=d;if(T&&typeof T=="object"&&!Array.isArray(T)&&typeof T.type!="string"&&(T=L!=null&&Object.prototype.hasOwnProperty.call(T,L)?T[L]:void 0),T==null||T===!0||T===!1)return null;if(typeof T=="string")return T==="linear"?null:$.includes(T)?{type:T,tension:1,mode:"after"}:null;if(typeof T=="object"){const W=typeof T.type=="string"&&$.includes(T.type)?T.type:"linear";if(W==="linear")return null;const G=Number.isFinite(T.tension)?Math.max(0,Math.min(1,Number(T.tension))):1,A=ke.includes(T.mode)?T.mode:"after";return{type:W,tension:G,mode:A}}return null}function se(d,L){return d.length?!L||L.type==="linear"?ie(d):L.type==="step"?Z(d,L.mode):L.type==="monotone"?le(d):L.type==="catmullRom"?D(d,L.tension):ie(d):[]}function ie(d){const L=["M",ae(d[0].x),ae(d[0].y)];for(let T=1;T<d.length;T++)L.push("L",ae(d[T].x),ae(d[T].y));return L}function Z(d,L){const T=["M",ae(d[0].x),ae(d[0].y)];for(let W=1;W<d.length;W++){const G=d[W-1].x,A=d[W-1].y,p=d[W].x,f=d[W].y;if(L==="before")T.push("L",ae(G),ae(f),"L",ae(p),ae(f));else if(L==="middle"){const w=ae((G+p)/2);T.push("L",w,ae(A),"L",w,ae(f),"L",ae(p),ae(f))}else T.push("L",ae(p),ae(A),"L",ae(p),ae(f))}return T}function le(d){const L=d.length;if(L<2)return["M",ae(d[0].x),ae(d[0].y)];if(L===2)return["M",ae(d[0].x),ae(d[0].y),"L",ae(d[1].x),ae(d[1].y)];const T=[];for(let A=0;A<L-1;A++){const p=d[A+1].x-d[A].x,f=d[A+1].y-d[A].y;T[A]=p===0?0:f/p}const W=new Array(L);W[0]=T[0],W[L-1]=T[L-2];for(let A=1;A<L-1;A++)W[A]=T[A-1]*T[A]<=0?0:(T[A-1]+T[A])/2;for(let A=0;A<L-1;A++)T[A]===0&&(W[A]=0,W[A+1]=0);for(let A=0;A<10;A++){let p=!1;for(let f=0;f<L-1;f++){if(T[f]===0)continue;const w=W[f]/T[f],N=W[f+1]/T[f],q=w*w+N*N;if(q>9){const k=3/Math.sqrt(q);W[f]=k*w*T[f],W[f+1]=k*N*T[f],p=!0}}if(!p)break}const G=["M",ae(d[0].x),ae(d[0].y)];for(let A=0;A<L-1;A++){const p=d[A].x,f=d[A].y,w=d[A+1].x,N=d[A+1].y,q=w-p,k=p+q/3,_=f+W[A]*q/3,c=w-q/3,v=N-W[A+1]*q/3;G.push("C",ae(k),ae(_),ae(c),ae(v),ae(w),ae(N))}return G}function D(d,L){const T=d.length;if(T<2)return["M",ae(d[0].x),ae(d[0].y)];const W=Number.isFinite(L)?Math.max(0,Math.min(1,L)):1,G=["M",ae(d[0].x),ae(d[0].y)];for(let A=0;A<T-1;A++){const p=d[A-1]||d[A],f=d[A],w=d[A+1],N=d[A+2]||d[A+1],q=f.x+(w.x-p.x)/6*W,k=f.y+(w.y-p.y)/6*W,_=w.x-(N.x-f.x)/6*W,c=w.y-(N.y-f.y)/6*W;G.push("C",ae(q),ae(k),ae(_),ae(c),ae(w.x),ae(w.y))}return G}}),tt("packages/modules/charts/combo.js",function(r,oe){"use strict";Object.defineProperty(r,"toPareto",{enumerable:!0,get:function(){return V}}),Object.defineProperty(r,"drawCombo",{enumerable:!0,get:function(){return x}}),Object.defineProperty(r,"drawRightAxis",{enumerable:!0,get:function(){return R}});const Ae=oe("packages/modules/charts/axis.js"),ae=Ae.drawAxisLines,$=Ae.drawAxisTitle,ke=Ae.drawCategoryAxis,we=Ae.drawContinuousAxis,se=Ae.drawMeasureAxis,ie=Ae.heldInside,Z=Ae.overhangFor,le=Ae.pinXDomain,D=Ae.setPlotClip,d=Ae.tickLabeller,L=Ae.tickValues,T=oe("packages/modules/charts/frame.js"),W=T.Pool,G=T.shouldRotate,p=oe("packages/modules/charts/format.js").formatters,f=oe("packages/modules/charts/scale.js"),w=f.bandScale,N=f.extent,q=f.isNumber,k=f.linearScale,_=f.measureDomain,c=f.timeScale,v=f.toNumber,E=f.toTime,m=oe("packages/modules/charts/stack.js"),y=m.measureValues,P=m.stacker,Q=oe("packages/modules/charts/svg.js"),K=Q.attrs,ge=Q.path,re=Q.round,ee=oe("packages/modules/charts/styles.js").NS,n=oe("packages/modules/charts/scheme.js").resolveScheme,i=oe("packages/modules/charts/labels.js").drawDataLabels,b=oe("packages/modules/charts/annotations.js").drawAnnotations,O=oe("packages/modules/charts/curve.js"),ne=O.curveCommands,H=O.resolveCurve;function F(o){return{left:o.filter(l=>l.axis!=="right"),right:o.filter(l=>l.axis==="right")}}function s(o,l){const t=o&&o.seriesStyle&&o.seriesStyle[l];if(t)return{width:t.width!=null?String(t.width):null,dash:Array.isArray(t.dash)&&t.dash.length?t.dash.join(" "):null,opacity:null,emphasized:!1};const h=o&&Array.isArray(o.emphasis)?o.emphasis:null;if(!h||!h.length)return{width:null,dash:null,opacity:null,emphasized:!1};const j=h.includes(l);return{width:j?"var(--lattice-chart-emphasis-width, 3.5)":null,dash:null,opacity:j?null:"var(--lattice-chart-muted-opacity, .35)",emphasized:j}}function M(o,l,t,h,j=null){const U=[];let J=[];const X=()=>{J.length===1?U.push("M",J[0].x,J[0].y):J.length>1&&U.push(...ne(J,j)),J=[]};for(const de of l.points){if(de.px===void 0){X();continue}J.push({x:de.px,y:de.py})}X(),K(o.next("path",`${ee}__line ${ee}__mark`),{d:U.length?ge(U):"",stroke:t,"data-series":l.index,"stroke-width":h.width,"stroke-dasharray":h.dash,opacity:h.opacity});for(const de of l.points)de.px!==void 0&&K(o.next("circle",`${ee}__point ${ee}__mark`),{cx:de.px,cy:de.py,r:3,fill:t})}function B(o,l){return l?{tick:t=>`${o.tick(t)}%`,value:t=>`${o.value(t)}%`}:o}function I(o,l,t,h,j){const U=o.filter(de=>(de.mark||"bar")==="bar"),J=o.filter(de=>(de.mark||"bar")!=="bar"),X=h?y(U,!0,!0):t?[...y(U,!0,!1),...J.length?y(J,!1,!1):[]]:y(o,!1,!1);return _(X,{zero:l,min:j&&j.min,max:j&&j.max})}function V(o){const l=o.series[0];if(!l)return o;const t=l.points.map((J,X)=>({point:J,label:o.labels[X],category:o.categories[X]})).filter(J=>q(J.point.y)).sort((J,X)=>X.point.y-J.point.y),h=t.reduce((J,X)=>J+X.point.y,0);let j=0;const U=t.map(J=>(j+=J.point.y,h>0?j/h*100:0));return{...o,categories:t.map(J=>J.category),labels:t.map(J=>J.label),series:[{...l,index:0,mark:"bar",axis:"left",points:t.map(J=>J.point)},{key:"cumulative",label:o.cumulativeLabel||"%",index:1,mark:"line",axis:"right",points:t.map((J,X)=>({x:J.category,xKey:J.point.xKey,label:J.label,y:U[X],rows:J.point.rows,rowKey:J.point.rowKey}))}]}}function fe(o,l,t){const h=[l.left,l.right];if(o.kind!=="time"&&o.kind!=="linear")return w(o.categories,h,.2);const j=o.kind==="time"?o.categories.map(E):o.categories.map(v);if(o.kind==="time"){const X=N(j);if(X&&X.min===X.max)return c(le({min:X.min-3e4,max:X.max+3e4},o,t),h)}const U=o.xDomain||_(j,{zero:!1,nice:o.kind!=="time"}),J=o.xDomain?U:le(U,o,t);return o.kind==="time"?c(J,h):k(J,h)}function a(o,l){const t=[...new Set(o.filter(X=>Number.isFinite(X)))].sort((X,de)=>X-de);if(t.length<2){const[X,de]=l.range;return Math.max(4,(de-X)/10)}const h=[];for(let X=1;X<t.length;X++)h.push(t[X]-t[X-1]);h.sort((X,de)=>X-de);const j=Math.floor(h.length/2),U=h.length%2?h[j]:(h[j-1]+h[j])/2,J=Math.abs(l.of(t[0]+U)-l.of(t[0]));return Math.max(1,J*.8)}function x(o){const l=o.scheme||n(),t=o.axis||{x:{},y:{},y2:{}},{plot:h}=o,j=o.pareto?V(o.bound):o.bound,U=j.series.filter(kt=>!o.hidden.has(kt.key)),J=F(U),X=kt=>(kt.mark||"bar")==="bar",de=J.left.some(X),pe=J.left.filter(X),xe=o.stack==="percent"&&pe.length>1&&!J.right.length,ve=(xe||!!o.stack)&&pe.length>1&&!J.right.length,Oe=j.yDomain||I(J.left,de,ve,xe,t.y),Pe=k(Oe,[h.bottom,h.top]),te=J.right.length?o.pareto?{min:0,max:100}:I(J.right,J.right.some(X),!1,!1,t.y2):null,Se=te?k(te,[h.bottom,h.top]):null,ye=fe(j,h,t.x),be=ye.kind!=="band",Ne=be?j.categories.map(kt=>j.kind==="time"?E(kt):v(kt)):null,je=t.y.position==="right"?"right":"left";se({gridGroup:o.groups.grid,axisGroup:o.groups.axis,plot:h,scale:Pe,format:B(p(o.grid,{kind:"linear",step:(Oe.max-Oe.min)/5}),xe),config:t.y,grid:o.grid,size:o.fontSize,side:je});const Ee=j.dimension&&j.dimension.col?o.grid.columns.get(j.dimension.col):void 0;be?we({group:o.groups.overlay,plot:h,scale:ye,format:p(o.grid,{kind:j.kind,span:ye.domain.max-ye.domain.min,step:(ye.domain.max-ye.domain.min)/5},Ee),config:t.x,grid:o.grid,size:o.fontSize}):ke({group:o.groups.overlay,plot:h,scale:ye,labels:j.labels,fontSize:o.fontSize,rotated:G(j.labels,ye.step,o.fontSize),config:t.x}),ae({group:o.groups.rules,plot:h,side:je});const Ce=o.typography&&o.typography.axisTitle||o.fontSize;if($({group:o.groups.axis,plot:h,text:t.y.title,side:je,size:Ce}),$({group:o.groups.axis,plot:h,text:t.x.title,side:"bottom",size:Ce}),Se){R({group:o.groups.axis,plot:h,scale:Se,colour:l.series(J.right[0].index,J.right[0].label),format:p(o.grid,{kind:"linear",step:(te.max-te.min)/5}),config:t.y2,grid:o.grid,suffix:o.pareto?"%":"",side:je==="right"?"left":"right"});const kt=t.y2.title||(J.right.length===1?J.right[0].label:"");$({group:o.groups.axis,plot:h,text:kt,side:je==="right"?"left":"right",size:Ce})}D(o.groups,h,Z(o.type));const Fe=new W(o.groups.marks),We=U.filter(kt=>(kt.mark||"bar")==="bar"),wt=be?a(Ne,ye):ye.bandwidth,lt=ve?wt:We.length?wt/We.length:wt,st=xe?j.categories.map((kt,Gt)=>pe.reduce((Vt,Ye)=>{const et=Ye.points[Gt]?Ye.points[Gt].y:null;return q(et)?Vt+Math.abs(et):Vt},0)):null,Qe=ve?P(j.categories.length,st):null;let rt=0;const pt=[];for(const kt of U){const Gt=kt.mark||"bar",Vt=kt.axis==="right"&&Se?Se:Pe,Ye=l.series(kt.index,kt.label);if(Gt==="bar"){const ut=ve?0:rt*lt;rt++;const Ue=Vt.of(Math.max(Vt.domain.min,0));for(let ft=0;ft<kt.points.length;ft++){const yt=kt.points[ft];if(!q(yt.y))continue;let Ct;if(be){const bt=j.kind==="time"?E(yt.x):v(yt.x);Ct=bt===null?NaN:ye.of(bt)-wt/2}else Ct=ye.of(yt.x);if(Number.isNaN(Ct))continue;const ot=Qe?Qe.take(ft,yt.y):null,dt=Vt.of(ot?ot[1]:yt.y),it=ot?Vt.of(ot[0]):Ue;K(Fe.next("rect",`${ee}__bar ${ee}__mark`),{x:re(Ct+ut),y:re(Math.min(dt,it)),width:re(Math.max(0,lt)),height:re(Math.max(1,Math.abs(it-dt))),fill:Ye,"data-series":kt.index,"data-point":ft}),yt.px=re(Ct+ut+lt/2),yt.py=re(Math.min(dt,it))}continue}for(const ut of kt.points){if(!q(ut.y)){ut.px=void 0;continue}let Ue;if(be){const yt=j.kind==="time"?E(ut.x):v(ut.x);Ue=yt===null?NaN:re(ye.of(yt))}else Ue=re(ye.centre(ut.x));if(Number.isNaN(Ue)){ut.px=void 0;continue}const ft=re(Vt.of(ut.y));ut.px=Ue,ut.py=ft}const et=s(o,kt.label),gt=H(o.curve,kt.label);et.emphasized?pt.push({series:kt,colour:Ye,style:et,curve:gt}):M(Fe,kt,Ye,et,gt)}for(const kt of pt)M(Fe,kt.series,kt.colour,kt.style,kt.curve);Fe.finish(),o.labels&&o.labels.show&&i({group:o.groups.labels,series:U,plot:h,options:o.labels,grid:o.grid,size:o.typography&&o.typography.small||o.fontSize});let Ht=null;return o.annotations&&o.annotations.length&&(Ht=b({group:o.groups.overlay,plot:h,xScale:ye,yScale:Pe,rightScale:Se,series:U,annotations:o.annotations,dual:!!Se,format:p(o.grid,{kind:"linear",step:(Oe.max-Oe.min)/5}).tick})),{xScale:ye,yScale:Pe,rightScale:Se,dual:!!Se,series:U,bound:j,annotations:Ht,percent:xe,percentTotals:st}}function R(o){const{group:l,plot:t,scale:h,format:j}=o,U=o.config||{},J=o.side==="left"?"left":"right",X=J==="right"?t.right:t.left,de=d(U,j,o.grid),pe=new W(l,l.childNodes.length);K(pe.next("line",`${ee}__axis-right`),{x1:re(X),x2:re(X),y1:re(t.top),y2:re(t.bottom),stroke:o.colour});for(const xe of L(h,U)){const ve=re(h.of(xe)),Oe=pe.next("text",`${ee}__tick`);K(Oe,{x:re(J==="right"?t.right+6:t.left-6),y:ie(ve,t,11),"text-anchor":J==="right"?"start":"end","dominant-baseline":"middle",fill:o.colour}),Oe.textContent=`${de(xe)}${o.suffix||""}`}pe.finish()}}),tt("packages/modules/charts/quantile.js",function(r,oe){"use strict";Object.defineProperty(r,"normalQuantile",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(r,"studentTQuantile",{enumerable:!0,get:function(){return D}});const Ae=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),ae=3e-12,$=1e-300;function ke(d){if(d<.5)return Math.log(Math.PI/Math.sin(Math.PI*d))-ke(1-d);const L=d-1;let T=.9999999999998099;const W=L+7.5;for(let G=0;G<Ae.length;G++)T+=Ae[G]/(L+G+1);return .5*Math.log(2*Math.PI)+(L+.5)*Math.log(W)-W+Math.log(T)}function we(d,L,T){const W=d+L,G=d+1,A=d-1;let p=1,f=1-W*T/G;Math.abs(f)<$&&(f=$),f=1/f;let w=f;for(let N=1;N<=300;N++){const q=2*N;let k=N*(L-N)*T/((A+q)*(d+q));f=1+k*f,Math.abs(f)<$&&(f=$),p=1+k/p,Math.abs(p)<$&&(p=$),f=1/f,w*=f*p,k=-(d+N)*(W+N)*T/((d+q)*(G+q)),f=1+k*f,Math.abs(f)<$&&(f=$),p=1+k/p,Math.abs(p)<$&&(p=$),f=1/f;const _=f*p;if(w*=_,Math.abs(_-1)<ae)break}return w}function se(d,L,T){if(!(d>0)||!(L>0)||!Number.isFinite(T))return Number.NaN;if(T<=0)return 0;if(T>=1)return 1;const W=Math.exp(ke(d+L)-ke(d)-ke(L)+d*Math.log(T)+L*Math.log(1-T));return T<(d+1)/(d+L+2)?W*we(d,L,T)/d:1-W*we(L,d,1-T)/L}function ie(d){const L=Math.abs(d),T=2/(2+L),W=4*T-2,G=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,15626441722e-18,-85238095915e-18,6529054439e-18,5059343495e-18,-991364156e-18,-227365122e-18,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18];let A=0,p=0,f;for(let N=G.length-1;N>0;N--)f=p,p=W*p-A+G[N],A=f;const w=T*Math.exp(-L*L+.5*(G[0]+W*p)-A);return d>=0?w:2-w}function Z(d){if(!(d>0)||!(d<1))return d===0?-1/0:d===1?1/0:Number.NaN;const L=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],T=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],W=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],G=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],A=.02425;let p,f,w;d<A?(p=Math.sqrt(-2*Math.log(d)),w=(((((W[0]*p+W[1])*p+W[2])*p+W[3])*p+W[4])*p+W[5])/((((G[0]*p+G[1])*p+G[2])*p+G[3])*p+1)):d<=1-A?(p=d-.5,f=p*p,w=(((((L[0]*f+L[1])*f+L[2])*f+L[3])*f+L[4])*f+L[5])*p/(((((T[0]*f+T[1])*f+T[2])*f+T[3])*f+T[4])*f+1)):(p=Math.sqrt(-2*Math.log(1-d)),w=-(((((W[0]*p+W[1])*p+W[2])*p+W[3])*p+W[4])*p+W[5])/((((G[0]*p+G[1])*p+G[2])*p+G[3])*p+1));const q=(.5*ie(-w/Math.SQRT2)-d)*Math.sqrt(2*Math.PI)*Math.exp(w*w/2);return w-q/(1+w*q/2)}function le(d,L){if(!(L>0)||!Number.isFinite(d))return Number.NaN;const T=.5*se(L/2,.5,L/(L+d*d));return d>0?1-T:T}function D(d,L){if(!(d>0)||!(d<1)||!(L>0))return Number.NaN;if(L>1e7)return Z(d);let T=-1e4,W=1e4,G=Z(d);const A=ke(L/2)+ke(.5)-ke((L+1)/2);for(let p=0;p<60;p++){const f=le(G,L);f<d?T=G:W=G;const w=Math.exp(-((L+1)/2)*Math.log(1+G*G/L)-A)/Math.sqrt(L),N=w>0?(f-d)/w:0;if(Math.abs(N)<1e-12)break;const q=G-N;if(G=q>T&&q<W&&Number.isFinite(q)?q:(T+W)/2,W-T<1e-12)break}return G}}),tt("packages/modules/charts/trendline.js",function(r,oe){"use strict";Object.defineProperty(r,"normaliseTrends",{enumerable:!0,get:function(){return v}}),Object.defineProperty(r,"linearTrend",{enumerable:!0,get:function(){return P}}),Object.defineProperty(r,"movingAverageTrend",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(r,"exponentialTrend",{enumerable:!0,get:function(){return C}}),Object.defineProperty(r,"computeTrend",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(r,"trendText",{enumerable:!0,get:function(){return z}}),Object.defineProperty(r,"drawTrendlines",{enumerable:!0,get:function(){return n}});const ae=oe("packages/modules/charts/frame.js").Pool,$=oe("packages/modules/charts/svg.js"),ke=$.attrs,we=$.path,se=$.ribbonPath,ie=$.round,Z=$.setText,le=$.SVG_NS,d=oe("packages/modules/charts/typography.js").applySize,T=oe("packages/modules/charts/styles.js").NS,W=oe("packages/modules/charts/scale.js"),G=W.toNumber,A=W.toTime,f=oe("packages/modules/charts/quantile.js").studentTQuantile,N=oe("packages/modules/charts/format.js").r2Digits,q={linear:new Set(["linear","lr","ols","regression","least-squares"]),movingAverage:new Set(["movingaverage","moving-average","ma","sma","rolling"]),exponential:new Set(["exponential","exp","ewma","ses","holt","smoothing"])},k=1e-4,_=1-1e-4;function c(e){const i=String(e||"linear").toLowerCase();return q.linear.has(i)?"linear":q.movingAverage.has(i)?"movingAverage":q.exponential.has(i)?"exponential":null}function v(e){if(!e)return[];const i=Array.isArray(e)?e:[e],g=[];for(const b of i){if(b===!0){g.push({method:"linear"});continue}if(typeof b=="string"){const O=c(b);O&&g.push({method:O});continue}if(b&&typeof b=="object"){const O=c(b.method);O&&g.push({...b,method:O})}}return g}function E(e,i){if(e.kind==="band")return e.centre(i);const g=e.kind==="time"?A(i):G(i);return g===null?NaN:e.of(g)}function m(e){const i=[];for(const g of e.points){const b=Number(g.y);i.push({value:Number.isFinite(b)?b:null,rawX:g.x})}return i}function y(e,i){const g=[];for(const b of e.points){const O=i.kind==="time"?A(b.x):G(b.x),ne=Number(b.y);O===null||!Number.isFinite(O)||!Number.isFinite(ne)||g.push({x:O,y:ne})}return g.sort((b,O)=>b.x-O.x),g}function P(e,i,g={}){const b=e.length;if(b<2)return null;let O=0,ne=0;for(const t of e)O+=t.x,ne+=t.y;O/=b,ne/=b;let H=0,F=0,s=0;for(const t of e){const h=t.x-O,j=t.y-ne;H+=h*h,F+=h*j,s+=j*j}if(H===0)return null;const M=F/H,B=ne-M*O,I=s===0?1:Math.max(0,Math.min(1,F*F/(H*s))),V=e[0].x,fe=e[b-1].x,a=t=>({x:t,y:B+M*t}),x=[a(V),a(fe)],R=[];let o=null;const l=Math.max(0,Math.floor(Number(i)||0));if(l>0&&fe>V){const t=(fe-V)/(b-1);if(t>0&&(R.push(a(fe),a(fe+l*t)),b>2)){const h=Number.isFinite(g.confidence)&&g.confidence>0&&g.confidence<1?Number(g.confidence):.95,j=1-(1-h)/2,U=Math.max(0,s-M*F),J=Math.sqrt(U/(b-2)),X=f(j,b-2),de=[];for(let pe=0;pe<=l;pe++){const xe=fe+pe*t,ve=B+M*xe,Oe=1/b+(xe-O)**2/H,Pe=J*Math.sqrt(1+Oe),te=J*Math.sqrt(Oe);de.push({x:xe,mean:ve,lower:ve-X*Pe,upper:ve+X*Pe,lowerMean:ve-X*te,upperMean:ve+X*te})}o={confidence:h,points:de}}}return{fit:x,forecast:R,band:o,stats:{method:"linear",slope:M,intercept:B,r2:I,n:b,forecast:R.length?l:0,confidence:o?o.confidence:null}}}function Q(e,i){const g=Math.max(1,Math.floor(Number(i)||3)),b=[];let O=0;const ne=[];for(const H of e)Number.isFinite(H.value)&&(b.push(H.value),O+=H.value,b.length>g&&(O-=b.shift())),b.length&&ne.push({x:H.rawX,y:O/b.length});return ne.length<2?null:{fit:ne,stats:{method:"movingAverage",window:g}}}function K(e,i){const g=e.length,b=new Array(g).fill(null);let O=null,ne=0;for(let H=0;H<g;H++){const F=e[H];if(!Number.isFinite(F)){O!==null&&(b[H]=O);continue}if(O===null){O=F,b[H]=F;continue}ne+=(F-O)**2,O=i*F+(1-i)*O,b[H]=O}return{smoothed:b,sse:ne}}function ge(e,i,g){const b=e.length,O=new Array(b).fill(null);let ne=null,H=null,F=0;for(let s=0;s<b;s++){const M=e[s];if(!Number.isFinite(M)){ne!==null&&(ne+=H,O[s]=ne);continue}if(ne===null){ne=M,O[s]=M;continue}if(H===null){H=M-ne;const V=ne+H;F+=(M-V)**2;const fe=ne;ne=i*M+(1-i)*(fe+H),H=g*(ne-fe)+(1-g)*H,O[s]=ne;continue}const B=ne+H;F+=(M-B)**2;const I=ne;ne=i*M+(1-i)*(I+H),H=g*(ne-I)+(1-g)*H,O[s]=ne}return{smoothed:O,sse:F}}function re(e,i,g,b=80){const O=(Math.sqrt(5)-1)/2;let ne=i,H=g,F=H-O*(H-ne),s=ne+O*(H-ne),M=e(F),B=e(s);for(let I=0;I<b;I++)M<B?(H=s,s=F,B=M,F=H-O*(H-ne),M=e(F)):(ne=F,F=s,M=B,s=ne+O*(H-ne),B=e(s));return(ne+H)/2}function C(e,i){const g=String(i.kind||i.model||"").toLowerCase()==="holt",b=e.map(B=>Number.isFinite(B.value)?B.value:null);if(b.filter(B=>B!==null).length<(g?2:1))return null;const ne=B=>Math.min(_,Math.max(k,B));let H=Number.isFinite(i.alpha)?ne(Number(i.alpha)):null,F=g&&Number.isFinite(i.beta)?ne(Number(i.beta)):null;if(g){if(H===null||F===null){let B=H===null?.5:H,I=F===null?.5:F;for(let V=0;V<6;V++)H===null&&(B=re(fe=>ge(b,fe,I).sse,k,_)),F===null&&(I=re(fe=>ge(b,B,fe).sse,k,_));H=H===null?B:H,F=F===null?I:F}}else H===null&&(H=re(B=>K(b,B).sse,k,_));const s=g?ge(b,H,F):K(b,H),M=[];for(let B=0;B<e.length;B++){const I=s.smoothed[B];I===null||!Number.isFinite(I)||M.push({x:e[B].rawX,y:I})}return M.length<2?null:{fit:M,stats:{method:"exponential",kind:g?"holt":"ses",alpha:H,beta:g?F:null}}}function ee(e,i,g){if(i.method==="linear"){const O=y(e,g);return P(O,i.forecast,{confidence:i.confidence})}const b=m(e);return i.method==="movingAverage"?Q(b,i.window||i.period):C(b,i)}function z(e,i,g,b,O,ne){const H=i?` for ${i}`:"";if(e.method==="linear"){const B=Number.isFinite(e.r2)?`, R² ${e.r2.toFixed(2)}`:"";let I=`Trend (linear)${H}: slope ${g(e.slope)}${B}`;if(e.forecast>0&&b&&b.length){const V=b[b.length-1];if(I+=`; forecast ${e.forecast} step${e.forecast===1?"":"s"} ahead to ${g(V.y)}`,O&&O.points.length){const fe=O.points[O.points.length-1],a=ne==="confidence"||ne==="mean",x=a?fe.lowerMean:fe.lower,R=a?fe.upperMean:fe.upper,o=a?"confidence":"prediction",l=Math.round(O.confidence*100);I+=`; ${l}% ${o} band ${g(x)} to ${g(R)} at the horizon`}}return I}if(e.method==="movingAverage")return`Trend (moving average, window ${e.window})${H}`;const F=e.kind==="holt"?"Holt":"single",s=Number.isFinite(e.alpha)?`, α ${e.alpha.toFixed(2)}`:"",M=Number.isFinite(e.beta)?`, β ${e.beta.toFixed(2)}`:"";return`Trend (exponential, ${F})${H}${s}${M}`}function n(e){const i=v(e.trend);if(!i.length)return[];const g=e.group.ownerDocument;let b=null;for(const H of e.group.childNodes||[])if(H&&String(H.getAttribute&&H.getAttribute("class"))===`${T}__trends`){b=H;break}b||(b=g.createElementNS(le,"g"),b.setAttribute("class",`${T}__trends`),e.group.appendChild(b)),e.clip?b.setAttribute("clip-path",`url(#${e.clip})`):b.removeAttribute("clip-path");const O=new ae(b),ne=[];for(const H of i)for(const F of e.series){const s=F.axis==="right"&&e.rightScale?e.rightScale:e.yScale,M=ee(F,H,e.xScale);if(!M)continue;const B=e.scheme.series(F.index),I=[];for(const a of M.fit){const x=E(e.xScale,a.x),R=s.of(a.y);!Number.isFinite(x)||!Number.isFinite(R)||I.push(I.length?"L":"M",ie(x),ie(R))}if(I.length<4)continue;if(ke(O.next("path",`${T}__trend`),{d:we(I),fill:"none",stroke:B,"data-series":F.index}),H.band!==!1&&M.band&&M.band.points.length>=2){const a=H.band==="confidence"||H.band==="mean",x=[];for(const o of M.band.points){const l=E(e.xScale,o.x),t=a?o.lowerMean:o.lower,h=a?o.upperMean:o.upper,j=s.of(t),U=s.of(h);!Number.isFinite(l)||!Number.isFinite(j)||!Number.isFinite(U)||x.push({x:ie(l),lower:ie(j),upper:ie(U)})}const R=se(x);R&&ke(O.next("path",`${T}__trend-band`),{d:R,fill:B,"fill-opacity":.15,stroke:"none","data-series":F.index})}const fe=M.forecast||[];if(fe.length>=2){const a=[];for(const x of fe){const R=E(e.xScale,x.x),o=s.of(x.y);!Number.isFinite(R)||!Number.isFinite(o)||a.push(a.length?"L":"M",ie(R),ie(o))}a.length>=4&&ke(O.next("path",`${T}__trend-forecast`),{d:we(a),fill:"none",stroke:B,"data-series":F.index})}if(H.label!==!1&&M.stats.method==="linear"&&Number.isFinite(M.stats.r2)){const a=M.fit[M.fit.length-1],x=O.next("text",`${T}__trend-label`);d(x,e.size),ke(x,{x:ie(E(e.xScale,a.x)),y:ie(s.of(a.y))-4,"text-anchor":"end",fill:B}),Z(x,e.grid.messages.t("chart.r2",{value:N(e.grid,M.stats.r2)}))}ne.push({text:z(M.stats,F.label,e.format,fe,H.band===!1?null:M.band,H.band)})}return O.finish(),ne.filter(H=>H.text)}}),tt("packages/modules/charts/rulecolour.js",function(r,oe){"use strict";Object.defineProperty(r,"colourOf",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(r,"ruleColour",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"ruleLegend",{enumerable:!0,get:function(){return ke}});const Ae="*";function ae(we){if(!we||typeof we!="object")return null;for(const se of["background","backgroundColor","color"]){const ie=we[se];if(typeof ie=="string"&&ie.trim())return ie.trim()}return null}function $(we){const{grid:se,col:ie,value:Z}=we;if(!se||!ie||!se.formatting||typeof se.formatting.styleFor!="function")return null;try{return ae(se.formatting.styleFor(ie,Z))}catch{return null}}function ke(we){const{grid:se,col:ie}=we,Z=new Set([...we.colours||[]].filter(Boolean));if(!Z.size||!se||!se.formatting||typeof se.formatting.list!="function")return[];let le;try{le=[...se.formatting.list(Ae)||[],...ie?se.formatting.list(ie)||[]:[]]}catch{return[]}const D=[],d=new Set;for(const L of le){if(!L||L.enabled===!1)continue;const T=ae(L.style);!T||!Z.has(T)||d.has(T)||(d.add(T),D.push({key:L.id||`rule:${D.length}`,label:L.label||L.id||T,colour:T,index:D.length}))}return D}}),tt("packages/modules/charts/glyph.js",function(r,oe){"use strict";Object.defineProperty(r,"glyphFor",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"glyphTransform",{enumerable:!0,get:function(){return se}});const ae=oe("packages/core/src/internal/util.js").warnOnce,ke=oe("packages/modules/charts/svg.js").round;function we(ie,Z,le="node"){if(!Z)return null;const D=le==="marker",d=D?"a chart image marker":"a network node",L=ie&&ie.icons;if(!L||typeof L.get!="function")return ae(`chart:icons:${Z}`,`${d.charAt(0).toUpperCase()}${d.slice(1)} asked for the icon '${Z}', but this grid publishes no icon registry — a headless grid has no sprites. The ${D?"point":"node"} drew as ${D?"its default marker":"a plain disc"}.`),null;const T=L.get(Z);return T||(ae(`chart:icon:${Z}`,`Unknown icon '${Z}' on ${d}; ${D?"kept the default marker":"drew a plain disc"} instead. Register it with registerIcon or config.icons, or name a built-in.`),null)}function se(ie,Z){const le=String(ie.viewBox||"0 0 16 16").trim().split(/[\s,]+/).map(Number),[D,d,L,T]=le.length===4&&le.every(Number.isFinite)?le:[0,0,16,16],W=Math.max(L||16,T||16),G=Z.size/W,A=Z.x-L*G/2,p=Z.y-T*G/2;return`translate(${ke(A-D*G)} ${ke(p-d*G)}) scale(${ke(G)})`}}),tt("packages/modules/charts/markers.js",function(r,oe){"use strict";Object.defineProperty(r,"MARKER_SIZE",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(r,"clearMarkerImages",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"resolveMarker",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"safeImageUrl",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"imageOf",{enumerable:!0,get:function(){return A}}),Object.defineProperty(r,"imageState",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"markerFor",{enumerable:!0,get:function(){return f}}),Object.defineProperty(r,"placeMarker",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"markerBoxHit",{enumerable:!0,get:function(){return N}});const ae=oe("packages/core/src/internal/util.js").warnOnce,$=oe("packages/modules/charts/glyph.js"),ke=$.glyphFor,we=$.glyphTransform,ie=oe("packages/modules/charts/styles.js").NS,Z=16,le=[6,64],D=/^data:image\/(png|jpe?g|gif|webp|avif|bmp|svg\+xml)[;,]/i,d=/^(https?:|blob:|data:|javascript:|vbscript:|file:|\/|\.\.?\/)|[/.]/i,L=new Map;function T(){L.clear()}function W(q){if(!q||typeof q!="object"||Array.isArray(q))return null;const k=q.image;if(k==null||k==="")return ae("chart:marker:no-image",'chart "marker" needs an "image": an icon name, a URL, { col } or a function. No markers were drawn from it.'),null;const _=Number(q.size);return{image:k,size:Number.isFinite(_)?Math.min(le[1],Math.max(le[0],_)):Z,explicitSize:Number.isFinite(_)}}function G(q){const k=String(q).trim(),_=/^([a-z][a-z0-9+.-]*):/i.exec(k);if(_){const c=_[1].toLowerCase();return c==="data"?D.test(k)?k:null:c==="http"||c==="https"||c==="blob"?k:null}return/^[^/]*:/.test(k)?null:k}function A(q,k,_){let c=q.image;if(typeof c=="function")try{c=c(k)}catch{c=null}else c&&typeof c=="object"&&typeof c.col=="string"&&(c=_&&_.rows&&k&&k.rowKey!==void 0&&k.rowKey!==null?_.rows.value(k.rowKey,c.col):null);return typeof c=="string"&&c.trim()?c.trim():null}function p(q,k,_){let c=L.get(q);if(c)return c.state==="loading"&&_&&c.waiting.add(_),c.state;const v=k&&k.defaultView,E=v&&v.Image;if(typeof E!="function")return"ok";c={state:"loading",waiting:new Set(_?[_]:[])},L.set(q,c);const m=new E,y=P=>{if(c.state=P,P==="failed"){const Q=q.length>80?q.slice(0,77):q;ae(`chart:marker:image-failed:${q}`,`a chart marker image could not be loaded (${Q}); those points keep the default marker. Check the URL, and that the server allows the page to load it.`)}for(const Q of c.waiting)try{Q()}catch{}c.waiting.clear()};return m.onload=()=>y("ok"),m.onerror=()=>y("failed"),m.src=q,"loading"}function f(q,k,_){const c=A(q,k,_.grid);if(!c)return null;if(!d.test(c)){const E=ke(_.grid,c,"marker");return E?{kind:"icon",def:E}:null}const v=G(c);if(!v){const E=c.slice(0,40);return ae(`chart:marker:unsafe-url:${E}`,`a chart marker image URL was refused (${E}): only http, https, blob, relative and data:image URLs are drawn. Those points keep the default marker.`),null}return p(v,_.doc,_.redraw)==="ok"?{kind:"image",href:v}:null}function w(q,k,_){const c=_.size/2;if(k.kind==="icon"){const E=k.def,m=E.paint==="stroke",y=q.next("path",`${ie}__marker-icon ${ie}__mark`);return _.attrs(y,{d:E.paths.join(" "),transform:we(E,{x:_.x,y:_.y,size:_.size}),fill:m?"none":_.colour,stroke:m?_.colour:null,"stroke-width":m?1.5:null,class:`${ie}__marker-icon ${ie}__mark`,..._.extra||{}}),y}const v=q.next("image",`${ie}__marker-image ${ie}__mark`);return _.attrs(v,{href:k.href,x:_.round(_.x-c),y:_.round(_.y-c),width:_.size,height:_.size,preserveAspectRatio:"xMidYMid meet",class:`${ie}__marker-image ${ie}__mark`,..._.extra||{}}),v}function N(q,k,_){return Math.abs(k-q.x)<=q.half&&Math.abs(_-q.y)<=q.half}}),tt("packages/modules/charts/cartesian.js",function(r,oe){"use strict";Object.defineProperty(r,"CARTESIAN",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(r,"WATERFALL_TOTAL",{enumerable:!0,get:function(){return je}}),Object.defineProperty(r,"withWaterfallTotal",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(r,"axisWindowSpan",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(r,"axisWindowNow",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(r,"rollingDomain",{enumerable:!0,get:function(){return We}}),Object.defineProperty(r,"WINDOW_LEAD",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(r,"aheadOfWindow",{enumerable:!0,get:function(){return st}}),Object.defineProperty(r,"staleWindow",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(r,"windowedBound",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(r,"slotPadFor",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(r,"pinnedContinuousX",{enumerable:!0,get:function(){return Vt}}),Object.defineProperty(r,"continuousX",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(r,"bandedX",{enumerable:!0,get:function(){return et}}),Object.defineProperty(r,"dataInterval",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(r,"continuousSlot",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(r,"xDomainFor",{enumerable:!0,get:function(){return Ue}}),Object.defineProperty(r,"xScaleFor",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(r,"drawFits",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(r,"drawConfidenceBand",{enumerable:!0,get:function(){return xn}}),Object.defineProperty(r,"drawBoundErrorBars",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(r,"drawForest",{enumerable:!0,get:function(){return an}}),Object.defineProperty(r,"drawReferenceLines",{enumerable:!0,get:function(){return on}}),Object.defineProperty(r,"drawCartesian",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(r,"HIT_TOLERANCE",{enumerable:!0,get:function(){return Bn}}),Object.defineProperty(r,"nearestDrawnPoint",{enumerable:!0,get:function(){return _r}}),Object.defineProperty(r,"nearestCategory",{enumerable:!0,get:function(){return yr}}),Object.defineProperty(r,"categoryKeyAt",{enumerable:!0,get:function(){return nr}});const Ae=oe("packages/modules/charts/axis.js"),ae=Ae.drawAxisLines,$=Ae.drawAxisTitle,ke=Ae.drawBandLabels,we=Ae.drawCategoryAxis,se=Ae.drawContinuousAxis,ie=Ae.drawMeasureAxis,Z=Ae.overhangFor,le=Ae.pinXDomain,D=Ae.setPlotClip,d=oe("packages/modules/charts/frame.js"),L=d.Pool,T=d.shouldRotate,W=oe("packages/modules/charts/format.js"),G=W.formatters,A=W.r2Digits,p=oe("packages/modules/charts/scale.js"),f=p.bandScale,w=p.extent,N=p.isNumber,q=p.key,k=p.linearScale,_=p.measureDomain,c=p.timeScale,v=p.toNumber,E=p.toTime,m=oe("packages/modules/charts/stack.js"),y=m.measureValues,P=m.stacker,Q=oe("packages/modules/charts/svg.js"),K=Q.attrs,ge=Q.path,re=Q.ribbonPath,C=Q.round,ee=Q.setText,z=Q.SVG_NS,e=oe("packages/modules/charts/styles.js").NS,g=oe("packages/modules/charts/labels.js").drawDataLabels,O=oe("packages/modules/charts/dense.js").downsample,H=oe("packages/modules/charts/scheme.js").resolveScheme,s=oe("packages/modules/charts/typography.js").applySize,B=oe("packages/modules/charts/combo.js").drawRightAxis,I=oe("packages/modules/charts/annotations.js"),V=I.drawAnnotations,fe=I.overlayLayer,x=oe("packages/modules/charts/trendline.js").drawTrendlines,R=oe("packages/modules/charts/rulecolour.js"),o=R.ruleColour,l=R.ruleLegend,t=oe("packages/modules/charts/curve.js"),h=t.curveCommands,j=t.resolveCurve,J=oe("packages/core/src/internal/util.js").warnOnce,X=oe("packages/modules/charts/fills.js"),de=X.isPaintRef,pe=X.paintSolid,xe=X.rowFillSource,ve=oe("packages/modules/charts/markers.js"),Oe=ve.markerFor,Pe=ve.placeMarker,te=ve.resolveMarker,Se=3.5,ye=Object.freeze({line:{zero:!1,marks:"path"},step:{zero:!1,marks:"path"},area:{zero:!0,marks:"path"},rangeArea:{zero:!1,marks:"path"},bar:{zero:!0,marks:"rect"},horizontalBar:{zero:!0,marks:"rect",horizontal:!0},waterfall:{zero:!0,marks:"rect"},scatter:{zero:!1,marks:"circle"},bubble:{zero:!1,marks:"circle"},candlestick:{zero:!1,marks:"rect"},ohlc:{zero:!1,marks:"rect"}});function be(he){const Le=[];for(let $e=0;$e<he.length;$e++){const _e=he[$e];if($e===0){Le.push("M",_e.x,_e.y);continue}Le.push("L",_e.x,he[$e-1].y),Le.push("L",_e.x,_e.y)}return Le}function Ne(he){const Le=[0];if(!he)return Le;let $e=0;for(const _e of he.points)N(_e.y)&&_e.total!==!0&&($e+=_e.y,Le.push($e));return Le}const je=Object.freeze({key:"lattice:waterfall-total"});function Ee(he,Le,$e){if(!Le||typeof Le!="object"||!Le.total||!he||he.empty||!Array.isArray(he.series)||!he.series.length)return he;const _e=typeof Le.total=="string"&&Le.total.trim()!==""?Le.total:$e,Re=he.series.map(Ie=>{let De=0,Xe=0,Ge=!1;for(const qe of Ie.points)Xe+=Number.isFinite(qe.rows)?qe.rows:0,N(qe.y)&&(De+=qe.y,Ge=!0);const He={x:je,xKey:q(je),label:_e,y:Ge?De:null,size:null,rows:Xe,rowKey:null,values:null,total:!0};return{...Ie,points:[...Ie.points,He]}});return{...he,kind:"category",series:Re,categories:[...he.categories||[],je],labels:[...he.labels||[],_e]}}function Ce(he){const Le=he&&he.window;if(!Le||typeof Le!="object")return 0;const $e=Number(Le.span);return!Number.isFinite($e)||$e<=0?0:Le.kind!=="time"?(J("chart.axis.window.kind",`axis window kind "${Le.kind}" is not supported on a chart axis; only { kind: "time", span } rolls the domain. Bound the row count with the source's maxRows instead.`),0):$e}function Fe(he,Le){const $e=he&&he.window;if(!$e||typeof $e!="object"||typeof $e.now!="function")return Le;const _e=Number($e.now());return Number.isFinite(_e)?_e:(J("chart.axis.window.now","axis.x.window.now did not return a time, so the rolling window is measured from this device's clock instead. It must return epoch milliseconds — the same number Date.now() returns — because that is what the x values are compared against."),Le)}function We(he,Le,$e){const _e=$e+he*wt;let Re=$e;for(const Ie of Le)Number.isFinite(Ie)&&Ie>Re&&Ie<=_e&&(Re=Ie);return{min:Re-he,max:Re}}const wt=.25;function lt(he,Le,$e){const _e=Ce(Le);if(!_e||!he||!Array.isArray(he.categories))return null;const Re=ye[$e];if(!Re||Re.horizontal||he.kind==="category"||$e==="bar"&&!Ye(he,$e,Le))return null;const Ie=he.categories.map(De=>he.kind==="time"?E(De):v(De));return{span:_e,values:Ie}}function st(he,Le,$e,_e){const Re=lt(he,Le,$e);if(!Re)return null;const Ie=Re.span*wt;let De=0,Xe=0;for(const Ge of Re.values)Ge===null||!Number.isFinite(Ge)||Ge-_e<=Ie||(De+=1,Ge-_e>Xe&&(Xe=Ge-_e));return De?{span:Re.span,limit:Ie,count:De,lead:Xe}:null}function Qe(he,Le,$e,_e){const Re=lt(he,Le,$e);if(!Re)return null;const{span:Ie}=Re,De=Re.values.filter(qe=>qe!==null&&Number.isFinite(qe));if(!De.length)return null;const{min:Xe,max:Ge}=We(Ie,De,_e);let He=-1/0;for(const qe of De){if(qe>=Xe&&qe<=Ge)return null;qe<Xe&&qe>He&&(He=qe)}return He===-1/0?{span:Ie,newest:null,age:null,points:De.length}:{span:Ie,newest:He,age:_e-He,points:De.length}}function rt(he,Le,$e,_e){const Re=lt(he,Le,$e);if(!Re)return he;const{span:Ie,values:De}=Re,Xe=De.filter(Je=>Je!==null&&Number.isFinite(Je));if(!Xe.length)return he;const{min:Ge,max:He}=We(Ie,Xe,_e),qe=[];for(let Je=0;Je<De.length;Je++){const St=De[Je];(St===null||!Number.isFinite(St)||St>=Ge&&St<=He)&&qe.push(Je)}return qe.length===De.length?he:{...he,categories:qe.map(Je=>he.categories[Je]),labels:Array.isArray(he.labels)?qe.map(Je=>he.labels[Je]):he.labels,series:(he.series||[]).map(Je=>({...Je,points:Array.isArray(Je.points)?qe.map(St=>Je.points[St]).filter(St=>St!==void 0):Je.points})),windowed:De.length-qe.length}}const pt=Object.freeze({bar:.2,candlestick:.3,ohlc:.3}),Ht=.4;function kt(he){return Object.hasOwn(pt,he)?pt[he]:Ht}const Gt=new Set(["bar","candlestick","ohlc"]);function Vt(he){const Le=he&&typeof he.scale=="string"?he.scale:"";return Le==="time"||Le==="linear"}function Ye(he,Le,$e){if(!he||he.kind==="category")return!1;const _e=ye[Le];return _e&&_e.horizontal?!1:Gt.has(Le)?Vt($e):!0}function et(he,Le,$e){return!Ye(he,Le,$e)}function gt(he){const Le=he.filter(Re=>typeof Re=="number"&&Number.isFinite(Re)).slice().sort((Re,Ie)=>Re-Ie),$e=[];for(let Re=1;Re<Le.length;Re++){const Ie=Le[Re]-Le[Re-1];Ie>0&&$e.push(Ie)}if(!$e.length)return 0;$e.sort((Re,Ie)=>Re-Ie);const _e=Math.floor($e.length/2);return $e.length%2?$e[_e]:($e[_e-1]+$e[_e])/2}function ut(he){const{bound:Le,scale:$e,config:_e,padding:Re}=he,Ie=_e?Number(_e.barWidth):NaN,De=Number.isFinite(Ie)&&Ie>0,Xe=(Le.categories||[]).map(Je=>Le.kind==="time"?E(Je):v(Je)),Ge=De?Ie:gt(Xe),He=Math.abs($e.range[1]-$e.range[0]);if(!Ge)return Math.max(1,He/20*(1-Re));const qe=Math.abs($e.of($e.domain.min+Ge)-$e.of($e.domain.min));return Math.max(1,De?qe:qe*(1-Re))}function Ue(he,Le,$e,_e){if(et(he,Le,$e))return null;const Re=Ce($e),Ie=he.kind==="time"?he.categories.map(E):he.categories.map(v);if(he.kind==="time"&&!Re){const Xe=w(Ie);if(Xe&&Xe.min===Xe.max)return le({min:Xe.min-3e4,max:Xe.max+3e4},he,$e)}const De=Re?We(Re,Ie,Number.isFinite(_e)?_e:Fe($e,Date.now())):_(Ie,{zero:!1,nice:he.kind!=="time"});return le(De,he,$e)}function ft(he,Le,$e,_e){const Re=[Le.left,Le.right];if(et(he,$e,_e))return Ce(_e)&&J("chart.axis.window.band","a rolling time window needs a continuous x axis; this chart bands its x values, so the window is ignored. Bind a date or numeric column to x, or put this type on a continuous axis with axis.x.scale."),f(he.categories,Re,kt($e));const Ie=he.xDomain||Ue(he,$e,_e);return he.kind==="time"?c(Ie,Re):k(Ie,Re)}function yt(he,Le){if(he.kind==="band")return he.centre(Le.x);const $e=he.kind==="time"?E(Le.x):v(Le.x);return $e===null?NaN:he.of($e)}function Ct(he,Le){const $e=he&&he.seriesStyle&&he.seriesStyle[Le];if($e)return{width:$e.width!=null?String($e.width):null,dash:Array.isArray($e.dash)&&$e.dash.length?$e.dash.join(" "):null,opacity:null,emphasized:!1};const _e=he&&Array.isArray(he.emphasis)?he.emphasis:null;if(!_e||!_e.length)return{width:null,dash:null,opacity:null,emphasized:!1};const Re=_e.includes(Le);return{width:Re?"var(--lattice-chart-emphasis-width, 3.5)":null,dash:null,opacity:Re?null:"var(--lattice-chart-muted-opacity, .35)",emphasized:Re}}function ot(he){const{series:Le,xScale:$e,yScale:_e,baseline:Re,fill:Ie,colour:De,stack:Xe,style:Ge}=he,He=[],qe=[];let Je=[];const St=()=>{Je.length===1?He.push("M",Je[0].x,Je[0].y):Je.length>1&&He.push(...h(Je,he.curve||null)),Je=[]};for(let Ft=0;Ft<Le.points.length;Ft++){const Bt=Le.points[Ft],tn=C(yt($e,Bt));if(!N(Bt.y)||Number.isNaN(tn)){St();continue}qe[Ft]=!0;const Zt=Bt.y,Xt=he.lower?he.lower.points[Ft]:null;if(he.lower&&!(Xt&&N(Xt.y))){St();continue}const It=Xe?Xe.take(Ft,Zt):null,qt=C(_e.of(It?It[1]:Zt)),rn=C(_e.of(It?It[0]:Xt?Xt.y:Re));Je.push({x:tn,y:qt,base:rn}),Bt.px=tn,Bt.py=qt,Bt.pbase=rn}St(),K(he.pool.next("path",`${e}__line ${e}__mark`),{d:He.length?ge(He):"",stroke:De,"data-series":he.index,"stroke-width":Ge?Ge.width:null,"stroke-dasharray":Ge?Ge.dash:null,opacity:Ge?Ge.opacity:null});const xt=!!he.marker&&!!he.markerEnv;if(xt&&!Ie&&dt(he,qe),!Ie){xt||it({...he,placed:qe});return}const Ot=[];let Nt=[];const $t=()=>{if(Nt.length<2){Nt=[];return}const Ft=h(Nt,he.curve||null);Ft[0]="L",Ot.push("M",Nt[0].x,Nt[0].base),Ot.push(...Ft);for(let Bt=Nt.length-1;Bt>=0;Bt--)Ot.push("L",Nt[Bt].x,Nt[Bt].base);Ot.push("Z"),Nt=[]};for(const Ft of Le.points){if(!N(Ft.y)||Ft.px===void 0){$t();continue}Nt.push({x:Ft.px,y:Ft.py,base:Ft.pbase})}$t(),K(he.pool.next("path",`${e}__area ${e}__mark`),{d:Ot.length?ge(Ot):"",fill:De,"data-series":he.index,opacity:de(De)?"1":Ge?Ge.emphasized?"1":Ge.opacity:null}),xt?dt(he,qe):it({...he,placed:qe})}function dt(he,Le){const{series:$e}=he;for(let _e=0;_e<$e.points.length;_e++){if(!Le[_e])continue;const Re=$e.points[_e];At(he,Re,_e,Re.px,Re.py,Se*2,he.colour)||K(he.pool.next("circle",`${e}__point ${e}__mark`),{cx:Re.px,cy:Re.py,r:Se,fill:he.colour,"data-series":he.index,"data-point":_e})}}function it(he){const{series:Le,placed:$e}=he;for(let _e=0;_e<Le.points.length;_e++){if(!$e[_e]||$e[_e-1]||$e[_e+1])continue;const Re=Le.points[_e];K(he.pool.next("circle",`${e}__point ${e}__mark`),{cx:Re.px,cy:Re.py,r:Se,fill:he.colour,"data-series":he.index,"data-point":_e})}}function bt(he,Le){const $e=he&&he.range;if(!Array.isArray($e)||$e.length!==2)return Le;const[_e,Re]=$e;return!Number.isFinite(_e)||!Number.isFinite(Re)||!Number.isFinite(Le)?Le:Math.min(Math.max(_e,Re),Math.max(Math.min(_e,Re),Le))}function Jt(he){const{series:Le,xScale:$e,yScale:_e,baseline:Re,colour:Ie,stack:De,slot:Xe}=he;for(let Ge=0;Ge<Le.points.length;Ge++){const He=Le.points[Ge];if(!N(He.y))continue;const qe=$e.kind==="band"?$e.of(He.x):yt($e,He)-Xe.span/2;if(Number.isNaN(qe))continue;const Je=He.y,St=he.pointColour&&he.pointColour(He,Ie)||Ie,xt=De?De.take(Ge,Je):[Re,Je],Ot=bt(_e,_e.of(xt[1])),Nt=bt(_e,_e.of(xt[0])),$t=qe+Xe.offset,Ft=$e.kind==="band"?$t:bt($e,$t),Bt=$e.kind==="band"?$t+Xe.width:bt($e,$t+Xe.width),tn=he.pool.next("rect",`${e}__bar ${e}__mark`,`${Le.key}:${q(He.x)}`);K(tn,{x:C(Ft),y:C(Math.min(Ot,Nt)),width:C(Math.max(0,Bt-Ft)),height:C(Math.max(1,Math.abs(Nt-Ot))),fill:St,"data-series":he.index,"data-point":Ge}),He.px=C(qe+Xe.offset+Xe.width/2),He.py=C(Math.min(Ot,Nt)),He.pbase=C(Math.max(Ot,Nt))}}function en(he){const{series:Le,xScale:$e,yScale:_e}=he;let Re=0;for(let Ie=0;Ie<Le.points.length;Ie++){const De=Le.points[Ie];if(!N(De.y))continue;const Xe=De.y,Ge=De.total===!0,He=Ge?0:Re,qe=Ge?Xe:Re+Xe;Ge||(Re+=Xe);const Je=bt(_e,_e.of(Math.max(He,qe))),St=bt(_e,_e.of(Math.min(He,qe))),xt=he.pool.next("rect",`${e}__bar ${e}__mark`,`${Le.key}:${q(De.x)}`);K(xt,{x:C($e.of(De.x)),y:C(Je),width:C($e.bandwidth),height:C(Math.max(1,St-Je)),fill:Xe>=0?he.positive:he.negative,"data-series":he.index,"data-point":Ie,"data-total":Ge?"true":null}),De.px=C($e.of(De.x)+$e.bandwidth/2),De.py=C(Je)}}function Mt(he){const{series:Le,valueScale:$e,baseline:_e,colour:Re,stack:Ie,slot:De}=he;for(let Xe=0;Xe<Le.points.length;Xe++){const Ge=Le.points[Xe];if(!N(Ge.y))continue;const He=he.bandScale.of(Ge.x);if(Number.isNaN(He))continue;const qe=Ge.y,Je=he.pointColour&&he.pointColour(Ge,Re)||Re,St=Ie?Ie.take(Xe,qe):[_e,qe],xt=bt($e,$e.of(St[0])),Ot=bt($e,$e.of(St[1]));K(he.pool.next("rect",`${e}__bar ${e}__mark`,`${Le.key}:${q(Ge.x)}`),{x:C(Math.min(xt,Ot)),y:C(He+De.offset),width:C(Math.max(1,Math.abs(Ot-xt))),height:C(Math.max(0,De.width)),fill:Je,"data-series":he.index,"data-point":Xe}),Ge.px=C(Ot),Ge.py=C(He+De.offset+De.width/2),Ge.pbase=C(xt)}}function Lt(he){const{series:Le,xScale:$e,yScale:_e,baseline:Re,colour:Ie,stack:De,slot:Xe}=he;for(let Ge=0;Ge<Le.points.length;Ge++){const He=Le.points[Ge];if(!N(He.y))continue;const qe=$e.kind==="band"?$e.of(He.x):yt($e,He)-Xe.span/2;if(Number.isNaN(qe))continue;const Je=He.y,St=he.pointColour&&he.pointColour(He,Ie)||Ie,xt=De?De.take(Ge,Je):[Re,Je],Ot=bt(_e,_e.of(xt[1])),Nt=bt(_e,_e.of(xt[0])),$t=C(qe+Xe.offset+Xe.width/2);K(he.pool.next("line",`${e}__lollipop-stem ${e}__mark`,`${Le.key}:${q(He.x)}`),{x1:$t,y1:C(Nt),x2:$t,y2:C(Ot),stroke:St,"stroke-width":2,"data-series":he.index,"data-point":Ge}),K(he.pool.next("circle",`${e}__lollipop-dot ${e}__mark`,`${Le.key}:${q(He.x)}`),{cx:$t,cy:C(Ot),r:4,fill:St,"data-series":he.index,"data-point":Ge}),He.px=$t,He.py=C(Ot),He.pbase=C(Nt)}}function zt(he){const{series:Le,valueScale:$e,baseline:_e,colour:Re,stack:Ie,slot:De}=he;for(let Xe=0;Xe<Le.points.length;Xe++){const Ge=Le.points[Xe];if(!N(Ge.y))continue;const He=he.bandScale.of(Ge.x);if(Number.isNaN(He))continue;const qe=Ge.y,Je=he.pointColour&&he.pointColour(Ge,Re)||Re,St=Ie?Ie.take(Xe,qe):[_e,qe],xt=bt($e,$e.of(St[0])),Ot=bt($e,$e.of(St[1])),Nt=C(He+De.offset+De.width/2);K(he.pool.next("line",`${e}__lollipop-stem ${e}__mark`,`${Le.key}:${q(Ge.x)}`),{x1:C(xt),y1:Nt,x2:C(Ot),y2:Nt,stroke:Je,"stroke-width":2,"data-series":he.index,"data-point":Xe}),K(he.pool.next("circle",`${e}__lollipop-dot ${e}__mark`,`${Le.key}:${q(Ge.x)}`),{cx:C(Ot),cy:Nt,r:4,fill:Je,"data-series":he.index,"data-point":Xe}),Ge.px=C(Ot),Ge.py=Nt,Ge.pbase=C(xt)}}function Yt(he){const Le=he.group.ownerDocument;let $e=null;for(const Ie of he.group.childNodes||[])if(Ie&&String(Ie.getAttribute&&Ie.getAttribute("class"))===`${e}__fits`){$e=Ie;break}$e||($e=Le.createElementNS(z,"g"),$e.setAttribute("class",`${e}__fits`),he.group.appendChild($e));const _e=new L($e),Re=[];for(const Ie of he.series){let De=0,Xe=0,Ge=0;for(const Zt of Ie.points){const Xt=Number(Zt.x),It=Number(Zt.y);!Number.isFinite(Xt)||!Number.isFinite(It)||(De++,Xe+=Xt,Ge+=It)}if(De<2)continue;const He=Xe/De,qe=Ge/De;let Je=0,St=0,xt=0,Ot=1/0,Nt=-1/0;for(const Zt of Ie.points){const Xt=Number(Zt.x),It=Number(Zt.y);if(!Number.isFinite(Xt)||!Number.isFinite(It))continue;const qt=Xt-He,rn=It-qe;Je+=qt*qt,St+=qt*rn,xt+=rn*rn,Xt<Ot&&(Ot=Xt),Xt>Nt&&(Nt=Xt)}if(Je===0)continue;const $t=St/Je,Ft=qe-$t*He,Bt=xt===0?1:Math.max(0,Math.min(1,St*St/(Je*xt))),tn=he.scheme.series(Ie.index);if(K(_e.next("path",`${e}__fit`),{d:ge(["M",C(he.xScale.of(Ot)),C(he.yScale.of(Ft+$t*Ot)),"L",C(he.xScale.of(Nt)),C(he.yScale.of(Ft+$t*Nt))]),fill:"none",stroke:tn,"data-series":Ie.index}),he.showR2){const Zt=_e.next("text",`${e}__fit-label`);s(Zt,he.size),K(Zt,{x:C(he.xScale.of(Nt)),y:C(he.yScale.of(Ft+$t*Nt))-4,"text-anchor":"end",fill:tn}),ee(Zt,he.grid.messages.t("chart.r2",{value:A(he.grid,Bt)}))}Re.push({key:Ie.key,slope:$t,intercept:Ft,r2:Bt,n:De})}return _e.finish(),Re}function xn(he){const Le=he.group.ownerDocument;let $e=null;for(const He of he.group.childNodes||[])if(He&&String(He.getAttribute&&He.getAttribute("class"))===`${e}__band`){$e=He;break}$e||($e=Le.createElementNS(z,"g"),$e.setAttribute("class",`${e}__band`),he.group.firstChild?he.group.insertBefore($e,he.group.firstChild):he.group.appendChild($e));const _e=new L($e),Re=he.band&&Array.isArray(he.band.points)?he.band.points:[],Ie=Number.isFinite(he.index)?Number(he.index):0,De=he.scheme.series(Ie),Xe=Number.isFinite(he.opacity)?Number(he.opacity):.15,Ge=[];for(const He of Re){const qe=Number(He.x),Je=Number(He.lower),St=Number(He.upper);if(!Number.isFinite(qe)||!Number.isFinite(Je)||!Number.isFinite(St))continue;const xt=Number(He.yhat);Ge.push({x:C(he.xScale.of(qe)),lower:C(he.yScale.of(Je)),upper:C(he.yScale.of(St)),yhat:Number.isFinite(xt)?C(he.yScale.of(xt)):null})}if(Ge.length>=2&&(K(_e.next("path",`${e}__band-fill`),{d:re(Ge),fill:De,"fill-opacity":Xe,stroke:"none","data-series":Ie}),he.line!==!1)){const He=[];let qe=!1;for(const Je of Ge){if(Je.yhat===null){qe=!1;continue}He.push(qe?"L":"M",Je.x,Je.yhat),qe=!0}K(_e.next("path",`${e}__band-line`),{d:He.length?ge(He):"",fill:"none",stroke:De,"data-series":Ie})}return _e.finish(),{points:Ge.length,confidence:he.band&&Number.isFinite(he.band.confidence)?Number(he.band.confidence):null}}function pn(he){const Le=he.group.ownerDocument;let $e=null;for(const Ge of he.group.childNodes||[])if(Ge&&String(Ge.getAttribute&&Ge.getAttribute("class"))===`${e}__whiskers`){$e=Ge;break}$e||($e=Le.createElementNS(z,"g"),$e.setAttribute("class",`${e}__whiskers`),he.group.appendChild($e));const _e=new L($e),Re=Number.isFinite(he.cap)?Number(he.cap):4,Ie=he.colour||"currentColor",De=he.orient!=="v";let Xe=0;for(const Ge of he.points||[]){const He=Number(Ge.main),qe=Number(Ge.lo),Je=Number(Ge.hi);if(!Number.isFinite(He)||!Number.isFinite(qe)||!Number.isFinite(Je))continue;const St=De?["M",qe,He,"L",Je,He,"M",qe,He-Re,"L",qe,He+Re,"M",Je,He-Re,"L",Je,He+Re]:["M",He,qe,"L",He,Je,"M",He-Re,qe,"L",He+Re,qe,"M",He-Re,Je,"L",He+Re,Je];K(_e.next("path",`${e}__whisker`),{d:ge(St),stroke:Ie,fill:"none"}),Xe++}return _e.finish(),Xe}function an(he){const Le=he.scheme||H(),$e=he.typography||{small:he.fontSize||11,axisTitle:11},{bound:_e}=he,Re=wn(he.plot,$e.small),Ie=_e.series[0]&&_e.series[0].points||[],De=Ie.map(xt=>xt.label),Xe=Le.series(0),Ge=f(De,[Re.top,Re.bottom],.4),He=[0];for(const xt of Ie)for(const Ot of[xt.x,xt.lower,xt.upper])Number.isFinite(Ot)&&He.push(Ot);const qe=k(_(He,{zero:!1}),[Re.left,Re.right]);pn({group:he.groups.overlay,orient:"h",colour:Xe,points:Ie.map(xt=>({main:C(Ge.centre(xt.label)),lo:C(qe.of(xt.lower)),hi:C(qe.of(xt.upper))}))});const Je=new L(he.groups.marks);let St=0;for(const xt of Ie)Number.isFinite(xt.x)&&(K(Je.next("circle",`${e}__point ${e}__mark`),{cx:C(qe.of(xt.x)),cy:C(Ge.centre(xt.label)),r:Se,fill:Xe}),St++);return Je.finish(),on({group:he.groups.rules,plot:Re,scale:qe,lines:[{value:0}]}),se({group:he.groups.axis,plot:Re,scale:qe,format:G(he.grid,{kind:"linear",step:(qe.domain.max-qe.domain.min)/5}),config:{},grid:he.grid,size:$e.small}),ke({group:he.groups.labels,plot:Re,scale:Ge,labels:De,fontSize:$e.small,config:{}}),{series:[],marks:St}}function wn(he,Le){const $e=6+Le*1.3+2,_e=he&&he.gutter&&Number.isFinite(he.gutter.bottom)?he.gutter.bottom:$e,Re=Math.min(Math.max(0,$e-_e),Math.max(0,he.height-10));return Re>0?{...he,height:he.height-Re,bottom:he.bottom-Re,gutter:{...he.gutter,bottom:_e+Re}}:he}function on(he){const Le=new L(fe(he.group,`${e}__reflines`));for(const $e of he.lines||[]){if(!N($e.value))continue;const _e=C(he.scale.of($e.value));if(K(Le.next("path",`${e}__reference`),{d:he.vertical?ge(["M",_e,C(he.plot.top),"L",_e,C(he.plot.bottom)]):ge(["M",C(he.plot.left),_e,"L",C(he.plot.right),_e]),stroke:$e.colour||"currentColor","stroke-dasharray":"4 3",fill:"none"}),!$e.label)continue;const Re=Le.next("text",`${e}__reference-label`);K(Re,he.vertical?{x:_e+4,y:C(he.plot.top+10),"text-anchor":"start"}:{x:C(he.plot.right-4),y:_e-4,"text-anchor":"end"}),ee(Re,$e.label)}Le.finish()}function Yn(he){const{series:Le,xScale:$e,yScale:_e,colour:Re}=he,Ie=he.size||null;for(let De=0;De<Le.points.length;De++){const Xe=Le.points[De];if(!N(Xe.y))continue;const Ge=C(yt($e,Xe));if(Number.isNaN(Ge))continue;const He=C(_e.of(Xe.y)),qe=Ie&&N(Xe.size)?C(Ie.of(Xe.size)):Se,Je=he.pointColour&&he.pointColour(Xe,Re)||Re;At(he,Xe,De,Ge,He,qe*2,Je)||K(he.pool.next("circle",`${e}__point ${e}__mark`),{cx:Ge,cy:He,r:qe,fill:Je,"fill-opacity":Ie?.7:1,"data-series":he.index,"data-point":De}),Xe.px=Ge,Xe.py=He}}function At(he,Le,$e,_e,Re,Ie,De){if(!he.marker||!he.markerEnv)return!1;const Xe=Oe(he.marker,Le,he.markerEnv);if(Le.markerHalf=0,!Xe)return!1;const Ge=he.marker.explicitSize?he.marker.size:Math.max(he.marker.size,Ie);return Pe(he.pool,Xe,{x:_e,y:Re,size:Ge,colour:pe(De),attrs:K,round:C,extra:{"data-series":he.index,"data-point":$e}}),Le.markerHalf=Ge/2,!0}function nn(he){const{group:Le,series:$e,xScale:_e,yScale:Re,options:Ie}=he,De=he.grid&&he.grid.statistics,Xe=De&&typeof De.intervalOf=="function"?(Nt,$t)=>De.intervalOf(Nt,$t):null,Ge=new L(fe(Le,`${e}__errorbars`)),He=Number.isFinite(Number(Ie.confidence))?Number(Ie.confidence):.95,qe=4;let Je=0,St=0,xt=0,Ot=0;for(const Nt of $e)for(const $t of Nt.points){if($t.y===null||$t.y===void 0)continue;St++;const Ft=Array.isArray($t.values)&&$t.values.length===1;Ft&&xt++;let Bt=null,tn=null;if(Ie.of!==void 0&&Number.isFinite(Number($t[Ie.of]))){const qt=Math.abs(Number($t[Ie.of]));Bt=$t.y-qt,tn=$t.y+qt}else if(Array.isArray($t.values)&&$t.values.length>1&&Xe){const qt=Xe($t.values,He);qt&&(Bt=qt.lower,tn=qt.upper)}if(Bt===null||!Number.isFinite(Bt)||!Number.isFinite(tn)){Ft&&Ot++;continue}const Zt=C(_e.of($t.xKey!==void 0?$t.xKey:$t.x)+(_e.bandwidth?_e.bandwidth/2:0)),Xt=C(Re.of(tn)),It=C(Re.of(Bt));K(Ge.next("path",`${e}__error-bar ${e}__mark`),{d:ge(["M",Zt-qe,Xt,"L",Zt+qe,Xt,"M",Zt,Xt,"L",Zt,It,"M",Zt-qe,It,"L",Zt+qe,It]),fill:"none",stroke:"currentColor","data-lower":Bt,"data-upper":tn}),Je++}return Ge.finish(),{drawn:Je,marks:St,single:xt,singleSkipped:Ot}}function fn(he){const Le=he.scheme||H(),$e=he.axis||{x:{},y:{},y2:{}},_e=he.typography||{small:he.fontSize||11,axisTitle:11},{bound:Re,plot:Ie,type:De}=he,Xe=ye[De]||ye.line,Ge=Re.series.filter(vt=>!he.hidden.has(vt.key)),He=!!Xe.horizontal,qe=he.mark==="lollipop"&&(De==="bar"||De==="horizontalBar"),Je=!He&&$e.y.position==="right"?"right":"left",St=Je==="right"?"left":"right",xt=(De==="bar"||De==="horizontalBar")&&he.byRuleColour&&Ge.length===1&&Re.measure&&Re.measure.col||null,Ot=xt?new Set:null,Nt=xt?vt=>{const Rt=o({grid:he.grid,col:xt,value:vt.y});return Rt&&Ot.add(Rt),Rt}:null,Ft=(De==="bar"||De==="horizontalBar")&&he.byRuleColour&&Ge.length===1&&Le.nameMap?vt=>Le.series(0,vt.label):null,Bt=he.fill?xe(he,Le):null,tn=Bt||Nt||Ft?(vt,Rt)=>Bt&&Bt(vt,Rt)||Nt&&Nt(vt)||Ft&&Ft(vt)||null:null,Zt=te(he.marker),Xt=Zt?{grid:he.grid,doc:he.doc,redraw:he.redraw}:null,It=!He&&De!=="waterfall"?Ge.filter(vt=>vt.axis==="right"):[],qt=It.length?Ge.filter(vt=>vt.axis!=="right"):Ge,rn=It.length>0,rr=(De==="bar"||De==="area"||De==="horizontalBar")&&!rn,$n=he.stack==="percent"&&rr&&qt.length>1,vn=($n||!!he.stack)&&qt.length>1&&rr,br=De==="waterfall"?Ne(Ge[0]):y(qt,vn,$n),On=Re.yDomain||he.domain||_(br,{zero:Xe.zero,min:$e.y.min,max:$e.y.max}),yn=He?k(On,[Ie.left,Ie.right]):k(On,[Ie.bottom,Ie.top]),Wt=He?f(Re.categories,[Ie.top,Ie.bottom],.2):ft(Re,Ie,De,$e.x),Tn=On.min<=0&&On.max>=0?0:On.min,wr=It.some(vt=>(vt.mark||(De==="bar"?"bar":De))==="bar"),Nn=rn?_(y(It,!1,!1),{zero:wr,min:$e.y2.min,max:$e.y2.max}):null,kn=Nn?k(Nn,[Ie.bottom,Ie.top]):null,bn=G(he.grid,{kind:"linear",step:(On.max-On.min)/5}),Zn=$n?{tick:vt=>`${bn.tick(vt)}%`,value:vt=>`${bn.value(vt)}%`}:bn,Gn=he.axes!==!1;if(Gn&&ie({gridGroup:he.groups.grid,axisGroup:he.groups.axis,plot:Ie,scale:yn,format:Zn,horizontal:He,side:Je,config:$e.y,grid:he.grid,size:_e.small}),Gn)if(He)ke({group:he.groups.overlay,plot:Ie,scale:Wt,labels:Re.labels,fontSize:_e.small,config:$e.x});else if(Wt.kind==="band")we({group:he.groups.overlay,plot:Ie,scale:Wt,labels:Re.labels,fontSize:_e.small,rotated:T(Re.labels,Wt.step,_e.small,$e.x.every),config:$e.x});else{const vt=Re.dimension&&Re.dimension.col?he.grid.columns.get(Re.dimension.col):void 0;se({group:he.groups.overlay,plot:Ie,scale:Wt,format:G(he.grid,{kind:Re.kind,span:Wt.domain.max-Wt.domain.min,step:(Wt.domain.max-Wt.domain.min)/5},vt),config:$e.x,grid:he.grid,column:vt,size:_e.small})}if(Gn&&(ae({group:he.groups.rules,plot:Ie,side:Je}),$({group:he.groups.axis,plot:Ie,text:$e.y.title,side:He?"bottom":Je,size:_e.axisTitle}),$({group:he.groups.axis,plot:Ie,text:$e.x.title,side:He?"left":"bottom",size:_e.axisTitle})),Gn&&kn){B({group:he.groups.axis,plot:Ie,scale:kn,colour:Le.series(It[0].index),side:St,format:G(he.grid,{kind:"linear",step:(Nn.max-Nn.min)/5})});const vt=$e.y2.title||(It.length===1?It[0].label:"");$({group:he.groups.axis,plot:Ie,text:vt,side:St,size:_e.axisTitle}),!$e.y.title&&qt.length===1&&qt[0].label&&$({group:he.groups.axis,plot:Ie,text:qt[0].label,side:Je,size:_e.axisTitle})}const Jn=Number.isFinite(he.downsampleTo)?Number(he.downsampleTo):Math.max(2,Math.round(Ie.width));let or=!1;if(Xe.marks==="path"||De==="scatter"||De==="bubble"){for(const vt of Ge)if(vt.kept=null,vt.points.length>Jn*1.5){const Rt=vt.points.map((ln,hn)=>({x:hn,y:ln.y,point:ln})),sn=O(Rt,Jn);vt.points=sn.map(ln=>ln.point),vt.kept=sn.map(ln=>ln.x),or=!0}}he.pool||D(he.groups,Ie,Z(De));const Mn=he.pool||new L(he.groups.marks),Kn=$n?Re.categories.map((vt,Rt)=>Ge.reduce((sn,ln)=>{const hn=ln.points[Rt]?ln.points[Rt].y:null;return N(hn)?sn+Math.abs(hn):sn},0)):null,En=vn?P(Re.categories.length,Kn):null,Xn=rn?Ge.filter(vt=>(vt.mark||(De==="bar"?"bar":De))==="bar"):Ge,sr=rn?Math.max(1,Xn.length):Math.max(1,Ge.length),ir=De==="bar"||rn&&Xn.length>0,Un=Wt.kind==="band"?Wt.bandwidth:ir?ut({bound:Re,scale:Wt,config:$e.x,padding:kt("bar")}):0,Hn=vn?Un:Un/sr,Cn=new Map;for(const vt of Xn)Cn.set(vt.key,Cn.size);const ar=[],Wn=De==="rangeArea"&&Re.series.length>=2?Re.series[0]:null,Qn=Wn?Re.series[1]:null;for(let vt=0;vt<Ge.length;vt++){const Rt=Ge[vt],sn=Le.series(Rt.index,Rt.label),ln=Rt.axis==="right"&&kn?kn:yn,hn=rn?Rt.mark||(De==="bar"?"bar":De):De,xr=rn&&Cn.has(Rt.key)?Cn.get(Rt.key):vt;if(De==="horizontalBar")(qe?zt:Mt)({pool:Mn,series:Rt,bandScale:Wt,valueScale:yn,baseline:Tn,colour:sn,stack:En,index:Rt.index,slot:{offset:vn?0:vt*Hn,width:Hn,span:Un},pointColour:tn});else if(De==="waterfall")en({pool:Mn,series:Rt,xScale:Wt,yScale:yn,index:Rt.index,positive:Le.positive,negative:Le.negative});else if(hn==="bar")(qe?Lt:Jt)({pool:Mn,series:Rt,xScale:Wt,yScale:ln,baseline:ln===kn?Nn.min<=0&&Nn.max>=0?0:Nn.min:Tn,colour:sn,stack:En,index:Rt.index,slot:{offset:vn?0:xr*Hn,width:Hn,span:Un},pointColour:tn});else if(De==="scatter"||De==="bubble")Yn({pool:Mn,series:Rt,xScale:Wt,yScale:ln,colour:sn,index:Rt.index,size:De==="bubble"?he.sizes:null,pointColour:tn,marker:Zt,markerEnv:Xt});else{const cr=Ct(he,Rt.label),vr=hn==="step"?{type:"step",tension:1,mode:"after"}:j(he.curve,Rt.label),ur={pool:Mn,series:Rt,xScale:Wt,yScale:ln,baseline:Tn,fill:Wn?Rt===Qn:hn==="area"||hn==="rangeArea",lower:Wn&&Rt===Qn?Wn:null,curve:vr,colour:sn,stack:En,index:Rt.index,style:cr,marker:Zt,markerEnv:Xt};cr.emphasized?ar.push(ur):ot(ur)}}for(const vt of ar)ot(vt);he.pool||Mn.finish(),he.band&&typeof Wt.invert=="function"&&xn({group:he.groups.overlay,band:he.band,xScale:Wt,yScale:yn,scheme:Le,index:0,line:he.band.line!==!1&&!he.fit}),he.fit&&(De==="scatter"||De==="bubble")&&typeof Wt.invert=="function"&&Yt({group:he.groups.overlay,series:Ge,xScale:Wt,yScale:yn,plot:Ie,scheme:Le,grid:he.grid,size:_e.small,showR2:he.fit!=="line"});let Ln=null;he.trend&&(Ln=x({group:he.groups.overlay,series:Ge,xScale:Wt,yScale:yn,rightScale:kn,plot:Ie,scheme:Le,trend:he.trend,grid:he.grid,format:vt=>Zn.tick(vt),size:_e.small,clip:he.groups.boxClipId}));let lr=null;if(he.error&&(lr=nn({group:he.groups.overlay,series:Ge,xScale:Wt,yScale:yn,grid:he.grid,options:he.error===!0?{}:he.error})),he.labels&&he.labels.show&&g({group:he.groups.labels,series:Ge,plot:Ie,options:he.labels,grid:he.grid,size:_e.small,horizontal:He}),he.reference&&he.reference.length){const vt=He?he.reference:he.reference.filter(sn=>!(sn.axis==="right"||sn.axis==="y2")),Rt=kn?he.reference.filter(sn=>sn.axis==="right"||sn.axis==="y2"):[];vt.length&&on({group:he.groups.overlay,plot:Ie,scale:yn,lines:vt,vertical:He}),Rt.length&&on({group:he.groups.overlay,plot:Ie,scale:kn,lines:Rt})}let _n=null;he.annotations&&he.annotations.length&&(_n=V({group:he.groups.overlay,plot:Ie,xScale:Wt,yScale:yn,rightScale:kn,series:Ge,annotations:he.annotations,dual:rn,horizontal:He,format:vt=>Zn.tick(vt),size:_e.small}));const kr=Array.isArray(Ln)&&Ln.length?[..._n||[],...Ln]:_n;return{xScale:Wt,yScale:yn,rightScale:kn,dual:rn,series:Ge,horizontal:He,percent:$n,percentTotals:$n?Kn:null,plot:Ie,errorBars:lr,annotations:kr,trendlines:Ln,reduced:or,legend:xt?l({grid:he.grid,col:xt,colours:Ot}):null}}const Bn=32;function _r(he){const{series:Le,xScale:$e,at:_e}=he,Re=Number.isFinite(he.tolerance)?Number(he.tolerance):Bn,Ie=[];let De=-1,Xe=1/0;for(const Ge of Le){let He=null,qe=-1,Je=1/0;const St=Ge.points||[];for(let xt=0;xt<St.length;xt++){const Ot=St[xt];if(!Ot||!N(Ot.y))continue;const Nt=yt($e,Ot);if(Number.isNaN(Nt))continue;const $t=Math.abs(Nt-_e);$t>=Je||(Je=$t,He=Ot,qe=Array.isArray(Ge.kept)?Ge.kept[xt]:xt)}!He||Je>Re||(Ie.push({series:Ge,point:He}),Je<Xe&&(Xe=Je,De=qe))}return De<0?null:{index:De,entries:Ie}}function yr(he){const{bound:Le,xScale:$e,at:_e}=he;if(!Le.categories.length)return-1;if($e.kind==="band"){const De=Math.floor((_e-$e.range[0])/($e.step||1));return De>=0&&De<Le.categories.length?De:-1}let Re=-1,Ie=1/0;for(let De=0;De<Le.categories.length;De++){const Xe=$e.kind==="time"?E(Le.categories[De]):v(Le.categories[De]);if(Xe===null)continue;const Ge=Math.abs($e.of(Xe)-_e);Ge<Ie&&(Ie=Ge,Re=De)}return Re}function nr(he,Le){return Le<0||Le>=he.categories.length?"":q(he.categories[Le])}}),tt("packages/modules/charts/drawable.js",function(r,oe){"use strict";Object.defineProperty(r,"REASONS",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"DRAWABLE",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(r,"namedColumns",{enumerable:!0,get:function(){return le}}),Object.defineProperty(r,"missingColumns",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"bucketKey",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"bucketMessage",{enumerable:!0,get:function(){return L}}),Object.defineProperty(r,"continuousX",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"drawability",{enumerable:!0,get:function(){return W}});const Ae=oe("packages/modules/charts/scale.js"),ae=Ae.extent,$=Ae.toNumber,ke=Ae.toTime,se=oe("packages/modules/charts/cartesian.js").staleWindow,ie=Object.freeze({EMPTY:"empty",INCOMPLETE:"incomplete",STALE:"stale",MISSING_COLUMN:"missing-column",NO_DOMAIN:"no-domain",BUCKETED:"bucketed",TOO_MANY_SETS:"too-many-sets"}),Z=Object.freeze({ok:!0});function le(G){if(!G||typeof G!="object")return[];const A=[],p=(f,w)=>{typeof w=="string"&&w?A.push({key:f,col:w}):w&&typeof w=="object"&&typeof w.col=="string"&&w.col&&A.push({key:f,col:w.col})};if(Array.isArray(G.points))return[];if(p("x",G.x),p("code",G.code),p("y",G.y),p("series",G.series),p("size",G.size),p("source",G.source),p("target",G.target),p("text",G.text),p("time",G.time),p("entity",G.entity),p("colour",G.colour),p("set",G.set),Array.isArray(G.sets))for(const f of G.sets)p("sets",f);if(typeof G.multiples=="string"&&p("multiples",G.multiples),Array.isArray(G.measures))for(const f of G.measures)p("measures",f);return A}function D(G,A){const p=G&&G.columns;return!p||typeof p.get!="function"?[]:le(A).filter(({col:f})=>!p.get(f))}function d(G){return`chart:x:date-bucket:${G}`}function L(G,A,p){return`chart x column ${JSON.stringify(G)} is a 'date', which stores a calendar day, so all ${A} rows collapsed into one point and were reduced by '${p}'. For a series inside a single day, type the column 'datetime' or bind epoch milliseconds.`}function T(G,A){return!A||A.kind!=="time"&&A.kind!=="linear"?!1:G!=="bar"&&G!=="horizontalBar"}function W(G){const{grid:A,spec:p,type:f,bound:w}=G,N=G.id===void 0?"":String(G.id),q=Number.isFinite(G.now)?Number(G.now):Date.now(),k=(v,E,m,y=!0)=>({ok:!1,reason:v,key:m||`chart:${N}:${v}`,message:E,tell:y}),_=D(A,p);if(_.length){const v=_.map(m=>`${m.key}: ${JSON.stringify(m.col)}`).join(", "),E=A&&A.columns&&typeof A.columns.all=="function"?A.columns.all().map(m=>m.id||m.field).filter(Boolean):[];return k(ie.MISSING_COLUMN,`chart ${v} ${_.length>1?"name columns":"names a column"} this grid does not have, so there is nothing to read and nothing to draw.${E.length?` The columns it does have: ${E.slice(0,12).map(m=>JSON.stringify(m)).join(", ")}${E.length>12?", …":""}.`:""} Bind a column the grid declares, or declare the column.`)}if(w&&w.empty){const v=A&&A.rows&&typeof A.rows.count=="function"?A.rows.count():0;return k(ie.EMPTY,v?`chart bound nothing from the ${v} row(s) the grid is showing, so it shows its empty state. The binding named no series to draw: check that the spec names the columns this chart needs — a flow type needs source and target, a measure needs a column with values in it.`:"chart has no rows to draw, so it shows its empty state.",void 0,v>0)}if(f==="venn"&&w&&w.tooMany)return k(ie.TOO_MANY_SETS,`a venn chart draws two or three sets and was given ${w.tooMany.count} (${w.tooMany.names.slice(0,8).map(v=>JSON.stringify(v)).join(", ")}${w.tooMany.count>8?", …":""}). Four or more sets cannot each have a region of their own as circles. Name two or three in "sets" (or "members" for a set column), or use an UpSet-style chart instead: a bar chart of how many rows hold each combination of memberships — group the grid by the membership columns and chart the row count.`);if(f==="venn"&&w&&w.tooFew)return k(ie.INCOMPLETE,`a venn chart needs two or three sets and was given ${w.tooFew.count}. Name the membership columns in "sets" (boolean columns), or a multi-value column in "set" with the "members" to compare.`);if((f==="candlestick"||f==="ohlc")&&(!w||!w.series||w.series.length<4)){const v=w&&w.series?w.series.length:0;return k(ie.INCOMPLETE,`a ${f} chart needs four measures — open, high, low and close, in that order — and ${v===0?"none was":`only ${v} were`} bound. Pass them as measures: [open, high, low, close].`)}const c=se(w,G.axis&&G.axis.x,f,q);if(c){const v=c.newest===null?"and every one of them is stamped ahead of it":`and the newest of ${c.points} x value(s) is ${Math.round(c.age/1e3)}s old`;return k(ie.STALE,`the rolling x window covers the last ${c.span} ms, ${v}, so every mark would be drawn outside the plot. The chart shows its empty state instead. Seed it with data inside the window, widen axis.x.window.span, or drop the window while showing history.`,`chart:${N}:x:window:stale:${p&&p.x||""}`,c.newest!==null)}if(T(f,w)){const v=Array.isArray(w.categories)?w.categories:[],E=w.kind==="time"?v.map(ke):v.map($);if(v.length&&!ae(E)){const m=p&&typeof p.x=="string"&&p.x||w.dimension&&w.dimension.col||"";return k(ie.NO_DOMAIN,`chart x ${m?`column ${JSON.stringify(m)} `:""}is drawn on a ${w.kind==="time"?"time":"continuous"} axis, and not one of its ${v.length} value(s) reads as a ${w.kind==="time"?"date":"number"} — so the axis would be drawn over a domain invented from nothing rather than measured from the data. Remove axis.x.scale to let the column choose its own scale, or type the column so its values parse.`)}}if(w&&w.bucketed&&T(f,w)){const{col:v,rows:E,fn:m}=w.bucketed;return k(ie.BUCKETED,L(v,E,m),d(v))}return Z}}),tt("packages/modules/charts/bind.js",function(r,oe){"use strict";Object.defineProperty(r,"AGGREGATIONS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"DEFAULT_AGGREGATION",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"resolveAggregation",{enumerable:!0,get:function(){return L}}),Object.defineProperty(r,"defaultAggregationFor",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"measureOf",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"walkRows",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"leafRows",{enumerable:!0,get:function(){return A}}),Object.defineProperty(r,"selectedRows",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"topGroups",{enumerable:!0,get:function(){return f}}),Object.defineProperty(r,"forcedScaleKind",{enumerable:!0,get:function(){return v}}),Object.defineProperty(r,"scaleKindFor",{enumerable:!0,get:function(){return m}}),Object.defineProperty(r,"bindSeries",{enumerable:!0,get:function(){return y}}),Object.defineProperty(r,"bindPoints",{enumerable:!0,get:function(){return P}}),Object.defineProperty(r,"bindMeasures",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(r,"bindLinks",{enumerable:!0,get:function(){return K}}),Object.defineProperty(r,"bindHierarchy",{enumerable:!0,get:function(){return ge}});const Ae=oe("packages/modules/charts/scale.js"),ae=Ae.key,$=Ae.toNumber,ke=Ae.toTime,we=oe("packages/modules/charts/drawable.js"),se=we.bucketKey,ie=we.bucketMessage,le=oe("packages/core/src/internal/util.js").warnOnce,D={sum:n=>n.length?n.reduce((e,i)=>e+i,0):null,avg:n=>n.length?n.reduce((e,i)=>e+i,0)/n.length:null,mean:n=>n.length?n.reduce((e,i)=>e+i,0)/n.length:null,min:n=>{let e=null;for(let i=0;i<n.length;i++)(e===null||n[i]<e)&&(e=n[i]);return e},max:n=>{let e=null;for(let i=0;i<n.length;i++)(e===null||n[i]>e)&&(e=n[i]);return e},median:n=>{if(!n.length)return null;const e=n.slice().sort((O,ne)=>O-ne),i=(e.length-1)/2,g=Math.floor(i),b=Math.ceil(i);return g===b?e[g]:(e[g]+e[b])/2},count:(n,e)=>e,countValues:n=>n.length,first:n=>n.length?n[0]:null,last:n=>n.length?n[n.length-1]:null},d="sum";function L(n){return n==null?d:typeof n=="string"&&n in D?n:(le(`chart:measure:fn:${String(n)}`,`chart measure fn ${JSON.stringify(n)} is not a known aggregation; using '${d}'. Supported: ${Object.keys(D).join(", ")}.`),d)}function T(n){if(!n)return d;const e=n.groupTotal??n.total;if(typeof e=="string"&&e in D)return e;const i=n.dataType&&n.dataType.totals?n.dataType.totals.supported:null;if(Array.isArray(i)&&!i.includes(d)){const g=["avg","mean","max","min","countValues","count"].find(b=>i.includes(b)&&b in D);if(g)return g}return d}function W(n,e){const i=T(e);return n?typeof n=="string"?{col:n,fn:i}:{col:n.col||null,fn:n.fn==null?i:L(n.fn)}:{col:null,fn:i}}function G(n,e){const i=new Set,g=b=>{if(!b||i.has(b)||(i.add(b),e(b),!b.group)||b.expanded)return;const O=b.filteredChildren||b.children;if(Array.isArray(O))for(const ne of O)g(ne)};n.rows.forEach(g)}function A(n){const e=[];return G(n,i=>{!i.group&&i.data!==null&&i.data!==void 0&&e.push(i)}),e}function p(n){const e=new Set(n.selection.keys());if(!e.size)return[];const i=[];return G(n,g=>{!g.group&&e.has(g.key)&&i.push(g)}),i}function f(n){const e=[];let i=1/0;return G(n,g=>{g.group&&(g.level<i&&(i=g.level,e.length=0),g.level===i&&e.push(g))}),e}function w(n,e,i){return e.group&&e.totals&&i in e.totals?$(e.totals[i]):$(n.rows.value(e.key,i))}function N(n,e,i,g){if(!e.group){const b=n.rows.text(e.key,i);if(b)return b}return g==null?"":g instanceof Date?g.toISOString().slice(0,10):String(g)}function q(n,e){return(D[e]||D[d])(n.values,n.rows)}const k=Object.freeze(["number","currency","percent"]),_=Object.freeze(["date","datetime","timestamp","dateString"]),c=Object.freeze({auto:"",band:"category",category:"category",linear:"linear",time:"time"});function v(n){const e=n&&typeof n=="object"?n.axis:null;if(!e||typeof e!="object")return"";const i=e.x;if(!i||typeof i!="object")return"";const g=typeof i.scale=="string"?i.scale:"";return g?Object.hasOwn(c,g)?c[g]:(le(`chart:x:scale:unknown:${g}`,`chart axis.x.scale ${JSON.stringify(g)} is not a scale this chart draws. Use one of: ${Object.keys(c).join(", ")}. The scale was chosen from the column instead.`),""):""}function E(n){if(n.length<3)return"";let e=0,i=0;for(const g of n){if(g==null||g===""||typeof g=="boolean")return"";$(g)!==null?e++:typeof g=="string"&&ke(g)!==null&&i++}return i===n.length?"time":e===n.length?"linear":""}function m(n,e,i={}){if(i.forced)return i.forced;const g=n&&typeof n.type=="string"?n.type:"";if(_.includes(g)||e.length&&e.every(ne=>ne instanceof Date))return"time";if(k.includes(g))return"linear";const b=i.id?String(i.id):"";if(!b)return"category";const O=g&&g!=="text"?"":E(e);return O&&le(`chart:x:banded:${b}`,`chart x column ${JSON.stringify(b)} is typed ${JSON.stringify(g||"text")}, so its ${e.length} values are drawn as categories on a band scale even though they all read as ${O==="time"?"dates":"numbers"}. Type the column ${O==="time"?"'date' (or 'datetime'/'timestamp'/'dateString')":"'number'"} for a continuous axis, or pin it with axis: { x: { scale: '${O}' } }.`),"category"}function y(n,e){const i=e.x||null,g=e.series||(typeof e.multiples=="string"?e.multiples:null)||null,b=n.columns,O=i?b.get(i):void 0,ne=W(e.y),H=ne.col?b.get(ne.col):void 0,F=W(e.y,H);let s;const M=typeof e.rows=="function"?e.rows(n):e.rows;let B=!1;if(Array.isArray(M)){const U=M.filter(J=>J&&typeof J=="object"&&(typeof J.key=="string"||typeof J.key=="number")&&n.rows.byKey(J.key)!==void 0);U.length<M.length&&(le("chart:rows:not-grid-rows",`chart "rows" takes rows the grid holds (from grid.rows.get(i) or grid.rows.byKey(key)); ${M.length-U.length} of ${M.length} given are not and were left out. To chart other data, put it in a grid and chart that grid.`),B=U.length===0),s=U}else e.from==="groups"?s=f(n):e.from==="selection"?s=p(n):s=A(n);const I=s.length||B?s:A(n),V=new Map,fe=new Map,a=[];for(let U=0;U<I.length;U++){const J=I[U],X=i?J.group&&J.groupColumn===i?J.groupValue:n.rows.value(J.key,i):U,de=ae(X);V.has(de)||(V.set(de,{value:X,label:i?N(n,J,i,X):String(U),order:V.size}),a.push(X));const pe=g?J.group&&J.groupColumn===g?J.groupValue:n.rows.value(J.key,g):null,xe=g?ae(pe):"";fe.has(xe)||fe.set(xe,{label:g?N(n,J,g,pe):H?.title||"",points:new Map});const ve=fe.get(xe);let Oe=ve.points.get(de);Oe||(Oe={values:[],rows:0,rowKey:J.key},ve.points.set(de,Oe)),Oe.rows+=J.group&&J.leafCount||1,(e.editable||e.selection)&&(Oe.keys||(Oe.keys=[])).push(J.key);const Pe=F.col?w(n,J,F.col):null;if(Pe!==null&&Oe.values.push(Pe),e.size){const te=$(n.rows.value(J.key,e.size));te!==null&&(Oe.sizes=(Oe.sizes||0)+te)}}const x=[...V.values()].sort((U,J)=>U.order-J.order),R=typeof e.limit=="number"&&e.limit>0?x.slice(0,e.limit):x,o=m(O,a,{forced:v(e),id:i});let l=null;o==="time"&&I.length>1&&V.size===1&&O&&(O.type==="date"||O.type==="dateString")&&(l={col:String(i),rows:I.length,fn:F.fn},le(se(l.col),ie(l.col,l.rows,l.fn)));const h=k.includes(O&&typeof O.type=="string"?O.type:"")?[...R].sort((U,J)=>($(U.value)??0)-($(J.value)??0)):o==="time"?[...R].sort((U,J)=>(ke(U.value)??1/0)-(ke(J.value)??1/0)||0):R,j=[...fe.entries()].map(([U,J],X)=>({key:U,label:J.label,index:X,points:h.map(de=>{const pe=ae(de.value),xe=J.points.get(pe);return{x:de.value,xKey:pe,label:de.label,y:xe?q(xe,F.fn):null,size:xe&&xe.sizes!==void 0?xe.sizes:null,rows:xe?xe.rows:0,rowKey:xe?xe.rowKey:null,...(e.editable||e.selection)&&xe&&xe.keys?{rowKeys:xe.keys}:{},values:xe&&xe.values?xe.values:null}})}));return{series:j,categories:h.map(U=>U.value),labels:h.map(U=>U.label),kind:o,measure:{...F,title:H?.title||F.col||""},dimension:{col:i,title:O?.title||i||""},empty:j.length===0||h.length===0,rows:I.length,truncated:x.length-h.length,bucketed:l}}function P(n){const e=Array.isArray(n.points)?n.points:[],i=e.length>0&&e.every(O=>typeof O.x=="number"&&Number.isFinite(O.x)),g=O=>typeof O=="number"&&Number.isFinite(O)?O:null,b=e.map((O,ne)=>({x:O.x,xKey:ae(O.x),label:O.label!=null?String(O.label):String(O.x),y:g(O.y),size:g(O.size),lower:g(O.lower),upper:g(O.upper),rows:1,rowKey:O.key!=null?String(O.key):String(ne),values:null}));return{series:[{key:n.seriesKey||"",label:n.seriesLabel||"",index:0,points:b}],categories:b.map(O=>O.x),labels:b.map(O=>O.label),kind:i?"linear":"category",measure:{col:null,fn:"sum",title:n.measureTitle||""},dimension:{col:null,title:n.dimensionTitle||""},empty:b.length===0,rows:b.length,truncated:0}}function Q(n,e){const i=Array.isArray(e.measures)?e.measures:[];if(!i.length)return y(n,e);const g=i.map(H=>{const F=typeof H=="string"?{col:H}:H;return{spec:F,result:y(n,{x:e.x,from:e.from,limit:e.limit,axis:e.axis,y:{col:F.col,fn:F.fn}})}}),b=g[0].result,O=new Map(b.categories.map((H,F)=>[ae(H),F])),ne=g.map(({spec:H,result:F},s)=>{const M=n.columns.get(H.col),B=b.categories.map(()=>null),I=F.series[0];if(I)for(const V of I.points){const fe=O.get(V.xKey);fe!==void 0&&(B[fe]=V)}return{key:H.col,label:H.title||H.label||M&&M.title||H.col,index:s,mark:H.type||null,axis:H.axis==="right"?"right":"left",points:b.categories.map((V,fe)=>B[fe]||{x:V,xKey:ae(V),label:b.labels[fe],y:null,rows:0,rowKey:null})}});return{series:ne,categories:b.categories,labels:b.labels,kind:b.kind,measure:{col:null,fn:"sum",title:ne.map(H=>H.label).join(", ")},dimension:b.dimension,empty:!ne.length||!b.categories.length,rows:b.rows,truncated:b.truncated}}function K(n,e,i={}){const g=W(e.y),b=!!i.perRow,O=Array.isArray(i.nodes)?i.nodes:[],ne=e.source||e.x||null,H=e.target||null;if(!ne||!H)return{nodes:[],links:[],measure:{...g,title:""},dimension:{col:null,title:""},series:[],categories:[],labels:[],empty:!0,total:0};const F=g.col?n.columns.get(g.col):void 0,s=new Map,M=new Map,B=(a,x,R)=>{const o=ae(a);return s.has(o)||s.set(o,{key:o,value:a,label:N(n,x,R,a),index:s.size,in:0,out:0}),s.get(o)},I=new Map;for(const a of O)!a||a.id===null||a.id===void 0||I.set(ae(a.id),a);for(const a of A(n)){const x=n.rows.value(a.key,ne),R=n.rows.value(a.key,H);if(x==null||R===null||R===void 0)continue;const o=g.col?$(n.rows.value(a.key,g.col)):1;if(o===null||o<=0)continue;const l=B(x,a,ne),t=B(R,a,H);if(b){const h=l.key>t.key,j=h?t:l,U=h?l:t;M.set(`${j.key}\0${U.key}\0${M.size}`,{source:j,target:U,value:o,undirected:!0,pair:`${j.key}\0${U.key}`,rowKeys:[a.key]})}else{const h=`${l.key}\0${t.key}`,j=M.get(h)||{source:l,target:t,value:0,rowKeys:[]};j.value+=o,j.rowKeys.length<64&&j.rowKeys.push(a.key),M.set(h,j)}l.out+=o,t.in+=o}for(const[a,x]of I)s.has(a)||s.set(a,{key:a,value:x.id,label:String(x.label??x.id),index:s.size,in:0,out:0});for(const[a,x]of I){const R=s.get(a);R&&(R.declared=!0,x.label!==void 0&&x.label!==null&&(R.label=String(x.label)),typeof x.icon=="string"&&x.icon&&(R.icon=x.icon),Number.isFinite(x.x)&&Number.isFinite(x.y)&&(R.fx=Number(x.x),R.fy=Number(x.y)))}const V=b?[...M.values()]:[...M.values()].sort((a,x)=>x.value-a.value),fe=typeof e.limit=="number"&&e.limit>0?V.slice(0,e.limit):V;return{nodes:[...s.values()],links:fe,measure:{...g,title:F?.title||g.col||""},dimension:{col:ne,title:n.columns.get(ne)?.title||ne},series:[],categories:[],labels:[],empty:!fe.length,total:fe.reduce((a,x)=>a+x.value,0)}}function ge(n,e,i={}){if(typeof e.parentId=="string"&&e.parentId)return ee(n,e,i);if(typeof e.path=="string"&&e.path)return z(n,e,i);const g=W(e.y),b=typeof e.depth=="number"&&e.depth>0?e.depth:1/0,O=g.col?n.columns.get(g.col):void 0,ne=e.radius&&typeof e.radius=="object"?e.radius:null,H=ne&&typeof ne.col=="string"?W(ne.col):null,F=H&&H.col?n.columns.get(H.col):void 0,s=(a,x,R)=>({label:a,value:x,depth:R,total:0,radius:0,children:[],rowKey:null,rowKeys:[]}),M=s("",null,0),B=f(n),I=new Map;if(B.length){const a=[];G(n,x=>{if(x.group){for(;a.length&&a[a.length-1].level>=x.level;)a.pop();a.push(x),I.has(x.key)||I.set(x.key,[])}else if(x.data!==null&&x.data!==void 0)for(const R of a)I.get(R.key).push(x.key)})}if(B.length){const a=(x,R,o)=>{const l=x.groupColumn?N(n,x,x.groupColumn,x.groupValue):"",t=s(l,x.groupValue,o);t.rowKey=x.key;const h=g.col?w(n,x,g.col):null;if(t.total=h===null?0:Math.abs(h),H&&H.col){const U=w(n,x,H.col);t.radius=U===null?0:Math.abs(U)}R.children.push(t);const j=x.filteredChildren||x.children;if(t.rowKeys=[...I.get(x.key)||[]],o<b&&Array.isArray(j))for(const U of j)U.group&&a(U,t,o+1);return!g.col&&i.count&&(t.total=t.rowKeys.length),!t.total&&t.children.length&&(t.total=t.children.reduce((U,J)=>U+J.total,0)),!t.radius&&H&&t.children.length&&(t.radius=t.children.reduce((U,J)=>U+J.radius,0)),t};for(const x of B)a(x,M,1)}else{const x=y(n,{x:e.x,y:e.y,limit:e.limit,editable:e.editable,selection:e.selection}).series[0];if(x){const R=x.points.map(()=>0);if(H&&H.col){const o=new Map(x.points.map((l,t)=>[ae(l.x),t]));for(const l of A(n)){const t=e.x?n.rows.value(l.key,e.x):null,h=o.get(ae(t));if(h===void 0)continue;const j=w(n,l,H.col);j!==null&&(R[h]+=Math.abs(j))}}for(let o=0;o<x.points.length;o++){const l=x.points[o],t=s(l.label,l.x,1);t.total=l.y===null?0:Math.abs(l.y),t.rowKey=l.rowKey,t.rowKeys=l.rowKeys||(l.rowKey?[l.rowKey]:[]),t.radius=R[o],M.children.push(t)}}}M.total=M.children.reduce((a,x)=>a+x.total,0);let V=0;const fe=a=>{a.depth>V&&(V=a.depth);for(const x of a.children)fe(x)};return fe(M),{root:M,depth:V,measure:{...g,title:O?.title||g.col||""},radius:H?{...H,title:F?.title||H.col||""}:null,empty:M.total<=0||M.children.length===0}}function re(n,e,i,g,b){let O=0;const ne=(F,s)=>{F.depth=s,s>O&&(O=s);for(const M of F.children)ne(M,s+1);if(F.children.length){const M=F.children.reduce((B,I)=>B+I.total,0);M>0||!F.own?F.total=M:F.total=F.own;for(const B of F.children)for(const I of B.rowKeys)F.rowKeys.push(I)}else F.total=F.own||(!i.col&&b?1:0)};ne(e,0);const H=i.col?n.columns.get(i.col):void 0;return{root:e,depth:O,measure:{...i,title:H?.title||i.col||""},dimension:g,radius:null,empty:e.total<=0||e.children.length===0}}function C(n,e){return{label:n,value:e,depth:0,total:0,own:0,radius:0,children:[],rowKey:null,rowKeys:[]}}function ee(n,e,i){const g=W(e.y),b=e.id||null,O=e.label||e.x||b,ne=C("",null),H=new Map,F=new Map;for(const M of A(n)){const B=b?n.rows.value(M.key,b):null,I=B==null||B===""?M.key:B,V=String(I);if(H.has(V))continue;const fe=O?n.rows.text(M.key,O):"",a=C(fe||V,I);a.rowKey=M.key,a.rowKeys=[M.key];const x=g.col?w(n,M,g.col):null;a.own=x===null?0:Math.abs(x),H.set(V,a);const R=n.rows.value(M.key,e.parentId);F.set(V,R==null||R===""?"":String(R))}for(const[M,B]of H){let I=F.get(M),V=0;for(;I&&H.has(I)&&I!==M&&V<=H.size;)I=F.get(I),V+=1;((!(V>H.size||I===M)&&F.get(M)&&F.get(M)!==M?H.get(F.get(M)):null)||ne).children.push(B)}const s={col:O||e.parentId,title:n.columns.get(O||e.parentId)?.title||O||e.parentId};return re(n,ne,g,s,!!i.count)}function z(n,e,i){const g=W(e.y),b=typeof e.pathSeparator=="string"&&e.pathSeparator?e.pathSeparator:"/",O=C("",null),ne=new Map([[O,new Map]]);for(const F of A(n)){const s=n.rows.value(F.key,e.path);if(s==null||s==="")continue;const M=String(s).split(b).map(V=>V.trim()).filter(Boolean);let B=O;for(const V of M){let fe=ne.get(B).get(V);fe||(fe=C(V,V),ne.get(B).set(V,fe),ne.set(fe,new Map),B.children.push(fe)),B=fe}if(B===O)continue;B.rowKey=B.rowKey||F.key,B.rowKeys.push(F.key);const I=g.col?w(n,F,g.col):null;B.own+=I===null?0:Math.abs(I),!g.col&&i.count&&(B.own+=1)}const H={col:e.path,title:n.columns.get(e.path)?.title||e.path};return re(n,O,g,H,!!i.count)}}),tt("packages/core/src/source/filterwire.js",function(r,oe){"use strict";Object.defineProperty(r,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(r,"warnWherePageRelative",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"warnWhereNotApplied",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(r,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return le}}),Object.defineProperty(r,"warnWhereOverThreshold",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(r,"parseRelativeToken",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"resolveRelativeRange",{enumerable:!0,get:function(){return N}}),Object.defineProperty(r,"relativeTokenOf",{enumerable:!0,get:function(){return q}}),Object.defineProperty(r,"relativeTokenHelp",{enumerable:!0,get:function(){return k}}),Object.defineProperty(r,"isResolvableRelative",{enumerable:!0,get:function(){return _}}),Object.defineProperty(r,"resolveRelativeCondition",{enumerable:!0,get:function(){return c}}),Object.defineProperty(r,"isGroup",{enumerable:!0,get:function(){return v}}),Object.defineProperty(r,"forEachCondition",{enumerable:!0,get:function(){return E}}),Object.defineProperty(r,"mapConditions",{enumerable:!0,get:function(){return m}}),Object.defineProperty(r,"normaliseFilterSet",{enumerable:!0,get:function(){return P}}),Object.defineProperty(r,"buildFilterSet",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(r,"wireFilters",{enumerable:!0,get:function(){return K}}),Object.defineProperty(r,"querySignature",{enumerable:!0,get:function(){return ge}});const ae=oe("packages/core/src/internal/util.js").warnOnce,$="source.remote.hostFilter",ke="source.where.pageRelative";function we(ee,z){!Array.isArray(ee)||!ee.length||ae(ke,`filters.where (${ee.join(", ")}) runs over the rows the ${z} 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 se(ee){const z=(ee||{}).config;!z||!z.hostFilter||ae($,"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 ie="source.where.notApplied";function Z(ee,z){ae(`${ie}:${ee}`,`filters.where("${ee}") is registered but the ${z} 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 le="source.where.overThreshold";function D(ee,z,n,e){!Array.isArray(ee)||!ee.length||ae(`${le}:${z}`,`filters.where (${ee.join(", ")}) is not applied to the ${z} pushdown source:`,n===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${n.toLocaleString()} rows, at or past the whereRowLimit of ${e.toLocaleString()}.`,"Running the predicate needs every matching row fetched and held here, which is the whole","download a pushdown source exists to avoid, so it is refused and the rows the predicate","would exclude stay on screen.","Give the predicate a { condition } twin so the engine narrows the fetch itself — that is the","route that works at any size — or raise `whereRowLimit` on the source config if you want the","download.")}const d=new Map;function L(ee){let z=d.get(ee);return z||(z=new Intl.DateTimeFormat("en-US",{timeZone:ee,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),d.set(ee,z)),z}function T(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function W(ee,z){const n=L(z).formatToParts(new Date(ee)),e={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const i of n)i.type==="year"?e.y=+i.value:i.type==="month"?e.m=+i.value:i.type==="day"?e.d=+i.value:i.type==="hour"?e.h=+i.value%24:i.type==="minute"?e.mi=+i.value:i.type==="second"&&(e.s=+i.value);return e}function G(ee,z){const n=W(ee,z);return Date.UTC(n.y,n.m-1,n.d,n.h,n.mi,n.s)-Math.floor(ee/1e3)*1e3}function A(ee,z,n,e){const i=Date.UTC(ee,z-1,n),g=i-G(i,e);return i-G(g,e)}function p(ee,z,n){const e=new Date(Date.UTC(ee.y,ee.m-1,ee.d+z));return A(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),n)}const f=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function w(ee,z){if(typeof ee!="string")return null;const n=ee.trim().toLowerCase().replace(/[\s_-]+/g,""),e=/^last(\d*|n)days?$/.exec(n);if(e){const i=e[1]==="n"?"":e[1],g=Number(i||z);return!Number.isFinite(g)||g<=0?null:{kind:"lastNDays",n:Math.floor(g)}}switch(n){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 N(ee,z={}){const n=w(ee,z.n);if(!n)return null;const e=z.tz||T(),i=z.now instanceof Date?z.now.getTime():typeof z.now=="number"?z.now:Date.now(),g=W(i,e),b=A(g.y,g.m,g.d,e),O=p(g,1,e);let ne=b,H=O;switch(n.kind){case"today":break;case"yesterday":ne=p(g,-1,e),H=b;break;case"lastNDays":H=z.includeToday?O:b,ne=p(g,z.includeToday?-(n.n-1):-n.n,e);break;case"thisWeek":{const F=Number.isFinite(z.weekStartsOn)?Number(z.weekStartsOn):1,M=(new Date(Date.UTC(g.y,g.m-1,g.d)).getUTCDay()-F+7)%7;ne=p(g,-M,e),H=p(g,-M+7,e);break}case"thisMonth":ne=A(g.y,g.m,1,e),H=A(g.m===12?g.y+1:g.y,g.m===12?1:g.m+1,1,e);break;case"thisQuarter":case"quarterToDate":{const F=Math.floor((g.m-1)/3)*3+1;ne=A(g.y,F,1,e),H=n.kind==="quarterToDate"?O:F===10?A(g.y+1,1,1,e):A(g.y,F+3,1,e);break}case"thisYear":case"yearToDate":ne=A(g.y,1,1,e),H=n.kind==="yearToDate"?O:A(g.y+1,1,1,e);break;default:return null}return{from:new Date(ne).toISOString(),to:new Date(H).toISOString(),bounds:"[)",tz:e,relative:n.kind==="lastNDays"?`last${n.n}Days`:n.kind,n:n.n}}function q(ee){if(!ee||typeof ee!="object")return null;const z=ee.value;if(z&&typeof z=="object"&&!Array.isArray(z)&&"relative"in z)return{token:String(z.relative),n:typeof z.n=="number"?z.n:void 0};if(ee.op==="relative"&&typeof ee.value=="string")return{token:ee.value,n:void 0};const n=ee.meta;return n&&typeof n.relative=="string"&&ee.value===void 0?{token:n.relative,n:typeof n.n=="number"?n.n:void 0}:null}function k(){return`Known tokens: ${f.filter(z=>z!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function _(ee){const z=q(ee);return z?w(z.token,z.n)!==null:!1}function c(ee,z={}){const n=q(ee);if(!n)return ee;const e=N(n.token,{...z,n:n.n});return e?{...ee,type:ee.type||"date",op:"between",value:[e.from,e.to],bounds:ee.bounds||e.bounds,meta:{...ee.meta||{},relative:e.relative,tz:e.tz}}:(ae(`source.relative.${n.token}`,`unknown relative date token "${n.token}"; sending the condition unresolved.`,k()),ee)}function v(ee){return!!ee&&typeof ee=="object"&&Array.isArray(ee.conditions)}function E(ee,z){if(ee){if(v(ee)){for(const n of ee.conditions)E(n,z);return}z(ee)}}function m(ee,z){if(!ee)return null;if(!v(ee))return z(ee);const n=ee;let e=!1;const i=[];for(const g of n.conditions){const b=m(g,z);b!==g&&(e=!0),b&&i.push(b)}return!e&&i.length===n.conditions.length?ee:i.length?{...n,conditions:i}:null}function y(ee){if(!ee)return null;if(!v(ee))return ee;const z=ee,n=[];for(const e of z.conditions){const i=y(e);i&&n.push(i)}return n.length?{op:z.op,conditions:n}:null}function P(ee){const z=y(ee);return z?v(z)&&z.op==="and"?z:{op:"and",conditions:[z]}:null}function Q(ee){const z=(ee||[]).filter(Boolean);return z.length?{op:"and",conditions:z}:null}function K(ee,z={}){const n=m(ee,e=>c(e,z));return P(n)}function ge(ee){const z=re(ee.filters??null);return JSON.stringify([z,ee.sort??null,ee.quick??"",ee.groupBy??null,ee.pivotBy??null,C(ee.context)])}function re(ee){if(!ee)return null;if(v(ee)){const e=ee;return{op:e.op,conditions:e.conditions.map(re)}}const z=ee,n=z.meta&&typeof z.meta.relative=="string"?z.meta.relative:q(z)?.token;return{col:z.col,op:z.op,bounds:z.bounds??null,caseSensitive:z.caseSensitive??!1,value:n?`rel:${n}`:z.value??null}}function C(ee){if(ee==null)return null;try{return JSON.parse(JSON.stringify(ee))}catch{return ae("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),tt("packages/core/src/source/aggregates.js",function(r,oe){"use strict";Object.defineProperty(r,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(r,"pushableAggregates",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(r,"fillAggregateSql",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"resolveAggregatesConfig",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(r,"routeAggregate",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"resolveAggregatePlan",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"groupKeysPushable",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(r,"pushdownDocRows",{enumerable:!0,get:function(){return le}});const Ae=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 ae(){const D=new Set;for(const[d,L]of Object.entries(Ae))L.pushable&&D.add(d);return D}function $(D,d,L){let T=D.split("%c").join(d);return L!==void 0&&(T=T.split("%w").join(L)),T}function ke(D){const d=D||{},L=d.default==="engine"||d.default==="engine-if-identical"?d.default:"client",T={};if(d.overrides&&typeof d.overrides=="object")for(const[W,G]of Object.entries(d.overrides))(G==="engine"||G==="client")&&(T[W]=G);return{default:L,overrides:T}}function we(D,d){const L=Ae[D];if(!L||!L.pushable)return"client";const T=d.overrides[D];return T==="engine"||T==="client"?T:d.default==="client"?"client":d.default==="engine-if-identical"?L.class==="identical"?"engine":"client":"engine"}function se(D,d){const L=ke(d),T=[],W=[];for(const G of D||[]){const A=Ae[G.fn],p=we(G.fn,L),f={id:G.id,col:G.col,fn:G.fn,class:A?A.class:"fallback"};G.weight!==void 0&&(f.weight=G.weight),G.params!==void 0&&(f.params=G.params),p==="engine"?T.push(f):(f.reason=A&&!A.pushable?A.note||"the engine cannot express this stat":"client by config",W.push(f))}return{engine:T,client:W,config:L}}const ie=/^[A-Za-z_][A-Za-z0-9_$]*$/;function Z(D,d=[]){return(D||[]).every(T=>{if(typeof T=="string")return ie.test(T);if(!T||typeof T!="object")return!1;const W=T;return Array.isArray(d)&&d.includes(W.bucket)&&typeof W.col=="string"&&ie.test(W.col)&&typeof W.size=="number"&&Number.isFinite(W.size)&&W.size>0})}function le(){return Object.entries(Ae).map(([D,d])=>({stat:D,class:d.class,sql:d.sql?$(d.sql,"col",d.twoColumn?"weight":void 0):"",note:d.note||(d.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),tt("packages/core/src/source/abort.js",function(r,oe){"use strict";Object.defineProperty(r,"SupersededError",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(r,"RequestToken",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(r,"AbortScope",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"createAbortScope",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(r,"isAbortError",{enumerable:!0,get:function(){return we}});class Ae extends Error{constructor(ie,Z="superseded"){super(`[lattice] request ${ie?`"${ie}" `:""}${Z}`),this.name="SupersededError",this.superseded=!0,this.key=ie}}class ae{#r;constructor(ie,Z,le,D){this.#r=ie,this.key=Z,this.controller=le,this.signal=le.signal,this.seq=D}get current(){return!this.signal.aborted&&this.#r.tokenFor(this.key)===this}settle(){this.#r.settle(this)}abort(ie){this.signal.aborted||this.controller.abort(new Ae(this.key,ie)),this.#r.settle(this)}}class ${#r=new Map;#n=0;begin(ie="",Z="superseded"){const le=this.#r.get(ie);le&&!le.signal.aborted&&le.controller.abort(new Ae(ie,Z));const D=new ae(this,ie,new AbortController,++this.#n);return this.#r.set(ie,D),D}tokenFor(ie){return this.#r.get(ie)}pending(ie=""){const Z=this.#r.get(ie);return!!Z&&!Z.signal.aborted}get size(){return this.#r.size}settle(ie){this.#r.get(ie.key)===ie&&this.#r.delete(ie.key)}abort(ie="",Z="superseded"){const le=this.#r.get(ie);le&&le.abort(Z)}abortAll(ie="superseded"){for(const Z of[...this.#r.values()])Z.abort(ie);this.#r.clear()}}function ke(){return new $}function we(se){if(!se||typeof se!="object")return!1;const ie=se;return ie.superseded===!0||ie.name==="AbortError"||ie.name==="SupersededError"}}),tt("packages/core/src/source/pushdown.js",function(r,oe){"use strict";Object.defineProperty(r,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return A}}),Object.defineProperty(r,"NO_CAPABILITIES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(r,"resolveMutate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"capabilitiesOf",{enumerable:!0,get:function(){return k}}),Object.defineProperty(r,"splitFilters",{enumerable:!0,get:function(){return c}}),Object.defineProperty(r,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return v}}),Object.defineProperty(r,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return P}}),Object.defineProperty(r,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(r,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return K}}),Object.defineProperty(r,"planQuery",{enumerable:!0,get:function(){return re}}),Object.defineProperty(r,"applyResidual",{enumerable:!0,get:function(){return z}}),Object.defineProperty(r,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return g}}),Object.defineProperty(r,"createPushdownSource",{enumerable:!0,get:function(){return H}});const Ae=oe("packages/core/src/internal/util.js"),ae=Ae.defaultCompare,$=Ae.isFunction,ke=Ae.toArray,we=Ae.warnOnce,se=oe("packages/core/src/source/filterwire.js"),ie=se.isGroup,Z=se.warnWherePageRelative,le=se.warnWhereOverThreshold,D=oe("packages/core/src/source/aggregates.js"),d=D.resolveAggregatePlan,L=D.groupKeysPushable,T=D.STAT_PUSHDOWN,G=oe("packages/core/src/source/abort.js").SupersededError,A=1e3;function p(F){const s=F&&F.signal;if(!s||!s.aborted)return;const M=s.reason;throw M instanceof Error?M:new G("","superseded before it was sent")}const f=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function w(F){if(!F||typeof F!="object")return!1;const s=F.returning==="row"||F.returning==="key"?F.returning:"none";return{append:F.append===!0,update:F.update===!0,delete:F.delete===!0,returning:s}}function N(F,s){if(!F||typeof s!="string")return;if(!s.includes("."))return F[s];let M=F;for(const B of s.split(".")){if(M===null||typeof M!="object")return;M=M[B]}return M}function q(F){if(F===!0)return!0;if(!F||typeof F!="object")return!1;const s=F;return s.enabled===!1?!1:s.enabled===!0||$(s.commit)}function k(F){const s={...f,...F||{}};return s.operators=new Set(s.operators||[]),s.mutate=w(s.mutate),s}function _(F,s){return!F||!F.op||!s.operators.size?!1:s.operators.has(F.op)}function c(F,s){if(!F)return{pushed:null,residual:null};if(!s.filter)return{pushed:null,residual:F};if(s.filter==="term"){if(ie(F)){const V=F.conditions||[];if(String(F.op)!=="and")return{pushed:null,residual:F};const fe=V.findIndex(x=>!ie(x)&&_(x,s));if(fe<0)return{pushed:null,residual:F};const a=V.filter((x,R)=>R!==fe);return{pushed:V[fe],residual:a.length?{op:"and",conditions:a}:null}}return _(F,s)?{pushed:F,residual:null}:{pushed:null,residual:F}}if(!ie(F))return _(F,s)?{pushed:F,residual:null}:{pushed:null,residual:F};if(String(F.op)!=="and")return(F.conditions||[]).every(fe=>ie(fe)?c(fe,s).residual===null:_(fe,s))?{pushed:F,residual:null}:{pushed:null,residual:F};const M=[],B=[];for(const V of F.conditions||[]){if(ie(V)){if(s.filter==="flat"){B.push(V);continue}const fe=c(V,s);fe.pushed&&M.push(fe.pushed),fe.residual&&B.push(fe.residual);continue}(_(V,s)?M:B).push(V)}const I=V=>V.length===0?null:V.length===1?V[0]:{op:"and",conditions:V};return{pushed:I(M),residual:I(B)}}const v="__lattice_leaves";function E(F){return F.aggregates?F.aggregates instanceof Set?F.aggregates:new Set(ke(F.aggregates)):new Set}function m(F){const s=E(F);return s.size?s.has("count")?F.filter!=="tree"||!F.operators||!F.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 y(F,s,M,B,I,V,fe){const a=Array.isArray(F.groupBy)?F.groupBy:[],x=Array.isArray(F.groupPath)?F.groupPath:[],R=Array.isArray(F.groupValues)?F.groupValues:null;if(!s.group){const o=m(s);if(o)return o}return L(a)?M.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":B?I?V?"a host `where` predicate can only run in the browser, over rows the engine grouped":fe?"fullDataset holds the whole matching set, so the grid groups it itself":!R||R.length!==x.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 P="pushdown:pivot-unsupported",Q="pushdown:group-unsupported",K=Symbol("lattice.remote.ungroupedLevel");function ge(F,s,M,B,I,V){const fe=Array.isArray(F.pivotBy)?F.pivotBy:[],a=Array.isArray(F.groupBy)?F.groupBy:[],x=Array.isArray(F.groupPath)?F.groupPath:[],R=Array.isArray(F.groupValues)?F.groupValues:null;return s.pivot?L(fe)?a.length&&!L(a)?"a grouping key is not a plain column the engine can name in a GROUP BY":M.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":B?I?V?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!R||R.length!==x.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 re(F,s,M=!1){const B=c(F.filters||null,s),I=[];B.residual&&I.push("filter");const V=F.sort||[],fe=V.length===0||s.sort==="multi"&&V.length>=1||s.sort==="single"&&V.length===1;!fe&&V.length&&I.push("sort");const a=F.quick?String(F.quick):"",x=!a||!!s.quick;x||I.push("quick");const R=F.where&&F.where.active?F.where:null;R&&I.push("where");const o={filters:B.residual,sort:fe?null:V,quick:x?"":a,where:R},l=!!M,t=Array.isArray(F.groupBy)&&F.groupBy.length>0,h=t?y(F,s,B,fe,x,R,l):"",j=F.pivotMode!==!1&&Array.isArray(F.pivotBy)&&F.pivotBy.length>0,U=j?ge(F,s,B,fe,x,R):"",J=j&&U==="";j&&!J&&I.push("pivot");const X=j?J&&t:t&&h==="";t&&!j&&!X&&I.push("group");const de=(X||J)&&Array.isArray(F.groupValues)?F.groupValues.length:0,pe=X||j?!1:l||!!(o.filters||o.sort||o.quick||o.where)||!s.range;return{pushed:{...F,filters:B.pushed,sort:fe?V:[],quick:x?a:"",range:pe?null:F.range},residual:o,needsAll:pe,unpushed:I,full:l,grouped:X,groupLevel:de,groupReason:j?"":h,pivoted:J,pivotReason:U}}function C(F){const s=Array.isArray(F.totals)?F.totals:[],M=F.totalFns&&typeof F.totalFns=="object"?F.totalFns:{},B=[],I=[];for(const V of s){const fe=String(V),a=typeof M[fe]=="string"?M[fe]:null,x=a?T[a]:null;a?!x||!x.pushable||!x.sql?I.push({id:fe,fn:a,class:x?x.class:"fallback",reason:x&&x.note?x.note:`the pushdown map cannot express "${a}"`}):x.twoColumn?I.push({id:fe,fn:a,class:x.class,reason:`"${a}" reduces two columns, and a grouped request carries no weight column`}):B.push({id:fe,col:fe,fn:a,class:x.class}):I.push({id:fe,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:B,client:I}}const ee=Object.freeze({items:F=>F==null?[]:Array.isArray(F)?F:[F]});function z(F,s,M){if(!s)return F;let B=F;if(s.filters&&$(M.evaluateFilters)){const I=B,V={count:B.length,handle:x=>({id:x,get:R=>N(I[R],x)}),itemwise:x=>I.some(R=>Array.isArray(N(R,x)))?ee:null},fe=M.evaluateFilters(s.filters,V),a=[];for(let x=0;x<B.length;x++)fe[x]&&a.push(B[x]);B=a}if(s.where&&s.where.active&&(s.whole||Z(s.where.names,"pushdown"),B=B.filter(I=>s.where.passes(I))),s.quick){const I=s.quick.toLowerCase();B=B.filter(V=>{if(!V||typeof V!="object")return!1;for(const fe of Object.values(V))if(fe!=null&&String(fe).toLowerCase().includes(I))return!0;return!1})}if(s.sort&&s.sort.length&&$(M.sortMulti)){const I=[...new Set(s.sort.map(x=>x.col))],V=B,fe=I.map(x=>({id:x,get:R=>N(V[R],x)})),a=M.sortMulti(fe,s.sort.map(x=>({col:x.col,dir:x.dir})),Uint32Array.from({length:B.length},(x,R)=>R),{});B=Array.from(a,x=>V[x])}return B}function n(F){return JSON.stringify({filters:F.filters||null,sort:F.sort||[],quick:F.quick||"",groupBy:F.groupBy||[],groupPath:F.groupPath||[],context:F.context??null})}function e(F){if(!F||typeof F!="object")return 16;let s="";try{s=JSON.stringify(F)}catch{return 200}return s.length*2+64}function i(F){const s=F||{};return{enabled:!!s.enabled,maxRows:Number.isFinite(s.maxRows)?s.maxRows:1e6,maxBytesEstimate:Number.isFinite(s.maxBytesEstimate)?s.maxBytesEstimate:512*1024*1024}}const g=5e4;function b(F){return Number.isFinite(F)&&F>=0?F:g}function O(F){return!!F&&$(F.then)}async function ne(F){if(!F||F.total!==void 0||!O(F.pendingTotal))return F;const s=await F.pendingTotal,{pendingTotal:M,...B}=F;return typeof s=="number"?{...B,total:s}:B}function H(F={}){const s=F.adapter;if(!s||!$(s.execute))return we("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...F,mode:"remote",fetch:async()=>({rows:[],total:0})};const M=k(s.capabilities),B=s.capabilities&&Object.getOwnPropertyDescriptor(s.capabilities,"operators");B&&$(B.get)&&Object.defineProperty(M,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(s.capabilities.operators||[]),set:()=>{}});const I=s.name||"adapter";let V=null;const fe=()=>$(s.ready)?(V||(V=Promise.resolve(s.ready()).then(()=>{Object.assign(M,k(s.capabilities))},Ye=>{throw V=null,Ye})),V):null,a=i(F.fullDataset),x=!!F.allowPartialResults,R=b(F.whereRowLimit);let o=null;const l=F.aggregates;let t=null,h=null,j=null,U=null,J=null,X,de=null,pe=0,xe=null;const ve=()=>!a.enabled||!t?null:(xe!==t.key&&(pe++,xe=t.key),{rows:t.rows,version:pe}),Oe=async Ye=>{const et=Ye.where&&Ye.where.active?Ye.where:null;if(!et)return{request:Ye,probe:null};const{where:gt,...ut}=Ye,Ue=re(ut,M,a.enabled);if(Ue.needsAll)return{request:Ye,probe:null};const ft=n(Ue.pushed);let yt=null;return(!o||o.key!==ft)&&(M.total?(p(Ye),yt=await ne(await s.execute(Ue.pushed,Ye)),o={key:ft,size:yt&&typeof yt.total=="number"?yt.total:null}):o={key:ft,size:null}),o.size!==null&&o.size<R?{request:Ye,probe:null}:(le(et.names,I,o.size,R),{request:ut,probe:yt})},Pe=async(Ye,et)=>{de=null;const gt=C(Ye.pushed);j={engine:gt.engine,client:gt.client,groupBy:Ye.pushed.groupBy},gt.client.length&&we(`source.pushdown.group.totals.${I}.${gt.client.map(ft=>ft.id).join(".")}`,`the ${I} adapter cannot compute the group subtotal for ${gt.client.map(ft=>`"${ft.id}" (${ft.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 ut=await s.executeGroupLevel(Ye.pushed,gt.engine,et)||{};let Ue=ut.rows||[];return!M.range&&et.range&&(Ue=Ue.slice(et.range.start,et.range.end)),be(ut),ut.total===void 0?{rows:Ue}:{rows:Ue,total:ut.total}},te=new Map,Se=64,ye=async(Ye,et)=>{de=null;const gt=Ye.pushed,ut=gt.groupBy,Ue=Array.isArray(gt.groupValues)?gt.groupValues:[],ft=Ue.length,yt=[...gt.filters?[gt.filters]:[],...ut.slice(0,ft).map((At,nn)=>({col:At,op:"eq",value:Ue[nn]===void 0?null:Ue[nn],caseSensitive:!0}))],Ct=yt.length===0?null:yt.length===1?yt[0]:{op:"and",conditions:yt},ot=et.range?et.range.start:0;if(ft>=ut.length){const At={...gt,filters:Ct,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},nn=await ne(await s.execute(At,et))||{};let fn=nn.rows||[];return!M.range&&et.range&&(fn=fn.slice(et.range.start,et.range.end)),typeof nn.total=="number"?{rows:fn,total:nn.total}:{rows:fn}}const dt=ut[ft],it=C(gt),bt=E(M),Jt=it.engine.filter(At=>bt.has(At.fn)),en=[...it.engine.filter(At=>!bt.has(At.fn)).map(At=>({id:At.id,fn:At.fn,class:At.class,reason:`the ${I} adapter does not compute "${At.fn}"`})),...it.client];j={engine:Jt,client:en,groupBy:ut},en.length&&we(`source.pushdown.group.totals.${I}.${en.map(At=>At.id).join(".")}`,`the ${I} adapter cannot compute the group subtotal for ${en.map(At=>`"${At.id}" (${At.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 Mt=[...Jt.map(At=>({id:At.id,col:At.col,fn:At.fn})),{id:v,col:dt,fn:"count"}],Lt={...gt,filters:Ct,range:null},zt=JSON.stringify([n(Lt),Ue,dt,Mt]);let Yt=ot>0?te.get(zt):void 0;if(!Yt){for(Yt=Promise.resolve(s.executeGroupedAggregates(Lt,[dt],Mt)),te.delete(zt),te.set(zt,Yt);te.size>Se;)te.delete(te.keys().next().value);Yt.catch(()=>{te.get(zt)===Yt&&te.delete(zt)})}const xn=await Yt||[];p(et);const pn=At=>{const nn={};for(const fn of Jt)nn[fn.id]=At?At[fn.id]:void 0;return nn},an=(gt.sort||[]).find(At=>At&&At.col===dt),wn=an&&an.dir==="desc"?-1:1,on=xn.filter(At=>At&&At.level===1).map(At=>({[dt]:At.keys[0]===void 0?null:At.keys[0],leafCount:Number(At.values&&At.values[v])||0,totals:pn(At.values)})).sort((At,nn)=>wn*ae(At[dt],nn[dt]));if(ft===0){const At=xn.find(fn=>fn&&fn.level===0),nn=At?Number(At.values&&At.values[v]):NaN;be({matchCount:Number.isFinite(nn)?nn:on.reduce((fn,Bn)=>fn+Bn.leafCount,0),...At?{grand:pn(At.values)}:{}})}const Yn=et.range?et.range.end:on.length;return{rows:on.slice(ot,Yn),total:on.length}},be=Ye=>{typeof Ye.matchCount=="number"&&(U=Ye.matchCount,J=Ye.grand?{totals:Ye.grand,leafCount:Ye.matchCount}:null,X===void 0&&$(s.unfilteredCount)&&(X=null,Promise.resolve(s.unfilteredCount()).then(et=>{X=typeof et=="number"?et:null}).catch(et=>{we(`source.pushdown.group.unfiltered.${I}`,`the ${I} adapter could not count the unfiltered set (${et&&et.message?et.message:et}), so "N of M" falls back to the display count for its denominator.`)})))},Ne=async(Ye,et)=>{de=null;const gt=C(Ye.pushed);j={engine:gt.engine,client:gt.client,groupBy:Ye.pushed.groupBy,pivotBy:Ye.pushed.pivotBy},gt.client.length&&we(`source.pushdown.pivot.totals.${I}.${gt.client.map(Ct=>Ct.id).join(".")}`,`the ${I} adapter cannot compute the pivot cells for ${gt.client.map(Ct=>`"${Ct.id}" (${Ct.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 ut=await s.executePivotLevel(Ye.pushed,gt.engine,et)||{};let Ue=ut.rows||[];!M.range&&et.range&&(Ue=Ue.slice(et.range.start,et.range.end)),be(ut);const ft=ut.pivot&&typeof ut.pivot=="object"?ut.pivot:{},yt={cells:Array.isArray(ft.cells)?ft.cells:[],...Array.isArray(ft.axis)?{axis:ft.axis}:{}};return ut.total===void 0?{rows:Ue,pivot:yt}:{rows:Ue,total:ut.total,pivot:yt}},je=Ye=>{we(`source.pushdown.pivot.${I}.${Ye}`,`pushdown:pivot-unsupported: the ${I} adapter cannot pivot this query because ${Ye}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const et=new Error(`[lattice] ${P}: the ${I} adapter cannot pivot this query because ${Ye}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw et.code=P,et.reason=Ye,et},Ee=(Ye,et)=>{const gt={key:et,state:"pending",value:null};return de=gt,Ye.then(ut=>(de===gt&&(de={key:et,state:"settled",value:typeof ut=="number"?ut:null}),ut),ut=>{throw de===gt&&(de={key:et,state:"failed",value:null}),ut})};let Ce=0,Fe=[];const We=()=>Ce===0?null:new Promise(Ye=>{const et=setTimeout(Ye,A);Fe.push(()=>{clearTimeout(et),Ye()})}),wt=async Ye=>{const et=fe();et&&await et;const ut=Ye&&Ye.pivotMode!==!1&&Array.isArray(Ye.pivotBy)&&Ye.pivotBy.length>0?{request:Ye,probe:null}:await Oe(Ye);p(Ye);let Ue=re(ut.request,M,a.enabled);if(M.group&&Ue.grouped&&!Ue.pivoted&&!$(s.executeGroupLevel)&&(we(`source.pushdown.group.method.${I}`,`the ${I} 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.`),Ue=re(ut.request,{...M,group:!1,aggregates:null},a.enabled)),Ue.pivoted&&!$(s.executePivotLevel)&&(Ue=re(ut.request,{...M,pivot:!1},a.enabled),Ue.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Ue.grouped&&!Ue.pivoted&&!M.group&&!$(s.executeGroupedAggregates)&&(we(`source.pushdown.group.aggregates.method.${I}`,`the ${I} 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\`.`),Ue=re(ut.request,{...M,aggregates:null},a.enabled)),h=Ue,Ue.pivoted)return Ne(Ue,Ye);if(Ue.pivotReason&&je(Ue.pivotReason),Ue.grouped)return M.group?Pe(Ue,Ye):ye(Ue,Ye);const yt=!!Ue.groupReason&&!Ue.full;yt?we(`source.pushdown.group-unsupported.${I}.${Ue.groupReason}`,`pushdown:group-unsupported: the ${I} adapter was not asked to group this query because ${Ue.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.`):Ue.groupReason&&we(`source.pushdown.group.${I}.${Ue.groupReason}`,`the ${I} adapter was not asked to group this query because ${Ue.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 Ct=Mt=>yt?{...Mt,[K]:!0}:Mt;if(!Ue.needsAll){const Mt=ut.probe||await s.execute(Ue.pushed,Ye),Lt=Mt.rows||[];return O(Mt.pendingTotal)&&Mt.total===void 0?Ct({rows:Lt,pendingTotal:Ee(Mt.pendingTotal,n(Ue.pushed))}):(de=null,!M.total&&Mt.total===void 0?Ct({rows:Lt}):Ct({rows:Lt,total:Mt.total??Lt.length}))}Ue.unpushed.length&&we(`source.pushdown.residual.${I}.${Ue.unpushed.join(".")}`,`the ${I} adapter cannot push ${Ue.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 ot=n(Ue.pushed);if(!t||t.key!==ot){const Mt=await ne(await s.execute(Ue.pushed,Ye));de=null;const Lt=Mt.rows||[];if(Ue.full){const zt=typeof Mt.total=="number"?Math.max(Mt.total,Lt.length):Lt.length;if(zt>a.maxRows)throw new Error(`[lattice] fullDataset refused: the ${I} adapter's matching set is ${zt.toLocaleString()} rows, past the configured maxRows of ${a.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 Yt=Lt.length*e(Lt[0]);if(Yt>a.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${I} adapter's matching set is an estimated ${Math.round(Yt/(1024*1024)).toLocaleString()} MB across ${Lt.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(a.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 Mt.total=="number"&&Lt.length<Mt.total){const zt=!!(Ue.residual.filters||Ue.residual.quick||Ue.residual.sort&&Ue.residual.sort.length);if(zt&&!x)throw new Error(`[lattice] the ${I} adapter returned ${Lt.length} of ${Mt.total} matching rows when asked for the whole result, and the query has residual ${Ue.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.`);zt?we(`source.pushdown.partial.residual.${I}`,`the ${I} adapter returned ${Lt.length} of ${Mt.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.`):we(`source.pushdown.partial.${I}`,`the ${I} adapter returned ${Lt.length} of ${Mt.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}t={key:ot,rows:Lt,total:typeof Mt.total=="number"?Mt.total:null}}let dt=Ue;if(Ue.residual.where){const Mt=t.total??t.rows.length;if(Mt>=R){le(Ue.residual.where.names,I,Mt,R);const{where:Lt,...zt}=ut.request;dt=re(zt,M,a.enabled),h=dt}}const it=t.total!==null&&t.rows.length>=t.total,bt=z(t.rows,{...dt.residual,whole:it},F.compute||{}),Jt=Ye.range?Ye.range.start:0,en=Ye.range?Ye.range.end:bt.length;return Ct({rows:bt.slice(Jt,en),total:bt.length})},lt=async(Ye,et)=>{const gt=We();gt&&await gt;const ut=fe();ut&&await ut;const Ue=re(Ye,M,a.enabled);h=Ue;const ft=d(et,l),yt=Array.isArray(Ye.groupBy)?Ye.groupBy:[],Ct=yt.length>0,ot=!Ue.residual.filters&&!Ue.residual.quick,dt=!Ct||L(yt,M.buckets);let it=ft.engine,bt=ft.client;if(M.aggregates&&it.length){const Lt=M.aggregates instanceof Set?M.aggregates:new Set(ke(M.aggregates)),zt=it.filter(Yt=>!Lt.has(Yt.fn));zt.length&&(it=it.filter(Yt=>Lt.has(Yt.fn)),bt=[...zt.map(Yt=>({...Yt,reason:`the ${I} adapter does not compute "${Yt.fn}"`})),...bt])}const Jt=Lt=>{bt=[...it.map(zt=>({...zt,reason:Lt})),...bt],it=[]};it.length&&!ot?Jt(Ue.residual.quick&&!Ue.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):it.length&&!dt&&Jt("a grouping key the engine cannot form forces all-client (no mixed provenance)");let en={},Mt;return it.length&&($(Ct?s.executeGroupedAggregates:s.executeAggregates)?Ct?Mt=await s.executeGroupedAggregates(Ue.pushed,yt,it)||[]:en=await s.executeAggregates(Ue.pushed,it)||{}:(we(`source.pushdown.aggregates.${I}${Ct?".grouped":""}`,`the ${I} adapter cannot compute ${Ct?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),Jt(`adapter cannot compute ${Ct?"grouped ":""}aggregates`))),j={engine:it,client:bt,...Ct?{groupBy:yt}:{}},{values:en,engine:it,client:bt,...Mt!==void 0?{groups:Mt}:{}}},st=async Ye=>{Ce++;try{return await wt(Ye)}finally{if(Ce--,Ce===0&&Fe.length){const et=Fe;Fe=[];for(const gt of et)gt()}}},Qe=q(F.edit),rt=F.edit&&typeof F.edit=="object"&&$(F.edit.commit);let pt=F.edit;if(Qe&&!rt)if(M.mutate&&M.mutate.update){const Ye=et=>{if(!M.mutate||!M.mutate.update)throw new Error(`[lattice] the ${I} 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 gt={kind:"update",key:String(et.key),patch:{[et.colId]:et.value}};return s.mutate(gt,et.request||{})};pt={...F.edit===!0?{}:F.edit,commit:Ye}}else we(`source.pushdown.readonly.${I}`,`edit is enabled but the ${I} adapter declares mutate: ${M.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 Ht=Qe&&M.mutate&&(M.mutate.append||M.mutate.delete)?{append:M.mutate.append===!0,remove:M.mutate.delete===!0,returning:M.mutate.returning,mutate:(Ye,et)=>s.mutate(Ye,et||{})}:null,kt=async Ye=>{const et=fe();et&&await et;const{range:gt,signal:ut,export:Ue,...ft}=Ye||{},yt={...ft,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:re(yt,M,a.enabled),signal:ut}};async function*Gt(Ye,et={}){const{plan:gt,signal:ut}=await kt(Ye),Ue=Math.max(1,Math.floor(Number(et.pageSize))||5e3),ft={signal:ut,stream:!0};if(!gt.needsAll)for(let ot=0;;ot+=Ue){p(ft);const dt=await s.execute({...gt.pushed,range:{start:ot,end:ot+Ue}},ft);dt&&O(dt.pendingTotal)&&dt.pendingTotal.then(null,()=>{});const it=dt&&dt.rows||[];if(it.length&&(yield it),it.length<Ue)return}p(ft);const yt=await ne(await s.execute({...gt.pushed,range:void 0},ft)),Ct=z(yt&&yt.rows||[],{...gt.residual,whole:!0},F.compute||{});for(let ot=0;ot<Ct.length;ot+=Ue)yield Ct.slice(ot,ot+Ue)}return{...F,edit:pt,rowMutate:Ht,mode:"remote",fetch:st,foregroundIdle:We,aggregate:lt,countMatching:async Ye=>{const{plan:et,signal:gt}=await kt(Ye);if(!et.needsAll&&M.total){p({signal:gt});const Ue=await ne(await s.execute({...et.pushed,range:{start:0,end:0}},{signal:gt}));if(Ue&&typeof Ue.total=="number")return Ue.total}let ut=0;for await(const Ue of Gt(Ye))ut+=Ue.length;return ut},streamMatching:Gt,lastPlan:()=>h?{...h,...j?{aggregates:j}:{},...de?{total:{deferred:!0,state:de.state,value:de.value}}:{}}:null,fullFrame:ve,counts:()=>({match:U,total:X??null,pending:!!de&&de.state==="pending"}),grandTotals:()=>J}}}),tt("packages/modules/shared/engine.js",function(r,oe){"use strict";Object.defineProperty(r,"sourceId",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(r,"engineSource",{enumerable:!0,get:function(){return le}}),Object.defineProperty(r,"gridPivoted",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"loadedAndMatching",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"gridHoldsWindow",{enumerable:!0,get:function(){return L}}),Object.defineProperty(r,"gridEngineRequest",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"EngineFlight",{enumerable:!0,get:function(){return G}});const Ae=oe("packages/core/src/source/pushdown.js"),ae=Ae.capabilitiesOf,$=Ae.planQuery,we=oe("packages/core/src/source/filterwire.js").wireFilters,se=new WeakMap;let ie=0;function Z(A){let p=se.get(A);return p===void 0&&(p=++ie,se.set(A,p)),p}function le(A){const p=A&&typeof A.config=="function"?A.config():null,f=p&&p.source&&typeof p.source=="object"?p.source:null;if(!f||typeof f.aggregate!="function")return{reason:"the grid's source has no aggregate() — it is not a pushdown source"};const w=ae(f.adapter&&f.adapter.capabilities);return{source:f,caps:w,config:p}}function D(A){const p=A&&typeof A.config=="function"?A.config():null,f=p&&p.source&&typeof p.source=="object"?p.source:null;if(!f||typeof f.lastPlan!="function")return!1;const w=A&&A.state&&typeof A.state.get=="function"?A.state.get():null,N=w&&w.pivot;return!!(N&&N.enabled&&Array.isArray(N.columns)&&N.columns.length>0)}function d(A){const p=A.rows&&typeof A.rows.residentCount=="function"?A.rows.residentCount():0,f=typeof A.rows.matchCount=="function"?A.rows.matchCount():NaN;return{loaded:p,total:Number.isFinite(f)?f:NaN}}function L(A){const p=A&&typeof A.config=="function"?A.config():null,f=p&&p.source&&typeof p.source=="object"?p.source:null;if(!f||f.mode!=="remote"&&f.mode!=="paged")return!1;if(typeof A.rows.matchCount=="function"&&A.rows.matchCount()===null)return!0;const{loaded:w,total:N}=d(A);return Number.isFinite(N)&&w<N}function T(A,p){return p?A?{op:"and",conditions:[A,p]}:p:A||null}function W(A,p,f=null){const w=A.filters&&typeof A.filters.where=="function"?A.filters.where():[];if(Array.isArray(w)&&w.length)return{reason:`a \`where\` predicate is in force (${w.join(", ")}), which only the browser can run`};const N=A.filters&&typeof A.filters.quickState=="function"?A.filters.quickState():{text:""},q=N&&N.text?String(N.text):"",{config:k,caps:_}=p,c={filters:we(T(A.filters.get(),f),{tz:k.timeZone,weekStartsOn:k.weekStartsOn}),sort:[],range:null,context:k.context??null,...q?{quick:q}:{}},v=$(c,_);return v.unpushed.includes("filter")?{reason:f?"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"}:v.unpushed.includes("quick")?{reason:"the quick search did not push to the engine"}:{request:c,quick:q}}class G{#r=null;#n=null;#i=!1;answer(p){return this.#n&&this.#n.key===p?this.#n:null}last(){return this.#n}get busy(){return this.#r!==null}ask(p,f,w){const N=this.#r;if(N){N.key!==p&&N.controller&&N.controller.abort();return}const q=globalThis.AbortController,k=typeof q=="function"?new q:null,_={key:p,controller:k};this.#r=_;let c;Promise.resolve().then(()=>f(k?k.signal:null)).then(v=>{c={key:p,result:v}},v=>{c={key:p,error:v}}).then(()=>{this.#r===_&&(this.#r=null),!this.#i&&(k&&k.signal.aborted||(this.#n=c),w())})}abort(){const p=this.#r;p&&p.controller&&p.controller.abort()}close(){this.#i=!0,this.abort()}}}),tt("packages/modules/charts/engine.js",function(r,oe){"use strict";Object.defineProperty(r,"AGGREGATE_MODES",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"ENGINE_TYPES",{enumerable:!0,get:function(){return N}}),Object.defineProperty(r,"aggregateMode",{enumerable:!0,get:function(){return m}}),Object.defineProperty(r,"planAggregate",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(r,"holdsWindow",{enumerable:!0,get:function(){return K}}),Object.defineProperty(r,"boundFromGroups",{enumerable:!0,get:function(){return C}}),Object.defineProperty(r,"measureProvenance",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(r,"specMeasures",{enumerable:!0,get:function(){return z}});const Ae=oe("packages/modules/charts/scale.js"),ae=Ae.key,$=Ae.toNumber,ke=oe("packages/modules/charts/bind.js"),we=ke.forcedScaleKind,se=ke.measureOf,ie=ke.scaleKindFor,Z=oe("packages/core/src/source/aggregates.js"),le=Z.resolveAggregatePlan,D=Z.STAT_PUSHDOWN,L=oe("packages/core/src/internal/util.js").warnOnce,T=oe("packages/modules/shared/engine.js"),W=T.engineSource,G=T.gridEngineRequest,A=T.gridHoldsWindow,p=T.loadedAndMatching,f=T.sourceId,w=Object.freeze(["auto","engine","client"]),N=Object.freeze(new Set(["line","step","area","bar","horizontalBar","waterfall","combo","pareto","heatmap","radar","funnel","stream","marimekko"])),q=Object.freeze(new Set(["combo","bar","line","step","area"])),k=Object.freeze({mean:"avg"}),_="__rows",c="m",v="__size",E=/^[A-Za-z_][A-Za-z0-9_$]*$/;function m(n){const e=n?n.aggregate:void 0;return e==null?"auto":typeof e=="string"&&w.includes(e)?e:(L(`chart:aggregate:mode:${String(e)}`,`chart aggregate ${JSON.stringify(e)} is not a mode; use one of ${w.join(", ")}. The chart used 'auto'.`),"auto")}function y(n,e,i){const g=n.columns.get(e);if(!g)return`the ${i} column "${e}" is not a column of the grid`;const b=g.value&&typeof g.value=="object"?g.value:null;return g.computed||b&&(typeof b.get=="function"||typeof b.compute=="function")?`the ${i} column "${e}" is computed by the grid, which the engine cannot reproduce`:(typeof g.field=="string"?g.field:e)!==e||!E.test(e)?`the ${i} column "${e}" is not a plain physical column the engine can name`:i!=="measure"&&g.type==="geometry"?`the ${i} column "${e}" is a geometry, which charts group in the browser for now`:""}function P(n,e,i){const g=q.has(i)&&Array.isArray(e.measures)&&e.measures.length>0;return(g?e.measures:[e.y]).map((O,ne)=>{const H=se(O),F=H.col?n.columns.get(H.col):void 0,s=se(O,F),M=O&&typeof O=="object"?O:{};return{id:`${c}${ne}`,col:s.col,fn:s.fn,stat:k[s.fn]||s.fn,label:g?M.title||M.label||F&&F.title||s.col||"":F&&F.title||s.col||"",mark:g&&M.type||null,axis:g&&M.axis==="right"?"right":"left",multi:g}})}function Q(n,e,i){const g=m(e),b=(l,t=!1)=>({mode:"client",asked:g,reason:l,refused:g==="engine",windowed:t});if(g==="client")return{...b("aggregate: 'client' was asked for"),refused:!1};if(!N.has(i))return b(`a "${i}" chart does not draw a grouped aggregate`);if(Array.isArray(e.points))return b("the chart draws an explicit point set");if(e.rows)return b("the chart was handed its own rows");if(e.from==="groups"||e.from==="selection")return b(`the chart reads the grid's ${e.from==="groups"?"group rows":"selection"}`);if(e.error)return b("error bars need the readings behind each mark");const O=W(n);if("reason"in O)return b(O.reason);const{source:ne,caps:H}=O;if(!H.group)return b("the source's adapter does not declare the `group` capability");const F=typeof e.x=="string"&&e.x?e.x:null;if(!F)return b("the chart names no x column to group by");const s=typeof e.series=="string"&&e.series?e.series:typeof e.multiples=="string"?e.multiples:null,M=P(n,e,i),B=M.length>0&&M[0].multi,I=s&&!B?[F,s]:[F];for(const[l,t]of I.entries()){const h=y(n,t,l===0?"x":"series");if(h)return b(h)}for(const l of M){if(!l.col)return b("a measure names no column to reduce");const t=y(n,l.col,"measure");if(t)return b(t);const h=D[l.stat];if(!h||!h.pushable)return b(`"${l.fn}" of "${l.col}" is not a reduction the engine can compute`)}if(e.size){const l=typeof e.size=="string"?y(n,e.size,"measure"):"the size channel is not a column";if(l)return b(l)}const V=[...M.map(l=>({id:l.id,col:l.col,fn:l.stat})),{id:_,col:F,fn:"count"},...e.size?[{id:v,col:e.size,fn:"sum"}]:[]],fe=le(V,ne.aggregates);if(fe.client.length){const l=fe.client[0];return b(`the source computes "${l.fn}" client-side (${l.reason}); set the pushdown source's \`aggregates: { default: 'engine' }\` to compute it in the engine`)}const a=G(n,O);if("reason"in a)return b(a.reason);const{quick:x}=a,R={...a.request,groupBy:I};if(g==="auto"){const{loaded:l,total:t}=p(n);if(Number.isFinite(t)&&l>=t)return b("the grid holds every matching row")}const o=JSON.stringify([f(ne),R.filters,x,I,V]);return{mode:"engine",asked:g,key:o,source:ne,request:R,requested:V,groupBy:I,measures:M}}function K(n){return A(n)}function ge(n,e){if(e==null)return"";if(n&&typeof n.formatValue=="function")try{const i=n.formatValue(e,null);if(typeof i=="string"&&i)return i}catch{}return e instanceof Date?e.toISOString().slice(0,10):String(e)}function re(n,e){if(n==null)return e==null?0:1;if(e==null)return-1;const i=n instanceof Date?n.getTime():$(n),g=e instanceof Date?e.getTime():$(e);return typeof n!="string"&&typeof e!="string"&&i!==null&&g!==null?i-g:String(n).localeCompare(String(e))}function C(n,e,i,g){const{groupBy:b,measures:O}=i,ne=b[0],H=b[1]||null,F=O[0].multi,s=n.columns.get(ne),M=H?n.columns.get(H):void 0,B=(g||[]).filter(X=>X&&X.level===b.length),I=new Map,V=new Map,fe=new Map;for(const X of B){const de=X.keys[0],pe=ae(de);I.has(pe)||I.set(pe,de);const xe=H?X.keys[1]:null,ve=H?ae(xe):"";V.has(ve)||V.set(ve,xe),fe.set(`${ve}\0${pe}`,X.values||{})}const a=n.sort&&typeof n.sort.get=="function"?n.sort.get():[],x=Array.isArray(a)&&a[0]&&a[0].col===ne&&a[0].dir==="desc",R=[...I.entries()].sort((X,de)=>re(X[1],de[1]));x&&R.reverse();const o=typeof e.limit=="number"&&e.limit>0?R.slice(0,e.limit):R,l=o.map(([,X])=>ge(s,X)),t=o.map(([,X])=>X),h=(X,de,pe,xe,ve)=>{const Oe=fe.get(`${X}\0${de}`),Pe=Oe?$(Oe[_]):null;return{x:pe,xKey:de,label:xe,y:Oe?$(Oe[ve]):null,size:Oe&&e.size?$(Oe[v]):null,rows:Pe===null?0:Pe,rowKey:null,values:null}};let j;F?j=O.map((X,de)=>({key:X.col,label:X.label,index:de,mark:X.mark,axis:X.axis,points:o.map(([pe,xe],ve)=>h("",pe,xe,l[ve],X.id))})):j=[...V.entries()].sort((de,pe)=>re(de[1],pe[1])).map(([de,pe],xe)=>({key:de,label:H?ge(M,pe):O[0].label,index:xe,points:o.map(([ve,Oe],Pe)=>h(de,ve,Oe,l[Pe],O[0].id))}));const U=B.reduce((X,de)=>X+($(de.values&&de.values[_])||0),0),J=ie(s,t,{forced:we(e),id:ne});return{series:j,categories:t,labels:l,kind:J,measure:F?{col:null,fn:"sum",title:j.map(X=>X.label).join(", ")}:{col:O[0].col,fn:O[0].fn,title:O[0].label},dimension:{col:ne,title:s&&s.title||ne},empty:j.length===0||o.length===0,rows:U,truncated:R.length-o.length,bucketed:null}}function ee(n,e,i=[],g=""){return n.map(b=>{const O=i.find(ne=>ne.id===b.id);return{col:b.col||null,fn:b.fn,computed:e,...O&&O.class?{class:O.class}:{},...e==="client"&&g?{reason:g}:{}}})}function z(n,e,i){try{return P(n,e,i).filter(g=>g.col)}catch{return[]}}}),tt("packages/core/src/compute/handle.js",function(r,oe){"use strict";Object.defineProperty(r,"identity",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"rowCount",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"bitReader",{enumerable:!0,get:function(){return le}}),Object.defineProperty(r,"presenceReader",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"dictSize",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"dictValue",{enumerable:!0,get:function(){return L}}),Object.defineProperty(r,"multiValue",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"valueReader",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"numericTotalOrder",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"valueComparator",{enumerable:!0,get:function(){return A}}),Object.defineProperty(r,"dictRanks",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"isMissing",{enumerable:!0,get:function(){return f}});const Ae=oe("packages/core/src/internal/util.js"),ae=Ae.collator,$=Ae.defaultCompare,ke=Ae.warnOnce;function we(w){const N=new Uint32Array(w);for(let q=0;q<w;q++)N[q]=q;return N}function se(w,N){if(N&&typeof N.count=="number")return N.count;if(!w)return 0;if(typeof w.count=="number")return w.count;if(typeof w.length=="number")return w.length;const q=w.values;return w.kind==="multi"&&w.offsets?Math.max(0,w.offsets.length-1):q?w.kind==="bitset"?typeof q.size=="number"?q.size:w.presence&&typeof w.presence.size=="number"?w.presence.size:(ke(`count:${w.id}`,`column "${w.id}" is bitset-backed with no declared row count; assuming ${q.length*8}`),q.length*8):q.length:w.presence&&typeof w.presence.size=="number"?w.presence.size:0}const ie=new WeakMap;function Z(w){const N=w.constructor;if(!N)return"unknown";const q=ie.get(N);if(q)return q;let k="unknown";try{let _=null;typeof N.from=="function"?_=N.from([!1,!0]):(_=new N(8),_.set(1));const c=_&&_.words;c&&c.length&&(c[0]===2?k="lsb":c[0]===64&&(k="msb"))}catch{k="unknown"}return ie.set(N,k),k}function le(w){if(!w)return()=>0;const N=w instanceof Uint8Array?w:w.words;if(N instanceof Uint8Array){const q=w instanceof Uint8Array?"lsb":Z(w);if(q==="lsb")return k=>N[k>>>3]>>>(k&7)&1;if(q==="msb")return k=>N[k>>>3]>>>7-(k&7)&1}return typeof w.get=="function"?q=>w.get(q)?1:0:()=>0}function D(w){return!w||!w.presence?null:le(w.presence)}function d(w){return w?typeof w.size=="number"?w.size:typeof w.values=="function"?w.values().length:0:0}function L(w,N){return w?typeof w.valueOf=="function"?w.valueOf(N):typeof w.values=="function"?w.values()[N]:null:null}function T(w,N){const q=w.offsets,k=w.values;if(!q||!k)return[];const _=q[N],c=q[N+1];if(!(c>_))return[];const v=w.dict,E=new Array(c-_);for(let m=_;m<c;m++)E[m-_]=v?L(v,k[m]):k[m];return E}function W(w){if(!w)return()=>{};const N=w.values,q=D(w),k=w.kind;if(k==="dictionary"){const _=w.dict;return q?c=>q(c)?L(_,N[c]):null:c=>L(_,N[c])}if(k==="bitset"){const _=le(N);return q?c=>q(c)?_(c)===1:null:c=>_(c)===1}if(k==="multi")return q?_=>q(_)?T(w,_):null:_=>T(w,_);if(!N&&typeof w.get=="function"){const _=w.get.bind(w);return c=>{const v=_(c);return v===void 0?null:v}}return q?_=>{if(!q(_))return null;const c=N[_];return c===void 0?null:c}:_=>{const c=N[_];return c===void 0?null:c}}function G(w,N){if(w<N)return-1;if(w>N)return 1;if(w===N){const _=Object.is(w,-0),c=Object.is(N,-0);return _===c?0:_?-1:1}const q=Number.isNaN(w),k=Number.isNaN(N);return q&&k?0:q?1:-1}function A(w){const N=ae(w);return(q,k)=>{if(q===k)return 0;const _=typeof q,c=typeof k;if(_==="string"&&c==="string")return N.compare(q,k);if(_==="number"&&c==="number")return G(q,k);if(_==="boolean"&&c==="boolean")return q===k?0:q?1:-1;if(q instanceof Date||k instanceof Date){const v=q instanceof Date?q.getTime():Number(q),E=k instanceof Date?k.getTime():Number(k);return G(v,E)}return $(q,k)}}function p(w,N){if(w&&typeof w.ranks=="function")return w.ranks(N);const q=w&&typeof w.values=="function"?w.values():[],k=q.length,_=A(N),c=new Array(k);for(let E=0;E<k;E++)c[E]=E;c.sort((E,m)=>_(q[E],q[m])||E-m);const v=new Uint32Array(k);for(let E=0;E<k;E++)v[c[E]]=E;return v}function f(w){return w==null||typeof w=="number"&&Number.isNaN(w)}}),tt("packages/core/src/compute/filter.js",function(r,oe){"use strict";Object.defineProperty(r,"releaseMask",{enumerable:!0,get:function(){return f}}),Object.defineProperty(r,"compilePredicate",{enumerable:!0,get:function(){return P}}),Object.defineProperty(r,"wallMs",{enumerable:!0,get:function(){return C}}),Object.defineProperty(r,"testValue",{enumerable:!0,get:function(){return n}}),Object.defineProperty(r,"itemwisePredicate",{enumerable:!0,get:function(){return g}}),Object.defineProperty(r,"evaluateCondition",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"evaluateFilters",{enumerable:!0,get:function(){return B}}),Object.defineProperty(r,"pruneColumn",{enumerable:!0,get:function(){return I}}),Object.defineProperty(r,"mentionsColumn",{enumerable:!0,get:function(){return V}}),Object.defineProperty(r,"compact",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(r,"declareOperators",{enumerable:!0,get:function(){return x}}),Object.defineProperty(r,"declaredOperator",{enumerable:!0,get:function(){return R}});const Ae=oe("packages/core/src/internal/util.js"),ae=Ae.isBlank,$=Ae.toArray,ke=Ae.warnOnce,we=oe("packages/core/src/format/date.js"),se=we.toDate,ie=we.toIsoDate,Z=oe("packages/core/src/compute/handle.js"),le=Z.bitReader,D=Z.dictSize,d=Z.dictValue,L=Z.presenceReader,T=Z.valueComparator,W=Z.valueReader,G=/^\d{4}-\d{2}-\d{2}$/,A="\0null\0";function p(o,l){const t=o&&o.pool;if(t){const h=t.mask||t.acquireMask||t.acquire||t.take;if(typeof h=="function"){const j=h.call(t,l);if(j&&j.length>=l)return j}}return new Uint8Array(l)}function f(o,l){const t=o&&o.pool;if(!t||!l)return;const h=t.release||t.releaseMask||t.free||t.recycle;typeof h=="function"&&h.call(t,l)}function w(o,l,t){return o.fill(t,0,l),o}function N(o){return o==null||typeof o=="number"&&Number.isNaN(o)}function q(o,l){if(o==null)return o;if(l==="number")return typeof o=="number"?o:Number(o);if(l==="date"||l==="dateString"){const t=ie(o);return t===null?k(o):t}return l==="boolean"?typeof o=="boolean"?o:o==="true"||o===1?!0:o==="false"||o===0?!1:!!o:o}function k(o){return o instanceof Date?o.getTime():typeof o=="number"?o:Date.parse(String(o))}function _(o){return typeof o=="number"?o:o instanceof Date?o.getTime():o==null||o===""?NaN:Number(o)}function c(o,l){const t=typeof o=="string"?o:String(o);return l?t:t.toLowerCase()}function v(o,l){return o==null?A:typeof o=="string"?l?o:o.toLowerCase():o instanceof Date?o.getTime():o}function E(o,l,t){const h=new Set;for(const j of $(o)){const U=q(j,t);h.add(v(U,l)),typeof U=="string"&&U!==""&&Number.isFinite(Number(U))?h.add(Number(U)):typeof U=="number"&&Number.isFinite(U)&&h.add(v(String(U),l))}return h}function m(o,l,t){if(o==null||l===null||l===void 0)return o==null&&l==null;const h=typeof o,j=typeof l;return h==="string"&&j==="string"?t?o===l:o.toLowerCase()===l.toLowerCase():o instanceof Date||l instanceof Date?k(o)===k(l):h==="number"&&j==="number"?o===l||Number.isNaN(o)&&Number.isNaN(l):h==="number"&&j==="string"?o===Number(l):h==="string"&&j==="number"?Number(o)===l:h==="boolean"||j==="boolean"?o===l:Array.isArray(o)&&Array.isArray(l)?o.length===l.length&&o.every((U,J)=>m(U,l[J],t)):o===l}function y(o,l){try{if(o instanceof RegExp){const t=o.flags.replace(/[gy]/g,"");return new RegExp(o.source,l||t.includes("i")?t:`${t}i`)}return new RegExp(String(o),l?"":"i")}catch(t){return ke(`regex:${String(o)}`,`filter operator "matches" received an invalid pattern: ${String(o)}`,t),null}}function P(o,l){if(o&&o.type==="datetime"&&Q.has(o.op))return ee(o,l);const t=z(o,l),h=o&&o.type;return h!=="date"&&h!=="dateString"?t:j=>t(typeof j=="string"&&G.test(j)?j:ie(j)??j)}const Q=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn"]),K=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3})\d*)?)?)?$/,ge=new Map;function re(o,l){let t=ge.get(l);if(t===void 0){try{t=new Intl.DateTimeFormat("en-CA",{timeZone:l,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{t=null}ge.set(l,t)}if(!t)return null;const h={};for(const j of t.formatToParts(o))j.type!=="literal"&&(h[j.type]=j.value);return h}function C(o,l){if(o==null||o==="")return null;if(typeof o=="string"){const U=K.exec(o.trim());if(U)return Date.UTC(+U[1],+U[2]-1,+U[3],+(U[4]||0),+(U[5]||0),+(U[6]||0),+(U[7]||"0").padEnd(3,"0"))}const t=se(o);if(!t)return null;const h=t.getUTCMilliseconds(),j=l?re(t,l):null;return j?Date.UTC(+j.year,+j.month-1,+j.day,j.hour==="24"?0:+j.hour,+j.minute,+j.second,h):Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),h)}function ee(o,l){const t=typeof o.timeZone=="string"&&o.timeZone?o.timeZone:void 0,h=J=>C(J,t),j=Array.isArray(o.value)?o.value.map(h):h(o.value),U=z({...o,type:"number",value:j},l);return J=>U(C(J))}function z(o,l){const t=o&&o.op,h=!!(o&&o.caseSensitive),j=o&&o.type,U=T(l),J=X=>de=>!X(de);switch(t){case"eq":{const X=q(o.value,j);return de=>m(de,X,h)}case"ne":{const X=q(o.value,j);return de=>!m(de,X,h)}case"lt":case"lte":case"gt":case"gte":{const X=q(o.value,j);if(N(X))return()=>!1;const de=t==="lt"?-1:t==="lte"?0:t==="gt"?1:2;return pe=>{if(N(pe))return!1;const xe=U(pe,X);return de===-1?xe<0:de===0?xe<=0:de===1?xe>0:xe>=0}}case"between":case"notBetween":{const X=$(o.value),de=q(X[0],j),pe=q(X[1],j),xe=o.bounds||"[]",ve=xe.charAt(0)!=="(",Oe=xe.charAt(1)!==")";if(N(de)||N(pe))return t==="between"?()=>!1:()=>!0;const Pe=te=>{if(N(te))return!1;const Se=U(te,de),ye=U(te,pe);return(ve?Se>=0:Se>0)&&(Oe?ye<=0:ye<0)};return t==="between"?Pe:J(Pe)}case"in":case"notIn":{const X=E(o.value,h,j),de=pe=>X.has(v(pe,h));return t==="in"?de:J(de)}case"contains":case"notContains":{const X=c(q(o.value,j),h),de=pe=>pe==null?!1:c(pe,h).includes(X);return t==="contains"?de:J(de)}case"startsWith":{const X=c(q(o.value,j),h);return de=>de==null?!1:c(de,h).startsWith(X)}case"endsWith":{const X=c(q(o.value,j),h);return de=>de==null?!1:c(de,h).endsWith(X)}case"matches":{const X=y(o.value,h);return X?de=>de==null?!1:X.test(String(de)):()=>!1}case"blank":return X=>ae(X)||Array.isArray(X)&&X.length===0;case"notBlank":return X=>!(ae(X)||Array.isArray(X)&&X.length===0);case"containsAny":case"containsNone":{const X=E(o.value,h,j),de=pe=>{const xe=pe==null?[]:$(pe);for(let ve=0;ve<xe.length;ve++)if(X.has(v(xe[ve],h)))return!0;return!1};return t==="containsAny"?de:J(de)}case"containsAll":{const X=$(o.value).map(de=>v(q(de,j),h));return de=>{const pe=de==null?[]:$(de);if(X.length===0)return!0;const xe=new Set(pe.map(ve=>v(ve,h)));for(let ve=0;ve<X.length;ve++)if(!xe.has(X[ve]))return!1;return!0}}default:{const X=R(t);return X?X.compile(o.value):(ke(`op:${String(t)}`,`unknown filter operator "${String(t)}"; the condition is refused rather than matching every row`),()=>!1)}}}function n(o,l,t){return P(l,t)(o)}const e=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),i=new Set(["containsAny","containsAll","containsNone"]);function g(o,l,t){const h=o&&o.op,j=e[h]||h,U=P({...o,op:j,type:l.type},t),J=l.items,X=de=>{const pe=J(de);if(!pe)return!1;for(let xe=0;xe<pe.length;xe++)if(U(pe[xe]))return!0;return!1};return e[h]?de=>!X(de):X}function b(o,l,t,h){const j=L(o);if(j){const X=l?1:0;for(let de=0;de<h;de++)t[de]=j(de)===X?1:0;return t}const U=o.kind;if(U==="float64"||U==="int32"||U==="bitset")return w(t,h,l?1:0);const J=W(o);for(let X=0;X<h;X++){const de=J(X),pe=ae(de)||Array.isArray(de)&&de.length===0;t[X]=pe===l?0:1}return t}function O(o,l,t,h){const j=o.dict,U=D(j),J=new Uint8Array(U);for(let xe=0;xe<U;xe++)J[xe]=l(d(j,xe))?1:0;const X=o.values,de=L(o);if(!de){for(let xe=0;xe<h;xe++)t[xe]=J[X[xe]];return t}const pe=l(null)?1:0;for(let xe=0;xe<h;xe++)t[xe]=de(xe)===1?J[X[xe]]:pe;return t}function ne(o,l,t,h){const j=le(o.values),U=l(!0)?1:0,J=l(!1)?1:0,X=L(o);if(!X){for(let pe=0;pe<h;pe++)t[pe]=j(pe)===1?U:J;return t}const de=l(null)?1:0;for(let pe=0;pe<h;pe++)t[pe]=X(pe)===0?de:j(pe)===1?U:J;return t}function H(o,l,t,h,j){const U=o.values,J=l.type,X=l.op;let de=!0;switch(X){case"eq":case"ne":{const xe=_(q(l.value,J)),ve=typeof l.value=="number"&&Number.isNaN(l.value),Oe=X==="ne"?1:0;if(ve)for(let Pe=0;Pe<j;Pe++)h[Pe]=(Number.isNaN(U[Pe])?1:0)^Oe;else for(let Pe=0;Pe<j;Pe++)h[Pe]=(U[Pe]===xe?1:0)^Oe;break}case"lt":{const xe=_(q(l.value,J));for(let ve=0;ve<j;ve++)h[ve]=U[ve]<xe?1:0;break}case"lte":{const xe=_(q(l.value,J));for(let ve=0;ve<j;ve++)h[ve]=U[ve]<=xe?1:0;break}case"gt":{const xe=_(q(l.value,J));for(let ve=0;ve<j;ve++)h[ve]=U[ve]>xe?1:0;break}case"gte":{const xe=_(q(l.value,J));for(let ve=0;ve<j;ve++)h[ve]=U[ve]>=xe?1:0;break}case"between":case"notBetween":{const xe=$(l.value),ve=_(q(xe[0],J)),Oe=_(q(xe[1],J)),Pe=l.bounds||"[]",te=Pe.charAt(0)!=="(",Se=Pe.charAt(1)!==")",ye=X==="notBetween"?1:0;if(te&&Se)for(let be=0;be<j;be++)h[be]=(U[be]>=ve&U[be]<=Oe?1:0)^ye;else if(te)for(let be=0;be<j;be++)h[be]=(U[be]>=ve&U[be]<Oe?1:0)^ye;else if(Se)for(let be=0;be<j;be++)h[be]=(U[be]>ve&U[be]<=Oe?1:0)^ye;else for(let be=0;be<j;be++)h[be]=(U[be]>ve&U[be]<Oe?1:0)^ye;break}case"in":case"notIn":{const xe=new Set;for(const Oe of $(l.value)){const Pe=_(q(Oe,J));Number.isNaN(Pe)||xe.add(Pe)}const ve=X==="notIn"?1:0;for(let Oe=0;Oe<j;Oe++)h[Oe]=(xe.has(U[Oe])?1:0)^ve;break}default:de=!1;break}if(!de)return!1;const pe=L(o);if(pe){const xe=t(null)?1:0;for(let ve=0;ve<j;ve++)pe(ve)===0&&(h[ve]=xe)}return!0}function F(o,l,t,h){const j=W(o);for(let U=0;U<h;U++)t[U]=l(j(U))?1:0;return t}function s(o,l,t){const h=l.count|0,j=t||p(l,h);if(!o)return w(j,h,1);const U=typeof l.handle=="function"?l.handle(o.col):void 0,J=typeof l.custom=="function"?l.custom:null;if(!U){if(J){for(let xe=0;xe<h;xe++)j[xe]=J(o,xe)?1:0;return j}return ke(`filter:col:${String(o.col)}`,`filter references unknown column "${String(o.col)}"; the condition is refused rather than matching every row`),w(j,h,0)}const X=o.op;if(X==="blank"||X==="notBlank")return b(U,X==="notBlank",j,h);const de=typeof l.itemwise=="function"?l.itemwise(o.col):null;if(de&&!R(X)&&!i.has(X))return F(U,g(o,de,l.locale),j,h);const pe=P(o,l.locale);switch(U.kind){case"dictionary":return O(U,pe,j,h);case"bitset":return ne(U,pe,j,h);case"float64":case"int32":return H(U,o,pe,j,h)?j:F(U,pe,j,h);default:return F(U,pe,j,h)}}function M(o,l,t){if(!o)return w(p(l,t),t,1);if(Array.isArray(o.conditions)){const h=o.conditions.filter(J=>J!=null),j=o.op==="or"?"or":o.op==="not"?"not":"and";if(h.length===0)return w(p(l,t),t,1);const U=M(h[0],l,t);for(let J=1;J<h.length;J++){const X=M(h[J],l,t);if(j==="or")for(let de=0;de<t;de++)U[de]|=X[de];else for(let de=0;de<t;de++)U[de]&=X[de];f(l,X)}if(j==="not")for(let J=0;J<t;J++)U[J]^=1;return U}return s(o,l,p(l,t))}function B(o,l){return M(o,l,l.count|0)}function I(o,l){if(!o||!l)return o||null;const t=o;if(Array.isArray(t.conditions)){if((t.op==="or"?"or":t.op==="not"?"not":"and")!=="and")return V(t,l)?null:o;const j=[];for(const U of t.conditions){const J=I(U,l);J&&j.push(J)}return j.length?{...t,op:"and",conditions:j}:null}return t.col===l?null:o}function V(o,l){if(!o||typeof o!="object")return!1;const t=o;if(t.col===l)return!0;if(Array.isArray(t.conditions)){for(const h of t.conditions)if(V(h,l))return!0}return!1}function fe(o,l,t){if(t&&t.length>=l){let J=0;for(let X=0;X<l;X++)o[X]&&(t[J++]=X);return t.subarray(0,J)}let h=0;for(let J=0;J<l;J++)h+=o[J]?1:0;const j=new Uint32Array(h);let U=0;for(let J=0;J<l;J++)o[J]&&(j[U++]=J);return j}const a=new Map;function x(o){if(!(!o||typeof o!="object"))for(const[l,t]of Object.entries(o))t&&typeof t.compile=="function"&&a.set(l,t)}function R(o){return typeof o=="string"?a.get(o):void 0}}),tt("packages/modules/charts/viewport-filter.js",function(r,oe){"use strict";Object.defineProperty(r,"VIEWPORT_FILTER_DEBOUNCE_MS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"resolveViewportFilter",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"viewportTarget",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"viewportBbox",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"sameBbox",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(r,"findColumnCondition",{enumerable:!0,get:function(){return le}}),Object.defineProperty(r,"viewportCondition",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"conditionBbox",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"pruneTarget",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"mergeViewportCondition",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"adoptedGeoView",{enumerable:!0,get:function(){return G}});const ae=oe("packages/core/src/compute/filter.js").pruneColumn,$=150,ke=1e-6;function we(A){const p={enabled:!1,column:null,debounce:$};if(A==null||A===!1)return p;const f=A===!0?{}:A;if(typeof f!="object")return p;const w=typeof f.column=="string"&&f.column?f.column:null,N=Number.isFinite(f.debounce)&&f.debounce>=0?Number(f.debounce):$;return{enabled:!0,column:w,debounce:N}}function se(A,p){return typeof p=="string"&&p?{kind:"geometry",column:p}:A&&typeof A.geometry=="string"&&A.geometry?{kind:"geometry",column:A.geometry}:A&&typeof A.lon=="string"&&A.lon&&typeof A.lat=="string"&&A.lat?{kind:"lonlat",lon:A.lon,lat:A.lat}:null}function ie(A,p){if(!A||!p||typeof A.xScale?.invert!="function"||typeof A.yScale?.invert!="function")return null;const f=A.xScale.invert(p.left),w=A.xScale.invert(p.right),N=A.yScale.invert(p.bottom),q=A.yScale.invert(p.top);if(![f,w,N,q].every(Number.isFinite))return null;const k=Math.max(-180,Math.min(f,w)),_=Math.min(180,Math.max(f,w)),c=Math.max(-90,Math.min(N,q)),v=Math.min(90,Math.max(N,q));return!(_>k)||!(v>c)?null:[k,c,_,v]}function Z(A,p){return!A||!p?!A&&!p:Math.abs(A[0]-p[0])<=ke&&Math.abs(A[1]-p[1])<=ke&&Math.abs(A[2]-p[2])<=ke&&Math.abs(A[3]-p[3])<=ke}function le(A,p){if(!A)return null;if(Array.isArray(A.conditions)){for(const f of A.conditions){const w=le(f,p);if(w)return w}return null}return A.col===p?A:null}function D(A,p,f){const[w,N,q,k]=p,_=f?{meta:{label:f}}:{};return A.kind==="geometry"?{col:A.column,op:"withinBbox",value:[w,N,q,k],..._}:{op:"and",conditions:[{col:A.lon,op:"between",value:[w,q]},{col:A.lat,op:"between",value:[N,k]}],..._}}function d(A,p){if(!A||!p)return null;if(p.kind==="geometry"){const c=le(A,p.column);if(!c||c.op!=="withinBbox"||!Array.isArray(c.value)||c.value.length<4)return null;const v=c.value.map(Number);return v.every(Number.isFinite)?v:null}const f=le(A,p.lon),w=le(A,p.lat);if(!f||f.op!=="between"||!Array.isArray(f.value)||f.value.length<2||!w||w.op!=="between"||!Array.isArray(w.value)||w.value.length<2)return null;const[N,q]=f.value.map(Number),[k,_]=w.value.map(Number);return[N,k,q,_].every(Number.isFinite)?[N,k,q,_]:null}function L(A){return A.kind==="geometry"?[A.column]:[A.lon,A.lat]}function T(A,p){let f=A||null;for(const w of L(p))f=ae(f,w);return f}function W(A,p,f){const w=T(A,p);return w?{op:"and",conditions:[...w.conditions||[w],f]}:f}function G(A,p,f,w){if(!A||!p||!f||!w||!(w.scale>0))return null;const[N,q,k,_]=A,[c,v,E,m]=p,y=k-N,P=_-q,Q=E-c,K=m-v;if(!(y>0)||!(P>0)||!(Q>0)||!(K>0))return null;const ge=(c+E)/2,re=(v+m)/2,C=f.left+(ge-N)/y*(f.right-f.left),ee=f.bottom-(re-q)/P*(f.bottom-f.top);if(!Number.isFinite(C)||!Number.isFinite(ee))return null;const z=(f.left+f.right)/2,n=(f.top+f.bottom)/2,e=z-C,i=n-ee,[g,b]=w.offset,O=[g-e/w.scale,b+i/w.scale],ne=Math.min(y/Q,P/K);return!Number.isFinite(ne)||ne<=0?null:{zoom:Math.min(8,Math.max(1,w.zoom*ne)),offset:O}}}),tt("packages/modules/charts/mapview.js",function(r,oe){"use strict";Object.defineProperty(r,"MAP_ENGINE_TYPES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(r,"DEFAULT_VIEWPORT_CAP",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"DENSITY_CELLS_ACROSS",{enumerable:!0,get:function(){return N}}),Object.defineProperty(r,"DENSITY_FIT_PASSES",{enumerable:!0,get:function(){return q}}),Object.defineProperty(r,"FRAME_REFIT_RATIO",{enumerable:!0,get:function(){return k}}),Object.defineProperty(r,"viewportCap",{enumerable:!0,get:function(){return v}}),Object.defineProperty(r,"densityCellSize",{enumerable:!0,get:function(){return E}}),Object.defineProperty(r,"boxSpan",{enumerable:!0,get:function(){return m}}),Object.defineProperty(r,"ringsBox",{enumerable:!0,get:function(){return y}}),Object.defineProperty(r,"needsRefit",{enumerable:!0,get:function(){return P}}),Object.defineProperty(r,"frameMoved",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(r,"planMapViewport",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(r,"engineRowsReader",{enumerable:!0,get:function(){return re}}),Object.defineProperty(r,"frameOf",{enumerable:!0,get:function(){return C}}),Object.defineProperty(r,"capClientBound",{enumerable:!0,get:function(){return z}});const ae=oe("packages/core/src/source/pushdown.js").planQuery,ke=oe("packages/core/src/source/aggregates.js").resolveAggregatePlan,se=oe("packages/core/src/internal/util.js").warnOnce,ie=oe("packages/modules/shared/engine.js"),Z=ie.engineSource,le=ie.gridEngineRequest,D=ie.loadedAndMatching,d=ie.sourceId,T=oe("packages/modules/charts/engine.js").aggregateMode,W=oe("packages/modules/charts/viewport-filter.js"),G=W.conditionBbox,A=W.viewportCondition,p=W.viewportTarget,f=Object.freeze(new Set(["markermap","bubblemap","choropleth"])),w=2e4,N=24,q=8,k=2,_="__viewport_rows",c=/^[A-Za-z_][A-Za-z0-9_$]*$/;function v(n){const e=n?n.viewportCap:void 0;return e==null?w:typeof e=="number"&&Number.isInteger(e)&&e>0?e:(se(`chart:viewportCap:${String(e)}`,`chart viewportCap ${JSON.stringify(e)} is not a positive whole number of rows; the map used ${w}.`),w)}function E(n){const e=Number.isFinite(n)&&n>0?Math.min(360,n):360,i=2**Math.floor(Math.log2(e/N));return Math.min(90,Math.max(2**-20,i))}function m(n){return Math.max(n[2]-n[0],n[3]-n[1])}function y(n){let e=1/0,i=1/0,g=-1/0,b=-1/0;for(const O of n||[])for(const[ne,H]of O)!Number.isFinite(ne)||!Number.isFinite(H)||(e=Math.min(e,ne),g=Math.max(g,ne),i=Math.min(i,H),b=Math.max(b,H));return g>=e&&b>=i?[e,i,g,b]:null}function P(n,e){if(!n||!e)return!1;for(const[i,g]of[[0,2],[1,3]]){const b=n[g]-n[i],O=e[g]-e[i];if(!(b>0)||!(O>0))continue;const ne=b/O;if(ne>k||ne<1/k)return!0}return!1}function Q(n,e){if(!n||!e)return!!e;const i=1e-9;return!(e[0]>=n[0]-i&&e[1]>=n[1]-i&&e[2]<=n[2]+i&&e[3]<=n[3]+i)||P(n,e)}function K(n,e,i){const g=n.columns.get(e);if(!g)return`the ${i} column "${e}" is not a column of the grid`;const b=g.value&&typeof g.value=="object"?g.value:null;return g.computed||b&&(typeof b.get=="function"||typeof b.compute=="function")?`the ${i} column "${e}" is computed by the grid, which the engine cannot reproduce`:(typeof g.field=="string"?g.field:e)!==e||!c.test(e)?`the ${i} column "${e}" is not a plain physical column the engine can name`:""}function ge(n,e,i,g){const b=T(e),O=ve=>({mode:"client",asked:b,reason:ve,refused:b==="engine"});if(b==="client")return{...O("aggregate: 'client' was asked for"),refused:!1};if(!f.has(i))return O(`a "${i}" chart does not draw a viewport`);if(e.rows)return O("the chart was handed its own rows");const ne=p(e);if(!ne)return O("the map names neither a geometry column nor lon/lat columns");if(ne.kind==="geometry"&&(e.lon||e.lat))return O("the map names both a geometry column and lon/lat columns");const H=ne.kind==="geometry"?[ne.column]:[ne.lon,ne.lat];for(const ve of H){const Oe=K(n,ve,"placement");if(Oe)return O(Oe)}const F=Z(n);if("reason"in F)return O(F.reason);const{source:s,caps:M}=F,B=s.adapter;if(!B||typeof B.execute!="function")return O("the source's adapter has no execute() to fetch rows with");const I=H[0],V=ke([{id:_,col:I,fn:"count"}],s.aggregates);if(V.client.length)return O(`the source computes "count" client-side (${V.client[0].reason}); set the pushdown source's \`aggregates: { default: 'engine' }\` to count in the engine`);const fe=Array.isArray(g&&g.bbox)?g.bbox:null,a=fe?A(ne,fe):null,x=le(n,F,a);if("reason"in x)return O(x.reason);if(b==="auto"){const{loaded:ve,total:Oe}=D(n);if(Number.isFinite(Oe)&&ve>=Oe)return O("the grid holds every matching row")}const R=v(e),o=fe||G(n.filters&&typeof n.filters.get=="function"?n.filters.get():null,ne),l=o?E(m(o)):null,t=ne.kind==="geometry"&&i!=="choropleth"&&Array.isArray(M.buckets)&&M.buckets.includes("grid")&&typeof B.executeGroupedAggregates=="function",h=i==="choropleth"?"a choropleth draws each shape, and has no density form":ne.kind!=="geometry"?"the engine bins a geometry column, and this map places its rows by lon/lat":"the source's adapter cannot bin a geometry column into grid cells (no `buckets` capability)",{request:j,quick:U}=x,J=le(n,F),X=JSON.stringify([d(s),"request"in J?J.request.filters:null,U]),de=JSON.stringify([d(s),j.filters,U,ne,R,i]),pe=JSON.stringify([de,t?l||"fit":0]);return{mode:"engine",asked:b,key:pe,rowsKey:de,baseKey:X,cap:R,bbox:fe,box:o,cellSize:l,run:async ve=>{const Oe=ve?{signal:ve}:{},Pe=await s.aggregate({...j,...Oe},[{id:_,col:I,fn:"count"}]);if(Pe&&Array.isArray(Pe.client)&&Pe.client.length)return{map:!0,refused:`the source counted client-side (${Pe.client[0].reason})`};const te=Number(Pe&&Pe.values?Pe.values[_]:NaN);if(!Number.isFinite(te))return{map:!0,refused:"the engine did not report a count for the view"};if(te<=R){const be={...j,range:{start:0,end:R}},Ne=ae(be,M).pushed,je=await B.execute({...Ne,...Oe},{...be,...Oe});return{map:!0,kind:"rows",rows:(je&&Array.isArray(je.rows)?je.rows:[]).slice(0,R),count:te,cap:R,bbox:fe,rowsKey:de}}if(!t)return{map:!0,kind:"over",count:te,cap:R,bbox:fe,reason:h};let Se=l||E(360),ye=[];for(let be=1;;be++){const Ne=await s.aggregate({...j,groupBy:[{col:ne.column,bucket:"grid",size:Se}],...Oe},[{id:_,col:I,fn:"count"}]);if(Ne&&Array.isArray(Ne.client)&&Ne.client.length)return{map:!0,kind:"over",count:te,cap:R,bbox:fe,reason:`the source binned client-side (${Ne.client[0].reason})`};ye=[];for(const Ce of Ne&&Ne.groups||[]){if(!Ce||Ce.level!==1||!Array.isArray(Ce.keys)||!Array.isArray(Ce.keys[0]))continue;const[Fe,We]=Ce.keys[0].map(Number),wt=Number(Ce.values?Ce.values[_]:NaN);!Number.isFinite(Fe)||!Number.isFinite(We)||!(wt>0)||ye.push({west:Fe*Se,south:We*Se,east:(Fe+1)*Se,north:(We+1)*Se,count:wt})}if(l||be>=q)break;const je=y(C([],ye));if(!je)break;const Ee=E(m(je));if(Ee>=Se)break;Se=Ee}return{map:!0,kind:"density",cells:ye,count:te,cap:R,bbox:fe,size:Se}}}}function re(n,e){const i=typeof n.config=="function"?n.config():{},g=i&&typeof i.rowKey=="string"?i.rowKey:null,b=n.permissions&&typeof n.permissions.levelOf=="function"?n.permissions:null,O=new Map,ne=e.map((s,M)=>{const B=g&&s&&s[g]!==void 0&&s[g]!==null?s[g]:`engine:${M}`,I=O.has(B)?`engine:${M}`:B,V={key:I,data:s,group:!1};return O.set(I,V),V}),H=s=>{if(!b)return!0;const M=b.levelOf(s);return M==="read"||M==="write"},F=(s,M)=>{const B=O.get(s);if(!B||!H(M))return;const I=n.columns.get(M),V=I&&typeof I.field=="string"?I.field:M,fe=B.data?B.data[V]:void 0,a=I&&I.dataType;if(a&&typeof a.toStorage=="function"&&fe!==null&&fe!==void 0)try{return a.toStorage(fe,{colId:M})}catch{return null}return fe};return{columns:n.columns,formatting:n.formatting,messages:n.messages,rows:{count:()=>ne.length,get:s=>ne[s],value:F,text:(s,M)=>{const B=F(s,M);if(B==null)return"";const I=n.columns.get(M);if(I&&typeof I.formatValue=="function")try{const V=I.formatValue(B,O.get(s));if(typeof V=="string")return V}catch{}return String(B)}}}}function C(n,e=[]){let i=1/0,g=1/0,b=-1/0,O=-1/0;for(const B of n||[])!Number.isFinite(B.lon)||!Number.isFinite(B.lat)||(i=Math.min(i,B.lon),b=Math.max(b,B.lon),g=Math.min(g,B.lat),O=Math.max(O,B.lat));for(const B of e||[])i=Math.min(i,B.west),b=Math.max(b,B.east),g=Math.min(g,B.south),O=Math.max(O,B.north);if(!(b>=i)||!(O>=g))return null;const ne=(B,I)=>Math.max(-I,Math.min(I,B)),H=ne(i,180),F=ne(b,180),s=ne(g,90),M=ne(O,90);return[[[H,s],[F,s],[F,M],[H,M]]]}function ee(n,e){if(!e)return!0;const[i,g,b,O]=e,ne=(H,F)=>H>=i&&H<=b&&F>=g&&F<=O;if(n.point)return ne(n.point[0],n.point[1]);for(const H of n.polygons||[])for(const F of H)for(const[s,M]of F)if(ne(s,M))return!0;return!1}function z(n,e,i,g){const b=v(i),O=g&&Array.isArray(g.bbox)?g.bbox:null;if(!e||!f.has(n))return{bound:e,viewport:null};if(n==="choropleth"){const x=e.features||[];if(x.length<=b)return{bound:e,viewport:null};let R=0;for(const t of x)ee(t,O)&&R++;if(R<=b)return{bound:e,viewport:null};const o=[];for(const t of x){t.point&&o.push({lon:t.point[0],lat:t.point[1]});for(const h of t.polygons||[])for(const j of h)for(const[U,J]of j)o.push({lon:U,lat:J})}const l="a choropleth draws each shape, and has no density form";return{bound:{...e,features:[],empty:!1,over:{count:R,cap:b,reason:l},frame:e.frame||C(o)},viewport:{rows:0,matched:R,cap:b,binned:!1,cells:0,over:l,bbox:O?[...O]:null,computed:"client"}}}const ne=e.points||[];if(ne.length<=b)return{bound:e,viewport:null};const[H,F,s,M]=O||[-1/0,-1/0,1/0,1/0],B=ne.filter(x=>x.lon>=H&&x.lon<=s&&x.lat>=F&&x.lat<=M);if(B.length<=b)return{bound:e,viewport:null};const I=O||y([B.map(x=>[x.lon,x.lat])]),V=E(I?m(I):360),fe=new Map;for(const x of B){const R=Math.floor(x.lon/V),o=Math.floor(x.lat/V),l=`${R}:${o}`,t=fe.get(l)||{west:R*V,south:o*V,east:(R+1)*V,north:(o+1)*V,count:0};t.count++,fe.set(l,t)}const a=[...fe.values()];return{bound:{...e,density:{cells:a,size:V},frame:e.frame||C(ne)},viewport:{rows:0,matched:B.length,cap:b,binned:!0,cells:a.length,over:null,bbox:O?[...O]:null,computed:"client"}}}}),tt("packages/modules/charts/rampscale.js",function(r,oe){"use strict";Object.defineProperty(r,"AUTO_LOG_RATIO",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(r,"QUANTILE_CLASSES",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(r,"chooseRampScale",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(r,"logTicks",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"quantileCuts",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"placeOnRamp",{enumerable:!0,get:function(){return Z}});const Ae=100,ae=5;function $(le){const D=[];for(const d of le||[])typeof d=="number"&&Number.isFinite(d)&&d>0&&D.push(d);return D}function ke(le,D){const d=$(le);let L=1/0,T=0;for(const G of d)G<L&&(L=G),G>T&&(T=G);const W=d.length?T/L:0;return D?{scale:D,auto:!1,ratio:W}:W>Ae?{scale:"log",auto:!0,ratio:W}:{scale:"linear",auto:!1,ratio:W}}function we(le){return Number(le.toPrecision(12))}function se(le,D){if(!(le>0)||!(D>=le)||!Number.isFinite(D))return[];const d=A=>A>=le*(1-1e-9)&&A<=D*(1+1e-9),L=Math.floor(Math.log10(le)+1e-9),T=Math.floor(Math.log10(D)+1e-9),W=[],G=Math.log10(D/le);for(let A=L;A<=T;A++){const p=G>=2?[1]:[1,2,5];for(const f of p){const w=we(f*10**A);d(w)&&W.push(w)}}return W}function ie(le,D=ae){const d=[];for(const T of le||[])typeof T=="number"&&Number.isFinite(T)&&d.push(T);if(!d.length)return[];d.sort((T,W)=>T-W);const L=[];for(let T=1;T<D;T++){const W=(d.length-1)*(T/D),G=Math.floor(W),A=Math.min(d.length-1,G+1);L.push(we(d[G]+(W-G)*(d[A]-d[G])))}return L}function Z(le,D,d){if(le==="log"){let T=$(d);T.length||(T=$([D.min,D.max]));let W=1/0,G=0;for(const w of T)w<W&&(W=w),w>G&&(G=w);T.length||(W=1,G=1);const A=Math.log10(W),p=Math.log10(G)-A||1,f=w=>typeof w!="number"||!Number.isFinite(w)||w<=0?0:Math.min(1,Math.max(0,(Math.log10(w)-A)/p));return{position:f,domain:{min:W,max:G},ticks:se(W,G).map(w=>({value:w,t:f(w)})),classes:0}}if(le==="quantile"){const T=ie(d),W=T.length+1;let G=1/0,A=-1/0;for(const f of d||[])typeof f!="number"||!Number.isFinite(f)||(f<G&&(G=f),f>A&&(A=f));return G>A&&(G=D.min,A=D.max),{position:f=>{if(typeof f!="number"||!Number.isFinite(f))return 0;let w=0;for(;w<T.length&&f>=T[w];)w++;return W>1?w/(W-1):0},domain:{min:G,max:A},ticks:T.map((f,w)=>({value:f,t:(w+1)/W})),classes:W}}const L=D.max-D.min||1;return{position:T=>(T-D.min)/L,domain:{min:D.min,max:D.max},ticks:[],classes:0}}}),tt("packages/modules/charts/matrix.js",function(r,oe){"use strict";Object.defineProperty(r,"colourRamp",{enumerable:!0,get:function(){return R}}),Object.defineProperty(r,"drawHeatmap",{enumerable:!0,get:function(){return o}}),Object.defineProperty(r,"drawFunnel",{enumerable:!0,get:function(){return l}}),Object.defineProperty(r,"drawCandlestick",{enumerable:!0,get:function(){return t}}),Object.defineProperty(r,"VOLUME_PANE_HEIGHT",{enumerable:!0,get:function(){return h}}),Object.defineProperty(r,"splitPanes",{enumerable:!0,get:function(){return j}}),Object.defineProperty(r,"clearVolumePane",{enumerable:!0,get:function(){return J}}),Object.defineProperty(r,"drawCorrelogram",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(r,"title",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(r,"cellAt",{enumerable:!0,get:function(){return Pe}});const ae=oe("packages/modules/charts/frame.js").Pool,$=oe("packages/modules/charts/axis.js"),ke=$.drawAxisLines,we=$.drawBandLabels,se=$.drawCategoryAxis,ie=$.drawContinuousAxis,Z=$.drawMeasureAxis,le=$.leftLabelRoom,D=$.overhangFor,d=$.setLabelText,L=$.setPlotClip,T=oe("packages/modules/charts/cartesian.js"),W=T.continuousSlot,G=T.drawReferenceLines,A=T.slotPadFor,p=T.xScaleFor,f=oe("packages/modules/charts/format.js"),w=f.formatters,N=f.measureText,q=oe("packages/modules/charts/scale.js"),k=q.bandScale,_=q.isNumber,c=q.linearTicks,v=q.measureDomain,E=q.toNumber,m=q.toTime,y=oe("packages/modules/charts/svg.js"),P=y.attrs,Q=y.path,K=y.round,ge=y.setText,re=y.SVG_NS,ee=oe("packages/modules/charts/typography.js").applySize,n=oe("packages/modules/charts/styles.js").NS,e=oe("packages/modules/charts/scheme.js"),i=e.rampStops,g=e.resolveScheme,b=oe("packages/modules/charts/rampscale.js"),O=b.chooseRampScale,ne=b.placeOnRamp,F=oe("packages/core/src/internal/util.js").warnOnce,s=oe("packages/modules/charts/labels.js"),M=s.drawAnchoredLabels,B=s.labelText,V=oe("packages/modules/charts/annotations.js").drawAnnotations,fe=Object.freeze([[236,243,249],[0,82,128]]),a=Object.freeze([[176,74,0],[247,247,247],[0,82,128]]);function x(te,Se,ye){const be=Math.min(1,Math.max(0,ye)),Ne=je=>Math.round(te[je]+(Se[je]-te[je])*be);return`rgb(${Ne(0)} ${Ne(1)} ${Ne(2)})`}function R(te,Se,ye,be){const Ne=ye?i(ye,Se):Se?a:fe,je=ye&&ye.rampScale?ye.rampScale:null;if(Se){je&&je!=="linear"&&F("chart:ramp:diverging-scale",`chart "ramp.scale" was "${je}" on a diverging ramp, which is always linear and centred on zero; the scale was not applied. Drop "diverging" to colour by a log or quantile scale.`);const st=Math.max(Math.abs(te.min),Math.abs(te.max))||1,Qe=pt=>pt>=0?x(Ne[1],Ne[2],pt/st):x(Ne[1],Ne[0],-pt/st),rt=te.max-te.min||1;return Object.assign(Qe,{scale:"linear",auto:!1,ratio:0,position:pt=>(pt-te.min)/rt,colourAt:pt=>Qe(te.min+pt*rt),domain:{min:te.min,max:te.max},ticks:[],classes:0})}const Ee=O(be||[te.min,te.max],je),Ce=ne(Ee.scale,te,be||[te.min,te.max]),Fe=Ne[0],We=Ne[Ne.length-1],wt=st=>x(Fe,We,st);return Object.assign(st=>wt(Ce.position(st)),{scale:Ee.scale,auto:Ee.auto,ratio:Ee.ratio,position:Ce.position,colourAt:wt,domain:Ce.domain,ticks:Ce.ticks,classes:Ce.classes})}function o(te){const Se=te.scheme||g(),{plot:ye,bound:be}=te;new ae(te.groups.grid).finish(),new ae(te.groups.axis).finish(),new ae(te.groups.rules).finish(),new ae(te.groups.labels).finish();const Ne=be.series.filter(lt=>!te.hidden.has(lt.key)),je=[];for(const lt of Ne)for(const st of lt.points)je.push(st.y);const Ee=v(je,{zero:!1,nice:!1}),Ce=R(Ee,!!te.diverging,Se,je),Fe=k(be.categories,[ye.left,ye.right],.04),We=k(Ne.map(lt=>lt.label),[ye.top,ye.bottom],.04),wt=new ae(te.groups.marks);for(const lt of Ne){const st=We.of(lt.label);if(!Number.isNaN(st))for(let Qe=0;Qe<lt.points.length;Qe++){const rt=lt.points[Qe],pt=Fe.of(rt.x);if(Number.isNaN(pt))continue;const Ht=wt.next("rect",`${n}__cell ${n}__mark`);P(Ht,{x:K(pt),y:K(st),width:K(Fe.bandwidth),height:K(We.bandwidth),fill:_(rt.y)?Ce(rt.y):"transparent","data-series":lt.index,"data-point":Qe}),rt.px=K(pt+Fe.bandwidth/2),rt.py=K(st+We.bandwidth/2)}}if(wt.finish(),se({group:te.groups.overlay,plot:ye,scale:Fe,labels:be.labels,fontSize:te.fontSize,rotated:be.labels.length>6,config:te.axis&&te.axis.x||{}}),we({group:te.groups.axis,plot:ye,scale:We,labels:Ne.map(lt=>lt.label),fontSize:te.fontSize,config:te.axis&&te.axis.y||{}}),te.labels&&te.labels.show){const lt=te.typography&&te.typography.small||te.fontSize||11,st=[];for(const Qe of Ne)for(const rt of Qe.points)rt.px===void 0||!_(rt.y)||st.push({x:rt.px,y:rt.py,text:B(rt.y,te.labels,te.grid),inside:!0,width:Fe.bandwidth-4,height:We.bandwidth-2});M({group:te.groups.labels,size:lt,minGap:0,anchors:st})}return{xScale:Fe,yScale:We,series:Ne,ramp:Ce,domain:Ee}}function l(te){const Se=te.scheme||g(),{plot:ye,bound:be}=te;new ae(te.groups.grid).finish(),new ae(te.groups.axis).finish(),new ae(te.groups.rules).finish(),new ae(te.groups.labels).finish();const Ne=be.series[0],je=Ne?Ne.points.map((st,Qe)=>({point:st,label:be.labels[Qe],value:_(st.y)?st.y:0})).filter(st=>st.value>0):[];if(!je.length)return{stages:je};let Ee=0;for(let st=0;st<je.length;st++)je[st].value>Ee&&(Ee=je[st].value);const Ce=ye.height/je.length,Fe=ye.left+ye.width/2,We=ye.width*.62,wt=new ae(te.groups.marks);je.forEach((st,Qe)=>{const rt=je[Qe+1],pt=ye.top+Qe*Ce,Ht=st.value/Ee*We/2,kt=(rt?rt.value:st.value)/Ee*We/2;P(wt.next("path",`${n}__funnel ${n}__mark`),{d:Q(["M",K(Fe-Ht),K(pt),"L",K(Fe+Ht),K(pt),"L",K(Fe+kt),K(pt+Ce-2),"L",K(Fe-kt),K(pt+Ce-2),"Z"]),fill:Se.series(Qe),"data-point":Qe}),st.point.px=K(Fe),st.point.py=K(pt+Ce/2)}),wt.finish();const lt=new ae(te.groups.overlay);return je.forEach((st,Qe)=>{const rt=ye.top+Qe*Ce,pt=lt.next("text",`${n}__funnel-label`);P(pt,{x:K(ye.left+4),y:K(rt+Ce/2),"text-anchor":"start","dominant-baseline":"middle"}),ge(pt,st.label);const Ht=lt.next("text",`${n}__funnel-value`);P(Ht,{x:K(ye.right-4),y:K(rt+Ce/2),"text-anchor":"end","dominant-baseline":"middle"});const kt=Qe===0?1:st.value/je[Qe-1].value,Gt=te.labels&&te.labels.show?B(st.value,te.labels,te.grid):N(st.value,te.grid.messages);ge(Ht,Qe===0?Gt:`${Gt} · ${Math.round(kt*100)}%`)}),lt.finish(),{stages:je}}function t(te){const Se=te.scheme||g(),{bound:ye}=te,[be,Ne,je,Ee]=ye.series;if(!be||!Ne||!je||!Ee)return J(te.groups),{xScale:null,yScale:null,series:[]};const Ce=te.ohlc?"ohlc":"candlestick",Fe=te.volume&&ye.series.find((ft,yt)=>yt>=4&&ft.key===te.volume)||null,We=Fe?j(te.plot,te.volumeHeight,te.fontSize):null,wt=We?We.price:te.plot,lt=te.plot,st=[];for(const ft of[Ne,je])for(const yt of ft.points)st.push(yt.y);const Qe=ye.yDomain||v(st,{zero:!1}),rt={...k([],[0,0])},pt=pe(Qe,wt),Ht=te.axis&&te.axis.x||{},kt=te.axis&&te.axis.y||{},Gt=p(ye,lt,Ce,Ht),Vt=Gt.kind==="band",Ye=Vt?Gt.bandwidth:W({bound:ye,scale:Gt,config:Ht,padding:A(Ce)});Z({gridGroup:te.groups.grid,axisGroup:te.groups.axis,plot:wt,scale:pt,side:kt.position==="right"?"right":"left",format:w(te.grid,{kind:"linear",step:(Qe.max-Qe.min)/5})}),ke({group:te.groups.rules,plot:wt,side:kt.position==="right"?"right":"left"}),Array.isArray(te.reference)&&te.reference.length&&G({group:te.groups.grid,plot:wt,scale:pt,lines:te.reference});const et=Fe?X({ctx:te,pane:We.volume,series:Fe,side:kt.position==="right"?"right":"left"}):null;if(Fe||J(te.groups),Vt)se({group:te.groups.overlay,plot:lt,scale:Gt,labels:ye.labels,fontSize:te.fontSize,rotated:ye.labels.length>10,config:Ht});else{const ft=ye.dimension&&ye.dimension.col?te.grid.columns.get(ye.dimension.col):void 0;ie({group:te.groups.overlay,plot:lt,scale:Gt,format:w(te.grid,{kind:ye.kind,span:Gt.domain.max-Gt.domain.min,step:(Gt.domain.max-Gt.domain.min)/5},ft),config:Ht,grid:te.grid,size:te.fontSize})}Vt||L(te.groups,lt,D("candlestick"));const gt=new ae(te.groups.marks);for(let ft=0;ft<ye.categories.length;ft++){const yt=be.points[ft],Ct=Ne.points[ft],ot=je.points[ft],dt=Ee.points[ft];if(![yt,Ct,ot,dt].every(an=>an&&_(an.y)))continue;const it=Vt?Gt.of(ye.categories[ft])+Ye/2:de(Gt,ye.kind,ye.categories[ft]);if(Number.isNaN(it))continue;const bt=Vt?it-Ye/2:Math.max(lt.left,it-Ye/2),Jt=Vt?it+Ye/2:Math.min(lt.right,it+Ye/2),en=bt,Mt=Math.max(1,Jt-bt),Lt=dt.y>=yt.y,zt=Lt?Se.positive:Se.negative;P(gt.next("path",`${n}__wick ${n}__mark`),{d:Q(["M",K(it),K(pt.of(Ct.y)),"L",K(it),K(pt.of(ot.y))]),stroke:zt,fill:"none"});const Yt=pt.of(Math.max(yt.y,dt.y)),xn=pt.of(Math.min(yt.y,dt.y));if(te.ohlc){const an=Math.max(1.5,Ye*.2),wn=K(pt.of(yt.y)),on=K(pt.of(dt.y));P(gt.next("path",`${n}__ohlc-tick ${n}__mark`),{d:Q(["M",K(it-an),wn,"L",K(it),wn]),stroke:zt,fill:"none"}),P(gt.next("path",`${n}__ohlc-tick ${n}__mark`),{d:Q(["M",K(it),on,"L",K(it+an),on]),stroke:zt,fill:"none"}),dt.px=K(it),dt.py=on}else P(gt.next("rect",`${n}__candle ${n}__mark`),{x:K(en),y:K(Yt),width:K(Mt),height:K(Math.max(1,xn-Yt)),fill:Lt?"transparent":zt,stroke:zt,"data-point":ft}),dt.px=K(it),dt.py=K(Yt);const pn=Fe?Fe.points[ft]:null;if(pn&&_(pn.y)){const an=et.of(Math.max(et.domain.min,0)),wn=et.of(pn.y);P(gt.next("rect",`${n}__volume ${n}__mark`),{x:K(en),y:K(Math.min(an,wn)),width:K(Mt),height:K(Math.abs(an-wn)),fill:zt,"data-point":ft,"data-direction":Lt?"up":"down"}),pn.px=K(it),pn.py=K(wn)}}gt.finish();let ut=null;Array.isArray(te.annotations)&&te.annotations.length&&(ut=V({group:te.groups.overlay,plot:wt,xScale:Gt,yScale:pt,rightScale:null,series:ye.series,annotations:te.annotations,dual:!1,format:w(te.grid,{kind:"linear",step:(Qe.max-Qe.min)/5}).tick,size:te.fontSize}));const Ue={xScale:Gt,yScale:pt,series:Fe?[Ee,Fe]:[Ee],candles:ye.categories.length,annotations:ut};return Fe&&(Ue.volumeScale=et,Ue.panes={price:We.price,volume:We.volume}),Ue}const h=.25;function j(te,Se,ye){const be=Number.isFinite(Se)&&Se>0&&Se<1?Number(Se):h,Ne=Math.round(Number.isFinite(ye)&&ye>0?ye:11),je=Math.max(0,te.height-Ne),Ee=Math.round(je*be),Ce=je-Ee,Fe={...te,bottom:te.top+Ce,height:Ce},We={...te,top:te.bottom-Ee,height:Ee};return{price:Fe,volume:We,gap:Ne}}function U(te,Se){const ye={grid:null,rules:null,axis:null};if(!te)return ye;for(const be of["grid","rules","axis"]){const Ne=te[be],je=Ne&&Ne.parentNode;if(!je)continue;const Ee=`${n}__pane-${be}`,Ce=[...je.childNodes||[]];let Fe=Ce.find(We=>String(We.getAttribute&&We.getAttribute("class")||"").split(" ").includes(Ee))||null;if(!Fe&&Se){Fe=je.ownerDocument.createElementNS(re,"g"),Fe.setAttribute("class",`${Ne.getAttribute("class")} ${Ee}`);const We=Ce[Ce.indexOf(Ne)+1]||null;We?je.insertBefore(Fe,We):je.appendChild(Fe)}ye[be]=Fe}return ye}function J(te){const Se=U(te,!1);for(const ye of Object.values(Se))ye&&new ae(ye).finish()}function X(te){const{ctx:Se,pane:ye,series:be}=te,Ne=U(Se.groups,!0),je=be.points.map(Fe=>Fe&&Fe.y).filter(_),Ee=v(je,{zero:!0,ticks:2}),Ce={...pe(Ee,ye),ticks(Fe=2){return c(Ee,Fe)}};return Z({gridGroup:Ne.grid,axisGroup:Ne.axis,plot:ye,scale:Ce,side:te.side,config:{ticks:2},format:w(Se.grid,{kind:"linear",step:(Ee.max-Ee.min)/2})}),ke({group:Ne.rules,plot:ye,side:te.side}),Ce}function de(te,Se,ye){const be=Se==="time"?m(ye):E(ye);return be===null?NaN:te.of(be)}function pe(te,Se){const ye=te.max-te.min||1,be=Se.top-Se.bottom;return{kind:"linear",domain:te,range:[Se.bottom,Se.top],of(Ne){return Se.bottom+(Ne-te.min)/ye*be},invert(Ne){return te.min+(Ne-Se.bottom)/be*ye},ticks(Ne=5){const je=[];for(let Ee=0;Ee<=Ne;Ee++)je.push(te.min+ye*Ee/Ne);return je}}}function xe(te){const Se=te.scheme||g(),{plot:ye}=te;new ae(te.groups.grid).finish(),new ae(te.groups.rules).finish(),new ae(te.groups.labels).finish();const be=te.columns||[];if(be.length<2)return null;const Ne=te.grid&&te.grid.statistics;if(!Ne)return null;const je=te.method==="spearman"?"spearman":te.method==="kendall"?"kendall":"correlation",Ee=[];for(let Qe=0;Qe<be.length;Qe++)for(let rt=0;rt<be.length;rt++){const pt=Qe===rt?1:Ne[je](be[Qe],be[rt]);Ee.push({row:Qe,col:rt,a:be[Qe],b:be[rt],r:pt})}const Ce=be.length,Fe=ye.width/Ce,We=ye.height/Ce,wt=new ae(te.groups.marks);for(const Qe of Ee){const rt=ye.left+Qe.col*Fe,pt=ye.top+Qe.row*We;Qe.x=rt,Qe.y=pt,Qe.width=Fe,Qe.height=We;const Ht=wt.next("rect",`${n}__cell ${n}__mark`);P(Ht,{x:K(rt),y:K(pt),width:K(Math.max(0,Fe-1)),height:K(Math.max(0,We-1)),fill:Qe.row===Qe.col||Qe.r===null?"var(--lattice-chart-empty, #eceff1)":ve(Qe.r,Se),"data-row":Qe.row,"data-col":Qe.col}),Qe.element=Ht}wt.finish();const lt=new ae(te.groups.overlay),st=le(ye);for(let Qe=0;Qe<Ce;Qe++){const rt=lt.next("text",`${n}__tick`);ee(rt,te.fontSize),P(rt,{x:K(ye.left-4),y:K(ye.top+Qe*We+We/2),"text-anchor":"end","dominant-baseline":"middle"}),d(rt,Oe(te.grid,be[Qe]),st,te.fontSize);const pt=lt.next("text",`${n}__tick`);ee(pt,te.fontSize),P(pt,{x:K(ye.left+Qe*Fe+Fe/2),y:K(ye.top-4),"text-anchor":"middle"}),d(pt,Oe(te.grid,be[Qe]),Fe,te.fontSize)}if(te.values!==!1&&Fe>te.fontSize*2.6&&We>te.fontSize*1.5)for(const Qe of Ee){if(Qe.row===Qe.col||Qe.r===null)continue;const rt=lt.next("text",`${n}__data-label`);ee(rt,te.fontSize),P(rt,{x:K(ye.left+Qe.col*Fe+Fe/2),y:K(ye.top+Qe.row*We+We/2),"text-anchor":"middle","dominant-baseline":"middle","data-inside":"true"}),ge(rt,Qe.r.toFixed(2))}return lt.finish(),{cells:Ee,columns:be}}function ve(te,Se){const ye=Math.min(1,Math.abs(te)),be=Se?i(Se,!0):a,Ne=be[Math.floor(be.length/2)],je=te>=0?be[be.length-1]:be[0];return x(Ne,je,ye)}function Oe(te,Se){const ye=te&&te.columns&&typeof te.columns.get=="function"?te.columns.get(Se):null;return String(ye&&ye.title||Se)}function Pe(te){for(const Se of te.cells||[])if(Se.x!==void 0&&te.x>=Se.x&&te.x<=Se.x+Se.width&&te.y>=Se.y&&te.y<=Se.y+Se.height)return Se;return null}}),tt("packages/modules/charts/mapdensity.js",function(r,oe){"use strict";Object.defineProperty(r,"drawDensityCells",{enumerable:!0,get:function(){return d}});const Ae=oe("packages/modules/charts/svg.js"),ae=Ae.attrs,$=Ae.path,ke=Ae.round,se=oe("packages/modules/charts/scale.js").measureDomain,Z=oe("packages/modules/charts/matrix.js").colourRamp,D=oe("packages/modules/charts/styles.js").NS;function d(L){const{pool:T,cells:W,to:G,plot:A,scheme:p}=L;let f=0;for(const _ of W)_.count>f&&(f=_.count);const w=se([0,f],{zero:!0}),N=Z(w,!1,p,W.map(_=>_.count)),q=(_,c)=>{const[v,E]=G(_,c);return!Number.isFinite(v)||!Number.isFinite(E)?null:[Math.min(Math.max(v,A.left),A.right),Math.min(Math.max(E,A.top),A.bottom)]};let k=0;for(const _ of W){const c=[q(_.west,_.south),q(_.east,_.south),q(_.east,_.north),q(_.west,_.north)];if(c.some(y=>y===null))continue;const v=c.map(y=>y[0]),E=c.map(y=>y[1]);if(Math.max(...v)-Math.min(...v)<.5||Math.max(...E)-Math.min(...E)<.5)continue;const m=[];c.forEach((y,P)=>m.push(P?"L":"M",ke(y[0]),ke(y[1]))),m.push("Z"),ae(T.next("path",`${D}__density-cell ${D}__mark`),{d:$(m),fill:N(_.count),stroke:"none","data-count":_.count,class:`${D}__density-cell ${D}__mark`}),k++}return{cells:k,maxCount:f,domain:w,ramp:N}}}),tt("packages/modules/charts/radial.js",function(r,oe){"use strict";Object.defineProperty(r,"horizontalRoom",{enumerable:!0,get:function(){return n}}),Object.defineProperty(r,"horizontalReach",{enumerable:!0,get:function(){return e}}),Object.defineProperty(r,"centredRoom",{enumerable:!0,get:function(){return i}}),Object.defineProperty(r,"arcPath",{enumerable:!0,get:function(){return g}}),Object.defineProperty(r,"layoutRings",{enumerable:!0,get:function(){return b}}),Object.defineProperty(r,"drawRadial",{enumerable:!0,get:function(){return H}}),Object.defineProperty(r,"arcAt",{enumerable:!0,get:function(){return F}});const ae=oe("packages/modules/charts/frame.js").Pool,$=oe("packages/modules/charts/svg.js"),ke=$.attrs,we=$.path,se=$.round,ie=$.setText,le=oe("packages/modules/charts/styles.js").NS,d=oe("packages/modules/charts/scheme.js").resolveScheme,L=oe("packages/modules/charts/fills.js"),T=L.nodePaint,W=L.rowFillSource,G=oe("packages/modules/charts/labels.js"),A=G.drawAnchoredLabels,p=G.labelText,f=oe("packages/modules/charts/typography.js"),w=f.applySize,N=f.textWidth,q=f.truncateTo,_=oe("packages/modules/charts/format.js").measureFormat,c=Math.PI*2,v=-Math.PI/2,E=.25,m=2,y=3,P=.58,Q=8,K=2;function ge(s,M,B,I){return s==="total"?_(M,B,I):typeof s=="number"?_(s,B,I):s==null?"":String(s)}function re(s,M,B){if(!s||B<=0)return Q;let I=M;for(;I>Q&&N(s,I)>B;)I-=1;return Math.max(Q,I)}function C(s,M,B,I){const V=B*Math.SQRT2-4;if(V<=0||!s&&!M)return null;let fe=re(s,Math.min(V,I*(M?1.6:2.2)),V),a=M?re(M,Math.min(V,fe*.55),V):0;const x=M?K:0;for(;fe+x+a>V&&(fe>Q||a>Q);)fe>Q&&(fe-=1),M&&a>Q&&(a-=1);const R=N(s,fe)>V?q(s,V,fe):s,o=M&&N(M,a)>V?q(M,V,a):M;return{value:R,valueSize:fe,label:o||"",labelSize:a,gap:x,height:fe+x+a}}function ee(s,M){const{cx:B,cy:I,hole:V,centre:fe,total:a,column:x,grid:R,baseSize:o}=M,l=ge(fe.value,a,x,R),t=fe.label?String(fe.label):"",h=C(l,t,V,o);if(!h)return;const j=h.label?I-h.height/2+h.valueSize/2:I;if(h.value){const U=s.next("text",`${le}__donut-centre-value`);ke(U,{x:se(B),y:se(j),"dominant-baseline":"middle"}),w(U,h.valueSize),ie(U,h.value)}if(h.label){const U=s.next("text",`${le}__donut-centre-label`);ke(U,{x:se(B),y:se(j+h.valueSize/2+h.gap+h.labelSize/2),"dominant-baseline":"middle"}),w(U,h.labelSize),ie(U,h.label)}}function z(s,M,B,I){return[s+B*Math.cos(I),M+B*Math.sin(I)]}function n(s,M,B){const{left:I,right:V}=e(s,M,B);return Math.max(0,I)+Math.max(0,V)}function e(s,M,B){const{inner:I,outer:V,from:fe,to:a}=s;if(B*B>=V*V)return{left:0,right:0};const x=Math.sqrt(V*V-B*B);let R=M+x,o=x-M;if(I>0&&B*B<I*I){const l=Math.sqrt(I*I-B*B);if(M>=l)R=Math.min(R,M-l);else if(M<=-l)o=Math.min(o,-l-M);else return{left:0,right:0}}if(a-fe<c-1e-9)for(const l of[fe,a]){const t=Math.sin(l);if(Math.abs(t)<1e-9)continue;const h=B/t;if(h<=0)continue;const j=h*Math.cos(l);j>=M?o=Math.min(o,j-M):R=Math.min(R,M-j)}return{left:Math.max(0,R),right:Math.max(0,o)}}function i(s,M,B,I){let V=1/0;for(const fe of[-I/2,0,I/2]){const{left:a,right:x}=e(s,M,B+fe);V=Math.min(V,a,x)}return Number.isFinite(V)?2*V:0}function g(s){const{cx:M,cy:B,inner:I,outer:V}=s,fe=s.to-s.from;if(fe<=0)return"";if(fe>=c-1e-9){const[h,j]=z(M,B,V,s.from),[U,J]=z(M,B,V,s.from+Math.PI),X=["M",se(h),se(j),"A",se(V),se(V),0,1,1,se(U),se(J),"A",se(V),se(V),0,1,1,se(h),se(j)];if(I>0){const[de,pe]=z(M,B,I,s.from),[xe,ve]=z(M,B,I,s.from+Math.PI);X.push("M",se(de),se(pe),"A",se(I),se(I),0,1,0,se(xe),se(ve),"A",se(I),se(I),0,1,0,se(de),se(pe))}return we(X)}const a=fe>Math.PI?1:0,[x,R]=z(M,B,V,s.from),[o,l]=z(M,B,V,s.to),t=["M",se(x),se(R),"A",se(V),se(V),0,a,1,se(o),se(l)];if(I>0){const[h,j]=z(M,B,I,s.to),[U,J]=z(M,B,I,s.from);t.push("L",se(h),se(j)),t.push("A",se(I),se(I),0,a,0,se(U),se(J))}else t.push("L",se(M),se(B));return t.push("Z"),we(t)}function b(s,M=v,B=v+c){const I=[],V=(fe,a,x,R,o,l)=>{if(R>0&&I.push({node:fe,from:a,to:x,depth:R,index:o,label:fe.label,total:fe.total,path:l}),R>=s.maxRings||!fe.children.length)return;const t=fe.children.reduce((U,J)=>U+J.total,0),h=x-a;if(t<=0||h<=0)return;let j=a;for(let U=0;U<fe.children.length;U++){const J=fe.children[U],X=J.total/t*h;V(J,j,j+X,R+1,R===0?U:o,[...l,J.label]),j+=X}};return V(s.root,M,B,0,0,[]),I}function O(s){return s*Math.PI/180-Math.PI/2}function ne(s,M,B){if(B>=c-1e-9)return{cx:s.left+s.width/2,cy:s.top+s.height/2,radius:Math.max(0,Math.min(s.width,s.height)/2-2)};let V=1/0,fe=-1/0,a=1/0,x=-1/0;const R=Math.max(2,Math.ceil(B*180/Math.PI));for(let U=0;U<=R;U++){const J=M+B*U/R,X=Math.cos(J),de=Math.sin(J);X<V&&(V=X),X>fe&&(fe=X),de<a&&(a=de),de>x&&(x=de)}const o=fe-V,l=x-a,t=Math.max(0,Math.min(o>0?s.width/o:1/0,l>0?s.height/l:1/0)-2),h=s.left+(s.width-t*(fe+V))/2,j=s.top+(s.height-t*(x+a))/2;return{cx:h,cy:j,radius:t}}function H(s){const M=s.scheme||d(),{plot:B,tree:I,type:V}=s,fe=s.radius&&typeof s.radius=="object"?s.radius:null,a=fe&&fe.col&&s.grid&&s.grid.columns&&s.grid.columns.get(fe.col)||null;let x=null;if(a){const be=I.root.children.map(Ce=>Number.isFinite(Ce.radius)&&Ce.radius>0?Ce.radius:0),Ne=be.length?Math.max(...be):0,je=fe.fn==="linear",Ee=Number.isFinite(fe.min)?Math.max(0,Math.min(1,Number(fe.min))):0;x=be.map(Ce=>{if(!Ne)return Ee;const Fe=je?Ce/Ne:Math.sqrt(Ce/Ne);return Math.max(Ee,Fe)})}const R=Number.isFinite(s.startAngle)?Number(s.startAngle):0,o=Number.isFinite(s.endAngle)?Number(s.endAngle):360,l=O(R);let t=O(o)-l;t<=0&&(t+=c);const h=ne(B,l,t),j=h.cx,U=h.cy,J=h.radius,X=V==="sunburst"?Math.max(1,I.depth):1,de=b({root:I.root,depth:I.depth,maxRings:X},l,l+t).filter(be=>!s.hidden.has(be.label)),pe=V==="donut"?J*P:0,xe=X>0?(J-pe)/X:J;new ae(s.groups.grid).finish(),new ae(s.groups.axis).finish(),new ae(s.groups.rules).finish(),new ae(s.groups.labels).finish();const ve=I.root.children.map(be=>be.label),Oe=s.fill?W(s,M):null,Pe=new ae(s.groups.marks);for(const be of de){const Ne=pe+(be.depth-1)*xe,je=x&&be.depth===1?x[be.index]:1,Ee=Ne+xe*je,Ce=Pe.next("path",`${le}__slice ${le}__mark`);ke(Ce,{d:g({cx:j,cy:U,inner:Ne,outer:Ee,from:be.from,to:be.to}),fill:T(Oe,be.node,M.series(be.index,ve[be.index])),"fill-opacity":be.depth>1?Math.max(.45,1-(be.depth-1)*.22):1,"data-arc":de.indexOf(be)}),be.geometry={cx:j,cy:U,inner:Ne,outer:Ee},be.depth===1&&(be.rvalue=I.root.children[be.index]?.radius??null)}Pe.finish();const te=s.typography&&s.typography.small||s.fontSize||11,Se=!(s.labels&&s.labels.names===!1),ye=new ae(s.groups.overlay);if(Se)for(const be of de){if(be.to-be.from<E||be.geometry.outer-be.geometry.inner<te+m*2)continue;const Ne=(be.from+be.to)/2,je=be.geometry.inner+(be.geometry.outer-be.geometry.inner)/2;if((be.to-be.from)*je<te+m*2)continue;const[Ee,Ce]=z(j,U,je,Ne),{inner:Fe,outer:We}=be.geometry,wt={inner:Fe,outer:We,from:be.from,to:be.to},lt=i(wt,Ee-j,Ce-U,te*1.3)-m*2,st=String(be.label===null||be.label===void 0?"":be.label),Qe=q(st,lt,te);if(Qe!==st&&Qe.length<y)continue;const rt=ye.next("text",`${le}__slice-label`);ke(rt,{x:se(Ee),y:se(Ce),"dominant-baseline":"middle","aria-label":Qe!==st?st:null}),w(rt,te),ie(rt,Qe)}if(V==="donut"&&s.centre&&pe>0){const be=s.grid&&s.grid.columns&&I.measure&&I.measure.col?s.grid.columns.get(I.measure.col):null;ee(ye,{cx:j,cy:U,hole:pe,centre:s.centre,total:de.filter(Ne=>Ne.depth===1).reduce((Ne,je)=>Ne+je.total,0),column:be,grid:s.grid,baseSize:te})}return ye.finish(),s.labels&&s.labels.show&&A({group:s.groups.labels,size:te,minGap:s.labels.minGap,anchors:de.filter(be=>be.depth===1&&be.to-be.from>=E).map(be=>{const Ne=(be.from+be.to)/2,je=be.geometry.inner+(be.geometry.outer-be.geometry.inner)/2,[Ee,Ce]=z(j,U,je,Ne);return{x:se(Ee),y:se(Ce+te+1),text:p(be.total,s.labels,s.grid),inside:!0}})}),{arcs:de,centre:{x:j,y:U,r:J}}}function F(s){for(const M of s.arcs){const B=M.geometry;if(!B)continue;const I=s.x-B.cx,V=s.y-B.cy,fe=Math.sqrt(I*I+V*V);if(fe<B.inner||fe>B.outer)continue;let a=Math.atan2(V,I);const x=M.from;for(;a<x;)a+=c;for(;a>=x+c;)a-=c;if(a>=M.from&&a<M.to)return M}return null}}),tt("packages/modules/charts/distribution.js",function(r,oe){"use strict";Object.defineProperty(r,"FENCE",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(r,"quantile",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(r,"summarise",{enumerable:!0,get:function(){return re}}),Object.defineProperty(r,"binEdge",{enumerable:!0,get:function(){return C}}),Object.defineProperty(r,"outsideDomain",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(r,"histogram",{enumerable:!0,get:function(){return z}}),Object.defineProperty(r,"readingsOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(r,"valuesByCategory",{enumerable:!0,get:function(){return e}}),Object.defineProperty(r,"allReadings",{enumerable:!0,get:function(){return i}}),Object.defineProperty(r,"distributionDomain",{enumerable:!0,get:function(){return g}}),Object.defineProperty(r,"density",{enumerable:!0,get:function(){return b}}),Object.defineProperty(r,"drawHistogram",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(r,"drawBoxPlot",{enumerable:!0,get:function(){return H}}),Object.defineProperty(r,"probit",{enumerable:!0,get:function(){return F}}),Object.defineProperty(r,"drawQQ",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"drawEcdf",{enumerable:!0,get:function(){return M}}),Object.defineProperty(r,"drawLorenz",{enumerable:!0,get:function(){return B}}),Object.defineProperty(r,"drawControl",{enumerable:!0,get:function(){return I}}),Object.defineProperty(r,"drawCapability",{enumerable:!0,get:function(){return V}}),Object.defineProperty(r,"drawMovingRange",{enumerable:!0,get:function(){return fe}});const ae=oe("packages/modules/charts/frame.js").Pool,$=oe("packages/modules/charts/axis.js"),ke=$.drawAxisLines,we=$.drawCategoryAxis,se=$.drawContinuousAxis,ie=$.drawMeasureAxis,Z=$.tickLabeller,D=oe("packages/modules/charts/format.js").formatters,d=oe("packages/modules/charts/scale.js"),L=d.bandScale,T=d.isNumber,W=d.linearScale,G=d.measureDomain,A=d.niceStep,p=oe("packages/modules/charts/svg.js"),f=p.attrs,w=p.path,N=p.round,k=oe("packages/modules/charts/styles.js").NS,c=oe("packages/modules/charts/scheme.js").resolveScheme,v=oe("packages/modules/charts/labels.js"),E=v.drawAnchoredLabels,m=v.labelText,P=oe("packages/modules/charts/typography.js").textWidth,Q=1.5,K="–";function ge(a,x){const R=a.length;if(!R)return NaN;if(R===1)return a[0];const o=(R-1)*Math.min(1,Math.max(0,x)),l=Math.floor(o),t=Math.ceil(o);return l===t?a[l]:a[l]+(o-l)*(a[t]-a[l])}function re(a){const x=a.filter(T).slice().sort((X,de)=>X-de);if(!x.length)return null;const R=ge(x,.25),o=ge(x,.5),l=ge(x,.75),t=l-R,h=R-Q*t,j=l+Q*t;let U=x[0];for(const X of x)if(X>=h){U=X;break}let J=x[x.length-1];for(let X=x.length-1;X>=0;X--)if(x[X]<=j){J=x[X];break}return{min:x[0],q1:R,median:o,q3:l,max:x[x.length-1],low:U,high:J,outliers:x.filter(X=>X<h||X>j),count:x.length}}function C(a,x,R){const o=a+R*x;return Math.abs(o)<x/1e6?0:Number(o.toPrecision(12))}function ee(a,x){const R=x||{},o=T(R.min),l=T(R.max);if(!o&&!l)return 0;let t=0;for(let h=0;h<a.length;h++){const j=a[h];T(j)&&(o&&j<R.min||l&&j>R.max)&&t++}return t}function z(a,x=12,R){const o=R||{},l=T(o.min),t=T(o.max);let h=1/0,j=-1/0,U=0;for(let ve=0;ve<a.length;ve++){const Oe=a[ve];T(Oe)&&(l&&Oe<o.min||t&&Oe>o.max||(Oe<h&&(h=Oe),Oe>j&&(j=Oe),U++))}if(!U)return[];if(l&&(h=Number(o.min)),t&&(j=Number(o.max)),h===j){const ve=Math.abs(h)>0?Math.abs(h)/10:.5;h-=ve,j+=ve}const J=A((j-h)/Math.max(1,x)),X=Math.floor(h/J)*J,de=Math.ceil(j/J)*J,pe=[],xe=Math.max(1,Math.round((de-X)/J));for(let ve=0;ve<xe;ve++)pe.push({from:C(X,J,ve),to:C(X,J,ve+1),count:0});for(let ve=0;ve<a.length;ve++){const Oe=a[ve];if(!T(Oe)||l&&Oe<o.min||t&&Oe>o.max)continue;let Pe=Math.floor((Oe-X)/J);Pe>=pe.length&&(Pe=pe.length-1),Pe<0&&(Pe=0),pe[Pe].count++}return pe}function n(a){if(!a)return[];if(Array.isArray(a.values)){const x=a.values.filter(T);if(x.length)return x}return T(a.y)?[a.y]:[]}function e(a){const x=new Map,R=!(a.dimension&&a.dimension.col),o=R&&a.measure&&a.measure.title||"";for(const l of a.series)for(const t of l.points){const h=n(t);if(!h.length)continue;const j=R?o:t.label;x.has(j)||x.set(j,[]);const U=x.get(j);for(const J of h)U.push(J)}return x}function i(a){const x=[];for(const R of a.series||[])for(const o of R.points||[])for(const l of n(o))x.push(l);return x}function g(a,x){const R=x&&x.y||{};return G(a,{zero:!1,min:R.min,max:R.max})}function b(a,x,R){const o=a.length;if(!o)return[];const l=a.reduce((X,de)=>X+de,0)/o,t=a.reduce((X,de)=>X+(de-l)**2,0)/Math.max(1,o-1),h=Math.sqrt(t)||1,j=Math.max(1e-9,1.06*h*o**(-1/5)),U=[],J=x.max-x.min||1;for(let X=0;X<R;X++){const de=x.min+J*X/(R-1||1);let pe=0;for(const xe of a){const ve=(de-xe)/j;pe+=Math.exp(-.5*ve*ve)}U.push({at:de,density:pe/(o*j*Math.sqrt(Math.PI*2))})}return U}function O(a,x,R){const o=D(a.grid,{kind:"linear",step:R}),l=x.measure&&x.measure.col&&a.grid.columns?a.grid.columns.get(x.measure.col):null,h=!!(l&&l.format&&typeof l.formatValue=="function")?{tick:j=>String(l.formatValue(j,null))}:o;return Z(a.axis&&a.axis.x||{},h,a.grid)}function ne(a){const x=a.scheme||c(),{plot:R,bound:o}=a,l=i(o),t=a.axis&&a.axis.y||{},h=z(l,a.buckets||12,t),j=ee(l,t),U=h.map(ye=>ye.count),J=G(U,{zero:!0}),X=W(J,[R.bottom,R.top]),de=h.length?h[0].to-h[0].from:1,pe=O(a,o,de),xe=h.map(ye=>pe(ye.from)),ve=h.map(ye=>`${pe(ye.from)} ${K} ${pe(ye.to)}`),Oe=h.map((ye,be)=>be),Pe=L(Oe,[R.left,R.right],.08);ie({gridGroup:a.groups.grid,axisGroup:a.groups.axis,plot:R,scale:X,format:D(a.grid,{kind:"linear",step:(J.max-J.min)/5})}),we({group:a.groups.overlay,plot:R,scale:Pe,labels:xe,fontSize:a.fontSize,rotated:xe.length>8}),ke({group:a.groups.rules,plot:R});const te=new ae(a.groups.marks),Se=X.of(J.min<=0?0:J.min);if(h.forEach((ye,be)=>{const Ne=X.of(ye.count);f(te.next("rect",`${k}__bar ${k}__mark`),{x:N(Pe.of(be)),y:N(Math.min(Ne,Se)),width:N(Pe.bandwidth),height:N(Math.max(ye.count>0?1:0,Math.abs(Se-Ne))),fill:x.series(0),"data-point":be})}),te.finish(),a.curve&&l.length>1){const ye={min:h[0].from,max:h[h.length-1].to},be=b(l,ye,Math.max(24,h.length*4)),Ne=be.reduce((je,Ee)=>Math.max(je,Ee.density),0);if(Ne>0){const je=ye.max-ye.min||1,Ee=X.of(J.max),Ce=be.map(We=>[N(R.left+(We.at-ye.min)/je*(R.right-R.left)),N(Se-We.density/Ne*(Se-Ee))]),Fe=new ae(a.groups.overlay);f(Fe.next("path",`${k}__density ${k}__mark`),{d:w(Ce.flatMap(([We,wt],lt)=>[lt?"L":"M",We,wt])),fill:"none",stroke:x.series(1)}),Fe.finish()}}if(a.labels&&a.labels.show){const ye=a.typography&&a.typography.small||a.fontSize||11;E({group:a.groups.labels,size:ye,minGap:a.labels.minGap,plot:R,anchors:h.map((be,Ne)=>{const je=Math.min(X.of(be.count),Se),Ee=je-ye/2-2,Ce=Ee<R.top;return{x:N(Pe.of(Ne)+Pe.bandwidth/2),y:N(Ce?je+ye/2+2:Ee),text:be.count?m(be.count,a.labels,a.grid):"",inside:Ce,height:Ce?Math.abs(Se-je)-2:void 0}})})}return{xScale:Pe,yScale:X,buckets:h,labels:ve,categories:h.map(ye=>ye.from),outside:j,series:[{key:"",label:o.measure.title,index:0,points:h.map((ye,be)=>({x:be,xKey:String(be),label:ve[be],from:ye.from,to:ye.to,y:ye.count,rows:ye.count}))}]}}function H(a){const x=a.scheme||c(),{plot:R,bound:o}=a,l=e(o),t=[...l.keys()],h=t.map(xe=>re(l.get(xe))).filter(Boolean),j=[];for(const xe of h)j.push(xe.min,xe.max);const U=g(j,a.axis),J=W(U,[R.bottom,R.top]),X=L(t,[R.left,R.right],.4);ie({gridGroup:a.groups.grid,axisGroup:a.groups.axis,plot:R,scale:J,format:D(a.grid,{kind:"linear",step:(U.max-U.min)/5})}),we({group:a.groups.overlay,plot:R,scale:X,labels:t,fontSize:a.fontSize,rotated:t.length>6}),ke({group:a.groups.rules,plot:R});const de=new ae(a.groups.marks),pe=X.bandwidth;return t.forEach((xe,ve)=>{const Oe=h[ve];if(!Oe)return;const Pe=X.of(xe),te=Pe+pe/2,Se=x.series(ve);f(de.next("rect",`${k}__box ${k}__mark`),{x:N(Pe),y:N(J.of(Oe.q3)),width:N(pe),height:N(Math.max(1,J.of(Oe.q1)-J.of(Oe.q3))),fill:Se,"fill-opacity":.35,stroke:Se,"data-point":ve}),f(de.next("path",`${k}__whisker ${k}__mark`),{d:w(["M",N(te),N(J.of(Oe.high)),"L",N(te),N(J.of(Oe.q3)),"M",N(te),N(J.of(Oe.q1)),"L",N(te),N(J.of(Oe.low)),"M",N(Pe+pe*.25),N(J.of(Oe.high)),"L",N(Pe+pe*.75),N(J.of(Oe.high)),"M",N(Pe+pe*.25),N(J.of(Oe.low)),"L",N(Pe+pe*.75),N(J.of(Oe.low))]),stroke:Se,fill:"none"}),f(de.next("path",`${k}__median ${k}__mark`),{d:w(["M",N(Pe),N(J.of(Oe.median)),"L",N(Pe+pe),N(J.of(Oe.median))]),stroke:Se,"stroke-width":2,fill:"none"});for(const ye of Oe.outliers)f(de.next("circle",`${k}__point ${k}__mark`),{cx:N(te),cy:N(J.of(ye)),r:2.5,fill:Se,"fill-opacity":.8})}),de.finish(),{xScale:X,yScale:J,boxes:h,series:[{key:"",label:o.measure.title,index:0,points:t.map((xe,ve)=>({x:xe,xKey:xe,label:xe,y:h[ve]?h[ve].median:null,rows:h[ve]?h[ve].count:0}))}]}}function F(a){if(!(a>0&&a<1))return Number.NaN;const x=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],R=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],o=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],l=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],t=.02425;if(a<t){const U=Math.sqrt(-2*Math.log(a));return(((((o[0]*U+o[1])*U+o[2])*U+o[3])*U+o[4])*U+o[5])/((((l[0]*U+l[1])*U+l[2])*U+l[3])*U+1)}if(a>1-t){const U=Math.sqrt(-2*Math.log(1-a));return-(((((o[0]*U+o[1])*U+o[2])*U+o[3])*U+o[4])*U+o[5])/((((l[0]*U+l[1])*U+l[2])*U+l[3])*U+1)}const h=a-.5,j=h*h;return(((((x[0]*j+x[1])*j+x[2])*j+x[3])*j+x[4])*j+x[5])*h/(((((R[0]*j+R[1])*j+R[2])*j+R[3])*j+R[4])*j+1)}function s(a){const x=a.scheme||c(),{plot:R,bound:o}=a;new ae(a.groups.grid).finish(),new ae(a.groups.axis).finish(),new ae(a.groups.rules).finish(),new ae(a.groups.labels).finish();const l=i(o);if(l.length<3)return null;const t=l.slice().sort((Ne,je)=>Ne-je),h=t.length,j=t.map((Ne,je)=>F((je+1-.375)/(h+.25))),U=G(j,{zero:!1,nice:!0}),J=G(t,{zero:!1,nice:!0}),X=W(U,[R.left,R.right]),de=W(J,[R.bottom,R.top]);ie({gridGroup:a.groups.grid,axisGroup:a.groups.axis,plot:R,scale:de,format:D(a.grid,{kind:"linear",step:(J.max-J.min)/5})}),se({group:a.groups.overlay,plot:R,scale:X,fontSize:a.fontSize,format:D(a.grid,{kind:"linear",step:(U.max-U.min)/5})}),ke({group:a.groups.rules,plot:R});const pe=ge(t,.25),xe=ge(t,.75),ve=F(.25),Oe=F(.75),Pe=(xe-pe)/(Oe-ve),te=pe-Pe*ve,Se=new ae(a.groups.rules);f(Se.next("path",`${k}__qq-line`),{d:w(["M",N(X.of(U.min)),N(de.of(te+Pe*U.min)),"L",N(X.of(U.max)),N(de.of(te+Pe*U.max))]),fill:"none"}),Se.finish();const ye=new ae(a.groups.marks),be=[];for(let Ne=0;Ne<h;Ne++){const je=N(X.of(j[Ne])),Ee=N(de.of(t[Ne]));f(ye.next("circle",`${k}__point ${k}__mark`),{cx:je,cy:Ee,r:2.5,fill:x.series(0),"data-point":Ne}),be.push({x:je,y:Ee,theoretical:j[Ne],sample:t[Ne]})}return ye.finish(),{points:be,line:{slope:Pe,intercept:te}}}function M(a){const x=a.scheme||c(),{plot:R,bound:o}=a;new ae(a.groups.grid).finish(),new ae(a.groups.axis).finish(),new ae(a.groups.rules).finish(),new ae(a.groups.labels).finish();const l=i(o);if(!l.length)return null;const t=l.slice().sort((xe,ve)=>xe-ve),h=t.length,j=G(t,{zero:!1,nice:!0}),U=W(j,[R.left,R.right]),J=W({min:0,max:1},[R.bottom,R.top]);ie({gridGroup:a.groups.grid,axisGroup:a.groups.axis,plot:R,scale:J,format:D(a.grid,{kind:"linear",step:.2})}),se({group:a.groups.overlay,plot:R,scale:U,fontSize:a.fontSize,format:D(a.grid,{kind:"linear",step:(j.max-j.min)/5})}),ke({group:a.groups.rules,plot:R});const X=["M",N(U.of(j.min)),N(J.of(0))],de=[];for(let xe=0;xe<h;xe++){const ve=N(U.of(t[xe])),Oe=(xe+1)/h;X.push("L",ve,N(J.of(xe/h)),"L",ve,N(J.of(Oe))),de.push({value:t[xe],share:Oe})}X.push("L",N(U.of(j.max)),N(J.of(1)));const pe=new ae(a.groups.marks);return f(pe.next("path",`${k}__ecdf ${k}__mark`),{d:w(X),fill:"none",stroke:x.series(0)}),pe.finish(),{steps:de}}function B(a){const x=a.scheme||c(),{plot:R,bound:o}=a;new ae(a.groups.grid).finish(),new ae(a.groups.axis).finish(),new ae(a.groups.rules).finish(),new ae(a.groups.labels).finish();const l=i(o).filter(te=>te>=0);if(!l.length)return null;const t=l.slice().sort((te,Se)=>te-Se),h=t.length,j=t.reduce((te,Se)=>te+Se,0);if(j<=0)return null;const U=W({min:0,max:1},[R.left,R.right]),J=W({min:0,max:1},[R.bottom,R.top]);ie({gridGroup:a.groups.grid,axisGroup:a.groups.axis,plot:R,scale:J,format:D(a.grid,{kind:"linear",step:.2})}),se({group:a.groups.overlay,plot:R,scale:U,fontSize:a.fontSize,format:D(a.grid,{kind:"linear",step:.2})}),ke({group:a.groups.rules,plot:R});const X=new ae(a.groups.rules);f(X.next("path",`${k}__lorenz-equality`),{d:w(["M",N(U.of(0)),N(J.of(0)),"L",N(U.of(1)),N(J.of(1))]),fill:"none"}),X.finish();const de=["M",N(U.of(0)),N(J.of(0))],pe=[{rows:0,held:0}];let xe=0;for(let te=0;te<h;te++){xe+=t[te];const Se={rows:(te+1)/h,held:xe/j};de.push("L",N(U.of(Se.rows)),N(J.of(Se.held))),pe.push(Se)}const ve=new ae(a.groups.marks);f(ve.next("path",`${k}__lorenz ${k}__mark`),{d:w(de),fill:"none",stroke:x.series(0)}),ve.finish();let Oe=0;for(let te=0;te<h;te++)Oe+=(te+1)*t[te];const Pe=2*Oe/(h*j)-(h+1)/h;return{curve:pe,gini:Pe}}function I(a){const x=a.scheme||c(),{plot:R,bound:o}=a;new ae(a.groups.grid).finish(),new ae(a.groups.labels).finish();const l=[];for(const Ee of o.series)for(const Ce of Ee.points)T(Ce.y)&&l.push(Ce.y);if(l.length<2)return null;const t=a.capability||null,h=t&&t.limits?t.limits:null,j=[...l];h&&j.push(h.upper,h.lower),t&&(t.lower!==null&&j.push(t.lower),t.upper!==null&&j.push(t.upper));const U=G(j,{zero:!1,nice:!0}),J=W(U,[R.bottom,R.top]),X=l.length>1?(R.right-R.left)/(l.length-1):0;ie({gridGroup:a.groups.grid,axisGroup:a.groups.axis,plot:R,scale:J,format:D(a.grid,{kind:"linear",step:(U.max-U.min)/5})}),ke({group:a.groups.rules,plot:R});const de=new ae(a.groups.overlay),pe=[],xe=(Ee,Ce,Fe,We="end")=>{!Number.isFinite(Ee)||Ee<U.min||Ee>U.max||(f(de.next("path",Ce),{d:w(["M",N(R.left),N(J.of(Ee)),"L",N(R.right),N(J.of(Ee))]),fill:"none"}),Fe&&pe.push({y:J.of(Ee),text:Fe,side:We}))};h&&(xe(h.centre,`${k}__control-centre`,"CL","end"),xe(h.upper,`${k}__control-limit`,"UCL","end"),xe(h.lower,`${k}__control-limit`,"LCL","end")),t&&(t.lower!==null&&xe(t.lower,`${k}__spec-limit`,"LSL","start"),t.upper!==null&&xe(t.upper,`${k}__spec-limit`,"USL","start"),t.target!==null&&xe(t.target,`${k}__spec-target`,"Target","start")),de.finish();const ve=new Map;for(const Ee of t&&t.violations?t.violations:[]){const Ce=ve.get(Ee.index);Ce?Ce.includes(Ee.rule)||Ce.push(Ee.rule):ve.set(Ee.index,[Ee.rule])}const Oe=new Set(ve.keys()),Pe=new ae(a.groups.marks),te=[],Se=[];for(let Ee=0;Ee<l.length;Ee++){const Ce=N(R.left+Ee*X),Fe=N(J.of(l[Ee]));te.push(Ee?"L":"M",Ce,Fe),Se.push({x:Ce,y:Fe,index:Ee,value:l[Ee],violating:Oe.has(Ee)})}f(Pe.next("path",`${k}__control-line ${k}__mark`),{d:w(te),fill:"none",stroke:x.series(0)});for(const Ee of Se)f(Pe.next("circle",`${k}__point ${k}__mark`),{cx:Ee.x,cy:Ee.y,r:Ee.violating?4:2.5,fill:Ee.violating?"var(--lattice-danger, #a4262c)":x.series(0),"data-violation":Ee.violating?"true":null});Pe.finish();const ye=[];for(const{y:Ee,text:Ce,side:Fe}of pe)ye.push({x:Fe==="start"?R.left+2:R.right-2,y:Ee-3,text:Ce,anchor:Fe,className:`${k}__control-name`});const be=R.gutter||{},Ne=R.left-(be.left||0),je=R.right+(be.right||0);for(const Ee of Se){const Ce=ve.get(Ee.index);if(!Ce)continue;const Fe=Ce.sort((wt,lt)=>wt-lt).join(","),We=P(Fe,9)/2+1;ye.push({x:Math.min(Math.max(Ee.x,Ne+We),je-We),y:Ee.y-7,text:Fe,anchor:"middle",className:`${k}__control-rule`})}return E({group:a.groups.labels,anchors:ye,size:9,grid:a.grid,minGap:5}),{points:Se,limits:h,ruleSet:t?t.ruleSet:null}}function V(a){const x=a.scheme||c(),{plot:R,bound:o}=a;new ae(a.groups.grid).finish();const l=[];for(const ye of o.series)for(const be of ye.points)T(be.y)&&l.push(be.y);if(l.length<2)return null;const t=a.capability||null,h=[...l];t&&(t.lower!==null&&h.push(t.lower),t.upper!==null&&h.push(t.upper),t.target!==null&&h.push(t.target));const j=G(h,{zero:!1,nice:!0}),U=W(j,[R.left,R.right]),J=z(l,a.buckets||14),X=J.map(ye=>ye.count),de=G(X,{zero:!0}),pe=W(de,[R.bottom,R.top]);ie({gridGroup:a.groups.grid,axisGroup:a.groups.axis,plot:R,scale:pe,format:D(a.grid,{kind:"linear",step:(de.max-de.min)/5})}),se({group:a.groups.overlay,plot:R,scale:U,fontSize:a.fontSize,format:D(a.grid,{kind:"linear",step:(j.max-j.min)/5})}),ke({group:a.groups.rules,plot:R});const xe=pe.of(0),ve=new ae(a.groups.marks);for(let ye=0;ye<J.length;ye++){const be=J[ye],Ne=U.of(be.from),je=U.of(be.to),Ee=pe.of(be.count);f(ve.next("rect",`${k}__bar ${k}__mark`),{x:N(Math.min(Ne,je)),y:N(Math.min(Ee,xe)),width:N(Math.max(1,Math.abs(je-Ne)-1)),height:N(Math.max(be.count>0?1:0,Math.abs(xe-Ee))),fill:x.series(0),"data-point":ye})}ve.finish();const Oe=new ae(a.groups.overlay),Pe=[];if(t&&Number.isFinite(t.mean)){const be=Ce=>{if(!Number.isFinite(Ce)||Ce<=0)return null;const Fe=[];for(let We=0;We<=96;We++){const wt=j.min+(j.max-j.min)*We/96,lt=(wt-t.mean)/Ce;Fe.push({at:wt,y:Math.exp(-.5*lt*lt)/Ce})}return Fe},Ne=be(t.sigmaWithin),je=be(t.sigmaOverall);let Ee=0;for(const Ce of[Ne,je])if(Ce)for(const Fe of Ce)Ee=Math.max(Ee,Fe.y);if(Ee>0){const Ce=pe.of(de.max),Fe=(We,wt,lt)=>{if(!We)return;const st=We.flatMap((Qe,rt)=>[rt?"L":"M",N(U.of(Qe.at)),N(xe-Qe.y/Ee*(xe-Ce))]);f(Oe.next("path",`${wt} ${k}__mark`),{d:w(st),fill:"none"}),Pe.push(lt)};Fe(Ne,`${k}__capability-within`,"within"),Fe(je,`${k}__capability-overall`,"overall")}}const te=[],Se=(ye,be,Ne)=>{if(ye===null||!Number.isFinite(ye)||ye<j.min||ye>j.max)return;const je=N(U.of(ye));f(Oe.next("path",be),{d:w(["M",je,N(R.top),"L",je,N(R.bottom)]),fill:"none"}),te.push({x:je,text:Ne})};return t&&(Se(t.lower,`${k}__spec-limit`,"LSL"),Se(t.upper,`${k}__spec-limit`,"USL"),Se(t.target,`${k}__spec-target`,"Target")),Oe.finish(),E({group:a.groups.labels,anchors:te.map(({x:ye,text:be})=>{const Ne=P(be,9)/2,je=ye-Ne<R.left+2?"start":ye+Ne>R.right-2?"end":"middle";return{x:je==="start"?ye+2:je==="end"?ye-2:ye,y:R.top+6,text:be,anchor:je,className:`${k}__control-name`}}),size:9,grid:a.grid,minGap:1}),{buckets:J,capability:t,curves:Pe}}function fe(a){const x=a.scheme||c(),{plot:R,bound:o}=a;new ae(a.groups.grid).finish();const l=[];for(const te of o.series)for(const Se of te.points)T(Se.y)&&l.push(Se.y);if(l.length<3)return null;const t=[];for(let te=1;te<l.length;te++)t.push(Math.abs(l[te]-l[te-1]));const h=t.reduce((te,Se)=>te+Se,0)/t.length,j=3.267*h,U=G([...t,0,j],{zero:!0,nice:!0}),J=W(U,[R.bottom,R.top]),X=t.length>1?(R.right-R.left)/(t.length-1):0;ie({gridGroup:a.groups.grid,axisGroup:a.groups.axis,plot:R,scale:J,format:D(a.grid,{kind:"linear",step:(U.max-U.min)/5})}),ke({group:a.groups.rules,plot:R});const de=new ae(a.groups.overlay),pe=[],xe=(te,Se,ye)=>{!Number.isFinite(te)||te<U.min||te>U.max||(f(de.next("path",Se),{d:w(["M",N(R.left),N(J.of(te)),"L",N(R.right),N(J.of(te))]),fill:"none"}),pe.push({y:J.of(te),text:ye}))};xe(h,`${k}__control-centre`,"MR"),xe(j,`${k}__control-limit`,"UCL"),de.finish();const ve=new ae(a.groups.marks),Oe=[],Pe=[];for(let te=0;te<t.length;te++){const Se=N(R.left+te*X),ye=N(J.of(t[te]));Oe.push(te?"L":"M",Se,ye),Pe.push({x:Se,y:ye,index:te,value:t[te],violating:t[te]>j})}f(ve.next("path",`${k}__control-line ${k}__mark`),{d:w(Oe),fill:"none",stroke:x.series(0)});for(const te of Pe)f(ve.next("circle",`${k}__point ${k}__mark`),{cx:te.x,cy:te.y,r:te.violating?4:2.5,fill:te.violating?"var(--lattice-danger, #a4262c)":x.series(0),"data-violation":te.violating?"true":null});return ve.finish(),E({group:a.groups.labels,anchors:pe.map(({y:te,text:Se})=>({x:R.right-2,y:te-3,text:Se,anchor:"end",className:`${k}__control-name`})),size:9,grid:a.grid,minGap:1}),{points:Pe,centre:h,upper:j}}}),tt("packages/modules/charts/treemap.js",function(r,oe){"use strict";Object.defineProperty(r,"squarify",{enumerable:!0,get:function(){return P}}),Object.defineProperty(r,"layoutTree",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(r,"drawTreemap",{enumerable:!0,get:function(){return K}}),Object.defineProperty(r,"tileAt",{enumerable:!0,get:function(){return ge}});const ae=oe("packages/modules/charts/frame.js").Pool,$=oe("packages/modules/charts/svg.js"),ke=$.attrs,we=$.round,se=$.setText,Z=oe("packages/modules/charts/styles.js").NS,D=oe("packages/modules/charts/scheme.js").resolveScheme,d=oe("packages/modules/charts/fills.js"),L=d.nodePaint,T=d.rowFillSource,W=oe("packages/modules/charts/labels.js"),G=W.drawAnchoredLabels,A=W.labelText,p=oe("packages/modules/charts/typography.js"),f=p.applySize,w=p.truncateTo,N=34,q=6,k=3,_=3,c=.28;function v(re){return re*1.6}function E(re){return Math.round(re*1.6)}function m(re){return re>1?Math.max(.45,1-(re-1)*.22):1}function y(re,C,ee){if(!re.length||C<=0||ee<=0)return 1/0;const z=Math.max(...re),n=Math.min(...re),e=C*C,i=ee*ee;return Math.max(e*z/i,i/(e*n))}function P(re,C){const ee=[],z=re.filter(H=>H.value>0),n=z.reduce((H,F)=>H+F.value,0);if(!z.length||n<=0||C.width<=0||C.height<=0)return ee;const e=z.slice().sort((H,F)=>F.value-H.value),i=C.width*C.height/n;let g={...C},b=[],O=[];const ne=()=>{if(!b.length)return;const H=Math.min(g.width,g.height),s=O.reduce((B,I)=>B+I,0)/H;let M=0;for(let B=0;B<b.length;B++){const I=O[B]/s;ee.push(g.width>=g.height?{item:b[B],x:g.x,y:g.y+M,width:s,height:I}:{item:b[B],x:g.x+M,y:g.y,width:I,height:s}),M+=I}g.width>=g.height?g={x:g.x+s,y:g.y,width:g.width-s,height:g.height}:g={x:g.x,y:g.y+s,width:g.width,height:g.height-s},b=[],O=[]};for(const H of e){const F=H.value*i,s=Math.min(g.width,g.height),M=y(O,s,O.reduce((I,V)=>I+V,0)),B=y([...O,F],s,O.reduce((I,V)=>I+V,0)+F);b.length&&B>M&&ne(),b.push(H),O.push(H.value*i)}return ne(),ee}function Q(re){const{plot:C,tree:ee}=re,z=v(re.fontSize),n=E(re.fontSize),e=[],i=(g,b,O,ne,H)=>{const F=g.children.filter(s=>O>0||!re.hidden.has(s.label)).map((s,M)=>({node:s,value:s.total,index:O===0?M:ne}));for(const s of P(F,b)){if(O>0&&(s.width<z||s.height<z))continue;const M={...s,depth:O+1,path:[...H,s.item.node.label],children:!1};e.push(M);const B={x:M.x+_,y:M.y+n,width:M.width-_*2,height:M.height-n-_};if(s.item.node.children.length&&B.width>=z&&B.height>=z){const I=e.length;i(s.item.node,B,O+1,M.item.index,M.path),M.children=e.length>I}}};return i(ee.root,{x:C.left,y:C.top,width:C.width,height:C.height},0,0,[]),e}function K(re){const C=re.scheme||D();new ae(re.groups.grid).finish(),new ae(re.groups.axis).finish(),new ae(re.groups.rules).finish(),new ae(re.groups.labels).finish();const ee=Q(re),z=re.typography&&re.typography.small||re.fontSize||11,n=re.fill?T(re,C):null,e=new ae(re.groups.marks);for(const[g,b]of ee.entries())ke(e.next("rect",`${Z}__tile ${Z}__mark${b.children?` ${Z}__tile--branch`:""}`),{x:we(b.x),y:we(b.y),width:we(Math.max(0,b.width)),height:we(Math.max(0,b.height)),fill:L(n,b.item.node,C.series(b.item.index)),"fill-opacity":b.children?c:m(b.depth),"data-point":b.item.index,"data-tile":g,"data-depth":b.depth});e.finish();const i=new ae(re.groups.overlay);for(const g of ee){if(g.width<N||g.height<re.fontSize*1.6)continue;const b=String(g.item.node.label??""),O=w(b,g.width-q*2,z);if(O!==b&&O.length<k)continue;const ne=i.next("text",`${Z}__tile-label${g.children?` ${Z}__tile-label--branch`:""}`);ke(ne,{x:we(g.x+q),y:we(g.y+re.fontSize+2),"text-anchor":"start"}),f(ne,z),se(ne,O)}return i.finish(),re.labels&&re.labels.show&&G({group:re.groups.labels,size:z,minGap:re.labels.minGap,anchors:ee.filter(g=>!g.children&&g.width>=N&&g.height>=re.fontSize*1.6+z).sort((g,b)=>b.width*b.height-g.width*g.height).map(g=>({x:we(g.x+q),y:we(g.y+re.fontSize*2+4),text:A(g.item.value,re.labels,re.grid),anchor:"start",inside:!0,width:g.width-q*2}))}),{tiles:ee}}function ge(re){let C=null;for(const ee of re.tiles)re.x>=ee.x&&re.x<=ee.x+ee.width&&re.y>=ee.y&&re.y<=ee.y+ee.height&&(!C||(ee.depth||1)>(C.depth||1))&&(C=ee);return C}}),tt("packages/modules/charts/annotate-items.js",function(r,oe){"use strict";Object.defineProperty(r,"ANNOTATION_TOOLS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"LEGACY_MEASURE_TOOLS",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(r,"MEASURE_KINDS",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"ANCHORS",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"PEN_MAX_POINTS",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"isSafeColour",{enumerable:!0,get:function(){return le}}),Object.defineProperty(r,"simplifyStroke",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"ITEM_KINDS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"TEXT_KINDS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(r,"FIB_LEVELS",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"nextItemId",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"resolveAnnotate",{enumerable:!0,get:function(){return A}}),Object.defineProperty(r,"normaliseAnchor",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"normaliseItem",{enumerable:!0,get:function(){return N}}),Object.defineProperty(r,"serialiseItem",{enumerable:!0,get:function(){return q}}),Object.defineProperty(r,"itemsFromState",{enumerable:!0,get:function(){return k}}),Object.defineProperty(r,"fibLevels",{enumerable:!0,get:function(){return _}}),Object.defineProperty(r,"anchorsFor",{enumerable:!0,get:function(){return c}});const ae=oe("packages/core/src/internal/util.js").warnOnce,$=Object.freeze(["select","trendLine","horizontalLine","verticalLine","channel","fibonacci","arrow","pen","measure","text","callout","note","delete"]),ke=Object.freeze({"measure-x":"x","measure-y":"y","measure-xy":"xy"}),we=Object.freeze(["measure-x","measure-y","measure-xy","measure"]),se=Object.freeze({trendLine:2,horizontalLine:1,verticalLine:1,channel:3,fibonacci:2,pen:2,arrow:2,"measure-x":2,"measure-y":2,"measure-xy":2,measure:2,text:1,callout:2,note:1}),ie=2e3,Z=24;function le(v){return typeof v=="string"&&/^[#\w\s().,%-]+$/.test(v)}function D(v,E){if(v.length<3)return v.slice();const m=new Array(v.length).fill(!1);m[0]=!0,m[v.length-1]=!0;const y=[[0,v.length-1]];for(;y.length;){const[P,Q]=y.pop(),K=v[P],ge=v[Q],re=ge.x-K.x,C=ge.y-K.y,ee=re*re+C*C;let z=-1,n=E;for(let e=P+1;e<Q;e++){const i=v[e],g=ee?Math.max(0,Math.min(1,((i.x-K.x)*re+(i.y-K.y)*C)/ee)):0,b=Math.hypot(i.x-(K.x+g*re),i.y-(K.y+g*C));b>n&&(n=b,z=e)}z>=0&&(m[z]=!0,y.push([P,z],[z,Q]))}return v.filter((P,Q)=>m[Q])}const d=Object.freeze(Object.keys(se)),L=Object.freeze(["text","callout","note"]),T=Object.freeze([0,23.6,38.2,50,61.8,78.6,100]);let W=0;function G(){return W+=1,`ann-${W}`}function A(v,E){const m={enabled:!1,tools:[],rail:"none",readOnly:!1,measure:{volume:null,snap:!0,pin:!1,axes:"xy"},pen:{colour:null,width:null}},y=E===!0?{}:E&&typeof E=="object"?E:null,P=v===!0||!!v&&typeof v=="object";if(!P&&!y)return m;const Q=v===!0||!P?{}:v,K=Array.isArray(Q.tools)?Q.tools:null;if(K){const O=K.filter(H=>!$.includes(H)&&!ke[H]),ne=K.filter(H=>ke[H]);ne.length&&ae(`chart:annotate:tools:legacy:${ne.join(",")}`,`chart annotate.tools lists ${ne.map(H=>JSON.stringify(H)).join(", ")}, which ${ne.length>1?"are":"is"} deprecated: the rail has one "measure" tool now. Use "measure" with measure: { axes: 'x' | 'y' | 'xy' }.`),O.length&&ae(`chart:annotate:tools:${O.join(",")}`,`chart annotate.tools names ${O.length} tool(s) this chart does not have: ${O.map(H=>JSON.stringify(H)).join(", ")}. The tools are ${$.join(", ")}.`)}const ge=K?K.map(O=>ke[O]?"measure":O):null;let re=$.filter(O=>ge?ge.includes(O):!0);const C=K?[...new Set(K.filter(O=>ke[O]).map(O=>ke[O]))]:[],ee=C.length===1?C[0]:C.length?"xy":null;let z=Q.rail==="top"||Q.rail==="none"?Q.rail:"left";const n=Q.measure&&typeof Q.measure.volume=="string"&&Q.measure.volume?Q.measure.volume:null,e=Q.measure&&typeof Q.measure=="object"?Q.measure:{};y&&(P?re.includes("measure")||(re=$.filter(O=>O==="measure"||re.includes(O))):(re=["measure"],z="top"));const i=O=>O==="x"||O==="y"||O==="xy"?O:null,g=i(y&&y.axes)||i(e.axes)||ee||"xy",b=(O,ne)=>y&&typeof y[O]=="boolean"?y[O]:typeof e[O]=="boolean"?e[O]:ne;return{enabled:!0,tools:re,rail:z,readOnly:Q.readOnly===!0,measure:{volume:n,snap:b("snap",!0),pin:b("pin",!1),axes:g},pen:p(Q.pen)}}function p(v){const E=v&&typeof v=="object"?v:{},m=Number(E.width);return{colour:le(E.colour)?E.colour:null,width:m>0?Math.min(Z,m):null}}function f(v){return typeof v=="string"?v!=="":typeof v=="number"?Number.isFinite(v):v instanceof Date&&Number.isFinite(v.getTime())}function w(v){if(!v||typeof v!="object")return null;const E=v,m=Number(E.y);return!Number.isFinite(m)||!f(E.x)?null:{x:E.x instanceof Date?new Date(E.x.getTime()):E.x,y:m}}function N(v){if(!v||typeof v!="object")return null;const E=v,m=String(E.kind||"");if(!se[m])return ae(`chart:annotate:kind:${m}`,`a drawn chart annotation of kind ${JSON.stringify(m)} was not restored: the kinds are ${d.join(", ")}.`),null;const y=(Array.isArray(E.anchors)?E.anchors:[]).map(w).filter(Boolean),P=m==="pen";if(y.length<se[m])return ae(`chart:annotate:anchors:${m}`,`a drawn chart annotation of kind ${JSON.stringify(m)} was not restored: it needs ${se[m]} data anchor(s) and carried ${y.length}.`),null;const Q={id:typeof E.id=="string"&&E.id?E.id:G(),kind:m,anchors:y.slice(0,P?ie:se[m])};return typeof E.text=="string"&&(Q.text=E.text),typeof E.colour=="string"&&E.colour&&(m!=="pen"||le(E.colour))&&(Q.colour=E.colour),E.readOnly===!0&&(Q.readOnly=!0),(m==="measure"||m==="pen")&&E.axis==="right"&&(Q.axis="right"),m==="pen"&&Number(E.width)>0&&(Q.width=Math.min(Z,Number(E.width))),Q}function q(v){const E={id:v.id,kind:v.kind,anchors:v.anchors.map(m=>({x:m.x instanceof Date?m.x.toISOString():m.x,y:m.y}))};return v.text!==void 0&&(E.text=v.text),v.colour!==void 0&&(E.colour=v.colour),v.readOnly&&(E.readOnly=!0),v.axis&&(E.axis=v.axis),v.width!==void 0&&(E.width=v.width),E}function k(v){if(Array.isArray(v))return v.map(N).filter(Boolean);if(v&&typeof v=="object"){const E=v;if(Array.isArray(E.annotations))return E.annotations.map(N).filter(Boolean)}return[]}function _(v,E){const m=E.y-v.y;return T.map(y=>({level:y,y:v.y+m*y/100}))}function c(v,E,m){if(se[v]===1)return[E];if(v==="channel"){const y=(m.y-E.y)/4||Math.abs(m.y||1)/10;return[E,m,{x:m.x,y:m.y+y}]}return[E,m]}}),tt("packages/modules/charts/annotate-measure.js",function(r,oe){"use strict";Object.defineProperty(r,"xSpan",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"naturalDuration",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"measureReadout",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"durationParts",{enumerable:!0,get:function(){return le}}),Object.defineProperty(r,"deltaReadout",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"deltaLines",{enumerable:!0,get:function(){return d}});const Ae=oe("packages/modules/charts/scale.js"),ae=Ae.key,$=Ae.toNumber,ke=Ae.toTime;function we(L,T,W,G,A=!1){if(!Array.isArray(L)||!L.length)return null;if(G){const v=L.findIndex(P=>ae(P)===ae(T)),E=L.findIndex(P=>ae(P)===ae(W));if(v<0||E<0)return null;const m=Math.min(v,E),y=Math.max(v,E);return{count:y-m+1,from:m,to:y}}const p=A?ke:$,f=p(T),w=p(W);if(f===null||w===null)return null;const N=Math.min(f,w),q=Math.max(f,w);let k=0,_=-1,c=-1;for(let v=0;v<L.length;v++){const E=p(L[v]);E===null||E<N||E>q||(_<0&&(_=v),c=v,k+=1)}return k?{count:k,from:_,to:c}:null}function se(L){const T=[["years",31536e6],["months",2592e6],["weeks",6048e5],["days",864e5],["hours",36e5],["minutes",6e4]];for(const[W,G]of T)if(L>=G)return{unit:W,count:Math.round(L/G)};return{unit:"seconds",count:Math.round(L/1e3)}}function ie(L,T,W){const[G,A]=T;if(L==="measure")return G&&A?D(G,A,W):{};const p={};if((L==="measure-x"||L==="measure-xy")&&G&&A){const f=we(W.categories,G.x,A.x,!!W.band,!!W.timeAxis);if(f){if(p.count=f.count,p.countUnit=W.candles?"bars":"points",W.timeAxis){const w=ke(G.x),N=ke(A.x);w!==null&&N!==null&&(p.elapsedMs=Math.abs(N-w),p.elapsed=se(p.elapsedMs))}if(W.volumeSeries){let w=0,N=!1;for(let q=f.from;q<=f.to;q++){const k=W.volumeSeries.points[q];k&&Number.isFinite(k.y)&&(w+=k.y,N=!0)}N&&(p.volume=w)}}}return(L==="measure-y"||L==="measure-xy")&&G&&A&&(p.change=A.y-G.y,p.changePercent=G.y?(A.y-G.y)/Math.abs(G.y)*100:null),p}const Z=24*3600*1e3;function le(L){let T=Math.round(Math.abs(L));const W=[["d",Z],["h",36e5],["min",6e4],["s",1e3],["ms",1]],G=[];for(const[A,p]of W){if(T>=p){const f=Math.floor(T/p);T-=f*p,f&&G.push({unit:A,count:f})}if(G.length===2)break}return G.length?G:[{unit:"s",count:0}]}function D(L,T,W){const G={},A=T.y-L.y;Number.isFinite(A)&&(G.change=A,G.changePercent=L.y?A/Math.abs(L.y)*100:null);let p=null;if(W.timeAxis){const f=ke(L.x),w=ke(T.x);f!==null&&w!==null&&(G.dxKind="time",G.dx=w-f,G.elapsedMs=Math.abs(w-f),G.duration=le(G.elapsedMs),p=(w-f)/Z,G.slopeUnit="day")}else if(W.band){const f=W.categories||[],w=f.findIndex(q=>ae(q)===ae(L.x)),N=f.findIndex(q=>ae(q)===ae(T.x));w>=0&&N>=0&&(G.dxKind="category",G.dx=N-w,p=N-w,G.slopeUnit="category")}else{const f=$(L.x),w=$(T.x);f!==null&&w!==null&&(G.dxKind="number",G.dx=w-f,p=w-f,G.slopeUnit="unit")}return p?G.slope=A/p:delete G.slopeUnit,G}function d(L,T,W,G){const A=[];if(!L)return A;const p=(f,w)=>`${f>0?"+":""}${w}`;if(L.dx!==void 0){let f;L.dxKind==="time"?f=L.duration.map(w=>T(`chart.annotate.measure.dur.${w.unit}`,{count:w.count})).join(" "):L.dxKind==="category"?f=T("chart.annotate.measure.categories",{count:Math.abs(L.dx)}):f=G(L.dx),A.push(T("chart.annotate.measure.dx",{value:L.dx<0?`-${f}`:f}))}if(L.change!==void 0){const f=L.changePercent===null||L.changePercent===void 0?"":` (${T("chart.annotate.measure.pct",{value:p(L.changePercent,G(L.changePercent,1))})})`;A.push(T("chart.annotate.measure.dy",{value:`${p(L.change,W(L.change))}${f}`}))}if(L.slope!==void 0){const f=L.slopeUnit==="day"?"perDay":L.slopeUnit==="category"?"perCategory":"perUnit";A.push(T(`chart.annotate.measure.slope.${f}`,{value:p(L.slope,G(L.slope))}))}return A}}),tt("packages/modules/charts/cursor.js",function(r,oe){"use strict";Object.defineProperty(r,"GROUP_TOOLTIPS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(r,"resolveCursor",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"buildStops",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"nearestStop",{enumerable:!0,get:function(){return A}}),Object.defineProperty(r,"stopForMessage",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"joinGroup",{enumerable:!0,get:function(){return q}}),Object.defineProperty(r,"tellGroup",{enumerable:!0,get:function(){return k}}),Object.defineProperty(r,"groupSize",{enumerable:!0,get:function(){return _}}),Object.defineProperty(r,"createCursorView",{enumerable:!0,get:function(){return c}}),Object.defineProperty(r,"ChartCursor",{enumerable:!0,get:function(){return v}}),Object.defineProperty(r,"CURSOR_CLASSES",{enumerable:!0,get:function(){return E}});const Ae=oe("packages/modules/charts/scale.js"),ae=Ae.isNumber,$=Ae.key,ke=Ae.toNumber,we=Ae.toTime,se=oe("packages/modules/charts/svg.js"),ie=se.clear,Z=se.svg,D=oe("packages/modules/charts/styles.js").NS,d=["shared","single"],L=["pointer","all"];function T(m){const y=m&&m.cursor;if(!y)return null;const P=y===!0?{}:typeof y=="object"?y:{};let Q="shared";return P.tooltip===!1||P.tooltip==="none"?Q=!1:d.includes(P.tooltip)&&(Q=P.tooltip),{x:P.x!==!1,y:P.y===!0,snap:P.snap==="none"?"none":"nearest",labels:P.labels!==!1,tooltip:Q,groupTooltips:L.includes(P.groupTooltips)?P.groupTooltips:"pointer",group:typeof P.group=="string"&&P.group?P.group:null,zoom:P.zoom===!0,rowHover:P.rowHover===!0}}function W(m,y){if(m.kind==="band")return m.centre(y.x);const P=m.kind==="time"?we(y.x):ke(y.x);return P===null?NaN:m.of(P)}function G(m){const{series:y,xScale:P}=m,Q=new Map;for(const ge of y||[]){const re=ge.points||[];for(let C=0;C<re.length;C++){const ee=re[C];if(!ee||!ae(ee.y))continue;const z=W(P,ee);if(Number.isNaN(z))continue;const n=P.kind==="band"?$(ee.x):String(P.kind==="time"?we(ee.x):ke(ee.x));let e=Q.get(n);e||(e={key:n,x:ee.x,value:P.kind==="band"?null:P.kind==="time"?we(ee.x):ke(ee.x),px:z,label:ee.label!==void 0&&ee.label!==null?String(ee.label):String(ee.x),index:Array.isArray(ge.kept)?ge.kept[C]:C,entries:[]},Q.set(n,e)),e.entries.some(i=>i.series===ge)||e.entries.push({series:ge,point:ee})}}return{stops:[...Q.values()].sort((ge,re)=>ge.px-re.px),byKey:Q}}function A(m,y){if(!m.length)return-1;let P=0,Q=m.length-1;for(;P<Q;){const K=P+Q>>1;m[K].px<y?P=K+1:Q=K}return P>0&&Math.abs(m[P-1].px-y)<=Math.abs(m[P].px-y)?P-1:P}function p(m,y,P){if(y.kind==="band")return{stop:m.byKey.get(P.key)||null,value:null};let Q=Number.isFinite(P.value)?P.value:null;if(Q===null&&(Q=y.kind==="time"?we(P.x):ke(P.x)),Q===null||!Number.isFinite(Q))return{stop:null,value:null};const{min:K,max:ge}=y.domain;if(Q<K||Q>ge)return{stop:null,value:null};if(!m.stops.length)return{stop:null,value:Q};let re=null,C=1/0;for(const ee of m.stops){const z=Math.abs(ee.value-Q);z<C&&(C=z,re=ee)}return{stop:re,value:Q}}const f=Symbol.for("lattice.chart.cursor.groups");function w(){return globalThis[f]||(globalThis[f]=new Map),globalThis[f]}let N=!1;function q(m,y){const P=w();return P.has(m)||P.set(m,new Set),P.get(m).add(y),()=>{const Q=P.get(m);Q&&(Q.delete(y),Q.size||P.delete(m))}}function k(m,y,P,Q){if(N)return;const K=w().get(m);if(K){N=!0;try{for(const ge of[...K])ge!==y&&ge[P](Q)}finally{N=!1}}}function _(m){const y=w().get(m);return y?y.size:0}function c(m,y){const P=Z(m,"g",{class:`${D}__cursor`,"aria-hidden":"true"});P.setAttribute("pointer-events","none"),y.appendChild(P);const Q=(K,ge,re,C,ee)=>{const z=Math.ceil(String(K).length*ee*.6)+8,n=ee+6,e=C==="end"?ge-z:C==="middle"?ge-z/2:ge;P.appendChild(Z(m,"rect",{class:`${D}__cursor-label`,x:Math.round(e),y:Math.round(re-n/2),width:z,height:n,rx:2}));const i=Z(m,"text",{class:`${D}__cursor-label-text`,x:Math.round(e+z/2),y:Math.round(re),"text-anchor":"middle","dominant-baseline":"central"});i.textContent=String(K),P.appendChild(i)};return{element:P,show(K){ie(P);const{plot:ge,horizontal:re,size:C}=K;if(K.cat){const ee=K.cat.pos;P.appendChild(Z(m,"line",re?{class:`${D}__cursor-line`,"data-axis":"x",x1:ge.left,x2:ge.right,y1:ee,y2:ee}:{class:`${D}__cursor-line`,"data-axis":"x",x1:ee,x2:ee,y1:ge.top,y2:ge.bottom}))}if(K.val){const ee=K.val.pos;P.appendChild(Z(m,"line",re?{class:`${D}__cursor-line`,"data-axis":"y",x1:ee,x2:ee,y1:ge.top,y2:ge.bottom}:{class:`${D}__cursor-line`,"data-axis":"y",x1:ge.left,x2:ge.right,y1:ee,y2:ee}))}K.labels&&(K.cat&&K.cat.text&&(re?Q(K.cat.text,ge.left-3,K.cat.pos,"end",C):Q(K.cat.text,K.cat.pos,ge.bottom+C,"middle",C)),K.val&&K.val.text&&(re?Q(K.val.text,K.val.pos,ge.bottom+C,"middle",C):Q(K.val.text,ge.left-3,K.val.pos,"end",C)),K.val&&K.val2&&K.val2.text&&!re&&Q(K.val2.text,ge.right+3,K.val.pos,"start",C))},hide(){ie(P)},destroy(){P.parentNode&&P.parentNode.removeChild(P)}}}class v{#r;#n=null;#i=null;#t=null;#s=null;#l=-1;#o=null;#a=null;constructor(y){this.#r=y,this.member={follow:P=>this.#k(P),unfollow:()=>this.#O(),zoomTo:P=>this.#r.zoomX(P)}}refresh(){const y=this.#r.options(),P=y&&y.group;if(P!==this.#a&&(this.#o&&this.#o(),this.#o=P?q(P,this.member):null,this.#a=P||null),this.#i=null,this.#t=null,!y||!this.#m()){this.#p(),this.#s=null;return}if(this.#s){const Q=this.#f().byKey.get(this.#s.key);Q?this.#c({stop:Q,source:this.#s.source,quiet:!0}):(this.#p(),this.#s=null)}}#m(){const y=this.#r.drawn();return!!(y&&y.xScale&&y.plot&&y.xScale.range&&this.#r.series().length)}#f(){const y=this.#r.drawn();return(!this.#i||this.#t!==y)&&(this.#i=G({series:this.#r.series(),xScale:y.xScale}),this.#t=y),this.#i}#M(){return this.#n||(this.#n=c(this.#r.doc,this.#r.svg())),this.#n}#p(){this.#n&&this.#n.hide(),this.#r.hideTooltip()}pointer(y,P){const Q=this.#r.options();if(!Q||!this.#m())return;const K=this.#r.drawn(),ge=K.plot;if(P.x<ge.left||P.x>ge.right||P.y<ge.top||P.y>ge.bottom){this.leave();return}const re=K.horizontal?P.y:P.x,C=this.#f(),ee=A(C.stops,re);if(ee<0){this.leave();return}this.#l=ee,this.#c({stop:C.stops[ee],pointer:K.horizontal?P.x:P.y,free:Q.snap==="none"?re:null,source:"pointer",client:y})}leave(){!this.#s&&!(this.#n&&this.#n.element.firstChild)||(this.#s=null,this.#l=-1,this.#p(),this.#r.left({source:"pointer"}),this.#a&&k(this.#a,this.member,"unfollow"))}#c(y){const P=this.#r.options(),Q=this.#r.drawn(),{stop:K}=y,ge=P.snap==="none",re=Q.xScale.kind!=="band";let C=K.px,ee=K.value;ge&&y.free!==void 0&&y.free!==null?(C=y.free,re&&(ee=Q.xScale.invert(y.free))):ge&&re&&y.value!==void 0&&y.value!==null&&(C=Q.xScale.of(y.value),ee=y.value);const z=Q.plot;this.#s={key:K.key,source:y.source};let n=null;if(P.y&&y.pointer!==void 0&&y.pointer!==null){const b=Q.horizontal?z.left:z.top,O=Q.horizontal?z.right:z.bottom,ne=Math.max(b,Math.min(O,y.pointer)),H=Q.yScale,F=H&&typeof H.invert=="function"?H.invert(ne):NaN;if(Number.isFinite(F)&&(n={pos:ne,text:this.#r.formatY(F)},Q.rightScale&&typeof Q.rightScale.invert=="function"&&!Q.horizontal)){const s=Q.rightScale.invert(ne);Number.isFinite(s)&&(n.text2=this.#r.formatY2(s))}}this.#M().show({plot:z,horizontal:!!Q.horizontal,size:this.#r.size(),labels:P.labels,cat:P.x?{pos:C,text:this.#r.formatX(K,ee)}:null,val:n,val2:n&&n.text2?{text:n.text2}:null});const e=P.tooltip,i=this.#r.rows(K,e||"shared",y.pointer===void 0?null:y.pointer);if(e&&(y.source!=="group"||P.groupTooltips==="all")){const b=y.client&&Number.isFinite(y.client.clientX)?y.client:this.#r.clientAt(Q.horizontal?z.left+8:C,Q.horizontal?C:z.top+8);this.#r.showTooltip(i.heading,i.rows,b)}else this.#r.hideTooltip();if(y.quiet)return;y.source!=="pointer"&&y.source!=="group"&&this.#r.announce(`${i.heading}: ${i.rows.map(b=>`${b.label} ${b.value}`).join(", ")}`);const g={x:K.x,key:K.key,label:K.label,values:i.rows.map((b,O)=>({series:b.label,value:b.value,raw:i.raw?i.raw[O]:null})),source:y.source};this.#r.moved(g),this.#a&&y.source!=="group"&&k(this.#a,this.member,"follow",{key:K.key,value:K.value,x:K.x,label:K.label})}#k(y){if(!this.#r.options()||!this.#m())return;const Q=this.#r.drawn(),K=p(this.#f(),Q.xScale,y);if(!K.stop){this.#s&&(this.#s=null,this.#p());return}this.#c({stop:K.stop,source:"group",value:K.value,free:null})}#O(){this.#s&&(this.#s=null,this.#p(),this.#r.left({source:"group"}))}set(y,P="api"){if(!this.#r.options()||!this.#m())return!1;const Q=this.#r.drawn(),K=this.#f();let ge=null,re=null;if(Q.xScale.kind==="band")ge=K.byKey.get($(y))||K.stops.find(C=>C.label===String(y))||null;else{const C=p(K,Q.xScale,{key:"",value:null,x:y});ge=C.stop,re=C.value}return ge?(this.#l=K.stops.indexOf(ge),this.#c({stop:ge,source:P,value:re}),!0):!1}clear(y="api"){this.#s&&(this.#s=null,this.#l=-1,this.#p(),this.#r.left({source:y}),this.#a&&k(this.#a,this.member,"unfollow"))}get(){if(!this.#s||!this.#m())return null;const y=this.#f().byKey.get(this.#s.key);return y?{x:y.x,key:y.key,label:y.label}:null}key(y){if(!this.#r.options()||!this.#m())return!1;const Q=this.#r.drawn(),K=Q.horizontal?"ArrowUp":"ArrowLeft",ge=Q.horizontal?"ArrowDown":"ArrowRight",re=y.key;if(re!==K&&re!==ge&&re!=="Home"&&re!=="End"&&re!=="Escape")return!1;if(re==="Escape")return this.#s?(this.clear(),y.preventDefault&&y.preventDefault(),!0):!1;const{stops:C}=this.#f();if(!C.length)return!1;let ee;return re==="Home"?ee=0:re==="End"?ee=C.length-1:this.#l<0?ee=re===ge?0:C.length-1:ee=Math.max(0,Math.min(C.length-1,this.#l+(re===ge?1:-1))),this.#l=ee,this.#c({stop:C[ee],source:"keyboard",value:C[ee].value}),y.preventDefault&&y.preventDefault(),!0}zoomed(y){const P=this.#r.options();!P||!P.zoom||!this.#a||k(this.#a,this.member,"zoomTo",y)}get active(){return!!this.#s}get source(){return this.#s?this.#s.source:null}destroy(){this.#o&&this.#o(),this.#o=null,this.#a=null,this.#n&&this.#n.destroy(),this.#n=null,this.#s=null}}const E=Object.freeze({group:`${D}__cursor`,line:`${D}__cursor-line`,label:`${D}__cursor-label-text`})}),tt("packages/modules/charts/annotate-rail.js",function(r,oe){"use strict";Object.defineProperty(r,"buildRail",{enumerable:!0,get:function(){return Z}});const Ae=oe("packages/modules/charts/svg.js"),ae=Ae.attrs,$=Ae.el,ke=Ae.svg,se=oe("packages/modules/charts/styles.js").NS,ie=Object.freeze({select:"M3 2 L12 8 L8 9 L10 13 L8 14 L6 10 L3 12 Z",trendLine:"M2 13 L14 4 M2 13 m-1.5 0 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0 M14 4 m-1.5 0 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0",horizontalLine:"M1 8 L15 8",verticalLine:"M8 1 L8 15",channel:"M2 12 L14 5 M2 15 L14 8",fibonacci:"M1 2 L15 2 M1 6 L15 6 M1 10 L15 10 M1 14 L15 14",arrow:"M2 14 L13 3 M13 3 L8 3 M13 3 L13 8",pen:"M2 12 C4 6 6 14 8 8 S11 4 13 3 M12 2 L14 4",measure:"M3 13 L13 3 M3 13 L13 13 L13 3 M3 13 m-1.5 0 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0 M13 3 m-1.5 0 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0",text:"M3 3 L13 3 M8 3 L8 13 M6 13 L10 13",callout:"M2 2 L11 2 L11 9 L7 9 L4 13 L4 9 L2 9 Z",note:"M8 14 L8 8 M8 8 m-3 -3 a3 3 0 1 1 6 0 a3 3 0 1 1 -6 0",delete:"M3 4 L13 4 M6 4 L6 2 L10 2 L10 4 M4 4 L5 14 L11 14 L12 4 Z"});function Z(le){const{doc:D,t:d}=le,L=$(D,"div",`${se}__annotate-rail ${se}__annotate-rail--${le.place}`);L.setAttribute("role","toolbar"),L.setAttribute("aria-label",d("chart.annotate.rail")),L.setAttribute("aria-orientation",le.place==="top"?"horizontal":"vertical");const T=new Map;for(const p of le.tools){const f=$(D,"button",`${se}__annotate-tool`);f.setAttribute("type","button"),f.setAttribute("data-tool",p);const w=d(`chart.annotate.${p}`);f.setAttribute("aria-label",w),f.setAttribute("title",w),p!=="delete"&&f.setAttribute("aria-pressed","false");const N=ke(D,"svg",{class:`${se}__annotate-icon`,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false"});N.appendChild(ke(D,"path",{d:ie[p]||ie.select})),f.appendChild(N),f.setAttribute("tabindex",T.size?"-1":"0"),f.addEventListener("click",()=>le.onTool(p)),L.appendChild(f),T.set(p,f)}const W=p=>{const f=[...T.values()];if(!f.length)return;const w=Math.max(0,Math.min(f.length-1,p));for(let N=0;N<f.length;N++)f[N].setAttribute("tabindex",N===w?"0":"-1");f[w].focus&&f[w].focus()},G=p=>{const f=[...T.values()],w=f.indexOf(p.target);if(w<0)return;const N={ArrowDown:w+1,ArrowRight:w+1,ArrowUp:w-1,ArrowLeft:w-1,Home:0,End:f.length-1};p.key in N&&(W(N[p.key]),p.preventDefault&&p.preventDefault(),p.stopPropagation&&p.stopPropagation())};return L.addEventListener("keydown",G),{element:L,sync:p=>{for(const[f,w]of T)f!=="delete"&&ae(w,{"aria-pressed":f===p?"true":"false"})}}}}),tt("packages/modules/charts/annotate-layer.js",function(r,oe){"use strict";Object.defineProperty(r,"projector",{enumerable:!0,get:function(){return H}}),Object.defineProperty(r,"smoothPath",{enumerable:!0,get:function(){return F}}),Object.defineProperty(r,"shapeOf",{enumerable:!0,get:function(){return B}}),Object.defineProperty(r,"ChartAnnotations",{enumerable:!0,get:function(){return x}});const ae=oe("packages/modules/charts/frame.js").Pool,ke=oe("packages/modules/charts/annotations.js").overlayLayer,we=oe("packages/modules/charts/scale.js"),se=we.toNumber,ie=we.toTime,Z=oe("packages/modules/charts/annotate-items.js"),le=Z.ANCHORS,D=Z.anchorsFor,d=Z.fibLevels,L=Z.itemsFromState,T=Z.LEGACY_MEASURE_TOOLS,W=Z.MEASURE_KINDS,G=Z.nextItemId,A=Z.normaliseItem,p=Z.serialiseItem,f=Z.simplifyStroke,w=Z.TEXT_KINDS,N=oe("packages/modules/charts/annotate-measure.js"),q=N.deltaLines,k=N.measureReadout,c=oe("packages/modules/charts/cursor.js").buildStops,E=oe("packages/modules/charts/annotate-rail.js").buildRail,m=oe("packages/modules/charts/svg.js"),y=m.attrs,P=m.el,Q=m.path,K=m.round,ge=m.setText,re=m.SVG_NS,ee=oe("packages/modules/charts/styles.js").NS,z=9,n=6,e=4,i=24,g="measure-transient",b=4;function O(o,l){let t=null,h=1/0;for(const j of o.domain||[]){const U=o.centre(j);if(!Number.isFinite(U))continue;const J=Math.abs(U-l);J<h&&(h=J,t=j)}return t}function ne(o){if(o.plot&&Number.isFinite(o.plot.left))return o.plot;const l=o.xScale.range||[0,0],t=o.yScale.range||[0,0],h=o.horizontal?t:l,j=o.horizontal?l:t;return{left:Math.min(h[0],h[1]),right:Math.max(h[0],h[1]),top:Math.min(j[0],j[1]),bottom:Math.max(j[0],j[1])}}function H(o,l){if(!o)return null;const{xScale:t}=o,h=l==="right"&&o.rightScale?o.rightScale:o.yScale;if(!t||!h||typeof t.of!="function"||typeof h.of!="function"||typeof h.invert!="function")return null;const j=t.kind==="band";if(!j&&typeof t.invert!="function")return null;const U=!!o.horizontal,J=ne(o),X=pe=>{if(j)return t.centre(pe);const xe=t.kind==="time"?ie(pe):se(pe);return xe===null?NaN:t.of(xe)},de=pe=>j?O(t,pe):t.invert(pe);return{plot:J,toPixel(pe){const xe=X(pe.x),ve=h.of(pe.y);return!Number.isFinite(xe)||!Number.isFinite(ve)?null:U?{x:ve,y:xe}:{x:xe,y:ve}},toData(pe,xe){const ve=U?xe:pe,Oe=U?pe:xe,Pe=de(ve),te=h.invert(Oe);return Pe==null||!Number.isFinite(te)?null:{x:Pe,y:te}}}}function F(o){if(!o.length)return"";const l=["M",K(o[0].x),K(o[0].y)];if(o.length===1)return Q(l);if(o.length===2)return Q([...l,"L",K(o[1].x),K(o[1].y)]);for(let h=1;h<o.length-1;h++){const j=(o[h].x+o[h+1].x)/2,U=(o[h].y+o[h+1].y)/2;l.push("Q",K(o[h].x),K(o[h].y),K(j),K(U))}const t=o[o.length-1];return l.push("L",K(t.x),K(t.y)),Q(l)}function s(o,l,t){const h=t.x-l.x,j=t.y-l.y,U=h*h+j*j,J=U?Math.max(0,Math.min(1,((o.x-l.x)*h+(o.y-l.y)*j)/U)):0;return Math.hypot(o.x-(l.x+J*h),o.y-(l.y+J*j))}function M(o,l){if(o instanceof Date)return o.toISOString().slice(0,10);if(typeof o=="string")return o;const t=Number(o);return Number.isFinite(t)?Math.abs(t)>1e12?new Date(t).toISOString().slice(0,10):l(t):String(o)}function B(o,l,t,h){const j=o.anchors.map(X=>l.toPixel(X));if(j.some(X=>!X))return null;const{plot:U}=l,J={handles:j,segments:[],fill:null,dots:[],labels:[],title:""};if(o.kind==="pen")return J.handles=[],J.stroke=j,J;if(o.kind==="trendLine"||o.kind==="arrow")return J.segments.push({from:j[0],to:j[1],arrow:o.kind==="arrow"}),J;if(o.kind==="horizontalLine"||o.kind==="verticalLine"){const X=o.kind==="horizontalLine",de=j[0],pe=X?{x:U.left,y:de.y}:{x:de.x,y:U.top},xe=X?{x:U.right,y:de.y}:{x:de.x,y:U.bottom};return J.segments.push({from:pe,to:xe,dashed:!0}),J.labels.push({x:xe.x-(X?4:-4),y:xe.y-(X?4:0),text:X?t(o.anchors[0].y):M(o.anchors[0].x,t),anchor:X?"end":"start"}),J}if(o.kind==="channel"){const[X,de,pe]=j,xe=de.x-X.x,ve=xe?X.y+(pe.x-X.x)/xe*(de.y-X.y):X.y,Oe=pe.y-ve,Pe={x:X.x,y:X.y+Oe},te={x:de.x,y:de.y+Oe};return J.segments.push({from:X,to:de}),J.segments.push({from:Pe,to:te}),J.fill=[X,de,te,Pe],J}if(o.kind==="fibonacci"){const X=Math.min(j[0].x,j[1].x),de=Math.max(j[0].x,j[1].x);for(const pe of d(o.anchors[0],o.anchors[1])){const xe=l.toPixel({x:o.anchors[0].x,y:pe.y});xe&&(J.segments.push({from:{x:X,y:xe.y},to:{x:de,y:xe.y},dashed:pe.level!==0}),J.labels.push({x:de+4,y:xe.y-3,text:`${pe.level}% · ${t(pe.y)}`,anchor:"start"}))}return J}return o.kind==="callout"?(J.dots.push(j[0]),J.segments.push({from:j[0],to:j[1]}),J.labels.push({x:j[1].x+4,y:j[1].y,text:o.text||"",anchor:"start"}),J):W.includes(o.kind)?a(o,j,J,h):o.kind==="note"?(J.dots.push(j[0]),J.title=o.text||"",J):(J.labels.push({x:j[0].x,y:j[0].y,text:o.text||"",anchor:"start"}),J)}function I(o){return!(o>0)&&!(o<0)?null:o>0?"var(--lattice-success, #15803d)":"var(--lattice-danger, #b91c1c)"}function V(o,l,t){if(!o||o.count===void 0)return"";const h=[l(o.countUnit==="bars"?"chart.annotate.measure.bars":"chart.annotate.measure.points",{count:o.count})];return o.elapsed&&h.push(l(`chart.annotate.measure.${o.elapsed.unit}`,{count:o.elapsed.count})),o.volume!==void 0&&h.push(l("chart.annotate.measure.volume",{value:t(o.volume)})),h.join(" | ")}function fe(o,l){if(!o||o.change===void 0)return"";const t=o.change>0?"+":"",h=o.changePercent===null||o.changePercent===void 0?"":` (${o.changePercent>0?"+":""}${Math.round(o.changePercent*10)/10}%)`;return`${t}${l(o.change)}${h}`}function a(o,l,t,h){const[j,U]=l,J=Math.min(j.x,U.x),X=Math.max(j.x,U.x),de=Math.min(j.y,U.y),pe=Math.max(j.y,U.y),xe=h?k(o.kind,o.anchors,h):{},ve=h&&h.t,Oe=h&&h.format;if(o.kind==="measure"){t.segments.push({from:j,to:U}),t.segments.push({from:j,to:{x:U.x,y:j.y},dashed:!0}),t.segments.push({from:{x:U.x,y:j.y},to:U,dashed:!0}),t.fill=[{x:J,y:de},{x:X,y:de},{x:X,y:pe},{x:J,y:pe}];const Se=o.axis==="right",ye=h&&h.formatSide?h.formatSide(Se):Oe,be=ve?q(xe,ve,ye,h.number):[];t.lines=be;const Ne=de-6-13*(be.length-1)>=12;return be.forEach((je,Ee)=>{t.labels.push({x:(J+X)/2,y:Ne?de-6-13*(be.length-1-Ee):pe+14+13*Ee,text:je,anchor:"middle",fill:Ee===1?I(xe.change):null})}),t}if(o.kind==="measure-xy"){t.segments.push({from:{x:J,y:de},to:{x:X,y:de}}),t.segments.push({from:{x:X,y:de},to:{x:X,y:pe}}),t.segments.push({from:{x:X,y:pe},to:{x:J,y:pe}}),t.segments.push({from:{x:J,y:pe},to:{x:J,y:de}}),t.fill=[{x:J,y:de},{x:X,y:de},{x:X,y:pe},{x:J,y:pe}];const Se=ve?V(xe,ve,Oe):"";Se&&t.labels.push({x:(J+X)/2,y:de-6,text:Se,anchor:"middle"});const ye=ve?fe(xe,Oe):"";return ye&&t.labels.push({x:X+6,y:(de+pe)/2,text:ye,anchor:"start",fill:I(xe.change)}),t}if(o.kind==="measure-x"){const Se=(j.y+U.y)/2;t.segments.push({from:{x:J,y:Se},to:{x:X,y:Se}}),t.segments.push({from:{x:J,y:Se-5},to:{x:J,y:Se+5}}),t.segments.push({from:{x:X,y:Se-5},to:{x:X,y:Se+5}});const ye=ve?V(xe,ve,Oe):"";return ye&&t.labels.push({x:(J+X)/2,y:Se-6,text:ye,anchor:"middle"}),t}const Pe=(j.x+U.x)/2;t.segments.push({from:{x:Pe,y:de},to:{x:Pe,y:pe}}),t.segments.push({from:{x:Pe-5,y:de},to:{x:Pe+5,y:de}}),t.segments.push({from:{x:Pe-5,y:pe},to:{x:Pe+5,y:pe}});const te=ve?fe(xe,Oe):"";return te&&t.labels.push({x:Pe+6,y:(de+pe)/2,text:te,anchor:"start",fill:I(xe.change)}),t}class x{#r;#n;#i=[];#t=null;#s=null;#l=null;#o=null;#a=null;#m=null;#f=null;#M=null;#p=[];#c=null;#k=null;#O=null;constructor(l,t){this.#r=l,this.#n=t,this.#$(),this.configure(t)}#v(l){if(!W.includes(l.kind))return;const t=this.#b();if(!t)return;const h=k(l.kind,l.anchors,t);return Object.keys(h).length?h:void 0}get tool(){return this.#t}get busy(){return!!this.#o||!!this.#t&&this.#t!=="delete"}configure(l){const t=this.#n;this.#n=l;const h=t&&t.rail===l.rail&&t.tools.join()===l.tools.join()&&t.readOnly===l.readOnly;if(!(this.#a&&h)){if(this.#a&&(this.#a.element.parentNode&&this.#a.element.parentNode.removeChild(this.#a.element),this.#a=null),l.rail==="none"||l.readOnly||!l.tools.length){this.#r.root.classList.remove(`${ee}--annotate-left`,`${ee}--annotate-top`),this.use(null);return}this.#a=E({doc:this.#r.doc,t:this.#r.t,tools:l.tools,place:l.rail,onTool:j=>this.#z(j)}),this.#r.root.classList.remove(`${ee}--annotate-left`,`${ee}--annotate-top`),this.#r.root.classList.add(`${ee}--annotate-${l.rail}`),this.#r.root.insertBefore(this.#a.element,this.#r.root.firstChild),this.#a.sync(this.#t)}}list(){return this.#i.map(p)}setItems(l){this.#i=L(l),this.#l=null,this.redraw()}use(l){this.#s=l&&T[l]?T[l]:null,this.#s&&(l="measure"),this.#t=l,this.#o=null,this.#c=null,this.#k=null,this.#a&&this.#a.sync(l),this.redraw()}add(l){if(this.#n.readOnly)return null;const t=A({id:G(),...l});return t?(this.#i.push(t),this.redraw(),this.#r.notify("added",p(t),this.#v(t)),t):null}remove(l){const t=this.#i.findIndex(j=>j.id===l);if(t<0||this.#n.readOnly||this.#i[t].readOnly)return!1;const[h]=this.#i.splice(t,1);return this.#l===l&&(this.#l=null),this.redraw(),this.#r.notify("removed",p(h),this.#v(h)),!0}setText(l,t){const h=this.#i.find(j=>j.id===l);return!h||this.#n.readOnly||h.readOnly?!1:(h.text=String(t),this.redraw(),this.#r.notify("changed",p(h),this.#v(h)),!0)}redraw(){const l=this.#r.groups&&this.#r.groups.overlay;if(!l)return;this.#m=ke(l,`${ee}__drawn`);const t=new ae(this.#m),h=H(this.#r.drawn());if(h){const j=this.#r.format(),U=this.#b(j);for(const J of this.#i){const X=B(J,this.#x(J.axis,h),j,U);X&&this.#e(t,J,X,J.id===this.#l)}if(this.#c){const J=B(this.#c,this.#x(this.#c.axis,h),j,U);J&&this.#e(t,this.#c,J,!1)}if(this.#o&&this.#o.preview){const J=B(this.#o.preview,this.#x(this.#o.preview.axis,h),j,U);J&&this.#e(t,this.#o.preview,J,!1)}}t.finish(),this.#r.described&&this.#r.described(this.describe())}#x(l,t){return l==="right"?H(this.#r.drawn(),"right"):t||H(this.#r.drawn())}#b(l){const t=this.#r.bound?this.#r.bound():null,h=this.#r.drawn();if(!t||!h||!h.xScale)return null;const j=h.xScale.kind==="band",U=!!h.candles,J=h.xScale.kind==="time"||U,X=this.#n.measure&&this.#n.measure.volume;let de=null;return Array.isArray(t.series)&&(X?de=t.series.find(pe=>pe.key===X)||null:U&&t.series.length>4&&(de=t.series[4])),{categories:t.categories||[],band:j,timeAxis:J,candles:U,volumeSeries:de,t:this.#r.t,format:l||this.#r.format(),formatSide:this.#r.formatSide||(()=>l||this.#r.format()),number:this.#r.number||(pe=>String(pe))}}#e(l,t,h,j){if(h.fill){const U=[];for(const X of h.fill)U.push(U.length?"L":"M",K(X.x),K(X.y));U.push("Z");const J=l.next("path",`${ee}__drawn-fill`);y(J,{class:`${ee}__drawn-fill`,"data-annotation-id":t.id,d:Q(U),fill:t.colour||null})}if(h.stroke){const U=l.next("path",`${ee}__drawn-pen`),J=t.width||this.#n.pen&&this.#n.pen.width||null,X=t.colour||this.#n.pen&&this.#n.pen.colour||null,de=[X?`stroke:${X}`:"",J?`stroke-width:${J}px`:""].filter(Boolean).join(";");y(U,{class:`${ee}__drawn-pen`,"data-annotation-id":t.id,"data-annotation-kind":"pen","data-selected":j?"true":null,style:de||null,d:F(h.stroke)})}for(const U of h.segments){const J=l.next("path",`${ee}__drawn-line`),X=["M",K(U.from.x),K(U.from.y),"L",K(U.to.x),K(U.to.y)];U.arrow&&X.push(...R(U.from,U.to)),y(J,{class:`${ee}__drawn-line`,"data-annotation-id":t.id,"data-annotation-kind":t.kind,"data-transient":t.id===g?"true":null,"stroke-dasharray":U.dashed?"4 3":null,d:Q(X),stroke:t.colour||null})}for(const U of h.dots){const J=l.next("circle",`${ee}__drawn-dot`);y(J,{class:`${ee}__drawn-dot`,"data-annotation-id":t.id,cx:K(U.x),cy:K(U.y),r:3.5,fill:t.colour||null}),this.#d(J,h.title)}for(const U of h.labels){if(!U.text)continue;const J=l.next("text",`${ee}__drawn-label`);y(J,{class:`${ee}__drawn-label`,"data-annotation-id":t.id,x:K(U.x),y:K(U.y),"text-anchor":U.anchor,fill:U.fill||t.colour||null}),ge(J,U.text)}if(j)for(let U=0;U<h.handles.length;U++){const J=l.next("circle",`${ee}__drawn-handle`);y(J,{class:`${ee}__drawn-handle`,"data-annotation-id":t.id,"data-anchor":U,cx:K(h.handles[U].x),cy:K(h.handles[U].y),r:b})}}#d(l,t){const h=l.firstChild;if(!t){h&&l.removeChild(h);return}if(h){ge(h,t);return}const j=this.#r.doc.createElementNS(re,"title");ge(j,t),l.appendChild(j)}#z(l){if(l==="delete"){this.#l&&this.remove(this.#l);return}this.use(this.#t===l?null:l)}#$(){const l=this.#r.plot,t=this.#r.root,h=X=>this.#_(X),j=X=>this.#pe(X),U=X=>this.#re(X),J=X=>this.#U(X);l.addEventListener("pointerdown",h),l.addEventListener("pointermove",j),l.addEventListener("pointerup",U),t.addEventListener("keydown",J),this.#p.push(()=>{l.removeEventListener("pointerdown",h),l.removeEventListener("pointermove",j),l.removeEventListener("pointerup",U),t.removeEventListener("keydown",J)})}#N(l){const t=this.#r.plot.getBoundingClientRect?this.#r.plot.getBoundingClientRect():{left:0,top:0};return{x:(l.clientX||0)-(t.left||0),y:(l.clientY||0)-(t.top||0)}}#L(l,t){const h=this.#r.format();for(let j=this.#i.length-1;j>=0;j--){const U=this.#i[j],J=B(U,this.#x(U.axis,t),h);if(!J)continue;for(let de=0;de<J.handles.length;de++)if(Math.hypot(l.x-J.handles[de].x,l.y-J.handles[de].y)<=z)return{item:U,anchor:de};if(J.segments.some(de=>s(l,de.from,de.to)<=n)||J.dots.some(de=>Math.hypot(l.x-de.x,l.y-de.y)<=z)||!!J.stroke&&J.stroke.some((de,pe)=>pe>0&&s(l,J.stroke[pe-1],de)<=n))return{item:U,anchor:-1}}return null}#_(l){if(!this.#t)return;const t=H(this.#r.drawn());if(!t)return;const h=this.#N(l);if(this.#t==="measure"&&this.#F()==="measure"){this.#Oe(l,h);return}const j=t.toData(h.x,h.y);if(j){if(l.preventDefault&&l.preventDefault(),this.#t==="select"){const U=this.#L(h,t);this.#l=U?U.item.id:null,this.#o=U&&!U.item.readOnly?{mode:"move",item:U.item,anchor:U.anchor,from:j,at:h}:null,this.redraw();return}if(this.#t==="pen"){this.#o={mode:"draw",kind:"pen",from:j,at:h,pts:[h],side:this.#oe(h)};return}this.#o={mode:"draw",kind:this.#t==="measure"?this.#F():this.#t,from:j,at:h}}}#F(){const l=this.#s||this.#n.measure&&this.#n.measure.axes||"xy";return l==="x"?"measure-x":l==="y"?"measure-y":"measure"}#pe(l){if(!this.#o)return;const t=this.#N(l);if(this.#o.kind==="measure"){this.#T(t);return}const h=this.#o.mode==="move"?this.#x(this.#o.item.axis):H(this.#r.drawn());if(!h)return;const j=h.toData(t.x,t.y);if(j){if(this.#o.mode==="move"){const{item:U}=this.#o;this.#o.anchor>=0?U.anchors[this.#o.anchor]=j:this.#Me(U,this.#o.from,j),this.#o.from=j,this.#o.moved=!0,this.redraw();return}if(this.#o.kind==="pen"){const U=this.#o.pts[this.#o.pts.length-1];Math.hypot(t.x-U.x,t.y-U.y)>=.5&&this.#o.pts.push(t);const J=this.#ye(this.#o.side,h);this.#o.preview={id:"preview",kind:"pen",axis:this.#o.side==="right"?"right":void 0,anchors:this.#o.pts.map(X=>J.toData(X.x,X.y)).filter(Boolean)},this.#o.preview.anchors.length<2&&(this.#o.preview=null),this.redraw();return}le[this.#o.kind]!==1&&(this.#o.to=j,this.#o.preview={id:"preview",kind:this.#o.kind,anchors:D(this.#o.kind,this.#o.from,j)},this.redraw())}}#Me(l,t,h){const j=h.y-t.y;if(l.kind==="pen"){this.#be(l,t,h);return}const U=this.#r.drawn(),J=!!(U&&U.xScale&&U.xScale.kind==="time"),X=J?ie:se,de=J?X(h.x)!==null&&X(t.x)!==null:typeof t.x=="number"&&typeof h.x=="number",pe=de?X(h.x)-X(t.x):0;for(const xe of l.anchors){if(xe.y+=j,!de)continue;const ve=X(xe.x);ve!==null&&(xe.x=ve+pe)}de||(l.anchors[0].x=h.x)}#ye(l,t){return(l==="right"?H(this.#r.drawn(),"right"):null)||t}#u(l,t,h){const j=l.pts.slice(),U=j[j.length-1];Math.hypot(t.x-U.x,t.y-U.y)>=.5&&j.push(t);const J=j.reduce((ve,Oe,Pe)=>ve+(Pe?Math.hypot(Oe.x-j[Pe-1].x,Oe.y-j[Pe-1].y):0),0);if(j.length<2||J<e){this.redraw();return}const X=this.#ye(l.side,h),de=f(j,1).map(ve=>X.toData(ve.x,ve.y)).filter(Boolean),pe=this.#n.pen||{},xe=A({id:G(),kind:"pen",anchors:de,axis:l.side==="right"?"right":void 0,colour:pe.colour||void 0,width:pe.width||void 0});if(!xe){this.redraw();return}this.#i.push(xe),this.#l=xe.id,this.redraw(),this.#r.notify("added",p(xe),void 0)}#be(l,t,h){const j=h.y-t.y,U=this.#r.drawn(),J=U&&U.xScale,X=J&&J.kind==="time";if(J&&J.kind==="band"){const pe=J.domain||[],xe=Pe=>String(Pe instanceof Date?Pe.toISOString():Pe),ve=Pe=>pe.findIndex(te=>xe(te)===xe(Pe)),Oe=ve(h.x)-ve(t.x);for(const Pe of l.anchors){Pe.y+=j;const te=ve(Pe.x);te>=0&&Oe&&(Pe.x=pe[Math.max(0,Math.min(pe.length-1,te+Oe))])}return}const de=Number(X?ie(h.x):se(h.x))-Number(X?ie(t.x):se(t.x));for(const pe of l.anchors){pe.y+=j;const xe=X?ie(pe.x):se(pe.x);Number.isFinite(de)&&xe!==null&&(pe.x=xe+de)}}describe(){const l=this.#r.format();return this.#i.filter(t=>t.kind==="pen").map(t=>this.#r.t("chart.annotate.pen.described",{from:M(t.anchors[0].x,l),to:M(t.anchors[t.anchors.length-1].x,l)}))}#re(l){const t=this.#o;if(!t)return;this.#o=null;const h=H(this.#r.drawn());if(!h){this.redraw();return}const j=this.#N(l);if(t.kind==="measure"){this.#q(t,j);return}const U=(t.mode==="move"?this.#x(t.item.axis):h).toData(j.x,j.y)||t.from;if(t.mode==="move"){this.redraw(),t.moved&&this.#r.notify("changed",p(t.item),this.#v(t.item));return}if(t.kind==="pen"){this.#u(t,j,h);return}const J=le[t.kind]===1,X=Math.hypot(j.x-t.at.x,j.y-t.at.y);if(!J&&X<e){this.redraw();return}const de=A({id:G(),kind:t.kind,anchors:D(t.kind,t.from,U)});if(!de){this.redraw();return}this.#i.push(de),this.#l=de.id,this.redraw(),w.includes(de.kind)?this.#g(de,j):this.#r.notify("added",p(de),this.#v(de))}#oe(l){const t=this.#r.drawn();if(!t||!t.rightScale||t.horizontal)return"left";const h=ne(t);return l.x>(h.left+h.right)/2?"right":"left"}#Q(l,t){const h=H(this.#r.drawn(),t);if(!h)return null;if(this.#n.measure&&this.#n.measure.snap===!1)return h.toData(l.x,l.y);const j=this.#r.drawn(),U=this.#r.series?this.#r.series():[];let J=null,X=i;for(const de of U)if((!!j.rightScale&&de.axis==="right"?"right":"left")===t)for(const xe of de.points||[]){if(!xe||!Number.isFinite(xe.y))continue;const ve=h.toPixel({x:xe.x,y:xe.y});if(!ve)continue;const Oe=Math.hypot(ve.x-l.x,ve.y-l.y);Oe<=X&&(X=Oe,J=xe)}return J&&(typeof J.x=="string"||typeof J.x=="number"||J.x instanceof Date)?{x:J.x,y:J.y}:h.toData(l.x,l.y)}#Oe(l,t){if(l.preventDefault&&l.preventDefault(),this.#k=null,this.#c){const U=this.#x(this.#c.axis),J=U&&B(this.#c,U,this.#r.format());if(!!J&&J.segments.some(de=>s(t,de.from,de.to)<=n)){this.#o={mode:"draw",kind:"measure",pinning:!0,at:t};return}this.#c=null}const h=this.#oe(t),j=this.#Q(t,h);if(!j){this.redraw();return}this.#o={mode:"draw",kind:"measure",from:j,at:t,axis:h},this.redraw()}#T(l){const t=this.#o;if(t.pinning)return;const h=this.#Q(l,t.axis);h&&(t.preview={id:g,kind:"measure",anchors:[t.from,h],axis:t.axis==="right"?"right":void 0},this.redraw())}#q(l,t){const h=Math.hypot(t.x-l.at.x,t.y-l.at.y);if(l.pinning){h<e?this.pin():this.redraw();return}if(h<e){this.redraw();return}const j=this.#Q(t,l.axis);if(!j){this.redraw();return}if(this.#c={id:g,kind:"measure",anchors:[l.from,j],axis:l.axis==="right"?"right":void 0},this.#n.measure&&this.#n.measure.pin){this.pin();return}this.redraw(),this.#B(this.#c)}pin(){const l=this.#c;if(!l||this.#n.readOnly)return null;this.#c=null,this.#k=null;const t=A({id:G(),kind:"measure",anchors:l.anchors,axis:l.axis});return t?(this.#i.push(t),this.redraw(),this.#r.notify("added",p(t),this.#v(t)),this.#B(t),t):(this.redraw(),null)}transient(){return this.#c?p({...this.#c,anchors:this.#c.anchors.map(l=>({...l}))}):null}#B(l,t){const h=this.#b();if(!h)return;const j=k("measure",l.anchors,h),U=h.formatSide(l.axis==="right"),J=q(j,h.t,U,h.number);J.length&&this.#G(`${t?`${t} `:""}${h.t("chart.annotate.measure.announce",{readout:J.join(", ")})}`)}#G(l){if(!this.#O){const t=P(this.#r.doc,"div",`${ee}__measure-live`);t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.setAttribute("style","position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0"),this.#r.root.appendChild(t),this.#O=t}ge(this.#O,l)}measureKey(l){const t=this.#n;if(t.readOnly||!t.tools.includes("measure")||l.ctrlKey||l.metaKey||l.altKey)return!1;const h=l.target;if(h&&h.tagName&&/^(input|textarea|select)$/i.test(h.tagName))return!1;const j=l.key,U=()=>(l.preventDefault&&l.preventDefault(),l.stopPropagation&&l.stopPropagation(),!0);if(j==="m"||j==="M")return this.use(this.#t==="measure"?null:"measure"),this.#t==="measure"&&this.#K(0,0),U();if(this.#t!=="measure")return!1;if(j==="Escape")return!this.#c&&!this.#k&&!this.#o?!1:(this.#c=null,this.#k=null,this.#o=null,this.redraw(),U());if(j==="Enter")return this.#k?(this.#A(),U()):this.#c?(this.pin(),U()):!1;const J={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,1],ArrowDown:[0,-1]}[j];return J?(this.#K(J[0],J[1]),U()):!1}#se(l){const t=this.#r.drawn(),h=this.#r.series?this.#r.series():[];if(!t||!t.xScale)return[];const j=h.filter(J=>l===null||(t.rightScale&&J.axis==="right"?"right":"left")===l),{stops:U}=c({series:j,xScale:t.xScale});for(const J of U)J.entries=[...J.entries].sort((X,de)=>X.point.y-de.point.y);return U}#K(l,t){const h=this.#k?this.#k.side:null,j=this.#se(h);if(!j.length)return;if(!this.#k){const X=ne(this.#r.drawn()),de=(X.left+X.right)/2;let pe=0;j.forEach((xe,ve)=>{Math.abs(xe.px-de)<Math.abs(j[pe].px-de)&&(pe=ve)}),this.#k={phase:"start",side:null,stop:pe,entry:0,start:null},l=0,t=0}const U=this.#k;U.stop=Math.max(0,Math.min(j.length-1,U.stop+l));const J=j[U.stop].entries;U.entry=Math.max(0,Math.min(J.length-1,U.entry+t)),this.#Le(j)}#Le(l){const t=this.#k,h=this.#r.drawn(),j=l[t.stop].entries[t.entry],U={x:j.point.x,y:j.point.y},J=t.side||(h.rightScale&&j.series.axis==="right"?"right":"left"),X=t.phase==="end"?t.start:U;if(this.#c={id:g,kind:"measure",anchors:[X,U],axis:J==="right"?"right":void 0},this.redraw(),t.phase==="end")this.#B(this.#c);else{const de=this.#b();de&&this.#G(de.t("chart.annotate.measure.start",{x:M(U.x,de.number),y:de.formatSide(J==="right")(U.y)}))}}#A(){const l=this.#k;if(l.phase==="start"){if(!this.#c)return;l.phase="end",l.start={...this.#c.anchors[1]},l.side=this.#c.axis==="right"?"right":"left";const t=this.#se(l.side),h=U=>String(U instanceof Date?U.getTime():U),j=t.findIndex(U=>h(U.x)===h(l.start.x));l.stop=j<0?0:j,l.entry=Math.max(0,(t[l.stop]?t[l.stop].entries:[]).findIndex(U=>U.point.y===l.start.y)),this.#Le(t);return}this.pin()}#U(l){if(!this.measureKey(l)){if(l.key==="Escape"){if(this.#f){this.#R(!0);return}if(!this.#o&&!this.#t&&!this.#l)return;this.#o=null,this.#l=null,this.use(null),l.preventDefault&&l.preventDefault();return}(l.key==="Delete"||l.key==="Backspace")&&this.#l&&!this.#f&&this.remove(this.#l)&&l.preventDefault&&l.preventDefault()}}#g(l,t){this.#R(!1);const h=this.#r.doc,j=P(h,"input",`${ee}__annotate-input`);j.setAttribute("type","text"),j.setAttribute("aria-label",this.#r.t("chart.annotate.editLabel")),j.value=l.text||"";const U=this.#r.plot.getBoundingClientRect?this.#r.plot.getBoundingClientRect():{left:0,top:0},J=this.#r.root.getBoundingClientRect?this.#r.root.getBoundingClientRect():{left:0,top:0};j.setAttribute("style",`left:${Math.round(t.x+(U.left||0)-(J.left||0))}px;top:${Math.round(t.y+(U.top||0)-(J.top||0))}px`);const X=de=>{de.key==="Enter"?(this.#R(!1),de.preventDefault&&de.preventDefault()):de.key==="Escape"&&(this.#R(!0),de.preventDefault&&de.preventDefault())};j.addEventListener("keydown",X),j.addEventListener("blur",()=>this.#R(!1)),this.#r.root.appendChild(j),this.#f=j,this.#M=l,j.focus&&j.focus()}#R(l){const t=this.#f,h=this.#M;if(!t||!h)return;this.#f=null,this.#M=null,t.parentNode&&t.parentNode.removeChild(t);const j=l?"":String(t.value||""),U=!h.text;if(!j&&U){const J=this.#i.indexOf(h);J>=0&&this.#i.splice(J,1),this.#l===h.id&&(this.#l=null),this.redraw();return}if(j===h.text){this.redraw();return}h.text=j,this.redraw(),this.#r.notify(U?"added":"changed",p(h))}destroy(){for(const l of this.#p)l();this.#p=[],this.#R(!0),this.#a&&this.#a.element.parentNode&&this.#a.element.parentNode.removeChild(this.#a.element),this.#a=null,this.#i=[],this.#m&&this.#m.parentNode&&this.#m.parentNode.removeChild(this.#m),this.#m=null}}function R(o,l){const t=Math.atan2(l.y-o.y,l.x-o.x),h=8,j=.45;return["M",K(l.x),K(l.y),"L",K(l.x-h*Math.cos(t-j)),K(l.y-h*Math.sin(t-j)),"M",K(l.x),K(l.y),"L",K(l.x-h*Math.cos(t+j)),K(l.y-h*Math.sin(t+j))]}}),tt("packages/modules/charts/zoom-view.js",function(r,oe){"use strict";Object.defineProperty(r,"ZOOM_CONTROLS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"ZOOM_BUTTONS",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(r,"ZOOM_AXES",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"ZOOM_STEP",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"ZOOM_MIN",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"resolveZoom",{enumerable:!0,get:function(){return le}}),Object.defineProperty(r,"settleView",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"magnify",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"slide",{enumerable:!0,get:function(){return L}}),Object.defineProperty(r,"sameView",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"bandRange",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"slice",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"viewOfRange",{enumerable:!0,get:function(){return A}});const ae=oe("packages/core/src/internal/util.js").warnOnce,$=Object.freeze(["in","out","left","right","reset"]),ke=Object.freeze(["hover","always","none"]),we=Object.freeze(["x","y","xy"]),se=.25,ie=.01,Z=1e-9;function le(p){const f={enabled:!1,axes:"x",buttons:"none",wheel:!1,pan:!1,step:se,min:ie};if(p==null||p===!1)return f;const w=p===!0?{}:p;if(typeof w!="object")return f;let N="x";w.axes!==void 0&&(we.includes(w.axes)?N=w.axes:ae(`chart:zoom:axes:${String(w.axes)}`,`chart zoom.axes is ${JSON.stringify(w.axes)}, which is not an axis this chart can zoom; it was ignored and x was used. The values are ${we.join(", ")}.`));let q="hover";w.buttons!==void 0&&(ke.includes(w.buttons)?q=w.buttons:ae(`chart:zoom:buttons:${String(w.buttons)}`,`chart zoom.buttons is ${JSON.stringify(w.buttons)}, which is not a way to show the zoom toolbar; it was ignored and hover was used. The values are ${ke.join(", ")}.`));const k=Number.isFinite(w.step)&&w.step>0&&w.step<1?Number(w.step):se,_=Number.isFinite(w.min)&&w.min>0&&w.min<=1?Number(w.min):ie;return{enabled:!0,axes:N,buttons:q,wheel:w.wheel!==!1,pan:w.pan!==!1,step:k,min:_}}function D(p,f){if(!p||!f)return null;const w=f.max-f.min;if(!(w>0))return null;let N=Math.min(p.to-p.from,w);if(!(N>0))return null;if(p.pinned){const _=f.max;return{from:_-N,to:_,pinned:!0}}let q=p.from;q<f.min&&(q=f.min),q+N>f.max&&(q=f.max-N);const k=q+N;return q<=f.min+Z&&k>=f.max-Z?null:{from:q,to:k,pinned:k>=f.max-Z}}function d(p,f,w,N,q){const k=f.max-f.min;if(!(k>0))return null;const _=p?p.from:f.min,c=p?p.to:f.max,v=c-_,E=!!p&&p.pinned,m=Number.isFinite(N)?Math.min(c,Math.max(_,N)):E?c:_+v/2,y=Math.max(k*q,0),P=Math.min(Math.max(v*w,y),k),Q=v>0?(m-_)/v:.5;return D({from:m-P*Q,to:m+P*(1-Q),pinned:E&&m>=c-Z},f)}function L(p,f,w){if(!p)return null;const N=(p.to-p.from)*w;return D({from:p.from+N,to:p.to+N,pinned:!1},f)}function T(p,f){return!p||!f?!p&&!f:Math.abs(p.from-f.from)<=Z&&Math.abs(p.to-f.to)<=Z}function W(p,f){const w=Math.max(0,f-1);if(!p)return{first:0,last:w};const N=Math.max(0,Math.ceil(p.from-Z)),q=Math.min(w,Math.floor(p.to+Z));return q<N?{first:Math.min(N,w),last:Math.min(N,w)}:{first:N,last:q}}function G(p,f,w){const N=(p.categories||[]).length;if(f<=0&&w>=N-1)return p;const q=[];for(let k=f;k<=w;k++)q.push(k);return{...p,categories:q.map(k=>p.categories[k]),labels:Array.isArray(p.labels)?q.map(k=>p.labels[k]):p.labels,series:(p.series||[]).map(k=>({...k,points:Array.isArray(k.points)?q.map(_=>k.points[_]).filter(_=>_!==void 0):k.points}))}}function A(p,f){if(!Array.isArray(p)||p.length<2||!f)return null;const w=Number(p[0]),N=Number(p[1]);return!Number.isFinite(w)||!Number.isFinite(N)||w===N?null:D({from:Math.min(w,N),to:Math.max(w,N),pinned:!1},f)}}),tt("packages/modules/charts/zoom-toolbar.js",function(r,oe){"use strict";Object.defineProperty(r,"buildZoomToolbar",{enumerable:!0,get:function(){return Z}});const Ae=oe("packages/modules/charts/svg.js"),ae=Ae.attrs,$=Ae.el,ke=Ae.svg,se=oe("packages/modules/charts/styles.js").NS,ie=Object.freeze({in:"M7 3 a4 4 0 1 0 0 8 a4 4 0 1 0 0 -8 M10 10 L14 14 M5 7 L9 7 M7 5 L7 9",out:"M7 3 a4 4 0 1 0 0 8 a4 4 0 1 0 0 -8 M10 10 L14 14 M5 7 L9 7",left:"M10 3 L5 8 L10 13",right:"M6 3 L11 8 L6 13",reset:"M3 8 a5 5 0 1 0 1.6 -3.7 M2 2 L2 5.5 L5.5 5.5"});function Z(le){const{doc:D,t:d}=le,L=$(D,"div",`${se}__zoom-bar ${se}__zoom-bar--${le.buttons}`);L.setAttribute("role","toolbar"),L.setAttribute("aria-label",d("chart.zoom.toolbar")),L.setAttribute("aria-orientation","horizontal");const T=new Map;for(const p of le.controls){const f=$(D,"button",`${se}__zoom-button`);f.setAttribute("type","button"),f.setAttribute("data-zoom",p);const w=d(`chart.zoom.${p}`);f.setAttribute("aria-label",w),f.setAttribute("title",w);const N=ke(D,"svg",{class:`${se}__zoom-icon`,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false"});N.appendChild(ke(D,"path",{d:ie[p]||ie.reset})),f.appendChild(N),f.setAttribute("tabindex",T.size?"-1":"0"),f.addEventListener("click",()=>le.onPress(p)),L.appendChild(f),T.set(p,f)}const W=p=>{const f=[...T.values()];if(!f.length)return;const w=Math.max(0,Math.min(f.length-1,p));for(let N=0;N<f.length;N++)f[N].setAttribute("tabindex",N===w?"0":"-1");f[w].focus&&f[w].focus()},G=p=>{const f=[...T.values()],w=f.indexOf(p.target);if(w<0)return;const N={ArrowRight:w+1,ArrowDown:w+1,ArrowLeft:w-1,ArrowUp:w-1,Home:0,End:f.length-1};p.key in N&&(W(N[p.key]),p.preventDefault&&p.preventDefault(),p.stopPropagation&&p.stopPropagation())};return L.addEventListener("keydown",G),{element:L,sync:p=>{for(const[f,w]of T){const N=f==="in"&&p.narrowest||f!=="in"&&!p.zoomed;ae(w,{disabled:N?"disabled":null,"aria-disabled":N?"true":null})}}}}}),tt("packages/modules/charts/zoom-follow.js",function(r,oe){"use strict";Object.defineProperty(r,"FOLLOW_OWNER",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(r,"FOLLOW_Y_TYPES",{enumerable:!0,get:function(){return le}}),Object.defineProperty(r,"BRUSH_OWNER",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"CLICK_OWNER",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"findOwned",{enumerable:!0,get:function(){return L}}),Object.defineProperty(r,"isOwned",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"ownedLeaves",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"pruneOwned",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"mergeOwned",{enumerable:!0,get:function(){return A}}),Object.defineProperty(r,"followCondition",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"localWall",{enumerable:!0,get:function(){return f}}),Object.defineProperty(r,"conditionRange",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"leafPrint",{enumerable:!0,get:function(){return N}}),Object.defineProperty(r,"sliceKeys",{enumerable:!0,get:function(){return q}}),Object.defineProperty(r,"unionExtent",{enumerable:!0,get:function(){return k}});const ae=oe("packages/modules/charts/zoom-view.js").bandRange,$=oe("packages/modules/charts/scale.js"),ke=$.key,we=$.toNumber,se=$.toTime,ie=1e-9,Z="chart-view",le=Object.freeze(new Set(["scatter","bubble"])),D="chart-brush",d="chart-click";function L(_,c,v){if(!_)return null;if(T(_,c,v))return _;if(!Array.isArray(_.conditions))return null;for(const E of _.conditions){const m=L(E,c,v);if(m)return m}return null}function T(_,c,v=Z){return!!(_&&!Array.isArray(_.conditions)&&_.meta&&_.meta.owner===v&&_.meta.chart===c)}function W(_,c){const v={x:null,y:null},E=m=>{if(m){if(Array.isArray(m.conditions)){for(const y of m.conditions)E(y);return}if(T(m,c)){const y=m.meta.axis==="y"?"y":"x";v[y]||(v[y]=m)}}};return E(_),v}function G(_,c,v=Z){if(!_||T(_,c,v))return null;if(!Array.isArray(_.conditions))return _;let E=!1;const m=[];for(const y of _.conditions){const P=G(y,c,v);P!==y&&(E=!0),P&&m.push(P)}return E?m.length?{..._,conditions:m}:null:_}function A(_,c,v,E=Z){const m=G(_,c,E),P=[...m?m.op==="and"&&Array.isArray(m.conditions)?m.conditions:[m]:[],...v];return P.length?{op:"and",conditions:P}:null}function p(_){const{column:c,axis:v,chart:E,banded:m,kind:y,view:P}=_;if(!c||!P)return null;const Q={owner:Z,chart:E,axis:v};if(m){const n=_.categories||[];if(!n.length)return null;const{first:e,last:i}=ae(P,n.length);return{col:c,op:"in",value:n.slice(e,i+1),meta:Q}}if(!Number.isFinite(P.from)||!Number.isFinite(P.to))return null;const K=n=>y==="time"?_.wall?f(n):new Date(n):n,ge=n=>y==="time"?se(n):we(n);let re=K(P.from),C=K(P.to),ee=1/0,z=-1/0;for(const n of _.readings||[]){const e=ge(n);e===null||!Number.isFinite(e)||e<P.from-ie||e>P.to+ie||(e<ee&&(ee=e,re=n),e>z&&(z=e,C=n))}return P.pinned?{col:c,op:"gte",value:re,meta:Q}:{col:c,op:"between",value:[re,C],bounds:"[]",meta:Q}}function f(_){const c=new Date(_),v=(E,m=2)=>String(E).padStart(m,"0");return`${c.getFullYear()}-${v(c.getMonth()+1)}-${v(c.getDate())}T${v(c.getHours())}:${v(c.getMinutes())}:${v(c.getSeconds())}.${v(c.getMilliseconds(),3)}`}function w(_,c,v){if(!_)return null;const E=m=>c==="time"?se(m):we(m);if(_.op==="in"&&Array.isArray(_.value)&&_.value.length)return{range:[_.value[0],_.value[_.value.length-1]],pinned:!1};if(_.op==="between"&&Array.isArray(_.value)&&_.value.length>=2){const m=E(_.value[0]),y=E(_.value[1]);return m===null||y===null?null:{range:[m,y],pinned:!1}}if(_.op==="gte"){const m=E(_.value);return m===null||!v||!(v.max>m)?null:{range:[m,v.max],pinned:!0}}return null}function N(_){if(!_)return"";const c=E=>E instanceof Date?E.getTime():typeof E=="string"&&/^\d{4}-\d{2}-\d{2}T/.test(E)&&Number.isFinite(Date.parse(E))?Date.parse(E):ke(E),v=Array.isArray(_.value)?_.value.map(c):c(_.value);return JSON.stringify([_.col,_.op,v,_.bounds||""])}function q(_,c){const v=_.categories||[],E=[];for(let m=0;m<v.length;m++)c.has(ke(v[m]))&&E.push(m);return E.length===v.length?_:{..._,categories:E.map(m=>v[m]),labels:Array.isArray(_.labels)?E.map(m=>_.labels[m]):_.labels,series:(_.series||[]).map(m=>({...m,points:Array.isArray(m.points)?E.map(y=>m.points[y]).filter(y=>y!==void 0):m.points}))}}function k(_,c){return _?c?{min:Math.min(_.min,c.min),max:Math.max(_.max,c.max)}:_:c||null}}),tt("packages/modules/charts/topojson.js",function(r,oe){"use strict";Object.defineProperty(r,"transformer",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(r,"arcPoints",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(r,"stitch",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(r,"decodeGeometry",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"feature",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"isTopology",{enumerable:!0,get:function(){return ie}});function Ae(Z){if(!Z)return G=>[G[0],G[1]];const[le,D]=Z.scale,[d,L]=Z.translate;let T=0,W=0;return(G,A)=>(A||(T=0,W=0),T+=G[0],W+=G[1],[T*le+d,W*D+L])}function ae(Z,le){const D=Z.arcs[le],d=Ae(Z.transform);return D.map((L,T)=>d(L,T))}function $(Z,le){const D=ae(Z,le<0?~le:le);return le<0?D.slice().reverse():D}function ke(Z,le){const D=[];for(const d of le){const L=$(Z,d);for(let T=D.length?1:0;T<L.length;T++)D.push(L[T])}return D}function we(Z,le){if(!le||!le.type)return null;const D=Ae(Z.transform);switch(le.type){case"Point":return{type:"Point",coordinates:D(le.coordinates,0)};case"MultiPoint":return{type:"MultiPoint",coordinates:le.coordinates.map(d=>D(d,0))};case"LineString":return{type:"LineString",coordinates:ke(Z,le.arcs)};case"MultiLineString":return{type:"MultiLineString",coordinates:le.arcs.map(d=>ke(Z,d))};case"Polygon":return{type:"Polygon",coordinates:le.arcs.map(d=>ke(Z,d))};case"MultiPolygon":return{type:"MultiPolygon",coordinates:le.arcs.map(d=>d.map(L=>ke(Z,L)))};case"GeometryCollection":return{type:"GeometryCollection",geometries:(le.geometries||[]).map(d=>we(Z,d)).filter(Boolean)};default:return null}}function se(Z,le){const D=typeof le=="string"?(Z.objects||{})[le]:le;if(!D)return{type:"FeatureCollection",features:[]};const d=D.type==="GeometryCollection"?D.geometries||[]:[D],L=[];for(const T of d){const W=we(Z,T);W&&L.push({type:"Feature",id:T.id,properties:T.properties||{},geometry:W})}return{type:"FeatureCollection",features:L}}function ie(Z){return!!Z&&typeof Z=="object"&&Z.type==="Topology"&&Array.isArray(Z.arcs)}}),tt("packages/modules/charts/projection.js",function(r,oe){"use strict";Object.defineProperty(r,"MERCATOR_LIMIT",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(r,"equalEarth",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"robinson",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"mercator",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"equirectangular",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(r,"albers",{enumerable:!0,get:function(){return le}}),Object.defineProperty(r,"transverseMercator",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"PROJECTIONS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"DEFAULT_PROJECTION",{enumerable:!0,get:function(){return L}}),Object.defineProperty(r,"resolveProjection",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"WRAP_DEGREES",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"splitAntimeridian",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"boundsOf",{enumerable:!0,get:function(){return A}}),Object.defineProperty(r,"fitted",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"graticule",{enumerable:!0,get:function(){return w}});const Ae=Math.PI/180,ae=Object.freeze([1.340264,-.081106,893e-6,.003796]),$=Object.freeze([[1,0],[.9986,.062],[.9954,.124],[.99,.186],[.9822,.248],[.973,.31],[.96,.372],[.9427,.434],[.9216,.4958],[.8962,.5571],[.8679,.6176],[.835,.6769],[.7986,.7346],[.7597,.7903],[.7186,.8435],[.6732,.8936],[.6213,.9394],[.5722,.9761],[.5322,1]]),ke=85.05113;function we(N,q){const[k,_,c,v]=ae,E=q*Ae,m=Math.asin(Math.min(1,Math.max(-1,Math.sqrt(3)/2*Math.sin(E)))),y=m*m,P=y*y*y,Q=Math.sqrt(3)/2*(k+3*_*y+P*(7*c+9*v*y));return[N*Ae*Math.cos(m)/Q,m*(k+_*y+P*(c+v*y))]}function se(N,q){const k=Math.min(Math.abs(q),90),_=Math.min($.length-2,Math.floor(k/5)),c=(k-_*5)/5,[v,E]=$[_],[m,y]=$[_+1],P=v+(m-v)*c,Q=E+(y-E)*c;return[N*Ae*P,(q<0?-Q:Q)*(Math.PI/2)]}function ie(N,q){const k=Math.min(ke,Math.max(-ke,q))*Ae;return[N*Ae,Math.log(Math.tan(Math.PI/4+k/2))]}function Z(N,q){return[N*Ae,q*Ae]}function le(N={}){const[q,k]=N.parallels||[29.5,45.5],[_,c]=N.centre||[-96,37.5],v=q*Ae,E=k*Ae,m=Math.sin(v),y=Math.abs(v-E)<1e-9?m:(m+Math.sin(E))/2,P=Math.cos(v)**2+2*y*m,Q=Math.sqrt(P-2*y*Math.sin(c*Ae))/y;return(K,ge)=>{const re=y*((K-_)*Ae),C=Math.max(0,P-2*y*Math.sin(ge*Ae)),ee=Math.sqrt(C)/y;return[ee*Math.sin(re),Q-ee*Math.cos(re)]}}function D(N={}){const[q,k]=N.centre||[-2,49];return(_,c)=>{const v=c*Ae,E=(_-q)*Ae,m=Math.cos(v)*Math.sin(E),y=Math.min(1-1e-12,Math.max(-1+1e-12,m));return[.5*Math.log((1+y)/(1-y)),Math.atan2(Math.tan(v),Math.cos(E))-k*Ae]}}const d=Object.freeze({equalEarth:()=>we,robinson:()=>se,mercator:()=>ie,equirectangular:()=>Z,albers:le,transverseMercator:D,britishNationalGrid:N=>D({centre:[-2,49],...N})}),L="equalEarth";function T(N,q={},k){if(typeof N=="function")return N;const c=d[typeof N=="string"&&N?N:L];return c?c(q):(k&&k(`chart projection ${JSON.stringify(N)} is not one this module draws; using '${L}'. Supported: ${Object.keys(d).join(", ")}.`),d[L]({}))}const W=180;function G(N){if(!Array.isArray(N)||N.length<2)return N&&N.length?[N]:[];const q=[];let k=[N[0]];for(let _=1;_<N.length;_++){const[c,v]=N[_-1],[E,m]=N[_],y=E-c;if(Math.abs(y)>W){const P=y>0?-180:180,Q=y>0?y-360:y+360,K=Q===0?0:Math.min(1,Math.max(0,(P-c)/Q)),ge=v+(m-v)*K;k.push([P,ge]),q.push(k),k=[[-P,ge],[E,m]]}else k.push([E,m])}return q.push(k),q.filter(_=>_.length>1)}function A(N){let q=1/0,k=1/0,_=-1/0,c=-1/0;for(const v of N||[])for(const[E,m]of v)E<q&&(q=E),E>_&&(_=E),m<k&&(k=m),m>c&&(c=m);return Number.isFinite(q)?{west:q,south:k,east:_,north:c}:null}function p(N){const{project:q,rings:k,plot:_}=N,c=typeof N.padding=="number"?N.padding:4;let v=1/0,E=1/0,m=-1/0,y=-1/0;for(const ne of k||[])for(const[H,F]of ne){const[s,M]=q(H,F);!Number.isFinite(s)||!Number.isFinite(M)||(s<v&&(v=s),s>m&&(m=s),M<E&&(E=M),M>y&&(y=M))}if(!Number.isFinite(v)||m===v||y===E)return{to:(H,F)=>{const[s,M]=q(H,F);return[_.left+_.width/2+s,_.top+_.height/2-M]},scale:1,width:_.width,height:_.height,left:_.left,top:_.top,aspect:1};const P=Math.max(1,_.width-c*2),Q=Math.max(1,_.height-c*2),K=typeof N.zoom=="number"&&N.zoom>0?N.zoom:1,ge=Math.min(P/(m-v),Q/(y-E))*K,re=(m-v)*ge,C=(y-E)*ge,[ee,z]=N.centre?q(N.centre[0],N.centre[1]):[(v+m)/2,(E+y)/2],n=N.centreOffset||[0,0],e=ee+(n[0]||0),i=z+(n[1]||0),g=_.left+_.width/2,b=_.top+_.height/2;return{to:(ne,H)=>{const[F,s]=q(ne,H);return[g+(F-e)*ge,b-(s-i)*ge]},scale:ge,width:re,height:C,left:g-re/2,top:b-C/2,aspect:(m-v)/(y-E)}}const f=2;function w(N={}){const q=N.step&&N.step>0?N.step:30,k=[];for(let _=-180;_<=180;_+=q){const c=[];for(let v=-80;v<=80;v+=f)c.push([_,v]);k.push(c)}for(let _=-60;_<=60;_+=q){const c=[];for(let v=-180;v<=180;v+=f)c.push([v,_]);k.push(c)}return k}}),tt("packages/modules/charts/geocolumn.js",function(r,oe){"use strict";Object.defineProperty(r,"geometryColumnOf",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(r,"bothPlacements",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"rowGeometry",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"geometryPoint",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"geometryPolygons",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(r,"geoAnchorScales",{enumerable:!0,get:function(){return le}});const Ae=Math.PI/180,ae=85.05113,$=Object.freeze({equirectangular:Object.freeze({forward:D=>D*Ae,inverse:D=>D/Ae}),mercator:Object.freeze({forward:D=>{const d=Math.min(ae,Math.max(-ae,D))*Ae;return Math.log(Math.tan(Math.PI/4+d/2))},inverse:D=>(2*Math.atan(Math.exp(D))-Math.PI/2)/Ae})});function ke(D,d){const L=d&&d.geometry;if(typeof L!="string"||!L)return null;const T=D&&D.columns&&typeof D.columns.get=="function"?D.columns.get(L):null,W=T&&T.dataType;return{col:L,measure:W&&typeof W.geometry=="function"?W.geometry:null}}function we(D){if(!D||typeof D.geometry!="string"||!D.geometry)return!1;const d=L=>L!=null&&L!=="";return d(D.lon)||d(D.lat)}function se(D,d,L){if(!d||!d.measure)return null;const T=D.rows.value(L,d.col);if(T==null)return null;const W=d.measure(T);if(!W||!W.bbox||!W.centroid)return null;const[G,A,p,f]=W.bbox;return![G,A,p,f].every(Number.isFinite)||G<-180||p>180||A<-90||f>90?null:{geometry:T,info:W}}function ie(D){const d=D.geometry;return d&&d.type==="Point"&&Array.isArray(d.coordinates)?[Number(d.coordinates[0]),Number(d.coordinates[1])]:[Number(D.info.centroid[0]),Number(D.info.centroid[1])]}function Z(D,d=[]){if(!D||typeof D!="object")return d;if(D.type==="Polygon")d.push(D.coordinates);else if(D.type==="MultiPolygon")for(const L of D.coordinates)d.push(L);else if(D.type==="GeometryCollection")for(const L of D.geometries||[])Z(L,d);return d}function le(D,d,L){const T=typeof d=="string"?$[d]:null;if(!T||typeof D!="function")return null;const[W,G]=D(0,0),[A]=D(1,0),[,p]=D(0,10),f=A-W,w=(p-G)/T.forward(10);if(![W,G,f,w].every(Number.isFinite)||!f||!w)return null;const N={kind:"linear",domain:{min:(L.left-W)/f,max:(L.right-W)/f},range:[L.left,L.right],of:k=>W+Number(k)*f,invert:k=>(k-W)/f},q={kind:"linear",domain:{min:T.inverse((L.bottom-G)/w),max:T.inverse((L.top-G)/w)},range:[L.bottom,L.top],of:k=>G+T.forward(Number(k))*w,invert:k=>T.inverse((k-G)/w)};return{xScale:N,yScale:q}}}),tt("packages/modules/charts/geo.js",function(r,oe){"use strict";Object.defineProperty(r,"CONTINENTS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(r,"CONTINENT_NAMES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(r,"OUTLINES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(r,"COUNTRY_CONTINENT",{enumerable:!0,get:function(){return O}}),Object.defineProperty(r,"ALPHA3",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(r,"NUMERIC",{enumerable:!0,get:function(){return H}}),Object.defineProperty(r,"normaliseCode",{enumerable:!0,get:function(){return F}}),Object.defineProperty(r,"continentOf",{enumerable:!0,get:function(){return s}}),Object.defineProperty(r,"projection",{enumerable:!0,get:function(){return M}}),Object.defineProperty(r,"referenceRegions",{enumerable:!0,get:function(){return B}}),Object.defineProperty(r,"projectedPath",{enumerable:!0,get:function(){return I}}),Object.defineProperty(r,"ringPath",{enumerable:!0,get:function(){return V}}),Object.defineProperty(r,"shapesToPaths",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(r,"registerGeoPack",{enumerable:!0,get:function(){return x}}),Object.defineProperty(r,"geoPack",{enumerable:!0,get:function(){return R}}),Object.defineProperty(r,"geoPacks",{enumerable:!0,get:function(){return o}}),Object.defineProperty(r,"resolvePack",{enumerable:!0,get:function(){return l}}),Object.defineProperty(r,"packRegions",{enumerable:!0,get:function(){return h}}),Object.defineProperty(r,"regionLabelPoint",{enumerable:!0,get:function(){return U}}),Object.defineProperty(r,"geoRamp",{enumerable:!0,get:function(){return J}}),Object.defineProperty(r,"basemapStyleOf",{enumerable:!0,get:function(){return de}}),Object.defineProperty(r,"drawGeomap",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(r,"regionAt",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(r,"markerAt",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(r,"checkGeometrySpec",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(r,"GEOMETRY_TYPES_PLACED",{enumerable:!0,get:function(){return Pe}});const ae=oe("packages/modules/charts/frame.js").Pool,ke=oe("packages/modules/charts/matrix.js").colourRamp,se=oe("packages/modules/charts/topojson.js").feature,ie=oe("packages/modules/charts/projection.js"),Z=ie.fitted,le=ie.graticule,D=ie.resolveProjection,d=ie.splitAntimeridian,T=oe("packages/modules/charts/labels.js").drawAnchoredLabels,W=oe("packages/modules/charts/axis.js"),G=W.overhangFor,A=W.setPlotClip,f=oe("packages/core/src/internal/util.js").warnOnce,N=oe("packages/modules/charts/scheme.js").resolveScheme,q=oe("packages/modules/charts/fills.js"),k=q.isFill,_=q.normaliseFill,c=oe("packages/modules/charts/scale.js"),v=c.isNumber,E=c.measureDomain,m=oe("packages/modules/charts/svg.js"),y=m.attrs,P=m.insideRings,Q=m.path,K=m.pathRings,ge=m.round,re=m.setText,ee=oe("packages/modules/charts/styles.js").NS,z=oe("packages/modules/charts/geocolumn.js"),n=z.bothPlacements,e=z.geometryColumnOf,i=Object.freeze(["AF","AN","AS","EU","NA","OC","SA"]),g=Object.freeze({AF:"Africa",AN:"Antarctica",AS:"Asia",EU:"Europe",NA:"North America",OC:"Oceania",SA:"South America"}),b=Object.freeze({NA:[[[-168,66],[-156,71],[-130,70],[-115,69],[-100,69],[-85,70],[-75,73],[-64,66],[-78,62],[-79,55],[-65,60],[-56,52],[-60,45],[-67,45],[-70,42],[-74,40],[-76,37],[-81,32],[-80,27],[-81,25],[-84,30],[-90,29],[-94,29],[-97,26],[-97,21],[-91,19],[-88,21],[-87,16],[-83,9],[-79,9],[-85,13],[-92,16],[-96,16],[-105,20],[-110,24],[-114,28],[-117,32],[-122,37],[-124,42],[-124,48],[-130,55],[-140,60],[-150,59],[-160,55],[-165,60],[-168,66]],[[-43,60],[-32,64],[-22,70],[-20,74],[-25,78],[-33,83],[-45,83],[-58,82],[-62,76],[-56,70],[-55,66],[-52,61],[-43,60]]],SA:[[[-81,12],[-72,12],[-62,11],[-52,5],[-50,0],[-44,-2],[-35,-6],[-38,-13],[-39,-18],[-48,-25],[-53,-34],[-57,-38],[-62,-40],[-65,-45],[-68,-52],[-75,-53],[-73,-45],[-73,-37],[-71,-30],[-70,-23],[-71,-18],[-76,-14],[-81,-6],[-80,-2],[-78,1],[-77,8],[-81,12]]],EU:[[[-10,36],[-9,44],[-2,43],[-4,48],[-1,49],[4,52],[7,53],[8,57],[10,58],[5,58],[5,62],[11,64],[15,69],[21,70],[28,71],[32,70],[40,67],[44,68],[50,69],[60,70],[60,60],[58,52],[50,46],[40,44],[36,45],[30,46],[28,41],[26,40],[23,38],[18,40],[13,38],[15,37],[12,44],[8,44],[3,42],[-2,37],[-10,36]],[[-5,50],[1,51],[2,53],[-1,55],[-3,58],[-5,58],[-6,55],[-5,50]],[[-10,52],[-6,52],[-6,55],[-10,55],[-10,52]]],AF:[[[-17,21],[-16,15],[-17,12],[-13,8],[-8,5],[-3,5],[3,6],[8,4],[9,2],[10,-2],[12,-6],[12,-12],[14,-18],[15,-23],[18,-29],[23,-34],[27,-34],[32,-29],[33,-26],[35,-22],[40,-16],[41,-10],[40,-3],[43,0],[51,4],[51,11],[45,12],[43,12],[39,15],[37,21],[34,28],[32,31],[25,32],[20,31],[15,32],[10,37],[3,36],[-2,35],[-6,36],[-10,30],[-13,27],[-17,21]]],AS:[[[26,40],[35,36],[36,31],[43,30],[48,30],[50,27],[56,25],[57,22],[60,25],[62,25],[67,24],[70,21],[73,16],[77,8],[80,6],[80,13],[84,19],[87,21],[92,21],[95,16],[98,10],[104,1],[104,10],[107,11],[109,17],[117,23],[122,30],[122,37],[126,34],[129,35],[130,43],[135,45],[142,45],[143,53],[140,58],[155,59],[162,60],[170,66],[180,68],[170,71],[150,73],[130,74],[110,76],[90,76],[75,73],[70,70],[60,70],[60,60],[58,52],[50,46],[40,44],[36,45],[30,46],[28,41],[26,40]],[[130,31],[132,32],[135,33],[137,34],[140,35],[141,38],[141,41],[142,42],[145,43],[145,45],[141,45],[140,42],[139,40],[137,37],[135,35],[133,34],[131,33],[130,31]]],OC:[[[113,-22],[114,-26],[115,-34],[119,-34],[126,-32],[132,-32],[137,-35],[141,-38],[147,-38],[150,-37],[153,-30],[153,-25],[146,-19],[142,-11],[136,-12],[130,-12],[126,-14],[122,-18],[113,-22]],[[145,-41],[148,-41],[148,-43],[145,-43],[145,-41]],[[173,-35],[178,-38],[174,-41],[172,-43],[167,-46],[170,-44],[173,-35]]],AN:[[[-180,-78],[-150,-76],[-120,-74],[-100,-73],[-80,-72],[-60,-63],[-45,-60],[-58,-64],[-70,-70],[-60,-76],[-30,-77],[0,-70],[20,-70],[40,-68],[60,-67],[80,-66],[100,-66],[120,-66],[140,-66],[160,-78],[170,-84],[180,-85],[-180,-85],[-180,-78]]]}),O=Object.freeze({AD:"EU",AE:"AS",AF:"AS",AG:"NA",AI:"NA",AL:"EU",AM:"AS",AO:"AF",AQ:"AN",AR:"SA",AS:"OC",AT:"EU",AU:"OC",AW:"NA",AX:"EU",AZ:"AS",BA:"EU",BB:"NA",BD:"AS",BE:"EU",BF:"AF",BG:"EU",BH:"AS",BI:"AF",BJ:"AF",BM:"NA",BN:"AS",BO:"SA",BR:"SA",BS:"NA",BT:"AS",BW:"AF",BY:"EU",BZ:"NA",CA:"NA",CD:"AF",CF:"AF",CG:"AF",CH:"EU",CI:"AF",CL:"SA",CM:"AF",CN:"AS",CO:"SA",CR:"NA",CU:"NA",CV:"AF",CY:"AS",CZ:"EU",DE:"EU",DJ:"AF",DK:"EU",DM:"NA",DO:"NA",DZ:"AF",EC:"SA",EE:"EU",EG:"AF",ER:"AF",ES:"EU",ET:"AF",FI:"EU",FJ:"OC",FK:"SA",FM:"OC",FO:"EU",FR:"EU",GA:"AF",GB:"EU",GD:"NA",GE:"AS",GF:"SA",GG:"EU",GH:"AF",GI:"EU",GL:"NA",GM:"AF",GN:"AF",GP:"NA",GQ:"AF",GR:"EU",GT:"NA",GU:"OC",GW:"AF",GY:"SA",HK:"AS",HN:"NA",HR:"EU",HT:"NA",HU:"EU",ID:"AS",IE:"EU",IL:"AS",IM:"EU",IN:"AS",IQ:"AS",IR:"AS",IS:"EU",IT:"EU",JE:"EU",JM:"NA",JO:"AS",JP:"AS",KE:"AF",KG:"AS",KH:"AS",KI:"OC",KM:"AF",KN:"NA",KP:"AS",KR:"AS",KW:"AS",KY:"NA",KZ:"AS",LA:"AS",LB:"AS",LC:"NA",LI:"EU",LK:"AS",LR:"AF",LS:"AF",LT:"EU",LU:"EU",LV:"EU",LY:"AF",MA:"AF",MC:"EU",MD:"EU",ME:"EU",MG:"AF",MH:"OC",MK:"EU",ML:"AF",MM:"AS",MN:"AS",MO:"AS",MQ:"NA",MR:"AF",MT:"EU",MU:"AF",MV:"AS",MW:"AF",MX:"NA",MY:"AS",MZ:"AF",NA:"AF",NC:"OC",NE:"AF",NG:"AF",NI:"NA",NL:"EU",NO:"EU",NP:"AS",NR:"OC",NZ:"OC",OM:"AS",PA:"NA",PE:"SA",PF:"OC",PG:"OC",PH:"AS",PK:"AS",PL:"EU",PM:"NA",PR:"NA",PS:"AS",PT:"EU",PW:"OC",PY:"SA",QA:"AS",RE:"AF",RO:"EU",RS:"EU",RU:"EU",RW:"AF",SA:"AS",SB:"OC",SC:"AF",SD:"AF",SE:"EU",SG:"AS",SI:"EU",SK:"EU",SL:"AF",SM:"EU",SN:"AF",SO:"AF",SR:"SA",SS:"AF",ST:"AF",SV:"NA",SY:"AS",SZ:"AF",TC:"NA",TD:"AF",TG:"AF",TH:"AS",TJ:"AS",TL:"AS",TM:"AS",TN:"AF",TO:"OC",TR:"AS",TT:"NA",TV:"OC",TW:"AS",TZ:"AF",UA:"EU",UG:"AF",US:"NA",UY:"SA",UZ:"AS",VA:"EU",VC:"NA",VE:"SA",VG:"NA",VI:"NA",VN:"AS",VU:"OC",WS:"OC",YE:"AS",YT:"AF",ZA:"AF",ZM:"AF",ZW:"AF"}),ne=Object.freeze({AFG:"AF",ALB:"AL",DZA:"DZ",AND:"AD",AGO:"AO",ARG:"AR",ARM:"AM",AUS:"AU",AUT:"AT",AZE:"AZ",BHS:"BS",BHR:"BH",BGD:"BD",BRB:"BB",BLR:"BY",BEL:"BE",BLZ:"BZ",BEN:"BJ",BTN:"BT",BOL:"BO",BIH:"BA",BWA:"BW",BRA:"BR",BRN:"BN",BGR:"BG",BFA:"BF",BDI:"BI",KHM:"KH",CMR:"CM",CAN:"CA",CPV:"CV",CAF:"CF",TCD:"TD",CHL:"CL",CHN:"CN",COL:"CO",COM:"KM",COG:"CG",COD:"CD",CRI:"CR",CIV:"CI",HRV:"HR",CUB:"CU",CYP:"CY",CZE:"CZ",DNK:"DK",DJI:"DJ",DMA:"DM",DOM:"DO",ECU:"EC",EGY:"EG",SLV:"SV",GNQ:"GQ",ERI:"ER",EST:"EE",ETH:"ET",FJI:"FJ",FIN:"FI",FRA:"FR",GAB:"GA",GMB:"GM",GEO:"GE",DEU:"DE",GHA:"GH",GRC:"GR",GRL:"GL",GTM:"GT",GIN:"GN",GNB:"GW",GUY:"GY",HTI:"HT",HND:"HN",HKG:"HK",HUN:"HU",ISL:"IS",IND:"IN",IDN:"ID",IRN:"IR",IRQ:"IQ",IRL:"IE",ISR:"IL",ITA:"IT",JAM:"JM",JPN:"JP",JOR:"JO",KAZ:"KZ",KEN:"KE",KIR:"KI",PRK:"KP",KOR:"KR",KWT:"KW",KGZ:"KG",LAO:"LA",LVA:"LV",LBN:"LB",LSO:"LS",LBR:"LR",LBY:"LY",LIE:"LI",LTU:"LT",LUX:"LU",MKD:"MK",MDG:"MG",MWI:"MW",MYS:"MY",MDV:"MV",MLI:"ML",MLT:"MT",MHL:"MH",MRT:"MR",MUS:"MU",MEX:"MX",FSM:"FM",MDA:"MD",MCO:"MC",MNG:"MN",MNE:"ME",MAR:"MA",MOZ:"MZ",MMR:"MM",NAM:"NA",NRU:"NR",NPL:"NP",NLD:"NL",NZL:"NZ",NIC:"NI",NER:"NE",NGA:"NG",NOR:"NO",OMN:"OM",PAK:"PK",PLW:"PW",PSE:"PS",PAN:"PA",PNG:"PG",PRY:"PY",PER:"PE",PHL:"PH",POL:"PL",PRT:"PT",PRI:"PR",QAT:"QA",ROU:"RO",RUS:"RU",RWA:"RW",KNA:"KN",LCA:"LC",VCT:"VC",WSM:"WS",SMR:"SM",STP:"ST",SAU:"SA",SEN:"SN",SRB:"RS",SYC:"SC",SLE:"SL",SGP:"SG",SVK:"SK",SVN:"SI",SLB:"SB",SOM:"SO",ZAF:"ZA",SSD:"SS",ESP:"ES",LKA:"LK",SDN:"SD",SUR:"SR",SWZ:"SZ",SWE:"SE",CHE:"CH",SYR:"SY",TWN:"TW",TJK:"TJ",TZA:"TZ",THA:"TH",TLS:"TL",TGO:"TG",TON:"TO",TTO:"TT",TUN:"TN",TUR:"TR",TKM:"TM",TUV:"TV",UGA:"UG",UKR:"UA",ARE:"AE",GBR:"GB",USA:"US",URY:"UY",UZB:"UZ",VUT:"VU",VEN:"VE",VNM:"VN",YEM:"YE",ZMB:"ZM",ZWE:"ZW"}),H=Object.freeze({4:"AF",8:"AL",12:"DZ",20:"AD",24:"AO",32:"AR",36:"AU",40:"AT",44:"BS",48:"BH",50:"BD",51:"AM",52:"BB",56:"BE",64:"BT",68:"BO",70:"BA",72:"BW",76:"BR",84:"BZ",90:"SB",96:"BN",100:"BG",104:"MM",108:"BI",112:"BY",116:"KH",120:"CM",124:"CA",132:"CV",140:"CF",144:"LK",148:"TD",152:"CL",156:"CN",170:"CO",174:"KM",178:"CG",180:"CD",188:"CR",191:"HR",192:"CU",196:"CY",203:"CZ",204:"BJ",208:"DK",212:"DM",214:"DO",218:"EC",222:"SV",226:"GQ",231:"ET",232:"ER",233:"EE",246:"FI",250:"FR",262:"DJ",266:"GA",268:"GE",270:"GM",276:"DE",288:"GH",300:"GR",304:"GL",320:"GT",324:"GN",328:"GY",332:"HT",340:"HN",344:"HK",348:"HU",352:"IS",356:"IN",360:"ID",364:"IR",368:"IQ",372:"IE",376:"IL",380:"IT",384:"CI",388:"JM",392:"JP",398:"KZ",400:"JO",404:"KE",408:"KP",410:"KR",414:"KW",417:"KG",418:"LA",422:"LB",426:"LS",428:"LV",430:"LR",434:"LY",438:"LI",440:"LT",442:"LU",450:"MG",454:"MW",458:"MY",462:"MV",466:"ML",470:"MT",478:"MR",480:"MU",484:"MX",496:"MN",498:"MD",499:"ME",504:"MA",508:"MZ",512:"OM",516:"NA",520:"NR",524:"NP",528:"NL",548:"VU",554:"NZ",558:"NI",562:"NE",566:"NG",578:"NO",586:"PK",585:"PW",591:"PA",598:"PG",600:"PY",604:"PE",608:"PH",616:"PL",620:"PT",624:"GW",626:"TL",630:"PR",634:"QA",642:"RO",643:"RU",646:"RW",682:"SA",686:"SN",688:"RS",690:"SC",694:"SL",702:"SG",703:"SK",704:"VN",705:"SI",706:"SO",710:"ZA",716:"ZW",724:"ES",728:"SS",729:"SD",740:"SR",748:"SZ",752:"SE",756:"CH",760:"SY",762:"TJ",764:"TH",768:"TG",776:"TO",780:"TT",784:"AE",788:"TN",792:"TR",795:"TM",798:"TV",800:"UG",804:"UA",807:"MK",818:"EG",826:"GB",834:"TZ",840:"US",858:"UY",860:"UZ",862:"VE",882:"WS",887:"YE",894:"ZM"});function F(te){if(te==null||te==="")return null;const Se=String(te).trim().toUpperCase();return Se?/^\d+$/.test(Se)?H[String(Number(Se))]||null:Se.length===2?Se:Se.length===3&&ne[Se]||null:null}function s(te){return te?i.includes(te)&&!(te in O)||i.includes(te)?te:O[te]||null:null}function M(te,Se={}){const ye=Se.antarctic?-90:-58,be=84,Ne=be-ye,je=Math.min(te.width/360,te.height/Ne),Ee=360*je,Ce=Ne*je,Fe=te.left+(te.width-Ee)/2,We=te.top+(te.height-Ce)/2;return(wt,lt)=>[Fe+(wt+180)*je,We+(be-lt)*je]}function B(te=!1){return i.filter(Se=>Se!=="AN"||te).map(Se=>({code:Se,label:g[Se],rings:b[Se]}))}function I(te,Se){const ye=[];for(let be=0;be<te.length;be++){const[Ne,je]=Se(te[be][0],te[be][1]);if(!Number.isFinite(Ne)||!Number.isFinite(je))return ye.length>4?Q([...ye,"Z"]):"";ye.push(be?"L":"M",ge(Ne),ge(je))}return ye.length?Q([...ye,"Z"]):""}function V(te,Se){const ye=Array.isArray(te)&&Array.isArray(te[0])&&Array.isArray(te[0][0])?te:[te],be=[];for(const Ne of ye)if(!(!Array.isArray(Ne)||!Ne.length)){for(let je=0;je<Ne.length;je++){const[Ee,Ce]=Se(Ne[je][0],Ne[je][1]);be.push(je?"L":"M",ge(Ee),ge(Ce))}be.push("Z")}return Q(be)}function fe(te){const Se=new Map,ye=te.shapes;if(!ye)return Se;const be=M(te.plot),Ne=te.codeProperty||"iso_a2";if(!Array.isArray(ye)&&!ye.type){for(const Ee of Object.keys(ye)){const Ce=F(Ee);Ce&&typeof ye[Ee]=="string"&&Se.set(Ce,ye[Ee])}return Se}const je=ye.type==="FeatureCollection"?ye.features||[]:[ye];for(const Ee of je){const Ce=Ee.properties||{},Fe=F(Ce[Ne]??Ce.iso??Ce.code),We=Ee.geometry;if(!Fe||!We)continue;const wt=We.type==="MultiPolygon"?We.coordinates:We.type==="Polygon"?[We.coordinates]:[],lt=[];for(const st of wt)for(const Qe of st)lt.push(V(Qe,be));lt.length&&Se.set(Fe,lt.join(" "))}return Se}const a=new Map;function x(te){return te&&typeof te=="object"&&typeof te.id=="string"&&a.set(te.id,te),te}function R(te){return a.get(te)||null}function o(){return[...a.keys()]}function l(te,Se){if(!te||typeof te!="object")return null;const ye=te;let be=te;if(typeof ye.pack=="string"){if(be=a.get(ye.pack),!be)return f(`chart:geomap:pack:${ye.pack}`,`geometry pack ${JSON.stringify(ye.pack)} has not been loaded, so the map fell back to the schematic continents. Import the pack module and pass it as \`shapes\` — import { pack } from '@toclocoinc/lattice-grid/modules/geo-${ye.pack}'; createChart({ …, shapes: pack })${a.size?`. Loaded: ${[...a.keys()].join(", ")}.`:"."}`),null}else ye.pack&&typeof ye.pack=="object"&&(be=ye.pack);if(!be||typeof be!="object")return null;const Ne=be;if(Ne.topology)return{pack:Ne,topology:Ne.topology};if(Ne.layers){const je=typeof ye.layer=="string"&&ye.layer||typeof Se=="string"&&Se||Ne.defaultLayer||Object.keys(Ne.layers)[0],Ee=Ne.layers[je];if(Ee&&Ee.topology)return{pack:Ne,topology:Ee.topology,layer:je}}return null}const t=new WeakMap;function h(te){const Se=t.get(te);if(Se)return Se;const ye=[];for(const be of se(te,"regions").features){const Ne=[],je=be.geometry,Ee=je.type==="MultiPolygon"?je.coordinates:je.type==="Polygon"?[je.coordinates]:[];for(const Ce of Ee)for(const Fe of Ce)for(const We of d(Fe))Ne.push(We);Ne.length&&ye.push({code:String(be.id===void 0||be.id===null?"":be.id),label:be.properties&&be.properties.name||String(be.id||""),properties:be.properties||{},rings:Ne})}return t.set(te,ye),ye}function j(te,Se){const ye=[];for(let be=0;be<te.length;be++){const[Ne,je]=Se(te[be][0],te[be][1]);!Number.isFinite(Ne)||!Number.isFinite(je)||ye.push(ye.length?"L":"M",ge(Ne),ge(je))}return ye.length>2?Q(ye):""}function U(te){let Se=null,ye=-1;for(const je of te){if(!je||je.length<3)continue;let Ee=0,Ce=0,Fe=0;for(let wt=0;wt<je.length;wt++){const[lt,st]=je[wt],[Qe,rt]=je[(wt+1)%je.length],pt=lt*rt-Qe*st;Ee+=pt,Ce+=(lt+Qe)*pt,Fe+=(st+rt)*pt}Ee/=2;const We=Math.abs(Ee);We<1e-9||We>ye&&(ye=We,Se=[Ce/(6*Ee),Fe/(6*Ee)])}if(Se)return Se;const be=te.flat();if(!be.length)return null;const Ne=be.reduce((je,[Ee,Ce])=>[je[0]+Ee,je[1]+Ce],[0,0]);return[Ne[0]/be.length,Ne[1]/be.length]}function J(te,Se,ye,be){const Ne=ke(te,Se,ye,be);if(Se)return Ne;const je=1/6,Ee=Fe=>Ne.colourAt(je+Fe*(1-je));return Object.assign(Fe=>Ee(Ne.position(Fe)),{...Ne,colourAt:Ee})}function X(te,Se){return(ye,be)=>{const[Ne,je]=te(ye,be);return!Number.isFinite(Ne)||!Number.isFinite(je)?[Ne,je]:[Math.min(Math.max(Ne,Se.left),Se.right),Math.min(Math.max(je,Se.top),Se.bottom)]}}function de(te,Se){const ye=te&&te.fill,be="var(--lattice-chart-basemap-fill, #c3cfd6)",Ne=k(ye)?Se?Se.paint(ye,be):(_(ye,be)||{}).solid||be:ye||be,je=te&&te.stroke||"var(--lattice-chart-basemap-stroke, #456374)",Ee=te&&te.strokeWidth!=null?te.strokeWidth:"var(--lattice-chart-basemap-stroke-width, 0.75)";return{fill:Ne,style:`stroke:${je};stroke-width:${Ee}`}}function pe(te){const Se=te.scheme||N(),{plot:ye,bound:be}=te;new ae(te.groups.grid).finish(),new ae(te.groups.axis).finish(),new ae(te.groups.rules).finish(),new ae(te.groups.labels).finish();const Ne=l(te.shapes,te.layer),je=Ne?new Map:fe({shapes:te.shapes,plot:ye,codeProperty:te.codeProperty}),Ee=je.size>0||!!Ne,Ce=Ne?h(Ne.topology):null,Fe=new Map;if(Ce)for(const ot of Ce){Fe.set(ot.code,ot);const dt=ot.properties||{};dt.alpha3&&Fe.set(String(dt.alpha3).toUpperCase(),ot),dt.numeric&&Fe.set(String(Number(dt.numeric)),ot),dt.fips&&Fe.set(String(dt.fips),ot)}const We=new Map,wt=[],lt=be.series[0];if(lt)for(let ot=0;ot<lt.points.length;ot++){const dt=lt.points[ot];if(!v(dt.y))continue;const it=be.categories[ot],bt=F(it),Jt=Ce?[bt,it==null?"":String(it).trim().toUpperCase()].map(zt=>zt?Fe.get(zt):null).find(Boolean):null,en=Jt?Jt.code:null,Mt=Ce?en:Ee?bt:s(bt);if(!Mt||Ee&&!Ce&&!je.has(Mt)){be.labels[ot]&&wt.push(be.labels[ot]);continue}const Lt=We.get(Mt)||{value:0,labels:[]};Lt.value+=dt.y,Lt.labels.push(be.labels[ot]),We.set(Mt,Lt)}const st=We.has("AN")||We.has("AQ"),Qe=M(ye,{antarctic:st});let rt=null;if(Ce){const ot=st?Ce:Ce.filter(it=>it.code!=="AQ"&&it.code!=="AN"),dt=D(te.projection||Ne.pack.projection,{...Ne.pack.projectionOptions||{},...te.projectionOptions||{}},it=>f(`chart:geomap:projection:${String(te.projection)}`,it));rt={project:dt,...Z({project:dt,rings:ot.flatMap(it=>it.rings),plot:ye,zoom:te.zoom,centre:te.centre,centreOffset:te.centreOffset}),drawn:ot}}const pt=E([...We.values()].map(ot=>ot.value),{zero:!te.diverging,nice:!1}),Ht=J(pt,!!te.diverging,Se,[...We.values()].map(ot=>ot.value)),kt=G("geomap");A(te.groups,ye,kt);const Gt={left:ye.left-kt,top:ye.top-kt,right:ye.right+kt,bottom:ye.bottom+kt},Vt=rt?X(rt.to,Gt):null,Ye=new ae(te.groups.marks);if(!!te.graticule&&!!rt){const ot=te.graticule&&typeof te.graticule=="object"&&te.graticule.step||30;for(const dt of le({step:ot}))for(const it of d(dt)){const bt=j(it,Vt);if(!bt)continue;const Jt=Ye.next("path",`${ee}__graticule`);y(Jt,{d:bt,class:`${ee}__graticule`})}}const gt=[],ut=rt?rt.drawn.map(ot=>ot.code):Ee?[...je.keys()]:i.filter(ot=>ot!=="AN"||st),Ue=rt?new Map(rt.drawn.map(ot=>[ot.code,ot])):null,ft=rt?de(te.basemap,Se.fills):null;for(const ot of ut){const dt=rt?Ue.get(ot).rings.map(Jt=>I(Jt,Vt)).filter(Boolean).join(" "):Ee?je.get(ot):V(b[ot],Qe),it=We.get(ot),bt=Ye.next("path",`${ee}__region ${ee}__mark`);y(bt,{d:dt,fill:it?Ht(it.value):ft?ft.fill:"var(--lattice-chart-empty, #eceff1)","data-code":ot,class:`${ee}__region ${ee}__mark`,style:ft?ft.style:null}),gt.push({code:ot,value:it?it.value:null,label:!Ee&&g[ot]||Ue&&Ue.get(ot).label||it&&it.labels[0]||ot,element:bt,d:dt})}Ye.finish();const yt=new ae(te.groups.overlay);if(wt.length){const ot=yt.next("text",`${ee}__geo-note`);y(ot,{x:ge(ye.left),y:ge(ye.bottom),"text-anchor":"start"}),re(ot,te.grid.messages.t("chart.geoUnmatched",{count:wt.length}))}yt.finish();let Ct=0;if(te.labels&&te.labels.show&&rt){const ot=gt.filter(dt=>dt.value!==null).sort((dt,it)=>it.value-dt.value).map(dt=>{const it=Ue.get(dt.code).rings.map(Jt=>Jt.map(([en,Mt])=>rt.to(en,Mt))),bt=U(it);return bt&&{x:bt[0],y:bt[1],text:dt.label}}).filter(Boolean);Ct=T({group:te.groups.labels,size:te.fontSize,minGap:te.labels.minGap,anchors:ot,plot:ye})}return{regions:gt,ramp:Ht,unmatched:wt,useCountries:Ee,packed:!!rt,scale:rt?rt.scale:null,attribution:Ne&&Ne.pack.attribution||"",aspect:rt?rt.aspect:null,labelsDrawn:Ct}}function xe(te){for(const Se of te.regions||[]){if(!Se.rings){Se.rings=K(Se.d);let be=1/0,Ne=1/0,je=-1/0,Ee=-1/0;for(const Ce of Se.rings)for(const[Fe,We]of Ce)Fe<be&&(be=Fe),Fe>je&&(je=Fe),We<Ne&&(Ne=We),We>Ee&&(Ee=We);Se.box={minX:be,minY:Ne,maxX:je,maxY:Ee}}const ye=Se.box;if(!(!ye||te.x<ye.minX||te.x>ye.maxX||te.y<ye.minY||te.y>ye.maxY)&&P(Se.rings,te.x,te.y))return Se}return null}function ve(te){let ye=null,be=1/0;for(const Ne of te.markers||[]){if(!Ne)continue;const je=(Ne.r||0)+3,Ee=te.x-Ne.x,Ce=te.y-Ne.y;if(Ne.half){if(Math.abs(Ee)>Ne.half+3||Math.abs(Ce)>Ne.half+3)continue;const We=Math.sqrt(Ee*Ee+Ce*Ce);if(We>=be)continue;be=We,ye=Ne;continue}const Fe=Math.sqrt(Ee*Ee+Ce*Ce);Fe>je||Fe>=be||(be=Fe,ye=Ne)}return ye}function Oe(te){const{grid:Se,spec:ye,type:be,id:Ne}=te;if(!ye||!Pe.has(be))return;if(n(ye)){f(`chart:${Ne}:geometry:both`,`a "${be}" chart was given both "geometry" and "lon"/"lat", and a row is placed by one or the other, so nothing was drawn rather than one being picked for you. Keep "geometry" for a geometry column, or "lon" and "lat" for two coordinate columns.`);return}const je=e(Se,ye);if(!je){be==="choropleth"&&f(`chart:${Ne}:geometry:missing`,`a "choropleth" chart draws each row's own shape from a geometry column and was given none, so it has nothing to draw. Name the column: geometry: '<column>'.`);return}je.measure||f(`chart:${Ne}:geometry:type:${je.col}`,`a "${be}" chart reads "geometry" from column ${JSON.stringify(je.col)}, which is not a geometry column, so no row could be placed. Import '@toclocoinc/lattice-grid/modules/geometry' and declare the column type: 'geometry'.`)}const Pe=new Set(["markermap","bubblemap","choropleth"])}),tt("packages/modules/charts/force.js",function(r,oe){"use strict";Object.defineProperty(r,"ITERATIONS",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(r,"sequence",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"layoutForce",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"layoutNetwork",{enumerable:!0,get:function(){return ie}});const Ae=220,ae=2400,$=.006,ke=.015;function we(Z){let le=Z>>>0||1;return()=>(le^=le<<13,le>>>=0,le^=le>>17,le^=le<<5,le>>>=0,le/4294967296)}function se(Z){const{nodes:le,links:D,plot:d}=Z;if(!le.length)return{nodes:le,ticks:0};const L=Number.isFinite(Z.repulsion)?Z.repulsion:ae,T=Number.isFinite(Z.attraction)?Z.attraction:$,W=Number.isFinite(Z.gravity)?Z.gravity:ke,G=we(le.length*2654435761),A=d.left+d.width/2,p=d.top+d.height/2,f=Math.min(d.width,d.height)/3;for(const N of le){const q=G()*Math.PI*2,k=f*(.35+G()*.65);if(Z.keep&&Number.isFinite(N.x)&&Number.isFinite(N.y)){N.vx=0,N.vy=0;continue}N.x=A+Math.cos(q)*k,N.y=p+Math.sin(q)*k,N.vx=0,N.vy=0}for(const N of le)N.pinned=Number.isFinite(N.fx)&&Number.isFinite(N.fy),N.pinned&&(N.x=d.left+Math.max(0,Math.min(1,N.fx))*d.width,N.y=d.top+Math.max(0,Math.min(1,N.fy))*d.height);const w=Z.iterations||Ae;for(let N=0;N<w;N++){const q=(Number.isFinite(Z.heat)?Z.heat:1)*(1-N/w);for(let k=0;k<le.length;k++){const _=le[k];for(let c=k+1;c<le.length;c++){const v=le[c];let E=_.x-v.x,m=_.y-v.y,y=Math.sqrt(E*E+m*m);y<.01&&(E=k-c||1,m=1,y=Math.sqrt(E*E+m*m));const P=L/(y*y),Q=E/y*P,K=m/y*P;_.vx+=Q,_.vy+=K,v.vx-=Q,v.vy-=K}}for(const k of D){const _=k.source,c=k.target;if(_===c)continue;const v=c.x-_.x,E=c.y-_.y,m=T*(k.weight||1);_.vx+=v*m,_.vy+=E*m,c.vx-=v*m,c.vy-=E*m}for(const k of le){if(k.pinned){k.vx=0,k.vy=0;continue}k.vx+=(A-k.x)*W,k.vy+=(p-k.y)*W,k.x+=k.vx*q*.08,k.y+=k.vy*q*.08,k.vx*=.82,k.vy*=.82,k.x=Math.max(d.left+8,Math.min(d.right-8,k.x)),k.y=Math.max(d.top+8,Math.min(d.bottom-8,k.y))}}return{nodes:le,ticks:w}}function ie(Z){return se(Z).nodes}}),tt("packages/modules/charts/network.js",function(r,oe){"use strict";Object.defineProperty(r,"glyphFor",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"glyphTransform",{enumerable:!0,get:function(){return N}}),Object.defineProperty(r,"ITERATIONS",{enumerable:!0,get:function(){return k}}),Object.defineProperty(r,"layoutNetwork",{enumerable:!0,get:function(){return _}}),Object.defineProperty(r,"sequence",{enumerable:!0,get:function(){return c}}),Object.defineProperty(r,"LINK_GAP",{enumerable:!0,get:function(){return v}}),Object.defineProperty(r,"ICON_RADIUS",{enumerable:!0,get:function(){return E}}),Object.defineProperty(r,"offsetParallel",{enumerable:!0,get:function(){return m}}),Object.defineProperty(r,"drawNetwork",{enumerable:!0,get:function(){return y}}),Object.defineProperty(r,"emphasiseNetwork",{enumerable:!0,get:function(){return P}}),Object.defineProperty(r,"nodeAt",{enumerable:!0,get:function(){return K}}),Object.defineProperty(r,"linkAt",{enumerable:!0,get:function(){return ge}});const ae=oe("packages/modules/charts/frame.js").Pool,ke=oe("packages/modules/charts/scheme.js").resolveScheme,we=oe("packages/modules/charts/svg.js"),se=we.attrs,ie=we.path,Z=we.round,le=we.setText,d=oe("packages/modules/charts/styles.js").NS,L=oe("packages/modules/charts/typography.js"),T=L.applySize,W=L.truncateTo,G=oe("packages/modules/charts/rulecolour.js"),A=G.ruleColour,p=G.ruleLegend,f=oe("packages/modules/charts/glyph.js"),w=f.glyphFor,N=f.glyphTransform,q=oe("packages/modules/charts/force.js"),k=q.ITERATIONS,_=q.layoutNetwork,c=q.sequence,v=4,E=10;function m(re){const C=new Map;for(const ee of re){const z=ee.pair||`${ee.source.key}\0${ee.target.key}`;C.has(z)||C.set(z,[]),C.get(z).push(ee)}for(const ee of C.values()){const z=ee.length;for(let n=0;n<z;n++){const e=ee[n],i=e.source,g=e.target,b=g.x-i.x,O=g.y-i.y,ne=Math.sqrt(b*b+O*O)||1,H=ne?-O/ne:0,F=ne?b/ne:1,s=(n-(z-1)/2)*v;e.offset=s,e.bundled=z>1,e.line={x1:i.x+H*s,y1:i.y+F*s,x2:g.x+H*s,y2:g.y+F*s}}}}function y(re){const C=re.scheme||ke(),{plot:ee,bound:z}=re;for(const V of["grid","axis","rules","labels"])new ae(re.groups[V]).finish();const n=z.nodes,e=z.links.map(V=>({...V,weight:V.value}));if(!n.length)return{nodes:[],links:[],legend:[]};const i=e.reduce((V,fe)=>Math.max(V,fe.value),0)||1;for(const V of e)V.weight=V.value/i;_({nodes:n,links:e,plot:ee,iterations:re.iterations}),m(e);const g=z.measure&&z.measure.col||null,b=new Set;for(const V of e)V.colour=A({grid:re.grid,col:g,value:V.value}),V.colour&&b.add(V.colour);const O=n.reduce((V,fe)=>Math.max(V,fe.in+fe.out),0)||1,ne=new ae(re.groups.marks),H=Number.isFinite(re.linkWidth)&&re.linkWidth>0?Number(re.linkWidth):null;for(const V of e){V.drawnWidth=H===null?.5+V.weight*3:H;const fe=ne.next("path",`${d}__edge ${d}__mark`);se(fe,{d:ie(["M",Z(V.line.x1),Z(V.line.y1),"L",Z(V.line.x2),Z(V.line.y2)]),style:V.colour?`stroke:${V.colour};stroke-opacity:1`:null,"stroke-width":Z(V.drawnWidth),fill:"none"}),V.el=fe}for(const V of n){const fe=(V.in+V.out)/O,a=V.icon||re.icon||null;V.glyph=w(re.grid,a),V.r=4+Math.sqrt(fe)*12,V.glyph&&(V.r=Math.max(V.r,E));const x=ne.next("circle",`${d}__node ${d}__mark`);se(x,{cx:Z(V.x),cy:Z(V.y),r:Z(V.r),fill:C.series(V.index),"data-node":V.key}),V.el=x}ne.finish();const F=new ae(re.groups.overlay),s=[];for(const V of n){if(!V.glyph){V.glyphEls=[];continue}const fe=V.glyph.paint==="stroke",a=N(V.glyph,{x:V.x,y:V.y,size:V.r*1.3});V.glyphEls=V.glyph.paths.map(x=>{const R=F.next("path",`${d}__node-icon${fe?` ${d}__node-icon--stroke`:""}`);return se(R,{d:x,transform:a}),R}),s.push(...V.glyphEls)}const M=re.typography&&re.typography.small||re.fontSize,B=n.filter(V=>V.declared),I=n.filter(V=>!V.declared).sort((V,fe)=>fe.in+fe.out-(V.in+V.out)).slice(0,12);for(const V of[...B,...I]){const fe=F.next("text",`${d}__flow-label`);T(fe,M),se(fe,{x:Z(V.x),y:Z(V.y+V.r+M),"text-anchor":"middle"}),le(fe,W(V.label,90,M)),V.labelEl=fe}return F.finish(),{nodes:n,links:e,glyphs:s,legend:p({grid:re.grid,col:g,colours:b})}}function P(re){const C=re.drawn||{},ee=re.keys||new Set,z=ee.size>0;let n=0;const e=new Set;for(const i of C.links||[]){const g=z&&(i.rowKeys||[]).some(b=>ee.has(b));g&&(n++,e.add(i.source),e.add(i.target)),Q(i.el,z&&!g)}for(const i of C.nodes||[]){const g=e.has(i);g&&n++,Q(i.el,z&&!g);for(const b of i.glyphEls||[])Q(b,z&&!g)}return n}function Q(re,C){!re||!re.setAttribute||(C?re.setAttribute("data-dim","true"):re.removeAttribute("data-dim"))}function K(re){const C=typeof re.slack=="number"?re.slack:2;let ee=null,z=1/0;for(const n of re.nodes||[]){if(typeof n.x!="number"||typeof n.y!="number")continue;const e=re.x-n.x,i=re.y-n.y,g=Math.sqrt(e*e+i*i);g<=(n.r||0)+C&&g<z&&(z=g,ee=n)}return ee}function ge(re){let C=null,ee=1/0;for(const z of re.links||[]){const n=z.line,e=n?{x:n.x1,y:n.y1}:z.source,i=n?{x:n.x2,y:n.y2}:z.target;if(!e||!i||typeof e.x!="number"||typeof i.x!="number")continue;const g=i.x-e.x,b=i.y-e.y,O=g*g+b*b,ne=O?Math.max(0,Math.min(1,((re.x-e.x)*g+(re.y-e.y)*b)/O)):0,H=re.x-(e.x+ne*g),F=re.y-(e.y+ne*b),s=Math.sqrt(H*H+F*F),M=Number.isFinite(z.drawnWidth)?z.drawnWidth:.5+(z.weight||0)*3,B=z.bundled?Math.min(Math.max(2,M/2),v/2):Math.max(3,M/2);s<=B&&s<ee&&(ee=s,C=z)}return C}}),tt("packages/modules/charts/hnodes.js",function(r,oe){"use strict";Object.defineProperty(r,"MIN_HIT",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(r,"isHierarchyDraw",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(r,"hnodeAt",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"emphasiseHierarchy",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"emphasiseLayout",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"emphasiseChord",{enumerable:!0,get:function(){return ie}});const Ae=7;function ae(Z){return!!Z&&Array.isArray(Z.hnodes)}function $(Z){const le=Z.view||{k:1,tx:0,ty:0},D=le.k||1,d=(Z.x-le.tx)/D,L=(Z.y-le.ty)/D;let T=null;for(const W of Z.hnodes)if(!W.hidden){if(Array.isArray(W.polygon)){if(!ke(W.polygon,d,L))continue}else{const G=Math.max(W.r,Ae/D),A=d-W.x,p=L-W.y;if(A*A+p*p>G*G)continue}(!T||W.r<T.r||W.r===T.r&&W.depth>=T.depth)&&(T=W)}return T}function ke(Z,le,D){let d=!1;const L=Z.length;for(let T=0,W=L-2;T<L;W=T,T+=2){const G=Z[T+1],A=Z[W+1];G>D!=A>D&&le<(Z[W]-Z[T])*(D-G)/(A-G)+Z[T]&&(d=!d)}return d}function we(Z){const le=Z.keys||new Set;let D=0;for(const d of Z.drawn.hnodes||[]){const L=d.element;if(!L||!L.setAttribute)continue;const T=d.node&&d.node.rowKeys||[];!le.size||T.some(G=>le.has(G))?(L.removeAttribute("data-dim"),D+=1):L.setAttribute("data-dim","true")}return D}function se(Z){const le=Z.keys||new Set;let D=0;for(const d of Z.marks&&Z.marks.childNodes||[]){if(!d||!d.getAttribute)continue;const L=d.getAttribute(Z.attribute);if(L===null)continue;const T=Z.entries[Number(L)],W=T&&(T.node||T.item&&T.item.node),G=W&&(W.rowKeys&&W.rowKeys.length?W.rowKeys:W.rowKey?[W.rowKey]:[])||[];!le.size||G.some(p=>le.has(p))?(d.removeAttribute("data-dim"),D+=1):d.setAttribute("data-dim","true")}return D}function ie(Z){const le=Z.keys||new Set,D=new Map,d=new Map;for(const{link:T}of Z.drawn.ribbons||[]){const W=T.rowKeys||[];D.set(`${T.source.key}->${T.target.key}`,W);for(const G of[T.source,T.target]){const A=d.get(G.key)||[];d.set(G.key,A.concat(W))}}let L=0;for(const T of Z.marks&&Z.marks.childNodes||[]){if(!T||!T.getAttribute)continue;const W=T.getAttribute("data-link"),G=T.getAttribute("data-node");if(W===null&&G===null)continue;const A=(W!==null?D.get(W):d.get(G))||[];!le.size||A.some(f=>le.has(f))?(T.removeAttribute("data-dim"),L+=1):T.setAttribute("data-dim","true")}return L}}),tt("packages/modules/charts/flow.js",function(r,oe){"use strict";Object.defineProperty(r,"assignDepths",{enumerable:!0,get:function(){return c}}),Object.defineProperty(r,"layoutSankey",{enumerable:!0,get:function(){return v}}),Object.defineProperty(r,"ribbon",{enumerable:!0,get:function(){return E}}),Object.defineProperty(r,"drawSankey",{enumerable:!0,get:function(){return m}}),Object.defineProperty(r,"readDirected",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(r,"layoutDirectedChord",{enumerable:!0,get:function(){return K}}),Object.defineProperty(r,"directedShape",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(r,"layoutChord",{enumerable:!0,get:function(){return re}}),Object.defineProperty(r,"drawChord",{enumerable:!0,get:function(){return C}}),Object.defineProperty(r,"describeLink",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(r,"flowNodeAt",{enumerable:!0,get:function(){return z}}),Object.defineProperty(r,"ribbonAt",{enumerable:!0,get:function(){return n}}),Object.defineProperty(r,"chordArcAt",{enumerable:!0,get:function(){return e}}),Object.defineProperty(r,"chordRibbonAt",{enumerable:!0,get:function(){return i}}),Object.defineProperty(r,"chordPolygon",{enumerable:!0,get:function(){return g}});const ae=oe("packages/modules/charts/frame.js").Pool,ke=oe("packages/modules/charts/format.js").measureText,se=oe("packages/modules/charts/scheme.js").resolveScheme,ie=oe("packages/modules/charts/svg.js"),Z=ie.attrs,le=ie.insideRings,D=ie.path,d=ie.round,L=ie.setText,W=oe("packages/modules/charts/styles.js").NS,G=oe("packages/modules/charts/typography.js"),A=G.applySize,p=G.textWidth,f=G.truncateTo,w=Math.PI*2,N=12,q=8,k=-Math.PI/2,_=16;function c(b,O){for(const M of b)M.depth=0;const ne=b.length+1;for(let M=0;M<ne;M++){let B=!1;for(const I of O){if(I.source===I.target)continue;const V=I.source.depth+1;V>I.target.depth&&V<ne&&(I.target.depth=V,B=!0)}if(!B)break}const H=b.reduce((M,B)=>Math.max(M,B.depth),0),F=new Set,s=new Set;for(const M of O)M.source!==M.target&&(F.add(M.source),s.add(M.target));for(const M of b)!F.has(M)&&s.has(M)&&(M.depth=H);return H+1}function v(b){const{nodes:O,links:ne,plot:H}=b,F=c(O,ne),s=b.nodeWidth||N,M=new Map;for(const a of O)M.has(a.depth)||M.set(a.depth,[]),M.get(a.depth).push(a);let B=0;for(const a of M.values()){const x=a.reduce((o,l)=>o+Math.max(l.in,l.out),0),R=Math.max(0,a.length-1)*q;x>0&&(B=Math.max(B,x/Math.max(1,H.height-R)))}const I=B>0?1/B:0,V=F>1?(H.width-s)/(F-1):0;for(const[a,x]of M){x.sort((t,h)=>Math.max(h.in,h.out)-Math.max(t.in,t.out));const R=x.map(t=>Math.max(1,Math.max(t.in,t.out)*I)),o=R.reduce((t,h)=>t+h,0)+(x.length-1)*q;let l=H.top+Math.max(0,(H.height-o)/2);x.forEach((t,h)=>{t.x=H.left+a*V,t.width=s,t.y=l,t.height=R[h],t.inAt=l,t.outAt=l,l+=R[h]+q})}const fe=ne.slice().sort((a,x)=>a.source.y-x.source.y||x.value-a.value);for(const a of fe){const x=Math.max(1,a.value*I);a.thickness=x,a.y0=a.source.outAt+x/2,a.source.outAt+=x}for(const a of fe.slice().sort((x,R)=>x.target.y-R.target.y||R.value-x.value))a.y1=a.target.inAt+a.thickness/2,a.target.inAt+=a.thickness;return{columns:F,scale:I}}function E(b){const O=b.source.x+b.source.width,ne=b.target.x,H=(O+ne)/2,F=b.thickness/2;return D(["M",d(O),d(b.y0-F),"C",d(H),d(b.y0-F),d(H),d(b.y1-F),d(ne),d(b.y1-F),"L",d(ne),d(b.y1+F),"C",d(H),d(b.y1+F),d(H),d(b.y0+F),d(O),d(b.y0+F),"Z"])}function m(b){const O=b.scheme||se(),{plot:ne,bound:H}=b;for(const V of["grid","axis","rules","labels"])new ae(b.groups[V]).finish();const F=H.nodes,s=H.links;if(!F.length||!s.length)return{nodes:[],links:[]};v({nodes:F,links:s,plot:ne});const M=new ae(b.groups.marks);for(const V of s){const fe=M.next("path",`${W}__ribbon ${W}__mark`);Z(fe,{d:E(V),fill:O.series(V.source.index),"data-link":`${V.source.key}->${V.target.key}`})}for(const V of F)Z(M.next("rect",`${W}__node ${W}__mark`),{x:d(V.x),y:d(V.y),width:d(V.width),height:d(V.height),fill:O.series(V.index),"data-node":V.key});M.finish();const B=new ae(b.groups.overlay),I=b.typography&&b.typography.small||b.fontSize;for(const V of F){const fe=V.x<ne.left+ne.width/2,a=B.next("text",`${W}__flow-label`);A(a,I),Z(a,{x:d(fe?V.x+V.width+4:V.x-4),y:d(V.y+V.height/2),"text-anchor":fe?"start":"end","dominant-baseline":"middle"});const x=fe?ne.right-(V.x+V.width)-6:V.x-ne.left-6;L(a,f(V.label,Math.max(0,x),I))}return B.finish(),{nodes:F,links:s}}const y=.07,P=.4;function Q(b){if(!b)return null;const O=typeof b=="object"?b:{};return{style:O.style==="arrow"?"arrow":"taper",arc:O.arc==="inout"?"inout":"out"}}function K(b){const{nodes:O,links:ne,directed:H}=b,F=new Map,s=new Map;for(const X of O)F.set(X.key,0),s.set(X.key,0);for(const X of ne)F.set(X.source.key,(F.get(X.source.key)||0)+X.value),s.set(X.target.key,(s.get(X.target.key)||0)+X.value);const M=H.arc==="inout",B=new Map;let I=0;for(const X of O){const de=(F.get(X.key)||0)+(M&&s.get(X.key)||0);B.set(X.key,de),I+=de}if(I<=0)return{arcs:[],ribbons:[],total:0};const V=I*.02;for(const X of O)B.get(X.key)||(B.set(X.key,V),I+=V);const fe=Math.min(.04,w/(O.length*8||1)),a=w-fe*O.length,x=[];let R=k;const o=new Map;for(const X of O){const de=B.get(X.key)/I*a,pe={node:X,from:R,to:R+de};x.push(pe),o.set(X.key,pe),R+=de+fe}const l=ne.slice().sort((X,de)=>de.value-X.value),t=new Map(x.map(X=>[X.node.key,X.from])),h=new Map(x.map(X=>[X.node.key,X.from+(F.get(X.node.key)||0)/I*a])),j=new Map;for(const X of l)j.set(X.target.key,(j.get(X.target.key)||0)+1);const U=new Map,J=l.map(X=>{const de=X.value/I*a,pe=t.get(X.source.key);t.set(X.source.key,pe+de);let xe;if(M){const ve=h.get(X.target.key);h.set(X.target.key,ve+de),xe={from:ve,to:ve+de}}else{const ve=o.get(X.target.key),Oe=j.get(X.target.key)||1,Pe=U.get(X.target.key)||0;U.set(X.target.key,Pe+1);const te=(ve.to-ve.from)/Oe,Se=Math.min(de,te)*.9,ye=ve.from+te*(Pe+.5);xe={from:ye-Se/2,to:ye+Se/2}}return{link:X,source:{from:pe,to:pe+de},target:xe}});return{arcs:x,ribbons:J,total:I}}function ge(b,O,ne){const{cx:H,cy:F,inner:s}=O,M=(Oe,Pe)=>[H+Pe*Math.cos(Oe),F+Pe*Math.sin(Oe)],B=b.source.from,I=b.source.to,V=(b.target.from+b.target.to)/2,fe=(b.target.to-b.target.from)/2*(ne==="taper"?P:1),a=V-fe,x=V+fe,R=s*y,o=[],l=(Oe,Pe)=>{for(let te=0;te<=_;te++)o.push(M(Oe+(Pe-Oe)*te/_,s))},t=(Oe,Pe)=>{for(let te=1;te<_;te++){const Se=te/_,ye=1-Se;o.push([ye*ye*Oe[0]+2*ye*Se*H+Se*Se*Pe[0],ye*ye*Oe[1]+2*ye*Se*F+Se*Se*Pe[1]])}},[h,j]=M(B,s),[U,J]=M(I,s);if(l(B,I),ne==="arrow"){const Oe=M(a,s-R),Pe=M(x,s-R),te=M(V,s);return t(M(I,s),Oe),o.push(Oe,te,Pe),t(Pe,M(B,s)),{d:D(["M",d(h),d(j),"A",d(s),d(s),0,0,1,d(U),d(J),"Q",d(H),d(F),d(Oe[0]),d(Oe[1]),"L",d(te[0]),d(te[1]),"L",d(Pe[0]),d(Pe[1]),"Q",d(H),d(F),d(h),d(j),"Z"]),polygon:o}}const[X,de]=M(a,s),[pe,xe]=M(x,s);return t(M(I,s),M(a,s)),l(a,x),t(M(x,s),M(B,s)),{d:D(["M",d(h),d(j),"A",d(s),d(s),0,0,1,d(U),d(J),"Q",d(H),d(F),d(X),d(de),"A",d(s),d(s),0,0,1,d(pe),d(xe),"Q",d(H),d(F),d(h),d(j),"Z"]),polygon:o}}function re(b){const{nodes:O,links:ne}=b,H=new Map;for(const a of O)H.set(a.key,0);for(const a of ne)H.set(a.source.key,(H.get(a.source.key)||0)+a.value),H.set(a.target.key,(H.get(a.target.key)||0)+a.value);const F=[...H.values()].reduce((a,x)=>a+x,0);if(F<=0)return{arcs:[],ribbons:[]};const s=Math.min(.04,w/(O.length*8||1)),M=w-s*O.length,B=[];let I=-Math.PI/2;const V=new Map;for(const a of O){const R=(H.get(a.key)||0)/F*M;B.push({node:a,from:I,to:I+R}),V.set(a.key,I),I+=R+s}const fe=[];for(const a of ne.slice().sort((x,R)=>R.value-x.value)){const x=a.value/F*M,R=V.get(a.source.key),o=V.get(a.target.key);V.set(a.source.key,R+x),V.set(a.target.key,o+x),fe.push({link:a,source:{from:R,to:R+x},target:{from:o,to:o+x}})}return{arcs:B,ribbons:fe}}function C(b){const O=b.scheme||se(),{plot:ne,bound:H}=b;for(const t of["grid","axis","rules","labels"])new ae(b.groups[t]).finish();const F=ne.left+ne.width/2,s=ne.top+ne.height/2,M=b.typography&&b.typography.small||b.fontSize,B=Math.max(...H.nodes.map(t=>p(t.label,M)),0),I=Math.max(10,Math.min(ne.width,ne.height)/2-Math.min(B+8,90)),V=I*.92,fe=Q(b.directed),{arcs:a,ribbons:x}=fe?K({nodes:H.nodes,links:H.links,directed:fe}):re({nodes:H.nodes,links:H.links,cx:F,cy:s,radius:I}),R=(t,h)=>[F+h*Math.cos(t),s+h*Math.sin(t)],o=new ae(b.groups.marks);for(const t of x){const{link:h,source:j,target:U}=t;if(fe){const te=ge(t,{cx:F,cy:s,inner:V},fe.style);t.polygon=te.polygon;const Se=ee(h,b.grid.messages);Z(o.next("path",`${W}__ribbon ${W}__ribbon--directed ${W}__mark`),{d:te.d,fill:O.series(h.source.index,h.source.label),"fill-opacity":.55,"data-link":`${h.source.key}->${h.target.key}`,"data-sweep":d((j.to-j.from)*180/Math.PI*1e3)/1e3,role:"img","aria-label":Se});continue}const[J,X]=R(j.from,V),[de,pe]=R(j.to,V),[xe,ve]=R(U.from,V),[Oe,Pe]=R(U.to,V);Z(o.next("path",`${W}__ribbon ${W}__mark`),{d:D(["M",d(J),d(X),"A",d(V),d(V),0,0,1,d(de),d(pe),"Q",d(F),d(s),d(xe),d(ve),"A",d(V),d(V),0,0,1,d(Oe),d(Pe),"Q",d(F),d(s),d(J),d(X),"Z"]),fill:O.series(h.source.index),"fill-opacity":.55,"data-link":`${h.source.key}->${h.target.key}`,"data-sweep":null,role:null,"aria-label":null})}for(const t of a){const[h,j]=R(t.from,I),[U,J]=R(t.to,I),[X,de]=R(t.to,V),[pe,xe]=R(t.from,V),ve=t.to-t.from>Math.PI?1:0;Z(o.next("path",`${W}__node ${W}__mark`),{d:D(["M",d(h),d(j),"A",d(I),d(I),0,ve,1,d(U),d(J),"L",d(X),d(de),"A",d(V),d(V),0,ve,0,d(pe),d(xe),"Z"]),fill:fe?O.series(t.node.index,t.node.label):O.series(t.node.index),"data-node":t.node.key,"data-sweep":fe?d((t.to-t.from)*180/Math.PI*1e3)/1e3:null})}o.finish();const l=new ae(b.groups.overlay);for(const t of a){const h=(t.from+t.to)/2,[j,U]=R(h,I+6),J=l.next("text",`${W}__flow-label`);A(J,M);const X=Math.cos(h)>=0;Z(J,{x:d(j),y:d(U),"text-anchor":X?"start":"end","dominant-baseline":"middle"}),L(J,t.node.label)}return l.finish(),{arcs:a,ribbons:x,ring:{cx:F,cy:s,inner:V,radius:I}}}function ee(b,O){return`${b.source.label} → ${b.target.label}: ${ke(b.value,O)}`}function z(b){for(const O of b.nodes||[])if(!(typeof O.x!="number"||typeof O.width!="number")&&b.x>=O.x&&b.x<=O.x+O.width&&b.y>=O.y&&b.y<=O.y+O.height)return O;return null}function n(b){let O=null,ne=1/0;for(const H of b.links||[]){const F=H.source,s=H.target;if(!F||!s||typeof H.y0!="number")continue;const M=F.x+F.width,B=s.x;if(b.x<Math.min(M,B)||b.x>Math.max(M,B))continue;const I=(M+B)/2,V=t=>{const h=1-t;return h*h*h*M+3*h*h*t*I+3*h*t*t*I+t*t*t*B};let fe=0,a=1;for(let t=0;t<24;t++){const h=(fe+a)/2;V(h)<b.x?fe=h:a=h}const x=(fe+a)/2,R=1-x,o=R*R*R*H.y0+3*R*R*x*H.y0+3*R*x*x*H.y1+x*x*x*H.y1,l=Math.max(1,H.thickness||1)/2;Math.abs(b.y-o)<=l&&(H.thickness||1)<ne&&(ne=H.thickness||1,O=H)}return O}function e(b){const O=b.ring;if(!O)return null;const ne=b.x-O.cx,H=b.y-O.cy,F=Math.sqrt(ne*ne+H*H);if(F<O.inner||F>O.radius)return null;let s=Math.atan2(H,ne);for(;s<k;)s+=w;for(;s>=k+w;)s-=w;for(const M of b.arcs||[])if(s>=M.from&&s<M.to)return M;return null}function i(b){const O=b.ring;if(!O)return null;const ne=b.x-O.cx,H=b.y-O.cy;if(Math.sqrt(ne*ne+H*H)>O.inner)return null;for(const F of b.ribbons||[])if(le([g(F,O)],b.x,b.y))return F;return null}function g(b,O){if(b.polygon)return b.polygon;const{cx:ne,cy:H,inner:F}=O,s=V=>[ne+F*Math.cos(V),H+F*Math.sin(V)],M=[],B=(V,fe)=>{for(let a=0;a<=_;a++)M.push(s(V+(fe-V)*a/_))},I=(V,fe)=>{for(let a=1;a<_;a++){const x=a/_,R=1-x;M.push([R*R*V[0]+2*R*x*ne+x*x*fe[0],R*R*V[1]+2*R*x*H+x*x*fe[1]])}};return B(b.source.from,b.source.to),I(s(b.source.to),s(b.target.from)),B(b.target.from,b.target.to),I(s(b.target.to),s(b.source.from)),M}}),tt("packages/modules/charts/hit.js",function(r,oe){"use strict";Object.defineProperty(r,"valueText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(r,"hnodeHit",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(r,"itemAt",{enumerable:!0,get:function(){return re}}),Object.defineProperty(r,"ownsGeometry",{enumerable:!0,get:function(){return C}}),Object.defineProperty(r,"resolveHit",{enumerable:!0,get:function(){return ee}});const ae=oe("packages/modules/charts/format.js").measureText,ke=oe("packages/modules/charts/treemap.js").tileAt,we=oe("packages/modules/charts/geo.js"),se=we.markerAt,ie=we.regionAt,le=oe("packages/modules/charts/matrix.js").cellAt,D=oe("packages/modules/charts/network.js"),d=D.linkAt,L=D.nodeAt,T=oe("packages/modules/charts/hnodes.js"),W=T.hnodeAt,G=T.isHierarchyDraw,A=oe("packages/modules/charts/flow.js"),p=A.chordArcAt,f=A.chordRibbonAt,w=A.flowNodeAt,N=A.ribbonAt,q=" → ",k=" – ",_=" › ";function c(z,n,e){const i=ae(z,e);if(!n||typeof z!="number"||!Number.isFinite(z))return i;const g=z/n;return Number.isFinite(g)?`${i} (${e.number(g,{style:"percent",maximumFractionDigits:1})})`:i}function v(z,n){const e=z.item.node,i=n.bound.root&&n.bound.root.total||0,g=Array.isArray(z.path)?[...z.path]:[e.label];return{heading:g.length>1?g.join(_):e.label,rows:[{label:n.bound.measure.title,value:c(e.total,i,n.grid.messages),colour:n.scheme.series(z.item.index||0)}],datum:{label:e.label,value:e.total,category:e.value,column:n.bound.measure.col&&n.spec.x||null,series:null,depth:z.depth,path:g,rowKeys:e.rowKeys&&e.rowKeys.length?[...e.rowKeys]:e.rowKey?[e.rowKey]:[]}}}function E(z,n,e){const i=n.reduce((g,b)=>g+(b.value||0),0);return{heading:z.label||z.code,rows:[{label:e.bound.measure.title,value:typeof z.text=="string"?z.text:c(z.value,i,e.grid.messages),colour:e.scheme.series(0)}],datum:{label:z.label||z.code,value:z.value,category:z.code,column:e.spec.code||e.spec.x||null,series:null,path:[z.label||z.code],rowKeys:Array.isArray(z.rowKeys)?[...z.rowKeys]:[]}}}function m(z,n,e){const i=e.spec.value||e.spec.y||null,g=i?e.grid.columns.get(i):null,b=H=>`${Number(H).toFixed(4)}°`,O=(n.legend||[]).find(H=>H.colour===z.fill)||null,ne=[{label:g&&g.title||i||"",value:z.text||"",colour:z.fill},{label:"",value:`${b(z.lat)}, ${b(z.lon)}`,colour:"transparent"}];return O&&O.label&&ne.push({label:"",value:O.label,colour:z.fill}),{heading:z.label||z.text||"",rows:ne,datum:{label:z.label||z.text||"",value:z.value,category:z.value,column:i,series:null,path:[z.label||z.text||""],lon:z.lon,lat:z.lat,status:O?O.label:null,rowKeys:z.rowKey?[z.rowKey]:[]}}}function y(z,n){const e=b=>{const O=n.grid.columns.get(b);return O&&O.title||b},i=e(z.a),g=e(z.b);return{heading:`${i} × ${g}`,rows:[{label:n.spec.method==="spearman"?"ρ":"r",value:typeof z.r=="number"&&Number.isFinite(z.r)?z.r.toFixed(2):"",colour:n.scheme.series(0)}],datum:{label:`${i} × ${g}`,value:typeof z.r=="number"?z.r:null,category:null,column:null,series:null,path:[i,g],rowKeys:[]}}}function P(z,n){const e=[],i=n.drawn&&n.drawn.links||(n.drawn&&n.drawn.ribbons||[]).map(ne=>ne.link);for(const ne of i)if(!(ne.source!==z&&ne.target!==z))for(const H of ne.rowKeys||[])e.includes(H)||e.push(H);const g=Math.max(z.in||0,z.out||0),b=!!(n.spec&&n.spec.directed&&n.spec.type==="chord"),O=n.scheme.series(z.index||0,b?z.label:void 0);return{heading:z.label,rows:b?[{label:`${n.bound.measure.title} →`,value:ae(z.out||0,n.grid.messages),colour:O},{label:`${n.bound.measure.title} ←`,value:ae(z.in||0,n.grid.messages),colour:O}]:[{label:n.bound.measure.title,value:ae(g,n.grid.messages),colour:n.scheme.series(z.index||0)}],datum:{label:z.label,value:g,category:z.value===void 0?z.key:z.value,column:null,series:null,path:[z.label],rowKeys:e}}}function Q(z,n){const e=`${z.source.label}${z.undirected?k:q}${z.target.label}`;return{heading:e,rows:[{label:n.bound.measure.title,value:c(z.value,z.undirected?0:n.bound.total||0,n.grid.messages),colour:z.colour||n.scheme.series(z.source.index||0,n.spec&&n.spec.directed&&n.spec.type==="chord"?z.source.label:void 0)}],datum:{label:e,value:z.value,category:null,column:null,series:null,path:[z.source.label,z.target.label],rowKeys:Array.isArray(z.rowKeys)?[...z.rowKeys]:[]}}}function K(z,n){return{heading:z.heading||z.label||"",rows:Array.isArray(z.rows)?z.rows:[],datum:{label:z.label||z.heading||"",value:z.value===void 0?null:z.value,category:z.category===void 0?null:z.category,column:z.column||null,series:null,path:[z.label||z.heading||""],...z.extra||{},rowKeys:Array.isArray(z.rowKeys)?[...z.rowKeys]:[]}}}function ge(z,n){const e=z.node,i=n.bound.root&&n.bound.root.total||0,g=Array.isArray(z.path)&&z.path.length?[...z.path]:[z.label];return{heading:g.length>1?g.join(_):z.label,rows:[{label:n.bound.measure&&n.bound.measure.title||"",value:c(e.total,i,n.grid.messages),colour:z.colour||n.scheme.series(0)}],datum:{label:z.label,value:e.total,category:e.value,column:null,series:null,depth:z.depth,index:z.index,path:g,rowKeys:Array.isArray(e.rowKeys)?[...e.rowKeys]:[]}}}function re(z,n,e){for(let i=z.length-1;i>=0;i--){const g=z[i];if(g&&typeof g.test=="function"&&g.test(n,e))return g}return null}function C(z){return z?!!(Array.isArray(z.items)||typeof z.hitAt=="function"||G(z)||Array.isArray(z.tiles)||Array.isArray(z.regions)||Array.isArray(z.markers)||Array.isArray(z.cells)&&Array.isArray(z.columns)||Array.isArray(z.ribbons)&&z.ring||Array.isArray(z.nodes)&&Array.isArray(z.links)):!1}function ee(z){const n=z.drawn;if(!n||!z.bound||!C(n))return null;const{x:e,y:i}=z.at;if(typeof n.hitAt=="function")return n.hitAt({x:e,y:i},z)||null;if(Array.isArray(n.items)){const g=re(n.items,e,i);return g?K(g,z):null}if(G(n)){const g=W({hnodes:n.hnodes,view:n.view,x:e,y:i});return g?ge(g,z):null}if(Array.isArray(n.tiles)){const g=ke({tiles:n.tiles,x:e,y:i});return g?v(g,z):null}if(Array.isArray(n.regions)){const g=ie({regions:n.regions,x:e,y:i});return g?E(g,n.regions,z):null}if(Array.isArray(n.markers)){const g=se({markers:n.markers,x:e,y:i});return g?m(g,n,z):null}if(Array.isArray(n.cells)&&Array.isArray(n.columns)){const g=le({cells:n.cells,x:e,y:i});return g?y(g,z):null}if(Array.isArray(n.ribbons)&&n.ring){const g=f({ribbons:n.ribbons,ring:n.ring,x:e,y:i});if(g)return Q(g.link,z);const b=p({arcs:n.arcs,ring:n.ring,x:e,y:i});return b?P(b.node,z):null}if(Array.isArray(n.nodes)&&Array.isArray(n.links)){const g=n.nodes.some(ne=>typeof ne.r=="number"),b=g?L({nodes:n.nodes,x:e,y:i}):w({nodes:n.nodes,x:e,y:i});if(b)return P(b,z);const O=g?d({links:n.links,x:e,y:i}):N({links:n.links,x:e,y:i});return O?Q(O,z):null}return null}}),tt("packages/modules/charts/drag-edit.js",function(r,oe){"use strict";Object.defineProperty(r,"EDITABLE_TYPES",{enumerable:!0,get:function(){return A}}),Object.defineProperty(r,"HANDLE_CAP",{enumerable:!0,get:function(){return f}}),Object.defineProperty(r,"resolveEditable",{enumerable:!0,get:function(){return _}}),Object.defineProperty(r,"settle",{enumerable:!0,get:function(){return c}}),Object.defineProperty(r,"stepFor",{enumerable:!0,get:function(){return v}}),Object.defineProperty(r,"editableHandles",{enumerable:!0,get:function(){return y}}),Object.defineProperty(r,"sliceValue",{enumerable:!0,get:function(){return re}}),Object.defineProperty(r,"planWrites",{enumerable:!0,get:function(){return C}}),Object.defineProperty(r,"commitWrites",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(r,"DragEditor",{enumerable:!0,get:function(){return z}});const ae=oe("packages/core/src/internal/util.js").warnOnce,$=oe("packages/modules/charts/svg.js"),ke=$.attrs,we=$.clear,se=$.round,ie=$.setText,Z=$.svg,D=oe("packages/modules/charts/format.js").measureText,L=oe("packages/modules/charts/styles.js").NS,T=oe("packages/modules/charts/scale.js"),W=T.niceStep,G=T.toNumber,A=Object.freeze(["line","step","area","bar","horizontalBar","scatter","bubble","floatingBar","horizontalFloatingBar","pie","donut"]),p=new Set(["sum","avg","mean","min","max","median","first","last"]),f=2e3,w={mouse:9,touch:22},N=3,q=Math.PI*2,k=.995;function _(n){if(!n)return null;const e=n===!0?{}:typeof n=="object"?n:{},i=O=>typeof O=="number"&&Number.isFinite(O)?O:null,g=i(e.step)!==null&&i(e.step)>0?i(e.step):null;let b=null;return e.snap===!0?b=g:i(e.snap)!==null&&i(e.snap)>0&&(b=i(e.snap)),{axis:e.axis==="x"||e.axis==="xy"?e.axis:"y",step:g,min:i(e.min),max:i(e.max),snap:b,distribute:e.distribute==="proportional"||e.distribute==="first"?e.distribute:null}}function c(n,e,i={}){let g=n;if(e.snap){const O=e.min!==null?e.min:0;g=Math.round((g-O)/e.snap)*e.snap+O}if(e.min!==null&&g<e.min&&(g=e.min),e.max!==null&&g>e.max&&(g=e.max),i.integer)return Math.round(g);const b=i.unit&&i.unit>0?Math.min(10,Math.max(0,Math.floor(-Math.log10(i.unit)))):6;return Number(g.toFixed(b))}function v(n,e){return n.step?n.step:W(Math.abs(e)/100)}function E(n){return typeof n=="number"&&Number.isFinite(n)}function m(n){return Array.isArray(n.rowKeys)&&n.rowKeys.length?n.rowKeys:n.rowKey?[n.rowKey]:[]}function y(n){const{drawn:e,bound:i,spec:g,type:b,editable:O}=n,ne=[];return!e||!i||!A.includes(b)||g.multiples?(ne.push({id:"type",message:"type"}),{handles:[],notices:ne}):b==="pie"||b==="donut"?ge(n,ne):!Array.isArray(e.series)||!e.yScale?{handles:[],notices:ne}:e.percent||g.stack&&i.series.length>1?(ne.push({id:"type",message:"stacked"}),{handles:[],notices:ne}):b==="floatingBar"||b==="horizontalFloatingBar"?K(n,ne):Q(n,ne)}function P(n,e,i,g,b){return e.length?e.some(ne=>{const H=n.rows.byKey(ne);return!H||H.group})?{ok:!1,reason:"aggregated"}:e.length>1?b||!i.distribute?{ok:!1,reason:"aggregated"}:g!=="sum"&&g!=="avg"&&g!=="mean"?{ok:!1,reason:"distribute"}:{ok:!0,distribute:!0}:p.has(g)?{ok:!0,distribute:!1}:{ok:!1,reason:"aggregated"}:{ok:!1,reason:"aggregated"}}function Q(n,e){const{drawn:i,bound:g,editable:b,grid:O}=n,ne=[],H=!!i.horizontal,F=b.axis!=="x",s=b.axis!=="y",M=g.measure&&g.measure.col,B=g.dimension&&g.dimension.col,I=i.xScale,V=!H&&I&&I.kind==="linear"&&!!B;s&&!V&&e.push({id:"axis",message:"axis"});const fe=a=>a?O.columns.get(a):null;for(const a of i.series){const x=a.axis==="right"&&i.rightScale?i.rightScale:i.yScale;for(let R=0;R<a.points.length;R++){const o=a.points[R];if(!o||!E(o.y)||!E(o.px))continue;const l=m(o),t=[];let h=null,j=!1;if(F&&M&&x&&x.kind==="linear"){const pe=P(O,l,b,g.measure.fn,!1);pe.ok?j=pe.distribute:h=pe.reason,t.push({name:"y",colId:M,scale:x,screen:H?"x":"y",value:o.y,column:fe(M)})}if(s&&V&&G(o.x)!==null){const pe=P(O,l,b,"first",!0);pe.ok||(h=h||pe.reason),t.push({name:"x",colId:B,scale:I,screen:"x",value:G(o.x),column:fe(B)})}if(!t.length)continue;const U=t.find(pe=>pe.name==="y"),J=t.find(pe=>pe.name==="x"),X=J?J.scale.of(J.value):U&&H?U.scale.of(U.value):o.px,de=U&&!H?U.scale.of(U.value):o.py;!E(X)||!E(de)||ne.push({id:`${a.key}\0${o.xKey}`,label:`${o.label}${a.label&&g.series.length>1?` (${a.label})`:""}`,keys:l,px:X,py:de,axes:t,reason:h,distribute:j,kind:"point",orientation:H?"horizontal":"vertical"})}}return{handles:ne,notices:e}}function K(n,e){const{drawn:i,bound:g,spec:b,grid:O,editable:ne}=n,H=[];if(ne.axis==="x")return e.push({id:"axis",message:"axis"}),{handles:H,notices:e};const F=Array.isArray(b.y)?b.y:[],s=i.yScale;if(i.valueKind==="time"||!s||s.kind!=="linear"||F.length!==2)return e.push({id:"type",message:"floating"}),{handles:H,notices:e};const M=!!i.horizontal;for(const B of i.series)for(const I of B.points){if(!E(I.y0)||!E(I.y1)||!E(I.px))continue;const V=m(I),fe=P(O,V,ne,"first",!0);for(const[a,x,R]of[["from",F[0],I.y0],["to",F[1],I.y1]]){const o=s.of(R);if(!E(o))continue;const l=O.columns.get(x);H.push({id:`${B.key}\0${I.xKey}\0${a}`,label:`${I.label}, ${l&&l.title||x}`,keys:V,px:M?o:I.px,py:M?I.py:o,axes:[{name:"y",colId:x,scale:s,screen:M?"x":"y",value:R,column:l}],reason:fe.ok?null:fe.reason,distribute:!1,kind:"end",orientation:M?"horizontal":"vertical"})}}return{handles:H,notices:e}}function ge(n,e){const{drawn:i,bound:g,grid:b,editable:O}=n,ne=[];if(O.axis!=="y"||!Array.isArray(i.arcs)||!i.centre)return O.axis!=="y"&&e.push({id:"axis",message:"axis"}),{handles:ne,notices:e};const H=g.measure&&g.measure.col,F=g.root&&g.root.total;if(!H||!(F>0))return{handles:ne,notices:e};const s=b.columns.get(H);for(const M of i.arcs){if(M.depth!==1||!M.geometry||!(M.total>0))continue;const B=M.node,I=m(B),V=P(b,I,O,g.measure.fn,!1),fe=(M.to-M.from)*F/M.total,a=(M.geometry.inner+M.geometry.outer)/2;ne.push({id:`slice\0${M.label}`,label:String(M.label),keys:I,px:M.geometry.cx+a*Math.cos(M.to),py:M.geometry.cy+a*Math.sin(M.to),axes:[{name:"y",colId:H,scale:null,screen:"angle",value:M.total,column:s}],pie:{cx:M.geometry.cx,cy:M.geometry.cy,mid:a,from:M.from,to:M.to,sweep:fe,whole:F},reason:V.ok?null:V.reason,distribute:V.ok?V.distribute:!1,kind:"slice",orientation:"angle"})}return{handles:ne,notices:e}}function re(n,e,i){const g=Math.max(0,Math.min(k,n));return g*(e-i)/(1-g)}function C(n,e,i,g,b,O){if(!e.distribute){const B=e.keys[0];return B?{writes:[{key:B,colId:i.colId,value:g}]}:{refusal:"aggregated"}}const ne=e.keys.map(B=>G(n.rows.value(B,i.colId)));if(ne.some(B=>B===null))return{refusal:"distribute"};const H=ne.length,F=ne.reduce((B,I)=>B+I,0),s=O==="sum"?g:g*H;let M;return b.distribute==="first"?M=ne.map((B,I)=>I===0?B+(s-F):B):F===0?M=ne.map(()=>s/H):M=ne.map(B=>B*s/F),{writes:e.keys.map((B,I)=>({key:B,colId:i.colId,value:Number(M[I].toPrecision(12)),old:ne[I]})).filter(B=>B.value!==B.old).map(({key:B,colId:I,value:V})=>({key:B,colId:I,value:V}))}}function ee(n,e){const i={reason:null,message:null},g=[n.on("validation:failed",ne=>{const H=ne&&ne.failures&&ne.failures[0];H&&!i.message&&(i.reason="validation",i.message=H.message)}),n.on("edit:cancelled",ne=>{ne&&!i.reason&&(i.reason=String(ne.reason||"prevented"))}),n.on("cell:edit:end",ne=>{const H=ne&&ne.valid===!1&&ne.errors&&ne.errors[0];H&&!i.message&&(i.reason="validation",i.message=H.message)})],b=ne=>{for(const H of g)H();if(ne<e.length&&n.edit&&typeof n.edit.stop=="function")try{n.edit.stop(!0)}catch{}return{ok:ne===e.length,count:ne,reason:ne===e.length?null:i.reason||"readOnly",message:ne===e.length?null:i.message}};let O;try{O=n.edit.setCells(e,"cell",{origin:"user"})}catch(ne){for(const H of g)H();return Promise.resolve({ok:!1,count:0,reason:"error",message:String(ne&&ne.message?ne.message:ne)})}return O&&typeof O.then=="function"?O.then(ne=>b(Number(ne)||0)):Promise.resolve(b(Number(O)||0))}class z{#r;#n;#i=[];#t=new Map;#s=null;#l=null;#o=null;#a=!1;#m=!1;#f=[];constructor(e){this.#r=e,this.#n=Z(e.doc,"g",{class:`${L}__edit`}),e.svg.appendChild(this.#n);const i=(g,b,O,ne)=>{g.addEventListener(b,O,ne),this.#f.push(()=>g.removeEventListener(b,O,ne))};i(this.#n,"pointerdown",g=>this.#e(g)),i(this.#n,"touchstart",g=>{const b=this.#t.get(g.target);b&&!b.reason&&g.cancelable!==!1&&g.preventDefault&&g.preventDefault()},{passive:!1}),i(e.svg,"pointermove",g=>this.#d(g)),i(e.svg,"pointerup",g=>this.#z(g)),i(e.svg,"pointercancel",()=>this.#$()),i(this.#n,"keydown",g=>this.#L(g)),i(this.#n,"focusout",g=>this.#F(g))}get dragging(){return!!this.#l}consumeClick(){const e=this.#a;return this.#a=!1,e}sync(e){if(this.#m)return;const i=_(e.spec.editable),g=this.#l?this.#l.handle.id:this.#o?this.#o.handle.id:null,b=this.#l?this.#l.values:this.#o?this.#o.values:null;if(this.#M(),!i||!e.drawn||!e.bound){this.#$(),this.#o=null;return}const O=y({drawn:e.drawn,bound:e.bound,spec:e.spec,type:e.type,grid:this.#r.grid(),editable:i});for(const s of O.notices)this.#p(s);const ne=this.#r.doc,H=O.handles.slice(0,f);O.handles.length>f&&ae("chart:editable:cap","editable draws a handle on at most 2000 marks, and this chart has more, so the rest cannot be dragged. Filter the grid, or aggregate the chart, to a size a person can point at.");let F=!0;for(const s of H){const M=!s.reason,B=Z(ne,"circle",{class:`${L}__edit-handle`,cx:se(s.px),cy:se(s.py),r:6,role:"slider",tabindex:M&&F?"0":"-1","data-editable":M?"true":"false","aria-label":s.label,"aria-orientation":s.orientation==="horizontal"?"horizontal":"vertical","aria-valuenow":String(s.axes[0].value),"aria-valuetext":this.#c(s,s.axes[0],s.axes[0].value)});M||B.setAttribute("aria-disabled","true"),M&&(F=!1),s.node=B,s.editable=i,this.#n.appendChild(B),this.#t.set(B,s)}if(this.#i=H,this.#s=null,g){const s=H.find(B=>B.id===g),M=this.#l||this.#o;s&&M?(M.handle=s,this.#O(s,b||{})):(this.#$(),this.#o=null)}}withoutHandles(e){const i=this.#n.parentNode;if(!i)return e();i.removeChild(this.#n);try{return e()}finally{i.appendChild(this.#n)}}clear(){this.#$(),this.#o=null,this.#M()}destroy(){this.#m=!0;for(const e of this.#f)e();this.#f=[],this.#M(),this.#n.parentNode&&this.#n.parentNode.removeChild(this.#n)}#M(){we(this.#n),this.#t.clear(),this.#i=[],this.#s=null}#p(e){e.id==="type"?ae("chart:editable:type","editable has no effect on this chart: its type has no draggable marks, it is stacked or percent (no single value at the end of a mark), it is drawn as small multiples, or it is a floating bar on a time axis. It drags a line, step or area point, a bar or horizontal bar end, both ends of a floating bar, a scatter or bubble point, and a pie or donut slice edge."):e.id==="axis"&&ae("chart:editable:axis",'editable.axis asks for an axis this chart cannot drag along. Only a numeric x axis (a scatter or bubble) can be dragged sideways; a bar, line, area, floating bar, pie or donut moves along its value only. Use axis: "y".')}#c(e,i,g){const b=i.column;if(b&&typeof b.formatValue=="function")try{const O=b.formatValue(g,null);if(typeof O=="string"&&O!=="")return O}catch{}return D(g,this.#r.grid().messages)}#k(e){const i=e.scale;if(!i||!i.range||!i.domain)return 0;const g=Math.abs(i.range[1]-i.range[0])||1;return(i.domain.max-i.domain.min)/g}#O(e,i){if(!e.node)return;const g=e.axes.find(M=>M.name==="y"),b=e.axes.find(M=>M.name==="x");let O=e.px,ne=e.py;if(e.kind==="slice"){const M=i.y!==void 0?i.y:e.axes[0].value,B=e.pie,I=M/(B.whole-e.axes[0].value+M),V=B.from+I*B.sweep;O=B.cx+B.mid*Math.cos(V),ne=B.cy+B.mid*Math.sin(V)}else if(b&&i.x!==void 0&&(O=b.scale.of(i.x)),g&&i.y!==void 0){const M=g.scale.of(i.y);g.screen==="x"?O=M:ne=M}ke(e.node,{cx:se(O),cy:se(ne)}),e.node.setAttribute("data-active","true");const H=e.axes.map(M=>i[M.name]===void 0?null:this.#c(e,M,i[M.name])).filter(M=>M!==null);this.#s||(this.#s=Z(this.#r.doc,"text",{class:`${L}__edit-value`,"pointer-events":"none"}),this.#n.appendChild(this.#s)),ie(this.#s,H.join(" , "));const F=e.orientation==="horizontal";ke(this.#s,{x:se(O+(F?0:12)),y:se(ne+(F?-12:4)),"text-anchor":F?"middle":"start"});const s=e.axes[0];i[s.name]!==void 0&&(e.node.setAttribute("aria-valuenow",String(i[s.name])),e.node.setAttribute("aria-valuetext",this.#c(e,s,i[s.name])))}#v(e){if(e.node){ke(e.node,{cx:se(e.px),cy:se(e.py)}),e.node.removeAttribute("data-active");const i=e.axes[0];e.node.setAttribute("aria-valuenow",String(i.value)),e.node.setAttribute("aria-valuetext",this.#c(e,i,i.value))}this.#s&&this.#s.parentNode&&this.#s.parentNode.removeChild(this.#s),this.#s=null}#x(e){const i=this.#r.status;ie(i,e),e?i.removeAttribute("hidden"):i.setAttribute("hidden","")}#b(e){if(!e.reason)return!0;const i=this.#r.grid().messages;return e.reason==="distribute"?ae("chart:editable:distribute","editable.distribute shares a new total between the rows of a mark, and only a sum or an average has a total to share. A mark that is a minimum, a maximum, a median or a count cannot be dragged."):ae("chart:editable:aggregated",'a chart mark that stands for several rows (a bar summing a category, a group) cannot be dragged, because there is no single cell to write. Set editable: { distribute: "proportional" } (or "first") to say how a new total is shared between its rows, or chart one row per mark.'),this.#x(i.t("chart.edit.aggregated")),!1}#e(e){this.#a=!1;const i=this.#t.get(e.target);if(!i||(e.stopPropagation&&e.stopPropagation(),e.button!==void 0&&e.button!==0&&e.pointerType!=="touch")||!this.#b(i))return;this.#x(""),this.#o=null,this.#r.hideTooltip();const g=this.#r.pointOf(e);this.#l={handle:i,pointerId:e.pointerId,from:g,moved:!1,values:{},grab:{x:g.x-i.px,y:g.y-i.py},angle:i.pie?i.pie.to:0,last:i.pie?Math.atan2(g.y-i.pie.cy,g.x-i.pie.cx):0},e.preventDefault&&e.preventDefault();const b=this.#r.svg;if(b.setPointerCapture&&e.pointerId!==void 0)try{b.setPointerCapture(e.pointerId)}catch{}}#d(e){const i=this.#l;if(!i||i.pointerId!==void 0&&e.pointerId!==void 0&&e.pointerId!==i.pointerId)return;const g=this.#r.pointOf(e);if(!i.moved&&Math.hypot(g.x-i.from.x,g.y-i.from.y)<N)return;i.moved=!0;const b=i.handle,O=b.editable,ne={};if(b.kind==="slice"){const H=b.pie;let F=Math.atan2(g.y-H.cy,g.x-H.cx),s=F-i.last;for(;s>Math.PI;)s-=q;for(;s<=-Math.PI;)s+=q;i.angle+=s,i.last=F;const M=(i.angle-H.from)/H.sweep,B=re(M,H.whole,b.axes[0].value);ne.y=c(B,O,{unit:H.whole/400})}else for(const H of b.axes){const F=H.screen==="x"?g.x-i.grab.x:g.y-i.grab.y,s=H.scale.range,M=Math.abs(s[1]-s[0]),B=Math.min(s[0],s[1])-M,I=Math.max(s[0],s[1])+M,V=H.scale.invert(Math.max(B,Math.min(I,F)));ne[H.name]=c(V,O,{unit:this.#k(H),integer:H.column&&H.column.type==="integer"})}i.values=ne,this.#O(b,ne),e.preventDefault&&e.preventDefault()}#z(e){const i=this.#l;if(!i||i.pointerId!==void 0&&e.pointerId!==void 0&&e.pointerId!==i.pointerId)return;this.#l=null;const g=this.#r.svg;if(g.releasePointerCapture&&i.pointerId!==void 0)try{g.releasePointerCapture(i.pointerId)}catch{}if(!i.moved){this.#v(i.handle);return}this.#a=!0,this.#N(i.handle,i.values)}#$(){const e=this.#l;this.#l=null,e&&this.#v(e.handle)}#N(e,i){const g=this.#r.grid(),b=this.#r.fn(),O=[];for(const H of e.axes){const F=i[H.name];if(F===void 0||F===H.value)continue;const s=C(g,e,H,F,e.editable,b);if("refusal"in s)return e.reason=s.refusal,this.#v(e),this.#b(e),Promise.resolve();O.push(...s.writes)}if(!O.length)return this.#v(e),Promise.resolve();const ne={rowKeys:e.keys.slice(),colId:e.axes[0].colId,value:i[e.axes[0].name],oldValue:e.axes[0].value,writes:O.map(H=>({...H}))};return ee(g,O).then(H=>{if(this.#m)return;if(H.ok){this.#s&&this.#s.parentNode&&this.#s.parentNode.removeChild(this.#s),this.#s=null,e.node&&e.node.removeAttribute("data-active"),this.#x(""),this.#r.edited(ne);return}if(H.count>0&&g.edit&&typeof g.edit.undo=="function")try{g.edit.undo()}catch{}this.#v(e);const F=g.messages,s=H.message||(H.reason&&H.reason!=="readOnly"&&H.reason!=="error"?F.t("chart.edit.refusedWhy",{reason:H.reason}):F.t("chart.edit.refused"));this.#x(s),this.#r.rejected({...ne,reason:H.reason,message:s})})}#L(e){const i=this.#t.get(e.target);if(!i)return;const g=e.key,b=()=>{e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation()},O=this.#i.filter(o=>!o.reason),ne=O.indexOf(i),H=o=>{const l=O[Math.max(0,Math.min(O.length-1,o))];if(!(!l||l===i)){this.#_();for(const t of O)t.node.setAttribute("tabindex",t===l?"0":"-1");l.node.focus&&l.node.focus()}};if(g==="Home"){b(),H(0);return}if(g==="End"){b(),H(O.length-1);return}if(g==="PageDown"){b(),H(ne+1);return}if(g==="PageUp"){b(),H(ne-1);return}if(g==="Escape"){this.#o&&(b(),this.#_());return}if(g==="Enter"||g===" "){if(!this.#b(i)){b();return}b();const o=this.#o;this.#o=null,o&&o.handle===i&&this.#N(i,o.values);return}const F={ArrowUp:["y",1,-1],ArrowDown:["y",-1,1],ArrowRight:["x",1,1],ArrowLeft:["x",-1,-1]}[g];if(!F)return;let s=F[0];const M=F[1];if(i.axes.length===1){const o=i.axes[0];if(i.kind!=="slice"&&o.screen!==F[0]){b(),H(ne+F[2]);return}s=o.name}const B=i.axes.find(o=>o.name===s);if(!B||(b(),!this.#b(i)))return;const I=i.editable,V=this.#o&&this.#o.handle===i&&this.#o.values[s]!==void 0?this.#o.values[s]:B.value,fe=i.kind==="slice"?i.pie.whole:B.scale.domain.max-B.scale.domain.min,a=v(I,fe)*(e.shiftKey?10:1),x=c(V+M*a,I,{unit:i.kind==="slice"?fe/400:this.#k(B),integer:B.column&&B.column.type==="integer"}),R={...this.#o&&this.#o.handle===i?this.#o.values:{},[s]:x};this.#o={handle:i,values:R},this.#x(""),this.#O(i,R)}#_(){const e=this.#o;this.#o=null,e&&this.#v(e.handle)}#F(e){const i=e.relatedTarget;i&&this.#t.has(i)||this.#_()}}}),tt("packages/modules/charts/floating.js",function(r,oe){"use strict";Object.defineProperty(r,"bindFloating",{enumerable:!0,get:function(){return z}}),Object.defineProperty(r,"drawFloating",{enumerable:!0,get:function(){return e}});const Ae=oe("packages/modules/charts/axis.js"),ae=Ae.drawAxisLines,$=Ae.drawAxisTitle,ke=Ae.drawBandLabels,we=Ae.drawCategoryAxis,se=Ae.drawMeasureAxis,ie=Ae.overhangFor,Z=Ae.setPlotClip,le=oe("packages/modules/charts/frame.js"),D=le.Pool,d=le.shouldRotate,T=oe("packages/modules/charts/format.js").formatters,W=oe("packages/modules/charts/scale.js"),G=W.bandScale,A=W.extent,p=W.isNumber,f=W.key,w=W.linearScale,N=W.timeScale,q=W.toNumber,k=W.toTime,_=oe("packages/modules/charts/svg.js"),c=_.attrs,v=_.round,m=oe("packages/modules/charts/styles.js").NS,P=oe("packages/modules/charts/scheme.js").resolveScheme,K=oe("packages/modules/charts/bind.js").leafRows,re=oe("packages/core/src/internal/util.js").warnOnce,C=Object.freeze(["date","datetime","timestamp","dateString"]);function ee(i,g){return g==="time"?k(i):q(i)}function z(i,g){const b=Array.isArray(g.y)&&g.y.length===2?g.y:null;if(!b)return re("chart:floating:y-pair",`a floating bar needs a from/to pair of columns, given as y: [lowCol, highCol]. It was given ${JSON.stringify(g.y)}, so it drew nothing.`),{series:[],categories:[],labels:[],kind:"category",measure:{col:null,fn:"sum",title:""},dimension:{col:g.x||null,title:""},empty:!0,rows:0,floating:!0,valueKind:"linear"};const O=b[0],ne=b[1],H=g.x||null,F=g.series||null,s=i.columns.get(O),M=i.columns.get(ne),B=C.includes(s&&s.type)||C.includes(M&&M.type)?"time":"linear",I=t=>ee(t,B),V=new Map,fe=new Map,a=Array.isArray(g.rows)?g.rows:K(i);for(let t=0;t<a.length;t++){const h=a[t],j=H?h.group&&h.groupColumn===H?h.groupValue:i.rows.value(h.key,H):t,U=f(j);if(!V.has(U)){const Oe=H?i.rows.text(h.key,H)||String(j):String(t);V.set(U,{value:j,label:Oe,order:V.size})}const J=F?h.group&&h.groupColumn===F?h.groupValue:i.rows.value(h.key,F):null,X=F?f(J):"";fe.has(X)||fe.set(X,{label:F?i.rows.text(h.key,F)||String(J):"",points:new Map});const de=fe.get(X);let pe=de.points.get(U);pe||(pe={lows:[],highs:[],rowKey:h.key,keys:[]},de.points.set(U,pe)),g.editable&&pe.keys.push(h.key);const xe=I(i.rows.value(h.key,O)),ve=I(i.rows.value(h.key,ne));xe!==null&&pe.lows.push(xe),ve!==null&&pe.highs.push(ve)}const x=[...V.values()].sort((t,h)=>t.order-h.order),R=typeof g.limit=="number"&&g.limit>0?x.slice(0,g.limit):x,o=[...fe.entries()].map(([t,h],j)=>({key:t,label:h.label,index:j,points:R.map(U=>{const J=f(U.value),X=h.points.get(J),de=X&&X.lows.length?Math.min(...X.lows):null,pe=X&&X.highs.length?Math.max(...X.highs):null;return{x:U.value,xKey:J,label:U.label,y0:de,y1:pe,y:pe!==null?pe:de,rows:1,rowKey:X?X.rowKey:null,...g.editable&&X?{rowKeys:X.keys}:{}}})})),l=[s&&s.title,M&&M.title];return{series:o,categories:R.map(t=>t.value),labels:R.map(t=>t.label),kind:"category",measure:{col:null,fn:"sum",title:l.filter(Boolean).join(" – ")},dimension:{col:H,title:(i.columns.get(H)||{}).title||H||""},empty:o.length===0||R.length===0,rows:a.length,truncated:x.length-R.length,floating:!0,valueKind:B}}function n(i,g,b){const O=[];for(const s of i)for(const M of s.points){const B=ee(M.y0,g),I=ee(M.y1,g);B!==null&&O.push(B),I!==null&&O.push(I)}const ne=A(O)||{min:0,max:1};let{min:H,max:F}=ne;if(H===F){const s=Math.abs(H)>0?Math.abs(H)/10:1;H-=s,F+=s}return p(b&&b.min)&&(H=b.min),p(b&&b.max)&&(F=b.max),H===F&&(F=H+1),{min:H,max:F,kind:g}}function e(i){const{bound:g,plot:b}=i,O=i.type==="horizontalFloatingBar",ne=g.valueKind||"linear",H=i.axis||{x:{},y:{}},F=i.typography||{small:i.fontSize||11,axisTitle:11},s=g.series.filter(h=>!i.hidden.has(h.key)),M=i.scheme||P(),B=n(s,ne,H.y),I=O?[b.left,b.right]:[b.bottom,b.top],V=ne==="time"?N(B,I):w(B,I),fe=O?[b.top,b.bottom]:[b.left,b.right],a=G(g.categories,fe,.2),x=T(i.grid,{kind:ne,span:B.max-B.min,step:(B.max-B.min)/5}),R=i.axes!==!1;R&&se({gridGroup:i.groups.grid,axisGroup:i.groups.axis,plot:b,scale:V,format:x,horizontal:O,side:"left",config:H.y,grid:i.grid,size:F.small}),R&&(O?ke({group:i.groups.overlay,plot:b,scale:a,labels:g.labels,fontSize:F.small,config:H.x}):we({group:i.groups.overlay,plot:b,scale:a,labels:g.labels,fontSize:F.small,rotated:d(g.labels,a.step,F.small),config:H.x})),R&&(ae({group:i.groups.rules,plot:b,side:"left"}),$({group:i.groups.axis,plot:b,text:H.y.title,side:O?"bottom":"left",size:F.axisTitle}),$({group:i.groups.axis,plot:b,text:H.x.title,side:O?"left":"bottom",size:F.axisTitle})),Z(i.groups,b,ie(i.type));const o=i.pool||new D(i.groups.marks),l=a.bandwidth,t=s.length?l/s.length:l;for(let h=0;h<s.length;h++){const j=s[h],U=M.series(j.index,j.label);for(let J=0;J<j.points.length;J++){const X=j.points[J],de=ee(X.y0,ne),pe=ee(X.y1,ne);if(de===null||pe===null)continue;const xe=Math.min(de,pe),ve=Math.max(de,pe);if(O){const Oe=a.of(X.x);if(Number.isNaN(Oe))continue;const Pe=v(V.of(xe)),te=v(V.of(ve)),Se=v(Oe+h*t);c(o.next("rect",`${m}__float ${m}__mark`,`${j.key}:${f(X.x)}`),{x:Pe,y:Se,width:v(Math.max(1,te-Pe)),height:v(Math.max(0,t)),fill:U,"data-series":j.index,"data-point":J}),X.px=te,X.py=v(Se+t/2),X.pbase=Pe}else{const Oe=a.of(X.x);if(Number.isNaN(Oe))continue;const Pe=v(V.of(ve)),te=v(V.of(xe));c(o.next("rect",`${m}__float ${m}__mark`,`${j.key}:${f(X.x)}`),{x:v(Oe+h*t),y:v(Math.min(Pe,te)),width:v(Math.max(1,t)),height:v(Math.max(1,Math.abs(te-Pe))),fill:U,"data-series":j.index,"data-point":J}),X.px=v(Oe+h*t+t/2),X.py=v(Math.min(Pe,te)),X.pbase=v(Math.max(Pe,te))}}}return i.pool||o.finish(),{xScale:a,yScale:V,series:s,horizontal:O,floating:!0,valueKind:ne}}}),tt("packages/modules/charts/pyramid.js",function(r,oe){"use strict";Object.defineProperty(r,"bindPyramid",{enumerable:!0,get:function(){return K}}),Object.defineProperty(r,"drawPyramid",{enumerable:!0,get:function(){return re}});const Ae=oe("packages/modules/charts/axis.js"),ae=Ae.drawAxisLines,$=Ae.drawAxisTitle,ke=Ae.drawBandLabels,we=Ae.setPlotClip,se=Ae.overhangFor,ie=Ae.tickLabeller,le=oe("packages/modules/charts/frame.js").Pool,D=oe("packages/modules/charts/format.js"),d=D.formatters,L=D.measureFormat,T=oe("packages/modules/charts/scale.js"),W=T.bandScale,G=T.isNumber,A=T.key,p=T.linearScale,f=T.measureDomain,w=oe("packages/modules/charts/svg.js"),N=w.attrs,q=w.round,_=oe("packages/modules/charts/styles.js").NS,v=oe("packages/modules/charts/scheme.js").resolveScheme,E=oe("packages/modules/charts/bind.js"),m=E.bindMeasures,y=E.bindSeries,Q=oe("packages/core/src/internal/util.js").warnOnce;function K(C,ee){const z=Array.isArray(ee.measures)?ee.measures:[],n=z.length>=2?m(C,{...ee,measures:z.slice(0,2)}):y(C,ee);return n.series.length!==2&&Q("chart:pyramid:halves",`a populationPyramid needs exactly two halves: a y column split by a series column holding two values, or measures: [left, right]. It found ${n.series.length}, so it draws the first two.`),{...n,series:n.series.slice(0,2),pyramid:!0}}function ge(C,ee){let z=0;for(const n of C)for(const e of n.points){const i=ee(e);i!==null&&(z=Math.max(z,Math.abs(i)))}return z>0?z:1}function re(C){const{bound:ee,plot:z}=C,n=C.pyramid||{},e=C.scheme||v(),i=C.axis||{x:{},y:{}},g=C.typography||{small:C.fontSize||11,axisTitle:11},b=C.hidden||new Set,O=ee.series.slice(0,2),[ne,H]=O,F=!!n.percent;let s=0;for(const ve of O)for(const Oe of ve.points)G(Oe.y)&&(s+=Math.abs(Oe.y));const M=ve=>{if(!G(ve.y))return null;const Oe=Math.abs(ve.y);return F?s?Oe/s*100:0:Oe},B=O.filter(ve=>!b.has(ve.key)),I=n.scale!=="independent",V=ge(B.length?B:O,M),fe=I?V:ge(ne&&!b.has(ne.key)?[ne]:[],M),a=I?V:ge(H&&!b.has(H.key)?[H]:[],M),x=q((z.left+z.right)/2),R=ve=>f([0,ve],{zero:!0,nice:!0,min:0}),o=p(R(fe),[x,z.left]),l=p(R(a),[x,z.right]),t=W(ee.categories,[z.top,z.bottom],.2),h=ve=>(ve.domain.max-ve.domain.min)/5,j=d(C.grid,{kind:"linear",step:Math.max(h(o),h(l))}),U={tick:ve=>j.tick(Math.abs(ve))+(F?"%":"")},J=ie(i.y,U,C.grid);if(C.axes!==!1){const ve=new le(C.groups.grid),Oe=new le(C.groups.axis),Pe=(te,Se)=>{for(const ye of te.ticks()){if(Se&&ye===0)continue;const be=q(te.of(ye));N(ve.next("line",`${_}__gridline`),{x1:be,x2:be,y1:q(z.top),y2:q(z.bottom),"stroke-opacity":ye===0?1:.6,"stroke-width":ye===0?1.5:1});const Ne=Oe.next("text",`${_}__tick`);N(Ne,{x:be,y:q(z.bottom+6),"text-anchor":"middle","dominant-baseline":"hanging"}),Ne.textContent=J(ye)}};Pe(l,!1),Pe(o,!0),ve.finish(),Oe.finish(),ke({group:C.groups.overlay,plot:z,scale:t,labels:ee.labels,fontSize:g.small,config:i.x}),ae({group:C.groups.rules,plot:z,side:"left"}),$({group:C.groups.axis,plot:z,text:i.y.title,side:"bottom",size:g.axisTitle})}we(C.groups,z,se(C.type));const X=C.pool||new le(C.groups.marks),de=t.bandwidth,pe=(ve,Oe,Pe)=>{if(!ve||b.has(ve.key))return;const te=e.series(ve.index,ve.label);for(let Se=0;Se<ve.points.length;Se++){const ye=ve.points[Se],be=M(ye);if(be===null)continue;const Ne=t.of(ye.x);if(Number.isNaN(Ne))continue;const je=q(Oe.of(be));N(X.next("rect",`${_}__bar ${_}__pyramid-bar ${_}__mark`,`${ve.key}:${A(ye.x)}`),{x:q(Math.min(je,x)),y:q(Ne),width:q(Math.abs(je-x)),height:q(Math.max(0,de)),fill:te,"data-series":ve.index,"data-point":Se}),ye.px=je,ye.py=q(Ne+de/2),ye.pbase=x,ye.side=Pe}};pe(ne,o,-1),pe(H,l,1),C.pool||X.finish();const xe=ve=>C.grid.columns.get(ve.key);return{xScale:t,yScale:l,series:B,horizontal:!0,pyramid:{percent:F,shared:I,centre:x},valueText:(ve,Oe)=>{const Pe=L(Math.abs(Oe.y),xe(ve),C.grid);if(!F)return Pe;const te=s?Math.abs(Oe.y)/s:0;return`${Pe} (${C.grid.messages.number(te,{style:"percent",maximumFractionDigits:1})})`}}}}),tt("packages/modules/charts/bullet.js",function(r,oe){"use strict";Object.defineProperty(r,"bindBullet",{enumerable:!0,get:function(){return K}}),Object.defineProperty(r,"drawBullet",{enumerable:!0,get:function(){return re}});const Ae=oe("packages/modules/charts/axis.js"),ae=Ae.drawAxisLines,$=Ae.drawAxisTitle,ke=Ae.drawBandLabels,we=Ae.drawCategoryAxis,se=Ae.drawMeasureAxis,ie=Ae.overhangFor,Z=Ae.setPlotClip,le=oe("packages/modules/charts/frame.js"),D=le.Pool,d=le.shouldRotate,L=oe("packages/modules/charts/format.js"),T=L.formatters,W=L.measureFormat,G=oe("packages/modules/charts/scale.js"),A=G.bandScale,p=G.isNumber,f=G.key,w=G.linearScale,N=G.measureDomain,q=G.toNumber,k=oe("packages/modules/charts/svg.js"),_=k.attrs,c=k.round,E=oe("packages/modules/charts/styles.js").NS,y=oe("packages/modules/charts/scheme.js").resolveScheme,Q=oe("packages/modules/charts/bind.js").bindMeasures;function K(C,ee){const z=ee.y&&typeof ee.y=="object"?ee.y:{col:ee.y},n=[{col:z.col,fn:z.fn}],e={actual:0,target:-1,rangeColumns:[],edges:[]};ee.target&&C.columns.get(ee.target)&&(e.target=n.length,n.push({col:ee.target}));for(const g of Array.isArray(ee.ranges)?ee.ranges:[])typeof g=="string"&&C.columns.get(g)?(e.rangeColumns.push(n.length),n.push({col:g})):p(q(g))&&e.edges.push(q(g));return{...Q(C,{...ee,measures:n}),bullet:e}}function ge(C,ee){const z=C.bullet,n=z.edges.slice();for(const e of z.rangeColumns){const i=C.series[e]&&C.series[e].points[ee];i&&p(i.y)&&n.push(i.y)}return n.sort((e,i)=>e-i)}function re(C){const{bound:ee,plot:z}=C,n=C.bullet||{},e=n.orientation!=="vertical",i=n.scale==="row",g=C.scheme||y(),b=C.axis||{x:{},y:{}},O=C.typography||{small:C.fontSize||11,axisTitle:11},ne=ee.bullet||{actual:0,target:-1,rangeColumns:[],edges:[]},H=ee.series[ne.actual],F=ne.target>=0?ee.series[ne.target]:null,s=ee.categories.length,M=pe=>{const xe=[0],ve=H&&H.points[pe],Oe=F&&F.points[pe];return ve&&p(ve.y)&&xe.push(ve.y),Oe&&p(Oe.y)&&xe.push(Oe.y),xe.concat(ge(ee,pe))},B=pe=>N(pe,{zero:!0,min:C.min,max:C.max}),I=[];for(let pe=0;pe<s;pe++)I.push(...M(pe));const V=B(I),fe=e?[z.left,z.right]:[z.bottom,z.top],a=pe=>w(pe,fe),x=a(V),R=[];for(let pe=0;pe<s;pe++)R.push(i?a(B(M(pe))):x);const o=e?[z.top,z.bottom]:[z.left,z.right],l=A(ee.categories,o,.25);C.axes!==!1&&(i?(new D(C.groups.grid).finish(),new D(C.groups.axis).finish()):se({gridGroup:C.groups.grid,axisGroup:C.groups.axis,plot:z,scale:x,format:T(C.grid,{kind:"linear",step:(V.max-V.min)/5}),horizontal:e,side:"left",config:b.y,grid:C.grid,size:O.small}),e?ke({group:C.groups.overlay,plot:z,scale:l,labels:ee.labels,fontSize:O.small,config:b.x}):we({group:C.groups.overlay,plot:z,scale:l,labels:ee.labels,fontSize:O.small,rotated:d(ee.labels,l.step,O.small),config:b.x}),ae({group:C.groups.rules,plot:z,side:"left"}),$({group:C.groups.axis,plot:z,text:b.y.title,side:e?"bottom":"left",size:O.axisTitle})),Z(C.groups,z,ie(C.type));const t=C.pool||new D(C.groups.marks),h=l.bandwidth,j=h/3,U=h*.6,J=H?g.series(H.index,H.label):g.series(0),X=(pe,xe)=>{const[ve,Oe]=pe.range,Pe=pe.of(Math.max(pe.domain.min,Math.min(pe.domain.max,xe)));return Math.max(Math.min(ve,Oe),Math.min(Math.max(ve,Oe),Pe))};for(let pe=0;pe<s;pe++){const xe=l.of(ee.categories[pe]);if(Number.isNaN(xe))continue;const ve=R[pe],Oe=X(ve,ve.domain.min),Pe=xe+h/2,te=f(ee.categories[pe]),Se=ge(ee,pe);let ye=Oe;for(let je=0;je<Se.length;je++){const Ee=X(ve,Se[je]),Ce=Se.length>1?.14+.3*((Se.length-1-je)/(Se.length-1)):.22,Fe=Math.min(ye,Ee),We=Math.max(ye,Ee);_(t.next("rect",`${E}__bullet-band`,`band:${te}:${je}`),e?{x:c(Fe),y:c(xe),width:c(We-Fe),height:c(h),"fill-opacity":Ce,"data-decor":"band"}:{x:c(xe),y:c(Fe),width:c(h),height:c(We-Fe),"fill-opacity":Ce,"data-decor":"band"}),ye=Ee}const be=H&&H.points[pe];if(be&&p(be.y)){const je=X(ve,be.y),Ee=Math.min(Oe,je),Ce=Math.max(Oe,je);_(t.next("rect",`${E}__bar ${E}__bullet-bar ${E}__mark`,`bar:${te}`),e?{x:c(Ee),y:c(Pe-j/2),width:c(Ce-Ee),height:c(j),fill:J,"data-series":H.index,"data-point":pe}:{x:c(Pe-j/2),y:c(Ee),width:c(j),height:c(Ce-Ee),fill:J,"data-series":H.index,"data-point":pe}),be.px=c(e?je:Pe),be.py=c(e?Pe:je),be.pbase=c(Oe)}const Ne=F&&F.points[pe];if(Ne&&p(Ne.y)){const je=X(ve,Ne.y);_(t.next("line",`${E}__bullet-target`,`target:${te}`),e?{x1:c(je),x2:c(je),y1:c(Pe-U/2),y2:c(Pe+U/2),"data-series":F.index,"data-point":pe}:{y1:c(je),y2:c(je),x1:c(Pe-U/2),x2:c(Pe+U/2),"data-series":F.index,"data-point":pe}),Ne.px=c(e?je:Pe),Ne.py=c(e?Pe:je)}}C.pool||t.finish();const de=C.hidden||new Set;return{xScale:l,yScale:x,series:ee.series.filter(pe=>!de.has(pe.key)),horizontal:e,bullet:{perRow:i,domain:V},valueText:(pe,xe)=>W(xe.y,C.grid.columns.get(pe.key),C.grid)}}}),tt("packages/modules/charts/polar.js",function(r,oe){"use strict";Object.defineProperty(r,"arcBand",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(r,"drawRadar",{enumerable:!0,get:function(){return re}}),Object.defineProperty(r,"gaugeReading",{enumerable:!0,get:function(){return C}}),Object.defineProperty(r,"gaugeReadingPlace",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(r,"drawGauge",{enumerable:!0,get:function(){return z}});const ae=oe("packages/modules/charts/frame.js").Pool,ke=oe("packages/modules/charts/format.js").measureFormat,we=oe("packages/modules/charts/scale.js"),se=we.isNumber,ie=we.measureDomain,Z=oe("packages/modules/charts/svg.js"),le=Z.attrs,D=Z.path,d=Z.round,L=Z.setText,W=oe("packages/modules/charts/styles.js").NS,A=oe("packages/modules/charts/scheme.js").resolveScheme,p=oe("packages/modules/charts/labels.js"),f=p.drawAnchoredLabels,w=p.labelText,N=oe("packages/modules/charts/bind.js"),q=N.AGGREGATIONS,k=N.DEFAULT_AGGREGATION,_=oe("packages/modules/charts/typography.js"),c=_.applySize,v=_.textWidth,E=_.truncateTo,m=Math.PI*2,y=4,P=m*2/3,Q=Math.PI/2+(m-P)/2;function K(n,e,i,g){const b=g-Math.PI/2;return[n+i*Math.cos(b),e+i*Math.sin(b)]}function ge(n){const e=n.to-n.from;if(e<=0)return"";const i=Math.max(0,n.r-n.width),g=e>Math.PI?1:0,[b,O]=K(n.cx,n.cy,n.r,n.from),[ne,H]=K(n.cx,n.cy,n.r,n.to),[F,s]=K(n.cx,n.cy,i,n.to),[M,B]=K(n.cx,n.cy,i,n.from);return D(["M",d(b),d(O),"A",d(n.r),d(n.r),0,g,1,d(ne),d(H),"L",d(F),d(s),"A",d(i),d(i),0,g,0,d(M),d(B),"Z"])}function re(n){const e=n.scheme||A(),{plot:i,bound:g}=n;new ae(n.groups.grid).finish(),new ae(n.groups.axis).finish(),new ae(n.groups.rules).finish(),new ae(n.groups.labels).finish();const b=i.left+i.width/2,O=i.top+i.height/2,ne=Math.max(0,Math.min(i.width,i.height)/2-n.fontSize*2),H=g.labels,F=g.series.filter(x=>!n.hidden.has(x.key)),s=[];for(const x of F)for(const R of x.points)s.push(R.y);const M=ie(s,{zero:!0}),B=H.length?m/H.length:m,I=x=>{const R=M.max-M.min||1;return Math.max(0,(x-M.min)/R*ne)},V=new ae(n.groups.grid);for(let x=1;x<=y;x++){const R=ne*x/y,o=H.map((l,t)=>K(b,O,R,t*B));le(V.next("path",`${W}__web`),{d:o.length?D([...o.flatMap(([l,t],h)=>[h?"L":"M",d(l),d(t)]),"Z"]):"",fill:"none"})}for(let x=0;x<H.length;x++){const[R,o]=K(b,O,ne,x*B);le(V.next("path",`${W}__web`),{d:D(["M",d(b),d(O),"L",d(R),d(o)]),fill:"none"})}V.finish();const fe=new ae(n.groups.marks);for(const x of F){const R=[];for(let t=0;t<H.length;t++){const h=x.points[t],j=se(h&&h.y)?h.y:M.min,[U,J]=K(b,O,I(j),t*B);R.push([d(U),d(J)]),h&&(h.px=d(U),h.py=d(J))}const o=R.length?D([...R.flatMap(([t,h],j)=>[j?"L":"M",t,h]),"Z"]):"",l=e.series(x.index,x.label);le(fe.next("path",`${W}__radar-fill ${W}__mark`),{d:o,fill:l,"data-series":x.index}),le(fe.next("path",`${W}__radar-line ${W}__mark`),{d:o,stroke:l,fill:"none","data-series":x.index})}fe.finish();const a=new ae(n.groups.overlay);for(let x=0;x<H.length;x++){const[R,o]=K(b,O,ne+n.fontSize,x*B),l=a.next("text",`${W}__tick`),t=Math.abs(R-b)<1?"middle":R>b?"start":"end";le(l,{x:d(R),y:d(o),"text-anchor":t,"dominant-baseline":"middle"}),L(l,H[x])}if(a.finish(),n.labels&&n.labels.show){const x=n.typography&&n.typography.small||n.fontSize||11,R=[];for(const o of F)for(const l of o.points){if(!l||l.px===void 0||!se(l.y))continue;const t=l.px-b,h=l.py-O,j=Math.hypot(t,h)||1;R.push({x:d(l.px+t/j*(x*.8)),y:d(l.py+h/j*(x*.8)),text:w(l.y,n.labels,n.grid)})}f({group:n.groups.labels,size:x,minGap:n.labels.minGap,anchors:R,plot:i})}return{centre:{x:b,y:O,r:ne},series:F,axes:H}}function C(n){const e=n&&Array.isArray(n.series)?n.series[0]:null,i=e&&Array.isArray(e.points)?e.points:[],g=n&&n.measure&&n.measure.fn,b=typeof g=="string"&&g in q?g:k,O=[];let ne=0,H=i.length>0;for(const M of i){if(ne+=Number.isFinite(M.rows)?M.rows:0,!Array.isArray(M.values)){H=!1;break}for(let B=0;B<M.values.length;B++)O.push(M.values[B])}if(H)return{value:q[b](O,ne),fn:b};const F=i.filter(M=>se(M.y));if(!F.length)return{value:null,fn:b};const s=F.map(M=>M.y);if(b==="min")return{value:q.min(s,0),fn:b};if(b==="max")return{value:q.max(s,0),fn:b};if(b==="first")return{value:s[0],fn:b};if(b==="last")return{value:s[s.length-1],fn:b};if(b==="avg"||b==="mean"){let M=0,B=0;for(const I of F){const V=Number.isFinite(I.rows)&&I.rows>0?I.rows:1;M+=V,B+=I.y*V}return{value:B/M,fn:b}}return{value:s.reduce((M,B)=>M+B,0),fn:b}}function ee(n){const e=(m-P)/2,[i,g]=K(0,0,1,Q-e),b=n.stroke/2+3,O=1.15,ne=n.bounds,H=(B,I,V)=>{const fe=Math.max(v(n.reading,B),V?v(V,I):0)*O+4,a=B*1.2,x=V?I*1.4:0,R=a+x,o=U=>{const J=i*U,X=g*U;for(const[pe,xe]of[[-1,-1],[1,-1],[1,1],[-1,1]]){const ve=J+pe*fe/2,Oe=X+xe*R/2,Pe=Math.hypot(ve,Oe);if(Pe<n.pin+b)return!1;const te=Math.acos(Math.max(-1,Math.min(1,(ve*i+Oe*g)/(Pe||1))));if(te>=e||Pe*Math.sin(e-te)<b)return!1}return Math.abs(J*i+X*g)-(Math.abs(i)*fe+Math.abs(g)*R)/2>=n.pin+b};let l=0;for(;l<4096&&!o(l);)l+=1;const t=n.cx+i*l,h=n.cy+g*l-R/2;return{fits:!ne||t-fe/2>=ne.left&&t+fe/2<=ne.right&&h>=ne.top&&h+R<=ne.bottom,x:t,readingY:h+a/2,captionY:h+a+x/2}},F=Math.max(1,Math.min(n.minSize,n.readingSize)),s=Math.min(n.captionSize,9),M=8;for(let B=1;;B-=.05){const I=Math.max(F,n.readingSize*B),V=Math.max(s,n.captionSize*B),fe=I<=F;let a=n.caption||"";for(;;){const x=H(I,V,a),R={...x,readingSize:I,captionSize:V,caption:a};if(x.fits)return R;if(!a){if(fe)return R;break}const o=E(n.caption,v(a,V)-V,V),l=o&&o!=="…"?o:"",t=l.endsWith("…")?l.length-1:l.length;if(!fe&&t<M)break;a=l}}}function z(n){const e=n.scheme||A(),{plot:i,bound:g}=n;new ae(n.groups.grid).finish(),new ae(n.groups.axis).finish(),new ae(n.groups.rules).finish(),new ae(n.groups.labels).finish();const b=C(g),O=b.value===null?0:b.value,ne=se(n.min)?n.min:0,H=se(n.max)?n.max:Math.max(O,1),F=H-ne||1,s=Math.min(H,Math.max(ne,O)),M=Math.min(1,Math.max(0,(s-ne)/F)),B=i.left+i.width/2,I=i.top+i.height/2,V=Math.max(0,Math.min(i.width,i.height)/2-4),fe=Math.max(6,V*.24),a=Oe=>Q+P*((Oe-ne)/F),x=new ae(n.groups.marks);le(x.next("path",`${W}__gauge-track`),{d:ge({cx:B,cy:I,r:V,width:fe,from:Q,to:Q+P})});const R=Array.isArray(n.bands)?n.bands:[],o=[];for(const Oe of R){const Pe=se(Oe.from)?Math.max(ne,Math.min(H,Oe.from)):ne,te=se(Oe.to)?Math.max(ne,Math.min(H,Oe.to)):H;if(te<=Pe)continue;const Se=Oe.colour||e.series(o.length);le(x.next("path",`${W}__gauge-band ${W}__mark`),{d:ge({cx:B,cy:I,r:V,width:fe,from:a(Pe),to:a(te)}),fill:Se}),Oe.label&&o.push({key:`band-${o.length}`,label:Oe.label,index:o.length,colour:Se})}const l=(()=>{for(const Oe of R)if(s>=Oe.from&&s<=Oe.to)return Oe.colour||e.series(0);return e.series(0)})();let t=0,h=0;if(n.needle){const Oe=typeof n.needle=="object"&&n.needle?n.needle:{};t=Number.isFinite(Oe.width)&&Oe.width>0?Oe.width:2,h=(Number.isFinite(Oe.pin)&&Oe.pin>0?Oe.pin:.08)*V;const Pe=a(s),[te,Se]=K(B,I,h,Pe),[ye,be]=K(B,I,V-fe*.5,Pe);le(x.next("path",`${W}__gauge-needle ${W}__mark`),{d:D(["M",d(te),d(Se),"L",d(ye),d(be)]),stroke:l,"stroke-width":t,fill:"none"}),le(x.next("circle",`${W}__gauge-pin ${W}__mark`),{cx:d(B),cy:d(I),r:d(h),fill:l})}else le(x.next("path",`${W}__gauge-value ${W}__mark`),{d:ge({cx:B,cy:I,r:V,width:fe,from:Q,to:Q+P*M}),fill:e.series(0)});if(se(n.target)){const Oe=Math.min(1,Math.max(0,(n.target-ne)/F)),Pe=Q+P*Oe,[te,Se]=K(B,I,V-fe,Pe),[ye,be]=K(B,I,V,Pe);le(x.next("path",`${W}__gauge-target`),{d:D(["M",d(te),d(Se),"L",d(ye),d(be)]),fill:"none"})}if(Array.isArray(n.ticks))for(const Oe of n.ticks){if(!se(Oe)||Oe<ne||Oe>H)continue;const Pe=a(Oe),[te,Se]=K(B,I,V-fe,Pe),[ye,be]=K(B,I,V,Pe);le(x.next("path",`${W}__gauge-tick`),{d:D(["M",d(te),d(Se),"L",d(ye),d(be)]),fill:"none"})}x.finish();const j=g.measure&&g.measure.col&&n.grid&&n.grid.columns?n.grid.columns.get(g.measure.col):null,U=ke(O,j,n.grid),J=n.centre&&n.centre.label||g.measure.title||"",X=n.needle?ee({cx:B,cy:I,pin:h,stroke:t,reading:U,caption:J,readingSize:n.fontSize*1.8,captionSize:n.fontSize*.9,minSize:n.fontSize,bounds:{left:i.left,top:i.top,right:i.left+i.width,bottom:i.top+i.height}}):null,de=new ae(n.groups.overlay),pe=de.next("text",`${W}__gauge-reading`);le(pe,{x:d(X?X.x:B),y:d(X?X.readingY:I),"text-anchor":"middle","dominant-baseline":"middle"}),L(pe,U);const xe=de.next("text",`${W}__gauge-caption`);le(xe,{x:d(X?X.x:B),y:d(X?X.captionY:I+n.fontSize*1.6),"text-anchor":"middle","dominant-baseline":"middle"});const ve=X?X.caption:J;return L(xe,ve),le(xe,{"aria-label":ve!==J?J:null}),X?(c(pe,X.readingSize),c(xe,X.captionSize)):(pe.style&&(pe.style.fontSize=""),xe.style&&(xe.style.fontSize="")),de.finish(),{value:O,fn:b.fn,reading:U,domain:{min:ne,max:H},legend:o}}}),tt("packages/modules/charts/multiples.js",function(r,oe){"use strict";Object.defineProperty(r,"MAX_PANELS",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(r,"panelGrid",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(r,"panelRects",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"splitPanels",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(r,"sharedDomain",{enumerable:!0,get:function(){return we}});const Ae=24;function ae(se,ie){if(se<=1)return{columns:1,rows:1};const Z=(ie.width||1)/(ie.height||1);let le=Math.max(1,Math.round(Math.sqrt(se*Z)));le=Math.min(le,se);const D=Math.ceil(se/le);return{columns:le,rows:D}}function $(se){const ie=Math.min(se.count,Ae),Z=se.gap===void 0?10:se.gap,le=se.titleHeight===void 0?14:se.titleHeight,{columns:D,rows:d}=ae(ie,se.plot),L=(se.plot.width-Z*(D-1))/D,T=(se.plot.height-Z*(d-1))/d,W=[];for(let G=0;G<ie;G++){const A=G%D,p=Math.floor(G/D);W.push({index:G,x:se.plot.left+A*(L+Z),y:se.plot.top+p*(T+Z)+le,width:Math.max(0,L),height:Math.max(0,T-le)})}return W}function ke(se){return se.series.map((ie,Z)=>({label:ie.label,key:ie.key,index:Z,bound:{...se,series:[{...ie,index:Z}]}}))}function we(se,ie,Z){const le=[];for(const D of se.series)for(const d of D.points)le.push(d.y);return Z(le,{zero:ie})}}),tt("packages/modules/charts/globe.js",function(r,oe){"use strict";Object.defineProperty(r,"HEMISPHERE_METRES",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"isGlobeProjection",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(r,"globeCentre",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"globeView",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"clipRing",{enumerable:!0,get:function(){return G}}),Object.defineProperty(r,"clipLine",{enumerable:!0,get:function(){return A}}),Object.defineProperty(r,"pixelsPath",{enumerable:!0,get:function(){return p}}),Object.defineProperty(r,"globeRingPath",{enumerable:!0,get:function(){return f}}),Object.defineProperty(r,"spherePath",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"globeLinePaths",{enumerable:!0,get:function(){return N}}),Object.defineProperty(r,"meanDirection",{enumerable:!0,get:function(){return q}}),Object.defineProperty(r,"drawGlobeBackdrop",{enumerable:!0,get:function(){return k}}),Object.defineProperty(r,"globeReport",{enumerable:!0,get:function(){return _}});const ae=oe("packages/modules/charts/projection.js").graticule,$=Math.PI/180;function ke(c){return Math.round(c*100)/100}const we=4,se=63710088e-1*(Math.PI/2),ie=new Set(["orthographic","globe"]);function Z(c){return typeof c=="string"&&ie.has(c)}function le(c){return((c+180)%360+360)%360-180}function D(c,v){const E=Array.isArray(c)&&Number.isFinite(c[0])&&Number.isFinite(c[1])?[Number(c[0]),Number(c[1])]:[0,0],[m,y]=v||[0,0],P=Math.max(-90,Math.min(90,E[1]+(y||0)/$));return[le(E[0]+(m||0)/$),P]}function d(c){const{plot:v}=c,E=typeof c.padding=="number"?c.padding:4,m=typeof c.zoom=="number"&&c.zoom>0?c.zoom:1,y=D(c.rotate,c.offset),P=y[0]*$,Q=Math.sin(y[1]*$),K=Math.cos(y[1]*$),ge=Math.max(1,Math.min(v.width,v.height)/2-E)*m,re=v.left+v.width/2,C=v.top+v.height/2,ee=(z,n)=>{const e=n*$,i=z*$-P,g=Math.cos(e),b=Math.sin(e);return[g*Math.sin(i),K*b-Q*g*Math.cos(i),Q*b+K*g*Math.cos(i)]};return{centre:y,radius:ge,cx:re,cy:C,vector:ee,visible:(z,n)=>ee(z,n)[2]>=0,to:(z,n)=>{const e=ee(z,n);return e[2]<0?[NaN,NaN]:[re+ge*e[0],C-ge*e[1]]}}}function L(c,v){return[c.cx+c.radius*v[0],c.cy-c.radius*v[1]]}function T(c,v){const E=c[2]/(c[2]-v[2]),m=c[0]+(v[0]-c[0])*E,y=c[1]+(v[1]-c[1])*E,P=Math.hypot(m,y)||1;return[m/P,y/P,0]}function W(c,v,E){let m=E-v;m=((m+Math.PI)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)-Math.PI;const y=Math.floor(Math.abs(m)/(we*$)),P=[];for(let Q=1;Q<=y;Q++){const K=v+m*Q/(y+1);P.push(L(c,[Math.cos(K),Math.sin(K),0]))}return P}function G(c,v){if(!Array.isArray(c)||c.length<3)return[];let E=c;const m=c[0],y=c[c.length-1];c.length>3&&m[0]===y[0]&&m[1]===y[1]&&(E=c.slice(0,-1));const P=E.map(([ee,z])=>v.vector(ee,z)),Q=P.length;let K=-1,ge=!0;for(let ee=0;ee<Q;ee++)P[ee][2]>=0?K<0&&(K=ee):ge=!1;if(K<0)return[];if(ge)return P.map(ee=>L(v,ee));const re=[L(v,P[K])];let C=0;for(let ee=0;ee<Q;ee++){const z=P[(K+ee)%Q],n=P[(K+ee+1)%Q],e=z[2]>=0,i=n[2]>=0,g=ee===Q-1;if(e&&i)g||re.push(L(v,n));else if(e){const b=T(z,n);C=Math.atan2(b[1],b[0]),re.push(L(v,b))}else if(i){const b=T(n,z);for(const O of W(v,C,Math.atan2(b[1],b[0])))re.push(O);re.push(L(v,b)),g||re.push(L(v,n))}}return re}function A(c,v){const E=[];let m=[],y=null;for(const[P,Q]of c||[]){const K=v.vector(P,Q),ge=K[2]>=0;if(y){const re=y[2]>=0;re&&!ge?(m.push(L(v,T(y,K))),E.push(m),m=[]):!re&&ge&&(m=[L(v,T(K,y))])}ge&&m.push(L(v,K)),y=K}return m.length&&E.push(m),E.filter(P=>P.length>1)}function p(c,v=!1){if(!c||c.length<2)return"";const E=ke;let m="";return c.forEach((y,P)=>{m+=`${P?"L":"M"}${E(y[0])} ${E(y[1])}`}),v?`${m}Z`:m}function f(c,v){const E=G(c,v);return E.length>2?p(E,!0):""}function w(c){const{cx:v,cy:E,radius:m}=c,y=ke;return`M${y(v-m)} ${y(E)}A${y(m)} ${y(m)} 0 1 0 ${y(v+m)} ${y(E)}A${y(m)} ${y(m)} 0 1 0 ${y(v-m)} ${y(E)}Z`}function N(c,v){const E=[];for(const m of c)for(const y of A(m,v))E.push(p(y));return E}function q(c){let v=0,E=0,m=0,y=0;for(const[P,Q]of c||[]){if(!Number.isFinite(P)||!Number.isFinite(Q))continue;const K=Q*$,ge=P*$;v+=Math.cos(K)*Math.cos(ge),E+=Math.cos(K)*Math.sin(ge),m+=Math.sin(K),y++}return!y||Math.hypot(v,E,m)<1e-9?null:[Math.atan2(E,v)/$,Math.atan2(m,Math.hypot(v,E))/$]}function k(c){const{view:v,spec:E,pool:m,attrs:y,NS:P,regions:Q,basemapStyle:K}=c;if((!E||E.sphere!==!1)&&y(m.next("path",`${P}__sphere`),{d:w(v),class:`${P}__sphere`,fill:void 0,style:void 0,"data-code":void 0}),E&&E.graticule){const ge=typeof E.graticule=="object"&&E.graticule.step||30;for(const re of N(ae({step:ge}),v))y(m.next("path",`${P}__graticule`),{d:re,class:`${P}__graticule`,fill:void 0,style:void 0,"data-code":void 0})}for(const ge of Q||[]){const re=ge.rings.map(C=>f(C,v)).filter(Boolean).join(" ");re&&y(m.next("path",`${P}__region`),{d:re,fill:K?K.fill:void 0,"data-code":ge.code,class:`${P}__region`,style:K?K.style:void 0})}}function _(c,v){if(!c)return{};const E=new Map;for(const m of v||[])E.set(m.rowKey,[m.lon,m.lat]);return{globe:{centre:c.centre,radius:c.radius,positions:E}}}}),tt("packages/modules/charts/stream.js",function(r,oe){"use strict";Object.defineProperty(r,"wiggleBaseline",{enumerable:!0,get:function(){return re}}),Object.defineProperty(r,"drawStream",{enumerable:!0,get:function(){return C}}),Object.defineProperty(r,"drawMarimekko",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(r,"drawViolin",{enumerable:!0,get:function(){return z}});const Ae=oe("packages/modules/charts/axis.js"),ae=Ae.drawAxisLines,$=Ae.drawCategoryAxis,ke=Ae.drawMeasureAxis,we=Ae.setLabelText,se=oe("packages/modules/charts/distribution.js"),ie=se.density,Z=se.distributionDomain,le=se.summarise,D=se.valuesByCategory,d=oe("packages/modules/charts/frame.js"),L=d.Pool,T=d.shouldRotate,G=oe("packages/modules/charts/format.js").formatters,A=oe("packages/modules/charts/scale.js"),p=A.bandScale,f=A.isNumber,w=A.linearScale,N=A.measureDomain,k=oe("packages/modules/charts/scheme.js").resolveScheme,_=oe("packages/modules/charts/svg.js"),c=_.attrs,v=_.path,E=_.round,y=oe("packages/modules/charts/styles.js").NS,Q=oe("packages/modules/charts/typography.js").truncateTo,K=2,ge=32;function re(n){const e=[];let i=0;for(let g=0;g<n.length;g++){const b=n[g],O=b.reduce((s,M)=>s+M,0);if(g===0){i=-O/2,e.push(i);continue}const ne=n[g-1];let H=0;const F=b.length;for(let s=0;s<F;s++){let M=0;for(let B=0;B<s;B++)M+=(b[B]||0)-(ne[B]||0);H+=(F-s-.5)*((b[s]||0)-(ne[s]||0))+M*0}i-=F>0?H/F:0,e.push(i)}return e}function C(n){const e=n.scheme||k(),{plot:i,bound:g}=n;new L(n.groups.grid).finish(),new L(n.groups.rules).finish(),new L(n.groups.labels).finish();const b=g.series.filter(I=>!n.hidden.has(I.key)),O=g.categories.map((I,V)=>b.map(fe=>{const a=fe.points[V];return f(a&&a.y)?Math.max(0,a.y):0})),ne=re(O),H=[];O.forEach((I,V)=>{H.push(ne[V]),H.push(ne[V]+I.reduce((fe,a)=>fe+a,0))});const F=N(H,{zero:!1,nice:!1}),s=w(F,[i.bottom,i.top]),M=p(g.categories,[i.left,i.right],0),B=new L(n.groups.marks);return b.forEach((I,V)=>{const fe=[],a=[];O.forEach((R,o)=>{let l=ne[o];for(let h=0;h<V;h++)l+=R[h];const t=E(M.centre(g.categories[o]));a.push([t,E(s.of(l))]),fe.push([t,E(s.of(l+R[V]))])});const x=[];fe.forEach(([R,o],l)=>x.push(l?"L":"M",R,o));for(let R=a.length-1;R>=0;R--)x.push("L",a[R][0],a[R][1]);x.push("Z"),c(B.next("path",`${y}__stream ${y}__mark`),{d:v(x),fill:e.series(I.index),"data-series":I.index})}),B.finish(),$({group:n.groups.overlay,plot:i,scale:M,labels:g.labels,fontSize:n.typography&&n.typography.small||n.fontSize,rotated:T(g.labels,M.step,n.fontSize,(n.axis&&n.axis.x||{}).every),config:n.axis&&n.axis.x||{}}),{xScale:M,yScale:s,series:b}}function ee(n){const e=n.scheme||k(),{plot:i,bound:g}=n,b=g.series.filter(a=>!n.hidden.has(a.key)),O=g.categories.map((a,x)=>b.reduce((R,o)=>{const l=o.points[x];return R+(f(l&&l.y)?Math.abs(l.y):0)},0)),ne=O.reduce((a,x)=>a+x,0);if(ne<=0)return{series:b,columns:[]};const H=2,F=i.width-H*Math.max(0,g.categories.length-1),s=w({min:0,max:100},[i.bottom,i.top]);ke({gridGroup:n.groups.grid,axisGroup:n.groups.axis,plot:i,scale:s,format:G(n.grid,{kind:"linear",step:20}),config:n.axis&&n.axis.y||{},grid:n.grid,size:n.typography&&n.typography.small||n.fontSize}),ae({group:n.groups.rules,plot:i});const M=new L(n.groups.marks),B=[];let I=i.left;g.categories.forEach((a,x)=>{const R=O[x]/ne*F;let o=i.bottom;b.forEach((l,t)=>{const h=l.points[x],j=f(h&&h.y)?Math.abs(h.y):0,J=(O[x]>0?j/O[x]:0)*i.height;c(M.next("rect",`${y}__bar ${y}__mark`),{x:E(I),y:E(o-J),width:E(Math.max(0,R)),height:E(Math.max(0,J)),fill:e.series(l.index),"data-series":l.index,"data-point":x}),h&&(h.px=E(I+R/2),h.py=E(o-J)),o-=J}),B.push({category:a,label:g.labels[x],x:I,width:R,total:O[x]}),I+=R+H}),M.finish();const V=new L(n.groups.overlay),fe=n.typography&&n.typography.small||n.fontSize;for(const a of B){const x=Math.max(0,a.width-K*2),R=Q(String(a.label===void 0||a.label===null?"":a.label),x,fe);if(!R||R==="…")continue;const o=V.next("text",`${y}__tick`);o.style.fontSize=`${fe}px`,c(o,{x:E(a.x+a.width/2),y:E(i.top-2),"text-anchor":"middle"}),we(o,a.label,x,fe)}return V.finish(),{series:b,columns:B}}function z(n){const e=n.scheme||k(),{plot:i,bound:g}=n,b=D(g),O=[...b.keys()],ne=[];for(const B of b.values())for(let I=0;I<B.length;I++)ne.push(B[I]);const H=Z(ne,n.axis),F=w(H,[i.bottom,i.top]),s=p(O,[i.left,i.right],.3);ke({gridGroup:n.groups.grid,axisGroup:n.groups.axis,plot:i,scale:F,format:G(n.grid,{kind:"linear",step:(H.max-H.min)/5}),config:n.axis&&n.axis.y||{},grid:n.grid,size:n.typography&&n.typography.small||n.fontSize}),$({group:n.groups.overlay,plot:i,scale:s,labels:O,fontSize:n.typography&&n.typography.small||n.fontSize,rotated:O.length>6,config:n.axis&&n.axis.x||{}}),ae({group:n.groups.rules,plot:i});const M=new L(n.groups.marks);return O.forEach((B,I)=>{const V=b.get(B),fe=ie(V,H,ge),a=fe.reduce((j,U)=>Math.max(j,U.density),0)||1,x=s.bandwidth/2,R=s.of(B)+x,o=fe.map(j=>[E(R+j.density/a*x),E(F.of(j.at))]),l=fe.map(j=>[E(R-j.density/a*x),E(F.of(j.at))]),t=[];o.forEach(([j,U],J)=>t.push(J?"L":"M",j,U));for(let j=l.length-1;j>=0;j--)t.push("L",l[j][0],l[j][1]);t.push("Z"),c(M.next("path",`${y}__violin ${y}__mark`),{d:v(t),fill:e.series(I),"data-point":I});const h=le(V);h&&c(M.next("path",`${y}__median ${y}__mark`),{d:v(["M",E(R-x*.5),E(F.of(h.median)),"L",E(R+x*.5),E(F.of(h.median))]),stroke:e.series(I),"stroke-width":2,fill:"none"})}),M.finish(),{xScale:s,yScale:F,series:[{key:"",label:g.measure.title,index:0,points:O.map(B=>{const I=le(b.get(B));return{x:B,xKey:B,label:B,y:I?I.median:null,rows:(b.get(B)||[]).length}})}]}}}),tt("packages/modules/charts/gantt.js",function(r,oe){"use strict";Object.defineProperty(r,"readTasks",{enumerable:!0,get:function(){return v}}),Object.defineProperty(r,"drawGantt",{enumerable:!0,get:function(){return E}});const Ae=oe("packages/modules/charts/axis.js"),ae=Ae.drawAxisLines,$=Ae.drawBandLabels,ke=Ae.drawContinuousAxis,se=oe("packages/modules/charts/frame.js").Pool,Z=oe("packages/modules/charts/format.js").formatters,le=oe("packages/modules/charts/scale.js"),D=le.bandScale,d=le.timeScale,L=le.toTime,W=oe("packages/modules/charts/scheme.js").resolveScheme,G=oe("packages/modules/charts/svg.js"),A=G.attrs,p=G.round,f=G.setText,N=oe("packages/modules/charts/styles.js").NS,q=oe("packages/modules/charts/typography.js"),k=q.applySize,_=q.truncateTo,c=8;function v(m,y,P){const Q=[];let K=1/0,ge=-1/0;for(const re of P){const C=L(m.rows.value(re.key,y.start)),ee=L(m.rows.value(re.key,y.end));if(C===null||ee===null)continue;const z=y.label?m.rows.text(re.key,y.label):re.key,n=y.series?m.rows.value(re.key,y.series):null;Q.push({key:re.key,label:z,group:n,from:Math.min(C,ee),to:Math.max(C,ee)}),K=Math.min(K,C,ee),ge=Math.max(ge,C,ee)}return{tasks:Q,span:Q.length?{min:K,max:ge}:null}}function E(m){const y=m.scheme||W(),{plot:P}=m,{tasks:Q,span:K}=v(m.grid,m.spec,m.rows);if(!K)return{tasks:[],xScale:null,dropped:0};const ge=Math.max(1,Math.floor(P.height/c)),re=Q.slice(0,ge),C=Q.length-re.length,ee=d({min:K.min,max:K.max},[P.left,P.right]),z=D(re.map(b=>b.key),[P.top,P.bottom],.25),n=m.typography&&m.typography.small||m.fontSize;ke({group:m.groups.overlay,plot:P,scale:ee,format:Z(m.grid,{kind:"time",span:K.max-K.min}),config:m.axis&&m.axis.x||{},grid:m.grid,size:n}),$({group:m.groups.axis,plot:P,scale:z,labels:re.map(b=>b.label),fontSize:n}),ae({group:m.groups.rules,plot:P});const e=[...new Set(re.map(b=>String(b.group)))],i=new se(m.groups.marks);re.forEach((b,O)=>{const ne=z.of(b.key),H=ee.of(b.from),F=ee.of(b.to);A(i.next("rect",`${N}__task ${N}__mark`),{x:p(H),width:p(Math.max(2,F-H)),y:p(ne),height:p(z.bandwidth),fill:y.series(b.group===null?0:e.indexOf(String(b.group))),"data-point":O,"data-key":b.key}),b.px=p((H+F)/2),b.py=p(ne+z.bandwidth/2)}),i.finish();const g=new se(m.groups.labels);if(C>0){const b=g.next("text",`${N}__geo-note`);k(b,n),A(b,{x:p(P.left),y:p(P.bottom+n+4),"text-anchor":"start"}),f(b,_(m.grid.messages.t("chart.tasksDropped",{count:C}),P.width,n))}return g.finish(),{tasks:re,xScale:ee,dropped:C,series:[{key:"",label:m.spec.label||"",index:0,points:re.map(b=>({x:b.key,xKey:b.key,label:b.label,y:b.to-b.from,rows:1,rowKey:b.key,px:b.px,py:b.py}))}]}}}),tt("packages/modules/charts/tween.js",function(r,oe){"use strict";Object.defineProperty(r,"tween",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(r,"easeOutQuad",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(r,"frameLoop",{enumerable:!0,get:function(){return we}});function Ae(se,ie,Z){return se+(ie-se)*Z}function ae(se){return 1-(1-se)*(1-se)}const $=new WeakMap;let ke=null;function we(se){const ie=se&&typeof se.requestAnimationFrame=="function";if(ie&&$.has(se))return $.get(se);if(!ie&&ke)return ke;const Z=new Map;let le=0,D=null;const d=W=>{D=null;const G=[...Z.values()];Z.clear();for(const A of G)try{A(W)}catch(p){setTimeout(()=>{throw p},0)}},L=()=>{D===null&&(D=ie?se.requestAnimationFrame(d):setTimeout(()=>d(Date.now()),16))},T={request(W){return le+=1,Z.set(le,W),L(),le},cancel(W){Z.delete(W),!Z.size&&D!==null&&(ie&&typeof se.cancelAnimationFrame=="function"?se.cancelAnimationFrame(D):ie||clearTimeout(D),D=null)},get pending(){return Z.size}};return ie?$.set(se,T):ke=T,T}}),tt("packages/modules/charts/animate.js",function(r,oe){"use strict";Object.defineProperty(r,"EASINGS",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(r,"easingOf",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"motionBlocked",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"ANIMATION_DURATION",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"motionTokenMs",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(r,"ANIMATION_BUDGET",{enumerable:!0,get:function(){return le}}),Object.defineProperty(r,"resolveAnimation",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"parsePath",{enumerable:!0,get:function(){return w}}),Object.defineProperty(r,"keyedMarks",{enumerable:!0,get:function(){return q}}),Object.defineProperty(r,"MarkAnimator",{enumerable:!0,get:function(){return v}});const Ae=oe("packages/modules/charts/tween.js"),ae=Ae.frameLoop,$=Ae.tween,ke=Object.freeze({linear:E=>E,"ease-in":E=>E*E*E,"ease-out":E=>1-(1-E)**3,"ease-in-out":E=>E<.5?4*E*E*E:1-(-2*E+2)**3/2});function we(E){return typeof E=="function"?m=>{if(m<=0)return 0;if(m>=1)return 1;const y=Number(E(m));return Number.isFinite(y)?y:m}:typeof E=="string"&&Object.prototype.hasOwnProperty.call(ke,E)?ke[E]:null}function se(E){if(!E||typeof E.requestAnimationFrame!="function")return"no-window";try{const m=E.navigator;if(m&&m.webdriver===!0||m&&/\bjsdom\b|happydom|happy-dom/i.test(String(m.userAgent||"")))return"automation";if(typeof E.matchMedia=="function"){const y=E.matchMedia("(prefers-reduced-motion: reduce)");if(y&&y.matches)return"reduced-motion"}}catch{return null}return null}const ie=400;function Z(E,m){try{if(!E||!m||typeof m.getComputedStyle!="function")return null;const y=String(m.getComputedStyle(E).getPropertyValue("--lattice-motion-duration")||"").trim(),P=/^(\d*\.?\d+)\s*(ms|s)?$/i.exec(y);if(!P)return null;const Q=Number(P[1])*(String(P[2]||"ms").toLowerCase()==="s"?1e3:1);return Number.isFinite(Q)?Q:null}catch{return null}}const le=2e3,D=["grid","marks","rules","axis","labels","overlay"],d=Object.freeze({rect:["x","y","width","height"],circle:["cx","cy","r"],line:["x1","y1","x2","y2"],text:["x","y"]}),L="data-anim-leaving";let T=0;function W(E,m=null){const y={on:!0,duration:ie,easing:ke["ease-out"],entry:!0,update:!0,budget:le,problems:[]};if(m===0&&(y.on=!1),E==null||E===!0)return y;if(E===!1)return y.on=!1,y;if(typeof E!="object")return y.problems.push(`animation must be true, false or an object; got ${JSON.stringify(E)}`),y;const P=E;if(P.duration!==void 0){const Q=Number(P.duration);Number.isFinite(Q)&&Q>=0?y.duration=Q:y.problems.push(`animation.duration must be a number of milliseconds, 0 or more; got ${JSON.stringify(P.duration)}`)}if(P.easing!==void 0){const Q=we(P.easing);Q?y.easing=Q:y.problems.push(`animation.easing must be one of ${Object.keys(ke).join(", ")} or a function; got ${JSON.stringify(P.easing)}`)}for(const Q of["entry","update"])P[Q]!==void 0&&(typeof P[Q]=="boolean"?y[Q]=P[Q]:y.problems.push(`animation.${Q} must be true or false; got ${JSON.stringify(P[Q])}`));if(P.budget!==void 0){const Q=Number(P.budget);Number.isFinite(Q)&&Q>=0?y.budget=Q:y.problems.push(`animation.budget must be a number of marks, 0 or more; got ${JSON.stringify(P.budget)}`)}return y.on=y.duration!==0,y}function G(E){return String(E.tagName||"").toLowerCase()}function A(E){return String(E.getAttribute("class")||"").split(/\s+/)[0]||""}function p(E,m){const y=Number.parseFloat(E.getAttribute(m));return Number.isFinite(y)?y:0}function f(E,m,y){E.setAttribute(m,String(Math.round(y*100)/100))}function w(E){const m=[],y=[];let P="",Q="",K=0;const ge=/([MmLlHhVvCcSsQqTtAaZz])|(-?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?)/g;let re;for(;(re=ge.exec(String(E||"")))!==null;)re[1]?(Q=re[1],K=0,m.push(Q),P+=Q):((Q==="A"||Q==="a")&&(K%7===3||K%7===4)&&y.push(m.length),m.push(Number(re[2])),P+="#",K+=1);return{tokens:m,skeleton:P,flags:y}}function N(E){return E.map(m=>typeof m=="number"?String(Math.round(m*100)/100):m).join(" ")}function q(E,m){const y=[],P=new Map,Q=new Map;for(const K of["axis","rules"]){const ge=E[K];if(ge)for(const re of ge.childNodes||[]){if(!re.getAttribute||G(re)!=="text")continue;const C=String(re.textContent||"");C&&(Q.set(`y${Math.round(p(re,"y"))}`,C),Q.set(`x${Math.round(p(re,"x"))}`,C))}}for(const K of D){const ge=E[K];if(ge)for(const re of ge.childNodes||[]){if(!re.getAttribute||re.getAttribute(L)!==null)continue;const C=G(re);if(!C||C==="g"||C==="defs"||C==="clippath"||K==="overlay"&&C!=="text")continue;const ee=`${K}|${C}|${A(re)}`;let z=re.getAttribute("data-pool-key");if(z!==null)z=`k:${z}`;else if(m&&m.ident){const i=m.ident(re);i!=null&&(z=`i:${i}`)}if(z===null&&C==="text"&&(z=`t:${re.textContent||""}`),z===null&&C==="line"&&K==="grid"){const i=p(re,"y1")===p(re,"y2"),g=i?Q.get(`y${Math.round(p(re,"y1"))}`):Q.get(`x${Math.round(p(re,"x1"))}`);g!==void 0&&(z=`g:${i?"h":"v"}:${g}`)}const n=`${ee}|${z===null?"#":z}`,e=P.get(n)||0;P.set(n,e+1),y.push({key:e?`${n}~${e}`:n,el:re,group:K})}}return y}function k(E){const m=E.attributes;if(!m)return[];if(m instanceof Map)return[...m.entries()].map(([P,Q])=>[P,String(Q)]);const y=[];for(let P=0;P<m.length;P++)y.push([m[P].name,m[P].value]);return y}function _(E){if(typeof E.cloneNode=="function")return E.cloneNode(!0);const y=E.ownerDocument.createElementNS("http://www.w3.org/2000/svg",G(E));for(const[P,Q]of k(E))y.setAttribute(P,Q);return G(E)==="text"&&(y.textContent=E.textContent),y}function c(E,m,y){const P=G(E),Q=E.getAttribute("opacity"),K=Q===null?1:Number.isFinite(Number(Q))?Number(Q):1,ge=y&&y.get(E)||(m&&m.arc?m.arc(E):null);return ge?{kind:"arc",values:null,path:null,arc:{...ge},opacity:K}:d[P]?{kind:P,values:d[P].map(re=>p(E,re)),path:null,arc:null,opacity:K}:P==="path"?{kind:"path",values:null,path:w(E.getAttribute("d")),arc:null,opacity:K}:{kind:"other",values:null,path:null,arc:null,opacity:K}}class v{#r;#n=null;#i=null;#t=null;#s=null;constructor(m={}){this.#r=m.view||null,m.loop&&(this.#n=m.loop)}get running(){return!!this.#i}get remaining(){const m=this.#i;return m?m.start===null?m.duration:Math.max(0,m.duration-(m.last-m.start)):0}#l(){return this.#n||(this.#n=ae(this.#r)),this.#n}halt(){const m=this.#i;if(m){this.#i=null,m.frame!==null&&(this.#l().cancel(m.frame),m.frame=null);for(const y of m.ghosts)y.el.parentNode&&y.el.parentNode.removeChild(y.el);this.#o(m);for(const y of m.records)for(const[P,Q]of y.temporary)Q===null?y.el.removeAttribute(P):y.el.setAttribute(P,Q);this.#t=m}}capture(m,y){const P=this.#i?this.#i.arcsNow:null;this.halt();const Q=new Map;for(const{key:K,el:ge,group:re}of q(m,y)){const C=c(ge,y,P),ee=ge.getAttribute("data-pool-key")!==null;Q.set(K,{...C,el:ge,group:re,copy:ee?null:_(ge)})}return Q}settle(){const m=this.#t;if(this.#t=null,!!m)for(const y of m.records)this.#a(y)}release(){this.#t=null}finish(){const m=this.#i;if(this.#t=null,!!m){this.#i=null,m.frame!==null&&(this.#l().cancel(m.frame),m.frame=null);for(const y of m.ghosts)y.el.parentNode&&y.el.parentNode.removeChild(y.el);this.#o(m);for(const y of m.records)this.#a(y)}}#o(m){m.reveal&&(m.reveal.parentNode&&m.reveal.parentNode.removeChild(m.reveal),this.#s===m.reveal&&(this.#s=null),m.reveal=null)}#a(m){for(const[y,P]of m.final)P===null?m.el.removeAttribute(y):m.el.setAttribute(y,P)}play(m){this.#t=null,this.finish();const{groups:y,before:P,describe:Q,settings:K,layout:ge}=m,re=y.marks&&y.marks.childNodes?y.marks.childNodes.length:0;if(re>K.budget)return{animated:!1,reason:"budget",marks:re};const C=q(y,Q),ee=[],z=[],n=new Map,e=new Set,i=m.mode==="entry";let g=!1;for(const{key:ne,el:H}of C){const F=c(H,Q,null),s=P&&!i?P.get(ne):void 0;if(s&&e.add(ne),s&&s.kind===F.kind){const B=this.#p(H,s,F);B&&ee.push(B);continue}if(s)continue;const M=this.#O(H,F,i,Q,ge);M&&(M.reveal&&(g=!0),ee.push(M))}if(!i&&P)for(const[ne,H]of P){if(e.has(ne))continue;const F=this.#v(y,H,ge);F&&z.push(F)}if(!ee.length&&!z.length)return{animated:!1,reason:"unchanged",marks:re};let b=null;if(g&&ge.defs&&ge.plot){b=this.#M(ge.defs,ge);for(const ne of ee)ne.reveal&&(ne.temporary.push(["clip-path",ne.el.getAttribute("clip-path")]),ne.final.push(["clip-path",ne.el.getAttribute("clip-path")]),ne.el.setAttribute("clip-path",`url(#${b.getAttribute("id")})`))}const O={records:ee,ghosts:z,arcsNow:n,reveal:b,layout:ge,duration:K.duration,easing:K.easing,start:null,last:null,frame:null};return this.#i=O,this.#f(O,0),O.frame=this.#l().request(ne=>this.#m(O,ne)),{animated:!0,reason:i?"entry":"update",marks:re}}#m(m,y){if(this.#i!==m)return;m.frame=null,m.start===null&&(m.start=y),m.last=y;const P=m.duration>0?Math.min(1,(y-m.start)/m.duration):1;if(P>=1){this.finish();return}this.#f(m,m.easing(P)),m.frame=this.#l().request(Q=>this.#m(m,Q))}#f(m,y){for(const P of m.records)P.paint(y);for(const P of m.ghosts)P.paint(y);if(m.reveal&&m.layout.plot){const P=m.reveal.firstChild,Q=m.layout.plot;f(P,"width",Math.max(0,(Q.width+16)*y))}}#M(m,y){if(!this.#s||this.#s.parentNode!==m){const Q=m.ownerDocument,K=Q.createElementNS("http://www.w3.org/2000/svg","clipPath");T+=1,K.setAttribute("id",`lattice-chart-reveal-${T}`),K.appendChild(Q.createElementNS("http://www.w3.org/2000/svg","rect")),m.appendChild(K),this.#s=K}const P=this.#s.firstChild;return f(P,"x",y.plot.left-8),P.setAttribute("y","0"),f(P,"height",Math.max(0,y.height||0)),P.setAttribute("width","0"),this.#s}#p(m,y,P){if(P.kind==="arc")return this.#k(m,y.arc,P.arc);if(P.kind==="path"){const K=y.path,ge=P.path;if(!K||!ge||K.skeleton!==ge.skeleton||K.tokens.length!==ge.tokens.length||ge.flags.some(ee=>K.tokens[ee]!==ge.tokens[ee])||K.tokens.every((ee,z)=>ee===ge.tokens[z]))return null;const re=[["d",m.getAttribute("d")]],C=ge.tokens.slice();return{el:m,final:re,temporary:[],paint:ee=>{for(let z=0;z<C.length;z++)typeof ge.tokens[z]=="number"&&(C[z]=$(K.tokens[z],ge.tokens[z],ee));m.setAttribute("d",N(C))}}}const Q=d[P.kind];return!Q||y.values.every((K,ge)=>K===P.values[ge])?null:this.#c(m,Q,y.values,P.values,null)}#c(m,y,P,Q,K){const ge=y.map(C=>[C,m.getAttribute(C)]),re=[];return K&&(ge.push(["opacity",m.getAttribute("opacity")]),re.push(["opacity",m.getAttribute("opacity")])),{el:m,final:ge,temporary:re,paint:C=>{for(let ee=0;ee<y.length;ee++)f(m,y[ee],$(P[ee],Q[ee],C));K&&f(m,"opacity",$(K.from,K.to,C))}}}#k(m,y,P){if(!y||!P||typeof P.draw!="function")return null;const Q=["cx","cy","inner","outer","from","to"];if(Q.every(re=>y[re]===P[re]))return null;const K=[["d",m.getAttribute("d")]],ge=()=>this.#i;return{el:m,final:K,temporary:[],paint:re=>{const C={};for(const z of Q)C[z]=$(y[z],P[z],re);const ee=ge();ee&&ee.arcsNow.set(m,{...C,draw:P.draw}),m.setAttribute("d",P.draw(C))}}}#O(m,y,P,Q,K){const ge=String(m.getAttribute("class")||"");if(y.kind==="arc"){const C=P&&Number.isFinite(Q.sweepStart)?Q.sweepStart:y.arc.from;return this.#k(m,{...y.arc,from:C,to:C},y.arc)}if(y.kind==="rect"&&/__bar\b/.test(ge)){const[C,ee,z,n]=y.values;if(K.horizontal){const i=Number.isFinite(K.base)?K.base:C;return this.#c(m,d.rect,[i,ee,0,n],y.values,null)}const e=Number.isFinite(K.base)?K.base:ee+n;return this.#c(m,d.rect,[C,e,z,0],y.values,null)}if(y.kind==="circle"){const[C,ee]=y.values;return this.#c(m,d.circle,[C,ee,0],y.values,{from:0,to:y.opacity})}if(y.kind==="line"){const[C,ee]=y.values;return this.#c(m,d.line,[C,ee,C,ee],y.values,null)}return y.kind==="path"&&P&&/__(line|area)\b/.test(ge)?{el:m,final:[],temporary:[],reveal:!0,paint:()=>{}}:this.#c(m,[],[],[],{from:0,to:y.opacity})}#v(m,y,P){const Q=m[y.group];if(!Q)return null;const K=y.copy||(y.el.parentNode?null:y.el);if(!K)return null;K.setAttribute(L,""),K.setAttribute("data-decor","true"),K.setAttribute("aria-hidden","true"),K.setAttribute("pointer-events","none");for(const C of["tabindex","role","aria-label","aria-roledescription","id","data-pool-key","data-series","data-point","data-arc"])K.removeAttribute(C);K.setAttribute("class",String(K.getAttribute("class")||"").replace(/\s*\S+__mark\b/g,"").trim()),Q.appendChild(K);const ge=String(K.getAttribute("class")||"");let re;if(y.kind==="arc"&&y.arc&&typeof y.arc.draw=="function"){const C=(y.arc.from+y.arc.to)/2;re=ee=>{K.setAttribute("d",y.arc.draw({...y.arc,from:$(y.arc.from,C,ee),to:$(y.arc.to,C,ee)}))}}else if(y.kind==="rect"&&/__bar\b/.test(ge)){const[C,ee,z,n]=y.values,e=P.horizontal?[Number.isFinite(P.base)?P.base:C,ee,0,n]:[C,Number.isFinite(P.base)?P.base:ee+n,z,0];re=i=>{for(let g=0;g<4;g++)f(K,d.rect[g],$(y.values[g],e[g],i))}}else y.kind==="circle"?re=C=>{f(K,"r",$(y.values[2],0,C))}:re=C=>{f(K,"opacity",$(y.opacity,0,C))};return{el:K,paint:re}}}}),tt("packages/modules/charts/interaction.js",function(r,oe){"use strict";Object.defineProperty(r,"resolveBrush",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(r,"brushed",{enumerable:!0,get:function(){return we}}),Object.defineProperty(r,"brushCondition",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"attachBrush",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(r,"applySelection",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(r,"attachKeyboard",{enumerable:!0,get:function(){return le}});const ae=oe("packages/modules/charts/svg.js").attrs,$=4;function ke(D){const d=D&&D.brush;if(d===!0)return{mode:"filter",axis:"x"};if(d==="filter"||d==="zoom"||d==="select")return{mode:d,axis:"x"};if(d&&typeof d=="object"&&d.mode){const L=["filter","zoom","select"].includes(d.mode)?d.mode:null,T=d.axis==="y"||d.axis==="y2"?d.axis:"x";return{mode:L,axis:T}}return{mode:null,axis:"x"}}function we(D){const{bound:d,xScale:L}=D,T=Math.min(D.from,D.to),W=Math.max(D.from,D.to);if(D.axis==="y"||D.axis==="y2"){const p=D.axis==="y2"&&D.rightScale?D.rightScale:D.yScale||L;if(!p||typeof p.invert!="function")return{kind:"range",values:[],range:null,axis:D.axis};const f=p.invert(T),w=p.invert(W);return{kind:"range",values:[],range:[f,w],axis:D.axis}}if(L.kind==="band"){const p=[];for(const f of d.categories){const w=L.centre(f);!Number.isNaN(w)&&w>=T&&w<=W&&p.push(f)}return{kind:"set",values:p,range:null,axis:"x"}}const G=L.invert(T),A=L.invert(W);return{kind:"range",values:[],range:[G,A],axis:"x"}}function se(D){const{column:d,result:L}=D;if(!d)return null;if(L.kind==="set")return L.values.length?{col:d,op:"in",value:L.values.slice()}:null;if(!L.range)return null;const[T,W]=L.range;if(!Number.isFinite(T)||!Number.isFinite(W))return null;const G=D.kind==="time"?[new Date(Math.min(T,W)),new Date(Math.max(T,W))]:[Math.min(T,W),Math.max(T,W)];return{col:d,op:"between",value:G,bounds:"[]"}}function ie(D){let d=null,L=null;const T=()=>{const p=typeof D.axis=="function"?D.axis():"x",f=p==="y"||p==="y2";return(typeof D.horizontal=="function"?D.horizontal():!1)!==f},W=p=>{if(!D.enabled())return;const f=D.pointOf(p);d=T()?f.y:f.x,L=D.svg.ownerDocument.createElementNS("http://www.w3.org/2000/svg","rect"),L.setAttribute("class","lat-chartview__brush"),D.overlay.appendChild(L)},G=p=>{if(d===null||!L)return;const f=D.plot();if(T()){const k=D.pointOf(p).y,_=Math.max(f.top,Math.min(d,k)),c=Math.min(f.bottom,Math.max(d,k));ae(L,{x:f.left,y:_,width:Math.max(0,f.right-f.left),height:Math.max(0,c-_)});return}const w=D.pointOf(p).x,N=Math.max(f.left,Math.min(d,w)),q=Math.min(f.right,Math.max(d,w));ae(L,{x:N,y:f.top,width:Math.max(0,q-N),height:f.height})},A=p=>{if(d===null)return;const f=D.pointOf(p),w=T()?f.y:f.x,N=Math.abs(w-d),q=d;d=null,L&&L.parentNode&&L.parentNode.removeChild(L),L=null,N>=$&&D.onBrush(q,w)};return D.svg.addEventListener("pointerdown",W),D.svg.addEventListener("pointermove",G),D.svg.addEventListener("pointerup",A),D.svg.addEventListener("pointerleave",A),()=>{D.svg.removeEventListener("pointerdown",W),D.svg.removeEventListener("pointermove",G),D.svg.removeEventListener("pointerup",A),D.svg.removeEventListener("pointerleave",A)}}function Z(D){const d=D.groups.marks,L=D.keys.size>0||D.categories.size>0;let T=0;for(const W of d.childNodes||[]){if(!W.getAttribute)continue;const G=Number(W.getAttribute("data-series")),A=Number(W.getAttribute("data-point")),p=D.series[G],f=p&&p.points[A],w=!!f&&(f.rowKey&&D.keys.has(f.rowKey)||f.xKey!==void 0&&D.categories.has(f.xKey));w&&T++,L&&!w?W.setAttribute("data-dim","true"):W.removeAttribute("data-dim")}return T}function le(D){let d=0;const L=W=>{const G=D.marks();if(G.length){d=Math.max(0,Math.min(G.length-1,W));for(let A=0;A<G.length;A++)G[A].setAttribute("tabindex",A===d?"0":"-1");G[d].focus&&G[d].focus(),D.onFocus(d)}},T=W=>{if(typeof D.intercept=="function"&&D.intercept(W))return;const G=D.marks();if(G.length){if(typeof D.within=="function"&&D.within(W,d)){W.preventDefault&&W.preventDefault();return}switch(W.key){case"ArrowRight":case"ArrowDown":L(d+1);break;case"ArrowLeft":case"ArrowUp":L(d-1);break;case"Home":L(0);break;case"End":L(G.length-1);break;case"Enter":case" ":D.onActivate(d);break;default:return}W.preventDefault&&W.preventDefault()}};return D.svg.addEventListener("keydown",T),()=>D.svg.removeEventListener("keydown",T)}}),tt("packages/modules/charts/range.js",function(r,oe){"use strict";Object.defineProperty(r,"deriveRangeSpec",{enumerable:!0,get:function(){return we}});const Ae=new Set(["number","currency","percent","integer"]);function ae(se){return!!se&&typeof se.type=="string"&&Ae.has(se.type)}function $(se){const ie=se&&se.selection&&typeof se.selection.ranges=="function"?se.selection.ranges():[];return!Array.isArray(ie)||!ie.length?null:ie[ie.length-1]}function ke(se,ie){const Z=[],le=Math.min(ie.startRow,ie.endRow),D=Math.max(ie.startRow,ie.endRow);for(let d=le;d<=D;d++){const L=se.rows.get(d);L&&!L.group&&L.data!==null&&L.data!==void 0&&Z.push(L)}return Z}function we(se,ie={}){const Z=_=>({spec:null,type:null,x:null,measures:[],columns:[],reason:_}),le=ie.range||$(se);if(!le)return Z("no-range");const D=se.columns.visible(),d=new Set(D.map(_=>_.id)),L=(le.columns||[]).filter(_=>d.has(_));if(!L.length)return Z("no-visible-columns");const T=L.map(_=>({id:_,column:se.columns.get(_)})),W=T.filter(_=>ae(_.column)).map(_=>_.id),G=T.filter(_=>!ae(_.column)).map(_=>_.id);if(!W.length)return Z("no-measure");const A=G.length?G[0]:null,p=W,w={rows:ke(se,le)},N=new Set(["bar","line","area"]);if(p.length>1){const _=ie.type,c=N.has(_)?_:null,v=_&&!N.has(_)?_:"combo";return{spec:{...w,type:v,x:A,measures:p.map(m=>c?{col:m,type:c}:{col:m})},type:v,x:A,measures:p,columns:L,reason:null}}const q=ie.type||"bar";return{spec:{...w,type:q,x:A,y:p[0]},type:q,x:A,measures:p,columns:L,reason:null}}}),tt("packages/modules/charts/regression.js",function(r,oe){"use strict";Object.defineProperty(r,"regressionPlots",{enumerable:!0,get:function(){return we}});const Ae=new Set(["number","currency","percent","integer"]);function ae(se,ie={}){return{spec:se,reason:null,...ie}}function $(se,ie={}){return{spec:null,reason:se,...ie}}function ke(se){if(!se||!Array.isArray(se.fitted)||!Array.isArray(se.residuals)||!Array.isArray(se.leverage)||!(se.sigma2>0))return null;const ie=Math.sqrt(se.sigma2),Z=[];for(let le=0;le<se.fitted.length;le++){const D=se.leverage[le];if(!Number.isFinite(D)||D>=1)continue;const d=ie*Math.sqrt(1-D);if(!(d>0))continue;const L=se.residuals[le]/d;Z.push({x:se.fitted[le],y:Math.sqrt(Math.abs(L)),key:String(le)})}return Z}function we(se,ie={}){const Z=ie.model||(se&&se.statistics&&typeof se.statistics.regressionModel=="function"?se.statistics.regressionModel(ie.spec||{}):null),le=P=>({fit:$(P),residualsFitted:$(P),qq:$(P),multicollinearity:$(P),scaleLocation:$(P),residualsLeverage:$(P),coefficientForest:$(P)});if(!Z||!Array.isArray(Z.predictors)||!Z.predictors.length||!Z.response)return{model:null,plots:le("no-model")};const D=Z.predictors,d=Z.response,L=ie.rows,T=()=>L===void 0?{}:{rows:L},W=ie.fitted||null,G=ie.residual||null,A=ie.stdResidual||null,p=ie.leverage||null,f=ie.cooksD||null,w=D.length===1?ae({type:"scatter",x:D[0],y:d,fit:!0,band:Z.band||null,...T()}):$("multiple-predictors"),N=W&&G?ae({type:"scatter",x:W,y:G,reference:[{value:0}],...T()}):$("needs-fitted-and-residual-columns"),q=G?ae({type:"qq",y:G,...T()}):$("needs-residual-column"),k=D.filter(P=>{const Q=se&&se.columns&&typeof se.columns.get=="function"?se.columns.get(P):null;return!Q||typeof Q.type=="string"&&Ae.has(Q.type)}),_=D.length>=2?ae({type:"correlogram",columns:k},{vif:Z.vif||null}):$("single-predictor",{vif:Z.vif||null}),c=p&&A?ae({type:f?"bubble":"scatter",x:p,y:A,...f?{size:f}:{},reference:[{value:0}],...T()}):$("needs-leverage-and-standardised-residual-columns"),v=ke(Z),E=v&&v.length?ae({type:"scatter",points:v,fit:!0,dimensionTitle:"Fitted",measureTitle:"√|standardised residual|"}):$("needs-fitted-model"),m=Array.isArray(Z.coefficients)?Z.coefficients.filter(P=>P&&Number.isFinite(P.estimate)&&Number.isFinite(P.lower)&&Number.isFinite(P.upper)).map(P=>({x:P.estimate,label:P.name,lower:P.lower,upper:P.upper})):[],y=m.length?ae({type:"forest",points:m,dimensionTitle:"Coefficient",measureTitle:"Estimate"},{coefficients:Z.coefficients||null}):$("needs-coefficient-intervals",{coefficients:Z.coefficients||null});return{model:Z,plots:{fit:w,residualsFitted:N,qq:q,multicollinearity:_,scaleLocation:E,residualsLeverage:c,coefficientForest:y}}}}),tt("packages/modules/charts/registry.js",function(r,oe){"use strict";Object.defineProperty(r,"registerChartType",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(r,"chartTypeDef",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"registeredChartTypes",{enumerable:!0,get:function(){return ke}});const Ae=new Map;function ae(we,se){if(typeof we!="string"||!we)throw new TypeError("[lattice] registerChartType needs a non-empty type name.");if(!se||typeof se.draw!="function")throw new TypeError(`[lattice] registerChartType('${we}') needs a { draw } function.`);Ae.set(we,se)}function $(we){return Ae.get(we)||null}function ke(){return[...Ae.keys()]}}),tt("packages/modules/charts/responsive.js",function(r,oe){"use strict";Object.defineProperty(r,"HYSTERESIS",{enumerable:!0,get:function(){return $}}),Object.defineProperty(r,"mergeOptions",{enumerable:!0,get:function(){return se}}),Object.defineProperty(r,"AUTO_RULES",{enumerable:!0,get:function(){return D}}),Object.defineProperty(r,"resolveRules",{enumerable:!0,get:function(){return d}}),Object.defineProperty(r,"ruleMatches",{enumerable:!0,get:function(){return L}}),Object.defineProperty(r,"matchRules",{enumerable:!0,get:function(){return T}}),Object.defineProperty(r,"applyRules",{enumerable:!0,get:function(){return W}}),Object.defineProperty(r,"describeActive",{enumerable:!0,get:function(){return G}});const ae=oe("packages/core/src/internal/util.js").warnOnce,$=4,ke=["maxWidth","minWidth","maxHeight","minHeight"];function we(A){return!!A&&typeof A=="object"&&!Array.isArray(A)&&Object.getPrototypeOf(A)===Object.prototype}function se(A,p){if(!we(A)||!we(p))return we(p)?se({},p):p;const f={...A};for(const w of Object.keys(p))f[w]=se(A[w],p[w]);return f}const ie=3;function Z(A){const p={};if(A.legend!==!1&&(p.legend={position:"bottom"}),A.axis!==!1){const f=w=>{const N=we(A.axis)?A.axis[w]:void 0;return we(N)&&Array.isArray(N.ticks)?{title:""}:{title:"",ticks:ie}};p.axis={x:{title:""},y:f("y"),y2:f("y2")}}return p}function le(){return{legend:!1}}const D=Object.freeze([Object.freeze({auto:!0,maxWidth:399,set:Z}),Object.freeze({auto:!0,maxWidth:249,set:le})]);function d(A){if(A==null||A===!1)return[];const p=A==="auto"||A===!0?["auto"]:A;if(!Array.isArray(p))return ae("chart:responsive-option","the chart option `responsive` takes 'auto' or an array of rules ({ maxWidth?, minWidth?, maxHeight?, minHeight?, set }); it was ignored."),[];const f=[];for(const w of p){if(w==="auto"){f.push(...D);continue}if(!(we(w)&&(we(w.set)||typeof w.set=="function")&&ke.every(q=>w[q]===void 0||Number.isFinite(w[q])))){ae("chart:responsive-rule","a chart `responsive` rule was ignored: each rule needs a `set` object and, optionally, numeric maxWidth / minWidth / maxHeight / minHeight.");continue}f.push(w)}return f}function L(A,p,f){const w=f?$:0;return!(A.maxWidth!==void 0&&!(p.width<=A.maxWidth+w)||A.minWidth!==void 0&&!(p.width>=A.minWidth-w)||A.maxHeight!==void 0&&!(p.height<=A.maxHeight+w)||A.minHeight!==void 0&&!(p.height>=A.minHeight-w))}function T(A,p,f){const w=new Set(f),N=[];return A.forEach((q,k)=>{L(q,p,w.has(k))&&N.push(k)}),N}function W(A,p,f){if(!f.length)return A;let w=A;for(const N of f){const q=p[N],k=typeof q.set=="function"?q.set(w):q.set;if(!we(k))continue;const{responsive:_,...c}=k;w=se(w,c)}return w}function G(A,p){return p.map(f=>{const w=A[f],N={index:f,auto:!!w.auto};for(const q of ke)w[q]!==void 0&&(N[q]=w[q]);return N})}}),tt("packages/modules/charts/index.js",function(r,oe){"use strict";Object.defineProperty(r,"TYPES",{enumerable:!0,get:function(){return tr}}),Object.defineProperty(r,"Chart",{enumerable:!0,get:function(){return ro}}),Object.defineProperty(r,"createChart",{enumerable:!0,get:function(){return oo}}),Object.defineProperty(r,"deriveRangeSpec",{enumerable:!0,get:function(){return Pr}}),Object.defineProperty(r,"regressionPlots",{enumerable:!0,get:function(){return jo}}),Object.defineProperty(r,"chartRange",{enumerable:!0,get:function(){return Ns}}),Object.defineProperty(r,"canChartRange",{enumerable:!0,get:function(){return js}});const Ae=oe("packages/modules/charts/cartesian.js"),ae=Ae.aheadOfWindow,$=Ae.axisWindowNow,ke=Ae.axisWindowSpan,we=Ae.bandedX,se=Ae.CARTESIAN,ie=Ae.drawCartesian,Z=Ae.drawForest,le=Ae.nearestCategory,D=Ae.nearestDrawnPoint,d=Ae.WINDOW_LEAD,L=Ae.windowedBound,T=Ae.withWaterfallTotal,W=Ae.xDomainFor,A=oe("packages/modules/charts/drawable.js").drawability,p=oe("packages/modules/charts/axis.js"),f=p.createGroups,w=p.drawAxisTitle,N=p.normaliseAxes,q=p.setPlotClip,k=p.tickLabeller,_=oe("packages/modules/charts/bind.js"),c=_.bindHierarchy,v=_.bindLinks,E=_.bindMeasures,m=_.bindPoints,y=_.bindSeries,P=_.leafRows,K=oe("packages/modules/shared/engine.js").EngineFlight,ge=oe("packages/modules/charts/mapview.js"),re=ge.capClientBound,C=ge.engineRowsReader,ee=ge.frameMoved,z=ge.frameOf,n=ge.MAP_ENGINE_TYPES,e=ge.needsRefit,i=ge.planMapViewport,g=ge.ringsBox,b=ge.viewportCap,ne=oe("packages/modules/charts/mapdensity.js").drawDensityCells,H=oe("packages/modules/charts/engine.js"),F=H.boundFromGroups,s=H.holdsWindow,M=H.measureProvenance,B=H.planAggregate,I=H.specMeasures,V=oe("packages/modules/charts/frame.js"),fe=V.Pool,a=V.plotRect,x=oe("packages/modules/charts/scale.js"),R=x.key,o=x.measureDomain,l=x.sqrtScale,t=oe("packages/modules/charts/format.js"),h=t.measureFormat,j=t.measureText,U=oe("packages/modules/charts/radial.js"),J=U.arcAt,X=U.arcPath,de=U.drawRadial,pe=oe("packages/modules/charts/distribution.js"),xe=pe.drawBoxPlot,ve=pe.drawCapability,Oe=pe.drawControl,Pe=pe.drawEcdf,te=pe.drawHistogram,Se=pe.drawLorenz,ye=pe.drawMovingRange,be=pe.drawQQ,je=oe("packages/modules/charts/treemap.js").drawTreemap,Ce=oe("packages/modules/charts/annotate-layer.js").ChartAnnotations,Fe=oe("packages/modules/charts/annotate-items.js"),We=Fe.itemsFromState,wt=Fe.resolveAnnotate,lt=Fe.serialiseItem,st=oe("packages/modules/charts/zoom-view.js"),Qe=st.bandRange,rt=st.magnify,pt=st.resolveZoom,Ht=st.sameView,kt=st.settleView,Gt=st.slice,Vt=st.slide,Ye=st.viewOfRange,et=st.ZOOM_CONTROLS,ut=oe("packages/modules/charts/zoom-toolbar.js").buildZoomToolbar,Ue=oe("packages/modules/charts/zoom-follow.js"),ft=Ue.BRUSH_OWNER,yt=Ue.CLICK_OWNER,Ct=Ue.conditionRange,ot=Ue.findOwned,dt=Ue.followCondition,it=Ue.FOLLOW_Y_TYPES,bt=Ue.leafPrint,Jt=Ue.localWall,en=Ue.mergeOwned,Mt=Ue.ownedLeaves,Lt=Ue.pruneOwned,zt=Ue.sliceKeys,Yt=Ue.unionExtent,xn=oe("packages/modules/charts/hit.js"),pn=xn.hnodeHit,an=xn.ownsGeometry,wn=xn.resolveHit,on=oe("packages/modules/charts/hnodes.js"),Yn=on.emphasiseChord,At=on.emphasiseHierarchy,nn=on.emphasiseLayout,Bn=oe("packages/modules/charts/drag-edit.js").DragEditor,yr=oe("packages/modules/charts/combo.js").drawCombo,nr=oe("packages/modules/charts/floating.js"),he=nr.bindFloating,Le=nr.drawFloating,$e=oe("packages/modules/charts/pyramid.js"),_e=$e.bindPyramid,Re=$e.drawPyramid,Ie=oe("packages/modules/charts/bullet.js"),De=Ie.bindBullet,Xe=Ie.drawBullet,Ge=oe("packages/modules/charts/polar.js"),He=Ge.drawGauge,qe=Ge.drawRadar,Je=oe("packages/modules/charts/matrix.js"),St=Je.clearVolumePane,xt=Je.drawCandlestick,Ot=Je.drawCorrelogram,Nt=Je.drawFunnel,$t=Je.drawHeatmap,Ft=Je.title,Bt=Je.VOLUME_PANE_HEIGHT,tn=oe("packages/modules/charts/multiples.js"),Zt=tn.panelRects,Xt=tn.splitPanels,It=oe("packages/modules/charts/geo.js"),qt=It.basemapStyleOf,rn=It.checkGeometrySpec,rr=It.drawGeomap,$n=It.geoRamp,vn=It.GEOMETRY_TYPES_PLACED,br=It.packRegions,On=It.projectedPath,yn=It.referenceRegions,Wt=It.resolvePack,Tn=oe("packages/modules/charts/projection.js"),wr=Tn.fitted,Nn=Tn.resolveProjection,kn=Tn.splitAntimeridian,bn=oe("packages/modules/charts/viewport-filter.js"),Zn=bn.adoptedGeoView,Gn=bn.conditionBbox,Jn=bn.mergeViewportCondition,or=bn.pruneTarget,Mn=bn.resolveViewportFilter,Kn=bn.sameBbox,En=bn.viewportBbox,Xn=bn.viewportCondition,sr=bn.viewportTarget,ir=oe("packages/modules/charts/globe.js"),Un=ir.HEMISPHERE_METRES,Hn=ir.meanDirection,Cn=oe("packages/modules/charts/flow.js"),ar=Cn.drawChord,Wn=Cn.drawSankey,Qn=oe("packages/modules/charts/network.js"),Ln=Qn.drawNetwork,lr=Qn.emphasiseNetwork,_n=oe("packages/modules/charts/stream.js"),kr=_n.drawMarimekko,vt=_n.drawStream,Rt=_n.drawViolin,ln=oe("packages/modules/charts/gantt.js").drawGantt,hn=oe("packages/modules/charts/animate.js"),xr=hn.ANIMATION_BUDGET,cr=hn.MarkAnimator,vr=hn.motionBlocked,ur=hn.motionTokenMs,co=hn.resolveAnimation,Rr=oe("packages/modules/charts/tween.js"),uo=Rr.frameLoop,fo=Rr.tween,jn=oe("packages/modules/charts/svg.js"),Rn=jn.attrs,zn=jn.append,Fn=jn.clear,mt=jn.el,qn=jn.round,Tt=jn.setText,Ar=jn.svg,zr=oe("packages/modules/charts/styles.js"),_t=zr.NS,ho=zr.injectStyles,In=oe("packages/modules/charts/scheme.js"),Sr=In.resolveScheme,fr=oe("packages/modules/charts/fills.js"),mo=fr.createFillRegistry,Fr=fr.nodePaint,Ir=fr.rowFillSource,Dr=fr.swatchCss,Mr=oe("packages/modules/charts/markers.js"),go=Mr.markerFor,po=Mr.placeMarker,yo=Mr.resolveMarker,Or=oe("packages/modules/charts/typography.js"),Dn=Or.applySize,Br=Or.resolveType,bo=Or.textWidth,Gr=oe("packages/modules/charts/labels.js"),wo=Gr.collides,ko=Gr.resolveLabels,Vn=oe("packages/modules/charts/interaction.js"),xo=Vn.applySelection,vo=Vn.attachBrush,Ao=Vn.attachKeyboard,Kr=Vn.brushCondition,So=Vn.brushed,hr=Vn.resolveBrush,Nr=oe("packages/modules/charts/dense.js"),Ps=Nr.downsample,$s=Nr.markCount,Mo=Nr.wantsCanvas,jr=oe("packages/modules/charts/cursor.js"),Oo=jr.ChartCursor,No=jr.GROUP_TOOLTIPS,Ur=jr.resolveCursor,Pr=oe("packages/modules/charts/range.js").deriveRangeSpec,jo=oe("packages/modules/charts/regression.js").regressionPlots,er=oe("packages/modules/charts/registry.js"),$r=er.chartTypeDef,Cs=er.registeredChartTypes,Ls=er.registerChartType,Po=x.linearScale,$o=x.bandScale,Hr=x.extent,Wr=x.toNumber,To=x.isNumber,Eo=x.niceDomain,Co=x.linearTicks,Lo=x.timeScale,Vr=x.toTime,_o=x.niceStep,Ro=Je.colourRamp,zo=jn.path,Fo=jn.attr,Yr=oe("packages/core/src/internal/util.js"),Io=Yr.infoOnce,Kt=Yr.warnOnce,dr=oe("packages/modules/charts/responsive.js"),Do=dr.resolveRules,Bo=dr.matchRules,Go=dr.applyRules,Zr=dr.describeActive,Ko=p.drawMeasureAxis,Uo=p.drawCategoryAxis,Ho=p.drawAxisLines,Wo=p.drawContinuousAxis,Vo=p.drawBandLabels,Yo=p.tickValues,Zo=pe.density,Jo=pe.valuesByCategory,Xo=pe.summarise,Qo=pe.quantile,qo=pe.histogram,mr=t.formatters;Object.defineProperty(r,"registerScheme",{enumerable:!0,get:function(){return In.registerScheme}}),Object.defineProperty(r,"resolveScheme",{enumerable:!0,get:function(){return In.resolveScheme}}),Object.defineProperty(r,"schemeNames",{enumerable:!0,get:function(){return In.schemeNames}}),Object.defineProperty(r,"setDefaultScheme",{enumerable:!0,get:function(){return In.setDefaultScheme}}),Object.defineProperty(r,"SCHEMES",{enumerable:!0,get:function(){return In.SCHEMES}}),Object.defineProperty(r,"PALETTE",{enumerable:!0,get:function(){return In.PALETTE}}),Object.defineProperty(r,"registerChartType",{enumerable:!0,get:function(){return er.registerChartType}}),Object.defineProperty(r,"registeredChartTypes",{enumerable:!0,get:function(){return er.registeredChartTypes}});const es=Object.freeze({el:mt,svg:Ar,attr:Fo,attrs:Rn,append:zn,clear:Fn,path:zo,round:qn,setText:Tt,Pool:fe,plotRect:a,linearScale:Po,bandScale:$o,sqrtScale:l,extent:Hr,measureDomain:o,niceDomain:Eo,linearTicks:Co,timeScale:Lo,toTime:Vr,niceStep:_o,toNumber:Wr,isNumber:To,key:R,drawMeasureAxis:Ko,drawCategoryAxis:Uo,drawAxisLines:Ho,drawContinuousAxis:Wo,drawBandLabels:Vo,tickValues:Yo,formatters:mr,resolveScheme:Sr,colourRamp:Ro,measureFormat:h,measureText:j,resolveMarker:yo,markerFor:go,placeMarker:po,density:Zo,valuesByCategory:Jo,summarise:Xo,quantile:Qo,histogram:qo,resolvePack:Wt,packRegions:br,fitted:wr,resolveProjection:Nn,splitAntimeridian:kn,projectedPath:On,basemapStyleOf:qt,referenceRegions:yn,geoRamp:$n,textWidth:bo,applySize:Dn,collides:wo,drawDensityCells:ne,frameLoop:uo,tween:fo,NS:_t});function Jr(ct,u){const S=`chart.type.${u}`,Y=ct.t(S);if(Y!==S)return Y;const ue=String(u).replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase();return ue.charAt(0).toUpperCase()+ue.slice(1)}const tr=Object.freeze(["line","step","area","rangeArea","bar","horizontalBar","waterfall","floatingBar","horizontalFloatingBar","populationPyramid","bullet","scatter","bubble","forest","combo","pareto","histogram","boxplot","heatmap","qq","ecdf","lorenz","correlogram","control","capability","movingRange","pie","donut","sunburst","treemap","radar","gauge","funnel","candlestick","ohlc","geomap","sankey","chord","network","stream","marimekko","violin","gantt"]),Tr=new Set([...Object.keys(se),"combo","candlestick",...vn]),gr=new Set([...Object.keys(se),"combo","heatmap"]),Er=new Set([...Object.keys(se),"combo","pareto"]),ts=4,Xr=new Set(["bar","column","horizontalBar","line","area","scatter","bubble","combo","pareto","histogram","heatmap","pie","donut","sunburst","treemap","radar","geomap"]),ns=new Set(["pie","donut","sunburst"]),rs=new Set(["pie","donut","sunburst","treemap"]),Qr=20,os=new Set(["histogram","boxplot","qq","ecdf","lorenz","control","capability","movingRange"]),ss=new Set(["histogram","boxplot","qq","ecdf","lorenz","violin"]);function is(ct){const u=ct.y||(Array.isArray(ct.measures)&&ct.measures.length?ct.measures[0]:null);if(!u)return ct;const S=typeof u=="string"?u:u.col;if(!S)return ct;const Y=typeof u=="object"&&u.fn!=null?u.fn:"median";return{...ct,y:{col:S,fn:Y}}}const as=new Set(["combo","candlestick","ohlc"]),qr=new Set(["bar","line","step","area","scatter","bubble"]),ls=new Set(["sankey","chord","network"]),Cr=Symbol("pending"),cs=new Set(["gantt"]),us=new Set(["radar","gauge","funnel","heatmap","geomap","sankey","chord","network"]),An=Object.freeze({width:480,height:300}),fs=new Set(["bar","horizontalBar","combo","pareto"]),hs=new Set(["horizontalBar","horizontalFloatingBar","populationPyramid"]),Lr=Object.freeze(["00000"]),ds=new Set(["horizontalBar","horizontalFloatingBar","forest"]);function pr(ct,u){return ds.has(ct)||ct==="populationPyramid"?!0:ct==="bullet"&&!(u&&u.bullet&&u.bullet.orientation==="vertical")}function ms(ct,u){return!(ct==="bullet"&&u&&u.bullet&&u.bullet.scale==="row")}function gs(ct){if(!ct||!Array.isArray(ct.points))return null;let u=0,S=!1;for(const Y of ct.points)typeof Y.y=="number"&&Number.isFinite(Y.y)&&(u+=Y.y,S=!0);return S?u:null}function eo(ct,u,S,Y){return ct==="correlogram"?(Array.isArray(Y.columns)?Y.columns:[]).map(ce=>Ft(S,ce)):ct==="heatmap"?(u.series||[]).map(ue=>ue.label):ct==="gantt"?(u.rows||[]).map(ue=>Y.label?S.rows.text(ue.key,Y.label):String(ue.key)):pr(ct,Y)?u.labels||[]:Lr}const ps=1e3,ys=50;let bs=0;function ws(ct){const u=ct/1e3;return`${u>=10?Math.round(u):Math.round(u*10)/10}s`}function to(ct){return`${ct/1e3}s`}function gn(ct){return ct&&ct.defaultView||globalThis}function ks(ct,u){return u?typeof u=="string"?ct.querySelector(u):u:null}function xs(ct,u,S){const Y=["fill","fill-opacity","stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-linejoin","stroke-linecap","font-size","font-family","font-weight","opacity","text-anchor","dominant-baseline","visibility"],ue=[ct,...ct.querySelectorAll("*")],ce=[u,...u.querySelectorAll("*")];for(let me=0;me<ue.length&&me<ce.length;me++){const Me=S.getComputedStyle(ue[me]),Te=[];for(const Ke of Y){const ze=Me.getPropertyValue(Ke);ze&&Te.push(`${Ke}:${ze}`)}Te.length&&ce[me].setAttribute("style",Te.join(";"))}}function vs(ct,u){let S=ct.root;const Y=[];for(const ue of u){const ce=(S.children||[]).find(me=>me.label===ue);if(!ce||!ce.children||!ce.children.length)break;S=ce,Y.push(ue)}return Y.length?{...ct,root:S,path:Y,empty:!S.children.length}:ct}function As(ct,u,S){return ct&&ct.plot?ct.plot:{left:0,top:0,right:u,bottom:S,width:u,height:S,gutter:{left:0,bottom:0,right:0,top:0}}}function no(ct){const[u,S]=[...ct.values()];return u&&S?Math.hypot(u.x-S.x,u.y-S.y):0}function Ss(ct){const[u,S]=[...ct.values()];return!u||!S?u||{x:0,y:0}:{x:(u.x+S.x)/2,y:(u.y+S.y)/2}}const Ms=new Set(["sum","avg","mean","median","min","max","first","last"]);function Os(ct,u){return ct&&ct.measure&&ct.measure.col===u&&ct.measure.fn?ct.measure.fn:"sum"}class ro{#r=++bs;#n;#i;#t;#s;#l=null;#o=null;#a=null;#m=null;#f=null;#M=null;#p=null;#c=null;#k=null;#O=null;#v=[];#x=[];#b=new Set;#e=null;#d={zoom:1,offset:[0,0]};#z=null;#$=null;#N=null;#L=0;#_=null;#F=null;#pe="";#Me=!1;#ye=!1;#u=null;#be=0;#re=null;#oe=[];#Q=null;#Oe=!1;#T=!1;#q=!1;#B=new Map;#G=Sr();#se=null;#K=Br();#Le=null;#A=null;#U=null;#g=null;#R=null;#_e=null;#rt="";#H=null;#h={x:null,y:null};#j={x:null,y:null};#J=!1;#S=[];#Ne={first:0,last:0};#W=!1;#we=!1;#ue=null;#V=null;#ke=!1;#Re=null;#Y=new Map;#xe=null;#ot=!1;#ee={written:{x:null,y:null},timer:0,frozen:null,reset:!1,moved:!1,type:"",full:null};#y=null;#X=!1;#I=-1;#ze=null;#Fe=null;#te=null;#fe=null;#Ie=0;#ie=new K;#ve={bbox:null,span:360,width:0};#he=null;#st=0;#P=null;#E=null;#je=!1;#it=!1;#at=null;#lt=0;#ct={animated:!1,reason:"not-drawn",marks:0,budget:xr};#C={source:"client",asked:"auto",reason:"the chart has not drawn yet",pending:!1,measures:[]};#Pe=null;#Z;#ne={rules:[],active:[]};#De=null;constructor(u){this.#n=u.grid,this.#i=u.container,this.#Z=u.spec,this.#t=u.spec,this.#s=u.container.ownerDocument,this.#Bt(),this.#Gt(),this.#Ce(!0),this.draw()}#Bt(){ho(this.#s);const u=this.#s;this.#l=mt(u,"div",_t);const S=mt(u,"figure",`${_t}__figure`);if(this.#t.title||this.#t.subtitle){const ue=mt(u,"figcaption",`${_t}__caption`);if(this.#t.title){const ce=mt(u,"div",`${_t}__title`);Tt(ce,this.#t.title),ue.appendChild(ce)}if(this.#t.subtitle){const ce=mt(u,"div",`${_t}__subtitle`);Tt(ce,this.#t.subtitle),ue.appendChild(ce)}S.appendChild(ue)}this.#o=Ar(u,"svg",{class:`${_t}__plot`,preserveAspectRatio:"xMidYMid meet",role:"img"}),this.#a=f(u,this.#o);const Y=Ar(u,"defs",{class:`${_t}__fills`});if(this.#o.appendChild(Y),this.#se=mo(Y),S.appendChild(this.#o),this.#E=new cr({view:u.defaultView||null}),this.#M=mt(u,"div",`${_t}__edit-status`),this.#M.setAttribute("role","status"),this.#M.setAttribute("aria-live","polite"),this.#M.setAttribute("hidden",""),S.appendChild(this.#M),this.#p=new Bn({svg:this.#o,doc:u,status:this.#M,grid:()=>this.#n,pointOf:ue=>this.#D(ue),edited:ue=>this.emit("edit",ue),rejected:ue=>this.emit("editRejected",ue),hideTooltip:()=>this.#de(),fn:()=>this.#u&&this.#u.measure&&this.#u.measure.fn||"sum"}),this.#O=mt(u,"div",`${_t}__empty`),this.#O.setAttribute("hidden",""),S.appendChild(this.#O),this.#c=mt(u,"div",`${_t}__table`),S.appendChild(this.#c),this.#m=mt(u,"div",`${_t}__legend`),S.appendChild(this.#m),this.#t.footnote){const ue=mt(u,"div",`${_t}__footnote`);Tt(ue,this.#t.footnote),S.appendChild(ue)}this.#$=mt(u,"div",`${_t}__attribution`),this.#$.setAttribute("hidden",""),S.appendChild(this.#$),this.#f=mt(u,"div",`${_t}__tooltip`),this.#f.setAttribute("hidden",""),this.#l.appendChild(S),this.#i.appendChild(this.#l),this.#gt(),this.#Ut()}#Gt(){this.#ut();const u=gn(this.#s);u&&typeof u.ResizeObserver=="function"&&(this.#Q=this.#i.getBoundingClientRect?this.#i.getBoundingClientRect():null,this.#re=new u.ResizeObserver(()=>{if(!this.#Oe){this.#Oe=!0;const S=this.#i.getBoundingClientRect?this.#i.getBoundingClientRect():null;if(S&&this.#Q&&Math.round(S.width)===Math.round(this.#Q.width)&&Math.round(S.height)===Math.round(this.#Q.height))return}this.#Ce(!1),this.schedule()}),this.#re.observe(this.#i))}#ut(){const u=["model:changed","rows:changed","filter:changed","sort:changed","column:grouped","column:pivoted","cell:changed","timeline:seek","timeline:attached","timeline:detached"];this.#t.selection&&this.#x.push(this.#n.on("selection:changed",()=>this.#wt())),this.#t.fitTo==="selection"&&this.#x.push(this.#n.on("selection:changed",()=>{this.fitToSelection()}));for(const S of u)this.#x.push(this.#n.on(S,()=>{this.#je=!0,this.schedule()}));this.#x.push(this.#n.on("destroy",()=>this.#Kt()))}#Kt(){if(!this.#T){this.#q=!0;for(const u of this.#x)try{u()}catch{}this.#x=[]}}#ft(){const u=this.#o&&this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():null;return u&&u.width>0&&u.height>0?u:this.#i.getBoundingClientRect?this.#i.getBoundingClientRect():An}#Ut(){const u=Ze=>{!this.#z&&!(this.#p&&this.#p.dragging)&&this.#Wt(Ze)},S=()=>{this.#X&&this.#y&&this.#y.leave(),this.#de()};this.#o.addEventListener("pointermove",u),this.#o.addEventListener("pointerleave",S);const Y=Ze=>this.#We(Ze);this.#o.addEventListener("click",Y);const ue=Ze=>{!this.#e||!this.#e.packed||this.#g&&this.#g.busy||(this.#z={x:Ze.clientX||0,y:Ze.clientY||0})},ce=Ze=>{if(!this.#z)return;const Pt=Ze.clientX||0,at=Ze.clientY||0;this.#Ae(Pt-this.#z.x,at-this.#z.y),this.#z={x:Pt,y:at}},me=()=>{this.#z=null},Me=Ze=>{!this.#e||!this.#e.packed||(Ze.preventDefault&&Ze.preventDefault(),this.#Ye(Ze.deltaY<0?1.15:1/1.15))},Te=Ze=>{if(!this.#e||!this.#e.packed)return;const Pt=40;if(Ze.shiftKey&&Ze.key==="ArrowLeft")this.#Ae(-Pt,0);else if(Ze.shiftKey&&Ze.key==="ArrowRight")this.#Ae(Pt,0);else if(Ze.shiftKey&&Ze.key==="ArrowUp")this.#Ae(0,-Pt);else if(Ze.shiftKey&&Ze.key==="ArrowDown")this.#Ae(0,Pt);else if(Ze.key==="+"||Ze.key==="=")this.#Ye(1.25);else if(Ze.key==="-"||Ze.key==="_")this.#Ye(1/1.25);else if(Ze.key==="0")this.#sn();else return;Ze.preventDefault&&Ze.preventDefault()};this.#o.addEventListener("pointerdown",ue),this.#o.addEventListener("pointermove",ce),this.#o.addEventListener("pointerup",me),this.#o.addEventListener("pointerleave",me),this.#o.addEventListener("wheel",Me,{passive:!1}),this.#o.addEventListener("keydown",Te);const Ke=()=>{if(!this.#W)return null;const Ze=pt(this.#t.zoom);return Ze.enabled?Ze:null},ze=()=>!!(this.#g&&this.#g.busy)||!!hr(this.#t).mode,Be=Ze=>{const Pt=Ke();if(!Pt||!Pt.wheel||this.#e&&this.#e.packed)return;const at=Number(Ze.deltaY)||0;if(!at)return;const nt=this.#D(Ze);this.#ce(at<0?"in":"out","wheel",this.#_t(nt)),Ze.preventDefault&&Ze.preventDefault()},ht=Ze=>{this.#ke=!1;const Pt=Ke();if(Pt&&!(this.#e&&this.#e.packed)){if(Ze.pointerType==="touch"&&!(this.#g&&this.#g.busy)&&(this.#Y.set(Number(Ze.pointerId)||0,this.#D(Ze)),this.#Y.size===2)){this.#V=null,this.#xe={distance:no(this.#Y)};return}!Pt.pan||ze()||!this.#h.x&&!this.#h.y||(this.#V={at:this.#D(Ze),moved:!1})}},Ut=Ze=>{if(Ze.pointerType==="touch"&&this.#Y.has(Number(Ze.pointerId)||0)&&(this.#Y.set(Number(Ze.pointerId)||0,this.#D(Ze)),this.#xe&&this.#Y.size>=2)){const Sn=no(this.#Y),dn=this.#xe.distance;dn>0&&Sn>0&&Sn!==dn&&(this.#xe.distance=Sn,this.#ke=!0,this.#En(dn/Sn,"pinch",this.#_t(Ss(this.#Y)))),Ze.preventDefault&&Ze.preventDefault();return}if(!this.#V)return;const Pt=this.#e&&this.#e.plot||null;if(!Pt)return;const at=this.#D(Ze),nt=at.x-this.#V.at.x,jt=at.y-this.#V.at.y,Et=Pt.right-Pt.left||1,Qt=Pt.bottom-Pt.top||1;if(!this.#V.moved&&Math.hypot(nt,jt)<ts)return;this.#V.moved=!0,this.#ke=!0,this.#V.at=at;const Pn=!!(this.#e&&this.#e.horizontal);this.#me((Sn,dn,so)=>Sn==="x"?Vt(dn,so,Pn?-jt/Qt:-nt/Et):Vt(dn,so,Pn?-nt/Et:jt/Qt),"pan"),Ze.preventDefault&&Ze.preventDefault()},Dt=Ze=>{this.#V=null,Ze&&Ze.pointerType==="touch"&&(this.#Y.delete(Number(Ze.pointerId)||0),this.#Y.size<2&&(this.#xe=null))},Ve=Ze=>{if(Ke()&&!(this.#e&&this.#e.packed)){if(Ze.key==="+"||Ze.key==="=")this.#ce("in","key");else if(Ze.key==="-"||Ze.key==="_")this.#ce("out","key");else if(Ze.key==="0"&&(this.#h.x||this.#h.y))this.#ce("reset","reset");else return;Ze.preventDefault&&Ze.preventDefault()}},cn=Ze=>{Ke()&&(this.#e&&this.#e.packed||(this.#ce("reset","reset"),Ze.preventDefault&&Ze.preventDefault()))};this.#o.addEventListener("wheel",Be,{passive:!1}),this.#o.addEventListener("pointerdown",ht),this.#o.addEventListener("pointermove",Ut),this.#o.addEventListener("pointerup",Dt),this.#o.addEventListener("pointerleave",Dt),this.#o.addEventListener("pointercancel",Dt),this.#o.addEventListener("keydown",Ve),this.#o.addEventListener("dblclick",cn),this.#v.push(()=>{this.#o.removeEventListener("wheel",Be),this.#o.removeEventListener("pointerdown",ht),this.#o.removeEventListener("pointermove",Ut),this.#o.removeEventListener("pointerup",Dt),this.#o.removeEventListener("pointerleave",Dt),this.#o.removeEventListener("pointercancel",Dt),this.#o.removeEventListener("keydown",Ve),this.#o.removeEventListener("dblclick",cn)}),this.#v.push(vo({svg:this.#o,overlay:this.#a.overlay,plot:()=>this.#e&&this.#e.plot||{left:0,top:0,right:0,bottom:0,height:0},pointOf:Ze=>this.#D(Ze),axis:()=>hr(this.#t).axis,horizontal:()=>!!(this.#e&&this.#e.horizontal),enabled:()=>!!hr(this.#t).mode&&!!(this.#e&&(this.#e.xScale||typeof this.#e.brushKeys=="function"))&&!(this.#g&&this.#g.busy),onBrush:(Ze,Pt)=>this.#tn(Ze,Pt)}));const un=Ze=>{if(Ze.key!=="Escape")return;const Pt=this.#n&&this.#n.filters;if(!Pt||typeof Pt.get!="function")return;let at=!1;for(const nt of[ft,yt])ot(Pt.get(),this.#r,nt)&&(this.#Ve(null,nt),at=!0);at&&Ze.preventDefault&&Ze.preventDefault()};this.#o.addEventListener("keydown",un),this.#v.push(()=>this.#o.removeEventListener("keydown",un)),this.#o.setAttribute("tabindex","0"),this.#v.push(Ao({svg:this.#o,marks:()=>this.#Ee(),intercept:Ze=>this.#g&&this.#g.measureKey(Ze)||this.#X&&!!this.#y&&this.#y.key(Ze)||this.#Un(Ze),within:(Ze,Pt)=>this.#rn(Ze,Pt),onFocus:Ze=>this.#St(Ze),onActivate:Ze=>this.#on(Ze)})),this.#v.push(()=>{this.#o.removeEventListener("pointermove",u),this.#o.removeEventListener("pointerleave",S),this.#o.removeEventListener("click",Y),this.#o.removeEventListener("pointerdown",ue),this.#o.removeEventListener("pointermove",ce),this.#o.removeEventListener("pointerup",me),this.#o.removeEventListener("pointerleave",me),this.#o.removeEventListener("wheel",Me),this.#o.removeEventListener("keydown",Te)})}#D(u){const S=this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():{left:0,top:0,width:An.width,height:An.height};return{x:(u.clientX||0)-S.left,y:(u.clientY||0)-S.top}}#ht(u){return le({bound:{categories:this.#$e().categories},xScale:this.#e.xScale,at:this.#e.horizontal?u.y:u.x})}#$e(){const u=this.#e;return u&&Array.isArray(u.labels)&&Array.isArray(u.categories)?{labels:u.labels,categories:u.categories}:{labels:this.#u&&this.#u.labels||[],categories:this.#u&&this.#u.categories||[]}}#dt(u){if(!this.#e||!Array.isArray(this.#e.series))return null;if(this.#e.reduced)return D({series:this.#e.series,xScale:this.#e.xScale,at:this.#e.horizontal?u.y:u.x});const S=this.#Ht(u);if(S)return S;const Y=this.#ht(u);return Y<0?null:{index:Y,entries:this.#e.series.map(ue=>({series:ue,point:ue.points[Y]})).filter(ue=>ue.point&&ue.point.y!==null)}}#Ht(u){let S=null;for(const Y of this.#e.series){const ue=Y&&Y.points||[];for(let ce=0;ce<ue.length;ce++){const me=ue[ce];if(!me||!(me.markerHalf>0)||me.y===null||me.px===void 0)continue;const Me=Math.abs(u.x-me.px),Te=Math.abs(u.y-me.py);if(Me>me.markerHalf||Te>me.markerHalf)continue;const Ke=Me*Me+Te*Te;(!S||Ke<=S.distance)&&(S={distance:Ke,index:ce,series:Y,point:me})}}return S?{index:S.index,entries:[{series:S.series,point:S.point}]}:null}#Be(u){return wn({drawn:this.#e,bound:this.#u,spec:this.#t,grid:this.#n,scheme:this.#G,at:u})}#Wt(u){if(this.#X&&this.#y&&this.#e&&this.#u){const Me=this.#D(u);this.#y.pointer(u,Me);const Te=this.#He(Me);Te&&this.emit("hover",{...Te,native:u});return}if(!this.#e||!this.#u||this.#t.tooltip===!1)return;const S=this.#D(u),Y=[];let ue="";const ce=this.#Be(S);if(ce){this.#Ke(ce.heading,ce.rows,u),this.emit("hover",{...ce.datum,native:u});return}if(an(this.#e)){this.#de();return}if(this.#e.arcs){const Me=J({arcs:this.#e.arcs,x:S.x,y:S.y});if(!Me){this.#de();return}ue=Me.label;const Te=this.#u.root.total>0?Me.total/this.#u.root.total:0;Y.push({label:this.#u.measure.title,value:`${j(Me.total,this.#n.messages)} (${this.#n.messages.number(Te,{style:"percent",maximumFractionDigits:1})})`,colour:this.#G.series(Me.index)}),this.#u.radius&&Number.isFinite(Me.rvalue)&&Y.push({label:this.#u.radius.title,value:j(Me.rvalue,this.#n.messages),colour:this.#G.series(Me.index)})}else{const Me=this.#dt(S);if(!Me){this.#de();return}ue=this.#$e().labels[Me.index]||"",Y.push(...this.#mt(Me.entries,Me.index))}if(!Y.length){this.#de();return}this.#Ke(ue,Y,u);const me=this.#He(S);me&&this.emit("hover",{...me,native:u})}#mt(u,S){const Y=this.#e.percent&&this.#e.percentTotals&&this.#e.percentTotals[S]||0,ue=[];for(const ce of u)ue.push({label:ce.series.label,value:this.#e.valueText?this.#e.valueText(ce.series,ce.point):this.#e.floating?this.#Ge(ce.point):Y?`${j(ce.point.y,this.#n.messages)} (${this.#n.messages.number(Math.abs(ce.point.y)/Y,{style:"percent",maximumFractionDigits:1})})`:j(ce.point.y,this.#n.messages),colour:this.#G.series(ce.series.index)});return ue}#Ge(u){if(u.y0===null||u.y1===null)return j(u.y,this.#n.messages);const Y=(this.#e&&this.#e.valueKind)==="time"?ue=>new Date(ue).toISOString().slice(0,10):ue=>j(ue,this.#n.messages);return`${Y(u.y0)} → ${Y(u.y1)}`}#Ke(u,S,Y){const ue=this.#s;if(Fn(this.#f),u){const ce=mt(ue,"div",`${_t}__tooltip-row`),me=mt(ue,"strong");Tt(me,u),ce.appendChild(me),this.#f.appendChild(ce)}for(const ce of S){const me=mt(ue,"div",`${_t}__tooltip-row`),Me=mt(ue,"span",`${_t}__swatch`);Me.setAttribute("style",`background:${Dr(ce.colour)}`);const Te=mt(ue,"span");Tt(Te,ce.label);const Ke=mt(ue,"span",`${_t}__tooltip-value`);Tt(Ke,ce.value),zn(me,[Me,Te,Ke]),this.#f.appendChild(me)}this.#f.removeAttribute("hidden"),this.#Yt(Y),this.#Vt()}#Vt(){if(this.#oe.length||!this.#l||this.#f.parentNode===this.#l)return;const u=gn(this.#s);if(!u||typeof u.MutationObserver!="function")return;const S=()=>{this.#l.isConnected===!1&&(this.#Te(),this.#f.setAttribute("hidden",""),this.#f.parentNode&&this.#f.parentNode.removeChild(this.#f))},Y=[this.#s,this.#pt(),this.#t.tooltipHost&&this.#t.tooltipHost.ownerDocument].filter((ue,ce,me)=>ue&&typeof ue.nodeType=="number"&&me.indexOf(ue)===ce);for(const ue of Y){const ce=new u.MutationObserver(S);ce.observe(ue,{childList:!0,subtree:!0}),this.#oe.push(ce)}}#Te(){for(const u of this.#oe)u.disconnect();this.#oe=[]}#Yt(u){this.#gt();const S=gn(this.#s),Y=12,ue=u&&u.clientX||0,ce=u&&u.clientY||0,me=typeof this.#f.getBoundingClientRect=="function"?this.#f.getBoundingClientRect():{width:0,height:0},Me=S.innerWidth||0,Te=S.innerHeight||0;let Ke=ue+Y;Me&&Ke+me.width>Me-Y&&(Ke=ue-Y-me.width),Ke=Math.max(Y,Ke);let ze=ce+Y;Te&&ze+me.height>Te-Y&&(ze=ce-Y-me.height),ze=Math.max(Y,ze),this.#f.style.left=`${Math.round(Ke)}px`,this.#f.style.top=`${Math.round(ze)}px`}#gt(){const u=this.#f;if(!u)return;const S=this.#t.tooltipHost,Y=S&&typeof S.appendChild=="function"?S:this.#pt()||this.#s&&this.#s.body||this.#l;if(u.parentNode!==Y&&Y.appendChild(u),Y!==this.#l){u.classList.add("lattice");let ue=null;for(let ce=this.#l;ce&&!ue;ce=ce.parentNode||ce.host)typeof ce.getAttribute=="function"&&(ue=ce.getAttribute("data-theme"));ue?u.setAttribute("data-theme",ue):u.removeAttribute("data-theme")}}#pt(){const u=this.#l;if(!u||typeof u.getRootNode!="function")return null;const S=u.getRootNode();return S&&S.nodeType===11&&S.host&&typeof S.appendChild=="function"?S:null}#de(){this.#f&&this.#f.setAttribute("hidden",""),this.#Te(),this.emit("leave",{})}#Zt(u){const S=Ur(this.#t);S&&!Er.has(u)&&Kt(`chart:${this.#r}:cursor:type:${u}`,`"cursor" is a crosshair over a chart's own axes and ${JSON.stringify(u)} has none to put one on, so no cursor was added. The types that take one are ${[...Er].sort().join(", ")}.`);const Y=this.#t.cursor;S&&Y&&typeof Y=="object"&&Y.groupTooltips!==void 0&&!No.includes(Y.groupTooltips)&&Kt(`chart:${this.#r}:cursor:groupTooltips`,`"cursor.groupTooltips" is ${JSON.stringify(Y.groupTooltips)}, which is not 'pointer' or 'all', so 'pointer' was used: only the chart under the pointer shows its tooltip.`),S&&this.#t.multiples&&Kt(`chart:${this.#r}:cursor:multiples`,`"cursor" is not drawn on small multiples: each panel has its own plot and the set reads as one chart, so no cursor was added. Put a cursor on each panel's own chart instead.`);const ue=this.#e;this.#X=!!(S&&Er.has(u)&&!this.#t.multiples&&ue&&ue.xScale&&ue.plot&&this.#u),this.#X&&!this.#y&&(this.#y=new Oo(this.#Jt())),this.#y&&this.#y.refresh(),this.#yt(this.#X&&S.rowHover)}#yt(u){if(!u){this.#te&&(this.#te(),this.#te=null);return}if(this.#te||this.#q)return;const S=this.#n.on("cell:mouseover",ue=>{const ce=typeof this.#t.x=="string"?this.#t.x:null;!ce||!ue||ue.key===void 0||!this.#y||this.#y.set(this.#n.rows.value(ue.key,ce),"row")}),Y=this.#n.on("cell:mouseout",()=>{this.#y&&this.#y.source==="row"&&this.#y.clear("row")});this.#te=()=>{S(),Y()}}#Jt(){return{doc:this.#s,svg:()=>this.#o,options:()=>this.#X?Ur(this.#t):null,drawn:()=>this.#e,series:()=>this.#bt(),size:()=>11,rows:(u,S,Y)=>{let ue=u.entries;if(S==="single"&&Y!==null&&Y!==void 0&&ue.length>1){const ce=this.#e;let me=ue[0],Me=1/0;for(const Te of ue){const Ke=Te.series.axis==="right"&&ce.rightScale?ce.rightScale:ce.yScale,ze=Math.abs(Ke.of(Te.point.y)-Y);ze<Me&&(Me=ze,me=Te)}ue=[me]}return{heading:u.label,rows:this.#mt(ue,u.index),raw:ue.map(ce=>ce.point.y)}},formatX:(u,S)=>this.#Xt(u,S),formatY:u=>this.#Ue(u,!1),formatY2:u=>this.#Ue(u,!0),showTooltip:(u,S,Y)=>{this.#t.tooltip!==!1&&this.#Ke(u,S,Y)},hideTooltip:()=>{this.#f&&this.#f.setAttribute("hidden",""),this.#Te()},moved:u=>this.emit("cursor:move",u),left:u=>this.emit("cursor:leave",u),announce:u=>this.#Qt(u),clientAt:(u,S)=>{const Y=this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():{left:0,top:0};return{clientX:Y.left+u,clientY:Y.top+S}},zoomX:u=>this.#qt(u)}}#bt(){const u=this.#e;if(!u||!Array.isArray(u.series))return[];const S=this.#t.type;return(S==="candlestick"||S==="ohlc")&&this.#u&&Array.isArray(this.#u.series)?[...this.#u.series.slice(0,4),...u.series.slice(1)]:u.series}#Xt(u,S){const Y=this.#e;if(!Y||Y.xScale.kind==="band"||S===null||S===void 0)return u.label;const ue=this.#u,ce=ue&&ue.dimension&&ue.dimension.col?this.#n.columns.get(ue.dimension.col):void 0,me=Y.xScale.domain,Me=mr(this.#n,{kind:ue.kind,span:me.max-me.min,step:(me.max-me.min)/5},ce),Te=N(this.#t.axis);return k(Te.x,{tick:Me.value},this.#n,ce)(S)}#Ue(u,S){const Y=this.#e,ce=(S&&Y.rightScale?Y.rightScale:Y.yScale).domain,me=mr(this.#n,{kind:"linear",step:ce?(ce.max-ce.min)/5:0}),Me=N(this.#t.axis),Te=k(S?Me.y2:Me.y,me,this.#n)(u);return Y.percent&&!S&&!(Me.y&&Me.y.format)?`${Te}%`:Te}#Qt(u){if(!this.#Fe){const S=mt(this.#s,"div",`${_t}__cursor-live`);S.setAttribute("role","status"),S.setAttribute("aria-live","polite"),S.setAttribute("aria-atomic","true"),S.setAttribute("style","position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0"),this.#l.appendChild(S),this.#Fe=S}Tt(this.#Fe,u)}#qt(u){!this.#W||!u||(u.reset||!u.x?this.#me(()=>null,"group"):this.#Rt(u.x,"group"))}get cursor(){return this.#ze||(this.#ze=Object.freeze({set:u=>!this.#X||!this.#y?(Kt(`chart:${this.#r}:cursor:off`,"chart.cursor.set() was called on a chart with no cursor, so nothing moved. Set `cursor: true` on a cartesian chart before driving it."),!1):this.#y.set(u),clear:()=>{this.#y&&this.#y.clear()},get:()=>this.#y?this.#y.get():null})),this.#ze}#He(u){if(!this.#e||!this.#u)return null;const S=this.#Be(u);if(S)return S.datum;if(an(this.#e))return null;if(this.#e.arcs){const Me=J({arcs:this.#e.arcs,x:u.x,y:u.y});return Me?{label:Me.label,value:Me.total,category:Me.node.value,column:this.#t.x||null,series:null,depth:Me.depth,path:Array.isArray(Me.path)?[...Me.path]:[Me.label],rowKeys:Me.node.rowKeys&&Me.node.rowKeys.length?[...Me.node.rowKeys]:Me.node.rowKey?[Me.node.rowKey]:[]}:null}const Y=this.#dt(u);if(!Y)return null;const ue=Y.entries,ce=this.#$e(),me=ue.length===1&&ue[0].point.from!==void 0?{from:ue[0].point.from,to:ue[0].point.to}:null;return{label:ce.labels[Y.index]||"",category:ce.categories[Y.index],column:this.#u.dimension.col,value:ue.length===1?ue[0].point.y:null,...me||{},series:ue.map(Me=>({key:Me.series.key,label:Me.series.label,value:Me.point.y,rows:Me.point.rows})),rowKeys:ue.map(Me=>Me.point.rowKey).filter(Boolean)}}#We(u,S=null,Y=null){if(!this.#e||!this.#u||this.#p&&this.#p.consumeClick()||this.#g&&this.#g.busy)return;if(this.#ke){this.#ke=!1;return}const ue=u&&u.target&&u.target.getAttribute?u.target.getAttribute("data-crumb"):null;if(ue!=null&&Array.isArray(this.#e.crumbs)){this.#Ft(Number(ue));return}const ce=Y||this.#He(S||this.#D(u));if(!ce)return;let me=!1;const Me=this.emit("click",{...ce,native:u,preventDefault(){me=!0}});if(me||Me.defaultPrevented)return;if(typeof this.#e.click=="function"){this.#e.click(ce,this.#t);return}if(Array.isArray(this.#e.hnodes)){const Be=typeof this.#e.activate=="function"?this.#e.activate(ce):!1;if(Be==="ignore")return;if(Be&&typeof Be=="object"&&Array.isArray(Be.drill)){this.#A=[...this.#A||[],...Be.drill],this.emit("drill",{path:[...this.#A],label:Be.label}),this.draw();return}this.#t.selection&&Array.isArray(ce.rowKeys)&&ce.rowKeys.length&&this.#n.selection.set([...new Set(ce.rowKeys)]),Be&&this.draw();return}if(this.#t.drill&&this.#u&&this.#u.root&&ce.label){const Be=Array.isArray(ce.path)&&ce.path.length?ce.path:[ce.label];this.#A=[...this.#A||[],...Be],this.emit("drill",{path:[...this.#A],label:ce.label}),this.draw();return}if(this.#t.selection&&Array.isArray(this.#e.markers)&&Array.isArray(ce.rowKeys)&&ce.rowKeys.length){this.#n.selection.set([...ce.rowKeys]);return}if(this.#t.selection&&(this.#t.type==="network"||Array.isArray(this.#e.items)||Array.isArray(this.#e.arcs)&&!this.#e.ribbons||Array.isArray(this.#e.tiles)||Array.isArray(this.#e.ribbons)&&this.#e.ring||Array.isArray(this.#e.links)&&Array.isArray(this.#e.nodes)&&!this.#e.series)&&Array.isArray(ce.rowKeys)&&ce.rowKeys.length){this.#n.selection.set([...new Set(ce.rowKeys)]);return}if(!this.#t.filterOnClick||!ce.column)return;const Te=this.#n.filters,Ke=ot(Te.get(),this.#r,yt),ze=Ke&&Ke.col===ce.column&&Ke.op==="eq"&&R(Ke.value)===R(ce.category);this.#Ve(ze?null:{col:ce.column,op:"eq",value:ce.category},yt)}#wt(){if(!this.#e)return;if(typeof this.#e.emphasise=="function"){this.#e.emphasise(new Set(this.#n.selection.keys()));return}if(Array.isArray(this.#e.markers)){this.#en();return}if(Array.isArray(this.#e.hnodes)){At({drawn:this.#e,keys:new Set(this.#n.selection.keys())});return}if(Array.isArray(this.#e.links)&&Array.isArray(this.#e.nodes)&&!this.#e.series){lr({drawn:this.#e,keys:new Set(this.#n.selection.keys())});return}if(Array.isArray(this.#e.ribbons)&&this.#e.ring&&!this.#e.series){Yn({marks:this.#a.marks,drawn:this.#e,keys:new Set(this.#n.selection.keys())});return}if(Array.isArray(this.#e.arcs)&&!this.#e.series){nn({marks:this.#a.marks,entries:this.#e.arcs,attribute:"data-arc",keys:new Set(this.#n.selection.keys())});return}if(Array.isArray(this.#e.tiles)&&!this.#e.series){nn({marks:this.#a.marks,entries:this.#e.tiles,attribute:"data-tile",keys:new Set(this.#n.selection.keys())});return}if(Array.isArray(this.#e.items)&&!this.#e.series){const ue=new Set(this.#n.selection.keys());for(const ce of this.#e.items){const me=ce&&ce.element;if(!me||!me.setAttribute)continue;const Me=Array.isArray(ce.rowKeys)?ce.rowKeys:[];ue.size&&!Me.some(Te=>ue.has(Te))?me.setAttribute("data-dim","true"):me.removeAttribute("data-dim")}return}if(!this.#e.series)return;const u=this.#n.selection.keys(),S=this.#u&&this.#u.dimension&&this.#u.dimension.col,Y=new Set;if(S)for(const ue of u)Y.add(R(this.#n.rows.value(ue,S)));xo({groups:this.#a,series:this.#e.series,keys:new Set(u),categories:Y})}#en(){const u=new Set(this.#n.selection.keys());for(const S of this.#e.markers){const Y=S.element;!Y||!Y.setAttribute||(u.size&&!u.has(S.rowKey)?Y.setAttribute("data-dim","true"):Y.removeAttribute("data-dim"))}}#tn(u,S){const Y=hr(this.#t),ue=Y.mode;if(ue&&this.#e&&typeof this.#e.brushKeys=="function"&&this.#u){this.#nn(ue,u,S);return}if(!ue||!this.#e||!this.#e.xScale||!this.#u)return;const ce=So({bound:this.#u,xScale:this.#e.xScale,yScale:this.#e.yScale,rightScale:this.#e.rightScale||null,axis:Y.axis,from:u,to:S});let me=!1;const Me=this.emit("brush",{mode:ue,kind:ce.kind,values:ce.values,range:ce.range,axis:ce.axis,column:ce.axis==="y"||ce.axis==="y2"?(this.#kt(ce.axis)||{}).col||null:this.#u.dimension.col,preventDefault(){me=!0}});if(me||Me.defaultPrevented)return;if(ue==="zoom"){if(ce.range){const ht=ce.axis==="y2"?"y2":ce.axis==="y"?"y":"x";this.#Z={...this.#Z,axis:{...this.#Z.axis||{},[ht]:{...(this.#Z.axis||{})[ht]||{},min:Math.min(ce.range[0],ce.range[1]),max:Math.max(ce.range[0],ce.range[1])}}},this.#Ce(!0),this.draw()}return}if(ue==="select"){const ht=[];for(const Ut of this.#e.series||[])for(const Dt of Ut.points){if(!Dt.rowKey)continue;(ce.kind!=="set"||ce.values.some(cn=>R(cn)===Dt.xKey))&&ht.push(Dt.rowKey)}this.#n.selection.set([...new Set(ht)]);return}const Te=ce.axis==="y"||ce.axis==="y2",Ke=Te?this.#kt(ce.axis):null;if(Te&&Ke&&Ke.refused){Ke.refused==="aggregate"?Kt(`chart:${this.#r}:brush:aggregate`,`a brush on the ${ce.axis} axis would filter rows by "${Ke.cols[0]}", but the marks on that axis are totals over several rows (or counts), and a range of totals says nothing about which rows lie in it, so no filter was written. Brush the x axis, or chart one row per mark.`):Kt(`chart:${this.#r}:brush:measures`,`a brush on the ${ce.axis} axis filters the measure behind it, and this chart has ${Ke.cols.length} measure column(s) there (${Ke.cols.join(", ")}), so no filter was written. Brush an axis that carries one measure.`);return}const ze=Te?Ke&&Ke.col:this.#u.dimension.col,Be=Kr(Te?{column:ze,result:ce,kind:"linear"}:{column:ze,result:ce,kind:this.#u.kind});Be&&ce.kind!=="set"&&this.#u.kind==="time"&&this.#xt(ze)&&(Be.value=Be.value.map(ht=>Jt(ht.getTime()))),this.#Ve(Be,ft)}#kt(u){const S=this.#u;if(!S)return null;const Y=u==="y2"?"right":"left",ue=Array.isArray(this.#t.measures)&&this.#t.measures.length?this.#t.measures.map(Be=>typeof Be=="string"?{col:Be}:Be):null,ce=ue?ue.filter(Be=>(Be.axis==="right"?"right":"left")===Y).map(Be=>({col:Be.col,fn:Be.fn||Os(S,Be.col)})):Y==="left"&&S.measure&&S.measure.col?[{col:S.measure.col,fn:S.measure.fn||"sum"}]:[],me=[...new Set(ce.map(Be=>Be.col).filter(Boolean))];if(me.length!==1)return{col:null,refused:"measures",cols:me};const Me=new Set(ue?me:[]),Ke=(S.series||[]).filter(Be=>ue?Me.has(Be.key)&&(Be.axis==="right"?"right":"left")===Y:!0).some(Be=>(Be.points||[]).some(ht=>ht&&ht.y!==null&&ht.rows>1)),ze=ce.some(Be=>!Ms.has(String(Be.fn||"sum")));return Ke||ze?{col:null,refused:"aggregate",cols:me}:{col:me[0]}}#xt(u){const S=this.#n&&this.#n.columns,Y=u&&S&&typeof S.get=="function"?S.get(u):null;return!!(Y&&Y.type==="datetime")}#Ve(u,S){const Y=this.#n&&this.#n.filters;if(!Y||typeof Y.get!="function"||typeof Y.set!="function")return;const ue=Y.get(),ce=u?{...u,meta:{...u.meta||{},owner:S,chart:this.#r}}:null;!ce&&Lt(ue,this.#r,S)===ue||Y.set(en(ue,this.#r,ce?[ce]:[],S))}#nn(u,S,Y){if(u!=="select"){Kt(`chart:${this.#r}:brush:polar:${u}`,`a ${this.#t.type} chart can only brush to a selection, and brush: ${JSON.stringify(u)} was set, so the drag did nothing. Set brush: 'select' to select the rows inside the dragged band in the grid.`);return}const ue=this.#e.brushKeys(S,Y);let ce=!1;const me=this.emit("brush",{mode:u,kind:"set",values:[],range:[Math.min(S,Y),Math.max(S,Y)],axis:"x",column:null,rowKeys:ue,preventDefault(){ce=!0}});ce||me.defaultPrevented||this.#n.selection.set([...new Set(ue)])}#Ee(){return[...this.#a.marks.childNodes||[]].filter(u=>u.setAttribute&&!(u.getAttribute&&u.getAttribute("data-decor")))}#vt(u){const S=this.#e&&this.#e.items;return Array.isArray(S)&&S.find(Y=>Y&&Y.element===u)||null}#At(u){if(!u||!u.getAttribute||!this.#e||!Array.isArray(this.#e.series)||this.#e.items||this.#e.hnodes||u.getAttribute("data-point")!==null&&u.getAttribute("data-point")!==void 0)return null;const S=u.getAttribute("data-series");if(S==null)return null;const Y=this.#e.series[Number(S)];return Y&&Array.isArray(Y.points)&&Y.points.length>1?Y:null}#rn(u,S){const Y=this.#Ee()[S],ue=this.#At(Y);if(!ue)return!1;const ce=ue.points.length-1,me=Ke=>ue.points[Ke]&&ue.points[Ke].y!==null&&ue.points[Ke].y!==void 0;this.#I>ce&&(this.#I=ce);let Me=this.#I;const Te=(Ke,ze)=>{for(let Be=Ke;Be>=0&&Be<=ce;Be+=ze)if(me(Be))return Be;return-1};switch(u.key){case"ArrowRight":Me=Te(this.#I<0?0:this.#I+1,1);break;case"ArrowLeft":Me=Te(this.#I<0?0:this.#I-1,-1);break;case"Home":Me=Te(0,1);break;case"End":Me=Te(ce,-1);break;default:return!1}return Me<0&&(Me=this.#I),Me<0||(this.#I=Me,Y.focus&&Y.focus(),this.#St(S)),!0}#St(u){const S=this.#Ee()[u];if(!S||!S.setAttribute)return;const Y=this.#vt(S);if(Y){S.setAttribute("role","img"),S.setAttribute("aria-label",`${Y.heading||Y.label}: ${(Y.rows||[]).map(Te=>Te.value).filter(Boolean).join(", ")}`),this.emit("focus",{label:Y.label||Y.heading,value:Y.value,index:u});return}const ue=this.#e&&this.#e.series?this.#e.series[Number(S.getAttribute("data-series"))||0]:null,ce=this.#At(S)&&this.#I>=0,me=ue&&ue.points[ce?Math.min(this.#I,ue.points.length-1):Number(S.getAttribute("data-point"))||0],Me=this.#Mt(S);if(Me){S.setAttribute("role","img"),S.setAttribute("aria-label",`${Me.heading}: ${Me.rows.map(Te=>Te.value).filter(Boolean).join(", ")}`),this.emit("focus",{label:Me.datum.label,value:Me.datum.value,index:u});return}if(!me){if(!S.getBoundingClientRect)return;const Te=S.getBoundingClientRect(),Ke=this.#Be(this.#D({clientX:Te.left+Te.width/2,clientY:Te.top+Te.height/2}));if(!Ke)return;S.setAttribute("role","img"),S.setAttribute("aria-label",`${Ke.heading}: ${Ke.rows.map(ze=>ze.value).filter(Boolean).join(", ")}`),this.emit("focus",{label:Ke.datum.label,value:Ke.datum.value,index:u});return}S.setAttribute("role","img"),S.setAttribute("aria-label",`${me.label}: ${this.#e.valueText?this.#e.valueText(ue,me):this.#e.floating?this.#Ge(me):j(me.y,this.#n.messages)}`),this.emit("focus",{label:me.label,value:me.y,index:u})}#on(u){const S=this.#Ee()[u];if(!S||!S.getBoundingClientRect)return;const Y=this.#vt(S);if(Y&&Y.at){this.#We(null,Y.at);return}const ue=S.getBoundingClientRect(),ce=this.#Mt(S);this.#We({clientX:ue.left+ue.width/2,clientY:ue.top+ue.height/2},null,ce?ce.datum:null)}#Mt(u){if(!this.#e||!Array.isArray(this.#e.hnodes)||!u.getAttribute)return null;const S=u.getAttribute("data-hnode");if(S==null)return null;const Y=this.#e.hnodes[Number(S)];return Y?pn(Y,{drawn:this.#e,bound:this.#u,grid:this.#n,scheme:this.#G,spec:this.#t}):null}#Ot(u){const S=u&&u.attribution||"";S?(Tt(this.#$,S),this.#$.removeAttribute("hidden")):this.#$.setAttribute("hidden","");const Y=u&&Number.isFinite(u.aspect)&&u.aspect>0?u.aspect:null;this.#o&&this.#o.style&&(Y?this.#o.style.setProperty("aspect-ratio",String(Y)):this.#o.style.removeProperty("aspect-ratio"))}#sn(){this.#d={zoom:1,offset:[0,0]},this.#P&&this.#P.refit&&(this.#P=null),this.#ae(),this.schedule()}#Ye(u){const S=this.#d.zoom*u;this.#d={...this.#d,zoom:Math.min(8,Math.max(1,S))},this.schedule()}#Ae(u,S){const Y=this.#e&&this.#e.scale||0;if(!Y)return;const[ue,ce]=this.#d.offset;this.#d={...this.#d,offset:[ue-u/Y,ce+S/Y]},this.schedule()}#in(u,S){const Y=sr(this.#t,u.column);if(!Y||Y.kind!=="geometry"){Y&&Kt(`chart:${this.#r}:viewportFilter:globe`,`a globe's "viewportFilter" writes the visible hemisphere as one condition on a geometry column, and this chart places its rows by "lon"/"lat", so no filter was written. Place the rows with geometry: '<column>' (or name viewportFilter: { column }).`),this.#ae();return}const ue=this.#_;ue&&(ue.kind!==Y.kind||ue.column!==Y.column)&&this.#ae(),this.#_=Y;const ce=this.#n&&this.#n.filters;if(!ce||typeof ce.get!="function"||typeof ce.set!="function")return;const[me,Me]=S.globe.centre,Te=`${me.toFixed(6)},${Me.toFixed(6)}`;if(Te===this.#pe)return;this.#pe=Te;const Ke=gn(this.#s);Ke.clearTimeout&&Ke.clearTimeout(this.#L);const ze=typeof Ke.setTimeout=="function"?Ke.setTimeout.bind(Ke):setTimeout;this.#L=ze(()=>{this.#L=0;const Be=ce.get(),ht=this.#n.messages&&typeof this.#n.messages.t=="function"?this.#n.messages.t("chart.viewportFilter.label"):void 0,Ut={col:Y.column,op:"withinDistance",value:[Number(me.toFixed(6)),Number(Me.toFixed(6)),Un],...ht?{meta:{label:ht}}:{}};this.#N=[me,Me,0,0],ce.set(Jn(Be,Y,Ut))},u.debounce)}fitToSelection(){const u=this.#e&&this.#e.globe;if(!u||!this.#n||!this.#n.selection)return!1;const S=[];for(const me of this.#n.selection.keys()){const Me=u.positions.get(me);Me&&S.push(Me)}const Y=Hn(S);if(!Y)return!1;const ue=Array.isArray(this.#t.rotate)?this.#t.rotate:[0,0];let ce=(Y[0]-ue[0])%360;return ce>180&&(ce-=360),ce<-180&&(ce+=360),this.#d={...this.#d,offset:[ce*Math.PI/180,(Y[1]-ue[1])*Math.PI/180]},this.schedule(),!0}#ae(){const u=gn(this.#s);if(u.clearTimeout&&u.clearTimeout(this.#L),this.#L=0,this.#F=null,this.#pe="",!this.#N||!this.#_){this.#N=null;return}this.#N=null;const S=this.#n&&this.#n.filters;if(!S||typeof S.get!="function"||typeof S.set!="function")return;const Y=S.get(),ue=or(Y,this.#_);ue!==Y&&S.set(ue)}#an(u){const S=Mn(this.#t.viewportFilter),Y=this.#e;if(S.enabled&&vn.has(u)&&Y&&Y.globe){this.#in(S,Y);return}const ue=vn.has(u)&&!!Y&&!!Y.anchor;if(!S.enabled||!ue){this.#ae();return}const ce=sr(this.#t,S.column);if(!ce){this.#ae();return}const me=this.#_;me&&(me.kind!==ce.kind||me.column!==ce.column||me.lon!==ce.lon||me.lat!==ce.lat)&&this.#ae(),this.#_=ce;const Me=this.#n&&this.#n.filters;if(!Me||typeof Me.get!="function"||typeof Me.set!="function")return;const Te=Me.get(),Ke=Gn(Te,ce);if(Ke&&!Kn(Ke,this.#N)){this.#F={zoom:this.#d.zoom,offset:[...this.#d.offset]},this.#N=Ke,this.#ln(Ke);return}Ke||(this.#N=null);const[ze,Be]=this.#d.offset;if(this.#d.zoom===1&&ze===0&&Be===0){this.#F=null;return}const ht=this.#F;if(ht&&this.#d.zoom===ht.zoom&&ze===ht.offset[0]&&Be===ht.offset[1])return;const Ut=En(Y.anchor,Y.plot);if(!Ut||Kn(Ut,this.#N)){this.#F={zoom:this.#d.zoom,offset:[ze,Be]};return}this.#F={zoom:this.#d.zoom,offset:[ze,Be]};const Dt=gn(this.#s);Dt.clearTimeout&&Dt.clearTimeout(this.#L);const Ve=typeof Dt.setTimeout=="function"?Dt.setTimeout.bind(Dt):setTimeout;this.#L=Ve(()=>{this.#L=0;const cn=Me.get(),un=this.#n.messages&&typeof this.#n.messages.t=="function"?this.#n.messages.t("chart.viewportFilter.label"):void 0,Ze=Jn(cn,ce,Xn(ce,Ut,un));this.#N=Ut,Me.set(Ze)},S.debounce)}#ln(u){const S=this.#e;if(!S||!S.anchor||!S.plot)return;const Y=En(S.anchor,S.plot);if(this.#he&&this.#P&&!this.#t.shapes&&e(Y,u)){const[ce,me,Me,Te]=u;this.#P={baseKey:this.#he.baseKey,rings:[[[ce,me],[Me,me],[Me,Te],[ce,Te]]],refit:!0},this.#d={zoom:1,offset:[0,0]},this.schedule();return}const ue=Zn(Y,u,S.plot,{zoom:this.#d.zoom,offset:this.#d.offset,scale:S.scale});ue&&(this.#d=ue,this.schedule())}schedule(){if(this.#T||this.#q||this.#be)return;const u=gn(this.#s),S=typeof u.requestAnimationFrame=="function"?u.requestAnimationFrame.bind(u):Y=>setTimeout(Y,16);this.#be=S(()=>{this.#be=0,this.draw()})||1}draw(){if(this.#T)return;if(this.#q){Kt("chart:grid-destroyed","this chart was bound to a grid that has been destroyed, so it draws nothing. Point it at a replacement with chart.rebind(grid).");return}const u=this.#cn();let S=null;u.mode==="update"?S=this.#E.capture(this.#a,this.#Nt(this.#e)):this.#E.halt();const Y=this.#jt();if(!Y){this.#E.settle(),this.#Ze();return}const ue=this.#ft(),ce=Math.round(ue.width||An.width),me=Math.round(ue.height||An.height),Me=ce!==Y.width||me!==Y.height?this.#jt():Y;if(!Me){this.#E.settle(),this.#Ze();return}this.#un(u,S,Me),this.emit("draw",{chartType:Me.chartType,categories:Me.categories,empty:Me.empty}),this.#Ze()}#Ze(){const u=this.#De;u&&(this.#De=null,this.emit("responsive",u))}#cn(){const u=co(this.#t.animation,ur(this.#i,this.#s&&this.#s.defaultView));u.problems.length&&Kt(`chart:${this.#r}:animation:invalid`,`${u.problems.join("; ")}. The default is used in its place.`);const S=this.#je;this.#je=!1;const Y=Me=>({mode:null,reason:Me,settings:u});if(!u.on)return Y("disabled");const ue=this.#t.type,ce=tr.includes(ue)?null:$r(ue);if(ce&&ce.animates)return Y("own-motion");const me=vr(this.#s&&this.#s.defaultView);if(me)return Y(me);if(!this.#it||this.#at!==(tr.includes(ue)||ce?ue:"bar"))return u.entry?{mode:"entry",reason:"entry",settings:u}:Y("disabled");if(this.#lt>u.budget)return Y("budget");if(!S&&this.#E.running){const Me=this.#E.remaining;if(Me>0)return{mode:"update",reason:"update",settings:{...u,duration:Me}}}return S?u.update?{mode:"update",reason:"update",settings:u}:Y("disabled"):Y("view-change")}#Nt(u){const S=new Map,Y=[u&&u.series,this.#u&&this.#u.series];for(const ce of Y)if(Array.isArray(ce))for(const me of ce)me&&me.index!==void 0&&!S.has(Number(me.index))&&S.set(Number(me.index),me);const ue=u&&Array.isArray(u.arcs)?u.arcs:null;return{ident(ce){const me=ce.getAttribute("data-arc");if(me!==null&&ue){const ht=ue[Number(me)];if(ht)return`arc:${(ht.path||[ht.label]).join("")}`}const Me=ce.getAttribute("data-series");if(Me===null)return null;const Te=S.get(Number(Me)),Ke=Te?String(Te.key??Te.label??Me):Me,ze=ce.getAttribute("data-point");if(ze===null)return`s:${Ke}`;const Be=Te&&Te.points?Te.points[Number(ze)]:null;return`s:${Ke}:${Be?R(Be.x):ze}`},arc(ce){const me=ce.getAttribute("data-arc");if(me===null||!ue)return null;const Me=ue[Number(me)];if(!Me||!Me.geometry)return null;const Te=Me.geometry;return{cx:Te.cx,cy:Te.cy,inner:Te.inner,outer:Te.outer,from:Me.from,to:Me.to,draw:X}},sweepStart:ue&&ue.length?Math.min(...ue.map(ce=>ce.from)):null}}#un(u,S,Y){const ue=this.#a.marks&&this.#a.marks.childNodes?this.#a.marks.childNodes.length:0;this.#it=!0,this.#at=Y.chartType,this.#lt=ue;let ce={animated:!1,reason:u.reason,marks:ue};if(u.mode){const me=this.#e||{},Me=me.plot||null,Te=!!me.horizontal||hs.has(Y.chartType);let Ke=null;const ze=me.yScale;if(Me&&ze&&typeof ze.of=="function"&&fs.has(Y.chartType)){const ht=ze.of(0);Number.isFinite(ht)&&(Ke=Te?Math.max(Me.left,Math.min(Me.left+Me.width,ht)):Math.max(Me.top,Math.min(Me.top+Me.height,ht)))}const Be=[...this.#o.childNodes||[]].find(ht=>String(ht.tagName||"").toLowerCase()==="defs")||null;ce=this.#E.play({groups:this.#a,before:S,describe:this.#Nt(me),settings:u.settings,mode:u.mode,layout:{horizontal:Te,base:Ke,plot:Me,height:Y.height,defs:Be}})}else this.#E.release();this.#ct={animated:ce.animated,reason:ce.reason,marks:ue,budget:u.settings.budget}}#jt(){const u=this.#ft(),S=this.#e,Y=Math.round(u.width||An.width),ue=Math.round(u.height||An.height),ce=tr.includes(this.#t.type)?null:$r(this.#t.type),me=tr.includes(this.#t.type)||ce?this.#t.type:"bar";Array.isArray(this.#t.x)&&Kt(`chart:${this.#r}:x:array`,`chart "x" expects one column id (a string) and was given an array [${this.#t.x.map(at=>JSON.stringify(at)).join(", ")}]. A chart takes one category column on "x". For a hierarchy, group the grid — grid.columns.group([...]) — and the hierarchical types (pie, donut, sunburst, treemap) read the grouping.`),this.#se&&this.#se.reset();const Me=Sr(this.#t,{fills:this.#se});this.#G=Me,this.#Pe=null;const Te=N(this.#t.axis),Ke=this.#n.messages,ze=Br(this.#t);this.#K=ze;const Be=ze.small,ht=ko(this.#t);if(ht.show&&!Xr.has(me)&&!(ce&&ce.labelled)&&!this.#Me){this.#Me=!0;const at=this.#s&&this.#s.defaultView,nt=at&&at.console||(typeof globalThis<"u"?globalThis.console:null);nt&&typeof nt.warn=="function"&&nt.warn(`[lattice] a "${me}" chart does not draw data labels; "labels" has no effect on it. Types that do: ${[...Xr].join(", ")}.`)}Rn(this.#o,{viewBox:`0 0 ${Y} ${ue}`,width:Y,height:ue});const Ut=rs.has(me)||!!(ce&&ce.hierarchical),Dt=this.#Fn(me);if(Dt===Cr)return null;Dt&&Dt.over&&Kt(`chart:viewportCap:over:${this.#r}`,`this map's view holds ${Dt.over.count} matching rows, more than its viewportCap of ${Dt.over.cap}, and ${Dt.over.reason}, so it draws none of them. Zoom in, narrow the filter, or raise viewportCap.`);let Ve;if(ce&&rn({grid:this.#n,spec:this.#t,type:me,id:this.#r}),Dt)Ve=Dt;else if(ce&&typeof ce.bind=="function"){if(Ve=ce.bind(this.#n,this.#t),n.has(me)&&(Ve=this.#Bn(me,Ve)),Ve&&Array.isArray(Ve.notices))for(const at of Ve.notices)!at||!at.id||!at.message||Kt(`chart:${this.#r}:notice:${at.id}`,at.message)}else if(Ut)Ve=c(this.#n,this.#t,{count:!!(ce&&ce.count)}),this.#A&&this.#A.length&&(Ve=vs(Ve,this.#A));else if(as.has(me))Ve=E(this.#n,me==="candlestick"||me==="ohlc"?this.#hn():this.#t);else if(me==="floatingBar"||me==="horizontalFloatingBar")Ve=he(this.#n,this.#t);else if(me==="populationPyramid")Ve=_e(this.#n,this.#t);else if(me==="bullet")Ve=De(this.#n,this.#t);else if((qr.has(me)||ce&&ce.multiMeasure)&&Array.isArray(this.#t.measures)&&this.#t.measures.length)Ve=E(this.#n,this.#t);else if(me==="rangeArea")Array.isArray(this.#t.measures)&&this.#t.measures.length>=2?Ve=E(this.#n,this.#t):(Kt(`chart:${this.#r}:rangearea:form`,"a rangeArea chart fills the band between two measures and was not given two. Write `measures: [low, high]` (low first, then high), with an optional third measure typed `line` for the centre: `measures: ['avg', 'peak', { col: 'mean', type: 'line' }]`. `y` and `y2` do not form a band, so this drew a plain area."),Ve=y(this.#n,this.#t));else if(ls.has(me))Ve=v(this.#n,this.#t,me==="network"?{perRow:!0,nodes:this.#t.nodes}:void 0);else if(cs.has(me)){const at=P(this.#n);Ve={rows:at,series:[],categories:[],labels:[],measure:{col:null,fn:"sum",title:""},dimension:{col:this.#t.label||null,title:""},empty:!at.length}}else me==="geomap"?Ve=y(this.#n,{...this.#t,x:this.#t.code||this.#t.x}):Array.isArray(this.#t.points)?Ve=m(this.#t):ss.has(me)?Ve=y(this.#n,is(this.#t)):Ve=y(this.#n,this.#t);me==="waterfall"&&(Ve=T(Ve,this.#t.waterfall,Ke.t("chart.waterfallTotal")));const cn=$(Te&&Te.x,Date.now());this.#u=Ve;const un=ae(Ve,Te&&Te.x,me,cn);if(un){const at=typeof this.#t.x=="string"?` "${this.#t.x}"`:"",nt=`${Math.round(d*1e3)/10}%`;Kt(`chart:${this.#r}:x:window:ahead`,`${un.count} reading(s) on the x axis${at} were not drawn: stamped up to ${ws(un.lead)} ahead of this device's clock, which is more than the ${to(un.limit)} (${nt} of the ${to(un.span)} rolling window) a reading may run ahead and still move the window. This is a producer whose clock is wrong, not a window that is too narrow: letting that reading carry the window would push every other producer's recent readings out of it, so it is left out instead. Correct the producer's clock (NTP), or stamp readings where they are received.`)}const Ze=A({grid:this.#n,spec:this.#t,type:me,bound:Ve,axis:Te,now:cn,id:this.#r});if(!Ze.ok)return Ze.tell&&Kt(Ze.key,Ze.message),this.#yn(this.#t.emptyText||Ke.t("chart.empty")),null;if(Ve=L(Ve,Te&&Te.x,me,cn),Ve=this.#Nn(Ve,me,Te,cn),this.#u=Ve,this.#O.setAttribute("hidden",""),this.#o.removeAttribute("hidden"),q(this.#a,null),me!=="candlestick"&&me!=="ohlc"&&(St(this.#a),this.#Je()),ce){const at=ce.freeform?a({width:Y,height:ue,fontSize:Be,margin:this.#t.margin}):a({width:Y,height:ue,fontSize:Be,margin:this.#t.margin,titleSize:ze.axisTitle,titles:{left:Te.y.title,bottom:Te.x.title,right:Te.y2.title},yLabels:Lr,xLabels:Ve.labels,rotated:!0});if(this.#e=ce.draw({doc:this.#s,groups:this.#a,plot:at,bound:Ve,type:me,grid:this.#n,fontSize:Be,hidden:this.#b,scheme:Me,axis:Te,typography:ze,labels:ht,spec:this.#t,geoView:{zoom:this.#d.zoom,offset:this.#d.offset},helpers:es,redraw:()=>this.draw()})||{},this.#w(Array.isArray(this.#e.legend)?this.#e.legend:[],this.#$t(this.#e,Ve.measure&&Ve.measure.col)),Ve.over){const nt=new fe(this.#a.overlay),jt=nt.next("text",`${_t}__geo-note`);Rn(jt,{x:qn(at.left),y:qn(at.bottom),"text-anchor":"start"}),Tt(jt,Ke.t("chart.viewportOverCap",{count:Ve.over.count,cap:Ve.over.cap})),nt.finish()}this.#Gn(me)}else if(me==="treemap"){const at=a({width:Y,height:ue,fontSize:Be,padding:2,margin:this.#t.margin});this.#e=je({scheme:Me,groups:this.#a,plot:at,tree:Ve,grid:this.#n,hidden:this.#b,fontSize:Be,typography:ze,labels:ht,fill:this.#t.fill});const nt=this.#t.fill?Ir({fill:this.#t.fill,grid:this.#n},Me):null;this.#w(Ve.root.children.map((jt,Et)=>({key:jt.label,label:jt.label,index:Et,...nt?{colour:Fr(nt,jt,Me.series(Et))}:{}})))}else if(ns.has(me)){const at=a({width:Y,height:ue,fontSize:Be});this.#e=de({scheme:Me,doc:this.#s,groups:this.#a,plot:at,tree:Ve,type:me,grid:this.#n,hidden:this.#b,fontSize:Be,typography:ze,labels:ht,centre:this.#t.centre,startAngle:this.#t.startAngle,endAngle:this.#t.endAngle,radius:this.#t.radius,fill:this.#t.fill});const nt=this.#t.fill?Ir({fill:this.#t.fill,grid:this.#n},Me):null,jt=this.#n.columns&&Ve.measure&&Ve.measure.col?this.#n.columns.get(Ve.measure.col):null;this.#w(Ve.root.children.map((Et,Qt)=>({key:Et.label,label:Et.label,index:Qt,value:h(Et.total,jt,this.#n),colour:Fr(nt,Et,Me.series(Qt,Et.label))})))}else{const at=us.has(me)?a({width:Y,height:ue,fontSize:Be,margin:this.#t.margin,yLabels:me==="heatmap"?eo(me,Ve,this.#n,this.#t):[],xLabels:me==="heatmap"?Ve.labels:[],rotated:!0}):a({width:Y,height:ue,fontSize:Be,margin:this.#t.margin,titleSize:ze.axisTitle,ySide:se[me]&&!se[me].horizontal&&Te.y.position==="right"?"right":"left",titles:se[me]&&se[me].horizontal||me==="horizontalFloatingBar"||me==="populationPyramid"||me==="bullet"&&pr(me,this.#t)?{left:Te.x.title,bottom:Te.y.title,right:Te.y2.title}:se[me]&&Te.y.position==="right"?{left:Te.y2.title,bottom:Te.x.title,right:Te.y.title}:{left:Te.y.title,bottom:Te.x.title,right:Te.y2.title},rightGutter:this.#gn(me,Ve)?Math.round(Be*3):0,yLabels:eo(me,Ve,this.#n,this.#t),xLabels:pr(me,this.#t)?ms(me,this.#t)?Lr:[]:Ve.labels,rotated:!pr(me,this.#t)}),nt={doc:this.#s,groups:this.#a,plot:at,bound:Ve,type:me,grid:this.#n,fontSize:Be,hidden:this.#b,scheme:Me,axis:Te,typography:ze,labels:ht,byRuleColour:!this.#t.series,fill:this.#t.fill,marker:this.#t.marker,redraw:()=>this.draw()};if(me!=="geomap"&&this.#Ot(null),this.#t.multiples)this.#e=this.#mn(nt),this.#w([]);else if(me==="combo"||me==="pareto")this.#e=yr({...nt,pareto:me==="pareto",stack:this.#t.stack,reference:this.#t.reference,annotations:this.#t.annotations,emphasis:this.#t.emphasis,seriesStyle:this.#t.seriesStyle,curve:this.#t.curve}),this.#w(this.#le(this.#e.series,Ve.measure&&Ve.measure.col));else if(me==="floatingBar"||me==="horizontalFloatingBar")this.#e=Le(nt),this.#w(Ve.series.length>1?this.#le(Ve.series,Ve.measure&&Ve.measure.col):[]);else if(me==="populationPyramid")this.#e=Re({...nt,pyramid:this.#t.pyramid}),this.#w(this.#le(Ve.series,Ve.measure&&Ve.measure.col));else if(me==="bullet")this.#e=Xe({...nt,bullet:this.#t.bullet,min:this.#t.min,max:this.#t.max}),this.#w([]);else if(me==="heatmap")this.#e=$t({...nt,diverging:this.#t.diverging}),this.#w([],this.#$t(this.#e,Ve.measure&&Ve.measure.col));else if(me==="radar")this.#e=qe(nt),this.#w(this.#le(Ve.series,Ve.measure&&Ve.measure.col));else if(me==="gauge")this.#e=He({...nt,min:this.#t.min,max:this.#t.max,target:this.#t.target,bands:this.#t.bands,needle:this.#t.needle,ticks:this.#t.ticks,centre:this.#t.centre}),this.#w(Array.isArray(this.#e.legend)?this.#e.legend:[]);else if(me==="sankey")this.#e=Wn(nt),this.#w([]);else if(me==="chord")this.#e=ar({...nt,directed:this.#t.directed}),this.#w([]);else if(me==="network")this.#e=Ln({...nt,iterations:this.#t.iterations,icon:this.#t.icon,linkWidth:this.#t.linkWidth}),this.#w(Array.isArray(this.#e.legend)?this.#e.legend:[]);else if(me==="stream")this.#e=vt(nt),this.#w(this.#le(Ve.series,Ve.measure&&Ve.measure.col));else if(me==="marimekko")this.#e=kr(nt),this.#w(this.#le(Ve.series,Ve.measure&&Ve.measure.col));else if(me==="violin")this.#e=Rt(nt),this.#w([]);else if(me==="gantt")this.#e=ln({...nt,spec:this.#t,rows:Ve.rows||[]}),this.#w([]);else if(me==="geomap")this.#e=rr({...nt,shapes:this.#t.shapes,codeProperty:this.#t.codeProperty,diverging:this.#t.diverging,projection:this.#t.projection,projectionOptions:this.#t.projectionOptions,layer:this.#t.layer,graticule:this.#t.graticule,basemap:this.#t.basemap,zoom:this.#d.zoom,centreOffset:this.#d.offset}),this.#Tt(this.#e&&this.#e.ramp),this.#w([]),this.#Ot(this.#e);else if(me==="correlogram")this.#e=Ot({...nt,columns:this.#wn(),method:this.#t.method,values:this.#t.values}),this.#w([]);else if(me==="forest")this.#e=Z(nt),this.#w([]);else if(me==="funnel")this.#e=Nt(nt),this.#w([]);else if(me==="candlestick"||me==="ohlc")this.#e=xt({...nt,ohlc:me==="ohlc",volume:this.#Je(),volumeHeight:this.#fn(),reference:this.#t.reference,annotations:this.#t.annotations}),this.#w([]);else if(os.has(me)){if(me==="histogram")this.#e=te({...nt,buckets:this.#t.buckets,curve:this.#t.curve});else if(me==="movingRange")this.#e=ye(nt);else if(me==="control"||me==="capability"){const jt=this.#t.y||this.#t.measure,Et=this.#n&&this.#n.statistics;this.#e=(me==="capability"?ve:Oe)({...nt,capability:Et&&jt?Et.capability(jt,{by:this.#t.x,baseline:this.#t.baseline,rules:this.#t.rules,confidence:this.#t.confidence,...this.#t.spec||{}}):null})}else me==="qq"?this.#e=be(nt):me==="ecdf"?this.#e=Pe(nt):me==="lorenz"?this.#e=Se(nt):this.#e=xe(nt);this.#w([])}else{this.#e=ie({...nt,fit:this.#t.fit,trend:this.#t.trend,band:this.#t.band,error:this.#t.error,dense:Mo({series:Ve.series,canvas:this.#t.canvas}),downsampleTo:this.#t.downsample,stack:this.#t.stack,mark:this.#t.mark,reference:this.#t.reference,annotations:this.#t.annotations,sizes:this.#pn(Ve),emphasis:this.#t.emphasis,seriesStyle:this.#t.seriesStyle,curve:this.#t.curve});const jt=Array.isArray(this.#e.legend)?this.#e.legend:null;this.#w(jt||(Ve.series.length>1?this.#le(Ve.series,Ve.measure&&Ve.measure.col,Et=>Me.series(Et.index,Et.label)):[]))}}const Pt=this.#e&&this.#e.errorBars;if(this.#t.error&&Pt&&Pt.marks&&!this.#ye&&(!Pt.drawn||Pt.singleSkipped)){this.#ye=!0;const at=this.#s&&this.#s.defaultView,nt=at&&at.console||(typeof globalThis<"u"?globalThis.console:null);if(nt&&typeof nt.warn=="function"){let jt;Pt.drawn?jt=`[lattice] error bars were requested but ${Pt.singleSkipped} of ${Pt.marks} marks have a single reading behind them, so their whiskers were not drawn; the other marks are shown. A bar with no whisker is easily read as the certain one: bind those categories to the readings they summarise, or supply a margin column with \`error: { of: "column" }\`.`:jt=Pt.single===Pt.marks?'[lattice] error bars were requested but every mark has a single reading behind it, so there is no spread to compute. A chart bound to a summary or derived grid sees one row per mark: bind it to the rows the summary was computed from, or supply a margin column with `error: { of: "column" }`.':"[lattice] error bars were requested but no mark had enough readings to compute an interval.",nt.warn(jt)}}return this.#Qe(S,this.#e),this.#qe(ce&&this.#e?this.#e.controls:null),this.#e&&(this.#e.plot=this.#e.plot||As(this.#e,Y,ue)),this.#u&&(this.#u.outside=this.#e&&this.#e.outside||0),this.#t.selection&&this.#wt(),this.#Pt(),this.#An(me,Ve,Ut),this.#On(me),this.#an(me),this.#$n(),this.#Ln(me),this.#Zt(me),this.#p.sync({drawn:this.#e,bound:Ve,spec:this.#t,type:me}),this.#dn(Te),{width:Y,height:ue,chartType:me,categories:Ve.categories||[],empty:!!Ve.empty}}#Je(){const u=this.#t.volume;if(u==null||u==="")return null;const S=this.#t.type;return S!=="candlestick"&&S!=="ohlc"?(Kt(`chart:${this.#r}:volume:type:${S}`,`"volume" adds a volume pane under a candlestick's (or an ohlc's) price pane, and this chart's type is ${JSON.stringify(S)}, so no volume pane was drawn. Set type: 'candlestick' or 'ohlc', or draw the volume as its own bar chart.`),null):typeof u!="string"||!this.#n.columns||!this.#n.columns.get(u)?(Kt(`chart:${this.#r}:volume:missing-column`,`"volume" names ${JSON.stringify(u)}, which is not a column of this grid, so the chart was drawn without a volume pane. Name the column that holds each period's traded volume by its id.`),null):u}#fn(){const u=this.#t.volumePane,S=u&&typeof u=="object"?u.height:void 0;return S===void 0?Bt:typeof S=="number"&&S>0&&S<1?S:(Kt(`chart:${this.#r}:volumePane:height`,`"volumePane.height" is the volume pane's share of the plot's height, a number above 0 and below 1, and was given ${JSON.stringify(S)}, so the default of ${Bt} was used.`),Bt)}#hn(){const u=this.#Je(),S=Array.isArray(this.#t.measures)?this.#t.measures:[];if(!u||S.length<4)return this.#t;const Y=ce=>typeof ce=="string"?ce:ce&&ce.col,ue=S.slice(4).filter(ce=>Y(ce)!==u);return{...this.#t,measures:[...S.slice(0,4),{col:u,fn:"sum"},...ue]}}#dn(u){const S=ke(u&&u.x),Y=S?Math.min(ps,Math.max(ys,Math.floor(S/4))):0;if(this.#T||!Y){this.#Xe();return}if(this.#fe&&this.#Ie===Y)return;this.#Xe(),this.#Ie=Y;const ue=gn(this.#s),ce=ue&&typeof ue.setInterval=="function"?ue.setInterval.bind(ue):setInterval;this.#fe=ce(()=>{this.#T||this.#s&&this.#s.hidden||this.#l&&this.#l.isConnected===!1||this.schedule()},Y);const me=this.#fe;me&&typeof me.unref=="function"&&me.unref()}#Xe(){if(this.#fe===null)return;const u=gn(this.#s);(u&&typeof u.clearInterval=="function"?u.clearInterval.bind(u):clearInterval)(this.#fe),this.#fe=null,this.#Ie=0}#mn(u){const S=Xt(u.bound),Y=Zt({count:S.length,plot:u.plot}),ue=[];for(const Ke of u.bound.series)for(const ze of Ke.points)ue.push(ze.y);const ce=o(ue,{zero:u.type!=="line"}),me=new fe(this.#a.overlay);q(this.#a,u.plot);const Me=new fe(this.#a.marks);new fe(this.#a.grid).finish(),new fe(this.#a.axis).finish(),new fe(this.#a.rules).finish();let Te=null;for(let Ke=0;Ke<Y.length;Ke++){const ze=Y[Ke],Be=S[Ke],ht={left:ze.x,top:ze.y,width:ze.width,height:ze.height,right:ze.x+ze.width,bottom:ze.y+ze.height,gutter:{left:0,bottom:0}};Te=ie({...u,plot:ht,bound:Be.bound,domain:ce,pool:Me,axes:!1});const Ut=me.next("text",`${_t}__panel-title`);Rn(Ut,{x:qn(ze.x),y:qn(ze.y-4),"text-anchor":"start"}),Tt(Ut,Be.label)}return Me.finish(),me.finish(),{...Te||{},panels:Y,multiples:!0}}#gn(u,S){return u==="combo"||u==="pareto"?!0:!qr.has(u)||u==="horizontalBar"||u==="waterfall"?!1:!!(S&&Array.isArray(S.series)&&S.series.some(Y=>Y.axis==="right"&&!this.#b.has(Y.key)))}#pn(u){if(this.#t.type!=="bubble"||!this.#t.size)return null;const S=[];for(const ue of u.series||[])for(const ce of ue.points)typeof ce.size=="number"&&S.push(ce.size);const Y=Hr(S);return Y?l(Y,[3,Math.max(6,Math.min(28,this.#t.maxRadius||22))]):null}#Qe(u,S){!u||u===S||typeof u.dispose!="function"||S&&S.stateKey!==void 0&&S.stateKey===u.stateKey||u.dispose()}#qe(u){const S=this.#k;S&&S!==u&&S.parentNode&&S.parentNode.removeChild(S),this.#k=u||null,u&&!u.parentNode&&this.#o&&this.#o.parentNode&&this.#o.parentNode.insertBefore(u,this.#o.nextSibling)}#yn(u){this.#Pt(),Tt(this.#O,u),this.#O.removeAttribute("hidden"),this.#o.setAttribute("hidden","");for(const S of Object.values(this.#a))Fn(S);this.#p&&this.#p.clear(),Fn(this.#m),Fn(this.#c),this.#Qe(this.#e,null),this.#e=null,this.#qe(null)}#Pt(){const u=this.#n.licence;if(!!!(u&&typeof u.watermark=="function"&&u.watermark())){this.#U&&this.#U.parentNode&&this.#U.parentNode.removeChild(this.#U),this.#U=null;return}if(this.#U&&this.#U.parentNode)return;const Y=this.#s,ue=mt(Y,"div",`${_t}__watermark`);ue.setAttribute("role","note");const ce=mt(Y,"a",`${_t}__watermark-link`);ce.setAttribute("href","https://www.latticegrid.dev"),ce.setAttribute("target","_blank"),ce.setAttribute("rel","noopener noreferrer"),Tt(ce,this.#n.messages.t("licence.watermark")),ue.appendChild(ce),this.#U=ue,this.#l&&this.#l.appendChild(ue)}#bn(){const u=this.#t.legend;if(u===!1)return{show:!1,position:"bottom",align:"start",shape:"square",maxItems:0,isolate:!1,values:!1,title:""};const S=u&&typeof u=="object"?u:{};return{show:!0,position:["top","bottom","left","right"].includes(S.position)?S.position:"bottom",align:["start","centre","center","end"].includes(S.align)?S.align:"start",shape:["square","circle","line"].includes(S.shape)?S.shape:"square",maxItems:Number.isFinite(S.maxItems)&&S.maxItems>0?Number(S.maxItems):0,isolate:!!S.isolate,values:!!S.values,title:typeof S.title=="string"?S.title:""}}#le(u,S,Y){const ue=S&&this.#n.columns?this.#n.columns.get(S):null;return(u||[]).map(ce=>({key:ce.key,label:ce.label,index:ce.index,value:h(gs(ce),ue,this.#n),...Y?{colour:Y(ce)}:{}}))}#wn(){const u=this.#t.columns;if(Array.isArray(u)&&u.length)return u.slice(0,Qr);const S=this.#n;return!S||!S.columns||typeof S.columns.visible!="function"?[]:S.columns.visible().filter(Y=>!Y.generated&&(Y.type==="number"||Y.type==="currency"||Y.type==="percent"||Y.type==="integer")).map(Y=>Y.id).slice(0,Qr)}#w(u,S=null){Fn(this.#m);const Y=this.#bn();if(Rn(this.#m,{"data-position":Y.position,"data-align":Y.align}),!Y.show||!u.length&&!S)return;const ue=this.#s;if(S&&this.#m.appendChild(this.#kn(S,Y)),!u.length)return;const ce=Y.maxItems?u.slice(0,Y.maxItems):u;for(const me of ce){const Me=mt(ue,"button",`${_t}__legend-item`);Me.setAttribute("type","button");const Te=!this.#b.has(me.key);Me.setAttribute("aria-pressed",Te?"true":"false");const Ke=mt(ue,"span",`${_t}__swatch ${_t}__swatch--${Y.shape}`);Ke.setAttribute("style",`background:${Dr(me.colour||this.#G.series(me.index))}`);const ze=mt(ue,"span");Dn(ze,this.#K.small),Tt(ze,Y.values&&me.value?`${me.label} ${me.value}`:me.label),zn(Me,[Ke,ze]),Me.addEventListener("click",()=>{this.#xn(me,u,Y)}),this.#m.appendChild(Me)}if(Y.maxItems&&u.length>ce.length){const me=mt(ue,"span",`${_t}__legend-more`);Dn(me,this.#K.small),Tt(me,this.#n.messages.t("chart.legendMore",{count:u.length-ce.length})),this.#m.appendChild(me)}}#kn(u,S){const Y=this.#s,ue=mt(Y,"div",`${_t}__legend-ramp`);if(S.title){const ze=mt(Y,"span",`${_t}__legend-ramp-title`);Dn(ze,this.#K.small),Tt(ze,S.title),ue.appendChild(ze)}const ce=mt(Y,"span",`${_t}__legend-ramp-label`);Dn(ce,this.#K.small),Tt(ce,u.minLabel);const me=mt(Y,"span",`${_t}__legend-ramp-bar`),Me=S.position==="left"||S.position==="right";me.setAttribute("style",`background:linear-gradient(${Me?"to top":"to right"}, ${u.colours.join(",")})`),ue.setAttribute("data-scale",u.scale||"linear");const Te=Array.isArray(u.ticks)?u.ticks:[];Te.length&&ue.setAttribute("data-ticks",String(Te.length));for(const ze of Te){const Be=mt(Y,"span",`${_t}__legend-ramp-tick`);Dn(Be,this.#K.small);const ht=Math.round(Math.min(1,Math.max(0,ze.t))*1e3)/10;Be.setAttribute("style",Me?`bottom:${ht}%`:`left:${ht}%`),Be.setAttribute("data-value",String(ze.value)),Tt(Be,ze.label),me.appendChild(Be)}const Ke=mt(Y,"span",`${_t}__legend-ramp-label`);return Dn(Ke,this.#K.small),Tt(Ke,u.maxLabel),zn(ue,[ce,me,Ke]),ue}#$t(u,S){if(!u||typeof u.ramp!="function"||!u.domain)return null;const Y=u.ramp;this.#Tt(Y);const ue=Y.scale==="log"||Y.scale==="quantile",{min:ce,max:me}=ue&&Y.domain?Y.domain:u.domain;if(!Number.isFinite(ce)||!Number.isFinite(me))return null;const Me=S&&this.#n.columns?this.#n.columns.get(S):null,Te=[];if(Y.scale==="quantile"&&Y.classes>1)for(let ze=0;ze<Y.classes;ze++){const Be=Y.colourAt(ze/(Y.classes-1)),ht=Math.round(ze/Y.classes*1e3)/10,Ut=Math.round((ze+1)/Y.classes*1e3)/10;Te.push(`${Be} ${ht}% ${Ut}%`)}else if(ue)for(let ze=0;ze<6;ze++)Te.push(Y.colourAt(ze/5));else for(let Be=0;Be<6;Be++){const ht=Be/5;Te.push(Y(ce+(me-ce)*ht))}const Ke=ue&&Array.isArray(Y.ticks)?Y.ticks.map(ze=>({t:ze.t,value:ze.value,label:h(ze.value,Me,this.#n)})):[];return{colours:Te,minLabel:h(ce,Me,this.#n),maxLabel:h(me,Me,this.#n),scale:Y.scale||"linear",ticks:Ke}}#Tt(u){typeof u!="function"||!u.scale||(this.#Pe={scale:u.scale,auto:!!u.auto,ratio:u.ratio||0},u.auto&&u.scale==="log"&&Io(`chart:${this.#r}:ramp:log`,`chart ${this.#t.type} is coloured on a log ramp scale: its values span ${Math.round(u.ratio).toLocaleString("en")}:1, past the 100:1 at which a linear ramp leaves all but the largest in its palest shade. Set ramp: { scale: "linear" } to keep it linear.`))}#xn(u,S,Y){if(Y.isolate){const ue=S.filter(me=>me.key!==u.key),ce=ue.every(me=>this.#b.has(me.key))&&!this.#b.has(u.key);if(this.#b.clear(),!ce)for(const me of ue)this.#b.add(me.key)}else this.#b.has(u.key)?this.#b.delete(u.key):this.#b.add(u.key);this.emit("legend",{label:u.label,key:u.key,hidden:this.#b.has(u.key),hiddenKeys:[...this.#b]}),this.#je=!0,this.draw()}#vn(){const u=this.#n.messages,S=this.#C.viewport;return S?S.over?u.t("chart.viewportOverCap",{count:S.matched,cap:S.cap}):S.binned?u.t(S.computed==="client"?"chart.summaryClientDensity":"chart.summaryEngineDensity",{count:S.matched,cap:S.cap,cells:S.cells}):u.t("chart.summaryEngineViewport",{count:S.rows}):u.t("chart.summaryEngine")}#An(u,S,Y){const ue=this.#n.messages,ce=S.measure&&S.measure.title||"",me=S.dimension&&S.dimension.title||"",Me=ce?me&&!Y?"chart.summary":"chart.summaryShare":"chart.summaryType";let Te=ue.t(Me,{type:Jr(ue,u),measure:ce,dimension:me});if(u==="gauge"&&this.#e&&typeof this.#e.reading=="string"){const at=this.#e.fn==="mean"?"avg":this.#e.fn;Te=ue.t("chart.summaryGauge",{type:Jr(ue,u),measure:ce,fn:ue.t(`total.${at}`),value:this.#e.reading})}const Ke=this.#C.source==="engine"||this.#C.viewport?this.#vn():"",ze=Ke?`${Te}. ${Ke}`:Te;Rn(this.#o,{"aria-label":this.#e&&this.#e.level?`${ze}: ${this.#e.level}`:ze}),Fn(this.#c);const Be=this.#s,ht=this.#e&&this.#e.table;if(ht&&Array.isArray(ht.head)&&Array.isArray(ht.rows)){this.#e.summary&&Rn(this.#o,{"aria-label":String(this.#e.summary)});const at=mt(Be,"table"),nt=mt(Be,"caption");Tt(nt,ue.t("chart.dataTable")),at.appendChild(nt);const jt=mt(Be,"tr");for(const Et of ht.head){const Qt=mt(Be,"th");Tt(Qt,String(Et)),jt.appendChild(Qt)}at.appendChild(jt);for(const Et of ht.rows){const Qt=mt(Be,"tr");Et.forEach((Pn,Sn)=>{const dn=mt(Be,Sn===0?"th":"td");Tt(dn,Pn==null?"":String(Pn)),Qt.appendChild(dn)}),at.appendChild(Qt)}if(this.#c.appendChild(at),ht.note){const Et=mt(Be,"p",`${_t}__table-note`);Tt(Et,String(ht.note)),this.#c.appendChild(Et)}return}const Ut=mt(Be,"table"),Dt=mt(Be,"caption");Tt(Dt,ue.t("chart.dataTable")),Ut.appendChild(Dt);const Ve=mt(Be,"tr"),cn=mt(Be,"th");Tt(cn,Y?"":me),Ve.appendChild(cn);const un=[];if(this.#e&&Array.isArray(this.#e.hnodes)&&S.root){for(const nt of this.#e.hnodes){if(nt.hidden)continue;const jt=mt(Be,"tr"),Et=mt(Be,"th");Tt(Et,(nt.path&&nt.path.length?nt.path:[nt.label]).join(" › "));const Qt=mt(Be,"td");Tt(Qt,j(nt.node.total,ue)),zn(jt,[Et,Qt]),un.push(jt)}const at=mt(Be,"th");Tt(at,ce),Ve.appendChild(at)}else if(Y&&S.root){for(const nt of S.root.children){const jt=mt(Be,"tr"),Et=mt(Be,"th");Tt(Et,nt.label);const Qt=mt(Be,"td");Tt(Qt,j(nt.total,ue)),zn(jt,[Et,Qt]),un.push(jt)}const at=mt(Be,"th");Tt(at,ce),Ve.appendChild(at)}else if(Array.isArray(S.links)&&!(S.series&&S.series.length)){const at=mt(Be,"th");Tt(at,ce),Ve.appendChild(at);for(const nt of S.links){const jt=mt(Be,"tr"),Et=mt(Be,"th");Tt(Et,`${nt.source.label} → ${nt.target.label}`);const Qt=mt(Be,"td");Tt(Qt,j(nt.value,ue)),zn(jt,[Et,Qt]),un.push(jt)}}else{const at=this.#$e(),nt=this.#e&&Array.isArray(this.#e.labels)&&Array.isArray(this.#e.series)&&Array.isArray(this.#e.categories)?this.#e.series:S.series||[];for(const jt of nt){const Et=mt(Be,"th");Tt(Et,jt.label),Ve.appendChild(Et)}for(let jt=0;jt<(at.labels||[]).length;jt++){const Et=mt(Be,"tr"),Qt=mt(Be,"th");Tt(Qt,at.labels[jt]),Et.appendChild(Qt);for(const Pn of nt){const Sn=mt(Be,"td"),dn=Pn.points[jt];Tt(Sn,dn&&dn.y!==null?this.#e&&this.#e.valueText?this.#e.valueText(Pn,dn):S.floating?this.#Ge(dn):j(dn.y,ue):""),Et.appendChild(Sn)}un.push(Et)}}Ut.appendChild(Ve);for(const at of un)Ut.appendChild(at);this.#c.appendChild(Ut);const Ze=this.#e&&Number(this.#e.unplaced);if(Ze>0){const at=mt(Be,"p",`${_t}__table-note`);Tt(at,ue.t("chart.geoUnmatched",{count:Ze})),this.#c.appendChild(at)}const Pt=this.#e&&this.#e.annotations;if(Array.isArray(Pt)&&Pt.length){const at=mt(Be,"ul",`${_t}__annotation-list`);for(const nt of Pt){if(!nt||!nt.text)continue;const jt=mt(Be,"li");Tt(jt,nt.text),at.appendChild(jt)}at.childNodes&&at.childNodes.length&&this.#c.appendChild(at)}}#Sn(u){const S=this.#c;if(!S)return;const Y=u.join(`
|
|
414
|
-
`),ue=this.#_e;if(ue&&ue.parentNode===S&&this.#rt===Y||(ue&&ue.parentNode&&ue.parentNode.removeChild(ue),this.#_e=null,this.#rt=Y,!u.length))return;const ce=S.ownerDocument,me=mt(ce,"ul",`${_t}__drawn-list`);for(const Me of u){const Te=mt(ce,"li");Tt(Te,Me),me.appendChild(Te)}S.appendChild(me),this.#_e=me}on(u,S){return typeof S!="function"?()=>{}:(this.#B.has(u)||this.#B.set(u,new Set),this.#B.get(u).add(S),()=>{const Y=this.#B.get(u);Y&&Y.delete(S)})}emit(u,S){const Y={...S,type:u,chart:this,grid:this.#n},ue=this.#t,ce=u.split(/[:\-_.]/).filter(Boolean).map(Te=>`${Te.charAt(0).toUpperCase()}${Te.slice(1)}`).join(""),me=[`on${u.charAt(0).toUpperCase()}${u.slice(1)}`,`on${ce}`].map(Te=>ue[Te]).find(Te=>typeof Te=="function"),Me=[...this.#B.get(u)||[]];typeof me=="function"&&Me.unshift(me);for(const Te of Me)try{Te(Y)}catch(Ke){const ze=gn(this.#s);ze.console&&typeof ze.console.error=="function"&&ze.console.error(`[lattice] a chart "${u}" listener threw`,Ke)}return Y}#Mn(){const u=this.#e;return u&&u.anchor&&vn.has(this.#t.type)?{plot:u.plot,xScale:u.anchor.xScale,yScale:u.anchor.yScale}:u}#On(u){const S=wt(this.#t.annotate,typeof this.#t.measure=="string"?void 0:this.#t.measure),Y=S.enabled&&vn.has(u)&&!!this.#e&&!this.#e.anchor;Y&&Kt(`chart:${this.#r}:annotate:projection`,`"annotate" anchors a drawing on a ${JSON.stringify(u)} in longitude and latitude, and this map is drawn through a projection with no written inverse, so no rail was added. Draw it through projection: 'mercator' or 'equirectangular' to annotate it.`);const ue=S.enabled&&Tr.has(u)&&!Y;if(S.enabled&&!Tr.has(u)&&Kt(`chart:${this.#r}:annotate:type:${u}`,`"annotate" adds a drawing rail to a chart with two readable axes and ${JSON.stringify(u)} has none, so no rail was added. The types that take one are ${[...Tr].sort().join(", ")}.`),!ue){this.#g&&(this.#g.destroy(),this.#g=null);return}this.#g?this.#g.configure(S):(this.#g=new Ce({doc:this.#s,root:this.#l,plot:this.#o,groups:this.#a,t:(ce,me)=>this.#n.messages.t(ce,me),drawn:()=>this.#Mn(),described:ce=>this.#Sn(ce),format:()=>this.#zn(),formatSide:ce=>me=>this.#Ue(me,ce),number:(ce,me)=>this.#n.messages.number(ce,me===void 0?{maximumSignificantDigits:4}:{maximumFractionDigits:me}),series:()=>this.#bt(),bound:()=>this.#u,notify:(ce,me,Me)=>{const Te=Me?{item:me,readout:Me}:{item:me};ce==="added"?this.emit("annotation:added",Te):ce==="changed"?this.emit("annotation:changed",Te):this.emit("annotation:removed",Te)}},S),this.#R&&(this.#g.setItems(this.#R),this.#R=null)),this.#g.redraw()}#Nn(u,S,Y,ue){const ce=pt(this.#t.zoom);if(this.#W=ce.enabled&&gr.has(S),ce.enabled&&!gr.has(S)&&Kt(`chart:${this.#r}:zoom:type:${S}`,`"zoom" narrows a chart's own axes and ${JSON.stringify(S)} has none to narrow, so no zoom was added. The types that take one are ${[...gr].sort().join(", ")}.`),!this.#W)return this.#j={x:null,y:null},this.#h={x:null,y:null},this.#S=u.categories||[],this.#Ne={first:0,last:Math.max(0,this.#S.length-1)},u;this.#J=S==="heatmap"||we(u,S,Y&&Y.x),this.#we=S==="heatmap",this.#we&&ce.axes!=="x"&&Kt(`chart:${this.#r}:zoom:heatmap:axes`,`a heatmap zooms its columns (the x axis) only; its rows are a band of series with no measure axis behind them, so zoom.axes ${JSON.stringify(ce.axes)} zoomed x alone. Leave zoom.axes at its default, x.`),this.#S=u.categories||[],this.#j.x=this.#J?this.#S.length>1?{min:0,max:this.#S.length-1}:null:W(u,S,Y&&Y.x,ue),this.#Cn(u.kind),ce.axes==="y"&&!this.#we&&(this.#h.x=null),(ce.axes==="x"||this.#we)&&(this.#h.y=null),this.#jn(ce),this.#h.x=kt(this.#h.x,this.#j.x),this.#h.y=kt(this.#h.y,this.#j.y);let me=u;const Me=this.#h.x;if(this.#J){const{first:Te,last:Ke}=Qe(Me,this.#S.length);this.#Ne={first:Te,last:Ke},Me&&this.#ee.frozen?me=zt(me,new Set(this.#S.slice(Te,Ke+1).map(ze=>R(ze)))):Me&&(me=Gt(me,Te,Ke))}else this.#Ne={first:0,last:Math.max(0,this.#S.length-1)},Me&&(me={...me,xDomain:{min:Me.from,max:Me.to}});return this.#h.y&&(me={...me,yDomain:{min:this.#h.y.from,max:this.#h.y.to}}),me}#jn(u){const S=this.#ue;if(!S)return;const Y={};for(const ue of["x","y"]){if(!(ue in S)||u.axes!=="xy"&&u.axes!==ue)continue;if(!this.#j[ue]){Y[ue]=S[ue];continue}this.#h[ue]=this.#et(ue,S[ue])}this.#ue=Object.keys(Y).length?Y:null}#et(u,S){const Y=this.#j[u];if(!Y)return null;const ue=Array.isArray(S)?S:S&&S.range;if(!Array.isArray(ue)||ue.length<2)return null;const ce=u==="x"&&this.#J?ue.map(Me=>this.#Pn(Me)):ue.map(Me=>this.#u&&this.#u.kind==="time"&&u==="x"?Vr(Me):Wr(Me));if(ce.some(Me=>Me===null||!Number.isFinite(Me)))return Kt("chart:zoom:range","a chart zoom range named a value this chart's axis does not have, so the zoom was left alone. An x range on a category axis names two categories; on a continuous or time axis it is two readings, and a measure range is two values."),null;const me=Ye(ce,Y);return me&&S&&S.pinned?kt({...me,pinned:!0},Y):me}#Pn(u){const S=R(u);for(let Y=0;Y<this.#S.length;Y++)if(R(this.#S[Y])===S)return Y;return null}#$n(){const u=pt(this.#t.zoom),S=this.#W&&u.enabled;if(this.#o.style&&S!==this.#ot&&(this.#o.style.touchAction=S?"none":"",this.#ot=S),!this.#W||u.buttons==="none")this.#tt();else{if(this.#H&&this.#H.buttons!==u.buttons&&this.#tt(),!this.#H){const Y=ut({doc:this.#s,t:ce=>this.#n.messages.t(ce),controls:[...et],buttons:u.buttons,onPress:ce=>this.#ce(ce,"button")});this.#H={...Y,buttons:u.buttons};const ue=this.#o.parentNode;ue&&ue.appendChild(Y.element)}this.#H.sync({zoomed:!!(this.#h.x||this.#h.y),narrowest:this.#Tn(u)})}if(this.#W&&!this.#we&&!this.#h.y){const Y=this.#e&&this.#e.yScale&&this.#e.yScale.domain;Y&&Number.isFinite(Y.min)&&Number.isFinite(Y.max)&&(this.#j.y={min:Y.min,max:Y.max},this.#ue&&"y"in this.#ue&&this.schedule())}}#Tn(u){for(const S of["x","y"]){const Y=this.#j[S],ue=this.#h[S];if(!Y||!ue)continue;const ce=Y.max-Y.min;if(ce>0&&ue.to-ue.from>ce*u.min*1.0001)return!1}return!!(this.#h.x||this.#h.y)}#tt(){this.#H&&this.#H.element.parentNode&&this.#H.element.parentNode.removeChild(this.#H.element),this.#H=null}#me(u,S){if(!this.#W)return!1;const Y=pt(this.#t.zoom);let ue=!1;for(const ce of["x","y"]){if(Y.axes!=="xy"&&Y.axes!==ce)continue;const me=this.#j[ce];if(!me)continue;const Me=kt(u(ce,this.#h[ce],me,Y),me);Ht(Me,this.#h[ce])||(this.#h[ce]=Me,ue=!0)}return ue?(this.#ee.moved=!0,this.draw(),this.emit("zoom",this.#Lt(S)),S!=="group"&&this.#y&&this.#y.zoomed(this.#h.x?{x:this.#Se("x")}:{reset:!0}),!0):!1}#ce(u,S,Y){return u==="reset"?this.#me(()=>null,"reset"):this.#me((ue,ce,me,Me)=>{const Te=Y&&Number.isFinite(Y[ue])?Y[ue]:null;return u==="in"?rt(ce,me,1-Me.step,Te,Me.min):u==="out"?rt(ce,me,1/(1-Me.step),Te,Me.min):ue!=="x"?ce:Vt(ce,me,u==="left"?-Me.step:Me.step)},S)}#En(u,S,Y){return!(u>0)||!Number.isFinite(u)?!1:this.#me((ue,ce,me,Me)=>{const Te=Y&&Number.isFinite(Y[ue])?Y[ue]:null;return rt(ce,me,u,Te,Me.min)},S)}#Cn(u){const S=this.#ee,Y=this.#n&&this.#n.filters;if(!Y||typeof Y.get!="function")return;const ue=Mt(Y.get(),this.#r);ue.x&&!S.frozen&&S.full&&(S.frozen=S.full),ue.x&&S.frozen?this.#J?(this.#S=S.frozen.all,this.#j.x=this.#S.length>1?{min:0,max:this.#S.length-1}:null):this.#j.x=Yt(S.frozen.extent,this.#j.x):ue.x||(S.frozen=null,S.full={extent:this.#j.x,all:this.#S});for(const ce of["x","y"]){const me=S.written[ce],Me=ue[ce];if(bt(me)===bt(Me))continue;if(S.written[ce]=Me,!Me){this.#h[ce]&&(this.#h[ce]=null,S.reset=!0);continue}const Te=ce==="x"?this.#J?"category":u:"linear",Ke=Ct(Me,Te,this.#j[ce]),ze=Ke?this.#et(ce,Ke):null;ze&&!Ht(ze,this.#h[ce])&&(this.#h[ce]=ze,S.reset=!0)}}#Et(u){return it.has(u)?(this.#u&&this.#u.series||[]).every(Y=>(Y.points||[]).every(ue=>!ue||!(ue.rows>1))):!1}#Ct(u){const S=Mn(this.#t.viewportFilter),Y=this.#u||{},ue=S.column||Y.dimension&&Y.dimension.col||(typeof this.#t.x=="string"?this.#t.x:null),ce=dt({column:ue,axis:"x",chart:this.#r,banded:this.#J,kind:Y.kind,view:this.#h.x,categories:this.#S,readings:this.#ee.frozen?[...this.#ee.frozen.all,...this.#S]:this.#S,wall:this.#xt(ue)});let me=null;return this.#h.y&&this.#Et(u)&&(me=dt({column:Y.measure&&Y.measure.col||null,axis:"y",chart:this.#r,banded:!1,kind:"linear",view:this.#h.y})),{x:ce,y:me}}#Ln(u){const S=Mn(this.#t.viewportFilter),Y=this.#ee;if(Y.type=u,Y.reset&&(Y.reset=!1,this.emit("zoom",this.#Lt("filter")),this.#y&&this.#y.zoomed(this.#h.x?{x:this.#Se("x")}:{reset:!0})),!S.enabled||!gr.has(u)){Y.moved=!1,this.#nt();return}if(!this.#W){Kt(`chart:${this.#r}:viewportFilter:zoom`,`"viewportFilter" on a ${u} chart filters the grid to the range the chart is zoomed to, and this chart has no zoom, so the grid was left alone. Set zoom: true as well.`),Y.moved=!1,this.#nt();return}this.#h.y&&!this.#Et(u)&&Kt(`chart:${this.#r}:viewportFilter:y`,`"viewportFilter" filtered the grid by the x range only: this ${u} chart's measure axis shows values combined over several rows at one x rather than any one row's value, so its y zoom narrows the picture but not the grid. A scatter or bubble with one row per point filters by y as well.`);const ue=Y.moved;Y.moved=!1;const ce=this.#Ct(u),me=gn(this.#s);if(bt(ce.x)===bt(Y.written.x)&&bt(ce.y)===bt(Y.written.y)){Y.timer&&me.clearTimeout&&me.clearTimeout(Y.timer),Y.timer=0;return}if(Y.timer&&!ue)return;Y.timer&&me.clearTimeout&&me.clearTimeout(Y.timer);const Me=typeof me.setTimeout=="function"?me.setTimeout.bind(me):setTimeout;Y.timer=Me(()=>{Y.timer=0,this.#T||this.#_n()},S.debounce)}#_n(){const u=this.#ee,S=this.#n&&this.#n.filters;if(!S||typeof S.get!="function"||typeof S.set!="function")return;const Y=this.#Ct(u.type);if(bt(Y.x)===bt(u.written.x)&&bt(Y.y)===bt(u.written.y))return;const ue=S.get(),ce=en(ue,this.#r,[Y.x,Y.y].filter(Boolean)),me=u.frozen;Y.x&&!me&&(u.frozen={extent:this.#j.x,all:this.#S}),u.written={x:Y.x,y:Y.y},S.set(ce);const Me=Mt(S.get(),this.#r);(bt(Me.x)!==bt(Y.x)||bt(Me.y)!==bt(Y.y))&&(u.written={x:Me.x,y:Me.y},u.frozen=Me.x?me:null)}#nt(){const u=this.#ee,S=gn(this.#s);u.timer&&S.clearTimeout&&S.clearTimeout(u.timer),u.timer=0,u.frozen=null,u.written={x:null,y:null};const Y=this.#n&&this.#n.filters;if(!Y||typeof Y.get!="function"||typeof Y.set!="function")return;const ue=Y.get(),ce=Lt(ue,this.#r);ce!==ue&&Y.set(ce)}#Lt(u){const S=pt(this.#t.zoom),Y={x:this.#Se("x"),reason:u};return(S.axes==="y"||S.axes==="xy")&&(Y.y=this.#Se("y")),Y}#Se(u){const S=this.#j[u];if(!S)return null;const Y=this.#h[u];if(u==="x"&&this.#J){const{first:ue,last:ce}=Qe(Y,this.#S.length);return[this.#S[ue],this.#S[ce]]}return Y?[Y.from,Y.to]:[S.min,S.max]}#_t(u){const S={x:null,y:null};if(!this.#e)return S;if(this.#J){const ue=this.#ht(u);ue>=0&&(S.x=this.#Ne.first+ue)}else if(this.#e.xScale&&typeof this.#e.xScale.invert=="function"){const ue=this.#e.xScale.invert(this.#e.horizontal?u.y:u.x);Number.isFinite(ue)&&(S.x=ue)}const Y=this.#e.yScale;if(Y&&typeof Y.invert=="function"){const ue=Y.invert(this.#e.horizontal?u.x:u.y);Number.isFinite(ue)&&(S.y=ue)}return S}get zoom(){return this.#Re||(this.#Re=Object.freeze({set:u=>this.#Rt(u),reset:()=>this.#ce("reset","reset")})),this.#Re}#Rt(u,S="api"){if(!this.#W)return Kt(`chart:${this.#r}:zoom:off`,'chart.zoom.set() was called on a chart with no zoom, so nothing moved. Set `zoom: true` on a cartesian chart (or `zoom: { buttons: "none" }` to drive it from your own controls) before setting a range.'),!1;const Y=Array.isArray(u)?{x:u}:u||{};return this.#me((ue,ce)=>ue in Y?this.#et(ue,Y[ue]):ce,S)}#Rn(){const u={};for(const S of["x","y"]){const Y=this.#h[S];Y&&(u[S]={range:this.#Se(S),pinned:!!Y.pinned})}return Object.keys(u).length?u:null}#zn(){const u=this.#e&&this.#e.yScale&&this.#e.yScale.domain||null,S=u&&Number.isFinite(u.max)&&Number.isFinite(u.min)?(u.max-u.min)/5:0;return mr(this.#n,{kind:"linear",step:S}).tick}state(){const u={annotations:this.#g?this.#g.list():We(this.#R).map(lt)},S=this.#Rn();return S&&(u.zoom=S),u}setState(u){if(this.#g?this.#g.setItems(u):this.#R=u,!u||Array.isArray(u))return;const S=u.zoom;this.#ue=S&&typeof S=="object"?{...S}:null,this.#ue||(this.#h={x:null,y:null}),this.schedule()}data(){return this.#u}provenance(){const u=this.#C;return{source:u.source,asked:u.asked,reason:u.reason??null,refused:!!u.refused,pending:!!u.pending,measures:u.measures.map(S=>({...S})),animation:{...this.#ct},...u.viewport?{viewport:{...u.viewport,bbox:u.viewport.bbox?[...u.viewport.bbox]:null}}:{},...this.#Pe?{ramp:{...this.#Pe}}:{},...this.#e&&this.#e.provenance&&typeof this.#e.provenance=="object"?this.#e.provenance:{}}}#ge(u,S){this.#zt();const Y=S.asked!=="client"&&s(this.#n);return this.#C={source:"client",asked:S.asked,reason:S.reason,refused:S.refused,pending:!1,measures:M(I(this.#n,this.#t,u),"client",[],S.reason)},S.refused?Kt(`chart:aggregate:engine-refused:${this.#r}:${S.reason}`,`chart aggregate: 'engine' was refused: ${S.reason}. The chart reads the rows the grid has loaded instead; chart.provenance() reports the same reason.`):Y&&Kt(`chart:aggregate:window:${this.#r}:${S.reason}`,`this chart draws the rows the grid has loaded, which are a window of the matching set, because ${S.reason}. Its figures describe that window, not the whole relation.`),this.#o?.removeAttribute?.("aria-busy"),null}#Fn(u){if(n.has(u))return this.#In(u);this.#he=null;const S=B(this.#n,this.#t,u);if(S.mode==="client")return this.#ge(u,S);const Y=this.#ie.answer(S.key);if(Y){if(Y.error!==void 0){const ce=Y.error&&Y.error.message?Y.error.message:String(Y.error);return this.#ge(u,{asked:S.asked,refused:S.asked==="engine",reason:`the engine request failed (${ce})`})}const ue=Y.result||{};return ue.client&&ue.client.length?this.#ge(u,{asked:S.asked,refused:S.asked==="engine",reason:`the source computed "${ue.client[0].fn}" client-side (${ue.client[0].reason})`}):(this.#C={source:"engine",asked:S.asked,reason:null,refused:!1,pending:!1,measures:M(S.measures,"engine",ue.engine||[])},this.#o?.removeAttribute?.("aria-busy"),F(this.#n,this.#t,S,ue.groups||[]))}return this.#Kn(S),this.#C={...this.#C,asked:S.asked,pending:!0},this.#o&&this.#o.setAttribute("aria-busy","true"),Cr}#In(u){const S=i(this.#n,this.#t,u,this.#ve);if(S.mode==="client")return this.#he=null,this.#ge(u,S);this.#he=S;let Y=this.#ie.answer(S.key);const ue=this.#ie.last();!Y&&ue&&ue.error===void 0&&ue.result&&ue.result.kind==="rows"&&ue.result.rowsKey===S.rowsKey&&(Y=ue);let ce=!1;if(!Y){this.#ie.ask(S.key,S.run,()=>{this.#T||this.schedule()});const Te=this.#ie.last();if(!(Te&&Te.error===void 0&&Te.result&&Te.result.map))return this.#C={...this.#C,asked:S.asked,pending:!0},this.#o&&this.#o.setAttribute("aria-busy","true"),Cr;Y=Te,ce=!0}if(Y.error!==void 0){const Te=Y.error&&Y.error.message?Y.error.message:String(Y.error);return this.#ge(u,{asked:S.asked,refused:S.asked==="engine",reason:`the engine request failed (${Te})`})}const me=Y.result;if(me.refused)return this.#ge(u,{asked:S.asked,refused:S.asked==="engine",reason:me.refused});const Me=this.#Dn(u,me,S,ce);return this.#C={source:"engine",asked:S.asked,reason:null,refused:!1,pending:ce,measures:[],viewport:{rows:me.kind==="rows"?me.rows.length:0,matched:me.count,cap:me.cap,binned:me.kind==="density",cells:me.kind==="density"?me.cells.length:0,over:me.kind==="over"?me.reason:null,bbox:me.bbox?[...me.bbox]:null,computed:"engine"}},this.#o&&(ce?this.#o.setAttribute("aria-busy","true"):this.#o.removeAttribute("aria-busy")),Me}#Dn(u,S,Y,ue){let ce;if(S.kind==="rows"){const ze=$r(u),Be=C(this.#n,S.rows);ce=ze&&typeof ze.bind=="function"?ze.bind(Be,this.#t):{points:[],empty:!0}}else if(S.kind==="density"){const ze=S.cells;ce={points:ze.map(Be=>({lon:(Be.west+Be.east)/2,lat:(Be.south+Be.north)/2})),features:[],unplaced:0,fromGeometry:!0,empty:ze.length===0,density:{cells:ze,size:S.size}}}else ce={points:[],features:[],unplaced:0,fromGeometry:!0,empty:!1,over:{count:S.count,cap:S.cap,reason:S.reason}};const[me,Me]=this.#d.offset,Te=this.#d.zoom===1&&me===0&&Me===0,Ke=!!(this.#P&&this.#P.refit);if(Te&&!ue&&!Ke&&(!this.#P||this.#P.baseKey!==Y.baseKey)){const ze=[...ce.points||[]];for(const ht of ce.features||[]){ht.point&&ze.push({lon:ht.point[0],lat:ht.point[1]});for(const Ut of ht.polygons||[])for(const Dt of Ut)for(const[Ve,cn]of Dt)ze.push({lon:Ve,lat:cn})}const Be=(S.kind==="density"?z([],S.cells):z(ze))||[[[-180,-85],[180,-85],[180,85],[-180,85]]];(!this.#P||ee(g(this.#P.rings),g(Be)))&&(this.#P={baseKey:Y.baseKey,rings:Be})}return ce.frame=this.#P?this.#P.rings:null,ce}#Bn(u,S){const Y=S&&Array.isArray(S.points)?S.points.length:S&&Array.isArray(S.features)?S.features.length:0;this.#st=Y;const ue=re(u,S,this.#t,this.#ve);return ue.viewport&&(this.#C={...this.#C,viewport:ue.viewport},ue.bound.over&&Kt(`chart:viewportCap:over:${this.#r}`,`this map's view holds ${ue.bound.over.count} rows, more than its viewportCap of ${ue.bound.over.cap}, and ${ue.bound.over.reason}, so it draws none of them. Zoom in, narrow the filter, or raise viewportCap.`)),ue.bound}#Gn(u){if(!n.has(u))return;const S=this.#e,Y=S&&S.plot,ue=S&&S.anchor&&Y?En(S.anchor,Y):null,[ce,me]=this.#d.offset,Me=this.#d.zoom===1&&ce===0&&me===0,Te=!!(this.#P&&this.#P.refit),Ke={bbox:Me&&!Te?null:ue,span:ue?ue[2]-ue[0]:360,width:Y?Y.right-Y.left:this.#ve.width},ze=this.#ve;if(Kn(Ke.bbox,ze.bbox)&&Math.abs(Ke.span-ze.span)<1e-9&&Ke.width===ze.width)return;this.#ve=Ke;const ht=b(this.#t);(this.#he||this.#st>ht)&&this.schedule()}#Kn(u){this.#ie.ask(u.key,S=>{const Y={...u.request,...S?{signal:S}:{}};return Promise.resolve(u.source.aggregate(Y,u.requested)).then(ue=>({groups:ue&&ue.groups||[],engine:ue&&ue.engine||[],client:ue&&ue.client||[]}))},()=>{this.#T||this.schedule()})}#zt(){this.#ie.abort()}#Ft(u){const S=this.#A||[],Y=S.slice(0,Math.max(0,u));Y.length!==S.length&&(this.#A=Y,this.emit("drill",{path:[...Y],label:Y[Y.length-1]||null}),this.draw())}#Un(u){const S=this.#e&&this.#e.crumbs;return!Array.isArray(S)||S.length<2||u.key!=="Escape"&&u.key!=="Backspace"?!1:(u.preventDefault&&u.preventDefault(),this.#Ft(S[S.length-2].keep),!0)}ascend(u){if(!this.#A||!this.#A.length)return[];const S=Number.isFinite(u)&&u>0?Number(u):this.#A.length;return this.#A=this.#A.slice(0,Math.max(0,this.#A.length-S)),this.emit("drill",{path:[...this.#A],label:this.#A[this.#A.length-1]||null}),this.draw(),[...this.#A]}update(u){this.#Z={...this.#Z,...u},this.#Ce(!0),this.draw()}#Ce(u){u&&(this.#ne.rules=Do(this.#Z.responsive));const{rules:S}=this.#ne;if(!S.length){const Te=this.#ne.active.length>0;this.#ne.active=[],this.#t=this.#Z,Te&&this.#It(S,[]);return}const Y=this.#i.getBoundingClientRect?this.#i.getBoundingClientRect():An,ue={width:Math.round(Y.width||0),height:Math.round(Y.height||0)},ce=this.#ne.active,me=Bo(S,ue,ce),Me=me.length!==ce.length||me.some((Te,Ke)=>Te!==ce[Ke]);!Me&&!u||(this.#ne.active=me,this.#t=Go(this.#Z,S,me),Me&&this.#It(S,me,ue))}#It(u,S,Y){this.#De={active:Zr(u,S),width:Y?Y.width:void 0,height:Y?Y.height:void 0}}get responsive(){return Zr(this.#ne.rules,this.#ne.active)}rebind(u){if(!u)return this;if(this.#T)return this;if(u===this.#n&&!this.#q)return this;for(const S of this.#x)try{S()}catch{}if(this.#x=[],this.#te){try{this.#te()}catch{}this.#te=null}return this.#n=u,this.#q=!1,this.#ut(),this.draw(),this}get element(){return this.#l}toSVG(u){return this.#o?(this.#E&&this.#E.finish(),this.#p?this.#p.withoutHandles(()=>this.#Dt(u)):this.#Dt(u)):""}#Dt(u){const S=gn(this.#s);let Y=this.#o;return u&&u.inlineStyles&&S.getComputedStyle&&this.#o.cloneNode&&(Y=this.#o.cloneNode(!0),xs(this.#o,Y,S),Y.setAttribute("xmlns","http://www.w3.org/2000/svg")),typeof S.XMLSerializer=="function"?new S.XMLSerializer().serializeToString(Y):Y.outerHTML||""}async toPNG(u){const S=gn(this.#s);if(!this.#o||!S.Image||!this.#s.createElement)return null;const Y=u&&u.scale||S.devicePixelRatio||1,ue=this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():An,ce=Math.max(1,Math.round(ue.width||An.width)),me=Math.max(1,Math.round(ue.height||An.height)),Me=this.toSVG({inlineStyles:!0}),Te=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Me)}`,Ke=new S.Image;await new Promise((Ut,Dt)=>{Ke.onload=Ut,Ke.onerror=()=>Dt(new Error("the chart could not be rasterised")),Ke.src=Te});const ze=this.#s.createElement("canvas");ze.width=Math.round(ce*Y),ze.height=Math.round(me*Y);const Be=ze.getContext("2d"),ht=u&&"background"in u?u.background:"#ffffff";return ht&&(Be.fillStyle=ht,Be.fillRect(0,0,ze.width,ze.height)),Be.drawImage(Ke,0,0,ze.width,ze.height),new Promise(Ut=>ze.toBlob(Ut,"image/png"))}toCSV(){const u=this.#u;if(!u)return"";const S=Me=>{const Te=Me==null?"":String(Me);return/[",\n]/.test(Te)?`"${Te.replace(/"/g,'""')}"`:Te},Y=this.#e&&this.#e.table;if(Y&&Array.isArray(Y.head)&&Array.isArray(Y.rows))return[Y.head,...Y.rows].map(Me=>Me.map(S).join(",")).join(`
|
|
415
|
-
`);if(!(
|
|
416
|
-
`)}const
|
|
417
|
-
`)}#Hn(
|
|
418
|
-
`)}destroy(){if(!this.#T){this.#T=!0,this.#Xe(),this.#E&&this.#E.finish(),this.#zt();for(const
|
|
413
|
+
`}function ae(J){const ue=J.documentElement;if(!ue||ue.getAttribute(ve))return;ue.setAttribute(ve,"1");const B=J.createElement("style");B.textContent=ie(),(J.head||J.body||ue).appendChild(B)}}),it("packages/modules/charts/scale.js",function(n,re){"use strict";Object.defineProperty(n,"isNumber",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"toNumber",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"toTime",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"extent",{enumerable:!0,get:function(){return f}}),Object.defineProperty(n,"niceStep",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"niceDomain",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"measureDomain",{enumerable:!0,get:function(){return W}}),Object.defineProperty(n,"linearTicks",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"timeStepFor",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"timeTicks",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"linearScale",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"timeScale",{enumerable:!0,get:function(){return O}}),Object.defineProperty(n,"key",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"bandScale",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"sqrtScale",{enumerable:!0,get:function(){return R}});const Se=[1,2,2.5,5,10],ce=6e4,N=36e5,ve=864e5,xe=365.25*ve,ie=[1,2,5,10,20,25,50,100],ae=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,ce,5*ce,15*ce,30*ce,N,3*N,6*N,12*N,ve,2*ve,7*ve,14*ve,30*ve,90*ve,180*ve,...ie.map(i=>i*xe)];function J(i){return typeof i=="number"&&Number.isFinite(i)}function ue(i){if(i==null||i==="")return null;if(i instanceof Date){const T=i.getTime();return Number.isFinite(T)?T:null}if(typeof i=="boolean")return i?1:0;const x=Number(i);return Number.isFinite(x)?x:null}function B(i){if(i==null||i==="")return null;if(i instanceof Date){const T=i.getTime();return Number.isFinite(T)?T:null}if(typeof i=="number")return Number.isFinite(i)?i:null;const x=Date.parse(String(i));return Number.isFinite(x)?x:null}function f(i){let x=1/0,T=-1/0;for(let h=0;h<i.length;h++){const g=i[h];J(g)&&(g<x&&(x=g),g>T&&(T=g))}return x===1/0?null:{min:x,max:T}}function L(i){if(!(i>0))return 1;const x=10**Math.floor(Math.log10(i));for(const T of Se)if(i<=T*x)return T*x;return 10*x}function P(i,x=5){const T=L((i.max-i.min)/Math.max(1,x));return{min:Math.floor(i.min/T)*T,max:Math.ceil(i.max/T)*T,step:T}}function W(i,x={}){const T=f(i)||{min:0,max:1};let{min:h,max:g}=T;if(x.zero&&(h>0&&(h=0),g<0&&(g=0)),h===g){const j=Math.abs(h)>0?Math.abs(h)/10:1;h-=j,g+=j}if(x.nice!==!1){const j=P({min:h,max:g},x.ticks||5);h=j.min,g=j.max}return J(x.min)&&(h=x.min),J(x.max)&&(g=x.max),h===g&&(g=h+1),{min:h,max:g}}function U(i,x=5){const T=L((i.max-i.min)/Math.max(1,x)),h=Math.ceil(i.min/T),g=Math.floor(i.max/T),j=[];for(let X=h;X<=g;X++){const K=X*T;j.push(Math.abs(K)<T/1e6?0:Number(K.toPrecision(12)))}return j}function v(i,x=5){const T=Math.max(1,x),h=i/T;let g=ae[ae.length-1];for(const K of ae)if(K>=h){g=K;break}if(g<xe)return g;let j=g,X=Math.abs(i/g-T);for(const K of ae){if(K<xe)continue;const pe=Math.abs(i/K-T);pe<X&&(X=pe,j=K)}return j}function m(i,x){const T=new Date(i.min).getUTCFullYear();let h=Math.ceil(T/x)*x;Date.UTC(h,0,1)<i.min&&(h+=x);const g=[];for(;Date.UTC(h,0,1)<=i.max;h+=x)g.push(Date.UTC(h,0,1));return g}function u(i,x=5){const T=v(i.max-i.min,x);if(T>=xe)return m(i,Math.round(T/xe));const h=[],g=Math.ceil(i.min/T)*T;for(let j=g;j<=i.max;j+=T)h.push(j);return h}function b(i,x){const T=i.max-i.min||1,[h,g]=x;return{kind:"linear",domain:i,range:x,of(j){return h+(j-i.min)/T*(g-h)},invert(j){return i.min+(j-h)/(g-h||1)*T},ticks(j=5){return U(i,j)}}}function O(i,x){return{...b(i,x),kind:"time",ticks(h=5){return u(i,h)}}}function Q(i){if(i==null)return" null";if(i instanceof Date)return` date:${i.getTime()}`;if(typeof i=="object"){const x=i,T=x.id??x.key??x.value;return T!==void 0&&typeof T!="object"?` obj:${String(T)}`:` obj:${String(i)}`}return String(i)}function w(i,x,T=.2){const h=Math.min(.9,Math.max(0,T)),[g,j]=x,X=new Map;for(let ne=0;ne<i.length;ne++){const C=Q(i[ne]);X.has(C)||X.set(C,ne)}const K=i.length?(j-g)/i.length:j-g,pe=Math.max(0,K*(1-h));return{kind:"band",domain:i,range:x,bandwidth:pe,step:K,of(ne){const C=X.get(Q(ne));return C===void 0?NaN:g+C*K+(K-pe)/2},centre(ne){const C=this.of(ne);return Number.isNaN(C)?NaN:C+pe/2},ticks(){return i}}}function R(i,x){const[T,h]=x,g=Math.max(Math.abs(i.max),Math.abs(i.min),0)||1;return{kind:"sqrt",domain:i,range:x,of(j){const X=Math.sqrt(Math.abs(j)/g);return T+X*(h-T)}}}}),it("packages/core/src/format/number.js",function(n,re){"use strict";Object.defineProperty(n,"compileNumber",{enumerable:!0,get:function(){return N}});const ce=re("packages/core/src/internal/util.js").isNil;function N(ve,xe){const ie=ve||{},ae=ie.locale||xe||void 0,J=ie.style||"decimal",ue=typeof ie.scale=="number"?ie.scale:1,B=ie.nullDisplay??"",f=ie.zeroDisplay,L=ie.prefix||"",P=ie.suffix||"",W=ie.negative||"minus",U=ie.signed===!0,v={style:J,notation:ie.notation||"standard"};J==="currency"&&(v.currency=ie.currency||"USD",ie.currencyDisplay&&(v.currencyDisplay=ie.currencyDisplay)),typeof ie.decimals=="number"?(v.minimumFractionDigits=ie.decimals,v.maximumFractionDigits=ie.decimals):(typeof ie.minDecimals=="number"&&(v.minimumFractionDigits=ie.minDecimals),typeof ie.maxDecimals=="number"&&(v.maximumFractionDigits=ie.maxDecimals),v.minimumFractionDigits>(v.maximumFractionDigits??20)&&(v.maximumFractionDigits=v.minimumFractionDigits)),ie.thousandsSeparator===!1&&(v.useGrouping=!1),v.notation==="compact"&&(v.compactDisplay=ie.compactDisplay||"short");const m=new Intl.NumberFormat(ae,v),u=typeof ie.thousandsSeparator=="string"?ie.thousandsSeparator:null,b=typeof ie.decimalSeparator=="string"?ie.decimalSeparator:null;let O=",",Q=".";if(u||b)for(const h of m.formatToParts(12345.6))h.type==="group"?O=h.value:h.type==="decimal"&&(Q=h.value);const w=h=>{let g=h;return u&&(g=g.split(O).join("")),b&&(g=g.split(Q).join("")),u&&(g=g.split("").join(u)),b&&(g=g.split("").join(b)),g},R=!!(u||b),i=L!==""&&J==="currency",x=h=>{let g;if(i){const j=m.formatToParts(h);let X=!1;g="";for(const K of j)g+=K.value,!X&&K.type==="currency"&&(g+=L,X=!0);X||(g=L+g)}else g=L+m.format(h);return R&&(g=w(g)),g+P},T=h=>{if(ce(h)||h==="")return B;const g=typeof h=="number"?h:Number(h);if(Number.isNaN(g))return B;const j=ue===1?g:g*ue;return j===0&&f!==void 0?f:j<0?W==="parentheses"?`(${x(-j)})`:W==="suffix"?`${x(-j)}-`:x(j):U&&j>0?`+${x(j)}`:x(j)};return T.negativeClass=ie.negativeClass||null,T.spec=ie,T}}),it("packages/core/src/format/date.js",function(n,re){"use strict";Object.defineProperty(n,"scanPattern",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"toDate",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"compilePattern",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"compileDate",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"toIsoDate",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"toIsoDateTime",{enumerable:!0,get:function(){return W}}),Object.defineProperty(n,"compareIso",{enumerable:!0,get:function(){return m}});const Se=re("packages/core/src/internal/util.js"),ce=Se.isNil,N=Se.warnOnce,ve=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function xe(u){const b=[];let O=0,Q="";const w=()=>{Q&&(b.push({token:null,text:Q}),Q="")};for(;O<u.length;){const R=u[O];if(R==="'"){if(u[O+1]==="'"){Q+="'",O+=2;continue}const x=u.indexOf("'",O+1);if(x===-1){Q+=u.slice(O+1),O=u.length;continue}Q+=u.slice(O+1,x),O=x+1;continue}const i=ve.find(x=>u.startsWith(x,O));if(i){w(),b.push({token:i,text:i}),O+=i.length;continue}/[A-Za-z]/.test(R)&&N(`date.pattern.token:${R}`,`the date pattern "${u}" contains '${R}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${ve.join(" ")}.`),Q+=R,O+=1}return w(),b}const ie=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function ae(u){if(ce(u)||u==="")return null;if(u instanceof Date)return Number.isNaN(u.getTime())?null:u;if(typeof u=="number")return Number.isNaN(u)?null:new Date(u);if(typeof u=="string"){const b=ie.exec(u.trim());if(b){const[,Q,w,R,i="0",x="0",T="0"]=b;return new Date(+Q,+w-1,+R,+i,+x,+T)}const O=new Date(u);return Number.isNaN(O.getTime())?null:O}return null}function J(u,b){return String(u).padStart(b,"0")}function ue(u){if(!u)return Q=>({year:Q.getFullYear(),month:Q.getMonth()+1,day:Q.getDate(),hour:Q.getHours(),minute:Q.getMinutes(),second:Q.getSeconds(),ms:Q.getMilliseconds(),weekday:Q.getDay()});const b=new Intl.DateTimeFormat("en-US",{timeZone:u,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,weekday:"short"}),O={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};return Q=>{const w={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:Q.getMilliseconds(),weekday:0};for(const R of b.formatToParts(Q))switch(R.type){case"year":w.year=Number(R.value);break;case"month":w.month=Number(R.value);break;case"day":w.day=Number(R.value);break;case"hour":w.hour=Number(R.value)%24;break;case"minute":w.minute=Number(R.value);break;case"second":w.second=Number(R.value);break;case"weekday":w.weekday=O[R.value]??0;break;default:break}return w}}function B(u,b,O){const Q=xe(u),w=ue(O),R=new Set(Q.filter(g=>g.token).map(g=>g.token)),i=R.has("MMM")?new Intl.DateTimeFormat(b,{month:"short",timeZone:O}):null,x=R.has("MMMM")?new Intl.DateTimeFormat(b,{month:"long",timeZone:O}):null,T=R.has("EEE")?new Intl.DateTimeFormat(b,{weekday:"short",timeZone:O}):null,h=R.has("EEEE")?new Intl.DateTimeFormat(b,{weekday:"long",timeZone:O}):null;return g=>{const j=w(g);let X="";for(const K of Q){if(!K.token){X+=K.text;continue}switch(K.token){case"yyyy":X+=J(j.year,4);break;case"yy":X+=J(j.year%100,2);break;case"MMMM":X+=x.format(g);break;case"MMM":X+=i.format(g);break;case"MM":X+=J(j.month,2);break;case"M":X+=String(j.month);break;case"dd":X+=J(j.day,2);break;case"d":X+=String(j.day);break;case"EEEE":X+=h.format(g);break;case"EEE":X+=T.format(g);break;case"HH":X+=J(j.hour,2);break;case"H":X+=String(j.hour);break;case"hh":X+=J(j.hour%12===0?12:j.hour%12,2);break;case"h":X+=String(j.hour%12===0?12:j.hour%12);break;case"mm":X+=J(j.minute,2);break;case"m":X+=String(j.minute);break;case"ss":X+=J(j.second,2);break;case"s":X+=String(j.second);break;case"SSS":X+=J(j.ms,3);break;case"a":X+=j.hour<12?"AM":"PM";break;default:X+=K.text;break}}return X}}const f=[["year",365*24*36e5],["month",720*36e5],["week",168*36e5],["day",24*36e5],["hour",36e5],["minute",6e4],["second",1e3]];function L(u,b){const O=u||{},Q=O.locale||b||void 0,w=O.nullDisplay??"",R=O.timeZone;let i;if(O.pattern)i=B(O.pattern,Q,R);else if(O.dateStyle||O.timeStyle){const j={timeZone:R};O.dateStyle&&(j.dateStyle=O.dateStyle),O.timeStyle&&(j.timeStyle=O.timeStyle);const X=new Intl.DateTimeFormat(Q,j);i=K=>X.format(K)}else{const j=new Intl.DateTimeFormat(Q,{dateStyle:"medium",timeZone:R});i=X=>j.format(X)}const x=O.relative?new Intl.RelativeTimeFormat(Q,{numeric:"auto"}):null,h=(typeof O.relative=="object"&&O.relative?O.relative.threshold??7:7)*24*36e5,g=(j,X)=>{const K=ae(j);if(!K)return w;if(x){const pe=X&&typeof X.now=="number"?X.now:Date.now(),ne=K.getTime()-pe;if(Math.abs(ne)<h){for(const[C,q]of f)if(Math.abs(ne)>=q||C==="second")return x.format(Math.round(ne/q),C)}}return i(K)};return g.spec=O,g}function P(u){if(ce(u)||u==="")return null;if(typeof u=="string"){const Q=/^(\d{4}-\d{2}-\d{2})/.exec(u.trim());if(Q)return Q[1];const w=ae(u);return w?P(w):null}const b=ae(u);if(!b)return null;const O=Q=>String(Q).padStart(2,"0");return`${b.getFullYear()}-${O(b.getMonth()+1)}-${O(b.getDate())}`}function W(u,b){if(ce(u)||u==="")return null;if(typeof u=="string"){const Q=u.trim();if(U.test(Q)){const i=ae(Q);return i?v(i,b):null}const w=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(Q);if(w){const[,i,x,T,h]=w;return`${i}T${x}:${T}${h&&h!=="00"?`:${h}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(Q))return`${Q}T00:00`;const R=ae(Q);return R?W(R):null}const O=ae(u);return O?v(O,b):null}const U=/(?:Z|[+-]\d{2}:?\d{2})$/i;function v(u,b){const O=i=>String(i).padStart(2,"0");if(b)try{const i=new Intl.DateTimeFormat("en-CA",{timeZone:b,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(u).reduce((h,g)=>(g.type!=="literal"&&(h[g.type]=g.value),h),{}),x=i.hour==="24"?"00":i.hour,T=Number(i.second);return`${i.year}-${i.month}-${i.day}T${x}:${i.minute}`+(T?`:${i.second}`:"")}catch{}const Q=`${u.getFullYear()}-${O(u.getMonth()+1)}-${O(u.getDate())}`,w=u.getSeconds(),R=`${O(u.getHours())}:${O(u.getMinutes())}${w?`:${O(w)}`:""}`;return`${Q}T${R}`}function m(u,b){const O=ce(u)||u===""?null:String(u),Q=ce(b)||b===""?null:String(b);return O===null?Q===null?0:1:Q===null||O<Q?-1:O>Q?1:0}}),it("packages/core/src/format/boolean.js",function(n,re){"use strict";Object.defineProperty(n,"toTriState",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"compileBoolean",{enumerable:!0,get:function(){return ie}});const ce=re("packages/core/src/internal/util.js").isNil,N={true:"☑",false:"☐",null:""},ve={true:"◉",false:"◯",null:""};function xe(ae){if(ce(ae)||ae==="")return null;if(typeof ae=="boolean")return ae;if(typeof ae=="number")return ae!==0;const J=String(ae).trim().toLowerCase();return J==="true"||J==="yes"||J==="y"||J==="1"?!0:J==="false"||J==="no"||J==="n"||J==="0"?!1:null}function ie(ae,J){const ue=ae||{},B=ue.display||"text",f=ue.trueLabel??"Yes",L=ue.falseLabel??"No",P=ue.nullLabel??"";let W=f,U=L;const v=P;B==="checkbox"?(W=N.true,U=N.false):B==="switch"?(W=ve.true,U=ve.false):B==="icon"&&(W=ue.trueIcon??f,U=ue.falseIcon??L);const m=u=>{const b=xe(u);return b===null?v:b?W:U};return m.display=B,m.labels={true:f,false:L,null:P},m.locale=J,m.spec=ue,m}}),it("packages/core/src/format/text.js",function(n,re){"use strict";Object.defineProperty(n,"compileText",{enumerable:!0,get:function(){return ve}});const Se=re("packages/core/src/internal/util.js"),ce=Se.isNil,N=Se.titleCase;function ve(xe,ie){const ae=xe||{},J=ae.locale||ie||void 0,ue=ae.nullDisplay??"",B=ae.emptyDisplay??"",f=ae.transform||"none",L=typeof ae.truncate=="number"?{chars:ae.truncate}:ae.truncate||null,P=L?L.chars:0,W=L?L.ellipsis??"…":"",U=m=>{switch(f){case"upper":return J?m.toLocaleUpperCase(J):m.toUpperCase();case"lower":return J?m.toLocaleLowerCase(J):m.toLowerCase();case"title":return N(m);default:return m}},v=m=>{if(ce(m))return ue;let u=typeof m=="string"?m:String(m);return u===""?B:(f!=="none"&&(u=U(u)),P>0&&u.length>P&&(u=u.slice(0,P)+W),u)};return v.spec=ae,v}}),it("packages/core/src/format/mask.js",function(n,re){"use strict";Object.defineProperty(n,"splitSections",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"parseSection",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(n,"compileMask",{enumerable:!0,get:function(){return ie}});const Se=new Set(["0","#","?",",","."]),ce="\0";function N(J){const ue=[];let B="",f=!1;for(let L=0;L<J.length;L++){const P=J[L];if(P==="\\"){B+=P+(J[L+1]??""),L+=1;continue}if(P==='"'){f=!f,B+=P;continue}if(P===";"&&!f){ue.push(B),B="";continue}B+=P}return ue.push(B),ue}function ve(J){let ue="",B="",f="",L=1,P=!1,W=!1;const U=i=>{W?B+=i:ue+=i};for(let i=0;i<J.length;i++){const x=J[i];if(x==="\\"){U(J[i+1]??""),i+=1;continue}if(x==='"'){const T=J.indexOf('"',i+1);U(T===-1?J.slice(i+1):J.slice(i+1,T)),i=T===-1?J.length:T;continue}if(x==="%"){L*=100,U("%");continue}if(x==="@"){P=!0,U("\0");continue}if(Se.has(x)){f+=x,W=!0;continue}U(x)}let v=-1;for(let i=f.length-1;i>=0;i--){const x=f[i];if(x==="0"||x==="#"||x==="?"){v=i;break}}let m=!1,u="";for(let i=0;i<f.length;i++){const x=f[i];if(x===","){i>v?L/=1e3:m=!0;continue}u+=x}const b=u.indexOf("."),O=b===-1?u:u.slice(0,b),Q=b===-1?"":u.slice(b+1);let w=0;for(const i of O)i==="0"&&(w+=1);let R=0;for(const i of Q)i==="0"&&(R+=1);return{prefix:ue,suffix:B,minInt:w,minDec:R,maxDec:Q.length,grouping:m,scale:L,hasNumber:v!==-1,isText:P}}function xe(J,ue){const B=new Intl.NumberFormat(ue,{minimumIntegerDigits:Math.max(J.minInt,1),minimumFractionDigits:J.minDec,maximumFractionDigits:Math.max(J.maxDec,J.minDec),useGrouping:J.grouping}),{prefix:f,suffix:L,scale:P,hasNumber:W}=J;return U=>{if(!W)return f+L;const v=P===1?U:U*P;return f+B.format(v)+L}}function ie(J,ue){const f=N(String(J)).map(ve),L=f.map(u=>xe(u,ue)),P=0,W=f.length>1?1:-1,U=f.length>2?2:-1,v=f.length>3?3:-1,m=u=>{if(u==null||u==="")return"";if(typeof u!="number"||Number.isNaN(u)){const b=Number(u);if(Number.isNaN(b))return v===-1?String(u):(f[v].prefix+f[v].suffix).split("\0").join(String(u));u=b}return u===0&&U!==-1?L[U](0):u<0&&W!==-1?L[W](-u):L[P](u)};return m.spec={mask:J},{format:m,ooxml:ae(String(J))}}function ae(J){return J.trim()}}),it("packages/core/src/format/shorthand.js",function(n,re){"use strict";Object.defineProperty(n,"looksLikeMask",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(n,"looksLikeDatePattern",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"parseShorthand",{enumerable:!0,get:function(){return ae}});const Se=["currency","number","percent","date","boolean","text","relative"],ce=/[#0?@;"\\]/,N=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function ve(J){return typeof J!="string"||J===""||ie(J)?!1:ce.test(J)}function xe(J){return typeof J!="string"||J===""||ie(J)?!1:N.test(J)}function ie(J){const ue=J.indexOf(":"),B=ue===-1?J:J.slice(0,ue);return Se.includes(B)?B:null}function ae(J){const ue=ie(J);if(!ue)return null;const B=J.indexOf(":"),f=B===-1?"":J.slice(B+1),L=f===""?[]:f.split(":");switch(ue){case"currency":{const P={type:"number",style:"currency",currency:L[0]||"USD"};return L[1]!==void 0&&L[1]!==""&&(P.decimals=Number(L[1])),P}case"number":{const P={type:"number",style:"decimal"};return L[0]!==void 0&&L[0]!==""&&(P.decimals=Number(L[0])),P}case"percent":{const P={type:"number",style:"percent"};return L[0]!==void 0&&L[0]!==""&&(P.decimals=Number(L[0])),P}case"date":return{type:"date",pattern:f||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const P=f.split("/"),W={type:"boolean",display:"text"};return P[0]!==void 0&&P[0]!==""&&(W.trueLabel=P[0]),P[1]!==void 0&&P[1]!==""&&(W.falseLabel=P[1]),P[2]!==void 0&&(W.nullLabel=P[2]),W}case"text":{const P={type:"text"};return L[0]&&(P.transform=L[0]),L[1]!==void 0&&L[1]!==""&&(P.truncate=Number(L[1])),P}default:return null}}}),it("packages/core/src/format/index.js",function(n,re){"use strict";Object.defineProperty(n,"compileFormat",{enumerable:!0,get:function(){return g}}),Object.defineProperty(n,"specToOoxml",{enumerable:!0,get:function(){return X}});const Se=re("packages/core/src/internal/util.js"),ce=Se.isFunction,N=Se.isObject,ve=Se.warnOnce,xe=re("packages/core/src/format/number.js"),ie=xe.compileNumber,ae=re("packages/core/src/format/date.js"),J=ae.compileDate,ue=ae.scanPattern,B=re("packages/core/src/format/boolean.js"),f=B.compileBoolean,L=re("packages/core/src/format/text.js"),P=L.compileText,W=re("packages/core/src/format/mask.js"),U=W.compileMask,v=re("packages/core/src/format/shorthand.js"),m=v.parseShorthand,u=v.looksLikeMask,b=v.looksLikeDatePattern;Object.defineProperty(n,"compileNumber",{enumerable:!0,get:function(){return xe.compileNumber}}),Object.defineProperty(n,"compileDate",{enumerable:!0,get:function(){return ae.compileDate}}),Object.defineProperty(n,"compilePattern",{enumerable:!0,get:function(){return ae.compilePattern}}),Object.defineProperty(n,"scanPattern",{enumerable:!0,get:function(){return ae.scanPattern}}),Object.defineProperty(n,"toDate",{enumerable:!0,get:function(){return ae.toDate}}),Object.defineProperty(n,"compileBoolean",{enumerable:!0,get:function(){return B.compileBoolean}}),Object.defineProperty(n,"toTriState",{enumerable:!0,get:function(){return B.toTriState}}),Object.defineProperty(n,"compileText",{enumerable:!0,get:function(){return L.compileText}}),Object.defineProperty(n,"compileMask",{enumerable:!0,get:function(){return W.compileMask}}),Object.defineProperty(n,"splitSections",{enumerable:!0,get:function(){return W.splitSections}}),Object.defineProperty(n,"parseSection",{enumerable:!0,get:function(){return W.parseSection}}),Object.defineProperty(n,"parseShorthand",{enumerable:!0,get:function(){return v.parseShorthand}}),Object.defineProperty(n,"looksLikeMask",{enumerable:!0,get:function(){return v.looksLikeMask}}),Object.defineProperty(n,"looksLikeDatePattern",{enumerable:!0,get:function(){return v.looksLikeDatePattern}});const O=new Set(["decimal","currency","percent","unit"]),Q=new Set(["type","locale"]),w={number:new Set(["style","currency","currencyDisplay","decimals","minDecimals","maxDecimals","thousandsSeparator","decimalSeparator","notation","compactDisplay","negative","negativeClass","signed","prefix","suffix","zeroDisplay","nullDisplay","messages","scale"]),date:new Set(["pattern","dateStyle","timeStyle","timeZone","relative","nullDisplay"]),boolean:new Set(["display","trueLabel","falseLabel","nullLabel","trueIcon","falseIcon"]),text:new Set(["transform","truncate","nullDisplay","emptyDisplay"])},R=new Set(["number","date","boolean","text"]);function i(C,q){const z=C.type;if(z===void 0||R.has(z)||!O.has(String(z)))return;const t=q?`"${q}"`:"with no id";ve(`format:unknown-style-key:${q||""}:${z}`,`column ${t} has format: { type: "${z}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${z}" instead?`)}function x(C,q,z){const t=w[q],e=z?`"${z}"`:"with no id";for(const s of C){if(Q.has(s)||t.has(s))continue;const d=Object.keys(w).find(p=>p!==q&&w[p].has(s));d?ve(`format:inapplicable:${z||""}:${s}`,`column ${e} has format key "${s}", which applies to a ${d} column, not the ${q} column it was applied to; it is ignored.`):ve(`format:unknown:${z||""}:${s}`,`column ${e} has an unrecognised format key "${s}" for its ${q} format; it is ignored.`)}}function T(C){if(C.type==="number"||C.type==="date"||C.type==="boolean"||C.type==="text")return!0;const q=O.has(String(C.style));return!!(C.pattern||C.dateStyle||C.timeStyle||C.relative||C.timeZone||C.trueLabel||C.falseLabel||C.display||C.trueIcon||C.falseIcon||C.transform||C.truncate||C.emptyDisplay||q||C.currency||C.decimals!==void 0||C.minDecimals!==void 0||C.maxDecimals!==void 0||C.notation||C.negative||C.scale!==void 0||C.prefix||C.suffix||C.zeroDisplay!==void 0)}function h(C,q){if(C.type==="number"||C.type==="date"||C.type==="boolean"||C.type==="text")return C.type;if(C.pattern||C.dateStyle||C.timeStyle||C.relative||C.timeZone)return"date";if(C.trueLabel||C.falseLabel||C.display||C.trueIcon||C.falseIcon)return"boolean";if(C.transform||C.truncate||C.emptyDisplay)return"text";if(C.style||C.currency||C.decimals!==void 0||C.minDecimals!==void 0||C.maxDecimals!==void 0||C.notation||C.negative||C.scale!==void 0||C.prefix||C.suffix||C.zeroDisplay!==void 0)return"number";const z=q&&q.base;return z==="number"?"number":z==="date"||z==="dateString"?"date":z==="boolean"?"boolean":"text"}function g(C,q=null,z=void 0,t=void 0,e=void 0){if(C==null||C==="")return null;const s=N(C)?Object.keys(C):null;if(typeof C=="function"){const M=(ee,H)=>String(C({...H||{},value:ee,locale:z})??"");return M.ooxml=q&&q.excel||"General",M}if(typeof C=="string"){if(u(C)){const{format:ee,ooxml:H}=U(C,z);return ee.ooxml=H,ee}const M=m(C)||(b(C)?{type:"date",pattern:C}:null);return M?g(M,q,z,t,e):(ve(`format:${C}`,`unrecognised format string "${C}"; the value will be stringified`),null)}if(!N(C))return ve("format:shape","format must be a spec object or a string; ignoring",C),null;if(q&&ce(q.format)&&!T(C)||q&&ce(q.format)&&Array.isArray(q.formatPatterns)&&C.type===void 0)return null;const d=h(C,q);d==="date"&&t&&C.timeZone===void 0&&(C={...C,timeZone:t}),i(C,e),x(s||Object.keys(C),d,e);let p;switch(d){case"number":p=ie(C,z);break;case"date":p=J(C,z);break;case"boolean":p=f(C,z);break;default:p=P(C,z);break}return p.ooxml=X(C,d,z,q),p.kind=d,p}const j={yyyy:"yyyy",yy:"yy",MMMM:"mmmm",MMM:"mmm",MM:"mm",M:"m",dd:"dd",d:"d",EEEE:"dddd",EEE:"ddd",HH:"hh",H:"h",hh:"hh",h:"h",mm:"mm",m:"m",ss:"ss",s:"s",SSS:"000",a:"AM/PM"};function X(C,q,z=void 0,t=null){if(q==="date"){if(C.pattern){let M="";for(const ee of ue(C.pattern))M+=ee.token?j[ee.token]??ee.text:ee.text;return M}return t&&t.excel||"yyyy-mm-dd"}if(q==="boolean")return"General";if(q==="text")return"@";if(C.notation==="compact"||C.notation==="scientific")return"General";const e=typeof C.decimals=="number"?C.decimals:typeof C.minDecimals=="number"?C.minDecimals:C.style==="currency"?2:0;let d=`${C.thousandsSeparator===!1?"":"#,#"}#0${e>0?`.${"0".repeat(e)}`:""}`,p="";return C.style==="currency"&&(p+=K(ne(C.currency||"USD",z))),C.prefix&&(p+=K(C.prefix)),d=p+d,C.style==="percent"&&(d=`${d}%`),C.suffix&&(d+=K(C.suffix)),C.negative==="parentheses"?`${d};(${d})`:C.negative==="suffix"?`${d};${d}-`:d}function K(C){return`"${String(C).split('"').join("")}"`}const pe=new Map;function ne(C,q){const z=`${C}|${q||""}`;let t=pe.get(z);if(t!==void 0)return t;t=C;try{const s=new Intl.NumberFormat(q,{style:"currency",currency:C}).formatToParts(0).find(d=>d.type==="currency");s&&(t=s.value)}catch{}return pe.set(z,t),t}}),it("packages/modules/charts/format.js",function(n,re){"use strict";Object.defineProperty(n,"precisionFor",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"axisNumber",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"r2Digits",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"dateFormatFor",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"formatters",{enumerable:!0,get:function(){return f}}),Object.defineProperty(n,"measureText",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"measureFormat",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"stringFormatter",{enumerable:!0,get:function(){return U}});const ce=re("packages/modules/charts/scale.js").timeStepFor,ve=re("packages/core/src/format/index.js").compileFormat,ie=re("packages/core/src/internal/util.js").warnOnce;function ae(v){if(!Number.isFinite(v)||v<=0)return 0;const m=Math.ceil(-Math.log10(v));return Math.min(6,Math.max(0,m))}function J(v,m,u=0){return Number.isFinite(v)?Math.abs(v)>=1e4?m.number(v,{notation:"compact",maximumFractionDigits:1}):m.number(v,{minimumFractionDigits:u,maximumFractionDigits:u}):""}function ue(v,m){const u=v&&v.messages;return!u||typeof u.number!="function"?Number(m).toFixed(2):u.number(m,{minimumFractionDigits:2,maximumFractionDigits:2})}function B(v){const u=v>0?ce(v):0;return u>0&&u<1e3?{minute:"2-digit",second:"2-digit",fractionalSecondDigits:3}:u>0&&u<6e4?{hour:"2-digit",minute:"2-digit",second:"2-digit"}:v<=864e5?{hour:"2-digit",minute:"2-digit"}:v<=180*864e5?u>0&&u<864e5?{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}:{day:"numeric",month:"short"}:v<=3*365*864e5?{month:"short",year:"numeric"}:{year:"numeric"}}function f(v,m,u){const b=v.messages,O=b.locale,w=u&&u.format&&u.format.timeZone||v.get("timeZone")||void 0;if(m.kind==="time"){const i=B(m.span||0),x=new Intl.DateTimeFormat(O,w?{...i,timeZone:w}:i),T=new Intl.DateTimeFormat(O,w?{dateStyle:"medium",timeStyle:"short",timeZone:w}:{dateStyle:"medium",timeStyle:"short"});return{tick:h=>Number.isFinite(Number(h))?x.format(new Date(Number(h))):"",value:h=>Number.isFinite(Number(h))?T.format(new Date(Number(h))):""}}const R=ae(m.step||0);return{tick:i=>typeof i=="number"?J(i,b,R):String(i??""),value:i=>typeof i=="number"?b.number(i):String(i??"")}}function L(v,m){if(v==null||!Number.isFinite(v))return"";const u=Math.abs(v)>=1e-6?Number(v.toPrecision(6)):v;return m.number(u)}function P(v,m,u){return v==null||!Number.isFinite(Number(v))?"":m&&m.format&&typeof m.formatValue=="function"?String(m.formatValue(v,null)):L(Number(v),u&&u.messages)}const W=new Map;function U(v,m,u){const b=m&&m.messages&&m.messages.locale,O=`${b}\0${v}`;if(!W.has(O)){let w=null;try{w=ve(v,null,b)}catch{w=null}W.set(O,w)}const Q=W.get(O);return Q?w=>String(Q(w)):(ie(`chart.format.string:${u}:${v}`,`${u}: the format string "${v}" is not understood; values are drawn unformatted`),null)}}),it("packages/modules/charts/axis.js",function(n,re){"use strict";Object.defineProperty(n,"pinXDomain",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"TICK_FLOOR",{enumerable:!0,get:function(){return R}}),Object.defineProperty(n,"tickFloor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"fitBandLabels",{enumerable:!0,get:function(){return x}}),Object.defineProperty(n,"normaliseAxes",{enumerable:!0,get:function(){return g}}),Object.defineProperty(n,"tickValues",{enumerable:!0,get:function(){return j}}),Object.defineProperty(n,"tickLabeller",{enumerable:!0,get:function(){return X}}),Object.defineProperty(n,"drawAxisTitle",{enumerable:!0,get:function(){return K}}),Object.defineProperty(n,"labelEvery",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(n,"drawMeasureAxis",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(n,"heldInside",{enumerable:!0,get:function(){return C}}),Object.defineProperty(n,"drawCategoryAxis",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"leftLabelRoom",{enumerable:!0,get:function(){return z}}),Object.defineProperty(n,"setLabelText",{enumerable:!0,get:function(){return t}}),Object.defineProperty(n,"drawBandLabels",{enumerable:!0,get:function(){return e}}),Object.defineProperty(n,"drawContinuousAxis",{enumerable:!0,get:function(){return s}}),Object.defineProperty(n,"drawAxisLines",{enumerable:!0,get:function(){return d}}),Object.defineProperty(n,"createGroups",{enumerable:!0,get:function(){return M}}),Object.defineProperty(n,"MARK_OVERHANG",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(n,"overhangFor",{enumerable:!0,get:function(){return H}}),Object.defineProperty(n,"setPlotClip",{enumerable:!0,get:function(){return F}});const ce=re("packages/modules/charts/frame.js").Pool,N=re("packages/modules/charts/svg.js"),ve=N.attrs,xe=N.round,ie=N.setText,ae=N.svg,J=re("packages/modules/charts/typography.js"),ue=J.applySize,B=J.CHAR_RATIO,f=J.truncateTo,P=re("packages/modules/charts/styles.js").NS,W=re("packages/modules/charts/scale.js"),U=W.toNumber,v=W.toTime,u=re("packages/modules/charts/format.js").stringFormatter,O=re("packages/core/src/internal/util.js").warnOnce;function Q(o,A,G){const D=A&&A.kind==="time"?v:U,V=y=>y==null||y===""?null:D(y),de=V(G&&G.min),$=V(G&&G.max);if(de===null&&$===null)return o;if(de!==null&&$!==null)return de<$?{min:de,max:$}:(O("chart.axis.x.domain.inverted",`axis.x.min (${de}) is not below axis.x.max (${$}), which is a mirrored axis rather than a narrow one, so both were ignored and the x domain was taken from the data. On a time axis both are epoch milliseconds.`),o);const _=de!==null?de:o.min,oe=$!==null?$:o.max;if(_<oe)return{min:_,max:oe};const a=Math.abs(o.max-o.min)||1;return O("chart.axis.x.domain.beyond",`axis.x.${de!==null?"min":"max"} is outside the x values entirely, so the plot is empty. The pin was kept and the other edge moved to hold the axis width; check the units (a time axis is pinned in epoch milliseconds).`),de!==null?{min:_,max:_+a}:{min:oe-a,max:oe}}const w=6,R=9;function i(o){const A=o&&o.ownerDocument,G=A&&A.defaultView;if(!G||typeof G.getComputedStyle!="function")return R;const D=G.getComputedStyle(o).getPropertyValue("--lattice-chart-tick-min"),V=parseFloat(D);return Number.isFinite(V)&&V>0?V:R}function x(o){const{size:A,floor:G,slot:D,per:V}=o,de=Number.isFinite(o.every)&&o.every>0?Number(o.every):null;if(de!==null&&de!==1)return{size:A,every:de,thinned:!1};if(!(D>0)||!(V>0))return{size:A,every:1,thinned:!1};const $=Math.min(A,D/V);return $>=G?{size:$,every:1,thinned:!1}:{size:G,every:Math.max(1,Math.ceil(G*V/D)),thinned:!0}}function T(o,A){const G=Math.ceil(o/A),D=o-G;O("chart.axis.band.thinned",`${D} of ${o} band labels were hidden: even the smallest font (--lattice-chart-tick-min) could not make them all fit. Set axis.x.every or axis.y.every to choose which ones show.`)}const h=1.2;function g(o){if(o===!1){const D={labels:!1,grid:!1};return{x:{...D},y:{...D},y2:{...D}}}const A=o&&typeof o=="object"?o:{},G=D=>typeof D=="string"?{title:D}:D&&typeof D=="object"?{...D}:{};return{x:G(A.x),y:G(A.y),y2:G(A.y2||A.right)}}function j(o,A){const G=A&&A.ticks;if(Array.isArray(G)){const V=o.domain;return!V||V.min===void 0?G:G.filter(de=>Number(de)>=V.min&&Number(de)<=V.max)}const D=Number.isFinite(G)&&G>0?Number(G):5;return o.ticks(D)}function X(o,A,G,D){const V=o&&o.format;if(typeof V=="function")return de=>String(V(de));if(typeof V=="string"){const de=u(V,G,"axis.<x|y|y2>.format");if(de)return de}return D&&D.format&&D.format.pattern&&typeof D.formatValue=="function"?de=>String(D.formatValue(de,null)):A.tick}function K(o){if(!o.text)return;const A=o.side==="left"||o.side==="right"?o.plot.height:o.plot.width,G=Number.isFinite(A)?f(String(o.text),Math.max(0,A),o.size):String(o.text);if(!G||G==="…")return;const D=ae(o.group.ownerDocument,"text",{class:`${P}__axis-title`});if(ue(D,o.size),o.side==="left"){const V=Math.max(o.size*1.15,o.plot.left-o.plot.gutter.left+o.size*1.15),de=o.plot.top+o.plot.height/2;ve(D,{transform:`translate(${xe(V)} ${xe(de)}) rotate(-90)`,"text-anchor":"middle"})}else if(o.side==="right"){const V=o.plot.right+o.plot.gutter.right-o.size*1.15,de=o.plot.top+o.plot.height/2;ve(D,{transform:`translate(${xe(V)} ${xe(de)}) rotate(90)`,"text-anchor":"middle"})}else ve(D,{x:xe(o.plot.left+o.plot.width/2),y:xe(o.plot.bottom+o.plot.gutter.bottom-2),"text-anchor":"middle"});ie(D,G),G!==String(o.text)&&D.setAttribute("aria-label",String(o.text)),o.group.appendChild(D)}function pe(o){const{values:A,scale:G,size:D,horizontal:V,label:de}=o;if(A.length<2)return 1;let $=1/0;for(let oe=1;oe<A.length;oe++){const a=Math.abs(G.of(A[oe])-G.of(A[oe-1]));Number.isFinite(a)&&a<$&&($=a)}if(!Number.isFinite($))return 1;if($<=0)return A.length;let _=D*h+2;if(V){let oe=0;for(const a of A){const y=String(de(a)||"").length*D*B;y>oe&&(oe=y)}_=oe+w}return Math.max(1,Math.ceil(_/$))}function ne(o){const{gridGroup:A,axisGroup:G,plot:D,scale:V,format:de}=o,$=o.config||{},_=j(V,$),oe=X($,de,o.grid),a=o.size||11,y=pe({values:_,scale:V,size:a,horizontal:!!o.horizontal,label:oe}),r=$.grid===!1?null:A,k=r?new ce(r):null,l=new ce(G);for(let I=0;I<_.length;I++){const E=_[I],Y=xe(V.of(E)),se=E===0,le=I%y!==0;if(o.horizontal){if(k&&ve(k.next("line",`${P}__gridline`),{x1:Y,x2:Y,y1:xe(D.top),y2:xe(D.bottom),"stroke-opacity":se?1:.6,"stroke-width":se?1.5:1}),$.labels===!1||le)continue;const ye=oe(E),be=String(ye).length*a*B/2,Ae=D.gutter;if(Ae&&(Y-be<D.left-(Ae.left||0)||Y+be>D.right+(Ae.right||0)))continue;const Ne=l.next("text",`${P}__tick`);ue(Ne,a),ve(Ne,{x:Y,y:xe(D.bottom+w),"text-anchor":"middle","dominant-baseline":"hanging"}),ie(Ne,ye)}else{if(k&&ve(k.next("line",`${P}__gridline`),{x1:xe(D.left),x2:xe(D.right),y1:Y,y2:Y,"stroke-opacity":se?1:.6,"stroke-width":se?1.5:1}),$.labels===!1||le)continue;const ye=l.next("text",`${P}__tick`);ue(ye,a);const be=o.side==="right";ve(ye,{x:xe(be?D.right+w:D.left-w),y:C(Y,D,a),"text-anchor":be?"start":"end","dominant-baseline":"middle"}),ie(ye,oe(E))}}return k?k.finish():new ce(A).finish(),l.finish(),_}function C(o,A,G){const D=A&&A.gutter;if(!D)return o;const V=A.top-(Number.isFinite(D.top)?D.top:0)+G*.85+1,de=A.bottom+(Number.isFinite(D.bottom)?D.bottom:0)-G*.6-1;return xe(Math.min(Math.max(o,V),Math.max(V,de)))}function q(o){const{group:A,plot:G,scale:D,labels:V}=o,de=o.config||{};if(de.labels===!1){new ce(A).finish();return}const $=new ce(A),_=D.domain,oe=D.step,a=de.rotate===void 0||de.rotate==="auto"?o.rotated:!!de.rotate,y=a?x({size:o.fontSize,floor:i(A),slot:oe,per:Math.SQRT2,every:de.every}):{size:o.fontSize,every:Number.isFinite(de.every)&&de.every>0?Number(de.every):1,thinned:!1},{size:r,every:k}=y;y.thinned&&T(_.length,k);const l=oe*k;for(let I=0;I<_.length;I++){const E=xe(D.centre(_[I]));if(Number.isNaN(E)||I%k!==0)continue;const Y=$.next("text",`${P}__tick`);ue(Y,r);const se=V[I]===void 0?"":V[I];a?(ve(Y,{x:0,y:0,"text-anchor":"end","dominant-baseline":"middle",transform:`translate(${E} ${xe(G.bottom+w)}) rotate(-45)`}),t(Y,se,Math.max(0,G.gutter.bottom-w)*Math.SQRT2,r)):(ve(Y,{x:E,y:xe(G.bottom+w),"text-anchor":"middle","dominant-baseline":"hanging",transform:null}),t(Y,se,l,r))}$.finish()}function z(o){return Math.max(0,(o.gutter?o.gutter.left:o.left)-w)}function t(o,A,G,D){const V=String(A??""),de=f(V,G,D);return ie(o,de),de!==V?o.setAttribute("aria-label",V):o.removeAttribute("aria-label"),de}function e(o){const{group:A,plot:G,scale:D,labels:V}=o,de=o.config||{},$=new ce(A),_=D.domain,oe=z(G),a=x({size:o.fontSize,floor:i(A),slot:D.step,per:h,every:de.every}),{size:y,every:r}=a;a.thinned&&T(_.length,r);for(let k=0;k<_.length;k++){if(k%r!==0)continue;const l=xe(D.centre(_[k]));if(Number.isNaN(l))continue;const I=$.next("text",`${P}__tick`);ve(I,{x:xe(G.left-w),y:l,"text-anchor":"end","dominant-baseline":"middle"}),ue(I,y),t(I,V[k],oe,y)}$.finish()}function s(o){const{group:A,plot:G,scale:D,format:V}=o,de=o.config||{};if(de.labels===!1){new ce(A).finish();return}const $=X(de,V,o.grid,o.column),_=o.size||11,oe=G&&G.gutter,a=oe&&Number.isFinite(oe.left)?G.left-oe.left:-1/0,y=oe&&Number.isFinite(oe.right)?G.right+oe.right:1/0,r=new ce(A);for(const k of j(D,de)){const l=xe(D.of(k));if(l<G.left-1||l>G.right+1)continue;const I=$(k),E=String(I).length*_*B/2;if(l-E<a||l+E>y)continue;const Y=r.next("text",`${P}__tick`);ue(Y,_),ve(Y,{x:l,y:xe(G.bottom+w),"text-anchor":"middle","dominant-baseline":"hanging"}),ie(Y,I)}r.finish()}function d(o){const{group:A,plot:G}=o,D=o.side==="right"?G.right:G.left,V=new ce(A);ve(V.next("line"),{x1:xe(D),x2:xe(D),y1:xe(G.top),y2:xe(G.bottom)}),ve(V.next("line"),{x1:xe(G.left),x2:xe(G.right),y1:xe(G.bottom),y2:xe(G.bottom)}),V.finish()}let p=0;function M(o,A){const G=`${P}-plot-clip-${++p}`,D=ae(o,"rect"),V=ae(o,"clipPath",{id:G});V.appendChild(D);const de=`${P}-box-clip-${p}`,$=ae(o,"clipPath",{id:de});$.appendChild(ae(o,"rect",{x:0,y:0,width:"100%",height:"100%"}));const _=ae(o,"defs");_.appendChild(V),_.appendChild($);const oe={grid:ae(o,"g",{class:`${P}__grid`}),marks:ae(o,"g",{class:`${P}__marks`}),rules:ae(o,"g",{class:`${P}__axis`}),axis:ae(o,"g",{class:`${P}__axis`}),labels:ae(o,"g",{class:`${P}__labels`}),overlay:ae(o,"g",{class:`${P}__overlay`}),clip:D,clipId:G,boxClipId:de};A.appendChild(_);for(const a of["grid","marks","rules","axis","labels","overlay"])A.appendChild(oe[a]);return oe}const ee=30;function H(o){return o==="bubble"?ee:o==="scatter"?6:3}function F(o,A,G){if(!o||!o.marks||!o.clip)return;if(!A||!Number.isFinite(A.width)||!Number.isFinite(A.height)){o.marks.removeAttribute("clip-path");return}const D=Number.isFinite(G)&&G>=0?Number(G):ee;ve(o.clip,{x:xe(A.left-D),y:xe(A.top-D),width:xe(Math.max(0,A.width)+D*2),height:xe(Math.max(0,A.height)+D*2)}),o.marks.setAttribute("clip-path",`url(#${o.clipId})`)}}),it("packages/modules/charts/stack.js",function(n,re){"use strict";Object.defineProperty(n,"measureValues",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"stacker",{enumerable:!0,get:function(){return ve}});const ce=re("packages/modules/charts/scale.js").isNumber;function N(xe,ie,ae){if(ae)return[0,100];if(!ie){const f=[];for(const L of xe)for(const P of L.points)f.push(P.y);return f}const J=[],ue=[],B=xe[0]?xe[0].points.length:0;for(let f=0;f<B;f++){let L=0,P=0;for(const W of xe){const U=W.points[f]?W.points[f].y:null;ce(U)&&(U>=0?L+=U:P+=U)}J.push(L),ue.push(P)}return[...J,...ue]}function ve(xe,ie){const ae=new Float64Array(xe),J=new Float64Array(xe);return{take(ue,B){const f=ie?ie[ue]:0,L=ie?f?B/f*100:0:B;if(L>=0){const W=ae[ue];return ae[ue]+=L,[W,ae[ue]]}const P=J[ue];return J[ue]+=L,[P,J[ue]]}}}}),it("packages/modules/charts/labels.js",function(n,re){"use strict";Object.defineProperty(n,"resolveLabels",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"collides",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"placeLabels",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"labelText",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"drawAnchoredLabels",{enumerable:!0,get:function(){return O}}),Object.defineProperty(n,"drawDataLabels",{enumerable:!0,get:function(){return Q}});const ce=re("packages/modules/charts/frame.js").Pool,N=re("packages/modules/charts/format.js"),ve=N.measureText,xe=N.stringFormatter,ie=re("packages/modules/charts/svg.js"),ae=ie.attrs,J=ie.round,ue=ie.setText,f=re("packages/modules/charts/styles.js").NS,L=re("packages/modules/charts/typography.js"),P=L.applySize,W=L.textWidth,U=4;function v(w){const R=w&&w.labels;if(!R)return{show:!1,names:R!==!1,position:"outside",format:null,minGap:2,total:!1};const i=typeof R=="object"?R:{};return{show:!0,names:!0,position:["outside","inside","auto"].includes(i.position)?i.position:"outside",format:i.format||null,minGap:Number.isFinite(i.minGap)?Number(i.minGap):2,total:!!i.total}}function m(w,R,i){for(const x of R)if(w.x-i<x.x+x.width&&w.x+w.width+i>x.x&&w.y-i<x.y+x.height&&w.y+w.height+i>x.y)return!0;return!1}function u(w){const{points:R,plot:i,size:x}=w,T=w.minGap===void 0?2:w.minGap,h=[],g=[];for(const j of R){if(j.px===void 0||j.py===void 0)continue;const X=w.text(j);if(!X)continue;const K=W(X,x),pe=x;let ne=j.px,C=j.py-U,q="middle",z=!1;w.horizontal?(ne=j.px+U,C=j.py,q="start",w.position!=="outside"&&j.pbase!==void 0&&Math.abs(j.px-j.pbase)>K+U*2&&(ne=j.px-U,q="end",z=!0)):w.position!=="outside"&&j.pbase!==void 0&&Math.abs(j.pbase-j.py)>pe+U*2&&(C=j.py+pe+U,z=!0);const t=()=>({x:q==="middle"?ne-K/2:q==="end"?ne-K:ne,y:C-pe,width:K,height:pe});let e=t();!(e.y>=i.top-1)&&!z&&!w.horizontal&&j.pbase!==void 0&&Math.abs(j.pbase-j.py)>pe+U*2&&(C=j.py+pe+U,z=!0,e=t()),!(e.x+e.width<=i.right+1)&&!z&&w.horizontal&&j.pbase!==void 0&&Math.abs(j.px-j.pbase)>K+U*2&&(ne=j.px-U,q="end",z=!0,e=t()),!(e.x<i.left-1||e.x+e.width>i.right+1)&&(e.y<i.top-1||e.y+e.height>i.bottom+pe||m(e,h,T)||(h.push(e),g.push({x:J(ne),y:J(C),text:X,anchor:q,inside:z})))}return g}function b(w,R,i){if(w==null)return"";if(typeof R.format=="function")return String(R.format(w));if(typeof R.format=="string"){const x=xe(R.format,i,"labels.format");if(x)return x(w)}return ve(w,i&&i.messages)}function O(w){const R=new ce(w.group),i=w.minGap===void 0?2:w.minGap,x=w.size,T=[];let h=0;for(const g of w.anchors){if(!g||!g.text)continue;const j=g.width===void 0?W(g.text,w.size):g.width,X=g.anchor||"middle",pe={x:X==="end"?g.x-j:X==="start"?g.x:g.x-j/2,y:g.y-x/2,width:j,height:x};if(w.plot&&(pe.x<w.plot.left-1||pe.x+pe.width>w.plot.right+1||pe.y<w.plot.top-1||pe.y+pe.height>w.plot.bottom+1)||g.width!==void 0&&j>g.width||g.height!==void 0&&x>g.height||m(pe,T,i))continue;T.push(pe);const ne=R.next("text",g.className||`${f}__data-label`);P(ne,w.size),ae(ne,{x:J(g.x),y:J(g.y),"text-anchor":X,"dominant-baseline":g.baseline||"middle","data-inside":g.inside?"true":null}),ue(ne,g.text),h++}return R.finish(),h}function Q(w){const R=new ce(w.group),{options:i}=w;let x=0;const T=h=>typeof i.format=="function"&&h.y!==null&&h.y!==void 0?String(i.format(h.y,h)):b(h.y,i,w.grid);for(const h of w.series){const g=u({points:h.points,plot:w.plot,size:w.size,position:i.position,horizontal:w.horizontal,minGap:i.minGap,text:T});for(const j of g){const X=R.next("text",`${f}__data-label`);P(X,w.size),ae(X,{x:j.x,y:j.y,"text-anchor":j.anchor,"data-inside":j.inside?"true":null}),ue(X,j.text),x++}}return R.finish(),x}}),it("packages/modules/charts/dense.js",function(n,re){"use strict";Object.defineProperty(n,"CANVAS_THRESHOLD",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(n,"downsample",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"markCount",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"wantsCanvas",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(n,"paintDense",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"sizeCanvas",{enumerable:!0,get:function(){return ie}});const Se=3e3;function ce(ae,J){const ue=ae.length;if(!Number.isFinite(J)||J>=ue||J<3||ue<3)return ae;const B=[ae[0]],f=(ue-2)/(J-2);let L=0;for(let P=0;P<J-2;P++){const W=Math.floor(P*f)+1,U=Math.min(Math.floor((P+1)*f)+1,ue-1),v=U,m=Math.min(Math.floor((P+2)*f)+1,ue);let u=0,b=0,O=0;for(let i=v;i<m;i++){const x=ae[i];!x||!Number.isFinite(x.y)||(u+=x.x,b+=x.y,O++)}O&&(u/=O,b/=O);const Q=ae[L];if(W>=U)continue;let w=W,R=-1;for(let i=W;i<U;i++){const x=ae[i];if(!x||!Number.isFinite(x.y))continue;const T=Math.abs((Q.x-u)*(x.y-Q.y)-(Q.x-x.x)*(b-Q.y));T>R&&(R=T,w=i)}w<=L||(B.push(ae[w]),L=w)}return B.push(ae[ue-1]),B}function N(ae){let J=0;for(const ue of ae)J+=ue.points.length;return J}function ve(ae){if(ae.canvas===!0)return!0;if(ae.canvas===!1)return!1;const J=Number.isFinite(ae.canvas)?Number(ae.canvas):Se;return N(ae.series)>J}function xe(ae){const{context:J,series:ue,ratio:B}=ae;J.save(),J.scale(B,B);for(const f of ue){const L=ae.colour(f.index);if(ae.type==="scatter"||ae.type==="bubble"){J.fillStyle=L;for(const W of f.points)W.px!==void 0&&(J.beginPath(),J.arc(W.px,W.py,W.pr||2,0,Math.PI*2),J.fill());continue}J.strokeStyle=L,J.lineWidth=2,J.lineJoin="round",J.beginPath();let P=!1;for(const W of f.points){if(W.px===void 0||W.py===void 0){P=!1;continue}P?J.lineTo(W.px,W.py):J.moveTo(W.px,W.py),P=!0}J.stroke()}J.restore()}function ie(ae){const{canvas:J}=ae;return J.width=Math.max(1,Math.round(ae.width*ae.ratio)),J.height=Math.max(1,Math.round(ae.height*ae.ratio)),J.style&&(J.style.width=`${ae.width}px`,J.style.height=`${ae.height}px`),typeof J.getContext=="function"?J.getContext("2d"):null}}),it("packages/modules/charts/annotations.js",function(n,re){"use strict";Object.defineProperty(n,"overlayLayer",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"annotationValue",{enumerable:!0,get:function(){return x}}),Object.defineProperty(n,"annotationAxis",{enumerable:!0,get:function(){return T}}),Object.defineProperty(n,"annotationText",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"drawAnnotations",{enumerable:!0,get:function(){return j}});const ce=re("packages/modules/charts/frame.js").Pool,N=re("packages/modules/charts/scale.js"),ve=N.isNumber,xe=N.toNumber,ie=N.toTime,ae=re("packages/modules/charts/svg.js"),J=ae.attrs,ue=ae.path,B=ae.round,f=ae.setText,L=ae.SVG_NS,W=re("packages/modules/charts/styles.js").NS,v=re("packages/core/src/internal/util.js").warnOnce;function m(X,K){for(const ne of X.childNodes||[])if(ne&&String(ne.getAttribute&&ne.getAttribute("class"))===K)return ne;const pe=X.ownerDocument.createElementNS(L,"g");return pe.setAttribute("class",K),X.appendChild(pe),pe}const u=new Set(["line","target","band","callout","event"]);function b(X,K){return X.kind==="time"?ie(K):xe(K)}function O(X,K,pe){if(X.kind==="band"){const C=X.of(K);if(!Number.isFinite(C))return NaN;const q=Number(X.bandwidth)||0;return pe==="right"?C+q:C}const ne=b(X,K);return ne===null?NaN:X.of(ne)}function Q(X,K,pe){const ne=X.kind||"line",C=X.label?` (${JSON.stringify(X.label)})`:"";v(`chart:annotation:dropped:${ne}:${K}:${pe}`,`chart annotation${C} of kind ${JSON.stringify(ne)}, reading the ${K} axis, was not drawn: ${pe}.`)}function w(X,K){if(X instanceof Date){const ne=X.getTime();return Number.isFinite(ne)?X.toISOString().slice(0,10):String(X)}if(typeof X=="number")return Number.isFinite(X)?K(X):String(X);const pe=xe(X);return pe===null||typeof X=="string"?String(X):K(pe)}function R(X,K,pe){const ne=[];for(const C of X)if((C.axis==="right"?"right":"left")===pe&&!(K.series!==void 0&&C.key!==K.series))for(const z of C.points)ve(z.y)&&ne.push(Number(z.y));return ne}function i(X,K){if(!X.length)return null;const pe=[...X].sort((z,t)=>z-t);if(pe.length===1)return pe[0];const ne=Math.min(100,Math.max(0,K))/100*(pe.length-1),C=Math.floor(ne),q=Math.ceil(ne);return C===q?pe[C]:pe[C]+(pe[q]-pe[C])*(ne-C)}function x(X,K,pe){if(!X.compute)return xe(X.value);const ne=R(K,X,pe);if(!ne.length)return null;const C=String(X.compute).toLowerCase();if(C==="mean"||C==="avg")return ne.reduce((z,t)=>z+t,0)/ne.length;if(C==="median"||C==="p50")return i(ne,50);if(C==="min")return Math.min(...ne);if(C==="max")return Math.max(...ne);const q=/^p(\d+(?:\.\d+)?)$/.exec(C);return q?i(ne,Number(q[1])):null}function T(X){return X.axis==="right"||X.axis==="y2"?"right":"left"}function h(X,K,pe,ne){const C=X.label?`${X.label}: `:"",q=ne?` (${T(X)==="right"?"right axis":"left axis"})`:"",z=X.kind||"line";if(z==="band"){if(!Array.isArray(K)||K[0]===null||K[1]===null)return"";const[e,s]=K;return`${C||"Band: "}${pe(Math.min(e,s))} to ${pe(Math.max(e,s))}${q}`}return K==null?"":`${C||`${z==="target"?"Target":z==="callout"?"Callout":"Reference"}: `}${pe(K)}${q}`}function g(X){return(X.kind||"line")==="band"?0:1}function j(X){const{group:K,plot:pe,xScale:ne,yScale:C,rightScale:q,series:z,format:t}=X,e=new ce(m(K,`${W}__annotations`)),s=[],p=[...Array.isArray(X.annotations)?X.annotations:[]].sort((M,ee)=>g(M)-g(ee));for(const M of p){const ee=M.kind||"line";if(!u.has(ee))continue;const H=T(M),F=H==="right"&&q?q:C;if(ee==="band"){if(M.orient==="vertical"){const _=O(ne,M.from,"left"),oe=O(ne,M.to,"right");if(Number.isNaN(_)||Number.isNaN(oe)){const k=Number.isNaN(_)&&Number.isNaN(oe)?"from and to":Number.isNaN(_)?"from":"to";Q(M,H,`its ${k} value could not be placed on the x scale`);continue}const a=B(Math.min(_,oe)),y=B(Math.max(_,oe));if(J(e.next("rect",`${W}__annotation-band ${M.className||""}`.trim()),{x:a,y:B(pe.top),width:Math.max(0,y-a),height:B(Math.max(0,pe.bottom-pe.top)),fill:M.colour||"currentColor","fill-opacity":M.opacity===void 0?.12:M.opacity}),M.label){const k=e.next("text",`${W}__annotation-label`);J(k,{x:a+4,y:B(pe.top+12),"text-anchor":"start"}),f(k,M.label)}const r=M.label?`${M.label}: `:"Event window: ";s.push({text:`${r}${w(M.from,t)} to ${w(M.to,t)}`});continue}const D=x({...M,value:M.from,compute:M.fromCompute},z,H),V=x({...M,value:M.to,compute:M.toCompute},z,H);if(D===null||V===null){Q(M,H,`its ${D===null&&V===null?"from and to":D===null?"from":"to"} value could not be resolved (a number, or a compute that finds values)`);continue}const de=B(F.of(D)),$=B(F.of(V));if(J(e.next("rect",`${W}__annotation-band ${M.className||""}`.trim()),{x:B(pe.left),y:Math.min(de,$),width:B(Math.max(0,pe.right-pe.left)),height:Math.max(0,Math.abs($-de)),fill:M.colour||"currentColor","fill-opacity":M.opacity===void 0?.12:M.opacity}),M.label){const _=e.next("text",`${W}__annotation-label`);J(_,{x:B(pe.left+4),y:Math.min(de,$)+12,"text-anchor":"start"}),f(_,M.label)}s.push({text:h(M,[D,V],t,X.dual)});continue}if(ee==="event"){const D=M.x!==void 0?M.x:M.at,V=B(O(ne,D,"left")+(ne.kind==="band"?(Number(ne.bandwidth)||0)/2:0));if(Number.isNaN(V)){Q(M,H,"its x value could not be placed on the x scale");continue}if(J(e.next("path",`${W}__annotation-event`),{d:ue(["M",V,B(pe.top),"L",V,B(pe.bottom)]),stroke:M.colour||"currentColor",fill:"none"}),J(e.next("circle",`${W}__annotation-event-flag`),{cx:V,cy:B(pe.top),r:3,fill:M.colour||"currentColor"}),M.label){const $=e.next("text",`${W}__annotation-label`);J($,{x:V+5,y:B(pe.top+10),"text-anchor":"start"}),f($,M.label)}const de=M.label?`${M.label} — `:"Event — ";s.push({text:`${de}at ${w(D,t)}`});continue}if(ee==="callout"){const D=x(M,z,H);if(D===null){Q(M,H,"its value could not be resolved (a number, or a compute that finds values)");continue}const V=M.at!==void 0?B(ne.kind==="band"?ne.centre(M.at):ne.of(b(ne,M.at)??NaN)):B(pe.right-4),de=B(F.of(D));if(Number.isNaN(V)){Q(M,H,"its x value could not be placed on the x scale");continue}if(J(e.next("circle",`${W}__annotation-point`),{cx:V,cy:de,r:3.5,fill:M.colour||"currentColor"}),M.label){const $=e.next("text",`${W}__annotation-label`);J($,{x:V+6,y:de-6,"text-anchor":"start"}),f($,M.label)}s.push({text:h(M,D,t,X.dual)});continue}if(M.orient==="vertical"||M.x!==void 0){const D=M.x!==void 0?M.x:M.value,V=ne.kind==="band"?B(ne.centre(D)):B(ne.of(b(ne,D)??NaN));if(Number.isNaN(V)){Q(M,H,"its x value could not be placed on the x scale");continue}const de=ee==="target"?`${W}__annotation-target`:`${W}__annotation-line`;if(J(e.next("path",de),{d:ue(["M",V,B(pe.top),"L",V,B(pe.bottom)]),stroke:M.colour||"currentColor",fill:"none"}),M.label){const $=e.next("text",`${W}__annotation-label`);J($,{x:V+4,y:B(pe.top+10),"text-anchor":"start"}),f($,M.label)}s.push({text:M.label?`${M.label} — at ${w(D,t)}`:""});continue}const o=x(M,z,H);if(o===null){Q(M,H,"its value could not be resolved (a number, or a compute that finds values)");continue}const A=B(F.of(o)),G=ee==="target"?`${W}__annotation-target`:`${W}__annotation-line`;if(J(e.next("path",G),{d:X.horizontal?ue(["M",A,B(pe.top),"L",A,B(pe.bottom)]):ue(["M",B(pe.left),A,"L",B(pe.right),A]),stroke:M.colour||"currentColor",fill:"none"}),M.label){const D=e.next("text",`${W}__annotation-label`);J(D,X.horizontal?{x:A+4,y:B(pe.top+10),"text-anchor":"start"}:{x:B(pe.right-4),y:A-4,"text-anchor":"end"}),f(D,M.label)}s.push({text:h(M,o,t,X.dual)})}return e.finish(),s.filter(M=>M.text)}}),it("packages/modules/charts/curve.js",function(n,re){"use strict";Object.defineProperty(n,"CURVES",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"STEP_MODES",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(n,"resolveCurve",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"curveCommands",{enumerable:!0,get:function(){return ie}});const ce=re("packages/modules/charts/svg.js").round,N=Object.freeze(["linear","monotone","catmullRom","step"]),ve=Object.freeze(["after","before","middle"]);function xe(f,L){let P=f;if(P&&typeof P=="object"&&!Array.isArray(P)&&typeof P.type!="string"&&(P=L!=null&&Object.prototype.hasOwnProperty.call(P,L)?P[L]:void 0),P==null||P===!0||P===!1)return null;if(typeof P=="string")return P==="linear"?null:N.includes(P)?{type:P,tension:1,mode:"after"}:null;if(typeof P=="object"){const W=typeof P.type=="string"&&N.includes(P.type)?P.type:"linear";if(W==="linear")return null;const U=Number.isFinite(P.tension)?Math.max(0,Math.min(1,Number(P.tension))):1,v=ve.includes(P.mode)?P.mode:"after";return{type:W,tension:U,mode:v}}return null}function ie(f,L){return f.length?!L||L.type==="linear"?ae(f):L.type==="step"?J(f,L.mode):L.type==="monotone"?ue(f):L.type==="catmullRom"?B(f,L.tension):ae(f):[]}function ae(f){const L=["M",ce(f[0].x),ce(f[0].y)];for(let P=1;P<f.length;P++)L.push("L",ce(f[P].x),ce(f[P].y));return L}function J(f,L){const P=["M",ce(f[0].x),ce(f[0].y)];for(let W=1;W<f.length;W++){const U=f[W-1].x,v=f[W-1].y,m=f[W].x,u=f[W].y;if(L==="before")P.push("L",ce(U),ce(u),"L",ce(m),ce(u));else if(L==="middle"){const b=ce((U+m)/2);P.push("L",b,ce(v),"L",b,ce(u),"L",ce(m),ce(u))}else P.push("L",ce(m),ce(v),"L",ce(m),ce(u))}return P}function ue(f){const L=f.length;if(L<2)return["M",ce(f[0].x),ce(f[0].y)];if(L===2)return["M",ce(f[0].x),ce(f[0].y),"L",ce(f[1].x),ce(f[1].y)];const P=[];for(let v=0;v<L-1;v++){const m=f[v+1].x-f[v].x,u=f[v+1].y-f[v].y;P[v]=m===0?0:u/m}const W=new Array(L);W[0]=P[0],W[L-1]=P[L-2];for(let v=1;v<L-1;v++)W[v]=P[v-1]*P[v]<=0?0:(P[v-1]+P[v])/2;for(let v=0;v<L-1;v++)P[v]===0&&(W[v]=0,W[v+1]=0);for(let v=0;v<10;v++){let m=!1;for(let u=0;u<L-1;u++){if(P[u]===0)continue;const b=W[u]/P[u],O=W[u+1]/P[u],Q=b*b+O*O;if(Q>9){const w=3/Math.sqrt(Q);W[u]=w*b*P[u],W[u+1]=w*O*P[u],m=!0}}if(!m)break}const U=["M",ce(f[0].x),ce(f[0].y)];for(let v=0;v<L-1;v++){const m=f[v].x,u=f[v].y,b=f[v+1].x,O=f[v+1].y,Q=b-m,w=m+Q/3,R=u+W[v]*Q/3,i=b-Q/3,x=O-W[v+1]*Q/3;U.push("C",ce(w),ce(R),ce(i),ce(x),ce(b),ce(O))}return U}function B(f,L){const P=f.length;if(P<2)return["M",ce(f[0].x),ce(f[0].y)];const W=Number.isFinite(L)?Math.max(0,Math.min(1,L)):1,U=["M",ce(f[0].x),ce(f[0].y)];for(let v=0;v<P-1;v++){const m=f[v-1]||f[v],u=f[v],b=f[v+1],O=f[v+2]||f[v+1],Q=u.x+(b.x-m.x)/6*W,w=u.y+(b.y-m.y)/6*W,R=b.x-(O.x-u.x)/6*W,i=b.y-(O.y-u.y)/6*W;U.push("C",ce(Q),ce(w),ce(R),ce(i),ce(b.x),ce(b.y))}return U}}),it("packages/modules/charts/combo.js",function(n,re){"use strict";Object.defineProperty(n,"toPareto",{enumerable:!0,get:function(){return V}}),Object.defineProperty(n,"drawCombo",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"drawRightAxis",{enumerable:!0,get:function(){return oe}});const Se=re("packages/modules/charts/axis.js"),ce=Se.drawAxisLines,N=Se.drawAxisTitle,ve=Se.drawCategoryAxis,xe=Se.drawContinuousAxis,ie=Se.drawMeasureAxis,ae=Se.heldInside,J=Se.overhangFor,ue=Se.pinXDomain,B=Se.setPlotClip,f=Se.tickLabeller,L=Se.tickValues,P=re("packages/modules/charts/frame.js"),W=P.Pool,U=P.shouldRotate,m=re("packages/modules/charts/format.js").formatters,u=re("packages/modules/charts/scale.js"),b=u.bandScale,O=u.extent,Q=u.isNumber,w=u.linearScale,R=u.measureDomain,i=u.timeScale,x=u.toNumber,T=u.toTime,h=re("packages/modules/charts/stack.js"),g=h.measureValues,j=h.stacker,X=re("packages/modules/charts/svg.js"),K=X.attrs,pe=X.path,ne=X.round,q=re("packages/modules/charts/styles.js").NS,t=re("packages/modules/charts/scheme.js").resolveScheme,s=re("packages/modules/charts/labels.js").drawDataLabels,p=re("packages/modules/charts/annotations.js").drawAnnotations,M=re("packages/modules/charts/curve.js"),ee=M.curveCommands,H=M.resolveCurve;function F(a){return{left:a.filter(y=>y.axis!=="right"),right:a.filter(y=>y.axis==="right")}}function o(a,y){const r=a&&a.seriesStyle&&a.seriesStyle[y];if(r)return{width:r.width!=null?String(r.width):null,dash:Array.isArray(r.dash)&&r.dash.length?r.dash.join(" "):null,opacity:null,emphasized:!1};const k=a&&Array.isArray(a.emphasis)?a.emphasis:null;if(!k||!k.length)return{width:null,dash:null,opacity:null,emphasized:!1};const l=k.includes(y);return{width:l?"var(--lattice-chart-emphasis-width, 3.5)":null,dash:null,opacity:l?null:"var(--lattice-chart-muted-opacity, .35)",emphasized:l}}function A(a,y,r,k,l=null){const I=[];let E=[];const Y=()=>{E.length===1?I.push("M",E[0].x,E[0].y):E.length>1&&I.push(...ee(E,l)),E=[]};for(const se of y.points){if(se.px===void 0){Y();continue}E.push({x:se.px,y:se.py})}Y(),K(a.next("path",`${q}__line ${q}__mark`),{d:I.length?pe(I):"",stroke:r,"data-series":y.index,"stroke-width":k.width,"stroke-dasharray":k.dash,opacity:k.opacity});for(const se of y.points)se.px!==void 0&&K(a.next("circle",`${q}__point ${q}__mark`),{cx:se.px,cy:se.py,r:3,fill:r})}function G(a,y){return y?{tick:r=>`${a.tick(r)}%`,value:r=>`${a.value(r)}%`}:a}function D(a,y,r,k,l){const I=a.filter(se=>(se.mark||"bar")==="bar"),E=a.filter(se=>(se.mark||"bar")!=="bar"),Y=k?g(I,!0,!0):r?[...g(I,!0,!1),...E.length?g(E,!1,!1):[]]:g(a,!1,!1);return R(Y,{zero:y,min:l&&l.min,max:l&&l.max})}function V(a){const y=a.series[0];if(!y)return a;const r=y.points.map((E,Y)=>({point:E,label:a.labels[Y],category:a.categories[Y]})).filter(E=>Q(E.point.y)).sort((E,Y)=>Y.point.y-E.point.y),k=r.reduce((E,Y)=>E+Y.point.y,0);let l=0;const I=r.map(E=>(l+=E.point.y,k>0?l/k*100:0));return{...a,categories:r.map(E=>E.category),labels:r.map(E=>E.label),series:[{...y,index:0,mark:"bar",axis:"left",points:r.map(E=>E.point)},{key:"cumulative",label:a.cumulativeLabel||"%",index:1,mark:"line",axis:"right",points:r.map((E,Y)=>({x:E.category,xKey:E.point.xKey,label:E.label,y:I[Y],rows:E.point.rows,rowKey:E.point.rowKey}))}]}}function de(a,y,r){const k=[y.left,y.right];if(a.kind!=="time"&&a.kind!=="linear")return b(a.categories,k,.2);const l=a.kind==="time"?a.categories.map(T):a.categories.map(x);if(a.kind==="time"){const Y=O(l);if(Y&&Y.min===Y.max)return i(ue({min:Y.min-3e4,max:Y.max+3e4},a,r),k)}const I=a.xDomain||R(l,{zero:!1,nice:a.kind!=="time"}),E=a.xDomain?I:ue(I,a,r);return a.kind==="time"?i(E,k):w(E,k)}function $(a,y){const r=[...new Set(a.filter(Y=>Number.isFinite(Y)))].sort((Y,se)=>Y-se);if(r.length<2){const[Y,se]=y.range;return Math.max(4,(se-Y)/10)}const k=[];for(let Y=1;Y<r.length;Y++)k.push(r[Y]-r[Y-1]);k.sort((Y,se)=>Y-se);const l=Math.floor(k.length/2),I=k.length%2?k[l]:(k[l-1]+k[l])/2,E=Math.abs(y.of(r[0]+I)-y.of(r[0]));return Math.max(1,E*.8)}function _(a){const y=a.scheme||t(),r=a.axis||{x:{},y:{},y2:{}},{plot:k}=a,l=a.pareto?V(a.bound):a.bound,I=l.series.filter(ct=>!a.hidden.has(ct.key)),E=F(I),Y=ct=>(ct.mark||"bar")==="bar",se=E.left.some(Y),le=E.left.filter(Y),ye=a.stack==="percent"&&le.length>1&&!E.right.length,be=(ye||!!a.stack)&&le.length>1&&!E.right.length,Ae=l.yDomain||D(E.left,se,be,ye,r.y),Ne=w(Ae,[k.bottom,k.top]),te=E.right.length?a.pareto?{min:0,max:100}:D(E.right,E.right.some(Y),!1,!1,r.y2):null,Me=te?w(te,[k.bottom,k.top]):null,ke=de(l,k,r.x),we=ke.kind!=="band",je=we?l.categories.map(ct=>l.kind==="time"?T(ct):x(ct)):null,Pe=r.y.position==="right"?"right":"left";ie({gridGroup:a.groups.grid,axisGroup:a.groups.axis,plot:k,scale:Ne,format:G(m(a.grid,{kind:"linear",step:(Ae.max-Ae.min)/5}),ye),config:r.y,grid:a.grid,size:a.fontSize,side:Pe});const Ce=l.dimension&&l.dimension.col?a.grid.columns.get(l.dimension.col):void 0;we?xe({group:a.groups.overlay,plot:k,scale:ke,format:m(a.grid,{kind:l.kind,span:ke.domain.max-ke.domain.min,step:(ke.domain.max-ke.domain.min)/5},Ce),config:r.x,grid:a.grid,size:a.fontSize}):ve({group:a.groups.overlay,plot:k,scale:ke,labels:l.labels,fontSize:a.fontSize,rotated:U(l.labels,ke.step,a.fontSize),config:r.x}),ce({group:a.groups.rules,plot:k,side:Pe});const $e=a.typography&&a.typography.axisTitle||a.fontSize;if(N({group:a.groups.axis,plot:k,text:r.y.title,side:Pe,size:$e}),N({group:a.groups.axis,plot:k,text:r.x.title,side:"bottom",size:$e}),Me){oe({group:a.groups.axis,plot:k,scale:Me,colour:y.series(E.right[0].index,E.right[0].label),format:m(a.grid,{kind:"linear",step:(te.max-te.min)/5}),config:r.y2,grid:a.grid,suffix:a.pareto?"%":"",side:Pe==="right"?"left":"right"});const ct=r.y2.title||(E.right.length===1?E.right[0].label:"");N({group:a.groups.axis,plot:k,text:ct,side:Pe==="right"?"left":"right",size:$e})}B(a.groups,k,J(a.type));const Le=new W(a.groups.marks),_e=I.filter(ct=>(ct.mark||"bar")==="bar"),ot=we?$(je,ke):ke.bandwidth,qe=be?ot:_e.length?ot/_e.length:ot,Xe=ye?l.categories.map((ct,St)=>le.reduce((Kt,Ye)=>{const nt=Ye.points[St]?Ye.points[St].y:null;return Q(nt)?Kt+Math.abs(nt):Kt},0)):null,We=be?j(l.categories.length,Xe):null;let et=0;const He=[];for(const ct of I){const St=ct.mark||"bar",Kt=ct.axis==="right"&&Me?Me:Ne,Ye=y.series(ct.index,ct.label);if(St==="bar"){const mt=be?0:et*qe;et++;const Je=Kt.of(Math.max(Kt.domain.min,0));for(let lt=0;lt<ct.points.length;lt++){const kt=ct.points[lt];if(!Q(kt.y))continue;let Et;if(we){const Ot=l.kind==="time"?T(kt.x):x(kt.x);Et=Ot===null?NaN:ke.of(Ot)-ot/2}else Et=ke.of(kt.x);if(Number.isNaN(Et))continue;const ut=We?We.take(lt,kt.y):null,bt=Kt.of(ut?ut[1]:kt.y),ft=ut?Kt.of(ut[0]):Je;K(Le.next("rect",`${q}__bar ${q}__mark`),{x:ne(Et+mt),y:ne(Math.min(bt,ft)),width:ne(Math.max(0,qe)),height:ne(Math.max(1,Math.abs(ft-bt))),fill:Ye,"data-series":ct.index,"data-point":lt}),kt.px=ne(Et+mt+qe/2),kt.py=ne(Math.min(bt,ft))}continue}for(const mt of ct.points){if(!Q(mt.y)){mt.px=void 0;continue}let Je;if(we){const kt=l.kind==="time"?T(mt.x):x(mt.x);Je=kt===null?NaN:ne(ke.of(kt))}else Je=ne(ke.centre(mt.x));if(Number.isNaN(Je)){mt.px=void 0;continue}const lt=ne(Kt.of(mt.y));mt.px=Je,mt.py=lt}const nt=o(a,ct.label),yt=H(a.curve,ct.label);nt.emphasized?He.push({series:ct,colour:Ye,style:nt,curve:yt}):A(Le,ct,Ye,nt,yt)}for(const ct of He)A(Le,ct.series,ct.colour,ct.style,ct.curve);Le.finish(),a.labels&&a.labels.show&&s({group:a.groups.labels,series:I,plot:k,options:a.labels,grid:a.grid,size:a.typography&&a.typography.small||a.fontSize});let pt=null;return a.annotations&&a.annotations.length&&(pt=p({group:a.groups.overlay,plot:k,xScale:ke,yScale:Ne,rightScale:Me,series:I,annotations:a.annotations,dual:!!Me,format:m(a.grid,{kind:"linear",step:(Ae.max-Ae.min)/5}).tick})),{xScale:ke,yScale:Ne,rightScale:Me,dual:!!Me,series:I,bound:l,annotations:pt,percent:ye,percentTotals:Xe}}function oe(a){const{group:y,plot:r,scale:k,format:l}=a,I=a.config||{},E=a.side==="left"?"left":"right",Y=E==="right"?r.right:r.left,se=f(I,l,a.grid),le=new W(y,y.childNodes.length);K(le.next("line",`${q}__axis-right`),{x1:ne(Y),x2:ne(Y),y1:ne(r.top),y2:ne(r.bottom),stroke:a.colour});for(const ye of L(k,I)){const be=ne(k.of(ye)),Ae=le.next("text",`${q}__tick`);K(Ae,{x:ne(E==="right"?r.right+6:r.left-6),y:ae(be,r,11),"text-anchor":E==="right"?"start":"end","dominant-baseline":"middle",fill:a.colour}),Ae.textContent=`${se(ye)}${a.suffix||""}`}le.finish()}}),it("packages/modules/charts/quantile.js",function(n,re){"use strict";Object.defineProperty(n,"normalQuantile",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"studentTQuantile",{enumerable:!0,get:function(){return B}});const Se=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),ce=3e-12,N=1e-300;function ve(f){if(f<.5)return Math.log(Math.PI/Math.sin(Math.PI*f))-ve(1-f);const L=f-1;let P=.9999999999998099;const W=L+7.5;for(let U=0;U<Se.length;U++)P+=Se[U]/(L+U+1);return .5*Math.log(2*Math.PI)+(L+.5)*Math.log(W)-W+Math.log(P)}function xe(f,L,P){const W=f+L,U=f+1,v=f-1;let m=1,u=1-W*P/U;Math.abs(u)<N&&(u=N),u=1/u;let b=u;for(let O=1;O<=300;O++){const Q=2*O;let w=O*(L-O)*P/((v+Q)*(f+Q));u=1+w*u,Math.abs(u)<N&&(u=N),m=1+w/m,Math.abs(m)<N&&(m=N),u=1/u,b*=u*m,w=-(f+O)*(W+O)*P/((f+Q)*(U+Q)),u=1+w*u,Math.abs(u)<N&&(u=N),m=1+w/m,Math.abs(m)<N&&(m=N),u=1/u;const R=u*m;if(b*=R,Math.abs(R-1)<ce)break}return b}function ie(f,L,P){if(!(f>0)||!(L>0)||!Number.isFinite(P))return Number.NaN;if(P<=0)return 0;if(P>=1)return 1;const W=Math.exp(ve(f+L)-ve(f)-ve(L)+f*Math.log(P)+L*Math.log(1-P));return P<(f+1)/(f+L+2)?W*xe(f,L,P)/f:1-W*xe(L,f,1-P)/L}function ae(f){const L=Math.abs(f),P=2/(2+L),W=4*P-2,U=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,15626441722e-18,-85238095915e-18,6529054439e-18,5059343495e-18,-991364156e-18,-227365122e-18,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18];let v=0,m=0,u;for(let O=U.length-1;O>0;O--)u=m,m=W*m-v+U[O],v=u;const b=P*Math.exp(-L*L+.5*(U[0]+W*m)-v);return f>=0?b:2-b}function J(f){if(!(f>0)||!(f<1))return f===0?-1/0:f===1?1/0:Number.NaN;const L=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],P=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],W=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],U=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],v=.02425;let m,u,b;f<v?(m=Math.sqrt(-2*Math.log(f)),b=(((((W[0]*m+W[1])*m+W[2])*m+W[3])*m+W[4])*m+W[5])/((((U[0]*m+U[1])*m+U[2])*m+U[3])*m+1)):f<=1-v?(m=f-.5,u=m*m,b=(((((L[0]*u+L[1])*u+L[2])*u+L[3])*u+L[4])*u+L[5])*m/(((((P[0]*u+P[1])*u+P[2])*u+P[3])*u+P[4])*u+1)):(m=Math.sqrt(-2*Math.log(1-f)),b=-(((((W[0]*m+W[1])*m+W[2])*m+W[3])*m+W[4])*m+W[5])/((((U[0]*m+U[1])*m+U[2])*m+U[3])*m+1));const Q=(.5*ae(-b/Math.SQRT2)-f)*Math.sqrt(2*Math.PI)*Math.exp(b*b/2);return b-Q/(1+b*Q/2)}function ue(f,L){if(!(L>0)||!Number.isFinite(f))return Number.NaN;const P=.5*ie(L/2,.5,L/(L+f*f));return f>0?1-P:P}function B(f,L){if(!(f>0)||!(f<1)||!(L>0))return Number.NaN;if(L>1e7)return J(f);let P=-1e4,W=1e4,U=J(f);const v=ve(L/2)+ve(.5)-ve((L+1)/2);for(let m=0;m<60;m++){const u=ue(U,L);u<f?P=U:W=U;const b=Math.exp(-((L+1)/2)*Math.log(1+U*U/L)-v)/Math.sqrt(L),O=b>0?(u-f)/b:0;if(Math.abs(O)<1e-12)break;const Q=U-O;if(U=Q>P&&Q<W&&Number.isFinite(Q)?Q:(P+W)/2,W-P<1e-12)break}return U}}),it("packages/modules/charts/trendline.js",function(n,re){"use strict";Object.defineProperty(n,"normaliseTrends",{enumerable:!0,get:function(){return x}}),Object.defineProperty(n,"linearTrend",{enumerable:!0,get:function(){return j}}),Object.defineProperty(n,"movingAverageTrend",{enumerable:!0,get:function(){return X}}),Object.defineProperty(n,"exponentialTrend",{enumerable:!0,get:function(){return C}}),Object.defineProperty(n,"computeTrend",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"trendText",{enumerable:!0,get:function(){return z}}),Object.defineProperty(n,"drawTrendlines",{enumerable:!0,get:function(){return t}});const ce=re("packages/modules/charts/frame.js").Pool,N=re("packages/modules/charts/svg.js"),ve=N.attrs,xe=N.path,ie=N.ribbonPath,ae=N.round,J=N.setText,ue=N.SVG_NS,f=re("packages/modules/charts/typography.js").applySize,P=re("packages/modules/charts/styles.js").NS,W=re("packages/modules/charts/scale.js"),U=W.toNumber,v=W.toTime,u=re("packages/modules/charts/quantile.js").studentTQuantile,O=re("packages/modules/charts/format.js").r2Digits,Q={linear:new Set(["linear","lr","ols","regression","least-squares"]),movingAverage:new Set(["movingaverage","moving-average","ma","sma","rolling"]),exponential:new Set(["exponential","exp","ewma","ses","holt","smoothing"])},w=1e-4,R=1-1e-4;function i(e){const s=String(e||"linear").toLowerCase();return Q.linear.has(s)?"linear":Q.movingAverage.has(s)?"movingAverage":Q.exponential.has(s)?"exponential":null}function x(e){if(!e)return[];const s=Array.isArray(e)?e:[e],d=[];for(const p of s){if(p===!0){d.push({method:"linear"});continue}if(typeof p=="string"){const M=i(p);M&&d.push({method:M});continue}if(p&&typeof p=="object"){const M=i(p.method);M&&d.push({...p,method:M})}}return d}function T(e,s){if(e.kind==="band")return e.centre(s);const d=e.kind==="time"?v(s):U(s);return d===null?NaN:e.of(d)}function h(e){const s=[];for(const d of e.points){const p=Number(d.y);s.push({value:Number.isFinite(p)?p:null,rawX:d.x})}return s}function g(e,s){const d=[];for(const p of e.points){const M=s.kind==="time"?v(p.x):U(p.x),ee=Number(p.y);M===null||!Number.isFinite(M)||!Number.isFinite(ee)||d.push({x:M,y:ee})}return d.sort((p,M)=>p.x-M.x),d}function j(e,s,d={}){const p=e.length;if(p<2)return null;let M=0,ee=0;for(const r of e)M+=r.x,ee+=r.y;M/=p,ee/=p;let H=0,F=0,o=0;for(const r of e){const k=r.x-M,l=r.y-ee;H+=k*k,F+=k*l,o+=l*l}if(H===0)return null;const A=F/H,G=ee-A*M,D=o===0?1:Math.max(0,Math.min(1,F*F/(H*o))),V=e[0].x,de=e[p-1].x,$=r=>({x:r,y:G+A*r}),_=[$(V),$(de)],oe=[];let a=null;const y=Math.max(0,Math.floor(Number(s)||0));if(y>0&&de>V){const r=(de-V)/(p-1);if(r>0&&(oe.push($(de),$(de+y*r)),p>2)){const k=Number.isFinite(d.confidence)&&d.confidence>0&&d.confidence<1?Number(d.confidence):.95,l=1-(1-k)/2,I=Math.max(0,o-A*F),E=Math.sqrt(I/(p-2)),Y=u(l,p-2),se=[];for(let le=0;le<=y;le++){const ye=de+le*r,be=G+A*ye,Ae=1/p+(ye-M)**2/H,Ne=E*Math.sqrt(1+Ae),te=E*Math.sqrt(Ae);se.push({x:ye,mean:be,lower:be-Y*Ne,upper:be+Y*Ne,lowerMean:be-Y*te,upperMean:be+Y*te})}a={confidence:k,points:se}}}return{fit:_,forecast:oe,band:a,stats:{method:"linear",slope:A,intercept:G,r2:D,n:p,forecast:oe.length?y:0,confidence:a?a.confidence:null}}}function X(e,s){const d=Math.max(1,Math.floor(Number(s)||3)),p=[];let M=0;const ee=[];for(const H of e)Number.isFinite(H.value)&&(p.push(H.value),M+=H.value,p.length>d&&(M-=p.shift())),p.length&&ee.push({x:H.rawX,y:M/p.length});return ee.length<2?null:{fit:ee,stats:{method:"movingAverage",window:d}}}function K(e,s){const d=e.length,p=new Array(d).fill(null);let M=null,ee=0;for(let H=0;H<d;H++){const F=e[H];if(!Number.isFinite(F)){M!==null&&(p[H]=M);continue}if(M===null){M=F,p[H]=F;continue}ee+=(F-M)**2,M=s*F+(1-s)*M,p[H]=M}return{smoothed:p,sse:ee}}function pe(e,s,d){const p=e.length,M=new Array(p).fill(null);let ee=null,H=null,F=0;for(let o=0;o<p;o++){const A=e[o];if(!Number.isFinite(A)){ee!==null&&(ee+=H,M[o]=ee);continue}if(ee===null){ee=A,M[o]=A;continue}if(H===null){H=A-ee;const V=ee+H;F+=(A-V)**2;const de=ee;ee=s*A+(1-s)*(de+H),H=d*(ee-de)+(1-d)*H,M[o]=ee;continue}const G=ee+H;F+=(A-G)**2;const D=ee;ee=s*A+(1-s)*(D+H),H=d*(ee-D)+(1-d)*H,M[o]=ee}return{smoothed:M,sse:F}}function ne(e,s,d,p=80){const M=(Math.sqrt(5)-1)/2;let ee=s,H=d,F=H-M*(H-ee),o=ee+M*(H-ee),A=e(F),G=e(o);for(let D=0;D<p;D++)A<G?(H=o,o=F,G=A,F=H-M*(H-ee),A=e(F)):(ee=F,F=o,A=G,o=ee+M*(H-ee),G=e(o));return(ee+H)/2}function C(e,s){const d=String(s.kind||s.model||"").toLowerCase()==="holt",p=e.map(G=>Number.isFinite(G.value)?G.value:null);if(p.filter(G=>G!==null).length<(d?2:1))return null;const ee=G=>Math.min(R,Math.max(w,G));let H=Number.isFinite(s.alpha)?ee(Number(s.alpha)):null,F=d&&Number.isFinite(s.beta)?ee(Number(s.beta)):null;if(d){if(H===null||F===null){let G=H===null?.5:H,D=F===null?.5:F;for(let V=0;V<6;V++)H===null&&(G=ne(de=>pe(p,de,D).sse,w,R)),F===null&&(D=ne(de=>pe(p,G,de).sse,w,R));H=H===null?G:H,F=F===null?D:F}}else H===null&&(H=ne(G=>K(p,G).sse,w,R));const o=d?pe(p,H,F):K(p,H),A=[];for(let G=0;G<e.length;G++){const D=o.smoothed[G];D===null||!Number.isFinite(D)||A.push({x:e[G].rawX,y:D})}return A.length<2?null:{fit:A,stats:{method:"exponential",kind:d?"holt":"ses",alpha:H,beta:d?F:null}}}function q(e,s,d){if(s.method==="linear"){const M=g(e,d);return j(M,s.forecast,{confidence:s.confidence})}const p=h(e);return s.method==="movingAverage"?X(p,s.window||s.period):C(p,s)}function z(e,s,d,p,M,ee){const H=s?` for ${s}`:"";if(e.method==="linear"){const G=Number.isFinite(e.r2)?`, R² ${e.r2.toFixed(2)}`:"";let D=`Trend (linear)${H}: slope ${d(e.slope)}${G}`;if(e.forecast>0&&p&&p.length){const V=p[p.length-1];if(D+=`; forecast ${e.forecast} step${e.forecast===1?"":"s"} ahead to ${d(V.y)}`,M&&M.points.length){const de=M.points[M.points.length-1],$=ee==="confidence"||ee==="mean",_=$?de.lowerMean:de.lower,oe=$?de.upperMean:de.upper,a=$?"confidence":"prediction",y=Math.round(M.confidence*100);D+=`; ${y}% ${a} band ${d(_)} to ${d(oe)} at the horizon`}}return D}if(e.method==="movingAverage")return`Trend (moving average, window ${e.window})${H}`;const F=e.kind==="holt"?"Holt":"single",o=Number.isFinite(e.alpha)?`, α ${e.alpha.toFixed(2)}`:"",A=Number.isFinite(e.beta)?`, β ${e.beta.toFixed(2)}`:"";return`Trend (exponential, ${F})${H}${o}${A}`}function t(e){const s=x(e.trend);if(!s.length)return[];const d=e.group.ownerDocument;let p=null;for(const H of e.group.childNodes||[])if(H&&String(H.getAttribute&&H.getAttribute("class"))===`${P}__trends`){p=H;break}p||(p=d.createElementNS(ue,"g"),p.setAttribute("class",`${P}__trends`),e.group.appendChild(p)),e.clip?p.setAttribute("clip-path",`url(#${e.clip})`):p.removeAttribute("clip-path");const M=new ce(p),ee=[];for(const H of s)for(const F of e.series){const o=F.axis==="right"&&e.rightScale?e.rightScale:e.yScale,A=q(F,H,e.xScale);if(!A)continue;const G=e.scheme.series(F.index),D=[];for(const $ of A.fit){const _=T(e.xScale,$.x),oe=o.of($.y);!Number.isFinite(_)||!Number.isFinite(oe)||D.push(D.length?"L":"M",ae(_),ae(oe))}if(D.length<4)continue;if(ve(M.next("path",`${P}__trend`),{d:xe(D),fill:"none",stroke:G,"data-series":F.index}),H.band!==!1&&A.band&&A.band.points.length>=2){const $=H.band==="confidence"||H.band==="mean",_=[];for(const a of A.band.points){const y=T(e.xScale,a.x),r=$?a.lowerMean:a.lower,k=$?a.upperMean:a.upper,l=o.of(r),I=o.of(k);!Number.isFinite(y)||!Number.isFinite(l)||!Number.isFinite(I)||_.push({x:ae(y),lower:ae(l),upper:ae(I)})}const oe=ie(_);oe&&ve(M.next("path",`${P}__trend-band`),{d:oe,fill:G,"fill-opacity":.15,stroke:"none","data-series":F.index})}const de=A.forecast||[];if(de.length>=2){const $=[];for(const _ of de){const oe=T(e.xScale,_.x),a=o.of(_.y);!Number.isFinite(oe)||!Number.isFinite(a)||$.push($.length?"L":"M",ae(oe),ae(a))}$.length>=4&&ve(M.next("path",`${P}__trend-forecast`),{d:xe($),fill:"none",stroke:G,"data-series":F.index})}if(H.label!==!1&&A.stats.method==="linear"&&Number.isFinite(A.stats.r2)){const $=A.fit[A.fit.length-1],_=M.next("text",`${P}__trend-label`);f(_,e.size),ve(_,{x:ae(T(e.xScale,$.x)),y:ae(o.of($.y))-4,"text-anchor":"end",fill:G}),J(_,e.grid.messages.t("chart.r2",{value:O(e.grid,A.stats.r2)}))}ee.push({text:z(A.stats,F.label,e.format,de,H.band===!1?null:A.band,H.band)})}return M.finish(),ee.filter(H=>H.text)}}),it("packages/modules/charts/rulecolour.js",function(n,re){"use strict";Object.defineProperty(n,"colourOf",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"ruleColour",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"ruleLegend",{enumerable:!0,get:function(){return ve}});const Se="*";function ce(xe){if(!xe||typeof xe!="object")return null;for(const ie of["background","backgroundColor","color"]){const ae=xe[ie];if(typeof ae=="string"&&ae.trim())return ae.trim()}return null}function N(xe){const{grid:ie,col:ae,value:J}=xe;if(!ie||!ae||!ie.formatting||typeof ie.formatting.styleFor!="function")return null;try{return ce(ie.formatting.styleFor(ae,J))}catch{return null}}function ve(xe){const{grid:ie,col:ae}=xe,J=new Set([...xe.colours||[]].filter(Boolean));if(!J.size||!ie||!ie.formatting||typeof ie.formatting.list!="function")return[];let ue;try{ue=[...ie.formatting.list(Se)||[],...ae?ie.formatting.list(ae)||[]:[]]}catch{return[]}const B=[],f=new Set;for(const L of ue){if(!L||L.enabled===!1)continue;const P=ce(L.style);!P||!J.has(P)||f.has(P)||(f.add(P),B.push({key:L.id||`rule:${B.length}`,label:L.label||L.id||P,colour:P,index:B.length}))}return B}}),it("packages/modules/charts/glyph.js",function(n,re){"use strict";Object.defineProperty(n,"glyphFor",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"glyphTransform",{enumerable:!0,get:function(){return ie}});const ce=re("packages/core/src/internal/util.js").warnOnce,ve=re("packages/modules/charts/svg.js").round;function xe(ae,J,ue="node"){if(!J)return null;const B=ue==="marker",f=B?"a chart image marker":"a network node",L=ae&&ae.icons;if(!L||typeof L.get!="function")return ce(`chart:icons:${J}`,`${f.charAt(0).toUpperCase()}${f.slice(1)} asked for the icon '${J}', but this grid publishes no icon registry — a headless grid has no sprites. The ${B?"point":"node"} drew as ${B?"its default marker":"a plain disc"}.`),null;const P=L.get(J);return P||(ce(`chart:icon:${J}`,`Unknown icon '${J}' on ${f}; ${B?"kept the default marker":"drew a plain disc"} instead. Register it with registerIcon or config.icons, or name a built-in.`),null)}function ie(ae,J){const ue=String(ae.viewBox||"0 0 16 16").trim().split(/[\s,]+/).map(Number),[B,f,L,P]=ue.length===4&&ue.every(Number.isFinite)?ue:[0,0,16,16],W=Math.max(L||16,P||16),U=J.size/W,v=J.x-L*U/2,m=J.y-P*U/2;return`translate(${ve(v-B*U)} ${ve(m-f*U)}) scale(${ve(U)})`}}),it("packages/modules/charts/markers.js",function(n,re){"use strict";Object.defineProperty(n,"MARKER_SIZE",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"clearMarkerImages",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"resolveMarker",{enumerable:!0,get:function(){return W}}),Object.defineProperty(n,"safeImageUrl",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"imageOf",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"imageState",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"markerFor",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"placeMarker",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"markerBoxHit",{enumerable:!0,get:function(){return O}});const ce=re("packages/core/src/internal/util.js").warnOnce,N=re("packages/modules/charts/glyph.js"),ve=N.glyphFor,xe=N.glyphTransform,ae=re("packages/modules/charts/styles.js").NS,J=16,ue=[6,64],B=/^data:image\/(png|jpe?g|gif|webp|avif|bmp|svg\+xml)[;,]/i,f=/^(https?:|blob:|data:|javascript:|vbscript:|file:|\/|\.\.?\/)|[/.]/i,L=new Map;function P(){L.clear()}function W(Q){if(!Q||typeof Q!="object"||Array.isArray(Q))return null;const w=Q.image;if(w==null||w==="")return ce("chart:marker:no-image",'chart "marker" needs an "image": an icon name, a URL, { col } or a function. No markers were drawn from it.'),null;const R=Number(Q.size);return{image:w,size:Number.isFinite(R)?Math.min(ue[1],Math.max(ue[0],R)):J,explicitSize:Number.isFinite(R)}}function U(Q){const w=String(Q).trim(),R=/^([a-z][a-z0-9+.-]*):/i.exec(w);if(R){const i=R[1].toLowerCase();return i==="data"?B.test(w)?w:null:i==="http"||i==="https"||i==="blob"?w:null}return/^[^/]*:/.test(w)?null:w}function v(Q,w,R){let i=Q.image;if(typeof i=="function")try{i=i(w)}catch{i=null}else i&&typeof i=="object"&&typeof i.col=="string"&&(i=R&&R.rows&&w&&w.rowKey!==void 0&&w.rowKey!==null?R.rows.value(w.rowKey,i.col):null);return typeof i=="string"&&i.trim()?i.trim():null}function m(Q,w,R){let i=L.get(Q);if(i)return i.state==="loading"&&R&&i.waiting.add(R),i.state;const x=w&&w.defaultView,T=x&&x.Image;if(typeof T!="function")return"ok";i={state:"loading",waiting:new Set(R?[R]:[])},L.set(Q,i);const h=new T,g=j=>{if(i.state=j,j==="failed"){const X=Q.length>80?Q.slice(0,77):Q;ce(`chart:marker:image-failed:${Q}`,`a chart marker image could not be loaded (${X}); those points keep the default marker. Check the URL, and that the server allows the page to load it.`)}for(const X of i.waiting)try{X()}catch{}i.waiting.clear()};return h.onload=()=>g("ok"),h.onerror=()=>g("failed"),h.src=Q,"loading"}function u(Q,w,R){const i=v(Q,w,R.grid);if(!i)return null;if(!f.test(i)){const T=ve(R.grid,i,"marker");return T?{kind:"icon",def:T}:null}const x=U(i);if(!x){const T=i.slice(0,40);return ce(`chart:marker:unsafe-url:${T}`,`a chart marker image URL was refused (${T}): only http, https, blob, relative and data:image URLs are drawn. Those points keep the default marker.`),null}return m(x,R.doc,R.redraw)==="ok"?{kind:"image",href:x}:null}function b(Q,w,R){const i=R.size/2;if(w.kind==="icon"){const T=w.def,h=T.paint==="stroke",g=Q.next("path",`${ae}__marker-icon ${ae}__mark`);return R.attrs(g,{d:T.paths.join(" "),transform:xe(T,{x:R.x,y:R.y,size:R.size}),fill:h?"none":R.colour,stroke:h?R.colour:null,"stroke-width":h?1.5:null,class:`${ae}__marker-icon ${ae}__mark`,...R.extra||{}}),g}const x=Q.next("image",`${ae}__marker-image ${ae}__mark`);return R.attrs(x,{href:w.href,x:R.round(R.x-i),y:R.round(R.y-i),width:R.size,height:R.size,preserveAspectRatio:"xMidYMid meet",class:`${ae}__marker-image ${ae}__mark`,...R.extra||{}}),x}function O(Q,w,R){return Math.abs(w-Q.x)<=Q.half&&Math.abs(R-Q.y)<=Q.half}}),it("packages/modules/charts/cartesian.js",function(n,re){"use strict";Object.defineProperty(n,"CARTESIAN",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(n,"WATERFALL_TOTAL",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(n,"withWaterfallTotal",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(n,"axisWindowSpan",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(n,"axisWindowNow",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(n,"rollingDomain",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(n,"WINDOW_LEAD",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(n,"aheadOfWindow",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(n,"staleWindow",{enumerable:!0,get:function(){return We}}),Object.defineProperty(n,"windowedBound",{enumerable:!0,get:function(){return et}}),Object.defineProperty(n,"slotPadFor",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(n,"pinnedContinuousX",{enumerable:!0,get:function(){return Kt}}),Object.defineProperty(n,"continuousX",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(n,"bandedX",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(n,"dataInterval",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(n,"continuousSlot",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(n,"xDomainFor",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(n,"xScaleFor",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(n,"drawFits",{enumerable:!0,get:function(){return Jt}}),Object.defineProperty(n,"drawConfidenceBand",{enumerable:!0,get:function(){return An}}),Object.defineProperty(n,"drawBoundErrorBars",{enumerable:!0,get:function(){return cn}}),Object.defineProperty(n,"drawForest",{enumerable:!0,get:function(){return un}}),Object.defineProperty(n,"drawReferenceLines",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(n,"drawCartesian",{enumerable:!0,get:function(){return sn}}),Object.defineProperty(n,"HIT_TOLERANCE",{enumerable:!0,get:function(){return Zn}}),Object.defineProperty(n,"nearestDrawnPoint",{enumerable:!0,get:function(){return kr}}),Object.defineProperty(n,"nearestCategory",{enumerable:!0,get:function(){return _r}}),Object.defineProperty(n,"categoryKeyAt",{enumerable:!0,get:function(){return xr}});const Se=re("packages/modules/charts/axis.js"),ce=Se.drawAxisLines,N=Se.drawAxisTitle,ve=Se.drawBandLabels,xe=Se.drawCategoryAxis,ie=Se.drawContinuousAxis,ae=Se.drawMeasureAxis,J=Se.overhangFor,ue=Se.pinXDomain,B=Se.setPlotClip,f=re("packages/modules/charts/frame.js"),L=f.Pool,P=f.shouldRotate,W=re("packages/modules/charts/format.js"),U=W.formatters,v=W.r2Digits,m=re("packages/modules/charts/scale.js"),u=m.bandScale,b=m.extent,O=m.isNumber,Q=m.key,w=m.linearScale,R=m.measureDomain,i=m.timeScale,x=m.toNumber,T=m.toTime,h=re("packages/modules/charts/stack.js"),g=h.measureValues,j=h.stacker,X=re("packages/modules/charts/svg.js"),K=X.attrs,pe=X.path,ne=X.ribbonPath,C=X.round,q=X.setText,z=X.SVG_NS,e=re("packages/modules/charts/styles.js").NS,d=re("packages/modules/charts/labels.js").drawDataLabels,M=re("packages/modules/charts/dense.js").downsample,H=re("packages/modules/charts/scheme.js").resolveScheme,o=re("packages/modules/charts/typography.js").applySize,G=re("packages/modules/charts/combo.js").drawRightAxis,D=re("packages/modules/charts/annotations.js"),V=D.drawAnnotations,de=D.overlayLayer,_=re("packages/modules/charts/trendline.js").drawTrendlines,oe=re("packages/modules/charts/rulecolour.js"),a=oe.ruleColour,y=oe.ruleLegend,r=re("packages/modules/charts/curve.js"),k=r.curveCommands,l=r.resolveCurve,E=re("packages/core/src/internal/util.js").warnOnce,Y=re("packages/modules/charts/fills.js"),se=Y.isPaintRef,le=Y.paintSolid,ye=Y.rowFillSource,be=re("packages/modules/charts/markers.js"),Ae=be.markerFor,Ne=be.placeMarker,te=be.resolveMarker,Me=3.5,ke=Object.freeze({line:{zero:!1,marks:"path"},step:{zero:!1,marks:"path"},area:{zero:!0,marks:"path"},rangeArea:{zero:!1,marks:"path"},bar:{zero:!0,marks:"rect"},horizontalBar:{zero:!0,marks:"rect",horizontal:!0},waterfall:{zero:!0,marks:"rect"},scatter:{zero:!1,marks:"circle"},bubble:{zero:!1,marks:"circle"},candlestick:{zero:!1,marks:"rect"},ohlc:{zero:!1,marks:"rect"}});function we(me){const Re=[];for(let Te=0;Te<me.length;Te++){const ze=me[Te];if(Te===0){Re.push("M",ze.x,ze.y);continue}Re.push("L",ze.x,me[Te-1].y),Re.push("L",ze.x,ze.y)}return Re}function je(me){const Re=[0];if(!me)return Re;let Te=0;for(const ze of me.points)O(ze.y)&&ze.total!==!0&&(Te+=ze.y,Re.push(Te));return Re}const Pe=Object.freeze({key:"lattice:waterfall-total"});function Ce(me,Re,Te){if(!Re||typeof Re!="object"||!Re.total||!me||me.empty||!Array.isArray(me.series)||!me.series.length)return me;const ze=typeof Re.total=="string"&&Re.total.trim()!==""?Re.total:Te,Fe=me.series.map(Be=>{let De=0,tt=0,Ke=!1;for(const rt of Be.points)tt+=Number.isFinite(rt.rows)?rt.rows:0,O(rt.y)&&(De+=rt.y,Ke=!0);const Ve={x:Pe,xKey:Q(Pe),label:ze,y:Ke?De:null,size:null,rows:tt,rowKey:null,values:null,total:!0};return{...Be,points:[...Be.points,Ve]}});return{...me,kind:"category",series:Fe,categories:[...me.categories||[],Pe],labels:[...me.labels||[],ze]}}function $e(me){const Re=me&&me.window;if(!Re||typeof Re!="object")return 0;const Te=Number(Re.span);return!Number.isFinite(Te)||Te<=0?0:Re.kind!=="time"?(E("chart.axis.window.kind",`axis window kind "${Re.kind}" is not supported on a chart axis; only { kind: "time", span } rolls the domain. Bound the row count with the source's maxRows instead.`),0):Te}function Le(me,Re){const Te=me&&me.window;if(!Te||typeof Te!="object"||typeof Te.now!="function")return Re;const ze=Number(Te.now());return Number.isFinite(ze)?ze:(E("chart.axis.window.now","axis.x.window.now did not return a time, so the rolling window is measured from this device's clock instead. It must return epoch milliseconds — the same number Date.now() returns — because that is what the x values are compared against."),Re)}function _e(me,Re,Te){const ze=Te+me*ot;let Fe=Te;for(const Be of Re)Number.isFinite(Be)&&Be>Fe&&Be<=ze&&(Fe=Be);return{min:Fe-me,max:Fe}}const ot=.25;function qe(me,Re,Te){const ze=$e(Re);if(!ze||!me||!Array.isArray(me.categories))return null;const Fe=ke[Te];if(!Fe||Fe.horizontal||me.kind==="category"||Te==="bar"&&!Ye(me,Te,Re))return null;const Be=me.categories.map(De=>me.kind==="time"?T(De):x(De));return{span:ze,values:Be}}function Xe(me,Re,Te,ze){const Fe=qe(me,Re,Te);if(!Fe)return null;const Be=Fe.span*ot;let De=0,tt=0;for(const Ke of Fe.values)Ke===null||!Number.isFinite(Ke)||Ke-ze<=Be||(De+=1,Ke-ze>tt&&(tt=Ke-ze));return De?{span:Fe.span,limit:Be,count:De,lead:tt}:null}function We(me,Re,Te,ze){const Fe=qe(me,Re,Te);if(!Fe)return null;const{span:Be}=Fe,De=Fe.values.filter(rt=>rt!==null&&Number.isFinite(rt));if(!De.length)return null;const{min:tt,max:Ke}=_e(Be,De,ze);let Ve=-1/0;for(const rt of De){if(rt>=tt&&rt<=Ke)return null;rt<tt&&rt>Ve&&(Ve=rt)}return Ve===-1/0?{span:Be,newest:null,age:null,points:De.length}:{span:Be,newest:Ve,age:ze-Ve,points:De.length}}function et(me,Re,Te,ze){const Fe=qe(me,Re,Te);if(!Fe)return me;const{span:Be,values:De}=Fe,tt=De.filter(st=>st!==null&&Number.isFinite(st));if(!tt.length)return me;const{min:Ke,max:Ve}=_e(Be,tt,ze),rt=[];for(let st=0;st<De.length;st++){const xt=De[st];(xt===null||!Number.isFinite(xt)||xt>=Ke&&xt<=Ve)&&rt.push(st)}return rt.length===De.length?me:{...me,categories:rt.map(st=>me.categories[st]),labels:Array.isArray(me.labels)?rt.map(st=>me.labels[st]):me.labels,series:(me.series||[]).map(st=>({...st,points:Array.isArray(st.points)?rt.map(xt=>st.points[xt]).filter(xt=>xt!==void 0):st.points})),windowed:De.length-rt.length}}const He=Object.freeze({bar:.2,candlestick:.3,ohlc:.3}),pt=.4;function ct(me){return Object.hasOwn(He,me)?He[me]:pt}const St=new Set(["bar","candlestick","ohlc"]);function Kt(me){const Re=me&&typeof me.scale=="string"?me.scale:"";return Re==="time"||Re==="linear"}function Ye(me,Re,Te){if(!me||me.kind==="category")return!1;const ze=ke[Re];return ze&&ze.horizontal?!1:St.has(Re)?Kt(Te):!0}function nt(me,Re,Te){return!Ye(me,Re,Te)}function yt(me){const Re=me.filter(Fe=>typeof Fe=="number"&&Number.isFinite(Fe)).slice().sort((Fe,Be)=>Fe-Be),Te=[];for(let Fe=1;Fe<Re.length;Fe++){const Be=Re[Fe]-Re[Fe-1];Be>0&&Te.push(Be)}if(!Te.length)return 0;Te.sort((Fe,Be)=>Fe-Be);const ze=Math.floor(Te.length/2);return Te.length%2?Te[ze]:(Te[ze-1]+Te[ze])/2}function mt(me){const{bound:Re,scale:Te,config:ze,padding:Fe}=me,Be=ze?Number(ze.barWidth):NaN,De=Number.isFinite(Be)&&Be>0,tt=(Re.categories||[]).map(st=>Re.kind==="time"?T(st):x(st)),Ke=De?Be:yt(tt),Ve=Math.abs(Te.range[1]-Te.range[0]);if(!Ke)return Math.max(1,Ve/20*(1-Fe));const rt=Math.abs(Te.of(Te.domain.min+Ke)-Te.of(Te.domain.min));return Math.max(1,De?rt:rt*(1-Fe))}function Je(me,Re,Te,ze){if(nt(me,Re,Te))return null;const Fe=$e(Te),Be=me.kind==="time"?me.categories.map(T):me.categories.map(x);if(me.kind==="time"&&!Fe){const tt=b(Be);if(tt&&tt.min===tt.max)return ue({min:tt.min-3e4,max:tt.max+3e4},me,Te)}const De=Fe?_e(Fe,Be,Number.isFinite(ze)?ze:Le(Te,Date.now())):R(Be,{zero:!1,nice:me.kind!=="time"});return ue(De,me,Te)}function lt(me,Re,Te,ze){const Fe=[Re.left,Re.right];if(nt(me,Te,ze))return $e(ze)&&E("chart.axis.window.band","a rolling time window needs a continuous x axis; this chart bands its x values, so the window is ignored. Bind a date or numeric column to x, or put this type on a continuous axis with axis.x.scale."),u(me.categories,Fe,ct(Te));const Be=me.xDomain||Je(me,Te,ze);return me.kind==="time"?i(Be,Fe):w(Be,Fe)}function kt(me,Re){if(me.kind==="band")return me.centre(Re.x);const Te=me.kind==="time"?T(Re.x):x(Re.x);return Te===null?NaN:me.of(Te)}function Et(me,Re){const Te=me&&me.seriesStyle&&me.seriesStyle[Re];if(Te)return{width:Te.width!=null?String(Te.width):null,dash:Array.isArray(Te.dash)&&Te.dash.length?Te.dash.join(" "):null,opacity:null,emphasized:!1};const ze=me&&Array.isArray(me.emphasis)?me.emphasis:null;if(!ze||!ze.length)return{width:null,dash:null,opacity:null,emphasized:!1};const Fe=ze.includes(Re);return{width:Fe?"var(--lattice-chart-emphasis-width, 3.5)":null,dash:null,opacity:Fe?null:"var(--lattice-chart-muted-opacity, .35)",emphasized:Fe}}function ut(me){const{series:Re,xScale:Te,yScale:ze,baseline:Fe,fill:Be,colour:De,stack:tt,style:Ke}=me,Ve=[],rt=[];let st=[];const xt=()=>{st.length===1?Ve.push("M",st[0].x,st[0].y):st.length>1&&Ve.push(...k(st,me.curve||null)),st=[]};for(let Bt=0;Bt<Re.points.length;Bt++){const Vt=Re.points[Bt],en=C(kt(Te,Vt));if(!O(Vt.y)||Number.isNaN(en)){xt();continue}rt[Bt]=!0;const Zt=Vt.y,Qt=me.lower?me.lower.points[Bt]:null;if(me.lower&&!(Qt&&O(Qt.y))){xt();continue}const Xt=tt?tt.take(Bt,Zt):null,Ut=C(ze.of(Xt?Xt[1]:Zt)),rn=C(ze.of(Xt?Xt[0]:Qt?Qt.y:Fe));st.push({x:en,y:Ut,base:rn}),Vt.px=en,Vt.py=Ut,Vt.pbase=rn}xt(),K(me.pool.next("path",`${e}__line ${e}__mark`),{d:Ve.length?pe(Ve):"",stroke:De,"data-series":me.index,"stroke-width":Ke?Ke.width:null,"stroke-dasharray":Ke?Ke.dash:null,opacity:Ke?Ke.opacity:null});const vt=!!me.marker&&!!me.markerEnv;if(vt&&!Be&&bt(me,rt),!Be){vt||ft({...me,placed:rt});return}const jt=[];let Pt=[];const Ct=()=>{if(Pt.length<2){Pt=[];return}const Bt=k(Pt,me.curve||null);Bt[0]="L",jt.push("M",Pt[0].x,Pt[0].base),jt.push(...Bt);for(let Vt=Pt.length-1;Vt>=0;Vt--)jt.push("L",Pt[Vt].x,Pt[Vt].base);jt.push("Z"),Pt=[]};for(const Bt of Re.points){if(!O(Bt.y)||Bt.px===void 0){Ct();continue}Pt.push({x:Bt.px,y:Bt.py,base:Bt.pbase})}Ct(),K(me.pool.next("path",`${e}__area ${e}__mark`),{d:jt.length?pe(jt):"",fill:De,"data-series":me.index,opacity:se(De)?"1":Ke?Ke.emphasized?"1":Ke.opacity:null}),vt?bt(me,rt):ft({...me,placed:rt})}function bt(me,Re){const{series:Te}=me;for(let ze=0;ze<Te.points.length;ze++){if(!Re[ze])continue;const Fe=Te.points[ze];Mt(me,Fe,ze,Fe.px,Fe.py,Me*2,me.colour)||K(me.pool.next("circle",`${e}__point ${e}__mark`),{cx:Fe.px,cy:Fe.py,r:Me,fill:me.colour,"data-series":me.index,"data-point":ze})}}function ft(me){const{series:Re,placed:Te}=me;for(let ze=0;ze<Re.points.length;ze++){if(!Te[ze]||Te[ze-1]||Te[ze+1])continue;const Fe=Re.points[ze];K(me.pool.next("circle",`${e}__point ${e}__mark`),{cx:Fe.px,cy:Fe.py,r:Me,fill:me.colour,"data-series":me.index,"data-point":ze})}}function Ot(me,Re){const Te=me&&me.range;if(!Array.isArray(Te)||Te.length!==2)return Re;const[ze,Fe]=Te;return!Number.isFinite(ze)||!Number.isFinite(Fe)||!Number.isFinite(Re)?Re:Math.min(Math.max(ze,Fe),Math.max(Math.min(ze,Fe),Re))}function Ft(me){const{series:Re,xScale:Te,yScale:ze,baseline:Fe,colour:Be,stack:De,slot:tt}=me;for(let Ke=0;Ke<Re.points.length;Ke++){const Ve=Re.points[Ke];if(!O(Ve.y))continue;const rt=Te.kind==="band"?Te.of(Ve.x):kt(Te,Ve)-tt.span/2;if(Number.isNaN(rt))continue;const st=Ve.y,xt=me.pointColour&&me.pointColour(Ve,Be)||Be,vt=De?De.take(Ke,st):[Fe,st],jt=Ot(ze,ze.of(vt[1])),Pt=Ot(ze,ze.of(vt[0])),Ct=rt+tt.offset,Bt=Te.kind==="band"?Ct:Ot(Te,Ct),Vt=Te.kind==="band"?Ct+tt.width:Ot(Te,Ct+tt.width),en=me.pool.next("rect",`${e}__bar ${e}__mark`,`${Re.key}:${Q(Ve.x)}`);K(en,{x:C(Bt),y:C(Math.min(jt,Pt)),width:C(Math.max(0,Vt-Bt)),height:C(Math.max(1,Math.abs(Pt-jt))),fill:xt,"data-series":me.index,"data-point":Ke}),Ve.px=C(rt+tt.offset+tt.width/2),Ve.py=C(Math.min(jt,Pt)),Ve.pbase=C(Math.max(jt,Pt))}}function tn(me){const{series:Re,xScale:Te,yScale:ze}=me;let Fe=0;for(let Be=0;Be<Re.points.length;Be++){const De=Re.points[Be];if(!O(De.y))continue;const tt=De.y,Ke=De.total===!0,Ve=Ke?0:Fe,rt=Ke?tt:Fe+tt;Ke||(Fe+=tt);const st=Ot(ze,ze.of(Math.max(Ve,rt))),xt=Ot(ze,ze.of(Math.min(Ve,rt))),vt=me.pool.next("rect",`${e}__bar ${e}__mark`,`${Re.key}:${Q(De.x)}`);K(vt,{x:C(Te.of(De.x)),y:C(st),width:C(Te.bandwidth),height:C(Math.max(1,xt-st)),fill:tt>=0?me.positive:me.negative,"data-series":me.index,"data-point":Be,"data-total":Ke?"true":null}),De.px=C(Te.of(De.x)+Te.bandwidth/2),De.py=C(st)}}function Nt(me){const{series:Re,valueScale:Te,baseline:ze,colour:Fe,stack:Be,slot:De}=me;for(let tt=0;tt<Re.points.length;tt++){const Ke=Re.points[tt];if(!O(Ke.y))continue;const Ve=me.bandScale.of(Ke.x);if(Number.isNaN(Ve))continue;const rt=Ke.y,st=me.pointColour&&me.pointColour(Ke,Fe)||Fe,xt=Be?Be.take(tt,rt):[ze,rt],vt=Ot(Te,Te.of(xt[0])),jt=Ot(Te,Te.of(xt[1]));K(me.pool.next("rect",`${e}__bar ${e}__mark`,`${Re.key}:${Q(Ke.x)}`),{x:C(Math.min(vt,jt)),y:C(Ve+De.offset),width:C(Math.max(1,Math.abs(jt-vt))),height:C(Math.max(0,De.width)),fill:st,"data-series":me.index,"data-point":tt}),Ke.px=C(jt),Ke.py=C(Ve+De.offset+De.width/2),Ke.pbase=C(vt)}}function Rt(me){const{series:Re,xScale:Te,yScale:ze,baseline:Fe,colour:Be,stack:De,slot:tt}=me;for(let Ke=0;Ke<Re.points.length;Ke++){const Ve=Re.points[Ke];if(!O(Ve.y))continue;const rt=Te.kind==="band"?Te.of(Ve.x):kt(Te,Ve)-tt.span/2;if(Number.isNaN(rt))continue;const st=Ve.y,xt=me.pointColour&&me.pointColour(Ve,Be)||Be,vt=De?De.take(Ke,st):[Fe,st],jt=Ot(ze,ze.of(vt[1])),Pt=Ot(ze,ze.of(vt[0])),Ct=C(rt+tt.offset+tt.width/2);K(me.pool.next("line",`${e}__lollipop-stem ${e}__mark`,`${Re.key}:${Q(Ve.x)}`),{x1:Ct,y1:C(Pt),x2:Ct,y2:C(jt),stroke:xt,"stroke-width":2,"data-series":me.index,"data-point":Ke}),K(me.pool.next("circle",`${e}__lollipop-dot ${e}__mark`,`${Re.key}:${Q(Ve.x)}`),{cx:Ct,cy:C(jt),r:4,fill:xt,"data-series":me.index,"data-point":Ke}),Ve.px=Ct,Ve.py=C(jt),Ve.pbase=C(Pt)}}function Dt(me){const{series:Re,valueScale:Te,baseline:ze,colour:Fe,stack:Be,slot:De}=me;for(let tt=0;tt<Re.points.length;tt++){const Ke=Re.points[tt];if(!O(Ke.y))continue;const Ve=me.bandScale.of(Ke.x);if(Number.isNaN(Ve))continue;const rt=Ke.y,st=me.pointColour&&me.pointColour(Ke,Fe)||Fe,xt=Be?Be.take(tt,rt):[ze,rt],vt=Ot(Te,Te.of(xt[0])),jt=Ot(Te,Te.of(xt[1])),Pt=C(Ve+De.offset+De.width/2);K(me.pool.next("line",`${e}__lollipop-stem ${e}__mark`,`${Re.key}:${Q(Ke.x)}`),{x1:C(vt),y1:Pt,x2:C(jt),y2:Pt,stroke:st,"stroke-width":2,"data-series":me.index,"data-point":tt}),K(me.pool.next("circle",`${e}__lollipop-dot ${e}__mark`,`${Re.key}:${Q(Ke.x)}`),{cx:C(jt),cy:Pt,r:4,fill:st,"data-series":me.index,"data-point":tt}),Ke.px=C(jt),Ke.py=Pt,Ke.pbase=C(vt)}}function Jt(me){const Re=me.group.ownerDocument;let Te=null;for(const Be of me.group.childNodes||[])if(Be&&String(Be.getAttribute&&Be.getAttribute("class"))===`${e}__fits`){Te=Be;break}Te||(Te=Re.createElementNS(z,"g"),Te.setAttribute("class",`${e}__fits`),me.group.appendChild(Te));const ze=new L(Te),Fe=[];for(const Be of me.series){let De=0,tt=0,Ke=0;for(const Zt of Be.points){const Qt=Number(Zt.x),Xt=Number(Zt.y);!Number.isFinite(Qt)||!Number.isFinite(Xt)||(De++,tt+=Qt,Ke+=Xt)}if(De<2)continue;const Ve=tt/De,rt=Ke/De;let st=0,xt=0,vt=0,jt=1/0,Pt=-1/0;for(const Zt of Be.points){const Qt=Number(Zt.x),Xt=Number(Zt.y);if(!Number.isFinite(Qt)||!Number.isFinite(Xt))continue;const Ut=Qt-Ve,rn=Xt-rt;st+=Ut*Ut,xt+=Ut*rn,vt+=rn*rn,Qt<jt&&(jt=Qt),Qt>Pt&&(Pt=Qt)}if(st===0)continue;const Ct=xt/st,Bt=rt-Ct*Ve,Vt=vt===0?1:Math.max(0,Math.min(1,xt*xt/(st*vt))),en=me.scheme.series(Be.index);if(K(ze.next("path",`${e}__fit`),{d:pe(["M",C(me.xScale.of(jt)),C(me.yScale.of(Bt+Ct*jt)),"L",C(me.xScale.of(Pt)),C(me.yScale.of(Bt+Ct*Pt))]),fill:"none",stroke:en,"data-series":Be.index}),me.showR2){const Zt=ze.next("text",`${e}__fit-label`);o(Zt,me.size),K(Zt,{x:C(me.xScale.of(Pt)),y:C(me.yScale.of(Bt+Ct*Pt))-4,"text-anchor":"end",fill:en}),q(Zt,me.grid.messages.t("chart.r2",{value:v(me.grid,Vt)}))}Fe.push({key:Be.key,slope:Ct,intercept:Bt,r2:Vt,n:De})}return ze.finish(),Fe}function An(me){const Re=me.group.ownerDocument;let Te=null;for(const Ve of me.group.childNodes||[])if(Ve&&String(Ve.getAttribute&&Ve.getAttribute("class"))===`${e}__band`){Te=Ve;break}Te||(Te=Re.createElementNS(z,"g"),Te.setAttribute("class",`${e}__band`),me.group.firstChild?me.group.insertBefore(Te,me.group.firstChild):me.group.appendChild(Te));const ze=new L(Te),Fe=me.band&&Array.isArray(me.band.points)?me.band.points:[],Be=Number.isFinite(me.index)?Number(me.index):0,De=me.scheme.series(Be),tt=Number.isFinite(me.opacity)?Number(me.opacity):.15,Ke=[];for(const Ve of Fe){const rt=Number(Ve.x),st=Number(Ve.lower),xt=Number(Ve.upper);if(!Number.isFinite(rt)||!Number.isFinite(st)||!Number.isFinite(xt))continue;const vt=Number(Ve.yhat);Ke.push({x:C(me.xScale.of(rt)),lower:C(me.yScale.of(st)),upper:C(me.yScale.of(xt)),yhat:Number.isFinite(vt)?C(me.yScale.of(vt)):null})}if(Ke.length>=2&&(K(ze.next("path",`${e}__band-fill`),{d:ne(Ke),fill:De,"fill-opacity":tt,stroke:"none","data-series":Be}),me.line!==!1)){const Ve=[];let rt=!1;for(const st of Ke){if(st.yhat===null){rt=!1;continue}Ve.push(rt?"L":"M",st.x,st.yhat),rt=!0}K(ze.next("path",`${e}__band-line`),{d:Ve.length?pe(Ve):"",fill:"none",stroke:De,"data-series":Be})}return ze.finish(),{points:Ke.length,confidence:me.band&&Number.isFinite(me.band.confidence)?Number(me.band.confidence):null}}function cn(me){const Re=me.group.ownerDocument;let Te=null;for(const Ke of me.group.childNodes||[])if(Ke&&String(Ke.getAttribute&&Ke.getAttribute("class"))===`${e}__whiskers`){Te=Ke;break}Te||(Te=Re.createElementNS(z,"g"),Te.setAttribute("class",`${e}__whiskers`),me.group.appendChild(Te));const ze=new L(Te),Fe=Number.isFinite(me.cap)?Number(me.cap):4,Be=me.colour||"currentColor",De=me.orient!=="v";let tt=0;for(const Ke of me.points||[]){const Ve=Number(Ke.main),rt=Number(Ke.lo),st=Number(Ke.hi);if(!Number.isFinite(Ve)||!Number.isFinite(rt)||!Number.isFinite(st))continue;const xt=De?["M",rt,Ve,"L",st,Ve,"M",rt,Ve-Fe,"L",rt,Ve+Fe,"M",st,Ve-Fe,"L",st,Ve+Fe]:["M",Ve,rt,"L",Ve,st,"M",Ve-Fe,rt,"L",Ve+Fe,rt,"M",Ve-Fe,st,"L",Ve+Fe,st];K(ze.next("path",`${e}__whisker`),{d:pe(xt),stroke:Be,fill:"none"}),tt++}return ze.finish(),tt}function un(me){const Re=me.scheme||H(),Te=me.typography||{small:me.fontSize||11,axisTitle:11},{bound:ze}=me,Fe=pn(me.plot,Te.small),Be=ze.series[0]&&ze.series[0].points||[],De=Be.map(vt=>vt.label),tt=Re.series(0),Ke=u(De,[Fe.top,Fe.bottom],.4),Ve=[0];for(const vt of Be)for(const jt of[vt.x,vt.lower,vt.upper])Number.isFinite(jt)&&Ve.push(jt);const rt=w(R(Ve,{zero:!1}),[Fe.left,Fe.right]);cn({group:me.groups.overlay,orient:"h",colour:tt,points:Be.map(vt=>({main:C(Ke.centre(vt.label)),lo:C(rt.of(vt.lower)),hi:C(rt.of(vt.upper))}))});const st=new L(me.groups.marks);let xt=0;for(const vt of Be)Number.isFinite(vt.x)&&(K(st.next("circle",`${e}__point ${e}__mark`),{cx:C(rt.of(vt.x)),cy:C(Ke.centre(vt.label)),r:Me,fill:tt}),xt++);return st.finish(),fn({group:me.groups.rules,plot:Fe,scale:rt,lines:[{value:0}]}),ie({group:me.groups.axis,plot:Fe,scale:rt,format:U(me.grid,{kind:"linear",step:(rt.domain.max-rt.domain.min)/5}),config:{},grid:me.grid,size:Te.small}),ve({group:me.groups.labels,plot:Fe,scale:Ke,labels:De,fontSize:Te.small,config:{}}),{series:[],marks:xt}}function pn(me,Re){const Te=6+Re*1.3+2,ze=me&&me.gutter&&Number.isFinite(me.gutter.bottom)?me.gutter.bottom:Te,Fe=Math.min(Math.max(0,Te-ze),Math.max(0,me.height-10));return Fe>0?{...me,height:me.height-Fe,bottom:me.bottom-Fe,gutter:{...me.gutter,bottom:ze+Fe}}:me}function fn(me){const Re=new L(de(me.group,`${e}__reflines`));for(const Te of me.lines||[]){if(!O(Te.value))continue;const ze=C(me.scale.of(Te.value));if(K(Re.next("path",`${e}__reference`),{d:me.vertical?pe(["M",ze,C(me.plot.top),"L",ze,C(me.plot.bottom)]):pe(["M",C(me.plot.left),ze,"L",C(me.plot.right),ze]),stroke:Te.colour||"currentColor","stroke-dasharray":"4 3",fill:"none"}),!Te.label)continue;const Fe=Re.next("text",`${e}__reference-label`);K(Fe,me.vertical?{x:ze+4,y:C(me.plot.top+10),"text-anchor":"start"}:{x:C(me.plot.right-4),y:ze-4,"text-anchor":"end"}),q(Fe,Te.label)}Re.finish()}function Tn(me){const{series:Re,xScale:Te,yScale:ze,colour:Fe}=me,Be=me.size||null;for(let De=0;De<Re.points.length;De++){const tt=Re.points[De];if(!O(tt.y))continue;const Ke=C(kt(Te,tt));if(Number.isNaN(Ke))continue;const Ve=C(ze.of(tt.y)),rt=Be&&O(tt.size)?C(Be.of(tt.size)):Me,st=me.pointColour&&me.pointColour(tt,Fe)||Fe;Mt(me,tt,De,Ke,Ve,rt*2,st)||K(me.pool.next("circle",`${e}__point ${e}__mark`),{cx:Ke,cy:Ve,r:rt,fill:st,"fill-opacity":Be?.7:1,"data-series":me.index,"data-point":De}),tt.px=Ke,tt.py=Ve}}function Mt(me,Re,Te,ze,Fe,Be,De){if(!me.marker||!me.markerEnv)return!1;const tt=Ae(me.marker,Re,me.markerEnv);if(Re.markerHalf=0,!tt)return!1;const Ke=me.marker.explicitSize?me.marker.size:Math.max(me.marker.size,Be);return Ne(me.pool,tt,{x:ze,y:Fe,size:Ke,colour:le(De),attrs:K,round:C,extra:{"data-series":me.index,"data-point":Te}}),Re.markerHalf=Ke/2,!0}function nn(me){const{group:Re,series:Te,xScale:ze,yScale:Fe,options:Be}=me,De=me.grid&&me.grid.statistics,tt=De&&typeof De.intervalOf=="function"?(Pt,Ct)=>De.intervalOf(Pt,Ct):null,Ke=new L(de(Re,`${e}__errorbars`)),Ve=Number.isFinite(Number(Be.confidence))?Number(Be.confidence):.95,rt=4;let st=0,xt=0,vt=0,jt=0;for(const Pt of Te)for(const Ct of Pt.points){if(Ct.y===null||Ct.y===void 0)continue;xt++;const Bt=Array.isArray(Ct.values)&&Ct.values.length===1;Bt&&vt++;let Vt=null,en=null;if(Be.of!==void 0&&Number.isFinite(Number(Ct[Be.of]))){const Ut=Math.abs(Number(Ct[Be.of]));Vt=Ct.y-Ut,en=Ct.y+Ut}else if(Array.isArray(Ct.values)&&Ct.values.length>1&&tt){const Ut=tt(Ct.values,Ve);Ut&&(Vt=Ut.lower,en=Ut.upper)}if(Vt===null||!Number.isFinite(Vt)||!Number.isFinite(en)){Bt&&jt++;continue}const Zt=C(ze.of(Ct.xKey!==void 0?Ct.xKey:Ct.x)+(ze.bandwidth?ze.bandwidth/2:0)),Qt=C(Fe.of(en)),Xt=C(Fe.of(Vt));K(Ke.next("path",`${e}__error-bar ${e}__mark`),{d:pe(["M",Zt-rt,Qt,"L",Zt+rt,Qt,"M",Zt,Qt,"L",Zt,Xt,"M",Zt-rt,Xt,"L",Zt+rt,Xt]),fill:"none",stroke:"currentColor","data-lower":Vt,"data-upper":en}),st++}return Ke.finish(),{drawn:st,marks:xt,single:vt,singleSkipped:jt}}function sn(me){const Re=me.scheme||H(),Te=me.axis||{x:{},y:{},y2:{}},ze=me.typography||{small:me.fontSize||11,axisTitle:11},{bound:Fe,plot:Be,type:De}=me,tt=ke[De]||ke.line,Ke=Fe.series.filter(At=>!me.hidden.has(At.key)),Ve=!!tt.horizontal,rt=me.mark==="lollipop"&&(De==="bar"||De==="horizontalBar"),st=!Ve&&Te.y.position==="right"?"right":"left",xt=st==="right"?"left":"right",vt=(De==="bar"||De==="horizontalBar")&&me.byRuleColour&&Ke.length===1&&Fe.measure&&Fe.measure.col||null,jt=vt?new Set:null,Pt=vt?At=>{const It=a({grid:me.grid,col:vt,value:At.y});return It&&jt.add(It),It}:null,Bt=(De==="bar"||De==="horizontalBar")&&me.byRuleColour&&Ke.length===1&&Re.nameMap?At=>Re.series(0,At.label):null,Vt=me.fill?ye(me,Re):null,en=Vt||Pt||Bt?(At,It)=>Vt&&Vt(At,It)||Pt&&Pt(At)||Bt&&Bt(At)||null:null,Zt=te(me.marker),Qt=Zt?{grid:me.grid,doc:me.doc,redraw:me.redraw}:null,Xt=!Ve&&De!=="waterfall"?Ke.filter(At=>At.axis==="right"):[],Ut=Xt.length?Ke.filter(At=>At.axis!=="right"):Ke,rn=Xt.length>0,ar=(De==="bar"||De==="area"||De==="horizontalBar")&&!rn,jn=me.stack==="percent"&&ar&&Ut.length>1,En=(jn||!!me.stack)&&Ut.length>1&&ar,Cn=De==="waterfall"?je(Ke[0]):g(Ut,En,jn),Sn=Fe.yDomain||me.domain||R(Cn,{zero:tt.zero,min:Te.y.min,max:Te.y.max}),yn=Ve?w(Sn,[Be.left,Be.right]):w(Sn,[Be.bottom,Be.top]),Yt=Ve?u(Fe.categories,[Be.top,Be.bottom],.2):lt(Fe,Be,De,Te.x),Jn=Sn.min<=0&&Sn.max>=0?0:Sn.min,Xn=Xt.some(At=>(At.mark||(De==="bar"?"bar":De))==="bar"),Mn=rn?R(g(Xt,!1,!1),{zero:Xn,min:Te.y2.min,max:Te.y2.max}):null,wn=Mn?w(Mn,[Be.bottom,Be.top]):null,Qn=U(me.grid,{kind:"linear",step:(Sn.max-Sn.min)/5}),bn=jn?{tick:At=>`${Qn.tick(At)}%`,value:At=>`${Qn.value(At)}%`}:Qn,Kn=me.axes!==!1;if(Kn&&ae({gridGroup:me.groups.grid,axisGroup:me.groups.axis,plot:Be,scale:yn,format:bn,horizontal:Ve,side:st,config:Te.y,grid:me.grid,size:ze.small}),Kn)if(Ve)ve({group:me.groups.overlay,plot:Be,scale:Yt,labels:Fe.labels,fontSize:ze.small,config:Te.x});else if(Yt.kind==="band")xe({group:me.groups.overlay,plot:Be,scale:Yt,labels:Fe.labels,fontSize:ze.small,rotated:P(Fe.labels,Yt.step,ze.small,Te.x.every),config:Te.x});else{const At=Fe.dimension&&Fe.dimension.col?me.grid.columns.get(Fe.dimension.col):void 0;ie({group:me.groups.overlay,plot:Be,scale:Yt,format:U(me.grid,{kind:Fe.kind,span:Yt.domain.max-Yt.domain.min,step:(Yt.domain.max-Yt.domain.min)/5},At),config:Te.x,grid:me.grid,column:At,size:ze.small})}if(Kn&&(ce({group:me.groups.rules,plot:Be,side:st}),N({group:me.groups.axis,plot:Be,text:Te.y.title,side:Ve?"bottom":st,size:ze.axisTitle}),N({group:me.groups.axis,plot:Be,text:Te.x.title,side:Ve?"left":"bottom",size:ze.axisTitle})),Kn&&wn){G({group:me.groups.axis,plot:Be,scale:wn,colour:Re.series(Xt[0].index),side:xt,format:U(me.grid,{kind:"linear",step:(Mn.max-Mn.min)/5})});const At=Te.y2.title||(Xt.length===1?Xt[0].label:"");N({group:me.groups.axis,plot:Be,text:At,side:xt,size:ze.axisTitle}),!Te.y.title&&Ut.length===1&&Ut[0].label&&N({group:me.groups.axis,plot:Be,text:Ut[0].label,side:st,size:ze.axisTitle})}const lr=Number.isFinite(me.downsampleTo)?Number(me.downsampleTo):Math.max(2,Math.round(Be.width));let qn=!1;if(tt.marks==="path"||De==="scatter"||De==="bubble"){for(const At of Ke)if(At.kept=null,At.points.length>lr*1.5){const It=At.points.map((hn,kn)=>({x:kn,y:hn.y,point:hn})),on=M(It,lr);At.points=on.map(hn=>hn.point),At.kept=on.map(hn=>hn.x),qn=!0}}me.pool||B(me.groups,Be,J(De));const Pn=me.pool||new L(me.groups.marks),Un=jn?Fe.categories.map((At,It)=>Ke.reduce((on,hn)=>{const kn=hn.points[It]?hn.points[It].y:null;return O(kn)?on+Math.abs(kn):on},0)):null,Ln=En?j(Fe.categories.length,Un):null,_n=rn?Ke.filter(At=>(At.mark||(De==="bar"?"bar":De))==="bar"):Ke,vr=rn?Math.max(1,_n.length):Math.max(1,Ke.length),cr=De==="bar"||rn&&_n.length>0,Rn=Yt.kind==="band"?Yt.bandwidth:cr?mt({bound:Fe,scale:Yt,config:Te.x,padding:ct("bar")}):0,Hn=En?Rn:Rn/vr,Wn=new Map;for(const At of _n)Wn.set(At.key,Wn.size);const er=[],Vn=De==="rangeArea"&&Fe.series.length>=2?Fe.series[0]:null,ur=Vn?Fe.series[1]:null;for(let At=0;At<Ke.length;At++){const It=Ke[At],on=Re.series(It.index,It.label),hn=It.axis==="right"&&wn?wn:yn,kn=rn?It.mark||(De==="bar"?"bar":De):De,zn=rn&&Wn.has(It.key)?Wn.get(It.key):At;if(De==="horizontalBar")(rt?Dt:Nt)({pool:Pn,series:It,bandScale:Yt,valueScale:yn,baseline:Jn,colour:on,stack:Ln,index:It.index,slot:{offset:En?0:At*Hn,width:Hn,span:Rn},pointColour:en});else if(De==="waterfall")tn({pool:Pn,series:It,xScale:Yt,yScale:yn,index:It.index,positive:Re.positive,negative:Re.negative});else if(kn==="bar")(rt?Rt:Ft)({pool:Pn,series:It,xScale:Yt,yScale:hn,baseline:hn===wn?Mn.min<=0&&Mn.max>=0?0:Mn.min:Jn,colour:on,stack:Ln,index:It.index,slot:{offset:En?0:zn*Hn,width:Hn,span:Rn},pointColour:en});else if(De==="scatter"||De==="bubble")Tn({pool:Pn,series:It,xScale:Yt,yScale:hn,colour:on,index:It.index,size:De==="bubble"?me.sizes:null,pointColour:en,marker:Zt,markerEnv:Qt});else{const hr=Et(me,It.label),Ar=kn==="step"?{type:"step",tension:1,mode:"after"}:l(me.curve,It.label),dr={pool:Pn,series:It,xScale:Yt,yScale:hn,baseline:Jn,fill:Vn?It===ur:kn==="area"||kn==="rangeArea",lower:Vn&&It===ur?Vn:null,curve:Ar,colour:on,stack:Ln,index:It.index,style:hr,marker:Zt,markerEnv:Qt};hr.emphasized?er.push(dr):ut(dr)}}for(const At of er)ut(At);me.pool||Pn.finish(),me.band&&typeof Yt.invert=="function"&&An({group:me.groups.overlay,band:me.band,xScale:Yt,yScale:yn,scheme:Re,index:0,line:me.band.line!==!1&&!me.fit}),me.fit&&(De==="scatter"||De==="bubble")&&typeof Yt.invert=="function"&&Jt({group:me.groups.overlay,series:Ke,xScale:Yt,yScale:yn,plot:Be,scheme:Re,grid:me.grid,size:ze.small,showR2:me.fit!=="line"});let $n=null;me.trend&&($n=_({group:me.groups.overlay,series:Ke,xScale:Yt,yScale:yn,rightScale:wn,plot:Be,scheme:Re,trend:me.trend,grid:me.grid,format:At=>bn.tick(At),size:ze.small,clip:me.groups.boxClipId}));let fr=null;if(me.error&&(fr=nn({group:me.groups.overlay,series:Ke,xScale:Yt,yScale:yn,grid:me.grid,options:me.error===!0?{}:me.error})),me.labels&&me.labels.show&&d({group:me.groups.labels,series:Ke,plot:Be,options:me.labels,grid:me.grid,size:ze.small,horizontal:Ve}),me.reference&&me.reference.length){const At=Ve?me.reference:me.reference.filter(on=>!(on.axis==="right"||on.axis==="y2")),It=wn?me.reference.filter(on=>on.axis==="right"||on.axis==="y2"):[];At.length&&fn({group:me.groups.overlay,plot:Be,scale:yn,lines:At,vertical:Ve}),It.length&&fn({group:me.groups.overlay,plot:Be,scale:wn,lines:It})}let tr=null;me.annotations&&me.annotations.length&&(tr=V({group:me.groups.overlay,plot:Be,xScale:Yt,yScale:yn,rightScale:wn,series:Ke,annotations:me.annotations,dual:rn,horizontal:Ve,format:At=>bn.tick(At),size:ze.small}));const nr=Array.isArray($n)&&$n.length?[...tr||[],...$n]:tr;return{xScale:Yt,yScale:yn,rightScale:wn,dual:rn,series:Ke,horizontal:Ve,percent:jn,percentTotals:jn?Un:null,plot:Be,errorBars:fr,annotations:nr,trendlines:$n,reduced:qn,legend:vt?y({grid:me.grid,col:vt,colours:jt}):null}}const Zn=32;function kr(me){const{series:Re,xScale:Te,at:ze}=me,Fe=Number.isFinite(me.tolerance)?Number(me.tolerance):Zn,Be=[];let De=-1,tt=1/0;for(const Ke of Re){let Ve=null,rt=-1,st=1/0;const xt=Ke.points||[];for(let vt=0;vt<xt.length;vt++){const jt=xt[vt];if(!jt||!O(jt.y))continue;const Pt=kt(Te,jt);if(Number.isNaN(Pt))continue;const Ct=Math.abs(Pt-ze);Ct>=st||(st=Ct,Ve=jt,rt=Array.isArray(Ke.kept)?Ke.kept[vt]:vt)}!Ve||st>Fe||(Be.push({series:Ke,point:Ve}),st<tt&&(tt=st,De=rt))}return De<0?null:{index:De,entries:Be}}function _r(me){const{bound:Re,xScale:Te,at:ze}=me;if(!Re.categories.length)return-1;if(Te.kind==="band"){const De=Math.floor((ze-Te.range[0])/(Te.step||1));return De>=0&&De<Re.categories.length?De:-1}let Fe=-1,Be=1/0;for(let De=0;De<Re.categories.length;De++){const tt=Te.kind==="time"?T(Re.categories[De]):x(Re.categories[De]);if(tt===null)continue;const Ke=Math.abs(Te.of(tt)-ze);Ke<Be&&(Be=Ke,Fe=De)}return Fe}function xr(me,Re){return Re<0||Re>=me.categories.length?"":Q(me.categories[Re])}}),it("packages/modules/charts/drawable.js",function(n,re){"use strict";Object.defineProperty(n,"REASONS",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"DRAWABLE",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"namedColumns",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"missingColumns",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"bucketKey",{enumerable:!0,get:function(){return f}}),Object.defineProperty(n,"bucketMessage",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"continuousX",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"drawability",{enumerable:!0,get:function(){return W}});const Se=re("packages/modules/charts/scale.js"),ce=Se.extent,N=Se.toNumber,ve=Se.toTime,ie=re("packages/modules/charts/cartesian.js").staleWindow,ae=Object.freeze({EMPTY:"empty",INCOMPLETE:"incomplete",STALE:"stale",MISSING_COLUMN:"missing-column",NO_DOMAIN:"no-domain",BUCKETED:"bucketed",TOO_MANY_SETS:"too-many-sets"}),J=Object.freeze({ok:!0});function ue(U){if(!U||typeof U!="object")return[];const v=[],m=(u,b)=>{typeof b=="string"&&b?v.push({key:u,col:b}):b&&typeof b=="object"&&typeof b.col=="string"&&b.col&&v.push({key:u,col:b.col})};if(Array.isArray(U.points))return[];if(m("x",U.x),m("code",U.code),m("y",U.y),m("series",U.series),m("size",U.size),m("source",U.source),m("target",U.target),m("text",U.text),m("time",U.time),m("entity",U.entity),m("colour",U.colour),m("set",U.set),Array.isArray(U.sets))for(const u of U.sets)m("sets",u);if(typeof U.multiples=="string"&&m("multiples",U.multiples),Array.isArray(U.measures))for(const u of U.measures)m("measures",u);return v}function B(U,v){const m=U&&U.columns;return!m||typeof m.get!="function"?[]:ue(v).filter(({col:u})=>!m.get(u))}function f(U){return`chart:x:date-bucket:${U}`}function L(U,v,m){return`chart x column ${JSON.stringify(U)} is a 'date', which stores a calendar day, so all ${v} rows collapsed into one point and were reduced by '${m}'. For a series inside a single day, type the column 'datetime' or bind epoch milliseconds.`}function P(U,v){return!v||v.kind!=="time"&&v.kind!=="linear"?!1:U!=="bar"&&U!=="horizontalBar"}function W(U){const{grid:v,spec:m,type:u,bound:b}=U,O=U.id===void 0?"":String(U.id),Q=Number.isFinite(U.now)?Number(U.now):Date.now(),w=(x,T,h,g=!0)=>({ok:!1,reason:x,key:h||`chart:${O}:${x}`,message:T,tell:g}),R=B(v,m);if(R.length){const x=R.map(h=>`${h.key}: ${JSON.stringify(h.col)}`).join(", "),T=v&&v.columns&&typeof v.columns.all=="function"?v.columns.all().map(h=>h.id||h.field).filter(Boolean):[];return w(ae.MISSING_COLUMN,`chart ${x} ${R.length>1?"name columns":"names a column"} this grid does not have, so there is nothing to read and nothing to draw.${T.length?` The columns it does have: ${T.slice(0,12).map(h=>JSON.stringify(h)).join(", ")}${T.length>12?", …":""}.`:""} Bind a column the grid declares, or declare the column.`)}if(b&&b.empty){const x=v&&v.rows&&typeof v.rows.count=="function"?v.rows.count():0;return w(ae.EMPTY,x?`chart bound nothing from the ${x} row(s) the grid is showing, so it shows its empty state. The binding named no series to draw: check that the spec names the columns this chart needs — a flow type needs source and target, a measure needs a column with values in it.`:"chart has no rows to draw, so it shows its empty state.",void 0,x>0)}if(u==="venn"&&b&&b.tooMany)return w(ae.TOO_MANY_SETS,`a venn chart draws two or three sets and was given ${b.tooMany.count} (${b.tooMany.names.slice(0,8).map(x=>JSON.stringify(x)).join(", ")}${b.tooMany.count>8?", …":""}). Four or more sets cannot each have a region of their own as circles. Name two or three in "sets" (or "members" for a set column), or use an UpSet-style chart instead: a bar chart of how many rows hold each combination of memberships — group the grid by the membership columns and chart the row count.`);if(u==="venn"&&b&&b.tooFew)return w(ae.INCOMPLETE,`a venn chart needs two or three sets and was given ${b.tooFew.count}. Name the membership columns in "sets" (boolean columns), or a multi-value column in "set" with the "members" to compare.`);if((u==="candlestick"||u==="ohlc")&&(!b||!b.series||b.series.length<4)){const x=b&&b.series?b.series.length:0;return w(ae.INCOMPLETE,`a ${u} chart needs four measures — open, high, low and close, in that order — and ${x===0?"none was":`only ${x} were`} bound. Pass them as measures: [open, high, low, close].`)}const i=ie(b,U.axis&&U.axis.x,u,Q);if(i){const x=i.newest===null?"and every one of them is stamped ahead of it":`and the newest of ${i.points} x value(s) is ${Math.round(i.age/1e3)}s old`;return w(ae.STALE,`the rolling x window covers the last ${i.span} ms, ${x}, so every mark would be drawn outside the plot. The chart shows its empty state instead. Seed it with data inside the window, widen axis.x.window.span, or drop the window while showing history.`,`chart:${O}:x:window:stale:${m&&m.x||""}`,i.newest!==null)}if(P(u,b)){const x=Array.isArray(b.categories)?b.categories:[],T=b.kind==="time"?x.map(ve):x.map(N);if(x.length&&!ce(T)){const h=m&&typeof m.x=="string"&&m.x||b.dimension&&b.dimension.col||"";return w(ae.NO_DOMAIN,`chart x ${h?`column ${JSON.stringify(h)} `:""}is drawn on a ${b.kind==="time"?"time":"continuous"} axis, and not one of its ${x.length} value(s) reads as a ${b.kind==="time"?"date":"number"} — so the axis would be drawn over a domain invented from nothing rather than measured from the data. Remove axis.x.scale to let the column choose its own scale, or type the column so its values parse.`)}}if(b&&b.bucketed&&P(u,b)){const{col:x,rows:T,fn:h}=b.bucketed;return w(ae.BUCKETED,L(x,T,h),f(x))}return J}}),it("packages/modules/charts/bind.js",function(n,re){"use strict";Object.defineProperty(n,"AGGREGATIONS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"DEFAULT_AGGREGATION",{enumerable:!0,get:function(){return f}}),Object.defineProperty(n,"resolveAggregation",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"defaultAggregationFor",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"measureOf",{enumerable:!0,get:function(){return W}}),Object.defineProperty(n,"walkRows",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"leafRows",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"selectedRows",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"topGroups",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"forcedScaleKind",{enumerable:!0,get:function(){return x}}),Object.defineProperty(n,"scaleKindFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"bindSeries",{enumerable:!0,get:function(){return g}}),Object.defineProperty(n,"bindPoints",{enumerable:!0,get:function(){return j}}),Object.defineProperty(n,"bindMeasures",{enumerable:!0,get:function(){return X}}),Object.defineProperty(n,"bindLinks",{enumerable:!0,get:function(){return K}}),Object.defineProperty(n,"bindHierarchy",{enumerable:!0,get:function(){return pe}});const Se=re("packages/modules/charts/scale.js"),ce=Se.key,N=Se.toNumber,ve=Se.toTime,xe=re("packages/modules/charts/drawable.js"),ie=xe.bucketKey,ae=xe.bucketMessage,ue=re("packages/core/src/internal/util.js").warnOnce,B={sum:t=>t.length?t.reduce((e,s)=>e+s,0):null,avg:t=>t.length?t.reduce((e,s)=>e+s,0)/t.length:null,mean:t=>t.length?t.reduce((e,s)=>e+s,0)/t.length:null,min:t=>{let e=null;for(let s=0;s<t.length;s++)(e===null||t[s]<e)&&(e=t[s]);return e},max:t=>{let e=null;for(let s=0;s<t.length;s++)(e===null||t[s]>e)&&(e=t[s]);return e},median:t=>{if(!t.length)return null;const e=t.slice().sort((M,ee)=>M-ee),s=(e.length-1)/2,d=Math.floor(s),p=Math.ceil(s);return d===p?e[d]:(e[d]+e[p])/2},count:(t,e)=>e,countValues:t=>t.length,first:t=>t.length?t[0]:null,last:t=>t.length?t[t.length-1]:null},f="sum";function L(t){return t==null?f:typeof t=="string"&&t in B?t:(ue(`chart:measure:fn:${String(t)}`,`chart measure fn ${JSON.stringify(t)} is not a known aggregation; using '${f}'. Supported: ${Object.keys(B).join(", ")}.`),f)}function P(t){if(!t)return f;const e=t.groupTotal??t.total;if(typeof e=="string"&&e in B)return e;const s=t.dataType&&t.dataType.totals?t.dataType.totals.supported:null;if(Array.isArray(s)&&!s.includes(f)){const d=["avg","mean","max","min","countValues","count"].find(p=>s.includes(p)&&p in B);if(d)return d}return f}function W(t,e){const s=P(e);return t?typeof t=="string"?{col:t,fn:s}:{col:t.col||null,fn:t.fn==null?s:L(t.fn)}:{col:null,fn:s}}function U(t,e){const s=new Set,d=p=>{if(!p||s.has(p)||(s.add(p),e(p),!p.group)||p.expanded)return;const M=p.filteredChildren||p.children;if(Array.isArray(M))for(const ee of M)d(ee)};t.rows.forEach(d)}function v(t){const e=[];return U(t,s=>{!s.group&&s.data!==null&&s.data!==void 0&&e.push(s)}),e}function m(t){const e=new Set(t.selection.keys());if(!e.size)return[];const s=[];return U(t,d=>{!d.group&&e.has(d.key)&&s.push(d)}),s}function u(t){const e=[];let s=1/0;return U(t,d=>{d.group&&(d.level<s&&(s=d.level,e.length=0),d.level===s&&e.push(d))}),e}function b(t,e,s){return e.group&&e.totals&&s in e.totals?N(e.totals[s]):N(t.rows.value(e.key,s))}function O(t,e,s,d){if(!e.group){const p=t.rows.text(e.key,s);if(p)return p}return d==null?"":d instanceof Date?d.toISOString().slice(0,10):String(d)}function Q(t,e){return(B[e]||B[f])(t.values,t.rows)}const w=Object.freeze(["number","currency","percent"]),R=Object.freeze(["date","datetime","timestamp","dateString"]),i=Object.freeze({auto:"",band:"category",category:"category",linear:"linear",time:"time"});function x(t){const e=t&&typeof t=="object"?t.axis:null;if(!e||typeof e!="object")return"";const s=e.x;if(!s||typeof s!="object")return"";const d=typeof s.scale=="string"?s.scale:"";return d?Object.hasOwn(i,d)?i[d]:(ue(`chart:x:scale:unknown:${d}`,`chart axis.x.scale ${JSON.stringify(d)} is not a scale this chart draws. Use one of: ${Object.keys(i).join(", ")}. The scale was chosen from the column instead.`),""):""}function T(t){if(t.length<3)return"";let e=0,s=0;for(const d of t){if(d==null||d===""||typeof d=="boolean")return"";N(d)!==null?e++:typeof d=="string"&&ve(d)!==null&&s++}return s===t.length?"time":e===t.length?"linear":""}function h(t,e,s={}){if(s.forced)return s.forced;const d=t&&typeof t.type=="string"?t.type:"";if(R.includes(d)||e.length&&e.every(ee=>ee instanceof Date))return"time";if(w.includes(d))return"linear";const p=s.id?String(s.id):"";if(!p)return"category";const M=d&&d!=="text"?"":T(e);return M&&ue(`chart:x:banded:${p}`,`chart x column ${JSON.stringify(p)} is typed ${JSON.stringify(d||"text")}, so its ${e.length} values are drawn as categories on a band scale even though they all read as ${M==="time"?"dates":"numbers"}. Type the column ${M==="time"?"'date' (or 'datetime'/'timestamp'/'dateString')":"'number'"} for a continuous axis, or pin it with axis: { x: { scale: '${M}' } }.`),"category"}function g(t,e){const s=e.x||null,d=e.series||(typeof e.multiples=="string"?e.multiples:null)||null,p=t.columns,M=s?p.get(s):void 0,ee=W(e.y),H=ee.col?p.get(ee.col):void 0,F=W(e.y,H);let o;const A=typeof e.rows=="function"?e.rows(t):e.rows;let G=!1;if(Array.isArray(A)){const I=A.filter(E=>E&&typeof E=="object"&&(typeof E.key=="string"||typeof E.key=="number")&&t.rows.byKey(E.key)!==void 0);I.length<A.length&&(ue("chart:rows:not-grid-rows",`chart "rows" takes rows the grid holds (from grid.rows.get(i) or grid.rows.byKey(key)); ${A.length-I.length} of ${A.length} given are not and were left out. To chart other data, put it in a grid and chart that grid.`),G=I.length===0),o=I}else e.from==="groups"?o=u(t):e.from==="selection"?o=m(t):o=v(t);const D=o.length||G?o:v(t),V=new Map,de=new Map,$=[];for(let I=0;I<D.length;I++){const E=D[I],Y=s?E.group&&E.groupColumn===s?E.groupValue:t.rows.value(E.key,s):I,se=ce(Y);V.has(se)||(V.set(se,{value:Y,label:s?O(t,E,s,Y):String(I),order:V.size}),$.push(Y));const le=d?E.group&&E.groupColumn===d?E.groupValue:t.rows.value(E.key,d):null,ye=d?ce(le):"";de.has(ye)||de.set(ye,{label:d?O(t,E,d,le):H?.title||"",points:new Map});const be=de.get(ye);let Ae=be.points.get(se);Ae||(Ae={values:[],rows:0,rowKey:E.key},be.points.set(se,Ae)),Ae.rows+=E.group&&E.leafCount||1,(e.editable||e.selection)&&(Ae.keys||(Ae.keys=[])).push(E.key);const Ne=F.col?b(t,E,F.col):null;if(Ne!==null&&Ae.values.push(Ne),e.size){const te=N(t.rows.value(E.key,e.size));te!==null&&(Ae.sizes=(Ae.sizes||0)+te)}}const _=[...V.values()].sort((I,E)=>I.order-E.order),oe=typeof e.limit=="number"&&e.limit>0?_.slice(0,e.limit):_,a=h(M,$,{forced:x(e),id:s});let y=null;a==="time"&&D.length>1&&V.size===1&&M&&(M.type==="date"||M.type==="dateString")&&(y={col:String(s),rows:D.length,fn:F.fn},ue(ie(y.col),ae(y.col,y.rows,y.fn)));const k=w.includes(M&&typeof M.type=="string"?M.type:"")?[...oe].sort((I,E)=>(N(I.value)??0)-(N(E.value)??0)):a==="time"?[...oe].sort((I,E)=>(ve(I.value)??1/0)-(ve(E.value)??1/0)||0):oe,l=[...de.entries()].map(([I,E],Y)=>({key:I,label:E.label,index:Y,points:k.map(se=>{const le=ce(se.value),ye=E.points.get(le);return{x:se.value,xKey:le,label:se.label,y:ye?Q(ye,F.fn):null,size:ye&&ye.sizes!==void 0?ye.sizes:null,rows:ye?ye.rows:0,rowKey:ye?ye.rowKey:null,...(e.editable||e.selection)&&ye&&ye.keys?{rowKeys:ye.keys}:{},values:ye&&ye.values?ye.values:null}})}));return{series:l,categories:k.map(I=>I.value),labels:k.map(I=>I.label),kind:a,measure:{...F,title:H?.title||F.col||""},dimension:{col:s,title:M?.title||s||""},empty:l.length===0||k.length===0,rows:D.length,truncated:_.length-k.length,bucketed:y}}function j(t){const e=Array.isArray(t.points)?t.points:[],s=e.length>0&&e.every(M=>typeof M.x=="number"&&Number.isFinite(M.x)),d=M=>typeof M=="number"&&Number.isFinite(M)?M:null,p=e.map((M,ee)=>({x:M.x,xKey:ce(M.x),label:M.label!=null?String(M.label):String(M.x),y:d(M.y),size:d(M.size),lower:d(M.lower),upper:d(M.upper),rows:1,rowKey:M.key!=null?String(M.key):String(ee),values:null}));return{series:[{key:t.seriesKey||"",label:t.seriesLabel||"",index:0,points:p}],categories:p.map(M=>M.x),labels:p.map(M=>M.label),kind:s?"linear":"category",measure:{col:null,fn:"sum",title:t.measureTitle||""},dimension:{col:null,title:t.dimensionTitle||""},empty:p.length===0,rows:p.length,truncated:0}}function X(t,e){const s=Array.isArray(e.measures)?e.measures:[];if(!s.length)return g(t,e);const d=s.map(H=>{const F=typeof H=="string"?{col:H}:H;return{spec:F,result:g(t,{x:e.x,from:e.from,limit:e.limit,axis:e.axis,y:{col:F.col,fn:F.fn}})}}),p=d[0].result,M=new Map(p.categories.map((H,F)=>[ce(H),F])),ee=d.map(({spec:H,result:F},o)=>{const A=t.columns.get(H.col),G=p.categories.map(()=>null),D=F.series[0];if(D)for(const V of D.points){const de=M.get(V.xKey);de!==void 0&&(G[de]=V)}return{key:H.col,label:H.title||H.label||A&&A.title||H.col,index:o,mark:H.type||null,axis:H.axis==="right"?"right":"left",points:p.categories.map((V,de)=>G[de]||{x:V,xKey:ce(V),label:p.labels[de],y:null,rows:0,rowKey:null})}});return{series:ee,categories:p.categories,labels:p.labels,kind:p.kind,measure:{col:null,fn:"sum",title:ee.map(H=>H.label).join(", ")},dimension:p.dimension,empty:!ee.length||!p.categories.length,rows:p.rows,truncated:p.truncated}}function K(t,e,s={}){const d=W(e.y),p=!!s.perRow,M=Array.isArray(s.nodes)?s.nodes:[],ee=e.source||e.x||null,H=e.target||null;if(!ee||!H)return{nodes:[],links:[],measure:{...d,title:""},dimension:{col:null,title:""},series:[],categories:[],labels:[],empty:!0,total:0};const F=d.col?t.columns.get(d.col):void 0,o=new Map,A=new Map,G=($,_,oe)=>{const a=ce($);return o.has(a)||o.set(a,{key:a,value:$,label:O(t,_,oe,$),index:o.size,in:0,out:0}),o.get(a)},D=new Map;for(const $ of M)!$||$.id===null||$.id===void 0||D.set(ce($.id),$);for(const $ of v(t)){const _=t.rows.value($.key,ee),oe=t.rows.value($.key,H);if(_==null||oe===null||oe===void 0)continue;const a=d.col?N(t.rows.value($.key,d.col)):1;if(a===null||a<=0)continue;const y=G(_,$,ee),r=G(oe,$,H);if(p){const k=y.key>r.key,l=k?r:y,I=k?y:r;A.set(`${l.key}\0${I.key}\0${A.size}`,{source:l,target:I,value:a,undirected:!0,pair:`${l.key}\0${I.key}`,rowKeys:[$.key]})}else{const k=`${y.key}\0${r.key}`,l=A.get(k)||{source:y,target:r,value:0,rowKeys:[]};l.value+=a,l.rowKeys.length<64&&l.rowKeys.push($.key),A.set(k,l)}y.out+=a,r.in+=a}for(const[$,_]of D)o.has($)||o.set($,{key:$,value:_.id,label:String(_.label??_.id),index:o.size,in:0,out:0});for(const[$,_]of D){const oe=o.get($);oe&&(oe.declared=!0,_.label!==void 0&&_.label!==null&&(oe.label=String(_.label)),typeof _.icon=="string"&&_.icon&&(oe.icon=_.icon),Number.isFinite(_.x)&&Number.isFinite(_.y)&&(oe.fx=Number(_.x),oe.fy=Number(_.y)))}const V=p?[...A.values()]:[...A.values()].sort(($,_)=>_.value-$.value),de=typeof e.limit=="number"&&e.limit>0?V.slice(0,e.limit):V;return{nodes:[...o.values()],links:de,measure:{...d,title:F?.title||d.col||""},dimension:{col:ee,title:t.columns.get(ee)?.title||ee},series:[],categories:[],labels:[],empty:!de.length,total:de.reduce(($,_)=>$+_.value,0)}}function pe(t,e,s={}){if(typeof e.parentId=="string"&&e.parentId)return q(t,e,s);if(typeof e.path=="string"&&e.path)return z(t,e,s);const d=W(e.y),p=typeof e.depth=="number"&&e.depth>0?e.depth:1/0,M=d.col?t.columns.get(d.col):void 0,ee=e.radius&&typeof e.radius=="object"?e.radius:null,H=ee&&typeof ee.col=="string"?W(ee.col):null,F=H&&H.col?t.columns.get(H.col):void 0,o=($,_,oe)=>({label:$,value:_,depth:oe,total:0,radius:0,children:[],rowKey:null,rowKeys:[]}),A=o("",null,0),G=u(t),D=new Map;if(G.length){const $=[];U(t,_=>{if(_.group){for(;$.length&&$[$.length-1].level>=_.level;)$.pop();$.push(_),D.has(_.key)||D.set(_.key,[])}else if(_.data!==null&&_.data!==void 0)for(const oe of $)D.get(oe.key).push(_.key)})}if(G.length){const $=(_,oe,a)=>{const y=_.groupColumn?O(t,_,_.groupColumn,_.groupValue):"",r=o(y,_.groupValue,a);r.rowKey=_.key;const k=d.col?b(t,_,d.col):null;if(r.total=k===null?0:Math.abs(k),H&&H.col){const I=b(t,_,H.col);r.radius=I===null?0:Math.abs(I)}oe.children.push(r);const l=_.filteredChildren||_.children;if(r.rowKeys=[...D.get(_.key)||[]],a<p&&Array.isArray(l))for(const I of l)I.group&&$(I,r,a+1);return!d.col&&s.count&&(r.total=r.rowKeys.length),!r.total&&r.children.length&&(r.total=r.children.reduce((I,E)=>I+E.total,0)),!r.radius&&H&&r.children.length&&(r.radius=r.children.reduce((I,E)=>I+E.radius,0)),r};for(const _ of G)$(_,A,1)}else{const _=g(t,{x:e.x,y:e.y,limit:e.limit,editable:e.editable,selection:e.selection}).series[0];if(_){const oe=_.points.map(()=>0);if(H&&H.col){const a=new Map(_.points.map((y,r)=>[ce(y.x),r]));for(const y of v(t)){const r=e.x?t.rows.value(y.key,e.x):null,k=a.get(ce(r));if(k===void 0)continue;const l=b(t,y,H.col);l!==null&&(oe[k]+=Math.abs(l))}}for(let a=0;a<_.points.length;a++){const y=_.points[a],r=o(y.label,y.x,1);r.total=y.y===null?0:Math.abs(y.y),r.rowKey=y.rowKey,r.rowKeys=y.rowKeys||(y.rowKey?[y.rowKey]:[]),r.radius=oe[a],A.children.push(r)}}}A.total=A.children.reduce(($,_)=>$+_.total,0);let V=0;const de=$=>{$.depth>V&&(V=$.depth);for(const _ of $.children)de(_)};return de(A),{root:A,depth:V,measure:{...d,title:M?.title||d.col||""},radius:H?{...H,title:F?.title||H.col||""}:null,empty:A.total<=0||A.children.length===0}}function ne(t,e,s,d,p){let M=0;const ee=(F,o)=>{F.depth=o,o>M&&(M=o);for(const A of F.children)ee(A,o+1);if(F.children.length){const A=F.children.reduce((G,D)=>G+D.total,0);A>0||!F.own?F.total=A:F.total=F.own;for(const G of F.children)for(const D of G.rowKeys)F.rowKeys.push(D)}else F.total=F.own||(!s.col&&p?1:0)};ee(e,0);const H=s.col?t.columns.get(s.col):void 0;return{root:e,depth:M,measure:{...s,title:H?.title||s.col||""},dimension:d,radius:null,empty:e.total<=0||e.children.length===0}}function C(t,e){return{label:t,value:e,depth:0,total:0,own:0,radius:0,children:[],rowKey:null,rowKeys:[]}}function q(t,e,s){const d=W(e.y),p=e.id||null,M=e.label||e.x||p,ee=C("",null),H=new Map,F=new Map;for(const A of v(t)){const G=p?t.rows.value(A.key,p):null,D=G==null||G===""?A.key:G,V=String(D);if(H.has(V))continue;const de=M?t.rows.text(A.key,M):"",$=C(de||V,D);$.rowKey=A.key,$.rowKeys=[A.key];const _=d.col?b(t,A,d.col):null;$.own=_===null?0:Math.abs(_),H.set(V,$);const oe=t.rows.value(A.key,e.parentId);F.set(V,oe==null||oe===""?"":String(oe))}for(const[A,G]of H){let D=F.get(A),V=0;for(;D&&H.has(D)&&D!==A&&V<=H.size;)D=F.get(D),V+=1;((!(V>H.size||D===A)&&F.get(A)&&F.get(A)!==A?H.get(F.get(A)):null)||ee).children.push(G)}const o={col:M||e.parentId,title:t.columns.get(M||e.parentId)?.title||M||e.parentId};return ne(t,ee,d,o,!!s.count)}function z(t,e,s){const d=W(e.y),p=typeof e.pathSeparator=="string"&&e.pathSeparator?e.pathSeparator:"/",M=C("",null),ee=new Map([[M,new Map]]);for(const F of v(t)){const o=t.rows.value(F.key,e.path);if(o==null||o==="")continue;const A=String(o).split(p).map(V=>V.trim()).filter(Boolean);let G=M;for(const V of A){let de=ee.get(G).get(V);de||(de=C(V,V),ee.get(G).set(V,de),ee.set(de,new Map),G.children.push(de)),G=de}if(G===M)continue;G.rowKey=G.rowKey||F.key,G.rowKeys.push(F.key);const D=d.col?b(t,F,d.col):null;G.own+=D===null?0:Math.abs(D),!d.col&&s.count&&(G.own+=1)}const H={col:e.path,title:t.columns.get(e.path)?.title||e.path};return ne(t,M,d,H,!!s.count)}}),it("packages/core/src/source/filterwire.js",function(n,re){"use strict";Object.defineProperty(n,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(n,"warnWherePageRelative",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"warnWhereNotApplied",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"warnWhereOverThreshold",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"parseRelativeToken",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"resolveRelativeRange",{enumerable:!0,get:function(){return O}}),Object.defineProperty(n,"relativeTokenOf",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"relativeTokenHelp",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"isResolvableRelative",{enumerable:!0,get:function(){return R}}),Object.defineProperty(n,"resolveRelativeCondition",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"isGroup",{enumerable:!0,get:function(){return x}}),Object.defineProperty(n,"forEachCondition",{enumerable:!0,get:function(){return T}}),Object.defineProperty(n,"mapConditions",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"normaliseFilterSet",{enumerable:!0,get:function(){return j}}),Object.defineProperty(n,"buildFilterSet",{enumerable:!0,get:function(){return X}}),Object.defineProperty(n,"wireFilters",{enumerable:!0,get:function(){return K}}),Object.defineProperty(n,"querySignature",{enumerable:!0,get:function(){return pe}});const ce=re("packages/core/src/internal/util.js").warnOnce,N="source.remote.hostFilter",ve="source.where.pageRelative";function xe(q,z){!Array.isArray(q)||!q.length||ce(ve,`filters.where (${q.join(", ")}) runs over the rows the ${z} 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 ie(q){const z=(q||{}).config;!z||!z.hostFilter||ce(N,"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 ae="source.where.notApplied";function J(q,z){ce(`${ae}:${q}`,`filters.where("${q}") is registered but the ${z} 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 ue="source.where.overThreshold";function B(q,z,t,e){!Array.isArray(q)||!q.length||ce(`${ue}:${z}`,`filters.where (${q.join(", ")}) is not applied to the ${z} pushdown source:`,t===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${t.toLocaleString()} rows, at or past the whereRowLimit of ${e.toLocaleString()}.`,"Running the predicate needs every matching row fetched and held here, which is the whole","download a pushdown source exists to avoid, so it is refused and the rows the predicate","would exclude stay on screen.","Give the predicate a { condition } twin so the engine narrows the fetch itself — that is the","route that works at any size — or raise `whereRowLimit` on the source config if you want the","download.")}const f=new Map;function L(q){let z=f.get(q);return z||(z=new Intl.DateTimeFormat("en-US",{timeZone:q,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),f.set(q,z)),z}function P(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function W(q,z){const t=L(z).formatToParts(new Date(q)),e={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const s of t)s.type==="year"?e.y=+s.value:s.type==="month"?e.m=+s.value:s.type==="day"?e.d=+s.value:s.type==="hour"?e.h=+s.value%24:s.type==="minute"?e.mi=+s.value:s.type==="second"&&(e.s=+s.value);return e}function U(q,z){const t=W(q,z);return Date.UTC(t.y,t.m-1,t.d,t.h,t.mi,t.s)-Math.floor(q/1e3)*1e3}function v(q,z,t,e){const s=Date.UTC(q,z-1,t),d=s-U(s,e);return s-U(d,e)}function m(q,z,t){const e=new Date(Date.UTC(q.y,q.m-1,q.d+z));return v(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),t)}const u=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function b(q,z){if(typeof q!="string")return null;const t=q.trim().toLowerCase().replace(/[\s_-]+/g,""),e=/^last(\d*|n)days?$/.exec(t);if(e){const s=e[1]==="n"?"":e[1],d=Number(s||z);return!Number.isFinite(d)||d<=0?null:{kind:"lastNDays",n:Math.floor(d)}}switch(t){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 O(q,z={}){const t=b(q,z.n);if(!t)return null;const e=z.tz||P(),s=z.now instanceof Date?z.now.getTime():typeof z.now=="number"?z.now:Date.now(),d=W(s,e),p=v(d.y,d.m,d.d,e),M=m(d,1,e);let ee=p,H=M;switch(t.kind){case"today":break;case"yesterday":ee=m(d,-1,e),H=p;break;case"lastNDays":H=z.includeToday?M:p,ee=m(d,z.includeToday?-(t.n-1):-t.n,e);break;case"thisWeek":{const F=Number.isFinite(z.weekStartsOn)?Number(z.weekStartsOn):1,A=(new Date(Date.UTC(d.y,d.m-1,d.d)).getUTCDay()-F+7)%7;ee=m(d,-A,e),H=m(d,-A+7,e);break}case"thisMonth":ee=v(d.y,d.m,1,e),H=v(d.m===12?d.y+1:d.y,d.m===12?1:d.m+1,1,e);break;case"thisQuarter":case"quarterToDate":{const F=Math.floor((d.m-1)/3)*3+1;ee=v(d.y,F,1,e),H=t.kind==="quarterToDate"?M:F===10?v(d.y+1,1,1,e):v(d.y,F+3,1,e);break}case"thisYear":case"yearToDate":ee=v(d.y,1,1,e),H=t.kind==="yearToDate"?M:v(d.y+1,1,1,e);break;default:return null}return{from:new Date(ee).toISOString(),to:new Date(H).toISOString(),bounds:"[)",tz:e,relative:t.kind==="lastNDays"?`last${t.n}Days`:t.kind,n:t.n}}function Q(q){if(!q||typeof q!="object")return null;const z=q.value;if(z&&typeof z=="object"&&!Array.isArray(z)&&"relative"in z)return{token:String(z.relative),n:typeof z.n=="number"?z.n:void 0};if(q.op==="relative"&&typeof q.value=="string")return{token:q.value,n:void 0};const t=q.meta;return t&&typeof t.relative=="string"&&q.value===void 0?{token:t.relative,n:typeof t.n=="number"?t.n:void 0}:null}function w(){return`Known tokens: ${u.filter(z=>z!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function R(q){const z=Q(q);return z?b(z.token,z.n)!==null:!1}function i(q,z={}){const t=Q(q);if(!t)return q;const e=O(t.token,{...z,n:t.n});return e?{...q,type:q.type||"date",op:"between",value:[e.from,e.to],bounds:q.bounds||e.bounds,meta:{...q.meta||{},relative:e.relative,tz:e.tz}}:(ce(`source.relative.${t.token}`,`unknown relative date token "${t.token}"; sending the condition unresolved.`,w()),q)}function x(q){return!!q&&typeof q=="object"&&Array.isArray(q.conditions)}function T(q,z){if(q){if(x(q)){for(const t of q.conditions)T(t,z);return}z(q)}}function h(q,z){if(!q)return null;if(!x(q))return z(q);const t=q;let e=!1;const s=[];for(const d of t.conditions){const p=h(d,z);p!==d&&(e=!0),p&&s.push(p)}return!e&&s.length===t.conditions.length?q:s.length?{...t,conditions:s}:null}function g(q){if(!q)return null;if(!x(q))return q;const z=q,t=[];for(const e of z.conditions){const s=g(e);s&&t.push(s)}return t.length?{op:z.op,conditions:t}:null}function j(q){const z=g(q);return z?x(z)&&z.op==="and"?z:{op:"and",conditions:[z]}:null}function X(q){const z=(q||[]).filter(Boolean);return z.length?{op:"and",conditions:z}:null}function K(q,z={}){const t=h(q,e=>i(e,z));return j(t)}function pe(q){const z=ne(q.filters??null);return JSON.stringify([z,q.sort??null,q.quick??"",q.groupBy??null,q.pivotBy??null,C(q.context)])}function ne(q){if(!q)return null;if(x(q)){const e=q;return{op:e.op,conditions:e.conditions.map(ne)}}const z=q,t=z.meta&&typeof z.meta.relative=="string"?z.meta.relative:Q(z)?.token;return{col:z.col,op:z.op,bounds:z.bounds??null,caseSensitive:z.caseSensitive??!1,value:t?`rel:${t}`:z.value??null}}function C(q){if(q==null)return null;try{return JSON.parse(JSON.stringify(q))}catch{return ce("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),it("packages/core/src/source/aggregates.js",function(n,re){"use strict";Object.defineProperty(n,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(n,"pushableAggregates",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"fillAggregateSql",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"resolveAggregatesConfig",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(n,"routeAggregate",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"resolveAggregatePlan",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"groupKeysPushable",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"pushdownDocRows",{enumerable:!0,get:function(){return ue}});const Se=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 ce(){const B=new Set;for(const[f,L]of Object.entries(Se))L.pushable&&B.add(f);return B}function N(B,f,L){let P=B.split("%c").join(f);return L!==void 0&&(P=P.split("%w").join(L)),P}function ve(B){const f=B||{},L=f.default==="engine"||f.default==="engine-if-identical"?f.default:"client",P={};if(f.overrides&&typeof f.overrides=="object")for(const[W,U]of Object.entries(f.overrides))(U==="engine"||U==="client")&&(P[W]=U);return{default:L,overrides:P}}function xe(B,f){const L=Se[B];if(!L||!L.pushable)return"client";const P=f.overrides[B];return P==="engine"||P==="client"?P:f.default==="client"?"client":f.default==="engine-if-identical"?L.class==="identical"?"engine":"client":"engine"}function ie(B,f){const L=ve(f),P=[],W=[];for(const U of B||[]){const v=Se[U.fn],m=xe(U.fn,L),u={id:U.id,col:U.col,fn:U.fn,class:v?v.class:"fallback"};U.weight!==void 0&&(u.weight=U.weight),U.params!==void 0&&(u.params=U.params),m==="engine"?P.push(u):(u.reason=v&&!v.pushable?v.note||"the engine cannot express this stat":"client by config",W.push(u))}return{engine:P,client:W,config:L}}const ae=/^[A-Za-z_][A-Za-z0-9_$]*$/;function J(B,f=[]){return(B||[]).every(P=>{if(typeof P=="string")return ae.test(P);if(!P||typeof P!="object")return!1;const W=P;return Array.isArray(f)&&f.includes(W.bucket)&&typeof W.col=="string"&&ae.test(W.col)&&typeof W.size=="number"&&Number.isFinite(W.size)&&W.size>0})}function ue(){return Object.entries(Se).map(([B,f])=>({stat:B,class:f.class,sql:f.sql?N(f.sql,"col",f.twoColumn?"weight":void 0):"",note:f.note||(f.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),it("packages/core/src/source/abort.js",function(n,re){"use strict";Object.defineProperty(n,"SupersededError",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(n,"RequestToken",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"AbortScope",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"createAbortScope",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(n,"isAbortError",{enumerable:!0,get:function(){return xe}});class Se extends Error{constructor(ae,J="superseded"){super(`[lattice] request ${ae?`"${ae}" `:""}${J}`),this.name="SupersededError",this.superseded=!0,this.key=ae}}class ce{#r;constructor(ae,J,ue,B){this.#r=ae,this.key=J,this.controller=ue,this.signal=ue.signal,this.seq=B}get current(){return!this.signal.aborted&&this.#r.tokenFor(this.key)===this}settle(){this.#r.settle(this)}abort(ae){this.signal.aborted||this.controller.abort(new Se(this.key,ae)),this.#r.settle(this)}}class N{#r=new Map;#n=0;begin(ae="",J="superseded"){const ue=this.#r.get(ae);ue&&!ue.signal.aborted&&ue.controller.abort(new Se(ae,J));const B=new ce(this,ae,new AbortController,++this.#n);return this.#r.set(ae,B),B}tokenFor(ae){return this.#r.get(ae)}pending(ae=""){const J=this.#r.get(ae);return!!J&&!J.signal.aborted}get size(){return this.#r.size}settle(ae){this.#r.get(ae.key)===ae&&this.#r.delete(ae.key)}abort(ae="",J="superseded"){const ue=this.#r.get(ae);ue&&ue.abort(J)}abortAll(ae="superseded"){for(const J of[...this.#r.values()])J.abort(ae);this.#r.clear()}}function ve(){return new N}function xe(ie){if(!ie||typeof ie!="object")return!1;const ae=ie;return ae.superseded===!0||ae.name==="AbortError"||ae.name==="SupersededError"}}),it("packages/core/src/source/pushdown.js",function(n,re){"use strict";Object.defineProperty(n,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"NO_CAPABILITIES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"resolveMutate",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"capabilitiesOf",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"splitFilters",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return x}}),Object.defineProperty(n,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return j}}),Object.defineProperty(n,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return X}}),Object.defineProperty(n,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return K}}),Object.defineProperty(n,"planQuery",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(n,"applyResidual",{enumerable:!0,get:function(){return z}}),Object.defineProperty(n,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return d}}),Object.defineProperty(n,"createPushdownSource",{enumerable:!0,get:function(){return H}});const Se=re("packages/core/src/internal/util.js"),ce=Se.defaultCompare,N=Se.isFunction,ve=Se.toArray,xe=Se.warnOnce,ie=re("packages/core/src/source/filterwire.js"),ae=ie.isGroup,J=ie.warnWherePageRelative,ue=ie.warnWhereOverThreshold,B=re("packages/core/src/source/aggregates.js"),f=B.resolveAggregatePlan,L=B.groupKeysPushable,P=B.STAT_PUSHDOWN,U=re("packages/core/src/source/abort.js").SupersededError,v=1e3;function m(F){const o=F&&F.signal;if(!o||!o.aborted)return;const A=o.reason;throw A instanceof Error?A:new U("","superseded before it was sent")}const u=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function b(F){if(!F||typeof F!="object")return!1;const o=F.returning==="row"||F.returning==="key"?F.returning:"none";return{append:F.append===!0,update:F.update===!0,delete:F.delete===!0,returning:o}}function O(F,o){if(!F||typeof o!="string")return;if(!o.includes("."))return F[o];let A=F;for(const G of o.split(".")){if(A===null||typeof A!="object")return;A=A[G]}return A}function Q(F){if(F===!0)return!0;if(!F||typeof F!="object")return!1;const o=F;return o.enabled===!1?!1:o.enabled===!0||N(o.commit)}function w(F){const o={...u,...F||{}};return o.operators=new Set(o.operators||[]),o.mutate=b(o.mutate),o}function R(F,o){return!F||!F.op||!o.operators.size?!1:o.operators.has(F.op)}function i(F,o){if(!F)return{pushed:null,residual:null};if(!o.filter)return{pushed:null,residual:F};if(o.filter==="term"){if(ae(F)){const V=F.conditions||[];if(String(F.op)!=="and")return{pushed:null,residual:F};const de=V.findIndex(_=>!ae(_)&&R(_,o));if(de<0)return{pushed:null,residual:F};const $=V.filter((_,oe)=>oe!==de);return{pushed:V[de],residual:$.length?{op:"and",conditions:$}:null}}return R(F,o)?{pushed:F,residual:null}:{pushed:null,residual:F}}if(!ae(F))return R(F,o)?{pushed:F,residual:null}:{pushed:null,residual:F};if(String(F.op)!=="and")return(F.conditions||[]).every(de=>ae(de)?i(de,o).residual===null:R(de,o))?{pushed:F,residual:null}:{pushed:null,residual:F};const A=[],G=[];for(const V of F.conditions||[]){if(ae(V)){if(o.filter==="flat"){G.push(V);continue}const de=i(V,o);de.pushed&&A.push(de.pushed),de.residual&&G.push(de.residual);continue}(R(V,o)?A:G).push(V)}const D=V=>V.length===0?null:V.length===1?V[0]:{op:"and",conditions:V};return{pushed:D(A),residual:D(G)}}const x="__lattice_leaves";function T(F){return F.aggregates?F.aggregates instanceof Set?F.aggregates:new Set(ve(F.aggregates)):new Set}function h(F){const o=T(F);return o.size?o.has("count")?F.filter!=="tree"||!F.operators||!F.operators.has("eq")?"the adapter does not declare the `group` capability, and cannot narrow a group's rows by its key (that needs a `tree` filter with the `eq` operator)":"":"the adapter does not declare the `group` capability, and its declared aggregates have no `count` to give each group its row count":"the adapter does not declare the `group` capability"}function g(F,o,A,G,D,V,de){const $=Array.isArray(F.groupBy)?F.groupBy:[],_=Array.isArray(F.groupPath)?F.groupPath:[],oe=Array.isArray(F.groupValues)?F.groupValues:null;if(!o.group){const a=h(o);if(a)return a}return L($)?A.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":G?D?V?"a host `where` predicate can only run in the browser, over rows the engine grouped":de?"fullDataset holds the whole matching set, so the grid groups it itself":!oe||oe.length!==_.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",X="pushdown:group-unsupported",K=Symbol("lattice.remote.ungroupedLevel");function pe(F,o,A,G,D,V){const de=Array.isArray(F.pivotBy)?F.pivotBy:[],$=Array.isArray(F.groupBy)?F.groupBy:[],_=Array.isArray(F.groupPath)?F.groupPath:[],oe=Array.isArray(F.groupValues)?F.groupValues:null;return o.pivot?L(de)?$.length&&!L($)?"a grouping key is not a plain column the engine can name in a GROUP BY":A.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":G?D?V?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!oe||oe.length!==_.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 ne(F,o,A=!1){const G=i(F.filters||null,o),D=[];G.residual&&D.push("filter");const V=F.sort||[],de=V.length===0||o.sort==="multi"&&V.length>=1||o.sort==="single"&&V.length===1;!de&&V.length&&D.push("sort");const $=F.quick?String(F.quick):"",_=!$||!!o.quick;_||D.push("quick");const oe=F.where&&F.where.active?F.where:null;oe&&D.push("where");const a={filters:G.residual,sort:de?null:V,quick:_?"":$,where:oe},y=!!A,r=Array.isArray(F.groupBy)&&F.groupBy.length>0,k=r?g(F,o,G,de,_,oe,y):"",l=F.pivotMode!==!1&&Array.isArray(F.pivotBy)&&F.pivotBy.length>0,I=l?pe(F,o,G,de,_,oe):"",E=l&&I==="";l&&!E&&D.push("pivot");const Y=l?E&&r:r&&k==="";r&&!l&&!Y&&D.push("group");const se=(Y||E)&&Array.isArray(F.groupValues)?F.groupValues.length:0,le=Y||l?!1:y||!!(a.filters||a.sort||a.quick||a.where)||!o.range;return{pushed:{...F,filters:G.pushed,sort:de?V:[],quick:_?$:"",range:le?null:F.range},residual:a,needsAll:le,unpushed:D,full:y,grouped:Y,groupLevel:se,groupReason:l?"":k,pivoted:E,pivotReason:I}}function C(F){const o=Array.isArray(F.totals)?F.totals:[],A=F.totalFns&&typeof F.totalFns=="object"?F.totalFns:{},G=[],D=[];for(const V of o){const de=String(V),$=typeof A[de]=="string"?A[de]:null,_=$?P[$]:null;$?!_||!_.pushable||!_.sql?D.push({id:de,fn:$,class:_?_.class:"fallback",reason:_&&_.note?_.note:`the pushdown map cannot express "${$}"`}):_.twoColumn?D.push({id:de,fn:$,class:_.class,reason:`"${$}" reduces two columns, and a grouped request carries no weight column`}):G.push({id:de,col:de,fn:$,class:_.class}):D.push({id:de,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:G,client:D}}const q=Object.freeze({items:F=>F==null?[]:Array.isArray(F)?F:[F]});function z(F,o,A){if(!o)return F;let G=F;if(o.filters&&N(A.evaluateFilters)){const D=G,V={count:G.length,handle:_=>({id:_,get:oe=>O(D[oe],_)}),itemwise:_=>D.some(oe=>Array.isArray(O(oe,_)))?q:null},de=A.evaluateFilters(o.filters,V),$=[];for(let _=0;_<G.length;_++)de[_]&&$.push(G[_]);G=$}if(o.where&&o.where.active&&(o.whole||J(o.where.names,"pushdown"),G=G.filter(D=>o.where.passes(D))),o.quick){const D=o.quick.toLowerCase();G=G.filter(V=>{if(!V||typeof V!="object")return!1;for(const de of Object.values(V))if(de!=null&&String(de).toLowerCase().includes(D))return!0;return!1})}if(o.sort&&o.sort.length&&N(A.sortMulti)){const D=[...new Set(o.sort.map(_=>_.col))],V=G,de=D.map(_=>({id:_,get:oe=>O(V[oe],_)})),$=A.sortMulti(de,o.sort.map(_=>({col:_.col,dir:_.dir})),Uint32Array.from({length:G.length},(_,oe)=>oe),{});G=Array.from($,_=>V[_])}return G}function t(F){return JSON.stringify({filters:F.filters||null,sort:F.sort||[],quick:F.quick||"",groupBy:F.groupBy||[],groupPath:F.groupPath||[],context:F.context??null})}function e(F){if(!F||typeof F!="object")return 16;let o="";try{o=JSON.stringify(F)}catch{return 200}return o.length*2+64}function s(F){const o=F||{};return{enabled:!!o.enabled,maxRows:Number.isFinite(o.maxRows)?o.maxRows:1e6,maxBytesEstimate:Number.isFinite(o.maxBytesEstimate)?o.maxBytesEstimate:512*1024*1024}}const d=5e4;function p(F){return Number.isFinite(F)&&F>=0?F:d}function M(F){return!!F&&N(F.then)}async function ee(F){if(!F||F.total!==void 0||!M(F.pendingTotal))return F;const o=await F.pendingTotal,{pendingTotal:A,...G}=F;return typeof o=="number"?{...G,total:o}:G}function H(F={}){const o=F.adapter;if(!o||!N(o.execute))return xe("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...F,mode:"remote",fetch:async()=>({rows:[],total:0})};const A=w(o.capabilities),G=o.capabilities&&Object.getOwnPropertyDescriptor(o.capabilities,"operators");G&&N(G.get)&&Object.defineProperty(A,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(o.capabilities.operators||[]),set:()=>{}});const D=o.name||"adapter";let V=null;const de=()=>N(o.ready)?(V||(V=Promise.resolve(o.ready()).then(()=>{Object.assign(A,w(o.capabilities))},Ye=>{throw V=null,Ye})),V):null,$=s(F.fullDataset),_=!!F.allowPartialResults,oe=p(F.whereRowLimit);let a=null;const y=F.aggregates;let r=null,k=null,l=null,I=null,E=null,Y,se=null,le=0,ye=null;const be=()=>!$.enabled||!r?null:(ye!==r.key&&(le++,ye=r.key),{rows:r.rows,version:le}),Ae=async Ye=>{const nt=Ye.where&&Ye.where.active?Ye.where:null;if(!nt)return{request:Ye,probe:null};const{where:yt,...mt}=Ye,Je=ne(mt,A,$.enabled);if(Je.needsAll)return{request:Ye,probe:null};const lt=t(Je.pushed);let kt=null;return(!a||a.key!==lt)&&(A.total?(m(Ye),kt=await ee(await o.execute(Je.pushed,Ye)),a={key:lt,size:kt&&typeof kt.total=="number"?kt.total:null}):a={key:lt,size:null}),a.size!==null&&a.size<oe?{request:Ye,probe:null}:(ue(nt.names,D,a.size,oe),{request:mt,probe:kt})},Ne=async(Ye,nt)=>{se=null;const yt=C(Ye.pushed);l={engine:yt.engine,client:yt.client,groupBy:Ye.pushed.groupBy},yt.client.length&&xe(`source.pushdown.group.totals.${D}.${yt.client.map(lt=>lt.id).join(".")}`,`the ${D} adapter cannot compute the group subtotal for ${yt.client.map(lt=>`"${lt.id}" (${lt.reason})`).join(", ")}, so those group rows carry no value for that column. A figure computed over anything other than the group would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const mt=await o.executeGroupLevel(Ye.pushed,yt.engine,nt)||{};let Je=mt.rows||[];return!A.range&&nt.range&&(Je=Je.slice(nt.range.start,nt.range.end)),we(mt),mt.total===void 0?{rows:Je}:{rows:Je,total:mt.total}},te=new Map,Me=64,ke=async(Ye,nt)=>{se=null;const yt=Ye.pushed,mt=yt.groupBy,Je=Array.isArray(yt.groupValues)?yt.groupValues:[],lt=Je.length,kt=[...yt.filters?[yt.filters]:[],...mt.slice(0,lt).map((Mt,nn)=>({col:Mt,op:"eq",value:Je[nn]===void 0?null:Je[nn],caseSensitive:!0}))],Et=kt.length===0?null:kt.length===1?kt[0]:{op:"and",conditions:kt},ut=nt.range?nt.range.start:0;if(lt>=mt.length){const Mt={...yt,filters:Et,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},nn=await ee(await o.execute(Mt,nt))||{};let sn=nn.rows||[];return!A.range&&nt.range&&(sn=sn.slice(nt.range.start,nt.range.end)),typeof nn.total=="number"?{rows:sn,total:nn.total}:{rows:sn}}const bt=mt[lt],ft=C(yt),Ot=T(A),Ft=ft.engine.filter(Mt=>Ot.has(Mt.fn)),tn=[...ft.engine.filter(Mt=>!Ot.has(Mt.fn)).map(Mt=>({id:Mt.id,fn:Mt.fn,class:Mt.class,reason:`the ${D} adapter does not compute "${Mt.fn}"`})),...ft.client];l={engine:Ft,client:tn,groupBy:mt},tn.length&&xe(`source.pushdown.group.totals.${D}.${tn.map(Mt=>Mt.id).join(".")}`,`the ${D} adapter cannot compute the group subtotal for ${tn.map(Mt=>`"${Mt.id}" (${Mt.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 Nt=[...Ft.map(Mt=>({id:Mt.id,col:Mt.col,fn:Mt.fn})),{id:x,col:bt,fn:"count"}],Rt={...yt,filters:Et,range:null},Dt=JSON.stringify([t(Rt),Je,bt,Nt]);let Jt=ut>0?te.get(Dt):void 0;if(!Jt){for(Jt=Promise.resolve(o.executeGroupedAggregates(Rt,[bt],Nt)),te.delete(Dt),te.set(Dt,Jt);te.size>Me;)te.delete(te.keys().next().value);Jt.catch(()=>{te.get(Dt)===Jt&&te.delete(Dt)})}const An=await Jt||[];m(nt);const cn=Mt=>{const nn={};for(const sn of Ft)nn[sn.id]=Mt?Mt[sn.id]:void 0;return nn},un=(yt.sort||[]).find(Mt=>Mt&&Mt.col===bt),pn=un&&un.dir==="desc"?-1:1,fn=An.filter(Mt=>Mt&&Mt.level===1).map(Mt=>({[bt]:Mt.keys[0]===void 0?null:Mt.keys[0],leafCount:Number(Mt.values&&Mt.values[x])||0,totals:cn(Mt.values)})).sort((Mt,nn)=>pn*ce(Mt[bt],nn[bt]));if(lt===0){const Mt=An.find(sn=>sn&&sn.level===0),nn=Mt?Number(Mt.values&&Mt.values[x]):NaN;we({matchCount:Number.isFinite(nn)?nn:fn.reduce((sn,Zn)=>sn+Zn.leafCount,0),...Mt?{grand:cn(Mt.values)}:{}})}const Tn=nt.range?nt.range.end:fn.length;return{rows:fn.slice(ut,Tn),total:fn.length}},we=Ye=>{typeof Ye.matchCount=="number"&&(I=Ye.matchCount,E=Ye.grand?{totals:Ye.grand,leafCount:Ye.matchCount}:null,Y===void 0&&N(o.unfilteredCount)&&(Y=null,Promise.resolve(o.unfilteredCount()).then(nt=>{Y=typeof nt=="number"?nt:null}).catch(nt=>{xe(`source.pushdown.group.unfiltered.${D}`,`the ${D} adapter could not count the unfiltered set (${nt&&nt.message?nt.message:nt}), so "N of M" falls back to the display count for its denominator.`)})))},je=async(Ye,nt)=>{se=null;const yt=C(Ye.pushed);l={engine:yt.engine,client:yt.client,groupBy:Ye.pushed.groupBy,pivotBy:Ye.pushed.pivotBy},yt.client.length&&xe(`source.pushdown.pivot.totals.${D}.${yt.client.map(Et=>Et.id).join(".")}`,`the ${D} adapter cannot compute the pivot cells for ${yt.client.map(Et=>`"${Et.id}" (${Et.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 mt=await o.executePivotLevel(Ye.pushed,yt.engine,nt)||{};let Je=mt.rows||[];!A.range&&nt.range&&(Je=Je.slice(nt.range.start,nt.range.end)),we(mt);const lt=mt.pivot&&typeof mt.pivot=="object"?mt.pivot:{},kt={cells:Array.isArray(lt.cells)?lt.cells:[],...Array.isArray(lt.axis)?{axis:lt.axis}:{}};return mt.total===void 0?{rows:Je,pivot:kt}:{rows:Je,total:mt.total,pivot:kt}},Pe=Ye=>{xe(`source.pushdown.pivot.${D}.${Ye}`,`pushdown:pivot-unsupported: the ${D} adapter cannot pivot this query because ${Ye}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const nt=new Error(`[lattice] ${j}: the ${D} adapter cannot pivot this query because ${Ye}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw nt.code=j,nt.reason=Ye,nt},Ce=(Ye,nt)=>{const yt={key:nt,state:"pending",value:null};return se=yt,Ye.then(mt=>(se===yt&&(se={key:nt,state:"settled",value:typeof mt=="number"?mt:null}),mt),mt=>{throw se===yt&&(se={key:nt,state:"failed",value:null}),mt})};let $e=0,Le=[];const _e=()=>$e===0?null:new Promise(Ye=>{const nt=setTimeout(Ye,v);Le.push(()=>{clearTimeout(nt),Ye()})}),ot=async Ye=>{const nt=de();nt&&await nt;const mt=Ye&&Ye.pivotMode!==!1&&Array.isArray(Ye.pivotBy)&&Ye.pivotBy.length>0?{request:Ye,probe:null}:await Ae(Ye);m(Ye);let Je=ne(mt.request,A,$.enabled);if(A.group&&Je.grouped&&!Je.pivoted&&!N(o.executeGroupLevel)&&(xe(`source.pushdown.group.method.${D}`,`the ${D} 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.`),Je=ne(mt.request,{...A,group:!1,aggregates:null},$.enabled)),Je.pivoted&&!N(o.executePivotLevel)&&(Je=ne(mt.request,{...A,pivot:!1},$.enabled),Je.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Je.grouped&&!Je.pivoted&&!A.group&&!N(o.executeGroupedAggregates)&&(xe(`source.pushdown.group.aggregates.method.${D}`,`the ${D} 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\`.`),Je=ne(mt.request,{...A,aggregates:null},$.enabled)),k=Je,Je.pivoted)return je(Je,Ye);if(Je.pivotReason&&Pe(Je.pivotReason),Je.grouped)return A.group?Ne(Je,Ye):ke(Je,Ye);const kt=!!Je.groupReason&&!Je.full;kt?xe(`source.pushdown.group-unsupported.${D}.${Je.groupReason}`,`pushdown:group-unsupported: the ${D} adapter was not asked to group this query because ${Je.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.`):Je.groupReason&&xe(`source.pushdown.group.${D}.${Je.groupReason}`,`the ${D} adapter was not asked to group this query because ${Je.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 Et=Nt=>kt?{...Nt,[K]:!0}:Nt;if(!Je.needsAll){const Nt=mt.probe||await o.execute(Je.pushed,Ye),Rt=Nt.rows||[];return M(Nt.pendingTotal)&&Nt.total===void 0?Et({rows:Rt,pendingTotal:Ce(Nt.pendingTotal,t(Je.pushed))}):(se=null,!A.total&&Nt.total===void 0?Et({rows:Rt}):Et({rows:Rt,total:Nt.total??Rt.length}))}Je.unpushed.length&&xe(`source.pushdown.residual.${D}.${Je.unpushed.join(".")}`,`the ${D} adapter cannot push ${Je.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 ut=t(Je.pushed);if(!r||r.key!==ut){const Nt=await ee(await o.execute(Je.pushed,Ye));se=null;const Rt=Nt.rows||[];if(Je.full){const Dt=typeof Nt.total=="number"?Math.max(Nt.total,Rt.length):Rt.length;if(Dt>$.maxRows)throw new Error(`[lattice] fullDataset refused: the ${D} adapter's matching set is ${Dt.toLocaleString()} rows, past the configured maxRows of ${$.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 Jt=Rt.length*e(Rt[0]);if(Jt>$.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${D} adapter's matching set is an estimated ${Math.round(Jt/(1024*1024)).toLocaleString()} MB across ${Rt.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round($.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 Nt.total=="number"&&Rt.length<Nt.total){const Dt=!!(Je.residual.filters||Je.residual.quick||Je.residual.sort&&Je.residual.sort.length);if(Dt&&!_)throw new Error(`[lattice] the ${D} adapter returned ${Rt.length} of ${Nt.total} matching rows when asked for the whole result, and the query has residual ${Je.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.`);Dt?xe(`source.pushdown.partial.residual.${D}`,`the ${D} adapter returned ${Rt.length} of ${Nt.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.`):xe(`source.pushdown.partial.${D}`,`the ${D} adapter returned ${Rt.length} of ${Nt.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}r={key:ut,rows:Rt,total:typeof Nt.total=="number"?Nt.total:null}}let bt=Je;if(Je.residual.where){const Nt=r.total??r.rows.length;if(Nt>=oe){ue(Je.residual.where.names,D,Nt,oe);const{where:Rt,...Dt}=mt.request;bt=ne(Dt,A,$.enabled),k=bt}}const ft=r.total!==null&&r.rows.length>=r.total,Ot=z(r.rows,{...bt.residual,whole:ft},F.compute||{}),Ft=Ye.range?Ye.range.start:0,tn=Ye.range?Ye.range.end:Ot.length;return Et({rows:Ot.slice(Ft,tn),total:Ot.length})},qe=async(Ye,nt)=>{const yt=_e();yt&&await yt;const mt=de();mt&&await mt;const Je=ne(Ye,A,$.enabled);k=Je;const lt=f(nt,y),kt=Array.isArray(Ye.groupBy)?Ye.groupBy:[],Et=kt.length>0,ut=!Je.residual.filters&&!Je.residual.quick,bt=!Et||L(kt,A.buckets);let ft=lt.engine,Ot=lt.client;if(A.aggregates&&ft.length){const Rt=A.aggregates instanceof Set?A.aggregates:new Set(ve(A.aggregates)),Dt=ft.filter(Jt=>!Rt.has(Jt.fn));Dt.length&&(ft=ft.filter(Jt=>Rt.has(Jt.fn)),Ot=[...Dt.map(Jt=>({...Jt,reason:`the ${D} adapter does not compute "${Jt.fn}"`})),...Ot])}const Ft=Rt=>{Ot=[...ft.map(Dt=>({...Dt,reason:Rt})),...Ot],ft=[]};ft.length&&!ut?Ft(Je.residual.quick&&!Je.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):ft.length&&!bt&&Ft("a grouping key the engine cannot form forces all-client (no mixed provenance)");let tn={},Nt;return ft.length&&(N(Et?o.executeGroupedAggregates:o.executeAggregates)?Et?Nt=await o.executeGroupedAggregates(Je.pushed,kt,ft)||[]:tn=await o.executeAggregates(Je.pushed,ft)||{}:(xe(`source.pushdown.aggregates.${D}${Et?".grouped":""}`,`the ${D} adapter cannot compute ${Et?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),Ft(`adapter cannot compute ${Et?"grouped ":""}aggregates`))),l={engine:ft,client:Ot,...Et?{groupBy:kt}:{}},{values:tn,engine:ft,client:Ot,...Nt!==void 0?{groups:Nt}:{}}},Xe=async Ye=>{$e++;try{return await ot(Ye)}finally{if($e--,$e===0&&Le.length){const nt=Le;Le=[];for(const yt of nt)yt()}}},We=Q(F.edit),et=F.edit&&typeof F.edit=="object"&&N(F.edit.commit);let He=F.edit;if(We&&!et)if(A.mutate&&A.mutate.update){const Ye=nt=>{if(!A.mutate||!A.mutate.update)throw new Error(`[lattice] the ${D} 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 yt={kind:"update",key:String(nt.key),patch:{[nt.colId]:nt.value}};return o.mutate(yt,nt.request||{})};He={...F.edit===!0?{}:F.edit,commit:Ye}}else xe(`source.pushdown.readonly.${D}`,`edit is enabled but the ${D} adapter declares mutate: ${A.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 pt=We&&A.mutate&&(A.mutate.append||A.mutate.delete)?{append:A.mutate.append===!0,remove:A.mutate.delete===!0,returning:A.mutate.returning,mutate:(Ye,nt)=>o.mutate(Ye,nt||{})}:null,ct=async Ye=>{const nt=de();nt&&await nt;const{range:yt,signal:mt,export:Je,...lt}=Ye||{},kt={...lt,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:ne(kt,A,$.enabled),signal:mt}};async function*St(Ye,nt={}){const{plan:yt,signal:mt}=await ct(Ye),Je=Math.max(1,Math.floor(Number(nt.pageSize))||5e3),lt={signal:mt,stream:!0};if(!yt.needsAll)for(let ut=0;;ut+=Je){m(lt);const bt=await o.execute({...yt.pushed,range:{start:ut,end:ut+Je}},lt);bt&&M(bt.pendingTotal)&&bt.pendingTotal.then(null,()=>{});const ft=bt&&bt.rows||[];if(ft.length&&(yield ft),ft.length<Je)return}m(lt);const kt=await ee(await o.execute({...yt.pushed,range:void 0},lt)),Et=z(kt&&kt.rows||[],{...yt.residual,whole:!0},F.compute||{});for(let ut=0;ut<Et.length;ut+=Je)yield Et.slice(ut,ut+Je)}return{...F,edit:He,rowMutate:pt,mode:"remote",fetch:Xe,foregroundIdle:_e,aggregate:qe,countMatching:async Ye=>{const{plan:nt,signal:yt}=await ct(Ye);if(!nt.needsAll&&A.total){m({signal:yt});const Je=await ee(await o.execute({...nt.pushed,range:{start:0,end:0}},{signal:yt}));if(Je&&typeof Je.total=="number")return Je.total}let mt=0;for await(const Je of St(Ye))mt+=Je.length;return mt},streamMatching:St,lastPlan:()=>k?{...k,...l?{aggregates:l}:{},...se?{total:{deferred:!0,state:se.state,value:se.value}}:{}}:null,fullFrame:be,counts:()=>({match:I,total:Y??null,pending:!!se&&se.state==="pending"}),grandTotals:()=>E}}}),it("packages/modules/shared/engine.js",function(n,re){"use strict";Object.defineProperty(n,"sourceId",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"engineSource",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"gridPivoted",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"loadedAndMatching",{enumerable:!0,get:function(){return f}}),Object.defineProperty(n,"gridHoldsWindow",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"gridEngineRequest",{enumerable:!0,get:function(){return W}}),Object.defineProperty(n,"EngineFlight",{enumerable:!0,get:function(){return U}});const Se=re("packages/core/src/source/pushdown.js"),ce=Se.capabilitiesOf,N=Se.planQuery,xe=re("packages/core/src/source/filterwire.js").wireFilters,ie=new WeakMap;let ae=0;function J(v){let m=ie.get(v);return m===void 0&&(m=++ae,ie.set(v,m)),m}function ue(v){const m=v&&typeof v.config=="function"?v.config():null,u=m&&m.source&&typeof m.source=="object"?m.source:null;if(!u||typeof u.aggregate!="function")return{reason:"the grid's source has no aggregate() — it is not a pushdown source"};const b=ce(u.adapter&&u.adapter.capabilities);return{source:u,caps:b,config:m}}function B(v){const m=v&&typeof v.config=="function"?v.config():null,u=m&&m.source&&typeof m.source=="object"?m.source:null;if(!u||typeof u.lastPlan!="function")return!1;const b=v&&v.state&&typeof v.state.get=="function"?v.state.get():null,O=b&&b.pivot;return!!(O&&O.enabled&&Array.isArray(O.columns)&&O.columns.length>0)}function f(v){const m=v.rows&&typeof v.rows.residentCount=="function"?v.rows.residentCount():0,u=typeof v.rows.matchCount=="function"?v.rows.matchCount():NaN;return{loaded:m,total:Number.isFinite(u)?u:NaN}}function L(v){const m=v&&typeof v.config=="function"?v.config():null,u=m&&m.source&&typeof m.source=="object"?m.source:null;if(!u||u.mode!=="remote"&&u.mode!=="paged")return!1;if(typeof v.rows.matchCount=="function"&&v.rows.matchCount()===null)return!0;const{loaded:b,total:O}=f(v);return Number.isFinite(O)&&b<O}function P(v,m){return m?v?{op:"and",conditions:[v,m]}:m:v||null}function W(v,m,u=null){const b=v.filters&&typeof v.filters.where=="function"?v.filters.where():[];if(Array.isArray(b)&&b.length)return{reason:`a \`where\` predicate is in force (${b.join(", ")}), which only the browser can run`};const O=v.filters&&typeof v.filters.quickState=="function"?v.filters.quickState():{text:""},Q=O&&O.text?String(O.text):"",{config:w,caps:R}=m,i={filters:xe(P(v.filters.get(),u),{tz:w.timeZone,weekStartsOn:w.weekStartsOn}),sort:[],range:null,context:w.context??null,...Q?{quick:Q}:{}},x=N(i,R);return x.unpushed.includes("filter")?{reason:u?"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:i,quick:Q}}class U{#r=null;#n=null;#i=!1;answer(m){return this.#n&&this.#n.key===m?this.#n:null}last(){return this.#n}get busy(){return this.#r!==null}ask(m,u,b){const O=this.#r;if(O){O.key!==m&&O.controller&&O.controller.abort();return}const Q=globalThis.AbortController,w=typeof Q=="function"?new Q:null,R={key:m,controller:w};this.#r=R;let i;Promise.resolve().then(()=>u(w?w.signal:null)).then(x=>{i={key:m,result:x}},x=>{i={key:m,error:x}}).then(()=>{this.#r===R&&(this.#r=null),!this.#i&&(w&&w.signal.aborted||(this.#n=i),b())})}abort(){const m=this.#r;m&&m.controller&&m.controller.abort()}close(){this.#i=!0,this.abort()}}}),it("packages/modules/charts/engine.js",function(n,re){"use strict";Object.defineProperty(n,"AGGREGATE_MODES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"ENGINE_TYPES",{enumerable:!0,get:function(){return O}}),Object.defineProperty(n,"aggregateMode",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"planAggregate",{enumerable:!0,get:function(){return X}}),Object.defineProperty(n,"holdsWindow",{enumerable:!0,get:function(){return K}}),Object.defineProperty(n,"boundFromGroups",{enumerable:!0,get:function(){return C}}),Object.defineProperty(n,"measureProvenance",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"specMeasures",{enumerable:!0,get:function(){return z}});const Se=re("packages/modules/charts/scale.js"),ce=Se.key,N=Se.toNumber,ve=re("packages/modules/charts/bind.js"),xe=ve.forcedScaleKind,ie=ve.measureOf,ae=ve.scaleKindFor,J=re("packages/core/src/source/aggregates.js"),ue=J.resolveAggregatePlan,B=J.STAT_PUSHDOWN,L=re("packages/core/src/internal/util.js").warnOnce,P=re("packages/modules/shared/engine.js"),W=P.engineSource,U=P.gridEngineRequest,v=P.gridHoldsWindow,m=P.loadedAndMatching,u=P.sourceId,b=Object.freeze(["auto","engine","client"]),O=Object.freeze(new Set(["line","step","area","bar","horizontalBar","waterfall","combo","pareto","heatmap","radar","funnel","stream","marimekko"])),Q=Object.freeze(new Set(["combo","bar","line","step","area"])),w=Object.freeze({mean:"avg"}),R="__rows",i="m",x="__size",T=/^[A-Za-z_][A-Za-z0-9_$]*$/;function h(t){const e=t?t.aggregate:void 0;return e==null?"auto":typeof e=="string"&&b.includes(e)?e:(L(`chart:aggregate:mode:${String(e)}`,`chart aggregate ${JSON.stringify(e)} is not a mode; use one of ${b.join(", ")}. The chart used 'auto'.`),"auto")}function g(t,e,s){const d=t.columns.get(e);if(!d)return`the ${s} column "${e}" is not a column of the grid`;const p=d.value&&typeof d.value=="object"?d.value:null;return d.computed||p&&(typeof p.get=="function"||typeof p.compute=="function")?`the ${s} column "${e}" is computed by the grid, which the engine cannot reproduce`:(typeof d.field=="string"?d.field:e)!==e||!T.test(e)?`the ${s} column "${e}" is not a plain physical column the engine can name`:s!=="measure"&&d.type==="geometry"?`the ${s} column "${e}" is a geometry, which charts group in the browser for now`:""}function j(t,e,s){const d=Q.has(s)&&Array.isArray(e.measures)&&e.measures.length>0;return(d?e.measures:[e.y]).map((M,ee)=>{const H=ie(M),F=H.col?t.columns.get(H.col):void 0,o=ie(M,F),A=M&&typeof M=="object"?M:{};return{id:`${i}${ee}`,col:o.col,fn:o.fn,stat:w[o.fn]||o.fn,label:d?A.title||A.label||F&&F.title||o.col||"":F&&F.title||o.col||"",mark:d&&A.type||null,axis:d&&A.axis==="right"?"right":"left",multi:d}})}function X(t,e,s){const d=h(e),p=(y,r=!1)=>({mode:"client",asked:d,reason:y,refused:d==="engine",windowed:r});if(d==="client")return{...p("aggregate: 'client' was asked for"),refused:!1};if(!O.has(s))return p(`a "${s}" chart does not draw a grouped aggregate`);if(Array.isArray(e.points))return p("the chart draws an explicit point set");if(e.rows)return p("the chart was handed its own rows");if(e.from==="groups"||e.from==="selection")return p(`the chart reads the grid's ${e.from==="groups"?"group rows":"selection"}`);if(e.error)return p("error bars need the readings behind each mark");const M=W(t);if("reason"in M)return p(M.reason);const{source:ee,caps:H}=M;if(!H.group)return p("the source's adapter does not declare the `group` capability");const F=typeof e.x=="string"&&e.x?e.x:null;if(!F)return p("the chart names no x column to group by");const o=typeof e.series=="string"&&e.series?e.series:typeof e.multiples=="string"?e.multiples:null,A=j(t,e,s),G=A.length>0&&A[0].multi,D=o&&!G?[F,o]:[F];for(const[y,r]of D.entries()){const k=g(t,r,y===0?"x":"series");if(k)return p(k)}for(const y of A){if(!y.col)return p("a measure names no column to reduce");const r=g(t,y.col,"measure");if(r)return p(r);const k=B[y.stat];if(!k||!k.pushable)return p(`"${y.fn}" of "${y.col}" is not a reduction the engine can compute`)}if(e.size){const y=typeof e.size=="string"?g(t,e.size,"measure"):"the size channel is not a column";if(y)return p(y)}const V=[...A.map(y=>({id:y.id,col:y.col,fn:y.stat})),{id:R,col:F,fn:"count"},...e.size?[{id:x,col:e.size,fn:"sum"}]:[]],de=ue(V,ee.aggregates);if(de.client.length){const y=de.client[0];return p(`the source computes "${y.fn}" client-side (${y.reason}); set the pushdown source's \`aggregates: { default: 'engine' }\` to compute it in the engine`)}const $=U(t,M);if("reason"in $)return p($.reason);const{quick:_}=$,oe={...$.request,groupBy:D};if(d==="auto"){const{loaded:y,total:r}=m(t);if(Number.isFinite(r)&&y>=r)return p("the grid holds every matching row")}const a=JSON.stringify([u(ee),oe.filters,_,D,V]);return{mode:"engine",asked:d,key:a,source:ee,request:oe,requested:V,groupBy:D,measures:A}}function K(t){return v(t)}function pe(t,e){if(e==null)return"";if(t&&typeof t.formatValue=="function")try{const s=t.formatValue(e,null);if(typeof s=="string"&&s)return s}catch{}return e instanceof Date?e.toISOString().slice(0,10):String(e)}function ne(t,e){if(t==null)return e==null?0:1;if(e==null)return-1;const s=t instanceof Date?t.getTime():N(t),d=e instanceof Date?e.getTime():N(e);return typeof t!="string"&&typeof e!="string"&&s!==null&&d!==null?s-d:String(t).localeCompare(String(e))}function C(t,e,s,d){const{groupBy:p,measures:M}=s,ee=p[0],H=p[1]||null,F=M[0].multi,o=t.columns.get(ee),A=H?t.columns.get(H):void 0,G=(d||[]).filter(Y=>Y&&Y.level===p.length),D=new Map,V=new Map,de=new Map;for(const Y of G){const se=Y.keys[0],le=ce(se);D.has(le)||D.set(le,se);const ye=H?Y.keys[1]:null,be=H?ce(ye):"";V.has(be)||V.set(be,ye),de.set(`${be}\0${le}`,Y.values||{})}const $=t.sort&&typeof t.sort.get=="function"?t.sort.get():[],_=Array.isArray($)&&$[0]&&$[0].col===ee&&$[0].dir==="desc",oe=[...D.entries()].sort((Y,se)=>ne(Y[1],se[1]));_&&oe.reverse();const a=typeof e.limit=="number"&&e.limit>0?oe.slice(0,e.limit):oe,y=a.map(([,Y])=>pe(o,Y)),r=a.map(([,Y])=>Y),k=(Y,se,le,ye,be)=>{const Ae=de.get(`${Y}\0${se}`),Ne=Ae?N(Ae[R]):null;return{x:le,xKey:se,label:ye,y:Ae?N(Ae[be]):null,size:Ae&&e.size?N(Ae[x]):null,rows:Ne===null?0:Ne,rowKey:null,values:null}};let l;F?l=M.map((Y,se)=>({key:Y.col,label:Y.label,index:se,mark:Y.mark,axis:Y.axis,points:a.map(([le,ye],be)=>k("",le,ye,y[be],Y.id))})):l=[...V.entries()].sort((se,le)=>ne(se[1],le[1])).map(([se,le],ye)=>({key:se,label:H?pe(A,le):M[0].label,index:ye,points:a.map(([be,Ae],Ne)=>k(se,be,Ae,y[Ne],M[0].id))}));const I=G.reduce((Y,se)=>Y+(N(se.values&&se.values[R])||0),0),E=ae(o,r,{forced:xe(e),id:ee});return{series:l,categories:r,labels:y,kind:E,measure:F?{col:null,fn:"sum",title:l.map(Y=>Y.label).join(", ")}:{col:M[0].col,fn:M[0].fn,title:M[0].label},dimension:{col:ee,title:o&&o.title||ee},empty:l.length===0||a.length===0,rows:I,truncated:oe.length-a.length,bucketed:null}}function q(t,e,s=[],d=""){return t.map(p=>{const M=s.find(ee=>ee.id===p.id);return{col:p.col||null,fn:p.fn,computed:e,...M&&M.class?{class:M.class}:{},...e==="client"&&d?{reason:d}:{}}})}function z(t,e,s){try{return j(t,e,s).filter(d=>d.col)}catch{return[]}}}),it("packages/core/src/compute/handle.js",function(n,re){"use strict";Object.defineProperty(n,"identity",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"rowCount",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"bitReader",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"presenceReader",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"dictSize",{enumerable:!0,get:function(){return f}}),Object.defineProperty(n,"dictValue",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"multiValue",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"valueReader",{enumerable:!0,get:function(){return W}}),Object.defineProperty(n,"numericTotalOrder",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"valueComparator",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"dictRanks",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"isMissing",{enumerable:!0,get:function(){return u}});const Se=re("packages/core/src/internal/util.js"),ce=Se.collator,N=Se.defaultCompare,ve=Se.warnOnce;function xe(b){const O=new Uint32Array(b);for(let Q=0;Q<b;Q++)O[Q]=Q;return O}function ie(b,O){if(O&&typeof O.count=="number")return O.count;if(!b)return 0;if(typeof b.count=="number")return b.count;if(typeof b.length=="number")return b.length;const Q=b.values;return b.kind==="multi"&&b.offsets?Math.max(0,b.offsets.length-1):Q?b.kind==="bitset"?typeof Q.size=="number"?Q.size:b.presence&&typeof b.presence.size=="number"?b.presence.size:(ve(`count:${b.id}`,`column "${b.id}" is bitset-backed with no declared row count; assuming ${Q.length*8}`),Q.length*8):Q.length:b.presence&&typeof b.presence.size=="number"?b.presence.size:0}const ae=new WeakMap;function J(b){const O=b.constructor;if(!O)return"unknown";const Q=ae.get(O);if(Q)return Q;let w="unknown";try{let R=null;typeof O.from=="function"?R=O.from([!1,!0]):(R=new O(8),R.set(1));const i=R&&R.words;i&&i.length&&(i[0]===2?w="lsb":i[0]===64&&(w="msb"))}catch{w="unknown"}return ae.set(O,w),w}function ue(b){if(!b)return()=>0;const O=b instanceof Uint8Array?b:b.words;if(O instanceof Uint8Array){const Q=b instanceof Uint8Array?"lsb":J(b);if(Q==="lsb")return w=>O[w>>>3]>>>(w&7)&1;if(Q==="msb")return w=>O[w>>>3]>>>7-(w&7)&1}return typeof b.get=="function"?Q=>b.get(Q)?1:0:()=>0}function B(b){return!b||!b.presence?null:ue(b.presence)}function f(b){return b?typeof b.size=="number"?b.size:typeof b.values=="function"?b.values().length:0:0}function L(b,O){return b?typeof b.valueOf=="function"?b.valueOf(O):typeof b.values=="function"?b.values()[O]:null:null}function P(b,O){const Q=b.offsets,w=b.values;if(!Q||!w)return[];const R=Q[O],i=Q[O+1];if(!(i>R))return[];const x=b.dict,T=new Array(i-R);for(let h=R;h<i;h++)T[h-R]=x?L(x,w[h]):w[h];return T}function W(b){if(!b)return()=>{};const O=b.values,Q=B(b),w=b.kind;if(w==="dictionary"){const R=b.dict;return Q?i=>Q(i)?L(R,O[i]):null:i=>L(R,O[i])}if(w==="bitset"){const R=ue(O);return Q?i=>Q(i)?R(i)===1:null:i=>R(i)===1}if(w==="multi")return Q?R=>Q(R)?P(b,R):null:R=>P(b,R);if(!O&&typeof b.get=="function"){const R=b.get.bind(b);return i=>{const x=R(i);return x===void 0?null:x}}return Q?R=>{if(!Q(R))return null;const i=O[R];return i===void 0?null:i}:R=>{const i=O[R];return i===void 0?null:i}}function U(b,O){if(b<O)return-1;if(b>O)return 1;if(b===O){const R=Object.is(b,-0),i=Object.is(O,-0);return R===i?0:R?-1:1}const Q=Number.isNaN(b),w=Number.isNaN(O);return Q&&w?0:Q?1:-1}function v(b){const O=ce(b);return(Q,w)=>{if(Q===w)return 0;const R=typeof Q,i=typeof w;if(R==="string"&&i==="string")return O.compare(Q,w);if(R==="number"&&i==="number")return U(Q,w);if(R==="boolean"&&i==="boolean")return Q===w?0:Q?1:-1;if(Q instanceof Date||w instanceof Date){const x=Q instanceof Date?Q.getTime():Number(Q),T=w instanceof Date?w.getTime():Number(w);return U(x,T)}return N(Q,w)}}function m(b,O){if(b&&typeof b.ranks=="function")return b.ranks(O);const Q=b&&typeof b.values=="function"?b.values():[],w=Q.length,R=v(O),i=new Array(w);for(let T=0;T<w;T++)i[T]=T;i.sort((T,h)=>R(Q[T],Q[h])||T-h);const x=new Uint32Array(w);for(let T=0;T<w;T++)x[i[T]]=T;return x}function u(b){return b==null||typeof b=="number"&&Number.isNaN(b)}}),it("packages/core/src/compute/filter.js",function(n,re){"use strict";Object.defineProperty(n,"releaseMask",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"compilePredicate",{enumerable:!0,get:function(){return j}}),Object.defineProperty(n,"wallMs",{enumerable:!0,get:function(){return C}}),Object.defineProperty(n,"testValue",{enumerable:!0,get:function(){return t}}),Object.defineProperty(n,"itemwisePredicate",{enumerable:!0,get:function(){return d}}),Object.defineProperty(n,"evaluateCondition",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"evaluateFilters",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"pruneColumn",{enumerable:!0,get:function(){return D}}),Object.defineProperty(n,"mentionsColumn",{enumerable:!0,get:function(){return V}}),Object.defineProperty(n,"compact",{enumerable:!0,get:function(){return de}}),Object.defineProperty(n,"declareOperators",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"declaredOperator",{enumerable:!0,get:function(){return oe}});const Se=re("packages/core/src/internal/util.js"),ce=Se.isBlank,N=Se.toArray,ve=Se.warnOnce,xe=re("packages/core/src/format/date.js"),ie=xe.toDate,ae=xe.toIsoDate,J=re("packages/core/src/compute/handle.js"),ue=J.bitReader,B=J.dictSize,f=J.dictValue,L=J.presenceReader,P=J.valueComparator,W=J.valueReader,U=/^\d{4}-\d{2}-\d{2}$/,v="\0null\0";function m(a,y){const r=a&&a.pool;if(r){const k=r.mask||r.acquireMask||r.acquire||r.take;if(typeof k=="function"){const l=k.call(r,y);if(l&&l.length>=y)return l}}return new Uint8Array(y)}function u(a,y){const r=a&&a.pool;if(!r||!y)return;const k=r.release||r.releaseMask||r.free||r.recycle;typeof k=="function"&&k.call(r,y)}function b(a,y,r){return a.fill(r,0,y),a}function O(a){return a==null||typeof a=="number"&&Number.isNaN(a)}function Q(a,y){if(a==null)return a;if(y==="number")return typeof a=="number"?a:Number(a);if(y==="date"||y==="dateString"){const r=ae(a);return r===null?w(a):r}return y==="boolean"?typeof a=="boolean"?a:a==="true"||a===1?!0:a==="false"||a===0?!1:!!a:a}function w(a){return a instanceof Date?a.getTime():typeof a=="number"?a:Date.parse(String(a))}function R(a){return typeof a=="number"?a:a instanceof Date?a.getTime():a==null||a===""?NaN:Number(a)}function i(a,y){const r=typeof a=="string"?a:String(a);return y?r:r.toLowerCase()}function x(a,y){return a==null?v:typeof a=="string"?y?a:a.toLowerCase():a instanceof Date?a.getTime():a}function T(a,y,r){const k=new Set;for(const l of N(a)){const I=Q(l,r);k.add(x(I,y)),typeof I=="string"&&I!==""&&Number.isFinite(Number(I))?k.add(Number(I)):typeof I=="number"&&Number.isFinite(I)&&k.add(x(String(I),y))}return k}function h(a,y,r){if(a==null||y===null||y===void 0)return a==null&&y==null;const k=typeof a,l=typeof y;return k==="string"&&l==="string"?r?a===y:a.toLowerCase()===y.toLowerCase():a instanceof Date||y instanceof Date?w(a)===w(y):k==="number"&&l==="number"?a===y||Number.isNaN(a)&&Number.isNaN(y):k==="number"&&l==="string"?a===Number(y):k==="string"&&l==="number"?Number(a)===y:k==="boolean"||l==="boolean"?a===y:Array.isArray(a)&&Array.isArray(y)?a.length===y.length&&a.every((I,E)=>h(I,y[E],r)):a===y}function g(a,y){try{if(a instanceof RegExp){const r=a.flags.replace(/[gy]/g,"");return new RegExp(a.source,y||r.includes("i")?r:`${r}i`)}return new RegExp(String(a),y?"":"i")}catch(r){return ve(`regex:${String(a)}`,`filter operator "matches" received an invalid pattern: ${String(a)}`,r),null}}function j(a,y){if(a&&a.type==="datetime"&&X.has(a.op))return q(a,y);const r=z(a,y),k=a&&a.type;return k!=="date"&&k!=="dateString"?r:l=>r(typeof l=="string"&&U.test(l)?l:ae(l)??l)}const X=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn"]),K=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3})\d*)?)?)?$/,pe=new Map;function ne(a,y){let r=pe.get(y);if(r===void 0){try{r=new Intl.DateTimeFormat("en-CA",{timeZone:y,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{r=null}pe.set(y,r)}if(!r)return null;const k={};for(const l of r.formatToParts(a))l.type!=="literal"&&(k[l.type]=l.value);return k}function C(a,y){if(a==null||a==="")return null;if(typeof a=="string"){const I=K.exec(a.trim());if(I)return Date.UTC(+I[1],+I[2]-1,+I[3],+(I[4]||0),+(I[5]||0),+(I[6]||0),+(I[7]||"0").padEnd(3,"0"))}const r=ie(a);if(!r)return null;const k=r.getUTCMilliseconds(),l=y?ne(r,y):null;return l?Date.UTC(+l.year,+l.month-1,+l.day,l.hour==="24"?0:+l.hour,+l.minute,+l.second,k):Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),k)}function q(a,y){const r=typeof a.timeZone=="string"&&a.timeZone?a.timeZone:void 0,k=E=>C(E,r),l=Array.isArray(a.value)?a.value.map(k):k(a.value),I=z({...a,type:"number",value:l},y);return E=>I(C(E))}function z(a,y){const r=a&&a.op,k=!!(a&&a.caseSensitive),l=a&&a.type,I=P(y),E=Y=>se=>!Y(se);switch(r){case"eq":{const Y=Q(a.value,l);return se=>h(se,Y,k)}case"ne":{const Y=Q(a.value,l);return se=>!h(se,Y,k)}case"lt":case"lte":case"gt":case"gte":{const Y=Q(a.value,l);if(O(Y))return()=>!1;const se=r==="lt"?-1:r==="lte"?0:r==="gt"?1:2;return le=>{if(O(le))return!1;const ye=I(le,Y);return se===-1?ye<0:se===0?ye<=0:se===1?ye>0:ye>=0}}case"between":case"notBetween":{const Y=N(a.value),se=Q(Y[0],l),le=Q(Y[1],l),ye=a.bounds||"[]",be=ye.charAt(0)!=="(",Ae=ye.charAt(1)!==")";if(O(se)||O(le))return r==="between"?()=>!1:()=>!0;const Ne=te=>{if(O(te))return!1;const Me=I(te,se),ke=I(te,le);return(be?Me>=0:Me>0)&&(Ae?ke<=0:ke<0)};return r==="between"?Ne:E(Ne)}case"in":case"notIn":{const Y=T(a.value,k,l),se=le=>Y.has(x(le,k));return r==="in"?se:E(se)}case"contains":case"notContains":{const Y=i(Q(a.value,l),k),se=le=>le==null?!1:i(le,k).includes(Y);return r==="contains"?se:E(se)}case"startsWith":{const Y=i(Q(a.value,l),k);return se=>se==null?!1:i(se,k).startsWith(Y)}case"endsWith":{const Y=i(Q(a.value,l),k);return se=>se==null?!1:i(se,k).endsWith(Y)}case"matches":{const Y=g(a.value,k);return Y?se=>se==null?!1:Y.test(String(se)):()=>!1}case"blank":return Y=>ce(Y)||Array.isArray(Y)&&Y.length===0;case"notBlank":return Y=>!(ce(Y)||Array.isArray(Y)&&Y.length===0);case"containsAny":case"containsNone":{const Y=T(a.value,k,l),se=le=>{const ye=le==null?[]:N(le);for(let be=0;be<ye.length;be++)if(Y.has(x(ye[be],k)))return!0;return!1};return r==="containsAny"?se:E(se)}case"containsAll":{const Y=N(a.value).map(se=>x(Q(se,l),k));return se=>{const le=se==null?[]:N(se);if(Y.length===0)return!0;const ye=new Set(le.map(be=>x(be,k)));for(let be=0;be<Y.length;be++)if(!ye.has(Y[be]))return!1;return!0}}default:{const Y=oe(r);return Y?Y.compile(a.value):(ve(`op:${String(r)}`,`unknown filter operator "${String(r)}"; the condition is refused rather than matching every row`),()=>!1)}}}function t(a,y,r){return j(y,r)(a)}const e=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),s=new Set(["containsAny","containsAll","containsNone"]);function d(a,y,r){const k=a&&a.op,l=e[k]||k,I=j({...a,op:l,type:y.type},r),E=y.items,Y=se=>{const le=E(se);if(!le)return!1;for(let ye=0;ye<le.length;ye++)if(I(le[ye]))return!0;return!1};return e[k]?se=>!Y(se):Y}function p(a,y,r,k){const l=L(a);if(l){const Y=y?1:0;for(let se=0;se<k;se++)r[se]=l(se)===Y?1:0;return r}const I=a.kind;if(I==="float64"||I==="int32"||I==="bitset")return b(r,k,y?1:0);const E=W(a);for(let Y=0;Y<k;Y++){const se=E(Y),le=ce(se)||Array.isArray(se)&&se.length===0;r[Y]=le===y?0:1}return r}function M(a,y,r,k){const l=a.dict,I=B(l),E=new Uint8Array(I);for(let ye=0;ye<I;ye++)E[ye]=y(f(l,ye))?1:0;const Y=a.values,se=L(a);if(!se){for(let ye=0;ye<k;ye++)r[ye]=E[Y[ye]];return r}const le=y(null)?1:0;for(let ye=0;ye<k;ye++)r[ye]=se(ye)===1?E[Y[ye]]:le;return r}function ee(a,y,r,k){const l=ue(a.values),I=y(!0)?1:0,E=y(!1)?1:0,Y=L(a);if(!Y){for(let le=0;le<k;le++)r[le]=l(le)===1?I:E;return r}const se=y(null)?1:0;for(let le=0;le<k;le++)r[le]=Y(le)===0?se:l(le)===1?I:E;return r}function H(a,y,r,k,l){const I=a.values,E=y.type,Y=y.op;let se=!0;switch(Y){case"eq":case"ne":{const ye=R(Q(y.value,E)),be=typeof y.value=="number"&&Number.isNaN(y.value),Ae=Y==="ne"?1:0;if(be)for(let Ne=0;Ne<l;Ne++)k[Ne]=(Number.isNaN(I[Ne])?1:0)^Ae;else for(let Ne=0;Ne<l;Ne++)k[Ne]=(I[Ne]===ye?1:0)^Ae;break}case"lt":{const ye=R(Q(y.value,E));for(let be=0;be<l;be++)k[be]=I[be]<ye?1:0;break}case"lte":{const ye=R(Q(y.value,E));for(let be=0;be<l;be++)k[be]=I[be]<=ye?1:0;break}case"gt":{const ye=R(Q(y.value,E));for(let be=0;be<l;be++)k[be]=I[be]>ye?1:0;break}case"gte":{const ye=R(Q(y.value,E));for(let be=0;be<l;be++)k[be]=I[be]>=ye?1:0;break}case"between":case"notBetween":{const ye=N(y.value),be=R(Q(ye[0],E)),Ae=R(Q(ye[1],E)),Ne=y.bounds||"[]",te=Ne.charAt(0)!=="(",Me=Ne.charAt(1)!==")",ke=Y==="notBetween"?1:0;if(te&&Me)for(let we=0;we<l;we++)k[we]=(I[we]>=be&I[we]<=Ae?1:0)^ke;else if(te)for(let we=0;we<l;we++)k[we]=(I[we]>=be&I[we]<Ae?1:0)^ke;else if(Me)for(let we=0;we<l;we++)k[we]=(I[we]>be&I[we]<=Ae?1:0)^ke;else for(let we=0;we<l;we++)k[we]=(I[we]>be&I[we]<Ae?1:0)^ke;break}case"in":case"notIn":{const ye=new Set;for(const Ae of N(y.value)){const Ne=R(Q(Ae,E));Number.isNaN(Ne)||ye.add(Ne)}const be=Y==="notIn"?1:0;for(let Ae=0;Ae<l;Ae++)k[Ae]=(ye.has(I[Ae])?1:0)^be;break}default:se=!1;break}if(!se)return!1;const le=L(a);if(le){const ye=r(null)?1:0;for(let be=0;be<l;be++)le(be)===0&&(k[be]=ye)}return!0}function F(a,y,r,k){const l=W(a);for(let I=0;I<k;I++)r[I]=y(l(I))?1:0;return r}function o(a,y,r){const k=y.count|0,l=r||m(y,k);if(!a)return b(l,k,1);const I=typeof y.handle=="function"?y.handle(a.col):void 0,E=typeof y.custom=="function"?y.custom:null;if(!I){if(E){for(let ye=0;ye<k;ye++)l[ye]=E(a,ye)?1:0;return l}return ve(`filter:col:${String(a.col)}`,`filter references unknown column "${String(a.col)}"; the condition is refused rather than matching every row`),b(l,k,0)}const Y=a.op;if(Y==="blank"||Y==="notBlank")return p(I,Y==="notBlank",l,k);const se=typeof y.itemwise=="function"?y.itemwise(a.col):null;if(se&&!oe(Y)&&!s.has(Y))return F(I,d(a,se,y.locale),l,k);const le=j(a,y.locale);switch(I.kind){case"dictionary":return M(I,le,l,k);case"bitset":return ee(I,le,l,k);case"float64":case"int32":return H(I,a,le,l,k)?l:F(I,le,l,k);default:return F(I,le,l,k)}}function A(a,y,r){if(!a)return b(m(y,r),r,1);if(Array.isArray(a.conditions)){const k=a.conditions.filter(E=>E!=null),l=a.op==="or"?"or":a.op==="not"?"not":"and";if(k.length===0)return b(m(y,r),r,1);const I=A(k[0],y,r);for(let E=1;E<k.length;E++){const Y=A(k[E],y,r);if(l==="or")for(let se=0;se<r;se++)I[se]|=Y[se];else for(let se=0;se<r;se++)I[se]&=Y[se];u(y,Y)}if(l==="not")for(let E=0;E<r;E++)I[E]^=1;return I}return o(a,y,m(y,r))}function G(a,y){return A(a,y,y.count|0)}function D(a,y){if(!a||!y)return a||null;const r=a;if(Array.isArray(r.conditions)){if((r.op==="or"?"or":r.op==="not"?"not":"and")!=="and")return V(r,y)?null:a;const l=[];for(const I of r.conditions){const E=D(I,y);E&&l.push(E)}return l.length?{...r,op:"and",conditions:l}:null}return r.col===y?null:a}function V(a,y){if(!a||typeof a!="object")return!1;const r=a;if(r.col===y)return!0;if(Array.isArray(r.conditions)){for(const k of r.conditions)if(V(k,y))return!0}return!1}function de(a,y,r){if(r&&r.length>=y){let E=0;for(let Y=0;Y<y;Y++)a[Y]&&(r[E++]=Y);return r.subarray(0,E)}let k=0;for(let E=0;E<y;E++)k+=a[E]?1:0;const l=new Uint32Array(k);let I=0;for(let E=0;E<y;E++)a[E]&&(l[I++]=E);return l}const $=new Map;function _(a){if(!(!a||typeof a!="object"))for(const[y,r]of Object.entries(a))r&&typeof r.compile=="function"&&$.set(y,r)}function oe(a){return typeof a=="string"?$.get(a):void 0}}),it("packages/modules/charts/viewport-filter.js",function(n,re){"use strict";Object.defineProperty(n,"VIEWPORT_FILTER_DEBOUNCE_MS",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"resolveViewportFilter",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"viewportTarget",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"viewportBbox",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"sameBbox",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"findColumnCondition",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"viewportCondition",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"conditionBbox",{enumerable:!0,get:function(){return f}}),Object.defineProperty(n,"pruneTarget",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"mergeViewportCondition",{enumerable:!0,get:function(){return W}}),Object.defineProperty(n,"adoptedGeoView",{enumerable:!0,get:function(){return U}});const ce=re("packages/core/src/compute/filter.js").pruneColumn,N=150,ve=1e-6;function xe(v){const m={enabled:!1,column:null,debounce:N};if(v==null||v===!1)return m;const u=v===!0?{}:v;if(typeof u!="object")return m;const b=typeof u.column=="string"&&u.column?u.column:null,O=Number.isFinite(u.debounce)&&u.debounce>=0?Number(u.debounce):N;return{enabled:!0,column:b,debounce:O}}function ie(v,m){return typeof m=="string"&&m?{kind:"geometry",column:m}:v&&typeof v.geometry=="string"&&v.geometry?{kind:"geometry",column:v.geometry}:v&&typeof v.lon=="string"&&v.lon&&typeof v.lat=="string"&&v.lat?{kind:"lonlat",lon:v.lon,lat:v.lat}:null}function ae(v,m){if(!v||!m||typeof v.xScale?.invert!="function"||typeof v.yScale?.invert!="function")return null;const u=v.xScale.invert(m.left),b=v.xScale.invert(m.right),O=v.yScale.invert(m.bottom),Q=v.yScale.invert(m.top);if(![u,b,O,Q].every(Number.isFinite))return null;const w=Math.max(-180,Math.min(u,b)),R=Math.min(180,Math.max(u,b)),i=Math.max(-90,Math.min(O,Q)),x=Math.min(90,Math.max(O,Q));return!(R>w)||!(x>i)?null:[w,i,R,x]}function J(v,m){return!v||!m?!v&&!m:Math.abs(v[0]-m[0])<=ve&&Math.abs(v[1]-m[1])<=ve&&Math.abs(v[2]-m[2])<=ve&&Math.abs(v[3]-m[3])<=ve}function ue(v,m){if(!v)return null;if(Array.isArray(v.conditions)){for(const u of v.conditions){const b=ue(u,m);if(b)return b}return null}return v.col===m?v:null}function B(v,m,u){const[b,O,Q,w]=m,R=u?{meta:{label:u}}:{};return v.kind==="geometry"?{col:v.column,op:"withinBbox",value:[b,O,Q,w],...R}:{op:"and",conditions:[{col:v.lon,op:"between",value:[b,Q]},{col:v.lat,op:"between",value:[O,w]}],...R}}function f(v,m){if(!v||!m)return null;if(m.kind==="geometry"){const i=ue(v,m.column);if(!i||i.op!=="withinBbox"||!Array.isArray(i.value)||i.value.length<4)return null;const x=i.value.map(Number);return x.every(Number.isFinite)?x:null}const u=ue(v,m.lon),b=ue(v,m.lat);if(!u||u.op!=="between"||!Array.isArray(u.value)||u.value.length<2||!b||b.op!=="between"||!Array.isArray(b.value)||b.value.length<2)return null;const[O,Q]=u.value.map(Number),[w,R]=b.value.map(Number);return[O,w,Q,R].every(Number.isFinite)?[O,w,Q,R]:null}function L(v){return v.kind==="geometry"?[v.column]:[v.lon,v.lat]}function P(v,m){let u=v||null;for(const b of L(m))u=ce(u,b);return u}function W(v,m,u){const b=P(v,m);return b?{op:"and",conditions:[...b.conditions||[b],u]}:u}function U(v,m,u,b){if(!v||!m||!u||!b||!(b.scale>0))return null;const[O,Q,w,R]=v,[i,x,T,h]=m,g=w-O,j=R-Q,X=T-i,K=h-x;if(!(g>0)||!(j>0)||!(X>0)||!(K>0))return null;const pe=(i+T)/2,ne=(x+h)/2,C=u.left+(pe-O)/g*(u.right-u.left),q=u.bottom-(ne-Q)/j*(u.bottom-u.top);if(!Number.isFinite(C)||!Number.isFinite(q))return null;const z=(u.left+u.right)/2,t=(u.top+u.bottom)/2,e=z-C,s=t-q,[d,p]=b.offset,M=[d-e/b.scale,p+s/b.scale],ee=Math.min(g/X,j/K);return!Number.isFinite(ee)||ee<=0?null:{zoom:Math.min(8,Math.max(1,b.zoom*ee)),offset:M}}}),it("packages/modules/charts/mapview.js",function(n,re){"use strict";Object.defineProperty(n,"MAP_ENGINE_TYPES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"DEFAULT_VIEWPORT_CAP",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"DENSITY_CELLS_ACROSS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(n,"DENSITY_FIT_PASSES",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"FRAME_REFIT_RATIO",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"viewportCap",{enumerable:!0,get:function(){return x}}),Object.defineProperty(n,"densityCellSize",{enumerable:!0,get:function(){return T}}),Object.defineProperty(n,"boxSpan",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"ringsBox",{enumerable:!0,get:function(){return g}}),Object.defineProperty(n,"needsRefit",{enumerable:!0,get:function(){return j}}),Object.defineProperty(n,"frameMoved",{enumerable:!0,get:function(){return X}}),Object.defineProperty(n,"planMapViewport",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(n,"engineRowsReader",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(n,"frameOf",{enumerable:!0,get:function(){return C}}),Object.defineProperty(n,"capClientBound",{enumerable:!0,get:function(){return z}});const ce=re("packages/core/src/source/pushdown.js").planQuery,ve=re("packages/core/src/source/aggregates.js").resolveAggregatePlan,ie=re("packages/core/src/internal/util.js").warnOnce,ae=re("packages/modules/shared/engine.js"),J=ae.engineSource,ue=ae.gridEngineRequest,B=ae.loadedAndMatching,f=ae.sourceId,P=re("packages/modules/charts/engine.js").aggregateMode,W=re("packages/modules/charts/viewport-filter.js"),U=W.conditionBbox,v=W.viewportCondition,m=W.viewportTarget,u=Object.freeze(new Set(["markermap","bubblemap","choropleth"])),b=2e4,O=24,Q=8,w=2,R="__viewport_rows",i=/^[A-Za-z_][A-Za-z0-9_$]*$/;function x(t){const e=t?t.viewportCap:void 0;return e==null?b:typeof e=="number"&&Number.isInteger(e)&&e>0?e:(ie(`chart:viewportCap:${String(e)}`,`chart viewportCap ${JSON.stringify(e)} is not a positive whole number of rows; the map used ${b}.`),b)}function T(t){const e=Number.isFinite(t)&&t>0?Math.min(360,t):360,s=2**Math.floor(Math.log2(e/O));return Math.min(90,Math.max(2**-20,s))}function h(t){return Math.max(t[2]-t[0],t[3]-t[1])}function g(t){let e=1/0,s=1/0,d=-1/0,p=-1/0;for(const M of t||[])for(const[ee,H]of M)!Number.isFinite(ee)||!Number.isFinite(H)||(e=Math.min(e,ee),d=Math.max(d,ee),s=Math.min(s,H),p=Math.max(p,H));return d>=e&&p>=s?[e,s,d,p]:null}function j(t,e){if(!t||!e)return!1;for(const[s,d]of[[0,2],[1,3]]){const p=t[d]-t[s],M=e[d]-e[s];if(!(p>0)||!(M>0))continue;const ee=p/M;if(ee>w||ee<1/w)return!0}return!1}function X(t,e){if(!t||!e)return!!e;const s=1e-9;return!(e[0]>=t[0]-s&&e[1]>=t[1]-s&&e[2]<=t[2]+s&&e[3]<=t[3]+s)||j(t,e)}function K(t,e,s){const d=t.columns.get(e);if(!d)return`the ${s} column "${e}" is not a column of the grid`;const p=d.value&&typeof d.value=="object"?d.value:null;return d.computed||p&&(typeof p.get=="function"||typeof p.compute=="function")?`the ${s} column "${e}" is computed by the grid, which the engine cannot reproduce`:(typeof d.field=="string"?d.field:e)!==e||!i.test(e)?`the ${s} column "${e}" is not a plain physical column the engine can name`:""}function pe(t,e,s,d){const p=P(e),M=be=>({mode:"client",asked:p,reason:be,refused:p==="engine"});if(p==="client")return{...M("aggregate: 'client' was asked for"),refused:!1};if(!u.has(s))return M(`a "${s}" chart does not draw a viewport`);if(e.rows)return M("the chart was handed its own rows");const ee=m(e);if(!ee)return M("the map names neither a geometry column nor lon/lat columns");if(ee.kind==="geometry"&&(e.lon||e.lat))return M("the map names both a geometry column and lon/lat columns");const H=ee.kind==="geometry"?[ee.column]:[ee.lon,ee.lat];for(const be of H){const Ae=K(t,be,"placement");if(Ae)return M(Ae)}const F=J(t);if("reason"in F)return M(F.reason);const{source:o,caps:A}=F,G=o.adapter;if(!G||typeof G.execute!="function")return M("the source's adapter has no execute() to fetch rows with");const D=H[0],V=ve([{id:R,col:D,fn:"count"}],o.aggregates);if(V.client.length)return M(`the source computes "count" client-side (${V.client[0].reason}); set the pushdown source's \`aggregates: { default: 'engine' }\` to count in the engine`);const de=Array.isArray(d&&d.bbox)?d.bbox:null,$=de?v(ee,de):null,_=ue(t,F,$);if("reason"in _)return M(_.reason);if(p==="auto"){const{loaded:be,total:Ae}=B(t);if(Number.isFinite(Ae)&&be>=Ae)return M("the grid holds every matching row")}const oe=x(e),a=de||U(t.filters&&typeof t.filters.get=="function"?t.filters.get():null,ee),y=a?T(h(a)):null,r=ee.kind==="geometry"&&s!=="choropleth"&&Array.isArray(A.buckets)&&A.buckets.includes("grid")&&typeof G.executeGroupedAggregates=="function",k=s==="choropleth"?"a choropleth draws each shape, and has no density form":ee.kind!=="geometry"?"the engine bins a geometry column, and this map places its rows by lon/lat":"the source's adapter cannot bin a geometry column into grid cells (no `buckets` capability)",{request:l,quick:I}=_,E=ue(t,F),Y=JSON.stringify([f(o),"request"in E?E.request.filters:null,I]),se=JSON.stringify([f(o),l.filters,I,ee,oe,s]),le=JSON.stringify([se,r?y||"fit":0]);return{mode:"engine",asked:p,key:le,rowsKey:se,baseKey:Y,cap:oe,bbox:de,box:a,cellSize:y,run:async be=>{const Ae=be?{signal:be}:{},Ne=await o.aggregate({...l,...Ae},[{id:R,col:D,fn:"count"}]);if(Ne&&Array.isArray(Ne.client)&&Ne.client.length)return{map:!0,refused:`the source counted client-side (${Ne.client[0].reason})`};const te=Number(Ne&&Ne.values?Ne.values[R]:NaN);if(!Number.isFinite(te))return{map:!0,refused:"the engine did not report a count for the view"};if(te<=oe){const we={...l,range:{start:0,end:oe}},je=ce(we,A).pushed,Pe=await G.execute({...je,...Ae},{...we,...Ae});return{map:!0,kind:"rows",rows:(Pe&&Array.isArray(Pe.rows)?Pe.rows:[]).slice(0,oe),count:te,cap:oe,bbox:de,rowsKey:se}}if(!r)return{map:!0,kind:"over",count:te,cap:oe,bbox:de,reason:k};let Me=y||T(360),ke=[];for(let we=1;;we++){const je=await o.aggregate({...l,groupBy:[{col:ee.column,bucket:"grid",size:Me}],...Ae},[{id:R,col:D,fn:"count"}]);if(je&&Array.isArray(je.client)&&je.client.length)return{map:!0,kind:"over",count:te,cap:oe,bbox:de,reason:`the source binned client-side (${je.client[0].reason})`};ke=[];for(const $e of je&&je.groups||[]){if(!$e||$e.level!==1||!Array.isArray($e.keys)||!Array.isArray($e.keys[0]))continue;const[Le,_e]=$e.keys[0].map(Number),ot=Number($e.values?$e.values[R]:NaN);!Number.isFinite(Le)||!Number.isFinite(_e)||!(ot>0)||ke.push({west:Le*Me,south:_e*Me,east:(Le+1)*Me,north:(_e+1)*Me,count:ot})}if(y||we>=Q)break;const Pe=g(C([],ke));if(!Pe)break;const Ce=T(h(Pe));if(Ce>=Me)break;Me=Ce}return{map:!0,kind:"density",cells:ke,count:te,cap:oe,bbox:de,size:Me}}}}function ne(t,e){const s=typeof t.config=="function"?t.config():{},d=s&&typeof s.rowKey=="string"?s.rowKey:null,p=t.permissions&&typeof t.permissions.levelOf=="function"?t.permissions:null,M=new Map,ee=e.map((o,A)=>{const G=d&&o&&o[d]!==void 0&&o[d]!==null?o[d]:`engine:${A}`,D=M.has(G)?`engine:${A}`:G,V={key:D,data:o,group:!1};return M.set(D,V),V}),H=o=>{if(!p)return!0;const A=p.levelOf(o);return A==="read"||A==="write"},F=(o,A)=>{const G=M.get(o);if(!G||!H(A))return;const D=t.columns.get(A),V=D&&typeof D.field=="string"?D.field:A,de=G.data?G.data[V]:void 0,$=D&&D.dataType;if($&&typeof $.toStorage=="function"&&de!==null&&de!==void 0)try{return $.toStorage(de,{colId:A})}catch{return null}return de};return{columns:t.columns,formatting:t.formatting,messages:t.messages,rows:{count:()=>ee.length,get:o=>ee[o],value:F,text:(o,A)=>{const G=F(o,A);if(G==null)return"";const D=t.columns.get(A);if(D&&typeof D.formatValue=="function")try{const V=D.formatValue(G,M.get(o));if(typeof V=="string")return V}catch{}return String(G)}}}}function C(t,e=[]){let s=1/0,d=1/0,p=-1/0,M=-1/0;for(const G of t||[])!Number.isFinite(G.lon)||!Number.isFinite(G.lat)||(s=Math.min(s,G.lon),p=Math.max(p,G.lon),d=Math.min(d,G.lat),M=Math.max(M,G.lat));for(const G of e||[])s=Math.min(s,G.west),p=Math.max(p,G.east),d=Math.min(d,G.south),M=Math.max(M,G.north);if(!(p>=s)||!(M>=d))return null;const ee=(G,D)=>Math.max(-D,Math.min(D,G)),H=ee(s,180),F=ee(p,180),o=ee(d,90),A=ee(M,90);return[[[H,o],[F,o],[F,A],[H,A]]]}function q(t,e){if(!e)return!0;const[s,d,p,M]=e,ee=(H,F)=>H>=s&&H<=p&&F>=d&&F<=M;if(t.point)return ee(t.point[0],t.point[1]);for(const H of t.polygons||[])for(const F of H)for(const[o,A]of F)if(ee(o,A))return!0;return!1}function z(t,e,s,d){const p=x(s),M=d&&Array.isArray(d.bbox)?d.bbox:null;if(!e||!u.has(t))return{bound:e,viewport:null};if(t==="choropleth"){const _=e.features||[];if(_.length<=p)return{bound:e,viewport:null};let oe=0;for(const r of _)q(r,M)&&oe++;if(oe<=p)return{bound:e,viewport:null};const a=[];for(const r of _){r.point&&a.push({lon:r.point[0],lat:r.point[1]});for(const k of r.polygons||[])for(const l of k)for(const[I,E]of l)a.push({lon:I,lat:E})}const y="a choropleth draws each shape, and has no density form";return{bound:{...e,features:[],empty:!1,over:{count:oe,cap:p,reason:y},frame:e.frame||C(a)},viewport:{rows:0,matched:oe,cap:p,binned:!1,cells:0,over:y,bbox:M?[...M]:null,computed:"client"}}}const ee=e.points||[];if(ee.length<=p)return{bound:e,viewport:null};const[H,F,o,A]=M||[-1/0,-1/0,1/0,1/0],G=ee.filter(_=>_.lon>=H&&_.lon<=o&&_.lat>=F&&_.lat<=A);if(G.length<=p)return{bound:e,viewport:null};const D=M||g([G.map(_=>[_.lon,_.lat])]),V=T(D?h(D):360),de=new Map;for(const _ of G){const oe=Math.floor(_.lon/V),a=Math.floor(_.lat/V),y=`${oe}:${a}`,r=de.get(y)||{west:oe*V,south:a*V,east:(oe+1)*V,north:(a+1)*V,count:0};r.count++,de.set(y,r)}const $=[...de.values()];return{bound:{...e,density:{cells:$,size:V},frame:e.frame||C(ee)},viewport:{rows:0,matched:G.length,cap:p,binned:!0,cells:$.length,over:null,bbox:M?[...M]:null,computed:"client"}}}}),it("packages/modules/charts/rampscale.js",function(n,re){"use strict";Object.defineProperty(n,"AUTO_LOG_RATIO",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(n,"QUANTILE_CLASSES",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"chooseRampScale",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(n,"logTicks",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"quantileCuts",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"placeOnRamp",{enumerable:!0,get:function(){return J}});const Se=100,ce=5;function N(ue){const B=[];for(const f of ue||[])typeof f=="number"&&Number.isFinite(f)&&f>0&&B.push(f);return B}function ve(ue,B){const f=N(ue);let L=1/0,P=0;for(const U of f)U<L&&(L=U),U>P&&(P=U);const W=f.length?P/L:0;return B?{scale:B,auto:!1,ratio:W}:W>Se?{scale:"log",auto:!0,ratio:W}:{scale:"linear",auto:!1,ratio:W}}function xe(ue){return Number(ue.toPrecision(12))}function ie(ue,B){if(!(ue>0)||!(B>=ue)||!Number.isFinite(B))return[];const f=v=>v>=ue*(1-1e-9)&&v<=B*(1+1e-9),L=Math.floor(Math.log10(ue)+1e-9),P=Math.floor(Math.log10(B)+1e-9),W=[],U=Math.log10(B/ue);for(let v=L;v<=P;v++){const m=U>=2?[1]:[1,2,5];for(const u of m){const b=xe(u*10**v);f(b)&&W.push(b)}}return W}function ae(ue,B=ce){const f=[];for(const P of ue||[])typeof P=="number"&&Number.isFinite(P)&&f.push(P);if(!f.length)return[];f.sort((P,W)=>P-W);const L=[];for(let P=1;P<B;P++){const W=(f.length-1)*(P/B),U=Math.floor(W),v=Math.min(f.length-1,U+1);L.push(xe(f[U]+(W-U)*(f[v]-f[U])))}return L}function J(ue,B,f){if(ue==="log"){let P=N(f);P.length||(P=N([B.min,B.max]));let W=1/0,U=0;for(const b of P)b<W&&(W=b),b>U&&(U=b);P.length||(W=1,U=1);const v=Math.log10(W),m=Math.log10(U)-v||1,u=b=>typeof b!="number"||!Number.isFinite(b)||b<=0?0:Math.min(1,Math.max(0,(Math.log10(b)-v)/m));return{position:u,domain:{min:W,max:U},ticks:ie(W,U).map(b=>({value:b,t:u(b)})),classes:0}}if(ue==="quantile"){const P=ae(f),W=P.length+1;let U=1/0,v=-1/0;for(const u of f||[])typeof u!="number"||!Number.isFinite(u)||(u<U&&(U=u),u>v&&(v=u));return U>v&&(U=B.min,v=B.max),{position:u=>{if(typeof u!="number"||!Number.isFinite(u))return 0;let b=0;for(;b<P.length&&u>=P[b];)b++;return W>1?b/(W-1):0},domain:{min:U,max:v},ticks:P.map((u,b)=>({value:u,t:(b+1)/W})),classes:W}}const L=B.max-B.min||1;return{position:P=>(P-B.min)/L,domain:{min:B.min,max:B.max},ticks:[],classes:0}}}),it("packages/modules/charts/matrix.js",function(n,re){"use strict";Object.defineProperty(n,"colourRamp",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(n,"drawHeatmap",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"drawFunnel",{enumerable:!0,get:function(){return y}}),Object.defineProperty(n,"drawCandlestick",{enumerable:!0,get:function(){return r}}),Object.defineProperty(n,"VOLUME_PANE_HEIGHT",{enumerable:!0,get:function(){return k}}),Object.defineProperty(n,"splitPanes",{enumerable:!0,get:function(){return l}}),Object.defineProperty(n,"clearVolumePane",{enumerable:!0,get:function(){return E}}),Object.defineProperty(n,"drawCorrelogram",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"title",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(n,"cellAt",{enumerable:!0,get:function(){return Ne}});const ce=re("packages/modules/charts/frame.js").Pool,N=re("packages/modules/charts/axis.js"),ve=N.drawAxisLines,xe=N.drawBandLabels,ie=N.drawCategoryAxis,ae=N.drawContinuousAxis,J=N.drawMeasureAxis,ue=N.leftLabelRoom,B=N.overhangFor,f=N.setLabelText,L=N.setPlotClip,P=re("packages/modules/charts/cartesian.js"),W=P.continuousSlot,U=P.drawReferenceLines,v=P.slotPadFor,m=P.xScaleFor,u=re("packages/modules/charts/format.js"),b=u.formatters,O=u.measureText,Q=re("packages/modules/charts/scale.js"),w=Q.bandScale,R=Q.isNumber,i=Q.linearTicks,x=Q.measureDomain,T=Q.toNumber,h=Q.toTime,g=re("packages/modules/charts/svg.js"),j=g.attrs,X=g.path,K=g.round,pe=g.setText,ne=g.SVG_NS,q=re("packages/modules/charts/typography.js").applySize,t=re("packages/modules/charts/styles.js").NS,e=re("packages/modules/charts/scheme.js"),s=e.rampStops,d=e.resolveScheme,p=re("packages/modules/charts/rampscale.js"),M=p.chooseRampScale,ee=p.placeOnRamp,F=re("packages/core/src/internal/util.js").warnOnce,o=re("packages/modules/charts/labels.js"),A=o.drawAnchoredLabels,G=o.labelText,V=re("packages/modules/charts/annotations.js").drawAnnotations,de=Object.freeze([[236,243,249],[0,82,128]]),$=Object.freeze([[176,74,0],[247,247,247],[0,82,128]]);function _(te,Me,ke){const we=Math.min(1,Math.max(0,ke)),je=Pe=>Math.round(te[Pe]+(Me[Pe]-te[Pe])*we);return`rgb(${je(0)} ${je(1)} ${je(2)})`}function oe(te,Me,ke,we){const je=ke?s(ke,Me):Me?$:de,Pe=ke&&ke.rampScale?ke.rampScale:null;if(Me){Pe&&Pe!=="linear"&&F("chart:ramp:diverging-scale",`chart "ramp.scale" was "${Pe}" on a diverging ramp, which is always linear and centred on zero; the scale was not applied. Drop "diverging" to colour by a log or quantile scale.`);const Xe=Math.max(Math.abs(te.min),Math.abs(te.max))||1,We=He=>He>=0?_(je[1],je[2],He/Xe):_(je[1],je[0],-He/Xe),et=te.max-te.min||1;return Object.assign(We,{scale:"linear",auto:!1,ratio:0,position:He=>(He-te.min)/et,colourAt:He=>We(te.min+He*et),domain:{min:te.min,max:te.max},ticks:[],classes:0})}const Ce=M(we||[te.min,te.max],Pe),$e=ee(Ce.scale,te,we||[te.min,te.max]),Le=je[0],_e=je[je.length-1],ot=Xe=>_(Le,_e,Xe);return Object.assign(Xe=>ot($e.position(Xe)),{scale:Ce.scale,auto:Ce.auto,ratio:Ce.ratio,position:$e.position,colourAt:ot,domain:$e.domain,ticks:$e.ticks,classes:$e.classes})}function a(te){const Me=te.scheme||d(),{plot:ke,bound:we}=te;new ce(te.groups.grid).finish(),new ce(te.groups.axis).finish(),new ce(te.groups.rules).finish(),new ce(te.groups.labels).finish();const je=we.series.filter(qe=>!te.hidden.has(qe.key)),Pe=[];for(const qe of je)for(const Xe of qe.points)Pe.push(Xe.y);const Ce=x(Pe,{zero:!1,nice:!1}),$e=oe(Ce,!!te.diverging,Me,Pe),Le=w(we.categories,[ke.left,ke.right],.04),_e=w(je.map(qe=>qe.label),[ke.top,ke.bottom],.04),ot=new ce(te.groups.marks);for(const qe of je){const Xe=_e.of(qe.label);if(!Number.isNaN(Xe))for(let We=0;We<qe.points.length;We++){const et=qe.points[We],He=Le.of(et.x);if(Number.isNaN(He))continue;const pt=ot.next("rect",`${t}__cell ${t}__mark`);j(pt,{x:K(He),y:K(Xe),width:K(Le.bandwidth),height:K(_e.bandwidth),fill:R(et.y)?$e(et.y):"transparent","data-series":qe.index,"data-point":We}),et.px=K(He+Le.bandwidth/2),et.py=K(Xe+_e.bandwidth/2)}}if(ot.finish(),ie({group:te.groups.overlay,plot:ke,scale:Le,labels:we.labels,fontSize:te.fontSize,rotated:we.labels.length>6,config:te.axis&&te.axis.x||{}}),xe({group:te.groups.axis,plot:ke,scale:_e,labels:je.map(qe=>qe.label),fontSize:te.fontSize,config:te.axis&&te.axis.y||{}}),te.labels&&te.labels.show){const qe=te.typography&&te.typography.small||te.fontSize||11,Xe=[];for(const We of je)for(const et of We.points)et.px===void 0||!R(et.y)||Xe.push({x:et.px,y:et.py,text:G(et.y,te.labels,te.grid),inside:!0,width:Le.bandwidth-4,height:_e.bandwidth-2});A({group:te.groups.labels,size:qe,minGap:0,anchors:Xe})}return{xScale:Le,yScale:_e,series:je,ramp:$e,domain:Ce}}function y(te){const Me=te.scheme||d(),{plot:ke,bound:we}=te;new ce(te.groups.grid).finish(),new ce(te.groups.axis).finish(),new ce(te.groups.rules).finish(),new ce(te.groups.labels).finish();const je=we.series[0],Pe=je?je.points.map((Xe,We)=>({point:Xe,label:we.labels[We],value:R(Xe.y)?Xe.y:0})).filter(Xe=>Xe.value>0):[];if(!Pe.length)return{stages:Pe};let Ce=0;for(let Xe=0;Xe<Pe.length;Xe++)Pe[Xe].value>Ce&&(Ce=Pe[Xe].value);const $e=ke.height/Pe.length,Le=ke.left+ke.width/2,_e=ke.width*.62,ot=new ce(te.groups.marks);Pe.forEach((Xe,We)=>{const et=Pe[We+1],He=ke.top+We*$e,pt=Xe.value/Ce*_e/2,ct=(et?et.value:Xe.value)/Ce*_e/2;j(ot.next("path",`${t}__funnel ${t}__mark`),{d:X(["M",K(Le-pt),K(He),"L",K(Le+pt),K(He),"L",K(Le+ct),K(He+$e-2),"L",K(Le-ct),K(He+$e-2),"Z"]),fill:Me.series(We),"data-point":We}),Xe.point.px=K(Le),Xe.point.py=K(He+$e/2)}),ot.finish();const qe=new ce(te.groups.overlay);return Pe.forEach((Xe,We)=>{const et=ke.top+We*$e,He=qe.next("text",`${t}__funnel-label`);j(He,{x:K(ke.left+4),y:K(et+$e/2),"text-anchor":"start","dominant-baseline":"middle"}),pe(He,Xe.label);const pt=qe.next("text",`${t}__funnel-value`);j(pt,{x:K(ke.right-4),y:K(et+$e/2),"text-anchor":"end","dominant-baseline":"middle"});const ct=We===0?1:Xe.value/Pe[We-1].value,St=te.labels&&te.labels.show?G(Xe.value,te.labels,te.grid):O(Xe.value,te.grid.messages);pe(pt,We===0?St:`${St} · ${Math.round(ct*100)}%`)}),qe.finish(),{stages:Pe}}function r(te){const Me=te.scheme||d(),{bound:ke}=te,[we,je,Pe,Ce]=ke.series;if(!we||!je||!Pe||!Ce)return E(te.groups),{xScale:null,yScale:null,series:[]};const $e=te.ohlc?"ohlc":"candlestick",Le=te.volume&&ke.series.find((lt,kt)=>kt>=4&<.key===te.volume)||null,_e=Le?l(te.plot,te.volumeHeight,te.fontSize):null,ot=_e?_e.price:te.plot,qe=te.plot,Xe=[];for(const lt of[je,Pe])for(const kt of lt.points)Xe.push(kt.y);const We=ke.yDomain||x(Xe,{zero:!1}),et={...w([],[0,0])},He=le(We,ot),pt=te.axis&&te.axis.x||{},ct=te.axis&&te.axis.y||{},St=m(ke,qe,$e,pt),Kt=St.kind==="band",Ye=Kt?St.bandwidth:W({bound:ke,scale:St,config:pt,padding:v($e)});J({gridGroup:te.groups.grid,axisGroup:te.groups.axis,plot:ot,scale:He,side:ct.position==="right"?"right":"left",format:b(te.grid,{kind:"linear",step:(We.max-We.min)/5})}),ve({group:te.groups.rules,plot:ot,side:ct.position==="right"?"right":"left"}),Array.isArray(te.reference)&&te.reference.length&&U({group:te.groups.grid,plot:ot,scale:He,lines:te.reference});const nt=Le?Y({ctx:te,pane:_e.volume,series:Le,side:ct.position==="right"?"right":"left"}):null;if(Le||E(te.groups),Kt)ie({group:te.groups.overlay,plot:qe,scale:St,labels:ke.labels,fontSize:te.fontSize,rotated:ke.labels.length>10,config:pt});else{const lt=ke.dimension&&ke.dimension.col?te.grid.columns.get(ke.dimension.col):void 0;ae({group:te.groups.overlay,plot:qe,scale:St,format:b(te.grid,{kind:ke.kind,span:St.domain.max-St.domain.min,step:(St.domain.max-St.domain.min)/5},lt),config:pt,grid:te.grid,size:te.fontSize})}Kt||L(te.groups,qe,B("candlestick"));const yt=new ce(te.groups.marks);for(let lt=0;lt<ke.categories.length;lt++){const kt=we.points[lt],Et=je.points[lt],ut=Pe.points[lt],bt=Ce.points[lt];if(![kt,Et,ut,bt].every(un=>un&&R(un.y)))continue;const ft=Kt?St.of(ke.categories[lt])+Ye/2:se(St,ke.kind,ke.categories[lt]);if(Number.isNaN(ft))continue;const Ot=Kt?ft-Ye/2:Math.max(qe.left,ft-Ye/2),Ft=Kt?ft+Ye/2:Math.min(qe.right,ft+Ye/2),tn=Ot,Nt=Math.max(1,Ft-Ot),Rt=bt.y>=kt.y,Dt=Rt?Me.positive:Me.negative;j(yt.next("path",`${t}__wick ${t}__mark`),{d:X(["M",K(ft),K(He.of(Et.y)),"L",K(ft),K(He.of(ut.y))]),stroke:Dt,fill:"none"});const Jt=He.of(Math.max(kt.y,bt.y)),An=He.of(Math.min(kt.y,bt.y));if(te.ohlc){const un=Math.max(1.5,Ye*.2),pn=K(He.of(kt.y)),fn=K(He.of(bt.y));j(yt.next("path",`${t}__ohlc-tick ${t}__mark`),{d:X(["M",K(ft-un),pn,"L",K(ft),pn]),stroke:Dt,fill:"none"}),j(yt.next("path",`${t}__ohlc-tick ${t}__mark`),{d:X(["M",K(ft),fn,"L",K(ft+un),fn]),stroke:Dt,fill:"none"}),bt.px=K(ft),bt.py=fn}else j(yt.next("rect",`${t}__candle ${t}__mark`),{x:K(tn),y:K(Jt),width:K(Nt),height:K(Math.max(1,An-Jt)),fill:Rt?"transparent":Dt,stroke:Dt,"data-point":lt}),bt.px=K(ft),bt.py=K(Jt);const cn=Le?Le.points[lt]:null;if(cn&&R(cn.y)){const un=nt.of(Math.max(nt.domain.min,0)),pn=nt.of(cn.y);j(yt.next("rect",`${t}__volume ${t}__mark`),{x:K(tn),y:K(Math.min(un,pn)),width:K(Nt),height:K(Math.abs(un-pn)),fill:Dt,"data-point":lt,"data-direction":Rt?"up":"down"}),cn.px=K(ft),cn.py=K(pn)}}yt.finish();let mt=null;Array.isArray(te.annotations)&&te.annotations.length&&(mt=V({group:te.groups.overlay,plot:ot,xScale:St,yScale:He,rightScale:null,series:ke.series,annotations:te.annotations,dual:!1,format:b(te.grid,{kind:"linear",step:(We.max-We.min)/5}).tick,size:te.fontSize}));const Je={xScale:St,yScale:He,series:Le?[Ce,Le]:[Ce],candles:ke.categories.length,annotations:mt};return Le&&(Je.volumeScale=nt,Je.panes={price:_e.price,volume:_e.volume}),Je}const k=.25;function l(te,Me,ke){const we=Number.isFinite(Me)&&Me>0&&Me<1?Number(Me):k,je=Math.round(Number.isFinite(ke)&&ke>0?ke:11),Pe=Math.max(0,te.height-je),Ce=Math.round(Pe*we),$e=Pe-Ce,Le={...te,bottom:te.top+$e,height:$e},_e={...te,top:te.bottom-Ce,height:Ce};return{price:Le,volume:_e,gap:je}}function I(te,Me){const ke={grid:null,rules:null,axis:null};if(!te)return ke;for(const we of["grid","rules","axis"]){const je=te[we],Pe=je&&je.parentNode;if(!Pe)continue;const Ce=`${t}__pane-${we}`,$e=[...Pe.childNodes||[]];let Le=$e.find(_e=>String(_e.getAttribute&&_e.getAttribute("class")||"").split(" ").includes(Ce))||null;if(!Le&&Me){Le=Pe.ownerDocument.createElementNS(ne,"g"),Le.setAttribute("class",`${je.getAttribute("class")} ${Ce}`);const _e=$e[$e.indexOf(je)+1]||null;_e?Pe.insertBefore(Le,_e):Pe.appendChild(Le)}ke[we]=Le}return ke}function E(te){const Me=I(te,!1);for(const ke of Object.values(Me))ke&&new ce(ke).finish()}function Y(te){const{ctx:Me,pane:ke,series:we}=te,je=I(Me.groups,!0),Pe=we.points.map(Le=>Le&&Le.y).filter(R),Ce=x(Pe,{zero:!0,ticks:2}),$e={...le(Ce,ke),ticks(Le=2){return i(Ce,Le)}};return J({gridGroup:je.grid,axisGroup:je.axis,plot:ke,scale:$e,side:te.side,config:{ticks:2},format:b(Me.grid,{kind:"linear",step:(Ce.max-Ce.min)/2})}),ve({group:je.rules,plot:ke,side:te.side}),$e}function se(te,Me,ke){const we=Me==="time"?h(ke):T(ke);return we===null?NaN:te.of(we)}function le(te,Me){const ke=te.max-te.min||1,we=Me.top-Me.bottom;return{kind:"linear",domain:te,range:[Me.bottom,Me.top],of(je){return Me.bottom+(je-te.min)/ke*we},invert(je){return te.min+(je-Me.bottom)/we*ke},ticks(je=5){const Pe=[];for(let Ce=0;Ce<=je;Ce++)Pe.push(te.min+ke*Ce/je);return Pe}}}function ye(te){const Me=te.scheme||d(),{plot:ke}=te;new ce(te.groups.grid).finish(),new ce(te.groups.rules).finish(),new ce(te.groups.labels).finish();const we=te.columns||[];if(we.length<2)return null;const je=te.grid&&te.grid.statistics;if(!je)return null;const Pe=te.method==="spearman"?"spearman":te.method==="kendall"?"kendall":"correlation",Ce=[];for(let We=0;We<we.length;We++)for(let et=0;et<we.length;et++){const He=We===et?1:je[Pe](we[We],we[et]);Ce.push({row:We,col:et,a:we[We],b:we[et],r:He})}const $e=we.length,Le=ke.width/$e,_e=ke.height/$e,ot=new ce(te.groups.marks);for(const We of Ce){const et=ke.left+We.col*Le,He=ke.top+We.row*_e;We.x=et,We.y=He,We.width=Le,We.height=_e;const pt=ot.next("rect",`${t}__cell ${t}__mark`);j(pt,{x:K(et),y:K(He),width:K(Math.max(0,Le-1)),height:K(Math.max(0,_e-1)),fill:We.row===We.col||We.r===null?"var(--lattice-chart-empty, #eceff1)":be(We.r,Me),"data-row":We.row,"data-col":We.col}),We.element=pt}ot.finish();const qe=new ce(te.groups.overlay),Xe=ue(ke);for(let We=0;We<$e;We++){const et=qe.next("text",`${t}__tick`);q(et,te.fontSize),j(et,{x:K(ke.left-4),y:K(ke.top+We*_e+_e/2),"text-anchor":"end","dominant-baseline":"middle"}),f(et,Ae(te.grid,we[We]),Xe,te.fontSize);const He=qe.next("text",`${t}__tick`);q(He,te.fontSize),j(He,{x:K(ke.left+We*Le+Le/2),y:K(ke.top-4),"text-anchor":"middle"}),f(He,Ae(te.grid,we[We]),Le,te.fontSize)}if(te.values!==!1&&Le>te.fontSize*2.6&&_e>te.fontSize*1.5)for(const We of Ce){if(We.row===We.col||We.r===null)continue;const et=qe.next("text",`${t}__data-label`);q(et,te.fontSize),j(et,{x:K(ke.left+We.col*Le+Le/2),y:K(ke.top+We.row*_e+_e/2),"text-anchor":"middle","dominant-baseline":"middle","data-inside":"true"}),pe(et,We.r.toFixed(2))}return qe.finish(),{cells:Ce,columns:we}}function be(te,Me){const ke=Math.min(1,Math.abs(te)),we=Me?s(Me,!0):$,je=we[Math.floor(we.length/2)],Pe=te>=0?we[we.length-1]:we[0];return _(je,Pe,ke)}function Ae(te,Me){const ke=te&&te.columns&&typeof te.columns.get=="function"?te.columns.get(Me):null;return String(ke&&ke.title||Me)}function Ne(te){for(const Me of te.cells||[])if(Me.x!==void 0&&te.x>=Me.x&&te.x<=Me.x+Me.width&&te.y>=Me.y&&te.y<=Me.y+Me.height)return Me;return null}}),it("packages/modules/charts/mapdensity.js",function(n,re){"use strict";Object.defineProperty(n,"drawDensityCells",{enumerable:!0,get:function(){return f}});const Se=re("packages/modules/charts/svg.js"),ce=Se.attrs,N=Se.path,ve=Se.round,ie=re("packages/modules/charts/scale.js").measureDomain,J=re("packages/modules/charts/matrix.js").colourRamp,B=re("packages/modules/charts/styles.js").NS;function f(L){const{pool:P,cells:W,to:U,plot:v,scheme:m}=L;let u=0;for(const R of W)R.count>u&&(u=R.count);const b=ie([0,u],{zero:!0}),O=J(b,!1,m,W.map(R=>R.count)),Q=(R,i)=>{const[x,T]=U(R,i);return!Number.isFinite(x)||!Number.isFinite(T)?null:[Math.min(Math.max(x,v.left),v.right),Math.min(Math.max(T,v.top),v.bottom)]};let w=0;for(const R of W){const i=[Q(R.west,R.south),Q(R.east,R.south),Q(R.east,R.north),Q(R.west,R.north)];if(i.some(g=>g===null))continue;const x=i.map(g=>g[0]),T=i.map(g=>g[1]);if(Math.max(...x)-Math.min(...x)<.5||Math.max(...T)-Math.min(...T)<.5)continue;const h=[];i.forEach((g,j)=>h.push(j?"L":"M",ve(g[0]),ve(g[1]))),h.push("Z"),ce(P.next("path",`${B}__density-cell ${B}__mark`),{d:N(h),fill:O(R.count),stroke:"none","data-count":R.count,class:`${B}__density-cell ${B}__mark`}),w++}return{cells:w,maxCount:u,domain:b,ramp:O}}}),it("packages/modules/charts/radial.js",function(n,re){"use strict";Object.defineProperty(n,"horizontalRoom",{enumerable:!0,get:function(){return t}}),Object.defineProperty(n,"horizontalReach",{enumerable:!0,get:function(){return e}}),Object.defineProperty(n,"centredRoom",{enumerable:!0,get:function(){return s}}),Object.defineProperty(n,"arcPath",{enumerable:!0,get:function(){return d}}),Object.defineProperty(n,"layoutRings",{enumerable:!0,get:function(){return p}}),Object.defineProperty(n,"drawRadial",{enumerable:!0,get:function(){return H}}),Object.defineProperty(n,"arcAt",{enumerable:!0,get:function(){return F}});const ce=re("packages/modules/charts/frame.js").Pool,N=re("packages/modules/charts/svg.js"),ve=N.attrs,xe=N.path,ie=N.round,ae=N.setText,ue=re("packages/modules/charts/styles.js").NS,f=re("packages/modules/charts/scheme.js").resolveScheme,L=re("packages/modules/charts/fills.js"),P=L.nodePaint,W=L.rowFillSource,U=re("packages/modules/charts/labels.js"),v=U.drawAnchoredLabels,m=U.labelText,u=re("packages/modules/charts/typography.js"),b=u.applySize,O=u.textWidth,Q=u.truncateTo,R=re("packages/modules/charts/format.js").measureFormat,i=Math.PI*2,x=-Math.PI/2,T=.25,h=2,g=3,j=.58,X=8,K=2;function pe(o,A,G,D){return o==="total"?R(A,G,D):typeof o=="number"?R(o,G,D):o==null?"":String(o)}function ne(o,A,G){if(!o||G<=0)return X;let D=A;for(;D>X&&O(o,D)>G;)D-=1;return Math.max(X,D)}function C(o,A,G,D){const V=G*Math.SQRT2-4;if(V<=0||!o&&!A)return null;let de=ne(o,Math.min(V,D*(A?1.6:2.2)),V),$=A?ne(A,Math.min(V,de*.55),V):0;const _=A?K:0;for(;de+_+$>V&&(de>X||$>X);)de>X&&(de-=1),A&&$>X&&($-=1);const oe=O(o,de)>V?Q(o,V,de):o,a=A&&O(A,$)>V?Q(A,V,$):A;return{value:oe,valueSize:de,label:a||"",labelSize:$,gap:_,height:de+_+$}}function q(o,A){const{cx:G,cy:D,hole:V,centre:de,total:$,column:_,grid:oe,baseSize:a}=A,y=pe(de.value,$,_,oe),r=de.label?String(de.label):"",k=C(y,r,V,a);if(!k)return;const l=k.label?D-k.height/2+k.valueSize/2:D;if(k.value){const I=o.next("text",`${ue}__donut-centre-value`);ve(I,{x:ie(G),y:ie(l),"dominant-baseline":"middle"}),b(I,k.valueSize),ae(I,k.value)}if(k.label){const I=o.next("text",`${ue}__donut-centre-label`);ve(I,{x:ie(G),y:ie(l+k.valueSize/2+k.gap+k.labelSize/2),"dominant-baseline":"middle"}),b(I,k.labelSize),ae(I,k.label)}}function z(o,A,G,D){return[o+G*Math.cos(D),A+G*Math.sin(D)]}function t(o,A,G){const{left:D,right:V}=e(o,A,G);return Math.max(0,D)+Math.max(0,V)}function e(o,A,G){const{inner:D,outer:V,from:de,to:$}=o;if(G*G>=V*V)return{left:0,right:0};const _=Math.sqrt(V*V-G*G);let oe=A+_,a=_-A;if(D>0&&G*G<D*D){const y=Math.sqrt(D*D-G*G);if(A>=y)oe=Math.min(oe,A-y);else if(A<=-y)a=Math.min(a,-y-A);else return{left:0,right:0}}if($-de<i-1e-9)for(const y of[de,$]){const r=Math.sin(y);if(Math.abs(r)<1e-9)continue;const k=G/r;if(k<=0)continue;const l=k*Math.cos(y);l>=A?a=Math.min(a,l-A):oe=Math.min(oe,A-l)}return{left:Math.max(0,oe),right:Math.max(0,a)}}function s(o,A,G,D){let V=1/0;for(const de of[-D/2,0,D/2]){const{left:$,right:_}=e(o,A,G+de);V=Math.min(V,$,_)}return Number.isFinite(V)?2*V:0}function d(o){const{cx:A,cy:G,inner:D,outer:V}=o,de=o.to-o.from;if(de<=0)return"";if(de>=i-1e-9){const[k,l]=z(A,G,V,o.from),[I,E]=z(A,G,V,o.from+Math.PI),Y=["M",ie(k),ie(l),"A",ie(V),ie(V),0,1,1,ie(I),ie(E),"A",ie(V),ie(V),0,1,1,ie(k),ie(l)];if(D>0){const[se,le]=z(A,G,D,o.from),[ye,be]=z(A,G,D,o.from+Math.PI);Y.push("M",ie(se),ie(le),"A",ie(D),ie(D),0,1,0,ie(ye),ie(be),"A",ie(D),ie(D),0,1,0,ie(se),ie(le))}return xe(Y)}const $=de>Math.PI?1:0,[_,oe]=z(A,G,V,o.from),[a,y]=z(A,G,V,o.to),r=["M",ie(_),ie(oe),"A",ie(V),ie(V),0,$,1,ie(a),ie(y)];if(D>0){const[k,l]=z(A,G,D,o.to),[I,E]=z(A,G,D,o.from);r.push("L",ie(k),ie(l)),r.push("A",ie(D),ie(D),0,$,0,ie(I),ie(E))}else r.push("L",ie(A),ie(G));return r.push("Z"),xe(r)}function p(o,A=x,G=x+i){const D=[],V=(de,$,_,oe,a,y)=>{if(oe>0&&D.push({node:de,from:$,to:_,depth:oe,index:a,label:de.label,total:de.total,path:y}),oe>=o.maxRings||!de.children.length)return;const r=de.children.reduce((I,E)=>I+E.total,0),k=_-$;if(r<=0||k<=0)return;let l=$;for(let I=0;I<de.children.length;I++){const E=de.children[I],Y=E.total/r*k;V(E,l,l+Y,oe+1,oe===0?I:a,[...y,E.label]),l+=Y}};return V(o.root,A,G,0,0,[]),D}function M(o){return o*Math.PI/180-Math.PI/2}function ee(o,A,G){if(G>=i-1e-9)return{cx:o.left+o.width/2,cy:o.top+o.height/2,radius:Math.max(0,Math.min(o.width,o.height)/2-2)};let V=1/0,de=-1/0,$=1/0,_=-1/0;const oe=Math.max(2,Math.ceil(G*180/Math.PI));for(let I=0;I<=oe;I++){const E=A+G*I/oe,Y=Math.cos(E),se=Math.sin(E);Y<V&&(V=Y),Y>de&&(de=Y),se<$&&($=se),se>_&&(_=se)}const a=de-V,y=_-$,r=Math.max(0,Math.min(a>0?o.width/a:1/0,y>0?o.height/y:1/0)-2),k=o.left+(o.width-r*(de+V))/2,l=o.top+(o.height-r*(_+$))/2;return{cx:k,cy:l,radius:r}}function H(o){const A=o.scheme||f(),{plot:G,tree:D,type:V}=o,de=o.radius&&typeof o.radius=="object"?o.radius:null,$=de&&de.col&&o.grid&&o.grid.columns&&o.grid.columns.get(de.col)||null;let _=null;if($){const we=D.root.children.map($e=>Number.isFinite($e.radius)&&$e.radius>0?$e.radius:0),je=we.length?Math.max(...we):0,Pe=de.fn==="linear",Ce=Number.isFinite(de.min)?Math.max(0,Math.min(1,Number(de.min))):0;_=we.map($e=>{if(!je)return Ce;const Le=Pe?$e/je:Math.sqrt($e/je);return Math.max(Ce,Le)})}const oe=Number.isFinite(o.startAngle)?Number(o.startAngle):0,a=Number.isFinite(o.endAngle)?Number(o.endAngle):360,y=M(oe);let r=M(a)-y;r<=0&&(r+=i);const k=ee(G,y,r),l=k.cx,I=k.cy,E=k.radius,Y=V==="sunburst"?Math.max(1,D.depth):1,se=p({root:D.root,depth:D.depth,maxRings:Y},y,y+r).filter(we=>!o.hidden.has(we.label)),le=V==="donut"?E*j:0,ye=Y>0?(E-le)/Y:E;new ce(o.groups.grid).finish(),new ce(o.groups.axis).finish(),new ce(o.groups.rules).finish(),new ce(o.groups.labels).finish();const be=D.root.children.map(we=>we.label),Ae=o.fill?W(o,A):null,Ne=new ce(o.groups.marks);for(const we of se){const je=le+(we.depth-1)*ye,Pe=_&&we.depth===1?_[we.index]:1,Ce=je+ye*Pe,$e=Ne.next("path",`${ue}__slice ${ue}__mark`);ve($e,{d:d({cx:l,cy:I,inner:je,outer:Ce,from:we.from,to:we.to}),fill:P(Ae,we.node,A.series(we.index,be[we.index])),"fill-opacity":we.depth>1?Math.max(.45,1-(we.depth-1)*.22):1,"data-arc":se.indexOf(we)}),we.geometry={cx:l,cy:I,inner:je,outer:Ce},we.depth===1&&(we.rvalue=D.root.children[we.index]?.radius??null)}Ne.finish();const te=o.typography&&o.typography.small||o.fontSize||11,Me=!(o.labels&&o.labels.names===!1),ke=new ce(o.groups.overlay);if(Me)for(const we of se){if(we.to-we.from<T||we.geometry.outer-we.geometry.inner<te+h*2)continue;const je=(we.from+we.to)/2,Pe=we.geometry.inner+(we.geometry.outer-we.geometry.inner)/2;if((we.to-we.from)*Pe<te+h*2)continue;const[Ce,$e]=z(l,I,Pe,je),{inner:Le,outer:_e}=we.geometry,ot={inner:Le,outer:_e,from:we.from,to:we.to},qe=s(ot,Ce-l,$e-I,te*1.3)-h*2,Xe=String(we.label===null||we.label===void 0?"":we.label),We=Q(Xe,qe,te);if(We!==Xe&&We.length<g)continue;const et=ke.next("text",`${ue}__slice-label`);ve(et,{x:ie(Ce),y:ie($e),"dominant-baseline":"middle","aria-label":We!==Xe?Xe:null}),b(et,te),ae(et,We)}if(V==="donut"&&o.centre&&le>0){const we=o.grid&&o.grid.columns&&D.measure&&D.measure.col?o.grid.columns.get(D.measure.col):null;q(ke,{cx:l,cy:I,hole:le,centre:o.centre,total:se.filter(je=>je.depth===1).reduce((je,Pe)=>je+Pe.total,0),column:we,grid:o.grid,baseSize:te})}return ke.finish(),o.labels&&o.labels.show&&v({group:o.groups.labels,size:te,minGap:o.labels.minGap,anchors:se.filter(we=>we.depth===1&&we.to-we.from>=T).map(we=>{const je=(we.from+we.to)/2,Pe=we.geometry.inner+(we.geometry.outer-we.geometry.inner)/2,[Ce,$e]=z(l,I,Pe,je);return{x:ie(Ce),y:ie($e+te+1),text:m(we.total,o.labels,o.grid),inside:!0}})}),{arcs:se,centre:{x:l,y:I,r:E}}}function F(o){for(const A of o.arcs){const G=A.geometry;if(!G)continue;const D=o.x-G.cx,V=o.y-G.cy,de=Math.sqrt(D*D+V*V);if(de<G.inner||de>G.outer)continue;let $=Math.atan2(V,D);const _=A.from;for(;$<_;)$+=i;for(;$>=_+i;)$-=i;if($>=A.from&&$<A.to)return A}return null}}),it("packages/modules/charts/distribution.js",function(n,re){"use strict";Object.defineProperty(n,"FENCE",{enumerable:!0,get:function(){return K}}),Object.defineProperty(n,"RULE_LABEL_ROOM",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(n,"quantile",{enumerable:!0,get:function(){return s}}),Object.defineProperty(n,"summarise",{enumerable:!0,get:function(){return d}}),Object.defineProperty(n,"binEdge",{enumerable:!0,get:function(){return p}}),Object.defineProperty(n,"outsideDomain",{enumerable:!0,get:function(){return M}}),Object.defineProperty(n,"histogram",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(n,"readingsOf",{enumerable:!0,get:function(){return H}}),Object.defineProperty(n,"valuesByCategory",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"allReadings",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"distributionDomain",{enumerable:!0,get:function(){return A}}),Object.defineProperty(n,"density",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"drawHistogram",{enumerable:!0,get:function(){return V}}),Object.defineProperty(n,"drawBoxPlot",{enumerable:!0,get:function(){return de}}),Object.defineProperty(n,"probit",{enumerable:!0,get:function(){return $}}),Object.defineProperty(n,"drawQQ",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"drawEcdf",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(n,"drawLorenz",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"drawControl",{enumerable:!0,get:function(){return y}}),Object.defineProperty(n,"drawCapability",{enumerable:!0,get:function(){return r}}),Object.defineProperty(n,"drawMovingRange",{enumerable:!0,get:function(){return k}});const ce=re("packages/modules/charts/frame.js").Pool,N=re("packages/modules/charts/axis.js"),ve=N.drawAxisLines,xe=N.drawCategoryAxis,ie=N.drawContinuousAxis,ae=N.drawMeasureAxis,J=N.tickLabeller,B=re("packages/modules/charts/format.js").formatters,f=re("packages/modules/charts/scale.js"),L=f.bandScale,P=f.isNumber,W=f.linearScale,U=f.measureDomain,v=f.niceStep,m=re("packages/modules/charts/svg.js"),u=m.attrs,b=m.path,O=m.round,w=re("packages/modules/charts/styles.js").NS,i=re("packages/modules/charts/scheme.js").resolveScheme,x=re("packages/modules/charts/labels.js"),T=x.collides,h=x.drawAnchoredLabels,g=x.labelText,X=re("packages/modules/charts/typography.js").textWidth,K=1.5,pe=16,ne=.75;function C(l,I,E,Y,se){const le=X(Y,se),ye=se*ne;return{x:E==="end"?l-le:E==="start"?l:l-le/2,y:I-ye,width:le,height:ye*2}}function q(l,I,E,Y,se,le){const ye=l.x-le,be=l.x+l.width+le,Ae=l.y-le,Ne=l.y+l.height+le,te=Y-I,Me=se-E;let ke=0,we=1;if(Math.abs(te)<1e-9){if(I<ye||I>be)return!1}else{const je=1/te;let Pe=(ye-I)*je,Ce=(be-I)*je;if(Pe>Ce){const $e=Pe;Pe=Ce,Ce=$e}if(Pe>ke&&(ke=Pe),Ce<we&&(we=Ce),ke>we)return!1}if(Math.abs(Me)<1e-9){if(E<Ae||E>Ne)return!1}else{const je=1/Me;let Pe=(Ae-E)*je,Ce=(Ne-E)*je;if(Pe>Ce){const $e=Pe;Pe=Ce,Ce=$e}if(Pe>ke&&(ke=Pe),Ce<we&&(we=Ce),ke>we)return!1}return!0}function z(l,I,E,Y){const se=Math.max(l.x,Math.min(I,l.x+l.width)),le=Math.max(l.y,Math.min(E,l.y+l.height)),ye=I-se,be=E-le;return ye*ye+be*be<=Y*Y}function t(l,I,E,Y,se,le){for(const ye of E){const be=C(ye.x,ye.y,ye.anchor,l,I);if(be.x<se.left-1||be.x+be.width>se.right+1||be.y<se.top-1||be.y+be.height>se.bottom+1)continue;let Ae=!1;for(const Ne of Y.segments)if(q(be,Ne.x1,Ne.y1,Ne.x2,Ne.y2,1)){Ae=!0;break}if(!Ae){for(const Ne of Y.points)if(z(be,Ne.x,Ne.y,Ne.r+1)){Ae=!0;break}}if(!Ae&&T(be,le,5)&&(Ae=!0),!Ae)return le.push(be),ye}return null}const e="–";function s(l,I){const E=l.length;if(!E)return NaN;if(E===1)return l[0];const Y=(E-1)*Math.min(1,Math.max(0,I)),se=Math.floor(Y),le=Math.ceil(Y);return se===le?l[se]:l[se]+(Y-se)*(l[le]-l[se])}function d(l){const I=l.filter(P).slice().sort((te,Me)=>te-Me);if(!I.length)return null;const E=s(I,.25),Y=s(I,.5),se=s(I,.75),le=se-E,ye=E-K*le,be=se+K*le;let Ae=I[0];for(const te of I)if(te>=ye){Ae=te;break}let Ne=I[I.length-1];for(let te=I.length-1;te>=0;te--)if(I[te]<=be){Ne=I[te];break}return{min:I[0],q1:E,median:Y,q3:se,max:I[I.length-1],low:Ae,high:Ne,outliers:I.filter(te=>te<ye||te>be),count:I.length}}function p(l,I,E){const Y=l+E*I;return Math.abs(Y)<I/1e6?0:Number(Y.toPrecision(12))}function M(l,I){const E=I||{},Y=P(E.min),se=P(E.max);if(!Y&&!se)return 0;let le=0;for(let ye=0;ye<l.length;ye++){const be=l[ye];P(be)&&(Y&&be<E.min||se&&be>E.max)&&le++}return le}function ee(l,I=12,E){const Y=E||{},se=P(Y.min),le=P(Y.max);let ye=1/0,be=-1/0,Ae=0;for(let je=0;je<l.length;je++){const Pe=l[je];P(Pe)&&(se&&Pe<Y.min||le&&Pe>Y.max||(Pe<ye&&(ye=Pe),Pe>be&&(be=Pe),Ae++))}if(!Ae)return[];if(se&&(ye=Number(Y.min)),le&&(be=Number(Y.max)),ye===be){const je=Math.abs(ye)>0?Math.abs(ye)/10:.5;ye-=je,be+=je}const Ne=v((be-ye)/Math.max(1,I)),te=Math.floor(ye/Ne)*Ne,Me=Math.ceil(be/Ne)*Ne,ke=[],we=Math.max(1,Math.round((Me-te)/Ne));for(let je=0;je<we;je++)ke.push({from:p(te,Ne,je),to:p(te,Ne,je+1),count:0});for(let je=0;je<l.length;je++){const Pe=l[je];if(!P(Pe)||se&&Pe<Y.min||le&&Pe>Y.max)continue;let Ce=Math.floor((Pe-te)/Ne);Ce>=ke.length&&(Ce=ke.length-1),Ce<0&&(Ce=0),ke[Ce].count++}return ke}function H(l){if(!l)return[];if(Array.isArray(l.values)){const I=l.values.filter(P);if(I.length)return I}return P(l.y)?[l.y]:[]}function F(l){const I=new Map,E=!(l.dimension&&l.dimension.col),Y=E&&l.measure&&l.measure.title||"";for(const se of l.series)for(const le of se.points){const ye=H(le);if(!ye.length)continue;const be=E?Y:le.label;I.has(be)||I.set(be,[]);const Ae=I.get(be);for(const Ne of ye)Ae.push(Ne)}return I}function o(l){const I=[];for(const E of l.series||[])for(const Y of E.points||[])for(const se of H(Y))I.push(se);return I}function A(l,I){const E=I&&I.y||{};return U(l,{zero:!1,min:E.min,max:E.max})}function G(l,I,E){const Y=l.length;if(!Y)return[];const se=l.reduce((te,Me)=>te+Me,0)/Y,le=l.reduce((te,Me)=>te+(Me-se)**2,0)/Math.max(1,Y-1),ye=Math.sqrt(le)||1,be=Math.max(1e-9,1.06*ye*Y**(-1/5)),Ae=[],Ne=I.max-I.min||1;for(let te=0;te<E;te++){const Me=I.min+Ne*te/(E-1||1);let ke=0;for(const we of l){const je=(Me-we)/be;ke+=Math.exp(-.5*je*je)}Ae.push({at:Me,density:ke/(Y*be*Math.sqrt(Math.PI*2))})}return Ae}function D(l,I,E){const Y=B(l.grid,{kind:"linear",step:E}),se=I.measure&&I.measure.col&&l.grid.columns?l.grid.columns.get(I.measure.col):null,ye=!!(se&&se.format&&typeof se.formatValue=="function")?{tick:be=>String(se.formatValue(be,null))}:Y;return J(l.axis&&l.axis.x||{},ye,l.grid)}function V(l){const I=l.scheme||i(),{plot:E,bound:Y}=l,se=o(Y),le=l.axis&&l.axis.y||{},ye=ee(se,l.buckets||12,le),be=M(se,le),Ae=ye.map(_e=>_e.count),Ne=U(Ae,{zero:!0}),te=W(Ne,[E.bottom,E.top]),Me=ye.length?ye[0].to-ye[0].from:1,ke=D(l,Y,Me),we=ye.map(_e=>ke(_e.from)),je=ye.map(_e=>`${ke(_e.from)} ${e} ${ke(_e.to)}`),Pe=ye.map((_e,ot)=>ot),Ce=L(Pe,[E.left,E.right],.08);ae({gridGroup:l.groups.grid,axisGroup:l.groups.axis,plot:E,scale:te,format:B(l.grid,{kind:"linear",step:(Ne.max-Ne.min)/5})}),xe({group:l.groups.overlay,plot:E,scale:Ce,labels:we,fontSize:l.fontSize,rotated:we.length>8}),ve({group:l.groups.rules,plot:E});const $e=new ce(l.groups.marks),Le=te.of(Ne.min<=0?0:Ne.min);if(ye.forEach((_e,ot)=>{const qe=te.of(_e.count);u($e.next("rect",`${w}__bar ${w}__mark`),{x:O(Ce.of(ot)),y:O(Math.min(qe,Le)),width:O(Ce.bandwidth),height:O(Math.max(_e.count>0?1:0,Math.abs(Le-qe))),fill:I.series(0),"data-point":ot})}),$e.finish(),l.curve&&se.length>1){const _e={min:ye[0].from,max:ye[ye.length-1].to},ot=G(se,_e,Math.max(24,ye.length*4)),qe=ot.reduce((Xe,We)=>Math.max(Xe,We.density),0);if(qe>0){const Xe=_e.max-_e.min||1,We=te.of(Ne.max),et=ot.map(pt=>[O(E.left+(pt.at-_e.min)/Xe*(E.right-E.left)),O(Le-pt.density/qe*(Le-We))]),He=new ce(l.groups.overlay);u(He.next("path",`${w}__density ${w}__mark`),{d:b(et.flatMap(([pt,ct],St)=>[St?"L":"M",pt,ct])),fill:"none",stroke:I.series(1)}),He.finish()}}if(l.labels&&l.labels.show){const _e=l.typography&&l.typography.small||l.fontSize||11;h({group:l.groups.labels,size:_e,minGap:l.labels.minGap,plot:E,anchors:ye.map((ot,qe)=>{const Xe=Math.min(te.of(ot.count),Le),We=Xe-_e/2-2,et=We<E.top;return{x:O(Ce.of(qe)+Ce.bandwidth/2),y:O(et?Xe+_e/2+2:We),text:ot.count?g(ot.count,l.labels,l.grid):"",inside:et,height:et?Math.abs(Le-Xe)-2:void 0}})})}return{xScale:Ce,yScale:te,buckets:ye,labels:je,categories:ye.map(_e=>_e.from),outside:be,series:[{key:"",label:Y.measure.title,index:0,points:ye.map((_e,ot)=>({x:ot,xKey:String(ot),label:je[ot],from:_e.from,to:_e.to,y:_e.count,rows:_e.count}))}]}}function de(l){const I=l.scheme||i(),{plot:E,bound:Y}=l,se=F(Y),le=[...se.keys()],ye=le.map(we=>d(se.get(we))).filter(Boolean),be=[];for(const we of ye)be.push(we.min,we.max);const Ae=A(be,l.axis),Ne=W(Ae,[E.bottom,E.top]),te=L(le,[E.left,E.right],.4);ae({gridGroup:l.groups.grid,axisGroup:l.groups.axis,plot:E,scale:Ne,format:B(l.grid,{kind:"linear",step:(Ae.max-Ae.min)/5})}),xe({group:l.groups.overlay,plot:E,scale:te,labels:le,fontSize:l.fontSize,rotated:le.length>6}),ve({group:l.groups.rules,plot:E});const Me=new ce(l.groups.marks),ke=te.bandwidth;return le.forEach((we,je)=>{const Pe=ye[je];if(!Pe)return;const Ce=te.of(we),$e=Ce+ke/2,Le=I.series(je);u(Me.next("rect",`${w}__box ${w}__mark`),{x:O(Ce),y:O(Ne.of(Pe.q3)),width:O(ke),height:O(Math.max(1,Ne.of(Pe.q1)-Ne.of(Pe.q3))),fill:Le,"fill-opacity":.35,stroke:Le,"data-point":je}),u(Me.next("path",`${w}__whisker ${w}__mark`),{d:b(["M",O($e),O(Ne.of(Pe.high)),"L",O($e),O(Ne.of(Pe.q3)),"M",O($e),O(Ne.of(Pe.q1)),"L",O($e),O(Ne.of(Pe.low)),"M",O(Ce+ke*.25),O(Ne.of(Pe.high)),"L",O(Ce+ke*.75),O(Ne.of(Pe.high)),"M",O(Ce+ke*.25),O(Ne.of(Pe.low)),"L",O(Ce+ke*.75),O(Ne.of(Pe.low))]),stroke:Le,fill:"none"}),u(Me.next("path",`${w}__median ${w}__mark`),{d:b(["M",O(Ce),O(Ne.of(Pe.median)),"L",O(Ce+ke),O(Ne.of(Pe.median))]),stroke:Le,"stroke-width":2,fill:"none"});for(const _e of Pe.outliers)u(Me.next("circle",`${w}__point ${w}__mark`),{cx:O($e),cy:O(Ne.of(_e)),r:2.5,fill:Le,"fill-opacity":.8})}),Me.finish(),{xScale:te,yScale:Ne,boxes:ye,series:[{key:"",label:Y.measure.title,index:0,points:le.map((we,je)=>({x:we,xKey:we,label:we,y:ye[je]?ye[je].median:null,rows:ye[je]?ye[je].count:0}))}]}}function $(l){if(!(l>0&&l<1))return Number.NaN;const I=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],E=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],Y=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],se=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],le=.02425;if(l<le){const Ae=Math.sqrt(-2*Math.log(l));return(((((Y[0]*Ae+Y[1])*Ae+Y[2])*Ae+Y[3])*Ae+Y[4])*Ae+Y[5])/((((se[0]*Ae+se[1])*Ae+se[2])*Ae+se[3])*Ae+1)}if(l>1-le){const Ae=Math.sqrt(-2*Math.log(1-l));return-(((((Y[0]*Ae+Y[1])*Ae+Y[2])*Ae+Y[3])*Ae+Y[4])*Ae+Y[5])/((((se[0]*Ae+se[1])*Ae+se[2])*Ae+se[3])*Ae+1)}const ye=l-.5,be=ye*ye;return(((((I[0]*be+I[1])*be+I[2])*be+I[3])*be+I[4])*be+I[5])*ye/(((((E[0]*be+E[1])*be+E[2])*be+E[3])*be+E[4])*be+1)}function _(l){const I=l.scheme||i(),{plot:E,bound:Y}=l;new ce(l.groups.grid).finish(),new ce(l.groups.axis).finish(),new ce(l.groups.rules).finish(),new ce(l.groups.labels).finish();const se=o(Y);if(se.length<3)return null;const le=se.slice().sort((qe,Xe)=>qe-Xe),ye=le.length,be=le.map((qe,Xe)=>$((Xe+1-.375)/(ye+.25))),Ae=U(be,{zero:!1,nice:!0}),Ne=U(le,{zero:!1,nice:!0}),te=W(Ae,[E.left,E.right]),Me=W(Ne,[E.bottom,E.top]);ae({gridGroup:l.groups.grid,axisGroup:l.groups.axis,plot:E,scale:Me,format:B(l.grid,{kind:"linear",step:(Ne.max-Ne.min)/5})}),ie({group:l.groups.overlay,plot:E,scale:te,fontSize:l.fontSize,format:B(l.grid,{kind:"linear",step:(Ae.max-Ae.min)/5})}),ve({group:l.groups.rules,plot:E});const ke=s(le,.25),we=s(le,.75),je=$(.25),Pe=$(.75),Ce=(we-ke)/(Pe-je),$e=ke-Ce*je,Le=new ce(l.groups.rules);u(Le.next("path",`${w}__qq-line`),{d:b(["M",O(te.of(Ae.min)),O(Me.of($e+Ce*Ae.min)),"L",O(te.of(Ae.max)),O(Me.of($e+Ce*Ae.max))]),fill:"none"}),Le.finish();const _e=new ce(l.groups.marks),ot=[];for(let qe=0;qe<ye;qe++){const Xe=O(te.of(be[qe])),We=O(Me.of(le[qe]));u(_e.next("circle",`${w}__point ${w}__mark`),{cx:Xe,cy:We,r:2.5,fill:I.series(0),"data-point":qe}),ot.push({x:Xe,y:We,theoretical:be[qe],sample:le[qe]})}return _e.finish(),{points:ot,line:{slope:Ce,intercept:$e}}}function oe(l){const I=l.scheme||i(),{plot:E,bound:Y}=l;new ce(l.groups.grid).finish(),new ce(l.groups.axis).finish(),new ce(l.groups.rules).finish(),new ce(l.groups.labels).finish();const se=o(Y);if(!se.length)return null;const le=se.slice().sort((we,je)=>we-je),ye=le.length,be=U(le,{zero:!1,nice:!0}),Ae=W(be,[E.left,E.right]),Ne=W({min:0,max:1},[E.bottom,E.top]);ae({gridGroup:l.groups.grid,axisGroup:l.groups.axis,plot:E,scale:Ne,format:B(l.grid,{kind:"linear",step:.2})}),ie({group:l.groups.overlay,plot:E,scale:Ae,fontSize:l.fontSize,format:B(l.grid,{kind:"linear",step:(be.max-be.min)/5})}),ve({group:l.groups.rules,plot:E});const te=["M",O(Ae.of(be.min)),O(Ne.of(0))],Me=[];for(let we=0;we<ye;we++){const je=O(Ae.of(le[we])),Pe=(we+1)/ye;te.push("L",je,O(Ne.of(we/ye)),"L",je,O(Ne.of(Pe))),Me.push({value:le[we],share:Pe})}te.push("L",O(Ae.of(be.max)),O(Ne.of(1)));const ke=new ce(l.groups.marks);return u(ke.next("path",`${w}__ecdf ${w}__mark`),{d:b(te),fill:"none",stroke:I.series(0)}),ke.finish(),{steps:Me}}function a(l){const I=l.scheme||i(),{plot:E,bound:Y}=l;new ce(l.groups.grid).finish(),new ce(l.groups.axis).finish(),new ce(l.groups.rules).finish(),new ce(l.groups.labels).finish();const se=o(Y).filter($e=>$e>=0);if(!se.length)return null;const le=se.slice().sort(($e,Le)=>$e-Le),ye=le.length,be=le.reduce(($e,Le)=>$e+Le,0);if(be<=0)return null;const Ae=W({min:0,max:1},[E.left,E.right]),Ne=W({min:0,max:1},[E.bottom,E.top]);ae({gridGroup:l.groups.grid,axisGroup:l.groups.axis,plot:E,scale:Ne,format:B(l.grid,{kind:"linear",step:.2})}),ie({group:l.groups.overlay,plot:E,scale:Ae,fontSize:l.fontSize,format:B(l.grid,{kind:"linear",step:.2})}),ve({group:l.groups.rules,plot:E});const te=new ce(l.groups.rules);u(te.next("path",`${w}__lorenz-equality`),{d:b(["M",O(Ae.of(0)),O(Ne.of(0)),"L",O(Ae.of(1)),O(Ne.of(1))]),fill:"none"}),te.finish();const Me=["M",O(Ae.of(0)),O(Ne.of(0))],ke=[{rows:0,held:0}];let we=0;for(let $e=0;$e<ye;$e++){we+=le[$e];const Le={rows:($e+1)/ye,held:we/be};Me.push("L",O(Ae.of(Le.rows)),O(Ne.of(Le.held))),ke.push(Le)}const je=new ce(l.groups.marks);u(je.next("path",`${w}__lorenz ${w}__mark`),{d:b(Me),fill:"none",stroke:I.series(0)}),je.finish();let Pe=0;for(let $e=0;$e<ye;$e++)Pe+=($e+1)*le[$e];const Ce=2*Pe/(ye*be)-(ye+1)/ye;return{curve:ke,gini:Ce}}function y(l){const I=l.scheme||i(),{plot:E,bound:Y}=l;new ce(l.groups.grid).finish(),new ce(l.groups.labels).finish();const se=[];for(const He of Y.series)for(const pt of He.points)P(pt.y)&&se.push(pt.y);if(se.length<2)return null;const le=l.capability||null,ye=le&&le.limits?le.limits:null,be=[...se];ye&&be.push(ye.upper,ye.lower),le&&(le.lower!==null&&be.push(le.lower),le.upper!==null&&be.push(le.upper));const Ae=U(be,{zero:!1,nice:!0}),Ne=W(Ae,[E.bottom,E.top]),te=se.length>1?(E.right-E.left)/(se.length-1):0;ae({gridGroup:l.groups.grid,axisGroup:l.groups.axis,plot:E,scale:Ne,format:B(l.grid,{kind:"linear",step:(Ae.max-Ae.min)/5})}),ve({group:l.groups.rules,plot:E});const Me=new ce(l.groups.overlay),ke=[],we=(He,pt,ct,St="end")=>{!Number.isFinite(He)||He<Ae.min||He>Ae.max||(u(Me.next("path",pt),{d:b(["M",O(E.left),O(Ne.of(He)),"L",O(E.right),O(Ne.of(He))]),fill:"none"}),ct&&ke.push({y:Ne.of(He),text:ct,side:St}))};ye&&(we(ye.centre,`${w}__control-centre`,"CL","end"),we(ye.upper,`${w}__control-limit`,"UCL","end"),we(ye.lower,`${w}__control-limit`,"LCL","end")),le&&(le.lower!==null&&we(le.lower,`${w}__spec-limit`,"LSL","start"),le.upper!==null&&we(le.upper,`${w}__spec-limit`,"USL","start"),le.target!==null&&we(le.target,`${w}__spec-target`,"Target","start")),Me.finish();const je=new Map;for(const He of le&&le.violations?le.violations:[]){const pt=je.get(He.index);pt?pt.includes(He.rule)||pt.push(He.rule):je.set(He.index,[He.rule])}const Pe=new Set(je.keys()),Ce=new ce(l.groups.marks),$e=[],Le=[];for(let He=0;He<se.length;He++){const pt=O(E.left+He*te),ct=O(Ne.of(se[He]));$e.push(He?"L":"M",pt,ct),Le.push({x:pt,y:ct,index:He,value:se[He],violating:Pe.has(He)})}u(Ce.next("path",`${w}__control-line ${w}__mark`),{d:b($e),fill:"none",stroke:I.series(0)});for(const He of Le)u(Ce.next("circle",`${w}__point ${w}__mark`),{cx:He.x,cy:He.y,r:He.violating?4:2.5,fill:He.violating?"var(--lattice-danger, #a4262c)":I.series(0),"data-violation":He.violating?"true":null});Ce.finish();const _e={segments:Le.slice(1).map((He,pt)=>({x1:Le[pt].x,y1:Le[pt].y,x2:He.x,y2:He.y})),points:Le.map(He=>({x:He.x,y:He.y,r:He.violating?4:2.5}))},ot=[],qe=[];for(const{y:He,text:pt,side:ct}of ke){const St=ct==="start"?E.left+2:E.right-2,Kt=[{x:St,y:He,anchor:ct}];for(let nt=3;nt<=E.bottom-E.top+20;nt+=3)Kt.push({x:St,y:He-nt,anchor:ct},{x:St,y:He+nt,anchor:ct});const Ye=t(pt,9,Kt,_e,E,ot);Ye&&qe.push({...Ye,text:pt,className:`${w}__control-name`})}const Xe=E.gutter||{},We=E.left-(Xe.left||0),et=E.right+(Xe.right||0);for(const He of Le){const pt=je.get(He.index);if(!pt)continue;const ct=pt.sort((Kt,Ye)=>Kt-Ye).join(","),St=X(ct,9)/2+1;qe.push({x:Math.min(Math.max(He.x,We+St),et-St),y:He.y-7,text:ct,anchor:"middle",className:`${w}__control-rule`})}return h({group:l.groups.labels,anchors:qe,size:9,grid:l.grid,minGap:5}),{points:Le,limits:ye,ruleSet:le?le.ruleSet:null}}function r(l){const I=l.scheme||i(),{plot:E,bound:Y}=l;new ce(l.groups.grid).finish();const se=[];for(const _e of Y.series)for(const ot of _e.points)P(ot.y)&&se.push(ot.y);if(se.length<2)return null;const le=l.capability||null,ye=[...se];le&&(le.lower!==null&&ye.push(le.lower),le.upper!==null&&ye.push(le.upper),le.target!==null&&ye.push(le.target));const be=U(ye,{zero:!1,nice:!0}),Ae=W(be,[E.left,E.right]),Ne=ee(se,l.buckets||14),te=Ne.map(_e=>_e.count),Me=U(te,{zero:!0}),ke=W(Me,[E.bottom,E.top]);ae({gridGroup:l.groups.grid,axisGroup:l.groups.axis,plot:E,scale:ke,format:B(l.grid,{kind:"linear",step:(Me.max-Me.min)/5})}),ie({group:l.groups.overlay,plot:E,scale:Ae,fontSize:l.fontSize,format:B(l.grid,{kind:"linear",step:(be.max-be.min)/5})}),ve({group:l.groups.rules,plot:E});const we=ke.of(0),je=new ce(l.groups.marks);for(let _e=0;_e<Ne.length;_e++){const ot=Ne[_e],qe=Ae.of(ot.from),Xe=Ae.of(ot.to),We=ke.of(ot.count);u(je.next("rect",`${w}__bar ${w}__mark`),{x:O(Math.min(qe,Xe)),y:O(Math.min(We,we)),width:O(Math.max(1,Math.abs(Xe-qe)-1)),height:O(Math.max(ot.count>0?1:0,Math.abs(we-We))),fill:I.series(0),"data-point":_e})}je.finish();const Pe=new ce(l.groups.overlay),Ce=[];if(le&&Number.isFinite(le.mean)){const ot=et=>{if(!Number.isFinite(et)||et<=0)return null;const He=[];for(let pt=0;pt<=96;pt++){const ct=be.min+(be.max-be.min)*pt/96,St=(ct-le.mean)/et;He.push({at:ct,y:Math.exp(-.5*St*St)/et})}return He},qe=ot(le.sigmaWithin),Xe=ot(le.sigmaOverall);let We=0;for(const et of[qe,Xe])if(et)for(const He of et)We=Math.max(We,He.y);if(We>0){const et=ke.of(Me.max),He=(pt,ct,St)=>{if(!pt)return;const Kt=pt.flatMap((Ye,nt)=>[nt?"L":"M",O(Ae.of(Ye.at)),O(we-Ye.y/We*(we-et))]);u(Pe.next("path",`${ct} ${w}__mark`),{d:b(Kt),fill:"none"}),Ce.push(St)};He(qe,`${w}__capability-within`,"within"),He(Xe,`${w}__capability-overall`,"overall")}}const $e=[],Le=(_e,ot,qe)=>{if(_e===null||!Number.isFinite(_e)||_e<be.min||_e>be.max)return;const Xe=O(Ae.of(_e));u(Pe.next("path",ot),{d:b(["M",Xe,O(E.top),"L",Xe,O(E.bottom)]),fill:"none"}),$e.push({x:Xe,text:qe})};return le&&(Le(le.lower,`${w}__spec-limit`,"LSL"),Le(le.upper,`${w}__spec-limit`,"USL"),Le(le.target,`${w}__spec-target`,"Target")),Pe.finish(),h({group:l.groups.labels,anchors:$e.map(({x:_e,text:ot})=>{const qe=X(ot,9)/2,Xe=_e-qe<E.left+2?"start":_e+qe>E.right-2?"end":"middle";return{x:Xe==="start"?_e+2:Xe==="end"?_e-2:_e,y:E.top-pe/2,text:ot,anchor:Xe,className:`${w}__control-name`}}),size:9,grid:l.grid,minGap:1}),{buckets:Ne,capability:le,curves:Ce}}function k(l){const I=l.scheme||i(),{plot:E,bound:Y}=l;new ce(l.groups.grid).finish();const se=[];for(const $e of Y.series)for(const Le of $e.points)P(Le.y)&&se.push(Le.y);if(se.length<3)return null;const le=[];for(let $e=1;$e<se.length;$e++)le.push(Math.abs(se[$e]-se[$e-1]));const ye=le.reduce(($e,Le)=>$e+Le,0)/le.length,be=3.267*ye,Ae=U([...le,0,be],{zero:!0,nice:!0}),Ne=W(Ae,[E.bottom,E.top]),te=le.length>1?(E.right-E.left)/(le.length-1):0;ae({gridGroup:l.groups.grid,axisGroup:l.groups.axis,plot:E,scale:Ne,format:B(l.grid,{kind:"linear",step:(Ae.max-Ae.min)/5})}),ve({group:l.groups.rules,plot:E});const Me=new ce(l.groups.overlay),ke=[],we=($e,Le,_e)=>{!Number.isFinite($e)||$e<Ae.min||$e>Ae.max||(u(Me.next("path",Le),{d:b(["M",O(E.left),O(Ne.of($e)),"L",O(E.right),O(Ne.of($e))]),fill:"none"}),ke.push({y:Ne.of($e),text:_e}))};we(ye,`${w}__control-centre`,"MR"),we(be,`${w}__control-limit`,"UCL"),Me.finish();const je=new ce(l.groups.marks),Pe=[],Ce=[];for(let $e=0;$e<le.length;$e++){const Le=O(E.left+$e*te),_e=O(Ne.of(le[$e]));Pe.push($e?"L":"M",Le,_e),Ce.push({x:Le,y:_e,index:$e,value:le[$e],violating:le[$e]>be})}u(je.next("path",`${w}__control-line ${w}__mark`),{d:b(Pe),fill:"none",stroke:I.series(0)});for(const $e of Ce)u(je.next("circle",`${w}__point ${w}__mark`),{cx:$e.x,cy:$e.y,r:$e.violating?4:2.5,fill:$e.violating?"var(--lattice-danger, #a4262c)":I.series(0),"data-violation":$e.violating?"true":null});return je.finish(),h({group:l.groups.labels,anchors:ke.map(({y:$e,text:Le})=>({x:E.right-2,y:$e-3,text:Le,anchor:"end",className:`${w}__control-name`})),size:9,grid:l.grid,minGap:1}),{points:Ce,centre:ye,upper:be}}}),it("packages/modules/charts/treemap.js",function(n,re){"use strict";Object.defineProperty(n,"squarify",{enumerable:!0,get:function(){return j}}),Object.defineProperty(n,"layoutTree",{enumerable:!0,get:function(){return X}}),Object.defineProperty(n,"drawTreemap",{enumerable:!0,get:function(){return K}}),Object.defineProperty(n,"tileAt",{enumerable:!0,get:function(){return pe}});const ce=re("packages/modules/charts/frame.js").Pool,N=re("packages/modules/charts/svg.js"),ve=N.attrs,xe=N.round,ie=N.setText,J=re("packages/modules/charts/styles.js").NS,B=re("packages/modules/charts/scheme.js").resolveScheme,f=re("packages/modules/charts/fills.js"),L=f.nodePaint,P=f.rowFillSource,W=re("packages/modules/charts/labels.js"),U=W.drawAnchoredLabels,v=W.labelText,m=re("packages/modules/charts/typography.js"),u=m.applySize,b=m.truncateTo,O=34,Q=6,w=3,R=3,i=.28;function x(ne){return ne*1.6}function T(ne){return Math.round(ne*1.6)}function h(ne){return ne>1?Math.max(.45,1-(ne-1)*.22):1}function g(ne,C,q){if(!ne.length||C<=0||q<=0)return 1/0;const z=Math.max(...ne),t=Math.min(...ne),e=C*C,s=q*q;return Math.max(e*z/s,s/(e*t))}function j(ne,C){const q=[],z=ne.filter(H=>H.value>0),t=z.reduce((H,F)=>H+F.value,0);if(!z.length||t<=0||C.width<=0||C.height<=0)return q;const e=z.slice().sort((H,F)=>F.value-H.value),s=C.width*C.height/t;let d={...C},p=[],M=[];const ee=()=>{if(!p.length)return;const H=Math.min(d.width,d.height),o=M.reduce((G,D)=>G+D,0)/H;let A=0;for(let G=0;G<p.length;G++){const D=M[G]/o;q.push(d.width>=d.height?{item:p[G],x:d.x,y:d.y+A,width:o,height:D}:{item:p[G],x:d.x+A,y:d.y,width:D,height:o}),A+=D}d.width>=d.height?d={x:d.x+o,y:d.y,width:d.width-o,height:d.height}:d={x:d.x,y:d.y+o,width:d.width,height:d.height-o},p=[],M=[]};for(const H of e){const F=H.value*s,o=Math.min(d.width,d.height),A=g(M,o,M.reduce((D,V)=>D+V,0)),G=g([...M,F],o,M.reduce((D,V)=>D+V,0)+F);p.length&&G>A&&ee(),p.push(H),M.push(H.value*s)}return ee(),q}function X(ne){const{plot:C,tree:q}=ne,z=x(ne.fontSize),t=T(ne.fontSize),e=[],s=(d,p,M,ee,H)=>{const F=d.children.filter(o=>M>0||!ne.hidden.has(o.label)).map((o,A)=>({node:o,value:o.total,index:M===0?A:ee}));for(const o of j(F,p)){if(M>0&&(o.width<z||o.height<z))continue;const A={...o,depth:M+1,path:[...H,o.item.node.label],children:!1};e.push(A);const G={x:A.x+R,y:A.y+t,width:A.width-R*2,height:A.height-t-R};if(o.item.node.children.length&&G.width>=z&&G.height>=z){const D=e.length;s(o.item.node,G,M+1,A.item.index,A.path),A.children=e.length>D}}};return s(q.root,{x:C.left,y:C.top,width:C.width,height:C.height},0,0,[]),e}function K(ne){const C=ne.scheme||B();new ce(ne.groups.grid).finish(),new ce(ne.groups.axis).finish(),new ce(ne.groups.rules).finish(),new ce(ne.groups.labels).finish();const q=X(ne),z=ne.typography&&ne.typography.small||ne.fontSize||11,t=ne.fill?P(ne,C):null,e=new ce(ne.groups.marks);for(const[d,p]of q.entries())ve(e.next("rect",`${J}__tile ${J}__mark${p.children?` ${J}__tile--branch`:""}`),{x:xe(p.x),y:xe(p.y),width:xe(Math.max(0,p.width)),height:xe(Math.max(0,p.height)),fill:L(t,p.item.node,C.series(p.item.index)),"fill-opacity":p.children?i:h(p.depth),"data-point":p.item.index,"data-tile":d,"data-depth":p.depth});e.finish();const s=new ce(ne.groups.overlay);for(const d of q){if(d.width<O||d.height<ne.fontSize*1.6)continue;const p=String(d.item.node.label??""),M=b(p,d.width-Q*2,z);if(M!==p&&M.length<w)continue;const ee=s.next("text",`${J}__tile-label${d.children?` ${J}__tile-label--branch`:""}`);ve(ee,{x:xe(d.x+Q),y:xe(d.y+ne.fontSize+2),"text-anchor":"start"}),u(ee,z),ie(ee,M)}return s.finish(),ne.labels&&ne.labels.show&&U({group:ne.groups.labels,size:z,minGap:ne.labels.minGap,anchors:q.filter(d=>!d.children&&d.width>=O&&d.height>=ne.fontSize*1.6+z).sort((d,p)=>p.width*p.height-d.width*d.height).map(d=>({x:xe(d.x+Q),y:xe(d.y+ne.fontSize*2+4),text:v(d.item.value,ne.labels,ne.grid),anchor:"start",inside:!0,width:d.width-Q*2}))}),{tiles:q}}function pe(ne){let C=null;for(const q of ne.tiles)ne.x>=q.x&&ne.x<=q.x+q.width&&ne.y>=q.y&&ne.y<=q.y+q.height&&(!C||(q.depth||1)>(C.depth||1))&&(C=q);return C}}),it("packages/modules/charts/annotate-items.js",function(n,re){"use strict";Object.defineProperty(n,"ANNOTATION_TOOLS",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"LEGACY_MEASURE_TOOLS",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(n,"MEASURE_KINDS",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"ANCHORS",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"PEN_MAX_POINTS",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"isSafeColour",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"simplifyStroke",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"ITEM_KINDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(n,"TEXT_KINDS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"FIB_LEVELS",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"nextItemId",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"resolveAnnotate",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"normaliseAnchor",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"normaliseItem",{enumerable:!0,get:function(){return O}}),Object.defineProperty(n,"serialiseItem",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"itemsFromState",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"fibLevels",{enumerable:!0,get:function(){return R}}),Object.defineProperty(n,"anchorsFor",{enumerable:!0,get:function(){return i}});const ce=re("packages/core/src/internal/util.js").warnOnce,N=Object.freeze(["select","trendLine","horizontalLine","verticalLine","channel","fibonacci","arrow","pen","measure","text","callout","note","delete"]),ve=Object.freeze({"measure-x":"x","measure-y":"y","measure-xy":"xy"}),xe=Object.freeze(["measure-x","measure-y","measure-xy","measure"]),ie=Object.freeze({trendLine:2,horizontalLine:1,verticalLine:1,channel:3,fibonacci:2,pen:2,arrow:2,"measure-x":2,"measure-y":2,"measure-xy":2,measure:2,text:1,callout:2,note:1}),ae=2e3,J=24;function ue(x){return typeof x=="string"&&/^[#\w\s().,%-]+$/.test(x)}function B(x,T){if(x.length<3)return x.slice();const h=new Array(x.length).fill(!1);h[0]=!0,h[x.length-1]=!0;const g=[[0,x.length-1]];for(;g.length;){const[j,X]=g.pop(),K=x[j],pe=x[X],ne=pe.x-K.x,C=pe.y-K.y,q=ne*ne+C*C;let z=-1,t=T;for(let e=j+1;e<X;e++){const s=x[e],d=q?Math.max(0,Math.min(1,((s.x-K.x)*ne+(s.y-K.y)*C)/q)):0,p=Math.hypot(s.x-(K.x+d*ne),s.y-(K.y+d*C));p>t&&(t=p,z=e)}z>=0&&(h[z]=!0,g.push([j,z],[z,X]))}return x.filter((j,X)=>h[X])}const f=Object.freeze(Object.keys(ie)),L=Object.freeze(["text","callout","note"]),P=Object.freeze([0,23.6,38.2,50,61.8,78.6,100]);let W=0;function U(){return W+=1,`ann-${W}`}function v(x,T){const h={enabled:!1,tools:[],rail:"none",readOnly:!1,measure:{volume:null,snap:!0,pin:!1,axes:"xy"},pen:{colour:null,width:null}},g=T===!0?{}:T&&typeof T=="object"?T:null,j=x===!0||!!x&&typeof x=="object";if(!j&&!g)return h;const X=x===!0||!j?{}:x,K=Array.isArray(X.tools)?X.tools:null;if(K){const M=K.filter(H=>!N.includes(H)&&!ve[H]),ee=K.filter(H=>ve[H]);ee.length&&ce(`chart:annotate:tools:legacy:${ee.join(",")}`,`chart annotate.tools lists ${ee.map(H=>JSON.stringify(H)).join(", ")}, which ${ee.length>1?"are":"is"} deprecated: the rail has one "measure" tool now. Use "measure" with measure: { axes: 'x' | 'y' | 'xy' }.`),M.length&&ce(`chart:annotate:tools:${M.join(",")}`,`chart annotate.tools names ${M.length} tool(s) this chart does not have: ${M.map(H=>JSON.stringify(H)).join(", ")}. The tools are ${N.join(", ")}.`)}const pe=K?K.map(M=>ve[M]?"measure":M):null;let ne=N.filter(M=>pe?pe.includes(M):!0);const C=K?[...new Set(K.filter(M=>ve[M]).map(M=>ve[M]))]:[],q=C.length===1?C[0]:C.length?"xy":null;let z=X.rail==="top"||X.rail==="none"?X.rail:"left";const t=X.measure&&typeof X.measure.volume=="string"&&X.measure.volume?X.measure.volume:null,e=X.measure&&typeof X.measure=="object"?X.measure:{};g&&(j?ne.includes("measure")||(ne=N.filter(M=>M==="measure"||ne.includes(M))):(ne=["measure"],z="top"));const s=M=>M==="x"||M==="y"||M==="xy"?M:null,d=s(g&&g.axes)||s(e.axes)||q||"xy",p=(M,ee)=>g&&typeof g[M]=="boolean"?g[M]:typeof e[M]=="boolean"?e[M]:ee;return{enabled:!0,tools:ne,rail:z,readOnly:X.readOnly===!0,measure:{volume:t,snap:p("snap",!0),pin:p("pin",!1),axes:d},pen:m(X.pen)}}function m(x){const T=x&&typeof x=="object"?x:{},h=Number(T.width);return{colour:ue(T.colour)?T.colour:null,width:h>0?Math.min(J,h):null}}function u(x){return typeof x=="string"?x!=="":typeof x=="number"?Number.isFinite(x):x instanceof Date&&Number.isFinite(x.getTime())}function b(x){if(!x||typeof x!="object")return null;const T=x,h=Number(T.y);return!Number.isFinite(h)||!u(T.x)?null:{x:T.x instanceof Date?new Date(T.x.getTime()):T.x,y:h}}function O(x){if(!x||typeof x!="object")return null;const T=x,h=String(T.kind||"");if(!ie[h])return ce(`chart:annotate:kind:${h}`,`a drawn chart annotation of kind ${JSON.stringify(h)} was not restored: the kinds are ${f.join(", ")}.`),null;const g=(Array.isArray(T.anchors)?T.anchors:[]).map(b).filter(Boolean),j=h==="pen";if(g.length<ie[h])return ce(`chart:annotate:anchors:${h}`,`a drawn chart annotation of kind ${JSON.stringify(h)} was not restored: it needs ${ie[h]} data anchor(s) and carried ${g.length}.`),null;const X={id:typeof T.id=="string"&&T.id?T.id:U(),kind:h,anchors:g.slice(0,j?ae:ie[h])};return typeof T.text=="string"&&(X.text=T.text),typeof T.colour=="string"&&T.colour&&(h!=="pen"||ue(T.colour))&&(X.colour=T.colour),T.readOnly===!0&&(X.readOnly=!0),(h==="measure"||h==="pen")&&T.axis==="right"&&(X.axis="right"),h==="pen"&&Number(T.width)>0&&(X.width=Math.min(J,Number(T.width))),X}function Q(x){const T={id:x.id,kind:x.kind,anchors:x.anchors.map(h=>({x:h.x instanceof Date?h.x.toISOString():h.x,y:h.y}))};return x.text!==void 0&&(T.text=x.text),x.colour!==void 0&&(T.colour=x.colour),x.readOnly&&(T.readOnly=!0),x.axis&&(T.axis=x.axis),x.width!==void 0&&(T.width=x.width),T}function w(x){if(Array.isArray(x))return x.map(O).filter(Boolean);if(x&&typeof x=="object"){const T=x;if(Array.isArray(T.annotations))return T.annotations.map(O).filter(Boolean)}return[]}function R(x,T){const h=T.y-x.y;return P.map(g=>({level:g,y:x.y+h*g/100}))}function i(x,T,h){if(ie[x]===1)return[T];if(x==="channel"){const g=(h.y-T.y)/4||Math.abs(h.y||1)/10;return[T,h,{x:h.x,y:h.y+g}]}return[T,h]}}),it("packages/modules/charts/annotate-measure.js",function(n,re){"use strict";Object.defineProperty(n,"xSpan",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"naturalDuration",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"measureReadout",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"durationParts",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"deltaReadout",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"deltaLines",{enumerable:!0,get:function(){return f}});const Se=re("packages/modules/charts/scale.js"),ce=Se.key,N=Se.toNumber,ve=Se.toTime;function xe(L,P,W,U,v=!1){if(!Array.isArray(L)||!L.length)return null;if(U){const x=L.findIndex(j=>ce(j)===ce(P)),T=L.findIndex(j=>ce(j)===ce(W));if(x<0||T<0)return null;const h=Math.min(x,T),g=Math.max(x,T);return{count:g-h+1,from:h,to:g}}const m=v?ve:N,u=m(P),b=m(W);if(u===null||b===null)return null;const O=Math.min(u,b),Q=Math.max(u,b);let w=0,R=-1,i=-1;for(let x=0;x<L.length;x++){const T=m(L[x]);T===null||T<O||T>Q||(R<0&&(R=x),i=x,w+=1)}return w?{count:w,from:R,to:i}:null}function ie(L){const P=[["years",31536e6],["months",2592e6],["weeks",6048e5],["days",864e5],["hours",36e5],["minutes",6e4]];for(const[W,U]of P)if(L>=U)return{unit:W,count:Math.round(L/U)};return{unit:"seconds",count:Math.round(L/1e3)}}function ae(L,P,W){const[U,v]=P;if(L==="measure")return U&&v?B(U,v,W):{};const m={};if((L==="measure-x"||L==="measure-xy")&&U&&v){const u=xe(W.categories,U.x,v.x,!!W.band,!!W.timeAxis);if(u){if(m.count=u.count,m.countUnit=W.candles?"bars":"points",W.timeAxis){const b=ve(U.x),O=ve(v.x);b!==null&&O!==null&&(m.elapsedMs=Math.abs(O-b),m.elapsed=ie(m.elapsedMs))}if(W.volumeSeries){let b=0,O=!1;for(let Q=u.from;Q<=u.to;Q++){const w=W.volumeSeries.points[Q];w&&Number.isFinite(w.y)&&(b+=w.y,O=!0)}O&&(m.volume=b)}}}return(L==="measure-y"||L==="measure-xy")&&U&&v&&(m.change=v.y-U.y,m.changePercent=U.y?(v.y-U.y)/Math.abs(U.y)*100:null),m}const J=24*3600*1e3;function ue(L){let P=Math.round(Math.abs(L));const W=[["d",J],["h",36e5],["min",6e4],["s",1e3],["ms",1]],U=[];for(const[v,m]of W){if(P>=m){const u=Math.floor(P/m);P-=u*m,u&&U.push({unit:v,count:u})}if(U.length===2)break}return U.length?U:[{unit:"s",count:0}]}function B(L,P,W){const U={},v=P.y-L.y;Number.isFinite(v)&&(U.change=v,U.changePercent=L.y?v/Math.abs(L.y)*100:null);let m=null;if(W.timeAxis){const u=ve(L.x),b=ve(P.x);u!==null&&b!==null&&(U.dxKind="time",U.dx=b-u,U.elapsedMs=Math.abs(b-u),U.duration=ue(U.elapsedMs),m=(b-u)/J,U.slopeUnit="day")}else if(W.band){const u=W.categories||[],b=u.findIndex(Q=>ce(Q)===ce(L.x)),O=u.findIndex(Q=>ce(Q)===ce(P.x));b>=0&&O>=0&&(U.dxKind="category",U.dx=O-b,m=O-b,U.slopeUnit="category")}else{const u=N(L.x),b=N(P.x);u!==null&&b!==null&&(U.dxKind="number",U.dx=b-u,m=b-u,U.slopeUnit="unit")}return m?U.slope=v/m:delete U.slopeUnit,U}function f(L,P,W,U){const v=[];if(!L)return v;const m=(u,b)=>`${u>0?"+":""}${b}`;if(L.dx!==void 0){let u;L.dxKind==="time"?u=L.duration.map(b=>P(`chart.annotate.measure.dur.${b.unit}`,{count:b.count})).join(" "):L.dxKind==="category"?u=P("chart.annotate.measure.categories",{count:Math.abs(L.dx)}):u=U(L.dx),v.push(P("chart.annotate.measure.dx",{value:L.dx<0?`-${u}`:u}))}if(L.change!==void 0){const u=L.changePercent===null||L.changePercent===void 0?"":` (${P("chart.annotate.measure.pct",{value:m(L.changePercent,U(L.changePercent,1))})})`;v.push(P("chart.annotate.measure.dy",{value:`${m(L.change,W(L.change))}${u}`}))}if(L.slope!==void 0){const u=L.slopeUnit==="day"?"perDay":L.slopeUnit==="category"?"perCategory":"perUnit";v.push(P(`chart.annotate.measure.slope.${u}`,{value:m(L.slope,U(L.slope))}))}return v}}),it("packages/modules/charts/cursor.js",function(n,re){"use strict";Object.defineProperty(n,"GROUP_TOOLTIPS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"resolveCursor",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"buildStops",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"nearestStop",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"stopForMessage",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"joinGroup",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"tellGroup",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"groupSize",{enumerable:!0,get:function(){return R}}),Object.defineProperty(n,"createCursorView",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"ChartCursor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(n,"CURSOR_CLASSES",{enumerable:!0,get:function(){return T}});const Se=re("packages/modules/charts/scale.js"),ce=Se.isNumber,N=Se.key,ve=Se.toNumber,xe=Se.toTime,ie=re("packages/modules/charts/svg.js"),ae=ie.clear,J=ie.svg,B=re("packages/modules/charts/styles.js").NS,f=["shared","single"],L=["pointer","all"];function P(h){const g=h&&h.cursor;if(!g)return null;const j=g===!0?{}:typeof g=="object"?g:{};let X="shared";return j.tooltip===!1||j.tooltip==="none"?X=!1:f.includes(j.tooltip)&&(X=j.tooltip),{x:j.x!==!1,y:j.y===!0,snap:j.snap==="none"?"none":"nearest",labels:j.labels!==!1,tooltip:X,groupTooltips:L.includes(j.groupTooltips)?j.groupTooltips:"pointer",group:typeof j.group=="string"&&j.group?j.group:null,zoom:j.zoom===!0,rowHover:j.rowHover===!0}}function W(h,g){if(h.kind==="band")return h.centre(g.x);const j=h.kind==="time"?xe(g.x):ve(g.x);return j===null?NaN:h.of(j)}function U(h){const{series:g,xScale:j}=h,X=new Map;for(const pe of g||[]){const ne=pe.points||[];for(let C=0;C<ne.length;C++){const q=ne[C];if(!q||!ce(q.y))continue;const z=W(j,q);if(Number.isNaN(z))continue;const t=j.kind==="band"?N(q.x):String(j.kind==="time"?xe(q.x):ve(q.x));let e=X.get(t);e||(e={key:t,x:q.x,value:j.kind==="band"?null:j.kind==="time"?xe(q.x):ve(q.x),px:z,label:q.label!==void 0&&q.label!==null?String(q.label):String(q.x),index:Array.isArray(pe.kept)?pe.kept[C]:C,entries:[]},X.set(t,e)),e.entries.some(s=>s.series===pe)||e.entries.push({series:pe,point:q})}}return{stops:[...X.values()].sort((pe,ne)=>pe.px-ne.px),byKey:X}}function v(h,g){if(!h.length)return-1;let j=0,X=h.length-1;for(;j<X;){const K=j+X>>1;h[K].px<g?j=K+1:X=K}return j>0&&Math.abs(h[j-1].px-g)<=Math.abs(h[j].px-g)?j-1:j}function m(h,g,j){if(g.kind==="band")return{stop:h.byKey.get(j.key)||null,value:null};let X=Number.isFinite(j.value)?j.value:null;if(X===null&&(X=g.kind==="time"?xe(j.x):ve(j.x)),X===null||!Number.isFinite(X))return{stop:null,value:null};const{min:K,max:pe}=g.domain;if(X<K||X>pe)return{stop:null,value:null};if(!h.stops.length)return{stop:null,value:X};let ne=null,C=1/0;for(const q of h.stops){const z=Math.abs(q.value-X);z<C&&(C=z,ne=q)}return{stop:ne,value:X}}const u=Symbol.for("lattice.chart.cursor.groups");function b(){return globalThis[u]||(globalThis[u]=new Map),globalThis[u]}let O=!1;function Q(h,g){const j=b();return j.has(h)||j.set(h,new Set),j.get(h).add(g),()=>{const X=j.get(h);X&&(X.delete(g),X.size||j.delete(h))}}function w(h,g,j,X){if(O)return;const K=b().get(h);if(K){O=!0;try{for(const pe of[...K])pe!==g&&pe[j](X)}finally{O=!1}}}function R(h){const g=b().get(h);return g?g.size:0}function i(h,g){const j=J(h,"g",{class:`${B}__cursor`,"aria-hidden":"true"});j.setAttribute("pointer-events","none"),g.appendChild(j);const X=(K,pe,ne,C,q)=>{const z=Math.ceil(String(K).length*q*.6)+8,t=q+6,e=C==="end"?pe-z:C==="middle"?pe-z/2:pe;j.appendChild(J(h,"rect",{class:`${B}__cursor-label`,x:Math.round(e),y:Math.round(ne-t/2),width:z,height:t,rx:2}));const s=J(h,"text",{class:`${B}__cursor-label-text`,x:Math.round(e+z/2),y:Math.round(ne),"text-anchor":"middle","dominant-baseline":"central"});s.textContent=String(K),j.appendChild(s)};return{element:j,show(K){ae(j);const{plot:pe,horizontal:ne,size:C}=K;if(K.cat){const q=K.cat.pos;j.appendChild(J(h,"line",ne?{class:`${B}__cursor-line`,"data-axis":"x",x1:pe.left,x2:pe.right,y1:q,y2:q}:{class:`${B}__cursor-line`,"data-axis":"x",x1:q,x2:q,y1:pe.top,y2:pe.bottom}))}if(K.val){const q=K.val.pos;j.appendChild(J(h,"line",ne?{class:`${B}__cursor-line`,"data-axis":"y",x1:q,x2:q,y1:pe.top,y2:pe.bottom}:{class:`${B}__cursor-line`,"data-axis":"y",x1:pe.left,x2:pe.right,y1:q,y2:q}))}K.labels&&(K.cat&&K.cat.text&&(ne?X(K.cat.text,pe.left-3,K.cat.pos,"end",C):X(K.cat.text,K.cat.pos,pe.bottom+C,"middle",C)),K.val&&K.val.text&&(ne?X(K.val.text,K.val.pos,pe.bottom+C,"middle",C):X(K.val.text,pe.left-3,K.val.pos,"end",C)),K.val&&K.val2&&K.val2.text&&!ne&&X(K.val2.text,pe.right+3,K.val.pos,"start",C))},hide(){ae(j)},destroy(){j.parentNode&&j.parentNode.removeChild(j)}}}class x{#r;#n=null;#i=null;#t=null;#s=null;#l=-1;#o=null;#a=null;constructor(g){this.#r=g,this.member={follow:j=>this.#k(j),unfollow:()=>this.#O(),zoomTo:j=>this.#r.zoomX(j)}}refresh(){const g=this.#r.options(),j=g&&g.group;if(j!==this.#a&&(this.#o&&this.#o(),this.#o=j?Q(j,this.member):null,this.#a=j||null),this.#i=null,this.#t=null,!g||!this.#m()){this.#p(),this.#s=null;return}if(this.#s){const X=this.#f().byKey.get(this.#s.key);X?this.#c({stop:X,source:this.#s.source,quiet:!0}):(this.#p(),this.#s=null)}}#m(){const g=this.#r.drawn();return!!(g&&g.xScale&&g.plot&&g.xScale.range&&this.#r.series().length)}#f(){const g=this.#r.drawn();return(!this.#i||this.#t!==g)&&(this.#i=U({series:this.#r.series(),xScale:g.xScale}),this.#t=g),this.#i}#M(){return this.#n||(this.#n=i(this.#r.doc,this.#r.svg())),this.#n}#p(){this.#n&&this.#n.hide(),this.#r.hideTooltip()}pointer(g,j){const X=this.#r.options();if(!X||!this.#m())return;const K=this.#r.drawn(),pe=K.plot;if(j.x<pe.left||j.x>pe.right||j.y<pe.top||j.y>pe.bottom){this.leave();return}const ne=K.horizontal?j.y:j.x,C=this.#f(),q=v(C.stops,ne);if(q<0){this.leave();return}this.#l=q,this.#c({stop:C.stops[q],pointer:K.horizontal?j.x:j.y,free:X.snap==="none"?ne:null,source:"pointer",client:g})}leave(){!this.#s&&!(this.#n&&this.#n.element.firstChild)||(this.#s=null,this.#l=-1,this.#p(),this.#r.left({source:"pointer"}),this.#a&&w(this.#a,this.member,"unfollow"))}#c(g){const j=this.#r.options(),X=this.#r.drawn(),{stop:K}=g,pe=j.snap==="none",ne=X.xScale.kind!=="band";let C=K.px,q=K.value;pe&&g.free!==void 0&&g.free!==null?(C=g.free,ne&&(q=X.xScale.invert(g.free))):pe&&ne&&g.value!==void 0&&g.value!==null&&(C=X.xScale.of(g.value),q=g.value);const z=X.plot;this.#s={key:K.key,source:g.source};let t=null;if(j.y&&g.pointer!==void 0&&g.pointer!==null){const p=X.horizontal?z.left:z.top,M=X.horizontal?z.right:z.bottom,ee=Math.max(p,Math.min(M,g.pointer)),H=X.yScale,F=H&&typeof H.invert=="function"?H.invert(ee):NaN;if(Number.isFinite(F)&&(t={pos:ee,text:this.#r.formatY(F)},X.rightScale&&typeof X.rightScale.invert=="function"&&!X.horizontal)){const o=X.rightScale.invert(ee);Number.isFinite(o)&&(t.text2=this.#r.formatY2(o))}}this.#M().show({plot:z,horizontal:!!X.horizontal,size:this.#r.size(),labels:j.labels,cat:j.x?{pos:C,text:this.#r.formatX(K,q)}:null,val:t,val2:t&&t.text2?{text:t.text2}:null});const e=j.tooltip,s=this.#r.rows(K,e||"shared",g.pointer===void 0?null:g.pointer);if(e&&(g.source!=="group"||j.groupTooltips==="all")){const p=g.client&&Number.isFinite(g.client.clientX)?g.client:this.#r.clientAt(X.horizontal?z.left+8:C,X.horizontal?C:z.top+8);this.#r.showTooltip(s.heading,s.rows,p)}else this.#r.hideTooltip();if(g.quiet)return;g.source!=="pointer"&&g.source!=="group"&&this.#r.announce(`${s.heading}: ${s.rows.map(p=>`${p.label} ${p.value}`).join(", ")}`);const d={x:K.x,key:K.key,label:K.label,values:s.rows.map((p,M)=>({series:p.label,value:p.value,raw:s.raw?s.raw[M]:null})),source:g.source};this.#r.moved(d),this.#a&&g.source!=="group"&&w(this.#a,this.member,"follow",{key:K.key,value:K.value,x:K.x,label:K.label})}#k(g){if(!this.#r.options()||!this.#m())return;const X=this.#r.drawn(),K=m(this.#f(),X.xScale,g);if(!K.stop){this.#s&&(this.#s=null,this.#p());return}this.#c({stop:K.stop,source:"group",value:K.value,free:null})}#O(){this.#s&&(this.#s=null,this.#p(),this.#r.left({source:"group"}))}set(g,j="api"){if(!this.#r.options()||!this.#m())return!1;const X=this.#r.drawn(),K=this.#f();let pe=null,ne=null;if(X.xScale.kind==="band")pe=K.byKey.get(N(g))||K.stops.find(C=>C.label===String(g))||null;else{const C=m(K,X.xScale,{key:"",value:null,x:g});pe=C.stop,ne=C.value}return pe?(this.#l=K.stops.indexOf(pe),this.#c({stop:pe,source:j,value:ne}),!0):!1}clear(g="api"){this.#s&&(this.#s=null,this.#l=-1,this.#p(),this.#r.left({source:g}),this.#a&&w(this.#a,this.member,"unfollow"))}get(){if(!this.#s||!this.#m())return null;const g=this.#f().byKey.get(this.#s.key);return g?{x:g.x,key:g.key,label:g.label}:null}key(g){if(!this.#r.options()||!this.#m())return!1;const X=this.#r.drawn(),K=X.horizontal?"ArrowUp":"ArrowLeft",pe=X.horizontal?"ArrowDown":"ArrowRight",ne=g.key;if(ne!==K&&ne!==pe&&ne!=="Home"&&ne!=="End"&&ne!=="Escape")return!1;if(ne==="Escape")return this.#s?(this.clear(),g.preventDefault&&g.preventDefault(),!0):!1;const{stops:C}=this.#f();if(!C.length)return!1;let q;return ne==="Home"?q=0:ne==="End"?q=C.length-1:this.#l<0?q=ne===pe?0:C.length-1:q=Math.max(0,Math.min(C.length-1,this.#l+(ne===pe?1:-1))),this.#l=q,this.#c({stop:C[q],source:"keyboard",value:C[q].value}),g.preventDefault&&g.preventDefault(),!0}zoomed(g){const j=this.#r.options();!j||!j.zoom||!this.#a||w(this.#a,this.member,"zoomTo",g)}get active(){return!!this.#s}get source(){return this.#s?this.#s.source:null}destroy(){this.#o&&this.#o(),this.#o=null,this.#a=null,this.#n&&this.#n.destroy(),this.#n=null,this.#s=null}}const T=Object.freeze({group:`${B}__cursor`,line:`${B}__cursor-line`,label:`${B}__cursor-label-text`})}),it("packages/modules/charts/annotate-rail.js",function(n,re){"use strict";Object.defineProperty(n,"buildRail",{enumerable:!0,get:function(){return J}});const Se=re("packages/modules/charts/svg.js"),ce=Se.attrs,N=Se.el,ve=Se.svg,ie=re("packages/modules/charts/styles.js").NS,ae=Object.freeze({select:"M3 2 L12 8 L8 9 L10 13 L8 14 L6 10 L3 12 Z",trendLine:"M2 13 L14 4 M2 13 m-1.5 0 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0 M14 4 m-1.5 0 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0",horizontalLine:"M1 8 L15 8",verticalLine:"M8 1 L8 15",channel:"M2 12 L14 5 M2 15 L14 8",fibonacci:"M1 2 L15 2 M1 6 L15 6 M1 10 L15 10 M1 14 L15 14",arrow:"M2 14 L13 3 M13 3 L8 3 M13 3 L13 8",pen:"M2 12 C4 6 6 14 8 8 S11 4 13 3 M12 2 L14 4",measure:"M3 13 L13 3 M3 13 L13 13 L13 3 M3 13 m-1.5 0 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0 M13 3 m-1.5 0 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0",text:"M3 3 L13 3 M8 3 L8 13 M6 13 L10 13",callout:"M2 2 L11 2 L11 9 L7 9 L4 13 L4 9 L2 9 Z",note:"M8 14 L8 8 M8 8 m-3 -3 a3 3 0 1 1 6 0 a3 3 0 1 1 -6 0",delete:"M3 4 L13 4 M6 4 L6 2 L10 2 L10 4 M4 4 L5 14 L11 14 L12 4 Z"});function J(ue){const{doc:B,t:f}=ue,L=N(B,"div",`${ie}__annotate-rail ${ie}__annotate-rail--${ue.place}`);L.setAttribute("role","toolbar"),L.setAttribute("aria-label",f("chart.annotate.rail")),L.setAttribute("aria-orientation",ue.place==="top"?"horizontal":"vertical");const P=new Map;for(const m of ue.tools){const u=N(B,"button",`${ie}__annotate-tool`);u.setAttribute("type","button"),u.setAttribute("data-tool",m);const b=f(`chart.annotate.${m}`);u.setAttribute("aria-label",b),u.setAttribute("title",b),m!=="delete"&&u.setAttribute("aria-pressed","false");const O=ve(B,"svg",{class:`${ie}__annotate-icon`,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false"});O.appendChild(ve(B,"path",{d:ae[m]||ae.select})),u.appendChild(O),u.setAttribute("tabindex",P.size?"-1":"0"),u.addEventListener("click",()=>ue.onTool(m)),L.appendChild(u),P.set(m,u)}const W=m=>{const u=[...P.values()];if(!u.length)return;const b=Math.max(0,Math.min(u.length-1,m));for(let O=0;O<u.length;O++)u[O].setAttribute("tabindex",O===b?"0":"-1");u[b].focus&&u[b].focus()},U=m=>{const u=[...P.values()],b=u.indexOf(m.target);if(b<0)return;const O={ArrowDown:b+1,ArrowRight:b+1,ArrowUp:b-1,ArrowLeft:b-1,Home:0,End:u.length-1};m.key in O&&(W(O[m.key]),m.preventDefault&&m.preventDefault(),m.stopPropagation&&m.stopPropagation())};return L.addEventListener("keydown",U),{element:L,sync:m=>{for(const[u,b]of P)u!=="delete"&&ce(b,{"aria-pressed":u===m?"true":"false"})}}}}),it("packages/modules/charts/annotate-layer.js",function(n,re){"use strict";Object.defineProperty(n,"projector",{enumerable:!0,get:function(){return H}}),Object.defineProperty(n,"smoothPath",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"shapeOf",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"ChartAnnotations",{enumerable:!0,get:function(){return _}});const ce=re("packages/modules/charts/frame.js").Pool,ve=re("packages/modules/charts/annotations.js").overlayLayer,xe=re("packages/modules/charts/scale.js"),ie=xe.toNumber,ae=xe.toTime,J=re("packages/modules/charts/annotate-items.js"),ue=J.ANCHORS,B=J.anchorsFor,f=J.fibLevels,L=J.itemsFromState,P=J.LEGACY_MEASURE_TOOLS,W=J.MEASURE_KINDS,U=J.nextItemId,v=J.normaliseItem,m=J.serialiseItem,u=J.simplifyStroke,b=J.TEXT_KINDS,O=re("packages/modules/charts/annotate-measure.js"),Q=O.deltaLines,w=O.measureReadout,i=re("packages/modules/charts/cursor.js").buildStops,T=re("packages/modules/charts/annotate-rail.js").buildRail,h=re("packages/modules/charts/svg.js"),g=h.attrs,j=h.el,X=h.path,K=h.round,pe=h.setText,ne=h.SVG_NS,q=re("packages/modules/charts/styles.js").NS,z=9,t=6,e=4,s=24,d="measure-transient",p=4;function M(a,y){let r=null,k=1/0;for(const l of a.domain||[]){const I=a.centre(l);if(!Number.isFinite(I))continue;const E=Math.abs(I-y);E<k&&(k=E,r=l)}return r}function ee(a){if(a.plot&&Number.isFinite(a.plot.left))return a.plot;const y=a.xScale.range||[0,0],r=a.yScale.range||[0,0],k=a.horizontal?r:y,l=a.horizontal?y:r;return{left:Math.min(k[0],k[1]),right:Math.max(k[0],k[1]),top:Math.min(l[0],l[1]),bottom:Math.max(l[0],l[1])}}function H(a,y){if(!a)return null;const{xScale:r}=a,k=y==="right"&&a.rightScale?a.rightScale:a.yScale;if(!r||!k||typeof r.of!="function"||typeof k.of!="function"||typeof k.invert!="function")return null;const l=r.kind==="band";if(!l&&typeof r.invert!="function")return null;const I=!!a.horizontal,E=ee(a),Y=le=>{if(l)return r.centre(le);const ye=r.kind==="time"?ae(le):ie(le);return ye===null?NaN:r.of(ye)},se=le=>l?M(r,le):r.invert(le);return{plot:E,toPixel(le){const ye=Y(le.x),be=k.of(le.y);return!Number.isFinite(ye)||!Number.isFinite(be)?null:I?{x:be,y:ye}:{x:ye,y:be}},toData(le,ye){const be=I?ye:le,Ae=I?le:ye,Ne=se(be),te=k.invert(Ae);return Ne==null||!Number.isFinite(te)?null:{x:Ne,y:te}}}}function F(a){if(!a.length)return"";const y=["M",K(a[0].x),K(a[0].y)];if(a.length===1)return X(y);if(a.length===2)return X([...y,"L",K(a[1].x),K(a[1].y)]);for(let k=1;k<a.length-1;k++){const l=(a[k].x+a[k+1].x)/2,I=(a[k].y+a[k+1].y)/2;y.push("Q",K(a[k].x),K(a[k].y),K(l),K(I))}const r=a[a.length-1];return y.push("L",K(r.x),K(r.y)),X(y)}function o(a,y,r){const k=r.x-y.x,l=r.y-y.y,I=k*k+l*l,E=I?Math.max(0,Math.min(1,((a.x-y.x)*k+(a.y-y.y)*l)/I)):0;return Math.hypot(a.x-(y.x+E*k),a.y-(y.y+E*l))}function A(a,y){if(a instanceof Date)return a.toISOString().slice(0,10);if(typeof a=="string")return a;const r=Number(a);return Number.isFinite(r)?Math.abs(r)>1e12?new Date(r).toISOString().slice(0,10):y(r):String(a)}function G(a,y,r,k){const l=a.anchors.map(Y=>y.toPixel(Y));if(l.some(Y=>!Y))return null;const{plot:I}=y,E={handles:l,segments:[],fill:null,dots:[],labels:[],title:""};if(a.kind==="pen")return E.handles=[],E.stroke=l,E;if(a.kind==="trendLine"||a.kind==="arrow")return E.segments.push({from:l[0],to:l[1],arrow:a.kind==="arrow"}),E;if(a.kind==="horizontalLine"||a.kind==="verticalLine"){const Y=a.kind==="horizontalLine",se=l[0],le=Y?{x:I.left,y:se.y}:{x:se.x,y:I.top},ye=Y?{x:I.right,y:se.y}:{x:se.x,y:I.bottom};return E.segments.push({from:le,to:ye,dashed:!0}),E.labels.push({x:ye.x-(Y?4:-4),y:ye.y-(Y?4:0),text:Y?r(a.anchors[0].y):A(a.anchors[0].x,r),anchor:Y?"end":"start"}),E}if(a.kind==="channel"){const[Y,se,le]=l,ye=se.x-Y.x,be=ye?Y.y+(le.x-Y.x)/ye*(se.y-Y.y):Y.y,Ae=le.y-be,Ne={x:Y.x,y:Y.y+Ae},te={x:se.x,y:se.y+Ae};return E.segments.push({from:Y,to:se}),E.segments.push({from:Ne,to:te}),E.fill=[Y,se,te,Ne],E}if(a.kind==="fibonacci"){const Y=Math.min(l[0].x,l[1].x),se=Math.max(l[0].x,l[1].x);for(const le of f(a.anchors[0],a.anchors[1])){const ye=y.toPixel({x:a.anchors[0].x,y:le.y});ye&&(E.segments.push({from:{x:Y,y:ye.y},to:{x:se,y:ye.y},dashed:le.level!==0}),E.labels.push({x:se+4,y:ye.y-3,text:`${le.level}% · ${r(le.y)}`,anchor:"start"}))}return E}return a.kind==="callout"?(E.dots.push(l[0]),E.segments.push({from:l[0],to:l[1]}),E.labels.push({x:l[1].x+4,y:l[1].y,text:a.text||"",anchor:"start"}),E):W.includes(a.kind)?$(a,l,E,k):a.kind==="note"?(E.dots.push(l[0]),E.title=a.text||"",E):(E.labels.push({x:l[0].x,y:l[0].y,text:a.text||"",anchor:"start"}),E)}function D(a){return!(a>0)&&!(a<0)?null:a>0?"var(--lattice-success, #15803d)":"var(--lattice-danger, #b91c1c)"}function V(a,y,r){if(!a||a.count===void 0)return"";const k=[y(a.countUnit==="bars"?"chart.annotate.measure.bars":"chart.annotate.measure.points",{count:a.count})];return a.elapsed&&k.push(y(`chart.annotate.measure.${a.elapsed.unit}`,{count:a.elapsed.count})),a.volume!==void 0&&k.push(y("chart.annotate.measure.volume",{value:r(a.volume)})),k.join(" | ")}function de(a,y){if(!a||a.change===void 0)return"";const r=a.change>0?"+":"",k=a.changePercent===null||a.changePercent===void 0?"":` (${a.changePercent>0?"+":""}${Math.round(a.changePercent*10)/10}%)`;return`${r}${y(a.change)}${k}`}function $(a,y,r,k){const[l,I]=y,E=Math.min(l.x,I.x),Y=Math.max(l.x,I.x),se=Math.min(l.y,I.y),le=Math.max(l.y,I.y),ye=k?w(a.kind,a.anchors,k):{},be=k&&k.t,Ae=k&&k.format;if(a.kind==="measure"){r.segments.push({from:l,to:I}),r.segments.push({from:l,to:{x:I.x,y:l.y},dashed:!0}),r.segments.push({from:{x:I.x,y:l.y},to:I,dashed:!0}),r.fill=[{x:E,y:se},{x:Y,y:se},{x:Y,y:le},{x:E,y:le}];const Me=a.axis==="right",ke=k&&k.formatSide?k.formatSide(Me):Ae,we=be?Q(ye,be,ke,k.number):[];r.lines=we;const je=se-6-13*(we.length-1)>=12;return we.forEach((Pe,Ce)=>{r.labels.push({x:(E+Y)/2,y:je?se-6-13*(we.length-1-Ce):le+14+13*Ce,text:Pe,anchor:"middle",fill:Ce===1?D(ye.change):null})}),r}if(a.kind==="measure-xy"){r.segments.push({from:{x:E,y:se},to:{x:Y,y:se}}),r.segments.push({from:{x:Y,y:se},to:{x:Y,y:le}}),r.segments.push({from:{x:Y,y:le},to:{x:E,y:le}}),r.segments.push({from:{x:E,y:le},to:{x:E,y:se}}),r.fill=[{x:E,y:se},{x:Y,y:se},{x:Y,y:le},{x:E,y:le}];const Me=be?V(ye,be,Ae):"";Me&&r.labels.push({x:(E+Y)/2,y:se-6,text:Me,anchor:"middle"});const ke=be?de(ye,Ae):"";return ke&&r.labels.push({x:Y+6,y:(se+le)/2,text:ke,anchor:"start",fill:D(ye.change)}),r}if(a.kind==="measure-x"){const Me=(l.y+I.y)/2;r.segments.push({from:{x:E,y:Me},to:{x:Y,y:Me}}),r.segments.push({from:{x:E,y:Me-5},to:{x:E,y:Me+5}}),r.segments.push({from:{x:Y,y:Me-5},to:{x:Y,y:Me+5}});const ke=be?V(ye,be,Ae):"";return ke&&r.labels.push({x:(E+Y)/2,y:Me-6,text:ke,anchor:"middle"}),r}const Ne=(l.x+I.x)/2;r.segments.push({from:{x:Ne,y:se},to:{x:Ne,y:le}}),r.segments.push({from:{x:Ne-5,y:se},to:{x:Ne+5,y:se}}),r.segments.push({from:{x:Ne-5,y:le},to:{x:Ne+5,y:le}});const te=be?de(ye,Ae):"";return te&&r.labels.push({x:Ne+6,y:(se+le)/2,text:te,anchor:"start",fill:D(ye.change)}),r}class _{#r;#n;#i=[];#t=null;#s=null;#l=null;#o=null;#a=null;#m=null;#f=null;#M=null;#p=[];#c=null;#k=null;#O=null;constructor(y,r){this.#r=y,this.#n=r,this.#$(),this.configure(r)}#v(y){if(!W.includes(y.kind))return;const r=this.#b();if(!r)return;const k=w(y.kind,y.anchors,r);return Object.keys(k).length?k:void 0}get tool(){return this.#t}get busy(){return!!this.#o||!!this.#t&&this.#t!=="delete"}configure(y){const r=this.#n;this.#n=y;const k=r&&r.rail===y.rail&&r.tools.join()===y.tools.join()&&r.readOnly===y.readOnly;if(!(this.#a&&k)){if(this.#a&&(this.#a.element.parentNode&&this.#a.element.parentNode.removeChild(this.#a.element),this.#a=null),y.rail==="none"||y.readOnly||!y.tools.length){this.#r.root.classList.remove(`${q}--annotate-left`,`${q}--annotate-top`),this.use(null);return}this.#a=T({doc:this.#r.doc,t:this.#r.t,tools:y.tools,place:y.rail,onTool:l=>this.#z(l)}),this.#r.root.classList.remove(`${q}--annotate-left`,`${q}--annotate-top`),this.#r.root.classList.add(`${q}--annotate-${y.rail}`),this.#r.root.insertBefore(this.#a.element,this.#r.root.firstChild),this.#a.sync(this.#t)}}list(){return this.#i.map(m)}setItems(y){this.#i=L(y),this.#l=null,this.redraw()}use(y){this.#s=y&&P[y]?P[y]:null,this.#s&&(y="measure"),this.#t=y,this.#o=null,this.#c=null,this.#k=null,this.#a&&this.#a.sync(y),this.redraw()}add(y){if(this.#n.readOnly)return null;const r=v({id:U(),...y});return r?(this.#i.push(r),this.redraw(),this.#r.notify("added",m(r),this.#v(r)),r):null}remove(y){const r=this.#i.findIndex(l=>l.id===y);if(r<0||this.#n.readOnly||this.#i[r].readOnly)return!1;const[k]=this.#i.splice(r,1);return this.#l===y&&(this.#l=null),this.redraw(),this.#r.notify("removed",m(k),this.#v(k)),!0}setText(y,r){const k=this.#i.find(l=>l.id===y);return!k||this.#n.readOnly||k.readOnly?!1:(k.text=String(r),this.redraw(),this.#r.notify("changed",m(k),this.#v(k)),!0)}redraw(){const y=this.#r.groups&&this.#r.groups.overlay;if(!y)return;this.#m=ve(y,`${q}__drawn`);const r=new ce(this.#m),k=H(this.#r.drawn());if(k){const l=this.#r.format(),I=this.#b(l);for(const E of this.#i){const Y=G(E,this.#x(E.axis,k),l,I);Y&&this.#e(r,E,Y,E.id===this.#l)}if(this.#c){const E=G(this.#c,this.#x(this.#c.axis,k),l,I);E&&this.#e(r,this.#c,E,!1)}if(this.#o&&this.#o.preview){const E=G(this.#o.preview,this.#x(this.#o.preview.axis,k),l,I);E&&this.#e(r,this.#o.preview,E,!1)}}r.finish(),this.#r.described&&this.#r.described(this.describe())}#x(y,r){return y==="right"?H(this.#r.drawn(),"right"):r||H(this.#r.drawn())}#b(y){const r=this.#r.bound?this.#r.bound():null,k=this.#r.drawn();if(!r||!k||!k.xScale)return null;const l=k.xScale.kind==="band",I=!!k.candles,E=k.xScale.kind==="time"||I,Y=this.#n.measure&&this.#n.measure.volume;let se=null;return Array.isArray(r.series)&&(Y?se=r.series.find(le=>le.key===Y)||null:I&&r.series.length>4&&(se=r.series[4])),{categories:r.categories||[],band:l,timeAxis:E,candles:I,volumeSeries:se,t:this.#r.t,format:y||this.#r.format(),formatSide:this.#r.formatSide||(()=>y||this.#r.format()),number:this.#r.number||(le=>String(le))}}#e(y,r,k,l){if(k.fill){const I=[];for(const Y of k.fill)I.push(I.length?"L":"M",K(Y.x),K(Y.y));I.push("Z");const E=y.next("path",`${q}__drawn-fill`);g(E,{class:`${q}__drawn-fill`,"data-annotation-id":r.id,d:X(I),fill:r.colour||null})}if(k.stroke){const I=y.next("path",`${q}__drawn-pen`),E=r.width||this.#n.pen&&this.#n.pen.width||null,Y=r.colour||this.#n.pen&&this.#n.pen.colour||null,se=[Y?`stroke:${Y}`:"",E?`stroke-width:${E}px`:""].filter(Boolean).join(";");g(I,{class:`${q}__drawn-pen`,"data-annotation-id":r.id,"data-annotation-kind":"pen","data-selected":l?"true":null,style:se||null,d:F(k.stroke)})}for(const I of k.segments){const E=y.next("path",`${q}__drawn-line`),Y=["M",K(I.from.x),K(I.from.y),"L",K(I.to.x),K(I.to.y)];I.arrow&&Y.push(...oe(I.from,I.to)),g(E,{class:`${q}__drawn-line`,"data-annotation-id":r.id,"data-annotation-kind":r.kind,"data-transient":r.id===d?"true":null,"stroke-dasharray":I.dashed?"4 3":null,d:X(Y),stroke:r.colour||null})}for(const I of k.dots){const E=y.next("circle",`${q}__drawn-dot`);g(E,{class:`${q}__drawn-dot`,"data-annotation-id":r.id,cx:K(I.x),cy:K(I.y),r:3.5,fill:r.colour||null}),this.#d(E,k.title)}for(const I of k.labels){if(!I.text)continue;const E=y.next("text",`${q}__drawn-label`);g(E,{class:`${q}__drawn-label`,"data-annotation-id":r.id,x:K(I.x),y:K(I.y),"text-anchor":I.anchor,fill:I.fill||r.colour||null}),pe(E,I.text)}if(l)for(let I=0;I<k.handles.length;I++){const E=y.next("circle",`${q}__drawn-handle`);g(E,{class:`${q}__drawn-handle`,"data-annotation-id":r.id,"data-anchor":I,cx:K(k.handles[I].x),cy:K(k.handles[I].y),r:p})}}#d(y,r){const k=y.firstChild;if(!r){k&&y.removeChild(k);return}if(k){pe(k,r);return}const l=this.#r.doc.createElementNS(ne,"title");pe(l,r),y.appendChild(l)}#z(y){if(y==="delete"){this.#l&&this.remove(this.#l);return}this.use(this.#t===y?null:y)}#$(){const y=this.#r.plot,r=this.#r.root,k=Y=>this.#_(Y),l=Y=>this.#pe(Y),I=Y=>this.#re(Y),E=Y=>this.#U(Y);y.addEventListener("pointerdown",k),y.addEventListener("pointermove",l),y.addEventListener("pointerup",I),r.addEventListener("keydown",E),this.#p.push(()=>{y.removeEventListener("pointerdown",k),y.removeEventListener("pointermove",l),y.removeEventListener("pointerup",I),r.removeEventListener("keydown",E)})}#N(y){const r=this.#r.plot.getBoundingClientRect?this.#r.plot.getBoundingClientRect():{left:0,top:0};return{x:(y.clientX||0)-(r.left||0),y:(y.clientY||0)-(r.top||0)}}#L(y,r){const k=this.#r.format();for(let l=this.#i.length-1;l>=0;l--){const I=this.#i[l],E=G(I,this.#x(I.axis,r),k);if(!E)continue;for(let se=0;se<E.handles.length;se++)if(Math.hypot(y.x-E.handles[se].x,y.y-E.handles[se].y)<=z)return{item:I,anchor:se};if(E.segments.some(se=>o(y,se.from,se.to)<=t)||E.dots.some(se=>Math.hypot(y.x-se.x,y.y-se.y)<=z)||!!E.stroke&&E.stroke.some((se,le)=>le>0&&o(y,E.stroke[le-1],se)<=t))return{item:I,anchor:-1}}return null}#_(y){if(!this.#t)return;const r=H(this.#r.drawn());if(!r)return;const k=this.#N(y);if(this.#t==="measure"&&this.#F()==="measure"){this.#Oe(y,k);return}const l=r.toData(k.x,k.y);if(l){if(y.preventDefault&&y.preventDefault(),this.#t==="select"){const I=this.#L(k,r);this.#l=I?I.item.id:null,this.#o=I&&!I.item.readOnly?{mode:"move",item:I.item,anchor:I.anchor,from:l,at:k}:null,this.redraw();return}if(this.#t==="pen"){this.#o={mode:"draw",kind:"pen",from:l,at:k,pts:[k],side:this.#oe(k)};return}this.#o={mode:"draw",kind:this.#t==="measure"?this.#F():this.#t,from:l,at:k}}}#F(){const y=this.#s||this.#n.measure&&this.#n.measure.axes||"xy";return y==="x"?"measure-x":y==="y"?"measure-y":"measure"}#pe(y){if(!this.#o)return;const r=this.#N(y);if(this.#o.kind==="measure"){this.#T(r);return}const k=this.#o.mode==="move"?this.#x(this.#o.item.axis):H(this.#r.drawn());if(!k)return;const l=k.toData(r.x,r.y);if(l){if(this.#o.mode==="move"){const{item:I}=this.#o;this.#o.anchor>=0?I.anchors[this.#o.anchor]=l:this.#Me(I,this.#o.from,l),this.#o.from=l,this.#o.moved=!0,this.redraw();return}if(this.#o.kind==="pen"){const I=this.#o.pts[this.#o.pts.length-1];Math.hypot(r.x-I.x,r.y-I.y)>=.5&&this.#o.pts.push(r);const E=this.#ye(this.#o.side,k);this.#o.preview={id:"preview",kind:"pen",axis:this.#o.side==="right"?"right":void 0,anchors:this.#o.pts.map(Y=>E.toData(Y.x,Y.y)).filter(Boolean)},this.#o.preview.anchors.length<2&&(this.#o.preview=null),this.redraw();return}ue[this.#o.kind]!==1&&(this.#o.to=l,this.#o.preview={id:"preview",kind:this.#o.kind,anchors:B(this.#o.kind,this.#o.from,l)},this.redraw())}}#Me(y,r,k){const l=k.y-r.y;if(y.kind==="pen"){this.#be(y,r,k);return}const I=this.#r.drawn(),E=!!(I&&I.xScale&&I.xScale.kind==="time"),Y=E?ae:ie,se=E?Y(k.x)!==null&&Y(r.x)!==null:typeof r.x=="number"&&typeof k.x=="number",le=se?Y(k.x)-Y(r.x):0;for(const ye of y.anchors){if(ye.y+=l,!se)continue;const be=Y(ye.x);be!==null&&(ye.x=be+le)}se||(y.anchors[0].x=k.x)}#ye(y,r){return(y==="right"?H(this.#r.drawn(),"right"):null)||r}#u(y,r,k){const l=y.pts.slice(),I=l[l.length-1];Math.hypot(r.x-I.x,r.y-I.y)>=.5&&l.push(r);const E=l.reduce((be,Ae,Ne)=>be+(Ne?Math.hypot(Ae.x-l[Ne-1].x,Ae.y-l[Ne-1].y):0),0);if(l.length<2||E<e){this.redraw();return}const Y=this.#ye(y.side,k),se=u(l,1).map(be=>Y.toData(be.x,be.y)).filter(Boolean),le=this.#n.pen||{},ye=v({id:U(),kind:"pen",anchors:se,axis:y.side==="right"?"right":void 0,colour:le.colour||void 0,width:le.width||void 0});if(!ye){this.redraw();return}this.#i.push(ye),this.#l=ye.id,this.redraw(),this.#r.notify("added",m(ye),void 0)}#be(y,r,k){const l=k.y-r.y,I=this.#r.drawn(),E=I&&I.xScale,Y=E&&E.kind==="time";if(E&&E.kind==="band"){const le=E.domain||[],ye=Ne=>String(Ne instanceof Date?Ne.toISOString():Ne),be=Ne=>le.findIndex(te=>ye(te)===ye(Ne)),Ae=be(k.x)-be(r.x);for(const Ne of y.anchors){Ne.y+=l;const te=be(Ne.x);te>=0&&Ae&&(Ne.x=le[Math.max(0,Math.min(le.length-1,te+Ae))])}return}const se=Number(Y?ae(k.x):ie(k.x))-Number(Y?ae(r.x):ie(r.x));for(const le of y.anchors){le.y+=l;const ye=Y?ae(le.x):ie(le.x);Number.isFinite(se)&&ye!==null&&(le.x=ye+se)}}describe(){const y=this.#r.format();return this.#i.filter(r=>r.kind==="pen").map(r=>this.#r.t("chart.annotate.pen.described",{from:A(r.anchors[0].x,y),to:A(r.anchors[r.anchors.length-1].x,y)}))}#re(y){const r=this.#o;if(!r)return;this.#o=null;const k=H(this.#r.drawn());if(!k){this.redraw();return}const l=this.#N(y);if(r.kind==="measure"){this.#q(r,l);return}const I=(r.mode==="move"?this.#x(r.item.axis):k).toData(l.x,l.y)||r.from;if(r.mode==="move"){this.redraw(),r.moved&&this.#r.notify("changed",m(r.item),this.#v(r.item));return}if(r.kind==="pen"){this.#u(r,l,k);return}const E=ue[r.kind]===1,Y=Math.hypot(l.x-r.at.x,l.y-r.at.y);if(!E&&Y<e){this.redraw();return}const se=v({id:U(),kind:r.kind,anchors:B(r.kind,r.from,I)});if(!se){this.redraw();return}this.#i.push(se),this.#l=se.id,this.redraw(),b.includes(se.kind)?this.#g(se,l):this.#r.notify("added",m(se),this.#v(se))}#oe(y){const r=this.#r.drawn();if(!r||!r.rightScale||r.horizontal)return"left";const k=ee(r);return y.x>(k.left+k.right)/2?"right":"left"}#Q(y,r){const k=H(this.#r.drawn(),r);if(!k)return null;if(this.#n.measure&&this.#n.measure.snap===!1)return k.toData(y.x,y.y);const l=this.#r.drawn(),I=this.#r.series?this.#r.series():[];let E=null,Y=s;for(const se of I)if((!!l.rightScale&&se.axis==="right"?"right":"left")===r)for(const ye of se.points||[]){if(!ye||!Number.isFinite(ye.y))continue;const be=k.toPixel({x:ye.x,y:ye.y});if(!be)continue;const Ae=Math.hypot(be.x-y.x,be.y-y.y);Ae<=Y&&(Y=Ae,E=ye)}return E&&(typeof E.x=="string"||typeof E.x=="number"||E.x instanceof Date)?{x:E.x,y:E.y}:k.toData(y.x,y.y)}#Oe(y,r){if(y.preventDefault&&y.preventDefault(),this.#k=null,this.#c){const I=this.#x(this.#c.axis),E=I&&G(this.#c,I,this.#r.format());if(!!E&&E.segments.some(se=>o(r,se.from,se.to)<=t)){this.#o={mode:"draw",kind:"measure",pinning:!0,at:r};return}this.#c=null}const k=this.#oe(r),l=this.#Q(r,k);if(!l){this.redraw();return}this.#o={mode:"draw",kind:"measure",from:l,at:r,axis:k},this.redraw()}#T(y){const r=this.#o;if(r.pinning)return;const k=this.#Q(y,r.axis);k&&(r.preview={id:d,kind:"measure",anchors:[r.from,k],axis:r.axis==="right"?"right":void 0},this.redraw())}#q(y,r){const k=Math.hypot(r.x-y.at.x,r.y-y.at.y);if(y.pinning){k<e?this.pin():this.redraw();return}if(k<e){this.redraw();return}const l=this.#Q(r,y.axis);if(!l){this.redraw();return}if(this.#c={id:d,kind:"measure",anchors:[y.from,l],axis:y.axis==="right"?"right":void 0},this.#n.measure&&this.#n.measure.pin){this.pin();return}this.redraw(),this.#B(this.#c)}pin(){const y=this.#c;if(!y||this.#n.readOnly)return null;this.#c=null,this.#k=null;const r=v({id:U(),kind:"measure",anchors:y.anchors,axis:y.axis});return r?(this.#i.push(r),this.redraw(),this.#r.notify("added",m(r),this.#v(r)),this.#B(r),r):(this.redraw(),null)}transient(){return this.#c?m({...this.#c,anchors:this.#c.anchors.map(y=>({...y}))}):null}#B(y,r){const k=this.#b();if(!k)return;const l=w("measure",y.anchors,k),I=k.formatSide(y.axis==="right"),E=Q(l,k.t,I,k.number);E.length&&this.#G(`${r?`${r} `:""}${k.t("chart.annotate.measure.announce",{readout:E.join(", ")})}`)}#G(y){if(!this.#O){const r=j(this.#r.doc,"div",`${q}__measure-live`);r.setAttribute("role","status"),r.setAttribute("aria-live","polite"),r.setAttribute("aria-atomic","true"),r.setAttribute("style","position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0"),this.#r.root.appendChild(r),this.#O=r}pe(this.#O,y)}measureKey(y){const r=this.#n;if(r.readOnly||!r.tools.includes("measure")||y.ctrlKey||y.metaKey||y.altKey)return!1;const k=y.target;if(k&&k.tagName&&/^(input|textarea|select)$/i.test(k.tagName))return!1;const l=y.key,I=()=>(y.preventDefault&&y.preventDefault(),y.stopPropagation&&y.stopPropagation(),!0);if(l==="m"||l==="M")return this.use(this.#t==="measure"?null:"measure"),this.#t==="measure"&&this.#K(0,0),I();if(this.#t!=="measure")return!1;if(l==="Escape")return!this.#c&&!this.#k&&!this.#o?!1:(this.#c=null,this.#k=null,this.#o=null,this.redraw(),I());if(l==="Enter")return this.#k?(this.#A(),I()):this.#c?(this.pin(),I()):!1;const E={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,1],ArrowDown:[0,-1]}[l];return E?(this.#K(E[0],E[1]),I()):!1}#se(y){const r=this.#r.drawn(),k=this.#r.series?this.#r.series():[];if(!r||!r.xScale)return[];const l=k.filter(E=>y===null||(r.rightScale&&E.axis==="right"?"right":"left")===y),{stops:I}=i({series:l,xScale:r.xScale});for(const E of I)E.entries=[...E.entries].sort((Y,se)=>Y.point.y-se.point.y);return I}#K(y,r){const k=this.#k?this.#k.side:null,l=this.#se(k);if(!l.length)return;if(!this.#k){const Y=ee(this.#r.drawn()),se=(Y.left+Y.right)/2;let le=0;l.forEach((ye,be)=>{Math.abs(ye.px-se)<Math.abs(l[le].px-se)&&(le=be)}),this.#k={phase:"start",side:null,stop:le,entry:0,start:null},y=0,r=0}const I=this.#k;I.stop=Math.max(0,Math.min(l.length-1,I.stop+y));const E=l[I.stop].entries;I.entry=Math.max(0,Math.min(E.length-1,I.entry+r)),this.#Le(l)}#Le(y){const r=this.#k,k=this.#r.drawn(),l=y[r.stop].entries[r.entry],I={x:l.point.x,y:l.point.y},E=r.side||(k.rightScale&&l.series.axis==="right"?"right":"left"),Y=r.phase==="end"?r.start:I;if(this.#c={id:d,kind:"measure",anchors:[Y,I],axis:E==="right"?"right":void 0},this.redraw(),r.phase==="end")this.#B(this.#c);else{const se=this.#b();se&&this.#G(se.t("chart.annotate.measure.start",{x:A(I.x,se.number),y:se.formatSide(E==="right")(I.y)}))}}#A(){const y=this.#k;if(y.phase==="start"){if(!this.#c)return;y.phase="end",y.start={...this.#c.anchors[1]},y.side=this.#c.axis==="right"?"right":"left";const r=this.#se(y.side),k=I=>String(I instanceof Date?I.getTime():I),l=r.findIndex(I=>k(I.x)===k(y.start.x));y.stop=l<0?0:l,y.entry=Math.max(0,(r[y.stop]?r[y.stop].entries:[]).findIndex(I=>I.point.y===y.start.y)),this.#Le(r);return}this.pin()}#U(y){if(!this.measureKey(y)){if(y.key==="Escape"){if(this.#f){this.#R(!0);return}if(!this.#o&&!this.#t&&!this.#l)return;this.#o=null,this.#l=null,this.use(null),y.preventDefault&&y.preventDefault();return}(y.key==="Delete"||y.key==="Backspace")&&this.#l&&!this.#f&&this.remove(this.#l)&&y.preventDefault&&y.preventDefault()}}#g(y,r){this.#R(!1);const k=this.#r.doc,l=j(k,"input",`${q}__annotate-input`);l.setAttribute("type","text"),l.setAttribute("aria-label",this.#r.t("chart.annotate.editLabel")),l.value=y.text||"";const I=this.#r.plot.getBoundingClientRect?this.#r.plot.getBoundingClientRect():{left:0,top:0},E=this.#r.root.getBoundingClientRect?this.#r.root.getBoundingClientRect():{left:0,top:0};l.setAttribute("style",`left:${Math.round(r.x+(I.left||0)-(E.left||0))}px;top:${Math.round(r.y+(I.top||0)-(E.top||0))}px`);const Y=se=>{se.key==="Enter"?(this.#R(!1),se.preventDefault&&se.preventDefault()):se.key==="Escape"&&(this.#R(!0),se.preventDefault&&se.preventDefault())};l.addEventListener("keydown",Y),l.addEventListener("blur",()=>this.#R(!1)),this.#r.root.appendChild(l),this.#f=l,this.#M=y,l.focus&&l.focus()}#R(y){const r=this.#f,k=this.#M;if(!r||!k)return;this.#f=null,this.#M=null,r.parentNode&&r.parentNode.removeChild(r);const l=y?"":String(r.value||""),I=!k.text;if(!l&&I){const E=this.#i.indexOf(k);E>=0&&this.#i.splice(E,1),this.#l===k.id&&(this.#l=null),this.redraw();return}if(l===k.text){this.redraw();return}k.text=l,this.redraw(),this.#r.notify(I?"added":"changed",m(k))}destroy(){for(const y of this.#p)y();this.#p=[],this.#R(!0),this.#a&&this.#a.element.parentNode&&this.#a.element.parentNode.removeChild(this.#a.element),this.#a=null,this.#i=[],this.#m&&this.#m.parentNode&&this.#m.parentNode.removeChild(this.#m),this.#m=null}}function oe(a,y){const r=Math.atan2(y.y-a.y,y.x-a.x),k=8,l=.45;return["M",K(y.x),K(y.y),"L",K(y.x-k*Math.cos(r-l)),K(y.y-k*Math.sin(r-l)),"M",K(y.x),K(y.y),"L",K(y.x-k*Math.cos(r+l)),K(y.y-k*Math.sin(r+l))]}}),it("packages/modules/charts/zoom-view.js",function(n,re){"use strict";Object.defineProperty(n,"ZOOM_CONTROLS",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"ZOOM_BUTTONS",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(n,"ZOOM_AXES",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"ZOOM_STEP",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"ZOOM_MIN",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"resolveZoom",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"settleView",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"magnify",{enumerable:!0,get:function(){return f}}),Object.defineProperty(n,"slide",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"sameView",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"bandRange",{enumerable:!0,get:function(){return W}}),Object.defineProperty(n,"slice",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"viewOfRange",{enumerable:!0,get:function(){return v}});const ce=re("packages/core/src/internal/util.js").warnOnce,N=Object.freeze(["in","out","left","right","reset"]),ve=Object.freeze(["hover","always","none"]),xe=Object.freeze(["x","y","xy"]),ie=.25,ae=.01,J=1e-9;function ue(m){const u={enabled:!1,axes:"x",buttons:"none",wheel:!1,pan:!1,step:ie,min:ae};if(m==null||m===!1)return u;const b=m===!0?{}:m;if(typeof b!="object")return u;let O="x";b.axes!==void 0&&(xe.includes(b.axes)?O=b.axes:ce(`chart:zoom:axes:${String(b.axes)}`,`chart zoom.axes is ${JSON.stringify(b.axes)}, which is not an axis this chart can zoom; it was ignored and x was used. The values are ${xe.join(", ")}.`));let Q="hover";b.buttons!==void 0&&(ve.includes(b.buttons)?Q=b.buttons:ce(`chart:zoom:buttons:${String(b.buttons)}`,`chart zoom.buttons is ${JSON.stringify(b.buttons)}, which is not a way to show the zoom toolbar; it was ignored and hover was used. The values are ${ve.join(", ")}.`));const w=Number.isFinite(b.step)&&b.step>0&&b.step<1?Number(b.step):ie,R=Number.isFinite(b.min)&&b.min>0&&b.min<=1?Number(b.min):ae;return{enabled:!0,axes:O,buttons:Q,wheel:b.wheel!==!1,pan:b.pan!==!1,step:w,min:R}}function B(m,u){if(!m||!u)return null;const b=u.max-u.min;if(!(b>0))return null;let O=Math.min(m.to-m.from,b);if(!(O>0))return null;if(m.pinned){const R=u.max;return{from:R-O,to:R,pinned:!0}}let Q=m.from;Q<u.min&&(Q=u.min),Q+O>u.max&&(Q=u.max-O);const w=Q+O;return Q<=u.min+J&&w>=u.max-J?null:{from:Q,to:w,pinned:w>=u.max-J}}function f(m,u,b,O,Q){const w=u.max-u.min;if(!(w>0))return null;const R=m?m.from:u.min,i=m?m.to:u.max,x=i-R,T=!!m&&m.pinned,h=Number.isFinite(O)?Math.min(i,Math.max(R,O)):T?i:R+x/2,g=Math.max(w*Q,0),j=Math.min(Math.max(x*b,g),w),X=x>0?(h-R)/x:.5;return B({from:h-j*X,to:h+j*(1-X),pinned:T&&h>=i-J},u)}function L(m,u,b){if(!m)return null;const O=(m.to-m.from)*b;return B({from:m.from+O,to:m.to+O,pinned:!1},u)}function P(m,u){return!m||!u?!m&&!u:Math.abs(m.from-u.from)<=J&&Math.abs(m.to-u.to)<=J}function W(m,u){const b=Math.max(0,u-1);if(!m)return{first:0,last:b};const O=Math.max(0,Math.ceil(m.from-J)),Q=Math.min(b,Math.floor(m.to+J));return Q<O?{first:Math.min(O,b),last:Math.min(O,b)}:{first:O,last:Q}}function U(m,u,b){const O=(m.categories||[]).length;if(u<=0&&b>=O-1)return m;const Q=[];for(let w=u;w<=b;w++)Q.push(w);return{...m,categories:Q.map(w=>m.categories[w]),labels:Array.isArray(m.labels)?Q.map(w=>m.labels[w]):m.labels,series:(m.series||[]).map(w=>({...w,points:Array.isArray(w.points)?Q.map(R=>w.points[R]).filter(R=>R!==void 0):w.points}))}}function v(m,u){if(!Array.isArray(m)||m.length<2||!u)return null;const b=Number(m[0]),O=Number(m[1]);return!Number.isFinite(b)||!Number.isFinite(O)||b===O?null:B({from:Math.min(b,O),to:Math.max(b,O),pinned:!1},u)}}),it("packages/modules/charts/zoom-toolbar.js",function(n,re){"use strict";Object.defineProperty(n,"buildZoomToolbar",{enumerable:!0,get:function(){return J}});const Se=re("packages/modules/charts/svg.js"),ce=Se.attrs,N=Se.el,ve=Se.svg,ie=re("packages/modules/charts/styles.js").NS,ae=Object.freeze({in:"M7 3 a4 4 0 1 0 0 8 a4 4 0 1 0 0 -8 M10 10 L14 14 M5 7 L9 7 M7 5 L7 9",out:"M7 3 a4 4 0 1 0 0 8 a4 4 0 1 0 0 -8 M10 10 L14 14 M5 7 L9 7",left:"M10 3 L5 8 L10 13",right:"M6 3 L11 8 L6 13",reset:"M3 8 a5 5 0 1 0 1.6 -3.7 M2 2 L2 5.5 L5.5 5.5"});function J(ue){const{doc:B,t:f}=ue,L=N(B,"div",`${ie}__zoom-bar ${ie}__zoom-bar--${ue.buttons}`);L.setAttribute("role","toolbar"),L.setAttribute("aria-label",f("chart.zoom.toolbar")),L.setAttribute("aria-orientation","horizontal");const P=new Map;for(const m of ue.controls){const u=N(B,"button",`${ie}__zoom-button`);u.setAttribute("type","button"),u.setAttribute("data-zoom",m);const b=f(`chart.zoom.${m}`);u.setAttribute("aria-label",b),u.setAttribute("title",b);const O=ve(B,"svg",{class:`${ie}__zoom-icon`,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false"});O.appendChild(ve(B,"path",{d:ae[m]||ae.reset})),u.appendChild(O),u.setAttribute("tabindex",P.size?"-1":"0"),u.addEventListener("click",()=>ue.onPress(m)),L.appendChild(u),P.set(m,u)}const W=m=>{const u=[...P.values()];if(!u.length)return;const b=Math.max(0,Math.min(u.length-1,m));for(let O=0;O<u.length;O++)u[O].setAttribute("tabindex",O===b?"0":"-1");u[b].focus&&u[b].focus()},U=m=>{const u=[...P.values()],b=u.indexOf(m.target);if(b<0)return;const O={ArrowRight:b+1,ArrowDown:b+1,ArrowLeft:b-1,ArrowUp:b-1,Home:0,End:u.length-1};m.key in O&&(W(O[m.key]),m.preventDefault&&m.preventDefault(),m.stopPropagation&&m.stopPropagation())};return L.addEventListener("keydown",U),{element:L,sync:m=>{for(const[u,b]of P){const O=u==="in"&&m.narrowest||u!=="in"&&!m.zoomed;ce(b,{disabled:O?"disabled":null,"aria-disabled":O?"true":null})}}}}}),it("packages/modules/charts/zoom-follow.js",function(n,re){"use strict";Object.defineProperty(n,"FOLLOW_OWNER",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"FOLLOW_Y_TYPES",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"BRUSH_OWNER",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"CLICK_OWNER",{enumerable:!0,get:function(){return f}}),Object.defineProperty(n,"findOwned",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"isOwned",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"ownedLeaves",{enumerable:!0,get:function(){return W}}),Object.defineProperty(n,"pruneOwned",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"mergeOwned",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"followCondition",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"localWall",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"conditionRange",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"leafPrint",{enumerable:!0,get:function(){return O}}),Object.defineProperty(n,"sliceKeys",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"unionExtent",{enumerable:!0,get:function(){return w}});const ce=re("packages/modules/charts/zoom-view.js").bandRange,N=re("packages/modules/charts/scale.js"),ve=N.key,xe=N.toNumber,ie=N.toTime,ae=1e-9,J="chart-view",ue=Object.freeze(new Set(["scatter","bubble"])),B="chart-brush",f="chart-click";function L(R,i,x){if(!R)return null;if(P(R,i,x))return R;if(!Array.isArray(R.conditions))return null;for(const T of R.conditions){const h=L(T,i,x);if(h)return h}return null}function P(R,i,x=J){return!!(R&&!Array.isArray(R.conditions)&&R.meta&&R.meta.owner===x&&R.meta.chart===i)}function W(R,i){const x={x:null,y:null},T=h=>{if(h){if(Array.isArray(h.conditions)){for(const g of h.conditions)T(g);return}if(P(h,i)){const g=h.meta.axis==="y"?"y":"x";x[g]||(x[g]=h)}}};return T(R),x}function U(R,i,x=J){if(!R||P(R,i,x))return null;if(!Array.isArray(R.conditions))return R;let T=!1;const h=[];for(const g of R.conditions){const j=U(g,i,x);j!==g&&(T=!0),j&&h.push(j)}return T?h.length?{...R,conditions:h}:null:R}function v(R,i,x,T=J){const h=U(R,i,T),j=[...h?h.op==="and"&&Array.isArray(h.conditions)?h.conditions:[h]:[],...x];return j.length?{op:"and",conditions:j}:null}function m(R){const{column:i,axis:x,chart:T,banded:h,kind:g,view:j}=R;if(!i||!j)return null;const X={owner:J,chart:T,axis:x};if(h){const t=R.categories||[];if(!t.length)return null;const{first:e,last:s}=ce(j,t.length);return{col:i,op:"in",value:t.slice(e,s+1),meta:X}}if(!Number.isFinite(j.from)||!Number.isFinite(j.to))return null;const K=t=>g==="time"?R.wall?u(t):new Date(t):t,pe=t=>g==="time"?ie(t):xe(t);let ne=K(j.from),C=K(j.to),q=1/0,z=-1/0;for(const t of R.readings||[]){const e=pe(t);e===null||!Number.isFinite(e)||e<j.from-ae||e>j.to+ae||(e<q&&(q=e,ne=t),e>z&&(z=e,C=t))}return j.pinned?{col:i,op:"gte",value:ne,meta:X}:{col:i,op:"between",value:[ne,C],bounds:"[]",meta:X}}function u(R){const i=new Date(R),x=(T,h=2)=>String(T).padStart(h,"0");return`${i.getFullYear()}-${x(i.getMonth()+1)}-${x(i.getDate())}T${x(i.getHours())}:${x(i.getMinutes())}:${x(i.getSeconds())}.${x(i.getMilliseconds(),3)}`}function b(R,i,x){if(!R)return null;const T=h=>i==="time"?ie(h):xe(h);if(R.op==="in"&&Array.isArray(R.value)&&R.value.length)return{range:[R.value[0],R.value[R.value.length-1]],pinned:!1};if(R.op==="between"&&Array.isArray(R.value)&&R.value.length>=2){const h=T(R.value[0]),g=T(R.value[1]);return h===null||g===null?null:{range:[h,g],pinned:!1}}if(R.op==="gte"){const h=T(R.value);return h===null||!x||!(x.max>h)?null:{range:[h,x.max],pinned:!0}}return null}function O(R){if(!R)return"";const i=T=>T instanceof Date?T.getTime():typeof T=="string"&&/^\d{4}-\d{2}-\d{2}T/.test(T)&&Number.isFinite(Date.parse(T))?Date.parse(T):ve(T),x=Array.isArray(R.value)?R.value.map(i):i(R.value);return JSON.stringify([R.col,R.op,x,R.bounds||""])}function Q(R,i){const x=R.categories||[],T=[];for(let h=0;h<x.length;h++)i.has(ve(x[h]))&&T.push(h);return T.length===x.length?R:{...R,categories:T.map(h=>x[h]),labels:Array.isArray(R.labels)?T.map(h=>R.labels[h]):R.labels,series:(R.series||[]).map(h=>({...h,points:Array.isArray(h.points)?T.map(g=>h.points[g]).filter(g=>g!==void 0):h.points}))}}function w(R,i){return R?i?{min:Math.min(R.min,i.min),max:Math.max(R.max,i.max)}:R:i||null}}),it("packages/modules/charts/topojson.js",function(n,re){"use strict";Object.defineProperty(n,"transformer",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(n,"arcPoints",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"stitch",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(n,"decodeGeometry",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"feature",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"isTopology",{enumerable:!0,get:function(){return ae}});function Se(J){if(!J)return U=>[U[0],U[1]];const[ue,B]=J.scale,[f,L]=J.translate;let P=0,W=0;return(U,v)=>(v||(P=0,W=0),P+=U[0],W+=U[1],[P*ue+f,W*B+L])}function ce(J,ue){const B=J.arcs[ue],f=Se(J.transform);return B.map((L,P)=>f(L,P))}function N(J,ue){const B=ce(J,ue<0?~ue:ue);return ue<0?B.slice().reverse():B}function ve(J,ue){const B=[];for(const f of ue){const L=N(J,f);for(let P=B.length?1:0;P<L.length;P++)B.push(L[P])}return B}function xe(J,ue){if(!ue||!ue.type)return null;const B=Se(J.transform);switch(ue.type){case"Point":return{type:"Point",coordinates:B(ue.coordinates,0)};case"MultiPoint":return{type:"MultiPoint",coordinates:ue.coordinates.map(f=>B(f,0))};case"LineString":return{type:"LineString",coordinates:ve(J,ue.arcs)};case"MultiLineString":return{type:"MultiLineString",coordinates:ue.arcs.map(f=>ve(J,f))};case"Polygon":return{type:"Polygon",coordinates:ue.arcs.map(f=>ve(J,f))};case"MultiPolygon":return{type:"MultiPolygon",coordinates:ue.arcs.map(f=>f.map(L=>ve(J,L)))};case"GeometryCollection":return{type:"GeometryCollection",geometries:(ue.geometries||[]).map(f=>xe(J,f)).filter(Boolean)};default:return null}}function ie(J,ue){const B=typeof ue=="string"?(J.objects||{})[ue]:ue;if(!B)return{type:"FeatureCollection",features:[]};const f=B.type==="GeometryCollection"?B.geometries||[]:[B],L=[];for(const P of f){const W=xe(J,P);W&&L.push({type:"Feature",id:P.id,properties:P.properties||{},geometry:W})}return{type:"FeatureCollection",features:L}}function ae(J){return!!J&&typeof J=="object"&&J.type==="Topology"&&Array.isArray(J.arcs)}}),it("packages/modules/charts/projection.js",function(n,re){"use strict";Object.defineProperty(n,"MERCATOR_LIMIT",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(n,"equalEarth",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"robinson",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"mercator",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"equirectangular",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"albers",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"transverseMercator",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"PROJECTIONS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(n,"DEFAULT_PROJECTION",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"resolveProjection",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"WRAP_DEGREES",{enumerable:!0,get:function(){return W}}),Object.defineProperty(n,"splitAntimeridian",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"boundsOf",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"fitted",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"graticule",{enumerable:!0,get:function(){return b}});const Se=Math.PI/180,ce=Object.freeze([1.340264,-.081106,893e-6,.003796]),N=Object.freeze([[1,0],[.9986,.062],[.9954,.124],[.99,.186],[.9822,.248],[.973,.31],[.96,.372],[.9427,.434],[.9216,.4958],[.8962,.5571],[.8679,.6176],[.835,.6769],[.7986,.7346],[.7597,.7903],[.7186,.8435],[.6732,.8936],[.6213,.9394],[.5722,.9761],[.5322,1]]),ve=85.05113;function xe(O,Q){const[w,R,i,x]=ce,T=Q*Se,h=Math.asin(Math.min(1,Math.max(-1,Math.sqrt(3)/2*Math.sin(T)))),g=h*h,j=g*g*g,X=Math.sqrt(3)/2*(w+3*R*g+j*(7*i+9*x*g));return[O*Se*Math.cos(h)/X,h*(w+R*g+j*(i+x*g))]}function ie(O,Q){const w=Math.min(Math.abs(Q),90),R=Math.min(N.length-2,Math.floor(w/5)),i=(w-R*5)/5,[x,T]=N[R],[h,g]=N[R+1],j=x+(h-x)*i,X=T+(g-T)*i;return[O*Se*j,(Q<0?-X:X)*(Math.PI/2)]}function ae(O,Q){const w=Math.min(ve,Math.max(-ve,Q))*Se;return[O*Se,Math.log(Math.tan(Math.PI/4+w/2))]}function J(O,Q){return[O*Se,Q*Se]}function ue(O={}){const[Q,w]=O.parallels||[29.5,45.5],[R,i]=O.centre||[-96,37.5],x=Q*Se,T=w*Se,h=Math.sin(x),g=Math.abs(x-T)<1e-9?h:(h+Math.sin(T))/2,j=Math.cos(x)**2+2*g*h,X=Math.sqrt(j-2*g*Math.sin(i*Se))/g;return(K,pe)=>{const ne=g*((K-R)*Se),C=Math.max(0,j-2*g*Math.sin(pe*Se)),q=Math.sqrt(C)/g;return[q*Math.sin(ne),X-q*Math.cos(ne)]}}function B(O={}){const[Q,w]=O.centre||[-2,49];return(R,i)=>{const x=i*Se,T=(R-Q)*Se,h=Math.cos(x)*Math.sin(T),g=Math.min(1-1e-12,Math.max(-1+1e-12,h));return[.5*Math.log((1+g)/(1-g)),Math.atan2(Math.tan(x),Math.cos(T))-w*Se]}}const f=Object.freeze({equalEarth:()=>xe,robinson:()=>ie,mercator:()=>ae,equirectangular:()=>J,albers:ue,transverseMercator:B,britishNationalGrid:O=>B({centre:[-2,49],...O})}),L="equalEarth";function P(O,Q={},w){if(typeof O=="function")return O;const i=f[typeof O=="string"&&O?O:L];return i?i(Q):(w&&w(`chart projection ${JSON.stringify(O)} is not one this module draws; using '${L}'. Supported: ${Object.keys(f).join(", ")}.`),f[L]({}))}const W=180;function U(O){if(!Array.isArray(O)||O.length<2)return O&&O.length?[O]:[];const Q=[];let w=[O[0]];for(let R=1;R<O.length;R++){const[i,x]=O[R-1],[T,h]=O[R],g=T-i;if(Math.abs(g)>W){const j=g>0?-180:180,X=g>0?g-360:g+360,K=X===0?0:Math.min(1,Math.max(0,(j-i)/X)),pe=x+(h-x)*K;w.push([j,pe]),Q.push(w),w=[[-j,pe],[T,h]]}else w.push([T,h])}return Q.push(w),Q.filter(R=>R.length>1)}function v(O){let Q=1/0,w=1/0,R=-1/0,i=-1/0;for(const x of O||[])for(const[T,h]of x)T<Q&&(Q=T),T>R&&(R=T),h<w&&(w=h),h>i&&(i=h);return Number.isFinite(Q)?{west:Q,south:w,east:R,north:i}:null}function m(O){const{project:Q,rings:w,plot:R}=O,i=typeof O.padding=="number"?O.padding:4;let x=1/0,T=1/0,h=-1/0,g=-1/0;for(const ee of w||[])for(const[H,F]of ee){const[o,A]=Q(H,F);!Number.isFinite(o)||!Number.isFinite(A)||(o<x&&(x=o),o>h&&(h=o),A<T&&(T=A),A>g&&(g=A))}if(!Number.isFinite(x)||h===x||g===T)return{to:(H,F)=>{const[o,A]=Q(H,F);return[R.left+R.width/2+o,R.top+R.height/2-A]},scale:1,width:R.width,height:R.height,left:R.left,top:R.top,aspect:1};const j=Math.max(1,R.width-i*2),X=Math.max(1,R.height-i*2),K=typeof O.zoom=="number"&&O.zoom>0?O.zoom:1,pe=Math.min(j/(h-x),X/(g-T))*K,ne=(h-x)*pe,C=(g-T)*pe,[q,z]=O.centre?Q(O.centre[0],O.centre[1]):[(x+h)/2,(T+g)/2],t=O.centreOffset||[0,0],e=q+(t[0]||0),s=z+(t[1]||0),d=R.left+R.width/2,p=R.top+R.height/2;return{to:(ee,H)=>{const[F,o]=Q(ee,H);return[d+(F-e)*pe,p-(o-s)*pe]},scale:pe,width:ne,height:C,left:d-ne/2,top:p-C/2,aspect:(h-x)/(g-T)}}const u=2;function b(O={}){const Q=O.step&&O.step>0?O.step:30,w=[];for(let R=-180;R<=180;R+=Q){const i=[];for(let x=-80;x<=80;x+=u)i.push([R,x]);w.push(i)}for(let R=-60;R<=60;R+=Q){const i=[];for(let x=-180;x<=180;x+=u)i.push([x,R]);w.push(i)}return w}}),it("packages/modules/charts/geocolumn.js",function(n,re){"use strict";Object.defineProperty(n,"geometryColumnOf",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(n,"bothPlacements",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"rowGeometry",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"geometryPoint",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"geometryPolygons",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"geoAnchorScales",{enumerable:!0,get:function(){return ue}});const Se=Math.PI/180,ce=85.05113,N=Object.freeze({equirectangular:Object.freeze({forward:B=>B*Se,inverse:B=>B/Se}),mercator:Object.freeze({forward:B=>{const f=Math.min(ce,Math.max(-ce,B))*Se;return Math.log(Math.tan(Math.PI/4+f/2))},inverse:B=>(2*Math.atan(Math.exp(B))-Math.PI/2)/Se})});function ve(B,f){const L=f&&f.geometry;if(typeof L!="string"||!L)return null;const P=B&&B.columns&&typeof B.columns.get=="function"?B.columns.get(L):null,W=P&&P.dataType;return{col:L,measure:W&&typeof W.geometry=="function"?W.geometry:null}}function xe(B){if(!B||typeof B.geometry!="string"||!B.geometry)return!1;const f=L=>L!=null&&L!=="";return f(B.lon)||f(B.lat)}function ie(B,f,L){if(!f||!f.measure)return null;const P=B.rows.value(L,f.col);if(P==null)return null;const W=f.measure(P);if(!W||!W.bbox||!W.centroid)return null;const[U,v,m,u]=W.bbox;return![U,v,m,u].every(Number.isFinite)||U<-180||m>180||v<-90||u>90?null:{geometry:P,info:W}}function ae(B){const f=B.geometry;return f&&f.type==="Point"&&Array.isArray(f.coordinates)?[Number(f.coordinates[0]),Number(f.coordinates[1])]:[Number(B.info.centroid[0]),Number(B.info.centroid[1])]}function J(B,f=[]){if(!B||typeof B!="object")return f;if(B.type==="Polygon")f.push(B.coordinates);else if(B.type==="MultiPolygon")for(const L of B.coordinates)f.push(L);else if(B.type==="GeometryCollection")for(const L of B.geometries||[])J(L,f);return f}function ue(B,f,L){const P=typeof f=="string"?N[f]:null;if(!P||typeof B!="function")return null;const[W,U]=B(0,0),[v]=B(1,0),[,m]=B(0,10),u=v-W,b=(m-U)/P.forward(10);if(![W,U,u,b].every(Number.isFinite)||!u||!b)return null;const O={kind:"linear",domain:{min:(L.left-W)/u,max:(L.right-W)/u},range:[L.left,L.right],of:w=>W+Number(w)*u,invert:w=>(w-W)/u},Q={kind:"linear",domain:{min:P.inverse((L.bottom-U)/b),max:P.inverse((L.top-U)/b)},range:[L.bottom,L.top],of:w=>U+P.forward(Number(w))*b,invert:w=>P.inverse((w-U)/b)};return{xScale:O,yScale:Q}}}),it("packages/modules/charts/geo.js",function(n,re){"use strict";Object.defineProperty(n,"CONTINENTS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(n,"CONTINENT_NAMES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(n,"OUTLINES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(n,"COUNTRY_CONTINENT",{enumerable:!0,get:function(){return M}}),Object.defineProperty(n,"ALPHA3",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(n,"NUMERIC",{enumerable:!0,get:function(){return H}}),Object.defineProperty(n,"normaliseCode",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"continentOf",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"projection",{enumerable:!0,get:function(){return A}}),Object.defineProperty(n,"referenceRegions",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"projectedPath",{enumerable:!0,get:function(){return D}}),Object.defineProperty(n,"ringPath",{enumerable:!0,get:function(){return V}}),Object.defineProperty(n,"shapesToPaths",{enumerable:!0,get:function(){return de}}),Object.defineProperty(n,"registerGeoPack",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"geoPack",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(n,"geoPacks",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"resolvePack",{enumerable:!0,get:function(){return y}}),Object.defineProperty(n,"packRegions",{enumerable:!0,get:function(){return k}}),Object.defineProperty(n,"regionLabelPoint",{enumerable:!0,get:function(){return I}}),Object.defineProperty(n,"geoRamp",{enumerable:!0,get:function(){return E}}),Object.defineProperty(n,"basemapStyleOf",{enumerable:!0,get:function(){return se}}),Object.defineProperty(n,"drawGeomap",{enumerable:!0,get:function(){return le}}),Object.defineProperty(n,"regionAt",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"markerAt",{enumerable:!0,get:function(){return be}}),Object.defineProperty(n,"checkGeometrySpec",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(n,"GEOMETRY_TYPES_PLACED",{enumerable:!0,get:function(){return Ne}});const ce=re("packages/modules/charts/frame.js").Pool,ve=re("packages/modules/charts/matrix.js").colourRamp,ie=re("packages/modules/charts/topojson.js").feature,ae=re("packages/modules/charts/projection.js"),J=ae.fitted,ue=ae.graticule,B=ae.resolveProjection,f=ae.splitAntimeridian,P=re("packages/modules/charts/labels.js").drawAnchoredLabels,W=re("packages/modules/charts/axis.js"),U=W.overhangFor,v=W.setPlotClip,u=re("packages/core/src/internal/util.js").warnOnce,O=re("packages/modules/charts/scheme.js").resolveScheme,Q=re("packages/modules/charts/fills.js"),w=Q.isFill,R=Q.normaliseFill,i=re("packages/modules/charts/scale.js"),x=i.isNumber,T=i.measureDomain,h=re("packages/modules/charts/svg.js"),g=h.attrs,j=h.insideRings,X=h.path,K=h.pathRings,pe=h.round,ne=h.setText,q=re("packages/modules/charts/styles.js").NS,z=re("packages/modules/charts/geocolumn.js"),t=z.bothPlacements,e=z.geometryColumnOf,s=Object.freeze(["AF","AN","AS","EU","NA","OC","SA"]),d=Object.freeze({AF:"Africa",AN:"Antarctica",AS:"Asia",EU:"Europe",NA:"North America",OC:"Oceania",SA:"South America"}),p=Object.freeze({NA:[[[-168,66],[-156,71],[-130,70],[-115,69],[-100,69],[-85,70],[-75,73],[-64,66],[-78,62],[-79,55],[-65,60],[-56,52],[-60,45],[-67,45],[-70,42],[-74,40],[-76,37],[-81,32],[-80,27],[-81,25],[-84,30],[-90,29],[-94,29],[-97,26],[-97,21],[-91,19],[-88,21],[-87,16],[-83,9],[-79,9],[-85,13],[-92,16],[-96,16],[-105,20],[-110,24],[-114,28],[-117,32],[-122,37],[-124,42],[-124,48],[-130,55],[-140,60],[-150,59],[-160,55],[-165,60],[-168,66]],[[-43,60],[-32,64],[-22,70],[-20,74],[-25,78],[-33,83],[-45,83],[-58,82],[-62,76],[-56,70],[-55,66],[-52,61],[-43,60]]],SA:[[[-81,12],[-72,12],[-62,11],[-52,5],[-50,0],[-44,-2],[-35,-6],[-38,-13],[-39,-18],[-48,-25],[-53,-34],[-57,-38],[-62,-40],[-65,-45],[-68,-52],[-75,-53],[-73,-45],[-73,-37],[-71,-30],[-70,-23],[-71,-18],[-76,-14],[-81,-6],[-80,-2],[-78,1],[-77,8],[-81,12]]],EU:[[[-10,36],[-9,44],[-2,43],[-4,48],[-1,49],[4,52],[7,53],[8,57],[10,58],[5,58],[5,62],[11,64],[15,69],[21,70],[28,71],[32,70],[40,67],[44,68],[50,69],[60,70],[60,60],[58,52],[50,46],[40,44],[36,45],[30,46],[28,41],[26,40],[23,38],[18,40],[13,38],[15,37],[12,44],[8,44],[3,42],[-2,37],[-10,36]],[[-5,50],[1,51],[2,53],[-1,55],[-3,58],[-5,58],[-6,55],[-5,50]],[[-10,52],[-6,52],[-6,55],[-10,55],[-10,52]]],AF:[[[-17,21],[-16,15],[-17,12],[-13,8],[-8,5],[-3,5],[3,6],[8,4],[9,2],[10,-2],[12,-6],[12,-12],[14,-18],[15,-23],[18,-29],[23,-34],[27,-34],[32,-29],[33,-26],[35,-22],[40,-16],[41,-10],[40,-3],[43,0],[51,4],[51,11],[45,12],[43,12],[39,15],[37,21],[34,28],[32,31],[25,32],[20,31],[15,32],[10,37],[3,36],[-2,35],[-6,36],[-10,30],[-13,27],[-17,21]]],AS:[[[26,40],[35,36],[36,31],[43,30],[48,30],[50,27],[56,25],[57,22],[60,25],[62,25],[67,24],[70,21],[73,16],[77,8],[80,6],[80,13],[84,19],[87,21],[92,21],[95,16],[98,10],[104,1],[104,10],[107,11],[109,17],[117,23],[122,30],[122,37],[126,34],[129,35],[130,43],[135,45],[142,45],[143,53],[140,58],[155,59],[162,60],[170,66],[180,68],[170,71],[150,73],[130,74],[110,76],[90,76],[75,73],[70,70],[60,70],[60,60],[58,52],[50,46],[40,44],[36,45],[30,46],[28,41],[26,40]],[[130,31],[132,32],[135,33],[137,34],[140,35],[141,38],[141,41],[142,42],[145,43],[145,45],[141,45],[140,42],[139,40],[137,37],[135,35],[133,34],[131,33],[130,31]]],OC:[[[113,-22],[114,-26],[115,-34],[119,-34],[126,-32],[132,-32],[137,-35],[141,-38],[147,-38],[150,-37],[153,-30],[153,-25],[146,-19],[142,-11],[136,-12],[130,-12],[126,-14],[122,-18],[113,-22]],[[145,-41],[148,-41],[148,-43],[145,-43],[145,-41]],[[173,-35],[178,-38],[174,-41],[172,-43],[167,-46],[170,-44],[173,-35]]],AN:[[[-180,-78],[-150,-76],[-120,-74],[-100,-73],[-80,-72],[-60,-63],[-45,-60],[-58,-64],[-70,-70],[-60,-76],[-30,-77],[0,-70],[20,-70],[40,-68],[60,-67],[80,-66],[100,-66],[120,-66],[140,-66],[160,-78],[170,-84],[180,-85],[-180,-85],[-180,-78]]]}),M=Object.freeze({AD:"EU",AE:"AS",AF:"AS",AG:"NA",AI:"NA",AL:"EU",AM:"AS",AO:"AF",AQ:"AN",AR:"SA",AS:"OC",AT:"EU",AU:"OC",AW:"NA",AX:"EU",AZ:"AS",BA:"EU",BB:"NA",BD:"AS",BE:"EU",BF:"AF",BG:"EU",BH:"AS",BI:"AF",BJ:"AF",BM:"NA",BN:"AS",BO:"SA",BR:"SA",BS:"NA",BT:"AS",BW:"AF",BY:"EU",BZ:"NA",CA:"NA",CD:"AF",CF:"AF",CG:"AF",CH:"EU",CI:"AF",CL:"SA",CM:"AF",CN:"AS",CO:"SA",CR:"NA",CU:"NA",CV:"AF",CY:"AS",CZ:"EU",DE:"EU",DJ:"AF",DK:"EU",DM:"NA",DO:"NA",DZ:"AF",EC:"SA",EE:"EU",EG:"AF",ER:"AF",ES:"EU",ET:"AF",FI:"EU",FJ:"OC",FK:"SA",FM:"OC",FO:"EU",FR:"EU",GA:"AF",GB:"EU",GD:"NA",GE:"AS",GF:"SA",GG:"EU",GH:"AF",GI:"EU",GL:"NA",GM:"AF",GN:"AF",GP:"NA",GQ:"AF",GR:"EU",GT:"NA",GU:"OC",GW:"AF",GY:"SA",HK:"AS",HN:"NA",HR:"EU",HT:"NA",HU:"EU",ID:"AS",IE:"EU",IL:"AS",IM:"EU",IN:"AS",IQ:"AS",IR:"AS",IS:"EU",IT:"EU",JE:"EU",JM:"NA",JO:"AS",JP:"AS",KE:"AF",KG:"AS",KH:"AS",KI:"OC",KM:"AF",KN:"NA",KP:"AS",KR:"AS",KW:"AS",KY:"NA",KZ:"AS",LA:"AS",LB:"AS",LC:"NA",LI:"EU",LK:"AS",LR:"AF",LS:"AF",LT:"EU",LU:"EU",LV:"EU",LY:"AF",MA:"AF",MC:"EU",MD:"EU",ME:"EU",MG:"AF",MH:"OC",MK:"EU",ML:"AF",MM:"AS",MN:"AS",MO:"AS",MQ:"NA",MR:"AF",MT:"EU",MU:"AF",MV:"AS",MW:"AF",MX:"NA",MY:"AS",MZ:"AF",NA:"AF",NC:"OC",NE:"AF",NG:"AF",NI:"NA",NL:"EU",NO:"EU",NP:"AS",NR:"OC",NZ:"OC",OM:"AS",PA:"NA",PE:"SA",PF:"OC",PG:"OC",PH:"AS",PK:"AS",PL:"EU",PM:"NA",PR:"NA",PS:"AS",PT:"EU",PW:"OC",PY:"SA",QA:"AS",RE:"AF",RO:"EU",RS:"EU",RU:"EU",RW:"AF",SA:"AS",SB:"OC",SC:"AF",SD:"AF",SE:"EU",SG:"AS",SI:"EU",SK:"EU",SL:"AF",SM:"EU",SN:"AF",SO:"AF",SR:"SA",SS:"AF",ST:"AF",SV:"NA",SY:"AS",SZ:"AF",TC:"NA",TD:"AF",TG:"AF",TH:"AS",TJ:"AS",TL:"AS",TM:"AS",TN:"AF",TO:"OC",TR:"AS",TT:"NA",TV:"OC",TW:"AS",TZ:"AF",UA:"EU",UG:"AF",US:"NA",UY:"SA",UZ:"AS",VA:"EU",VC:"NA",VE:"SA",VG:"NA",VI:"NA",VN:"AS",VU:"OC",WS:"OC",YE:"AS",YT:"AF",ZA:"AF",ZM:"AF",ZW:"AF"}),ee=Object.freeze({AFG:"AF",ALB:"AL",DZA:"DZ",AND:"AD",AGO:"AO",ARG:"AR",ARM:"AM",AUS:"AU",AUT:"AT",AZE:"AZ",BHS:"BS",BHR:"BH",BGD:"BD",BRB:"BB",BLR:"BY",BEL:"BE",BLZ:"BZ",BEN:"BJ",BTN:"BT",BOL:"BO",BIH:"BA",BWA:"BW",BRA:"BR",BRN:"BN",BGR:"BG",BFA:"BF",BDI:"BI",KHM:"KH",CMR:"CM",CAN:"CA",CPV:"CV",CAF:"CF",TCD:"TD",CHL:"CL",CHN:"CN",COL:"CO",COM:"KM",COG:"CG",COD:"CD",CRI:"CR",CIV:"CI",HRV:"HR",CUB:"CU",CYP:"CY",CZE:"CZ",DNK:"DK",DJI:"DJ",DMA:"DM",DOM:"DO",ECU:"EC",EGY:"EG",SLV:"SV",GNQ:"GQ",ERI:"ER",EST:"EE",ETH:"ET",FJI:"FJ",FIN:"FI",FRA:"FR",GAB:"GA",GMB:"GM",GEO:"GE",DEU:"DE",GHA:"GH",GRC:"GR",GRL:"GL",GTM:"GT",GIN:"GN",GNB:"GW",GUY:"GY",HTI:"HT",HND:"HN",HKG:"HK",HUN:"HU",ISL:"IS",IND:"IN",IDN:"ID",IRN:"IR",IRQ:"IQ",IRL:"IE",ISR:"IL",ITA:"IT",JAM:"JM",JPN:"JP",JOR:"JO",KAZ:"KZ",KEN:"KE",KIR:"KI",PRK:"KP",KOR:"KR",KWT:"KW",KGZ:"KG",LAO:"LA",LVA:"LV",LBN:"LB",LSO:"LS",LBR:"LR",LBY:"LY",LIE:"LI",LTU:"LT",LUX:"LU",MKD:"MK",MDG:"MG",MWI:"MW",MYS:"MY",MDV:"MV",MLI:"ML",MLT:"MT",MHL:"MH",MRT:"MR",MUS:"MU",MEX:"MX",FSM:"FM",MDA:"MD",MCO:"MC",MNG:"MN",MNE:"ME",MAR:"MA",MOZ:"MZ",MMR:"MM",NAM:"NA",NRU:"NR",NPL:"NP",NLD:"NL",NZL:"NZ",NIC:"NI",NER:"NE",NGA:"NG",NOR:"NO",OMN:"OM",PAK:"PK",PLW:"PW",PSE:"PS",PAN:"PA",PNG:"PG",PRY:"PY",PER:"PE",PHL:"PH",POL:"PL",PRT:"PT",PRI:"PR",QAT:"QA",ROU:"RO",RUS:"RU",RWA:"RW",KNA:"KN",LCA:"LC",VCT:"VC",WSM:"WS",SMR:"SM",STP:"ST",SAU:"SA",SEN:"SN",SRB:"RS",SYC:"SC",SLE:"SL",SGP:"SG",SVK:"SK",SVN:"SI",SLB:"SB",SOM:"SO",ZAF:"ZA",SSD:"SS",ESP:"ES",LKA:"LK",SDN:"SD",SUR:"SR",SWZ:"SZ",SWE:"SE",CHE:"CH",SYR:"SY",TWN:"TW",TJK:"TJ",TZA:"TZ",THA:"TH",TLS:"TL",TGO:"TG",TON:"TO",TTO:"TT",TUN:"TN",TUR:"TR",TKM:"TM",TUV:"TV",UGA:"UG",UKR:"UA",ARE:"AE",GBR:"GB",USA:"US",URY:"UY",UZB:"UZ",VUT:"VU",VEN:"VE",VNM:"VN",YEM:"YE",ZMB:"ZM",ZWE:"ZW"}),H=Object.freeze({4:"AF",8:"AL",12:"DZ",20:"AD",24:"AO",32:"AR",36:"AU",40:"AT",44:"BS",48:"BH",50:"BD",51:"AM",52:"BB",56:"BE",64:"BT",68:"BO",70:"BA",72:"BW",76:"BR",84:"BZ",90:"SB",96:"BN",100:"BG",104:"MM",108:"BI",112:"BY",116:"KH",120:"CM",124:"CA",132:"CV",140:"CF",144:"LK",148:"TD",152:"CL",156:"CN",170:"CO",174:"KM",178:"CG",180:"CD",188:"CR",191:"HR",192:"CU",196:"CY",203:"CZ",204:"BJ",208:"DK",212:"DM",214:"DO",218:"EC",222:"SV",226:"GQ",231:"ET",232:"ER",233:"EE",246:"FI",250:"FR",262:"DJ",266:"GA",268:"GE",270:"GM",276:"DE",288:"GH",300:"GR",304:"GL",320:"GT",324:"GN",328:"GY",332:"HT",340:"HN",344:"HK",348:"HU",352:"IS",356:"IN",360:"ID",364:"IR",368:"IQ",372:"IE",376:"IL",380:"IT",384:"CI",388:"JM",392:"JP",398:"KZ",400:"JO",404:"KE",408:"KP",410:"KR",414:"KW",417:"KG",418:"LA",422:"LB",426:"LS",428:"LV",430:"LR",434:"LY",438:"LI",440:"LT",442:"LU",450:"MG",454:"MW",458:"MY",462:"MV",466:"ML",470:"MT",478:"MR",480:"MU",484:"MX",496:"MN",498:"MD",499:"ME",504:"MA",508:"MZ",512:"OM",516:"NA",520:"NR",524:"NP",528:"NL",548:"VU",554:"NZ",558:"NI",562:"NE",566:"NG",578:"NO",586:"PK",585:"PW",591:"PA",598:"PG",600:"PY",604:"PE",608:"PH",616:"PL",620:"PT",624:"GW",626:"TL",630:"PR",634:"QA",642:"RO",643:"RU",646:"RW",682:"SA",686:"SN",688:"RS",690:"SC",694:"SL",702:"SG",703:"SK",704:"VN",705:"SI",706:"SO",710:"ZA",716:"ZW",724:"ES",728:"SS",729:"SD",740:"SR",748:"SZ",752:"SE",756:"CH",760:"SY",762:"TJ",764:"TH",768:"TG",776:"TO",780:"TT",784:"AE",788:"TN",792:"TR",795:"TM",798:"TV",800:"UG",804:"UA",807:"MK",818:"EG",826:"GB",834:"TZ",840:"US",858:"UY",860:"UZ",862:"VE",882:"WS",887:"YE",894:"ZM"});function F(te){if(te==null||te==="")return null;const Me=String(te).trim().toUpperCase();return Me?/^\d+$/.test(Me)?H[String(Number(Me))]||null:Me.length===2?Me:Me.length===3&&ee[Me]||null:null}function o(te){return te?s.includes(te)&&!(te in M)||s.includes(te)?te:M[te]||null:null}function A(te,Me={}){const ke=Me.antarctic?-90:-58,we=84,je=we-ke,Pe=Math.min(te.width/360,te.height/je),Ce=360*Pe,$e=je*Pe,Le=te.left+(te.width-Ce)/2,_e=te.top+(te.height-$e)/2;return(ot,qe)=>[Le+(ot+180)*Pe,_e+(we-qe)*Pe]}function G(te=!1){return s.filter(Me=>Me!=="AN"||te).map(Me=>({code:Me,label:d[Me],rings:p[Me]}))}function D(te,Me){const ke=[];for(let we=0;we<te.length;we++){const[je,Pe]=Me(te[we][0],te[we][1]);if(!Number.isFinite(je)||!Number.isFinite(Pe))return ke.length>4?X([...ke,"Z"]):"";ke.push(we?"L":"M",pe(je),pe(Pe))}return ke.length?X([...ke,"Z"]):""}function V(te,Me){const ke=Array.isArray(te)&&Array.isArray(te[0])&&Array.isArray(te[0][0])?te:[te],we=[];for(const je of ke)if(!(!Array.isArray(je)||!je.length)){for(let Pe=0;Pe<je.length;Pe++){const[Ce,$e]=Me(je[Pe][0],je[Pe][1]);we.push(Pe?"L":"M",pe(Ce),pe($e))}we.push("Z")}return X(we)}function de(te){const Me=new Map,ke=te.shapes;if(!ke)return Me;const we=A(te.plot),je=te.codeProperty||"iso_a2";if(!Array.isArray(ke)&&!ke.type){for(const Ce of Object.keys(ke)){const $e=F(Ce);$e&&typeof ke[Ce]=="string"&&Me.set($e,ke[Ce])}return Me}const Pe=ke.type==="FeatureCollection"?ke.features||[]:[ke];for(const Ce of Pe){const $e=Ce.properties||{},Le=F($e[je]??$e.iso??$e.code),_e=Ce.geometry;if(!Le||!_e)continue;const ot=_e.type==="MultiPolygon"?_e.coordinates:_e.type==="Polygon"?[_e.coordinates]:[],qe=[];for(const Xe of ot)for(const We of Xe)qe.push(V(We,we));qe.length&&Me.set(Le,qe.join(" "))}return Me}const $=new Map;function _(te){return te&&typeof te=="object"&&typeof te.id=="string"&&$.set(te.id,te),te}function oe(te){return $.get(te)||null}function a(){return[...$.keys()]}function y(te,Me){if(!te||typeof te!="object")return null;const ke=te;let we=te;if(typeof ke.pack=="string"){if(we=$.get(ke.pack),!we)return u(`chart:geomap:pack:${ke.pack}`,`geometry pack ${JSON.stringify(ke.pack)} has not been loaded, so the map fell back to the schematic continents. Import the pack module and pass it as \`shapes\` — import { pack } from '@toclocoinc/lattice-grid/modules/geo-${ke.pack}'; createChart({ …, shapes: pack })${$.size?`. Loaded: ${[...$.keys()].join(", ")}.`:"."}`),null}else ke.pack&&typeof ke.pack=="object"&&(we=ke.pack);if(!we||typeof we!="object")return null;const je=we;if(je.topology)return{pack:je,topology:je.topology};if(je.layers){const Pe=typeof ke.layer=="string"&&ke.layer||typeof Me=="string"&&Me||je.defaultLayer||Object.keys(je.layers)[0],Ce=je.layers[Pe];if(Ce&&Ce.topology)return{pack:je,topology:Ce.topology,layer:Pe}}return null}const r=new WeakMap;function k(te){const Me=r.get(te);if(Me)return Me;const ke=[];for(const we of ie(te,"regions").features){const je=[],Pe=we.geometry,Ce=Pe.type==="MultiPolygon"?Pe.coordinates:Pe.type==="Polygon"?[Pe.coordinates]:[];for(const $e of Ce)for(const Le of $e)for(const _e of f(Le))je.push(_e);je.length&&ke.push({code:String(we.id===void 0||we.id===null?"":we.id),label:we.properties&&we.properties.name||String(we.id||""),properties:we.properties||{},rings:je})}return r.set(te,ke),ke}function l(te,Me){const ke=[];for(let we=0;we<te.length;we++){const[je,Pe]=Me(te[we][0],te[we][1]);!Number.isFinite(je)||!Number.isFinite(Pe)||ke.push(ke.length?"L":"M",pe(je),pe(Pe))}return ke.length>2?X(ke):""}function I(te){let Me=null,ke=-1;for(const Pe of te){if(!Pe||Pe.length<3)continue;let Ce=0,$e=0,Le=0;for(let ot=0;ot<Pe.length;ot++){const[qe,Xe]=Pe[ot],[We,et]=Pe[(ot+1)%Pe.length],He=qe*et-We*Xe;Ce+=He,$e+=(qe+We)*He,Le+=(Xe+et)*He}Ce/=2;const _e=Math.abs(Ce);_e<1e-9||_e>ke&&(ke=_e,Me=[$e/(6*Ce),Le/(6*Ce)])}if(Me)return Me;const we=te.flat();if(!we.length)return null;const je=we.reduce((Pe,[Ce,$e])=>[Pe[0]+Ce,Pe[1]+$e],[0,0]);return[je[0]/we.length,je[1]/we.length]}function E(te,Me,ke,we){const je=ve(te,Me,ke,we);if(Me)return je;const Pe=1/6,Ce=Le=>je.colourAt(Pe+Le*(1-Pe));return Object.assign(Le=>Ce(je.position(Le)),{...je,colourAt:Ce})}function Y(te,Me){return(ke,we)=>{const[je,Pe]=te(ke,we);return!Number.isFinite(je)||!Number.isFinite(Pe)?[je,Pe]:[Math.min(Math.max(je,Me.left),Me.right),Math.min(Math.max(Pe,Me.top),Me.bottom)]}}function se(te,Me){const ke=te&&te.fill,we="var(--lattice-chart-basemap-fill, #c3cfd6)",je=w(ke)?Me?Me.paint(ke,we):(R(ke,we)||{}).solid||we:ke||we,Pe=te&&te.stroke||"var(--lattice-chart-basemap-stroke, #456374)",Ce=te&&te.strokeWidth!=null?te.strokeWidth:"var(--lattice-chart-basemap-stroke-width, 0.75)";return{fill:je,style:`stroke:${Pe};stroke-width:${Ce}`}}function le(te){const Me=te.scheme||O(),{plot:ke,bound:we}=te;new ce(te.groups.grid).finish(),new ce(te.groups.axis).finish(),new ce(te.groups.rules).finish(),new ce(te.groups.labels).finish();const je=y(te.shapes,te.layer),Pe=je?new Map:de({shapes:te.shapes,plot:ke,codeProperty:te.codeProperty}),Ce=Pe.size>0||!!je,$e=je?k(je.topology):null,Le=new Map;if($e)for(const ut of $e){Le.set(ut.code,ut);const bt=ut.properties||{};bt.alpha3&&Le.set(String(bt.alpha3).toUpperCase(),ut),bt.numeric&&Le.set(String(Number(bt.numeric)),ut),bt.fips&&Le.set(String(bt.fips),ut)}const _e=new Map,ot=[],qe=we.series[0];if(qe)for(let ut=0;ut<qe.points.length;ut++){const bt=qe.points[ut];if(!x(bt.y))continue;const ft=we.categories[ut],Ot=F(ft),Ft=$e?[Ot,ft==null?"":String(ft).trim().toUpperCase()].map(Dt=>Dt?Le.get(Dt):null).find(Boolean):null,tn=Ft?Ft.code:null,Nt=$e?tn:Ce?Ot:o(Ot);if(!Nt||Ce&&!$e&&!Pe.has(Nt)){we.labels[ut]&&ot.push(we.labels[ut]);continue}const Rt=_e.get(Nt)||{value:0,labels:[]};Rt.value+=bt.y,Rt.labels.push(we.labels[ut]),_e.set(Nt,Rt)}const Xe=_e.has("AN")||_e.has("AQ"),We=A(ke,{antarctic:Xe});let et=null;if($e){const ut=Xe?$e:$e.filter(ft=>ft.code!=="AQ"&&ft.code!=="AN"),bt=B(te.projection||je.pack.projection,{...je.pack.projectionOptions||{},...te.projectionOptions||{}},ft=>u(`chart:geomap:projection:${String(te.projection)}`,ft));et={project:bt,...J({project:bt,rings:ut.flatMap(ft=>ft.rings),plot:ke,zoom:te.zoom,centre:te.centre,centreOffset:te.centreOffset}),drawn:ut}}const He=T([..._e.values()].map(ut=>ut.value),{zero:!te.diverging,nice:!1}),pt=E(He,!!te.diverging,Me,[..._e.values()].map(ut=>ut.value)),ct=U("geomap");v(te.groups,ke,ct);const St={left:ke.left-ct,top:ke.top-ct,right:ke.right+ct,bottom:ke.bottom+ct},Kt=et?Y(et.to,St):null,Ye=new ce(te.groups.marks);if(!!te.graticule&&!!et){const ut=te.graticule&&typeof te.graticule=="object"&&te.graticule.step||30;for(const bt of ue({step:ut}))for(const ft of f(bt)){const Ot=l(ft,Kt);if(!Ot)continue;const Ft=Ye.next("path",`${q}__graticule`);g(Ft,{d:Ot,class:`${q}__graticule`})}}const yt=[],mt=et?et.drawn.map(ut=>ut.code):Ce?[...Pe.keys()]:s.filter(ut=>ut!=="AN"||Xe),Je=et?new Map(et.drawn.map(ut=>[ut.code,ut])):null,lt=et?se(te.basemap,Me.fills):null;for(const ut of mt){const bt=et?Je.get(ut).rings.map(Ft=>D(Ft,Kt)).filter(Boolean).join(" "):Ce?Pe.get(ut):V(p[ut],We),ft=_e.get(ut),Ot=Ye.next("path",`${q}__region ${q}__mark`);g(Ot,{d:bt,fill:ft?pt(ft.value):lt?lt.fill:"var(--lattice-chart-empty, #eceff1)","data-code":ut,class:`${q}__region ${q}__mark`,style:lt?lt.style:null}),yt.push({code:ut,value:ft?ft.value:null,label:!Ce&&d[ut]||Je&&Je.get(ut).label||ft&&ft.labels[0]||ut,element:Ot,d:bt})}Ye.finish();const kt=new ce(te.groups.overlay);if(ot.length){const ut=kt.next("text",`${q}__geo-note`);g(ut,{x:pe(ke.left),y:pe(ke.bottom),"text-anchor":"start"}),ne(ut,te.grid.messages.t("chart.geoUnmatched",{count:ot.length}))}kt.finish();let Et=0;if(te.labels&&te.labels.show&&et){const ut=yt.filter(bt=>bt.value!==null).sort((bt,ft)=>ft.value-bt.value).map(bt=>{const ft=Je.get(bt.code).rings.map(Ft=>Ft.map(([tn,Nt])=>et.to(tn,Nt))),Ot=I(ft);return Ot&&{x:Ot[0],y:Ot[1],text:bt.label}}).filter(Boolean);Et=P({group:te.groups.labels,size:te.fontSize,minGap:te.labels.minGap,anchors:ut,plot:ke})}return{regions:yt,ramp:pt,unmatched:ot,useCountries:Ce,packed:!!et,scale:et?et.scale:null,attribution:je&&je.pack.attribution||"",aspect:et?et.aspect:null,labelsDrawn:Et}}function ye(te){for(const Me of te.regions||[]){if(!Me.rings){Me.rings=K(Me.d);let we=1/0,je=1/0,Pe=-1/0,Ce=-1/0;for(const $e of Me.rings)for(const[Le,_e]of $e)Le<we&&(we=Le),Le>Pe&&(Pe=Le),_e<je&&(je=_e),_e>Ce&&(Ce=_e);Me.box={minX:we,minY:je,maxX:Pe,maxY:Ce}}const ke=Me.box;if(!(!ke||te.x<ke.minX||te.x>ke.maxX||te.y<ke.minY||te.y>ke.maxY)&&j(Me.rings,te.x,te.y))return Me}return null}function be(te){let ke=null,we=1/0;for(const je of te.markers||[]){if(!je)continue;const Pe=(je.r||0)+3,Ce=te.x-je.x,$e=te.y-je.y;if(je.half){if(Math.abs(Ce)>je.half+3||Math.abs($e)>je.half+3)continue;const _e=Math.sqrt(Ce*Ce+$e*$e);if(_e>=we)continue;we=_e,ke=je;continue}const Le=Math.sqrt(Ce*Ce+$e*$e);Le>Pe||Le>=we||(we=Le,ke=je)}return ke}function Ae(te){const{grid:Me,spec:ke,type:we,id:je}=te;if(!ke||!Ne.has(we))return;if(t(ke)){u(`chart:${je}:geometry:both`,`a "${we}" chart was given both "geometry" and "lon"/"lat", and a row is placed by one or the other, so nothing was drawn rather than one being picked for you. Keep "geometry" for a geometry column, or "lon" and "lat" for two coordinate columns.`);return}const Pe=e(Me,ke);if(!Pe){we==="choropleth"&&u(`chart:${je}:geometry:missing`,`a "choropleth" chart draws each row's own shape from a geometry column and was given none, so it has nothing to draw. Name the column: geometry: '<column>'.`);return}Pe.measure||u(`chart:${je}:geometry:type:${Pe.col}`,`a "${we}" chart reads "geometry" from column ${JSON.stringify(Pe.col)}, which is not a geometry column, so no row could be placed. Import '@toclocoinc/lattice-grid/modules/geometry' and declare the column type: 'geometry'.`)}const Ne=new Set(["markermap","bubblemap","choropleth"])}),it("packages/modules/charts/force.js",function(n,re){"use strict";Object.defineProperty(n,"ITERATIONS",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(n,"sequence",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"layoutForce",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"layoutNetwork",{enumerable:!0,get:function(){return ae}});const Se=220,ce=2400,N=.006,ve=.015;function xe(J){let ue=J>>>0||1;return()=>(ue^=ue<<13,ue>>>=0,ue^=ue>>17,ue^=ue<<5,ue>>>=0,ue/4294967296)}function ie(J){const{nodes:ue,links:B,plot:f}=J;if(!ue.length)return{nodes:ue,ticks:0};const L=Number.isFinite(J.repulsion)?J.repulsion:ce,P=Number.isFinite(J.attraction)?J.attraction:N,W=Number.isFinite(J.gravity)?J.gravity:ve,U=xe(ue.length*2654435761),v=f.left+f.width/2,m=f.top+f.height/2,u=Math.min(f.width,f.height)/3;for(const O of ue){const Q=U()*Math.PI*2,w=u*(.35+U()*.65);if(J.keep&&Number.isFinite(O.x)&&Number.isFinite(O.y)){O.vx=0,O.vy=0;continue}O.x=v+Math.cos(Q)*w,O.y=m+Math.sin(Q)*w,O.vx=0,O.vy=0}for(const O of ue)O.pinned=Number.isFinite(O.fx)&&Number.isFinite(O.fy),O.pinned&&(O.x=f.left+Math.max(0,Math.min(1,O.fx))*f.width,O.y=f.top+Math.max(0,Math.min(1,O.fy))*f.height);const b=J.iterations||Se;for(let O=0;O<b;O++){const Q=(Number.isFinite(J.heat)?J.heat:1)*(1-O/b);for(let w=0;w<ue.length;w++){const R=ue[w];for(let i=w+1;i<ue.length;i++){const x=ue[i];let T=R.x-x.x,h=R.y-x.y,g=Math.sqrt(T*T+h*h);g<.01&&(T=w-i||1,h=1,g=Math.sqrt(T*T+h*h));const j=L/(g*g),X=T/g*j,K=h/g*j;R.vx+=X,R.vy+=K,x.vx-=X,x.vy-=K}}for(const w of B){const R=w.source,i=w.target;if(R===i)continue;const x=i.x-R.x,T=i.y-R.y,h=P*(w.weight||1);R.vx+=x*h,R.vy+=T*h,i.vx-=x*h,i.vy-=T*h}for(const w of ue){if(w.pinned){w.vx=0,w.vy=0;continue}w.vx+=(v-w.x)*W,w.vy+=(m-w.y)*W,w.x+=w.vx*Q*.08,w.y+=w.vy*Q*.08,w.vx*=.82,w.vy*=.82,w.x=Math.max(f.left+8,Math.min(f.right-8,w.x)),w.y=Math.max(f.top+8,Math.min(f.bottom-8,w.y))}}return{nodes:ue,ticks:b}}function ae(J){return ie(J).nodes}}),it("packages/modules/charts/network.js",function(n,re){"use strict";Object.defineProperty(n,"glyphFor",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"glyphTransform",{enumerable:!0,get:function(){return O}}),Object.defineProperty(n,"ITERATIONS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"layoutNetwork",{enumerable:!0,get:function(){return R}}),Object.defineProperty(n,"sequence",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"LINK_GAP",{enumerable:!0,get:function(){return x}}),Object.defineProperty(n,"ICON_RADIUS",{enumerable:!0,get:function(){return T}}),Object.defineProperty(n,"offsetParallel",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"drawNetwork",{enumerable:!0,get:function(){return g}}),Object.defineProperty(n,"emphasiseNetwork",{enumerable:!0,get:function(){return j}}),Object.defineProperty(n,"nodeAt",{enumerable:!0,get:function(){return K}}),Object.defineProperty(n,"linkAt",{enumerable:!0,get:function(){return pe}});const ce=re("packages/modules/charts/frame.js").Pool,ve=re("packages/modules/charts/scheme.js").resolveScheme,xe=re("packages/modules/charts/svg.js"),ie=xe.attrs,ae=xe.path,J=xe.round,ue=xe.setText,f=re("packages/modules/charts/styles.js").NS,L=re("packages/modules/charts/typography.js"),P=L.applySize,W=L.truncateTo,U=re("packages/modules/charts/rulecolour.js"),v=U.ruleColour,m=U.ruleLegend,u=re("packages/modules/charts/glyph.js"),b=u.glyphFor,O=u.glyphTransform,Q=re("packages/modules/charts/force.js"),w=Q.ITERATIONS,R=Q.layoutNetwork,i=Q.sequence,x=4,T=10;function h(ne){const C=new Map;for(const q of ne){const z=q.pair||`${q.source.key}\0${q.target.key}`;C.has(z)||C.set(z,[]),C.get(z).push(q)}for(const q of C.values()){const z=q.length;for(let t=0;t<z;t++){const e=q[t],s=e.source,d=e.target,p=d.x-s.x,M=d.y-s.y,ee=Math.sqrt(p*p+M*M)||1,H=ee?-M/ee:0,F=ee?p/ee:1,o=(t-(z-1)/2)*x;e.offset=o,e.bundled=z>1,e.line={x1:s.x+H*o,y1:s.y+F*o,x2:d.x+H*o,y2:d.y+F*o}}}}function g(ne){const C=ne.scheme||ve(),{plot:q,bound:z}=ne;for(const V of["grid","axis","rules","labels"])new ce(ne.groups[V]).finish();const t=z.nodes,e=z.links.map(V=>({...V,weight:V.value}));if(!t.length)return{nodes:[],links:[],legend:[]};const s=e.reduce((V,de)=>Math.max(V,de.value),0)||1;for(const V of e)V.weight=V.value/s;R({nodes:t,links:e,plot:q,iterations:ne.iterations}),h(e);const d=z.measure&&z.measure.col||null,p=new Set;for(const V of e)V.colour=v({grid:ne.grid,col:d,value:V.value}),V.colour&&p.add(V.colour);const M=t.reduce((V,de)=>Math.max(V,de.in+de.out),0)||1,ee=new ce(ne.groups.marks),H=Number.isFinite(ne.linkWidth)&&ne.linkWidth>0?Number(ne.linkWidth):null;for(const V of e){V.drawnWidth=H===null?.5+V.weight*3:H;const de=ee.next("path",`${f}__edge ${f}__mark`);ie(de,{d:ae(["M",J(V.line.x1),J(V.line.y1),"L",J(V.line.x2),J(V.line.y2)]),style:V.colour?`stroke:${V.colour};stroke-opacity:1`:null,"stroke-width":J(V.drawnWidth),fill:"none"}),V.el=de}for(const V of t){const de=(V.in+V.out)/M,$=V.icon||ne.icon||null;V.glyph=b(ne.grid,$),V.r=4+Math.sqrt(de)*12,V.glyph&&(V.r=Math.max(V.r,T));const _=ee.next("circle",`${f}__node ${f}__mark`);ie(_,{cx:J(V.x),cy:J(V.y),r:J(V.r),fill:C.series(V.index),"data-node":V.key}),V.el=_}ee.finish();const F=new ce(ne.groups.overlay),o=[];for(const V of t){if(!V.glyph){V.glyphEls=[];continue}const de=V.glyph.paint==="stroke",$=O(V.glyph,{x:V.x,y:V.y,size:V.r*1.3});V.glyphEls=V.glyph.paths.map(_=>{const oe=F.next("path",`${f}__node-icon${de?` ${f}__node-icon--stroke`:""}`);return ie(oe,{d:_,transform:$}),oe}),o.push(...V.glyphEls)}const A=ne.typography&&ne.typography.small||ne.fontSize,G=t.filter(V=>V.declared),D=t.filter(V=>!V.declared).sort((V,de)=>de.in+de.out-(V.in+V.out)).slice(0,12);for(const V of[...G,...D]){const de=F.next("text",`${f}__flow-label`);P(de,A),ie(de,{x:J(V.x),y:J(V.y+V.r+A),"text-anchor":"middle"}),ue(de,W(V.label,90,A)),V.labelEl=de}return F.finish(),{nodes:t,links:e,glyphs:o,legend:m({grid:ne.grid,col:d,colours:p})}}function j(ne){const C=ne.drawn||{},q=ne.keys||new Set,z=q.size>0;let t=0;const e=new Set;for(const s of C.links||[]){const d=z&&(s.rowKeys||[]).some(p=>q.has(p));d&&(t++,e.add(s.source),e.add(s.target)),X(s.el,z&&!d)}for(const s of C.nodes||[]){const d=e.has(s);d&&t++,X(s.el,z&&!d);for(const p of s.glyphEls||[])X(p,z&&!d)}return t}function X(ne,C){!ne||!ne.setAttribute||(C?ne.setAttribute("data-dim","true"):ne.removeAttribute("data-dim"))}function K(ne){const C=typeof ne.slack=="number"?ne.slack:2;let q=null,z=1/0;for(const t of ne.nodes||[]){if(typeof t.x!="number"||typeof t.y!="number")continue;const e=ne.x-t.x,s=ne.y-t.y,d=Math.sqrt(e*e+s*s);d<=(t.r||0)+C&&d<z&&(z=d,q=t)}return q}function pe(ne){let C=null,q=1/0;for(const z of ne.links||[]){const t=z.line,e=t?{x:t.x1,y:t.y1}:z.source,s=t?{x:t.x2,y:t.y2}:z.target;if(!e||!s||typeof e.x!="number"||typeof s.x!="number")continue;const d=s.x-e.x,p=s.y-e.y,M=d*d+p*p,ee=M?Math.max(0,Math.min(1,((ne.x-e.x)*d+(ne.y-e.y)*p)/M)):0,H=ne.x-(e.x+ee*d),F=ne.y-(e.y+ee*p),o=Math.sqrt(H*H+F*F),A=Number.isFinite(z.drawnWidth)?z.drawnWidth:.5+(z.weight||0)*3,G=z.bundled?Math.min(Math.max(2,A/2),x/2):Math.max(3,A/2);o<=G&&o<q&&(q=o,C=z)}return C}}),it("packages/modules/charts/hnodes.js",function(n,re){"use strict";Object.defineProperty(n,"MIN_HIT",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(n,"isHierarchyDraw",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"hnodeAt",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"emphasiseHierarchy",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"emphasiseLayout",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"emphasiseChord",{enumerable:!0,get:function(){return ae}});const Se=7;function ce(J){return!!J&&Array.isArray(J.hnodes)}function N(J){const ue=J.view||{k:1,tx:0,ty:0},B=ue.k||1,f=(J.x-ue.tx)/B,L=(J.y-ue.ty)/B;let P=null;for(const W of J.hnodes)if(!W.hidden){if(Array.isArray(W.polygon)){if(!ve(W.polygon,f,L))continue}else{const U=Math.max(W.r,Se/B),v=f-W.x,m=L-W.y;if(v*v+m*m>U*U)continue}(!P||W.r<P.r||W.r===P.r&&W.depth>=P.depth)&&(P=W)}return P}function ve(J,ue,B){let f=!1;const L=J.length;for(let P=0,W=L-2;P<L;W=P,P+=2){const U=J[P+1],v=J[W+1];U>B!=v>B&&ue<(J[W]-J[P])*(B-U)/(v-U)+J[P]&&(f=!f)}return f}function xe(J){const ue=J.keys||new Set;let B=0;for(const f of J.drawn.hnodes||[]){const L=f.element;if(!L||!L.setAttribute)continue;const P=f.node&&f.node.rowKeys||[];!ue.size||P.some(U=>ue.has(U))?(L.removeAttribute("data-dim"),B+=1):L.setAttribute("data-dim","true")}return B}function ie(J){const ue=J.keys||new Set;let B=0;for(const f of J.marks&&J.marks.childNodes||[]){if(!f||!f.getAttribute)continue;const L=f.getAttribute(J.attribute);if(L===null)continue;const P=J.entries[Number(L)],W=P&&(P.node||P.item&&P.item.node),U=W&&(W.rowKeys&&W.rowKeys.length?W.rowKeys:W.rowKey?[W.rowKey]:[])||[];!ue.size||U.some(m=>ue.has(m))?(f.removeAttribute("data-dim"),B+=1):f.setAttribute("data-dim","true")}return B}function ae(J){const ue=J.keys||new Set,B=new Map,f=new Map;for(const{link:P}of J.drawn.ribbons||[]){const W=P.rowKeys||[];B.set(`${P.source.key}->${P.target.key}`,W);for(const U of[P.source,P.target]){const v=f.get(U.key)||[];f.set(U.key,v.concat(W))}}let L=0;for(const P of J.marks&&J.marks.childNodes||[]){if(!P||!P.getAttribute)continue;const W=P.getAttribute("data-link"),U=P.getAttribute("data-node");if(W===null&&U===null)continue;const v=(W!==null?B.get(W):f.get(U))||[];!ue.size||v.some(u=>ue.has(u))?(P.removeAttribute("data-dim"),L+=1):P.setAttribute("data-dim","true")}return L}}),it("packages/modules/charts/flow.js",function(n,re){"use strict";Object.defineProperty(n,"assignDepths",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"layoutSankey",{enumerable:!0,get:function(){return x}}),Object.defineProperty(n,"ribbon",{enumerable:!0,get:function(){return T}}),Object.defineProperty(n,"drawSankey",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"readDirected",{enumerable:!0,get:function(){return X}}),Object.defineProperty(n,"layoutDirectedChord",{enumerable:!0,get:function(){return K}}),Object.defineProperty(n,"directedShape",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(n,"layoutChord",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(n,"drawChord",{enumerable:!0,get:function(){return C}}),Object.defineProperty(n,"describeLink",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"flowNodeAt",{enumerable:!0,get:function(){return z}}),Object.defineProperty(n,"ribbonAt",{enumerable:!0,get:function(){return t}}),Object.defineProperty(n,"chordArcAt",{enumerable:!0,get:function(){return e}}),Object.defineProperty(n,"chordRibbonAt",{enumerable:!0,get:function(){return s}}),Object.defineProperty(n,"chordPolygon",{enumerable:!0,get:function(){return d}});const ce=re("packages/modules/charts/frame.js").Pool,ve=re("packages/modules/charts/format.js").measureText,ie=re("packages/modules/charts/scheme.js").resolveScheme,ae=re("packages/modules/charts/svg.js"),J=ae.attrs,ue=ae.insideRings,B=ae.path,f=ae.round,L=ae.setText,W=re("packages/modules/charts/styles.js").NS,U=re("packages/modules/charts/typography.js"),v=U.applySize,m=U.textWidth,u=U.truncateTo,b=Math.PI*2,O=12,Q=8,w=-Math.PI/2,R=16;function i(p,M){for(const A of p)A.depth=0;const ee=p.length+1;for(let A=0;A<ee;A++){let G=!1;for(const D of M){if(D.source===D.target)continue;const V=D.source.depth+1;V>D.target.depth&&V<ee&&(D.target.depth=V,G=!0)}if(!G)break}const H=p.reduce((A,G)=>Math.max(A,G.depth),0),F=new Set,o=new Set;for(const A of M)A.source!==A.target&&(F.add(A.source),o.add(A.target));for(const A of p)!F.has(A)&&o.has(A)&&(A.depth=H);return H+1}function x(p){const{nodes:M,links:ee,plot:H}=p,F=i(M,ee),o=p.nodeWidth||O,A=new Map;for(const $ of M)A.has($.depth)||A.set($.depth,[]),A.get($.depth).push($);let G=0;for(const $ of A.values()){const _=$.reduce((a,y)=>a+Math.max(y.in,y.out),0),oe=Math.max(0,$.length-1)*Q;_>0&&(G=Math.max(G,_/Math.max(1,H.height-oe)))}const D=G>0?1/G:0,V=F>1?(H.width-o)/(F-1):0;for(const[$,_]of A){_.sort((r,k)=>Math.max(k.in,k.out)-Math.max(r.in,r.out));const oe=_.map(r=>Math.max(1,Math.max(r.in,r.out)*D)),a=oe.reduce((r,k)=>r+k,0)+(_.length-1)*Q;let y=H.top+Math.max(0,(H.height-a)/2);_.forEach((r,k)=>{r.x=H.left+$*V,r.width=o,r.y=y,r.height=oe[k],r.inAt=y,r.outAt=y,y+=oe[k]+Q})}const de=ee.slice().sort(($,_)=>$.source.y-_.source.y||_.value-$.value);for(const $ of de){const _=Math.max(1,$.value*D);$.thickness=_,$.y0=$.source.outAt+_/2,$.source.outAt+=_}for(const $ of de.slice().sort((_,oe)=>_.target.y-oe.target.y||oe.value-_.value))$.y1=$.target.inAt+$.thickness/2,$.target.inAt+=$.thickness;return{columns:F,scale:D}}function T(p){const M=p.source.x+p.source.width,ee=p.target.x,H=(M+ee)/2,F=p.thickness/2;return B(["M",f(M),f(p.y0-F),"C",f(H),f(p.y0-F),f(H),f(p.y1-F),f(ee),f(p.y1-F),"L",f(ee),f(p.y1+F),"C",f(H),f(p.y1+F),f(H),f(p.y0+F),f(M),f(p.y0+F),"Z"])}function h(p){const M=p.scheme||ie(),{plot:ee,bound:H}=p;for(const V of["grid","axis","rules","labels"])new ce(p.groups[V]).finish();const F=H.nodes,o=H.links;if(!F.length||!o.length)return{nodes:[],links:[]};x({nodes:F,links:o,plot:ee});const A=new ce(p.groups.marks);for(const V of o){const de=A.next("path",`${W}__ribbon ${W}__mark`);J(de,{d:T(V),fill:M.series(V.source.index),"data-link":`${V.source.key}->${V.target.key}`})}for(const V of F)J(A.next("rect",`${W}__node ${W}__mark`),{x:f(V.x),y:f(V.y),width:f(V.width),height:f(V.height),fill:M.series(V.index),"data-node":V.key});A.finish();const G=new ce(p.groups.overlay),D=p.typography&&p.typography.small||p.fontSize;for(const V of F){const de=V.x<ee.left+ee.width/2,$=G.next("text",`${W}__flow-label`);v($,D),J($,{x:f(de?V.x+V.width+4:V.x-4),y:f(V.y+V.height/2),"text-anchor":de?"start":"end","dominant-baseline":"middle"});const _=de?ee.right-(V.x+V.width)-6:V.x-ee.left-6;L($,u(V.label,Math.max(0,_),D))}return G.finish(),{nodes:F,links:o}}const g=.07,j=.4;function X(p){if(!p)return null;const M=typeof p=="object"?p:{};return{style:M.style==="arrow"?"arrow":"taper",arc:M.arc==="inout"?"inout":"out"}}function K(p){const{nodes:M,links:ee,directed:H}=p,F=new Map,o=new Map;for(const Y of M)F.set(Y.key,0),o.set(Y.key,0);for(const Y of ee)F.set(Y.source.key,(F.get(Y.source.key)||0)+Y.value),o.set(Y.target.key,(o.get(Y.target.key)||0)+Y.value);const A=H.arc==="inout",G=new Map;let D=0;for(const Y of M){const se=(F.get(Y.key)||0)+(A&&o.get(Y.key)||0);G.set(Y.key,se),D+=se}if(D<=0)return{arcs:[],ribbons:[],total:0};const V=D*.02;for(const Y of M)G.get(Y.key)||(G.set(Y.key,V),D+=V);const de=Math.min(.04,b/(M.length*8||1)),$=b-de*M.length,_=[];let oe=w;const a=new Map;for(const Y of M){const se=G.get(Y.key)/D*$,le={node:Y,from:oe,to:oe+se};_.push(le),a.set(Y.key,le),oe+=se+de}const y=ee.slice().sort((Y,se)=>se.value-Y.value),r=new Map(_.map(Y=>[Y.node.key,Y.from])),k=new Map(_.map(Y=>[Y.node.key,Y.from+(F.get(Y.node.key)||0)/D*$])),l=new Map;for(const Y of y)l.set(Y.target.key,(l.get(Y.target.key)||0)+1);const I=new Map,E=y.map(Y=>{const se=Y.value/D*$,le=r.get(Y.source.key);r.set(Y.source.key,le+se);let ye;if(A){const be=k.get(Y.target.key);k.set(Y.target.key,be+se),ye={from:be,to:be+se}}else{const be=a.get(Y.target.key),Ae=l.get(Y.target.key)||1,Ne=I.get(Y.target.key)||0;I.set(Y.target.key,Ne+1);const te=(be.to-be.from)/Ae,Me=Math.min(se,te)*.9,ke=be.from+te*(Ne+.5);ye={from:ke-Me/2,to:ke+Me/2}}return{link:Y,source:{from:le,to:le+se},target:ye}});return{arcs:_,ribbons:E,total:D}}function pe(p,M,ee){const{cx:H,cy:F,inner:o}=M,A=(Ae,Ne)=>[H+Ne*Math.cos(Ae),F+Ne*Math.sin(Ae)],G=p.source.from,D=p.source.to,V=(p.target.from+p.target.to)/2,de=(p.target.to-p.target.from)/2*(ee==="taper"?j:1),$=V-de,_=V+de,oe=o*g,a=[],y=(Ae,Ne)=>{for(let te=0;te<=R;te++)a.push(A(Ae+(Ne-Ae)*te/R,o))},r=(Ae,Ne)=>{for(let te=1;te<R;te++){const Me=te/R,ke=1-Me;a.push([ke*ke*Ae[0]+2*ke*Me*H+Me*Me*Ne[0],ke*ke*Ae[1]+2*ke*Me*F+Me*Me*Ne[1]])}},[k,l]=A(G,o),[I,E]=A(D,o);if(y(G,D),ee==="arrow"){const Ae=A($,o-oe),Ne=A(_,o-oe),te=A(V,o);return r(A(D,o),Ae),a.push(Ae,te,Ne),r(Ne,A(G,o)),{d:B(["M",f(k),f(l),"A",f(o),f(o),0,0,1,f(I),f(E),"Q",f(H),f(F),f(Ae[0]),f(Ae[1]),"L",f(te[0]),f(te[1]),"L",f(Ne[0]),f(Ne[1]),"Q",f(H),f(F),f(k),f(l),"Z"]),polygon:a}}const[Y,se]=A($,o),[le,ye]=A(_,o);return r(A(D,o),A($,o)),y($,_),r(A(_,o),A(G,o)),{d:B(["M",f(k),f(l),"A",f(o),f(o),0,0,1,f(I),f(E),"Q",f(H),f(F),f(Y),f(se),"A",f(o),f(o),0,0,1,f(le),f(ye),"Q",f(H),f(F),f(k),f(l),"Z"]),polygon:a}}function ne(p){const{nodes:M,links:ee}=p,H=new Map;for(const $ of M)H.set($.key,0);for(const $ of ee)H.set($.source.key,(H.get($.source.key)||0)+$.value),H.set($.target.key,(H.get($.target.key)||0)+$.value);const F=[...H.values()].reduce(($,_)=>$+_,0);if(F<=0)return{arcs:[],ribbons:[]};const o=Math.min(.04,b/(M.length*8||1)),A=b-o*M.length,G=[];let D=-Math.PI/2;const V=new Map;for(const $ of M){const oe=(H.get($.key)||0)/F*A;G.push({node:$,from:D,to:D+oe}),V.set($.key,D),D+=oe+o}const de=[];for(const $ of ee.slice().sort((_,oe)=>oe.value-_.value)){const _=$.value/F*A,oe=V.get($.source.key),a=V.get($.target.key);V.set($.source.key,oe+_),V.set($.target.key,a+_),de.push({link:$,source:{from:oe,to:oe+_},target:{from:a,to:a+_}})}return{arcs:G,ribbons:de}}function C(p){const M=p.scheme||ie(),{plot:ee,bound:H}=p;for(const r of["grid","axis","rules","labels"])new ce(p.groups[r]).finish();const F=ee.left+ee.width/2,o=ee.top+ee.height/2,A=p.typography&&p.typography.small||p.fontSize,G=Math.max(...H.nodes.map(r=>m(r.label,A)),0),D=Math.max(10,Math.min(ee.width,ee.height)/2-Math.min(G+8,90)),V=D*.92,de=X(p.directed),{arcs:$,ribbons:_}=de?K({nodes:H.nodes,links:H.links,directed:de}):ne({nodes:H.nodes,links:H.links,cx:F,cy:o,radius:D}),oe=(r,k)=>[F+k*Math.cos(r),o+k*Math.sin(r)],a=new ce(p.groups.marks);for(const r of _){const{link:k,source:l,target:I}=r;if(de){const te=pe(r,{cx:F,cy:o,inner:V},de.style);r.polygon=te.polygon;const Me=q(k,p.grid.messages);J(a.next("path",`${W}__ribbon ${W}__ribbon--directed ${W}__mark`),{d:te.d,fill:M.series(k.source.index,k.source.label),"fill-opacity":.55,"data-link":`${k.source.key}->${k.target.key}`,"data-sweep":f((l.to-l.from)*180/Math.PI*1e3)/1e3,role:"img","aria-label":Me});continue}const[E,Y]=oe(l.from,V),[se,le]=oe(l.to,V),[ye,be]=oe(I.from,V),[Ae,Ne]=oe(I.to,V);J(a.next("path",`${W}__ribbon ${W}__mark`),{d:B(["M",f(E),f(Y),"A",f(V),f(V),0,0,1,f(se),f(le),"Q",f(F),f(o),f(ye),f(be),"A",f(V),f(V),0,0,1,f(Ae),f(Ne),"Q",f(F),f(o),f(E),f(Y),"Z"]),fill:M.series(k.source.index),"fill-opacity":.55,"data-link":`${k.source.key}->${k.target.key}`,"data-sweep":null,role:null,"aria-label":null})}for(const r of $){const[k,l]=oe(r.from,D),[I,E]=oe(r.to,D),[Y,se]=oe(r.to,V),[le,ye]=oe(r.from,V),be=r.to-r.from>Math.PI?1:0;J(a.next("path",`${W}__node ${W}__mark`),{d:B(["M",f(k),f(l),"A",f(D),f(D),0,be,1,f(I),f(E),"L",f(Y),f(se),"A",f(V),f(V),0,be,0,f(le),f(ye),"Z"]),fill:de?M.series(r.node.index,r.node.label):M.series(r.node.index),"data-node":r.node.key,"data-sweep":de?f((r.to-r.from)*180/Math.PI*1e3)/1e3:null})}a.finish();const y=new ce(p.groups.overlay);for(const r of $){const k=(r.from+r.to)/2,[l,I]=oe(k,D+6),E=y.next("text",`${W}__flow-label`);v(E,A);const Y=Math.cos(k)>=0;J(E,{x:f(l),y:f(I),"text-anchor":Y?"start":"end","dominant-baseline":"middle"}),L(E,r.node.label)}return y.finish(),{arcs:$,ribbons:_,ring:{cx:F,cy:o,inner:V,radius:D}}}function q(p,M){return`${p.source.label} → ${p.target.label}: ${ve(p.value,M)}`}function z(p){for(const M of p.nodes||[])if(!(typeof M.x!="number"||typeof M.width!="number")&&p.x>=M.x&&p.x<=M.x+M.width&&p.y>=M.y&&p.y<=M.y+M.height)return M;return null}function t(p){let M=null,ee=1/0;for(const H of p.links||[]){const F=H.source,o=H.target;if(!F||!o||typeof H.y0!="number")continue;const A=F.x+F.width,G=o.x;if(p.x<Math.min(A,G)||p.x>Math.max(A,G))continue;const D=(A+G)/2,V=r=>{const k=1-r;return k*k*k*A+3*k*k*r*D+3*k*r*r*D+r*r*r*G};let de=0,$=1;for(let r=0;r<24;r++){const k=(de+$)/2;V(k)<p.x?de=k:$=k}const _=(de+$)/2,oe=1-_,a=oe*oe*oe*H.y0+3*oe*oe*_*H.y0+3*oe*_*_*H.y1+_*_*_*H.y1,y=Math.max(1,H.thickness||1)/2;Math.abs(p.y-a)<=y&&(H.thickness||1)<ee&&(ee=H.thickness||1,M=H)}return M}function e(p){const M=p.ring;if(!M)return null;const ee=p.x-M.cx,H=p.y-M.cy,F=Math.sqrt(ee*ee+H*H);if(F<M.inner||F>M.radius)return null;let o=Math.atan2(H,ee);for(;o<w;)o+=b;for(;o>=w+b;)o-=b;for(const A of p.arcs||[])if(o>=A.from&&o<A.to)return A;return null}function s(p){const M=p.ring;if(!M)return null;const ee=p.x-M.cx,H=p.y-M.cy;if(Math.sqrt(ee*ee+H*H)>M.inner)return null;for(const F of p.ribbons||[])if(ue([d(F,M)],p.x,p.y))return F;return null}function d(p,M){if(p.polygon)return p.polygon;const{cx:ee,cy:H,inner:F}=M,o=V=>[ee+F*Math.cos(V),H+F*Math.sin(V)],A=[],G=(V,de)=>{for(let $=0;$<=R;$++)A.push(o(V+(de-V)*$/R))},D=(V,de)=>{for(let $=1;$<R;$++){const _=$/R,oe=1-_;A.push([oe*oe*V[0]+2*oe*_*ee+_*_*de[0],oe*oe*V[1]+2*oe*_*H+_*_*de[1]])}};return G(p.source.from,p.source.to),D(o(p.source.to),o(p.target.from)),G(p.target.from,p.target.to),D(o(p.target.to),o(p.source.from)),A}}),it("packages/modules/charts/hit.js",function(n,re){"use strict";Object.defineProperty(n,"valueText",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"hnodeHit",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(n,"itemAt",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(n,"ownsGeometry",{enumerable:!0,get:function(){return C}}),Object.defineProperty(n,"resolveHit",{enumerable:!0,get:function(){return q}});const ce=re("packages/modules/charts/format.js").measureText,ve=re("packages/modules/charts/treemap.js").tileAt,xe=re("packages/modules/charts/geo.js"),ie=xe.markerAt,ae=xe.regionAt,ue=re("packages/modules/charts/matrix.js").cellAt,B=re("packages/modules/charts/network.js"),f=B.linkAt,L=B.nodeAt,P=re("packages/modules/charts/hnodes.js"),W=P.hnodeAt,U=P.isHierarchyDraw,v=re("packages/modules/charts/flow.js"),m=v.chordArcAt,u=v.chordRibbonAt,b=v.flowNodeAt,O=v.ribbonAt,Q=" → ",w=" – ",R=" › ";function i(z,t,e){const s=ce(z,e);if(!t||typeof z!="number"||!Number.isFinite(z))return s;const d=z/t;return Number.isFinite(d)?`${s} (${e.number(d,{style:"percent",maximumFractionDigits:1})})`:s}function x(z,t){const e=z.item.node,s=t.bound.root&&t.bound.root.total||0,d=Array.isArray(z.path)?[...z.path]:[e.label];return{heading:d.length>1?d.join(R):e.label,rows:[{label:t.bound.measure.title,value:i(e.total,s,t.grid.messages),colour:t.scheme.series(z.item.index||0)}],datum:{label:e.label,value:e.total,category:e.value,column:t.bound.measure.col&&t.spec.x||null,series:null,depth:z.depth,path:d,rowKeys:e.rowKeys&&e.rowKeys.length?[...e.rowKeys]:e.rowKey?[e.rowKey]:[]}}}function T(z,t,e){const s=t.reduce((d,p)=>d+(p.value||0),0);return{heading:z.label||z.code,rows:[{label:e.bound.measure.title,value:typeof z.text=="string"?z.text:i(z.value,s,e.grid.messages),colour:e.scheme.series(0)}],datum:{label:z.label||z.code,value:z.value,category:z.code,column:e.spec.code||e.spec.x||null,series:null,path:[z.label||z.code],rowKeys:Array.isArray(z.rowKeys)?[...z.rowKeys]:[]}}}function h(z,t,e){const s=e.spec.value||e.spec.y||null,d=s?e.grid.columns.get(s):null,p=H=>`${Number(H).toFixed(4)}°`,M=(t.legend||[]).find(H=>H.colour===z.fill)||null,ee=[{label:d&&d.title||s||"",value:z.text||"",colour:z.fill},{label:"",value:`${p(z.lat)}, ${p(z.lon)}`,colour:"transparent"}];return M&&M.label&&ee.push({label:"",value:M.label,colour:z.fill}),{heading:z.label||z.text||"",rows:ee,datum:{label:z.label||z.text||"",value:z.value,category:z.value,column:s,series:null,path:[z.label||z.text||""],lon:z.lon,lat:z.lat,status:M?M.label:null,rowKeys:z.rowKey?[z.rowKey]:[]}}}function g(z,t){const e=p=>{const M=t.grid.columns.get(p);return M&&M.title||p},s=e(z.a),d=e(z.b);return{heading:`${s} × ${d}`,rows:[{label:t.spec.method==="spearman"?"ρ":"r",value:typeof z.r=="number"&&Number.isFinite(z.r)?z.r.toFixed(2):"",colour:t.scheme.series(0)}],datum:{label:`${s} × ${d}`,value:typeof z.r=="number"?z.r:null,category:null,column:null,series:null,path:[s,d],rowKeys:[]}}}function j(z,t){const e=[],s=t.drawn&&t.drawn.links||(t.drawn&&t.drawn.ribbons||[]).map(ee=>ee.link);for(const ee of s)if(!(ee.source!==z&&ee.target!==z))for(const H of ee.rowKeys||[])e.includes(H)||e.push(H);const d=Math.max(z.in||0,z.out||0),p=!!(t.spec&&t.spec.directed&&t.spec.type==="chord"),M=t.scheme.series(z.index||0,p?z.label:void 0);return{heading:z.label,rows:p?[{label:`${t.bound.measure.title} →`,value:ce(z.out||0,t.grid.messages),colour:M},{label:`${t.bound.measure.title} ←`,value:ce(z.in||0,t.grid.messages),colour:M}]:[{label:t.bound.measure.title,value:ce(d,t.grid.messages),colour:t.scheme.series(z.index||0)}],datum:{label:z.label,value:d,category:z.value===void 0?z.key:z.value,column:null,series:null,path:[z.label],rowKeys:e}}}function X(z,t){const e=`${z.source.label}${z.undirected?w:Q}${z.target.label}`;return{heading:e,rows:[{label:t.bound.measure.title,value:i(z.value,z.undirected?0:t.bound.total||0,t.grid.messages),colour:z.colour||t.scheme.series(z.source.index||0,t.spec&&t.spec.directed&&t.spec.type==="chord"?z.source.label:void 0)}],datum:{label:e,value:z.value,category:null,column:null,series:null,path:[z.source.label,z.target.label],rowKeys:Array.isArray(z.rowKeys)?[...z.rowKeys]:[]}}}function K(z,t){return{heading:z.heading||z.label||"",rows:Array.isArray(z.rows)?z.rows:[],datum:{label:z.label||z.heading||"",value:z.value===void 0?null:z.value,category:z.category===void 0?null:z.category,column:z.column||null,series:null,path:[z.label||z.heading||""],...z.extra||{},rowKeys:Array.isArray(z.rowKeys)?[...z.rowKeys]:[]}}}function pe(z,t){const e=z.node,s=t.bound.root&&t.bound.root.total||0,d=Array.isArray(z.path)&&z.path.length?[...z.path]:[z.label];return{heading:d.length>1?d.join(R):z.label,rows:[{label:t.bound.measure&&t.bound.measure.title||"",value:i(e.total,s,t.grid.messages),colour:z.colour||t.scheme.series(0)}],datum:{label:z.label,value:e.total,category:e.value,column:null,series:null,depth:z.depth,index:z.index,path:d,rowKeys:Array.isArray(e.rowKeys)?[...e.rowKeys]:[]}}}function ne(z,t,e){for(let s=z.length-1;s>=0;s--){const d=z[s];if(d&&typeof d.test=="function"&&d.test(t,e))return d}return null}function C(z){return z?!!(Array.isArray(z.items)||typeof z.hitAt=="function"||U(z)||Array.isArray(z.tiles)||Array.isArray(z.regions)||Array.isArray(z.markers)||Array.isArray(z.cells)&&Array.isArray(z.columns)||Array.isArray(z.ribbons)&&z.ring||Array.isArray(z.nodes)&&Array.isArray(z.links)):!1}function q(z){const t=z.drawn;if(!t||!z.bound||!C(t))return null;const{x:e,y:s}=z.at;if(typeof t.hitAt=="function")return t.hitAt({x:e,y:s},z)||null;if(Array.isArray(t.items)){const d=ne(t.items,e,s);return d?K(d,z):null}if(U(t)){const d=W({hnodes:t.hnodes,view:t.view,x:e,y:s});return d?pe(d,z):null}if(Array.isArray(t.tiles)){const d=ve({tiles:t.tiles,x:e,y:s});return d?x(d,z):null}if(Array.isArray(t.regions)){const d=ae({regions:t.regions,x:e,y:s});return d?T(d,t.regions,z):null}if(Array.isArray(t.markers)){const d=ie({markers:t.markers,x:e,y:s});return d?h(d,t,z):null}if(Array.isArray(t.cells)&&Array.isArray(t.columns)){const d=ue({cells:t.cells,x:e,y:s});return d?g(d,z):null}if(Array.isArray(t.ribbons)&&t.ring){const d=u({ribbons:t.ribbons,ring:t.ring,x:e,y:s});if(d)return X(d.link,z);const p=m({arcs:t.arcs,ring:t.ring,x:e,y:s});return p?j(p.node,z):null}if(Array.isArray(t.nodes)&&Array.isArray(t.links)){const d=t.nodes.some(ee=>typeof ee.r=="number"),p=d?L({nodes:t.nodes,x:e,y:s}):b({nodes:t.nodes,x:e,y:s});if(p)return j(p,z);const M=d?f({links:t.links,x:e,y:s}):O({links:t.links,x:e,y:s});return M?X(M,z):null}return null}}),it("packages/modules/charts/drag-edit.js",function(n,re){"use strict";Object.defineProperty(n,"EDITABLE_TYPES",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"HANDLE_CAP",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"resolveEditable",{enumerable:!0,get:function(){return R}}),Object.defineProperty(n,"settle",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"stepFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(n,"editableHandles",{enumerable:!0,get:function(){return g}}),Object.defineProperty(n,"sliceValue",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(n,"planWrites",{enumerable:!0,get:function(){return C}}),Object.defineProperty(n,"commitWrites",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"DragEditor",{enumerable:!0,get:function(){return z}});const ce=re("packages/core/src/internal/util.js").warnOnce,N=re("packages/modules/charts/svg.js"),ve=N.attrs,xe=N.clear,ie=N.round,ae=N.setText,J=N.svg,B=re("packages/modules/charts/format.js").measureText,L=re("packages/modules/charts/styles.js").NS,P=re("packages/modules/charts/scale.js"),W=P.niceStep,U=P.toNumber,v=Object.freeze(["line","step","area","bar","horizontalBar","scatter","bubble","floatingBar","horizontalFloatingBar","pie","donut"]),m=new Set(["sum","avg","mean","min","max","median","first","last"]),u=2e3,b={mouse:9,touch:22},O=3,Q=Math.PI*2,w=.995;function R(t){if(!t)return null;const e=t===!0?{}:typeof t=="object"?t:{},s=M=>typeof M=="number"&&Number.isFinite(M)?M:null,d=s(e.step)!==null&&s(e.step)>0?s(e.step):null;let p=null;return e.snap===!0?p=d:s(e.snap)!==null&&s(e.snap)>0&&(p=s(e.snap)),{axis:e.axis==="x"||e.axis==="xy"?e.axis:"y",step:d,min:s(e.min),max:s(e.max),snap:p,distribute:e.distribute==="proportional"||e.distribute==="first"?e.distribute:null}}function i(t,e,s={}){let d=t;if(e.snap){const M=e.min!==null?e.min:0;d=Math.round((d-M)/e.snap)*e.snap+M}if(e.min!==null&&d<e.min&&(d=e.min),e.max!==null&&d>e.max&&(d=e.max),s.integer)return Math.round(d);const p=s.unit&&s.unit>0?Math.min(10,Math.max(0,Math.floor(-Math.log10(s.unit)))):6;return Number(d.toFixed(p))}function x(t,e){return t.step?t.step:W(Math.abs(e)/100)}function T(t){return typeof t=="number"&&Number.isFinite(t)}function h(t){return Array.isArray(t.rowKeys)&&t.rowKeys.length?t.rowKeys:t.rowKey?[t.rowKey]:[]}function g(t){const{drawn:e,bound:s,spec:d,type:p,editable:M}=t,ee=[];return!e||!s||!v.includes(p)||d.multiples?(ee.push({id:"type",message:"type"}),{handles:[],notices:ee}):p==="pie"||p==="donut"?pe(t,ee):!Array.isArray(e.series)||!e.yScale?{handles:[],notices:ee}:e.percent||d.stack&&s.series.length>1?(ee.push({id:"type",message:"stacked"}),{handles:[],notices:ee}):p==="floatingBar"||p==="horizontalFloatingBar"?K(t,ee):X(t,ee)}function j(t,e,s,d,p){return e.length?e.some(ee=>{const H=t.rows.byKey(ee);return!H||H.group})?{ok:!1,reason:"aggregated"}:e.length>1?p||!s.distribute?{ok:!1,reason:"aggregated"}:d!=="sum"&&d!=="avg"&&d!=="mean"?{ok:!1,reason:"distribute"}:{ok:!0,distribute:!0}:m.has(d)?{ok:!0,distribute:!1}:{ok:!1,reason:"aggregated"}:{ok:!1,reason:"aggregated"}}function X(t,e){const{drawn:s,bound:d,editable:p,grid:M}=t,ee=[],H=!!s.horizontal,F=p.axis!=="x",o=p.axis!=="y",A=d.measure&&d.measure.col,G=d.dimension&&d.dimension.col,D=s.xScale,V=!H&&D&&D.kind==="linear"&&!!G;o&&!V&&e.push({id:"axis",message:"axis"});const de=$=>$?M.columns.get($):null;for(const $ of s.series){const _=$.axis==="right"&&s.rightScale?s.rightScale:s.yScale;for(let oe=0;oe<$.points.length;oe++){const a=$.points[oe];if(!a||!T(a.y)||!T(a.px))continue;const y=h(a),r=[];let k=null,l=!1;if(F&&A&&_&&_.kind==="linear"){const le=j(M,y,p,d.measure.fn,!1);le.ok?l=le.distribute:k=le.reason,r.push({name:"y",colId:A,scale:_,screen:H?"x":"y",value:a.y,column:de(A)})}if(o&&V&&U(a.x)!==null){const le=j(M,y,p,"first",!0);le.ok||(k=k||le.reason),r.push({name:"x",colId:G,scale:D,screen:"x",value:U(a.x),column:de(G)})}if(!r.length)continue;const I=r.find(le=>le.name==="y"),E=r.find(le=>le.name==="x"),Y=E?E.scale.of(E.value):I&&H?I.scale.of(I.value):a.px,se=I&&!H?I.scale.of(I.value):a.py;!T(Y)||!T(se)||ee.push({id:`${$.key}\0${a.xKey}`,label:`${a.label}${$.label&&d.series.length>1?` (${$.label})`:""}`,keys:y,px:Y,py:se,axes:r,reason:k,distribute:l,kind:"point",orientation:H?"horizontal":"vertical"})}}return{handles:ee,notices:e}}function K(t,e){const{drawn:s,bound:d,spec:p,grid:M,editable:ee}=t,H=[];if(ee.axis==="x")return e.push({id:"axis",message:"axis"}),{handles:H,notices:e};const F=Array.isArray(p.y)?p.y:[],o=s.yScale;if(s.valueKind==="time"||!o||o.kind!=="linear"||F.length!==2)return e.push({id:"type",message:"floating"}),{handles:H,notices:e};const A=!!s.horizontal;for(const G of s.series)for(const D of G.points){if(!T(D.y0)||!T(D.y1)||!T(D.px))continue;const V=h(D),de=j(M,V,ee,"first",!0);for(const[$,_,oe]of[["from",F[0],D.y0],["to",F[1],D.y1]]){const a=o.of(oe);if(!T(a))continue;const y=M.columns.get(_);H.push({id:`${G.key}\0${D.xKey}\0${$}`,label:`${D.label}, ${y&&y.title||_}`,keys:V,px:A?a:D.px,py:A?D.py:a,axes:[{name:"y",colId:_,scale:o,screen:A?"x":"y",value:oe,column:y}],reason:de.ok?null:de.reason,distribute:!1,kind:"end",orientation:A?"horizontal":"vertical"})}}return{handles:H,notices:e}}function pe(t,e){const{drawn:s,bound:d,grid:p,editable:M}=t,ee=[];if(M.axis!=="y"||!Array.isArray(s.arcs)||!s.centre)return M.axis!=="y"&&e.push({id:"axis",message:"axis"}),{handles:ee,notices:e};const H=d.measure&&d.measure.col,F=d.root&&d.root.total;if(!H||!(F>0))return{handles:ee,notices:e};const o=p.columns.get(H);for(const A of s.arcs){if(A.depth!==1||!A.geometry||!(A.total>0))continue;const G=A.node,D=h(G),V=j(p,D,M,d.measure.fn,!1),de=(A.to-A.from)*F/A.total,$=(A.geometry.inner+A.geometry.outer)/2;ee.push({id:`slice\0${A.label}`,label:String(A.label),keys:D,px:A.geometry.cx+$*Math.cos(A.to),py:A.geometry.cy+$*Math.sin(A.to),axes:[{name:"y",colId:H,scale:null,screen:"angle",value:A.total,column:o}],pie:{cx:A.geometry.cx,cy:A.geometry.cy,mid:$,from:A.from,to:A.to,sweep:de,whole:F},reason:V.ok?null:V.reason,distribute:V.ok?V.distribute:!1,kind:"slice",orientation:"angle"})}return{handles:ee,notices:e}}function ne(t,e,s){const d=Math.max(0,Math.min(w,t));return d*(e-s)/(1-d)}function C(t,e,s,d,p,M){if(!e.distribute){const G=e.keys[0];return G?{writes:[{key:G,colId:s.colId,value:d}]}:{refusal:"aggregated"}}const ee=e.keys.map(G=>U(t.rows.value(G,s.colId)));if(ee.some(G=>G===null))return{refusal:"distribute"};const H=ee.length,F=ee.reduce((G,D)=>G+D,0),o=M==="sum"?d:d*H;let A;return p.distribute==="first"?A=ee.map((G,D)=>D===0?G+(o-F):G):F===0?A=ee.map(()=>o/H):A=ee.map(G=>G*o/F),{writes:e.keys.map((G,D)=>({key:G,colId:s.colId,value:Number(A[D].toPrecision(12)),old:ee[D]})).filter(G=>G.value!==G.old).map(({key:G,colId:D,value:V})=>({key:G,colId:D,value:V}))}}function q(t,e){const s={reason:null,message:null},d=[t.on("validation:failed",ee=>{const H=ee&&ee.failures&&ee.failures[0];H&&!s.message&&(s.reason="validation",s.message=H.message)}),t.on("edit:cancelled",ee=>{ee&&!s.reason&&(s.reason=String(ee.reason||"prevented"))}),t.on("cell:edit:end",ee=>{const H=ee&&ee.valid===!1&&ee.errors&&ee.errors[0];H&&!s.message&&(s.reason="validation",s.message=H.message)})],p=ee=>{for(const H of d)H();if(ee<e.length&&t.edit&&typeof t.edit.stop=="function")try{t.edit.stop(!0)}catch{}return{ok:ee===e.length,count:ee,reason:ee===e.length?null:s.reason||"readOnly",message:ee===e.length?null:s.message}};let M;try{M=t.edit.setCells(e,"cell",{origin:"user"})}catch(ee){for(const H of d)H();return Promise.resolve({ok:!1,count:0,reason:"error",message:String(ee&&ee.message?ee.message:ee)})}return M&&typeof M.then=="function"?M.then(ee=>p(Number(ee)||0)):Promise.resolve(p(Number(M)||0))}class z{#r;#n;#i=[];#t=new Map;#s=null;#l=null;#o=null;#a=!1;#m=!1;#f=[];constructor(e){this.#r=e,this.#n=J(e.doc,"g",{class:`${L}__edit`}),e.svg.appendChild(this.#n);const s=(d,p,M,ee)=>{d.addEventListener(p,M,ee),this.#f.push(()=>d.removeEventListener(p,M,ee))};s(this.#n,"pointerdown",d=>this.#e(d)),s(this.#n,"touchstart",d=>{const p=this.#t.get(d.target);p&&!p.reason&&d.cancelable!==!1&&d.preventDefault&&d.preventDefault()},{passive:!1}),s(e.svg,"pointermove",d=>this.#d(d)),s(e.svg,"pointerup",d=>this.#z(d)),s(e.svg,"pointercancel",()=>this.#$()),s(this.#n,"keydown",d=>this.#L(d)),s(this.#n,"focusout",d=>this.#F(d))}get dragging(){return!!this.#l}consumeClick(){const e=this.#a;return this.#a=!1,e}sync(e){if(this.#m)return;const s=R(e.spec.editable),d=this.#l?this.#l.handle.id:this.#o?this.#o.handle.id:null,p=this.#l?this.#l.values:this.#o?this.#o.values:null;if(this.#M(),!s||!e.drawn||!e.bound){this.#$(),this.#o=null;return}const M=g({drawn:e.drawn,bound:e.bound,spec:e.spec,type:e.type,grid:this.#r.grid(),editable:s});for(const o of M.notices)this.#p(o);const ee=this.#r.doc,H=M.handles.slice(0,u);M.handles.length>u&&ce("chart:editable:cap","editable draws a handle on at most 2000 marks, and this chart has more, so the rest cannot be dragged. Filter the grid, or aggregate the chart, to a size a person can point at.");let F=!0;for(const o of H){const A=!o.reason,G=J(ee,"circle",{class:`${L}__edit-handle`,cx:ie(o.px),cy:ie(o.py),r:6,role:"slider",tabindex:A&&F?"0":"-1","data-editable":A?"true":"false","aria-label":o.label,"aria-orientation":o.orientation==="horizontal"?"horizontal":"vertical","aria-valuenow":String(o.axes[0].value),"aria-valuetext":this.#c(o,o.axes[0],o.axes[0].value)});A||G.setAttribute("aria-disabled","true"),A&&(F=!1),o.node=G,o.editable=s,this.#n.appendChild(G),this.#t.set(G,o)}if(this.#i=H,this.#s=null,d){const o=H.find(G=>G.id===d),A=this.#l||this.#o;o&&A?(A.handle=o,this.#O(o,p||{})):(this.#$(),this.#o=null)}}withoutHandles(e){const s=this.#n.parentNode;if(!s)return e();s.removeChild(this.#n);try{return e()}finally{s.appendChild(this.#n)}}clear(){this.#$(),this.#o=null,this.#M()}destroy(){this.#m=!0;for(const e of this.#f)e();this.#f=[],this.#M(),this.#n.parentNode&&this.#n.parentNode.removeChild(this.#n)}#M(){xe(this.#n),this.#t.clear(),this.#i=[],this.#s=null}#p(e){e.id==="type"?ce("chart:editable:type","editable has no effect on this chart: its type has no draggable marks, it is stacked or percent (no single value at the end of a mark), it is drawn as small multiples, or it is a floating bar on a time axis. It drags a line, step or area point, a bar or horizontal bar end, both ends of a floating bar, a scatter or bubble point, and a pie or donut slice edge."):e.id==="axis"&&ce("chart:editable:axis",'editable.axis asks for an axis this chart cannot drag along. Only a numeric x axis (a scatter or bubble) can be dragged sideways; a bar, line, area, floating bar, pie or donut moves along its value only. Use axis: "y".')}#c(e,s,d){const p=s.column;if(p&&typeof p.formatValue=="function")try{const M=p.formatValue(d,null);if(typeof M=="string"&&M!=="")return M}catch{}return B(d,this.#r.grid().messages)}#k(e){const s=e.scale;if(!s||!s.range||!s.domain)return 0;const d=Math.abs(s.range[1]-s.range[0])||1;return(s.domain.max-s.domain.min)/d}#O(e,s){if(!e.node)return;const d=e.axes.find(A=>A.name==="y"),p=e.axes.find(A=>A.name==="x");let M=e.px,ee=e.py;if(e.kind==="slice"){const A=s.y!==void 0?s.y:e.axes[0].value,G=e.pie,D=A/(G.whole-e.axes[0].value+A),V=G.from+D*G.sweep;M=G.cx+G.mid*Math.cos(V),ee=G.cy+G.mid*Math.sin(V)}else if(p&&s.x!==void 0&&(M=p.scale.of(s.x)),d&&s.y!==void 0){const A=d.scale.of(s.y);d.screen==="x"?M=A:ee=A}ve(e.node,{cx:ie(M),cy:ie(ee)}),e.node.setAttribute("data-active","true");const H=e.axes.map(A=>s[A.name]===void 0?null:this.#c(e,A,s[A.name])).filter(A=>A!==null);this.#s||(this.#s=J(this.#r.doc,"text",{class:`${L}__edit-value`,"pointer-events":"none"}),this.#n.appendChild(this.#s)),ae(this.#s,H.join(" , "));const F=e.orientation==="horizontal";ve(this.#s,{x:ie(M+(F?0:12)),y:ie(ee+(F?-12:4)),"text-anchor":F?"middle":"start"});const o=e.axes[0];s[o.name]!==void 0&&(e.node.setAttribute("aria-valuenow",String(s[o.name])),e.node.setAttribute("aria-valuetext",this.#c(e,o,s[o.name])))}#v(e){if(e.node){ve(e.node,{cx:ie(e.px),cy:ie(e.py)}),e.node.removeAttribute("data-active");const s=e.axes[0];e.node.setAttribute("aria-valuenow",String(s.value)),e.node.setAttribute("aria-valuetext",this.#c(e,s,s.value))}this.#s&&this.#s.parentNode&&this.#s.parentNode.removeChild(this.#s),this.#s=null}#x(e){const s=this.#r.status;ae(s,e),e?s.removeAttribute("hidden"):s.setAttribute("hidden","")}#b(e){if(!e.reason)return!0;const s=this.#r.grid().messages;return e.reason==="distribute"?ce("chart:editable:distribute","editable.distribute shares a new total between the rows of a mark, and only a sum or an average has a total to share. A mark that is a minimum, a maximum, a median or a count cannot be dragged."):ce("chart:editable:aggregated",'a chart mark that stands for several rows (a bar summing a category, a group) cannot be dragged, because there is no single cell to write. Set editable: { distribute: "proportional" } (or "first") to say how a new total is shared between its rows, or chart one row per mark.'),this.#x(s.t("chart.edit.aggregated")),!1}#e(e){this.#a=!1;const s=this.#t.get(e.target);if(!s||(e.stopPropagation&&e.stopPropagation(),e.button!==void 0&&e.button!==0&&e.pointerType!=="touch")||!this.#b(s))return;this.#x(""),this.#o=null,this.#r.hideTooltip();const d=this.#r.pointOf(e);this.#l={handle:s,pointerId:e.pointerId,from:d,moved:!1,values:{},grab:{x:d.x-s.px,y:d.y-s.py},angle:s.pie?s.pie.to:0,last:s.pie?Math.atan2(d.y-s.pie.cy,d.x-s.pie.cx):0},e.preventDefault&&e.preventDefault();const p=this.#r.svg;if(p.setPointerCapture&&e.pointerId!==void 0)try{p.setPointerCapture(e.pointerId)}catch{}}#d(e){const s=this.#l;if(!s||s.pointerId!==void 0&&e.pointerId!==void 0&&e.pointerId!==s.pointerId)return;const d=this.#r.pointOf(e);if(!s.moved&&Math.hypot(d.x-s.from.x,d.y-s.from.y)<O)return;s.moved=!0;const p=s.handle,M=p.editable,ee={};if(p.kind==="slice"){const H=p.pie;let F=Math.atan2(d.y-H.cy,d.x-H.cx),o=F-s.last;for(;o>Math.PI;)o-=Q;for(;o<=-Math.PI;)o+=Q;s.angle+=o,s.last=F;const A=(s.angle-H.from)/H.sweep,G=ne(A,H.whole,p.axes[0].value);ee.y=i(G,M,{unit:H.whole/400})}else for(const H of p.axes){const F=H.screen==="x"?d.x-s.grab.x:d.y-s.grab.y,o=H.scale.range,A=Math.abs(o[1]-o[0]),G=Math.min(o[0],o[1])-A,D=Math.max(o[0],o[1])+A,V=H.scale.invert(Math.max(G,Math.min(D,F)));ee[H.name]=i(V,M,{unit:this.#k(H),integer:H.column&&H.column.type==="integer"})}s.values=ee,this.#O(p,ee),e.preventDefault&&e.preventDefault()}#z(e){const s=this.#l;if(!s||s.pointerId!==void 0&&e.pointerId!==void 0&&e.pointerId!==s.pointerId)return;this.#l=null;const d=this.#r.svg;if(d.releasePointerCapture&&s.pointerId!==void 0)try{d.releasePointerCapture(s.pointerId)}catch{}if(!s.moved){this.#v(s.handle);return}this.#a=!0,this.#N(s.handle,s.values)}#$(){const e=this.#l;this.#l=null,e&&this.#v(e.handle)}#N(e,s){const d=this.#r.grid(),p=this.#r.fn(),M=[];for(const H of e.axes){const F=s[H.name];if(F===void 0||F===H.value)continue;const o=C(d,e,H,F,e.editable,p);if("refusal"in o)return e.reason=o.refusal,this.#v(e),this.#b(e),Promise.resolve();M.push(...o.writes)}if(!M.length)return this.#v(e),Promise.resolve();const ee={rowKeys:e.keys.slice(),colId:e.axes[0].colId,value:s[e.axes[0].name],oldValue:e.axes[0].value,writes:M.map(H=>({...H}))};return q(d,M).then(H=>{if(this.#m)return;if(H.ok){this.#s&&this.#s.parentNode&&this.#s.parentNode.removeChild(this.#s),this.#s=null,e.node&&e.node.removeAttribute("data-active"),this.#x(""),this.#r.edited(ee);return}if(H.count>0&&d.edit&&typeof d.edit.undo=="function")try{d.edit.undo()}catch{}this.#v(e);const F=d.messages,o=H.message||(H.reason&&H.reason!=="readOnly"&&H.reason!=="error"?F.t("chart.edit.refusedWhy",{reason:H.reason}):F.t("chart.edit.refused"));this.#x(o),this.#r.rejected({...ee,reason:H.reason,message:o})})}#L(e){const s=this.#t.get(e.target);if(!s)return;const d=e.key,p=()=>{e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation()},M=this.#i.filter(a=>!a.reason),ee=M.indexOf(s),H=a=>{const y=M[Math.max(0,Math.min(M.length-1,a))];if(!(!y||y===s)){this.#_();for(const r of M)r.node.setAttribute("tabindex",r===y?"0":"-1");y.node.focus&&y.node.focus()}};if(d==="Home"){p(),H(0);return}if(d==="End"){p(),H(M.length-1);return}if(d==="PageDown"){p(),H(ee+1);return}if(d==="PageUp"){p(),H(ee-1);return}if(d==="Escape"){this.#o&&(p(),this.#_());return}if(d==="Enter"||d===" "){if(!this.#b(s)){p();return}p();const a=this.#o;this.#o=null,a&&a.handle===s&&this.#N(s,a.values);return}const F={ArrowUp:["y",1,-1],ArrowDown:["y",-1,1],ArrowRight:["x",1,1],ArrowLeft:["x",-1,-1]}[d];if(!F)return;let o=F[0];const A=F[1];if(s.axes.length===1){const a=s.axes[0];if(s.kind!=="slice"&&a.screen!==F[0]){p(),H(ee+F[2]);return}o=a.name}const G=s.axes.find(a=>a.name===o);if(!G||(p(),!this.#b(s)))return;const D=s.editable,V=this.#o&&this.#o.handle===s&&this.#o.values[o]!==void 0?this.#o.values[o]:G.value,de=s.kind==="slice"?s.pie.whole:G.scale.domain.max-G.scale.domain.min,$=x(D,de)*(e.shiftKey?10:1),_=i(V+A*$,D,{unit:s.kind==="slice"?de/400:this.#k(G),integer:G.column&&G.column.type==="integer"}),oe={...this.#o&&this.#o.handle===s?this.#o.values:{},[o]:_};this.#o={handle:s,values:oe},this.#x(""),this.#O(s,oe)}#_(){const e=this.#o;this.#o=null,e&&this.#v(e.handle)}#F(e){const s=e.relatedTarget;s&&this.#t.has(s)||this.#_()}}}),it("packages/modules/charts/floating.js",function(n,re){"use strict";Object.defineProperty(n,"bindFloating",{enumerable:!0,get:function(){return z}}),Object.defineProperty(n,"drawFloating",{enumerable:!0,get:function(){return e}});const Se=re("packages/modules/charts/axis.js"),ce=Se.drawAxisLines,N=Se.drawAxisTitle,ve=Se.drawBandLabels,xe=Se.drawCategoryAxis,ie=Se.drawMeasureAxis,ae=Se.overhangFor,J=Se.setPlotClip,ue=re("packages/modules/charts/frame.js"),B=ue.Pool,f=ue.shouldRotate,P=re("packages/modules/charts/format.js").formatters,W=re("packages/modules/charts/scale.js"),U=W.bandScale,v=W.extent,m=W.isNumber,u=W.key,b=W.linearScale,O=W.timeScale,Q=W.toNumber,w=W.toTime,R=re("packages/modules/charts/svg.js"),i=R.attrs,x=R.round,h=re("packages/modules/charts/styles.js").NS,j=re("packages/modules/charts/scheme.js").resolveScheme,K=re("packages/modules/charts/bind.js").leafRows,ne=re("packages/core/src/internal/util.js").warnOnce,C=Object.freeze(["date","datetime","timestamp","dateString"]);function q(s,d){return d==="time"?w(s):Q(s)}function z(s,d){const p=Array.isArray(d.y)&&d.y.length===2?d.y:null;if(!p)return ne("chart:floating:y-pair",`a floating bar needs a from/to pair of columns, given as y: [lowCol, highCol]. It was given ${JSON.stringify(d.y)}, so it drew nothing.`),{series:[],categories:[],labels:[],kind:"category",measure:{col:null,fn:"sum",title:""},dimension:{col:d.x||null,title:""},empty:!0,rows:0,floating:!0,valueKind:"linear"};const M=p[0],ee=p[1],H=d.x||null,F=d.series||null,o=s.columns.get(M),A=s.columns.get(ee),G=C.includes(o&&o.type)||C.includes(A&&A.type)?"time":"linear",D=r=>q(r,G),V=new Map,de=new Map,$=Array.isArray(d.rows)?d.rows:K(s);for(let r=0;r<$.length;r++){const k=$[r],l=H?k.group&&k.groupColumn===H?k.groupValue:s.rows.value(k.key,H):r,I=u(l);if(!V.has(I)){const Ae=H?s.rows.text(k.key,H)||String(l):String(r);V.set(I,{value:l,label:Ae,order:V.size})}const E=F?k.group&&k.groupColumn===F?k.groupValue:s.rows.value(k.key,F):null,Y=F?u(E):"";de.has(Y)||de.set(Y,{label:F?s.rows.text(k.key,F)||String(E):"",points:new Map});const se=de.get(Y);let le=se.points.get(I);le||(le={lows:[],highs:[],rowKey:k.key,keys:[]},se.points.set(I,le)),d.editable&&le.keys.push(k.key);const ye=D(s.rows.value(k.key,M)),be=D(s.rows.value(k.key,ee));ye!==null&&le.lows.push(ye),be!==null&&le.highs.push(be)}const _=[...V.values()].sort((r,k)=>r.order-k.order),oe=typeof d.limit=="number"&&d.limit>0?_.slice(0,d.limit):_,a=[...de.entries()].map(([r,k],l)=>({key:r,label:k.label,index:l,points:oe.map(I=>{const E=u(I.value),Y=k.points.get(E),se=Y&&Y.lows.length?Math.min(...Y.lows):null,le=Y&&Y.highs.length?Math.max(...Y.highs):null;return{x:I.value,xKey:E,label:I.label,y0:se,y1:le,y:le!==null?le:se,rows:1,rowKey:Y?Y.rowKey:null,...d.editable&&Y?{rowKeys:Y.keys}:{}}})})),y=[o&&o.title,A&&A.title];return{series:a,categories:oe.map(r=>r.value),labels:oe.map(r=>r.label),kind:"category",measure:{col:null,fn:"sum",title:y.filter(Boolean).join(" – ")},dimension:{col:H,title:(s.columns.get(H)||{}).title||H||""},empty:a.length===0||oe.length===0,rows:$.length,truncated:_.length-oe.length,floating:!0,valueKind:G}}function t(s,d,p){const M=[];for(const o of s)for(const A of o.points){const G=q(A.y0,d),D=q(A.y1,d);G!==null&&M.push(G),D!==null&&M.push(D)}const ee=v(M)||{min:0,max:1};let{min:H,max:F}=ee;if(H===F){const o=Math.abs(H)>0?Math.abs(H)/10:1;H-=o,F+=o}return m(p&&p.min)&&(H=p.min),m(p&&p.max)&&(F=p.max),H===F&&(F=H+1),{min:H,max:F,kind:d}}function e(s){const{bound:d,plot:p}=s,M=s.type==="horizontalFloatingBar",ee=d.valueKind||"linear",H=s.axis||{x:{},y:{}},F=s.typography||{small:s.fontSize||11,axisTitle:11},o=d.series.filter(k=>!s.hidden.has(k.key)),A=s.scheme||j(),G=t(o,ee,H.y),D=M?[p.left,p.right]:[p.bottom,p.top],V=ee==="time"?O(G,D):b(G,D),de=M?[p.top,p.bottom]:[p.left,p.right],$=U(d.categories,de,.2),_=P(s.grid,{kind:ee,span:G.max-G.min,step:(G.max-G.min)/5}),oe=s.axes!==!1;oe&&ie({gridGroup:s.groups.grid,axisGroup:s.groups.axis,plot:p,scale:V,format:_,horizontal:M,side:"left",config:H.y,grid:s.grid,size:F.small}),oe&&(M?ve({group:s.groups.overlay,plot:p,scale:$,labels:d.labels,fontSize:F.small,config:H.x}):xe({group:s.groups.overlay,plot:p,scale:$,labels:d.labels,fontSize:F.small,rotated:f(d.labels,$.step,F.small),config:H.x})),oe&&(ce({group:s.groups.rules,plot:p,side:"left"}),N({group:s.groups.axis,plot:p,text:H.y.title,side:M?"bottom":"left",size:F.axisTitle}),N({group:s.groups.axis,plot:p,text:H.x.title,side:M?"left":"bottom",size:F.axisTitle})),J(s.groups,p,ae(s.type));const a=s.pool||new B(s.groups.marks),y=$.bandwidth,r=o.length?y/o.length:y;for(let k=0;k<o.length;k++){const l=o[k],I=A.series(l.index,l.label);for(let E=0;E<l.points.length;E++){const Y=l.points[E],se=q(Y.y0,ee),le=q(Y.y1,ee);if(se===null||le===null)continue;const ye=Math.min(se,le),be=Math.max(se,le);if(M){const Ae=$.of(Y.x);if(Number.isNaN(Ae))continue;const Ne=x(V.of(ye)),te=x(V.of(be)),Me=x(Ae+k*r);i(a.next("rect",`${h}__float ${h}__mark`,`${l.key}:${u(Y.x)}`),{x:Ne,y:Me,width:x(Math.max(1,te-Ne)),height:x(Math.max(0,r)),fill:I,"data-series":l.index,"data-point":E}),Y.px=te,Y.py=x(Me+r/2),Y.pbase=Ne}else{const Ae=$.of(Y.x);if(Number.isNaN(Ae))continue;const Ne=x(V.of(be)),te=x(V.of(ye));i(a.next("rect",`${h}__float ${h}__mark`,`${l.key}:${u(Y.x)}`),{x:x(Ae+k*r),y:x(Math.min(Ne,te)),width:x(Math.max(1,r)),height:x(Math.max(1,Math.abs(te-Ne))),fill:I,"data-series":l.index,"data-point":E}),Y.px=x(Ae+k*r+r/2),Y.py=x(Math.min(Ne,te)),Y.pbase=x(Math.max(Ne,te))}}}return s.pool||a.finish(),{xScale:$,yScale:V,series:o,horizontal:M,floating:!0,valueKind:ee}}}),it("packages/modules/charts/pyramid.js",function(n,re){"use strict";Object.defineProperty(n,"bindPyramid",{enumerable:!0,get:function(){return K}}),Object.defineProperty(n,"drawPyramid",{enumerable:!0,get:function(){return ne}});const Se=re("packages/modules/charts/axis.js"),ce=Se.drawAxisLines,N=Se.drawAxisTitle,ve=Se.drawBandLabels,xe=Se.setPlotClip,ie=Se.overhangFor,ae=Se.tickLabeller,ue=re("packages/modules/charts/frame.js").Pool,B=re("packages/modules/charts/format.js"),f=B.formatters,L=B.measureFormat,P=re("packages/modules/charts/scale.js"),W=P.bandScale,U=P.isNumber,v=P.key,m=P.linearScale,u=P.measureDomain,b=re("packages/modules/charts/svg.js"),O=b.attrs,Q=b.round,R=re("packages/modules/charts/styles.js").NS,x=re("packages/modules/charts/scheme.js").resolveScheme,T=re("packages/modules/charts/bind.js"),h=T.bindMeasures,g=T.bindSeries,X=re("packages/core/src/internal/util.js").warnOnce;function K(C,q){const z=Array.isArray(q.measures)?q.measures:[],t=z.length>=2?h(C,{...q,measures:z.slice(0,2)}):g(C,q);return t.series.length!==2&&X("chart:pyramid:halves",`a populationPyramid needs exactly two halves: a y column split by a series column holding two values, or measures: [left, right]. It found ${t.series.length}, so it draws the first two.`),{...t,series:t.series.slice(0,2),pyramid:!0}}function pe(C,q){let z=0;for(const t of C)for(const e of t.points){const s=q(e);s!==null&&(z=Math.max(z,Math.abs(s)))}return z>0?z:1}function ne(C){const{bound:q,plot:z}=C,t=C.pyramid||{},e=C.scheme||x(),s=C.axis||{x:{},y:{}},d=C.typography||{small:C.fontSize||11,axisTitle:11},p=C.hidden||new Set,M=q.series.slice(0,2),[ee,H]=M,F=!!t.percent;let o=0;for(const be of M)for(const Ae of be.points)U(Ae.y)&&(o+=Math.abs(Ae.y));const A=be=>{if(!U(be.y))return null;const Ae=Math.abs(be.y);return F?o?Ae/o*100:0:Ae},G=M.filter(be=>!p.has(be.key)),D=t.scale!=="independent",V=pe(G.length?G:M,A),de=D?V:pe(ee&&!p.has(ee.key)?[ee]:[],A),$=D?V:pe(H&&!p.has(H.key)?[H]:[],A),_=Q((z.left+z.right)/2),oe=be=>u([0,be],{zero:!0,nice:!0,min:0}),a=m(oe(de),[_,z.left]),y=m(oe($),[_,z.right]),r=W(q.categories,[z.top,z.bottom],.2),k=be=>(be.domain.max-be.domain.min)/5,l=f(C.grid,{kind:"linear",step:Math.max(k(a),k(y))}),I={tick:be=>l.tick(Math.abs(be))+(F?"%":"")},E=ae(s.y,I,C.grid);if(C.axes!==!1){const be=new ue(C.groups.grid),Ae=new ue(C.groups.axis),Ne=(te,Me)=>{for(const ke of te.ticks()){if(Me&&ke===0)continue;const we=Q(te.of(ke));O(be.next("line",`${R}__gridline`),{x1:we,x2:we,y1:Q(z.top),y2:Q(z.bottom),"stroke-opacity":ke===0?1:.6,"stroke-width":ke===0?1.5:1});const je=Ae.next("text",`${R}__tick`);O(je,{x:we,y:Q(z.bottom+6),"text-anchor":"middle","dominant-baseline":"hanging"}),je.textContent=E(ke)}};Ne(y,!1),Ne(a,!0),be.finish(),Ae.finish(),ve({group:C.groups.overlay,plot:z,scale:r,labels:q.labels,fontSize:d.small,config:s.x}),ce({group:C.groups.rules,plot:z,side:"left"}),N({group:C.groups.axis,plot:z,text:s.y.title,side:"bottom",size:d.axisTitle})}xe(C.groups,z,ie(C.type));const Y=C.pool||new ue(C.groups.marks),se=r.bandwidth,le=(be,Ae,Ne)=>{if(!be||p.has(be.key))return;const te=e.series(be.index,be.label);for(let Me=0;Me<be.points.length;Me++){const ke=be.points[Me],we=A(ke);if(we===null)continue;const je=r.of(ke.x);if(Number.isNaN(je))continue;const Pe=Q(Ae.of(we));O(Y.next("rect",`${R}__bar ${R}__pyramid-bar ${R}__mark`,`${be.key}:${v(ke.x)}`),{x:Q(Math.min(Pe,_)),y:Q(je),width:Q(Math.abs(Pe-_)),height:Q(Math.max(0,se)),fill:te,"data-series":be.index,"data-point":Me}),ke.px=Pe,ke.py=Q(je+se/2),ke.pbase=_,ke.side=Ne}};le(ee,a,-1),le(H,y,1),C.pool||Y.finish();const ye=be=>C.grid.columns.get(be.key);return{xScale:r,yScale:y,series:G,horizontal:!0,pyramid:{percent:F,shared:D,centre:_},valueText:(be,Ae)=>{const Ne=L(Math.abs(Ae.y),ye(be),C.grid);if(!F)return Ne;const te=o?Math.abs(Ae.y)/o:0;return`${Ne} (${C.grid.messages.number(te,{style:"percent",maximumFractionDigits:1})})`}}}}),it("packages/modules/charts/bullet.js",function(n,re){"use strict";Object.defineProperty(n,"bindBullet",{enumerable:!0,get:function(){return K}}),Object.defineProperty(n,"drawBullet",{enumerable:!0,get:function(){return ne}});const Se=re("packages/modules/charts/axis.js"),ce=Se.drawAxisLines,N=Se.drawAxisTitle,ve=Se.drawBandLabels,xe=Se.drawCategoryAxis,ie=Se.drawMeasureAxis,ae=Se.overhangFor,J=Se.setPlotClip,ue=re("packages/modules/charts/frame.js"),B=ue.Pool,f=ue.shouldRotate,L=re("packages/modules/charts/format.js"),P=L.formatters,W=L.measureFormat,U=re("packages/modules/charts/scale.js"),v=U.bandScale,m=U.isNumber,u=U.key,b=U.linearScale,O=U.measureDomain,Q=U.toNumber,w=re("packages/modules/charts/svg.js"),R=w.attrs,i=w.round,T=re("packages/modules/charts/styles.js").NS,g=re("packages/modules/charts/scheme.js").resolveScheme,X=re("packages/modules/charts/bind.js").bindMeasures;function K(C,q){const z=q.y&&typeof q.y=="object"?q.y:{col:q.y},t=[{col:z.col,fn:z.fn}],e={actual:0,target:-1,rangeColumns:[],edges:[]};q.target&&C.columns.get(q.target)&&(e.target=t.length,t.push({col:q.target}));for(const d of Array.isArray(q.ranges)?q.ranges:[])typeof d=="string"&&C.columns.get(d)?(e.rangeColumns.push(t.length),t.push({col:d})):m(Q(d))&&e.edges.push(Q(d));return{...X(C,{...q,measures:t}),bullet:e}}function pe(C,q){const z=C.bullet,t=z.edges.slice();for(const e of z.rangeColumns){const s=C.series[e]&&C.series[e].points[q];s&&m(s.y)&&t.push(s.y)}return t.sort((e,s)=>e-s)}function ne(C){const{bound:q,plot:z}=C,t=C.bullet||{},e=t.orientation!=="vertical",s=t.scale==="row",d=C.scheme||g(),p=C.axis||{x:{},y:{}},M=C.typography||{small:C.fontSize||11,axisTitle:11},ee=q.bullet||{actual:0,target:-1,rangeColumns:[],edges:[]},H=q.series[ee.actual],F=ee.target>=0?q.series[ee.target]:null,o=q.categories.length,A=le=>{const ye=[0],be=H&&H.points[le],Ae=F&&F.points[le];return be&&m(be.y)&&ye.push(be.y),Ae&&m(Ae.y)&&ye.push(Ae.y),ye.concat(pe(q,le))},G=le=>O(le,{zero:!0,min:C.min,max:C.max}),D=[];for(let le=0;le<o;le++)D.push(...A(le));const V=G(D),de=e?[z.left,z.right]:[z.bottom,z.top],$=le=>b(le,de),_=$(V),oe=[];for(let le=0;le<o;le++)oe.push(s?$(G(A(le))):_);const a=e?[z.top,z.bottom]:[z.left,z.right],y=v(q.categories,a,.25);C.axes!==!1&&(s?(new B(C.groups.grid).finish(),new B(C.groups.axis).finish()):ie({gridGroup:C.groups.grid,axisGroup:C.groups.axis,plot:z,scale:_,format:P(C.grid,{kind:"linear",step:(V.max-V.min)/5}),horizontal:e,side:"left",config:p.y,grid:C.grid,size:M.small}),e?ve({group:C.groups.overlay,plot:z,scale:y,labels:q.labels,fontSize:M.small,config:p.x}):xe({group:C.groups.overlay,plot:z,scale:y,labels:q.labels,fontSize:M.small,rotated:f(q.labels,y.step,M.small),config:p.x}),ce({group:C.groups.rules,plot:z,side:"left"}),N({group:C.groups.axis,plot:z,text:p.y.title,side:e?"bottom":"left",size:M.axisTitle})),J(C.groups,z,ae(C.type));const r=C.pool||new B(C.groups.marks),k=y.bandwidth,l=k/3,I=k*.6,E=H?d.series(H.index,H.label):d.series(0),Y=(le,ye)=>{const[be,Ae]=le.range,Ne=le.of(Math.max(le.domain.min,Math.min(le.domain.max,ye)));return Math.max(Math.min(be,Ae),Math.min(Math.max(be,Ae),Ne))};for(let le=0;le<o;le++){const ye=y.of(q.categories[le]);if(Number.isNaN(ye))continue;const be=oe[le],Ae=Y(be,be.domain.min),Ne=ye+k/2,te=u(q.categories[le]),Me=pe(q,le);let ke=Ae;for(let Pe=0;Pe<Me.length;Pe++){const Ce=Y(be,Me[Pe]),$e=Me.length>1?.14+.3*((Me.length-1-Pe)/(Me.length-1)):.22,Le=Math.min(ke,Ce),_e=Math.max(ke,Ce);R(r.next("rect",`${T}__bullet-band`,`band:${te}:${Pe}`),e?{x:i(Le),y:i(ye),width:i(_e-Le),height:i(k),"fill-opacity":$e,"data-decor":"band"}:{x:i(ye),y:i(Le),width:i(k),height:i(_e-Le),"fill-opacity":$e,"data-decor":"band"}),ke=Ce}const we=H&&H.points[le];if(we&&m(we.y)){const Pe=Y(be,we.y),Ce=Math.min(Ae,Pe),$e=Math.max(Ae,Pe);R(r.next("rect",`${T}__bar ${T}__bullet-bar ${T}__mark`,`bar:${te}`),e?{x:i(Ce),y:i(Ne-l/2),width:i($e-Ce),height:i(l),fill:E,"data-series":H.index,"data-point":le}:{x:i(Ne-l/2),y:i(Ce),width:i(l),height:i($e-Ce),fill:E,"data-series":H.index,"data-point":le}),we.px=i(e?Pe:Ne),we.py=i(e?Ne:Pe),we.pbase=i(Ae)}const je=F&&F.points[le];if(je&&m(je.y)){const Pe=Y(be,je.y);R(r.next("line",`${T}__bullet-target`,`target:${te}`),e?{x1:i(Pe),x2:i(Pe),y1:i(Ne-I/2),y2:i(Ne+I/2),"data-series":F.index,"data-point":le}:{y1:i(Pe),y2:i(Pe),x1:i(Ne-I/2),x2:i(Ne+I/2),"data-series":F.index,"data-point":le}),je.px=i(e?Pe:Ne),je.py=i(e?Ne:Pe)}}C.pool||r.finish();const se=C.hidden||new Set;return{xScale:y,yScale:_,series:q.series.filter(le=>!se.has(le.key)),horizontal:e,bullet:{perRow:s,domain:V},valueText:(le,ye)=>W(ye.y,C.grid.columns.get(le.key),C.grid)}}}),it("packages/modules/charts/polar.js",function(n,re){"use strict";Object.defineProperty(n,"arcBand",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(n,"drawRadar",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(n,"gaugeReading",{enumerable:!0,get:function(){return C}}),Object.defineProperty(n,"gaugeReadingPlace",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"drawGauge",{enumerable:!0,get:function(){return z}});const ce=re("packages/modules/charts/frame.js").Pool,ve=re("packages/modules/charts/format.js").measureFormat,xe=re("packages/modules/charts/scale.js"),ie=xe.isNumber,ae=xe.measureDomain,J=re("packages/modules/charts/svg.js"),ue=J.attrs,B=J.path,f=J.round,L=J.setText,W=re("packages/modules/charts/styles.js").NS,v=re("packages/modules/charts/scheme.js").resolveScheme,m=re("packages/modules/charts/labels.js"),u=m.drawAnchoredLabels,b=m.labelText,O=re("packages/modules/charts/bind.js"),Q=O.AGGREGATIONS,w=O.DEFAULT_AGGREGATION,R=re("packages/modules/charts/typography.js"),i=R.applySize,x=R.textWidth,T=R.truncateTo,h=Math.PI*2,g=4,j=h*2/3,X=Math.PI/2+(h-j)/2;function K(t,e,s,d){const p=d-Math.PI/2;return[t+s*Math.cos(p),e+s*Math.sin(p)]}function pe(t){const e=t.to-t.from;if(e<=0)return"";const s=Math.max(0,t.r-t.width),d=e>Math.PI?1:0,[p,M]=K(t.cx,t.cy,t.r,t.from),[ee,H]=K(t.cx,t.cy,t.r,t.to),[F,o]=K(t.cx,t.cy,s,t.to),[A,G]=K(t.cx,t.cy,s,t.from);return B(["M",f(p),f(M),"A",f(t.r),f(t.r),0,d,1,f(ee),f(H),"L",f(F),f(o),"A",f(s),f(s),0,d,0,f(A),f(G),"Z"])}function ne(t){const e=t.scheme||v(),{plot:s,bound:d}=t;new ce(t.groups.grid).finish(),new ce(t.groups.axis).finish(),new ce(t.groups.rules).finish(),new ce(t.groups.labels).finish();const p=s.left+s.width/2,M=s.top+s.height/2,ee=Math.max(0,Math.min(s.width,s.height)/2-t.fontSize*2),H=d.labels,F=d.series.filter(_=>!t.hidden.has(_.key)),o=[];for(const _ of F)for(const oe of _.points)o.push(oe.y);const A=ae(o,{zero:!0}),G=H.length?h/H.length:h,D=_=>{const oe=A.max-A.min||1;return Math.max(0,(_-A.min)/oe*ee)},V=new ce(t.groups.grid);for(let _=1;_<=g;_++){const oe=ee*_/g,a=H.map((y,r)=>K(p,M,oe,r*G));ue(V.next("path",`${W}__web`),{d:a.length?B([...a.flatMap(([y,r],k)=>[k?"L":"M",f(y),f(r)]),"Z"]):"",fill:"none"})}for(let _=0;_<H.length;_++){const[oe,a]=K(p,M,ee,_*G);ue(V.next("path",`${W}__web`),{d:B(["M",f(p),f(M),"L",f(oe),f(a)]),fill:"none"})}V.finish();const de=new ce(t.groups.marks);for(const _ of F){const oe=[];for(let r=0;r<H.length;r++){const k=_.points[r],l=ie(k&&k.y)?k.y:A.min,[I,E]=K(p,M,D(l),r*G);oe.push([f(I),f(E)]),k&&(k.px=f(I),k.py=f(E))}const a=oe.length?B([...oe.flatMap(([r,k],l)=>[l?"L":"M",r,k]),"Z"]):"",y=e.series(_.index,_.label);ue(de.next("path",`${W}__radar-fill ${W}__mark`),{d:a,fill:y,"data-series":_.index}),ue(de.next("path",`${W}__radar-line ${W}__mark`),{d:a,stroke:y,fill:"none","data-series":_.index})}de.finish();const $=new ce(t.groups.overlay);for(let _=0;_<H.length;_++){const[oe,a]=K(p,M,ee+t.fontSize,_*G),y=$.next("text",`${W}__tick`),r=Math.abs(oe-p)<1?"middle":oe>p?"start":"end";ue(y,{x:f(oe),y:f(a),"text-anchor":r,"dominant-baseline":"middle"}),L(y,H[_])}if($.finish(),t.labels&&t.labels.show){const _=t.typography&&t.typography.small||t.fontSize||11,oe=[];for(const a of F)for(const y of a.points){if(!y||y.px===void 0||!ie(y.y))continue;const r=y.px-p,k=y.py-M,l=Math.hypot(r,k)||1;oe.push({x:f(y.px+r/l*(_*.8)),y:f(y.py+k/l*(_*.8)),text:b(y.y,t.labels,t.grid)})}u({group:t.groups.labels,size:_,minGap:t.labels.minGap,anchors:oe,plot:s})}return{centre:{x:p,y:M,r:ee},series:F,axes:H}}function C(t){const e=t&&Array.isArray(t.series)?t.series[0]:null,s=e&&Array.isArray(e.points)?e.points:[],d=t&&t.measure&&t.measure.fn,p=typeof d=="string"&&d in Q?d:w,M=[];let ee=0,H=s.length>0;for(const A of s){if(ee+=Number.isFinite(A.rows)?A.rows:0,!Array.isArray(A.values)){H=!1;break}for(let G=0;G<A.values.length;G++)M.push(A.values[G])}if(H)return{value:Q[p](M,ee),fn:p};const F=s.filter(A=>ie(A.y));if(!F.length)return{value:null,fn:p};const o=F.map(A=>A.y);if(p==="min")return{value:Q.min(o,0),fn:p};if(p==="max")return{value:Q.max(o,0),fn:p};if(p==="first")return{value:o[0],fn:p};if(p==="last")return{value:o[o.length-1],fn:p};if(p==="avg"||p==="mean"){let A=0,G=0;for(const D of F){const V=Number.isFinite(D.rows)&&D.rows>0?D.rows:1;A+=V,G+=D.y*V}return{value:G/A,fn:p}}return{value:o.reduce((A,G)=>A+G,0),fn:p}}function q(t){const e=(h-j)/2,[s,d]=K(0,0,1,X-e),p=t.stroke/2+3,M=1.15,ee=t.bounds,H=(G,D,V)=>{const de=Math.max(x(t.reading,G),V?x(V,D):0)*M+4,$=G*1.2,_=V?D*1.4:0,oe=$+_,a=I=>{const E=s*I,Y=d*I;for(const[le,ye]of[[-1,-1],[1,-1],[1,1],[-1,1]]){const be=E+le*de/2,Ae=Y+ye*oe/2,Ne=Math.hypot(be,Ae);if(Ne<t.pin+p)return!1;const te=Math.acos(Math.max(-1,Math.min(1,(be*s+Ae*d)/(Ne||1))));if(te>=e||Ne*Math.sin(e-te)<p)return!1}return Math.abs(E*s+Y*d)-(Math.abs(s)*de+Math.abs(d)*oe)/2>=t.pin+p};let y=0;for(;y<4096&&!a(y);)y+=1;const r=t.cx+s*y,k=t.cy+d*y-oe/2;return{fits:!ee||r-de/2>=ee.left&&r+de/2<=ee.right&&k>=ee.top&&k+oe<=ee.bottom,x:r,readingY:k+$/2,captionY:k+$+_/2}},F=Math.max(1,Math.min(t.minSize,t.readingSize)),o=Math.min(t.captionSize,9),A=8;for(let G=1;;G-=.05){const D=Math.max(F,t.readingSize*G),V=Math.max(o,t.captionSize*G),de=D<=F;let $=t.caption||"";for(;;){const _=H(D,V,$),oe={..._,readingSize:D,captionSize:V,caption:$};if(_.fits)return oe;if(!$){if(de)return oe;break}const a=T(t.caption,x($,V)-V,V),y=a&&a!=="…"?a:"",r=y.endsWith("…")?y.length-1:y.length;if(!de&&r<A)break;$=y}}}function z(t){const e=t.scheme||v(),{plot:s,bound:d}=t;new ce(t.groups.grid).finish(),new ce(t.groups.axis).finish(),new ce(t.groups.rules).finish(),new ce(t.groups.labels).finish();const p=C(d),M=p.value===null?0:p.value,ee=ie(t.min)?t.min:0,H=ie(t.max)?t.max:Math.max(M,1),F=H-ee||1,o=Math.min(H,Math.max(ee,M)),A=Math.min(1,Math.max(0,(o-ee)/F)),G=s.left+s.width/2,D=s.top+s.height/2,V=Math.max(0,Math.min(s.width,s.height)/2-4),de=Math.max(6,V*.24),$=Ae=>X+j*((Ae-ee)/F),_=new ce(t.groups.marks);ue(_.next("path",`${W}__gauge-track`),{d:pe({cx:G,cy:D,r:V,width:de,from:X,to:X+j})});const oe=Array.isArray(t.bands)?t.bands:[],a=[];for(const Ae of oe){const Ne=ie(Ae.from)?Math.max(ee,Math.min(H,Ae.from)):ee,te=ie(Ae.to)?Math.max(ee,Math.min(H,Ae.to)):H;if(te<=Ne)continue;const Me=Ae.colour||e.series(a.length);ue(_.next("path",`${W}__gauge-band ${W}__mark`),{d:pe({cx:G,cy:D,r:V,width:de,from:$(Ne),to:$(te)}),fill:Me}),Ae.label&&a.push({key:`band-${a.length}`,label:Ae.label,index:a.length,colour:Me})}const y=(()=>{for(const Ae of oe)if(o>=Ae.from&&o<=Ae.to)return Ae.colour||e.series(0);return e.series(0)})();let r=0,k=0;if(t.needle){const Ae=typeof t.needle=="object"&&t.needle?t.needle:{};r=Number.isFinite(Ae.width)&&Ae.width>0?Ae.width:2,k=(Number.isFinite(Ae.pin)&&Ae.pin>0?Ae.pin:.08)*V;const Ne=$(o),[te,Me]=K(G,D,k,Ne),[ke,we]=K(G,D,V-de*.5,Ne);ue(_.next("path",`${W}__gauge-needle ${W}__mark`),{d:B(["M",f(te),f(Me),"L",f(ke),f(we)]),stroke:y,"stroke-width":r,fill:"none"}),ue(_.next("circle",`${W}__gauge-pin ${W}__mark`),{cx:f(G),cy:f(D),r:f(k),fill:y})}else ue(_.next("path",`${W}__gauge-value ${W}__mark`),{d:pe({cx:G,cy:D,r:V,width:de,from:X,to:X+j*A}),fill:e.series(0)});if(ie(t.target)){const Ae=Math.min(1,Math.max(0,(t.target-ee)/F)),Ne=X+j*Ae,[te,Me]=K(G,D,V-de,Ne),[ke,we]=K(G,D,V,Ne);ue(_.next("path",`${W}__gauge-target`),{d:B(["M",f(te),f(Me),"L",f(ke),f(we)]),fill:"none"})}if(Array.isArray(t.ticks))for(const Ae of t.ticks){if(!ie(Ae)||Ae<ee||Ae>H)continue;const Ne=$(Ae),[te,Me]=K(G,D,V-de,Ne),[ke,we]=K(G,D,V,Ne);ue(_.next("path",`${W}__gauge-tick`),{d:B(["M",f(te),f(Me),"L",f(ke),f(we)]),fill:"none"})}_.finish();const l=d.measure&&d.measure.col&&t.grid&&t.grid.columns?t.grid.columns.get(d.measure.col):null,I=ve(M,l,t.grid),E=t.centre&&t.centre.label||d.measure.title||"",Y=t.needle?q({cx:G,cy:D,pin:k,stroke:r,reading:I,caption:E,readingSize:t.fontSize*1.8,captionSize:t.fontSize*.9,minSize:t.fontSize,bounds:{left:s.left,top:s.top,right:s.left+s.width,bottom:s.top+s.height}}):null,se=new ce(t.groups.overlay),le=se.next("text",`${W}__gauge-reading`);ue(le,{x:f(Y?Y.x:G),y:f(Y?Y.readingY:D),"text-anchor":"middle","dominant-baseline":"middle"}),L(le,I);const ye=se.next("text",`${W}__gauge-caption`);ue(ye,{x:f(Y?Y.x:G),y:f(Y?Y.captionY:D+t.fontSize*1.6),"text-anchor":"middle","dominant-baseline":"middle"});const be=Y?Y.caption:E;return L(ye,be),ue(ye,{"aria-label":be!==E?E:null}),Y?(i(le,Y.readingSize),i(ye,Y.captionSize)):(le.style&&(le.style.fontSize=""),ye.style&&(ye.style.fontSize="")),se.finish(),{value:M,fn:p.fn,reading:I,domain:{min:ee,max:H},legend:a}}}),it("packages/modules/charts/multiples.js",function(n,re){"use strict";Object.defineProperty(n,"MAX_PANELS",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(n,"panelGrid",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"panelRects",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"splitPanels",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(n,"sharedDomain",{enumerable:!0,get:function(){return xe}});const Se=24;function ce(ie,ae){if(ie<=1)return{columns:1,rows:1};const J=(ae.width||1)/(ae.height||1);let ue=Math.max(1,Math.round(Math.sqrt(ie*J)));ue=Math.min(ue,ie);const B=Math.ceil(ie/ue);return{columns:ue,rows:B}}function N(ie){const ae=Math.min(ie.count,Se),J=ie.gap===void 0?10:ie.gap,ue=ie.titleHeight===void 0?14:ie.titleHeight,{columns:B,rows:f}=ce(ae,ie.plot),L=(ie.plot.width-J*(B-1))/B,P=(ie.plot.height-J*(f-1))/f,W=[];for(let U=0;U<ae;U++){const v=U%B,m=Math.floor(U/B);W.push({index:U,x:ie.plot.left+v*(L+J),y:ie.plot.top+m*(P+J)+ue,width:Math.max(0,L),height:Math.max(0,P-ue)})}return W}function ve(ie){return ie.series.map((ae,J)=>({label:ae.label,key:ae.key,index:J,bound:{...ie,series:[{...ae,index:J}]}}))}function xe(ie,ae,J){const ue=[];for(const B of ie.series)for(const f of B.points)ue.push(f.y);return J(ue,{zero:ae})}}),it("packages/modules/charts/globe.js",function(n,re){"use strict";Object.defineProperty(n,"HEMISPHERE_METRES",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"isGlobeProjection",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"globeCentre",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"globeView",{enumerable:!0,get:function(){return f}}),Object.defineProperty(n,"clipRing",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"clipLine",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"pixelsPath",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"globeRingPath",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"spherePath",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"globeLinePaths",{enumerable:!0,get:function(){return O}}),Object.defineProperty(n,"meanDirection",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"drawGlobeBackdrop",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"globeReport",{enumerable:!0,get:function(){return R}});const ce=re("packages/modules/charts/projection.js").graticule,N=Math.PI/180;function ve(i){return Math.round(i*100)/100}const xe=4,ie=63710088e-1*(Math.PI/2),ae=new Set(["orthographic","globe"]);function J(i){return typeof i=="string"&&ae.has(i)}function ue(i){return((i+180)%360+360)%360-180}function B(i,x){const T=Array.isArray(i)&&Number.isFinite(i[0])&&Number.isFinite(i[1])?[Number(i[0]),Number(i[1])]:[0,0],[h,g]=x||[0,0],j=Math.max(-90,Math.min(90,T[1]+(g||0)/N));return[ue(T[0]+(h||0)/N),j]}function f(i){const{plot:x}=i,T=typeof i.padding=="number"?i.padding:4,h=typeof i.zoom=="number"&&i.zoom>0?i.zoom:1,g=B(i.rotate,i.offset),j=g[0]*N,X=Math.sin(g[1]*N),K=Math.cos(g[1]*N),pe=Math.max(1,Math.min(x.width,x.height)/2-T)*h,ne=x.left+x.width/2,C=x.top+x.height/2,q=(z,t)=>{const e=t*N,s=z*N-j,d=Math.cos(e),p=Math.sin(e);return[d*Math.sin(s),K*p-X*d*Math.cos(s),X*p+K*d*Math.cos(s)]};return{centre:g,radius:pe,cx:ne,cy:C,vector:q,visible:(z,t)=>q(z,t)[2]>=0,to:(z,t)=>{const e=q(z,t);return e[2]<0?[NaN,NaN]:[ne+pe*e[0],C-pe*e[1]]}}}function L(i,x){return[i.cx+i.radius*x[0],i.cy-i.radius*x[1]]}function P(i,x){const T=i[2]/(i[2]-x[2]),h=i[0]+(x[0]-i[0])*T,g=i[1]+(x[1]-i[1])*T,j=Math.hypot(h,g)||1;return[h/j,g/j,0]}function W(i,x,T){let h=T-x;h=((h+Math.PI)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)-Math.PI;const g=Math.floor(Math.abs(h)/(xe*N)),j=[];for(let X=1;X<=g;X++){const K=x+h*X/(g+1);j.push(L(i,[Math.cos(K),Math.sin(K),0]))}return j}function U(i,x){if(!Array.isArray(i)||i.length<3)return[];let T=i;const h=i[0],g=i[i.length-1];i.length>3&&h[0]===g[0]&&h[1]===g[1]&&(T=i.slice(0,-1));const j=T.map(([q,z])=>x.vector(q,z)),X=j.length;let K=-1,pe=!0;for(let q=0;q<X;q++)j[q][2]>=0?K<0&&(K=q):pe=!1;if(K<0)return[];if(pe)return j.map(q=>L(x,q));const ne=[L(x,j[K])];let C=0;for(let q=0;q<X;q++){const z=j[(K+q)%X],t=j[(K+q+1)%X],e=z[2]>=0,s=t[2]>=0,d=q===X-1;if(e&&s)d||ne.push(L(x,t));else if(e){const p=P(z,t);C=Math.atan2(p[1],p[0]),ne.push(L(x,p))}else if(s){const p=P(t,z);for(const M of W(x,C,Math.atan2(p[1],p[0])))ne.push(M);ne.push(L(x,p)),d||ne.push(L(x,t))}}return ne}function v(i,x){const T=[];let h=[],g=null;for(const[j,X]of i||[]){const K=x.vector(j,X),pe=K[2]>=0;if(g){const ne=g[2]>=0;ne&&!pe?(h.push(L(x,P(g,K))),T.push(h),h=[]):!ne&&pe&&(h=[L(x,P(K,g))])}pe&&h.push(L(x,K)),g=K}return h.length&&T.push(h),T.filter(j=>j.length>1)}function m(i,x=!1){if(!i||i.length<2)return"";const T=ve;let h="";return i.forEach((g,j)=>{h+=`${j?"L":"M"}${T(g[0])} ${T(g[1])}`}),x?`${h}Z`:h}function u(i,x){const T=U(i,x);return T.length>2?m(T,!0):""}function b(i){const{cx:x,cy:T,radius:h}=i,g=ve;return`M${g(x-h)} ${g(T)}A${g(h)} ${g(h)} 0 1 0 ${g(x+h)} ${g(T)}A${g(h)} ${g(h)} 0 1 0 ${g(x-h)} ${g(T)}Z`}function O(i,x){const T=[];for(const h of i)for(const g of v(h,x))T.push(m(g));return T}function Q(i){let x=0,T=0,h=0,g=0;for(const[j,X]of i||[]){if(!Number.isFinite(j)||!Number.isFinite(X))continue;const K=X*N,pe=j*N;x+=Math.cos(K)*Math.cos(pe),T+=Math.cos(K)*Math.sin(pe),h+=Math.sin(K),g++}return!g||Math.hypot(x,T,h)<1e-9?null:[Math.atan2(T,x)/N,Math.atan2(h,Math.hypot(x,T))/N]}function w(i){const{view:x,spec:T,pool:h,attrs:g,NS:j,regions:X,basemapStyle:K}=i;if((!T||T.sphere!==!1)&&g(h.next("path",`${j}__sphere`),{d:b(x),class:`${j}__sphere`,fill:void 0,style:void 0,"data-code":void 0}),T&&T.graticule){const pe=typeof T.graticule=="object"&&T.graticule.step||30;for(const ne of O(ce({step:pe}),x))g(h.next("path",`${j}__graticule`),{d:ne,class:`${j}__graticule`,fill:void 0,style:void 0,"data-code":void 0})}for(const pe of X||[]){const ne=pe.rings.map(C=>u(C,x)).filter(Boolean).join(" ");ne&&g(h.next("path",`${j}__region`),{d:ne,fill:K?K.fill:void 0,"data-code":pe.code,class:`${j}__region`,style:K?K.style:void 0})}}function R(i,x){if(!i)return{};const T=new Map;for(const h of x||[])T.set(h.rowKey,[h.lon,h.lat]);return{globe:{centre:i.centre,radius:i.radius,positions:T}}}}),it("packages/modules/charts/stream.js",function(n,re){"use strict";Object.defineProperty(n,"wiggleBaseline",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(n,"drawStream",{enumerable:!0,get:function(){return C}}),Object.defineProperty(n,"drawMarimekko",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"drawViolin",{enumerable:!0,get:function(){return z}});const Se=re("packages/modules/charts/axis.js"),ce=Se.drawAxisLines,N=Se.drawCategoryAxis,ve=Se.drawMeasureAxis,xe=Se.setLabelText,ie=re("packages/modules/charts/distribution.js"),ae=ie.density,J=ie.distributionDomain,ue=ie.summarise,B=ie.valuesByCategory,f=re("packages/modules/charts/frame.js"),L=f.Pool,P=f.shouldRotate,U=re("packages/modules/charts/format.js").formatters,v=re("packages/modules/charts/scale.js"),m=v.bandScale,u=v.isNumber,b=v.linearScale,O=v.measureDomain,w=re("packages/modules/charts/scheme.js").resolveScheme,R=re("packages/modules/charts/svg.js"),i=R.attrs,x=R.path,T=R.round,g=re("packages/modules/charts/styles.js").NS,X=re("packages/modules/charts/typography.js").truncateTo,K=2,pe=32;function ne(t){const e=[];let s=0;for(let d=0;d<t.length;d++){const p=t[d],M=p.reduce((o,A)=>o+A,0);if(d===0){s=-M/2,e.push(s);continue}const ee=t[d-1];let H=0;const F=p.length;for(let o=0;o<F;o++){let A=0;for(let G=0;G<o;G++)A+=(p[G]||0)-(ee[G]||0);H+=(F-o-.5)*((p[o]||0)-(ee[o]||0))+A*0}s-=F>0?H/F:0,e.push(s)}return e}function C(t){const e=t.scheme||w(),{plot:s,bound:d}=t;new L(t.groups.grid).finish(),new L(t.groups.rules).finish(),new L(t.groups.labels).finish();const p=d.series.filter(D=>!t.hidden.has(D.key)),M=d.categories.map((D,V)=>p.map(de=>{const $=de.points[V];return u($&&$.y)?Math.max(0,$.y):0})),ee=ne(M),H=[];M.forEach((D,V)=>{H.push(ee[V]),H.push(ee[V]+D.reduce((de,$)=>de+$,0))});const F=O(H,{zero:!1,nice:!1}),o=b(F,[s.bottom,s.top]),A=m(d.categories,[s.left,s.right],0),G=new L(t.groups.marks);return p.forEach((D,V)=>{const de=[],$=[];M.forEach((oe,a)=>{let y=ee[a];for(let k=0;k<V;k++)y+=oe[k];const r=T(A.centre(d.categories[a]));$.push([r,T(o.of(y))]),de.push([r,T(o.of(y+oe[V]))])});const _=[];de.forEach(([oe,a],y)=>_.push(y?"L":"M",oe,a));for(let oe=$.length-1;oe>=0;oe--)_.push("L",$[oe][0],$[oe][1]);_.push("Z"),i(G.next("path",`${g}__stream ${g}__mark`),{d:x(_),fill:e.series(D.index),"data-series":D.index})}),G.finish(),N({group:t.groups.overlay,plot:s,scale:A,labels:d.labels,fontSize:t.typography&&t.typography.small||t.fontSize,rotated:P(d.labels,A.step,t.fontSize,(t.axis&&t.axis.x||{}).every),config:t.axis&&t.axis.x||{}}),{xScale:A,yScale:o,series:p}}function q(t){const e=t.scheme||w(),{plot:s,bound:d}=t,p=d.series.filter($=>!t.hidden.has($.key)),M=d.categories.map(($,_)=>p.reduce((oe,a)=>{const y=a.points[_];return oe+(u(y&&y.y)?Math.abs(y.y):0)},0)),ee=M.reduce(($,_)=>$+_,0);if(ee<=0)return{series:p,columns:[]};const H=2,F=s.width-H*Math.max(0,d.categories.length-1),o=b({min:0,max:100},[s.bottom,s.top]);ve({gridGroup:t.groups.grid,axisGroup:t.groups.axis,plot:s,scale:o,format:U(t.grid,{kind:"linear",step:20}),config:t.axis&&t.axis.y||{},grid:t.grid,size:t.typography&&t.typography.small||t.fontSize}),ce({group:t.groups.rules,plot:s});const A=new L(t.groups.marks),G=[];let D=s.left;d.categories.forEach(($,_)=>{const oe=M[_]/ee*F;let a=s.bottom;p.forEach((y,r)=>{const k=y.points[_],l=u(k&&k.y)?Math.abs(k.y):0,E=(M[_]>0?l/M[_]:0)*s.height;i(A.next("rect",`${g}__bar ${g}__mark`),{x:T(D),y:T(a-E),width:T(Math.max(0,oe)),height:T(Math.max(0,E)),fill:e.series(y.index),"data-series":y.index,"data-point":_}),k&&(k.px=T(D+oe/2),k.py=T(a-E)),a-=E}),G.push({category:$,label:d.labels[_],x:D,width:oe,total:M[_]}),D+=oe+H}),A.finish();const V=new L(t.groups.overlay),de=t.typography&&t.typography.small||t.fontSize;for(const $ of G){const _=Math.max(0,$.width-K*2),oe=X(String($.label===void 0||$.label===null?"":$.label),_,de);if(!oe||oe==="…")continue;const a=V.next("text",`${g}__tick`);a.style.fontSize=`${de}px`,i(a,{x:T($.x+$.width/2),y:T(s.top-2),"text-anchor":"middle"}),xe(a,$.label,_,de)}return V.finish(),{series:p,columns:G}}function z(t){const e=t.scheme||w(),{plot:s,bound:d}=t,p=B(d),M=[...p.keys()],ee=[];for(const G of p.values())for(let D=0;D<G.length;D++)ee.push(G[D]);const H=J(ee,t.axis),F=b(H,[s.bottom,s.top]),o=m(M,[s.left,s.right],.3);ve({gridGroup:t.groups.grid,axisGroup:t.groups.axis,plot:s,scale:F,format:U(t.grid,{kind:"linear",step:(H.max-H.min)/5}),config:t.axis&&t.axis.y||{},grid:t.grid,size:t.typography&&t.typography.small||t.fontSize}),N({group:t.groups.overlay,plot:s,scale:o,labels:M,fontSize:t.typography&&t.typography.small||t.fontSize,rotated:M.length>6,config:t.axis&&t.axis.x||{}}),ce({group:t.groups.rules,plot:s});const A=new L(t.groups.marks);return M.forEach((G,D)=>{const V=p.get(G),de=ae(V,H,pe),$=de.reduce((l,I)=>Math.max(l,I.density),0)||1,_=o.bandwidth/2,oe=o.of(G)+_,a=de.map(l=>[T(oe+l.density/$*_),T(F.of(l.at))]),y=de.map(l=>[T(oe-l.density/$*_),T(F.of(l.at))]),r=[];a.forEach(([l,I],E)=>r.push(E?"L":"M",l,I));for(let l=y.length-1;l>=0;l--)r.push("L",y[l][0],y[l][1]);r.push("Z"),i(A.next("path",`${g}__violin ${g}__mark`),{d:x(r),fill:e.series(D),"data-point":D});const k=ue(V);k&&i(A.next("path",`${g}__median ${g}__mark`),{d:x(["M",T(oe-_*.5),T(F.of(k.median)),"L",T(oe+_*.5),T(F.of(k.median))]),stroke:e.series(D),"stroke-width":2,fill:"none"})}),A.finish(),{xScale:o,yScale:F,series:[{key:"",label:d.measure.title,index:0,points:M.map(G=>{const D=ue(p.get(G));return{x:G,xKey:G,label:G,y:D?D.median:null,rows:(p.get(G)||[]).length}})}]}}}),it("packages/modules/charts/gantt.js",function(n,re){"use strict";Object.defineProperty(n,"readTasks",{enumerable:!0,get:function(){return x}}),Object.defineProperty(n,"drawGantt",{enumerable:!0,get:function(){return T}});const Se=re("packages/modules/charts/axis.js"),ce=Se.drawAxisLines,N=Se.drawBandLabels,ve=Se.drawContinuousAxis,ie=re("packages/modules/charts/frame.js").Pool,J=re("packages/modules/charts/format.js").formatters,ue=re("packages/modules/charts/scale.js"),B=ue.bandScale,f=ue.timeScale,L=ue.toTime,W=re("packages/modules/charts/scheme.js").resolveScheme,U=re("packages/modules/charts/svg.js"),v=U.attrs,m=U.round,u=U.setText,O=re("packages/modules/charts/styles.js").NS,Q=re("packages/modules/charts/typography.js"),w=Q.applySize,R=Q.truncateTo,i=8;function x(h,g,j){const X=[];let K=1/0,pe=-1/0;for(const ne of j){const C=L(h.rows.value(ne.key,g.start)),q=L(h.rows.value(ne.key,g.end));if(C===null||q===null)continue;const z=g.label?h.rows.text(ne.key,g.label):ne.key,t=g.series?h.rows.value(ne.key,g.series):null;X.push({key:ne.key,label:z,group:t,from:Math.min(C,q),to:Math.max(C,q)}),K=Math.min(K,C,q),pe=Math.max(pe,C,q)}return{tasks:X,span:X.length?{min:K,max:pe}:null}}function T(h){const g=h.scheme||W(),{plot:j}=h,{tasks:X,span:K}=x(h.grid,h.spec,h.rows);if(!K)return{tasks:[],xScale:null,dropped:0};const pe=Math.max(1,Math.floor(j.height/i)),ne=X.slice(0,pe),C=X.length-ne.length,q=f({min:K.min,max:K.max},[j.left,j.right]),z=B(ne.map(p=>p.key),[j.top,j.bottom],.25),t=h.typography&&h.typography.small||h.fontSize;ve({group:h.groups.overlay,plot:j,scale:q,format:J(h.grid,{kind:"time",span:K.max-K.min}),config:h.axis&&h.axis.x||{},grid:h.grid,size:t}),N({group:h.groups.axis,plot:j,scale:z,labels:ne.map(p=>p.label),fontSize:t}),ce({group:h.groups.rules,plot:j});const e=[...new Set(ne.map(p=>String(p.group)))],s=new ie(h.groups.marks);ne.forEach((p,M)=>{const ee=z.of(p.key),H=q.of(p.from),F=q.of(p.to);v(s.next("rect",`${O}__task ${O}__mark`),{x:m(H),width:m(Math.max(2,F-H)),y:m(ee),height:m(z.bandwidth),fill:g.series(p.group===null?0:e.indexOf(String(p.group))),"data-point":M,"data-key":p.key}),p.px=m((H+F)/2),p.py=m(ee+z.bandwidth/2)}),s.finish();const d=new ie(h.groups.labels);if(C>0){const p=d.next("text",`${O}__geo-note`);w(p,t),v(p,{x:m(j.left),y:m(j.bottom+t+4),"text-anchor":"start"}),u(p,R(h.grid.messages.t("chart.tasksDropped",{count:C}),j.width,t))}return d.finish(),{tasks:ne,xScale:q,dropped:C,series:[{key:"",label:h.spec.label||"",index:0,points:ne.map(p=>({x:p.key,xKey:p.key,label:p.label,y:p.to-p.from,rows:1,rowKey:p.key,px:p.px,py:p.py}))}]}}}),it("packages/modules/charts/tween.js",function(n,re){"use strict";Object.defineProperty(n,"tween",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(n,"easeOutQuad",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"frameLoop",{enumerable:!0,get:function(){return xe}});function Se(ie,ae,J){return ie+(ae-ie)*J}function ce(ie){return 1-(1-ie)*(1-ie)}const N=new WeakMap;let ve=null;function xe(ie){const ae=ie&&typeof ie.requestAnimationFrame=="function";if(ae&&N.has(ie))return N.get(ie);if(!ae&&ve)return ve;const J=new Map;let ue=0,B=null;const f=W=>{B=null;const U=[...J.values()];J.clear();for(const v of U)try{v(W)}catch(m){setTimeout(()=>{throw m},0)}},L=()=>{B===null&&(B=ae?ie.requestAnimationFrame(f):setTimeout(()=>f(Date.now()),16))},P={request(W){return ue+=1,J.set(ue,W),L(),ue},cancel(W){J.delete(W),!J.size&&B!==null&&(ae&&typeof ie.cancelAnimationFrame=="function"?ie.cancelAnimationFrame(B):ae||clearTimeout(B),B=null)},get pending(){return J.size}};return ae?N.set(ie,P):ve=P,P}}),it("packages/modules/charts/animate.js",function(n,re){"use strict";Object.defineProperty(n,"EASINGS",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(n,"easingOf",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"motionBlocked",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"ANIMATION_DURATION",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"motionTokenMs",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"ANIMATION_BUDGET",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"resolveAnimation",{enumerable:!0,get:function(){return W}}),Object.defineProperty(n,"parsePath",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"keyedMarks",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"MarkAnimator",{enumerable:!0,get:function(){return x}});const Se=re("packages/modules/charts/tween.js"),ce=Se.frameLoop,N=Se.tween,ve=Object.freeze({linear:T=>T,"ease-in":T=>T*T*T,"ease-out":T=>1-(1-T)**3,"ease-in-out":T=>T<.5?4*T*T*T:1-(-2*T+2)**3/2});function xe(T){return typeof T=="function"?h=>{if(h<=0)return 0;if(h>=1)return 1;const g=Number(T(h));return Number.isFinite(g)?g:h}:typeof T=="string"&&Object.prototype.hasOwnProperty.call(ve,T)?ve[T]:null}function ie(T){if(!T||typeof T.requestAnimationFrame!="function")return"no-window";try{const h=T.navigator;if(h&&h.webdriver===!0||h&&/\bjsdom\b|happydom|happy-dom/i.test(String(h.userAgent||"")))return"automation";if(typeof T.matchMedia=="function"){const g=T.matchMedia("(prefers-reduced-motion: reduce)");if(g&&g.matches)return"reduced-motion"}}catch{return null}return null}const ae=400;function J(T,h){try{if(!T||!h||typeof h.getComputedStyle!="function")return null;const g=String(h.getComputedStyle(T).getPropertyValue("--lattice-motion-duration")||"").trim(),j=/^(\d*\.?\d+)\s*(ms|s)?$/i.exec(g);if(!j)return null;const X=Number(j[1])*(String(j[2]||"ms").toLowerCase()==="s"?1e3:1);return Number.isFinite(X)?X:null}catch{return null}}const ue=2e3,B=["grid","marks","rules","axis","labels","overlay"],f=Object.freeze({rect:["x","y","width","height"],circle:["cx","cy","r"],line:["x1","y1","x2","y2"],text:["x","y"]}),L="data-anim-leaving";let P=0;function W(T,h=null){const g={on:!0,duration:ae,easing:ve["ease-out"],entry:!0,update:!0,budget:ue,problems:[]};if(h===0&&(g.on=!1),T==null||T===!0)return g;if(T===!1)return g.on=!1,g;if(typeof T!="object")return g.problems.push(`animation must be true, false or an object; got ${JSON.stringify(T)}`),g;const j=T;if(j.duration!==void 0){const X=Number(j.duration);Number.isFinite(X)&&X>=0?g.duration=X:g.problems.push(`animation.duration must be a number of milliseconds, 0 or more; got ${JSON.stringify(j.duration)}`)}if(j.easing!==void 0){const X=xe(j.easing);X?g.easing=X:g.problems.push(`animation.easing must be one of ${Object.keys(ve).join(", ")} or a function; got ${JSON.stringify(j.easing)}`)}for(const X of["entry","update"])j[X]!==void 0&&(typeof j[X]=="boolean"?g[X]=j[X]:g.problems.push(`animation.${X} must be true or false; got ${JSON.stringify(j[X])}`));if(j.budget!==void 0){const X=Number(j.budget);Number.isFinite(X)&&X>=0?g.budget=X:g.problems.push(`animation.budget must be a number of marks, 0 or more; got ${JSON.stringify(j.budget)}`)}return g.on=g.duration!==0,g}function U(T){return String(T.tagName||"").toLowerCase()}function v(T){return String(T.getAttribute("class")||"").split(/\s+/)[0]||""}function m(T,h){const g=Number.parseFloat(T.getAttribute(h));return Number.isFinite(g)?g:0}function u(T,h,g){T.setAttribute(h,String(Math.round(g*100)/100))}function b(T){const h=[],g=[];let j="",X="",K=0;const pe=/([MmLlHhVvCcSsQqTtAaZz])|(-?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?)/g;let ne;for(;(ne=pe.exec(String(T||"")))!==null;)ne[1]?(X=ne[1],K=0,h.push(X),j+=X):((X==="A"||X==="a")&&(K%7===3||K%7===4)&&g.push(h.length),h.push(Number(ne[2])),j+="#",K+=1);return{tokens:h,skeleton:j,flags:g}}function O(T){return T.map(h=>typeof h=="number"?String(Math.round(h*100)/100):h).join(" ")}function Q(T,h){const g=[],j=new Map,X=new Map;for(const K of["axis","rules"]){const pe=T[K];if(pe)for(const ne of pe.childNodes||[]){if(!ne.getAttribute||U(ne)!=="text")continue;const C=String(ne.textContent||"");C&&(X.set(`y${Math.round(m(ne,"y"))}`,C),X.set(`x${Math.round(m(ne,"x"))}`,C))}}for(const K of B){const pe=T[K];if(pe)for(const ne of pe.childNodes||[]){if(!ne.getAttribute||ne.getAttribute(L)!==null)continue;const C=U(ne);if(!C||C==="g"||C==="defs"||C==="clippath"||K==="overlay"&&C!=="text")continue;const q=`${K}|${C}|${v(ne)}`;let z=ne.getAttribute("data-pool-key");if(z!==null)z=`k:${z}`;else if(h&&h.ident){const s=h.ident(ne);s!=null&&(z=`i:${s}`)}if(z===null&&C==="text"&&(z=`t:${ne.textContent||""}`),z===null&&C==="line"&&K==="grid"){const s=m(ne,"y1")===m(ne,"y2"),d=s?X.get(`y${Math.round(m(ne,"y1"))}`):X.get(`x${Math.round(m(ne,"x1"))}`);d!==void 0&&(z=`g:${s?"h":"v"}:${d}`)}const t=`${q}|${z===null?"#":z}`,e=j.get(t)||0;j.set(t,e+1),g.push({key:e?`${t}~${e}`:t,el:ne,group:K})}}return g}function w(T){const h=T.attributes;if(!h)return[];if(h instanceof Map)return[...h.entries()].map(([j,X])=>[j,String(X)]);const g=[];for(let j=0;j<h.length;j++)g.push([h[j].name,h[j].value]);return g}function R(T){if(typeof T.cloneNode=="function")return T.cloneNode(!0);const g=T.ownerDocument.createElementNS("http://www.w3.org/2000/svg",U(T));for(const[j,X]of w(T))g.setAttribute(j,X);return U(T)==="text"&&(g.textContent=T.textContent),g}function i(T,h,g){const j=U(T),X=T.getAttribute("opacity"),K=X===null?1:Number.isFinite(Number(X))?Number(X):1,pe=g&&g.get(T)||(h&&h.arc?h.arc(T):null);return pe?{kind:"arc",values:null,path:null,arc:{...pe},opacity:K}:f[j]?{kind:j,values:f[j].map(ne=>m(T,ne)),path:null,arc:null,opacity:K}:j==="path"?{kind:"path",values:null,path:b(T.getAttribute("d")),arc:null,opacity:K}:{kind:"other",values:null,path:null,arc:null,opacity:K}}class x{#r;#n=null;#i=null;#t=null;#s=null;constructor(h={}){this.#r=h.view||null,h.loop&&(this.#n=h.loop)}get running(){return!!this.#i}get remaining(){const h=this.#i;return h?h.start===null?h.duration:Math.max(0,h.duration-(h.last-h.start)):0}#l(){return this.#n||(this.#n=ce(this.#r)),this.#n}halt(){const h=this.#i;if(h){this.#i=null,h.frame!==null&&(this.#l().cancel(h.frame),h.frame=null);for(const g of h.ghosts)g.el.parentNode&&g.el.parentNode.removeChild(g.el);this.#o(h);for(const g of h.records)for(const[j,X]of g.temporary)X===null?g.el.removeAttribute(j):g.el.setAttribute(j,X);this.#t=h}}capture(h,g){const j=this.#i?this.#i.arcsNow:null;this.halt();const X=new Map;for(const{key:K,el:pe,group:ne}of Q(h,g)){const C=i(pe,g,j),q=pe.getAttribute("data-pool-key")!==null;X.set(K,{...C,el:pe,group:ne,copy:q?null:R(pe)})}return X}settle(){const h=this.#t;if(this.#t=null,!!h)for(const g of h.records)this.#a(g)}release(){this.#t=null}finish(){const h=this.#i;if(this.#t=null,!!h){this.#i=null,h.frame!==null&&(this.#l().cancel(h.frame),h.frame=null);for(const g of h.ghosts)g.el.parentNode&&g.el.parentNode.removeChild(g.el);this.#o(h);for(const g of h.records)this.#a(g)}}#o(h){h.reveal&&(h.reveal.parentNode&&h.reveal.parentNode.removeChild(h.reveal),this.#s===h.reveal&&(this.#s=null),h.reveal=null)}#a(h){for(const[g,j]of h.final)j===null?h.el.removeAttribute(g):h.el.setAttribute(g,j)}play(h){this.#t=null,this.finish();const{groups:g,before:j,describe:X,settings:K,layout:pe}=h,ne=g.marks&&g.marks.childNodes?g.marks.childNodes.length:0;if(ne>K.budget)return{animated:!1,reason:"budget",marks:ne};const C=Q(g,X),q=[],z=[],t=new Map,e=new Set,s=h.mode==="entry";let d=!1;for(const{key:ee,el:H}of C){const F=i(H,X,null),o=j&&!s?j.get(ee):void 0;if(o&&e.add(ee),o&&o.kind===F.kind){const G=this.#p(H,o,F);G&&q.push(G);continue}if(o)continue;const A=this.#O(H,F,s,X,pe);A&&(A.reveal&&(d=!0),q.push(A))}if(!s&&j)for(const[ee,H]of j){if(e.has(ee))continue;const F=this.#v(g,H,pe);F&&z.push(F)}if(!q.length&&!z.length)return{animated:!1,reason:"unchanged",marks:ne};let p=null;if(d&&pe.defs&&pe.plot){p=this.#M(pe.defs,pe);for(const ee of q)ee.reveal&&(ee.temporary.push(["clip-path",ee.el.getAttribute("clip-path")]),ee.final.push(["clip-path",ee.el.getAttribute("clip-path")]),ee.el.setAttribute("clip-path",`url(#${p.getAttribute("id")})`))}const M={records:q,ghosts:z,arcsNow:t,reveal:p,layout:pe,duration:K.duration,easing:K.easing,start:null,last:null,frame:null};return this.#i=M,this.#f(M,0),M.frame=this.#l().request(ee=>this.#m(M,ee)),{animated:!0,reason:s?"entry":"update",marks:ne}}#m(h,g){if(this.#i!==h)return;h.frame=null,h.start===null&&(h.start=g),h.last=g;const j=h.duration>0?Math.min(1,(g-h.start)/h.duration):1;if(j>=1){this.finish();return}this.#f(h,h.easing(j)),h.frame=this.#l().request(X=>this.#m(h,X))}#f(h,g){for(const j of h.records)j.paint(g);for(const j of h.ghosts)j.paint(g);if(h.reveal&&h.layout.plot){const j=h.reveal.firstChild,X=h.layout.plot;u(j,"width",Math.max(0,(X.width+16)*g))}}#M(h,g){if(!this.#s||this.#s.parentNode!==h){const X=h.ownerDocument,K=X.createElementNS("http://www.w3.org/2000/svg","clipPath");P+=1,K.setAttribute("id",`lattice-chart-reveal-${P}`),K.appendChild(X.createElementNS("http://www.w3.org/2000/svg","rect")),h.appendChild(K),this.#s=K}const j=this.#s.firstChild;return u(j,"x",g.plot.left-8),j.setAttribute("y","0"),u(j,"height",Math.max(0,g.height||0)),j.setAttribute("width","0"),this.#s}#p(h,g,j){if(j.kind==="arc")return this.#k(h,g.arc,j.arc);if(j.kind==="path"){const K=g.path,pe=j.path;if(!K||!pe||K.skeleton!==pe.skeleton||K.tokens.length!==pe.tokens.length||pe.flags.some(q=>K.tokens[q]!==pe.tokens[q])||K.tokens.every((q,z)=>q===pe.tokens[z]))return null;const ne=[["d",h.getAttribute("d")]],C=pe.tokens.slice();return{el:h,final:ne,temporary:[],paint:q=>{for(let z=0;z<C.length;z++)typeof pe.tokens[z]=="number"&&(C[z]=N(K.tokens[z],pe.tokens[z],q));h.setAttribute("d",O(C))}}}const X=f[j.kind];return!X||g.values.every((K,pe)=>K===j.values[pe])?null:this.#c(h,X,g.values,j.values,null)}#c(h,g,j,X,K){const pe=g.map(C=>[C,h.getAttribute(C)]),ne=[];return K&&(pe.push(["opacity",h.getAttribute("opacity")]),ne.push(["opacity",h.getAttribute("opacity")])),{el:h,final:pe,temporary:ne,paint:C=>{for(let q=0;q<g.length;q++)u(h,g[q],N(j[q],X[q],C));K&&u(h,"opacity",N(K.from,K.to,C))}}}#k(h,g,j){if(!g||!j||typeof j.draw!="function")return null;const X=["cx","cy","inner","outer","from","to"];if(X.every(ne=>g[ne]===j[ne]))return null;const K=[["d",h.getAttribute("d")]],pe=()=>this.#i;return{el:h,final:K,temporary:[],paint:ne=>{const C={};for(const z of X)C[z]=N(g[z],j[z],ne);const q=pe();q&&q.arcsNow.set(h,{...C,draw:j.draw}),h.setAttribute("d",j.draw(C))}}}#O(h,g,j,X,K){const pe=String(h.getAttribute("class")||"");if(g.kind==="arc"){const C=j&&Number.isFinite(X.sweepStart)?X.sweepStart:g.arc.from;return this.#k(h,{...g.arc,from:C,to:C},g.arc)}if(g.kind==="rect"&&/__bar\b/.test(pe)){const[C,q,z,t]=g.values;if(K.horizontal){const s=Number.isFinite(K.base)?K.base:C;return this.#c(h,f.rect,[s,q,0,t],g.values,null)}const e=Number.isFinite(K.base)?K.base:q+t;return this.#c(h,f.rect,[C,e,z,0],g.values,null)}if(g.kind==="circle"){const[C,q]=g.values;return this.#c(h,f.circle,[C,q,0],g.values,{from:0,to:g.opacity})}if(g.kind==="line"){const[C,q]=g.values;return this.#c(h,f.line,[C,q,C,q],g.values,null)}return g.kind==="path"&&j&&/__(line|area)\b/.test(pe)?{el:h,final:[],temporary:[],reveal:!0,paint:()=>{}}:this.#c(h,[],[],[],{from:0,to:g.opacity})}#v(h,g,j){const X=h[g.group];if(!X)return null;const K=g.copy||(g.el.parentNode?null:g.el);if(!K)return null;K.setAttribute(L,""),K.setAttribute("data-decor","true"),K.setAttribute("aria-hidden","true"),K.setAttribute("pointer-events","none");for(const C of["tabindex","role","aria-label","aria-roledescription","id","data-pool-key","data-series","data-point","data-arc"])K.removeAttribute(C);K.setAttribute("class",String(K.getAttribute("class")||"").replace(/\s*\S+__mark\b/g,"").trim()),X.appendChild(K);const pe=String(K.getAttribute("class")||"");let ne;if(g.kind==="arc"&&g.arc&&typeof g.arc.draw=="function"){const C=(g.arc.from+g.arc.to)/2;ne=q=>{K.setAttribute("d",g.arc.draw({...g.arc,from:N(g.arc.from,C,q),to:N(g.arc.to,C,q)}))}}else if(g.kind==="rect"&&/__bar\b/.test(pe)){const[C,q,z,t]=g.values,e=j.horizontal?[Number.isFinite(j.base)?j.base:C,q,0,t]:[C,Number.isFinite(j.base)?j.base:q+t,z,0];ne=s=>{for(let d=0;d<4;d++)u(K,f.rect[d],N(g.values[d],e[d],s))}}else g.kind==="circle"?ne=C=>{u(K,"r",N(g.values[2],0,C))}:ne=C=>{u(K,"opacity",N(g.opacity,0,C))};return{el:K,paint:ne}}}}),it("packages/modules/charts/interaction.js",function(n,re){"use strict";Object.defineProperty(n,"resolveBrush",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(n,"brushed",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(n,"brushCondition",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"attachBrush",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"applySelection",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"attachKeyboard",{enumerable:!0,get:function(){return ue}});const ce=re("packages/modules/charts/svg.js").attrs,N=4;function ve(B){const f=B&&B.brush;if(f===!0)return{mode:"filter",axis:"x"};if(f==="filter"||f==="zoom"||f==="select")return{mode:f,axis:"x"};if(f&&typeof f=="object"&&f.mode){const L=["filter","zoom","select"].includes(f.mode)?f.mode:null,P=f.axis==="y"||f.axis==="y2"?f.axis:"x";return{mode:L,axis:P}}return{mode:null,axis:"x"}}function xe(B){const{bound:f,xScale:L}=B,P=Math.min(B.from,B.to),W=Math.max(B.from,B.to);if(B.axis==="y"||B.axis==="y2"){const m=B.axis==="y2"&&B.rightScale?B.rightScale:B.yScale||L;if(!m||typeof m.invert!="function")return{kind:"range",values:[],range:null,axis:B.axis};const u=m.invert(P),b=m.invert(W);return{kind:"range",values:[],range:[u,b],axis:B.axis}}if(L.kind==="band"){const m=[];for(const u of f.categories){const b=L.centre(u);!Number.isNaN(b)&&b>=P&&b<=W&&m.push(u)}return{kind:"set",values:m,range:null,axis:"x"}}const U=L.invert(P),v=L.invert(W);return{kind:"range",values:[],range:[U,v],axis:"x"}}function ie(B){const{column:f,result:L}=B;if(!f)return null;if(L.kind==="set")return L.values.length?{col:f,op:"in",value:L.values.slice()}:null;if(!L.range)return null;const[P,W]=L.range;if(!Number.isFinite(P)||!Number.isFinite(W))return null;const U=B.kind==="time"?[new Date(Math.min(P,W)),new Date(Math.max(P,W))]:[Math.min(P,W),Math.max(P,W)];return{col:f,op:"between",value:U,bounds:"[]"}}function ae(B){let f=null,L=null;const P=()=>{const m=typeof B.axis=="function"?B.axis():"x",u=m==="y"||m==="y2";return(typeof B.horizontal=="function"?B.horizontal():!1)!==u},W=m=>{if(!B.enabled())return;const u=B.pointOf(m);f=P()?u.y:u.x,L=B.svg.ownerDocument.createElementNS("http://www.w3.org/2000/svg","rect"),L.setAttribute("class","lat-chartview__brush"),B.overlay.appendChild(L)},U=m=>{if(f===null||!L)return;const u=B.plot();if(P()){const w=B.pointOf(m).y,R=Math.max(u.top,Math.min(f,w)),i=Math.min(u.bottom,Math.max(f,w));ce(L,{x:u.left,y:R,width:Math.max(0,u.right-u.left),height:Math.max(0,i-R)});return}const b=B.pointOf(m).x,O=Math.max(u.left,Math.min(f,b)),Q=Math.min(u.right,Math.max(f,b));ce(L,{x:O,y:u.top,width:Math.max(0,Q-O),height:u.height})},v=m=>{if(f===null)return;const u=B.pointOf(m),b=P()?u.y:u.x,O=Math.abs(b-f),Q=f;f=null,L&&L.parentNode&&L.parentNode.removeChild(L),L=null,O>=N&&B.onBrush(Q,b)};return B.svg.addEventListener("pointerdown",W),B.svg.addEventListener("pointermove",U),B.svg.addEventListener("pointerup",v),B.svg.addEventListener("pointerleave",v),()=>{B.svg.removeEventListener("pointerdown",W),B.svg.removeEventListener("pointermove",U),B.svg.removeEventListener("pointerup",v),B.svg.removeEventListener("pointerleave",v)}}function J(B){const f=B.groups.marks,L=B.keys.size>0||B.categories.size>0;let P=0;for(const W of f.childNodes||[]){if(!W.getAttribute)continue;const U=Number(W.getAttribute("data-series")),v=Number(W.getAttribute("data-point")),m=B.series[U],u=m&&m.points[v],b=!!u&&(u.rowKey&&B.keys.has(u.rowKey)||u.xKey!==void 0&&B.categories.has(u.xKey));b&&P++,L&&!b?W.setAttribute("data-dim","true"):W.removeAttribute("data-dim")}return P}function ue(B){let f=0;const L=W=>{const U=B.marks();if(U.length){f=Math.max(0,Math.min(U.length-1,W));for(let v=0;v<U.length;v++)U[v].setAttribute("tabindex",v===f?"0":"-1");U[f].focus&&U[f].focus(),B.onFocus(f)}},P=W=>{if(typeof B.intercept=="function"&&B.intercept(W))return;const U=B.marks();if(U.length){if(typeof B.within=="function"&&B.within(W,f)){W.preventDefault&&W.preventDefault();return}switch(W.key){case"ArrowRight":case"ArrowDown":L(f+1);break;case"ArrowLeft":case"ArrowUp":L(f-1);break;case"Home":L(0);break;case"End":L(U.length-1);break;case"Enter":case" ":B.onActivate(f);break;default:return}W.preventDefault&&W.preventDefault()}};return B.svg.addEventListener("keydown",P),()=>B.svg.removeEventListener("keydown",P)}}),it("packages/modules/charts/range.js",function(n,re){"use strict";Object.defineProperty(n,"deriveRangeSpec",{enumerable:!0,get:function(){return xe}});const Se=new Set(["number","currency","percent","integer"]);function ce(ie){return!!ie&&typeof ie.type=="string"&&Se.has(ie.type)}function N(ie){const ae=ie&&ie.selection&&typeof ie.selection.ranges=="function"?ie.selection.ranges():[];return!Array.isArray(ae)||!ae.length?null:ae[ae.length-1]}function ve(ie,ae){const J=[],ue=Math.min(ae.startRow,ae.endRow),B=Math.max(ae.startRow,ae.endRow);for(let f=ue;f<=B;f++){const L=ie.rows.get(f);L&&!L.group&&L.data!==null&&L.data!==void 0&&J.push(L)}return J}function xe(ie,ae={}){const J=R=>({spec:null,type:null,x:null,measures:[],columns:[],reason:R}),ue=ae.range||N(ie);if(!ue)return J("no-range");const B=ie.columns.visible(),f=new Set(B.map(R=>R.id)),L=(ue.columns||[]).filter(R=>f.has(R));if(!L.length)return J("no-visible-columns");const P=L.map(R=>({id:R,column:ie.columns.get(R)})),W=P.filter(R=>ce(R.column)).map(R=>R.id),U=P.filter(R=>!ce(R.column)).map(R=>R.id);if(!W.length)return J("no-measure");const v=U.length?U[0]:null,m=W,b={rows:ve(ie,ue)},O=new Set(["bar","line","area"]);if(m.length>1){const R=ae.type,i=O.has(R)?R:null,x=R&&!O.has(R)?R:"combo";return{spec:{...b,type:x,x:v,measures:m.map(h=>i?{col:h,type:i}:{col:h})},type:x,x:v,measures:m,columns:L,reason:null}}const Q=ae.type||"bar";return{spec:{...b,type:Q,x:v,y:m[0]},type:Q,x:v,measures:m,columns:L,reason:null}}}),it("packages/modules/charts/regression.js",function(n,re){"use strict";Object.defineProperty(n,"regressionPlots",{enumerable:!0,get:function(){return xe}});const Se=new Set(["number","currency","percent","integer"]);function ce(ie,ae={}){return{spec:ie,reason:null,...ae}}function N(ie,ae={}){return{spec:null,reason:ie,...ae}}function ve(ie){if(!ie||!Array.isArray(ie.fitted)||!Array.isArray(ie.residuals)||!Array.isArray(ie.leverage)||!(ie.sigma2>0))return null;const ae=Math.sqrt(ie.sigma2),J=[];for(let ue=0;ue<ie.fitted.length;ue++){const B=ie.leverage[ue];if(!Number.isFinite(B)||B>=1)continue;const f=ae*Math.sqrt(1-B);if(!(f>0))continue;const L=ie.residuals[ue]/f;J.push({x:ie.fitted[ue],y:Math.sqrt(Math.abs(L)),key:String(ue)})}return J}function xe(ie,ae={}){const J=ae.model||(ie&&ie.statistics&&typeof ie.statistics.regressionModel=="function"?ie.statistics.regressionModel(ae.spec||{}):null),ue=j=>({fit:N(j),residualsFitted:N(j),qq:N(j),multicollinearity:N(j),scaleLocation:N(j),residualsLeverage:N(j),coefficientForest:N(j)});if(!J||!Array.isArray(J.predictors)||!J.predictors.length||!J.response)return{model:null,plots:ue("no-model")};const B=J.predictors,f=J.response,L=ae.rows,P=()=>L===void 0?{}:{rows:L},W=ae.fitted||null,U=ae.residual||null,v=ae.stdResidual||null,m=ae.leverage||null,u=ae.cooksD||null,b=B.length===1?ce({type:"scatter",x:B[0],y:f,fit:!0,band:J.band||null,...P()}):N("multiple-predictors"),O=W&&U?ce({type:"scatter",x:W,y:U,reference:[{value:0}],...P()}):N("needs-fitted-and-residual-columns"),Q=U?ce({type:"qq",y:U,...P()}):N("needs-residual-column"),w=B.filter(j=>{const X=ie&&ie.columns&&typeof ie.columns.get=="function"?ie.columns.get(j):null;return!X||typeof X.type=="string"&&Se.has(X.type)}),R=B.length>=2?ce({type:"correlogram",columns:w},{vif:J.vif||null}):N("single-predictor",{vif:J.vif||null}),i=m&&v?ce({type:u?"bubble":"scatter",x:m,y:v,...u?{size:u}:{},reference:[{value:0}],...P()}):N("needs-leverage-and-standardised-residual-columns"),x=ve(J),T=x&&x.length?ce({type:"scatter",points:x,fit:!0,dimensionTitle:"Fitted",measureTitle:"√|standardised residual|"}):N("needs-fitted-model"),h=Array.isArray(J.coefficients)?J.coefficients.filter(j=>j&&Number.isFinite(j.estimate)&&Number.isFinite(j.lower)&&Number.isFinite(j.upper)).map(j=>({x:j.estimate,label:j.name,lower:j.lower,upper:j.upper})):[],g=h.length?ce({type:"forest",points:h,dimensionTitle:"Coefficient",measureTitle:"Estimate"},{coefficients:J.coefficients||null}):N("needs-coefficient-intervals",{coefficients:J.coefficients||null});return{model:J,plots:{fit:b,residualsFitted:O,qq:Q,multicollinearity:R,scaleLocation:T,residualsLeverage:i,coefficientForest:g}}}}),it("packages/modules/charts/registry.js",function(n,re){"use strict";Object.defineProperty(n,"registerChartType",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"chartTypeDef",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"registeredChartTypes",{enumerable:!0,get:function(){return ve}});const Se=new Map;function ce(xe,ie){if(typeof xe!="string"||!xe)throw new TypeError("[lattice] registerChartType needs a non-empty type name.");if(!ie||typeof ie.draw!="function")throw new TypeError(`[lattice] registerChartType('${xe}') needs a { draw } function.`);Se.set(xe,ie)}function N(xe){return Se.get(xe)||null}function ve(){return[...Se.keys()]}}),it("packages/modules/charts/responsive.js",function(n,re){"use strict";Object.defineProperty(n,"HYSTERESIS",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"mergeOptions",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"AUTO_RULES",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"resolveRules",{enumerable:!0,get:function(){return f}}),Object.defineProperty(n,"ruleMatches",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"matchRules",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"applyRules",{enumerable:!0,get:function(){return W}}),Object.defineProperty(n,"describeActive",{enumerable:!0,get:function(){return U}});const ce=re("packages/core/src/internal/util.js").warnOnce,N=4,ve=["maxWidth","minWidth","maxHeight","minHeight"];function xe(v){return!!v&&typeof v=="object"&&!Array.isArray(v)&&Object.getPrototypeOf(v)===Object.prototype}function ie(v,m){if(!xe(v)||!xe(m))return xe(m)?ie({},m):m;const u={...v};for(const b of Object.keys(m))u[b]=ie(v[b],m[b]);return u}const ae=3;function J(v){const m={};if(v.legend!==!1&&(m.legend={position:"bottom"}),v.axis!==!1){const u=b=>{const O=xe(v.axis)?v.axis[b]:void 0;return xe(O)&&Array.isArray(O.ticks)?{title:""}:{title:"",ticks:ae}};m.axis={x:{title:""},y:u("y"),y2:u("y2")}}return m}function ue(){return{legend:!1}}const B=Object.freeze([Object.freeze({auto:!0,maxWidth:399,set:J}),Object.freeze({auto:!0,maxWidth:249,set:ue})]);function f(v){if(v==null||v===!1)return[];const m=v==="auto"||v===!0?["auto"]:v;if(!Array.isArray(m))return ce("chart:responsive-option","the chart option `responsive` takes 'auto' or an array of rules ({ maxWidth?, minWidth?, maxHeight?, minHeight?, set }); it was ignored."),[];const u=[];for(const b of m){if(b==="auto"){u.push(...B);continue}if(!(xe(b)&&(xe(b.set)||typeof b.set=="function")&&ve.every(Q=>b[Q]===void 0||Number.isFinite(b[Q])))){ce("chart:responsive-rule","a chart `responsive` rule was ignored: each rule needs a `set` object and, optionally, numeric maxWidth / minWidth / maxHeight / minHeight.");continue}u.push(b)}return u}function L(v,m,u){const b=u?N:0;return!(v.maxWidth!==void 0&&!(m.width<=v.maxWidth+b)||v.minWidth!==void 0&&!(m.width>=v.minWidth-b)||v.maxHeight!==void 0&&!(m.height<=v.maxHeight+b)||v.minHeight!==void 0&&!(m.height>=v.minHeight-b))}function P(v,m,u){const b=new Set(u),O=[];return v.forEach((Q,w)=>{L(Q,m,b.has(w))&&O.push(w)}),O}function W(v,m,u){if(!u.length)return v;let b=v;for(const O of u){const Q=m[O],w=typeof Q.set=="function"?Q.set(b):Q.set;if(!xe(w))continue;const{responsive:R,...i}=w;b=ie(b,i)}return b}function U(v,m){return m.map(u=>{const b=v[u],O={index:u,auto:!!b.auto};for(const Q of ve)b[Q]!==void 0&&(O[Q]=b[Q]);return O})}}),it("packages/modules/charts/index.js",function(n,re){"use strict";Object.defineProperty(n,"TYPES",{enumerable:!0,get:function(){return sr}}),Object.defineProperty(n,"Chart",{enumerable:!0,get:function(){return ro}}),Object.defineProperty(n,"createChart",{enumerable:!0,get:function(){return oo}}),Object.defineProperty(n,"deriveRangeSpec",{enumerable:!0,get:function(){return $r}}),Object.defineProperty(n,"regressionPlots",{enumerable:!0,get:function(){return Po}}),Object.defineProperty(n,"chartRange",{enumerable:!0,get:function(){return js}}),Object.defineProperty(n,"canChartRange",{enumerable:!0,get:function(){return Ps}});const Se=re("packages/modules/charts/cartesian.js"),ce=Se.aheadOfWindow,N=Se.axisWindowNow,ve=Se.axisWindowSpan,xe=Se.bandedX,ie=Se.CARTESIAN,ae=Se.drawCartesian,J=Se.drawForest,ue=Se.nearestCategory,B=Se.nearestDrawnPoint,f=Se.WINDOW_LEAD,L=Se.windowedBound,P=Se.withWaterfallTotal,W=Se.xDomainFor,v=re("packages/modules/charts/drawable.js").drawability,m=re("packages/modules/charts/axis.js"),u=m.createGroups,b=m.drawAxisTitle,O=m.normaliseAxes,Q=m.setPlotClip,w=m.tickLabeller,R=re("packages/modules/charts/bind.js"),i=R.bindHierarchy,x=R.bindLinks,T=R.bindMeasures,h=R.bindPoints,g=R.bindSeries,j=R.leafRows,K=re("packages/modules/shared/engine.js").EngineFlight,pe=re("packages/modules/charts/mapview.js"),ne=pe.capClientBound,C=pe.engineRowsReader,q=pe.frameMoved,z=pe.frameOf,t=pe.MAP_ENGINE_TYPES,e=pe.needsRefit,s=pe.planMapViewport,d=pe.ringsBox,p=pe.viewportCap,ee=re("packages/modules/charts/mapdensity.js").drawDensityCells,H=re("packages/modules/charts/engine.js"),F=H.boundFromGroups,o=H.holdsWindow,A=H.measureProvenance,G=H.planAggregate,D=H.specMeasures,V=re("packages/modules/charts/frame.js"),de=V.Pool,$=V.plotRect,_=re("packages/modules/charts/scale.js"),oe=_.key,a=_.measureDomain,y=_.sqrtScale,r=re("packages/modules/charts/format.js"),k=r.measureFormat,l=r.measureText,I=re("packages/modules/charts/radial.js"),E=I.arcAt,Y=I.arcPath,se=I.drawRadial,le=re("packages/modules/charts/distribution.js"),ye=le.drawBoxPlot,be=le.drawCapability,Ae=le.drawControl,Ne=le.drawEcdf,te=le.drawHistogram,Me=le.drawLorenz,ke=le.drawMovingRange,we=le.drawQQ,je=le.RULE_LABEL_ROOM,Ce=re("packages/modules/charts/treemap.js").drawTreemap,Le=re("packages/modules/charts/annotate-layer.js").ChartAnnotations,_e=re("packages/modules/charts/annotate-items.js"),ot=_e.itemsFromState,qe=_e.resolveAnnotate,Xe=_e.serialiseItem,We=re("packages/modules/charts/zoom-view.js"),et=We.bandRange,He=We.magnify,pt=We.resolveZoom,ct=We.sameView,St=We.settleView,Kt=We.slice,Ye=We.slide,nt=We.viewOfRange,yt=We.ZOOM_CONTROLS,Je=re("packages/modules/charts/zoom-toolbar.js").buildZoomToolbar,lt=re("packages/modules/charts/zoom-follow.js"),kt=lt.BRUSH_OWNER,Et=lt.CLICK_OWNER,ut=lt.conditionRange,bt=lt.findOwned,ft=lt.followCondition,Ot=lt.FOLLOW_Y_TYPES,Ft=lt.leafPrint,tn=lt.localWall,Nt=lt.mergeOwned,Rt=lt.ownedLeaves,Dt=lt.pruneOwned,Jt=lt.sliceKeys,An=lt.unionExtent,cn=re("packages/modules/charts/hit.js"),un=cn.hnodeHit,pn=cn.ownsGeometry,fn=cn.resolveHit,Tn=re("packages/modules/charts/hnodes.js"),Mt=Tn.emphasiseChord,nn=Tn.emphasiseHierarchy,sn=Tn.emphasiseLayout,kr=re("packages/modules/charts/drag-edit.js").DragEditor,xr=re("packages/modules/charts/combo.js").drawCombo,me=re("packages/modules/charts/floating.js"),Re=me.bindFloating,Te=me.drawFloating,ze=re("packages/modules/charts/pyramid.js"),Fe=ze.bindPyramid,Be=ze.drawPyramid,De=re("packages/modules/charts/bullet.js"),tt=De.bindBullet,Ke=De.drawBullet,Ve=re("packages/modules/charts/polar.js"),rt=Ve.drawGauge,st=Ve.drawRadar,xt=re("packages/modules/charts/matrix.js"),vt=xt.clearVolumePane,jt=xt.drawCandlestick,Pt=xt.drawCorrelogram,Ct=xt.drawFunnel,Bt=xt.drawHeatmap,Vt=xt.title,en=xt.VOLUME_PANE_HEIGHT,Zt=re("packages/modules/charts/multiples.js"),Qt=Zt.panelRects,Xt=Zt.splitPanels,Ut=re("packages/modules/charts/geo.js"),rn=Ut.basemapStyleOf,ar=Ut.checkGeometrySpec,jn=Ut.drawGeomap,En=Ut.geoRamp,Cn=Ut.GEOMETRY_TYPES_PLACED,Sn=Ut.packRegions,yn=Ut.projectedPath,Yt=Ut.referenceRegions,Jn=Ut.resolvePack,Xn=re("packages/modules/charts/projection.js"),Mn=Xn.fitted,wn=Xn.resolveProjection,Qn=Xn.splitAntimeridian,bn=re("packages/modules/charts/viewport-filter.js"),Kn=bn.adoptedGeoView,lr=bn.conditionBbox,qn=bn.mergeViewportCondition,Pn=bn.pruneTarget,Un=bn.resolveViewportFilter,Ln=bn.sameBbox,_n=bn.viewportBbox,vr=bn.viewportCondition,cr=bn.viewportTarget,Rn=re("packages/modules/charts/globe.js"),Hn=Rn.HEMISPHERE_METRES,Wn=Rn.meanDirection,er=re("packages/modules/charts/flow.js"),Vn=er.drawChord,ur=er.drawSankey,$n=re("packages/modules/charts/network.js"),fr=$n.drawNetwork,tr=$n.emphasiseNetwork,nr=re("packages/modules/charts/stream.js"),At=nr.drawMarimekko,It=nr.drawStream,on=nr.drawViolin,kn=re("packages/modules/charts/gantt.js").drawGantt,zn=re("packages/modules/charts/animate.js"),hr=zn.ANIMATION_BUDGET,Ar=zn.MarkAnimator,dr=zn.motionBlocked,co=zn.motionTokenMs,uo=zn.resolveAnimation,Rr=re("packages/modules/charts/tween.js"),fo=Rr.frameLoop,ho=Rr.tween,On=re("packages/modules/charts/svg.js"),Fn=On.attrs,In=On.append,Dn=On.clear,wt=On.el,rr=On.round,Lt=On.setText,Sr=On.svg,zr=re("packages/modules/charts/styles.js"),zt=zr.NS,mo=zr.injectStyles,Bn=re("packages/modules/charts/scheme.js"),Mr=Bn.resolveScheme,mr=re("packages/modules/charts/fills.js"),go=mr.createFillRegistry,Fr=mr.nodePaint,Ir=mr.rowFillSource,Dr=mr.swatchCss,Or=re("packages/modules/charts/markers.js"),po=Or.markerFor,yo=Or.placeMarker,bo=Or.resolveMarker,Nr=re("packages/modules/charts/typography.js"),Gn=Nr.applySize,Br=Nr.resolveType,wo=Nr.textWidth,Gr=re("packages/modules/charts/labels.js"),ko=Gr.collides,xo=Gr.resolveLabels,Yn=re("packages/modules/charts/interaction.js"),vo=Yn.applySelection,Ao=Yn.attachBrush,So=Yn.attachKeyboard,Kr=Yn.brushCondition,Mo=Yn.brushed,gr=Yn.resolveBrush,jr=re("packages/modules/charts/dense.js"),$s=jr.downsample,Ts=jr.markCount,Oo=jr.wantsCanvas,Pr=re("packages/modules/charts/cursor.js"),No=Pr.ChartCursor,jo=Pr.GROUP_TOOLTIPS,Ur=Pr.resolveCursor,$r=re("packages/modules/charts/range.js").deriveRangeSpec,Po=re("packages/modules/charts/regression.js").regressionPlots,or=re("packages/modules/charts/registry.js"),Tr=or.chartTypeDef,Ls=or.registeredChartTypes,_s=or.registerChartType,$o=_.linearScale,To=_.bandScale,Hr=_.extent,Wr=_.toNumber,Eo=_.isNumber,Co=_.niceDomain,Lo=_.linearTicks,_o=_.timeScale,Vr=_.toTime,Ro=_.niceStep,zo=xt.colourRamp,Fo=On.path,Io=On.attr,Yr=re("packages/core/src/internal/util.js"),Do=Yr.infoOnce,Ht=Yr.warnOnce,pr=re("packages/modules/charts/responsive.js"),Bo=pr.resolveRules,Go=pr.matchRules,Ko=pr.applyRules,Zr=pr.describeActive,Uo=m.drawMeasureAxis,Ho=m.drawCategoryAxis,Wo=m.drawAxisLines,Vo=m.drawContinuousAxis,Yo=m.drawBandLabels,Zo=m.tickValues,Jo=le.density,Xo=le.valuesByCategory,Qo=le.summarise,qo=le.quantile,es=le.histogram,yr=r.formatters;Object.defineProperty(n,"registerScheme",{enumerable:!0,get:function(){return Bn.registerScheme}}),Object.defineProperty(n,"resolveScheme",{enumerable:!0,get:function(){return Bn.resolveScheme}}),Object.defineProperty(n,"schemeNames",{enumerable:!0,get:function(){return Bn.schemeNames}}),Object.defineProperty(n,"setDefaultScheme",{enumerable:!0,get:function(){return Bn.setDefaultScheme}}),Object.defineProperty(n,"SCHEMES",{enumerable:!0,get:function(){return Bn.SCHEMES}}),Object.defineProperty(n,"PALETTE",{enumerable:!0,get:function(){return Bn.PALETTE}}),Object.defineProperty(n,"registerChartType",{enumerable:!0,get:function(){return or.registerChartType}}),Object.defineProperty(n,"registeredChartTypes",{enumerable:!0,get:function(){return or.registeredChartTypes}});const ts=Object.freeze({el:wt,svg:Sr,attr:Io,attrs:Fn,append:In,clear:Dn,path:Fo,round:rr,setText:Lt,Pool:de,plotRect:$,linearScale:$o,bandScale:To,sqrtScale:y,extent:Hr,measureDomain:a,niceDomain:Co,linearTicks:Lo,timeScale:_o,toTime:Vr,niceStep:Ro,toNumber:Wr,isNumber:Eo,key:oe,drawMeasureAxis:Uo,drawCategoryAxis:Ho,drawAxisLines:Wo,drawContinuousAxis:Vo,drawBandLabels:Yo,tickValues:Zo,formatters:yr,resolveScheme:Mr,colourRamp:zo,measureFormat:k,measureText:l,resolveMarker:bo,markerFor:po,placeMarker:yo,density:Jo,valuesByCategory:Xo,summarise:Qo,quantile:qo,histogram:es,resolvePack:Jn,packRegions:Sn,fitted:Mn,resolveProjection:wn,splitAntimeridian:Qn,projectedPath:yn,basemapStyleOf:rn,referenceRegions:Yt,geoRamp:En,textWidth:wo,applySize:Gn,collides:ko,drawDensityCells:ee,frameLoop:fo,tween:ho,NS:zt});function Jr(dt,c){const S=`chart.type.${c}`,Z=dt.t(S);if(Z!==S)return Z;const he=String(c).replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase();return he.charAt(0).toUpperCase()+he.slice(1)}const sr=Object.freeze(["line","step","area","rangeArea","bar","horizontalBar","waterfall","floatingBar","horizontalFloatingBar","populationPyramid","bullet","scatter","bubble","forest","combo","pareto","histogram","boxplot","heatmap","qq","ecdf","lorenz","correlogram","control","capability","movingRange","pie","donut","sunburst","treemap","radar","gauge","funnel","candlestick","ohlc","geomap","sankey","chord","network","stream","marimekko","violin","gantt"]),Er=new Set([...Object.keys(ie),"combo","candlestick",...Cn]),br=new Set([...Object.keys(ie),"combo","heatmap"]),Cr=new Set([...Object.keys(ie),"combo","pareto"]),ns=4,Xr=new Set(["bar","column","horizontalBar","line","area","scatter","bubble","combo","pareto","histogram","heatmap","pie","donut","sunburst","treemap","radar","geomap"]),rs=new Set(["pie","donut","sunburst"]),os=new Set(["pie","donut","sunburst","treemap"]),Qr=20,ss=new Set(["histogram","boxplot","qq","ecdf","lorenz","control","capability","movingRange"]),is=new Set(["histogram","boxplot","qq","ecdf","lorenz","violin"]);function as(dt){const c=dt.y||(Array.isArray(dt.measures)&&dt.measures.length?dt.measures[0]:null);if(!c)return dt;const S=typeof c=="string"?c:c.col;if(!S)return dt;const Z=typeof c=="object"&&c.fn!=null?c.fn:"median";return{...dt,y:{col:S,fn:Z}}}const ls=new Set(["combo","candlestick","ohlc"]),qr=new Set(["bar","line","step","area","scatter","bubble"]),cs=new Set(["sankey","chord","network"]),Lr=Symbol("pending"),us=new Set(["gantt"]),fs=new Set(["radar","gauge","funnel","heatmap","geomap","sankey","chord","network"]),xn=Object.freeze({width:480,height:300}),hs=new Set(["bar","horizontalBar","combo","pareto"]),ds=new Set(["horizontalBar","horizontalFloatingBar","populationPyramid"]),ir=Object.freeze(["00000"]),ms=new Set(["horizontalBar","horizontalFloatingBar","forest"]);function wr(dt,c){return ms.has(dt)||dt==="populationPyramid"?!0:dt==="bullet"&&!(c&&c.bullet&&c.bullet.orientation==="vertical")}function gs(dt,c){return!(dt==="bullet"&&c&&c.bullet&&c.bullet.scale==="row")}function ps(dt){if(!dt||!Array.isArray(dt.points))return null;let c=0,S=!1;for(const Z of dt.points)typeof Z.y=="number"&&Number.isFinite(Z.y)&&(c+=Z.y,S=!0);return S?c:null}function eo(dt,c,S,Z){return dt==="correlogram"?(Array.isArray(Z.columns)?Z.columns:[]).map(fe=>Vt(S,fe)):dt==="heatmap"?(c.series||[]).map(he=>he.label):dt==="gantt"?(c.rows||[]).map(he=>Z.label?S.rows.text(he.key,Z.label):String(he.key)):wr(dt,Z)?c.labels||[]:ir}const ys=1e3,bs=50;let ws=0;function ks(dt){const c=dt/1e3;return`${c>=10?Math.round(c):Math.round(c*10)/10}s`}function to(dt){return`${dt/1e3}s`}function gn(dt){return dt&&dt.defaultView||globalThis}function xs(dt,c){return c?typeof c=="string"?dt.querySelector(c):c:null}function vs(dt,c,S){const Z=["fill","fill-opacity","stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-linejoin","stroke-linecap","font-size","font-family","font-weight","opacity","text-anchor","dominant-baseline","visibility"],he=[dt,...dt.querySelectorAll("*")],fe=[c,...c.querySelectorAll("*")];for(let ge=0;ge<he.length&&ge<fe.length;ge++){const Oe=S.getComputedStyle(he[ge]),Ee=[];for(const Ue of Z){const Ie=Oe.getPropertyValue(Ue);Ie&&Ee.push(`${Ue}:${Ie}`)}Ee.length&&fe[ge].setAttribute("style",Ee.join(";"))}}function As(dt,c){let S=dt.root;const Z=[];for(const he of c){const fe=(S.children||[]).find(ge=>ge.label===he);if(!fe||!fe.children||!fe.children.length)break;S=fe,Z.push(he)}return Z.length?{...dt,root:S,path:Z,empty:!S.children.length}:dt}function Ss(dt,c,S){return dt&&dt.plot?dt.plot:{left:0,top:0,right:c,bottom:S,width:c,height:S,gutter:{left:0,bottom:0,right:0,top:0}}}function no(dt){const[c,S]=[...dt.values()];return c&&S?Math.hypot(c.x-S.x,c.y-S.y):0}function Ms(dt){const[c,S]=[...dt.values()];return!c||!S?c||{x:0,y:0}:{x:(c.x+S.x)/2,y:(c.y+S.y)/2}}const Os=new Set(["sum","avg","mean","median","min","max","first","last"]);function Ns(dt,c){return dt&&dt.measure&&dt.measure.col===c&&dt.measure.fn?dt.measure.fn:"sum"}class ro{#r=++ws;#n;#i;#t;#s;#l=null;#o=null;#a=null;#m=null;#f=null;#M=null;#p=null;#c=null;#k=null;#O=null;#v=[];#x=[];#b=new Set;#e=null;#d={zoom:1,offset:[0,0]};#z=null;#$=null;#N=null;#L=0;#_=null;#F=null;#pe="";#Me=!1;#ye=!1;#u=null;#be=0;#re=null;#oe=[];#Q=null;#Oe=!1;#T=!1;#q=!1;#B=new Map;#G=Mr();#se=null;#K=Br();#Le=null;#A=null;#U=null;#g=null;#R=null;#_e=null;#rt="";#H=null;#h={x:null,y:null};#j={x:null,y:null};#J=!1;#S=[];#Ne={first:0,last:0};#W=!1;#we=!1;#ue=null;#V=null;#ke=!1;#Re=null;#Y=new Map;#xe=null;#ot=!1;#ee={written:{x:null,y:null},timer:0,frozen:null,reset:!1,moved:!1,type:"",full:null};#y=null;#X=!1;#I=-1;#ze=null;#Fe=null;#te=null;#fe=null;#Ie=0;#ie=new K;#ve={bbox:null,span:360,width:0};#he=null;#st=0;#P=null;#E=null;#je=!1;#it=!1;#at=null;#lt=0;#ct={animated:!1,reason:"not-drawn",marks:0,budget:hr};#C={source:"client",asked:"auto",reason:"the chart has not drawn yet",pending:!1,measures:[]};#Pe=null;#Z;#ne={rules:[],active:[]};#De=null;constructor(c){this.#n=c.grid,this.#i=c.container,this.#Z=c.spec,this.#t=c.spec,this.#s=c.container.ownerDocument,this.#Bt(),this.#Gt(),this.#Ce(!0),this.draw()}#Bt(){mo(this.#s);const c=this.#s;this.#l=wt(c,"div",zt);const S=wt(c,"figure",`${zt}__figure`);if(this.#t.title||this.#t.subtitle){const he=wt(c,"figcaption",`${zt}__caption`);if(this.#t.title){const fe=wt(c,"div",`${zt}__title`);Lt(fe,this.#t.title),he.appendChild(fe)}if(this.#t.subtitle){const fe=wt(c,"div",`${zt}__subtitle`);Lt(fe,this.#t.subtitle),he.appendChild(fe)}S.appendChild(he)}this.#o=Sr(c,"svg",{class:`${zt}__plot`,preserveAspectRatio:"xMidYMid meet",role:"img"}),this.#a=u(c,this.#o);const Z=Sr(c,"defs",{class:`${zt}__fills`});if(this.#o.appendChild(Z),this.#se=go(Z),S.appendChild(this.#o),this.#E=new Ar({view:c.defaultView||null}),this.#M=wt(c,"div",`${zt}__edit-status`),this.#M.setAttribute("role","status"),this.#M.setAttribute("aria-live","polite"),this.#M.setAttribute("hidden",""),S.appendChild(this.#M),this.#p=new kr({svg:this.#o,doc:c,status:this.#M,grid:()=>this.#n,pointOf:he=>this.#D(he),edited:he=>this.emit("edit",he),rejected:he=>this.emit("editRejected",he),hideTooltip:()=>this.#de(),fn:()=>this.#u&&this.#u.measure&&this.#u.measure.fn||"sum"}),this.#O=wt(c,"div",`${zt}__empty`),this.#O.setAttribute("hidden",""),S.appendChild(this.#O),this.#c=wt(c,"div",`${zt}__table`),S.appendChild(this.#c),this.#m=wt(c,"div",`${zt}__legend`),S.appendChild(this.#m),this.#t.footnote){const he=wt(c,"div",`${zt}__footnote`);Lt(he,this.#t.footnote),S.appendChild(he)}this.#$=wt(c,"div",`${zt}__attribution`),this.#$.setAttribute("hidden",""),S.appendChild(this.#$),this.#f=wt(c,"div",`${zt}__tooltip`),this.#f.setAttribute("hidden",""),this.#l.appendChild(S),this.#i.appendChild(this.#l),this.#gt(),this.#Ut()}#Gt(){this.#ut();const c=gn(this.#s);c&&typeof c.ResizeObserver=="function"&&(this.#Q=this.#i.getBoundingClientRect?this.#i.getBoundingClientRect():null,this.#re=new c.ResizeObserver(()=>{if(!this.#Oe){this.#Oe=!0;const S=this.#i.getBoundingClientRect?this.#i.getBoundingClientRect():null;if(S&&this.#Q&&Math.round(S.width)===Math.round(this.#Q.width)&&Math.round(S.height)===Math.round(this.#Q.height))return}this.#Ce(!1),this.schedule()}),this.#re.observe(this.#i))}#ut(){const c=["model:changed","rows:changed","filter:changed","sort:changed","column:grouped","column:pivoted","cell:changed","timeline:seek","timeline:attached","timeline:detached"];this.#t.selection&&this.#x.push(this.#n.on("selection:changed",()=>this.#wt())),this.#t.fitTo==="selection"&&this.#x.push(this.#n.on("selection:changed",()=>{this.fitToSelection()}));for(const S of c)this.#x.push(this.#n.on(S,()=>{this.#je=!0,this.schedule()}));this.#x.push(this.#n.on("destroy",()=>this.#Kt()))}#Kt(){if(!this.#T){this.#q=!0;for(const c of this.#x)try{c()}catch{}this.#x=[]}}#ft(){const c=this.#o&&this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():null;return c&&c.width>0&&c.height>0?c:this.#i.getBoundingClientRect?this.#i.getBoundingClientRect():xn}#Ut(){const c=Qe=>{!this.#z&&!(this.#p&&this.#p.dragging)&&this.#Wt(Qe)},S=()=>{this.#X&&this.#y&&this.#y.leave(),this.#de()};this.#o.addEventListener("pointermove",c),this.#o.addEventListener("pointerleave",S);const Z=Qe=>this.#We(Qe);this.#o.addEventListener("click",Z);const he=Qe=>{!this.#e||!this.#e.packed||this.#g&&this.#g.busy||(this.#z={x:Qe.clientX||0,y:Qe.clientY||0})},fe=Qe=>{if(!this.#z)return;const Tt=Qe.clientX||0,ht=Qe.clientY||0;this.#Ae(Tt-this.#z.x,ht-this.#z.y),this.#z={x:Tt,y:ht}},ge=()=>{this.#z=null},Oe=Qe=>{!this.#e||!this.#e.packed||(Qe.preventDefault&&Qe.preventDefault(),this.#Ye(Qe.deltaY<0?1.15:1/1.15))},Ee=Qe=>{if(!this.#e||!this.#e.packed)return;const Tt=40;if(Qe.shiftKey&&Qe.key==="ArrowLeft")this.#Ae(-Tt,0);else if(Qe.shiftKey&&Qe.key==="ArrowRight")this.#Ae(Tt,0);else if(Qe.shiftKey&&Qe.key==="ArrowUp")this.#Ae(0,-Tt);else if(Qe.shiftKey&&Qe.key==="ArrowDown")this.#Ae(0,Tt);else if(Qe.key==="+"||Qe.key==="=")this.#Ye(1.25);else if(Qe.key==="-"||Qe.key==="_")this.#Ye(1/1.25);else if(Qe.key==="0")this.#sn();else return;Qe.preventDefault&&Qe.preventDefault()};this.#o.addEventListener("pointerdown",he),this.#o.addEventListener("pointermove",fe),this.#o.addEventListener("pointerup",ge),this.#o.addEventListener("pointerleave",ge),this.#o.addEventListener("wheel",Oe,{passive:!1}),this.#o.addEventListener("keydown",Ee);const Ue=()=>{if(!this.#W)return null;const Qe=pt(this.#t.zoom);return Qe.enabled?Qe:null},Ie=()=>!!(this.#g&&this.#g.busy)||!!gr(this.#t).mode,Ge=Qe=>{const Tt=Ue();if(!Tt||!Tt.wheel||this.#e&&this.#e.packed)return;const ht=Number(Qe.deltaY)||0;if(!ht)return;const at=this.#D(Qe);this.#ce(ht<0?"in":"out","wheel",this.#_t(at)),Qe.preventDefault&&Qe.preventDefault()},gt=Qe=>{this.#ke=!1;const Tt=Ue();if(Tt&&!(this.#e&&this.#e.packed)){if(Qe.pointerType==="touch"&&!(this.#g&&this.#g.busy)&&(this.#Y.set(Number(Qe.pointerId)||0,this.#D(Qe)),this.#Y.size===2)){this.#V=null,this.#xe={distance:no(this.#Y)};return}!Tt.pan||Ie()||!this.#h.x&&!this.#h.y||(this.#V={at:this.#D(Qe),moved:!1})}},Wt=Qe=>{if(Qe.pointerType==="touch"&&this.#Y.has(Number(Qe.pointerId)||0)&&(this.#Y.set(Number(Qe.pointerId)||0,this.#D(Qe)),this.#xe&&this.#Y.size>=2)){const vn=no(this.#Y),dn=this.#xe.distance;dn>0&&vn>0&&vn!==dn&&(this.#xe.distance=vn,this.#ke=!0,this.#En(dn/vn,"pinch",this.#_t(Ms(this.#Y)))),Qe.preventDefault&&Qe.preventDefault();return}if(!this.#V)return;const Tt=this.#e&&this.#e.plot||null;if(!Tt)return;const ht=this.#D(Qe),at=ht.x-this.#V.at.x,$t=ht.y-this.#V.at.y,_t=Tt.right-Tt.left||1,qt=Tt.bottom-Tt.top||1;if(!this.#V.moved&&Math.hypot(at,$t)<ns)return;this.#V.moved=!0,this.#ke=!0,this.#V.at=ht;const Nn=!!(this.#e&&this.#e.horizontal);this.#me((vn,dn,so)=>vn==="x"?Ye(dn,so,Nn?-$t/qt:-at/_t):Ye(dn,so,Nn?-at/_t:$t/qt),"pan"),Qe.preventDefault&&Qe.preventDefault()},Gt=Qe=>{this.#V=null,Qe&&Qe.pointerType==="touch"&&(this.#Y.delete(Number(Qe.pointerId)||0),this.#Y.size<2&&(this.#xe=null))},Ze=Qe=>{if(Ue()&&!(this.#e&&this.#e.packed)){if(Qe.key==="+"||Qe.key==="=")this.#ce("in","key");else if(Qe.key==="-"||Qe.key==="_")this.#ce("out","key");else if(Qe.key==="0"&&(this.#h.x||this.#h.y))this.#ce("reset","reset");else return;Qe.preventDefault&&Qe.preventDefault()}},an=Qe=>{Ue()&&(this.#e&&this.#e.packed||(this.#ce("reset","reset"),Qe.preventDefault&&Qe.preventDefault()))};this.#o.addEventListener("wheel",Ge,{passive:!1}),this.#o.addEventListener("pointerdown",gt),this.#o.addEventListener("pointermove",Wt),this.#o.addEventListener("pointerup",Gt),this.#o.addEventListener("pointerleave",Gt),this.#o.addEventListener("pointercancel",Gt),this.#o.addEventListener("keydown",Ze),this.#o.addEventListener("dblclick",an),this.#v.push(()=>{this.#o.removeEventListener("wheel",Ge),this.#o.removeEventListener("pointerdown",gt),this.#o.removeEventListener("pointermove",Wt),this.#o.removeEventListener("pointerup",Gt),this.#o.removeEventListener("pointerleave",Gt),this.#o.removeEventListener("pointercancel",Gt),this.#o.removeEventListener("keydown",Ze),this.#o.removeEventListener("dblclick",an)}),this.#v.push(Ao({svg:this.#o,overlay:this.#a.overlay,plot:()=>this.#e&&this.#e.plot||{left:0,top:0,right:0,bottom:0,height:0},pointOf:Qe=>this.#D(Qe),axis:()=>gr(this.#t).axis,horizontal:()=>!!(this.#e&&this.#e.horizontal),enabled:()=>!!gr(this.#t).mode&&!!(this.#e&&(this.#e.xScale||typeof this.#e.brushKeys=="function"))&&!(this.#g&&this.#g.busy),onBrush:(Qe,Tt)=>this.#tn(Qe,Tt)}));const ln=Qe=>{if(Qe.key!=="Escape")return;const Tt=this.#n&&this.#n.filters;if(!Tt||typeof Tt.get!="function")return;let ht=!1;for(const at of[kt,Et])bt(Tt.get(),this.#r,at)&&(this.#Ve(null,at),ht=!0);ht&&Qe.preventDefault&&Qe.preventDefault()};this.#o.addEventListener("keydown",ln),this.#v.push(()=>this.#o.removeEventListener("keydown",ln)),this.#o.setAttribute("tabindex","0"),this.#v.push(So({svg:this.#o,marks:()=>this.#Ee(),intercept:Qe=>this.#g&&this.#g.measureKey(Qe)||this.#X&&!!this.#y&&this.#y.key(Qe)||this.#Un(Qe),within:(Qe,Tt)=>this.#rn(Qe,Tt),onFocus:Qe=>this.#St(Qe),onActivate:Qe=>this.#on(Qe)})),this.#v.push(()=>{this.#o.removeEventListener("pointermove",c),this.#o.removeEventListener("pointerleave",S),this.#o.removeEventListener("click",Z),this.#o.removeEventListener("pointerdown",he),this.#o.removeEventListener("pointermove",fe),this.#o.removeEventListener("pointerup",ge),this.#o.removeEventListener("pointerleave",ge),this.#o.removeEventListener("wheel",Oe),this.#o.removeEventListener("keydown",Ee)})}#D(c){const S=this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():{left:0,top:0,width:xn.width,height:xn.height};return{x:(c.clientX||0)-S.left,y:(c.clientY||0)-S.top}}#ht(c){return ue({bound:{categories:this.#$e().categories},xScale:this.#e.xScale,at:this.#e.horizontal?c.y:c.x})}#$e(){const c=this.#e;return c&&Array.isArray(c.labels)&&Array.isArray(c.categories)?{labels:c.labels,categories:c.categories}:{labels:this.#u&&this.#u.labels||[],categories:this.#u&&this.#u.categories||[]}}#dt(c){if(!this.#e||!Array.isArray(this.#e.series))return null;if(this.#e.reduced)return B({series:this.#e.series,xScale:this.#e.xScale,at:this.#e.horizontal?c.y:c.x});const S=this.#Ht(c);if(S)return S;const Z=this.#ht(c);return Z<0?null:{index:Z,entries:this.#e.series.map(he=>({series:he,point:he.points[Z]})).filter(he=>he.point&&he.point.y!==null)}}#Ht(c){let S=null;for(const Z of this.#e.series){const he=Z&&Z.points||[];for(let fe=0;fe<he.length;fe++){const ge=he[fe];if(!ge||!(ge.markerHalf>0)||ge.y===null||ge.px===void 0)continue;const Oe=Math.abs(c.x-ge.px),Ee=Math.abs(c.y-ge.py);if(Oe>ge.markerHalf||Ee>ge.markerHalf)continue;const Ue=Oe*Oe+Ee*Ee;(!S||Ue<=S.distance)&&(S={distance:Ue,index:fe,series:Z,point:ge})}}return S?{index:S.index,entries:[{series:S.series,point:S.point}]}:null}#Be(c){return fn({drawn:this.#e,bound:this.#u,spec:this.#t,grid:this.#n,scheme:this.#G,at:c})}#Wt(c){if(this.#X&&this.#y&&this.#e&&this.#u){const Oe=this.#D(c);this.#y.pointer(c,Oe);const Ee=this.#He(Oe);Ee&&this.emit("hover",{...Ee,native:c});return}if(!this.#e||!this.#u||this.#t.tooltip===!1)return;const S=this.#D(c),Z=[];let he="";const fe=this.#Be(S);if(fe){this.#Ke(fe.heading,fe.rows,c),this.emit("hover",{...fe.datum,native:c});return}if(pn(this.#e)){this.#de();return}if(this.#e.arcs){const Oe=E({arcs:this.#e.arcs,x:S.x,y:S.y});if(!Oe){this.#de();return}he=Oe.label;const Ee=this.#u.root.total>0?Oe.total/this.#u.root.total:0;Z.push({label:this.#u.measure.title,value:`${l(Oe.total,this.#n.messages)} (${this.#n.messages.number(Ee,{style:"percent",maximumFractionDigits:1})})`,colour:this.#G.series(Oe.index)}),this.#u.radius&&Number.isFinite(Oe.rvalue)&&Z.push({label:this.#u.radius.title,value:l(Oe.rvalue,this.#n.messages),colour:this.#G.series(Oe.index)})}else{const Oe=this.#dt(S);if(!Oe){this.#de();return}he=this.#$e().labels[Oe.index]||"",Z.push(...this.#mt(Oe.entries,Oe.index))}if(!Z.length){this.#de();return}this.#Ke(he,Z,c);const ge=this.#He(S);ge&&this.emit("hover",{...ge,native:c})}#mt(c,S){const Z=this.#e.percent&&this.#e.percentTotals&&this.#e.percentTotals[S]||0,he=[];for(const fe of c)he.push({label:fe.series.label,value:this.#e.valueText?this.#e.valueText(fe.series,fe.point):this.#e.floating?this.#Ge(fe.point):Z?`${l(fe.point.y,this.#n.messages)} (${this.#n.messages.number(Math.abs(fe.point.y)/Z,{style:"percent",maximumFractionDigits:1})})`:l(fe.point.y,this.#n.messages),colour:this.#G.series(fe.series.index)});return he}#Ge(c){if(c.y0===null||c.y1===null)return l(c.y,this.#n.messages);const Z=(this.#e&&this.#e.valueKind)==="time"?he=>new Date(he).toISOString().slice(0,10):he=>l(he,this.#n.messages);return`${Z(c.y0)} → ${Z(c.y1)}`}#Ke(c,S,Z){const he=this.#s;if(Dn(this.#f),c){const fe=wt(he,"div",`${zt}__tooltip-row`),ge=wt(he,"strong");Lt(ge,c),fe.appendChild(ge),this.#f.appendChild(fe)}for(const fe of S){const ge=wt(he,"div",`${zt}__tooltip-row`),Oe=wt(he,"span",`${zt}__swatch`);Oe.setAttribute("style",`background:${Dr(fe.colour)}`);const Ee=wt(he,"span");Lt(Ee,fe.label);const Ue=wt(he,"span",`${zt}__tooltip-value`);Lt(Ue,fe.value),In(ge,[Oe,Ee,Ue]),this.#f.appendChild(ge)}this.#f.removeAttribute("hidden"),this.#Yt(Z),this.#Vt()}#Vt(){if(this.#oe.length||!this.#l||this.#f.parentNode===this.#l)return;const c=gn(this.#s);if(!c||typeof c.MutationObserver!="function")return;const S=()=>{this.#l.isConnected===!1&&(this.#Te(),this.#f.setAttribute("hidden",""),this.#f.parentNode&&this.#f.parentNode.removeChild(this.#f))},Z=[this.#s,this.#pt(),this.#t.tooltipHost&&this.#t.tooltipHost.ownerDocument].filter((he,fe,ge)=>he&&typeof he.nodeType=="number"&&ge.indexOf(he)===fe);for(const he of Z){const fe=new c.MutationObserver(S);fe.observe(he,{childList:!0,subtree:!0}),this.#oe.push(fe)}}#Te(){for(const c of this.#oe)c.disconnect();this.#oe=[]}#Yt(c){this.#gt();const S=gn(this.#s),Z=12,he=c&&c.clientX||0,fe=c&&c.clientY||0,ge=typeof this.#f.getBoundingClientRect=="function"?this.#f.getBoundingClientRect():{width:0,height:0},Oe=S.innerWidth||0,Ee=S.innerHeight||0;let Ue=he+Z;Oe&&Ue+ge.width>Oe-Z&&(Ue=he-Z-ge.width),Ue=Math.max(Z,Ue);let Ie=fe+Z;Ee&&Ie+ge.height>Ee-Z&&(Ie=fe-Z-ge.height),Ie=Math.max(Z,Ie),this.#f.style.left=`${Math.round(Ue)}px`,this.#f.style.top=`${Math.round(Ie)}px`}#gt(){const c=this.#f;if(!c)return;const S=this.#t.tooltipHost,Z=S&&typeof S.appendChild=="function"?S:this.#pt()||this.#s&&this.#s.body||this.#l;if(c.parentNode!==Z&&Z.appendChild(c),Z!==this.#l){c.classList.add("lattice");let he=null;for(let fe=this.#l;fe&&!he;fe=fe.parentNode||fe.host)typeof fe.getAttribute=="function"&&(he=fe.getAttribute("data-theme"));he?c.setAttribute("data-theme",he):c.removeAttribute("data-theme")}}#pt(){const c=this.#l;if(!c||typeof c.getRootNode!="function")return null;const S=c.getRootNode();return S&&S.nodeType===11&&S.host&&typeof S.appendChild=="function"?S:null}#de(){this.#f&&this.#f.setAttribute("hidden",""),this.#Te(),this.emit("leave",{})}#Zt(c){const S=Ur(this.#t);S&&!Cr.has(c)&&Ht(`chart:${this.#r}:cursor:type:${c}`,`"cursor" is a crosshair over a chart's own axes and ${JSON.stringify(c)} has none to put one on, so no cursor was added. The types that take one are ${[...Cr].sort().join(", ")}.`);const Z=this.#t.cursor;S&&Z&&typeof Z=="object"&&Z.groupTooltips!==void 0&&!jo.includes(Z.groupTooltips)&&Ht(`chart:${this.#r}:cursor:groupTooltips`,`"cursor.groupTooltips" is ${JSON.stringify(Z.groupTooltips)}, which is not 'pointer' or 'all', so 'pointer' was used: only the chart under the pointer shows its tooltip.`),S&&this.#t.multiples&&Ht(`chart:${this.#r}:cursor:multiples`,`"cursor" is not drawn on small multiples: each panel has its own plot and the set reads as one chart, so no cursor was added. Put a cursor on each panel's own chart instead.`);const he=this.#e;this.#X=!!(S&&Cr.has(c)&&!this.#t.multiples&&he&&he.xScale&&he.plot&&this.#u),this.#X&&!this.#y&&(this.#y=new No(this.#Jt())),this.#y&&this.#y.refresh(),this.#yt(this.#X&&S.rowHover)}#yt(c){if(!c){this.#te&&(this.#te(),this.#te=null);return}if(this.#te||this.#q)return;const S=this.#n.on("cell:mouseover",he=>{const fe=typeof this.#t.x=="string"?this.#t.x:null;!fe||!he||he.key===void 0||!this.#y||this.#y.set(this.#n.rows.value(he.key,fe),"row")}),Z=this.#n.on("cell:mouseout",()=>{this.#y&&this.#y.source==="row"&&this.#y.clear("row")});this.#te=()=>{S(),Z()}}#Jt(){return{doc:this.#s,svg:()=>this.#o,options:()=>this.#X?Ur(this.#t):null,drawn:()=>this.#e,series:()=>this.#bt(),size:()=>11,rows:(c,S,Z)=>{let he=c.entries;if(S==="single"&&Z!==null&&Z!==void 0&&he.length>1){const fe=this.#e;let ge=he[0],Oe=1/0;for(const Ee of he){const Ue=Ee.series.axis==="right"&&fe.rightScale?fe.rightScale:fe.yScale,Ie=Math.abs(Ue.of(Ee.point.y)-Z);Ie<Oe&&(Oe=Ie,ge=Ee)}he=[ge]}return{heading:c.label,rows:this.#mt(he,c.index),raw:he.map(fe=>fe.point.y)}},formatX:(c,S)=>this.#Xt(c,S),formatY:c=>this.#Ue(c,!1),formatY2:c=>this.#Ue(c,!0),showTooltip:(c,S,Z)=>{this.#t.tooltip!==!1&&this.#Ke(c,S,Z)},hideTooltip:()=>{this.#f&&this.#f.setAttribute("hidden",""),this.#Te()},moved:c=>this.emit("cursor:move",c),left:c=>this.emit("cursor:leave",c),announce:c=>this.#Qt(c),clientAt:(c,S)=>{const Z=this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():{left:0,top:0};return{clientX:Z.left+c,clientY:Z.top+S}},zoomX:c=>this.#qt(c)}}#bt(){const c=this.#e;if(!c||!Array.isArray(c.series))return[];const S=this.#t.type;return(S==="candlestick"||S==="ohlc")&&this.#u&&Array.isArray(this.#u.series)?[...this.#u.series.slice(0,4),...c.series.slice(1)]:c.series}#Xt(c,S){const Z=this.#e;if(!Z||Z.xScale.kind==="band"||S===null||S===void 0)return c.label;const he=this.#u,fe=he&&he.dimension&&he.dimension.col?this.#n.columns.get(he.dimension.col):void 0,ge=Z.xScale.domain,Oe=yr(this.#n,{kind:he.kind,span:ge.max-ge.min,step:(ge.max-ge.min)/5},fe),Ee=O(this.#t.axis);return w(Ee.x,{tick:Oe.value},this.#n,fe)(S)}#Ue(c,S){const Z=this.#e,fe=(S&&Z.rightScale?Z.rightScale:Z.yScale).domain,ge=yr(this.#n,{kind:"linear",step:fe?(fe.max-fe.min)/5:0}),Oe=O(this.#t.axis),Ee=w(S?Oe.y2:Oe.y,ge,this.#n)(c);return Z.percent&&!S&&!(Oe.y&&Oe.y.format)?`${Ee}%`:Ee}#Qt(c){if(!this.#Fe){const S=wt(this.#s,"div",`${zt}__cursor-live`);S.setAttribute("role","status"),S.setAttribute("aria-live","polite"),S.setAttribute("aria-atomic","true"),S.setAttribute("style","position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0"),this.#l.appendChild(S),this.#Fe=S}Lt(this.#Fe,c)}#qt(c){!this.#W||!c||(c.reset||!c.x?this.#me(()=>null,"group"):this.#Rt(c.x,"group"))}get cursor(){return this.#ze||(this.#ze=Object.freeze({set:c=>!this.#X||!this.#y?(Ht(`chart:${this.#r}:cursor:off`,"chart.cursor.set() was called on a chart with no cursor, so nothing moved. Set `cursor: true` on a cartesian chart before driving it."),!1):this.#y.set(c),clear:()=>{this.#y&&this.#y.clear()},get:()=>this.#y?this.#y.get():null})),this.#ze}#He(c){if(!this.#e||!this.#u)return null;const S=this.#Be(c);if(S)return S.datum;if(pn(this.#e))return null;if(this.#e.arcs){const Oe=E({arcs:this.#e.arcs,x:c.x,y:c.y});return Oe?{label:Oe.label,value:Oe.total,category:Oe.node.value,column:this.#t.x||null,series:null,depth:Oe.depth,path:Array.isArray(Oe.path)?[...Oe.path]:[Oe.label],rowKeys:Oe.node.rowKeys&&Oe.node.rowKeys.length?[...Oe.node.rowKeys]:Oe.node.rowKey?[Oe.node.rowKey]:[]}:null}const Z=this.#dt(c);if(!Z)return null;const he=Z.entries,fe=this.#$e(),ge=he.length===1&&he[0].point.from!==void 0?{from:he[0].point.from,to:he[0].point.to}:null;return{label:fe.labels[Z.index]||"",category:fe.categories[Z.index],column:this.#u.dimension.col,value:he.length===1?he[0].point.y:null,...ge||{},series:he.map(Oe=>({key:Oe.series.key,label:Oe.series.label,value:Oe.point.y,rows:Oe.point.rows})),rowKeys:he.map(Oe=>Oe.point.rowKey).filter(Boolean)}}#We(c,S=null,Z=null){if(!this.#e||!this.#u||this.#p&&this.#p.consumeClick()||this.#g&&this.#g.busy)return;if(this.#ke){this.#ke=!1;return}const he=c&&c.target&&c.target.getAttribute?c.target.getAttribute("data-crumb"):null;if(he!=null&&Array.isArray(this.#e.crumbs)){this.#Ft(Number(he));return}const fe=Z||this.#He(S||this.#D(c));if(!fe)return;let ge=!1;const Oe=this.emit("click",{...fe,native:c,preventDefault(){ge=!0}});if(ge||Oe.defaultPrevented)return;if(typeof this.#e.click=="function"){this.#e.click(fe,this.#t);return}if(Array.isArray(this.#e.hnodes)){const Ge=typeof this.#e.activate=="function"?this.#e.activate(fe):!1;if(Ge==="ignore")return;if(Ge&&typeof Ge=="object"&&Array.isArray(Ge.drill)){this.#A=[...this.#A||[],...Ge.drill],this.emit("drill",{path:[...this.#A],label:Ge.label}),this.draw();return}this.#t.selection&&Array.isArray(fe.rowKeys)&&fe.rowKeys.length&&this.#n.selection.set([...new Set(fe.rowKeys)]),Ge&&this.draw();return}if(this.#t.drill&&this.#u&&this.#u.root&&fe.label){const Ge=Array.isArray(fe.path)&&fe.path.length?fe.path:[fe.label];this.#A=[...this.#A||[],...Ge],this.emit("drill",{path:[...this.#A],label:fe.label}),this.draw();return}if(this.#t.selection&&Array.isArray(this.#e.markers)&&Array.isArray(fe.rowKeys)&&fe.rowKeys.length){this.#n.selection.set([...fe.rowKeys]);return}if(this.#t.selection&&(this.#t.type==="network"||Array.isArray(this.#e.items)||Array.isArray(this.#e.arcs)&&!this.#e.ribbons||Array.isArray(this.#e.tiles)||Array.isArray(this.#e.ribbons)&&this.#e.ring||Array.isArray(this.#e.links)&&Array.isArray(this.#e.nodes)&&!this.#e.series)&&Array.isArray(fe.rowKeys)&&fe.rowKeys.length){this.#n.selection.set([...new Set(fe.rowKeys)]);return}if(!this.#t.filterOnClick||!fe.column)return;const Ee=this.#n.filters,Ue=bt(Ee.get(),this.#r,Et),Ie=Ue&&Ue.col===fe.column&&Ue.op==="eq"&&oe(Ue.value)===oe(fe.category);this.#Ve(Ie?null:{col:fe.column,op:"eq",value:fe.category},Et)}#wt(){if(!this.#e)return;if(typeof this.#e.emphasise=="function"){this.#e.emphasise(new Set(this.#n.selection.keys()));return}if(Array.isArray(this.#e.markers)){this.#en();return}if(Array.isArray(this.#e.hnodes)){nn({drawn:this.#e,keys:new Set(this.#n.selection.keys())});return}if(Array.isArray(this.#e.links)&&Array.isArray(this.#e.nodes)&&!this.#e.series){tr({drawn:this.#e,keys:new Set(this.#n.selection.keys())});return}if(Array.isArray(this.#e.ribbons)&&this.#e.ring&&!this.#e.series){Mt({marks:this.#a.marks,drawn:this.#e,keys:new Set(this.#n.selection.keys())});return}if(Array.isArray(this.#e.arcs)&&!this.#e.series){sn({marks:this.#a.marks,entries:this.#e.arcs,attribute:"data-arc",keys:new Set(this.#n.selection.keys())});return}if(Array.isArray(this.#e.tiles)&&!this.#e.series){sn({marks:this.#a.marks,entries:this.#e.tiles,attribute:"data-tile",keys:new Set(this.#n.selection.keys())});return}if(Array.isArray(this.#e.items)&&!this.#e.series){const he=new Set(this.#n.selection.keys());for(const fe of this.#e.items){const ge=fe&&fe.element;if(!ge||!ge.setAttribute)continue;const Oe=Array.isArray(fe.rowKeys)?fe.rowKeys:[];he.size&&!Oe.some(Ee=>he.has(Ee))?ge.setAttribute("data-dim","true"):ge.removeAttribute("data-dim")}return}if(!this.#e.series)return;const c=this.#n.selection.keys(),S=this.#u&&this.#u.dimension&&this.#u.dimension.col,Z=new Set;if(S)for(const he of c)Z.add(oe(this.#n.rows.value(he,S)));vo({groups:this.#a,series:this.#e.series,keys:new Set(c),categories:Z})}#en(){const c=new Set(this.#n.selection.keys());for(const S of this.#e.markers){const Z=S.element;!Z||!Z.setAttribute||(c.size&&!c.has(S.rowKey)?Z.setAttribute("data-dim","true"):Z.removeAttribute("data-dim"))}}#tn(c,S){const Z=gr(this.#t),he=Z.mode;if(he&&this.#e&&typeof this.#e.brushKeys=="function"&&this.#u){this.#nn(he,c,S);return}if(!he||!this.#e||!this.#e.xScale||!this.#u)return;const fe=Mo({bound:this.#u,xScale:this.#e.xScale,yScale:this.#e.yScale,rightScale:this.#e.rightScale||null,axis:Z.axis,from:c,to:S});let ge=!1;const Oe=this.emit("brush",{mode:he,kind:fe.kind,values:fe.values,range:fe.range,axis:fe.axis,column:fe.axis==="y"||fe.axis==="y2"?(this.#kt(fe.axis)||{}).col||null:this.#u.dimension.col,preventDefault(){ge=!0}});if(ge||Oe.defaultPrevented)return;if(he==="zoom"){if(fe.range){const gt=fe.axis==="y2"?"y2":fe.axis==="y"?"y":"x";this.#Z={...this.#Z,axis:{...this.#Z.axis||{},[gt]:{...(this.#Z.axis||{})[gt]||{},min:Math.min(fe.range[0],fe.range[1]),max:Math.max(fe.range[0],fe.range[1])}}},this.#Ce(!0),this.draw()}return}if(he==="select"){const gt=[];for(const Wt of this.#e.series||[])for(const Gt of Wt.points){if(!Gt.rowKey)continue;(fe.kind!=="set"||fe.values.some(an=>oe(an)===Gt.xKey))&>.push(Gt.rowKey)}this.#n.selection.set([...new Set(gt)]);return}const Ee=fe.axis==="y"||fe.axis==="y2",Ue=Ee?this.#kt(fe.axis):null;if(Ee&&Ue&&Ue.refused){Ue.refused==="aggregate"?Ht(`chart:${this.#r}:brush:aggregate`,`a brush on the ${fe.axis} axis would filter rows by "${Ue.cols[0]}", but the marks on that axis are totals over several rows (or counts), and a range of totals says nothing about which rows lie in it, so no filter was written. Brush the x axis, or chart one row per mark.`):Ht(`chart:${this.#r}:brush:measures`,`a brush on the ${fe.axis} axis filters the measure behind it, and this chart has ${Ue.cols.length} measure column(s) there (${Ue.cols.join(", ")}), so no filter was written. Brush an axis that carries one measure.`);return}const Ie=Ee?Ue&&Ue.col:this.#u.dimension.col,Ge=Kr(Ee?{column:Ie,result:fe,kind:"linear"}:{column:Ie,result:fe,kind:this.#u.kind});Ge&&fe.kind!=="set"&&this.#u.kind==="time"&&this.#xt(Ie)&&(Ge.value=Ge.value.map(gt=>tn(gt.getTime()))),this.#Ve(Ge,kt)}#kt(c){const S=this.#u;if(!S)return null;const Z=c==="y2"?"right":"left",he=Array.isArray(this.#t.measures)&&this.#t.measures.length?this.#t.measures.map(Ge=>typeof Ge=="string"?{col:Ge}:Ge):null,fe=he?he.filter(Ge=>(Ge.axis==="right"?"right":"left")===Z).map(Ge=>({col:Ge.col,fn:Ge.fn||Ns(S,Ge.col)})):Z==="left"&&S.measure&&S.measure.col?[{col:S.measure.col,fn:S.measure.fn||"sum"}]:[],ge=[...new Set(fe.map(Ge=>Ge.col).filter(Boolean))];if(ge.length!==1)return{col:null,refused:"measures",cols:ge};const Oe=new Set(he?ge:[]),Ue=(S.series||[]).filter(Ge=>he?Oe.has(Ge.key)&&(Ge.axis==="right"?"right":"left")===Z:!0).some(Ge=>(Ge.points||[]).some(gt=>gt&>.y!==null&>.rows>1)),Ie=fe.some(Ge=>!Os.has(String(Ge.fn||"sum")));return Ue||Ie?{col:null,refused:"aggregate",cols:ge}:{col:ge[0]}}#xt(c){const S=this.#n&&this.#n.columns,Z=c&&S&&typeof S.get=="function"?S.get(c):null;return!!(Z&&Z.type==="datetime")}#Ve(c,S){const Z=this.#n&&this.#n.filters;if(!Z||typeof Z.get!="function"||typeof Z.set!="function")return;const he=Z.get(),fe=c?{...c,meta:{...c.meta||{},owner:S,chart:this.#r}}:null;!fe&&Dt(he,this.#r,S)===he||Z.set(Nt(he,this.#r,fe?[fe]:[],S))}#nn(c,S,Z){if(c!=="select"){Ht(`chart:${this.#r}:brush:polar:${c}`,`a ${this.#t.type} chart can only brush to a selection, and brush: ${JSON.stringify(c)} was set, so the drag did nothing. Set brush: 'select' to select the rows inside the dragged band in the grid.`);return}const he=this.#e.brushKeys(S,Z);let fe=!1;const ge=this.emit("brush",{mode:c,kind:"set",values:[],range:[Math.min(S,Z),Math.max(S,Z)],axis:"x",column:null,rowKeys:he,preventDefault(){fe=!0}});fe||ge.defaultPrevented||this.#n.selection.set([...new Set(he)])}#Ee(){return[...this.#a.marks.childNodes||[]].filter(c=>c.setAttribute&&!(c.getAttribute&&c.getAttribute("data-decor")))}#vt(c){const S=this.#e&&this.#e.items;return Array.isArray(S)&&S.find(Z=>Z&&Z.element===c)||null}#At(c){if(!c||!c.getAttribute||!this.#e||!Array.isArray(this.#e.series)||this.#e.items||this.#e.hnodes||c.getAttribute("data-point")!==null&&c.getAttribute("data-point")!==void 0)return null;const S=c.getAttribute("data-series");if(S==null)return null;const Z=this.#e.series[Number(S)];return Z&&Array.isArray(Z.points)&&Z.points.length>1?Z:null}#rn(c,S){const Z=this.#Ee()[S],he=this.#At(Z);if(!he)return!1;const fe=he.points.length-1,ge=Ue=>he.points[Ue]&&he.points[Ue].y!==null&&he.points[Ue].y!==void 0;this.#I>fe&&(this.#I=fe);let Oe=this.#I;const Ee=(Ue,Ie)=>{for(let Ge=Ue;Ge>=0&&Ge<=fe;Ge+=Ie)if(ge(Ge))return Ge;return-1};switch(c.key){case"ArrowRight":Oe=Ee(this.#I<0?0:this.#I+1,1);break;case"ArrowLeft":Oe=Ee(this.#I<0?0:this.#I-1,-1);break;case"Home":Oe=Ee(0,1);break;case"End":Oe=Ee(fe,-1);break;default:return!1}return Oe<0&&(Oe=this.#I),Oe<0||(this.#I=Oe,Z.focus&&Z.focus(),this.#St(S)),!0}#St(c){const S=this.#Ee()[c];if(!S||!S.setAttribute)return;const Z=this.#vt(S);if(Z){S.setAttribute("role","img"),S.setAttribute("aria-label",`${Z.heading||Z.label}: ${(Z.rows||[]).map(Ee=>Ee.value).filter(Boolean).join(", ")}`),this.emit("focus",{label:Z.label||Z.heading,value:Z.value,index:c});return}const he=this.#e&&this.#e.series?this.#e.series[Number(S.getAttribute("data-series"))||0]:null,fe=this.#At(S)&&this.#I>=0,ge=he&&he.points[fe?Math.min(this.#I,he.points.length-1):Number(S.getAttribute("data-point"))||0],Oe=this.#Mt(S);if(Oe){S.setAttribute("role","img"),S.setAttribute("aria-label",`${Oe.heading}: ${Oe.rows.map(Ee=>Ee.value).filter(Boolean).join(", ")}`),this.emit("focus",{label:Oe.datum.label,value:Oe.datum.value,index:c});return}if(!ge){if(!S.getBoundingClientRect)return;const Ee=S.getBoundingClientRect(),Ue=this.#Be(this.#D({clientX:Ee.left+Ee.width/2,clientY:Ee.top+Ee.height/2}));if(!Ue)return;S.setAttribute("role","img"),S.setAttribute("aria-label",`${Ue.heading}: ${Ue.rows.map(Ie=>Ie.value).filter(Boolean).join(", ")}`),this.emit("focus",{label:Ue.datum.label,value:Ue.datum.value,index:c});return}S.setAttribute("role","img"),S.setAttribute("aria-label",`${ge.label}: ${this.#e.valueText?this.#e.valueText(he,ge):this.#e.floating?this.#Ge(ge):l(ge.y,this.#n.messages)}`),this.emit("focus",{label:ge.label,value:ge.y,index:c})}#on(c){const S=this.#Ee()[c];if(!S||!S.getBoundingClientRect)return;const Z=this.#vt(S);if(Z&&Z.at){this.#We(null,Z.at);return}const he=S.getBoundingClientRect(),fe=this.#Mt(S);this.#We({clientX:he.left+he.width/2,clientY:he.top+he.height/2},null,fe?fe.datum:null)}#Mt(c){if(!this.#e||!Array.isArray(this.#e.hnodes)||!c.getAttribute)return null;const S=c.getAttribute("data-hnode");if(S==null)return null;const Z=this.#e.hnodes[Number(S)];return Z?un(Z,{drawn:this.#e,bound:this.#u,grid:this.#n,scheme:this.#G,spec:this.#t}):null}#Ot(c){const S=c&&c.attribution||"";S?(Lt(this.#$,S),this.#$.removeAttribute("hidden")):this.#$.setAttribute("hidden","");const Z=c&&Number.isFinite(c.aspect)&&c.aspect>0?c.aspect:null;this.#o&&this.#o.style&&(Z?this.#o.style.setProperty("aspect-ratio",String(Z)):this.#o.style.removeProperty("aspect-ratio"))}#sn(){this.#d={zoom:1,offset:[0,0]},this.#P&&this.#P.refit&&(this.#P=null),this.#ae(),this.schedule()}#Ye(c){const S=this.#d.zoom*c;this.#d={...this.#d,zoom:Math.min(8,Math.max(1,S))},this.schedule()}#Ae(c,S){const Z=this.#e&&this.#e.scale||0;if(!Z)return;const[he,fe]=this.#d.offset;this.#d={...this.#d,offset:[he-c/Z,fe+S/Z]},this.schedule()}#in(c,S){const Z=cr(this.#t,c.column);if(!Z||Z.kind!=="geometry"){Z&&Ht(`chart:${this.#r}:viewportFilter:globe`,`a globe's "viewportFilter" writes the visible hemisphere as one condition on a geometry column, and this chart places its rows by "lon"/"lat", so no filter was written. Place the rows with geometry: '<column>' (or name viewportFilter: { column }).`),this.#ae();return}const he=this.#_;he&&(he.kind!==Z.kind||he.column!==Z.column)&&this.#ae(),this.#_=Z;const fe=this.#n&&this.#n.filters;if(!fe||typeof fe.get!="function"||typeof fe.set!="function")return;const[ge,Oe]=S.globe.centre,Ee=`${ge.toFixed(6)},${Oe.toFixed(6)}`;if(Ee===this.#pe)return;this.#pe=Ee;const Ue=gn(this.#s);Ue.clearTimeout&&Ue.clearTimeout(this.#L);const Ie=typeof Ue.setTimeout=="function"?Ue.setTimeout.bind(Ue):setTimeout;this.#L=Ie(()=>{this.#L=0;const Ge=fe.get(),gt=this.#n.messages&&typeof this.#n.messages.t=="function"?this.#n.messages.t("chart.viewportFilter.label"):void 0,Wt={col:Z.column,op:"withinDistance",value:[Number(ge.toFixed(6)),Number(Oe.toFixed(6)),Hn],...gt?{meta:{label:gt}}:{}};this.#N=[ge,Oe,0,0],fe.set(qn(Ge,Z,Wt))},c.debounce)}fitToSelection(){const c=this.#e&&this.#e.globe;if(!c||!this.#n||!this.#n.selection)return!1;const S=[];for(const ge of this.#n.selection.keys()){const Oe=c.positions.get(ge);Oe&&S.push(Oe)}const Z=Wn(S);if(!Z)return!1;const he=Array.isArray(this.#t.rotate)?this.#t.rotate:[0,0];let fe=(Z[0]-he[0])%360;return fe>180&&(fe-=360),fe<-180&&(fe+=360),this.#d={...this.#d,offset:[fe*Math.PI/180,(Z[1]-he[1])*Math.PI/180]},this.schedule(),!0}#ae(){const c=gn(this.#s);if(c.clearTimeout&&c.clearTimeout(this.#L),this.#L=0,this.#F=null,this.#pe="",!this.#N||!this.#_){this.#N=null;return}this.#N=null;const S=this.#n&&this.#n.filters;if(!S||typeof S.get!="function"||typeof S.set!="function")return;const Z=S.get(),he=Pn(Z,this.#_);he!==Z&&S.set(he)}#an(c){const S=Un(this.#t.viewportFilter),Z=this.#e;if(S.enabled&&Cn.has(c)&&Z&&Z.globe){this.#in(S,Z);return}const he=Cn.has(c)&&!!Z&&!!Z.anchor;if(!S.enabled||!he){this.#ae();return}const fe=cr(this.#t,S.column);if(!fe){this.#ae();return}const ge=this.#_;ge&&(ge.kind!==fe.kind||ge.column!==fe.column||ge.lon!==fe.lon||ge.lat!==fe.lat)&&this.#ae(),this.#_=fe;const Oe=this.#n&&this.#n.filters;if(!Oe||typeof Oe.get!="function"||typeof Oe.set!="function")return;const Ee=Oe.get(),Ue=lr(Ee,fe);if(Ue&&!Ln(Ue,this.#N)){this.#F={zoom:this.#d.zoom,offset:[...this.#d.offset]},this.#N=Ue,this.#ln(Ue);return}Ue||(this.#N=null);const[Ie,Ge]=this.#d.offset;if(this.#d.zoom===1&&Ie===0&&Ge===0){this.#F=null;return}const gt=this.#F;if(gt&&this.#d.zoom===gt.zoom&&Ie===gt.offset[0]&&Ge===gt.offset[1])return;const Wt=_n(Z.anchor,Z.plot);if(!Wt||Ln(Wt,this.#N)){this.#F={zoom:this.#d.zoom,offset:[Ie,Ge]};return}this.#F={zoom:this.#d.zoom,offset:[Ie,Ge]};const Gt=gn(this.#s);Gt.clearTimeout&&Gt.clearTimeout(this.#L);const Ze=typeof Gt.setTimeout=="function"?Gt.setTimeout.bind(Gt):setTimeout;this.#L=Ze(()=>{this.#L=0;const an=Oe.get(),ln=this.#n.messages&&typeof this.#n.messages.t=="function"?this.#n.messages.t("chart.viewportFilter.label"):void 0,Qe=qn(an,fe,vr(fe,Wt,ln));this.#N=Wt,Oe.set(Qe)},S.debounce)}#ln(c){const S=this.#e;if(!S||!S.anchor||!S.plot)return;const Z=_n(S.anchor,S.plot);if(this.#he&&this.#P&&!this.#t.shapes&&e(Z,c)){const[fe,ge,Oe,Ee]=c;this.#P={baseKey:this.#he.baseKey,rings:[[[fe,ge],[Oe,ge],[Oe,Ee],[fe,Ee]]],refit:!0},this.#d={zoom:1,offset:[0,0]},this.schedule();return}const he=Kn(Z,c,S.plot,{zoom:this.#d.zoom,offset:this.#d.offset,scale:S.scale});he&&(this.#d=he,this.schedule())}schedule(){if(this.#T||this.#q||this.#be)return;const c=gn(this.#s),S=typeof c.requestAnimationFrame=="function"?c.requestAnimationFrame.bind(c):Z=>setTimeout(Z,16);this.#be=S(()=>{this.#be=0,this.draw()})||1}draw(){if(this.#T)return;if(this.#q){Ht("chart:grid-destroyed","this chart was bound to a grid that has been destroyed, so it draws nothing. Point it at a replacement with chart.rebind(grid).");return}const c=this.#cn();let S=null;c.mode==="update"?S=this.#E.capture(this.#a,this.#Nt(this.#e)):this.#E.halt();const Z=this.#jt();if(!Z){this.#E.settle(),this.#Ze();return}const he=this.#ft(),fe=Math.round(he.width||xn.width),ge=Math.round(he.height||xn.height),Oe=fe!==Z.width||ge!==Z.height?this.#jt():Z;if(!Oe){this.#E.settle(),this.#Ze();return}this.#un(c,S,Oe),this.emit("draw",{chartType:Oe.chartType,categories:Oe.categories,empty:Oe.empty}),this.#Ze()}#Ze(){const c=this.#De;c&&(this.#De=null,this.emit("responsive",c))}#cn(){const c=uo(this.#t.animation,co(this.#i,this.#s&&this.#s.defaultView));c.problems.length&&Ht(`chart:${this.#r}:animation:invalid`,`${c.problems.join("; ")}. The default is used in its place.`);const S=this.#je;this.#je=!1;const Z=Oe=>({mode:null,reason:Oe,settings:c});if(!c.on)return Z("disabled");const he=this.#t.type,fe=sr.includes(he)?null:Tr(he);if(fe&&fe.animates)return Z("own-motion");const ge=dr(this.#s&&this.#s.defaultView);if(ge)return Z(ge);if(!this.#it||this.#at!==(sr.includes(he)||fe?he:"bar"))return c.entry?{mode:"entry",reason:"entry",settings:c}:Z("disabled");if(this.#lt>c.budget)return Z("budget");if(!S&&this.#E.running){const Oe=this.#E.remaining;if(Oe>0)return{mode:"update",reason:"update",settings:{...c,duration:Oe}}}return S?c.update?{mode:"update",reason:"update",settings:c}:Z("disabled"):Z("view-change")}#Nt(c){const S=new Map,Z=[c&&c.series,this.#u&&this.#u.series];for(const fe of Z)if(Array.isArray(fe))for(const ge of fe)ge&&ge.index!==void 0&&!S.has(Number(ge.index))&&S.set(Number(ge.index),ge);const he=c&&Array.isArray(c.arcs)?c.arcs:null;return{ident(fe){const ge=fe.getAttribute("data-arc");if(ge!==null&&he){const gt=he[Number(ge)];if(gt)return`arc:${(gt.path||[gt.label]).join("")}`}const Oe=fe.getAttribute("data-series");if(Oe===null)return null;const Ee=S.get(Number(Oe)),Ue=Ee?String(Ee.key??Ee.label??Oe):Oe,Ie=fe.getAttribute("data-point");if(Ie===null)return`s:${Ue}`;const Ge=Ee&&Ee.points?Ee.points[Number(Ie)]:null;return`s:${Ue}:${Ge?oe(Ge.x):Ie}`},arc(fe){const ge=fe.getAttribute("data-arc");if(ge===null||!he)return null;const Oe=he[Number(ge)];if(!Oe||!Oe.geometry)return null;const Ee=Oe.geometry;return{cx:Ee.cx,cy:Ee.cy,inner:Ee.inner,outer:Ee.outer,from:Oe.from,to:Oe.to,draw:Y}},sweepStart:he&&he.length?Math.min(...he.map(fe=>fe.from)):null}}#un(c,S,Z){const he=this.#a.marks&&this.#a.marks.childNodes?this.#a.marks.childNodes.length:0;this.#it=!0,this.#at=Z.chartType,this.#lt=he;let fe={animated:!1,reason:c.reason,marks:he};if(c.mode){const ge=this.#e||{},Oe=ge.plot||null,Ee=!!ge.horizontal||ds.has(Z.chartType);let Ue=null;const Ie=ge.yScale;if(Oe&&Ie&&typeof Ie.of=="function"&&hs.has(Z.chartType)){const gt=Ie.of(0);Number.isFinite(gt)&&(Ue=Ee?Math.max(Oe.left,Math.min(Oe.left+Oe.width,gt)):Math.max(Oe.top,Math.min(Oe.top+Oe.height,gt)))}const Ge=[...this.#o.childNodes||[]].find(gt=>String(gt.tagName||"").toLowerCase()==="defs")||null;fe=this.#E.play({groups:this.#a,before:S,describe:this.#Nt(ge),settings:c.settings,mode:c.mode,layout:{horizontal:Ee,base:Ue,plot:Oe,height:Z.height,defs:Ge}})}else this.#E.release();this.#ct={animated:fe.animated,reason:fe.reason,marks:he,budget:c.settings.budget}}#jt(){const c=this.#ft(),S=this.#e,Z=Math.round(c.width||xn.width),he=Math.round(c.height||xn.height),fe=sr.includes(this.#t.type)?null:Tr(this.#t.type),ge=sr.includes(this.#t.type)||fe?this.#t.type:"bar";Array.isArray(this.#t.x)&&Ht(`chart:${this.#r}:x:array`,`chart "x" expects one column id (a string) and was given an array [${this.#t.x.map(ht=>JSON.stringify(ht)).join(", ")}]. A chart takes one category column on "x". For a hierarchy, group the grid — grid.columns.group([...]) — and the hierarchical types (pie, donut, sunburst, treemap) read the grouping.`),this.#se&&this.#se.reset();const Oe=Mr(this.#t,{fills:this.#se});this.#G=Oe,this.#Pe=null;const Ee=O(this.#t.axis),Ue=this.#n.messages,Ie=Br(this.#t);this.#K=Ie;const Ge=Ie.small,gt=xo(this.#t);if(gt.show&&!Xr.has(ge)&&!(fe&&fe.labelled)&&!this.#Me){this.#Me=!0;const ht=this.#s&&this.#s.defaultView,at=ht&&ht.console||(typeof globalThis<"u"?globalThis.console:null);at&&typeof at.warn=="function"&&at.warn(`[lattice] a "${ge}" chart does not draw data labels; "labels" has no effect on it. Types that do: ${[...Xr].join(", ")}.`)}Fn(this.#o,{viewBox:`0 0 ${Z} ${he}`,width:Z,height:he});const Wt=os.has(ge)||!!(fe&&fe.hierarchical),Gt=this.#Fn(ge);if(Gt===Lr)return null;Gt&&Gt.over&&Ht(`chart:viewportCap:over:${this.#r}`,`this map's view holds ${Gt.over.count} matching rows, more than its viewportCap of ${Gt.over.cap}, and ${Gt.over.reason}, so it draws none of them. Zoom in, narrow the filter, or raise viewportCap.`);let Ze;if(fe&&ar({grid:this.#n,spec:this.#t,type:ge,id:this.#r}),Gt)Ze=Gt;else if(fe&&typeof fe.bind=="function"){if(Ze=fe.bind(this.#n,this.#t),t.has(ge)&&(Ze=this.#Bn(ge,Ze)),Ze&&Array.isArray(Ze.notices))for(const ht of Ze.notices)!ht||!ht.id||!ht.message||Ht(`chart:${this.#r}:notice:${ht.id}`,ht.message)}else if(Wt)Ze=i(this.#n,this.#t,{count:!!(fe&&fe.count)}),this.#A&&this.#A.length&&(Ze=As(Ze,this.#A));else if(ls.has(ge))Ze=T(this.#n,ge==="candlestick"||ge==="ohlc"?this.#hn():this.#t);else if(ge==="floatingBar"||ge==="horizontalFloatingBar")Ze=Re(this.#n,this.#t);else if(ge==="populationPyramid")Ze=Fe(this.#n,this.#t);else if(ge==="bullet")Ze=tt(this.#n,this.#t);else if((qr.has(ge)||fe&&fe.multiMeasure)&&Array.isArray(this.#t.measures)&&this.#t.measures.length)Ze=T(this.#n,this.#t);else if(ge==="rangeArea")Array.isArray(this.#t.measures)&&this.#t.measures.length>=2?Ze=T(this.#n,this.#t):(Ht(`chart:${this.#r}:rangearea:form`,"a rangeArea chart fills the band between two measures and was not given two. Write `measures: [low, high]` (low first, then high), with an optional third measure typed `line` for the centre: `measures: ['avg', 'peak', { col: 'mean', type: 'line' }]`. `y` and `y2` do not form a band, so this drew a plain area."),Ze=g(this.#n,this.#t));else if(cs.has(ge))Ze=x(this.#n,this.#t,ge==="network"?{perRow:!0,nodes:this.#t.nodes}:void 0);else if(us.has(ge)){const ht=j(this.#n);Ze={rows:ht,series:[],categories:[],labels:[],measure:{col:null,fn:"sum",title:""},dimension:{col:this.#t.label||null,title:""},empty:!ht.length}}else ge==="geomap"?Ze=g(this.#n,{...this.#t,x:this.#t.code||this.#t.x}):Array.isArray(this.#t.points)?Ze=h(this.#t):is.has(ge)?Ze=g(this.#n,as(this.#t)):Ze=g(this.#n,this.#t);ge==="waterfall"&&(Ze=P(Ze,this.#t.waterfall,Ue.t("chart.waterfallTotal")));const an=N(Ee&&Ee.x,Date.now());this.#u=Ze;const ln=ce(Ze,Ee&&Ee.x,ge,an);if(ln){const ht=typeof this.#t.x=="string"?` "${this.#t.x}"`:"",at=`${Math.round(f*1e3)/10}%`;Ht(`chart:${this.#r}:x:window:ahead`,`${ln.count} reading(s) on the x axis${ht} were not drawn: stamped up to ${ks(ln.lead)} ahead of this device's clock, which is more than the ${to(ln.limit)} (${at} of the ${to(ln.span)} rolling window) a reading may run ahead and still move the window. This is a producer whose clock is wrong, not a window that is too narrow: letting that reading carry the window would push every other producer's recent readings out of it, so it is left out instead. Correct the producer's clock (NTP), or stamp readings where they are received.`)}const Qe=v({grid:this.#n,spec:this.#t,type:ge,bound:Ze,axis:Ee,now:an,id:this.#r});if(!Qe.ok)return Qe.tell&&Ht(Qe.key,Qe.message),this.#yn(this.#t.emptyText||Ue.t("chart.empty")),null;if(Ze=L(Ze,Ee&&Ee.x,ge,an),Ze=this.#Nn(Ze,ge,Ee,an),this.#u=Ze,this.#O.setAttribute("hidden",""),this.#o.removeAttribute("hidden"),Q(this.#a,null),ge!=="candlestick"&&ge!=="ohlc"&&(vt(this.#a),this.#Je()),fe){const ht=fe.freeform?$({width:Z,height:he,fontSize:Ge,margin:this.#t.margin}):$({width:Z,height:he,fontSize:Ge,margin:this.#t.margin,titleSize:Ie.axisTitle,titles:{left:Ee.y.title,bottom:Ee.x.title,right:Ee.y2.title},yLabels:ir,xLabels:Ze.labels&&Ze.labels.length?Ze.labels:ir,rotated:!!(Ze.labels&&Ze.labels.length)});if(this.#e=fe.draw({doc:this.#s,groups:this.#a,plot:ht,bound:Ze,type:ge,grid:this.#n,fontSize:Ge,hidden:this.#b,scheme:Oe,axis:Ee,typography:Ie,labels:gt,spec:this.#t,geoView:{zoom:this.#d.zoom,offset:this.#d.offset},helpers:ts,redraw:()=>this.draw()})||{},this.#w(Array.isArray(this.#e.legend)?this.#e.legend:[],this.#$t(this.#e,Ze.measure&&Ze.measure.col)),Ze.over){const at=new de(this.#a.overlay),$t=at.next("text",`${zt}__geo-note`);Fn($t,{x:rr(ht.left),y:rr(ht.bottom),"text-anchor":"start"}),Lt($t,Ue.t("chart.viewportOverCap",{count:Ze.over.count,cap:Ze.over.cap})),at.finish()}this.#Gn(ge)}else if(ge==="treemap"){const ht=$({width:Z,height:he,fontSize:Ge,padding:2,margin:this.#t.margin});this.#e=Ce({scheme:Oe,groups:this.#a,plot:ht,tree:Ze,grid:this.#n,hidden:this.#b,fontSize:Ge,typography:Ie,labels:gt,fill:this.#t.fill});const at=this.#t.fill?Ir({fill:this.#t.fill,grid:this.#n},Oe):null;this.#w(Ze.root.children.map(($t,_t)=>({key:$t.label,label:$t.label,index:_t,...at?{colour:Fr(at,$t,Oe.series(_t))}:{}})))}else if(rs.has(ge)){const ht=$({width:Z,height:he,fontSize:Ge});this.#e=se({scheme:Oe,doc:this.#s,groups:this.#a,plot:ht,tree:Ze,type:ge,grid:this.#n,hidden:this.#b,fontSize:Ge,typography:Ie,labels:gt,centre:this.#t.centre,startAngle:this.#t.startAngle,endAngle:this.#t.endAngle,radius:this.#t.radius,fill:this.#t.fill});const at=this.#t.fill?Ir({fill:this.#t.fill,grid:this.#n},Oe):null,$t=this.#n.columns&&Ze.measure&&Ze.measure.col?this.#n.columns.get(Ze.measure.col):null;this.#w(Ze.root.children.map((_t,qt)=>({key:_t.label,label:_t.label,index:qt,value:k(_t.total,$t,this.#n),colour:Fr(at,_t,Oe.series(qt,_t.label))})))}else{const ht=fs.has(ge)?$({width:Z,height:he,fontSize:Ge,margin:this.#t.margin,yLabels:ge==="heatmap"?eo(ge,Ze,this.#n,this.#t):[],xLabels:ge==="heatmap"?Ze.labels:[],rotated:!0}):$({width:Z,height:he,fontSize:Ge,margin:this.#t.margin,titleSize:Ie.axisTitle,topGutter:ge==="capability"?je:0,ySide:ie[ge]&&!ie[ge].horizontal&&Ee.y.position==="right"?"right":"left",titles:ie[ge]&&ie[ge].horizontal||ge==="horizontalFloatingBar"||ge==="populationPyramid"||ge==="bullet"&&wr(ge,this.#t)?{left:Ee.x.title,bottom:Ee.y.title,right:Ee.y2.title}:ie[ge]&&Ee.y.position==="right"?{left:Ee.y2.title,bottom:Ee.x.title,right:Ee.y.title}:{left:Ee.y.title,bottom:Ee.x.title,right:Ee.y2.title},rightGutter:this.#gn(ge,Ze)?Math.round(Ge*3):0,yLabels:eo(ge,Ze,this.#n,this.#t),xLabels:wr(ge,this.#t)?gs(ge,this.#t)?ir:[]:ge==="gantt"?ir:Ze.labels,rotated:ge==="gantt"?!1:!wr(ge,this.#t)}),at={doc:this.#s,groups:this.#a,plot:ht,bound:Ze,type:ge,grid:this.#n,fontSize:Ge,hidden:this.#b,scheme:Oe,axis:Ee,typography:Ie,labels:gt,byRuleColour:!this.#t.series,fill:this.#t.fill,marker:this.#t.marker,redraw:()=>this.draw()};if(ge!=="geomap"&&this.#Ot(null),this.#t.multiples)this.#e=this.#mn(at),this.#w([]);else if(ge==="combo"||ge==="pareto")this.#e=xr({...at,pareto:ge==="pareto",stack:this.#t.stack,reference:this.#t.reference,annotations:this.#t.annotations,emphasis:this.#t.emphasis,seriesStyle:this.#t.seriesStyle,curve:this.#t.curve}),this.#w(this.#le(this.#e.series,Ze.measure&&Ze.measure.col));else if(ge==="floatingBar"||ge==="horizontalFloatingBar")this.#e=Te(at),this.#w(Ze.series.length>1?this.#le(Ze.series,Ze.measure&&Ze.measure.col):[]);else if(ge==="populationPyramid")this.#e=Be({...at,pyramid:this.#t.pyramid}),this.#w(this.#le(Ze.series,Ze.measure&&Ze.measure.col));else if(ge==="bullet")this.#e=Ke({...at,bullet:this.#t.bullet,min:this.#t.min,max:this.#t.max}),this.#w([]);else if(ge==="heatmap")this.#e=Bt({...at,diverging:this.#t.diverging}),this.#w([],this.#$t(this.#e,Ze.measure&&Ze.measure.col));else if(ge==="radar")this.#e=st(at),this.#w(this.#le(Ze.series,Ze.measure&&Ze.measure.col));else if(ge==="gauge")this.#e=rt({...at,min:this.#t.min,max:this.#t.max,target:this.#t.target,bands:this.#t.bands,needle:this.#t.needle,ticks:this.#t.ticks,centre:this.#t.centre}),this.#w(Array.isArray(this.#e.legend)?this.#e.legend:[]);else if(ge==="sankey")this.#e=ur(at),this.#w([]);else if(ge==="chord")this.#e=Vn({...at,directed:this.#t.directed}),this.#w([]);else if(ge==="network")this.#e=fr({...at,iterations:this.#t.iterations,icon:this.#t.icon,linkWidth:this.#t.linkWidth}),this.#w(Array.isArray(this.#e.legend)?this.#e.legend:[]);else if(ge==="stream")this.#e=It(at),this.#w(this.#le(Ze.series,Ze.measure&&Ze.measure.col));else if(ge==="marimekko")this.#e=At(at),this.#w(this.#le(Ze.series,Ze.measure&&Ze.measure.col));else if(ge==="violin")this.#e=on(at),this.#w([]);else if(ge==="gantt")this.#e=kn({...at,spec:this.#t,rows:Ze.rows||[]}),this.#w([]);else if(ge==="geomap")this.#e=jn({...at,shapes:this.#t.shapes,codeProperty:this.#t.codeProperty,diverging:this.#t.diverging,projection:this.#t.projection,projectionOptions:this.#t.projectionOptions,layer:this.#t.layer,graticule:this.#t.graticule,basemap:this.#t.basemap,zoom:this.#d.zoom,centreOffset:this.#d.offset}),this.#Tt(this.#e&&this.#e.ramp),this.#w([]),this.#Ot(this.#e);else if(ge==="correlogram")this.#e=Pt({...at,columns:this.#wn(),method:this.#t.method,values:this.#t.values}),this.#w([]);else if(ge==="forest")this.#e=J(at),this.#w([]);else if(ge==="funnel")this.#e=Ct(at),this.#w([]);else if(ge==="candlestick"||ge==="ohlc")this.#e=jt({...at,ohlc:ge==="ohlc",volume:this.#Je(),volumeHeight:this.#fn(),reference:this.#t.reference,annotations:this.#t.annotations}),this.#w([]);else if(ss.has(ge)){if(ge==="histogram")this.#e=te({...at,buckets:this.#t.buckets,curve:this.#t.curve});else if(ge==="movingRange")this.#e=ke(at);else if(ge==="control"||ge==="capability"){const $t=this.#t.y||this.#t.measure,_t=this.#n&&this.#n.statistics;this.#e=(ge==="capability"?be:Ae)({...at,capability:_t&&$t?_t.capability($t,{by:this.#t.x,baseline:this.#t.baseline,rules:this.#t.rules,confidence:this.#t.confidence,...this.#t.spec||{}}):null})}else ge==="qq"?this.#e=we(at):ge==="ecdf"?this.#e=Ne(at):ge==="lorenz"?this.#e=Me(at):this.#e=ye(at);this.#w([])}else{this.#e=ae({...at,fit:this.#t.fit,trend:this.#t.trend,band:this.#t.band,error:this.#t.error,dense:Oo({series:Ze.series,canvas:this.#t.canvas}),downsampleTo:this.#t.downsample,stack:this.#t.stack,mark:this.#t.mark,reference:this.#t.reference,annotations:this.#t.annotations,sizes:this.#pn(Ze),emphasis:this.#t.emphasis,seriesStyle:this.#t.seriesStyle,curve:this.#t.curve});const $t=Array.isArray(this.#e.legend)?this.#e.legend:null;this.#w($t||(Ze.series.length>1?this.#le(Ze.series,Ze.measure&&Ze.measure.col,_t=>Oe.series(_t.index,_t.label)):[]))}}const Tt=this.#e&&this.#e.errorBars;if(this.#t.error&&Tt&&Tt.marks&&!this.#ye&&(!Tt.drawn||Tt.singleSkipped)){this.#ye=!0;const ht=this.#s&&this.#s.defaultView,at=ht&&ht.console||(typeof globalThis<"u"?globalThis.console:null);if(at&&typeof at.warn=="function"){let $t;Tt.drawn?$t=`[lattice] error bars were requested but ${Tt.singleSkipped} of ${Tt.marks} marks have a single reading behind them, so their whiskers were not drawn; the other marks are shown. A bar with no whisker is easily read as the certain one: bind those categories to the readings they summarise, or supply a margin column with \`error: { of: "column" }\`.`:$t=Tt.single===Tt.marks?'[lattice] error bars were requested but every mark has a single reading behind it, so there is no spread to compute. A chart bound to a summary or derived grid sees one row per mark: bind it to the rows the summary was computed from, or supply a margin column with `error: { of: "column" }`.':"[lattice] error bars were requested but no mark had enough readings to compute an interval.",at.warn($t)}}return this.#Qe(S,this.#e),this.#qe(fe&&this.#e?this.#e.controls:null),this.#e&&(this.#e.plot=this.#e.plot||Ss(this.#e,Z,he)),this.#u&&(this.#u.outside=this.#e&&this.#e.outside||0),this.#t.selection&&this.#wt(),this.#Pt(),this.#An(ge,Ze,Wt),this.#On(ge),this.#an(ge),this.#$n(),this.#Ln(ge),this.#Zt(ge),this.#p.sync({drawn:this.#e,bound:Ze,spec:this.#t,type:ge}),this.#dn(Ee),{width:Z,height:he,chartType:ge,categories:Ze.categories||[],empty:!!Ze.empty}}#Je(){const c=this.#t.volume;if(c==null||c==="")return null;const S=this.#t.type;return S!=="candlestick"&&S!=="ohlc"?(Ht(`chart:${this.#r}:volume:type:${S}`,`"volume" adds a volume pane under a candlestick's (or an ohlc's) price pane, and this chart's type is ${JSON.stringify(S)}, so no volume pane was drawn. Set type: 'candlestick' or 'ohlc', or draw the volume as its own bar chart.`),null):typeof c!="string"||!this.#n.columns||!this.#n.columns.get(c)?(Ht(`chart:${this.#r}:volume:missing-column`,`"volume" names ${JSON.stringify(c)}, which is not a column of this grid, so the chart was drawn without a volume pane. Name the column that holds each period's traded volume by its id.`),null):c}#fn(){const c=this.#t.volumePane,S=c&&typeof c=="object"?c.height:void 0;return S===void 0?en:typeof S=="number"&&S>0&&S<1?S:(Ht(`chart:${this.#r}:volumePane:height`,`"volumePane.height" is the volume pane's share of the plot's height, a number above 0 and below 1, and was given ${JSON.stringify(S)}, so the default of ${en} was used.`),en)}#hn(){const c=this.#Je(),S=Array.isArray(this.#t.measures)?this.#t.measures:[];if(!c||S.length<4)return this.#t;const Z=fe=>typeof fe=="string"?fe:fe&&fe.col,he=S.slice(4).filter(fe=>Z(fe)!==c);return{...this.#t,measures:[...S.slice(0,4),{col:c,fn:"sum"},...he]}}#dn(c){const S=ve(c&&c.x),Z=S?Math.min(ys,Math.max(bs,Math.floor(S/4))):0;if(this.#T||!Z){this.#Xe();return}if(this.#fe&&this.#Ie===Z)return;this.#Xe(),this.#Ie=Z;const he=gn(this.#s),fe=he&&typeof he.setInterval=="function"?he.setInterval.bind(he):setInterval;this.#fe=fe(()=>{this.#T||this.#s&&this.#s.hidden||this.#l&&this.#l.isConnected===!1||this.schedule()},Z);const ge=this.#fe;ge&&typeof ge.unref=="function"&&ge.unref()}#Xe(){if(this.#fe===null)return;const c=gn(this.#s);(c&&typeof c.clearInterval=="function"?c.clearInterval.bind(c):clearInterval)(this.#fe),this.#fe=null,this.#Ie=0}#mn(c){const S=Xt(c.bound),Z=Qt({count:S.length,plot:c.plot}),he=[];for(const Ue of c.bound.series)for(const Ie of Ue.points)he.push(Ie.y);const fe=a(he,{zero:c.type!=="line"}),ge=new de(this.#a.overlay);Q(this.#a,c.plot);const Oe=new de(this.#a.marks);new de(this.#a.grid).finish(),new de(this.#a.axis).finish(),new de(this.#a.rules).finish();let Ee=null;for(let Ue=0;Ue<Z.length;Ue++){const Ie=Z[Ue],Ge=S[Ue],gt={left:Ie.x,top:Ie.y,width:Ie.width,height:Ie.height,right:Ie.x+Ie.width,bottom:Ie.y+Ie.height,gutter:{left:0,bottom:0}};Ee=ae({...c,plot:gt,bound:Ge.bound,domain:fe,pool:Oe,axes:!1});const Wt=ge.next("text",`${zt}__panel-title`);Fn(Wt,{x:rr(Ie.x),y:rr(Ie.y-4),"text-anchor":"start"}),Lt(Wt,Ge.label)}return Oe.finish(),ge.finish(),{...Ee||{},panels:Z,multiples:!0}}#gn(c,S){return c==="combo"||c==="pareto"?!0:!qr.has(c)||c==="horizontalBar"||c==="waterfall"?!1:!!(S&&Array.isArray(S.series)&&S.series.some(Z=>Z.axis==="right"&&!this.#b.has(Z.key)))}#pn(c){if(this.#t.type!=="bubble"||!this.#t.size)return null;const S=[];for(const he of c.series||[])for(const fe of he.points)typeof fe.size=="number"&&S.push(fe.size);const Z=Hr(S);return Z?y(Z,[3,Math.max(6,Math.min(28,this.#t.maxRadius||22))]):null}#Qe(c,S){!c||c===S||typeof c.dispose!="function"||S&&S.stateKey!==void 0&&S.stateKey===c.stateKey||c.dispose()}#qe(c){const S=this.#k;S&&S!==c&&S.parentNode&&S.parentNode.removeChild(S),this.#k=c||null,c&&!c.parentNode&&this.#o&&this.#o.parentNode&&this.#o.parentNode.insertBefore(c,this.#o.nextSibling)}#yn(c){this.#Pt(),Lt(this.#O,c),this.#O.removeAttribute("hidden"),this.#o.setAttribute("hidden","");for(const S of Object.values(this.#a))Dn(S);this.#p&&this.#p.clear(),Dn(this.#m),Dn(this.#c),this.#Qe(this.#e,null),this.#e=null,this.#qe(null)}#Pt(){const c=this.#n.licence;if(!!!(c&&typeof c.watermark=="function"&&c.watermark())){this.#U&&this.#U.parentNode&&this.#U.parentNode.removeChild(this.#U),this.#U=null;return}if(this.#U&&this.#U.parentNode)return;const Z=this.#s,he=wt(Z,"div",`${zt}__watermark`);he.setAttribute("role","note");const fe=wt(Z,"a",`${zt}__watermark-link`);fe.setAttribute("href","https://www.latticegrid.dev"),fe.setAttribute("target","_blank"),fe.setAttribute("rel","noopener noreferrer"),Lt(fe,this.#n.messages.t("licence.watermark")),he.appendChild(fe),this.#U=he,this.#l&&this.#l.appendChild(he)}#bn(){const c=this.#t.legend;if(c===!1)return{show:!1,position:"bottom",align:"start",shape:"square",maxItems:0,isolate:!1,values:!1,title:""};const S=c&&typeof c=="object"?c:{};return{show:!0,position:["top","bottom","left","right"].includes(S.position)?S.position:"bottom",align:["start","centre","center","end"].includes(S.align)?S.align:"start",shape:["square","circle","line"].includes(S.shape)?S.shape:"square",maxItems:Number.isFinite(S.maxItems)&&S.maxItems>0?Number(S.maxItems):0,isolate:!!S.isolate,values:!!S.values,title:typeof S.title=="string"?S.title:""}}#le(c,S,Z){const he=S&&this.#n.columns?this.#n.columns.get(S):null;return(c||[]).map(fe=>({key:fe.key,label:fe.label,index:fe.index,value:k(ps(fe),he,this.#n),...Z?{colour:Z(fe)}:{}}))}#wn(){const c=this.#t.columns;if(Array.isArray(c)&&c.length)return c.slice(0,Qr);const S=this.#n;return!S||!S.columns||typeof S.columns.visible!="function"?[]:S.columns.visible().filter(Z=>!Z.generated&&(Z.type==="number"||Z.type==="currency"||Z.type==="percent"||Z.type==="integer")).map(Z=>Z.id).slice(0,Qr)}#w(c,S=null){Dn(this.#m);const Z=this.#bn();if(Fn(this.#m,{"data-position":Z.position,"data-align":Z.align}),!Z.show||!c.length&&!S)return;const he=this.#s;if(S&&this.#m.appendChild(this.#kn(S,Z)),!c.length)return;const fe=Z.maxItems?c.slice(0,Z.maxItems):c;for(const ge of fe){const Oe=wt(he,"button",`${zt}__legend-item`);Oe.setAttribute("type","button");const Ee=!this.#b.has(ge.key);Oe.setAttribute("aria-pressed",Ee?"true":"false");const Ue=wt(he,"span",`${zt}__swatch ${zt}__swatch--${Z.shape}`);Ue.setAttribute("style",`background:${Dr(ge.colour||this.#G.series(ge.index))}`);const Ie=wt(he,"span");Gn(Ie,this.#K.small),Lt(Ie,Z.values&&ge.value?`${ge.label} ${ge.value}`:ge.label),In(Oe,[Ue,Ie]),Oe.addEventListener("click",()=>{this.#xn(ge,c,Z)}),this.#m.appendChild(Oe)}if(Z.maxItems&&c.length>fe.length){const ge=wt(he,"span",`${zt}__legend-more`);Gn(ge,this.#K.small),Lt(ge,this.#n.messages.t("chart.legendMore",{count:c.length-fe.length})),this.#m.appendChild(ge)}}#kn(c,S){const Z=this.#s,he=wt(Z,"div",`${zt}__legend-ramp`);if(S.title){const Ie=wt(Z,"span",`${zt}__legend-ramp-title`);Gn(Ie,this.#K.small),Lt(Ie,S.title),he.appendChild(Ie)}const fe=wt(Z,"span",`${zt}__legend-ramp-label`);Gn(fe,this.#K.small),Lt(fe,c.minLabel);const ge=wt(Z,"span",`${zt}__legend-ramp-bar`),Oe=S.position==="left"||S.position==="right";ge.setAttribute("style",`background:linear-gradient(${Oe?"to top":"to right"}, ${c.colours.join(",")})`),he.setAttribute("data-scale",c.scale||"linear");const Ee=Array.isArray(c.ticks)?c.ticks:[];Ee.length&&he.setAttribute("data-ticks",String(Ee.length));for(const Ie of Ee){const Ge=wt(Z,"span",`${zt}__legend-ramp-tick`);Gn(Ge,this.#K.small);const gt=Math.round(Math.min(1,Math.max(0,Ie.t))*1e3)/10;Ge.setAttribute("style",Oe?`bottom:${gt}%`:`left:${gt}%`),Ge.setAttribute("data-value",String(Ie.value)),Lt(Ge,Ie.label),ge.appendChild(Ge)}const Ue=wt(Z,"span",`${zt}__legend-ramp-label`);return Gn(Ue,this.#K.small),Lt(Ue,c.maxLabel),In(he,[fe,ge,Ue]),he}#$t(c,S){if(!c||typeof c.ramp!="function"||!c.domain)return null;const Z=c.ramp;this.#Tt(Z);const he=Z.scale==="log"||Z.scale==="quantile",{min:fe,max:ge}=he&&Z.domain?Z.domain:c.domain;if(!Number.isFinite(fe)||!Number.isFinite(ge))return null;const Oe=S&&this.#n.columns?this.#n.columns.get(S):null,Ee=[];if(Z.scale==="quantile"&&Z.classes>1)for(let Ie=0;Ie<Z.classes;Ie++){const Ge=Z.colourAt(Ie/(Z.classes-1)),gt=Math.round(Ie/Z.classes*1e3)/10,Wt=Math.round((Ie+1)/Z.classes*1e3)/10;Ee.push(`${Ge} ${gt}% ${Wt}%`)}else if(he)for(let Ie=0;Ie<6;Ie++)Ee.push(Z.colourAt(Ie/5));else for(let Ge=0;Ge<6;Ge++){const gt=Ge/5;Ee.push(Z(fe+(ge-fe)*gt))}const Ue=he&&Array.isArray(Z.ticks)?Z.ticks.map(Ie=>({t:Ie.t,value:Ie.value,label:k(Ie.value,Oe,this.#n)})):[];return{colours:Ee,minLabel:k(fe,Oe,this.#n),maxLabel:k(ge,Oe,this.#n),scale:Z.scale||"linear",ticks:Ue}}#Tt(c){typeof c!="function"||!c.scale||(this.#Pe={scale:c.scale,auto:!!c.auto,ratio:c.ratio||0},c.auto&&c.scale==="log"&&Do(`chart:${this.#r}:ramp:log`,`chart ${this.#t.type} is coloured on a log ramp scale: its values span ${Math.round(c.ratio).toLocaleString("en")}:1, past the 100:1 at which a linear ramp leaves all but the largest in its palest shade. Set ramp: { scale: "linear" } to keep it linear.`))}#xn(c,S,Z){if(Z.isolate){const he=S.filter(ge=>ge.key!==c.key),fe=he.every(ge=>this.#b.has(ge.key))&&!this.#b.has(c.key);if(this.#b.clear(),!fe)for(const ge of he)this.#b.add(ge.key)}else this.#b.has(c.key)?this.#b.delete(c.key):this.#b.add(c.key);this.emit("legend",{label:c.label,key:c.key,hidden:this.#b.has(c.key),hiddenKeys:[...this.#b]}),this.#je=!0,this.draw()}#vn(){const c=this.#n.messages,S=this.#C.viewport;return S?S.over?c.t("chart.viewportOverCap",{count:S.matched,cap:S.cap}):S.binned?c.t(S.computed==="client"?"chart.summaryClientDensity":"chart.summaryEngineDensity",{count:S.matched,cap:S.cap,cells:S.cells}):c.t("chart.summaryEngineViewport",{count:S.rows}):c.t("chart.summaryEngine")}#An(c,S,Z){const he=this.#n.messages,fe=S.measure&&S.measure.title||"",ge=S.dimension&&S.dimension.title||"",Oe=fe?ge&&!Z?"chart.summary":"chart.summaryShare":"chart.summaryType";let Ee=he.t(Oe,{type:Jr(he,c),measure:fe,dimension:ge});if(c==="gauge"&&this.#e&&typeof this.#e.reading=="string"){const ht=this.#e.fn==="mean"?"avg":this.#e.fn;Ee=he.t("chart.summaryGauge",{type:Jr(he,c),measure:fe,fn:he.t(`total.${ht}`),value:this.#e.reading})}const Ue=this.#C.source==="engine"||this.#C.viewport?this.#vn():"",Ie=Ue?`${Ee}. ${Ue}`:Ee;Fn(this.#o,{"aria-label":this.#e&&this.#e.level?`${Ie}: ${this.#e.level}`:Ie}),Dn(this.#c);const Ge=this.#s,gt=this.#e&&this.#e.table;if(gt&&Array.isArray(gt.head)&&Array.isArray(gt.rows)){this.#e.summary&&Fn(this.#o,{"aria-label":String(this.#e.summary)});const ht=wt(Ge,"table"),at=wt(Ge,"caption");Lt(at,he.t("chart.dataTable")),ht.appendChild(at);const $t=wt(Ge,"tr");for(const _t of gt.head){const qt=wt(Ge,"th");Lt(qt,String(_t)),$t.appendChild(qt)}ht.appendChild($t);for(const _t of gt.rows){const qt=wt(Ge,"tr");_t.forEach((Nn,vn)=>{const dn=wt(Ge,vn===0?"th":"td");Lt(dn,Nn==null?"":String(Nn)),qt.appendChild(dn)}),ht.appendChild(qt)}if(this.#c.appendChild(ht),gt.note){const _t=wt(Ge,"p",`${zt}__table-note`);Lt(_t,String(gt.note)),this.#c.appendChild(_t)}return}const Wt=wt(Ge,"table"),Gt=wt(Ge,"caption");Lt(Gt,he.t("chart.dataTable")),Wt.appendChild(Gt);const Ze=wt(Ge,"tr"),an=wt(Ge,"th");Lt(an,Z?"":ge),Ze.appendChild(an);const ln=[];if(this.#e&&Array.isArray(this.#e.hnodes)&&S.root){for(const at of this.#e.hnodes){if(at.hidden)continue;const $t=wt(Ge,"tr"),_t=wt(Ge,"th");Lt(_t,(at.path&&at.path.length?at.path:[at.label]).join(" › "));const qt=wt(Ge,"td");Lt(qt,l(at.node.total,he)),In($t,[_t,qt]),ln.push($t)}const ht=wt(Ge,"th");Lt(ht,fe),Ze.appendChild(ht)}else if(Z&&S.root){for(const at of S.root.children){const $t=wt(Ge,"tr"),_t=wt(Ge,"th");Lt(_t,at.label);const qt=wt(Ge,"td");Lt(qt,l(at.total,he)),In($t,[_t,qt]),ln.push($t)}const ht=wt(Ge,"th");Lt(ht,fe),Ze.appendChild(ht)}else if(Array.isArray(S.links)&&!(S.series&&S.series.length)){const ht=wt(Ge,"th");Lt(ht,fe),Ze.appendChild(ht);for(const at of S.links){const $t=wt(Ge,"tr"),_t=wt(Ge,"th");Lt(_t,`${at.source.label} → ${at.target.label}`);const qt=wt(Ge,"td");Lt(qt,l(at.value,he)),In($t,[_t,qt]),ln.push($t)}}else{const ht=this.#$e(),at=this.#e&&Array.isArray(this.#e.labels)&&Array.isArray(this.#e.series)&&Array.isArray(this.#e.categories)?this.#e.series:S.series||[];for(const $t of at){const _t=wt(Ge,"th");Lt(_t,$t.label),Ze.appendChild(_t)}for(let $t=0;$t<(ht.labels||[]).length;$t++){const _t=wt(Ge,"tr"),qt=wt(Ge,"th");Lt(qt,ht.labels[$t]),_t.appendChild(qt);for(const Nn of at){const vn=wt(Ge,"td"),dn=Nn.points[$t];Lt(vn,dn&&dn.y!==null?this.#e&&this.#e.valueText?this.#e.valueText(Nn,dn):S.floating?this.#Ge(dn):l(dn.y,he):""),_t.appendChild(vn)}ln.push(_t)}}Wt.appendChild(Ze);for(const ht of ln)Wt.appendChild(ht);this.#c.appendChild(Wt);const Qe=this.#e&&Number(this.#e.unplaced);if(Qe>0){const ht=wt(Ge,"p",`${zt}__table-note`);Lt(ht,he.t("chart.geoUnmatched",{count:Qe})),this.#c.appendChild(ht)}const Tt=this.#e&&this.#e.annotations;if(Array.isArray(Tt)&&Tt.length){const ht=wt(Ge,"ul",`${zt}__annotation-list`);for(const at of Tt){if(!at||!at.text)continue;const $t=wt(Ge,"li");Lt($t,at.text),ht.appendChild($t)}ht.childNodes&&ht.childNodes.length&&this.#c.appendChild(ht)}}#Sn(c){const S=this.#c;if(!S)return;const Z=c.join(`
|
|
414
|
+
`),he=this.#_e;if(he&&he.parentNode===S&&this.#rt===Z||(he&&he.parentNode&&he.parentNode.removeChild(he),this.#_e=null,this.#rt=Z,!c.length))return;const fe=S.ownerDocument,ge=wt(fe,"ul",`${zt}__drawn-list`);for(const Oe of c){const Ee=wt(fe,"li");Lt(Ee,Oe),ge.appendChild(Ee)}S.appendChild(ge),this.#_e=ge}on(c,S){return typeof S!="function"?()=>{}:(this.#B.has(c)||this.#B.set(c,new Set),this.#B.get(c).add(S),()=>{const Z=this.#B.get(c);Z&&Z.delete(S)})}emit(c,S){const Z={...S,type:c,chart:this,grid:this.#n},he=this.#t,fe=c.split(/[:\-_.]/).filter(Boolean).map(Ee=>`${Ee.charAt(0).toUpperCase()}${Ee.slice(1)}`).join(""),ge=[`on${c.charAt(0).toUpperCase()}${c.slice(1)}`,`on${fe}`].map(Ee=>he[Ee]).find(Ee=>typeof Ee=="function"),Oe=[...this.#B.get(c)||[]];typeof ge=="function"&&Oe.unshift(ge);for(const Ee of Oe)try{Ee(Z)}catch(Ue){const Ie=gn(this.#s);Ie.console&&typeof Ie.console.error=="function"&&Ie.console.error(`[lattice] a chart "${c}" listener threw`,Ue)}return Z}#Mn(){const c=this.#e;return c&&c.anchor&&Cn.has(this.#t.type)?{plot:c.plot,xScale:c.anchor.xScale,yScale:c.anchor.yScale}:c}#On(c){const S=qe(this.#t.annotate,typeof this.#t.measure=="string"?void 0:this.#t.measure),Z=S.enabled&&Cn.has(c)&&!!this.#e&&!this.#e.anchor;Z&&Ht(`chart:${this.#r}:annotate:projection`,`"annotate" anchors a drawing on a ${JSON.stringify(c)} in longitude and latitude, and this map is drawn through a projection with no written inverse, so no rail was added. Draw it through projection: 'mercator' or 'equirectangular' to annotate it.`);const he=S.enabled&&Er.has(c)&&!Z;if(S.enabled&&!Er.has(c)&&Ht(`chart:${this.#r}:annotate:type:${c}`,`"annotate" adds a drawing rail to a chart with two readable axes and ${JSON.stringify(c)} has none, so no rail was added. The types that take one are ${[...Er].sort().join(", ")}.`),!he){this.#g&&(this.#g.destroy(),this.#g=null);return}this.#g?this.#g.configure(S):(this.#g=new Le({doc:this.#s,root:this.#l,plot:this.#o,groups:this.#a,t:(fe,ge)=>this.#n.messages.t(fe,ge),drawn:()=>this.#Mn(),described:fe=>this.#Sn(fe),format:()=>this.#zn(),formatSide:fe=>ge=>this.#Ue(ge,fe),number:(fe,ge)=>this.#n.messages.number(fe,ge===void 0?{maximumSignificantDigits:4}:{maximumFractionDigits:ge}),series:()=>this.#bt(),bound:()=>this.#u,notify:(fe,ge,Oe)=>{const Ee=Oe?{item:ge,readout:Oe}:{item:ge};fe==="added"?this.emit("annotation:added",Ee):fe==="changed"?this.emit("annotation:changed",Ee):this.emit("annotation:removed",Ee)}},S),this.#R&&(this.#g.setItems(this.#R),this.#R=null)),this.#g.redraw()}#Nn(c,S,Z,he){const fe=pt(this.#t.zoom);if(this.#W=fe.enabled&&br.has(S),fe.enabled&&!br.has(S)&&Ht(`chart:${this.#r}:zoom:type:${S}`,`"zoom" narrows a chart's own axes and ${JSON.stringify(S)} has none to narrow, so no zoom was added. The types that take one are ${[...br].sort().join(", ")}.`),!this.#W)return this.#j={x:null,y:null},this.#h={x:null,y:null},this.#S=c.categories||[],this.#Ne={first:0,last:Math.max(0,this.#S.length-1)},c;this.#J=S==="heatmap"||xe(c,S,Z&&Z.x),this.#we=S==="heatmap",this.#we&&fe.axes!=="x"&&Ht(`chart:${this.#r}:zoom:heatmap:axes`,`a heatmap zooms its columns (the x axis) only; its rows are a band of series with no measure axis behind them, so zoom.axes ${JSON.stringify(fe.axes)} zoomed x alone. Leave zoom.axes at its default, x.`),this.#S=c.categories||[],this.#j.x=this.#J?this.#S.length>1?{min:0,max:this.#S.length-1}:null:W(c,S,Z&&Z.x,he),this.#Cn(c.kind),fe.axes==="y"&&!this.#we&&(this.#h.x=null),(fe.axes==="x"||this.#we)&&(this.#h.y=null),this.#jn(fe),this.#h.x=St(this.#h.x,this.#j.x),this.#h.y=St(this.#h.y,this.#j.y);let ge=c;const Oe=this.#h.x;if(this.#J){const{first:Ee,last:Ue}=et(Oe,this.#S.length);this.#Ne={first:Ee,last:Ue},Oe&&this.#ee.frozen?ge=Jt(ge,new Set(this.#S.slice(Ee,Ue+1).map(Ie=>oe(Ie)))):Oe&&(ge=Kt(ge,Ee,Ue))}else this.#Ne={first:0,last:Math.max(0,this.#S.length-1)},Oe&&(ge={...ge,xDomain:{min:Oe.from,max:Oe.to}});return this.#h.y&&(ge={...ge,yDomain:{min:this.#h.y.from,max:this.#h.y.to}}),ge}#jn(c){const S=this.#ue;if(!S)return;const Z={};for(const he of["x","y"]){if(!(he in S)||c.axes!=="xy"&&c.axes!==he)continue;if(!this.#j[he]){Z[he]=S[he];continue}this.#h[he]=this.#et(he,S[he])}this.#ue=Object.keys(Z).length?Z:null}#et(c,S){const Z=this.#j[c];if(!Z)return null;const he=Array.isArray(S)?S:S&&S.range;if(!Array.isArray(he)||he.length<2)return null;const fe=c==="x"&&this.#J?he.map(Oe=>this.#Pn(Oe)):he.map(Oe=>this.#u&&this.#u.kind==="time"&&c==="x"?Vr(Oe):Wr(Oe));if(fe.some(Oe=>Oe===null||!Number.isFinite(Oe)))return Ht("chart:zoom:range","a chart zoom range named a value this chart's axis does not have, so the zoom was left alone. An x range on a category axis names two categories; on a continuous or time axis it is two readings, and a measure range is two values."),null;const ge=nt(fe,Z);return ge&&S&&S.pinned?St({...ge,pinned:!0},Z):ge}#Pn(c){const S=oe(c);for(let Z=0;Z<this.#S.length;Z++)if(oe(this.#S[Z])===S)return Z;return null}#$n(){const c=pt(this.#t.zoom),S=this.#W&&c.enabled;if(this.#o.style&&S!==this.#ot&&(this.#o.style.touchAction=S?"none":"",this.#ot=S),!this.#W||c.buttons==="none")this.#tt();else{if(this.#H&&this.#H.buttons!==c.buttons&&this.#tt(),!this.#H){const Z=Je({doc:this.#s,t:fe=>this.#n.messages.t(fe),controls:[...yt],buttons:c.buttons,onPress:fe=>this.#ce(fe,"button")});this.#H={...Z,buttons:c.buttons};const he=this.#o.parentNode;he&&he.appendChild(Z.element)}this.#H.sync({zoomed:!!(this.#h.x||this.#h.y),narrowest:this.#Tn(c)})}if(this.#W&&!this.#we&&!this.#h.y){const Z=this.#e&&this.#e.yScale&&this.#e.yScale.domain;Z&&Number.isFinite(Z.min)&&Number.isFinite(Z.max)&&(this.#j.y={min:Z.min,max:Z.max},this.#ue&&"y"in this.#ue&&this.schedule())}}#Tn(c){for(const S of["x","y"]){const Z=this.#j[S],he=this.#h[S];if(!Z||!he)continue;const fe=Z.max-Z.min;if(fe>0&&he.to-he.from>fe*c.min*1.0001)return!1}return!!(this.#h.x||this.#h.y)}#tt(){this.#H&&this.#H.element.parentNode&&this.#H.element.parentNode.removeChild(this.#H.element),this.#H=null}#me(c,S){if(!this.#W)return!1;const Z=pt(this.#t.zoom);let he=!1;for(const fe of["x","y"]){if(Z.axes!=="xy"&&Z.axes!==fe)continue;const ge=this.#j[fe];if(!ge)continue;const Oe=St(c(fe,this.#h[fe],ge,Z),ge);ct(Oe,this.#h[fe])||(this.#h[fe]=Oe,he=!0)}return he?(this.#ee.moved=!0,this.draw(),this.emit("zoom",this.#Lt(S)),S!=="group"&&this.#y&&this.#y.zoomed(this.#h.x?{x:this.#Se("x")}:{reset:!0}),!0):!1}#ce(c,S,Z){return c==="reset"?this.#me(()=>null,"reset"):this.#me((he,fe,ge,Oe)=>{const Ee=Z&&Number.isFinite(Z[he])?Z[he]:null;return c==="in"?He(fe,ge,1-Oe.step,Ee,Oe.min):c==="out"?He(fe,ge,1/(1-Oe.step),Ee,Oe.min):he!=="x"?fe:Ye(fe,ge,c==="left"?-Oe.step:Oe.step)},S)}#En(c,S,Z){return!(c>0)||!Number.isFinite(c)?!1:this.#me((he,fe,ge,Oe)=>{const Ee=Z&&Number.isFinite(Z[he])?Z[he]:null;return He(fe,ge,c,Ee,Oe.min)},S)}#Cn(c){const S=this.#ee,Z=this.#n&&this.#n.filters;if(!Z||typeof Z.get!="function")return;const he=Rt(Z.get(),this.#r);he.x&&!S.frozen&&S.full&&(S.frozen=S.full),he.x&&S.frozen?this.#J?(this.#S=S.frozen.all,this.#j.x=this.#S.length>1?{min:0,max:this.#S.length-1}:null):this.#j.x=An(S.frozen.extent,this.#j.x):he.x||(S.frozen=null,S.full={extent:this.#j.x,all:this.#S});for(const fe of["x","y"]){const ge=S.written[fe],Oe=he[fe];if(Ft(ge)===Ft(Oe))continue;if(S.written[fe]=Oe,!Oe){this.#h[fe]&&(this.#h[fe]=null,S.reset=!0);continue}const Ee=fe==="x"?this.#J?"category":c:"linear",Ue=ut(Oe,Ee,this.#j[fe]),Ie=Ue?this.#et(fe,Ue):null;Ie&&!ct(Ie,this.#h[fe])&&(this.#h[fe]=Ie,S.reset=!0)}}#Et(c){return Ot.has(c)?(this.#u&&this.#u.series||[]).every(Z=>(Z.points||[]).every(he=>!he||!(he.rows>1))):!1}#Ct(c){const S=Un(this.#t.viewportFilter),Z=this.#u||{},he=S.column||Z.dimension&&Z.dimension.col||(typeof this.#t.x=="string"?this.#t.x:null),fe=ft({column:he,axis:"x",chart:this.#r,banded:this.#J,kind:Z.kind,view:this.#h.x,categories:this.#S,readings:this.#ee.frozen?[...this.#ee.frozen.all,...this.#S]:this.#S,wall:this.#xt(he)});let ge=null;return this.#h.y&&this.#Et(c)&&(ge=ft({column:Z.measure&&Z.measure.col||null,axis:"y",chart:this.#r,banded:!1,kind:"linear",view:this.#h.y})),{x:fe,y:ge}}#Ln(c){const S=Un(this.#t.viewportFilter),Z=this.#ee;if(Z.type=c,Z.reset&&(Z.reset=!1,this.emit("zoom",this.#Lt("filter")),this.#y&&this.#y.zoomed(this.#h.x?{x:this.#Se("x")}:{reset:!0})),!S.enabled||!br.has(c)){Z.moved=!1,this.#nt();return}if(!this.#W){Ht(`chart:${this.#r}:viewportFilter:zoom`,`"viewportFilter" on a ${c} chart filters the grid to the range the chart is zoomed to, and this chart has no zoom, so the grid was left alone. Set zoom: true as well.`),Z.moved=!1,this.#nt();return}this.#h.y&&!this.#Et(c)&&Ht(`chart:${this.#r}:viewportFilter:y`,`"viewportFilter" filtered the grid by the x range only: this ${c} chart's measure axis shows values combined over several rows at one x rather than any one row's value, so its y zoom narrows the picture but not the grid. A scatter or bubble with one row per point filters by y as well.`);const he=Z.moved;Z.moved=!1;const fe=this.#Ct(c),ge=gn(this.#s);if(Ft(fe.x)===Ft(Z.written.x)&&Ft(fe.y)===Ft(Z.written.y)){Z.timer&&ge.clearTimeout&&ge.clearTimeout(Z.timer),Z.timer=0;return}if(Z.timer&&!he)return;Z.timer&&ge.clearTimeout&&ge.clearTimeout(Z.timer);const Oe=typeof ge.setTimeout=="function"?ge.setTimeout.bind(ge):setTimeout;Z.timer=Oe(()=>{Z.timer=0,this.#T||this.#_n()},S.debounce)}#_n(){const c=this.#ee,S=this.#n&&this.#n.filters;if(!S||typeof S.get!="function"||typeof S.set!="function")return;const Z=this.#Ct(c.type);if(Ft(Z.x)===Ft(c.written.x)&&Ft(Z.y)===Ft(c.written.y))return;const he=S.get(),fe=Nt(he,this.#r,[Z.x,Z.y].filter(Boolean)),ge=c.frozen;Z.x&&!ge&&(c.frozen={extent:this.#j.x,all:this.#S}),c.written={x:Z.x,y:Z.y},S.set(fe);const Oe=Rt(S.get(),this.#r);(Ft(Oe.x)!==Ft(Z.x)||Ft(Oe.y)!==Ft(Z.y))&&(c.written={x:Oe.x,y:Oe.y},c.frozen=Oe.x?ge:null)}#nt(){const c=this.#ee,S=gn(this.#s);c.timer&&S.clearTimeout&&S.clearTimeout(c.timer),c.timer=0,c.frozen=null,c.written={x:null,y:null};const Z=this.#n&&this.#n.filters;if(!Z||typeof Z.get!="function"||typeof Z.set!="function")return;const he=Z.get(),fe=Dt(he,this.#r);fe!==he&&Z.set(fe)}#Lt(c){const S=pt(this.#t.zoom),Z={x:this.#Se("x"),reason:c};return(S.axes==="y"||S.axes==="xy")&&(Z.y=this.#Se("y")),Z}#Se(c){const S=this.#j[c];if(!S)return null;const Z=this.#h[c];if(c==="x"&&this.#J){const{first:he,last:fe}=et(Z,this.#S.length);return[this.#S[he],this.#S[fe]]}return Z?[Z.from,Z.to]:[S.min,S.max]}#_t(c){const S={x:null,y:null};if(!this.#e)return S;if(this.#J){const he=this.#ht(c);he>=0&&(S.x=this.#Ne.first+he)}else if(this.#e.xScale&&typeof this.#e.xScale.invert=="function"){const he=this.#e.xScale.invert(this.#e.horizontal?c.y:c.x);Number.isFinite(he)&&(S.x=he)}const Z=this.#e.yScale;if(Z&&typeof Z.invert=="function"){const he=Z.invert(this.#e.horizontal?c.x:c.y);Number.isFinite(he)&&(S.y=he)}return S}get zoom(){return this.#Re||(this.#Re=Object.freeze({set:c=>this.#Rt(c),reset:()=>this.#ce("reset","reset")})),this.#Re}#Rt(c,S="api"){if(!this.#W)return Ht(`chart:${this.#r}:zoom:off`,'chart.zoom.set() was called on a chart with no zoom, so nothing moved. Set `zoom: true` on a cartesian chart (or `zoom: { buttons: "none" }` to drive it from your own controls) before setting a range.'),!1;const Z=Array.isArray(c)?{x:c}:c||{};return this.#me((he,fe)=>he in Z?this.#et(he,Z[he]):fe,S)}#Rn(){const c={};for(const S of["x","y"]){const Z=this.#h[S];Z&&(c[S]={range:this.#Se(S),pinned:!!Z.pinned})}return Object.keys(c).length?c:null}#zn(){const c=this.#e&&this.#e.yScale&&this.#e.yScale.domain||null,S=c&&Number.isFinite(c.max)&&Number.isFinite(c.min)?(c.max-c.min)/5:0;return yr(this.#n,{kind:"linear",step:S}).tick}state(){const c={annotations:this.#g?this.#g.list():ot(this.#R).map(Xe)},S=this.#Rn();return S&&(c.zoom=S),c}setState(c){if(this.#g?this.#g.setItems(c):this.#R=c,!c||Array.isArray(c))return;const S=c.zoom;this.#ue=S&&typeof S=="object"?{...S}:null,this.#ue||(this.#h={x:null,y:null}),this.schedule()}data(){return this.#u}provenance(){const c=this.#C;return{source:c.source,asked:c.asked,reason:c.reason??null,refused:!!c.refused,pending:!!c.pending,measures:c.measures.map(S=>({...S})),animation:{...this.#ct},...c.viewport?{viewport:{...c.viewport,bbox:c.viewport.bbox?[...c.viewport.bbox]:null}}:{},...this.#Pe?{ramp:{...this.#Pe}}:{},...this.#e&&this.#e.provenance&&typeof this.#e.provenance=="object"?this.#e.provenance:{}}}#ge(c,S){this.#zt();const Z=S.asked!=="client"&&o(this.#n);return this.#C={source:"client",asked:S.asked,reason:S.reason,refused:S.refused,pending:!1,measures:A(D(this.#n,this.#t,c),"client",[],S.reason)},S.refused?Ht(`chart:aggregate:engine-refused:${this.#r}:${S.reason}`,`chart aggregate: 'engine' was refused: ${S.reason}. The chart reads the rows the grid has loaded instead; chart.provenance() reports the same reason.`):Z&&Ht(`chart:aggregate:window:${this.#r}:${S.reason}`,`this chart draws the rows the grid has loaded, which are a window of the matching set, because ${S.reason}. Its figures describe that window, not the whole relation.`),this.#o?.removeAttribute?.("aria-busy"),null}#Fn(c){if(t.has(c))return this.#In(c);this.#he=null;const S=G(this.#n,this.#t,c);if(S.mode==="client")return this.#ge(c,S);const Z=this.#ie.answer(S.key);if(Z){if(Z.error!==void 0){const fe=Z.error&&Z.error.message?Z.error.message:String(Z.error);return this.#ge(c,{asked:S.asked,refused:S.asked==="engine",reason:`the engine request failed (${fe})`})}const he=Z.result||{};return he.client&&he.client.length?this.#ge(c,{asked:S.asked,refused:S.asked==="engine",reason:`the source computed "${he.client[0].fn}" client-side (${he.client[0].reason})`}):(this.#C={source:"engine",asked:S.asked,reason:null,refused:!1,pending:!1,measures:A(S.measures,"engine",he.engine||[])},this.#o?.removeAttribute?.("aria-busy"),F(this.#n,this.#t,S,he.groups||[]))}return this.#Kn(S),this.#C={...this.#C,asked:S.asked,pending:!0},this.#o&&this.#o.setAttribute("aria-busy","true"),Lr}#In(c){const S=s(this.#n,this.#t,c,this.#ve);if(S.mode==="client")return this.#he=null,this.#ge(c,S);this.#he=S;let Z=this.#ie.answer(S.key);const he=this.#ie.last();!Z&&he&&he.error===void 0&&he.result&&he.result.kind==="rows"&&he.result.rowsKey===S.rowsKey&&(Z=he);let fe=!1;if(!Z){this.#ie.ask(S.key,S.run,()=>{this.#T||this.schedule()});const Ee=this.#ie.last();if(!(Ee&&Ee.error===void 0&&Ee.result&&Ee.result.map))return this.#C={...this.#C,asked:S.asked,pending:!0},this.#o&&this.#o.setAttribute("aria-busy","true"),Lr;Z=Ee,fe=!0}if(Z.error!==void 0){const Ee=Z.error&&Z.error.message?Z.error.message:String(Z.error);return this.#ge(c,{asked:S.asked,refused:S.asked==="engine",reason:`the engine request failed (${Ee})`})}const ge=Z.result;if(ge.refused)return this.#ge(c,{asked:S.asked,refused:S.asked==="engine",reason:ge.refused});const Oe=this.#Dn(c,ge,S,fe);return this.#C={source:"engine",asked:S.asked,reason:null,refused:!1,pending:fe,measures:[],viewport:{rows:ge.kind==="rows"?ge.rows.length:0,matched:ge.count,cap:ge.cap,binned:ge.kind==="density",cells:ge.kind==="density"?ge.cells.length:0,over:ge.kind==="over"?ge.reason:null,bbox:ge.bbox?[...ge.bbox]:null,computed:"engine"}},this.#o&&(fe?this.#o.setAttribute("aria-busy","true"):this.#o.removeAttribute("aria-busy")),Oe}#Dn(c,S,Z,he){let fe;if(S.kind==="rows"){const Ie=Tr(c),Ge=C(this.#n,S.rows);fe=Ie&&typeof Ie.bind=="function"?Ie.bind(Ge,this.#t):{points:[],empty:!0}}else if(S.kind==="density"){const Ie=S.cells;fe={points:Ie.map(Ge=>({lon:(Ge.west+Ge.east)/2,lat:(Ge.south+Ge.north)/2})),features:[],unplaced:0,fromGeometry:!0,empty:Ie.length===0,density:{cells:Ie,size:S.size}}}else fe={points:[],features:[],unplaced:0,fromGeometry:!0,empty:!1,over:{count:S.count,cap:S.cap,reason:S.reason}};const[ge,Oe]=this.#d.offset,Ee=this.#d.zoom===1&&ge===0&&Oe===0,Ue=!!(this.#P&&this.#P.refit);if(Ee&&!he&&!Ue&&(!this.#P||this.#P.baseKey!==Z.baseKey)){const Ie=[...fe.points||[]];for(const gt of fe.features||[]){gt.point&&Ie.push({lon:gt.point[0],lat:gt.point[1]});for(const Wt of gt.polygons||[])for(const Gt of Wt)for(const[Ze,an]of Gt)Ie.push({lon:Ze,lat:an})}const Ge=(S.kind==="density"?z([],S.cells):z(Ie))||[[[-180,-85],[180,-85],[180,85],[-180,85]]];(!this.#P||q(d(this.#P.rings),d(Ge)))&&(this.#P={baseKey:Z.baseKey,rings:Ge})}return fe.frame=this.#P?this.#P.rings:null,fe}#Bn(c,S){const Z=S&&Array.isArray(S.points)?S.points.length:S&&Array.isArray(S.features)?S.features.length:0;this.#st=Z;const he=ne(c,S,this.#t,this.#ve);return he.viewport&&(this.#C={...this.#C,viewport:he.viewport},he.bound.over&&Ht(`chart:viewportCap:over:${this.#r}`,`this map's view holds ${he.bound.over.count} rows, more than its viewportCap of ${he.bound.over.cap}, and ${he.bound.over.reason}, so it draws none of them. Zoom in, narrow the filter, or raise viewportCap.`)),he.bound}#Gn(c){if(!t.has(c))return;const S=this.#e,Z=S&&S.plot,he=S&&S.anchor&&Z?_n(S.anchor,Z):null,[fe,ge]=this.#d.offset,Oe=this.#d.zoom===1&&fe===0&&ge===0,Ee=!!(this.#P&&this.#P.refit),Ue={bbox:Oe&&!Ee?null:he,span:he?he[2]-he[0]:360,width:Z?Z.right-Z.left:this.#ve.width},Ie=this.#ve;if(Ln(Ue.bbox,Ie.bbox)&&Math.abs(Ue.span-Ie.span)<1e-9&&Ue.width===Ie.width)return;this.#ve=Ue;const gt=p(this.#t);(this.#he||this.#st>gt)&&this.schedule()}#Kn(c){this.#ie.ask(c.key,S=>{const Z={...c.request,...S?{signal:S}:{}};return Promise.resolve(c.source.aggregate(Z,c.requested)).then(he=>({groups:he&&he.groups||[],engine:he&&he.engine||[],client:he&&he.client||[]}))},()=>{this.#T||this.schedule()})}#zt(){this.#ie.abort()}#Ft(c){const S=this.#A||[],Z=S.slice(0,Math.max(0,c));Z.length!==S.length&&(this.#A=Z,this.emit("drill",{path:[...Z],label:Z[Z.length-1]||null}),this.draw())}#Un(c){const S=this.#e&&this.#e.crumbs;return!Array.isArray(S)||S.length<2||c.key!=="Escape"&&c.key!=="Backspace"?!1:(c.preventDefault&&c.preventDefault(),this.#Ft(S[S.length-2].keep),!0)}ascend(c){if(!this.#A||!this.#A.length)return[];const S=Number.isFinite(c)&&c>0?Number(c):this.#A.length;return this.#A=this.#A.slice(0,Math.max(0,this.#A.length-S)),this.emit("drill",{path:[...this.#A],label:this.#A[this.#A.length-1]||null}),this.draw(),[...this.#A]}update(c){this.#Z={...this.#Z,...c},this.#Ce(!0),this.draw()}#Ce(c){c&&(this.#ne.rules=Bo(this.#Z.responsive));const{rules:S}=this.#ne;if(!S.length){const Ee=this.#ne.active.length>0;this.#ne.active=[],this.#t=this.#Z,Ee&&this.#It(S,[]);return}const Z=this.#i.getBoundingClientRect?this.#i.getBoundingClientRect():xn,he={width:Math.round(Z.width||0),height:Math.round(Z.height||0)},fe=this.#ne.active,ge=Go(S,he,fe),Oe=ge.length!==fe.length||ge.some((Ee,Ue)=>Ee!==fe[Ue]);!Oe&&!c||(this.#ne.active=ge,this.#t=Ko(this.#Z,S,ge),Oe&&this.#It(S,ge,he))}#It(c,S,Z){this.#De={active:Zr(c,S),width:Z?Z.width:void 0,height:Z?Z.height:void 0}}get responsive(){return Zr(this.#ne.rules,this.#ne.active)}rebind(c){if(!c)return this;if(this.#T)return this;if(c===this.#n&&!this.#q)return this;for(const S of this.#x)try{S()}catch{}if(this.#x=[],this.#te){try{this.#te()}catch{}this.#te=null}return this.#n=c,this.#q=!1,this.#ut(),this.draw(),this}get element(){return this.#l}toSVG(c){return this.#o?(this.#E&&this.#E.finish(),this.#p?this.#p.withoutHandles(()=>this.#Dt(c)):this.#Dt(c)):""}#Dt(c){const S=gn(this.#s);let Z=this.#o;return c&&c.inlineStyles&&S.getComputedStyle&&this.#o.cloneNode&&(Z=this.#o.cloneNode(!0),vs(this.#o,Z,S),Z.setAttribute("xmlns","http://www.w3.org/2000/svg")),typeof S.XMLSerializer=="function"?new S.XMLSerializer().serializeToString(Z):Z.outerHTML||""}async toPNG(c){const S=gn(this.#s);if(!this.#o||!S.Image||!this.#s.createElement)return null;const Z=c&&c.scale||S.devicePixelRatio||1,he=this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():xn,fe=Math.max(1,Math.round(he.width||xn.width)),ge=Math.max(1,Math.round(he.height||xn.height)),Oe=this.toSVG({inlineStyles:!0}),Ee=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Oe)}`,Ue=new S.Image;await new Promise((Wt,Gt)=>{Ue.onload=Wt,Ue.onerror=()=>Gt(new Error("the chart could not be rasterised")),Ue.src=Ee});const Ie=this.#s.createElement("canvas");Ie.width=Math.round(fe*Z),Ie.height=Math.round(ge*Z);const Ge=Ie.getContext("2d"),gt=c&&"background"in c?c.background:"#ffffff";return gt&&(Ge.fillStyle=gt,Ge.fillRect(0,0,Ie.width,Ie.height)),Ge.drawImage(Ue,0,0,Ie.width,Ie.height),new Promise(Wt=>Ie.toBlob(Wt,"image/png"))}toCSV(){const c=this.#u;if(!c)return"";const S=Oe=>{const Ee=Oe==null?"":String(Oe);return/[",\n]/.test(Ee)?`"${Ee.replace(/"/g,'""')}"`:Ee},Z=this.#e&&this.#e.table;if(Z&&Array.isArray(Z.head)&&Array.isArray(Z.rows))return[Z.head,...Z.rows].map(Oe=>Oe.map(S).join(",")).join(`
|
|
415
|
+
`);if(!(c.root||c.dimension&&Array.isArray(c.series)&&c.series.length))return this.#Hn(S);if(c.root){const Oe=[["Label",c.measure&&c.measure.title||"Value"].map(S).join(",")];for(const Ee of c.root.children)Oe.push([S(Ee.label),S(Ee.total)].join(","));return Oe.join(`
|
|
416
|
+
`)}const ge=[[c.dimension.title||"",...c.series.map(Oe=>Oe.label)].map(S).join(",")];for(let Oe=0;Oe<c.labels.length;Oe++){const Ee=[S(c.labels[Oe])];for(const Ue of c.series){const Ie=Ue.points[Oe];Ee.push(S(Ie&&Ie.y!==null?Ie.y:""))}ge.push(Ee.join(","))}return ge.join(`
|
|
417
|
+
`)}#Hn(c){const S=[],Z=this.#c&&this.#c.querySelector?this.#c.querySelector("table"):null;if(!Z)return"";for(const he of Z.querySelectorAll("tr")){const fe=[];for(const ge of he.childNodes||[]){const Oe=String(ge.tagName||"").toLowerCase();(Oe==="th"||Oe==="td")&&fe.push(c(ge.textContent))}fe.length&&S.push(fe.join(","))}return S.join(`
|
|
418
|
+
`)}destroy(){if(!this.#T){this.#T=!0,this.#Xe(),this.#E&&this.#E.finish(),this.#zt();for(const c of this.#x)try{c()}catch{}this.#x=[];for(const c of this.#v)c();this.#v=[],this.#re&&this.#re.disconnect(),this.#re=null,this.#g&&this.#g.destroy(),this.#g=null,this.#y&&this.#y.destroy(),this.#y=null,this.#X=!1,this.#yt(!1),this.#p&&this.#p.destroy(),this.#p=null,this.#tt(),this.#V=null,this.#ae(),this.#nt(),this.#Qe(this.#e,null),this.#qe(null),this.#i&&this.#i.__latticeChart===this&&(this.#i.__latticeChart=null),this.#l&&this.#l.parentNode&&this.#l.parentNode.removeChild(this.#l),this.#Te(),this.#f&&this.#f.parentNode&&this.#f.parentNode.removeChild(this.#f),this.#e=null,this.#u=null,this.#B.clear()}}}function oo(dt){if(!dt||!dt.grid)throw new Error("createChart needs a grid");const c=dt.grid.element?dt.grid.element.ownerDocument:globalThis.document,S=xs(c,dt.container);if(!S)throw new Error("createChart needs a container element");const{grid:Z,container:he,...fe}=dt,ge=new ro({grid:Z,container:S,spec:fe});return S.__latticeChart=ge,ge}function js(dt,c){if(!c||!c.container)return null;const S=$r(dt,c);if(!S.spec)return null;const{container:Z,range:he,...fe}=c,ge=[{provided:["x"],derivedKeys:["x"]},{provided:["y","measures"],derivedKeys:["y","measures"]},{provided:["series"],derivedKeys:["series"]}],Oe={...S.spec};for(const Ee of ge)if(Ee.provided.some(Ue=>Ue in fe))for(const Ue of Ee.derivedKeys)delete Oe[Ue];return oo({...fe,...Oe,grid:dt,container:Z})}function Ps(dt,c={}){return!!$r(dt,c).spec}});const mn=lo("packages/modules/charts/index.js"),Rs=mn.registerScheme,zs=mn.resolveScheme,Fs=mn.schemeNames,Is=mn.setDefaultScheme,Ds=mn.SCHEMES,Bs=mn.PALETTE,Gs=mn.registerChartType,Ks=mn.registeredChartTypes,Us=mn.TYPES,Hs=mn.Chart,Ws=mn.createChart,Vs=mn.deriveRangeSpec,Ys=mn.regressionPlots,Zs=mn.chartRange,Js=mn.canChartRange;export{Hs as Chart,Bs as PALETTE,Ds as SCHEMES,Us as TYPES,Js as canChartRange,Zs as chartRange,Ws as createChart,Vs as deriveRangeSpec,Gs as registerChartType,Rs as registerScheme,Ks as registeredChartTypes,Ys as regressionPlots,zs as resolveScheme,Fs as schemeNames,Is as setDefaultScheme};
|
|
419
419
|
|
|
420
420
|
//# sourceMappingURL=charts.esm.min.js.map
|