expressive-charts 0.2.0 → 0.4.0
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 +69 -1
- package/README.md +10 -10
- package/dist/define-DeZLs1h7.js +95 -0
- package/dist/define-DeZLs1h7.js.map +1 -0
- package/dist/drawing-Dz_IvJPB.d.cts +208 -0
- package/dist/drawing-Dz_IvJPB.d.ts +208 -0
- package/dist/effect-CdH5449m.d.ts +232 -0
- package/dist/effect-uYC8Vs6_.d.cts +232 -0
- package/dist/expressive-charts.css +8 -1
- package/dist/expressive-charts.css.d.cts +1 -0
- package/dist/expressive-charts.css.d.ts +1 -0
- package/dist/expressive-charts.global.js +50 -47
- package/dist/expressive-charts.global.js.map +1 -1
- package/dist/icons/sport.cjs +211 -152
- package/dist/icons/sport.cjs.map +1 -1
- package/dist/icons/sport.d.cts +5 -7
- package/dist/icons/sport.d.ts +5 -7
- package/dist/icons/sport.js +122 -71
- package/dist/icons/sport.js.map +1 -1
- package/dist/index.cjs +12647 -9513
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +929 -859
- package/dist/index.d.ts +929 -859
- package/dist/index.js +10452 -7822
- package/dist/index.js.map +1 -1
- package/dist/path-data-DnEckjY8.js +123 -0
- package/dist/path-data-DnEckjY8.js.map +1 -0
- package/dist/testing.cjs +2034 -1222
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +137 -141
- package/dist/testing.d.ts +137 -141
- package/dist/testing.js +696 -501
- package/dist/testing.js.map +1 -1
- package/dist/transition-DSRt2DH3.js +2053 -0
- package/dist/transition-DSRt2DH3.js.map +1 -0
- package/package.json +18 -6
- package/dist/chunk-CVXP2L2J.js +0 -1182
- package/dist/chunk-CVXP2L2J.js.map +0 -1
- package/dist/chunk-N5IF2RO2.js +0 -66
- package/dist/chunk-N5IF2RO2.js.map +0 -1
- package/dist/chunk-V5IUTXRW.js +0 -571
- package/dist/chunk-V5IUTXRW.js.map +0 -1
- package/dist/drawing-DWZIXIeR.d.cts +0 -194
- package/dist/drawing-DWZIXIeR.d.ts +0 -194
- package/dist/effect-CZUckY0l.d.ts +0 -245
- package/dist/effect-CcGdU41j.d.cts +0 -245
|
@@ -1,93 +1,96 @@
|
|
|
1
|
-
"use strict";var ExpressiveCharts=(()=>{var Mo=Object.defineProperty;var Mc=Object.getOwnPropertyDescriptor;var Sc=Object.getOwnPropertyNames;var Ec=Object.prototype.hasOwnProperty;var Dc=(e,t)=>{for(var n in t)Mo(e,n,{get:t[n],enumerable:!0})},Tc=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Sc(t))!Ec.call(e,o)&&o!==n&&Mo(e,o,{get:()=>t[o],enumerable:!(r=Mc(t,o))||r.enumerable});return e};var Rc=e=>Tc(Mo({},"__esModule",{value:!0}),e);var em={};Dc(em,{VERSION:()=>Uf,animated:()=>Be,barChart:()=>Wf,chartSwitch:()=>Jf,colorAssignment:()=>Hr,configure:()=>vc,createClock:()=>Cr,createMotion:()=>Eo,defaultClock:()=>Fe,defaultScaling:()=>ar,defineDataEffect:()=>fc,defineEffect:()=>uc,defineIcon:()=>yn,delta:()=>Xs,describe:()=>Ye,donutChart:()=>Zf,easeInOutCubic:()=>nt,easeOutCubic:()=>It,expressive:()=>Yf,flash:()=>ho,fromVegaView:()=>Xf,gaits:()=>Tr,iconFromSvg:()=>gc,icons:()=>xo,interpolateNumber:()=>ct,interpolatePoint:()=>Ka,interpolateRecord:()=>xt,label:()=>Qs,lineChart:()=>qf,linear:()=>yt,link:()=>zo,manualClock:()=>za,matrix:()=>xe,mediaReducedMotion:()=>Do,morph:()=>vo,motion:()=>kt,motionSwitch:()=>Qf,offset:()=>rn,only:()=>ic,parallel:()=>ac,playButton:()=>La,playback:()=>Ua,pulse:()=>bo,registerIcon:()=>Fa,registerIcons:()=>wc,registerPreset:()=>bc,samplesAlong:()=>dr,scaleDuration:()=>ir,sequence:()=>oc,stagger:()=>sc,threshold:()=>tc,trace:()=>qs,travel:()=>js,tween:()=>en,wiggle:()=>go});function Se(e){let t=globalThis.reportError;typeof t=="function"?t(e):console.error(e)}function Cr(e=Cc()){let t=new Set,n,r=()=>{!n&&t.size>0&&(n=e.request(o))},o=a=>{n=void 0;for(let i of[...t])if(t.has(i))try{i(a)}catch(s){Se(s)}r()};return{now:()=>e.now(),onFrame(a){let i=s=>a(s);return t.add(i),r(),()=>{t.delete(i)&&t.size===0&&n&&(n(),n=void 0)}}}}function za(e=0){let t=e,n,r=Cr({now:()=>t,request(o){return n=o,()=>{n===o&&(n=void 0)}}});return{now:r.now,onFrame:r.onFrame,get idle(){return n===void 0},advance(o){if(!(o>=0))throw new RangeError(`manualClock.advance needs a non-negative number of ms, got ${o}`);t+=o;let a=n;n=void 0,a?.(t)}}}function Cc(){let e=()=>typeof performance<"u"?performance.now():Date.now();return{now:e,request(t){if(typeof requestAnimationFrame=="function"){let r=requestAnimationFrame(t);return()=>cancelAnimationFrame(r)}let n=setTimeout(()=>t(e()),16);return()=>clearTimeout(n)}}}var Fe=Cr();var yt=e=>e,nt=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,It=e=>1-Math.pow(1-e,3);function Lr(e){return e<.5?Math.cbrt(e/4):1-Math.cbrt(2*(1-e))/2}var ar={presentation:{feedback:{factor:1},transition:{factor:1},effect:{factor:1},playback:{factor:1},stagger:{factor:1}},analysis:{feedback:{factor:1},transition:{factor:.35,max:200},effect:{factor:.35,min:140,max:300},playback:{factor:.3},stagger:{factor:0}}},_a=["presentation","analysis","off"],Pr=["feedback","transition","effect","playback","stagger"];function Eo(e={}){let t=So(e.mode??"presentation"),n,r=Lc(e.scaling),o=e.reducedMotion??Do(),a=new Set,i,s=()=>n??(o.matches?"off":t),c=()=>{for(let d of[...a])if(a.has(d))try{d()}catch(l){Se(l)}};return{get mode(){return s()},get staged(){return s()==="presentation"},get requested(){return t},get viewerChoice(){return n},get prefersReduced(){return o.matches},duration(d,l="transition"){let u=s();return u==="off"?0:ir(d,r[u][l])},setMode(d){So(d),d!==t&&(t=d,c())},chooseMode(d){So(d),d!==n&&(n=d,c())},clearChoice(){n!==void 0&&(n=void 0,c())},subscribe(d){let l=()=>d();return a.add(l),i??(i=o.subscribe(c)),()=>{!a.delete(l)||a.size>0||(i?.(),i=void 0)}}}}function ir(e,t){if(!(e>0))return 0;let n=Math.min(e,t.min??0),r=t.max??1/0;return Math.min(Math.max(e*t.factor,n),r)}function Do(e="(prefers-reduced-motion: reduce)"){let t,n=()=>{if(t===void 0)try{t=typeof matchMedia=="function"?matchMedia(e):null}catch{t=null}return t};return{get matches(){return n()?.matches??!1},subscribe(r){let o=n();if(!o)return()=>{};let a=()=>r();return typeof o.addEventListener=="function"?(o.addEventListener("change",a),()=>o.removeEventListener("change",a)):(o.addListener(a),()=>o.removeListener(a))}}}function So(e){if(!_a.includes(e))throw new TypeError(`Unknown motion mode "${String(e)}". Use one of: ${_a.join(", ")}.`);return e}function Lc(e={}){let t=n=>{let r={...ar[n]};for(let o of Pr){let a=e[n]?.[o];a&&(r[o]=a)}return r};return{presentation:t("presentation"),analysis:t("analysis")}}var kt=Eo();function en(e,t={}){let n=t.clock??Fe,r=t.motion??kt,o=e.timing??"transition",a=e.ease??nt,i=r.duration(e.duration,o),s=e.delay?r.duration(e.delay,o):0,{update:c,signal:d}=e,l=n.now(),u="running",f,h,w=new Promise(O=>{h=O}),v=O=>{u=O,f?.(),f=void 0,d?.removeEventListener("abort",D),h(O)};function D(){u==="running"&&v("cancelled")}let F=!1;function P(){u!=="running"||F||(F=!0,V(1),u==="running"&&v("done"))}function V(O){try{c(a(O))}catch(G){throw D(),G}}let x=O=>{if(r.mode==="off"){P();return}let G=O-l-s;G>=i?P():G>0&&V(G/i)},R={finished:w,get state(){return u},cancel:D,finish:P};return d?.aborted?(v("cancelled"),R):(d?.addEventListener("abort",D,{once:!0}),i<=0&&s<=0?(P(),R):(V(0),u==="running"&&(f=n.onFrame(x)),R))}var ct=(e,t)=>n=>e*(1-n)+t*n,Ka=(e,t)=>n=>({x:e.x*(1-n)+t.x*n,y:e.y*(1-n)+t.y*n});function xt(e,t){let n=[...new Set([...Object.keys(e),...Object.keys(t)])];return r=>{if(r===1)return{...t};let o={};for(let a of n)o[a]=(e[a]??0)*(1-r)+(t[a]??0)*r;return o}}function Be(e,t,n={}){let{onChange:r,...o}=n,a=e,i=e,s,c=!1,d=u=>{a=u,r?.(u)},l=()=>{let u=s;s=void 0,c=!1,u?.cancel()};return{get value(){return a},get target(){return s?.state==="cancelled"?a:i},get animating(){return s?.state==="running"},to(u,f){let h=s?.state==="running"&&c&&!(f.delay&&f.delay>0);l(),i=u;let w=t(a,u),v=!1,D=en({duration:f.duration,timing:f.timing,ease:f.ease??(h?It:nt),delay:f.delay,signal:f.signal,update:F=>{v&&(c=!0),v=!0,d(w(F))}},o);return s=D,D.finished},set(u){l(),i=u,d(u)},stop(){l(),i=a}}}var Pc=350;function Ua(e){Oc(e);let{from:t,to:n,duration:r,onFrame:o}=e,a=e.ease??yt,i=e.timing??"playback",s=e.clock??Fe,c=e.motion??kt,d=Math.min(t,n),l=Math.max(t,n),u=n,f=!1,h=!1,w,v=0,D=new Set,F=g=>{for(let E of[...D])if(D.has(E))try{E(g)}catch(U){Se(U)}},P=()=>{let g=w;return w=void 0,g?.stop(),g?.moved??!1},V=()=>{f&&(f=!1,F("pause"))},x=g=>{throw v++,P(),V(),g},R=g=>{if(g!==u){u=g;try{o(g)}catch(E){x(E)}}},O=(g,E,U,k)=>{let T=v;if(!(E>0)){R(g),v===T&&k();return}let H=u,_=s.now(),te={moved:!1,stop:s.onFrame(ae=>{let z=c.mode==="off"?1:(ae-_)/E;if(z<1){te.moved=!0;let Z;try{Z=U(z)}catch(se){return x(se)}R(H+(g-H)*Z);return}P(),R(g),v===T&&k()})};w=te},G=()=>{f=!1,F("end")};return{get position(){return u},get playing(){return f},play(){if(h||f)return;let g=++v;if(P(),f=!0,F("play"),v!==g)return;let E=c.duration(r,i);E>0&&u===n&&(R(t),v!==g)||O(n,E*Math.abs(n-u)/Math.abs(n-t),a,G)},pause(){h||!f||(v++,P(),V())},seek(g,E={}){if(Ac(g,E),h)return;let U=++v,k=P();if(V(),v!==U||(F("seek"),v!==U))return;let T=E.animate===!1?0:c.duration(Pc,"transition");O(Math.min(Math.max(g,d),l),T,k?It:nt,()=>{})},subscribe(g){if(typeof g!="function")throw new TypeError(`playback.subscribe needs a function, got ${typeof g}.`);if(h)return()=>{};let E=U=>g(U);return D.add(E),()=>{D.delete(E)}},destroy(){h||(h=!0,v++,P(),V(),D.clear())}}}function Oc(e){if(typeof e!="object"||e===null)throw new TypeError("playback needs options: { from, to, duration, onFrame }.");let{from:t,to:n,duration:r,ease:o,timing:a,onFrame:i,clock:s,motion:c}=e;for(let[d,l]of[["from",t],["to",n]])if(!To(l))throw new RangeError(`playback: ${d} must be a finite number, got ${String(l)}.`);if(t===n)throw new RangeError(`playback: from and to must differ, got ${t} for both.`);if(!To(r)||r<0)throw new RangeError(`playback: duration must be a non-negative number of ms, got ${String(r)}.`);if(typeof i!="function")throw new TypeError(`playback: onFrame must be a function, got ${typeof i}.`);if(o!==void 0&&typeof o!="function")throw new TypeError(`playback: ease must be a function, got ${typeof o}.`);if(a!==void 0&&!Pr.includes(a))throw new RangeError(`playback: timing must be one of ${Pr.join(", ")}, got ${JSON.stringify(a)??String(a)}.`);if(s!==void 0&&(typeof s?.now!="function"||typeof s.onFrame!="function"))throw new TypeError("playback: clock must be a Clock, such as one from createClock() or manualClock().");if(c!==void 0&&typeof c?.duration!="function")throw new TypeError("playback: motion must be a Motion, such as the page-wide `motion` or one from createMotion().")}function Ac(e,t){if(!To(e))throw new RangeError(`playback.seek needs a finite number, got ${String(e)}.`);if(typeof t!="object"||t===null)throw new TypeError("playback.seek's options must be an object, such as { animate: false }.");if(t.animate!==void 0&&typeof t.animate!="boolean")throw new TypeError(`playback.seek: animate must be true or false, got ${String(t.animate)}.`)}function To(e){return typeof e=="number"&&Number.isFinite(e)}var Vt=2*Math.PI;function rt(e,t,n=0){let r=t.x-e.x,o=t.y-e.y,a=Math.hypot(r,o);return{kind:"line",from:e,to:t,length:a,angle:a>0?Math.atan2(o,r):sr(n)}}function Mt(e,t,n,r){return{kind:"arc",center:e,radius:t,start:n,sweep:r,length:t*Math.abs(r)}}function Nt(e,t){if(e.kind==="line"){let{from:n,to:r}=e;return{x:n.x*(1-t)+r.x*t,y:n.y*(1-t)+r.y*t}}return Ft(e.center,e.radius,e.start+e.sweep*t)}function Ro(e,t){if(e.kind==="line")return e.angle;let n=e.sweep<0?-Math.PI/2:Math.PI/2;return sr(e.start+e.sweep*t+n)}function Ft(e,t,n){return{x:e.x+t*Math.cos(n),y:e.y+t*Math.sin(n)}}function sr(e){return e-Vt*Math.ceil((e-Math.PI)/Vt)}function Co(e){if(e.kind==="line")return[e.from,e.to];let t=[Nt(e,0),Nt(e,1)];for(let n=0;n<4;n++){let r=n*Math.PI/2;$c(e,r)&&t.push(Ft(e.center,e.radius,r))}return t}function pn(e){let t=1/0,n=1/0,r=-1/0,o=-1/0;for(let{x:a,y:i}of e)a<t&&(t=a),a>r&&(r=a),i<n&&(n=i),i>o&&(o=i);return{x:t,y:n,width:r-t,height:o-n}}function $c(e,t){let n=Math.abs(e.sweep);return n>=Vt?!0:((e.sweep>=0?t-e.start:e.start-t)%Vt+Vt)%Vt<=n}function Ze(e){let t=Math.round(e*1e3)/1e3;return t===0?"0":String(t)}function Or(e){return`M${Ze(e.x)},${Ze(e.y)}`}function Ar(e,t=0,n=1){if(e.kind==="line"){let d=n===1?e.to:Nt(e,n);return`L${Ze(d.x)},${Ze(d.y)}`}let r=e.start+e.sweep*t,o=e.sweep*(n-t),a=Math.max(1,Math.ceil(Math.abs(o)/Math.PI-1e-9)),i=Ze(e.radius),s=o>=0?1:0,c="";for(let d=1;d<=a;d++){let l=Ft(e.center,e.radius,r+o*d/a);c+=`A${i},${i} 0 0 ${s} ${Ze(l.x)},${Ze(l.y)}`}return c}function cr(e,t=!1){let n=e[0];if(!n)return"";let r=e.length;if(t){for(;r>0&&e[r-1].length<=0;)r--;r>0&&e[r-1].kind==="line"&&r--}let o=Or(Nt(n,0));for(let a=0;a<r;a++){let i=e[a];i.length>0&&(o+=Ar(i))}return t?`${o}Z`:o}var $r=e=>e>0?e<1?e:1:0;function Bt(e){let t=e[0],n=e[e.length-1];if(!t||!n)throw new RangeError("A walk needs at least one segment.");let r=[0];for(let d of e)r.push(r[r.length-1]+d.length);let o=r[e.length],a=Nt(t,0),i=Nt(n,1),s=d=>{if(!(o>0))return{index:0,u:0};if(d>=o){let f=e.length-1;for(;f>0&&!(e[f].length>0);)f--;return{index:f,u:1}}let l=0,u=e.length-1;for(;l<u;){let f=l+u>>1;r[f+1]>d?u=f:l=f+1}return{index:l,u:Math.min(1,(d-r[l])/e[l].length)}},c=d=>{let l=$r(d);if(l===0)return a;if(l===1)return i;let{index:u,u:f}=s(l*o);return Nt(e[u],f)};return{segments:e,length:o,start:a,end:i,point:c,angle(d){let{index:l,u}=s($r(d)*o);return Ro(e[l],u)},slice(d,l){let u=$r(Math.min(d,l)),f=$r(Math.max(d,l)),h=Or(c(u)),w=u*o,v=f*o;if(!(v>w))return h;let D=s(w);for(let F=D.index;F<e.length&&r[F]<v;F++){let P=e[F];if(!(P.length>0))continue;let V=F===D.index?D.u:0,x=r[F+1]>v?Math.min(1,(v-r[F])/P.length):1;x>V&&(h+=Ar(P,V,x))}return h},d:cr(e)}}function En(e){let t=e.map(Bt);return{d:cr(e.flat(),!0),closed:!0,sample(n){Za(n,4);let r=n/4,o=[];for(let a of t)for(let i=0;i<r;i++)o.push(a.point(i/r));return o}}}function Wa(e){return{d:e.d,closed:!1,sample(t){if(Za(t,1),t===1)return[e.start];let n=[];for(let r=0;r<t;r++)n.push(e.point(r/(t-1)));return n}}}function Za(e,t){if(!Number.isInteger(e)||e<0||e%t!==0){let n=t===1?"a whole number \u2265 0":`a whole multiple of ${t}`;throw new RangeError(`outline.sample(n): n must be ${n}, got ${e}.`)}}function tn({key:e,series:t,walk:n,thickness:r,outline:o,bounds:a,center:i,pivot:s,labelBounds:c,segments:d}){return{key:e,...t===void 0?{}:{series:t},start:n.start,end:n.end,length:n.length,path:l=>n.point(l),angle:l=>n.angle(l),slice:(l,u)=>n.slice(l,u),thickness:r,outline:o,bounds:a,center:i,pivot:s,...c===void 0?{}:{labelBounds:c},...d===void 0?{}:{segments:d}}}function ot(e,t,n){if(!Number.isFinite(n))throw new RangeError(`describe.${e}: ${t} must be a finite number, got ${n}.`);return n}function nn(e,t){if(!t)return t;for(let n=0;n<t.length;n++){let{x:r,y:o,width:a,height:i}=t[n];Number.isFinite(r)&&Number.isFinite(o)&&Number.isFinite(a)&&a>=0&&Number.isFinite(i)&&i>=0||(ot(e,`labelBounds[${n}].x`,r),ot(e,`labelBounds[${n}].y`,o),lt(e,`labelBounds[${n}].width`,a),lt(e,`labelBounds[${n}].height`,i))}return t}function lt(e,t,n){if(!(Number.isFinite(n)&&n>=0))throw new RangeError(`describe.${e}: ${t} must be a finite number \u2265 0, got ${n}.`);return n}function qa(e){let{key:t,series:n}=e,r={x:ot("arc","cx",e.cx),y:ot("arc","cy",e.cy)},o=Math.min(lt("arc","inner",e.inner),lt("arc","outer",e.outer)),a=Math.max(e.inner,e.outer);ot("arc","start",e.start),ot("arc","end",e.end);let i=Math.max(-Vt,Math.min(Vt,e.end-e.start)),s=e.start-Math.PI/2,c=s+i,[d,l]=i>=0?[a,o]:[o,a],u=[[Mt(r,d,s,i)],[rt(Ft(r,d,c),Ft(r,l,c),c+(d>l?Math.PI:0))],[Mt(r,l,c,-i)],[rt(Ft(r,l,s),Ft(r,d,s),s+(d>l?0:Math.PI))]],f=Bt([Mt(r,(o+a)/2,s,i)]);return tn({key:t,series:n,walk:f,thickness:a-o,outline:En(u),bounds:pn(u.flat().flatMap(Co)),center:f.point(.5),pivot:r,labelBounds:nn("arc",e.labelBounds)})}var Ja={left:0,right:Math.PI,top:Math.PI/2,bottom:-Math.PI/2};function Ya(e){let{key:t,series:n,baseline:r,x:o,y:a,width:i,height:s}=e;if(!Object.prototype.hasOwnProperty.call(Ja,r))throw new RangeError(`describe.bar: baseline must be left, right, top or bottom, got ${String(r)}.`);ot("bar","x",o),ot("bar","y",a),lt("bar","width",i),lt("bar","height",s);let c=lt("bar","radius",e.radius??0),d=lt("bar","gap",e.gap??0),l=nn("bar",e.labelBounds),u=r==="left"||r==="right",f=u?i:s,h=u?s:i,w=h,v=Ja[r],D=Gc(e),F=(G,g,E,U)=>{let k=Math.max(0,Math.min(E,g-G,w/2)),T=En([[rt(D(G,0),D(g-k,0),v)],k>0?[Mt(D(g-k,k),k,v-Math.PI/2,Math.PI/2),rt(D(g,k),D(g,w-k),v+Math.PI/2),Mt(D(g-k,w-k),k,v,Math.PI/2)]:[rt(D(g,0),D(g,w),v+Math.PI/2)],[rt(D(g-k,w),D(G,w),v+Math.PI)],[rt(D(G,w),D(G,0),v-Math.PI/2)]]),H=Bt([rt(D(G,w/2),D(g,w/2),v)]);return tn({...U,walk:H,thickness:h,outline:T,bounds:U.bounds??pn([D(G,0),D(g,w)]),center:D((G+g)/2,w/2),pivot:H.start})},P=e.segments??[{series:n,size:f}],V=new Set,x=0,O=P.map((G,g)=>{if(lt("bar",`segments[${g}].size`,G.size),G.series!==void 0){if(V.has(G.series))throw new Error(`describe.bar: series "${G.series}" appears twice in the segments of "${t}".`);V.add(G.series)}let E=Math.min(x,f);x+=G.size;let U=Math.min(x,f);return{segment:G,index:g,p0:Math.min(E+Math.min(d,E),U),p1:U}}).map(({segment:G,index:g,p0:E,p1:U})=>F(E,U,c-(f-U),{key:G.series===void 0?`${t}/${g}`:`${t}/${G.series}`,series:G.series}));return F(0,f,c,{key:t,series:n,bounds:{x:o,y:a,width:i,height:s},labelBounds:l,segments:O})}function Gc({x:e,y:t,width:n,height:r,baseline:o}){switch(o){case"left":return(a,i)=>({x:e+a,y:t+i});case"right":return(a,i)=>({x:e+n-a,y:t+r-i});case"top":return(a,i)=>({x:e+n-i,y:t+a});case"bottom":return(a,i)=>({x:e+i,y:t+r-a})}}function Xa(e){let{key:t,series:n,points:r}=e,o=lt("line","width",e.width??1),a=r[0];if(!a)throw new RangeError(`describe.line: "${t}" needs at least one point.`);r.forEach((l,u)=>{ot("line",`points[${u}].x`,l.x),ot("line",`points[${u}].y`,l.y)});let i=[];for(let l=1;l<r.length;l++)i.push(rt(r[l-1],r[l],i[i.length-1]?.angle??0));i.length===0&&i.push(rt(a,a));let s=Bt(i),c=pn(r),d=o/2;return tn({key:t,series:n,walk:s,thickness:o,outline:Wa(s),bounds:{x:c.x-d,y:c.y-d,width:c.width+o,height:c.height+o},center:s.point(.5),pivot:a,labelBounds:nn("line",e.labelBounds)})}function Qa(e){let{key:t,series:n}=e,r={x:ot("point","x",e.x),y:ot("point","y",e.y)},o=lt("point","r",e.r),a=Math.PI/2;return tn({key:t,series:n,walk:Bt([rt(r,r)]),thickness:2*o,outline:En([[Mt(r,o,-3*a/2,a)],[Mt(r,o,-a/2,a)],[Mt(r,o,a/2,a)],[Mt(r,o,3*a/2,a)]]),bounds:{x:r.x-o,y:r.y-o,width:2*o,height:2*o},center:r,pivot:r,labelBounds:nn("point",e.labelBounds)})}var Ye={bar:Ya,arc:qa,line:Xa,point:Qa};function ei(e,t){return[1,0,0,1,e,t]}function ti(e,t){let n=Math.cos(e),r=Math.sin(e);return oi([n,r,-r,n,0,0],t)}function ni(e,t=e,n){return oi([e,0,0,t,0,0],n)}function ri(...e){let t=[1,0,0,1,0,0];for(let n of e)t=Vc(t,n);return t}function Ic(e,t){let[n,r,o,a,i,s]=e;return{x:n*t.x+o*t.y+i,y:r*t.x+a*t.y+s}}function Vc(e,t){let[n,r,o,a,i,s]=e,[c,d,l,u,f,h]=t;return[n*c+o*d,r*c+a*d,n*l+o*u,r*l+a*u,n*f+o*h+i,r*f+a*h+s]}function oi(e,t){if(!t)return e;let[n,r,o,a]=e;return[n,r,o,a,t.x-n*t.x-o*t.y,t.y-r*t.x-a*t.y]}var xe={translate:ei,rotate:ti,scale:ni,multiply:ri,apply:Ic};function Dn(e){let[t,n,r,o,a,i]=e,s=t*o-n*r;if(!Number.isFinite(s)||Math.abs(s)<1e-12)throw new RangeError("This transform can't be inverted: it has no area.");return[o/s,-n/s,-r/s,t/s,(r*i-o*a)/s,(n*a-t*i)/s]}function lr(e){let t=[];for(let[,n,r=""]of e.matchAll(/(matrix|translate|scale|rotate|skewX|skewY)\s*\(([^)]*)\)/g)){let o=r.trim().split(/[\s,]+/).filter(Boolean).map(Number);if(!o.every(Number.isFinite))continue;let[a=0,i,s,c=0,d=0,l=0]=o,u=f=>f*Math.PI/180;switch(n){case"matrix":o.length===6&&t.push([a,i,s,c,d,l]);break;case"translate":t.push(ei(a,i??0));break;case"scale":t.push(ni(a,i??a));break;case"rotate":t.push(ti(u(a),i!==void 0&&s!==void 0?{x:i,y:s}:void 0));break;case"skewX":t.push([1,0,Math.tan(u(a)),1,0,0]);break;case"skewY":t.push([1,Math.tan(u(a)),0,1,0,0]);break}}return ri(...t)}function rn(e,t,n){return{x:e.x+n*Math.cos(t),y:e.y+n*Math.sin(t)}}var Gr=(Math.sqrt(5)-1)/2;function dr(e,t){if(typeof e!="object"||e===null||typeof e.path!="function"||!Number.isFinite(e.length))throw new TypeError("samplesAlong needs a MarkGeometry, as describe builds it.");if(!Array.isArray(t))throw new TypeError("samplesAlong needs an array of points { x, y, value, at? }.");t.forEach((o,a)=>{for(let i of["x","y","value"]){let s=o?.[i];if(typeof s!="number"||!Number.isFinite(s))throw new RangeError(`samplesAlong: points[${a}].${i} must be a finite number, got ${String(s)}.`)}});let n=e.length>0?Math.min(4096,Math.ceil(e.length)+1):1,r=Array.from({length:n},(o,a)=>e.path(n===1?0:a/(n-1)));return t.map((o,a)=>({index:a,sample:{t:Nc(e,r,o),value:o.value,...o.at===void 0?{}:{at:o.at}}})).sort((o,a)=>o.sample.t-a.sample.t||o.index-a.index).map(({sample:o})=>o)}function Nc(e,t,n){let r=t.length;if(r===1)return 0;let o=0,a=1/0;t.forEach((v,D)=>{let F=ai(v,n);F<a&&(o=D,a=F)});let i=v=>ai(e.path(v),n),s=Math.max(0,o-1)/(r-1),c=Math.min(r-1,o+1)/(r-1),d=c-Gr*(c-s),l=s+Gr*(c-s),u=i(d),f=i(l);for(let v=0;v<48;v++)u<=f?(c=l,l=d,f=u,d=c-Gr*(c-s),u=i(d)):(s=d,d=l,u=f,l=s+Gr*(c-s),f=i(l));let h=(s+c)/2,w=i(h)<a?h:o/(r-1);return w>0?w<1?w:1:0}function ai(e,t){return(e.x-t.x)**2+(e.y-t.y)**2}function Lo(e){let{kind:t,hint:n}=e,r=new Map,o={get:a=>r.get(a),resolve(a){let i=r.get(a);if(i!==void 0)return i;let s=r.size>0?[...r.keys()].join(", "):"none";throw new RangeError(`Unknown ${t} "${String(a)}". Registered ${t}s: ${s}.${n?` ${n}`:""}`)},register(a,i){if(typeof a!="string"||a==="")throw new TypeError(`A ${t} needs a non-empty string name, got ${JSON.stringify(a)}.`);if(i===void 0)throw new TypeError(`Registering ${t} "${a}" needs a value.`);r.set(a,i)},names:()=>[...r.keys()]};for(let[a,i]of Object.entries(e.entries??{}))o.register(a,i);return o}var Ht=["hover","enter","update","exit","decorate"];function jt(e,t){let n={};for(let r of Object.keys(e??{}))if(!Ht.includes(r))throw new TypeError(`on.${r} isn't an effect slot. Use one of: ${Ht.join(", ")}.`);for(let r of Ht){let o=e?.[r];if(o!==void 0)if(typeof o=="string"){let a=t.resolve(o)();if(!Ir(a))throw new TypeError(`Preset "${o}" for on.${r} didn't return a mark effect; it returned ${ur(a)}.`);n[r]=a}else{if(!Ir(o))throw new TypeError(`on.${r} needs a mark effect (kind "geometry" or "data") or a preset name, got ${ur(o)}.`);n[r]=o}}return n}function Ir(e){if(typeof e!="object"||e===null)return!1;let t=e;return(t.kind==="geometry"||t.kind==="data")&&typeof t.run=="function"&&typeof t.end=="function"&&typeof t.clear=="function"}function ur(e){if(typeof e!="object"||e===null)return e===null?"null":typeof e;let t=e.kind;return t==="transition"?"a transition effect, which runs between two charts rather than on one mark":t==="geometry"||t==="data"?`a ${t} effect without run(), end() and clear()`:t===void 0?"an object with no kind":`an effect of kind ${JSON.stringify(t)}`}function Yt(e,t){let n={...e};for(let[r,o]of Object.entries(t??{}))o===void 0?delete n[r]:n[r]=o;return n}function Oo(e){let{clock:t,motion:n,layer:r,mark:o}=e,a=new AbortController,i=[];return{context:{signal:a.signal,motion:n,mark:o,layer:r,icons:e.icons,batch:e.batch,...e.previous?{previous:e.previous}:{},tween(c){let d=c.signal,l=en({...c,signal:d??a.signal},{clock:t,motion:n});return d&&d!==a.signal&&(a.signal.aborted?l.cancel():a.signal.addEventListener("abort",()=>l.cancel(),{once:!0})),l},onChange(c){i.push(c)}},abort(){a.abort()},change(c,d){for(let l of[...i])l(c,d)},clear(){a.abort(),r.clear(),o.reset(),i=[]}}}var Fc=["decorate","enter","update","exit","hover"],Bc={get:()=>{}},Po={place(){},update(){},remove(){}};function on(e){let{surface:t}=e,n=e.effects,r=e.motion??kt,o=e.clock??Fe,a=e.icons??Bc,i=new Map,s=new Set,c=!1,d=!1,l=0,u=r.subscribe(()=>{r.mode==="off"&&g()});function f(k){let T=k.mark.key,H=i.get(T);if(H)return H.mark=k.mark,H.data=k.data,H;let _={key:T,mark:k.mark,data:k.data,runs:new Map,applied:{},handle:void 0,exiting:void 0};return i.set(T,_),_}function h(k,T,H,_,te={}){let{previous:ae,done:z}=te,Z=n[T];if(!Z){z?.();return}let se=k.runs.get(T);se&&F(se);let de={entry:k,slot:T,order:te.order??++l,effect:Z,data:H,batch:_,previous:ae,style:{},state:"running",done:z,scope:Oo({clock:o,motion:r,icons:a,batch:_,previous:ae,layer:P(k.key,T,()=>de.order,()=>de.state!=="cleared"),mark:V(()=>de)})};k.runs.set(T,de);let we=te.mark??k.mark,A=de.scope.context;try{if(te.end||r.mode==="off")Z.kind==="data"?Z.end(we,H,A):Z.end(we,A),w(de);else{let j=Z.kind==="data"?Z.run(we,H,A):Z.run(we,A);Promise.resolve(j).then(()=>w(de),Q=>v(de,Q))}}catch(j){v(de,j)}}function w(k){k.state==="running"&&(k.state="ended",D(k))}function v(k,T){let{signal:H}=k.scope.context;H.aborted&&(T===H.reason||T?.name==="AbortError")||(Se(T),F(k))}function D(k){let T=k.done;k.done=void 0,T?.()}function F(k){if(k.state==="cleared")return;k.state="cleared";let{entry:T}=k;T.runs.get(k.slot)===k&&T.runs.delete(k.slot),k.scope.abort();try{k.effect.clear(k.scope.context)}catch(H){Se(H)}k.scope.clear(),D(k)}function P(k,T,H,_){let te,ae=()=>_()?te??(te=t.group(k,T,H())):void 0;return{icon:(z,Z)=>ae()?.icon(z,Z)??Po,path:(z,Z)=>ae()?.path(z,Z)??Po,text:(z,Z)=>ae()?.text(z,Z)??Po,clear(){let z=te;te=void 0,z?.clear()}}}function V(k){return{set(T){let H=k();H.state!=="cleared"&&(H.style=Yt(H.style,T),x(H.entry))},reset(){let T=k();Object.keys(T.style).length!==0&&(T.style={},x(T.entry))}}}function x(k){let T=[...k.runs.values()].sort((z,Z)=>z.order-Z.order),H=Object.assign({},...T.map(z=>z.style)),_=k.applied;if(k.applied=H,Object.keys(H).length===0){Object.keys(_).length>0&&R(k).reset();return}let te={},ae=!1;for(let z of new Set([...Object.keys(_),...Object.keys(H)]))_[z]!==H[z]&&(te[z]=H[z],ae=!0);ae&&R(k).set(te)}function R(k){return k.handle??(k.handle=t.mark(k.key))}function O(k){i.get(k.key)===k&&i.delete(k.key),s.delete(k.key);let T=k.exiting;k.exiting=void 0;for(let H of[...k.runs.values()])F(H);k.handle=void 0,T?.()}function G(k){let T=k.exiting;if(!T)return;k.exiting=void 0;let H=k.runs.get("exit");H&&F(H),T()}function g(){for(let k of[...i.values()])for(let T of[...k.runs.values()]){if(T.state!=="running"||k.runs.get(T.slot)!==T)continue;let H=T.done;T.done=void 0,h(k,T.slot,U(k,T),T.batch,{previous:T.previous,done:H,order:T.order})}}function E(k){let T=new Map;for(let H of[...i.values()]){let _=H.runs.get(k);_&&(T.set(H,_.order),F(_))}return T}function U(k,T){let H=T.data.previous;return H&&!k.data.previous?ii(k.data,H):k.data}return{enter(k){d||k.forEach((T,H)=>{let _=f(T);G(_);let te={index:H,count:k.length};h(_,"decorate",T.data,te),h(_,"enter",T.data,te)})},update(k){d||k.forEach((T,H)=>{let _=i.get(T.mark.key),te=T.from??_?.mark,ae=_&&!T.data.previous?ii(T.data,_.data):T.data;h(f(T),"update",ae,{index:H,count:k.length},{previous:te})})},exit(k){if(d)return Promise.resolve();let T=k.map((H,_)=>{let te=f(H);G(te),s.delete(te.key);for(let ae of[...te.runs.values()])F(ae);return new Promise(ae=>{if(te.exiting=ae,!n.exit){O(te);return}h(te,"exit",H.data,{index:_,count:k.length},{done:()=>{te.exiting&&i.get(te.key)===te&&O(te)}})})});return Promise.all(T).then(()=>{})},hover(k){d||k.forEach((T,H)=>{let _=f(T);_.exiting||(s.add(_.key),c||h(_,"hover",T.data,{index:H,count:k.length}))})},leave(k=[...s]){for(let T of k){s.delete(T);let H=i.get(T)?.runs.get("hover");H&&F(H)}},change(k,T){let H=i.get(k.key);if(H){H.mark=k,T&&(H.data=T);for(let _ of[...H.runs.values()])if(_.state!=="cleared")try{_.scope.change(k,U(H,_))}catch(te){Se(te),F(_)}}},interrupt(){if(!d){c=!0;for(let k of[...i.values()]){let T=k.runs.get("hover");T&&F(T)}}},settle(){if(!c)return;c=!1;let k=[...s];k.forEach((T,H)=>{let _=i.get(T);_&&h(_,"hover",_.data,{index:H,count:k.length})})},swap(k,T){if(d)return;let H=Fc.filter(_=>k[_]!==n[_]);n=k;for(let _ of H)if(_==="decorate"){let te=E(_);T.forEach((ae,z)=>{let Z=i.get(ae.mark.key)??f(ae);Z.exiting||h(Z,_,ae.data,{index:z,count:T.length},{mark:ae.mark,order:te.get(Z)})})}else if(_==="hover"){if(E(_),c)continue;let te=[...s];te.forEach((ae,z)=>{let Z=i.get(ae);Z&&h(Z,_,Z.data,{index:z,count:te.length})})}else for(let te of[...i.values()]){let ae=te.runs.get(_);if(!ae)continue;let z=ae.done;ae.done=void 0;let Z=U(te,ae);F(ae),h(te,_,Z,ae.batch,{previous:ae.previous,done:z,order:ae.order,end:!0})}},destroy(){if(!d){d=!0,c=!1,u();for(let k of[...i.values()])O(k);s.clear()}}}}function ii(e,t){return{datum:e.datum,samples:e.samples,related:n=>e.related(n),previous:t}}var Hc={value:"Sorted highest first",key:"Sorted A to Z",none:"In data order",custom:"Sorted"},Ao=3;function Tn(e){let t=[],{series:n}=e;e.label!==void 0?t.push(e.label):n&&!(n.length===1&&n[0]==="value")&&t.push(`Showing ${Vr(n)}`),e.sort&&t.push(Hc[e.sort]);let{changed:r,added:o,removed:a}=e;return!n&&r.length>0&&t.push(r.length<=Ao?`${Vr(r)} changed`:`${r.length} of ${e.count} changed`),o.length>0&&t.push(`Added ${o.length<=Ao?Vr(o):o.length}`),a.length>0&&t.push(`Removed ${a.length<=Ao?Vr(a):a.length}`),t.join(". ")}function Vr(e){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function Ot(e){let t=e.ownerDocument.createElement("div");t.className="ec-announcer ec-visually-hidden",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),e.after(t);let n=!1;return{say(r){r!==""&&(n=!n,t.textContent=n?r:`${r}\xA0`)},destroy(){t.remove()}}}var jc="http://www.w3.org/2000/svg";function Y(e,t={},n){let o=(n?.ownerDocument??document).createElementNS(jc,e);return le(o,t),n?.appendChild(o),o}function le(e,t){for(let[n,r]of Object.entries(t))r===void 0?e.removeAttribute(n):e.setAttribute(n,typeof r=="number"?Ze(r):r)}function $e(e,t){for(let[n,r]of Object.entries(t))r===void 0?e.style.removeProperty(n):e.style.setProperty(n,r)}function At({width:e,height:t}){return{width:e,height:t,viewBox:`0 0 ${Ze(e)} ${Ze(t)}`}}function pt(e){let[t,n,r,o,a,i]=e;return`matrix(${[t,n,r,o].map(zc).join(" ")} ${Ze(a)} ${Ze(i)})`}function zc(e){let t=Math.round(e*1e6)/1e6;return t===0?"0":String(t)}var si=1.05,_c=.25,ci=.16;function an(e,t,n,r){let o=t(e.text.replace(/\d/g,"0"),n,r);return{x:(e.anchor==="start"?e.x:e.anchor==="end"?e.x-o:e.x-o/2)-ci*r,y:e.y-si*r,width:o+2*ci*r,height:(si+_c)*r}}function St(e,t){le(e,{x:t.x,y:t.y,"text-anchor":t.anchor}),e.textContent!==t.text&&(e.textContent=t.text)}var Kc=.6;function Rn(e){let t=new Map;return Object.assign((r,o,a)=>{if(r==="")return 0;let i=`${o}
|
|
2
|
-
|
|
3
|
-
${
|
|
4
|
-
`)}
|
|
5
|
-
${Ho(yr.light," ")}
|
|
1
|
+
"use strict";var ExpressiveCharts=(function(e){Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=globalThis.reportError;typeof t==`function`?t(e):console.error(e)}function n(e=i()){let n=/* @__PURE__ */ new Set,r,a=()=>{!r&&n.size>0&&(r=e.request(o))},o=e=>{r=void 0;for(let r of[...n])if(n.has(r))try{r(e)}catch(e){t(e)}a()};return{now:()=>e.now(),onFrame(e){let t=t=>e(t);return n.add(t),a(),()=>{n.delete(t)&&n.size===0&&r&&(r(),r=void 0)}}}}function r(e=0){let t=e,r,i=n({now:()=>t,request(e){return r=e,()=>{r===e&&(r=void 0)}}});return{now:i.now,onFrame:i.onFrame,get idle(){return r===void 0},advance(e){if(!(e>=0))throw RangeError(`manualClock.advance needs a non-negative number of ms, got ${e}`);t+=e;let n=r;r=void 0,n?.(t)}}}function i(){let e=()=>typeof performance<`u`?performance.now():Date.now();return{now:e,request(t){if(typeof requestAnimationFrame==`function`){let e=requestAnimationFrame(t);return()=>cancelAnimationFrame(e)}let n=setTimeout(()=>t(e()),16);return()=>clearTimeout(n)}}}let a=/* @__PURE__ */ n(),o=e=>e,s=e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2,c=e=>1-(1-e)**3;function l(e){return e<.5?Math.cbrt(e/4):1-Math.cbrt(2*(1-e))/2}let u={presentation:{feedback:{factor:1},transition:{factor:1},effect:{factor:1},playback:{factor:1},stagger:{factor:1}},analysis:{feedback:{factor:1},transition:{factor:.35,max:200},effect:{factor:.35,min:140,max:300},playback:{factor:.3},stagger:{factor:0}}},d=[`presentation`,`analysis`,`off`],f=[`feedback`,`transition`,`effect`,`playback`,`stagger`];function p(e={}){let n=g(e.mode??`presentation`),r,i=_(e.scaling),a=e.reducedMotion??h(),o=/* @__PURE__ */ new Set,s,c=()=>r??(a.matches?`off`:n),l=()=>{for(let e of[...o])if(o.has(e))try{e()}catch(e){t(e)}};return{get mode(){return c()},get staged(){return c()===`presentation`},get requested(){return n},get viewerChoice(){return r},get prefersReduced(){return a.matches},duration(e,t=`transition`){let n=c();return n===`off`?0:m(e,i[n][t])},setMode(e){g(e),e!==n&&(n=e,l())},chooseMode(e){g(e),e!==r&&(r=e,l())},clearChoice(){r!==void 0&&(r=void 0,l())},subscribe(e){let t=()=>e();return o.add(t),s??(s=a.subscribe(l)),()=>{!o.delete(t)||o.size>0||(s?.(),s=void 0)}}}}function m(e,t){if(!(e>0))return 0;let n=Math.min(e,t.min??0),r=t.max??1/0;return Math.min(Math.max(e*t.factor,n),r)}function h(e=`(prefers-reduced-motion: reduce)`){let t,n=()=>{if(t===void 0)try{t=typeof matchMedia==`function`?matchMedia(e):null}catch{t=null}return t};return{get matches(){return n()?.matches??!1},subscribe(e){let t=n();if(!t)return()=>{};let r=()=>e();return typeof t.addEventListener==`function`?(t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)):(t.addListener(r),()=>t.removeListener(r))}}}function g(e){if(!d.includes(e))throw TypeError(`Unknown motion mode "${String(e)}". Use one of: ${d.join(`, `)}.`);return e}function _(e={}){let t=t=>{let n={...u[t]};for(let r of f){let i=e[t]?.[r];i&&(n[r]=i)}return n};return{presentation:t(`presentation`),analysis:t(`analysis`)}}let v=/* @__PURE__ */ p();function y(e,t={}){let n=t.clock??a,r=t.motion??v,i=e.timing??`transition`,o=e.ease??s,c=r.duration(e.duration,i),l=e.delay?r.duration(e.delay,i):0,{update:u,signal:d}=e,f=n.now(),p=`running`,m,h,g=new Promise(e=>{h=e}),_=e=>{p=e,m?.(),m=void 0,d?.removeEventListener(`abort`,y),h(e)};function y(){p===`running`&&_(`cancelled`)}let b=!1;function x(){p!==`running`||b||(b=!0,S(1),p===`running`&&_(`done`))}function S(e){try{u(o(e))}catch(e){throw y(),e}}let C=e=>{if(r.mode===`off`){x();return}let t=e-f-l;t>=c?x():t>0&&S(t/c)},w={finished:g,get state(){return p},cancel:y,finish:x};return d?.aborted?(_(`cancelled`),w):(d?.addEventListener(`abort`,y,{once:!0}),c<=0&&l<=0?(x(),w):(S(0),p===`running`&&(m=n.onFrame(C)),w))}let b=(e,t)=>n=>e*(1-n)+t*n,x=(e,t)=>n=>({x:e.x*(1-n)+t.x*n,y:e.y*(1-n)+t.y*n});function S(e,t){let n=[.../* @__PURE__ */ new Set([...Object.keys(e),...Object.keys(t)])];return r=>{if(r===1)return{...t};let i={};for(let a of n)i[a]=(e[a]??0)*(1-r)+(t[a]??0)*r;return i}}function C(e,t,n={}){let{onChange:r,...i}=n,a=e,o=e,l,u=!1,d=e=>{a=e,r?.(e)},f=()=>{let e=l;l=void 0,u=!1,e?.cancel()};return{get value(){return a},get target(){return l?.state===`cancelled`?a:o},get animating(){return l?.state===`running`},to(e,n){let r=l?.state===`running`&&u&&!(n.delay&&n.delay>0);f(),o=e;let p=t(a,e),m=!1,h=y({duration:n.duration,timing:n.timing,ease:n.ease??(r?c:s),delay:n.delay,signal:n.signal,update:e=>{m&&(u=!0),m=!0,d(p(e))}},i);return l=h,h.finished},set(e){f(),o=e,d(e)},stop(){f(),o=a}}}function w(e){T(e);let{from:n,to:r,duration:i,onFrame:l}=e,u=e.ease??o,d=e.timing??`playback`,f=e.clock??a,p=e.motion??v,m=Math.min(n,r),h=Math.max(n,r),g=r,_=!1,y=!1,b,x=0,S=/* @__PURE__ */ new Set,C=e=>{for(let n of[...S])if(S.has(n))try{n(e)}catch(e){t(e)}},w=()=>{let e=b;return b=void 0,e?.stop(),e?.moved??!1},D=()=>{_&&(_=!1,C(`pause`))},O=e=>{throw x++,w(),D(),e},k=e=>{if(e!==g){g=e;try{l(e)}catch(e){O(e)}}},A=(e,t,n,r)=>{let i=x;if(!(t>0)){k(e),x===i&&r();return}let a=g,o=f.now(),s={moved:!1,stop:f.onFrame(c=>{let l=p.mode===`off`?1:(c-o)/t;if(l<1){s.moved=!0;let t;try{t=n(l)}catch(e){return O(e)}k(a+(e-a)*t)}else w(),k(e),x===i&&r()})};b=s},j=()=>{_=!1,C(`end`)};return{get position(){return g},get playing(){return _},play(){if(y||_)return;let e=++x;if(w(),_=!0,C(`play`),x!==e)return;let t=p.duration(i,d);t>0&&g===r&&(k(n),x!==e)||A(r,t*Math.abs(r-g)/Math.abs(r-n),u,j)},pause(){!y&&_&&(x++,w(),D())},seek(e,t={}){if(E(e,t),y)return;let n=++x,r=w();if(D(),x!==n||(C(`seek`),x!==n))return;let i=t.animate===!1?0:p.duration(350,`transition`);A(Math.min(Math.max(e,m),h),i,r?c:s,()=>{})},subscribe(e){if(typeof e!=`function`)throw TypeError(`playback.subscribe needs a function, got ${typeof e}.`);if(y)return()=>{};let t=t=>e(t);return S.add(t),()=>{S.delete(t)}},destroy(){y||(y=!0,x++,w(),D(),S.clear())}}}function T(e){if(typeof e!=`object`||!e)throw TypeError(`playback needs options: { from, to, duration, onFrame }.`);let{from:t,to:n,duration:r,ease:i,timing:a,onFrame:o,clock:s,motion:c}=e;for(let[e,r]of[[`from`,t],[`to`,n]])if(!D(r))throw RangeError(`playback: ${e} must be a finite number, got ${String(r)}.`);if(t===n)throw RangeError(`playback: from and to must differ, got ${t} for both.`);if(!D(r)||r<0)throw RangeError(`playback: duration must be a non-negative number of ms, got ${String(r)}.`);if(typeof o!=`function`)throw TypeError(`playback: onFrame must be a function, got ${typeof o}.`);if(i!==void 0&&typeof i!=`function`)throw TypeError(`playback: ease must be a function, got ${typeof i}.`);if(a!==void 0&&!f.includes(a))throw RangeError(`playback: timing must be one of ${f.join(`, `)}, got ${JSON.stringify(a)??String(a)}.`);if(s!==void 0&&(typeof s?.now!=`function`||typeof s.onFrame!=`function`))throw TypeError(`playback: clock must be a Clock, such as one from createClock() or manualClock().`);if(c!==void 0&&typeof c?.duration!=`function`)throw TypeError("playback: motion must be a Motion, such as the page-wide `motion` or one from createMotion().")}function E(e,t){if(!D(e))throw RangeError(`playback.seek needs a finite number, got ${String(e)}.`);if(typeof t!=`object`||!t)throw TypeError(`playback.seek's options must be an object, such as { animate: false }.`);if(t.animate!==void 0&&typeof t.animate!=`boolean`)throw TypeError(`playback.seek: animate must be true or false, got ${String(t.animate)}.`)}function D(e){return typeof e==`number`&&Number.isFinite(e)}let O=2*Math.PI;function k(e,t,n=0){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i);return{kind:`line`,from:e,to:t,length:a,angle:a>0?Math.atan2(i,r):P(n)}}function A(e,t,n,r){return{kind:`arc`,center:e,radius:t,start:n,sweep:r,length:t*Math.abs(r)}}function j(e,t){if(e.kind===`line`){let{from:n,to:r}=e;return{x:n.x*(1-t)+r.x*t,y:n.y*(1-t)+r.y*t}}return N(e.center,e.radius,e.start+e.sweep*t)}function M(e,t){if(e.kind===`line`)return e.angle;let n=e.sweep<0?-Math.PI/2:Math.PI/2;return P(e.start+e.sweep*t+n)}function N(e,t,n){return{x:e.x+t*Math.cos(n),y:e.y+t*Math.sin(n)}}function P(e){return e-O*Math.ceil((e-Math.PI)/O)}function F(e){if(e.kind===`line`)return[e.from,e.to];let t=[j(e,0),j(e,1)];for(let n=0;n<4;n++){let r=n*Math.PI/2;ee(e,r)&&t.push(N(e.center,e.radius,r))}return t}function I(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let{x:a,y:o}of e)a<t&&(t=a),a>r&&(r=a),o<n&&(n=o),o>i&&(i=o);return{x:t,y:n,width:r-t,height:i-n}}function ee(e,t){let n=Math.abs(e.sweep);return n>=O||((e.sweep>=0?t-e.start:e.start-t)%O+O)%O<=n}function L(e){let t=Math.round(e*1e3)/1e3;return t===0?`0`:String(t)}function R(e){return`M${L(e.x)},${L(e.y)}`}function z(e,t=0,n=1){if(e.kind===`line`){let t=n===1?e.to:j(e,n);return`L${L(t.x)},${L(t.y)}`}let r=e.start+e.sweep*t,i=e.sweep*(n-t),a=Math.max(1,Math.ceil(Math.abs(i)/Math.PI-1e-9)),o=L(e.radius),s=+(i>=0),c=``;for(let t=1;t<=a;t++){let n=N(e.center,e.radius,r+i*t/a);c+=`A${o},${o} 0 0 ${s} ${L(n.x)},${L(n.y)}`}return c}function B(e,t=!1){let n=e[0];if(!n)return``;let r=e.length;if(t){for(;r>0&&e[r-1].length<=0;)r--;r>0&&e[r-1].kind===`line`&&r--}let i=R(j(n,0));for(let t=0;t<r;t++){let n=e[t];n.length>0&&(i+=z(n))}return t?`${i}Z`:i}let V=e=>e>0?e<1?e:1:0,te=Object.freeze([]);function H(e,t=te){let n=e[0],r=e[e.length-1];if(!n||!r)throw RangeError(`A walk needs at least one segment.`);let i=[0];for(let t of e)i.push(i[i.length-1]+t.length);let a=i[e.length],o=j(n,0),s=j(r,1),c=t=>{if(!(a>0))return{index:0,u:0};if(t>=a){let t=e.length-1;for(;t>0&&!(e[t].length>0);)t--;return{index:t,u:1}}let n=0,r=e.length-1;for(;n<r;){let e=n+r>>1;i[e+1]>t?r=e:n=e+1}return{index:n,u:Math.min(1,(t-i[n])/e[n].length)}},l=t=>{let n=V(t);if(n===0)return o;if(n===1)return s;let{index:r,u:i}=c(n*a);return j(e[r],i)},u=(t,n)=>{let r=R(l(t)),o=t*a,s=n*a;if(!(s>o))return r;let u=c(o);for(let t=u.index;t<e.length&&i[t]<s;t++){let n=e[t];if(!(n.length>0))continue;let a=t===u.index?u.u:0,o=i[t+1]>s?Math.min(1,(s-i[t])/n.length):1;o>a&&(r+=z(n,a,o))}return r},d=(e,n)=>{let r=V(Math.min(e,n)),i=V(Math.max(e,n));if(t.length===0)return u(r,i);let a=``,o=r;for(let[e,n]of t){if(e>=i)break;e>o&&(a+=u(o,e)),n>o&&(o=n)}return i>o&&(a+=u(o,i)),a===``?R(l(r)):a};return{segments:e,length:a,start:o,end:s,gaps:t,point:l,angle(t){let{index:n,u:r}=c(V(t)*a);return M(e[n],r)},slice:d,d:t.length===0?B(e):d(0,1)}}function ne(e){let t=e.map(e=>H(e));return{d:B(e.flat(),!0),closed:!0,sample(e){ce(e,4);let n=e/4,r=[];for(let e of t)for(let t=0;t<n;t++)r.push(e.point(t/n));return r}}}function re(e){let t=e.map(e=>e.reduce((e,t)=>e+t.length,0)),n=0;t.forEach((e,r)=>{e>t[n]&&(n=r)});let r=ie(e[n])<0,i=e.map(e=>r?ae(e):e),a=oe(i[n]),o=H(a);return{d:[a,...i.filter((e,t)=>t!==n)].map(e=>B(e,!0)).join(``),closed:!0,sample(e){ce(e,4);let t=e/4,n=[];for(let e=0;e<4;e++)for(let r=0;r<t;r++)n.push(o.point(e/4+r/t/4));return n}}}function ie(e){let t=0;for(let n of e){if(n.kind===`line`){t+=n.from.x*n.to.y-n.to.x*n.from.y;continue}let{center:e,radius:r,start:i,sweep:a}=n,o=i+a;t+=r*(e.x*(Math.sin(o)-Math.sin(i))-e.y*(Math.cos(o)-Math.cos(i)))+r*r*a}return t/2}function ae(e){return e.map(e=>e.kind===`line`?k(e.to,e.from):A(e.center,e.radius,e.start+e.sweep,-e.sweep)).reverse()}function oe(e){let t=0,n=0,r=1/0,i=1/0,a=(e,a,o)=>{let s=e.x+e.y;(s<r-1e-9||s<=r+1e-9&&e.y<i)&&([t,n,r,i]=[a,o,s,e.y])};e.forEach((e,t)=>{if(a(j(e,0),t,0),e.kind===`arc`){let n=((e.sweep>=0?W-e.start:e.start-W)%O+O)%O/Math.abs(e.sweep);n<1&&a(j(e,n),t,n)}});let[o,s]=U(e[t],n);return[s,...e.slice(t+1),...e.slice(0,t),o].filter(e=>e.length>0)}function U(e,t){if(e.kind===`line`){let n=j(e,t);return[k(e.from,n),k(n,e.to)]}let{center:n,radius:r,start:i,sweep:a}=e;return[A(n,r,i,a*t),A(n,r,i+a*t,a*(1-t))]}let W=-3*Math.PI/4;function se(e){return{d:e.d,closed:!1,sample(t){if(ce(t,1),t===1)return[e.start];let n=[];for(let r=0;r<t;r++)n.push(e.point(r/(t-1)));return n}}}function ce(e,t){if(!Number.isInteger(e)||e<0||e%t!==0){let n=t===1?`a whole number ≥ 0`:`a whole multiple of ${t}`;throw RangeError(`outline.sample(n): n must be ${n}, got ${e}.`)}}function le({key:e,series:t,walk:n,thickness:r,outline:i,bounds:a,center:o,pivot:s,labelBounds:c,segments:l}){return{key:e,...t===void 0?{}:{series:t},start:n.start,end:n.end,length:n.length,path:e=>n.point(e),angle:e=>n.angle(e),slice:(e,t)=>n.slice(e,t),...n.gaps.length===0?{}:{gaps:n.gaps},thickness:r,outline:i,bounds:a,center:o,pivot:s,...c===void 0?{}:{labelBounds:c},...l===void 0?{}:{segments:l}}}function G(e,t,n){if(!Number.isFinite(n))throw RangeError(`describe.${e}: ${t} must be a finite number, got ${n}.`);return n}function ue(e,t){if(!t)return t;for(let n=0;n<t.length;n++){let{x:r,y:i,width:a,height:o}=t[n];Number.isFinite(r)&&Number.isFinite(i)&&Number.isFinite(a)&&a>=0&&Number.isFinite(o)&&o>=0||(G(e,`labelBounds[${n}].x`,r),G(e,`labelBounds[${n}].y`,i),K(e,`labelBounds[${n}].width`,a),K(e,`labelBounds[${n}].height`,o))}return t}function K(e,t,n){if(!(Number.isFinite(n)&&n>=0))throw RangeError(`describe.${e}: ${t} must be a finite number ≥ 0, got ${n}.`);return n}function de(e){let{key:t,series:n}=e,r={x:G(`arc`,`cx`,e.cx),y:G(`arc`,`cy`,e.cy)},i=Math.min(K(`arc`,`inner`,e.inner),K(`arc`,`outer`,e.outer)),a=Math.max(e.inner,e.outer);G(`arc`,`start`,e.start),G(`arc`,`end`,e.end);let o=Math.max(-O,Math.min(O,e.end-e.start)),s=e.start-Math.PI/2,c=s+o,[l,u]=o>=0?[a,i]:[i,a],d=[[A(r,l,s,o)],[k(N(r,l,c),N(r,u,c),c+(l>u?Math.PI:0))],[A(r,u,c,-o)],[k(N(r,u,s),N(r,l,s),s+(l>u?0:Math.PI))]],f=H([A(r,(i+a)/2,s,o)]);return le({key:t,series:n,walk:f,thickness:a-i,outline:ne(d),bounds:I(d.flat().flatMap(F)),center:f.point(.5),pivot:r,labelBounds:ue(`arc`,e.labelBounds)})}let fe={left:0,right:Math.PI,top:Math.PI/2,bottom:-Math.PI/2};function pe(e){let{key:t,series:n,baseline:r,x:i,y:a,width:o,height:s}=e;if(!Object.prototype.hasOwnProperty.call(fe,r))throw RangeError(`describe.bar: baseline must be left, right, top or bottom, got ${String(r)}.`);G(`bar`,`x`,i),G(`bar`,`y`,a),K(`bar`,`width`,o),K(`bar`,`height`,s);let c=K(`bar`,`radius`,e.radius??0),l=K(`bar`,`gap`,e.gap??0),u=ue(`bar`,e.labelBounds),d=r===`left`||r===`right`,f=d?o:s,p=d?s:o,m=p,h=fe[r],g=me(e),_=(e,t,n,r)=>{let i=Math.max(0,Math.min(n,t-e,m/2)),a=ne([[k(g(e,0),g(t-i,0),h)],i>0?[A(g(t-i,i),i,h-Math.PI/2,Math.PI/2),k(g(t,i),g(t,m-i),h+Math.PI/2),A(g(t-i,m-i),i,h,Math.PI/2)]:[k(g(t,0),g(t,m),h+Math.PI/2)],[k(g(t-i,m),g(e,m),h+Math.PI)],[k(g(e,m),g(e,0),h-Math.PI/2)]]),o=H([k(g(e,m/2),g(t,m/2),h)]);return le({...r,walk:o,thickness:p,outline:a,bounds:r.bounds??I([g(e,0),g(t,m)]),center:g((e+t)/2,m/2),pivot:o.start})},v=e.segments??[{series:n,size:f}],y=/* @__PURE__ */ new Set,b=0,x=v.map((e,n)=>{if(K(`bar`,`segments[${n}].size`,e.size),e.series!==void 0){if(y.has(e.series))throw Error(`describe.bar: series "${e.series}" appears twice in the segments of "${t}".`);y.add(e.series)}let r=Math.min(b,f);b+=e.size;let i=Math.min(b,f);return{segment:e,index:n,p0:Math.min(r+Math.min(l,r),i),p1:i}}).map(({segment:e,index:n,p0:r,p1:i})=>_(r,i,c-(f-i),{key:e.series===void 0?`${t}/${n}`:`${t}/${e.series}`,series:e.series}));return _(0,f,c,{key:t,series:n,bounds:{x:i,y:a,width:o,height:s},labelBounds:u,segments:x})}function me({x:e,y:t,width:n,height:r,baseline:i}){switch(i){case`left`:return(n,r)=>({x:e+n,y:t+r});case`right`:return(i,a)=>({x:e+n-i,y:t+r-a});case`top`:return(r,i)=>({x:e+n-i,y:t+r});case`bottom`:return(n,i)=>({x:e+i,y:t+r-n})}}function he(e){let{key:t,series:n,points:r}=e,i=K(`line`,`width`,e.width??1),a=r[0];if(!a)throw RangeError(`describe.line: "${t}" needs at least one point.`);r.forEach((e,t)=>{G(`line`,`points[${t}].x`,e.x),G(`line`,`points[${t}].y`,e.y)});let o=_e(e.breaks,r.length),s=[];for(let e=1;e<r.length;e++)s.push(k(r[e-1],r[e],s[s.length-1]?.angle??0));s.length===0&&s.push(k(a,a));let c=H(s,ge(o,s)),l=I(r),u=i/2;return le({key:t,series:n,walk:c,thickness:i,outline:se(c),bounds:{x:l.x-u,y:l.y-u,width:l.width+i,height:l.height+i},center:c.point(.5),pivot:a,labelBounds:ue(`line`,e.labelBounds)})}function ge(e,t){let n=[0];for(let e of t)n.push(n[n.length-1]+e.length);let r=n[n.length-1];return e.filter(e=>n[e]>n[e-1]).map(e=>[n[e-1]/r,n[e]/r])}function _e(e,t){if(e===void 0)return[];if(!Array.isArray(e))throw RangeError(`describe.line: breaks must be an array of point indices, got ${ve(e)}.`);let n=0;return e.forEach((e,r)=>{if(!(Number.isInteger(e)&&e>n&&e<t))throw RangeError(`describe.line: breaks[${r}] must be a whole number more than ${n} and less than ${t}, the number of points, got ${ve(e)}.`);n=e}),e}let ve=e=>typeof e==`string`?JSON.stringify(e):String(e);function ye(e){let{key:t,series:n}=e,r={x:G(`point`,`x`,e.x),y:G(`point`,`y`,e.y)},i=K(`point`,`r`,e.r),a=Math.PI/2;return le({key:t,series:n,walk:H([k(r,r)]),thickness:2*i,outline:ne([[A(r,i,-3*a/2,a)],[A(r,i,-a/2,a)],[A(r,i,a/2,a)],[A(r,i,3*a/2,a)]]),bounds:{x:r.x-i,y:r.y-i,width:2*i,height:2*i},center:r,pivot:r,labelBounds:ue(`point`,e.labelBounds)})}let be=1e4;function xe(e){let t=[],n,r={x:0,y:0},i=[],a=!1,o=e=>{a&&t.push({start:n,end:r,segments:i,closed:e}),i=[],a=!1},s=e=>{a||(n=r,a=!0),r=e},c=e=>{e.length!==0&&i.push(e)},l=(e,t)=>c(k(e,t)),u=e=>{for(let t=1;t<e.length;t++)l(e[t-1],e[t])};for(let t=0;t<e.length;t++){let i=e[t],d=r;switch(i.op){case`M`:o(!1),r=i.to,e[t+1]&&e[t+1].op!==`M`&&(n=r,a=!0);break;case`Z`:s(n??r),l(d,r),o(!0);break;case`L`:s(i.to),l(d,r);break;case`C`:s(i.to),u(q(d,i.c1,i.c2,i.to));break;case`Q`:s(i.to),u(q(d,i.c,i.to));break;case`A`:s(i.to);for(let e of Ce(d,i))c(e)}}return o(!1),t}function q(...e){let t=(e,t,n)=>Math.hypot(e.x-2*t.x+n.x,e.y-2*t.y+n.y),n=e.length===4,r=Se(1,n?6*Math.max(t(e[0],e[1],e[2]),t(e[1],e[2],e[3])):2*t(e[0],e[1],e[2])),i=[e[0]];for(let t=1;t<r;t++){let a=t/r,o=1-a,[s,c,l,u]=n?[o*o*o,3*o*o*a,3*o*a*a,a*a*a]:[o*o,2*o*a,a*a,0];i.push({x:s*e[0].x+c*e[1].x+l*e[2].x+(n?u*e[3].x:0),y:s*e[0].y+c*e[1].y+l*e[2].y+(n?u*e[3].y:0)})}return i.push(e[e.length-1]),i}function Se(e,t){let n=Math.ceil(e*Math.sqrt(t/.8));return Number.isFinite(n)?Math.min(be,Math.max(1,n)):be}function Ce(e,t){let{to:n,large:r,sweep:i}=t;if(e.x===n.x&&e.y===n.y)return[];let{rx:a,ry:o}=t;if(!(a>0&&o>0))return[k(e,n)];let s=Math.abs(a-o)<=1e-9*Math.max(a,o),c=s?0:t.rotation*Math.PI/180,l=Math.cos(c),u=Math.sin(c),d=(e.x-n.x)/2,f=(e.y-n.y)/2,p=l*d+u*f,m=-u*d+l*f,h=p*p/(a*a)+m*m/(o*o);h>1&&(a*=Math.sqrt(h),o*=Math.sqrt(h));let g=a*a,_=o*o,v=g*m*m+_*p*p,y=(r===i?-1:1)*Math.sqrt(Math.max(0,(g*_-v)/v)),b=y*a*m/o,x=-y*o*p/a,S={x:l*b-u*x+(e.x+n.x)/2,y:u*b+l*x+(e.y+n.y)/2},C=Math.atan2((m-x)/o,(p-b)/a),w=Math.atan2((-m-x)/o,(-p-b)/a)-C;if(i&&w<0?w+=O:!i&&w>0&&(w-=O),s)return[A(S,a,C,w)];let T=Se(Math.abs(w),Math.max(a,o)),E=e=>{let t=a*Math.cos(e),n=o*Math.sin(e);return{x:S.x+l*t-u*n,y:S.y+u*t+l*n}},D=[],j=e;for(let e=1;e<=T;e++){let t=e===T?n:E(C+w*e/T);D.push(k(j,t)),j=t}return D}let we={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},Te=/[\s,]*([A-Za-z]|[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?)/y,Ee=/^[A-Za-z]$/;function De(e){let t=[];Te.lastIndex=0;for(let n=Te.exec(e);n;n=Te.exec(e))t.push(n[1]);let n=[],r={x:0,y:0},i=r,a,o=``,s=0;for(;s<t.length;){if(Ee.test(t[s]))o=t[s++];else if(o===``||o===`Z`||o===`z`)break;let e=o.toUpperCase();if(e===`Z`){n.push({op:`Z`,to:i}),r=i,a=void 0;continue}let c=we[e];if(c===void 0)break;let l=[],u=!1;for(;l.length<c&&s<t.length&&!Ee.test(t[s]);){let n=t[s];if(e===`A`&&(l.length===3||l.length===4)){let e=n[0];if(e!==`0`&&e!==`1`){u=!0;break}l.push(Number(e)),n.length>1?t[s]=n.slice(1):s++}else l.push(Number(n)),s++}if(u||l.length<c||!l.every(Number.isFinite))break;let d=o!==e,f=(e,t)=>d?{x:r.x+e,y:r.y+t}:{x:e,y:t},[p=0,m=0,h=0,g=0,_=0,v=0,y=0]=l,b;switch(e){case`M`:r=i=f(p,m),n.push({op:`M`,to:r}),o=d?`l`:`L`;break;case`L`:n.push({op:`L`,to:r=f(p,m)});break;case`H`:n.push({op:`L`,to:r={x:d?r.x+p:p,y:r.y}});break;case`V`:n.push({op:`L`,to:r={x:r.x,y:d?r.y+p:p}});break;case`C`:case`S`:{let t=e===`S`,i=t?a&&Oe(n,`C`)?ke(a,r):r:f(p,m);b=t?f(p,m):f(h,g),n.push({op:`C`,c1:i,c2:b,to:r=t?f(h,g):f(_,v)});break}case`Q`:case`T`:{let t=e===`T`;b=t?a&&Oe(n,`Q`)?ke(a,r):r:f(p,m),n.push({op:`Q`,c:b,to:r=t?f(p,m):f(h,g)});break}case`A`:n.push({op:`A`,rx:Math.abs(p),ry:Math.abs(m),rotation:h,large:g!==0,sweep:_!==0,to:r=f(v,y)})}a=b}return n}let Oe=(e,t)=>e[e.length-1]?.op===t,ke=(e,t)=>({x:2*t.x-e.x,y:2*t.y-e.y});function Ae(e,t){let n=e=>{let n=Number.parseFloat(t(e)??``);return Number.isFinite(n)?n:0};switch(e){case`path`:return De(t(`d`)??``);case`circle`:return je(n(`cx`),n(`cy`),n(`r`),n(`r`));case`ellipse`:return je(n(`cx`),n(`cy`),n(`rx`),n(`ry`));case`line`:return[{op:`M`,to:{x:n(`x1`),y:n(`y1`)}},{op:`L`,to:{x:n(`x2`),y:n(`y2`)}}];case`polyline`:case`polygon`:{let n=(t(`points`)??``).trim().split(/[\s,]+/).filter(Boolean).map(Number),r=[];for(let e=0;e+1<n.length&&Number.isFinite(n[e])&&Number.isFinite(n[e+1]);e+=2)r.push({x:n[e],y:n[e+1]});if(r.length<2)return[];let i=r.map((e,t)=>({op:t===0?`M`:`L`,to:e}));return e===`polygon`?[...i,{op:`Z`,to:r[0]}]:i}case`rect`:return Me(n(`x`),n(`y`),n(`width`),n(`height`),t);default:return[]}}function je(e,t,n,r){if(!(n>0&&r>0))return[];let i=e=>({op:`A`,rx:n,ry:r,rotation:0,large:!1,sweep:!0,to:{x:e,y:t}});return[{op:`M`,to:{x:e+n,y:t}},i(e-n),i(e+n),{op:`Z`,to:{x:e+n,y:t}}]}function Me(e,t,n,r,i){if(!(n>0&&r>0))return[];let a=e=>{let t=Number.parseFloat(i(e)??``);return t>=0?t:void 0},o=Math.min(a(`rx`)??a(`ry`)??0,n/2),s=Math.min(a(`ry`)??a(`rx`)??0,r/2),c=(e,t)=>({op:`L`,to:{x:e,y:t}});if(!(o>0&&s>0))return[{op:`M`,to:{x:e,y:t}},c(e+n,t),c(e+n,t+r),c(e,t+r),{op:`Z`,to:{x:e,y:t}}];let l=(e,t)=>({op:`A`,rx:o,ry:s,rotation:0,large:!1,sweep:!0,to:{x:e,y:t}});return[{op:`M`,to:{x:e+o,y:t}},c(e+n-o,t),l(e+n,t+s),c(e+n,t+r-s),l(e+n-o,t+r),c(e+o,t+r),l(e,t+r-s),c(e,t+s),l(e+o,t),{op:`Z`,to:{x:e+o,y:t}}]}function Ne(e,t){let n=e=>({x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}),r=t[0]*t[3]-t[1]*t[2]<0;return e.map(e=>{switch(e.op){case`M`:case`L`:case`Z`:return{op:e.op,to:n(e.to)};case`C`:return{op:`C`,c1:n(e.c1),c2:n(e.c2),to:n(e.to)};case`Q`:return{op:`Q`,c:n(e.c),to:n(e.to)};case`A`:return{...e,...Pe(e,t),sweep:r!==e.sweep,to:n(e.to)}}})}function Pe({rx:e,ry:t,rotation:n},r){let i=n*Math.PI/180,a=Math.cos(i),o=Math.sin(i),s=(r[0]*a+r[2]*o)*e,c=(r[2]*a-r[0]*o)*t,l=(r[1]*a+r[3]*o)*e,u=(r[3]*a-r[1]*o)*t,d=s*s+c*c,f=s*l+c*u,p=l*l+u*u,m=(d+p)/2,h=Math.hypot((d-p)/2,f),g=m+h,_=Math.abs(f)<1e-12?d>=p?0:Math.PI/2:Math.atan2(g-d,f);return{rx:Math.sqrt(g),ry:Math.sqrt(Math.max(0,m-h)),rotation:_*180/Math.PI}}function Fe(e){let t=L,n=e=>`${t(e.x)},${t(e.y)}`;return e.map(e=>{switch(e.op){case`M`:case`L`:return`${e.op}${n(e.to)}`;case`C`:return`C${n(e.c1)} ${n(e.c2)} ${n(e.to)}`;case`Q`:return`Q${n(e.c)} ${n(e.to)}`;case`A`:return`A${t(e.rx)},${t(e.ry)} ${t(e.rotation)} ${+!!e.large} ${+!!e.sweep} ${n(e.to)}`;case`Z`:return`Z`}}).join(``)}function Ie(e){let{key:t,series:n,d:r}=e,i=e.width??1;if(!(Number.isFinite(i)&&i>0))throw RangeError(`describe.shape: width must be a finite number more than 0, got ${i}.`);let a=ze(e.matrix);if(typeof r!=`string`)throw RangeError(`describe.shape: d must be path data, a string, got ${Be(r)}.`);let o=De(r),s=o[0]?.op===`M`?xe(a?Ne(o,a):o):[];if(s.length===0)throw RangeError(`describe.shape: d must start with a move and draw something after it, got ${Be(r)}.`);let c=[],l=0;for(let e of s){c.push(e.start);for(let t of e.segments){for(let e of F(t))c.push(e);l+=t.length}}let u=I(c);if(![u.x,u.y,u.width,u.height,l].every(Number.isFinite))throw RangeError(`describe.shape: d must stay finite${a?` once moved by matrix`:``}, got ${Be(r)}.`);let d=ue(`shape`,e.labelBounds);if(s.every(Le)&&l>0){let e={x:u.x+u.width/2,y:u.y+u.height/2};return le({key:t,series:n,walk:H([k(e,e)]),thickness:Math.min(u.width,u.height),outline:re(s.map(e=>e.segments).filter(e=>e.length>0)),bounds:u,center:e,pivot:e,labelBounds:d})}let{segments:f,gaps:p}=Re(s),m=H(f,p),h=i/2;return le({key:t,series:n,walk:m,thickness:i,outline:se(m),bounds:{x:u.x-h,y:u.y-h,width:u.width+i,height:u.height+i},center:m.point(.5),pivot:m.start,labelBounds:d})}let Le=({closed:e,start:t,end:n})=>e||t.x===n.x&&t.y===n.y;function Re(e){let t=[],n=[],r;for(let i of e){r&&(r.x!==i.start.x||r.y!==i.start.y)&&(n.push(t.length),t.push(k(r,i.start)));for(let e of i.segments)t.push(e);r=i.end}t.length===0&&t.push(k(e[0].start,e[0].start));let i=[0];for(let e of t)i.push(i[i.length-1]+e.length);let a=i[i.length-1];return{segments:t,gaps:n.map(e=>[i[e]/a,i[e+1]/a])}}function ze(e){if(e===void 0)return e;if(!(Array.isArray(e)&&e.length===6&&e.every(Number.isFinite)))throw RangeError(`describe.shape: matrix must be six finite numbers [a, b, c, d, e, f], got ${Be(e)}.`);return e}function Be(e){return Array.isArray(e)?`[${e.map(Be).join(`, `)}]`:typeof e==`string`?JSON.stringify(e.length>40?`${e.slice(0,40)}…`:e):String(e)}let Ve={bar:pe,arc:de,line:he,point:ye,shape:Ie};function He(e,t){return[1,0,0,1,e,t]}function Ue(e,t){let n=Math.cos(e),r=Math.sin(e);return Je([n,r,-r,n,0,0],t)}function We(e,t=e,n){return Je([e,0,0,t,0,0],n)}function Ge(...e){let t=[1,0,0,1,0,0];for(let n of e)t=qe(t,n);return t}function Ke(e,t){let[n,r,i,a,o,s]=e;return{x:n*t.x+i*t.y+o,y:r*t.x+a*t.y+s}}function qe(e,t){let[n,r,i,a,o,s]=e,[c,l,u,d,f,p]=t;return[n*c+i*l,r*c+a*l,n*u+i*d,r*u+a*d,n*f+i*p+o,r*f+a*p+s]}function Je(e,t){if(!t)return e;let[n,r,i,a]=e;return[n,r,i,a,t.x-n*t.x-i*t.y,t.y-r*t.x-a*t.y]}let J={translate:He,rotate:Ue,scale:We,multiply:Ge,apply:Ke};function Ye(e){let[t,n,r,i,a,o]=e,s=t*i-n*r;if(!Number.isFinite(s)||Math.abs(s)<1e-12)throw RangeError(`This transform can't be inverted: it has no area.`);return[i/s,-n/s,-r/s,t/s,(r*o-i*a)/s,(n*a-t*o)/s]}function Xe(e){let t=[];for(let[,n,r=``]of e.matchAll(/(matrix|translate|scale|rotate|skewX|skewY)\s*\(([^)]*)\)/g)){let e=r.trim().split(/[\s,]+/).filter(Boolean).map(Number);if(!e.every(Number.isFinite))continue;let[i=0,a,o,s=0,c=0,l=0]=e,u=e=>e*Math.PI/180;switch(n){case`matrix`:e.length===6&&t.push([i,a,o,s,c,l]);break;case`translate`:t.push(He(i,a??0));break;case`scale`:t.push(We(i,a??i));break;case`rotate`:t.push(Ue(u(i),a!==void 0&&o!==void 0?{x:a,y:o}:void 0));break;case`skewX`:t.push([1,0,Math.tan(u(i)),1,0,0]);break;case`skewY`:t.push([1,Math.tan(u(i)),0,1,0,0])}}return Ge(...t)}function Ze(e,t,n){return{x:e.x+n*Math.cos(t),y:e.y+n*Math.sin(t)}}let Qe=(Math.sqrt(5)-1)/2;function $e(e,t){if(typeof e!=`object`||!e||typeof e.path!=`function`||!Number.isFinite(e.length))throw TypeError(`samplesAlong needs a MarkGeometry, as describe builds it.`);if(!Array.isArray(t))throw TypeError(`samplesAlong needs an array of points { x, y, value, at? }.`);t.forEach((e,t)=>{for(let n of[`x`,`y`,`value`]){let r=e?.[n];if(typeof r!=`number`||!Number.isFinite(r))throw RangeError(`samplesAlong: points[${t}].${n} must be a finite number, got ${String(r)}.`)}});let n=e.length>0?Math.min(4096,Math.ceil(e.length)+1):1,r=Array.from({length:n},(t,r)=>e.path(n===1?0:r/(n-1))),i=t.map((t,n)=>({index:n,sample:{t:tt(e,r,t),value:t.value,...t.at===void 0?{}:{at:t.at}}})).sort((e,t)=>e.sample.t-t.sample.t||e.index-t.index).map(({sample:e})=>e);return e.gaps&&e.gaps.length>0?et(i,e.gaps):i}function et(e,t){let n=t.map(([e,t])=>(e+t)/2).sort((e,t)=>e-t),r=0;return e.map((t,i)=>{if(i===0)return t;let a=e[i-1].t;for(;r<n.length&&n[r]<=a;)r++;return r<n.length&&n[r]<=t.t?{...t,gapBefore:!0}:t})}function tt(e,t,n){let r=t.length;if(r===1)return 0;let i=0,a=1/0;t.forEach((e,t)=>{let r=nt(e,n);r<a&&(i=t,a=r)});let o=t=>nt(e.path(t),n),s=Math.max(0,i-1)/(r-1),c=Math.min(r-1,i+1)/(r-1),l=c-Qe*(c-s),u=s+Qe*(c-s),d=o(l),f=o(u);for(let e=0;e<48;e++)d<=f?(c=u,u=l,f=d,l=c-Qe*(c-s),d=o(l)):(s=l,l=u,d=f,u=s+Qe*(c-s),f=o(u));let p=(s+c)/2,m=o(p)<a?p:i/(r-1);return m>0?m<1?m:1:0}function nt(e,t){return(e.x-t.x)**2+(e.y-t.y)**2}function rt(e){let{kind:t,hint:n}=e,r=/* @__PURE__ */ new Map,i={get:e=>r.get(e),resolve(e){let i=r.get(e);if(i!==void 0)return i;let a=r.size>0?[...r.keys()].join(`, `):`none`;throw RangeError(`Unknown ${t} "${String(e)}". Registered ${t}s: ${a}.${n?` ${n}`:``}`)},register(e,n){if(typeof e!=`string`||e===``)throw TypeError(`A ${t} needs a non-empty string name, got ${JSON.stringify(e)}.`);if(n===void 0)throw TypeError(`Registering ${t} "${e}" needs a value.`);r.set(e,n)},names:()=>[...r.keys()]};for(let[t,n]of Object.entries(e.entries??{}))i.register(t,n);return i}let it=[`hover`,`enter`,`update`,`exit`,`decorate`];function at(e,t){let n={};for(let t of Object.keys(e??{}))if(!it.includes(t))throw TypeError(`on.${t} isn't an effect slot. Use one of: ${it.join(`, `)}.`);for(let r of it){let i=e?.[r];if(i!==void 0){if(typeof i==`string`){let e=t.resolve(i)();if(!ot(e))throw TypeError(`Preset "${i}" for on.${r} didn't return a mark effect; it returned ${st(e)}.`);n[r]=e}else{if(!ot(i))throw TypeError(`on.${r} needs a mark effect (kind "geometry" or "data") or a preset name, got ${st(i)}.`);n[r]=i}}}return n}function ot(e){if(typeof e!=`object`||!e)return!1;let t=e;return(t.kind===`geometry`||t.kind===`data`)&&typeof t.run==`function`&&typeof t.end==`function`&&typeof t.clear==`function`}function st(e){if(typeof e!=`object`||!e)return e===null?`null`:typeof e;let t=e.kind;return t===`transition`?`a transition effect, which runs between two charts rather than on one mark`:t===`geometry`||t===`data`?`a ${t} effect without run(), end() and clear()`:t===void 0?`an object with no kind`:`an effect of kind ${JSON.stringify(t)}`}function ct(e,t){let n={...e};for(let[e,r]of Object.entries(t??{}))r===void 0?delete n[e]:n[e]=r;return n}function lt(e){let{clock:t,motion:n,layer:r,mark:i}=e,a=new AbortController,o=[];return{context:{signal:a.signal,motion:n,mark:i,layer:r,icons:e.icons,batch:e.batch,...e.previous?{previous:e.previous}:{},tween(e){let r=e.signal,i=y({...e,signal:r??a.signal},{clock:t,motion:n});return r&&r!==a.signal&&(a.signal.aborted?i.cancel():a.signal.addEventListener(`abort`,()=>i.cancel(),{once:!0})),i},onChange(e){o.push(e)}},abort(){a.abort()},change(e,t){for(let n of[...o])n(e,t)},clear(){a.abort(),r.clear(),i.reset(),o=[]}}}let ut=[`decorate`,`enter`,`update`,`exit`,`hover`],dt={get:()=>void 0},ft={place(){},update(){},remove(){}};function pt(e){let{surface:n}=e,r=e.effects,i=e.motion??v,o=e.clock??a,s=e.icons??dt,c=/* @__PURE__ */ new Map,l=/* @__PURE__ */ new Set,u=!1,d=!1,f=0,p=i.subscribe(()=>{i.mode===`off`&&D()});function m(e){let t=e.mark.key,n=c.get(t);if(n)return n.mark=e.mark,n.data=e.data,n;let r={key:t,mark:e.mark,data:e.data,resting:e.data,runs:/* @__PURE__ */ new Map,applied:{},handle:void 0,exiting:void 0};return c.set(t,r),r}function h(e,t,n,a,c={}){let{previous:l,done:u}=c,d=r[t];if(!d){u?.();return}let p=e.runs.get(t);p&&b(p);let m={entry:e,slot:t,order:c.order??++f,effect:d,data:n,batch:a,previous:l,style:{},state:`running`,done:u,scope:lt({clock:o,motion:i,icons:s,batch:a,previous:l,layer:x(e.key,t,()=>m.order,()=>m.state!==`cleared`),mark:S(()=>m)})};e.runs.set(t,m);let h=c.mark??e.mark,v=m.scope.context;try{if(c.end||i.mode===`off`)d.kind===`data`?d.end(h,n,v):d.end(h,v),g(m);else{let e=d.kind===`data`?d.run(h,n,v):d.run(h,v);Promise.resolve(e).then(()=>g(m),e=>_(m,e))}}catch(e){_(m,e)}}function g(e){e.state===`running`&&(e.state=`ended`,y(e))}function _(e,n){let{signal:r}=e.scope.context;(!r.aborted||n!==r.reason&&n?.name!==`AbortError`)&&(t(n),b(e))}function y(e){let t=e.done;e.done=void 0,t?.()}function b(e){if(e.state===`cleared`)return;e.state=`cleared`;let{entry:n}=e;n.runs.get(e.slot)===e&&n.runs.delete(e.slot),e.scope.abort();try{e.effect.clear(e.scope.context)}catch(e){t(e)}e.scope.clear(),y(e)}function x(e,t,r,i){let a,o=()=>i()?a??(a=n.group(e,t,r())):void 0;return{icon:(e,t)=>o()?.icon(e,t)??ft,path:(e,t)=>o()?.path(e,t)??ft,text:(e,t)=>o()?.text(e,t)??ft,clear(){let e=a;a=void 0,e?.clear()}}}function S(e){return{set(t){let n=e();n.state!==`cleared`&&(n.style=ct(n.style,t),C(n.entry))},reset(){let t=e();Object.keys(t.style).length!==0&&(t.style={},C(t.entry))}}}function C(e){let t=[...e.runs.values()].sort((e,t)=>e.order-t.order),n=Object.assign({},...t.map(e=>e.style)),r=e.applied;if(e.applied=n,Object.keys(n).length===0){Object.keys(r).length>0&&w(e).reset();return}let i={},a=!1;for(let e of/* @__PURE__ */ new Set([...Object.keys(r),...Object.keys(n)]))r[e]!==n[e]&&(i[e]=n[e],a=!0);a&&w(e).set(i)}function w(e){return e.handle??(e.handle=n.mark(e.key))}function T(e){c.get(e.key)===e&&c.delete(e.key),l.delete(e.key);let t=e.exiting;e.exiting=void 0;for(let t of[...e.runs.values()])b(t);e.handle=void 0,t?.()}function E(e){let t=e.exiting;if(!t)return;e.exiting=void 0;let n=e.runs.get(`exit`);n&&b(n),t()}function D(){for(let e of[...c.values()])for(let t of[...e.runs.values()]){if(t.state!==`running`||e.runs.get(t.slot)!==t)continue;let n=t.done;t.done=void 0,h(e,t.slot,k(e,t),t.batch,{previous:t.previous,done:n,order:t.order})}}function O(e){let t=/* @__PURE__ */ new Map;for(let n of[...c.values()]){let r=n.runs.get(e);r&&(t.set(n,r.order),b(r))}return t}function k(e,t){let n=t.data.previous;return n&&!e.data.previous?mt(e.data,n):e.data}return{enter(e){d||e.forEach((t,n)=>{let r=m(t);r.resting=t.data,E(r);let i={index:n,count:e.length};h(r,`decorate`,t.data,i),h(r,`enter`,t.data,i)})},update(e){if(d)return;let t=new Set(e.map(e=>e.mark.key));for(let e of[...c.values()]){let n=e.runs.get(`update`);n&&!t.has(e.key)&&b(n)}e.forEach((t,n)=>{let r=c.get(t.mark.key),i=t.from??r?.mark,a=r&&!t.data.previous?mt(t.data,r.resting):t.data,o=m(t);o.resting=t.data,h(o,`update`,a,{index:n,count:e.length},{previous:i})})},exit(e){if(d)return Promise.resolve();let t=e.map((t,n)=>{let i=m(t);E(i),l.delete(i.key);for(let e of[...i.runs.values()])b(e);return new Promise(a=>{i.exiting=a,r.exit?h(i,`exit`,t.data,{index:n,count:e.length},{done:()=>{i.exiting&&c.get(i.key)===i&&T(i)}}):T(i)})});return Promise.all(t).then(()=>void 0)},hover(e){d||e.forEach((t,n)=>{let r=m(t);r.exiting||(l.add(r.key),u||h(r,`hover`,t.data,{index:n,count:e.length}))})},leave(e=[...l]){for(let t of e){l.delete(t);let e=c.get(t)?.runs.get(`hover`);e&&b(e)}},change(e,n){let r=c.get(e.key);if(r){r.mark=e,n&&(r.data=n,u||(r.resting=n));for(let n of[...r.runs.values()])if(n.state!==`cleared`)try{n.scope.change(e,k(r,n))}catch(e){t(e),b(n)}}},interrupt(){if(!d){u=!0;for(let e of[...c.values()]){let t=e.runs.get(`hover`);t&&b(t)}}},settle(){if(!u)return;u=!1;for(let e of c.values())e.exiting||(e.resting=e.data);let e=[...l];e.forEach((t,n)=>{let r=c.get(t);r&&h(r,`hover`,r.data,{index:n,count:e.length})})},swap(e,t){if(d)return;let n=ut.filter(t=>e[t]!==r[t]);r=e;for(let e of n)if(e===`decorate`){let n=O(e);t.forEach((r,i)=>{let a=c.get(r.mark.key)??m(r);a.exiting||h(a,e,r.data,{index:i,count:t.length},{mark:r.mark,order:n.get(a)})})}else if(e===`hover`){if(O(e),u)continue;let t=[...l];t.forEach((n,r)=>{let i=c.get(n);i&&h(i,e,i.data,{index:r,count:t.length})})}else for(let t of[...c.values()]){let n=t.runs.get(e);if(!n)continue;let r=n.done;n.done=void 0;let i=k(t,n);b(n),h(t,e,i,n.batch,{previous:n.previous,done:r,order:n.order,end:!0})}},destroy(){if(!d){d=!0,u=!1,p();for(let e of[...c.values()])T(e);l.clear()}}}}function mt(e,t){return{datum:e.datum,samples:e.samples,related:t=>e.related(t),previous:t}}let ht={value:`Sorted highest first`,key:`Sorted A to Z`,none:`In data order`,custom:`Sorted`};function gt(e){let t=[],{series:n}=e;e.label===void 0?n&&(n.length!==1||n[0]!==`value`)&&t.push(`Showing ${_t(n)}`):t.push(e.label),e.sort&&t.push(ht[e.sort]);let{changed:r,added:i,removed:a}=e;return!n&&r.length>0&&t.push(r.length<=3?`${_t(r)} changed`:`${r.length} of ${e.count} changed`),i.length>0&&t.push(`Added ${i.length<=3?_t(i):i.length}`),a.length>0&&t.push(`Removed ${a.length<=3?_t(a):a.length}`),t.join(`. `)}function _t(e){return e.length<=1?e.join(``):`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`}function vt(e){let t=e.ownerDocument.createElement(`div`);t.className=`ec-announcer ec-visually-hidden`,t.setAttribute(`role`,`status`),t.setAttribute(`aria-live`,`polite`),t.setAttribute(`aria-atomic`,`true`),e.after(t);let n=!1;return{say(e){e!==``&&(n=!n,t.textContent=n?e:`${e} `)},destroy(){t.remove()}}}function Y(e,t={},n){let r=(n?.ownerDocument??document).createElementNS(`http://www.w3.org/2000/svg`,e);return X(r,t),n?.appendChild(r),r}function X(e,t){for(let[n,r]of Object.entries(t))r===void 0?e.removeAttribute(n):e.setAttribute(n,typeof r==`number`?L(r):r)}function yt(e,t){for(let[n,r]of Object.entries(t))r===void 0?e.style.removeProperty(n):e.style.setProperty(n,r)}function bt({width:e,height:t}){return{width:e,height:t,viewBox:`0 0 ${L(e)} ${L(t)}`}}function xt(e){let[t,n,r,i,a,o]=e;return`matrix(${[t,n,r,i].map(St).join(` `)} ${L(a)} ${L(o)})`}function St(e){let t=Math.round(e*1e6)/1e6;return t===0?`0`:String(t)}let Ct=.16;function wt(e,t,n,r){let i=t(e.text.replace(/\d/g,`0`),n,r);return{x:(e.anchor===`start`?e.x:e.anchor===`end`?e.x-i:e.x-i/2)-Ct*r,y:e.y-1.05*r,width:i+2*Ct*r,height:1.3*r}}function Tt(e,t){X(e,{x:t.x,y:t.y,"text-anchor":t.anchor}),e.textContent!==t.text&&(e.textContent=t.text)}function Et(e){let t=/* @__PURE__ */ new Map;return Object.assign((n,r,i)=>{if(n===``)return 0;let a=`${r}\n${i}\n${n}`,o=t.get(a);if(o!==void 0)return o;let s=0,c=Y(`text`,{class:r,visibility:`hidden`,"aria-hidden":`true`},e);return typeof c.getComputedTextLength==`function`&&e.isConnected&&(c.textContent=n,s=c.getComputedTextLength()),c.remove(),s>0?(t.set(a,s),s):n.length*i*.6},{clear:()=>t.clear()})}let Dt=12.5,Ot=12.5,kt={label:!0,value:!0},At=.36;function jt(e){let{x:t,y:n,stack:r,data:i}=e,a=e.orientation;if(a!==void 0&&a!==`horizontal`&&a!==`vertical`)throw TypeError(`barChart: orientation must be "horizontal" or "vertical", got ${String(a)}.`);if(r!==void 0){if(!Array.isArray(r)||r.length===0)throw TypeError(`barChart: stack needs at least one numeric field.`);let e=/* @__PURE__ */ new Set;for(let t of r){if(e.has(t))throw TypeError(`barChart: "${t}" appears twice in stack.`);e.add(t)}}if(a===void 0){if(t!==void 0&&n!==void 0){let e=Zt(i,Xt(t));if(e!==Zt(i,Xt(n)))a=e?`horizontal`:`vertical`;else if(i.length===0)a=`horizontal`;else throw RangeError(`barChart: ${e?`x and y both hold numbers`:`neither x nor y holds numbers`}, so it can't tell which is the category. Set orientation: "horizontal" (categories along y) or "vertical" (categories along x).`)}else if(r!==void 0&&(t!==void 0||n!==void 0))a=n===void 0?`vertical`:`horizontal`;else throw TypeError(`barChart needs x and y (the axis whose values aren't numbers is the category), or one of them plus stack.`)}let o=a===`horizontal`,s=o?n:t,c=o?t:n;if(s===void 0)throw TypeError(`barChart: a ${a} chart takes its categories from ${o?`y`:`x`}.`);let l=Xt(s),u;if(r!==void 0)u=r.map(e=>({series:e,value:Xt(e)}));else if(c!==void 0)u=[{series:typeof c==`string`?c:`value`,value:Xt(c)}];else throw TypeError(`barChart needs values: ${o?`x`:`y`} set to a numeric field, or stack.`);return{orientation:a,category:l,key:e.key===void 0?l:Xt(e.key),series:u}}function Mt(e){let t=Ht(Vt(e),e.sort),n=Ut(t.map(e=>e.total)),r=t.map(t=>e.format(t.total)),i=n.ticks.map(e.format),a=(e.encoding.orientation===`horizontal`?Gt:Kt)(e,t,n,r,i),o=Nt(a,t,r,e.measure);return{width:a.bands.width,height:a.bands.height,orientation:a.orientation,frame:a,rows:t.map((t,n)=>Rt(a,{...t,slot:n,text:r[n],drawn:{label:n%o.every===0,value:o.values}},e.measure)),ticks:n.ticks.map((e,t)=>zt(a,e,i[t])),labels:o}}function Nt(e,t,n,r){let i=t.map((t,r)=>Lt(e,r,t.total,t.category,n[r])),a=e.orientation===`horizontal`,o=!It(Ft(i.map(({value:e})=>e),r,`ec-value`,Ot),a),s=e=>Ft(i.filter((t,n)=>n%e===0).map(({label:e})=>e),r,`ec-label`,Dt),c=0;for(;Pt(c)<t.length&&It(s(Pt(c)),a);)c++;return{every:Pt(c),values:o}}let Pt=e=>[1,2,5][e%3]*10**Math.floor(e/3);function Ft(e,t,n,r){return e.filter(e=>e.text!==``).map(e=>wt(e,t,n,r))}function It(e,t){let n=t?e.map(({x:e,y:t,width:n,height:r})=>({x:t,y:e,width:r,height:n})):[...e];n.sort((e,t)=>e.x-t.x);let r=[];for(let e of n){for(let t=r.length-1;t>=0;t--)r[t].x+r[t].width<=e.x&&r.splice(t,1);if(r.some(t=>t.y<e.y+e.height&&e.y<t.y+t.height))return!0;r.push(e)}return!1}function Lt(e,t,n,r,i){let{scale:a,bands:o}=e,s=n<0,c=Bt(a)(n),l=o.start+t*o.band;if(e.orientation===`horizontal`){let e=l+o.band/2+Dt*At;return{label:{x:a.label,y:e,anchor:`end`,text:r},value:{x:s?c-6:c+6,y:e,anchor:s?`end`:`start`,text:i}}}let u=l+o.band/2;return{label:{x:u,y:a.label,anchor:`middle`,text:r},value:{x:u,y:s?c+6+Ot*.8:c-6,anchor:`middle`,text:i}}}function Rt(e,t,n){let{scale:r,bands:i}=e,a=Bt(r),o=Math.abs(r.extent/(r.hi-r.lo)),s=t.values.reduce((e,t)=>e+t.value,0),c=s<0,l=a(0),u=a(s),d=i.start+t.slot*i.band,f={key:t.key,...t.values.length===1?{series:t.values[0].series}:{},radius:4,gap:2,segments:t.values.map(e=>({series:e.series,size:Math.max(0,c?-e.value:e.value)*o}))},p=t.drawn??kt,m={key:t.key,datum:t.datum,index:t.index,slot:t.slot,values:t.values,total:s,category:t.category,drawn:p},{label:h,value:g}=Lt(e,t.slot,s,p.label?t.category:``,p.value?t.text:``),_=()=>[...Ft([h],n,`ec-label`,Dt),...Ft([g],n,`ec-value`,Ot)];if(e.orientation===`horizontal`){let e=pe({...f,x:Math.min(l,u),y:d+(i.band-i.thickness)/2,width:Math.abs(u-l),height:i.thickness,baseline:c?`right`:`left`,labelBounds:_()});return{...m,geometry:e,data:Jt(t.datum,s,e),label:h,value:g,hit:{x:0,y:d,width:i.width,height:i.band}}}let v=d+i.band/2,y=pe({...f,x:v-i.thickness/2,y:Math.min(l,u),width:i.thickness,height:Math.abs(u-l),baseline:c?`top`:`bottom`,labelBounds:_()});return{...m,geometry:y,data:Jt(t.datum,s,y),label:h,value:g,hit:{x:d,y:0,width:i.band,height:i.height}}}function zt(e,t,n){let{bands:r}=e,i=Bt(e.scale)(t);if(e.orientation===`horizontal`){let e=r.start+r.span;return{value:t,line:{x1:i,y1:r.start,x2:i,y2:e},label:{x:i,y:e+16,anchor:`middle`,text:n}}}return{value:t,line:{x1:r.start,y1:i,x2:r.start+r.span,y2:i},label:{x:r.start-8,y:i+11*At,anchor:`end`,text:n}}}function Bt(e){let t=e.extent/(e.hi-e.lo);return n=>e.from+(n-e.lo)*t}function Vt({data:e,encoding:t}){let n=/* @__PURE__ */ new Set;return e.map((e,r)=>{let i=String(t.key(e,r));if(n.has(i))throw Error(`barChart: two rows have the key "${i}". Keys must be unique; pass a key accessor if categories repeat.`);n.add(i);let a=t.series.map(({series:t,value:n})=>({series:t,value:Qt(n(e,r),t,i)}));if(a.some(e=>e.value>0)&&a.some(e=>e.value<0))throw RangeError(`barChart: the stack for "${i}" mixes positive and negative values, which isn't supported yet.`);let o=a.reduce((e,t)=>e+t.value,0);return{key:i,category:String(t.category(e,r)??``),datum:e,index:r,values:a,total:o}})}function Ht(e,t){if(t===void 0||t===`none`)return e;if(t===`value`)return[...e].sort((e,t)=>t.total-e.total);if(t===`key`)return[...e].sort((e,t)=>e.key.localeCompare(t.key,void 0,{numeric:!0}));if(typeof t==`function`)return[...e].sort((e,n)=>t(e.datum,n.datum));throw TypeError(`barChart: sort must be "value", "key", "none" or a comparator, got ${String(t)}.`)}function Ut(e){let t=e.reduce((e,t)=>Math.min(e,t),0),n=e.reduce((e,t)=>Math.max(e,t),0);t===n&&(n=1);let r=Wt((n-t)/4);t=$t(Math.floor(t/r)*r),n=$t(Math.ceil(n/r)*r);let i=Math.round((n-t)/r),a=Array.from({length:i+1},(e,n)=>$t(t+n*r));return{lo:t,hi:n,ticks:a}}function Wt(e){let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<=1?1:n<=2?2:n<=5?5:10)*t}function Gt(e,t,n,r,i){let{width:a,measure:o}=e,s=t.length,c=Yt(t.map(e=>e.category),`ec-label`,Dt,o),l=Yt(r,`ec-value`,Ot,o),u=Yt(i,`ec-tick`,11,o),{positive:d,negative:f}=qt(e,t),p=n.lo<0?l+6:0,m=Math.max(c+10+p+f,u/2+2),h=Math.max(l+6+4+d,u/2+2),g=e.height===void 0||s===0?34:Math.max(0,e.height-4-26)/s;return{orientation:`horizontal`,scale:{lo:n.lo,hi:n.hi,from:m,extent:Math.max(0,a-m-h),label:m-10-p},bands:{start:4,band:g,thickness:g*20/34,span:s*g,width:a,height:e.height??4+s*g+26}}}function Kt(e,t,n,r,i){let{width:a,measure:o}=e,s=t.length,c=e.height??300,l=Yt(i,`ec-tick`,11,o),{positive:u,negative:d}=qt(e,t),f=(n.hi>0?20.5:4)+u,p=26+(n.lo<0?18.5:0)+d,m=l+8+2,h={x:m,y:f,width:Math.max(0,a-m-8),height:Math.max(0,c-f-p)},g=s>0?h.width/s:0,_=h.y+h.height;return{orientation:`vertical`,scale:{lo:n.lo,hi:n.hi,from:_,extent:-h.height,label:_+18},bands:{start:h.x,band:g,thickness:Math.min(g*20/34,72),span:h.width,width:a,height:c}}}function qt(e,t){let n=e.room??0;return{positive:t.some(e=>e.total>0)?n:0,negative:t.some(e=>e.total<0)?n:0}}function Jt(e,t,n){let r=e=>n.length>0?t*e/n.length:0,i={datum:e,samples:[{t:0,value:0},{t:1,value:t}],related(t){let a=n.segments?.find(e=>e.series===t);if(!a)return;let o=Math.hypot(a.start.x-n.start.x,a.start.y-n.start.y);return{datum:e,samples:[{t:0,value:r(o)},{t:1,value:r(o+a.length)}],related:i.related}}};return i}function Yt(e,t,n,r){return e.reduce((e,i)=>Math.max(e,r(i,t,n)),0)}function Xt(e){return typeof e==`function`?e:t=>t[e]}function Zt(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=t(e[r],r);if(i!=null){if(typeof i!=`number`)return!1;n=!0}}return n}function Qt(e,t,n){if(e==null)return 0;if(typeof e==`number`&&Number.isFinite(e))return e;throw RangeError(`barChart: "${t}" for "${n}" must be a finite number, got ${typeof e==`string`?JSON.stringify(e):String(e)}.`)}function $t(e){let t=Number(e.toPrecision(12));return t===0?0:t}let en={light:{surface:`#fcfcfb`,text:`#0b0b0b`,"text-muted":`#75736d`,grid:`#e1e0d9`,axis:`#c3c2b7`,focus:`#2a78d6`,negative:`#d03b3b`,ring:`rgba(11, 11, 11, 0.1)`,"dim-opacity":`0.3`,series:[[`#2a78d6`,`#1c5cab`],[`#eb6834`,`#c24d1d`],[`#02a471`,`#07835a`],[`#c28409`,`#9d6a07`],[`#8966da`,`#6e49ba`],[`#0096b0`,`#05778c`],[`#7a8a05`,`#606d03`],[`#c34e97`,`#a32f7a`]]},dark:{surface:`#1a1a19`,text:`#f0efec`,"text-muted":`#8f8d86`,grid:`#2c2c2a`,axis:`#45453f`,focus:`#3987e5`,negative:`#e66767`,ring:`rgba(255, 255, 255, 0.1)`,"dim-opacity":`0.3`,series:[[`#3987e5`,`#6da7ec`],[`#d95926`,`#fb7747`],[`#199e70`,`#45bc8c`],[`#c98500`,`#eda100`],[`#936fe4`,`#af8ffe`],[`#0b99b3`,`#40b7d2`],[`#829401`,`#9eb237`],[`#c8529c`,`#e970ba`]]}},tn=[`surface`,`text`,`text-muted`,`grid`,`axis`,`focus`,`negative`],Z=Object.fromEntries(tn.map(e=>[e,en.light[e]]));function nn(e){let t=(Math.max(1,Math.floor(e))-1)%8+1,[n,r]=en.light.series[t-1];return{color:`var(--ec-series-${t}, ${n})`,strong:`var(--ec-series-${t}-strong, ${r})`}}function rn(e){if(e===`mark`)return`var(--ec-mark, ${nn(1).color})`;if(e===`mark-strong`)return`var(--ec-mark-strong, ${nn(1).strong})`;let t=Z[e];if(t!==void 0)return`var(--ec-${e}, ${t})`;let n=/^series-(\d+)(-strong)?$/.exec(e);if(n){let e=nn(Number(n[1]));return n[2]?e.strong:e.color}return e}function an(e){return{"--ec-mark":e?.color,"--ec-mark-strong":e?.strong}}function on(e,t){let n=[...tn,`ring`,`dim-opacity`].map(t=>`--ec-${t}: ${e[t]};`);return e.series.forEach(([e,t],r)=>n.push(`--ec-series-${r+1}: ${e};`,`--ec-series-${r+1}-strong: ${t};`)),n.map(e=>t+e).join(`
|
|
2
|
+
`)}let sn=`/* expressive-charts: theme tokens and default styles. Every rule has zero specificity, so your CSS wins. */
|
|
3
|
+
${`:where(:root, [data-theme="light"]) {
|
|
4
|
+
${on(en.light,` `)}
|
|
6
5
|
}
|
|
7
6
|
@media (prefers-color-scheme: dark) {
|
|
8
7
|
:where(:root:not([data-theme="light"])) {
|
|
9
|
-
${
|
|
8
|
+
${on(en.dark,` `)}
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
11
|
:where([data-theme="dark"]) {
|
|
13
|
-
${
|
|
14
|
-
}
|
|
15
|
-
${tl}
|
|
12
|
+
${on(en.dark,` `)}
|
|
13
|
+
}`}
|
|
16
14
|
:where(.ec-chart) { display: block; max-width: 100%; height: auto; overflow: visible; touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
|
|
17
15
|
:where(.ec-chart text) { font-variant-numeric: tabular-nums; }
|
|
18
|
-
:where(.ec-chart .ec-gridline) { stroke: var(--ec-grid, ${
|
|
19
|
-
:where(.ec-chart .ec-baseline) { stroke: var(--ec-axis, ${
|
|
20
|
-
:where(.ec-chart .ec-tick) { fill: var(--ec-text-muted, ${
|
|
21
|
-
:where(.ec-chart .ec-label) { fill: var(--ec-text, ${
|
|
22
|
-
:where(.ec-chart .ec-value, .ec-chart .ec-text) { fill: var(--ec-text, ${
|
|
16
|
+
:where(.ec-chart .ec-gridline) { stroke: var(--ec-grid, ${Z.grid}); stroke-width: 1; }
|
|
17
|
+
:where(.ec-chart .ec-baseline) { stroke: var(--ec-axis, ${Z.axis}); stroke-width: 1; }
|
|
18
|
+
:where(.ec-chart .ec-tick) { fill: var(--ec-text-muted, ${Z[`text-muted`]}); font-size: 11px; }
|
|
19
|
+
:where(.ec-chart .ec-label) { fill: var(--ec-text, ${Z.text}); font-size: 12.5px; }
|
|
20
|
+
:where(.ec-chart .ec-value, .ec-chart .ec-text) { fill: var(--ec-text, ${Z.text}); font-size: 12.5px; font-weight: 600; }
|
|
21
|
+
:where(.ec-overlay .ec-text) { fill: var(--ec-text, ${Z.text}); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
23
22
|
:where(.ec-chart .ec-hit) { fill: transparent; }
|
|
24
23
|
:where(.ec-chart .ec-mark:focus) { outline: none; }
|
|
25
24
|
:where(.ec-chart .ec-focus) { pointer-events: none; }
|
|
26
|
-
:where(.ec-chart .ec-focus-ring) { fill: none; stroke: var(--ec-focus, ${
|
|
27
|
-
:where(.ec-chart .ec-focus-gap) { fill: var(--ec-surface, ${
|
|
25
|
+
:where(.ec-chart .ec-focus-ring) { fill: none; stroke: var(--ec-focus, ${Z.focus}); }
|
|
26
|
+
:where(.ec-chart .ec-focus-gap) { fill: var(--ec-surface, ${Z.surface}); stroke: var(--ec-surface, ${Z.surface}); }
|
|
28
27
|
:where(.ec-chart .ec-body > *) { transition: opacity var(--ec-hover-duration, 100ms) ease-out; }
|
|
29
28
|
:where(.ec-chart .ec-segment) { fill: var(--ec-mark); transition: fill var(--ec-hover-duration, 100ms) ease-out, opacity var(--ec-hover-duration, 100ms) ease-out; }
|
|
30
29
|
:where(.ec-chart .ec-hot .ec-segment) { fill: var(--ec-mark-strong); }
|
|
31
30
|
:where(.ec-chart .ec-stroke) { fill: none; stroke: var(--ec-mark); stroke-linejoin: round; transition: stroke var(--ec-hover-duration, 100ms) ease-out, opacity var(--ec-hover-duration, 100ms) ease-out; }
|
|
32
31
|
:where(.ec-chart .ec-hot .ec-stroke) { stroke: var(--ec-mark-strong); }
|
|
33
|
-
:where(.ec-chart .ec-end) { fill: var(--ec-mark); stroke: var(--ec-surface, ${
|
|
34
|
-
:where(.ec-chart .ec-dot) { fill: var(--ec-mark); stroke: var(--ec-surface, ${
|
|
32
|
+
:where(.ec-chart .ec-end) { fill: var(--ec-mark); stroke: var(--ec-surface, ${Z.surface}); stroke-width: 2; }
|
|
33
|
+
:where(.ec-chart .ec-dot) { fill: var(--ec-mark); stroke: var(--ec-surface, ${Z.surface}); stroke-width: 2; opacity: 0; transition: opacity var(--ec-hover-duration, 100ms) ease-out, fill var(--ec-hover-duration, 100ms) ease-out; }
|
|
35
34
|
:where(.ec-chart .ec-hot .ec-dot) { fill: var(--ec-mark-strong); opacity: 1; }
|
|
36
|
-
:where(.ec-chart .ec-
|
|
35
|
+
:where(.ec-chart .ec-alone .ec-dot) { opacity: 1; }
|
|
36
|
+
:where(.ec-chart .ec-crosshair) { stroke: var(--ec-axis, ${Z.axis}); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
|
|
37
37
|
:where(.ec-chart .ec-column:focus) { outline: none; }
|
|
38
38
|
:where(.ec-chart .ec-lines, .ec-chart .ec-points) { pointer-events: none; }
|
|
39
|
-
:where(.ec-chart .ec-slice) { fill: var(--ec-mark); stroke: var(--ec-surface, ${
|
|
39
|
+
:where(.ec-chart .ec-slice) { fill: var(--ec-mark); stroke: var(--ec-surface, ${Z.surface}); stroke-width: 2; stroke-linejoin: round; transition: fill var(--ec-hover-duration, 100ms) ease-out, opacity var(--ec-hover-duration, 100ms) ease-out; }
|
|
40
40
|
:where(.ec-chart .ec-hot .ec-slice) { fill: var(--ec-mark-strong); }
|
|
41
|
-
:where(.ec-chart .ec-center-value) { fill: var(--ec-text, ${
|
|
42
|
-
:where(.ec-chart .ec-center-label) { fill: var(--ec-text-muted, ${
|
|
41
|
+
:where(.ec-chart .ec-center-value) { fill: var(--ec-text, ${Z.text}); font-size: 26px; font-weight: 600; }
|
|
42
|
+
:where(.ec-chart .ec-center-label) { fill: var(--ec-text-muted, ${Z[`text-muted`]}); font-size: 12.5px; }
|
|
43
43
|
:where(.ec-chart.ec-hovering .ec-mark:not(.ec-hot) > .ec-body > *) { opacity: var(--ec-dim-opacity, 0.3); }
|
|
44
|
+
:where(.ec-hovering .ec-run:not(.ec-hot) > .ec-follow) { opacity: var(--ec-dim-opacity, 0.3); }
|
|
45
|
+
:where(.ec-follow) { transition: opacity var(--ec-hover-duration, 100ms) ease-out; }
|
|
44
46
|
:where(.ec-chart.ec-morphing .ec-marks) { visibility: hidden; }
|
|
45
47
|
:where(.ec-switch) { display: grid; grid-template-columns: minmax(0, 1fr); position: relative; }
|
|
46
48
|
:where(.ec-switch-view) { grid-area: 1 / 1; min-width: 0; }
|
|
47
49
|
:where(.ec-switch-view.ec-switch-inactive) { visibility: hidden; }
|
|
48
50
|
:where(.ec-switch-view.ec-switching .ec-focus, .ec-switch-view.ec-switching .ec-overlay, .ec-switch-view.ec-switching .ec-columns) { visibility: hidden; }
|
|
49
51
|
:where(.ec-switch-overlay) { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
|
|
50
|
-
:where(.ec-motion-switch) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--ec-text, ${
|
|
52
|
+
:where(.ec-motion-switch) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--ec-text, ${Z.text}); font-size: 13px; }
|
|
51
53
|
:where(.ec-motion-label) { font-weight: 600; }
|
|
52
|
-
:where(.ec-motion-modes) { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--ec-ring, color-mix(in srgb, currentColor 12%, transparent)); border-radius: 8px; background: var(--ec-surface, ${
|
|
54
|
+
:where(.ec-motion-modes) { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--ec-ring, color-mix(in srgb, currentColor 12%, transparent)); border-radius: 8px; background: var(--ec-surface, ${Z.surface}); }
|
|
53
55
|
:where(.ec-motion-modes button) { font: inherit; color: inherit; border: 0; background: transparent; padding: 5px 10px; border-radius: 6px; cursor: pointer; }
|
|
54
|
-
:where(.ec-motion-modes button:hover, .ec-motion-modes button[aria-pressed="true"]) { background: color-mix(in srgb, var(--ec-focus, ${
|
|
56
|
+
:where(.ec-motion-modes button:hover, .ec-motion-modes button[aria-pressed="true"]) { background: color-mix(in srgb, var(--ec-focus, ${Z.focus}) 12%, transparent); }
|
|
55
57
|
:where(.ec-motion-modes button[aria-pressed="true"]) { font-weight: 600; }
|
|
56
|
-
:where(.ec-motion-modes button:focus-visible) { outline: 2px solid var(--ec-focus, ${
|
|
58
|
+
:where(.ec-motion-modes button:focus-visible) { outline: 2px solid var(--ec-focus, ${Z.focus}); outline-offset: 2px; }
|
|
57
59
|
@media (forced-colors: active) {
|
|
58
60
|
/* Forced colours drop the pressed mode's tint, which leaves only its weight: it takes the viewer's selection colours. */
|
|
59
61
|
:where(.ec-motion-modes button[aria-pressed="true"]) { background: Highlight; color: HighlightText; }
|
|
60
62
|
}
|
|
61
|
-
:where(.ec-motion-hint) { flex: 1 1 220px; min-width: 0; color: var(--ec-text-muted, ${
|
|
62
|
-
:where(.ec-play) { font: inherit; font-size: 13px; font-weight: 600; color: var(--ec-text, ${
|
|
63
|
-
:where(.ec-play:hover) { background: color-mix(in srgb, var(--ec-focus, ${
|
|
64
|
-
:where(.ec-play:focus-visible) { outline: 2px solid var(--ec-focus, ${
|
|
63
|
+
:where(.ec-motion-hint) { flex: 1 1 220px; min-width: 0; color: var(--ec-text-muted, ${Z[`text-muted`]}); }
|
|
64
|
+
:where(.ec-play) { font: inherit; font-size: 13px; font-weight: 600; color: var(--ec-text, ${Z.text}); border: 1px solid var(--ec-ring, color-mix(in srgb, currentColor 12%, transparent)); background: var(--ec-surface, ${Z.surface}); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
|
|
65
|
+
:where(.ec-play:hover) { background: color-mix(in srgb, var(--ec-focus, ${Z.focus}) 12%, var(--ec-surface, ${Z.surface})); }
|
|
66
|
+
:where(.ec-play:focus-visible) { outline: 2px solid var(--ec-focus, ${Z.focus}); outline-offset: 2px; }
|
|
65
67
|
:where(.ec-chart .ec-leaving, .ec-chart .ec-overlay) { pointer-events: none; }
|
|
66
68
|
:where(.ec-attached.ec-dimmed) { opacity: var(--ec-dim-opacity, 0.3); }
|
|
67
69
|
:where(.ec-attached) { transition: opacity var(--ec-hover-duration, 100ms) ease-out, fill var(--ec-hover-duration, 100ms) ease-out, stroke var(--ec-hover-duration, 100ms) ease-out; }
|
|
68
70
|
:where(.ec-tooltip-layer) { position: relative; height: 0; }
|
|
69
|
-
:where(.ec-tooltip) { position: absolute; left: 0; top: 0; z-index: 3; box-sizing: border-box; width: max-content; max-width: 24em; padding: 8px 10px; border: 1px solid var(--ec-ring, color-mix(in srgb, currentColor 12%, transparent)); border-radius: 8px; background: var(--ec-surface, ${
|
|
70
|
-
:where(.ec-tooltip.ec-tooltip-shown) { opacity: 1; visibility: visible; transition: opacity var(--ec-hover-duration, 100ms) ease-out; }
|
|
71
|
+
:where(.ec-tooltip) { position: absolute; left: 0; top: 0; z-index: 3; box-sizing: border-box; width: max-content; max-width: 24em; padding: 8px 10px; border: 1px solid var(--ec-ring, color-mix(in srgb, currentColor 12%, transparent)); border-radius: 8px; background: var(--ec-surface, ${Z.surface}); color: var(--ec-text, ${Z.text}); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12); font-size: 13px; line-height: 1.35; white-space: pre-line; font-variant-numeric: tabular-nums; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity var(--ec-hover-duration, 100ms) ease-out, visibility 0s linear var(--ec-hover-duration, 100ms); }
|
|
72
|
+
:where(.ec-tooltip.ec-tooltip-shown) { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity var(--ec-hover-duration, 100ms) ease-out; }
|
|
73
|
+
:where(.ec-tooltip-bridge) { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; }
|
|
74
|
+
:where(.ec-tooltip-shown + .ec-tooltip-bridge) { pointer-events: auto; }
|
|
75
|
+
:where(.ec-tooltip-through > .ec-tooltip, .ec-tooltip-through > .ec-tooltip-bridge) { pointer-events: none; }
|
|
71
76
|
:where(.ec-tooltip-title) { font-weight: 600; }
|
|
72
|
-
:where(.ec-legend) { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 8px; font-size: 13px; line-height: 1.4; color: var(--ec-text, ${
|
|
77
|
+
:where(.ec-legend) { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 8px; font-size: 13px; line-height: 1.4; color: var(--ec-text, ${Z.text}); }
|
|
73
78
|
:where(.ec-legend-item) { display: inline-flex; align-items: center; gap: 6px; }
|
|
74
79
|
:where(.ec-legend-swatch) { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--ec-mark); forced-color-adjust: none; }
|
|
75
|
-
:where(.ec-table) { margin-top: 8px; font-size: 13px; line-height: 1.4; color: var(--ec-text, ${
|
|
76
|
-
:where(.ec-table summary) { cursor: pointer; color: var(--ec-text-muted, ${
|
|
77
|
-
:where(.ec-table summary:focus-visible) { outline: 2px solid var(--ec-focus, ${
|
|
80
|
+
:where(.ec-table) { margin-top: 8px; font-size: 13px; line-height: 1.4; color: var(--ec-text, ${Z.text}); }
|
|
81
|
+
:where(.ec-table summary) { cursor: pointer; color: var(--ec-text-muted, ${Z[`text-muted`]}); font-weight: 600; }
|
|
82
|
+
:where(.ec-table summary:focus-visible) { outline: 2px solid var(--ec-focus, ${Z.focus}); outline-offset: 2px; border-radius: 2px; }
|
|
78
83
|
:where(.ec-table-scroll) { overflow-x: auto; margin-top: 8px; }
|
|
79
84
|
:where(.ec-table table) { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
|
|
80
|
-
:where(.ec-table th, .ec-table td) { text-align: left; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--ec-grid, ${
|
|
81
|
-
:where(.ec-table thead th) { color: var(--ec-text-muted, ${
|
|
85
|
+
:where(.ec-table th, .ec-table td) { text-align: left; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--ec-grid, ${Z.grid}); font-weight: 400; }
|
|
86
|
+
:where(.ec-table thead th) { color: var(--ec-text-muted, ${Z[`text-muted`]}); font-size: 12px; font-weight: 600; }
|
|
82
87
|
:where(.ec-table .ec-num) { text-align: right; }
|
|
83
88
|
:where(.ec-table-caption, .ec-visually-hidden) { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
|
|
84
|
-
`,pi="data-expressive-charts";var hn={};function gt(e){if(hn.injectStyles===!1||e.querySelector(`style[${pi}]`))return;let t=e.createElement("style");t.setAttribute(pi,""),hn.nonce&&t.setAttribute("nonce",hn.nonce),t.textContent=nl,(e.head??e.documentElement).appendChild(t)}function Hr(e={}){let t=new Map;for(let[n,r]of Object.entries(e)){if(!Number.isInteger(r)||r<1||r>8)throw new RangeError(`colorAssignment: the slot for "${n}" must be a whole number from 1 to ${8}, got ${String(r)}.`);t.set(n,r)}return{slot(n){let r=t.get(n);if(r===void 0){let o=new Set(t.values());for(r=1;o.has(r)&&r<=8;)r++;r>8&&(r=t.size%8+1),t.set(n,r)}return r}}}function $t(e){return e&&typeof e.slot=="function"?e:Hr(e)}function bi(e,t){if(e===void 0||typeof e=="boolean")return;let n=o=>{throw new TypeError(`${t}: ${o}`)};(typeof e!="object"||e===null||Array.isArray(e))&&n("legend must be true or false, or an object with the entries the page adds.");let{entries:r}=e;r!==void 0&&(Array.isArray(r)||n("legend.entries must be an array of { label, color }."),r.forEach((o,a)=>{let{label:i,color:s}=typeof o=="object"&&o!==null?o:n(`legend.entries[${a}] must be an object with a label and a color.`);(typeof i!="string"||i.trim()==="")&&n(`legend.entries[${a}].label must be a non-empty string: the entry's name.`),(typeof s!="string"||s.trim()==="")&&n(`legend.entries[${a}].color must be a theme token or a CSS colour.`),(s==="mark"||s==="mark-strong")&&n(`legend.entries[${a}].color can't be "${s}": an entry has no mark. Use a theme token or a CSS colour.`)}))}var gi=e=>typeof e=="object"?e.entries??[]:[];function On(e){let t,n="",r=()=>{t?.remove(),t=void 0,n=""},o=(a,i,s,c)=>{let d=[...a.map(({key:f,label:h})=>({key:f,label:h,styles:ht(at(i.slot(f)))})),...c.map(({label:f,color:h})=>({key:void 0,label:f,styles:{"--ec-mark":it(h)}}))],l=e.ownerDocument;t??(t=Object.assign(l.createElement("div"),{className:"ec-legend"})),t.nextSibling!==e&&e.before(t);let u=JSON.stringify([s,d]);u!==n&&(n=u,t.replaceChildren(...d.map(({key:f,label:h,styles:w})=>{let v=l.createElement("span");v.className="ec-legend-item",f!==void 0&&v.setAttribute(s,f);for(let[P,V]of Object.entries(w))V!==void 0&&v.style.setProperty(P,V);let D=l.createElement("span");D.className="ec-legend-swatch";let F=l.createElement("span");return F.className="ec-legend-label",F.textContent=h,v.append(D,F),v})))};return{update(a,i,s){let c=gi(s);s===!1||a.length+c.length<2?r():o(a.map(({series:d,label:l})=>({key:d,label:l})),i,"data-series",c)},categories(a,i,s){s===!1||a.length===0?r():o(a,i,"data-key",gi(s))},destroy:r}}var zt=e=>e!==void 0&&e.source!=="linked",jo=new WeakMap,jr=new WeakSet;function _t(e,t){return jo.set(t,e),t}var wi=e=>jo.get(e);function zo(e,t={}){if(!Array.isArray(e))throw new TypeError("link needs an array of charts and attachments: link([columns, line]).");if(typeof t!="object"||t===null)throw new TypeError("link: options must be an object, such as { by: (event) => event.data.datum.week }.");let{by:n,effects:r=!0}=t;if(n!==void 0&&typeof n!="function")throw new TypeError("link: by must be a function, such as (event) => event.data.datum.week.");if(typeof r!="boolean")throw new TypeError(`link: effects must be true or false, got ${String(r)}.`);let o=[];for(let l of e){let u=typeof l=="object"&&l!==null?jo.get(l):void 0;if(!u)throw new TypeError("link: each source must be a chart (barChart, donutChart or lineChart) or an attachment (expressive or fromVegaView). A chartSwitch can't be linked yet.");if(jr.has(u)||o.includes(u))throw new TypeError("link: a chart or attachment can be in one link at a time. Destroy the link it's in first.");o.push(u)}let a=new Set,i;function s(l){let u;if(n)try{u=n(l)}catch(f){Se(f);return}else{let{samples:f}=l.data;u=f[f.length-1]?.at??l.mark.key}return u instanceof Date?Number.isNaN(u.getTime())?void 0:u.toISOString():u==null?void 0:String(u)}function c(l,u){i=l;let f=new Set(u.map(s));f.delete(void 0);let h=w=>w.some(v=>{let D=s(v);return D!==void 0&&f.has(D)});for(let w of a){if(w===l)continue;let v=f.size===0?[]:w.targets().flatMap(D=>h(D.marks)?[D.key]:[]);if(w.hover(v,r),i!==l)return}}function d(l){if(i===l){i=void 0;for(let u of a)u.unlink()}}for(let l of o)l.listen({hover:f=>c(l,f),leave:()=>d(l),dismiss(){let f=i;f?.leave(),f&&d(f)},gone(){a.delete(l),jr.delete(l),d(l)}})&&(a.add(l),jr.add(l));return{destroy(){for(let l of a)l.listen(void 0),l.unlink(),jr.delete(l);a.clear(),i=void 0}}}var vi=["presentation","analysis","off"];function cn(e,t){if(e===void 0)return t;if(typeof e!="string")return e;if(!vi.includes(e))throw new TypeError(`Unknown motion mode "${String(e)}". Use one of: ${vi.join(", ")}.`);let n=()=>t.viewerChoice??(t.prefersReduced?"off":e);return{get mode(){return n()},get staged(){return n()==="presentation"},duration(r,o="transition"){let a=n();return a==="off"?0:ir(r,ar[a][o])},subscribe:r=>t.subscribe(r)}}var ki=2,rl=2,xi=new WeakMap,ol=0;function zr(e){let t=e.ownerDocument,n=(xi.get(t)??0)+1;xi.set(t,n);let r=Y("mask",{id:`ec-focus-mask-${n}`,maskUnits:"userSpaceOnUse",x:-1e5,y:-1e5,width:2e5,height:2e5},e);Y("rect",{x:-1e5,y:-1e5,width:2e5,height:2e5,fill:"white"},r);let o=Y("path",{stroke:"black","stroke-linejoin":"round"},r),a=Y("path",{class:"ec-focus-ring",visibility:"hidden","stroke-linejoin":"round",mask:`url(#${r.id})`},e);return $e(a,{fill:"none",stroke:it("focus")}),{draw(i){if(!i){le(a,{visibility:"hidden"});return}let{outline:s,thickness:c,transform:d}=i,l=s.closed?0:c;le(o,{d:s.d,fill:s.closed?"black":"none","stroke-width":l+2*ki}),le(a,{d:s.d,"stroke-width":l+2*(ki+rl),transform:d&&pt(d),visibility:void 0})}}}function _r(){let e,t=()=>{e?.remove(),e=void 0};return{paint(n,r,o,a){if(!o||!n||r.length===0){t();return}(!e||e.parentNode!==n)&&(e?.remove(),e=Y("g",{class:"ec-halo"},n)),e.textContent="";let i=`ec-halo-mask-${++ol}`,s=Y("mask",{id:i,maskUnits:"userSpaceOnUse",x:-1e5,y:-1e5,width:2e5,height:2e5},e);Y("rect",{x:-1e5,y:-1e5,width:2e5,height:2e5,fill:"white"},s);for(let c of r){let d=c.stroke===void 0?{fill:"black"}:{fill:"none",stroke:"black","stroke-width":c.stroke,"stroke-linejoin":"round"};Y("path",{d:c.d,...d},s)}le(e,{transform:a&&pt(a)});for(let c of r){let d=c.stroke!==void 0,l=Y("path",{d:c.d,"stroke-width":o.width+(c.stroke??0),"stroke-opacity":o.opacity,"stroke-linejoin":"round","stroke-linecap":d?"round":void 0,mask:`url(#${i})`},e);$e(l,{fill:"none",stroke:o.color===void 0?c.color??it("mark"):it(o.color)})}},remove:t}}function gn(e,t={}){let n={},r,o=t.halos&&_r(),a=()=>{let s=e();if(!s)return;let{body:c,parts:d}=s;le(c,{transform:n.transform&&pt(n.transform),opacity:n.opacity});let l=n.emphasis;for(let u of d)$e(u.element,{[u.open?"stroke":"fill"]:l===void 0?void 0:al(u.colors,l),transition:l===void 0?void 0:"none"});i(c,d)},i=(s,c)=>{let d=n.halo;if(o){let u=c.flatMap(f=>f.visible?[{d:f.d,color:f.colors.color,...f.open?{stroke:f.open.width}:{}}]:[]);o.paint(t.halos?.(),u,d,n.transform);return}if(!d){r?.remove(),r=void 0;return}(!r||r.parentNode!==s)&&(r?.remove(),r=Y("g",{class:"ec-halo"},s),s.insertBefore(r,s.firstChild));let l=c.filter(u=>u.visible);for(;r.childElementCount>l.length;)r.lastElementChild?.remove();l.forEach((u,f)=>{let h=r.children[f]??Y("path",{"stroke-linejoin":"round"},r);le(h,{d:u.d,"stroke-width":d.width+(u.open?.width??0),"stroke-opacity":d.opacity,"stroke-linecap":u.open?"round":void 0}),$e(h,{fill:"none",stroke:d.color===void 0?u.colors.color:it(d.color)})})};return{get style(){return n},set(s){n=Yt(n,s),a()},reset(){n={},a()},repaint:a}}function al(e,t){let n=Math.min(1,Math.max(0,t));return n===0?e.color:n===1?e.strong:`color-mix(in srgb, ${e.strong} ${Math.round(n*1e3)/10}%, ${e.color})`}var il=0;function pr(e){return{icon(t,n){let r=n?.size;if(r!==void 0&&!(r>=0))throw new RangeError(`layer.icon: size must be a non-negative number, got ${String(r)}.`);let o=Y("g",{class:"ec-icon","data-icon":t.name,visibility:"hidden"},e),a=r===void 0||!(t.size>0)?1:r/t.size,i=a===1?o:Y("g",{transform:pt(xe.scale(a,a,t.anchor))},o);for(let c of t.shapes)sl(c,i);return{place(c){le(o,{transform:pt(c),visibility:void 0})},remove:()=>o.remove()}},path(t,n){let r=Y("path",{class:"ec-path",d:t},e),o={...n};return Mi(r,o),{update(i,s){r.setAttribute("d",i),s&&(o=Yt(o,s),Mi(r,o))},remove:()=>r.remove()}},text(t,n){let r=Y("text",{class:"ec-text"},e);r.textContent=t;let o={...n};return Si(r,o),{update(i,s){o=Yt(o,i),Si(r,o),s!==void 0&&(r.textContent=s)},remove:()=>r.remove()}}}}function sl(e,t){let n;if(e.clip!==void 0){n=`ec-clip-${++il}`;let o=Y("clipPath",{id:n},t);Y("path",{d:e.clip},o)}let r=Y("path",{d:e.d,"clip-path":n&&`url(#${n})`,"stroke-width":e.stroke===void 0?void 0:e.width??1,"stroke-linecap":e.linecap,"stroke-linejoin":e.linejoin},t);$e(r,{fill:e.fill===void 0?"none":it(e.fill),stroke:e.stroke===void 0?void 0:it(e.stroke)})}function Mi(e,t){le(e,{"stroke-width":t.stroke===void 0?void 0:t.width??1,opacity:t.opacity,"stroke-linecap":t.linecap,"stroke-linejoin":"round"}),$e(e,{fill:t.fill===void 0?"none":it(t.fill),stroke:t.stroke===void 0?void 0:it(t.stroke)})}function Si(e,t){le(e,{x:t.at.x,y:t.at.y,"text-anchor":t.anchor??"start",opacity:t.opacity}),$e(e,{fill:it(t.color??"text")})}function ln(e){let{overlay:t}=e,n=new WeakMap,r=new Map,o=new Set;return{group(a,i,s){let c=Y("g",{class:"ec-run","data-key":a,"data-slot":i,visibility:o.has(a)?"hidden":void 0},t);$e(c,ht(e.colors(a))),n.set(c,s);let d=Array.from(t.children).find(f=>(n.get(f)??-1/0)>s);t.insertBefore(c,d??null);let l=r.get(a);l||r.set(a,l=new Set),l.add(c);let u=l;return{...pr(c),clear(){c.remove(),u.delete(c),u.size===0&&r.get(a)===u&&r.delete(a)}}},mark:a=>e.mark(a),recolor(a){let i=r.get(a);if(!i)return;let s=ht(e.colors(a));for(let c of i)$e(c,s)},hide(a,i){i?o.add(a):o.delete(a);for(let s of r.get(a)??[])le(s,{visibility:i?"hidden":void 0})}}}function Xe(e,t){return e!==void 0&&Object.prototype.hasOwnProperty.call(e,t)?e[t]??t:t}function Ei(e,t){if(e!==void 0){if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError(`${t}: seriesLabels must be an object of names by series, as { goals: "Goals" }.`);for(let[n,r]of Object.entries(e))if(typeof r!="string"||r.trim()==="")throw new TypeError(`${t}: seriesLabels.${n} must be a name, not ${typeof r=="string"?"blank":String(r)}.`)}}function An(e){let t={enter:new Set,update:new Set,exit:new Set,hover:new Set,leave:new Set};function n(r,o){for(let a of[...t[r]])try{a(o)}catch(i){Se(i)}}return{emit:n,emitEach(r,o,a){o.forEach((i,s)=>n(r,{...a(i),batch:{index:s,count:o.length}}))},on(r,o){let a=t[r];if(!a)throw new TypeError(`${e}: unknown event "${String(r)}". Use one of: ${Object.keys(t).join(", ")}.`);return a.add(o),()=>{a.delete(o)}},clear(){for(let r of Object.values(t))r.clear()}}}function qe(e){return e.format??cl}var _o;function cl(e){return _o??(_o=new Intl.NumberFormat(void 0,{maximumFractionDigits:2})),_o.format(e)}function Kt(e){let t=String(Number(e.toPrecision(12)));if(/e/i.test(t))return 6;let n=t.indexOf(".");return n<0?0:Math.min(6,t.length-n-1)}function bn(e,t){let n=10**t,r=Math.round(e*n)/n;return r===0?0:r}function wn(e){return`${bn(e*100,0)}%`}function Kr(e,t){let n=e.ownerDocument,r,o="mouse",a=(f,h)=>{f?.key!==r&&(i(),f&&(r=f.key,t.hover(f,h)))},i=()=>{r!==void 0&&(r=void 0,t.leave())},s=f=>{f.pointerType!=="touch"&&a(t.find(f.target),"pointer")},c=f=>{f.pointerType!=="touch"&&i()},d=f=>{o=f.pointerType},l=f=>{o==="touch"&&a(t.find(f.target),"touch")},u=f=>{r!==void 0&&f.pointerType==="touch"&&!e.contains(f.target)&&i()};return e.addEventListener("pointerover",s),e.addEventListener("pointerleave",c),e.addEventListener("pointerdown",d),e.addEventListener("click",l),n.addEventListener("pointerdown",u,!0),{get current(){return r},clear:i,destroy(){r=void 0,e.removeEventListener("pointerover",s),e.removeEventListener("pointerleave",c),e.removeEventListener("pointerdown",d),e.removeEventListener("click",l),n.removeEventListener("pointerdown",u,!0)}}}function Ur(e,t){let n,r,o,a,i,s=[],c=!0,d=t.tabIndex??((x,R)=>{let O=t.element(x);R===void 0?O?.removeAttribute("tabindex"):O?.setAttribute("tabindex",R)}),l=x=>{for(let R of x)d(R,R===i?"0":"-1")},u=x=>{i=x,l(t.order()),t.element(x)?.focus()},f=()=>{let x=r;r=void 0,x!==void 0&&t.blur(x)},h=x=>{!x.metaKey&&!x.altKey&&!x.ctrlKey&&(c=!0)},w=()=>{c=!1,a=void 0},v=x=>{a=void 0;let R=t.find(x.target);if(R===void 0){f();return}let O=t.element(R);O&&O!==x.target&&x.target.getAttribute("aria-hidden")==="true"&&(O.focus(),n?.scope.activeElement===O)||(o={key:R,element:x.target},R!==r&&(r=R,i=R,l(t.order()),t.focus(R,c)))},D=x=>{let R=o?.element;r===void 0||!R||x.target!==R||t.find(x.relatedTarget)===void 0&&(f(),x.relatedTarget===null&&(a=R,queueMicrotask(()=>{a===R&&R.isConnected&&(a=void 0)})))},F=x=>{let R=t.find(x.target);if(R===void 0||x.altKey||x.ctrlKey||x.metaKey)return;let O=t.order(),G=O.indexOf(R),g;switch(x.key){case"ArrowDown":case"ArrowRight":g=O[Math.min(O.length-1,G+1)];break;case"ArrowUp":case"ArrowLeft":g=O[Math.max(0,G-1)];break;case"Home":g=O[0];break;case"End":g=O[O.length-1];break;case"Escape":t.escape(R)&&x.preventDefault();return;default:return}x.preventDefault(),g!==void 0&&g!==R&&u(g)},P=()=>{n&&(n.doc.removeEventListener("keydown",h,!0),n.doc.removeEventListener("pointerdown",w,!0),n.scope.removeEventListener("focusin",v,!0),n.scope.removeEventListener("focusout",D,!0),n.svg.removeEventListener("keydown",F),n=void 0)},V=()=>{let x=e(),R=x?.getRootNode(),O=R&&"host"in R?R:x?.ownerDocument;x===n?.svg&&O===n?.scope||(P(),!(!x||!O)&&(n={svg:x,doc:x.ownerDocument,scope:O},n.doc.addEventListener("keydown",h,!0),n.doc.addEventListener("pointerdown",w,!0),n.scope.addEventListener("focusin",v,!0),n.scope.addEventListener("focusout",D,!0),n.svg.addEventListener("keydown",F)))};return V(),{active:()=>n?.scope.activeElement??null,focus(x){c=!0,x===r&&o?.element===n?.scope.activeElement?t.focus(x,!0):u(x)},sync(){V();let x=t.order(),R=new Set(x),O=s.filter(U=>!R.has(U));(i===void 0||!R.has(i))&&(i=ll(s,i,R)??x[0]);let G=!n?.doc.activeElement||n.doc.activeElement===n.doc.body,g=o!==void 0&&!o.element.isConnected&&(r!==void 0||o.element===a&&G),E=o&&(o.element===n?.scope.activeElement||g)?o:void 0;a=void 0,E&&!R.has(E.key)?i!==void 0?u(i):E.element.isConnected?E.element.blur():f():E&&t.find(E.element)!==E.key&&u(E.key),l(x);for(let U of O)d(U,void 0);s=x},destroy(){r=void 0,o=void 0,a=void 0,P()}}}function ll(e,t,n){let r=t===void 0?-1:e.indexOf(t);if(!(r<0))for(let o=1;o<e.length;o++)for(let a of[r+o,r-o]){let i=e[a];if(i!==void 0&&n.has(i))return i}}function $n(e){let{svg:t,runner:n,events:r}=e,o=g=>e.marks?.(g)??[g],a=g=>(e.markElement??e.element)(g),i,s,c,d=!1,l=g=>g.flatMap(E=>{let U=e.onScreen(E);return U?[{key:E,input:U}]:[]}),u=g=>g.length===1?o(g[0]):[...new Set(g.flatMap(o))];function f(g,E,U,k){if(g.length===0)return;U&&n.hover(g.map(({input:H})=>H));let T=g.length;g.forEach(({input:H},_)=>r.emit("hover",{...H,batch:{index:_,count:T},source:E,...k===void 0?{}:{segment:k}}))}function h(g){let E=l(g);if(E.length===0)return;for(let{key:k}of E)a(k)?.classList.remove("ec-hot");n.leave(E.map(({key:k})=>k));let U=E.length;E.forEach(({input:k},T)=>r.emit("leave",{...k,batch:{index:T,count:U}}))}function w(g,E,U,k=!0){let T=l(u(g)),H={keys:g,source:E,marks:T.map(_=>_.key),effects:k};i=H;for(let{key:_}of T)a(_)?.classList.add("ec-hot");e.dim()&&t.classList.add("ec-hovering"),E!=="linked"&&(e.tooltip.show(g[0]),P(!0)),f(T,E,k,U),E!=="linked"&&i===H&&c?.hover(T.map(({input:_})=>_))}function v(){let g=i;i=void 0,P(!1),t.classList.remove("ec-hovering"),e.tooltip.hide(),h(g?.marks??[]),zt(g)&&c?.leave()}let D,F=g=>{g.key==="Escape"&&!g.defaultPrevented&&i!==void 0&&V()};function P(g){D?.removeEventListener("keydown",F),D=g?t.ownerDocument:void 0,D?.addEventListener("keydown",F)}function V(){R.clear(),i!==void 0&&v()}let x=(g,E)=>E===g||e.live(g)&&o(g).includes(E),R=Kr(t,{find:e.find,hover(g,E){!e.live(g.key)||zt(i)&&i.keys[0]===g.key||(v(),w([g.key],E,g.segment))},leave(){(i?.source==="pointer"||i?.source==="touch")&&v()}}),O=Ur(()=>t,{find:g=>e.find(g)?.key,order:e.order,element:e.element,focus(g,E){if(s=E?g:void 0,e.ring(s),!!e.live(g)){if(!E){i?.source==="keyboard"&&i.keys[0]!==g&&v();return}if(zt(i)&&i.keys[0]===g){i={...i,source:"keyboard"};return}v(),w([g],"keyboard")}},blur(){s=void 0,e.ring(s),i?.source==="keyboard"&&(R.current===i.keys[0]?i={...i,source:"pointer"}:v())},escape(){return i?(i.source==="linked"&&c?c.dismiss():v(),!0):!1}});return{get key(){return zt(i)?i.keys[0]:void 0},get ringKey(){return s},link:{targets:()=>e.order().map(g=>({key:g,marks:l(o(g)).map(({input:E})=>E)})),hover(g,E){i!==void 0&&v();let U=g.filter(e.live);U.length>0&&w(U,"linked",void 0,E)},unlink(){i?.source==="linked"&&v()},leave:V,listen(g){return d?!1:(c=g,!0)}},active:()=>O.active(),restyled(g){s!==void 0&&x(s,g)&&e.ring(s);let E=zt(i)?i.keys[0]:void 0;E!==void 0&&(i?.marks.includes(g)||g===E)&&e.live(E)&&e.tooltip.show(E)},syncDim(){e.dim()?i!==void 0&&t.classList.add("ec-hovering"):t.classList.remove("ec-hovering")},dropGone(){if(i===void 0)return;let g=i.keys.filter(e.live);if(g.length===0){R.clear(),v();return}let{source:E,marks:U,effects:k}=i,T=l(u(g));if(i={...i,keys:g},T.length===U.length&&T.every((z,Z)=>z.key===U[Z]))return;let H=new Set(U),_=new Set(T.map(z=>z.key)),te=l(U.filter(z=>!_.has(z)));i={...i,marks:T.map(z=>z.key)};for(let{key:z}of te)a(z)?.classList.remove("ec-hot");for(let{key:z}of T)H.has(z)||a(z)?.classList.add("ec-hot");n.leave(U),k&&n.hover(T.map(({input:z})=>z)),te.forEach(({input:z},Z)=>r.emit("leave",{...z,batch:{index:Z,count:te.length}}));let ae=T.length;T.forEach(({key:z,input:Z},se)=>{H.has(z)||r.emit("hover",{...Z,batch:{index:se,count:ae},source:E})})},sync:()=>O.sync(),focus(g){e.live(g)&&O.focus(g)},leave:V,destroy(){d=!0,c?.gone(),c=void 0,P(!1),R.destroy(),O.destroy()}}}function dn(e,t,n,r){return!n||n.text===""?[]:[{key:e,role:t,text:n.text,x:n.x,y:n.y,anchor:n.anchor,element:r}]}function Gn(e){let t=new Map;return{get:n=>t.get(n),values:()=>t.values(),start(n){t.set(n.key,n),n.group.classList.add("ec-leaving"),n.group.setAttribute("aria-hidden","true"),n.leave=dl()},recall(n){let r=t.get(n);if(r)return t.delete(n),r.group.classList.remove("ec-leaving"),r.group.removeAttribute("aria-hidden"),r.leave?.resolve(),r.leave=void 0,r},sweep(){for(let n of[...t.values()]){let{leave:r}=n;!r?.exited||e(n)||(t.delete(n.key),n.leave=void 0,n.group.remove(),r.resolve())}},clear:()=>t.clear()}}function dl(){let e;return{exited:!1,gone:new Promise(n=>{e=n}),resolve:e}}function vn(e,t,n,r){if(!n.some((s,c)=>t[c]!==s))return;let o=r(),a=n.findIndex(s=>s===o),i=n[a]??null;n.forEach((s,c)=>{c<a?e.insertBefore(s,i):c>a&&e.appendChild(s)})}function Ti(e,t){if(e===void 0||typeof e=="boolean"||e==="hidden")return;let n=l=>{throw new TypeError(`${t}: ${l}`)};(typeof e!="object"||e===null)&&n('table must be true, false, "hidden" or an object of table options.');let{hidden:r,columns:o,category:a,total:i,share:s,summary:c,series:d}=e;r!==void 0&&typeof r!="boolean"&&n("table.hidden must be true or false.");for(let[l,u]of Object.entries({category:a,total:i,share:s,summary:c}))u!==void 0&&typeof u!="string"&&n(`table.${l} must be a string.`);if(d!==void 0){(typeof d!="object"||d===null||Array.isArray(d))&&n('table.series must be an object of headers by series, as { shots: "Shots" }.');for(let[l,u]of Object.entries(d))typeof u!="string"&&n(`table.series.${l} must be a string: the column's header.`)}o!==void 0&&(Array.isArray(o)||n("table.columns must be an array of { label, field }."),o.forEach((l,u)=>{let f=typeof l=="object"&&l!==null?l:n(`table.columns[${u}] must be an object with a label and a field.`);typeof f.label!="string"&&n(`table.columns[${u}].label must be a string: the column's header.`),typeof f.field!="string"&&typeof f.field!="function"&&n(`table.columns[${u}].field must be a field name or a function of the row.`),f.format!==void 0&&typeof f.format!="function"&&n(`table.columns[${u}].format must be a function.`),f.after!==void 0&&f.after!=="category"&&f.after!=="values"&&n(`table.columns[${u}].after must be "category" or "values".`)}))}function In(e){let{option:t,format:n}=e;if(t===!1)return;let r=typeof t=="object"?t:{},o=r.columns??[],a=o.filter(x=>x.after!=="values"),i=o.filter(x=>x.after==="values"),s=e.total??e.series.length>1,c=x=>({text:n(x),numeric:!0}),d=e.rows.reduce((x,R)=>x+R.total,0),l=x=>e.shares?[{text:wn(d>0?x/d:0),numeric:!0}]:[],u=x=>({text:x.label,numeric:!1}),f=x=>r.series&&Object.prototype.hasOwnProperty.call(r.series,x)?r.series[x]:void 0,h=()=>({text:"",numeric:!1}),w=[{text:r.category??e.category??"Category",numeric:!1},...a.map(u),...e.series.map(x=>({text:f(x)??e.label?.(x)??x,numeric:!0})),...s?[{text:r.total??"Total",numeric:!0}]:[],...e.shares?[{text:r.share??"Share",numeric:!0}]:[],...i.map(u)],v=e.rows.map(x=>{let R=new Map(x.values.map(O=>[O.series,O.value]));return{key:x.key,cells:[{text:x.category,numeric:!1},...a.map(O=>Di(O,x,n)),...e.series.map(O=>c(R.get(O)??0)),...s?[c(x.total)]:[],...l(x.total),...i.map(O=>Di(O,x,n))]}}),D=x=>e.rows.reduce((R,O)=>R+(O.values.find(G=>G.series===x)?.value??0),0),F=e.shares?[{text:r.total??"Total",numeric:!1},...a.map(h),...e.series.map(x=>c(D(x))),...s?[c(d)]:[],...l(d),...i.map(h)]:void 0,P=w.length-i.length,V=[...a.map((x,R)=>1+R),...i.map((x,R)=>P+R)];for(let x of V){let R=v.map(O=>O.cells[x]).filter(O=>O.text!=="");R.length>0&&R.every(O=>O.numeric)&&(w[x]={...w[x],numeric:!0})}return{hidden:t==="hidden"||r.hidden===!0,summary:r.summary??"Data table",caption:e.caption,headers:w,rows:v,...F?{footer:F}:{}}}function Di(e,t,n){let r=typeof e.field=="function"?e.field(t.datum,t.index):t.datum?.[e.field];return e.format?{text:String(e.format(r)),numeric:typeof r=="number"}:r==null?{text:"",numeric:!1}:typeof r=="number"?{text:n(r),numeric:!0}:{text:String(r),numeric:!1}}function Vn(e){let t=e.ownerDocument,n,r,o,a,i,s,c,d=new Map,l="",u=(D,F)=>{let P=t.createElement(D);return F&&(P.className=F),P};function f(){o=u("table"),a=u("caption","ec-table-caption");let D=u("thead");return i=u("tr"),D.appendChild(i),s=u("tbody"),o.append(a,D,s),o}function h(D,F){let P=D?"DIV":"DETAILS";if(n?.tagName!==P){let V=D?u("div","ec-table ec-visually-hidden"):u("details","ec-table"),x=o??f();if(D)r=void 0,V.appendChild(x);else{r=u("summary");let R=u("div","ec-table-scroll");R.appendChild(x),V.append(r,R)}n?.isConnected&&n.replaceWith(V),n=V}n.isConnected||e.after(n),r&&r.textContent!==F&&(r.textContent=F)}function w(D,{text:F,numeric:P}){D.textContent!==F&&(D.textContent=F),D.classList.toggle("ec-num",P)}function v(){n?.remove(),n=r=o=a=i=s=c=void 0,d.clear(),l=""}return{render(D){if(!D){v();return}h(D.hidden,D.summary),a.textContent!==D.caption&&(a.textContent=D.caption);let F=JSON.stringify(D.headers);F!==l&&(l=F,i.replaceChildren(...D.headers.map(R=>{let O=u("th");return O.scope="col",w(O,R),O})),d.clear(),s.replaceChildren());let P=new Set(D.rows.map(R=>R.key));for(let[R,O]of d)P.has(R)||(O.remove(),d.delete(R));if(D.rows.forEach((R,O)=>{let G=d.get(R.key);G||(G=u("tr"),G.setAttribute("data-key",R.key),R.cells.forEach((g,E)=>{let U=u(E===0?"th":"td");E===0&&(U.scope="row"),G.appendChild(U)}),d.set(R.key,G)),R.cells.forEach((g,E)=>w(G.cells[E],g)),s.children[O]!==G&&s.insertBefore(G,s.children[O]??null)}),!D.footer){c?.remove(),c=void 0;return}let V=D.footer,x=c?.rows[0];(!c||!x||x.cells.length!==V.length)&&(c?.remove(),c=u("tfoot"),x=u("tr"),V.forEach((R,O)=>{let G=u(O===0?"th":"td");O===0&&(G.scope="row"),x.appendChild(G)}),c.appendChild(x),o.appendChild(c)),V.forEach((R,O)=>w(x.cells[O],R))},destroy:v}}var ul=640;function un(e,t){if(typeof e=="string"){let n=typeof document>"u"?null:document.querySelector(e);if(!n)throw new TypeError(`${t}: no element matches "${e}".`);return n}if(!e||typeof e.appendChild!="function")throw new TypeError(`${t} needs a container element or a selector.`);return e}function Nn(e){let t=e.ownerDocument.defaultView?.getComputedStyle(e),n=(parseFloat(t?.paddingLeft??"")||0)+(parseFloat(t?.paddingRight??"")||0),r=e.clientWidth-n;return r>0?r:ul}function fn(e,t){e.setAttribute("aria-label",t.label);let n=e.querySelector(":scope > desc");t.description?(n??(n=e.insertBefore(Y("desc",{},e),e.firstChild)),n.textContent=t.description):n?.remove()}function Fn(e,t,n){for(let r of Ht){let o=e[r];if(o?.kind==="data"){for(let a of o.needs?.related??[])if(!t.includes(a))throw new RangeError(`${n}: on.${r} needs the series "${a}", but the chart's series are ${t.map(i=>`"${i}"`).join(", ")}.`)}}}function Bn(e,t,n,r){let o=s=>Ht.includes(s)&&n?.[s]!==void 0&&n[s]===t?.[s],a=jt(Object.fromEntries(Object.entries(n??{}).filter(([s])=>!o(s))),r),i={};for(let s of Ht){let c=o(s)?e[s]:a[s];c&&(i[s]=c)}return i}function kn(e,t){if(typeof e!="object"||e===null)throw new TypeError(`${t} needs options.`);if(typeof e.label!="string"||e.label.trim()==="")throw new TypeError(`${t} needs a label: the chart's accessible name.`);if(!Array.isArray(e.data))throw new TypeError(`${t}: data must be an array of rows.`);for(let c of["width","height"]){let d=e[c];if(d!==void 0&&!(typeof d=="number"&&Number.isFinite(d)&&d>0))throw new RangeError(`${t}: ${c} must be a positive number of px, got ${String(d)}.`)}let{format:n,tooltip:r,markLabel:o,markDescription:a,legend:i,announce:s}=e;if(n!==void 0&&typeof n!="function")throw new TypeError(`${t}: format must be a function that turns a value into text.`);if(r!==void 0&&typeof r!="boolean"&&typeof r!="function")throw new TypeError(`${t}: tooltip must be true, false or a function that returns a row's text.`);if(o!==void 0&&typeof o!="function")throw new TypeError(`${t}: markLabel must be a function that returns a mark's accessible name.`);if(a!==void 0&&a!==!1&&typeof a!="function")throw new TypeError(`${t}: markDescription must be false or a function that returns a mark's accessible description.`);if(bi(i,t),Ei(e.seriesLabels,t),Ti(e.table,t),s!==void 0&&typeof s!="boolean"&&typeof s!="function")throw new TypeError(`${t}: announce must be true, false or a function that returns the text to announce.`)}function Hn(e){let{clock:t}=e,n,r=0,o,a,i=!1;function s(c){if(i||n?.id!==c)return;let{waiters:d}=n;n=void 0,o?.(),o=void 0,e.land(),e.runner.settle(),e.leaving.sweep();for(let l of d)l()}return{run(c){e.draw();let d=++r;return new Promise(l=>{if(n={id:d,waiters:[...n?.waiters??[],l]},c.length===0){s(d);return}o?.(),o=t.onFrame(()=>e.draw()),Promise.all(c).then(()=>s(d))})},supersede:()=>a?.(),wait(c,d){return new Promise(l=>{a=l,c.then(()=>Promise.all(d.map(u=>u.gone))).then(()=>l())})},destroy(){i=!0,n=void 0,o?.(),a?.()}}}function jn(e,t,n){let{runner:r,events:o,input:a,onScreen:i}=e;r.interrupt();let s=t();e.swap?.(s),e.hover.dropGone();let c=s.exiting.map(l=>l.leave);return r.exit(s.exiting.map(i)).then(()=>{for(let l of c)l.exited=!0;e.leaving.sweep()}),o.emitEach("exit",s.exiting,i),r.update(s.changed.map(({record:l,from:u})=>({...a(l),from:u}))),o.emitEach("update",s.changed,({record:l,from:u})=>({...a(l),from:u})),r.enter(s.entering.map(a)),o.emitEach("enter",s.entering,a),n(s),e.hover.sync(),c}function Le(e,t,n){return e.animating||!n(e.value,t)}var Me=(e,t)=>e===t;function ze(e,t){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(r=>e[r]===t[r])}function mn(e,t){if(e.outline.d!==t.outline.d||Ko(e,t))return!0;let n=e.segments??[],r=t.segments??[];return n.length!==r.length||n.some((o,a)=>o.key!==r[a].key||o.outline.d!==r[a].outline.d)}function Ko(e,t){let n=e.labelBounds,r=t.labelBounds;return n===r?!1:!n||!r||n.length!==r.length?!0:n.some((o,a)=>o.x!==r[a].x||o.y!==r[a].y||o.width!==r[a].width||o.height!==r[a].height)}function zn(e,t,n,r){if(typeof ResizeObserver!="function")return()=>{};let o=n,a=n,i,s=new ResizeObserver(c=>{let d=c[c.length-1]?.contentRect.width??0;!(d>0)||Math.abs(d-a)<.5||(a=d,i??(i=t.onFrame(()=>{i?.(),i=void 0,!(Math.abs(a-o)<.5)&&(o=a,r(o))})))});return s.observe(e),()=>{s.disconnect(),i?.()}}function _n(e,t){let n=e.fonts;return n?.addEventListener?.("loadingdone",t),()=>n?.removeEventListener?.("loadingdone",t)}function Kn(e,t){let n=()=>e.style.setProperty("--ec-hover-duration",`${t.duration(100,"feedback")}ms`);return n(),t.subscribe(n)}var Uo=12,fl=100,ml=0;function Ri(e,t,n,r){let o=e.top-Uo,a=n.height-e.bottom-Uo;return r??(r=t.height<=o||o>=a?"above":"below"),{x:Math.max(0,Math.min(n.width-t.width,e.x-t.width/2)),y:r==="above"?o-t.height:e.bottom+Uo,side:r}}function Wr(e,t,n,r={}){let o=t.length===1&&t[0].series==="value"&&(t[0].label??"value")==="value",a=[t.map(i=>o?n(i.value):`${n(i.value)} ${i.label??i.series}`).join(" \xB7 ")];return t.length>1&&r.total!==!1&&a.push(`${n(t.reduce((i,s)=>i+s.value,0))} total`),{title:e,lines:a}}function Un(e,t){let n,r,o=new WeakMap,a,i=u=>u.style.setProperty("--ec-hover-duration",`${t.motion.duration(fl,"feedback")}ms`);function s(){if(!n||!r){let u=e.ownerDocument;n=u.createElement("div"),n.className="ec-tooltip-layer",r=u.createElement("div"),r.className="ec-tooltip",r.setAttribute("aria-hidden","true"),n.appendChild(r)}return n.previousSibling!==e&&e.after(n),r}function c(u,f){let h=t.option(),w=o.get(u);if(w&&w.option===h)return w.content;let v=yl(h,u.datum,f);return o.set(u,{option:h,content:v}),v}function d(){r&&(i(r),r.classList.remove("ec-tooltip-shown"))}function l(u,f,h,w){let v=c(u,f);if(v===void 0){d();return}let D=s(),F=typeof v=="string"?`text:${v}`:JSON.stringify(v);F!==a&&(pl(D,v),a=F);let P=hl(e),V=e.getBoundingClientRect(),x=V.width>0&&P.width>0?V.width/P.width:1,R={x:U=>(U-P.x)*x,y:U=>(U-P.y)*x},O=V.width>0?{width:V.width,height:V.height}:{width:P.width,height:P.height},G={width:D.offsetWidth,height:D.offsetHeight},g=Ri(h(R,w),G,O,w?Ri(h(R,!1),G,O).side:void 0),E=n.getBoundingClientRect();D.style.left=`${Math.round(V.left-E.left+g.x)}px`,D.style.top=`${Math.round(V.top-E.top+g.y)}px`,D.setAttribute("data-side",g.side),i(D),D.classList.add("ec-tooltip-shown")}return{show(u,f,h,w){l(f,h,(D,F)=>{let P=F?w:void 0,{x:V,y:x,width:R,height:O}=u.bounds,G=[{x:V,y:x},{x:V+R,y:x},{x:V,y:x+O},{x:V+R,y:x+O}].map(E=>P?xe.apply(P,E).y:E.y),g=P?xe.apply(P,u.center):u.center;return{x:D.x(g.x),top:D.y(Math.min(...G)),bottom:D.y(Math.max(...G))}},w!==void 0)},showAt(u,f,h){l(f,h,w=>({x:w.x(u.x),top:w.y(u.top),bottom:w.y(u.bottom)}),!1)},describe(u,f){let h=t.description?.(),w;if(h===!1)w=void 0;else if(typeof h=="function")try{let D=h(f.datum);w=typeof D=="string"&&D!==""?D:void 0}catch(D){Se(D),w=void 0}else w=typeof t.option()=="function"?c(f,()=>""):void 0;let v=u.querySelector(":scope > desc.ec-description");if(typeof w!="string"){if(!v)return;u.getAttribute("aria-describedby")===v.id&&u.removeAttribute("aria-describedby"),v.remove();return}v??(v=Y("desc",{class:"ec-description",id:`ec-description-${++ml}`},u)),v.textContent!==w&&(v.textContent=w),u.setAttribute("aria-describedby",v.id)},hide:d,destroy(){n?.remove(),n=void 0,r=void 0,o=new WeakMap,a=void 0}}}function yl(e,t,n){if(e!==!1){if(typeof e!="function")return n();try{let r=e(t);return r==null||r===""?void 0:String(r)}catch(r){Se(r);return}}}function pl(e,t){if(typeof t=="string"){e.textContent=t;return}let n=e.ownerDocument,r=(o,a)=>{let i=n.createElement("div");return a&&(i.className=a),i.textContent=o,i};e.replaceChildren(r(t.title,"ec-tooltip-title"),...t.lines.map(o=>r(o)))}function hl(e){let t=(e.getAttribute("viewBox")??"").split(/[\s,]+/).map(Number);return t.length===4&&t.every(Number.isFinite)?{x:t[0],y:t[1],width:t[2],height:t[3]}:{x:0,y:0,width:Number(e.getAttribute("width"))||0,height:Number(e.getAttribute("height"))||0}}var Wn=500,Ci=2,gl=2;function Zo(e,t,n){let r=un(e,"barChart");Li(t);let o=t,a=cn(t.motion,n.motion),i=jt(t.on,n.presets),s=$t(t.colors),c=n.clock??Fe,d=r.ownerDocument;gt(d);let l=Y("svg",{class:"ec-chart ec-bar-chart",role:"group"},r),u=Y("g",{class:"ec-grid","aria-hidden":"true"},l),f=Y("g",{class:"ec-axis","aria-hidden":"true"},l),h=Y("g",{class:"ec-focus","aria-hidden":"true",visibility:"hidden"},l),w=[Y("path",{class:"ec-focus-ring","stroke-width":2*(Ci+gl),"stroke-linejoin":"round"},h),Y("path",{class:"ec-focus-gap","stroke-width":2*Ci,"stroke-linejoin":"round"},h)],v=Y("g",{class:"ec-marks"},l),D=Y("g",{class:"ec-overlay","aria-hidden":"true"},l),F=Rn(l),P=[],V=new Map,x=Gn(M=>M.values.animating||M.presence.animating),R=new WeakMap,O=An("barChart"),G=Nn(r),g=!1,E,U;try{E=be(o),U=_e(o,E)}catch(M){throw l.remove(),M}let k=M=>V.get(M)??x.get(M),T=ln({overlay:D,mark:M=>({set:W=>{k(M)?.handle.set(W),Ne.restyled(M)},reset:()=>{k(M)?.handle.reset(),Ne.restyled(M)}}),colors:M=>k(M)?.parts[0]?.colors}),H=on({effects:i,motion:a,icons:n.icons,clock:c,surface:T}),_=Un(l,{motion:a,option:()=>o.tooltip,description:()=>o.markDescription}),te=On(l),ae=Vn(l),z=o.announce?Ot(l):void 0,Z=E.orientation,se=new Map,de=new Set,we=!1,A=!1,j=Be(E.frame.scale,xt,{clock:c,motion:a,onChange:()=>we=!0}),Q=Be(E.frame.bands,xt,{clock:c,motion:a,onChange:()=>we=!0}),ue=Hn({clock:c,runner:H,leaving:x,draw:ft,land:Ke});function be(M,W=i){let oe=Pn(M);return Fn(W,oe.series.map(pe=>pe.series),"barChart"),mi({data:M.data,encoding:oe,sort:M.sort,width:M.width??G,height:M.height,format:qe(M),measure:F})}function ve(M,W){let oe=Y("g",{class:"ec-mark","data-key":M.key,role:"img"},v),pe={clock:c,motion:a,onChange:()=>de.add(I)},p=qr(M),I={key:M.key,row:M,shown:M,group:oe,hit:Y("rect",{class:"ec-hit"},oe),label:Y("text",{class:"ec-label","aria-hidden":"true"},oe),body:Y("g",{class:"ec-body"},oe),value:Y("text",{class:"ec-value","aria-hidden":"true"},oe),paths:new Map,parts:[],handle:gn(()=>I),values:Be(W?Wo(p):p,xt,pe),series:M.values.map(m=>m.series),slot:Be(M.slot,ct,pe),presence:Be(W?0:1,ct,pe),count:void 0,leave:void 0};return R.set(oe,I),je(I,W?wt(I,ut()):M),I}function je(M,W){let oe=M.parts[0]?.colors.color;M.shown=W,le(M.hit,{...W.hit}),St(M.label,W.label),St(M.value,W.value);let pe=M.presence.value,p=pe<1?pe:void 0;le(M.label,{opacity:p}),le(M.value,{opacity:p});let I=W.geometry.segments??[],m=new Set,b=Zr(o)?at(s.slot(M.key)):void 0;M.parts=I.map(C=>{let B=C.series??C.key;m.add(B);let N=M.paths.get(B);N||(N=Y("path",{class:"ec-segment","data-series":B},M.body),M.paths.set(B,N));let ee=b??at(s.slot(B));return N.setAttribute("d",C.outline.d),$e(N,ht(ee)),{element:N,d:C.outline.d,colors:ee,visible:C.length>=.5}});for(let[C,B]of M.paths)m.has(C)||(B.remove(),M.paths.delete(C));let S=Array.from(M.body.children).filter(C=>C.classList.contains("ec-segment"));if(M.parts.some((C,B)=>S[B]!==C.element))for(let C of M.parts)M.body.appendChild(C.element);M.handle.repaint(),M.parts[0]?.colors.color!==oe&&T.recolor(M.key),M.key===Ne.ringKey&&Oe(M.key)}function Oe(M){let W=M===void 0?void 0:V.get(M);if(!W){h.setAttribute("visibility","hidden");return}for(let pe of w)pe.setAttribute("d",W.shown.geometry.outline.d);let{transform:oe}=W.handle.style;le(h,{transform:oe&&pt(oe),visibility:void 0})}function Pe(M,W){let oe=mn(M.shown.geometry,W.geometry)||M.shown.datum!==W.datum;je(M,W),oe&&H.change(W.geometry,W.data),M.key===Ne.key&&Ce(M)}function Ce(M){let{row:W}=M;_.show(M.shown.geometry,W,()=>Wr(W.label.text,Oi(W.values,o),qe(o)),M.handle.style.transform)}function Ae(M){if(Zr(o)){te.categories(M.rows.map(W=>({key:W.key,label:W.label.text})),s,o.legend);return}te.update(Pn(o).series.map(W=>({series:W.series,label:Xe(o.seriesLabels,W.series)})),s,o.legend)}function _e(M,W){let oe=Pn(M),pe=oe.orientation==="horizontal"?M.y:M.x;return In({option:M.table,caption:M.label,category:typeof pe=="string"?pe:void 0,series:oe.series.map(p=>p.series),label:p=>Xe(M.seriesLabels,p),rows:W.rows.map(p=>({key:p.key,category:p.label.text,datum:p.datum,index:p.index,values:p.values,total:p.total})),format:qe(M)})}function dt(M,W){let oe=o.announce;if(!z||!oe)return;let pe=Pn(o).series.map(B=>B.series),p=Pn(M).series.map(B=>B.series),I=Pi(o.sort),m=B=>B.row.label.text,b=W.changed.map(({record:B})=>B),S=Tn({...o.label!==M.label?{label:o.label}:{},...pe.join(`
|
|
85
|
-
`)
|
|
86
|
-
`)?{series:
|
|
87
|
-
`),o=2*e.inner*.85,a=n(r[0],"ec-center-value",hr),i=a>o&&a>0?Math.max(Sl,hr*o/a):hr,s=r.map((l,u)=>u===0?0:El+(u-1)*Dl),c=s[s.length-1],d=e.cy+(2*Tl*i-c)/2;return r.map((l,u)=>({x:e.cx,y:d+s[u],anchor:"middle",text:l,size:u===0?i:Yr}))}function Cl({data:e,encoding:t}){let n=new Set;return e.map((r,o)=>{let a=String(t.key(r,o));if(n.has(a))throw new Error(`donutChart: two rows have the key "${a}". Keys must be unique; pass a key accessor if categories repeat.`);n.add(a);let i=Gl(t.value(r,o),t.series,a);return{key:a,category:String(t.category(r,o)??""),datum:r,index:o,value:i}})}function Ll(e,t){if(t===void 0||t==="none")return e;if(t==="value")return[...e].sort((n,r)=>r.value-n.value);throw new TypeError(`donutChart: sort must be "value" or "none", got ${String(t)}.`)}function Pl(e,t){let{width:n,measure:r}=e,o=e.height??kl,a=n/2,i=o/2,s=r("100%","ec-value",ea),c=t.reduce((f,h)=>Math.max(f,r(h.category,"ec-label",Yr)),s),d=Math.min(a-qo-Yo-c,i-qo-Yo-Qo),l=Math.max(0,Math.min(a,i)-qo),u=Math.max(0,d,l/2);return{width:n,height:o,cx:a,cy:i,inner:u*xl,outer:u}}function Ol(e,t,n){let r=(t.start+t.end)/2,o=Math.sin(r),a=Math.cos(r),i=e.outer+Yo,s=e.cx+i*o,c=e.cy-i*a,d=wn(t.share),l=[n(t.category,"ec-label",Yr),n(d,"ec-value",ea)],u=Math.max(...l),f=c-Qo*(a+1)/2,h=w=>s+o*w/2;return{category:{x:h(l[0]),y:f+Xo,anchor:"middle",text:t.category},share:{x:h(l[1]),y:f+Xo+Gi,anchor:"middle",text:d},box:{x:h(u)-u/2,y:f,width:u,height:Qo}}}function Al(e,t){let n=[];return e.category.text!==""&&n.push(an(e.category,t,"ec-label",Yr)),e.share.text!==""&&n.push(an(e.share,t,"ec-value",ea)),n}function $i(e,t){return e.x<t.x+t.width+Jr&&t.x<e.x+e.width+Jr&&e.y<t.y+t.height+Jr&&t.y<e.y+e.height+Jr}function $l(e,t,n){let r={datum:e,samples:[{t:0,value:0},{t:1,value:t}],related:o=>o===n?r:void 0};return r}function Jo(e){return typeof e=="function"?e:t=>t[e]}function Gl(e,t,n){if(e==null)return 0;if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return e;throw new RangeError(`donutChart: "${t}" for "${n}" must be a finite number of 0 or more, got ${typeof e=="string"?JSON.stringify(e):String(e)}.`)}var qn=500,Vi=2*Math.PI,Il=.5;function oa(e,t,n){let r=un(e,"donutChart");Ni(t);let o=t,a=cn(t.motion,n.motion),i=jt(t.on,n.presets),s=$t(t.colors),c=n.clock??Fe,d=r.ownerDocument;gt(d);let l=Y("svg",{class:"ec-chart ec-donut-chart",role:"group"},r),u=Y("g",{class:"ec-center","aria-hidden":"true"},l),f=Y("g",{class:"ec-marks"},l),h=Y("g",{class:"ec-overlay","aria-hidden":"true"},l),w=Y("g",{class:"ec-halos"},h),v=zr(h),D=Y("g",{class:"ec-runs"},h),F=Rn(l),P=[],V=new Map,x=Gn(p=>p.value.animating||p.presence.animating),R=new WeakMap,O=An("donutChart"),G=Nn(r),g=!1,E,U,k;try{E=be(o),U=dt(o,E),k=Fi(o,E)}catch(p){throw l.remove(),p}let T=p=>V.get(p)??x.get(p),H=ln({overlay:D,mark:p=>({set:I=>{T(p)?.handle.set(I),Ue.restyled(p)},reset:()=>{T(p)?.handle.reset(),Ue.restyled(p)}}),colors:p=>T(p)?.parts[0]?.colors}),_=on({effects:i,motion:a,icons:n.icons,clock:c,surface:H}),te=Un(l,{motion:a,option:()=>o.tooltip,description:()=>o.markDescription}),ae=On(l),z=Vn(l),Z=o.announce?Ot(l):void 0,se=[],de=[],we=!1,A=Be(E.frame,xt,{clock:c,motion:a,onChange:()=>we=!0}),j,Q,ue=Hn({clock:c,runner:_,leaving:x,draw:Tt,land:st});function be(p,I=i){let m=Zn(p);return Fn(I,[m.series],"donutChart"),Ii({data:p.data,encoding:m,sort:p.sort,width:p.width??G,height:p.height,center:b=>Bi(p,m.series,b),measure:F})}function ve(p,I){let m=Y("g",{class:"ec-mark","data-key":p.key,role:"img"},f),b={clock:c,motion:a,onChange:()=>we=!0},S=Y("g",{class:"ec-body"},m),C={key:p.key,row:p,shown:p,group:m,hit:Y("path",{class:"ec-hit"},m),body:S,path:Y("path",{class:"ec-slice","data-series":p.series},S),label:Y("text",{class:"ec-label","aria-hidden":"true"},m),share:Y("text",{class:"ec-value","aria-hidden":"true"},m),drawnLabel:void 0,parts:[],handle:gn(()=>C,{halos:()=>w}),value:Be(I?0:p.value,ct,b),turn:Be(1,ct,b),offset:0,planned:0,presence:Be(I?0:1,ct,b),leave:void 0};return m.insertBefore(C.hit,S),R.set(m,C),C}function je(p,I,m){let b=p.parts[0]?.colors.color;p.shown=I;let{outline:S}=I.geometry,C=I.geometry.length>=Il,B=C?void 0:"hidden";le(p.path,{d:S.d,visibility:B}),le(p.hit,{d:S.d,visibility:B});let N=at(s.slot(p.key));$e(p.path,ht(N)),p.parts=[{element:p.path,d:S.d,colors:N,visible:C}];let ee=p.presence.value,ce=ee<1?ee:void 0;p.drawnLabel=m;for(let[K,ye]of[[p.label,m?.category],[p.share,m?.share]])ye&&St(K,ye),le(K,{visibility:ye?void 0:"hidden",opacity:ce});p.handle.repaint(),N.color!==b&&H.recolor(p.key),p.key===Ue.ringKey&&Oe(p.key)}function Oe(p){let I=p===void 0?void 0:V.get(p);v.draw(I&&{outline:I.shown.geometry.outline,thickness:I.shown.geometry.thickness,transform:I.handle.style.transform})}function Pe(p,I,m){let b=mn(p.shown.geometry,I.geometry)||p.shown.datum!==I.datum;je(p,I,m),b&&_.change(I.geometry,I.data),p.key===Ue.key&&Ce(p)}function Ce(p){let{row:I}=p;te.show(p.shown.geometry,I,()=>({title:I.category,lines:[`${Hi(I,o)} \xB7 ${wn(I.share)}`]}),p.handle.style.transform)}function Ae(p){for(;u.childElementCount>p.length;)u.lastElementChild.remove();p.forEach((I,m)=>{let b=u.children[m]??Y("text",{},u);le(b,{class:m===0?"ec-center-value":"ec-center-label"}),St(b,I),$e(b,{"font-size":m===0&&I.size!==hr?`${I.size}px`:void 0})})}let _e=()=>ae.categories(E.slices.map(p=>({key:p.key,label:p.category})),s,o.legend);function dt(p,I){let{series:m}=Zn(p);return In({option:p.table,caption:p.label,category:typeof p.category=="string"?p.category:void 0,series:[m],label:b=>Xe(p.seriesLabels,b),rows:I.slices.map(b=>({key:b.key,category:b.category,datum:b.datum,index:b.index,values:[{series:m,value:b.value}],total:b.value})),format:qe(p),shares:!0})}function ut(){fn(l,{label:o.label,description:Nl(o.description,E.centerText)})}function wt(p,I){let m=o.announce;if(!Z||!m)return;let b=Zn(o).series,S=Zn(p).series,C=o.sort??"none",B=K=>K.row.category,N=I.changed.map(({record:K})=>K),ee=Tn({...o.label!==p.label?{label:o.label}:{},...b!==S?{series:[Xe(o.seriesLabels,b)]}:{},...C!==(p.sort??"none")?{sort:C}:{},changed:N.map(B),added:I.entering.map(B),removed:I.exiting.map(B),count:P.length});if(typeof m!="function"){Z.say(ee);return}let ce=K=>K.key;try{let K=m({text:ee,changed:N.map(ce),added:I.entering.map(ce),removed:I.exiting.map(ce)});K!=null&&Z.say(String(K))}catch(K){Se(K)}}let me=p=>V.get(p.key)===p||x.get(p.key)===p,Ge=p=>Math.max(0,p.value.value);function ft(p,I,m=Ge){let b=new Map,S=0;for(let C of p)b.set(C,I>0?S/I:0),S+=m(C);return b}function Ke(){se=se.filter(me),de=de.filter(me);let p=se.reduce((S,C)=>S+Ge(C),0),I=ft(se,p),m=ft(de,p),b=new Map;for(let S of se){let C=I.get(S),B=S.turn.value,N=m.get(S),ee=C;if(N!==void 0&&B<1){let ce=N+S.offset-C;ee=C+(1-B)*(ce-Math.round(ce-S.planned))}b.set(S,{start:ee,span:p>0?Ge(S)/p:0})}return b}function Dt(p){let I=[...Ke()].map(([b,{start:S,span:C}])=>{let{row:B}=b,N={key:B.key,datum:B.datum,index:B.index,category:B.category,series:B.series,value:Ge(b),share:C,start:S*Vi,end:(S+C)*Vi};return{record:b,state:N}}),m=na(p,I.map(({state:b})=>b),F);return I.map(({record:b,state:S},C)=>({record:b,slice:ta(p,S,m[C],F),label:m[C]}))}function Tt(){if(!we)return;we=!1;let p=A.value;le(l,At(p));let I=Dt(p);for(let{record:b,slice:S,label:C}of I)Pe(b,S,C);let m=I.reduce((b,{slice:S})=>b+S.value,0);Ae(ra(p,j===void 0?E.centerText:Rt(bn(m,j)),F))}function Rt(p){return Q?.total!==p&&(Q={total:p,text:Bi(o,Zn(o).series,p)}),Q.text}function st(){se=se.filter(me),de=se;for(let p of se)p.turn.set(1),p.offset=0,p.planned=0;j=void 0,Q=void 0,le(l,At(E.frame)),E.slices.forEach((p,I)=>Pe(V.get(p.key),p,E.labels[I])),Ae(E.center),we=!1}function Ct(p){let I=new Set(p.slices.map(S=>S.key)),m={entering:[],exiting:[],changed:[]};for(let S of P)I.has(S.key)||(V.delete(S.key),x.start(S),m.exiting.push(S));let b=P;return P=p.slices.map(S=>{let C=V.get(S.key);return C?(C.row.value!==S.value||C.row.series!==S.series)&&m.changed.push({record:C,from:C.shown.geometry}):(C=x.recall(S.key)??ve(S,!0),V.set(S.key,C),m.entering.push(C)),C.row=S,C.path.setAttribute("data-series",S.series),vt(C),C}),vn(f,b.map(S=>S.group),P.map(S=>S.group),Ue.active),m}function vt(p){p.group.setAttribute("aria-label",k.get(p.key)),te.describe(p.group,p.row)}function Lt(p,I){we=!0;let m=Ke(),b=new Set(P.filter(ie=>ie.presence.value===0)),S=P.filter(ie=>!b.has(ie)),C=[...x.values()],B=de.length>0&&de.every(ie=>ie.turn.value===0),N=se;if(se=Fl(N,P),!B){de=N;let ie=N.reduce((Gt,Mn)=>Gt+Ge(Mn),0),tt=ft(N,ie);for(let Gt of N)Gt.offset=m.get(Gt).start-tt.get(Gt)}de=de.filter(ie=>!b.has(ie));let ee=ie=>V.get(ie.key)===ie?ie.row.value:0,ce=se.reduce((ie,tt)=>ie+ee(tt),0),K=ft(se,ce,ee),ye=ft(de,ce,ee),Ie=!1;for(let ie of de){let tt=ye.get(ie)+ie.offset-K.get(ie);ie.planned=tt-Math.round(tt),Math.abs(ie.planned)>1e-9&&(Ie=!0)}let Ve=S.some(ie=>Le(ie.value,ie.row.value,Me)||Le(ie.presence,1,Me))||C.some(ie=>Le(ie.value,0,Me)||Le(ie.presence,0,Me)),He=Ie||b.size>0||Le(A,p.frame,ze),Ee,Je,mt;if(!I&&a.staged){let ie=Ve?qn:0;Ee={duration:qn},Je={duration:qn,delay:ie},mt={duration:qn/2,delay:ie+qn/2}}else I||(Ee=Je=mt={duration:(Ve&&He?2:1)*qn});let Et=[],et=(ie,tt,Gt,Mn)=>{Le(ie,tt,Gt)&&(Mn?Et.push(ie.to(tt,Mn)):ie.set(tt))};et(A,p.frame,ze,Je);for(let ie of S)et(ie.value,ie.row.value,Me,Ee),et(ie.presence,1,Me,Ee);for(let ie of b)et(ie.value,ie.row.value,Me,mt),et(ie.presence,1,Me,mt);for(let ie of C)et(ie.value,0,Me,Ee),et(ie.presence,0,Me,Ee);if(I){de=se;for(let ie of se)ie.turn.set(1),ie.offset=0,ie.planned=0;return Et}let Wt=new Set(de);for(let ie of se)ie.turn.set(Wt.has(ie)?0:1);if(Ie)for(let ie of de)et(ie.turn,1,Me,Je);return Et}function Ne(p,I){return E=p,ue.run(Lt(p,I))}let Qe=p=>({mark:p.row.geometry,data:p.row.data}),Pt=p=>({mark:p.shown.geometry,data:p.shown.data});function Qt(p){let I=p,m=typeof I?.closest=="function"?I.closest(".ec-mark"):null,b=m?R.get(m):void 0;return b&&V.get(b.key)===b?b:void 0}let Ue=$n({svg:l,runner:_,events:O,dim:()=>o.dim!==!1,find(p){let I=Qt(p);return I&&{key:I.key}},live:p=>V.has(p),order:()=>P.map(p=>p.key),element:p=>T(p)?.group,onScreen(p){let I=T(p);return I&&Pt(I)},ring:Oe,tooltip:{show(p){let I=V.get(p);I&&Ce(I)},hide:()=>te.hide()}}),M=Kn(l,a);function W(){if(g)return;let p=be(o),I=new Map(p.slices.map(m=>[m.key,m]));for(let m of P)m.row=I.get(m.key)??m.row;Ne(p,!0)}let oe=zn(r,c,G,p=>{G=p,o.width===void 0&&W()}),pe=_n(d,()=>{F.clear(),W()});return ut(),_e(),z.render(U),le(l,At(E.frame)),P=E.slices.map(p=>{let I=ve(p,!1);return V.set(p.key,I),vt(I),I}),se=de=P,E.slices.forEach((p,I)=>je(P[I],p,E.labels[I])),Ae(E.center),Ue.sync(),_.enter(P.map(Qe)),_t(Ue.link,{element:l,async update(p){if(g)return;if(p.motion!==void 0&&p.motion!==o.motion)throw new TypeError("donutChart: `motion` can't be changed by update() yet.");let I={...o,...p};Ni(I);let m="on"in p?Bn(i,o.on,I.on,n.presets):i,b=be(I,m),S=dt(I,b),C=Fi(I,b);"colors"in p&&(s=$t(I.colors));let B=o,N=E.total;o=I,E=b,k=C,ut(),_e(),z.render(S);let ee=Z!==void 0;o.announce&&!Z?Z=Ot(l):!o.announce&&Z&&(Z.destroy(),Z=void 0),Ue.syncDim(),ue.supersede();let ce=m!==i;i=m;let K=jn({runner:_,events:O,hover:Ue,leaving:x,input:Qe,onScreen:Pt,...ce?{swap:Ie=>{let Ve=new Set(Ie.entering);_.swap(m,P.filter(He=>!Ve.has(He)).map(Qe))}}:{}},()=>Ct(b),Ie=>{ee&&wt(B,Ie)});j=b.total===N?void 0:Math.max(Kt(N),Kt(b.total));let ye=Ne(b,a.mode==="off");await ue.wait(ye,K)},on:O.on,marks:()=>P.map(p=>p.shown.geometry),focus(p){g||Ue.focus(p)},leave(){g||Ue.leave()},labels:()=>P.flatMap(p=>[...dn(p.key,"category",p.drawnLabel?.category,p.label),...dn(p.key,"value",p.drawnLabel?.share,p.share)]),destroy(){if(!g){g=!0,ue.destroy(),Ue.destroy(),_.destroy(),te.destroy(),ae.destroy(),z.destroy(),Z?.destroy(),M(),oe(),pe();for(let p of[...P,...x.values()]){for(let I of[p.value,p.turn,p.presence])I.stop();p.leave?.resolve()}A.stop(),O.clear(),V.clear(),x.clear(),P=se=de=[],l.remove()}}})}function Ni(e){kn(e,"donutChart");let{center:t,sort:n}=e;if(t!==void 0&&t!==!1&&typeof t!="function")throw new TypeError("donutChart: center must be false or a function that returns the text for the total.");if(n!==void 0&&n!=="none"&&n!=="value")throw new TypeError(`donutChart: sort must be "value" or "none", got ${String(n)}.`)}function Hi(e,t){let n=qe(t)(e.value),r=Xe(t.seriesLabels,e.series);return e.series==="value"&&r==="value"?n:`${n} ${r}`}function Fi(e,t){return new Map(t.slices.map(n=>[n.key,Vl(n,e)]))}function Vl(e,t){let n=`${e.category}: ${Hi(e,t)}, ${wn(e.share)}`;if(!t.markLabel)return n;try{let r={series:e.series,label:Xe(t.seriesLabels,e.series),value:e.value},o=t.markLabel(e.datum,{key:e.key,category:e.category,values:[r],total:e.value,share:e.share,format:qe(t),text:n});if(o!=null&&String(o).trim()!=="")return String(o)}catch(r){Se(r)}return n}function Bi(e,t,n){let{center:r}=e,o=qe(e);if(r===!1)return"";if(r===void 0){let a=Xe(e.seriesLabels,t);return t==="value"&&a==="value"?o(n):`${o(n)}
|
|
88
|
-
${a}`}try{let a=r(n,o);return a==null?"":String(a)}catch(a){return Se(a),""}}function Nl(e,t){let n=t.split(`
|
|
89
|
-
`).join(" ").trim(),r=e?.trim();return n===""?e:r?/[.!?:;]$/.test(r)?`${r} ${n}`:`${r}. ${n}`:n}function Fl(e,t){let n=[...t];return e.forEach((r,o)=>{if(n.includes(r))return;let a=0;for(let i=o-1;i>=0;i--){let s=n.indexOf(e[i]);if(s>=0){a=s+1;break}}n.splice(a,0,r)}),n}var ji=["UTC","local"],sa=1e3,to=60*sa,eo=60*to,Xr=24*eo,aa={second:sa,minute:to,hour:eo,day:Xr+eo,week:7*Xr+eo,month:31*Xr,year:366*Xr},Bl=[...[1,5,15,30].map(e=>({unit:"second",count:e})),...[1,5,15,30].map(e=>({unit:"minute",count:e})),...[1,3,6,12].map(e=>({unit:"hour",count:e})),{unit:"day",count:1},{unit:"day",count:2},{unit:"week",count:1},{unit:"month",count:1},{unit:"month",count:3}],Ut=["year","month","day","hour","minute","second","millisecond"],Hl={second:"second",minute:"minute",hour:"hour",day:"day",week:"day",month:"month",year:"year"},jl={fractionalSecondDigits:3},ia={year:{year:"numeric"},month:{month:"short"},day:{month:"short",day:"numeric"},hour:{hour:"numeric",minute:"2-digit"},minute:{hour:"numeric",minute:"2-digit"},second:{hour:"numeric",minute:"2-digit",second:"2-digit"},millisecond:{hour:"numeric",minute:"2-digit",second:"2-digit",...jl}};function zl(e){for(let t of Bl)if(aa[t.unit]*t.count>=e)return t;return{unit:"year",count:Math.max(1,mr(e/aa.year))}}function zi(e,t,n){let r=Ul(n);if(!(t>e))return[{value:e,text:r(e,"year")}];let o=zl((t-e)/4),a=Ut[Math.min(Ut.indexOf(Hl[o.unit]),Ut.indexOf(_l(e,t,n)))],i=Kl(e,t,o,n).map(s=>({value:s,text:r(s,"millisecond")}));return[{value:e,text:r(e,a)},...i,{value:t,text:r(t,a)}]}function _l(e,t,n){let[r,o]=[Jn(e,n),Jn(t,n)];return r.year!==o.year?"year":r.month!==o.month?"month":r.date!==o.date?"day":r.hours!==o.hours?"hour":r.minutes!==o.minutes?"minute":"second"}function Kl(e,t,n,r){let{unit:o,count:a}=n,i=[],s=Jn(e,r);if(o==="second"||o==="minute"||o==="hour"){let l=o==="hour"?15*to:aa[o],u=e-s.ms-(o==="second"?0:s.seconds*sa)-(o==="hour"?s.minutes%15*to:0);for(;u<t;u+=l){let f=Jn(u,r),h=o!=="hour"||f.minutes===0,w=o==="second"?f.seconds:o==="minute"?f.minutes:f.hours;u>e&&h&&w%a===0&&i.push(u)}return i}let c=o==="day"?l=>Qr(r,s.year,s.month,s.date+l):o==="week"?l=>Qr(r,s.year,s.month,s.date-(s.weekday+6)%7+7*l):o==="month"?l=>Qr(r,s.year,Math.floor(s.month/a)*a+a*l,1):l=>Qr(r,Math.floor(s.year/a)*a+a*l,0,1),d=-1/0;for(let l=0;;l++){let u=c(l);if(u>=t||u<=d)break;d=u,u>e&&(o!=="day"||(Jn(u,r).date-1)%a===0)&&i.push(u)}return i}function _i(e,t){let{ms:n,seconds:r,minutes:o,hours:a,date:i,month:s}=Jn(e,t);return n!==0?"millisecond":r!==0?"second":o!==0?"minute":a!==0?"hour":i!==1?"day":s!==0?"month":"year"}function Ki(e,t){let n=e.reduce((s,c)=>Math.max(s,Ut.indexOf(_i(c,t))),0),r=Ui(t),o=n>=Ut.indexOf("second")?"medium":n>=Ut.indexOf("hour")?"short":void 0,a=n===Ut.indexOf("millisecond")?{year:"numeric",...ia.day,...ia.millisecond,timeZone:r}:{dateStyle:"medium",...o?{timeStyle:o}:{},timeZone:r},i=new Intl.DateTimeFormat(void 0,a);return s=>i.format(s)}function Ul(e){let t=new Map;return(n,r)=>{let o=Ut.indexOf(_i(n,e)),a={};for(let c=Math.min(o,Ut.indexOf(r));c<=o;c++)Object.assign(a,ia[Ut[c]]);let i=JSON.stringify(a),s=t.get(i);return s||t.set(i,s=new Intl.DateTimeFormat(void 0,{...a,timeZone:Ui(e)})),s.format(n)}}var Ui=e=>e==="UTC"?"UTC":void 0;function Jn(e,t){let n=new Date(e);return t==="UTC"?{year:n.getUTCFullYear(),month:n.getUTCMonth(),date:n.getUTCDate(),weekday:n.getUTCDay(),hours:n.getUTCHours(),minutes:n.getUTCMinutes(),seconds:n.getUTCSeconds(),ms:n.getUTCMilliseconds()}:{year:n.getFullYear(),month:n.getMonth(),date:n.getDate(),weekday:n.getDay(),hours:n.getHours(),minutes:n.getMinutes(),seconds:n.getSeconds(),ms:n.getMilliseconds()}}function Qr(e,t,n,r){let o=new Date(0);return e==="UTC"?(o.setUTCFullYear(t,n,r),o.setUTCHours(0,0,0,0)):(o.setFullYear(t,n,r),o.setHours(0,0,0,0)),o.getTime()}var ua=2.25,br=4.5,Wl=300,Wi=12,Zl=32,qi=8,da=11,no=12.5,Ji=10,ql=16,ca=8,Yi=.36;function Xi(e){let{x:t,series:n,key:r}=e;if(typeof t!="string"&&typeof t!="function")throw new TypeError("lineChart needs x: a field of numbers or Dates, or a function that returns each row's x.");if(!Array.isArray(n)||n.length===0)throw new TypeError("lineChart needs series: the numeric fields to draw as lines.");let o=new Set;for(let c of n){if(typeof c!="string"||c==="")throw new TypeError(`lineChart: each series must be a field name, got ${gr(c)}.`);if(o.has(c))throw new TypeError(`lineChart: "${c}" appears twice in series.`);o.add(c)}if(r!==void 0&&typeof r!="string"&&typeof r!="function")throw new TypeError("lineChart: key must be a field name or a function.");let a=e.labels;if(a!==void 0&&a!==!1&&typeof a!="function")throw new TypeError("lineChart: labels must be false or a function that returns a line's end label.");let i=e.timeZone??"UTC";if(!ji.includes(i))throw new TypeError(`lineChart: timeZone must be "UTC" or "local", got ${gr(i)}.`);let s=e.xFormat;if(s!==void 0&&typeof s!="function")throw new TypeError("lineChart: xFormat must be a function that turns an x into text.");return{x:la(t),key:r===void 0?void 0:la(r),series:n.map(c=>({series:c,value:la(c)})),timeZone:i,xFormat:e.xFormat}}function Qi(e){let{width:t,measure:n}=e,r=e.height??Wl,{rows:o,time:a}=ed(e),i=e.encoding.series.map(R=>R.series),s=Bo(o.flatMap(R=>R.values.map(O=>O.value))),c=s.ticks.map(e.format),d=o[0]?.x??0,l=o[o.length-1]?.x??0,u=o.length===0?[]:a?zi(d,l,e.encoding.timeZone):Xl(d,l).map(R=>({value:R,text:ha(R)})),f=u.map(R=>R.value),h=u.map(R=>R.text),w=h.map(R=>n(R,"ec-tick",da)),v=e.label?Zi(od(o,e.label),"ec-value",no,n):0,D=Math.max(Zi(c,"ec-tick",da,n)+10,(w[0]??0)/2+2),F=Math.max(qi+2,(w[w.length-1]??0)/2+2,v>0?Ji+v+4:0),P={scale:{lo:s.lo,hi:s.hi},box:{xLo:d,xHi:l,left:D,right:Math.max(D,t-F),top:Wi,bottom:Math.max(Wi,r-Zl),width:t,height:r}},V={};for(let R of i)V[R]=0;for(let R of o)for(let O of R.values)V[O.series]=Math.max(V[O.series],Kt(O.value));let x=f.map((R,O)=>pa(P,R,h[O]));return{width:t,height:r,frame:P,rows:o,time:a,series:i,yTicks:s.ticks.map((R,O)=>ya(P,R,c[O])),xTicks:Ql(x,w),decimals:V}}function Yn(e){let{scale:t,box:n}=e,r=n.xHi-n.xLo,o=t.hi-t.lo;return{x:a=>r>0?n.left+(a-n.xLo)/r*(n.right-n.left):(n.left+n.right)/2,y:a=>o>0?n.bottom-(a-t.lo)/o*(n.bottom-n.top):n.bottom}}function fa(e,t,n,r,o=!1,a){if(!t[0])return[];let s=Yn(e),c=0;for(;c+1<t.length&&t[c+1].x<=r;)c++;let d=t[c],l=t[c+1],u=l&&l.x>d.x&&r>d.x?(r-d.x)/(l.x-d.x):void 0,f=t.slice(0,c+1),h=new Map,w=P=>V=>V===P?void 0:h.get(V),v=n.map(P=>{let V=f.map(x=>({at:x.x,value:x.values[P]??0}));if(u!==void 0){let x=d.values[P]??0;V.push({at:r,value:x+u*((l.values[P]??0)-x)})}return{name:P,vertices:V,points:V.map(x=>({x:s.x(x.at),y:s.y(x.value)}))}}),D=a?Jl(e,v.map(({name:P,vertices:V,points:x})=>({...x[x.length-1],text:a.text(P,V[V.length-1].value)}))):[];return v.map(({name:P,vertices:V,points:x},R)=>{let O=D[R],G=a?O&&O.text!==""?[an(O,a.measure,"ec-value",no)]:[]:void 0,g=Ye.line({key:P,series:P,points:x,width:ua,...G?{labelBounds:G}:{}}),E=0,U=V.map((H,_)=>(_>0&&(E+=Math.hypot(x[_].x-x[_-1].x,x[_].y-x[_-1].y)),{t:g.length>0?_===V.length-1?1:Math.min(1,E/g.length):0,value:H.value,at:ns(H.at,o)})),k={datum:d.datum,samples:U,related:w(P)};h.set(P,k);let T=V[V.length-1];return{series:P,geometry:g,data:k,end:{...x[x.length-1],value:T.value},label:O}})}function wr(e,t){return`${e}@${t}`}function ma(e,t,n,r=!1){let o=Yn(e),a=o.x(t.x),i=new Map;return n.map(s=>{let c=t.values[s]??0,d=wr(s,t.key),l={datum:t.datum,samples:[{t:0,value:c,at:ns(t.x,r)}],related:u=>u===s?void 0:i.get(u)};return i.set(s,l),{key:d,series:s,geometry:Ye.point({key:d,series:s,x:a,y:o.y(c),r:br}),data:l}})}function es(e,t){let{width:n,height:r}=e.box;return t.map((o,a)=>{let i=a===0?0:(t[a-1]+o)/2,s=a===t.length-1?n:(o+t[a+1])/2;return{x:i,y:0,width:Math.max(0,s-i),height:r}})}function ts(e,t){return{x1:t,y1:e.box.top,x2:t,y2:e.box.bottom}}function Jl(e,t){let n=no/2,r=Yl(t.map(o=>o.y),ql,n,e.box.height-n);return t.map((o,a)=>({x:o.x+Ji,y:r[a]+no*Yi,anchor:"start",text:o.text}))}function Yl(e,t,n,r){let o=e.map((c,d)=>({value:c,index:d})).sort((c,d)=>c.value-d.value||c.index-d.index),a=[],i=c=>{let d=c.reduce((u,f)=>u+f.value,0)/c.length,l=(c.length-1)*t;return Math.max(n,Math.min(r-l,d-l/2))};for(let c of o)for(a.push({members:[c],start:i([c])});a.length>1;){let d=a[a.length-1],l=a[a.length-2];if(d.start-(l.start+(l.members.length-1)*t)>=t)break;a.pop(),l.members.push(...d.members),l.start=i(l.members)}let s=new Array(e.length);for(let c of a)c.members.forEach((d,l)=>s[d.index]=c.start+l*t);return s}function ya(e,t,n){let{box:r}=e,o=Yn(e).y(t);return{value:t,line:{x1:r.left,y1:o,x2:r.right+qi,y2:o},label:{x:r.left-8,y:o+da*Yi,anchor:"end",text:n}}}function pa(e,t,n){return{value:t,label:{x:Yn(e).x(t),y:e.box.bottom+18,anchor:"middle",text:n}}}function Xl(e,t){if(!(t>e))return[e];let n=mr((t-e)/4),r=[e];for(let o=Math.floor(e/n)+1;Ln(o*n)<t;o++){let a=Ln(o*n);a>e&&r.push(a)}return r.push(t),r}function ha(e){return String(e)}function Ql(e,t){if(e.length<=1)return[...e];let n=e.map((a,i)=>({tick:a,from:a.label.x-t[i]/2,to:a.label.x+t[i]/2})),r=n[n.length-1],o=[n[0]];for(let a of n.slice(1,-1))a.from-o[o.length-1].to>=ca&&r.from-a.to>=ca&&o.push(a);return r.from-o[o.length-1].to>=ca&&o.push(r),o.map(a=>a.tick)}function ed({data:e,encoding:t}){let n=new Set,r=!1,o=e.map((i,s)=>{let c=t.x(i,s);s===0&&(r=c instanceof Date);let d=td(c,s,r),l=String(t.key?t.key(i,s):r?new Date(d).toISOString():d);if(n.has(l))throw new Error(`lineChart: two rows have the key "${l}". Keys must be unique.`);n.add(l);let u=t.series.map(({series:f,value:h})=>({series:f,value:rd(h(i,s),f,l)}));return{key:l,datum:i,index:s,x:d,values:u}});o.sort((i,s)=>i.x-s.x);for(let i=1;i<o.length;i++){let[s,c]=[o[i-1],o[i]];if(s.x===c.x){let d=r?new Date(s.x).toISOString():ha(s.x);throw new Error(`lineChart: the rows "${s.key}" and "${c.key}" have the same x, ${d}. Each x is one point on every line, so x values must be unique.`)}}let a=nd(t,r,o.map(i=>i.x));return{rows:o.map(i=>({...i,label:a(i.x)})),time:r}}function td(e,t,n){if(e instanceof Date){if(!n)throw new TypeError(`lineChart: x must be all numbers or all Dates, but row 0's is a number and row ${t}'s a Date.`);let r=e.getTime();if(Number.isNaN(r))throw new TypeError(`lineChart: x must be a valid Date, got an invalid Date in row ${t}.`);return r}if(n)throw typeof e=="number"?new TypeError(`lineChart: x must be all numbers or all Dates, but row 0's is a Date and row ${t}'s a number.`):new TypeError(`lineChart: x must be a valid Date, got ${gr(e)} in row ${t}.`);if(typeof e!="number"||!Number.isFinite(e))throw new RangeError(`lineChart: x must be a finite number, got ${gr(e)} in row ${t}.`);return e}function nd(e,t,n){let{xFormat:r}=e;return r?o=>r(t?new Date(o):o):t?Ki(n,e.timeZone):ha}function ns(e,t){return t?new Date(e):e}function rd(e,t,n){if(typeof e=="number"&&Number.isFinite(e))return e;throw new RangeError(`lineChart: "${t}" for "${n}" must be a finite number, got ${gr(e)}. Lines can't skip a value yet.`)}function od(e,t){let n=new Map;for(let r of e)for(let{series:o,value:a}of r.values){let i=t(o,a),s=i.replace(/\d/g,"0");n.has(s)||n.set(s,i)}return[...n.values()]}function Zi(e,t,n,r){return e.reduce((o,a)=>Math.max(o,r(a,t,n)),0)}function la(e){return typeof e=="function"?e:t=>t[e]}var gr=e=>typeof e=="string"?JSON.stringify(e):String(e);var ro=500,rs=2,ad=2,id=.5;function ga(e,t,n){let r=un(e,"lineChart");kn(t,"lineChart");let o=t,a=cn(t.motion,n.motion),i=jt(t.on,n.presets),s=$t(t.colors),c=n.clock??Fe,d=r.ownerDocument;gt(d);let l=Y("svg",{class:"ec-chart ec-line-chart",role:"group"},r),u=Y("g",{class:"ec-grid","aria-hidden":"true"},l),f=Y("g",{class:"ec-axis","aria-hidden":"true"},l),h=Y("line",{class:"ec-crosshair","aria-hidden":"true",visibility:"hidden"},l),w=Y("g",{class:"ec-focus","aria-hidden":"true",visibility:"hidden"},l),v=Y("g",{class:"ec-marks","aria-hidden":"true"},l),D=Y("g",{class:"ec-lines"},v),F=Y("g",{class:"ec-points"},v),P=Y("g",{class:"ec-columns"},l),V=Y("g",{class:"ec-overlay","aria-hidden":"true"},l),x=Rn(l),R=[],O=new Map,G=new Map,g=new WeakMap,E=[],U=new Map,k=new Map,T=Gn(y=>y.kind==="line"?y.presence.animating:y.row.presence.animating||y.row.values.animating||y.row.x.animating),H=An("lineChart"),_=Nn(r),te=!1,ae=1/0,z=new WeakSet,Z,se,de;try{Z=Ge(o),se=Je(o,Z),de=ss(o,Z)}catch(y){throw l.remove(),y}let we=y=>k.get(y)??U.get(y)??T.get(y),A=ln({overlay:V,mark:y=>({set:L=>{we(y)?.handle.set(L),He.restyled(y)},reset:()=>{we(y)?.handle.reset(),He.restyled(y)}}),colors:y=>we(y)?.parts[0]?.colors}),j=on({effects:i,motion:a,icons:n.icons,clock:c,surface:A}),Q=Un(l,{motion:a,option:()=>o.tooltip,description:()=>o.markDescription}),ue=On(l),be=Vn(l),ve=o.announce?Ot(l):void 0,je=!1,Oe=()=>{je=!0},Pe=Be(Z.frame.scale,xt,{clock:c,motion:a,onChange:Oe}),Ce=Be(Z.frame.box,xt,{clock:c,motion:a,onChange:Oe}),Ae=new Map,_e=new Map,dt=Z.decimals,ut={changed:[],added:[],removed:[]},wt=Z.frame,me=Hn({clock:c,runner:j,leaving:T,draw:M,land:oe});function Ge(y,L=i){let $=Xi(y),q=$.series.map(re=>re.series);Fn(L,q,"lineChart");let J=Qi({data:y.data,encoding:$,width:y.width??_,height:y.height,format:qe(y),measure:x,label:ft(y,!0)}),X=new Set(J.series);for(let re of J.rows)for(let he of J.series){let ge=wr(he,re.key);if(X.has(ge))throw new RangeError(`lineChart: two marks would have the key "${ge}". Series and keys joined with "@" must be unique.`);X.add(ge)}for(let re of J.rows)if(X.has(re.key))throw new RangeError(`lineChart: the key "${re.key}" would name both an x and a line or point. A row's key can't be a series, or a series and a key joined with "@".`);return J}function ft(y,L=!1){let{labels:$}=y;if($===!1)return;let q=qe(y);return(J,X)=>{let re=`${q(X)} ${Xe(y.seriesLabels,J)}`;if(typeof $!="function")return re;try{let he=$(X,J,q);return he==null?"":String(he)}catch(he){return!L&&!z.has($)&&(z.add($),Se(he)),re}}}function Ke(y){let L=ft(o);if(L)return{text:($,q)=>L($,bn(q,y[$]??Kt(q))),measure:x}}function Dt(y){let L=y.rows.map(os);return{lines:new Map(fa(y.frame,L,y.series,Rt(y),y.time,Ke(y.decimals)).map($=>[$.series,$])),points:new Map(L.flatMap($=>ma(y.frame,$,y.series,y.time)).map($=>[$.key,$]))}}function Tt(y){let L=y.rows[0],$=y.rows[y.rows.length-1];return L&&$?Math.min(Math.max(ae,L.x),$.x):ae}function Rt(y){let L=y.rows[y.rows.length-1];return L&&ae<L.x?Tt(y):1/0}let st=y=>!y.leaving&&y.row.x<=Tt(Z);function Ct(y,L){let $=Y("g",{class:"ec-column","data-key":y.key,role:"img"},P),q={clock:c,motion:a,onChange:Oe},J={key:y.key,row:y,column:$,hit:Y("rect",{class:"ec-hit"},$),x:Be(y.x,ct,q),values:Be(vr(y.values),xt,q),presence:Be(L?0:1,ct,q),anchor:void 0,points:[],leaving:!1,shown:!0};return g.set($,J),J}function vt(y,L,$){let q=Y("g",{class:"ec-line","data-key":y,"data-series":y},D),J=Y("g",{class:"ec-body"},q),X={kind:"line",key:y,series:y,group:q,body:J,path:Y("path",{class:"ec-stroke","stroke-width":ua},J),end:Y("circle",{class:"ec-end",r:br},J),label:Y("text",{class:"ec-value ec-end-label"},q),drawnLabel:void 0,parts:[],handle:gn(()=>X),target:L,shown:L,presence:Be($?0:1,ct,{clock:c,motion:a,onChange:Oe}),leave:void 0};return X}function Lt(y,L){let $=Y("g",{class:"ec-point","data-key":L.key,"data-series":L.series},F),q=Y("g",{class:"ec-body"},$),J={kind:"point",key:L.key,series:L.series,row:y,group:$,body:q,path:Y("path",{class:"ec-dot"},q),parts:[],handle:gn(()=>J),target:L,shown:L,hidden:void 0,leave:void 0};return J}let Ne=y=>we(y.key)===y,Qe=y=>y.points.filter(L=>k.get(L.key)===L),Pt=()=>[...T.values()].filter(y=>y.kind==="line"),Qt=()=>({scale:Pe.value,box:Ce.value});function Ue(){let y=X=>({x:X.x.value,values:X.values.value}),L=new Map,$=new Set,q=X=>{let re=L.get(X);if(re)return re;let he=X.presence.value,ge=y(X);if(X.anchor&&he<1&&!$.has(X)){$.add(X);let De=q(X.anchor);$.delete(X),ge={x:De.x+he*(ge.x-De.x),values:xt(De.values,ge.values)(he)}}return L.set(X,ge),ge};return[...R,...[...G.values()].filter(X=>X.presence.value>0&&X.anchor)].map(X=>{let{x:re,values:he}=q(X);return{record:X,state:{key:X.key,datum:X.row.datum,x:re,values:he}}}).sort((X,re)=>X.state.x-re.state.x)}function M(){if(!je)return;je=!1;let y=Qt(),L=Ue();pe(y),p(y,L.map($=>$.state));for(let{record:$,state:q}of L){let J=new Map(ma(y,q,$.points.map(X=>X.series),Z.time).map(X=>[X.key,X]));m($.points.filter(Ne).map(X=>({record:X,placed:J.get(X.key)})))}B(y,L),K()}function W(){let y=Qt(),L=Ue();p(y,L.map($=>$.state)),B(y,L),K()}function oe(){for(let J of G.values()){for(let X of[J.x,J.values,J.presence])X.stop();J.column.remove()}G.clear();for(let J of R)J.anchor=void 0,J.points=J.points.filter(Ne);for(let[J,X]of[[Ae,Z.yTicks],[_e,Z.xTicks]]){for(let re of[...J.values()])re.wanted||(re.line?.remove(),re.label.remove(),J.delete(re.value));for(let re of X){let he=J.get(re.value);he&&(he.line&&"line"in re&&le(he.line,{...re.line,opacity:void 0}),St(he.label,re.label),he.label.removeAttribute("opacity"))}}dt=Z.decimals;let{frame:y}=Z;le(l,At(y.box)),wt=y;let L=Dt(Z),$=(J,X)=>{let re=J.flatMap(ge=>{let De=X(ge);return De?[{record:ge,to:De}]:[]});if(!re.every(({record:ge,to:De})=>sd(ge.target.geometry,De.geometry)&&is(ge.target.data,De.data)))for(let{record:ge,to:De}of re)ge.target=De;m(re.map(({record:ge})=>({record:ge,placed:ge.target})))};$(E,J=>L.lines.get(J.series)),I(new Map(E.flatMap(J=>L.lines.has(J.series)?[[J,L.lines.get(J.series)]]:[])));let q=R.map(J=>({record:J,state:os(J.row)}));for(let{record:J}of q)$(Qe(J),X=>L.points.get(X.key));B(y,q),K(),je=!1}function pe(y){wt=y,le(l,At(y.box));let L=qe(o);for(let $ of Ae.values()){let q=ya(y,$.value,L($.value)),J=$.opacity.value<1?$.opacity.value:void 0;le($.line,{...q.line,opacity:J}),St($.label,q.label),le($.label,{opacity:J})}for(let $ of _e.values())St($.label,pa(y,$.value,$.text).label),le($.label,{opacity:$.opacity.value<1?$.opacity.value:void 0})}function p(y,L){let $=[...E,...Pt()];if(L.length===0||$.length===0)return;let q=fa(y,L,$.map(J=>J.series),Rt(Z),Z.time,Ke(dt));m($.map((J,X)=>({record:J,placed:q[X]}))),I(new Map($.map((J,X)=>[J,q[X]])))}function I(y){for(let[L,{label:$}]of y)$&&St(L.label,$),L.drawnLabel=$&&$.text!==""?$:void 0,le(L.label,{visibility:L.drawnLabel?void 0:"hidden"})}function m(y){let L=y.some(({record:$,placed:q})=>!is($.shown.data,q.data));for(let{record:$,placed:q}of y)$.kind==="line"?b($,q,L):S($,q,L)}function b(y,L,$){let q=$||mn(y.shown.geometry,L.geometry);y.shown=L;let{geometry:J}=L;C(y,at(s.slot(y.series)),{visible:J.length>=id,open:{width:J.thickness}}),le(y.end,{cx:J.end.x,cy:J.end.y});let X=y.presence.value;le(y.group,{opacity:X<1?X:void 0}),q&&j.change(J,L.data)}function S(y,L,$){let q=$||mn(y.shown.geometry,L.geometry);y.shown=L,C(y,at(s.slot(y.series)),{visible:!0}),q&&j.change(L.geometry,L.data)}function C(y,L,$){let q=y.parts[0],{d:J}=y.shown.geometry.outline,X=q?.colors.color!==L.color;!X&&q?.d===J&&q.visible===$.visible&&q.open?.width===$.open?.width||(y.path.getAttribute("d")!==J&&y.path.setAttribute("d",J),X&&$e(y.group,ht(L)),y.parts=[{element:y.path,d:J,colors:L,...$}],y.handle.repaint(),q&&X&&A.recolor(y.key))}function B(y,L){let{x:$}=Yn(y),q=L.filter(({record:re})=>st(re)),J=es(y,q.map(({state:re})=>$(re.x)));q.forEach(({record:re},he)=>le(re.hit,{...J[he]}));let X=new Set(q.map(({record:re})=>re));for(let re of[...R,...G.values()]){let he=X.has(re);re.shown!==he&&(re.shown=he,le(re.column,{visibility:he?void 0:"hidden","aria-hidden":re.leaving?"true":void 0}));let ge=!st(re);for(let De of re.points)De.hidden!==ge&&(De.hidden=ge,le(De.group,{visibility:ge?"hidden":void 0}),A.hide(De.key,ge))}}function N(y){let L=O.get(y),$=L&&st(L)?Qe(L):[],q=$[0];if(!L||!q)return;let J=q.shown.geometry.center.x;le(h,{...ts(wt,J),visibility:void 0});let X=$.map(he=>{let{transform:ge}=he.handle.style,{center:De}=he.shown.geometry;return(ge?xe.apply(ge,De):De).y}),{row:re}=L;Q.showAt({x:J,top:Math.min(...X)-br,bottom:Math.max(...X)+br},re,()=>Wr(re.label,ls(re.values,o),qe(o),{total:!1}))}function ee(){h.setAttribute("visibility","hidden"),Q.hide()}function ce(y){let L=y===void 0?void 0:O.get(y),$=L&&st(L)?Qe(L):[];for(;w.childElementCount>$.length;)w.lastElementChild.remove();$.forEach((q,J)=>{let X=w.children[J];X||(X=Y("g",{},w),Y("path",{class:"ec-focus-ring","stroke-width":2*(rs+ad)},X),Y("path",{class:"ec-focus-gap","stroke-width":2*rs},X));for(let he of Array.from(X.children))he.setAttribute("d",q.shown.geometry.outline.d);let{transform:re}=q.handle.style;le(X,{transform:re&&pt(re)})}),le(w,{visibility:$.length>0?void 0:"hidden"})}function K(){He.key!==void 0&&N(He.key),He.ringKey!==void 0&&ce(He.ringKey)}let ye=y=>({mark:y.target.geometry,data:y.target.data}),Ie=y=>({mark:y.shown.geometry,data:y.shown.data});function Ve(y){let L=y,$=typeof L?.closest=="function"?L.closest(".ec-column"):null,q=$?g.get($):void 0;return q&&O.get(q.key)===q&&st(q)?q:void 0}let He=$n({svg:l,runner:j,events:H,dim:()=>!1,find(y){let L=Ve(y);return L&&{key:L.key}},live(y){let L=O.get(y);return L!==void 0&&st(L)},order:()=>R.filter(st).map(y=>y.key),marks:y=>{let L=O.get(y);return L?Qe(L).map($=>$.key):[]},element:y=>(O.get(y)??G.get(y))?.column,markElement:y=>we(y)?.group,onScreen(y){let L=we(y);return L&&Ie(L)},ring:ce,tooltip:{show:N,hide:ee}}),Ee=()=>ue.update(Z.series.map(y=>({series:y,label:Xe(o.seriesLabels,y)})),s,o.legend);function Je(y,L){return In({option:y.table,caption:y.label,category:typeof y.x=="string"?y.x:void 0,series:L.series,label:$=>Xe(y.seriesLabels,$),rows:L.rows.map($=>({key:$.key,category:$.label,datum:$.datum,index:$.index,values:$.values,total:cs($.values)})),format:qe(y),total:!1})}function mt(y){y.column.setAttribute("aria-label",de.get(y.key)),Q.describe(y.column,y.row)}function Et(y,L){let $=o.announce;if(!ve||!$)return;let q=Z.series,J=Re=>Re.row.label,{changed:X,added:re,removed:he}=ut,ge=Tn({...o.label!==y.label?{label:o.label}:{},...q.join(`
|
|
90
|
-
`)!==L.join(`
|
|
91
|
-
`)?{series:q.map(Re=>Xe(o.seriesLabels,Re))}:{},changed:X.map(J),added:re.map(J),removed:he.map(J),count:R.length});if(typeof $!="function"){ve.say(ge);return}let De=Re=>Re.key;try{let Re=$({text:ge,changed:X.map(De),added:re.map(De),removed:he.map(De)});Re!=null&&ve.say(String(Re))}catch(Re){Se(Re)}}function et(y){Z=y;let L=Dt(y),$={entering:[],exiting:[],changed:[]},q=new Set(y.rows.map(ne=>ne.key)),J=y.rows.length>0?y.series:[],X={changed:[],added:[],removed:[]},re=R,he=new Map(re.map(ne=>[ne,ne.row])),ge=E.filter(ne=>!J.includes(ne.series)),De=[];for(let ne of re){let ke=!q.has(ne.key);ke&&(O.delete(ne.key),ne.leaving=!0,G.set(ne.key,ne),X.removed.push(ne));for(let We of Qe(ne))(ke||!J.includes(We.series))&&De.push(We)}for(let ne of ge)U.delete(ne.series);for(let ne of De)k.delete(ne.key);for(let ne of[...ge,...De])T.start(ne);$.exiting.push(...ge,...De);let Re=new Set,fe=X.removed.length>0;R=y.rows.map(ne=>{let ke=O.get(ne.key);return ke?(Re.add(ke),ke.row.x!==ne.x&&(fe=!0),ne.values.some((We,Sn)=>ke.row.values[Sn]?.series!==We.series||ke.row.values[Sn]?.value!==We.value)&&X.changed.push(ke)):(ke=G.get(ne.key)??Ct(ne,!0),G.delete(ne.key),ke.leaving=!1,ke.x.set(ne.x),ke.values.set(vr(ne.values)),O.set(ne.key,ke),X.added.push(ke),fe=!0),ke.row=ne,ke}),R.forEach((ne,ke)=>{Re.has(ne)?ne.presence.value===1&&(ne.anchor=void 0):ne.anchor=as(R,ke,Re)});for(let ne of X.removed)ne.anchor??(ne.anchor=as(re,re.indexOf(ne),Re));let Zt=E;E=J.map(ne=>{let ke=U.get(ne),We=L.lines.get(ne);if(ke){let Sn=[...Re].some(qt=>oo(he.get(qt),ne)!==oo(qt.row,ne));(fe||Sn)&&$.changed.push({record:ke,from:ke.shown.geometry})}else ke=Wt(ne,"line")??vt(ne,We,!0),U.set(ne,ke),$.entering.push(ke);return ke.target=We,ke});for(let ne of R){let ke=Re.has(ne)?he.get(ne):void 0,We=J.map(qt=>{let Rr=wr(qt,ne.key),ja=L.points.get(Rr),Jt=k.get(Rr);return Jt?ke&&oo(ke,qt)!==oo(ne.row,qt)&&$.changed.push({record:Jt,from:Jt.shown.geometry}):(Jt=Wt(Rr,"point")??Lt(ne,ja),Jt.row=ne,k.set(Rr,Jt),$.entering.push(Jt)),Jt.target=ja,Jt}),Sn=new Set(We);ne.points=[...We,...ne.points.filter(qt=>!Sn.has(qt)&&Ne(qt))]}for(let ne of R)mt(ne);return vn(P,re.filter(ne=>!ne.leaving).map(ne=>ne.column),R.map(ne=>ne.column),He.active),vn(D,Zt.map(ne=>ne.group),E.map(ne=>ne.group),()=>null),ut=X,je=!0,M(),$}function Wt(y,L){return T.get(y)?.kind===L?T.recall(y):void 0}function ie(y,L){je=!0;let{frame:$}=y;for(let[fe,Zt,ne]of[[Ae,y.yTicks,!0],[_e,y.xTicks,!1]]){let ke=new Set(Zt.map(We=>We.value));for(let We of ke)fe.has(We)||tt(fe,We,0,ne);for(let We of fe.values())We.wanted=ke.has(We.value)}for(let fe of y.xTicks)_e.get(fe.value).text=fe.label.text;let q=Pt(),J=[...G.values()],X=Le(Pe,$.scale,ze)||[...Ae.values()].some(fe=>Le(fe.opacity,fe.wanted?1:0,Me))||R.some(fe=>Le(fe.values,vr(fe.row.values),ze))||E.some(fe=>Le(fe.presence,1,Me))||q.some(fe=>Le(fe.presence,0,Me)),re=Le(Ce,$.box,ze)||[..._e.values()].some(fe=>Le(fe.opacity,fe.wanted?1:0,Me))||R.some(fe=>Le(fe.x,fe.row.x,Me)||fe.anchor!==void 0&&Le(fe.presence,1,Me))||J.some(fe=>fe.anchor!==void 0&&Le(fe.presence,0,Me)),he,ge;!L&&a.staged?(he={duration:ro},ge={duration:ro,delay:X?ro:0}):L||(he=ge={duration:(X&&re?2:1)*ro});let De=[],Re=(fe,Zt,ne,ke)=>{Le(fe,Zt,ne)&&(ke?De.push(fe.to(Zt,ke)):fe.set(Zt))};Re(Pe,$.scale,ze,he),Re(Ce,$.box,ze,ge);for(let fe of Ae.values())Re(fe.opacity,fe.wanted?1:0,Me,he);for(let fe of _e.values())Re(fe.opacity,fe.wanted?1:0,Me,ge);for(let fe of R)Re(fe.values,vr(fe.row.values),ze,he),Re(fe.x,fe.row.x,Me,ge),Re(fe.presence,1,Me,fe.anchor?ge:void 0);for(let fe of J)Re(fe.presence,0,Me,fe.anchor?ge:void 0);for(let fe of E)Re(fe.presence,1,Me,he);for(let fe of q)Re(fe.presence,0,Me,he);return De}function tt(y,L,$,q,J=""){let X={value:L,line:q?Y("line",{class:L===0?"ec-baseline":"ec-gridline"},u):void 0,label:Y("text",{class:"ec-tick"},f),text:J,opacity:Be($,ct,{clock:c,motion:a,onChange:Oe}),wanted:!0};y.set(L,X);for(let re of[...y.values()].sort((he,ge)=>he.value-ge.value))re.line&&u.appendChild(re.line),f.appendChild(re.label)}function Gt(y,L){return Z=y,dt=Object.fromEntries(y.series.map($=>[$,Math.max(dt[$]??0,y.decimals[$]??0)])),me.run(ie(y,L))}let Mn=Kn(l,a);function Ba(){if(te)return;let y=Ge(o),L=new Map(y.rows.map(q=>[q.key,q]));for(let q of R)q.row=L.get(q.key)??q.row;let $=Dt(y);for(let q of E)q.target=$.lines.get(q.series)??q.target;for(let q of k.values())q.target=$.points.get(q.key)??q.target;Gt(y,!0)}let kc=zn(r,c,_,y=>{_=y,o.width===void 0&&Ba()}),xc=_n(d,()=>{x.clear(),Ba()});fn(l,o),Ee(),be.render(se);{let y=Dt(Z);for(let L of Z.yTicks)tt(Ae,L.value,1,!0);for(let L of Z.xTicks)tt(_e,L.value,1,!1,L.label.text);R=Z.rows.map(L=>{let $=Ct(L,!1);return O.set(L.key,$),$.points=Z.series.map(q=>{let J=Lt($,y.points.get(wr(q,L.key)));return k.set(J.key,J),J}),mt($),$}),E=Z.rows.length>0?Z.series.map(L=>vt(L,y.lines.get(L),!1)):[];for(let L of E)U.set(L.series,L);oe()}let Ha=()=>[...E,...R.flatMap(Qe)];return He.sync(),j.enter(Ha().map(ye)),_t(He.link,{element:l,async update(y){if(te)return;if(y.motion!==void 0&&y.motion!==o.motion)throw new TypeError("lineChart: `motion` can't be changed by update() yet.");let L={...o,...y};kn(L,"lineChart");let $="on"in y?Bn(i,o.on,L.on,n.presets):i,q=Ge(L,$),J=Je(L,q),X=ss(L,q);"colors"in y&&(s=$t(L.colors));let re=o,he=Z.series;o=L,de=X,fn(l,o),be.render(J);let ge=ve!==void 0;o.announce&&!ve?ve=Ot(l):!o.announce&&ve&&(ve.destroy(),ve=void 0),me.supersede();let De=$!==i;i=$;let Re=jn({runner:j,events:H,hover:He,leaving:T,input:ye,onScreen:Ie,...De?{swap:Zt=>{let ne=new Set(Zt.entering);j.swap($,Ha().filter(ke=>!ne.has(ke)).map(ye))}}:{}},()=>et(q),()=>{ge&&Et(re,he)});Ee();let fe=Gt(q,a.mode==="off");await me.wait(fe,Re)},reveal(y){if(te)return;if(y instanceof Date&&Number.isNaN(y.getTime()))throw new RangeError("lineChart: reveal(x) needs a valid Date, got an invalid Date.");let L=y instanceof Date?y.getTime():y;if(typeof L!="number"||Number.isNaN(L))throw new RangeError(`lineChart: reveal(x) needs a number, got ${typeof L=="string"?JSON.stringify(L):String(L)}.`);let $=Tt(Z);ae=L,Tt(Z)!==$&&(W(),He.dropGone(),He.sync())},on:H.on,marks:()=>[...E.map(y=>y.shown.geometry),...R.filter(st).flatMap(y=>Qe(y).map(L=>L.shown.geometry))],focus(y){if(te)return;let L=O.get(y)??k.get(y)?.row;L&&He.focus(L.key)},leave(){te||He.leave()},labels:()=>E.flatMap(y=>dn(y.key,"value",y.drawnLabel,y.label)),destroy(){if(!te){te=!0,me.destroy(),He.destroy(),j.destroy(),Q.destroy(),ue.destroy(),be.destroy(),ve?.destroy(),Mn(),kc(),xc();for(let y of[...R,...G.values()])for(let L of[y.x,y.values,y.presence])L.stop();for(let y of[...E,...Pt()])y.presence.stop();for(let y of T.values())y.leave?.resolve();Pe.stop(),Ce.stop();for(let y of[...Ae.values(),..._e.values()])y.opacity.stop();H.clear(),O.clear(),G.clear(),U.clear(),k.clear(),T.clear(),R=[],E=[],l.remove()}}})}function os(e){return{key:e.key,datum:e.datum,x:e.x,values:vr(e.values)}}function vr(e){return Object.fromEntries(e.map(t=>[t.series,t.value]))}function oo(e,t){return e.values.find(n=>n.series===t)?.value}function cs(e){return e.reduce((t,n)=>t+n.value,0)}function as(e,t,n){for(let r=t-1;r>=0;r--)if(n.has(e[r]))return e[r];for(let r=t+1;r<e.length;r++)if(n.has(e[r]))return e[r]}function sd(e,t){return e.key===t.key&&!mn(e,t)&&e.start.x===t.start.x&&e.start.y===t.start.y&&e.end.x===t.end.x&&e.end.y===t.end.y}function is(e,t){return e.datum!==t.datum||e.samples.length!==t.samples.length?!1:e.samples.every((n,r)=>{let o=t.samples[r];return n.t===o.t&&n.value===o.value&&cd(n.at,o.at)})}function cd(e,t){return e===t||e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function ls(e,t){return e.map(n=>({series:n.series,label:Xe(t.seriesLabels,n.series),value:n.value}))}function ss(e,t){let n=qe(e);return new Map(t.rows.map(r=>{let o=ls(r.values,e),a=`${r.label}: ${o.map(i=>`${n(i.value)} ${i.label}`).join(", ")}`;if(!e.markLabel)return[r.key,a];try{let i=e.markLabel(r.datum,{key:r.key,category:r.label,values:o,total:cs(r.values),format:n,text:a});if(i!=null&&String(i).trim()!=="")return[r.key,String(i)]}catch(i){Se(i)}return[r.key,a]}))}function kr(e){let t=ba(e.start,e.pivot);return t>.5&&Math.abs(ba(e.center,e.pivot)-t)<=.5&&Math.abs(ba(e.end,e.pivot)-t)<=.5}var ba=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y);var ds=.5,ld=["left","right","top","bottom"];function fs(e){return typeof e=="string"&&ld.includes(e)}function xr(e,t){if(t!=="auto")return e.map(()=>t);if(e.length===0)return[];let n=us(e,a=>a.x,a=>a.x+a.width,"left","right"),r=us(e,a=>a.y+a.height,a=>a.y,"bottom","top");if(n&&r)return dd(e)?n:r;let o=n??r;if(!o)throw new RangeError('expressive: baseline "auto" found no edge that every mark grows from. Pass baseline: "left", "right", "top" or "bottom".');return o}function io(e,t,n){let r=xn(t.map(f=>f.box)),o=ud(r,n),a=t.map((f,h)=>({index:h,...o(f.box)})).sort((f,h)=>f.near-h.near||f.far-h.far||f.index-h.index),i=0,s=1/0,c=a.map(({index:f,near:h,far:w})=>{i>0&&w>h&&(s=Math.min(s,h-i));let v=Math.max(0,w-i);return i=Math.max(i,w),{series:t[f].series,size:v}}),d=t[a[a.length-1].index],l=t.length===1?t[0].series:void 0;return{geometry:Ye.bar({key:e,...l===void 0?{}:{series:l},...r,baseline:n,radius:d.radius,gap:Number.isFinite(s)?Math.max(0,ao(s)):0,...c.every(f=>f.series!==void 0)?{segments:c.map(f=>({series:f.series,size:ao(f.size)}))}:{}}),order:a.map(f=>f.index)}}function Mr(e,t){let n=t[0]==="left"||t[0]==="right",r=a=>n?a.y:a.x,o=a=>n?a.x:a.y;return e.map((a,i)=>i).sort((a,i)=>r(e[a])-r(e[i])||o(e[a])-o(e[i])||a-i)}function xn(e){let t=Math.min(...e.map(r=>r.x)),n=Math.min(...e.map(r=>r.y));return{x:t,y:n,width:ao(Math.max(...e.map(r=>r.x+r.width))-t),height:ao(Math.max(...e.map(r=>r.y+r.height))-n)}}function us(e,t,n,r,o){let a=e[0];if(!a)return[];for(let i of[t(a),n(a)]){let s=[];for(let c of e)if(Math.abs(t(c)-i)<ds)s.push(r);else if(Math.abs(n(c)-i)<ds)s.push(o);else break;if(s.length===e.length)return s}}function dd(e){let t=o=>Math.max(...o)-Math.min(...o),n=t(e.map(o=>o.y+o.height/2)),r=t(e.map(o=>o.x+o.width/2));return n!==r?n>r:e[0].width>=e[0].height}function ud(e,t){switch(t){case"left":return n=>({near:n.x-e.x,far:n.x+n.width-e.x});case"right":return n=>({near:e.x+e.width-(n.x+n.width),far:e.x+e.width-n.x});case"top":return n=>({near:n.y-e.y,far:n.y+n.height-e.y});case"bottom":return n=>({near:e.y+e.height-(n.y+n.height),far:e.y+e.height-n.y})}}function ao(e){return Math.round(e*1e3)/1e3}function ms(){let e=new Map,t=u=>{let f=e.get(u);return f||(f={attributes:new Map,styles:new Map,classes:new Set,before:{}},e.set(u,f)),f},n=u=>u.style,r=(u,f,h)=>{h===null?u.removeAttribute(f):u.getAttribute(f)!==h&&u.setAttribute(f,h)},o=(u,f)=>{let h=f.before.style;f.styles.size>0||!h||(f.before.style=void 0,n(u)?.cssText===h.css&&r(u,"style",h.text))},a=(u,f)=>{let h=f.before.class;if(f.classes.size>0||h===void 0)return;f.before.class=void 0;let w=v=>[...new Set((v??"").split(/\s+/).filter(Boolean))].sort().join(" ");w(u.getAttribute("class"))===w(h)&&r(u,"class",h)};function i(u,f,h){let w=u.getAttribute(f),v=t(u).attributes,D=v.get(f);D?(w!==D.written&&(D.original=w),D.written=h):v.set(f,{original:w,written:h}),r(u,f,h)}function s(u,f,h){if(h!==null){i(u,f,h);return}let w=e.get(u)?.attributes,v=w?.get(f);!w||!v||(u.getAttribute(f)===v.written&&r(u,f,v.original),w.delete(f))}function c(u,f,h){let w=n(u);if(!w)return;let v=t(u),D=v.styles.get(f);if(h===void 0){if(!D)return;D.value===""?w.removeProperty(f):w.setProperty(f,D.value,D.priority),v.styles.delete(f),o(u,v);return}D||(v.styles.size===0&&(v.before.style={text:u.getAttribute("style"),css:w.cssText}),v.styles.set(f,{value:w.getPropertyValue(f),priority:w.getPropertyPriority(f)})),w.getPropertyValue(f)!==h&&w.setProperty(f,h)}function d(u,f,h){let w=u.classList;if(h){if(w.contains(f))return;let D=t(u);D.classes.size===0&&(D.before.class=u.getAttribute("class")),D.classes.add(f),w.add(f);return}let v=e.get(u);v?.classes.delete(f)&&(w.remove(f),a(u,v))}function l(u){let f=e.get(u);if(f){for(let h of[...f.styles.keys()])c(u,h,void 0);for(let h of[...f.classes])d(u,h,!1);for(let h of[...f.attributes.keys()])s(u,h,null);e.delete(u)}}return{attribute:s,remove:(u,f)=>i(u,f,null),style:c,styled:(u,f)=>e.get(u)?.styles.has(f)??!1,toggleClass:d,restore:l,restoreAll(){for(let u of[...e.keys()])l(u)},elements:()=>[...e.keys()]}}function Sr(){let e=new Map;return t=>(e.has(t)||e.set(t,gs(t)),e.get(t))}function Xt(e,t,n,r=gs){let o=r(e),a=o&&r(t);return o&&a?xe.multiply(Dn(o),a):xe.multiply(Dn(ys(e,n)),ys(t,n))}function Er(e){return lr(e.getAttribute("transform")??"")}function ps(e){let[t,n,r,o]=e,a=1e-9*Math.max(Math.abs(t),Math.abs(n),Math.abs(r),Math.abs(o));return Math.abs(n)<=a&&Math.abs(r)<=a||Math.abs(t)<=a&&Math.abs(o)<=a}function Qn(e,t){let n=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x,y:t.y+t.height},{x:t.x+t.width,y:t.y+t.height}].map(s=>xe.apply(e,s)),r=n.map(s=>s.x),o=n.map(s=>s.y),a=Xn(Math.min(...r)),i=Xn(Math.min(...o));return{x:a,y:i,width:Xn(Xn(Math.max(...r))-a),height:Xn(Xn(Math.max(...o))-i)}}function hs(e){let t=n=>{let r=e[n],o=typeof r?.baseVal?.value=="number"?r.baseVal.value:Number.parseFloat(e.getAttribute(n)??"");return Number.isFinite(o)?o:0};return{x:t("x"),y:t("y"),width:Math.max(0,t("width")),height:Math.max(0,t("height"))}}function gs(e){let t=typeof e.getScreenCTM=="function"?e.getScreenCTM():null;return t?[t.a,t.b,t.c,t.d,t.e,t.f]:void 0}function ys(e,t){let n=[1,0,0,1,0,0];for(let r=e;r&&r!==t;r=r.parentElement)n=xe.multiply(Er(r),n);return n}function Xn(e){return Math.round(e*1e3)/1e3}function vs(e,t,n){let r={},o=!1,a=_r(),i=()=>{let{transform:c,opacity:d,emphasis:l}=r;for(let u of e()){let{element:f,colors:h}=u,w=c&&u.parentInverse?xe.multiply(u.parentInverse,c,u.parent,Er(f)):void 0;t.style(f,"transform",w&&yd(w)),t.style(f,"transform-origin",w&&"0 0"),t.style(f,"transform-box",w&&"view-box"),t.style(f,"opacity",d===void 0?void 0:String(d));let v=h?l!==void 0?md(h,l):o?h.strong:void 0:void 0;t.style(f,"fill",h?.paint==="fill"?v:void 0),t.style(f,"stroke",h?.paint==="stroke"?v:void 0),t.style(f,"transition",l===void 0||!h?void 0:"none")}s()},s=()=>{let c=e().flatMap(d=>d.outline===void 0?[]:[{...d.outline,color:d.colors?.color}]);a.paint(n(),c,r.halo,r.transform)};return{get style(){return r},set(c){r=Yt(r,c),i()},reset(){r={},i()},repaint:i,hot(c){c!==o&&(o=c,i())}}}function ks(e,t){let n=bs(e,t,"fill"),r=n===Dr?"stroke":"fill",o=r==="fill"?n:bs(e,t,"stroke");if(!(o===void 0||o===Dr))return{color:o,strong:`color-mix(in oklab, ${o}, ${it("text")} ${fd})`,paint:r}}var fd="25%",Dr="none";function bs(e,t,n){let r;for(let i=e;i&&r===void 0;i=i===t?null:i.parentElement){let s=i.style?.getPropertyValue(n)||i.getAttribute(n);s&&(r=s)}let o=ws(e.ownerDocument.defaultView?.getComputedStyle?.(e).getPropertyValue(n)),a=n==="fill"?o?.replace(/\s/g,"")==="rgb(0,0,0)":o===Dr;return o!==void 0&&!(a&&r!==void 0)?o:ws(r)}function ws(e){let t=e?.trim().toLowerCase();if(!(!t||t==="inherit"||t.startsWith("url(")))return t===Dr||t==="transparent"||/^rgba\((?:[^,]+,){3}\s*0(?:\.0*)?\s*\)$/.test(t)?Dr:e.trim()}function md(e,t){let n=Math.min(1,Math.max(0,t));return n===0?e.color:n===1?e.strong:`color-mix(in srgb, ${e.strong} ${Math.round(n*1e3)/10}%, ${e.color})`}function yd(e){return`matrix(${e.map((t,n)=>n<4?Math.round(t*1e6)/1e6:Math.round(t*1e3)/1e3).join(", ")})`}function wa(e){if(typeof e=="string"){if(typeof document>"u")throw new TypeError("expressive: a selector needs a document.");return{elements:Array.from(document.querySelectorAll(e)),data:void 0}}if(Ms(e))return{elements:[e],data:void 0};if(Ss(e)){let t=Array.from(e.nodes()),n=Array.from(e.data());return{elements:t,data:n.length===t.length?n:void 0}}if(e!==null&&typeof e=="object"&&typeof e.length=="number")return{elements:Array.from(e),data:void 0};throw new TypeError("expressive needs marks: a selector, an element, a list of elements or a D3 selection.")}function xs(e){if(!Ss(e))return;let{elements:t,data:n}=wa(e);return n&&new Map(t.map((r,o)=>[r,n[o]]))}function so(e){let t;for(let n of e){if(!Ms(n))throw new TypeError(`expressive: marks must be elements, got ${String(n)}.`);let r=n.ownerSVGElement??null;if(!r){let o=n.localName;throw new TypeError(o==="svg"?'expressive: got an <svg>, not its marks. Pass the marks, for example svg.querySelectorAll("rect").':`expressive: marks must be SVG elements inside an <svg>, got <${o}>.`)}for(;r.ownerSVGElement;)r=r.ownerSVGElement;if(t&&r!==t)throw new TypeError("expressive: all marks must be in the same <svg>.");t=r}if(!t)throw new TypeError("expressive: no marks.");return t}function co(e,t){let n=e[0].parentElement??t;for(;n!==t&&!e.every(r=>r!==n&&n.contains(r));)n=n.parentElement??t;return n}function Ms(e){return typeof e=="object"&&e!==null&&e.nodeType===1}function Ss(e){return typeof e=="object"&&e!==null&&typeof e.nodes=="function"&&typeof e.data=="function"}var pd=["d","x","y","width","height","cx","cy","r","points","transform"],hd=["transform","style"];function Es(e,t,n){let r=e.defaultView?.MutationObserver??(typeof MutationObserver>"u"?void 0:MutationObserver);if(!r)throw new TypeError("expressive: watch needs MutationObserver, which this DOM doesn't have.");let o=new Set,a=new Set,i=new Set,s=new Set,c,d=h=>{for(let{target:w,attributeName:v}of h){let D=w;i.has(D)&&o.add(D),s.has(D)&&(v==="transform"||v==="style")&&a.add(D)}},l=new r(h=>{d(h),(o.size>0||a.size>0)&&!c&&(c=t.onFrame(u))});function u(){if(d(l.takeRecords()),o.size===0&&a.size===0){c?.(),c=void 0;return}let h={marks:o,ancestors:a};o=new Set,a=new Set,n(h)}function f(){l.takeRecords(),c?.(),c=void 0,o=new Set,a=new Set}return{observe(h,w){f(),l.disconnect(),i=new Set(h),s=new Set;for(let v of h)for(let D=v.parentElement;D&&!s.has(D);D=D===w?null:D.parentElement)s.add(D);for(let v of s)i.has(v)||l.observe(v,{attributes:!0,attributeFilter:hd});for(let v of i)l.observe(v,{attributes:!0,attributeFilter:pd})},destroy(){f(),l.disconnect(),i=new Set,s=new Set}}}var gd="http://www.w3.org/2000/svg",bd=new Set(["img","image","graphics-symbol","graphics-object"]);function er(e,t,n){wd(t);let r=cn(t.motion,n.motion),o=jt(t.on,n.presets),a=n.clock??Fe,i=t.dim===!0,s=ms(),c=new WeakMap,d=e,l=!1,u=!1;function f(m){let{elements:b,data:S}=wa(m);if(b.length===0)return{root:void 0,ancestor:void 0,marks:[]};let C=so(b),B=co(b,C),N=new Map;b.forEach((Ee,Je)=>{let mt=V(Ee,Je,S),Et=t.key(mt,Ee);if(Et==null||Et==="")throw new TypeError(`expressive: key returned ${JSON.stringify(Et)??String(Et)} for a <${Ee.localName}>. Every mark needs a key.`);let et=String(Et),Wt=x(mt,Ee,et),ie=N.get(et);if(!ie)N.set(et,ie=[]);else{if(Wt===void 0)throw new RangeError(`expressive: two elements have the key "${et}". Keys must be unique, or name each part with segment.`);if(ie.some(tt=>tt.series===Wt))throw new RangeError(`expressive: the mark "${et}" has two "${Wt}" segments.`)}ie.push({element:Ee,datum:mt,series:Wt,value:t.value?.(mt,Ee)})});let ee={svg:C,common:B,screen:Sr(),colors:Ee=>O(Ee,C)},ce=Ee=>({...Ee,label:R(Ee.key,Ee.parts)}),K=[...N.keys()];if(t.geometry){let Ee=K.map((Je,mt)=>ce(h(Je,N.get(Je),mt,ee)));return{root:C,ancestor:B,marks:P(F(Ts(Ee,Je=>Je.geometry)))}}let ye=K.map(Ee=>N.get(Ee).map(Je=>w(Ee,Je,ee))),Ie=ye.map(Ee=>xn(Ee.map(Je=>Je.rect.box))),Ve=xr(Ie,t.baseline??"auto"),He=Mr(Ie,Ve).map(Ee=>ce(v(K[Ee],ye[Ee],Ve[Ee],Ee,ee)));return{root:C,ancestor:B,marks:P(F(He))}}function h(m,b,S,C){let B=b[0],N=t.geometry(B.element,B.datum,m);if(typeof N!="object"||N===null||N.key!==m)throw new TypeError(`expressive: geometry for "${m}" must be a MarkGeometry with the key "${m}". Build it with describe and the key passed in.`);let ee=b.map(ce=>D(ce,Md(N,ce.series,b.length),C));return{key:m,geometry:N,parts:ee,index:S}}function w(m,b,S){if(b.element.localName!=="rect")throw new TypeError(`expressive: can't read the geometry of a <${b.element.localName}> (mark "${m}"). Only <rect> marks are read; describe others with the geometry option.`);let C=xe.multiply(Xt(S.common,b.element.parentElement??S.svg,S.svg,S.screen),Er(b.element));if(!ps(C))throw new TypeError(`expressive: the <rect> of "${m}" is rotated or skewed, so it isn't an upright bar. Describe it with the geometry option.`);return{...b,rect:{box:Qn(C,hs(b.element)),series:b.series,radius:Sd(b.element)}}}function v(m,b,S,C,B){let{geometry:N,order:ee}=io(m,b.map(ye=>ye.rect),S),ce=N.segments??[],K=ee.map((ye,Ie)=>{let Ve=ce[Ie];return D(b[ye],Ve&&Ve.length>=.5?{d:Ve.outline.d}:void 0,B)});return{key:m,geometry:N,parts:K,index:C,rect:{edge:S,box:xn(b.map(ye=>ye.rect.box))}}}function D(m,b,S){let C=Xt(S.common,m.element.parentElement??S.svg,S.svg,S.screen);return{element:m.element,datum:m.datum,series:m.series,value:m.value,parent:C,parentInverse:Ed(C),colors:S.colors(m.element),outline:b}}function F(m){return m.map(b=>{let{key:S,geometry:C,parts:B}=b,N=b.rect?vd(B):void 0,ee=(ye,Ie,Ve)=>t.samples?xd(t.samples(ye,Ie),Ve===void 0?`"${S}"`:`"${S}" (${Ve})`):N===void 0?[]:kd(C,Ie,N),ce=new Map,K=ye=>ce.get(ye)??oe(ye,S);for(let ye of Ds(b)){let Ie=(B.find(Ve=>Ve.series===ye)??B[0]).datum;ce.set(ye,{datum:Ie,samples:ee(Ie,C.segments?.find(Ve=>Ve.series===ye)??C,ye),related:K})}return{...b,data:{datum:B[0].datum,samples:ee(B[0].datum,C),related:K}}})}function P(m){if(m.length===0)return m;let b=new Set(m.flatMap(S=>[...S.geometry.series===void 0?[]:[S.geometry.series],...Ds(S)]));for(let S of Ht){let C=o[S];if(C?.kind==="data")for(let B of C.needs?.related??[]){if(b.has(B))continue;let N=b.size>0?`the marks' series are ${[...b].map(ee=>`"${ee}"`).join(", ")}`:"the marks have no series";throw new RangeError(`expressive: on.${S} needs the series "${B}", but ${N}. Name each mark's series in its geometry (describe.line({ key, series, \u2026 })), or a stack's parts with segment.`)}}return m}function V(m,b,S){if(t.datum)return t.datum(m);if(S)return S[b];let C=m.__data__;return typeof C=="number"&&!l&&(l=!0,console.warn("expressive: element.__data__ is a number, which looks like Observable Plot's row index. Pass datum: (el) => rows[el.__data__].")),C}function x(m,b,S){if(!t.segment)return;let C=t.segment(m,b);if(C==null||C==="")throw new TypeError(`expressive: segment returned ${String(C)} for a part of "${S}".`);return String(C)}function R(m,b){if(t.markLabel)try{let S=String(t.markLabel(b[0].datum,{key:m,parts:b.map(({series:C,datum:B})=>({series:C,datum:B}))})??"");return S.trim()===""?void 0:S}catch(S){Se(S);return}}function O(m,b){if((s.styled(m,"fill")||s.styled(m,"stroke"))&&c.has(m))return c.get(m);let S=ks(m,b);return c.set(m,S),S}let G=f(d),g=G.root?.ownerDocument??(typeof document>"u"?void 0:document);if(!g)throw new TypeError("expressive needs a DOM.");gt(g);let E,U,k=new Map,T=[],H=new Map,_=new Map,te=new Set,ae={enter:new Set,update:new Set,exit:new Set,hover:new Set,leave:new Set},z,Z,se,de,we=!1,A=(m,b,S)=>{let C=g.createElementNS(gd,m);return le(C,b),S?.appendChild(C),C},j=A("g",{class:"ec-overlay","aria-hidden":"true"});$e(j,{"pointer-events":"none"});let Q=A("g",{class:"ec-halos"},j),ue=A("g",{class:"ec-runs"},j),be=zr(j),ve=m=>k.get(m)??H.get(m),je=ln({overlay:ue,mark:m=>({set:b=>ve(m)?.handle.set(b),reset:()=>ve(m)?.handle.reset()}),colors:m=>ve(m)?.mark.parts[0]?.colors}),Oe=on({effects:o,motion:r,icons:n.icons,clock:a,surface:je}),Pe=m=>({mark:m.mark.geometry,data:m.mark.data});function Ce(m){let b={key:m.key,mark:m,handle:vs(()=>b.mark.parts.filter(S=>(_.get(S.element)?.record??b)===b),s,()=>Q)};return b}function Ae(m){m.root&&m.root!==E&&wt(m.root),U=m.ancestor??U;let b=new Set(m.marks.map(N=>N.key)),S={entering:[],exiting:[],changed:[],moved:[]},C=[];for(let N of T)b.has(N.key)||(k.delete(N.key),H.set(N.key,N),S.exiting.push(N));let B=_;_=new Map,T=m.marks.map(N=>{let ee=k.get(N.key);if(ee){let ce=ee.mark;(t.value?Td(ce.parts,N.parts):Rd(ce.geometry,N.geometry))?S.changed.push({record:ee,from:ce.geometry}):(Ld(ce.geometry,N.geometry)||ce.data.datum!==N.data.datum||Cd(ce.data.samples,N.data.samples))&&S.moved.push(ee),ce.parts[0]?.colors?.color!==N.parts[0]?.colors?.color&&C.push(N.key),ee.mark=N}else ee=H.get(N.key),ee?(H.delete(N.key),ee.mark=N):ee=Ce(N),k.set(N.key,ee),S.entering.push(ee);for(let ce of N.parts)_.set(ce.element,{record:ee,part:ce});return ee});for(let[N,ee]of B)_.get(N)?.record!==ee.record&&s.restore(N);for(let N of T)_e(N);dt(),ut(),Rt();for(let N of T)N.handle.repaint();for(let N of C)je.recolor(N);return vt(),S}function _e(m){if(!t.markLabel)return;let{label:b,parts:S}=m.mark;S.forEach((C,B)=>{let N=b!==void 0&&B===0;s.attribute(C.element,"role",N?"img":null),s.attribute(C.element,"aria-label",N?b:null),N?s.remove(C.element,"aria-hidden"):s.attribute(C.element,"aria-hidden",b===void 0?null:"true")})}function dt(){let m=E,b=new Set;for(let S of t.markLabel&&m?T:[])if(S.mark.label!==void 0)for(let C of S.mark.parts)for(let B=C.element.parentElement;B&&B!==m&&m?.contains(B);B=B.parentElement){if(b.has(B)||B.hasAttribute("aria-label")||B.hasAttribute("aria-labelledby"))continue;let N=B.getAttribute("role")?.trim().split(/\s+/)[0];(N!==void 0&&bd.has(N)||N===void 0&&te.has(B))&&b.add(B)}for(let S of te)b.has(S)||(s.attribute(S,"role",null),s.attribute(S,"aria-roledescription",null));for(let S of b)s.remove(S,"role"),s.remove(S,"aria-roledescription");te=b}function ut(){if(!E||!U)return;E.lastElementChild!==j&&E.appendChild(j),j.removeAttribute("transform");let m=Xt(j,U,E);Dd(m)||j.setAttribute("transform",pt(m))}function wt(m){me(),E=m,E.appendChild(j),(t.keyboard===!0||t.markLabel)&&E.getAttribute("role")==="img"&&!u&&(u=!0,console.warn('expressive: the <svg> is role="img", so screen readers read it as one picture and skip the marks inside, with their names and keyboard focus. Make it role="group"; its aria-label can stay.')),se=Kr(E,{find(b){let S=Ge(b);if(!S)return;let{key:C}=S.record;return S.part.series===void 0?{key:C}:{key:C,segment:S.part.series}},hover(b,S){let C=k.get(b.key);!C||zt(z)&&z.keys[0]===b.key||(Ke(),ft([C],S,b.segment))},leave(){(z?.source==="pointer"||z?.source==="touch")&&Ke()}})}function me(){E&&(Ke(),se?.destroy(),se=void 0)}function Ge(m){for(let b=m;b&&b!==E;b=b.parentElement){let S=_.get(b);if(S)return S}}function ft(m,b,S,C=!0){let B={keys:m.map(N=>N.key),source:b,effects:C};z=B,Rt(),C&&Oe.hover(m.map(Pe)),m.forEach((N,ee)=>pe("hover",{...Pe(N),batch:{index:ee,count:m.length},source:b,...S===void 0?{}:{segment:S}})),b!=="linked"&&z===B&&de?.hover(m.map(Pe))}function Ke(){let m=z;m&&(z=void 0,Rt(),Dt(m.keys),zt(m)&&de?.leave())}function Dt(m){let b=m.flatMap(S=>ve(S)??[]);Oe.leave(m),b.forEach((S,C)=>pe("leave",{...Pe(S),batch:{index:C,count:b.length}}))}function Tt(){if(z===void 0)return;let m=z.keys.filter(S=>k.has(S));if(m.length===z.keys.length)return;if(m.length===0){se?.clear(),Ke();return}let b=z.keys.filter(S=>!k.has(S));z={...z,keys:m},Dt(b)}function Rt(){if(!i)return;let m=`${r.duration(100,"feedback")}ms`;for(let b of T){let S=z?.keys.includes(b.key)===!0;for(let C of b.mark.parts)s.toggleClass(C.element,"ec-attached",!0),s.toggleClass(C.element,"ec-dimmed",z!==void 0&&!S),s.style(C.element,"--ec-hover-duration",m);b.handle.hot(S)}for(let b of H.values())b.handle.hot(!1)}let st=i?r.subscribe(Rt):void 0,Ct=new Set(Ht.flatMap(m=>{let b=o[m];return b?.kind==="data"?b.needs?.related??[]:[]}));function vt(){let m=Z===void 0?void 0:k.get(Z);be.draw(m?.mark.geometry)}let Lt=t.keyboard===!0?Ur(()=>E,{find:m=>Ge(m)?.record.key,order:()=>T.map(m=>m.key),element:m=>k.get(m)?.mark.parts[0]?.element,tabIndex(m,b){let S=k.get(m);!S||b===void 0||S.mark.parts.forEach((C,B)=>{s.attribute(C.element,"tabindex",B===0?b:"-1"),s.style(C.element,"outline","none")})},focus(m,b){Z=b?m:void 0,vt();let S=k.get(m);if(S){if(!b){z?.source==="keyboard"&&z.keys[0]!==m&&Ke();return}if(zt(z)&&z.keys[0]===m){z={...z,source:"keyboard"};return}Ke(),ft([S],"keyboard")}},blur(){Z=void 0,vt(),z?.source==="keyboard"&&(se?.current===z.keys[0]?z={...z,source:"pointer"}:Ke())},escape(){return z?(z.source==="linked"&&de?de.dismiss():Ke(),!0):!1}}):void 0,Ne=t.watch===!0?Es(g,a,Pt):void 0;function Qe(){Ne?.observe(T.flatMap(m=>m.mark.parts.map(b=>b.element)),E)}function Pt(m){if(we||!U)return;let b=new Set;for(let ee of m.marks){let ce=_.get(ee)?.record;ce&&b.add(ce)}let S=!1;for(let ee of m.ancestors)if(ee.contains(U))S=!0;else for(let ce of T)ce.mark.parts.some(K=>ee.contains(K.element))&&b.add(ce);if(S&&ut(),b.size===0)return;let{records:C,marks:B}=Qt([...b]);C.forEach((ee,ce)=>{let K=B[ce];ee.mark=K;for(let ye of K.parts)_.set(ye.element,{record:ee,part:ye});ee.handle.repaint()}),T=W(T),C.some(ee=>ee.key===Z)&&vt();let N=new Set(C);if(C.some(ee=>Ct.has(ee.mark.geometry.series??"")))for(let ee of T)N.add(ee);for(let ee of N)Oe.change(ee.mark.geometry,ee.mark.data)}function Qt(m){let b={svg:E,common:U,screen:Sr(),colors:K=>_.get(K)?.part.colors},S=M(),C=({parts:K})=>K.map(ye=>({element:ye.element,datum:S(ye.element),series:ye.series,value:ye.value}));if(t.geometry){let K=m.map(({mark:ye})=>({...h(ye.key,C(ye),ye.index,b),label:ye.label}));return{records:[...m],marks:F(K)}}let B=new Map(m.map(K=>[K,C(K.mark).map(ye=>w(K.key,ye,b))])),N=Ue(B);for(let K of T)!B.has(K)&&N.get(K)!==K.mark.rect.edge&&B.set(K,C(K.mark).map(ye=>w(K.key,ye,b)));let ee=[...B.keys()],ce=ee.map(K=>({...v(K.key,B.get(K),N.get(K),K.mark.index,b),label:K.mark.label}));return{records:ee,marks:F(ce)}}function Ue(m){let b=new Map(T.map(C=>[C,C.mark.rect.edge]));if(t.baseline!==void 0&&t.baseline!=="auto")return b;let S=T.map(C=>{let B=m.get(C);return B?xn(B.map(N=>N.rect.box)):C.mark.rect.box});try{let C=xr(S,"auto");return new Map(T.map((B,N)=>[B,C[N]]))}catch{return b}}function M(){if(t.datum)return t.datum;let m=xs(d);return b=>m?.has(b)?m.get(b):V(b,0,void 0)}function W(m){let b=[...m].sort((B,N)=>B.mark.index-N.mark.index);if(t.geometry)return[...Ts(b,B=>B.mark.geometry)];let S=b.map(B=>B.mark.rect.box),C=b.map(B=>B.mark.rect.edge);return Mr(S,C).map(B=>b[B])}function oe(m,b){return T.find(S=>S.key!==b&&S.mark.geometry.series===m)?.mark.data}function pe(m,b){for(let S of[...ae[m]])try{S(b)}catch(C){Se(C)}}function p(m,b){b.forEach((S,C)=>pe(m,{...Pe(S),batch:{index:C,count:b.length}}))}return Oe.enter(Ae(G).entering.map(Pe)),Lt?.sync(),Qe(),_t({targets:()=>T.map(m=>({key:m.key,marks:[Pe(m)]})),hover(m,b){Ke();let S=m.flatMap(C=>k.get(C)??[]);S.length>0&&ft(S,"linked",void 0,b)},unlink(){z?.source==="linked"&&Ke()},leave(){se?.clear(),Ke()},listen(m){return we?!1:(de=m,!0)}},{refresh(m){if(we)return;let b=f(m??d);m!==void 0&&(d=m),Oe.interrupt();let S=Ae(b);Qe(),Tt();let C=Oe.exit(S.exiting.map(Pe));p("exit",S.exiting),Oe.update(S.changed.map(({record:N,from:ee})=>({...Pe(N),from:ee}))),S.changed.forEach(({record:N,from:ee},ce)=>pe("update",{...Pe(N),from:ee,batch:{index:ce,count:S.changed.length}})),Oe.enter(S.entering.map(Pe)),p("enter",S.entering);let B=new Set([...S.changed.map(N=>N.record),...S.moved]);if([...B,...S.entering,...S.exiting].some(N=>Ct.has(N.mark.geometry.series??""))){let N=new Set(S.entering);for(let ee of T)N.has(ee)||B.add(ee)}for(let N of B)Oe.change(N.mark.geometry,N.mark.data);Oe.settle(),Lt?.sync(),C.then(()=>{for(let N of S.exiting)H.get(N.key)===N&&H.delete(N.key)})},on(m,b){let S=ae[m];if(!S)throw new TypeError(`expressive: unknown event "${String(m)}". Use one of: ${Object.keys(ae).join(", ")}.`);return S.add(b),()=>{S.delete(b)}},marks:()=>T.map(m=>m.mark.geometry),focus(m){k.has(m)&&!we&&Lt?.focus(m)},destroy(){if(!we){we=!0,z=void 0,de?.gone(),de=void 0,Ne?.destroy(),Oe.destroy(),st?.(),Lt?.destroy(),me(),j.remove(),s.restoreAll();for(let m of Object.values(ae))m.clear();k.clear(),H.clear(),T=[],_=new Map}}})}function wd(e){if(typeof e!="object"||e===null)throw new TypeError("expressive needs options, with at least a key: { key: (d) => d.name }.");if(typeof e.key!="function")throw new TypeError("expressive needs a key function, for example key: (d) => d.name. Marks are matched by key.");for(let t of["datum","segment","value","geometry","markLabel"])if(e[t]!==void 0&&typeof e[t]!="function")throw new TypeError(`expressive: ${t} must be a function.`);if(e.baseline!==void 0&&e.baseline!=="auto"&&!fs(e.baseline))throw new RangeError(`expressive: baseline must be "left", "right", "top", "bottom" or "auto", got ${String(e.baseline)}.`)}function Ds(e){let t=[...(e.geometry.segments??[]).map(n=>n.series),...e.parts.map(n=>n.series)];return[...new Set(t.filter(n=>n!==void 0))]}function vd(e){let t=0;for(let{value:n}of e){if(typeof n!="number"||!Number.isFinite(n))return;t+=n}return t}function kd(e,t,n){let r=a=>e.length>0?n*a/e.length:0;if(t===e)return[{t:0,value:0},{t:1,value:n}];let o=Rs(e.start,t.start);return[{t:0,value:r(o)},{t:1,value:r(o+t.length)}]}function xd(e,t){if(!Array.isArray(e))throw new TypeError(`expressive: samples for ${t} must return an array of { t, value }, got ${va(e)}.`);let n=0;return e.map((r,o)=>{let{t:a,value:i,at:s}=typeof r=="object"&&r!==null?r:{};if(typeof a!="number"||!(a>=0&&a<=1))throw new RangeError(`expressive: samples for ${t}: samples[${o}].t must be in [0, 1], got ${va(a)}.`);if(a<n)throw new RangeError(`expressive: samples for ${t} must be in t order: samples[${o}].t is ${a}, after ${n}.`);if(typeof i!="number"||!Number.isFinite(i))throw new RangeError(`expressive: samples for ${t}: samples[${o}].value must be a finite number, got ${va(i)}.`);return n=a,s===void 0?{t:a,value:i}:{t:a,value:i,at:s}})}function va(e){return typeof e=="string"?JSON.stringify(e):String(e)}function Ts(e,t){let n=e[0]&&t(e[0]).pivot;if(!n||!e.every(a=>Rs(t(a).pivot,n)<=.5&&kr(t(a))))return e;let r=2*Math.PI,o=a=>{let{center:i}=t(a),s=Math.atan2(i.x-n.x,n.y-i.y),c=s<0?s+r:s;return c>=r?0:c};return e.map(a=>({mark:a,angle:o(a)})).sort((a,i)=>a.angle-i.angle).map(({mark:a})=>a)}function Rs(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function Md(e,t,n){let r=t===void 0?void 0:e.segments?.find(a=>a.series===t),o=r??(n===1?e:void 0);if(!(!o||r&&r.length<.5))return o.outline.closed?{d:o.outline.d}:{d:o.outline.d,stroke:o.thickness}}function Sd(e){let t=Number.parseFloat(e.getAttribute("rx")??""),n=Number.parseFloat(e.getAttribute("ry")??""),r=Number.isFinite(t)?t:n;return Number.isFinite(r)&&r>0?r:0}function Ed(e){try{return Dn(e)}catch{return}}function Dd(e){return Math.abs(e[0]-1)<1e-9&&Math.abs(e[1])<1e-9&&Math.abs(e[2])<1e-9&&Math.abs(e[3]-1)<1e-9&&Math.abs(e[4])<1e-6&&Math.abs(e[5])<1e-6}function Td(e,t){if(e.length!==t.length)return!0;let n=new Map(e.map(r=>[r.series,r.value]));return t.some(r=>{let o=n.get(r.series);return!n.has(r.series)||!(o===r.value||Object.is(o,r.value))})}function Rd(e,t){let n=e.segments??[],r=t.segments??[];return Math.abs(e.length-t.length)>.01||n.length!==r.length?!0:n.some((o,a)=>o.key!==r[a].key||Math.abs(o.length-r[a].length)>.01)}function Cd(e,t){let n=(r,o)=>r===o||r instanceof Date&&o instanceof Date&&r.getTime()===o.getTime();return e.length!==t.length||e.some((r,o)=>r.t!==t[o].t||r.value!==t[o].value||!n(r.at,t[o].at))}function Ld(e,t){if(e.outline.d!==t.outline.d||e.thickness!==t.thickness||Ko(e,t))return!0;let n=e.segments??[],r=t.segments??[];return n.length!==r.length||n.some((o,a)=>o.key!==r[a].key||o.outline.d!==r[a].outline.d)}var Pd=["line","rect","arc","symbol"],Od=["d","transform","x","y","width","height","stroke-width"];function lo(e,t,n){if(Ad(e),typeof t!="object"||t===null||typeof t.key!="function")throw new TypeError("fromVegaView needs options with a key: { key: (d) => d.series }. Marks are matched by key.");let r=t.mark??"marks";if(typeof r!="string"||r==="")throw new TypeError(`fromVegaView: mark must be a mark's name, got ${String(r)}.`);if(t.sample!==void 0&&typeof t.sample!="function")throw new TypeError("fromVegaView: sample must be a function.");let o=v(),{mark:a,sample:i,...s}=t,c=er(o.elements,{...s,datum:g=>w(g).datum,geometry:(g,E,U)=>{let k=o.geometry.get(U);if(!k)throw new TypeError(`fromVegaView: no geometry for "${U}". Its key must be the same for every item of a mark.`);return k},...t.samples||!t.sample?{}:{samples:(g,E)=>o.samples.get(E)??[]},...t.value||!t.sample?{}:{value:(g,E)=>o.values.get(E)}},n),d=n.clock??Fe,l,u,f=!1,h=typeof MutationObserver=="function"?new MutationObserver(g=>g.some(x)&&R()):void 0;O(o.root);function w(g){let E=o.items.get(g);if(!E)throw new TypeError("fromVegaView: an element that isn't one of the View's items.");return E}function v(){let g=$d(Cs(e),r),E=Gd(g,r,e),U=e.container(),k=U?.localName==="svg"?U:U?.querySelector("svg"),T={root:k??void 0,elements:[],items:new Map,geometry:new Map,samples:new Map,values:new Map};if(!E||!k)return T;let H=new Set(E==="line"?g.flatMap(j=>j.items?.length?[j.items[0]]:[]):g.flatMap(j=>j.items??[])),_=new Map;for(let j of Array.from(k.querySelectorAll("*"))){let Q=j.__data__;H.has(Q)&&_.set(j,Q)}let te=[..._.keys()];if(te.length===0)return T;let ae=so(te),z=co(te,ae),Z=Sr(),se=j=>Xt(z,j.parentElement??ae,ae,Z),de=j=>String(t.key(_.get(j).datum,j)),we=j=>t.segment?String(t.segment(_.get(j).datum,j)):void 0,A={root:ae,items:_,elements:te,geometry:new Map,samples:new Map,values:new Map};if(t.sample)for(let[j,Q]of _){let ue=E==="line"?ka(Q).map(be=>be.item):[Q];A.values.set(j,ue.map(be=>F(be).value).join(","))}if(E==="rect")return D(A,se,de,we);for(let j of te){let Q=_.get(j),ue=de(j);if(A.geometry.has(ue))continue;let be=se(j),ve=E==="line"?Vd(ue,j,Q,be):E==="arc"?Nd(ue,Q,be):Fd(ue,Q,be);A.geometry.set(ue,ve),t.sample&&A.samples.set(ve,E==="line"?P(ve,Q,be):V(ve,Q,E))}return A}function D(g,E,U,k){let T=new Map;for(let z of g.elements){let Z=g.items.get(z),se=U(z),de={box:Qn(E(z),Bd(Z)),series:k(z),radius:Math.max(0,Z.cornerRadius??0)},we=T.get(se);we?we.push({element:z,part:de}):T.set(se,[{element:z,part:de}])}let H=[...T.keys()],_=H.map(z=>xn(T.get(z).map(Z=>Z.part.box))),te=xr(_,t.baseline??"auto"),ae=[];for(let z of Mr(_,te)){let Z=H[z],se=T.get(Z),{geometry:de,order:we}=io(Z,se.map(A=>A.part),te[z]);if(g.geometry.set(Z,de),ae.push(...we.map(A=>se[A].element)),t.sample){let A=we.map(ue=>F(g.items.get(se[ue].element)).value),j=A.reduce((ue,be)=>ue+be,0);g.samples.set(de,[{t:0,value:0},{t:1,value:j}]);let Q=0;(de.segments??[]).forEach((ue,be)=>{let ve=Q;Q+=A[be]??0,g.samples.set(ue,[{t:0,value:ve},{t:1,value:Q}])})}}return{...g,elements:ae}}function F(g){let E=t.sample(g.datum),U=typeof E=="number"?{value:E}:E;if(typeof U!="object"||U===null||!Number.isFinite(U.value))throw new RangeError(`fromVegaView: sample must give a finite number, or { value, at }, got ${JSON.stringify(E)}.`);return U.at===void 0?{value:U.value}:{value:U.value,at:U.at}}function P(g,E,U){return dr(g,ka(E).map(({item:k,point:T})=>({...xe.apply(U,T),...F(k)})))}function V(g,E,U){let{value:k,at:T}=F(E),H=T===void 0?{t:1,value:k}:{t:1,value:k,at:T};return U==="symbol"?[{...H,t:0}]:g.length>0?[{t:0,value:0},H]:[{...H,t:0}]}function x(g){let E=l?.querySelector(":scope > .ec-overlay"),U=k=>k===E||(E?.contains(k)??!1);return U(g.target)?!1:g.type==="childList"?[...Array.from(g.addedNodes),...Array.from(g.removedNodes)].some(k=>!U(k)):!0}function R(){if(u||f)return;let g=d.onFrame(()=>{g(),u=void 0;try{G()}catch(E){Se(E)}});u=g}function O(g){!h||g===l||(h.disconnect(),l=g,g&&h.observe(g,{subtree:!0,childList:!0,attributes:!0,attributeFilter:Od}))}function G(){if(f)return;let g=v(),E=o;o=g;try{c.refresh(g.elements)}catch(U){throw o=E,U}O(g.root)}return _t(wi(c),{refresh:G,on:c.on,marks:c.marks,focus:c.focus,destroy(){f||(f=!0,h?.disconnect(),u?.(),u=void 0,c.destroy())}})}function Ad(e){if(typeof e!="object"||e===null||typeof e.renderer!="function"||typeof e.scenegraph!="function"||typeof e.container!="function")throw new TypeError(`fromVegaView needs a Vega View: new vega.View(runtime, { renderer: "svg", container }), or vega-embed's result.view.`);let t=e.renderer();if(t!=="svg")throw new TypeError(`fromVegaView: the View renders with "${t}", which draws no SVG elements to attach to. Use renderer: "svg" (vega-embed's default; a bare vega.View uses canvas).`)}function Cs(e){let t=e.scenegraph();return t.root??t}function $d(e,t){let n=[],r=o=>{if(o.name===t&&o.marktype!=="group"&&n.push(o),o.marktype==="group")for(let a of o.items??[])for(let i of a.items??[])r(i)};return r(e),n}function Gd(e,t,n){if(e.length===0){let o=Id(Cs(n));if(o.length===0)return;throw new RangeError(`fromVegaView: the View has no mark named "${t}". Its named marks: ${o.map(a=>`"${a}"`).join(", ")}.`)}let r=e[0].marktype;if(!e.every(o=>o.marktype===r)||!Pd.includes(r))throw new TypeError(`fromVegaView: "${t}" is a ${String(r)} mark. Rects, arcs, symbols and lines can be read; describe others with expressive()'s geometry option.`);return r}function Id(e){let t=new Set,n=r=>{r.name&&r.marktype!=="group"&&t.add(r.name);for(let o of r.items??[])for(let a of o.items??[])n(a)};return n(e),[...t]}function ka(e){let t=e.mark?.items??[e],n=t[0]?.interpolate;if(n!==void 0&&n!=="linear")throw new TypeError(`fromVegaView: a line is drawn with interpolate "${n}", but only straight lines can be read. Use interpolate "linear" (the default), or describe the curve with expressive()'s geometry option.`);if(t.some(r=>r.defined===!1))throw new TypeError("fromVegaView: a line has a gap (a point with defined: false). Lines with gaps can't be read yet.");return t.map(r=>({item:r,point:{x:bt(r.x),y:bt(r.y)}}))}function Vd(e,t,n,r){let o=n.strokeWidth??Number.parseFloat(t.getAttribute("stroke-width")??"1");return Ye.line({key:e,series:e,points:ka(n).map(({point:a})=>xe.apply(r,a)),width:(Number.isFinite(o)?o:1)*xa(r)})}function Nd(e,t,n){let r=xe.apply(n,{x:bt(t.x),y:bt(t.y)}),o=xa(n),[a,i]=[bt(t.startAngle),bt(t.endAngle)].sort((s,c)=>s-c);return Ye.arc({key:e,cx:r.x,cy:r.y,inner:bt(t.innerRadius)*o,outer:bt(t.outerRadius)*o,start:a,end:i})}function Fd(e,t,n){let r=xe.apply(n,{x:bt(t.x),y:bt(t.y)});return Ye.point({key:e,x:r.x,y:r.y,r:Math.sqrt(Math.max(0,t.size??64)/Math.PI)*xa(n)})}function Bd(e){let t=bt(e.x),n=bt(e.y),r=bt(e.width),o=bt(e.height);return{x:Math.min(t,t+r),y:Math.min(n,n+o),width:Math.abs(r),height:Math.abs(o)}}function xa(e){return Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]))}function bt(e){return typeof e=="number"&&Number.isFinite(e)?e:0}var Hd={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},Ma=/[\s,]*([A-Za-z]|[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?)/y,Ls=/^[A-Za-z]$/;function uo(e){let t=[];Ma.lastIndex=0;for(let c=Ma.exec(e);c;c=Ma.exec(e))t.push(c[1]);let n=[],r={x:0,y:0},o=r,a,i="",s=0;for(;s<t.length;){if(Ls.test(t[s]))i=t[s++];else if(i===""||i==="Z"||i==="z")break;let c=i.toUpperCase();if(c==="Z"){n.push({op:"Z",to:o}),r=o,a=void 0;continue}let d=Hd[c];if(d===void 0)break;let l=[],u=!1;for(;l.length<d&&s<t.length&&!Ls.test(t[s]);){let O=t[s];if(c==="A"&&(l.length===3||l.length===4)){let G=O[0];if(G!=="0"&&G!=="1"){u=!0;break}l.push(Number(G)),O.length>1?t[s]=O.slice(1):s++;continue}l.push(Number(O)),s++}if(u||l.length<d||!l.every(Number.isFinite))break;let f=i!==c,h=(O,G)=>f?{x:r.x+O,y:r.y+G}:{x:O,y:G},[w=0,v=0,D=0,F=0,P=0,V=0,x=0]=l,R;switch(c){case"M":r=o=h(w,v),n.push({op:"M",to:r}),i=f?"l":"L";break;case"L":n.push({op:"L",to:r=h(w,v)});break;case"H":n.push({op:"L",to:r={x:f?r.x+w:w,y:r.y}});break;case"V":n.push({op:"L",to:r={x:r.x,y:f?r.y+w:w}});break;case"C":case"S":{let O=c==="S",G=O?a&&Ps(n,"C")?Os(a,r):r:h(w,v);R=O?h(w,v):h(D,F),n.push({op:"C",c1:G,c2:R,to:r=O?h(D,F):h(P,V)});break}case"Q":case"T":{let O=c==="T";R=O?a&&Ps(n,"Q")?Os(a,r):r:h(w,v),n.push({op:"Q",c:R,to:r=O?h(w,v):h(D,F)});break}case"A":n.push({op:"A",rx:Math.abs(w),ry:Math.abs(v),rotation:D,large:F!==0,sweep:P!==0,to:r=h(V,x)});break}a=R}return n}var Ps=(e,t)=>e[e.length-1]?.op===t,Os=(e,t)=>({x:2*t.x-e.x,y:2*t.y-e.y});function fo(e,t){let n=o=>({x:t[0]*o.x+t[2]*o.y+t[4],y:t[1]*o.x+t[3]*o.y+t[5]}),r=t[0]*t[3]-t[1]*t[2]<0;return e.map(o=>{switch(o.op){case"M":case"L":case"Z":return{op:o.op,to:n(o.to)};case"C":return{op:"C",c1:n(o.c1),c2:n(o.c2),to:n(o.to)};case"Q":return{op:"Q",c:n(o.c),to:n(o.to)};case"A":return{...o,...jd(o,t),sweep:r!==o.sweep,to:n(o.to)}}})}function jd({rx:e,ry:t,rotation:n},r){let o=n*Math.PI/180,a=Math.cos(o),i=Math.sin(o),s=(r[0]*a+r[2]*i)*e,c=(r[2]*a-r[0]*i)*t,d=(r[1]*a+r[3]*i)*e,l=(r[3]*a-r[1]*i)*t,u=s*s+c*c,f=s*d+c*l,h=d*d+l*l,w=(u+h)/2,v=Math.hypot((u-h)/2,f),D=w+v,F=Math.abs(f)<1e-12?u>=h?0:Math.PI/2:Math.atan2(D-u,f);return{rx:Math.sqrt(D),ry:Math.sqrt(Math.max(0,w-v)),rotation:F*180/Math.PI}}function mo(e){let t=Ze,n=r=>`${t(r.x)},${t(r.y)}`;return e.map(r=>{switch(r.op){case"M":case"L":return`${r.op}${n(r.to)}`;case"C":return`C${n(r.c1)} ${n(r.c2)} ${n(r.to)}`;case"Q":return`Q${n(r.c)} ${n(r.to)}`;case"A":return`A${t(r.rx)},${t(r.ry)} ${t(r.rotation)} ${r.large?1:0} ${r.sweep?1:0} ${n(r.to)}`;case"Z":return"Z"}}).join("")}var zd={get:()=>{}},_d={set(){},reset(){}},Sa={place(){},update(){},remove(){}};function As(e,t){let{effect:n,surface:r}=t;if(!Ea(n))throw new TypeError(`playTransition needs a transition effect (kind "transition" with run, end and clear), got ${Kd(n)}.`);let o=t.start??0;if(!(typeof o=="number"&&o>=0&&o<=1))throw new RangeError(`playTransition: start must be a number from 0 to 1, got ${String(o)}.`);let a=t.motion??kt,i=t.clock??Fe,s=t.icons??zd,c=e.length,d=[],l=!1,u=c,f,h=new Promise(G=>{f=G}),w=c>0?a.subscribe(()=>{a.mode==="off"&&R()}):void 0,v=()=>{--u>0||(w?.(),w=void 0,f())};function D(G,g,E){let U=Oo({clock:i,motion:a,icons:s,batch:{index:g,count:c},layer:O(G.to.key,g,()=>k.state!=="cleared"),mark:_d}),k={pair:G,index:g,scope:U,context:{...U.context,start:o},state:"running",done:E};d[g]=k;let{from:T,to:H}=G;try{a.mode==="off"?(n.end(T,H,k.context),F(k)):Promise.resolve(n.run(T,H,k.context)).then(()=>F(k),_=>P(k,_))}catch(_){P(k,_)}}function F(G){G.state==="running"&&(G.state="ended",V(G))}function P(G,g){let{signal:E}=G.context;E.aborted&&(g===E.reason||g?.name==="AbortError")||(Se(g),x(G))}function V(G){let g=G.done;G.done=void 0,g?.()}function x(G){if(G.state!=="cleared"){G.state="cleared",G.scope.abort();try{n.clear(G.context)}catch(g){Se(g)}G.scope.clear(),V(G)}}function R(){for(let G of[...d]){if(G.state!=="running")continue;let g=G.done;G.done=void 0,x(G),D(G.pair,G.index,g)}}function O(G,g,E){let U,k=()=>E()?U??(U=r.group(G,g)):void 0;return{icon:(T,H)=>k()?.icon(T,H)??Sa,path:(T,H)=>k()?.path(T,H)??Sa,text:(T,H)=>k()?.text(T,H)??Sa,clear(){let T=U;U=void 0,T?.clear()}}}return e.forEach((G,g)=>D(G,g,v)),c===0&&f(),{finished:h,clear(){if(!l){l=!0;for(let G of[...d])x(G)}}}}function Ea(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.kind==="transition"&&typeof t.run=="function"&&typeof t.end=="function"&&typeof t.clear=="function"}function Kd(e){if(typeof e!="object"||e===null)return e===null?"null":typeof e;let t=e.kind;return t==="geometry"||t==="data"?`a ${t} effect, which plays on one mark: put it in a chart's \`on\` option`:t==="transition"?"a transition effect without run(), end() and clear()":t===void 0?"an object with no kind":`an effect of kind ${JSON.stringify(t)}`}var Ud=950,Wd=.4,tr=.5;function Ra(e,t,n){let r=un(e,"chartSwitch"),o=Qd(t),a=t.transition,i=$t(t.colors),s=n.motion,c=n.clock??Fe,d=r.ownerDocument;gt(d);let l=d.createElement("div");l.className="ec-switch",r.appendChild(l);let u=new Map;try{for(let A of o){let j=d.createElement("div");j.className="ec-switch-view",j.setAttribute("data-view",A),l.appendChild(j),Da(j,A===t.initial);let Q=t.views[A](j,i);if(!Xd(Q,j))throw Q?.destroy?.(),new TypeError(`chartSwitch: views.${A} must return the chart it draws in the container it's given (with element, marks(), labels(), focus(), leave() and destroy()), such as donutChart(container, { ... }).`);u.set(A,{name:A,container:j,chart:Q})}}catch(A){for(let j of u.values())j.chart.destroy();throw l.remove(),A}let f=Y("svg",{class:"ec-chart ec-switch-overlay","aria-hidden":"true"},l),h=Y("g",{class:"ec-switch-fades"},f),w=Y("g",{class:"ec-switch-runs"},f),v=Y("g",{class:"ec-switch-labels"},f),D=t.announce?Ot(f):void 0,F=new WeakMap,P={group(A,j){let Q=Y("g",{class:"ec-run","data-key":A},w);$e(Q,ht(at(i.slot(A)))),F.set(Q,j);let ue=Array.from(w.children).find(be=>(F.get(be)??-1/0)>j);return w.insertBefore(Q,ue??null),{...pr(Q),clear:()=>Q.remove()}}},V=t.initial,x,R=!1,O=s.subscribe(()=>{s.mode==="off"&&x&&z(x,!0)}),G,g=typeof ResizeObserver=="function"?new ResizeObserver(A=>{let j=A[A.length-1]?.contentRect.width??0;if(G!==void 0&&Math.abs(j-G)<.5)return;let Q=G===void 0;G=j,!Q&&x&&z(x,!0)}):void 0;g?.observe(l);let E=A=>u.get(A);function U(){return l.getRootNode().activeElement??null}function k(A){let j=U();if(!j||!A.container.contains(j))return;let Q=j.closest("[data-key]");return{key:Q&&A.chart.element.contains(Q)?Q.getAttribute("data-key")??void 0:void 0}}function T(A,j){if(!j)return;let Q=U();if(Q&&Q!==d.body&&Q!==d.documentElement&&!l.contains(Q))return;let ue=()=>A.chart.element.contains(U());if(j.key!==void 0&&A.chart.focus(j.key),!ue()){for(let be of A.chart.marks())if(A.chart.focus(be.key),ue())return}}function H(A){D?.say(A.chart.element.getAttribute("aria-label")??"")}function _(A,j,Q){V=j.name;let ue=Q?Q.focus:k(A);if(A.chart.leave(),s.mode==="off"){for(let Ce of u.values())Da(Ce.container,Ce===j);return T(j,ue),H(j),Promise.resolve()}for(let Ce of[A,j])Ce.container.classList.remove("ec-switch-inactive"),Ce.container.classList.add("ec-switching"),Ce.container.setAttribute("inert",""),Ce.chart.element.classList.add("ec-morphing");let{pairs:be,scene:ve}=Z(A,j),{done:je,settle:Oe}=Fs(),Pe={a:A,b:j,forward:!0,pairs:be,reversed:be.map(({from:Ce,to:Ae})=>({from:Ae,to:Ce})),scene:ve,focus:ue,progress:0,transition:void 0,driver:void 0,run:0,done:je,settle:Oe};return x=Pe,te(Pe,0),Pe.done}function te(A,j){let Q=++A.run;if(j>=1){z(A,!0);return}let ue=ve=>{A.progress=ve,A.scene.draw(A.forward?ve:1-ve)},be=qd(c);A.transition=As(A.forward?A.pairs:A.reversed,{effect:a,surface:P,start:j,motion:s,clock:be.clock,icons:n.icons}),A.driver=Zd(j,ue,{clock:be.clock,motion:s}),be.release(),Promise.all([A.driver.finished,A.transition.finished]).then(([ve])=>{x===A&&A.run===Q&&ve==="done"&&z(A,!0)})}function ae(A){return A.driver?.cancel(),A.transition?.clear(),A.forward=!A.forward,V=(A.forward?A.b:A.a).name,A.settle(),{done:A.done,settle:A.settle}=Fs(),te(A,1-A.progress),A.done}function z(A,j){if(x!==A)return;x=void 0,A.run++,A.driver?.cancel(),A.transition?.clear(),A.scene.clear();let Q=A.forward?A.b:A.a;for(let ue of[A.a,A.b])ue.chart.element.classList.remove("ec-morphing"),ue.container.classList.remove("ec-switching"),ue.container.style.removeProperty("opacity");for(let ue of u.values())Da(ue.container,ue===Q);j&&(T(Q,A.focus),H(Q)),A.settle()}function Z(A,j){let Q=Xt(f,A.chart.element,l),ue=Xt(f,j.chart.element,l),be=A.chart.marks().map(me=>Ta(me,Q)),ve=j.chart.marks().map(me=>Ta(me,ue)),je=new Map(be.map(me=>[me.key,me])),Oe=new Set(ve.map(me=>me.key)),Pe=ve.flatMap(me=>{let Ge=je.get(me.key);return Ge?[{from:Ge,to:me}]:[]}),Ce=[];for(let me of be)Oe.has(me.key)||Ce.push(se(me,Is));for(let me of ve)je.has(me.key)||Ce.push(se(me,Vs));let Ae=me=>`${me.role}
|
|
92
|
-
${me.key}`,_e=A.chart.labels(),dt=j.chart.labels(),ut=new Map(_e.map(me=>[Ae(me),me])),wt=new Set;for(let me of dt){let Ge=ut.get(Ae(me));Ge&&(wt.add(Ae(me)),Ce.push(Jd(de(Ge,Q),de(me,ue))))}for(let me of _e)wt.has(Ae(me))||Ce.push(Gs(de(me,Q),Is));for(let me of dt)ut.has(Ae(me))||Ce.push(Gs(de(me,ue),Vs));return Ce.push(me=>{$s(A.container,1-yo(me/Wd)),$s(j.container,yo((me-tr)/(1-tr)))}),{pairs:Pe,scene:{draw:me=>{for(let Ge of Ce)Ge(me)},clear:()=>{h.replaceChildren(),w.replaceChildren(),v.replaceChildren()}}}}function se(A,j){let Q=Y("g",{class:"ec-switch-fade","data-key":A.key},h);return $e(Q,ht(at(i.slot(A.key)))),pr(Q).path(A.outline.d,A.outline.closed?{fill:"mark"}:{stroke:"mark",width:A.thickness}),ue=>le(Q,{opacity:j(ue)})}function de(A,j){let Q=A.element.cloneNode(!0);for(let be of["id","opacity","visibility","aria-hidden"])Q.removeAttribute(be);Q.textContent=A.text;let ue=xe.apply(j,A);return le(Q,{x:ue.x,y:ue.y,"text-anchor":A.anchor}),v.appendChild(Q),{text:Q,at:ue}}return{get current(){return V},show(A){if(!u.has(A))return Promise.reject(new TypeError(`chartSwitch: there's no view ${JSON.stringify(A)}. The views are ${o.map(be=>JSON.stringify(be)).join(", ")}.`));if(R)return Promise.resolve();let j=x;if(!j)return A===V?Promise.resolve():_(E(V),E(A));let Q=j.forward?j.b:j.a,ue=j.forward?j.a:j.b;return A===Q.name?j.done:A===ue.name?ae(j):(z(j,!1),_(Q,E(A),{focus:j.focus}))},chart(A){let j=u.get(A);if(!j)throw new TypeError(`chartSwitch: there's no view ${JSON.stringify(A)}. The views are ${o.map(Q=>JSON.stringify(Q)).join(", ")}.`);return j.chart},destroy(){if(R)return;R=!0;let A=x;A&&(x=void 0,A.run++,A.driver?.cancel(),A.transition?.clear(),A.scene.clear(),A.settle()),O(),g?.disconnect(),D?.destroy();for(let j of u.values())j.chart.destroy();l.remove()}}}function Zd(e,t,n){let r=Lr(e),o;return o=en({duration:Ud,timing:"transition",ease:yt,update:a=>{let i=Math.min(1,r+a);t(a===0?e:nt(i)),i>=1&&a<1&&o?.finish()}},n),o}function qd(e){let t=e.now();return{clock:{now:()=>t??e.now(),onFrame:n=>e.onFrame(n)},release(){t=void 0}}}function Da(e,t){e.classList.toggle("ec-switch-inactive",!t),e.toggleAttribute("inert",!t),t?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden","true")}function $s(e,t){e.style.setProperty("opacity",String(Math.round(t*1e3)/1e3))}function Jd(e,t){return n=>{let r=Ns(e.at.x,t.at.x,n),o=Ns(e.at.y,t.at.y,n),a=n>=tr;le(e.text,{x:r,y:o,visibility:a?"hidden":void 0}),le(t.text,{x:r,y:o,visibility:a?void 0:"hidden"})}}function Gs(e,t){return n=>le(e.text,{opacity:t(n)})}var Is=e=>1-yo(e/tr),Vs=e=>yo((e-tr)/(1-tr)),yo=e=>Math.min(1,Math.max(0,e)),Ns=(e,t,n)=>e*(1-n)+t*n,Yd=e=>e[0]===1&&e[1]===0&&e[2]===0&&e[3]===1&&e[4]===0&&e[5]===0;function Ta(e,t){if(Yd(t))return e;let n=i=>xe.apply(t,i),r=i=>mo(fo(uo(i),t)),o=Math.sqrt(Math.abs(t[0]*t[3]-t[1]*t[2])),{outline:a}=e;return{key:e.key,...e.series===void 0?{}:{series:e.series},start:n(e.start),end:n(e.end),length:e.length*o,path:i=>n(e.path(i)),angle:i=>{let s=e.angle(i),c=Math.cos(s),d=Math.sin(s);return Math.atan2(t[1]*c+t[3]*d,t[0]*c+t[2]*d)},slice:(i,s)=>r(e.slice(i,s)),thickness:e.thickness*o,outline:{d:r(a.d),closed:a.closed,sample:i=>a.sample(i).map(n)},bounds:Qn(t,e.bounds),center:n(e.center),pivot:n(e.pivot),...e.segments===void 0?{}:{segments:e.segments.map(i=>Ta(i,t))}}}function Fs(){let e;return{done:new Promise(n=>{e=n}),settle:e}}function Xd(e,t){if(typeof e!="object"||e===null)return!1;let n=e,r=n.element;return["marks","labels","focus","leave","destroy"].every(o=>typeof n[o]=="function")&&r?.nodeType===1&&t.contains(r)}function Qd(e){if(typeof e!="object"||e===null)throw new TypeError("chartSwitch needs options.");let{views:t,initial:n,transition:r,announce:o}=e;if(typeof t!="object"||t===null)throw new TypeError("chartSwitch needs views: by name, a function that draws each view's chart in the container it's given.");let a=Object.keys(t);if(a.length===0)throw new TypeError("chartSwitch needs at least one view.");for(let i of a)if(typeof t[i]!="function")throw new TypeError(`chartSwitch: views.${i} must be a function that draws the view's chart in the container it's given.`);if(typeof n!="string"||!a.includes(n))throw new TypeError(`chartSwitch: initial must be one of the views (${a.map(i=>JSON.stringify(i)).join(", ")}), got ${typeof n=="string"?JSON.stringify(n):String(n)}.`);if(!Ea(r))throw new TypeError("chartSwitch: transition must be a transition effect, such as morph().");if(o!==void 0&&typeof o!="boolean")throw new TypeError("chartSwitch: announce must be true or false.");return a}var Bs=["presentation","analysis","off"],eu={presentation:"Presentation",analysis:"Analysis",off:"Off"},tu={presentation:"Staged, unhurried motion. Best for walking someone through a change.",analysis:"Quick, unstaged motion. Best for exploring.",off:"No motion: charts jump straight to their end state.",reduced:"Your device asks for reduced motion, so motion is off. Picking a mode here overrides it."},nu=0;function Ca(e,t,n={}){let r=ru(e);ou(t),au(n);let o={...eu,...n.labels},a={...tu,...n.hints},{persist:i}=n,s=r.ownerDocument;gt(s);let c=`ec-motion-${++nu}`,d=s.createElement("div");d.className="ec-motion-switch",d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${c}-label`),d.setAttribute("aria-describedby",`${c}-hint`);let l=d.appendChild(s.createElement("span"));l.className="ec-motion-label",l.id=`${c}-label`,l.textContent=n.label??"Motion";let u=d.appendChild(s.createElement("span"));u.className="ec-motion-modes";let f=Bs.map(F=>{let P=u.appendChild(s.createElement("button"));return P.type="button",P.dataset.mode=F,P.textContent=o[F],P.addEventListener("click",()=>t.chooseMode(F)),P}),h=d.appendChild(s.createElement("span"));h.className="ec-motion-hint",h.id=`${c}-hint`,h.setAttribute("aria-live","polite");let w=()=>{let F=t.mode;for(let P of f)P.setAttribute("aria-pressed",String(P.dataset.mode===F));h.textContent=t.prefersReduced&&t.viewerChoice===void 0?a.reduced:a[F]};if(i!==void 0){let F=Hs(s,P=>P.getItem(i));Bs.includes(F)&&t.chooseMode(F)}w(),r.appendChild(d);let v=t.subscribe(()=>{if(w(),i===void 0)return;let F=t.viewerChoice;Hs(s,P=>F===void 0?P.removeItem(i):P.setItem(i,F))}),D=!1;return{element:d,destroy(){D||(D=!0,v(),d.remove())}}}function Hs(e,t){try{let n=e.defaultView?.localStorage;return n?t(n):void 0}catch{return}}function ru(e){if(typeof e=="string"){let t=typeof document>"u"?null:document.querySelector(e);if(!t)throw new TypeError(`motionSwitch: no element matches "${e}".`);return t}if(typeof e!="object"||e===null||typeof e.appendChild!="function")throw new TypeError("motionSwitch needs an element or a selector to build the switch in.");return e}function ou(e){if(typeof e!="object"||e===null||typeof e.chooseMode!="function"||typeof e.subscribe!="function")throw new TypeError("motionSwitch needs a Motion, such as the page-wide `motion` or one from createMotion().")}function au(e){let{label:t,labels:n,hints:r,persist:o}=e;if(t!==void 0&&typeof t!="string")throw new TypeError(`motionSwitch: label must be a string, got ${typeof t}.`);for(let[a,i]of[["labels",n],["hints",r]])if(i!==void 0){for(let[s,c]of Object.entries(i))if(typeof c!="string")throw new TypeError(`motionSwitch: ${a}.${s} must be a string, got ${typeof c}.`)}if(o!==void 0&&(typeof o!="string"||o===""))throw new TypeError(`motionSwitch: persist must be a localStorage key, got ${JSON.stringify(o)??String(o)}.`)}var iu={play:"Play",pause:"Pause"};function La(e,t,n={}){let r=su(e);cu(t),lu(n);let o={...iu,...n.labels},a=r.ownerDocument;gt(a);let i=a.createElement("button");i.type="button",i.className="ec-play",i.addEventListener("click",()=>t.playing?t.pause():t.play());let s=()=>{let l=t.playing?o.pause:o.play;i.textContent!==l&&(i.textContent=l)};s(),r.appendChild(i);let c=t.subscribe(s),d=!1;return{element:i,destroy(){d||(d=!0,c(),i.remove())}}}function su(e){if(typeof e=="string"){let t=typeof document>"u"?null:document.querySelector(e);if(!t)throw new TypeError(`playButton: no element matches "${e}".`);return t}if(typeof e!="object"||e===null||typeof e.appendChild!="function")throw new TypeError("playButton needs an element or a selector to build the button in.");return e}function cu(e){if(typeof e!="object"||e===null||typeof e.play!="function"||typeof e.pause!="function"||typeof e.subscribe!="function")throw new TypeError("playButton needs a Playback, from playback().")}function lu(e){let{labels:t}=e;if(t!==void 0){for(let[n,r]of Object.entries(t))if(typeof r!="string"||r.trim()==="")throw new TypeError(`playButton: labels.${n} must be a string with some text, got ${JSON.stringify(r)??String(r)}.`)}}var du=Object.freeze({lift:0,spin:0,tilt:0});function uu(){return e=>({lift:0,spin:e.distance/e.radius,tilt:0})}function fu(e={}){let t=e.stride??42,n=e.lift??3.2,r=e.tilt??9;if(!(t>0)||!Number.isFinite(t))throw new RangeError(`gaits.step: stride must be more than 0, got ${t}.`);if(!(n>=0)||!Number.isFinite(n))throw new RangeError(`gaits.step: lift can't be negative, got ${n}.`);if(!Number.isFinite(r))throw new RangeError(`gaits.step: tilt must be a finite number of degrees, got ${r}.`);let o=r*Math.PI/180;return Object.assign(i=>{let s=Math.max(1,Math.round(i.length/t)),c=Math.abs(Math.sin(Math.PI*(i.progress*s%1)));return{lift:c*n,spin:0,tilt:c*o*(1-.3*i.progress)}},{ease:nt,pace:1.15})}function mu(){return()=>du}var Tr={roll:uu,step:fu,slide:mu};var yu=360,pu=260,hu=4e3,gu=.5,bu=.85,wu=2,vu=[1,0,0,1,0,0],ku=["auto","follow","level"],xu=["center","on"];function js(e,t={}){Tu(e,t);function n(o,a){let i=typeof e=="string"?a.icons.get(e):e;if(!i)throw new RangeError(`travel: unknown icon "${String(e)}". Register it with registerIcon(icon), or pass the icon itself.`);let s=Su(o,t.along);if(!s||!(s.length>=gu))return;let c=t.size===void 0?1:t.size==="fit"?bu*s.thickness/i.box.height:t.size/i.size;if(c>0)return Mu(s,i,c,t)}function r(o,a){let i=n(o,a),s,c,d=0,l=()=>{if(!i){s?.remove(),s=c=void 0;return}(!s||c?.icon!==i.icon||c.size!==i.size)&&(s?.remove(),s=a.layer.icon(i.icon,{size:i.size}),c={icon:i.icon,size:i.size}),s.place(i.transform(d))};return a.onChange(u=>{i=n(u,a),l()}),{get trip(){return i},show(u){d=u,l()}}}return{kind:"geometry",async run(o,a){if(a.signal.aborted)return;let i=r(o,a),s=i.trip;if(!s||s.span<=0){i.show(1);return}await a.tween({duration:s.duration,timing:"effect",ease:s.gait.ease??It,update:c=>i.show(c)}).finished},end(o,a){r(o,a).show(1)},clear(){}}}function Mu(e,t,n,r){let o=typeof r.gait=="function"?r.gait:Tr[r.gait??t.gait??"slide"](),a=e.length,i=t.footprint[0]*n,s=t.footprint[1]*n,c=Math.max(0,a-i-s),d=Math.max(wu,(i+s)/2),l=t.radius??t.box.height/2,{anchor:u}=t,f={x:u.x+n*(t.pivot.x-u.x),y:u.y+n*(t.pivot.y-u.y)},h=r.ride==="on"?e.thickness/2+(t.box.y+t.box.height-u.y)*n:0,w=r.orient??"auto";return{icon:t,size:t.size*n,span:c,duration:Math.min(hu,Math.max(pu,c/yu*1e3)*(o.pace??1)),gait:o,transform(v){let D=i+v*c,F=o({distance:v*c/n,length:c/n,progress:v,radius:l}),P=Eu(e,D),V=Du(e,Math.min(D,a),d),x=w==="auto"&&t.upright===!0&&Math.cos(V)<-1e-9,R=w==="level"?0:x?sr(V-Math.PI):V;return xe.multiply(xe.translate(P.x,P.y),xe.rotate(R),x?xe.scale(-1,1):vu,xe.translate(-u.x,-u.y-F.lift*n-h),xe.rotate(F.spin-F.tilt,f))}}}function Su(e,t){return t===void 0?e:e.segments?e.segments.find(n=>n.series===t):e.series===t?e:void 0}function Eu(e,t){let{length:n}=e;return t<=n?e.path(t/n):rn(e.end,e.angle(1),t-n)}function Du(e,t,n){let{length:r}=e,o=Math.min(n,t,r-t);if(o>1e-6){let a=e.path((t-o)/r),i=e.path((t+o)/r);if(Math.hypot(i.x-a.x,i.y-a.y)>1e-9)return Math.atan2(i.y-a.y,i.x-a.x)}return e.angle(t/r)}function Tu(e,t){if(!(typeof e=="string"&&e!=="")&&(typeof e!="object"||e===null||typeof e.name!="string"))throw new TypeError(`travel needs an icon or an icon's name, got ${e===null?"null":typeof e}.`);let{along:r,gait:o,size:a,orient:i,ride:s}=t;if(r!==void 0&&typeof r!="string")throw new RangeError(`travel: along must be a series name, got ${String(r)}.`);if(o!==void 0&&typeof o!="function"&&!Object.prototype.hasOwnProperty.call(Tr,o))throw new RangeError(`travel: gait must be a gait or one of roll, step, slide, got ${String(o)}.`);if(a!==void 0&&a!=="fit"&&!(typeof a=="number"&&a>0&&Number.isFinite(a)))throw new RangeError(`travel: size must be more than 0 px, or "fit", got ${String(a)}.`);if(i!==void 0&&!ku.includes(i))throw new RangeError(`travel: orient must be auto, follow or level, got ${String(i)}.`);if(s!==void 0&&!xu.includes(s))throw new RangeError(`travel: ride must be center or on, got ${String(s)}.`)}var Ru=900,po=.25,Cu=8,Lu=.35;function ho(e={}){Ou(e);let t=e.width??Cu,n=e.opacity??Lu,{color:r}=e,o=(a,i)=>{let s=t*Pu(i);a.mark.set({halo:s>0?{width:s,opacity:n,...r===void 0?{}:{color:r}}:void 0})};return{kind:"geometry",async run(a,i){i.signal.aborted||await i.tween({duration:Ru,timing:"effect",ease:yt,update:s=>o(i,s)}).finished},end(){},clear(){}}}function Pu(e){return!(e>0)||e>=1?0:e<po?zs(e/po):1-zs((e-po)/(1-po))}function zs(e){if(!(e>0))return 0;if(e>=1)return 1;let t=0,n=1;for(let o=0;o<24;o++){let a=(t+n)/2;1.74*a*a*(1-a)+a*a*a<e?t=a:n=a}let r=(t+n)/2;return 3*r*r-2*r*r*r}function Ou(e){let{width:t,opacity:n,color:r}=e;if(t!==void 0&&!(typeof t=="number"&&t>0&&Number.isFinite(t)))throw new RangeError(`flash: width must be more than 0 px, got ${String(t)}.`);if(n!==void 0&&!(typeof n=="number"&&n>0&&n<=1))throw new RangeError(`flash: opacity must be more than 0 and at most 1, got ${String(n)}.`);if(r!==void 0&&(typeof r!="string"||r===""))throw new RangeError(`flash: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}var Au=450,_s=[1,-.5,.25],Pa=3,$u=.5,Gu=64,Iu=Math.PI/12;function go(e={}){Nu(e);let t=e.swing??Pa;return{kind:"geometry",async run(n,r){if(r.signal.aborted)return;let o=n,a=Ks(n,t),i=0,s=()=>{let c=a*Vu(i);r.mark.set({transform:c===0?void 0:xe.rotate(c,o.pivot)})};r.onChange(c=>{o=c,a=Ks(c,t),s()}),await r.tween({duration:Au,timing:"effect",ease:yt,update:c=>{i=c,s()}}).finished},end(){},clear(){}}}function Ks(e,t){let{pivot:n}=e,r=0;for(let o of e.outline.sample(Gu))r=Math.max(r,Math.hypot(o.x-n.x,o.y-n.y));return r>=$u?Math.min(Iu,2*Math.asin(Math.min(1,t/(2*r)))):0}function Vu(e){if(!(e>0)||e>=1)return 0;let t=e*_s.length,n=Math.floor(t);return _s[n]*Math.sin(Math.PI*(t-n))}function Nu(e){let{swing:t}=e;if(t!==void 0&&!(typeof t=="number"&&t>0&&t<=Pa))throw new RangeError(`wiggle: swing must be more than 0 and at most ${Pa} px, got ${String(t)}.`)}var Us=600,Fu=2,Ws=6,Bu=12,Hu=.4,ju=5e3;function bo(e={}){zu(e);let t=e.times??Fu,n=e.width??Bu,{color:r}=e,o=(a,i)=>{let s=i>0&&i<1;a.mark.set({halo:s?{width:n*It(i),opacity:Hu*(1-i),...r===void 0?{}:{color:r}}:void 0})};return{kind:"geometry",async run(a,i){let s=0;for(let c=0;c<t;c++){if(i.signal.aborted)return;let d=i.motion.duration(Us,"effect");if(s+d>=ju)return;s+=d,await i.tween({duration:Us,timing:"effect",ease:yt,update:l=>o(i,l)}).finished}},end(){},clear(){}}}function zu(e){let{times:t,width:n,color:r}=e;if(t!==void 0&&!(Number.isInteger(t)&&t>=1&&t<=Ws))throw new RangeError(`pulse: times must be a whole number from 1 to ${Ws}, got ${String(t)}.`);if(n!==void 0&&!(typeof n=="number"&&n>0&&Number.isFinite(n)))throw new RangeError(`pulse: width must be more than 0 px, got ${String(n)}.`);if(r!==void 0&&(typeof r!="string"||r===""))throw new RangeError(`pulse: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}var _u=500,Ku=3,Uu=.5,Zs=.5;function qs(e={}){Wu(e);let t=e.duration??_u,n={stroke:e.color??"mark",width:e.width??Ku,opacity:e.opacity??Uu,linecap:"round"},r=(o,a)=>{let i=o,s=0,c,d=()=>{if(!(i.length>=Zs)){c?.remove(),c=void 0;return}let l=i.slice(0,s);c?c.update(l):c=a.layer.path(l,n)};return a.onChange(l=>{i=l,d()}),d(),l=>{s=l,d()}};return{kind:"geometry",async run(o,a){if(a.signal.aborted)return;let i=r(o,a);if(!(o.length>=Zs)){i(1);return}await a.tween({duration:t,timing:"effect",ease:nt,update:i}).finished},end(o,a){r(o,a)(1)},clear(){}}}function Wu(e){let{color:t,width:n,opacity:r,duration:o}=e;if(t!==void 0&&(typeof t!="string"||t===""))throw new RangeError(`trace: color must be a theme token or a CSS colour, got ${JSON.stringify(t)??String(t)}.`);if(n!==void 0&&!(typeof n=="number"&&n>=0&&Number.isFinite(n)))throw new RangeError(`trace: width must be 0 px or more, got ${String(n)}.`);if(r!==void 0&&!(typeof r=="number"&&r>=0&&r<=1))throw new RangeError(`trace: opacity must be from 0 to 1, got ${String(r)}.`);if(o!==void 0&&!(typeof o=="number"&&o>=0&&Number.isFinite(o)))throw new RangeError(`trace: duration must be 0 ms or more, got ${String(o)}.`)}var Zu=10,wo=6,qu=8,Ju=12.5,Oa=.36,Yu=.8;function Xu(e){let t=e.labelBounds??[],n=e.angle(1),r=Ys(e.end,n,t);if(r===void 0&&t.length>0){let o=e.angle(.5)-Math.PI/2,a=Ys(e.center,o,t);if(a!==void 0)return Js(e.center,o,a)}return Js(e.end,n,Math.max(Zu,r??-1/0))}function Js(e,t,n){let r=Math.cos(t),o=Math.sin(t),a=rn(e,t,n),i=Ju*(o<0?Oa*(1+o):Oa+(Yu-Oa)*o),s=Math.abs(r)<=Math.SQRT1_2+1e-9?"middle":r>0?"start":"end";return{at:{x:a.x,y:a.y+i},anchor:s,toward:t}}function Ys(e,t,n){let r=Math.cos(t),o=Math.sin(t),a;for(let{x:i,y:s,width:c,height:d}of n){let l={x:i-wo,y:s-wo,width:c+2*wo,height:d+2*wo},u=Qu(e,r,o,l);u!==void 0&&(a=Math.max(a??u,u))}return a}function Qu(e,t,n,r){let o=0,a=1/0;for(let[i,s,c,d]of[[e.x,t,r.x,r.x+r.width],[e.y,n,r.y,r.y+r.height]]){if(Math.abs(s)<1e-12){if(i<c||i>d)return;continue}let l=(c-i)/s,u=(d-i)/s;o=Math.max(o,Math.min(l,u)),a=Math.min(a,Math.max(l,u))}return a>=o?a:void 0}function nr(e,t,n,r,o){let a=e,i=o(e,t)??"",s=t,c=0,d,l=()=>{if(i===""){d?.remove(),d=void 0;return}let{at:u,anchor:f,toward:h}=Xu(a),w={at:rn(u,h-Math.PI/2,-qu*(1-c)),anchor:f,color:r,opacity:c};d?d.update(w,i):d=n.layer.text(i,w)};return n.onChange((u,f)=>{a=u,s=f??s,i=o(a,s)??"",l()}),l(),u=>{c=u,l()}}var ef=400,tf=1e-9,nf=e=>{let{samples:t}=e;return t[t.length-1]?.value??Number.NaN},Aa,rf=e=>(Aa??(Aa=new Intl.NumberFormat(void 0,{signDisplay:"always",maximumFractionDigits:2})),Aa.format(e));function Xs(e={}){of(e);let t=e.value??nf,n=e.format??rf,r=e.color??"text",o=a=>{if(!a.previous)return;let i=t(a),s=t(a.previous),c=i-s;if(!(!Number.isFinite(c)||Math.abs(c)<=tf*Math.max(Math.abs(i),Math.abs(s))))return n(c)};return{kind:"data",run:async(a,i,s)=>{if(s.signal.aborted)return;let c=o(i);if(c===void 0||c==="")return;let d=nr(a,i,s,r,()=>c);await s.tween({duration:ef,timing:"effect",update:d}).finished},end:(a,i,s)=>{let c=o(i);c!==void 0&&c!==""&&nr(a,i,s,r,()=>c)(1)},clear(){}}}function of(e){let{value:t,format:n,color:r}=e;if(t!==void 0&&typeof t!="function")throw new TypeError(`delta: value must be a function that reads the mark's value from its data, got ${typeof t}.`);if(n!==void 0&&typeof n!="function")throw new TypeError(`delta: format must be a function that words the change, got ${typeof n}.`);if(r!==void 0&&(typeof r!="string"||r===""))throw new RangeError(`delta: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}var af=400;function Qs(e,t={}){if(typeof e!="function")throw new TypeError(`label needs a function that returns the text from the mark's data, got ${typeof e}.`);let{color:n="text"}=t;if(typeof n!="string"||n==="")throw new RangeError(`label: color must be a theme token or a CSS colour, got ${JSON.stringify(n)??String(n)}.`);let r=(o,a)=>{let i=e(a,o);return i==null?void 0:String(i)};return{kind:"data",run:async(o,a,i)=>{if(i.signal.aborted)return;let s=nr(o,a,i,n,r);await i.tween({duration:af,timing:"effect",update:s}).finished},end:(o,a,i)=>nr(o,a,i,n,r)(1),clear(){}}}var sf=["below","above"];function tc(e){ff(e);let{compareTo:t}=e,n=e.when??"below",r=e.color??"negative",o=(a,i,s)=>{let c=[],d=i,l=u=>{let f=u.length>=.5?df(d.samples,cf(t,d),n):[],h={stroke:r,width:u.thickness,linecap:"butt"};f.forEach(([w,v],D)=>{let F=u.slice(w,v),P=c[D];P?P.update(F,h):c.push(s.layer.path(F,h))});for(let w of c.splice(f.length))w.remove()};s.onChange((u,f)=>{d=f??d,l(u)}),l(a)};return{kind:"data",...typeof t=="string"?{needs:Object.freeze({related:Object.freeze([t])})}:{},run:async(a,i,s)=>{s.signal.aborted||o(a,i,s)},end:(a,i,s)=>o(a,i,s),clear(){}}}function cf(e,t){if(typeof e=="number")return{place:i=>i.t,valueAt:()=>e,bends:[]};let n=t.related(e);if(!n)return;let o=t.samples.every(i=>$a(i.at)!==void 0)&&n.samples.every(i=>$a(i.at)!==void 0)?i=>$a(i.at):i=>i.t,a=n.samples.map(i=>({u:o(i),value:i.value})).filter(i=>Number.isFinite(i.u)).sort((i,s)=>i.u-s.u);return{place:o,valueAt:i=>lf(a,i),bends:a.map(i=>i.u)}}function $a(e){let t=typeof e=="number"?e:e instanceof Date?e.getTime():void 0;return t!==void 0&&Number.isFinite(t)?t:void 0}function lf(e,t){let n=e[0],r=e[e.length-1];if(!n||!r||t<n.u||t>r.u)return;let o=0,a=e.length-1;for(;o<a;){let c=o+a>>1;e[c].u<t?o=c+1:a=c}let i=e[o];if(o===0||i.u===t)return i.value;let s=e[o-1];return s.value+(t-s.u)/(i.u-s.u)*(i.value-s.value)}function df(e,t,n){if(!t)return[];let r=n==="below"?1:-1,o=(c,d,l)=>{let u=t.valueAt(d);if(u===void 0||!Number.isFinite(u)||!Number.isFinite(l)||!Number.isFinite(c))return{t:c,past:void 0};let f=r*(u-l);return{t:c,past:Math.abs(f)<=1e-9*Math.max(Math.abs(u),Math.abs(l))?0:f}},a=[];e.forEach((c,d)=>{let l=t.place(c);a.push(o(c.t,l,c.value));let u=e[d+1];if(!u)return;let f=t.place(u);if(l===f||!Number.isFinite(l)||!Number.isFinite(f))return;let h=[],{bends:w}=t;for(let v=uf(w,Math.min(l,f));v<w.length&&w[v]<Math.max(l,f);v++)h.push((w[v]-l)/(f-l));f<l&&h.reverse();for(let v of h)a.push(o(c.t+v*(u.t-c.t),l+v*(f-l),c.value+v*(u.value-c.value)))});let i=[],s=(c,d)=>{let l=ec(c),u=ec(d);if(!(u>l))return;let f=i[i.length-1];f&&f[1]>=l?f[1]=Math.max(f[1],u):i.push([l,u])};for(let c=1;c<a.length;c++){let d=a[c-1],l=a[c];d.past===void 0||l.past===void 0||!(l.t>d.t)||(d.past>0&&l.past>0?s(d.t,l.t):d.past>0?s(d.t,d.t+(l.t-d.t)*(d.past/(d.past-l.past))):l.past>0&&s(d.t+(l.t-d.t)*(d.past/(d.past-l.past)),l.t))}return i}var ec=e=>Math.min(1,Math.max(0,e));function uf(e,t){let n=0,r=e.length;for(;n<r;){let o=n+r>>1;e[o]<=t?n=o+1:r=o}return n}function ff(e){let{compareTo:t,when:n,color:r}=e??{};if(!(typeof t=="string"?t!=="":typeof t=="number"&&Number.isFinite(t)))throw new RangeError(`threshold: compareTo must be a finite number or a series name, got ${Ga(t)}.`);if(n!==void 0&&!sf.includes(n))throw new RangeError(`threshold: when must be "below" or "above", got ${Ga(n)}.`);if(r!==void 0&&(typeof r!="string"||r===""))throw new RangeError(`threshold: color must be a theme token or a CSS colour, got ${Ga(r)}.`)}var Ga=e=>typeof e=="string"?JSON.stringify(e):String(e);var mf=950,yf=160,pf=["unroll","drop"];function vo(e={}){vf(e);let t=e?.points??yf,n=e?.align??"unroll";return{kind:"transition",async run(r,o,a){if(a.signal.aborted)return;let i=nc(r,o,a.layer,t,n),s=wf(a.start);if(s>=1){i(1);return}let c=Lr(s),d;d=a.tween({duration:mf,timing:"transition",ease:yt,update:l=>{let u=Math.min(1,c+l);i(l===0?s:nt(u)),u>=1&&l<1&&d?.finish()}}),await d.finished},end(r,o,a){nc(r,o,a.layer,t,n)(1)},clear(){}}}function nc(e,t,n,r,o){let a=e.outline.closed;if(a!==t.outline.closed)return gf(e,t,n);let i=e.outline.sample(r),s=t.outline.sample(r);if(!a)return hf(e,t,n,i,s);let[c,d]=o==="drop"?bf(e,t,r):[0,0],l;return u=>{let f=u<=0?e.outline.d:u>=1?t.outline.d:rc(i,s,c,d,u,!0);l?l.update(f):l=n.path(f,{fill:"mark"})}}function hf(e,t,n,r,o){let a;return i=>{let s=i<=0?e.outline.d:i>=1?t.outline.d:rc(r,o,0,0,i,!1),c=i<=0?e.thickness:i>=1?t.thickness:Ia(e.thickness,t.thickness,i);a?a.update(s,{width:c}):a=n.path(s,{stroke:"mark",width:c})}}function gf(e,t,n){let r=(i,s)=>({...i.outline.closed?{fill:"mark"}:{stroke:"mark",width:i.thickness},...s===void 0?{}:{opacity:s}}),o,a;return i=>{if(i>=1){o?.remove(),o=void 0,a?a.update(t.outline.d,{opacity:void 0}):a=n.path(t.outline.d,r(t));return}a?(o?.update(e.outline.d,{opacity:1-i}),a.update(t.outline.d,{opacity:i})):e.outline.closed?(o=n.path(e.outline.d,r(e,1-i)),a=n.path(t.outline.d,r(t,i))):(a=n.path(t.outline.d,r(t,i)),o=n.path(e.outline.d,r(e,1-i)))}}function rc(e,t,n,r,o,a){let i=e.length,s="";for(let c=0;c<i;c++){let d=e[(c+n)%i],l=t[(c+r)%i];s+=`${c===0?"M":"L"}${Ze(Ia(d.x,l.x,o))},${Ze(Ia(d.y,l.y,o))}`}return a?`${s}Z`:s}var Ia=(e,t,n)=>e*(1-n)+t*n;function bf(e,t,n){let r=n/4,o=kr(e);return o===kr(t)?[0,0]:o?[0,r]:[r,0]}function wf(e){return typeof e=="number"&&e>0?Math.min(1,e):0}function vf(e){let{points:t,align:n}=e??{};if(t!==void 0&&!(Number.isInteger(t)&&t>=4&&t%4===0))throw new RangeError(`morph: points must be a whole multiple of 4, got ${String(t)}.`);if(n!==void 0&&!pf.includes(n))throw new RangeError(`morph: align must be "unroll" or "drop", got ${typeof n=="string"?JSON.stringify(n):String(n)}.`)}function oc(...e){let t=ko("sequence",e);return lc(t,async(n,r)=>{for(let o of t){if(r.signal.aborted)return;await n(o)}})}function ac(...e){let t=ko("parallel",e);return lc(t,async n=>{await Promise.all(t.map(n))})}function ic(e,t){if(typeof e!="string"&&typeof e!="function")throw new TypeError(`only needs a key, a series name or a predicate, got ${ur(e)}.`);let[n]=ko("only",[t]),r=typeof e=="string"?i=>i.key===e||i.series===e:e;if(n.kind==="data"){let i=n;return{kind:"data",...i.needs?{needs:i.needs}:{},run:(c,d,l)=>r(c)?i.run(c,d,l):Promise.resolve(),end:(c,d,l)=>{r(c)&&i.end(c,d,l)},clear:c=>i.clear(c)}}let o=n;return{kind:"geometry",run:(i,s)=>r(i)?o.run(i,s):Promise.resolve(),end(i,s){r(i)&&o.end(i,s)},clear:i=>o.clear(i)}}var kf=50,xf=500;function sc(e,t={}){let[n]=ko("stagger",[e]),r=t.delay??kf;if(!(typeof r=="number"&&r>=0&&Number.isFinite(r)))throw new RangeError(`stagger: delay must be 0 ms or more, got ${String(r)}.`);let o=async(s,c,d)=>{if(d.signal.aborted)return;let{index:l,count:u}=d.batch,f=u>1?Math.min(r,xf/(u-1)):0,h=l>0?l*f:0;if(!(h>0))return{mark:s,data:c};let w=cc(s,c,d);return await d.tween({duration:h,timing:"stagger",update:()=>{}}).finished,d.signal.aborted?void 0:w()};if(n.kind==="data"){let s=n;return{kind:"data",...s.needs?{needs:s.needs}:{},run:async(d,l,u)=>{let f=await o(d,l,u);f&&await s.run(f.mark,f.data,u)},end:(d,l,u)=>s.end(d,l,u),clear:d=>s.clear(d)}}let a=n;return{kind:"geometry",async run(s,c){let d=await o(s,void 0,c);d&&await a.run(d.mark,c)},end:(s,c)=>a.end(s,c),clear:s=>a.clear(s)}}function cc(e,t,n){let r={mark:e,data:t};return n.onChange((o,a)=>{r={mark:o,data:a??r.data}}),()=>r}function lc(e,t){let n=(i,s,c)=>{let d=cc(i,s,c);return l=>{let{mark:u,data:f}=d();return l.kind==="data"?l.run(u,f,c):l.run(u,c)}},r=(i,s,c)=>{for(let d of e)d.kind==="data"?d.end(i,s,c):d.end(i,c)},o=i=>{let s;for(let c of e)try{c.clear(i)}catch(d){s??(s={error:d})}if(s)throw s.error};if(e.some(i=>i.kind==="data")){let i=[...new Set(e.flatMap(c=>c.kind==="data"?c.needs?.related??[]:[]))];return{kind:"data",...i.length>0?{needs:{related:i}}:{},run:(c,d,l)=>t(n(c,d,l),l),end:(c,d,l)=>r(c,d,l),clear:o}}return{kind:"geometry",run:(i,s)=>t(n(i,void 0,s),s),end:(i,s)=>r(i,void 0,s),clear:o}}function ko(e,t){return t.forEach((n,r)=>{if(!Ir(n))throw new TypeError(`${e}: part ${r+1} needs to be a mark effect (kind "geometry" or "data"), got ${ur(n)}.`)}),[...t]}var dc=()=>{};function uc(e){mc("defineEffect",e);let t={kind:"geometry",run:e.run,end:e.end,clear:e.clear??dc};return Object.freeze(t)}function fc(e){mc("defineDataEffect",e);let t=Mf(e.needs),n={kind:"data",...t?{needs:t}:{},run:e.run,end:e.end,clear:e.clear??dc};return Object.freeze(n)}function mc(e,t){if(typeof t!="object"||t===null)throw new TypeError(`${e} needs a spec object { run, end }, got ${t===null?"null":typeof t}.`);let{run:n,end:r,clear:o}=t;if(typeof n!="function")throw new TypeError(`${e}: run must be a function that animates the mark, got ${typeof n}.`);if(typeof r!="function")throw new TypeError(`${e}: end must be a function that draws the final state, got ${typeof r}. Every effect needs one: reduced motion shows only end states.`);if(o!==void 0&&typeof o!="function")throw new TypeError(`${e}: clear must be a function if it's given, got ${typeof o}.`)}function Mf(e){if(e===void 0)return;let t=typeof e=="object"&&e!==null?e.related:void 0;if(!(typeof e=="object"&&e!==null&&(t===void 0||Array.isArray(t)&&t.every(r=>typeof r=="string"&&r!==""))))throw new TypeError(`defineDataEffect: needs must be { related: [series names] }, got ${JSON.stringify(e)??String(e)}.`);return t===void 0?void 0:Object.freeze({related:Object.freeze([...t])})}var Sf=["roll","step","slide"],Ef=["butt","round"],Df=["miter","round"],yc=/^\s*[Mm][MmLlHhVvCcSsQqTtAaZz0-9eE.,+\-\s]*$/;function yn(e){let t=e?.name;if(typeof t!="string"||t==="")throw new TypeError(`defineIcon needs a non-empty string name, got ${JSON.stringify(t)}.`);let n=(w,v)=>{throw new RangeError(`defineIcon: "${t}" ${w} ${v}.`)},r=(w,v)=>typeof v=="number"&&Number.isFinite(v)?v:n(w,`must be a finite number, got ${String(v)}`),o=(w,v)=>r(w,v)>0?v:n(w,`must be more than 0, got ${String(v)}`),a=(w,v)=>v&&typeof v=="object"?rr({x:r(`${w}.x`,v.x),y:r(`${w}.y`,v.y)}):n(w,"must be a point { x, y }");(!Array.isArray(e.shapes)||e.shapes.length===0)&&n("shapes","must be a non-empty array");let i=e.shapes.map((w,v)=>Tf(w,`shapes[${v}]`,n,r)),s=e.box;(!s||typeof s!="object")&&n("box","must be a rectangle { x, y, width, height }");let c=rr({x:r("box.x",s.x),y:r("box.y",s.y),width:o("box.width",s.width),height:o("box.height",s.height)}),d=a("anchor",e.anchor),l=e.pivot===void 0?d:a("pivot",e.pivot),u=e.footprint??[Math.max(0,d.x-c.x),Math.max(0,c.x+c.width-d.x)];(!Array.isArray(u)||u.length!==2)&&n("footprint","must be [behind, ahead]"),u.forEach((w,v)=>{r(`footprint[${v}]`,w)<0&&n(`footprint[${v}]`,`can't be negative, got ${w}`)});let f=e.size===void 0?c.width:o("size",e.size),h=e.radius===void 0?c.height/2:o("radius",e.radius);return e.gait!==void 0&&!Sf.includes(e.gait)&&n("gait",`must be roll, step or slide, got ${String(e.gait)}`),e.upright!==void 0&&typeof e.upright!="boolean"&&n("upright",`must be true or false, got ${String(e.upright)}`),rr({name:t,shapes:rr(i),box:c,size:f,anchor:d,pivot:l,footprint:rr([u[0],u[1]]),...e.gait!==void 0?{gait:e.gait}:{},radius:h,...e.upright!==void 0?{upright:e.upright}:{}})}function Tf(e,t,n,r){(!e||typeof e!="object")&&n(t,"must be a shape { d, fill?, stroke?, \u2026 }"),(typeof e.d!="string"||!yc.test(e.d))&&n(`${t}.d`,"must be path data starting with a move"),e.clip!==void 0&&(typeof e.clip!="string"||!yc.test(e.clip))&&n(`${t}.clip`,"must be path data starting with a move");for(let a of["fill","stroke"]){let i=e[a];i!==void 0&&(typeof i!="string"||i==="")&&n(`${t}.${a}`,`must be a colour, got ${String(i)}`)}e.width!==void 0&&r(`${t}.width`,e.width)<0&&n(`${t}.width`,`can't be negative, got ${e.width}`),e.linecap!==void 0&&!Ef.includes(e.linecap)&&n(`${t}.linecap`,`must be butt or round, got ${String(e.linecap)}`),e.linejoin!==void 0&&!Df.includes(e.linejoin)&&n(`${t}.linejoin`,`must be miter or round, got ${String(e.linejoin)}`);let o={d:e.d};for(let a of["fill","stroke","width","linecap","linejoin","clip"])e[a]!==void 0&&(o[a]=e[a]);return rr(o)}var rr=e=>Object.freeze(e);var Rf=new Set(["svg","g","a"]),Cf=new Set(["path","circle","rect","ellipse","line","polyline","polygon"]),Lf=/<![^<>]*>|<(\/?)([A-Za-z][\w:.-]*)((?:\s+[^\s=/<>]+(?:\s*=\s*(?:"[^"<]*"|'[^'<]*'|[^\s"'<>]+))?)*)\s*(\/?)>/g,Pf=/([^\s=/<>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+)))?/g,Of=/^(?:#[0-9a-fA-F]{3,8}|[a-zA-Z][a-zA-Z0-9-]*|(?:rgba?|hsla?)\([\d\s.,%+\-/]*\))$/;function gc(e,t){if(typeof e!="string")throw new TypeError("iconFromSvg needs SVG markup as a string.");let n=typeof t?.name=="string"?`"${t.name}"`:"an icon",r=u=>{throw new RangeError(`iconFromSvg: ${n} ${u}.`)},o,a=1,i=[],s=[],c;for(let u of Af(e).matchAll(Lf)){let[,f,h,w="",v]=u;if(h===void 0)continue;let D=h.toLowerCase();if(f){let R=Hf(s,D);R>=0&&(s.length=R);continue}let F=$f(w),P=!o&&D==="svg";P&&(o=Gf(F)??r("needs a viewBox, or a width and height in px, on its <svg>"),t.size!==void 0&&((typeof t.size!="number"||!(t.size>0)||!Number.isFinite(t.size))&&r(`size must be more than 0, got ${String(t.size)}`),a=t.size/o.width),c={fill:"#000000",stroke:"none",width:1,linecap:void 0,linejoin:void 0,transform:xe.scale(a)});let V=s.length>0?s[s.length-1].state:P?c:void 0,x=V&&!If(F)?Vf(V,F):void 0;if(x&&Cf.has(D)){let R=Nf(D,F,x);R&&i.push(R)}v||s.push({tag:D,state:Rf.has(D)?x:void 0})}o||r("needs an <svg> element"),i.length===0&&r("has nothing to draw: no path, circle, rect, ellipse, line, polyline or polygon with a fill or stroke");let d={x:o.x*a,y:o.y*a,width:o.width*a,height:o.height*a},l=u=>u&&typeof u=="object"?{x:u.x*a,y:u.y*a}:u;return yn({...t,shapes:i,box:d,anchor:l(t.anchor),...t.pivot?{pivot:l(t.pivot)}:{},...Array.isArray(t.footprint)?{footprint:[t.footprint[0]*a,t.footprint[1]*a]}:{},...typeof t.radius=="number"?{radius:t.radius*a}:{}})}function Af(e){let t=[["<!--","-->"],["<![CDATA[","]]>"],["<?","?>"]],n=t.map(([a])=>e.indexOf(a)),r="",o=0;for(;;){let a=-1;if(n.forEach((d,l)=>{d>=0&&(a<0||d<n[a])&&(a=l)}),a<0)return r+e.slice(o);let i=n[a],s=t[a][1];r+=e.slice(o,i);let c=e.indexOf(s,i+t[a][0].length);if(c<0)return r;o=c+s.length,n.forEach((d,l)=>{d>=0&&d<o&&(n[l]=e.indexOf(t[l][0],o))})}}function $f(e){let t=new Map;for(let[,n,r,o,a]of e.matchAll(Pf))n!==void 0&&t.set(n,r??o??a??"");for(let n of(t.get("style")??"").split(";")){let r=n.indexOf(":");r>0&&t.set(n.slice(0,r).trim(),n.slice(r+1).replace(/!important/i,"").trim())}return t}function Gf(e){let t=(e.get("viewBox")??"").trim().split(/[\s,]+/).map(Number);if(t.length===4&&t.every(Number.isFinite)&&t[2]>0&&t[3]>0)return{x:t[0],y:t[1],width:t[2],height:t[3]};let n=pc(e.get("width")),r=pc(e.get("height"));return n!==void 0&&r!==void 0?{x:0,y:0,width:n,height:r}:void 0}function pc(e){let t=/^\s*(\d*\.?\d+(?:e[+-]?\d+)?)\s*(px)?\s*$/i.exec(e??""),n=t?Number(t[1]):NaN;return n>0&&Number.isFinite(n)?n:void 0}function If(e){return e.get("display")?.trim()==="none"||e.get("visibility")?.trim()==="hidden"}function Vf(e,t){let n=(s,c)=>{let d=t.get(s)?.trim();if(d===void 0||!Of.test(d))return c;let l=d.toLowerCase();return l==="inherit"?c:l==="currentcolor"?"text":l==="none"?l:d},r=Number.parseFloat(t.get("stroke-width")??""),o=t.get("stroke-linecap")?.trim(),a=t.get("stroke-linejoin")?.trim(),i=t.get("transform");return{fill:n("fill",e.fill),stroke:n("stroke",e.stroke),width:r>=0?r:e.width,linecap:o==="butt"||o==="round"?o:e.linecap,linejoin:a==="miter"||a==="round"?a:e.linejoin,transform:i?xe.multiply(e.transform,lr(i)):e.transform}}function Nf(e,t,n){let r=n.fill==="none"?void 0:n.fill,o=n.stroke==="none"||!(n.width>0)?void 0:n.stroke;if(r===void 0&&o===void 0)return;let a=Ff(e,t);if(!a.some(s=>s.op!=="M"))return;let i=n.transform;return{d:mo(fo(a,i)),...r!==void 0?{fill:r}:{},...o!==void 0?{stroke:o,width:jf(n.width*Math.sqrt(Math.abs(i[0]*i[3]-i[1]*i[2]))),...n.linecap?{linecap:n.linecap}:{},...n.linejoin?{linejoin:n.linejoin}:{}}:{}}}function Ff(e,t){let n=r=>{let o=Number.parseFloat(t.get(r)??"");return Number.isFinite(o)?o:0};switch(e){case"path":return uo(t.get("d")??"");case"circle":return hc(n("cx"),n("cy"),n("r"),n("r"));case"ellipse":return hc(n("cx"),n("cy"),n("rx"),n("ry"));case"line":return[{op:"M",to:{x:n("x1"),y:n("y1")}},{op:"L",to:{x:n("x2"),y:n("y2")}}];case"polyline":case"polygon":{let r=(t.get("points")??"").trim().split(/[\s,]+/).filter(Boolean).map(Number),o=[];for(let i=0;i+1<r.length&&Number.isFinite(r[i])&&Number.isFinite(r[i+1]);i+=2)o.push({x:r[i],y:r[i+1]});if(o.length<2)return[];let a=o.map((i,s)=>({op:s===0?"M":"L",to:i}));return e==="polygon"?[...a,{op:"Z",to:o[0]}]:a}case"rect":return Bf(n("x"),n("y"),n("width"),n("height"),t);default:return[]}}function hc(e,t,n,r){if(!(n>0&&r>0))return[];let o=a=>({op:"A",rx:n,ry:r,rotation:0,large:!1,sweep:!0,to:{x:a,y:t}});return[{op:"M",to:{x:e+n,y:t}},o(e-n),o(e+n),{op:"Z",to:{x:e+n,y:t}}]}function Bf(e,t,n,r,o){if(!(n>0&&r>0))return[];let a=l=>{let u=Number.parseFloat(o.get(l)??"");return u>=0?u:void 0},i=Math.min(a("rx")??a("ry")??0,n/2),s=Math.min(a("ry")??a("rx")??0,r/2),c=(l,u)=>({op:"L",to:{x:l,y:u}});if(!(i>0&&s>0))return[{op:"M",to:{x:e,y:t}},c(e+n,t),c(e+n,t+r),c(e,t+r),{op:"Z",to:{x:e,y:t}}];let d=(l,u)=>({op:"A",rx:i,ry:s,rotation:0,large:!1,sweep:!0,to:{x:l,y:u}});return[{op:"M",to:{x:e+i,y:t}},c(e+n-i,t),d(e+n,t+s),c(e+n,t+r-s),d(e+n-i,t+r),c(e+i,t+r),d(e,t+r-s),c(e,t+s),d(e+i,t),{op:"Z",to:{x:e+i,y:t}}]}function Hf(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].tag===t)return n;return-1}var jf=e=>Math.round(e*1e3)/1e3;var zf=yn({name:"dot",shapes:[{d:"M4,0A4,4 0 0 1 -4,0A4,4 0 0 1 4,0Z",fill:"surface",stroke:"text",width:1.5}],box:{x:-5,y:-5,width:10,height:10},anchor:{x:0,y:0}}),_f=yn({name:"arrow",shapes:[{d:"M-7,-1.5L1,-1.5L1,-5L7,0L1,5L1,1.5L-7,1.5Z",fill:"text",stroke:"surface",width:1.5,linejoin:"round"}],box:{x:-8,y:-6,width:16,height:12},anchor:{x:0,y:0}}),Kf=yn({name:"chevron",shapes:[{d:"M-2.5,-5L2.5,0L-2.5,5",stroke:"surface",width:4.5,linecap:"round",linejoin:"round"},{d:"M-2.5,-5L2.5,0L-2.5,5",stroke:"text",width:2,linecap:"round",linejoin:"round"}],box:{x:-5,y:-7.5,width:10,height:15},anchor:{x:0,y:0}}),xo=Object.freeze({dot:zf,arrow:_f,chevron:Kf});var Va=Lo({kind:"preset",entries:{flash:()=>ho(),wiggle:()=>go(),pulse:()=>bo()},hint:"Register custom presets with registerPreset(name, factory)."}),Na=Lo({kind:"icon",entries:xo,hint:"Register icons with registerIcon(icon) or registerIcons(icons)."});function bc(e,t){if(typeof t!="function")throw new TypeError(`registerPreset("${e}") needs a function that returns an effect.`);Va.register(e,t)}function Fa(e){if(typeof e!="object"||e===null||typeof e.name!="string")throw new TypeError("registerIcon needs an icon with a name.");Na.register(e.name,e)}function wc(e){for(let t of e)Fa(t)}function vc(e){if(typeof e!="object"||e===null)throw new TypeError("configure needs an options object.");if("nonce"in e){if(e.nonce!==void 0&&(typeof e.nonce!="string"||e.nonce===""))throw new TypeError("configure: nonce must be a non-empty string.");hn.nonce=e.nonce}if("injectStyles"in e){if(e.injectStyles!==void 0&&typeof e.injectStyles!="boolean")throw new TypeError("configure: injectStyles must be true or false.");hn.injectStyles=e.injectStyles}}var Uf="0.2.0",or={presets:Va,icons:Na,motion:kt};function Wf(e,t){return Zo(e,t,or)}function Zf(e,t){return oa(e,t,or)}function qf(e,t){return ga(e,t,or)}function Jf(e,t){let n=typeof t=="object"&&t!==null&&t.transition===void 0?{...t,transition:vo()}:t;return Ra(e,n,or)}function Yf(e,t){return er(e,t,or)}function Xf(e,t){return lo(e,t,or)}function Qf(e,t=kt,n){return Ca(e,t,n)}return Rc(em);})();
|
|
89
|
+
`,cn=`data-expressive-charts`,ln={};function un(e){if(ln.injectStyles===!1||e.querySelector(`style[${cn}]`))return;let t=e.createElement(`style`);t.setAttribute(cn,``),ln.nonce&&t.setAttribute(`nonce`,ln.nonce),t.textContent=sn,(e.head??e.documentElement).appendChild(t)}function dn(e={}){let t=/* @__PURE__ */ new Map;for(let[n,r]of Object.entries(e)){if(!Number.isInteger(r)||r<1||r>8)throw RangeError(`colorAssignment: the slot for "${n}" must be a whole number from 1 to 8, got ${String(r)}.`);t.set(n,r)}return{slot(e){let n=t.get(e);if(n===void 0){let r=new Set(t.values());for(n=1;r.has(n)&&n<=8;)n++;n>8&&(n=t.size%8+1),t.set(e,n)}return n}}}function fn(e){return e&&typeof e.slot==`function`?e:dn(e)}function pn(e,t){if(e===void 0||typeof e==`boolean`)return;let n=e=>{throw TypeError(`${t}: ${e}`)};(typeof e!=`object`||!e||Array.isArray(e))&&n(`legend must be true or false, or an object with the entries the page adds.`);let{entries:r}=e;r!==void 0&&(Array.isArray(r)||n(`legend.entries must be an array of { label, color }.`),r.forEach((e,t)=>{let{label:r,color:i}=typeof e==`object`&&e?e:n(`legend.entries[${t}] must be an object with a label and a color.`);(typeof r!=`string`||r.trim()===``)&&n(`legend.entries[${t}].label must be a non-empty string: the entry's name.`),(typeof i!=`string`||i.trim()===``)&&n(`legend.entries[${t}].color must be a theme token or a CSS colour.`),(i===`mark`||i===`mark-strong`)&&n(`legend.entries[${t}].color can't be "${i}": an entry has no mark. Use a theme token or a CSS colour.`)}))}let mn=e=>typeof e==`object`?e.entries??[]:[];function hn(e){let t,n=``,r=()=>{t?.remove(),t=void 0,n=``},i=(r,i,a,o)=>{let s=[...r.map(({key:e,label:t})=>({key:e,label:t,styles:an(nn(i.slot(e)))})),...o.map(({label:e,color:t})=>({key:void 0,label:e,styles:{"--ec-mark":rn(t)}}))],c=e.ownerDocument;t??(t=Object.assign(c.createElement(`div`),{className:`ec-legend`})),t.nextSibling!==e&&e.before(t);let l=JSON.stringify([a,s]);l!==n&&(n=l,t.replaceChildren(...s.map(({key:e,label:t,styles:n})=>{let r=c.createElement(`span`);r.className=`ec-legend-item`,e!==void 0&&r.setAttribute(a,e);for(let[e,t]of Object.entries(n))t!==void 0&&r.style.setProperty(e,t);let i=c.createElement(`span`);i.className=`ec-legend-swatch`;let o=c.createElement(`span`);return o.className=`ec-legend-label`,o.textContent=t,r.append(i,o),r})))};return{update(e,t,n){let a=mn(n);n===!1||e.length+a.length<2?r():i(e.map(({series:e,label:t})=>({key:e,label:t})),t,`data-series`,a)},categories(e,t,n){n===!1||e.length===0?r():i(e,t,`data-key`,mn(n))},destroy:r}}let gn=e=>e!==void 0&&e.source!==`linked`,_n=/* @__PURE__ */ new WeakMap,vn=/* @__PURE__ */ new WeakSet,yn=e=>e.parts?[e,...e.parts]:[e];function bn(e,t){return _n.set(t,e),t}let xn=e=>_n.get(e);function Sn(e,n={}){if(!Array.isArray(e))throw TypeError(`link needs an array of charts, chart switches and attachments: link([columns, line]).`);if(typeof n!=`object`||!n)throw TypeError(`link: options must be an object, such as { by: (event) => event.data.datum.week }.`);let{by:r,effects:i=!0}=n;if(r!==void 0&&typeof r!=`function`)throw TypeError(`link: by must be a function, such as (event) => event.data.datum.week.`);if(typeof i!=`boolean`)throw TypeError(`link: effects must be true or false, got ${String(i)}.`);let a=[],o=/* @__PURE__ */ new Set;for(let t of e){let e=typeof t==`object`&&t?_n.get(t):void 0;if(!e)throw TypeError(`link: each source must be a chart (barChart, donutChart or lineChart), a chartSwitch or an attachment (expressive or fromVegaView).`);let n=yn(e);if(n.some(e=>vn.has(e)||o.has(e)))throw TypeError(`link: a chart, chart switch or attachment can be in one link at a time, and a chart switch's views' charts go with it. Destroy the link it's in first.`);for(let e of n)o.add(e);a.push(e)}let s=/* @__PURE__ */ new Set,c,l=/* @__PURE__ */ new Set;function u(e){let n;if(r)try{n=r(e)}catch(e){t(e);return}else{let{samples:t}=e.data;n=t[t.length-1]?.at??e.mark.key}return n instanceof Date?Number.isNaN(n.getTime())?void 0:n.toISOString():n==null?void 0:String(n)}function d(e,t){if(t.size===0)return[];let n=e=>e.some(e=>{let n=u(e);return n!==void 0&&t.has(n)});return e.targets().flatMap(e=>n(e.marks)?[e.key]:[])}function f(e,t){c=e;let n=new Set(t.map(u));n.delete(void 0),l=n;for(let t of s)if(t!==e&&(t.hover(d(t,n),i),c!==e))return}function p(e){if(c===e){c=void 0,l=/* @__PURE__ */ new Set;for(let e of s)e.unlink()}}for(let e of a)if(e.listen({hover:t=>f(e,t),leave:()=>p(e),dismiss(){let e=c;e?.leave(),e&&p(e)},shown(){c!==void 0&&c!==e&&s.has(e)&&e.hover(d(e,l),i)},gone(){s.delete(e);for(let t of yn(e))vn.delete(t);p(e)}})){s.add(e);for(let t of yn(e))vn.add(t)}return{destroy(){for(let e of s){e.listen(void 0),e.unlink();for(let t of yn(e))vn.delete(t)}s.clear(),c=void 0,l=/* @__PURE__ */ new Set}}}let Cn=[`presentation`,`analysis`,`off`];function wn(e,t){if(e===void 0)return t;if(typeof e!=`string`)return e;if(!Cn.includes(e))throw TypeError(`Unknown motion mode "${String(e)}". Use one of: ${Cn.join(`, `)}.`);let n=()=>t.viewerChoice??(t.prefersReduced?`off`:e);return{get mode(){return n()},get staged(){return n()===`presentation`},duration(e,t=`transition`){let r=n();return r===`off`?0:m(e,u[r][t])},subscribe:e=>t.subscribe(e)}}let Tn=/* @__PURE__ */ new WeakMap,En=0;function Dn(e){let t=e.ownerDocument,n=(Tn.get(t)??0)+1;Tn.set(t,n);let r=Y(`mask`,{id:`ec-focus-mask-${n}`,maskUnits:`userSpaceOnUse`,x:-1e5,y:-1e5,width:2e5,height:2e5},e);Y(`rect`,{x:-1e5,y:-1e5,width:2e5,height:2e5,fill:`white`},r);let i=Y(`path`,{stroke:`black`,"stroke-linejoin":`round`},r),a=Y(`path`,{class:`ec-focus-ring`,visibility:`hidden`,"stroke-linejoin":`round`,mask:`url(#${r.id})`},e);return yt(a,{fill:`none`,stroke:rn(`focus`)}),{draw(e){if(!e){X(a,{visibility:`hidden`});return}let{outline:t,thickness:n,transform:r}=e,o=t.closed?0:n;X(i,{d:t.d,fill:t.closed?`black`:`none`,"stroke-width":o+4}),X(a,{d:t.d,"stroke-width":o+8,transform:r&&xt(r),visibility:void 0})}}}function On(){let e,t=()=>{e?.remove(),e=void 0};return{paint(n,r,i,a){if(!i||!n||r.length===0){t();return}e&&e.parentNode===n||(e?.remove(),e=Y(`g`,{class:`ec-halo`},n)),e.textContent=``;let o=`ec-halo-mask-${++En}`,s=Y(`mask`,{id:o,maskUnits:`userSpaceOnUse`,x:-1e5,y:-1e5,width:2e5,height:2e5},e);Y(`rect`,{x:-1e5,y:-1e5,width:2e5,height:2e5,fill:`white`},s);for(let e of r){let t=e.stroke===void 0?{fill:`black`}:{fill:`none`,stroke:`black`,"stroke-width":e.stroke,"stroke-linejoin":`round`};Y(`path`,{d:e.d,...t},s)}X(e,{transform:a&&xt(a)});for(let t of r){let n=t.stroke!==void 0;yt(Y(`path`,{d:t.d,"stroke-width":i.width+(t.stroke??0),"stroke-opacity":i.opacity,"stroke-linejoin":`round`,"stroke-linecap":n?`round`:void 0,mask:`url(#${o})`},e),{fill:`none`,stroke:i.color===void 0?t.color??rn(`mark`):rn(i.color)})}},remove:t}}function kn(e,t={}){let n={},r,i=t.halos&&On(),a=()=>{let t=e();if(!t)return;let{body:r,parts:i}=t;X(r,{transform:n.transform&&xt(n.transform),opacity:n.opacity});let a=n.emphasis;for(let e of i)yt(e.element,{[e.open?`stroke`:`fill`]:a===void 0?void 0:An(e.colors,a),transition:a===void 0?void 0:`none`});o(r,i)},o=(e,a)=>{let o=n.halo;if(i){let e=a.flatMap(e=>e.visible?[{d:e.d,color:e.colors.color,...e.open?{stroke:e.open.width}:{}}]:[]);i.paint(t.halos?.(),e,o,n.transform);return}if(!o){r?.remove(),r=void 0;return}r&&r.parentNode===e||(r?.remove(),r=Y(`g`,{class:`ec-halo`},e),e.insertBefore(r,e.firstChild));let s=a.filter(e=>e.visible);for(;r.childElementCount>s.length;)r.lastElementChild?.remove();s.forEach((e,t)=>{let n=r.children[t]??Y(`path`,{"stroke-linejoin":`round`},r);X(n,{d:e.d,"stroke-width":o.width+(e.open?.width??0),"stroke-opacity":o.opacity,"stroke-linecap":e.open?`round`:void 0}),yt(n,{fill:`none`,stroke:o.color===void 0?e.colors.color:rn(o.color)})})};return{get style(){return n},set(e){n=ct(n,e),a()},reset(){n={},a()},repaint:a}}function An(e,t){let n=Math.min(1,Math.max(0,t));return n===0?e.color:n===1?e.strong:`color-mix(in srgb, ${e.strong} ${Math.round(n*1e3)/10}%, ${e.color})`}let jn=0;function Mn(e,t){let n=()=>{if(!t)return e;let n=e.lastElementChild;if(n?.getAttribute(`class`)===`ec-follow`)return n;let r=t();return Y(`g`,{class:`ec-follow`,transform:r&&xt(r)},e)};return{icon(e,t){let r=t?.size;if(r!==void 0&&!(r>=0))throw RangeError(`layer.icon: size must be a non-negative number, got ${String(r)}.`);let i=Y(`g`,{class:`ec-icon`,"data-icon":e.name,visibility:`hidden`},n()),a=r===void 0||!(e.size>0)?1:r/e.size,o=a===1?i:Y(`g`,{transform:xt(J.scale(a,a,e.anchor))},i);for(let t of e.shapes)Nn(t,o);return{place(e){X(i,{transform:xt(e),visibility:void 0})},remove:()=>i.remove()}},path(e,t){let r=Y(`path`,{class:`ec-path`,d:e},n()),i={...t};return Pn(r,i),{update(e,t){r.setAttribute(`d`,e),t&&(i=ct(i,t),Pn(r,i))},remove:()=>r.remove()}},text(t,n){let r=Y(`text`,{class:`ec-text`},e);r.textContent=t;let i={...n};return Fn(r,i),{update(e,t){i=ct(i,e),Fn(r,i),t!==void 0&&(r.textContent=t)},remove:()=>r.remove()}}}}function Nn(e,t){let n;if(e.clip!==void 0){n=`ec-clip-${++jn}`;let r=Y(`clipPath`,{id:n},t);Y(`path`,{d:e.clip},r)}yt(Y(`path`,{d:e.d,"clip-path":n&&`url(#${n})`,"stroke-width":e.stroke===void 0?void 0:e.width??1,"stroke-linecap":e.linecap,"stroke-linejoin":e.linejoin,"fill-rule":e.fillRule,opacity:e.opacity,"fill-opacity":e.fillOpacity,"stroke-opacity":e.strokeOpacity},t),{fill:e.fill===void 0?`none`:rn(e.fill),stroke:e.stroke===void 0?void 0:rn(e.stroke)})}function Pn(e,t){X(e,{"stroke-width":t.stroke===void 0?void 0:t.width??1,opacity:t.opacity,"stroke-linecap":t.linecap,"stroke-linejoin":`round`}),yt(e,{fill:t.fill===void 0?`none`:rn(t.fill),stroke:t.stroke===void 0?void 0:rn(t.stroke)})}function Fn(e,t){X(e,{x:t.at.x,y:t.at.y,"text-anchor":t.anchor??`start`,opacity:t.opacity}),yt(e,{fill:rn(t.color??`text`)})}function In(e){let{overlay:t}=e,n=/* @__PURE__ */ new WeakMap,r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Set,o=/* @__PURE__ */ new Map,s=(e,t)=>{if(t)o.set(e,t);else if(!o.delete(e))return;for(let n of r.get(e)??[])for(let e of Array.from(n.children))e.getAttribute(`class`)===`ec-follow`&&X(e,{transform:t&&xt(t)})};return{group(s,c,l){let u=Y(`g`,{class:a.has(s)?`ec-run ec-hot`:`ec-run`,"data-key":s,"data-slot":c,visibility:i.has(s)?`hidden`:void 0},t);yt(u,an(e.colors(s))),n.set(u,l);let d=Array.from(t.children).find(e=>(n.get(e)??-1/0)>l);t.insertBefore(u,d??null);let f=r.get(s);f||r.set(s,f=/* @__PURE__ */ new Set),f.add(u);let p=f;return{...Mn(u,()=>o.get(s)),clear(){u.remove(),p.delete(u),p.size===0&&r.get(s)===p&&r.delete(s)}}},mark(t){let n=e.mark(t);return{set(e){n.set(e),`transform`in e&&s(t,e.transform)},reset(){n.reset(),s(t,void 0)}}},recolor(t){let n=r.get(t);if(!n)return;let i=an(e.colors(t));for(let e of n)yt(e,i)},hide(e,t){t?i.add(e):i.delete(e);for(let n of r.get(e)??[])X(n,{visibility:t?`hidden`:void 0})},hot(e,t){t?a.add(e):a.delete(e);for(let n of r.get(e)??[])n.classList.toggle(`ec-hot`,t)}}}function Ln(e,t){return e!==void 0&&Object.prototype.hasOwnProperty.call(e,t)?e[t]??t:t}function Rn(e,t){if(e!==void 0){if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(`${t}: seriesLabels must be an object of names by series, as { goals: "Goals" }.`);for(let[n,r]of Object.entries(e))if(typeof r!=`string`||r.trim()===``)throw TypeError(`${t}: seriesLabels.${n} must be a name, not ${typeof r==`string`?`blank`:String(r)}.`)}}function zn(e){let n={enter:/* @__PURE__ */ new Set,update:/* @__PURE__ */ new Set,exit:/* @__PURE__ */ new Set,hover:/* @__PURE__ */ new Set,leave:/* @__PURE__ */ new Set};function r(e,r){for(let i of[...n[e]])try{i(r)}catch(e){t(e)}}return{emit:r,emitEach(e,t,n){t.forEach((i,a)=>r(e,{...n(i),batch:{index:a,count:t.length}}))},on(t,r){let i=n[t];if(!i)throw TypeError(`${e}: unknown event "${String(t)}". Use one of: ${Object.keys(n).join(`, `)}.`);return i.add(r),()=>{i.delete(r)}},clear(){for(let e of Object.values(n))e.clear()}}}function Bn(e){return e.format??Hn}let Vn;function Hn(e){return Vn??(Vn=new Intl.NumberFormat(void 0,{maximumFractionDigits:2})),Vn.format(e)}function Un(e){let t=String(Number(e.toPrecision(12)));if(/e/i.test(t))return 6;let n=t.indexOf(`.`);return n<0?0:Math.min(6,t.length-n-1)}function Wn(e,t){let n=10**t,r=Math.round(e*n)/n;return r===0?0:r}function Gn(e){return`${Wn(e*100,0)}%`}function Kn(e,t){let n=e.ownerDocument,r,i=`mouse`,a,o,s,c=(e,n)=>{e?.key!==r&&(l(),e&&(r=e.key,t.hover(e,n)))},l=()=>{h(),r!==void 0&&(r=void 0,t.leave())},u=e=>{let n=t.tooltip?.();return n?.element&&e&&n.element.contains(e)?n:void 0},d=(t,n)=>{let r=e.getRootNode();return typeof r.elementFromPoint==`function`?r.elementFromPoint(t,n):void 0},f=e=>e.relatedTarget??d(e.clientX,e.clientY)??null,p=(n,r,i)=>{let a=u(n);a?m(a,r,i):c(n&&e.contains(n)?t.find(n):void 0,`pointer`)},m=(e,t,n)=>{c({key:e.key},`pointer`);let r=e.element;a?.element===r?(a.x=t,a.y=n):(h(),a={element:r,x:t,y:n},r.addEventListener(`pointermove`,g),r.addEventListener(`pointerleave`,_),o=new MutationObserver(v),o.observe(r,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))},h=()=>{a&&(a.element.removeEventListener(`pointermove`,g),a.element.removeEventListener(`pointerleave`,_),o?.disconnect(),o=void 0,a=void 0)},g=e=>{a&&e.pointerType!==`touch`&&(a.x=e.clientX,a.y=e.clientY)},_=e=>{e.pointerType!==`touch`&&(h(),p(f(e),e.clientX,e.clientY))},v=()=>{if(!a)return;let{x:e,y:n}=a,i=d(e,n);if(i===void 0)return;let o=t.tooltip?.(),c=o?.element!==void 0&&i!==null&&o.element.contains(i);c&&o.key===r||(h(),!c&&o?.key!==r?(s={x:e,y:n},l()):p(i,e,n))},y=e=>s&&Math.abs(e.clientX-s.x)<1&&Math.abs(e.clientY-s.y)<1?!0:(s=void 0,!1),b=e=>{e.pointerType===`touch`||y(e)||(h(),c(t.find(e.target),`pointer`))},x=e=>{e.pointerType!==`touch`&&(s=void 0,p(f(e),e.clientX,e.clientY))},S=e=>{e.pointerType!==`touch`&&y(e)},C=e=>{i=e.pointerType},w=e=>{i===`touch`&&c(t.find(e.target),`touch`)},T=t=>{if(r===void 0||t.pointerType!==`touch`)return;let n=t.composedPath()[0]??t.target;!e.contains(n)&&!u(n)&&l()};return e.addEventListener(`pointerover`,b),e.addEventListener(`pointerleave`,x),e.addEventListener(`pointermove`,S),e.addEventListener(`pointerdown`,C),e.addEventListener(`click`,w),n.addEventListener(`pointerdown`,T,!0),{get current(){return r},clear(){a&&(s={x:a.x,y:a.y}),l()},destroy(){h(),r=void 0,e.removeEventListener(`pointerover`,b),e.removeEventListener(`pointerleave`,x),e.removeEventListener(`pointermove`,S),e.removeEventListener(`pointerdown`,C),e.removeEventListener(`click`,w),n.removeEventListener(`pointerdown`,T,!0)}}}function qn(e,t){let n,r,i,a,o,s=[],c=!0,l=t.tabIndex??((e,n)=>{let r=t.element(e);n===void 0?r?.removeAttribute(`tabindex`):r?.setAttribute(`tabindex`,n)}),u=e=>{for(let t of e)l(t,t===o?`0`:`-1`)},d=e=>{o=e,u(t.order()),t.element(e)?.focus()},f=()=>{let e=r;r=void 0,e!==void 0&&t.blur(e)},p=e=>{e.metaKey||e.altKey||e.ctrlKey||(c=!0)},m=()=>{c=!1,a=void 0},h=e=>{a=void 0;let s=t.find(e.target);if(s===void 0){f();return}let l=t.element(s);l&&l!==e.target&&e.target.getAttribute(`aria-hidden`)===`true`&&(l.focus(),n?.scope.activeElement===l)||(i={key:s,element:e.target},s!==r&&(r=s,o=s,u(t.order()),t.focus(s,c)))},g=e=>{let n=i?.element;r!==void 0&&n&&e.target===n&&t.find(e.relatedTarget)===void 0&&(f(),e.relatedTarget===null&&(a=n,queueMicrotask(()=>{a===n&&n.isConnected&&(a=void 0)})))},_=e=>{let n=t.find(e.target);if(n===void 0||e.altKey||e.ctrlKey||e.metaKey)return;let r=t.order(),i=r.indexOf(n),a;switch(e.key){case`ArrowDown`:case`ArrowRight`:a=r[Math.min(r.length-1,i+1)];break;case`ArrowUp`:case`ArrowLeft`:a=r[Math.max(0,i-1)];break;case`PageDown`:case`PageUp`:{let o=e.key===`PageDown`?1:-1,s=t.page?.(n,o);a=s!==void 0&&r.includes(s)?s:r[Math.min(r.length-1,Math.max(0,i+o*Math.ceil(r.length/10)))];break}case`Home`:a=r[0];break;case`End`:a=r[r.length-1];break;case`Escape`:t.escape(n)&&e.preventDefault();return;default:return}e.preventDefault(),a!==void 0&&a!==n&&d(a)},v=()=>{n&&(n.doc.removeEventListener(`keydown`,p,!0),n.doc.removeEventListener(`pointerdown`,m,!0),n.scope.removeEventListener(`focusin`,h,!0),n.scope.removeEventListener(`focusout`,g,!0),n.svg.removeEventListener(`keydown`,_),n=void 0)},y=()=>{let t=e(),r=t?.getRootNode(),i=r&&`host`in r?r:t?.ownerDocument;(t!==n?.svg||i!==n?.scope)&&(v(),t&&i&&(n={svg:t,doc:t.ownerDocument,scope:i},n.doc.addEventListener(`keydown`,p,!0),n.doc.addEventListener(`pointerdown`,m,!0),n.scope.addEventListener(`focusin`,h,!0),n.scope.addEventListener(`focusout`,g,!0),n.svg.addEventListener(`keydown`,_)))};return y(),{active:()=>n?.scope.activeElement??null,focus(e){c=!0,e===r&&i?.element===n?.scope.activeElement?t.focus(e,!0):d(e)},sync(){y();let e=t.order(),c=new Set(e),p=s.filter(e=>!c.has(e));o!==void 0&&c.has(o)||(o=Jn(s,o,c)??e[0]);let m=!n?.doc.activeElement||n.doc.activeElement===n.doc.body,h=i!==void 0&&!i.element.isConnected&&(r!==void 0||i.element===a&&m),g=i&&(i.element===n?.scope.activeElement||h)?i:void 0;a=void 0,g&&!c.has(g.key)?o===void 0?g.element.isConnected?g.element.blur():f():d(o):g&&t.find(g.element)!==g.key&&d(g.key),u(e);for(let e of p)l(e,void 0);s=e},destroy(){r=void 0,i=void 0,a=void 0,v()}}}function Jn(e,t,n){let r=t===void 0?-1:e.indexOf(t);if(!(r<0))for(let t=1;t<e.length;t++)for(let i of[r+t,r-t]){let t=e[i];if(t!==void 0&&n.has(t))return t}}function Yn(e){let{svg:t,runner:n,events:r}=e,i=t=>e.marks?.(t)??[t],a=t=>(e.markElement??e.element)(t),o=(t,n)=>{a(t)?.classList.toggle(`ec-hot`,n),e.hot?.(t,n)},s,c,l,u=!1,d=t=>t.flatMap(t=>{let n=e.onScreen(t);return n?[{key:t,input:n}]:[]}),f=e=>e.length===1?i(e[0]):[...new Set(e.flatMap(i))];function p(e,t,i,a){if(e.length===0)return;i&&n.hover(e.map(({input:e})=>e));let o=e.length;e.forEach(({input:e},n)=>r.emit(`hover`,{...e,batch:{index:n,count:o},source:t,...a===void 0?{}:{segment:a}}))}function m(e){for(let t of e)o(t,!1);let t=d(e);if(t.length===0)return;n.leave(t.map(({key:e})=>e));let i=t.length;t.forEach(({input:e},t)=>r.emit(`leave`,{...e,batch:{index:t,count:i}}))}function h(n,r,i,a=!0){let c=d(f(n)),u={keys:n,source:r,marks:c.map(e=>e.key),effects:a};s=u;for(let{key:e}of c)o(e,!0);e.dim()&&t.classList.add(`ec-hovering`),r!==`linked`&&(e.tooltip.show(n[0]),y(!0)),p(c,r,a,i),r!==`linked`&&s===u&&l?.hover(c.map(({input:e})=>e))}function g(){let n=s;s=void 0,y(!1),t.classList.remove(`ec-hovering`),e.tooltip.hide(),m(n?.marks??[]),gn(n)&&l?.leave()}let _,v=e=>{e.key===`Escape`&&!e.defaultPrevented&&s!==void 0&&b()};function y(e){_?.removeEventListener(`keydown`,v),_=e?t.ownerDocument:void 0,_?.addEventListener(`keydown`,v)}function b(){S.clear(),s!==void 0&&g()}let x=(t,n)=>n===t||e.live(t)&&i(t).includes(n),S=Kn(t,{find:e.find,hover(t,n){!e.live(t.key)||gn(s)&&s.keys[0]===t.key||(g(),h([t.key],n,t.segment))},leave(){(s?.source===`pointer`||s?.source===`touch`)&&g()},tooltip:()=>gn(s)?{key:s.keys[0],element:e.tooltip.element?.()}:void 0}),C=qn(()=>t,{find:t=>e.find(t)?.key,order:e.order,page:(t,n)=>e.page?.(t,n),element:e.element,focus(t,n){c=n?t:void 0,e.ring(c),e.live(t)&&(n?gn(s)&&s.keys[0]===t?s={...s,source:`keyboard`}:(g(),h([t],`keyboard`)):s?.source===`keyboard`&&s.keys[0]!==t&&g())},blur(){c=void 0,e.ring(c),s?.source===`keyboard`&&(S.current===s.keys[0]?s={...s,source:`pointer`}:g())},escape(){return s?(s.source===`linked`&&l?l.dismiss():g(),!0):!1}});return{get key(){return gn(s)?s.keys[0]:void 0},get ringKey(){return c},link:{targets:()=>e.order().map(e=>({key:e,marks:d(i(e)).map(({input:e})=>e)})),hover(t,n){s!==void 0&&g();let r=t.filter(e.live);r.length>0&&h(r,`linked`,void 0,n)},unlink(){s?.source===`linked`&&g()},leave:b,listen(e){return!u&&(l=e,!0)}},active:()=>C.active(),restyled(t){c!==void 0&&x(c,t)&&e.ring(c);let n=gn(s)?s.keys[0]:void 0;n!==void 0&&(s?.marks.includes(t)||t===n)&&e.live(n)&&e.tooltip.show(n)},syncDim(){e.dim()?s!==void 0&&t.classList.add(`ec-hovering`):t.classList.remove(`ec-hovering`)},dropGone(){if(s===void 0)return;let t=s.keys.filter(e.live);if(t.length===0){S.clear(),g();return}let{source:i,marks:a,effects:c}=s,l=d(f(t));if(s={...s,keys:t},l.length===a.length&&l.every((e,t)=>e.key===a[t]))return;let u=new Set(a),p=new Set(l.map(e=>e.key)),m=d(a.filter(e=>!p.has(e)));s={...s,marks:l.map(e=>e.key)};for(let e of a)p.has(e)||o(e,!1);for(let{key:e}of l)u.has(e)||o(e,!0);n.leave(a),c&&n.hover(l.map(({input:e})=>e)),m.forEach(({input:e},t)=>r.emit(`leave`,{...e,batch:{index:t,count:m.length}}));let h=l.length;l.forEach(({key:e,input:t},n)=>{u.has(e)||r.emit(`hover`,{...t,batch:{index:n,count:h},source:i})})},sync:()=>C.sync(),focus(t){e.live(t)&&C.focus(t)},leave:b,destroy(){u=!0,l?.gone(),l=void 0,y(!1),S.destroy(),C.destroy()}}}function Xn(e,t,n,r){return!n||n.text===``?[]:[{key:e,role:t,text:n.text,x:n.x,y:n.y,anchor:n.anchor,element:r}]}function Zn(e){let t=/* @__PURE__ */ new Map;return{get:e=>t.get(e),values:()=>t.values(),start(e){t.set(e.key,e),e.group.classList.add(`ec-leaving`),e.group.setAttribute(`aria-hidden`,`true`),e.leave=Qn()},recall(e){let n=t.get(e);if(n)return t.delete(e),n.group.classList.remove(`ec-leaving`),n.group.removeAttribute(`aria-hidden`),n.leave?.resolve(),n.leave=void 0,n},sweep(){for(let n of[...t.values()]){let{leave:r}=n;r?.exited&&!e(n)&&(t.delete(n.key),n.leave=void 0,n.group.remove(),r.resolve())}},clear:()=>t.clear()}}function Qn(){let e;return{exited:!1,gone:new Promise(t=>{e=t}),resolve:e}}function $n(e,t,n,r){if(!n.some((e,n)=>t[n]!==e))return;let i=r(),a=n.findIndex(e=>e===i),o=n[a]??null;n.forEach((t,n)=>{n<a?e.insertBefore(t,o):n>a&&e.appendChild(t)})}function er(e,t){if(e===void 0||typeof e==`boolean`||e===`hidden`)return;let n=e=>{throw TypeError(`${t}: ${e}`)};typeof e==`object`&&e||n(`table must be true, false, "hidden" or an object of table options.`);let{hidden:r,columns:i,category:a,total:o,share:s,summary:c,series:l}=e;r!==void 0&&typeof r!=`boolean`&&n(`table.hidden must be true or false.`);for(let[e,t]of Object.entries({category:a,total:o,share:s,summary:c}))t!==void 0&&typeof t!=`string`&&n(`table.${e} must be a string.`);if(l!==void 0){(typeof l!=`object`||!l||Array.isArray(l))&&n(`table.series must be an object of headers by series, as { shots: "Shots" }.`);for(let[e,t]of Object.entries(l))typeof t!=`string`&&n(`table.series.${e} must be a string: the column's header.`)}i!==void 0&&(Array.isArray(i)||n(`table.columns must be an array of { label, field }.`),i.forEach((e,t)=>{let r=typeof e==`object`&&e?e:n(`table.columns[${t}] must be an object with a label and a field.`);typeof r.label!=`string`&&n(`table.columns[${t}].label must be a string: the column's header.`),typeof r.field!=`string`&&typeof r.field!=`function`&&n(`table.columns[${t}].field must be a field name or a function of the row.`),r.format!==void 0&&typeof r.format!=`function`&&n(`table.columns[${t}].format must be a function.`),r.after!==void 0&&r.after!==`category`&&r.after!==`values`&&n(`table.columns[${t}].after must be "category" or "values".`)}))}function tr(e){let{option:t,format:n}=e;if(t===!1)return;let r=typeof t==`object`?t:{},i=r.columns??[],a=i.filter(e=>e.after!==`values`),o=i.filter(e=>e.after===`values`),s=e.total??e.series.length>1,c=e=>({text:n(e),numeric:!0}),l=e.rows.reduce((e,t)=>e+t.total,0),u=t=>e.shares?[{text:Gn(l>0?t/l:0),numeric:!0}]:[],d=e=>({text:e.label,numeric:!1}),f=e=>r.series&&Object.prototype.hasOwnProperty.call(r.series,e)?r.series[e]:void 0,p=()=>({text:``,numeric:!1}),m=[{text:r.category??e.category??`Category`,numeric:!1},...a.map(d),...e.series.map(t=>({text:f(t)??e.label?.(t)??t,numeric:!0})),...s?[{text:r.total??`Total`,numeric:!0}]:[],...e.shares?[{text:r.share??`Share`,numeric:!0}]:[],...o.map(d)],h=e.rows.map(t=>{let r=new Map(t.values.map(e=>[e.series,e.value]));return{key:t.key,cells:[{text:t.category,numeric:!1},...a.map(e=>nr(e,t,n)),...e.series.map(e=>t.missing?.has(e)?{text:`missing`,numeric:!0}:c(r.get(e)??0)),...s?[c(t.total)]:[],...u(t.total),...o.map(e=>nr(e,t,n))]}}),g=t=>e.rows.reduce((e,n)=>e+(n.values.find(e=>e.series===t)?.value??0),0),_=e.shares?[{text:r.total??`Total`,numeric:!1},...a.map(p),...e.series.map(e=>c(g(e))),...s?[c(l)]:[],...u(l),...o.map(p)]:void 0,v=m.length-o.length,y=[...a.map((e,t)=>1+t),...o.map((e,t)=>v+t)];for(let e of y){let t=h.map(t=>t.cells[e]).filter(e=>e.text!==``);t.length>0&&t.every(e=>e.numeric)&&(m[e]={...m[e],numeric:!0})}return{hidden:t===`hidden`||r.hidden===!0,summary:r.summary??`Data table`,caption:e.caption,headers:m,rows:h,..._?{footer:_}:{}}}function nr(e,t,n){let r=typeof e.field==`function`?e.field(t.datum,t.index):t.datum?.[e.field];return e.format?{text:String(e.format(r)),numeric:typeof r==`number`}:r==null?{text:``,numeric:!1}:typeof r==`number`?{text:n(r),numeric:!0}:{text:String(r),numeric:!1}}function rr(e){let t=e.ownerDocument,n,r,i,a,o,s,c,l=/* @__PURE__ */ new Map,u=``,d=(e,n)=>{let r=t.createElement(e);return n&&(r.className=n),r};function f(){i=d(`table`),a=d(`caption`,`ec-table-caption`);let e=d(`thead`);return o=d(`tr`),e.appendChild(o),s=d(`tbody`),i.append(a,e,s),i}function p(t,a){let o=t?`DIV`:`DETAILS`;if(n?.tagName!==o){let e=t?d(`div`,`ec-table ec-visually-hidden`):d(`details`,`ec-table`),a=i??f();if(t)r=void 0,e.appendChild(a);else{r=d(`summary`);let t=d(`div`,`ec-table-scroll`);t.appendChild(a),e.append(r,t)}n?.isConnected&&n.replaceWith(e),n=e}n.isConnected||e.after(n),r&&r.textContent!==a&&(r.textContent=a)}function m(e,{text:t,numeric:n}){e.textContent!==t&&(e.textContent=t),e.classList.toggle(`ec-num`,n)}function h(){n?.remove(),n=r=i=a=o=s=c=void 0,l.clear(),u=``}return{render(e){if(!e){h();return}p(e.hidden,e.summary),a.textContent!==e.caption&&(a.textContent=e.caption);let t=JSON.stringify(e.headers);t!==u&&(u=t,o.replaceChildren(...e.headers.map(e=>{let t=d(`th`);return t.scope=`col`,m(t,e),t})),l.clear(),s.replaceChildren());let n=new Set(e.rows.map(e=>e.key));for(let[e,t]of l)n.has(e)||(t.remove(),l.delete(e));if(e.rows.forEach((e,t)=>{let n=l.get(e.key);n||(n=d(`tr`),n.setAttribute(`data-key`,e.key),e.cells.forEach((e,t)=>{let r=d(t===0?`th`:`td`);t===0&&(r.scope=`row`),n.appendChild(r)}),l.set(e.key,n)),e.cells.forEach((e,t)=>m(n.cells[t],e)),s.children[t]!==n&&s.insertBefore(n,s.children[t]??null)}),!e.footer){c?.remove(),c=void 0;return}let r=e.footer,f=c?.rows[0];c&&f&&f.cells.length===r.length||(c?.remove(),c=d(`tfoot`),f=d(`tr`),r.forEach((e,t)=>{let n=d(t===0?`th`:`td`);t===0&&(n.scope=`row`),f.appendChild(n)}),c.appendChild(f),i.appendChild(c)),r.forEach((e,t)=>m(f.cells[t],e))},destroy:h}}function ir(e,t){if(typeof e==`string`){let n=typeof document>`u`?null:document.querySelector(e);if(!n)throw TypeError(`${t}: no element matches "${e}".`);return n}if(!e||typeof e.appendChild!=`function`)throw TypeError(`${t} needs a container element or a selector.`);return e}function ar(e){let t=e.ownerDocument.defaultView?.getComputedStyle(e),n=(parseFloat(t?.paddingLeft??``)||0)+(parseFloat(t?.paddingRight??``)||0),r=e.clientWidth-n;return r>0?r:640}function or(e,t){e.setAttribute(`aria-label`,t.label);let n=e.querySelector(`:scope > desc`);t.description?(n??(n=e.insertBefore(Y(`desc`,{},e),e.firstChild)),n.textContent=t.description):n?.remove()}function sr(e,t,n){for(let r of it){let i=e[r];if(i?.kind===`data`){for(let e of i.needs?.related??[])if(!t.includes(e))throw RangeError(`${n}: on.${r} needs the series "${e}", but the chart's series are ${t.map(e=>`"${e}"`).join(`, `)}.`)}}}function cr(e,t,n,r){let i=e=>it.includes(e)&&n?.[e]!==void 0&&n[e]===t?.[e],a=at(Object.fromEntries(Object.entries(n??{}).filter(([e])=>!i(e))),r),o={};for(let t of it){let n=i(t)?e[t]:a[t];n&&(o[t]=n)}return o}function lr(e,t){if(typeof e!=`object`||!e)throw TypeError(`${t} needs options.`);if(typeof e.label!=`string`||e.label.trim()===``)throw TypeError(`${t} needs a label: the chart's accessible name.`);if(!Array.isArray(e.data))throw TypeError(`${t}: data must be an array of rows.`);for(let n of[`width`,`height`]){let r=e[n];if(r!==void 0&&!(typeof r==`number`&&Number.isFinite(r)&&r>0))throw RangeError(`${t}: ${n} must be a positive number of px, got ${String(r)}.`)}let{format:n,tooltip:r,markLabel:i,markDescription:a,legend:o,announce:s}=e;if(n!==void 0&&typeof n!=`function`)throw TypeError(`${t}: format must be a function that turns a value into text.`);if(r!==void 0&&typeof r!=`boolean`&&typeof r!=`function`)throw TypeError(`${t}: tooltip must be true, false or a function that returns a row's text.`);if(i!==void 0&&typeof i!=`function`)throw TypeError(`${t}: markLabel must be a function that returns a mark's accessible name.`);if(a!==void 0&&a!==!1&&typeof a!=`function`)throw TypeError(`${t}: markDescription must be false or a function that returns a mark's accessible description.`);if(pn(o,t),Rn(e.seriesLabels,t),er(e.table,t),s!==void 0&&typeof s!=`boolean`&&typeof s!=`function`)throw TypeError(`${t}: announce must be true, false or a function that returns the text to announce.`)}function ur(e){let{clock:t}=e,n,r=0,i,a,o=!1;function s(t){if(o||n?.id!==t)return;let{waiters:r}=n;n=void 0,i?.(),i=void 0,e.land(),e.runner.settle(),e.leaving.sweep();for(let e of r)e()}return{run(a){e.draw();let o=++r;return new Promise(r=>{n={id:o,waiters:[...n?.waiters??[],r]},a.length===0?s(o):(i?.(),i=t.onFrame(()=>e.draw()),Promise.all(a).then(()=>s(o)))})},supersede:()=>a?.(),wait(e,t){return new Promise(n=>{a=n,e.then(()=>Promise.all(t.map(e=>e.gone))).then(()=>n())})},destroy(){o=!0,n=void 0,i?.(),a?.()}}}function dr(e,t,n){let{runner:r,events:i,input:a,onScreen:o}=e;r.interrupt();let s=t();e.swap?.(s),e.hover.dropGone();let c=s.exiting.map(e=>e.leave);return r.exit(s.exiting.map(o)).then(()=>{for(let e of c)e.exited=!0;e.leaving.sweep()}),i.emitEach(`exit`,s.exiting,o),(e.data||s.changed.length>0||s.entering.length>0||s.exiting.length>0)&&r.update(s.changed.map(({record:e,from:t})=>({...a(e),from:t}))),i.emitEach(`update`,s.changed,({record:e,from:t})=>({...a(e),from:t})),r.enter(s.entering.map(a)),i.emitEach(`enter`,s.entering,a),n(s),e.hover.sync(),c}function Q(e,t,n){return e.animating||!n(e.value,t)}let $=(e,t)=>e===t;function fr(e,t){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])}function pr(e,t){if(e.outline.d!==t.outline.d||mr(e,t))return!0;let n=e.segments??[],r=t.segments??[];return n.length!==r.length||n.some((e,t)=>e.key!==r[t].key||e.outline.d!==r[t].outline.d)}function mr(e,t){let n=e.labelBounds,r=t.labelBounds;return n===r?!1:!n||!r||n.length!==r.length||n.some((e,t)=>e.x!==r[t].x||e.y!==r[t].y||e.width!==r[t].width||e.height!==r[t].height)}function hr(e,t,n,r){if(typeof ResizeObserver!=`function`)return()=>{};let i=n,a=n,o,s=new ResizeObserver(e=>{let n=e[e.length-1]?.contentRect.width??0;!(n>0)||Math.abs(n-a)<.5||(a=n,o??(o=t.onFrame(()=>{o?.(),o=void 0,!(Math.abs(a-i)<.5)&&(i=a,r(i))})))});return s.observe(e),()=>{s.disconnect(),o?.()}}function gr(e,t){let n=e.fonts;return n?.addEventListener?.(`loadingdone`,t),()=>n?.removeEventListener?.(`loadingdone`,t)}function _r(e,t){let n=()=>e.style.setProperty(`--ec-hover-duration`,`${t.duration(100,`feedback`)}ms`);return n(),t.subscribe(n)}let vr=0;function yr(e,t,n,r){let i=e.top-12,a=n.height-e.bottom-12;return r??(r=t.height<=i||i>=a?`above`:`below`),{x:Math.max(0,Math.min(n.width-t.width,e.x-t.width/2)),y:r===`above`?i-t.height:e.bottom+12,side:r}}function br(e,t,n,r={}){let i=t.length===1&&t[0].series===`value`&&(t[0].label??`value`)===`value`,a=[t.map(e=>i?n(e.value):`${n(e.value)} ${e.label??e.series}`).join(` · `)];return t.length>1&&r.total!==!1&&a.push(`${n(t.reduce((e,t)=>e+t.value,0))} total`),{title:e,lines:a}}function xr(e,n){let r,i,a,o=/* @__PURE__ */ new WeakMap,s,c,l=!1,u,d=e=>e.style.setProperty(`--ec-hover-duration`,`${n.motion.duration(100,`feedback`)}ms`),f=()=>i?.classList.contains(`ec-tooltip-shown`)??!1,p=()=>{if(!c||!i||!r)return!1;let{x:e,y:t}=c,{left:n,right:a,top:o,bottom:s}=i.getBoundingClientRect();if(e>n&&e<a&&t>o&&t<s)return!0;if(!u)return!1;let l=r.getBoundingClientRect();return Sr(u,e-l.left,t-l.top)},m=e=>{l=e,r?.classList.toggle(`ec-tooltip-through`,e)},h=e=>{c=e.pointerType===`touch`?void 0:{x:e.clientX,y:e.clientY},l&&!p()&&m(!1)};e.ownerDocument.addEventListener(`pointerover`,h,!0),e.ownerDocument.addEventListener(`pointermove`,h,!0);function g(){if(!r||!i||!a){let t=e.ownerDocument;r=t.createElement(`div`),r.className=`ec-tooltip-layer`,i=t.createElement(`div`),i.className=`ec-tooltip`,i.setAttribute(`aria-hidden`,`true`),a=t.createElement(`div`),a.className=`ec-tooltip-bridge`,a.setAttribute(`aria-hidden`,`true`),r.append(i,a)}return r.previousSibling!==e&&e.after(r),i}function _(e,t){let r=n.option(),i=o.get(e);if(i&&i.option===r)return i.content;let a=wr(r,e.datum,t);return o.set(e,{option:r,content:a}),a}function v(){i&&(d(i),i.classList.remove(`ec-tooltip-shown`),m(!1))}function y(t,n,i,o){let c=_(t,n);if(c===void 0){v();return}let h=g(),y=f()&&!l&&p(),b=typeof c==`string`?`text:${c}`:JSON.stringify(c);b!==s&&(Tr(h,c),s=b);let x=Er(e),S=e.getBoundingClientRect(),C=S.width>0&&x.width>0?S.width/x.width:1,w={x:e=>(e-x.x)*C,y:e=>(e-x.y)*C},T=S.width>0?{width:S.width,height:S.height}:{width:x.width,height:x.height},E={width:h.offsetWidth,height:h.offsetHeight},D=i(w,o),O=yr(D,E,T,o?yr(i(w,!1),E,T).side:void 0),k=r.getBoundingClientRect(),A=S.left-k.left,j=S.top-k.top,M=Math.round(A+O.x),N=Math.round(j+O.y);h.style.left=`${M}px`,h.style.top=`${N}px`,h.setAttribute(`data-side`,O.side);let P=D.left===void 0||D.right===void 0?void 0:{left:A+D.left,right:A+D.right,top:j+D.top,bottom:j+D.bottom};u=Cr(a,{left:M,top:N,...E},P,O.side),d(h),h.classList.add(`ec-tooltip-shown`),m(!y&&p())}return{show(e,t,n,r){y(t,n,(t,n)=>{let i=n?r:void 0,{x:a,y:o,width:s,height:c}=e.bounds,l=[{x:a,y:o},{x:a+s,y:o},{x:a,y:o+c},{x:a+s,y:o+c}].map(e=>i?J.apply(i,e):e),u=l.map(e=>e.x),d=l.map(e=>e.y),f=i?J.apply(i,e.center):e.center;return{x:t.x(f.x),top:t.y(Math.min(...d)),bottom:t.y(Math.max(...d)),left:t.x(Math.min(...u)),right:t.x(Math.max(...u))}},r!==void 0)},showAt(e,t,n){y(t,n,t=>({x:t.x(e.x),top:t.y(e.top),bottom:t.y(e.bottom)}),!1)},describe(e,r){let i=n.description?.(),a;if(i===!1)a=void 0;else if(typeof i==`function`)try{let e=i(r.datum);a=typeof e==`string`&&e!==``?e:void 0}catch(e){t(e),a=void 0}else a=typeof n.option()==`function`?_(r,()=>``):void 0;let o=e.querySelector(`:scope > desc.ec-description`);if(typeof a!=`string`){if(!o)return;e.getAttribute(`aria-describedby`)===o.id&&e.removeAttribute(`aria-describedby`),o.remove()}else o??(o=Y(`desc`,{class:`ec-description`,id:`ec-description-${++vr}`},e)),o.textContent!==a&&(o.textContent=a),e.setAttribute(`aria-describedby`,o.id)},element:()=>f()?r:void 0,hide:v,destroy(){e.ownerDocument.removeEventListener(`pointerover`,h,!0),e.ownerDocument.removeEventListener(`pointermove`,h,!0),r?.remove(),r=void 0,i=void 0,a=void 0,u=void 0,l=!1,o=/* @__PURE__ */ new WeakMap,s=void 0}}}function Sr({top:e,bottom:t,upper:n,lower:r},i,a){if(a<=e||a>=t)return!1;let o=(a-e)/(t-e);return i>n.left+(r.left-n.left)*o&&i<n.right+(r.right-n.right)*o}function Cr(e,t,n,r){if(e.hidden=n===void 0,!n)return;let i={left:t.left,right:t.left+t.width},[a,o,s,c]=r===`above`?[i,n,t.top+t.height,Math.round(n.top+1)]:[n,i,Math.round(n.bottom-1),t.top],l=Math.round(Math.min(a.left,o.left)),u=Math.round(Math.max(a.right,o.right))-l,d=Math.max(0,c-s),f=e=>`${Math.round(e)-l}px`;e.style.left=`${l}px`,e.style.top=`${s}px`,e.style.width=`${u}px`,e.style.height=`${d}px`,e.style.setProperty(`clip-path`,`polygon(${f(a.left)} 0px, ${f(a.right)} 0px, ${f(o.right)} ${d}px, ${f(o.left)} ${d}px)`);let p=e=>({left:Math.round(e.left),right:Math.round(e.right)});return{top:s,bottom:s+d,upper:p(a),lower:p(o)}}function wr(e,n,r){if(e!==!1){if(typeof e!=`function`)return r();try{let t=e(n);return t==null||t===``?void 0:String(t)}catch(e){t(e);return}}}function Tr(e,t){if(typeof t==`string`){e.textContent=t;return}let n=e.ownerDocument,r=(e,t)=>{let r=n.createElement(`div`);return t&&(r.className=t),r.textContent=e,r};e.replaceChildren(r(t.title,`ec-tooltip-title`),...t.lines.map(e=>r(e)))}function Er(e){let t=(e.getAttribute(`viewBox`)??``).split(/[\s,]+/).map(Number);return t.length===4&&t.every(Number.isFinite)?{x:t[0],y:t[1],width:t[2],height:t[3]}:{x:0,y:0,width:Number(e.getAttribute(`width`))||0,height:Number(e.getAttribute(`height`))||0}}function Dr(e,n,r){let i=ir(e,`barChart`);Or(n);let o=n,s=wn(n.motion,r.motion),c=at(n.on,r.presets),l=fn(n.colors),u=r.clock??a,d=i.ownerDocument;un(d);let f=Y(`svg`,{class:`ec-chart ec-bar-chart`,role:`group`},i),p=Y(`g`,{class:`ec-grid`,"aria-hidden":`true`},f),m=Y(`g`,{class:`ec-axis`,"aria-hidden":`true`},f),h=Y(`g`,{class:`ec-focus`,"aria-hidden":`true`,visibility:`hidden`},f),g=[Y(`path`,{class:`ec-focus-ring`,"stroke-width":8,"stroke-linejoin":`round`},h),Y(`path`,{class:`ec-focus-gap`,"stroke-width":4,"stroke-linejoin":`round`},h)],_=Y(`g`,{class:`ec-marks`},f),v=Y(`g`,{class:`ec-overlay`,"aria-hidden":`true`},f),y=Et(f),x=[],w=/* @__PURE__ */ new Map,T=Zn(e=>e.values.animating||e.presence.animating),E=/* @__PURE__ */ new WeakMap,D=zn(`barChart`),O=ar(i),k=!1,A,j;try{A=ie(o),j=le(o,A)}catch(e){throw f.remove(),e}let M=e=>w.get(e)??T.get(e),N=In({overlay:v,mark:e=>({set:t=>{M(e)?.handle.set(t),q.restyled(e)},reset:()=>{M(e)?.handle.reset(),q.restyled(e)}}),colors:e=>M(e)?.parts[0]?.colors}),P=pt({effects:c,motion:s,icons:r.icons,clock:u,surface:N}),F=xr(f,{motion:s,option:()=>o.tooltip,description:()=>o.markDescription}),I=hn(f),ee=rr(f),L=o.announce?vt(f):void 0,R=A.orientation,z=/* @__PURE__ */ new Map,B=/* @__PURE__ */ new Set,V=!1,te=!1,H=C(A.frame.scale,S,{clock:u,motion:s,onChange:()=>V=!0}),ne=C(A.frame.bands,S,{clock:u,motion:s,onChange:()=>V=!0}),re=ur({clock:u,runner:P,leaving:T,draw:pe,land:me});function ie(e,t=c){let n=jt(e);return sr(t,n.series.map(e=>e.series),`barChart`),Mt({data:e.data,encoding:n,sort:e.sort,width:e.width??O,height:e.height,format:Bn(e),measure:y,room:e.room??0})}function ae(e,t){let n=Y(`g`,{class:`ec-mark`,"data-key":e.key,role:`img`},_),r={clock:u,motion:s,onChange:()=>B.add(a)},i=Nr(e),a={key:e.key,row:e,shown:e,group:n,hit:Y(`rect`,{class:`ec-hit`},n),label:Y(`text`,{class:`ec-label`,"aria-hidden":`true`},n),body:Y(`g`,{class:`ec-body`},n),value:Y(`text`,{class:`ec-value`,"aria-hidden":`true`},n),paths:/* @__PURE__ */ new Map,parts:[],handle:kn(()=>a),values:C(t?Pr(i):i,S,r),series:e.values.map(e=>e.series),slot:C(e.slot,b,r),presence:C(+!t,b,r),count:void 0,leave:void 0};return E.set(n,a),oe(a,t?K(a,ue()):e),a}function oe(e,t){let n=e.parts[0]?.colors.color;e.shown=t,X(e.hit,{...t.hit}),Tt(e.label,t.label),Tt(e.value,t.value);let r=e.presence.value,i=r<1?r:void 0;X(e.label,{opacity:i}),X(e.value,{opacity:i});let a=t.geometry.segments??[],s=/* @__PURE__ */ new Set,c=kr(o)?nn(l.slot(e.key)):void 0;e.parts=a.map(t=>{let n=t.series??t.key;s.add(n);let r=e.paths.get(n);r||(r=Y(`path`,{class:`ec-segment`,"data-series":n},e.body),e.paths.set(n,r));let i=c??nn(l.slot(n));return r.setAttribute(`d`,t.outline.d),yt(r,an(i)),{element:r,d:t.outline.d,colors:i,visible:t.length>=.5}});for(let[t,n]of e.paths)s.has(t)||(n.remove(),e.paths.delete(t));let u=Array.from(e.body.children).filter(e=>e.classList.contains(`ec-segment`));if(e.parts.some((e,t)=>u[t]!==e.element))for(let t of e.parts)e.body.appendChild(t.element);e.handle.repaint(),e.parts[0]?.colors.color!==n&&N.recolor(e.key),e.key===q.ringKey&&U(e.key)}function U(e){let t=e===void 0?void 0:w.get(e);if(!t){h.setAttribute(`visibility`,`hidden`);return}for(let e of g)e.setAttribute(`d`,t.shown.geometry.outline.d);let{transform:n}=t.handle.style;X(h,{transform:n&&xt(n),visibility:void 0})}function W(e,t){let n=pr(e.shown.geometry,t.geometry)||e.shown.datum!==t.datum;oe(e,t),n&&P.change(t.geometry,t.data),e.key===q.key&&se(e)}function se(e){let{row:t}=e;F.show(e.shown.geometry,t,()=>br(t.category,jr(t.values,o),Bn(o)),e.handle.style.transform)}function ce(e){kr(o)?I.categories(e.rows.map(e=>({key:e.key,label:e.category})),l,o.legend):I.update(jt(o).series.map(e=>({series:e.series,label:Ln(o.seriesLabels,e.series)})),l,o.legend)}function le(e,t){let n=jt(e),r=n.orientation===`horizontal`?e.y:e.x;return tr({option:e.table,caption:e.label,category:typeof r==`string`?r:void 0,series:n.series.map(e=>e.series),label:t=>Ln(e.seriesLabels,t),rows:t.rows.map(e=>({key:e.key,category:e.category,datum:e.datum,index:e.index,values:e.values,total:e.total})),format:Bn(e)})}function G(e,n){let r=o.announce;if(!L||!r)return;let i=jt(o).series.map(e=>e.series),a=jt(e).series.map(e=>e.series),s=Ir(o.sort),c=e=>e.row.category,l=n.changed.map(({record:e})=>e),u=gt({...o.label===e.label?{}:{label:o.label},...i.join(`
|
|
90
|
+
`)===a.join(`
|
|
91
|
+
`)?{}:{series:i.map(e=>Ln(o.seriesLabels,e))},...s!==Ir(e.sort)||s===`custom`&&o.sort!==e.sort?{sort:s}:{},changed:l.map(c),added:n.entering.map(c),removed:n.exiting.map(c),count:x.length});if(typeof r!=`function`){L.say(u);return}let d=e=>e.key;try{let e=r({text:u,changed:l.map(d),added:n.entering.map(d),removed:n.exiting.map(d)});e!=null&&L.say(String(e))}catch(e){t(e)}}let ue=()=>({orientation:R,scale:H.value,bands:ne.value});function K(e,t){let{row:n}=e,r=e.values.value,i=e.series.map(e=>({series:e,value:r[e]??0})),a=i.reduce((e,t)=>e+t.value,0),s=e.count===void 0?n.value.text:Bn(o)(Wn(a,e.count));return Rt(t,{key:n.key,datum:n.datum,index:n.index,category:n.category,values:i,slot:e.slot.value,text:s,drawn:n.drawn},y)}function de(e,t){let n={value:e,line:Y(`line`,{class:e===0?`ec-baseline`:`ec-gridline`},p),label:Y(`text`,{class:`ec-tick`},m),opacity:C(t,b,{clock:u,motion:s,onChange:()=>te=!0}),wanted:!0};z.set(e,n);for(let e of[...z.values()].sort((e,t)=>e.value-t.value))p.appendChild(e.line),m.appendChild(e.label)}function fe(e,t){let n=zt(t,e.value,Bn(o)(e.value)),r=e.opacity.value<1?e.opacity.value:void 0;X(e.line,{...n.line,opacity:r}),Tt(e.label,n.label),X(e.label,{opacity:r})}function pe(){let e=ue();if(V&&X(f,bt(e.bands)),V||te)for(let t of z.values())fe(t,e);for(let t of[...x,...T.values()])(V||B.has(t))&&W(t,K(t,e));V=!1,te=!1,B.clear()}function me(){X(f,bt(A.frame.bands));for(let e of[...z.values()])e.wanted||(e.line.remove(),e.label.remove(),z.delete(e.value));for(let e of A.ticks){let t=z.get(e.value);t&&(X(t.line,{...e.line,opacity:void 0}),Tt(t.label,e.label),t.label.removeAttribute(`opacity`))}for(let e of x)e.series=e.row.values.map(e=>e.series),e.count=void 0,W(e,e.row);V=!1,te=!1,B.clear()}function he(e){let t=new Set(e.rows.map(e=>e.key)),n={entering:[],exiting:[],changed:[]};for(let e of x)t.has(e.key)||(w.delete(e.key),T.start(e),e.count=void 0,n.exiting.push(e));let r=x;return x=e.rows.map(e=>{let t=w.get(e.key);return t?(Mr(t.row,e)&&n.changed.push({record:t,from:t.shown.geometry}),t.count=Math.max(Un(t.row.total),Un(e.total))):(t=T.recall(e.key)??ae(e,!0),t.count=void 0,w.set(e.key,t),n.entering.push(t)),t.row=e,t.series=Fr(t.series,e.values.map(e=>e.series)),ge(t),t}),$n(_,r.map(e=>e.group),x.map(e=>e.group),q.active),n}function ge(e){e.group.setAttribute(`aria-label`,Ar(e.row,o)),F.describe(e.group,e.row)}function _e(e,t){let{frame:n}=e;t&&(R=e.orientation);let r=new Set(e.ticks.map(e=>e.value));for(let e of r)z.has(e)||de(e,0);for(let e of z.values())e.wanted=r.has(e.value);let i=new Set(x.filter(e=>e.presence.value===0)),a=x.filter(e=>!i.has(e)),o=[...T.values()],c=Q(H,n.scale,fr)||[...z.values()].some(e=>Q(e.opacity,+!!e.wanted,$))||a.some(e=>Q(e.values,Nr(e.row),fr)||Q(e.presence,1,$))||o.some(e=>Q(e.values,Pr(e.values.value),fr)||Q(e.presence,0,$)),l=i.size>0||Q(ne,n.bands,fr)||a.some(e=>Q(e.slot,e.row.slot,$)),u,d,f;if(!t&&s.staged){let e=c?500:0;u={duration:500},d={duration:500,delay:e},f={duration:250,delay:e+250}}else t||(u=d=f={duration:(c&&l?2:1)*500});let p=[],m=(e,t,n,r)=>{Q(e,t,n)&&(r?p.push(e.to(t,r)):e.set(t))};m(H,n.scale,fr,u),m(ne,n.bands,fr,d);for(let e of z.values())m(e.opacity,+!!e.wanted,$,u);for(let e of a)m(e.values,Nr(e.row),fr,u),m(e.presence,1,$,u),m(e.slot,e.row.slot,$,d);for(let e of i)e.slot.set(e.row.slot),m(e.values,Nr(e.row),fr,f),m(e.presence,1,$,f);for(let e of o)m(e.values,Pr(e.values.value),fr,u),m(e.presence,0,$,u);return p}function ve(e,t){return A=e,re.run(_e(e,t))}let ye=e=>({mark:e.row.geometry,data:e.row.data}),be=e=>({mark:e.shown.geometry,data:e.shown.data});function xe(e){let t=e,n=typeof t?.closest==`function`?t.closest(`.ec-mark`):null,r=n?E.get(n):void 0;return r&&w.get(r.key)===r?r:void 0}let q=Yn({svg:f,runner:P,events:D,dim:()=>o.dim!==!1,find(e){let t=xe(e);if(!t)return;let n=e.closest(`.ec-segment`)?.getAttribute(`data-series`)??void 0;return n===void 0?{key:t.key}:{key:t.key,segment:n}},live:e=>w.has(e),order:()=>x.map(e=>e.key),element:e=>M(e)?.group,hot:N.hot,onScreen(e){let t=M(e);return t&&be(t)},ring:U,tooltip:{show(e){let t=w.get(e);t&&se(t)},hide:()=>F.hide(),element:()=>F.element()}}),Se=_r(f,s);function Ce(){if(k)return;let e=ie(o),t=new Map(e.rows.map(e=>[e.key,e]));for(let e of x)e.row=t.get(e.key)??e.row;ve(e,!0)}let we=hr(i,u,O,e=>{O=e,o.width===void 0&&Ce()}),Te=gr(d,()=>{y.clear(),Ce()});or(f,o),ce(A),ee.render(j),X(f,bt(A.frame.bands));for(let e of A.ticks)de(e.value,1);for(let e of z.values())fe(e,A.frame);return x=A.rows.map(e=>{let t=ae(e,!1);return w.set(e.key,t),ge(t),t}),q.sync(),P.enter(x.map(ye)),bn(q.link,{element:f,async update(e){if(k)return;if(e.motion!==void 0&&e.motion!==o.motion)throw TypeError("barChart: `motion` can't be changed by update() yet.");let t={...o,...e};Or(t);let n=`on`in e?cr(c,o.on,t.on,r.presets):c,i=ie(t,n),a=le(t,i);`colors`in e&&(l=fn(t.colors));let u=o;o=t,or(f,o),ce(i),ee.render(a);let d=L!==void 0;o.announce&&!L?L=vt(f):!o.announce&&L&&(L.destroy(),L=void 0),q.syncDim(),re.supersede();let p=n!==c;c=n;let m=dr({runner:P,events:D,hover:q,leaving:T,input:ye,onScreen:be,data:`data`in e,...p?{swap:e=>{let t=new Set(e.entering);P.swap(n,x.filter(e=>!t.has(e)).map(ye))}}:{}},()=>he(i),e=>{d&&G(u,e)});if(kr(o)!==kr(u))for(let e of[...x,...T.values()])B.add(e);let h=ve(i,s.mode===`off`||i.orientation!==R);await re.wait(h,m)},on:D.on,marks:()=>x.map(e=>e.shown.geometry),focus(e){k||q.focus(e)},leave(){k||q.leave()},labels:()=>x.flatMap(e=>[...Xn(e.key,`category`,e.shown.label,e.label),...Xn(e.key,`value`,e.shown.value,e.value)]),destroy(){if(!k){k=!0,re.destroy(),q.destroy(),P.destroy(),F.destroy(),I.destroy(),ee.destroy(),L?.destroy(),Se(),we(),Te();for(let e of[...x,...T.values()]){for(let t of[e.values,e.slot,e.presence])t.stop();e.leave?.resolve()}H.stop(),ne.stop();for(let e of z.values())e.opacity.stop();D.clear(),w.clear(),T.clear(),x=[],f.remove()}}})}function Or(e){lr(e,`barChart`);let{colorBy:t,room:n}=e;if(n!==void 0&&!(typeof n==`number`&&Number.isFinite(n)&&n>=0))throw RangeError(`barChart: room must be a number of px, 0 or more, got ${String(n)}.`);if(t!==void 0&&t!==`series`&&t!==`category`)throw TypeError(`barChart: colorBy must be "series" or "category", got ${String(t)}.`);if(t===`category`&&e.stack!==void 0)throw TypeError(`barChart: colorBy: "category" gives each bar one colour, so it needs one series, not a stack. A stack colours its segments by series.`)}function kr(e){return e.colorBy===`category`}function Ar(e,n){let r=Bn(n),i=jr(e.values,n),a=i.length===1&&i[0].series===`value`&&i[0].label===`value`,o=`${e.category}: ${i.map(e=>a?r(e.value):`${r(e.value)} ${e.label}`).join(`, `)}`;if(!n.markLabel)return o;try{let t=n.markLabel(e.datum,{key:e.key,category:e.category,values:i,total:e.total,format:r,text:o});if(t!=null&&String(t).trim()!==``)return String(t)}catch(e){t(e)}return o}function jr(e,t){return e.map(e=>({series:e.series,label:Ln(t.seriesLabels,e.series),value:e.value}))}function Mr(e,t){return e.values.length!==t.values.length||e.values.some((e,n)=>e.series!==t.values[n].series||e.value!==t.values[n].value)}function Nr(e){return Object.fromEntries(e.values.map(e=>[e.series,e.value]))}function Pr(e){return Object.fromEntries(Object.keys(e).map(e=>[e,0]))}function Fr(e,t){let n=[...t];return e.forEach((t,r)=>{if(n.includes(t))return;let i=0;for(let t=r-1;t>=0;t--){let r=n.indexOf(e[t]);if(r>=0){i=r+1;break}}n.splice(i,0,t)}),n}function Ir(e){return typeof e==`function`?`custom`:e??`none`}let Lr=2*Math.PI,Rr=Math.PI/12,zr=12.5,Br=12.5;function Vr(e){let{category:t,value:n,key:r}=e;if(typeof t!=`string`&&typeof t!=`function`)throw TypeError(`donutChart needs a category: the field, or a function, that names each slice.`);if(typeof n!=`string`&&typeof n!=`function`)throw TypeError(`donutChart needs a value: the numeric field, or a function, that sizes each slice.`);if(r!==void 0&&typeof r!=`string`&&typeof r!=`function`)throw TypeError(`donutChart: key must be a field name or a function.`);let i=ei(t);return{category:i,key:r===void 0?i:ei(r),series:typeof n==`string`?n:`value`,value:ei(n)}}function Hr(e){let t=Jr(qr(e),e.sort),n=Yr(e,t),r=t.reduce((e,t)=>e+t.value,0),i=Ur(t.map(e=>e.value)),a=t.map((n,a)=>{let o=r>0?n.value/r:0,s=a+1<t.length&&r>0?i[a+1]:+(r>0);return{...n,series:e.encoding.series,share:o,start:i[a]*Lr,end:s*Lr}}),o=Gr(n,a,e.measure),s=e.center(r);return{frame:n,total:r,slices:a.map((t,r)=>Wr(n,t,o[r],e.measure)),labels:o,centerText:s,center:Kr(n,s,e.measure)}}function Ur(e){let t=e.reduce((e,t)=>e+t,0),n=0;return e.map(e=>{let r=t>0?n/t:0;return n+=e,r})}function Wr(e,t,n,r){let i=de({key:t.key,series:t.series,cx:e.cx,cy:e.cy,inner:e.inner,outer:e.outer,start:t.start,end:t.end,labelBounds:n&&r?Zr(n,r):[]});return{...t,geometry:i,data:$r(t.datum,t.share,t.series)}}function Gr(e,t,n){let r,i,a=t.map((t,a)=>{if(t.end-t.start<Rr-1e-9)return;let o=Xr(e,t,n),{box:s}=o;if(!(s.x<0||s.y<0||s.x+s.width>e.width||s.y+s.height>e.height)&&!(r&&Qr(r,s)))return r=s,i??(i=a),o});for(let e=a.length-1;i!==void 0&&e>i;e--){let t=a[e];if(t){if(!Qr(a[i].box,t.box))break;a[e]=void 0}}return a}function Kr(e,t,n){if(t===``)return[];let r=t.split(`
|
|
92
|
+
`),i=2*e.inner*.85,a=n(r[0],`ec-center-value`,26),o=a>i&&a>0?Math.max(14,26*i/a):26,s=r.map((e,t)=>t===0?0:20+(t-1)*16),c=s[s.length-1],l=e.cy+(.72*o-c)/2;return r.map((t,n)=>({x:e.cx,y:l+s[n],anchor:`middle`,text:t,size:n===0?o:zr}))}function qr({data:e,encoding:t}){let n=/* @__PURE__ */ new Set;return e.map((e,r)=>{let i=String(t.key(e,r));if(n.has(i))throw Error(`donutChart: two rows have the key "${i}". Keys must be unique; pass a key accessor if categories repeat.`);n.add(i);let a=ti(t.value(e,r),t.series,i);return{key:i,category:String(t.category(e,r)??``),datum:e,index:r,value:a}})}function Jr(e,t){if(t===void 0||t===`none`)return e;if(t===`value`)return[...e].sort((e,t)=>t.value-e.value);throw TypeError(`donutChart: sort must be "value" or "none", got ${String(t)}.`)}function Yr(e,t){let{width:n,measure:r}=e,i=e.height??300,a=n/2,o=i/2,s=r(`100%`,`ec-value`,Br),c=t.reduce((e,t)=>Math.max(e,r(t.category,`ec-label`,zr)),s),l=Math.min(a-4-10-c,o-4-10-28),u=Math.max(0,Math.min(a,o)-4),d=Math.max(0,l,u/2);return{width:n,height:i,cx:a,cy:o,inner:d*.6,outer:d}}function Xr(e,t,n){let r=(t.start+t.end)/2,i=Math.sin(r),a=Math.cos(r),o=e.outer+10,s=e.cx+o*i,c=e.cy-o*a,l=Gn(t.share),u=[n(t.category,`ec-label`,zr),n(l,`ec-value`,Br)],d=Math.max(...u),f=c-28*(a+1)/2,p=e=>s+i*e/2;return{category:{x:p(u[0]),y:f+10,anchor:`middle`,text:t.category},share:{x:p(u[1]),y:f+10+15,anchor:`middle`,text:l},box:{x:p(d)-d/2,y:f,width:d,height:28}}}function Zr(e,t){let n=[];return e.category.text!==``&&n.push(wt(e.category,t,`ec-label`,zr)),e.share.text!==``&&n.push(wt(e.share,t,`ec-value`,Br)),n}function Qr(e,t){return e.x<t.x+t.width+2&&t.x<e.x+e.width+2&&e.y<t.y+t.height+2&&t.y<e.y+e.height+2}function $r(e,t,n){let r={datum:e,samples:[{t:0,value:0},{t:1,value:t}],related:e=>e===n?r:void 0};return r}function ei(e){return typeof e==`function`?e:t=>t[e]}function ti(e,t,n){if(e==null)return 0;if(typeof e==`number`&&Number.isFinite(e)&&e>=0)return e;throw RangeError(`donutChart: "${t}" for "${n}" must be a finite number of 0 or more, got ${typeof e==`string`?JSON.stringify(e):String(e)}.`)}let ni=2*Math.PI;function ri(e,n,r){let i=ir(e,`donutChart`);ii(n);let o=n,s=wn(n.motion,r.motion),c=at(n.on,r.presets),l=fn(n.colors),u=r.clock??a,d=i.ownerDocument;un(d);let f=Y(`svg`,{class:`ec-chart ec-donut-chart`,role:`group`},i),p=Y(`g`,{class:`ec-center`,"aria-hidden":`true`},f),m=Y(`g`,{class:`ec-marks`},f),h=Y(`g`,{class:`ec-overlay`,"aria-hidden":`true`},f),g=Y(`g`,{class:`ec-halos`},h),_=Dn(h),v=Y(`g`,{class:`ec-runs`},h),y=Et(f),x=[],w=/* @__PURE__ */ new Map,T=Zn(e=>e.value.animating||e.presence.animating),E=/* @__PURE__ */ new WeakMap,D=zn(`donutChart`),O=ar(i),k=!1,A,j,M;try{A=ie(o),j=G(o,A),M=oi(o,A)}catch(e){throw f.remove(),e}let N=e=>w.get(e)??T.get(e),P=In({overlay:v,mark:e=>({set:t=>{N(e)?.handle.set(t),Te.restyled(e)},reset:()=>{N(e)?.handle.reset(),Te.restyled(e)}}),colors:e=>N(e)?.parts[0]?.colors}),F=pt({effects:c,motion:s,icons:r.icons,clock:u,surface:P}),I=xr(f,{motion:s,option:()=>o.tooltip,description:()=>o.markDescription}),ee=hn(f),L=rr(f),R=o.announce?vt(f):void 0,z=[],B=[],V=!1,te=C(A.frame,S,{clock:u,motion:s,onChange:()=>V=!0}),H,ne,re=ur({clock:u,runner:F,leaving:T,draw:ge,land:ve});function ie(e,t=c){let n=Vr(e);return sr(t,[n.series],`donutChart`),Hr({data:e.data,encoding:n,sort:e.sort,width:e.width??O,height:e.height,center:t=>ci(e,n.series,t),measure:y})}function ae(e,t){let n=Y(`g`,{class:`ec-mark`,"data-key":e.key,role:`img`},m),r={clock:u,motion:s,onChange:()=>V=!0},i=Y(`g`,{class:`ec-body`},n),a={key:e.key,row:e,shown:e,group:n,hit:Y(`path`,{class:`ec-hit`},n),body:i,path:Y(`path`,{class:`ec-slice`,"data-series":e.series},i),label:Y(`text`,{class:`ec-label`,"aria-hidden":`true`},n),share:Y(`text`,{class:`ec-value`,"aria-hidden":`true`},n),drawnLabel:void 0,parts:[],handle:kn(()=>a,{halos:()=>g}),value:C(t?0:e.value,b,r),turn:C(1,b,r),offset:0,planned:0,presence:C(+!t,b,r),leave:void 0};return n.insertBefore(a.hit,i),E.set(n,a),a}function oe(e,t,n){let r=e.parts[0]?.colors.color;e.shown=t;let{outline:i}=t.geometry,a=t.geometry.length>=.5,o=a?void 0:`hidden`;X(e.path,{d:i.d,visibility:o}),X(e.hit,{d:i.d,visibility:o});let s=nn(l.slot(e.key));yt(e.path,an(s)),e.parts=[{element:e.path,d:i.d,colors:s,visible:a}];let c=e.presence.value,u=c<1?c:void 0;e.drawnLabel=n;for(let[t,r]of[[e.label,n?.category],[e.share,n?.share]])r&&Tt(t,r),X(t,{visibility:r?void 0:`hidden`,opacity:u});e.handle.repaint(),s.color!==r&&P.recolor(e.key),e.key===Te.ringKey&&U(e.key)}function U(e){let t=e===void 0?void 0:w.get(e);_.draw(t&&{outline:t.shown.geometry.outline,thickness:t.shown.geometry.thickness,transform:t.handle.style.transform})}function W(e,t,n){let r=pr(e.shown.geometry,t.geometry)||e.shown.datum!==t.datum;oe(e,t,n),r&&F.change(t.geometry,t.data),e.key===Te.key&&se(e)}function se(e){let{row:t}=e;I.show(e.shown.geometry,t,()=>({title:t.category,lines:[`${ai(t,o)} · ${Gn(t.share)}`]}),e.handle.style.transform)}function ce(e){for(;p.childElementCount>e.length;)p.lastElementChild.remove();e.forEach((e,t)=>{let n=p.children[t]??Y(`text`,{},p);X(n,{class:t===0?`ec-center-value`:`ec-center-label`}),Tt(n,e),yt(n,{"font-size":t===0&&e.size!==26?`${e.size}px`:void 0})})}let le=()=>ee.categories(A.slices.map(e=>({key:e.key,label:e.category})),l,o.legend);function G(e,t){let{series:n}=Vr(e);return tr({option:e.table,caption:e.label,category:typeof e.category==`string`?e.category:void 0,series:[n],label:t=>Ln(e.seriesLabels,t),rows:t.slices.map(e=>({key:e.key,category:e.category,datum:e.datum,index:e.index,values:[{series:n,value:e.value}],total:e.value})),format:Bn(e),shares:!0})}function ue(){or(f,{label:o.label,description:li(o.description,A.centerText)})}function K(e,n){let r=o.announce;if(!R||!r)return;let i=Vr(o).series,a=Vr(e).series,s=o.sort??`none`,c=e=>e.row.category,l=n.changed.map(({record:e})=>e),u=gt({...o.label===e.label?{}:{label:o.label},...i===a?{}:{series:[Ln(o.seriesLabels,i)]},...s===(e.sort??`none`)?{}:{sort:s},changed:l.map(c),added:n.entering.map(c),removed:n.exiting.map(c),count:x.length});if(typeof r!=`function`){R.say(u);return}let d=e=>e.key;try{let e=r({text:u,changed:l.map(d),added:n.entering.map(d),removed:n.exiting.map(d)});e!=null&&R.say(String(e))}catch(e){t(e)}}let de=e=>w.get(e.key)===e||T.get(e.key)===e,fe=e=>Math.max(0,e.value.value);function pe(e,t,n=fe){let r=/* @__PURE__ */ new Map,i=0;for(let a of e)r.set(a,t>0?i/t:0),i+=n(a);return r}function me(){z=z.filter(de),B=B.filter(de);let e=z.reduce((e,t)=>e+fe(t),0),t=pe(z,e),n=pe(B,e),r=/* @__PURE__ */ new Map;for(let i of z){let a=t.get(i),o=i.turn.value,s=n.get(i),c=a;if(s!==void 0&&o<1){let e=s+i.offset-a;c=a+(1-o)*(e-Math.round(e-i.planned))}r.set(i,{start:c,span:e>0?fe(i)/e:0})}return r}function he(e){let t=[...me()].map(([e,{start:t,span:n}])=>{let{row:r}=e;return{record:e,state:{key:r.key,datum:r.datum,index:r.index,category:r.category,series:r.series,value:fe(e),share:n,start:t*ni,end:(t+n)*ni}}}),n=Gr(e,t.map(({state:e})=>e),y);return t.map(({record:t,state:r},i)=>({record:t,slice:Wr(e,r,n[i],y),label:n[i]}))}function ge(){if(!V)return;V=!1;let e=te.value;X(f,bt(e));let t=he(e);for(let{record:e,slice:n,label:r}of t)W(e,n,r);let n=t.reduce((e,{slice:t})=>e+t.value,0);ce(Kr(e,H===void 0?A.centerText:_e(Wn(n,H)),y))}function _e(e){return ne?.total!==e&&(ne={total:e,text:ci(o,Vr(o).series,e)}),ne.text}function ve(){z=z.filter(de),B=z;for(let e of z)e.turn.set(1),e.offset=0,e.planned=0;H=void 0,ne=void 0,X(f,bt(A.frame)),A.slices.forEach((e,t)=>W(w.get(e.key),e,A.labels[t])),ce(A.center),V=!1}function ye(e){let t=new Set(e.slices.map(e=>e.key)),n={entering:[],exiting:[],changed:[]};for(let e of x)t.has(e.key)||(w.delete(e.key),T.start(e),n.exiting.push(e));let r=x;return x=e.slices.map(e=>{let t=w.get(e.key);return t?(t.row.value!==e.value||t.row.series!==e.series)&&n.changed.push({record:t,from:t.shown.geometry}):(t=T.recall(e.key)??ae(e,!0),w.set(e.key,t),n.entering.push(t)),t.row=e,t.path.setAttribute(`data-series`,e.series),be(t),t}),$n(m,r.map(e=>e.group),x.map(e=>e.group),Te.active),n}function be(e){e.group.setAttribute(`aria-label`,M.get(e.key)),I.describe(e.group,e.row)}function xe(e,t){V=!0;let n=me(),r=new Set(x.filter(e=>e.presence.value===0)),i=x.filter(e=>!r.has(e)),a=[...T.values()],o=B.length>0&&B.every(e=>e.turn.value===0),c=z;if(z=ui(c,x),!o){B=c;let e=pe(c,c.reduce((e,t)=>e+fe(t),0));for(let t of c)t.offset=n.get(t).start-e.get(t)}B=B.filter(e=>!r.has(e));let l=e=>w.get(e.key)===e?e.row.value:0,u=z.reduce((e,t)=>e+l(t),0),d=pe(z,u,l),f=pe(B,u,l),p=!1;for(let e of B){let t=f.get(e)+e.offset-d.get(e);e.planned=t-Math.round(t),Math.abs(e.planned)>1e-9&&(p=!0)}let m=i.some(e=>Q(e.value,e.row.value,$)||Q(e.presence,1,$))||a.some(e=>Q(e.value,0,$)||Q(e.presence,0,$)),h=p||r.size>0||Q(te,e.frame,fr),g,_,v;if(!t&&s.staged){let e=m?500:0;g={duration:500},_={duration:500,delay:e},v={duration:250,delay:e+250}}else t||(g=_=v={duration:(m&&h?2:1)*500});let y=[],b=(e,t,n,r)=>{Q(e,t,n)&&(r?y.push(e.to(t,r)):e.set(t))};b(te,e.frame,fr,_);for(let e of i)b(e.value,e.row.value,$,g),b(e.presence,1,$,g);for(let e of r)b(e.value,e.row.value,$,v),b(e.presence,1,$,v);for(let e of a)b(e.value,0,$,g),b(e.presence,0,$,g);if(t){B=z;for(let e of z)e.turn.set(1),e.offset=0,e.planned=0;return y}let S=new Set(B);for(let e of z)e.turn.set(+!S.has(e));if(p)for(let e of B)b(e.turn,1,$,_);return y}function q(e,t){return A=e,re.run(xe(e,t))}let Se=e=>({mark:e.row.geometry,data:e.row.data}),Ce=e=>({mark:e.shown.geometry,data:e.shown.data});function we(e){let t=e,n=typeof t?.closest==`function`?t.closest(`.ec-mark`):null,r=n?E.get(n):void 0;return r&&w.get(r.key)===r?r:void 0}let Te=Yn({svg:f,runner:F,events:D,dim:()=>o.dim!==!1,find(e){let t=we(e);return t&&{key:t.key}},live:e=>w.has(e),order:()=>x.map(e=>e.key),element:e=>N(e)?.group,hot:P.hot,onScreen(e){let t=N(e);return t&&Ce(t)},ring:U,tooltip:{show(e){let t=w.get(e);t&&se(t)},hide:()=>I.hide(),element:()=>I.element()}}),Ee=_r(f,s);function De(){if(k)return;let e=ie(o),t=new Map(e.slices.map(e=>[e.key,e]));for(let e of x)e.row=t.get(e.key)??e.row;q(e,!0)}let Oe=hr(i,u,O,e=>{O=e,o.width===void 0&&De()}),ke=gr(d,()=>{y.clear(),De()});return ue(),le(),L.render(j),X(f,bt(A.frame)),x=A.slices.map(e=>{let t=ae(e,!1);return w.set(e.key,t),be(t),t}),z=B=x,A.slices.forEach((e,t)=>oe(x[t],e,A.labels[t])),ce(A.center),Te.sync(),F.enter(x.map(Se)),bn(Te.link,{element:f,async update(e){if(k)return;if(e.motion!==void 0&&e.motion!==o.motion)throw TypeError("donutChart: `motion` can't be changed by update() yet.");let t={...o,...e};ii(t);let n=`on`in e?cr(c,o.on,t.on,r.presets):c,i=ie(t,n),a=G(t,i),u=oi(t,i);`colors`in e&&(l=fn(t.colors));let d=o,p=A.total;o=t,A=i,M=u,ue(),le(),L.render(a);let m=R!==void 0;o.announce&&!R?R=vt(f):!o.announce&&R&&(R.destroy(),R=void 0),Te.syncDim(),re.supersede();let h=n!==c;c=n;let g=dr({runner:F,events:D,hover:Te,leaving:T,input:Se,onScreen:Ce,data:`data`in e,...h?{swap:e=>{let t=new Set(e.entering);F.swap(n,x.filter(e=>!t.has(e)).map(Se))}}:{}},()=>ye(i),e=>{m&&K(d,e)});H=i.total===p?void 0:Math.max(Un(p),Un(i.total));let _=q(i,s.mode===`off`);await re.wait(_,g)},on:D.on,marks:()=>x.map(e=>e.shown.geometry),focus(e){k||Te.focus(e)},leave(){k||Te.leave()},labels:()=>x.flatMap(e=>[...Xn(e.key,`category`,e.drawnLabel?.category,e.label),...Xn(e.key,`value`,e.drawnLabel?.share,e.share)]),destroy(){if(!k){k=!0,re.destroy(),Te.destroy(),F.destroy(),I.destroy(),ee.destroy(),L.destroy(),R?.destroy(),Ee(),Oe(),ke();for(let e of[...x,...T.values()]){for(let t of[e.value,e.turn,e.presence])t.stop();e.leave?.resolve()}te.stop(),D.clear(),w.clear(),T.clear(),x=z=B=[],f.remove()}}})}function ii(e){lr(e,`donutChart`);let{center:t,sort:n}=e;if(t!==void 0&&t!==!1&&typeof t!=`function`)throw TypeError(`donutChart: center must be false or a function that returns the text for the total.`);if(n!==void 0&&n!==`none`&&n!==`value`)throw TypeError(`donutChart: sort must be "value" or "none", got ${String(n)}.`)}function ai(e,t){let n=Bn(t)(e.value),r=Ln(t.seriesLabels,e.series);return e.series===`value`&&r===`value`?n:`${n} ${r}`}function oi(e,t){return new Map(t.slices.map(t=>[t.key,si(t,e)]))}function si(e,n){let r=`${e.category}: ${ai(e,n)}, ${Gn(e.share)}`;if(!n.markLabel)return r;try{let t={series:e.series,label:Ln(n.seriesLabels,e.series),value:e.value},i=n.markLabel(e.datum,{key:e.key,category:e.category,values:[t],total:e.value,share:e.share,format:Bn(n),text:r});if(i!=null&&String(i).trim()!==``)return String(i)}catch(e){t(e)}return r}function ci(e,n,r){let{center:i}=e,a=Bn(e);if(i===!1)return``;if(i===void 0){let t=Ln(e.seriesLabels,n);return n===`value`&&t===`value`?a(r):`${a(r)}\n${t}`}try{let e=i(r,a);return e==null?``:String(e)}catch(e){return t(e),``}}function li(e,t){let n=t.split(`
|
|
93
|
+
`).join(` `).trim(),r=e?.trim();return n===``?e:r?/[.!?:;]$/.test(r)?`${r} ${n}`:`${r}. ${n}`:n}function ui(e,t){let n=[...t];return e.forEach((t,r)=>{if(n.includes(t))return;let i=0;for(let t=r-1;t>=0;t--){let r=n.indexOf(e[t]);if(r>=0){i=r+1;break}}n.splice(i,0,t)}),n}let di=[`UTC`,`local`],fi=1e3,pi=60*fi,mi=60*pi,hi=24*mi,gi={second:fi,minute:pi,hour:mi,day:9e7,week:6084e5,month:31*hi,year:366*hi},_i=[...[1,5,15,30].map(e=>({unit:`second`,count:e})),...[1,5,15,30].map(e=>({unit:`minute`,count:e})),...[1,3,6,12].map(e=>({unit:`hour`,count:e})),{unit:`day`,count:1},{unit:`day`,count:2},{unit:`week`,count:1},{unit:`month`,count:1},{unit:`month`,count:3}],vi=[`year`,`month`,`day`,`hour`,`minute`,`second`,`millisecond`],yi={second:`second`,minute:`minute`,hour:`hour`,day:`day`,week:`day`,month:`month`,year:`year`},bi={year:{year:`numeric`},month:{month:`short`},day:{month:`short`,day:`numeric`},hour:{hour:`numeric`,minute:`2-digit`},minute:{hour:`numeric`,minute:`2-digit`},second:{hour:`numeric`,minute:`2-digit`,second:`2-digit`},millisecond:{hour:`numeric`,minute:`2-digit`,second:`2-digit`,fractionalSecondDigits:3}};function xi(e){for(let t of _i)if(gi[t.unit]*t.count>=e)return t;return{unit:`year`,count:Math.max(1,Wt(e/gi.year))}}function Si(e,t,n){let r=Oi(n);if(!(t>e))return[{value:e,text:r(e,`year`)}];let i=xi((t-e)/4),a=vi[Math.min(vi.indexOf(yi[i.unit]),vi.indexOf(Ci(e,t,n)))],o=wi(e,t,i,n).map(e=>({value:e,text:r(e,`millisecond`)}));return[{value:e,text:r(e,a)},...o,{value:t,text:r(t,a)}]}function Ci(e,t,n){let[r,i]=[Ai(e,n),Ai(t,n)];return r.year===i.year?r.month===i.month?r.date===i.date?r.hours===i.hours?r.minutes===i.minutes?`second`:`minute`:`hour`:`day`:`month`:`year`}function wi(e,t,n,r){let{unit:i,count:a}=n,o=[],s=Ai(e,r);if(i===`second`||i===`minute`||i===`hour`){let n=i===`hour`?15*pi:gi[i],c=e-s.ms-(i===`second`?0:s.seconds*fi)-(i===`hour`?s.minutes%15*pi:0);for(;c<t;c+=n){let t=Ai(c,r),n=i!==`hour`||t.minutes===0,s=i===`second`?t.seconds:i===`minute`?t.minutes:t.hours;c>e&&n&&s%a===0&&o.push(c)}return o}let c=i===`day`?e=>ji(r,s.year,s.month,s.date+e):i===`week`?e=>ji(r,s.year,s.month,s.date-(s.weekday+6)%7+7*e):i===`month`?e=>ji(r,s.year,Math.floor(s.month/a)*a+a*e,1):e=>ji(r,Math.floor(s.year/a)*a+a*e,0,1),l=-1/0;for(let n=0;;n++){let s=c(n);if(s>=t||s<=l)break;l=s,s>e&&(i!==`day`||(Ai(s,r).date-1)%a==0)&&o.push(s)}return o}function Ti(e,t,n){let{year:r,month:i,date:a,hours:o,minutes:s,seconds:c,ms:l}=Ai(e,n),u=/* @__PURE__ */ new Date(0);u.setUTCFullYear(r,i+t+1,0);let d=Math.min(a,u.getUTCDate()),f=/* @__PURE__ */ new Date(0);return n===`UTC`?(f.setUTCFullYear(r,i+t,d),f.setUTCHours(o,s,c,l)):(f.setFullYear(r,i+t,d),f.setHours(o,s,c,l)),f.getTime()}function Ei(e,t){let{ms:n,seconds:r,minutes:i,hours:a,date:o,month:s}=Ai(e,t);return n===0?r===0?i===0?a===0?o===1?s===0?`year`:`month`:`day`:`hour`:`minute`:`second`:`millisecond`}function Di(e,t){let n=e.reduce((e,n)=>Math.max(e,vi.indexOf(Ei(n,t))),0),r=ki(t),i=n>=vi.indexOf(`second`)?`medium`:n>=vi.indexOf(`hour`)?`short`:void 0,a=n===vi.indexOf(`millisecond`)?{year:`numeric`,...bi.day,...bi.millisecond,timeZone:r}:{dateStyle:`medium`,...i?{timeStyle:i}:{},timeZone:r},o=new Intl.DateTimeFormat(void 0,a);return e=>o.format(e)}function Oi(e){let t=/* @__PURE__ */ new Map;return(n,r)=>{let i=vi.indexOf(Ei(n,e)),a={};for(let e=Math.min(i,vi.indexOf(r));e<=i;e++)Object.assign(a,bi[vi[e]]);let o=JSON.stringify(a),s=t.get(o);return s||t.set(o,s=new Intl.DateTimeFormat(void 0,{...a,timeZone:ki(e)})),s.format(n)}}let ki=e=>e===`UTC`?`UTC`:void 0;function Ai(e,t){let n=new Date(e);return t===`UTC`?{year:n.getUTCFullYear(),month:n.getUTCMonth(),date:n.getUTCDate(),weekday:n.getUTCDay(),hours:n.getUTCHours(),minutes:n.getUTCMinutes(),seconds:n.getUTCSeconds(),ms:n.getUTCMilliseconds()}:{year:n.getFullYear(),month:n.getMonth(),date:n.getDate(),weekday:n.getDay(),hours:n.getHours(),minutes:n.getMinutes(),seconds:n.getSeconds(),ms:n.getMilliseconds()}}function ji(e,t,n,r){let i=/* @__PURE__ */ new Date(0);return e===`UTC`?(i.setUTCFullYear(t,n,r),i.setUTCHours(0,0,0,0)):(i.setFullYear(t,n,r),i.setHours(0,0,0,0)),i.getTime()}let Mi=2.25,Ni=4.5,Pi=12.5,Fi=.36;function Ii(e){let{x:t,series:n,key:r}=e;if(typeof t!=`string`&&typeof t!=`function`)throw TypeError(`lineChart needs x: a field of numbers or Dates, or a function that returns each row's x.`);if(!Array.isArray(n)||n.length===0)throw TypeError(`lineChart needs series: the numeric fields to draw as lines.`);let i=/* @__PURE__ */ new Set;for(let e of n){if(typeof e!=`string`||e===``)throw TypeError(`lineChart: each series must be a field name, got ${sa(e)}.`);if(i.has(e))throw TypeError(`lineChart: "${e}" appears twice in series.`);i.add(e)}if(r!==void 0&&typeof r!=`string`&&typeof r!=`function`)throw TypeError(`lineChart: key must be a field name or a function.`);let a=e.labels;if(a!==void 0&&a!==!1&&typeof a!=`function`)throw TypeError(`lineChart: labels must be false or a function that returns a line's end label.`);let o=e.timeZone??`UTC`;if(!di.includes(o))throw TypeError(`lineChart: timeZone must be "UTC" or "local", got ${sa(o)}.`);let s=e.xFormat;if(s!==void 0&&typeof s!=`function`)throw TypeError(`lineChart: xFormat must be a function that turns an x into text.`);return{x:oa(t),key:r===void 0?void 0:oa(r),series:n.map(e=>({series:e,value:oa(e)})),timeZone:o,xFormat:e.xFormat}}function Li(e){let{width:t,measure:n}=e,r=e.height??300,{rows:i,time:a}=Qi(e),o=e.encoding.series.map(e=>e.series),s=Ut(i.flatMap(e=>e.values.flatMap(e=>e.value===void 0?[]:[e.value]))),c=s.ticks.map(e.format),l=i[0]?.x??0,u=i[i.length-1]?.x??0,d=i.length===0?[]:a?Si(l,u,e.encoding.timeZone):Yi(l,u).map(e=>({value:e,text:Xi(e)})),f=d.map(e=>e.value),p=d.map(e=>e.text),m=p.map(e=>n(e,`ec-tick`,11)),h=e.label?aa(ia(i,e.label),`ec-value`,Pi,n):0,g=Math.max(aa(c,`ec-tick`,11,n)+10,(m[0]??0)/2+2),_=Math.max(10,(m[m.length-1]??0)/2+2,h>0?10+h+4:0),v={scale:{lo:s.lo,hi:s.hi},box:{xLo:l,xHi:u,left:g,right:Math.max(g,t-_),top:12,bottom:Math.max(12,r-32),width:t,height:r}},y={};for(let e of o)y[e]=0;for(let e of i)for(let t of e.values)t.value!==void 0&&(y[t.series]=Math.max(y[t.series],Un(t.value)));let b=f.map((e,t)=>Ji(v,e,p[t]));return{width:t,height:r,frame:v,rows:i,time:a,series:o,yTicks:s.ticks.map((e,t)=>qi(v,e,c[t])),xTicks:Zi(b,m),decimals:y}}function Ri(e){let{scale:t,box:n}=e,r=n.xHi-n.xLo,i=t.hi-t.lo;return{x:e=>r>0?n.left+(e-n.xLo)/r*(n.right-n.left):(n.left+n.right)/2,y:e=>i>0?n.bottom-(e-t.lo)/i*(n.bottom-n.top):n.bottom}}function zi(e,t,n,r,i=!1,a){let o=t[0];if(!o)return[];let s=Ri(e),c=0;for(;c+1<t.length&&t[c+1].x<=r;)c++;let l=t[c],u=t[c+1],d=u&&u.x>l.x&&r>l.x?(r-l.x)/(u.x-l.x):void 0,f=t.slice(0,c+1),p=/* @__PURE__ */ new Map,m=e=>t=>t===e?void 0:p.get(t),h=n.map(e=>{let t=t=>!t.missing?.has(e),n=[],i=!1;for(let r of f)t(r)?(n.push({at:r.x,value:r.values[e]??0,datum:r.datum,gapBefore:i}),i=!1):i=n.length>0;if(d!==void 0&&t(l)&&t(u)){let t=l.values[e]??0;n.push({at:r,value:t+d*((u.values[e]??0)-t),datum:l.datum,gapBefore:!1})}return{name:e,vertices:n,points:n.length>0?n.map(e=>({x:s.x(e.at),y:s.y(e.value)})):[{x:s.x(o.x),y:s.y(o.values[e]??0)}]}}),g=h.filter(({vertices:e})=>e.length>0),_=a?Gi(e,g.map(({name:e,vertices:t,points:n})=>({...n[n.length-1],text:a.text(e,t[t.length-1].value)}))):[];return h.map(({name:e,vertices:t,points:n})=>{let r=n[n.length-1],s=a?_[g.findIndex(t=>t.name===e)]??{x:r.x+10,y:r.y+Pi*Fi,anchor:`start`,text:``}:void 0,c=a?s&&s.text!==``?[wt(s,a.measure,`ec-value`,Pi)]:[]:void 0,u=t.flatMap((e,t)=>e.gapBefore?[t]:[]),d=he({key:e,series:e,points:n,width:Mi,...u.length>0?{breaks:u}:{},...c?{labelBounds:c}:{}}),f=0,h=t.map((e,r)=>(r>0&&(f+=Math.hypot(n[r].x-n[r-1].x,n[r].y-n[r-1].y)),{t:d.length>0?r===t.length-1?1:Math.min(1,f/d.length):0,value:e.value,at:na(e.at,i),...e.gapBefore?{gapBefore:!0}:{}})),v=t[t.length-1],y={datum:v?v.datum:l.datum,samples:h,related:m(e)};return p.set(e,y),{series:e,geometry:d,data:y,end:{...r,value:v?v.value:o.values[e]??0},label:s}})}function Bi(e,t){let n=/* @__PURE__ */ new Set;if(!e.some(e=>e.missing!==void 0&&e.missing.size>0))return n;let r=(e,t)=>e!==void 0&&!e.missing?.has(t);return e.forEach((i,a)=>{for(let o of t){let t=e[a-1],s=e[a+1];!r(i,o)||r(t,o)||r(s,o)||t===void 0&&s===void 0||n.add(Vi(o,i.key))}}),n}function Vi(e,t){return`${e}@${t}`}function Hi(e,t,n,r=!1){let i=Ri(e),a=i.x(t.x),o=/* @__PURE__ */ new Map;return n.filter(e=>!t.missing?.has(e)).map(e=>{let n=t.values[e]??0,s=Vi(e,t.key),c={datum:t.datum,samples:[{t:0,value:n,at:na(t.x,r)}],related:t=>t===e?void 0:o.get(t)};return o.set(e,c),{key:s,series:e,geometry:ye({key:s,series:e,x:a,y:i.y(n),r:Ni}),data:c}})}function Ui(e,t){let{width:n,height:r}=e.box;return t.map((e,i)=>{let a=i===0?0:(t[i-1]+e)/2,o=i===t.length-1?n:(e+t[i+1])/2;return{x:a,y:0,width:Math.max(0,o-a),height:r}})}function Wi(e,t){return{x1:t,y1:e.box.top,x2:t,y2:e.box.bottom}}function Gi(e,t){let n=Pi/2,r=Ki(t.map(e=>e.y),16,n,e.box.height-n);return t.map((e,t)=>({x:e.x+10,y:r[t]+Pi*Fi,anchor:`start`,text:e.text}))}function Ki(e,t,n,r){let i=e.map((e,t)=>({value:e,index:t})).sort((e,t)=>e.value-t.value||e.index-t.index),a=[],o=e=>{let i=e.reduce((e,t)=>e+t.value,0)/e.length,a=(e.length-1)*t;return Math.max(n,Math.min(r-a,i-a/2))};for(let e of i)for(a.push({members:[e],start:o([e])});a.length>1;){let e=a[a.length-1],n=a[a.length-2];if(e.start-(n.start+(n.members.length-1)*t)>=t)break;a.pop(),n.members.push(...e.members),n.start=o(n.members)}let s=Array(e.length);for(let e of a)e.members.forEach((n,r)=>s[n.index]=e.start+r*t);return s}function qi(e,t,n){let{box:r}=e,i=Ri(e).y(t);return{value:t,line:{x1:r.left,y1:i,x2:r.right+8,y2:i},label:{x:r.left-8,y:i+11*Fi,anchor:`end`,text:n}}}function Ji(e,t,n){return{value:t,label:{x:Ri(e).x(t),y:e.box.bottom+18,anchor:`middle`,text:n}}}function Yi(e,t){if(!(t>e))return[e];let n=Wt((t-e)/4),r=[e];for(let i=Math.floor(e/n)+1;$t(i*n)<t;i++){let t=$t(i*n);t>e&&r.push(t)}return r.push(t),r}function Xi(e){return String(e)}function Zi(e,t){if(e.length<=1)return[...e];let n=e.map((e,n)=>({tick:e,from:e.label.x-t[n]/2,to:e.label.x+t[n]/2})),r=n[n.length-1],i=[n[0]];for(let e of n.slice(1,-1))e.from-i[i.length-1].to>=8&&r.from-e.to>=8&&i.push(e);return r.from-i[i.length-1].to>=8&&i.push(r),i.map(e=>e.tick)}function Qi({data:e,encoding:t}){let n=/* @__PURE__ */ new Set,r=!1,i=e.map((e,i)=>{let a=t.x(e,i);i===0&&(r=a instanceof Date);let o=ea(a,i,r),s=String(t.key?t.key(e,i):r?new Date(o).toISOString():o);if(n.has(s))throw Error(`lineChart: two rows have the key "${s}". Keys must be unique.`);return n.add(s),{key:s,datum:e,index:i,x:o,values:t.series.map(({series:t,value:n})=>({series:t,value:ra(n(e,i),t,s)}))}});i.sort((e,t)=>e.x-t.x);for(let e=1;e<i.length;e++){let[t,n]=[i[e-1],i[e]];if(t.x===n.x){let e=r?new Date(t.x).toISOString():Xi(t.x);throw Error(`lineChart: the rows "${t.key}" and "${n.key}" have the same x, ${e}. Each x is one point on every line, so x values must be unique.`)}}let a=ta(t,r,i.map(e=>e.x)),o=$i(i,t.series.length);return{rows:i.map((e,t)=>({...e,label:a(e.x),missing:new Set(e.values.flatMap(e=>e.value===void 0?[e.series]:[])),levels:o[t]})),time:r}}function $i(e,t){let n=e.map(()=>({}));for(let r=0;r<t;r++){let t=-1,i=-1;e.forEach((a,o)=>{let{series:s,value:c}=a.values[r];if(c!==void 0){n[o][s]=c,t=o;return}if(i<=o)for(i=o+1;i<e.length&&e[i].values[r].value===void 0;)i++;let l=e[t]?.values[r].value,u=e[i]?.values[r].value;n[o][s]=l!==void 0&&u!==void 0?l+(a.x-e[t].x)/(e[i].x-e[t].x)*(u-l):l??u??0})}return n}function ea(e,t,n){if(e instanceof Date){if(!n)throw TypeError(`lineChart: x must be all numbers or all Dates, but row 0's is a number and row ${t}'s a Date.`);let r=e.getTime();if(Number.isNaN(r))throw TypeError(`lineChart: x must be a valid Date, got an invalid Date in row ${t}.`);return r}if(n)throw TypeError(typeof e==`number`?`lineChart: x must be all numbers or all Dates, but row 0's is a Date and row ${t}'s a number.`:`lineChart: x must be a valid Date, got ${sa(e)} in row ${t}.`);if(typeof e!=`number`||!Number.isFinite(e))throw RangeError(`lineChart: x must be a finite number, got ${sa(e)} in row ${t}.`);return e}function ta(e,t,n){let{xFormat:r}=e;return r?e=>r(t?new Date(e):e):t?Di(n,e.timeZone):Xi}function na(e,t){return t?new Date(e):e}function ra(e,t,n){if(typeof e==`number`&&Number.isFinite(e))return e;if(e!=null)throw RangeError(`lineChart: "${t}" for "${n}" must be a finite number, or null or undefined where it has no value, got ${sa(e)}.`)}function ia(e,t){let n=/* @__PURE__ */ new Map;for(let r of e)for(let{series:e,value:i}of r.values){if(i===void 0)continue;let r=t(e,i),a=r.replace(/\d/g,`0`);n.has(a)||n.set(a,r)}return[...n.values()]}function aa(e,t,n,r){return e.reduce((e,i)=>Math.max(e,r(i,t,n)),0)}function oa(e){return typeof e==`function`?e:t=>t[e]}let sa=e=>typeof e==`string`?JSON.stringify(e):String(e);function ca(e,n,r){let i=ir(e,`lineChart`);lr(n,`lineChart`);let o=n,s=wn(n.motion,r.motion),c=at(n.on,r.presets),l=fn(n.colors),u=r.clock??a,d=i.ownerDocument;un(d);let f=Y(`svg`,{class:`ec-chart ec-line-chart`,role:`group`},i),p=Y(`g`,{class:`ec-grid`,"aria-hidden":`true`},f),m=Y(`g`,{class:`ec-axis`,"aria-hidden":`true`},f),h=Y(`line`,{class:`ec-crosshair`,"aria-hidden":`true`,visibility:`hidden`},f),g=Y(`g`,{class:`ec-focus`,"aria-hidden":`true`,visibility:`hidden`},f),_=Y(`g`,{class:`ec-marks`,"aria-hidden":`true`},f),v=Y(`g`,{class:`ec-lines`},_),y=Y(`g`,{class:`ec-points`},_),x=Y(`g`,{class:`ec-columns`},f),w=Y(`g`,{class:`ec-overlay`,"aria-hidden":`true`},f),T=Et(f),E=[],D=/* @__PURE__ */ new Map,O=/* @__PURE__ */ new Map,k=/* @__PURE__ */ new WeakMap,A=[],j=/* @__PURE__ */ new Map,M=/* @__PURE__ */ new Map,N=Zn(e=>e.kind===`line`?e.presence.animating:e.row.presence.animating||e.row.values.animating||e.row.x.animating),P=zn(`lineChart`),F=ar(i),I=!1,ee=1/0,L=/* @__PURE__ */ new WeakSet,R,z,B;try{R=fe(o),z=Ye(o,R),B=ba(o,R)}catch(e){throw f.remove(),e}let V=e=>M.get(e)??j.get(e)??N.get(e),te=In({overlay:w,mark:e=>({set:t=>{V(e)?.handle.set(t),qe.restyled(e)},reset:()=>{V(e)?.handle.reset(),qe.restyled(e)}}),colors:e=>V(e)?.parts[0]?.colors}),H=pt({effects:c,motion:s,icons:r.icons,clock:u,surface:te}),ne=xr(f,{motion:s,option:()=>o.tooltip,description:()=>o.markDescription}),re=hn(f),ie=rr(f),ae=o.announce?vt(f):void 0,oe=!1,U=()=>{oe=!0},W=C(R.frame.scale,S,{clock:u,motion:s,onChange:U}),se=C(R.frame.box,S,{clock:u,motion:s,onChange:U}),ce=/* @__PURE__ */ new Map,le=/* @__PURE__ */ new Map,G=R.decimals,ue={changed:[],added:[],removed:[]},K=R.frame,de=ur({clock:u,runner:H,leaving:N,draw:Ee,land:Oe});function fe(e,t=c){let n=Ii(e);sr(t,n.series.map(e=>e.series),`lineChart`);let r=Li({data:e.data,encoding:n,width:e.width??F,height:e.height,format:Bn(e),measure:T,label:pe(e,!0)}),i=new Set(r.series);for(let e of r.rows)for(let t of r.series){let n=Vi(t,e.key);if(i.has(n))throw RangeError(`lineChart: two marks would have the key "${n}". Series and keys joined with "@" must be unique.`);i.add(n)}for(let e of r.rows)if(i.has(e.key))throw RangeError(`lineChart: the key "${e.key}" would name both an x and a line or point. A row's key can't be a series, or a series and a key joined with "@".`);return r}function pe(e,n=!1){let{labels:r}=e;if(r===!1)return;let i=Bn(e);return(a,o)=>{let s=`${i(o)} ${Ln(e.seriesLabels,a)}`;if(typeof r!=`function`)return s;try{let e=r(o,a,i);return e==null?``:String(e)}catch(e){return!n&&!L.has(r)&&(L.add(r),t(e)),s}}}function me(e){let t=pe(o);if(t)return{text:(n,r)=>t(n,Wn(r,e[n]??Un(r))),measure:T}}function he(e){let t=e.rows.map(la);return{lines:new Map(zi(e.frame,t,e.series,_e(e),e.time,me(e.decimals)).map(e=>[e.series,e])),points:new Map(t.flatMap(t=>Hi(e.frame,t,e.series,e.time)).map(e=>[e.key,e]))}}function ge(e){let t=e.rows[0],n=e.rows[e.rows.length-1];return t&&n?Math.min(Math.max(ee,t.x),n.x):ee}function _e(e){let t=e.rows[e.rows.length-1];return t&&ee<t.x?ge(e):1/0}let ve=e=>!e.leaving&&e.row.x<=ge(R);function ye(e,t){let n=Y(`g`,{class:`ec-column`,"data-key":e.key,role:`img`},x),r={clock:u,motion:s,onChange:U},i={key:e.key,row:e,column:n,hit:Y(`rect`,{class:`ec-hit`},n),x:C(e.x,b,r),values:C(e.levels,S,r),presence:C(+!t,b,r),anchor:void 0,points:[],leaving:!1,shown:!0,px:0};return k.set(n,i),i}function be(e,t,n){let r=Y(`g`,{class:`ec-line`,"data-key":e,"data-series":e},v),i=Y(`g`,{class:`ec-body`},r),a={kind:`line`,key:e,series:e,group:r,body:i,path:Y(`path`,{class:`ec-stroke`,"stroke-width":Mi},i),end:Y(`circle`,{class:`ec-end`,r:Ni},i),label:Y(`text`,{class:`ec-value ec-end-label`},r),drawnLabel:void 0,parts:[],handle:kn(()=>a),target:t,shown:t,presence:C(+!n,b,{clock:u,motion:s,onChange:U}),leave:void 0};return a}function xe(e,t){let n=Y(`g`,{class:`ec-point`,"data-key":t.key,"data-series":t.series},y),r=Y(`g`,{class:`ec-body`},n),i={kind:`point`,key:t.key,series:t.series,row:e,group:n,body:r,path:Y(`path`,{class:`ec-dot`},r),parts:[],handle:kn(()=>i),target:t,shown:t,hidden:void 0,leave:void 0};return i}let q=e=>V(e.key)===e,Se=e=>e.points.filter(e=>M.get(e.key)===e),Ce=()=>[...N.values()].filter(e=>e.kind===`line`),we=()=>({scale:W.value,box:se.value});function Te(){let e=e=>({x:e.x.value,values:e.values.value}),t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Set,r=i=>{let a=t.get(i);if(a)return a;let o=i.presence.value,s=e(i);if(i.anchor&&o<1&&!n.has(i)){n.add(i);let e=r(i.anchor);n.delete(i),s={x:e.x+o*(s.x-e.x),values:S(e.values,s.values)(o)}}return t.set(i,s),s};return[...E,...[...O.values()].filter(e=>e.presence.value>0&&e.anchor)].map(e=>{let{x:t,values:n}=r(e);return{record:e,state:{key:e.key,datum:e.row.datum,x:t,values:n,missing:e.row.missing}}}).sort((e,t)=>e.state.x-t.state.x)}function Ee(){if(!oe)return;oe=!1;let e=we(),t=Te();ke(e),Ae(e,t.map(e=>e.state));for(let{record:n,state:r}of t){let t=new Map(Hi(e,r,n.points.map(e=>e.series),R.time).map(e=>[e.key,e]));Me(n.points.filter(q).flatMap(e=>t.has(e.key)?[{record:e,placed:t.get(e.key)}]:[]))}Le(t.map(e=>e.state)),Re(e,t),Ue()}function De(){let e=we(),t=Te();Ae(e,t.map(e=>e.state)),Re(e,t),Ue()}function Oe(){for(let e of O.values()){for(let t of[e.x,e.values,e.presence])t.stop();e.column.remove()}O.clear();for(let e of E)e.anchor=void 0,e.points=e.points.filter(q);for(let[e,t]of[[ce,R.yTicks],[le,R.xTicks]]){for(let t of[...e.values()])t.wanted||(t.line?.remove(),t.label.remove(),e.delete(t.value));for(let n of t){let t=e.get(n.value);t&&(t.line&&`line`in n&&X(t.line,{...n.line,opacity:void 0}),Tt(t.label,n.label),t.label.removeAttribute(`opacity`))}}G=R.decimals;let{frame:e}=R;X(f,bt(e.box)),K=e;let t=he(R),n=(e,t)=>{let n=e.flatMap(e=>{let n=t(e);return n?[{record:e,to:n}]:[]});if(!n.every(({record:e,to:t})=>ma(e.target.geometry,t.geometry)&&ha(e.target.data,t.data)))for(let{record:e,to:t}of n)e.target=t;Me(n.map(({record:e})=>({record:e,placed:e.target})))};n(A,e=>t.lines.get(e.series)),je(new Map(A.flatMap(e=>t.lines.has(e.series)?[[e,t.lines.get(e.series)]]:[])));let r=E.map(e=>({record:e,state:la(e.row)}));for(let{record:e}of r)n(Se(e),e=>t.points.get(e.key));Le(r.map(e=>e.state)),Re(e,r),Ue(),oe=!1}function ke(e){K=e,X(f,bt(e.box));let t=Bn(o);for(let n of ce.values()){let r=qi(e,n.value,t(n.value)),i=n.opacity.value<1?n.opacity.value:void 0;X(n.line,{...r.line,opacity:i}),Tt(n.label,r.label),X(n.label,{opacity:i})}for(let t of le.values())Tt(t.label,Ji(e,t.value,t.text).label),X(t.label,{opacity:t.opacity.value<1?t.opacity.value:void 0})}function Ae(e,t){let n=[...A,...Ce()];if(t.length===0||n.length===0)return;let r=zi(e,t,n.map(e=>e.series),_e(R),R.time,me(G));Me(n.map((e,t)=>({record:e,placed:r[t]}))),je(new Map(n.map((e,t)=>[e,r[t]])))}function je(e){for(let[t,{label:n}]of e)n&&Tt(t.label,n),t.drawnLabel=n&&n.text!==``?n:void 0,X(t.label,{visibility:t.drawnLabel?void 0:`hidden`})}function Me(e){let t=e.some(({record:e,placed:t})=>!ha(e.shown.data,t.data));for(let{record:n,placed:r}of e)n.kind===`line`?Ne(n,r,t):Pe(n,r,t)}function Ne(e,t,n){let r=n||pr(e.shown.geometry,t.geometry);e.shown=t;let{geometry:i}=t;Fe(e,nn(l.slot(e.series)),{visible:i.length>=.5,open:{width:i.thickness}}),X(e.end,{cx:i.end.x,cy:i.end.y,visibility:t.data.samples.length===0?`hidden`:void 0});let a=e.presence.value;X(e.group,{opacity:a<1?a:void 0}),r&&H.change(i,t.data)}function Pe(e,t,n){let r=n||pr(e.shown.geometry,t.geometry);e.shown=t,Fe(e,nn(l.slot(e.series)),{visible:!0}),r&&H.change(t.geometry,t.data)}function Fe(e,t,n){let r=e.parts[0],{d:i}=e.shown.geometry.outline,a=r?.colors.color!==t.color;(a||r?.d!==i||r.visible!==n.visible||r.open?.width!==n.open?.width)&&(e.path.getAttribute(`d`)!==i&&e.path.setAttribute(`d`,i),a&&yt(e.group,an(t)),e.parts=[{element:e.path,d:i,colors:t,...n}],e.handle.repaint(),r&&a&&te.recolor(e.key))}let Ie=!1;function Le(e){let t=Bi(e,R.series);if(t.size!==0||Ie){for(let e of M.values())e.group.classList.toggle(`ec-alone`,t.has(e.key));Ie=t.size>0}}function Re(e,t){let{x:n}=Ri(e),r=t.filter(({record:e})=>ve(e)),i=Ui(e,r.map(({state:e})=>n(e.x)));r.forEach(({record:e,state:t},r)=>{X(e.hit,{...i[r]}),e.px=n(t.x)});let a=new Set(r.map(({record:e})=>e));for(let e of[...E,...O.values()]){let t=a.has(e);e.shown!==t&&(e.shown=t,X(e.column,{visibility:t?void 0:`hidden`,"aria-hidden":e.leaving?`true`:void 0}));let n=!ve(e);for(let t of e.points)t.hidden!==n&&(t.hidden=n,X(t.group,{visibility:n?`hidden`:void 0}),te.hide(t.key,n))}}function ze(e){let t=D.get(e);if(!t||!ve(t))return;let n=Se(t),r=n[0]?.shown.geometry.center.x??t.px;X(h,{...Wi(K,r),visibility:void 0});let i=n.map(e=>{let{transform:t}=e.handle.style,{center:n}=e.shown.geometry;return(t?J.apply(t,n):n).y}),{row:a}=t,s=i.length>0?{top:Math.min(...i)-Ni,bottom:Math.max(...i)+Ni}:{top:K.box.top,bottom:K.box.top};ne.showAt({x:r,...s},a,()=>ya(a,o))}function Be(){h.setAttribute(`visibility`,`hidden`),ne.hide()}let Ve;function He(e){let t=e===void 0?void 0:D.get(e),n=t!==void 0&&ve(t),r=n?Se(t):[];if(n&&r.length===0)Ve??(Ve=Y(`line`,{class:`ec-focus-ring`,"stroke-width":2},g)),(g.childElementCount>1||g.firstElementChild!==Ve)&&g.replaceChildren(Ve),X(Ve,Wi(K,t.px)),g.removeAttribute(`visibility`);else{for(Ve?.remove();g.childElementCount>r.length;)g.lastElementChild.remove();r.forEach((e,t)=>{let n=g.children[t];n||(n=Y(`g`,{},g),Y(`path`,{class:`ec-focus-ring`,"stroke-width":8},n),Y(`path`,{class:`ec-focus-gap`,"stroke-width":4},n));for(let t of Array.from(n.children))t.setAttribute(`d`,e.shown.geometry.outline.d);let{transform:r}=e.handle.style;X(n,{transform:r&&xt(r)})}),X(g,{visibility:r.length>0?void 0:`hidden`})}}function Ue(){qe.key!==void 0&&ze(qe.key),qe.ringKey!==void 0&&He(qe.ringKey)}let We=e=>({mark:e.target.geometry,data:e.target.data}),Ge=e=>({mark:e.shown.geometry,data:e.shown.data});function Ke(e){let t=e,n=typeof t?.closest==`function`?t.closest(`.ec-column`):null,r=n?k.get(n):void 0;return r&&D.get(r.key)===r&&ve(r)?r:void 0}let qe=Yn({svg:f,runner:H,events:P,dim:()=>!1,find(e){let t=Ke(e);return t&&{key:t.key}},live(e){let t=D.get(e);return t!==void 0&&ve(t)},order:()=>E.filter(ve).map(e=>e.key),page(e,t){let n=D.get(e);if(!R.time||!n)return;let r=E.filter(ve),i=Ti(n.row.x,t,Ii(o).timeZone);if(t>0)return(r.find(e=>e.row.x>=i)??r[r.length-1])?.key;for(let e=r.length-1;e>=0;e--)if(r[e].row.x<=i)return r[e].key;return r[0]?.key},marks:e=>{let t=D.get(e);return t?Se(t).map(e=>e.key):[]},element:e=>(D.get(e)??O.get(e))?.column,markElement:e=>V(e)?.group,onScreen(e){let t=V(e);return t&&Ge(t)},ring:He,tooltip:{show:ze,hide:Be,element:()=>ne.element()}}),Je=()=>re.update(R.series.map(e=>({series:e,label:Ln(o.seriesLabels,e)})),l,o.legend);function Ye(e,t){return tr({option:e.table,caption:e.label,category:typeof e.x==`string`?e.x:void 0,series:t.series,label:t=>Ln(e.seriesLabels,t),rows:t.rows.map(e=>({key:e.key,category:e.label,datum:e.datum,index:e.index,values:ua(e.values),missing:e.missing,total:fa(e.values)})),format:Bn(e),total:!1})}function Xe(e){e.column.setAttribute(`aria-label`,B.get(e.key)),ne.describe(e.column,e.row)}function Ze(e,n){let r=o.announce;if(!ae||!r)return;let i=R.series,a=e=>e.row.label,{changed:s,added:c,removed:l}=ue,u=gt({...o.label===e.label?{}:{label:o.label},...i.join(`
|
|
94
|
+
`)===n.join(`
|
|
95
|
+
`)?{}:{series:i.map(e=>Ln(o.seriesLabels,e))},changed:s.map(a),added:c.map(a),removed:l.map(a),count:E.length});if(typeof r!=`function`){ae.say(u);return}let d=e=>e.key;try{let e=r({text:u,changed:s.map(d),added:c.map(d),removed:l.map(d)});e!=null&&ae.say(String(e))}catch(e){t(e)}}function Qe(e){R=e;let t=he(e),n={entering:[],exiting:[],changed:[]},r=new Set(e.rows.map(e=>e.key)),i=e.rows.length>0?e.series:[],a={changed:[],added:[],removed:[]},o=E,s=new Map(o.map(e=>[e,e.row])),c=new Map(e.rows.map(e=>[e.key,e])),l=A.filter(e=>!i.includes(e.series)),u=[];for(let e of o){let t=!r.has(e.key),n=c.get(e.key)?.missing;t&&(D.delete(e.key),e.leaving=!0,O.set(e.key,e),a.removed.push(e));for(let r of Se(e))(t||!i.includes(r.series)||n?.has(r.series))&&u.push(r)}for(let e of l)j.delete(e.series);for(let e of u)M.delete(e.key);for(let e of[...l,...u])N.start(e);n.exiting.push(...l,...u);let d=/* @__PURE__ */ new Set,f=a.removed.length>0;E=e.rows.map(e=>{let t=D.get(e.key);return t?(d.add(t),t.row.x!==e.x&&(f=!0),e.values.some((e,n)=>t.row.values[n]?.series!==e.series||t.row.values[n]?.value!==e.value)&&a.changed.push(t)):(t=O.get(e.key)??ye(e,!0),O.delete(e.key),t.leaving=!1,t.x.set(e.x),t.values.set(e.levels),D.set(e.key,t),a.added.push(t),f=!0),t.row=e,t}),E.forEach((e,t)=>{d.has(e)?e.presence.value===1&&(e.anchor=void 0):e.anchor=pa(E,t,d)});for(let e of a.removed)e.anchor??(e.anchor=pa(o,o.indexOf(e),d));let p=A;A=i.map(e=>{let r=j.get(e),i=t.lines.get(e);if(r){let t=[...d].some(t=>da(s.get(t),e)!==da(t.row,e));(f||t)&&n.changed.push({record:r,from:r.shown.geometry})}else r=$e(e,`line`)??be(e,i,!0),j.set(e,r),n.entering.push(r);return r.target=i,r});for(let e of E){let r=d.has(e)?s.get(e):void 0,a=i.filter(t=>!e.row.missing.has(t)).map(i=>{let a=Vi(i,e.key),o=t.points.get(a),s=M.get(a);return s?r&&da(r,i)!==da(e.row,i)&&n.changed.push({record:s,from:s.shown.geometry}):(s=$e(a,`point`)??xe(e,o),s.row=e,M.set(a,s),n.entering.push(s)),s.target=o,s}),o=new Set(a);e.points=[...a,...e.points.filter(e=>!o.has(e)&&q(e))]}for(let e of E)Xe(e);return $n(x,o.filter(e=>!e.leaving).map(e=>e.column),E.map(e=>e.column),qe.active),$n(v,p.map(e=>e.group),A.map(e=>e.group),()=>null),ue=a,oe=!0,Ee(),n}function $e(e,t){return N.get(e)?.kind===t?N.recall(e):void 0}function et(e,t){oe=!0;let{frame:n}=e;for(let[t,n,r]of[[ce,e.yTicks,!0],[le,e.xTicks,!1]]){let e=new Set(n.map(e=>e.value));for(let n of e)t.has(n)||tt(t,n,0,r);for(let n of t.values())n.wanted=e.has(n.value)}for(let t of e.xTicks)le.get(t.value).text=t.label.text;let r=Ce(),i=[...O.values()],a=Q(W,n.scale,fr)||[...ce.values()].some(e=>Q(e.opacity,+!!e.wanted,$))||E.some(e=>Q(e.values,e.row.levels,fr))||A.some(e=>Q(e.presence,1,$))||r.some(e=>Q(e.presence,0,$)),o=Q(se,n.box,fr)||[...le.values()].some(e=>Q(e.opacity,+!!e.wanted,$))||E.some(e=>Q(e.x,e.row.x,$)||e.anchor!==void 0&&Q(e.presence,1,$))||i.some(e=>e.anchor!==void 0&&Q(e.presence,0,$)),c,l;!t&&s.staged?(c={duration:500},l={duration:500,delay:a?500:0}):t||(c=l={duration:(a&&o?2:1)*500});let u=[],d=(e,t,n,r)=>{Q(e,t,n)&&(r?u.push(e.to(t,r)):e.set(t))};d(W,n.scale,fr,c),d(se,n.box,fr,l);for(let e of ce.values())d(e.opacity,+!!e.wanted,$,c);for(let e of le.values())d(e.opacity,+!!e.wanted,$,l);for(let e of E)d(e.values,e.row.levels,fr,c),d(e.x,e.row.x,$,l),d(e.presence,1,$,e.anchor?l:void 0);for(let e of i)d(e.presence,0,$,e.anchor?l:void 0);for(let e of A)d(e.presence,1,$,c);for(let e of r)d(e.presence,0,$,c);return u}function tt(e,t,n,r,i=``){let a={value:t,line:r?Y(`line`,{class:t===0?`ec-baseline`:`ec-gridline`},p):void 0,label:Y(`text`,{class:`ec-tick`},m),text:i,opacity:C(n,b,{clock:u,motion:s,onChange:U}),wanted:!0};e.set(t,a);for(let t of[...e.values()].sort((e,t)=>e.value-t.value))t.line&&p.appendChild(t.line),m.appendChild(t.label)}function nt(e,t){return R=e,G=Object.fromEntries(e.series.map(t=>[t,Math.max(G[t]??0,e.decimals[t]??0)])),de.run(et(e,t))}let rt=_r(f,s);function it(){if(I)return;let e=fe(o),t=new Map(e.rows.map(e=>[e.key,e]));for(let e of E)e.row=t.get(e.key)??e.row;let n=he(e);for(let e of A)e.target=n.lines.get(e.series)??e.target;for(let e of M.values())e.target=n.points.get(e.key)??e.target;nt(e,!0)}let ot=hr(i,u,F,e=>{F=e,o.width===void 0&&it()}),st=gr(d,()=>{T.clear(),it()});or(f,o),Je(),ie.render(z);{let e=he(R);for(let e of R.yTicks)tt(ce,e.value,1,!0);for(let e of R.xTicks)tt(le,e.value,1,!1,e.label.text);E=R.rows.map(t=>{let n=ye(t,!1);return D.set(t.key,n),n.points=R.series.filter(e=>!t.missing.has(e)).map(r=>{let i=xe(n,e.points.get(Vi(r,t.key)));return M.set(i.key,i),i}),Xe(n),n}),A=R.rows.length>0?R.series.map(t=>be(t,e.lines.get(t),!1)):[];for(let e of A)j.set(e.series,e);Oe()}let ct=()=>[...A,...E.flatMap(Se)];return qe.sync(),H.enter(ct().map(We)),bn(qe.link,{element:f,async update(e){if(I)return;if(e.motion!==void 0&&e.motion!==o.motion)throw TypeError("lineChart: `motion` can't be changed by update() yet.");let t={...o,...e};lr(t,`lineChart`);let n=`on`in e?cr(c,o.on,t.on,r.presets):c,i=fe(t,n),a=Ye(t,i),u=ba(t,i);`colors`in e&&(l=fn(t.colors));let d=o,p=R.series;o=t,B=u,or(f,o),ie.render(a);let m=ae!==void 0;o.announce&&!ae?ae=vt(f):!o.announce&&ae&&(ae.destroy(),ae=void 0),de.supersede();let h=n!==c;c=n;let g=dr({runner:H,events:P,hover:qe,leaving:N,input:We,onScreen:Ge,data:`data`in e,...h?{swap:e=>{let t=new Set(e.entering);H.swap(n,ct().filter(e=>!t.has(e)).map(We))}}:{}},()=>Qe(i),()=>{m&&Ze(d,p)});Je();let _=nt(i,s.mode===`off`);await de.wait(_,g)},reveal(e){if(I)return;if(e instanceof Date&&Number.isNaN(e.getTime()))throw RangeError(`lineChart: reveal(x) needs a valid Date, got an invalid Date.`);let t=e instanceof Date?e.getTime():e;if(typeof t!=`number`||Number.isNaN(t))throw RangeError(`lineChart: reveal(x) needs a number, got ${typeof t==`string`?JSON.stringify(t):String(t)}.`);let n=ge(R);ee=t,ge(R)!==n&&(De(),qe.dropGone(),qe.sync())},on:P.on,marks:()=>[...A.map(e=>e.shown.geometry),...E.filter(ve).flatMap(e=>Se(e).map(e=>e.shown.geometry))],focus(e){if(I)return;let t=D.get(e)??M.get(e)?.row;t&&qe.focus(t.key)},leave(){I||qe.leave()},labels:()=>A.flatMap(e=>Xn(e.key,`value`,e.drawnLabel,e.label)),destroy(){if(!I){I=!0,de.destroy(),qe.destroy(),H.destroy(),ne.destroy(),re.destroy(),ie.destroy(),ae?.destroy(),rt(),ot(),st();for(let e of[...E,...O.values()])for(let t of[e.x,e.values,e.presence])t.stop();for(let e of[...A,...Ce()])e.presence.stop();for(let e of N.values())e.leave?.resolve();W.stop(),se.stop();for(let e of[...ce.values(),...le.values()])e.opacity.stop();P.clear(),D.clear(),O.clear(),j.clear(),M.clear(),N.clear(),E=[],A=[],f.remove()}}})}function la(e){return{key:e.key,datum:e.datum,x:e.x,values:e.levels,missing:e.missing}}function ua(e){return e.flatMap(e=>e.value===void 0?[]:[{series:e.series,value:e.value}])}function da(e,t){return e.values.find(e=>e.series===t)?.value}function fa(e){return e.reduce((e,t)=>e+(t.value??0),0)}function pa(e,t,n){for(let r=t-1;r>=0;r--)if(n.has(e[r]))return e[r];for(let r=t+1;r<e.length;r++)if(n.has(e[r]))return e[r]}function ma(e,t){return e.key===t.key&&!pr(e,t)&&e.start.x===t.start.x&&e.start.y===t.start.y&&e.end.x===t.end.x&&e.end.y===t.end.y}function ha(e,t){return e.datum!==t.datum||e.samples.length!==t.samples.length?!1:e.samples.every((e,n)=>{let r=t.samples[n];return e.t===r.t&&e.value===r.value&&ga(e.at,r.at)&&e.gapBefore===r.gapBefore})}function ga(e,t){return e===t||e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function _a(e,t){return ua(e).map(e=>({series:e.series,label:Ln(t.seriesLabels,e.series),value:e.value}))}function va(e,t){let n=Bn(t);return e.map(e=>{let r=Ln(t.seriesLabels,e.series);return e.value===void 0?`${r} missing`:`${n(e.value)} ${r}`})}function ya(e,t){return e.missing.size===0?br(e.label,_a(e.values,t),Bn(t),{total:!1}):{title:e.label,lines:[va(e.values,t).join(` · `)]}}function ba(e,n){let r=Bn(e);return new Map(n.rows.map(n=>{let i=_a(n.values,e),a=`${n.label}: ${va(n.values,e).join(`, `)}`;if(!e.markLabel)return[n.key,a];try{let t=e.markLabel(n.datum,{key:n.key,category:n.label,values:i,total:fa(n.values),format:r,text:a});if(t!=null&&String(t).trim()!==``)return[n.key,String(t)]}catch(e){t(e)}return[n.key,a]}))}let xa=.5;function Sa(e){let t=Ca(e.start,e.pivot);return t>xa&&Math.abs(Ca(e.center,e.pivot)-t)<=xa&&Math.abs(Ca(e.end,e.pivot)-t)<=xa}let Ca=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y),wa=.5,Ta=[`left`,`right`,`top`,`bottom`];function Ea(e){return typeof e==`string`&&Ta.includes(e)}function Da(e,t){if(t!==`auto`)return e.map(()=>t);if(e.length===0)return[];let n=ja(e,e=>e.x,e=>e.x+e.width,`left`,`right`),r=ja(e,e=>e.y+e.height,e=>e.y,`bottom`,`top`);if(n&&r)return Ma(e)?n:r;let i=n??r;if(!i)throw RangeError(`expressive: baseline "auto" found no edge that every mark grows from. Pass baseline: "left", "right", "top" or "bottom".`);return i}function Oa(e,t,n){let r=Aa(t.map(e=>e.box)),i=Na(r,n),a=t.map((e,t)=>({index:t,...i(e.box)})).sort((e,t)=>e.near-t.near||e.far-t.far||e.index-t.index),o=0,s=1/0,c=a.map(({index:e,near:n,far:r})=>{o>0&&r>n&&(s=Math.min(s,n-o));let i=Math.max(0,r-o);return o=Math.max(o,r),{series:t[e].series,size:i}}),l=t[a[a.length-1].index],u=t.length===1?t[0].series:void 0;return{geometry:pe({key:e,...u===void 0?{}:{series:u},...r,baseline:n,radius:l.radius,gap:Number.isFinite(s)?Math.max(0,Pa(s)):0,...c.every(e=>e.series!==void 0)?{segments:c.map(e=>({series:e.series,size:Pa(e.size)}))}:{}}),order:a.map(e=>e.index)}}function ka(e,t){let n=t[0]===`left`||t[0]===`right`,r=e=>n?e.y:e.x,i=e=>n?e.x:e.y;return e.map((e,t)=>t).sort((t,n)=>r(e[t])-r(e[n])||i(e[t])-i(e[n])||t-n)}function Aa(e){let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y));return{x:t,y:n,width:Pa(Math.max(...e.map(e=>e.x+e.width))-t),height:Pa(Math.max(...e.map(e=>e.y+e.height))-n)}}function ja(e,t,n,r,i){let a=e[0];if(!a)return[];for(let o of[t(a),n(a)]){let a=[];for(let s of e)if(Math.abs(t(s)-o)<wa)a.push(r);else if(Math.abs(n(s)-o)<wa)a.push(i);else break;if(a.length===e.length)return a}}function Ma(e){let t=e=>Math.max(...e)-Math.min(...e),n=t(e.map(e=>e.y+e.height/2)),r=t(e.map(e=>e.x+e.width/2));return n===r?e[0].width>=e[0].height:n>r}function Na(e,t){switch(t){case`left`:return t=>({near:t.x-e.x,far:t.x+t.width-e.x});case`right`:return t=>({near:e.x+e.width-(t.x+t.width),far:e.x+e.width-t.x});case`top`:return t=>({near:t.y-e.y,far:t.y+t.height-e.y});case`bottom`:return t=>({near:e.y+e.height-(t.y+t.height),far:e.y+e.height-t.y})}}function Pa(e){return Math.round(e*1e3)/1e3}function Fa(){let e=/* @__PURE__ */ new Map,t=t=>{let n=e.get(t);return n||(n={attributes:/* @__PURE__ */ new Map,styles:/* @__PURE__ */ new Map,classes:/* @__PURE__ */ new Set,before:{}},e.set(t,n)),n},n=e=>e.style,r=(e,t,n)=>{n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)},i=(e,t)=>{let i=t.before.style;t.styles.size>0||!i||(t.before.style=void 0,n(e)?.cssText===i.css&&r(e,`style`,i.text))},a=(e,t)=>{let n=t.before.class;if(t.classes.size>0||n===void 0)return;t.before.class=void 0;let i=e=>[...new Set((e??``).split(/\s+/).filter(Boolean))].sort().join(` `);i(e.getAttribute(`class`))===i(n)&&r(e,`class`,n)};function o(e,n,i){let a=e.getAttribute(n),o=t(e).attributes,s=o.get(n);s?(a!==s.written&&(s.original=a),s.written=i):o.set(n,{original:a,written:i}),r(e,n,i)}function s(t,n,i){if(i!==null){o(t,n,i);return}let a=e.get(t)?.attributes,s=a?.get(n);a&&s&&(t.getAttribute(n)===s.written&&r(t,n,s.original),a.delete(n))}function c(e,r,a){let o=n(e);if(!o)return;let s=t(e),c=s.styles.get(r);if(a===void 0){if(!c)return;c.value===``?o.removeProperty(r):o.setProperty(r,c.value,c.priority),s.styles.delete(r),i(e,s)}else c||(s.styles.size===0&&(s.before.style={text:e.getAttribute(`style`),css:o.cssText}),s.styles.set(r,{value:o.getPropertyValue(r),priority:o.getPropertyPriority(r)})),o.getPropertyValue(r)!==a&&o.setProperty(r,a)}function l(n,r,i){let o=n.classList;if(i){if(o.contains(r))return;let e=t(n);e.classes.size===0&&(e.before.class=n.getAttribute(`class`)),e.classes.add(r),o.add(r);return}let s=e.get(n);s?.classes.delete(r)&&(o.remove(r),a(n,s))}function u(t){let n=e.get(t);if(n){for(let e of[...n.styles.keys()])c(t,e,void 0);for(let e of[...n.classes])l(t,e,!1);for(let e of[...n.attributes.keys()])s(t,e,null);e.delete(t)}}return{attribute:s,remove:(e,t)=>o(e,t,null),style:c,styled:(t,n)=>e.get(t)?.styles.has(n)??!1,toggleClass:l,restore:u,restoreAll(){for(let t of[...e.keys()])u(t)},elements:()=>[...e.keys()]}}function Ia(){let e=/* @__PURE__ */ new Map;return t=>(e.has(t)||e.set(t,Ga(t)),e.get(t))}function La(e,t,n,r=Ga){let i=r(e),a=i&&r(t);return i&&a?J.multiply(Ye(i),a):J.multiply(Ye(Ka(e,n)),Ka(t,n))}function Ra(e){return Xe(e.getAttribute(`transform`)??``)}function za(e){let[t,n,r,i]=e,a=1e-9*Math.max(Math.abs(t),Math.abs(n),Math.abs(r),Math.abs(i));return Math.abs(n)<=a&&Math.abs(r)<=a||Math.abs(t)<=a&&Math.abs(i)<=a}function Ba(e){let[t,n,r,i]=e,a=t*t+n*n,o=r*r+i*i,s=1e-4*Math.max(a,o);return Math.abs(a-o)<=s&&Math.abs(t*r+n*i)<=s}function Va(e){return Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]))}function Ha(e,t){let n=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x,y:t.y+t.height},{x:t.x+t.width,y:t.y+t.height}].map(t=>J.apply(e,t)),r=n.map(e=>e.x),i=n.map(e=>e.y),a=qa(Math.min(...r)),o=qa(Math.min(...i));return{x:a,y:o,width:qa(qa(Math.max(...r))-a),height:qa(qa(Math.max(...i))-o)}}function Ua(e){let t=Wa(e),n=e=>{let n=Number.parseFloat(t(e)??``);return Number.isFinite(n)?n:0};return{x:n(`x`),y:n(`y`),width:Math.max(0,n(`width`)),height:Math.max(0,n(`height`))}}function Wa(e){return t=>{let n=e[t];return typeof n?.baseVal?.value==`number`?String(n.baseVal.value):e.getAttribute(t)}}function Ga(e){let t=typeof e.getScreenCTM==`function`?e.getScreenCTM():null;return t?[t.a,t.b,t.c,t.d,t.e,t.f]:void 0}function Ka(e,t){let n=[1,0,0,1,0,0];for(let r=e;r&&r!==t;r=r.parentElement)n=J.multiply(Ra(r),n);return n}function qa(e){return Math.round(e*1e3)/1e3}function Ja(e,t,n){let r={},i=!1,a=On(),o=()=>{let{transform:n,opacity:a,emphasis:o}=r;for(let r of e()){let{element:e,colors:s}=r,c=n&&r.parentInverse?J.multiply(r.parentInverse,n,r.parent,Ra(e)):void 0;t.style(e,`transform`,c&&ao(c)),t.style(e,`transform-origin`,c&&`0 0`),t.style(e,`transform-box`,c&&`view-box`),t.style(e,`opacity`,a===void 0?void 0:String(a));let l=s?o===void 0?i?s.strong:void 0:io(s,o):void 0;t.style(e,`fill`,s?.paint===`fill`?l:void 0),t.style(e,`stroke`,s?.paint===`stroke`?l:void 0),t.style(e,`transition`,o===void 0||!s?void 0:`none`)}s()},s=()=>{let t=e().flatMap(e=>e.outline===void 0?[]:[{...e.outline,color:e.colors?.color}]);a.paint(n(),t,r.halo,r.transform)};return{get style(){return r},set(e){r=ct(r,e),o()},reset(){r={},o()},repaint:o,hot(e){e!==i&&(i=e,o())}}}function Ya(e,t){let n=eo(e,t,`fill`),r=n===Za?`stroke`:`fill`,i=r===`fill`?n:eo(e,t,`stroke`);if(i!==void 0&&i!==Za)return{color:i,strong:`color-mix(in oklab, ${i}, ${rn(`text`)} ${Xa})`,paint:r}}let Xa=`25%`,Za=`none`,Qa=/* @__PURE__ */ new WeakMap;function $a(e){let t=Qa.get(e);if(t!==void 0)return t;let n=e.ownerDocument.defaultView;if(!e.isConnected||typeof n?.getComputedStyle!=`function`)return!1;let r=e.ownerDocument.createElementNS(`http://www.w3.org/2000/svg`,`g`);r.setAttribute(`stroke-miterlimit`,`7`),e.appendChild(r);let i=n.getComputedStyle(r).getPropertyValue(`stroke-miterlimit`).trim()===`7`;return r.remove(),Qa.set(e,i),i}function eo(e,t,n){let r=e.ownerDocument.defaultView?.getComputedStyle?.(e).getPropertyValue(n),i=ro(r);if(r&&$a(t))return i;let a;for(let r=e;r&&a===void 0;r=r===t?null:r.parentElement){let e=r.style?.getPropertyValue(n)||r.getAttribute(n);e&&(a=e)}let o=n===`fill`?i?.replace(/\s/g,``)===`rgb(0,0,0)`:i===Za;return i!==void 0&&!(o&&a!==void 0)?i:ro(a)}function to(e,t){let n=e.ownerDocument.defaultView?.getComputedStyle?.(e).getPropertyValue(`stroke-width`),r=no(n);if(n&&$a(t)||r!==void 0&&r!==1)return r;for(let n=e;n&&!n.style?.getPropertyValue(`stroke-width`);n=n===t?null:n.parentElement){let e=no(n.getAttribute(`stroke-width`));if(e!==void 0)return e}return r}function no(e){let t=/^\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)\s*(?:px\s*)?$/i.exec(e??``),n=t?Number(t[1]):NaN;return n>=0&&Number.isFinite(n)?n:void 0}function ro(e){let t=e?.trim().toLowerCase();if(t&&t!==`inherit`&&!t.startsWith(`url(`))return t===Za||t===`transparent`||/^rgba\((?:[^,]+,){3}\s*0(?:\.0*)?\s*\)$/.test(t)?Za:e.trim()}function io(e,t){let n=Math.min(1,Math.max(0,t));return n===0?e.color:n===1?e.strong:`color-mix(in srgb, ${e.strong} ${Math.round(n*1e3)/10}%, ${e.color})`}function ao(e){return`matrix(${e.map((e,t)=>t<4?Math.round(e*1e6)/1e6:Math.round(e*1e3)/1e3).join(`, `)})`}function oo(e){if(typeof e==`string`){if(typeof document>`u`)throw TypeError(`expressive: a selector needs a document.`);return{elements:Array.from(document.querySelectorAll(e)),data:void 0}}if(uo(e))return{elements:[e],data:void 0};if(fo(e)){let t=Array.from(e.nodes()),n=Array.from(e.data());return{elements:t,data:n.length===t.length?n:void 0}}if(typeof e==`object`&&e&&typeof e.length==`number`)return{elements:Array.from(e),data:void 0};throw TypeError(`expressive needs marks: a selector, an element, a list of elements or a D3 selection.`)}function so(e){if(!fo(e))return;let{elements:t,data:n}=oo(e);return n&&new Map(t.map((e,t)=>[e,n[t]]))}function co(e){let t;for(let n of e){if(!uo(n))throw TypeError(`expressive: marks must be elements, got ${String(n)}.`);let e=n.ownerSVGElement??null;if(!e){let e=n.localName;throw TypeError(e===`svg`?`expressive: got an <svg>, not its marks. Pass the marks, for example svg.querySelectorAll("rect").`:`expressive: marks must be SVG elements inside an <svg>, got <${e}>.`)}for(;e.ownerSVGElement;)e=e.ownerSVGElement;if(t&&e!==t)throw TypeError(`expressive: all marks must be in the same <svg>.`);t=e}if(!t)throw TypeError(`expressive: no marks.`);return t}function lo(e,t){let n=e[0].parentElement??t;for(;n!==t&&!e.every(e=>e!==n&&n.contains(e));)n=n.parentElement??t;return n}function uo(e){return typeof e==`object`&&!!e&&e.nodeType===1}function fo(e){return typeof e==`object`&&!!e&&typeof e.nodes==`function`&&typeof e.data==`function`}let po=[`d`,`x`,`y`,`width`,`height`,`cx`,`cy`,`r`,`rx`,`ry`,`x1`,`y1`,`x2`,`y2`,`points`,`transform`],mo=[`transform`,`style`];function ho(e,t,n){let r=e.defaultView?.MutationObserver??(typeof MutationObserver>`u`?void 0:MutationObserver);if(!r)throw TypeError(`expressive: watch needs MutationObserver, which this DOM doesn't have.`);let i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Set,o=/* @__PURE__ */ new Set,s=/* @__PURE__ */ new Set,c,l=e=>{for(let{target:t,attributeName:n}of e){let e=t;o.has(e)&&i.add(e),s.has(e)&&(n===`transform`||n===`style`)&&a.add(e)}},u=new r(e=>{l(e),(i.size>0||a.size>0)&&!c&&(c=t.onFrame(d))});function d(){if(l(u.takeRecords()),i.size===0&&a.size===0){c?.(),c=void 0;return}let e={marks:i,ancestors:a};i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Set,n(e)}function f(){u.takeRecords(),c?.(),c=void 0,i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Set}return{observe(e,t){f(),u.disconnect(),o=new Set(e),s=/* @__PURE__ */ new Set;for(let n of e)for(let e=n.parentElement;e&&!s.has(e);e=e===t?null:e.parentElement)s.add(e);for(let e of s)o.has(e)||u.observe(e,{attributes:!0,attributeFilter:mo});for(let e of o)u.observe(e,{attributes:!0,attributeFilter:po})},destroy(){f(),u.disconnect(),o=/* @__PURE__ */ new Set,s=/* @__PURE__ */ new Set}}}let go=/* @__PURE__ */ new Set([`circle`,`ellipse`,`line`,`path`,`polygon`,`polyline`]),_o=/* @__PURE__ */ new Set([`img`,`image`,`graphics-symbol`,`graphics-object`]);function vo(e,n,r){yo(n);let i=wn(n.motion,r.motion),o=at(n.on,r.presets),s=n.on,c=r.clock??a,l=n.dim===!0,u=Fa(),d=/* @__PURE__ */ new WeakMap,f=e,p=!1,m=!1;function h(e){let{elements:t,data:r}=oo(e);if(t.length===0)return{root:void 0,ancestor:void 0,marks:[]};let i=co(t),a=lo(t,i),s=/* @__PURE__ */ new Map;t.forEach((e,t)=>{let i=w(e,t,r),a=n.key(i,e);if(a==null||a===``)throw TypeError(`expressive: key returned ${JSON.stringify(a)??String(a)} for a <${e.localName}>. Every mark needs a key.`);let o=String(a),c=e.localName;if(!n.geometry&&c!==`rect`&&!go.has(c))throw TypeError(`expressive: can't read the geometry of a <${c}> (mark "${o}"). <rect>, <circle>, <ellipse>, <line>, <path>, <polygon> and <polyline> are read; describe others with the geometry option.`);let l=T(i,e,o),u=s.get(o);if(!u)s.set(o,u=[]);else if(!n.geometry&&(go.has(c)||go.has(u[0].element.localName))){let e=go.has(c)?c:u[0].element.localName;throw TypeError(`expressive: two elements have the key "${o}", and one is a <${e}>. A circle or a shape is a mark of its own: give each its own key.`)}else if(l===void 0)throw RangeError(`expressive: two elements have the key "${o}". Keys must be unique, or name each part with segment.`);else if(u.some(e=>e.series===l))throw RangeError(`expressive: the mark "${o}" has two "${l}" segments.`);u.push({element:e,datum:i,series:l,value:n.value?.(i,e)})});let c={svg:i,common:a,screen:Ia(),colors:e=>D(e,i),strokeWidth:e=>to(e,i)},l=e=>({...e,label:E(e.key,e.parts)}),u=[...s.keys()];if(n.geometry)return{root:i,ancestor:a,marks:C(S(To(u.map((e,t)=>l(g(e,s.get(e),t,c))),e=>e.geometry)),o)};let d=[],f=[];u.forEach((e,t)=>{let n=s.get(e);if(n[0].element.localName===`rect`)d.push(t);else{let r=y(e,n[0],t,c);r&&f.push(r)}});let p=d.map(e=>s.get(u[e]).map(t=>_(u[e],t,c))),m=p.map(e=>Aa(e.map(e=>e.rect.box))),h=Da(m,n.baseline??`auto`),b=e=>v(u[d[e]],p[e],h[e],d[e],c);return{root:i,ancestor:a,marks:C(S(f.length===0?ka(m,h).map(e=>l(b(e))):To([...d.map((e,t)=>b(t)),...f].sort((e,t)=>e.index-t.index),e=>e.geometry).map(e=>l(e))),o)}}function g(e,t,r,i){let a=t[0],o=n.geometry(a.element,a.datum,e);if(typeof o!=`object`||!o||o.key!==e)throw TypeError(`expressive: geometry for "${e}" must be a MarkGeometry with the key "${e}". Build it with describe and the key passed in.`);return{key:e,geometry:o,parts:t.map(e=>x(e,Do(o,e.series,t.length),i)),index:r}}function _(e,t,n){let r=b(t.element,n);if(!za(r))throw TypeError(`expressive: the <rect> of "${e}" is rotated or skewed, so it isn't an upright bar. Describe it with the geometry option.`);return{...t,rect:{box:Ha(r,Ua(t.element)),series:t.series,radius:Oo(t.element)}}}function v(e,t,n,r,i){let{geometry:a,order:o}=Oa(e,t.map(e=>e.rect),n),s=a.segments??[];return{key:e,geometry:a,parts:o.map((e,n)=>{let r=s[n];return x(t[e],r&&r.length>=.5?{d:r.outline.d}:void 0,i)}),index:r,rect:{edge:n,box:Aa(t.map(e=>e.rect.box))}}}function y(e,t,n,r){let{element:i,series:a}=t,o=i.localName,s=b(i,r),c=Wa(i),l=e=>{let t=Number.parseFloat(c(e)??``);return Number.isFinite(t)?t:0},u=o===`circle`?l(`r`):0,d,f;if(o===`circle`&&(Ba(s)||!(u>0))){let t=J.apply(s,{x:l(`cx`),y:l(`cy`)});d=ye({key:e,series:a,x:ko(t.x),y:ko(t.y),r:ko(Math.max(0,u)*Va(s))})}else{let t=Ae(o,c);if(t[0]?.op!==`M`||t.every(e=>e.op===`M`))return;f=o===`circle`?void 0:r.strokeWidth(i);let n=ko((f??1)*Va(s));d=Ie({key:e,series:a,d:o===`path`?c(`d`)??``:Fe(t),matrix:s,width:n>0?n:1})}let p=[{...x(t,Do(d,a,1),r),strokeWidth:f}];return{key:e,geometry:d,parts:p,index:n,...o===`circle`?{circle:!0}:{}}}function b(e,t){return J.multiply(La(t.common,e.parentElement??t.svg,t.svg,t.screen),Ra(e))}function x(e,t,n){let r=La(n.common,e.element.parentElement??n.svg,n.svg,n.screen);return{element:e.element,datum:e.datum,series:e.series,value:e.value,parent:r,parentInverse:Ao(r),colors:n.colors(e.element),outline:t}}function S(e){return e.map(e=>{let{key:t,geometry:r,parts:i}=e,a=e.rect?xo(i):void 0,o=i[0].value,s=e.circle&&typeof o==`number`&&Number.isFinite(o)?o:void 0,c=(e,i,o)=>n.samples?Co(n.samples(e,i),o===void 0?`"${t}"`:`"${t}" (${o})`):a===void 0?s===void 0?[]:[{t:0,value:s}]:So(r,i,a),l=/* @__PURE__ */ new Map,u=e=>l.get(e)??je(e,t);for(let t of bo(e)){let e=(i.find(e=>e.series===t)??i[0]).datum;l.set(t,{datum:e,samples:c(e,r.segments?.find(e=>e.series===t)??r,t),related:u})}return{...e,data:{datum:i[0].datum,samples:c(i[0].datum,r),related:u}}})}function C(e,t){if(e.length===0)return e;let n=new Set(e.flatMap(e=>[...e.geometry.series===void 0?[]:[e.geometry.series],...bo(e)]));for(let e of it){let r=t[e];if(r?.kind===`data`)for(let t of r.needs?.related??[]){if(n.has(t))continue;let r=n.size>0?`the marks' series are ${[...n].map(e=>`"${e}"`).join(`, `)}`:`the marks have no series`;throw RangeError(`expressive: on.${e} needs the series "${t}", but ${r}. Name each mark's series in its geometry (describe.line({ key, series, … })), or a stack's parts with segment.`)}}return e}function w(e,t,r){if(n.datum)return n.datum(e);if(r)return r[t];let i=e.__data__;return typeof i==`number`&&!p&&(p=!0,console.warn(`expressive: element.__data__ is a number, which looks like Observable Plot's row index. Pass datum: (el) => rows[el.__data__].`)),i}function T(e,t,r){if(!n.segment)return;let i=n.segment(e,t);if(i==null||i===``)throw TypeError(`expressive: segment returned ${String(i)} for a part of "${r}".`);return String(i)}function E(e,r){if(n.markLabel)try{let t=String(n.markLabel(r[0].datum,{key:e,parts:r.map(({series:e,datum:t})=>({series:e,datum:t}))})??``);return t.trim()===``?void 0:t}catch(e){t(e);return}}function D(e,t){if((u.styled(e,`fill`)||u.styled(e,`stroke`))&&d.has(e))return d.get(e);let n=Ya(e,t);return d.set(e,n),n}let O=h(f),k=O.root?.ownerDocument??(typeof document>`u`?void 0:document);if(!k)throw TypeError(`expressive needs a DOM.`);un(k);let A,j,M=/* @__PURE__ */ new Map,N=[],P=/* @__PURE__ */ new Map,F=/* @__PURE__ */ new Map,I=/* @__PURE__ */ new Set,ee={enter:/* @__PURE__ */ new Set,update:/* @__PURE__ */ new Set,exit:/* @__PURE__ */ new Set,hover:/* @__PURE__ */ new Set,leave:/* @__PURE__ */ new Set},L,R,z,B,V=!1,te=(e,t,n)=>{let r=k.createElementNS(`http://www.w3.org/2000/svg`,e);return X(r,t),n?.appendChild(r),r},H=te(`g`,{class:`ec-overlay`,"aria-hidden":`true`});yt(H,{"pointer-events":`none`});let ne=te(`g`,{class:`ec-halos`},H),re=te(`g`,{class:`ec-runs`},H),ie=Dn(H),ae=e=>M.get(e)??P.get(e),oe=In({overlay:re,mark:e=>({set:t=>ae(e)?.handle.set(t),reset:()=>ae(e)?.handle.reset()}),colors:e=>ae(e)?.mark.parts[0]?.colors}),U=pt({effects:o,motion:i,icons:r.icons,clock:c,surface:oe}),W=e=>({mark:e.mark.geometry,data:e.mark.data});function se(e){let t={key:e.key,mark:e,handle:Ja(()=>t.mark.parts.filter(e=>(F.get(e.element)?.record??t)===t),u,()=>ne)};return t}function ce(e){e.root&&e.root!==A&&K(e.root),j=e.ancestor??j;let t=new Set(e.marks.map(e=>e.key)),r={entering:[],exiting:[],changed:[],moved:[],newRow:!1},i=[];for(let e of N)t.has(e.key)||(M.delete(e.key),P.set(e.key,e),r.exiting.push(e));let a=F;F=/* @__PURE__ */ new Map,N=e.marks.map(e=>{let t=M.get(e.key);if(t){let a=t.mark,o=n.value?Mo(a.parts,e.parts):No(a.geometry,e.geometry),s=a.data.datum!==e.data.datum;s&&(r.newRow=!0),o?r.changed.push({record:t,from:a.geometry}):(s||Fo(a.geometry,e.geometry)||Po(a.data.samples,e.data.samples))&&r.moved.push(t),a.parts[0]?.colors?.color!==e.parts[0]?.colors?.color&&i.push(e.key),t.mark=e}else t=P.get(e.key),t?(P.delete(e.key),t.mark=e):t=se(e),M.set(e.key,t),r.entering.push(t);for(let n of e.parts)F.set(n.element,{record:t,part:n});return t});for(let[e,t]of a)F.get(e)?.record!==t.record&&u.restore(e);for(let e of N)le(e);G(),ue(),_e();for(let e of N)e.handle.repaint();for(let e of i)oe.recolor(e);return q(),r}function le(e){if(!n.markLabel)return;let{label:t,parts:r}=e.mark;r.forEach((e,n)=>{let r=t!==void 0&&n===0;u.attribute(e.element,`role`,r?`img`:null),u.attribute(e.element,`aria-label`,r?t:null),r?u.remove(e.element,`aria-hidden`):u.attribute(e.element,`aria-hidden`,t===void 0?null:`true`)})}function G(){let e=A,t=/* @__PURE__ */ new Set;for(let r of n.markLabel&&e?N:[])if(r.mark.label!==void 0)for(let n of r.mark.parts)for(let r=n.element.parentElement;r&&r!==e&&e?.contains(r);r=r.parentElement){if(t.has(r)||r.hasAttribute(`aria-label`)||r.hasAttribute(`aria-labelledby`))continue;let e=r.getAttribute(`role`)?.trim().split(/\s+/)[0];(e!==void 0&&_o.has(e)||e===void 0&&I.has(r))&&t.add(r)}for(let e of I)t.has(e)||(u.attribute(e,`role`,null),u.attribute(e,`aria-roledescription`,null));for(let e of t)u.remove(e,`role`),u.remove(e,`aria-roledescription`);I=t}function ue(){if(!A||!j)return;A.lastElementChild!==H&&A.appendChild(H),H.removeAttribute(`transform`);let e=La(H,j,A);jo(e)||H.setAttribute(`transform`,xt(e))}function K(e){de(),A=e,A.appendChild(H),(n.keyboard===!0||n.markLabel)&&A.getAttribute(`role`)===`img`&&!m&&(m=!0,console.warn(`expressive: the <svg> is role="img", so screen readers read it as one picture and skip the marks inside, with their names and keyboard focus. Make it role="group"; its aria-label can stay.`)),z=Kn(A,{find(e){let t=fe(e);if(!t)return;let{key:n}=t.record;return t.part.series===void 0?{key:n}:{key:n,segment:t.part.series}},hover(e,t){let n=M.get(e.key);!n||gn(L)&&L.keys[0]===e.key||(me(),pe([n],t,e.segment))},leave(){(L?.source===`pointer`||L?.source===`touch`)&&me()}})}function de(){A&&(me(),z?.destroy(),z=void 0)}function fe(e){for(let t=e;t&&t!==A;t=t.parentElement){let e=F.get(t);if(e)return e}}function pe(e,t,n,r=!0){let i={keys:e.map(e=>e.key),source:t,effects:r};L=i,_e(),r&&U.hover(e.map(W)),e.forEach((r,i)=>Me(`hover`,{...W(r),batch:{index:i,count:e.length},source:t,...n===void 0?{}:{segment:n}})),t!==`linked`&&L===i&&B?.hover(e.map(W))}function me(){let e=L;e&&(L=void 0,_e(),he(e.keys),gn(e)&&B?.leave())}function he(e){let t=e.flatMap(e=>ae(e)??[]);U.leave(e),t.forEach((e,n)=>Me(`leave`,{...W(e),batch:{index:n,count:t.length}}))}function ge(){if(L===void 0)return;let e=L.keys.filter(e=>M.has(e));if(e.length===L.keys.length)return;if(e.length===0){z?.clear(),me();return}let t=L.keys.filter(e=>!M.has(e));L={...L,keys:e},he(t)}function _e(){if(!l)return;let e=`${i.duration(100,`feedback`)}ms`;H.classList.toggle(`ec-hovering`,L!==void 0),yt(H,{"--ec-hover-duration":e});for(let t of N){let n=L?.keys.includes(t.key)===!0;for(let r of t.mark.parts)u.toggleClass(r.element,`ec-attached`,!0),u.toggleClass(r.element,`ec-dimmed`,L!==void 0&&!n),u.style(r.element,`--ec-hover-duration`,e);t.handle.hot(n),oe.hot(t.key,n)}for(let e of P.values())e.handle.hot(!1),oe.hot(e.key,!1)}let ve=l?i.subscribe(_e):void 0,be=e=>new Set(it.flatMap(t=>{let n=e[t];return n?.kind===`data`?n.needs?.related??[]:[]})),xe=be(o);function q(){let e=R===void 0?void 0:M.get(R);ie.draw(e?.mark.geometry)}let Se=n.keyboard===!0?qn(()=>A,{find:e=>fe(e)?.record.key,order:()=>N.map(e=>e.key),element:e=>M.get(e)?.mark.parts[0]?.element,tabIndex(e,t){let n=M.get(e);n&&t!==void 0&&n.mark.parts.forEach((e,n)=>{u.attribute(e.element,`tabindex`,n===0?t:`-1`),u.style(e.element,`outline`,`none`)})},focus(e,t){R=t?e:void 0,q();let n=M.get(e);n&&(t?gn(L)&&L.keys[0]===e?L={...L,source:`keyboard`}:(me(),pe([n],`keyboard`)):L?.source===`keyboard`&&L.keys[0]!==e&&me())},blur(){R=void 0,q(),L?.source===`keyboard`&&(z?.current===L.keys[0]?L={...L,source:`pointer`}:me())},escape(){return L?(L.source===`linked`&&B?B.dismiss():me(),!0):!1}}):void 0,Ce=n.watch===!0?ho(k,c,Te):void 0;function we(){Ce?.observe(N.flatMap(e=>e.mark.parts.map(e=>e.element)),A)}function Te(e){if(V||!j)return;let t=/* @__PURE__ */ new Set;for(let n of e.marks){let e=F.get(n)?.record;e&&t.add(e)}let n=!1;for(let r of e.ancestors)if(r.contains(j))n=!0;else for(let e of N)e.mark.parts.some(e=>r.contains(e.element))&&t.add(e);if(n&&ue(),t.size===0)return;let{records:r,marks:i}=Ee([...t]);r.forEach((e,t)=>{let n=i[t];e.mark=n;for(let t of n.parts)F.set(t.element,{record:e,part:t});e.handle.repaint()}),N=ke(N),r.some(e=>e.key===R)&&q();let a=new Set(r);if(r.some(e=>xe.has(e.mark.geometry.series??``)))for(let e of N)a.add(e);for(let e of a)U.change(e.mark.geometry,e.mark.data)}function Ee(e){let t={svg:A,common:j,screen:Ia(),colors:e=>F.get(e)?.part.colors,strokeWidth:e=>F.get(e)?.part.strokeWidth},r=Oe(),i=({parts:e})=>e.map(e=>({element:e.element,datum:r(e.element),series:e.series,value:e.value}));if(n.geometry){let n=e.map(({mark:e})=>({...g(e.key,i(e),e.index,t),label:e.label}));return{records:[...e],marks:S(n)}}let a=new Map(e.flatMap(e=>e.mark.rect?[[e,i(e.mark).map(n=>_(e.key,n,t))]]:[])),o=De(a);for(let e of N)e.mark.rect&&!a.has(e)&&o.get(e)!==e.mark.rect.edge&&a.set(e,i(e.mark).map(n=>_(e.key,n,t)));let s=[...a.keys()],c=s.map(e=>({...v(e.key,a.get(e),o.get(e),e.mark.index,t),label:e.mark.label}));for(let n of e){if(n.mark.rect)continue;let e=y(n.key,i(n.mark)[0],n.mark.index,t);e&&(s.push(n),c.push({...e,label:n.mark.label}))}return{records:s,marks:S(c)}}function De(e){let t=N.filter(e=>e.mark.rect),r=new Map(t.map(e=>[e,e.mark.rect.edge]));if(n.baseline!==void 0&&n.baseline!==`auto`)return r;let i=t.map(t=>{let n=e.get(t);return n?Aa(n.map(e=>e.rect.box)):t.mark.rect.box});try{let e=Da(i,`auto`);return new Map(t.map((t,n)=>[t,e[n]]))}catch{return r}}function Oe(){if(n.datum)return n.datum;let e=so(f);return t=>e?.has(t)?e.get(t):w(t,0,void 0)}function ke(e){let t=[...e].sort((e,t)=>e.mark.index-t.mark.index);return n.geometry||!t.every(e=>e.mark.rect)?[...To(t,e=>e.mark.geometry)]:ka(t.map(e=>e.mark.rect.box),t.map(e=>e.mark.rect.edge)).map(e=>t[e])}function je(e,t){return N.find(n=>n.key!==t&&n.mark.geometry.series===e)?.mark.data}function Me(e,n){for(let r of[...ee[e]])try{r(n)}catch(e){t(e)}}function Ne(e,t){t.forEach((n,r)=>Me(e,{...W(n),batch:{index:r,count:t.length}}))}U.enter(ce(O).entering.map(W)),Se?.sync(),we();let Pe={targets:()=>N.map(e=>({key:e.key,marks:[W(e)]})),hover(e,t){me();let n=e.flatMap(e=>M.get(e)??[]);n.length>0&&pe(n,`linked`,void 0,t)},unlink(){L?.source===`linked`&&me()},leave(){z?.clear(),me()},listen(e){return!V&&(B=e,!0)}};return bn(Pe,{refresh(e){if(V)return;let t=h(e??f);e!==void 0&&(f=e),U.interrupt();let n=ce(t);we(),ge();let r=U.exit(n.exiting.map(W));Ne(`exit`,n.exiting),(n.newRow||n.changed.length>0||n.entering.length>0||n.exiting.length>0)&&U.update(n.changed.map(({record:e,from:t})=>({...W(e),from:t}))),n.changed.forEach(({record:e,from:t},r)=>Me(`update`,{...W(e),from:t,batch:{index:r,count:n.changed.length}})),U.enter(n.entering.map(W)),Ne(`enter`,n.entering);let i=/* @__PURE__ */ new Set([...n.changed.map(e=>e.record),...n.moved]);if([...i,...n.entering,...n.exiting].some(e=>xe.has(e.mark.geometry.series??``))){let e=new Set(n.entering);for(let t of N)e.has(t)||i.add(t)}for(let e of i)U.change(e.mark.geometry,e.mark.data);U.settle(),Se?.sync(),r.then(()=>{for(let e of n.exiting)P.get(e.key)===e&&P.delete(e.key)})},async update(e){if(V)return;if(typeof e!=`object`||!e)throw TypeError(`expressive: update() needs options, such as { on: { hover: "lift" } }.`);let t=Object.keys(e).find(e=>e!==`on`);if(t!==void 0)throw TypeError(`expressive: \`${t}\` can't be changed by update() yet. Only \`on\` can.`);if(!(`on`in e))return;let n=cr(o,s,e.on,r.presets);C(N.map(e=>e.mark),n),s=e.on,o=n,xe=be(n),U.swap(n,N.map(W))},on(e,t){let n=ee[e];if(!n)throw TypeError(`expressive: unknown event "${String(e)}". Use one of: ${Object.keys(ee).join(`, `)}.`);return n.add(t),()=>{n.delete(t)}},marks:()=>N.map(e=>e.mark.geometry),focus(e){M.has(e)&&!V&&Se?.focus(e)},leave(){V||Pe.leave()},destroy(){if(!V){V=!0,L=void 0,B?.gone(),B=void 0,Ce?.destroy(),U.destroy(),ve?.(),Se?.destroy(),de(),H.remove(),u.restoreAll();for(let e of Object.values(ee))e.clear();M.clear(),P.clear(),N=[],F=/* @__PURE__ */ new Map}}})}function yo(e){if(typeof e!=`object`||!e)throw TypeError(`expressive needs options, with at least a key: { key: (d) => d.name }.`);if(typeof e.key!=`function`)throw TypeError(`expressive needs a key function, for example key: (d) => d.name. Marks are matched by key.`);for(let t of[`datum`,`segment`,`value`,`geometry`,`markLabel`])if(e[t]!==void 0&&typeof e[t]!=`function`)throw TypeError(`expressive: ${t} must be a function.`);if(e.baseline!==void 0&&e.baseline!==`auto`&&!Ea(e.baseline))throw RangeError(`expressive: baseline must be "left", "right", "top", "bottom" or "auto", got ${String(e.baseline)}.`)}function bo(e){let t=[...(e.geometry.segments??[]).map(e=>e.series),...e.parts.map(e=>e.series)];return[...new Set(t.filter(e=>e!==void 0))]}function xo(e){let t=0;for(let{value:n}of e){if(typeof n!=`number`||!Number.isFinite(n))return;t+=n}return t}function So(e,t,n){let r=t=>e.length>0?n*t/e.length:0;if(t===e)return[{t:0,value:0},{t:1,value:n}];let i=Eo(e.start,t.start);return[{t:0,value:r(i)},{t:1,value:r(i+t.length)}]}function Co(e,t){if(!Array.isArray(e))throw TypeError(`expressive: samples for ${t} must return an array of { t, value }, got ${wo(e)}.`);let n=0;return e.map((e,r)=>{let{t:i,value:a,at:o,gapBefore:s}=typeof e==`object`&&e?e:{};if(typeof i!=`number`||!(i>=0&&i<=1))throw RangeError(`expressive: samples for ${t}: samples[${r}].t must be in [0, 1], got ${wo(i)}.`);if(i<n)throw RangeError(`expressive: samples for ${t} must be in t order: samples[${r}].t is ${i}, after ${n}.`);if(typeof a!=`number`||!Number.isFinite(a))throw RangeError(`expressive: samples for ${t}: samples[${r}].value must be a finite number, got ${wo(a)}.`);if(s!==void 0&&typeof s!=`boolean`)throw RangeError(`expressive: samples for ${t}: samples[${r}].gapBefore must be true or false, got ${wo(s)}.`);return n=i,{t:i,value:a,...o===void 0?{}:{at:o},...s?{gapBefore:s}:{}}})}function wo(e){return typeof e==`string`?JSON.stringify(e):String(e)}function To(e,t){let n=e[0]&&t(e[0]).pivot;if(!n||!e.every(e=>Eo(t(e).pivot,n)<=.5&&Sa(t(e))))return e;let r=2*Math.PI,i=e=>{let{center:i}=t(e),a=Math.atan2(i.x-n.x,n.y-i.y),o=a<0?a+r:a;return o>=r?0:o};return e.map(e=>({mark:e,angle:i(e)})).sort((e,t)=>e.angle-t.angle).map(({mark:e})=>e)}function Eo(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function Do(e,t,n){let r=t===void 0?void 0:e.segments?.find(e=>e.series===t),i=r??(n===1?e:void 0);if(!(!i||r&&r.length<.5))return i.outline.closed?{d:i.outline.d}:{d:i.outline.d,stroke:i.thickness}}function Oo(e){let t=Number.parseFloat(e.getAttribute(`rx`)??``),n=Number.parseFloat(e.getAttribute(`ry`)??``),r=Number.isFinite(t)?t:n;return Number.isFinite(r)&&r>0?r:0}function ko(e){return Math.round(e*1e3)/1e3}function Ao(e){try{return Ye(e)}catch{return}}function jo(e){return Math.abs(e[0]-1)<1e-9&&Math.abs(e[1])<1e-9&&Math.abs(e[2])<1e-9&&Math.abs(e[3]-1)<1e-9&&Math.abs(e[4])<1e-6&&Math.abs(e[5])<1e-6}function Mo(e,t){if(e.length!==t.length)return!0;let n=new Map(e.map(e=>[e.series,e.value]));return t.some(e=>{let t=n.get(e.series);return!n.has(e.series)||!(t===e.value||Object.is(t,e.value))})}function No(e,t){let n=e.segments??[],r=t.segments??[];return Math.abs(e.length-t.length)>.01||n.length!==r.length||n.some((e,t)=>e.key!==r[t].key||Math.abs(e.length-r[t].length)>.01)}function Po(e,t){let n=(e,t)=>e===t||e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime();return e.length!==t.length||e.some((e,r)=>e.t!==t[r].t||e.value!==t[r].value||!n(e.at,t[r].at))}function Fo(e,t){if(e.outline.d!==t.outline.d||e.thickness!==t.thickness||mr(e,t))return!0;let n=e.segments??[],r=t.segments??[];return n.length!==r.length||n.some((e,t)=>e.key!==r[t].key||e.outline.d!==r[t].outline.d)}let Io=[`line`,`rect`,`arc`,`symbol`],Lo=[`d`,`transform`,`x`,`y`,`width`,`height`,`stroke-width`];function Ro(e,n,r){if(zo(e),typeof n!=`object`||!n||typeof n.key!=`function`)throw TypeError(`fromVegaView needs options with a key: { key: (d) => d.series }. Marks are matched by key.`);let i=n.mark??`marks`;if(typeof i!=`string`||i===``)throw TypeError(`fromVegaView: mark must be a mark's name, got ${String(i)}.`);if(n.sample!==void 0&&typeof n.sample!=`function`)throw TypeError(`fromVegaView: sample must be a function.`);let o=_(),{mark:s,sample:c,...l}=n,u=vo(o.elements,{...l,datum:e=>g(e).datum,geometry:(e,t,n)=>{let r=o.geometry.get(n);if(!r)throw TypeError(`fromVegaView: no geometry for "${n}". Its key must be the same for every item of a mark.`);return r},...n.samples||!n.sample?{}:{samples:(e,t)=>o.samples.get(t)??[]},...n.value||!n.sample?{}:{value:(e,t)=>o.values.get(t)}},r),d=r.clock??a,f,p,m=!1,h=typeof MutationObserver==`function`?new MutationObserver(e=>e.some(S)&&C()):void 0;w(o.root);function g(e){let t=o.items.get(e);if(!t)throw TypeError(`fromVegaView: an element that isn't one of the View's items.`);return t}function _(){let t=Vo(Bo(e),i),r=Ho(t,i,e),a=e.container(),o=a?.localName===`svg`?a:a?.querySelector(`svg`),s={root:o??void 0,elements:[],items:/* @__PURE__ */ new Map,geometry:/* @__PURE__ */ new Map,samples:/* @__PURE__ */ new Map,values:/* @__PURE__ */ new Map};if(!r||!o)return s;let c=new Set(r===`line`?t.flatMap(e=>e.items?.[0]&&Go(e.items[0])?[e.items[0]]:[]):t.flatMap(e=>e.items??[])),l=/* @__PURE__ */ new Map;for(let e of Array.from(o.querySelectorAll(`*`))){let t=e.__data__;c.has(t)&&l.set(e,t)}let u=[...l.keys()];if(u.length===0)return s;let d=co(u),f=lo(u,d),p=Ia(),m=e=>La(f,e.parentElement??d,d,p),h=e=>String(n.key(l.get(e).datum,e)),g=e=>n.segment?String(n.segment(l.get(e).datum,e)):void 0,_={root:d,items:l,elements:u,geometry:/* @__PURE__ */ new Map,samples:/* @__PURE__ */ new Map,values:/* @__PURE__ */ new Map};if(n.sample)for(let[e,t]of l){let n=r===`line`?Wo(t):[t];_.values.set(e,n.map(e=>e.defined===!1?``:y(e).value).join(`,`))}if(r===`rect`)return v(_,m,h,g);for(let e of u){let t=l.get(e),i=h(e);if(_.geometry.has(i))continue;let a=m(e),o=r===`line`?qo(i,e,t,a):r===`arc`?Jo(i,t,a):Yo(i,t,a);_.geometry.set(i,o),n.sample&&_.samples.set(o,r===`line`?b(o,t,a):x(o,t,r))}return _}function v(e,t,r,i){let a=/* @__PURE__ */ new Map;for(let n of e.elements){let o=e.items.get(n),s=r(n),c={box:Ha(t(n),Xo(o)),series:i(n),radius:Math.max(0,o.cornerRadius??0)},l=a.get(s);l?l.push({element:n,part:c}):a.set(s,[{element:n,part:c}])}let o=[...a.keys()],s=o.map(e=>Aa(a.get(e).map(e=>e.part.box))),c=Da(s,n.baseline??`auto`),l=[];for(let t of ka(s,c)){let r=o[t],i=a.get(r),{geometry:s,order:u}=Oa(r,i.map(e=>e.part),c[t]);if(e.geometry.set(r,s),l.push(...u.map(e=>i[e].element)),n.sample){let t=u.map(t=>y(e.items.get(i[t].element)).value),n=t.reduce((e,t)=>e+t,0);e.samples.set(s,[{t:0,value:0},{t:1,value:n}]);let r=0;(s.segments??[]).forEach((n,i)=>{let a=r;r+=t[i]??0,e.samples.set(n,[{t:0,value:a},{t:1,value:r}])})}}return{...e,elements:l}}function y(e){let t=n.sample(e.datum),r=typeof t==`number`?{value:t}:t;if(typeof r!=`object`||!r||!Number.isFinite(r.value))throw RangeError(`fromVegaView: sample must give a finite number, or { value, at }, got ${JSON.stringify(t)}.`);return r.at===void 0?{value:r.value}:{value:r.value,at:r.at}}function b(e,t,n){return $e(e,Ko(t).map(({item:e,point:t})=>({...J.apply(n,t),...y(e)})))}function x(e,t,n){let{value:r,at:i}=y(t),a=i===void 0?{t:1,value:r}:{t:1,value:r,at:i};return n===`symbol`?[{...a,t:0}]:e.length>0?[{t:0,value:0},a]:[{...a,t:0}]}function S(e){let t=f?.querySelector(`:scope > .ec-overlay`),n=e=>e===t||(t?.contains(e)??!1);return n(e.target)?!1:e.type!==`childList`||[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].some(e=>!n(e))}function C(){if(p||m)return;let e=d.onFrame(()=>{e(),p=void 0;try{T()}catch(e){t(e)}});p=e}function w(e){h&&e!==f&&(h.disconnect(),f=e,e&&h.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:Lo}))}function T(){if(m)return;let e=_(),t=o;o=e;try{u.refresh(e.elements)}catch(e){throw o=t,e}w(e.root)}return bn(xn(u),{refresh:T,update:u.update,on:u.on,marks:u.marks,focus:u.focus,leave:u.leave,destroy(){m||(m=!0,h?.disconnect(),p?.(),p=void 0,u.destroy())}})}function zo(e){if(typeof e!=`object`||!e||typeof e.renderer!=`function`||typeof e.scenegraph!=`function`||typeof e.container!=`function`)throw TypeError(`fromVegaView needs a Vega View: new vega.View(runtime, { renderer: "svg", container }), or vega-embed's result.view.`);let t=e.renderer();if(t!==`svg`)throw TypeError(`fromVegaView: the View renders with "${t}", which draws no SVG elements to attach to. Use renderer: "svg" (vega-embed's default; a bare vega.View uses canvas).`)}function Bo(e){let t=e.scenegraph();return t.root??t}function Vo(e,t){let n=[],r=e=>{if(e.name===t&&e.marktype!==`group`&&n.push(e),e.marktype===`group`)for(let t of e.items??[])for(let e of t.items??[])r(e)};return r(e),n}function Ho(e,t,n){if(e.length===0){let e=Uo(Bo(n));if(e.length===0)return;throw RangeError(`fromVegaView: the View has no mark named "${t}". Its named marks: ${e.map(e=>`"${e}"`).join(`, `)}.`)}let r=e[0].marktype;if(!e.every(e=>e.marktype===r)||!Io.includes(r))throw TypeError(`fromVegaView: "${t}" is a ${String(r)} mark. Rects, arcs, symbols and lines can be read; describe others with expressive()'s geometry option.`);return r}function Uo(e){let t=/* @__PURE__ */ new Set,n=e=>{e.name&&e.marktype!==`group`&&t.add(e.name);for(let t of e.items??[])for(let e of t.items??[])n(e)};return n(e),[...t]}let Wo=e=>e.mark?.items??[e],Go=e=>Wo(e).some(e=>e.defined!==!1);function Ko(e){let t=Wo(e),n=t[0]?.interpolate;if(n!==void 0&&n!==`linear`)throw TypeError(`fromVegaView: a line is drawn with interpolate "${n}", but only straight lines can be read. Use interpolate "linear" (the default), or describe the curve with expressive()'s geometry option.`);let r=[],i=!1;for(let e of t)e.defined===!1?i=r.length>0:(r.push({item:e,point:{x:Qo(e.x),y:Qo(e.y)},gapBefore:i}),i=!1);return r}function qo(e,t,n,r){let i=n.strokeWidth??Number.parseFloat(t.getAttribute(`stroke-width`)??`1`),a=Ko(n),o=a.flatMap((e,t)=>e.gapBefore?[t]:[]);return he({key:e,series:e,points:a.map(({point:e})=>J.apply(r,e)),...o.length>0?{breaks:o}:{},width:(Number.isFinite(i)?i:1)*Zo(r)})}function Jo(e,t,n){let r=J.apply(n,{x:Qo(t.x),y:Qo(t.y)}),i=Zo(n),[a,o]=[Qo(t.startAngle),Qo(t.endAngle)].sort((e,t)=>e-t);return de({key:e,cx:r.x,cy:r.y,inner:Qo(t.innerRadius)*i,outer:Qo(t.outerRadius)*i,start:a,end:o})}function Yo(e,t,n){let r=J.apply(n,{x:Qo(t.x),y:Qo(t.y)});return ye({key:e,x:r.x,y:r.y,r:Math.sqrt(Math.max(0,t.size??64)/Math.PI)*Zo(n)})}function Xo(e){let t=Qo(e.x),n=Qo(e.y),r=Qo(e.width),i=Qo(e.height);return{x:Math.min(t,t+r),y:Math.min(n,n+i),width:Math.abs(r),height:Math.abs(i)}}function Zo(e){return Math.sqrt(Math.abs(e[0]*e[3]-e[1]*e[2]))}function Qo(e){return typeof e==`number`&&Number.isFinite(e)?e:0}let $o={get:()=>void 0},es={set(){},reset(){}},ts={place(){},update(){},remove(){}};function ns(e,n){let{effect:r,surface:i}=n;if(!rs(r))throw TypeError(`playTransition needs a transition effect (kind "transition" with run, end and clear), got ${is(r)}.`);let o=n.start??0;if(!(typeof o==`number`&&o>=0&&o<=1))throw RangeError(`playTransition: start must be a number from 0 to 1, got ${String(o)}.`);let s=n.motion??v,c=n.clock??a,l=n.icons??$o,u=e.length,d=[],f=!1,p=u,m,h=new Promise(e=>{m=e}),g=u>0?s.subscribe(()=>{s.mode===`off`&&w()}):void 0,_=()=>{--p>0||(g?.(),g=void 0,m())};function y(e,t,n){let i=lt({clock:c,motion:s,icons:l,batch:{index:t,count:u},layer:T(e.to.key,t,()=>a.state!==`cleared`),mark:es}),a={pair:e,index:t,scope:i,context:{...i.context,start:o},state:`running`,done:n};d[t]=a;let{from:f,to:p}=e;try{s.mode===`off`?(r.end(f,p,a.context),b(a)):Promise.resolve(r.run(f,p,a.context)).then(()=>b(a),e=>x(a,e))}catch(e){x(a,e)}}function b(e){e.state===`running`&&(e.state=`ended`,S(e))}function x(e,n){let{signal:r}=e.context;(!r.aborted||n!==r.reason&&n?.name!==`AbortError`)&&(t(n),C(e))}function S(e){let t=e.done;e.done=void 0,t?.()}function C(e){if(e.state!==`cleared`){e.state=`cleared`,e.scope.abort();try{r.clear(e.context)}catch(e){t(e)}e.scope.clear(),S(e)}}function w(){for(let e of[...d]){if(e.state!==`running`)continue;let t=e.done;e.done=void 0,C(e),y(e.pair,e.index,t)}}function T(e,t,n){let r,a=()=>n()?r??(r=i.group(e,t)):void 0;return{icon:(e,t)=>a()?.icon(e,t)??ts,path:(e,t)=>a()?.path(e,t)??ts,text:(e,t)=>a()?.text(e,t)??ts,clear(){let e=r;r=void 0,e?.clear()}}}return e.forEach((e,t)=>y(e,t,_)),u===0&&m(),{finished:h,clear(){if(!f){f=!0;for(let e of[...d])C(e)}}}}function rs(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.kind===`transition`&&typeof t.run==`function`&&typeof t.end==`function`&&typeof t.clear==`function`}function is(e){if(typeof e!=`object`||!e)return e===null?`null`:typeof e;let t=e.kind;return t===`geometry`||t===`data`?`a ${t} effect, which plays on one mark: put it in a chart's \`on\` option`:t===`transition`?`a transition effect without run(), end() and clear()`:t===void 0?`an object with no kind`:`an effect of kind ${JSON.stringify(t)}`}let as=.5;function os(e,t,n){let r=ir(e,`chartSwitch`),i=xs(t),o=t.transition,s=fn(t.colors),c=n.motion,l=n.clock??a,u=r.ownerDocument;un(u);let d=u.createElement(`div`);d.className=`ec-switch`,r.appendChild(d);let f=/* @__PURE__ */ new Map;try{for(let e of i){let n=u.createElement(`div`);n.className=`ec-switch-view`,n.setAttribute(`data-view`,e),d.appendChild(n),ls(n,e===t.initial);let r=t.views[e](n,s);if(!bs(r,n))throw r?.destroy?.(),TypeError(`chartSwitch: views.${e} must return the chart it draws in the container it's given (with element, marks(), labels(), focus(), leave() and destroy()), such as donutChart(container, { ... }).`);f.set(e,{name:e,container:n,chart:r,port:xn(r)})}}catch(e){for(let e of f.values())e.chart.destroy();throw d.remove(),e}let p=Y(`svg`,{class:`ec-chart ec-switch-overlay`,"aria-hidden":`true`},d),m=Y(`g`,{class:`ec-switch-fades`},p),h=Y(`g`,{class:`ec-switch-runs`},p),g=Y(`g`,{class:`ec-switch-labels`},p),_=t.announce?vt(p):void 0,v=/* @__PURE__ */ new WeakMap,y={group(e,t){let n=Y(`g`,{class:`ec-run`,"data-key":e},h);yt(n,an(nn(s.slot(e)))),v.set(n,t);let r=Array.from(h.children).find(e=>(v.get(e)??-1/0)>t);return h.insertBefore(n,r??null),{...Mn(n),clear:()=>n.remove()}}},b=t.initial,x,S=!1,C,w,T=!1,E,D=c.subscribe(()=>{c.mode===`off`&&x&&z(x,!0)}),O,k=typeof ResizeObserver==`function`?new ResizeObserver(e=>{let t=e[e.length-1]?.contentRect.width??0;if(O!==void 0&&Math.abs(t-O)<.5)return;let n=O===void 0;O=t,!n&&x&&z(x,!0)}):void 0;k?.observe(d);let A=e=>f.get(e);function j(){return d.getRootNode().activeElement??null}function M(e){let t=j();if(!t||!e.container.contains(t))return;let n=t.closest(`[data-key]`);return{key:n&&e.chart.element.contains(n)?n.getAttribute(`data-key`)??void 0:void 0}}function N(e,t){if(!t)return;let n=j();if(n&&n!==u.body&&n!==u.documentElement&&!d.contains(n))return;let r=()=>e.chart.element.contains(j());if(t.key!==void 0&&e.chart.focus(t.key),!r()){for(let t of e.chart.marks())if(e.chart.focus(t.key),r())return}}function P(e){_?.say(e.chart.element.getAttribute(`aria-label`)??``)}function F(){T&&C?.shown()}function I(e,t,n){let r=n?n.focus:M(e),i=[];E=i;try{e.chart.leave()}finally{E=void 0}let a=S?Promise.resolve():ee(e,t,r);for(let e of i)e();return a}function ee(e,t,n){if(b=t.name,c.mode===`off`){for(let e of f.values())ls(e.container,e===t);return N(t,n),P(t),F(),Promise.resolve()}for(let n of[e,t])n.container.classList.remove(`ec-switch-inactive`),n.container.classList.add(`ec-switching`),n.container.setAttribute(`inert`,``),n.chart.element.classList.add(`ec-morphing`);let{pairs:r,scene:i}=B(e,t),{done:a,settle:o}=ys(),s={a:e,b:t,forward:!0,pairs:r,reversed:r.map(({from:e,to:t})=>({from:t,to:e})),scene:i,focus:n,progress:0,transition:void 0,driver:void 0,run:0,done:a,settle:o};return x=s,L(s,0),s.done}function L(e,t){let r=++e.run;if(t>=1){z(e,!0);return}let i=t=>{e.progress=t,e.scene.draw(e.forward?t:1-t)},a=cs(l);e.transition=ns(e.forward?e.pairs:e.reversed,{effect:o,surface:y,start:t,motion:c,clock:a.clock,icons:n.icons}),e.driver=ss(t,i,{clock:a.clock,motion:c}),a.release(),Promise.all([e.driver.finished,e.transition.finished]).then(([t])=>{x===e&&e.run===r&&t===`done`&&z(e,!0)})}function R(e){return e.driver?.cancel(),e.transition?.clear(),e.forward=!e.forward,b=(e.forward?e.b:e.a).name,e.settle(),{done:e.done,settle:e.settle}=ys(),L(e,1-e.progress),e.done}function z(e,t){if(x!==e)return;x=void 0,e.run++,e.driver?.cancel(),e.transition?.clear(),e.scene.clear();let n=e.forward?e.b:e.a;for(let t of[e.a,e.b])t.chart.element.classList.remove(`ec-morphing`),t.container.classList.remove(`ec-switching`),t.container.style.removeProperty(`opacity`);for(let e of f.values())ls(e.container,e===n);t&&(N(n,e.focus),P(n),F()),e.settle()}function B(e,t){let n=La(p,e.chart.element,d),r=La(p,t.chart.element,d),i=e.chart.marks().map(e=>vs(e,n)),a=t.chart.marks().map(e=>vs(e,r)),o=new Map(i.map(e=>[e.key,e])),s=new Set(a.map(e=>e.key)),c=a.flatMap(e=>{let t=o.get(e.key);return t?[{from:t,to:e}]:[]}),l=[];for(let e of i)s.has(e.key)||l.push(V(e,ps));for(let e of a)o.has(e.key)||l.push(V(e,ms));let u=e=>`${e.role}\n${e.key}`,f=e.chart.labels(),_=t.chart.labels(),v=new Map(f.map(e=>[u(e),e])),y=/* @__PURE__ */ new Set;for(let e of _){let t=v.get(u(e));t&&(y.add(u(e)),l.push(ds(te(t,n),te(e,r))))}for(let e of f)y.has(u(e))||l.push(fs(te(e,n),ps));for(let e of _)v.has(u(e))||l.push(fs(te(e,r),ms));return l.push(n=>{us(e.container,1-hs(n/.4)),us(t.container,hs((n-as)/.5))}),{pairs:c,scene:{draw:e=>{for(let t of l)t(e)},clear:()=>{m.replaceChildren(),h.replaceChildren(),g.replaceChildren()}}}}function V(e,t){let n=Y(`g`,{class:`ec-switch-fade`,"data-key":e.key},m);return yt(n,an(nn(s.slot(e.key)))),Mn(n).path(e.outline.d,e.outline.closed?{fill:`mark`}:{stroke:`mark`,width:e.thickness}),e=>X(n,{opacity:t(e)})}function te(e,t){let n=e.element.cloneNode(!0);for(let e of[`id`,`opacity`,`visibility`,`aria-hidden`])n.removeAttribute(e);n.textContent=e.text;let r=J.apply(t,e);return X(n,{x:r.x,y:r.y,"text-anchor":e.anchor}),g.appendChild(n),{text:n,at:r}}let H={get current(){return b},show(e){if(!f.has(e))return Promise.reject(/* @__PURE__ */ TypeError(`chartSwitch: there's no view ${JSON.stringify(e)}. The views are ${i.map(e=>JSON.stringify(e)).join(`, `)}.`));if(S)return Promise.resolve();let t=E;if(t)return new Promise(n=>t.push(()=>n(H.show(e))));let n=x;if(!n)return e===b?Promise.resolve():I(A(b),A(e));let r=n.forward?n.b:n.a,a=n.forward?n.a:n.b;return e===r.name?n.done:e===a.name?R(n):(z(n,!1),I(r,A(e),{focus:n.focus}))},chart(e){let t=f.get(e);if(!t)throw TypeError(`chartSwitch: there's no view ${JSON.stringify(e)}. The views are ${i.map(e=>JSON.stringify(e)).join(`, `)}.`);return t.chart},on(e,t){let n=Array.from(f.values(),n=>{let r=n.chart.on;if(typeof r==`function`)return r.call(n.chart,e,e=>{n.name===b&&t(e)})});return()=>{for(let e of n)e?.()}},marks:()=>A(b).chart.marks(),leave(){T=!1,S||A(b).chart.leave()},destroy(){if(S)return;S=!0;let e=x;e&&(x=void 0,e.run++,e.driver?.cancel(),e.transition?.clear(),e.scene.clear(),e.settle()),D(),k?.disconnect(),_?.destroy();let t=C;C=void 0,t?.gone();for(let e of f.values())e.chart.destroy();d.remove()}},ne=e=>x===void 0&&e.name===b;function re(e){let t=()=>{w===e&&(w=void 0,C?.leave())};return{hover(t){ne(e)&&(w=e,C?.hover(t))},leave:t,dismiss(){ne(e)&&C?.dismiss()},shown(){},gone:t}}return bn({targets:()=>x===void 0?A(b).port?.targets()??[]:[],hover(e,t){T=!0,x===void 0&&A(b).port?.hover(e,t)},unlink(){T=!1;for(let e of f.values())e.port?.unlink()},leave:()=>H.leave(),listen(e){if(S)return!1;C=e,w=void 0,T=!1;for(let t of f.values())t.port?.listen(e&&re(t));return!0},parts:Array.from(f.values()).flatMap(e=>e.port?[e.port]:[])},H)}function ss(e,t,n){let r=l(e),i;return i=y({duration:950,timing:`transition`,ease:o,update:n=>{let a=Math.min(1,r+n);t(n===0?e:s(a)),a>=1&&n<1&&i?.finish()}},n),i}function cs(e){let t=e.now();return{clock:{now:()=>t??e.now(),onFrame:t=>e.onFrame(t)},release(){t=void 0}}}function ls(e,t){e.classList.toggle(`ec-switch-inactive`,!t),e.toggleAttribute(`inert`,!t),t?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,`true`)}function us(e,t){e.style.setProperty(`opacity`,String(Math.round(t*1e3)/1e3))}function ds(e,t){return n=>{let r=gs(e.at.x,t.at.x,n),i=gs(e.at.y,t.at.y,n),a=n>=as;X(e.text,{x:r,y:i,visibility:a?`hidden`:void 0}),X(t.text,{x:r,y:i,visibility:a?void 0:`hidden`})}}function fs(e,t){return n=>X(e.text,{opacity:t(n)})}let ps=e=>1-hs(e/as),ms=e=>hs((e-as)/.5),hs=e=>Math.min(1,Math.max(0,e)),gs=(e,t,n)=>e*(1-n)+t*n,_s=e=>e[0]===1&&e[1]===0&&e[2]===0&&e[3]===1&&e[4]===0&&e[5]===0;function vs(e,t){if(_s(t))return e;let n=e=>J.apply(t,e),r=e=>Fe(Ne(De(e),t)),i=Math.sqrt(Math.abs(t[0]*t[3]-t[1]*t[2])),{outline:a}=e;return{key:e.key,...e.series===void 0?{}:{series:e.series},start:n(e.start),end:n(e.end),length:e.length*i,path:t=>n(e.path(t)),angle:n=>{let r=e.angle(n),i=Math.cos(r),a=Math.sin(r);return Math.atan2(t[1]*i+t[3]*a,t[0]*i+t[2]*a)},slice:(t,n)=>r(e.slice(t,n)),thickness:e.thickness*i,outline:{d:r(a.d),closed:a.closed,sample:e=>a.sample(e).map(n)},bounds:Ha(t,e.bounds),center:n(e.center),pivot:n(e.pivot),...e.segments===void 0?{}:{segments:e.segments.map(e=>vs(e,t))}}}function ys(){let e;return{done:new Promise(t=>{e=t}),settle:e}}function bs(e,t){if(typeof e!=`object`||!e)return!1;let n=e,r=n.element;return[`marks`,`labels`,`focus`,`leave`,`destroy`].every(e=>typeof n[e]==`function`)&&r?.nodeType===1&&t.contains(r)}function xs(e){if(typeof e!=`object`||!e)throw TypeError(`chartSwitch needs options.`);let{views:t,initial:n,transition:r,announce:i}=e;if(typeof t!=`object`||!t)throw TypeError(`chartSwitch needs views: by name, a function that draws each view's chart in the container it's given.`);let a=Object.keys(t);if(a.length===0)throw TypeError(`chartSwitch needs at least one view.`);for(let e of a)if(typeof t[e]!=`function`)throw TypeError(`chartSwitch: views.${e} must be a function that draws the view's chart in the container it's given.`);if(typeof n!=`string`||!a.includes(n))throw TypeError(`chartSwitch: initial must be one of the views (${a.map(e=>JSON.stringify(e)).join(`, `)}), got ${typeof n==`string`?JSON.stringify(n):String(n)}.`);if(!rs(r))throw TypeError(`chartSwitch: transition must be a transition effect, such as morph().`);if(i!==void 0&&typeof i!=`boolean`)throw TypeError(`chartSwitch: announce must be true or false.`);return a}let Ss=[`presentation`,`analysis`,`off`],Cs={presentation:`Presentation`,analysis:`Analysis`,off:`Off`},ws={presentation:`Staged, unhurried motion. Best for walking someone through a change.`,analysis:`Quick, unstaged motion. Best for exploring.`,off:`No motion: charts jump straight to their end state.`,reduced:`Your device asks for reduced motion, so motion is off. Picking a mode here overrides it.`},Ts=0;function Es(e,t,n={}){let r=Os(e);ks(t),As(n);let i={...Cs,...n.labels},a={...ws,...n.hints},{persist:o}=n,s=r.ownerDocument;un(s);let c=`ec-motion-${++Ts}`,l=s.createElement(`div`);l.className=`ec-motion-switch`,l.setAttribute(`role`,`group`),l.setAttribute(`aria-labelledby`,`${c}-label`),l.setAttribute(`aria-describedby`,`${c}-hint`);let u=l.appendChild(s.createElement(`span`));u.className=`ec-motion-label`,u.id=`${c}-label`,u.textContent=n.label??`Motion`;let d=l.appendChild(s.createElement(`span`));d.className=`ec-motion-modes`;let f=Ss.map(e=>{let n=d.appendChild(s.createElement(`button`));return n.type=`button`,n.dataset.mode=e,n.textContent=i[e],n.addEventListener(`click`,()=>t.chooseMode(e)),n}),p=l.appendChild(s.createElement(`span`));p.className=`ec-motion-hint`,p.id=`${c}-hint`,p.setAttribute(`aria-live`,`polite`);let m=()=>{let e=t.mode;for(let t of f)t.setAttribute(`aria-pressed`,String(t.dataset.mode===e));p.textContent=t.prefersReduced&&t.viewerChoice===void 0?a.reduced:a[e]};if(o!==void 0){let e=Ds(s,e=>e.getItem(o));Ss.includes(e)&&t.chooseMode(e)}m(),r.appendChild(l);let h=t.subscribe(()=>{if(m(),o===void 0)return;let e=t.viewerChoice;Ds(s,t=>e===void 0?t.removeItem(o):t.setItem(o,e))}),g=!1;return{element:l,destroy(){g||(g=!0,h(),l.remove())}}}function Ds(e,t){try{let n=e.defaultView?.localStorage;return n?t(n):void 0}catch{return}}function Os(e){if(typeof e==`string`){let t=typeof document>`u`?null:document.querySelector(e);if(!t)throw TypeError(`motionSwitch: no element matches "${e}".`);return t}if(typeof e!=`object`||!e||typeof e.appendChild!=`function`)throw TypeError(`motionSwitch needs an element or a selector to build the switch in.`);return e}function ks(e){if(typeof e!=`object`||!e||typeof e.chooseMode!=`function`||typeof e.subscribe!=`function`)throw TypeError("motionSwitch needs a Motion, such as the page-wide `motion` or one from createMotion().")}function As(e){let{label:t,labels:n,hints:r,persist:i}=e;if(t!==void 0&&typeof t!=`string`)throw TypeError(`motionSwitch: label must be a string, got ${typeof t}.`);for(let[e,t]of[[`labels`,n],[`hints`,r]])if(t!==void 0){for(let[n,r]of Object.entries(t))if(typeof r!=`string`)throw TypeError(`motionSwitch: ${e}.${n} must be a string, got ${typeof r}.`)}if(i!==void 0&&(typeof i!=`string`||i===``))throw TypeError(`motionSwitch: persist must be a localStorage key, got ${JSON.stringify(i)??String(i)}.`)}let js={play:`Play`,pause:`Pause`};function Ms(e,t,n={}){let r=Ns(e);Ps(t),Fs(n);let i={...js,...n.labels},a=r.ownerDocument;un(a);let o=a.createElement(`button`);o.type=`button`,o.className=`ec-play`,o.addEventListener(`click`,()=>t.playing?t.pause():t.play());let s=()=>{let e=t.playing?i.pause:i.play;o.textContent!==e&&(o.textContent=e)};s(),r.appendChild(o);let c=t.subscribe(s),l=!1;return{element:o,destroy(){l||(l=!0,c(),o.remove())}}}function Ns(e){if(typeof e==`string`){let t=typeof document>`u`?null:document.querySelector(e);if(!t)throw TypeError(`playButton: no element matches "${e}".`);return t}if(typeof e!=`object`||!e||typeof e.appendChild!=`function`)throw TypeError(`playButton needs an element or a selector to build the button in.`);return e}function Ps(e){if(typeof e!=`object`||!e||typeof e.play!=`function`||typeof e.pause!=`function`||typeof e.subscribe!=`function`)throw TypeError(`playButton needs a Playback, from playback().`)}function Fs(e){let{labels:t}=e;if(t!==void 0){for(let[e,n]of Object.entries(t))if(typeof n!=`string`||n.trim()===``)throw TypeError(`playButton: labels.${e} must be a string with some text, got ${JSON.stringify(n)??String(n)}.`)}}let Is=Object.freeze({lift:0,spin:0,tilt:0});function Ls(){return e=>({lift:0,spin:e.distance/e.radius,tilt:0})}function Rs(e={}){let t=e.stride??42,n=e.lift??3.2,r=e.tilt??9;if(!(t>0)||!Number.isFinite(t))throw RangeError(`gaits.step: stride must be more than 0, got ${t}.`);if(!(n>=0)||!Number.isFinite(n))throw RangeError(`gaits.step: lift can't be negative, got ${n}.`);if(!Number.isFinite(r))throw RangeError(`gaits.step: tilt must be a finite number of degrees, got ${r}.`);let i=r*Math.PI/180;return Object.assign(e=>{let r=Math.max(1,Math.round(e.length/t)),a=Math.abs(Math.sin(Math.PI*(e.progress*r%1)));return{lift:a*n,spin:0,tilt:a*i*(1-.3*e.progress)}},{ease:s,pace:1.15})}function zs(){return()=>Is}let Bs={roll:Ls,step:Rs,slide:zs},Vs=[1,0,0,1,0,0],Hs=[`auto`,`follow`,`level`],Us=[`center`,`on`];function Ws(e,t={}){Zs(e,t);function n(n,r){let i=typeof e==`string`?r.icons.get(e):e;if(!i)throw RangeError(`travel: unknown icon "${String(e)}". Register it with registerIcon(icon), or pass the icon itself.`);let a=Ks(n,t.along);if(!a||!(Js(a)>=.5))return;let o=t.size===void 0?1:t.size===`fit`?.85*a.thickness/i.box.height:t.size/i.size;if(o>0)return Gs(a,i,o,t)}function r(e,t){let r=n(e,t),i,a,o=0,s=()=>{r?(i&&a?.icon===r.icon&&a.size===r.size||(i?.remove(),i=t.layer.icon(r.icon,{size:r.size}),a={icon:r.icon,size:r.size}),i.place(r.transform(o))):(i?.remove(),i=a=void 0)};return t.onChange(e=>{r=n(e,t),s()}),{get trip(){return r},show(e){o=e,s()}}}return{kind:`geometry`,async run(e,t){if(t.signal.aborted)return;let n=r(e,t),i=n.trip;!i||i.span<=0?n.show(1):await t.tween({duration:i.duration,timing:`effect`,ease:i.gait.ease??c,update:e=>n.show(e)}).finished},end(e,t){r(e,t).show(1)},clear(){}}}function Gs(e,t,n,r){let i=typeof r.gait==`function`?r.gait:Bs[r.gait??t.gait??`slide`](),a=e.length,o=t.footprint[0]*n,s=t.footprint[1]*n,c=0,l=qs(e).map(([e,t])=>{let n={from:e,to:t,span:Math.max(0,t-e-o-s),before:c};return c+=n.span,n}),u=Math.max(2,(o+s)/2),d=t.radius??t.box.height/2,{anchor:f}=t,p={x:f.x+n*(t.pivot.x-f.x),y:f.y+n*(t.pivot.y-f.y)},m=r.ride===`on`?e.thickness/2+(t.box.y+t.box.height-f.y)*n:0,h=r.orient??`auto`;return{icon:t,size:t.size*n,span:c,duration:Math.min(4e3,Math.max(260,c/360*1e3)*(i.pace??1)),gait:i,transform(r){let s=r*c,g=l.length-1;for(;g>0&&l[g].before>s;)g--;let _=l[g],v=_.from+o+Math.min(_.span,s-_.before),y=i({distance:s/n,length:c/n,progress:r,radius:d}),b=Ys(e,v),x=Xs(e,Math.min(v,a),u,_),S=h===`auto`&&t.upright===!0&&Math.cos(x)<-1e-9,C=h===`level`?0:S?P(x-Math.PI):x;return J.multiply(J.translate(b.x,b.y),J.rotate(C),S?J.scale(-1,1):Vs,J.translate(-f.x,-f.y-y.lift*n-m),J.rotate(y.spin-y.tilt,p))}}}function Ks(e,t){return t===void 0?e:e.segments?e.segments.find(e=>e.series===t):e.series===t?e:void 0}function qs(e){let{length:t}=e,n=[],r=0;for(let[i,a]of e.gaps??[])a>i&&a>r&&(i>r&&n.push([r*t,Math.min(1,i)*t]),r=Math.min(1,a));return n.push([r*t,t]),n}function Js(e){return qs(e).reduce((e,[t,n])=>e+(n-t),0)}function Ys(e,t){let{length:n}=e;return t<=n?e.path(t/n):Ze(e.end,e.angle(1),t-n)}function Xs(e,t,n,r){let{length:i}=e,a=Math.min(n,t-r.from,r.to-t);if(a>1e-6){let n=e.path((t-a)/i),r=e.path((t+a)/i);if(Math.hypot(r.x-n.x,r.y-n.y)>1e-9)return Math.atan2(r.y-n.y,r.x-n.x)}return e.angle(t/i)}function Zs(e,t){if((typeof e!=`string`||e===``)&&(typeof e!=`object`||!e||typeof e.name!=`string`))throw TypeError(`travel needs an icon or an icon's name, got ${e===null?`null`:typeof e}.`);let{along:n,gait:r,size:i,orient:a,ride:o}=t;if(n!==void 0&&typeof n!=`string`)throw RangeError(`travel: along must be a series name, got ${String(n)}.`);if(r!==void 0&&typeof r!=`function`&&!Object.prototype.hasOwnProperty.call(Bs,r))throw RangeError(`travel: gait must be a gait or one of roll, step, slide, got ${String(r)}.`);if(i!==void 0&&i!==`fit`&&!(typeof i==`number`&&i>0&&Number.isFinite(i)))throw RangeError(`travel: size must be more than 0 px, or "fit", got ${String(i)}.`);if(a!==void 0&&!Hs.includes(a))throw RangeError(`travel: orient must be auto, follow or level, got ${String(a)}.`);if(o!==void 0&&!Us.includes(o))throw RangeError(`travel: ride must be center or on, got ${String(o)}.`)}let Qs=.25;function $s(e={}){nc(e);let t=e.width??8,n=e.opacity??.35,{color:r}=e,i=(e,i)=>{let a=t*ec(i);e.mark.set({halo:a>0?{width:a,opacity:n,...r===void 0?{}:{color:r}}:void 0})};return{kind:`geometry`,async run(e,t){t.signal.aborted||await t.tween({duration:900,timing:`effect`,ease:o,update:e=>i(t,e)}).finished},end(){},clear(){}}}function ec(e){return!(e>0)||e>=1?0:e<Qs?tc(e/Qs):1-tc((e-Qs)/.75)}function tc(e){if(!(e>0))return 0;if(e>=1)return 1;let t=0,n=1;for(let r=0;r<24;r++){let r=(t+n)/2;1.74*r*r*(1-r)+r*r*r<e?t=r:n=r}let r=(t+n)/2;return 3*r*r-2*r*r*r}function nc(e){let{width:t,opacity:n,color:r}=e;if(t!==void 0&&!(typeof t==`number`&&t>0&&Number.isFinite(t)))throw RangeError(`flash: width must be more than 0 px, got ${String(t)}.`);if(n!==void 0&&!(typeof n==`number`&&n>0&&n<=1))throw RangeError(`flash: opacity must be more than 0 and at most 1, got ${String(n)}.`);if(r!==void 0&&(typeof r!=`string`||r===``))throw RangeError(`flash: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}let rc=[1,-.5,.25],ic=Math.PI/12;function ac(e={}){cc(e);let t=e.swing??3;return{kind:`geometry`,async run(e,n){if(n.signal.aborted)return;let r=e,i=oc(e,t),a=0,s=()=>{let e=i*sc(a);n.mark.set({transform:e===0?void 0:J.rotate(e,r.pivot)})};n.onChange(e=>{r=e,i=oc(e,t),s()}),await n.tween({duration:450,timing:`effect`,ease:o,update:e=>{a=e,s()}}).finished},end(){},clear(){}}}function oc(e,t){let{pivot:n}=e,r=0;for(let t of e.outline.sample(64))r=Math.max(r,Math.hypot(t.x-n.x,t.y-n.y));return r>=.5?Math.min(ic,2*Math.asin(Math.min(1,t/(2*r)))):0}function sc(e){if(!(e>0)||e>=1)return 0;let t=e*rc.length,n=Math.floor(t);return rc[n]*Math.sin(Math.PI*(t-n))}function cc(e){let{swing:t}=e;if(t!==void 0&&!(typeof t==`number`&&t>0&&t<=3))throw RangeError(`wiggle: swing must be more than 0 and at most 3 px, got ${String(t)}.`)}function lc(e={}){uc(e);let t=e.times??2,n=e.width??12,{color:r}=e,i=(e,t)=>{let i=t>0&&t<1;e.mark.set({halo:i?{width:n*c(t),opacity:.4*(1-t),...r===void 0?{}:{color:r}}:void 0})};return{kind:`geometry`,async run(e,n){let r=0;for(let e=0;e<t;e++){if(n.signal.aborted)return;let e=n.motion.duration(600,`effect`);if(r+e>=5e3)return;r+=e,await n.tween({duration:600,timing:`effect`,ease:o,update:e=>i(n,e)}).finished}},end(){},clear(){}}}function uc(e){let{times:t,width:n,color:r}=e;if(t!==void 0&&!(Number.isInteger(t)&&t>=1&&t<=6))throw RangeError(`pulse: times must be a whole number from 1 to 6, got ${String(t)}.`);if(n!==void 0&&!(typeof n==`number`&&n>0&&Number.isFinite(n)))throw RangeError(`pulse: width must be more than 0 px, got ${String(n)}.`);if(r!==void 0&&(typeof r!=`string`||r===``))throw RangeError(`pulse: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}let dc=.5;function fc(e={}){pc(e);let t=e.duration??500,n={stroke:e.color??`mark`,width:e.width??3,opacity:e.opacity??.5,linecap:`round`},r=(e,t)=>{let r=e,i=0,a,o=()=>{if(!(r.length>=dc)){a?.remove(),a=void 0;return}let e=r.slice(0,i);a?a.update(e):a=t.layer.path(e,n)};return t.onChange(e=>{r=e,o()}),o(),e=>{i=e,o()}};return{kind:`geometry`,async run(e,n){if(n.signal.aborted)return;let i=r(e,n);e.length>=dc?await n.tween({duration:t,timing:`effect`,ease:s,update:i}).finished:i(1)},end(e,t){r(e,t)(1)},clear(){}}}function pc(e){let{color:t,width:n,opacity:r,duration:i}=e;if(t!==void 0&&(typeof t!=`string`||t===``))throw RangeError(`trace: color must be a theme token or a CSS colour, got ${JSON.stringify(t)??String(t)}.`);if(n!==void 0&&!(typeof n==`number`&&n>=0&&Number.isFinite(n)))throw RangeError(`trace: width must be 0 px or more, got ${String(n)}.`);if(r!==void 0&&!(typeof r==`number`&&r>=0&&r<=1))throw RangeError(`trace: opacity must be from 0 to 1, got ${String(r)}.`);if(i!==void 0&&!(typeof i==`number`&&i>=0&&Number.isFinite(i)))throw RangeError(`trace: duration must be 0 ms or more, got ${String(i)}.`)}let mc=.36;function hc(e){let t=e.labelBounds??[],n=e.angle(1),r=_c(e.end,n,t);if(r===void 0&&t.length>0){let n=e.angle(.5)-Math.PI/2,r=_c(e.center,n,t);if(r!==void 0)return gc(e.center,n,r)}return gc(e.end,n,Math.max(10,r??-1/0))}function gc(e,t,n){let r=Math.cos(t),i=Math.sin(t),a=Ze(e,t,n),o=12.5*(i<0?mc*(1+i):mc+.44000000000000006*i),s=Math.abs(r)<=Math.SQRT1_2+1e-9?`middle`:r>0?`start`:`end`;return{at:{x:a.x,y:a.y+o},anchor:s,toward:t}}function _c(e,t,n){let r=Math.cos(t),i=Math.sin(t),a;for(let{x:t,y:o,width:s,height:c}of n){let n=vc(e,r,i,{x:t-6,y:o-6,width:s+12,height:c+12});n!==void 0&&(a=Math.max(a??n,n))}return a}function vc(e,t,n,r){let i=0,a=1/0;for(let[o,s,c,l]of[[e.x,t,r.x,r.x+r.width],[e.y,n,r.y,r.y+r.height]]){if(Math.abs(s)<1e-12){if(o<c||o>l)return;continue}let e=(c-o)/s,t=(l-o)/s;i=Math.max(i,Math.min(e,t)),a=Math.min(a,Math.max(e,t))}return a>=i?a:void 0}function yc(e,t,n,r,i){let a=e,o=i(e,t)??``,s=t,c=0,l,u=()=>{if(o===``){l?.remove(),l=void 0;return}let{at:e,anchor:t,toward:i}=hc(a),s={at:Ze(e,i-Math.PI/2,-8*(1-c)),anchor:t,color:r,opacity:c};l?l.update(s,o):l=n.layer.text(o,s)};return n.onChange((e,t)=>{a=e,s=t??s,o=i(a,s)??``,u()}),u(),e=>{c=e,u()}}let bc=e=>{let{samples:t}=e;return t[t.length-1]?.value??NaN},xc,Sc=e=>(xc??(xc=new Intl.NumberFormat(void 0,{signDisplay:`always`,maximumFractionDigits:2})),xc.format(e));function Cc(e={}){wc(e);let t=e.value??bc,n=e.format??Sc,r=e.color??`text`,i=e=>{if(!e.previous)return;let r=t(e),i=t(e.previous),a=r-i;if(!(!Number.isFinite(a)||Math.abs(a)<=1e-9*Math.max(Math.abs(r),Math.abs(i))))return n(a)};return{kind:`data`,run:async(e,t,n)=>{if(n.signal.aborted)return;let a=i(t);if(a===void 0||a===``)return;let o=yc(e,t,n,r,()=>a);await n.tween({duration:400,timing:`effect`,update:o}).finished},end:(e,t,n)=>{let a=i(t);a!==void 0&&a!==``&&yc(e,t,n,r,()=>a)(1)},clear(){}}}function wc(e){let{value:t,format:n,color:r}=e;if(t!==void 0&&typeof t!=`function`)throw TypeError(`delta: value must be a function that reads the mark's value from its data, got ${typeof t}.`);if(n!==void 0&&typeof n!=`function`)throw TypeError(`delta: format must be a function that words the change, got ${typeof n}.`);if(r!==void 0&&(typeof r!=`string`||r===``))throw RangeError(`delta: color must be a theme token or a CSS colour, got ${JSON.stringify(r)??String(r)}.`)}function Tc(e,t={}){if(typeof e!=`function`)throw TypeError(`label needs a function that returns the text from the mark's data, got ${typeof e}.`);let{color:n=`text`}=t;if(typeof n!=`string`||n===``)throw RangeError(`label: color must be a theme token or a CSS colour, got ${JSON.stringify(n)??String(n)}.`);let r=(t,n)=>{let r=e(n,t);return r==null?void 0:String(r)};return{kind:`data`,run:async(e,t,i)=>{if(i.signal.aborted)return;let a=yc(e,t,i,n,r);await i.tween({duration:400,timing:`effect`,update:a}).finished},end:(e,t,i)=>yc(e,t,i,n,r)(1),clear(){}}}let Ec=[`below`,`above`];function Dc(e){Ic(e);let{compareTo:t}=e,n=e.when??`below`,r=e.color??`negative`,i=(e,i,a)=>{let o=[],s=i,c=e=>{let i=e.length>=.5?Nc(s.samples,Oc(t,s),n):[],c={stroke:r,width:e.thickness,linecap:`butt`};i.forEach(([t,n],r)=>{let i=e.slice(t,n),s=o[r];s?s.update(i,c):o.push(a.layer.path(i,c))});for(let e of o.splice(i.length))e.remove()};a.onChange((e,t)=>{s=t??s,c(e)}),c(e)};return{kind:`data`,...typeof t==`string`?{needs:Object.freeze({related:Object.freeze([t])})}:{},run:async(e,t,n)=>{n.signal.aborted||i(e,t,n)},end:(e,t,n)=>i(e,t,n),clear(){}}}function Oc(e,t){if(typeof e==`number`)return{place:e=>e.t,valueAt:()=>e,bends:[]};let n=t.related(e);if(!n)return;let r=t.samples.every(e=>jc(e.at)!==void 0)&&n.samples.every(e=>jc(e.at)!==void 0)?e=>jc(e.at):e=>e.t,i=n.samples.map(e=>({u:r(e),value:e.value})).filter(e=>Number.isFinite(e.u)).sort((e,t)=>e.u-t.u),a=kc(n.samples,r);return{place:r,valueAt:e=>Ac(a,e)?void 0:Mc(i,e),bends:i.map(e=>e.u)}}function kc(e,t){let n=[];e.forEach((r,i)=>{let a=e[i-1];if(r.gapBefore!==!0||!a)return;let o=t(a),s=t(r);Number.isFinite(o)&&Number.isFinite(s)&&o!==s&&n.push([Math.min(o,s),Math.max(o,s)])}),n.sort((e,t)=>e[0]-t[0]);let r=[];for(let e of n){let t=r[r.length-1];t&&e[0]<t[1]?t[1]=Math.max(t[1],e[1]):r.push(e)}return r}function Ac(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i][0]<t?n=i+1:r=i}let i=e[n-1];return i!==void 0&&t<i[1]}function jc(e){let t=typeof e==`number`?e:e instanceof Date?e.getTime():void 0;return t!==void 0&&Number.isFinite(t)?t:void 0}function Mc(e,t){let n=e[0],r=e[e.length-1];if(!n||!r||t<n.u||t>r.u)return;let i=0,a=e.length-1;for(;i<a;){let n=i+a>>1;e[n].u<t?i=n+1:a=n}let o=e[i];if(i===0||o.u===t)return o.value;let s=e[i-1];return s.value+(t-s.u)/(o.u-s.u)*(o.value-s.value)}function Nc(e,t,n){if(!t)return[];let r=n===`below`?1:-1,i=(e,n,i,a=!0)=>{let o=t.valueAt(n);if(o===void 0||!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(e))return{t:e,u:n,past:void 0,joined:a};let s=r*(o-i);return{t:e,u:n,past:Math.abs(s)<=1e-9*Math.max(Math.abs(o),Math.abs(i))?0:s,joined:a}},a=[];e.forEach((n,r)=>{let o=t.place(n);a.push(i(n.t,o,n.value,n.gapBefore!==!0));let s=e[r+1];if(!s||s.gapBefore===!0)return;let c=t.place(s);if(o===c||!Number.isFinite(o)||!Number.isFinite(c))return;let l=[],{bends:u}=t;for(let e=Fc(u,Math.min(o,c));e<u.length&&u[e]<Math.max(o,c);e++)l.push((u[e]-o)/(c-o));c<o&&l.reverse();for(let e of l)a.push(i(n.t+e*(s.t-n.t),o+e*(c-o),n.value+e*(s.value-n.value)))});let o=[],s=(e,t)=>{let n=Pc(e),r=Pc(t);if(!(r>n))return;let i=o[o.length-1];i&&i[1]>=n?i[1]=Math.max(i[1],r):o.push([n,r])};for(let e=1;e<a.length;e++){let n=a[e-1],r=a[e];n.past!==void 0&&r.past!==void 0&&r.joined&&r.t>n.t&&(n.u===r.u||t.valueAt((n.u+r.u)/2)!==void 0)&&(n.past>0&&r.past>0?s(n.t,r.t):n.past>0?s(n.t,n.t+(r.t-n.t)*(n.past/(n.past-r.past))):r.past>0&&s(n.t+(r.t-n.t)*(n.past/(n.past-r.past)),r.t))}return o}let Pc=e=>Math.min(1,Math.max(0,e));function Fc(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i]<=t?n=i+1:r=i}return n}function Ic(e){let{compareTo:t,when:n,color:r}=e??{};if(!(typeof t==`string`?t!==``:typeof t==`number`&&Number.isFinite(t)))throw RangeError(`threshold: compareTo must be a finite number or a series name, got ${Lc(t)}.`);if(n!==void 0&&!Ec.includes(n))throw RangeError(`threshold: when must be "below" or "above", got ${Lc(n)}.`);if(r!==void 0&&(typeof r!=`string`||r===``))throw RangeError(`threshold: color must be a theme token or a CSS colour, got ${Lc(r)}.`)}let Lc=e=>typeof e==`string`?JSON.stringify(e):String(e),Rc=[`unroll`,`drop`];function zc(e={}){qc(e);let t=e?.points??160,n=e?.align??`unroll`;return{kind:`transition`,async run(e,r,i){if(i.signal.aborted)return;let a=Bc(e,r,i.layer,t,n),c=Kc(i.start);if(c>=1){a(1);return}let u=l(c),d;d=i.tween({duration:950,timing:`transition`,ease:o,update:e=>{let t=Math.min(1,u+e);a(e===0?c:s(t)),t>=1&&e<1&&d?.finish()}}),await d.finished},end(e,r,i){Bc(e,r,i.layer,t,n)(1)},clear(){}}}function Bc(e,t,n,r,i){let a=e.outline.closed;if(a!==t.outline.closed)return Hc(e,t,n);let o=e.outline.sample(r),s=t.outline.sample(r);if(!a)return Vc(e,t,n,o,s);let[c,l]=i===`drop`?Gc(e,t,r):[0,0],u;return r=>{let i=r<=0?e.outline.d:r>=1?t.outline.d:Uc(o,s,c,l,r,!0);u?u.update(i):u=n.path(i,{fill:`mark`})}}function Vc(e,t,n,r,i){let a;return o=>{let s=o<=0?e.outline.d:o>=1?t.outline.d:Uc(r,i,0,0,o,!1),c=o<=0?e.thickness:o>=1?t.thickness:Wc(e.thickness,t.thickness,o);a?a.update(s,{width:c}):a=n.path(s,{stroke:`mark`,width:c})}}function Hc(e,t,n){let r=(e,t)=>({...e.outline.closed?{fill:`mark`}:{stroke:`mark`,width:e.thickness},...t===void 0?{}:{opacity:t}}),i,a;return o=>{o>=1?(i?.remove(),i=void 0,a?a.update(t.outline.d,{opacity:void 0}):a=n.path(t.outline.d,r(t))):a?(i?.update(e.outline.d,{opacity:1-o}),a.update(t.outline.d,{opacity:o})):e.outline.closed?(i=n.path(e.outline.d,r(e,1-o)),a=n.path(t.outline.d,r(t,o))):(a=n.path(t.outline.d,r(t,o)),i=n.path(e.outline.d,r(e,1-o)))}}function Uc(e,t,n,r,i,a){let o=e.length,s=``;for(let a=0;a<o;a++){let c=e[(a+n)%o],l=t[(a+r)%o];s+=`${a===0?`M`:`L`}${L(Wc(c.x,l.x,i))},${L(Wc(c.y,l.y,i))}`}return a?`${s}Z`:s}let Wc=(e,t,n)=>e*(1-n)+t*n;function Gc(e,t,n){let r=n/4,i=Sa(e);return i===Sa(t)?[0,0]:i?[0,r]:[r,0]}function Kc(e){return typeof e==`number`&&e>0?Math.min(1,e):0}function qc(e){let{points:t,align:n}=e??{};if(t!==void 0&&!(Number.isInteger(t)&&t>=4&&t%4==0))throw RangeError(`morph: points must be a whole multiple of 4, got ${String(t)}.`);if(n!==void 0&&!Rc.includes(n))throw RangeError(`morph: align must be "unroll" or "drop", got ${typeof n==`string`?JSON.stringify(n):String(n)}.`)}function Jc(...e){let t=el(`sequence`,e);return $c(t,async(e,n)=>{for(let r of t){if(n.signal.aborted)return;await e(r)}})}function Yc(...e){let t=el(`parallel`,e);return $c(t,async e=>{await Promise.all(t.map(e))})}function Xc(e,t){if(typeof e!=`string`&&typeof e!=`function`)throw TypeError(`only needs a key, a series name or a predicate, got ${st(e)}.`);let[n]=el(`only`,[t]),r=typeof e==`string`?t=>t.key===e||t.series===e:e;if(n.kind===`data`){let e=n;return{kind:`data`,...e.needs?{needs:e.needs}:{},run:(t,n,i)=>r(t)?e.run(t,n,i):Promise.resolve(),end:(t,n,i)=>{r(t)&&e.end(t,n,i)},clear:t=>e.clear(t)}}let i=n;return{kind:`geometry`,run:(e,t)=>r(e)?i.run(e,t):Promise.resolve(),end(e,t){r(e)&&i.end(e,t)},clear:e=>i.clear(e)}}function Zc(e,t={}){let[n]=el(`stagger`,[e]),r=t.delay??50;if(!(typeof r==`number`&&r>=0&&Number.isFinite(r)))throw RangeError(`stagger: delay must be 0 ms or more, got ${String(r)}.`);let i=async(e,t,n)=>{if(n.signal.aborted)return;let{index:i,count:a}=n.batch,o=a>1?Math.min(r,500/(a-1)):0,s=i>0?i*o:0;if(!(s>0))return{mark:e,data:t};let c=Qc(e,t,n);return await n.tween({duration:s,timing:`stagger`,update:()=>{}}).finished,n.signal.aborted?void 0:c()};if(n.kind===`data`){let e=n;return{kind:`data`,...e.needs?{needs:e.needs}:{},run:async(t,n,r)=>{let a=await i(t,n,r);a&&await e.run(a.mark,a.data,r)},end:(t,n,r)=>e.end(t,n,r),clear:t=>e.clear(t)}}let a=n;return{kind:`geometry`,async run(e,t){let n=await i(e,void 0,t);n&&await a.run(n.mark,t)},end:(e,t)=>a.end(e,t),clear:e=>a.clear(e)}}function Qc(e,t,n){let r={mark:e,data:t};return n.onChange((e,t)=>{r={mark:e,data:t??r.data}}),()=>r}function $c(e,t){let n=(e,t,n)=>{let r=Qc(e,t,n);return e=>{let{mark:t,data:i}=r();return e.kind===`data`?e.run(t,i,n):e.run(t,n)}},r=(t,n,r)=>{for(let i of e)i.kind===`data`?i.end(t,n,r):i.end(t,r)},i=t=>{let n;for(let r of e)try{r.clear(t)}catch(e){n??(n={error:e})}if(n)throw n.error};if(e.some(e=>e.kind===`data`)){let a=[...new Set(e.flatMap(e=>e.kind===`data`?e.needs?.related??[]:[]))];return{kind:`data`,...a.length>0?{needs:{related:a}}:{},run:(e,r,i)=>t(n(e,r,i),i),end:(e,t,n)=>r(e,t,n),clear:i}}return{kind:`geometry`,run:(e,r)=>t(n(e,void 0,r),r),end:(e,t)=>r(e,void 0,t),clear:i}}function el(e,t){return t.forEach((t,n)=>{if(!ot(t))throw TypeError(`${e}: part ${n+1} needs to be a mark effect (kind "geometry" or "data"), got ${st(t)}.`)}),[...t]}let tl=()=>{};function nl(e){il(`defineEffect`,e);let t={kind:`geometry`,run:e.run,end:e.end,clear:e.clear??tl};return Object.freeze(t)}function rl(e){il(`defineDataEffect`,e);let t=al(e.needs),n={kind:`data`,...t?{needs:t}:{},run:e.run,end:e.end,clear:e.clear??tl};return Object.freeze(n)}function il(e,t){if(typeof t!=`object`||!t)throw TypeError(`${e} needs a spec object { run, end }, got ${t===null?`null`:typeof t}.`);let{run:n,end:r,clear:i}=t;if(typeof n!=`function`)throw TypeError(`${e}: run must be a function that animates the mark, got ${typeof n}.`);if(typeof r!=`function`)throw TypeError(`${e}: end must be a function that draws the final state, got ${typeof r}. Every effect needs one: reduced motion shows only end states.`);if(i!==void 0&&typeof i!=`function`)throw TypeError(`${e}: clear must be a function if it's given, got ${typeof i}.`)}function al(e){if(e===void 0)return;let t=typeof e==`object`&&e?e.related:void 0;if(!(typeof e==`object`&&e&&(t===void 0||Array.isArray(t)&&t.every(e=>typeof e==`string`&&e!==``))))throw TypeError(`defineDataEffect: needs must be { related: [series names] }, got ${JSON.stringify(e)??String(e)}.`);return t===void 0?void 0:Object.freeze({related:Object.freeze([...t])})}let ol=[`roll`,`step`,`slide`],sl=[`butt`,`round`],cl=[`miter`,`round`],ll=[`nonzero`,`evenodd`],ul=/^\s*[Mm][MmLlHhVvCcSsQqTtAaZz0-9eE.,+\-\s]*$/;function dl(e){let t=e?.name;if(typeof t!=`string`||t===``)throw TypeError(`defineIcon needs a non-empty string name, got ${JSON.stringify(t)}.`);let n=(e,n)=>{throw RangeError(`defineIcon: "${t}" ${e} ${n}.`)},r=(e,t)=>typeof t==`number`&&Number.isFinite(t)?t:n(e,`must be a finite number, got ${String(t)}`),i=(e,t)=>r(e,t)>0?t:n(e,`must be more than 0, got ${String(t)}`),a=(e,t)=>t&&typeof t==`object`?pl({x:r(`${e}.x`,t.x),y:r(`${e}.y`,t.y)}):n(e,`must be a point { x, y }`);Array.isArray(e.shapes)&&e.shapes.length!==0||n(`shapes`,`must be a non-empty array`);let o=e.shapes.map((e,t)=>fl(e,`shapes[${t}]`,n,r)),s=e.box;s&&typeof s==`object`||n(`box`,`must be a rectangle { x, y, width, height }`);let c=pl({x:r(`box.x`,s.x),y:r(`box.y`,s.y),width:i(`box.width`,s.width),height:i(`box.height`,s.height)}),l=a(`anchor`,e.anchor),u=e.pivot===void 0?l:a(`pivot`,e.pivot),d=e.footprint??[Math.max(0,l.x-c.x),Math.max(0,c.x+c.width-l.x)];Array.isArray(d)&&d.length===2||n(`footprint`,`must be [behind, ahead]`),d.forEach((e,t)=>{r(`footprint[${t}]`,e)<0&&n(`footprint[${t}]`,`can't be negative, got ${e}`)});let f=e.size===void 0?c.width:i(`size`,e.size),p=e.radius===void 0?c.height/2:i(`radius`,e.radius);return e.gait!==void 0&&!ol.includes(e.gait)&&n(`gait`,`must be roll, step or slide, got ${String(e.gait)}`),e.upright!==void 0&&typeof e.upright!=`boolean`&&n(`upright`,`must be true or false, got ${String(e.upright)}`),pl({name:t,shapes:pl(o),box:c,size:f,anchor:l,pivot:u,footprint:pl([d[0],d[1]]),...e.gait===void 0?{}:{gait:e.gait},radius:p,...e.upright===void 0?{}:{upright:e.upright}})}function fl(e,t,n,r){e&&typeof e==`object`||n(t,`must be a shape { d, fill?, stroke?, … }`),typeof e.d==`string`&&ul.test(e.d)||n(`${t}.d`,`must be path data starting with a move`),e.clip===void 0||typeof e.clip==`string`&&ul.test(e.clip)||n(`${t}.clip`,`must be path data starting with a move`);for(let r of[`fill`,`stroke`]){let i=e[r];i!==void 0&&(typeof i!=`string`||i===``)&&n(`${t}.${r}`,`must be a colour, got ${String(i)}`)}e.width!==void 0&&r(`${t}.width`,e.width)<0&&n(`${t}.width`,`can't be negative, got ${e.width}`),e.linecap!==void 0&&!sl.includes(e.linecap)&&n(`${t}.linecap`,`must be butt or round, got ${String(e.linecap)}`),e.linejoin!==void 0&&!cl.includes(e.linejoin)&&n(`${t}.linejoin`,`must be miter or round, got ${String(e.linejoin)}`),e.fillRule!==void 0&&!ll.includes(e.fillRule)&&n(`${t}.fillRule`,`must be nonzero or evenodd, got ${String(e.fillRule)}`);for(let i of[`opacity`,`fillOpacity`,`strokeOpacity`]){let a=e[i]===void 0?1:r(`${t}.${i}`,e[i]);(a<0||a>1)&&n(`${t}.${i}`,`must be from 0 to 1, got ${a}`)}let i={d:e.d};for(let t of[`fill`,`stroke`,`width`,`linecap`,`linejoin`,`clip`,`fillRule`,`opacity`,`fillOpacity`,`strokeOpacity`])e[t]!==void 0&&(i[t]=e[t]);return pl(i)}let pl=e=>Object.freeze(e),ml=/* @__PURE__ */ new Set([`svg`,`g`,`a`]),hl=/* @__PURE__ */ new Set([`path`,`circle`,`rect`,`ellipse`,`line`,`polyline`,`polygon`]),gl=/<![^<>]*>|<(\/?)([A-Za-z][\w:.-]*)((?:\s+[^\s=/<>]+(?:\s*=\s*(?:"[^"<]*"|'[^'<]*'|[^\s"'<>]+))?)*)\s*(\/?)>/g,_l=/([^\s=/<>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+)))?/g,vl=/^(?:#[0-9a-fA-F]{3,8}|[a-zA-Z][a-zA-Z0-9-]*|(?:rgba?|hsla?)\([\d\s.,%+\-/]*\))$/;function yl(e,t){if(typeof e!=`string`)throw TypeError(`iconFromSvg needs SVG markup as a string.`);let n=typeof t?.name==`string`?`"${t.name}"`:`an icon`,r=e=>{throw RangeError(`iconFromSvg: ${n} ${e}.`)},i,a=1,o=[],s=[],c;for(let n of bl(e).matchAll(gl)){let[,e,l,u=``,d]=n;if(l===void 0)continue;let f=l.toLowerCase();if(e){let e=Ol(s,f);e>=0&&(s.length=e);continue}let p=xl(u),m=!i&&f===`svg`;m&&(i=Sl(p)??r(`needs a viewBox, or a width and height in px, on its <svg>`),t.size!==void 0&&(typeof t.size==`number`&&t.size>0&&Number.isFinite(t.size)||r(`size must be more than 0, got ${String(t.size)}`),a=t.size/i.width),c={fill:`#000000`,stroke:`none`,width:1,linecap:void 0,linejoin:void 0,fillRule:`nonzero`,opacity:1,fillOpacity:1,strokeOpacity:1,transform:J.scale(a)});let h=s.length>0?s[s.length-1].state:m?c:void 0,g=h&&!Tl(p)?El(h,p):void 0;if(g&&hl.has(f)){let e=Dl(f,p,g);e&&o.push(e)}d||s.push({tag:f,state:ml.has(f)?g:void 0})}i||r(`needs an <svg> element`),o.length===0&&r(`has nothing to draw: no path, circle, rect, ellipse, line, polyline or polygon with a fill or stroke`);let l={x:i.x*a,y:i.y*a,width:i.width*a,height:i.height*a},u=e=>e&&typeof e==`object`?{x:e.x*a,y:e.y*a}:e;return dl({...t,shapes:o,box:l,anchor:u(t.anchor),...t.pivot?{pivot:u(t.pivot)}:{},...Array.isArray(t.footprint)?{footprint:[t.footprint[0]*a,t.footprint[1]*a]}:{},...typeof t.radius==`number`?{radius:t.radius*a}:{}})}function bl(e){let t=[[`<!--`,`-->`],[`<![CDATA[`,`]]>`],[`<?`,`?>`]],n=t.map(([t])=>e.indexOf(t)),r=``,i=0;for(;;){let a=-1;if(n.forEach((e,t)=>{e>=0&&(a<0||e<n[a])&&(a=t)}),a<0)return r+e.slice(i);let o=n[a],s=t[a][1];r+=e.slice(i,o);let c=e.indexOf(s,o+t[a][0].length);if(c<0)return r;i=c+s.length,n.forEach((r,a)=>{r>=0&&r<i&&(n[a]=e.indexOf(t[a][0],i))})}}function xl(e){let t=/* @__PURE__ */ new Map;for(let[,n,r,i,a]of e.matchAll(_l))n!==void 0&&t.set(n,r??i??a??``);for(let e of(t.get(`style`)??``).split(`;`)){let n=e.indexOf(`:`);n>0&&t.set(e.slice(0,n).trim(),e.slice(n+1).replace(/!important/i,``).trim())}return t}function Sl(e){let t=(e.get(`viewBox`)??``).trim().split(/[\s,]+/).map(Number);if(t.length===4&&t.every(Number.isFinite)&&t[2]>0&&t[3]>0)return{x:t[0],y:t[1],width:t[2],height:t[3]};let n=Cl(e.get(`width`)),r=Cl(e.get(`height`));return n!==void 0&&r!==void 0?{x:0,y:0,width:n,height:r}:void 0}function Cl(e){let t=/^\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)\s*(?:px\s*)?$/i.exec(e??``),n=t?Number(t[1]):NaN;return n>0&&Number.isFinite(n)?n:void 0}function wl(e){let t=/^\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)(%?)\s*$/i.exec(e??``);return t?Math.min(1,Math.max(0,Number(t[1])/(t[2]?100:1))):void 0}function Tl(e){return e.get(`display`)?.trim()===`none`||e.get(`visibility`)?.trim()===`hidden`}function El(e,t){let n=(e,n)=>{let r=t.get(e)?.trim();if(r===void 0||!vl.test(r))return n;let i=r.toLowerCase();return i===`inherit`?n:i===`currentcolor`?`text`:i===`none`?i:r},r=Number.parseFloat(t.get(`stroke-width`)??``),i=t.get(`stroke-linecap`)?.trim(),a=t.get(`stroke-linejoin`)?.trim(),o=t.get(`fill-rule`)?.trim().toLowerCase(),s=t.get(`transform`);return{fill:n(`fill`,e.fill),stroke:n(`stroke`,e.stroke),width:r>=0?r:e.width,linecap:i===`butt`||i===`round`?i:e.linecap,linejoin:a===`miter`||a===`round`?a:e.linejoin,fillRule:o===`nonzero`||o===`evenodd`?o:e.fillRule,opacity:e.opacity*(wl(t.get(`opacity`))??1),fillOpacity:wl(t.get(`fill-opacity`))??e.fillOpacity,strokeOpacity:wl(t.get(`stroke-opacity`))??e.strokeOpacity,transform:s?J.multiply(e.transform,Xe(s)):e.transform}}function Dl(e,t,n){let r=kl(n.fillOpacity),i=kl(n.strokeOpacity),a=n.fill===`none`||!(r>0)?void 0:n.fill,o=n.stroke===`none`||!(n.width>0)||!(i>0)?void 0:n.stroke,s=kl(n.opacity);if(a===void 0&&o===void 0||!(s>0))return;let c=Ae(e,e=>t.get(e));if(!c.some(e=>e.op!==`M`))return;let l=n.transform;return{d:Fe(Ne(c,l)),...a===void 0?{}:{fill:a,...n.fillRule===`evenodd`?{fillRule:n.fillRule}:{},...r<1?{fillOpacity:r}:{}},...o===void 0?{}:{stroke:o,width:kl(n.width*Math.sqrt(Math.abs(l[0]*l[3]-l[1]*l[2]))),...n.linecap?{linecap:n.linecap}:{},...n.linejoin?{linejoin:n.linejoin}:{},...i<1?{strokeOpacity:i}:{}},...s<1?{opacity:s}:{}}}function Ol(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].tag===t)return n;return-1}let kl=e=>Math.round(e*1e3)/1e3,Al=/* @__PURE__ */ Object.freeze({dot:/* @__PURE__ */ dl({name:`dot`,shapes:[{d:`M4,0A4,4 0 0 1 -4,0A4,4 0 0 1 4,0Z`,fill:`surface`,stroke:`text`,width:1.5}],box:{x:-5,y:-5,width:10,height:10},anchor:{x:0,y:0}}),arrow:/* @__PURE__ */ dl({name:`arrow`,shapes:[{d:`M-7,-1.5L1,-1.5L1,-5L7,0L1,5L1,1.5L-7,1.5Z`,fill:`text`,stroke:`surface`,width:1.5,linejoin:`round`}],box:{x:-8,y:-6,width:16,height:12},anchor:{x:0,y:0}}),chevron:/* @__PURE__ */ dl({name:`chevron`,shapes:[{d:`M-2.5,-5L2.5,0L-2.5,5`,stroke:`surface`,width:4.5,linecap:`round`,linejoin:`round`},{d:`M-2.5,-5L2.5,0L-2.5,5`,stroke:`text`,width:2,linecap:`round`,linejoin:`round`}],box:{x:-5,y:-7.5,width:10,height:15},anchor:{x:0,y:0}})}),jl=/* @__PURE__ */ rt({kind:`preset`,entries:{flash:()=>$s(),wiggle:()=>ac(),pulse:()=>lc()},hint:`Register custom presets with registerPreset(name, factory).`}),Ml=/* @__PURE__ */ rt({kind:`icon`,entries:Al,hint:`Register icons with registerIcon(icon) or registerIcons(icons).`});function Nl(e,t){if(typeof t!=`function`)throw TypeError(`registerPreset("${e}") needs a function that returns an effect.`);jl.register(e,t)}function Pl(e){if(typeof e!=`object`||!e||typeof e.name!=`string`)throw TypeError(`registerIcon needs an icon with a name.`);Ml.register(e.name,e)}function Fl(e){for(let t of e)Pl(t)}function Il(e){if(typeof e!=`object`||!e)throw TypeError(`configure needs an options object.`);if(`nonce`in e){if(e.nonce!==void 0&&(typeof e.nonce!=`string`||e.nonce===``))throw TypeError(`configure: nonce must be a non-empty string.`);ln.nonce=e.nonce}if(`injectStyles`in e){if(e.injectStyles!==void 0&&typeof e.injectStyles!=`boolean`)throw TypeError(`configure: injectStyles must be true or false.`);ln.injectStyles=e.injectStyles}}let Ll={presets:jl,icons:Ml,motion:v};function Rl(e,t){return Dr(e,t,Ll)}function zl(e,t){return ri(e,t,Ll)}function Bl(e,t){return ca(e,t,Ll)}function Vl(e,t){return os(e,typeof t==`object`&&t&&t.transition===void 0?{...t,transition:zc()}:t,Ll)}function Hl(e,t){return vo(e,t,Ll)}function Ul(e,t){return Ro(e,t,Ll)}function Wl(e,t=v,n){return Es(e,t,n)}return e.VERSION=`0.4.0`,e.animated=C,e.barChart=Rl,e.chartSwitch=Vl,e.colorAssignment=dn,e.configure=Il,e.createClock=n,e.createMotion=p,e.defaultClock=a,e.defaultScaling=u,e.defineDataEffect=rl,e.defineEffect=nl,e.defineIcon=dl,e.delta=Cc,e.describe=Ve,e.donutChart=zl,e.easeInOutCubic=s,e.easeOutCubic=c,e.expressive=Hl,e.flash=$s,e.fromVegaView=Ul,e.gaits=Bs,e.iconFromSvg=yl,e.icons=Al,e.interpolateNumber=b,e.interpolatePoint=x,e.interpolateRecord=S,e.label=Tc,e.lineChart=Bl,e.linear=o,e.link=Sn,e.manualClock=r,e.matrix=J,e.mediaReducedMotion=h,e.morph=zc,e.motion=v,e.motionSwitch=Wl,e.offset=Ze,e.only=Xc,e.parallel=Yc,e.playButton=Ms,e.playback=w,e.pulse=lc,e.registerIcon=Pl,e.registerIcons=Fl,e.registerPreset=Nl,e.samplesAlong=$e,e.scaleDuration=m,e.sequence=Jc,e.stagger=Zc,e.threshold=Dc,e.trace=fc,e.travel=Ws,e.tween=y,e.wiggle=ac,e})({});
|
|
93
96
|
//# sourceMappingURL=expressive-charts.global.js.map
|