@toclocoinc/lattice-grid 1.71.0 → 1.71.1
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 +12 -0
- package/README.md +1 -1
- package/angular/package.json +1 -1
- package/docs/API.html +35 -11
- package/docs/api/adapters.html +1 -1
- package/docs/api/ai.html +1 -1
- package/docs/api/alarms.html +1 -1
- package/docs/api/charts.html +32 -8
- package/docs/api/data-router.html +1 -1
- package/docs/api/gantt.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/mock-socket.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 +23 -1
- package/lattice-grid.esm.min.js +3 -3
- package/lattice-grid.min.cjs +3 -3
- package/lattice-grid.min.js +3 -3
- package/modules/ai.d.ts +1 -1
- package/modules/ai.esm.min.js +2 -2
- package/modules/ai.min.cjs +2 -2
- package/modules/ai.min.js +2 -2
- package/modules/alarms.d.ts +1 -1
- package/modules/alarms.esm.min.js +2 -2
- package/modules/alarms.min.cjs +2 -2
- package/modules/alarms.min.js +2 -2
- package/modules/angular.d.ts +1 -1
- package/modules/angular.esm.min.js +2 -2
- package/modules/angular.min.cjs +2 -2
- package/modules/angular.min.js +2 -2
- package/modules/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-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-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-hexbin.d.ts +1 -1
- package/modules/chart-hexbin.esm.min.js +1 -1
- package/modules/chart-hexbin.min.cjs +1 -1
- package/modules/chart-hexbin.min.js +1 -1
- package/modules/chart-hexmap.d.ts +1 -1
- package/modules/chart-hexmap.esm.min.js +1 -1
- package/modules/chart-hexmap.min.cjs +1 -1
- package/modules/chart-hexmap.min.js +1 -1
- package/modules/chart-icicle.d.ts +1 -1
- package/modules/chart-icicle.esm.min.js +1 -1
- package/modules/chart-icicle.min.cjs +1 -1
- package/modules/chart-icicle.min.js +1 -1
- package/modules/chart-markermap.d.ts +1 -1
- package/modules/chart-markermap.esm.min.js +1 -1
- package/modules/chart-markermap.min.cjs +1 -1
- package/modules/chart-markermap.min.js +1 -1
- package/modules/chart-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-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-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-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-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/charts.d.ts +1 -1
- package/modules/charts.esm.min.js +133 -133
- package/modules/charts.esm.min.js.map +2 -2
- package/modules/charts.min.cjs +133 -133
- package/modules/charts.min.js +133 -133
- package/modules/charts.min.js.map +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/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 +8 -0
- package/modules/geo-europe-nuts.min.js +8 -0
- package/modules/geo-europe-nuts.min.js.map +6 -0
- package/modules/geo-uk.d.ts +1 -1
- package/modules/geo-uk.esm.min.js +1 -1
- package/modules/geo-uk.min.cjs +8 -0
- package/modules/geo-uk.min.js +8 -0
- package/modules/geo-uk.min.js.map +6 -0
- 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 +8 -0
- package/modules/geo-us-states.min.js +8 -0
- package/modules/geo-us-states.min.js.map +6 -0
- 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 +8 -0
- package/modules/geo-world-110m.min.js +8 -0
- package/modules/geo-world-110m.min.js.map +6 -0
- 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 +8 -0
- package/modules/geo-world-50m.min.js +8 -0
- package/modules/geo-world-50m.min.js.map +6 -0
- 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/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/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
package/modules/charts.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.71.
|
|
2
|
+
* Lattice Grid 1.71.1, charts module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
6
|
-
(function(
|
|
7
|
-
.${
|
|
6
|
+
(function(rn){"use strict";var sn=Object.create(null),an=Object.create(null);function Qe(s,K){sn[s]=K}function ln(s){var K=an[s];if(K)return K;var xe=Object.create(null);an[s]=xe;var W=sn[s];if(!W)throw new Error("[lattice] missing module: "+s);return W(xe,ln),xe}Qe("packages/modules/charts/svg.js",function(s,K){"use strict";Object.defineProperty(s,"SVG_NS",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(s,"el",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"svg",{enumerable:!0,get:function(){return v}}),Object.defineProperty(s,"attr",{enumerable:!0,get:function(){return de}}),Object.defineProperty(s,"attrs",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"setText",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"clear",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"append",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"path",{enumerable:!0,get:function(){return te}}),Object.defineProperty(s,"ribbonPath",{enumerable:!0,get:function(){return O}}),Object.defineProperty(s,"round",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"pathRings",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(s,"insideRings",{enumerable:!0,get:function(){return M}});const xe="http://www.w3.org/2000/svg";function W(k,F,J){const Z=k.createElement(F);return J&&Z.setAttribute("class",J),Z}function v(k,F,J){const Z=k.createElementNS(xe,F);if(J)for(const L of Object.keys(J))Z.setAttribute(L,String(J[L]));return Z}function de(k,F,J){k&&(J==null?k.removeAttribute(F):k.setAttribute(F,String(J)))}function ue(k,F){if(k)for(const J of Object.keys(F))de(k,J,F[J])}function V(k,F){k&&(k.textContent=F==null?"":String(F))}function Q(k){if(k)for(;k.firstChild;)k.removeChild(k.firstChild)}function G(k,F){for(const J of F)J&&k.appendChild(J);return k}function te(k){return k.join(" ")}function O(k){if(!k||k.length<2)return"";const F=["M",k[0].x,k[0].upper];for(let J=1;J<k.length;J++)F.push("L",k[J].x,k[J].upper);for(let J=k.length-1;J>=0;J--)F.push("L",k[J].x,k[J].lower);return F.push("Z"),te(F)}function c(k){return Math.round(k*100)/100}function Y(k){const F=[];let J=[];const Z=String(k||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let L="",ne=[];const N=()=>{if(!L||!ne.length){ne=[];return}if(L==="M"||L==="L")for(let X=0;X+1<ne.length;X+=2)J.push([ne[X],ne[X+1]]);else L!=="Z"&&ne.length>=2&&J.push([ne[ne.length-2],ne[ne.length-1]]);ne=[]};for(const X of Z){if(/[A-Za-z]/.test(X)){if(N(),X==="Z"||X==="z"){J.length>2&&F.push(J),J=[],L="";continue}X==="M"&&J.length>2&&(F.push(J),J=[]),L=X;continue}ne.push(Number(X))}return N(),J.length>2&&F.push(J),F}function M(k,F,J){let Z=!1;for(const L of k)for(let ne=0,N=L.length-1;ne<L.length;N=ne++){const[X,oe]=L[ne],[ee,_]=L[N];oe>J!=_>J&&F<(ee-X)*(J-oe)/(_-oe||1e-12)+X&&(Z=!Z)}return Z}}),Qe("packages/modules/charts/typography.js",function(s,K){"use strict";Object.defineProperty(s,"BASE_SIZE",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(s,"BASE_FAMILY",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"CHAR_RATIO",{enumerable:!0,get:function(){return v}}),Object.defineProperty(s,"resolveType",{enumerable:!0,get:function(){return de}}),Object.defineProperty(s,"textWidth",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"widestLabel",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"truncateTo",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"applySize",{enumerable:!0,get:function(){return te}});const xe=12,W="var(--lattice-font-family, system-ui, -apple-system, sans-serif)",v=.62;function de(O){const c=O&&O.font,Y=typeof c=="number"?{size:c}:c||{},M=ue(Y.size,xe);return{family:Y.family||W,size:M,small:ue(Y.small??Y.tickSize,Math.max(9,M-1)),title:ue(Y.title,Math.round(M*1.15)),axisTitle:ue(Y.axisTitle,Math.max(10,M-1)),weight:Y.weight||"inherit"}}function ue(O,c){const Y=Number(O);return Number.isFinite(Y)&&Y>0?Y:c}function V(O,c){return String(O??"").length*c*v}function Q(O,c){let Y=0;for(const M of O||[]){const k=V(M,c);k>Y&&(Y=k)}return Y}function G(O,c,Y){const M=String(O??""),k=Math.floor(c/(Y*v));return k<=0?"":M.length<=k?M:k===1?"…":`${M.slice(0,k-1)}…`}function te(O,c){!O||!Number.isFinite(c)||(O.style?O.style.fontSize=`${c}px`:O.setAttribute("style",`font-size:${c}px`))}}),Qe("packages/modules/charts/frame.js",function(s,K){"use strict";Object.defineProperty(s,"LABEL_GAP",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"LABEL_GUTTER_SHARE",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"resolveMargin",{enumerable:!0,get:function(){return te}}),Object.defineProperty(s,"plotRect",{enumerable:!0,get:function(){return O}}),Object.defineProperty(s,"shouldRotate",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"Pool",{enumerable:!0,get:function(){return Y}});const W=K("packages/modules/charts/svg.js").SVG_NS,v=K("packages/modules/charts/typography.js"),de=v.textWidth,ue=v.widestLabel,V=8,Q=6,G=.4;function te(M,k){const F=typeof M=="number"?M:k,J=M&&typeof M=="object"?M:{},Z=L=>Number.isFinite(L)&&L>=0?Number(L):F;return{base:F,top:Z(J.top),right:Z(J.right),bottom:Z(J.bottom),left:Z(J.left)}}function O(M){const k=te(M.margin,typeof M.padding=="number"?M.padding:8),F=k.base,J=M.fontSize||12,Z=M.yLabels||[],L=M.xLabels||[],ne=M.titles||{},N=M.titleSize||J,X=r=>r?N+Q:0,oe=ue(Z,J),ee=(Z.length?Math.min(M.width*G,k.left+oe+Q):Math.max(V,k.left))+X(ne.left),_=ue(L.map(r=>String(r).slice(0,14)),J),R=(L.length?M.rotated?Math.min(M.height*G,Q+_):J+Q+k.bottom:Math.max(V,k.bottom))+X(ne.bottom),ie=k.right+X(ne.right)+(M.rightGutter||0),I=k.top+(M.topGutter||0),P=Math.max(0,M.width-ee-ie),he=Math.max(0,M.height-I-R);return{left:ee,top:I,width:P,height:he,right:ee+P,bottom:I+he,gutter:{left:ee,bottom:R,right:ie,top:I}}}function c(M,k,F,J){if(!M.length||k<=0)return!1;const Z=Number.isFinite(J)&&J>0?Number(J):1;return ue(M,F)>k*Z-4}class Y{#l;#n=0;constructor(k){this.#l=k}next(k,F){const J=this.#l.childNodes[this.#n],Z=J&&J.tagName;if(Z&&String(Z).toLowerCase()===k.toLowerCase())return this.#n++,J;const L=this.#l.ownerDocument.createElementNS(W,k);return F&&L.setAttribute("class",F),J?this.#l.insertBefore(L,J):this.#l.appendChild(L),this.#n++,L}finish(){for(;this.#l.childNodes.length>this.#n;)this.#l.removeChild(this.#l.lastChild);this.#n=0}}}),Qe("packages/modules/charts/scheme.js",function(s,K){"use strict";Object.defineProperty(s,"PALETTE",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(s,"SCHEMES",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"registerScheme",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"setDefaultScheme",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"schemeNames",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"resolveScheme",{enumerable:!0,get:function(){return te}}),Object.defineProperty(s,"toRgb",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"rampStops",{enumerable:!0,get:function(){return Y}});const xe=Object.freeze(["#0072b2","#e69f00","#009e73","#cc79a7","#56b4e9","#d55e00","#7a5195","#6b7d8c"]),W=Object.freeze({default:{series:xe,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"}}),v=new Map;let de="default";function ue(M,k){!M||!k||v.set(String(M),k)}function V(M){if(typeof M=="string"){de=M;return}M&&typeof M=="object"&&(v.set("__default__",M),de="__default__")}function Q(){return[...Object.keys(W),...v.keys()].filter(M=>!M.startsWith("__"))}function G(M){return v.has(M)?v.get(M):W[M]||null}function te(M){const k=G(de)||W.default,F=M&&M.scheme,J=typeof F=="string"?G(F):F||null,Z=M&&Array.isArray(M.palette)&&M.palette.length?M.palette:null,L={...W.default,...k,...J||{}};Z&&(L.series=Z);const ne=!!(J||Z),N=L.series&&L.series.length?L.series:xe;return{...L,series:X=>O(N,X,ne),explicit:ne}}function O(M,k,F){const J=(k%M.length+M.length)%M.length;return F?M[J]:`var(--lattice-chart-${J+1}, ${M[J]})`}function c(M){if(typeof M!="string")return null;const k=M.trim(),F=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(k);if(F){const L=F[1];return L.length===3?[0,1,2].map(ne=>parseInt(L[ne]+L[ne],16)):[0,2,4].map(ne=>parseInt(L.slice(ne,ne+2),16))}const J=/^rgba?\(([^)]+)\)$/i.exec(k);if(!J)return null;const Z=J[1].split(/[\s,/]+/).filter(Boolean).slice(0,3).map(Number);return Z.length===3&&Z.every(L=>Number.isFinite(L))?Z:null}function Y(M,k){const F=k?M.diverging:M.sequential,J=k?W.default.diverging:W.default.sequential,Z=(Array.isArray(F)?F:J).map((L,ne)=>c(L)||c(J[ne])||[0,0,0]);return Z.length>=2?Z:J.map(L=>c(L))}}),Qe("packages/modules/charts/styles.js",function(s,K){"use strict";Object.defineProperty(s,"NS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(s,"seriesColour",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"css",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"injectStyles",{enumerable:!0,get:function(){return Q}});const W=K("packages/modules/charts/scheme.js").PALETTE,v="lat-chartview",de="data-lattice-chartview";function ue(G){const te=(G%W.length+W.length)%W.length;return`var(--lattice-chart-${te+1}, ${W[te]})`}function V(){return`
|
|
7
|
+
.${v}{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);
|
|
@@ -18,180 +18,180 @@
|
|
|
18
18
|
--lattice-chart-empty:var(--lattice-surface,#f7f8f9);
|
|
19
19
|
--lattice-chart-axis:var(--lattice-foreground-muted,#5b6670);
|
|
20
20
|
--lattice-chart-map-stroke:var(--lattice-border-color,#dfe3e6)}
|
|
21
|
-
.${
|
|
22
|
-
.${
|
|
23
|
-
.${
|
|
21
|
+
.${v}__figure{margin:0;display:flex;flex-direction:column;flex:1 1 auto;min-height:0}
|
|
22
|
+
.${v}__caption{padding:2px 4px 6px;display:flex;flex-direction:column;gap:2px}
|
|
23
|
+
.${v}__title{font-weight:var(--lattice-header-font-weight,600);
|
|
24
24
|
font-size:var(--lattice-font-size,13px)}
|
|
25
|
-
.${
|
|
25
|
+
.${v}__subtitle{color:var(--lattice-foreground-muted,#5b6670);
|
|
26
26
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
27
|
-
.${
|
|
27
|
+
.${v}__footnote{color:var(--lattice-foreground-muted,#5b6670);
|
|
28
28
|
font-size:var(--lattice-font-size-sm,11px);padding:2px 4px 4px}
|
|
29
29
|
/* A label outside its mark sits on the chart's background and takes the axis
|
|
30
30
|
colour; one inside sits on the series colour and needs the contrast the
|
|
31
31
|
background gives it. */
|
|
32
|
-
.${
|
|
33
|
-
.${
|
|
34
|
-
.${
|
|
32
|
+
.${v}__data-label{fill:var(--lattice-chart-axis);pointer-events:none}
|
|
33
|
+
.${v}__data-label[data-inside="true"]{fill:var(--lattice-background,#fff)}
|
|
34
|
+
.${v}__plot{flex:1 1 auto;min-height:0;display:block;width:100%;height:100%;overflow:visible}
|
|
35
35
|
/* The plot is hidden while the empty state is up; the author display:block
|
|
36
36
|
above would otherwise keep an empty frame painted behind the message — the
|
|
37
37
|
mirror of the placeholder's own trap (BACKLOG-0001023). */
|
|
38
|
-
.${
|
|
39
|
-
.${
|
|
40
|
-
.${
|
|
41
|
-
.${
|
|
38
|
+
.${v}__plot[hidden]{display:none}
|
|
39
|
+
.${v}__grid line{stroke:var(--lattice-chart-grid);stroke-width:1;shape-rendering:crispEdges}
|
|
40
|
+
.${v}__axis line{stroke:var(--lattice-chart-axis);stroke-width:1;shape-rendering:crispEdges}
|
|
41
|
+
.${v}__axis text{fill:var(--lattice-chart-axis);
|
|
42
42
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
43
|
-
.${
|
|
43
|
+
.${v}__axis-title{fill:var(--lattice-chart-axis);
|
|
44
44
|
font-size:var(--lattice-font-size-sm,11px);font-weight:600}
|
|
45
|
-
.${
|
|
46
|
-
.${
|
|
47
|
-
.${
|
|
48
|
-
.${
|
|
49
|
-
.${
|
|
50
|
-
.${
|
|
45
|
+
.${v}__line{fill:none;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
|
|
46
|
+
.${v}__area{stroke:none;opacity:0.18}
|
|
47
|
+
.${v}__bar,.${v}__slice{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
48
|
+
.${v}__point{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
49
|
+
.${v}__mark[data-dim]{opacity:0.18}
|
|
50
|
+
.${v}__brush{fill:var(--lattice-range-background,#e7f1fd);fill-opacity:0.5;
|
|
51
51
|
stroke:var(--lattice-range-border,#1a6bc7);stroke-width:1;pointer-events:none}
|
|
52
|
-
.${
|
|
53
|
-
.${
|
|
52
|
+
.${v}__plot:focus{outline:none}
|
|
53
|
+
.${v}__plot:focus-visible{outline:var(--lattice-focus-width,2px) solid var(--lattice-focus-color,#1a6bc7);
|
|
54
54
|
outline-offset:-2px}
|
|
55
|
-
.${
|
|
56
|
-
.${
|
|
55
|
+
.${v}__mark:focus{outline:none}
|
|
56
|
+
.${v}__mark:focus-visible{outline:var(--lattice-focus-width,2px) solid var(--lattice-focus-color,#1a6bc7);
|
|
57
57
|
outline-offset:1px}
|
|
58
|
-
.${
|
|
59
|
-
.${
|
|
60
|
-
.${
|
|
61
|
-
.${
|
|
62
|
-
.${
|
|
63
|
-
.${
|
|
64
|
-
.${
|
|
65
|
-
.${
|
|
66
|
-
.${
|
|
67
|
-
.${
|
|
68
|
-
.${
|
|
69
|
-
.${
|
|
70
|
-
.${
|
|
71
|
-
.${
|
|
72
|
-
.${
|
|
73
|
-
.${
|
|
74
|
-
.${
|
|
75
|
-
.${
|
|
76
|
-
.${
|
|
77
|
-
.${
|
|
78
|
-
.${
|
|
79
|
-
.${
|
|
80
|
-
.${
|
|
81
|
-
.${
|
|
82
|
-
.${
|
|
83
|
-
.${
|
|
58
|
+
.${v}__box{stroke-width:1}
|
|
59
|
+
.${v}__whisker{stroke-width:1;fill:none}
|
|
60
|
+
.${v}__density{stroke-width:1.5;fill:none;opacity:.85}
|
|
61
|
+
.${v}__fit{stroke-width:1.5;fill:none;opacity:.9}
|
|
62
|
+
.${v}__fit-label{font-weight:600;opacity:.9}
|
|
63
|
+
.${v}__trend{stroke-width:1.75;fill:none;opacity:.9}
|
|
64
|
+
.${v}__trend-forecast{stroke-width:1.75;fill:none;opacity:.9;stroke-dasharray:5 4}
|
|
65
|
+
.${v}__trend-label{font-weight:600;opacity:.9}
|
|
66
|
+
.${v}__trend-band{stroke:none;pointer-events:none}
|
|
67
|
+
.${v}__qq-line{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;stroke-dasharray:4 3;fill:none}
|
|
68
|
+
.${v}__ecdf{stroke-width:1.5;fill:none}
|
|
69
|
+
.${v}__control-line{stroke-width:1.25;fill:none}
|
|
70
|
+
.${v}__error-bar{stroke:var(--lattice-foreground,#1a1a1a);stroke-width:1.5;fill:none;stroke-linecap:round}
|
|
71
|
+
.${v}__control-centre{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;fill:none}
|
|
72
|
+
.${v}__control-limit{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;stroke-dasharray:6 3;fill:none}
|
|
73
|
+
.${v}__spec-limit{stroke:var(--lattice-danger,#a4262c);stroke-width:1;stroke-dasharray:2 3;fill:none}
|
|
74
|
+
.${v}__spec-target{stroke:var(--lattice-success,#107c41);stroke-width:1;stroke-dasharray:1 4;fill:none}
|
|
75
|
+
.${v}__control-name{fill:var(--lattice-foreground-muted,#5b6570);font-size:9px;letter-spacing:.04em}
|
|
76
|
+
.${v}__control-rule{fill:var(--lattice-danger,#a4262c);font-size:9px;font-weight:600}
|
|
77
|
+
.${v}__capability-within{stroke:var(--lattice-foreground,#1a1a1a);stroke-width:1.5;fill:none}
|
|
78
|
+
.${v}__capability-overall{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1.5;stroke-dasharray:4 3;fill:none}
|
|
79
|
+
.${v}__lorenz{stroke-width:1.75;fill:none}
|
|
80
|
+
.${v}__lorenz-equality{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;stroke-dasharray:4 3;fill:none}
|
|
81
|
+
.${v}__median{fill:none}
|
|
82
|
+
.${v}__tile{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
83
|
+
.${v}__tile-label{fill:var(--lattice-background,#fff);
|
|
84
84
|
font-size:var(--lattice-font-size-sm,11px);pointer-events:none}
|
|
85
|
-
.${
|
|
86
|
-
.${
|
|
87
|
-
.${
|
|
85
|
+
.${v}__tile-label--branch{fill:var(--lattice-foreground,#1d2733)}
|
|
86
|
+
.${v}__reference{stroke:var(--lattice-chart-axis);stroke-width:1}
|
|
87
|
+
.${v}__reference-label{fill:var(--lattice-chart-axis);
|
|
88
88
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
89
|
-
.${
|
|
90
|
-
.${
|
|
91
|
-
.${
|
|
92
|
-
.${
|
|
93
|
-
.${
|
|
94
|
-
.${
|
|
95
|
-
.${
|
|
89
|
+
.${v}__annotation-line{stroke:var(--lattice-chart-axis);stroke-width:1;stroke-dasharray:4 3;fill:none}
|
|
90
|
+
.${v}__annotation-target{stroke:var(--lattice-success,#107c41);stroke-width:1.5;stroke-dasharray:2 2;fill:none}
|
|
91
|
+
.${v}__annotation-band{stroke:none}
|
|
92
|
+
.${v}__annotation-point{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
93
|
+
.${v}__annotation-event{stroke:var(--lattice-chart-axis);stroke-width:1;fill:none}
|
|
94
|
+
.${v}__annotation-event-flag{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
95
|
+
.${v}__annotation-label{fill:var(--lattice-chart-axis);
|
|
96
96
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
97
|
-
.${
|
|
97
|
+
.${v}__annotation-list{list-style:none;margin:0;padding:0;
|
|
98
98
|
position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
|
|
99
|
-
.${
|
|
100
|
-
.${
|
|
101
|
-
.${
|
|
102
|
-
.${
|
|
99
|
+
.${v}__ribbon{stroke:none;fill-opacity:0.62}
|
|
100
|
+
.${v}__ribbon:hover{fill-opacity:0.85}
|
|
101
|
+
.${v}__node{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
102
|
+
.${v}__edge{stroke:var(--lattice-chart-grid);stroke-opacity:0.7}
|
|
103
103
|
/* A node's glyph, knocked out of its disc in the chart's own background colour
|
|
104
104
|
so it takes the theme rather than a colour written into the drawing. Drawn as
|
|
105
105
|
SVG paths from the grid's sprite registry, so it is sharp at any chart size
|
|
106
106
|
and any device pixel ratio. */
|
|
107
|
-
.${
|
|
108
|
-
.${
|
|
107
|
+
.${v}__node-icon{fill:var(--lattice-background,#fff);stroke:none;pointer-events:none}
|
|
108
|
+
.${v}__node-icon--stroke{fill:none;stroke:var(--lattice-background,#fff);
|
|
109
109
|
stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
|
|
110
|
-
.${
|
|
111
|
-
.${
|
|
112
|
-
.${
|
|
113
|
-
.${
|
|
114
|
-
.${
|
|
115
|
-
.${
|
|
116
|
-
.${
|
|
117
|
-
.${
|
|
118
|
-
.${
|
|
119
|
-
.${
|
|
120
|
-
.${
|
|
110
|
+
.${v}__node-icon[data-dim]{opacity:0.18}
|
|
111
|
+
.${v}__flow-label{fill:var(--lattice-chart-axis);pointer-events:none}
|
|
112
|
+
.${v}__stream{stroke:none}
|
|
113
|
+
.${v}__violin{stroke:none;fill-opacity:0.55}
|
|
114
|
+
.${v}__task{stroke:var(--lattice-background,#fff);stroke-width:1;rx:2}
|
|
115
|
+
.${v}__web{stroke:var(--lattice-chart-grid);fill:none}
|
|
116
|
+
.${v}__radar-fill{opacity:0.18;stroke:none}
|
|
117
|
+
.${v}__radar-line{stroke-width:2;fill:none}
|
|
118
|
+
.${v}__gauge-track{fill:var(--lattice-chart-grid)}
|
|
119
|
+
.${v}__gauge-target{stroke:var(--lattice-foreground,#1c2126);stroke-width:2}
|
|
120
|
+
.${v}__gauge-reading{fill:var(--lattice-foreground,#1c2126);
|
|
121
121
|
font-size:calc(var(--lattice-font-size,13px) * 1.8);font-weight:600}
|
|
122
|
-
.${
|
|
122
|
+
.${v}__gauge-caption{fill:var(--lattice-chart-axis);
|
|
123
123
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
124
|
-
.${
|
|
125
|
-
.${
|
|
126
|
-
.${
|
|
124
|
+
.${v}__cell{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
125
|
+
.${v}__funnel{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
126
|
+
.${v}__funnel-label,.${v}__funnel-value{fill:var(--lattice-foreground,#1c2126);
|
|
127
127
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
128
|
-
.${
|
|
129
|
-
.${
|
|
130
|
-
.${
|
|
131
|
-
.${
|
|
128
|
+
.${v}__wick{stroke-width:1}
|
|
129
|
+
.${v}__candle{stroke-width:1}
|
|
130
|
+
.${v}__axis-right{stroke-width:1}
|
|
131
|
+
.${v}__panel-title{fill:var(--lattice-chart-axis);
|
|
132
132
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
133
|
-
.${
|
|
133
|
+
.${v}__region{stroke:var(--lattice-chart-map-stroke,var(--lattice-chart-grid,#dfe3e6));
|
|
134
134
|
stroke-width:0.5;vector-effect:non-scaling-stroke}
|
|
135
|
-
.${
|
|
135
|
+
.${v}__graticule{fill:none;stroke:var(--lattice-chart-grid,#dfe3e6);stroke-width:0.5;
|
|
136
136
|
stroke-opacity:0.6;vector-effect:non-scaling-stroke;pointer-events:none}
|
|
137
|
-
.${
|
|
137
|
+
.${v}__geo-note{fill:var(--lattice-chart-axis);
|
|
138
138
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
139
|
-
.${
|
|
139
|
+
.${v}__attribution{color:var(--lattice-foreground-muted,#5b6670);
|
|
140
140
|
font-size:var(--lattice-font-size-sm,11px);padding:0 4px 4px}
|
|
141
|
-
.${
|
|
142
|
-
.${
|
|
141
|
+
.${v}__attribution[hidden]{display:none}
|
|
142
|
+
.${v}__slice-label{fill:var(--lattice-background,#fff);font-size:var(--lattice-font-size-sm,11px);
|
|
143
143
|
pointer-events:none;text-anchor:middle}
|
|
144
|
-
.${
|
|
144
|
+
.${v}__legend{display:flex;flex-wrap:wrap;gap:2px 12px;padding:6px 4px 2px;
|
|
145
145
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
146
|
-
.${
|
|
146
|
+
.${v}__legend-item{display:inline-flex;align-items:center;gap:5px;border:0;padding:1px 3px;
|
|
147
147
|
background:none;color:inherit;font:inherit;cursor:pointer;border-radius:3px}
|
|
148
|
-
.${
|
|
148
|
+
.${v}__legend-item:focus-visible{outline:var(--lattice-focus-width,2px) solid var(--lattice-focus-color,#1a6bc7);
|
|
149
149
|
outline-offset:1px}
|
|
150
|
-
.${
|
|
151
|
-
.${
|
|
152
|
-
.${
|
|
150
|
+
.${v}__legend-item[aria-pressed="false"]{opacity:0.45}
|
|
151
|
+
.${v}__swatch{width:10px;height:10px;border-radius:2px;flex:0 0 auto}
|
|
152
|
+
.${v}__swatch--circle{border-radius:50%}
|
|
153
153
|
/* A line swatch for a series drawn as a line: the symbol should say which mark
|
|
154
154
|
the reader is looking for, not merely which colour. */
|
|
155
|
-
.${
|
|
156
|
-
.${
|
|
157
|
-
.${
|
|
155
|
+
.${v}__swatch--line{height:3px;border-radius:2px}
|
|
156
|
+
.${v}__legend[data-align="centre"],.${v}__legend[data-align="center"]{justify-content:center}
|
|
157
|
+
.${v}__legend[data-align="end"]{justify-content:flex-end}
|
|
158
158
|
/* Top and bottom are the default row; the sides become a column beside the
|
|
159
159
|
plot, which is why the figure itself changes direction rather than the
|
|
160
160
|
legend floating over the marks. */
|
|
161
|
-
.${
|
|
162
|
-
.${
|
|
163
|
-
.${
|
|
164
|
-
.${
|
|
165
|
-
.${
|
|
161
|
+
.${v}__figure:has(> .${v}__legend[data-position="top"]){flex-direction:column}
|
|
162
|
+
.${v}__legend[data-position="top"]{order:-1}
|
|
163
|
+
.${v}__figure:has(> .${v}__legend[data-position="left"]),
|
|
164
|
+
.${v}__figure:has(> .${v}__legend[data-position="right"]){flex-direction:row;align-items:stretch}
|
|
165
|
+
.${v}__legend[data-position="left"],.${v}__legend[data-position="right"]{
|
|
166
166
|
flex-direction:column;flex:0 0 auto;align-content:flex-start;
|
|
167
167
|
max-width:40%;overflow:auto;padding:4px 8px}
|
|
168
|
-
.${
|
|
169
|
-
.${
|
|
170
|
-
.${
|
|
168
|
+
.${v}__legend[data-position="left"]{order:-1}
|
|
169
|
+
.${v}__legend-more{align-self:center;color:var(--lattice-foreground-muted,#5b6670)}
|
|
170
|
+
.${v}__tooltip{position:fixed;z-index:5;pointer-events:none;max-width:260px;
|
|
171
171
|
padding:5px 8px;border-radius:4px;font-size:var(--lattice-font-size-sm,11px);
|
|
172
172
|
background:var(--lattice-surface,#f7f8f9);color:var(--lattice-foreground,#1c2126);
|
|
173
173
|
border:1px solid var(--lattice-border-color,#dfe3e6);
|
|
174
174
|
box-shadow:var(--lattice-popup-shadow,0 6px 16px -4px rgb(16 20 24/24%))}
|
|
175
|
-
.${
|
|
176
|
-
.${
|
|
177
|
-
.${
|
|
178
|
-
.${
|
|
175
|
+
.${v}__tooltip[hidden]{display:none}
|
|
176
|
+
.${v}__tooltip-row{display:flex;align-items:center;gap:5px;white-space:nowrap}
|
|
177
|
+
.${v}__tooltip-value{font-weight:600;margin-inline-start:auto;padding-inline-start:10px}
|
|
178
|
+
.${v}__empty{display:flex;align-items:center;justify-content:center;flex:1 1 auto;
|
|
179
179
|
color:var(--lattice-foreground-muted,#5b6670)}
|
|
180
180
|
/* The author display:flex above outranks the browser's own [hidden] rule, so
|
|
181
181
|
without this the placeholder stays painted under a drawn chart whenever the
|
|
182
182
|
pane has a fixed height (BACKLOG-0001023). Same guard as the tooltip. */
|
|
183
|
-
.${
|
|
184
|
-
.${
|
|
183
|
+
.${v}__empty[hidden]{display:none}
|
|
184
|
+
.${v}__watermark{position:absolute;right:4px;bottom:4px;z-index:6;
|
|
185
185
|
font-size:var(--lattice-font-size-sm,11px);pointer-events:auto;
|
|
186
186
|
background:var(--lattice-overlay-background,rgb(255 255 255/72%));
|
|
187
187
|
padding:1px 6px;border-radius:3px}
|
|
188
|
-
.${
|
|
189
|
-
.${
|
|
190
|
-
.${
|
|
188
|
+
.${v}__watermark-link{color:var(--lattice-foreground-muted,#5b6670);text-decoration:none}
|
|
189
|
+
.${v}__watermark-link:hover{text-decoration:underline}
|
|
190
|
+
.${v}__table{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;
|
|
191
191
|
clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}
|
|
192
192
|
|
|
193
|
-
.${
|
|
194
|
-
.lattice[data-theme="dark"] .${
|
|
193
|
+
.${v}[data-theme="dark"],
|
|
194
|
+
.lattice[data-theme="dark"] .${v}{
|
|
195
195
|
--lattice-chart-1:#4ea6dd;--lattice-chart-2:#f0b429;--lattice-chart-3:#34c79a;
|
|
196
196
|
--lattice-chart-4:#e39ec4;--lattice-chart-5:#7cc7f0;--lattice-chart-6:#f07c3f;
|
|
197
197
|
--lattice-chart-7:#a48ad4;--lattice-chart-8:#93a3b1}
|
|
@@ -199,15 +199,15 @@
|
|
|
199
199
|
@media (prefers-color-scheme: dark){
|
|
200
200
|
/* Guarded so an explicit light theme still wins on a dark desktop, which is
|
|
201
201
|
the same rule the grid's own tokens follow. */
|
|
202
|
-
.${
|
|
202
|
+
.${v}:not([data-theme="light"]){
|
|
203
203
|
--lattice-chart-1:#4ea6dd;--lattice-chart-2:#f0b429;--lattice-chart-3:#34c79a;
|
|
204
204
|
--lattice-chart-4:#e39ec4;--lattice-chart-5:#7cc7f0;--lattice-chart-6:#f07c3f;
|
|
205
205
|
--lattice-chart-7:#a48ad4;--lattice-chart-8:#93a3b1}
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
@media (prefers-reduced-motion: no-preference){
|
|
209
|
-
.${
|
|
210
|
-
.${
|
|
209
|
+
.${v}__line,.${v}__area{transition:d 160ms ease-out}
|
|
210
|
+
.${v}__bar{transition:x 160ms ease-out,y 160ms ease-out,width 160ms ease-out,height 160ms ease-out}
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
@media (forced-colors: active){
|
|
@@ -215,14 +215,14 @@
|
|
|
215
215
|
meaning entirely. What survives is position, the stroke that separates one
|
|
216
216
|
mark from the next, and the label, which is why the legend carries text
|
|
217
217
|
and the tooltip names its series rather than relying on a swatch. */
|
|
218
|
-
.${
|
|
219
|
-
.${
|
|
220
|
-
.${
|
|
221
|
-
.${
|
|
222
|
-
.${
|
|
218
|
+
.${v}__bar,.${v}__slice,.${v}__point{fill:CanvasText;stroke:Canvas;stroke-width:1}
|
|
219
|
+
.${v}__line{stroke:CanvasText}
|
|
220
|
+
.${v}__area{fill:CanvasText;opacity:0.12}
|
|
221
|
+
.${v}__swatch{border:1px solid CanvasText}
|
|
222
|
+
.${v}__mark[data-dim]{opacity:1;fill:GrayText}
|
|
223
223
|
}
|
|
224
|
-
`}function Q(G){const te=G.documentElement;if(!te||te.getAttribute(pe))return;te.setAttribute(pe,"1");const j=G.createElement("style");j.textContent=V(),(G.head||G.body||te).appendChild(j)}}),Je("packages/modules/charts/axis.js",function(s,K){"use strict";Object.defineProperty(s,"normaliseAxes",{enumerable:!0,get:function(){return J}}),Object.defineProperty(s,"tickValues",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(s,"tickLabeller",{enumerable:!0,get:function(){return E}}),Object.defineProperty(s,"drawAxisTitle",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(s,"labelEvery",{enumerable:!0,get:function(){return M}}),Object.defineProperty(s,"drawMeasureAxis",{enumerable:!0,get:function(){return X}}),Object.defineProperty(s,"drawCategoryAxis",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(s,"leftLabelRoom",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(s,"setLabelText",{enumerable:!0,get:function(){return C}}),Object.defineProperty(s,"drawBandLabels",{enumerable:!0,get:function(){return z}}),Object.defineProperty(s,"drawContinuousAxis",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"drawAxisLines",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"createGroups",{enumerable:!0,get:function(){return me}}),Object.defineProperty(s,"MARK_OVERHANG",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"overhangFor",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"setPlotClip",{enumerable:!0,get:function(){return _}});const W=K("packages/modules/charts/frame.js").Pool,S=K("packages/modules/charts/svg.js"),pe=S.attrs,ue=S.round,V=S.setText,Q=S.svg,G=K("packages/modules/charts/typography.js"),te=G.applySize,j=G.CHAR_RATIO,c=G.truncateTo,v=K("packages/modules/charts/styles.js").NS,k=6,F=1.2;function J(e){if(e===!1){const t={labels:!1,grid:!1};return{x:{...t},y:{...t},y2:{...t}}}const i=e&&typeof e=="object"?e:{},y=t=>typeof t=="string"?{title:t}:t&&typeof t=="object"?{...t}:{};return{x:y(i.x),y:y(i.y),y2:y(i.y2||i.right)}}function Z(e,i){const y=i&&i.ticks;if(Array.isArray(y)){const g=e.domain;return!g||g.min===void 0?y:y.filter(m=>Number(m)>=g.min&&Number(m)<=g.max)}const t=Number.isFinite(y)&&y>0?Number(y):5;return e.ticks(t)}function E(e,i,y){const t=e&&e.format;return typeof t=="function"?g=>String(t(g)):typeof t=="string"&&y&&y.formatting&&y.formatting.format?g=>String(y.formatting.format(g,t)):i.tick}function ne(e){if(!e.text)return;const i=e.side==="left"||e.side==="right"?e.plot.height:e.plot.width,y=Number.isFinite(i)?c(String(e.text),Math.max(0,i),e.size):String(e.text);if(!y||y==="…")return;const t=Q(e.group.ownerDocument,"text",{class:`${v}__axis-title`});if(te(t,e.size),e.side==="left"){const g=Math.max(e.size,e.plot.left-e.plot.gutter.left+e.size),m=e.plot.top+e.plot.height/2;pe(t,{transform:`translate(${ue(g)} ${ue(m)}) rotate(-90)`,"text-anchor":"middle"})}else if(e.side==="right"){const g=e.plot.right+e.plot.gutter.right-e.size,m=e.plot.top+e.plot.height/2;pe(t,{transform:`translate(${ue(g)} ${ue(m)}) rotate(90)`,"text-anchor":"middle"})}else pe(t,{x:ue(e.plot.left+e.plot.width/2),y:ue(e.plot.bottom+e.plot.gutter.bottom-2),"text-anchor":"middle"});V(t,y),y!==String(e.text)&&t.setAttribute("aria-label",String(e.text)),e.group.appendChild(t)}function M(e){const{values:i,scale:y,size:t,horizontal:g,label:m}=e;if(i.length<2)return 1;let b=1/0;for(let l=1;l<i.length;l++){const u=Math.abs(y.of(i[l])-y.of(i[l-1]));Number.isFinite(u)&&u<b&&(b=u)}if(!Number.isFinite(b))return 1;if(b<=0)return i.length;let P=t*F+2;if(g){let l=0;for(const u of i){const x=String(m(u)||"").length*t*j;x>l&&(l=x)}P=l+k}return Math.max(1,Math.ceil(P/b))}function X(e){const{gridGroup:i,axisGroup:y,plot:t,scale:g,format:m}=e,b=e.config||{},P=Z(g,b),l=E(b,m,e.grid),u=e.size||11,x=M({values:P,scale:g,size:u,horizontal:!!e.horizontal,label:l}),n=b.grid===!1?null:i,d=n?new W(n):null,A=new W(y);for(let p=0;p<P.length;p++){const w=P[p],N=ue(g.of(w)),f=w===0,a=p%x!==0;if(e.horizontal){if(d&&pe(d.next("line",`${v}__gridline`),{x1:N,x2:N,y1:ue(t.top),y2:ue(t.bottom),"stroke-opacity":f?1:.6,"stroke-width":f?1.5:1}),b.labels===!1||a)continue;const o=A.next("text",`${v}__tick`);te(o,u),pe(o,{x:N,y:ue(t.bottom+k),"text-anchor":"middle","dominant-baseline":"hanging"}),V(o,l(w))}else{if(d&&pe(d.next("line",`${v}__gridline`),{x1:ue(t.left),x2:ue(t.right),y1:N,y2:N,"stroke-opacity":f?1:.6,"stroke-width":f?1.5:1}),b.labels===!1||a)continue;const o=A.next("text",`${v}__tick`);te(o,u),pe(o,{x:ue(t.left-k),y:N,"text-anchor":"end","dominant-baseline":"middle"}),V(o,l(w))}}return d?d.finish():new W(i).finish(),A.finish(),P}function oe(e){const{group:i,plot:y,scale:t,labels:g,fontSize:m}=e,b=e.config||{};if(b.labels===!1){new W(i).finish();return}const P=new W(i),l=t.domain,u=t.step,x=b.rotate===void 0||b.rotate==="auto"?e.rotated:!!b.rotate,n=x&&u>0?Math.max(1,Math.ceil(m*Math.SQRT2/u)):1,d=Number.isFinite(b.every)&&b.every>0?Number(b.every):n,A=u*d;for(let p=0;p<l.length;p++){const w=ue(t.centre(l[p]));if(Number.isNaN(w)||p%d!==0)continue;const N=P.next("text",`${v}__tick`);te(N,m);const f=g[p]===void 0?"":g[p];x?(pe(N,{x:0,y:0,"text-anchor":"end","dominant-baseline":"middle",transform:`translate(${w} ${ue(y.bottom+k)}) rotate(-45)`}),C(N,f,Math.max(0,y.gutter.bottom-k)*Math.SQRT2,m)):(pe(N,{x:w,y:ue(y.bottom+k),"text-anchor":"middle","dominant-baseline":"hanging",transform:null}),C(N,f,A,m))}P.finish()}function ee(e){return Math.max(0,(e.gutter?e.gutter.left:e.left)-k)}function C(e,i,y,t){const g=String(i??""),m=c(g,y,t);return V(e,m),m!==g?e.setAttribute("aria-label",g):e.removeAttribute("aria-label"),m}function z(e){const{group:i,plot:y,scale:t,labels:g}=e,m=e.config||{},b=new W(i),P=t.domain,l=e.fontSize,u=ee(y),x=t.step>0?Math.max(1,Math.ceil(l*F/t.step)):1,n=Number.isFinite(m.every)&&m.every>0?Number(m.every):x;for(let d=0;d<P.length;d++){if(d%n!==0)continue;const A=ue(t.centre(P[d]));if(Number.isNaN(A))continue;const p=b.next("text",`${v}__tick`);pe(p,{x:ue(y.left-k),y:A,"text-anchor":"end","dominant-baseline":"middle"}),te(p,l),C(p,g[d],u,l)}b.finish()}function ie(e){const{group:i,plot:y,scale:t,format:g}=e,m=e.config||{};if(m.labels===!1){new W(i).finish();return}const b=E(m,g,e.grid),P=new W(i);for(const l of Z(t,m)){const u=ue(t.of(l));if(u<y.left-1||u>y.right+1)continue;const x=P.next("text",`${v}__tick`);te(x,e.size||11),pe(x,{x:u,y:ue(y.bottom+k),"text-anchor":"middle","dominant-baseline":"hanging"}),V(x,b(l))}P.finish()}function I(e){const{group:i,plot:y}=e,t=new W(i);pe(t.next("line"),{x1:ue(y.left),x2:ue(y.left),y1:ue(y.top),y2:ue(y.bottom)}),pe(t.next("line"),{x1:ue(y.left),x2:ue(y.right),y1:ue(y.bottom),y2:ue(y.bottom)}),t.finish()}let $=0;function me(e,i){const y=`${v}-plot-clip-${++$}`,t=Q(e,"rect"),g=Q(e,"clipPath",{id:y});g.appendChild(t);const m=`${v}-box-clip-${$}`,b=Q(e,"clipPath",{id:m});b.appendChild(Q(e,"rect",{x:0,y:0,width:"100%",height:"100%"}));const P=Q(e,"defs");P.appendChild(g),P.appendChild(b);const l={grid:Q(e,"g",{class:`${v}__grid`}),marks:Q(e,"g",{class:`${v}__marks`}),rules:Q(e,"g",{class:`${v}__axis`}),axis:Q(e,"g",{class:`${v}__axis`}),labels:Q(e,"g",{class:`${v}__labels`}),overlay:Q(e,"g",{class:`${v}__overlay`}),clip:t,clipId:y,boxClipId:m};i.appendChild(P);for(const u of["grid","marks","rules","axis","labels","overlay"])i.appendChild(l[u]);return l}const r=30;function D(e){return e==="bubble"?r:e==="scatter"?6:3}function _(e,i,y){if(!e||!e.marks||!e.clip)return;if(!i||!Number.isFinite(i.width)||!Number.isFinite(i.height)){e.marks.removeAttribute("clip-path");return}const t=Number.isFinite(y)&&y>=0?Number(y):r;pe(e.clip,{x:ue(i.left-t),y:ue(i.top-t),width:ue(Math.max(0,i.width)+t*2),height:ue(Math.max(0,i.height)+t*2)}),e.marks.setAttribute("clip-path",`url(#${e.clipId})`)}}),Je("packages/modules/charts/scale.js",function(s,K){"use strict";Object.defineProperty(s,"isNumber",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"toNumber",{enumerable:!0,get:function(){return te}}),Object.defineProperty(s,"toTime",{enumerable:!0,get:function(){return j}}),Object.defineProperty(s,"extent",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"niceStep",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(s,"niceDomain",{enumerable:!0,get:function(){return v}}),Object.defineProperty(s,"measureDomain",{enumerable:!0,get:function(){return k}}),Object.defineProperty(s,"linearTicks",{enumerable:!0,get:function(){return F}}),Object.defineProperty(s,"timeStepFor",{enumerable:!0,get:function(){return J}}),Object.defineProperty(s,"timeTicks",{enumerable:!0,get:function(){return E}}),Object.defineProperty(s,"linearScale",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(s,"timeScale",{enumerable:!0,get:function(){return M}}),Object.defineProperty(s,"key",{enumerable:!0,get:function(){return X}}),Object.defineProperty(s,"bandScale",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(s,"sqrtScale",{enumerable:!0,get:function(){return ee}});const Ae=[1,2,2.5,5,10],W=6e4,S=36e5,pe=864e5,ue=365.25*pe,V=[1,2,5,10,20,25,50,100],Q=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,W,5*W,15*W,30*W,S,3*S,6*S,12*S,pe,2*pe,7*pe,14*pe,30*pe,90*pe,180*pe,...V.map(C=>C*ue)];function G(C){return typeof C=="number"&&Number.isFinite(C)}function te(C){if(C==null||C==="")return null;if(C instanceof Date){const ie=C.getTime();return Number.isFinite(ie)?ie:null}if(typeof C=="boolean")return C?1:0;const z=Number(C);return Number.isFinite(z)?z:null}function j(C){if(C==null||C==="")return null;if(C instanceof Date){const ie=C.getTime();return Number.isFinite(ie)?ie:null}if(typeof C=="number")return Number.isFinite(C)?C:null;const z=Date.parse(String(C));return Number.isFinite(z)?z:null}function c(C){let z=1/0,ie=-1/0;for(let I=0;I<C.length;I++){const $=C[I];G($)&&($<z&&(z=$),$>ie&&(ie=$))}return z===1/0?null:{min:z,max:ie}}function Y(C){if(!(C>0))return 1;const z=10**Math.floor(Math.log10(C));for(const ie of Ae)if(C<=ie*z)return ie*z;return 10*z}function v(C,z=5){const ie=Y((C.max-C.min)/Math.max(1,z));return{min:Math.floor(C.min/ie)*ie,max:Math.ceil(C.max/ie)*ie,step:ie}}function k(C,z={}){const ie=c(C)||{min:0,max:1};let{min:I,max:$}=ie;if(z.zero&&(I>0&&(I=0),$<0&&($=0)),I===$){const me=Math.abs(I)>0?Math.abs(I)/10:1;I-=me,$+=me}if(z.nice!==!1){const me=v({min:I,max:$},z.ticks||5);I=me.min,$=me.max}return G(z.min)&&(I=z.min),G(z.max)&&($=z.max),I===$&&($=I+1),{min:I,max:$}}function F(C,z=5){const ie=Y((C.max-C.min)/Math.max(1,z)),I=Math.ceil(C.min/ie),$=Math.floor(C.max/ie),me=[];for(let r=I;r<=$;r++){const D=r*ie;me.push(Math.abs(D)<ie/1e6?0:Number(D.toPrecision(12)))}return me}function J(C,z=5){const ie=Math.max(1,z),I=C/ie;let $=Q[Q.length-1];for(const D of Q)if(D>=I){$=D;break}if($<ue)return $;let me=$,r=Math.abs(C/$-ie);for(const D of Q){if(D<ue)continue;const _=Math.abs(C/D-ie);_<r&&(r=_,me=D)}return me}function Z(C,z){const ie=new Date(C.min).getUTCFullYear();let I=Math.ceil(ie/z)*z;Date.UTC(I,0,1)<C.min&&(I+=z);const $=[];for(;Date.UTC(I,0,1)<=C.max;I+=z)$.push(Date.UTC(I,0,1));return $}function E(C,z=5){const ie=J(C.max-C.min,z);if(ie>=ue)return Z(C,Math.round(ie/ue));const I=[],$=Math.ceil(C.min/ie)*ie;for(let me=$;me<=C.max;me+=ie)I.push(me);return I}function ne(C,z){const ie=C.max-C.min||1,[I,$]=z;return{kind:"linear",domain:C,range:z,of(me){return I+(me-C.min)/ie*($-I)},invert(me){return C.min+(me-I)/($-I||1)*ie},ticks(me=5){return F(C,me)}}}function M(C,z){return{...ne(C,z),kind:"time",ticks(I=5){return E(C,I)}}}function X(C){if(C==null)return" null";if(C instanceof Date)return` date:${C.getTime()}`;if(typeof C=="object"){const z=C,ie=z.id??z.key??z.value;return ie!==void 0&&typeof ie!="object"?` obj:${String(ie)}`:` obj:${String(C)}`}return String(C)}function oe(C,z,ie=.2){const I=Math.min(.9,Math.max(0,ie)),[$,me]=z,r=new Map;for(let e=0;e<C.length;e++){const i=X(C[e]);r.has(i)||r.set(i,e)}const D=C.length?(me-$)/C.length:me-$,_=Math.max(0,D*(1-I));return{kind:"band",domain:C,range:z,bandwidth:_,step:D,of(e){const i=r.get(X(e));return i===void 0?NaN:$+i*D+(D-_)/2},centre(e){const i=this.of(e);return Number.isNaN(i)?NaN:i+_/2},ticks(){return C}}}function ee(C,z){const[ie,I]=z,$=Math.max(Math.abs(C.max),Math.abs(C.min),0)||1;return{kind:"sqrt",domain:C,range:z,of(me){const r=Math.sqrt(Math.abs(me)/$);return ie+r*(I-ie)}}}}),Je("packages/modules/charts/format.js",function(s,K){"use strict";Object.defineProperty(s,"precisionFor",{enumerable:!0,get:function(){return S}}),Object.defineProperty(s,"axisNumber",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(s,"r2Digits",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"dateFormatFor",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"formatters",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"measureText",{enumerable:!0,get:function(){return G}});const W=K("packages/modules/charts/scale.js").timeStepFor;function S(te){if(!Number.isFinite(te)||te<=0)return 0;const j=Math.ceil(-Math.log10(te));return Math.min(6,Math.max(0,j))}function pe(te,j,c=0){return Number.isFinite(te)?Math.abs(te)>=1e4?j.number(te,{notation:"compact",maximumFractionDigits:1}):j.number(te,{minimumFractionDigits:c,maximumFractionDigits:c}):""}function ue(te,j){const c=te&&te.messages;return!c||typeof c.number!="function"?Number(j).toFixed(2):c.number(j,{minimumFractionDigits:2,maximumFractionDigits:2})}function V(te){if(te>0){const c=W(te);if(c<1e3)return{minute:"2-digit",second:"2-digit",fractionalSecondDigits:3};if(c<6e4)return{hour:"2-digit",minute:"2-digit",second:"2-digit"}}return te<=2*36e5?{hour:"2-digit",minute:"2-digit"}:te<=3*864e5?{weekday:"short",hour:"2-digit"}:te<=180*864e5?{day:"numeric",month:"short"}:te<=3*365*864e5?{month:"short",year:"numeric"}:{year:"numeric"}}function Q(te,j){const c=te.messages,Y=c.locale,v=te.get("timeZone")||void 0;if(j.kind==="time"){const F=V(j.span||0),J=new Intl.DateTimeFormat(Y,v?{...F,timeZone:v}:F),Z=new Intl.DateTimeFormat(Y,v?{dateStyle:"medium",timeStyle:"short",timeZone:v}:{dateStyle:"medium",timeStyle:"short"});return{tick:E=>Number.isFinite(Number(E))?J.format(new Date(Number(E))):"",value:E=>Number.isFinite(Number(E))?Z.format(new Date(Number(E))):""}}const k=S(j.step||0);return{tick:F=>typeof F=="number"?pe(F,c,k):String(F??""),value:F=>typeof F=="number"?c.number(F):String(F??"")}}function G(te,j){if(te==null||!Number.isFinite(te))return"";const c=Math.abs(te)>=1e-6?Number(te.toPrecision(6)):te;return j.number(c)}}),Je("packages/modules/charts/labels.js",function(s,K){"use strict";Object.defineProperty(s,"resolveLabels",{enumerable:!0,get:function(){return F}}),Object.defineProperty(s,"collides",{enumerable:!0,get:function(){return J}}),Object.defineProperty(s,"placeLabels",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(s,"labelText",{enumerable:!0,get:function(){return E}}),Object.defineProperty(s,"drawAnchoredLabels",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(s,"drawDataLabels",{enumerable:!0,get:function(){return M}});const W=K("packages/modules/charts/frame.js").Pool,pe=K("packages/modules/charts/format.js").measureText,ue=K("packages/modules/charts/svg.js"),V=ue.attrs,Q=ue.round,G=ue.setText,j=K("packages/modules/charts/styles.js").NS,c=K("packages/modules/charts/typography.js"),Y=c.applySize,v=c.textWidth,k=4;function F(X){const oe=X&&X.labels;if(!oe)return{show:!1,names:oe!==!1,position:"outside",format:null,minGap:2,total:!1};const ee=typeof oe=="object"?oe:{};return{show:!0,names:!0,position:["outside","inside","auto"].includes(ee.position)?ee.position:"outside",format:ee.format||null,minGap:Number.isFinite(ee.minGap)?Number(ee.minGap):2,total:!!ee.total}}function J(X,oe,ee){for(const C of oe)if(X.x-ee<C.x+C.width&&X.x+X.width+ee>C.x&&X.y-ee<C.y+C.height&&X.y+X.height+ee>C.y)return!0;return!1}function Z(X){const{points:oe,plot:ee,size:C}=X,z=X.minGap===void 0?2:X.minGap,ie=[],I=[];for(const $ of oe){if($.px===void 0||$.py===void 0)continue;const me=X.text($);if(!me)continue;const r=v(me,C),D=C;let _=$.px,e=$.py-k,i="middle",y=!1;X.horizontal?(_=$.px+k,e=$.py,i="start",X.position!=="outside"&&$.pbase!==void 0&&Math.abs($.px-$.pbase)>r+k*2&&(_=$.px-k,i="end",y=!0)):X.position!=="outside"&&$.pbase!==void 0&&Math.abs($.pbase-$.py)>D+k*2&&(e=$.py+D+k,y=!0);const t=()=>({x:i==="middle"?_-r/2:i==="end"?_-r:_,y:e-D,width:r,height:D});let g=t();!(g.y>=ee.top-1)&&!y&&!X.horizontal&&$.pbase!==void 0&&Math.abs($.pbase-$.py)>D+k*2&&(e=$.py+D+k,y=!0,g=t()),!(g.x<ee.left-1||g.x+g.width>ee.right+1)&&(g.y<ee.top-1||g.y+g.height>ee.bottom+D||J(g,ie,z)||(ie.push(g),I.push({x:Q(_),y:Q(e),text:me,anchor:i,inside:y})))}return I}function E(X,oe,ee){return X==null?"":typeof oe.format=="function"?String(oe.format(X)):typeof oe.format=="string"&&ee&&ee.formatting&&ee.formatting.format?String(ee.formatting.format(X,oe.format)):pe(X,ee&&ee.messages)}function ne(X){const oe=new W(X.group),ee=X.minGap===void 0?2:X.minGap,C=X.size,z=[];let ie=0;for(const I of X.anchors){if(!I||!I.text)continue;const $=I.width===void 0?v(I.text,X.size):I.width,me=I.anchor||"middle",D={x:me==="end"?I.x-$:me==="start"?I.x:I.x-$/2,y:I.y-C/2,width:$,height:C};if(X.plot&&(D.x<X.plot.left-1||D.x+D.width>X.plot.right+1||D.y<X.plot.top-1||D.y+D.height>X.plot.bottom+1)||I.width!==void 0&&$>I.width||I.height!==void 0&&C>I.height||J(D,z,ee))continue;z.push(D);const _=oe.next("text",I.className||`${j}__data-label`);Y(_,X.size),V(_,{x:Q(I.x),y:Q(I.y),"text-anchor":me,"dominant-baseline":I.baseline||"middle","data-inside":I.inside?"true":null}),G(_,I.text),ie++}return oe.finish(),ie}function M(X){const oe=new W(X.group),{options:ee}=X;let C=0;const z=ie=>typeof ee.format=="function"&&ie.y!==null&&ie.y!==void 0?String(ee.format(ie.y,ie)):E(ie.y,ee,X.grid);for(const ie of X.series){const I=Z({points:ie.points,plot:X.plot,size:X.size,position:ee.position,horizontal:X.horizontal,minGap:ee.minGap,text:z});for(const $ of I){const me=oe.next("text",`${j}__data-label`);Y(me,X.size),V(me,{x:$.x,y:$.y,"text-anchor":$.anchor,"data-inside":$.inside?"true":null}),G(me,$.text),C++}}return oe.finish(),C}}),Je("packages/modules/charts/dense.js",function(s,K){"use strict";Object.defineProperty(s,"CANVAS_THRESHOLD",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(s,"downsample",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"markCount",{enumerable:!0,get:function(){return S}}),Object.defineProperty(s,"wantsCanvas",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(s,"paintDense",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"sizeCanvas",{enumerable:!0,get:function(){return V}});const Ae=3e3;function W(Q,G){const te=Q.length;if(!Number.isFinite(G)||G>=te||G<3||te<3)return Q;const j=[Q[0]],c=(te-2)/(G-2);let Y=0;for(let v=0;v<G-2;v++){const k=Math.floor(v*c)+1,F=Math.min(Math.floor((v+1)*c)+1,te-1),J=F,Z=Math.min(Math.floor((v+2)*c)+1,te);let E=0,ne=0,M=0;for(let C=J;C<Z;C++){const z=Q[C];!z||!Number.isFinite(z.y)||(E+=z.x,ne+=z.y,M++)}M&&(E/=M,ne/=M);const X=Q[Y];if(k>=F)continue;let oe=k,ee=-1;for(let C=k;C<F;C++){const z=Q[C];if(!z||!Number.isFinite(z.y))continue;const ie=Math.abs((X.x-E)*(z.y-X.y)-(X.x-z.x)*(ne-X.y));ie>ee&&(ee=ie,oe=C)}oe<=Y||(j.push(Q[oe]),Y=oe)}return j.push(Q[te-1]),j}function S(Q){let G=0;for(const te of Q)G+=te.points.length;return G}function pe(Q){if(Q.canvas===!0)return!0;if(Q.canvas===!1)return!1;const G=Number.isFinite(Q.canvas)?Number(Q.canvas):Ae;return S(Q.series)>G}function ue(Q){const{context:G,series:te,ratio:j}=Q;G.save(),G.scale(j,j);for(const c of te){const Y=Q.colour(c.index);if(Q.type==="scatter"||Q.type==="bubble"){G.fillStyle=Y;for(const k of c.points)k.px!==void 0&&(G.beginPath(),G.arc(k.px,k.py,k.pr||2,0,Math.PI*2),G.fill());continue}G.strokeStyle=Y,G.lineWidth=2,G.lineJoin="round",G.beginPath();let v=!1;for(const k of c.points){if(k.px===void 0||k.py===void 0){v=!1;continue}v?G.lineTo(k.px,k.py):G.moveTo(k.px,k.py),v=!0}G.stroke()}G.restore()}function V(Q){const{canvas:G}=Q;return G.width=Math.max(1,Math.round(Q.width*Q.ratio)),G.height=Math.max(1,Math.round(Q.height*Q.ratio)),G.style&&(G.style.width=`${Q.width}px`,G.style.height=`${Q.height}px`),typeof G.getContext=="function"?G.getContext("2d"):null}}),Je("packages/core/src/internal/util.js",function(s,K){"use strict";Object.defineProperty(s,"VERSION",{enumerable:!0,get:function(){return S}}),Object.defineProperty(s,"reportedWarnings",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"warnOnce",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(s,"infoOnce",{enumerable:!0,get:function(){return v}}),Object.defineProperty(s,"resetWarnings",{enumerable:!0,get:function(){return k}}),Object.defineProperty(s,"fail",{enumerable:!0,get:function(){return F}}),Object.defineProperty(s,"invariant",{enumerable:!0,get:function(){return J}}),Object.defineProperty(s,"DEV",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(s,"isObject",{enumerable:!0,get:function(){return E}}),Object.defineProperty(s,"isFunction",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(s,"isNil",{enumerable:!0,get:function(){return M}}),Object.defineProperty(s,"isBlank",{enumerable:!0,get:function(){return X}}),Object.defineProperty(s,"isCtor",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(s,"pathGetter",{enumerable:!0,get:function(){return C}}),Object.defineProperty(s,"pathSetter",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"getPath",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"setPath",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"humanise",{enumerable:!0,get:function(){return me}}),Object.defineProperty(s,"escapeHtml",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"titleCase",{enumerable:!0,get:function(){return _}}),Object.defineProperty(s,"expand",{enumerable:!0,get:function(){return e}}),Object.defineProperty(s,"toArray",{enumerable:!0,get:function(){return i}}),Object.defineProperty(s,"merge",{enumerable:!0,get:function(){return t}}),Object.defineProperty(s,"mergeRow",{enumerable:!0,get:function(){return g}}),Object.defineProperty(s,"Lru",{enumerable:!0,get:function(){return m}}),Object.defineProperty(s,"collator",{enumerable:!0,get:function(){return P}}),Object.defineProperty(s,"defaultCompare",{enumerable:!0,get:function(){return l}}),Object.defineProperty(s,"now",{enumerable:!0,get:function(){return u}}),Object.defineProperty(s,"nextFrame",{enumerable:!0,get:function(){return n}}),Object.defineProperty(s,"cancelFrame",{enumerable:!0,get:function(){return d}}),Object.defineProperty(s,"frameBatched",{enumerable:!0,get:function(){return A}}),Object.defineProperty(s,"settleDebounce",{enumerable:!0,get:function(){return p}}),Object.defineProperty(s,"whenIdle",{enumerable:!0,get:function(){return w}}),Object.defineProperty(s,"uid",{enumerable:!0,get:function(){return f}});const Ae="1.71.0";async function W(){return Ae}const S="1.71.0",pe=new Set,ue=2e3;function V(a){if(pe.add(a),pe.size>ue){const o=pe.values().next().value;o!==void 0&&pe.delete(o)}}const Q=[],G=500;function te(a,o,h){Q.push({key:a,level:o,message:h.map(B=>typeof B=="string"?B:j(B)).join(" "),at:Date.now()}),Q.length>G&&Q.shift()}function j(a){if(a instanceof Error)return a.message;try{return JSON.stringify(a)}catch{return String(a)}}function c(){return Q.map(a=>({...a}))}function Y(a,...o){pe.has(a)||(V(a),te(a,"warn",o),console.warn("[lattice]",...o))}function v(a,...o){pe.has(a)||(V(a),te(a,"info",o),console.info("[lattice]",...o))}function k(){pe.clear(),Q.length=0}function F(a,o){const h=new Error(`[lattice] ${a}`);throw o!==void 0&&(h.cause=o),h}function J(a,o){a||F(o)}const Z=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function E(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)}function ne(a){return typeof a=="function"}function M(a){return a==null}function X(a){return a==null||a===""}function oe(a){return typeof a!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(a))?!0:!!(a.prototype&&Object.getOwnPropertyNames(a.prototype).length>1)}const ee=new Map;function C(a){let o=ee.get(a);if(o)return o;if(!a.includes("."))o=h=>h?.[a];else{const h=a.split("."),B=h.length;o=R=>{let U=R;for(let q=0;q<B;q++){if(U==null)return;U=U[h[q]]}return U}}return ee.set(a,o),o}const z=new Map;function ie(a){let o=z.get(a);if(o)return o;if(!a.includes("."))o=(h,B)=>{h!=null&&(h[a]=B)};else{const h=a.split("."),B=h.length-1;o=(R,U)=>{let q=R;for(let se=0;se<B;se++){if(q==null)return;const T=h[se];q[T]==null&&(q[T]={}),q=q[T]}q!=null&&(q[h[B]]=U)}}return z.set(a,o),o}function I(a,o){return C(o)(a)}function $(a,o,h){ie(o)(a,h)}function me(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(/^./,h=>h.toUpperCase()):""}const r={"&":"&","<":"<",">":">",'"':""","'":"'"};function D(a){const o=a==null?"":String(a);return/[&<>"']/.test(o)?o.replace(/[&<>"']/g,h=>r[h]):o}function _(a){return String(a).replace(/\w\S*/g,o=>o[0].toUpperCase()+o.slice(1).toLowerCase())}function e(a,o,h){if(a!==void 0)return a===!0?{enabled:!0,...h}:a===!1?{enabled:!1}:E(a)?a:{[o]:a,enabled:!0}}function i(a){return a==null?[]:Array.isArray(a)?a:[a]}const y=Object.freeze(new Set(["__proto__","constructor","prototype"]));function t(a,o){if(!E(a))return E(o)?{...o}:o;if(!E(o))return o===void 0?a:o;const h={...a};for(const B of Object.keys(o)){if(y.has(B))continue;const R=o[B];R!==void 0&&(h[B]=E(R)&&E(h[B])?t(h[B],R):R)}return h}function g(a,o){if(!E(a)||!E(o)||a===o)return o;const h=Object.create(Object.getPrototypeOf(a));return Object.assign(h,a,o),h}class m{#l;#n=new Map;#c;constructor(o=256,h=null){this.#l=o,this.#c=h}get size(){return this.#n.size}get max(){return this.#l}set max(o){this.#l=o,this.#e()}has(o){return this.#n.has(o)}get(o){const h=this.#n;if(!h.has(o))return;const B=h.get(o);return h.delete(o),h.set(o,B),B}peek(o){return this.#n.get(o)}set(o,h){const B=this.#n;return B.has(o)&&B.delete(o),B.set(o,h),this.#e(),h}delete(o){const h=this.#n.get(o);return this.#n.delete(o)&&this.#c&&this.#c(h,o),h}clear(){if(this.#c)for(const[o,h]of this.#n)this.#c(h,o);this.#n.clear()}keys(){return this.#n.keys()}values(){return this.#n.values()}#e(){const o=this.#n;for(;o.size>this.#l;){const h=o.keys().next().value,B=o.get(h);o.delete(h),this.#c&&this.#c(B,h)}}}const b=new Map;function P(a,o){const h=`${a||""}|${o?JSON.stringify(o):""}`;let B=b.get(h);return B||(B=new Intl.Collator(a||void 0,{numeric:!0,sensitivity:"variant",...o}),b.set(h,B)),B}function l(a,o){if(a===o)return 0;if(a==null)return 1;if(o==null)return-1;if(typeof a=="number"&&typeof o=="number")return Number.isNaN(a)?Number.isNaN(o)?0:1:Number.isNaN(o)||a<o?-1:a>o?1:0;const h=String(a),B=String(o);return h<B?-1:h>B?1:0}function u(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const x=typeof requestAnimationFrame=="function";function n(a){return x?requestAnimationFrame(a):setTimeout(()=>a(u()),16)}function d(a){a!=null&&(x?cancelAnimationFrame(a):clearTimeout(a))}function A(a){let o=null,h=null;const B=()=>{o=null;const U=h;h=null,a(...U||[])},R=(...U)=>{h=U,o===null&&(o=n(B))};return R.cancel=()=>{d(o),o=null,h=null},R.flush=()=>{o!==null&&(d(o),B())},R}function p(a,o){let h=null,B=null;const R=()=>{if(h=null,B===null)return;const se=B;B=null,a(...se),U()},U=()=>{h=setTimeout(R,o),typeof h?.unref=="function"&&h.unref()},q=(...se)=>{h===null?(a(...se),U()):(B=se,clearTimeout(h),U())};return q.flush=()=>{if(h!==null&&clearTimeout(h),h=null,B===null)return;const se=B;B=null,a(...se)},q.cancel=()=>{h!==null&&clearTimeout(h),h=null,B=null},q.pending=()=>h!==null||B!==null,q}function w(a,o=50){return typeof requestIdleCallback=="function"?requestIdleCallback(a,{timeout:o}):setTimeout(()=>a({timeRemaining:()=>0,didTimeout:!0}),1)}let N=0;function f(a="l"){return`${a}${(++N).toString(36)}`}}),Je("packages/modules/charts/annotations.js",function(s,K){"use strict";Object.defineProperty(s,"overlayLayer",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(s,"annotationValue",{enumerable:!0,get:function(){return z}}),Object.defineProperty(s,"annotationAxis",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"annotationText",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"drawAnnotations",{enumerable:!0,get:function(){return me}});const W=K("packages/modules/charts/frame.js").Pool,S=K("packages/modules/charts/scale.js"),pe=S.isNumber,ue=S.toNumber,V=S.toTime,Q=K("packages/modules/charts/svg.js"),G=Q.attrs,te=Q.path,j=Q.round,c=Q.setText,Y=Q.SVG_NS,k=K("packages/modules/charts/styles.js").NS,J=K("packages/core/src/internal/util.js").warnOnce;function Z(r,D){for(const e of r.childNodes||[])if(e&&String(e.getAttribute&&e.getAttribute("class"))===D)return e;const _=r.ownerDocument.createElementNS(Y,"g");return _.setAttribute("class",D),r.appendChild(_),_}const E=new Set(["line","target","band","callout","event"]);function ne(r,D){return r.kind==="time"?V(D):ue(D)}function M(r,D,_){if(r.kind==="band"){const i=r.of(D);if(!Number.isFinite(i))return NaN;const y=Number(r.bandwidth)||0;return _==="right"?i+y:i}const e=ne(r,D);return e===null?NaN:r.of(e)}function X(r,D,_){const e=r.kind||"line",i=r.label?` (${JSON.stringify(r.label)})`:"";J(`chart:annotation:dropped:${e}:${D}:${_}`,`chart annotation${i} of kind ${JSON.stringify(e)}, reading the ${D} axis, was not drawn: ${_}.`)}function oe(r,D){if(r instanceof Date){const e=r.getTime();return Number.isFinite(e)?r.toISOString().slice(0,10):String(r)}if(typeof r=="number")return Number.isFinite(r)?D(r):String(r);const _=ue(r);return _===null||typeof r=="string"?String(r):D(_)}function ee(r,D,_){const e=[];for(const i of r)if((i.axis==="right"?"right":"left")===_&&!(D.series!==void 0&&i.key!==D.series))for(const t of i.points)pe(t.y)&&e.push(Number(t.y));return e}function C(r,D){if(!r.length)return null;const _=[...r].sort((t,g)=>t-g);if(_.length===1)return _[0];const e=Math.min(100,Math.max(0,D))/100*(_.length-1),i=Math.floor(e),y=Math.ceil(e);return i===y?_[i]:_[i]+(_[y]-_[i])*(e-i)}function z(r,D,_){if(!r.compute)return ue(r.value);const e=ee(D,r,_);if(!e.length)return null;const i=String(r.compute).toLowerCase();if(i==="mean"||i==="avg")return e.reduce((t,g)=>t+g,0)/e.length;if(i==="median"||i==="p50")return C(e,50);if(i==="min")return Math.min(...e);if(i==="max")return Math.max(...e);const y=/^p(\d+(?:\.\d+)?)$/.exec(i);return y?C(e,Number(y[1])):null}function ie(r){return r.axis==="right"||r.axis==="y2"?"right":"left"}function I(r,D,_,e){const i=r.label?`${r.label}: `:"",y=e?` (${ie(r)==="right"?"right axis":"left axis"})`:"",t=r.kind||"line";if(t==="band"){if(!Array.isArray(D)||D[0]===null||D[1]===null)return"";const[m,b]=D;return`${i||"Band: "}${_(Math.min(m,b))} to ${_(Math.max(m,b))}${y}`}return D==null?"":`${i||`${t==="target"?"Target":t==="callout"?"Callout":"Reference"}: `}${_(D)}${y}`}function $(r){return(r.kind||"line")==="band"?0:1}function me(r){const{group:D,plot:_,xScale:e,yScale:i,rightScale:y,series:t,format:g}=r,m=new W(Z(D,`${k}__annotations`)),b=[],l=[...Array.isArray(r.annotations)?r.annotations:[]].sort((u,x)=>$(u)-$(x));for(const u of l){const x=u.kind||"line";if(!E.has(x))continue;const n=ie(u),d=n==="right"&&y?y:i;if(x==="band"){if(u.orient==="vertical"){const h=M(e,u.from,"left"),B=M(e,u.to,"right");if(Number.isNaN(h)||Number.isNaN(B)){const se=Number.isNaN(h)&&Number.isNaN(B)?"from and to":Number.isNaN(h)?"from":"to";X(u,n,`its ${se} value could not be placed on the x scale`);continue}const R=j(Math.min(h,B)),U=j(Math.max(h,B));if(G(m.next("rect",`${k}__annotation-band ${u.className||""}`.trim()),{x:R,y:j(_.top),width:Math.max(0,U-R),height:j(Math.max(0,_.bottom-_.top)),fill:u.colour||"currentColor","fill-opacity":u.opacity===void 0?.12:u.opacity}),u.label){const se=m.next("text",`${k}__annotation-label`);G(se,{x:R+4,y:j(_.top+12),"text-anchor":"start"}),c(se,u.label)}const q=u.label?`${u.label}: `:"Event window: ";b.push({text:`${q}${oe(u.from,g)} to ${oe(u.to,g)}`});continue}const N=z({...u,value:u.from,compute:u.fromCompute},t,n),f=z({...u,value:u.to,compute:u.toCompute},t,n);if(N===null||f===null)continue;const a=j(d.of(N)),o=j(d.of(f));if(G(m.next("rect",`${k}__annotation-band ${u.className||""}`.trim()),{x:j(_.left),y:Math.min(a,o),width:j(Math.max(0,_.right-_.left)),height:Math.max(0,Math.abs(o-a)),fill:u.colour||"currentColor","fill-opacity":u.opacity===void 0?.12:u.opacity}),u.label){const h=m.next("text",`${k}__annotation-label`);G(h,{x:j(_.left+4),y:Math.min(a,o)+12,"text-anchor":"start"}),c(h,u.label)}b.push({text:I(u,[N,f],g,r.dual)});continue}if(x==="event"){const N=u.x!==void 0?u.x:u.at,f=j(M(e,N,"left")+(e.kind==="band"?(Number(e.bandwidth)||0)/2:0));if(Number.isNaN(f)){X(u,n,"its x value could not be placed on the x scale");continue}if(G(m.next("path",`${k}__annotation-event`),{d:te(["M",f,j(_.top),"L",f,j(_.bottom)]),stroke:u.colour||"currentColor",fill:"none"}),G(m.next("circle",`${k}__annotation-event-flag`),{cx:f,cy:j(_.top),r:3,fill:u.colour||"currentColor"}),u.label){const o=m.next("text",`${k}__annotation-label`);G(o,{x:f+5,y:j(_.top+10),"text-anchor":"start"}),c(o,u.label)}const a=u.label?`${u.label} — `:"Event — ";b.push({text:`${a}at ${oe(N,g)}`});continue}if(x==="callout"){const N=z(u,t,n);if(N===null)continue;const f=u.at!==void 0?j(e.kind==="band"?e.centre(u.at):e.of(ne(e,u.at)??NaN)):j(_.right-4),a=j(d.of(N));if(Number.isNaN(f)){X(u,n,"its x value could not be placed on the x scale");continue}if(G(m.next("circle",`${k}__annotation-point`),{cx:f,cy:a,r:3.5,fill:u.colour||"currentColor"}),u.label){const o=m.next("text",`${k}__annotation-label`);G(o,{x:f+6,y:a-6,"text-anchor":"start"}),c(o,u.label)}b.push({text:I(u,N,g,r.dual)});continue}if(u.orient==="vertical"||u.x!==void 0){const N=u.x!==void 0?u.x:u.value,f=e.kind==="band"?j(e.centre(N)):j(e.of(ne(e,N)??NaN));if(Number.isNaN(f)){X(u,n,"its x value could not be placed on the x scale");continue}const a=x==="target"?`${k}__annotation-target`:`${k}__annotation-line`;if(G(m.next("path",a),{d:te(["M",f,j(_.top),"L",f,j(_.bottom)]),stroke:u.colour||"currentColor",fill:"none"}),u.label){const o=m.next("text",`${k}__annotation-label`);G(o,{x:f+4,y:j(_.top+10),"text-anchor":"start"}),c(o,u.label)}b.push({text:u.label?`${u.label} — at ${oe(N,g)}`:""});continue}const A=z(u,t,n);if(A===null)continue;const p=j(d.of(A)),w=x==="target"?`${k}__annotation-target`:`${k}__annotation-line`;if(G(m.next("path",w),{d:te(["M",j(_.left),p,"L",j(_.right),p]),stroke:u.colour||"currentColor",fill:"none"}),u.label){const N=m.next("text",`${k}__annotation-label`);G(N,{x:j(_.right-4),y:p-4,"text-anchor":"end"}),c(N,u.label)}b.push({text:I(u,A,g,r.dual)})}return m.finish(),b.filter(u=>u.text)}}),Je("packages/modules/charts/combo.js",function(s,K){"use strict";Object.defineProperty(s,"toPareto",{enumerable:!0,get:function(){return t}}),Object.defineProperty(s,"drawCombo",{enumerable:!0,get:function(){return b}}),Object.defineProperty(s,"drawRightAxis",{enumerable:!0,get:function(){return P}});const Ae=K("packages/modules/charts/axis.js"),W=Ae.drawAxisLines,S=Ae.drawCategoryAxis,pe=Ae.drawContinuousAxis,ue=Ae.drawMeasureAxis,V=Ae.overhangFor,Q=Ae.setPlotClip,G=K("packages/modules/charts/frame.js"),te=G.Pool,j=G.shouldRotate,Y=K("packages/modules/charts/format.js").formatters,v=K("packages/modules/charts/scale.js"),k=v.bandScale,F=v.extent,J=v.isNumber,Z=v.linearScale,E=v.measureDomain,ne=v.timeScale,M=v.toNumber,X=v.toTime,oe=K("packages/modules/charts/svg.js"),ee=oe.attrs,C=oe.path,z=oe.round,I=K("packages/modules/charts/styles.js").NS,me=K("packages/modules/charts/scheme.js").resolveScheme,D=K("packages/modules/charts/labels.js").drawDataLabels,e=K("packages/modules/charts/annotations.js").drawAnnotations;function i(l){return{left:l.filter(u=>u.axis!=="right"),right:l.filter(u=>u.axis==="right")}}function y(l,u){const x=[];for(const n of l)for(const d of n.points)x.push(d.y);return E(x,{zero:u})}function t(l){const u=l.series[0];if(!u)return l;const x=u.points.map((p,w)=>({point:p,label:l.labels[w],category:l.categories[w]})).filter(p=>J(p.point.y)).sort((p,w)=>w.point.y-p.point.y),n=x.reduce((p,w)=>p+w.point.y,0);let d=0;const A=x.map(p=>(d+=p.point.y,n>0?d/n*100:0));return{...l,categories:x.map(p=>p.category),labels:x.map(p=>p.label),series:[{...u,index:0,mark:"bar",axis:"left",points:x.map(p=>p.point)},{key:"cumulative",label:l.cumulativeLabel||"%",index:1,mark:"line",axis:"right",points:x.map((p,w)=>({x:p.category,xKey:p.point.xKey,label:p.label,y:A[w],rows:p.point.rows,rowKey:p.point.rowKey}))}]}}function g(l,u){const x=[u.left,u.right];if(l.kind!=="time"&&l.kind!=="linear")return k(l.categories,x,.2);const n=l.kind==="time"?l.categories.map(X):l.categories.map(M);if(l.kind==="time"){const A=F(n);if(A&&A.min===A.max)return ne({min:A.min-3e4,max:A.max+3e4},x)}const d=E(n,{zero:!1,nice:l.kind!=="time"});return l.kind==="time"?ne(d,x):Z(d,x)}function m(l,u){const x=[...new Set(l.filter(w=>Number.isFinite(w)))].sort((w,N)=>w-N);if(x.length<2){const[w,N]=u.range;return Math.max(4,(N-w)/10)}const n=[];for(let w=1;w<x.length;w++)n.push(x[w]-x[w-1]);n.sort((w,N)=>w-N);const d=Math.floor(n.length/2),A=n.length%2?n[d]:(n[d-1]+n[d])/2,p=Math.abs(u.of(x[0]+A)-u.of(x[0]));return Math.max(1,p*.8)}function b(l){const u=l.scheme||me(),{plot:x}=l,n=l.pareto?t(l.bound):l.bound,d=n.series.filter(he=>!l.hidden.has(he.key)),A=i(d),p=A.left.some(he=>(he.mark||"bar")==="bar"),w=y(A.left,p),N=Z(w,[x.bottom,x.top]),f=A.right.length?l.pareto?{min:0,max:100}:y(A.right,!1):null,a=f?Z(f,[x.bottom,x.top]):null,o=g(n,x),h=o.kind!=="band",B=h?n.categories.map(he=>n.kind==="time"?X(he):M(he)):null;ue({gridGroup:l.groups.grid,axisGroup:l.groups.axis,plot:x,scale:N,format:Y(l.grid,{kind:"linear",step:(w.max-w.min)/5})}),h?pe({group:l.groups.overlay,plot:x,scale:o,format:Y(l.grid,{kind:n.kind,span:o.domain.max-o.domain.min,step:(o.domain.max-o.domain.min)/5}),grid:l.grid,size:l.fontSize}):S({group:l.groups.overlay,plot:x,scale:o,labels:n.labels,fontSize:l.fontSize,rotated:j(n.labels,o.step,l.fontSize)}),W({group:l.groups.rules,plot:x}),a&&P({group:l.groups.axis,plot:x,scale:a,colour:u.series(A.right[0].index),format:Y(l.grid,{kind:"linear",step:(f.max-f.min)/5}),suffix:l.pareto?"%":""}),Q(l.groups,x,V(l.type));const R=new te(l.groups.marks),U=d.filter(he=>(he.mark||"bar")==="bar"),q=h?m(B,o):o.bandwidth,se=U.length?q/U.length:q;let T=0;for(const he of d){const be=he.mark||"bar",we=he.axis==="right"&&a?a:N,ye=u.series(he.index);if(be==="bar"){const xe=T*se;T++;const _e=we.of(Math.max(we.domain.min,0));for(let $e=0;$e<he.points.length;$e++){const Pe=he.points[$e];if(!J(Pe.y))continue;let Ie;if(h){const We=n.kind==="time"?X(Pe.x):M(Pe.x);Ie=We===null?NaN:o.of(We)-q/2}else Ie=o.of(Pe.x);if(Number.isNaN(Ie))continue;const He=we.of(Pe.y);ee(R.next("rect",`${I}__bar ${I}__mark`),{x:z(Ie+xe),y:z(Math.min(He,_e)),width:z(Math.max(0,se)),height:z(Math.max(1,Math.abs(_e-He))),fill:ye,"data-series":he.index,"data-point":$e}),Pe.px=z(Ie+xe+se/2),Pe.py=z(Math.min(He,_e))}continue}const Me=[];let Te=!1;for(const xe of he.points){if(!J(xe.y)){Te=!1;continue}let _e;if(h){const Pe=n.kind==="time"?X(xe.x):M(xe.x);_e=Pe===null?NaN:z(o.of(Pe))}else _e=z(o.centre(xe.x));if(Number.isNaN(_e)){Te=!1;continue}const $e=z(we.of(xe.y));Me.push(Te?"L":"M",_e,$e),Te=!0,xe.px=_e,xe.py=$e}ee(R.next("path",`${I}__line ${I}__mark`),{d:Me.length?C(Me):"",stroke:ye,"data-series":he.index});for(const xe of he.points)xe.px!==void 0&&ee(R.next("circle",`${I}__point ${I}__mark`),{cx:xe.px,cy:xe.py,r:3,fill:ye})}R.finish(),l.labels&&l.labels.show&&D({group:l.groups.labels,series:d,plot:x,options:l.labels,grid:l.grid,size:l.typography&&l.typography.small||l.fontSize});let le=null;return l.annotations&&l.annotations.length&&(le=e({group:l.groups.overlay,plot:x,xScale:o,yScale:N,rightScale:a,series:d,annotations:l.annotations,dual:!!a,format:Y(l.grid,{kind:"linear",step:(w.max-w.min)/5}).tick})),{xScale:o,yScale:N,rightScale:a,dual:!!a,series:d,bound:n,annotations:le}}function P(l){const{group:u,plot:x,scale:n,format:d}=l,A=new te(u);ee(A.next("line",`${I}__axis-right`),{x1:z(x.right),x2:z(x.right),y1:z(x.top),y2:z(x.bottom),stroke:l.colour});for(const p of n.ticks(5)){const w=z(n.of(p)),N=A.next("text",`${I}__tick`);ee(N,{x:z(x.right+6),y:w,"text-anchor":"start","dominant-baseline":"middle",fill:l.colour}),N.textContent=`${d.tick(p)}${l.suffix||""}`}A.finish()}}),Je("packages/modules/charts/quantile.js",function(s,K){"use strict";Object.defineProperty(s,"normalQuantile",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"studentTQuantile",{enumerable:!0,get:function(){return j}});const Ae=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),W=3e-12,S=1e-300;function pe(c){if(c<.5)return Math.log(Math.PI/Math.sin(Math.PI*c))-pe(1-c);const Y=c-1;let v=.9999999999998099;const k=Y+7.5;for(let F=0;F<Ae.length;F++)v+=Ae[F]/(Y+F+1);return .5*Math.log(2*Math.PI)+(Y+.5)*Math.log(k)-k+Math.log(v)}function ue(c,Y,v){const k=c+Y,F=c+1,J=c-1;let Z=1,E=1-k*v/F;Math.abs(E)<S&&(E=S),E=1/E;let ne=E;for(let M=1;M<=300;M++){const X=2*M;let oe=M*(Y-M)*v/((J+X)*(c+X));E=1+oe*E,Math.abs(E)<S&&(E=S),Z=1+oe/Z,Math.abs(Z)<S&&(Z=S),E=1/E,ne*=E*Z,oe=-(c+M)*(k+M)*v/((c+X)*(F+X)),E=1+oe*E,Math.abs(E)<S&&(E=S),Z=1+oe/Z,Math.abs(Z)<S&&(Z=S),E=1/E;const ee=E*Z;if(ne*=ee,Math.abs(ee-1)<W)break}return ne}function V(c,Y,v){if(!(c>0)||!(Y>0)||!Number.isFinite(v))return Number.NaN;if(v<=0)return 0;if(v>=1)return 1;const k=Math.exp(pe(c+Y)-pe(c)-pe(Y)+c*Math.log(v)+Y*Math.log(1-v));return v<(c+1)/(c+Y+2)?k*ue(c,Y,v)/c:1-k*ue(Y,c,1-v)/Y}function Q(c){const Y=Math.abs(c),v=2/(2+Y),k=4*v-2,F=[-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 J=0,Z=0,E;for(let M=F.length-1;M>0;M--)E=Z,Z=k*Z-J+F[M],J=E;const ne=v*Math.exp(-Y*Y+.5*(F[0]+k*Z)-J);return c>=0?ne:2-ne}function G(c){if(!(c>0)||!(c<1))return c===0?-1/0:c===1?1/0:Number.NaN;const Y=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],v=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],k=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],F=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],J=.02425;let Z,E,ne;c<J?(Z=Math.sqrt(-2*Math.log(c)),ne=(((((k[0]*Z+k[1])*Z+k[2])*Z+k[3])*Z+k[4])*Z+k[5])/((((F[0]*Z+F[1])*Z+F[2])*Z+F[3])*Z+1)):c<=1-J?(Z=c-.5,E=Z*Z,ne=(((((Y[0]*E+Y[1])*E+Y[2])*E+Y[3])*E+Y[4])*E+Y[5])*Z/(((((v[0]*E+v[1])*E+v[2])*E+v[3])*E+v[4])*E+1)):(Z=Math.sqrt(-2*Math.log(1-c)),ne=-(((((k[0]*Z+k[1])*Z+k[2])*Z+k[3])*Z+k[4])*Z+k[5])/((((F[0]*Z+F[1])*Z+F[2])*Z+F[3])*Z+1));const X=(.5*Q(-ne/Math.SQRT2)-c)*Math.sqrt(2*Math.PI)*Math.exp(ne*ne/2);return ne-X/(1+ne*X/2)}function te(c,Y){if(!(Y>0)||!Number.isFinite(c))return Number.NaN;const v=.5*V(Y/2,.5,Y/(Y+c*c));return c>0?1-v:v}function j(c,Y){if(!(c>0)||!(c<1)||!(Y>0))return Number.NaN;if(Y>1e7)return G(c);let v=-1e4,k=1e4,F=G(c);const J=pe(Y/2)+pe(.5)-pe((Y+1)/2);for(let Z=0;Z<60;Z++){const E=te(F,Y);E<c?v=F:k=F;const ne=Math.exp(-((Y+1)/2)*Math.log(1+F*F/Y)-J)/Math.sqrt(Y),M=ne>0?(E-c)/ne:0;if(Math.abs(M)<1e-12)break;const X=F-M;if(F=X>v&&X<k&&Number.isFinite(X)?X:(v+k)/2,k-v<1e-12)break}return F}}),Je("packages/modules/charts/trendline.js",function(s,K){"use strict";Object.defineProperty(s,"normaliseTrends",{enumerable:!0,get:function(){return z}}),Object.defineProperty(s,"linearTrend",{enumerable:!0,get:function(){return me}}),Object.defineProperty(s,"movingAverageTrend",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"exponentialTrend",{enumerable:!0,get:function(){return i}}),Object.defineProperty(s,"computeTrend",{enumerable:!0,get:function(){return y}}),Object.defineProperty(s,"trendText",{enumerable:!0,get:function(){return t}}),Object.defineProperty(s,"drawTrendlines",{enumerable:!0,get:function(){return g}});const W=K("packages/modules/charts/frame.js").Pool,S=K("packages/modules/charts/svg.js"),pe=S.attrs,ue=S.path,V=S.ribbonPath,Q=S.round,G=S.setText,te=S.SVG_NS,c=K("packages/modules/charts/typography.js").applySize,v=K("packages/modules/charts/styles.js").NS,k=K("packages/modules/charts/scale.js"),F=k.toNumber,J=k.toTime,E=K("packages/modules/charts/quantile.js").studentTQuantile,M=K("packages/modules/charts/format.js").r2Digits,X={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"])},oe=1e-4,ee=1-1e-4;function C(m){const b=String(m||"linear").toLowerCase();return X.linear.has(b)?"linear":X.movingAverage.has(b)?"movingAverage":X.exponential.has(b)?"exponential":null}function z(m){if(!m)return[];const b=Array.isArray(m)?m:[m],P=[];for(const l of b){if(l===!0){P.push({method:"linear"});continue}if(typeof l=="string"){const u=C(l);u&&P.push({method:u});continue}if(l&&typeof l=="object"){const u=C(l.method);u&&P.push({...l,method:u})}}return P}function ie(m,b){if(m.kind==="band")return m.centre(b);const P=m.kind==="time"?J(b):F(b);return P===null?NaN:m.of(P)}function I(m){const b=[];for(const P of m.points){const l=Number(P.y);b.push({value:Number.isFinite(l)?l:null,rawX:P.x})}return b}function $(m,b){const P=[];for(const l of m.points){const u=b.kind==="time"?J(l.x):F(l.x),x=Number(l.y);u===null||!Number.isFinite(u)||!Number.isFinite(x)||P.push({x:u,y:x})}return P.sort((l,u)=>l.x-u.x),P}function me(m,b,P={}){const l=m.length;if(l<2)return null;let u=0,x=0;for(const q of m)u+=q.x,x+=q.y;u/=l,x/=l;let n=0,d=0,A=0;for(const q of m){const se=q.x-u,T=q.y-x;n+=se*se,d+=se*T,A+=T*T}if(n===0)return null;const p=d/n,w=x-p*u,N=A===0?1:Math.max(0,Math.min(1,d*d/(n*A))),f=m[0].x,a=m[l-1].x,o=q=>({x:q,y:w+p*q}),h=[o(f),o(a)],B=[];let R=null;const U=Math.max(0,Math.floor(Number(b)||0));if(U>0&&a>f){const q=(a-f)/(l-1);if(q>0&&(B.push(o(a),o(a+U*q)),l>2)){const se=Number.isFinite(P.confidence)&&P.confidence>0&&P.confidence<1?Number(P.confidence):.95,T=1-(1-se)/2,le=Math.max(0,A-p*d),he=Math.sqrt(le/(l-2)),be=E(T,l-2),we=[];for(let ye=0;ye<=U;ye++){const Me=a+ye*q,Te=w+p*Me,xe=1/l+(Me-u)**2/n,_e=he*Math.sqrt(1+xe),$e=he*Math.sqrt(xe);we.push({x:Me,mean:Te,lower:Te-be*_e,upper:Te+be*_e,lowerMean:Te-be*$e,upperMean:Te+be*$e})}R={confidence:se,points:we}}}return{fit:h,forecast:B,band:R,stats:{method:"linear",slope:p,intercept:w,r2:N,n:l,forecast:B.length?U:0,confidence:R?R.confidence:null}}}function r(m,b){const P=Math.max(1,Math.floor(Number(b)||3)),l=[];let u=0;const x=[];for(const n of m)Number.isFinite(n.value)&&(l.push(n.value),u+=n.value,l.length>P&&(u-=l.shift())),l.length&&x.push({x:n.rawX,y:u/l.length});return x.length<2?null:{fit:x,stats:{method:"movingAverage",window:P}}}function D(m,b){const P=m.length,l=new Array(P).fill(null);let u=null,x=0;for(let n=0;n<P;n++){const d=m[n];if(!Number.isFinite(d)){u!==null&&(l[n]=u);continue}if(u===null){u=d,l[n]=d;continue}x+=(d-u)**2,u=b*d+(1-b)*u,l[n]=u}return{smoothed:l,sse:x}}function _(m,b,P){const l=m.length,u=new Array(l).fill(null);let x=null,n=null,d=0;for(let A=0;A<l;A++){const p=m[A];if(!Number.isFinite(p)){x!==null&&(x+=n,u[A]=x);continue}if(x===null){x=p,u[A]=p;continue}if(n===null){n=p-x;const f=x+n;d+=(p-f)**2;const a=x;x=b*p+(1-b)*(a+n),n=P*(x-a)+(1-P)*n,u[A]=x;continue}const w=x+n;d+=(p-w)**2;const N=x;x=b*p+(1-b)*(N+n),n=P*(x-N)+(1-P)*n,u[A]=x}return{smoothed:u,sse:d}}function e(m,b,P,l=80){const u=(Math.sqrt(5)-1)/2;let x=b,n=P,d=n-u*(n-x),A=x+u*(n-x),p=m(d),w=m(A);for(let N=0;N<l;N++)p<w?(n=A,A=d,w=p,d=n-u*(n-x),p=m(d)):(x=d,d=A,p=w,A=x+u*(n-x),w=m(A));return(x+n)/2}function i(m,b){const P=String(b.kind||b.model||"").toLowerCase()==="holt",l=m.map(w=>Number.isFinite(w.value)?w.value:null);if(l.filter(w=>w!==null).length<(P?2:1))return null;const x=w=>Math.min(ee,Math.max(oe,w));let n=Number.isFinite(b.alpha)?x(Number(b.alpha)):null,d=P&&Number.isFinite(b.beta)?x(Number(b.beta)):null;if(P){if(n===null||d===null){let w=n===null?.5:n,N=d===null?.5:d;for(let f=0;f<6;f++)n===null&&(w=e(a=>_(l,a,N).sse,oe,ee)),d===null&&(N=e(a=>_(l,w,a).sse,oe,ee));n=n===null?w:n,d=d===null?N:d}}else n===null&&(n=e(w=>D(l,w).sse,oe,ee));const A=P?_(l,n,d):D(l,n),p=[];for(let w=0;w<m.length;w++){const N=A.smoothed[w];N===null||!Number.isFinite(N)||p.push({x:m[w].rawX,y:N})}return p.length<2?null:{fit:p,stats:{method:"exponential",kind:P?"holt":"ses",alpha:n,beta:P?d:null}}}function y(m,b,P){if(b.method==="linear"){const u=$(m,P);return me(u,b.forecast,{confidence:b.confidence})}const l=I(m);return b.method==="movingAverage"?r(l,b.window||b.period):i(l,b)}function t(m,b,P,l,u,x){const n=b?` for ${b}`:"";if(m.method==="linear"){const w=Number.isFinite(m.r2)?`, R² ${m.r2.toFixed(2)}`:"";let N=`Trend (linear)${n}: slope ${P(m.slope)}${w}`;if(m.forecast>0&&l&&l.length){const f=l[l.length-1];if(N+=`; forecast ${m.forecast} step${m.forecast===1?"":"s"} ahead to ${P(f.y)}`,u&&u.points.length){const a=u.points[u.points.length-1],o=x==="confidence"||x==="mean",h=o?a.lowerMean:a.lower,B=o?a.upperMean:a.upper,R=o?"confidence":"prediction",U=Math.round(u.confidence*100);N+=`; ${U}% ${R} band ${P(h)} to ${P(B)} at the horizon`}}return N}if(m.method==="movingAverage")return`Trend (moving average, window ${m.window})${n}`;const d=m.kind==="holt"?"Holt":"single",A=Number.isFinite(m.alpha)?`, α ${m.alpha.toFixed(2)}`:"",p=Number.isFinite(m.beta)?`, β ${m.beta.toFixed(2)}`:"";return`Trend (exponential, ${d})${n}${A}${p}`}function g(m){const b=z(m.trend);if(!b.length)return[];const P=m.group.ownerDocument;let l=null;for(const n of m.group.childNodes||[])if(n&&String(n.getAttribute&&n.getAttribute("class"))===`${v}__trends`){l=n;break}l||(l=P.createElementNS(te,"g"),l.setAttribute("class",`${v}__trends`),m.group.appendChild(l)),m.clip?l.setAttribute("clip-path",`url(#${m.clip})`):l.removeAttribute("clip-path");const u=new W(l),x=[];for(const n of b)for(const d of m.series){const A=d.axis==="right"&&m.rightScale?m.rightScale:m.yScale,p=y(d,n,m.xScale);if(!p)continue;const w=m.scheme.series(d.index),N=[];for(const o of p.fit){const h=ie(m.xScale,o.x),B=A.of(o.y);!Number.isFinite(h)||!Number.isFinite(B)||N.push(N.length?"L":"M",Q(h),Q(B))}if(N.length<4)continue;if(pe(u.next("path",`${v}__trend`),{d:ue(N),fill:"none",stroke:w,"data-series":d.index}),n.band!==!1&&p.band&&p.band.points.length>=2){const o=n.band==="confidence"||n.band==="mean",h=[];for(const R of p.band.points){const U=ie(m.xScale,R.x),q=o?R.lowerMean:R.lower,se=o?R.upperMean:R.upper,T=A.of(q),le=A.of(se);!Number.isFinite(U)||!Number.isFinite(T)||!Number.isFinite(le)||h.push({x:Q(U),lower:Q(T),upper:Q(le)})}const B=V(h);B&&pe(u.next("path",`${v}__trend-band`),{d:B,fill:w,"fill-opacity":.15,stroke:"none","data-series":d.index})}const a=p.forecast||[];if(a.length>=2){const o=[];for(const h of a){const B=ie(m.xScale,h.x),R=A.of(h.y);!Number.isFinite(B)||!Number.isFinite(R)||o.push(o.length?"L":"M",Q(B),Q(R))}o.length>=4&&pe(u.next("path",`${v}__trend-forecast`),{d:ue(o),fill:"none",stroke:w,"data-series":d.index})}if(n.label!==!1&&p.stats.method==="linear"&&Number.isFinite(p.stats.r2)){const o=p.fit[p.fit.length-1],h=u.next("text",`${v}__trend-label`);c(h,m.size),pe(h,{x:Q(ie(m.xScale,o.x)),y:Q(A.of(o.y))-4,"text-anchor":"end",fill:w}),G(h,m.grid.messages.t("chart.r2",{value:M(m.grid,p.stats.r2)}))}x.push({text:t(p.stats,d.label,m.format,a,n.band===!1?null:p.band,n.band)})}return u.finish(),x.filter(n=>n.text)}}),Je("packages/modules/charts/cartesian.js",function(s,K){"use strict";Object.defineProperty(s,"CARTESIAN",{enumerable:!0,get:function(){return h}}),Object.defineProperty(s,"axisWindowSpan",{enumerable:!0,get:function(){return se}}),Object.defineProperty(s,"rollingDomain",{enumerable:!0,get:function(){return T}}),Object.defineProperty(s,"WINDOW_LEAD",{enumerable:!0,get:function(){return le}}),Object.defineProperty(s,"aheadOfWindow",{enumerable:!0,get:function(){return be}}),Object.defineProperty(s,"staleWindow",{enumerable:!0,get:function(){return we}}),Object.defineProperty(s,"windowedBound",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(s,"drawFits",{enumerable:!0,get:function(){return We}}),Object.defineProperty(s,"drawConfidenceBand",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(s,"drawBoundErrorBars",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(s,"drawForest",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(s,"drawReferenceLines",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(s,"drawCartesian",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(s,"HIT_TOLERANCE",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(s,"nearestDrawnPoint",{enumerable:!0,get:function(){return zt}}),Object.defineProperty(s,"nearestCategory",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(s,"categoryKeyAt",{enumerable:!0,get:function(){return Rt}});const Ae=K("packages/modules/charts/axis.js"),W=Ae.drawAxisLines,S=Ae.drawAxisTitle,pe=Ae.drawBandLabels,ue=Ae.drawCategoryAxis,V=Ae.drawContinuousAxis,Q=Ae.drawMeasureAxis,G=Ae.overhangFor,te=Ae.setPlotClip,j=K("packages/modules/charts/frame.js"),c=j.Pool,Y=j.shouldRotate,v=K("packages/modules/charts/format.js"),k=v.formatters,F=v.r2Digits,J=K("packages/modules/charts/scale.js"),Z=J.bandScale,E=J.extent,ne=J.isNumber,M=J.key,X=J.linearScale,oe=J.measureDomain,ee=J.timeScale,C=J.toNumber,z=J.toTime,ie=K("packages/modules/charts/svg.js"),I=ie.attrs,$=ie.path,me=ie.ribbonPath,r=ie.round,D=ie.setText,_=ie.SVG_NS,i=K("packages/modules/charts/styles.js").NS,t=K("packages/modules/charts/labels.js").drawDataLabels,m=K("packages/modules/charts/dense.js").downsample,P=K("packages/modules/charts/scheme.js").resolveScheme,u=K("packages/modules/charts/typography.js").applySize,n=K("packages/modules/charts/combo.js").drawRightAxis,d=K("packages/modules/charts/annotations.js"),A=d.drawAnnotations,p=d.overlayLayer,N=K("packages/modules/charts/trendline.js").drawTrendlines,a=K("packages/core/src/internal/util.js").warnOnce,o=3.5,h=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"}});function B(O){const fe=[];for(let de=0;de<O.length;de++){const ge=O[de];if(de===0){fe.push("M",ge.x,ge.y);continue}fe.push("L",ge.x,O[de-1].y),fe.push("L",ge.x,ge.y)}return fe}function R(O,fe,de){if(de)return[0,100];if(!fe){const ke=[];for(const Oe of O)for(const Ne of Oe.points)ke.push(Ne.y);return ke}const ge=[],Se=[],ce=O[0]?O[0].points.length:0;for(let ke=0;ke<ce;ke++){let Oe=0,Ne=0;for(const Ce of O){const je=Ce.points[ke]?Ce.points[ke].y:null;ne(je)&&(je>=0?Oe+=je:Ne+=je)}ge.push(Oe),Se.push(Ne)}return[...ge,...Se]}function U(O){const fe=[0];if(!O)return fe;let de=0;for(const ge of O.points)ne(ge.y)&&(de+=ge.y,fe.push(de));return fe}function q(O,fe){const de=new Float64Array(O),ge=new Float64Array(O);return{take(Se,ce){const ke=fe?fe[Se]:0,Oe=fe?ke?ce/ke*100:0:ce;if(Oe>=0){const Ce=de[Se];return de[Se]+=Oe,[Ce,de[Se]]}const Ne=ge[Se];return ge[Se]+=Oe,[Ne,ge[Se]]}}}function se(O){const fe=O&&O.window;if(!fe||typeof fe!="object")return 0;const de=Number(fe.span);return!Number.isFinite(de)||de<=0?0:fe.kind!=="time"?(a("chart.axis.window.kind",`axis window kind "${fe.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):de}function T(O,fe,de){const ge=de+O*le;let Se=de;for(const ce of fe)Number.isFinite(ce)&&ce>Se&&ce<=ge&&(Se=ce);return{min:Se-O,max:Se}}const le=.25;function he(O,fe,de){const ge=se(fe);if(!ge||!O||!Array.isArray(O.categories))return null;const Se=h[de];if(!Se||Se.horizontal||de==="bar"||O.kind==="category")return null;const ce=O.categories.map(ke=>O.kind==="time"?z(ke):C(ke));return{span:ge,values:ce}}function be(O,fe,de,ge){const Se=he(O,fe,de);if(!Se)return null;const ce=Se.span*le;let ke=0,Oe=0;for(const Ne of Se.values)Ne===null||!Number.isFinite(Ne)||Ne-ge<=ce||(ke+=1,Ne-ge>Oe&&(Oe=Ne-ge));return ke?{span:Se.span,limit:ce,count:ke,lead:Oe}:null}function we(O,fe,de,ge){const Se=he(O,fe,de);if(!Se)return null;const{span:ce}=Se,ke=Se.values.filter(je=>je!==null&&Number.isFinite(je));if(!ke.length)return null;const{min:Oe,max:Ne}=T(ce,ke,ge);let Ce=-1/0;for(const je of ke){if(je>=Oe&&je<=Ne)return null;je<Oe&&je>Ce&&(Ce=je)}return Ce===-1/0?{span:ce,newest:null,age:null,points:ke.length}:{span:ce,newest:Ce,age:ge-Ce,points:ke.length}}function ye(O,fe,de,ge){const Se=he(O,fe,de);if(!Se)return O;const{span:ce,values:ke}=Se,Oe=ke.filter(Re=>Re!==null&&Number.isFinite(Re));if(!Oe.length)return O;const{min:Ne,max:Ce}=T(ce,Oe,ge),je=[];for(let Re=0;Re<ke.length;Re++){const De=ke[Re];(De===null||!Number.isFinite(De)||De>=Ne&&De<=Ce)&&je.push(Re)}return je.length===ke.length?O:{...O,categories:je.map(Re=>O.categories[Re]),labels:Array.isArray(O.labels)?je.map(Re=>O.labels[Re]):O.labels,series:(O.series||[]).map(Re=>({...Re,points:Array.isArray(Re.points)?je.map(De=>Re.points[De]).filter(De=>De!==void 0):Re.points})),windowed:ke.length-je.length}}function Me(O,fe,de,ge){const Se=[fe.left,fe.right],ce=se(ge);if(O.kind==="category"||de==="bar")return ce&&a("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."),Z(O.categories,Se,de==="bar"?.2:.4);const ke=O.kind==="time"?O.categories.map(z):O.categories.map(C);if(O.kind==="time"&&!ce){const Ne=E(ke);if(Ne&&Ne.min===Ne.max)return ee({min:Ne.min-3e4,max:Ne.max+3e4},Se)}const Oe=ce?T(ce,ke,Date.now()):oe(ke,{zero:!1,nice:O.kind!=="time"});return O.kind==="time"?ee(Oe,Se):X(Oe,Se)}function Te(O,fe){if(O.kind==="band")return O.centre(fe.x);const de=O.kind==="time"?z(fe.x):C(fe.x);return de===null?NaN:O.of(de)}function xe(O){const{series:fe,xScale:de,yScale:ge,baseline:Se,fill:ce,colour:ke,stack:Oe}=O,Ne=[],Ce=[];let je=!1;const Re=[];for(let Ve=0;Ve<fe.points.length;Ve++){const Qe=fe.points[Ve],st=r(Te(de,Qe));if(!ne(Qe.y)||Number.isNaN(st)){je=!1;continue}Re[Ve]=!0;const rt=Qe.y,Ze=Oe?Oe.take(Ve,rt):null,nt=r(ge.of(Ze?Ze[1]:rt)),at=r(ge.of(Ze?Ze[0]:Se));O.step&&je&&Ne.push("L",st,O.previous),Ne.push(je?"L":"M",st,nt),O.previous=nt,ce&&Ce.push(je?"L":"M",st,nt),ce&&!je&&Ce.push("M",st,nt),je=!0,Qe.px=st,Qe.py=nt,Qe.pbase=at}if(I(O.pool.next("path",`${i}__line ${i}__mark`),{d:Ne.length?$(Ne):"",stroke:ke,"data-series":O.index}),!ce){_e({...O,placed:Re});return}const De=[];let Ge=[];const tt=()=>{if(Ge.length<2){Ge=[];return}De.push("M",Ge[0].x,Ge[0].base);for(const Ve of Ge)De.push("L",Ve.x,Ve.y);for(let Ve=Ge.length-1;Ve>=0;Ve--)De.push("L",Ge[Ve].x,Ge[Ve].base);De.push("Z"),Ge=[]};for(const Ve of fe.points){if(!ne(Ve.y)||Ve.px===void 0){tt();continue}Ge.push({x:Ve.px,y:Ve.py,base:Ve.pbase})}tt(),I(O.pool.next("path",`${i}__area ${i}__mark`),{d:De.length?$(De):"",fill:ke,"data-series":O.index}),_e({...O,placed:Re})}function _e(O){const{series:fe,placed:de}=O;for(let ge=0;ge<fe.points.length;ge++){if(!de[ge]||de[ge-1]||de[ge+1])continue;const Se=fe.points[ge];I(O.pool.next("circle",`${i}__point ${i}__mark`),{cx:Se.px,cy:Se.py,r:o,fill:O.colour,"data-series":O.index,"data-point":ge})}}function $e(O,fe){const de=O&&O.range;if(!Array.isArray(de)||de.length!==2)return fe;const[ge,Se]=de;return!Number.isFinite(ge)||!Number.isFinite(Se)||!Number.isFinite(fe)?fe:Math.min(Math.max(ge,Se),Math.max(Math.min(ge,Se),fe))}function Pe(O){const{series:fe,xScale:de,yScale:ge,baseline:Se,colour:ce,stack:ke,slot:Oe}=O;for(let Ne=0;Ne<fe.points.length;Ne++){const Ce=fe.points[Ne];if(!ne(Ce.y))continue;const je=de.of(Ce.x);if(Number.isNaN(je))continue;const Re=Ce.y,De=ke?ke.take(Ne,Re):[Se,Re],Ge=$e(ge,ge.of(De[1])),tt=$e(ge,ge.of(De[0])),Ve=O.pool.next("rect",`${i}__bar ${i}__mark`);I(Ve,{x:r(je+Oe.offset),y:r(Math.min(Ge,tt)),width:r(Math.max(0,Oe.width)),height:r(Math.max(1,Math.abs(tt-Ge))),fill:ce,"data-series":O.index,"data-point":Ne}),Ce.px=r(je+Oe.offset+Oe.width/2),Ce.py=r(Math.min(Ge,tt)),Ce.pbase=r(Math.max(Ge,tt))}}function Ie(O){const{series:fe,xScale:de,yScale:ge}=O;let Se=0;for(let ce=0;ce<fe.points.length;ce++){const ke=fe.points[ce];if(!ne(ke.y))continue;const Oe=ke.y,Ne=ce===fe.points.length-1,Ce=O.total&&Ne?0:Se,je=(O.total&&Ne,Se+Oe);O.total,Se+=Oe;const Re=$e(ge,ge.of(Math.max(Ce,je))),De=$e(ge,ge.of(Math.min(Ce,je))),Ge=O.pool.next("rect",`${i}__bar ${i}__mark`);I(Ge,{x:r(de.of(ke.x)),y:r(Re),width:r(de.bandwidth),height:r(Math.max(1,De-Re)),fill:Oe>=0?O.positive:O.negative,"data-series":O.index,"data-point":ce}),ke.px=r(de.of(ke.x)+de.bandwidth/2),ke.py=r(Re)}}function He(O){const{series:fe,valueScale:de,baseline:ge,colour:Se,stack:ce,slot:ke}=O;for(let Oe=0;Oe<fe.points.length;Oe++){const Ne=fe.points[Oe];if(!ne(Ne.y))continue;const Ce=O.bandScale.of(Ne.x);if(Number.isNaN(Ce))continue;const je=Ne.y,Re=ce?ce.take(Oe,je):[ge,je],De=$e(de,de.of(Re[0])),Ge=$e(de,de.of(Re[1]));I(O.pool.next("rect",`${i}__bar ${i}__mark`),{x:r(Math.min(De,Ge)),y:r(Ce+ke.offset),width:r(Math.max(1,Math.abs(Ge-De))),height:r(Math.max(0,ke.width)),fill:Se,"data-series":O.index,"data-point":Oe}),Ne.px=r(Ge),Ne.py=r(Ce+ke.offset+ke.width/2),Ne.pbase=r(De)}}function We(O){const fe=O.group.ownerDocument;let de=null;for(const ce of O.group.childNodes||[])if(ce&&String(ce.getAttribute&&ce.getAttribute("class"))===`${i}__fits`){de=ce;break}de||(de=fe.createElementNS(_,"g"),de.setAttribute("class",`${i}__fits`),O.group.appendChild(de));const ge=new c(de),Se=[];for(const ce of O.series){let ke=0,Oe=0,Ne=0;for(const nt of ce.points){const at=Number(nt.x),ft=Number(nt.y);!Number.isFinite(at)||!Number.isFinite(ft)||(ke++,Oe+=at,Ne+=ft)}if(ke<2)continue;const Ce=Oe/ke,je=Ne/ke;let Re=0,De=0,Ge=0,tt=1/0,Ve=-1/0;for(const nt of ce.points){const at=Number(nt.x),ft=Number(nt.y);if(!Number.isFinite(at)||!Number.isFinite(ft))continue;const lt=at-Ce,Nt=ft-je;Re+=lt*lt,De+=lt*Nt,Ge+=Nt*Nt,at<tt&&(tt=at),at>Ve&&(Ve=at)}if(Re===0)continue;const Qe=De/Re,st=je-Qe*Ce,rt=Ge===0?1:Math.max(0,Math.min(1,De*De/(Re*Ge))),Ze=O.scheme.series(ce.index);if(I(ge.next("path",`${i}__fit`),{d:$(["M",r(O.xScale.of(tt)),r(O.yScale.of(st+Qe*tt)),"L",r(O.xScale.of(Ve)),r(O.yScale.of(st+Qe*Ve))]),fill:"none",stroke:Ze,"data-series":ce.index}),O.showR2){const nt=ge.next("text",`${i}__fit-label`);u(nt,O.size),I(nt,{x:r(O.xScale.of(Ve)),y:r(O.yScale.of(st+Qe*Ve))-4,"text-anchor":"end",fill:Ze}),D(nt,O.grid.messages.t("chart.r2",{value:F(O.grid,rt)}))}Se.push({key:ce.key,slope:Qe,intercept:st,r2:rt,n:ke})}return ge.finish(),Se}function ot(O){const fe=O.group.ownerDocument;let de=null;for(const Ce of O.group.childNodes||[])if(Ce&&String(Ce.getAttribute&&Ce.getAttribute("class"))===`${i}__band`){de=Ce;break}de||(de=fe.createElementNS(_,"g"),de.setAttribute("class",`${i}__band`),O.group.firstChild?O.group.insertBefore(de,O.group.firstChild):O.group.appendChild(de));const ge=new c(de),Se=O.band&&Array.isArray(O.band.points)?O.band.points:[],ce=Number.isFinite(O.index)?Number(O.index):0,ke=O.scheme.series(ce),Oe=Number.isFinite(O.opacity)?Number(O.opacity):.15,Ne=[];for(const Ce of Se){const je=Number(Ce.x),Re=Number(Ce.lower),De=Number(Ce.upper);if(!Number.isFinite(je)||!Number.isFinite(Re)||!Number.isFinite(De))continue;const Ge=Number(Ce.yhat);Ne.push({x:r(O.xScale.of(je)),lower:r(O.yScale.of(Re)),upper:r(O.yScale.of(De)),yhat:Number.isFinite(Ge)?r(O.yScale.of(Ge)):null})}if(Ne.length>=2&&(I(ge.next("path",`${i}__band-fill`),{d:me(Ne),fill:ke,"fill-opacity":Oe,stroke:"none","data-series":ce}),O.line!==!1)){const Ce=[];let je=!1;for(const Re of Ne){if(Re.yhat===null){je=!1;continue}Ce.push(je?"L":"M",Re.x,Re.yhat),je=!0}I(ge.next("path",`${i}__band-line`),{d:Ce.length?$(Ce):"",fill:"none",stroke:ke,"data-series":ce})}return ge.finish(),{points:Ne.length,confidence:O.band&&Number.isFinite(O.band.confidence)?Number(O.band.confidence):null}}function dt(O){const fe=O.group.ownerDocument;let de=null;for(const Ne of O.group.childNodes||[])if(Ne&&String(Ne.getAttribute&&Ne.getAttribute("class"))===`${i}__whiskers`){de=Ne;break}de||(de=fe.createElementNS(_,"g"),de.setAttribute("class",`${i}__whiskers`),O.group.appendChild(de));const ge=new c(de),Se=Number.isFinite(O.cap)?Number(O.cap):4,ce=O.colour||"currentColor",ke=O.orient!=="v";let Oe=0;for(const Ne of O.points||[]){const Ce=Number(Ne.main),je=Number(Ne.lo),Re=Number(Ne.hi);if(!Number.isFinite(Ce)||!Number.isFinite(je)||!Number.isFinite(Re))continue;const De=ke?["M",je,Ce,"L",Re,Ce,"M",je,Ce-Se,"L",je,Ce+Se,"M",Re,Ce-Se,"L",Re,Ce+Se]:["M",Ce,je,"L",Ce,Re,"M",Ce-Se,je,"L",Ce+Se,je,"M",Ce-Se,Re,"L",Ce+Se,Re];I(ge.next("path",`${i}__whisker`),{d:$(De),stroke:ce,fill:"none"}),Oe++}return ge.finish(),Oe}function ut(O){const fe=O.scheme||P(),de=O.typography||{small:O.fontSize||11,axisTitle:11},{plot:ge,bound:Se}=O,ce=Se.series[0]&&Se.series[0].points||[],ke=ce.map(Ge=>Ge.label),Oe=fe.series(0),Ne=Z(ke,[ge.top,ge.bottom],.4),Ce=[0];for(const Ge of ce)for(const tt of[Ge.x,Ge.lower,Ge.upper])Number.isFinite(tt)&&Ce.push(tt);const je=X(oe(Ce,{zero:!1}),[ge.left,ge.right]);dt({group:O.groups.overlay,orient:"h",colour:Oe,points:ce.map(Ge=>({main:r(Ne.centre(Ge.label)),lo:r(je.of(Ge.lower)),hi:r(je.of(Ge.upper))}))});const Re=new c(O.groups.marks);let De=0;for(const Ge of ce)Number.isFinite(Ge.x)&&(I(Re.next("circle",`${i}__point ${i}__mark`),{cx:r(je.of(Ge.x)),cy:r(Ne.centre(Ge.label)),r:o,fill:Oe}),De++);return Re.finish(),bt({group:O.groups.rules,plot:ge,scale:je,lines:[{value:0}]}),V({group:O.groups.axis,plot:ge,scale:je,format:k(O.grid,{kind:"linear",step:(je.domain.max-je.domain.min)/5}),config:{},grid:O.grid,size:de.small}),pe({group:O.groups.labels,plot:ge,scale:Ne,labels:ke,fontSize:de.small,config:{}}),{series:[],marks:De}}function bt(O){const fe=new c(p(O.group,`${i}__reflines`));for(const de of O.lines||[]){if(!ne(de.value))continue;const ge=r(O.scale.of(de.value));if(I(fe.next("path",`${i}__reference`),{d:$(["M",r(O.plot.left),ge,"L",r(O.plot.right),ge]),stroke:de.colour||"currentColor","stroke-dasharray":"4 3",fill:"none"}),!de.label)continue;const Se=fe.next("text",`${i}__reference-label`);I(Se,{x:r(O.plot.right-4),y:ge-4,"text-anchor":"end"}),D(Se,de.label)}fe.finish()}function yt(O){const{series:fe,xScale:de,yScale:ge,colour:Se}=O,ce=O.size||null;for(let ke=0;ke<fe.points.length;ke++){const Oe=fe.points[ke];if(!ne(Oe.y))continue;const Ne=r(Te(de,Oe));if(Number.isNaN(Ne))continue;const Ce=r(ge.of(Oe.y));I(O.pool.next("circle",`${i}__point ${i}__mark`),{cx:Ne,cy:Ce,r:ce&&ne(Oe.size)?r(ce.of(Oe.size)):o,fill:Se,"fill-opacity":ce?.7:1,"data-series":O.index,"data-point":ke}),Oe.px=Ne,Oe.py=Ce}}function vt(O){const{group:fe,series:de,xScale:ge,yScale:Se,options:ce}=O,ke=O.grid&&O.grid.statistics,Oe=ke&&typeof ke.intervalOf=="function"?(Ve,Qe)=>ke.intervalOf(Ve,Qe):null,Ne=new c(p(fe,`${i}__errorbars`)),Ce=Number.isFinite(Number(ce.confidence))?Number(ce.confidence):.95,je=4;let Re=0,De=0,Ge=0,tt=0;for(const Ve of de)for(const Qe of Ve.points){if(Qe.y===null||Qe.y===void 0)continue;De++;const st=Array.isArray(Qe.values)&&Qe.values.length===1;st&&Ge++;let rt=null,Ze=null;if(ce.of!==void 0&&Number.isFinite(Number(Qe[ce.of]))){const lt=Math.abs(Number(Qe[ce.of]));rt=Qe.y-lt,Ze=Qe.y+lt}else if(Array.isArray(Qe.values)&&Qe.values.length>1&&Oe){const lt=Oe(Qe.values,Ce);lt&&(rt=lt.lower,Ze=lt.upper)}if(rt===null||!Number.isFinite(rt)||!Number.isFinite(Ze)){st&&tt++;continue}const nt=r(ge.of(Qe.xKey!==void 0?Qe.xKey:Qe.x)+(ge.bandwidth?ge.bandwidth/2:0)),at=r(Se.of(Ze)),ft=r(Se.of(rt));I(Ne.next("path",`${i}__error-bar ${i}__mark`),{d:$(["M",nt-je,at,"L",nt+je,at,"M",nt,at,"L",nt,ft,"M",nt-je,ft,"L",nt+je,ft]),fill:"none",stroke:"currentColor","data-lower":rt,"data-upper":Ze}),Re++}return Ne.finish(),{drawn:Re,marks:De,single:Ge,singleSkipped:tt}}function Mt(O){const fe=O.scheme||P(),de=O.axis||{x:{},y:{},y2:{}},ge=O.typography||{small:O.fontSize||11,axisTitle:11},{bound:Se,plot:ce,type:ke}=O,Oe=h[ke]||h.line,Ne=Se.series.filter(qe=>!O.hidden.has(qe.key)),Ce=!!Oe.horizontal,je=!Ce&&ke!=="waterfall"?Ne.filter(qe=>qe.axis==="right"):[],Re=je.length?Ne.filter(qe=>qe.axis!=="right"):Ne,De=je.length>0,Ge=(ke==="bar"||ke==="area"||ke==="horizontalBar")&&!De,tt=O.stack==="percent"&&Ge&&Re.length>1,Ve=(tt||!!O.stack)&&Re.length>1&&Ge,Qe=ke==="waterfall"?U(Ne[0]):R(Re,Ve,tt),st=O.domain||oe(Qe,{zero:Oe.zero,min:de.y.min,max:de.y.max}),rt=Ce?X(st,[ce.left,ce.right]):X(st,[ce.bottom,ce.top]),Ze=Ce?Z(Se.categories,[ce.top,ce.bottom],.2):Me(Se,ce,ke,de.x),nt=st.min<=0&&st.max>=0?0:st.min,at=je.some(qe=>(qe.mark||(ke==="bar"?"bar":ke))==="bar"),ft=De?oe(R(je,!1,!1),{zero:at,min:de.y2.min,max:de.y2.max}):null,lt=ft?X(ft,[ce.bottom,ce.top]):null,Nt=k(O.grid,{kind:"linear",step:(st.max-st.min)/5}),Et=O.axes!==!1;if(Et&&Q({gridGroup:O.groups.grid,axisGroup:O.groups.axis,plot:ce,scale:rt,format:Nt,horizontal:Ce,config:de.y,grid:O.grid,size:ge.small}),Et&&(Ce?pe({group:O.groups.overlay,plot:ce,scale:Ze,labels:Se.labels,fontSize:ge.small,config:de.x}):Ze.kind==="band"?ue({group:O.groups.overlay,plot:ce,scale:Ze,labels:Se.labels,fontSize:ge.small,rotated:Y(Se.labels,Ze.step,ge.small,de.x.every),config:de.x}):V({group:O.groups.overlay,plot:ce,scale:Ze,format:k(O.grid,{kind:Se.kind,span:Ze.domain.max-Ze.domain.min,step:(Ze.domain.max-Ze.domain.min)/5}),config:de.x,grid:O.grid,size:ge.small})),Et&&(W({group:O.groups.rules,plot:ce}),S({group:O.groups.axis,plot:ce,text:de.y.title,side:Ce?"bottom":"left",size:ge.axisTitle}),S({group:O.groups.axis,plot:ce,text:de.x.title,side:Ce?"left":"bottom",size:ge.axisTitle})),Et&<){n({group:O.groups.axis,plot:ce,scale:lt,colour:fe.series(je[0].index),format:k(O.grid,{kind:"linear",step:(ft.max-ft.min)/5})});const qe=de.y2.title||(je.length===1?je[0].label:"");S({group:O.groups.axis,plot:ce,text:qe,side:"right",size:ge.axisTitle}),!de.y.title&&Re.length===1&&Re[0].label&&S({group:O.groups.axis,plot:ce,text:Re[0].label,side:"left",size:ge.axisTitle})}const Gt=Number.isFinite(O.downsampleTo)?Number(O.downsampleTo):Math.max(2,Math.round(ce.width));let Lt=!1;if(Oe.marks==="path"||ke==="scatter"||ke==="bubble"){for(const qe of Ne)if(qe.kept=null,qe.points.length>Gt*1.5){const it=qe.points.map((gt,kt)=>({x:kt,y:gt.y,point:gt})),mt=m(it,Gt);qe.points=mt.map(gt=>gt.point),qe.kept=mt.map(gt=>gt.x),Lt=!0}}O.pool||te(O.groups,ce,G(ke));const At=O.pool||new c(O.groups.marks),en=tt?Se.categories.map((qe,it)=>Ne.reduce((mt,gt)=>{const kt=gt.points[it]?gt.points[it].y:null;return ne(kt)?mt+Math.abs(kt):mt},0)):null,Bt=Ve?q(Se.categories.length,en):null,Ut=De?Ne.filter(qe=>(qe.mark||(ke==="bar"?"bar":ke))==="bar"):Ne,tn=De?Math.max(1,Ut.length):Math.max(1,Ne.length),Tt=Ze.kind==="band"?Ve?Ze.bandwidth:Ze.bandwidth/tn:0,Ft=new Map;for(const qe of Ut)Ft.set(qe.key,Ft.size);for(let qe=0;qe<Ne.length;qe++){const it=Ne[qe],mt=fe.series(it.index),gt=it.axis==="right"&<?lt:rt,kt=De?it.mark||(ke==="bar"?"bar":ke):ke,Wt=De&&Ft.has(it.key)?Ft.get(it.key):qe;ke==="horizontalBar"?He({pool:At,series:it,bandScale:Ze,valueScale:rt,baseline:nt,colour:mt,stack:Bt,index:it.index,slot:{offset:Ve?0:qe*Tt,width:Tt}}):ke==="waterfall"?Ie({pool:At,series:it,xScale:Ze,yScale:rt,index:it.index,total:!0,positive:fe.positive,negative:fe.negative}):kt==="bar"?Pe({pool:At,series:it,xScale:Ze,yScale:gt,baseline:gt===lt?ft.min<=0&&ft.max>=0?0:ft.min:nt,colour:mt,stack:Bt,index:it.index,slot:{offset:Ve?0:Wt*Tt,width:Tt}}):ke==="scatter"||ke==="bubble"?yt({pool:At,series:it,xScale:Ze,yScale:gt,colour:mt,index:it.index,size:ke==="bubble"?O.sizes:null}):xe({pool:At,series:it,xScale:Ze,yScale:gt,baseline:nt,fill:kt==="area"||kt==="rangeArea",step:kt==="step",colour:mt,stack:Bt,index:it.index})}O.pool||At.finish(),O.band&&typeof Ze.invert=="function"&&ot({group:O.groups.overlay,band:O.band,xScale:Ze,yScale:rt,scheme:fe,index:0,line:O.band.line!==!1&&!O.fit}),O.fit&&(ke==="scatter"||ke==="bubble")&&typeof Ze.invert=="function"&&We({group:O.groups.overlay,series:Ne,xScale:Ze,yScale:rt,plot:ce,scheme:fe,grid:O.grid,size:ge.small,showR2:O.fit!=="line"});let Ct=null;O.trend&&(Ct=N({group:O.groups.overlay,series:Ne,xScale:Ze,yScale:rt,rightScale:lt,plot:ce,scheme:fe,trend:O.trend,grid:O.grid,format:qe=>Nt.tick(qe),size:ge.small,clip:O.groups.boxClipId}));let _t=null;if(O.error&&(_t=vt({group:O.groups.overlay,series:Ne,xScale:Ze,yScale:rt,grid:O.grid,options:O.error===!0?{}:O.error})),O.labels&&O.labels.show&&t({group:O.groups.labels,series:Ne,plot:ce,options:O.labels,grid:O.grid,size:ge.small,horizontal:Ce}),O.reference&&O.reference.length){const qe=O.reference.filter(mt=>!(mt.axis==="right"||mt.axis==="y2")),it=lt?O.reference.filter(mt=>mt.axis==="right"||mt.axis==="y2"):[];qe.length&&bt({group:O.groups.overlay,plot:ce,scale:rt,lines:qe}),it.length&&bt({group:O.groups.overlay,plot:ce,scale:lt,lines:it})}let It=null;O.annotations&&O.annotations.length&&(It=A({group:O.groups.overlay,plot:ce,xScale:Ze,yScale:rt,rightScale:lt,series:Ne,annotations:O.annotations,dual:De,format:qe=>Nt.tick(qe),size:ge.small}));const nn=Array.isArray(Ct)&&Ct.length?[...It||[],...Ct]:It;return{xScale:Ze,yScale:rt,rightScale:lt,dual:De,series:Ne,horizontal:Ce,percent:tt,plot:ce,errorBars:_t,annotations:nn,trendlines:Ct,reduced:Lt}}const xt=32;function zt(O){const{series:fe,xScale:de,at:ge}=O,Se=Number.isFinite(O.tolerance)?Number(O.tolerance):xt,ce=[];let ke=-1,Oe=1/0;for(const Ne of fe){let Ce=null,je=-1,Re=1/0;const De=Ne.points||[];for(let Ge=0;Ge<De.length;Ge++){const tt=De[Ge];if(!tt||!ne(tt.y))continue;const Ve=Te(de,tt);if(Number.isNaN(Ve))continue;const Qe=Math.abs(Ve-ge);Qe>=Re||(Re=Qe,Ce=tt,je=Array.isArray(Ne.kept)?Ne.kept[Ge]:Ge)}!Ce||Re>Se||(ce.push({series:Ne,point:Ce}),Re<Oe&&(Oe=Re,ke=je))}return ke<0?null:{index:ke,entries:ce}}function $t(O){const{bound:fe,xScale:de,at:ge}=O;if(!fe.categories.length)return-1;if(de.kind==="band"){const ke=Math.floor((ge-de.range[0])/(de.step||1));return ke>=0&&ke<fe.categories.length?ke:-1}let Se=-1,ce=1/0;for(let ke=0;ke<fe.categories.length;ke++){const Oe=de.kind==="time"?z(fe.categories[ke]):C(fe.categories[ke]);if(Oe===null)continue;const Ne=Math.abs(de.of(Oe)-ge);Ne<ce&&(ce=Ne,Se=ke)}return Se}function Rt(O,fe){return fe<0||fe>=O.categories.length?"":M(O.categories[fe])}}),Je("packages/modules/charts/drawable.js",function(s,K){"use strict";Object.defineProperty(s,"REASONS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"DRAWABLE",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"namedColumns",{enumerable:!0,get:function(){return te}}),Object.defineProperty(s,"missingColumns",{enumerable:!0,get:function(){return j}}),Object.defineProperty(s,"bucketKey",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"bucketMessage",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(s,"continuousX",{enumerable:!0,get:function(){return v}}),Object.defineProperty(s,"drawability",{enumerable:!0,get:function(){return k}});const Ae=K("packages/modules/charts/scale.js"),W=Ae.extent,S=Ae.toNumber,pe=Ae.toTime,V=K("packages/modules/charts/cartesian.js").staleWindow,Q=Object.freeze({EMPTY:"empty",INCOMPLETE:"incomplete",STALE:"stale",MISSING_COLUMN:"missing-column",NO_DOMAIN:"no-domain",BUCKETED:"bucketed"}),G=Object.freeze({ok:!0});function te(F){if(!F||typeof F!="object")return[];const J=[],Z=(E,ne)=>{typeof ne=="string"&&ne?J.push({key:E,col:ne}):ne&&typeof ne=="object"&&typeof ne.col=="string"&&ne.col&&J.push({key:E,col:ne.col})};if(Array.isArray(F.points))return[];if(Z("x",F.x),Z("code",F.code),Z("y",F.y),Z("series",F.series),Z("size",F.size),Z("source",F.source),Z("target",F.target),typeof F.multiples=="string"&&Z("multiples",F.multiples),Array.isArray(F.measures))for(const E of F.measures)Z("measures",E);return J}function j(F,J){const Z=F&&F.columns;return!Z||typeof Z.get!="function"?[]:te(J).filter(({col:E})=>!Z.get(E))}function c(F){return`chart:x:date-bucket:${F}`}function Y(F,J,Z){return`chart x column ${JSON.stringify(F)} is a 'date', which stores a calendar day, so all ${J} rows collapsed into one point and were reduced by '${Z}'. For a series inside a single day, type the column 'datetime' or bind epoch milliseconds.`}function v(F,J){return!J||J.kind!=="time"&&J.kind!=="linear"?!1:F!=="bar"&&F!=="horizontalBar"}function k(F){const{grid:J,spec:Z,type:E,bound:ne}=F,M=F.id===void 0?"":String(F.id),X=Number.isFinite(F.now)?Number(F.now):Date.now(),oe=(z,ie,I,$=!0)=>({ok:!1,reason:z,key:I||`chart:${M}:${z}`,message:ie,tell:$}),ee=j(J,Z);if(ee.length){const z=ee.map(I=>`${I.key}: ${JSON.stringify(I.col)}`).join(", "),ie=J&&J.columns&&typeof J.columns.all=="function"?J.columns.all().map(I=>I.id||I.field).filter(Boolean):[];return oe(Q.MISSING_COLUMN,`chart ${z} ${ee.length>1?"name columns":"names a column"} this grid does not have, so there is nothing to read and nothing to draw.${ie.length?` The columns it does have: ${ie.slice(0,12).map(I=>JSON.stringify(I)).join(", ")}${ie.length>12?", …":""}.`:""} Bind a column the grid declares, or declare the column.`)}if(ne&&ne.empty){const z=J&&J.rows&&typeof J.rows.count=="function"?J.rows.count():0;return oe(Q.EMPTY,z?`chart bound nothing from the ${z} 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,z>0)}if(E==="candlestick"&&(!ne||!ne.series||ne.series.length<4)){const z=ne&&ne.series?ne.series.length:0;return oe(Q.INCOMPLETE,`a candlestick chart needs four measures — open, high, low and close, in that order — and ${z===0?"none was":`only ${z} were`} bound. Pass them as measures: [open, high, low, close].`)}const C=V(ne,F.axis&&F.axis.x,E,X);if(C){const z=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 oe(Q.STALE,`the rolling x window covers the last ${C.span} ms, ${z}, 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:${M}:x:window:stale:${Z&&Z.x||""}`,C.newest!==null)}if(v(E,ne)){const z=Array.isArray(ne.categories)?ne.categories:[],ie=ne.kind==="time"?z.map(pe):z.map(S);if(z.length&&!W(ie)){const I=Z&&typeof Z.x=="string"&&Z.x||ne.dimension&&ne.dimension.col||"";return oe(Q.NO_DOMAIN,`chart x ${I?`column ${JSON.stringify(I)} `:""}is drawn on a ${ne.kind==="time"?"time":"continuous"} axis, and not one of its ${z.length} value(s) reads as a ${ne.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(ne&&ne.bucketed&&v(E,ne)){const{col:z,rows:ie,fn:I}=ne.bucketed;return oe(Q.BUCKETED,Y(z,ie,I),c(z))}return G}}),Je("packages/modules/charts/bind.js",function(s,K){"use strict";Object.defineProperty(s,"AGGREGATIONS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(s,"DEFAULT_AGGREGATION",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"resolveAggregation",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(s,"defaultAggregationFor",{enumerable:!0,get:function(){return v}}),Object.defineProperty(s,"measureOf",{enumerable:!0,get:function(){return k}}),Object.defineProperty(s,"walkRows",{enumerable:!0,get:function(){return F}}),Object.defineProperty(s,"leafRows",{enumerable:!0,get:function(){return J}}),Object.defineProperty(s,"selectedRows",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(s,"topGroups",{enumerable:!0,get:function(){return E}}),Object.defineProperty(s,"forcedScaleKind",{enumerable:!0,get:function(){return z}}),Object.defineProperty(s,"scaleKindFor",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"bindSeries",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"bindPoints",{enumerable:!0,get:function(){return me}}),Object.defineProperty(s,"bindMeasures",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"bindLinks",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"bindHierarchy",{enumerable:!0,get:function(){return _}});const Ae=K("packages/modules/charts/scale.js"),W=Ae.key,S=Ae.toNumber,pe=Ae.toTime,ue=K("packages/modules/charts/drawable.js"),V=ue.bucketKey,Q=ue.bucketMessage,te=K("packages/core/src/internal/util.js").warnOnce,j={sum:e=>e.length?e.reduce((i,y)=>i+y,0):null,avg:e=>e.length?e.reduce((i,y)=>i+y,0)/e.length:null,mean:e=>e.length?e.reduce((i,y)=>i+y,0)/e.length:null,min:e=>{let i=null;for(let y=0;y<e.length;y++)(i===null||e[y]<i)&&(i=e[y]);return i},max:e=>{let i=null;for(let y=0;y<e.length;y++)(i===null||e[y]>i)&&(i=e[y]);return i},median:e=>{if(!e.length)return null;const i=e.slice().sort((m,b)=>m-b),y=(i.length-1)/2,t=Math.floor(y),g=Math.ceil(y);return t===g?i[t]:(i[t]+i[g])/2},count:(e,i)=>i,countValues:e=>e.length,first:e=>e.length?e[0]:null,last:e=>e.length?e[e.length-1]:null},c="sum";function Y(e){return e==null?c:typeof e=="string"&&e in j?e:(te(`chart:measure:fn:${String(e)}`,`chart measure fn ${JSON.stringify(e)} is not a known aggregation; using '${c}'. Supported: ${Object.keys(j).join(", ")}.`),c)}function v(e){if(!e)return c;const i=e.groupTotal??e.total;if(typeof i=="string"&&i in j)return i;const y=e.dataType&&e.dataType.totals?e.dataType.totals.supported:null;if(Array.isArray(y)&&!y.includes(c)){const t=["avg","mean","max","min","countValues","count"].find(g=>y.includes(g)&&g in j);if(t)return t}return c}function k(e,i){const y=v(i);return e?typeof e=="string"?{col:e,fn:y}:{col:e.col||null,fn:e.fn==null?y:Y(e.fn)}:{col:null,fn:y}}function F(e,i){const y=new Set,t=g=>{if(!g||y.has(g)||(y.add(g),i(g),!g.group)||g.expanded)return;const m=g.filteredChildren||g.children;if(Array.isArray(m))for(const b of m)t(b)};e.rows.forEach(t)}function J(e){const i=[];return F(e,y=>{!y.group&&y.data!==null&&y.data!==void 0&&i.push(y)}),i}function Z(e){const i=new Set(e.selection.keys());if(!i.size)return[];const y=[];return F(e,t=>{!t.group&&i.has(t.key)&&y.push(t)}),y}function E(e){const i=[];let y=1/0;return F(e,t=>{t.group&&(t.level<y&&(y=t.level,i.length=0),t.level===y&&i.push(t))}),i}function ne(e,i,y){return i.group&&i.totals&&y in i.totals?S(i.totals[y]):S(e.rows.value(i.key,y))}function M(e,i,y,t){if(!i.group){const g=e.rows.text(i.key,y);if(g)return g}return t==null?"":t instanceof Date?t.toISOString().slice(0,10):String(t)}function X(e,i){return(j[i]||j[c])(e.values,e.rows)}const oe=Object.freeze(["number","currency","percent"]),ee=Object.freeze(["date","datetime","timestamp","dateString"]),C=Object.freeze({auto:"",band:"category",category:"category",linear:"linear",time:"time"});function z(e){const i=e&&typeof e=="object"?e.axis:null;if(!i||typeof i!="object")return"";const y=i.x;if(!y||typeof y!="object")return"";const t=typeof y.scale=="string"?y.scale:"";return t?Object.hasOwn(C,t)?C[t]:(te(`chart:x:scale:unknown:${t}`,`chart axis.x.scale ${JSON.stringify(t)} is not a scale this chart draws. Use one of: ${Object.keys(C).join(", ")}. The scale was chosen from the column instead.`),""):""}function ie(e){if(e.length<3)return"";let i=0,y=0;for(const t of e){if(t==null||t===""||typeof t=="boolean")return"";S(t)!==null?i++:typeof t=="string"&&pe(t)!==null&&y++}return y===e.length?"time":i===e.length?"linear":""}function I(e,i,y={}){if(y.forced)return y.forced;const t=e&&typeof e.type=="string"?e.type:"";if(ee.includes(t)||i.length&&i.every(b=>b instanceof Date))return"time";if(oe.includes(t))return"linear";const g=y.id?String(y.id):"";if(!g)return"category";const m=t&&t!=="text"?"":ie(i);return m&&te(`chart:x:banded:${g}`,`chart x column ${JSON.stringify(g)} is typed ${JSON.stringify(t||"text")}, so its ${i.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 $(e,i){const y=i.x||null,t=i.series||(typeof i.multiples=="string"?i.multiples:null)||null,g=e.columns,m=y?g.get(y):void 0,b=k(i.y),P=b.col?g.get(b.col):void 0,l=k(i.y,P);let u;const x=typeof i.rows=="function"?i.rows(e):i.rows;Array.isArray(x)?u=x:i.from==="groups"?u=E(e):i.from==="selection"?u=Z(e):u=J(e);const n=u.length?u:J(e),d=new Map,A=new Map,p=[];for(let R=0;R<n.length;R++){const U=n[R],q=y?U.group&&U.groupColumn===y?U.groupValue:e.rows.value(U.key,y):R,se=W(q);d.has(se)||(d.set(se,{value:q,label:y?M(e,U,y,q):String(R),order:d.size}),p.push(q));const T=t?U.group&&U.groupColumn===t?U.groupValue:e.rows.value(U.key,t):null,le=t?W(T):"";A.has(le)||A.set(le,{label:t?M(e,U,t,T):P?.title||"",points:new Map});const he=A.get(le);let be=he.points.get(se);be||(be={values:[],rows:0,rowKey:U.key},he.points.set(se,be)),be.rows+=U.group&&U.leafCount||1;const we=l.col?ne(e,U,l.col):null;if(we!==null&&be.values.push(we),i.size){const ye=S(e.rows.value(U.key,i.size));ye!==null&&(be.sizes=(be.sizes||0)+ye)}}const w=[...d.values()].sort((R,U)=>R.order-U.order),N=typeof i.limit=="number"&&i.limit>0?w.slice(0,i.limit):w,f=I(m,p,{forced:z(i),id:y});let a=null;f==="time"&&n.length>1&&d.size===1&&m&&(m.type==="date"||m.type==="dateString")&&(a={col:String(y),rows:n.length,fn:l.fn},te(V(a.col),Q(a.col,a.rows,a.fn)));const h=oe.includes(m&&typeof m.type=="string"?m.type:"")?[...N].sort((R,U)=>(S(R.value)??0)-(S(U.value)??0)):N,B=[...A.entries()].map(([R,U],q)=>({key:R,label:U.label,index:q,points:h.map(se=>{const T=W(se.value),le=U.points.get(T);return{x:se.value,xKey:T,label:se.label,y:le?X(le,l.fn):null,size:le&&le.sizes!==void 0?le.sizes:null,rows:le?le.rows:0,rowKey:le?le.rowKey:null,values:le&&le.values?le.values:null}})}));return{series:B,categories:h.map(R=>R.value),labels:h.map(R=>R.label),kind:f,measure:{...l,title:P?.title||l.col||""},dimension:{col:y,title:m?.title||y||""},empty:B.length===0||h.length===0,rows:n.length,truncated:w.length-h.length,bucketed:a}}function me(e){const i=Array.isArray(e.points)?e.points:[],y=i.length>0&&i.every(m=>typeof m.x=="number"&&Number.isFinite(m.x)),t=m=>typeof m=="number"&&Number.isFinite(m)?m:null,g=i.map((m,b)=>({x:m.x,xKey:W(m.x),label:m.label!=null?String(m.label):String(m.x),y:t(m.y),size:t(m.size),lower:t(m.lower),upper:t(m.upper),rows:1,rowKey:m.key!=null?String(m.key):String(b),values:null}));return{series:[{key:e.seriesKey||"",label:e.seriesLabel||"",index:0,points:g}],categories:g.map(m=>m.x),labels:g.map(m=>m.label),kind:y?"linear":"category",measure:{col:null,fn:"sum",title:e.measureTitle||""},dimension:{col:null,title:e.dimensionTitle||""},empty:g.length===0,rows:g.length,truncated:0}}function r(e,i){const y=Array.isArray(i.measures)?i.measures:[];if(!y.length)return $(e,i);const t=y.map(P=>{const l=typeof P=="string"?{col:P}:P;return{spec:l,result:$(e,{x:i.x,from:i.from,limit:i.limit,axis:i.axis,y:{col:l.col,fn:l.fn}})}}),g=t[0].result,m=new Map(g.categories.map((P,l)=>[W(P),l])),b=t.map(({spec:P,result:l},u)=>{const x=e.columns.get(P.col),n=g.categories.map(()=>null),d=l.series[0];if(d)for(const A of d.points){const p=m.get(A.xKey);p!==void 0&&(n[p]=A)}return{key:P.col,label:P.title||P.label||x&&x.title||P.col,index:u,mark:P.type||null,axis:P.axis==="right"?"right":"left",points:g.categories.map((A,p)=>n[p]||{x:A,xKey:W(A),label:g.labels[p],y:null,rows:0,rowKey:null})}});return{series:b,categories:g.categories,labels:g.labels,kind:g.kind,measure:{col:null,fn:"sum",title:b.map(P=>P.label).join(", ")},dimension:g.dimension,empty:!b.length||!g.categories.length,rows:g.rows,truncated:g.truncated}}function D(e,i,y={}){const t=k(i.y),g=!!y.perRow,m=Array.isArray(y.nodes)?y.nodes:[],b=i.source||i.x||null,P=i.target||null;if(!b||!P)return{nodes:[],links:[],measure:{...t,title:""},dimension:{col:null,title:""},series:[],categories:[],labels:[],empty:!0,total:0};const l=t.col?e.columns.get(t.col):void 0,u=new Map,x=new Map,n=(w,N,f)=>{const a=W(w);return u.has(a)||u.set(a,{key:a,value:w,label:M(e,N,f,w),index:u.size,in:0,out:0}),u.get(a)},d=new Map;for(const w of m)!w||w.id===null||w.id===void 0||d.set(W(w.id),w);for(const w of J(e)){const N=e.rows.value(w.key,b),f=e.rows.value(w.key,P);if(N==null||f===null||f===void 0)continue;const a=t.col?S(e.rows.value(w.key,t.col)):1;if(a===null||a<=0)continue;const o=n(N,w,b),h=n(f,w,P);if(g){const B=o.key>h.key,R=B?h:o,U=B?o:h;x.set(`${R.key}\0${U.key}\0${x.size}`,{source:R,target:U,value:a,undirected:!0,pair:`${R.key}\0${U.key}`,rowKeys:[w.key]})}else{const B=`${o.key}\0${h.key}`,R=x.get(B)||{source:o,target:h,value:0,rowKeys:[]};R.value+=a,R.rowKeys.length<64&&R.rowKeys.push(w.key),x.set(B,R)}o.out+=a,h.in+=a}for(const[w,N]of d)u.has(w)||u.set(w,{key:w,value:N.id,label:String(N.label??N.id),index:u.size,in:0,out:0});for(const[w,N]of d){const f=u.get(w);f&&(f.declared=!0,N.label!==void 0&&N.label!==null&&(f.label=String(N.label)),typeof N.icon=="string"&&N.icon&&(f.icon=N.icon),Number.isFinite(N.x)&&Number.isFinite(N.y)&&(f.fx=Number(N.x),f.fy=Number(N.y)))}const A=g?[...x.values()]:[...x.values()].sort((w,N)=>N.value-w.value),p=typeof i.limit=="number"&&i.limit>0?A.slice(0,i.limit):A;return{nodes:[...u.values()],links:p,measure:{...t,title:l?.title||t.col||""},dimension:{col:b,title:e.columns.get(b)?.title||b},series:[],categories:[],labels:[],empty:!p.length,total:p.reduce((w,N)=>w+N.value,0)}}function _(e,i){const y=k(i.y),t=typeof i.depth=="number"&&i.depth>0?i.depth:1/0,g=y.col?e.columns.get(y.col):void 0,m=(x,n,d)=>({label:x,value:n,depth:d,total:0,children:[],rowKey:null}),b=m("",null,0),P=E(e);if(P.length){const x=(n,d,A)=>{const p=n.groupColumn?M(e,n,n.groupColumn,n.groupValue):"",w=m(p,n.groupValue,A);w.rowKey=n.key;const N=y.col?ne(e,n,y.col):null;w.total=N===null?0:Math.abs(N),d.children.push(w);const f=n.filteredChildren||n.children;if(A<t&&Array.isArray(f))for(const a of f)a.group&&x(a,w,A+1);return!w.total&&w.children.length&&(w.total=w.children.reduce((a,o)=>a+o.total,0)),w};for(const n of P)x(n,b,1)}else{const n=$(e,{x:i.x,y:i.y,limit:i.limit}).series[0];if(n)for(const d of n.points){const A=m(d.label,d.x,1);A.total=d.y===null?0:Math.abs(d.y),A.rowKey=d.rowKey,b.children.push(A)}}b.total=b.children.reduce((x,n)=>x+n.total,0);let l=0;const u=x=>{x.depth>l&&(l=x.depth);for(const n of x.children)u(n)};return u(b),{root:b,depth:l,measure:{...y,title:g?.title||y.col||""},empty:b.total<=0||b.children.length===0}}}),Je("packages/modules/charts/radial.js",function(s,K){"use strict";Object.defineProperty(s,"horizontalRoom",{enumerable:!0,get:function(){return z}}),Object.defineProperty(s,"arcPath",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"layoutRings",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"drawRadial",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"arcAt",{enumerable:!0,get:function(){return me}});const W=K("packages/modules/charts/frame.js").Pool,S=K("packages/modules/charts/svg.js"),pe=S.attrs,ue=S.path,V=S.round,Q=S.setText,te=K("packages/modules/charts/styles.js").NS,c=K("packages/modules/charts/scheme.js").resolveScheme,Y=K("packages/modules/charts/labels.js"),v=Y.drawAnchoredLabels,k=Y.labelText,F=K("packages/modules/charts/typography.js"),J=F.applySize,Z=F.truncateTo,E=Math.PI*2,ne=-Math.PI/2,M=.25,X=2,oe=3,ee=.58;function C(r,D,_,e){return[r+_*Math.cos(e),D+_*Math.sin(e)]}function z(r,D,_){const{inner:e,outer:i,from:y,to:t}=r;if(_*_>=i*i)return 0;const g=Math.sqrt(i*i-_*_);let m=D+g,b=g-D;if(e>0&&_*_<e*e){const P=Math.sqrt(e*e-_*_);if(D>=P)m=Math.min(m,D-P);else if(D<=-P)b=Math.min(b,-P-D);else return 0}if(t-y<E-1e-9)for(const P of[y,t]){const l=Math.sin(P);if(Math.abs(l)<1e-9)continue;const u=_/l;if(u<=0)continue;const x=u*Math.cos(P);x>=D?b=Math.min(b,x-D):m=Math.min(m,D-x)}return Math.max(0,m)+Math.max(0,b)}function ie(r){const{cx:D,cy:_,inner:e,outer:i}=r,y=r.to-r.from;if(y<=0)return"";if(y>=E-1e-9){const[u,x]=C(D,_,i,r.from),[n,d]=C(D,_,i,r.from+Math.PI),A=["M",V(u),V(x),"A",V(i),V(i),0,1,1,V(n),V(d),"A",V(i),V(i),0,1,1,V(u),V(x)];if(e>0){const[p,w]=C(D,_,e,r.from),[N,f]=C(D,_,e,r.from+Math.PI);A.push("M",V(p),V(w),"A",V(e),V(e),0,1,0,V(N),V(f),"A",V(e),V(e),0,1,0,V(p),V(w))}return ue(A)}const t=y>Math.PI?1:0,[g,m]=C(D,_,i,r.from),[b,P]=C(D,_,i,r.to),l=["M",V(g),V(m),"A",V(i),V(i),0,t,1,V(b),V(P)];if(e>0){const[u,x]=C(D,_,e,r.to),[n,d]=C(D,_,e,r.from);l.push("L",V(u),V(x)),l.push("A",V(e),V(e),0,t,0,V(n),V(d))}else l.push("L",V(D),V(_));return l.push("Z"),ue(l)}function I(r){const D=[],_=(e,i,y,t,g,m)=>{if(t>0&&D.push({node:e,from:i,to:y,depth:t,index:g,label:e.label,total:e.total,path:m}),t>=r.maxRings||!e.children.length)return;const b=e.children.reduce((u,x)=>u+x.total,0),P=y-i;if(b<=0||P<=0)return;let l=i;for(let u=0;u<e.children.length;u++){const x=e.children[u],n=x.total/b*P;_(x,l,l+n,t+1,t===0?u:g,[...m,x.label]),l+=n}};return _(r.root,ne,ne+E,0,0,[]),D}function $(r){const D=r.scheme||c(),{plot:_,tree:e,type:i}=r,y=_.left+_.width/2,t=_.top+_.height/2,g=Math.max(0,Math.min(_.width,_.height)/2-2),m=i==="sunburst"?Math.max(1,e.depth):1,b=I({root:e.root,depth:e.depth,maxRings:m}).filter(A=>!r.hidden.has(A.label)),P=i==="donut"?g*ee:0,l=m>0?(g-P)/m:g;new W(r.groups.grid).finish(),new W(r.groups.axis).finish(),new W(r.groups.rules).finish(),new W(r.groups.labels).finish();const u=new W(r.groups.marks);for(const A of b){const p=P+(A.depth-1)*l,w=p+l,N=u.next("path",`${te}__slice ${te}__mark`);pe(N,{d:ie({cx:y,cy:t,inner:p,outer:w,from:A.from,to:A.to}),fill:D.series(A.index),"fill-opacity":A.depth>1?Math.max(.45,1-(A.depth-1)*.22):1,"data-arc":b.indexOf(A)}),A.geometry={cx:y,cy:t,inner:p,outer:w}}u.finish();const x=r.typography&&r.typography.small||r.fontSize||11,n=!(r.labels&&r.labels.names===!1),d=new W(r.groups.overlay);if(n)for(const A of b){if(A.to-A.from<M||A.geometry.outer-A.geometry.inner<x+X*2)continue;const p=(A.from+A.to)/2,w=A.geometry.inner+(A.geometry.outer-A.geometry.inner)/2;if((A.to-A.from)*w<x+X*2)continue;const[N,f]=C(y,t,w,p),{inner:a,outer:o}=A.geometry,h=z({inner:a,outer:o,from:A.from,to:A.to},N-y,f-t)-X*2,B=String(A.label===null||A.label===void 0?"":A.label),R=Z(B,h,x);if(R!==B&&R.length<oe)continue;const U=d.next("text",`${te}__slice-label`);pe(U,{x:V(N),y:V(f),"dominant-baseline":"middle"}),J(U,x),Q(U,R)}return d.finish(),r.labels&&r.labels.show&&v({group:r.groups.labels,size:x,minGap:r.labels.minGap,anchors:b.filter(A=>A.depth===1&&A.to-A.from>=M).map(A=>{const p=(A.from+A.to)/2,w=A.geometry.inner+(A.geometry.outer-A.geometry.inner)/2,[N,f]=C(y,t,w,p);return{x:V(N),y:V(f+x+1),text:k(A.total,r.labels,r.grid),inside:!0}})}),{arcs:b,centre:{x:y,y:t,r:g}}}function me(r){for(const D of r.arcs){const _=D.geometry;if(!_)continue;const e=r.x-_.cx,i=r.y-_.cy,y=Math.sqrt(e*e+i*i);if(y<_.inner||y>_.outer)continue;let t=Math.atan2(i,e);for(;t<ne;)t+=E;for(;t>=ne+E;)t-=E;if(t>=D.from&&t<D.to)return D}return null}}),Je("packages/modules/charts/distribution.js",function(s,K){"use strict";Object.defineProperty(s,"FENCE",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"quantile",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"summarise",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"binEdge",{enumerable:!0,get:function(){return _}}),Object.defineProperty(s,"outsideDomain",{enumerable:!0,get:function(){return e}}),Object.defineProperty(s,"histogram",{enumerable:!0,get:function(){return i}}),Object.defineProperty(s,"readingsOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(s,"valuesByCategory",{enumerable:!0,get:function(){return t}}),Object.defineProperty(s,"allReadings",{enumerable:!0,get:function(){return g}}),Object.defineProperty(s,"distributionDomain",{enumerable:!0,get:function(){return m}}),Object.defineProperty(s,"density",{enumerable:!0,get:function(){return b}}),Object.defineProperty(s,"drawHistogram",{enumerable:!0,get:function(){return l}}),Object.defineProperty(s,"drawBoxPlot",{enumerable:!0,get:function(){return u}}),Object.defineProperty(s,"probit",{enumerable:!0,get:function(){return x}}),Object.defineProperty(s,"drawQQ",{enumerable:!0,get:function(){return n}}),Object.defineProperty(s,"drawEcdf",{enumerable:!0,get:function(){return d}}),Object.defineProperty(s,"drawLorenz",{enumerable:!0,get:function(){return A}}),Object.defineProperty(s,"drawControl",{enumerable:!0,get:function(){return p}}),Object.defineProperty(s,"drawCapability",{enumerable:!0,get:function(){return w}}),Object.defineProperty(s,"drawMovingRange",{enumerable:!0,get:function(){return N}});const W=K("packages/modules/charts/frame.js").Pool,S=K("packages/modules/charts/axis.js"),pe=S.drawAxisLines,ue=S.drawCategoryAxis,V=S.drawContinuousAxis,Q=S.drawMeasureAxis,G=S.tickLabeller,j=K("packages/modules/charts/format.js").formatters,c=K("packages/modules/charts/scale.js"),Y=c.bandScale,v=c.isNumber,k=c.linearScale,F=c.measureDomain,J=c.niceStep,Z=K("packages/modules/charts/svg.js"),E=Z.attrs,ne=Z.path,M=Z.round,oe=K("packages/modules/charts/styles.js").NS,C=K("packages/modules/charts/scheme.js").resolveScheme,z=K("packages/modules/charts/labels.js"),ie=z.drawAnchoredLabels,I=z.labelText,$=1.5,me="–";function r(f,a){const o=f.length;if(!o)return NaN;if(o===1)return f[0];const h=(o-1)*Math.min(1,Math.max(0,a)),B=Math.floor(h),R=Math.ceil(h);return B===R?f[B]:f[B]+(h-B)*(f[R]-f[B])}function D(f){const a=f.filter(v).slice().sort((le,he)=>le-he);if(!a.length)return null;const o=r(a,.25),h=r(a,.5),B=r(a,.75),R=B-o,U=o-$*R,q=B+$*R;let se=a[0];for(const le of a)if(le>=U){se=le;break}let T=a[a.length-1];for(let le=a.length-1;le>=0;le--)if(a[le]<=q){T=a[le];break}return{min:a[0],q1:o,median:h,q3:B,max:a[a.length-1],low:se,high:T,outliers:a.filter(le=>le<U||le>q),count:a.length}}function _(f,a,o){const h=f+o*a;return Math.abs(h)<a/1e6?0:Number(h.toPrecision(12))}function e(f,a){const o=a||{},h=v(o.min),B=v(o.max);if(!h&&!B)return 0;let R=0;for(let U=0;U<f.length;U++){const q=f[U];v(q)&&(h&&q<o.min||B&&q>o.max)&&R++}return R}function i(f,a=12,o){const h=o||{},B=v(h.min),R=v(h.max);let U=1/0,q=-1/0,se=0;for(let ye=0;ye<f.length;ye++){const Me=f[ye];v(Me)&&(B&&Me<h.min||R&&Me>h.max||(Me<U&&(U=Me),Me>q&&(q=Me),se++))}if(!se)return[];if(B&&(U=Number(h.min)),R&&(q=Number(h.max)),U===q){const ye=Math.abs(U)>0?Math.abs(U)/10:.5;U-=ye,q+=ye}const T=J((q-U)/Math.max(1,a)),le=Math.floor(U/T)*T,he=Math.ceil(q/T)*T,be=[],we=Math.max(1,Math.round((he-le)/T));for(let ye=0;ye<we;ye++)be.push({from:_(le,T,ye),to:_(le,T,ye+1),count:0});for(let ye=0;ye<f.length;ye++){const Me=f[ye];if(!v(Me)||B&&Me<h.min||R&&Me>h.max)continue;let Te=Math.floor((Me-le)/T);Te>=be.length&&(Te=be.length-1),Te<0&&(Te=0),be[Te].count++}return be}function y(f){if(!f)return[];if(Array.isArray(f.values)){const a=f.values.filter(v);if(a.length)return a}return v(f.y)?[f.y]:[]}function t(f){const a=new Map,o=!(f.dimension&&f.dimension.col),h=o&&f.measure&&f.measure.title||"";for(const B of f.series)for(const R of B.points){const U=y(R);if(!U.length)continue;const q=o?h:R.label;a.has(q)||a.set(q,[]);const se=a.get(q);for(const T of U)se.push(T)}return a}function g(f){const a=[];for(const o of f.series||[])for(const h of o.points||[])for(const B of y(h))a.push(B);return a}function m(f,a){const o=a&&a.y||{};return F(f,{zero:!1,min:o.min,max:o.max})}function b(f,a,o){const h=f.length;if(!h)return[];const B=f.reduce((le,he)=>le+he,0)/h,R=f.reduce((le,he)=>le+(he-B)**2,0)/Math.max(1,h-1),U=Math.sqrt(R)||1,q=Math.max(1e-9,1.06*U*h**(-1/5)),se=[],T=a.max-a.min||1;for(let le=0;le<o;le++){const he=a.min+T*le/(o-1||1);let be=0;for(const we of f){const ye=(he-we)/q;be+=Math.exp(-.5*ye*ye)}se.push({at:he,density:be/(h*q*Math.sqrt(Math.PI*2))})}return se}function P(f,a,o){const h=j(f.grid,{kind:"linear",step:o}),B=a.measure&&a.measure.col&&f.grid.columns?f.grid.columns.get(a.measure.col):null,U=!!(B&&B.format&&typeof B.formatValue=="function")?{tick:q=>String(B.formatValue(q,null))}:h;return G(f.axis&&f.axis.x||{},U,f.grid)}function l(f){const a=f.scheme||C(),{plot:o,bound:h}=f,B=g(h),R=f.axis&&f.axis.y||{},U=i(B,f.buckets||12,R),q=e(B,R),se=U.map($e=>$e.count),T=F(se,{zero:!0}),le=k(T,[o.bottom,o.top]),he=U.length?U[0].to-U[0].from:1,be=P(f,h,he),we=U.map($e=>be($e.from)),ye=U.map($e=>`${be($e.from)} ${me} ${be($e.to)}`),Me=U.map(($e,Pe)=>Pe),Te=Y(Me,[o.left,o.right],.08);Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:le,format:j(f.grid,{kind:"linear",step:(T.max-T.min)/5})}),ue({group:f.groups.overlay,plot:o,scale:Te,labels:we,fontSize:f.fontSize,rotated:we.length>8}),pe({group:f.groups.rules,plot:o});const xe=new W(f.groups.marks),_e=le.of(T.min<=0?0:T.min);if(U.forEach(($e,Pe)=>{const Ie=le.of($e.count);E(xe.next("rect",`${oe}__bar ${oe}__mark`),{x:M(Te.of(Pe)),y:M(Math.min(Ie,_e)),width:M(Te.bandwidth),height:M(Math.max($e.count>0?1:0,Math.abs(_e-Ie))),fill:a.series(0),"data-point":Pe})}),xe.finish(),f.curve&&B.length>1){const $e={min:U[0].from,max:U[U.length-1].to},Pe=b(B,$e,Math.max(24,U.length*4)),Ie=Pe.reduce((He,We)=>Math.max(He,We.density),0);if(Ie>0){const He=$e.max-$e.min||1,We=le.of(T.max),ot=Pe.map(ut=>[M(o.left+(ut.at-$e.min)/He*(o.right-o.left)),M(_e-ut.density/Ie*(_e-We))]),dt=new W(f.groups.overlay);E(dt.next("path",`${oe}__density ${oe}__mark`),{d:ne(ot.flatMap(([ut,bt],yt)=>[yt?"L":"M",ut,bt])),fill:"none",stroke:a.series(1)}),dt.finish()}}if(f.labels&&f.labels.show){const $e=f.typography&&f.typography.small||f.fontSize||11;ie({group:f.groups.labels,size:$e,minGap:f.labels.minGap,plot:o,anchors:U.map((Pe,Ie)=>{const He=Math.min(le.of(Pe.count),_e),We=He-$e/2-2,ot=We<o.top;return{x:M(Te.of(Ie)+Te.bandwidth/2),y:M(ot?He+$e/2+2:We),text:Pe.count?I(Pe.count,f.labels,f.grid):"",inside:ot,height:ot?Math.abs(_e-He)-2:void 0}})})}return{xScale:Te,yScale:le,buckets:U,labels:ye,categories:U.map($e=>$e.from),outside:q,series:[{key:"",label:h.measure.title,index:0,points:U.map(($e,Pe)=>({x:Pe,xKey:String(Pe),label:ye[Pe],from:$e.from,to:$e.to,y:$e.count,rows:$e.count}))}]}}function u(f){const a=f.scheme||C(),{plot:o,bound:h}=f,B=t(h),R=[...B.keys()],U=R.map(we=>D(B.get(we))).filter(Boolean),q=[];for(const we of U)q.push(we.min,we.max);const se=m(q,f.axis),T=k(se,[o.bottom,o.top]),le=Y(R,[o.left,o.right],.4);Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:T,format:j(f.grid,{kind:"linear",step:(se.max-se.min)/5})}),ue({group:f.groups.overlay,plot:o,scale:le,labels:R,fontSize:f.fontSize,rotated:R.length>6}),pe({group:f.groups.rules,plot:o});const he=new W(f.groups.marks),be=le.bandwidth;return R.forEach((we,ye)=>{const Me=U[ye];if(!Me)return;const Te=le.of(we),xe=Te+be/2,_e=a.series(ye);E(he.next("rect",`${oe}__box ${oe}__mark`),{x:M(Te),y:M(T.of(Me.q3)),width:M(be),height:M(Math.max(1,T.of(Me.q1)-T.of(Me.q3))),fill:_e,"fill-opacity":.35,stroke:_e,"data-point":ye}),E(he.next("path",`${oe}__whisker ${oe}__mark`),{d:ne(["M",M(xe),M(T.of(Me.high)),"L",M(xe),M(T.of(Me.q3)),"M",M(xe),M(T.of(Me.q1)),"L",M(xe),M(T.of(Me.low)),"M",M(Te+be*.25),M(T.of(Me.high)),"L",M(Te+be*.75),M(T.of(Me.high)),"M",M(Te+be*.25),M(T.of(Me.low)),"L",M(Te+be*.75),M(T.of(Me.low))]),stroke:_e,fill:"none"}),E(he.next("path",`${oe}__median ${oe}__mark`),{d:ne(["M",M(Te),M(T.of(Me.median)),"L",M(Te+be),M(T.of(Me.median))]),stroke:_e,"stroke-width":2,fill:"none"});for(const $e of Me.outliers)E(he.next("circle",`${oe}__point ${oe}__mark`),{cx:M(xe),cy:M(T.of($e)),r:2.5,fill:_e,"fill-opacity":.8})}),he.finish(),{xScale:le,yScale:T,boxes:U,series:[{key:"",label:h.measure.title,index:0,points:R.map((we,ye)=>({x:we,xKey:we,label:we,y:U[ye]?U[ye].median:null,rows:U[ye]?U[ye].count:0}))}]}}function x(f){if(!(f>0&&f<1))return Number.NaN;const a=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],o=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],h=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],B=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],R=.02425;if(f<R){const se=Math.sqrt(-2*Math.log(f));return(((((h[0]*se+h[1])*se+h[2])*se+h[3])*se+h[4])*se+h[5])/((((B[0]*se+B[1])*se+B[2])*se+B[3])*se+1)}if(f>1-R){const se=Math.sqrt(-2*Math.log(1-f));return-(((((h[0]*se+h[1])*se+h[2])*se+h[3])*se+h[4])*se+h[5])/((((B[0]*se+B[1])*se+B[2])*se+B[3])*se+1)}const U=f-.5,q=U*U;return(((((a[0]*q+a[1])*q+a[2])*q+a[3])*q+a[4])*q+a[5])*U/(((((o[0]*q+o[1])*q+o[2])*q+o[3])*q+o[4])*q+1)}function n(f){const a=f.scheme||C(),{plot:o,bound:h}=f;new W(f.groups.grid).finish(),new W(f.groups.axis).finish(),new W(f.groups.rules).finish(),new W(f.groups.labels).finish();const B=g(h);if(B.length<3)return null;const R=B.slice().sort((Ie,He)=>Ie-He),U=R.length,q=R.map((Ie,He)=>x((He+1-.375)/(U+.25))),se=F(q,{zero:!1,nice:!0}),T=F(R,{zero:!1,nice:!0}),le=k(se,[o.left,o.right]),he=k(T,[o.bottom,o.top]);Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:he,format:j(f.grid,{kind:"linear",step:(T.max-T.min)/5})}),V({group:f.groups.overlay,plot:o,scale:le,fontSize:f.fontSize,format:j(f.grid,{kind:"linear",step:(se.max-se.min)/5})}),pe({group:f.groups.rules,plot:o});const be=r(R,.25),we=r(R,.75),ye=x(.25),Me=x(.75),Te=(we-be)/(Me-ye),xe=be-Te*ye,_e=new W(f.groups.rules);E(_e.next("path",`${oe}__qq-line`),{d:ne(["M",M(le.of(se.min)),M(he.of(xe+Te*se.min)),"L",M(le.of(se.max)),M(he.of(xe+Te*se.max))]),fill:"none"}),_e.finish();const $e=new W(f.groups.marks),Pe=[];for(let Ie=0;Ie<U;Ie++){const He=M(le.of(q[Ie])),We=M(he.of(R[Ie]));E($e.next("circle",`${oe}__point ${oe}__mark`),{cx:He,cy:We,r:2.5,fill:a.series(0),"data-point":Ie}),Pe.push({x:He,y:We,theoretical:q[Ie],sample:R[Ie]})}return $e.finish(),{points:Pe,line:{slope:Te,intercept:xe}}}function d(f){const a=f.scheme||C(),{plot:o,bound:h}=f;new W(f.groups.grid).finish(),new W(f.groups.axis).finish(),new W(f.groups.rules).finish(),new W(f.groups.labels).finish();const B=g(h);if(!B.length)return null;const R=B.slice().sort((we,ye)=>we-ye),U=R.length,q=F(R,{zero:!1,nice:!0}),se=k(q,[o.left,o.right]),T=k({min:0,max:1},[o.bottom,o.top]);Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:T,format:j(f.grid,{kind:"linear",step:.2})}),V({group:f.groups.overlay,plot:o,scale:se,fontSize:f.fontSize,format:j(f.grid,{kind:"linear",step:(q.max-q.min)/5})}),pe({group:f.groups.rules,plot:o});const le=["M",M(se.of(q.min)),M(T.of(0))],he=[];for(let we=0;we<U;we++){const ye=M(se.of(R[we])),Me=(we+1)/U;le.push("L",ye,M(T.of(we/U)),"L",ye,M(T.of(Me))),he.push({value:R[we],share:Me})}le.push("L",M(se.of(q.max)),M(T.of(1)));const be=new W(f.groups.marks);return E(be.next("path",`${oe}__ecdf ${oe}__mark`),{d:ne(le),fill:"none",stroke:a.series(0)}),be.finish(),{steps:he}}function A(f){const a=f.scheme||C(),{plot:o,bound:h}=f;new W(f.groups.grid).finish(),new W(f.groups.axis).finish(),new W(f.groups.rules).finish(),new W(f.groups.labels).finish();const B=g(h).filter(xe=>xe>=0);if(!B.length)return null;const R=B.slice().sort((xe,_e)=>xe-_e),U=R.length,q=R.reduce((xe,_e)=>xe+_e,0);if(q<=0)return null;const se=k({min:0,max:1},[o.left,o.right]),T=k({min:0,max:1},[o.bottom,o.top]);Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:T,format:j(f.grid,{kind:"linear",step:.2})}),V({group:f.groups.overlay,plot:o,scale:se,fontSize:f.fontSize,format:j(f.grid,{kind:"linear",step:.2})}),pe({group:f.groups.rules,plot:o});const le=new W(f.groups.rules);E(le.next("path",`${oe}__lorenz-equality`),{d:ne(["M",M(se.of(0)),M(T.of(0)),"L",M(se.of(1)),M(T.of(1))]),fill:"none"}),le.finish();const he=["M",M(se.of(0)),M(T.of(0))],be=[{rows:0,held:0}];let we=0;for(let xe=0;xe<U;xe++){we+=R[xe];const _e={rows:(xe+1)/U,held:we/q};he.push("L",M(se.of(_e.rows)),M(T.of(_e.held))),be.push(_e)}const ye=new W(f.groups.marks);E(ye.next("path",`${oe}__lorenz ${oe}__mark`),{d:ne(he),fill:"none",stroke:a.series(0)}),ye.finish();let Me=0;for(let xe=0;xe<U;xe++)Me+=(xe+1)*R[xe];const Te=2*Me/(U*q)-(U+1)/U;return{curve:be,gini:Te}}function p(f){const a=f.scheme||C(),{plot:o,bound:h}=f;new W(f.groups.grid).finish(),new W(f.groups.labels).finish();const B=[];for(const Pe of h.series)for(const Ie of Pe.points)v(Ie.y)&&B.push(Ie.y);if(B.length<2)return null;const R=f.capability||null,U=R&&R.limits?R.limits:null,q=[...B];U&&q.push(U.upper,U.lower),R&&(R.lower!==null&&q.push(R.lower),R.upper!==null&&q.push(R.upper));const se=F(q,{zero:!1,nice:!0}),T=k(se,[o.bottom,o.top]),le=B.length>1?(o.right-o.left)/(B.length-1):0;Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:T,format:j(f.grid,{kind:"linear",step:(se.max-se.min)/5})}),pe({group:f.groups.rules,plot:o});const he=new W(f.groups.overlay),be=[],we=(Pe,Ie,He,We="end")=>{!Number.isFinite(Pe)||Pe<se.min||Pe>se.max||(E(he.next("path",Ie),{d:ne(["M",M(o.left),M(T.of(Pe)),"L",M(o.right),M(T.of(Pe))]),fill:"none"}),He&&be.push({y:T.of(Pe),text:He,side:We}))};U&&(we(U.centre,`${oe}__control-centre`,"CL","end"),we(U.upper,`${oe}__control-limit`,"UCL","end"),we(U.lower,`${oe}__control-limit`,"LCL","end")),R&&(R.lower!==null&&we(R.lower,`${oe}__spec-limit`,"LSL","start"),R.upper!==null&&we(R.upper,`${oe}__spec-limit`,"USL","start"),R.target!==null&&we(R.target,`${oe}__spec-target`,"Target","start")),he.finish();const ye=new Map;for(const Pe of R&&R.violations?R.violations:[]){const Ie=ye.get(Pe.index);Ie?Ie.includes(Pe.rule)||Ie.push(Pe.rule):ye.set(Pe.index,[Pe.rule])}const Me=new Set(ye.keys()),Te=new W(f.groups.marks),xe=[],_e=[];for(let Pe=0;Pe<B.length;Pe++){const Ie=M(o.left+Pe*le),He=M(T.of(B[Pe]));xe.push(Pe?"L":"M",Ie,He),_e.push({x:Ie,y:He,index:Pe,value:B[Pe],violating:Me.has(Pe)})}E(Te.next("path",`${oe}__control-line ${oe}__mark`),{d:ne(xe),fill:"none",stroke:a.series(0)});for(const Pe of _e)E(Te.next("circle",`${oe}__point ${oe}__mark`),{cx:Pe.x,cy:Pe.y,r:Pe.violating?4:2.5,fill:Pe.violating?"var(--lattice-danger, #a4262c)":a.series(0),"data-violation":Pe.violating?"true":null});Te.finish();const $e=[];for(const{y:Pe,text:Ie,side:He}of be)$e.push({x:He==="start"?o.left+2:o.right-2,y:Pe-3,text:Ie,anchor:He,className:`${oe}__control-name`});for(const Pe of _e){const Ie=ye.get(Pe.index);Ie&&$e.push({x:Pe.x,y:Pe.y-7,text:Ie.sort((He,We)=>He-We).join(","),anchor:"middle",className:`${oe}__control-rule`})}return ie({group:f.groups.labels,anchors:$e,size:9,grid:f.grid,minGap:1}),{points:_e,limits:U,ruleSet:R?R.ruleSet:null}}function w(f){const a=f.scheme||C(),{plot:o,bound:h}=f;new W(f.groups.grid).finish();const B=[];for(const $e of h.series)for(const Pe of $e.points)v(Pe.y)&&B.push(Pe.y);if(B.length<2)return null;const R=f.capability||null,U=[...B];R&&(R.lower!==null&&U.push(R.lower),R.upper!==null&&U.push(R.upper),R.target!==null&&U.push(R.target));const q=F(U,{zero:!1,nice:!0}),se=k(q,[o.left,o.right]),T=i(B,f.buckets||14),le=T.map($e=>$e.count),he=F(le,{zero:!0}),be=k(he,[o.bottom,o.top]);Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:be,format:j(f.grid,{kind:"linear",step:(he.max-he.min)/5})}),V({group:f.groups.overlay,plot:o,scale:se,fontSize:f.fontSize,format:j(f.grid,{kind:"linear",step:(q.max-q.min)/5})}),pe({group:f.groups.rules,plot:o});const we=be.of(0),ye=new W(f.groups.marks);for(let $e=0;$e<T.length;$e++){const Pe=T[$e],Ie=se.of(Pe.from),He=se.of(Pe.to),We=be.of(Pe.count);E(ye.next("rect",`${oe}__bar ${oe}__mark`),{x:M(Math.min(Ie,He)),y:M(Math.min(We,we)),width:M(Math.max(1,Math.abs(He-Ie)-1)),height:M(Math.max(Pe.count>0?1:0,Math.abs(we-We))),fill:a.series(0),"data-point":$e})}ye.finish();const Me=new W(f.groups.overlay),Te=[];if(R&&Number.isFinite(R.mean)){const Pe=ot=>{if(!Number.isFinite(ot)||ot<=0)return null;const dt=[];for(let ut=0;ut<=96;ut++){const bt=q.min+(q.max-q.min)*ut/96,yt=(bt-R.mean)/ot;dt.push({at:bt,y:Math.exp(-.5*yt*yt)/ot})}return dt},Ie=Pe(R.sigmaWithin),He=Pe(R.sigmaOverall);let We=0;for(const ot of[Ie,He])if(ot)for(const dt of ot)We=Math.max(We,dt.y);if(We>0){const ot=be.of(he.max),dt=(ut,bt,yt)=>{if(!ut)return;const vt=ut.flatMap((Mt,xt)=>[xt?"L":"M",M(se.of(Mt.at)),M(we-Mt.y/We*(we-ot))]);E(Me.next("path",`${bt} ${oe}__mark`),{d:ne(vt),fill:"none"}),Te.push(yt)};dt(Ie,`${oe}__capability-within`,"within"),dt(He,`${oe}__capability-overall`,"overall")}}const xe=[],_e=($e,Pe,Ie)=>{if($e===null||!Number.isFinite($e)||$e<q.min||$e>q.max)return;const He=M(se.of($e));E(Me.next("path",Pe),{d:ne(["M",He,M(o.top),"L",He,M(o.bottom)]),fill:"none"}),xe.push({x:He,text:Ie})};return R&&(_e(R.lower,`${oe}__spec-limit`,"LSL"),_e(R.upper,`${oe}__spec-limit`,"USL"),_e(R.target,`${oe}__spec-target`,"Target")),Me.finish(),ie({group:f.groups.labels,anchors:xe.map(({x:$e,text:Pe})=>({x:$e,y:o.top+6,text:Pe,anchor:"middle",className:`${oe}__control-name`})),size:9,grid:f.grid,minGap:1}),{buckets:T,capability:R,curves:Te}}function N(f){const a=f.scheme||C(),{plot:o,bound:h}=f;new W(f.groups.grid).finish();const B=[];for(const xe of h.series)for(const _e of xe.points)v(_e.y)&&B.push(_e.y);if(B.length<3)return null;const R=[];for(let xe=1;xe<B.length;xe++)R.push(Math.abs(B[xe]-B[xe-1]));const U=R.reduce((xe,_e)=>xe+_e,0)/R.length,q=3.267*U,se=F([...R,0,q],{zero:!0,nice:!0}),T=k(se,[o.bottom,o.top]),le=R.length>1?(o.right-o.left)/(R.length-1):0;Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:T,format:j(f.grid,{kind:"linear",step:(se.max-se.min)/5})}),pe({group:f.groups.rules,plot:o});const he=new W(f.groups.overlay),be=[],we=(xe,_e,$e)=>{!Number.isFinite(xe)||xe<se.min||xe>se.max||(E(he.next("path",_e),{d:ne(["M",M(o.left),M(T.of(xe)),"L",M(o.right),M(T.of(xe))]),fill:"none"}),be.push({y:T.of(xe),text:$e}))};we(U,`${oe}__control-centre`,"MR"),we(q,`${oe}__control-limit`,"UCL"),he.finish();const ye=new W(f.groups.marks),Me=[],Te=[];for(let xe=0;xe<R.length;xe++){const _e=M(o.left+xe*le),$e=M(T.of(R[xe]));Me.push(xe?"L":"M",_e,$e),Te.push({x:_e,y:$e,index:xe,value:R[xe],violating:R[xe]>q})}E(ye.next("path",`${oe}__control-line ${oe}__mark`),{d:ne(Me),fill:"none",stroke:a.series(0)});for(const xe of Te)E(ye.next("circle",`${oe}__point ${oe}__mark`),{cx:xe.x,cy:xe.y,r:xe.violating?4:2.5,fill:xe.violating?"var(--lattice-danger, #a4262c)":a.series(0),"data-violation":xe.violating?"true":null});return ye.finish(),ie({group:f.groups.labels,anchors:be.map(({y:xe,text:_e})=>({x:o.right-2,y:xe-3,text:_e,anchor:"end",className:`${oe}__control-name`})),size:9,grid:f.grid,minGap:1}),{points:Te,centre:U,upper:q}}}),Je("packages/modules/charts/treemap.js",function(s,K){"use strict";Object.defineProperty(s,"squarify",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"layoutTree",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"drawTreemap",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"tileAt",{enumerable:!0,get:function(){return me}});const W=K("packages/modules/charts/frame.js").Pool,S=K("packages/modules/charts/svg.js"),pe=S.attrs,ue=S.round,V=S.setText,G=K("packages/modules/charts/styles.js").NS,j=K("packages/modules/charts/scheme.js").resolveScheme,c=K("packages/modules/charts/labels.js"),Y=c.drawAnchoredLabels,v=c.labelText,k=K("packages/modules/charts/typography.js"),F=k.applySize,J=k.truncateTo,Z=34,E=6,ne=3,M=3,X=.28;function oe(r){return r*1.6}function ee(r){return Math.round(r*1.6)}function C(r){return r>1?Math.max(.45,1-(r-1)*.22):1}function z(r,D,_){if(!r.length||D<=0||_<=0)return 1/0;const e=Math.max(...r),i=Math.min(...r),y=D*D,t=_*_;return Math.max(y*e/t,t/(y*i))}function ie(r,D){const _=[],e=r.filter(l=>l.value>0),i=e.reduce((l,u)=>l+u.value,0);if(!e.length||i<=0||D.width<=0||D.height<=0)return _;const y=e.slice().sort((l,u)=>u.value-l.value),t=D.width*D.height/i;let g={...D},m=[],b=[];const P=()=>{if(!m.length)return;const l=Math.min(g.width,g.height),x=b.reduce((d,A)=>d+A,0)/l;let n=0;for(let d=0;d<m.length;d++){const A=b[d]/x;_.push(g.width>=g.height?{item:m[d],x:g.x,y:g.y+n,width:x,height:A}:{item:m[d],x:g.x+n,y:g.y,width:A,height:x}),n+=A}g.width>=g.height?g={x:g.x+x,y:g.y,width:g.width-x,height:g.height}:g={x:g.x,y:g.y+x,width:g.width,height:g.height-x},m=[],b=[]};for(const l of y){const u=l.value*t,x=Math.min(g.width,g.height),n=z(b,x,b.reduce((A,p)=>A+p,0)),d=z([...b,u],x,b.reduce((A,p)=>A+p,0)+u);m.length&&d>n&&P(),m.push(l),b.push(l.value*t)}return P(),_}function I(r){const{plot:D,tree:_}=r,e=oe(r.fontSize),i=ee(r.fontSize),y=[],t=(g,m,b,P,l)=>{const u=g.children.filter(x=>b>0||!r.hidden.has(x.label)).map((x,n)=>({node:x,value:x.total,index:b===0?n:P}));for(const x of ie(u,m)){if(b>0&&(x.width<e||x.height<e))continue;const n={...x,depth:b+1,path:[...l,x.item.node.label],children:!1};y.push(n);const d={x:n.x+M,y:n.y+i,width:n.width-M*2,height:n.height-i-M};if(x.item.node.children.length&&d.width>=e&&d.height>=e){const A=y.length;t(x.item.node,d,b+1,n.item.index,n.path),n.children=y.length>A}}};return t(_.root,{x:D.left,y:D.top,width:D.width,height:D.height},0,0,[]),y}function $(r){const D=r.scheme||j();new W(r.groups.grid).finish(),new W(r.groups.axis).finish(),new W(r.groups.rules).finish(),new W(r.groups.labels).finish();const _=I(r),e=r.typography&&r.typography.small||r.fontSize||11,i=new W(r.groups.marks);for(const t of _)pe(i.next("rect",`${G}__tile ${G}__mark${t.children?` ${G}__tile--branch`:""}`),{x:ue(t.x),y:ue(t.y),width:ue(Math.max(0,t.width)),height:ue(Math.max(0,t.height)),fill:D.series(t.item.index),"fill-opacity":t.children?X:C(t.depth),"data-point":t.item.index,"data-depth":t.depth});i.finish();const y=new W(r.groups.overlay);for(const t of _){if(t.width<Z||t.height<r.fontSize*1.6)continue;const g=String(t.item.node.label??""),m=J(g,t.width-E*2,e);if(m!==g&&m.length<ne)continue;const b=y.next("text",`${G}__tile-label${t.children?` ${G}__tile-label--branch`:""}`);pe(b,{x:ue(t.x+E),y:ue(t.y+r.fontSize+2),"text-anchor":"start"}),F(b,e),V(b,m)}return y.finish(),r.labels&&r.labels.show&&Y({group:r.groups.labels,size:e,minGap:r.labels.minGap,anchors:_.filter(t=>!t.children&&t.width>=Z&&t.height>=r.fontSize*1.6+e).sort((t,g)=>g.width*g.height-t.width*t.height).map(t=>({x:ue(t.x+E),y:ue(t.y+r.fontSize*2+4),text:v(t.item.value,r.labels,r.grid),anchor:"start",inside:!0,width:t.width-E*2}))}),{tiles:_}}function me(r){let D=null;for(const _ of r.tiles)r.x>=_.x&&r.x<=_.x+_.width&&r.y>=_.y&&r.y<=_.y+_.height&&(!D||(_.depth||1)>(D.depth||1))&&(D=_);return D}}),Je("packages/modules/charts/matrix.js",function(s,K){"use strict";Object.defineProperty(s,"colourRamp",{enumerable:!0,get:function(){return y}}),Object.defineProperty(s,"drawHeatmap",{enumerable:!0,get:function(){return t}}),Object.defineProperty(s,"drawFunnel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(s,"drawCandlestick",{enumerable:!0,get:function(){return m}}),Object.defineProperty(s,"drawCorrelogram",{enumerable:!0,get:function(){return P}}),Object.defineProperty(s,"title",{enumerable:!0,get:function(){return u}}),Object.defineProperty(s,"cellAt",{enumerable:!0,get:function(){return x}});const W=K("packages/modules/charts/frame.js").Pool,S=K("packages/modules/charts/axis.js"),pe=S.drawAxisLines,ue=S.drawBandLabels,V=S.drawCategoryAxis,Q=S.drawMeasureAxis,G=S.leftLabelRoom,te=S.setLabelText,j=K("packages/modules/charts/format.js"),c=j.formatters,Y=j.measureText,v=K("packages/modules/charts/scale.js"),k=v.bandScale,F=v.isNumber,J=v.measureDomain,Z=K("packages/modules/charts/svg.js"),E=Z.attrs,ne=Z.path,M=Z.round,X=Z.setText,ee=K("packages/modules/charts/typography.js").applySize,z=K("packages/modules/charts/styles.js").NS,ie=K("packages/modules/charts/scheme.js"),I=ie.rampStops,$=ie.resolveScheme,me=K("packages/modules/charts/labels.js"),r=me.drawAnchoredLabels,D=me.labelText,_=Object.freeze([[236,243,249],[0,82,128]]),e=Object.freeze([[176,74,0],[247,247,247],[0,82,128]]);function i(n,d,A){const p=Math.min(1,Math.max(0,A)),w=N=>Math.round(n[N]+(d[N]-n[N])*p);return`rgb(${w(0)} ${w(1)} ${w(2)})`}function y(n,d,A){const p=n.max-n.min||1,w=A?I(A,d):d?e:_;if(!d)return f=>i(w[0],w[w.length-1],(f-n.min)/p);const N=Math.max(Math.abs(n.min),Math.abs(n.max))||1;return f=>f>=0?i(w[1],w[2],f/N):i(w[1],w[0],-f/N)}function t(n){const d=n.scheme||$(),{plot:A,bound:p}=n;new W(n.groups.grid).finish(),new W(n.groups.axis).finish(),new W(n.groups.rules).finish(),new W(n.groups.labels).finish();const w=p.series.filter(R=>!n.hidden.has(R.key)),N=[];for(const R of w)for(const U of R.points)N.push(U.y);const f=J(N,{zero:!1,nice:!1}),a=y(f,!!n.diverging,d),o=k(p.categories,[A.left,A.right],.04),h=k(w.map(R=>R.label),[A.top,A.bottom],.04),B=new W(n.groups.marks);for(const R of w){const U=h.of(R.label);if(!Number.isNaN(U))for(let q=0;q<R.points.length;q++){const se=R.points[q],T=o.of(se.x);if(Number.isNaN(T))continue;const le=B.next("rect",`${z}__cell ${z}__mark`);E(le,{x:M(T),y:M(U),width:M(o.bandwidth),height:M(h.bandwidth),fill:F(se.y)?a(se.y):"transparent","data-series":R.index,"data-point":q}),se.px=M(T+o.bandwidth/2),se.py=M(U+h.bandwidth/2)}}if(B.finish(),V({group:n.groups.overlay,plot:A,scale:o,labels:p.labels,fontSize:n.fontSize,rotated:p.labels.length>6}),ue({group:n.groups.axis,plot:A,scale:h,labels:w.map(R=>R.label),fontSize:n.fontSize}),n.labels&&n.labels.show){const R=n.typography&&n.typography.small||n.fontSize||11,U=[];for(const q of w)for(const se of q.points)se.px===void 0||!F(se.y)||U.push({x:se.px,y:se.py,text:D(se.y,n.labels,n.grid),inside:!0,width:o.bandwidth-4,height:h.bandwidth-2});r({group:n.groups.labels,size:R,minGap:0,anchors:U})}return{xScale:o,yScale:h,series:w,ramp:a}}function g(n){const d=n.scheme||$(),{plot:A,bound:p}=n;new W(n.groups.grid).finish(),new W(n.groups.axis).finish(),new W(n.groups.rules).finish(),new W(n.groups.labels).finish();const w=p.series[0],N=w?w.points.map((U,q)=>({point:U,label:p.labels[q],value:F(U.y)?U.y:0})).filter(U=>U.value>0):[];if(!N.length)return{stages:N};let f=0;for(let U=0;U<N.length;U++)N[U].value>f&&(f=N[U].value);const a=A.height/N.length,o=A.left+A.width/2,h=A.width*.62,B=new W(n.groups.marks);N.forEach((U,q)=>{const se=N[q+1],T=A.top+q*a,le=U.value/f*h/2,he=(se?se.value:U.value)/f*h/2;E(B.next("path",`${z}__funnel ${z}__mark`),{d:ne(["M",M(o-le),M(T),"L",M(o+le),M(T),"L",M(o+he),M(T+a-2),"L",M(o-he),M(T+a-2),"Z"]),fill:d.series(q),"data-point":q}),U.point.px=M(o),U.point.py=M(T+a/2)}),B.finish();const R=new W(n.groups.overlay);return N.forEach((U,q)=>{const se=A.top+q*a,T=R.next("text",`${z}__funnel-label`);E(T,{x:M(A.left+4),y:M(se+a/2),"text-anchor":"start","dominant-baseline":"middle"}),X(T,U.label);const le=R.next("text",`${z}__funnel-value`);E(le,{x:M(A.right-4),y:M(se+a/2),"text-anchor":"end","dominant-baseline":"middle"});const he=q===0?1:U.value/N[q-1].value,be=n.labels&&n.labels.show?D(U.value,n.labels,n.grid):Y(U.value,n.grid.messages);X(le,q===0?be:`${be} · ${Math.round(he*100)}%`)}),R.finish(),{stages:N}}function m(n){const d=n.scheme||$(),{plot:A,bound:p}=n,[w,N,f,a]=p.series;if(!w||!N||!f||!a)return{xScale:null,yScale:null,series:[]};const o=[];for(const se of[N,f])for(const T of se.points)o.push(T.y);const h=J(o,{zero:!1}),B={...k([],[0,0])},R=b(h,A),U=k(p.categories,[A.left,A.right],.3);Q({gridGroup:n.groups.grid,axisGroup:n.groups.axis,plot:A,scale:R,format:c(n.grid,{kind:"linear",step:(h.max-h.min)/5})}),pe({group:n.groups.rules,plot:A}),V({group:n.groups.overlay,plot:A,scale:U,labels:p.labels,fontSize:n.fontSize,rotated:p.labels.length>10});const q=new W(n.groups.marks);for(let se=0;se<p.categories.length;se++){const T=w.points[se],le=N.points[se],he=f.points[se],be=a.points[se];if(![T,le,he,be].every($e=>$e&&F($e.y)))continue;const we=U.of(p.categories[se]),ye=we+U.bandwidth/2,Me=be.y>=T.y,Te=Me?d.positive:d.negative;E(q.next("path",`${z}__wick ${z}__mark`),{d:ne(["M",M(ye),M(R.of(le.y)),"L",M(ye),M(R.of(he.y))]),stroke:Te,fill:"none"});const xe=R.of(Math.max(T.y,be.y)),_e=R.of(Math.min(T.y,be.y));E(q.next("rect",`${z}__candle ${z}__mark`),{x:M(we),y:M(xe),width:M(U.bandwidth),height:M(Math.max(1,_e-xe)),fill:Me?"transparent":Te,stroke:Te,"data-point":se}),be.px=M(ye),be.py=M(xe)}return q.finish(),{xScale:U,yScale:R,series:[a],candles:p.categories.length}}function b(n,d){const A=n.max-n.min||1;return{kind:"linear",domain:n,range:[d.bottom,d.top],of(p){return d.bottom+(p-n.min)/A*(d.top-d.bottom)},ticks(p=5){const w=[];for(let N=0;N<=p;N++)w.push(n.min+A*N/p);return w}}}function P(n){const d=n.scheme||$(),{plot:A}=n;new W(n.groups.grid).finish(),new W(n.groups.rules).finish(),new W(n.groups.labels).finish();const p=n.columns||[];if(p.length<2)return null;const w=n.grid&&n.grid.statistics;if(!w)return null;const N=n.method==="spearman"?"spearman":n.method==="kendall"?"kendall":"correlation",f=[];for(let q=0;q<p.length;q++)for(let se=0;se<p.length;se++){const T=q===se?1:w[N](p[q],p[se]);f.push({row:q,col:se,a:p[q],b:p[se],r:T})}const a=p.length,o=A.width/a,h=A.height/a,B=new W(n.groups.marks);for(const q of f){const se=A.left+q.col*o,T=A.top+q.row*h;q.x=se,q.y=T,q.width=o,q.height=h;const le=B.next("rect",`${z}__cell ${z}__mark`);E(le,{x:M(se),y:M(T),width:M(Math.max(0,o-1)),height:M(Math.max(0,h-1)),fill:q.row===q.col||q.r===null?"var(--lattice-chart-empty, #eceff1)":l(q.r,d),"data-row":q.row,"data-col":q.col}),q.element=le}B.finish();const R=new W(n.groups.overlay),U=G(A);for(let q=0;q<a;q++){const se=R.next("text",`${z}__tick`);ee(se,n.fontSize),E(se,{x:M(A.left-4),y:M(A.top+q*h+h/2),"text-anchor":"end","dominant-baseline":"middle"}),te(se,u(n.grid,p[q]),U,n.fontSize);const T=R.next("text",`${z}__tick`);ee(T,n.fontSize),E(T,{x:M(A.left+q*o+o/2),y:M(A.top-4),"text-anchor":"middle"}),te(T,u(n.grid,p[q]),o,n.fontSize)}if(n.values!==!1&&o>n.fontSize*2.6&&h>n.fontSize*1.5)for(const q of f){if(q.row===q.col||q.r===null)continue;const se=R.next("text",`${z}__data-label`);ee(se,n.fontSize),E(se,{x:M(A.left+q.col*o+o/2),y:M(A.top+q.row*h+h/2),"text-anchor":"middle","dominant-baseline":"middle","data-inside":"true"}),X(se,q.r.toFixed(2))}return R.finish(),{cells:f,columns:p}}function l(n,d){const A=Math.min(1,Math.abs(n)),p=d?I(d,!0):e,w=p[Math.floor(p.length/2)],N=n>=0?p[p.length-1]:p[0];return i(w,N,A)}function u(n,d){const A=n&&n.columns&&typeof n.columns.get=="function"?n.columns.get(d):null;return String(A&&A.title||d)}function x(n){for(const d of n.cells||[])if(d.x!==void 0&&n.x>=d.x&&n.x<=d.x+d.width&&n.y>=d.y&&n.y<=d.y+d.height)return d;return null}}),Je("packages/modules/charts/topojson.js",function(s,K){"use strict";Object.defineProperty(s,"transformer",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(s,"arcPoints",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"stitch",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(s,"decodeGeometry",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"feature",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"isTopology",{enumerable:!0,get:function(){return Q}});function Ae(G){if(!G)return F=>[F[0],F[1]];const[te,j]=G.scale,[c,Y]=G.translate;let v=0,k=0;return(F,J)=>(J||(v=0,k=0),v+=F[0],k+=F[1],[v*te+c,k*j+Y])}function W(G,te){const j=G.arcs[te],c=Ae(G.transform);return j.map((Y,v)=>c(Y,v))}function S(G,te){const j=W(G,te<0?~te:te);return te<0?j.slice().reverse():j}function pe(G,te){const j=[];for(const c of te){const Y=S(G,c);for(let v=j.length?1:0;v<Y.length;v++)j.push(Y[v])}return j}function ue(G,te){if(!te||!te.type)return null;const j=Ae(G.transform);switch(te.type){case"Point":return{type:"Point",coordinates:j(te.coordinates,0)};case"MultiPoint":return{type:"MultiPoint",coordinates:te.coordinates.map(c=>j(c,0))};case"LineString":return{type:"LineString",coordinates:pe(G,te.arcs)};case"MultiLineString":return{type:"MultiLineString",coordinates:te.arcs.map(c=>pe(G,c))};case"Polygon":return{type:"Polygon",coordinates:te.arcs.map(c=>pe(G,c))};case"MultiPolygon":return{type:"MultiPolygon",coordinates:te.arcs.map(c=>c.map(Y=>pe(G,Y)))};case"GeometryCollection":return{type:"GeometryCollection",geometries:(te.geometries||[]).map(c=>ue(G,c)).filter(Boolean)};default:return null}}function V(G,te){const j=typeof te=="string"?(G.objects||{})[te]:te;if(!j)return{type:"FeatureCollection",features:[]};const c=j.type==="GeometryCollection"?j.geometries||[]:[j],Y=[];for(const v of c){const k=ue(G,v);k&&Y.push({type:"Feature",id:v.id,properties:v.properties||{},geometry:k})}return{type:"FeatureCollection",features:Y}}function Q(G){return!!G&&typeof G=="object"&&G.type==="Topology"&&Array.isArray(G.arcs)}}),Je("packages/modules/charts/projection.js",function(s,K){"use strict";Object.defineProperty(s,"MERCATOR_LIMIT",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(s,"equalEarth",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"robinson",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"mercator",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"equirectangular",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"albers",{enumerable:!0,get:function(){return te}}),Object.defineProperty(s,"transverseMercator",{enumerable:!0,get:function(){return j}}),Object.defineProperty(s,"PROJECTIONS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"DEFAULT_PROJECTION",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(s,"resolveProjection",{enumerable:!0,get:function(){return v}}),Object.defineProperty(s,"WRAP_DEGREES",{enumerable:!0,get:function(){return k}}),Object.defineProperty(s,"splitAntimeridian",{enumerable:!0,get:function(){return F}}),Object.defineProperty(s,"boundsOf",{enumerable:!0,get:function(){return J}}),Object.defineProperty(s,"fitted",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(s,"graticule",{enumerable:!0,get:function(){return ne}});const Ae=Math.PI/180,W=Object.freeze([1.340264,-.081106,893e-6,.003796]),S=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]]),pe=85.05113;function ue(M,X){const[oe,ee,C,z]=W,ie=X*Ae,I=Math.asin(Math.min(1,Math.max(-1,Math.sqrt(3)/2*Math.sin(ie)))),$=I*I,me=$*$*$,r=Math.sqrt(3)/2*(oe+3*ee*$+me*(7*C+9*z*$));return[M*Ae*Math.cos(I)/r,I*(oe+ee*$+me*(C+z*$))]}function V(M,X){const oe=Math.min(Math.abs(X),90),ee=Math.min(S.length-2,Math.floor(oe/5)),C=(oe-ee*5)/5,[z,ie]=S[ee],[I,$]=S[ee+1],me=z+(I-z)*C,r=ie+($-ie)*C;return[M*Ae*me,(X<0?-r:r)*(Math.PI/2)]}function Q(M,X){const oe=Math.min(pe,Math.max(-pe,X))*Ae;return[M*Ae,Math.log(Math.tan(Math.PI/4+oe/2))]}function G(M,X){return[M*Ae,X*Ae]}function te(M={}){const[X,oe]=M.parallels||[29.5,45.5],[ee,C]=M.centre||[-96,37.5],z=X*Ae,ie=oe*Ae,I=Math.sin(z),$=Math.abs(z-ie)<1e-9?I:(I+Math.sin(ie))/2,me=Math.cos(z)**2+2*$*I,r=Math.sqrt(me-2*$*Math.sin(C*Ae))/$;return(D,_)=>{const e=$*((D-ee)*Ae),i=Math.max(0,me-2*$*Math.sin(_*Ae)),y=Math.sqrt(i)/$;return[y*Math.sin(e),r-y*Math.cos(e)]}}function j(M={}){const[X,oe]=M.centre||[-2,49];return(ee,C)=>{const z=C*Ae,ie=(ee-X)*Ae,I=Math.cos(z)*Math.sin(ie),$=Math.min(1-1e-12,Math.max(-1+1e-12,I));return[.5*Math.log((1+$)/(1-$)),Math.atan2(Math.tan(z),Math.cos(ie))-oe*Ae]}}const c=Object.freeze({equalEarth:()=>ue,robinson:()=>V,mercator:()=>Q,equirectangular:()=>G,albers:te,transverseMercator:j,britishNationalGrid:M=>j({centre:[-2,49],...M})}),Y="equalEarth";function v(M,X={},oe){if(typeof M=="function")return M;const C=c[typeof M=="string"&&M?M:Y];return C?C(X):(oe&&oe(`chart projection ${JSON.stringify(M)} is not one this module draws; using '${Y}'. Supported: ${Object.keys(c).join(", ")}.`),c[Y]({}))}const k=180;function F(M){if(!Array.isArray(M)||M.length<2)return M&&M.length?[M]:[];const X=[];let oe=[M[0]];for(let ee=1;ee<M.length;ee++){const[C,z]=M[ee-1],[ie,I]=M[ee],$=ie-C;if(Math.abs($)>k){const me=$>0?-180:180,r=$>0?$-360:$+360,D=r===0?0:Math.min(1,Math.max(0,(me-C)/r)),_=z+(I-z)*D;oe.push([me,_]),X.push(oe),oe=[[-me,_],[ie,I]]}else oe.push([ie,I])}return X.push(oe),X.filter(ee=>ee.length>1)}function J(M){let X=1/0,oe=1/0,ee=-1/0,C=-1/0;for(const z of M||[])for(const[ie,I]of z)ie<X&&(X=ie),ie>ee&&(ee=ie),I<oe&&(oe=I),I>C&&(C=I);return Number.isFinite(X)?{west:X,south:oe,east:ee,north:C}:null}function Z(M){const{project:X,rings:oe,plot:ee}=M,C=typeof M.padding=="number"?M.padding:4;let z=1/0,ie=1/0,I=-1/0,$=-1/0;for(const x of oe||[])for(const[n,d]of x){const[A,p]=X(n,d);!Number.isFinite(A)||!Number.isFinite(p)||(A<z&&(z=A),A>I&&(I=A),p<ie&&(ie=p),p>$&&($=p))}if(!Number.isFinite(z)||I===z||$===ie)return{to:(n,d)=>{const[A,p]=X(n,d);return[ee.left+ee.width/2+A,ee.top+ee.height/2-p]},scale:1,width:ee.width,height:ee.height,left:ee.left,top:ee.top,aspect:1};const me=Math.max(1,ee.width-C*2),r=Math.max(1,ee.height-C*2),D=typeof M.zoom=="number"&&M.zoom>0?M.zoom:1,_=Math.min(me/(I-z),r/($-ie))*D,e=(I-z)*_,i=($-ie)*_,[y,t]=M.centre?X(M.centre[0],M.centre[1]):[(z+I)/2,(ie+$)/2],g=M.centreOffset||[0,0],m=y+(g[0]||0),b=t+(g[1]||0),P=ee.left+ee.width/2,l=ee.top+ee.height/2;return{to:(x,n)=>{const[d,A]=X(x,n);return[P+(d-m)*_,l-(A-b)*_]},scale:_,width:e,height:i,left:P-e/2,top:l-i/2,aspect:(I-z)/($-ie)}}const E=2;function ne(M={}){const X=M.step&&M.step>0?M.step:30,oe=[];for(let ee=-180;ee<=180;ee+=X){const C=[];for(let z=-80;z<=80;z+=E)C.push([ee,z]);oe.push(C)}for(let ee=-60;ee<=60;ee+=X){const C=[];for(let z=-180;z<=180;z+=E)C.push([z,ee]);oe.push(C)}return oe}}),Je("packages/modules/charts/geo.js",function(s,K){"use strict";Object.defineProperty(s,"CONTINENTS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(s,"CONTINENT_NAMES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(s,"OUTLINES",{enumerable:!0,get:function(){return y}}),Object.defineProperty(s,"COUNTRY_CONTINENT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(s,"ALPHA3",{enumerable:!0,get:function(){return g}}),Object.defineProperty(s,"NUMERIC",{enumerable:!0,get:function(){return m}}),Object.defineProperty(s,"normaliseCode",{enumerable:!0,get:function(){return b}}),Object.defineProperty(s,"continentOf",{enumerable:!0,get:function(){return P}}),Object.defineProperty(s,"projection",{enumerable:!0,get:function(){return l}}),Object.defineProperty(s,"projectedPath",{enumerable:!0,get:function(){return u}}),Object.defineProperty(s,"ringPath",{enumerable:!0,get:function(){return x}}),Object.defineProperty(s,"shapesToPaths",{enumerable:!0,get:function(){return n}}),Object.defineProperty(s,"registerGeoPack",{enumerable:!0,get:function(){return A}}),Object.defineProperty(s,"geoPack",{enumerable:!0,get:function(){return p}}),Object.defineProperty(s,"geoPacks",{enumerable:!0,get:function(){return w}}),Object.defineProperty(s,"resolvePack",{enumerable:!0,get:function(){return N}}),Object.defineProperty(s,"packRegions",{enumerable:!0,get:function(){return a}}),Object.defineProperty(s,"regionLabelPoint",{enumerable:!0,get:function(){return h}}),Object.defineProperty(s,"geoRamp",{enumerable:!0,get:function(){return B}}),Object.defineProperty(s,"drawGeomap",{enumerable:!0,get:function(){return U}}),Object.defineProperty(s,"regionAt",{enumerable:!0,get:function(){return q}}),Object.defineProperty(s,"markerAt",{enumerable:!0,get:function(){return se}});const W=K("packages/modules/charts/frame.js").Pool,pe=K("packages/modules/charts/matrix.js").colourRamp,V=K("packages/modules/charts/topojson.js").feature,Q=K("packages/modules/charts/projection.js"),G=Q.fitted,te=Q.graticule,j=Q.resolveProjection,c=Q.splitAntimeridian,v=K("packages/modules/charts/labels.js").drawAnchoredLabels,k=K("packages/modules/charts/axis.js"),F=k.overhangFor,J=k.setPlotClip,E=K("packages/core/src/internal/util.js").warnOnce,M=K("packages/modules/charts/scheme.js").resolveScheme,X=K("packages/modules/charts/scale.js"),oe=X.isNumber,ee=X.measureDomain,C=K("packages/modules/charts/svg.js"),z=C.attrs,ie=C.insideRings,I=C.path,$=C.pathRings,me=C.round,r=C.setText,_=K("packages/modules/charts/styles.js").NS,e=Object.freeze(["AF","AN","AS","EU","NA","OC","SA"]),i=Object.freeze({AF:"Africa",AN:"Antarctica",AS:"Asia",EU:"Europe",NA:"North America",OC:"Oceania",SA:"South America"}),y=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]]]}),t=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"}),g=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"}),m=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 b(T){if(T==null||T==="")return null;const le=String(T).trim().toUpperCase();return le?/^\d+$/.test(le)?m[String(Number(le))]||null:le.length===2?le:le.length===3&&g[le]||null:null}function P(T){return T?e.includes(T)&&!(T in t)||e.includes(T)?T:t[T]||null:null}function l(T,le={}){const he=le.antarctic?-90:-58,be=84,we=be-he,ye=Math.min(T.width/360,T.height/we),Me=360*ye,Te=we*ye,xe=T.left+(T.width-Me)/2,_e=T.top+(T.height-Te)/2;return($e,Pe)=>[xe+($e+180)*ye,_e+(be-Pe)*ye]}function u(T,le){const he=[];for(let be=0;be<T.length;be++){const[we,ye]=le(T[be][0],T[be][1]);if(!Number.isFinite(we)||!Number.isFinite(ye))return he.length>4?I([...he,"Z"]):"";he.push(be?"L":"M",me(we),me(ye))}return he.length?I([...he,"Z"]):""}function x(T,le){const he=Array.isArray(T)&&Array.isArray(T[0])&&Array.isArray(T[0][0])?T:[T],be=[];for(const we of he)if(!(!Array.isArray(we)||!we.length)){for(let ye=0;ye<we.length;ye++){const[Me,Te]=le(we[ye][0],we[ye][1]);be.push(ye?"L":"M",me(Me),me(Te))}be.push("Z")}return I(be)}function n(T){const le=new Map,he=T.shapes;if(!he)return le;const be=l(T.plot),we=T.codeProperty||"iso_a2";if(!Array.isArray(he)&&!he.type){for(const Me of Object.keys(he)){const Te=b(Me);Te&&typeof he[Me]=="string"&&le.set(Te,he[Me])}return le}const ye=he.type==="FeatureCollection"?he.features||[]:[he];for(const Me of ye){const Te=Me.properties||{},xe=b(Te[we]??Te.iso??Te.code),_e=Me.geometry;if(!xe||!_e)continue;const $e=_e.type==="MultiPolygon"?_e.coordinates:_e.type==="Polygon"?[_e.coordinates]:[],Pe=[];for(const Ie of $e)for(const He of Ie)Pe.push(x(He,be));Pe.length&&le.set(xe,Pe.join(" "))}return le}const d=new Map;function A(T){return T&&typeof T=="object"&&typeof T.id=="string"&&d.set(T.id,T),T}function p(T){return d.get(T)||null}function w(){return[...d.keys()]}function N(T,le){if(!T||typeof T!="object")return null;const he=T;let be=T;if(typeof he.pack=="string"){if(be=d.get(he.pack),!be)return E(`chart:geomap:pack:${he.pack}`,`geometry pack ${JSON.stringify(he.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-${he.pack}'; createChart({ …, shapes: pack })${d.size?`. Loaded: ${[...d.keys()].join(", ")}.`:"."}`),null}else he.pack&&typeof he.pack=="object"&&(be=he.pack);if(!be||typeof be!="object")return null;const we=be;if(we.topology)return{pack:we,topology:we.topology};if(we.layers){const ye=typeof he.layer=="string"&&he.layer||typeof le=="string"&&le||we.defaultLayer||Object.keys(we.layers)[0],Me=we.layers[ye];if(Me&&Me.topology)return{pack:we,topology:Me.topology,layer:ye}}return null}const f=new WeakMap;function a(T){const le=f.get(T);if(le)return le;const he=[];for(const be of V(T,"regions").features){const we=[],ye=be.geometry,Me=ye.type==="MultiPolygon"?ye.coordinates:ye.type==="Polygon"?[ye.coordinates]:[];for(const Te of Me)for(const xe of Te)for(const _e of c(xe))we.push(_e);we.length&&he.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:we})}return f.set(T,he),he}function o(T,le){const he=[];for(let be=0;be<T.length;be++){const[we,ye]=le(T[be][0],T[be][1]);!Number.isFinite(we)||!Number.isFinite(ye)||he.push(he.length?"L":"M",me(we),me(ye))}return he.length>2?I(he):""}function h(T){let le=null,he=-1;for(const ye of T){if(!ye||ye.length<3)continue;let Me=0,Te=0,xe=0;for(let $e=0;$e<ye.length;$e++){const[Pe,Ie]=ye[$e],[He,We]=ye[($e+1)%ye.length],ot=Pe*We-He*Ie;Me+=ot,Te+=(Pe+He)*ot,xe+=(Ie+We)*ot}Me/=2;const _e=Math.abs(Me);_e<1e-9||_e>he&&(he=_e,le=[Te/(6*Me),xe/(6*Me)])}if(le)return le;const be=T.flat();if(!be.length)return null;const we=be.reduce((ye,[Me,Te])=>[ye[0]+Me,ye[1]+Te],[0,0]);return[we[0]/be.length,we[1]/be.length]}function B(T,le,he){const be=pe(T,le,he);if(le)return be;const we=T.max-T.min||1,ye=1/6;return Me=>be(T.min+(ye+(Me-T.min)/we*(1-ye))*we)}function R(T,le){return(he,be)=>{const[we,ye]=T(he,be);return!Number.isFinite(we)||!Number.isFinite(ye)?[we,ye]:[Math.min(Math.max(we,le.left),le.right),Math.min(Math.max(ye,le.top),le.bottom)]}}function U(T){const le=T.scheme||M(),{plot:he,bound:be}=T;new W(T.groups.grid).finish(),new W(T.groups.axis).finish(),new W(T.groups.rules).finish(),new W(T.groups.labels).finish();const we=N(T.shapes,T.layer),ye=we?new Map:n({shapes:T.shapes,plot:he,codeProperty:T.codeProperty}),Me=ye.size>0||!!we,Te=we?a(we.topology):null,xe=new Map;if(Te)for(const fe of Te){xe.set(fe.code,fe);const de=fe.properties||{};de.alpha3&&xe.set(String(de.alpha3).toUpperCase(),fe),de.numeric&&xe.set(String(Number(de.numeric)),fe),de.fips&&xe.set(String(de.fips),fe)}const _e=new Map,$e=[],Pe=be.series[0];if(Pe)for(let fe=0;fe<Pe.points.length;fe++){const de=Pe.points[fe];if(!oe(de.y))continue;const ge=be.categories[fe],Se=b(ge),ce=Te?[Se,ge==null?"":String(ge).trim().toUpperCase()].map(Ce=>Ce?xe.get(Ce):null).find(Boolean):null,ke=ce?ce.code:null,Oe=Te?ke:Me?Se:P(Se);if(!Oe||Me&&!Te&&!ye.has(Oe)){be.labels[fe]&&$e.push(be.labels[fe]);continue}const Ne=_e.get(Oe)||{value:0,labels:[]};Ne.value+=de.y,Ne.labels.push(be.labels[fe]),_e.set(Oe,Ne)}const Ie=_e.has("AN")||_e.has("AQ"),He=l(he,{antarctic:Ie});let We=null;if(Te){const fe=Ie?Te:Te.filter(ge=>ge.code!=="AQ"&&ge.code!=="AN"),de=j(T.projection||we.pack.projection,{...we.pack.projectionOptions||{},...T.projectionOptions||{}},ge=>E(`chart:geomap:projection:${String(T.projection)}`,ge));We={project:de,...G({project:de,rings:fe.flatMap(ge=>ge.rings),plot:he,zoom:T.zoom,centre:T.centre,centreOffset:T.centreOffset}),drawn:fe}}const ot=ee([..._e.values()].map(fe=>fe.value),{zero:!T.diverging,nice:!1}),dt=B(ot,!!T.diverging,le),ut=F("geomap");J(T.groups,he,ut);const bt={left:he.left-ut,top:he.top-ut,right:he.right+ut,bottom:he.bottom+ut},yt=We?R(We.to,bt):null,vt=new W(T.groups.marks);if(!!T.graticule&&!!We){const fe=T.graticule&&typeof T.graticule=="object"&&T.graticule.step||30;for(const de of te({step:fe}))for(const ge of c(de)){const Se=o(ge,yt);if(!Se)continue;const ce=vt.next("path",`${_}__graticule`);z(ce,{d:Se,class:`${_}__graticule`})}}const xt=[],zt=We?We.drawn.map(fe=>fe.code):Me?[...ye.keys()]:e.filter(fe=>fe!=="AN"||Ie),$t=We?new Map(We.drawn.map(fe=>[fe.code,fe])):null;for(const fe of zt){const de=We?$t.get(fe).rings.map(ce=>u(ce,yt)).filter(Boolean).join(" "):Me?ye.get(fe):x(y[fe],He),ge=_e.get(fe),Se=vt.next("path",`${_}__region ${_}__mark`);z(Se,{d:de,fill:ge?dt(ge.value):"var(--lattice-chart-empty, #eceff1)","data-code":fe,class:`${_}__region ${_}__mark`}),xt.push({code:fe,value:ge?ge.value:null,label:!Me&&i[fe]||$t&&$t.get(fe).label||ge&&ge.labels[0]||fe,element:Se,d:de})}vt.finish();const Rt=new W(T.groups.overlay);if($e.length){const fe=Rt.next("text",`${_}__geo-note`);z(fe,{x:me(he.left),y:me(he.bottom),"text-anchor":"start"}),r(fe,T.grid.messages.t("chart.geoUnmatched",{count:$e.length}))}Rt.finish();let O=0;if(T.labels&&T.labels.show&&We){const fe=xt.filter(de=>de.value!==null).sort((de,ge)=>ge.value-de.value).map(de=>{const ge=$t.get(de.code).rings.map(ce=>ce.map(([ke,Oe])=>We.to(ke,Oe))),Se=h(ge);return Se&&{x:Se[0],y:Se[1],text:de.label}}).filter(Boolean);O=v({group:T.groups.labels,size:T.fontSize,minGap:T.labels.minGap,anchors:fe,plot:he})}return{regions:xt,ramp:dt,unmatched:$e,useCountries:Me,packed:!!We,scale:We?We.scale:null,attribution:we&&we.pack.attribution||"",aspect:We?We.aspect:null,labelsDrawn:O}}function q(T){for(const le of T.regions||[]){if(!le.rings){le.rings=$(le.d);let be=1/0,we=1/0,ye=-1/0,Me=-1/0;for(const Te of le.rings)for(const[xe,_e]of Te)xe<be&&(be=xe),xe>ye&&(ye=xe),_e<we&&(we=_e),_e>Me&&(Me=_e);le.box={minX:be,minY:we,maxX:ye,maxY:Me}}const he=le.box;if(!(!he||T.x<he.minX||T.x>he.maxX||T.y<he.minY||T.y>he.maxY)&&ie(le.rings,T.x,T.y))return le}return null}function se(T){let he=null,be=1/0;for(const we of T.markers||[]){if(!we)continue;const ye=(we.r||0)+3,Me=T.x-we.x,Te=T.y-we.y,xe=Math.sqrt(Me*Me+Te*Te);xe>ye||xe>=be||(be=xe,he=we)}return he}}),Je("packages/modules/charts/rulecolour.js",function(s,K){"use strict";Object.defineProperty(s,"colourOf",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"ruleColour",{enumerable:!0,get:function(){return S}}),Object.defineProperty(s,"ruleLegend",{enumerable:!0,get:function(){return pe}});const Ae="*";function W(ue){if(!ue||typeof ue!="object")return null;for(const V of["background","backgroundColor","color"]){const Q=ue[V];if(typeof Q=="string"&&Q.trim())return Q.trim()}return null}function S(ue){const{grid:V,col:Q,value:G}=ue;if(!V||!Q||!V.formatting||typeof V.formatting.styleFor!="function")return null;try{return W(V.formatting.styleFor(Q,G))}catch{return null}}function pe(ue){const{grid:V,col:Q}=ue,G=new Set([...ue.colours||[]].filter(Boolean));if(!G.size||!V||!V.formatting||typeof V.formatting.list!="function")return[];let te;try{te=[...V.formatting.list(Ae)||[],...Q?V.formatting.list(Q)||[]:[]]}catch{return[]}const j=[],c=new Set;for(const Y of te){if(!Y||Y.enabled===!1)continue;const v=W(Y.style);!v||!G.has(v)||c.has(v)||(c.add(v),j.push({key:Y.id||`rule:${j.length}`,label:Y.label||Y.id||v,colour:v,index:j.length}))}return j}}),Je("packages/modules/charts/network.js",function(s,K){"use strict";Object.defineProperty(s,"ITERATIONS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(s,"LINK_GAP",{enumerable:!0,get:function(){return C}}),Object.defineProperty(s,"ICON_RADIUS",{enumerable:!0,get:function(){return z}}),Object.defineProperty(s,"sequence",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"layoutNetwork",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"glyphFor",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"glyphTransform",{enumerable:!0,get:function(){return me}}),Object.defineProperty(s,"offsetParallel",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"drawNetwork",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"emphasiseNetwork",{enumerable:!0,get:function(){return _}}),Object.defineProperty(s,"nodeAt",{enumerable:!0,get:function(){return i}}),Object.defineProperty(s,"linkAt",{enumerable:!0,get:function(){return y}});const W=K("packages/modules/charts/frame.js").Pool,pe=K("packages/modules/charts/scheme.js").resolveScheme,ue=K("packages/modules/charts/svg.js"),V=ue.attrs,Q=ue.path,G=ue.round,te=ue.setText,c=K("packages/modules/charts/styles.js").NS,Y=K("packages/modules/charts/typography.js"),v=Y.applySize,k=Y.truncateTo,F=K("packages/modules/charts/rulecolour.js"),J=F.ruleColour,Z=F.ruleLegend,ne=K("packages/core/src/internal/util.js").warnOnce,M=220,X=2400,oe=.006,ee=.015,C=4,z=10;function ie(t){let g=t>>>0||1;return()=>(g^=g<<13,g>>>=0,g^=g>>17,g^=g<<5,g>>>=0,g/4294967296)}function I(t){const{nodes:g,links:m,plot:b}=t;if(!g.length)return g;const P=ie(g.length*2654435761),l=b.left+b.width/2,u=b.top+b.height/2,x=Math.min(b.width,b.height)/3;for(const d of g){const A=P()*Math.PI*2,p=x*(.35+P()*.65);d.x=l+Math.cos(A)*p,d.y=u+Math.sin(A)*p,d.vx=0,d.vy=0}for(const d of g)d.pinned=Number.isFinite(d.fx)&&Number.isFinite(d.fy),d.pinned&&(d.x=b.left+Math.max(0,Math.min(1,d.fx))*b.width,d.y=b.top+Math.max(0,Math.min(1,d.fy))*b.height);const n=t.iterations||M;for(let d=0;d<n;d++){const A=1-d/n;for(let p=0;p<g.length;p++){const w=g[p];for(let N=p+1;N<g.length;N++){const f=g[N];let a=w.x-f.x,o=w.y-f.y,h=Math.sqrt(a*a+o*o);h<.01&&(a=p-N||1,o=1,h=Math.sqrt(a*a+o*o));const B=X/(h*h),R=a/h*B,U=o/h*B;w.vx+=R,w.vy+=U,f.vx-=R,f.vy-=U}}for(const p of m){const w=p.source,N=p.target;if(w===N)continue;const f=N.x-w.x,a=N.y-w.y,o=oe*(p.weight||1);w.vx+=f*o,w.vy+=a*o,N.vx-=f*o,N.vy-=a*o}for(const p of g){if(p.pinned){p.vx=0,p.vy=0;continue}p.vx+=(l-p.x)*ee,p.vy+=(u-p.y)*ee,p.x+=p.vx*A*.08,p.y+=p.vy*A*.08,p.vx*=.82,p.vy*=.82,p.x=Math.max(b.left+8,Math.min(b.right-8,p.x)),p.y=Math.max(b.top+8,Math.min(b.bottom-8,p.y))}}return g}function $(t,g){if(!g)return null;const m=t&&t.icons;if(!m||typeof m.get!="function")return ne(`chart:icons:${g}`,`A network node asked for the icon '${g}', but this grid publishes no icon registry — a headless grid has no sprites. The node drew as a plain disc.`),null;const b=m.get(g);return b||(ne(`chart:icon:${g}`,`Unknown icon '${g}' on a network node; drew a plain disc instead. Register it with registerIcon or config.icons, or name a built-in.`),null)}function me(t,g){const m=String(t.viewBox||"0 0 16 16").trim().split(/[\s,]+/).map(Number),[b,P,l,u]=m.length===4&&m.every(Number.isFinite)?m:[0,0,16,16],x=Math.max(l||16,u||16),n=g.size/x,d=g.x-l*n/2,A=g.y-u*n/2;return`translate(${G(d-b*n)} ${G(A-P*n)}) scale(${G(n)})`}function r(t){const g=new Map;for(const m of t){const b=m.pair||`${m.source.key}\0${m.target.key}`;g.has(b)||g.set(b,[]),g.get(b).push(m)}for(const m of g.values()){const b=m.length;for(let P=0;P<b;P++){const l=m[P],u=l.source,x=l.target,n=x.x-u.x,d=x.y-u.y,A=Math.sqrt(n*n+d*d)||1,p=A?-d/A:0,w=A?n/A:1,N=(P-(b-1)/2)*C;l.offset=N,l.bundled=b>1,l.line={x1:u.x+p*N,y1:u.y+w*N,x2:x.x+p*N,y2:x.y+w*N}}}}function D(t){const g=t.scheme||pe(),{plot:m,bound:b}=t;for(const h of["grid","axis","rules","labels"])new W(t.groups[h]).finish();const P=b.nodes,l=b.links.map(h=>({...h,weight:h.value}));if(!P.length)return{nodes:[],links:[],legend:[]};const u=l.reduce((h,B)=>Math.max(h,B.value),0)||1;for(const h of l)h.weight=h.value/u;I({nodes:P,links:l,plot:m,iterations:t.iterations}),r(l);const x=b.measure&&b.measure.col||null,n=new Set;for(const h of l)h.colour=J({grid:t.grid,col:x,value:h.value}),h.colour&&n.add(h.colour);const d=P.reduce((h,B)=>Math.max(h,B.in+B.out),0)||1,A=new W(t.groups.marks),p=Number.isFinite(t.linkWidth)&&t.linkWidth>0?Number(t.linkWidth):null;for(const h of l){h.drawnWidth=p===null?.5+h.weight*3:p;const B=A.next("path",`${c}__edge ${c}__mark`);V(B,{d:Q(["M",G(h.line.x1),G(h.line.y1),"L",G(h.line.x2),G(h.line.y2)]),style:h.colour?`stroke:${h.colour};stroke-opacity:1`:null,"stroke-width":G(h.drawnWidth),fill:"none"}),h.el=B}for(const h of P){const B=(h.in+h.out)/d,R=h.icon||t.icon||null;h.glyph=$(t.grid,R),h.r=4+Math.sqrt(B)*12,h.glyph&&(h.r=Math.max(h.r,z));const U=A.next("circle",`${c}__node ${c}__mark`);V(U,{cx:G(h.x),cy:G(h.y),r:G(h.r),fill:g.series(h.index),"data-node":h.key}),h.el=U}A.finish();const w=new W(t.groups.overlay),N=[];for(const h of P){if(!h.glyph){h.glyphEls=[];continue}const B=h.glyph.paint==="stroke",R=me(h.glyph,{x:h.x,y:h.y,size:h.r*1.3});h.glyphEls=h.glyph.paths.map(U=>{const q=w.next("path",`${c}__node-icon${B?` ${c}__node-icon--stroke`:""}`);return V(q,{d:U,transform:R}),q}),N.push(...h.glyphEls)}const f=t.typography&&t.typography.small||t.fontSize,a=P.filter(h=>h.declared),o=P.filter(h=>!h.declared).sort((h,B)=>B.in+B.out-(h.in+h.out)).slice(0,12);for(const h of[...a,...o]){const B=w.next("text",`${c}__flow-label`);v(B,f),V(B,{x:G(h.x),y:G(h.y+h.r+f),"text-anchor":"middle"}),te(B,k(h.label,90,f)),h.labelEl=B}return w.finish(),{nodes:P,links:l,glyphs:N,legend:Z({grid:t.grid,col:x,colours:n})}}function _(t){const g=t.drawn||{},m=t.keys||new Set,b=m.size>0;let P=0;const l=new Set;for(const u of g.links||[]){const x=b&&(u.rowKeys||[]).some(n=>m.has(n));x&&(P++,l.add(u.source),l.add(u.target)),e(u.el,b&&!x)}for(const u of g.nodes||[]){const x=l.has(u);x&&P++,e(u.el,b&&!x);for(const n of u.glyphEls||[])e(n,b&&!x)}return P}function e(t,g){!t||!t.setAttribute||(g?t.setAttribute("data-dim","true"):t.removeAttribute("data-dim"))}function i(t){const g=typeof t.slack=="number"?t.slack:2;let m=null,b=1/0;for(const P of t.nodes||[]){if(typeof P.x!="number"||typeof P.y!="number")continue;const l=t.x-P.x,u=t.y-P.y,x=Math.sqrt(l*l+u*u);x<=(P.r||0)+g&&x<b&&(b=x,m=P)}return m}function y(t){let g=null,m=1/0;for(const b of t.links||[]){const P=b.line,l=P?{x:P.x1,y:P.y1}:b.source,u=P?{x:P.x2,y:P.y2}:b.target;if(!l||!u||typeof l.x!="number"||typeof u.x!="number")continue;const x=u.x-l.x,n=u.y-l.y,d=x*x+n*n,A=d?Math.max(0,Math.min(1,((t.x-l.x)*x+(t.y-l.y)*n)/d)):0,p=t.x-(l.x+A*x),w=t.y-(l.y+A*n),N=Math.sqrt(p*p+w*w),f=Number.isFinite(b.drawnWidth)?b.drawnWidth:.5+(b.weight||0)*3,a=b.bundled?Math.min(Math.max(2,f/2),C/2):Math.max(3,f/2);N<=a&&N<m&&(m=N,g=b)}return g}}),Je("packages/modules/charts/flow.js",function(s,K){"use strict";Object.defineProperty(s,"assignDepths",{enumerable:!0,get:function(){return C}}),Object.defineProperty(s,"layoutSankey",{enumerable:!0,get:function(){return z}}),Object.defineProperty(s,"ribbon",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"drawSankey",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"layoutChord",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"drawChord",{enumerable:!0,get:function(){return me}}),Object.defineProperty(s,"describeLink",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"flowNodeAt",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"ribbonAt",{enumerable:!0,get:function(){return _}}),Object.defineProperty(s,"chordArcAt",{enumerable:!0,get:function(){return e}}),Object.defineProperty(s,"chordRibbonAt",{enumerable:!0,get:function(){return i}}),Object.defineProperty(s,"chordPolygon",{enumerable:!0,get:function(){return y}});const W=K("packages/modules/charts/frame.js").Pool,pe=K("packages/modules/charts/format.js").measureText,V=K("packages/modules/charts/scheme.js").resolveScheme,Q=K("packages/modules/charts/svg.js"),G=Q.attrs,te=Q.insideRings,j=Q.path,c=Q.round,Y=Q.setText,k=K("packages/modules/charts/styles.js").NS,F=K("packages/modules/charts/typography.js"),J=F.applySize,Z=F.textWidth,E=F.truncateTo,ne=Math.PI*2,M=12,X=8,oe=-Math.PI/2,ee=16;function C(t,g){for(const u of t)u.depth=0;const m=t.length+1;for(let u=0;u<m;u++){let x=!1;for(const n of g){if(n.source===n.target)continue;const d=n.source.depth+1;d>n.target.depth&&d<m&&(n.target.depth=d,x=!0)}if(!x)break}const b=t.reduce((u,x)=>Math.max(u,x.depth),0),P=new Set,l=new Set;for(const u of g)u.source!==u.target&&(P.add(u.source),l.add(u.target));for(const u of t)!P.has(u)&&l.has(u)&&(u.depth=b);return b+1}function z(t){const{nodes:g,links:m,plot:b}=t,P=C(g,m),l=t.nodeWidth||M,u=new Map;for(const p of g)u.has(p.depth)||u.set(p.depth,[]),u.get(p.depth).push(p);let x=0;for(const p of u.values()){const w=p.reduce((f,a)=>f+Math.max(a.in,a.out),0),N=Math.max(0,p.length-1)*X;w>0&&(x=Math.max(x,w/Math.max(1,b.height-N)))}const n=x>0?1/x:0,d=P>1?(b.width-l)/(P-1):0;for(const[p,w]of u){w.sort((o,h)=>Math.max(h.in,h.out)-Math.max(o.in,o.out));const N=w.map(o=>Math.max(1,Math.max(o.in,o.out)*n)),f=N.reduce((o,h)=>o+h,0)+(w.length-1)*X;let a=b.top+Math.max(0,(b.height-f)/2);w.forEach((o,h)=>{o.x=b.left+p*d,o.width=l,o.y=a,o.height=N[h],o.inAt=a,o.outAt=a,a+=N[h]+X})}const A=m.slice().sort((p,w)=>p.source.y-w.source.y||w.value-p.value);for(const p of A){const w=Math.max(1,p.value*n);p.thickness=w,p.y0=p.source.outAt+w/2,p.source.outAt+=w}for(const p of A.slice().sort((w,N)=>w.target.y-N.target.y||N.value-w.value))p.y1=p.target.inAt+p.thickness/2,p.target.inAt+=p.thickness;return{columns:P,scale:n}}function ie(t){const g=t.source.x+t.source.width,m=t.target.x,b=(g+m)/2,P=t.thickness/2;return j(["M",c(g),c(t.y0-P),"C",c(b),c(t.y0-P),c(b),c(t.y1-P),c(m),c(t.y1-P),"L",c(m),c(t.y1+P),"C",c(b),c(t.y1+P),c(b),c(t.y0+P),c(g),c(t.y0+P),"Z"])}function I(t){const g=t.scheme||V(),{plot:m,bound:b}=t;for(const d of["grid","axis","rules","labels"])new W(t.groups[d]).finish();const P=b.nodes,l=b.links;if(!P.length||!l.length)return{nodes:[],links:[]};z({nodes:P,links:l,plot:m});const u=new W(t.groups.marks);for(const d of l){const A=u.next("path",`${k}__ribbon ${k}__mark`);G(A,{d:ie(d),fill:g.series(d.source.index),"data-link":`${d.source.key}->${d.target.key}`})}for(const d of P)G(u.next("rect",`${k}__node ${k}__mark`),{x:c(d.x),y:c(d.y),width:c(d.width),height:c(d.height),fill:g.series(d.index),"data-node":d.key});u.finish();const x=new W(t.groups.overlay),n=t.typography&&t.typography.small||t.fontSize;for(const d of P){const A=d.x<m.left+m.width/2,p=x.next("text",`${k}__flow-label`);J(p,n),G(p,{x:c(A?d.x+d.width+4:d.x-4),y:c(d.y+d.height/2),"text-anchor":A?"start":"end","dominant-baseline":"middle"});const w=A?m.right-(d.x+d.width)-6:d.x-m.left-6;Y(p,E(d.label,Math.max(0,w),n))}return x.finish(),{nodes:P,links:l}}function $(t){const{nodes:g,links:m}=t,b=new Map;for(const p of g)b.set(p.key,0);for(const p of m)b.set(p.source.key,(b.get(p.source.key)||0)+p.value),b.set(p.target.key,(b.get(p.target.key)||0)+p.value);const P=[...b.values()].reduce((p,w)=>p+w,0);if(P<=0)return{arcs:[],ribbons:[]};const l=Math.min(.04,ne/(g.length*8||1)),u=ne-l*g.length,x=[];let n=-Math.PI/2;const d=new Map;for(const p of g){const N=(b.get(p.key)||0)/P*u;x.push({node:p,from:n,to:n+N}),d.set(p.key,n),n+=N+l}const A=[];for(const p of m.slice().sort((w,N)=>N.value-w.value)){const w=p.value/P*u,N=d.get(p.source.key),f=d.get(p.target.key);d.set(p.source.key,N+w),d.set(p.target.key,f+w),A.push({link:p,source:{from:N,to:N+w},target:{from:f,to:f+w}})}return{arcs:x,ribbons:A}}function me(t){const g=t.scheme||V(),{plot:m,bound:b}=t;for(const a of["grid","axis","rules","labels"])new W(t.groups[a]).finish();const P=m.left+m.width/2,l=m.top+m.height/2,u=t.typography&&t.typography.small||t.fontSize,x=Math.max(...b.nodes.map(a=>Z(a.label,u)),0),n=Math.max(10,Math.min(m.width,m.height)/2-Math.min(x+8,90)),d=n*.92,{arcs:A,ribbons:p}=$({nodes:b.nodes,links:b.links,cx:P,cy:l,radius:n}),w=(a,o)=>[P+o*Math.cos(a),l+o*Math.sin(a)],N=new W(t.groups.marks);for(const{link:a,source:o,target:h}of p){const[B,R]=w(o.from,d),[U,q]=w(o.to,d),[se,T]=w(h.from,d),[le,he]=w(h.to,d);G(N.next("path",`${k}__ribbon ${k}__mark`),{d:j(["M",c(B),c(R),"A",c(d),c(d),0,0,1,c(U),c(q),"Q",c(P),c(l),c(se),c(T),"A",c(d),c(d),0,0,1,c(le),c(he),"Q",c(P),c(l),c(B),c(R),"Z"]),fill:g.series(a.source.index),"fill-opacity":.55,"data-link":`${a.source.key}->${a.target.key}`})}for(const a of A){const[o,h]=w(a.from,n),[B,R]=w(a.to,n),[U,q]=w(a.to,d),[se,T]=w(a.from,d),le=a.to-a.from>Math.PI?1:0;G(N.next("path",`${k}__node ${k}__mark`),{d:j(["M",c(o),c(h),"A",c(n),c(n),0,le,1,c(B),c(R),"L",c(U),c(q),"A",c(d),c(d),0,le,0,c(se),c(T),"Z"]),fill:g.series(a.node.index),"data-node":a.node.key})}N.finish();const f=new W(t.groups.overlay);for(const a of A){const o=(a.from+a.to)/2,[h,B]=w(o,n+6),R=f.next("text",`${k}__flow-label`);J(R,u);const U=Math.cos(o)>=0;G(R,{x:c(h),y:c(B),"text-anchor":U?"start":"end","dominant-baseline":"middle"}),Y(R,a.node.label)}return f.finish(),{arcs:A,ribbons:p,ring:{cx:P,cy:l,inner:d,radius:n}}}function r(t,g){return`${t.source.label} → ${t.target.label}: ${pe(t.value,g)}`}function D(t){for(const g of t.nodes||[])if(!(typeof g.x!="number"||typeof g.width!="number")&&t.x>=g.x&&t.x<=g.x+g.width&&t.y>=g.y&&t.y<=g.y+g.height)return g;return null}function _(t){let g=null,m=1/0;for(const b of t.links||[]){const P=b.source,l=b.target;if(!P||!l||typeof b.y0!="number")continue;const u=P.x+P.width,x=l.x;if(t.x<Math.min(u,x)||t.x>Math.max(u,x))continue;const n=(u+x)/2,d=o=>{const h=1-o;return h*h*h*u+3*h*h*o*n+3*h*o*o*n+o*o*o*x};let A=0,p=1;for(let o=0;o<24;o++){const h=(A+p)/2;d(h)<t.x?A=h:p=h}const w=(A+p)/2,N=1-w,f=N*N*N*b.y0+3*N*N*w*b.y0+3*N*w*w*b.y1+w*w*w*b.y1,a=Math.max(1,b.thickness||1)/2;Math.abs(t.y-f)<=a&&(b.thickness||1)<m&&(m=b.thickness||1,g=b)}return g}function e(t){const g=t.ring;if(!g)return null;const m=t.x-g.cx,b=t.y-g.cy,P=Math.sqrt(m*m+b*b);if(P<g.inner||P>g.radius)return null;let l=Math.atan2(b,m);for(;l<oe;)l+=ne;for(;l>=oe+ne;)l-=ne;for(const u of t.arcs||[])if(l>=u.from&&l<u.to)return u;return null}function i(t){const g=t.ring;if(!g)return null;const m=t.x-g.cx,b=t.y-g.cy;if(Math.sqrt(m*m+b*b)>g.inner)return null;for(const P of t.ribbons||[])if(te([y(P,g)],t.x,t.y))return P;return null}function y(t,g){const{cx:m,cy:b,inner:P}=g,l=d=>[m+P*Math.cos(d),b+P*Math.sin(d)],u=[],x=(d,A)=>{for(let p=0;p<=ee;p++)u.push(l(d+(A-d)*p/ee))},n=(d,A)=>{for(let p=1;p<ee;p++){const w=p/ee,N=1-w;u.push([N*N*d[0]+2*N*w*m+w*w*A[0],N*N*d[1]+2*N*w*b+w*w*A[1]])}};return x(t.source.from,t.source.to),n(l(t.source.to),l(t.target.from)),x(t.target.from,t.target.to),n(l(t.target.to),l(t.source.from)),u}}),Je("packages/modules/charts/hit.js",function(s,K){"use strict";Object.defineProperty(s,"valueText",{enumerable:!0,get:function(){return X}}),Object.defineProperty(s,"ownsGeometry",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"resolveHit",{enumerable:!0,get:function(){return me}});const W=K("packages/modules/charts/format.js").measureText,pe=K("packages/modules/charts/treemap.js").tileAt,ue=K("packages/modules/charts/geo.js"),V=ue.markerAt,Q=ue.regionAt,te=K("packages/modules/charts/matrix.js").cellAt,j=K("packages/modules/charts/network.js"),c=j.linkAt,Y=j.nodeAt,v=K("packages/modules/charts/flow.js"),k=v.chordArcAt,F=v.chordRibbonAt,J=v.flowNodeAt,Z=v.ribbonAt,E=" → ",ne=" – ",M=" › ";function X(r,D,_){const e=W(r,_);if(!D||typeof r!="number"||!Number.isFinite(r))return e;const i=r/D;return Number.isFinite(i)?`${e} (${_.number(i,{style:"percent",maximumFractionDigits:1})})`:e}function oe(r,D){const _=r.item.node,e=D.bound.root&&D.bound.root.total||0,i=Array.isArray(r.path)?[...r.path]:[_.label];return{heading:i.length>1?i.join(M):_.label,rows:[{label:D.bound.measure.title,value:X(_.total,e,D.grid.messages),colour:D.scheme.series(r.item.index||0)}],datum:{label:_.label,value:_.total,category:_.value,column:D.bound.measure.col&&D.spec.x||null,series:null,depth:r.depth,path:i,rowKeys:_.rowKey?[_.rowKey]:[]}}}function ee(r,D,_){const e=D.reduce((i,y)=>i+(y.value||0),0);return{heading:r.label||r.code,rows:[{label:_.bound.measure.title,value:X(r.value,e,_.grid.messages),colour:_.scheme.series(0)}],datum:{label:r.label||r.code,value:r.value,category:r.code,column:_.spec.code||_.spec.x||null,series:null,path:[r.label||r.code],rowKeys:[]}}}function C(r,D,_){const e=_.spec.value||_.spec.y||null,i=e?_.grid.columns.get(e):null,y=m=>`${Number(m).toFixed(4)}°`,t=(D.legend||[]).find(m=>m.colour===r.fill)||null,g=[{label:i&&i.title||e||"",value:r.text||"",colour:r.fill},{label:"",value:`${y(r.lat)}, ${y(r.lon)}`,colour:"transparent"}];return t&&t.label&&g.push({label:"",value:t.label,colour:r.fill}),{heading:r.label||r.text||"",rows:g,datum:{label:r.label||r.text||"",value:r.value,category:r.value,column:e,series:null,path:[r.label||r.text||""],lon:r.lon,lat:r.lat,status:t?t.label:null,rowKeys:r.rowKey?[r.rowKey]:[]}}}function z(r,D){const _=y=>{const t=D.grid.columns.get(y);return t&&t.title||y},e=_(r.a),i=_(r.b);return{heading:`${e} × ${i}`,rows:[{label:D.spec.method==="spearman"?"ρ":"r",value:typeof r.r=="number"&&Number.isFinite(r.r)?r.r.toFixed(2):"",colour:D.scheme.series(0)}],datum:{label:`${e} × ${i}`,value:typeof r.r=="number"?r.r:null,category:null,column:null,series:null,path:[e,i],rowKeys:[]}}}function ie(r,D){const _=[];for(const i of D.drawn&&D.drawn.links||[])if(!(i.source!==r&&i.target!==r))for(const y of i.rowKeys||[])_.includes(y)||_.push(y);const e=Math.max(r.in||0,r.out||0);return{heading:r.label,rows:[{label:D.bound.measure.title,value:W(e,D.grid.messages),colour:D.scheme.series(r.index||0)}],datum:{label:r.label,value:e,category:r.value===void 0?r.key:r.value,column:null,series:null,path:[r.label],rowKeys:_}}}function I(r,D){const _=`${r.source.label}${r.undirected?ne:E}${r.target.label}`;return{heading:_,rows:[{label:D.bound.measure.title,value:X(r.value,r.undirected?0:D.bound.total||0,D.grid.messages),colour:r.colour||D.scheme.series(r.source.index||0)}],datum:{label:_,value:r.value,category:null,column:null,series:null,path:[r.source.label,r.target.label],rowKeys:Array.isArray(r.rowKeys)?[...r.rowKeys]:[]}}}function $(r){return r?!!(Array.isArray(r.tiles)||Array.isArray(r.regions)||Array.isArray(r.markers)||Array.isArray(r.cells)&&Array.isArray(r.columns)||Array.isArray(r.ribbons)&&r.ring||Array.isArray(r.nodes)&&Array.isArray(r.links)):!1}function me(r){const D=r.drawn;if(!D||!r.bound||!$(D))return null;const{x:_,y:e}=r.at;if(Array.isArray(D.tiles)){const i=pe({tiles:D.tiles,x:_,y:e});return i?oe(i,r):null}if(Array.isArray(D.regions)){const i=Q({regions:D.regions,x:_,y:e});return i?ee(i,D.regions,r):null}if(Array.isArray(D.markers)){const i=V({markers:D.markers,x:_,y:e});return i?C(i,D,r):null}if(Array.isArray(D.cells)&&Array.isArray(D.columns)){const i=te({cells:D.cells,x:_,y:e});return i?z(i,r):null}if(Array.isArray(D.ribbons)&&D.ring){const i=F({ribbons:D.ribbons,ring:D.ring,x:_,y:e});if(i)return I(i.link,r);const y=k({arcs:D.arcs,ring:D.ring,x:_,y:e});return y?ie(y.node,r):null}if(Array.isArray(D.nodes)&&Array.isArray(D.links)){const i=D.nodes.some(g=>typeof g.r=="number"),y=i?Y({nodes:D.nodes,x:_,y:e}):J({nodes:D.nodes,x:_,y:e});if(y)return ie(y,r);const t=i?c({links:D.links,x:_,y:e}):Z({links:D.links,x:_,y:e});return t?I(t,r):null}return null}}),Je("packages/modules/charts/polar.js",function(s,K){"use strict";Object.defineProperty(s,"arcBand",{enumerable:!0,get:function(){return z}}),Object.defineProperty(s,"drawRadar",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"drawGauge",{enumerable:!0,get:function(){return I}});const W=K("packages/modules/charts/frame.js").Pool,pe=K("packages/modules/charts/format.js").measureText,ue=K("packages/modules/charts/scale.js"),V=ue.isNumber,Q=ue.measureDomain,G=K("packages/modules/charts/svg.js"),te=G.attrs,j=G.path,c=G.round,Y=G.setText,k=K("packages/modules/charts/styles.js").NS,J=K("packages/modules/charts/scheme.js").resolveScheme,Z=K("packages/modules/charts/labels.js"),E=Z.drawAnchoredLabels,ne=Z.labelText,M=Math.PI*2,X=4,oe=M*2/3,ee=Math.PI/2+(M-oe)/2;function C($,me,r,D){const _=D-Math.PI/2;return[$+r*Math.cos(_),me+r*Math.sin(_)]}function z($){const me=$.to-$.from;if(me<=0)return"";const r=Math.max(0,$.r-$.width),D=me>Math.PI?1:0,[_,e]=C($.cx,$.cy,$.r,$.from),[i,y]=C($.cx,$.cy,$.r,$.to),[t,g]=C($.cx,$.cy,r,$.to),[m,b]=C($.cx,$.cy,r,$.from);return j(["M",c(_),c(e),"A",c($.r),c($.r),0,D,1,c(i),c(y),"L",c(t),c(g),"A",c(r),c(r),0,D,0,c(m),c(b),"Z"])}function ie($){const me=$.scheme||J(),{plot:r,bound:D}=$;new W($.groups.grid).finish(),new W($.groups.axis).finish(),new W($.groups.rules).finish(),new W($.groups.labels).finish();const _=r.left+r.width/2,e=r.top+r.height/2,i=Math.max(0,Math.min(r.width,r.height)/2-$.fontSize*2),y=D.labels,t=D.series.filter(n=>!$.hidden.has(n.key)),g=[];for(const n of t)for(const d of n.points)g.push(d.y);const m=Q(g,{zero:!0}),b=y.length?M/y.length:M,P=n=>{const d=m.max-m.min||1;return Math.max(0,(n-m.min)/d*i)},l=new W($.groups.grid);for(let n=1;n<=X;n++){const d=i*n/X,A=y.map((p,w)=>C(_,e,d,w*b));te(l.next("path",`${k}__web`),{d:A.length?j([...A.flatMap(([p,w],N)=>[N?"L":"M",c(p),c(w)]),"Z"]):"",fill:"none"})}for(let n=0;n<y.length;n++){const[d,A]=C(_,e,i,n*b);te(l.next("path",`${k}__web`),{d:j(["M",c(_),c(e),"L",c(d),c(A)]),fill:"none"})}l.finish();const u=new W($.groups.marks);for(const n of t){const d=[];for(let w=0;w<y.length;w++){const N=n.points[w],f=V(N&&N.y)?N.y:m.min,[a,o]=C(_,e,P(f),w*b);d.push([c(a),c(o)]),N&&(N.px=c(a),N.py=c(o))}const A=d.length?j([...d.flatMap(([w,N],f)=>[f?"L":"M",w,N]),"Z"]):"",p=me.series(n.index);te(u.next("path",`${k}__radar-fill ${k}__mark`),{d:A,fill:p,"data-series":n.index}),te(u.next("path",`${k}__radar-line ${k}__mark`),{d:A,stroke:p,fill:"none","data-series":n.index})}u.finish();const x=new W($.groups.overlay);for(let n=0;n<y.length;n++){const[d,A]=C(_,e,i+$.fontSize,n*b),p=x.next("text",`${k}__tick`),w=Math.abs(d-_)<1?"middle":d>_?"start":"end";te(p,{x:c(d),y:c(A),"text-anchor":w,"dominant-baseline":"middle"}),Y(p,y[n])}if(x.finish(),$.labels&&$.labels.show){const n=$.typography&&$.typography.small||$.fontSize||11,d=[];for(const A of t)for(const p of A.points){if(!p||p.px===void 0||!V(p.y))continue;const w=p.px-_,N=p.py-e,f=Math.hypot(w,N)||1;d.push({x:c(p.px+w/f*(n*.8)),y:c(p.py+N/f*(n*.8)),text:ne(p.y,$.labels,$.grid)})}E({group:$.groups.labels,size:n,minGap:$.labels.minGap,anchors:d,plot:r})}return{centre:{x:_,y:e,r:i},series:t,axes:y}}function I($){const me=$.scheme||J(),{plot:r,bound:D}=$;new W($.groups.grid).finish(),new W($.groups.axis).finish(),new W($.groups.rules).finish(),new W($.groups.labels).finish();const _=D.series[0],i=(_?_.points.filter(p=>V(p.y)):[]).reduce((p,w)=>p+w.y,0),y=V($.min)?$.min:0,t=V($.max)?$.max:Math.max(i,1),g=t-y||1,m=Math.min(1,Math.max(0,(i-y)/g)),b=r.left+r.width/2,P=r.top+r.height/2,l=Math.max(0,Math.min(r.width,r.height)/2-4),u=Math.max(6,l*.24),x=new W($.groups.marks);if(te(x.next("path",`${k}__gauge-track`),{d:z({cx:b,cy:P,r:l,width:u,from:ee,to:ee+oe})}),te(x.next("path",`${k}__gauge-value ${k}__mark`),{d:z({cx:b,cy:P,r:l,width:u,from:ee,to:ee+oe*m}),fill:me.series(0)}),V($.target)){const p=Math.min(1,Math.max(0,($.target-y)/g)),w=ee+oe*p,[N,f]=C(b,P,l-u,w),[a,o]=C(b,P,l,w);te(x.next("path",`${k}__gauge-target`),{d:j(["M",c(N),c(f),"L",c(a),c(o)]),fill:"none"})}x.finish();const n=new W($.groups.overlay),d=n.next("text",`${k}__gauge-reading`);te(d,{x:c(b),y:c(P),"text-anchor":"middle","dominant-baseline":"middle"}),Y(d,pe(i,$.grid.messages));const A=n.next("text",`${k}__gauge-caption`);return te(A,{x:c(b),y:c(P+$.fontSize*1.6),"text-anchor":"middle","dominant-baseline":"middle"}),Y(A,D.measure.title||""),n.finish(),{value:i,domain:{min:y,max:t}}}}),Je("packages/modules/charts/multiples.js",function(s,K){"use strict";Object.defineProperty(s,"MAX_PANELS",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(s,"panelGrid",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"panelRects",{enumerable:!0,get:function(){return S}}),Object.defineProperty(s,"splitPanels",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(s,"sharedDomain",{enumerable:!0,get:function(){return ue}});const Ae=24;function W(V,Q){if(V<=1)return{columns:1,rows:1};const G=(Q.width||1)/(Q.height||1);let te=Math.max(1,Math.round(Math.sqrt(V*G)));te=Math.min(te,V);const j=Math.ceil(V/te);return{columns:te,rows:j}}function S(V){const Q=Math.min(V.count,Ae),G=V.gap===void 0?10:V.gap,te=V.titleHeight===void 0?14:V.titleHeight,{columns:j,rows:c}=W(Q,V.plot),Y=(V.plot.width-G*(j-1))/j,v=(V.plot.height-G*(c-1))/c,k=[];for(let F=0;F<Q;F++){const J=F%j,Z=Math.floor(F/j);k.push({index:F,x:V.plot.left+J*(Y+G),y:V.plot.top+Z*(v+G)+te,width:Math.max(0,Y),height:Math.max(0,v-te)})}return k}function pe(V){return V.series.map((Q,G)=>({label:Q.label,key:Q.key,index:G,bound:{...V,series:[{...Q,index:G}]}}))}function ue(V,Q,G){const te=[];for(const j of V.series)for(const c of j.points)te.push(c.y);return G(te,{zero:Q})}}),Je("packages/modules/charts/stream.js",function(s,K){"use strict";Object.defineProperty(s,"wiggleBaseline",{enumerable:!0,get:function(){return me}}),Object.defineProperty(s,"drawStream",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"drawMarimekko",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"drawViolin",{enumerable:!0,get:function(){return _}});const Ae=K("packages/modules/charts/axis.js"),W=Ae.drawAxisLines,S=Ae.drawCategoryAxis,pe=Ae.drawMeasureAxis,ue=K("packages/modules/charts/distribution.js"),V=ue.density,Q=ue.distributionDomain,G=ue.summarise,te=ue.valuesByCategory,j=K("packages/modules/charts/frame.js"),c=j.Pool,Y=j.shouldRotate,k=K("packages/modules/charts/format.js").formatters,F=K("packages/modules/charts/scale.js"),J=F.bandScale,Z=F.isNumber,E=F.linearScale,ne=F.measureDomain,X=K("packages/modules/charts/scheme.js").resolveScheme,oe=K("packages/modules/charts/svg.js"),ee=oe.attrs,C=oe.path,z=oe.round,I=K("packages/modules/charts/styles.js").NS,$=32;function me(e){const i=[];let y=0;for(let t=0;t<e.length;t++){const g=e[t],m=g.reduce((u,x)=>u+x,0);if(t===0){y=-m/2,i.push(y);continue}const b=e[t-1];let P=0;const l=g.length;for(let u=0;u<l;u++){let x=0;for(let n=0;n<u;n++)x+=(g[n]||0)-(b[n]||0);P+=(l-u-.5)*((g[u]||0)-(b[u]||0))+x*0}y-=l>0?P/l:0,i.push(y)}return i}function r(e){const i=e.scheme||X(),{plot:y,bound:t}=e;new c(e.groups.grid).finish(),new c(e.groups.rules).finish(),new c(e.groups.labels).finish();const g=t.series.filter(d=>!e.hidden.has(d.key)),m=t.categories.map((d,A)=>g.map(p=>{const w=p.points[A];return Z(w&&w.y)?Math.max(0,w.y):0})),b=me(m),P=[];m.forEach((d,A)=>{P.push(b[A]),P.push(b[A]+d.reduce((p,w)=>p+w,0))});const l=ne(P,{zero:!1,nice:!1}),u=E(l,[y.bottom,y.top]),x=J(t.categories,[y.left,y.right],0),n=new c(e.groups.marks);return g.forEach((d,A)=>{const p=[],w=[];m.forEach((f,a)=>{let o=b[a];for(let B=0;B<A;B++)o+=f[B];const h=z(x.centre(t.categories[a]));w.push([h,z(u.of(o))]),p.push([h,z(u.of(o+f[A]))])});const N=[];p.forEach(([f,a],o)=>N.push(o?"L":"M",f,a));for(let f=w.length-1;f>=0;f--)N.push("L",w[f][0],w[f][1]);N.push("Z"),ee(n.next("path",`${I}__stream ${I}__mark`),{d:C(N),fill:i.series(d.index),"data-series":d.index})}),n.finish(),S({group:e.groups.overlay,plot:y,scale:x,labels:t.labels,fontSize:e.typography&&e.typography.small||e.fontSize,rotated:Y(t.labels,x.step,e.fontSize,(e.axis&&e.axis.x||{}).every),config:e.axis&&e.axis.x||{}}),{xScale:x,yScale:u,series:g}}function D(e){const i=e.scheme||X(),{plot:y,bound:t}=e,g=t.series.filter(w=>!e.hidden.has(w.key)),m=t.categories.map((w,N)=>g.reduce((f,a)=>{const o=a.points[N];return f+(Z(o&&o.y)?Math.abs(o.y):0)},0)),b=m.reduce((w,N)=>w+N,0);if(b<=0)return{series:g,columns:[]};const P=2,l=y.width-P*Math.max(0,t.categories.length-1),u=E({min:0,max:100},[y.bottom,y.top]);pe({gridGroup:e.groups.grid,axisGroup:e.groups.axis,plot:y,scale:u,format:k(e.grid,{kind:"linear",step:20}),config:e.axis&&e.axis.y||{},grid:e.grid,size:e.typography&&e.typography.small||e.fontSize}),W({group:e.groups.rules,plot:y});const x=new c(e.groups.marks),n=[];let d=y.left;t.categories.forEach((w,N)=>{const f=m[N]/b*l;let a=y.bottom;g.forEach((o,h)=>{const B=o.points[N],R=Z(B&&B.y)?Math.abs(B.y):0,q=(m[N]>0?R/m[N]:0)*y.height;ee(x.next("rect",`${I}__bar ${I}__mark`),{x:z(d),y:z(a-q),width:z(Math.max(0,f)),height:z(Math.max(0,q)),fill:i.series(o.index),"data-series":o.index,"data-point":N}),B&&(B.px=z(d+f/2),B.py=z(a-q)),a-=q}),n.push({category:w,label:t.labels[N],x:d,width:f,total:m[N]}),d+=f+P}),x.finish();const A=new c(e.groups.overlay),p=e.typography&&e.typography.small||e.fontSize;for(const w of n){if(w.width<p*2)continue;const N=A.next("text",`${I}__tick`);N.style.fontSize=`${p}px`,ee(N,{x:z(w.x+w.width/2),y:z(y.top-2),"text-anchor":"middle"}),N.textContent=w.label}return A.finish(),{series:g,columns:n}}function _(e){const i=e.scheme||X(),{plot:y,bound:t}=e,g=te(t),m=[...g.keys()],b=[];for(const n of g.values())for(let d=0;d<n.length;d++)b.push(n[d]);const P=Q(b,e.axis),l=E(P,[y.bottom,y.top]),u=J(m,[y.left,y.right],.3);pe({gridGroup:e.groups.grid,axisGroup:e.groups.axis,plot:y,scale:l,format:k(e.grid,{kind:"linear",step:(P.max-P.min)/5}),config:e.axis&&e.axis.y||{},grid:e.grid,size:e.typography&&e.typography.small||e.fontSize}),S({group:e.groups.overlay,plot:y,scale:u,labels:m,fontSize:e.typography&&e.typography.small||e.fontSize,rotated:m.length>6,config:e.axis&&e.axis.x||{}}),W({group:e.groups.rules,plot:y});const x=new c(e.groups.marks);return m.forEach((n,d)=>{const A=g.get(n),p=V(A,P,$),w=p.reduce((R,U)=>Math.max(R,U.density),0)||1,N=u.bandwidth/2,f=u.of(n)+N,a=p.map(R=>[z(f+R.density/w*N),z(l.of(R.at))]),o=p.map(R=>[z(f-R.density/w*N),z(l.of(R.at))]),h=[];a.forEach(([R,U],q)=>h.push(q?"L":"M",R,U));for(let R=o.length-1;R>=0;R--)h.push("L",o[R][0],o[R][1]);h.push("Z"),ee(x.next("path",`${I}__violin ${I}__mark`),{d:C(h),fill:i.series(d),"data-point":d});const B=G(A);B&&ee(x.next("path",`${I}__median ${I}__mark`),{d:C(["M",z(f-N*.5),z(l.of(B.median)),"L",z(f+N*.5),z(l.of(B.median))]),stroke:i.series(d),"stroke-width":2,fill:"none"})}),x.finish(),{xScale:u,yScale:l,series:[{key:"",label:t.measure.title,index:0,points:m.map(n=>{const d=G(g.get(n));return{x:n,xKey:n,label:n,y:d?d.median:null,rows:(g.get(n)||[]).length}})}]}}}),Je("packages/modules/charts/gantt.js",function(s,K){"use strict";Object.defineProperty(s,"readTasks",{enumerable:!0,get:function(){return z}}),Object.defineProperty(s,"drawGantt",{enumerable:!0,get:function(){return ie}});const Ae=K("packages/modules/charts/axis.js"),W=Ae.drawAxisLines,S=Ae.drawBandLabels,pe=Ae.drawContinuousAxis,V=K("packages/modules/charts/frame.js").Pool,G=K("packages/modules/charts/format.js").formatters,te=K("packages/modules/charts/scale.js"),j=te.bandScale,c=te.timeScale,Y=te.toTime,k=K("packages/modules/charts/scheme.js").resolveScheme,F=K("packages/modules/charts/svg.js"),J=F.attrs,Z=F.round,E=F.setText,M=K("packages/modules/charts/styles.js").NS,X=K("packages/modules/charts/typography.js"),oe=X.applySize,ee=X.truncateTo,C=8;function z(I,$,me){const r=[];let D=1/0,_=-1/0;for(const e of me){const i=Y(I.rows.value(e.key,$.start)),y=Y(I.rows.value(e.key,$.end));if(i===null||y===null)continue;const t=$.label?I.rows.text(e.key,$.label):e.key,g=$.series?I.rows.value(e.key,$.series):null;r.push({key:e.key,label:t,group:g,from:Math.min(i,y),to:Math.max(i,y)}),D=Math.min(D,i,y),_=Math.max(_,i,y)}return{tasks:r,span:r.length?{min:D,max:_}:null}}function ie(I){const $=I.scheme||k(),{plot:me}=I,{tasks:r,span:D}=z(I.grid,I.spec,I.rows);if(!D)return{tasks:[],xScale:null,dropped:0};const _=Math.max(1,Math.floor(me.height/C)),e=r.slice(0,_),i=r.length-e.length,y=c({min:D.min,max:D.max},[me.left,me.right]),t=j(e.map(l=>l.key),[me.top,me.bottom],.25),g=I.typography&&I.typography.small||I.fontSize;pe({group:I.groups.overlay,plot:me,scale:y,format:G(I.grid,{kind:"time",span:D.max-D.min}),config:I.axis&&I.axis.x||{},grid:I.grid,size:g}),S({group:I.groups.axis,plot:me,scale:t,labels:e.map(l=>l.label),fontSize:g}),W({group:I.groups.rules,plot:me});const m=[...new Set(e.map(l=>String(l.group)))],b=new V(I.groups.marks);e.forEach((l,u)=>{const x=t.of(l.key),n=y.of(l.from),d=y.of(l.to);J(b.next("rect",`${M}__task ${M}__mark`),{x:Z(n),width:Z(Math.max(2,d-n)),y:Z(x),height:Z(t.bandwidth),fill:$.series(l.group===null?0:m.indexOf(String(l.group))),"data-point":u,"data-key":l.key}),l.px=Z((n+d)/2),l.py=Z(x+t.bandwidth/2)}),b.finish();const P=new V(I.groups.labels);if(i>0){const l=P.next("text",`${M}__geo-note`);oe(l,g),J(l,{x:Z(me.left),y:Z(me.bottom+g+4),"text-anchor":"start"}),E(l,ee(I.grid.messages.t("chart.tasksDropped",{count:i}),me.width,g))}return P.finish(),{tasks:e,xScale:y,dropped:i,series:[{key:"",label:I.spec.label||"",index:0,points:e.map(l=>({x:l.key,xKey:l.key,label:l.label,y:l.to-l.from,rows:1,rowKey:l.key,px:l.px,py:l.py}))}]}}}),Je("packages/modules/charts/interaction.js",function(s,K){"use strict";Object.defineProperty(s,"resolveBrush",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(s,"brushed",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"brushCondition",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"attachBrush",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"applySelection",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"attachKeyboard",{enumerable:!0,get:function(){return te}});const W=K("packages/modules/charts/svg.js").attrs,S=4;function pe(j){const c=j&&j.brush;if(c===!0)return{mode:"filter",axis:"x"};if(c==="filter"||c==="zoom"||c==="select")return{mode:c,axis:"x"};if(c&&typeof c=="object"&&c.mode){const Y=["filter","zoom","select"].includes(c.mode)?c.mode:null,v=c.axis==="y"||c.axis==="y2"?c.axis:"x";return{mode:Y,axis:v}}return{mode:null,axis:"x"}}function ue(j){const{bound:c,xScale:Y}=j,v=Math.min(j.from,j.to),k=Math.max(j.from,j.to);if(j.axis==="y"||j.axis==="y2"){const Z=j.axis==="y2"&&j.rightScale?j.rightScale:j.yScale||Y;if(!Z||typeof Z.invert!="function")return{kind:"range",values:[],range:null,axis:j.axis};const E=Z.invert(v),ne=Z.invert(k);return{kind:"range",values:[],range:[E,ne],axis:j.axis}}if(Y.kind==="band"){const Z=[];for(const E of c.categories){const ne=Y.centre(E);!Number.isNaN(ne)&&ne>=v&&ne<=k&&Z.push(E)}return{kind:"set",values:Z,range:null,axis:"x"}}const F=Y.invert(v),J=Y.invert(k);return{kind:"range",values:[],range:[F,J],axis:"x"}}function V(j){const{column:c,result:Y}=j;if(!c)return null;if(Y.kind==="set")return Y.values.length?{col:c,op:"in",value:Y.values.slice()}:null;if(!Y.range)return null;const[v,k]=Y.range;if(!Number.isFinite(v)||!Number.isFinite(k))return null;const F=j.kind==="time"?[new Date(Math.min(v,k)),new Date(Math.max(v,k))]:[Math.min(v,k),Math.max(v,k)];return{col:c,op:"between",value:F,bounds:"[]"}}function Q(j){let c=null,Y=null;const v=()=>{const Z=typeof j.axis=="function"?j.axis():"x",E=Z==="y"||Z==="y2";return(typeof j.horizontal=="function"?j.horizontal():!1)!==E},k=Z=>{if(!j.enabled())return;const E=j.pointOf(Z);c=v()?E.y:E.x,Y=j.svg.ownerDocument.createElementNS("http://www.w3.org/2000/svg","rect"),Y.setAttribute("class","lat-chartview__brush"),j.overlay.appendChild(Y)},F=Z=>{if(c===null||!Y)return;const E=j.plot();if(v()){const oe=j.pointOf(Z).y,ee=Math.max(E.top,Math.min(c,oe)),C=Math.min(E.bottom,Math.max(c,oe));W(Y,{x:E.left,y:ee,width:Math.max(0,E.right-E.left),height:Math.max(0,C-ee)});return}const ne=j.pointOf(Z).x,M=Math.max(E.left,Math.min(c,ne)),X=Math.min(E.right,Math.max(c,ne));W(Y,{x:M,y:E.top,width:Math.max(0,X-M),height:E.height})},J=Z=>{if(c===null)return;const E=j.pointOf(Z),ne=v()?E.y:E.x,M=Math.abs(ne-c),X=c;c=null,Y&&Y.parentNode&&Y.parentNode.removeChild(Y),Y=null,M>=S&&j.onBrush(X,ne)};return j.svg.addEventListener("pointerdown",k),j.svg.addEventListener("pointermove",F),j.svg.addEventListener("pointerup",J),j.svg.addEventListener("pointerleave",J),()=>{j.svg.removeEventListener("pointerdown",k),j.svg.removeEventListener("pointermove",F),j.svg.removeEventListener("pointerup",J),j.svg.removeEventListener("pointerleave",J)}}function G(j){const c=j.groups.marks,Y=j.keys.size>0||j.categories.size>0;let v=0;for(const k of c.childNodes||[]){if(!k.getAttribute)continue;const F=Number(k.getAttribute("data-series")),J=Number(k.getAttribute("data-point")),Z=j.series[F],E=Z&&Z.points[J],ne=!!E&&(E.rowKey&&j.keys.has(E.rowKey)||E.xKey!==void 0&&j.categories.has(E.xKey));ne&&v++,Y&&!ne?k.setAttribute("data-dim","true"):k.removeAttribute("data-dim")}return v}function te(j){let c=0;const Y=k=>{const F=j.marks();if(F.length){c=Math.max(0,Math.min(F.length-1,k));for(let J=0;J<F.length;J++)F[J].setAttribute("tabindex",J===c?"0":"-1");F[c].focus&&F[c].focus(),j.onFocus(c)}},v=k=>{const F=j.marks();if(F.length){switch(k.key){case"ArrowRight":case"ArrowDown":Y(c+1);break;case"ArrowLeft":case"ArrowUp":Y(c-1);break;case"Home":Y(0);break;case"End":Y(F.length-1);break;case"Enter":case" ":j.onActivate(c);break;default:return}k.preventDefault&&k.preventDefault()}};return j.svg.addEventListener("keydown",v),()=>j.svg.removeEventListener("keydown",v)}}),Je("packages/modules/charts/range.js",function(s,K){"use strict";Object.defineProperty(s,"deriveRangeSpec",{enumerable:!0,get:function(){return ue}});const Ae=new Set(["number","currency","percent","integer"]);function W(V){return!!V&&typeof V.type=="string"&&Ae.has(V.type)}function S(V){const Q=V&&V.selection&&typeof V.selection.ranges=="function"?V.selection.ranges():[];return!Array.isArray(Q)||!Q.length?null:Q[Q.length-1]}function pe(V,Q){const G=[],te=Math.min(Q.startRow,Q.endRow),j=Math.max(Q.startRow,Q.endRow);for(let c=te;c<=j;c++){const Y=V.rows.get(c);Y&&!Y.group&&Y.data!==null&&Y.data!==void 0&&G.push(Y)}return G}function ue(V,Q={}){const G=ee=>({spec:null,type:null,x:null,measures:[],columns:[],reason:ee}),te=Q.range||S(V);if(!te)return G("no-range");const j=V.columns.visible(),c=new Set(j.map(ee=>ee.id)),Y=(te.columns||[]).filter(ee=>c.has(ee));if(!Y.length)return G("no-visible-columns");const v=Y.map(ee=>({id:ee,column:V.columns.get(ee)})),k=v.filter(ee=>W(ee.column)).map(ee=>ee.id),F=v.filter(ee=>!W(ee.column)).map(ee=>ee.id);if(!k.length)return G("no-measure");const J=F.length?F[0]:null,Z=k,ne={rows:pe(V,te)},M=new Set(["bar","line","area"]);if(Z.length>1){const ee=Q.type,C=M.has(ee)?ee:null,z=ee&&!M.has(ee)?ee:"combo";return{spec:{...ne,type:z,x:J,measures:Z.map(I=>C?{col:I,type:C}:{col:I})},type:z,x:J,measures:Z,columns:Y,reason:null}}const X=Q.type||"bar";return{spec:{...ne,type:X,x:J,y:Z[0]},type:X,x:J,measures:Z,columns:Y,reason:null}}}),Je("packages/modules/charts/regression.js",function(s,K){"use strict";Object.defineProperty(s,"regressionPlots",{enumerable:!0,get:function(){return ue}});const Ae=new Set(["number","currency","percent","integer"]);function W(V,Q={}){return{spec:V,reason:null,...Q}}function S(V,Q={}){return{spec:null,reason:V,...Q}}function pe(V){if(!V||!Array.isArray(V.fitted)||!Array.isArray(V.residuals)||!Array.isArray(V.leverage)||!(V.sigma2>0))return null;const Q=Math.sqrt(V.sigma2),G=[];for(let te=0;te<V.fitted.length;te++){const j=V.leverage[te];if(!Number.isFinite(j)||j>=1)continue;const c=Q*Math.sqrt(1-j);if(!(c>0))continue;const Y=V.residuals[te]/c;G.push({x:V.fitted[te],y:Math.sqrt(Math.abs(Y)),key:String(te)})}return G}function ue(V,Q={}){const G=Q.model||(V&&V.statistics&&typeof V.statistics.regressionModel=="function"?V.statistics.regressionModel(Q.spec||{}):null),te=me=>({fit:S(me),residualsFitted:S(me),qq:S(me),multicollinearity:S(me),scaleLocation:S(me),residualsLeverage:S(me),coefficientForest:S(me)});if(!G||!Array.isArray(G.predictors)||!G.predictors.length||!G.response)return{model:null,plots:te("no-model")};const j=G.predictors,c=G.response,Y=Q.rows,v=()=>Y===void 0?{}:{rows:Y},k=Q.fitted||null,F=Q.residual||null,J=Q.stdResidual||null,Z=Q.leverage||null,E=Q.cooksD||null,ne=j.length===1?W({type:"scatter",x:j[0],y:c,fit:!0,band:G.band||null,...v()}):S("multiple-predictors"),M=k&&F?W({type:"scatter",x:k,y:F,reference:[{value:0}],...v()}):S("needs-fitted-and-residual-columns"),X=F?W({type:"qq",y:F,...v()}):S("needs-residual-column"),oe=j.filter(me=>{const r=V&&V.columns&&typeof V.columns.get=="function"?V.columns.get(me):null;return!r||typeof r.type=="string"&&Ae.has(r.type)}),ee=j.length>=2?W({type:"correlogram",columns:oe},{vif:G.vif||null}):S("single-predictor",{vif:G.vif||null}),C=Z&&J?W({type:E?"bubble":"scatter",x:Z,y:J,...E?{size:E}:{},reference:[{value:0}],...v()}):S("needs-leverage-and-standardised-residual-columns"),z=pe(G),ie=z&&z.length?W({type:"scatter",points:z,fit:!0,dimensionTitle:"Fitted",measureTitle:"√|standardised residual|"}):S("needs-fitted-model"),I=Array.isArray(G.coefficients)?G.coefficients.filter(me=>me&&Number.isFinite(me.estimate)&&Number.isFinite(me.lower)&&Number.isFinite(me.upper)).map(me=>({x:me.estimate,label:me.name,lower:me.lower,upper:me.upper})):[],$=I.length?W({type:"forest",points:I,dimensionTitle:"Coefficient",measureTitle:"Estimate"},{coefficients:G.coefficients||null}):S("needs-coefficient-intervals",{coefficients:G.coefficients||null});return{model:G,plots:{fit:ne,residualsFitted:M,qq:X,multicollinearity:ee,scaleLocation:ie,residualsLeverage:C,coefficientForest:$}}}}),Je("packages/modules/charts/registry.js",function(s,K){"use strict";Object.defineProperty(s,"registerChartType",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"chartTypeDef",{enumerable:!0,get:function(){return S}}),Object.defineProperty(s,"registeredChartTypes",{enumerable:!0,get:function(){return pe}});const Ae=new Map;function W(ue,V){if(typeof ue!="string"||!ue)throw new TypeError("[lattice] registerChartType needs a non-empty type name.");if(!V||typeof V.draw!="function")throw new TypeError(`[lattice] registerChartType('${ue}') needs a { draw } function.`);Ae.set(ue,V)}function S(ue){return Ae.get(ue)||null}function pe(){return[...Ae.keys()]}}),Je("packages/modules/charts/index.js",function(s,K){"use strict";Object.defineProperty(s,"TYPES",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(s,"Chart",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(s,"createChart",{enumerable:!0,get:function(){return hn}}),Object.defineProperty(s,"deriveRangeSpec",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(s,"regressionPlots",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(s,"chartRange",{enumerable:!0,get:function(){return qn}}),Object.defineProperty(s,"canChartRange",{enumerable:!0,get:function(){return eo}});const Ae=K("packages/modules/charts/cartesian.js"),W=Ae.aheadOfWindow,S=Ae.axisWindowSpan,pe=Ae.CARTESIAN,ue=Ae.drawCartesian,V=Ae.drawForest,Q=Ae.nearestCategory,G=Ae.nearestDrawnPoint,te=Ae.WINDOW_LEAD,j=Ae.windowedBound,Y=K("packages/modules/charts/drawable.js").drawability,v=K("packages/modules/charts/axis.js"),k=v.createGroups,F=v.drawAxisTitle,J=v.normaliseAxes,Z=v.setPlotClip,E=K("packages/modules/charts/bind.js"),ne=E.bindHierarchy,M=E.bindLinks,X=E.bindMeasures,oe=E.bindPoints,ee=E.bindSeries,C=E.leafRows,z=K("packages/modules/charts/frame.js"),ie=z.Pool,I=z.plotRect,$=K("packages/modules/charts/scale.js"),me=$.key,r=$.measureDomain,D=$.sqrtScale,_=K("packages/modules/charts/format.js"),e=_.measureText,i=K("packages/modules/charts/radial.js"),y=i.arcAt,t=i.drawRadial,g=K("packages/modules/charts/distribution.js"),m=g.drawBoxPlot,b=g.drawCapability,P=g.drawControl,l=g.drawEcdf,u=g.drawHistogram,x=g.drawLorenz,n=g.drawMovingRange,d=g.drawQQ,p=K("packages/modules/charts/treemap.js").drawTreemap,w=K("packages/modules/charts/hit.js"),N=w.ownsGeometry,f=w.resolveHit,o=K("packages/modules/charts/combo.js").drawCombo,h=K("packages/modules/charts/polar.js"),B=h.drawGauge,R=h.drawRadar,U=K("packages/modules/charts/matrix.js"),q=U.drawCandlestick,se=U.drawCorrelogram,T=U.drawFunnel,le=U.drawHeatmap,he=U.title,be=K("packages/modules/charts/multiples.js"),we=be.panelRects,ye=be.splitPanels,Me=K("packages/modules/charts/geo.js"),Te=Me.drawGeomap,xe=Me.packRegions,_e=Me.projectedPath,$e=Me.resolvePack,Pe=K("packages/modules/charts/projection.js"),Ie=Pe.fitted,He=Pe.resolveProjection,We=Pe.splitAntimeridian,ot=K("packages/modules/charts/flow.js"),dt=ot.drawChord,ut=ot.drawSankey,bt=K("packages/modules/charts/network.js"),yt=bt.drawNetwork,vt=bt.emphasiseNetwork,Mt=K("packages/modules/charts/stream.js"),xt=Mt.drawMarimekko,zt=Mt.drawStream,$t=Mt.drawViolin,O=K("packages/modules/charts/gantt.js").drawGantt,fe=K("packages/modules/charts/svg.js"),de=fe.attrs,ge=fe.append,Se=fe.clear,ce=fe.el,ke=fe.round,Oe=fe.setText,Ne=fe.svg,Ce=K("packages/modules/charts/styles.js"),je=Ce.NS,Re=Ce.injectStyles,De=K("packages/modules/charts/scheme.js"),Ge=De.resolveScheme,tt=K("packages/modules/charts/typography.js"),Ve=tt.applySize,Qe=tt.resolveType,st=tt.textWidth,rt=K("packages/modules/charts/labels.js"),Ze=rt.collides,nt=rt.resolveLabels,at=K("packages/modules/charts/interaction.js"),ft=at.applySelection,lt=at.attachBrush,Nt=at.attachKeyboard,Et=at.brushCondition,Gt=at.brushed,Lt=at.resolveBrush,At=K("packages/modules/charts/dense.js"),en=At.downsample,Bt=At.markCount,Ut=At.wantsCanvas,Tt=K("packages/modules/charts/range.js").deriveRangeSpec,Ct=K("packages/modules/charts/regression.js").regressionPlots,_t=K("packages/modules/charts/registry.js"),It=_t.chartTypeDef,nn=_t.registeredChartTypes,qe=_t.registerChartType,it=$.linearScale,mt=$.bandScale,gt=$.extent,kt=$.toNumber,Wt=$.isNumber,gn=$.niceDomain,pn=$.linearTicks,bn=$.timeScale,yn=$.toTime,wn=$.niceStep,kn=U.colourRamp,xn=fe.path,An=fe.attr,Vt=K("packages/core/src/internal/util.js").warnOnce,Sn=v.drawMeasureAxis,vn=v.drawCategoryAxis,Mn=v.drawAxisLines,Nn=v.drawContinuousAxis,jn=v.drawBandLabels,On=v.tickValues,Pn=g.density,$n=g.valuesByCategory,Tn=g.summarise,_n=g.quantile,Cn=g.histogram,En=_.formatters;Object.defineProperty(s,"registerScheme",{enumerable:!0,get:function(){return De.registerScheme}}),Object.defineProperty(s,"resolveScheme",{enumerable:!0,get:function(){return De.resolveScheme}}),Object.defineProperty(s,"schemeNames",{enumerable:!0,get:function(){return De.schemeNames}}),Object.defineProperty(s,"setDefaultScheme",{enumerable:!0,get:function(){return De.setDefaultScheme}}),Object.defineProperty(s,"SCHEMES",{enumerable:!0,get:function(){return De.SCHEMES}}),Object.defineProperty(s,"PALETTE",{enumerable:!0,get:function(){return De.PALETTE}}),Object.defineProperty(s,"registerChartType",{enumerable:!0,get:function(){return _t.registerChartType}}),Object.defineProperty(s,"registeredChartTypes",{enumerable:!0,get:function(){return _t.registeredChartTypes}});const Ln=Object.freeze({el:ce,svg:Ne,attr:An,attrs:de,append:ge,clear:Se,path:xn,round:ke,setText:Oe,Pool:ie,plotRect:I,linearScale:it,bandScale:mt,sqrtScale:D,extent:gt,measureDomain:r,niceDomain:gn,linearTicks:pn,timeScale:bn,toTime:yn,niceStep:wn,toNumber:kt,isNumber:Wt,key:me,drawMeasureAxis:Sn,drawCategoryAxis:vn,drawAxisLines:Mn,drawContinuousAxis:Nn,drawBandLabels:jn,tickValues:On,formatters:En,resolveScheme:Ge,colourRamp:kn,density:Pn,valuesByCategory:$n,summarise:Tn,quantile:_n,histogram:Cn,resolvePack:$e,packRegions:xe,fitted:Ie,resolveProjection:He,splitAntimeridian:We,projectedPath:_e,textWidth:st,applySize:Ve,collides:Ze,NS:je}),Yt=Object.freeze(["line","step","area","rangeArea","bar","horizontalBar","waterfall","scatter","bubble","forest","combo","pareto","histogram","boxplot","heatmap","qq","ecdf","lorenz","correlogram","control","capability","movingRange","pie","donut","sunburst","treemap","radar","gauge","funnel","candlestick","geomap","sankey","chord","network","stream","marimekko","violin","gantt"]),on=new Set(["bar","column","line","area","scatter","bubble","combo","pareto","histogram","heatmap","pie","donut","sunburst","treemap","radar","geomap"]),zn=new Set(["pie","donut","sunburst"]),Rn=new Set(["pie","donut","sunburst","treemap"]),rn=20,Fn=new Set(["histogram","boxplot","qq","ecdf","lorenz","control","capability","movingRange"]),In=new Set(["histogram","boxplot","qq","ecdf","lorenz","violin"]);function Dn(Ye){const L=Ye.y||(Array.isArray(Ye.measures)&&Ye.measures.length?Ye.measures[0]:null);if(!L)return Ye;const H=typeof L=="string"?L:L.col;if(!H)return Ye;const ae=typeof L=="object"&&L.fn!=null?L.fn:"median";return{...Ye,y:{col:H,fn:ae}}}const Gn=new Set(["combo","candlestick"]),sn=new Set(["bar","line","step","area","scatter","bubble"]),Bn=new Set(["sankey","chord","network"]),Un=new Set(["gantt"]),Kn=new Set(["radar","gauge","funnel","heatmap","geomap","sankey","chord","network"]),St=Object.freeze({width:480,height:300}),an=Object.freeze(["00000"]),ln=new Set(["horizontalBar","forest"]);function cn(Ye,L,H,ae){return Ye==="correlogram"?(Array.isArray(ae.columns)?ae.columns:[]).map(re=>he(H,re)):Ye==="heatmap"?(L.series||[]).map(ve=>ve.label):Ye==="gantt"?(L.rows||[]).map(ve=>ae.label?H.rows.text(ve.key,ae.label):String(ve.key)):ln.has(Ye)?L.labels||[]:an}const Hn=1e3,Wn=50;let Vn=0;function Yn(Ye){const L=Ye/1e3;return`${L>=10?Math.round(L):Math.round(L*10)/10}s`}function un(Ye){return`${Ye/1e3}s`}function jt(Ye){return Ye&&Ye.defaultView||globalThis}function Zn(Ye,L){return L?typeof L=="string"?Ye.querySelector(L):L:null}function Jn(Ye,L,H){const ae=["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"],ve=[Ye,...Ye.querySelectorAll("*")],re=[L,...L.querySelectorAll("*")];for(let Le=0;Le<ve.length&&Le<re.length;Le++){const ze=H.getComputedStyle(ve[Le]),Ee=[];for(const Fe of ae){const Ue=ze.getPropertyValue(Fe);Ue&&Ee.push(`${Fe}:${Ue}`)}Ee.length&&re[Le].setAttribute("style",Ee.join(";"))}}function Qn(Ye,L){let H=Ye.root;const ae=[];for(const ve of L){const re=(H.children||[]).find(Le=>Le.label===ve);if(!re||!re.children||!re.children.length)break;H=re,ae.push(ve)}return ae.length?{...Ye,root:H,path:ae,empty:!H.children.length}:Ye}function Xn(Ye,L,H){return Ye&&Ye.plot?Ye.plot:{left:0,top:0,right:L,bottom:H,width:L,height:H,gutter:{left:0,bottom:0,right:0,top:0}}}class fn{#l=++Vn;#n;#c;#e;#i;#f=null;#o=null;#a=null;#p=null;#d=null;#F=!1;#w=null;#k=null;#b=[];#h=new Set;#t=null;#m={zoom:1,offset:[0,0]};#y=null;#x=null;#I=!1;#D=!1;#r=null;#_=0;#M=null;#P=null;#G=!1;#A=!1;#S=new Map;#N=Ge();#C=Qe();#ye=null;#u=null;#g=null;#v=null;#E=0;constructor(L){this.#n=L.grid,this.#c=L.container,this.#e=L.spec,this.#i=L.container.ownerDocument,this.#Q(),this.#X(),this.draw()}#Q(){Re(this.#i);const L=this.#i;this.#f=ce(L,"div",je);const H=ce(L,"figure",`${je}__figure`);if(this.#e.title||this.#e.subtitle){const ae=ce(L,"figcaption",`${je}__caption`);if(this.#e.title){const ve=ce(L,"div",`${je}__title`);Oe(ve,this.#e.title),ae.appendChild(ve)}if(this.#e.subtitle){const ve=ce(L,"div",`${je}__subtitle`);Oe(ve,this.#e.subtitle),ae.appendChild(ve)}H.appendChild(ae)}if(this.#o=Ne(L,"svg",{class:`${je}__plot`,preserveAspectRatio:"xMidYMid meet",role:"img"}),this.#a=k(L,this.#o),H.appendChild(this.#o),this.#k=ce(L,"div",`${je}__empty`),this.#k.setAttribute("hidden",""),H.appendChild(this.#k),this.#w=ce(L,"div",`${je}__table`),H.appendChild(this.#w),this.#p=ce(L,"div",`${je}__legend`),H.appendChild(this.#p),this.#e.footnote){const ae=ce(L,"div",`${je}__footnote`);Oe(ae,this.#e.footnote),H.appendChild(ae)}this.#x=ce(L,"div",`${je}__attribution`),this.#x.setAttribute("hidden",""),H.appendChild(this.#x),this.#d=ce(L,"div",`${je}__tooltip`),this.#d.setAttribute("hidden",""),this.#f.appendChild(H),this.#f.appendChild(this.#d),this.#c.appendChild(this.#f),this.#q()}#X(){const L=["model:changed","rows:changed","filter:changed","sort:changed","column:grouped","column:pivoted","cell:changed","timeline:seek","timeline:attached","timeline:detached"];this.#e.selection&&this.#b.push(this.#n.on("selection:changed",()=>this.#V()));for(const ae of L)this.#b.push(this.#n.on(ae,()=>this.schedule()));const H=jt(this.#i);H&&typeof H.ResizeObserver=="function"&&(this.#P=this.#c.getBoundingClientRect?this.#c.getBoundingClientRect():null,this.#M=new H.ResizeObserver(()=>{if(!this.#G){this.#G=!0;const ae=this.#c.getBoundingClientRect?this.#c.getBoundingClientRect():null;if(ae&&this.#P&&Math.round(ae.width)===Math.round(this.#P.width)&&Math.round(ae.height)===Math.round(this.#P.height))return}this.schedule()}),this.#M.observe(this.#c))}#B(){const L=this.#o&&this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():null;return L&&L.width>0&&L.height>0?L:this.#c.getBoundingClientRect?this.#c.getBoundingClientRect():St}#q(){const L=Ee=>{this.#y||this.#te(Ee)},H=()=>this.#j();this.#o.addEventListener("pointermove",L),this.#o.addEventListener("pointerleave",H),this.#o.addEventListener("click",Ee=>this.#W(Ee));const ae=Ee=>{!this.#t||!this.#t.packed||(this.#y={x:Ee.clientX||0,y:Ee.clientY||0})},ve=Ee=>{if(!this.#y)return;const Fe=Ee.clientX||0,Ue=Ee.clientY||0;this.#O(Fe-this.#y.x,Ue-this.#y.y),this.#y={x:Fe,y:Ue}},re=()=>{this.#y=null},Le=Ee=>{!this.#t||!this.#t.packed||(Ee.preventDefault&&Ee.preventDefault(),this.#z(Ee.deltaY<0?1.15:1/1.15))},ze=Ee=>{if(!this.#t||!this.#t.packed)return;const Fe=40;if(Ee.shiftKey&&Ee.key==="ArrowLeft")this.#O(-Fe,0);else if(Ee.shiftKey&&Ee.key==="ArrowRight")this.#O(Fe,0);else if(Ee.shiftKey&&Ee.key==="ArrowUp")this.#O(0,-Fe);else if(Ee.shiftKey&&Ee.key==="ArrowDown")this.#O(0,Fe);else if(Ee.key==="+"||Ee.key==="=")this.#z(1.25);else if(Ee.key==="-"||Ee.key==="_")this.#z(1/1.25);else if(Ee.key==="0")this.#le();else return;Ee.preventDefault&&Ee.preventDefault()};this.#o.addEventListener("pointerdown",ae),this.#o.addEventListener("pointermove",ve),this.#o.addEventListener("pointerup",re),this.#o.addEventListener("pointerleave",re),this.#o.addEventListener("wheel",Le,{passive:!1}),this.#o.addEventListener("keydown",ze),this.#b.push(lt({svg:this.#o,overlay:this.#a.overlay,plot:()=>this.#t&&this.#t.plot||{left:0,top:0,right:0,bottom:0,height:0},pointOf:Ee=>this.#$(Ee),axis:()=>Lt(this.#e).axis,horizontal:()=>!!(this.#t&&this.#t.horizontal),enabled:()=>!!Lt(this.#e).mode&&!!(this.#t&&this.#t.xScale),onBrush:(Ee,Fe)=>this.#ie(Ee,Fe)})),this.#o.setAttribute("tabindex","0"),this.#b.push(Nt({svg:this.#o,marks:()=>[...this.#a.marks.childNodes||[]].filter(Ee=>Ee.setAttribute),onFocus:Ee=>this.#se(Ee),onActivate:Ee=>this.#ae(Ee)})),this.#b.push(()=>{this.#o.removeEventListener("pointermove",L),this.#o.removeEventListener("pointerleave",H),this.#o.removeEventListener("pointerdown",ae),this.#o.removeEventListener("pointermove",ve),this.#o.removeEventListener("pointerup",re),this.#o.removeEventListener("pointerleave",re),this.#o.removeEventListener("wheel",Le),this.#o.removeEventListener("keydown",ze)})}#$(L){const H=this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():{left:0,top:0,width:St.width,height:St.height};return{x:(L.clientX||0)-H.left,y:(L.clientY||0)-H.top}}#ee(L){return Q({bound:{categories:this.#T().categories},xScale:this.#t.xScale,at:this.#t.horizontal?L.y:L.x})}#T(){const L=this.#t;return L&&Array.isArray(L.labels)&&Array.isArray(L.categories)?{labels:L.labels,categories:L.categories}:{labels:this.#r&&this.#r.labels||[],categories:this.#r&&this.#r.categories||[]}}#U(L){if(!this.#t||!Array.isArray(this.#t.series))return null;if(this.#t.reduced)return G({series:this.#t.series,xScale:this.#t.xScale,at:this.#t.horizontal?L.y:L.x});const H=this.#ee(L);return H<0?null:{index:H,entries:this.#t.series.map(ae=>({series:ae,point:ae.points[H]})).filter(ae=>ae.point&&ae.point.y!==null)}}#L(L){return f({drawn:this.#t,bound:this.#r,spec:this.#e,grid:this.#n,scheme:this.#N,at:L})}#te(L){if(!this.#t||!this.#r||this.#e.tooltip===!1)return;const H=this.#$(L),ae=[];let ve="";const re=this.#L(H);if(re){this.#K(re.heading,re.rows,L),this.emit("hover",{...re.datum,native:L});return}if(N(this.#t)){this.#j();return}if(this.#t.arcs){const ze=y({arcs:this.#t.arcs,x:H.x,y:H.y});if(!ze){this.#j();return}ve=ze.label;const Ee=this.#r.root.total>0?ze.total/this.#r.root.total:0;ae.push({label:this.#r.measure.title,value:`${e(ze.total,this.#n.messages)} (${this.#n.messages.number(Ee,{style:"percent",maximumFractionDigits:1})})`,colour:this.#N.series(ze.index)})}else{const ze=this.#U(H);if(!ze){this.#j();return}ve=this.#T().labels[ze.index]||"";for(const Ee of ze.entries)ae.push({label:Ee.series.label,value:e(Ee.point.y,this.#n.messages),colour:this.#N.series(Ee.series.index)})}if(!ae.length){this.#j();return}this.#K(ve,ae,L);const Le=this.#H(H);Le&&this.emit("hover",{...Le,native:L})}#K(L,H,ae){const ve=this.#i;if(Se(this.#d),L){const re=ce(ve,"div",`${je}__tooltip-row`),Le=ce(ve,"strong");Oe(Le,L),re.appendChild(Le),this.#d.appendChild(re)}for(const re of H){const Le=ce(ve,"div",`${je}__tooltip-row`),ze=ce(ve,"span",`${je}__swatch`);ze.setAttribute("style",`background:${re.colour}`);const Ee=ce(ve,"span");Oe(Ee,re.label);const Fe=ce(ve,"span",`${je}__tooltip-value`);Oe(Fe,re.value),ge(Le,[ze,Ee,Fe]),this.#d.appendChild(Le)}this.#d.removeAttribute("hidden"),this.#ne(ae)}#ne(L){if(!this.#F&&(this.#F=!0,this.#oe())){const ct=this.#i&&this.#i.body;ct&&typeof ct.appendChild=="function"&&ct.appendChild(this.#d)}const H=jt(this.#i),ae=12,ve=L&&L.clientX||0,re=L&&L.clientY||0,Le=typeof this.#d.getBoundingClientRect=="function"?this.#d.getBoundingClientRect():{width:0,height:0},ze=H.innerWidth||0,Ee=H.innerHeight||0;let Fe=ve+ae;ze&&Fe+Le.width>ze-ae&&(Fe=ve-ae-Le.width),Fe=Math.max(ae,Fe);let Ue=re+ae;Ee&&Ue+Le.height>Ee-ae&&(Ue=re-ae-Le.height),Ue=Math.max(ae,Ue),this.#d.style.left=`${Math.round(Fe)}px`,this.#d.style.top=`${Math.round(Ue)}px`}#oe(){const L=jt(this.#i);if(typeof L.getComputedStyle!="function")return!1;let H=this.#f&&this.#f.parentNode;for(;H;){if(H.nodeType===11&&H.host){H=H.host;continue}if(H.nodeType!==1)break;const ae=L.getComputedStyle(H);if(ae&&(ae.transform&&ae.transform!=="none"||ae.perspective&&ae.perspective!=="none"||ae.filter&&ae.filter!=="none"||ae.backdropFilter&&ae.backdropFilter!=="none"||ae.contain&&/layout|paint|strict|content/.test(ae.contain)))return!0;H=H.parentNode}return!1}#j(){this.#d&&this.#d.setAttribute("hidden",""),this.emit("leave",{})}#H(L){if(!this.#t||!this.#r)return null;const H=this.#L(L);if(H)return H.datum;if(N(this.#t))return null;if(this.#t.arcs){const ze=y({arcs:this.#t.arcs,x:L.x,y:L.y});return ze?{label:ze.label,value:ze.total,category:ze.node.value,column:this.#e.x||null,series:null,depth:ze.depth,path:Array.isArray(ze.path)?[...ze.path]:[ze.label],rowKeys:ze.node.rowKey?[ze.node.rowKey]:[]}:null}const ae=this.#U(L);if(!ae)return null;const ve=ae.entries,re=this.#T(),Le=ve.length===1&&ve[0].point.from!==void 0?{from:ve[0].point.from,to:ve[0].point.to}:null;return{label:re.labels[ae.index]||"",category:re.categories[ae.index],column:this.#r.dimension.col,value:ve.length===1?ve[0].point.y:null,...Le||{},series:ve.map(ze=>({key:ze.series.key,label:ze.series.label,value:ze.point.y,rows:ze.point.rows})),rowKeys:ve.map(ze=>ze.point.rowKey).filter(Boolean)}}#W(L){if(!this.#t||!this.#r)return;const H=this.#H(this.#$(L));if(!H)return;let ae=!1;const ve=this.emit("click",{...H,native:L,preventDefault(){ae=!0}});if(!(ae||ve.defaultPrevented)){if(this.#e.drill&&this.#r&&this.#r.root&&H.label){const re=Array.isArray(H.path)&&H.path.length?H.path:[H.label];this.#u=[...this.#u||[],...re],this.emit("drill",{path:[...this.#u],label:H.label}),this.draw();return}if(this.#e.selection&&Array.isArray(this.#t.markers)&&Array.isArray(H.rowKeys)&&H.rowKeys.length){this.#n.selection.set([...H.rowKeys]);return}if(this.#e.selection&&this.#e.type==="network"&&Array.isArray(H.rowKeys)&&H.rowKeys.length){this.#n.selection.set([...new Set(H.rowKeys)]);return}!this.#e.filterOnClick||!H.column||this.#n.filters.set({col:H.column,op:"eq",value:H.category})}}#V(){if(!this.#t)return;if(Array.isArray(this.#t.markers)){this.#re();return}if(Array.isArray(this.#t.links)&&Array.isArray(this.#t.nodes)&&!this.#t.series){vt({drawn:this.#t,keys:new Set(this.#n.selection.keys())});return}if(!this.#t.series)return;const L=this.#n.selection.keys(),H=this.#r&&this.#r.dimension&&this.#r.dimension.col,ae=new Set;if(H)for(const ve of L)ae.add(me(this.#n.rows.value(ve,H)));ft({groups:this.#a,series:this.#t.series,keys:new Set(L),categories:ae})}#re(){const L=new Set(this.#n.selection.keys());for(const H of this.#t.markers){const ae=H.element;!ae||!ae.setAttribute||(L.size&&!L.has(H.rowKey)?ae.setAttribute("data-dim","true"):ae.removeAttribute("data-dim"))}}#ie(L,H){const ae=Lt(this.#e),ve=ae.mode;if(!ve||!this.#t||!this.#t.xScale||!this.#r)return;const re=Gt({bound:this.#r,xScale:this.#t.xScale,yScale:this.#t.yScale,rightScale:this.#t.rightScale||null,axis:ae.axis,from:L,to:H});let Le=!1;const ze=this.emit("brush",{mode:ve,kind:re.kind,values:re.values,range:re.range,axis:re.axis,column:re.axis==="y"||re.axis==="y2"?this.#r.measure&&this.#r.measure.col||null:this.#r.dimension.col,preventDefault(){Le=!0}});if(Le||ze.defaultPrevented)return;if(ve==="zoom"){if(re.range){const Fe=re.axis==="y2"?"y2":re.axis==="y"?"y":"x";this.#e={...this.#e,axis:{...this.#e.axis||{},[Fe]:{...(this.#e.axis||{})[Fe]||{},min:Math.min(re.range[0],re.range[1]),max:Math.max(re.range[0],re.range[1])}}},this.draw()}return}if(ve==="select"){const Fe=[];for(const Ue of this.#t.series||[])for(const ct of Ue.points){if(!ct.rowKey)continue;(re.kind!=="set"||re.values.some(Be=>me(Be)===ct.xKey))&&Fe.push(ct.rowKey)}this.#n.selection.set([...new Set(Fe)]);return}const Ee=Et({column:this.#r.dimension.col,result:re,kind:this.#r.kind});Ee&&this.#n.filters.set(Ee)}#se(L){const H=(this.#a.marks.childNodes||[])[L];if(!H||!H.setAttribute)return;const ae=this.#t&&this.#t.series?this.#t.series[Number(H.getAttribute("data-series"))||0]:null,ve=ae&&ae.points[Number(H.getAttribute("data-point"))||0];if(!ve){if(!H.getBoundingClientRect)return;const re=H.getBoundingClientRect(),Le=this.#L(this.#$({clientX:re.left+re.width/2,clientY:re.top+re.height/2}));if(!Le)return;H.setAttribute("role","img"),H.setAttribute("aria-label",`${Le.heading}: ${Le.rows.map(ze=>ze.value).filter(Boolean).join(", ")}`),this.emit("focus",{label:Le.datum.label,value:Le.datum.value,index:L});return}H.setAttribute("role","img"),H.setAttribute("aria-label",`${ve.label}: ${e(ve.y,this.#n.messages)}`),this.emit("focus",{label:ve.label,value:ve.y,index:L})}#ae(L){const H=(this.#a.marks.childNodes||[])[L];if(!H||!H.getBoundingClientRect)return;const ae=H.getBoundingClientRect();this.#W({clientX:ae.left+ae.width/2,clientY:ae.top+ae.height/2})}#Y(L){const H=L&&L.attribution||"";H?(Oe(this.#x,H),this.#x.removeAttribute("hidden")):this.#x.setAttribute("hidden","");const ae=L&&Number.isFinite(L.aspect)&&L.aspect>0?L.aspect:null;this.#o&&this.#o.style&&(ae?this.#o.style.setProperty("aspect-ratio",String(ae)):this.#o.style.removeProperty("aspect-ratio"))}#le(){this.#m={zoom:1,offset:[0,0]},this.schedule()}#z(L){const H=this.#m.zoom*L;this.#m={...this.#m,zoom:Math.min(8,Math.max(1,H))},this.schedule()}#O(L,H){const ae=this.#t&&this.#t.scale||0;if(!ae)return;const[ve,re]=this.#m.offset;this.#m={...this.#m,offset:[ve-L/ae,re+H/ae]},this.schedule()}schedule(){if(this.#A||this.#_)return;const L=jt(this.#i),H=typeof L.requestAnimationFrame=="function"?L.requestAnimationFrame.bind(L):ae=>setTimeout(ae,16);this.#_=H(()=>{this.#_=0,this.draw()})||1}draw(){if(this.#A)return;const L=this.#Z();if(!L)return;const H=this.#B(),ae=Math.round(H.width||St.width),ve=Math.round(H.height||St.height),re=ae!==L.width||ve!==L.height?this.#Z():L;re&&this.emit("draw",{chartType:re.chartType,categories:re.categories,empty:re.empty})}#Z(){const L=this.#B(),H=Math.round(L.width||St.width),ae=Math.round(L.height||St.height),ve=Yt.includes(this.#e.type)?null:It(this.#e.type),re=Yt.includes(this.#e.type)||ve?this.#e.type:"bar";Array.isArray(this.#e.x)&&Vt(`chart:${this.#l}:x:array`,`chart "x" expects one column id (a string) and was given an array [${this.#e.x.map(et=>JSON.stringify(et)).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.`);const Le=Ge(this.#e);this.#N=Le;const ze=J(this.#e.axis),Ee=this.#n.messages,Fe=Qe(this.#e);this.#C=Fe;const Ue=Fe.small,ct=nt(this.#e);if(ct.show&&!on.has(re)&&!(ve&&ve.labelled)&&!this.#I){this.#I=!0;const et=this.#i&&this.#i.defaultView,Ke=et&&et.console||(typeof globalThis<"u"?globalThis.console:null);Ke&&typeof Ke.warn=="function"&&Ke.warn(`[lattice] a "${re}" chart does not draw data labels; "labels" has no effect on it. Types that do: ${[...on].join(", ")}.`)}de(this.#o,{viewBox:`0 0 ${H} ${ae}`,width:H,height:ae});const wt=Rn.has(re)||!!(ve&&ve.hierarchical);let Be;if(ve&&typeof ve.bind=="function")Be=ve.bind(this.#n,this.#e);else if(wt)Be=ne(this.#n,this.#e),this.#u&&this.#u.length&&(Be=Qn(Be,this.#u));else if(Gn.has(re))Be=X(this.#n,this.#e);else if(sn.has(re)&&Array.isArray(this.#e.measures)&&this.#e.measures.length)Be=X(this.#n,this.#e);else if(Bn.has(re))Be=M(this.#n,this.#e,re==="network"?{perRow:!0,nodes:this.#e.nodes}:void 0);else if(Un.has(re)){const et=C(this.#n);Be={rows:et,series:[],categories:[],labels:[],measure:{col:null,fn:"sum",title:""},dimension:{col:this.#e.label||null,title:""},empty:!et.length}}else re==="geomap"?Be=ee(this.#n,{...this.#e,x:this.#e.code||this.#e.x}):Array.isArray(this.#e.points)?Be=oe(this.#e):In.has(re)?Be=ee(this.#n,Dn(this.#e)):Be=ee(this.#n,this.#e);const Ot=Date.now();this.#r=Be;const Pt=W(Be,ze&&ze.x,re,Ot);if(Pt){const et=typeof this.#e.x=="string"?` "${this.#e.x}"`:"",Ke=`${Math.round(te*1e3)/10}%`;Vt(`chart:${this.#l}:x:window:ahead`,`${Pt.count} reading(s) on the x axis${et} were not drawn: stamped up to ${Yn(Pt.lead)} ahead of this device's clock, which is more than the ${un(Pt.limit)} (${Ke} of the ${un(Pt.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 pt=Y({grid:this.#n,spec:this.#e,type:re,bound:Be,axis:ze,now:Ot,id:this.#l});if(!pt.ok)return pt.tell&&Vt(pt.key,pt.message),this.#de(this.#e.emptyText||Ee.t("chart.empty")),null;if(Be=j(Be,ze&&ze.x,re,Ot),this.#r=Be,this.#k.setAttribute("hidden",""),this.#o.removeAttribute("hidden"),Z(this.#a,null),ve){const et=ve.freeform?I({width:H,height:ae,fontSize:Ue,margin:this.#e.margin}):I({width:H,height:ae,fontSize:Ue,margin:this.#e.margin,titleSize:Fe.axisTitle,titles:{left:ze.y.title,bottom:ze.x.title,right:ze.y2.title},yLabels:an,xLabels:Be.labels,rotated:!0});this.#t=ve.draw({doc:this.#i,groups:this.#a,plot:et,bound:Be,type:re,grid:this.#n,fontSize:Ue,hidden:this.#h,scheme:Le,axis:ze,typography:Fe,labels:ct,spec:this.#e,geoView:{zoom:this.#m.zoom,offset:this.#m.offset},helpers:Ln})||{},this.#s(Array.isArray(this.#t.legend)?this.#t.legend:[])}else if(re==="treemap"){const et=I({width:H,height:ae,fontSize:Ue,padding:2,margin:this.#e.margin});this.#t=p({scheme:Le,groups:this.#a,plot:et,tree:Be,grid:this.#n,hidden:this.#h,fontSize:Ue,typography:Fe,labels:ct}),this.#s(Be.root.children.map((Ke,Xe)=>({key:Ke.label,label:Ke.label,index:Xe})))}else if(zn.has(re)){const et=I({width:H,height:ae,fontSize:Ue});this.#t=t({scheme:Le,doc:this.#i,groups:this.#a,plot:et,tree:Be,type:re,grid:this.#n,hidden:this.#h,fontSize:Ue,typography:Fe,labels:ct}),this.#s(Be.root.children.map((Ke,Xe)=>({key:Ke.label,label:Ke.label,index:Xe})))}else{const et=Kn.has(re)?I({width:H,height:ae,fontSize:Ue,margin:this.#e.margin,yLabels:re==="heatmap"?cn(re,Be,this.#n,this.#e):[],xLabels:re==="heatmap"?Be.labels:[],rotated:!0}):I({width:H,height:ae,fontSize:Ue,margin:this.#e.margin,titleSize:Fe.axisTitle,titles:pe[re]&&pe[re].horizontal?{left:ze.x.title,bottom:ze.y.title,right:ze.y2.title}:{left:ze.y.title,bottom:ze.x.title,right:ze.y2.title},rightGutter:this.#fe(re,Be)?Math.round(Ue*3):0,yLabels:cn(re,Be,this.#n,this.#e),xLabels:ln.has(re)?[]:Be.labels,rotated:!0}),Ke={doc:this.#i,groups:this.#a,plot:et,bound:Be,type:re,grid:this.#n,fontSize:Ue,hidden:this.#h,scheme:Le,axis:ze,typography:Fe,labels:ct};if(re!=="geomap"&&this.#Y(null),this.#e.multiples)this.#t=this.#ue(Ke),this.#s([]);else if(re==="combo"||re==="pareto")this.#t=o({...Ke,pareto:re==="pareto",reference:this.#e.reference,annotations:this.#e.annotations}),this.#s(this.#t.series.map(Xe=>({key:Xe.key,label:Xe.label,index:Xe.index})));else if(re==="heatmap")this.#t=le({...Ke,diverging:this.#e.diverging}),this.#s([]);else if(re==="radar")this.#t=R(Ke),this.#s(Be.series.map(Xe=>({key:Xe.key,label:Xe.label,index:Xe.index})));else if(re==="gauge")this.#t=B({...Ke,min:this.#e.min,max:this.#e.max,target:this.#e.target}),this.#s([]);else if(re==="sankey")this.#t=ut(Ke),this.#s([]);else if(re==="chord")this.#t=dt(Ke),this.#s([]);else if(re==="network")this.#t=yt({...Ke,iterations:this.#e.iterations,icon:this.#e.icon,linkWidth:this.#e.linkWidth}),this.#s(Array.isArray(this.#t.legend)?this.#t.legend:[]);else if(re==="stream")this.#t=zt(Ke),this.#s(Be.series.map(Xe=>({key:Xe.key,label:Xe.label,index:Xe.index})));else if(re==="marimekko")this.#t=xt(Ke),this.#s(Be.series.map(Xe=>({key:Xe.key,label:Xe.label,index:Xe.index})));else if(re==="violin")this.#t=$t(Ke),this.#s([]);else if(re==="gantt")this.#t=O({...Ke,spec:this.#e,rows:Be.rows||[]}),this.#s([]);else if(re==="geomap")this.#t=Te({...Ke,shapes:this.#e.shapes,codeProperty:this.#e.codeProperty,diverging:this.#e.diverging,projection:this.#e.projection,projectionOptions:this.#e.projectionOptions,layer:this.#e.layer,graticule:this.#e.graticule,zoom:this.#m.zoom,centreOffset:this.#m.offset}),this.#s([]),this.#Y(this.#t);else if(re==="correlogram")this.#t=se({...Ke,columns:this.#ge(),method:this.#e.method,values:this.#e.values}),this.#s([]);else if(re==="forest")this.#t=V(Ke),this.#s([]);else if(re==="funnel")this.#t=T(Ke),this.#s([]);else if(re==="candlestick")this.#t=q(Ke),this.#s([]);else if(Fn.has(re)){if(re==="histogram")this.#t=u({...Ke,buckets:this.#e.buckets,curve:this.#e.curve});else if(re==="movingRange")this.#t=n(Ke);else if(re==="control"||re==="capability"){const Xe=this.#e.y||this.#e.measure,Kt=this.#n&&this.#n.statistics;this.#t=(re==="capability"?b:P)({...Ke,capability:Kt&&Xe?Kt.capability(Xe,{by:this.#e.x,baseline:this.#e.baseline,rules:this.#e.rules,confidence:this.#e.confidence,...this.#e.spec||{}}):null})}else re==="qq"?this.#t=d(Ke):re==="ecdf"?this.#t=l(Ke):re==="lorenz"?this.#t=x(Ke):this.#t=m(Ke);this.#s([])}else this.#t=ue({...Ke,fit:this.#e.fit,trend:this.#e.trend,band:this.#e.band,error:this.#e.error,dense:Ut({series:Be.series,canvas:this.#e.canvas}),downsampleTo:this.#e.downsample,stack:this.#e.stack,reference:this.#e.reference,annotations:this.#e.annotations,sizes:this.#he(Be)}),this.#s(Be.series.length>1?Be.series.map(Xe=>({key:Xe.key,label:Xe.label,index:Xe.index})):[])}const ht=this.#t&&this.#t.errorBars;if(this.#e.error&&ht&&ht.marks&&!this.#D&&(!ht.drawn||ht.singleSkipped)){this.#D=!0;const et=this.#i&&this.#i.defaultView,Ke=et&&et.console||(typeof globalThis<"u"?globalThis.console:null);if(Ke&&typeof Ke.warn=="function"){let Xe;ht.drawn?Xe=`[lattice] error bars were requested but ${ht.singleSkipped} of ${ht.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" }\`.`:Xe=ht.single===ht.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.",Ke.warn(Xe)}}return this.#t&&(this.#t.plot=this.#t.plot||Xn(this.#t,H,ae)),this.#r&&(this.#r.outside=this.#t&&this.#t.outside||0),this.#e.selection&&this.#V(),this.#J(),this.#be(re,Be,wt),this.#ce(ze),{width:H,height:ae,chartType:re,categories:Be.categories||[],empty:!!Be.empty}}#ce(L){const H=S(L&&L.x),ae=H?Math.min(Hn,Math.max(Wn,Math.floor(H/4))):0;if(this.#A||!ae){this.#R();return}if(this.#v&&this.#E===ae)return;this.#R(),this.#E=ae;const ve=jt(this.#i),re=ve&&typeof ve.setInterval=="function"?ve.setInterval.bind(ve):setInterval;this.#v=re(()=>{this.#A||this.#i&&this.#i.hidden||this.#f&&this.#f.isConnected===!1||this.schedule()},ae);const Le=this.#v;Le&&typeof Le.unref=="function"&&Le.unref()}#R(){if(this.#v===null)return;const L=jt(this.#i);(L&&typeof L.clearInterval=="function"?L.clearInterval.bind(L):clearInterval)(this.#v),this.#v=null,this.#E=0}#ue(L){const H=ye(L.bound),ae=we({count:H.length,plot:L.plot}),ve=[];for(const Fe of L.bound.series)for(const Ue of Fe.points)ve.push(Ue.y);const re=r(ve,{zero:L.type!=="line"}),Le=new ie(this.#a.overlay);Z(this.#a,L.plot);const ze=new ie(this.#a.marks);new ie(this.#a.grid).finish(),new ie(this.#a.axis).finish(),new ie(this.#a.rules).finish();let Ee=null;for(let Fe=0;Fe<ae.length;Fe++){const Ue=ae[Fe],ct=H[Fe],wt={left:Ue.x,top:Ue.y,width:Ue.width,height:Ue.height,right:Ue.x+Ue.width,bottom:Ue.y+Ue.height,gutter:{left:0,bottom:0}};Ee=ue({...L,plot:wt,bound:ct.bound,domain:re,pool:ze,axes:!1});const Be=Le.next("text",`${je}__panel-title`);de(Be,{x:ke(Ue.x),y:ke(Ue.y-4),"text-anchor":"start"}),Oe(Be,ct.label)}return ze.finish(),Le.finish(),{...Ee||{},panels:ae,multiples:!0}}#fe(L,H){return L==="combo"||L==="pareto"?!0:!sn.has(L)||L==="horizontalBar"||L==="waterfall"?!1:!!(H&&Array.isArray(H.series)&&H.series.some(ae=>ae.axis==="right"&&!this.#h.has(ae.key)))}#he(L){if(this.#e.type!=="bubble"||!this.#e.size)return null;const H=[];for(const ve of L.series||[])for(const re of ve.points)typeof re.size=="number"&&H.push(re.size);const ae=gt(H);return ae?D(ae,[3,Math.max(6,Math.min(28,this.#e.maxRadius||22))]):null}#de(L){this.#J(),Oe(this.#k,L),this.#k.removeAttribute("hidden"),this.#o.setAttribute("hidden","");for(const H of Object.values(this.#a))Se(H);Se(this.#p),Se(this.#w),this.#t=null}#J(){const L=this.#n.licence;if(!!!(L&&typeof L.watermark=="function"&&L.watermark())){this.#g&&this.#g.parentNode&&this.#g.parentNode.removeChild(this.#g),this.#g=null;return}if(this.#g&&this.#g.parentNode)return;const ae=this.#i,ve=ce(ae,"div",`${je}__watermark`);ve.setAttribute("role","note");const re=ce(ae,"a",`${je}__watermark-link`);re.setAttribute("href","https://www.latticegrid.dev"),re.setAttribute("target","_blank"),re.setAttribute("rel","noopener noreferrer"),Oe(re,this.#n.messages.t("licence.watermark")),ve.appendChild(re),this.#g=ve,this.#f&&this.#f.appendChild(ve)}#me(){const L=this.#e.legend;if(L===!1)return{show:!1,position:"bottom",align:"start",shape:"square",maxItems:0,isolate:!1};const H=L&&typeof L=="object"?L:{};return{show:!0,position:["top","bottom","left","right"].includes(H.position)?H.position:"bottom",align:["start","centre","center","end"].includes(H.align)?H.align:"start",shape:["square","circle","line"].includes(H.shape)?H.shape:"square",maxItems:Number.isFinite(H.maxItems)&&H.maxItems>0?Number(H.maxItems):0,isolate:!!H.isolate}}#ge(){const L=this.#e.columns;if(Array.isArray(L)&&L.length)return L.slice(0,rn);const H=this.#n;return!H||!H.columns||typeof H.columns.visible!="function"?[]:H.columns.visible().filter(ae=>!ae.generated&&(ae.type==="number"||ae.type==="currency"||ae.type==="percent"||ae.type==="integer")).map(ae=>ae.id).slice(0,rn)}#s(L){Se(this.#p);const H=this.#me();if(de(this.#p,{"data-position":H.position,"data-align":H.align}),!L.length||!H.show)return;const ae=this.#i,ve=H.maxItems?L.slice(0,H.maxItems):L;for(const re of ve){const Le=ce(ae,"button",`${je}__legend-item`);Le.setAttribute("type","button");const ze=!this.#h.has(re.key);Le.setAttribute("aria-pressed",ze?"true":"false");const Ee=ce(ae,"span",`${je}__swatch ${je}__swatch--${H.shape}`);Ee.setAttribute("style",`background:${re.colour||this.#N.series(re.index)}`);const Fe=ce(ae,"span");Ve(Fe,this.#C.small),Oe(Fe,re.label),ge(Le,[Ee,Fe]),Le.addEventListener("click",()=>{this.#pe(re,L,H)}),this.#p.appendChild(Le)}if(H.maxItems&&L.length>ve.length){const re=ce(ae,"span",`${je}__legend-more`);Ve(re,this.#C.small),Oe(re,this.#n.messages.t("chart.legendMore",{count:L.length-ve.length})),this.#p.appendChild(re)}}#pe(L,H,ae){if(ae.isolate){const ve=H.filter(Le=>Le.key!==L.key),re=ve.every(Le=>this.#h.has(Le.key))&&!this.#h.has(L.key);if(this.#h.clear(),!re)for(const Le of ve)this.#h.add(Le.key)}else this.#h.has(L.key)?this.#h.delete(L.key):this.#h.add(L.key);this.emit("legend",{label:L.label,key:L.key,hidden:this.#h.has(L.key),hiddenKeys:[...this.#h]}),this.draw()}#be(L,H,ae){const ve=this.#n.messages,re=H.measure&&H.measure.title||"",Le=H.dimension&&H.dimension.title||"",ze=re?Le&&!ae?"chart.summary":"chart.summaryShare":"chart.summaryType",Ee=ve.t(ze,{type:ve.t(`chart.type.${L}`),measure:re,dimension:Le});de(this.#o,{"aria-label":Ee}),Se(this.#w);const Fe=this.#i,Ue=ce(Fe,"table"),ct=ce(Fe,"caption");Oe(ct,ve.t("chart.dataTable")),Ue.appendChild(ct);const wt=ce(Fe,"tr"),Be=ce(Fe,"th");Oe(Be,ae?"":Le),wt.appendChild(Be);const Ot=[];if(ae&&H.root){for(const ht of H.root.children){const et=ce(Fe,"tr"),Ke=ce(Fe,"th");Oe(Ke,ht.label);const Xe=ce(Fe,"td");Oe(Xe,e(ht.total,ve)),ge(et,[Ke,Xe]),Ot.push(et)}const pt=ce(Fe,"th");Oe(pt,re),wt.appendChild(pt)}else{const pt=this.#T(),ht=this.#t&&Array.isArray(this.#t.labels)&&Array.isArray(this.#t.series)&&Array.isArray(this.#t.categories)?this.#t.series:H.series||[];for(const et of ht){const Ke=ce(Fe,"th");Oe(Ke,et.label),wt.appendChild(Ke)}for(let et=0;et<(pt.labels||[]).length;et++){const Ke=ce(Fe,"tr"),Xe=ce(Fe,"th");Oe(Xe,pt.labels[et]),Ke.appendChild(Xe);for(const Kt of ht){const dn=ce(Fe,"td"),Zt=Kt.points[et];Oe(dn,Zt&&Zt.y!==null?e(Zt.y,ve):""),Ke.appendChild(dn)}Ot.push(Ke)}}Ue.appendChild(wt);for(const pt of Ot)Ue.appendChild(pt);this.#w.appendChild(Ue);const Pt=this.#t&&this.#t.annotations;if(Array.isArray(Pt)&&Pt.length){const pt=ce(Fe,"ul",`${je}__annotation-list`);for(const ht of Pt){if(!ht||!ht.text)continue;const et=ce(Fe,"li");Oe(et,ht.text),pt.appendChild(et)}pt.childNodes&&pt.childNodes.length&&this.#w.appendChild(pt)}}on(L,H){return typeof H!="function"?()=>{}:(this.#S.has(L)||this.#S.set(L,new Set),this.#S.get(L).add(H),()=>{const ae=this.#S.get(L);ae&&ae.delete(H)})}emit(L,H){const ae={...H,type:L,chart:this,grid:this.#n},ve=this.#e[`on${L.charAt(0).toUpperCase()}${L.slice(1)}`],re=[...this.#S.get(L)||[]];typeof ve=="function"&&re.unshift(ve);for(const Le of re)try{Le(ae)}catch(ze){const Ee=jt(this.#i);Ee.console&&typeof Ee.console.error=="function"&&Ee.console.error(`[lattice] a chart "${L}" listener threw`,ze)}return ae}data(){return this.#r}ascend(L){if(!this.#u||!this.#u.length)return[];const H=Number.isFinite(L)&&L>0?Number(L):this.#u.length;return this.#u=this.#u.slice(0,Math.max(0,this.#u.length-H)),this.emit("drill",{path:[...this.#u],label:this.#u[this.#u.length-1]||null}),this.draw(),[...this.#u]}update(L){this.#e={...this.#e,...L},this.draw()}get element(){return this.#f}toSVG(L){if(!this.#o)return"";const H=jt(this.#i);let ae=this.#o;return L&&L.inlineStyles&&H.getComputedStyle&&this.#o.cloneNode&&(ae=this.#o.cloneNode(!0),Jn(this.#o,ae,H),ae.setAttribute("xmlns","http://www.w3.org/2000/svg")),typeof H.XMLSerializer=="function"?new H.XMLSerializer().serializeToString(ae):ae.outerHTML||""}async toPNG(L){const H=jt(this.#i);if(!this.#o||!H.Image||!this.#i.createElement)return null;const ae=L&&L.scale||H.devicePixelRatio||1,ve=this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():St,re=Math.max(1,Math.round(ve.width||St.width)),Le=Math.max(1,Math.round(ve.height||St.height)),ze=this.toSVG({inlineStyles:!0}),Ee=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(ze)}`,Fe=new H.Image;await new Promise((Be,Ot)=>{Fe.onload=Be,Fe.onerror=()=>Ot(new Error("the chart could not be rasterised")),Fe.src=Ee});const Ue=this.#i.createElement("canvas");Ue.width=Math.round(re*ae),Ue.height=Math.round(Le*ae);const ct=Ue.getContext("2d"),wt=L&&"background"in L?L.background:"#ffffff";return wt&&(ct.fillStyle=wt,ct.fillRect(0,0,Ue.width,Ue.height)),ct.drawImage(Fe,0,0,Ue.width,Ue.height),new Promise(Be=>Ue.toBlob(Be,"image/png"))}toCSV(){const L=this.#r;if(!L)return"";const H=re=>{const Le=re==null?"":String(re);return/[",\n]/.test(Le)?`"${Le.replace(/"/g,'""')}"`:Le};if(L.root){const re=[["Label",L.measure.title||"Value"].map(H).join(",")];for(const Le of L.root.children)re.push([H(Le.label),H(Le.total)].join(","));return re.join(`
|
|
225
|
-
`)}const ve=[[
|
|
226
|
-
`)}destroy(){if(!this.#A){this.#A=!0,this.#R();for(const
|
|
224
|
+
`}function Q(G){const te=G.documentElement;if(!te||te.getAttribute(de))return;te.setAttribute(de,"1");const O=G.createElement("style");O.textContent=V(),(G.head||G.body||te).appendChild(O)}}),Qe("packages/modules/charts/axis.js",function(s,K){"use strict";Object.defineProperty(s,"normaliseAxes",{enumerable:!0,get:function(){return J}}),Object.defineProperty(s,"tickValues",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(s,"tickLabeller",{enumerable:!0,get:function(){return L}}),Object.defineProperty(s,"drawAxisTitle",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(s,"labelEvery",{enumerable:!0,get:function(){return N}}),Object.defineProperty(s,"drawMeasureAxis",{enumerable:!0,get:function(){return X}}),Object.defineProperty(s,"drawCategoryAxis",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(s,"leftLabelRoom",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(s,"setLabelText",{enumerable:!0,get:function(){return _}}),Object.defineProperty(s,"drawBandLabels",{enumerable:!0,get:function(){return R}}),Object.defineProperty(s,"drawContinuousAxis",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"drawAxisLines",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"createGroups",{enumerable:!0,get:function(){return he}}),Object.defineProperty(s,"MARK_OVERHANG",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"overhangFor",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"setPlotClip",{enumerable:!0,get:function(){return T}});const W=K("packages/modules/charts/frame.js").Pool,v=K("packages/modules/charts/svg.js"),de=v.attrs,ue=v.round,V=v.setText,Q=v.svg,G=K("packages/modules/charts/typography.js"),te=G.applySize,O=G.CHAR_RATIO,c=G.truncateTo,M=K("packages/modules/charts/styles.js").NS,k=6,F=1.2;function J(e){if(e===!1){const t={labels:!1,grid:!1};return{x:{...t},y:{...t},y2:{...t}}}const i=e&&typeof e=="object"?e:{},y=t=>typeof t=="string"?{title:t}:t&&typeof t=="object"?{...t}:{};return{x:y(i.x),y:y(i.y),y2:y(i.y2||i.right)}}function Z(e,i){const y=i&&i.ticks;if(Array.isArray(y)){const m=e.domain;return!m||m.min===void 0?y:y.filter(g=>Number(g)>=m.min&&Number(g)<=m.max)}const t=Number.isFinite(y)&&y>0?Number(y):5;return e.ticks(t)}function L(e,i,y){const t=e&&e.format;return typeof t=="function"?m=>String(t(m)):typeof t=="string"&&y&&y.formatting&&y.formatting.format?m=>String(y.formatting.format(m,t)):i.tick}function ne(e){if(!e.text)return;const i=e.side==="left"||e.side==="right"?e.plot.height:e.plot.width,y=Number.isFinite(i)?c(String(e.text),Math.max(0,i),e.size):String(e.text);if(!y||y==="…")return;const t=Q(e.group.ownerDocument,"text",{class:`${M}__axis-title`});if(te(t,e.size),e.side==="left"){const m=Math.max(e.size,e.plot.left-e.plot.gutter.left+e.size),g=e.plot.top+e.plot.height/2;de(t,{transform:`translate(${ue(m)} ${ue(g)}) rotate(-90)`,"text-anchor":"middle"})}else if(e.side==="right"){const m=e.plot.right+e.plot.gutter.right-e.size,g=e.plot.top+e.plot.height/2;de(t,{transform:`translate(${ue(m)} ${ue(g)}) rotate(90)`,"text-anchor":"middle"})}else de(t,{x:ue(e.plot.left+e.plot.width/2),y:ue(e.plot.bottom+e.plot.gutter.bottom-2),"text-anchor":"middle"});V(t,y),y!==String(e.text)&&t.setAttribute("aria-label",String(e.text)),e.group.appendChild(t)}function N(e){const{values:i,scale:y,size:t,horizontal:m,label:g}=e;if(i.length<2)return 1;let b=1/0;for(let l=1;l<i.length;l++){const u=Math.abs(y.of(i[l])-y.of(i[l-1]));Number.isFinite(u)&&u<b&&(b=u)}if(!Number.isFinite(b))return 1;if(b<=0)return i.length;let $=t*F+2;if(m){let l=0;for(const u of i){const x=String(g(u)||"").length*t*O;x>l&&(l=x)}$=l+k}return Math.max(1,Math.ceil($/b))}function X(e){const{gridGroup:i,axisGroup:y,plot:t,scale:m,format:g}=e,b=e.config||{},$=Z(m,b),l=L(b,g,e.grid),u=e.size||11,x=N({values:$,scale:m,size:u,horizontal:!!e.horizontal,label:l}),n=b.grid===!1?null:i,d=n?new W(n):null,S=new W(y);for(let p=0;p<$.length;p++){const w=$[p],j=ue(m.of(w)),f=w===0,a=p%x!==0;if(e.horizontal){if(d&&de(d.next("line",`${M}__gridline`),{x1:j,x2:j,y1:ue(t.top),y2:ue(t.bottom),"stroke-opacity":f?1:.6,"stroke-width":f?1.5:1}),b.labels===!1||a)continue;const o=S.next("text",`${M}__tick`);te(o,u),de(o,{x:j,y:ue(t.bottom+k),"text-anchor":"middle","dominant-baseline":"hanging"}),V(o,l(w))}else{if(d&&de(d.next("line",`${M}__gridline`),{x1:ue(t.left),x2:ue(t.right),y1:j,y2:j,"stroke-opacity":f?1:.6,"stroke-width":f?1.5:1}),b.labels===!1||a)continue;const o=S.next("text",`${M}__tick`);te(o,u),de(o,{x:ue(t.left-k),y:j,"text-anchor":"end","dominant-baseline":"middle"}),V(o,l(w))}}return d?d.finish():new W(i).finish(),S.finish(),$}function oe(e){const{group:i,plot:y,scale:t,labels:m,fontSize:g}=e,b=e.config||{};if(b.labels===!1){new W(i).finish();return}const $=new W(i),l=t.domain,u=t.step,x=b.rotate===void 0||b.rotate==="auto"?e.rotated:!!b.rotate,n=x&&u>0?Math.max(1,Math.ceil(g*Math.SQRT2/u)):1,d=Number.isFinite(b.every)&&b.every>0?Number(b.every):n,S=u*d;for(let p=0;p<l.length;p++){const w=ue(t.centre(l[p]));if(Number.isNaN(w)||p%d!==0)continue;const j=$.next("text",`${M}__tick`);te(j,g);const f=m[p]===void 0?"":m[p];x?(de(j,{x:0,y:0,"text-anchor":"end","dominant-baseline":"middle",transform:`translate(${w} ${ue(y.bottom+k)}) rotate(-45)`}),_(j,f,Math.max(0,y.gutter.bottom-k)*Math.SQRT2,g)):(de(j,{x:w,y:ue(y.bottom+k),"text-anchor":"middle","dominant-baseline":"hanging",transform:null}),_(j,f,S,g))}$.finish()}function ee(e){return Math.max(0,(e.gutter?e.gutter.left:e.left)-k)}function _(e,i,y,t){const m=String(i??""),g=c(m,y,t);return V(e,g),g!==m?e.setAttribute("aria-label",m):e.removeAttribute("aria-label"),g}function R(e){const{group:i,plot:y,scale:t,labels:m}=e,g=e.config||{},b=new W(i),$=t.domain,l=e.fontSize,u=ee(y),x=t.step>0?Math.max(1,Math.ceil(l*F/t.step)):1,n=Number.isFinite(g.every)&&g.every>0?Number(g.every):x;for(let d=0;d<$.length;d++){if(d%n!==0)continue;const S=ue(t.centre($[d]));if(Number.isNaN(S))continue;const p=b.next("text",`${M}__tick`);de(p,{x:ue(y.left-k),y:S,"text-anchor":"end","dominant-baseline":"middle"}),te(p,l),_(p,m[d],u,l)}b.finish()}function ie(e){const{group:i,plot:y,scale:t,format:m}=e,g=e.config||{};if(g.labels===!1){new W(i).finish();return}const b=L(g,m,e.grid),$=new W(i);for(const l of Z(t,g)){const u=ue(t.of(l));if(u<y.left-1||u>y.right+1)continue;const x=$.next("text",`${M}__tick`);te(x,e.size||11),de(x,{x:u,y:ue(y.bottom+k),"text-anchor":"middle","dominant-baseline":"hanging"}),V(x,b(l))}$.finish()}function I(e){const{group:i,plot:y}=e,t=new W(i);de(t.next("line"),{x1:ue(y.left),x2:ue(y.left),y1:ue(y.top),y2:ue(y.bottom)}),de(t.next("line"),{x1:ue(y.left),x2:ue(y.right),y1:ue(y.bottom),y2:ue(y.bottom)}),t.finish()}let P=0;function he(e,i){const y=`${M}-plot-clip-${++P}`,t=Q(e,"rect"),m=Q(e,"clipPath",{id:y});m.appendChild(t);const g=`${M}-box-clip-${P}`,b=Q(e,"clipPath",{id:g});b.appendChild(Q(e,"rect",{x:0,y:0,width:"100%",height:"100%"}));const $=Q(e,"defs");$.appendChild(m),$.appendChild(b);const l={grid:Q(e,"g",{class:`${M}__grid`}),marks:Q(e,"g",{class:`${M}__marks`}),rules:Q(e,"g",{class:`${M}__axis`}),axis:Q(e,"g",{class:`${M}__axis`}),labels:Q(e,"g",{class:`${M}__labels`}),overlay:Q(e,"g",{class:`${M}__overlay`}),clip:t,clipId:y,boxClipId:g};i.appendChild($);for(const u of["grid","marks","rules","axis","labels","overlay"])i.appendChild(l[u]);return l}const r=30;function D(e){return e==="bubble"?r:e==="scatter"?6:3}function T(e,i,y){if(!e||!e.marks||!e.clip)return;if(!i||!Number.isFinite(i.width)||!Number.isFinite(i.height)){e.marks.removeAttribute("clip-path");return}const t=Number.isFinite(y)&&y>=0?Number(y):r;de(e.clip,{x:ue(i.left-t),y:ue(i.top-t),width:ue(Math.max(0,i.width)+t*2),height:ue(Math.max(0,i.height)+t*2)}),e.marks.setAttribute("clip-path",`url(#${e.clipId})`)}}),Qe("packages/modules/charts/scale.js",function(s,K){"use strict";Object.defineProperty(s,"isNumber",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"toNumber",{enumerable:!0,get:function(){return te}}),Object.defineProperty(s,"toTime",{enumerable:!0,get:function(){return O}}),Object.defineProperty(s,"extent",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"niceStep",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(s,"niceDomain",{enumerable:!0,get:function(){return M}}),Object.defineProperty(s,"measureDomain",{enumerable:!0,get:function(){return k}}),Object.defineProperty(s,"linearTicks",{enumerable:!0,get:function(){return F}}),Object.defineProperty(s,"timeStepFor",{enumerable:!0,get:function(){return J}}),Object.defineProperty(s,"timeTicks",{enumerable:!0,get:function(){return L}}),Object.defineProperty(s,"linearScale",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(s,"timeScale",{enumerable:!0,get:function(){return N}}),Object.defineProperty(s,"key",{enumerable:!0,get:function(){return X}}),Object.defineProperty(s,"bandScale",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(s,"sqrtScale",{enumerable:!0,get:function(){return ee}});const xe=[1,2,2.5,5,10],W=6e4,v=36e5,de=864e5,ue=365.25*de,V=[1,2,5,10,20,25,50,100],Q=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,W,5*W,15*W,30*W,v,3*v,6*v,12*v,de,2*de,7*de,14*de,30*de,90*de,180*de,...V.map(_=>_*ue)];function G(_){return typeof _=="number"&&Number.isFinite(_)}function te(_){if(_==null||_==="")return null;if(_ instanceof Date){const ie=_.getTime();return Number.isFinite(ie)?ie:null}if(typeof _=="boolean")return _?1:0;const R=Number(_);return Number.isFinite(R)?R:null}function O(_){if(_==null||_==="")return null;if(_ instanceof Date){const ie=_.getTime();return Number.isFinite(ie)?ie:null}if(typeof _=="number")return Number.isFinite(_)?_:null;const R=Date.parse(String(_));return Number.isFinite(R)?R:null}function c(_){let R=1/0,ie=-1/0;for(let I=0;I<_.length;I++){const P=_[I];G(P)&&(P<R&&(R=P),P>ie&&(ie=P))}return R===1/0?null:{min:R,max:ie}}function Y(_){if(!(_>0))return 1;const R=10**Math.floor(Math.log10(_));for(const ie of xe)if(_<=ie*R)return ie*R;return 10*R}function M(_,R=5){const ie=Y((_.max-_.min)/Math.max(1,R));return{min:Math.floor(_.min/ie)*ie,max:Math.ceil(_.max/ie)*ie,step:ie}}function k(_,R={}){const ie=c(_)||{min:0,max:1};let{min:I,max:P}=ie;if(R.zero&&(I>0&&(I=0),P<0&&(P=0)),I===P){const he=Math.abs(I)>0?Math.abs(I)/10:1;I-=he,P+=he}if(R.nice!==!1){const he=M({min:I,max:P},R.ticks||5);I=he.min,P=he.max}return G(R.min)&&(I=R.min),G(R.max)&&(P=R.max),I===P&&(P=I+1),{min:I,max:P}}function F(_,R=5){const ie=Y((_.max-_.min)/Math.max(1,R)),I=Math.ceil(_.min/ie),P=Math.floor(_.max/ie),he=[];for(let r=I;r<=P;r++){const D=r*ie;he.push(Math.abs(D)<ie/1e6?0:Number(D.toPrecision(12)))}return he}function J(_,R=5){const ie=Math.max(1,R),I=_/ie;let P=Q[Q.length-1];for(const D of Q)if(D>=I){P=D;break}if(P<ue)return P;let he=P,r=Math.abs(_/P-ie);for(const D of Q){if(D<ue)continue;const T=Math.abs(_/D-ie);T<r&&(r=T,he=D)}return he}function Z(_,R){const ie=new Date(_.min).getUTCFullYear();let I=Math.ceil(ie/R)*R;Date.UTC(I,0,1)<_.min&&(I+=R);const P=[];for(;Date.UTC(I,0,1)<=_.max;I+=R)P.push(Date.UTC(I,0,1));return P}function L(_,R=5){const ie=J(_.max-_.min,R);if(ie>=ue)return Z(_,Math.round(ie/ue));const I=[],P=Math.ceil(_.min/ie)*ie;for(let he=P;he<=_.max;he+=ie)I.push(he);return I}function ne(_,R){const ie=_.max-_.min||1,[I,P]=R;return{kind:"linear",domain:_,range:R,of(he){return I+(he-_.min)/ie*(P-I)},invert(he){return _.min+(he-I)/(P-I||1)*ie},ticks(he=5){return F(_,he)}}}function N(_,R){return{...ne(_,R),kind:"time",ticks(I=5){return L(_,I)}}}function X(_){if(_==null)return" null";if(_ instanceof Date)return` date:${_.getTime()}`;if(typeof _=="object"){const R=_,ie=R.id??R.key??R.value;return ie!==void 0&&typeof ie!="object"?` obj:${String(ie)}`:` obj:${String(_)}`}return String(_)}function oe(_,R,ie=.2){const I=Math.min(.9,Math.max(0,ie)),[P,he]=R,r=new Map;for(let e=0;e<_.length;e++){const i=X(_[e]);r.has(i)||r.set(i,e)}const D=_.length?(he-P)/_.length:he-P,T=Math.max(0,D*(1-I));return{kind:"band",domain:_,range:R,bandwidth:T,step:D,of(e){const i=r.get(X(e));return i===void 0?NaN:P+i*D+(D-T)/2},centre(e){const i=this.of(e);return Number.isNaN(i)?NaN:i+T/2},ticks(){return _}}}function ee(_,R){const[ie,I]=R,P=Math.max(Math.abs(_.max),Math.abs(_.min),0)||1;return{kind:"sqrt",domain:_,range:R,of(he){const r=Math.sqrt(Math.abs(he)/P);return ie+r*(I-ie)}}}}),Qe("packages/modules/charts/format.js",function(s,K){"use strict";Object.defineProperty(s,"precisionFor",{enumerable:!0,get:function(){return v}}),Object.defineProperty(s,"axisNumber",{enumerable:!0,get:function(){return de}}),Object.defineProperty(s,"r2Digits",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"dateFormatFor",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"formatters",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"measureText",{enumerable:!0,get:function(){return G}});const W=K("packages/modules/charts/scale.js").timeStepFor;function v(te){if(!Number.isFinite(te)||te<=0)return 0;const O=Math.ceil(-Math.log10(te));return Math.min(6,Math.max(0,O))}function de(te,O,c=0){return Number.isFinite(te)?Math.abs(te)>=1e4?O.number(te,{notation:"compact",maximumFractionDigits:1}):O.number(te,{minimumFractionDigits:c,maximumFractionDigits:c}):""}function ue(te,O){const c=te&&te.messages;return!c||typeof c.number!="function"?Number(O).toFixed(2):c.number(O,{minimumFractionDigits:2,maximumFractionDigits:2})}function V(te){if(te>0){const c=W(te);if(c<1e3)return{minute:"2-digit",second:"2-digit",fractionalSecondDigits:3};if(c<6e4)return{hour:"2-digit",minute:"2-digit",second:"2-digit"}}return te<=2*36e5?{hour:"2-digit",minute:"2-digit"}:te<=3*864e5?{weekday:"short",hour:"2-digit"}:te<=180*864e5?{day:"numeric",month:"short"}:te<=3*365*864e5?{month:"short",year:"numeric"}:{year:"numeric"}}function Q(te,O){const c=te.messages,Y=c.locale,M=te.get("timeZone")||void 0;if(O.kind==="time"){const F=V(O.span||0),J=new Intl.DateTimeFormat(Y,M?{...F,timeZone:M}:F),Z=new Intl.DateTimeFormat(Y,M?{dateStyle:"medium",timeStyle:"short",timeZone:M}:{dateStyle:"medium",timeStyle:"short"});return{tick:L=>Number.isFinite(Number(L))?J.format(new Date(Number(L))):"",value:L=>Number.isFinite(Number(L))?Z.format(new Date(Number(L))):""}}const k=v(O.step||0);return{tick:F=>typeof F=="number"?de(F,c,k):String(F??""),value:F=>typeof F=="number"?c.number(F):String(F??"")}}function G(te,O){if(te==null||!Number.isFinite(te))return"";const c=Math.abs(te)>=1e-6?Number(te.toPrecision(6)):te;return O.number(c)}}),Qe("packages/modules/charts/labels.js",function(s,K){"use strict";Object.defineProperty(s,"resolveLabels",{enumerable:!0,get:function(){return F}}),Object.defineProperty(s,"collides",{enumerable:!0,get:function(){return J}}),Object.defineProperty(s,"placeLabels",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(s,"labelText",{enumerable:!0,get:function(){return L}}),Object.defineProperty(s,"drawAnchoredLabels",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(s,"drawDataLabels",{enumerable:!0,get:function(){return N}});const W=K("packages/modules/charts/frame.js").Pool,de=K("packages/modules/charts/format.js").measureText,ue=K("packages/modules/charts/svg.js"),V=ue.attrs,Q=ue.round,G=ue.setText,O=K("packages/modules/charts/styles.js").NS,c=K("packages/modules/charts/typography.js"),Y=c.applySize,M=c.textWidth,k=4;function F(X){const oe=X&&X.labels;if(!oe)return{show:!1,names:oe!==!1,position:"outside",format:null,minGap:2,total:!1};const ee=typeof oe=="object"?oe:{};return{show:!0,names:!0,position:["outside","inside","auto"].includes(ee.position)?ee.position:"outside",format:ee.format||null,minGap:Number.isFinite(ee.minGap)?Number(ee.minGap):2,total:!!ee.total}}function J(X,oe,ee){for(const _ of oe)if(X.x-ee<_.x+_.width&&X.x+X.width+ee>_.x&&X.y-ee<_.y+_.height&&X.y+X.height+ee>_.y)return!0;return!1}function Z(X){const{points:oe,plot:ee,size:_}=X,R=X.minGap===void 0?2:X.minGap,ie=[],I=[];for(const P of oe){if(P.px===void 0||P.py===void 0)continue;const he=X.text(P);if(!he)continue;const r=M(he,_),D=_;let T=P.px,e=P.py-k,i="middle",y=!1;X.horizontal?(T=P.px+k,e=P.py,i="start",X.position!=="outside"&&P.pbase!==void 0&&Math.abs(P.px-P.pbase)>r+k*2&&(T=P.px-k,i="end",y=!0)):X.position!=="outside"&&P.pbase!==void 0&&Math.abs(P.pbase-P.py)>D+k*2&&(e=P.py+D+k,y=!0);const t=()=>({x:i==="middle"?T-r/2:i==="end"?T-r:T,y:e-D,width:r,height:D});let m=t();!(m.y>=ee.top-1)&&!y&&!X.horizontal&&P.pbase!==void 0&&Math.abs(P.pbase-P.py)>D+k*2&&(e=P.py+D+k,y=!0,m=t()),!(m.x+m.width<=ee.right+1)&&!y&&X.horizontal&&P.pbase!==void 0&&Math.abs(P.px-P.pbase)>r+k*2&&(T=P.px-k,i="end",y=!0,m=t()),!(m.x<ee.left-1||m.x+m.width>ee.right+1)&&(m.y<ee.top-1||m.y+m.height>ee.bottom+D||J(m,ie,R)||(ie.push(m),I.push({x:Q(T),y:Q(e),text:he,anchor:i,inside:y})))}return I}function L(X,oe,ee){return X==null?"":typeof oe.format=="function"?String(oe.format(X)):typeof oe.format=="string"&&ee&&ee.formatting&&ee.formatting.format?String(ee.formatting.format(X,oe.format)):de(X,ee&&ee.messages)}function ne(X){const oe=new W(X.group),ee=X.minGap===void 0?2:X.minGap,_=X.size,R=[];let ie=0;for(const I of X.anchors){if(!I||!I.text)continue;const P=I.width===void 0?M(I.text,X.size):I.width,he=I.anchor||"middle",D={x:he==="end"?I.x-P:he==="start"?I.x:I.x-P/2,y:I.y-_/2,width:P,height:_};if(X.plot&&(D.x<X.plot.left-1||D.x+D.width>X.plot.right+1||D.y<X.plot.top-1||D.y+D.height>X.plot.bottom+1)||I.width!==void 0&&P>I.width||I.height!==void 0&&_>I.height||J(D,R,ee))continue;R.push(D);const T=oe.next("text",I.className||`${O}__data-label`);Y(T,X.size),V(T,{x:Q(I.x),y:Q(I.y),"text-anchor":he,"dominant-baseline":I.baseline||"middle","data-inside":I.inside?"true":null}),G(T,I.text),ie++}return oe.finish(),ie}function N(X){const oe=new W(X.group),{options:ee}=X;let _=0;const R=ie=>typeof ee.format=="function"&&ie.y!==null&&ie.y!==void 0?String(ee.format(ie.y,ie)):L(ie.y,ee,X.grid);for(const ie of X.series){const I=Z({points:ie.points,plot:X.plot,size:X.size,position:ee.position,horizontal:X.horizontal,minGap:ee.minGap,text:R});for(const P of I){const he=oe.next("text",`${O}__data-label`);Y(he,X.size),V(he,{x:P.x,y:P.y,"text-anchor":P.anchor,"data-inside":P.inside?"true":null}),G(he,P.text),_++}}return oe.finish(),_}}),Qe("packages/modules/charts/dense.js",function(s,K){"use strict";Object.defineProperty(s,"CANVAS_THRESHOLD",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(s,"downsample",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"markCount",{enumerable:!0,get:function(){return v}}),Object.defineProperty(s,"wantsCanvas",{enumerable:!0,get:function(){return de}}),Object.defineProperty(s,"paintDense",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"sizeCanvas",{enumerable:!0,get:function(){return V}});const xe=3e3;function W(Q,G){const te=Q.length;if(!Number.isFinite(G)||G>=te||G<3||te<3)return Q;const O=[Q[0]],c=(te-2)/(G-2);let Y=0;for(let M=0;M<G-2;M++){const k=Math.floor(M*c)+1,F=Math.min(Math.floor((M+1)*c)+1,te-1),J=F,Z=Math.min(Math.floor((M+2)*c)+1,te);let L=0,ne=0,N=0;for(let _=J;_<Z;_++){const R=Q[_];!R||!Number.isFinite(R.y)||(L+=R.x,ne+=R.y,N++)}N&&(L/=N,ne/=N);const X=Q[Y];if(k>=F)continue;let oe=k,ee=-1;for(let _=k;_<F;_++){const R=Q[_];if(!R||!Number.isFinite(R.y))continue;const ie=Math.abs((X.x-L)*(R.y-X.y)-(X.x-R.x)*(ne-X.y));ie>ee&&(ee=ie,oe=_)}oe<=Y||(O.push(Q[oe]),Y=oe)}return O.push(Q[te-1]),O}function v(Q){let G=0;for(const te of Q)G+=te.points.length;return G}function de(Q){if(Q.canvas===!0)return!0;if(Q.canvas===!1)return!1;const G=Number.isFinite(Q.canvas)?Number(Q.canvas):xe;return v(Q.series)>G}function ue(Q){const{context:G,series:te,ratio:O}=Q;G.save(),G.scale(O,O);for(const c of te){const Y=Q.colour(c.index);if(Q.type==="scatter"||Q.type==="bubble"){G.fillStyle=Y;for(const k of c.points)k.px!==void 0&&(G.beginPath(),G.arc(k.px,k.py,k.pr||2,0,Math.PI*2),G.fill());continue}G.strokeStyle=Y,G.lineWidth=2,G.lineJoin="round",G.beginPath();let M=!1;for(const k of c.points){if(k.px===void 0||k.py===void 0){M=!1;continue}M?G.lineTo(k.px,k.py):G.moveTo(k.px,k.py),M=!0}G.stroke()}G.restore()}function V(Q){const{canvas:G}=Q;return G.width=Math.max(1,Math.round(Q.width*Q.ratio)),G.height=Math.max(1,Math.round(Q.height*Q.ratio)),G.style&&(G.style.width=`${Q.width}px`,G.style.height=`${Q.height}px`),typeof G.getContext=="function"?G.getContext("2d"):null}}),Qe("packages/core/src/internal/util.js",function(s,K){"use strict";Object.defineProperty(s,"VERSION",{enumerable:!0,get:function(){return v}}),Object.defineProperty(s,"reportedWarnings",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"warnOnce",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(s,"infoOnce",{enumerable:!0,get:function(){return M}}),Object.defineProperty(s,"resetWarnings",{enumerable:!0,get:function(){return k}}),Object.defineProperty(s,"fail",{enumerable:!0,get:function(){return F}}),Object.defineProperty(s,"invariant",{enumerable:!0,get:function(){return J}}),Object.defineProperty(s,"DEV",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(s,"isObject",{enumerable:!0,get:function(){return L}}),Object.defineProperty(s,"isFunction",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(s,"isNil",{enumerable:!0,get:function(){return N}}),Object.defineProperty(s,"isBlank",{enumerable:!0,get:function(){return X}}),Object.defineProperty(s,"isCtor",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(s,"pathGetter",{enumerable:!0,get:function(){return _}}),Object.defineProperty(s,"pathSetter",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"getPath",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"setPath",{enumerable:!0,get:function(){return P}}),Object.defineProperty(s,"humanise",{enumerable:!0,get:function(){return he}}),Object.defineProperty(s,"escapeHtml",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"titleCase",{enumerable:!0,get:function(){return T}}),Object.defineProperty(s,"expand",{enumerable:!0,get:function(){return e}}),Object.defineProperty(s,"toArray",{enumerable:!0,get:function(){return i}}),Object.defineProperty(s,"merge",{enumerable:!0,get:function(){return t}}),Object.defineProperty(s,"mergeRow",{enumerable:!0,get:function(){return m}}),Object.defineProperty(s,"Lru",{enumerable:!0,get:function(){return g}}),Object.defineProperty(s,"collator",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"defaultCompare",{enumerable:!0,get:function(){return l}}),Object.defineProperty(s,"now",{enumerable:!0,get:function(){return u}}),Object.defineProperty(s,"nextFrame",{enumerable:!0,get:function(){return n}}),Object.defineProperty(s,"cancelFrame",{enumerable:!0,get:function(){return d}}),Object.defineProperty(s,"frameBatched",{enumerable:!0,get:function(){return S}}),Object.defineProperty(s,"settleDebounce",{enumerable:!0,get:function(){return p}}),Object.defineProperty(s,"whenIdle",{enumerable:!0,get:function(){return w}}),Object.defineProperty(s,"uid",{enumerable:!0,get:function(){return f}});const xe="1.71.1";async function W(){return xe}const v="1.71.1",de=new Set,ue=2e3;function V(a){if(de.add(a),de.size>ue){const o=de.values().next().value;o!==void 0&&de.delete(o)}}const Q=[],G=500;function te(a,o,h){Q.push({key:a,level:o,message:h.map(B=>typeof B=="string"?B:O(B)).join(" "),at:Date.now()}),Q.length>G&&Q.shift()}function O(a){if(a instanceof Error)return a.message;try{return JSON.stringify(a)}catch{return String(a)}}function c(){return Q.map(a=>({...a}))}function Y(a,...o){de.has(a)||(V(a),te(a,"warn",o),console.warn("[lattice]",...o))}function M(a,...o){de.has(a)||(V(a),te(a,"info",o),console.info("[lattice]",...o))}function k(){de.clear(),Q.length=0}function F(a,o){const h=new Error(`[lattice] ${a}`);throw o!==void 0&&(h.cause=o),h}function J(a,o){a||F(o)}const Z=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function L(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)}function ne(a){return typeof a=="function"}function N(a){return a==null}function X(a){return a==null||a===""}function oe(a){return typeof a!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(a))?!0:!!(a.prototype&&Object.getOwnPropertyNames(a.prototype).length>1)}const ee=new Map;function _(a){let o=ee.get(a);if(o)return o;if(!a.includes("."))o=h=>h?.[a];else{const h=a.split("."),B=h.length;o=E=>{let U=E;for(let q=0;q<B;q++){if(U==null)return;U=U[h[q]]}return U}}return ee.set(a,o),o}const R=new Map;function ie(a){let o=R.get(a);if(o)return o;if(!a.includes("."))o=(h,B)=>{h!=null&&(h[a]=B)};else{const h=a.split("."),B=h.length-1;o=(E,U)=>{let q=E;for(let se=0;se<B;se++){if(q==null)return;const C=h[se];q[C]==null&&(q[C]={}),q=q[C]}q!=null&&(q[h[B]]=U)}}return R.set(a,o),o}function I(a,o){return _(o)(a)}function P(a,o,h){ie(o)(a,h)}function he(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(/^./,h=>h.toUpperCase()):""}const r={"&":"&","<":"<",">":">",'"':""","'":"'"};function D(a){const o=a==null?"":String(a);return/[&<>"']/.test(o)?o.replace(/[&<>"']/g,h=>r[h]):o}function T(a){return String(a).replace(/\w\S*/g,o=>o[0].toUpperCase()+o.slice(1).toLowerCase())}function e(a,o,h){if(a!==void 0)return a===!0?{enabled:!0,...h}:a===!1?{enabled:!1}:L(a)?a:{[o]:a,enabled:!0}}function i(a){return a==null?[]:Array.isArray(a)?a:[a]}const y=Object.freeze(new Set(["__proto__","constructor","prototype"]));function t(a,o){if(!L(a))return L(o)?{...o}:o;if(!L(o))return o===void 0?a:o;const h={...a};for(const B of Object.keys(o)){if(y.has(B))continue;const E=o[B];E!==void 0&&(h[B]=L(E)&&L(h[B])?t(h[B],E):E)}return h}function m(a,o){if(!L(a)||!L(o)||a===o)return o;const h=Object.create(Object.getPrototypeOf(a));return Object.assign(h,a,o),h}class g{#l;#n=new Map;#c;constructor(o=256,h=null){this.#l=o,this.#c=h}get size(){return this.#n.size}get max(){return this.#l}set max(o){this.#l=o,this.#e()}has(o){return this.#n.has(o)}get(o){const h=this.#n;if(!h.has(o))return;const B=h.get(o);return h.delete(o),h.set(o,B),B}peek(o){return this.#n.get(o)}set(o,h){const B=this.#n;return B.has(o)&&B.delete(o),B.set(o,h),this.#e(),h}delete(o){const h=this.#n.get(o);return this.#n.delete(o)&&this.#c&&this.#c(h,o),h}clear(){if(this.#c)for(const[o,h]of this.#n)this.#c(h,o);this.#n.clear()}keys(){return this.#n.keys()}values(){return this.#n.values()}#e(){const o=this.#n;for(;o.size>this.#l;){const h=o.keys().next().value,B=o.get(h);o.delete(h),this.#c&&this.#c(B,h)}}}const b=new Map;function $(a,o){const h=`${a||""}|${o?JSON.stringify(o):""}`;let B=b.get(h);return B||(B=new Intl.Collator(a||void 0,{numeric:!0,sensitivity:"variant",...o}),b.set(h,B)),B}function l(a,o){if(a===o)return 0;if(a==null)return 1;if(o==null)return-1;if(typeof a=="number"&&typeof o=="number")return Number.isNaN(a)?Number.isNaN(o)?0:1:Number.isNaN(o)||a<o?-1:a>o?1:0;const h=String(a),B=String(o);return h<B?-1:h>B?1:0}function u(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const x=typeof requestAnimationFrame=="function";function n(a){return x?requestAnimationFrame(a):setTimeout(()=>a(u()),16)}function d(a){a!=null&&(x?cancelAnimationFrame(a):clearTimeout(a))}function S(a){let o=null,h=null;const B=()=>{o=null;const U=h;h=null,a(...U||[])},E=(...U)=>{h=U,o===null&&(o=n(B))};return E.cancel=()=>{d(o),o=null,h=null},E.flush=()=>{o!==null&&(d(o),B())},E}function p(a,o){let h=null,B=null;const E=()=>{if(h=null,B===null)return;const se=B;B=null,a(...se),U()},U=()=>{h=setTimeout(E,o),typeof h?.unref=="function"&&h.unref()},q=(...se)=>{h===null?(a(...se),U()):(B=se,clearTimeout(h),U())};return q.flush=()=>{if(h!==null&&clearTimeout(h),h=null,B===null)return;const se=B;B=null,a(...se)},q.cancel=()=>{h!==null&&clearTimeout(h),h=null,B=null},q.pending=()=>h!==null||B!==null,q}function w(a,o=50){return typeof requestIdleCallback=="function"?requestIdleCallback(a,{timeout:o}):setTimeout(()=>a({timeRemaining:()=>0,didTimeout:!0}),1)}let j=0;function f(a="l"){return`${a}${(++j).toString(36)}`}}),Qe("packages/modules/charts/annotations.js",function(s,K){"use strict";Object.defineProperty(s,"overlayLayer",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(s,"annotationValue",{enumerable:!0,get:function(){return R}}),Object.defineProperty(s,"annotationAxis",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"annotationText",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"drawAnnotations",{enumerable:!0,get:function(){return he}});const W=K("packages/modules/charts/frame.js").Pool,v=K("packages/modules/charts/scale.js"),de=v.isNumber,ue=v.toNumber,V=v.toTime,Q=K("packages/modules/charts/svg.js"),G=Q.attrs,te=Q.path,O=Q.round,c=Q.setText,Y=Q.SVG_NS,k=K("packages/modules/charts/styles.js").NS,J=K("packages/core/src/internal/util.js").warnOnce;function Z(r,D){for(const e of r.childNodes||[])if(e&&String(e.getAttribute&&e.getAttribute("class"))===D)return e;const T=r.ownerDocument.createElementNS(Y,"g");return T.setAttribute("class",D),r.appendChild(T),T}const L=new Set(["line","target","band","callout","event"]);function ne(r,D){return r.kind==="time"?V(D):ue(D)}function N(r,D,T){if(r.kind==="band"){const i=r.of(D);if(!Number.isFinite(i))return NaN;const y=Number(r.bandwidth)||0;return T==="right"?i+y:i}const e=ne(r,D);return e===null?NaN:r.of(e)}function X(r,D,T){const e=r.kind||"line",i=r.label?` (${JSON.stringify(r.label)})`:"";J(`chart:annotation:dropped:${e}:${D}:${T}`,`chart annotation${i} of kind ${JSON.stringify(e)}, reading the ${D} axis, was not drawn: ${T}.`)}function oe(r,D){if(r instanceof Date){const e=r.getTime();return Number.isFinite(e)?r.toISOString().slice(0,10):String(r)}if(typeof r=="number")return Number.isFinite(r)?D(r):String(r);const T=ue(r);return T===null||typeof r=="string"?String(r):D(T)}function ee(r,D,T){const e=[];for(const i of r)if((i.axis==="right"?"right":"left")===T&&!(D.series!==void 0&&i.key!==D.series))for(const t of i.points)de(t.y)&&e.push(Number(t.y));return e}function _(r,D){if(!r.length)return null;const T=[...r].sort((t,m)=>t-m);if(T.length===1)return T[0];const e=Math.min(100,Math.max(0,D))/100*(T.length-1),i=Math.floor(e),y=Math.ceil(e);return i===y?T[i]:T[i]+(T[y]-T[i])*(e-i)}function R(r,D,T){if(!r.compute)return ue(r.value);const e=ee(D,r,T);if(!e.length)return null;const i=String(r.compute).toLowerCase();if(i==="mean"||i==="avg")return e.reduce((t,m)=>t+m,0)/e.length;if(i==="median"||i==="p50")return _(e,50);if(i==="min")return Math.min(...e);if(i==="max")return Math.max(...e);const y=/^p(\d+(?:\.\d+)?)$/.exec(i);return y?_(e,Number(y[1])):null}function ie(r){return r.axis==="right"||r.axis==="y2"?"right":"left"}function I(r,D,T,e){const i=r.label?`${r.label}: `:"",y=e?` (${ie(r)==="right"?"right axis":"left axis"})`:"",t=r.kind||"line";if(t==="band"){if(!Array.isArray(D)||D[0]===null||D[1]===null)return"";const[g,b]=D;return`${i||"Band: "}${T(Math.min(g,b))} to ${T(Math.max(g,b))}${y}`}return D==null?"":`${i||`${t==="target"?"Target":t==="callout"?"Callout":"Reference"}: `}${T(D)}${y}`}function P(r){return(r.kind||"line")==="band"?0:1}function he(r){const{group:D,plot:T,xScale:e,yScale:i,rightScale:y,series:t,format:m}=r,g=new W(Z(D,`${k}__annotations`)),b=[],l=[...Array.isArray(r.annotations)?r.annotations:[]].sort((u,x)=>P(u)-P(x));for(const u of l){const x=u.kind||"line";if(!L.has(x))continue;const n=ie(u),d=n==="right"&&y?y:i;if(x==="band"){if(u.orient==="vertical"){const h=N(e,u.from,"left"),B=N(e,u.to,"right");if(Number.isNaN(h)||Number.isNaN(B)){const se=Number.isNaN(h)&&Number.isNaN(B)?"from and to":Number.isNaN(h)?"from":"to";X(u,n,`its ${se} value could not be placed on the x scale`);continue}const E=O(Math.min(h,B)),U=O(Math.max(h,B));if(G(g.next("rect",`${k}__annotation-band ${u.className||""}`.trim()),{x:E,y:O(T.top),width:Math.max(0,U-E),height:O(Math.max(0,T.bottom-T.top)),fill:u.colour||"currentColor","fill-opacity":u.opacity===void 0?.12:u.opacity}),u.label){const se=g.next("text",`${k}__annotation-label`);G(se,{x:E+4,y:O(T.top+12),"text-anchor":"start"}),c(se,u.label)}const q=u.label?`${u.label}: `:"Event window: ";b.push({text:`${q}${oe(u.from,m)} to ${oe(u.to,m)}`});continue}const j=R({...u,value:u.from,compute:u.fromCompute},t,n),f=R({...u,value:u.to,compute:u.toCompute},t,n);if(j===null||f===null)continue;const a=O(d.of(j)),o=O(d.of(f));if(G(g.next("rect",`${k}__annotation-band ${u.className||""}`.trim()),{x:O(T.left),y:Math.min(a,o),width:O(Math.max(0,T.right-T.left)),height:Math.max(0,Math.abs(o-a)),fill:u.colour||"currentColor","fill-opacity":u.opacity===void 0?.12:u.opacity}),u.label){const h=g.next("text",`${k}__annotation-label`);G(h,{x:O(T.left+4),y:Math.min(a,o)+12,"text-anchor":"start"}),c(h,u.label)}b.push({text:I(u,[j,f],m,r.dual)});continue}if(x==="event"){const j=u.x!==void 0?u.x:u.at,f=O(N(e,j,"left")+(e.kind==="band"?(Number(e.bandwidth)||0)/2:0));if(Number.isNaN(f)){X(u,n,"its x value could not be placed on the x scale");continue}if(G(g.next("path",`${k}__annotation-event`),{d:te(["M",f,O(T.top),"L",f,O(T.bottom)]),stroke:u.colour||"currentColor",fill:"none"}),G(g.next("circle",`${k}__annotation-event-flag`),{cx:f,cy:O(T.top),r:3,fill:u.colour||"currentColor"}),u.label){const o=g.next("text",`${k}__annotation-label`);G(o,{x:f+5,y:O(T.top+10),"text-anchor":"start"}),c(o,u.label)}const a=u.label?`${u.label} — `:"Event — ";b.push({text:`${a}at ${oe(j,m)}`});continue}if(x==="callout"){const j=R(u,t,n);if(j===null)continue;const f=u.at!==void 0?O(e.kind==="band"?e.centre(u.at):e.of(ne(e,u.at)??NaN)):O(T.right-4),a=O(d.of(j));if(Number.isNaN(f)){X(u,n,"its x value could not be placed on the x scale");continue}if(G(g.next("circle",`${k}__annotation-point`),{cx:f,cy:a,r:3.5,fill:u.colour||"currentColor"}),u.label){const o=g.next("text",`${k}__annotation-label`);G(o,{x:f+6,y:a-6,"text-anchor":"start"}),c(o,u.label)}b.push({text:I(u,j,m,r.dual)});continue}if(u.orient==="vertical"||u.x!==void 0){const j=u.x!==void 0?u.x:u.value,f=e.kind==="band"?O(e.centre(j)):O(e.of(ne(e,j)??NaN));if(Number.isNaN(f)){X(u,n,"its x value could not be placed on the x scale");continue}const a=x==="target"?`${k}__annotation-target`:`${k}__annotation-line`;if(G(g.next("path",a),{d:te(["M",f,O(T.top),"L",f,O(T.bottom)]),stroke:u.colour||"currentColor",fill:"none"}),u.label){const o=g.next("text",`${k}__annotation-label`);G(o,{x:f+4,y:O(T.top+10),"text-anchor":"start"}),c(o,u.label)}b.push({text:u.label?`${u.label} — at ${oe(j,m)}`:""});continue}const S=R(u,t,n);if(S===null)continue;const p=O(d.of(S)),w=x==="target"?`${k}__annotation-target`:`${k}__annotation-line`;if(G(g.next("path",w),{d:te(["M",O(T.left),p,"L",O(T.right),p]),stroke:u.colour||"currentColor",fill:"none"}),u.label){const j=g.next("text",`${k}__annotation-label`);G(j,{x:O(T.right-4),y:p-4,"text-anchor":"end"}),c(j,u.label)}b.push({text:I(u,S,m,r.dual)})}return g.finish(),b.filter(u=>u.text)}}),Qe("packages/modules/charts/combo.js",function(s,K){"use strict";Object.defineProperty(s,"toPareto",{enumerable:!0,get:function(){return t}}),Object.defineProperty(s,"drawCombo",{enumerable:!0,get:function(){return b}}),Object.defineProperty(s,"drawRightAxis",{enumerable:!0,get:function(){return $}});const xe=K("packages/modules/charts/axis.js"),W=xe.drawAxisLines,v=xe.drawCategoryAxis,de=xe.drawContinuousAxis,ue=xe.drawMeasureAxis,V=xe.overhangFor,Q=xe.setPlotClip,G=K("packages/modules/charts/frame.js"),te=G.Pool,O=G.shouldRotate,Y=K("packages/modules/charts/format.js").formatters,M=K("packages/modules/charts/scale.js"),k=M.bandScale,F=M.extent,J=M.isNumber,Z=M.linearScale,L=M.measureDomain,ne=M.timeScale,N=M.toNumber,X=M.toTime,oe=K("packages/modules/charts/svg.js"),ee=oe.attrs,_=oe.path,R=oe.round,I=K("packages/modules/charts/styles.js").NS,he=K("packages/modules/charts/scheme.js").resolveScheme,D=K("packages/modules/charts/labels.js").drawDataLabels,e=K("packages/modules/charts/annotations.js").drawAnnotations;function i(l){return{left:l.filter(u=>u.axis!=="right"),right:l.filter(u=>u.axis==="right")}}function y(l,u){const x=[];for(const n of l)for(const d of n.points)x.push(d.y);return L(x,{zero:u})}function t(l){const u=l.series[0];if(!u)return l;const x=u.points.map((p,w)=>({point:p,label:l.labels[w],category:l.categories[w]})).filter(p=>J(p.point.y)).sort((p,w)=>w.point.y-p.point.y),n=x.reduce((p,w)=>p+w.point.y,0);let d=0;const S=x.map(p=>(d+=p.point.y,n>0?d/n*100:0));return{...l,categories:x.map(p=>p.category),labels:x.map(p=>p.label),series:[{...u,index:0,mark:"bar",axis:"left",points:x.map(p=>p.point)},{key:"cumulative",label:l.cumulativeLabel||"%",index:1,mark:"line",axis:"right",points:x.map((p,w)=>({x:p.category,xKey:p.point.xKey,label:p.label,y:S[w],rows:p.point.rows,rowKey:p.point.rowKey}))}]}}function m(l,u){const x=[u.left,u.right];if(l.kind!=="time"&&l.kind!=="linear")return k(l.categories,x,.2);const n=l.kind==="time"?l.categories.map(X):l.categories.map(N);if(l.kind==="time"){const S=F(n);if(S&&S.min===S.max)return ne({min:S.min-3e4,max:S.max+3e4},x)}const d=L(n,{zero:!1,nice:l.kind!=="time"});return l.kind==="time"?ne(d,x):Z(d,x)}function g(l,u){const x=[...new Set(l.filter(w=>Number.isFinite(w)))].sort((w,j)=>w-j);if(x.length<2){const[w,j]=u.range;return Math.max(4,(j-w)/10)}const n=[];for(let w=1;w<x.length;w++)n.push(x[w]-x[w-1]);n.sort((w,j)=>w-j);const d=Math.floor(n.length/2),S=n.length%2?n[d]:(n[d-1]+n[d])/2,p=Math.abs(u.of(x[0]+S)-u.of(x[0]));return Math.max(1,p*.8)}function b(l){const u=l.scheme||he(),{plot:x}=l,n=l.pareto?t(l.bound):l.bound,d=n.series.filter(fe=>!l.hidden.has(fe.key)),S=i(d),p=S.left.some(fe=>(fe.mark||"bar")==="bar"),w=y(S.left,p),j=Z(w,[x.bottom,x.top]),f=S.right.length?l.pareto?{min:0,max:100}:y(S.right,!1):null,a=f?Z(f,[x.bottom,x.top]):null,o=m(n,x),h=o.kind!=="band",B=h?n.categories.map(fe=>n.kind==="time"?X(fe):N(fe)):null;ue({gridGroup:l.groups.grid,axisGroup:l.groups.axis,plot:x,scale:j,format:Y(l.grid,{kind:"linear",step:(w.max-w.min)/5})}),h?de({group:l.groups.overlay,plot:x,scale:o,format:Y(l.grid,{kind:n.kind,span:o.domain.max-o.domain.min,step:(o.domain.max-o.domain.min)/5}),grid:l.grid,size:l.fontSize}):v({group:l.groups.overlay,plot:x,scale:o,labels:n.labels,fontSize:l.fontSize,rotated:O(n.labels,o.step,l.fontSize)}),W({group:l.groups.rules,plot:x}),a&&$({group:l.groups.axis,plot:x,scale:a,colour:u.series(S.right[0].index),format:Y(l.grid,{kind:"linear",step:(f.max-f.min)/5}),suffix:l.pareto?"%":""}),Q(l.groups,x,V(l.type));const E=new te(l.groups.marks),U=d.filter(fe=>(fe.mark||"bar")==="bar"),q=h?g(B,o):o.bandwidth,se=U.length?q/U.length:q;let C=0;for(const fe of d){const me=fe.mark||"bar",be=fe.axis==="right"&&a?a:j,ge=u.series(fe.index);if(me==="bar"){const we=C*se;C++;const _e=be.of(Math.max(be.domain.min,0));for(let Pe=0;Pe<fe.points.length;Pe++){const je=fe.points[Pe];if(!J(je.y))continue;let Ie;if(h){const Ve=n.kind==="time"?X(je.x):N(je.x);Ie=Ve===null?NaN:o.of(Ve)-q/2}else Ie=o.of(je.x);if(Number.isNaN(Ie))continue;const Ge=be.of(je.y);ee(E.next("rect",`${I}__bar ${I}__mark`),{x:R(Ie+we),y:R(Math.min(Ge,_e)),width:R(Math.max(0,se)),height:R(Math.max(1,Math.abs(_e-Ge))),fill:ge,"data-series":fe.index,"data-point":Pe}),je.px=R(Ie+we+se/2),je.py=R(Math.min(Ge,_e))}continue}const Me=[];let Te=!1;for(const we of fe.points){if(!J(we.y)){Te=!1;continue}let _e;if(h){const je=n.kind==="time"?X(we.x):N(we.x);_e=je===null?NaN:R(o.of(je))}else _e=R(o.centre(we.x));if(Number.isNaN(_e)){Te=!1;continue}const Pe=R(be.of(we.y));Me.push(Te?"L":"M",_e,Pe),Te=!0,we.px=_e,we.py=Pe}ee(E.next("path",`${I}__line ${I}__mark`),{d:Me.length?_(Me):"",stroke:ge,"data-series":fe.index});for(const we of fe.points)we.px!==void 0&&ee(E.next("circle",`${I}__point ${I}__mark`),{cx:we.px,cy:we.py,r:3,fill:ge})}E.finish(),l.labels&&l.labels.show&&D({group:l.groups.labels,series:d,plot:x,options:l.labels,grid:l.grid,size:l.typography&&l.typography.small||l.fontSize});let ce=null;return l.annotations&&l.annotations.length&&(ce=e({group:l.groups.overlay,plot:x,xScale:o,yScale:j,rightScale:a,series:d,annotations:l.annotations,dual:!!a,format:Y(l.grid,{kind:"linear",step:(w.max-w.min)/5}).tick})),{xScale:o,yScale:j,rightScale:a,dual:!!a,series:d,bound:n,annotations:ce}}function $(l){const{group:u,plot:x,scale:n,format:d}=l,S=new te(u);ee(S.next("line",`${I}__axis-right`),{x1:R(x.right),x2:R(x.right),y1:R(x.top),y2:R(x.bottom),stroke:l.colour});for(const p of n.ticks(5)){const w=R(n.of(p)),j=S.next("text",`${I}__tick`);ee(j,{x:R(x.right+6),y:w,"text-anchor":"start","dominant-baseline":"middle",fill:l.colour}),j.textContent=`${d.tick(p)}${l.suffix||""}`}S.finish()}}),Qe("packages/modules/charts/quantile.js",function(s,K){"use strict";Object.defineProperty(s,"normalQuantile",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"studentTQuantile",{enumerable:!0,get:function(){return O}});const xe=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),W=3e-12,v=1e-300;function de(c){if(c<.5)return Math.log(Math.PI/Math.sin(Math.PI*c))-de(1-c);const Y=c-1;let M=.9999999999998099;const k=Y+7.5;for(let F=0;F<xe.length;F++)M+=xe[F]/(Y+F+1);return .5*Math.log(2*Math.PI)+(Y+.5)*Math.log(k)-k+Math.log(M)}function ue(c,Y,M){const k=c+Y,F=c+1,J=c-1;let Z=1,L=1-k*M/F;Math.abs(L)<v&&(L=v),L=1/L;let ne=L;for(let N=1;N<=300;N++){const X=2*N;let oe=N*(Y-N)*M/((J+X)*(c+X));L=1+oe*L,Math.abs(L)<v&&(L=v),Z=1+oe/Z,Math.abs(Z)<v&&(Z=v),L=1/L,ne*=L*Z,oe=-(c+N)*(k+N)*M/((c+X)*(F+X)),L=1+oe*L,Math.abs(L)<v&&(L=v),Z=1+oe/Z,Math.abs(Z)<v&&(Z=v),L=1/L;const ee=L*Z;if(ne*=ee,Math.abs(ee-1)<W)break}return ne}function V(c,Y,M){if(!(c>0)||!(Y>0)||!Number.isFinite(M))return Number.NaN;if(M<=0)return 0;if(M>=1)return 1;const k=Math.exp(de(c+Y)-de(c)-de(Y)+c*Math.log(M)+Y*Math.log(1-M));return M<(c+1)/(c+Y+2)?k*ue(c,Y,M)/c:1-k*ue(Y,c,1-M)/Y}function Q(c){const Y=Math.abs(c),M=2/(2+Y),k=4*M-2,F=[-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 J=0,Z=0,L;for(let N=F.length-1;N>0;N--)L=Z,Z=k*Z-J+F[N],J=L;const ne=M*Math.exp(-Y*Y+.5*(F[0]+k*Z)-J);return c>=0?ne:2-ne}function G(c){if(!(c>0)||!(c<1))return c===0?-1/0:c===1?1/0:Number.NaN;const Y=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],M=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],k=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],F=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],J=.02425;let Z,L,ne;c<J?(Z=Math.sqrt(-2*Math.log(c)),ne=(((((k[0]*Z+k[1])*Z+k[2])*Z+k[3])*Z+k[4])*Z+k[5])/((((F[0]*Z+F[1])*Z+F[2])*Z+F[3])*Z+1)):c<=1-J?(Z=c-.5,L=Z*Z,ne=(((((Y[0]*L+Y[1])*L+Y[2])*L+Y[3])*L+Y[4])*L+Y[5])*Z/(((((M[0]*L+M[1])*L+M[2])*L+M[3])*L+M[4])*L+1)):(Z=Math.sqrt(-2*Math.log(1-c)),ne=-(((((k[0]*Z+k[1])*Z+k[2])*Z+k[3])*Z+k[4])*Z+k[5])/((((F[0]*Z+F[1])*Z+F[2])*Z+F[3])*Z+1));const X=(.5*Q(-ne/Math.SQRT2)-c)*Math.sqrt(2*Math.PI)*Math.exp(ne*ne/2);return ne-X/(1+ne*X/2)}function te(c,Y){if(!(Y>0)||!Number.isFinite(c))return Number.NaN;const M=.5*V(Y/2,.5,Y/(Y+c*c));return c>0?1-M:M}function O(c,Y){if(!(c>0)||!(c<1)||!(Y>0))return Number.NaN;if(Y>1e7)return G(c);let M=-1e4,k=1e4,F=G(c);const J=de(Y/2)+de(.5)-de((Y+1)/2);for(let Z=0;Z<60;Z++){const L=te(F,Y);L<c?M=F:k=F;const ne=Math.exp(-((Y+1)/2)*Math.log(1+F*F/Y)-J)/Math.sqrt(Y),N=ne>0?(L-c)/ne:0;if(Math.abs(N)<1e-12)break;const X=F-N;if(F=X>M&&X<k&&Number.isFinite(X)?X:(M+k)/2,k-M<1e-12)break}return F}}),Qe("packages/modules/charts/trendline.js",function(s,K){"use strict";Object.defineProperty(s,"normaliseTrends",{enumerable:!0,get:function(){return R}}),Object.defineProperty(s,"linearTrend",{enumerable:!0,get:function(){return he}}),Object.defineProperty(s,"movingAverageTrend",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"exponentialTrend",{enumerable:!0,get:function(){return i}}),Object.defineProperty(s,"computeTrend",{enumerable:!0,get:function(){return y}}),Object.defineProperty(s,"trendText",{enumerable:!0,get:function(){return t}}),Object.defineProperty(s,"drawTrendlines",{enumerable:!0,get:function(){return m}});const W=K("packages/modules/charts/frame.js").Pool,v=K("packages/modules/charts/svg.js"),de=v.attrs,ue=v.path,V=v.ribbonPath,Q=v.round,G=v.setText,te=v.SVG_NS,c=K("packages/modules/charts/typography.js").applySize,M=K("packages/modules/charts/styles.js").NS,k=K("packages/modules/charts/scale.js"),F=k.toNumber,J=k.toTime,L=K("packages/modules/charts/quantile.js").studentTQuantile,N=K("packages/modules/charts/format.js").r2Digits,X={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"])},oe=1e-4,ee=1-1e-4;function _(g){const b=String(g||"linear").toLowerCase();return X.linear.has(b)?"linear":X.movingAverage.has(b)?"movingAverage":X.exponential.has(b)?"exponential":null}function R(g){if(!g)return[];const b=Array.isArray(g)?g:[g],$=[];for(const l of b){if(l===!0){$.push({method:"linear"});continue}if(typeof l=="string"){const u=_(l);u&&$.push({method:u});continue}if(l&&typeof l=="object"){const u=_(l.method);u&&$.push({...l,method:u})}}return $}function ie(g,b){if(g.kind==="band")return g.centre(b);const $=g.kind==="time"?J(b):F(b);return $===null?NaN:g.of($)}function I(g){const b=[];for(const $ of g.points){const l=Number($.y);b.push({value:Number.isFinite(l)?l:null,rawX:$.x})}return b}function P(g,b){const $=[];for(const l of g.points){const u=b.kind==="time"?J(l.x):F(l.x),x=Number(l.y);u===null||!Number.isFinite(u)||!Number.isFinite(x)||$.push({x:u,y:x})}return $.sort((l,u)=>l.x-u.x),$}function he(g,b,$={}){const l=g.length;if(l<2)return null;let u=0,x=0;for(const q of g)u+=q.x,x+=q.y;u/=l,x/=l;let n=0,d=0,S=0;for(const q of g){const se=q.x-u,C=q.y-x;n+=se*se,d+=se*C,S+=C*C}if(n===0)return null;const p=d/n,w=x-p*u,j=S===0?1:Math.max(0,Math.min(1,d*d/(n*S))),f=g[0].x,a=g[l-1].x,o=q=>({x:q,y:w+p*q}),h=[o(f),o(a)],B=[];let E=null;const U=Math.max(0,Math.floor(Number(b)||0));if(U>0&&a>f){const q=(a-f)/(l-1);if(q>0&&(B.push(o(a),o(a+U*q)),l>2)){const se=Number.isFinite($.confidence)&&$.confidence>0&&$.confidence<1?Number($.confidence):.95,C=1-(1-se)/2,ce=Math.max(0,S-p*d),fe=Math.sqrt(ce/(l-2)),me=L(C,l-2),be=[];for(let ge=0;ge<=U;ge++){const Me=a+ge*q,Te=w+p*Me,we=1/l+(Me-u)**2/n,_e=fe*Math.sqrt(1+we),Pe=fe*Math.sqrt(we);be.push({x:Me,mean:Te,lower:Te-me*_e,upper:Te+me*_e,lowerMean:Te-me*Pe,upperMean:Te+me*Pe})}E={confidence:se,points:be}}}return{fit:h,forecast:B,band:E,stats:{method:"linear",slope:p,intercept:w,r2:j,n:l,forecast:B.length?U:0,confidence:E?E.confidence:null}}}function r(g,b){const $=Math.max(1,Math.floor(Number(b)||3)),l=[];let u=0;const x=[];for(const n of g)Number.isFinite(n.value)&&(l.push(n.value),u+=n.value,l.length>$&&(u-=l.shift())),l.length&&x.push({x:n.rawX,y:u/l.length});return x.length<2?null:{fit:x,stats:{method:"movingAverage",window:$}}}function D(g,b){const $=g.length,l=new Array($).fill(null);let u=null,x=0;for(let n=0;n<$;n++){const d=g[n];if(!Number.isFinite(d)){u!==null&&(l[n]=u);continue}if(u===null){u=d,l[n]=d;continue}x+=(d-u)**2,u=b*d+(1-b)*u,l[n]=u}return{smoothed:l,sse:x}}function T(g,b,$){const l=g.length,u=new Array(l).fill(null);let x=null,n=null,d=0;for(let S=0;S<l;S++){const p=g[S];if(!Number.isFinite(p)){x!==null&&(x+=n,u[S]=x);continue}if(x===null){x=p,u[S]=p;continue}if(n===null){n=p-x;const f=x+n;d+=(p-f)**2;const a=x;x=b*p+(1-b)*(a+n),n=$*(x-a)+(1-$)*n,u[S]=x;continue}const w=x+n;d+=(p-w)**2;const j=x;x=b*p+(1-b)*(j+n),n=$*(x-j)+(1-$)*n,u[S]=x}return{smoothed:u,sse:d}}function e(g,b,$,l=80){const u=(Math.sqrt(5)-1)/2;let x=b,n=$,d=n-u*(n-x),S=x+u*(n-x),p=g(d),w=g(S);for(let j=0;j<l;j++)p<w?(n=S,S=d,w=p,d=n-u*(n-x),p=g(d)):(x=d,d=S,p=w,S=x+u*(n-x),w=g(S));return(x+n)/2}function i(g,b){const $=String(b.kind||b.model||"").toLowerCase()==="holt",l=g.map(w=>Number.isFinite(w.value)?w.value:null);if(l.filter(w=>w!==null).length<($?2:1))return null;const x=w=>Math.min(ee,Math.max(oe,w));let n=Number.isFinite(b.alpha)?x(Number(b.alpha)):null,d=$&&Number.isFinite(b.beta)?x(Number(b.beta)):null;if($){if(n===null||d===null){let w=n===null?.5:n,j=d===null?.5:d;for(let f=0;f<6;f++)n===null&&(w=e(a=>T(l,a,j).sse,oe,ee)),d===null&&(j=e(a=>T(l,w,a).sse,oe,ee));n=n===null?w:n,d=d===null?j:d}}else n===null&&(n=e(w=>D(l,w).sse,oe,ee));const S=$?T(l,n,d):D(l,n),p=[];for(let w=0;w<g.length;w++){const j=S.smoothed[w];j===null||!Number.isFinite(j)||p.push({x:g[w].rawX,y:j})}return p.length<2?null:{fit:p,stats:{method:"exponential",kind:$?"holt":"ses",alpha:n,beta:$?d:null}}}function y(g,b,$){if(b.method==="linear"){const u=P(g,$);return he(u,b.forecast,{confidence:b.confidence})}const l=I(g);return b.method==="movingAverage"?r(l,b.window||b.period):i(l,b)}function t(g,b,$,l,u,x){const n=b?` for ${b}`:"";if(g.method==="linear"){const w=Number.isFinite(g.r2)?`, R² ${g.r2.toFixed(2)}`:"";let j=`Trend (linear)${n}: slope ${$(g.slope)}${w}`;if(g.forecast>0&&l&&l.length){const f=l[l.length-1];if(j+=`; forecast ${g.forecast} step${g.forecast===1?"":"s"} ahead to ${$(f.y)}`,u&&u.points.length){const a=u.points[u.points.length-1],o=x==="confidence"||x==="mean",h=o?a.lowerMean:a.lower,B=o?a.upperMean:a.upper,E=o?"confidence":"prediction",U=Math.round(u.confidence*100);j+=`; ${U}% ${E} band ${$(h)} to ${$(B)} at the horizon`}}return j}if(g.method==="movingAverage")return`Trend (moving average, window ${g.window})${n}`;const d=g.kind==="holt"?"Holt":"single",S=Number.isFinite(g.alpha)?`, α ${g.alpha.toFixed(2)}`:"",p=Number.isFinite(g.beta)?`, β ${g.beta.toFixed(2)}`:"";return`Trend (exponential, ${d})${n}${S}${p}`}function m(g){const b=R(g.trend);if(!b.length)return[];const $=g.group.ownerDocument;let l=null;for(const n of g.group.childNodes||[])if(n&&String(n.getAttribute&&n.getAttribute("class"))===`${M}__trends`){l=n;break}l||(l=$.createElementNS(te,"g"),l.setAttribute("class",`${M}__trends`),g.group.appendChild(l)),g.clip?l.setAttribute("clip-path",`url(#${g.clip})`):l.removeAttribute("clip-path");const u=new W(l),x=[];for(const n of b)for(const d of g.series){const S=d.axis==="right"&&g.rightScale?g.rightScale:g.yScale,p=y(d,n,g.xScale);if(!p)continue;const w=g.scheme.series(d.index),j=[];for(const o of p.fit){const h=ie(g.xScale,o.x),B=S.of(o.y);!Number.isFinite(h)||!Number.isFinite(B)||j.push(j.length?"L":"M",Q(h),Q(B))}if(j.length<4)continue;if(de(u.next("path",`${M}__trend`),{d:ue(j),fill:"none",stroke:w,"data-series":d.index}),n.band!==!1&&p.band&&p.band.points.length>=2){const o=n.band==="confidence"||n.band==="mean",h=[];for(const E of p.band.points){const U=ie(g.xScale,E.x),q=o?E.lowerMean:E.lower,se=o?E.upperMean:E.upper,C=S.of(q),ce=S.of(se);!Number.isFinite(U)||!Number.isFinite(C)||!Number.isFinite(ce)||h.push({x:Q(U),lower:Q(C),upper:Q(ce)})}const B=V(h);B&&de(u.next("path",`${M}__trend-band`),{d:B,fill:w,"fill-opacity":.15,stroke:"none","data-series":d.index})}const a=p.forecast||[];if(a.length>=2){const o=[];for(const h of a){const B=ie(g.xScale,h.x),E=S.of(h.y);!Number.isFinite(B)||!Number.isFinite(E)||o.push(o.length?"L":"M",Q(B),Q(E))}o.length>=4&&de(u.next("path",`${M}__trend-forecast`),{d:ue(o),fill:"none",stroke:w,"data-series":d.index})}if(n.label!==!1&&p.stats.method==="linear"&&Number.isFinite(p.stats.r2)){const o=p.fit[p.fit.length-1],h=u.next("text",`${M}__trend-label`);c(h,g.size),de(h,{x:Q(ie(g.xScale,o.x)),y:Q(S.of(o.y))-4,"text-anchor":"end",fill:w}),G(h,g.grid.messages.t("chart.r2",{value:N(g.grid,p.stats.r2)}))}x.push({text:t(p.stats,d.label,g.format,a,n.band===!1?null:p.band,n.band)})}return u.finish(),x.filter(n=>n.text)}}),Qe("packages/modules/charts/rulecolour.js",function(s,K){"use strict";Object.defineProperty(s,"colourOf",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"ruleColour",{enumerable:!0,get:function(){return v}}),Object.defineProperty(s,"ruleLegend",{enumerable:!0,get:function(){return de}});const xe="*";function W(ue){if(!ue||typeof ue!="object")return null;for(const V of["background","backgroundColor","color"]){const Q=ue[V];if(typeof Q=="string"&&Q.trim())return Q.trim()}return null}function v(ue){const{grid:V,col:Q,value:G}=ue;if(!V||!Q||!V.formatting||typeof V.formatting.styleFor!="function")return null;try{return W(V.formatting.styleFor(Q,G))}catch{return null}}function de(ue){const{grid:V,col:Q}=ue,G=new Set([...ue.colours||[]].filter(Boolean));if(!G.size||!V||!V.formatting||typeof V.formatting.list!="function")return[];let te;try{te=[...V.formatting.list(xe)||[],...Q?V.formatting.list(Q)||[]:[]]}catch{return[]}const O=[],c=new Set;for(const Y of te){if(!Y||Y.enabled===!1)continue;const M=W(Y.style);!M||!G.has(M)||c.has(M)||(c.add(M),O.push({key:Y.id||`rule:${O.length}`,label:Y.label||Y.id||M,colour:M,index:O.length}))}return O}}),Qe("packages/modules/charts/cartesian.js",function(s,K){"use strict";Object.defineProperty(s,"CARTESIAN",{enumerable:!0,get:function(){return U}}),Object.defineProperty(s,"axisWindowSpan",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(s,"rollingDomain",{enumerable:!0,get:function(){return me}}),Object.defineProperty(s,"WINDOW_LEAD",{enumerable:!0,get:function(){return be}}),Object.defineProperty(s,"aheadOfWindow",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(s,"staleWindow",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(s,"windowedBound",{enumerable:!0,get:function(){return we}}),Object.defineProperty(s,"drawFits",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(s,"drawConfidenceBand",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(s,"drawBoundErrorBars",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(s,"drawForest",{enumerable:!0,get:function(){return jt}}),Object.defineProperty(s,"drawReferenceLines",{enumerable:!0,get:function(){return At}}),Object.defineProperty(s,"drawCartesian",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(s,"HIT_TOLERANCE",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(s,"nearestDrawnPoint",{enumerable:!0,get:function(){return It}}),Object.defineProperty(s,"nearestCategory",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(s,"categoryKeyAt",{enumerable:!0,get:function(){return ot}});const xe=K("packages/modules/charts/axis.js"),W=xe.drawAxisLines,v=xe.drawAxisTitle,de=xe.drawBandLabels,ue=xe.drawCategoryAxis,V=xe.drawContinuousAxis,Q=xe.drawMeasureAxis,G=xe.overhangFor,te=xe.setPlotClip,O=K("packages/modules/charts/frame.js"),c=O.Pool,Y=O.shouldRotate,M=K("packages/modules/charts/format.js"),k=M.formatters,F=M.r2Digits,J=K("packages/modules/charts/scale.js"),Z=J.bandScale,L=J.extent,ne=J.isNumber,N=J.key,X=J.linearScale,oe=J.measureDomain,ee=J.timeScale,_=J.toNumber,R=J.toTime,ie=K("packages/modules/charts/svg.js"),I=ie.attrs,P=ie.path,he=ie.ribbonPath,r=ie.round,D=ie.setText,T=ie.SVG_NS,i=K("packages/modules/charts/styles.js").NS,t=K("packages/modules/charts/labels.js").drawDataLabels,g=K("packages/modules/charts/dense.js").downsample,$=K("packages/modules/charts/scheme.js").resolveScheme,u=K("packages/modules/charts/typography.js").applySize,n=K("packages/modules/charts/combo.js").drawRightAxis,d=K("packages/modules/charts/annotations.js"),S=d.drawAnnotations,p=d.overlayLayer,j=K("packages/modules/charts/trendline.js").drawTrendlines,f=K("packages/modules/charts/rulecolour.js"),a=f.ruleColour,o=f.ruleLegend,B=K("packages/core/src/internal/util.js").warnOnce,E=3.5,U=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"}});function q(A){const ke=[];for(let le=0;le<A.length;le++){const Ae=A[le];if(le===0){ke.push("M",Ae.x,Ae.y);continue}ke.push("L",Ae.x,A[le-1].y),ke.push("L",Ae.x,Ae.y)}return ke}function se(A,ke,le){if(le)return[0,100];if(!ke){const ye=[];for(const Oe of A)for(const Ne of Oe.points)ye.push(Ne.y);return ye}const Ae=[],pe=[],Se=A[0]?A[0].points.length:0;for(let ye=0;ye<Se;ye++){let Oe=0,Ne=0;for(const $e of A){const Ce=$e.points[ye]?$e.points[ye].y:null;ne(Ce)&&(Ce>=0?Oe+=Ce:Ne+=Ce)}Ae.push(Oe),pe.push(Ne)}return[...Ae,...pe]}function C(A){const ke=[0];if(!A)return ke;let le=0;for(const Ae of A.points)ne(Ae.y)&&(le+=Ae.y,ke.push(le));return ke}function ce(A,ke){const le=new Float64Array(A),Ae=new Float64Array(A);return{take(pe,Se){const ye=ke?ke[pe]:0,Oe=ke?ye?Se/ye*100:0:Se;if(Oe>=0){const $e=le[pe];return le[pe]+=Oe,[$e,le[pe]]}const Ne=Ae[pe];return Ae[pe]+=Oe,[Ne,Ae[pe]]}}}function fe(A){const ke=A&&A.window;if(!ke||typeof ke!="object")return 0;const le=Number(ke.span);return!Number.isFinite(le)||le<=0?0:ke.kind!=="time"?(B("chart.axis.window.kind",`axis window kind "${ke.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):le}function me(A,ke,le){const Ae=le+A*be;let pe=le;for(const Se of ke)Number.isFinite(Se)&&Se>pe&&Se<=Ae&&(pe=Se);return{min:pe-A,max:pe}}const be=.25;function ge(A,ke,le){const Ae=fe(ke);if(!Ae||!A||!Array.isArray(A.categories))return null;const pe=U[le];if(!pe||pe.horizontal||le==="bar"||A.kind==="category")return null;const Se=A.categories.map(ye=>A.kind==="time"?R(ye):_(ye));return{span:Ae,values:Se}}function Me(A,ke,le,Ae){const pe=ge(A,ke,le);if(!pe)return null;const Se=pe.span*be;let ye=0,Oe=0;for(const Ne of pe.values)Ne===null||!Number.isFinite(Ne)||Ne-Ae<=Se||(ye+=1,Ne-Ae>Oe&&(Oe=Ne-Ae));return ye?{span:pe.span,limit:Se,count:ye,lead:Oe}:null}function Te(A,ke,le,Ae){const pe=ge(A,ke,le);if(!pe)return null;const{span:Se}=pe,ye=pe.values.filter(Ce=>Ce!==null&&Number.isFinite(Ce));if(!ye.length)return null;const{min:Oe,max:Ne}=me(Se,ye,Ae);let $e=-1/0;for(const Ce of ye){if(Ce>=Oe&&Ce<=Ne)return null;Ce<Oe&&Ce>$e&&($e=Ce)}return $e===-1/0?{span:Se,newest:null,age:null,points:ye.length}:{span:Se,newest:$e,age:Ae-$e,points:ye.length}}function we(A,ke,le,Ae){const pe=ge(A,ke,le);if(!pe)return A;const{span:Se,values:ye}=pe,Oe=ye.filter(Fe=>Fe!==null&&Number.isFinite(Fe));if(!Oe.length)return A;const{min:Ne,max:$e}=me(Se,Oe,Ae),Ce=[];for(let Fe=0;Fe<ye.length;Fe++){const Ye=ye[Fe];(Ye===null||!Number.isFinite(Ye)||Ye>=Ne&&Ye<=$e)&&Ce.push(Fe)}return Ce.length===ye.length?A:{...A,categories:Ce.map(Fe=>A.categories[Fe]),labels:Array.isArray(A.labels)?Ce.map(Fe=>A.labels[Fe]):A.labels,series:(A.series||[]).map(Fe=>({...Fe,points:Array.isArray(Fe.points)?Ce.map(Ye=>Fe.points[Ye]).filter(Ye=>Ye!==void 0):Fe.points})),windowed:ye.length-Ce.length}}function _e(A,ke,le,Ae){const pe=[ke.left,ke.right],Se=fe(Ae);if(A.kind==="category"||le==="bar")return Se&&B("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."),Z(A.categories,pe,le==="bar"?.2:.4);const ye=A.kind==="time"?A.categories.map(R):A.categories.map(_);if(A.kind==="time"&&!Se){const Ne=L(ye);if(Ne&&Ne.min===Ne.max)return ee({min:Ne.min-3e4,max:Ne.max+3e4},pe)}const Oe=Se?me(Se,ye,Date.now()):oe(ye,{zero:!1,nice:A.kind!=="time"});return A.kind==="time"?ee(Oe,pe):X(Oe,pe)}function Pe(A,ke){if(A.kind==="band")return A.centre(ke.x);const le=A.kind==="time"?R(ke.x):_(ke.x);return le===null?NaN:A.of(le)}function je(A){const{series:ke,xScale:le,yScale:Ae,baseline:pe,fill:Se,colour:ye,stack:Oe}=A,Ne=[],$e=[];let Ce=!1;const Fe=[];for(let We=0;We<ke.points.length;We++){const Je=ke.points[We],ft=r(Pe(le,Je));if(!ne(Je.y)||Number.isNaN(ft)){Ce=!1;continue}Fe[We]=!0;const lt=Je.y,gt=Oe?Oe.take(We,lt):null,rt=r(Ae.of(gt?gt[1]:lt)),it=r(Ae.of(gt?gt[0]:pe));A.step&&Ce&&Ne.push("L",ft,A.previous),Ne.push(Ce?"L":"M",ft,rt),A.previous=rt,Se&&$e.push(Ce?"L":"M",ft,rt),Se&&!Ce&&$e.push("M",ft,rt),Ce=!0,Je.px=ft,Je.py=rt,Je.pbase=it}if(I(A.pool.next("path",`${i}__line ${i}__mark`),{d:Ne.length?P(Ne):"",stroke:ye,"data-series":A.index}),!Se){Ie({...A,placed:Fe});return}const Ye=[];let De=[];const et=()=>{if(De.length<2){De=[];return}Ye.push("M",De[0].x,De[0].base);for(const We of De)Ye.push("L",We.x,We.y);for(let We=De.length-1;We>=0;We--)Ye.push("L",De[We].x,De[We].base);Ye.push("Z"),De=[]};for(const We of ke.points){if(!ne(We.y)||We.px===void 0){et();continue}De.push({x:We.px,y:We.py,base:We.pbase})}et(),I(A.pool.next("path",`${i}__area ${i}__mark`),{d:Ye.length?P(Ye):"",fill:ye,"data-series":A.index}),Ie({...A,placed:Fe})}function Ie(A){const{series:ke,placed:le}=A;for(let Ae=0;Ae<ke.points.length;Ae++){if(!le[Ae]||le[Ae-1]||le[Ae+1])continue;const pe=ke.points[Ae];I(A.pool.next("circle",`${i}__point ${i}__mark`),{cx:pe.px,cy:pe.py,r:E,fill:A.colour,"data-series":A.index,"data-point":Ae})}}function Ge(A,ke){const le=A&&A.range;if(!Array.isArray(le)||le.length!==2)return ke;const[Ae,pe]=le;return!Number.isFinite(Ae)||!Number.isFinite(pe)||!Number.isFinite(ke)?ke:Math.min(Math.max(Ae,pe),Math.max(Math.min(Ae,pe),ke))}function Ve(A){const{series:ke,xScale:le,yScale:Ae,baseline:pe,colour:Se,stack:ye,slot:Oe}=A;for(let Ne=0;Ne<ke.points.length;Ne++){const $e=ke.points[Ne];if(!ne($e.y))continue;const Ce=le.of($e.x);if(Number.isNaN(Ce))continue;const Fe=$e.y,Ye=A.pointColour&&A.pointColour($e)||Se,De=ye?ye.take(Ne,Fe):[pe,Fe],et=Ge(Ae,Ae.of(De[1])),We=Ge(Ae,Ae.of(De[0])),Je=A.pool.next("rect",`${i}__bar ${i}__mark`);I(Je,{x:r(Ce+Oe.offset),y:r(Math.min(et,We)),width:r(Math.max(0,Oe.width)),height:r(Math.max(1,Math.abs(We-et))),fill:Ye,"data-series":A.index,"data-point":Ne}),$e.px=r(Ce+Oe.offset+Oe.width/2),$e.py=r(Math.min(et,We)),$e.pbase=r(Math.max(et,We))}}function at(A){const{series:ke,xScale:le,yScale:Ae}=A;let pe=0;for(let Se=0;Se<ke.points.length;Se++){const ye=ke.points[Se];if(!ne(ye.y))continue;const Oe=ye.y,Ne=Se===ke.points.length-1,$e=A.total&&Ne?0:pe,Ce=(A.total&&Ne,pe+Oe);A.total,pe+=Oe;const Fe=Ge(Ae,Ae.of(Math.max($e,Ce))),Ye=Ge(Ae,Ae.of(Math.min($e,Ce))),De=A.pool.next("rect",`${i}__bar ${i}__mark`);I(De,{x:r(le.of(ye.x)),y:r(Fe),width:r(le.bandwidth),height:r(Math.max(1,Ye-Fe)),fill:Oe>=0?A.positive:A.negative,"data-series":A.index,"data-point":Se}),ye.px=r(le.of(ye.x)+le.bandwidth/2),ye.py=r(Fe)}}function mt(A){const{series:ke,valueScale:le,baseline:Ae,colour:pe,stack:Se,slot:ye}=A;for(let Oe=0;Oe<ke.points.length;Oe++){const Ne=ke.points[Oe];if(!ne(Ne.y))continue;const $e=A.bandScale.of(Ne.x);if(Number.isNaN($e))continue;const Ce=Ne.y,Fe=A.pointColour&&A.pointColour(Ne)||pe,Ye=Se?Se.take(Oe,Ce):[Ae,Ce],De=Ge(le,le.of(Ye[0])),et=Ge(le,le.of(Ye[1]));I(A.pool.next("rect",`${i}__bar ${i}__mark`),{x:r(Math.min(De,et)),y:r($e+ye.offset),width:r(Math.max(1,Math.abs(et-De))),height:r(Math.max(0,ye.width)),fill:Fe,"data-series":A.index,"data-point":Oe}),Ne.px=r(et),Ne.py=r($e+ye.offset+ye.width/2),Ne.pbase=r(De)}}function ut(A){const ke=A.group.ownerDocument;let le=null;for(const Se of A.group.childNodes||[])if(Se&&String(Se.getAttribute&&Se.getAttribute("class"))===`${i}__fits`){le=Se;break}le||(le=ke.createElementNS(T,"g"),le.setAttribute("class",`${i}__fits`),A.group.appendChild(le));const Ae=new c(le),pe=[];for(const Se of A.series){let ye=0,Oe=0,Ne=0;for(const rt of Se.points){const it=Number(rt.x),qe=Number(rt.y);!Number.isFinite(it)||!Number.isFinite(qe)||(ye++,Oe+=it,Ne+=qe)}if(ye<2)continue;const $e=Oe/ye,Ce=Ne/ye;let Fe=0,Ye=0,De=0,et=1/0,We=-1/0;for(const rt of Se.points){const it=Number(rt.x),qe=Number(rt.y);if(!Number.isFinite(it)||!Number.isFinite(qe))continue;const bt=it-$e,Pt=qe-Ce;Fe+=bt*bt,Ye+=bt*Pt,De+=Pt*Pt,it<et&&(et=it),it>We&&(We=it)}if(Fe===0)continue;const Je=Ye/Fe,ft=Ce-Je*$e,lt=De===0?1:Math.max(0,Math.min(1,Ye*Ye/(Fe*De))),gt=A.scheme.series(Se.index);if(I(Ae.next("path",`${i}__fit`),{d:P(["M",r(A.xScale.of(et)),r(A.yScale.of(ft+Je*et)),"L",r(A.xScale.of(We)),r(A.yScale.of(ft+Je*We))]),fill:"none",stroke:gt,"data-series":Se.index}),A.showR2){const rt=Ae.next("text",`${i}__fit-label`);u(rt,A.size),I(rt,{x:r(A.xScale.of(We)),y:r(A.yScale.of(ft+Je*We))-4,"text-anchor":"end",fill:gt}),D(rt,A.grid.messages.t("chart.r2",{value:F(A.grid,lt)}))}pe.push({key:Se.key,slope:Je,intercept:ft,r2:lt,n:ye})}return Ae.finish(),pe}function wt(A){const ke=A.group.ownerDocument;let le=null;for(const $e of A.group.childNodes||[])if($e&&String($e.getAttribute&&$e.getAttribute("class"))===`${i}__band`){le=$e;break}le||(le=ke.createElementNS(T,"g"),le.setAttribute("class",`${i}__band`),A.group.firstChild?A.group.insertBefore(le,A.group.firstChild):A.group.appendChild(le));const Ae=new c(le),pe=A.band&&Array.isArray(A.band.points)?A.band.points:[],Se=Number.isFinite(A.index)?Number(A.index):0,ye=A.scheme.series(Se),Oe=Number.isFinite(A.opacity)?Number(A.opacity):.15,Ne=[];for(const $e of pe){const Ce=Number($e.x),Fe=Number($e.lower),Ye=Number($e.upper);if(!Number.isFinite(Ce)||!Number.isFinite(Fe)||!Number.isFinite(Ye))continue;const De=Number($e.yhat);Ne.push({x:r(A.xScale.of(Ce)),lower:r(A.yScale.of(Fe)),upper:r(A.yScale.of(Ye)),yhat:Number.isFinite(De)?r(A.yScale.of(De)):null})}if(Ne.length>=2&&(I(Ae.next("path",`${i}__band-fill`),{d:he(Ne),fill:ye,"fill-opacity":Oe,stroke:"none","data-series":Se}),A.line!==!1)){const $e=[];let Ce=!1;for(const Fe of Ne){if(Fe.yhat===null){Ce=!1;continue}$e.push(Ce?"L":"M",Fe.x,Fe.yhat),Ce=!0}I(Ae.next("path",`${i}__band-line`),{d:$e.length?P($e):"",fill:"none",stroke:ye,"data-series":Se})}return Ae.finish(),{points:Ne.length,confidence:A.band&&Number.isFinite(A.band.confidence)?Number(A.band.confidence):null}}function kt(A){const ke=A.group.ownerDocument;let le=null;for(const Ne of A.group.childNodes||[])if(Ne&&String(Ne.getAttribute&&Ne.getAttribute("class"))===`${i}__whiskers`){le=Ne;break}le||(le=ke.createElementNS(T,"g"),le.setAttribute("class",`${i}__whiskers`),A.group.appendChild(le));const Ae=new c(le),pe=Number.isFinite(A.cap)?Number(A.cap):4,Se=A.colour||"currentColor",ye=A.orient!=="v";let Oe=0;for(const Ne of A.points||[]){const $e=Number(Ne.main),Ce=Number(Ne.lo),Fe=Number(Ne.hi);if(!Number.isFinite($e)||!Number.isFinite(Ce)||!Number.isFinite(Fe))continue;const Ye=ye?["M",Ce,$e,"L",Fe,$e,"M",Ce,$e-pe,"L",Ce,$e+pe,"M",Fe,$e-pe,"L",Fe,$e+pe]:["M",$e,Ce,"L",$e,Fe,"M",$e-pe,Ce,"L",$e+pe,Ce,"M",$e-pe,Fe,"L",$e+pe,Fe];I(Ae.next("path",`${i}__whisker`),{d:P(Ye),stroke:Se,fill:"none"}),Oe++}return Ae.finish(),Oe}function jt(A){const ke=A.scheme||$(),le=A.typography||{small:A.fontSize||11,axisTitle:11},{plot:Ae,bound:pe}=A,Se=pe.series[0]&&pe.series[0].points||[],ye=Se.map(De=>De.label),Oe=ke.series(0),Ne=Z(ye,[Ae.top,Ae.bottom],.4),$e=[0];for(const De of Se)for(const et of[De.x,De.lower,De.upper])Number.isFinite(et)&&$e.push(et);const Ce=X(oe($e,{zero:!1}),[Ae.left,Ae.right]);kt({group:A.groups.overlay,orient:"h",colour:Oe,points:Se.map(De=>({main:r(Ne.centre(De.label)),lo:r(Ce.of(De.lower)),hi:r(Ce.of(De.upper))}))});const Fe=new c(A.groups.marks);let Ye=0;for(const De of Se)Number.isFinite(De.x)&&(I(Fe.next("circle",`${i}__point ${i}__mark`),{cx:r(Ce.of(De.x)),cy:r(Ne.centre(De.label)),r:E,fill:Oe}),Ye++);return Fe.finish(),At({group:A.groups.rules,plot:Ae,scale:Ce,lines:[{value:0}]}),V({group:A.groups.axis,plot:Ae,scale:Ce,format:k(A.grid,{kind:"linear",step:(Ce.domain.max-Ce.domain.min)/5}),config:{},grid:A.grid,size:le.small}),de({group:A.groups.labels,plot:Ae,scale:Ne,labels:ye,fontSize:le.small,config:{}}),{series:[],marks:Ye}}function At(A){const ke=new c(p(A.group,`${i}__reflines`));for(const le of A.lines||[]){if(!ne(le.value))continue;const Ae=r(A.scale.of(le.value));if(I(ke.next("path",`${i}__reference`),{d:P(["M",r(A.plot.left),Ae,"L",r(A.plot.right),Ae]),stroke:le.colour||"currentColor","stroke-dasharray":"4 3",fill:"none"}),!le.label)continue;const pe=ke.next("text",`${i}__reference-label`);I(pe,{x:r(A.plot.right-4),y:Ae-4,"text-anchor":"end"}),D(pe,le.label)}ke.finish()}function Ot(A){const{series:ke,xScale:le,yScale:Ae,colour:pe}=A,Se=A.size||null;for(let ye=0;ye<ke.points.length;ye++){const Oe=ke.points[ye];if(!ne(Oe.y))continue;const Ne=r(Pe(le,Oe));if(Number.isNaN(Ne))continue;const $e=r(Ae.of(Oe.y));I(A.pool.next("circle",`${i}__point ${i}__mark`),{cx:Ne,cy:$e,r:Se&&ne(Oe.size)?r(Se.of(Oe.size)):E,fill:pe,"fill-opacity":Se?.7:1,"data-series":A.index,"data-point":ye}),Oe.px=Ne,Oe.py=$e}}function Ut(A){const{group:ke,series:le,xScale:Ae,yScale:pe,options:Se}=A,ye=A.grid&&A.grid.statistics,Oe=ye&&typeof ye.intervalOf=="function"?(We,Je)=>ye.intervalOf(We,Je):null,Ne=new c(p(ke,`${i}__errorbars`)),$e=Number.isFinite(Number(Se.confidence))?Number(Se.confidence):.95,Ce=4;let Fe=0,Ye=0,De=0,et=0;for(const We of le)for(const Je of We.points){if(Je.y===null||Je.y===void 0)continue;Ye++;const ft=Array.isArray(Je.values)&&Je.values.length===1;ft&&De++;let lt=null,gt=null;if(Se.of!==void 0&&Number.isFinite(Number(Je[Se.of]))){const bt=Math.abs(Number(Je[Se.of]));lt=Je.y-bt,gt=Je.y+bt}else if(Array.isArray(Je.values)&&Je.values.length>1&&Oe){const bt=Oe(Je.values,$e);bt&&(lt=bt.lower,gt=bt.upper)}if(lt===null||!Number.isFinite(lt)||!Number.isFinite(gt)){ft&&et++;continue}const rt=r(Ae.of(Je.xKey!==void 0?Je.xKey:Je.x)+(Ae.bandwidth?Ae.bandwidth/2:0)),it=r(pe.of(gt)),qe=r(pe.of(lt));I(Ne.next("path",`${i}__error-bar ${i}__mark`),{d:P(["M",rt-Ce,it,"L",rt+Ce,it,"M",rt,it,"L",rt,qe,"M",rt-Ce,qe,"L",rt+Ce,qe]),fill:"none",stroke:"currentColor","data-lower":lt,"data-upper":gt}),Fe++}return Ne.finish(),{drawn:Fe,marks:Ye,single:De,singleSkipped:et}}function Lt(A){const ke=A.scheme||$(),le=A.axis||{x:{},y:{},y2:{}},Ae=A.typography||{small:A.fontSize||11,axisTitle:11},{bound:pe,plot:Se,type:ye}=A,Oe=U[ye]||U.line,Ne=pe.series.filter(Xe=>!A.hidden.has(Xe.key)),$e=!!Oe.horizontal,Ce=(ye==="bar"||ye==="horizontalBar")&&A.byRuleColour&&Ne.length===1&&pe.measure&&pe.measure.col||null,Fe=Ce?new Set:null,Ye=Ce?Xe=>{const st=a({grid:A.grid,col:Ce,value:Xe.y});return st&&Fe.add(st),st}:null,De=!$e&&ye!=="waterfall"?Ne.filter(Xe=>Xe.axis==="right"):[],et=De.length?Ne.filter(Xe=>Xe.axis!=="right"):Ne,We=De.length>0,Je=(ye==="bar"||ye==="area"||ye==="horizontalBar")&&!We,ft=A.stack==="percent"&&Je&&et.length>1,lt=(ft||!!A.stack)&&et.length>1&&Je,gt=ye==="waterfall"?C(Ne[0]):se(et,lt,ft),rt=A.domain||oe(gt,{zero:Oe.zero,min:le.y.min,max:le.y.max}),it=$e?X(rt,[Se.left,Se.right]):X(rt,[Se.bottom,Se.top]),qe=$e?Z(pe.categories,[Se.top,Se.bottom],.2):_e(pe,Se,ye,le.x),bt=rt.min<=0&&rt.max>=0?0:rt.min,Pt=De.some(Xe=>(Xe.mark||(ye==="bar"?"bar":ye))==="bar"),St=We?oe(se(De,!1,!1),{zero:Pt,min:le.y2.min,max:le.y2.max}):null,vt=St?X(St,[Se.bottom,Se.top]):null,Yt=k(A.grid,{kind:"linear",step:(rt.max-rt.min)/5}),Dt=A.axes!==!1;if(Dt&&Q({gridGroup:A.groups.grid,axisGroup:A.groups.axis,plot:Se,scale:it,format:Yt,horizontal:$e,config:le.y,grid:A.grid,size:Ae.small}),Dt&&($e?de({group:A.groups.overlay,plot:Se,scale:qe,labels:pe.labels,fontSize:Ae.small,config:le.x}):qe.kind==="band"?ue({group:A.groups.overlay,plot:Se,scale:qe,labels:pe.labels,fontSize:Ae.small,rotated:Y(pe.labels,qe.step,Ae.small,le.x.every),config:le.x}):V({group:A.groups.overlay,plot:Se,scale:qe,format:k(A.grid,{kind:pe.kind,span:qe.domain.max-qe.domain.min,step:(qe.domain.max-qe.domain.min)/5}),config:le.x,grid:A.grid,size:Ae.small})),Dt&&(W({group:A.groups.rules,plot:Se}),v({group:A.groups.axis,plot:Se,text:le.y.title,side:$e?"bottom":"left",size:Ae.axisTitle}),v({group:A.groups.axis,plot:Se,text:le.x.title,side:$e?"left":"bottom",size:Ae.axisTitle})),Dt&&vt){n({group:A.groups.axis,plot:Se,scale:vt,colour:ke.series(De[0].index),format:k(A.grid,{kind:"linear",step:(St.max-St.min)/5})});const Xe=le.y2.title||(De.length===1?De[0].label:"");v({group:A.groups.axis,plot:Se,text:Xe,side:"right",size:Ae.axisTitle}),!le.y.title&&et.length===1&&et[0].label&&v({group:A.groups.axis,plot:Se,text:et[0].label,side:"left",size:Ae.axisTitle})}const Qt=Number.isFinite(A.downsampleTo)?Number(A.downsampleTo):Math.max(2,Math.round(Se.width));let Gt=!1;if(Oe.marks==="path"||ye==="scatter"||ye==="bubble"){for(const Xe of Ne)if(Xe.kept=null,Xe.points.length>Qt*1.5){const st=Xe.points.map((yt,Mt)=>({x:Mt,y:yt.y,point:yt})),dt=g(st,Qt);Xe.points=dt.map(yt=>yt.point),Xe.kept=dt.map(yt=>yt.x),Gt=!0}}A.pool||te(A.groups,Se,G(ye));const zt=A.pool||new c(A.groups.marks),Xt=ft?pe.categories.map((Xe,st)=>Ne.reduce((dt,yt)=>{const Mt=yt.points[st]?yt.points[st].y:null;return ne(Mt)?dt+Math.abs(Mt):dt},0)):null,$t=lt?ce(pe.categories.length,Xt):null,Zt=We?Ne.filter(Xe=>(Xe.mark||(ye==="bar"?"bar":ye))==="bar"):Ne,cn=We?Math.max(1,Zt.length):Math.max(1,Ne.length),Kt=qe.kind==="band"?lt?qe.bandwidth:qe.bandwidth/cn:0,Bt=new Map;for(const Xe of Zt)Bt.set(Xe.key,Bt.size);for(let Xe=0;Xe<Ne.length;Xe++){const st=Ne[Xe],dt=ke.series(st.index),yt=st.axis==="right"&&vt?vt:it,Mt=We?st.mark||(ye==="bar"?"bar":ye):ye,en=We&&Bt.has(st.key)?Bt.get(st.key):Xe;ye==="horizontalBar"?mt({pool:zt,series:st,bandScale:qe,valueScale:it,baseline:bt,colour:dt,stack:$t,index:st.index,slot:{offset:lt?0:Xe*Kt,width:Kt},pointColour:Ye}):ye==="waterfall"?at({pool:zt,series:st,xScale:qe,yScale:it,index:st.index,total:!0,positive:ke.positive,negative:ke.negative}):Mt==="bar"?Ve({pool:zt,series:st,xScale:qe,yScale:yt,baseline:yt===vt?St.min<=0&&St.max>=0?0:St.min:bt,colour:dt,stack:$t,index:st.index,slot:{offset:lt?0:en*Kt,width:Kt},pointColour:Ye}):ye==="scatter"||ye==="bubble"?Ot({pool:zt,series:st,xScale:qe,yScale:yt,colour:dt,index:st.index,size:ye==="bubble"?A.sizes:null}):je({pool:zt,series:st,xScale:qe,yScale:yt,baseline:bt,fill:Mt==="area"||Mt==="rangeArea",step:Mt==="step",colour:dt,stack:$t,index:st.index})}A.pool||zt.finish(),A.band&&typeof qe.invert=="function"&&wt({group:A.groups.overlay,band:A.band,xScale:qe,yScale:it,scheme:ke,index:0,line:A.band.line!==!1&&!A.fit}),A.fit&&(ye==="scatter"||ye==="bubble")&&typeof qe.invert=="function"&&ut({group:A.groups.overlay,series:Ne,xScale:qe,yScale:it,plot:Se,scheme:ke,grid:A.grid,size:Ae.small,showR2:A.fit!=="line"});let Rt=null;A.trend&&(Rt=j({group:A.groups.overlay,series:Ne,xScale:qe,yScale:it,rightScale:vt,plot:Se,scheme:ke,trend:A.trend,grid:A.grid,format:Xe=>Yt.tick(Xe),size:Ae.small,clip:A.groups.boxClipId}));let Ht=null;if(A.error&&(Ht=Ut({group:A.groups.overlay,series:Ne,xScale:qe,yScale:it,grid:A.grid,options:A.error===!0?{}:A.error})),A.labels&&A.labels.show&&t({group:A.groups.labels,series:Ne,plot:Se,options:A.labels,grid:A.grid,size:Ae.small,horizontal:$e}),A.reference&&A.reference.length){const Xe=A.reference.filter(dt=>!(dt.axis==="right"||dt.axis==="y2")),st=vt?A.reference.filter(dt=>dt.axis==="right"||dt.axis==="y2"):[];Xe.length&&At({group:A.groups.overlay,plot:Se,scale:it,lines:Xe}),st.length&&At({group:A.groups.overlay,plot:Se,scale:vt,lines:st})}let Wt=null;A.annotations&&A.annotations.length&&(Wt=S({group:A.groups.overlay,plot:Se,xScale:qe,yScale:it,rightScale:vt,series:Ne,annotations:A.annotations,dual:We,format:Xe=>Yt.tick(Xe),size:Ae.small}));const qt=Array.isArray(Rt)&&Rt.length?[...Wt||[],...Rt]:Wt;return{xScale:qe,yScale:it,rightScale:vt,dual:We,series:Ne,horizontal:$e,percent:ft,plot:Se,errorBars:Ht,annotations:qt,trendlines:Rt,reduced:Gt,legend:Ce?o({grid:A.grid,col:Ce,colours:Fe}):null}}const Ft=32;function It(A){const{series:ke,xScale:le,at:Ae}=A,pe=Number.isFinite(A.tolerance)?Number(A.tolerance):Ft,Se=[];let ye=-1,Oe=1/0;for(const Ne of ke){let $e=null,Ce=-1,Fe=1/0;const Ye=Ne.points||[];for(let De=0;De<Ye.length;De++){const et=Ye[De];if(!et||!ne(et.y))continue;const We=Pe(le,et);if(Number.isNaN(We))continue;const Je=Math.abs(We-Ae);Je>=Fe||(Fe=Je,$e=et,Ce=Array.isArray(Ne.kept)?Ne.kept[De]:De)}!$e||Fe>pe||(Se.push({series:Ne,point:$e}),Fe<Oe&&(Oe=Fe,ye=Ce))}return ye<0?null:{index:ye,entries:Se}}function Be(A){const{bound:ke,xScale:le,at:Ae}=A;if(!ke.categories.length)return-1;if(le.kind==="band"){const ye=Math.floor((Ae-le.range[0])/(le.step||1));return ye>=0&&ye<ke.categories.length?ye:-1}let pe=-1,Se=1/0;for(let ye=0;ye<ke.categories.length;ye++){const Oe=le.kind==="time"?R(ke.categories[ye]):_(ke.categories[ye]);if(Oe===null)continue;const Ne=Math.abs(le.of(Oe)-Ae);Ne<Se&&(Se=Ne,pe=ye)}return pe}function ot(A,ke){return ke<0||ke>=A.categories.length?"":N(A.categories[ke])}}),Qe("packages/modules/charts/drawable.js",function(s,K){"use strict";Object.defineProperty(s,"REASONS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"DRAWABLE",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"namedColumns",{enumerable:!0,get:function(){return te}}),Object.defineProperty(s,"missingColumns",{enumerable:!0,get:function(){return O}}),Object.defineProperty(s,"bucketKey",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"bucketMessage",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(s,"continuousX",{enumerable:!0,get:function(){return M}}),Object.defineProperty(s,"drawability",{enumerable:!0,get:function(){return k}});const xe=K("packages/modules/charts/scale.js"),W=xe.extent,v=xe.toNumber,de=xe.toTime,V=K("packages/modules/charts/cartesian.js").staleWindow,Q=Object.freeze({EMPTY:"empty",INCOMPLETE:"incomplete",STALE:"stale",MISSING_COLUMN:"missing-column",NO_DOMAIN:"no-domain",BUCKETED:"bucketed"}),G=Object.freeze({ok:!0});function te(F){if(!F||typeof F!="object")return[];const J=[],Z=(L,ne)=>{typeof ne=="string"&&ne?J.push({key:L,col:ne}):ne&&typeof ne=="object"&&typeof ne.col=="string"&&ne.col&&J.push({key:L,col:ne.col})};if(Array.isArray(F.points))return[];if(Z("x",F.x),Z("code",F.code),Z("y",F.y),Z("series",F.series),Z("size",F.size),Z("source",F.source),Z("target",F.target),typeof F.multiples=="string"&&Z("multiples",F.multiples),Array.isArray(F.measures))for(const L of F.measures)Z("measures",L);return J}function O(F,J){const Z=F&&F.columns;return!Z||typeof Z.get!="function"?[]:te(J).filter(({col:L})=>!Z.get(L))}function c(F){return`chart:x:date-bucket:${F}`}function Y(F,J,Z){return`chart x column ${JSON.stringify(F)} is a 'date', which stores a calendar day, so all ${J} rows collapsed into one point and were reduced by '${Z}'. For a series inside a single day, type the column 'datetime' or bind epoch milliseconds.`}function M(F,J){return!J||J.kind!=="time"&&J.kind!=="linear"?!1:F!=="bar"&&F!=="horizontalBar"}function k(F){const{grid:J,spec:Z,type:L,bound:ne}=F,N=F.id===void 0?"":String(F.id),X=Number.isFinite(F.now)?Number(F.now):Date.now(),oe=(R,ie,I,P=!0)=>({ok:!1,reason:R,key:I||`chart:${N}:${R}`,message:ie,tell:P}),ee=O(J,Z);if(ee.length){const R=ee.map(I=>`${I.key}: ${JSON.stringify(I.col)}`).join(", "),ie=J&&J.columns&&typeof J.columns.all=="function"?J.columns.all().map(I=>I.id||I.field).filter(Boolean):[];return oe(Q.MISSING_COLUMN,`chart ${R} ${ee.length>1?"name columns":"names a column"} this grid does not have, so there is nothing to read and nothing to draw.${ie.length?` The columns it does have: ${ie.slice(0,12).map(I=>JSON.stringify(I)).join(", ")}${ie.length>12?", …":""}.`:""} Bind a column the grid declares, or declare the column.`)}if(ne&&ne.empty){const R=J&&J.rows&&typeof J.rows.count=="function"?J.rows.count():0;return oe(Q.EMPTY,R?`chart bound nothing from the ${R} 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,R>0)}if(L==="candlestick"&&(!ne||!ne.series||ne.series.length<4)){const R=ne&&ne.series?ne.series.length:0;return oe(Q.INCOMPLETE,`a candlestick chart needs four measures — open, high, low and close, in that order — and ${R===0?"none was":`only ${R} were`} bound. Pass them as measures: [open, high, low, close].`)}const _=V(ne,F.axis&&F.axis.x,L,X);if(_){const R=_.newest===null?"and every one of them is stamped ahead of it":`and the newest of ${_.points} x value(s) is ${Math.round(_.age/1e3)}s old`;return oe(Q.STALE,`the rolling x window covers the last ${_.span} ms, ${R}, 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:${Z&&Z.x||""}`,_.newest!==null)}if(M(L,ne)){const R=Array.isArray(ne.categories)?ne.categories:[],ie=ne.kind==="time"?R.map(de):R.map(v);if(R.length&&!W(ie)){const I=Z&&typeof Z.x=="string"&&Z.x||ne.dimension&&ne.dimension.col||"";return oe(Q.NO_DOMAIN,`chart x ${I?`column ${JSON.stringify(I)} `:""}is drawn on a ${ne.kind==="time"?"time":"continuous"} axis, and not one of its ${R.length} value(s) reads as a ${ne.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(ne&&ne.bucketed&&M(L,ne)){const{col:R,rows:ie,fn:I}=ne.bucketed;return oe(Q.BUCKETED,Y(R,ie,I),c(R))}return G}}),Qe("packages/modules/charts/bind.js",function(s,K){"use strict";Object.defineProperty(s,"AGGREGATIONS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(s,"DEFAULT_AGGREGATION",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"resolveAggregation",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(s,"defaultAggregationFor",{enumerable:!0,get:function(){return M}}),Object.defineProperty(s,"measureOf",{enumerable:!0,get:function(){return k}}),Object.defineProperty(s,"walkRows",{enumerable:!0,get:function(){return F}}),Object.defineProperty(s,"leafRows",{enumerable:!0,get:function(){return J}}),Object.defineProperty(s,"selectedRows",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(s,"topGroups",{enumerable:!0,get:function(){return L}}),Object.defineProperty(s,"forcedScaleKind",{enumerable:!0,get:function(){return R}}),Object.defineProperty(s,"scaleKindFor",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"bindSeries",{enumerable:!0,get:function(){return P}}),Object.defineProperty(s,"bindPoints",{enumerable:!0,get:function(){return he}}),Object.defineProperty(s,"bindMeasures",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"bindLinks",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"bindHierarchy",{enumerable:!0,get:function(){return T}});const xe=K("packages/modules/charts/scale.js"),W=xe.key,v=xe.toNumber,de=xe.toTime,ue=K("packages/modules/charts/drawable.js"),V=ue.bucketKey,Q=ue.bucketMessage,te=K("packages/core/src/internal/util.js").warnOnce,O={sum:e=>e.length?e.reduce((i,y)=>i+y,0):null,avg:e=>e.length?e.reduce((i,y)=>i+y,0)/e.length:null,mean:e=>e.length?e.reduce((i,y)=>i+y,0)/e.length:null,min:e=>{let i=null;for(let y=0;y<e.length;y++)(i===null||e[y]<i)&&(i=e[y]);return i},max:e=>{let i=null;for(let y=0;y<e.length;y++)(i===null||e[y]>i)&&(i=e[y]);return i},median:e=>{if(!e.length)return null;const i=e.slice().sort((g,b)=>g-b),y=(i.length-1)/2,t=Math.floor(y),m=Math.ceil(y);return t===m?i[t]:(i[t]+i[m])/2},count:(e,i)=>i,countValues:e=>e.length,first:e=>e.length?e[0]:null,last:e=>e.length?e[e.length-1]:null},c="sum";function Y(e){return e==null?c:typeof e=="string"&&e in O?e:(te(`chart:measure:fn:${String(e)}`,`chart measure fn ${JSON.stringify(e)} is not a known aggregation; using '${c}'. Supported: ${Object.keys(O).join(", ")}.`),c)}function M(e){if(!e)return c;const i=e.groupTotal??e.total;if(typeof i=="string"&&i in O)return i;const y=e.dataType&&e.dataType.totals?e.dataType.totals.supported:null;if(Array.isArray(y)&&!y.includes(c)){const t=["avg","mean","max","min","countValues","count"].find(m=>y.includes(m)&&m in O);if(t)return t}return c}function k(e,i){const y=M(i);return e?typeof e=="string"?{col:e,fn:y}:{col:e.col||null,fn:e.fn==null?y:Y(e.fn)}:{col:null,fn:y}}function F(e,i){const y=new Set,t=m=>{if(!m||y.has(m)||(y.add(m),i(m),!m.group)||m.expanded)return;const g=m.filteredChildren||m.children;if(Array.isArray(g))for(const b of g)t(b)};e.rows.forEach(t)}function J(e){const i=[];return F(e,y=>{!y.group&&y.data!==null&&y.data!==void 0&&i.push(y)}),i}function Z(e){const i=new Set(e.selection.keys());if(!i.size)return[];const y=[];return F(e,t=>{!t.group&&i.has(t.key)&&y.push(t)}),y}function L(e){const i=[];let y=1/0;return F(e,t=>{t.group&&(t.level<y&&(y=t.level,i.length=0),t.level===y&&i.push(t))}),i}function ne(e,i,y){return i.group&&i.totals&&y in i.totals?v(i.totals[y]):v(e.rows.value(i.key,y))}function N(e,i,y,t){if(!i.group){const m=e.rows.text(i.key,y);if(m)return m}return t==null?"":t instanceof Date?t.toISOString().slice(0,10):String(t)}function X(e,i){return(O[i]||O[c])(e.values,e.rows)}const oe=Object.freeze(["number","currency","percent"]),ee=Object.freeze(["date","datetime","timestamp","dateString"]),_=Object.freeze({auto:"",band:"category",category:"category",linear:"linear",time:"time"});function R(e){const i=e&&typeof e=="object"?e.axis:null;if(!i||typeof i!="object")return"";const y=i.x;if(!y||typeof y!="object")return"";const t=typeof y.scale=="string"?y.scale:"";return t?Object.hasOwn(_,t)?_[t]:(te(`chart:x:scale:unknown:${t}`,`chart axis.x.scale ${JSON.stringify(t)} is not a scale this chart draws. Use one of: ${Object.keys(_).join(", ")}. The scale was chosen from the column instead.`),""):""}function ie(e){if(e.length<3)return"";let i=0,y=0;for(const t of e){if(t==null||t===""||typeof t=="boolean")return"";v(t)!==null?i++:typeof t=="string"&&de(t)!==null&&y++}return y===e.length?"time":i===e.length?"linear":""}function I(e,i,y={}){if(y.forced)return y.forced;const t=e&&typeof e.type=="string"?e.type:"";if(ee.includes(t)||i.length&&i.every(b=>b instanceof Date))return"time";if(oe.includes(t))return"linear";const m=y.id?String(y.id):"";if(!m)return"category";const g=t&&t!=="text"?"":ie(i);return g&&te(`chart:x:banded:${m}`,`chart x column ${JSON.stringify(m)} is typed ${JSON.stringify(t||"text")}, so its ${i.length} values are drawn as categories on a band scale even though they all read as ${g==="time"?"dates":"numbers"}. Type the column ${g==="time"?"'date' (or 'datetime'/'timestamp'/'dateString')":"'number'"} for a continuous axis, or pin it with axis: { x: { scale: '${g}' } }.`),"category"}function P(e,i){const y=i.x||null,t=i.series||(typeof i.multiples=="string"?i.multiples:null)||null,m=e.columns,g=y?m.get(y):void 0,b=k(i.y),$=b.col?m.get(b.col):void 0,l=k(i.y,$);let u;const x=typeof i.rows=="function"?i.rows(e):i.rows;Array.isArray(x)?u=x:i.from==="groups"?u=L(e):i.from==="selection"?u=Z(e):u=J(e);const n=u.length?u:J(e),d=new Map,S=new Map,p=[];for(let E=0;E<n.length;E++){const U=n[E],q=y?U.group&&U.groupColumn===y?U.groupValue:e.rows.value(U.key,y):E,se=W(q);d.has(se)||(d.set(se,{value:q,label:y?N(e,U,y,q):String(E),order:d.size}),p.push(q));const C=t?U.group&&U.groupColumn===t?U.groupValue:e.rows.value(U.key,t):null,ce=t?W(C):"";S.has(ce)||S.set(ce,{label:t?N(e,U,t,C):$?.title||"",points:new Map});const fe=S.get(ce);let me=fe.points.get(se);me||(me={values:[],rows:0,rowKey:U.key},fe.points.set(se,me)),me.rows+=U.group&&U.leafCount||1;const be=l.col?ne(e,U,l.col):null;if(be!==null&&me.values.push(be),i.size){const ge=v(e.rows.value(U.key,i.size));ge!==null&&(me.sizes=(me.sizes||0)+ge)}}const w=[...d.values()].sort((E,U)=>E.order-U.order),j=typeof i.limit=="number"&&i.limit>0?w.slice(0,i.limit):w,f=I(g,p,{forced:R(i),id:y});let a=null;f==="time"&&n.length>1&&d.size===1&&g&&(g.type==="date"||g.type==="dateString")&&(a={col:String(y),rows:n.length,fn:l.fn},te(V(a.col),Q(a.col,a.rows,a.fn)));const h=oe.includes(g&&typeof g.type=="string"?g.type:"")?[...j].sort((E,U)=>(v(E.value)??0)-(v(U.value)??0)):j,B=[...S.entries()].map(([E,U],q)=>({key:E,label:U.label,index:q,points:h.map(se=>{const C=W(se.value),ce=U.points.get(C);return{x:se.value,xKey:C,label:se.label,y:ce?X(ce,l.fn):null,size:ce&&ce.sizes!==void 0?ce.sizes:null,rows:ce?ce.rows:0,rowKey:ce?ce.rowKey:null,values:ce&&ce.values?ce.values:null}})}));return{series:B,categories:h.map(E=>E.value),labels:h.map(E=>E.label),kind:f,measure:{...l,title:$?.title||l.col||""},dimension:{col:y,title:g?.title||y||""},empty:B.length===0||h.length===0,rows:n.length,truncated:w.length-h.length,bucketed:a}}function he(e){const i=Array.isArray(e.points)?e.points:[],y=i.length>0&&i.every(g=>typeof g.x=="number"&&Number.isFinite(g.x)),t=g=>typeof g=="number"&&Number.isFinite(g)?g:null,m=i.map((g,b)=>({x:g.x,xKey:W(g.x),label:g.label!=null?String(g.label):String(g.x),y:t(g.y),size:t(g.size),lower:t(g.lower),upper:t(g.upper),rows:1,rowKey:g.key!=null?String(g.key):String(b),values:null}));return{series:[{key:e.seriesKey||"",label:e.seriesLabel||"",index:0,points:m}],categories:m.map(g=>g.x),labels:m.map(g=>g.label),kind:y?"linear":"category",measure:{col:null,fn:"sum",title:e.measureTitle||""},dimension:{col:null,title:e.dimensionTitle||""},empty:m.length===0,rows:m.length,truncated:0}}function r(e,i){const y=Array.isArray(i.measures)?i.measures:[];if(!y.length)return P(e,i);const t=y.map($=>{const l=typeof $=="string"?{col:$}:$;return{spec:l,result:P(e,{x:i.x,from:i.from,limit:i.limit,axis:i.axis,y:{col:l.col,fn:l.fn}})}}),m=t[0].result,g=new Map(m.categories.map(($,l)=>[W($),l])),b=t.map(({spec:$,result:l},u)=>{const x=e.columns.get($.col),n=m.categories.map(()=>null),d=l.series[0];if(d)for(const S of d.points){const p=g.get(S.xKey);p!==void 0&&(n[p]=S)}return{key:$.col,label:$.title||$.label||x&&x.title||$.col,index:u,mark:$.type||null,axis:$.axis==="right"?"right":"left",points:m.categories.map((S,p)=>n[p]||{x:S,xKey:W(S),label:m.labels[p],y:null,rows:0,rowKey:null})}});return{series:b,categories:m.categories,labels:m.labels,kind:m.kind,measure:{col:null,fn:"sum",title:b.map($=>$.label).join(", ")},dimension:m.dimension,empty:!b.length||!m.categories.length,rows:m.rows,truncated:m.truncated}}function D(e,i,y={}){const t=k(i.y),m=!!y.perRow,g=Array.isArray(y.nodes)?y.nodes:[],b=i.source||i.x||null,$=i.target||null;if(!b||!$)return{nodes:[],links:[],measure:{...t,title:""},dimension:{col:null,title:""},series:[],categories:[],labels:[],empty:!0,total:0};const l=t.col?e.columns.get(t.col):void 0,u=new Map,x=new Map,n=(w,j,f)=>{const a=W(w);return u.has(a)||u.set(a,{key:a,value:w,label:N(e,j,f,w),index:u.size,in:0,out:0}),u.get(a)},d=new Map;for(const w of g)!w||w.id===null||w.id===void 0||d.set(W(w.id),w);for(const w of J(e)){const j=e.rows.value(w.key,b),f=e.rows.value(w.key,$);if(j==null||f===null||f===void 0)continue;const a=t.col?v(e.rows.value(w.key,t.col)):1;if(a===null||a<=0)continue;const o=n(j,w,b),h=n(f,w,$);if(m){const B=o.key>h.key,E=B?h:o,U=B?o:h;x.set(`${E.key}\0${U.key}\0${x.size}`,{source:E,target:U,value:a,undirected:!0,pair:`${E.key}\0${U.key}`,rowKeys:[w.key]})}else{const B=`${o.key}\0${h.key}`,E=x.get(B)||{source:o,target:h,value:0,rowKeys:[]};E.value+=a,E.rowKeys.length<64&&E.rowKeys.push(w.key),x.set(B,E)}o.out+=a,h.in+=a}for(const[w,j]of d)u.has(w)||u.set(w,{key:w,value:j.id,label:String(j.label??j.id),index:u.size,in:0,out:0});for(const[w,j]of d){const f=u.get(w);f&&(f.declared=!0,j.label!==void 0&&j.label!==null&&(f.label=String(j.label)),typeof j.icon=="string"&&j.icon&&(f.icon=j.icon),Number.isFinite(j.x)&&Number.isFinite(j.y)&&(f.fx=Number(j.x),f.fy=Number(j.y)))}const S=m?[...x.values()]:[...x.values()].sort((w,j)=>j.value-w.value),p=typeof i.limit=="number"&&i.limit>0?S.slice(0,i.limit):S;return{nodes:[...u.values()],links:p,measure:{...t,title:l?.title||t.col||""},dimension:{col:b,title:e.columns.get(b)?.title||b},series:[],categories:[],labels:[],empty:!p.length,total:p.reduce((w,j)=>w+j.value,0)}}function T(e,i){const y=k(i.y),t=typeof i.depth=="number"&&i.depth>0?i.depth:1/0,m=y.col?e.columns.get(y.col):void 0,g=(x,n,d)=>({label:x,value:n,depth:d,total:0,children:[],rowKey:null}),b=g("",null,0),$=L(e);if($.length){const x=(n,d,S)=>{const p=n.groupColumn?N(e,n,n.groupColumn,n.groupValue):"",w=g(p,n.groupValue,S);w.rowKey=n.key;const j=y.col?ne(e,n,y.col):null;w.total=j===null?0:Math.abs(j),d.children.push(w);const f=n.filteredChildren||n.children;if(S<t&&Array.isArray(f))for(const a of f)a.group&&x(a,w,S+1);return!w.total&&w.children.length&&(w.total=w.children.reduce((a,o)=>a+o.total,0)),w};for(const n of $)x(n,b,1)}else{const n=P(e,{x:i.x,y:i.y,limit:i.limit}).series[0];if(n)for(const d of n.points){const S=g(d.label,d.x,1);S.total=d.y===null?0:Math.abs(d.y),S.rowKey=d.rowKey,b.children.push(S)}}b.total=b.children.reduce((x,n)=>x+n.total,0);let l=0;const u=x=>{x.depth>l&&(l=x.depth);for(const n of x.children)u(n)};return u(b),{root:b,depth:l,measure:{...y,title:m?.title||y.col||""},empty:b.total<=0||b.children.length===0}}}),Qe("packages/modules/charts/radial.js",function(s,K){"use strict";Object.defineProperty(s,"horizontalRoom",{enumerable:!0,get:function(){return R}}),Object.defineProperty(s,"arcPath",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"layoutRings",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"drawRadial",{enumerable:!0,get:function(){return P}}),Object.defineProperty(s,"arcAt",{enumerable:!0,get:function(){return he}});const W=K("packages/modules/charts/frame.js").Pool,v=K("packages/modules/charts/svg.js"),de=v.attrs,ue=v.path,V=v.round,Q=v.setText,te=K("packages/modules/charts/styles.js").NS,c=K("packages/modules/charts/scheme.js").resolveScheme,Y=K("packages/modules/charts/labels.js"),M=Y.drawAnchoredLabels,k=Y.labelText,F=K("packages/modules/charts/typography.js"),J=F.applySize,Z=F.truncateTo,L=Math.PI*2,ne=-Math.PI/2,N=.25,X=2,oe=3,ee=.58;function _(r,D,T,e){return[r+T*Math.cos(e),D+T*Math.sin(e)]}function R(r,D,T){const{inner:e,outer:i,from:y,to:t}=r;if(T*T>=i*i)return 0;const m=Math.sqrt(i*i-T*T);let g=D+m,b=m-D;if(e>0&&T*T<e*e){const $=Math.sqrt(e*e-T*T);if(D>=$)g=Math.min(g,D-$);else if(D<=-$)b=Math.min(b,-$-D);else return 0}if(t-y<L-1e-9)for(const $ of[y,t]){const l=Math.sin($);if(Math.abs(l)<1e-9)continue;const u=T/l;if(u<=0)continue;const x=u*Math.cos($);x>=D?b=Math.min(b,x-D):g=Math.min(g,D-x)}return Math.max(0,g)+Math.max(0,b)}function ie(r){const{cx:D,cy:T,inner:e,outer:i}=r,y=r.to-r.from;if(y<=0)return"";if(y>=L-1e-9){const[u,x]=_(D,T,i,r.from),[n,d]=_(D,T,i,r.from+Math.PI),S=["M",V(u),V(x),"A",V(i),V(i),0,1,1,V(n),V(d),"A",V(i),V(i),0,1,1,V(u),V(x)];if(e>0){const[p,w]=_(D,T,e,r.from),[j,f]=_(D,T,e,r.from+Math.PI);S.push("M",V(p),V(w),"A",V(e),V(e),0,1,0,V(j),V(f),"A",V(e),V(e),0,1,0,V(p),V(w))}return ue(S)}const t=y>Math.PI?1:0,[m,g]=_(D,T,i,r.from),[b,$]=_(D,T,i,r.to),l=["M",V(m),V(g),"A",V(i),V(i),0,t,1,V(b),V($)];if(e>0){const[u,x]=_(D,T,e,r.to),[n,d]=_(D,T,e,r.from);l.push("L",V(u),V(x)),l.push("A",V(e),V(e),0,t,0,V(n),V(d))}else l.push("L",V(D),V(T));return l.push("Z"),ue(l)}function I(r){const D=[],T=(e,i,y,t,m,g)=>{if(t>0&&D.push({node:e,from:i,to:y,depth:t,index:m,label:e.label,total:e.total,path:g}),t>=r.maxRings||!e.children.length)return;const b=e.children.reduce((u,x)=>u+x.total,0),$=y-i;if(b<=0||$<=0)return;let l=i;for(let u=0;u<e.children.length;u++){const x=e.children[u],n=x.total/b*$;T(x,l,l+n,t+1,t===0?u:m,[...g,x.label]),l+=n}};return T(r.root,ne,ne+L,0,0,[]),D}function P(r){const D=r.scheme||c(),{plot:T,tree:e,type:i}=r,y=T.left+T.width/2,t=T.top+T.height/2,m=Math.max(0,Math.min(T.width,T.height)/2-2),g=i==="sunburst"?Math.max(1,e.depth):1,b=I({root:e.root,depth:e.depth,maxRings:g}).filter(S=>!r.hidden.has(S.label)),$=i==="donut"?m*ee:0,l=g>0?(m-$)/g:m;new W(r.groups.grid).finish(),new W(r.groups.axis).finish(),new W(r.groups.rules).finish(),new W(r.groups.labels).finish();const u=new W(r.groups.marks);for(const S of b){const p=$+(S.depth-1)*l,w=p+l,j=u.next("path",`${te}__slice ${te}__mark`);de(j,{d:ie({cx:y,cy:t,inner:p,outer:w,from:S.from,to:S.to}),fill:D.series(S.index),"fill-opacity":S.depth>1?Math.max(.45,1-(S.depth-1)*.22):1,"data-arc":b.indexOf(S)}),S.geometry={cx:y,cy:t,inner:p,outer:w}}u.finish();const x=r.typography&&r.typography.small||r.fontSize||11,n=!(r.labels&&r.labels.names===!1),d=new W(r.groups.overlay);if(n)for(const S of b){if(S.to-S.from<N||S.geometry.outer-S.geometry.inner<x+X*2)continue;const p=(S.from+S.to)/2,w=S.geometry.inner+(S.geometry.outer-S.geometry.inner)/2;if((S.to-S.from)*w<x+X*2)continue;const[j,f]=_(y,t,w,p),{inner:a,outer:o}=S.geometry,h=R({inner:a,outer:o,from:S.from,to:S.to},j-y,f-t)-X*2,B=String(S.label===null||S.label===void 0?"":S.label),E=Z(B,h,x);if(E!==B&&E.length<oe)continue;const U=d.next("text",`${te}__slice-label`);de(U,{x:V(j),y:V(f),"dominant-baseline":"middle"}),J(U,x),Q(U,E)}return d.finish(),r.labels&&r.labels.show&&M({group:r.groups.labels,size:x,minGap:r.labels.minGap,anchors:b.filter(S=>S.depth===1&&S.to-S.from>=N).map(S=>{const p=(S.from+S.to)/2,w=S.geometry.inner+(S.geometry.outer-S.geometry.inner)/2,[j,f]=_(y,t,w,p);return{x:V(j),y:V(f+x+1),text:k(S.total,r.labels,r.grid),inside:!0}})}),{arcs:b,centre:{x:y,y:t,r:m}}}function he(r){for(const D of r.arcs){const T=D.geometry;if(!T)continue;const e=r.x-T.cx,i=r.y-T.cy,y=Math.sqrt(e*e+i*i);if(y<T.inner||y>T.outer)continue;let t=Math.atan2(i,e);for(;t<ne;)t+=L;for(;t>=ne+L;)t-=L;if(t>=D.from&&t<D.to)return D}return null}}),Qe("packages/modules/charts/distribution.js",function(s,K){"use strict";Object.defineProperty(s,"FENCE",{enumerable:!0,get:function(){return P}}),Object.defineProperty(s,"quantile",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"summarise",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"binEdge",{enumerable:!0,get:function(){return T}}),Object.defineProperty(s,"outsideDomain",{enumerable:!0,get:function(){return e}}),Object.defineProperty(s,"histogram",{enumerable:!0,get:function(){return i}}),Object.defineProperty(s,"readingsOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(s,"valuesByCategory",{enumerable:!0,get:function(){return t}}),Object.defineProperty(s,"allReadings",{enumerable:!0,get:function(){return m}}),Object.defineProperty(s,"distributionDomain",{enumerable:!0,get:function(){return g}}),Object.defineProperty(s,"density",{enumerable:!0,get:function(){return b}}),Object.defineProperty(s,"drawHistogram",{enumerable:!0,get:function(){return l}}),Object.defineProperty(s,"drawBoxPlot",{enumerable:!0,get:function(){return u}}),Object.defineProperty(s,"probit",{enumerable:!0,get:function(){return x}}),Object.defineProperty(s,"drawQQ",{enumerable:!0,get:function(){return n}}),Object.defineProperty(s,"drawEcdf",{enumerable:!0,get:function(){return d}}),Object.defineProperty(s,"drawLorenz",{enumerable:!0,get:function(){return S}}),Object.defineProperty(s,"drawControl",{enumerable:!0,get:function(){return p}}),Object.defineProperty(s,"drawCapability",{enumerable:!0,get:function(){return w}}),Object.defineProperty(s,"drawMovingRange",{enumerable:!0,get:function(){return j}});const W=K("packages/modules/charts/frame.js").Pool,v=K("packages/modules/charts/axis.js"),de=v.drawAxisLines,ue=v.drawCategoryAxis,V=v.drawContinuousAxis,Q=v.drawMeasureAxis,G=v.tickLabeller,O=K("packages/modules/charts/format.js").formatters,c=K("packages/modules/charts/scale.js"),Y=c.bandScale,M=c.isNumber,k=c.linearScale,F=c.measureDomain,J=c.niceStep,Z=K("packages/modules/charts/svg.js"),L=Z.attrs,ne=Z.path,N=Z.round,oe=K("packages/modules/charts/styles.js").NS,_=K("packages/modules/charts/scheme.js").resolveScheme,R=K("packages/modules/charts/labels.js"),ie=R.drawAnchoredLabels,I=R.labelText,P=1.5,he="–";function r(f,a){const o=f.length;if(!o)return NaN;if(o===1)return f[0];const h=(o-1)*Math.min(1,Math.max(0,a)),B=Math.floor(h),E=Math.ceil(h);return B===E?f[B]:f[B]+(h-B)*(f[E]-f[B])}function D(f){const a=f.filter(M).slice().sort((ce,fe)=>ce-fe);if(!a.length)return null;const o=r(a,.25),h=r(a,.5),B=r(a,.75),E=B-o,U=o-P*E,q=B+P*E;let se=a[0];for(const ce of a)if(ce>=U){se=ce;break}let C=a[a.length-1];for(let ce=a.length-1;ce>=0;ce--)if(a[ce]<=q){C=a[ce];break}return{min:a[0],q1:o,median:h,q3:B,max:a[a.length-1],low:se,high:C,outliers:a.filter(ce=>ce<U||ce>q),count:a.length}}function T(f,a,o){const h=f+o*a;return Math.abs(h)<a/1e6?0:Number(h.toPrecision(12))}function e(f,a){const o=a||{},h=M(o.min),B=M(o.max);if(!h&&!B)return 0;let E=0;for(let U=0;U<f.length;U++){const q=f[U];M(q)&&(h&&q<o.min||B&&q>o.max)&&E++}return E}function i(f,a=12,o){const h=o||{},B=M(h.min),E=M(h.max);let U=1/0,q=-1/0,se=0;for(let ge=0;ge<f.length;ge++){const Me=f[ge];M(Me)&&(B&&Me<h.min||E&&Me>h.max||(Me<U&&(U=Me),Me>q&&(q=Me),se++))}if(!se)return[];if(B&&(U=Number(h.min)),E&&(q=Number(h.max)),U===q){const ge=Math.abs(U)>0?Math.abs(U)/10:.5;U-=ge,q+=ge}const C=J((q-U)/Math.max(1,a)),ce=Math.floor(U/C)*C,fe=Math.ceil(q/C)*C,me=[],be=Math.max(1,Math.round((fe-ce)/C));for(let ge=0;ge<be;ge++)me.push({from:T(ce,C,ge),to:T(ce,C,ge+1),count:0});for(let ge=0;ge<f.length;ge++){const Me=f[ge];if(!M(Me)||B&&Me<h.min||E&&Me>h.max)continue;let Te=Math.floor((Me-ce)/C);Te>=me.length&&(Te=me.length-1),Te<0&&(Te=0),me[Te].count++}return me}function y(f){if(!f)return[];if(Array.isArray(f.values)){const a=f.values.filter(M);if(a.length)return a}return M(f.y)?[f.y]:[]}function t(f){const a=new Map,o=!(f.dimension&&f.dimension.col),h=o&&f.measure&&f.measure.title||"";for(const B of f.series)for(const E of B.points){const U=y(E);if(!U.length)continue;const q=o?h:E.label;a.has(q)||a.set(q,[]);const se=a.get(q);for(const C of U)se.push(C)}return a}function m(f){const a=[];for(const o of f.series||[])for(const h of o.points||[])for(const B of y(h))a.push(B);return a}function g(f,a){const o=a&&a.y||{};return F(f,{zero:!1,min:o.min,max:o.max})}function b(f,a,o){const h=f.length;if(!h)return[];const B=f.reduce((ce,fe)=>ce+fe,0)/h,E=f.reduce((ce,fe)=>ce+(fe-B)**2,0)/Math.max(1,h-1),U=Math.sqrt(E)||1,q=Math.max(1e-9,1.06*U*h**(-1/5)),se=[],C=a.max-a.min||1;for(let ce=0;ce<o;ce++){const fe=a.min+C*ce/(o-1||1);let me=0;for(const be of f){const ge=(fe-be)/q;me+=Math.exp(-.5*ge*ge)}se.push({at:fe,density:me/(h*q*Math.sqrt(Math.PI*2))})}return se}function $(f,a,o){const h=O(f.grid,{kind:"linear",step:o}),B=a.measure&&a.measure.col&&f.grid.columns?f.grid.columns.get(a.measure.col):null,U=!!(B&&B.format&&typeof B.formatValue=="function")?{tick:q=>String(B.formatValue(q,null))}:h;return G(f.axis&&f.axis.x||{},U,f.grid)}function l(f){const a=f.scheme||_(),{plot:o,bound:h}=f,B=m(h),E=f.axis&&f.axis.y||{},U=i(B,f.buckets||12,E),q=e(B,E),se=U.map(Pe=>Pe.count),C=F(se,{zero:!0}),ce=k(C,[o.bottom,o.top]),fe=U.length?U[0].to-U[0].from:1,me=$(f,h,fe),be=U.map(Pe=>me(Pe.from)),ge=U.map(Pe=>`${me(Pe.from)} ${he} ${me(Pe.to)}`),Me=U.map((Pe,je)=>je),Te=Y(Me,[o.left,o.right],.08);Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:ce,format:O(f.grid,{kind:"linear",step:(C.max-C.min)/5})}),ue({group:f.groups.overlay,plot:o,scale:Te,labels:be,fontSize:f.fontSize,rotated:be.length>8}),de({group:f.groups.rules,plot:o});const we=new W(f.groups.marks),_e=ce.of(C.min<=0?0:C.min);if(U.forEach((Pe,je)=>{const Ie=ce.of(Pe.count);L(we.next("rect",`${oe}__bar ${oe}__mark`),{x:N(Te.of(je)),y:N(Math.min(Ie,_e)),width:N(Te.bandwidth),height:N(Math.max(Pe.count>0?1:0,Math.abs(_e-Ie))),fill:a.series(0),"data-point":je})}),we.finish(),f.curve&&B.length>1){const Pe={min:U[0].from,max:U[U.length-1].to},je=b(B,Pe,Math.max(24,U.length*4)),Ie=je.reduce((Ge,Ve)=>Math.max(Ge,Ve.density),0);if(Ie>0){const Ge=Pe.max-Pe.min||1,Ve=ce.of(C.max),at=je.map(ut=>[N(o.left+(ut.at-Pe.min)/Ge*(o.right-o.left)),N(_e-ut.density/Ie*(_e-Ve))]),mt=new W(f.groups.overlay);L(mt.next("path",`${oe}__density ${oe}__mark`),{d:ne(at.flatMap(([ut,wt],kt)=>[kt?"L":"M",ut,wt])),fill:"none",stroke:a.series(1)}),mt.finish()}}if(f.labels&&f.labels.show){const Pe=f.typography&&f.typography.small||f.fontSize||11;ie({group:f.groups.labels,size:Pe,minGap:f.labels.minGap,plot:o,anchors:U.map((je,Ie)=>{const Ge=Math.min(ce.of(je.count),_e),Ve=Ge-Pe/2-2,at=Ve<o.top;return{x:N(Te.of(Ie)+Te.bandwidth/2),y:N(at?Ge+Pe/2+2:Ve),text:je.count?I(je.count,f.labels,f.grid):"",inside:at,height:at?Math.abs(_e-Ge)-2:void 0}})})}return{xScale:Te,yScale:ce,buckets:U,labels:ge,categories:U.map(Pe=>Pe.from),outside:q,series:[{key:"",label:h.measure.title,index:0,points:U.map((Pe,je)=>({x:je,xKey:String(je),label:ge[je],from:Pe.from,to:Pe.to,y:Pe.count,rows:Pe.count}))}]}}function u(f){const a=f.scheme||_(),{plot:o,bound:h}=f,B=t(h),E=[...B.keys()],U=E.map(be=>D(B.get(be))).filter(Boolean),q=[];for(const be of U)q.push(be.min,be.max);const se=g(q,f.axis),C=k(se,[o.bottom,o.top]),ce=Y(E,[o.left,o.right],.4);Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:C,format:O(f.grid,{kind:"linear",step:(se.max-se.min)/5})}),ue({group:f.groups.overlay,plot:o,scale:ce,labels:E,fontSize:f.fontSize,rotated:E.length>6}),de({group:f.groups.rules,plot:o});const fe=new W(f.groups.marks),me=ce.bandwidth;return E.forEach((be,ge)=>{const Me=U[ge];if(!Me)return;const Te=ce.of(be),we=Te+me/2,_e=a.series(ge);L(fe.next("rect",`${oe}__box ${oe}__mark`),{x:N(Te),y:N(C.of(Me.q3)),width:N(me),height:N(Math.max(1,C.of(Me.q1)-C.of(Me.q3))),fill:_e,"fill-opacity":.35,stroke:_e,"data-point":ge}),L(fe.next("path",`${oe}__whisker ${oe}__mark`),{d:ne(["M",N(we),N(C.of(Me.high)),"L",N(we),N(C.of(Me.q3)),"M",N(we),N(C.of(Me.q1)),"L",N(we),N(C.of(Me.low)),"M",N(Te+me*.25),N(C.of(Me.high)),"L",N(Te+me*.75),N(C.of(Me.high)),"M",N(Te+me*.25),N(C.of(Me.low)),"L",N(Te+me*.75),N(C.of(Me.low))]),stroke:_e,fill:"none"}),L(fe.next("path",`${oe}__median ${oe}__mark`),{d:ne(["M",N(Te),N(C.of(Me.median)),"L",N(Te+me),N(C.of(Me.median))]),stroke:_e,"stroke-width":2,fill:"none"});for(const Pe of Me.outliers)L(fe.next("circle",`${oe}__point ${oe}__mark`),{cx:N(we),cy:N(C.of(Pe)),r:2.5,fill:_e,"fill-opacity":.8})}),fe.finish(),{xScale:ce,yScale:C,boxes:U,series:[{key:"",label:h.measure.title,index:0,points:E.map((be,ge)=>({x:be,xKey:be,label:be,y:U[ge]?U[ge].median:null,rows:U[ge]?U[ge].count:0}))}]}}function x(f){if(!(f>0&&f<1))return Number.NaN;const a=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],o=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],h=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],B=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],E=.02425;if(f<E){const se=Math.sqrt(-2*Math.log(f));return(((((h[0]*se+h[1])*se+h[2])*se+h[3])*se+h[4])*se+h[5])/((((B[0]*se+B[1])*se+B[2])*se+B[3])*se+1)}if(f>1-E){const se=Math.sqrt(-2*Math.log(1-f));return-(((((h[0]*se+h[1])*se+h[2])*se+h[3])*se+h[4])*se+h[5])/((((B[0]*se+B[1])*se+B[2])*se+B[3])*se+1)}const U=f-.5,q=U*U;return(((((a[0]*q+a[1])*q+a[2])*q+a[3])*q+a[4])*q+a[5])*U/(((((o[0]*q+o[1])*q+o[2])*q+o[3])*q+o[4])*q+1)}function n(f){const a=f.scheme||_(),{plot:o,bound:h}=f;new W(f.groups.grid).finish(),new W(f.groups.axis).finish(),new W(f.groups.rules).finish(),new W(f.groups.labels).finish();const B=m(h);if(B.length<3)return null;const E=B.slice().sort((Ie,Ge)=>Ie-Ge),U=E.length,q=E.map((Ie,Ge)=>x((Ge+1-.375)/(U+.25))),se=F(q,{zero:!1,nice:!0}),C=F(E,{zero:!1,nice:!0}),ce=k(se,[o.left,o.right]),fe=k(C,[o.bottom,o.top]);Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:fe,format:O(f.grid,{kind:"linear",step:(C.max-C.min)/5})}),V({group:f.groups.overlay,plot:o,scale:ce,fontSize:f.fontSize,format:O(f.grid,{kind:"linear",step:(se.max-se.min)/5})}),de({group:f.groups.rules,plot:o});const me=r(E,.25),be=r(E,.75),ge=x(.25),Me=x(.75),Te=(be-me)/(Me-ge),we=me-Te*ge,_e=new W(f.groups.rules);L(_e.next("path",`${oe}__qq-line`),{d:ne(["M",N(ce.of(se.min)),N(fe.of(we+Te*se.min)),"L",N(ce.of(se.max)),N(fe.of(we+Te*se.max))]),fill:"none"}),_e.finish();const Pe=new W(f.groups.marks),je=[];for(let Ie=0;Ie<U;Ie++){const Ge=N(ce.of(q[Ie])),Ve=N(fe.of(E[Ie]));L(Pe.next("circle",`${oe}__point ${oe}__mark`),{cx:Ge,cy:Ve,r:2.5,fill:a.series(0),"data-point":Ie}),je.push({x:Ge,y:Ve,theoretical:q[Ie],sample:E[Ie]})}return Pe.finish(),{points:je,line:{slope:Te,intercept:we}}}function d(f){const a=f.scheme||_(),{plot:o,bound:h}=f;new W(f.groups.grid).finish(),new W(f.groups.axis).finish(),new W(f.groups.rules).finish(),new W(f.groups.labels).finish();const B=m(h);if(!B.length)return null;const E=B.slice().sort((be,ge)=>be-ge),U=E.length,q=F(E,{zero:!1,nice:!0}),se=k(q,[o.left,o.right]),C=k({min:0,max:1},[o.bottom,o.top]);Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:C,format:O(f.grid,{kind:"linear",step:.2})}),V({group:f.groups.overlay,plot:o,scale:se,fontSize:f.fontSize,format:O(f.grid,{kind:"linear",step:(q.max-q.min)/5})}),de({group:f.groups.rules,plot:o});const ce=["M",N(se.of(q.min)),N(C.of(0))],fe=[];for(let be=0;be<U;be++){const ge=N(se.of(E[be])),Me=(be+1)/U;ce.push("L",ge,N(C.of(be/U)),"L",ge,N(C.of(Me))),fe.push({value:E[be],share:Me})}ce.push("L",N(se.of(q.max)),N(C.of(1)));const me=new W(f.groups.marks);return L(me.next("path",`${oe}__ecdf ${oe}__mark`),{d:ne(ce),fill:"none",stroke:a.series(0)}),me.finish(),{steps:fe}}function S(f){const a=f.scheme||_(),{plot:o,bound:h}=f;new W(f.groups.grid).finish(),new W(f.groups.axis).finish(),new W(f.groups.rules).finish(),new W(f.groups.labels).finish();const B=m(h).filter(we=>we>=0);if(!B.length)return null;const E=B.slice().sort((we,_e)=>we-_e),U=E.length,q=E.reduce((we,_e)=>we+_e,0);if(q<=0)return null;const se=k({min:0,max:1},[o.left,o.right]),C=k({min:0,max:1},[o.bottom,o.top]);Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:C,format:O(f.grid,{kind:"linear",step:.2})}),V({group:f.groups.overlay,plot:o,scale:se,fontSize:f.fontSize,format:O(f.grid,{kind:"linear",step:.2})}),de({group:f.groups.rules,plot:o});const ce=new W(f.groups.rules);L(ce.next("path",`${oe}__lorenz-equality`),{d:ne(["M",N(se.of(0)),N(C.of(0)),"L",N(se.of(1)),N(C.of(1))]),fill:"none"}),ce.finish();const fe=["M",N(se.of(0)),N(C.of(0))],me=[{rows:0,held:0}];let be=0;for(let we=0;we<U;we++){be+=E[we];const _e={rows:(we+1)/U,held:be/q};fe.push("L",N(se.of(_e.rows)),N(C.of(_e.held))),me.push(_e)}const ge=new W(f.groups.marks);L(ge.next("path",`${oe}__lorenz ${oe}__mark`),{d:ne(fe),fill:"none",stroke:a.series(0)}),ge.finish();let Me=0;for(let we=0;we<U;we++)Me+=(we+1)*E[we];const Te=2*Me/(U*q)-(U+1)/U;return{curve:me,gini:Te}}function p(f){const a=f.scheme||_(),{plot:o,bound:h}=f;new W(f.groups.grid).finish(),new W(f.groups.labels).finish();const B=[];for(const je of h.series)for(const Ie of je.points)M(Ie.y)&&B.push(Ie.y);if(B.length<2)return null;const E=f.capability||null,U=E&&E.limits?E.limits:null,q=[...B];U&&q.push(U.upper,U.lower),E&&(E.lower!==null&&q.push(E.lower),E.upper!==null&&q.push(E.upper));const se=F(q,{zero:!1,nice:!0}),C=k(se,[o.bottom,o.top]),ce=B.length>1?(o.right-o.left)/(B.length-1):0;Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:C,format:O(f.grid,{kind:"linear",step:(se.max-se.min)/5})}),de({group:f.groups.rules,plot:o});const fe=new W(f.groups.overlay),me=[],be=(je,Ie,Ge,Ve="end")=>{!Number.isFinite(je)||je<se.min||je>se.max||(L(fe.next("path",Ie),{d:ne(["M",N(o.left),N(C.of(je)),"L",N(o.right),N(C.of(je))]),fill:"none"}),Ge&&me.push({y:C.of(je),text:Ge,side:Ve}))};U&&(be(U.centre,`${oe}__control-centre`,"CL","end"),be(U.upper,`${oe}__control-limit`,"UCL","end"),be(U.lower,`${oe}__control-limit`,"LCL","end")),E&&(E.lower!==null&&be(E.lower,`${oe}__spec-limit`,"LSL","start"),E.upper!==null&&be(E.upper,`${oe}__spec-limit`,"USL","start"),E.target!==null&&be(E.target,`${oe}__spec-target`,"Target","start")),fe.finish();const ge=new Map;for(const je of E&&E.violations?E.violations:[]){const Ie=ge.get(je.index);Ie?Ie.includes(je.rule)||Ie.push(je.rule):ge.set(je.index,[je.rule])}const Me=new Set(ge.keys()),Te=new W(f.groups.marks),we=[],_e=[];for(let je=0;je<B.length;je++){const Ie=N(o.left+je*ce),Ge=N(C.of(B[je]));we.push(je?"L":"M",Ie,Ge),_e.push({x:Ie,y:Ge,index:je,value:B[je],violating:Me.has(je)})}L(Te.next("path",`${oe}__control-line ${oe}__mark`),{d:ne(we),fill:"none",stroke:a.series(0)});for(const je of _e)L(Te.next("circle",`${oe}__point ${oe}__mark`),{cx:je.x,cy:je.y,r:je.violating?4:2.5,fill:je.violating?"var(--lattice-danger, #a4262c)":a.series(0),"data-violation":je.violating?"true":null});Te.finish();const Pe=[];for(const{y:je,text:Ie,side:Ge}of me)Pe.push({x:Ge==="start"?o.left+2:o.right-2,y:je-3,text:Ie,anchor:Ge,className:`${oe}__control-name`});for(const je of _e){const Ie=ge.get(je.index);Ie&&Pe.push({x:je.x,y:je.y-7,text:Ie.sort((Ge,Ve)=>Ge-Ve).join(","),anchor:"middle",className:`${oe}__control-rule`})}return ie({group:f.groups.labels,anchors:Pe,size:9,grid:f.grid,minGap:1}),{points:_e,limits:U,ruleSet:E?E.ruleSet:null}}function w(f){const a=f.scheme||_(),{plot:o,bound:h}=f;new W(f.groups.grid).finish();const B=[];for(const Pe of h.series)for(const je of Pe.points)M(je.y)&&B.push(je.y);if(B.length<2)return null;const E=f.capability||null,U=[...B];E&&(E.lower!==null&&U.push(E.lower),E.upper!==null&&U.push(E.upper),E.target!==null&&U.push(E.target));const q=F(U,{zero:!1,nice:!0}),se=k(q,[o.left,o.right]),C=i(B,f.buckets||14),ce=C.map(Pe=>Pe.count),fe=F(ce,{zero:!0}),me=k(fe,[o.bottom,o.top]);Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:me,format:O(f.grid,{kind:"linear",step:(fe.max-fe.min)/5})}),V({group:f.groups.overlay,plot:o,scale:se,fontSize:f.fontSize,format:O(f.grid,{kind:"linear",step:(q.max-q.min)/5})}),de({group:f.groups.rules,plot:o});const be=me.of(0),ge=new W(f.groups.marks);for(let Pe=0;Pe<C.length;Pe++){const je=C[Pe],Ie=se.of(je.from),Ge=se.of(je.to),Ve=me.of(je.count);L(ge.next("rect",`${oe}__bar ${oe}__mark`),{x:N(Math.min(Ie,Ge)),y:N(Math.min(Ve,be)),width:N(Math.max(1,Math.abs(Ge-Ie)-1)),height:N(Math.max(je.count>0?1:0,Math.abs(be-Ve))),fill:a.series(0),"data-point":Pe})}ge.finish();const Me=new W(f.groups.overlay),Te=[];if(E&&Number.isFinite(E.mean)){const je=at=>{if(!Number.isFinite(at)||at<=0)return null;const mt=[];for(let ut=0;ut<=96;ut++){const wt=q.min+(q.max-q.min)*ut/96,kt=(wt-E.mean)/at;mt.push({at:wt,y:Math.exp(-.5*kt*kt)/at})}return mt},Ie=je(E.sigmaWithin),Ge=je(E.sigmaOverall);let Ve=0;for(const at of[Ie,Ge])if(at)for(const mt of at)Ve=Math.max(Ve,mt.y);if(Ve>0){const at=me.of(fe.max),mt=(ut,wt,kt)=>{if(!ut)return;const jt=ut.flatMap((At,Ot)=>[Ot?"L":"M",N(se.of(At.at)),N(be-At.y/Ve*(be-at))]);L(Me.next("path",`${wt} ${oe}__mark`),{d:ne(jt),fill:"none"}),Te.push(kt)};mt(Ie,`${oe}__capability-within`,"within"),mt(Ge,`${oe}__capability-overall`,"overall")}}const we=[],_e=(Pe,je,Ie)=>{if(Pe===null||!Number.isFinite(Pe)||Pe<q.min||Pe>q.max)return;const Ge=N(se.of(Pe));L(Me.next("path",je),{d:ne(["M",Ge,N(o.top),"L",Ge,N(o.bottom)]),fill:"none"}),we.push({x:Ge,text:Ie})};return E&&(_e(E.lower,`${oe}__spec-limit`,"LSL"),_e(E.upper,`${oe}__spec-limit`,"USL"),_e(E.target,`${oe}__spec-target`,"Target")),Me.finish(),ie({group:f.groups.labels,anchors:we.map(({x:Pe,text:je})=>({x:Pe,y:o.top+6,text:je,anchor:"middle",className:`${oe}__control-name`})),size:9,grid:f.grid,minGap:1}),{buckets:C,capability:E,curves:Te}}function j(f){const a=f.scheme||_(),{plot:o,bound:h}=f;new W(f.groups.grid).finish();const B=[];for(const we of h.series)for(const _e of we.points)M(_e.y)&&B.push(_e.y);if(B.length<3)return null;const E=[];for(let we=1;we<B.length;we++)E.push(Math.abs(B[we]-B[we-1]));const U=E.reduce((we,_e)=>we+_e,0)/E.length,q=3.267*U,se=F([...E,0,q],{zero:!0,nice:!0}),C=k(se,[o.bottom,o.top]),ce=E.length>1?(o.right-o.left)/(E.length-1):0;Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:C,format:O(f.grid,{kind:"linear",step:(se.max-se.min)/5})}),de({group:f.groups.rules,plot:o});const fe=new W(f.groups.overlay),me=[],be=(we,_e,Pe)=>{!Number.isFinite(we)||we<se.min||we>se.max||(L(fe.next("path",_e),{d:ne(["M",N(o.left),N(C.of(we)),"L",N(o.right),N(C.of(we))]),fill:"none"}),me.push({y:C.of(we),text:Pe}))};be(U,`${oe}__control-centre`,"MR"),be(q,`${oe}__control-limit`,"UCL"),fe.finish();const ge=new W(f.groups.marks),Me=[],Te=[];for(let we=0;we<E.length;we++){const _e=N(o.left+we*ce),Pe=N(C.of(E[we]));Me.push(we?"L":"M",_e,Pe),Te.push({x:_e,y:Pe,index:we,value:E[we],violating:E[we]>q})}L(ge.next("path",`${oe}__control-line ${oe}__mark`),{d:ne(Me),fill:"none",stroke:a.series(0)});for(const we of Te)L(ge.next("circle",`${oe}__point ${oe}__mark`),{cx:we.x,cy:we.y,r:we.violating?4:2.5,fill:we.violating?"var(--lattice-danger, #a4262c)":a.series(0),"data-violation":we.violating?"true":null});return ge.finish(),ie({group:f.groups.labels,anchors:me.map(({y:we,text:_e})=>({x:o.right-2,y:we-3,text:_e,anchor:"end",className:`${oe}__control-name`})),size:9,grid:f.grid,minGap:1}),{points:Te,centre:U,upper:q}}}),Qe("packages/modules/charts/treemap.js",function(s,K){"use strict";Object.defineProperty(s,"squarify",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"layoutTree",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"drawTreemap",{enumerable:!0,get:function(){return P}}),Object.defineProperty(s,"tileAt",{enumerable:!0,get:function(){return he}});const W=K("packages/modules/charts/frame.js").Pool,v=K("packages/modules/charts/svg.js"),de=v.attrs,ue=v.round,V=v.setText,G=K("packages/modules/charts/styles.js").NS,O=K("packages/modules/charts/scheme.js").resolveScheme,c=K("packages/modules/charts/labels.js"),Y=c.drawAnchoredLabels,M=c.labelText,k=K("packages/modules/charts/typography.js"),F=k.applySize,J=k.truncateTo,Z=34,L=6,ne=3,N=3,X=.28;function oe(r){return r*1.6}function ee(r){return Math.round(r*1.6)}function _(r){return r>1?Math.max(.45,1-(r-1)*.22):1}function R(r,D,T){if(!r.length||D<=0||T<=0)return 1/0;const e=Math.max(...r),i=Math.min(...r),y=D*D,t=T*T;return Math.max(y*e/t,t/(y*i))}function ie(r,D){const T=[],e=r.filter(l=>l.value>0),i=e.reduce((l,u)=>l+u.value,0);if(!e.length||i<=0||D.width<=0||D.height<=0)return T;const y=e.slice().sort((l,u)=>u.value-l.value),t=D.width*D.height/i;let m={...D},g=[],b=[];const $=()=>{if(!g.length)return;const l=Math.min(m.width,m.height),x=b.reduce((d,S)=>d+S,0)/l;let n=0;for(let d=0;d<g.length;d++){const S=b[d]/x;T.push(m.width>=m.height?{item:g[d],x:m.x,y:m.y+n,width:x,height:S}:{item:g[d],x:m.x+n,y:m.y,width:S,height:x}),n+=S}m.width>=m.height?m={x:m.x+x,y:m.y,width:m.width-x,height:m.height}:m={x:m.x,y:m.y+x,width:m.width,height:m.height-x},g=[],b=[]};for(const l of y){const u=l.value*t,x=Math.min(m.width,m.height),n=R(b,x,b.reduce((S,p)=>S+p,0)),d=R([...b,u],x,b.reduce((S,p)=>S+p,0)+u);g.length&&d>n&&$(),g.push(l),b.push(l.value*t)}return $(),T}function I(r){const{plot:D,tree:T}=r,e=oe(r.fontSize),i=ee(r.fontSize),y=[],t=(m,g,b,$,l)=>{const u=m.children.filter(x=>b>0||!r.hidden.has(x.label)).map((x,n)=>({node:x,value:x.total,index:b===0?n:$}));for(const x of ie(u,g)){if(b>0&&(x.width<e||x.height<e))continue;const n={...x,depth:b+1,path:[...l,x.item.node.label],children:!1};y.push(n);const d={x:n.x+N,y:n.y+i,width:n.width-N*2,height:n.height-i-N};if(x.item.node.children.length&&d.width>=e&&d.height>=e){const S=y.length;t(x.item.node,d,b+1,n.item.index,n.path),n.children=y.length>S}}};return t(T.root,{x:D.left,y:D.top,width:D.width,height:D.height},0,0,[]),y}function P(r){const D=r.scheme||O();new W(r.groups.grid).finish(),new W(r.groups.axis).finish(),new W(r.groups.rules).finish(),new W(r.groups.labels).finish();const T=I(r),e=r.typography&&r.typography.small||r.fontSize||11,i=new W(r.groups.marks);for(const t of T)de(i.next("rect",`${G}__tile ${G}__mark${t.children?` ${G}__tile--branch`:""}`),{x:ue(t.x),y:ue(t.y),width:ue(Math.max(0,t.width)),height:ue(Math.max(0,t.height)),fill:D.series(t.item.index),"fill-opacity":t.children?X:_(t.depth),"data-point":t.item.index,"data-depth":t.depth});i.finish();const y=new W(r.groups.overlay);for(const t of T){if(t.width<Z||t.height<r.fontSize*1.6)continue;const m=String(t.item.node.label??""),g=J(m,t.width-L*2,e);if(g!==m&&g.length<ne)continue;const b=y.next("text",`${G}__tile-label${t.children?` ${G}__tile-label--branch`:""}`);de(b,{x:ue(t.x+L),y:ue(t.y+r.fontSize+2),"text-anchor":"start"}),F(b,e),V(b,g)}return y.finish(),r.labels&&r.labels.show&&Y({group:r.groups.labels,size:e,minGap:r.labels.minGap,anchors:T.filter(t=>!t.children&&t.width>=Z&&t.height>=r.fontSize*1.6+e).sort((t,m)=>m.width*m.height-t.width*t.height).map(t=>({x:ue(t.x+L),y:ue(t.y+r.fontSize*2+4),text:M(t.item.value,r.labels,r.grid),anchor:"start",inside:!0,width:t.width-L*2}))}),{tiles:T}}function he(r){let D=null;for(const T of r.tiles)r.x>=T.x&&r.x<=T.x+T.width&&r.y>=T.y&&r.y<=T.y+T.height&&(!D||(T.depth||1)>(D.depth||1))&&(D=T);return D}}),Qe("packages/modules/charts/matrix.js",function(s,K){"use strict";Object.defineProperty(s,"colourRamp",{enumerable:!0,get:function(){return y}}),Object.defineProperty(s,"drawHeatmap",{enumerable:!0,get:function(){return t}}),Object.defineProperty(s,"drawFunnel",{enumerable:!0,get:function(){return m}}),Object.defineProperty(s,"drawCandlestick",{enumerable:!0,get:function(){return g}}),Object.defineProperty(s,"drawCorrelogram",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"title",{enumerable:!0,get:function(){return u}}),Object.defineProperty(s,"cellAt",{enumerable:!0,get:function(){return x}});const W=K("packages/modules/charts/frame.js").Pool,v=K("packages/modules/charts/axis.js"),de=v.drawAxisLines,ue=v.drawBandLabels,V=v.drawCategoryAxis,Q=v.drawMeasureAxis,G=v.leftLabelRoom,te=v.setLabelText,O=K("packages/modules/charts/format.js"),c=O.formatters,Y=O.measureText,M=K("packages/modules/charts/scale.js"),k=M.bandScale,F=M.isNumber,J=M.measureDomain,Z=K("packages/modules/charts/svg.js"),L=Z.attrs,ne=Z.path,N=Z.round,X=Z.setText,ee=K("packages/modules/charts/typography.js").applySize,R=K("packages/modules/charts/styles.js").NS,ie=K("packages/modules/charts/scheme.js"),I=ie.rampStops,P=ie.resolveScheme,he=K("packages/modules/charts/labels.js"),r=he.drawAnchoredLabels,D=he.labelText,T=Object.freeze([[236,243,249],[0,82,128]]),e=Object.freeze([[176,74,0],[247,247,247],[0,82,128]]);function i(n,d,S){const p=Math.min(1,Math.max(0,S)),w=j=>Math.round(n[j]+(d[j]-n[j])*p);return`rgb(${w(0)} ${w(1)} ${w(2)})`}function y(n,d,S){const p=n.max-n.min||1,w=S?I(S,d):d?e:T;if(!d)return f=>i(w[0],w[w.length-1],(f-n.min)/p);const j=Math.max(Math.abs(n.min),Math.abs(n.max))||1;return f=>f>=0?i(w[1],w[2],f/j):i(w[1],w[0],-f/j)}function t(n){const d=n.scheme||P(),{plot:S,bound:p}=n;new W(n.groups.grid).finish(),new W(n.groups.axis).finish(),new W(n.groups.rules).finish(),new W(n.groups.labels).finish();const w=p.series.filter(E=>!n.hidden.has(E.key)),j=[];for(const E of w)for(const U of E.points)j.push(U.y);const f=J(j,{zero:!1,nice:!1}),a=y(f,!!n.diverging,d),o=k(p.categories,[S.left,S.right],.04),h=k(w.map(E=>E.label),[S.top,S.bottom],.04),B=new W(n.groups.marks);for(const E of w){const U=h.of(E.label);if(!Number.isNaN(U))for(let q=0;q<E.points.length;q++){const se=E.points[q],C=o.of(se.x);if(Number.isNaN(C))continue;const ce=B.next("rect",`${R}__cell ${R}__mark`);L(ce,{x:N(C),y:N(U),width:N(o.bandwidth),height:N(h.bandwidth),fill:F(se.y)?a(se.y):"transparent","data-series":E.index,"data-point":q}),se.px=N(C+o.bandwidth/2),se.py=N(U+h.bandwidth/2)}}if(B.finish(),V({group:n.groups.overlay,plot:S,scale:o,labels:p.labels,fontSize:n.fontSize,rotated:p.labels.length>6}),ue({group:n.groups.axis,plot:S,scale:h,labels:w.map(E=>E.label),fontSize:n.fontSize}),n.labels&&n.labels.show){const E=n.typography&&n.typography.small||n.fontSize||11,U=[];for(const q of w)for(const se of q.points)se.px===void 0||!F(se.y)||U.push({x:se.px,y:se.py,text:D(se.y,n.labels,n.grid),inside:!0,width:o.bandwidth-4,height:h.bandwidth-2});r({group:n.groups.labels,size:E,minGap:0,anchors:U})}return{xScale:o,yScale:h,series:w,ramp:a}}function m(n){const d=n.scheme||P(),{plot:S,bound:p}=n;new W(n.groups.grid).finish(),new W(n.groups.axis).finish(),new W(n.groups.rules).finish(),new W(n.groups.labels).finish();const w=p.series[0],j=w?w.points.map((U,q)=>({point:U,label:p.labels[q],value:F(U.y)?U.y:0})).filter(U=>U.value>0):[];if(!j.length)return{stages:j};let f=0;for(let U=0;U<j.length;U++)j[U].value>f&&(f=j[U].value);const a=S.height/j.length,o=S.left+S.width/2,h=S.width*.62,B=new W(n.groups.marks);j.forEach((U,q)=>{const se=j[q+1],C=S.top+q*a,ce=U.value/f*h/2,fe=(se?se.value:U.value)/f*h/2;L(B.next("path",`${R}__funnel ${R}__mark`),{d:ne(["M",N(o-ce),N(C),"L",N(o+ce),N(C),"L",N(o+fe),N(C+a-2),"L",N(o-fe),N(C+a-2),"Z"]),fill:d.series(q),"data-point":q}),U.point.px=N(o),U.point.py=N(C+a/2)}),B.finish();const E=new W(n.groups.overlay);return j.forEach((U,q)=>{const se=S.top+q*a,C=E.next("text",`${R}__funnel-label`);L(C,{x:N(S.left+4),y:N(se+a/2),"text-anchor":"start","dominant-baseline":"middle"}),X(C,U.label);const ce=E.next("text",`${R}__funnel-value`);L(ce,{x:N(S.right-4),y:N(se+a/2),"text-anchor":"end","dominant-baseline":"middle"});const fe=q===0?1:U.value/j[q-1].value,me=n.labels&&n.labels.show?D(U.value,n.labels,n.grid):Y(U.value,n.grid.messages);X(ce,q===0?me:`${me} · ${Math.round(fe*100)}%`)}),E.finish(),{stages:j}}function g(n){const d=n.scheme||P(),{plot:S,bound:p}=n,[w,j,f,a]=p.series;if(!w||!j||!f||!a)return{xScale:null,yScale:null,series:[]};const o=[];for(const se of[j,f])for(const C of se.points)o.push(C.y);const h=J(o,{zero:!1}),B={...k([],[0,0])},E=b(h,S),U=k(p.categories,[S.left,S.right],.3);Q({gridGroup:n.groups.grid,axisGroup:n.groups.axis,plot:S,scale:E,format:c(n.grid,{kind:"linear",step:(h.max-h.min)/5})}),de({group:n.groups.rules,plot:S}),V({group:n.groups.overlay,plot:S,scale:U,labels:p.labels,fontSize:n.fontSize,rotated:p.labels.length>10});const q=new W(n.groups.marks);for(let se=0;se<p.categories.length;se++){const C=w.points[se],ce=j.points[se],fe=f.points[se],me=a.points[se];if(![C,ce,fe,me].every(Pe=>Pe&&F(Pe.y)))continue;const be=U.of(p.categories[se]),ge=be+U.bandwidth/2,Me=me.y>=C.y,Te=Me?d.positive:d.negative;L(q.next("path",`${R}__wick ${R}__mark`),{d:ne(["M",N(ge),N(E.of(ce.y)),"L",N(ge),N(E.of(fe.y))]),stroke:Te,fill:"none"});const we=E.of(Math.max(C.y,me.y)),_e=E.of(Math.min(C.y,me.y));L(q.next("rect",`${R}__candle ${R}__mark`),{x:N(be),y:N(we),width:N(U.bandwidth),height:N(Math.max(1,_e-we)),fill:Me?"transparent":Te,stroke:Te,"data-point":se}),me.px=N(ge),me.py=N(we)}return q.finish(),{xScale:U,yScale:E,series:[a],candles:p.categories.length}}function b(n,d){const S=n.max-n.min||1;return{kind:"linear",domain:n,range:[d.bottom,d.top],of(p){return d.bottom+(p-n.min)/S*(d.top-d.bottom)},ticks(p=5){const w=[];for(let j=0;j<=p;j++)w.push(n.min+S*j/p);return w}}}function $(n){const d=n.scheme||P(),{plot:S}=n;new W(n.groups.grid).finish(),new W(n.groups.rules).finish(),new W(n.groups.labels).finish();const p=n.columns||[];if(p.length<2)return null;const w=n.grid&&n.grid.statistics;if(!w)return null;const j=n.method==="spearman"?"spearman":n.method==="kendall"?"kendall":"correlation",f=[];for(let q=0;q<p.length;q++)for(let se=0;se<p.length;se++){const C=q===se?1:w[j](p[q],p[se]);f.push({row:q,col:se,a:p[q],b:p[se],r:C})}const a=p.length,o=S.width/a,h=S.height/a,B=new W(n.groups.marks);for(const q of f){const se=S.left+q.col*o,C=S.top+q.row*h;q.x=se,q.y=C,q.width=o,q.height=h;const ce=B.next("rect",`${R}__cell ${R}__mark`);L(ce,{x:N(se),y:N(C),width:N(Math.max(0,o-1)),height:N(Math.max(0,h-1)),fill:q.row===q.col||q.r===null?"var(--lattice-chart-empty, #eceff1)":l(q.r,d),"data-row":q.row,"data-col":q.col}),q.element=ce}B.finish();const E=new W(n.groups.overlay),U=G(S);for(let q=0;q<a;q++){const se=E.next("text",`${R}__tick`);ee(se,n.fontSize),L(se,{x:N(S.left-4),y:N(S.top+q*h+h/2),"text-anchor":"end","dominant-baseline":"middle"}),te(se,u(n.grid,p[q]),U,n.fontSize);const C=E.next("text",`${R}__tick`);ee(C,n.fontSize),L(C,{x:N(S.left+q*o+o/2),y:N(S.top-4),"text-anchor":"middle"}),te(C,u(n.grid,p[q]),o,n.fontSize)}if(n.values!==!1&&o>n.fontSize*2.6&&h>n.fontSize*1.5)for(const q of f){if(q.row===q.col||q.r===null)continue;const se=E.next("text",`${R}__data-label`);ee(se,n.fontSize),L(se,{x:N(S.left+q.col*o+o/2),y:N(S.top+q.row*h+h/2),"text-anchor":"middle","dominant-baseline":"middle","data-inside":"true"}),X(se,q.r.toFixed(2))}return E.finish(),{cells:f,columns:p}}function l(n,d){const S=Math.min(1,Math.abs(n)),p=d?I(d,!0):e,w=p[Math.floor(p.length/2)],j=n>=0?p[p.length-1]:p[0];return i(w,j,S)}function u(n,d){const S=n&&n.columns&&typeof n.columns.get=="function"?n.columns.get(d):null;return String(S&&S.title||d)}function x(n){for(const d of n.cells||[])if(d.x!==void 0&&n.x>=d.x&&n.x<=d.x+d.width&&n.y>=d.y&&n.y<=d.y+d.height)return d;return null}}),Qe("packages/modules/charts/topojson.js",function(s,K){"use strict";Object.defineProperty(s,"transformer",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(s,"arcPoints",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"stitch",{enumerable:!0,get:function(){return de}}),Object.defineProperty(s,"decodeGeometry",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"feature",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"isTopology",{enumerable:!0,get:function(){return Q}});function xe(G){if(!G)return F=>[F[0],F[1]];const[te,O]=G.scale,[c,Y]=G.translate;let M=0,k=0;return(F,J)=>(J||(M=0,k=0),M+=F[0],k+=F[1],[M*te+c,k*O+Y])}function W(G,te){const O=G.arcs[te],c=xe(G.transform);return O.map((Y,M)=>c(Y,M))}function v(G,te){const O=W(G,te<0?~te:te);return te<0?O.slice().reverse():O}function de(G,te){const O=[];for(const c of te){const Y=v(G,c);for(let M=O.length?1:0;M<Y.length;M++)O.push(Y[M])}return O}function ue(G,te){if(!te||!te.type)return null;const O=xe(G.transform);switch(te.type){case"Point":return{type:"Point",coordinates:O(te.coordinates,0)};case"MultiPoint":return{type:"MultiPoint",coordinates:te.coordinates.map(c=>O(c,0))};case"LineString":return{type:"LineString",coordinates:de(G,te.arcs)};case"MultiLineString":return{type:"MultiLineString",coordinates:te.arcs.map(c=>de(G,c))};case"Polygon":return{type:"Polygon",coordinates:te.arcs.map(c=>de(G,c))};case"MultiPolygon":return{type:"MultiPolygon",coordinates:te.arcs.map(c=>c.map(Y=>de(G,Y)))};case"GeometryCollection":return{type:"GeometryCollection",geometries:(te.geometries||[]).map(c=>ue(G,c)).filter(Boolean)};default:return null}}function V(G,te){const O=typeof te=="string"?(G.objects||{})[te]:te;if(!O)return{type:"FeatureCollection",features:[]};const c=O.type==="GeometryCollection"?O.geometries||[]:[O],Y=[];for(const M of c){const k=ue(G,M);k&&Y.push({type:"Feature",id:M.id,properties:M.properties||{},geometry:k})}return{type:"FeatureCollection",features:Y}}function Q(G){return!!G&&typeof G=="object"&&G.type==="Topology"&&Array.isArray(G.arcs)}}),Qe("packages/modules/charts/projection.js",function(s,K){"use strict";Object.defineProperty(s,"MERCATOR_LIMIT",{enumerable:!0,get:function(){return de}}),Object.defineProperty(s,"equalEarth",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"robinson",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"mercator",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"equirectangular",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"albers",{enumerable:!0,get:function(){return te}}),Object.defineProperty(s,"transverseMercator",{enumerable:!0,get:function(){return O}}),Object.defineProperty(s,"PROJECTIONS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"DEFAULT_PROJECTION",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(s,"resolveProjection",{enumerable:!0,get:function(){return M}}),Object.defineProperty(s,"WRAP_DEGREES",{enumerable:!0,get:function(){return k}}),Object.defineProperty(s,"splitAntimeridian",{enumerable:!0,get:function(){return F}}),Object.defineProperty(s,"boundsOf",{enumerable:!0,get:function(){return J}}),Object.defineProperty(s,"fitted",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(s,"graticule",{enumerable:!0,get:function(){return ne}});const xe=Math.PI/180,W=Object.freeze([1.340264,-.081106,893e-6,.003796]),v=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]]),de=85.05113;function ue(N,X){const[oe,ee,_,R]=W,ie=X*xe,I=Math.asin(Math.min(1,Math.max(-1,Math.sqrt(3)/2*Math.sin(ie)))),P=I*I,he=P*P*P,r=Math.sqrt(3)/2*(oe+3*ee*P+he*(7*_+9*R*P));return[N*xe*Math.cos(I)/r,I*(oe+ee*P+he*(_+R*P))]}function V(N,X){const oe=Math.min(Math.abs(X),90),ee=Math.min(v.length-2,Math.floor(oe/5)),_=(oe-ee*5)/5,[R,ie]=v[ee],[I,P]=v[ee+1],he=R+(I-R)*_,r=ie+(P-ie)*_;return[N*xe*he,(X<0?-r:r)*(Math.PI/2)]}function Q(N,X){const oe=Math.min(de,Math.max(-de,X))*xe;return[N*xe,Math.log(Math.tan(Math.PI/4+oe/2))]}function G(N,X){return[N*xe,X*xe]}function te(N={}){const[X,oe]=N.parallels||[29.5,45.5],[ee,_]=N.centre||[-96,37.5],R=X*xe,ie=oe*xe,I=Math.sin(R),P=Math.abs(R-ie)<1e-9?I:(I+Math.sin(ie))/2,he=Math.cos(R)**2+2*P*I,r=Math.sqrt(he-2*P*Math.sin(_*xe))/P;return(D,T)=>{const e=P*((D-ee)*xe),i=Math.max(0,he-2*P*Math.sin(T*xe)),y=Math.sqrt(i)/P;return[y*Math.sin(e),r-y*Math.cos(e)]}}function O(N={}){const[X,oe]=N.centre||[-2,49];return(ee,_)=>{const R=_*xe,ie=(ee-X)*xe,I=Math.cos(R)*Math.sin(ie),P=Math.min(1-1e-12,Math.max(-1+1e-12,I));return[.5*Math.log((1+P)/(1-P)),Math.atan2(Math.tan(R),Math.cos(ie))-oe*xe]}}const c=Object.freeze({equalEarth:()=>ue,robinson:()=>V,mercator:()=>Q,equirectangular:()=>G,albers:te,transverseMercator:O,britishNationalGrid:N=>O({centre:[-2,49],...N})}),Y="equalEarth";function M(N,X={},oe){if(typeof N=="function")return N;const _=c[typeof N=="string"&&N?N:Y];return _?_(X):(oe&&oe(`chart projection ${JSON.stringify(N)} is not one this module draws; using '${Y}'. Supported: ${Object.keys(c).join(", ")}.`),c[Y]({}))}const k=180;function F(N){if(!Array.isArray(N)||N.length<2)return N&&N.length?[N]:[];const X=[];let oe=[N[0]];for(let ee=1;ee<N.length;ee++){const[_,R]=N[ee-1],[ie,I]=N[ee],P=ie-_;if(Math.abs(P)>k){const he=P>0?-180:180,r=P>0?P-360:P+360,D=r===0?0:Math.min(1,Math.max(0,(he-_)/r)),T=R+(I-R)*D;oe.push([he,T]),X.push(oe),oe=[[-he,T],[ie,I]]}else oe.push([ie,I])}return X.push(oe),X.filter(ee=>ee.length>1)}function J(N){let X=1/0,oe=1/0,ee=-1/0,_=-1/0;for(const R of N||[])for(const[ie,I]of R)ie<X&&(X=ie),ie>ee&&(ee=ie),I<oe&&(oe=I),I>_&&(_=I);return Number.isFinite(X)?{west:X,south:oe,east:ee,north:_}:null}function Z(N){const{project:X,rings:oe,plot:ee}=N,_=typeof N.padding=="number"?N.padding:4;let R=1/0,ie=1/0,I=-1/0,P=-1/0;for(const x of oe||[])for(const[n,d]of x){const[S,p]=X(n,d);!Number.isFinite(S)||!Number.isFinite(p)||(S<R&&(R=S),S>I&&(I=S),p<ie&&(ie=p),p>P&&(P=p))}if(!Number.isFinite(R)||I===R||P===ie)return{to:(n,d)=>{const[S,p]=X(n,d);return[ee.left+ee.width/2+S,ee.top+ee.height/2-p]},scale:1,width:ee.width,height:ee.height,left:ee.left,top:ee.top,aspect:1};const he=Math.max(1,ee.width-_*2),r=Math.max(1,ee.height-_*2),D=typeof N.zoom=="number"&&N.zoom>0?N.zoom:1,T=Math.min(he/(I-R),r/(P-ie))*D,e=(I-R)*T,i=(P-ie)*T,[y,t]=N.centre?X(N.centre[0],N.centre[1]):[(R+I)/2,(ie+P)/2],m=N.centreOffset||[0,0],g=y+(m[0]||0),b=t+(m[1]||0),$=ee.left+ee.width/2,l=ee.top+ee.height/2;return{to:(x,n)=>{const[d,S]=X(x,n);return[$+(d-g)*T,l-(S-b)*T]},scale:T,width:e,height:i,left:$-e/2,top:l-i/2,aspect:(I-R)/(P-ie)}}const L=2;function ne(N={}){const X=N.step&&N.step>0?N.step:30,oe=[];for(let ee=-180;ee<=180;ee+=X){const _=[];for(let R=-80;R<=80;R+=L)_.push([ee,R]);oe.push(_)}for(let ee=-60;ee<=60;ee+=X){const _=[];for(let R=-180;R<=180;R+=L)_.push([R,ee]);oe.push(_)}return oe}}),Qe("packages/modules/charts/geo.js",function(s,K){"use strict";Object.defineProperty(s,"CONTINENTS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(s,"CONTINENT_NAMES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(s,"OUTLINES",{enumerable:!0,get:function(){return y}}),Object.defineProperty(s,"COUNTRY_CONTINENT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(s,"ALPHA3",{enumerable:!0,get:function(){return m}}),Object.defineProperty(s,"NUMERIC",{enumerable:!0,get:function(){return g}}),Object.defineProperty(s,"normaliseCode",{enumerable:!0,get:function(){return b}}),Object.defineProperty(s,"continentOf",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"projection",{enumerable:!0,get:function(){return l}}),Object.defineProperty(s,"projectedPath",{enumerable:!0,get:function(){return u}}),Object.defineProperty(s,"ringPath",{enumerable:!0,get:function(){return x}}),Object.defineProperty(s,"shapesToPaths",{enumerable:!0,get:function(){return n}}),Object.defineProperty(s,"registerGeoPack",{enumerable:!0,get:function(){return S}}),Object.defineProperty(s,"geoPack",{enumerable:!0,get:function(){return p}}),Object.defineProperty(s,"geoPacks",{enumerable:!0,get:function(){return w}}),Object.defineProperty(s,"resolvePack",{enumerable:!0,get:function(){return j}}),Object.defineProperty(s,"packRegions",{enumerable:!0,get:function(){return a}}),Object.defineProperty(s,"regionLabelPoint",{enumerable:!0,get:function(){return h}}),Object.defineProperty(s,"geoRamp",{enumerable:!0,get:function(){return B}}),Object.defineProperty(s,"drawGeomap",{enumerable:!0,get:function(){return U}}),Object.defineProperty(s,"regionAt",{enumerable:!0,get:function(){return q}}),Object.defineProperty(s,"markerAt",{enumerable:!0,get:function(){return se}});const W=K("packages/modules/charts/frame.js").Pool,de=K("packages/modules/charts/matrix.js").colourRamp,V=K("packages/modules/charts/topojson.js").feature,Q=K("packages/modules/charts/projection.js"),G=Q.fitted,te=Q.graticule,O=Q.resolveProjection,c=Q.splitAntimeridian,M=K("packages/modules/charts/labels.js").drawAnchoredLabels,k=K("packages/modules/charts/axis.js"),F=k.overhangFor,J=k.setPlotClip,L=K("packages/core/src/internal/util.js").warnOnce,N=K("packages/modules/charts/scheme.js").resolveScheme,X=K("packages/modules/charts/scale.js"),oe=X.isNumber,ee=X.measureDomain,_=K("packages/modules/charts/svg.js"),R=_.attrs,ie=_.insideRings,I=_.path,P=_.pathRings,he=_.round,r=_.setText,T=K("packages/modules/charts/styles.js").NS,e=Object.freeze(["AF","AN","AS","EU","NA","OC","SA"]),i=Object.freeze({AF:"Africa",AN:"Antarctica",AS:"Asia",EU:"Europe",NA:"North America",OC:"Oceania",SA:"South America"}),y=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]]]}),t=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"}),m=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"}),g=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 b(C){if(C==null||C==="")return null;const ce=String(C).trim().toUpperCase();return ce?/^\d+$/.test(ce)?g[String(Number(ce))]||null:ce.length===2?ce:ce.length===3&&m[ce]||null:null}function $(C){return C?e.includes(C)&&!(C in t)||e.includes(C)?C:t[C]||null:null}function l(C,ce={}){const fe=ce.antarctic?-90:-58,me=84,be=me-fe,ge=Math.min(C.width/360,C.height/be),Me=360*ge,Te=be*ge,we=C.left+(C.width-Me)/2,_e=C.top+(C.height-Te)/2;return(Pe,je)=>[we+(Pe+180)*ge,_e+(me-je)*ge]}function u(C,ce){const fe=[];for(let me=0;me<C.length;me++){const[be,ge]=ce(C[me][0],C[me][1]);if(!Number.isFinite(be)||!Number.isFinite(ge))return fe.length>4?I([...fe,"Z"]):"";fe.push(me?"L":"M",he(be),he(ge))}return fe.length?I([...fe,"Z"]):""}function x(C,ce){const fe=Array.isArray(C)&&Array.isArray(C[0])&&Array.isArray(C[0][0])?C:[C],me=[];for(const be of fe)if(!(!Array.isArray(be)||!be.length)){for(let ge=0;ge<be.length;ge++){const[Me,Te]=ce(be[ge][0],be[ge][1]);me.push(ge?"L":"M",he(Me),he(Te))}me.push("Z")}return I(me)}function n(C){const ce=new Map,fe=C.shapes;if(!fe)return ce;const me=l(C.plot),be=C.codeProperty||"iso_a2";if(!Array.isArray(fe)&&!fe.type){for(const Me of Object.keys(fe)){const Te=b(Me);Te&&typeof fe[Me]=="string"&&ce.set(Te,fe[Me])}return ce}const ge=fe.type==="FeatureCollection"?fe.features||[]:[fe];for(const Me of ge){const Te=Me.properties||{},we=b(Te[be]??Te.iso??Te.code),_e=Me.geometry;if(!we||!_e)continue;const Pe=_e.type==="MultiPolygon"?_e.coordinates:_e.type==="Polygon"?[_e.coordinates]:[],je=[];for(const Ie of Pe)for(const Ge of Ie)je.push(x(Ge,me));je.length&&ce.set(we,je.join(" "))}return ce}const d=new Map;function S(C){return C&&typeof C=="object"&&typeof C.id=="string"&&d.set(C.id,C),C}function p(C){return d.get(C)||null}function w(){return[...d.keys()]}function j(C,ce){if(!C||typeof C!="object")return null;const fe=C;let me=C;if(typeof fe.pack=="string"){if(me=d.get(fe.pack),!me)return L(`chart:geomap:pack:${fe.pack}`,`geometry pack ${JSON.stringify(fe.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-${fe.pack}'; createChart({ …, shapes: pack })${d.size?`. Loaded: ${[...d.keys()].join(", ")}.`:"."}`),null}else fe.pack&&typeof fe.pack=="object"&&(me=fe.pack);if(!me||typeof me!="object")return null;const be=me;if(be.topology)return{pack:be,topology:be.topology};if(be.layers){const ge=typeof fe.layer=="string"&&fe.layer||typeof ce=="string"&&ce||be.defaultLayer||Object.keys(be.layers)[0],Me=be.layers[ge];if(Me&&Me.topology)return{pack:be,topology:Me.topology,layer:ge}}return null}const f=new WeakMap;function a(C){const ce=f.get(C);if(ce)return ce;const fe=[];for(const me of V(C,"regions").features){const be=[],ge=me.geometry,Me=ge.type==="MultiPolygon"?ge.coordinates:ge.type==="Polygon"?[ge.coordinates]:[];for(const Te of Me)for(const we of Te)for(const _e of c(we))be.push(_e);be.length&&fe.push({code:String(me.id===void 0||me.id===null?"":me.id),label:me.properties&&me.properties.name||String(me.id||""),properties:me.properties||{},rings:be})}return f.set(C,fe),fe}function o(C,ce){const fe=[];for(let me=0;me<C.length;me++){const[be,ge]=ce(C[me][0],C[me][1]);!Number.isFinite(be)||!Number.isFinite(ge)||fe.push(fe.length?"L":"M",he(be),he(ge))}return fe.length>2?I(fe):""}function h(C){let ce=null,fe=-1;for(const ge of C){if(!ge||ge.length<3)continue;let Me=0,Te=0,we=0;for(let Pe=0;Pe<ge.length;Pe++){const[je,Ie]=ge[Pe],[Ge,Ve]=ge[(Pe+1)%ge.length],at=je*Ve-Ge*Ie;Me+=at,Te+=(je+Ge)*at,we+=(Ie+Ve)*at}Me/=2;const _e=Math.abs(Me);_e<1e-9||_e>fe&&(fe=_e,ce=[Te/(6*Me),we/(6*Me)])}if(ce)return ce;const me=C.flat();if(!me.length)return null;const be=me.reduce((ge,[Me,Te])=>[ge[0]+Me,ge[1]+Te],[0,0]);return[be[0]/me.length,be[1]/me.length]}function B(C,ce,fe){const me=de(C,ce,fe);if(ce)return me;const be=C.max-C.min||1,ge=1/6;return Me=>me(C.min+(ge+(Me-C.min)/be*(1-ge))*be)}function E(C,ce){return(fe,me)=>{const[be,ge]=C(fe,me);return!Number.isFinite(be)||!Number.isFinite(ge)?[be,ge]:[Math.min(Math.max(be,ce.left),ce.right),Math.min(Math.max(ge,ce.top),ce.bottom)]}}function U(C){const ce=C.scheme||N(),{plot:fe,bound:me}=C;new W(C.groups.grid).finish(),new W(C.groups.axis).finish(),new W(C.groups.rules).finish(),new W(C.groups.labels).finish();const be=j(C.shapes,C.layer),ge=be?new Map:n({shapes:C.shapes,plot:fe,codeProperty:C.codeProperty}),Me=ge.size>0||!!be,Te=be?a(be.topology):null,we=new Map;if(Te)for(const Be of Te){we.set(Be.code,Be);const ot=Be.properties||{};ot.alpha3&&we.set(String(ot.alpha3).toUpperCase(),Be),ot.numeric&&we.set(String(Number(ot.numeric)),Be),ot.fips&&we.set(String(ot.fips),Be)}const _e=new Map,Pe=[],je=me.series[0];if(je)for(let Be=0;Be<je.points.length;Be++){const ot=je.points[Be];if(!oe(ot.y))continue;const A=me.categories[Be],ke=b(A),le=Te?[ke,A==null?"":String(A).trim().toUpperCase()].map(ye=>ye?we.get(ye):null).find(Boolean):null,Ae=le?le.code:null,pe=Te?Ae:Me?ke:$(ke);if(!pe||Me&&!Te&&!ge.has(pe)){me.labels[Be]&&Pe.push(me.labels[Be]);continue}const Se=_e.get(pe)||{value:0,labels:[]};Se.value+=ot.y,Se.labels.push(me.labels[Be]),_e.set(pe,Se)}const Ie=_e.has("AN")||_e.has("AQ"),Ge=l(fe,{antarctic:Ie});let Ve=null;if(Te){const Be=Ie?Te:Te.filter(A=>A.code!=="AQ"&&A.code!=="AN"),ot=O(C.projection||be.pack.projection,{...be.pack.projectionOptions||{},...C.projectionOptions||{}},A=>L(`chart:geomap:projection:${String(C.projection)}`,A));Ve={project:ot,...G({project:ot,rings:Be.flatMap(A=>A.rings),plot:fe,zoom:C.zoom,centre:C.centre,centreOffset:C.centreOffset}),drawn:Be}}const at=ee([..._e.values()].map(Be=>Be.value),{zero:!C.diverging,nice:!1}),mt=B(at,!!C.diverging,ce),ut=F("geomap");J(C.groups,fe,ut);const wt={left:fe.left-ut,top:fe.top-ut,right:fe.right+ut,bottom:fe.bottom+ut},kt=Ve?E(Ve.to,wt):null,jt=new W(C.groups.marks);if(!!C.graticule&&!!Ve){const Be=C.graticule&&typeof C.graticule=="object"&&C.graticule.step||30;for(const ot of te({step:Be}))for(const A of c(ot)){const ke=o(A,kt);if(!ke)continue;const le=jt.next("path",`${T}__graticule`);R(le,{d:ke,class:`${T}__graticule`})}}const Ot=[],Ut=Ve?Ve.drawn.map(Be=>Be.code):Me?[...ge.keys()]:e.filter(Be=>Be!=="AN"||Ie),Lt=Ve?new Map(Ve.drawn.map(Be=>[Be.code,Be])):null;for(const Be of Ut){const ot=Ve?Lt.get(Be).rings.map(le=>u(le,kt)).filter(Boolean).join(" "):Me?ge.get(Be):x(y[Be],Ge),A=_e.get(Be),ke=jt.next("path",`${T}__region ${T}__mark`);R(ke,{d:ot,fill:A?mt(A.value):"var(--lattice-chart-empty, #eceff1)","data-code":Be,class:`${T}__region ${T}__mark`}),Ot.push({code:Be,value:A?A.value:null,label:!Me&&i[Be]||Lt&&Lt.get(Be).label||A&&A.labels[0]||Be,element:ke,d:ot})}jt.finish();const Ft=new W(C.groups.overlay);if(Pe.length){const Be=Ft.next("text",`${T}__geo-note`);R(Be,{x:he(fe.left),y:he(fe.bottom),"text-anchor":"start"}),r(Be,C.grid.messages.t("chart.geoUnmatched",{count:Pe.length}))}Ft.finish();let It=0;if(C.labels&&C.labels.show&&Ve){const Be=Ot.filter(ot=>ot.value!==null).sort((ot,A)=>A.value-ot.value).map(ot=>{const A=Lt.get(ot.code).rings.map(le=>le.map(([Ae,pe])=>Ve.to(Ae,pe))),ke=h(A);return ke&&{x:ke[0],y:ke[1],text:ot.label}}).filter(Boolean);It=M({group:C.groups.labels,size:C.fontSize,minGap:C.labels.minGap,anchors:Be,plot:fe})}return{regions:Ot,ramp:mt,unmatched:Pe,useCountries:Me,packed:!!Ve,scale:Ve?Ve.scale:null,attribution:be&&be.pack.attribution||"",aspect:Ve?Ve.aspect:null,labelsDrawn:It}}function q(C){for(const ce of C.regions||[]){if(!ce.rings){ce.rings=P(ce.d);let me=1/0,be=1/0,ge=-1/0,Me=-1/0;for(const Te of ce.rings)for(const[we,_e]of Te)we<me&&(me=we),we>ge&&(ge=we),_e<be&&(be=_e),_e>Me&&(Me=_e);ce.box={minX:me,minY:be,maxX:ge,maxY:Me}}const fe=ce.box;if(!(!fe||C.x<fe.minX||C.x>fe.maxX||C.y<fe.minY||C.y>fe.maxY)&&ie(ce.rings,C.x,C.y))return ce}return null}function se(C){let fe=null,me=1/0;for(const be of C.markers||[]){if(!be)continue;const ge=(be.r||0)+3,Me=C.x-be.x,Te=C.y-be.y,we=Math.sqrt(Me*Me+Te*Te);we>ge||we>=me||(me=we,fe=be)}return fe}}),Qe("packages/modules/charts/network.js",function(s,K){"use strict";Object.defineProperty(s,"ITERATIONS",{enumerable:!0,get:function(){return N}}),Object.defineProperty(s,"LINK_GAP",{enumerable:!0,get:function(){return _}}),Object.defineProperty(s,"ICON_RADIUS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(s,"sequence",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"layoutNetwork",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"glyphFor",{enumerable:!0,get:function(){return P}}),Object.defineProperty(s,"glyphTransform",{enumerable:!0,get:function(){return he}}),Object.defineProperty(s,"offsetParallel",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"drawNetwork",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"emphasiseNetwork",{enumerable:!0,get:function(){return T}}),Object.defineProperty(s,"nodeAt",{enumerable:!0,get:function(){return i}}),Object.defineProperty(s,"linkAt",{enumerable:!0,get:function(){return y}});const W=K("packages/modules/charts/frame.js").Pool,de=K("packages/modules/charts/scheme.js").resolveScheme,ue=K("packages/modules/charts/svg.js"),V=ue.attrs,Q=ue.path,G=ue.round,te=ue.setText,c=K("packages/modules/charts/styles.js").NS,Y=K("packages/modules/charts/typography.js"),M=Y.applySize,k=Y.truncateTo,F=K("packages/modules/charts/rulecolour.js"),J=F.ruleColour,Z=F.ruleLegend,ne=K("packages/core/src/internal/util.js").warnOnce,N=220,X=2400,oe=.006,ee=.015,_=4,R=10;function ie(t){let m=t>>>0||1;return()=>(m^=m<<13,m>>>=0,m^=m>>17,m^=m<<5,m>>>=0,m/4294967296)}function I(t){const{nodes:m,links:g,plot:b}=t;if(!m.length)return m;const $=ie(m.length*2654435761),l=b.left+b.width/2,u=b.top+b.height/2,x=Math.min(b.width,b.height)/3;for(const d of m){const S=$()*Math.PI*2,p=x*(.35+$()*.65);d.x=l+Math.cos(S)*p,d.y=u+Math.sin(S)*p,d.vx=0,d.vy=0}for(const d of m)d.pinned=Number.isFinite(d.fx)&&Number.isFinite(d.fy),d.pinned&&(d.x=b.left+Math.max(0,Math.min(1,d.fx))*b.width,d.y=b.top+Math.max(0,Math.min(1,d.fy))*b.height);const n=t.iterations||N;for(let d=0;d<n;d++){const S=1-d/n;for(let p=0;p<m.length;p++){const w=m[p];for(let j=p+1;j<m.length;j++){const f=m[j];let a=w.x-f.x,o=w.y-f.y,h=Math.sqrt(a*a+o*o);h<.01&&(a=p-j||1,o=1,h=Math.sqrt(a*a+o*o));const B=X/(h*h),E=a/h*B,U=o/h*B;w.vx+=E,w.vy+=U,f.vx-=E,f.vy-=U}}for(const p of g){const w=p.source,j=p.target;if(w===j)continue;const f=j.x-w.x,a=j.y-w.y,o=oe*(p.weight||1);w.vx+=f*o,w.vy+=a*o,j.vx-=f*o,j.vy-=a*o}for(const p of m){if(p.pinned){p.vx=0,p.vy=0;continue}p.vx+=(l-p.x)*ee,p.vy+=(u-p.y)*ee,p.x+=p.vx*S*.08,p.y+=p.vy*S*.08,p.vx*=.82,p.vy*=.82,p.x=Math.max(b.left+8,Math.min(b.right-8,p.x)),p.y=Math.max(b.top+8,Math.min(b.bottom-8,p.y))}}return m}function P(t,m){if(!m)return null;const g=t&&t.icons;if(!g||typeof g.get!="function")return ne(`chart:icons:${m}`,`A network node asked for the icon '${m}', but this grid publishes no icon registry — a headless grid has no sprites. The node drew as a plain disc.`),null;const b=g.get(m);return b||(ne(`chart:icon:${m}`,`Unknown icon '${m}' on a network node; drew a plain disc instead. Register it with registerIcon or config.icons, or name a built-in.`),null)}function he(t,m){const g=String(t.viewBox||"0 0 16 16").trim().split(/[\s,]+/).map(Number),[b,$,l,u]=g.length===4&&g.every(Number.isFinite)?g:[0,0,16,16],x=Math.max(l||16,u||16),n=m.size/x,d=m.x-l*n/2,S=m.y-u*n/2;return`translate(${G(d-b*n)} ${G(S-$*n)}) scale(${G(n)})`}function r(t){const m=new Map;for(const g of t){const b=g.pair||`${g.source.key}\0${g.target.key}`;m.has(b)||m.set(b,[]),m.get(b).push(g)}for(const g of m.values()){const b=g.length;for(let $=0;$<b;$++){const l=g[$],u=l.source,x=l.target,n=x.x-u.x,d=x.y-u.y,S=Math.sqrt(n*n+d*d)||1,p=S?-d/S:0,w=S?n/S:1,j=($-(b-1)/2)*_;l.offset=j,l.bundled=b>1,l.line={x1:u.x+p*j,y1:u.y+w*j,x2:x.x+p*j,y2:x.y+w*j}}}}function D(t){const m=t.scheme||de(),{plot:g,bound:b}=t;for(const h of["grid","axis","rules","labels"])new W(t.groups[h]).finish();const $=b.nodes,l=b.links.map(h=>({...h,weight:h.value}));if(!$.length)return{nodes:[],links:[],legend:[]};const u=l.reduce((h,B)=>Math.max(h,B.value),0)||1;for(const h of l)h.weight=h.value/u;I({nodes:$,links:l,plot:g,iterations:t.iterations}),r(l);const x=b.measure&&b.measure.col||null,n=new Set;for(const h of l)h.colour=J({grid:t.grid,col:x,value:h.value}),h.colour&&n.add(h.colour);const d=$.reduce((h,B)=>Math.max(h,B.in+B.out),0)||1,S=new W(t.groups.marks),p=Number.isFinite(t.linkWidth)&&t.linkWidth>0?Number(t.linkWidth):null;for(const h of l){h.drawnWidth=p===null?.5+h.weight*3:p;const B=S.next("path",`${c}__edge ${c}__mark`);V(B,{d:Q(["M",G(h.line.x1),G(h.line.y1),"L",G(h.line.x2),G(h.line.y2)]),style:h.colour?`stroke:${h.colour};stroke-opacity:1`:null,"stroke-width":G(h.drawnWidth),fill:"none"}),h.el=B}for(const h of $){const B=(h.in+h.out)/d,E=h.icon||t.icon||null;h.glyph=P(t.grid,E),h.r=4+Math.sqrt(B)*12,h.glyph&&(h.r=Math.max(h.r,R));const U=S.next("circle",`${c}__node ${c}__mark`);V(U,{cx:G(h.x),cy:G(h.y),r:G(h.r),fill:m.series(h.index),"data-node":h.key}),h.el=U}S.finish();const w=new W(t.groups.overlay),j=[];for(const h of $){if(!h.glyph){h.glyphEls=[];continue}const B=h.glyph.paint==="stroke",E=he(h.glyph,{x:h.x,y:h.y,size:h.r*1.3});h.glyphEls=h.glyph.paths.map(U=>{const q=w.next("path",`${c}__node-icon${B?` ${c}__node-icon--stroke`:""}`);return V(q,{d:U,transform:E}),q}),j.push(...h.glyphEls)}const f=t.typography&&t.typography.small||t.fontSize,a=$.filter(h=>h.declared),o=$.filter(h=>!h.declared).sort((h,B)=>B.in+B.out-(h.in+h.out)).slice(0,12);for(const h of[...a,...o]){const B=w.next("text",`${c}__flow-label`);M(B,f),V(B,{x:G(h.x),y:G(h.y+h.r+f),"text-anchor":"middle"}),te(B,k(h.label,90,f)),h.labelEl=B}return w.finish(),{nodes:$,links:l,glyphs:j,legend:Z({grid:t.grid,col:x,colours:n})}}function T(t){const m=t.drawn||{},g=t.keys||new Set,b=g.size>0;let $=0;const l=new Set;for(const u of m.links||[]){const x=b&&(u.rowKeys||[]).some(n=>g.has(n));x&&($++,l.add(u.source),l.add(u.target)),e(u.el,b&&!x)}for(const u of m.nodes||[]){const x=l.has(u);x&&$++,e(u.el,b&&!x);for(const n of u.glyphEls||[])e(n,b&&!x)}return $}function e(t,m){!t||!t.setAttribute||(m?t.setAttribute("data-dim","true"):t.removeAttribute("data-dim"))}function i(t){const m=typeof t.slack=="number"?t.slack:2;let g=null,b=1/0;for(const $ of t.nodes||[]){if(typeof $.x!="number"||typeof $.y!="number")continue;const l=t.x-$.x,u=t.y-$.y,x=Math.sqrt(l*l+u*u);x<=($.r||0)+m&&x<b&&(b=x,g=$)}return g}function y(t){let m=null,g=1/0;for(const b of t.links||[]){const $=b.line,l=$?{x:$.x1,y:$.y1}:b.source,u=$?{x:$.x2,y:$.y2}:b.target;if(!l||!u||typeof l.x!="number"||typeof u.x!="number")continue;const x=u.x-l.x,n=u.y-l.y,d=x*x+n*n,S=d?Math.max(0,Math.min(1,((t.x-l.x)*x+(t.y-l.y)*n)/d)):0,p=t.x-(l.x+S*x),w=t.y-(l.y+S*n),j=Math.sqrt(p*p+w*w),f=Number.isFinite(b.drawnWidth)?b.drawnWidth:.5+(b.weight||0)*3,a=b.bundled?Math.min(Math.max(2,f/2),_/2):Math.max(3,f/2);j<=a&&j<g&&(g=j,m=b)}return m}}),Qe("packages/modules/charts/flow.js",function(s,K){"use strict";Object.defineProperty(s,"assignDepths",{enumerable:!0,get:function(){return _}}),Object.defineProperty(s,"layoutSankey",{enumerable:!0,get:function(){return R}}),Object.defineProperty(s,"ribbon",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"drawSankey",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"layoutChord",{enumerable:!0,get:function(){return P}}),Object.defineProperty(s,"drawChord",{enumerable:!0,get:function(){return he}}),Object.defineProperty(s,"describeLink",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"flowNodeAt",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"ribbonAt",{enumerable:!0,get:function(){return T}}),Object.defineProperty(s,"chordArcAt",{enumerable:!0,get:function(){return e}}),Object.defineProperty(s,"chordRibbonAt",{enumerable:!0,get:function(){return i}}),Object.defineProperty(s,"chordPolygon",{enumerable:!0,get:function(){return y}});const W=K("packages/modules/charts/frame.js").Pool,de=K("packages/modules/charts/format.js").measureText,V=K("packages/modules/charts/scheme.js").resolveScheme,Q=K("packages/modules/charts/svg.js"),G=Q.attrs,te=Q.insideRings,O=Q.path,c=Q.round,Y=Q.setText,k=K("packages/modules/charts/styles.js").NS,F=K("packages/modules/charts/typography.js"),J=F.applySize,Z=F.textWidth,L=F.truncateTo,ne=Math.PI*2,N=12,X=8,oe=-Math.PI/2,ee=16;function _(t,m){for(const u of t)u.depth=0;const g=t.length+1;for(let u=0;u<g;u++){let x=!1;for(const n of m){if(n.source===n.target)continue;const d=n.source.depth+1;d>n.target.depth&&d<g&&(n.target.depth=d,x=!0)}if(!x)break}const b=t.reduce((u,x)=>Math.max(u,x.depth),0),$=new Set,l=new Set;for(const u of m)u.source!==u.target&&($.add(u.source),l.add(u.target));for(const u of t)!$.has(u)&&l.has(u)&&(u.depth=b);return b+1}function R(t){const{nodes:m,links:g,plot:b}=t,$=_(m,g),l=t.nodeWidth||N,u=new Map;for(const p of m)u.has(p.depth)||u.set(p.depth,[]),u.get(p.depth).push(p);let x=0;for(const p of u.values()){const w=p.reduce((f,a)=>f+Math.max(a.in,a.out),0),j=Math.max(0,p.length-1)*X;w>0&&(x=Math.max(x,w/Math.max(1,b.height-j)))}const n=x>0?1/x:0,d=$>1?(b.width-l)/($-1):0;for(const[p,w]of u){w.sort((o,h)=>Math.max(h.in,h.out)-Math.max(o.in,o.out));const j=w.map(o=>Math.max(1,Math.max(o.in,o.out)*n)),f=j.reduce((o,h)=>o+h,0)+(w.length-1)*X;let a=b.top+Math.max(0,(b.height-f)/2);w.forEach((o,h)=>{o.x=b.left+p*d,o.width=l,o.y=a,o.height=j[h],o.inAt=a,o.outAt=a,a+=j[h]+X})}const S=g.slice().sort((p,w)=>p.source.y-w.source.y||w.value-p.value);for(const p of S){const w=Math.max(1,p.value*n);p.thickness=w,p.y0=p.source.outAt+w/2,p.source.outAt+=w}for(const p of S.slice().sort((w,j)=>w.target.y-j.target.y||j.value-w.value))p.y1=p.target.inAt+p.thickness/2,p.target.inAt+=p.thickness;return{columns:$,scale:n}}function ie(t){const m=t.source.x+t.source.width,g=t.target.x,b=(m+g)/2,$=t.thickness/2;return O(["M",c(m),c(t.y0-$),"C",c(b),c(t.y0-$),c(b),c(t.y1-$),c(g),c(t.y1-$),"L",c(g),c(t.y1+$),"C",c(b),c(t.y1+$),c(b),c(t.y0+$),c(m),c(t.y0+$),"Z"])}function I(t){const m=t.scheme||V(),{plot:g,bound:b}=t;for(const d of["grid","axis","rules","labels"])new W(t.groups[d]).finish();const $=b.nodes,l=b.links;if(!$.length||!l.length)return{nodes:[],links:[]};R({nodes:$,links:l,plot:g});const u=new W(t.groups.marks);for(const d of l){const S=u.next("path",`${k}__ribbon ${k}__mark`);G(S,{d:ie(d),fill:m.series(d.source.index),"data-link":`${d.source.key}->${d.target.key}`})}for(const d of $)G(u.next("rect",`${k}__node ${k}__mark`),{x:c(d.x),y:c(d.y),width:c(d.width),height:c(d.height),fill:m.series(d.index),"data-node":d.key});u.finish();const x=new W(t.groups.overlay),n=t.typography&&t.typography.small||t.fontSize;for(const d of $){const S=d.x<g.left+g.width/2,p=x.next("text",`${k}__flow-label`);J(p,n),G(p,{x:c(S?d.x+d.width+4:d.x-4),y:c(d.y+d.height/2),"text-anchor":S?"start":"end","dominant-baseline":"middle"});const w=S?g.right-(d.x+d.width)-6:d.x-g.left-6;Y(p,L(d.label,Math.max(0,w),n))}return x.finish(),{nodes:$,links:l}}function P(t){const{nodes:m,links:g}=t,b=new Map;for(const p of m)b.set(p.key,0);for(const p of g)b.set(p.source.key,(b.get(p.source.key)||0)+p.value),b.set(p.target.key,(b.get(p.target.key)||0)+p.value);const $=[...b.values()].reduce((p,w)=>p+w,0);if($<=0)return{arcs:[],ribbons:[]};const l=Math.min(.04,ne/(m.length*8||1)),u=ne-l*m.length,x=[];let n=-Math.PI/2;const d=new Map;for(const p of m){const j=(b.get(p.key)||0)/$*u;x.push({node:p,from:n,to:n+j}),d.set(p.key,n),n+=j+l}const S=[];for(const p of g.slice().sort((w,j)=>j.value-w.value)){const w=p.value/$*u,j=d.get(p.source.key),f=d.get(p.target.key);d.set(p.source.key,j+w),d.set(p.target.key,f+w),S.push({link:p,source:{from:j,to:j+w},target:{from:f,to:f+w}})}return{arcs:x,ribbons:S}}function he(t){const m=t.scheme||V(),{plot:g,bound:b}=t;for(const a of["grid","axis","rules","labels"])new W(t.groups[a]).finish();const $=g.left+g.width/2,l=g.top+g.height/2,u=t.typography&&t.typography.small||t.fontSize,x=Math.max(...b.nodes.map(a=>Z(a.label,u)),0),n=Math.max(10,Math.min(g.width,g.height)/2-Math.min(x+8,90)),d=n*.92,{arcs:S,ribbons:p}=P({nodes:b.nodes,links:b.links,cx:$,cy:l,radius:n}),w=(a,o)=>[$+o*Math.cos(a),l+o*Math.sin(a)],j=new W(t.groups.marks);for(const{link:a,source:o,target:h}of p){const[B,E]=w(o.from,d),[U,q]=w(o.to,d),[se,C]=w(h.from,d),[ce,fe]=w(h.to,d);G(j.next("path",`${k}__ribbon ${k}__mark`),{d:O(["M",c(B),c(E),"A",c(d),c(d),0,0,1,c(U),c(q),"Q",c($),c(l),c(se),c(C),"A",c(d),c(d),0,0,1,c(ce),c(fe),"Q",c($),c(l),c(B),c(E),"Z"]),fill:m.series(a.source.index),"fill-opacity":.55,"data-link":`${a.source.key}->${a.target.key}`})}for(const a of S){const[o,h]=w(a.from,n),[B,E]=w(a.to,n),[U,q]=w(a.to,d),[se,C]=w(a.from,d),ce=a.to-a.from>Math.PI?1:0;G(j.next("path",`${k}__node ${k}__mark`),{d:O(["M",c(o),c(h),"A",c(n),c(n),0,ce,1,c(B),c(E),"L",c(U),c(q),"A",c(d),c(d),0,ce,0,c(se),c(C),"Z"]),fill:m.series(a.node.index),"data-node":a.node.key})}j.finish();const f=new W(t.groups.overlay);for(const a of S){const o=(a.from+a.to)/2,[h,B]=w(o,n+6),E=f.next("text",`${k}__flow-label`);J(E,u);const U=Math.cos(o)>=0;G(E,{x:c(h),y:c(B),"text-anchor":U?"start":"end","dominant-baseline":"middle"}),Y(E,a.node.label)}return f.finish(),{arcs:S,ribbons:p,ring:{cx:$,cy:l,inner:d,radius:n}}}function r(t,m){return`${t.source.label} → ${t.target.label}: ${de(t.value,m)}`}function D(t){for(const m of t.nodes||[])if(!(typeof m.x!="number"||typeof m.width!="number")&&t.x>=m.x&&t.x<=m.x+m.width&&t.y>=m.y&&t.y<=m.y+m.height)return m;return null}function T(t){let m=null,g=1/0;for(const b of t.links||[]){const $=b.source,l=b.target;if(!$||!l||typeof b.y0!="number")continue;const u=$.x+$.width,x=l.x;if(t.x<Math.min(u,x)||t.x>Math.max(u,x))continue;const n=(u+x)/2,d=o=>{const h=1-o;return h*h*h*u+3*h*h*o*n+3*h*o*o*n+o*o*o*x};let S=0,p=1;for(let o=0;o<24;o++){const h=(S+p)/2;d(h)<t.x?S=h:p=h}const w=(S+p)/2,j=1-w,f=j*j*j*b.y0+3*j*j*w*b.y0+3*j*w*w*b.y1+w*w*w*b.y1,a=Math.max(1,b.thickness||1)/2;Math.abs(t.y-f)<=a&&(b.thickness||1)<g&&(g=b.thickness||1,m=b)}return m}function e(t){const m=t.ring;if(!m)return null;const g=t.x-m.cx,b=t.y-m.cy,$=Math.sqrt(g*g+b*b);if($<m.inner||$>m.radius)return null;let l=Math.atan2(b,g);for(;l<oe;)l+=ne;for(;l>=oe+ne;)l-=ne;for(const u of t.arcs||[])if(l>=u.from&&l<u.to)return u;return null}function i(t){const m=t.ring;if(!m)return null;const g=t.x-m.cx,b=t.y-m.cy;if(Math.sqrt(g*g+b*b)>m.inner)return null;for(const $ of t.ribbons||[])if(te([y($,m)],t.x,t.y))return $;return null}function y(t,m){const{cx:g,cy:b,inner:$}=m,l=d=>[g+$*Math.cos(d),b+$*Math.sin(d)],u=[],x=(d,S)=>{for(let p=0;p<=ee;p++)u.push(l(d+(S-d)*p/ee))},n=(d,S)=>{for(let p=1;p<ee;p++){const w=p/ee,j=1-w;u.push([j*j*d[0]+2*j*w*g+w*w*S[0],j*j*d[1]+2*j*w*b+w*w*S[1]])}};return x(t.source.from,t.source.to),n(l(t.source.to),l(t.target.from)),x(t.target.from,t.target.to),n(l(t.target.to),l(t.source.from)),u}}),Qe("packages/modules/charts/hit.js",function(s,K){"use strict";Object.defineProperty(s,"valueText",{enumerable:!0,get:function(){return X}}),Object.defineProperty(s,"ownsGeometry",{enumerable:!0,get:function(){return P}}),Object.defineProperty(s,"resolveHit",{enumerable:!0,get:function(){return he}});const W=K("packages/modules/charts/format.js").measureText,de=K("packages/modules/charts/treemap.js").tileAt,ue=K("packages/modules/charts/geo.js"),V=ue.markerAt,Q=ue.regionAt,te=K("packages/modules/charts/matrix.js").cellAt,O=K("packages/modules/charts/network.js"),c=O.linkAt,Y=O.nodeAt,M=K("packages/modules/charts/flow.js"),k=M.chordArcAt,F=M.chordRibbonAt,J=M.flowNodeAt,Z=M.ribbonAt,L=" → ",ne=" – ",N=" › ";function X(r,D,T){const e=W(r,T);if(!D||typeof r!="number"||!Number.isFinite(r))return e;const i=r/D;return Number.isFinite(i)?`${e} (${T.number(i,{style:"percent",maximumFractionDigits:1})})`:e}function oe(r,D){const T=r.item.node,e=D.bound.root&&D.bound.root.total||0,i=Array.isArray(r.path)?[...r.path]:[T.label];return{heading:i.length>1?i.join(N):T.label,rows:[{label:D.bound.measure.title,value:X(T.total,e,D.grid.messages),colour:D.scheme.series(r.item.index||0)}],datum:{label:T.label,value:T.total,category:T.value,column:D.bound.measure.col&&D.spec.x||null,series:null,depth:r.depth,path:i,rowKeys:T.rowKey?[T.rowKey]:[]}}}function ee(r,D,T){const e=D.reduce((i,y)=>i+(y.value||0),0);return{heading:r.label||r.code,rows:[{label:T.bound.measure.title,value:X(r.value,e,T.grid.messages),colour:T.scheme.series(0)}],datum:{label:r.label||r.code,value:r.value,category:r.code,column:T.spec.code||T.spec.x||null,series:null,path:[r.label||r.code],rowKeys:[]}}}function _(r,D,T){const e=T.spec.value||T.spec.y||null,i=e?T.grid.columns.get(e):null,y=g=>`${Number(g).toFixed(4)}°`,t=(D.legend||[]).find(g=>g.colour===r.fill)||null,m=[{label:i&&i.title||e||"",value:r.text||"",colour:r.fill},{label:"",value:`${y(r.lat)}, ${y(r.lon)}`,colour:"transparent"}];return t&&t.label&&m.push({label:"",value:t.label,colour:r.fill}),{heading:r.label||r.text||"",rows:m,datum:{label:r.label||r.text||"",value:r.value,category:r.value,column:e,series:null,path:[r.label||r.text||""],lon:r.lon,lat:r.lat,status:t?t.label:null,rowKeys:r.rowKey?[r.rowKey]:[]}}}function R(r,D){const T=y=>{const t=D.grid.columns.get(y);return t&&t.title||y},e=T(r.a),i=T(r.b);return{heading:`${e} × ${i}`,rows:[{label:D.spec.method==="spearman"?"ρ":"r",value:typeof r.r=="number"&&Number.isFinite(r.r)?r.r.toFixed(2):"",colour:D.scheme.series(0)}],datum:{label:`${e} × ${i}`,value:typeof r.r=="number"?r.r:null,category:null,column:null,series:null,path:[e,i],rowKeys:[]}}}function ie(r,D){const T=[];for(const i of D.drawn&&D.drawn.links||[])if(!(i.source!==r&&i.target!==r))for(const y of i.rowKeys||[])T.includes(y)||T.push(y);const e=Math.max(r.in||0,r.out||0);return{heading:r.label,rows:[{label:D.bound.measure.title,value:W(e,D.grid.messages),colour:D.scheme.series(r.index||0)}],datum:{label:r.label,value:e,category:r.value===void 0?r.key:r.value,column:null,series:null,path:[r.label],rowKeys:T}}}function I(r,D){const T=`${r.source.label}${r.undirected?ne:L}${r.target.label}`;return{heading:T,rows:[{label:D.bound.measure.title,value:X(r.value,r.undirected?0:D.bound.total||0,D.grid.messages),colour:r.colour||D.scheme.series(r.source.index||0)}],datum:{label:T,value:r.value,category:null,column:null,series:null,path:[r.source.label,r.target.label],rowKeys:Array.isArray(r.rowKeys)?[...r.rowKeys]:[]}}}function P(r){return r?!!(Array.isArray(r.tiles)||Array.isArray(r.regions)||Array.isArray(r.markers)||Array.isArray(r.cells)&&Array.isArray(r.columns)||Array.isArray(r.ribbons)&&r.ring||Array.isArray(r.nodes)&&Array.isArray(r.links)):!1}function he(r){const D=r.drawn;if(!D||!r.bound||!P(D))return null;const{x:T,y:e}=r.at;if(Array.isArray(D.tiles)){const i=de({tiles:D.tiles,x:T,y:e});return i?oe(i,r):null}if(Array.isArray(D.regions)){const i=Q({regions:D.regions,x:T,y:e});return i?ee(i,D.regions,r):null}if(Array.isArray(D.markers)){const i=V({markers:D.markers,x:T,y:e});return i?_(i,D,r):null}if(Array.isArray(D.cells)&&Array.isArray(D.columns)){const i=te({cells:D.cells,x:T,y:e});return i?R(i,r):null}if(Array.isArray(D.ribbons)&&D.ring){const i=F({ribbons:D.ribbons,ring:D.ring,x:T,y:e});if(i)return I(i.link,r);const y=k({arcs:D.arcs,ring:D.ring,x:T,y:e});return y?ie(y.node,r):null}if(Array.isArray(D.nodes)&&Array.isArray(D.links)){const i=D.nodes.some(m=>typeof m.r=="number"),y=i?Y({nodes:D.nodes,x:T,y:e}):J({nodes:D.nodes,x:T,y:e});if(y)return ie(y,r);const t=i?c({links:D.links,x:T,y:e}):Z({links:D.links,x:T,y:e});return t?I(t,r):null}return null}}),Qe("packages/modules/charts/polar.js",function(s,K){"use strict";Object.defineProperty(s,"arcBand",{enumerable:!0,get:function(){return R}}),Object.defineProperty(s,"drawRadar",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"drawGauge",{enumerable:!0,get:function(){return I}});const W=K("packages/modules/charts/frame.js").Pool,de=K("packages/modules/charts/format.js").measureText,ue=K("packages/modules/charts/scale.js"),V=ue.isNumber,Q=ue.measureDomain,G=K("packages/modules/charts/svg.js"),te=G.attrs,O=G.path,c=G.round,Y=G.setText,k=K("packages/modules/charts/styles.js").NS,J=K("packages/modules/charts/scheme.js").resolveScheme,Z=K("packages/modules/charts/labels.js"),L=Z.drawAnchoredLabels,ne=Z.labelText,N=Math.PI*2,X=4,oe=N*2/3,ee=Math.PI/2+(N-oe)/2;function _(P,he,r,D){const T=D-Math.PI/2;return[P+r*Math.cos(T),he+r*Math.sin(T)]}function R(P){const he=P.to-P.from;if(he<=0)return"";const r=Math.max(0,P.r-P.width),D=he>Math.PI?1:0,[T,e]=_(P.cx,P.cy,P.r,P.from),[i,y]=_(P.cx,P.cy,P.r,P.to),[t,m]=_(P.cx,P.cy,r,P.to),[g,b]=_(P.cx,P.cy,r,P.from);return O(["M",c(T),c(e),"A",c(P.r),c(P.r),0,D,1,c(i),c(y),"L",c(t),c(m),"A",c(r),c(r),0,D,0,c(g),c(b),"Z"])}function ie(P){const he=P.scheme||J(),{plot:r,bound:D}=P;new W(P.groups.grid).finish(),new W(P.groups.axis).finish(),new W(P.groups.rules).finish(),new W(P.groups.labels).finish();const T=r.left+r.width/2,e=r.top+r.height/2,i=Math.max(0,Math.min(r.width,r.height)/2-P.fontSize*2),y=D.labels,t=D.series.filter(n=>!P.hidden.has(n.key)),m=[];for(const n of t)for(const d of n.points)m.push(d.y);const g=Q(m,{zero:!0}),b=y.length?N/y.length:N,$=n=>{const d=g.max-g.min||1;return Math.max(0,(n-g.min)/d*i)},l=new W(P.groups.grid);for(let n=1;n<=X;n++){const d=i*n/X,S=y.map((p,w)=>_(T,e,d,w*b));te(l.next("path",`${k}__web`),{d:S.length?O([...S.flatMap(([p,w],j)=>[j?"L":"M",c(p),c(w)]),"Z"]):"",fill:"none"})}for(let n=0;n<y.length;n++){const[d,S]=_(T,e,i,n*b);te(l.next("path",`${k}__web`),{d:O(["M",c(T),c(e),"L",c(d),c(S)]),fill:"none"})}l.finish();const u=new W(P.groups.marks);for(const n of t){const d=[];for(let w=0;w<y.length;w++){const j=n.points[w],f=V(j&&j.y)?j.y:g.min,[a,o]=_(T,e,$(f),w*b);d.push([c(a),c(o)]),j&&(j.px=c(a),j.py=c(o))}const S=d.length?O([...d.flatMap(([w,j],f)=>[f?"L":"M",w,j]),"Z"]):"",p=he.series(n.index);te(u.next("path",`${k}__radar-fill ${k}__mark`),{d:S,fill:p,"data-series":n.index}),te(u.next("path",`${k}__radar-line ${k}__mark`),{d:S,stroke:p,fill:"none","data-series":n.index})}u.finish();const x=new W(P.groups.overlay);for(let n=0;n<y.length;n++){const[d,S]=_(T,e,i+P.fontSize,n*b),p=x.next("text",`${k}__tick`),w=Math.abs(d-T)<1?"middle":d>T?"start":"end";te(p,{x:c(d),y:c(S),"text-anchor":w,"dominant-baseline":"middle"}),Y(p,y[n])}if(x.finish(),P.labels&&P.labels.show){const n=P.typography&&P.typography.small||P.fontSize||11,d=[];for(const S of t)for(const p of S.points){if(!p||p.px===void 0||!V(p.y))continue;const w=p.px-T,j=p.py-e,f=Math.hypot(w,j)||1;d.push({x:c(p.px+w/f*(n*.8)),y:c(p.py+j/f*(n*.8)),text:ne(p.y,P.labels,P.grid)})}L({group:P.groups.labels,size:n,minGap:P.labels.minGap,anchors:d,plot:r})}return{centre:{x:T,y:e,r:i},series:t,axes:y}}function I(P){const he=P.scheme||J(),{plot:r,bound:D}=P;new W(P.groups.grid).finish(),new W(P.groups.axis).finish(),new W(P.groups.rules).finish(),new W(P.groups.labels).finish();const T=D.series[0],i=(T?T.points.filter(p=>V(p.y)):[]).reduce((p,w)=>p+w.y,0),y=V(P.min)?P.min:0,t=V(P.max)?P.max:Math.max(i,1),m=t-y||1,g=Math.min(1,Math.max(0,(i-y)/m)),b=r.left+r.width/2,$=r.top+r.height/2,l=Math.max(0,Math.min(r.width,r.height)/2-4),u=Math.max(6,l*.24),x=new W(P.groups.marks);if(te(x.next("path",`${k}__gauge-track`),{d:R({cx:b,cy:$,r:l,width:u,from:ee,to:ee+oe})}),te(x.next("path",`${k}__gauge-value ${k}__mark`),{d:R({cx:b,cy:$,r:l,width:u,from:ee,to:ee+oe*g}),fill:he.series(0)}),V(P.target)){const p=Math.min(1,Math.max(0,(P.target-y)/m)),w=ee+oe*p,[j,f]=_(b,$,l-u,w),[a,o]=_(b,$,l,w);te(x.next("path",`${k}__gauge-target`),{d:O(["M",c(j),c(f),"L",c(a),c(o)]),fill:"none"})}x.finish();const n=new W(P.groups.overlay),d=n.next("text",`${k}__gauge-reading`);te(d,{x:c(b),y:c($),"text-anchor":"middle","dominant-baseline":"middle"}),Y(d,de(i,P.grid.messages));const S=n.next("text",`${k}__gauge-caption`);return te(S,{x:c(b),y:c($+P.fontSize*1.6),"text-anchor":"middle","dominant-baseline":"middle"}),Y(S,D.measure.title||""),n.finish(),{value:i,domain:{min:y,max:t}}}}),Qe("packages/modules/charts/multiples.js",function(s,K){"use strict";Object.defineProperty(s,"MAX_PANELS",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(s,"panelGrid",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"panelRects",{enumerable:!0,get:function(){return v}}),Object.defineProperty(s,"splitPanels",{enumerable:!0,get:function(){return de}}),Object.defineProperty(s,"sharedDomain",{enumerable:!0,get:function(){return ue}});const xe=24;function W(V,Q){if(V<=1)return{columns:1,rows:1};const G=(Q.width||1)/(Q.height||1);let te=Math.max(1,Math.round(Math.sqrt(V*G)));te=Math.min(te,V);const O=Math.ceil(V/te);return{columns:te,rows:O}}function v(V){const Q=Math.min(V.count,xe),G=V.gap===void 0?10:V.gap,te=V.titleHeight===void 0?14:V.titleHeight,{columns:O,rows:c}=W(Q,V.plot),Y=(V.plot.width-G*(O-1))/O,M=(V.plot.height-G*(c-1))/c,k=[];for(let F=0;F<Q;F++){const J=F%O,Z=Math.floor(F/O);k.push({index:F,x:V.plot.left+J*(Y+G),y:V.plot.top+Z*(M+G)+te,width:Math.max(0,Y),height:Math.max(0,M-te)})}return k}function de(V){return V.series.map((Q,G)=>({label:Q.label,key:Q.key,index:G,bound:{...V,series:[{...Q,index:G}]}}))}function ue(V,Q,G){const te=[];for(const O of V.series)for(const c of O.points)te.push(c.y);return G(te,{zero:Q})}}),Qe("packages/modules/charts/stream.js",function(s,K){"use strict";Object.defineProperty(s,"wiggleBaseline",{enumerable:!0,get:function(){return he}}),Object.defineProperty(s,"drawStream",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"drawMarimekko",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"drawViolin",{enumerable:!0,get:function(){return T}});const xe=K("packages/modules/charts/axis.js"),W=xe.drawAxisLines,v=xe.drawCategoryAxis,de=xe.drawMeasureAxis,ue=K("packages/modules/charts/distribution.js"),V=ue.density,Q=ue.distributionDomain,G=ue.summarise,te=ue.valuesByCategory,O=K("packages/modules/charts/frame.js"),c=O.Pool,Y=O.shouldRotate,k=K("packages/modules/charts/format.js").formatters,F=K("packages/modules/charts/scale.js"),J=F.bandScale,Z=F.isNumber,L=F.linearScale,ne=F.measureDomain,X=K("packages/modules/charts/scheme.js").resolveScheme,oe=K("packages/modules/charts/svg.js"),ee=oe.attrs,_=oe.path,R=oe.round,I=K("packages/modules/charts/styles.js").NS,P=32;function he(e){const i=[];let y=0;for(let t=0;t<e.length;t++){const m=e[t],g=m.reduce((u,x)=>u+x,0);if(t===0){y=-g/2,i.push(y);continue}const b=e[t-1];let $=0;const l=m.length;for(let u=0;u<l;u++){let x=0;for(let n=0;n<u;n++)x+=(m[n]||0)-(b[n]||0);$+=(l-u-.5)*((m[u]||0)-(b[u]||0))+x*0}y-=l>0?$/l:0,i.push(y)}return i}function r(e){const i=e.scheme||X(),{plot:y,bound:t}=e;new c(e.groups.grid).finish(),new c(e.groups.rules).finish(),new c(e.groups.labels).finish();const m=t.series.filter(d=>!e.hidden.has(d.key)),g=t.categories.map((d,S)=>m.map(p=>{const w=p.points[S];return Z(w&&w.y)?Math.max(0,w.y):0})),b=he(g),$=[];g.forEach((d,S)=>{$.push(b[S]),$.push(b[S]+d.reduce((p,w)=>p+w,0))});const l=ne($,{zero:!1,nice:!1}),u=L(l,[y.bottom,y.top]),x=J(t.categories,[y.left,y.right],0),n=new c(e.groups.marks);return m.forEach((d,S)=>{const p=[],w=[];g.forEach((f,a)=>{let o=b[a];for(let B=0;B<S;B++)o+=f[B];const h=R(x.centre(t.categories[a]));w.push([h,R(u.of(o))]),p.push([h,R(u.of(o+f[S]))])});const j=[];p.forEach(([f,a],o)=>j.push(o?"L":"M",f,a));for(let f=w.length-1;f>=0;f--)j.push("L",w[f][0],w[f][1]);j.push("Z"),ee(n.next("path",`${I}__stream ${I}__mark`),{d:_(j),fill:i.series(d.index),"data-series":d.index})}),n.finish(),v({group:e.groups.overlay,plot:y,scale:x,labels:t.labels,fontSize:e.typography&&e.typography.small||e.fontSize,rotated:Y(t.labels,x.step,e.fontSize,(e.axis&&e.axis.x||{}).every),config:e.axis&&e.axis.x||{}}),{xScale:x,yScale:u,series:m}}function D(e){const i=e.scheme||X(),{plot:y,bound:t}=e,m=t.series.filter(w=>!e.hidden.has(w.key)),g=t.categories.map((w,j)=>m.reduce((f,a)=>{const o=a.points[j];return f+(Z(o&&o.y)?Math.abs(o.y):0)},0)),b=g.reduce((w,j)=>w+j,0);if(b<=0)return{series:m,columns:[]};const $=2,l=y.width-$*Math.max(0,t.categories.length-1),u=L({min:0,max:100},[y.bottom,y.top]);de({gridGroup:e.groups.grid,axisGroup:e.groups.axis,plot:y,scale:u,format:k(e.grid,{kind:"linear",step:20}),config:e.axis&&e.axis.y||{},grid:e.grid,size:e.typography&&e.typography.small||e.fontSize}),W({group:e.groups.rules,plot:y});const x=new c(e.groups.marks),n=[];let d=y.left;t.categories.forEach((w,j)=>{const f=g[j]/b*l;let a=y.bottom;m.forEach((o,h)=>{const B=o.points[j],E=Z(B&&B.y)?Math.abs(B.y):0,q=(g[j]>0?E/g[j]:0)*y.height;ee(x.next("rect",`${I}__bar ${I}__mark`),{x:R(d),y:R(a-q),width:R(Math.max(0,f)),height:R(Math.max(0,q)),fill:i.series(o.index),"data-series":o.index,"data-point":j}),B&&(B.px=R(d+f/2),B.py=R(a-q)),a-=q}),n.push({category:w,label:t.labels[j],x:d,width:f,total:g[j]}),d+=f+$}),x.finish();const S=new c(e.groups.overlay),p=e.typography&&e.typography.small||e.fontSize;for(const w of n){if(w.width<p*2)continue;const j=S.next("text",`${I}__tick`);j.style.fontSize=`${p}px`,ee(j,{x:R(w.x+w.width/2),y:R(y.top-2),"text-anchor":"middle"}),j.textContent=w.label}return S.finish(),{series:m,columns:n}}function T(e){const i=e.scheme||X(),{plot:y,bound:t}=e,m=te(t),g=[...m.keys()],b=[];for(const n of m.values())for(let d=0;d<n.length;d++)b.push(n[d]);const $=Q(b,e.axis),l=L($,[y.bottom,y.top]),u=J(g,[y.left,y.right],.3);de({gridGroup:e.groups.grid,axisGroup:e.groups.axis,plot:y,scale:l,format:k(e.grid,{kind:"linear",step:($.max-$.min)/5}),config:e.axis&&e.axis.y||{},grid:e.grid,size:e.typography&&e.typography.small||e.fontSize}),v({group:e.groups.overlay,plot:y,scale:u,labels:g,fontSize:e.typography&&e.typography.small||e.fontSize,rotated:g.length>6,config:e.axis&&e.axis.x||{}}),W({group:e.groups.rules,plot:y});const x=new c(e.groups.marks);return g.forEach((n,d)=>{const S=m.get(n),p=V(S,$,P),w=p.reduce((E,U)=>Math.max(E,U.density),0)||1,j=u.bandwidth/2,f=u.of(n)+j,a=p.map(E=>[R(f+E.density/w*j),R(l.of(E.at))]),o=p.map(E=>[R(f-E.density/w*j),R(l.of(E.at))]),h=[];a.forEach(([E,U],q)=>h.push(q?"L":"M",E,U));for(let E=o.length-1;E>=0;E--)h.push("L",o[E][0],o[E][1]);h.push("Z"),ee(x.next("path",`${I}__violin ${I}__mark`),{d:_(h),fill:i.series(d),"data-point":d});const B=G(S);B&&ee(x.next("path",`${I}__median ${I}__mark`),{d:_(["M",R(f-j*.5),R(l.of(B.median)),"L",R(f+j*.5),R(l.of(B.median))]),stroke:i.series(d),"stroke-width":2,fill:"none"})}),x.finish(),{xScale:u,yScale:l,series:[{key:"",label:t.measure.title,index:0,points:g.map(n=>{const d=G(m.get(n));return{x:n,xKey:n,label:n,y:d?d.median:null,rows:(m.get(n)||[]).length}})}]}}}),Qe("packages/modules/charts/gantt.js",function(s,K){"use strict";Object.defineProperty(s,"readTasks",{enumerable:!0,get:function(){return R}}),Object.defineProperty(s,"drawGantt",{enumerable:!0,get:function(){return ie}});const xe=K("packages/modules/charts/axis.js"),W=xe.drawAxisLines,v=xe.drawBandLabels,de=xe.drawContinuousAxis,V=K("packages/modules/charts/frame.js").Pool,G=K("packages/modules/charts/format.js").formatters,te=K("packages/modules/charts/scale.js"),O=te.bandScale,c=te.timeScale,Y=te.toTime,k=K("packages/modules/charts/scheme.js").resolveScheme,F=K("packages/modules/charts/svg.js"),J=F.attrs,Z=F.round,L=F.setText,N=K("packages/modules/charts/styles.js").NS,X=K("packages/modules/charts/typography.js"),oe=X.applySize,ee=X.truncateTo,_=8;function R(I,P,he){const r=[];let D=1/0,T=-1/0;for(const e of he){const i=Y(I.rows.value(e.key,P.start)),y=Y(I.rows.value(e.key,P.end));if(i===null||y===null)continue;const t=P.label?I.rows.text(e.key,P.label):e.key,m=P.series?I.rows.value(e.key,P.series):null;r.push({key:e.key,label:t,group:m,from:Math.min(i,y),to:Math.max(i,y)}),D=Math.min(D,i,y),T=Math.max(T,i,y)}return{tasks:r,span:r.length?{min:D,max:T}:null}}function ie(I){const P=I.scheme||k(),{plot:he}=I,{tasks:r,span:D}=R(I.grid,I.spec,I.rows);if(!D)return{tasks:[],xScale:null,dropped:0};const T=Math.max(1,Math.floor(he.height/_)),e=r.slice(0,T),i=r.length-e.length,y=c({min:D.min,max:D.max},[he.left,he.right]),t=O(e.map(l=>l.key),[he.top,he.bottom],.25),m=I.typography&&I.typography.small||I.fontSize;de({group:I.groups.overlay,plot:he,scale:y,format:G(I.grid,{kind:"time",span:D.max-D.min}),config:I.axis&&I.axis.x||{},grid:I.grid,size:m}),v({group:I.groups.axis,plot:he,scale:t,labels:e.map(l=>l.label),fontSize:m}),W({group:I.groups.rules,plot:he});const g=[...new Set(e.map(l=>String(l.group)))],b=new V(I.groups.marks);e.forEach((l,u)=>{const x=t.of(l.key),n=y.of(l.from),d=y.of(l.to);J(b.next("rect",`${N}__task ${N}__mark`),{x:Z(n),width:Z(Math.max(2,d-n)),y:Z(x),height:Z(t.bandwidth),fill:P.series(l.group===null?0:g.indexOf(String(l.group))),"data-point":u,"data-key":l.key}),l.px=Z((n+d)/2),l.py=Z(x+t.bandwidth/2)}),b.finish();const $=new V(I.groups.labels);if(i>0){const l=$.next("text",`${N}__geo-note`);oe(l,m),J(l,{x:Z(he.left),y:Z(he.bottom+m+4),"text-anchor":"start"}),L(l,ee(I.grid.messages.t("chart.tasksDropped",{count:i}),he.width,m))}return $.finish(),{tasks:e,xScale:y,dropped:i,series:[{key:"",label:I.spec.label||"",index:0,points:e.map(l=>({x:l.key,xKey:l.key,label:l.label,y:l.to-l.from,rows:1,rowKey:l.key,px:l.px,py:l.py}))}]}}}),Qe("packages/modules/charts/interaction.js",function(s,K){"use strict";Object.defineProperty(s,"resolveBrush",{enumerable:!0,get:function(){return de}}),Object.defineProperty(s,"brushed",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"brushCondition",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"attachBrush",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"applySelection",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"attachKeyboard",{enumerable:!0,get:function(){return te}});const W=K("packages/modules/charts/svg.js").attrs,v=4;function de(O){const c=O&&O.brush;if(c===!0)return{mode:"filter",axis:"x"};if(c==="filter"||c==="zoom"||c==="select")return{mode:c,axis:"x"};if(c&&typeof c=="object"&&c.mode){const Y=["filter","zoom","select"].includes(c.mode)?c.mode:null,M=c.axis==="y"||c.axis==="y2"?c.axis:"x";return{mode:Y,axis:M}}return{mode:null,axis:"x"}}function ue(O){const{bound:c,xScale:Y}=O,M=Math.min(O.from,O.to),k=Math.max(O.from,O.to);if(O.axis==="y"||O.axis==="y2"){const Z=O.axis==="y2"&&O.rightScale?O.rightScale:O.yScale||Y;if(!Z||typeof Z.invert!="function")return{kind:"range",values:[],range:null,axis:O.axis};const L=Z.invert(M),ne=Z.invert(k);return{kind:"range",values:[],range:[L,ne],axis:O.axis}}if(Y.kind==="band"){const Z=[];for(const L of c.categories){const ne=Y.centre(L);!Number.isNaN(ne)&&ne>=M&&ne<=k&&Z.push(L)}return{kind:"set",values:Z,range:null,axis:"x"}}const F=Y.invert(M),J=Y.invert(k);return{kind:"range",values:[],range:[F,J],axis:"x"}}function V(O){const{column:c,result:Y}=O;if(!c)return null;if(Y.kind==="set")return Y.values.length?{col:c,op:"in",value:Y.values.slice()}:null;if(!Y.range)return null;const[M,k]=Y.range;if(!Number.isFinite(M)||!Number.isFinite(k))return null;const F=O.kind==="time"?[new Date(Math.min(M,k)),new Date(Math.max(M,k))]:[Math.min(M,k),Math.max(M,k)];return{col:c,op:"between",value:F,bounds:"[]"}}function Q(O){let c=null,Y=null;const M=()=>{const Z=typeof O.axis=="function"?O.axis():"x",L=Z==="y"||Z==="y2";return(typeof O.horizontal=="function"?O.horizontal():!1)!==L},k=Z=>{if(!O.enabled())return;const L=O.pointOf(Z);c=M()?L.y:L.x,Y=O.svg.ownerDocument.createElementNS("http://www.w3.org/2000/svg","rect"),Y.setAttribute("class","lat-chartview__brush"),O.overlay.appendChild(Y)},F=Z=>{if(c===null||!Y)return;const L=O.plot();if(M()){const oe=O.pointOf(Z).y,ee=Math.max(L.top,Math.min(c,oe)),_=Math.min(L.bottom,Math.max(c,oe));W(Y,{x:L.left,y:ee,width:Math.max(0,L.right-L.left),height:Math.max(0,_-ee)});return}const ne=O.pointOf(Z).x,N=Math.max(L.left,Math.min(c,ne)),X=Math.min(L.right,Math.max(c,ne));W(Y,{x:N,y:L.top,width:Math.max(0,X-N),height:L.height})},J=Z=>{if(c===null)return;const L=O.pointOf(Z),ne=M()?L.y:L.x,N=Math.abs(ne-c),X=c;c=null,Y&&Y.parentNode&&Y.parentNode.removeChild(Y),Y=null,N>=v&&O.onBrush(X,ne)};return O.svg.addEventListener("pointerdown",k),O.svg.addEventListener("pointermove",F),O.svg.addEventListener("pointerup",J),O.svg.addEventListener("pointerleave",J),()=>{O.svg.removeEventListener("pointerdown",k),O.svg.removeEventListener("pointermove",F),O.svg.removeEventListener("pointerup",J),O.svg.removeEventListener("pointerleave",J)}}function G(O){const c=O.groups.marks,Y=O.keys.size>0||O.categories.size>0;let M=0;for(const k of c.childNodes||[]){if(!k.getAttribute)continue;const F=Number(k.getAttribute("data-series")),J=Number(k.getAttribute("data-point")),Z=O.series[F],L=Z&&Z.points[J],ne=!!L&&(L.rowKey&&O.keys.has(L.rowKey)||L.xKey!==void 0&&O.categories.has(L.xKey));ne&&M++,Y&&!ne?k.setAttribute("data-dim","true"):k.removeAttribute("data-dim")}return M}function te(O){let c=0;const Y=k=>{const F=O.marks();if(F.length){c=Math.max(0,Math.min(F.length-1,k));for(let J=0;J<F.length;J++)F[J].setAttribute("tabindex",J===c?"0":"-1");F[c].focus&&F[c].focus(),O.onFocus(c)}},M=k=>{const F=O.marks();if(F.length){switch(k.key){case"ArrowRight":case"ArrowDown":Y(c+1);break;case"ArrowLeft":case"ArrowUp":Y(c-1);break;case"Home":Y(0);break;case"End":Y(F.length-1);break;case"Enter":case" ":O.onActivate(c);break;default:return}k.preventDefault&&k.preventDefault()}};return O.svg.addEventListener("keydown",M),()=>O.svg.removeEventListener("keydown",M)}}),Qe("packages/modules/charts/range.js",function(s,K){"use strict";Object.defineProperty(s,"deriveRangeSpec",{enumerable:!0,get:function(){return ue}});const xe=new Set(["number","currency","percent","integer"]);function W(V){return!!V&&typeof V.type=="string"&&xe.has(V.type)}function v(V){const Q=V&&V.selection&&typeof V.selection.ranges=="function"?V.selection.ranges():[];return!Array.isArray(Q)||!Q.length?null:Q[Q.length-1]}function de(V,Q){const G=[],te=Math.min(Q.startRow,Q.endRow),O=Math.max(Q.startRow,Q.endRow);for(let c=te;c<=O;c++){const Y=V.rows.get(c);Y&&!Y.group&&Y.data!==null&&Y.data!==void 0&&G.push(Y)}return G}function ue(V,Q={}){const G=ee=>({spec:null,type:null,x:null,measures:[],columns:[],reason:ee}),te=Q.range||v(V);if(!te)return G("no-range");const O=V.columns.visible(),c=new Set(O.map(ee=>ee.id)),Y=(te.columns||[]).filter(ee=>c.has(ee));if(!Y.length)return G("no-visible-columns");const M=Y.map(ee=>({id:ee,column:V.columns.get(ee)})),k=M.filter(ee=>W(ee.column)).map(ee=>ee.id),F=M.filter(ee=>!W(ee.column)).map(ee=>ee.id);if(!k.length)return G("no-measure");const J=F.length?F[0]:null,Z=k,ne={rows:de(V,te)},N=new Set(["bar","line","area"]);if(Z.length>1){const ee=Q.type,_=N.has(ee)?ee:null,R=ee&&!N.has(ee)?ee:"combo";return{spec:{...ne,type:R,x:J,measures:Z.map(I=>_?{col:I,type:_}:{col:I})},type:R,x:J,measures:Z,columns:Y,reason:null}}const X=Q.type||"bar";return{spec:{...ne,type:X,x:J,y:Z[0]},type:X,x:J,measures:Z,columns:Y,reason:null}}}),Qe("packages/modules/charts/regression.js",function(s,K){"use strict";Object.defineProperty(s,"regressionPlots",{enumerable:!0,get:function(){return ue}});const xe=new Set(["number","currency","percent","integer"]);function W(V,Q={}){return{spec:V,reason:null,...Q}}function v(V,Q={}){return{spec:null,reason:V,...Q}}function de(V){if(!V||!Array.isArray(V.fitted)||!Array.isArray(V.residuals)||!Array.isArray(V.leverage)||!(V.sigma2>0))return null;const Q=Math.sqrt(V.sigma2),G=[];for(let te=0;te<V.fitted.length;te++){const O=V.leverage[te];if(!Number.isFinite(O)||O>=1)continue;const c=Q*Math.sqrt(1-O);if(!(c>0))continue;const Y=V.residuals[te]/c;G.push({x:V.fitted[te],y:Math.sqrt(Math.abs(Y)),key:String(te)})}return G}function ue(V,Q={}){const G=Q.model||(V&&V.statistics&&typeof V.statistics.regressionModel=="function"?V.statistics.regressionModel(Q.spec||{}):null),te=he=>({fit:v(he),residualsFitted:v(he),qq:v(he),multicollinearity:v(he),scaleLocation:v(he),residualsLeverage:v(he),coefficientForest:v(he)});if(!G||!Array.isArray(G.predictors)||!G.predictors.length||!G.response)return{model:null,plots:te("no-model")};const O=G.predictors,c=G.response,Y=Q.rows,M=()=>Y===void 0?{}:{rows:Y},k=Q.fitted||null,F=Q.residual||null,J=Q.stdResidual||null,Z=Q.leverage||null,L=Q.cooksD||null,ne=O.length===1?W({type:"scatter",x:O[0],y:c,fit:!0,band:G.band||null,...M()}):v("multiple-predictors"),N=k&&F?W({type:"scatter",x:k,y:F,reference:[{value:0}],...M()}):v("needs-fitted-and-residual-columns"),X=F?W({type:"qq",y:F,...M()}):v("needs-residual-column"),oe=O.filter(he=>{const r=V&&V.columns&&typeof V.columns.get=="function"?V.columns.get(he):null;return!r||typeof r.type=="string"&&xe.has(r.type)}),ee=O.length>=2?W({type:"correlogram",columns:oe},{vif:G.vif||null}):v("single-predictor",{vif:G.vif||null}),_=Z&&J?W({type:L?"bubble":"scatter",x:Z,y:J,...L?{size:L}:{},reference:[{value:0}],...M()}):v("needs-leverage-and-standardised-residual-columns"),R=de(G),ie=R&&R.length?W({type:"scatter",points:R,fit:!0,dimensionTitle:"Fitted",measureTitle:"√|standardised residual|"}):v("needs-fitted-model"),I=Array.isArray(G.coefficients)?G.coefficients.filter(he=>he&&Number.isFinite(he.estimate)&&Number.isFinite(he.lower)&&Number.isFinite(he.upper)).map(he=>({x:he.estimate,label:he.name,lower:he.lower,upper:he.upper})):[],P=I.length?W({type:"forest",points:I,dimensionTitle:"Coefficient",measureTitle:"Estimate"},{coefficients:G.coefficients||null}):v("needs-coefficient-intervals",{coefficients:G.coefficients||null});return{model:G,plots:{fit:ne,residualsFitted:N,qq:X,multicollinearity:ee,scaleLocation:ie,residualsLeverage:_,coefficientForest:P}}}}),Qe("packages/modules/charts/registry.js",function(s,K){"use strict";Object.defineProperty(s,"registerChartType",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"chartTypeDef",{enumerable:!0,get:function(){return v}}),Object.defineProperty(s,"registeredChartTypes",{enumerable:!0,get:function(){return de}});const xe=new Map;function W(ue,V){if(typeof ue!="string"||!ue)throw new TypeError("[lattice] registerChartType needs a non-empty type name.");if(!V||typeof V.draw!="function")throw new TypeError(`[lattice] registerChartType('${ue}') needs a { draw } function.`);xe.set(ue,V)}function v(ue){return xe.get(ue)||null}function de(){return[...xe.keys()]}}),Qe("packages/modules/charts/index.js",function(s,K){"use strict";Object.defineProperty(s,"TYPES",{enumerable:!0,get:function(){return nn}}),Object.defineProperty(s,"Chart",{enumerable:!0,get:function(){return bn}}),Object.defineProperty(s,"createChart",{enumerable:!0,get:function(){return yn}}),Object.defineProperty(s,"deriveRangeSpec",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(s,"regressionPlots",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(s,"chartRange",{enumerable:!0,get:function(){return qn}}),Object.defineProperty(s,"canChartRange",{enumerable:!0,get:function(){return eo}});const xe=K("packages/modules/charts/cartesian.js"),W=xe.aheadOfWindow,v=xe.axisWindowSpan,de=xe.CARTESIAN,ue=xe.drawCartesian,V=xe.drawForest,Q=xe.nearestCategory,G=xe.nearestDrawnPoint,te=xe.WINDOW_LEAD,O=xe.windowedBound,Y=K("packages/modules/charts/drawable.js").drawability,M=K("packages/modules/charts/axis.js"),k=M.createGroups,F=M.drawAxisTitle,J=M.normaliseAxes,Z=M.setPlotClip,L=K("packages/modules/charts/bind.js"),ne=L.bindHierarchy,N=L.bindLinks,X=L.bindMeasures,oe=L.bindPoints,ee=L.bindSeries,_=L.leafRows,R=K("packages/modules/charts/frame.js"),ie=R.Pool,I=R.plotRect,P=K("packages/modules/charts/scale.js"),he=P.key,r=P.measureDomain,D=P.sqrtScale,T=K("packages/modules/charts/format.js"),e=T.measureText,i=K("packages/modules/charts/radial.js"),y=i.arcAt,t=i.drawRadial,m=K("packages/modules/charts/distribution.js"),g=m.drawBoxPlot,b=m.drawCapability,$=m.drawControl,l=m.drawEcdf,u=m.drawHistogram,x=m.drawLorenz,n=m.drawMovingRange,d=m.drawQQ,p=K("packages/modules/charts/treemap.js").drawTreemap,w=K("packages/modules/charts/hit.js"),j=w.ownsGeometry,f=w.resolveHit,o=K("packages/modules/charts/combo.js").drawCombo,h=K("packages/modules/charts/polar.js"),B=h.drawGauge,E=h.drawRadar,U=K("packages/modules/charts/matrix.js"),q=U.drawCandlestick,se=U.drawCorrelogram,C=U.drawFunnel,ce=U.drawHeatmap,fe=U.title,me=K("packages/modules/charts/multiples.js"),be=me.panelRects,ge=me.splitPanels,Me=K("packages/modules/charts/geo.js"),Te=Me.drawGeomap,we=Me.packRegions,_e=Me.projectedPath,Pe=Me.resolvePack,je=K("packages/modules/charts/projection.js"),Ie=je.fitted,Ge=je.resolveProjection,Ve=je.splitAntimeridian,at=K("packages/modules/charts/flow.js"),mt=at.drawChord,ut=at.drawSankey,wt=K("packages/modules/charts/network.js"),kt=wt.drawNetwork,jt=wt.emphasiseNetwork,At=K("packages/modules/charts/stream.js"),Ot=At.drawMarimekko,Ut=At.drawStream,Lt=At.drawViolin,It=K("packages/modules/charts/gantt.js").drawGantt,Be=K("packages/modules/charts/svg.js"),ot=Be.attrs,A=Be.append,ke=Be.clear,le=Be.el,Ae=Be.round,pe=Be.setText,Se=Be.svg,ye=K("packages/modules/charts/styles.js"),Oe=ye.NS,Ne=ye.injectStyles,$e=K("packages/modules/charts/scheme.js"),Ce=$e.resolveScheme,Fe=K("packages/modules/charts/typography.js"),Ye=Fe.applySize,De=Fe.resolveType,et=Fe.textWidth,We=K("packages/modules/charts/labels.js"),Je=We.collides,ft=We.resolveLabels,lt=K("packages/modules/charts/interaction.js"),gt=lt.applySelection,rt=lt.attachBrush,it=lt.attachKeyboard,qe=lt.brushCondition,bt=lt.brushed,Pt=lt.resolveBrush,St=K("packages/modules/charts/dense.js"),vt=St.downsample,Yt=St.markCount,Dt=St.wantsCanvas,Gt=K("packages/modules/charts/range.js").deriveRangeSpec,Xt=K("packages/modules/charts/regression.js").regressionPlots,$t=K("packages/modules/charts/registry.js"),Zt=$t.chartTypeDef,cn=$t.registeredChartTypes,Kt=$t.registerChartType,Bt=P.linearScale,Rt=P.bandScale,Ht=P.extent,Wt=P.toNumber,qt=P.isNumber,Xe=P.niceDomain,st=P.linearTicks,dt=P.timeScale,yt=P.toTime,Mt=P.niceStep,en=U.colourRamp,xn=Be.path,An=Be.attr,tn=K("packages/core/src/internal/util.js").warnOnce,Sn=M.drawMeasureAxis,vn=M.drawCategoryAxis,Mn=M.drawAxisLines,Nn=M.drawContinuousAxis,jn=M.drawBandLabels,On=M.tickValues,Pn=m.density,$n=m.valuesByCategory,Tn=m.summarise,_n=m.quantile,Cn=m.histogram,Ln=T.formatters;Object.defineProperty(s,"registerScheme",{enumerable:!0,get:function(){return $e.registerScheme}}),Object.defineProperty(s,"resolveScheme",{enumerable:!0,get:function(){return $e.resolveScheme}}),Object.defineProperty(s,"schemeNames",{enumerable:!0,get:function(){return $e.schemeNames}}),Object.defineProperty(s,"setDefaultScheme",{enumerable:!0,get:function(){return $e.setDefaultScheme}}),Object.defineProperty(s,"SCHEMES",{enumerable:!0,get:function(){return $e.SCHEMES}}),Object.defineProperty(s,"PALETTE",{enumerable:!0,get:function(){return $e.PALETTE}}),Object.defineProperty(s,"registerChartType",{enumerable:!0,get:function(){return $t.registerChartType}}),Object.defineProperty(s,"registeredChartTypes",{enumerable:!0,get:function(){return $t.registeredChartTypes}});const En=Object.freeze({el:le,svg:Se,attr:An,attrs:ot,append:A,clear:ke,path:xn,round:Ae,setText:pe,Pool:ie,plotRect:I,linearScale:Bt,bandScale:Rt,sqrtScale:D,extent:Ht,measureDomain:r,niceDomain:Xe,linearTicks:st,timeScale:dt,toTime:yt,niceStep:Mt,toNumber:Wt,isNumber:qt,key:he,drawMeasureAxis:Sn,drawCategoryAxis:vn,drawAxisLines:Mn,drawContinuousAxis:Nn,drawBandLabels:jn,tickValues:On,formatters:Ln,resolveScheme:Ce,colourRamp:en,density:Pn,valuesByCategory:$n,summarise:Tn,quantile:_n,histogram:Cn,resolvePack:Pe,packRegions:we,fitted:Ie,resolveProjection:Ge,splitAntimeridian:Ve,projectedPath:_e,textWidth:et,applySize:Ye,collides:Je,NS:Oe}),nn=Object.freeze(["line","step","area","rangeArea","bar","horizontalBar","waterfall","scatter","bubble","forest","combo","pareto","histogram","boxplot","heatmap","qq","ecdf","lorenz","correlogram","control","capability","movingRange","pie","donut","sunburst","treemap","radar","gauge","funnel","candlestick","geomap","sankey","chord","network","stream","marimekko","violin","gantt"]),un=new Set(["bar","column","horizontalBar","line","area","scatter","bubble","combo","pareto","histogram","heatmap","pie","donut","sunburst","treemap","radar","geomap"]),zn=new Set(["pie","donut","sunburst"]),Rn=new Set(["pie","donut","sunburst","treemap"]),fn=20,Fn=new Set(["histogram","boxplot","qq","ecdf","lorenz","control","capability","movingRange"]),In=new Set(["histogram","boxplot","qq","ecdf","lorenz","violin"]);function Dn(Ze){const z=Ze.y||(Array.isArray(Ze.measures)&&Ze.measures.length?Ze.measures[0]:null);if(!z)return Ze;const H=typeof z=="string"?z:z.col;if(!H)return Ze;const ae=typeof z=="object"&&z.fn!=null?z.fn:"median";return{...Ze,y:{col:H,fn:ae}}}const Gn=new Set(["combo","candlestick"]),hn=new Set(["bar","line","step","area","scatter","bubble"]),Bn=new Set(["sankey","chord","network"]),Un=new Set(["gantt"]),Kn=new Set(["radar","gauge","funnel","heatmap","geomap","sankey","chord","network"]),Nt=Object.freeze({width:480,height:300}),dn=Object.freeze(["00000"]),mn=new Set(["horizontalBar","forest"]);function gn(Ze,z,H,ae){return Ze==="correlogram"?(Array.isArray(ae.columns)?ae.columns:[]).map(re=>fe(H,re)):Ze==="heatmap"?(z.series||[]).map(ve=>ve.label):Ze==="gantt"?(z.rows||[]).map(ve=>ae.label?H.rows.text(ve.key,ae.label):String(ve.key)):mn.has(Ze)?z.labels||[]:dn}const Hn=1e3,Wn=50;let Vn=0;function Yn(Ze){const z=Ze/1e3;return`${z>=10?Math.round(z):Math.round(z*10)/10}s`}function pn(Ze){return`${Ze/1e3}s`}function Tt(Ze){return Ze&&Ze.defaultView||globalThis}function Zn(Ze,z){return z?typeof z=="string"?Ze.querySelector(z):z:null}function Jn(Ze,z,H){const ae=["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"],ve=[Ze,...Ze.querySelectorAll("*")],re=[z,...z.querySelectorAll("*")];for(let Ee=0;Ee<ve.length&&Ee<re.length;Ee++){const ze=H.getComputedStyle(ve[Ee]),Le=[];for(const Re of ae){const Ke=ze.getPropertyValue(Re);Ke&&Le.push(`${Re}:${Ke}`)}Le.length&&re[Ee].setAttribute("style",Le.join(";"))}}function Qn(Ze,z){let H=Ze.root;const ae=[];for(const ve of z){const re=(H.children||[]).find(Ee=>Ee.label===ve);if(!re||!re.children||!re.children.length)break;H=re,ae.push(ve)}return ae.length?{...Ze,root:H,path:ae,empty:!H.children.length}:Ze}function Xn(Ze,z,H){return Ze&&Ze.plot?Ze.plot:{left:0,top:0,right:z,bottom:H,width:z,height:H,gutter:{left:0,bottom:0,right:0,top:0}}}class bn{#l=++Vn;#n;#c;#e;#i;#f=null;#o=null;#a=null;#p=null;#d=null;#F=!1;#w=null;#k=null;#b=[];#h=new Set;#t=null;#m={zoom:1,offset:[0,0]};#y=null;#x=null;#I=!1;#D=!1;#r=null;#_=0;#M=null;#P=null;#G=!1;#A=!1;#S=new Map;#N=Ce();#C=De();#ye=null;#u=null;#g=null;#v=null;#L=0;constructor(z){this.#n=z.grid,this.#c=z.container,this.#e=z.spec,this.#i=z.container.ownerDocument,this.#Q(),this.#X(),this.draw()}#Q(){Ne(this.#i);const z=this.#i;this.#f=le(z,"div",Oe);const H=le(z,"figure",`${Oe}__figure`);if(this.#e.title||this.#e.subtitle){const ae=le(z,"figcaption",`${Oe}__caption`);if(this.#e.title){const ve=le(z,"div",`${Oe}__title`);pe(ve,this.#e.title),ae.appendChild(ve)}if(this.#e.subtitle){const ve=le(z,"div",`${Oe}__subtitle`);pe(ve,this.#e.subtitle),ae.appendChild(ve)}H.appendChild(ae)}if(this.#o=Se(z,"svg",{class:`${Oe}__plot`,preserveAspectRatio:"xMidYMid meet",role:"img"}),this.#a=k(z,this.#o),H.appendChild(this.#o),this.#k=le(z,"div",`${Oe}__empty`),this.#k.setAttribute("hidden",""),H.appendChild(this.#k),this.#w=le(z,"div",`${Oe}__table`),H.appendChild(this.#w),this.#p=le(z,"div",`${Oe}__legend`),H.appendChild(this.#p),this.#e.footnote){const ae=le(z,"div",`${Oe}__footnote`);pe(ae,this.#e.footnote),H.appendChild(ae)}this.#x=le(z,"div",`${Oe}__attribution`),this.#x.setAttribute("hidden",""),H.appendChild(this.#x),this.#d=le(z,"div",`${Oe}__tooltip`),this.#d.setAttribute("hidden",""),this.#f.appendChild(H),this.#f.appendChild(this.#d),this.#c.appendChild(this.#f),this.#q()}#X(){const z=["model:changed","rows:changed","filter:changed","sort:changed","column:grouped","column:pivoted","cell:changed","timeline:seek","timeline:attached","timeline:detached"];this.#e.selection&&this.#b.push(this.#n.on("selection:changed",()=>this.#V()));for(const ae of z)this.#b.push(this.#n.on(ae,()=>this.schedule()));const H=Tt(this.#i);H&&typeof H.ResizeObserver=="function"&&(this.#P=this.#c.getBoundingClientRect?this.#c.getBoundingClientRect():null,this.#M=new H.ResizeObserver(()=>{if(!this.#G){this.#G=!0;const ae=this.#c.getBoundingClientRect?this.#c.getBoundingClientRect():null;if(ae&&this.#P&&Math.round(ae.width)===Math.round(this.#P.width)&&Math.round(ae.height)===Math.round(this.#P.height))return}this.schedule()}),this.#M.observe(this.#c))}#B(){const z=this.#o&&this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():null;return z&&z.width>0&&z.height>0?z:this.#c.getBoundingClientRect?this.#c.getBoundingClientRect():Nt}#q(){const z=Le=>{this.#y||this.#te(Le)},H=()=>this.#j();this.#o.addEventListener("pointermove",z),this.#o.addEventListener("pointerleave",H),this.#o.addEventListener("click",Le=>this.#W(Le));const ae=Le=>{!this.#t||!this.#t.packed||(this.#y={x:Le.clientX||0,y:Le.clientY||0})},ve=Le=>{if(!this.#y)return;const Re=Le.clientX||0,Ke=Le.clientY||0;this.#O(Re-this.#y.x,Ke-this.#y.y),this.#y={x:Re,y:Ke}},re=()=>{this.#y=null},Ee=Le=>{!this.#t||!this.#t.packed||(Le.preventDefault&&Le.preventDefault(),this.#z(Le.deltaY<0?1.15:1/1.15))},ze=Le=>{if(!this.#t||!this.#t.packed)return;const Re=40;if(Le.shiftKey&&Le.key==="ArrowLeft")this.#O(-Re,0);else if(Le.shiftKey&&Le.key==="ArrowRight")this.#O(Re,0);else if(Le.shiftKey&&Le.key==="ArrowUp")this.#O(0,-Re);else if(Le.shiftKey&&Le.key==="ArrowDown")this.#O(0,Re);else if(Le.key==="+"||Le.key==="=")this.#z(1.25);else if(Le.key==="-"||Le.key==="_")this.#z(1/1.25);else if(Le.key==="0")this.#le();else return;Le.preventDefault&&Le.preventDefault()};this.#o.addEventListener("pointerdown",ae),this.#o.addEventListener("pointermove",ve),this.#o.addEventListener("pointerup",re),this.#o.addEventListener("pointerleave",re),this.#o.addEventListener("wheel",Ee,{passive:!1}),this.#o.addEventListener("keydown",ze),this.#b.push(rt({svg:this.#o,overlay:this.#a.overlay,plot:()=>this.#t&&this.#t.plot||{left:0,top:0,right:0,bottom:0,height:0},pointOf:Le=>this.#$(Le),axis:()=>Pt(this.#e).axis,horizontal:()=>!!(this.#t&&this.#t.horizontal),enabled:()=>!!Pt(this.#e).mode&&!!(this.#t&&this.#t.xScale),onBrush:(Le,Re)=>this.#ie(Le,Re)})),this.#o.setAttribute("tabindex","0"),this.#b.push(it({svg:this.#o,marks:()=>[...this.#a.marks.childNodes||[]].filter(Le=>Le.setAttribute),onFocus:Le=>this.#se(Le),onActivate:Le=>this.#ae(Le)})),this.#b.push(()=>{this.#o.removeEventListener("pointermove",z),this.#o.removeEventListener("pointerleave",H),this.#o.removeEventListener("pointerdown",ae),this.#o.removeEventListener("pointermove",ve),this.#o.removeEventListener("pointerup",re),this.#o.removeEventListener("pointerleave",re),this.#o.removeEventListener("wheel",Ee),this.#o.removeEventListener("keydown",ze)})}#$(z){const H=this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():{left:0,top:0,width:Nt.width,height:Nt.height};return{x:(z.clientX||0)-H.left,y:(z.clientY||0)-H.top}}#ee(z){return Q({bound:{categories:this.#T().categories},xScale:this.#t.xScale,at:this.#t.horizontal?z.y:z.x})}#T(){const z=this.#t;return z&&Array.isArray(z.labels)&&Array.isArray(z.categories)?{labels:z.labels,categories:z.categories}:{labels:this.#r&&this.#r.labels||[],categories:this.#r&&this.#r.categories||[]}}#U(z){if(!this.#t||!Array.isArray(this.#t.series))return null;if(this.#t.reduced)return G({series:this.#t.series,xScale:this.#t.xScale,at:this.#t.horizontal?z.y:z.x});const H=this.#ee(z);return H<0?null:{index:H,entries:this.#t.series.map(ae=>({series:ae,point:ae.points[H]})).filter(ae=>ae.point&&ae.point.y!==null)}}#E(z){return f({drawn:this.#t,bound:this.#r,spec:this.#e,grid:this.#n,scheme:this.#N,at:z})}#te(z){if(!this.#t||!this.#r||this.#e.tooltip===!1)return;const H=this.#$(z),ae=[];let ve="";const re=this.#E(H);if(re){this.#K(re.heading,re.rows,z),this.emit("hover",{...re.datum,native:z});return}if(j(this.#t)){this.#j();return}if(this.#t.arcs){const ze=y({arcs:this.#t.arcs,x:H.x,y:H.y});if(!ze){this.#j();return}ve=ze.label;const Le=this.#r.root.total>0?ze.total/this.#r.root.total:0;ae.push({label:this.#r.measure.title,value:`${e(ze.total,this.#n.messages)} (${this.#n.messages.number(Le,{style:"percent",maximumFractionDigits:1})})`,colour:this.#N.series(ze.index)})}else{const ze=this.#U(H);if(!ze){this.#j();return}ve=this.#T().labels[ze.index]||"";for(const Le of ze.entries)ae.push({label:Le.series.label,value:e(Le.point.y,this.#n.messages),colour:this.#N.series(Le.series.index)})}if(!ae.length){this.#j();return}this.#K(ve,ae,z);const Ee=this.#H(H);Ee&&this.emit("hover",{...Ee,native:z})}#K(z,H,ae){const ve=this.#i;if(ke(this.#d),z){const re=le(ve,"div",`${Oe}__tooltip-row`),Ee=le(ve,"strong");pe(Ee,z),re.appendChild(Ee),this.#d.appendChild(re)}for(const re of H){const Ee=le(ve,"div",`${Oe}__tooltip-row`),ze=le(ve,"span",`${Oe}__swatch`);ze.setAttribute("style",`background:${re.colour}`);const Le=le(ve,"span");pe(Le,re.label);const Re=le(ve,"span",`${Oe}__tooltip-value`);pe(Re,re.value),A(Ee,[ze,Le,Re]),this.#d.appendChild(Ee)}this.#d.removeAttribute("hidden"),this.#ne(ae)}#ne(z){if(!this.#F&&(this.#F=!0,this.#oe())){const ct=this.#i&&this.#i.body;ct&&typeof ct.appendChild=="function"&&ct.appendChild(this.#d)}const H=Tt(this.#i),ae=12,ve=z&&z.clientX||0,re=z&&z.clientY||0,Ee=typeof this.#d.getBoundingClientRect=="function"?this.#d.getBoundingClientRect():{width:0,height:0},ze=H.innerWidth||0,Le=H.innerHeight||0;let Re=ve+ae;ze&&Re+Ee.width>ze-ae&&(Re=ve-ae-Ee.width),Re=Math.max(ae,Re);let Ke=re+ae;Le&&Ke+Ee.height>Le-ae&&(Ke=re-ae-Ee.height),Ke=Math.max(ae,Ke),this.#d.style.left=`${Math.round(Re)}px`,this.#d.style.top=`${Math.round(Ke)}px`}#oe(){const z=Tt(this.#i);if(typeof z.getComputedStyle!="function")return!1;let H=this.#f&&this.#f.parentNode;for(;H;){if(H.nodeType===11&&H.host){H=H.host;continue}if(H.nodeType!==1)break;const ae=z.getComputedStyle(H);if(ae&&(ae.transform&&ae.transform!=="none"||ae.perspective&&ae.perspective!=="none"||ae.filter&&ae.filter!=="none"||ae.backdropFilter&&ae.backdropFilter!=="none"||ae.contain&&/layout|paint|strict|content/.test(ae.contain)))return!0;H=H.parentNode}return!1}#j(){this.#d&&this.#d.setAttribute("hidden",""),this.emit("leave",{})}#H(z){if(!this.#t||!this.#r)return null;const H=this.#E(z);if(H)return H.datum;if(j(this.#t))return null;if(this.#t.arcs){const ze=y({arcs:this.#t.arcs,x:z.x,y:z.y});return ze?{label:ze.label,value:ze.total,category:ze.node.value,column:this.#e.x||null,series:null,depth:ze.depth,path:Array.isArray(ze.path)?[...ze.path]:[ze.label],rowKeys:ze.node.rowKey?[ze.node.rowKey]:[]}:null}const ae=this.#U(z);if(!ae)return null;const ve=ae.entries,re=this.#T(),Ee=ve.length===1&&ve[0].point.from!==void 0?{from:ve[0].point.from,to:ve[0].point.to}:null;return{label:re.labels[ae.index]||"",category:re.categories[ae.index],column:this.#r.dimension.col,value:ve.length===1?ve[0].point.y:null,...Ee||{},series:ve.map(ze=>({key:ze.series.key,label:ze.series.label,value:ze.point.y,rows:ze.point.rows})),rowKeys:ve.map(ze=>ze.point.rowKey).filter(Boolean)}}#W(z){if(!this.#t||!this.#r)return;const H=this.#H(this.#$(z));if(!H)return;let ae=!1;const ve=this.emit("click",{...H,native:z,preventDefault(){ae=!0}});if(!(ae||ve.defaultPrevented)){if(this.#e.drill&&this.#r&&this.#r.root&&H.label){const re=Array.isArray(H.path)&&H.path.length?H.path:[H.label];this.#u=[...this.#u||[],...re],this.emit("drill",{path:[...this.#u],label:H.label}),this.draw();return}if(this.#e.selection&&Array.isArray(this.#t.markers)&&Array.isArray(H.rowKeys)&&H.rowKeys.length){this.#n.selection.set([...H.rowKeys]);return}if(this.#e.selection&&this.#e.type==="network"&&Array.isArray(H.rowKeys)&&H.rowKeys.length){this.#n.selection.set([...new Set(H.rowKeys)]);return}!this.#e.filterOnClick||!H.column||this.#n.filters.set({col:H.column,op:"eq",value:H.category})}}#V(){if(!this.#t)return;if(Array.isArray(this.#t.markers)){this.#re();return}if(Array.isArray(this.#t.links)&&Array.isArray(this.#t.nodes)&&!this.#t.series){jt({drawn:this.#t,keys:new Set(this.#n.selection.keys())});return}if(!this.#t.series)return;const z=this.#n.selection.keys(),H=this.#r&&this.#r.dimension&&this.#r.dimension.col,ae=new Set;if(H)for(const ve of z)ae.add(he(this.#n.rows.value(ve,H)));gt({groups:this.#a,series:this.#t.series,keys:new Set(z),categories:ae})}#re(){const z=new Set(this.#n.selection.keys());for(const H of this.#t.markers){const ae=H.element;!ae||!ae.setAttribute||(z.size&&!z.has(H.rowKey)?ae.setAttribute("data-dim","true"):ae.removeAttribute("data-dim"))}}#ie(z,H){const ae=Pt(this.#e),ve=ae.mode;if(!ve||!this.#t||!this.#t.xScale||!this.#r)return;const re=bt({bound:this.#r,xScale:this.#t.xScale,yScale:this.#t.yScale,rightScale:this.#t.rightScale||null,axis:ae.axis,from:z,to:H});let Ee=!1;const ze=this.emit("brush",{mode:ve,kind:re.kind,values:re.values,range:re.range,axis:re.axis,column:re.axis==="y"||re.axis==="y2"?this.#r.measure&&this.#r.measure.col||null:this.#r.dimension.col,preventDefault(){Ee=!0}});if(Ee||ze.defaultPrevented)return;if(ve==="zoom"){if(re.range){const Re=re.axis==="y2"?"y2":re.axis==="y"?"y":"x";this.#e={...this.#e,axis:{...this.#e.axis||{},[Re]:{...(this.#e.axis||{})[Re]||{},min:Math.min(re.range[0],re.range[1]),max:Math.max(re.range[0],re.range[1])}}},this.draw()}return}if(ve==="select"){const Re=[];for(const Ke of this.#t.series||[])for(const ct of Ke.points){if(!ct.rowKey)continue;(re.kind!=="set"||re.values.some(Ue=>he(Ue)===ct.xKey))&&Re.push(ct.rowKey)}this.#n.selection.set([...new Set(Re)]);return}const Le=qe({column:this.#r.dimension.col,result:re,kind:this.#r.kind});Le&&this.#n.filters.set(Le)}#se(z){const H=(this.#a.marks.childNodes||[])[z];if(!H||!H.setAttribute)return;const ae=this.#t&&this.#t.series?this.#t.series[Number(H.getAttribute("data-series"))||0]:null,ve=ae&&ae.points[Number(H.getAttribute("data-point"))||0];if(!ve){if(!H.getBoundingClientRect)return;const re=H.getBoundingClientRect(),Ee=this.#E(this.#$({clientX:re.left+re.width/2,clientY:re.top+re.height/2}));if(!Ee)return;H.setAttribute("role","img"),H.setAttribute("aria-label",`${Ee.heading}: ${Ee.rows.map(ze=>ze.value).filter(Boolean).join(", ")}`),this.emit("focus",{label:Ee.datum.label,value:Ee.datum.value,index:z});return}H.setAttribute("role","img"),H.setAttribute("aria-label",`${ve.label}: ${e(ve.y,this.#n.messages)}`),this.emit("focus",{label:ve.label,value:ve.y,index:z})}#ae(z){const H=(this.#a.marks.childNodes||[])[z];if(!H||!H.getBoundingClientRect)return;const ae=H.getBoundingClientRect();this.#W({clientX:ae.left+ae.width/2,clientY:ae.top+ae.height/2})}#Y(z){const H=z&&z.attribution||"";H?(pe(this.#x,H),this.#x.removeAttribute("hidden")):this.#x.setAttribute("hidden","");const ae=z&&Number.isFinite(z.aspect)&&z.aspect>0?z.aspect:null;this.#o&&this.#o.style&&(ae?this.#o.style.setProperty("aspect-ratio",String(ae)):this.#o.style.removeProperty("aspect-ratio"))}#le(){this.#m={zoom:1,offset:[0,0]},this.schedule()}#z(z){const H=this.#m.zoom*z;this.#m={...this.#m,zoom:Math.min(8,Math.max(1,H))},this.schedule()}#O(z,H){const ae=this.#t&&this.#t.scale||0;if(!ae)return;const[ve,re]=this.#m.offset;this.#m={...this.#m,offset:[ve-z/ae,re+H/ae]},this.schedule()}schedule(){if(this.#A||this.#_)return;const z=Tt(this.#i),H=typeof z.requestAnimationFrame=="function"?z.requestAnimationFrame.bind(z):ae=>setTimeout(ae,16);this.#_=H(()=>{this.#_=0,this.draw()})||1}draw(){if(this.#A)return;const z=this.#Z();if(!z)return;const H=this.#B(),ae=Math.round(H.width||Nt.width),ve=Math.round(H.height||Nt.height),re=ae!==z.width||ve!==z.height?this.#Z():z;re&&this.emit("draw",{chartType:re.chartType,categories:re.categories,empty:re.empty})}#Z(){const z=this.#B(),H=Math.round(z.width||Nt.width),ae=Math.round(z.height||Nt.height),ve=nn.includes(this.#e.type)?null:Zt(this.#e.type),re=nn.includes(this.#e.type)||ve?this.#e.type:"bar";Array.isArray(this.#e.x)&&tn(`chart:${this.#l}:x:array`,`chart "x" expects one column id (a string) and was given an array [${this.#e.x.map(nt=>JSON.stringify(nt)).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.`);const Ee=Ce(this.#e);this.#N=Ee;const ze=J(this.#e.axis),Le=this.#n.messages,Re=De(this.#e);this.#C=Re;const Ke=Re.small,ct=ft(this.#e);if(ct.show&&!un.has(re)&&!(ve&&ve.labelled)&&!this.#I){this.#I=!0;const nt=this.#i&&this.#i.defaultView,He=nt&&nt.console||(typeof globalThis<"u"?globalThis.console:null);He&&typeof He.warn=="function"&&He.warn(`[lattice] a "${re}" chart does not draw data labels; "labels" has no effect on it. Types that do: ${[...un].join(", ")}.`)}ot(this.#o,{viewBox:`0 0 ${H} ${ae}`,width:H,height:ae});const xt=Rn.has(re)||!!(ve&&ve.hierarchical);let Ue;if(ve&&typeof ve.bind=="function")Ue=ve.bind(this.#n,this.#e);else if(xt)Ue=ne(this.#n,this.#e),this.#u&&this.#u.length&&(Ue=Qn(Ue,this.#u));else if(Gn.has(re))Ue=X(this.#n,this.#e);else if(hn.has(re)&&Array.isArray(this.#e.measures)&&this.#e.measures.length)Ue=X(this.#n,this.#e);else if(Bn.has(re))Ue=N(this.#n,this.#e,re==="network"?{perRow:!0,nodes:this.#e.nodes}:void 0);else if(Un.has(re)){const nt=_(this.#n);Ue={rows:nt,series:[],categories:[],labels:[],measure:{col:null,fn:"sum",title:""},dimension:{col:this.#e.label||null,title:""},empty:!nt.length}}else re==="geomap"?Ue=ee(this.#n,{...this.#e,x:this.#e.code||this.#e.x}):Array.isArray(this.#e.points)?Ue=oe(this.#e):In.has(re)?Ue=ee(this.#n,Dn(this.#e)):Ue=ee(this.#n,this.#e);const _t=Date.now();this.#r=Ue;const Ct=W(Ue,ze&&ze.x,re,_t);if(Ct){const nt=typeof this.#e.x=="string"?` "${this.#e.x}"`:"",He=`${Math.round(te*1e3)/10}%`;tn(`chart:${this.#l}:x:window:ahead`,`${Ct.count} reading(s) on the x axis${nt} were not drawn: stamped up to ${Yn(Ct.lead)} ahead of this device's clock, which is more than the ${pn(Ct.limit)} (${He} of the ${pn(Ct.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 pt=Y({grid:this.#n,spec:this.#e,type:re,bound:Ue,axis:ze,now:_t,id:this.#l});if(!pt.ok)return pt.tell&&tn(pt.key,pt.message),this.#de(this.#e.emptyText||Le.t("chart.empty")),null;if(Ue=O(Ue,ze&&ze.x,re,_t),this.#r=Ue,this.#k.setAttribute("hidden",""),this.#o.removeAttribute("hidden"),Z(this.#a,null),ve){const nt=ve.freeform?I({width:H,height:ae,fontSize:Ke,margin:this.#e.margin}):I({width:H,height:ae,fontSize:Ke,margin:this.#e.margin,titleSize:Re.axisTitle,titles:{left:ze.y.title,bottom:ze.x.title,right:ze.y2.title},yLabels:dn,xLabels:Ue.labels,rotated:!0});this.#t=ve.draw({doc:this.#i,groups:this.#a,plot:nt,bound:Ue,type:re,grid:this.#n,fontSize:Ke,hidden:this.#h,scheme:Ee,axis:ze,typography:Re,labels:ct,spec:this.#e,geoView:{zoom:this.#m.zoom,offset:this.#m.offset},helpers:En})||{},this.#s(Array.isArray(this.#t.legend)?this.#t.legend:[])}else if(re==="treemap"){const nt=I({width:H,height:ae,fontSize:Ke,padding:2,margin:this.#e.margin});this.#t=p({scheme:Ee,groups:this.#a,plot:nt,tree:Ue,grid:this.#n,hidden:this.#h,fontSize:Ke,typography:Re,labels:ct}),this.#s(Ue.root.children.map((He,tt)=>({key:He.label,label:He.label,index:tt})))}else if(zn.has(re)){const nt=I({width:H,height:ae,fontSize:Ke});this.#t=t({scheme:Ee,doc:this.#i,groups:this.#a,plot:nt,tree:Ue,type:re,grid:this.#n,hidden:this.#h,fontSize:Ke,typography:Re,labels:ct}),this.#s(Ue.root.children.map((He,tt)=>({key:He.label,label:He.label,index:tt})))}else{const nt=Kn.has(re)?I({width:H,height:ae,fontSize:Ke,margin:this.#e.margin,yLabels:re==="heatmap"?gn(re,Ue,this.#n,this.#e):[],xLabels:re==="heatmap"?Ue.labels:[],rotated:!0}):I({width:H,height:ae,fontSize:Ke,margin:this.#e.margin,titleSize:Re.axisTitle,titles:de[re]&&de[re].horizontal?{left:ze.x.title,bottom:ze.y.title,right:ze.y2.title}:{left:ze.y.title,bottom:ze.x.title,right:ze.y2.title},rightGutter:this.#fe(re,Ue)?Math.round(Ke*3):0,yLabels:gn(re,Ue,this.#n,this.#e),xLabels:mn.has(re)?[]:Ue.labels,rotated:!0}),He={doc:this.#i,groups:this.#a,plot:nt,bound:Ue,type:re,grid:this.#n,fontSize:Ke,hidden:this.#h,scheme:Ee,axis:ze,typography:Re,labels:ct,byRuleColour:!this.#e.series};if(re!=="geomap"&&this.#Y(null),this.#e.multiples)this.#t=this.#ue(He),this.#s([]);else if(re==="combo"||re==="pareto")this.#t=o({...He,pareto:re==="pareto",reference:this.#e.reference,annotations:this.#e.annotations}),this.#s(this.#t.series.map(tt=>({key:tt.key,label:tt.label,index:tt.index})));else if(re==="heatmap")this.#t=ce({...He,diverging:this.#e.diverging}),this.#s([]);else if(re==="radar")this.#t=E(He),this.#s(Ue.series.map(tt=>({key:tt.key,label:tt.label,index:tt.index})));else if(re==="gauge")this.#t=B({...He,min:this.#e.min,max:this.#e.max,target:this.#e.target}),this.#s([]);else if(re==="sankey")this.#t=ut(He),this.#s([]);else if(re==="chord")this.#t=mt(He),this.#s([]);else if(re==="network")this.#t=kt({...He,iterations:this.#e.iterations,icon:this.#e.icon,linkWidth:this.#e.linkWidth}),this.#s(Array.isArray(this.#t.legend)?this.#t.legend:[]);else if(re==="stream")this.#t=Ut(He),this.#s(Ue.series.map(tt=>({key:tt.key,label:tt.label,index:tt.index})));else if(re==="marimekko")this.#t=Ot(He),this.#s(Ue.series.map(tt=>({key:tt.key,label:tt.label,index:tt.index})));else if(re==="violin")this.#t=Lt(He),this.#s([]);else if(re==="gantt")this.#t=It({...He,spec:this.#e,rows:Ue.rows||[]}),this.#s([]);else if(re==="geomap")this.#t=Te({...He,shapes:this.#e.shapes,codeProperty:this.#e.codeProperty,diverging:this.#e.diverging,projection:this.#e.projection,projectionOptions:this.#e.projectionOptions,layer:this.#e.layer,graticule:this.#e.graticule,zoom:this.#m.zoom,centreOffset:this.#m.offset}),this.#s([]),this.#Y(this.#t);else if(re==="correlogram")this.#t=se({...He,columns:this.#ge(),method:this.#e.method,values:this.#e.values}),this.#s([]);else if(re==="forest")this.#t=V(He),this.#s([]);else if(re==="funnel")this.#t=C(He),this.#s([]);else if(re==="candlestick")this.#t=q(He),this.#s([]);else if(Fn.has(re)){if(re==="histogram")this.#t=u({...He,buckets:this.#e.buckets,curve:this.#e.curve});else if(re==="movingRange")this.#t=n(He);else if(re==="control"||re==="capability"){const tt=this.#e.y||this.#e.measure,Et=this.#n&&this.#n.statistics;this.#t=(re==="capability"?b:$)({...He,capability:Et&&tt?Et.capability(tt,{by:this.#e.x,baseline:this.#e.baseline,rules:this.#e.rules,confidence:this.#e.confidence,...this.#e.spec||{}}):null})}else re==="qq"?this.#t=d(He):re==="ecdf"?this.#t=l(He):re==="lorenz"?this.#t=x(He):this.#t=g(He);this.#s([])}else{this.#t=ue({...He,fit:this.#e.fit,trend:this.#e.trend,band:this.#e.band,error:this.#e.error,dense:Dt({series:Ue.series,canvas:this.#e.canvas}),downsampleTo:this.#e.downsample,stack:this.#e.stack,reference:this.#e.reference,annotations:this.#e.annotations,sizes:this.#he(Ue)});const tt=Array.isArray(this.#t.legend)?this.#t.legend:null;this.#s(tt||(Ue.series.length>1?Ue.series.map(Et=>({key:Et.key,label:Et.label,index:Et.index})):[]))}}const ht=this.#t&&this.#t.errorBars;if(this.#e.error&&ht&&ht.marks&&!this.#D&&(!ht.drawn||ht.singleSkipped)){this.#D=!0;const nt=this.#i&&this.#i.defaultView,He=nt&&nt.console||(typeof globalThis<"u"?globalThis.console:null);if(He&&typeof He.warn=="function"){let tt;ht.drawn?tt=`[lattice] error bars were requested but ${ht.singleSkipped} of ${ht.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" }\`.`:tt=ht.single===ht.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.",He.warn(tt)}}return this.#t&&(this.#t.plot=this.#t.plot||Xn(this.#t,H,ae)),this.#r&&(this.#r.outside=this.#t&&this.#t.outside||0),this.#e.selection&&this.#V(),this.#J(),this.#be(re,Ue,xt),this.#ce(ze),{width:H,height:ae,chartType:re,categories:Ue.categories||[],empty:!!Ue.empty}}#ce(z){const H=v(z&&z.x),ae=H?Math.min(Hn,Math.max(Wn,Math.floor(H/4))):0;if(this.#A||!ae){this.#R();return}if(this.#v&&this.#L===ae)return;this.#R(),this.#L=ae;const ve=Tt(this.#i),re=ve&&typeof ve.setInterval=="function"?ve.setInterval.bind(ve):setInterval;this.#v=re(()=>{this.#A||this.#i&&this.#i.hidden||this.#f&&this.#f.isConnected===!1||this.schedule()},ae);const Ee=this.#v;Ee&&typeof Ee.unref=="function"&&Ee.unref()}#R(){if(this.#v===null)return;const z=Tt(this.#i);(z&&typeof z.clearInterval=="function"?z.clearInterval.bind(z):clearInterval)(this.#v),this.#v=null,this.#L=0}#ue(z){const H=ge(z.bound),ae=be({count:H.length,plot:z.plot}),ve=[];for(const Re of z.bound.series)for(const Ke of Re.points)ve.push(Ke.y);const re=r(ve,{zero:z.type!=="line"}),Ee=new ie(this.#a.overlay);Z(this.#a,z.plot);const ze=new ie(this.#a.marks);new ie(this.#a.grid).finish(),new ie(this.#a.axis).finish(),new ie(this.#a.rules).finish();let Le=null;for(let Re=0;Re<ae.length;Re++){const Ke=ae[Re],ct=H[Re],xt={left:Ke.x,top:Ke.y,width:Ke.width,height:Ke.height,right:Ke.x+Ke.width,bottom:Ke.y+Ke.height,gutter:{left:0,bottom:0}};Le=ue({...z,plot:xt,bound:ct.bound,domain:re,pool:ze,axes:!1});const Ue=Ee.next("text",`${Oe}__panel-title`);ot(Ue,{x:Ae(Ke.x),y:Ae(Ke.y-4),"text-anchor":"start"}),pe(Ue,ct.label)}return ze.finish(),Ee.finish(),{...Le||{},panels:ae,multiples:!0}}#fe(z,H){return z==="combo"||z==="pareto"?!0:!hn.has(z)||z==="horizontalBar"||z==="waterfall"?!1:!!(H&&Array.isArray(H.series)&&H.series.some(ae=>ae.axis==="right"&&!this.#h.has(ae.key)))}#he(z){if(this.#e.type!=="bubble"||!this.#e.size)return null;const H=[];for(const ve of z.series||[])for(const re of ve.points)typeof re.size=="number"&&H.push(re.size);const ae=Ht(H);return ae?D(ae,[3,Math.max(6,Math.min(28,this.#e.maxRadius||22))]):null}#de(z){this.#J(),pe(this.#k,z),this.#k.removeAttribute("hidden"),this.#o.setAttribute("hidden","");for(const H of Object.values(this.#a))ke(H);ke(this.#p),ke(this.#w),this.#t=null}#J(){const z=this.#n.licence;if(!!!(z&&typeof z.watermark=="function"&&z.watermark())){this.#g&&this.#g.parentNode&&this.#g.parentNode.removeChild(this.#g),this.#g=null;return}if(this.#g&&this.#g.parentNode)return;const ae=this.#i,ve=le(ae,"div",`${Oe}__watermark`);ve.setAttribute("role","note");const re=le(ae,"a",`${Oe}__watermark-link`);re.setAttribute("href","https://www.latticegrid.dev"),re.setAttribute("target","_blank"),re.setAttribute("rel","noopener noreferrer"),pe(re,this.#n.messages.t("licence.watermark")),ve.appendChild(re),this.#g=ve,this.#f&&this.#f.appendChild(ve)}#me(){const z=this.#e.legend;if(z===!1)return{show:!1,position:"bottom",align:"start",shape:"square",maxItems:0,isolate:!1};const H=z&&typeof z=="object"?z:{};return{show:!0,position:["top","bottom","left","right"].includes(H.position)?H.position:"bottom",align:["start","centre","center","end"].includes(H.align)?H.align:"start",shape:["square","circle","line"].includes(H.shape)?H.shape:"square",maxItems:Number.isFinite(H.maxItems)&&H.maxItems>0?Number(H.maxItems):0,isolate:!!H.isolate}}#ge(){const z=this.#e.columns;if(Array.isArray(z)&&z.length)return z.slice(0,fn);const H=this.#n;return!H||!H.columns||typeof H.columns.visible!="function"?[]:H.columns.visible().filter(ae=>!ae.generated&&(ae.type==="number"||ae.type==="currency"||ae.type==="percent"||ae.type==="integer")).map(ae=>ae.id).slice(0,fn)}#s(z){ke(this.#p);const H=this.#me();if(ot(this.#p,{"data-position":H.position,"data-align":H.align}),!z.length||!H.show)return;const ae=this.#i,ve=H.maxItems?z.slice(0,H.maxItems):z;for(const re of ve){const Ee=le(ae,"button",`${Oe}__legend-item`);Ee.setAttribute("type","button");const ze=!this.#h.has(re.key);Ee.setAttribute("aria-pressed",ze?"true":"false");const Le=le(ae,"span",`${Oe}__swatch ${Oe}__swatch--${H.shape}`);Le.setAttribute("style",`background:${re.colour||this.#N.series(re.index)}`);const Re=le(ae,"span");Ye(Re,this.#C.small),pe(Re,re.label),A(Ee,[Le,Re]),Ee.addEventListener("click",()=>{this.#pe(re,z,H)}),this.#p.appendChild(Ee)}if(H.maxItems&&z.length>ve.length){const re=le(ae,"span",`${Oe}__legend-more`);Ye(re,this.#C.small),pe(re,this.#n.messages.t("chart.legendMore",{count:z.length-ve.length})),this.#p.appendChild(re)}}#pe(z,H,ae){if(ae.isolate){const ve=H.filter(Ee=>Ee.key!==z.key),re=ve.every(Ee=>this.#h.has(Ee.key))&&!this.#h.has(z.key);if(this.#h.clear(),!re)for(const Ee of ve)this.#h.add(Ee.key)}else this.#h.has(z.key)?this.#h.delete(z.key):this.#h.add(z.key);this.emit("legend",{label:z.label,key:z.key,hidden:this.#h.has(z.key),hiddenKeys:[...this.#h]}),this.draw()}#be(z,H,ae){const ve=this.#n.messages,re=H.measure&&H.measure.title||"",Ee=H.dimension&&H.dimension.title||"",ze=re?Ee&&!ae?"chart.summary":"chart.summaryShare":"chart.summaryType",Le=ve.t(ze,{type:ve.t(`chart.type.${z}`),measure:re,dimension:Ee});ot(this.#o,{"aria-label":Le}),ke(this.#w);const Re=this.#i,Ke=le(Re,"table"),ct=le(Re,"caption");pe(ct,ve.t("chart.dataTable")),Ke.appendChild(ct);const xt=le(Re,"tr"),Ue=le(Re,"th");pe(Ue,ae?"":Ee),xt.appendChild(Ue);const _t=[];if(ae&&H.root){for(const ht of H.root.children){const nt=le(Re,"tr"),He=le(Re,"th");pe(He,ht.label);const tt=le(Re,"td");pe(tt,e(ht.total,ve)),A(nt,[He,tt]),_t.push(nt)}const pt=le(Re,"th");pe(pt,re),xt.appendChild(pt)}else{const pt=this.#T(),ht=this.#t&&Array.isArray(this.#t.labels)&&Array.isArray(this.#t.series)&&Array.isArray(this.#t.categories)?this.#t.series:H.series||[];for(const nt of ht){const He=le(Re,"th");pe(He,nt.label),xt.appendChild(He)}for(let nt=0;nt<(pt.labels||[]).length;nt++){const He=le(Re,"tr"),tt=le(Re,"th");pe(tt,pt.labels[nt]),He.appendChild(tt);for(const Et of ht){const wn=le(Re,"td"),on=Et.points[nt];pe(wn,on&&on.y!==null?e(on.y,ve):""),He.appendChild(wn)}_t.push(He)}}Ke.appendChild(xt);for(const pt of _t)Ke.appendChild(pt);this.#w.appendChild(Ke);const Ct=this.#t&&this.#t.annotations;if(Array.isArray(Ct)&&Ct.length){const pt=le(Re,"ul",`${Oe}__annotation-list`);for(const ht of Ct){if(!ht||!ht.text)continue;const nt=le(Re,"li");pe(nt,ht.text),pt.appendChild(nt)}pt.childNodes&&pt.childNodes.length&&this.#w.appendChild(pt)}}on(z,H){return typeof H!="function"?()=>{}:(this.#S.has(z)||this.#S.set(z,new Set),this.#S.get(z).add(H),()=>{const ae=this.#S.get(z);ae&&ae.delete(H)})}emit(z,H){const ae={...H,type:z,chart:this,grid:this.#n},ve=this.#e[`on${z.charAt(0).toUpperCase()}${z.slice(1)}`],re=[...this.#S.get(z)||[]];typeof ve=="function"&&re.unshift(ve);for(const Ee of re)try{Ee(ae)}catch(ze){const Le=Tt(this.#i);Le.console&&typeof Le.console.error=="function"&&Le.console.error(`[lattice] a chart "${z}" listener threw`,ze)}return ae}data(){return this.#r}ascend(z){if(!this.#u||!this.#u.length)return[];const H=Number.isFinite(z)&&z>0?Number(z):this.#u.length;return this.#u=this.#u.slice(0,Math.max(0,this.#u.length-H)),this.emit("drill",{path:[...this.#u],label:this.#u[this.#u.length-1]||null}),this.draw(),[...this.#u]}update(z){this.#e={...this.#e,...z},this.draw()}get element(){return this.#f}toSVG(z){if(!this.#o)return"";const H=Tt(this.#i);let ae=this.#o;return z&&z.inlineStyles&&H.getComputedStyle&&this.#o.cloneNode&&(ae=this.#o.cloneNode(!0),Jn(this.#o,ae,H),ae.setAttribute("xmlns","http://www.w3.org/2000/svg")),typeof H.XMLSerializer=="function"?new H.XMLSerializer().serializeToString(ae):ae.outerHTML||""}async toPNG(z){const H=Tt(this.#i);if(!this.#o||!H.Image||!this.#i.createElement)return null;const ae=z&&z.scale||H.devicePixelRatio||1,ve=this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():Nt,re=Math.max(1,Math.round(ve.width||Nt.width)),Ee=Math.max(1,Math.round(ve.height||Nt.height)),ze=this.toSVG({inlineStyles:!0}),Le=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(ze)}`,Re=new H.Image;await new Promise((Ue,_t)=>{Re.onload=Ue,Re.onerror=()=>_t(new Error("the chart could not be rasterised")),Re.src=Le});const Ke=this.#i.createElement("canvas");Ke.width=Math.round(re*ae),Ke.height=Math.round(Ee*ae);const ct=Ke.getContext("2d"),xt=z&&"background"in z?z.background:"#ffffff";return xt&&(ct.fillStyle=xt,ct.fillRect(0,0,Ke.width,Ke.height)),ct.drawImage(Re,0,0,Ke.width,Ke.height),new Promise(Ue=>Ke.toBlob(Ue,"image/png"))}toCSV(){const z=this.#r;if(!z)return"";const H=re=>{const Ee=re==null?"":String(re);return/[",\n]/.test(Ee)?`"${Ee.replace(/"/g,'""')}"`:Ee};if(z.root){const re=[["Label",z.measure.title||"Value"].map(H).join(",")];for(const Ee of z.root.children)re.push([H(Ee.label),H(Ee.total)].join(","));return re.join(`
|
|
225
|
+
`)}const ve=[[z.dimension.title||"",...z.series.map(re=>re.label)].map(H).join(",")];for(let re=0;re<z.labels.length;re++){const Ee=[H(z.labels[re])];for(const ze of z.series){const Le=ze.points[re];Ee.push(H(Le&&Le.y!==null?Le.y:""))}ve.push(Ee.join(","))}return ve.join(`
|
|
226
|
+
`)}destroy(){if(!this.#A){this.#A=!0,this.#R();for(const z of this.#b)z();this.#b=[],this.#M&&this.#M.disconnect(),this.#M=null,this.#f&&this.#f.parentNode&&this.#f.parentNode.removeChild(this.#f),this.#t=null,this.#r=null,this.#S.clear()}}}function yn(Ze){if(!Ze||!Ze.grid)throw new Error("createChart needs a grid");const z=Ze.grid.element?Ze.grid.element.ownerDocument:globalThis.document,H=Zn(z,Ze.container);if(!H)throw new Error("createChart needs a container element");const{grid:ae,container:ve,...re}=Ze;return new bn({grid:ae,container:H,spec:re})}function qn(Ze,z){if(!z||!z.container)return null;const H=Gt(Ze,z);if(!H.spec)return null;const{container:ae,range:ve,...re}=z,Ee=[{provided:["x"],derivedKeys:["x"]},{provided:["y","measures"],derivedKeys:["y","measures"]},{provided:["series"],derivedKeys:["series"]}],ze={...H.spec};for(const Le of Ee)if(Le.provided.some(Re=>Re in re))for(const Re of Le.derivedKeys)delete ze[Re];return yn({...re,...ze,grid:Ze,container:ae})}function eo(Ze,z={}){return!!Gt(Ze,z).spec}});var Vt=ln("packages/modules/charts/index.js");if(typeof module=="object"&&module.exports)module.exports=Vt;else if(typeof define=="function"&&define.amd)define(function(){return Vt});else{var kn=rn.LatticeGrid||(rn.LatticeGrid={});for(var Jt in Vt)Jt!=="default"&&(kn[Jt]=Vt[Jt])}})(typeof globalThis<"u"?globalThis:this);
|
|
227
227
|
|
|
228
228
|
//# sourceMappingURL=charts.min.js.map
|