@toclocoinc/lattice-grid 1.71.1 → 1.71.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/angular/package.json +1 -1
- package/docs/API.html +42 -8
- 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 +39 -5
- 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 +2 -2
- package/docs/api/kanban.html +1 -1
- package/docs/api/kpi.html +1 -1
- package/docs/api/layout.html +1 -1
- package/docs/api/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 +13 -2
- package/lattice-grid.d.ts +31 -7
- 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 +13 -9
- package/modules/charts.esm.min.js.map +2 -2
- package/modules/charts.min.cjs +141 -137
- package/modules/charts.min.js +141 -137
- 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 +1 -1
- package/modules/geo-europe-nuts.min.js +1 -1
- package/modules/geo-uk.d.ts +1 -1
- package/modules/geo-uk.esm.min.js +1 -1
- package/modules/geo-uk.min.cjs +1 -1
- package/modules/geo-uk.min.js +1 -1
- package/modules/geo-us-states.d.ts +1 -1
- package/modules/geo-us-states.esm.min.js +1 -1
- package/modules/geo-us-states.min.cjs +1 -1
- package/modules/geo-us-states.min.js +1 -1
- package/modules/geo-world-110m.d.ts +1 -1
- package/modules/geo-world-110m.esm.min.js +1 -1
- package/modules/geo-world-110m.min.cjs +1 -1
- package/modules/geo-world-110m.min.js +1 -1
- package/modules/geo-world-50m.d.ts +1 -1
- package/modules/geo-world-50m.esm.min.js +1 -1
- package/modules/geo-world-50m.min.cjs +1 -1
- package/modules/geo-world-50m.min.js +1 -1
- package/modules/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,197 +1,201 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.71.
|
|
2
|
+
* Lattice Grid 1.71.3, charts module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
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
|
-
.${
|
|
6
|
+
(function(ln){"use strict";var cn=Object.create(null),un=Object.create(null);function Xe(a,V){cn[a]=V}function fn(a){var V=un[a];if(V)return V;var ve=Object.create(null);un[a]=ve;var ee=cn[a];if(!ee)throw new Error("[lattice] missing module: "+a);return ee(ve,fn),ve}Xe("packages/modules/charts/svg.js",function(a,V){"use strict";Object.defineProperty(a,"SVG_NS",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(a,"el",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(a,"svg",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"attr",{enumerable:!0,get:function(){return de}}),Object.defineProperty(a,"attrs",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(a,"setText",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(a,"clear",{enumerable:!0,get:function(){return X}}),Object.defineProperty(a,"append",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"path",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(a,"ribbonPath",{enumerable:!0,get:function(){return N}}),Object.defineProperty(a,"round",{enumerable:!0,get:function(){return d}}),Object.defineProperty(a,"pathRings",{enumerable:!0,get:function(){return D}}),Object.defineProperty(a,"insideRings",{enumerable:!0,get:function(){return z}});const ve="http://www.w3.org/2000/svg";function ee(x,B,Q){const F=x.createElement(B);return Q&&F.setAttribute("class",Q),F}function M(x,B,Q){const F=x.createElementNS(ve,B);if(Q)for(const I of Object.keys(Q))F.setAttribute(I,String(Q[I]));return F}function de(x,B,Q){x&&(Q==null?x.removeAttribute(B):x.setAttribute(B,String(Q)))}function ce(x,B){if(x)for(const Q of Object.keys(B))de(x,Q,B[Q])}function Y(x,B){x&&(x.textContent=B==null?"":String(B))}function X(x){if(x)for(;x.firstChild;)x.removeChild(x.firstChild)}function U(x,B){for(const Q of B)Q&&x.appendChild(Q);return x}function ae(x){return x.join(" ")}function N(x){if(!x||x.length<2)return"";const B=["M",x[0].x,x[0].upper];for(let Q=1;Q<x.length;Q++)B.push("L",x[Q].x,x[Q].upper);for(let Q=x.length-1;Q>=0;Q--)B.push("L",x[Q].x,x[Q].lower);return B.push("Z"),ae(B)}function d(x){return Math.round(x*100)/100}function D(x){const B=[];let Q=[];const F=String(x||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let I="",ne=[];const S=()=>{if(!I||!ne.length){ne=[];return}if(I==="M"||I==="L")for(let Z=0;Z+1<ne.length;Z+=2)Q.push([ne[Z],ne[Z+1]]);else I!=="Z"&&ne.length>=2&&Q.push([ne[ne.length-2],ne[ne.length-1]]);ne=[]};for(const Z of F){if(/[A-Za-z]/.test(Z)){if(S(),Z==="Z"||Z==="z"){Q.length>2&&B.push(Q),Q=[],I="";continue}Z==="M"&&Q.length>2&&(B.push(Q),Q=[]),I=Z;continue}ne.push(Number(Z))}return S(),Q.length>2&&B.push(Q),B}function z(x,B,Q){let F=!1;for(const I of x)for(let ne=0,S=I.length-1;ne<I.length;S=ne++){const[Z,te]=I[ne],[q,E]=I[S];te>Q!=E>Q&&B<(q-Z)*(Q-te)/(E-te||1e-12)+Z&&(F=!F)}return F}}),Xe("packages/modules/charts/typography.js",function(a,V){"use strict";Object.defineProperty(a,"BASE_SIZE",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(a,"BASE_FAMILY",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(a,"CHAR_RATIO",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"resolveType",{enumerable:!0,get:function(){return de}}),Object.defineProperty(a,"textWidth",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(a,"widestLabel",{enumerable:!0,get:function(){return X}}),Object.defineProperty(a,"truncateTo",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"applySize",{enumerable:!0,get:function(){return ae}});const ve=12,ee="var(--lattice-font-family, system-ui, -apple-system, sans-serif)",M=.62;function de(N){const d=N&&N.font,D=typeof d=="number"?{size:d}:d||{},z=ce(D.size,ve);return{family:D.family||ee,size:z,small:ce(D.small??D.tickSize,Math.max(9,z-1)),title:ce(D.title,Math.round(z*1.15)),axisTitle:ce(D.axisTitle,Math.max(10,z-1)),weight:D.weight||"inherit"}}function ce(N,d){const D=Number(N);return Number.isFinite(D)&&D>0?D:d}function Y(N,d){return String(N??"").length*d*M}function X(N,d){let D=0;for(const z of N||[]){const x=Y(z,d);x>D&&(D=x)}return D}function U(N,d,D){const z=String(N??""),x=Math.floor(d/(D*M));return x<=0?"":z.length<=x?z:x===1?"…":`${z.slice(0,x-1)}…`}function ae(N,d){!N||!Number.isFinite(d)||(N.style?N.style.fontSize=`${d}px`:N.setAttribute("style",`font-size:${d}px`))}}),Xe("packages/modules/charts/frame.js",function(a,V){"use strict";Object.defineProperty(a,"LABEL_GAP",{enumerable:!0,get:function(){return X}}),Object.defineProperty(a,"LABEL_GUTTER_SHARE",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"resolveMargin",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(a,"plotRect",{enumerable:!0,get:function(){return N}}),Object.defineProperty(a,"shouldRotate",{enumerable:!0,get:function(){return d}}),Object.defineProperty(a,"Pool",{enumerable:!0,get:function(){return D}});const ee=V("packages/modules/charts/svg.js").SVG_NS,M=V("packages/modules/charts/typography.js"),de=M.textWidth,ce=M.widestLabel,Y=8,X=6,U=.4;function ae(z,x){const B=typeof z=="number"?z:x,Q=z&&typeof z=="object"?z:{},F=I=>Number.isFinite(I)&&I>=0?Number(I):B;return{base:B,top:F(Q.top),right:F(Q.right),bottom:F(Q.bottom),left:F(Q.left)}}function N(z){const x=ae(z.margin,typeof z.padding=="number"?z.padding:8),B=x.base,Q=z.fontSize||12,F=z.yLabels||[],I=z.xLabels||[],ne=z.titles||{},S=z.titleSize||Q,Z=f=>f?S+X:0,te=ce(F,Q),q=(F.length?Math.min(z.width*U,x.left+te+X):Math.max(Y,x.left))+Z(ne.left),E=ce(I.map(f=>String(f).slice(0,14)),Q),L=(I.length?z.rotated?Math.min(z.height*U,X+E):Q+X+x.bottom:Math.max(Y,x.bottom))+Z(ne.bottom),se=x.right+Z(ne.right)+(z.rightGutter||0),R=x.top+(z.topGutter||0),$=Math.max(0,z.width-q-se),he=Math.max(0,z.height-R-L);return{left:q,top:R,width:$,height:he,right:q+$,bottom:R+he,gutter:{left:q,bottom:L,right:se,top:R}}}function d(z,x,B,Q){if(!z.length||x<=0)return!1;const F=Number.isFinite(Q)&&Q>0?Number(Q):1;return ce(z,B)>x*F-4}class D{#l;#n=0;constructor(x){this.#l=x}next(x,B){const Q=this.#l.childNodes[this.#n],F=Q&&Q.tagName;if(F&&String(F).toLowerCase()===x.toLowerCase())return this.#n++,Q;const I=this.#l.ownerDocument.createElementNS(ee,x);return B&&I.setAttribute("class",B),Q?this.#l.insertBefore(I,Q):this.#l.appendChild(I),this.#n++,I}finish(){for(;this.#l.childNodes.length>this.#n;)this.#l.removeChild(this.#l.lastChild);this.#n=0}}}),Xe("packages/core/src/internal/util.js",function(a,V){"use strict";Object.defineProperty(a,"VERSION",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"reportedWarnings",{enumerable:!0,get:function(){return d}}),Object.defineProperty(a,"warnOnce",{enumerable:!0,get:function(){return D}}),Object.defineProperty(a,"infoOnce",{enumerable:!0,get:function(){return z}}),Object.defineProperty(a,"resetWarnings",{enumerable:!0,get:function(){return x}}),Object.defineProperty(a,"fail",{enumerable:!0,get:function(){return B}}),Object.defineProperty(a,"invariant",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(a,"DEV",{enumerable:!0,get:function(){return F}}),Object.defineProperty(a,"isObject",{enumerable:!0,get:function(){return I}}),Object.defineProperty(a,"isFunction",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(a,"isNil",{enumerable:!0,get:function(){return S}}),Object.defineProperty(a,"isBlank",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(a,"isCtor",{enumerable:!0,get:function(){return te}}),Object.defineProperty(a,"pathGetter",{enumerable:!0,get:function(){return E}}),Object.defineProperty(a,"pathSetter",{enumerable:!0,get:function(){return se}}),Object.defineProperty(a,"getPath",{enumerable:!0,get:function(){return R}}),Object.defineProperty(a,"setPath",{enumerable:!0,get:function(){return $}}),Object.defineProperty(a,"humanise",{enumerable:!0,get:function(){return he}}),Object.defineProperty(a,"escapeHtml",{enumerable:!0,get:function(){return J}}),Object.defineProperty(a,"titleCase",{enumerable:!0,get:function(){return H}}),Object.defineProperty(a,"expand",{enumerable:!0,get:function(){return e}}),Object.defineProperty(a,"toArray",{enumerable:!0,get:function(){return u}}),Object.defineProperty(a,"merge",{enumerable:!0,get:function(){return o}}),Object.defineProperty(a,"mergeRow",{enumerable:!0,get:function(){return w}}),Object.defineProperty(a,"Lru",{enumerable:!0,get:function(){return p}}),Object.defineProperty(a,"collator",{enumerable:!0,get:function(){return v}}),Object.defineProperty(a,"defaultCompare",{enumerable:!0,get:function(){return r}}),Object.defineProperty(a,"now",{enumerable:!0,get:function(){return s}}),Object.defineProperty(a,"nextFrame",{enumerable:!0,get:function(){return t}}),Object.defineProperty(a,"cancelFrame",{enumerable:!0,get:function(){return c}}),Object.defineProperty(a,"frameBatched",{enumerable:!0,get:function(){return P}}),Object.defineProperty(a,"settleDebounce",{enumerable:!0,get:function(){return g}}),Object.defineProperty(a,"whenIdle",{enumerable:!0,get:function(){return y}}),Object.defineProperty(a,"uid",{enumerable:!0,get:function(){return h}});const ve="1.71.3";async function ee(){return ve}const M="1.71.3",de=new Set,ce=2e3;function Y(i){if(de.add(i),de.size>ce){const n=de.values().next().value;n!==void 0&&de.delete(n)}}const X=[],U=500;function ae(i,n,m){X.push({key:i,level:n,message:m.map(G=>typeof G=="string"?G:N(G)).join(" "),at:Date.now()}),X.length>U&&X.shift()}function N(i){if(i instanceof Error)return i.message;try{return JSON.stringify(i)}catch{return String(i)}}function d(){return X.map(i=>({...i}))}function D(i,...n){de.has(i)||(Y(i),ae(i,"warn",n),console.warn("[lattice]",...n))}function z(i,...n){de.has(i)||(Y(i),ae(i,"info",n),console.info("[lattice]",...n))}function x(){de.clear(),X.length=0}function B(i,n){const m=new Error(`[lattice] ${i}`);throw n!==void 0&&(m.cause=n),m}function Q(i,n){i||B(n)}const F=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function I(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)}function ne(i){return typeof i=="function"}function S(i){return i==null}function Z(i){return i==null||i===""}function te(i){return typeof i!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(i))?!0:!!(i.prototype&&Object.getOwnPropertyNames(i.prototype).length>1)}const q=new Map;function E(i){let n=q.get(i);if(n)return n;if(!i.includes("."))n=m=>m?.[i];else{const m=i.split("."),G=m.length;n=C=>{let O=C;for(let W=0;W<G;W++){if(O==null)return;O=O[m[W]]}return O}}return q.set(i,n),n}const L=new Map;function se(i){let n=L.get(i);if(n)return n;if(!i.includes("."))n=(m,G)=>{m!=null&&(m[i]=G)};else{const m=i.split("."),G=m.length-1;n=(C,O)=>{let W=C;for(let re=0;re<G;re++){if(W==null)return;const _=m[re];W[_]==null&&(W[_]={}),W=W[_]}W!=null&&(W[m[G]]=O)}}return L.set(i,n),n}function R(i,n){return E(n)(i)}function $(i,n,m){se(n)(i,m)}function he(i){return i?(i.includes(".")?i.slice(i.lastIndexOf(".")+1):i).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(/^./,m=>m.toUpperCase()):""}const f={"&":"&","<":"<",">":">",'"':""","'":"'"};function J(i){const n=i==null?"":String(i);return/[&<>"']/.test(n)?n.replace(/[&<>"']/g,m=>f[m]):n}function H(i){return String(i).replace(/\w\S*/g,n=>n[0].toUpperCase()+n.slice(1).toLowerCase())}function e(i,n,m){if(i!==void 0)return i===!0?{enabled:!0,...m}:i===!1?{enabled:!1}:I(i)?i:{[n]:i,enabled:!0}}function u(i){return i==null?[]:Array.isArray(i)?i:[i]}const k=Object.freeze(new Set(["__proto__","constructor","prototype"]));function o(i,n){if(!I(i))return I(n)?{...n}:n;if(!I(n))return n===void 0?i:n;const m={...i};for(const G of Object.keys(n)){if(k.has(G))continue;const C=n[G];C!==void 0&&(m[G]=I(C)&&I(m[G])?o(m[G],C):C)}return m}function w(i,n){if(!I(i)||!I(n)||i===n)return n;const m=Object.create(Object.getPrototypeOf(i));return Object.assign(m,i,n),m}class p{#l;#n=new Map;#c;constructor(n=256,m=null){this.#l=n,this.#c=m}get size(){return this.#n.size}get max(){return this.#l}set max(n){this.#l=n,this.#e()}has(n){return this.#n.has(n)}get(n){const m=this.#n;if(!m.has(n))return;const G=m.get(n);return m.delete(n),m.set(n,G),G}peek(n){return this.#n.get(n)}set(n,m){const G=this.#n;return G.has(n)&&G.delete(n),G.set(n,m),this.#e(),m}delete(n){const m=this.#n.get(n);return this.#n.delete(n)&&this.#c&&this.#c(m,n),m}clear(){if(this.#c)for(const[n,m]of this.#n)this.#c(m,n);this.#n.clear()}keys(){return this.#n.keys()}values(){return this.#n.values()}#e(){const n=this.#n;for(;n.size>this.#l;){const m=n.keys().next().value,G=n.get(m);n.delete(m),this.#c&&this.#c(G,m)}}}const l=new Map;function v(i,n){const m=`${i||""}|${n?JSON.stringify(n):""}`;let G=l.get(m);return G||(G=new Intl.Collator(i||void 0,{numeric:!0,sensitivity:"variant",...n}),l.set(m,G)),G}function r(i,n){if(i===n)return 0;if(i==null)return 1;if(n==null)return-1;if(typeof i=="number"&&typeof n=="number")return Number.isNaN(i)?Number.isNaN(n)?0:1:Number.isNaN(n)||i<n?-1:i>n?1:0;const m=String(i),G=String(n);return m<G?-1:m>G?1:0}function s(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const b=typeof requestAnimationFrame=="function";function t(i){return b?requestAnimationFrame(i):setTimeout(()=>i(s()),16)}function c(i){i!=null&&(b?cancelAnimationFrame(i):clearTimeout(i))}function P(i){let n=null,m=null;const G=()=>{n=null;const O=m;m=null,i(...O||[])},C=(...O)=>{m=O,n===null&&(n=t(G))};return C.cancel=()=>{c(n),n=null,m=null},C.flush=()=>{n!==null&&(c(n),G())},C}function g(i,n){let m=null,G=null;const C=()=>{if(m=null,G===null)return;const re=G;G=null,i(...re),O()},O=()=>{m=setTimeout(C,n),typeof m?.unref=="function"&&m.unref()},W=(...re)=>{m===null?(i(...re),O()):(G=re,clearTimeout(m),O())};return W.flush=()=>{if(m!==null&&clearTimeout(m),m=null,G===null)return;const re=G;G=null,i(...re)},W.cancel=()=>{m!==null&&clearTimeout(m),m=null,G=null},W.pending=()=>m!==null||G!==null,W}function y(i,n=50){return typeof requestIdleCallback=="function"?requestIdleCallback(i,{timeout:n}):setTimeout(()=>i({timeRemaining:()=>0,didTimeout:!0}),1)}let j=0;function h(i="l"){return`${i}${(++j).toString(36)}`}}),Xe("packages/modules/charts/scheme.js",function(a,V){"use strict";Object.defineProperty(a,"PALETTE",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"SCHEMES",{enumerable:!0,get:function(){return de}}),Object.defineProperty(a,"registerScheme",{enumerable:!0,get:function(){return X}}),Object.defineProperty(a,"setDefaultScheme",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"schemeNames",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(a,"resolveScheme",{enumerable:!0,get:function(){return z}}),Object.defineProperty(a,"toRgb",{enumerable:!0,get:function(){return B}}),Object.defineProperty(a,"rampStops",{enumerable:!0,get:function(){return Q}});const ee=V("packages/core/src/internal/util.js").warnOnce,M=Object.freeze(["#0072b2","#e69f00","#009e73","#cc79a7","#56b4e9","#d55e00","#7a5195","#6b7d8c"]),de=Object.freeze({default:{series:M,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"}}),ce=new Map;let Y="default";function X(F,I){!F||!I||ce.set(String(F),I)}function U(F){if(typeof F=="string"){Y=F;return}F&&typeof F=="object"&&(ce.set("__default__",F),Y="__default__")}function ae(){return[...Object.keys(de),...ce.keys()].filter(F=>!F.startsWith("__"))}function N(F){return ce.has(F)?ce.get(F):de[F]||null}const d=["series","sequential","diverging","positive","negative"];function D(F){return!F||typeof F!="object"||Array.isArray(F)?!1:!d.some(I=>I in F)}function z(F){const I=N(Y)||de.default,ne=F&&F.scheme,S=D(ne)?ne:null,Z=typeof ne=="string"?N(ne):S?null:ne||null,te=F&&Array.isArray(F.palette)&&F.palette.length?F.palette:null;S&&te&&ee("chart:scheme:array-and-map",'chart "scheme" was given as a name map together with a "palette" array; the two do not combine. Colours came from the map and the array was ignored. Pass one or the other.');const q=S?null:te,E={...de.default,...I,...Z||{}};q&&(E.series=q);const L=!!(Z||q||S),se=E.series&&E.series.length?E.series:M,R=new Map;let $=0;return{...E,series:(f,J)=>{if(S&&J!==void 0&&J!==null){const H=String(J);return Object.prototype.hasOwnProperty.call(S,H)?S[H]:(R.has(H)||R.set(H,$++),x(se,R.get(H),!0))}return x(se,f,L)},explicit:L,nameMap:!!S}}function x(F,I,ne){const S=(I%F.length+F.length)%F.length;return ne?F[S]:`var(--lattice-chart-${S+1}, ${F[S]})`}function B(F){if(typeof F!="string")return null;const I=F.trim(),ne=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(I);if(ne){const te=ne[1];return te.length===3?[0,1,2].map(q=>parseInt(te[q]+te[q],16)):[0,2,4].map(q=>parseInt(te.slice(q,q+2),16))}const S=/^rgba?\(([^)]+)\)$/i.exec(I);if(!S)return null;const Z=S[1].split(/[\s,/]+/).filter(Boolean).slice(0,3).map(Number);return Z.length===3&&Z.every(te=>Number.isFinite(te))?Z:null}function Q(F,I){const ne=I?F.diverging:F.sequential,S=I?de.default.diverging:de.default.sequential,Z=(Array.isArray(ne)?ne:S).map((te,q)=>B(te)||B(S[q])||[0,0,0]);return Z.length>=2?Z:S.map(te=>B(te))}}),Xe("packages/modules/charts/styles.js",function(a,V){"use strict";Object.defineProperty(a,"NS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"seriesColour",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(a,"css",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(a,"injectStyles",{enumerable:!0,get:function(){return X}});const ee=V("packages/modules/charts/scheme.js").PALETTE,M="lat-chartview",de="data-lattice-chartview";function ce(U){const ae=(U%ee.length+ee.length)%ee.length;return`var(--lattice-chart-${ae+1}, ${ee[ae]})`}function Y(){return`
|
|
7
|
+
.${M}{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;
|
|
8
8
|
width:100%;height:100%;box-sizing:border-box;
|
|
9
9
|
font-family:var(--lattice-font-family,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif);
|
|
10
10
|
font-size:var(--lattice-font-size,13px);
|
|
11
11
|
color:var(--lattice-foreground,#1c2126);
|
|
12
12
|
background:var(--lattice-background,#fff);
|
|
13
|
-
--lattice-chart-1:${
|
|
14
|
-
--lattice-chart-3:${
|
|
15
|
-
--lattice-chart-5:${
|
|
16
|
-
--lattice-chart-7:${
|
|
13
|
+
--lattice-chart-1:${ee[0]};--lattice-chart-2:${ee[1]};
|
|
14
|
+
--lattice-chart-3:${ee[2]};--lattice-chart-4:${ee[3]};
|
|
15
|
+
--lattice-chart-5:${ee[4]};--lattice-chart-6:${ee[5]};
|
|
16
|
+
--lattice-chart-7:${ee[6]};--lattice-chart-8:${ee[7]};
|
|
17
17
|
--lattice-chart-grid:var(--lattice-border-color,#dfe3e6);
|
|
18
18
|
--lattice-chart-empty:var(--lattice-surface,#f7f8f9);
|
|
19
19
|
--lattice-chart-axis:var(--lattice-foreground-muted,#5b6670);
|
|
20
20
|
--lattice-chart-map-stroke:var(--lattice-border-color,#dfe3e6)}
|
|
21
|
-
.${
|
|
22
|
-
.${
|
|
23
|
-
.${
|
|
21
|
+
.${M}__figure{margin:0;display:flex;flex-direction:column;flex:1 1 auto;min-height:0}
|
|
22
|
+
.${M}__caption{padding:2px 4px 6px;display:flex;flex-direction:column;gap:2px}
|
|
23
|
+
.${M}__title{font-weight:var(--lattice-header-font-weight,600);
|
|
24
24
|
font-size:var(--lattice-font-size,13px)}
|
|
25
|
-
.${
|
|
25
|
+
.${M}__subtitle{color:var(--lattice-foreground-muted,#5b6670);
|
|
26
26
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
27
|
-
.${
|
|
27
|
+
.${M}__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
|
+
.${M}__data-label{fill:var(--lattice-chart-axis);pointer-events:none}
|
|
33
|
+
.${M}__data-label[data-inside="true"]{fill:var(--lattice-background,#fff)}
|
|
34
|
+
.${M}__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
|
+
.${M}__plot[hidden]{display:none}
|
|
39
|
+
.${M}__grid line{stroke:var(--lattice-chart-grid);stroke-width:1;shape-rendering:crispEdges}
|
|
40
|
+
.${M}__axis line{stroke:var(--lattice-chart-axis);stroke-width:1;shape-rendering:crispEdges}
|
|
41
|
+
.${M}__axis text{fill:var(--lattice-chart-axis);
|
|
42
42
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
43
|
-
.${
|
|
43
|
+
.${M}__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
|
+
.${M}__line{fill:none;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
|
|
46
|
+
.${M}__area{stroke:none;opacity:0.18}
|
|
47
|
+
.${M}__bar,.${M}__slice{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
48
|
+
.${M}__point{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
49
|
+
.${M}__mark[data-dim]{opacity:0.18}
|
|
50
|
+
.${M}__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
|
+
.${M}__plot:focus{outline:none}
|
|
53
|
+
.${M}__plot:focus-visible{outline:var(--lattice-focus-width,2px) solid var(--lattice-focus-color,#1a6bc7);
|
|
54
54
|
outline-offset:-2px}
|
|
55
|
-
.${
|
|
56
|
-
.${
|
|
55
|
+
.${M}__mark:focus{outline:none}
|
|
56
|
+
.${M}__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
|
+
.${M}__box{stroke-width:1}
|
|
59
|
+
.${M}__whisker{stroke-width:1;fill:none}
|
|
60
|
+
.${M}__density{stroke-width:1.5;fill:none;opacity:.85}
|
|
61
|
+
.${M}__fit{stroke-width:1.5;fill:none;opacity:.9}
|
|
62
|
+
.${M}__fit-label{font-weight:600;opacity:.9}
|
|
63
|
+
.${M}__trend{stroke-width:1.75;fill:none;opacity:.9}
|
|
64
|
+
.${M}__trend-forecast{stroke-width:1.75;fill:none;opacity:.9;stroke-dasharray:5 4}
|
|
65
|
+
.${M}__trend-label{font-weight:600;opacity:.9}
|
|
66
|
+
.${M}__trend-band{stroke:none;pointer-events:none}
|
|
67
|
+
.${M}__qq-line{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;stroke-dasharray:4 3;fill:none}
|
|
68
|
+
.${M}__ecdf{stroke-width:1.5;fill:none}
|
|
69
|
+
.${M}__control-line{stroke-width:1.25;fill:none}
|
|
70
|
+
.${M}__error-bar{stroke:var(--lattice-foreground,#1a1a1a);stroke-width:1.5;fill:none;stroke-linecap:round}
|
|
71
|
+
.${M}__control-centre{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;fill:none}
|
|
72
|
+
.${M}__control-limit{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;stroke-dasharray:6 3;fill:none}
|
|
73
|
+
.${M}__spec-limit{stroke:var(--lattice-danger,#a4262c);stroke-width:1;stroke-dasharray:2 3;fill:none}
|
|
74
|
+
.${M}__spec-target{stroke:var(--lattice-success,#107c41);stroke-width:1;stroke-dasharray:1 4;fill:none}
|
|
75
|
+
.${M}__control-name{fill:var(--lattice-foreground-muted,#5b6570);font-size:9px;letter-spacing:.04em}
|
|
76
|
+
.${M}__control-rule{fill:var(--lattice-danger,#a4262c);font-size:9px;font-weight:600}
|
|
77
|
+
.${M}__capability-within{stroke:var(--lattice-foreground,#1a1a1a);stroke-width:1.5;fill:none}
|
|
78
|
+
.${M}__capability-overall{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1.5;stroke-dasharray:4 3;fill:none}
|
|
79
|
+
.${M}__lorenz{stroke-width:1.75;fill:none}
|
|
80
|
+
.${M}__lorenz-equality{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;stroke-dasharray:4 3;fill:none}
|
|
81
|
+
.${M}__median{fill:none}
|
|
82
|
+
.${M}__tile{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
83
|
+
.${M}__tile-label{fill:var(--lattice-background,#fff);
|
|
84
84
|
font-size:var(--lattice-font-size-sm,11px);pointer-events:none}
|
|
85
|
-
.${
|
|
86
|
-
.${
|
|
87
|
-
.${
|
|
85
|
+
.${M}__tile-label--branch{fill:var(--lattice-foreground,#1d2733)}
|
|
86
|
+
.${M}__reference{stroke:var(--lattice-chart-axis);stroke-width:1}
|
|
87
|
+
.${M}__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
|
+
.${M}__annotation-line{stroke:var(--lattice-chart-axis);stroke-width:1;stroke-dasharray:4 3;fill:none}
|
|
90
|
+
.${M}__annotation-target{stroke:var(--lattice-success,#107c41);stroke-width:1.5;stroke-dasharray:2 2;fill:none}
|
|
91
|
+
.${M}__annotation-band{stroke:none}
|
|
92
|
+
.${M}__annotation-point{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
93
|
+
.${M}__annotation-event{stroke:var(--lattice-chart-axis);stroke-width:1;fill:none}
|
|
94
|
+
.${M}__annotation-event-flag{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
95
|
+
.${M}__annotation-label{fill:var(--lattice-chart-axis);
|
|
96
96
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
97
|
-
.${
|
|
97
|
+
.${M}__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
|
+
.${M}__ribbon{stroke:none;fill-opacity:0.62}
|
|
100
|
+
.${M}__ribbon:hover{fill-opacity:0.85}
|
|
101
|
+
.${M}__node{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
102
|
+
.${M}__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
|
+
.${M}__node-icon{fill:var(--lattice-background,#fff);stroke:none;pointer-events:none}
|
|
108
|
+
.${M}__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
|
+
.${M}__node-icon[data-dim]{opacity:0.18}
|
|
111
|
+
.${M}__flow-label{fill:var(--lattice-chart-axis);pointer-events:none}
|
|
112
|
+
.${M}__stream{stroke:none}
|
|
113
|
+
.${M}__violin{stroke:none;fill-opacity:0.55}
|
|
114
|
+
.${M}__task{stroke:var(--lattice-background,#fff);stroke-width:1;rx:2}
|
|
115
|
+
.${M}__web{stroke:var(--lattice-chart-grid);fill:none}
|
|
116
|
+
.${M}__radar-fill{opacity:0.18;stroke:none}
|
|
117
|
+
.${M}__radar-line{stroke-width:2;fill:none}
|
|
118
|
+
.${M}__gauge-track{fill:var(--lattice-chart-grid)}
|
|
119
|
+
.${M}__gauge-target{stroke:var(--lattice-foreground,#1c2126);stroke-width:2}
|
|
120
|
+
.${M}__gauge-reading{fill:var(--lattice-foreground,#1c2126);
|
|
121
121
|
font-size:calc(var(--lattice-font-size,13px) * 1.8);font-weight:600}
|
|
122
|
-
.${
|
|
122
|
+
.${M}__gauge-caption{fill:var(--lattice-chart-axis);
|
|
123
123
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
124
|
-
.${
|
|
125
|
-
.${
|
|
126
|
-
.${
|
|
124
|
+
.${M}__cell{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
125
|
+
.${M}__funnel{stroke:var(--lattice-background,#fff);stroke-width:1}
|
|
126
|
+
.${M}__funnel-label,.${M}__funnel-value{fill:var(--lattice-foreground,#1c2126);
|
|
127
127
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
128
|
-
.${
|
|
129
|
-
.${
|
|
130
|
-
.${
|
|
131
|
-
.${
|
|
128
|
+
.${M}__wick{stroke-width:1}
|
|
129
|
+
.${M}__candle{stroke-width:1}
|
|
130
|
+
.${M}__axis-right{stroke-width:1}
|
|
131
|
+
.${M}__panel-title{fill:var(--lattice-chart-axis);
|
|
132
132
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
133
|
-
.${
|
|
133
|
+
.${M}__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
|
+
.${M}__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
|
+
.${M}__geo-note{fill:var(--lattice-chart-axis);
|
|
138
138
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
139
|
-
.${
|
|
139
|
+
.${M}__attribution{color:var(--lattice-foreground-muted,#5b6670);
|
|
140
140
|
font-size:var(--lattice-font-size-sm,11px);padding:0 4px 4px}
|
|
141
|
-
.${
|
|
142
|
-
.${
|
|
141
|
+
.${M}__attribution[hidden]{display:none}
|
|
142
|
+
.${M}__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
|
+
.${M}__donut-centre-value{fill:var(--lattice-foreground,#1c2126);font-weight:600;
|
|
145
|
+
pointer-events:none;text-anchor:middle}
|
|
146
|
+
.${M}__donut-centre-label{fill:var(--lattice-chart-axis);
|
|
147
|
+
pointer-events:none;text-anchor:middle}
|
|
148
|
+
.${M}__legend{display:flex;flex-wrap:wrap;gap:2px 12px;padding:6px 4px 2px;
|
|
145
149
|
font-size:var(--lattice-font-size-sm,11px)}
|
|
146
|
-
.${
|
|
150
|
+
.${M}__legend-item{display:inline-flex;align-items:center;gap:5px;border:0;padding:1px 3px;
|
|
147
151
|
background:none;color:inherit;font:inherit;cursor:pointer;border-radius:3px}
|
|
148
|
-
.${
|
|
152
|
+
.${M}__legend-item:focus-visible{outline:var(--lattice-focus-width,2px) solid var(--lattice-focus-color,#1a6bc7);
|
|
149
153
|
outline-offset:1px}
|
|
150
|
-
.${
|
|
151
|
-
.${
|
|
152
|
-
.${
|
|
154
|
+
.${M}__legend-item[aria-pressed="false"]{opacity:0.45}
|
|
155
|
+
.${M}__swatch{width:10px;height:10px;border-radius:2px;flex:0 0 auto}
|
|
156
|
+
.${M}__swatch--circle{border-radius:50%}
|
|
153
157
|
/* A line swatch for a series drawn as a line: the symbol should say which mark
|
|
154
158
|
the reader is looking for, not merely which colour. */
|
|
155
|
-
.${
|
|
156
|
-
.${
|
|
157
|
-
.${
|
|
159
|
+
.${M}__swatch--line{height:3px;border-radius:2px}
|
|
160
|
+
.${M}__legend[data-align="centre"],.${M}__legend[data-align="center"]{justify-content:center}
|
|
161
|
+
.${M}__legend[data-align="end"]{justify-content:flex-end}
|
|
158
162
|
/* Top and bottom are the default row; the sides become a column beside the
|
|
159
163
|
plot, which is why the figure itself changes direction rather than the
|
|
160
164
|
legend floating over the marks. */
|
|
161
|
-
.${
|
|
162
|
-
.${
|
|
163
|
-
.${
|
|
164
|
-
.${
|
|
165
|
-
.${
|
|
165
|
+
.${M}__figure:has(> .${M}__legend[data-position="top"]){flex-direction:column}
|
|
166
|
+
.${M}__legend[data-position="top"]{order:-1}
|
|
167
|
+
.${M}__figure:has(> .${M}__legend[data-position="left"]),
|
|
168
|
+
.${M}__figure:has(> .${M}__legend[data-position="right"]){flex-direction:row;align-items:stretch}
|
|
169
|
+
.${M}__legend[data-position="left"],.${M}__legend[data-position="right"]{
|
|
166
170
|
flex-direction:column;flex:0 0 auto;align-content:flex-start;
|
|
167
171
|
max-width:40%;overflow:auto;padding:4px 8px}
|
|
168
|
-
.${
|
|
169
|
-
.${
|
|
170
|
-
.${
|
|
172
|
+
.${M}__legend[data-position="left"]{order:-1}
|
|
173
|
+
.${M}__legend-more{align-self:center;color:var(--lattice-foreground-muted,#5b6670)}
|
|
174
|
+
.${M}__tooltip{position:fixed;z-index:5;pointer-events:none;max-width:260px;
|
|
171
175
|
padding:5px 8px;border-radius:4px;font-size:var(--lattice-font-size-sm,11px);
|
|
172
176
|
background:var(--lattice-surface,#f7f8f9);color:var(--lattice-foreground,#1c2126);
|
|
173
177
|
border:1px solid var(--lattice-border-color,#dfe3e6);
|
|
174
178
|
box-shadow:var(--lattice-popup-shadow,0 6px 16px -4px rgb(16 20 24/24%))}
|
|
175
|
-
.${
|
|
176
|
-
.${
|
|
177
|
-
.${
|
|
178
|
-
.${
|
|
179
|
+
.${M}__tooltip[hidden]{display:none}
|
|
180
|
+
.${M}__tooltip-row{display:flex;align-items:center;gap:5px;white-space:nowrap}
|
|
181
|
+
.${M}__tooltip-value{font-weight:600;margin-inline-start:auto;padding-inline-start:10px}
|
|
182
|
+
.${M}__empty{display:flex;align-items:center;justify-content:center;flex:1 1 auto;
|
|
179
183
|
color:var(--lattice-foreground-muted,#5b6670)}
|
|
180
184
|
/* The author display:flex above outranks the browser's own [hidden] rule, so
|
|
181
185
|
without this the placeholder stays painted under a drawn chart whenever the
|
|
182
186
|
pane has a fixed height (BACKLOG-0001023). Same guard as the tooltip. */
|
|
183
|
-
.${
|
|
184
|
-
.${
|
|
187
|
+
.${M}__empty[hidden]{display:none}
|
|
188
|
+
.${M}__watermark{position:absolute;right:4px;bottom:4px;z-index:6;
|
|
185
189
|
font-size:var(--lattice-font-size-sm,11px);pointer-events:auto;
|
|
186
190
|
background:var(--lattice-overlay-background,rgb(255 255 255/72%));
|
|
187
191
|
padding:1px 6px;border-radius:3px}
|
|
188
|
-
.${
|
|
189
|
-
.${
|
|
190
|
-
.${
|
|
192
|
+
.${M}__watermark-link{color:var(--lattice-foreground-muted,#5b6670);text-decoration:none}
|
|
193
|
+
.${M}__watermark-link:hover{text-decoration:underline}
|
|
194
|
+
.${M}__table{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;
|
|
191
195
|
clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}
|
|
192
196
|
|
|
193
|
-
.${
|
|
194
|
-
.lattice[data-theme="dark"] .${
|
|
197
|
+
.${M}[data-theme="dark"],
|
|
198
|
+
.lattice[data-theme="dark"] .${M}{
|
|
195
199
|
--lattice-chart-1:#4ea6dd;--lattice-chart-2:#f0b429;--lattice-chart-3:#34c79a;
|
|
196
200
|
--lattice-chart-4:#e39ec4;--lattice-chart-5:#7cc7f0;--lattice-chart-6:#f07c3f;
|
|
197
201
|
--lattice-chart-7:#a48ad4;--lattice-chart-8:#93a3b1}
|
|
@@ -199,15 +203,15 @@
|
|
|
199
203
|
@media (prefers-color-scheme: dark){
|
|
200
204
|
/* Guarded so an explicit light theme still wins on a dark desktop, which is
|
|
201
205
|
the same rule the grid's own tokens follow. */
|
|
202
|
-
.${
|
|
206
|
+
.${M}:not([data-theme="light"]){
|
|
203
207
|
--lattice-chart-1:#4ea6dd;--lattice-chart-2:#f0b429;--lattice-chart-3:#34c79a;
|
|
204
208
|
--lattice-chart-4:#e39ec4;--lattice-chart-5:#7cc7f0;--lattice-chart-6:#f07c3f;
|
|
205
209
|
--lattice-chart-7:#a48ad4;--lattice-chart-8:#93a3b1}
|
|
206
210
|
}
|
|
207
211
|
|
|
208
212
|
@media (prefers-reduced-motion: no-preference){
|
|
209
|
-
.${
|
|
210
|
-
.${
|
|
213
|
+
.${M}__line,.${M}__area{transition:d 160ms ease-out}
|
|
214
|
+
.${M}__bar{transition:x 160ms ease-out,y 160ms ease-out,width 160ms ease-out,height 160ms ease-out}
|
|
211
215
|
}
|
|
212
216
|
|
|
213
217
|
@media (forced-colors: active){
|
|
@@ -215,14 +219,14 @@
|
|
|
215
219
|
meaning entirely. What survives is position, the stroke that separates one
|
|
216
220
|
mark from the next, and the label, which is why the legend carries text
|
|
217
221
|
and the tooltip names its series rather than relying on a swatch. */
|
|
218
|
-
.${
|
|
219
|
-
.${
|
|
220
|
-
.${
|
|
221
|
-
.${
|
|
222
|
-
.${
|
|
222
|
+
.${M}__bar,.${M}__slice,.${M}__point{fill:CanvasText;stroke:Canvas;stroke-width:1}
|
|
223
|
+
.${M}__line{stroke:CanvasText}
|
|
224
|
+
.${M}__area{fill:CanvasText;opacity:0.12}
|
|
225
|
+
.${M}__swatch{border:1px solid CanvasText}
|
|
226
|
+
.${M}__mark[data-dim]{opacity:1;fill:GrayText}
|
|
223
227
|
}
|
|
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
|
|
226
|
-
`)}destroy(){if(!this.#A){this.#A=!0,this.#
|
|
228
|
+
`}function X(U){const ae=U.documentElement;if(!ae||ae.getAttribute(de))return;ae.setAttribute(de,"1");const N=U.createElement("style");N.textContent=Y(),(U.head||U.body||ae).appendChild(N)}}),Xe("packages/modules/charts/axis.js",function(a,V){"use strict";Object.defineProperty(a,"normaliseAxes",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(a,"tickValues",{enumerable:!0,get:function(){return F}}),Object.defineProperty(a,"tickLabeller",{enumerable:!0,get:function(){return I}}),Object.defineProperty(a,"drawAxisTitle",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(a,"labelEvery",{enumerable:!0,get:function(){return S}}),Object.defineProperty(a,"drawMeasureAxis",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(a,"drawCategoryAxis",{enumerable:!0,get:function(){return te}}),Object.defineProperty(a,"leftLabelRoom",{enumerable:!0,get:function(){return q}}),Object.defineProperty(a,"setLabelText",{enumerable:!0,get:function(){return E}}),Object.defineProperty(a,"drawBandLabels",{enumerable:!0,get:function(){return L}}),Object.defineProperty(a,"drawContinuousAxis",{enumerable:!0,get:function(){return se}}),Object.defineProperty(a,"drawAxisLines",{enumerable:!0,get:function(){return R}}),Object.defineProperty(a,"createGroups",{enumerable:!0,get:function(){return he}}),Object.defineProperty(a,"MARK_OVERHANG",{enumerable:!0,get:function(){return f}}),Object.defineProperty(a,"overhangFor",{enumerable:!0,get:function(){return J}}),Object.defineProperty(a,"setPlotClip",{enumerable:!0,get:function(){return H}});const ee=V("packages/modules/charts/frame.js").Pool,M=V("packages/modules/charts/svg.js"),de=M.attrs,ce=M.round,Y=M.setText,X=M.svg,U=V("packages/modules/charts/typography.js"),ae=U.applySize,N=U.CHAR_RATIO,d=U.truncateTo,z=V("packages/modules/charts/styles.js").NS,x=6,B=1.2;function Q(e){if(e===!1){const o={labels:!1,grid:!1};return{x:{...o},y:{...o},y2:{...o}}}const u=e&&typeof e=="object"?e:{},k=o=>typeof o=="string"?{title:o}:o&&typeof o=="object"?{...o}:{};return{x:k(u.x),y:k(u.y),y2:k(u.y2||u.right)}}function F(e,u){const k=u&&u.ticks;if(Array.isArray(k)){const w=e.domain;return!w||w.min===void 0?k:k.filter(p=>Number(p)>=w.min&&Number(p)<=w.max)}const o=Number.isFinite(k)&&k>0?Number(k):5;return e.ticks(o)}function I(e,u,k){const o=e&&e.format;return typeof o=="function"?w=>String(o(w)):typeof o=="string"&&k&&k.formatting&&k.formatting.format?w=>String(k.formatting.format(w,o)):u.tick}function ne(e){if(!e.text)return;const u=e.side==="left"||e.side==="right"?e.plot.height:e.plot.width,k=Number.isFinite(u)?d(String(e.text),Math.max(0,u),e.size):String(e.text);if(!k||k==="…")return;const o=X(e.group.ownerDocument,"text",{class:`${z}__axis-title`});if(ae(o,e.size),e.side==="left"){const w=Math.max(e.size,e.plot.left-e.plot.gutter.left+e.size),p=e.plot.top+e.plot.height/2;de(o,{transform:`translate(${ce(w)} ${ce(p)}) rotate(-90)`,"text-anchor":"middle"})}else if(e.side==="right"){const w=e.plot.right+e.plot.gutter.right-e.size,p=e.plot.top+e.plot.height/2;de(o,{transform:`translate(${ce(w)} ${ce(p)}) rotate(90)`,"text-anchor":"middle"})}else de(o,{x:ce(e.plot.left+e.plot.width/2),y:ce(e.plot.bottom+e.plot.gutter.bottom-2),"text-anchor":"middle"});Y(o,k),k!==String(e.text)&&o.setAttribute("aria-label",String(e.text)),e.group.appendChild(o)}function S(e){const{values:u,scale:k,size:o,horizontal:w,label:p}=e;if(u.length<2)return 1;let l=1/0;for(let r=1;r<u.length;r++){const s=Math.abs(k.of(u[r])-k.of(u[r-1]));Number.isFinite(s)&&s<l&&(l=s)}if(!Number.isFinite(l))return 1;if(l<=0)return u.length;let v=o*B+2;if(w){let r=0;for(const s of u){const b=String(p(s)||"").length*o*N;b>r&&(r=b)}v=r+x}return Math.max(1,Math.ceil(v/l))}function Z(e){const{gridGroup:u,axisGroup:k,plot:o,scale:w,format:p}=e,l=e.config||{},v=F(w,l),r=I(l,p,e.grid),s=e.size||11,b=S({values:v,scale:w,size:s,horizontal:!!e.horizontal,label:r}),t=l.grid===!1?null:u,c=t?new ee(t):null,P=new ee(k);for(let g=0;g<v.length;g++){const y=v[g],j=ce(w.of(y)),h=y===0,i=g%b!==0;if(e.horizontal){if(c&&de(c.next("line",`${z}__gridline`),{x1:j,x2:j,y1:ce(o.top),y2:ce(o.bottom),"stroke-opacity":h?1:.6,"stroke-width":h?1.5:1}),l.labels===!1||i)continue;const n=P.next("text",`${z}__tick`);ae(n,s),de(n,{x:j,y:ce(o.bottom+x),"text-anchor":"middle","dominant-baseline":"hanging"}),Y(n,r(y))}else{if(c&&de(c.next("line",`${z}__gridline`),{x1:ce(o.left),x2:ce(o.right),y1:j,y2:j,"stroke-opacity":h?1:.6,"stroke-width":h?1.5:1}),l.labels===!1||i)continue;const n=P.next("text",`${z}__tick`);ae(n,s),de(n,{x:ce(o.left-x),y:j,"text-anchor":"end","dominant-baseline":"middle"}),Y(n,r(y))}}return c?c.finish():new ee(u).finish(),P.finish(),v}function te(e){const{group:u,plot:k,scale:o,labels:w,fontSize:p}=e,l=e.config||{};if(l.labels===!1){new ee(u).finish();return}const v=new ee(u),r=o.domain,s=o.step,b=l.rotate===void 0||l.rotate==="auto"?e.rotated:!!l.rotate,t=b&&s>0?Math.max(1,Math.ceil(p*Math.SQRT2/s)):1,c=Number.isFinite(l.every)&&l.every>0?Number(l.every):t,P=s*c;for(let g=0;g<r.length;g++){const y=ce(o.centre(r[g]));if(Number.isNaN(y)||g%c!==0)continue;const j=v.next("text",`${z}__tick`);ae(j,p);const h=w[g]===void 0?"":w[g];b?(de(j,{x:0,y:0,"text-anchor":"end","dominant-baseline":"middle",transform:`translate(${y} ${ce(k.bottom+x)}) rotate(-45)`}),E(j,h,Math.max(0,k.gutter.bottom-x)*Math.SQRT2,p)):(de(j,{x:y,y:ce(k.bottom+x),"text-anchor":"middle","dominant-baseline":"hanging",transform:null}),E(j,h,P,p))}v.finish()}function q(e){return Math.max(0,(e.gutter?e.gutter.left:e.left)-x)}function E(e,u,k,o){const w=String(u??""),p=d(w,k,o);return Y(e,p),p!==w?e.setAttribute("aria-label",w):e.removeAttribute("aria-label"),p}function L(e){const{group:u,plot:k,scale:o,labels:w}=e,p=e.config||{},l=new ee(u),v=o.domain,r=e.fontSize,s=q(k),b=o.step>0?Math.max(1,Math.ceil(r*B/o.step)):1,t=Number.isFinite(p.every)&&p.every>0?Number(p.every):b;for(let c=0;c<v.length;c++){if(c%t!==0)continue;const P=ce(o.centre(v[c]));if(Number.isNaN(P))continue;const g=l.next("text",`${z}__tick`);de(g,{x:ce(k.left-x),y:P,"text-anchor":"end","dominant-baseline":"middle"}),ae(g,r),E(g,w[c],s,r)}l.finish()}function se(e){const{group:u,plot:k,scale:o,format:w}=e,p=e.config||{};if(p.labels===!1){new ee(u).finish();return}const l=I(p,w,e.grid),v=new ee(u);for(const r of F(o,p)){const s=ce(o.of(r));if(s<k.left-1||s>k.right+1)continue;const b=v.next("text",`${z}__tick`);ae(b,e.size||11),de(b,{x:s,y:ce(k.bottom+x),"text-anchor":"middle","dominant-baseline":"hanging"}),Y(b,l(r))}v.finish()}function R(e){const{group:u,plot:k}=e,o=new ee(u);de(o.next("line"),{x1:ce(k.left),x2:ce(k.left),y1:ce(k.top),y2:ce(k.bottom)}),de(o.next("line"),{x1:ce(k.left),x2:ce(k.right),y1:ce(k.bottom),y2:ce(k.bottom)}),o.finish()}let $=0;function he(e,u){const k=`${z}-plot-clip-${++$}`,o=X(e,"rect"),w=X(e,"clipPath",{id:k});w.appendChild(o);const p=`${z}-box-clip-${$}`,l=X(e,"clipPath",{id:p});l.appendChild(X(e,"rect",{x:0,y:0,width:"100%",height:"100%"}));const v=X(e,"defs");v.appendChild(w),v.appendChild(l);const r={grid:X(e,"g",{class:`${z}__grid`}),marks:X(e,"g",{class:`${z}__marks`}),rules:X(e,"g",{class:`${z}__axis`}),axis:X(e,"g",{class:`${z}__axis`}),labels:X(e,"g",{class:`${z}__labels`}),overlay:X(e,"g",{class:`${z}__overlay`}),clip:o,clipId:k,boxClipId:p};u.appendChild(v);for(const s of["grid","marks","rules","axis","labels","overlay"])u.appendChild(r[s]);return r}const f=30;function J(e){return e==="bubble"?f:e==="scatter"?6:3}function H(e,u,k){if(!e||!e.marks||!e.clip)return;if(!u||!Number.isFinite(u.width)||!Number.isFinite(u.height)){e.marks.removeAttribute("clip-path");return}const o=Number.isFinite(k)&&k>=0?Number(k):f;de(e.clip,{x:ce(u.left-o),y:ce(u.top-o),width:ce(Math.max(0,u.width)+o*2),height:ce(Math.max(0,u.height)+o*2)}),e.marks.setAttribute("clip-path",`url(#${e.clipId})`)}}),Xe("packages/modules/charts/scale.js",function(a,V){"use strict";Object.defineProperty(a,"isNumber",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"toNumber",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(a,"toTime",{enumerable:!0,get:function(){return N}}),Object.defineProperty(a,"extent",{enumerable:!0,get:function(){return d}}),Object.defineProperty(a,"niceStep",{enumerable:!0,get:function(){return D}}),Object.defineProperty(a,"niceDomain",{enumerable:!0,get:function(){return z}}),Object.defineProperty(a,"measureDomain",{enumerable:!0,get:function(){return x}}),Object.defineProperty(a,"linearTicks",{enumerable:!0,get:function(){return B}}),Object.defineProperty(a,"timeStepFor",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(a,"timeTicks",{enumerable:!0,get:function(){return I}}),Object.defineProperty(a,"linearScale",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(a,"timeScale",{enumerable:!0,get:function(){return S}}),Object.defineProperty(a,"key",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(a,"bandScale",{enumerable:!0,get:function(){return te}}),Object.defineProperty(a,"sqrtScale",{enumerable:!0,get:function(){return q}});const ve=[1,2,2.5,5,10],ee=6e4,M=36e5,de=864e5,ce=365.25*de,Y=[1,2,5,10,20,25,50,100],X=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,ee,5*ee,15*ee,30*ee,M,3*M,6*M,12*M,de,2*de,7*de,14*de,30*de,90*de,180*de,...Y.map(E=>E*ce)];function U(E){return typeof E=="number"&&Number.isFinite(E)}function ae(E){if(E==null||E==="")return null;if(E instanceof Date){const se=E.getTime();return Number.isFinite(se)?se:null}if(typeof E=="boolean")return E?1:0;const L=Number(E);return Number.isFinite(L)?L:null}function N(E){if(E==null||E==="")return null;if(E instanceof Date){const se=E.getTime();return Number.isFinite(se)?se:null}if(typeof E=="number")return Number.isFinite(E)?E:null;const L=Date.parse(String(E));return Number.isFinite(L)?L:null}function d(E){let L=1/0,se=-1/0;for(let R=0;R<E.length;R++){const $=E[R];U($)&&($<L&&(L=$),$>se&&(se=$))}return L===1/0?null:{min:L,max:se}}function D(E){if(!(E>0))return 1;const L=10**Math.floor(Math.log10(E));for(const se of ve)if(E<=se*L)return se*L;return 10*L}function z(E,L=5){const se=D((E.max-E.min)/Math.max(1,L));return{min:Math.floor(E.min/se)*se,max:Math.ceil(E.max/se)*se,step:se}}function x(E,L={}){const se=d(E)||{min:0,max:1};let{min:R,max:$}=se;if(L.zero&&(R>0&&(R=0),$<0&&($=0)),R===$){const he=Math.abs(R)>0?Math.abs(R)/10:1;R-=he,$+=he}if(L.nice!==!1){const he=z({min:R,max:$},L.ticks||5);R=he.min,$=he.max}return U(L.min)&&(R=L.min),U(L.max)&&($=L.max),R===$&&($=R+1),{min:R,max:$}}function B(E,L=5){const se=D((E.max-E.min)/Math.max(1,L)),R=Math.ceil(E.min/se),$=Math.floor(E.max/se),he=[];for(let f=R;f<=$;f++){const J=f*se;he.push(Math.abs(J)<se/1e6?0:Number(J.toPrecision(12)))}return he}function Q(E,L=5){const se=Math.max(1,L),R=E/se;let $=X[X.length-1];for(const J of X)if(J>=R){$=J;break}if($<ce)return $;let he=$,f=Math.abs(E/$-se);for(const J of X){if(J<ce)continue;const H=Math.abs(E/J-se);H<f&&(f=H,he=J)}return he}function F(E,L){const se=new Date(E.min).getUTCFullYear();let R=Math.ceil(se/L)*L;Date.UTC(R,0,1)<E.min&&(R+=L);const $=[];for(;Date.UTC(R,0,1)<=E.max;R+=L)$.push(Date.UTC(R,0,1));return $}function I(E,L=5){const se=Q(E.max-E.min,L);if(se>=ce)return F(E,Math.round(se/ce));const R=[],$=Math.ceil(E.min/se)*se;for(let he=$;he<=E.max;he+=se)R.push(he);return R}function ne(E,L){const se=E.max-E.min||1,[R,$]=L;return{kind:"linear",domain:E,range:L,of(he){return R+(he-E.min)/se*($-R)},invert(he){return E.min+(he-R)/($-R||1)*se},ticks(he=5){return B(E,he)}}}function S(E,L){return{...ne(E,L),kind:"time",ticks(R=5){return I(E,R)}}}function Z(E){if(E==null)return" null";if(E instanceof Date)return` date:${E.getTime()}`;if(typeof E=="object"){const L=E,se=L.id??L.key??L.value;return se!==void 0&&typeof se!="object"?` obj:${String(se)}`:` obj:${String(E)}`}return String(E)}function te(E,L,se=.2){const R=Math.min(.9,Math.max(0,se)),[$,he]=L,f=new Map;for(let e=0;e<E.length;e++){const u=Z(E[e]);f.has(u)||f.set(u,e)}const J=E.length?(he-$)/E.length:he-$,H=Math.max(0,J*(1-R));return{kind:"band",domain:E,range:L,bandwidth:H,step:J,of(e){const u=f.get(Z(e));return u===void 0?NaN:$+u*J+(J-H)/2},centre(e){const u=this.of(e);return Number.isNaN(u)?NaN:u+H/2},ticks(){return E}}}function q(E,L){const[se,R]=L,$=Math.max(Math.abs(E.max),Math.abs(E.min),0)||1;return{kind:"sqrt",domain:E,range:L,of(he){const f=Math.sqrt(Math.abs(he)/$);return se+f*(R-se)}}}}),Xe("packages/modules/charts/format.js",function(a,V){"use strict";Object.defineProperty(a,"precisionFor",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"axisNumber",{enumerable:!0,get:function(){return de}}),Object.defineProperty(a,"r2Digits",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(a,"dateFormatFor",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(a,"formatters",{enumerable:!0,get:function(){return X}}),Object.defineProperty(a,"measureText",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"measureFormat",{enumerable:!0,get:function(){return ae}});const ee=V("packages/modules/charts/scale.js").timeStepFor;function M(N){if(!Number.isFinite(N)||N<=0)return 0;const d=Math.ceil(-Math.log10(N));return Math.min(6,Math.max(0,d))}function de(N,d,D=0){return Number.isFinite(N)?Math.abs(N)>=1e4?d.number(N,{notation:"compact",maximumFractionDigits:1}):d.number(N,{minimumFractionDigits:D,maximumFractionDigits:D}):""}function ce(N,d){const D=N&&N.messages;return!D||typeof D.number!="function"?Number(d).toFixed(2):D.number(d,{minimumFractionDigits:2,maximumFractionDigits:2})}function Y(N){if(N>0){const D=ee(N);if(D<1e3)return{minute:"2-digit",second:"2-digit",fractionalSecondDigits:3};if(D<6e4)return{hour:"2-digit",minute:"2-digit",second:"2-digit"}}return N<=2*36e5?{hour:"2-digit",minute:"2-digit"}:N<=3*864e5?{weekday:"short",hour:"2-digit"}:N<=180*864e5?{day:"numeric",month:"short"}:N<=3*365*864e5?{month:"short",year:"numeric"}:{year:"numeric"}}function X(N,d){const D=N.messages,z=D.locale,x=N.get("timeZone")||void 0;if(d.kind==="time"){const Q=Y(d.span||0),F=new Intl.DateTimeFormat(z,x?{...Q,timeZone:x}:Q),I=new Intl.DateTimeFormat(z,x?{dateStyle:"medium",timeStyle:"short",timeZone:x}:{dateStyle:"medium",timeStyle:"short"});return{tick:ne=>Number.isFinite(Number(ne))?F.format(new Date(Number(ne))):"",value:ne=>Number.isFinite(Number(ne))?I.format(new Date(Number(ne))):""}}const B=M(d.step||0);return{tick:Q=>typeof Q=="number"?de(Q,D,B):String(Q??""),value:Q=>typeof Q=="number"?D.number(Q):String(Q??"")}}function U(N,d){if(N==null||!Number.isFinite(N))return"";const D=Math.abs(N)>=1e-6?Number(N.toPrecision(6)):N;return d.number(D)}function ae(N,d,D){return N==null||!Number.isFinite(Number(N))?"":d&&d.format&&typeof d.formatValue=="function"?String(d.formatValue(N,null)):U(Number(N),D&&D.messages)}}),Xe("packages/modules/charts/labels.js",function(a,V){"use strict";Object.defineProperty(a,"resolveLabels",{enumerable:!0,get:function(){return B}}),Object.defineProperty(a,"collides",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(a,"placeLabels",{enumerable:!0,get:function(){return F}}),Object.defineProperty(a,"labelText",{enumerable:!0,get:function(){return I}}),Object.defineProperty(a,"drawAnchoredLabels",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(a,"drawDataLabels",{enumerable:!0,get:function(){return S}});const ee=V("packages/modules/charts/frame.js").Pool,de=V("packages/modules/charts/format.js").measureText,ce=V("packages/modules/charts/svg.js"),Y=ce.attrs,X=ce.round,U=ce.setText,N=V("packages/modules/charts/styles.js").NS,d=V("packages/modules/charts/typography.js"),D=d.applySize,z=d.textWidth,x=4;function B(Z){const te=Z&&Z.labels;if(!te)return{show:!1,names:te!==!1,position:"outside",format:null,minGap:2,total:!1};const q=typeof te=="object"?te:{};return{show:!0,names:!0,position:["outside","inside","auto"].includes(q.position)?q.position:"outside",format:q.format||null,minGap:Number.isFinite(q.minGap)?Number(q.minGap):2,total:!!q.total}}function Q(Z,te,q){for(const E of te)if(Z.x-q<E.x+E.width&&Z.x+Z.width+q>E.x&&Z.y-q<E.y+E.height&&Z.y+Z.height+q>E.y)return!0;return!1}function F(Z){const{points:te,plot:q,size:E}=Z,L=Z.minGap===void 0?2:Z.minGap,se=[],R=[];for(const $ of te){if($.px===void 0||$.py===void 0)continue;const he=Z.text($);if(!he)continue;const f=z(he,E),J=E;let H=$.px,e=$.py-x,u="middle",k=!1;Z.horizontal?(H=$.px+x,e=$.py,u="start",Z.position!=="outside"&&$.pbase!==void 0&&Math.abs($.px-$.pbase)>f+x*2&&(H=$.px-x,u="end",k=!0)):Z.position!=="outside"&&$.pbase!==void 0&&Math.abs($.pbase-$.py)>J+x*2&&(e=$.py+J+x,k=!0);const o=()=>({x:u==="middle"?H-f/2:u==="end"?H-f:H,y:e-J,width:f,height:J});let w=o();!(w.y>=q.top-1)&&!k&&!Z.horizontal&&$.pbase!==void 0&&Math.abs($.pbase-$.py)>J+x*2&&(e=$.py+J+x,k=!0,w=o()),!(w.x+w.width<=q.right+1)&&!k&&Z.horizontal&&$.pbase!==void 0&&Math.abs($.px-$.pbase)>f+x*2&&(H=$.px-x,u="end",k=!0,w=o()),!(w.x<q.left-1||w.x+w.width>q.right+1)&&(w.y<q.top-1||w.y+w.height>q.bottom+J||Q(w,se,L)||(se.push(w),R.push({x:X(H),y:X(e),text:he,anchor:u,inside:k})))}return R}function I(Z,te,q){return Z==null?"":typeof te.format=="function"?String(te.format(Z)):typeof te.format=="string"&&q&&q.formatting&&q.formatting.format?String(q.formatting.format(Z,te.format)):de(Z,q&&q.messages)}function ne(Z){const te=new ee(Z.group),q=Z.minGap===void 0?2:Z.minGap,E=Z.size,L=[];let se=0;for(const R of Z.anchors){if(!R||!R.text)continue;const $=R.width===void 0?z(R.text,Z.size):R.width,he=R.anchor||"middle",J={x:he==="end"?R.x-$:he==="start"?R.x:R.x-$/2,y:R.y-E/2,width:$,height:E};if(Z.plot&&(J.x<Z.plot.left-1||J.x+J.width>Z.plot.right+1||J.y<Z.plot.top-1||J.y+J.height>Z.plot.bottom+1)||R.width!==void 0&&$>R.width||R.height!==void 0&&E>R.height||Q(J,L,q))continue;L.push(J);const H=te.next("text",R.className||`${N}__data-label`);D(H,Z.size),Y(H,{x:X(R.x),y:X(R.y),"text-anchor":he,"dominant-baseline":R.baseline||"middle","data-inside":R.inside?"true":null}),U(H,R.text),se++}return te.finish(),se}function S(Z){const te=new ee(Z.group),{options:q}=Z;let E=0;const L=se=>typeof q.format=="function"&&se.y!==null&&se.y!==void 0?String(q.format(se.y,se)):I(se.y,q,Z.grid);for(const se of Z.series){const R=F({points:se.points,plot:Z.plot,size:Z.size,position:q.position,horizontal:Z.horizontal,minGap:q.minGap,text:L});for(const $ of R){const he=te.next("text",`${N}__data-label`);D(he,Z.size),Y(he,{x:$.x,y:$.y,"text-anchor":$.anchor,"data-inside":$.inside?"true":null}),U(he,$.text),E++}}return te.finish(),E}}),Xe("packages/modules/charts/dense.js",function(a,V){"use strict";Object.defineProperty(a,"CANVAS_THRESHOLD",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(a,"downsample",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(a,"markCount",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"wantsCanvas",{enumerable:!0,get:function(){return de}}),Object.defineProperty(a,"paintDense",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(a,"sizeCanvas",{enumerable:!0,get:function(){return Y}});const ve=3e3;function ee(X,U){const ae=X.length;if(!Number.isFinite(U)||U>=ae||U<3||ae<3)return X;const N=[X[0]],d=(ae-2)/(U-2);let D=0;for(let z=0;z<U-2;z++){const x=Math.floor(z*d)+1,B=Math.min(Math.floor((z+1)*d)+1,ae-1),Q=B,F=Math.min(Math.floor((z+2)*d)+1,ae);let I=0,ne=0,S=0;for(let E=Q;E<F;E++){const L=X[E];!L||!Number.isFinite(L.y)||(I+=L.x,ne+=L.y,S++)}S&&(I/=S,ne/=S);const Z=X[D];if(x>=B)continue;let te=x,q=-1;for(let E=x;E<B;E++){const L=X[E];if(!L||!Number.isFinite(L.y))continue;const se=Math.abs((Z.x-I)*(L.y-Z.y)-(Z.x-L.x)*(ne-Z.y));se>q&&(q=se,te=E)}te<=D||(N.push(X[te]),D=te)}return N.push(X[ae-1]),N}function M(X){let U=0;for(const ae of X)U+=ae.points.length;return U}function de(X){if(X.canvas===!0)return!0;if(X.canvas===!1)return!1;const U=Number.isFinite(X.canvas)?Number(X.canvas):ve;return M(X.series)>U}function ce(X){const{context:U,series:ae,ratio:N}=X;U.save(),U.scale(N,N);for(const d of ae){const D=X.colour(d.index);if(X.type==="scatter"||X.type==="bubble"){U.fillStyle=D;for(const x of d.points)x.px!==void 0&&(U.beginPath(),U.arc(x.px,x.py,x.pr||2,0,Math.PI*2),U.fill());continue}U.strokeStyle=D,U.lineWidth=2,U.lineJoin="round",U.beginPath();let z=!1;for(const x of d.points){if(x.px===void 0||x.py===void 0){z=!1;continue}z?U.lineTo(x.px,x.py):U.moveTo(x.px,x.py),z=!0}U.stroke()}U.restore()}function Y(X){const{canvas:U}=X;return U.width=Math.max(1,Math.round(X.width*X.ratio)),U.height=Math.max(1,Math.round(X.height*X.ratio)),U.style&&(U.style.width=`${X.width}px`,U.style.height=`${X.height}px`),typeof U.getContext=="function"?U.getContext("2d"):null}}),Xe("packages/modules/charts/annotations.js",function(a,V){"use strict";Object.defineProperty(a,"overlayLayer",{enumerable:!0,get:function(){return F}}),Object.defineProperty(a,"annotationValue",{enumerable:!0,get:function(){return L}}),Object.defineProperty(a,"annotationAxis",{enumerable:!0,get:function(){return se}}),Object.defineProperty(a,"annotationText",{enumerable:!0,get:function(){return R}}),Object.defineProperty(a,"drawAnnotations",{enumerable:!0,get:function(){return he}});const ee=V("packages/modules/charts/frame.js").Pool,M=V("packages/modules/charts/scale.js"),de=M.isNumber,ce=M.toNumber,Y=M.toTime,X=V("packages/modules/charts/svg.js"),U=X.attrs,ae=X.path,N=X.round,d=X.setText,D=X.SVG_NS,x=V("packages/modules/charts/styles.js").NS,Q=V("packages/core/src/internal/util.js").warnOnce;function F(f,J){for(const e of f.childNodes||[])if(e&&String(e.getAttribute&&e.getAttribute("class"))===J)return e;const H=f.ownerDocument.createElementNS(D,"g");return H.setAttribute("class",J),f.appendChild(H),H}const I=new Set(["line","target","band","callout","event"]);function ne(f,J){return f.kind==="time"?Y(J):ce(J)}function S(f,J,H){if(f.kind==="band"){const u=f.of(J);if(!Number.isFinite(u))return NaN;const k=Number(f.bandwidth)||0;return H==="right"?u+k:u}const e=ne(f,J);return e===null?NaN:f.of(e)}function Z(f,J,H){const e=f.kind||"line",u=f.label?` (${JSON.stringify(f.label)})`:"";Q(`chart:annotation:dropped:${e}:${J}:${H}`,`chart annotation${u} of kind ${JSON.stringify(e)}, reading the ${J} axis, was not drawn: ${H}.`)}function te(f,J){if(f instanceof Date){const e=f.getTime();return Number.isFinite(e)?f.toISOString().slice(0,10):String(f)}if(typeof f=="number")return Number.isFinite(f)?J(f):String(f);const H=ce(f);return H===null||typeof f=="string"?String(f):J(H)}function q(f,J,H){const e=[];for(const u of f)if((u.axis==="right"?"right":"left")===H&&!(J.series!==void 0&&u.key!==J.series))for(const o of u.points)de(o.y)&&e.push(Number(o.y));return e}function E(f,J){if(!f.length)return null;const H=[...f].sort((o,w)=>o-w);if(H.length===1)return H[0];const e=Math.min(100,Math.max(0,J))/100*(H.length-1),u=Math.floor(e),k=Math.ceil(e);return u===k?H[u]:H[u]+(H[k]-H[u])*(e-u)}function L(f,J,H){if(!f.compute)return ce(f.value);const e=q(J,f,H);if(!e.length)return null;const u=String(f.compute).toLowerCase();if(u==="mean"||u==="avg")return e.reduce((o,w)=>o+w,0)/e.length;if(u==="median"||u==="p50")return E(e,50);if(u==="min")return Math.min(...e);if(u==="max")return Math.max(...e);const k=/^p(\d+(?:\.\d+)?)$/.exec(u);return k?E(e,Number(k[1])):null}function se(f){return f.axis==="right"||f.axis==="y2"?"right":"left"}function R(f,J,H,e){const u=f.label?`${f.label}: `:"",k=e?` (${se(f)==="right"?"right axis":"left axis"})`:"",o=f.kind||"line";if(o==="band"){if(!Array.isArray(J)||J[0]===null||J[1]===null)return"";const[p,l]=J;return`${u||"Band: "}${H(Math.min(p,l))} to ${H(Math.max(p,l))}${k}`}return J==null?"":`${u||`${o==="target"?"Target":o==="callout"?"Callout":"Reference"}: `}${H(J)}${k}`}function $(f){return(f.kind||"line")==="band"?0:1}function he(f){const{group:J,plot:H,xScale:e,yScale:u,rightScale:k,series:o,format:w}=f,p=new ee(F(J,`${x}__annotations`)),l=[],r=[...Array.isArray(f.annotations)?f.annotations:[]].sort((s,b)=>$(s)-$(b));for(const s of r){const b=s.kind||"line";if(!I.has(b))continue;const t=se(s),c=t==="right"&&k?k:u;if(b==="band"){if(s.orient==="vertical"){const m=S(e,s.from,"left"),G=S(e,s.to,"right");if(Number.isNaN(m)||Number.isNaN(G)){const re=Number.isNaN(m)&&Number.isNaN(G)?"from and to":Number.isNaN(m)?"from":"to";Z(s,t,`its ${re} value could not be placed on the x scale`);continue}const C=N(Math.min(m,G)),O=N(Math.max(m,G));if(U(p.next("rect",`${x}__annotation-band ${s.className||""}`.trim()),{x:C,y:N(H.top),width:Math.max(0,O-C),height:N(Math.max(0,H.bottom-H.top)),fill:s.colour||"currentColor","fill-opacity":s.opacity===void 0?.12:s.opacity}),s.label){const re=p.next("text",`${x}__annotation-label`);U(re,{x:C+4,y:N(H.top+12),"text-anchor":"start"}),d(re,s.label)}const W=s.label?`${s.label}: `:"Event window: ";l.push({text:`${W}${te(s.from,w)} to ${te(s.to,w)}`});continue}const j=L({...s,value:s.from,compute:s.fromCompute},o,t),h=L({...s,value:s.to,compute:s.toCompute},o,t);if(j===null||h===null)continue;const i=N(c.of(j)),n=N(c.of(h));if(U(p.next("rect",`${x}__annotation-band ${s.className||""}`.trim()),{x:N(H.left),y:Math.min(i,n),width:N(Math.max(0,H.right-H.left)),height:Math.max(0,Math.abs(n-i)),fill:s.colour||"currentColor","fill-opacity":s.opacity===void 0?.12:s.opacity}),s.label){const m=p.next("text",`${x}__annotation-label`);U(m,{x:N(H.left+4),y:Math.min(i,n)+12,"text-anchor":"start"}),d(m,s.label)}l.push({text:R(s,[j,h],w,f.dual)});continue}if(b==="event"){const j=s.x!==void 0?s.x:s.at,h=N(S(e,j,"left")+(e.kind==="band"?(Number(e.bandwidth)||0)/2:0));if(Number.isNaN(h)){Z(s,t,"its x value could not be placed on the x scale");continue}if(U(p.next("path",`${x}__annotation-event`),{d:ae(["M",h,N(H.top),"L",h,N(H.bottom)]),stroke:s.colour||"currentColor",fill:"none"}),U(p.next("circle",`${x}__annotation-event-flag`),{cx:h,cy:N(H.top),r:3,fill:s.colour||"currentColor"}),s.label){const n=p.next("text",`${x}__annotation-label`);U(n,{x:h+5,y:N(H.top+10),"text-anchor":"start"}),d(n,s.label)}const i=s.label?`${s.label} — `:"Event — ";l.push({text:`${i}at ${te(j,w)}`});continue}if(b==="callout"){const j=L(s,o,t);if(j===null)continue;const h=s.at!==void 0?N(e.kind==="band"?e.centre(s.at):e.of(ne(e,s.at)??NaN)):N(H.right-4),i=N(c.of(j));if(Number.isNaN(h)){Z(s,t,"its x value could not be placed on the x scale");continue}if(U(p.next("circle",`${x}__annotation-point`),{cx:h,cy:i,r:3.5,fill:s.colour||"currentColor"}),s.label){const n=p.next("text",`${x}__annotation-label`);U(n,{x:h+6,y:i-6,"text-anchor":"start"}),d(n,s.label)}l.push({text:R(s,j,w,f.dual)});continue}if(s.orient==="vertical"||s.x!==void 0){const j=s.x!==void 0?s.x:s.value,h=e.kind==="band"?N(e.centre(j)):N(e.of(ne(e,j)??NaN));if(Number.isNaN(h)){Z(s,t,"its x value could not be placed on the x scale");continue}const i=b==="target"?`${x}__annotation-target`:`${x}__annotation-line`;if(U(p.next("path",i),{d:ae(["M",h,N(H.top),"L",h,N(H.bottom)]),stroke:s.colour||"currentColor",fill:"none"}),s.label){const n=p.next("text",`${x}__annotation-label`);U(n,{x:h+4,y:N(H.top+10),"text-anchor":"start"}),d(n,s.label)}l.push({text:s.label?`${s.label} — at ${te(j,w)}`:""});continue}const P=L(s,o,t);if(P===null)continue;const g=N(c.of(P)),y=b==="target"?`${x}__annotation-target`:`${x}__annotation-line`;if(U(p.next("path",y),{d:ae(["M",N(H.left),g,"L",N(H.right),g]),stroke:s.colour||"currentColor",fill:"none"}),s.label){const j=p.next("text",`${x}__annotation-label`);U(j,{x:N(H.right-4),y:g-4,"text-anchor":"end"}),d(j,s.label)}l.push({text:R(s,P,w,f.dual)})}return p.finish(),l.filter(s=>s.text)}}),Xe("packages/modules/charts/combo.js",function(a,V){"use strict";Object.defineProperty(a,"toPareto",{enumerable:!0,get:function(){return o}}),Object.defineProperty(a,"drawCombo",{enumerable:!0,get:function(){return l}}),Object.defineProperty(a,"drawRightAxis",{enumerable:!0,get:function(){return v}});const ve=V("packages/modules/charts/axis.js"),ee=ve.drawAxisLines,M=ve.drawCategoryAxis,de=ve.drawContinuousAxis,ce=ve.drawMeasureAxis,Y=ve.overhangFor,X=ve.setPlotClip,U=V("packages/modules/charts/frame.js"),ae=U.Pool,N=U.shouldRotate,D=V("packages/modules/charts/format.js").formatters,z=V("packages/modules/charts/scale.js"),x=z.bandScale,B=z.extent,Q=z.isNumber,F=z.linearScale,I=z.measureDomain,ne=z.timeScale,S=z.toNumber,Z=z.toTime,te=V("packages/modules/charts/svg.js"),q=te.attrs,E=te.path,L=te.round,R=V("packages/modules/charts/styles.js").NS,he=V("packages/modules/charts/scheme.js").resolveScheme,J=V("packages/modules/charts/labels.js").drawDataLabels,e=V("packages/modules/charts/annotations.js").drawAnnotations;function u(r){return{left:r.filter(s=>s.axis!=="right"),right:r.filter(s=>s.axis==="right")}}function k(r,s){const b=[];for(const t of r)for(const c of t.points)b.push(c.y);return I(b,{zero:s})}function o(r){const s=r.series[0];if(!s)return r;const b=s.points.map((g,y)=>({point:g,label:r.labels[y],category:r.categories[y]})).filter(g=>Q(g.point.y)).sort((g,y)=>y.point.y-g.point.y),t=b.reduce((g,y)=>g+y.point.y,0);let c=0;const P=b.map(g=>(c+=g.point.y,t>0?c/t*100:0));return{...r,categories:b.map(g=>g.category),labels:b.map(g=>g.label),series:[{...s,index:0,mark:"bar",axis:"left",points:b.map(g=>g.point)},{key:"cumulative",label:r.cumulativeLabel||"%",index:1,mark:"line",axis:"right",points:b.map((g,y)=>({x:g.category,xKey:g.point.xKey,label:g.label,y:P[y],rows:g.point.rows,rowKey:g.point.rowKey}))}]}}function w(r,s){const b=[s.left,s.right];if(r.kind!=="time"&&r.kind!=="linear")return x(r.categories,b,.2);const t=r.kind==="time"?r.categories.map(Z):r.categories.map(S);if(r.kind==="time"){const P=B(t);if(P&&P.min===P.max)return ne({min:P.min-3e4,max:P.max+3e4},b)}const c=I(t,{zero:!1,nice:r.kind!=="time"});return r.kind==="time"?ne(c,b):F(c,b)}function p(r,s){const b=[...new Set(r.filter(y=>Number.isFinite(y)))].sort((y,j)=>y-j);if(b.length<2){const[y,j]=s.range;return Math.max(4,(j-y)/10)}const t=[];for(let y=1;y<b.length;y++)t.push(b[y]-b[y-1]);t.sort((y,j)=>y-j);const c=Math.floor(t.length/2),P=t.length%2?t[c]:(t[c-1]+t[c])/2,g=Math.abs(s.of(b[0]+P)-s.of(b[0]));return Math.max(1,g*.8)}function l(r){const s=r.scheme||he(),{plot:b}=r,t=r.pareto?o(r.bound):r.bound,c=t.series.filter(ue=>!r.hidden.has(ue.key)),P=u(c),g=P.left.some(ue=>(ue.mark||"bar")==="bar"),y=k(P.left,g),j=F(y,[b.bottom,b.top]),h=P.right.length?r.pareto?{min:0,max:100}:k(P.right,!1):null,i=h?F(h,[b.bottom,b.top]):null,n=w(t,b),m=n.kind!=="band",G=m?t.categories.map(ue=>t.kind==="time"?Z(ue):S(ue)):null;ce({gridGroup:r.groups.grid,axisGroup:r.groups.axis,plot:b,scale:j,format:D(r.grid,{kind:"linear",step:(y.max-y.min)/5})}),m?de({group:r.groups.overlay,plot:b,scale:n,format:D(r.grid,{kind:t.kind,span:n.domain.max-n.domain.min,step:(n.domain.max-n.domain.min)/5}),grid:r.grid,size:r.fontSize}):M({group:r.groups.overlay,plot:b,scale:n,labels:t.labels,fontSize:r.fontSize,rotated:N(t.labels,n.step,r.fontSize)}),ee({group:r.groups.rules,plot:b}),i&&v({group:r.groups.axis,plot:b,scale:i,colour:s.series(P.right[0].index),format:D(r.grid,{kind:"linear",step:(h.max-h.min)/5}),suffix:r.pareto?"%":""}),X(r.groups,b,Y(r.type));const C=new ae(r.groups.marks),O=c.filter(ue=>(ue.mark||"bar")==="bar"),W=m?p(G,n):n.bandwidth,re=O.length?W/O.length:W;let _=0;for(const ue of c){const ge=ue.mark||"bar",ye=ue.axis==="right"&&i?i:j,be=s.series(ue.index);if(ge==="bar"){const xe=_*re;_++;const $e=ye.of(Math.max(ye.domain.min,0));for(let Oe=0;Oe<ue.points.length;Oe++){const Pe=ue.points[Oe];if(!Q(Pe.y))continue;let De;if(m){const Ve=t.kind==="time"?Z(Pe.x):S(Pe.x);De=Ve===null?NaN:n.of(Ve)-W/2}else De=n.of(Pe.x);if(Number.isNaN(De))continue;const Ge=ye.of(Pe.y);q(C.next("rect",`${R}__bar ${R}__mark`),{x:L(De+xe),y:L(Math.min(Ge,$e)),width:L(Math.max(0,re)),height:L(Math.max(1,Math.abs($e-Ge))),fill:be,"data-series":ue.index,"data-point":Oe}),Pe.px=L(De+xe+re/2),Pe.py=L(Math.min(Ge,$e))}continue}const Me=[];let je=!1;for(const xe of ue.points){if(!Q(xe.y)){je=!1;continue}let $e;if(m){const Pe=t.kind==="time"?Z(xe.x):S(xe.x);$e=Pe===null?NaN:L(n.of(Pe))}else $e=L(n.centre(xe.x));if(Number.isNaN($e)){je=!1;continue}const Oe=L(ye.of(xe.y));Me.push(je?"L":"M",$e,Oe),je=!0,xe.px=$e,xe.py=Oe}q(C.next("path",`${R}__line ${R}__mark`),{d:Me.length?E(Me):"",stroke:be,"data-series":ue.index});for(const xe of ue.points)xe.px!==void 0&&q(C.next("circle",`${R}__point ${R}__mark`),{cx:xe.px,cy:xe.py,r:3,fill:be})}C.finish(),r.labels&&r.labels.show&&J({group:r.groups.labels,series:c,plot:b,options:r.labels,grid:r.grid,size:r.typography&&r.typography.small||r.fontSize});let le=null;return r.annotations&&r.annotations.length&&(le=e({group:r.groups.overlay,plot:b,xScale:n,yScale:j,rightScale:i,series:c,annotations:r.annotations,dual:!!i,format:D(r.grid,{kind:"linear",step:(y.max-y.min)/5}).tick})),{xScale:n,yScale:j,rightScale:i,dual:!!i,series:c,bound:t,annotations:le}}function v(r){const{group:s,plot:b,scale:t,format:c}=r,P=new ae(s);q(P.next("line",`${R}__axis-right`),{x1:L(b.right),x2:L(b.right),y1:L(b.top),y2:L(b.bottom),stroke:r.colour});for(const g of t.ticks(5)){const y=L(t.of(g)),j=P.next("text",`${R}__tick`);q(j,{x:L(b.right+6),y,"text-anchor":"start","dominant-baseline":"middle",fill:r.colour}),j.textContent=`${c.tick(g)}${r.suffix||""}`}P.finish()}}),Xe("packages/modules/charts/quantile.js",function(a,V){"use strict";Object.defineProperty(a,"normalQuantile",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"studentTQuantile",{enumerable:!0,get:function(){return N}});const ve=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),ee=3e-12,M=1e-300;function de(d){if(d<.5)return Math.log(Math.PI/Math.sin(Math.PI*d))-de(1-d);const D=d-1;let z=.9999999999998099;const x=D+7.5;for(let B=0;B<ve.length;B++)z+=ve[B]/(D+B+1);return .5*Math.log(2*Math.PI)+(D+.5)*Math.log(x)-x+Math.log(z)}function ce(d,D,z){const x=d+D,B=d+1,Q=d-1;let F=1,I=1-x*z/B;Math.abs(I)<M&&(I=M),I=1/I;let ne=I;for(let S=1;S<=300;S++){const Z=2*S;let te=S*(D-S)*z/((Q+Z)*(d+Z));I=1+te*I,Math.abs(I)<M&&(I=M),F=1+te/F,Math.abs(F)<M&&(F=M),I=1/I,ne*=I*F,te=-(d+S)*(x+S)*z/((d+Z)*(B+Z)),I=1+te*I,Math.abs(I)<M&&(I=M),F=1+te/F,Math.abs(F)<M&&(F=M),I=1/I;const q=I*F;if(ne*=q,Math.abs(q-1)<ee)break}return ne}function Y(d,D,z){if(!(d>0)||!(D>0)||!Number.isFinite(z))return Number.NaN;if(z<=0)return 0;if(z>=1)return 1;const x=Math.exp(de(d+D)-de(d)-de(D)+d*Math.log(z)+D*Math.log(1-z));return z<(d+1)/(d+D+2)?x*ce(d,D,z)/d:1-x*ce(D,d,1-z)/D}function X(d){const D=Math.abs(d),z=2/(2+D),x=4*z-2,B=[-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 Q=0,F=0,I;for(let S=B.length-1;S>0;S--)I=F,F=x*F-Q+B[S],Q=I;const ne=z*Math.exp(-D*D+.5*(B[0]+x*F)-Q);return d>=0?ne:2-ne}function U(d){if(!(d>0)||!(d<1))return d===0?-1/0:d===1?1/0:Number.NaN;const D=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],z=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],x=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],B=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],Q=.02425;let F,I,ne;d<Q?(F=Math.sqrt(-2*Math.log(d)),ne=(((((x[0]*F+x[1])*F+x[2])*F+x[3])*F+x[4])*F+x[5])/((((B[0]*F+B[1])*F+B[2])*F+B[3])*F+1)):d<=1-Q?(F=d-.5,I=F*F,ne=(((((D[0]*I+D[1])*I+D[2])*I+D[3])*I+D[4])*I+D[5])*F/(((((z[0]*I+z[1])*I+z[2])*I+z[3])*I+z[4])*I+1)):(F=Math.sqrt(-2*Math.log(1-d)),ne=-(((((x[0]*F+x[1])*F+x[2])*F+x[3])*F+x[4])*F+x[5])/((((B[0]*F+B[1])*F+B[2])*F+B[3])*F+1));const Z=(.5*X(-ne/Math.SQRT2)-d)*Math.sqrt(2*Math.PI)*Math.exp(ne*ne/2);return ne-Z/(1+ne*Z/2)}function ae(d,D){if(!(D>0)||!Number.isFinite(d))return Number.NaN;const z=.5*Y(D/2,.5,D/(D+d*d));return d>0?1-z:z}function N(d,D){if(!(d>0)||!(d<1)||!(D>0))return Number.NaN;if(D>1e7)return U(d);let z=-1e4,x=1e4,B=U(d);const Q=de(D/2)+de(.5)-de((D+1)/2);for(let F=0;F<60;F++){const I=ae(B,D);I<d?z=B:x=B;const ne=Math.exp(-((D+1)/2)*Math.log(1+B*B/D)-Q)/Math.sqrt(D),S=ne>0?(I-d)/ne:0;if(Math.abs(S)<1e-12)break;const Z=B-S;if(B=Z>z&&Z<x&&Number.isFinite(Z)?Z:(z+x)/2,x-z<1e-12)break}return B}}),Xe("packages/modules/charts/trendline.js",function(a,V){"use strict";Object.defineProperty(a,"normaliseTrends",{enumerable:!0,get:function(){return L}}),Object.defineProperty(a,"linearTrend",{enumerable:!0,get:function(){return he}}),Object.defineProperty(a,"movingAverageTrend",{enumerable:!0,get:function(){return f}}),Object.defineProperty(a,"exponentialTrend",{enumerable:!0,get:function(){return u}}),Object.defineProperty(a,"computeTrend",{enumerable:!0,get:function(){return k}}),Object.defineProperty(a,"trendText",{enumerable:!0,get:function(){return o}}),Object.defineProperty(a,"drawTrendlines",{enumerable:!0,get:function(){return w}});const ee=V("packages/modules/charts/frame.js").Pool,M=V("packages/modules/charts/svg.js"),de=M.attrs,ce=M.path,Y=M.ribbonPath,X=M.round,U=M.setText,ae=M.SVG_NS,d=V("packages/modules/charts/typography.js").applySize,z=V("packages/modules/charts/styles.js").NS,x=V("packages/modules/charts/scale.js"),B=x.toNumber,Q=x.toTime,I=V("packages/modules/charts/quantile.js").studentTQuantile,S=V("packages/modules/charts/format.js").r2Digits,Z={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"])},te=1e-4,q=1-1e-4;function E(p){const l=String(p||"linear").toLowerCase();return Z.linear.has(l)?"linear":Z.movingAverage.has(l)?"movingAverage":Z.exponential.has(l)?"exponential":null}function L(p){if(!p)return[];const l=Array.isArray(p)?p:[p],v=[];for(const r of l){if(r===!0){v.push({method:"linear"});continue}if(typeof r=="string"){const s=E(r);s&&v.push({method:s});continue}if(r&&typeof r=="object"){const s=E(r.method);s&&v.push({...r,method:s})}}return v}function se(p,l){if(p.kind==="band")return p.centre(l);const v=p.kind==="time"?Q(l):B(l);return v===null?NaN:p.of(v)}function R(p){const l=[];for(const v of p.points){const r=Number(v.y);l.push({value:Number.isFinite(r)?r:null,rawX:v.x})}return l}function $(p,l){const v=[];for(const r of p.points){const s=l.kind==="time"?Q(r.x):B(r.x),b=Number(r.y);s===null||!Number.isFinite(s)||!Number.isFinite(b)||v.push({x:s,y:b})}return v.sort((r,s)=>r.x-s.x),v}function he(p,l,v={}){const r=p.length;if(r<2)return null;let s=0,b=0;for(const W of p)s+=W.x,b+=W.y;s/=r,b/=r;let t=0,c=0,P=0;for(const W of p){const re=W.x-s,_=W.y-b;t+=re*re,c+=re*_,P+=_*_}if(t===0)return null;const g=c/t,y=b-g*s,j=P===0?1:Math.max(0,Math.min(1,c*c/(t*P))),h=p[0].x,i=p[r-1].x,n=W=>({x:W,y:y+g*W}),m=[n(h),n(i)],G=[];let C=null;const O=Math.max(0,Math.floor(Number(l)||0));if(O>0&&i>h){const W=(i-h)/(r-1);if(W>0&&(G.push(n(i),n(i+O*W)),r>2)){const re=Number.isFinite(v.confidence)&&v.confidence>0&&v.confidence<1?Number(v.confidence):.95,_=1-(1-re)/2,le=Math.max(0,P-g*c),ue=Math.sqrt(le/(r-2)),ge=I(_,r-2),ye=[];for(let be=0;be<=O;be++){const Me=i+be*W,je=y+g*Me,xe=1/r+(Me-s)**2/t,$e=ue*Math.sqrt(1+xe),Oe=ue*Math.sqrt(xe);ye.push({x:Me,mean:je,lower:je-ge*$e,upper:je+ge*$e,lowerMean:je-ge*Oe,upperMean:je+ge*Oe})}C={confidence:re,points:ye}}}return{fit:m,forecast:G,band:C,stats:{method:"linear",slope:g,intercept:y,r2:j,n:r,forecast:G.length?O:0,confidence:C?C.confidence:null}}}function f(p,l){const v=Math.max(1,Math.floor(Number(l)||3)),r=[];let s=0;const b=[];for(const t of p)Number.isFinite(t.value)&&(r.push(t.value),s+=t.value,r.length>v&&(s-=r.shift())),r.length&&b.push({x:t.rawX,y:s/r.length});return b.length<2?null:{fit:b,stats:{method:"movingAverage",window:v}}}function J(p,l){const v=p.length,r=new Array(v).fill(null);let s=null,b=0;for(let t=0;t<v;t++){const c=p[t];if(!Number.isFinite(c)){s!==null&&(r[t]=s);continue}if(s===null){s=c,r[t]=c;continue}b+=(c-s)**2,s=l*c+(1-l)*s,r[t]=s}return{smoothed:r,sse:b}}function H(p,l,v){const r=p.length,s=new Array(r).fill(null);let b=null,t=null,c=0;for(let P=0;P<r;P++){const g=p[P];if(!Number.isFinite(g)){b!==null&&(b+=t,s[P]=b);continue}if(b===null){b=g,s[P]=g;continue}if(t===null){t=g-b;const h=b+t;c+=(g-h)**2;const i=b;b=l*g+(1-l)*(i+t),t=v*(b-i)+(1-v)*t,s[P]=b;continue}const y=b+t;c+=(g-y)**2;const j=b;b=l*g+(1-l)*(j+t),t=v*(b-j)+(1-v)*t,s[P]=b}return{smoothed:s,sse:c}}function e(p,l,v,r=80){const s=(Math.sqrt(5)-1)/2;let b=l,t=v,c=t-s*(t-b),P=b+s*(t-b),g=p(c),y=p(P);for(let j=0;j<r;j++)g<y?(t=P,P=c,y=g,c=t-s*(t-b),g=p(c)):(b=c,c=P,g=y,P=b+s*(t-b),y=p(P));return(b+t)/2}function u(p,l){const v=String(l.kind||l.model||"").toLowerCase()==="holt",r=p.map(y=>Number.isFinite(y.value)?y.value:null);if(r.filter(y=>y!==null).length<(v?2:1))return null;const b=y=>Math.min(q,Math.max(te,y));let t=Number.isFinite(l.alpha)?b(Number(l.alpha)):null,c=v&&Number.isFinite(l.beta)?b(Number(l.beta)):null;if(v){if(t===null||c===null){let y=t===null?.5:t,j=c===null?.5:c;for(let h=0;h<6;h++)t===null&&(y=e(i=>H(r,i,j).sse,te,q)),c===null&&(j=e(i=>H(r,y,i).sse,te,q));t=t===null?y:t,c=c===null?j:c}}else t===null&&(t=e(y=>J(r,y).sse,te,q));const P=v?H(r,t,c):J(r,t),g=[];for(let y=0;y<p.length;y++){const j=P.smoothed[y];j===null||!Number.isFinite(j)||g.push({x:p[y].rawX,y:j})}return g.length<2?null:{fit:g,stats:{method:"exponential",kind:v?"holt":"ses",alpha:t,beta:v?c:null}}}function k(p,l,v){if(l.method==="linear"){const s=$(p,v);return he(s,l.forecast,{confidence:l.confidence})}const r=R(p);return l.method==="movingAverage"?f(r,l.window||l.period):u(r,l)}function o(p,l,v,r,s,b){const t=l?` for ${l}`:"";if(p.method==="linear"){const y=Number.isFinite(p.r2)?`, R² ${p.r2.toFixed(2)}`:"";let j=`Trend (linear)${t}: slope ${v(p.slope)}${y}`;if(p.forecast>0&&r&&r.length){const h=r[r.length-1];if(j+=`; forecast ${p.forecast} step${p.forecast===1?"":"s"} ahead to ${v(h.y)}`,s&&s.points.length){const i=s.points[s.points.length-1],n=b==="confidence"||b==="mean",m=n?i.lowerMean:i.lower,G=n?i.upperMean:i.upper,C=n?"confidence":"prediction",O=Math.round(s.confidence*100);j+=`; ${O}% ${C} band ${v(m)} to ${v(G)} at the horizon`}}return j}if(p.method==="movingAverage")return`Trend (moving average, window ${p.window})${t}`;const c=p.kind==="holt"?"Holt":"single",P=Number.isFinite(p.alpha)?`, α ${p.alpha.toFixed(2)}`:"",g=Number.isFinite(p.beta)?`, β ${p.beta.toFixed(2)}`:"";return`Trend (exponential, ${c})${t}${P}${g}`}function w(p){const l=L(p.trend);if(!l.length)return[];const v=p.group.ownerDocument;let r=null;for(const t of p.group.childNodes||[])if(t&&String(t.getAttribute&&t.getAttribute("class"))===`${z}__trends`){r=t;break}r||(r=v.createElementNS(ae,"g"),r.setAttribute("class",`${z}__trends`),p.group.appendChild(r)),p.clip?r.setAttribute("clip-path",`url(#${p.clip})`):r.removeAttribute("clip-path");const s=new ee(r),b=[];for(const t of l)for(const c of p.series){const P=c.axis==="right"&&p.rightScale?p.rightScale:p.yScale,g=k(c,t,p.xScale);if(!g)continue;const y=p.scheme.series(c.index),j=[];for(const n of g.fit){const m=se(p.xScale,n.x),G=P.of(n.y);!Number.isFinite(m)||!Number.isFinite(G)||j.push(j.length?"L":"M",X(m),X(G))}if(j.length<4)continue;if(de(s.next("path",`${z}__trend`),{d:ce(j),fill:"none",stroke:y,"data-series":c.index}),t.band!==!1&&g.band&&g.band.points.length>=2){const n=t.band==="confidence"||t.band==="mean",m=[];for(const C of g.band.points){const O=se(p.xScale,C.x),W=n?C.lowerMean:C.lower,re=n?C.upperMean:C.upper,_=P.of(W),le=P.of(re);!Number.isFinite(O)||!Number.isFinite(_)||!Number.isFinite(le)||m.push({x:X(O),lower:X(_),upper:X(le)})}const G=Y(m);G&&de(s.next("path",`${z}__trend-band`),{d:G,fill:y,"fill-opacity":.15,stroke:"none","data-series":c.index})}const i=g.forecast||[];if(i.length>=2){const n=[];for(const m of i){const G=se(p.xScale,m.x),C=P.of(m.y);!Number.isFinite(G)||!Number.isFinite(C)||n.push(n.length?"L":"M",X(G),X(C))}n.length>=4&&de(s.next("path",`${z}__trend-forecast`),{d:ce(n),fill:"none",stroke:y,"data-series":c.index})}if(t.label!==!1&&g.stats.method==="linear"&&Number.isFinite(g.stats.r2)){const n=g.fit[g.fit.length-1],m=s.next("text",`${z}__trend-label`);d(m,p.size),de(m,{x:X(se(p.xScale,n.x)),y:X(P.of(n.y))-4,"text-anchor":"end",fill:y}),U(m,p.grid.messages.t("chart.r2",{value:S(p.grid,g.stats.r2)}))}b.push({text:o(g.stats,c.label,p.format,i,t.band===!1?null:g.band,t.band)})}return s.finish(),b.filter(t=>t.text)}}),Xe("packages/modules/charts/rulecolour.js",function(a,V){"use strict";Object.defineProperty(a,"colourOf",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(a,"ruleColour",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"ruleLegend",{enumerable:!0,get:function(){return de}});const ve="*";function ee(ce){if(!ce||typeof ce!="object")return null;for(const Y of["background","backgroundColor","color"]){const X=ce[Y];if(typeof X=="string"&&X.trim())return X.trim()}return null}function M(ce){const{grid:Y,col:X,value:U}=ce;if(!Y||!X||!Y.formatting||typeof Y.formatting.styleFor!="function")return null;try{return ee(Y.formatting.styleFor(X,U))}catch{return null}}function de(ce){const{grid:Y,col:X}=ce,U=new Set([...ce.colours||[]].filter(Boolean));if(!U.size||!Y||!Y.formatting||typeof Y.formatting.list!="function")return[];let ae;try{ae=[...Y.formatting.list(ve)||[],...X?Y.formatting.list(X)||[]:[]]}catch{return[]}const N=[],d=new Set;for(const D of ae){if(!D||D.enabled===!1)continue;const z=ee(D.style);!z||!U.has(z)||d.has(z)||(d.add(z),N.push({key:D.id||`rule:${N.length}`,label:D.label||D.id||z,colour:z,index:N.length}))}return N}}),Xe("packages/modules/charts/cartesian.js",function(a,V){"use strict";Object.defineProperty(a,"CARTESIAN",{enumerable:!0,get:function(){return O}}),Object.defineProperty(a,"axisWindowSpan",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(a,"rollingDomain",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(a,"WINDOW_LEAD",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(a,"aheadOfWindow",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(a,"staleWindow",{enumerable:!0,get:function(){return je}}),Object.defineProperty(a,"windowedBound",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(a,"drawFits",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(a,"drawConfidenceBand",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(a,"drawBoundErrorBars",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(a,"drawForest",{enumerable:!0,get:function(){return _t}}),Object.defineProperty(a,"drawReferenceLines",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(a,"drawCartesian",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(a,"HIT_TOLERANCE",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(a,"nearestDrawnPoint",{enumerable:!0,get:function(){return Kt}}),Object.defineProperty(a,"nearestCategory",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(a,"categoryKeyAt",{enumerable:!0,get:function(){return qe}});const ve=V("packages/modules/charts/axis.js"),ee=ve.drawAxisLines,M=ve.drawAxisTitle,de=ve.drawBandLabels,ce=ve.drawCategoryAxis,Y=ve.drawContinuousAxis,X=ve.drawMeasureAxis,U=ve.overhangFor,ae=ve.setPlotClip,N=V("packages/modules/charts/frame.js"),d=N.Pool,D=N.shouldRotate,z=V("packages/modules/charts/format.js"),x=z.formatters,B=z.r2Digits,Q=V("packages/modules/charts/scale.js"),F=Q.bandScale,I=Q.extent,ne=Q.isNumber,S=Q.key,Z=Q.linearScale,te=Q.measureDomain,q=Q.timeScale,E=Q.toNumber,L=Q.toTime,se=V("packages/modules/charts/svg.js"),R=se.attrs,$=se.path,he=se.ribbonPath,f=se.round,J=se.setText,H=se.SVG_NS,u=V("packages/modules/charts/styles.js").NS,o=V("packages/modules/charts/labels.js").drawDataLabels,p=V("packages/modules/charts/dense.js").downsample,v=V("packages/modules/charts/scheme.js").resolveScheme,s=V("packages/modules/charts/typography.js").applySize,t=V("packages/modules/charts/combo.js").drawRightAxis,c=V("packages/modules/charts/annotations.js"),P=c.drawAnnotations,g=c.overlayLayer,j=V("packages/modules/charts/trendline.js").drawTrendlines,h=V("packages/modules/charts/rulecolour.js"),i=h.ruleColour,n=h.ruleLegend,G=V("packages/core/src/internal/util.js").warnOnce,C=3.5,O=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 W(A){const Ae=[];for(let pe=0;pe<A.length;pe++){const fe=A[pe];if(pe===0){Ae.push("M",fe.x,fe.y);continue}Ae.push("L",fe.x,A[pe-1].y),Ae.push("L",fe.x,fe.y)}return Ae}function re(A,Ae,pe){if(pe)return[0,100];if(!Ae){const ke=[];for(const Le of A)for(const we of Le.points)ke.push(we.y);return ke}const fe=[],Ne=[],me=A[0]?A[0].points.length:0;for(let ke=0;ke<me;ke++){let Le=0,we=0;for(const _e of A){const Te=_e.points[ke]?_e.points[ke].y:null;ne(Te)&&(Te>=0?Le+=Te:we+=Te)}fe.push(Le),Ne.push(we)}return[...fe,...Ne]}function _(A){const Ae=[0];if(!A)return Ae;let pe=0;for(const fe of A.points)ne(fe.y)&&(pe+=fe.y,Ae.push(pe));return Ae}function le(A,Ae){const pe=new Float64Array(A),fe=new Float64Array(A);return{take(Ne,me){const ke=Ae?Ae[Ne]:0,Le=Ae?ke?me/ke*100:0:me;if(Le>=0){const _e=pe[Ne];return pe[Ne]+=Le,[_e,pe[Ne]]}const we=fe[Ne];return fe[Ne]+=Le,[we,fe[Ne]]}}}function ue(A){const Ae=A&&A.window;if(!Ae||typeof Ae!="object")return 0;const pe=Number(Ae.span);return!Number.isFinite(pe)||pe<=0?0:Ae.kind!=="time"?(G("chart.axis.window.kind",`axis window kind "${Ae.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):pe}function ge(A,Ae,pe){const fe=pe+A*ye;let Ne=pe;for(const me of Ae)Number.isFinite(me)&&me>Ne&&me<=fe&&(Ne=me);return{min:Ne-A,max:Ne}}const ye=.25;function be(A,Ae,pe){const fe=ue(Ae);if(!fe||!A||!Array.isArray(A.categories))return null;const Ne=O[pe];if(!Ne||Ne.horizontal||pe==="bar"||A.kind==="category")return null;const me=A.categories.map(ke=>A.kind==="time"?L(ke):E(ke));return{span:fe,values:me}}function Me(A,Ae,pe,fe){const Ne=be(A,Ae,pe);if(!Ne)return null;const me=Ne.span*ye;let ke=0,Le=0;for(const we of Ne.values)we===null||!Number.isFinite(we)||we-fe<=me||(ke+=1,we-fe>Le&&(Le=we-fe));return ke?{span:Ne.span,limit:me,count:ke,lead:Le}:null}function je(A,Ae,pe,fe){const Ne=be(A,Ae,pe);if(!Ne)return null;const{span:me}=Ne,ke=Ne.values.filter(Te=>Te!==null&&Number.isFinite(Te));if(!ke.length)return null;const{min:Le,max:we}=ge(me,ke,fe);let _e=-1/0;for(const Te of ke){if(Te>=Le&&Te<=we)return null;Te<Le&&Te>_e&&(_e=Te)}return _e===-1/0?{span:me,newest:null,age:null,points:ke.length}:{span:me,newest:_e,age:fe-_e,points:ke.length}}function xe(A,Ae,pe,fe){const Ne=be(A,Ae,pe);if(!Ne)return A;const{span:me,values:ke}=Ne,Le=ke.filter(Fe=>Fe!==null&&Number.isFinite(Fe));if(!Le.length)return A;const{min:we,max:_e}=ge(me,Le,fe),Te=[];for(let Fe=0;Fe<ke.length;Fe++){const He=ke[Fe];(He===null||!Number.isFinite(He)||He>=we&&He<=_e)&&Te.push(Fe)}return Te.length===ke.length?A:{...A,categories:Te.map(Fe=>A.categories[Fe]),labels:Array.isArray(A.labels)?Te.map(Fe=>A.labels[Fe]):A.labels,series:(A.series||[]).map(Fe=>({...Fe,points:Array.isArray(Fe.points)?Te.map(He=>Fe.points[He]).filter(He=>He!==void 0):Fe.points})),windowed:ke.length-Te.length}}function $e(A,Ae,pe,fe){const Ne=[Ae.left,Ae.right],me=ue(fe);if(A.kind==="category"||pe==="bar")return me&&G("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."),F(A.categories,Ne,pe==="bar"?.2:.4);const ke=A.kind==="time"?A.categories.map(L):A.categories.map(E);if(A.kind==="time"&&!me){const we=I(ke);if(we&&we.min===we.max)return q({min:we.min-3e4,max:we.max+3e4},Ne)}const Le=me?ge(me,ke,Date.now()):te(ke,{zero:!1,nice:A.kind!=="time"});return A.kind==="time"?q(Le,Ne):Z(Le,Ne)}function Oe(A,Ae){if(A.kind==="band")return A.centre(Ae.x);const pe=A.kind==="time"?L(Ae.x):E(Ae.x);return pe===null?NaN:A.of(pe)}function Pe(A){const{series:Ae,xScale:pe,yScale:fe,baseline:Ne,fill:me,colour:ke,stack:Le}=A,we=[],_e=[];let Te=!1;const Fe=[];for(let Je=0;Je<Ae.points.length;Je++){const Ze=Ae.points[Je],st=f(Oe(pe,Ze));if(!ne(Ze.y)||Number.isNaN(st)){Te=!1;continue}Fe[Je]=!0;const at=Ze.y,lt=Le?Le.take(Je,at):null,ot=f(fe.of(lt?lt[1]:at)),ct=f(fe.of(lt?lt[0]:Ne));A.step&&Te&&we.push("L",st,A.previous),we.push(Te?"L":"M",st,ot),A.previous=ot,me&&_e.push(Te?"L":"M",st,ot),me&&!Te&&_e.push("M",st,ot),Te=!0,Ze.px=st,Ze.py=ot,Ze.pbase=ct}if(R(A.pool.next("path",`${u}__line ${u}__mark`),{d:we.length?$(we):"",stroke:ke,"data-series":A.index}),!me){De({...A,placed:Fe});return}const He=[];let Be=[];const et=()=>{if(Be.length<2){Be=[];return}He.push("M",Be[0].x,Be[0].base);for(const Je of Be)He.push("L",Je.x,Je.y);for(let Je=Be.length-1;Je>=0;Je--)He.push("L",Be[Je].x,Be[Je].base);He.push("Z"),Be=[]};for(const Je of Ae.points){if(!ne(Je.y)||Je.px===void 0){et();continue}Be.push({x:Je.px,y:Je.py,base:Je.pbase})}et(),R(A.pool.next("path",`${u}__area ${u}__mark`),{d:He.length?$(He):"",fill:ke,"data-series":A.index}),De({...A,placed:Fe})}function De(A){const{series:Ae,placed:pe}=A;for(let fe=0;fe<Ae.points.length;fe++){if(!pe[fe]||pe[fe-1]||pe[fe+1])continue;const Ne=Ae.points[fe];R(A.pool.next("circle",`${u}__point ${u}__mark`),{cx:Ne.px,cy:Ne.py,r:C,fill:A.colour,"data-series":A.index,"data-point":fe})}}function Ge(A,Ae){const pe=A&&A.range;if(!Array.isArray(pe)||pe.length!==2)return Ae;const[fe,Ne]=pe;return!Number.isFinite(fe)||!Number.isFinite(Ne)||!Number.isFinite(Ae)?Ae:Math.min(Math.max(fe,Ne),Math.max(Math.min(fe,Ne),Ae))}function Ve(A){const{series:Ae,xScale:pe,yScale:fe,baseline:Ne,colour:me,stack:ke,slot:Le}=A;for(let we=0;we<Ae.points.length;we++){const _e=Ae.points[we];if(!ne(_e.y))continue;const Te=pe.of(_e.x);if(Number.isNaN(Te))continue;const Fe=_e.y,He=A.pointColour&&A.pointColour(_e)||me,Be=ke?ke.take(we,Fe):[Ne,Fe],et=Ge(fe,fe.of(Be[1])),Je=Ge(fe,fe.of(Be[0])),Ze=A.pool.next("rect",`${u}__bar ${u}__mark`);R(Ze,{x:f(Te+Le.offset),y:f(Math.min(et,Je)),width:f(Math.max(0,Le.width)),height:f(Math.max(1,Math.abs(Je-et))),fill:He,"data-series":A.index,"data-point":we}),_e.px=f(Te+Le.offset+Le.width/2),_e.py=f(Math.min(et,Je)),_e.pbase=f(Math.max(et,Je))}}function it(A){const{series:Ae,xScale:pe,yScale:fe}=A;let Ne=0;for(let me=0;me<Ae.points.length;me++){const ke=Ae.points[me];if(!ne(ke.y))continue;const Le=ke.y,we=me===Ae.points.length-1,_e=A.total&&we?0:Ne,Te=(A.total&&we,Ne+Le);A.total,Ne+=Le;const Fe=Ge(fe,fe.of(Math.max(_e,Te))),He=Ge(fe,fe.of(Math.min(_e,Te))),Be=A.pool.next("rect",`${u}__bar ${u}__mark`);R(Be,{x:f(pe.of(ke.x)),y:f(Fe),width:f(pe.bandwidth),height:f(Math.max(1,He-Fe)),fill:Le>=0?A.positive:A.negative,"data-series":A.index,"data-point":me}),ke.px=f(pe.of(ke.x)+pe.bandwidth/2),ke.py=f(Fe)}}function gt(A){const{series:Ae,valueScale:pe,baseline:fe,colour:Ne,stack:me,slot:ke}=A;for(let Le=0;Le<Ae.points.length;Le++){const we=Ae.points[Le];if(!ne(we.y))continue;const _e=A.bandScale.of(we.x);if(Number.isNaN(_e))continue;const Te=we.y,Fe=A.pointColour&&A.pointColour(we)||Ne,He=me?me.take(Le,Te):[fe,Te],Be=Ge(pe,pe.of(He[0])),et=Ge(pe,pe.of(He[1]));R(A.pool.next("rect",`${u}__bar ${u}__mark`),{x:f(Math.min(Be,et)),y:f(_e+ke.offset),width:f(Math.max(1,Math.abs(et-Be))),height:f(Math.max(0,ke.width)),fill:Fe,"data-series":A.index,"data-point":Le}),we.px=f(et),we.py=f(_e+ke.offset+ke.width/2),we.pbase=f(Be)}}function ft(A){const Ae=A.group.ownerDocument;let pe=null;for(const me of A.group.childNodes||[])if(me&&String(me.getAttribute&&me.getAttribute("class"))===`${u}__fits`){pe=me;break}pe||(pe=Ae.createElementNS(H,"g"),pe.setAttribute("class",`${u}__fits`),A.group.appendChild(pe));const fe=new d(pe),Ne=[];for(const me of A.series){let ke=0,Le=0,we=0;for(const ot of me.points){const ct=Number(ot.x),At=Number(ot.y);!Number.isFinite(ct)||!Number.isFinite(At)||(ke++,Le+=ct,we+=At)}if(ke<2)continue;const _e=Le/ke,Te=we/ke;let Fe=0,He=0,Be=0,et=1/0,Je=-1/0;for(const ot of me.points){const ct=Number(ot.x),At=Number(ot.y);if(!Number.isFinite(ct)||!Number.isFinite(At))continue;const dt=ct-_e,bt=At-Te;Fe+=dt*dt,He+=dt*bt,Be+=bt*bt,ct<et&&(et=ct),ct>Je&&(Je=ct)}if(Fe===0)continue;const Ze=He/Fe,st=Te-Ze*_e,at=Be===0?1:Math.max(0,Math.min(1,He*He/(Fe*Be))),lt=A.scheme.series(me.index);if(R(fe.next("path",`${u}__fit`),{d:$(["M",f(A.xScale.of(et)),f(A.yScale.of(st+Ze*et)),"L",f(A.xScale.of(Je)),f(A.yScale.of(st+Ze*Je))]),fill:"none",stroke:lt,"data-series":me.index}),A.showR2){const ot=fe.next("text",`${u}__fit-label`);s(ot,A.size),R(ot,{x:f(A.xScale.of(Je)),y:f(A.yScale.of(st+Ze*Je))-4,"text-anchor":"end",fill:lt}),J(ot,A.grid.messages.t("chart.r2",{value:B(A.grid,at)}))}Ne.push({key:me.key,slope:Ze,intercept:st,r2:at,n:ke})}return fe.finish(),Ne}function xt(A){const Ae=A.group.ownerDocument;let pe=null;for(const _e of A.group.childNodes||[])if(_e&&String(_e.getAttribute&&_e.getAttribute("class"))===`${u}__band`){pe=_e;break}pe||(pe=Ae.createElementNS(H,"g"),pe.setAttribute("class",`${u}__band`),A.group.firstChild?A.group.insertBefore(pe,A.group.firstChild):A.group.appendChild(pe));const fe=new d(pe),Ne=A.band&&Array.isArray(A.band.points)?A.band.points:[],me=Number.isFinite(A.index)?Number(A.index):0,ke=A.scheme.series(me),Le=Number.isFinite(A.opacity)?Number(A.opacity):.15,we=[];for(const _e of Ne){const Te=Number(_e.x),Fe=Number(_e.lower),He=Number(_e.upper);if(!Number.isFinite(Te)||!Number.isFinite(Fe)||!Number.isFinite(He))continue;const Be=Number(_e.yhat);we.push({x:f(A.xScale.of(Te)),lower:f(A.yScale.of(Fe)),upper:f(A.yScale.of(He)),yhat:Number.isFinite(Be)?f(A.yScale.of(Be)):null})}if(we.length>=2&&(R(fe.next("path",`${u}__band-fill`),{d:he(we),fill:ke,"fill-opacity":Le,stroke:"none","data-series":me}),A.line!==!1)){const _e=[];let Te=!1;for(const Fe of we){if(Fe.yhat===null){Te=!1;continue}_e.push(Te?"L":"M",Fe.x,Fe.yhat),Te=!0}R(fe.next("path",`${u}__band-line`),{d:_e.length?$(_e):"",fill:"none",stroke:ke,"data-series":me})}return fe.finish(),{points:we.length,confidence:A.band&&Number.isFinite(A.band.confidence)?Number(A.band.confidence):null}}function kt(A){const Ae=A.group.ownerDocument;let pe=null;for(const we of A.group.childNodes||[])if(we&&String(we.getAttribute&&we.getAttribute("class"))===`${u}__whiskers`){pe=we;break}pe||(pe=Ae.createElementNS(H,"g"),pe.setAttribute("class",`${u}__whiskers`),A.group.appendChild(pe));const fe=new d(pe),Ne=Number.isFinite(A.cap)?Number(A.cap):4,me=A.colour||"currentColor",ke=A.orient!=="v";let Le=0;for(const we of A.points||[]){const _e=Number(we.main),Te=Number(we.lo),Fe=Number(we.hi);if(!Number.isFinite(_e)||!Number.isFinite(Te)||!Number.isFinite(Fe))continue;const He=ke?["M",Te,_e,"L",Fe,_e,"M",Te,_e-Ne,"L",Te,_e+Ne,"M",Fe,_e-Ne,"L",Fe,_e+Ne]:["M",_e,Te,"L",_e,Fe,"M",_e-Ne,Te,"L",_e+Ne,Te,"M",_e-Ne,Fe,"L",_e+Ne,Fe];R(fe.next("path",`${u}__whisker`),{d:$(He),stroke:me,fill:"none"}),Le++}return fe.finish(),Le}function _t(A){const Ae=A.scheme||v(),pe=A.typography||{small:A.fontSize||11,axisTitle:11},{plot:fe,bound:Ne}=A,me=Ne.series[0]&&Ne.series[0].points||[],ke=me.map(Be=>Be.label),Le=Ae.series(0),we=F(ke,[fe.top,fe.bottom],.4),_e=[0];for(const Be of me)for(const et of[Be.x,Be.lower,Be.upper])Number.isFinite(et)&&_e.push(et);const Te=Z(te(_e,{zero:!1}),[fe.left,fe.right]);kt({group:A.groups.overlay,orient:"h",colour:Le,points:me.map(Be=>({main:f(we.centre(Be.label)),lo:f(Te.of(Be.lower)),hi:f(Te.of(Be.upper))}))});const Fe=new d(A.groups.marks);let He=0;for(const Be of me)Number.isFinite(Be.x)&&(R(Fe.next("circle",`${u}__point ${u}__mark`),{cx:f(Te.of(Be.x)),cy:f(we.centre(Be.label)),r:C,fill:Le}),He++);return Fe.finish(),Pt({group:A.groups.rules,plot:fe,scale:Te,lines:[{value:0}]}),Y({group:A.groups.axis,plot:fe,scale:Te,format:x(A.grid,{kind:"linear",step:(Te.domain.max-Te.domain.min)/5}),config:{},grid:A.grid,size:pe.small}),de({group:A.groups.labels,plot:fe,scale:we,labels:ke,fontSize:pe.small,config:{}}),{series:[],marks:He}}function Pt(A){const Ae=new d(g(A.group,`${u}__reflines`));for(const pe of A.lines||[]){if(!ne(pe.value))continue;const fe=f(A.scale.of(pe.value));if(R(Ae.next("path",`${u}__reference`),{d:$(["M",f(A.plot.left),fe,"L",f(A.plot.right),fe]),stroke:pe.colour||"currentColor","stroke-dasharray":"4 3",fill:"none"}),!pe.label)continue;const Ne=Ae.next("text",`${u}__reference-label`);R(Ne,{x:f(A.plot.right-4),y:fe-4,"text-anchor":"end"}),J(Ne,pe.label)}Ae.finish()}function Nt(A){const{series:Ae,xScale:pe,yScale:fe,colour:Ne}=A,me=A.size||null;for(let ke=0;ke<Ae.points.length;ke++){const Le=Ae.points[ke];if(!ne(Le.y))continue;const we=f(Oe(pe,Le));if(Number.isNaN(we))continue;const _e=f(fe.of(Le.y));R(A.pool.next("circle",`${u}__point ${u}__mark`),{cx:we,cy:_e,r:me&&ne(Le.size)?f(me.of(Le.size)):C,fill:Ne,"fill-opacity":me?.7:1,"data-series":A.index,"data-point":ke}),Le.px=we,Le.py=_e}}function Ut(A){const{group:Ae,series:pe,xScale:fe,yScale:Ne,options:me}=A,ke=A.grid&&A.grid.statistics,Le=ke&&typeof ke.intervalOf=="function"?(Je,Ze)=>ke.intervalOf(Je,Ze):null,we=new d(g(Ae,`${u}__errorbars`)),_e=Number.isFinite(Number(me.confidence))?Number(me.confidence):.95,Te=4;let Fe=0,He=0,Be=0,et=0;for(const Je of pe)for(const Ze of Je.points){if(Ze.y===null||Ze.y===void 0)continue;He++;const st=Array.isArray(Ze.values)&&Ze.values.length===1;st&&Be++;let at=null,lt=null;if(me.of!==void 0&&Number.isFinite(Number(Ze[me.of]))){const dt=Math.abs(Number(Ze[me.of]));at=Ze.y-dt,lt=Ze.y+dt}else if(Array.isArray(Ze.values)&&Ze.values.length>1&&Le){const dt=Le(Ze.values,_e);dt&&(at=dt.lower,lt=dt.upper)}if(at===null||!Number.isFinite(at)||!Number.isFinite(lt)){st&&et++;continue}const ot=f(fe.of(Ze.xKey!==void 0?Ze.xKey:Ze.x)+(fe.bandwidth?fe.bandwidth/2:0)),ct=f(Ne.of(lt)),At=f(Ne.of(at));R(we.next("path",`${u}__error-bar ${u}__mark`),{d:$(["M",ot-Te,ct,"L",ot+Te,ct,"M",ot,ct,"L",ot,At,"M",ot-Te,At,"L",ot+Te,At]),fill:"none",stroke:"currentColor","data-lower":at,"data-upper":lt}),Fe++}return we.finish(),{drawn:Fe,marks:He,single:Be,singleSkipped:et}}function Lt(A){const Ae=A.scheme||v(),pe=A.axis||{x:{},y:{},y2:{}},fe=A.typography||{small:A.fontSize||11,axisTitle:11},{bound:Ne,plot:me,type:ke}=A,Le=O[ke]||O.line,we=Ne.series.filter(Qe=>!A.hidden.has(Qe.key)),_e=!!Le.horizontal,Te=(ke==="bar"||ke==="horizontalBar")&&A.byRuleColour&&we.length===1&&Ne.measure&&Ne.measure.col||null,Fe=Te?new Set:null,He=Te?Qe=>{const nt=i({grid:A.grid,col:Te,value:Qe.y});return nt&&Fe.add(nt),nt}:null,et=(ke==="bar"||ke==="horizontalBar")&&A.byRuleColour&&we.length===1&&Ae.nameMap?Qe=>Ae.series(0,Qe.label):null,Je=He||et?Qe=>He&&He(Qe)||et&&et(Qe)||null:null,Ze=!_e&&ke!=="waterfall"?we.filter(Qe=>Qe.axis==="right"):[],st=Ze.length?we.filter(Qe=>Qe.axis!=="right"):we,at=Ze.length>0,lt=(ke==="bar"||ke==="area"||ke==="horizontalBar")&&!at,ot=A.stack==="percent"&<&&st.length>1,ct=(ot||!!A.stack)&&st.length>1&<,At=ke==="waterfall"?_(we[0]):re(st,ct,ot),dt=A.domain||te(At,{zero:Le.zero,min:pe.y.min,max:pe.y.max}),bt=_e?Z(dt,[me.left,me.right]):Z(dt,[me.bottom,me.top]),rt=_e?F(Ne.categories,[me.top,me.bottom],.2):$e(Ne,me,ke,pe.x),It=dt.min<=0&&dt.max>=0?0:dt.min,hn=Ze.some(Qe=>(Qe.mark||(ke==="bar"?"bar":ke))==="bar"),zt=at?te(re(Ze,!1,!1),{zero:hn,min:pe.y2.min,max:pe.y2.max}):null,vt=zt?Z(zt,[me.bottom,me.top]):null,Vt=x(A.grid,{kind:"linear",step:(dt.max-dt.min)/5}),Rt=A.axes!==!1;if(Rt&&X({gridGroup:A.groups.grid,axisGroup:A.groups.axis,plot:me,scale:bt,format:Vt,horizontal:_e,config:pe.y,grid:A.grid,size:fe.small}),Rt&&(_e?de({group:A.groups.overlay,plot:me,scale:rt,labels:Ne.labels,fontSize:fe.small,config:pe.x}):rt.kind==="band"?ce({group:A.groups.overlay,plot:me,scale:rt,labels:Ne.labels,fontSize:fe.small,rotated:D(Ne.labels,rt.step,fe.small,pe.x.every),config:pe.x}):Y({group:A.groups.overlay,plot:me,scale:rt,format:x(A.grid,{kind:Ne.kind,span:rt.domain.max-rt.domain.min,step:(rt.domain.max-rt.domain.min)/5}),config:pe.x,grid:A.grid,size:fe.small})),Rt&&(ee({group:A.groups.rules,plot:me}),M({group:A.groups.axis,plot:me,text:pe.y.title,side:_e?"bottom":"left",size:fe.axisTitle}),M({group:A.groups.axis,plot:me,text:pe.x.title,side:_e?"left":"bottom",size:fe.axisTitle})),Rt&&vt){t({group:A.groups.axis,plot:me,scale:vt,colour:Ae.series(Ze[0].index),format:x(A.grid,{kind:"linear",step:(zt.max-zt.min)/5})});const Qe=pe.y2.title||(Ze.length===1?Ze[0].label:"");M({group:A.groups.axis,plot:me,text:Qe,side:"right",size:fe.axisTitle}),!pe.y.title&&st.length===1&&st[0].label&&M({group:A.groups.axis,plot:me,text:st[0].label,side:"left",size:fe.axisTitle})}const Xt=Number.isFinite(A.downsampleTo)?Number(A.downsampleTo):Math.max(2,Math.round(me.width));let Yt=!1;if(Le.marks==="path"||ke==="scatter"||ke==="bubble"){for(const Qe of we)if(Qe.kept=null,Qe.points.length>Xt*1.5){const nt=Qe.points.map((wt,jt)=>({x:jt,y:wt.y,point:wt})),pt=p(nt,Xt);Qe.points=pt.map(wt=>wt.point),Qe.kept=pt.map(wt=>wt.x),Yt=!0}}A.pool||ae(A.groups,me,U(ke));const Mt=A.pool||new d(A.groups.marks),qt=ot?Ne.categories.map((Qe,nt)=>we.reduce((pt,wt)=>{const jt=wt.points[nt]?wt.points[nt].y:null;return ne(jt)?pt+Math.abs(jt):pt},0)):null,Zt=ct?le(Ne.categories.length,qt):null,en=at?we.filter(Qe=>(Qe.mark||(ke==="bar"?"bar":ke))==="bar"):we,tn=at?Math.max(1,en.length):Math.max(1,we.length),Bt=rt.kind==="band"?ct?rt.bandwidth:rt.bandwidth/tn:0,Dt=new Map;for(const Qe of en)Dt.set(Qe.key,Dt.size);for(let Qe=0;Qe<we.length;Qe++){const nt=we[Qe],pt=Ae.series(nt.index,nt.label),wt=nt.axis==="right"&&vt?vt:bt,jt=at?nt.mark||(ke==="bar"?"bar":ke):ke,on=at&&Dt.has(nt.key)?Dt.get(nt.key):Qe;ke==="horizontalBar"?gt({pool:Mt,series:nt,bandScale:rt,valueScale:bt,baseline:It,colour:pt,stack:Zt,index:nt.index,slot:{offset:ct?0:Qe*Bt,width:Bt},pointColour:Je}):ke==="waterfall"?it({pool:Mt,series:nt,xScale:rt,yScale:bt,index:nt.index,total:!0,positive:Ae.positive,negative:Ae.negative}):jt==="bar"?Ve({pool:Mt,series:nt,xScale:rt,yScale:wt,baseline:wt===vt?zt.min<=0&&zt.max>=0?0:zt.min:It,colour:pt,stack:Zt,index:nt.index,slot:{offset:ct?0:on*Bt,width:Bt},pointColour:Je}):ke==="scatter"||ke==="bubble"?Nt({pool:Mt,series:nt,xScale:rt,yScale:wt,colour:pt,index:nt.index,size:ke==="bubble"?A.sizes:null}):Pe({pool:Mt,series:nt,xScale:rt,yScale:wt,baseline:It,fill:jt==="area"||jt==="rangeArea",step:jt==="step",colour:pt,stack:Zt,index:nt.index})}A.pool||Mt.finish(),A.band&&typeof rt.invert=="function"&&xt({group:A.groups.overlay,band:A.band,xScale:rt,yScale:bt,scheme:Ae,index:0,line:A.band.line!==!1&&!A.fit}),A.fit&&(ke==="scatter"||ke==="bubble")&&typeof rt.invert=="function"&&ft({group:A.groups.overlay,series:we,xScale:rt,yScale:bt,plot:me,scheme:Ae,grid:A.grid,size:fe.small,showR2:A.fit!=="line"});let Gt=null;A.trend&&(Gt=j({group:A.groups.overlay,series:we,xScale:rt,yScale:bt,rightScale:vt,plot:me,scheme:Ae,trend:A.trend,grid:A.grid,format:Qe=>Vt.tick(Qe),size:fe.small,clip:A.groups.boxClipId}));let Jt=null;if(A.error&&(Jt=Ut({group:A.groups.overlay,series:we,xScale:rt,yScale:bt,grid:A.grid,options:A.error===!0?{}:A.error})),A.labels&&A.labels.show&&o({group:A.groups.labels,series:we,plot:me,options:A.labels,grid:A.grid,size:fe.small,horizontal:_e}),A.reference&&A.reference.length){const Qe=A.reference.filter(pt=>!(pt.axis==="right"||pt.axis==="y2")),nt=vt?A.reference.filter(pt=>pt.axis==="right"||pt.axis==="y2"):[];Qe.length&&Pt({group:A.groups.overlay,plot:me,scale:bt,lines:Qe}),nt.length&&Pt({group:A.groups.overlay,plot:me,scale:vt,lines:nt})}let Ht=null;A.annotations&&A.annotations.length&&(Ht=P({group:A.groups.overlay,plot:me,xScale:rt,yScale:bt,rightScale:vt,series:we,annotations:A.annotations,dual:at,format:Qe=>Vt.tick(Qe),size:fe.small}));const nn=Array.isArray(Gt)&&Gt.length?[...Ht||[],...Gt]:Ht;return{xScale:rt,yScale:bt,rightScale:vt,dual:at,series:we,horizontal:_e,percent:ot,plot:me,errorBars:Jt,annotations:nn,trendlines:Gt,reduced:Yt,legend:Te?n({grid:A.grid,col:Te,colours:Fe}):null}}const Ft=32;function Kt(A){const{series:Ae,xScale:pe,at:fe}=A,Ne=Number.isFinite(A.tolerance)?Number(A.tolerance):Ft,me=[];let ke=-1,Le=1/0;for(const we of Ae){let _e=null,Te=-1,Fe=1/0;const He=we.points||[];for(let Be=0;Be<He.length;Be++){const et=He[Be];if(!et||!ne(et.y))continue;const Je=Oe(pe,et);if(Number.isNaN(Je))continue;const Ze=Math.abs(Je-fe);Ze>=Fe||(Fe=Ze,_e=et,Te=Array.isArray(we.kept)?we.kept[Be]:Be)}!_e||Fe>Ne||(me.push({series:we,point:_e}),Fe<Le&&(Le=Fe,ke=Te))}return ke<0?null:{index:ke,entries:me}}function Ye(A){const{bound:Ae,xScale:pe,at:fe}=A;if(!Ae.categories.length)return-1;if(pe.kind==="band"){const ke=Math.floor((fe-pe.range[0])/(pe.step||1));return ke>=0&&ke<Ae.categories.length?ke:-1}let Ne=-1,me=1/0;for(let ke=0;ke<Ae.categories.length;ke++){const Le=pe.kind==="time"?L(Ae.categories[ke]):E(Ae.categories[ke]);if(Le===null)continue;const we=Math.abs(pe.of(Le)-fe);we<me&&(me=we,Ne=ke)}return Ne}function qe(A,Ae){return Ae<0||Ae>=A.categories.length?"":S(A.categories[Ae])}}),Xe("packages/modules/charts/drawable.js",function(a,V){"use strict";Object.defineProperty(a,"REASONS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(a,"DRAWABLE",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"namedColumns",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(a,"missingColumns",{enumerable:!0,get:function(){return N}}),Object.defineProperty(a,"bucketKey",{enumerable:!0,get:function(){return d}}),Object.defineProperty(a,"bucketMessage",{enumerable:!0,get:function(){return D}}),Object.defineProperty(a,"continuousX",{enumerable:!0,get:function(){return z}}),Object.defineProperty(a,"drawability",{enumerable:!0,get:function(){return x}});const ve=V("packages/modules/charts/scale.js"),ee=ve.extent,M=ve.toNumber,de=ve.toTime,Y=V("packages/modules/charts/cartesian.js").staleWindow,X=Object.freeze({EMPTY:"empty",INCOMPLETE:"incomplete",STALE:"stale",MISSING_COLUMN:"missing-column",NO_DOMAIN:"no-domain",BUCKETED:"bucketed"}),U=Object.freeze({ok:!0});function ae(B){if(!B||typeof B!="object")return[];const Q=[],F=(I,ne)=>{typeof ne=="string"&&ne?Q.push({key:I,col:ne}):ne&&typeof ne=="object"&&typeof ne.col=="string"&&ne.col&&Q.push({key:I,col:ne.col})};if(Array.isArray(B.points))return[];if(F("x",B.x),F("code",B.code),F("y",B.y),F("series",B.series),F("size",B.size),F("source",B.source),F("target",B.target),typeof B.multiples=="string"&&F("multiples",B.multiples),Array.isArray(B.measures))for(const I of B.measures)F("measures",I);return Q}function N(B,Q){const F=B&&B.columns;return!F||typeof F.get!="function"?[]:ae(Q).filter(({col:I})=>!F.get(I))}function d(B){return`chart:x:date-bucket:${B}`}function D(B,Q,F){return`chart x column ${JSON.stringify(B)} is a 'date', which stores a calendar day, so all ${Q} rows collapsed into one point and were reduced by '${F}'. For a series inside a single day, type the column 'datetime' or bind epoch milliseconds.`}function z(B,Q){return!Q||Q.kind!=="time"&&Q.kind!=="linear"?!1:B!=="bar"&&B!=="horizontalBar"}function x(B){const{grid:Q,spec:F,type:I,bound:ne}=B,S=B.id===void 0?"":String(B.id),Z=Number.isFinite(B.now)?Number(B.now):Date.now(),te=(L,se,R,$=!0)=>({ok:!1,reason:L,key:R||`chart:${S}:${L}`,message:se,tell:$}),q=N(Q,F);if(q.length){const L=q.map(R=>`${R.key}: ${JSON.stringify(R.col)}`).join(", "),se=Q&&Q.columns&&typeof Q.columns.all=="function"?Q.columns.all().map(R=>R.id||R.field).filter(Boolean):[];return te(X.MISSING_COLUMN,`chart ${L} ${q.length>1?"name columns":"names a column"} this grid does not have, so there is nothing to read and nothing to draw.${se.length?` The columns it does have: ${se.slice(0,12).map(R=>JSON.stringify(R)).join(", ")}${se.length>12?", …":""}.`:""} Bind a column the grid declares, or declare the column.`)}if(ne&&ne.empty){const L=Q&&Q.rows&&typeof Q.rows.count=="function"?Q.rows.count():0;return te(X.EMPTY,L?`chart bound nothing from the ${L} 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,L>0)}if(I==="candlestick"&&(!ne||!ne.series||ne.series.length<4)){const L=ne&&ne.series?ne.series.length:0;return te(X.INCOMPLETE,`a candlestick chart needs four measures — open, high, low and close, in that order — and ${L===0?"none was":`only ${L} were`} bound. Pass them as measures: [open, high, low, close].`)}const E=Y(ne,B.axis&&B.axis.x,I,Z);if(E){const L=E.newest===null?"and every one of them is stamped ahead of it":`and the newest of ${E.points} x value(s) is ${Math.round(E.age/1e3)}s old`;return te(X.STALE,`the rolling x window covers the last ${E.span} ms, ${L}, 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:${S}:x:window:stale:${F&&F.x||""}`,E.newest!==null)}if(z(I,ne)){const L=Array.isArray(ne.categories)?ne.categories:[],se=ne.kind==="time"?L.map(de):L.map(M);if(L.length&&!ee(se)){const R=F&&typeof F.x=="string"&&F.x||ne.dimension&&ne.dimension.col||"";return te(X.NO_DOMAIN,`chart x ${R?`column ${JSON.stringify(R)} `:""}is drawn on a ${ne.kind==="time"?"time":"continuous"} axis, and not one of its ${L.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&&z(I,ne)){const{col:L,rows:se,fn:R}=ne.bucketed;return te(X.BUCKETED,D(L,se,R),d(L))}return U}}),Xe("packages/modules/charts/bind.js",function(a,V){"use strict";Object.defineProperty(a,"AGGREGATIONS",{enumerable:!0,get:function(){return N}}),Object.defineProperty(a,"DEFAULT_AGGREGATION",{enumerable:!0,get:function(){return d}}),Object.defineProperty(a,"resolveAggregation",{enumerable:!0,get:function(){return D}}),Object.defineProperty(a,"defaultAggregationFor",{enumerable:!0,get:function(){return z}}),Object.defineProperty(a,"measureOf",{enumerable:!0,get:function(){return x}}),Object.defineProperty(a,"walkRows",{enumerable:!0,get:function(){return B}}),Object.defineProperty(a,"leafRows",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(a,"selectedRows",{enumerable:!0,get:function(){return F}}),Object.defineProperty(a,"topGroups",{enumerable:!0,get:function(){return I}}),Object.defineProperty(a,"forcedScaleKind",{enumerable:!0,get:function(){return L}}),Object.defineProperty(a,"scaleKindFor",{enumerable:!0,get:function(){return R}}),Object.defineProperty(a,"bindSeries",{enumerable:!0,get:function(){return $}}),Object.defineProperty(a,"bindPoints",{enumerable:!0,get:function(){return he}}),Object.defineProperty(a,"bindMeasures",{enumerable:!0,get:function(){return f}}),Object.defineProperty(a,"bindLinks",{enumerable:!0,get:function(){return J}}),Object.defineProperty(a,"bindHierarchy",{enumerable:!0,get:function(){return H}});const ve=V("packages/modules/charts/scale.js"),ee=ve.key,M=ve.toNumber,de=ve.toTime,ce=V("packages/modules/charts/drawable.js"),Y=ce.bucketKey,X=ce.bucketMessage,ae=V("packages/core/src/internal/util.js").warnOnce,N={sum:e=>e.length?e.reduce((u,k)=>u+k,0):null,avg:e=>e.length?e.reduce((u,k)=>u+k,0)/e.length:null,mean:e=>e.length?e.reduce((u,k)=>u+k,0)/e.length:null,min:e=>{let u=null;for(let k=0;k<e.length;k++)(u===null||e[k]<u)&&(u=e[k]);return u},max:e=>{let u=null;for(let k=0;k<e.length;k++)(u===null||e[k]>u)&&(u=e[k]);return u},median:e=>{if(!e.length)return null;const u=e.slice().sort((p,l)=>p-l),k=(u.length-1)/2,o=Math.floor(k),w=Math.ceil(k);return o===w?u[o]:(u[o]+u[w])/2},count:(e,u)=>u,countValues:e=>e.length,first:e=>e.length?e[0]:null,last:e=>e.length?e[e.length-1]:null},d="sum";function D(e){return e==null?d:typeof e=="string"&&e in N?e:(ae(`chart:measure:fn:${String(e)}`,`chart measure fn ${JSON.stringify(e)} is not a known aggregation; using '${d}'. Supported: ${Object.keys(N).join(", ")}.`),d)}function z(e){if(!e)return d;const u=e.groupTotal??e.total;if(typeof u=="string"&&u in N)return u;const k=e.dataType&&e.dataType.totals?e.dataType.totals.supported:null;if(Array.isArray(k)&&!k.includes(d)){const o=["avg","mean","max","min","countValues","count"].find(w=>k.includes(w)&&w in N);if(o)return o}return d}function x(e,u){const k=z(u);return e?typeof e=="string"?{col:e,fn:k}:{col:e.col||null,fn:e.fn==null?k:D(e.fn)}:{col:null,fn:k}}function B(e,u){const k=new Set,o=w=>{if(!w||k.has(w)||(k.add(w),u(w),!w.group)||w.expanded)return;const p=w.filteredChildren||w.children;if(Array.isArray(p))for(const l of p)o(l)};e.rows.forEach(o)}function Q(e){const u=[];return B(e,k=>{!k.group&&k.data!==null&&k.data!==void 0&&u.push(k)}),u}function F(e){const u=new Set(e.selection.keys());if(!u.size)return[];const k=[];return B(e,o=>{!o.group&&u.has(o.key)&&k.push(o)}),k}function I(e){const u=[];let k=1/0;return B(e,o=>{o.group&&(o.level<k&&(k=o.level,u.length=0),o.level===k&&u.push(o))}),u}function ne(e,u,k){return u.group&&u.totals&&k in u.totals?M(u.totals[k]):M(e.rows.value(u.key,k))}function S(e,u,k,o){if(!u.group){const w=e.rows.text(u.key,k);if(w)return w}return o==null?"":o instanceof Date?o.toISOString().slice(0,10):String(o)}function Z(e,u){return(N[u]||N[d])(e.values,e.rows)}const te=Object.freeze(["number","currency","percent"]),q=Object.freeze(["date","datetime","timestamp","dateString"]),E=Object.freeze({auto:"",band:"category",category:"category",linear:"linear",time:"time"});function L(e){const u=e&&typeof e=="object"?e.axis:null;if(!u||typeof u!="object")return"";const k=u.x;if(!k||typeof k!="object")return"";const o=typeof k.scale=="string"?k.scale:"";return o?Object.hasOwn(E,o)?E[o]:(ae(`chart:x:scale:unknown:${o}`,`chart axis.x.scale ${JSON.stringify(o)} is not a scale this chart draws. Use one of: ${Object.keys(E).join(", ")}. The scale was chosen from the column instead.`),""):""}function se(e){if(e.length<3)return"";let u=0,k=0;for(const o of e){if(o==null||o===""||typeof o=="boolean")return"";M(o)!==null?u++:typeof o=="string"&&de(o)!==null&&k++}return k===e.length?"time":u===e.length?"linear":""}function R(e,u,k={}){if(k.forced)return k.forced;const o=e&&typeof e.type=="string"?e.type:"";if(q.includes(o)||u.length&&u.every(l=>l instanceof Date))return"time";if(te.includes(o))return"linear";const w=k.id?String(k.id):"";if(!w)return"category";const p=o&&o!=="text"?"":se(u);return p&&ae(`chart:x:banded:${w}`,`chart x column ${JSON.stringify(w)} is typed ${JSON.stringify(o||"text")}, so its ${u.length} values are drawn as categories on a band scale even though they all read as ${p==="time"?"dates":"numbers"}. Type the column ${p==="time"?"'date' (or 'datetime'/'timestamp'/'dateString')":"'number'"} for a continuous axis, or pin it with axis: { x: { scale: '${p}' } }.`),"category"}function $(e,u){const k=u.x||null,o=u.series||(typeof u.multiples=="string"?u.multiples:null)||null,w=e.columns,p=k?w.get(k):void 0,l=x(u.y),v=l.col?w.get(l.col):void 0,r=x(u.y,v);let s;const b=typeof u.rows=="function"?u.rows(e):u.rows;Array.isArray(b)?s=b:u.from==="groups"?s=I(e):u.from==="selection"?s=F(e):s=Q(e);const t=s.length?s:Q(e),c=new Map,P=new Map,g=[];for(let C=0;C<t.length;C++){const O=t[C],W=k?O.group&&O.groupColumn===k?O.groupValue:e.rows.value(O.key,k):C,re=ee(W);c.has(re)||(c.set(re,{value:W,label:k?S(e,O,k,W):String(C),order:c.size}),g.push(W));const _=o?O.group&&O.groupColumn===o?O.groupValue:e.rows.value(O.key,o):null,le=o?ee(_):"";P.has(le)||P.set(le,{label:o?S(e,O,o,_):v?.title||"",points:new Map});const ue=P.get(le);let ge=ue.points.get(re);ge||(ge={values:[],rows:0,rowKey:O.key},ue.points.set(re,ge)),ge.rows+=O.group&&O.leafCount||1;const ye=r.col?ne(e,O,r.col):null;if(ye!==null&&ge.values.push(ye),u.size){const be=M(e.rows.value(O.key,u.size));be!==null&&(ge.sizes=(ge.sizes||0)+be)}}const y=[...c.values()].sort((C,O)=>C.order-O.order),j=typeof u.limit=="number"&&u.limit>0?y.slice(0,u.limit):y,h=R(p,g,{forced:L(u),id:k});let i=null;h==="time"&&t.length>1&&c.size===1&&p&&(p.type==="date"||p.type==="dateString")&&(i={col:String(k),rows:t.length,fn:r.fn},ae(Y(i.col),X(i.col,i.rows,i.fn)));const m=te.includes(p&&typeof p.type=="string"?p.type:"")?[...j].sort((C,O)=>(M(C.value)??0)-(M(O.value)??0)):j,G=[...P.entries()].map(([C,O],W)=>({key:C,label:O.label,index:W,points:m.map(re=>{const _=ee(re.value),le=O.points.get(_);return{x:re.value,xKey:_,label:re.label,y:le?Z(le,r.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:G,categories:m.map(C=>C.value),labels:m.map(C=>C.label),kind:h,measure:{...r,title:v?.title||r.col||""},dimension:{col:k,title:p?.title||k||""},empty:G.length===0||m.length===0,rows:t.length,truncated:y.length-m.length,bucketed:i}}function he(e){const u=Array.isArray(e.points)?e.points:[],k=u.length>0&&u.every(p=>typeof p.x=="number"&&Number.isFinite(p.x)),o=p=>typeof p=="number"&&Number.isFinite(p)?p:null,w=u.map((p,l)=>({x:p.x,xKey:ee(p.x),label:p.label!=null?String(p.label):String(p.x),y:o(p.y),size:o(p.size),lower:o(p.lower),upper:o(p.upper),rows:1,rowKey:p.key!=null?String(p.key):String(l),values:null}));return{series:[{key:e.seriesKey||"",label:e.seriesLabel||"",index:0,points:w}],categories:w.map(p=>p.x),labels:w.map(p=>p.label),kind:k?"linear":"category",measure:{col:null,fn:"sum",title:e.measureTitle||""},dimension:{col:null,title:e.dimensionTitle||""},empty:w.length===0,rows:w.length,truncated:0}}function f(e,u){const k=Array.isArray(u.measures)?u.measures:[];if(!k.length)return $(e,u);const o=k.map(v=>{const r=typeof v=="string"?{col:v}:v;return{spec:r,result:$(e,{x:u.x,from:u.from,limit:u.limit,axis:u.axis,y:{col:r.col,fn:r.fn}})}}),w=o[0].result,p=new Map(w.categories.map((v,r)=>[ee(v),r])),l=o.map(({spec:v,result:r},s)=>{const b=e.columns.get(v.col),t=w.categories.map(()=>null),c=r.series[0];if(c)for(const P of c.points){const g=p.get(P.xKey);g!==void 0&&(t[g]=P)}return{key:v.col,label:v.title||v.label||b&&b.title||v.col,index:s,mark:v.type||null,axis:v.axis==="right"?"right":"left",points:w.categories.map((P,g)=>t[g]||{x:P,xKey:ee(P),label:w.labels[g],y:null,rows:0,rowKey:null})}});return{series:l,categories:w.categories,labels:w.labels,kind:w.kind,measure:{col:null,fn:"sum",title:l.map(v=>v.label).join(", ")},dimension:w.dimension,empty:!l.length||!w.categories.length,rows:w.rows,truncated:w.truncated}}function J(e,u,k={}){const o=x(u.y),w=!!k.perRow,p=Array.isArray(k.nodes)?k.nodes:[],l=u.source||u.x||null,v=u.target||null;if(!l||!v)return{nodes:[],links:[],measure:{...o,title:""},dimension:{col:null,title:""},series:[],categories:[],labels:[],empty:!0,total:0};const r=o.col?e.columns.get(o.col):void 0,s=new Map,b=new Map,t=(y,j,h)=>{const i=ee(y);return s.has(i)||s.set(i,{key:i,value:y,label:S(e,j,h,y),index:s.size,in:0,out:0}),s.get(i)},c=new Map;for(const y of p)!y||y.id===null||y.id===void 0||c.set(ee(y.id),y);for(const y of Q(e)){const j=e.rows.value(y.key,l),h=e.rows.value(y.key,v);if(j==null||h===null||h===void 0)continue;const i=o.col?M(e.rows.value(y.key,o.col)):1;if(i===null||i<=0)continue;const n=t(j,y,l),m=t(h,y,v);if(w){const G=n.key>m.key,C=G?m:n,O=G?n:m;b.set(`${C.key}\0${O.key}\0${b.size}`,{source:C,target:O,value:i,undirected:!0,pair:`${C.key}\0${O.key}`,rowKeys:[y.key]})}else{const G=`${n.key}\0${m.key}`,C=b.get(G)||{source:n,target:m,value:0,rowKeys:[]};C.value+=i,C.rowKeys.length<64&&C.rowKeys.push(y.key),b.set(G,C)}n.out+=i,m.in+=i}for(const[y,j]of c)s.has(y)||s.set(y,{key:y,value:j.id,label:String(j.label??j.id),index:s.size,in:0,out:0});for(const[y,j]of c){const h=s.get(y);h&&(h.declared=!0,j.label!==void 0&&j.label!==null&&(h.label=String(j.label)),typeof j.icon=="string"&&j.icon&&(h.icon=j.icon),Number.isFinite(j.x)&&Number.isFinite(j.y)&&(h.fx=Number(j.x),h.fy=Number(j.y)))}const P=w?[...b.values()]:[...b.values()].sort((y,j)=>j.value-y.value),g=typeof u.limit=="number"&&u.limit>0?P.slice(0,u.limit):P;return{nodes:[...s.values()],links:g,measure:{...o,title:r?.title||o.col||""},dimension:{col:l,title:e.columns.get(l)?.title||l},series:[],categories:[],labels:[],empty:!g.length,total:g.reduce((y,j)=>y+j.value,0)}}function H(e,u){const k=x(u.y),o=typeof u.depth=="number"&&u.depth>0?u.depth:1/0,w=k.col?e.columns.get(k.col):void 0,p=(b,t,c)=>({label:b,value:t,depth:c,total:0,children:[],rowKey:null}),l=p("",null,0),v=I(e);if(v.length){const b=(t,c,P)=>{const g=t.groupColumn?S(e,t,t.groupColumn,t.groupValue):"",y=p(g,t.groupValue,P);y.rowKey=t.key;const j=k.col?ne(e,t,k.col):null;y.total=j===null?0:Math.abs(j),c.children.push(y);const h=t.filteredChildren||t.children;if(P<o&&Array.isArray(h))for(const i of h)i.group&&b(i,y,P+1);return!y.total&&y.children.length&&(y.total=y.children.reduce((i,n)=>i+n.total,0)),y};for(const t of v)b(t,l,1)}else{const t=$(e,{x:u.x,y:u.y,limit:u.limit}).series[0];if(t)for(const c of t.points){const P=p(c.label,c.x,1);P.total=c.y===null?0:Math.abs(c.y),P.rowKey=c.rowKey,l.children.push(P)}}l.total=l.children.reduce((b,t)=>b+t.total,0);let r=0;const s=b=>{b.depth>r&&(r=b.depth);for(const t of b.children)s(t)};return s(l),{root:l,depth:r,measure:{...k,title:w?.title||k.col||""},empty:l.total<=0||l.children.length===0}}}),Xe("packages/modules/charts/radial.js",function(a,V){"use strict";Object.defineProperty(a,"horizontalRoom",{enumerable:!0,get:function(){return u}}),Object.defineProperty(a,"arcPath",{enumerable:!0,get:function(){return k}}),Object.defineProperty(a,"layoutRings",{enumerable:!0,get:function(){return o}}),Object.defineProperty(a,"drawRadial",{enumerable:!0,get:function(){return w}}),Object.defineProperty(a,"arcAt",{enumerable:!0,get:function(){return p}});const ee=V("packages/modules/charts/frame.js").Pool,M=V("packages/modules/charts/svg.js"),de=M.attrs,ce=M.path,Y=M.round,X=M.setText,ae=V("packages/modules/charts/styles.js").NS,d=V("packages/modules/charts/scheme.js").resolveScheme,D=V("packages/modules/charts/labels.js"),z=D.drawAnchoredLabels,x=D.labelText,B=V("packages/modules/charts/typography.js"),Q=B.applySize,F=B.textWidth,I=B.truncateTo,S=V("packages/modules/charts/format.js").measureFormat,Z=Math.PI*2,te=-Math.PI/2,q=.25,E=2,L=3,se=.58,R=8,$=2;function he(l,v,r,s){return l==="total"?S(v,r,s):typeof l=="number"?S(l,r,s):l==null?"":String(l)}function f(l,v,r){if(!l||r<=0)return R;let s=v;for(;s>R&&F(l,s)>r;)s-=1;return Math.max(R,s)}function J(l,v,r,s){const b=r*Math.SQRT2-4;if(b<=0||!l&&!v)return null;let t=f(l,Math.min(b,s*(v?1.6:2.2)),b),c=v?f(v,Math.min(b,t*.55),b):0;const P=v?$:0;for(;t+P+c>b&&(t>R||c>R);)t>R&&(t-=1),v&&c>R&&(c-=1);const g=F(l,t)>b?I(l,b,t):l,y=v&&F(v,c)>b?I(v,b,c):v;return{value:g,valueSize:t,label:y||"",labelSize:c,gap:P,height:t+P+c}}function H(l,v){const{cx:r,cy:s,hole:b,centre:t,total:c,column:P,grid:g,baseSize:y}=v,j=he(t.value,c,P,g),h=t.label?String(t.label):"",i=J(j,h,b,y);if(!i)return;const n=i.label?s-i.height/2+i.valueSize/2:s;if(i.value){const m=l.next("text",`${ae}__donut-centre-value`);de(m,{x:Y(r),y:Y(n),"dominant-baseline":"middle"}),Q(m,i.valueSize),X(m,i.value)}if(i.label){const m=l.next("text",`${ae}__donut-centre-label`);de(m,{x:Y(r),y:Y(n+i.valueSize/2+i.gap+i.labelSize/2),"dominant-baseline":"middle"}),Q(m,i.labelSize),X(m,i.label)}}function e(l,v,r,s){return[l+r*Math.cos(s),v+r*Math.sin(s)]}function u(l,v,r){const{inner:s,outer:b,from:t,to:c}=l;if(r*r>=b*b)return 0;const P=Math.sqrt(b*b-r*r);let g=v+P,y=P-v;if(s>0&&r*r<s*s){const j=Math.sqrt(s*s-r*r);if(v>=j)g=Math.min(g,v-j);else if(v<=-j)y=Math.min(y,-j-v);else return 0}if(c-t<Z-1e-9)for(const j of[t,c]){const h=Math.sin(j);if(Math.abs(h)<1e-9)continue;const i=r/h;if(i<=0)continue;const n=i*Math.cos(j);n>=v?y=Math.min(y,n-v):g=Math.min(g,v-n)}return Math.max(0,g)+Math.max(0,y)}function k(l){const{cx:v,cy:r,inner:s,outer:b}=l,t=l.to-l.from;if(t<=0)return"";if(t>=Z-1e-9){const[i,n]=e(v,r,b,l.from),[m,G]=e(v,r,b,l.from+Math.PI),C=["M",Y(i),Y(n),"A",Y(b),Y(b),0,1,1,Y(m),Y(G),"A",Y(b),Y(b),0,1,1,Y(i),Y(n)];if(s>0){const[O,W]=e(v,r,s,l.from),[re,_]=e(v,r,s,l.from+Math.PI);C.push("M",Y(O),Y(W),"A",Y(s),Y(s),0,1,0,Y(re),Y(_),"A",Y(s),Y(s),0,1,0,Y(O),Y(W))}return ce(C)}const c=t>Math.PI?1:0,[P,g]=e(v,r,b,l.from),[y,j]=e(v,r,b,l.to),h=["M",Y(P),Y(g),"A",Y(b),Y(b),0,c,1,Y(y),Y(j)];if(s>0){const[i,n]=e(v,r,s,l.to),[m,G]=e(v,r,s,l.from);h.push("L",Y(i),Y(n)),h.push("A",Y(s),Y(s),0,c,0,Y(m),Y(G))}else h.push("L",Y(v),Y(r));return h.push("Z"),ce(h)}function o(l){const v=[],r=(s,b,t,c,P,g)=>{if(c>0&&v.push({node:s,from:b,to:t,depth:c,index:P,label:s.label,total:s.total,path:g}),c>=l.maxRings||!s.children.length)return;const y=s.children.reduce((i,n)=>i+n.total,0),j=t-b;if(y<=0||j<=0)return;let h=b;for(let i=0;i<s.children.length;i++){const n=s.children[i],m=n.total/y*j;r(n,h,h+m,c+1,c===0?i:P,[...g,n.label]),h+=m}};return r(l.root,te,te+Z,0,0,[]),v}function w(l){const v=l.scheme||d(),{plot:r,tree:s,type:b}=l,t=r.left+r.width/2,c=r.top+r.height/2,P=Math.max(0,Math.min(r.width,r.height)/2-2),g=b==="sunburst"?Math.max(1,s.depth):1,y=o({root:s.root,depth:s.depth,maxRings:g}).filter(O=>!l.hidden.has(O.label)),j=b==="donut"?P*se:0,h=g>0?(P-j)/g:P;new ee(l.groups.grid).finish(),new ee(l.groups.axis).finish(),new ee(l.groups.rules).finish(),new ee(l.groups.labels).finish();const i=s.root.children.map(O=>O.label),n=new ee(l.groups.marks);for(const O of y){const W=j+(O.depth-1)*h,re=W+h,_=n.next("path",`${ae}__slice ${ae}__mark`);de(_,{d:k({cx:t,cy:c,inner:W,outer:re,from:O.from,to:O.to}),fill:v.series(O.index,i[O.index]),"fill-opacity":O.depth>1?Math.max(.45,1-(O.depth-1)*.22):1,"data-arc":y.indexOf(O)}),O.geometry={cx:t,cy:c,inner:W,outer:re}}n.finish();const m=l.typography&&l.typography.small||l.fontSize||11,G=!(l.labels&&l.labels.names===!1),C=new ee(l.groups.overlay);if(G)for(const O of y){if(O.to-O.from<q||O.geometry.outer-O.geometry.inner<m+E*2)continue;const W=(O.from+O.to)/2,re=O.geometry.inner+(O.geometry.outer-O.geometry.inner)/2;if((O.to-O.from)*re<m+E*2)continue;const[_,le]=e(t,c,re,W),{inner:ue,outer:ge}=O.geometry,ye=u({inner:ue,outer:ge,from:O.from,to:O.to},_-t,le-c)-E*2,be=String(O.label===null||O.label===void 0?"":O.label),Me=I(be,ye,m);if(Me!==be&&Me.length<L)continue;const je=C.next("text",`${ae}__slice-label`);de(je,{x:Y(_),y:Y(le),"dominant-baseline":"middle"}),Q(je,m),X(je,Me)}if(b==="donut"&&l.centre&&j>0){const O=l.grid&&l.grid.columns&&s.measure&&s.measure.col?l.grid.columns.get(s.measure.col):null;H(C,{cx:t,cy:c,hole:j,centre:l.centre,total:y.filter(W=>W.depth===1).reduce((W,re)=>W+re.total,0),column:O,grid:l.grid,baseSize:m})}return C.finish(),l.labels&&l.labels.show&&z({group:l.groups.labels,size:m,minGap:l.labels.minGap,anchors:y.filter(O=>O.depth===1&&O.to-O.from>=q).map(O=>{const W=(O.from+O.to)/2,re=O.geometry.inner+(O.geometry.outer-O.geometry.inner)/2,[_,le]=e(t,c,re,W);return{x:Y(_),y:Y(le+m+1),text:x(O.total,l.labels,l.grid),inside:!0}})}),{arcs:y,centre:{x:t,y:c,r:P}}}function p(l){for(const v of l.arcs){const r=v.geometry;if(!r)continue;const s=l.x-r.cx,b=l.y-r.cy,t=Math.sqrt(s*s+b*b);if(t<r.inner||t>r.outer)continue;let c=Math.atan2(b,s);for(;c<te;)c+=Z;for(;c>=te+Z;)c-=Z;if(c>=v.from&&c<v.to)return v}return null}}),Xe("packages/modules/charts/distribution.js",function(a,V){"use strict";Object.defineProperty(a,"FENCE",{enumerable:!0,get:function(){return $}}),Object.defineProperty(a,"quantile",{enumerable:!0,get:function(){return f}}),Object.defineProperty(a,"summarise",{enumerable:!0,get:function(){return J}}),Object.defineProperty(a,"binEdge",{enumerable:!0,get:function(){return H}}),Object.defineProperty(a,"outsideDomain",{enumerable:!0,get:function(){return e}}),Object.defineProperty(a,"histogram",{enumerable:!0,get:function(){return u}}),Object.defineProperty(a,"readingsOf",{enumerable:!0,get:function(){return k}}),Object.defineProperty(a,"valuesByCategory",{enumerable:!0,get:function(){return o}}),Object.defineProperty(a,"allReadings",{enumerable:!0,get:function(){return w}}),Object.defineProperty(a,"distributionDomain",{enumerable:!0,get:function(){return p}}),Object.defineProperty(a,"density",{enumerable:!0,get:function(){return l}}),Object.defineProperty(a,"drawHistogram",{enumerable:!0,get:function(){return r}}),Object.defineProperty(a,"drawBoxPlot",{enumerable:!0,get:function(){return s}}),Object.defineProperty(a,"probit",{enumerable:!0,get:function(){return b}}),Object.defineProperty(a,"drawQQ",{enumerable:!0,get:function(){return t}}),Object.defineProperty(a,"drawEcdf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(a,"drawLorenz",{enumerable:!0,get:function(){return P}}),Object.defineProperty(a,"drawControl",{enumerable:!0,get:function(){return g}}),Object.defineProperty(a,"drawCapability",{enumerable:!0,get:function(){return y}}),Object.defineProperty(a,"drawMovingRange",{enumerable:!0,get:function(){return j}});const ee=V("packages/modules/charts/frame.js").Pool,M=V("packages/modules/charts/axis.js"),de=M.drawAxisLines,ce=M.drawCategoryAxis,Y=M.drawContinuousAxis,X=M.drawMeasureAxis,U=M.tickLabeller,N=V("packages/modules/charts/format.js").formatters,d=V("packages/modules/charts/scale.js"),D=d.bandScale,z=d.isNumber,x=d.linearScale,B=d.measureDomain,Q=d.niceStep,F=V("packages/modules/charts/svg.js"),I=F.attrs,ne=F.path,S=F.round,te=V("packages/modules/charts/styles.js").NS,E=V("packages/modules/charts/scheme.js").resolveScheme,L=V("packages/modules/charts/labels.js"),se=L.drawAnchoredLabels,R=L.labelText,$=1.5,he="–";function f(h,i){const n=h.length;if(!n)return NaN;if(n===1)return h[0];const m=(n-1)*Math.min(1,Math.max(0,i)),G=Math.floor(m),C=Math.ceil(m);return G===C?h[G]:h[G]+(m-G)*(h[C]-h[G])}function J(h){const i=h.filter(z).slice().sort((le,ue)=>le-ue);if(!i.length)return null;const n=f(i,.25),m=f(i,.5),G=f(i,.75),C=G-n,O=n-$*C,W=G+$*C;let re=i[0];for(const le of i)if(le>=O){re=le;break}let _=i[i.length-1];for(let le=i.length-1;le>=0;le--)if(i[le]<=W){_=i[le];break}return{min:i[0],q1:n,median:m,q3:G,max:i[i.length-1],low:re,high:_,outliers:i.filter(le=>le<O||le>W),count:i.length}}function H(h,i,n){const m=h+n*i;return Math.abs(m)<i/1e6?0:Number(m.toPrecision(12))}function e(h,i){const n=i||{},m=z(n.min),G=z(n.max);if(!m&&!G)return 0;let C=0;for(let O=0;O<h.length;O++){const W=h[O];z(W)&&(m&&W<n.min||G&&W>n.max)&&C++}return C}function u(h,i=12,n){const m=n||{},G=z(m.min),C=z(m.max);let O=1/0,W=-1/0,re=0;for(let be=0;be<h.length;be++){const Me=h[be];z(Me)&&(G&&Me<m.min||C&&Me>m.max||(Me<O&&(O=Me),Me>W&&(W=Me),re++))}if(!re)return[];if(G&&(O=Number(m.min)),C&&(W=Number(m.max)),O===W){const be=Math.abs(O)>0?Math.abs(O)/10:.5;O-=be,W+=be}const _=Q((W-O)/Math.max(1,i)),le=Math.floor(O/_)*_,ue=Math.ceil(W/_)*_,ge=[],ye=Math.max(1,Math.round((ue-le)/_));for(let be=0;be<ye;be++)ge.push({from:H(le,_,be),to:H(le,_,be+1),count:0});for(let be=0;be<h.length;be++){const Me=h[be];if(!z(Me)||G&&Me<m.min||C&&Me>m.max)continue;let je=Math.floor((Me-le)/_);je>=ge.length&&(je=ge.length-1),je<0&&(je=0),ge[je].count++}return ge}function k(h){if(!h)return[];if(Array.isArray(h.values)){const i=h.values.filter(z);if(i.length)return i}return z(h.y)?[h.y]:[]}function o(h){const i=new Map,n=!(h.dimension&&h.dimension.col),m=n&&h.measure&&h.measure.title||"";for(const G of h.series)for(const C of G.points){const O=k(C);if(!O.length)continue;const W=n?m:C.label;i.has(W)||i.set(W,[]);const re=i.get(W);for(const _ of O)re.push(_)}return i}function w(h){const i=[];for(const n of h.series||[])for(const m of n.points||[])for(const G of k(m))i.push(G);return i}function p(h,i){const n=i&&i.y||{};return B(h,{zero:!1,min:n.min,max:n.max})}function l(h,i,n){const m=h.length;if(!m)return[];const G=h.reduce((le,ue)=>le+ue,0)/m,C=h.reduce((le,ue)=>le+(ue-G)**2,0)/Math.max(1,m-1),O=Math.sqrt(C)||1,W=Math.max(1e-9,1.06*O*m**(-1/5)),re=[],_=i.max-i.min||1;for(let le=0;le<n;le++){const ue=i.min+_*le/(n-1||1);let ge=0;for(const ye of h){const be=(ue-ye)/W;ge+=Math.exp(-.5*be*be)}re.push({at:ue,density:ge/(m*W*Math.sqrt(Math.PI*2))})}return re}function v(h,i,n){const m=N(h.grid,{kind:"linear",step:n}),G=i.measure&&i.measure.col&&h.grid.columns?h.grid.columns.get(i.measure.col):null,O=!!(G&&G.format&&typeof G.formatValue=="function")?{tick:W=>String(G.formatValue(W,null))}:m;return U(h.axis&&h.axis.x||{},O,h.grid)}function r(h){const i=h.scheme||E(),{plot:n,bound:m}=h,G=w(m),C=h.axis&&h.axis.y||{},O=u(G,h.buckets||12,C),W=e(G,C),re=O.map(Oe=>Oe.count),_=B(re,{zero:!0}),le=x(_,[n.bottom,n.top]),ue=O.length?O[0].to-O[0].from:1,ge=v(h,m,ue),ye=O.map(Oe=>ge(Oe.from)),be=O.map(Oe=>`${ge(Oe.from)} ${he} ${ge(Oe.to)}`),Me=O.map((Oe,Pe)=>Pe),je=D(Me,[n.left,n.right],.08);X({gridGroup:h.groups.grid,axisGroup:h.groups.axis,plot:n,scale:le,format:N(h.grid,{kind:"linear",step:(_.max-_.min)/5})}),ce({group:h.groups.overlay,plot:n,scale:je,labels:ye,fontSize:h.fontSize,rotated:ye.length>8}),de({group:h.groups.rules,plot:n});const xe=new ee(h.groups.marks),$e=le.of(_.min<=0?0:_.min);if(O.forEach((Oe,Pe)=>{const De=le.of(Oe.count);I(xe.next("rect",`${te}__bar ${te}__mark`),{x:S(je.of(Pe)),y:S(Math.min(De,$e)),width:S(je.bandwidth),height:S(Math.max(Oe.count>0?1:0,Math.abs($e-De))),fill:i.series(0),"data-point":Pe})}),xe.finish(),h.curve&&G.length>1){const Oe={min:O[0].from,max:O[O.length-1].to},Pe=l(G,Oe,Math.max(24,O.length*4)),De=Pe.reduce((Ge,Ve)=>Math.max(Ge,Ve.density),0);if(De>0){const Ge=Oe.max-Oe.min||1,Ve=le.of(_.max),it=Pe.map(ft=>[S(n.left+(ft.at-Oe.min)/Ge*(n.right-n.left)),S($e-ft.density/De*($e-Ve))]),gt=new ee(h.groups.overlay);I(gt.next("path",`${te}__density ${te}__mark`),{d:ne(it.flatMap(([ft,xt],kt)=>[kt?"L":"M",ft,xt])),fill:"none",stroke:i.series(1)}),gt.finish()}}if(h.labels&&h.labels.show){const Oe=h.typography&&h.typography.small||h.fontSize||11;se({group:h.groups.labels,size:Oe,minGap:h.labels.minGap,plot:n,anchors:O.map((Pe,De)=>{const Ge=Math.min(le.of(Pe.count),$e),Ve=Ge-Oe/2-2,it=Ve<n.top;return{x:S(je.of(De)+je.bandwidth/2),y:S(it?Ge+Oe/2+2:Ve),text:Pe.count?R(Pe.count,h.labels,h.grid):"",inside:it,height:it?Math.abs($e-Ge)-2:void 0}})})}return{xScale:je,yScale:le,buckets:O,labels:be,categories:O.map(Oe=>Oe.from),outside:W,series:[{key:"",label:m.measure.title,index:0,points:O.map((Oe,Pe)=>({x:Pe,xKey:String(Pe),label:be[Pe],from:Oe.from,to:Oe.to,y:Oe.count,rows:Oe.count}))}]}}function s(h){const i=h.scheme||E(),{plot:n,bound:m}=h,G=o(m),C=[...G.keys()],O=C.map(ye=>J(G.get(ye))).filter(Boolean),W=[];for(const ye of O)W.push(ye.min,ye.max);const re=p(W,h.axis),_=x(re,[n.bottom,n.top]),le=D(C,[n.left,n.right],.4);X({gridGroup:h.groups.grid,axisGroup:h.groups.axis,plot:n,scale:_,format:N(h.grid,{kind:"linear",step:(re.max-re.min)/5})}),ce({group:h.groups.overlay,plot:n,scale:le,labels:C,fontSize:h.fontSize,rotated:C.length>6}),de({group:h.groups.rules,plot:n});const ue=new ee(h.groups.marks),ge=le.bandwidth;return C.forEach((ye,be)=>{const Me=O[be];if(!Me)return;const je=le.of(ye),xe=je+ge/2,$e=i.series(be);I(ue.next("rect",`${te}__box ${te}__mark`),{x:S(je),y:S(_.of(Me.q3)),width:S(ge),height:S(Math.max(1,_.of(Me.q1)-_.of(Me.q3))),fill:$e,"fill-opacity":.35,stroke:$e,"data-point":be}),I(ue.next("path",`${te}__whisker ${te}__mark`),{d:ne(["M",S(xe),S(_.of(Me.high)),"L",S(xe),S(_.of(Me.q3)),"M",S(xe),S(_.of(Me.q1)),"L",S(xe),S(_.of(Me.low)),"M",S(je+ge*.25),S(_.of(Me.high)),"L",S(je+ge*.75),S(_.of(Me.high)),"M",S(je+ge*.25),S(_.of(Me.low)),"L",S(je+ge*.75),S(_.of(Me.low))]),stroke:$e,fill:"none"}),I(ue.next("path",`${te}__median ${te}__mark`),{d:ne(["M",S(je),S(_.of(Me.median)),"L",S(je+ge),S(_.of(Me.median))]),stroke:$e,"stroke-width":2,fill:"none"});for(const Oe of Me.outliers)I(ue.next("circle",`${te}__point ${te}__mark`),{cx:S(xe),cy:S(_.of(Oe)),r:2.5,fill:$e,"fill-opacity":.8})}),ue.finish(),{xScale:le,yScale:_,boxes:O,series:[{key:"",label:m.measure.title,index:0,points:C.map((ye,be)=>({x:ye,xKey:ye,label:ye,y:O[be]?O[be].median:null,rows:O[be]?O[be].count:0}))}]}}function b(h){if(!(h>0&&h<1))return Number.NaN;const i=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],n=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],m=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],G=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],C=.02425;if(h<C){const re=Math.sqrt(-2*Math.log(h));return(((((m[0]*re+m[1])*re+m[2])*re+m[3])*re+m[4])*re+m[5])/((((G[0]*re+G[1])*re+G[2])*re+G[3])*re+1)}if(h>1-C){const re=Math.sqrt(-2*Math.log(1-h));return-(((((m[0]*re+m[1])*re+m[2])*re+m[3])*re+m[4])*re+m[5])/((((G[0]*re+G[1])*re+G[2])*re+G[3])*re+1)}const O=h-.5,W=O*O;return(((((i[0]*W+i[1])*W+i[2])*W+i[3])*W+i[4])*W+i[5])*O/(((((n[0]*W+n[1])*W+n[2])*W+n[3])*W+n[4])*W+1)}function t(h){const i=h.scheme||E(),{plot:n,bound:m}=h;new ee(h.groups.grid).finish(),new ee(h.groups.axis).finish(),new ee(h.groups.rules).finish(),new ee(h.groups.labels).finish();const G=w(m);if(G.length<3)return null;const C=G.slice().sort((De,Ge)=>De-Ge),O=C.length,W=C.map((De,Ge)=>b((Ge+1-.375)/(O+.25))),re=B(W,{zero:!1,nice:!0}),_=B(C,{zero:!1,nice:!0}),le=x(re,[n.left,n.right]),ue=x(_,[n.bottom,n.top]);X({gridGroup:h.groups.grid,axisGroup:h.groups.axis,plot:n,scale:ue,format:N(h.grid,{kind:"linear",step:(_.max-_.min)/5})}),Y({group:h.groups.overlay,plot:n,scale:le,fontSize:h.fontSize,format:N(h.grid,{kind:"linear",step:(re.max-re.min)/5})}),de({group:h.groups.rules,plot:n});const ge=f(C,.25),ye=f(C,.75),be=b(.25),Me=b(.75),je=(ye-ge)/(Me-be),xe=ge-je*be,$e=new ee(h.groups.rules);I($e.next("path",`${te}__qq-line`),{d:ne(["M",S(le.of(re.min)),S(ue.of(xe+je*re.min)),"L",S(le.of(re.max)),S(ue.of(xe+je*re.max))]),fill:"none"}),$e.finish();const Oe=new ee(h.groups.marks),Pe=[];for(let De=0;De<O;De++){const Ge=S(le.of(W[De])),Ve=S(ue.of(C[De]));I(Oe.next("circle",`${te}__point ${te}__mark`),{cx:Ge,cy:Ve,r:2.5,fill:i.series(0),"data-point":De}),Pe.push({x:Ge,y:Ve,theoretical:W[De],sample:C[De]})}return Oe.finish(),{points:Pe,line:{slope:je,intercept:xe}}}function c(h){const i=h.scheme||E(),{plot:n,bound:m}=h;new ee(h.groups.grid).finish(),new ee(h.groups.axis).finish(),new ee(h.groups.rules).finish(),new ee(h.groups.labels).finish();const G=w(m);if(!G.length)return null;const C=G.slice().sort((ye,be)=>ye-be),O=C.length,W=B(C,{zero:!1,nice:!0}),re=x(W,[n.left,n.right]),_=x({min:0,max:1},[n.bottom,n.top]);X({gridGroup:h.groups.grid,axisGroup:h.groups.axis,plot:n,scale:_,format:N(h.grid,{kind:"linear",step:.2})}),Y({group:h.groups.overlay,plot:n,scale:re,fontSize:h.fontSize,format:N(h.grid,{kind:"linear",step:(W.max-W.min)/5})}),de({group:h.groups.rules,plot:n});const le=["M",S(re.of(W.min)),S(_.of(0))],ue=[];for(let ye=0;ye<O;ye++){const be=S(re.of(C[ye])),Me=(ye+1)/O;le.push("L",be,S(_.of(ye/O)),"L",be,S(_.of(Me))),ue.push({value:C[ye],share:Me})}le.push("L",S(re.of(W.max)),S(_.of(1)));const ge=new ee(h.groups.marks);return I(ge.next("path",`${te}__ecdf ${te}__mark`),{d:ne(le),fill:"none",stroke:i.series(0)}),ge.finish(),{steps:ue}}function P(h){const i=h.scheme||E(),{plot:n,bound:m}=h;new ee(h.groups.grid).finish(),new ee(h.groups.axis).finish(),new ee(h.groups.rules).finish(),new ee(h.groups.labels).finish();const G=w(m).filter(xe=>xe>=0);if(!G.length)return null;const C=G.slice().sort((xe,$e)=>xe-$e),O=C.length,W=C.reduce((xe,$e)=>xe+$e,0);if(W<=0)return null;const re=x({min:0,max:1},[n.left,n.right]),_=x({min:0,max:1},[n.bottom,n.top]);X({gridGroup:h.groups.grid,axisGroup:h.groups.axis,plot:n,scale:_,format:N(h.grid,{kind:"linear",step:.2})}),Y({group:h.groups.overlay,plot:n,scale:re,fontSize:h.fontSize,format:N(h.grid,{kind:"linear",step:.2})}),de({group:h.groups.rules,plot:n});const le=new ee(h.groups.rules);I(le.next("path",`${te}__lorenz-equality`),{d:ne(["M",S(re.of(0)),S(_.of(0)),"L",S(re.of(1)),S(_.of(1))]),fill:"none"}),le.finish();const ue=["M",S(re.of(0)),S(_.of(0))],ge=[{rows:0,held:0}];let ye=0;for(let xe=0;xe<O;xe++){ye+=C[xe];const $e={rows:(xe+1)/O,held:ye/W};ue.push("L",S(re.of($e.rows)),S(_.of($e.held))),ge.push($e)}const be=new ee(h.groups.marks);I(be.next("path",`${te}__lorenz ${te}__mark`),{d:ne(ue),fill:"none",stroke:i.series(0)}),be.finish();let Me=0;for(let xe=0;xe<O;xe++)Me+=(xe+1)*C[xe];const je=2*Me/(O*W)-(O+1)/O;return{curve:ge,gini:je}}function g(h){const i=h.scheme||E(),{plot:n,bound:m}=h;new ee(h.groups.grid).finish(),new ee(h.groups.labels).finish();const G=[];for(const Pe of m.series)for(const De of Pe.points)z(De.y)&&G.push(De.y);if(G.length<2)return null;const C=h.capability||null,O=C&&C.limits?C.limits:null,W=[...G];O&&W.push(O.upper,O.lower),C&&(C.lower!==null&&W.push(C.lower),C.upper!==null&&W.push(C.upper));const re=B(W,{zero:!1,nice:!0}),_=x(re,[n.bottom,n.top]),le=G.length>1?(n.right-n.left)/(G.length-1):0;X({gridGroup:h.groups.grid,axisGroup:h.groups.axis,plot:n,scale:_,format:N(h.grid,{kind:"linear",step:(re.max-re.min)/5})}),de({group:h.groups.rules,plot:n});const ue=new ee(h.groups.overlay),ge=[],ye=(Pe,De,Ge,Ve="end")=>{!Number.isFinite(Pe)||Pe<re.min||Pe>re.max||(I(ue.next("path",De),{d:ne(["M",S(n.left),S(_.of(Pe)),"L",S(n.right),S(_.of(Pe))]),fill:"none"}),Ge&&ge.push({y:_.of(Pe),text:Ge,side:Ve}))};O&&(ye(O.centre,`${te}__control-centre`,"CL","end"),ye(O.upper,`${te}__control-limit`,"UCL","end"),ye(O.lower,`${te}__control-limit`,"LCL","end")),C&&(C.lower!==null&&ye(C.lower,`${te}__spec-limit`,"LSL","start"),C.upper!==null&&ye(C.upper,`${te}__spec-limit`,"USL","start"),C.target!==null&&ye(C.target,`${te}__spec-target`,"Target","start")),ue.finish();const be=new Map;for(const Pe of C&&C.violations?C.violations:[]){const De=be.get(Pe.index);De?De.includes(Pe.rule)||De.push(Pe.rule):be.set(Pe.index,[Pe.rule])}const Me=new Set(be.keys()),je=new ee(h.groups.marks),xe=[],$e=[];for(let Pe=0;Pe<G.length;Pe++){const De=S(n.left+Pe*le),Ge=S(_.of(G[Pe]));xe.push(Pe?"L":"M",De,Ge),$e.push({x:De,y:Ge,index:Pe,value:G[Pe],violating:Me.has(Pe)})}I(je.next("path",`${te}__control-line ${te}__mark`),{d:ne(xe),fill:"none",stroke:i.series(0)});for(const Pe of $e)I(je.next("circle",`${te}__point ${te}__mark`),{cx:Pe.x,cy:Pe.y,r:Pe.violating?4:2.5,fill:Pe.violating?"var(--lattice-danger, #a4262c)":i.series(0),"data-violation":Pe.violating?"true":null});je.finish();const Oe=[];for(const{y:Pe,text:De,side:Ge}of ge)Oe.push({x:Ge==="start"?n.left+2:n.right-2,y:Pe-3,text:De,anchor:Ge,className:`${te}__control-name`});for(const Pe of $e){const De=be.get(Pe.index);De&&Oe.push({x:Pe.x,y:Pe.y-7,text:De.sort((Ge,Ve)=>Ge-Ve).join(","),anchor:"middle",className:`${te}__control-rule`})}return se({group:h.groups.labels,anchors:Oe,size:9,grid:h.grid,minGap:1}),{points:$e,limits:O,ruleSet:C?C.ruleSet:null}}function y(h){const i=h.scheme||E(),{plot:n,bound:m}=h;new ee(h.groups.grid).finish();const G=[];for(const Oe of m.series)for(const Pe of Oe.points)z(Pe.y)&&G.push(Pe.y);if(G.length<2)return null;const C=h.capability||null,O=[...G];C&&(C.lower!==null&&O.push(C.lower),C.upper!==null&&O.push(C.upper),C.target!==null&&O.push(C.target));const W=B(O,{zero:!1,nice:!0}),re=x(W,[n.left,n.right]),_=u(G,h.buckets||14),le=_.map(Oe=>Oe.count),ue=B(le,{zero:!0}),ge=x(ue,[n.bottom,n.top]);X({gridGroup:h.groups.grid,axisGroup:h.groups.axis,plot:n,scale:ge,format:N(h.grid,{kind:"linear",step:(ue.max-ue.min)/5})}),Y({group:h.groups.overlay,plot:n,scale:re,fontSize:h.fontSize,format:N(h.grid,{kind:"linear",step:(W.max-W.min)/5})}),de({group:h.groups.rules,plot:n});const ye=ge.of(0),be=new ee(h.groups.marks);for(let Oe=0;Oe<_.length;Oe++){const Pe=_[Oe],De=re.of(Pe.from),Ge=re.of(Pe.to),Ve=ge.of(Pe.count);I(be.next("rect",`${te}__bar ${te}__mark`),{x:S(Math.min(De,Ge)),y:S(Math.min(Ve,ye)),width:S(Math.max(1,Math.abs(Ge-De)-1)),height:S(Math.max(Pe.count>0?1:0,Math.abs(ye-Ve))),fill:i.series(0),"data-point":Oe})}be.finish();const Me=new ee(h.groups.overlay),je=[];if(C&&Number.isFinite(C.mean)){const Pe=it=>{if(!Number.isFinite(it)||it<=0)return null;const gt=[];for(let ft=0;ft<=96;ft++){const xt=W.min+(W.max-W.min)*ft/96,kt=(xt-C.mean)/it;gt.push({at:xt,y:Math.exp(-.5*kt*kt)/it})}return gt},De=Pe(C.sigmaWithin),Ge=Pe(C.sigmaOverall);let Ve=0;for(const it of[De,Ge])if(it)for(const gt of it)Ve=Math.max(Ve,gt.y);if(Ve>0){const it=ge.of(ue.max),gt=(ft,xt,kt)=>{if(!ft)return;const _t=ft.flatMap((Pt,Nt)=>[Nt?"L":"M",S(re.of(Pt.at)),S(ye-Pt.y/Ve*(ye-it))]);I(Me.next("path",`${xt} ${te}__mark`),{d:ne(_t),fill:"none"}),je.push(kt)};gt(De,`${te}__capability-within`,"within"),gt(Ge,`${te}__capability-overall`,"overall")}}const xe=[],$e=(Oe,Pe,De)=>{if(Oe===null||!Number.isFinite(Oe)||Oe<W.min||Oe>W.max)return;const Ge=S(re.of(Oe));I(Me.next("path",Pe),{d:ne(["M",Ge,S(n.top),"L",Ge,S(n.bottom)]),fill:"none"}),xe.push({x:Ge,text:De})};return C&&($e(C.lower,`${te}__spec-limit`,"LSL"),$e(C.upper,`${te}__spec-limit`,"USL"),$e(C.target,`${te}__spec-target`,"Target")),Me.finish(),se({group:h.groups.labels,anchors:xe.map(({x:Oe,text:Pe})=>({x:Oe,y:n.top+6,text:Pe,anchor:"middle",className:`${te}__control-name`})),size:9,grid:h.grid,minGap:1}),{buckets:_,capability:C,curves:je}}function j(h){const i=h.scheme||E(),{plot:n,bound:m}=h;new ee(h.groups.grid).finish();const G=[];for(const xe of m.series)for(const $e of xe.points)z($e.y)&&G.push($e.y);if(G.length<3)return null;const C=[];for(let xe=1;xe<G.length;xe++)C.push(Math.abs(G[xe]-G[xe-1]));const O=C.reduce((xe,$e)=>xe+$e,0)/C.length,W=3.267*O,re=B([...C,0,W],{zero:!0,nice:!0}),_=x(re,[n.bottom,n.top]),le=C.length>1?(n.right-n.left)/(C.length-1):0;X({gridGroup:h.groups.grid,axisGroup:h.groups.axis,plot:n,scale:_,format:N(h.grid,{kind:"linear",step:(re.max-re.min)/5})}),de({group:h.groups.rules,plot:n});const ue=new ee(h.groups.overlay),ge=[],ye=(xe,$e,Oe)=>{!Number.isFinite(xe)||xe<re.min||xe>re.max||(I(ue.next("path",$e),{d:ne(["M",S(n.left),S(_.of(xe)),"L",S(n.right),S(_.of(xe))]),fill:"none"}),ge.push({y:_.of(xe),text:Oe}))};ye(O,`${te}__control-centre`,"MR"),ye(W,`${te}__control-limit`,"UCL"),ue.finish();const be=new ee(h.groups.marks),Me=[],je=[];for(let xe=0;xe<C.length;xe++){const $e=S(n.left+xe*le),Oe=S(_.of(C[xe]));Me.push(xe?"L":"M",$e,Oe),je.push({x:$e,y:Oe,index:xe,value:C[xe],violating:C[xe]>W})}I(be.next("path",`${te}__control-line ${te}__mark`),{d:ne(Me),fill:"none",stroke:i.series(0)});for(const xe of je)I(be.next("circle",`${te}__point ${te}__mark`),{cx:xe.x,cy:xe.y,r:xe.violating?4:2.5,fill:xe.violating?"var(--lattice-danger, #a4262c)":i.series(0),"data-violation":xe.violating?"true":null});return be.finish(),se({group:h.groups.labels,anchors:ge.map(({y:xe,text:$e})=>({x:n.right-2,y:xe-3,text:$e,anchor:"end",className:`${te}__control-name`})),size:9,grid:h.grid,minGap:1}),{points:je,centre:O,upper:W}}}),Xe("packages/modules/charts/treemap.js",function(a,V){"use strict";Object.defineProperty(a,"squarify",{enumerable:!0,get:function(){return se}}),Object.defineProperty(a,"layoutTree",{enumerable:!0,get:function(){return R}}),Object.defineProperty(a,"drawTreemap",{enumerable:!0,get:function(){return $}}),Object.defineProperty(a,"tileAt",{enumerable:!0,get:function(){return he}});const ee=V("packages/modules/charts/frame.js").Pool,M=V("packages/modules/charts/svg.js"),de=M.attrs,ce=M.round,Y=M.setText,U=V("packages/modules/charts/styles.js").NS,N=V("packages/modules/charts/scheme.js").resolveScheme,d=V("packages/modules/charts/labels.js"),D=d.drawAnchoredLabels,z=d.labelText,x=V("packages/modules/charts/typography.js"),B=x.applySize,Q=x.truncateTo,F=34,I=6,ne=3,S=3,Z=.28;function te(f){return f*1.6}function q(f){return Math.round(f*1.6)}function E(f){return f>1?Math.max(.45,1-(f-1)*.22):1}function L(f,J,H){if(!f.length||J<=0||H<=0)return 1/0;const e=Math.max(...f),u=Math.min(...f),k=J*J,o=H*H;return Math.max(k*e/o,o/(k*u))}function se(f,J){const H=[],e=f.filter(r=>r.value>0),u=e.reduce((r,s)=>r+s.value,0);if(!e.length||u<=0||J.width<=0||J.height<=0)return H;const k=e.slice().sort((r,s)=>s.value-r.value),o=J.width*J.height/u;let w={...J},p=[],l=[];const v=()=>{if(!p.length)return;const r=Math.min(w.width,w.height),b=l.reduce((c,P)=>c+P,0)/r;let t=0;for(let c=0;c<p.length;c++){const P=l[c]/b;H.push(w.width>=w.height?{item:p[c],x:w.x,y:w.y+t,width:b,height:P}:{item:p[c],x:w.x+t,y:w.y,width:P,height:b}),t+=P}w.width>=w.height?w={x:w.x+b,y:w.y,width:w.width-b,height:w.height}:w={x:w.x,y:w.y+b,width:w.width,height:w.height-b},p=[],l=[]};for(const r of k){const s=r.value*o,b=Math.min(w.width,w.height),t=L(l,b,l.reduce((P,g)=>P+g,0)),c=L([...l,s],b,l.reduce((P,g)=>P+g,0)+s);p.length&&c>t&&v(),p.push(r),l.push(r.value*o)}return v(),H}function R(f){const{plot:J,tree:H}=f,e=te(f.fontSize),u=q(f.fontSize),k=[],o=(w,p,l,v,r)=>{const s=w.children.filter(b=>l>0||!f.hidden.has(b.label)).map((b,t)=>({node:b,value:b.total,index:l===0?t:v}));for(const b of se(s,p)){if(l>0&&(b.width<e||b.height<e))continue;const t={...b,depth:l+1,path:[...r,b.item.node.label],children:!1};k.push(t);const c={x:t.x+S,y:t.y+u,width:t.width-S*2,height:t.height-u-S};if(b.item.node.children.length&&c.width>=e&&c.height>=e){const P=k.length;o(b.item.node,c,l+1,t.item.index,t.path),t.children=k.length>P}}};return o(H.root,{x:J.left,y:J.top,width:J.width,height:J.height},0,0,[]),k}function $(f){const J=f.scheme||N();new ee(f.groups.grid).finish(),new ee(f.groups.axis).finish(),new ee(f.groups.rules).finish(),new ee(f.groups.labels).finish();const H=R(f),e=f.typography&&f.typography.small||f.fontSize||11,u=new ee(f.groups.marks);for(const o of H)de(u.next("rect",`${U}__tile ${U}__mark${o.children?` ${U}__tile--branch`:""}`),{x:ce(o.x),y:ce(o.y),width:ce(Math.max(0,o.width)),height:ce(Math.max(0,o.height)),fill:J.series(o.item.index),"fill-opacity":o.children?Z:E(o.depth),"data-point":o.item.index,"data-depth":o.depth});u.finish();const k=new ee(f.groups.overlay);for(const o of H){if(o.width<F||o.height<f.fontSize*1.6)continue;const w=String(o.item.node.label??""),p=Q(w,o.width-I*2,e);if(p!==w&&p.length<ne)continue;const l=k.next("text",`${U}__tile-label${o.children?` ${U}__tile-label--branch`:""}`);de(l,{x:ce(o.x+I),y:ce(o.y+f.fontSize+2),"text-anchor":"start"}),B(l,e),Y(l,p)}return k.finish(),f.labels&&f.labels.show&&D({group:f.groups.labels,size:e,minGap:f.labels.minGap,anchors:H.filter(o=>!o.children&&o.width>=F&&o.height>=f.fontSize*1.6+e).sort((o,w)=>w.width*w.height-o.width*o.height).map(o=>({x:ce(o.x+I),y:ce(o.y+f.fontSize*2+4),text:z(o.item.value,f.labels,f.grid),anchor:"start",inside:!0,width:o.width-I*2}))}),{tiles:H}}function he(f){let J=null;for(const H of f.tiles)f.x>=H.x&&f.x<=H.x+H.width&&f.y>=H.y&&f.y<=H.y+H.height&&(!J||(H.depth||1)>(J.depth||1))&&(J=H);return J}}),Xe("packages/modules/charts/matrix.js",function(a,V){"use strict";Object.defineProperty(a,"colourRamp",{enumerable:!0,get:function(){return k}}),Object.defineProperty(a,"drawHeatmap",{enumerable:!0,get:function(){return o}}),Object.defineProperty(a,"drawFunnel",{enumerable:!0,get:function(){return w}}),Object.defineProperty(a,"drawCandlestick",{enumerable:!0,get:function(){return p}}),Object.defineProperty(a,"drawCorrelogram",{enumerable:!0,get:function(){return v}}),Object.defineProperty(a,"title",{enumerable:!0,get:function(){return s}}),Object.defineProperty(a,"cellAt",{enumerable:!0,get:function(){return b}});const ee=V("packages/modules/charts/frame.js").Pool,M=V("packages/modules/charts/axis.js"),de=M.drawAxisLines,ce=M.drawBandLabels,Y=M.drawCategoryAxis,X=M.drawMeasureAxis,U=M.leftLabelRoom,ae=M.setLabelText,N=V("packages/modules/charts/format.js"),d=N.formatters,D=N.measureText,z=V("packages/modules/charts/scale.js"),x=z.bandScale,B=z.isNumber,Q=z.measureDomain,F=V("packages/modules/charts/svg.js"),I=F.attrs,ne=F.path,S=F.round,Z=F.setText,q=V("packages/modules/charts/typography.js").applySize,L=V("packages/modules/charts/styles.js").NS,se=V("packages/modules/charts/scheme.js"),R=se.rampStops,$=se.resolveScheme,he=V("packages/modules/charts/labels.js"),f=he.drawAnchoredLabels,J=he.labelText,H=Object.freeze([[236,243,249],[0,82,128]]),e=Object.freeze([[176,74,0],[247,247,247],[0,82,128]]);function u(t,c,P){const g=Math.min(1,Math.max(0,P)),y=j=>Math.round(t[j]+(c[j]-t[j])*g);return`rgb(${y(0)} ${y(1)} ${y(2)})`}function k(t,c,P){const g=t.max-t.min||1,y=P?R(P,c):c?e:H;if(!c)return h=>u(y[0],y[y.length-1],(h-t.min)/g);const j=Math.max(Math.abs(t.min),Math.abs(t.max))||1;return h=>h>=0?u(y[1],y[2],h/j):u(y[1],y[0],-h/j)}function o(t){const c=t.scheme||$(),{plot:P,bound:g}=t;new ee(t.groups.grid).finish(),new ee(t.groups.axis).finish(),new ee(t.groups.rules).finish(),new ee(t.groups.labels).finish();const y=g.series.filter(C=>!t.hidden.has(C.key)),j=[];for(const C of y)for(const O of C.points)j.push(O.y);const h=Q(j,{zero:!1,nice:!1}),i=k(h,!!t.diverging,c),n=x(g.categories,[P.left,P.right],.04),m=x(y.map(C=>C.label),[P.top,P.bottom],.04),G=new ee(t.groups.marks);for(const C of y){const O=m.of(C.label);if(!Number.isNaN(O))for(let W=0;W<C.points.length;W++){const re=C.points[W],_=n.of(re.x);if(Number.isNaN(_))continue;const le=G.next("rect",`${L}__cell ${L}__mark`);I(le,{x:S(_),y:S(O),width:S(n.bandwidth),height:S(m.bandwidth),fill:B(re.y)?i(re.y):"transparent","data-series":C.index,"data-point":W}),re.px=S(_+n.bandwidth/2),re.py=S(O+m.bandwidth/2)}}if(G.finish(),Y({group:t.groups.overlay,plot:P,scale:n,labels:g.labels,fontSize:t.fontSize,rotated:g.labels.length>6}),ce({group:t.groups.axis,plot:P,scale:m,labels:y.map(C=>C.label),fontSize:t.fontSize}),t.labels&&t.labels.show){const C=t.typography&&t.typography.small||t.fontSize||11,O=[];for(const W of y)for(const re of W.points)re.px===void 0||!B(re.y)||O.push({x:re.px,y:re.py,text:J(re.y,t.labels,t.grid),inside:!0,width:n.bandwidth-4,height:m.bandwidth-2});f({group:t.groups.labels,size:C,minGap:0,anchors:O})}return{xScale:n,yScale:m,series:y,ramp:i}}function w(t){const c=t.scheme||$(),{plot:P,bound:g}=t;new ee(t.groups.grid).finish(),new ee(t.groups.axis).finish(),new ee(t.groups.rules).finish(),new ee(t.groups.labels).finish();const y=g.series[0],j=y?y.points.map((O,W)=>({point:O,label:g.labels[W],value:B(O.y)?O.y:0})).filter(O=>O.value>0):[];if(!j.length)return{stages:j};let h=0;for(let O=0;O<j.length;O++)j[O].value>h&&(h=j[O].value);const i=P.height/j.length,n=P.left+P.width/2,m=P.width*.62,G=new ee(t.groups.marks);j.forEach((O,W)=>{const re=j[W+1],_=P.top+W*i,le=O.value/h*m/2,ue=(re?re.value:O.value)/h*m/2;I(G.next("path",`${L}__funnel ${L}__mark`),{d:ne(["M",S(n-le),S(_),"L",S(n+le),S(_),"L",S(n+ue),S(_+i-2),"L",S(n-ue),S(_+i-2),"Z"]),fill:c.series(W),"data-point":W}),O.point.px=S(n),O.point.py=S(_+i/2)}),G.finish();const C=new ee(t.groups.overlay);return j.forEach((O,W)=>{const re=P.top+W*i,_=C.next("text",`${L}__funnel-label`);I(_,{x:S(P.left+4),y:S(re+i/2),"text-anchor":"start","dominant-baseline":"middle"}),Z(_,O.label);const le=C.next("text",`${L}__funnel-value`);I(le,{x:S(P.right-4),y:S(re+i/2),"text-anchor":"end","dominant-baseline":"middle"});const ue=W===0?1:O.value/j[W-1].value,ge=t.labels&&t.labels.show?J(O.value,t.labels,t.grid):D(O.value,t.grid.messages);Z(le,W===0?ge:`${ge} · ${Math.round(ue*100)}%`)}),C.finish(),{stages:j}}function p(t){const c=t.scheme||$(),{plot:P,bound:g}=t,[y,j,h,i]=g.series;if(!y||!j||!h||!i)return{xScale:null,yScale:null,series:[]};const n=[];for(const re of[j,h])for(const _ of re.points)n.push(_.y);const m=Q(n,{zero:!1}),G={...x([],[0,0])},C=l(m,P),O=x(g.categories,[P.left,P.right],.3);X({gridGroup:t.groups.grid,axisGroup:t.groups.axis,plot:P,scale:C,format:d(t.grid,{kind:"linear",step:(m.max-m.min)/5})}),de({group:t.groups.rules,plot:P}),Y({group:t.groups.overlay,plot:P,scale:O,labels:g.labels,fontSize:t.fontSize,rotated:g.labels.length>10});const W=new ee(t.groups.marks);for(let re=0;re<g.categories.length;re++){const _=y.points[re],le=j.points[re],ue=h.points[re],ge=i.points[re];if(![_,le,ue,ge].every(Oe=>Oe&&B(Oe.y)))continue;const ye=O.of(g.categories[re]),be=ye+O.bandwidth/2,Me=ge.y>=_.y,je=Me?c.positive:c.negative;I(W.next("path",`${L}__wick ${L}__mark`),{d:ne(["M",S(be),S(C.of(le.y)),"L",S(be),S(C.of(ue.y))]),stroke:je,fill:"none"});const xe=C.of(Math.max(_.y,ge.y)),$e=C.of(Math.min(_.y,ge.y));I(W.next("rect",`${L}__candle ${L}__mark`),{x:S(ye),y:S(xe),width:S(O.bandwidth),height:S(Math.max(1,$e-xe)),fill:Me?"transparent":je,stroke:je,"data-point":re}),ge.px=S(be),ge.py=S(xe)}return W.finish(),{xScale:O,yScale:C,series:[i],candles:g.categories.length}}function l(t,c){const P=t.max-t.min||1;return{kind:"linear",domain:t,range:[c.bottom,c.top],of(g){return c.bottom+(g-t.min)/P*(c.top-c.bottom)},ticks(g=5){const y=[];for(let j=0;j<=g;j++)y.push(t.min+P*j/g);return y}}}function v(t){const c=t.scheme||$(),{plot:P}=t;new ee(t.groups.grid).finish(),new ee(t.groups.rules).finish(),new ee(t.groups.labels).finish();const g=t.columns||[];if(g.length<2)return null;const y=t.grid&&t.grid.statistics;if(!y)return null;const j=t.method==="spearman"?"spearman":t.method==="kendall"?"kendall":"correlation",h=[];for(let W=0;W<g.length;W++)for(let re=0;re<g.length;re++){const _=W===re?1:y[j](g[W],g[re]);h.push({row:W,col:re,a:g[W],b:g[re],r:_})}const i=g.length,n=P.width/i,m=P.height/i,G=new ee(t.groups.marks);for(const W of h){const re=P.left+W.col*n,_=P.top+W.row*m;W.x=re,W.y=_,W.width=n,W.height=m;const le=G.next("rect",`${L}__cell ${L}__mark`);I(le,{x:S(re),y:S(_),width:S(Math.max(0,n-1)),height:S(Math.max(0,m-1)),fill:W.row===W.col||W.r===null?"var(--lattice-chart-empty, #eceff1)":r(W.r,c),"data-row":W.row,"data-col":W.col}),W.element=le}G.finish();const C=new ee(t.groups.overlay),O=U(P);for(let W=0;W<i;W++){const re=C.next("text",`${L}__tick`);q(re,t.fontSize),I(re,{x:S(P.left-4),y:S(P.top+W*m+m/2),"text-anchor":"end","dominant-baseline":"middle"}),ae(re,s(t.grid,g[W]),O,t.fontSize);const _=C.next("text",`${L}__tick`);q(_,t.fontSize),I(_,{x:S(P.left+W*n+n/2),y:S(P.top-4),"text-anchor":"middle"}),ae(_,s(t.grid,g[W]),n,t.fontSize)}if(t.values!==!1&&n>t.fontSize*2.6&&m>t.fontSize*1.5)for(const W of h){if(W.row===W.col||W.r===null)continue;const re=C.next("text",`${L}__data-label`);q(re,t.fontSize),I(re,{x:S(P.left+W.col*n+n/2),y:S(P.top+W.row*m+m/2),"text-anchor":"middle","dominant-baseline":"middle","data-inside":"true"}),Z(re,W.r.toFixed(2))}return C.finish(),{cells:h,columns:g}}function r(t,c){const P=Math.min(1,Math.abs(t)),g=c?R(c,!0):e,y=g[Math.floor(g.length/2)],j=t>=0?g[g.length-1]:g[0];return u(y,j,P)}function s(t,c){const P=t&&t.columns&&typeof t.columns.get=="function"?t.columns.get(c):null;return String(P&&P.title||c)}function b(t){for(const c of t.cells||[])if(c.x!==void 0&&t.x>=c.x&&t.x<=c.x+c.width&&t.y>=c.y&&t.y<=c.y+c.height)return c;return null}}),Xe("packages/modules/charts/topojson.js",function(a,V){"use strict";Object.defineProperty(a,"transformer",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(a,"arcPoints",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(a,"stitch",{enumerable:!0,get:function(){return de}}),Object.defineProperty(a,"decodeGeometry",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(a,"feature",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(a,"isTopology",{enumerable:!0,get:function(){return X}});function ve(U){if(!U)return B=>[B[0],B[1]];const[ae,N]=U.scale,[d,D]=U.translate;let z=0,x=0;return(B,Q)=>(Q||(z=0,x=0),z+=B[0],x+=B[1],[z*ae+d,x*N+D])}function ee(U,ae){const N=U.arcs[ae],d=ve(U.transform);return N.map((D,z)=>d(D,z))}function M(U,ae){const N=ee(U,ae<0?~ae:ae);return ae<0?N.slice().reverse():N}function de(U,ae){const N=[];for(const d of ae){const D=M(U,d);for(let z=N.length?1:0;z<D.length;z++)N.push(D[z])}return N}function ce(U,ae){if(!ae||!ae.type)return null;const N=ve(U.transform);switch(ae.type){case"Point":return{type:"Point",coordinates:N(ae.coordinates,0)};case"MultiPoint":return{type:"MultiPoint",coordinates:ae.coordinates.map(d=>N(d,0))};case"LineString":return{type:"LineString",coordinates:de(U,ae.arcs)};case"MultiLineString":return{type:"MultiLineString",coordinates:ae.arcs.map(d=>de(U,d))};case"Polygon":return{type:"Polygon",coordinates:ae.arcs.map(d=>de(U,d))};case"MultiPolygon":return{type:"MultiPolygon",coordinates:ae.arcs.map(d=>d.map(D=>de(U,D)))};case"GeometryCollection":return{type:"GeometryCollection",geometries:(ae.geometries||[]).map(d=>ce(U,d)).filter(Boolean)};default:return null}}function Y(U,ae){const N=typeof ae=="string"?(U.objects||{})[ae]:ae;if(!N)return{type:"FeatureCollection",features:[]};const d=N.type==="GeometryCollection"?N.geometries||[]:[N],D=[];for(const z of d){const x=ce(U,z);x&&D.push({type:"Feature",id:z.id,properties:z.properties||{},geometry:x})}return{type:"FeatureCollection",features:D}}function X(U){return!!U&&typeof U=="object"&&U.type==="Topology"&&Array.isArray(U.arcs)}}),Xe("packages/modules/charts/projection.js",function(a,V){"use strict";Object.defineProperty(a,"MERCATOR_LIMIT",{enumerable:!0,get:function(){return de}}),Object.defineProperty(a,"equalEarth",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(a,"robinson",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(a,"mercator",{enumerable:!0,get:function(){return X}}),Object.defineProperty(a,"equirectangular",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"albers",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(a,"transverseMercator",{enumerable:!0,get:function(){return N}}),Object.defineProperty(a,"PROJECTIONS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(a,"DEFAULT_PROJECTION",{enumerable:!0,get:function(){return D}}),Object.defineProperty(a,"resolveProjection",{enumerable:!0,get:function(){return z}}),Object.defineProperty(a,"WRAP_DEGREES",{enumerable:!0,get:function(){return x}}),Object.defineProperty(a,"splitAntimeridian",{enumerable:!0,get:function(){return B}}),Object.defineProperty(a,"boundsOf",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(a,"fitted",{enumerable:!0,get:function(){return F}}),Object.defineProperty(a,"graticule",{enumerable:!0,get:function(){return ne}});const ve=Math.PI/180,ee=Object.freeze([1.340264,-.081106,893e-6,.003796]),M=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 ce(S,Z){const[te,q,E,L]=ee,se=Z*ve,R=Math.asin(Math.min(1,Math.max(-1,Math.sqrt(3)/2*Math.sin(se)))),$=R*R,he=$*$*$,f=Math.sqrt(3)/2*(te+3*q*$+he*(7*E+9*L*$));return[S*ve*Math.cos(R)/f,R*(te+q*$+he*(E+L*$))]}function Y(S,Z){const te=Math.min(Math.abs(Z),90),q=Math.min(M.length-2,Math.floor(te/5)),E=(te-q*5)/5,[L,se]=M[q],[R,$]=M[q+1],he=L+(R-L)*E,f=se+($-se)*E;return[S*ve*he,(Z<0?-f:f)*(Math.PI/2)]}function X(S,Z){const te=Math.min(de,Math.max(-de,Z))*ve;return[S*ve,Math.log(Math.tan(Math.PI/4+te/2))]}function U(S,Z){return[S*ve,Z*ve]}function ae(S={}){const[Z,te]=S.parallels||[29.5,45.5],[q,E]=S.centre||[-96,37.5],L=Z*ve,se=te*ve,R=Math.sin(L),$=Math.abs(L-se)<1e-9?R:(R+Math.sin(se))/2,he=Math.cos(L)**2+2*$*R,f=Math.sqrt(he-2*$*Math.sin(E*ve))/$;return(J,H)=>{const e=$*((J-q)*ve),u=Math.max(0,he-2*$*Math.sin(H*ve)),k=Math.sqrt(u)/$;return[k*Math.sin(e),f-k*Math.cos(e)]}}function N(S={}){const[Z,te]=S.centre||[-2,49];return(q,E)=>{const L=E*ve,se=(q-Z)*ve,R=Math.cos(L)*Math.sin(se),$=Math.min(1-1e-12,Math.max(-1+1e-12,R));return[.5*Math.log((1+$)/(1-$)),Math.atan2(Math.tan(L),Math.cos(se))-te*ve]}}const d=Object.freeze({equalEarth:()=>ce,robinson:()=>Y,mercator:()=>X,equirectangular:()=>U,albers:ae,transverseMercator:N,britishNationalGrid:S=>N({centre:[-2,49],...S})}),D="equalEarth";function z(S,Z={},te){if(typeof S=="function")return S;const E=d[typeof S=="string"&&S?S:D];return E?E(Z):(te&&te(`chart projection ${JSON.stringify(S)} is not one this module draws; using '${D}'. Supported: ${Object.keys(d).join(", ")}.`),d[D]({}))}const x=180;function B(S){if(!Array.isArray(S)||S.length<2)return S&&S.length?[S]:[];const Z=[];let te=[S[0]];for(let q=1;q<S.length;q++){const[E,L]=S[q-1],[se,R]=S[q],$=se-E;if(Math.abs($)>x){const he=$>0?-180:180,f=$>0?$-360:$+360,J=f===0?0:Math.min(1,Math.max(0,(he-E)/f)),H=L+(R-L)*J;te.push([he,H]),Z.push(te),te=[[-he,H],[se,R]]}else te.push([se,R])}return Z.push(te),Z.filter(q=>q.length>1)}function Q(S){let Z=1/0,te=1/0,q=-1/0,E=-1/0;for(const L of S||[])for(const[se,R]of L)se<Z&&(Z=se),se>q&&(q=se),R<te&&(te=R),R>E&&(E=R);return Number.isFinite(Z)?{west:Z,south:te,east:q,north:E}:null}function F(S){const{project:Z,rings:te,plot:q}=S,E=typeof S.padding=="number"?S.padding:4;let L=1/0,se=1/0,R=-1/0,$=-1/0;for(const b of te||[])for(const[t,c]of b){const[P,g]=Z(t,c);!Number.isFinite(P)||!Number.isFinite(g)||(P<L&&(L=P),P>R&&(R=P),g<se&&(se=g),g>$&&($=g))}if(!Number.isFinite(L)||R===L||$===se)return{to:(t,c)=>{const[P,g]=Z(t,c);return[q.left+q.width/2+P,q.top+q.height/2-g]},scale:1,width:q.width,height:q.height,left:q.left,top:q.top,aspect:1};const he=Math.max(1,q.width-E*2),f=Math.max(1,q.height-E*2),J=typeof S.zoom=="number"&&S.zoom>0?S.zoom:1,H=Math.min(he/(R-L),f/($-se))*J,e=(R-L)*H,u=($-se)*H,[k,o]=S.centre?Z(S.centre[0],S.centre[1]):[(L+R)/2,(se+$)/2],w=S.centreOffset||[0,0],p=k+(w[0]||0),l=o+(w[1]||0),v=q.left+q.width/2,r=q.top+q.height/2;return{to:(b,t)=>{const[c,P]=Z(b,t);return[v+(c-p)*H,r-(P-l)*H]},scale:H,width:e,height:u,left:v-e/2,top:r-u/2,aspect:(R-L)/($-se)}}const I=2;function ne(S={}){const Z=S.step&&S.step>0?S.step:30,te=[];for(let q=-180;q<=180;q+=Z){const E=[];for(let L=-80;L<=80;L+=I)E.push([q,L]);te.push(E)}for(let q=-60;q<=60;q+=Z){const E=[];for(let L=-180;L<=180;L+=I)E.push([L,q]);te.push(E)}return te}}),Xe("packages/modules/charts/geo.js",function(a,V){"use strict";Object.defineProperty(a,"CONTINENTS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(a,"CONTINENT_NAMES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(a,"OUTLINES",{enumerable:!0,get:function(){return k}}),Object.defineProperty(a,"COUNTRY_CONTINENT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(a,"ALPHA3",{enumerable:!0,get:function(){return w}}),Object.defineProperty(a,"NUMERIC",{enumerable:!0,get:function(){return p}}),Object.defineProperty(a,"normaliseCode",{enumerable:!0,get:function(){return l}}),Object.defineProperty(a,"continentOf",{enumerable:!0,get:function(){return v}}),Object.defineProperty(a,"projection",{enumerable:!0,get:function(){return r}}),Object.defineProperty(a,"projectedPath",{enumerable:!0,get:function(){return s}}),Object.defineProperty(a,"ringPath",{enumerable:!0,get:function(){return b}}),Object.defineProperty(a,"shapesToPaths",{enumerable:!0,get:function(){return t}}),Object.defineProperty(a,"registerGeoPack",{enumerable:!0,get:function(){return P}}),Object.defineProperty(a,"geoPack",{enumerable:!0,get:function(){return g}}),Object.defineProperty(a,"geoPacks",{enumerable:!0,get:function(){return y}}),Object.defineProperty(a,"resolvePack",{enumerable:!0,get:function(){return j}}),Object.defineProperty(a,"packRegions",{enumerable:!0,get:function(){return i}}),Object.defineProperty(a,"regionLabelPoint",{enumerable:!0,get:function(){return m}}),Object.defineProperty(a,"geoRamp",{enumerable:!0,get:function(){return G}}),Object.defineProperty(a,"drawGeomap",{enumerable:!0,get:function(){return O}}),Object.defineProperty(a,"regionAt",{enumerable:!0,get:function(){return W}}),Object.defineProperty(a,"markerAt",{enumerable:!0,get:function(){return re}});const ee=V("packages/modules/charts/frame.js").Pool,de=V("packages/modules/charts/matrix.js").colourRamp,Y=V("packages/modules/charts/topojson.js").feature,X=V("packages/modules/charts/projection.js"),U=X.fitted,ae=X.graticule,N=X.resolveProjection,d=X.splitAntimeridian,z=V("packages/modules/charts/labels.js").drawAnchoredLabels,x=V("packages/modules/charts/axis.js"),B=x.overhangFor,Q=x.setPlotClip,I=V("packages/core/src/internal/util.js").warnOnce,S=V("packages/modules/charts/scheme.js").resolveScheme,Z=V("packages/modules/charts/scale.js"),te=Z.isNumber,q=Z.measureDomain,E=V("packages/modules/charts/svg.js"),L=E.attrs,se=E.insideRings,R=E.path,$=E.pathRings,he=E.round,f=E.setText,H=V("packages/modules/charts/styles.js").NS,e=Object.freeze(["AF","AN","AS","EU","NA","OC","SA"]),u=Object.freeze({AF:"Africa",AN:"Antarctica",AS:"Asia",EU:"Europe",NA:"North America",OC:"Oceania",SA:"South America"}),k=Object.freeze({NA:[[[-168,66],[-156,71],[-130,70],[-115,69],[-100,69],[-85,70],[-75,73],[-64,66],[-78,62],[-79,55],[-65,60],[-56,52],[-60,45],[-67,45],[-70,42],[-74,40],[-76,37],[-81,32],[-80,27],[-81,25],[-84,30],[-90,29],[-94,29],[-97,26],[-97,21],[-91,19],[-88,21],[-87,16],[-83,9],[-79,9],[-85,13],[-92,16],[-96,16],[-105,20],[-110,24],[-114,28],[-117,32],[-122,37],[-124,42],[-124,48],[-130,55],[-140,60],[-150,59],[-160,55],[-165,60],[-168,66]],[[-43,60],[-32,64],[-22,70],[-20,74],[-25,78],[-33,83],[-45,83],[-58,82],[-62,76],[-56,70],[-55,66],[-52,61],[-43,60]]],SA:[[[-81,12],[-72,12],[-62,11],[-52,5],[-50,0],[-44,-2],[-35,-6],[-38,-13],[-39,-18],[-48,-25],[-53,-34],[-57,-38],[-62,-40],[-65,-45],[-68,-52],[-75,-53],[-73,-45],[-73,-37],[-71,-30],[-70,-23],[-71,-18],[-76,-14],[-81,-6],[-80,-2],[-78,1],[-77,8],[-81,12]]],EU:[[[-10,36],[-9,44],[-2,43],[-4,48],[-1,49],[4,52],[7,53],[8,57],[10,58],[5,58],[5,62],[11,64],[15,69],[21,70],[28,71],[32,70],[40,67],[44,68],[50,69],[60,70],[60,60],[58,52],[50,46],[40,44],[36,45],[30,46],[28,41],[26,40],[23,38],[18,40],[13,38],[15,37],[12,44],[8,44],[3,42],[-2,37],[-10,36]],[[-5,50],[1,51],[2,53],[-1,55],[-3,58],[-5,58],[-6,55],[-5,50]],[[-10,52],[-6,52],[-6,55],[-10,55],[-10,52]]],AF:[[[-17,21],[-16,15],[-17,12],[-13,8],[-8,5],[-3,5],[3,6],[8,4],[9,2],[10,-2],[12,-6],[12,-12],[14,-18],[15,-23],[18,-29],[23,-34],[27,-34],[32,-29],[33,-26],[35,-22],[40,-16],[41,-10],[40,-3],[43,0],[51,4],[51,11],[45,12],[43,12],[39,15],[37,21],[34,28],[32,31],[25,32],[20,31],[15,32],[10,37],[3,36],[-2,35],[-6,36],[-10,30],[-13,27],[-17,21]]],AS:[[[26,40],[35,36],[36,31],[43,30],[48,30],[50,27],[56,25],[57,22],[60,25],[62,25],[67,24],[70,21],[73,16],[77,8],[80,6],[80,13],[84,19],[87,21],[92,21],[95,16],[98,10],[104,1],[104,10],[107,11],[109,17],[117,23],[122,30],[122,37],[126,34],[129,35],[130,43],[135,45],[142,45],[143,53],[140,58],[155,59],[162,60],[170,66],[180,68],[170,71],[150,73],[130,74],[110,76],[90,76],[75,73],[70,70],[60,70],[60,60],[58,52],[50,46],[40,44],[36,45],[30,46],[28,41],[26,40]],[[130,31],[132,32],[135,33],[137,34],[140,35],[141,38],[141,41],[142,42],[145,43],[145,45],[141,45],[140,42],[139,40],[137,37],[135,35],[133,34],[131,33],[130,31]]],OC:[[[113,-22],[114,-26],[115,-34],[119,-34],[126,-32],[132,-32],[137,-35],[141,-38],[147,-38],[150,-37],[153,-30],[153,-25],[146,-19],[142,-11],[136,-12],[130,-12],[126,-14],[122,-18],[113,-22]],[[145,-41],[148,-41],[148,-43],[145,-43],[145,-41]],[[173,-35],[178,-38],[174,-41],[172,-43],[167,-46],[170,-44],[173,-35]]],AN:[[[-180,-78],[-150,-76],[-120,-74],[-100,-73],[-80,-72],[-60,-63],[-45,-60],[-58,-64],[-70,-70],[-60,-76],[-30,-77],[0,-70],[20,-70],[40,-68],[60,-67],[80,-66],[100,-66],[120,-66],[140,-66],[160,-78],[170,-84],[180,-85],[-180,-85],[-180,-78]]]}),o=Object.freeze({AD:"EU",AE:"AS",AF:"AS",AG:"NA",AI:"NA",AL:"EU",AM:"AS",AO:"AF",AQ:"AN",AR:"SA",AS:"OC",AT:"EU",AU:"OC",AW:"NA",AX:"EU",AZ:"AS",BA:"EU",BB:"NA",BD:"AS",BE:"EU",BF:"AF",BG:"EU",BH:"AS",BI:"AF",BJ:"AF",BM:"NA",BN:"AS",BO:"SA",BR:"SA",BS:"NA",BT:"AS",BW:"AF",BY:"EU",BZ:"NA",CA:"NA",CD:"AF",CF:"AF",CG:"AF",CH:"EU",CI:"AF",CL:"SA",CM:"AF",CN:"AS",CO:"SA",CR:"NA",CU:"NA",CV:"AF",CY:"AS",CZ:"EU",DE:"EU",DJ:"AF",DK:"EU",DM:"NA",DO:"NA",DZ:"AF",EC:"SA",EE:"EU",EG:"AF",ER:"AF",ES:"EU",ET:"AF",FI:"EU",FJ:"OC",FK:"SA",FM:"OC",FO:"EU",FR:"EU",GA:"AF",GB:"EU",GD:"NA",GE:"AS",GF:"SA",GG:"EU",GH:"AF",GI:"EU",GL:"NA",GM:"AF",GN:"AF",GP:"NA",GQ:"AF",GR:"EU",GT:"NA",GU:"OC",GW:"AF",GY:"SA",HK:"AS",HN:"NA",HR:"EU",HT:"NA",HU:"EU",ID:"AS",IE:"EU",IL:"AS",IM:"EU",IN:"AS",IQ:"AS",IR:"AS",IS:"EU",IT:"EU",JE:"EU",JM:"NA",JO:"AS",JP:"AS",KE:"AF",KG:"AS",KH:"AS",KI:"OC",KM:"AF",KN:"NA",KP:"AS",KR:"AS",KW:"AS",KY:"NA",KZ:"AS",LA:"AS",LB:"AS",LC:"NA",LI:"EU",LK:"AS",LR:"AF",LS:"AF",LT:"EU",LU:"EU",LV:"EU",LY:"AF",MA:"AF",MC:"EU",MD:"EU",ME:"EU",MG:"AF",MH:"OC",MK:"EU",ML:"AF",MM:"AS",MN:"AS",MO:"AS",MQ:"NA",MR:"AF",MT:"EU",MU:"AF",MV:"AS",MW:"AF",MX:"NA",MY:"AS",MZ:"AF",NA:"AF",NC:"OC",NE:"AF",NG:"AF",NI:"NA",NL:"EU",NO:"EU",NP:"AS",NR:"OC",NZ:"OC",OM:"AS",PA:"NA",PE:"SA",PF:"OC",PG:"OC",PH:"AS",PK:"AS",PL:"EU",PM:"NA",PR:"NA",PS:"AS",PT:"EU",PW:"OC",PY:"SA",QA:"AS",RE:"AF",RO:"EU",RS:"EU",RU:"EU",RW:"AF",SA:"AS",SB:"OC",SC:"AF",SD:"AF",SE:"EU",SG:"AS",SI:"EU",SK:"EU",SL:"AF",SM:"EU",SN:"AF",SO:"AF",SR:"SA",SS:"AF",ST:"AF",SV:"NA",SY:"AS",SZ:"AF",TC:"NA",TD:"AF",TG:"AF",TH:"AS",TJ:"AS",TL:"AS",TM:"AS",TN:"AF",TO:"OC",TR:"AS",TT:"NA",TV:"OC",TW:"AS",TZ:"AF",UA:"EU",UG:"AF",US:"NA",UY:"SA",UZ:"AS",VA:"EU",VC:"NA",VE:"SA",VG:"NA",VI:"NA",VN:"AS",VU:"OC",WS:"OC",YE:"AS",YT:"AF",ZA:"AF",ZM:"AF",ZW:"AF"}),w=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"}),p=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 l(_){if(_==null||_==="")return null;const le=String(_).trim().toUpperCase();return le?/^\d+$/.test(le)?p[String(Number(le))]||null:le.length===2?le:le.length===3&&w[le]||null:null}function v(_){return _?e.includes(_)&&!(_ in o)||e.includes(_)?_:o[_]||null:null}function r(_,le={}){const ue=le.antarctic?-90:-58,ge=84,ye=ge-ue,be=Math.min(_.width/360,_.height/ye),Me=360*be,je=ye*be,xe=_.left+(_.width-Me)/2,$e=_.top+(_.height-je)/2;return(Oe,Pe)=>[xe+(Oe+180)*be,$e+(ge-Pe)*be]}function s(_,le){const ue=[];for(let ge=0;ge<_.length;ge++){const[ye,be]=le(_[ge][0],_[ge][1]);if(!Number.isFinite(ye)||!Number.isFinite(be))return ue.length>4?R([...ue,"Z"]):"";ue.push(ge?"L":"M",he(ye),he(be))}return ue.length?R([...ue,"Z"]):""}function b(_,le){const ue=Array.isArray(_)&&Array.isArray(_[0])&&Array.isArray(_[0][0])?_:[_],ge=[];for(const ye of ue)if(!(!Array.isArray(ye)||!ye.length)){for(let be=0;be<ye.length;be++){const[Me,je]=le(ye[be][0],ye[be][1]);ge.push(be?"L":"M",he(Me),he(je))}ge.push("Z")}return R(ge)}function t(_){const le=new Map,ue=_.shapes;if(!ue)return le;const ge=r(_.plot),ye=_.codeProperty||"iso_a2";if(!Array.isArray(ue)&&!ue.type){for(const Me of Object.keys(ue)){const je=l(Me);je&&typeof ue[Me]=="string"&&le.set(je,ue[Me])}return le}const be=ue.type==="FeatureCollection"?ue.features||[]:[ue];for(const Me of be){const je=Me.properties||{},xe=l(je[ye]??je.iso??je.code),$e=Me.geometry;if(!xe||!$e)continue;const Oe=$e.type==="MultiPolygon"?$e.coordinates:$e.type==="Polygon"?[$e.coordinates]:[],Pe=[];for(const De of Oe)for(const Ge of De)Pe.push(b(Ge,ge));Pe.length&&le.set(xe,Pe.join(" "))}return le}const c=new Map;function P(_){return _&&typeof _=="object"&&typeof _.id=="string"&&c.set(_.id,_),_}function g(_){return c.get(_)||null}function y(){return[...c.keys()]}function j(_,le){if(!_||typeof _!="object")return null;const ue=_;let ge=_;if(typeof ue.pack=="string"){if(ge=c.get(ue.pack),!ge)return I(`chart:geomap:pack:${ue.pack}`,`geometry pack ${JSON.stringify(ue.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-${ue.pack}'; createChart({ …, shapes: pack })${c.size?`. Loaded: ${[...c.keys()].join(", ")}.`:"."}`),null}else ue.pack&&typeof ue.pack=="object"&&(ge=ue.pack);if(!ge||typeof ge!="object")return null;const ye=ge;if(ye.topology)return{pack:ye,topology:ye.topology};if(ye.layers){const be=typeof ue.layer=="string"&&ue.layer||typeof le=="string"&&le||ye.defaultLayer||Object.keys(ye.layers)[0],Me=ye.layers[be];if(Me&&Me.topology)return{pack:ye,topology:Me.topology,layer:be}}return null}const h=new WeakMap;function i(_){const le=h.get(_);if(le)return le;const ue=[];for(const ge of Y(_,"regions").features){const ye=[],be=ge.geometry,Me=be.type==="MultiPolygon"?be.coordinates:be.type==="Polygon"?[be.coordinates]:[];for(const je of Me)for(const xe of je)for(const $e of d(xe))ye.push($e);ye.length&&ue.push({code:String(ge.id===void 0||ge.id===null?"":ge.id),label:ge.properties&&ge.properties.name||String(ge.id||""),properties:ge.properties||{},rings:ye})}return h.set(_,ue),ue}function n(_,le){const ue=[];for(let ge=0;ge<_.length;ge++){const[ye,be]=le(_[ge][0],_[ge][1]);!Number.isFinite(ye)||!Number.isFinite(be)||ue.push(ue.length?"L":"M",he(ye),he(be))}return ue.length>2?R(ue):""}function m(_){let le=null,ue=-1;for(const be of _){if(!be||be.length<3)continue;let Me=0,je=0,xe=0;for(let Oe=0;Oe<be.length;Oe++){const[Pe,De]=be[Oe],[Ge,Ve]=be[(Oe+1)%be.length],it=Pe*Ve-Ge*De;Me+=it,je+=(Pe+Ge)*it,xe+=(De+Ve)*it}Me/=2;const $e=Math.abs(Me);$e<1e-9||$e>ue&&(ue=$e,le=[je/(6*Me),xe/(6*Me)])}if(le)return le;const ge=_.flat();if(!ge.length)return null;const ye=ge.reduce((be,[Me,je])=>[be[0]+Me,be[1]+je],[0,0]);return[ye[0]/ge.length,ye[1]/ge.length]}function G(_,le,ue){const ge=de(_,le,ue);if(le)return ge;const ye=_.max-_.min||1,be=1/6;return Me=>ge(_.min+(be+(Me-_.min)/ye*(1-be))*ye)}function C(_,le){return(ue,ge)=>{const[ye,be]=_(ue,ge);return!Number.isFinite(ye)||!Number.isFinite(be)?[ye,be]:[Math.min(Math.max(ye,le.left),le.right),Math.min(Math.max(be,le.top),le.bottom)]}}function O(_){const le=_.scheme||S(),{plot:ue,bound:ge}=_;new ee(_.groups.grid).finish(),new ee(_.groups.axis).finish(),new ee(_.groups.rules).finish(),new ee(_.groups.labels).finish();const ye=j(_.shapes,_.layer),be=ye?new Map:t({shapes:_.shapes,plot:ue,codeProperty:_.codeProperty}),Me=be.size>0||!!ye,je=ye?i(ye.topology):null,xe=new Map;if(je)for(const Ye of je){xe.set(Ye.code,Ye);const qe=Ye.properties||{};qe.alpha3&&xe.set(String(qe.alpha3).toUpperCase(),Ye),qe.numeric&&xe.set(String(Number(qe.numeric)),Ye),qe.fips&&xe.set(String(qe.fips),Ye)}const $e=new Map,Oe=[],Pe=ge.series[0];if(Pe)for(let Ye=0;Ye<Pe.points.length;Ye++){const qe=Pe.points[Ye];if(!te(qe.y))continue;const A=ge.categories[Ye],Ae=l(A),pe=je?[Ae,A==null?"":String(A).trim().toUpperCase()].map(ke=>ke?xe.get(ke):null).find(Boolean):null,fe=pe?pe.code:null,Ne=je?fe:Me?Ae:v(Ae);if(!Ne||Me&&!je&&!be.has(Ne)){ge.labels[Ye]&&Oe.push(ge.labels[Ye]);continue}const me=$e.get(Ne)||{value:0,labels:[]};me.value+=qe.y,me.labels.push(ge.labels[Ye]),$e.set(Ne,me)}const De=$e.has("AN")||$e.has("AQ"),Ge=r(ue,{antarctic:De});let Ve=null;if(je){const Ye=De?je:je.filter(A=>A.code!=="AQ"&&A.code!=="AN"),qe=N(_.projection||ye.pack.projection,{...ye.pack.projectionOptions||{},..._.projectionOptions||{}},A=>I(`chart:geomap:projection:${String(_.projection)}`,A));Ve={project:qe,...U({project:qe,rings:Ye.flatMap(A=>A.rings),plot:ue,zoom:_.zoom,centre:_.centre,centreOffset:_.centreOffset}),drawn:Ye}}const it=q([...$e.values()].map(Ye=>Ye.value),{zero:!_.diverging,nice:!1}),gt=G(it,!!_.diverging,le),ft=B("geomap");Q(_.groups,ue,ft);const xt={left:ue.left-ft,top:ue.top-ft,right:ue.right+ft,bottom:ue.bottom+ft},kt=Ve?C(Ve.to,xt):null,_t=new ee(_.groups.marks);if(!!_.graticule&&!!Ve){const Ye=_.graticule&&typeof _.graticule=="object"&&_.graticule.step||30;for(const qe of ae({step:Ye}))for(const A of d(qe)){const Ae=n(A,kt);if(!Ae)continue;const pe=_t.next("path",`${H}__graticule`);L(pe,{d:Ae,class:`${H}__graticule`})}}const Nt=[],Ut=Ve?Ve.drawn.map(Ye=>Ye.code):Me?[...be.keys()]:e.filter(Ye=>Ye!=="AN"||De),Lt=Ve?new Map(Ve.drawn.map(Ye=>[Ye.code,Ye])):null;for(const Ye of Ut){const qe=Ve?Lt.get(Ye).rings.map(pe=>s(pe,kt)).filter(Boolean).join(" "):Me?be.get(Ye):b(k[Ye],Ge),A=$e.get(Ye),Ae=_t.next("path",`${H}__region ${H}__mark`);L(Ae,{d:qe,fill:A?gt(A.value):"var(--lattice-chart-empty, #eceff1)","data-code":Ye,class:`${H}__region ${H}__mark`}),Nt.push({code:Ye,value:A?A.value:null,label:!Me&&u[Ye]||Lt&&Lt.get(Ye).label||A&&A.labels[0]||Ye,element:Ae,d:qe})}_t.finish();const Ft=new ee(_.groups.overlay);if(Oe.length){const Ye=Ft.next("text",`${H}__geo-note`);L(Ye,{x:he(ue.left),y:he(ue.bottom),"text-anchor":"start"}),f(Ye,_.grid.messages.t("chart.geoUnmatched",{count:Oe.length}))}Ft.finish();let Kt=0;if(_.labels&&_.labels.show&&Ve){const Ye=Nt.filter(qe=>qe.value!==null).sort((qe,A)=>A.value-qe.value).map(qe=>{const A=Lt.get(qe.code).rings.map(pe=>pe.map(([fe,Ne])=>Ve.to(fe,Ne))),Ae=m(A);return Ae&&{x:Ae[0],y:Ae[1],text:qe.label}}).filter(Boolean);Kt=z({group:_.groups.labels,size:_.fontSize,minGap:_.labels.minGap,anchors:Ye,plot:ue})}return{regions:Nt,ramp:gt,unmatched:Oe,useCountries:Me,packed:!!Ve,scale:Ve?Ve.scale:null,attribution:ye&&ye.pack.attribution||"",aspect:Ve?Ve.aspect:null,labelsDrawn:Kt}}function W(_){for(const le of _.regions||[]){if(!le.rings){le.rings=$(le.d);let ge=1/0,ye=1/0,be=-1/0,Me=-1/0;for(const je of le.rings)for(const[xe,$e]of je)xe<ge&&(ge=xe),xe>be&&(be=xe),$e<ye&&(ye=$e),$e>Me&&(Me=$e);le.box={minX:ge,minY:ye,maxX:be,maxY:Me}}const ue=le.box;if(!(!ue||_.x<ue.minX||_.x>ue.maxX||_.y<ue.minY||_.y>ue.maxY)&&se(le.rings,_.x,_.y))return le}return null}function re(_){let ue=null,ge=1/0;for(const ye of _.markers||[]){if(!ye)continue;const be=(ye.r||0)+3,Me=_.x-ye.x,je=_.y-ye.y,xe=Math.sqrt(Me*Me+je*je);xe>be||xe>=ge||(ge=xe,ue=ye)}return ue}}),Xe("packages/modules/charts/network.js",function(a,V){"use strict";Object.defineProperty(a,"ITERATIONS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(a,"LINK_GAP",{enumerable:!0,get:function(){return E}}),Object.defineProperty(a,"ICON_RADIUS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(a,"sequence",{enumerable:!0,get:function(){return se}}),Object.defineProperty(a,"layoutNetwork",{enumerable:!0,get:function(){return R}}),Object.defineProperty(a,"glyphFor",{enumerable:!0,get:function(){return $}}),Object.defineProperty(a,"glyphTransform",{enumerable:!0,get:function(){return he}}),Object.defineProperty(a,"offsetParallel",{enumerable:!0,get:function(){return f}}),Object.defineProperty(a,"drawNetwork",{enumerable:!0,get:function(){return J}}),Object.defineProperty(a,"emphasiseNetwork",{enumerable:!0,get:function(){return H}}),Object.defineProperty(a,"nodeAt",{enumerable:!0,get:function(){return u}}),Object.defineProperty(a,"linkAt",{enumerable:!0,get:function(){return k}});const ee=V("packages/modules/charts/frame.js").Pool,de=V("packages/modules/charts/scheme.js").resolveScheme,ce=V("packages/modules/charts/svg.js"),Y=ce.attrs,X=ce.path,U=ce.round,ae=ce.setText,d=V("packages/modules/charts/styles.js").NS,D=V("packages/modules/charts/typography.js"),z=D.applySize,x=D.truncateTo,B=V("packages/modules/charts/rulecolour.js"),Q=B.ruleColour,F=B.ruleLegend,ne=V("packages/core/src/internal/util.js").warnOnce,S=220,Z=2400,te=.006,q=.015,E=4,L=10;function se(o){let w=o>>>0||1;return()=>(w^=w<<13,w>>>=0,w^=w>>17,w^=w<<5,w>>>=0,w/4294967296)}function R(o){const{nodes:w,links:p,plot:l}=o;if(!w.length)return w;const v=se(w.length*2654435761),r=l.left+l.width/2,s=l.top+l.height/2,b=Math.min(l.width,l.height)/3;for(const c of w){const P=v()*Math.PI*2,g=b*(.35+v()*.65);c.x=r+Math.cos(P)*g,c.y=s+Math.sin(P)*g,c.vx=0,c.vy=0}for(const c of w)c.pinned=Number.isFinite(c.fx)&&Number.isFinite(c.fy),c.pinned&&(c.x=l.left+Math.max(0,Math.min(1,c.fx))*l.width,c.y=l.top+Math.max(0,Math.min(1,c.fy))*l.height);const t=o.iterations||S;for(let c=0;c<t;c++){const P=1-c/t;for(let g=0;g<w.length;g++){const y=w[g];for(let j=g+1;j<w.length;j++){const h=w[j];let i=y.x-h.x,n=y.y-h.y,m=Math.sqrt(i*i+n*n);m<.01&&(i=g-j||1,n=1,m=Math.sqrt(i*i+n*n));const G=Z/(m*m),C=i/m*G,O=n/m*G;y.vx+=C,y.vy+=O,h.vx-=C,h.vy-=O}}for(const g of p){const y=g.source,j=g.target;if(y===j)continue;const h=j.x-y.x,i=j.y-y.y,n=te*(g.weight||1);y.vx+=h*n,y.vy+=i*n,j.vx-=h*n,j.vy-=i*n}for(const g of w){if(g.pinned){g.vx=0,g.vy=0;continue}g.vx+=(r-g.x)*q,g.vy+=(s-g.y)*q,g.x+=g.vx*P*.08,g.y+=g.vy*P*.08,g.vx*=.82,g.vy*=.82,g.x=Math.max(l.left+8,Math.min(l.right-8,g.x)),g.y=Math.max(l.top+8,Math.min(l.bottom-8,g.y))}}return w}function $(o,w){if(!w)return null;const p=o&&o.icons;if(!p||typeof p.get!="function")return ne(`chart:icons:${w}`,`A network node asked for the icon '${w}', but this grid publishes no icon registry — a headless grid has no sprites. The node drew as a plain disc.`),null;const l=p.get(w);return l||(ne(`chart:icon:${w}`,`Unknown icon '${w}' on a network node; drew a plain disc instead. Register it with registerIcon or config.icons, or name a built-in.`),null)}function he(o,w){const p=String(o.viewBox||"0 0 16 16").trim().split(/[\s,]+/).map(Number),[l,v,r,s]=p.length===4&&p.every(Number.isFinite)?p:[0,0,16,16],b=Math.max(r||16,s||16),t=w.size/b,c=w.x-r*t/2,P=w.y-s*t/2;return`translate(${U(c-l*t)} ${U(P-v*t)}) scale(${U(t)})`}function f(o){const w=new Map;for(const p of o){const l=p.pair||`${p.source.key}\0${p.target.key}`;w.has(l)||w.set(l,[]),w.get(l).push(p)}for(const p of w.values()){const l=p.length;for(let v=0;v<l;v++){const r=p[v],s=r.source,b=r.target,t=b.x-s.x,c=b.y-s.y,P=Math.sqrt(t*t+c*c)||1,g=P?-c/P:0,y=P?t/P:1,j=(v-(l-1)/2)*E;r.offset=j,r.bundled=l>1,r.line={x1:s.x+g*j,y1:s.y+y*j,x2:b.x+g*j,y2:b.y+y*j}}}}function J(o){const w=o.scheme||de(),{plot:p,bound:l}=o;for(const m of["grid","axis","rules","labels"])new ee(o.groups[m]).finish();const v=l.nodes,r=l.links.map(m=>({...m,weight:m.value}));if(!v.length)return{nodes:[],links:[],legend:[]};const s=r.reduce((m,G)=>Math.max(m,G.value),0)||1;for(const m of r)m.weight=m.value/s;R({nodes:v,links:r,plot:p,iterations:o.iterations}),f(r);const b=l.measure&&l.measure.col||null,t=new Set;for(const m of r)m.colour=Q({grid:o.grid,col:b,value:m.value}),m.colour&&t.add(m.colour);const c=v.reduce((m,G)=>Math.max(m,G.in+G.out),0)||1,P=new ee(o.groups.marks),g=Number.isFinite(o.linkWidth)&&o.linkWidth>0?Number(o.linkWidth):null;for(const m of r){m.drawnWidth=g===null?.5+m.weight*3:g;const G=P.next("path",`${d}__edge ${d}__mark`);Y(G,{d:X(["M",U(m.line.x1),U(m.line.y1),"L",U(m.line.x2),U(m.line.y2)]),style:m.colour?`stroke:${m.colour};stroke-opacity:1`:null,"stroke-width":U(m.drawnWidth),fill:"none"}),m.el=G}for(const m of v){const G=(m.in+m.out)/c,C=m.icon||o.icon||null;m.glyph=$(o.grid,C),m.r=4+Math.sqrt(G)*12,m.glyph&&(m.r=Math.max(m.r,L));const O=P.next("circle",`${d}__node ${d}__mark`);Y(O,{cx:U(m.x),cy:U(m.y),r:U(m.r),fill:w.series(m.index),"data-node":m.key}),m.el=O}P.finish();const y=new ee(o.groups.overlay),j=[];for(const m of v){if(!m.glyph){m.glyphEls=[];continue}const G=m.glyph.paint==="stroke",C=he(m.glyph,{x:m.x,y:m.y,size:m.r*1.3});m.glyphEls=m.glyph.paths.map(O=>{const W=y.next("path",`${d}__node-icon${G?` ${d}__node-icon--stroke`:""}`);return Y(W,{d:O,transform:C}),W}),j.push(...m.glyphEls)}const h=o.typography&&o.typography.small||o.fontSize,i=v.filter(m=>m.declared),n=v.filter(m=>!m.declared).sort((m,G)=>G.in+G.out-(m.in+m.out)).slice(0,12);for(const m of[...i,...n]){const G=y.next("text",`${d}__flow-label`);z(G,h),Y(G,{x:U(m.x),y:U(m.y+m.r+h),"text-anchor":"middle"}),ae(G,x(m.label,90,h)),m.labelEl=G}return y.finish(),{nodes:v,links:r,glyphs:j,legend:F({grid:o.grid,col:b,colours:t})}}function H(o){const w=o.drawn||{},p=o.keys||new Set,l=p.size>0;let v=0;const r=new Set;for(const s of w.links||[]){const b=l&&(s.rowKeys||[]).some(t=>p.has(t));b&&(v++,r.add(s.source),r.add(s.target)),e(s.el,l&&!b)}for(const s of w.nodes||[]){const b=r.has(s);b&&v++,e(s.el,l&&!b);for(const t of s.glyphEls||[])e(t,l&&!b)}return v}function e(o,w){!o||!o.setAttribute||(w?o.setAttribute("data-dim","true"):o.removeAttribute("data-dim"))}function u(o){const w=typeof o.slack=="number"?o.slack:2;let p=null,l=1/0;for(const v of o.nodes||[]){if(typeof v.x!="number"||typeof v.y!="number")continue;const r=o.x-v.x,s=o.y-v.y,b=Math.sqrt(r*r+s*s);b<=(v.r||0)+w&&b<l&&(l=b,p=v)}return p}function k(o){let w=null,p=1/0;for(const l of o.links||[]){const v=l.line,r=v?{x:v.x1,y:v.y1}:l.source,s=v?{x:v.x2,y:v.y2}:l.target;if(!r||!s||typeof r.x!="number"||typeof s.x!="number")continue;const b=s.x-r.x,t=s.y-r.y,c=b*b+t*t,P=c?Math.max(0,Math.min(1,((o.x-r.x)*b+(o.y-r.y)*t)/c)):0,g=o.x-(r.x+P*b),y=o.y-(r.y+P*t),j=Math.sqrt(g*g+y*y),h=Number.isFinite(l.drawnWidth)?l.drawnWidth:.5+(l.weight||0)*3,i=l.bundled?Math.min(Math.max(2,h/2),E/2):Math.max(3,h/2);j<=i&&j<p&&(p=j,w=l)}return w}}),Xe("packages/modules/charts/flow.js",function(a,V){"use strict";Object.defineProperty(a,"assignDepths",{enumerable:!0,get:function(){return E}}),Object.defineProperty(a,"layoutSankey",{enumerable:!0,get:function(){return L}}),Object.defineProperty(a,"ribbon",{enumerable:!0,get:function(){return se}}),Object.defineProperty(a,"drawSankey",{enumerable:!0,get:function(){return R}}),Object.defineProperty(a,"layoutChord",{enumerable:!0,get:function(){return $}}),Object.defineProperty(a,"drawChord",{enumerable:!0,get:function(){return he}}),Object.defineProperty(a,"describeLink",{enumerable:!0,get:function(){return f}}),Object.defineProperty(a,"flowNodeAt",{enumerable:!0,get:function(){return J}}),Object.defineProperty(a,"ribbonAt",{enumerable:!0,get:function(){return H}}),Object.defineProperty(a,"chordArcAt",{enumerable:!0,get:function(){return e}}),Object.defineProperty(a,"chordRibbonAt",{enumerable:!0,get:function(){return u}}),Object.defineProperty(a,"chordPolygon",{enumerable:!0,get:function(){return k}});const ee=V("packages/modules/charts/frame.js").Pool,de=V("packages/modules/charts/format.js").measureText,Y=V("packages/modules/charts/scheme.js").resolveScheme,X=V("packages/modules/charts/svg.js"),U=X.attrs,ae=X.insideRings,N=X.path,d=X.round,D=X.setText,x=V("packages/modules/charts/styles.js").NS,B=V("packages/modules/charts/typography.js"),Q=B.applySize,F=B.textWidth,I=B.truncateTo,ne=Math.PI*2,S=12,Z=8,te=-Math.PI/2,q=16;function E(o,w){for(const s of o)s.depth=0;const p=o.length+1;for(let s=0;s<p;s++){let b=!1;for(const t of w){if(t.source===t.target)continue;const c=t.source.depth+1;c>t.target.depth&&c<p&&(t.target.depth=c,b=!0)}if(!b)break}const l=o.reduce((s,b)=>Math.max(s,b.depth),0),v=new Set,r=new Set;for(const s of w)s.source!==s.target&&(v.add(s.source),r.add(s.target));for(const s of o)!v.has(s)&&r.has(s)&&(s.depth=l);return l+1}function L(o){const{nodes:w,links:p,plot:l}=o,v=E(w,p),r=o.nodeWidth||S,s=new Map;for(const g of w)s.has(g.depth)||s.set(g.depth,[]),s.get(g.depth).push(g);let b=0;for(const g of s.values()){const y=g.reduce((h,i)=>h+Math.max(i.in,i.out),0),j=Math.max(0,g.length-1)*Z;y>0&&(b=Math.max(b,y/Math.max(1,l.height-j)))}const t=b>0?1/b:0,c=v>1?(l.width-r)/(v-1):0;for(const[g,y]of s){y.sort((n,m)=>Math.max(m.in,m.out)-Math.max(n.in,n.out));const j=y.map(n=>Math.max(1,Math.max(n.in,n.out)*t)),h=j.reduce((n,m)=>n+m,0)+(y.length-1)*Z;let i=l.top+Math.max(0,(l.height-h)/2);y.forEach((n,m)=>{n.x=l.left+g*c,n.width=r,n.y=i,n.height=j[m],n.inAt=i,n.outAt=i,i+=j[m]+Z})}const P=p.slice().sort((g,y)=>g.source.y-y.source.y||y.value-g.value);for(const g of P){const y=Math.max(1,g.value*t);g.thickness=y,g.y0=g.source.outAt+y/2,g.source.outAt+=y}for(const g of P.slice().sort((y,j)=>y.target.y-j.target.y||j.value-y.value))g.y1=g.target.inAt+g.thickness/2,g.target.inAt+=g.thickness;return{columns:v,scale:t}}function se(o){const w=o.source.x+o.source.width,p=o.target.x,l=(w+p)/2,v=o.thickness/2;return N(["M",d(w),d(o.y0-v),"C",d(l),d(o.y0-v),d(l),d(o.y1-v),d(p),d(o.y1-v),"L",d(p),d(o.y1+v),"C",d(l),d(o.y1+v),d(l),d(o.y0+v),d(w),d(o.y0+v),"Z"])}function R(o){const w=o.scheme||Y(),{plot:p,bound:l}=o;for(const c of["grid","axis","rules","labels"])new ee(o.groups[c]).finish();const v=l.nodes,r=l.links;if(!v.length||!r.length)return{nodes:[],links:[]};L({nodes:v,links:r,plot:p});const s=new ee(o.groups.marks);for(const c of r){const P=s.next("path",`${x}__ribbon ${x}__mark`);U(P,{d:se(c),fill:w.series(c.source.index),"data-link":`${c.source.key}->${c.target.key}`})}for(const c of v)U(s.next("rect",`${x}__node ${x}__mark`),{x:d(c.x),y:d(c.y),width:d(c.width),height:d(c.height),fill:w.series(c.index),"data-node":c.key});s.finish();const b=new ee(o.groups.overlay),t=o.typography&&o.typography.small||o.fontSize;for(const c of v){const P=c.x<p.left+p.width/2,g=b.next("text",`${x}__flow-label`);Q(g,t),U(g,{x:d(P?c.x+c.width+4:c.x-4),y:d(c.y+c.height/2),"text-anchor":P?"start":"end","dominant-baseline":"middle"});const y=P?p.right-(c.x+c.width)-6:c.x-p.left-6;D(g,I(c.label,Math.max(0,y),t))}return b.finish(),{nodes:v,links:r}}function $(o){const{nodes:w,links:p}=o,l=new Map;for(const g of w)l.set(g.key,0);for(const g of p)l.set(g.source.key,(l.get(g.source.key)||0)+g.value),l.set(g.target.key,(l.get(g.target.key)||0)+g.value);const v=[...l.values()].reduce((g,y)=>g+y,0);if(v<=0)return{arcs:[],ribbons:[]};const r=Math.min(.04,ne/(w.length*8||1)),s=ne-r*w.length,b=[];let t=-Math.PI/2;const c=new Map;for(const g of w){const j=(l.get(g.key)||0)/v*s;b.push({node:g,from:t,to:t+j}),c.set(g.key,t),t+=j+r}const P=[];for(const g of p.slice().sort((y,j)=>j.value-y.value)){const y=g.value/v*s,j=c.get(g.source.key),h=c.get(g.target.key);c.set(g.source.key,j+y),c.set(g.target.key,h+y),P.push({link:g,source:{from:j,to:j+y},target:{from:h,to:h+y}})}return{arcs:b,ribbons:P}}function he(o){const w=o.scheme||Y(),{plot:p,bound:l}=o;for(const i of["grid","axis","rules","labels"])new ee(o.groups[i]).finish();const v=p.left+p.width/2,r=p.top+p.height/2,s=o.typography&&o.typography.small||o.fontSize,b=Math.max(...l.nodes.map(i=>F(i.label,s)),0),t=Math.max(10,Math.min(p.width,p.height)/2-Math.min(b+8,90)),c=t*.92,{arcs:P,ribbons:g}=$({nodes:l.nodes,links:l.links,cx:v,cy:r,radius:t}),y=(i,n)=>[v+n*Math.cos(i),r+n*Math.sin(i)],j=new ee(o.groups.marks);for(const{link:i,source:n,target:m}of g){const[G,C]=y(n.from,c),[O,W]=y(n.to,c),[re,_]=y(m.from,c),[le,ue]=y(m.to,c);U(j.next("path",`${x}__ribbon ${x}__mark`),{d:N(["M",d(G),d(C),"A",d(c),d(c),0,0,1,d(O),d(W),"Q",d(v),d(r),d(re),d(_),"A",d(c),d(c),0,0,1,d(le),d(ue),"Q",d(v),d(r),d(G),d(C),"Z"]),fill:w.series(i.source.index),"fill-opacity":.55,"data-link":`${i.source.key}->${i.target.key}`})}for(const i of P){const[n,m]=y(i.from,t),[G,C]=y(i.to,t),[O,W]=y(i.to,c),[re,_]=y(i.from,c),le=i.to-i.from>Math.PI?1:0;U(j.next("path",`${x}__node ${x}__mark`),{d:N(["M",d(n),d(m),"A",d(t),d(t),0,le,1,d(G),d(C),"L",d(O),d(W),"A",d(c),d(c),0,le,0,d(re),d(_),"Z"]),fill:w.series(i.node.index),"data-node":i.node.key})}j.finish();const h=new ee(o.groups.overlay);for(const i of P){const n=(i.from+i.to)/2,[m,G]=y(n,t+6),C=h.next("text",`${x}__flow-label`);Q(C,s);const O=Math.cos(n)>=0;U(C,{x:d(m),y:d(G),"text-anchor":O?"start":"end","dominant-baseline":"middle"}),D(C,i.node.label)}return h.finish(),{arcs:P,ribbons:g,ring:{cx:v,cy:r,inner:c,radius:t}}}function f(o,w){return`${o.source.label} → ${o.target.label}: ${de(o.value,w)}`}function J(o){for(const w of o.nodes||[])if(!(typeof w.x!="number"||typeof w.width!="number")&&o.x>=w.x&&o.x<=w.x+w.width&&o.y>=w.y&&o.y<=w.y+w.height)return w;return null}function H(o){let w=null,p=1/0;for(const l of o.links||[]){const v=l.source,r=l.target;if(!v||!r||typeof l.y0!="number")continue;const s=v.x+v.width,b=r.x;if(o.x<Math.min(s,b)||o.x>Math.max(s,b))continue;const t=(s+b)/2,c=n=>{const m=1-n;return m*m*m*s+3*m*m*n*t+3*m*n*n*t+n*n*n*b};let P=0,g=1;for(let n=0;n<24;n++){const m=(P+g)/2;c(m)<o.x?P=m:g=m}const y=(P+g)/2,j=1-y,h=j*j*j*l.y0+3*j*j*y*l.y0+3*j*y*y*l.y1+y*y*y*l.y1,i=Math.max(1,l.thickness||1)/2;Math.abs(o.y-h)<=i&&(l.thickness||1)<p&&(p=l.thickness||1,w=l)}return w}function e(o){const w=o.ring;if(!w)return null;const p=o.x-w.cx,l=o.y-w.cy,v=Math.sqrt(p*p+l*l);if(v<w.inner||v>w.radius)return null;let r=Math.atan2(l,p);for(;r<te;)r+=ne;for(;r>=te+ne;)r-=ne;for(const s of o.arcs||[])if(r>=s.from&&r<s.to)return s;return null}function u(o){const w=o.ring;if(!w)return null;const p=o.x-w.cx,l=o.y-w.cy;if(Math.sqrt(p*p+l*l)>w.inner)return null;for(const v of o.ribbons||[])if(ae([k(v,w)],o.x,o.y))return v;return null}function k(o,w){const{cx:p,cy:l,inner:v}=w,r=c=>[p+v*Math.cos(c),l+v*Math.sin(c)],s=[],b=(c,P)=>{for(let g=0;g<=q;g++)s.push(r(c+(P-c)*g/q))},t=(c,P)=>{for(let g=1;g<q;g++){const y=g/q,j=1-y;s.push([j*j*c[0]+2*j*y*p+y*y*P[0],j*j*c[1]+2*j*y*l+y*y*P[1]])}};return b(o.source.from,o.source.to),t(r(o.source.to),r(o.target.from)),b(o.target.from,o.target.to),t(r(o.target.to),r(o.source.from)),s}}),Xe("packages/modules/charts/hit.js",function(a,V){"use strict";Object.defineProperty(a,"valueText",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(a,"ownsGeometry",{enumerable:!0,get:function(){return $}}),Object.defineProperty(a,"resolveHit",{enumerable:!0,get:function(){return he}});const ee=V("packages/modules/charts/format.js").measureText,de=V("packages/modules/charts/treemap.js").tileAt,ce=V("packages/modules/charts/geo.js"),Y=ce.markerAt,X=ce.regionAt,ae=V("packages/modules/charts/matrix.js").cellAt,N=V("packages/modules/charts/network.js"),d=N.linkAt,D=N.nodeAt,z=V("packages/modules/charts/flow.js"),x=z.chordArcAt,B=z.chordRibbonAt,Q=z.flowNodeAt,F=z.ribbonAt,I=" → ",ne=" – ",S=" › ";function Z(f,J,H){const e=ee(f,H);if(!J||typeof f!="number"||!Number.isFinite(f))return e;const u=f/J;return Number.isFinite(u)?`${e} (${H.number(u,{style:"percent",maximumFractionDigits:1})})`:e}function te(f,J){const H=f.item.node,e=J.bound.root&&J.bound.root.total||0,u=Array.isArray(f.path)?[...f.path]:[H.label];return{heading:u.length>1?u.join(S):H.label,rows:[{label:J.bound.measure.title,value:Z(H.total,e,J.grid.messages),colour:J.scheme.series(f.item.index||0)}],datum:{label:H.label,value:H.total,category:H.value,column:J.bound.measure.col&&J.spec.x||null,series:null,depth:f.depth,path:u,rowKeys:H.rowKey?[H.rowKey]:[]}}}function q(f,J,H){const e=J.reduce((u,k)=>u+(k.value||0),0);return{heading:f.label||f.code,rows:[{label:H.bound.measure.title,value:Z(f.value,e,H.grid.messages),colour:H.scheme.series(0)}],datum:{label:f.label||f.code,value:f.value,category:f.code,column:H.spec.code||H.spec.x||null,series:null,path:[f.label||f.code],rowKeys:[]}}}function E(f,J,H){const e=H.spec.value||H.spec.y||null,u=e?H.grid.columns.get(e):null,k=p=>`${Number(p).toFixed(4)}°`,o=(J.legend||[]).find(p=>p.colour===f.fill)||null,w=[{label:u&&u.title||e||"",value:f.text||"",colour:f.fill},{label:"",value:`${k(f.lat)}, ${k(f.lon)}`,colour:"transparent"}];return o&&o.label&&w.push({label:"",value:o.label,colour:f.fill}),{heading:f.label||f.text||"",rows:w,datum:{label:f.label||f.text||"",value:f.value,category:f.value,column:e,series:null,path:[f.label||f.text||""],lon:f.lon,lat:f.lat,status:o?o.label:null,rowKeys:f.rowKey?[f.rowKey]:[]}}}function L(f,J){const H=k=>{const o=J.grid.columns.get(k);return o&&o.title||k},e=H(f.a),u=H(f.b);return{heading:`${e} × ${u}`,rows:[{label:J.spec.method==="spearman"?"ρ":"r",value:typeof f.r=="number"&&Number.isFinite(f.r)?f.r.toFixed(2):"",colour:J.scheme.series(0)}],datum:{label:`${e} × ${u}`,value:typeof f.r=="number"?f.r:null,category:null,column:null,series:null,path:[e,u],rowKeys:[]}}}function se(f,J){const H=[];for(const u of J.drawn&&J.drawn.links||[])if(!(u.source!==f&&u.target!==f))for(const k of u.rowKeys||[])H.includes(k)||H.push(k);const e=Math.max(f.in||0,f.out||0);return{heading:f.label,rows:[{label:J.bound.measure.title,value:ee(e,J.grid.messages),colour:J.scheme.series(f.index||0)}],datum:{label:f.label,value:e,category:f.value===void 0?f.key:f.value,column:null,series:null,path:[f.label],rowKeys:H}}}function R(f,J){const H=`${f.source.label}${f.undirected?ne:I}${f.target.label}`;return{heading:H,rows:[{label:J.bound.measure.title,value:Z(f.value,f.undirected?0:J.bound.total||0,J.grid.messages),colour:f.colour||J.scheme.series(f.source.index||0)}],datum:{label:H,value:f.value,category:null,column:null,series:null,path:[f.source.label,f.target.label],rowKeys:Array.isArray(f.rowKeys)?[...f.rowKeys]:[]}}}function $(f){return f?!!(Array.isArray(f.tiles)||Array.isArray(f.regions)||Array.isArray(f.markers)||Array.isArray(f.cells)&&Array.isArray(f.columns)||Array.isArray(f.ribbons)&&f.ring||Array.isArray(f.nodes)&&Array.isArray(f.links)):!1}function he(f){const J=f.drawn;if(!J||!f.bound||!$(J))return null;const{x:H,y:e}=f.at;if(Array.isArray(J.tiles)){const u=de({tiles:J.tiles,x:H,y:e});return u?te(u,f):null}if(Array.isArray(J.regions)){const u=X({regions:J.regions,x:H,y:e});return u?q(u,J.regions,f):null}if(Array.isArray(J.markers)){const u=Y({markers:J.markers,x:H,y:e});return u?E(u,J,f):null}if(Array.isArray(J.cells)&&Array.isArray(J.columns)){const u=ae({cells:J.cells,x:H,y:e});return u?L(u,f):null}if(Array.isArray(J.ribbons)&&J.ring){const u=B({ribbons:J.ribbons,ring:J.ring,x:H,y:e});if(u)return R(u.link,f);const k=x({arcs:J.arcs,ring:J.ring,x:H,y:e});return k?se(k.node,f):null}if(Array.isArray(J.nodes)&&Array.isArray(J.links)){const u=J.nodes.some(w=>typeof w.r=="number"),k=u?D({nodes:J.nodes,x:H,y:e}):Q({nodes:J.nodes,x:H,y:e});if(k)return se(k,f);const o=u?d({links:J.links,x:H,y:e}):F({links:J.links,x:H,y:e});return o?R(o,f):null}return null}}),Xe("packages/modules/charts/polar.js",function(a,V){"use strict";Object.defineProperty(a,"arcBand",{enumerable:!0,get:function(){return L}}),Object.defineProperty(a,"drawRadar",{enumerable:!0,get:function(){return se}}),Object.defineProperty(a,"drawGauge",{enumerable:!0,get:function(){return R}});const ee=V("packages/modules/charts/frame.js").Pool,de=V("packages/modules/charts/format.js").measureText,ce=V("packages/modules/charts/scale.js"),Y=ce.isNumber,X=ce.measureDomain,U=V("packages/modules/charts/svg.js"),ae=U.attrs,N=U.path,d=U.round,D=U.setText,x=V("packages/modules/charts/styles.js").NS,Q=V("packages/modules/charts/scheme.js").resolveScheme,F=V("packages/modules/charts/labels.js"),I=F.drawAnchoredLabels,ne=F.labelText,S=Math.PI*2,Z=4,te=S*2/3,q=Math.PI/2+(S-te)/2;function E($,he,f,J){const H=J-Math.PI/2;return[$+f*Math.cos(H),he+f*Math.sin(H)]}function L($){const he=$.to-$.from;if(he<=0)return"";const f=Math.max(0,$.r-$.width),J=he>Math.PI?1:0,[H,e]=E($.cx,$.cy,$.r,$.from),[u,k]=E($.cx,$.cy,$.r,$.to),[o,w]=E($.cx,$.cy,f,$.to),[p,l]=E($.cx,$.cy,f,$.from);return N(["M",d(H),d(e),"A",d($.r),d($.r),0,J,1,d(u),d(k),"L",d(o),d(w),"A",d(f),d(f),0,J,0,d(p),d(l),"Z"])}function se($){const he=$.scheme||Q(),{plot:f,bound:J}=$;new ee($.groups.grid).finish(),new ee($.groups.axis).finish(),new ee($.groups.rules).finish(),new ee($.groups.labels).finish();const H=f.left+f.width/2,e=f.top+f.height/2,u=Math.max(0,Math.min(f.width,f.height)/2-$.fontSize*2),k=J.labels,o=J.series.filter(t=>!$.hidden.has(t.key)),w=[];for(const t of o)for(const c of t.points)w.push(c.y);const p=X(w,{zero:!0}),l=k.length?S/k.length:S,v=t=>{const c=p.max-p.min||1;return Math.max(0,(t-p.min)/c*u)},r=new ee($.groups.grid);for(let t=1;t<=Z;t++){const c=u*t/Z,P=k.map((g,y)=>E(H,e,c,y*l));ae(r.next("path",`${x}__web`),{d:P.length?N([...P.flatMap(([g,y],j)=>[j?"L":"M",d(g),d(y)]),"Z"]):"",fill:"none"})}for(let t=0;t<k.length;t++){const[c,P]=E(H,e,u,t*l);ae(r.next("path",`${x}__web`),{d:N(["M",d(H),d(e),"L",d(c),d(P)]),fill:"none"})}r.finish();const s=new ee($.groups.marks);for(const t of o){const c=[];for(let y=0;y<k.length;y++){const j=t.points[y],h=Y(j&&j.y)?j.y:p.min,[i,n]=E(H,e,v(h),y*l);c.push([d(i),d(n)]),j&&(j.px=d(i),j.py=d(n))}const P=c.length?N([...c.flatMap(([y,j],h)=>[h?"L":"M",y,j]),"Z"]):"",g=he.series(t.index);ae(s.next("path",`${x}__radar-fill ${x}__mark`),{d:P,fill:g,"data-series":t.index}),ae(s.next("path",`${x}__radar-line ${x}__mark`),{d:P,stroke:g,fill:"none","data-series":t.index})}s.finish();const b=new ee($.groups.overlay);for(let t=0;t<k.length;t++){const[c,P]=E(H,e,u+$.fontSize,t*l),g=b.next("text",`${x}__tick`),y=Math.abs(c-H)<1?"middle":c>H?"start":"end";ae(g,{x:d(c),y:d(P),"text-anchor":y,"dominant-baseline":"middle"}),D(g,k[t])}if(b.finish(),$.labels&&$.labels.show){const t=$.typography&&$.typography.small||$.fontSize||11,c=[];for(const P of o)for(const g of P.points){if(!g||g.px===void 0||!Y(g.y))continue;const y=g.px-H,j=g.py-e,h=Math.hypot(y,j)||1;c.push({x:d(g.px+y/h*(t*.8)),y:d(g.py+j/h*(t*.8)),text:ne(g.y,$.labels,$.grid)})}I({group:$.groups.labels,size:t,minGap:$.labels.minGap,anchors:c,plot:f})}return{centre:{x:H,y:e,r:u},series:o,axes:k}}function R($){const he=$.scheme||Q(),{plot:f,bound:J}=$;new ee($.groups.grid).finish(),new ee($.groups.axis).finish(),new ee($.groups.rules).finish(),new ee($.groups.labels).finish();const H=J.series[0],u=(H?H.points.filter(g=>Y(g.y)):[]).reduce((g,y)=>g+y.y,0),k=Y($.min)?$.min:0,o=Y($.max)?$.max:Math.max(u,1),w=o-k||1,p=Math.min(1,Math.max(0,(u-k)/w)),l=f.left+f.width/2,v=f.top+f.height/2,r=Math.max(0,Math.min(f.width,f.height)/2-4),s=Math.max(6,r*.24),b=new ee($.groups.marks);if(ae(b.next("path",`${x}__gauge-track`),{d:L({cx:l,cy:v,r,width:s,from:q,to:q+te})}),ae(b.next("path",`${x}__gauge-value ${x}__mark`),{d:L({cx:l,cy:v,r,width:s,from:q,to:q+te*p}),fill:he.series(0)}),Y($.target)){const g=Math.min(1,Math.max(0,($.target-k)/w)),y=q+te*g,[j,h]=E(l,v,r-s,y),[i,n]=E(l,v,r,y);ae(b.next("path",`${x}__gauge-target`),{d:N(["M",d(j),d(h),"L",d(i),d(n)]),fill:"none"})}b.finish();const t=new ee($.groups.overlay),c=t.next("text",`${x}__gauge-reading`);ae(c,{x:d(l),y:d(v),"text-anchor":"middle","dominant-baseline":"middle"}),D(c,de(u,$.grid.messages));const P=t.next("text",`${x}__gauge-caption`);return ae(P,{x:d(l),y:d(v+$.fontSize*1.6),"text-anchor":"middle","dominant-baseline":"middle"}),D(P,J.measure.title||""),t.finish(),{value:u,domain:{min:k,max:o}}}}),Xe("packages/modules/charts/multiples.js",function(a,V){"use strict";Object.defineProperty(a,"MAX_PANELS",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(a,"panelGrid",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(a,"panelRects",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"splitPanels",{enumerable:!0,get:function(){return de}}),Object.defineProperty(a,"sharedDomain",{enumerable:!0,get:function(){return ce}});const ve=24;function ee(Y,X){if(Y<=1)return{columns:1,rows:1};const U=(X.width||1)/(X.height||1);let ae=Math.max(1,Math.round(Math.sqrt(Y*U)));ae=Math.min(ae,Y);const N=Math.ceil(Y/ae);return{columns:ae,rows:N}}function M(Y){const X=Math.min(Y.count,ve),U=Y.gap===void 0?10:Y.gap,ae=Y.titleHeight===void 0?14:Y.titleHeight,{columns:N,rows:d}=ee(X,Y.plot),D=(Y.plot.width-U*(N-1))/N,z=(Y.plot.height-U*(d-1))/d,x=[];for(let B=0;B<X;B++){const Q=B%N,F=Math.floor(B/N);x.push({index:B,x:Y.plot.left+Q*(D+U),y:Y.plot.top+F*(z+U)+ae,width:Math.max(0,D),height:Math.max(0,z-ae)})}return x}function de(Y){return Y.series.map((X,U)=>({label:X.label,key:X.key,index:U,bound:{...Y,series:[{...X,index:U}]}}))}function ce(Y,X,U){const ae=[];for(const N of Y.series)for(const d of N.points)ae.push(d.y);return U(ae,{zero:X})}}),Xe("packages/modules/charts/stream.js",function(a,V){"use strict";Object.defineProperty(a,"wiggleBaseline",{enumerable:!0,get:function(){return he}}),Object.defineProperty(a,"drawStream",{enumerable:!0,get:function(){return f}}),Object.defineProperty(a,"drawMarimekko",{enumerable:!0,get:function(){return J}}),Object.defineProperty(a,"drawViolin",{enumerable:!0,get:function(){return H}});const ve=V("packages/modules/charts/axis.js"),ee=ve.drawAxisLines,M=ve.drawCategoryAxis,de=ve.drawMeasureAxis,ce=V("packages/modules/charts/distribution.js"),Y=ce.density,X=ce.distributionDomain,U=ce.summarise,ae=ce.valuesByCategory,N=V("packages/modules/charts/frame.js"),d=N.Pool,D=N.shouldRotate,x=V("packages/modules/charts/format.js").formatters,B=V("packages/modules/charts/scale.js"),Q=B.bandScale,F=B.isNumber,I=B.linearScale,ne=B.measureDomain,Z=V("packages/modules/charts/scheme.js").resolveScheme,te=V("packages/modules/charts/svg.js"),q=te.attrs,E=te.path,L=te.round,R=V("packages/modules/charts/styles.js").NS,$=32;function he(e){const u=[];let k=0;for(let o=0;o<e.length;o++){const w=e[o],p=w.reduce((s,b)=>s+b,0);if(o===0){k=-p/2,u.push(k);continue}const l=e[o-1];let v=0;const r=w.length;for(let s=0;s<r;s++){let b=0;for(let t=0;t<s;t++)b+=(w[t]||0)-(l[t]||0);v+=(r-s-.5)*((w[s]||0)-(l[s]||0))+b*0}k-=r>0?v/r:0,u.push(k)}return u}function f(e){const u=e.scheme||Z(),{plot:k,bound:o}=e;new d(e.groups.grid).finish(),new d(e.groups.rules).finish(),new d(e.groups.labels).finish();const w=o.series.filter(c=>!e.hidden.has(c.key)),p=o.categories.map((c,P)=>w.map(g=>{const y=g.points[P];return F(y&&y.y)?Math.max(0,y.y):0})),l=he(p),v=[];p.forEach((c,P)=>{v.push(l[P]),v.push(l[P]+c.reduce((g,y)=>g+y,0))});const r=ne(v,{zero:!1,nice:!1}),s=I(r,[k.bottom,k.top]),b=Q(o.categories,[k.left,k.right],0),t=new d(e.groups.marks);return w.forEach((c,P)=>{const g=[],y=[];p.forEach((h,i)=>{let n=l[i];for(let G=0;G<P;G++)n+=h[G];const m=L(b.centre(o.categories[i]));y.push([m,L(s.of(n))]),g.push([m,L(s.of(n+h[P]))])});const j=[];g.forEach(([h,i],n)=>j.push(n?"L":"M",h,i));for(let h=y.length-1;h>=0;h--)j.push("L",y[h][0],y[h][1]);j.push("Z"),q(t.next("path",`${R}__stream ${R}__mark`),{d:E(j),fill:u.series(c.index),"data-series":c.index})}),t.finish(),M({group:e.groups.overlay,plot:k,scale:b,labels:o.labels,fontSize:e.typography&&e.typography.small||e.fontSize,rotated:D(o.labels,b.step,e.fontSize,(e.axis&&e.axis.x||{}).every),config:e.axis&&e.axis.x||{}}),{xScale:b,yScale:s,series:w}}function J(e){const u=e.scheme||Z(),{plot:k,bound:o}=e,w=o.series.filter(y=>!e.hidden.has(y.key)),p=o.categories.map((y,j)=>w.reduce((h,i)=>{const n=i.points[j];return h+(F(n&&n.y)?Math.abs(n.y):0)},0)),l=p.reduce((y,j)=>y+j,0);if(l<=0)return{series:w,columns:[]};const v=2,r=k.width-v*Math.max(0,o.categories.length-1),s=I({min:0,max:100},[k.bottom,k.top]);de({gridGroup:e.groups.grid,axisGroup:e.groups.axis,plot:k,scale:s,format:x(e.grid,{kind:"linear",step:20}),config:e.axis&&e.axis.y||{},grid:e.grid,size:e.typography&&e.typography.small||e.fontSize}),ee({group:e.groups.rules,plot:k});const b=new d(e.groups.marks),t=[];let c=k.left;o.categories.forEach((y,j)=>{const h=p[j]/l*r;let i=k.bottom;w.forEach((n,m)=>{const G=n.points[j],C=F(G&&G.y)?Math.abs(G.y):0,W=(p[j]>0?C/p[j]:0)*k.height;q(b.next("rect",`${R}__bar ${R}__mark`),{x:L(c),y:L(i-W),width:L(Math.max(0,h)),height:L(Math.max(0,W)),fill:u.series(n.index),"data-series":n.index,"data-point":j}),G&&(G.px=L(c+h/2),G.py=L(i-W)),i-=W}),t.push({category:y,label:o.labels[j],x:c,width:h,total:p[j]}),c+=h+v}),b.finish();const P=new d(e.groups.overlay),g=e.typography&&e.typography.small||e.fontSize;for(const y of t){if(y.width<g*2)continue;const j=P.next("text",`${R}__tick`);j.style.fontSize=`${g}px`,q(j,{x:L(y.x+y.width/2),y:L(k.top-2),"text-anchor":"middle"}),j.textContent=y.label}return P.finish(),{series:w,columns:t}}function H(e){const u=e.scheme||Z(),{plot:k,bound:o}=e,w=ae(o),p=[...w.keys()],l=[];for(const t of w.values())for(let c=0;c<t.length;c++)l.push(t[c]);const v=X(l,e.axis),r=I(v,[k.bottom,k.top]),s=Q(p,[k.left,k.right],.3);de({gridGroup:e.groups.grid,axisGroup:e.groups.axis,plot:k,scale:r,format:x(e.grid,{kind:"linear",step:(v.max-v.min)/5}),config:e.axis&&e.axis.y||{},grid:e.grid,size:e.typography&&e.typography.small||e.fontSize}),M({group:e.groups.overlay,plot:k,scale:s,labels:p,fontSize:e.typography&&e.typography.small||e.fontSize,rotated:p.length>6,config:e.axis&&e.axis.x||{}}),ee({group:e.groups.rules,plot:k});const b=new d(e.groups.marks);return p.forEach((t,c)=>{const P=w.get(t),g=Y(P,v,$),y=g.reduce((C,O)=>Math.max(C,O.density),0)||1,j=s.bandwidth/2,h=s.of(t)+j,i=g.map(C=>[L(h+C.density/y*j),L(r.of(C.at))]),n=g.map(C=>[L(h-C.density/y*j),L(r.of(C.at))]),m=[];i.forEach(([C,O],W)=>m.push(W?"L":"M",C,O));for(let C=n.length-1;C>=0;C--)m.push("L",n[C][0],n[C][1]);m.push("Z"),q(b.next("path",`${R}__violin ${R}__mark`),{d:E(m),fill:u.series(c),"data-point":c});const G=U(P);G&&q(b.next("path",`${R}__median ${R}__mark`),{d:E(["M",L(h-j*.5),L(r.of(G.median)),"L",L(h+j*.5),L(r.of(G.median))]),stroke:u.series(c),"stroke-width":2,fill:"none"})}),b.finish(),{xScale:s,yScale:r,series:[{key:"",label:o.measure.title,index:0,points:p.map(t=>{const c=U(w.get(t));return{x:t,xKey:t,label:t,y:c?c.median:null,rows:(w.get(t)||[]).length}})}]}}}),Xe("packages/modules/charts/gantt.js",function(a,V){"use strict";Object.defineProperty(a,"readTasks",{enumerable:!0,get:function(){return L}}),Object.defineProperty(a,"drawGantt",{enumerable:!0,get:function(){return se}});const ve=V("packages/modules/charts/axis.js"),ee=ve.drawAxisLines,M=ve.drawBandLabels,de=ve.drawContinuousAxis,Y=V("packages/modules/charts/frame.js").Pool,U=V("packages/modules/charts/format.js").formatters,ae=V("packages/modules/charts/scale.js"),N=ae.bandScale,d=ae.timeScale,D=ae.toTime,x=V("packages/modules/charts/scheme.js").resolveScheme,B=V("packages/modules/charts/svg.js"),Q=B.attrs,F=B.round,I=B.setText,S=V("packages/modules/charts/styles.js").NS,Z=V("packages/modules/charts/typography.js"),te=Z.applySize,q=Z.truncateTo,E=8;function L(R,$,he){const f=[];let J=1/0,H=-1/0;for(const e of he){const u=D(R.rows.value(e.key,$.start)),k=D(R.rows.value(e.key,$.end));if(u===null||k===null)continue;const o=$.label?R.rows.text(e.key,$.label):e.key,w=$.series?R.rows.value(e.key,$.series):null;f.push({key:e.key,label:o,group:w,from:Math.min(u,k),to:Math.max(u,k)}),J=Math.min(J,u,k),H=Math.max(H,u,k)}return{tasks:f,span:f.length?{min:J,max:H}:null}}function se(R){const $=R.scheme||x(),{plot:he}=R,{tasks:f,span:J}=L(R.grid,R.spec,R.rows);if(!J)return{tasks:[],xScale:null,dropped:0};const H=Math.max(1,Math.floor(he.height/E)),e=f.slice(0,H),u=f.length-e.length,k=d({min:J.min,max:J.max},[he.left,he.right]),o=N(e.map(r=>r.key),[he.top,he.bottom],.25),w=R.typography&&R.typography.small||R.fontSize;de({group:R.groups.overlay,plot:he,scale:k,format:U(R.grid,{kind:"time",span:J.max-J.min}),config:R.axis&&R.axis.x||{},grid:R.grid,size:w}),M({group:R.groups.axis,plot:he,scale:o,labels:e.map(r=>r.label),fontSize:w}),ee({group:R.groups.rules,plot:he});const p=[...new Set(e.map(r=>String(r.group)))],l=new Y(R.groups.marks);e.forEach((r,s)=>{const b=o.of(r.key),t=k.of(r.from),c=k.of(r.to);Q(l.next("rect",`${S}__task ${S}__mark`),{x:F(t),width:F(Math.max(2,c-t)),y:F(b),height:F(o.bandwidth),fill:$.series(r.group===null?0:p.indexOf(String(r.group))),"data-point":s,"data-key":r.key}),r.px=F((t+c)/2),r.py=F(b+o.bandwidth/2)}),l.finish();const v=new Y(R.groups.labels);if(u>0){const r=v.next("text",`${S}__geo-note`);te(r,w),Q(r,{x:F(he.left),y:F(he.bottom+w+4),"text-anchor":"start"}),I(r,q(R.grid.messages.t("chart.tasksDropped",{count:u}),he.width,w))}return v.finish(),{tasks:e,xScale:k,dropped:u,series:[{key:"",label:R.spec.label||"",index:0,points:e.map(r=>({x:r.key,xKey:r.key,label:r.label,y:r.to-r.from,rows:1,rowKey:r.key,px:r.px,py:r.py}))}]}}}),Xe("packages/modules/charts/interaction.js",function(a,V){"use strict";Object.defineProperty(a,"resolveBrush",{enumerable:!0,get:function(){return de}}),Object.defineProperty(a,"brushed",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(a,"brushCondition",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(a,"attachBrush",{enumerable:!0,get:function(){return X}}),Object.defineProperty(a,"applySelection",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"attachKeyboard",{enumerable:!0,get:function(){return ae}});const ee=V("packages/modules/charts/svg.js").attrs,M=4;function de(N){const d=N&&N.brush;if(d===!0)return{mode:"filter",axis:"x"};if(d==="filter"||d==="zoom"||d==="select")return{mode:d,axis:"x"};if(d&&typeof d=="object"&&d.mode){const D=["filter","zoom","select"].includes(d.mode)?d.mode:null,z=d.axis==="y"||d.axis==="y2"?d.axis:"x";return{mode:D,axis:z}}return{mode:null,axis:"x"}}function ce(N){const{bound:d,xScale:D}=N,z=Math.min(N.from,N.to),x=Math.max(N.from,N.to);if(N.axis==="y"||N.axis==="y2"){const F=N.axis==="y2"&&N.rightScale?N.rightScale:N.yScale||D;if(!F||typeof F.invert!="function")return{kind:"range",values:[],range:null,axis:N.axis};const I=F.invert(z),ne=F.invert(x);return{kind:"range",values:[],range:[I,ne],axis:N.axis}}if(D.kind==="band"){const F=[];for(const I of d.categories){const ne=D.centre(I);!Number.isNaN(ne)&&ne>=z&&ne<=x&&F.push(I)}return{kind:"set",values:F,range:null,axis:"x"}}const B=D.invert(z),Q=D.invert(x);return{kind:"range",values:[],range:[B,Q],axis:"x"}}function Y(N){const{column:d,result:D}=N;if(!d)return null;if(D.kind==="set")return D.values.length?{col:d,op:"in",value:D.values.slice()}:null;if(!D.range)return null;const[z,x]=D.range;if(!Number.isFinite(z)||!Number.isFinite(x))return null;const B=N.kind==="time"?[new Date(Math.min(z,x)),new Date(Math.max(z,x))]:[Math.min(z,x),Math.max(z,x)];return{col:d,op:"between",value:B,bounds:"[]"}}function X(N){let d=null,D=null;const z=()=>{const F=typeof N.axis=="function"?N.axis():"x",I=F==="y"||F==="y2";return(typeof N.horizontal=="function"?N.horizontal():!1)!==I},x=F=>{if(!N.enabled())return;const I=N.pointOf(F);d=z()?I.y:I.x,D=N.svg.ownerDocument.createElementNS("http://www.w3.org/2000/svg","rect"),D.setAttribute("class","lat-chartview__brush"),N.overlay.appendChild(D)},B=F=>{if(d===null||!D)return;const I=N.plot();if(z()){const te=N.pointOf(F).y,q=Math.max(I.top,Math.min(d,te)),E=Math.min(I.bottom,Math.max(d,te));ee(D,{x:I.left,y:q,width:Math.max(0,I.right-I.left),height:Math.max(0,E-q)});return}const ne=N.pointOf(F).x,S=Math.max(I.left,Math.min(d,ne)),Z=Math.min(I.right,Math.max(d,ne));ee(D,{x:S,y:I.top,width:Math.max(0,Z-S),height:I.height})},Q=F=>{if(d===null)return;const I=N.pointOf(F),ne=z()?I.y:I.x,S=Math.abs(ne-d),Z=d;d=null,D&&D.parentNode&&D.parentNode.removeChild(D),D=null,S>=M&&N.onBrush(Z,ne)};return N.svg.addEventListener("pointerdown",x),N.svg.addEventListener("pointermove",B),N.svg.addEventListener("pointerup",Q),N.svg.addEventListener("pointerleave",Q),()=>{N.svg.removeEventListener("pointerdown",x),N.svg.removeEventListener("pointermove",B),N.svg.removeEventListener("pointerup",Q),N.svg.removeEventListener("pointerleave",Q)}}function U(N){const d=N.groups.marks,D=N.keys.size>0||N.categories.size>0;let z=0;for(const x of d.childNodes||[]){if(!x.getAttribute)continue;const B=Number(x.getAttribute("data-series")),Q=Number(x.getAttribute("data-point")),F=N.series[B],I=F&&F.points[Q],ne=!!I&&(I.rowKey&&N.keys.has(I.rowKey)||I.xKey!==void 0&&N.categories.has(I.xKey));ne&&z++,D&&!ne?x.setAttribute("data-dim","true"):x.removeAttribute("data-dim")}return z}function ae(N){let d=0;const D=x=>{const B=N.marks();if(B.length){d=Math.max(0,Math.min(B.length-1,x));for(let Q=0;Q<B.length;Q++)B[Q].setAttribute("tabindex",Q===d?"0":"-1");B[d].focus&&B[d].focus(),N.onFocus(d)}},z=x=>{const B=N.marks();if(B.length){switch(x.key){case"ArrowRight":case"ArrowDown":D(d+1);break;case"ArrowLeft":case"ArrowUp":D(d-1);break;case"Home":D(0);break;case"End":D(B.length-1);break;case"Enter":case" ":N.onActivate(d);break;default:return}x.preventDefault&&x.preventDefault()}};return N.svg.addEventListener("keydown",z),()=>N.svg.removeEventListener("keydown",z)}}),Xe("packages/modules/charts/range.js",function(a,V){"use strict";Object.defineProperty(a,"deriveRangeSpec",{enumerable:!0,get:function(){return ce}});const ve=new Set(["number","currency","percent","integer"]);function ee(Y){return!!Y&&typeof Y.type=="string"&&ve.has(Y.type)}function M(Y){const X=Y&&Y.selection&&typeof Y.selection.ranges=="function"?Y.selection.ranges():[];return!Array.isArray(X)||!X.length?null:X[X.length-1]}function de(Y,X){const U=[],ae=Math.min(X.startRow,X.endRow),N=Math.max(X.startRow,X.endRow);for(let d=ae;d<=N;d++){const D=Y.rows.get(d);D&&!D.group&&D.data!==null&&D.data!==void 0&&U.push(D)}return U}function ce(Y,X={}){const U=q=>({spec:null,type:null,x:null,measures:[],columns:[],reason:q}),ae=X.range||M(Y);if(!ae)return U("no-range");const N=Y.columns.visible(),d=new Set(N.map(q=>q.id)),D=(ae.columns||[]).filter(q=>d.has(q));if(!D.length)return U("no-visible-columns");const z=D.map(q=>({id:q,column:Y.columns.get(q)})),x=z.filter(q=>ee(q.column)).map(q=>q.id),B=z.filter(q=>!ee(q.column)).map(q=>q.id);if(!x.length)return U("no-measure");const Q=B.length?B[0]:null,F=x,ne={rows:de(Y,ae)},S=new Set(["bar","line","area"]);if(F.length>1){const q=X.type,E=S.has(q)?q:null,L=q&&!S.has(q)?q:"combo";return{spec:{...ne,type:L,x:Q,measures:F.map(R=>E?{col:R,type:E}:{col:R})},type:L,x:Q,measures:F,columns:D,reason:null}}const Z=X.type||"bar";return{spec:{...ne,type:Z,x:Q,y:F[0]},type:Z,x:Q,measures:F,columns:D,reason:null}}}),Xe("packages/modules/charts/regression.js",function(a,V){"use strict";Object.defineProperty(a,"regressionPlots",{enumerable:!0,get:function(){return ce}});const ve=new Set(["number","currency","percent","integer"]);function ee(Y,X={}){return{spec:Y,reason:null,...X}}function M(Y,X={}){return{spec:null,reason:Y,...X}}function de(Y){if(!Y||!Array.isArray(Y.fitted)||!Array.isArray(Y.residuals)||!Array.isArray(Y.leverage)||!(Y.sigma2>0))return null;const X=Math.sqrt(Y.sigma2),U=[];for(let ae=0;ae<Y.fitted.length;ae++){const N=Y.leverage[ae];if(!Number.isFinite(N)||N>=1)continue;const d=X*Math.sqrt(1-N);if(!(d>0))continue;const D=Y.residuals[ae]/d;U.push({x:Y.fitted[ae],y:Math.sqrt(Math.abs(D)),key:String(ae)})}return U}function ce(Y,X={}){const U=X.model||(Y&&Y.statistics&&typeof Y.statistics.regressionModel=="function"?Y.statistics.regressionModel(X.spec||{}):null),ae=he=>({fit:M(he),residualsFitted:M(he),qq:M(he),multicollinearity:M(he),scaleLocation:M(he),residualsLeverage:M(he),coefficientForest:M(he)});if(!U||!Array.isArray(U.predictors)||!U.predictors.length||!U.response)return{model:null,plots:ae("no-model")};const N=U.predictors,d=U.response,D=X.rows,z=()=>D===void 0?{}:{rows:D},x=X.fitted||null,B=X.residual||null,Q=X.stdResidual||null,F=X.leverage||null,I=X.cooksD||null,ne=N.length===1?ee({type:"scatter",x:N[0],y:d,fit:!0,band:U.band||null,...z()}):M("multiple-predictors"),S=x&&B?ee({type:"scatter",x,y:B,reference:[{value:0}],...z()}):M("needs-fitted-and-residual-columns"),Z=B?ee({type:"qq",y:B,...z()}):M("needs-residual-column"),te=N.filter(he=>{const f=Y&&Y.columns&&typeof Y.columns.get=="function"?Y.columns.get(he):null;return!f||typeof f.type=="string"&&ve.has(f.type)}),q=N.length>=2?ee({type:"correlogram",columns:te},{vif:U.vif||null}):M("single-predictor",{vif:U.vif||null}),E=F&&Q?ee({type:I?"bubble":"scatter",x:F,y:Q,...I?{size:I}:{},reference:[{value:0}],...z()}):M("needs-leverage-and-standardised-residual-columns"),L=de(U),se=L&&L.length?ee({type:"scatter",points:L,fit:!0,dimensionTitle:"Fitted",measureTitle:"√|standardised residual|"}):M("needs-fitted-model"),R=Array.isArray(U.coefficients)?U.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})):[],$=R.length?ee({type:"forest",points:R,dimensionTitle:"Coefficient",measureTitle:"Estimate"},{coefficients:U.coefficients||null}):M("needs-coefficient-intervals",{coefficients:U.coefficients||null});return{model:U,plots:{fit:ne,residualsFitted:S,qq:Z,multicollinearity:q,scaleLocation:se,residualsLeverage:E,coefficientForest:$}}}}),Xe("packages/modules/charts/registry.js",function(a,V){"use strict";Object.defineProperty(a,"registerChartType",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(a,"chartTypeDef",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"registeredChartTypes",{enumerable:!0,get:function(){return de}});const ve=new Map;function ee(ce,Y){if(typeof ce!="string"||!ce)throw new TypeError("[lattice] registerChartType needs a non-empty type name.");if(!Y||typeof Y.draw!="function")throw new TypeError(`[lattice] registerChartType('${ce}') needs a { draw } function.`);ve.set(ce,Y)}function M(ce){return ve.get(ce)||null}function de(){return[...ve.keys()]}}),Xe("packages/modules/charts/index.js",function(a,V){"use strict";Object.defineProperty(a,"TYPES",{enumerable:!0,get:function(){return sn}}),Object.defineProperty(a,"Chart",{enumerable:!0,get:function(){return kn}}),Object.defineProperty(a,"createChart",{enumerable:!0,get:function(){return xn}}),Object.defineProperty(a,"deriveRangeSpec",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(a,"regressionPlots",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(a,"chartRange",{enumerable:!0,get:function(){return to}}),Object.defineProperty(a,"canChartRange",{enumerable:!0,get:function(){return no}});const ve=V("packages/modules/charts/cartesian.js"),ee=ve.aheadOfWindow,M=ve.axisWindowSpan,de=ve.CARTESIAN,ce=ve.drawCartesian,Y=ve.drawForest,X=ve.nearestCategory,U=ve.nearestDrawnPoint,ae=ve.WINDOW_LEAD,N=ve.windowedBound,D=V("packages/modules/charts/drawable.js").drawability,z=V("packages/modules/charts/axis.js"),x=z.createGroups,B=z.drawAxisTitle,Q=z.normaliseAxes,F=z.setPlotClip,I=V("packages/modules/charts/bind.js"),ne=I.bindHierarchy,S=I.bindLinks,Z=I.bindMeasures,te=I.bindPoints,q=I.bindSeries,E=I.leafRows,L=V("packages/modules/charts/frame.js"),se=L.Pool,R=L.plotRect,$=V("packages/modules/charts/scale.js"),he=$.key,f=$.measureDomain,J=$.sqrtScale,H=V("packages/modules/charts/format.js"),e=H.measureFormat,u=H.measureText,k=V("packages/modules/charts/radial.js"),o=k.arcAt,w=k.drawRadial,p=V("packages/modules/charts/distribution.js"),l=p.drawBoxPlot,v=p.drawCapability,r=p.drawControl,s=p.drawEcdf,b=p.drawHistogram,t=p.drawLorenz,c=p.drawMovingRange,P=p.drawQQ,y=V("packages/modules/charts/treemap.js").drawTreemap,j=V("packages/modules/charts/hit.js"),h=j.ownsGeometry,i=j.resolveHit,m=V("packages/modules/charts/combo.js").drawCombo,G=V("packages/modules/charts/polar.js"),C=G.drawGauge,O=G.drawRadar,W=V("packages/modules/charts/matrix.js"),re=W.drawCandlestick,_=W.drawCorrelogram,le=W.drawFunnel,ue=W.drawHeatmap,ge=W.title,ye=V("packages/modules/charts/multiples.js"),be=ye.panelRects,Me=ye.splitPanels,je=V("packages/modules/charts/geo.js"),xe=je.drawGeomap,$e=je.packRegions,Oe=je.projectedPath,Pe=je.resolvePack,De=V("packages/modules/charts/projection.js"),Ge=De.fitted,Ve=De.resolveProjection,it=De.splitAntimeridian,gt=V("packages/modules/charts/flow.js"),ft=gt.drawChord,xt=gt.drawSankey,kt=V("packages/modules/charts/network.js"),_t=kt.drawNetwork,Pt=kt.emphasiseNetwork,Nt=V("packages/modules/charts/stream.js"),Ut=Nt.drawMarimekko,Lt=Nt.drawStream,Ft=Nt.drawViolin,Ye=V("packages/modules/charts/gantt.js").drawGantt,qe=V("packages/modules/charts/svg.js"),A=qe.attrs,Ae=qe.append,pe=qe.clear,fe=qe.el,Ne=qe.round,me=qe.setText,ke=qe.svg,Le=V("packages/modules/charts/styles.js"),we=Le.NS,_e=Le.injectStyles,Te=V("packages/modules/charts/scheme.js"),Fe=Te.resolveScheme,He=V("packages/modules/charts/typography.js"),Be=He.applySize,et=He.resolveType,Je=He.textWidth,Ze=V("packages/modules/charts/labels.js"),st=Ze.collides,at=Ze.resolveLabels,lt=V("packages/modules/charts/interaction.js"),ot=lt.applySelection,ct=lt.attachBrush,At=lt.attachKeyboard,dt=lt.brushCondition,bt=lt.brushed,rt=lt.resolveBrush,It=V("packages/modules/charts/dense.js"),hn=It.downsample,zt=It.markCount,vt=It.wantsCanvas,Rt=V("packages/modules/charts/range.js").deriveRangeSpec,Yt=V("packages/modules/charts/regression.js").regressionPlots,Mt=V("packages/modules/charts/registry.js"),qt=Mt.chartTypeDef,Zt=Mt.registeredChartTypes,en=Mt.registerChartType,tn=$.linearScale,Bt=$.bandScale,Dt=$.extent,Gt=$.toNumber,Jt=$.isNumber,Ht=$.niceDomain,nn=$.linearTicks,Qe=$.timeScale,nt=$.toTime,pt=$.niceStep,wt=W.colourRamp,jt=qe.path,on=qe.attr,rn=V("packages/core/src/internal/util.js").warnOnce,vn=z.drawMeasureAxis,Mn=z.drawCategoryAxis,Nn=z.drawAxisLines,jn=z.drawContinuousAxis,Pn=z.drawBandLabels,On=z.tickValues,$n=p.density,_n=p.valuesByCategory,Tn=p.summarise,Cn=p.quantile,En=p.histogram,Ln=H.formatters;Object.defineProperty(a,"registerScheme",{enumerable:!0,get:function(){return Te.registerScheme}}),Object.defineProperty(a,"resolveScheme",{enumerable:!0,get:function(){return Te.resolveScheme}}),Object.defineProperty(a,"schemeNames",{enumerable:!0,get:function(){return Te.schemeNames}}),Object.defineProperty(a,"setDefaultScheme",{enumerable:!0,get:function(){return Te.setDefaultScheme}}),Object.defineProperty(a,"SCHEMES",{enumerable:!0,get:function(){return Te.SCHEMES}}),Object.defineProperty(a,"PALETTE",{enumerable:!0,get:function(){return Te.PALETTE}}),Object.defineProperty(a,"registerChartType",{enumerable:!0,get:function(){return Mt.registerChartType}}),Object.defineProperty(a,"registeredChartTypes",{enumerable:!0,get:function(){return Mt.registeredChartTypes}});const zn=Object.freeze({el:fe,svg:ke,attr:on,attrs:A,append:Ae,clear:pe,path:jt,round:Ne,setText:me,Pool:se,plotRect:R,linearScale:tn,bandScale:Bt,sqrtScale:J,extent:Dt,measureDomain:f,niceDomain:Ht,linearTicks:nn,timeScale:Qe,toTime:nt,niceStep:pt,toNumber:Gt,isNumber:Jt,key:he,drawMeasureAxis:vn,drawCategoryAxis:Mn,drawAxisLines:Nn,drawContinuousAxis:jn,drawBandLabels:Pn,tickValues:On,formatters:Ln,resolveScheme:Fe,colourRamp:wt,density:$n,valuesByCategory:_n,summarise:Tn,quantile:Cn,histogram:En,resolvePack:Pe,packRegions:$e,fitted:Ge,resolveProjection:Ve,splitAntimeridian:it,projectedPath:Oe,textWidth:Je,applySize:Be,collides:st,NS:we}),sn=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"]),dn=new Set(["bar","column","horizontalBar","line","area","scatter","bubble","combo","pareto","histogram","heatmap","pie","donut","sunburst","treemap","radar","geomap"]),Rn=new Set(["pie","donut","sunburst"]),Fn=new Set(["pie","donut","sunburst","treemap"]),mn=20,In=new Set(["histogram","boxplot","qq","ecdf","lorenz","control","capability","movingRange"]),Dn=new Set(["histogram","boxplot","qq","ecdf","lorenz","violin"]);function Gn(We){const T=We.y||(Array.isArray(We.measures)&&We.measures.length?We.measures[0]:null);if(!T)return We;const K=typeof T=="string"?T:T.col;if(!K)return We;const ie=typeof T=="object"&&T.fn!=null?T.fn:"median";return{...We,y:{col:K,fn:ie}}}const Bn=new Set(["combo","candlestick"]),gn=new Set(["bar","line","step","area","scatter","bubble"]),Un=new Set(["sankey","chord","network"]),Kn=new Set(["gantt"]),Hn=new Set(["radar","gauge","funnel","heatmap","geomap","sankey","chord","network"]),Ot=Object.freeze({width:480,height:300}),pn=Object.freeze(["00000"]),bn=new Set(["horizontalBar","forest"]);function Wn(We){if(!We||!Array.isArray(We.points))return null;let T=0,K=!1;for(const ie of We.points)typeof ie.y=="number"&&Number.isFinite(ie.y)&&(T+=ie.y,K=!0);return K?T:null}function yn(We,T,K,ie){return We==="correlogram"?(Array.isArray(ie.columns)?ie.columns:[]).map(oe=>ge(K,oe)):We==="heatmap"?(T.series||[]).map(Se=>Se.label):We==="gantt"?(T.rows||[]).map(Se=>ie.label?K.rows.text(Se.key,ie.label):String(Se.key)):bn.has(We)?T.labels||[]:pn}const Vn=1e3,Yn=50;let Zn=0;function Jn(We){const T=We/1e3;return`${T>=10?Math.round(T):Math.round(T*10)/10}s`}function wn(We){return`${We/1e3}s`}function Tt(We){return We&&We.defaultView||globalThis}function Qn(We,T){return T?typeof T=="string"?We.querySelector(T):T:null}function Xn(We,T,K){const ie=["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"],Se=[We,...We.querySelectorAll("*")],oe=[T,...T.querySelectorAll("*")];for(let Ce=0;Ce<Se.length&&Ce<oe.length;Ce++){const ze=K.getComputedStyle(Se[Ce]),Ee=[];for(const Re of ie){const Ue=ze.getPropertyValue(Re);Ue&&Ee.push(`${Re}:${Ue}`)}Ee.length&&oe[Ce].setAttribute("style",Ee.join(";"))}}function qn(We,T){let K=We.root;const ie=[];for(const Se of T){const oe=(K.children||[]).find(Ce=>Ce.label===Se);if(!oe||!oe.children||!oe.children.length)break;K=oe,ie.push(Se)}return ie.length?{...We,root:K,path:ie,empty:!K.children.length}:We}function eo(We,T,K){return We&&We.plot?We.plot:{left:0,top:0,right:T,bottom:K,width:T,height:K,gutter:{left:0,bottom:0,right:0,top:0}}}class kn{#l=++Zn;#n;#c;#e;#i;#f=null;#o=null;#a=null;#p=null;#d=null;#I=!1;#w=null;#k=null;#b=[];#h=new Set;#t=null;#m={zoom:1,offset:[0,0]};#y=null;#x=null;#D=!1;#G=!1;#r=null;#C=0;#M=null;#$=null;#B=!1;#A=!1;#S=new Map;#N=Fe();#E=et();#we=null;#u=null;#g=null;#v=null;#L=0;constructor(T){this.#n=T.grid,this.#c=T.container,this.#e=T.spec,this.#i=T.container.ownerDocument,this.#X(),this.#q(),this.draw()}#X(){_e(this.#i);const T=this.#i;this.#f=fe(T,"div",we);const K=fe(T,"figure",`${we}__figure`);if(this.#e.title||this.#e.subtitle){const ie=fe(T,"figcaption",`${we}__caption`);if(this.#e.title){const Se=fe(T,"div",`${we}__title`);me(Se,this.#e.title),ie.appendChild(Se)}if(this.#e.subtitle){const Se=fe(T,"div",`${we}__subtitle`);me(Se,this.#e.subtitle),ie.appendChild(Se)}K.appendChild(ie)}if(this.#o=ke(T,"svg",{class:`${we}__plot`,preserveAspectRatio:"xMidYMid meet",role:"img"}),this.#a=x(T,this.#o),K.appendChild(this.#o),this.#k=fe(T,"div",`${we}__empty`),this.#k.setAttribute("hidden",""),K.appendChild(this.#k),this.#w=fe(T,"div",`${we}__table`),K.appendChild(this.#w),this.#p=fe(T,"div",`${we}__legend`),K.appendChild(this.#p),this.#e.footnote){const ie=fe(T,"div",`${we}__footnote`);me(ie,this.#e.footnote),K.appendChild(ie)}this.#x=fe(T,"div",`${we}__attribution`),this.#x.setAttribute("hidden",""),K.appendChild(this.#x),this.#d=fe(T,"div",`${we}__tooltip`),this.#d.setAttribute("hidden",""),this.#f.appendChild(K),this.#f.appendChild(this.#d),this.#c.appendChild(this.#f),this.#ee()}#q(){const T=["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.#Y()));for(const ie of T)this.#b.push(this.#n.on(ie,()=>this.schedule()));const K=Tt(this.#i);K&&typeof K.ResizeObserver=="function"&&(this.#$=this.#c.getBoundingClientRect?this.#c.getBoundingClientRect():null,this.#M=new K.ResizeObserver(()=>{if(!this.#B){this.#B=!0;const ie=this.#c.getBoundingClientRect?this.#c.getBoundingClientRect():null;if(ie&&this.#$&&Math.round(ie.width)===Math.round(this.#$.width)&&Math.round(ie.height)===Math.round(this.#$.height))return}this.schedule()}),this.#M.observe(this.#c))}#U(){const T=this.#o&&this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():null;return T&&T.width>0&&T.height>0?T:this.#c.getBoundingClientRect?this.#c.getBoundingClientRect():Ot}#ee(){const T=Ee=>{this.#y||this.#ne(Ee)},K=()=>this.#j();this.#o.addEventListener("pointermove",T),this.#o.addEventListener("pointerleave",K),this.#o.addEventListener("click",Ee=>this.#V(Ee));const ie=Ee=>{!this.#t||!this.#t.packed||(this.#y={x:Ee.clientX||0,y:Ee.clientY||0})},Se=Ee=>{if(!this.#y)return;const Re=Ee.clientX||0,Ue=Ee.clientY||0;this.#P(Re-this.#y.x,Ue-this.#y.y),this.#y={x:Re,y:Ue}},oe=()=>{this.#y=null},Ce=Ee=>{!this.#t||!this.#t.packed||(Ee.preventDefault&&Ee.preventDefault(),this.#R(Ee.deltaY<0?1.15:1/1.15))},ze=Ee=>{if(!this.#t||!this.#t.packed)return;const Re=40;if(Ee.shiftKey&&Ee.key==="ArrowLeft")this.#P(-Re,0);else if(Ee.shiftKey&&Ee.key==="ArrowRight")this.#P(Re,0);else if(Ee.shiftKey&&Ee.key==="ArrowUp")this.#P(0,-Re);else if(Ee.shiftKey&&Ee.key==="ArrowDown")this.#P(0,Re);else if(Ee.key==="+"||Ee.key==="=")this.#R(1.25);else if(Ee.key==="-"||Ee.key==="_")this.#R(1/1.25);else if(Ee.key==="0")this.#ce();else return;Ee.preventDefault&&Ee.preventDefault()};this.#o.addEventListener("pointerdown",ie),this.#o.addEventListener("pointermove",Se),this.#o.addEventListener("pointerup",oe),this.#o.addEventListener("pointerleave",oe),this.#o.addEventListener("wheel",Ce,{passive:!1}),this.#o.addEventListener("keydown",ze),this.#b.push(ct({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:()=>rt(this.#e).axis,horizontal:()=>!!(this.#t&&this.#t.horizontal),enabled:()=>!!rt(this.#e).mode&&!!(this.#t&&this.#t.xScale),onBrush:(Ee,Re)=>this.#se(Ee,Re)})),this.#o.setAttribute("tabindex","0"),this.#b.push(At({svg:this.#o,marks:()=>[...this.#a.marks.childNodes||[]].filter(Ee=>Ee.setAttribute),onFocus:Ee=>this.#ae(Ee),onActivate:Ee=>this.#le(Ee)})),this.#b.push(()=>{this.#o.removeEventListener("pointermove",T),this.#o.removeEventListener("pointerleave",K),this.#o.removeEventListener("pointerdown",ie),this.#o.removeEventListener("pointermove",Se),this.#o.removeEventListener("pointerup",oe),this.#o.removeEventListener("pointerleave",oe),this.#o.removeEventListener("wheel",Ce),this.#o.removeEventListener("keydown",ze)})}#_(T){const K=this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():{left:0,top:0,width:Ot.width,height:Ot.height};return{x:(T.clientX||0)-K.left,y:(T.clientY||0)-K.top}}#te(T){return X({bound:{categories:this.#T().categories},xScale:this.#t.xScale,at:this.#t.horizontal?T.y:T.x})}#T(){const T=this.#t;return T&&Array.isArray(T.labels)&&Array.isArray(T.categories)?{labels:T.labels,categories:T.categories}:{labels:this.#r&&this.#r.labels||[],categories:this.#r&&this.#r.categories||[]}}#K(T){if(!this.#t||!Array.isArray(this.#t.series))return null;if(this.#t.reduced)return U({series:this.#t.series,xScale:this.#t.xScale,at:this.#t.horizontal?T.y:T.x});const K=this.#te(T);return K<0?null:{index:K,entries:this.#t.series.map(ie=>({series:ie,point:ie.points[K]})).filter(ie=>ie.point&&ie.point.y!==null)}}#z(T){return i({drawn:this.#t,bound:this.#r,spec:this.#e,grid:this.#n,scheme:this.#N,at:T})}#ne(T){if(!this.#t||!this.#r||this.#e.tooltip===!1)return;const K=this.#_(T),ie=[];let Se="";const oe=this.#z(K);if(oe){this.#H(oe.heading,oe.rows,T),this.emit("hover",{...oe.datum,native:T});return}if(h(this.#t)){this.#j();return}if(this.#t.arcs){const ze=o({arcs:this.#t.arcs,x:K.x,y:K.y});if(!ze){this.#j();return}Se=ze.label;const Ee=this.#r.root.total>0?ze.total/this.#r.root.total:0;ie.push({label:this.#r.measure.title,value:`${u(ze.total,this.#n.messages)} (${this.#n.messages.number(Ee,{style:"percent",maximumFractionDigits:1})})`,colour:this.#N.series(ze.index)})}else{const ze=this.#K(K);if(!ze){this.#j();return}Se=this.#T().labels[ze.index]||"";for(const Ee of ze.entries)ie.push({label:Ee.series.label,value:u(Ee.point.y,this.#n.messages),colour:this.#N.series(Ee.series.index)})}if(!ie.length){this.#j();return}this.#H(Se,ie,T);const Ce=this.#W(K);Ce&&this.emit("hover",{...Ce,native:T})}#H(T,K,ie){const Se=this.#i;if(pe(this.#d),T){const oe=fe(Se,"div",`${we}__tooltip-row`),Ce=fe(Se,"strong");me(Ce,T),oe.appendChild(Ce),this.#d.appendChild(oe)}for(const oe of K){const Ce=fe(Se,"div",`${we}__tooltip-row`),ze=fe(Se,"span",`${we}__swatch`);ze.setAttribute("style",`background:${oe.colour}`);const Ee=fe(Se,"span");me(Ee,oe.label);const Re=fe(Se,"span",`${we}__tooltip-value`);me(Re,oe.value),Ae(Ce,[ze,Ee,Re]),this.#d.appendChild(Ce)}this.#d.removeAttribute("hidden"),this.#oe(ie)}#oe(T){if(!this.#I&&(this.#I=!0,this.#re())){const ut=this.#i&&this.#i.body;ut&&typeof ut.appendChild=="function"&&ut.appendChild(this.#d)}const K=Tt(this.#i),ie=12,Se=T&&T.clientX||0,oe=T&&T.clientY||0,Ce=typeof this.#d.getBoundingClientRect=="function"?this.#d.getBoundingClientRect():{width:0,height:0},ze=K.innerWidth||0,Ee=K.innerHeight||0;let Re=Se+ie;ze&&Re+Ce.width>ze-ie&&(Re=Se-ie-Ce.width),Re=Math.max(ie,Re);let Ue=oe+ie;Ee&&Ue+Ce.height>Ee-ie&&(Ue=oe-ie-Ce.height),Ue=Math.max(ie,Ue),this.#d.style.left=`${Math.round(Re)}px`,this.#d.style.top=`${Math.round(Ue)}px`}#re(){const T=Tt(this.#i);if(typeof T.getComputedStyle!="function")return!1;let K=this.#f&&this.#f.parentNode;for(;K;){if(K.nodeType===11&&K.host){K=K.host;continue}if(K.nodeType!==1)break;const ie=T.getComputedStyle(K);if(ie&&(ie.transform&&ie.transform!=="none"||ie.perspective&&ie.perspective!=="none"||ie.filter&&ie.filter!=="none"||ie.backdropFilter&&ie.backdropFilter!=="none"||ie.contain&&/layout|paint|strict|content/.test(ie.contain)))return!0;K=K.parentNode}return!1}#j(){this.#d&&this.#d.setAttribute("hidden",""),this.emit("leave",{})}#W(T){if(!this.#t||!this.#r)return null;const K=this.#z(T);if(K)return K.datum;if(h(this.#t))return null;if(this.#t.arcs){const ze=o({arcs:this.#t.arcs,x:T.x,y:T.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 ie=this.#K(T);if(!ie)return null;const Se=ie.entries,oe=this.#T(),Ce=Se.length===1&&Se[0].point.from!==void 0?{from:Se[0].point.from,to:Se[0].point.to}:null;return{label:oe.labels[ie.index]||"",category:oe.categories[ie.index],column:this.#r.dimension.col,value:Se.length===1?Se[0].point.y:null,...Ce||{},series:Se.map(ze=>({key:ze.series.key,label:ze.series.label,value:ze.point.y,rows:ze.point.rows})),rowKeys:Se.map(ze=>ze.point.rowKey).filter(Boolean)}}#V(T){if(!this.#t||!this.#r)return;const K=this.#W(this.#_(T));if(!K)return;let ie=!1;const Se=this.emit("click",{...K,native:T,preventDefault(){ie=!0}});if(!(ie||Se.defaultPrevented)){if(this.#e.drill&&this.#r&&this.#r.root&&K.label){const oe=Array.isArray(K.path)&&K.path.length?K.path:[K.label];this.#u=[...this.#u||[],...oe],this.emit("drill",{path:[...this.#u],label:K.label}),this.draw();return}if(this.#e.selection&&Array.isArray(this.#t.markers)&&Array.isArray(K.rowKeys)&&K.rowKeys.length){this.#n.selection.set([...K.rowKeys]);return}if(this.#e.selection&&this.#e.type==="network"&&Array.isArray(K.rowKeys)&&K.rowKeys.length){this.#n.selection.set([...new Set(K.rowKeys)]);return}!this.#e.filterOnClick||!K.column||this.#n.filters.set({col:K.column,op:"eq",value:K.category})}}#Y(){if(!this.#t)return;if(Array.isArray(this.#t.markers)){this.#ie();return}if(Array.isArray(this.#t.links)&&Array.isArray(this.#t.nodes)&&!this.#t.series){Pt({drawn:this.#t,keys:new Set(this.#n.selection.keys())});return}if(!this.#t.series)return;const T=this.#n.selection.keys(),K=this.#r&&this.#r.dimension&&this.#r.dimension.col,ie=new Set;if(K)for(const Se of T)ie.add(he(this.#n.rows.value(Se,K)));ot({groups:this.#a,series:this.#t.series,keys:new Set(T),categories:ie})}#ie(){const T=new Set(this.#n.selection.keys());for(const K of this.#t.markers){const ie=K.element;!ie||!ie.setAttribute||(T.size&&!T.has(K.rowKey)?ie.setAttribute("data-dim","true"):ie.removeAttribute("data-dim"))}}#se(T,K){const ie=rt(this.#e),Se=ie.mode;if(!Se||!this.#t||!this.#t.xScale||!this.#r)return;const oe=bt({bound:this.#r,xScale:this.#t.xScale,yScale:this.#t.yScale,rightScale:this.#t.rightScale||null,axis:ie.axis,from:T,to:K});let Ce=!1;const ze=this.emit("brush",{mode:Se,kind:oe.kind,values:oe.values,range:oe.range,axis:oe.axis,column:oe.axis==="y"||oe.axis==="y2"?this.#r.measure&&this.#r.measure.col||null:this.#r.dimension.col,preventDefault(){Ce=!0}});if(Ce||ze.defaultPrevented)return;if(Se==="zoom"){if(oe.range){const Re=oe.axis==="y2"?"y2":oe.axis==="y"?"y":"x";this.#e={...this.#e,axis:{...this.#e.axis||{},[Re]:{...(this.#e.axis||{})[Re]||{},min:Math.min(oe.range[0],oe.range[1]),max:Math.max(oe.range[0],oe.range[1])}}},this.draw()}return}if(Se==="select"){const Re=[];for(const Ue of this.#t.series||[])for(const ut of Ue.points){if(!ut.rowKey)continue;(oe.kind!=="set"||oe.values.some(Ie=>he(Ie)===ut.xKey))&&Re.push(ut.rowKey)}this.#n.selection.set([...new Set(Re)]);return}const Ee=dt({column:this.#r.dimension.col,result:oe,kind:this.#r.kind});Ee&&this.#n.filters.set(Ee)}#ae(T){const K=(this.#a.marks.childNodes||[])[T];if(!K||!K.setAttribute)return;const ie=this.#t&&this.#t.series?this.#t.series[Number(K.getAttribute("data-series"))||0]:null,Se=ie&&ie.points[Number(K.getAttribute("data-point"))||0];if(!Se){if(!K.getBoundingClientRect)return;const oe=K.getBoundingClientRect(),Ce=this.#z(this.#_({clientX:oe.left+oe.width/2,clientY:oe.top+oe.height/2}));if(!Ce)return;K.setAttribute("role","img"),K.setAttribute("aria-label",`${Ce.heading}: ${Ce.rows.map(ze=>ze.value).filter(Boolean).join(", ")}`),this.emit("focus",{label:Ce.datum.label,value:Ce.datum.value,index:T});return}K.setAttribute("role","img"),K.setAttribute("aria-label",`${Se.label}: ${u(Se.y,this.#n.messages)}`),this.emit("focus",{label:Se.label,value:Se.y,index:T})}#le(T){const K=(this.#a.marks.childNodes||[])[T];if(!K||!K.getBoundingClientRect)return;const ie=K.getBoundingClientRect();this.#V({clientX:ie.left+ie.width/2,clientY:ie.top+ie.height/2})}#Z(T){const K=T&&T.attribution||"";K?(me(this.#x,K),this.#x.removeAttribute("hidden")):this.#x.setAttribute("hidden","");const ie=T&&Number.isFinite(T.aspect)&&T.aspect>0?T.aspect:null;this.#o&&this.#o.style&&(ie?this.#o.style.setProperty("aspect-ratio",String(ie)):this.#o.style.removeProperty("aspect-ratio"))}#ce(){this.#m={zoom:1,offset:[0,0]},this.schedule()}#R(T){const K=this.#m.zoom*T;this.#m={...this.#m,zoom:Math.min(8,Math.max(1,K))},this.schedule()}#P(T,K){const ie=this.#t&&this.#t.scale||0;if(!ie)return;const[Se,oe]=this.#m.offset;this.#m={...this.#m,offset:[Se-T/ie,oe+K/ie]},this.schedule()}schedule(){if(this.#A||this.#C)return;const T=Tt(this.#i),K=typeof T.requestAnimationFrame=="function"?T.requestAnimationFrame.bind(T):ie=>setTimeout(ie,16);this.#C=K(()=>{this.#C=0,this.draw()})||1}draw(){if(this.#A)return;const T=this.#J();if(!T)return;const K=this.#U(),ie=Math.round(K.width||Ot.width),Se=Math.round(K.height||Ot.height),oe=ie!==T.width||Se!==T.height?this.#J():T;oe&&this.emit("draw",{chartType:oe.chartType,categories:oe.categories,empty:oe.empty})}#J(){const T=this.#U(),K=Math.round(T.width||Ot.width),ie=Math.round(T.height||Ot.height),Se=sn.includes(this.#e.type)?null:qt(this.#e.type),oe=sn.includes(this.#e.type)||Se?this.#e.type:"bar";Array.isArray(this.#e.x)&&rn(`chart:${this.#l}:x:array`,`chart "x" expects one column id (a string) and was given an array [${this.#e.x.map(tt=>JSON.stringify(tt)).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 Ce=Fe(this.#e);this.#N=Ce;const ze=Q(this.#e.axis),Ee=this.#n.messages,Re=et(this.#e);this.#E=Re;const Ue=Re.small,ut=at(this.#e);if(ut.show&&!dn.has(oe)&&!(Se&&Se.labelled)&&!this.#D){this.#D=!0;const tt=this.#i&&this.#i.defaultView,Ke=tt&&tt.console||(typeof globalThis<"u"?globalThis.console:null);Ke&&typeof Ke.warn=="function"&&Ke.warn(`[lattice] a "${oe}" chart does not draw data labels; "labels" has no effect on it. Types that do: ${[...dn].join(", ")}.`)}A(this.#o,{viewBox:`0 0 ${K} ${ie}`,width:K,height:ie});const St=Fn.has(oe)||!!(Se&&Se.hierarchical);let Ie;if(Se&&typeof Se.bind=="function")Ie=Se.bind(this.#n,this.#e);else if(St)Ie=ne(this.#n,this.#e),this.#u&&this.#u.length&&(Ie=qn(Ie,this.#u));else if(Bn.has(oe))Ie=Z(this.#n,this.#e);else if(gn.has(oe)&&Array.isArray(this.#e.measures)&&this.#e.measures.length)Ie=Z(this.#n,this.#e);else if(Un.has(oe))Ie=S(this.#n,this.#e,oe==="network"?{perRow:!0,nodes:this.#e.nodes}:void 0);else if(Kn.has(oe)){const tt=E(this.#n);Ie={rows:tt,series:[],categories:[],labels:[],measure:{col:null,fn:"sum",title:""},dimension:{col:this.#e.label||null,title:""},empty:!tt.length}}else oe==="geomap"?Ie=q(this.#n,{...this.#e,x:this.#e.code||this.#e.x}):Array.isArray(this.#e.points)?Ie=te(this.#e):Dn.has(oe)?Ie=q(this.#n,Gn(this.#e)):Ie=q(this.#n,this.#e);const Ct=Date.now();this.#r=Ie;const Et=ee(Ie,ze&&ze.x,oe,Ct);if(Et){const tt=typeof this.#e.x=="string"?` "${this.#e.x}"`:"",Ke=`${Math.round(ae*1e3)/10}%`;rn(`chart:${this.#l}:x:window:ahead`,`${Et.count} reading(s) on the x axis${tt} were not drawn: stamped up to ${Jn(Et.lead)} ahead of this device's clock, which is more than the ${wn(Et.limit)} (${Ke} of the ${wn(Et.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 yt=D({grid:this.#n,spec:this.#e,type:oe,bound:Ie,axis:ze,now:Ct,id:this.#l});if(!yt.ok)return yt.tell&&rn(yt.key,yt.message),this.#me(this.#e.emptyText||Ee.t("chart.empty")),null;if(Ie=N(Ie,ze&&ze.x,oe,Ct),this.#r=Ie,this.#k.setAttribute("hidden",""),this.#o.removeAttribute("hidden"),F(this.#a,null),Se){const tt=Se.freeform?R({width:K,height:ie,fontSize:Ue,margin:this.#e.margin}):R({width:K,height:ie,fontSize:Ue,margin:this.#e.margin,titleSize:Re.axisTitle,titles:{left:ze.y.title,bottom:ze.x.title,right:ze.y2.title},yLabels:pn,xLabels:Ie.labels,rotated:!0});this.#t=Se.draw({doc:this.#i,groups:this.#a,plot:tt,bound:Ie,type:oe,grid:this.#n,fontSize:Ue,hidden:this.#h,scheme:Ce,axis:ze,typography:Re,labels:ut,spec:this.#e,geoView:{zoom:this.#m.zoom,offset:this.#m.offset},helpers:zn})||{},this.#s(Array.isArray(this.#t.legend)?this.#t.legend:[])}else if(oe==="treemap"){const tt=R({width:K,height:ie,fontSize:Ue,padding:2,margin:this.#e.margin});this.#t=y({scheme:Ce,groups:this.#a,plot:tt,tree:Ie,grid:this.#n,hidden:this.#h,fontSize:Ue,typography:Re,labels:ut}),this.#s(Ie.root.children.map((Ke,ht)=>({key:Ke.label,label:Ke.label,index:ht})))}else if(Rn.has(oe)){const tt=R({width:K,height:ie,fontSize:Ue});this.#t=w({scheme:Ce,doc:this.#i,groups:this.#a,plot:tt,tree:Ie,type:oe,grid:this.#n,hidden:this.#h,fontSize:Ue,typography:Re,labels:ut,centre:this.#e.centre});const Ke=this.#n.columns&&Ie.measure&&Ie.measure.col?this.#n.columns.get(Ie.measure.col):null;this.#s(Ie.root.children.map((ht,$t)=>({key:ht.label,label:ht.label,index:$t,value:e(ht.total,Ke,this.#n),colour:Ce.series($t,ht.label)})))}else{const tt=Hn.has(oe)?R({width:K,height:ie,fontSize:Ue,margin:this.#e.margin,yLabels:oe==="heatmap"?yn(oe,Ie,this.#n,this.#e):[],xLabels:oe==="heatmap"?Ie.labels:[],rotated:!0}):R({width:K,height:ie,fontSize:Ue,margin:this.#e.margin,titleSize:Re.axisTitle,titles:de[oe]&&de[oe].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.#he(oe,Ie)?Math.round(Ue*3):0,yLabels:yn(oe,Ie,this.#n,this.#e),xLabels:bn.has(oe)?[]:Ie.labels,rotated:!0}),Ke={doc:this.#i,groups:this.#a,plot:tt,bound:Ie,type:oe,grid:this.#n,fontSize:Ue,hidden:this.#h,scheme:Ce,axis:ze,typography:Re,labels:ut,byRuleColour:!this.#e.series};if(oe!=="geomap"&&this.#Z(null),this.#e.multiples)this.#t=this.#fe(Ke),this.#s([]);else if(oe==="combo"||oe==="pareto")this.#t=m({...Ke,pareto:oe==="pareto",reference:this.#e.reference,annotations:this.#e.annotations}),this.#s(this.#O(this.#t.series,Ie.measure&&Ie.measure.col));else if(oe==="heatmap")this.#t=ue({...Ke,diverging:this.#e.diverging}),this.#s([]);else if(oe==="radar")this.#t=O(Ke),this.#s(this.#O(Ie.series,Ie.measure&&Ie.measure.col));else if(oe==="gauge")this.#t=C({...Ke,min:this.#e.min,max:this.#e.max,target:this.#e.target}),this.#s([]);else if(oe==="sankey")this.#t=xt(Ke),this.#s([]);else if(oe==="chord")this.#t=ft(Ke),this.#s([]);else if(oe==="network")this.#t=_t({...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(oe==="stream")this.#t=Lt(Ke),this.#s(this.#O(Ie.series,Ie.measure&&Ie.measure.col));else if(oe==="marimekko")this.#t=Ut(Ke),this.#s(this.#O(Ie.series,Ie.measure&&Ie.measure.col));else if(oe==="violin")this.#t=Ft(Ke),this.#s([]);else if(oe==="gantt")this.#t=Ye({...Ke,spec:this.#e,rows:Ie.rows||[]}),this.#s([]);else if(oe==="geomap")this.#t=xe({...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.#Z(this.#t);else if(oe==="correlogram")this.#t=_({...Ke,columns:this.#pe(),method:this.#e.method,values:this.#e.values}),this.#s([]);else if(oe==="forest")this.#t=Y(Ke),this.#s([]);else if(oe==="funnel")this.#t=le(Ke),this.#s([]);else if(oe==="candlestick")this.#t=re(Ke),this.#s([]);else if(In.has(oe)){if(oe==="histogram")this.#t=b({...Ke,buckets:this.#e.buckets,curve:this.#e.curve});else if(oe==="movingRange")this.#t=c(Ke);else if(oe==="control"||oe==="capability"){const ht=this.#e.y||this.#e.measure,$t=this.#n&&this.#n.statistics;this.#t=(oe==="capability"?v:r)({...Ke,capability:$t&&ht?$t.capability(ht,{by:this.#e.x,baseline:this.#e.baseline,rules:this.#e.rules,confidence:this.#e.confidence,...this.#e.spec||{}}):null})}else oe==="qq"?this.#t=P(Ke):oe==="ecdf"?this.#t=s(Ke):oe==="lorenz"?this.#t=t(Ke):this.#t=l(Ke);this.#s([])}else{this.#t=ce({...Ke,fit:this.#e.fit,trend:this.#e.trend,band:this.#e.band,error:this.#e.error,dense:vt({series:Ie.series,canvas:this.#e.canvas}),downsampleTo:this.#e.downsample,stack:this.#e.stack,reference:this.#e.reference,annotations:this.#e.annotations,sizes:this.#de(Ie)});const ht=Array.isArray(this.#t.legend)?this.#t.legend:null;this.#s(ht||(Ie.series.length>1?this.#O(Ie.series,Ie.measure&&Ie.measure.col,$t=>Ce.series($t.index,$t.label)):[]))}}const mt=this.#t&&this.#t.errorBars;if(this.#e.error&&mt&&mt.marks&&!this.#G&&(!mt.drawn||mt.singleSkipped)){this.#G=!0;const tt=this.#i&&this.#i.defaultView,Ke=tt&&tt.console||(typeof globalThis<"u"?globalThis.console:null);if(Ke&&typeof Ke.warn=="function"){let ht;mt.drawn?ht=`[lattice] error bars were requested but ${mt.singleSkipped} of ${mt.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" }\`.`:ht=mt.single===mt.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(ht)}}return this.#t&&(this.#t.plot=this.#t.plot||eo(this.#t,K,ie)),this.#r&&(this.#r.outside=this.#t&&this.#t.outside||0),this.#e.selection&&this.#Y(),this.#Q(),this.#ye(oe,Ie,St),this.#ue(ze),{width:K,height:ie,chartType:oe,categories:Ie.categories||[],empty:!!Ie.empty}}#ue(T){const K=M(T&&T.x),ie=K?Math.min(Vn,Math.max(Yn,Math.floor(K/4))):0;if(this.#A||!ie){this.#F();return}if(this.#v&&this.#L===ie)return;this.#F(),this.#L=ie;const Se=Tt(this.#i),oe=Se&&typeof Se.setInterval=="function"?Se.setInterval.bind(Se):setInterval;this.#v=oe(()=>{this.#A||this.#i&&this.#i.hidden||this.#f&&this.#f.isConnected===!1||this.schedule()},ie);const Ce=this.#v;Ce&&typeof Ce.unref=="function"&&Ce.unref()}#F(){if(this.#v===null)return;const T=Tt(this.#i);(T&&typeof T.clearInterval=="function"?T.clearInterval.bind(T):clearInterval)(this.#v),this.#v=null,this.#L=0}#fe(T){const K=Me(T.bound),ie=be({count:K.length,plot:T.plot}),Se=[];for(const Re of T.bound.series)for(const Ue of Re.points)Se.push(Ue.y);const oe=f(Se,{zero:T.type!=="line"}),Ce=new se(this.#a.overlay);F(this.#a,T.plot);const ze=new se(this.#a.marks);new se(this.#a.grid).finish(),new se(this.#a.axis).finish(),new se(this.#a.rules).finish();let Ee=null;for(let Re=0;Re<ie.length;Re++){const Ue=ie[Re],ut=K[Re],St={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=ce({...T,plot:St,bound:ut.bound,domain:oe,pool:ze,axes:!1});const Ie=Ce.next("text",`${we}__panel-title`);A(Ie,{x:Ne(Ue.x),y:Ne(Ue.y-4),"text-anchor":"start"}),me(Ie,ut.label)}return ze.finish(),Ce.finish(),{...Ee||{},panels:ie,multiples:!0}}#he(T,K){return T==="combo"||T==="pareto"?!0:!gn.has(T)||T==="horizontalBar"||T==="waterfall"?!1:!!(K&&Array.isArray(K.series)&&K.series.some(ie=>ie.axis==="right"&&!this.#h.has(ie.key)))}#de(T){if(this.#e.type!=="bubble"||!this.#e.size)return null;const K=[];for(const Se of T.series||[])for(const oe of Se.points)typeof oe.size=="number"&&K.push(oe.size);const ie=Dt(K);return ie?J(ie,[3,Math.max(6,Math.min(28,this.#e.maxRadius||22))]):null}#me(T){this.#Q(),me(this.#k,T),this.#k.removeAttribute("hidden"),this.#o.setAttribute("hidden","");for(const K of Object.values(this.#a))pe(K);pe(this.#p),pe(this.#w),this.#t=null}#Q(){const T=this.#n.licence;if(!!!(T&&typeof T.watermark=="function"&&T.watermark())){this.#g&&this.#g.parentNode&&this.#g.parentNode.removeChild(this.#g),this.#g=null;return}if(this.#g&&this.#g.parentNode)return;const ie=this.#i,Se=fe(ie,"div",`${we}__watermark`);Se.setAttribute("role","note");const oe=fe(ie,"a",`${we}__watermark-link`);oe.setAttribute("href","https://www.latticegrid.dev"),oe.setAttribute("target","_blank"),oe.setAttribute("rel","noopener noreferrer"),me(oe,this.#n.messages.t("licence.watermark")),Se.appendChild(oe),this.#g=Se,this.#f&&this.#f.appendChild(Se)}#ge(){const T=this.#e.legend;if(T===!1)return{show:!1,position:"bottom",align:"start",shape:"square",maxItems:0,isolate:!1,values:!1};const K=T&&typeof T=="object"?T:{};return{show:!0,position:["top","bottom","left","right"].includes(K.position)?K.position:"bottom",align:["start","centre","center","end"].includes(K.align)?K.align:"start",shape:["square","circle","line"].includes(K.shape)?K.shape:"square",maxItems:Number.isFinite(K.maxItems)&&K.maxItems>0?Number(K.maxItems):0,isolate:!!K.isolate,values:!!K.values}}#O(T,K,ie){const Se=K&&this.#n.columns?this.#n.columns.get(K):null;return(T||[]).map(oe=>({key:oe.key,label:oe.label,index:oe.index,value:e(Wn(oe),Se,this.#n),...ie?{colour:ie(oe)}:{}}))}#pe(){const T=this.#e.columns;if(Array.isArray(T)&&T.length)return T.slice(0,mn);const K=this.#n;return!K||!K.columns||typeof K.columns.visible!="function"?[]:K.columns.visible().filter(ie=>!ie.generated&&(ie.type==="number"||ie.type==="currency"||ie.type==="percent"||ie.type==="integer")).map(ie=>ie.id).slice(0,mn)}#s(T){pe(this.#p);const K=this.#ge();if(A(this.#p,{"data-position":K.position,"data-align":K.align}),!T.length||!K.show)return;const ie=this.#i,Se=K.maxItems?T.slice(0,K.maxItems):T;for(const oe of Se){const Ce=fe(ie,"button",`${we}__legend-item`);Ce.setAttribute("type","button");const ze=!this.#h.has(oe.key);Ce.setAttribute("aria-pressed",ze?"true":"false");const Ee=fe(ie,"span",`${we}__swatch ${we}__swatch--${K.shape}`);Ee.setAttribute("style",`background:${oe.colour||this.#N.series(oe.index)}`);const Re=fe(ie,"span");Be(Re,this.#E.small),me(Re,K.values&&oe.value?`${oe.label} ${oe.value}`:oe.label),Ae(Ce,[Ee,Re]),Ce.addEventListener("click",()=>{this.#be(oe,T,K)}),this.#p.appendChild(Ce)}if(K.maxItems&&T.length>Se.length){const oe=fe(ie,"span",`${we}__legend-more`);Be(oe,this.#E.small),me(oe,this.#n.messages.t("chart.legendMore",{count:T.length-Se.length})),this.#p.appendChild(oe)}}#be(T,K,ie){if(ie.isolate){const Se=K.filter(Ce=>Ce.key!==T.key),oe=Se.every(Ce=>this.#h.has(Ce.key))&&!this.#h.has(T.key);if(this.#h.clear(),!oe)for(const Ce of Se)this.#h.add(Ce.key)}else this.#h.has(T.key)?this.#h.delete(T.key):this.#h.add(T.key);this.emit("legend",{label:T.label,key:T.key,hidden:this.#h.has(T.key),hiddenKeys:[...this.#h]}),this.draw()}#ye(T,K,ie){const Se=this.#n.messages,oe=K.measure&&K.measure.title||"",Ce=K.dimension&&K.dimension.title||"",ze=oe?Ce&&!ie?"chart.summary":"chart.summaryShare":"chart.summaryType",Ee=Se.t(ze,{type:Se.t(`chart.type.${T}`),measure:oe,dimension:Ce});A(this.#o,{"aria-label":Ee}),pe(this.#w);const Re=this.#i,Ue=fe(Re,"table"),ut=fe(Re,"caption");me(ut,Se.t("chart.dataTable")),Ue.appendChild(ut);const St=fe(Re,"tr"),Ie=fe(Re,"th");me(Ie,ie?"":Ce),St.appendChild(Ie);const Ct=[];if(ie&&K.root){for(const mt of K.root.children){const tt=fe(Re,"tr"),Ke=fe(Re,"th");me(Ke,mt.label);const ht=fe(Re,"td");me(ht,u(mt.total,Se)),Ae(tt,[Ke,ht]),Ct.push(tt)}const yt=fe(Re,"th");me(yt,oe),St.appendChild(yt)}else{const yt=this.#T(),mt=this.#t&&Array.isArray(this.#t.labels)&&Array.isArray(this.#t.series)&&Array.isArray(this.#t.categories)?this.#t.series:K.series||[];for(const tt of mt){const Ke=fe(Re,"th");me(Ke,tt.label),St.appendChild(Ke)}for(let tt=0;tt<(yt.labels||[]).length;tt++){const Ke=fe(Re,"tr"),ht=fe(Re,"th");me(ht,yt.labels[tt]),Ke.appendChild(ht);for(const $t of mt){const An=fe(Re,"td"),an=$t.points[tt];me(An,an&&an.y!==null?u(an.y,Se):""),Ke.appendChild(An)}Ct.push(Ke)}}Ue.appendChild(St);for(const yt of Ct)Ue.appendChild(yt);this.#w.appendChild(Ue);const Et=this.#t&&this.#t.annotations;if(Array.isArray(Et)&&Et.length){const yt=fe(Re,"ul",`${we}__annotation-list`);for(const mt of Et){if(!mt||!mt.text)continue;const tt=fe(Re,"li");me(tt,mt.text),yt.appendChild(tt)}yt.childNodes&&yt.childNodes.length&&this.#w.appendChild(yt)}}on(T,K){return typeof K!="function"?()=>{}:(this.#S.has(T)||this.#S.set(T,new Set),this.#S.get(T).add(K),()=>{const ie=this.#S.get(T);ie&&ie.delete(K)})}emit(T,K){const ie={...K,type:T,chart:this,grid:this.#n},Se=this.#e[`on${T.charAt(0).toUpperCase()}${T.slice(1)}`],oe=[...this.#S.get(T)||[]];typeof Se=="function"&&oe.unshift(Se);for(const Ce of oe)try{Ce(ie)}catch(ze){const Ee=Tt(this.#i);Ee.console&&typeof Ee.console.error=="function"&&Ee.console.error(`[lattice] a chart "${T}" listener threw`,ze)}return ie}data(){return this.#r}ascend(T){if(!this.#u||!this.#u.length)return[];const K=Number.isFinite(T)&&T>0?Number(T):this.#u.length;return this.#u=this.#u.slice(0,Math.max(0,this.#u.length-K)),this.emit("drill",{path:[...this.#u],label:this.#u[this.#u.length-1]||null}),this.draw(),[...this.#u]}update(T){this.#e={...this.#e,...T},this.draw()}get element(){return this.#f}toSVG(T){if(!this.#o)return"";const K=Tt(this.#i);let ie=this.#o;return T&&T.inlineStyles&&K.getComputedStyle&&this.#o.cloneNode&&(ie=this.#o.cloneNode(!0),Xn(this.#o,ie,K),ie.setAttribute("xmlns","http://www.w3.org/2000/svg")),typeof K.XMLSerializer=="function"?new K.XMLSerializer().serializeToString(ie):ie.outerHTML||""}async toPNG(T){const K=Tt(this.#i);if(!this.#o||!K.Image||!this.#i.createElement)return null;const ie=T&&T.scale||K.devicePixelRatio||1,Se=this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():Ot,oe=Math.max(1,Math.round(Se.width||Ot.width)),Ce=Math.max(1,Math.round(Se.height||Ot.height)),ze=this.toSVG({inlineStyles:!0}),Ee=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(ze)}`,Re=new K.Image;await new Promise((Ie,Ct)=>{Re.onload=Ie,Re.onerror=()=>Ct(new Error("the chart could not be rasterised")),Re.src=Ee});const Ue=this.#i.createElement("canvas");Ue.width=Math.round(oe*ie),Ue.height=Math.round(Ce*ie);const ut=Ue.getContext("2d"),St=T&&"background"in T?T.background:"#ffffff";return St&&(ut.fillStyle=St,ut.fillRect(0,0,Ue.width,Ue.height)),ut.drawImage(Re,0,0,Ue.width,Ue.height),new Promise(Ie=>Ue.toBlob(Ie,"image/png"))}toCSV(){const T=this.#r;if(!T)return"";const K=oe=>{const Ce=oe==null?"":String(oe);return/[",\n]/.test(Ce)?`"${Ce.replace(/"/g,'""')}"`:Ce};if(T.root){const oe=[["Label",T.measure.title||"Value"].map(K).join(",")];for(const Ce of T.root.children)oe.push([K(Ce.label),K(Ce.total)].join(","));return oe.join(`
|
|
229
|
+
`)}const Se=[[T.dimension.title||"",...T.series.map(oe=>oe.label)].map(K).join(",")];for(let oe=0;oe<T.labels.length;oe++){const Ce=[K(T.labels[oe])];for(const ze of T.series){const Ee=ze.points[oe];Ce.push(K(Ee&&Ee.y!==null?Ee.y:""))}Se.push(Ce.join(","))}return Se.join(`
|
|
230
|
+
`)}destroy(){if(!this.#A){this.#A=!0,this.#F();for(const T of this.#b)T();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 xn(We){if(!We||!We.grid)throw new Error("createChart needs a grid");const T=We.grid.element?We.grid.element.ownerDocument:globalThis.document,K=Qn(T,We.container);if(!K)throw new Error("createChart needs a container element");const{grid:ie,container:Se,...oe}=We;return new kn({grid:ie,container:K,spec:oe})}function to(We,T){if(!T||!T.container)return null;const K=Rt(We,T);if(!K.spec)return null;const{container:ie,range:Se,...oe}=T,Ce=[{provided:["x"],derivedKeys:["x"]},{provided:["y","measures"],derivedKeys:["y","measures"]},{provided:["series"],derivedKeys:["series"]}],ze={...K.spec};for(const Ee of Ce)if(Ee.provided.some(Re=>Re in oe))for(const Re of Ee.derivedKeys)delete ze[Re];return xn({...oe,...ze,grid:We,container:ie})}function no(We,T={}){return!!Rt(We,T).spec}});var Wt=fn("packages/modules/charts/index.js");if(typeof module=="object"&&module.exports)module.exports=Wt;else if(typeof define=="function"&&define.amd)define(function(){return Wt});else{var Sn=ln.LatticeGrid||(ln.LatticeGrid={});for(var Qt in Wt)Qt!=="default"&&(Sn[Qt]=Wt[Qt])}})(typeof globalThis<"u"?globalThis:this);
|
|
227
231
|
|
|
228
232
|
//# sourceMappingURL=charts.min.js.map
|