mascot-vis 3.3.2 → 3.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.
@@ -1,2 +1,2 @@
1
- // version: 3.3.2
2
- "use strict";function t(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function e(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function n(n){let i,o,a;function s(t,e,n=0,r=t.length){if(n<r){if(0!==i(e,e))return r;do{const i=n+r>>>1;o(t[i],e)<0?n=i+1:r=i}while(n<r)}return n}return 2!==n.length?(i=t,o=(e,r)=>t(n(e),r),a=(t,e)=>n(t)-e):(i=n===t||n===e?n:r,o=n,a=n),{left:s,center:function(t,e,n=0,r=t.length){const i=s(t,e,n,r-1);return i>n&&a(t[i-1],e)>-a(t[i],e)?i-1:i},right:function(t,e,n=0,r=t.length){if(n<r){if(0!==i(e,e))return r;do{const i=n+r>>>1;o(t[i],e)<=0?n=i+1:r=i}while(n<r)}return n}}}function r(){return 0}function i(t){return null===t?NaN:+t}const o=n(t),a=o.right,s=o.left,l=n(i).center;const c=h(p),u=h(function(t){const e=p(t);return(t,n,r,i,o)=>{e(t,n,(r<<=2)+0,(i<<=2)+0,o<<=2),e(t,n,r+1,i+1,o),e(t,n,r+2,i+2,o),e(t,n,r+3,i+3,o)}});function h(t){return function(e,n,r=n){if(!((n=+n)>=0))throw new RangeError("invalid rx");if(!((r=+r)>=0))throw new RangeError("invalid ry");let{data:i,width:o,height:a}=e;if(!((o=Math.floor(o))>=0))throw new RangeError("invalid width");if(!((a=Math.floor(void 0!==a?a:i.length/o))>=0))throw new RangeError("invalid height");if(!o||!a||!n&&!r)return e;const s=n&&t(n),l=r&&t(r),c=i.slice();return s&&l?(f(s,c,i,o,a),f(s,i,c,o,a),f(s,c,i,o,a),d(l,i,c,o,a),d(l,c,i,o,a),d(l,i,c,o,a)):s?(f(s,i,c,o,a),f(s,c,i,o,a),f(s,i,c,o,a)):l&&(d(l,i,c,o,a),d(l,c,i,o,a),d(l,i,c,o,a)),e}}function f(t,e,n,r,i){for(let o=0,a=r*i;o<a;)t(e,n,o,o+=r,1)}function d(t,e,n,r,i){for(let o=0,a=r*i;o<r;++o)t(e,n,o,o+a,r)}function p(t){const e=Math.floor(t);if(e===t)return function(t){const e=2*t+1;return(n,r,i,o,a)=>{if(!((o-=a)>=i))return;let s=t*r[i];const l=a*t;for(let t=i,e=i+l;t<e;t+=a)s+=r[Math.min(o,t)];for(let t=i,c=o;t<=c;t+=a)s+=r[Math.min(o,t+l)],n[t]=s/e,s-=r[Math.max(i,t-l)]}}(t);const n=t-e,r=2*t+1;return(t,i,o,a,s)=>{if(!((a-=s)>=o))return;let l=e*i[o];const c=s*e,u=c+s;for(let t=o,e=o+c;t<e;t+=s)l+=i[Math.min(a,t)];for(let e=o,h=a;e<=h;e+=s)l+=i[Math.min(a,e+c)],t[e]=(l+n*(i[Math.max(o,e-u)]+i[Math.min(a,e+u)]))/r,l-=i[Math.max(o,e-c)]}}function g(t,e){let n=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&++n;else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(i=+i)>=i&&++n}return n}function _(t){return 0|t.length}function y(t){return!(t>0)}function m(t){return"object"!=typeof t||"length"in t?t:Array.from(t)}function b(t,e){let n,r=0,i=0,o=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(n=e-i,i+=n/++r,o+=n*(e-i));else{let a=-1;for(let s of t)null!=(s=e(s,++a,t))&&(s=+s)>=s&&(n=s-i,i+=n/++r,o+=n*(s-i))}if(r>1)return o/(r-1)}function v(t,e){const n=b(t,e);return n?Math.sqrt(n):n}function x(t,e){let n,r;if(void 0===e)for(const e of t)null!=e&&(void 0===n?e>=e&&(n=r=e):(n>e&&(n=e),r<e&&(r=e)));else{let i=-1;for(let o of t)null!=(o=e(o,++i,t))&&(void 0===n?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)))}return[n,r]}class w{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let n=0;for(let r=0;r<this._n&&r<32;r++){const i=e[r],o=t+i,a=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);a&&(e[n++]=a),t=o}return e[n]=t,this._n=n+1,this}valueOf(){const t=this._partials;let e,n,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(e=o,n=t[--i],o=e+n,r=n-(o-e),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(n=2*r,e=o+n,n==e-o&&(o=e))}return o}}class E extends Map{constructor(t,e=k){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(T(this,t))}has(t){return super.has(T(this,t))}set(t,e){return super.set(S(this,t),e)}delete(t){return super.delete(C(this,t))}}class A extends Set{constructor(t,e=k){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const e of t)this.add(e)}has(t){return super.has(T(this,t))}add(t){return super.add(S(this,t))}delete(t){return super.delete(C(this,t))}}function T({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function S({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function C({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function k(t){return null!==t&&"object"==typeof t?t.valueOf():t}function M(t){return t}function R(t,...e){return V(t,M,M,e)}function O(t,...e){return V(t,Array.from,M,e)}function N(t,e){for(let n=1,r=e.length;n<r;++n)t=t.flatMap(t=>t.pop().map(([e,n])=>[...t,e,n]));return t}function I(t,e,...n){return V(t,M,e,n)}function L(t,e,...n){return V(t,Array.from,e,n)}function P(t){if(1!==t.length)throw new Error("duplicate key");return t[0]}function V(t,e,n,r){return function t(i,o){if(o>=r.length)return n(i);const a=new E,s=r[o++];let l=-1;for(const t of i){const e=s(t,++l,i),n=a.get(e);n?n.push(t):a.set(e,[t])}for(const[e,n]of a)a.set(e,t(n,o));return e(a)}(t,0)}function D(t,e){return Array.from(e,e=>t[e])}function B(t,...e){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");t=Array.from(t);let[n]=e;if(n&&2!==n.length||e.length>1){const r=Uint32Array.from(t,(t,e)=>e);return e.length>1?(e=e.map(e=>t.map(e)),r.sort((t,n)=>{for(const r of e){const e=F(r[t],r[n]);if(e)return e}})):(n=t.map(n),r.sort((t,e)=>F(n[t],n[e]))),D(t,r)}return t.sort(z(n))}function z(e=t){if(e===t)return F;if("function"!=typeof e)throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||0===r?r:(0===e(n,n))-(0===e(t,t))}}function F(t,e){return(null==t||!(t>=t))-(null==e||!(e>=e))||(t<e?-1:t>e?1:0)}var G=Array.prototype.slice;function j(t){return()=>t}const U=Math.sqrt(50),Y=Math.sqrt(10),H=Math.sqrt(2);function q(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=U?10:o>=Y?5:o>=H?2:1;let s,l,c;return i<0?(c=Math.pow(10,-i)/a,s=Math.round(t*c),l=Math.round(e*c),s/c<t&&++s,l/c>e&&--l,c=-c):(c=Math.pow(10,i)*a,s=Math.round(t/c),l=Math.round(e/c),s*c<t&&++s,l*c>e&&--l),l<s&&.5<=n&&n<2?q(t,e,2*n):[s,l,c]}function W(t,e,n){if(!((n=+n)>0))return[];if((t=+t)===(e=+e))return[t];const r=e<t,[i,o,a]=r?q(e,t,n):q(t,e,n);if(!(o>=i))return[];const s=o-i+1,l=new Array(s);if(r)if(a<0)for(let t=0;t<s;++t)l[t]=(o-t)/-a;else for(let t=0;t<s;++t)l[t]=(o-t)*a;else if(a<0)for(let t=0;t<s;++t)l[t]=(i+t)/-a;else for(let t=0;t<s;++t)l[t]=(i+t)*a;return l}function $(t,e,n){return q(t=+t,e=+e,n=+n)[2]}function X(t,e,n){n=+n;const r=(e=+e)<(t=+t),i=r?$(e,t,n):$(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}function K(t,e,n){let r;for(;;){const i=$(t,e,n);if(i===r||0===i||!isFinite(i))return[t,e];i>0?(t=Math.floor(t/i)*i,e=Math.ceil(e/i)*i):i<0&&(t=Math.ceil(t*i)/i,e=Math.floor(e*i)/i),r=i}}function Z(t){return Math.max(1,Math.ceil(Math.log(g(t))/Math.LN2)+1)}function J(){var t=M,e=x,n=Z;function r(r){Array.isArray(r)||(r=Array.from(r));var i,o,s,l=r.length,c=new Array(l);for(i=0;i<l;++i)c[i]=t(r[i],i,r);var u=e(c),h=u[0],f=u[1],d=n(c,h,f);if(!Array.isArray(d)){const t=f,n=+d;if(e===x&&([h,f]=K(h,f,n)),(d=W(h,f,n))[0]<=h&&(s=$(h,f,n)),d[d.length-1]>=f)if(t>=f&&e===x){const t=$(h,f,n);isFinite(t)&&(t>0?f=(Math.floor(f/t)+1)*t:t<0&&(f=(Math.ceil(f*-t)+1)/-t))}else d.pop()}for(var p=d.length,g=0,_=p;d[g]<=h;)++g;for(;d[_-1]>f;)--_;(g||_<p)&&(d=d.slice(g,_),p=_-g);var y,m=new Array(p+1);for(i=0;i<=p;++i)(y=m[i]=[]).x0=i>0?d[i-1]:h,y.x1=i<p?d[i]:f;if(isFinite(s)){if(s>0)for(i=0;i<l;++i)null!=(o=c[i])&&h<=o&&o<=f&&m[Math.min(p,Math.floor((o-h)/s))].push(r[i]);else if(s<0)for(i=0;i<l;++i)if(null!=(o=c[i])&&h<=o&&o<=f){const t=Math.floor((h-o)*s);m[Math.min(p,t+(d[t]<=o))].push(r[i])}}else for(i=0;i<l;++i)null!=(o=c[i])&&h<=o&&o<=f&&m[a(d,o,0,p)].push(r[i]);return m}return r.value=function(e){return arguments.length?(t="function"==typeof e?e:j(e),r):t},r.domain=function(t){return arguments.length?(e="function"==typeof t?t:j([t[0],t[1]]),r):e},r.thresholds=function(t){return arguments.length?(n="function"==typeof t?t:j(Array.isArray(t)?G.call(t):t),r):n},r}function Q(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n<e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n<i||void 0===n&&i>=i)&&(n=i)}return n}function tt(t,e){let n,r=-1,i=-1;if(void 0===e)for(const e of t)++i,null!=e&&(n<e||void 0===n&&e>=e)&&(n=e,r=i);else for(let o of t)null!=(o=e(o,++i,t))&&(n<o||void 0===n&&o>=o)&&(n=o,r=i);return r}function et(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function nt(t,e){let n,r=-1,i=-1;if(void 0===e)for(const e of t)++i,null!=e&&(n>e||void 0===n&&e>=e)&&(n=e,r=i);else for(let o of t)null!=(o=e(o,++i,t))&&(n>o||void 0===n&&o>=o)&&(n=o,r=i);return r}function rt(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=void 0===i?F:z(i);r>n;){if(r-n>600){const o=r-n+1,a=e-n+1,s=Math.log(o),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1);rt(t,e,Math.max(n,Math.floor(e-a*l/o+c)),Math.min(r,Math.floor(e+(o-a)*l/o+c)),i)}const o=t[e];let a=n,s=r;for(it(t,n,e),i(t[r],o)>0&&it(t,n,r);a<s;){for(it(t,a,s),++a,--s;i(t[a],o)<0;)++a;for(;i(t[s],o)>0;)--s}0===i(t[n],o)?it(t,n,s):(++s,it(t,s,r)),s<=e&&(n=s+1),e<=s&&(r=s-1)}return t}function it(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function ot(e,n=t){let r,i=!1;if(1===n.length){let o;for(const a of e){const e=n(a);(i?t(e,o)>0:0===t(e,e))&&(r=a,o=e,i=!0)}}else for(const t of e)(i?n(t,r)>0:0===n(t,t))&&(r=t,i=!0);return r}function at(t,e,n){if(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}}(t,n)),(r=t.length)&&!isNaN(e=+e)){if(e<=0||r<2)return et(t);if(e>=1)return Q(t);var r,i=(r-1)*e,o=Math.floor(i),a=Q(rt(t,o).subarray(0,o+1));return a+(et(t.subarray(o+1))-a)*(i-o)}}function st(t,e,n=i){if((r=t.length)&&!isNaN(e=+e)){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,o=(r-1)*e,a=Math.floor(o),s=+n(t[a],a,t);return s+(+n(t[a+1],a+1,t)-s)*(o-a)}}function lt(t,e,n=i){if(!isNaN(e=+e)){if(r=Float64Array.from(t,(e,r)=>i(n(t[r],r,t))),e<=0)return nt(r);if(e>=1)return tt(r);var r,o=Uint32Array.from(t,(t,e)=>e),a=r.length-1,s=Math.floor(a*e);return rt(o,s,0,a,(t,e)=>F(r[t],r[e])),(s=ot(o.subarray(0,s+1),t=>r[t]))>=0?s:-1}}function ct(t,e){let n=0,r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++n,r+=e);else{let i=-1;for(let o of t)null!=(o=e(o,++i,t))&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n}function ut(t,e){return at(t,.5,e)}function ht(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}function ft(t,e){return[t,e]}function dt(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),o=new Array(i);++r<i;)o[r]=t+r*n;return o}function pt(e,n=t){if(1===n.length)return nt(e,n);let r,i=-1,o=-1;for(const t of e)++o,(i<0?0===n(t,t):n(t,r)<0)&&(r=t,i=o);return i}var gt=_t(Math.random);function _t(t){return function(e,n=0,r=e.length){let i=r-(n=+n);for(;i;){const r=t()*i--|0,o=e[i+n];e[i+n]=e[r+n],e[r+n]=o}return e}}function yt(t,e){let n=0;if(void 0===e)for(let e of t)(e=+e)&&(n+=e);else{let r=-1;for(let i of t)(i=+e(i,++r,t))&&(n+=i)}return n}function mt(t){if(!(i=t.length))return[];for(var e=-1,n=et(t,bt),r=new Array(n);++e<n;)for(var i,o=-1,a=r[e]=new Array(i);++o<i;)a[o]=t[o][e];return r}function bt(t){return t.length}function vt(t){return t instanceof A?t:new A(t)}function xt(t,e){const n=t[Symbol.iterator](),r=new Set;for(const t of e){const e=wt(t);if(r.has(e))continue;let i,o;for(;({value:i,done:o}=n.next());){if(o)return!1;const t=wt(i);if(r.add(t),Object.is(e,t))break}}return!0}function wt(t){return null!==t&&"object"==typeof t?t.valueOf():t}function Et(t){return t}var At=1e-6;function Tt(t){return"translate("+t+",0)"}function St(t){return"translate(0,"+t+")"}function Ct(t){return e=>+t(e)}function kt(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function Mt(){return!this.__axis}function Rt(t,e){var n=[],r=null,i=null,o=6,a=6,s=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=1===t||4===t?-1:1,u=4===t||2===t?"x":"y",h=1===t||3===t?Tt:St;function f(f){var d=null==r?e.ticks?e.ticks.apply(e,n):e.domain():r,p=null==i?e.tickFormat?e.tickFormat.apply(e,n):Et:i,g=Math.max(o,0)+s,_=e.range(),y=+_[0]+l,m=+_[_.length-1]+l,b=(e.bandwidth?kt:Ct)(e.copy(),l),v=f.selection?f.selection():f,x=v.selectAll(".domain").data([null]),w=v.selectAll(".tick").data(d,e).order(),E=w.exit(),A=w.enter().append("g").attr("class","tick"),T=w.select("line"),S=w.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),w=w.merge(A),T=T.merge(A.append("line").attr("stroke","currentColor").attr(u+"2",c*o)),S=S.merge(A.append("text").attr("fill","currentColor").attr(u,c*g).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),f!==v&&(x=x.transition(f),w=w.transition(f),T=T.transition(f),S=S.transition(f),E=E.transition(f).attr("opacity",At).attr("transform",function(t){return isFinite(t=b(t))?h(t+l):this.getAttribute("transform")}),A.attr("opacity",At).attr("transform",function(t){var e=this.parentNode.__axis;return h((e&&isFinite(e=e(t))?e:b(t))+l)})),E.remove(),x.attr("d",4===t||2===t?a?"M"+c*a+","+y+"H"+l+"V"+m+"H"+c*a:"M"+l+","+y+"V"+m:a?"M"+y+","+c*a+"V"+l+"H"+m+"V"+c*a:"M"+y+","+l+"H"+m),w.attr("opacity",1).attr("transform",function(t){return h(b(t)+l)}),T.attr(u+"2",c*o),S.attr(u,c*g).text(p),v.filter(Mt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),v.each(function(){this.__axis=b})}return f.scale=function(t){return arguments.length?(e=t,f):e},f.ticks=function(){return n=Array.from(arguments),f},f.tickArguments=function(t){return arguments.length?(n=null==t?[]:Array.from(t),f):n.slice()},f.tickValues=function(t){return arguments.length?(r=null==t?null:Array.from(t),f):r&&r.slice()},f.tickFormat=function(t){return arguments.length?(i=t,f):i},f.tickSize=function(t){return arguments.length?(o=a=+t,f):o},f.tickSizeInner=function(t){return arguments.length?(o=+t,f):o},f.tickSizeOuter=function(t){return arguments.length?(a=+t,f):a},f.tickPadding=function(t){return arguments.length?(s=+t,f):s},f.offset=function(t){return arguments.length?(l=+t,f):l},f}var Ot={value:()=>{}};function Nt(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new It(r)}function It(t){this._=t}function Lt(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Pt(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Ot,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}It.prototype=Nt.prototype={constructor:It,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)i[n]=Pt(i[n],t.name,e);else if(null==e)for(n in i)i[n]=Pt(i[n],t.name,null);return this}for(;++a<s;)if((n=(t=o[a]).type)&&(n=Lt(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new It(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var Vt="http://www.w3.org/1999/xhtml",Dt={svg:"http://www.w3.org/2000/svg",xhtml:Vt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Bt(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),Dt.hasOwnProperty(e)?{space:Dt[e],local:t}:t}function zt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Vt&&e.documentElement.namespaceURI===Vt?e.createElement(t):e.createElementNS(n,t)}}function Ft(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Gt(t){var e=Bt(t);return(e.local?Ft:zt)(e)}function jt(){}function Ut(t){return null==t?jt:function(){return this.querySelector(t)}}function Yt(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function Ht(){return[]}function qt(t){return null==t?Ht:function(){return this.querySelectorAll(t)}}function Wt(t){return function(){return this.matches(t)}}function $t(t){return function(e){return e.matches(t)}}var Xt=Array.prototype.find;function Kt(){return this.firstElementChild}var Zt=Array.prototype.filter;function Jt(){return Array.from(this.children)}function Qt(t){return new Array(t.length)}function te(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function ee(t,e,n,r,i,o){for(var a,s=0,l=e.length,c=o.length;s<c;++s)(a=e[s])?(a.__data__=o[s],r[s]=a):n[s]=new te(t,o[s]);for(;s<l;++s)(a=e[s])&&(i[s]=a)}function ne(t,e,n,r,i,o,a){var s,l,c,u=new Map,h=e.length,f=o.length,d=new Array(h);for(s=0;s<h;++s)(l=e[s])&&(d[s]=c=a.call(l,l.__data__,s,e)+"",u.has(c)?i[s]=l:u.set(c,l));for(s=0;s<f;++s)c=a.call(t,o[s],s,o)+"",(l=u.get(c))?(r[s]=l,l.__data__=o[s],u.delete(c)):n[s]=new te(t,o[s]);for(s=0;s<h;++s)(l=e[s])&&u.get(d[s])===l&&(i[s]=l)}function re(t){return t.__data__}function ie(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function oe(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ae(t){return function(){this.removeAttribute(t)}}function se(t){return function(){this.removeAttributeNS(t.space,t.local)}}function le(t,e){return function(){this.setAttribute(t,e)}}function ce(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function ue(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function he(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function fe(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function de(t){return function(){this.style.removeProperty(t)}}function pe(t,e,n){return function(){this.style.setProperty(t,e,n)}}function ge(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function _e(t,e){return t.style.getPropertyValue(e)||fe(t).getComputedStyle(t,null).getPropertyValue(e)}function ye(t){return function(){delete this[t]}}function me(t,e){return function(){this[t]=e}}function be(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function ve(t){return t.trim().split(/^|\s+/)}function xe(t){return t.classList||new we(t)}function we(t){this._node=t,this._names=ve(t.getAttribute("class")||"")}function Ee(t,e){for(var n=xe(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function Ae(t,e){for(var n=xe(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function Te(t){return function(){Ee(this,t)}}function Se(t){return function(){Ae(this,t)}}function Ce(t,e){return function(){(e.apply(this,arguments)?Ee:Ae)(this,t)}}function ke(){this.textContent=""}function Me(t){return function(){this.textContent=t}}function Re(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Oe(){this.innerHTML=""}function Ne(t){return function(){this.innerHTML=t}}function Ie(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Le(){this.nextSibling&&this.parentNode.appendChild(this)}function Pe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ve(){return null}function De(){var t=this.parentNode;t&&t.removeChild(this)}function Be(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ze(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Fe(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r<o;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?e.length=i:delete this.__on}}}function Ge(t,e,n){return function(){var r,i=this.__on,o=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var a=0,s=i.length;a<s;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),void(r.value=e);this.addEventListener(t.type,o,n),r={type:t.type,name:t.name,value:e,listener:o,options:n},i?i.push(r):this.__on=[r]}}function je(t,e,n){var r=fe(t),i=r.CustomEvent;"function"==typeof i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Ue(t,e){return function(){return je(this,t,e)}}function Ye(t,e){return function(){return je(this,t,e.apply(this,arguments))}}te.prototype={constructor:te,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},we.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var He=[null];function qe(t,e){this._groups=t,this._parents=e}function We(){return new qe([[document.documentElement]],He)}function $e(t){return"string"==typeof t?new qe([[document.querySelector(t)]],[document.documentElement]):new qe([[t]],He)}qe.prototype=We.prototype={constructor:qe,select:function(t){"function"!=typeof t&&(t=Ut(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a,s=e[i],l=s.length,c=r[i]=new Array(l),u=0;u<l;++u)(o=s[u])&&(a=t.call(o,o.__data__,u,s))&&("__data__"in o&&(a.__data__=o.__data__),c[u]=a);return new qe(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return Yt(t.apply(this,arguments))}}(t):qt(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var a,s=e[o],l=s.length,c=0;c<l;++c)(a=s[c])&&(r.push(t.call(a,a.__data__,c,s)),i.push(a));return new qe(r,i)},selectChild:function(t){return this.select(null==t?Kt:function(t){return function(){return Xt.call(this.children,t)}}("function"==typeof t?t:$t(t)))},selectChildren:function(t){return this.selectAll(null==t?Jt:function(t){return function(){return Zt.call(this.children,t)}}("function"==typeof t?t:$t(t)))},filter:function(t){"function"!=typeof t&&(t=Wt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,l=r[i]=[],c=0;c<s;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&l.push(o);return new qe(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,re);var n=e?ne:ee,r=this._parents,i=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var o=i.length,a=new Array(o),s=new Array(o),l=new Array(o),c=0;c<o;++c){var u=r[c],h=i[c],f=h.length,d=ie(t.call(u,u&&u.__data__,c,r)),p=d.length,g=s[c]=new Array(p),_=a[c]=new Array(p);n(u,h,g,_,l[c]=new Array(f),d,e);for(var y,m,b=0,v=0;b<p;++b)if(y=g[b]){for(b>=v&&(v=b+1);!(m=_[v])&&++v<p;);y._next=m||null}}return(a=new qe(a,r))._enter=s,a._exit=l,a},enter:function(){return new qe(this._enter||this._groups.map(Qt),this._parents)},exit:function(){return new qe(this._exit||this._groups.map(Qt),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==n?o.remove():n(o),r&&i?r.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),l=0;l<a;++l)for(var c,u=n[l],h=r[l],f=u.length,d=s[l]=new Array(f),p=0;p<f;++p)(c=u[p]||h[p])&&(d[p]=c);for(;l<i;++l)s[l]=n[l];return new qe(s,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=oe);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a,s=n[o],l=s.length,c=i[o]=new Array(l),u=0;u<l;++u)(a=s[u])&&(c[u]=a);c.sort(e)}return new qe(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,o=e[n],a=0,s=o.length;a<s;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,e){var n=Bt(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?se:ae:"function"==typeof e?n.local?he:ue:n.local?ce:le)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?de:"function"==typeof e?ge:pe)(t,e,null==n?"":n)):_e(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?ye:"function"==typeof e?be:me)(t,e)):this.node()[t]},classed:function(t,e){var n=ve(t+"");if(arguments.length<2){for(var r=xe(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?Ce:e?Te:Se)(n,e))},text:function(t){return arguments.length?this.each(null==t?ke:("function"==typeof t?Re:Me)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Oe:("function"==typeof t?Ie:Ne)(t)):this.node().innerHTML},raise:function(){return this.each(Le)},lower:function(){return this.each(Pe)},append:function(t){var e="function"==typeof t?t:Gt(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:Gt(t),r=null==e?Ve:"function"==typeof e?e:Ut(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(De)},clone:function(t){return this.select(t?ze:Be)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,o=function(t){return t.trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}(t+""),a=o.length;if(!(arguments.length<2)){for(s=e?Ge:Fe,r=0;r<a;++r)this.each(s(o[r],e,n));return this}var s=this.node().__on;if(s)for(var l,c=0,u=s.length;c<u;++c)for(r=0,l=s[c];r<a;++r)if((i=o[r]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?Ye:Ue)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,i=t[e],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};var Xe=0;function Ke(){return new Ze}function Ze(){this._="@"+(++Xe).toString(36)}function Je(t){let e;for(;e=t.sourceEvent;)t=e;return t}function Qe(t,e){if(t=Je(t),void 0===e&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(e.getScreenCTM().inverse())).x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}Ze.prototype=Ke.prototype={constructor:Ze,get:function(t){for(var e=this._;!(e in t);)if(!(t=t.parentNode))return;return t[e]},set:function(t,e){return t[this._]=e},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};const tn={passive:!1},en={capture:!0,passive:!1};function nn(t){t.stopImmediatePropagation()}function rn(t){t.preventDefault(),t.stopImmediatePropagation()}function on(t){var e=t.document.documentElement,n=$e(t).on("dragstart.drag",rn,en);"onselectstart"in e?n.on("selectstart.drag",rn,en):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function an(t,e){var n=t.document.documentElement,r=$e(t).on("dragstart.drag",null);e&&(r.on("click.drag",rn,en),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var sn=t=>()=>t;function ln(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}function cn(t){return!t.ctrlKey&&!t.button}function un(){return this.parentNode}function hn(t,e){return null==e?{x:t.x,y:t.y}:e}function fn(){return navigator.maxTouchPoints||"ontouchstart"in this}function dn(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function pn(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function gn(){}ln.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var _n=.7,yn=1/_n,mn="\\s*([+-]?\\d+)\\s*",bn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",vn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xn=/^#([0-9a-f]{3,8})$/,wn=new RegExp(`^rgb\\(${mn},${mn},${mn}\\)$`),En=new RegExp(`^rgb\\(${vn},${vn},${vn}\\)$`),An=new RegExp(`^rgba\\(${mn},${mn},${mn},${bn}\\)$`),Tn=new RegExp(`^rgba\\(${vn},${vn},${vn},${bn}\\)$`),Sn=new RegExp(`^hsl\\(${bn},${vn},${vn}\\)$`),Cn=new RegExp(`^hsla\\(${bn},${vn},${vn},${bn}\\)$`),kn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Mn(){return this.rgb().formatHex()}function Rn(){return this.rgb().formatRgb()}function On(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=xn.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Nn(e):3===n?new Vn(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?In(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?In(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=wn.exec(t))?new Vn(e[1],e[2],e[3],1):(e=En.exec(t))?new Vn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=An.exec(t))?In(e[1],e[2],e[3],e[4]):(e=Tn.exec(t))?In(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Sn.exec(t))?jn(e[1],e[2]/100,e[3]/100,1):(e=Cn.exec(t))?jn(e[1],e[2]/100,e[3]/100,e[4]):kn.hasOwnProperty(t)?Nn(kn[t]):"transparent"===t?new Vn(NaN,NaN,NaN,0):null}function Nn(t){return new Vn(t>>16&255,t>>8&255,255&t,1)}function In(t,e,n,r){return r<=0&&(t=e=n=NaN),new Vn(t,e,n,r)}function Ln(t){return t instanceof gn||(t=On(t)),t?new Vn((t=t.rgb()).r,t.g,t.b,t.opacity):new Vn}function Pn(t,e,n,r){return 1===arguments.length?Ln(t):new Vn(t,e,n,null==r?1:r)}function Vn(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Dn(){return`#${Gn(this.r)}${Gn(this.g)}${Gn(this.b)}`}function Bn(){const t=zn(this.opacity);return`${1===t?"rgb(":"rgba("}${Fn(this.r)}, ${Fn(this.g)}, ${Fn(this.b)}${1===t?")":`, ${t})`}`}function zn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Fn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Gn(t){return((t=Fn(t))<16?"0":"")+t.toString(16)}function jn(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Hn(t,e,n,r)}function Un(t){if(t instanceof Hn)return new Hn(t.h,t.s,t.l,t.opacity);if(t instanceof gn||(t=On(t)),!t)return new Hn;if(t instanceof Hn)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n<r):n===o?(r-e)/s+2:(e-n)/s+4,s/=l<.5?o+i:2-o-i,a*=60):s=l>0&&l<1?0:a,new Hn(a,s,l,t.opacity)}function Yn(t,e,n,r){return 1===arguments.length?Un(t):new Hn(t,e,n,null==r?1:r)}function Hn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function qn(t){return(t=(t||0)%360)<0?t+360:t}function Wn(t){return Math.max(0,Math.min(1,t||0))}function $n(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}dn(gn,On,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Mn,formatHex:Mn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Un(this).formatHsl()},formatRgb:Rn,toString:Rn}),dn(Vn,Pn,pn(gn,{brighter(t){return t=null==t?yn:Math.pow(yn,t),new Vn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?_n:Math.pow(_n,t),new Vn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Vn(Fn(this.r),Fn(this.g),Fn(this.b),zn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Dn,formatHex:Dn,formatHex8:function(){return`#${Gn(this.r)}${Gn(this.g)}${Gn(this.b)}${Gn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Bn,toString:Bn})),dn(Hn,Yn,pn(gn,{brighter(t){return t=null==t?yn:Math.pow(yn,t),new Hn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?_n:Math.pow(_n,t),new Hn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Vn($n(t>=240?t-240:t+120,i,r),$n(t,i,r),$n(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Hn(qn(this.h),Wn(this.s),Wn(this.l),zn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=zn(this.opacity);return`${1===t?"hsl(":"hsla("}${qn(this.h)}, ${100*Wn(this.s)}%, ${100*Wn(this.l)}%${1===t?")":`, ${t})`}`}}));const Xn=Math.PI/180,Kn=180/Math.PI,Zn=.96422,Jn=.82521,Qn=4/29,tr=6/29,er=3*tr*tr,nr=tr*tr*tr;function rr(t){if(t instanceof or)return new or(t.l,t.a,t.b,t.opacity);if(t instanceof fr)return dr(t);t instanceof Vn||(t=Ln(t));var e,n,r=cr(t.r),i=cr(t.g),o=cr(t.b),a=ar((.2225045*r+.7168786*i+.0606169*o)/1);return r===i&&i===o?e=n=a:(e=ar((.4360747*r+.3850649*i+.1430804*o)/Zn),n=ar((.0139322*r+.0971045*i+.7141733*o)/Jn)),new or(116*a-16,500*(e-a),200*(a-n),t.opacity)}function ir(t,e,n,r){return 1===arguments.length?rr(t):new or(t,e,n,null==r?1:r)}function or(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function ar(t){return t>nr?Math.pow(t,1/3):t/er+Qn}function sr(t){return t>tr?t*t*t:er*(t-Qn)}function lr(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function cr(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ur(t){if(t instanceof fr)return new fr(t.h,t.c,t.l,t.opacity);if(t instanceof or||(t=rr(t)),0===t.a&&0===t.b)return new fr(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*Kn;return new fr(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function hr(t,e,n,r){return 1===arguments.length?ur(t):new fr(t,e,n,null==r?1:r)}function fr(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function dr(t){if(isNaN(t.h))return new or(t.l,0,0,t.opacity);var e=t.h*Xn;return new or(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}dn(or,ir,pn(gn,{brighter(t){return new or(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new or(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new Vn(lr(3.1338561*(e=Zn*sr(e))-1.6168667*(t=1*sr(t))-.4906146*(n=Jn*sr(n))),lr(-.9787684*e+1.9161415*t+.033454*n),lr(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),dn(fr,hr,pn(gn,{brighter(t){return new fr(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new fr(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return dr(this).rgb()}}));var pr=-.14861,gr=1.78277,_r=-.29227,yr=-.90649,mr=1.97294,br=mr*yr,vr=mr*gr,xr=gr*_r-yr*pr;function wr(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof Er)return new Er(t.h,t.s,t.l,t.opacity);t instanceof Vn||(t=Ln(t));var e=t.r/255,n=t.g/255,r=t.b/255,i=(xr*r+br*e-vr*n)/(xr+br-vr),o=r-i,a=(mr*(n-i)-_r*o)/yr,s=Math.sqrt(a*a+o*o)/(mr*i*(1-i)),l=s?Math.atan2(a,o)*Kn-120:NaN;return new Er(l<0?l+360:l,s,i,t.opacity)}(t):new Er(t,e,n,null==r?1:r)}function Er(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Ar(t,e,n,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*r+a*i)/6}function Tr(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=r<e-1?t[r+2]:2*o-i;return Ar((n-r/e)*e,a,i,o,s)}}function Sr(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),i=t[(r+e-1)%e],o=t[r%e],a=t[(r+1)%e],s=t[(r+2)%e];return Ar((n-r/e)*e,i,o,a,s)}}dn(Er,wr,pn(gn,{brighter(t){return t=null==t?yn:Math.pow(yn,t),new Er(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?_n:Math.pow(_n,t),new Er(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*Xn,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new Vn(255*(e+n*(pr*r+gr*i)),255*(e+n*(_r*r+yr*i)),255*(e+n*(mr*r)),this.opacity)}}));var Cr=t=>()=>t;function kr(t,e){return function(n){return t+n*e}}function Mr(t,e){var n=e-t;return n?kr(t,n>180||n<-180?n-360*Math.round(n/360):n):Cr(isNaN(t)?e:t)}function Rr(t){return 1===(t=+t)?Or:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Cr(isNaN(e)?n:e)}}function Or(t,e){var n=e-t;return n?kr(t,n):Cr(isNaN(t)?e:t)}var Nr=function t(e){var n=Rr(e);function r(t,e){var r=n((t=Pn(t)).r,(e=Pn(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=Or(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function Ir(t){return function(e){var n,r,i=e.length,o=new Array(i),a=new Array(i),s=new Array(i);for(n=0;n<i;++n)r=Pn(e[n]),o[n]=r.r||0,a[n]=r.g||0,s[n]=r.b||0;return o=t(o),a=t(a),s=t(s),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=s(t),r+""}}}var Lr=Ir(Tr),Pr=Ir(Sr);function Vr(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(o){for(n=0;n<r;++n)i[n]=t[n]*(1-o)+e[n]*o;return i}}function Dr(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Br(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(n=0;n<i;++n)o[n]=Hr(t[n],e[n]);for(;n<r;++n)a[n]=e[n];return function(t){for(n=0;n<i;++n)a[n]=o[n](t);return a}}function zr(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Fr(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Gr(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=Hr(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}var jr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ur=new RegExp(jr.source,"g");function Yr(t,e){var n,r,i,o=jr.lastIndex=Ur.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(n=jr.exec(t))&&(r=Ur.exec(e));)(i=r.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:Fr(n,r)})),o=Ur.lastIndex;return o<e.length&&(i=e.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,r=0;r<e;++r)s[(n=l[r]).i]=n.x(t);return s.join("")})}function Hr(t,e){var n,r=typeof e;return null==e||"boolean"===r?Cr(e):("number"===r?Fr:"string"===r?(n=On(e))?(e=n,Nr):Yr:e instanceof On?Nr:e instanceof Date?zr:Dr(e)?Vr:Array.isArray(e)?Br:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Gr:Fr)(t,e)}function qr(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var Wr,$r=180/Math.PI,Xr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Kr(t,e,n,r,i,o){var a,s,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),t*r<e*n&&(t=-t,e=-e,l=-l,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*$r,skewX:Math.atan(l)*$r,scaleX:a,scaleY:s}}function Zr(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var s=[],l=[];return o=t(o),a=t(a),function(t,r,i,o,a,s){if(t!==i||r!==o){var l=a.push("translate(",null,e,null,n);s.push({i:l-4,x:Fr(t,i)},{i:l-2,x:Fr(r,o)})}else(i||o)&&a.push("translate("+i+e+o+n)}(o.translateX,o.translateY,a.translateX,a.translateY,s,l),function(t,e,n,o){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Fr(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,l),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Fr(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,l),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Fr(t,n)},{i:s-2,x:Fr(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,l),o=a=null,function(t){for(var e,n=-1,r=l.length;++n<r;)s[(e=l[n]).i]=e.x(t);return s.join("")}}}var Jr=Zr(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Xr:Kr(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),Qr=Zr(function(t){return null==t?Xr:(Wr||(Wr=document.createElementNS("http://www.w3.org/2000/svg","g")),Wr.setAttribute("transform",t),(t=Wr.transform.baseVal.consolidate())?Kr((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Xr)},", ",")",")");function ti(t){return((t=Math.exp(t))+1/t)/2}var ei=function t(e,n,r){function i(t,i){var o,a,s=t[0],l=t[1],c=t[2],u=i[0],h=i[1],f=i[2],d=u-s,p=h-l,g=d*d+p*p;if(g<1e-12)a=Math.log(f/c)/e,o=function(t){return[s+t*d,l+t*p,c*Math.exp(e*t*a)]};else{var _=Math.sqrt(g),y=(f*f-c*c+r*g)/(2*c*n*_),m=(f*f-c*c-r*g)/(2*f*n*_),b=Math.log(Math.sqrt(y*y+1)-y),v=Math.log(Math.sqrt(m*m+1)-m);a=(v-b)/e,o=function(t){var r=t*a,i=ti(b),o=c/(n*_)*(i*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(e*r+b)-function(t){return((t=Math.exp(t))-1/t)/2}(b));return[s+o*d,l+o*p,c*i/ti(e*r+b)]}}return o.duration=1e3*a*e/Math.SQRT2,o}return i.rho=function(e){var n=Math.max(.001,+e),r=n*n;return t(n,r,r*r)},i}(Math.SQRT2,2,4);function ni(t){return function(e,n){var r=t((e=Yn(e)).h,(n=Yn(n)).h),i=Or(e.s,n.s),o=Or(e.l,n.l),a=Or(e.opacity,n.opacity);return function(t){return e.h=r(t),e.s=i(t),e.l=o(t),e.opacity=a(t),e+""}}}var ri=ni(Mr),ii=ni(Or);function oi(t){return function(e,n){var r=t((e=hr(e)).h,(n=hr(n)).h),i=Or(e.c,n.c),o=Or(e.l,n.l),a=Or(e.opacity,n.opacity);return function(t){return e.h=r(t),e.c=i(t),e.l=o(t),e.opacity=a(t),e+""}}}var ai=oi(Mr),si=oi(Or);function li(t){return function e(n){function r(e,r){var i=t((e=wr(e)).h,(r=wr(r)).h),o=Or(e.s,r.s),a=Or(e.l,r.l),s=Or(e.opacity,r.opacity);return function(t){return e.h=i(t),e.s=o(t),e.l=a(Math.pow(t,n)),e.opacity=s(t),e+""}}return n=+n,r.gamma=e,r}(1)}var ci=li(Mr),ui=li(Or);function hi(t,e){void 0===e&&(e=t,t=Hr);for(var n=0,r=e.length-1,i=e[0],o=new Array(r<0?0:r);n<r;)o[n]=t(i,i=e[++n]);return function(t){var e=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return o[e](t-e)}}var fi,di,pi=0,gi=0,_i=0,yi=0,mi=0,bi=0,vi="object"==typeof performance&&performance.now?performance:Date,xi="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function wi(){return mi||(xi(Ei),mi=vi.now()+bi)}function Ei(){mi=0}function Ai(){this._call=this._time=this._next=null}function Ti(t,e,n){var r=new Ai;return r.restart(t,e,n),r}function Si(){wi(),++pi;for(var t,e=fi;e;)(t=mi-e._time)>=0&&e._call.call(void 0,t),e=e._next;--pi}function Ci(){mi=(yi=vi.now())+bi,pi=gi=0;try{Si()}finally{pi=0,function(){var t,e,n=fi,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:fi=e);di=t,Mi(r)}(),mi=0}}function ki(){var t=vi.now(),e=t-yi;e>1e3&&(bi-=e,yi=t)}function Mi(t){pi||(gi&&(gi=clearTimeout(gi)),t-mi>24?(t<1/0&&(gi=setTimeout(Ci,t-vi.now()-bi)),_i&&(_i=clearInterval(_i))):(_i||(yi=vi.now(),_i=setInterval(ki,1e3)),pi=1,xi(Ci)))}function Ri(t,e,n){var r=new Ai;return e=null==e?0:+e,r.restart(n=>{r.stop(),t(n+e)},e,n),r}Ai.prototype=Ti.prototype={constructor:Ai,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?wi():+n)+(null==e?0:+e),this._next||di===this||(di?di._next=this:fi=this,di=this),this._call=t,this._time=n,Mi()},stop:function(){this._call&&(this._call=null,this._time=1/0,Mi())}};var Oi=Nt("start","end","cancel","interrupt"),Ni=[];function Ii(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(t){n.state=1,n.timer.restart(a,n.delay,n.time),n.delay<=t&&a(t-n.delay)}function a(o){var c,u,h,f;if(1!==n.state)return l();for(c in i)if((f=i[c]).name===n.name){if(3===f.state)return Ri(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[c]):+c<e&&(f.state=6,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete i[c])}if(Ri(function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(o))}),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(h=n.tween.length),c=0,u=-1;c<h;++c)(f=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(r[++u]=f);r.length=u+1}}function s(e){for(var i=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(l),n.state=5,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){for(var r in n.state=6,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=Ti(o,0,n.time)}(t,n,{name:e,index:r,group:i,on:Oi,tween:Ni,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:0})}function Li(t,e){var n=Vi(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function Pi(t,e){var n=Vi(t,e);if(n.state>3)throw new Error("too late; already running");return n}function Vi(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Di(t,e){var n,r,i,o=t.__transition,a=!0;if(o){for(i in e=null==e?null:e+"",o)(n=o[i]).name===e?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):a=!1;a&&delete t.__transition}}function Bi(t,e){var n,r;return function(){var i=Pi(this,t),o=i.tween;if(o!==n)for(var a=0,s=(r=n=o).length;a<s;++a)if(r[a].name===e){(r=r.slice()).splice(a,1);break}i.tween=r}}function zi(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var o=Pi(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:e,value:n},l=0,c=i.length;l<c;++l)if(i[l].name===e){i[l]=s;break}l===c&&i.push(s)}o.tween=i}}function Fi(t,e,n){var r=t._id;return t.each(function(){var t=Pi(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return Vi(t,r).value[e]}}function Gi(t,e){var n;return("number"==typeof e?Fr:e instanceof On?Nr:(n=On(e))?(e=n,Nr):Yr)(t,e)}function ji(t){return function(){this.removeAttribute(t)}}function Ui(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Yi(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=e(r=a,n)}}function Hi(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=e(r=a,n)}}function qi(t,e,n){var r,i,o;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttribute(t))===(s=l+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,l));this.removeAttribute(t)}}function Wi(t,e,n){var r,i,o;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttributeNS(t.space,t.local))===(s=l+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,l));this.removeAttributeNS(t.space,t.local)}}function $i(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,i)),n}return i._value=e,i}function Xi(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,i)),n}return i._value=e,i}function Ki(t,e){return function(){Li(this,t).delay=+e.apply(this,arguments)}}function Zi(t,e){return e=+e,function(){Li(this,t).delay=e}}function Ji(t,e){return function(){Pi(this,t).duration=+e.apply(this,arguments)}}function Qi(t,e){return e=+e,function(){Pi(this,t).duration=e}}var to=We.prototype.constructor;function eo(t){return function(){this.style.removeProperty(t)}}var no=0;function ro(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function io(t){return We().transition(t)}function oo(){return++no}var ao=We.prototype;ro.prototype=io.prototype={constructor:ro,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Ut(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s,l,c=r[a],u=c.length,h=o[a]=new Array(u),f=0;f<u;++f)(s=c[f])&&(l=t.call(s,s.__data__,f,c))&&("__data__"in s&&(l.__data__=s.__data__),h[f]=l,Ii(h[f],e,n,f,h,Vi(s,n)));return new ro(o,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=qt(t));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var l,c=r[s],u=c.length,h=0;h<u;++h)if(l=c[h]){for(var f,d=t.call(l,l.__data__,h,c),p=Vi(l,n),g=0,_=d.length;g<_;++g)(f=d[g])&&Ii(f,e,n,g,d,p);o.push(d),a.push(l)}return new ro(o,a,e,n)},selectChild:ao.selectChild,selectChildren:ao.selectChildren,filter:function(t){"function"!=typeof t&&(t=Wt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,l=r[i]=[],c=0;c<s;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&l.push(o);return new ro(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var l,c=e[s],u=n[s],h=c.length,f=a[s]=new Array(h),d=0;d<h;++d)(l=c[d]||u[d])&&(f[d]=l);for(;s<r;++s)a[s]=e[s];return new ro(a,this._parents,this._name,this._id)},selection:function(){return new to(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=oo(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],l=s.length,c=0;c<l;++c)if(a=s[c]){var u=Vi(a,e);Ii(a,t,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new ro(r,this._parents,t,n)},call:ao.call,nodes:ao.nodes,node:ao.node,size:ao.size,empty:ao.empty,each:ao.each,on:function(t,e){var n=this._id;return arguments.length<2?Vi(this.node(),n).on.on(t):this.each(function(t,e,n){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t})}(e)?Li:Pi;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}(n,t,e))},attr:function(t,e){var n=Bt(t),r="transform"===n?Qr:Gi;return this.attrTween(t,"function"==typeof e?(n.local?Wi:qi)(n,r,Fi(this,"attr."+t,e)):null==e?(n.local?Ui:ji)(n):(n.local?Hi:Yi)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=Bt(t);return this.tween(n,(r.local?$i:Xi)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?Jr:Gi;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=_e(this,t),a=(this.style.removeProperty(t),_e(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,eo(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=_e(this,t),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(t),l=s=_e(this,t)),a===l?null:a===r&&l===i?o:(i=l,o=e(r=a,s))}}(t,r,Fi(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,s="end."+a;return function(){var l=Pi(this,t),c=l.on,u=null==l.value[a]?o||(o=eo(e)):void 0;c===n&&i===u||(r=(n=c).copy()).on(s,i=u),l.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var a=_e(this,t);return a===o?null:a===r?i:i=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Fi(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=Vi(this.node(),n).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==e?Bi:zi)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Ki:Zi)(e,t)):Vi(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Ji:Qi)(e,t)):Vi(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){Pi(this,t).ease=e}}(e,t)):Vi(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;Pi(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(o,a){var s={value:a},l={value:function(){0===--i&&o()}};n.each(function(){var n=Pi(this,r),i=n.on;i!==t&&((e=(t=i).copy())._.cancel.push(s),e._.interrupt.push(s),e._.end.push(l)),n.on=e}),0===i&&o()})},[Symbol.iterator]:ao[Symbol.iterator]};function so(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function lo(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var co=function t(e){function n(t){return Math.pow(t,e)}return e=+e,n.exponent=t,n}(3),uo=function t(e){function n(t){return 1-Math.pow(1-t,e)}return e=+e,n.exponent=t,n}(3),ho=function t(e){function n(t){return((t*=2)<=1?Math.pow(t,e):2-Math.pow(2-t,e))/2}return e=+e,n.exponent=t,n}(3),fo=Math.PI,po=fo/2;function go(t){return(1-Math.cos(fo*t))/2}function _o(t){return 1.0009775171065494*(Math.pow(2,-10*t)-.0009765625)}function yo(t){return((t*=2)<=1?_o(1-t):2-_o(t-1))/2}function mo(t){return((t*=2)<=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}var bo=4/11,vo=6/11,xo=8/11,wo=9/11,Eo=10/11,Ao=21/22,To=7.5625;function So(t){return(t=+t)<bo?To*t*t:t<xo?To*(t-=vo)*t+.75:t<Eo?To*(t-=wo)*t+.9375:To*(t-=Ao)*t+.984375}var Co=1.70158,ko=function t(e){function n(t){return(t=+t)*t*(e*(t-1)+t)}return e=+e,n.overshoot=t,n}(Co),Mo=function t(e){function n(t){return--t*t*((t+1)*e+t)+1}return e=+e,n.overshoot=t,n}(Co),Ro=function t(e){function n(t){return((t*=2)<1?t*t*((e+1)*t-e):(t-=2)*t*((e+1)*t+e)+2)/2}return e=+e,n.overshoot=t,n}(Co),Oo=2*Math.PI,No=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=Oo);function i(t){return e*_o(- --t)*Math.sin((r-t)/n)}return i.amplitude=function(e){return t(e,n*Oo)},i.period=function(n){return t(e,n)},i}(1,.3),Io=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=Oo);function i(t){return 1-e*_o(t=+t)*Math.sin((t+r)/n)}return i.amplitude=function(e){return t(e,n*Oo)},i.period=function(n){return t(e,n)},i}(1,.3),Lo=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=Oo);function i(t){return((t=2*t-1)<0?e*_o(-t)*Math.sin((r-t)/n):2-e*_o(t)*Math.sin((r+t)/n))/2}return i.amplitude=function(e){return t(e,n*Oo)},i.period=function(n){return t(e,n)},i}(1,.3),Po={time:null,delay:0,duration:250,ease:lo};function Vo(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}We.prototype.interrupt=function(t){return this.each(function(){Di(this,t)})},We.prototype.transition=function(t){var e,n;t instanceof ro?(e=t._id,t=t._name):(e=oo(),(n=Po).time=wi(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],l=s.length,c=0;c<l;++c)(a=s[c])&&Ii(a,t,e,c,s,n||Vo(a,e));return new ro(r,this._parents,t,e)};var Do=[null];var Bo=t=>()=>t;function zo(t,{sourceEvent:e,target:n,selection:r,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function Fo(t){t.preventDefault(),t.stopImmediatePropagation()}var Go={name:"drag"},jo={name:"space"},Uo={name:"handle"},Yo={name:"center"};const{abs:Ho,max:qo,min:Wo}=Math;function $o(t){return[+t[0],+t[1]]}function Xo(t){return[$o(t[0]),$o(t[1])]}var Ko={name:"x",handles:["w","e"].map(ia),input:function(t,e){return null==t?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},Zo={name:"y",handles:["n","s"].map(ia),input:function(t,e){return null==t?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},Jo={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(ia),input:function(t){return null==t?null:Xo(t)},output:function(t){return t}},Qo={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},ta={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},ea={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},na={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},ra={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function ia(t){return{type:t}}function oa(t){return!t.ctrlKey&&!t.button}function aa(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function sa(){return navigator.maxTouchPoints||"ontouchstart"in this}function la(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function ca(t){var e,n=aa,r=oa,i=sa,o=!0,a=Nt("start","brush","end"),s=6;function l(e){var n=e.property("__brush",g).selectAll(".overlay").data([ia("overlay")]);n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Qo.overlay).merge(n).each(function(){var t=la(this).extent;$e(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])}),e.selectAll(".selection").data([ia("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Qo.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=e.selectAll(".handle").data(t.handles,function(t){return t.type});r.exit().remove(),r.enter().append("rect").attr("class",function(t){return"handle handle--"+t.type}).attr("cursor",function(t){return Qo[t.type]}),e.each(c).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",f).filter(i).on("touchstart.brush",f).on("touchmove.brush",d).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function c(){var t=$e(this),e=la(this).selection;e?(t.selectAll(".selection").style("display",null).attr("x",e[0][0]).attr("y",e[0][1]).attr("width",e[1][0]-e[0][0]).attr("height",e[1][1]-e[0][1]),t.selectAll(".handle").style("display",null).attr("x",function(t){return"e"===t.type[t.type.length-1]?e[1][0]-s/2:e[0][0]-s/2}).attr("y",function(t){return"s"===t.type[0]?e[1][1]-s/2:e[0][1]-s/2}).attr("width",function(t){return"n"===t.type||"s"===t.type?e[1][0]-e[0][0]+s:s}).attr("height",function(t){return"e"===t.type||"w"===t.type?e[1][1]-e[0][1]+s:s})):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(t,e,n){var r=t.__brush.emitter;return!r||n&&r.clean?new h(t,e,n):r}function h(t,e,n){this.that=t,this.args=e,this.state=t.__brush,this.active=0,this.clean=n}function f(n){if((!e||n.touches)&&r.apply(this,arguments)){var i,a,s,l,h,f,d,p,g,_,y,m=this,b=n.target.__data__.type,v="selection"===(o&&n.metaKey?b="overlay":b)?Go:o&&n.altKey?Yo:Uo,x=t===Zo?null:na[b],w=t===Ko?null:ra[b],E=la(m),A=E.extent,T=E.selection,S=A[0][0],C=A[0][1],k=A[1][0],M=A[1][1],R=0,O=0,N=x&&w&&o&&n.shiftKey,I=Array.from(n.touches||[n],t=>{const e=t.identifier;return(t=Qe(t,m)).point0=t.slice(),t.identifier=e,t});Di(m);var L=u(m,arguments,!0).beforestart();if("overlay"===b){T&&(g=!0);const e=[I[0],I[1]||I[0]];E.selection=T=[[i=t===Zo?S:Wo(e[0][0],e[1][0]),s=t===Ko?C:Wo(e[0][1],e[1][1])],[h=t===Zo?k:qo(e[0][0],e[1][0]),d=t===Ko?M:qo(e[0][1],e[1][1])]],I.length>1&&z(n)}else i=T[0][0],s=T[0][1],h=T[1][0],d=T[1][1];a=i,l=s,f=h,p=d;var P=$e(m).attr("pointer-events","none"),V=P.selectAll(".overlay").attr("cursor",Qo[b]);if(n.touches)L.moved=B,L.ended=F;else{var D=$e(n.view).on("mousemove.brush",B,!0).on("mouseup.brush",F,!0);o&&D.on("keydown.brush",function(t){switch(t.keyCode){case 16:N=x&&w;break;case 18:v===Uo&&(x&&(h=f-R*x,i=a+R*x),w&&(d=p-O*w,s=l+O*w),v=Yo,z(t));break;case 32:v!==Uo&&v!==Yo||(x<0?h=f-R:x>0&&(i=a-R),w<0?d=p-O:w>0&&(s=l-O),v=jo,V.attr("cursor",Qo.selection),z(t));break;default:return}Fo(t)},!0).on("keyup.brush",function(t){switch(t.keyCode){case 16:N&&(_=y=N=!1,z(t));break;case 18:v===Yo&&(x<0?h=f:x>0&&(i=a),w<0?d=p:w>0&&(s=l),v=Uo,z(t));break;case 32:v===jo&&(t.altKey?(x&&(h=f-R*x,i=a+R*x),w&&(d=p-O*w,s=l+O*w),v=Yo):(x<0?h=f:x>0&&(i=a),w<0?d=p:w>0&&(s=l),v=Uo),V.attr("cursor",Qo[b]),z(t));break;default:return}Fo(t)},!0),on(n.view)}c.call(m),L.start(n,v.name)}function B(t){for(const e of t.changedTouches||[t])for(const t of I)t.identifier===e.identifier&&(t.cur=Qe(e,m));if(N&&!_&&!y&&1===I.length){const t=I[0];Ho(t.cur[0]-t[0])>Ho(t.cur[1]-t[1])?y=!0:_=!0}for(const t of I)t.cur&&(t[0]=t.cur[0],t[1]=t.cur[1]);g=!0,Fo(t),z(t)}function z(t){const e=I[0],n=e.point0;var r;switch(R=e[0]-n[0],O=e[1]-n[1],v){case jo:case Go:x&&(R=qo(S-i,Wo(k-h,R)),a=i+R,f=h+R),w&&(O=qo(C-s,Wo(M-d,O)),l=s+O,p=d+O);break;case Uo:I[1]?(x&&(a=qo(S,Wo(k,I[0][0])),f=qo(S,Wo(k,I[1][0])),x=1),w&&(l=qo(C,Wo(M,I[0][1])),p=qo(C,Wo(M,I[1][1])),w=1)):(x<0?(R=qo(S-i,Wo(k-i,R)),a=i+R,f=h):x>0&&(R=qo(S-h,Wo(k-h,R)),a=i,f=h+R),w<0?(O=qo(C-s,Wo(M-s,O)),l=s+O,p=d):w>0&&(O=qo(C-d,Wo(M-d,O)),l=s,p=d+O));break;case Yo:x&&(a=qo(S,Wo(k,i-R*x)),f=qo(S,Wo(k,h+R*x))),w&&(l=qo(C,Wo(M,s-O*w)),p=qo(C,Wo(M,d+O*w)))}f<a&&(x*=-1,r=i,i=h,h=r,r=a,a=f,f=r,b in ta&&V.attr("cursor",Qo[b=ta[b]])),p<l&&(w*=-1,r=s,s=d,d=r,r=l,l=p,p=r,b in ea&&V.attr("cursor",Qo[b=ea[b]])),E.selection&&(T=E.selection),_&&(a=T[0][0],f=T[1][0]),y&&(l=T[0][1],p=T[1][1]),T[0][0]===a&&T[0][1]===l&&T[1][0]===f&&T[1][1]===p||(E.selection=[[a,l],[f,p]],c.call(m),L.brush(t,v.name))}function F(t){if(function(t){t.stopImmediatePropagation()}(t),t.touches){if(t.touches.length)return;e&&clearTimeout(e),e=setTimeout(function(){e=null},500)}else an(t.view,g),D.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);P.attr("pointer-events","all"),V.attr("cursor",Qo.overlay),E.selection&&(T=E.selection),function(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}(T)&&(E.selection=null,c.call(m)),L.end(t,v.name)}}function d(t){u(this,arguments).moved(t)}function p(t){u(this,arguments).ended(t)}function g(){var e=this.__brush||{selection:null};return e.extent=Xo(n.apply(this,arguments)),e.dim=t,e}return l.move=function(e,n,r){e.tween?e.on("start.brush",function(t){u(this,arguments).beforestart().start(t)}).on("interrupt.brush end.brush",function(t){u(this,arguments).end(t)}).tween("brush",function(){var e=this,r=e.__brush,i=u(e,arguments),o=r.selection,a=t.input("function"==typeof n?n.apply(this,arguments):n,r.extent),s=Hr(o,a);function l(t){r.selection=1===t&&null===a?null:s(t),c.call(e),i.brush()}return null!==o&&null!==a?l:l(1)}):e.each(function(){var e=this,i=arguments,o=e.__brush,a=t.input("function"==typeof n?n.apply(e,i):n,o.extent),s=u(e,i).beforestart();Di(e),o.selection=null===a?null:a,c.call(e),s.start(r).brush(r).end(r)})},l.clear=function(t,e){l.move(t,null,e)},h.prototype={beforestart:function(){return 1===++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(t,e){return this.starting?(this.starting=!1,this.emit("start",t,e)):this.emit("brush",t),this},brush:function(t,e){return this.emit("brush",t,e),this},end:function(t,e){return 0===--this.active&&(delete this.state.emitter,this.emit("end",t,e)),this},emit:function(e,n,r){var i=$e(this.that).datum();a.call(e,this.that,new zo(e,{sourceEvent:n,target:l,selection:t.output(this.state.selection),mode:r,dispatch:a}),i)}},l.extent=function(t){return arguments.length?(n="function"==typeof t?t:Bo(Xo(t)),l):n},l.filter=function(t){return arguments.length?(r="function"==typeof t?t:Bo(!!t),l):r},l.touchable=function(t){return arguments.length?(i="function"==typeof t?t:Bo(!!t),l):i},l.handleSize=function(t){return arguments.length?(s=+t,l):s},l.keyModifiers=function(t){return arguments.length?(o=!!t,l):o},l.on=function(){var t=a.on.apply(a,arguments);return t===a?l:t},l}var ua=Math.abs,ha=Math.cos,fa=Math.sin,da=Math.PI,pa=da/2,ga=2*da,_a=Math.max,ya=1e-12;function ma(t,e){return Array.from({length:e-t},(e,n)=>t+n)}function ba(t,e){var n=0,r=null,i=null,o=null;function a(a){var s,l=a.length,c=new Array(l),u=ma(0,l),h=new Array(l*l),f=new Array(l),d=0;a=Float64Array.from({length:l*l},e?(t,e)=>a[e%l][e/l|0]:(t,e)=>a[e/l|0][e%l]);for(let e=0;e<l;++e){let n=0;for(let r=0;r<l;++r)n+=a[e*l+r]+t*a[r*l+e];d+=c[e]=n}s=(d=_a(0,ga-n*l)/d)?n:ga/l;{let e=0;r&&u.sort((t,e)=>r(c[t],c[e]));for(const n of u){const r=e;if(t){const t=ma(1+~l,l).filter(t=>t<0?a[~t*l+n]:a[n*l+t]);i&&t.sort((t,e)=>i(t<0?-a[~t*l+n]:a[n*l+t],e<0?-a[~e*l+n]:a[n*l+e]));for(const r of t)if(r<0){(h[~r*l+n]||(h[~r*l+n]={source:null,target:null})).target={index:n,startAngle:e,endAngle:e+=a[~r*l+n]*d,value:a[~r*l+n]}}else{(h[n*l+r]||(h[n*l+r]={source:null,target:null})).source={index:n,startAngle:e,endAngle:e+=a[n*l+r]*d,value:a[n*l+r]}}f[n]={index:n,startAngle:r,endAngle:e,value:c[n]}}else{const t=ma(0,l).filter(t=>a[n*l+t]||a[t*l+n]);i&&t.sort((t,e)=>i(a[n*l+t],a[n*l+e]));for(const r of t){let t;if(n<r?(t=h[n*l+r]||(h[n*l+r]={source:null,target:null}),t.source={index:n,startAngle:e,endAngle:e+=a[n*l+r]*d,value:a[n*l+r]}):(t=h[r*l+n]||(h[r*l+n]={source:null,target:null}),t.target={index:n,startAngle:e,endAngle:e+=a[n*l+r]*d,value:a[n*l+r]},n===r&&(t.source=t.target)),t.source&&t.target&&t.source.value<t.target.value){const e=t.source;t.source=t.target,t.target=e}}f[n]={index:n,startAngle:r,endAngle:e,value:c[n]}}e+=s}}return(h=Object.values(h)).groups=f,o?h.sort(o):h}return a.padAngle=function(t){return arguments.length?(n=_a(0,t),a):n},a.sortGroups=function(t){return arguments.length?(r=t,a):r},a.sortSubgroups=function(t){return arguments.length?(i=t,a):i},a.sortChords=function(t){return arguments.length?(null==t?o=null:(e=t,o=function(t,n){return e(t.source.value+t.target.value,n.source.value+n.target.value)})._=t,a):o&&o._;var e},a}const va=Math.PI,xa=2*va,wa=1e-6,Ea=xa-wa;function Aa(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}let Ta=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?Aa:function(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Aa;const n=10**e;return function(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=Math.round(arguments[e]*n)/n+t[e]}}(t)}moveTo(t,e){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,e){this._append`L${this._x1=+t},${this._y1=+e}`}quadraticCurveTo(t,e,n,r){this._append`Q${+t},${+e},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(t,e,n,r,i,o){this._append`C${+t},${+e},${+n},${+r},${this._x1=+i},${this._y1=+o}`}arcTo(t,e,n,r,i){if(t=+t,e=+e,n=+n,r=+r,(i=+i)<0)throw new Error(`negative radius: ${i}`);let o=this._x1,a=this._y1,s=n-t,l=r-e,c=o-t,u=a-e,h=c*c+u*u;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(h>wa)if(Math.abs(u*s-l*c)>wa&&i){let f=n-o,d=r-a,p=s*s+l*l,g=f*f+d*d,_=Math.sqrt(p),y=Math.sqrt(h),m=i*Math.tan((va-Math.acos((p+h-g)/(2*_*y)))/2),b=m/y,v=m/_;Math.abs(b-1)>wa&&this._append`L${t+b*c},${e+b*u}`,this._append`A${i},${i},0,0,${+(u*f>c*d)},${this._x1=t+v*s},${this._y1=e+v*l}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,n,r,i,o){if(t=+t,e=+e,o=!!o,(n=+n)<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(r),s=n*Math.sin(r),l=t+a,c=e+s,u=1^o,h=o?r-i:i-r;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>wa||Math.abs(this._y1-c)>wa)&&this._append`L${l},${c}`,n&&(h<0&&(h=h%xa+xa),h>Ea?this._append`A${n},${n},0,1,${u},${t-a},${e-s}A${n},${n},0,1,${u},${this._x1=l},${this._y1=c}`:h>wa&&this._append`A${n},${n},0,${+(h>=va)},${u},${this._x1=t+n*Math.cos(i)},${this._y1=e+n*Math.sin(i)}`)}rect(t,e,n,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function Sa(){return new Ta}Sa.prototype=Ta.prototype;var Ca=Array.prototype.slice;function ka(t){return function(){return t}}function Ma(t){return t.source}function Ra(t){return t.target}function Oa(t){return t.radius}function Na(t){return t.startAngle}function Ia(t){return t.endAngle}function La(){return 0}function Pa(){return 10}function Va(t){var e=Ma,n=Ra,r=Oa,i=Oa,o=Na,a=Ia,s=La,l=null;function c(){var c,u=e.apply(this,arguments),h=n.apply(this,arguments),f=s.apply(this,arguments)/2,d=Ca.call(arguments),p=+r.apply(this,(d[0]=u,d)),g=o.apply(this,d)-pa,_=a.apply(this,d)-pa,y=+i.apply(this,(d[0]=h,d)),m=o.apply(this,d)-pa,b=a.apply(this,d)-pa;if(l||(l=c=Sa()),f>ya&&(ua(_-g)>2*f+ya?_>g?(g+=f,_-=f):(g-=f,_+=f):g=_=(g+_)/2,ua(b-m)>2*f+ya?b>m?(m+=f,b-=f):(m-=f,b+=f):m=b=(m+b)/2),l.moveTo(p*ha(g),p*fa(g)),l.arc(0,0,p,g,_),g!==m||_!==b)if(t){var v=y-+t.apply(this,arguments),x=(m+b)/2;l.quadraticCurveTo(0,0,v*ha(m),v*fa(m)),l.lineTo(y*ha(x),y*fa(x)),l.lineTo(v*ha(b),v*fa(b))}else l.quadraticCurveTo(0,0,y*ha(m),y*fa(m)),l.arc(0,0,y,m,b);if(l.quadraticCurveTo(0,0,p*ha(g),p*fa(g)),l.closePath(),c)return l=null,c+""||null}return t&&(c.headRadius=function(e){return arguments.length?(t="function"==typeof e?e:ka(+e),c):t}),c.radius=function(t){return arguments.length?(r=i="function"==typeof t?t:ka(+t),c):r},c.sourceRadius=function(t){return arguments.length?(r="function"==typeof t?t:ka(+t),c):r},c.targetRadius=function(t){return arguments.length?(i="function"==typeof t?t:ka(+t),c):i},c.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:ka(+t),c):o},c.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:ka(+t),c):a},c.padAngle=function(t){return arguments.length?(s="function"==typeof t?t:ka(+t),c):s},c.source=function(t){return arguments.length?(e=t,c):e},c.target=function(t){return arguments.length?(n=t,c):n},c.context=function(t){return arguments.length?(l=null==t?null:t,c):l},c}var Da=Array.prototype.slice;function Ba(t,e){return t-e}var za=t=>()=>t;function Fa(t,e){for(var n,r=-1,i=e.length;++r<i;)if(n=Ga(t,e[r]))return n;return 0}function Ga(t,e){for(var n=e[0],r=e[1],i=-1,o=0,a=t.length,s=a-1;o<a;s=o++){var l=t[o],c=l[0],u=l[1],h=t[s],f=h[0],d=h[1];if(ja(l,h,e))return 0;u>r!=d>r&&n<(f-c)*(r-u)/(d-u)+c&&(i=-i)}return i}function ja(t,e,n){var r,i,o,a;return function(t,e,n){return(e[0]-t[0])*(n[1]-t[1])===(n[0]-t[0])*(e[1]-t[1])}(t,e,n)&&(i=t[r=+(t[0]===e[0])],o=n[r],a=e[r],i<=o&&o<=a||a<=o&&o<=i)}function Ua(){}var Ya=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function Ha(){var t=1,e=1,n=Z,r=s;function i(t){var e=n(t);if(Array.isArray(e))e=e.slice().sort(Ba);else{const n=x(t,qa);for(e=W(...K(n[0],n[1],e),e);e[e.length-1]>=n[1];)e.pop();for(;e[1]<n[0];)e.shift()}return e.map(e=>o(t,e))}function o(n,i){const o=null==i?NaN:+i;if(isNaN(o))throw new Error(`invalid value: ${i}`);var s=[],l=[];return function(n,r,i){var o,s,l,c,u,h,f=new Array,d=new Array;o=s=-1,c=Wa(n[0],r),Ya[c<<1].forEach(p);for(;++o<t-1;)l=c,c=Wa(n[o+1],r),Ya[l|c<<1].forEach(p);Ya[c|0].forEach(p);for(;++s<e-1;){for(o=-1,c=Wa(n[s*t+t],r),u=Wa(n[s*t],r),Ya[c<<1|u<<2].forEach(p);++o<t-1;)l=c,c=Wa(n[s*t+t+o+1],r),h=u,u=Wa(n[s*t+o+1],r),Ya[l|c<<1|u<<2|h<<3].forEach(p);Ya[c|u<<3].forEach(p)}o=-1,u=n[s*t]>=r,Ya[u<<2].forEach(p);for(;++o<t-1;)h=u,u=Wa(n[s*t+o+1],r),Ya[u<<2|h<<3].forEach(p);function p(t){var e,n,r=[t[0][0]+o,t[0][1]+s],l=[t[1][0]+o,t[1][1]+s],c=a(r),u=a(l);(e=d[c])?(n=f[u])?(delete d[e.end],delete f[n.start],e===n?(e.ring.push(l),i(e.ring)):f[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete d[e.end],e.ring.push(l),d[e.end=u]=e):(e=f[u])?(n=d[c])?(delete f[e.start],delete d[n.end],e===n?(e.ring.push(l),i(e.ring)):f[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete f[e.start],e.ring.unshift(r),f[e.start=c]=e):f[c]=d[u]={start:c,end:u,ring:[r,l]}}Ya[u<<3].forEach(p)}(n,o,function(t){r(t,n,o),function(t){for(var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];++e<n;)r+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return r}(t)>0?s.push([t]):l.push(t)}),l.forEach(function(t){for(var e,n=0,r=s.length;n<r;++n)if(-1!==Fa((e=s[n])[0],t))return void e.push(t)}),{type:"MultiPolygon",value:i,coordinates:s}}function a(e){return 2*e[0]+e[1]*(t+1)*4}function s(n,r,i){n.forEach(function(n){var o=n[0],a=n[1],s=0|o,l=0|a,c=$a(r[l*t+s]);o>0&&o<t&&s===o&&(n[0]=Xa(o,$a(r[l*t+s-1]),c,i)),a>0&&a<e&&l===a&&(n[1]=Xa(a,$a(r[(l-1)*t+s]),c,i))})}return i.contour=o,i.size=function(n){if(!arguments.length)return[t,e];var r=Math.floor(n[0]),o=Math.floor(n[1]);if(!(r>=0&&o>=0))throw new Error("invalid size");return t=r,e=o,i},i.thresholds=function(t){return arguments.length?(n="function"==typeof t?t:Array.isArray(t)?za(Da.call(t)):za(t),i):n},i.smooth=function(t){return arguments.length?(r=t?s:Ua,i):r===s},i}function qa(t){return isFinite(t)?t:NaN}function Wa(t,e){return null!=t&&+t>=e}function $a(t){return null==t||isNaN(t=+t)?-1/0:t}function Xa(t,e,n,r){const i=r-e,o=n-e,a=isFinite(i)||isFinite(o)?i/o:Math.sign(i)/Math.sign(o);return isNaN(a)?t:t+a-.5}function Ka(t){return t[0]}function Za(t){return t[1]}function Ja(){return 1}const Qa=134217729;function ts(t,e,n,r,i){let o,a,s,l,c=e[0],u=r[0],h=0,f=0;u>c==u>-c?(o=c,c=e[++h]):(o=u,u=r[++f]);let d=0;if(h<t&&f<n)for(u>c==u>-c?(a=c+o,s=o-(a-c),c=e[++h]):(a=u+o,s=o-(a-u),u=r[++f]),o=a,0!==s&&(i[d++]=s);h<t&&f<n;)u>c==u>-c?(a=o+c,l=a-o,s=o-(a-l)+(c-l),c=e[++h]):(a=o+u,l=a-o,s=o-(a-l)+(u-l),u=r[++f]),o=a,0!==s&&(i[d++]=s);for(;h<t;)a=o+c,l=a-o,s=o-(a-l)+(c-l),c=e[++h],o=a,0!==s&&(i[d++]=s);for(;f<n;)a=o+u,l=a-o,s=o-(a-l)+(u-l),u=r[++f],o=a,0!==s&&(i[d++]=s);return 0===o&&0!==d||(i[d++]=o),d}function es(t){return new Float64Array(t)}const ns=es(4),rs=es(8),is=es(12),os=es(16),as=es(4);function ss(t,e,n,r,i,o){const a=(e-o)*(n-i),s=(t-i)*(r-o),l=a-s,c=Math.abs(a+s);return Math.abs(l)>=33306690738754716e-32*c?l:-function(t,e,n,r,i,o,a){let s,l,c,u,h,f,d,p,g,_,y,m,b,v,x,w,E,A;const T=t-i,S=n-i,C=e-o,k=r-o;v=T*k,f=Qa*T,d=f-(f-T),p=T-d,f=Qa*k,g=f-(f-k),_=k-g,x=p*_-(v-d*g-p*g-d*_),w=C*S,f=Qa*C,d=f-(f-C),p=C-d,f=Qa*S,g=f-(f-S),_=S-g,E=p*_-(w-d*g-p*g-d*_),y=x-E,h=x-y,ns[0]=x-(y+h)+(h-E),m=v+y,h=m-v,b=v-(m-h)+(y-h),y=b-w,h=b-y,ns[1]=b-(y+h)+(h-w),A=m+y,h=A-m,ns[2]=m-(A-h)+(y-h),ns[3]=A;let M=function(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}(4,ns),R=22204460492503146e-32*a;if(M>=R||-M>=R)return M;if(h=t-T,s=t-(T+h)+(h-i),h=n-S,c=n-(S+h)+(h-i),h=e-C,l=e-(C+h)+(h-o),h=r-k,u=r-(k+h)+(h-o),0===s&&0===l&&0===c&&0===u)return M;if(R=11093356479670487e-47*a+33306690738754706e-32*Math.abs(M),M+=T*u+k*s-(C*c+S*l),M>=R||-M>=R)return M;v=s*k,f=Qa*s,d=f-(f-s),p=s-d,f=Qa*k,g=f-(f-k),_=k-g,x=p*_-(v-d*g-p*g-d*_),w=l*S,f=Qa*l,d=f-(f-l),p=l-d,f=Qa*S,g=f-(f-S),_=S-g,E=p*_-(w-d*g-p*g-d*_),y=x-E,h=x-y,as[0]=x-(y+h)+(h-E),m=v+y,h=m-v,b=v-(m-h)+(y-h),y=b-w,h=b-y,as[1]=b-(y+h)+(h-w),A=m+y,h=A-m,as[2]=m-(A-h)+(y-h),as[3]=A;const O=ts(4,ns,4,as,rs);v=T*u,f=Qa*T,d=f-(f-T),p=T-d,f=Qa*u,g=f-(f-u),_=u-g,x=p*_-(v-d*g-p*g-d*_),w=C*c,f=Qa*C,d=f-(f-C),p=C-d,f=Qa*c,g=f-(f-c),_=c-g,E=p*_-(w-d*g-p*g-d*_),y=x-E,h=x-y,as[0]=x-(y+h)+(h-E),m=v+y,h=m-v,b=v-(m-h)+(y-h),y=b-w,h=b-y,as[1]=b-(y+h)+(h-w),A=m+y,h=A-m,as[2]=m-(A-h)+(y-h),as[3]=A;const N=ts(O,rs,4,as,is);v=s*u,f=Qa*s,d=f-(f-s),p=s-d,f=Qa*u,g=f-(f-u),_=u-g,x=p*_-(v-d*g-p*g-d*_),w=l*c,f=Qa*l,d=f-(f-l),p=l-d,f=Qa*c,g=f-(f-c),_=c-g,E=p*_-(w-d*g-p*g-d*_),y=x-E,h=x-y,as[0]=x-(y+h)+(h-E),m=v+y,h=m-v,b=v-(m-h)+(y-h),y=b-w,h=b-y,as[1]=b-(y+h)+(h-w),A=m+y,h=A-m,as[2]=m-(A-h)+(y-h),as[3]=A;const I=ts(N,is,4,as,os);return os[I-1]}(t,e,n,r,i,o,c)}const ls=Math.pow(2,-52),cs=new Uint32Array(512);class us{static from(t,e=_s,n=ys){const r=t.length,i=new Float64Array(2*r);for(let o=0;o<r;o++){const r=t[o];i[2*o]=e(r),i[2*o+1]=n(r)}return new us(i)}constructor(t){const e=t.length>>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:r,_hullHash:i}=this,o=t.length>>1;let a=1/0,s=1/0,l=-1/0,c=-1/0;for(let e=0;e<o;e++){const n=t[2*e],r=t[2*e+1];n<a&&(a=n),r<s&&(s=r),n>l&&(l=n),r>c&&(c=r),this._ids[e]=e}const u=(a+l)/2,h=(s+c)/2;let f,d,p;for(let e=0,n=1/0;e<o;e++){const r=hs(u,h,t[2*e],t[2*e+1]);r<n&&(f=e,n=r)}const g=t[2*f],_=t[2*f+1];for(let e=0,n=1/0;e<o;e++){if(e===f)continue;const r=hs(g,_,t[2*e],t[2*e+1]);r<n&&r>0&&(d=e,n=r)}let y=t[2*d],m=t[2*d+1],b=1/0;for(let e=0;e<o;e++){if(e===f||e===d)continue;const n=ds(g,_,y,m,t[2*e],t[2*e+1]);n<b&&(p=e,b=n)}let v=t[2*p],x=t[2*p+1];if(b===1/0){for(let e=0;e<o;e++)this._dists[e]=t[2*e]-t[0]||t[2*e+1]-t[1];ps(this._ids,this._dists,0,o-1);const e=new Uint32Array(o);let n=0;for(let t=0,r=-1/0;t<o;t++){const i=this._ids[t],o=this._dists[i];o>r&&(e[n++]=i,r=o)}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(ss(g,_,y,m,v,x)<0){const t=d,e=y,n=m;d=p,y=v,m=x,p=t,v=e,x=n}const w=function(t,e,n,r,i,o){const a=n-t,s=r-e,l=i-t,c=o-e,u=a*a+s*s,h=l*l+c*c,f=.5/(a*c-s*l),d=t+(c*u-s*h)*f,p=e+(a*h-l*u)*f;return{x:d,y:p}}(g,_,y,m,v,x);this._cx=w.x,this._cy=w.y;for(let e=0;e<o;e++)this._dists[e]=hs(t[2*e],t[2*e+1],w.x,w.y);ps(this._ids,this._dists,0,o-1),this._hullStart=f;let E=3;n[f]=e[p]=d,n[d]=e[f]=p,n[p]=e[d]=f,r[f]=0,r[d]=1,r[p]=2,i.fill(-1),i[this._hashKey(g,_)]=f,i[this._hashKey(y,m)]=d,i[this._hashKey(v,x)]=p,this.trianglesLen=0,this._addTriangle(f,d,p,-1,-1,-1);for(let o,a,s=0;s<this._ids.length;s++){const l=this._ids[s],c=t[2*l],u=t[2*l+1];if(s>0&&Math.abs(c-o)<=ls&&Math.abs(u-a)<=ls)continue;if(o=c,a=u,l===f||l===d||l===p)continue;let h=0;for(let t=0,e=this._hashKey(c,u);t<this._hashSize&&(h=i[(e+t)%this._hashSize],-1===h||h===n[h]);t++);h=e[h];let g,_=h;for(;g=n[_],ss(c,u,t[2*_],t[2*_+1],t[2*g],t[2*g+1])>=0;)if(_=g,_===h){_=-1;break}if(-1===_)continue;let y=this._addTriangle(_,l,n[_],-1,-1,r[_]);r[l]=this._legalize(y+2),r[_]=y,E++;let m=n[_];for(;g=n[m],ss(c,u,t[2*m],t[2*m+1],t[2*g],t[2*g+1])<0;)y=this._addTriangle(m,l,g,r[l],-1,r[m]),r[l]=this._legalize(y+2),n[m]=m,E--,m=g;if(_===h)for(;g=e[_],ss(c,u,t[2*g],t[2*g+1],t[2*_],t[2*_+1])<0;)y=this._addTriangle(g,l,_,-1,r[_],r[g]),this._legalize(y+2),r[g]=y,n[_]=_,E--,_=g;this._hullStart=e[l]=_,n[_]=e[m]=l,n[l]=m,i[this._hashKey(c,u)]=l,i[this._hashKey(t[2*_],t[2*_+1])]=_}this.hull=new Uint32Array(E);for(let t=0,e=this._hullStart;t<E;t++)this.hull[t]=e,e=n[e];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,e){return Math.floor(function(t,e){const n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:r}=this;let i=0,o=0;for(;;){const a=n[t],s=t-t%3;if(o=s+(t+2)%3,-1===a){if(0===i)break;t=cs[--i];continue}const l=a-a%3,c=s+(t+1)%3,u=l+(a+2)%3,h=e[o],f=e[t],d=e[c],p=e[u];if(fs(r[2*h],r[2*h+1],r[2*f],r[2*f+1],r[2*d],r[2*d+1],r[2*p],r[2*p+1])){e[t]=p,e[a]=h;const r=n[u];if(-1===r){let e=this._hullStart;do{if(this._hullTri[e]===u){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,r),this._link(a,n[o]),this._link(o,u);const s=l+(a+1)%3;i<cs.length&&(cs[i++]=s)}else{if(0===i)break;t=cs[--i]}}return o}_link(t,e){this._halfedges[t]=e,-1!==e&&(this._halfedges[e]=t)}_addTriangle(t,e,n,r,i,o){const a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=e,this._triangles[a+2]=n,this._link(a,r),this._link(a+1,i),this._link(a+2,o),this.trianglesLen+=3,a}}function hs(t,e,n,r){const i=t-n,o=e-r;return i*i+o*o}function fs(t,e,n,r,i,o,a,s){const l=t-a,c=e-s,u=n-a,h=r-s,f=i-a,d=o-s,p=u*u+h*h,g=f*f+d*d;return l*(h*g-p*d)-c*(u*g-p*f)+(l*l+c*c)*(u*d-h*f)<0}function ds(t,e,n,r,i,o){const a=n-t,s=r-e,l=i-t,c=o-e,u=a*a+s*s,h=l*l+c*c,f=.5/(a*c-s*l),d=(c*u-s*h)*f,p=(a*h-l*u)*f;return d*d+p*p}function ps(t,e,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const r=t[i],o=e[r];let a=i-1;for(;a>=n&&e[t[a]]>o;)t[a+1]=t[a--];t[a+1]=r}else{let i=n+1,o=r;gs(t,n+r>>1,i),e[t[n]]>e[t[r]]&&gs(t,n,r),e[t[i]]>e[t[r]]&&gs(t,i,r),e[t[n]]>e[t[i]]&&gs(t,n,i);const a=t[i],s=e[a];for(;;){do{i++}while(e[t[i]]<s);do{o--}while(e[t[o]]>s);if(o<i)break;gs(t,i,o)}t[n+1]=t[o],t[o]=a,r-i+1>=o-n?(ps(t,e,i,r),ps(t,e,n,o-1)):(ps(t,e,n,o-1),ps(t,e,i,r))}}function gs(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function _s(t){return t[0]}function ys(t){return t[1]}const ms=1e-6;let bs=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,e){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,e){this._+=`L${this._x1=+t},${this._y1=+e}`}arc(t,e,n){const r=(t=+t)+(n=+n),i=e=+e;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>ms||Math.abs(this._y1-i)>ms)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${t-n},${e}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,e,n,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${+n}v${+r}h${-n}Z`}value(){return this._||null}},vs=class{constructor(){this._=[]}moveTo(t,e){this._.push([t,e])}closePath(){this._.push(this._[0].slice())}lineTo(t,e){this._.push([t,e])}value(){return this._.length?this._:null}};class xs{constructor(t,[e,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(e=+e)&&(i=+i)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=e,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:e,triangles:n},vectors:r}=this;let i,o;const a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let r,s,l=0,c=0,u=n.length;l<u;l+=3,c+=2){const u=2*n[l],h=2*n[l+1],f=2*n[l+2],d=t[u],p=t[u+1],g=t[h],_=t[h+1],y=t[f],m=t[f+1],b=g-d,v=_-p,x=y-d,w=m-p,E=2*(b*w-v*x);if(Math.abs(E)<1e-9){if(void 0===i){i=o=0;for(const n of e)i+=t[2*n],o+=t[2*n+1];i/=e.length,o/=e.length}const n=1e9*Math.sign((i-d)*w-(o-p)*x);r=(d+y)/2-n*w,s=(p+m)/2+n*x}else{const t=1/E,e=b*b+v*v,n=x*x+w*w;r=d+(w*e-v*n)*t,s=p+(b*n-x*e)*t}a[c]=r,a[c+1]=s}let s,l,c,u=e[e.length-1],h=4*u,f=t[2*u],d=t[2*u+1];r.fill(0);for(let n=0;n<e.length;++n)u=e[n],s=h,l=f,c=d,h=4*u,f=t[2*u],d=t[2*u+1],r[s+2]=r[h]=c-d,r[s+3]=r[h+1]=f-l}render(t){const e=null==t?t=new bs:void 0,{delaunay:{halfedges:n,inedges:r,hull:i},circumcenters:o,vectors:a}=this;if(i.length<=1)return null;for(let e=0,r=n.length;e<r;++e){const r=n[e];if(r<e)continue;const i=2*Math.floor(e/3),a=2*Math.floor(r/3),s=o[i],l=o[i+1],c=o[a],u=o[a+1];this._renderSegment(s,l,c,u,t)}let s,l=i[i.length-1];for(let e=0;e<i.length;++e){s=l,l=i[e];const n=2*Math.floor(r[l]/3),c=o[n],u=o[n+1],h=4*s,f=this._project(c,u,a[h+2],a[h+3]);f&&this._renderSegment(c,u,f[0],f[1],t)}return e&&e.value()}renderBounds(t){const e=null==t?t=new bs:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),e&&e.value()}renderCell(t,e){const n=null==e?e=new bs:void 0,r=this._clip(t);if(null===r||!r.length)return;e.moveTo(r[0],r[1]);let i=r.length;for(;r[0]===r[i-2]&&r[1]===r[i-1]&&i>1;)i-=2;for(let t=2;t<i;t+=2)r[t]===r[t-2]&&r[t+1]===r[t-1]||e.lineTo(r[t],r[t+1]);return e.closePath(),n&&n.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let e=0,n=t.length/2;e<n;++e){const t=this.cellPolygon(e);t&&(t.index=e,yield t)}}cellPolygon(t){const e=new vs;return this.renderCell(t,e),e.value()}_renderSegment(t,e,n,r,i){let o;const a=this._regioncode(t,e),s=this._regioncode(n,r);0===a&&0===s?(i.moveTo(t,e),i.lineTo(n,r)):(o=this._clipSegment(t,e,n,r,a,s))&&(i.moveTo(o[0],o[1]),i.lineTo(o[2],o[3]))}contains(t,e,n){return(e=+e)==e&&(n=+n)==n&&this.delaunay._step(t,e,n)===t}*neighbors(t){const e=this._clip(t);if(e)for(const n of this.delaunay.neighbors(t)){const t=this._clip(n);if(t)t:for(let r=0,i=e.length;r<i;r+=2)for(let o=0,a=t.length;o<a;o+=2)if(e[r]===t[o]&&e[r+1]===t[o+1]&&e[(r+2)%i]===t[(o+a-2)%a]&&e[(r+3)%i]===t[(o+a-1)%a]){yield n;break t}}}_cell(t){const{circumcenters:e,delaunay:{inedges:n,halfedges:r,triangles:i}}=this,o=n[t];if(-1===o)return null;const a=[];let s=o;do{const n=Math.floor(s/3);if(a.push(e[2*n],e[2*n+1]),s=s%3==2?s-2:s+1,i[s]!==t)break;s=r[s]}while(s!==o&&-1!==s);return a}_clip(t){if(0===t&&1===this.delaunay.hull.length)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const e=this._cell(t);if(null===e)return null;const{vectors:n}=this,r=4*t;return this._simplify(n[r]||n[r+1]?this._clipInfinite(t,e,n[r],n[r+1],n[r+2],n[r+3]):this._clipFinite(t,e))}_clipFinite(t,e){const n=e.length;let r,i,o,a,s=null,l=e[n-2],c=e[n-1],u=this._regioncode(l,c),h=0;for(let f=0;f<n;f+=2)if(r=l,i=c,l=e[f],c=e[f+1],o=u,u=this._regioncode(l,c),0===o&&0===u)a=h,h=0,s?s.push(l,c):s=[l,c];else{let e,n,f,d,p;if(0===o){if(null===(e=this._clipSegment(r,i,l,c,o,u)))continue;[n,f,d,p]=e}else{if(null===(e=this._clipSegment(l,c,r,i,u,o)))continue;[d,p,n,f]=e,a=h,h=this._edgecode(n,f),a&&h&&this._edge(t,a,h,s,s.length),s?s.push(n,f):s=[n,f]}a=h,h=this._edgecode(d,p),a&&h&&this._edge(t,a,h,s,s.length),s?s.push(d,p):s=[d,p]}if(s)a=h,h=this._edgecode(s[0],s[1]),a&&h&&this._edge(t,a,h,s,s.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return s}_clipSegment(t,e,n,r,i,o){const a=i<o;for(a&&([t,e,n,r,i,o]=[n,r,t,e,o,i]);;){if(0===i&&0===o)return a?[n,r,t,e]:[t,e,n,r];if(i&o)return null;let s,l,c=i||o;8&c?(s=t+(n-t)*(this.ymax-e)/(r-e),l=this.ymax):4&c?(s=t+(n-t)*(this.ymin-e)/(r-e),l=this.ymin):2&c?(l=e+(r-e)*(this.xmax-t)/(n-t),s=this.xmax):(l=e+(r-e)*(this.xmin-t)/(n-t),s=this.xmin),i?(t=s,e=l,i=this._regioncode(t,e)):(n=s,r=l,o=this._regioncode(n,r))}}_clipInfinite(t,e,n,r,i,o){let a,s=Array.from(e);if((a=this._project(s[0],s[1],n,r))&&s.unshift(a[0],a[1]),(a=this._project(s[s.length-2],s[s.length-1],i,o))&&s.push(a[0],a[1]),s=this._clipFinite(t,s))for(let e,n=0,r=s.length,i=this._edgecode(s[r-2],s[r-1]);n<r;n+=2)e=i,i=this._edgecode(s[n],s[n+1]),e&&i&&(n=this._edge(t,e,i,s,n),r=s.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(s=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return s}_edge(t,e,n,r,i){for(;e!==n;){let n,o;switch(e){case 5:e=4;continue;case 4:e=6,n=this.xmax,o=this.ymin;break;case 6:e=2;continue;case 2:e=10,n=this.xmax,o=this.ymax;break;case 10:e=8;continue;case 8:e=9,n=this.xmin,o=this.ymax;break;case 9:e=1;continue;case 1:e=5,n=this.xmin,o=this.ymin}r[i]===n&&r[i+1]===o||!this.contains(t,n,o)||(r.splice(i,0,n,o),i+=2)}return i}_project(t,e,n,r){let i,o,a,s=1/0;if(r<0){if(e<=this.ymin)return null;(i=(this.ymin-e)/r)<s&&(a=this.ymin,o=t+(s=i)*n)}else if(r>0){if(e>=this.ymax)return null;(i=(this.ymax-e)/r)<s&&(a=this.ymax,o=t+(s=i)*n)}if(n>0){if(t>=this.xmax)return null;(i=(this.xmax-t)/n)<s&&(o=this.xmax,a=e+(s=i)*r)}else if(n<0){if(t<=this.xmin)return null;(i=(this.xmin-t)/n)<s&&(o=this.xmin,a=e+(s=i)*r)}return[o,a]}_edgecode(t,e){return(t===this.xmin?1:t===this.xmax?2:0)|(e===this.ymin?4:e===this.ymax?8:0)}_regioncode(t,e){return(t<this.xmin?1:t>this.xmax?2:0)|(e<this.ymin?4:e>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let e=0;e<t.length;e+=2){const n=(e+2)%t.length,r=(e+4)%t.length;(t[e]===t[n]&&t[n]===t[r]||t[e+1]===t[n+1]&&t[n+1]===t[r+1])&&(t.splice(n,2),e-=2)}t.length||(t=null)}return t}}const ws=2*Math.PI,Es=Math.pow;function As(t){return t[0]}function Ts(t){return t[1]}function Ss(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}class Cs{static from(t,e=As,n=Ts,r){return new Cs("length"in t?function(t,e,n,r){const i=t.length,o=new Float64Array(2*i);for(let a=0;a<i;++a){const i=t[a];o[2*a]=e.call(r,i,a,t),o[2*a+1]=n.call(r,i,a,t)}return o}(t,e,n,r):Float64Array.from(function*(t,e,n,r){let i=0;for(const o of t)yield e.call(r,o,i,t),yield n.call(r,o,i,t),++i}(t,e,n,r)))}constructor(t){this._delaunator=new us(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,e=this.points;if(t.hull&&t.hull.length>2&&function(t){const{triangles:e,coords:n}=t;for(let t=0;t<e.length;t+=3){const r=2*e[t],i=2*e[t+1],o=2*e[t+2];if((n[o]-n[r])*(n[i+1]-n[r+1])-(n[i]-n[r])*(n[o+1]-n[r+1])>1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:e.length/2},(t,e)=>e).sort((t,n)=>e[2*t]-e[2*n]||e[2*t+1]-e[2*n+1]);const t=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[e[2*t],e[2*t+1],e[2*n],e[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,n=e.length/2;t<n;++t){const n=Ss(e[2*t],e[2*t+1],i);e[2*t]=n[0],e[2*t+1]=n[1]}this._delaunator=new us(e)}else delete this.collinear;const n=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,i=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let t=0,e=n.length;t<e;++t){const e=i[t%3==2?t-2:t+1];-1!==n[t]&&-1!==o[e]||(o[e]=t)}for(let t=0,e=r.length;t<e;++t)a[r[t]]=t;r.length<=2&&r.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],o[r[0]]=1,2===r.length&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(t){return new xs(this,t)}*neighbors(t){const{inedges:e,hull:n,_hullIndex:r,halfedges:i,triangles:o,collinear:a}=this;if(a){const e=a.indexOf(t);return e>0&&(yield a[e-1]),void(e<a.length-1&&(yield a[e+1]))}const s=e[t];if(-1===s)return;let l=s,c=-1;do{if(yield c=o[l],l=l%3==2?l-2:l+1,o[l]!==t)return;if(l=i[l],-1===l){const e=n[(r[t]+1)%n.length];return void(e!==c&&(yield e))}}while(l!==s)}find(t,e,n=0){if((t=+t)!=t||(e=+e)!=e)return-1;const r=n;let i;for(;(i=this._step(n,t,e))>=0&&i!==n&&i!==r;)n=i;return i}_step(t,e,n){const{inedges:r,hull:i,_hullIndex:o,halfedges:a,triangles:s,points:l}=this;if(-1===r[t]||!l.length)return(t+1)%(l.length>>1);let c=t,u=Es(e-l[2*t],2)+Es(n-l[2*t+1],2);const h=r[t];let f=h;do{let r=s[f];const h=Es(e-l[2*r],2)+Es(n-l[2*r+1],2);if(h<u&&(u=h,c=r),f=f%3==2?f-2:f+1,s[f]!==t)break;if(f=a[f],-1===f){if(f=i[(o[t]+1)%i.length],f!==r&&Es(e-l[2*f],2)+Es(n-l[2*f+1],2)<u)return f;break}}while(f!==h);return c}render(t){const e=null==t?t=new bs:void 0,{points:n,halfedges:r,triangles:i}=this;for(let e=0,o=r.length;e<o;++e){const o=r[e];if(o<e)continue;const a=2*i[e],s=2*i[o];t.moveTo(n[a],n[a+1]),t.lineTo(n[s],n[s+1])}return this.renderHull(t),e&&e.value()}renderPoints(t,e){void 0!==e||t&&"function"==typeof t.moveTo||(e=t,t=null),e=null==e?2:+e;const n=null==t?t=new bs:void 0,{points:r}=this;for(let n=0,i=r.length;n<i;n+=2){const i=r[n],o=r[n+1];t.moveTo(i+e,o),t.arc(i,o,e,0,ws)}return n&&n.value()}renderHull(t){const e=null==t?t=new bs:void 0,{hull:n,points:r}=this,i=2*n[0],o=n.length;t.moveTo(r[i],r[i+1]);for(let e=1;e<o;++e){const i=2*n[e];t.lineTo(r[i],r[i+1])}return t.closePath(),e&&e.value()}hullPolygon(){const t=new vs;return this.renderHull(t),t.value()}renderTriangle(t,e){const n=null==e?e=new bs:void 0,{points:r,triangles:i}=this,o=2*i[t*=3],a=2*i[t+1],s=2*i[t+2];return e.moveTo(r[o],r[o+1]),e.lineTo(r[a],r[a+1]),e.lineTo(r[s],r[s+1]),e.closePath(),n&&n.value()}*trianglePolygons(){const{triangles:t}=this;for(let e=0,n=t.length/3;e<n;++e)yield this.trianglePolygon(e)}trianglePolygon(t){const e=new vs;return this.renderTriangle(t,e),e.value()}}var ks={},Ms={};function Rs(t){return new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'}).join(",")+"}")}function Os(t){var e=Object.create(null),n=[];return t.forEach(function(t){for(var r in t)r in e||n.push(e[r]=r)}),n}function Ns(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function Is(t){var e,n=t.getUTCHours(),r=t.getUTCMinutes(),i=t.getUTCSeconds(),o=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":((e=t.getUTCFullYear())<0?"-"+Ns(-e,6):e>9999?"+"+Ns(e,6):Ns(e,4))+"-"+Ns(t.getUTCMonth()+1,2)+"-"+Ns(t.getUTCDate(),2)+(o?"T"+Ns(n,2)+":"+Ns(r,2)+":"+Ns(i,2)+"."+Ns(o,3)+"Z":i?"T"+Ns(n,2)+":"+Ns(r,2)+":"+Ns(i,2)+"Z":r||n?"T"+Ns(n,2)+":"+Ns(r,2)+"Z":"")}function Ls(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],o=t.length,a=0,s=0,l=o<=0,c=!1;function u(){if(l)return Ms;if(c)return c=!1,ks;var e,r,i=a;if(34===t.charCodeAt(i)){for(;a++<o&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(e=a)>=o?l=!0:10===(r=t.charCodeAt(a++))?c=!0:13===r&&(c=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a<o;){if(10===(r=t.charCodeAt(e=a++)))c=!0;else if(13===r)c=!0,10===t.charCodeAt(a)&&++a;else if(r!==n)continue;return t.slice(i,e)}return l=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=u())!==Ms;){for(var h=[];r!==ks&&r!==Ms;)h.push(r),r=u();e&&null==(h=e(h,s++))||i.push(h)}return i}function i(e,n){return e.map(function(e){return n.map(function(t){return a(e[t])}).join(t)})}function o(e){return e.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?Is(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,o=r(t,function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=Rs(t);return function(r,i){return e(n(r),i,t)}}(t,e):Rs(t)});return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=Os(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=Os(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}var Ps=Ls(","),Vs=Ps.parse,Ds=Ps.parseRows,Bs=Ps.format,zs=Ps.formatBody,Fs=Ps.formatRows,Gs=Ps.formatRow,js=Ps.formatValue,Us=Ls("\t"),Ys=Us.parse,Hs=Us.parseRows,qs=Us.format,Ws=Us.formatBody,$s=Us.formatRows,Xs=Us.formatRow,Ks=Us.formatValue;function Zs(t){for(var e in t){var n,r,i=t[e].trim();if(i)if("true"===i)i=!0;else if("false"===i)i=!1;else if("NaN"===i)i=NaN;else if(isNaN(n=+i)){if(!(r=i.match(/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/)))continue;Js&&r[4]&&!r[7]&&(i=i.replace(/-/g,"/").replace(/T/," ")),i=new Date(i)}else i=n;else i=null;t[e]=i}return t}const Js=new Date("2019-01-01T00:00").getHours()||new Date("2019-07-01T00:00").getHours();function Qs(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.blob()}function tl(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.arrayBuffer()}function el(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function nl(t,e){return fetch(t,e).then(el)}function rl(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=void 0),nl(e,n).then(function(e){return t(e,r)})}}var il=rl(Vs),ol=rl(Ys);function al(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}function sl(t){return(e,n)=>nl(e,n).then(e=>(new DOMParser).parseFromString(e,t))}var ll=sl("application/xml"),cl=sl("text/html"),ul=sl("image/svg+xml");function hl(t,e){var n,r=1;function i(){var i,o,a=n.length,s=0,l=0;for(i=0;i<a;++i)s+=(o=n[i]).x,l+=o.y;for(s=(s/a-t)*r,l=(l/a-e)*r,i=0;i<a;++i)(o=n[i]).x-=s,o.y-=l}return null==t&&(t=0),null==e&&(e=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.strength=function(t){return arguments.length?(r=+t,i):r},i}function fl(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,s,l,c,u,h,f,d=t._root,p={data:r},g=t._x0,_=t._y0,y=t._x1,m=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((c=e>=(o=(g+y)/2))?g=o:y=o,(u=n>=(a=(_+m)/2))?_=a:m=a,i=d,!(d=d[h=u<<1|c]))return i[h]=p,t;if(s=+t._x.call(null,d.data),l=+t._y.call(null,d.data),e===s&&n===l)return p.next=d,i?i[h]=p:t._root=p,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(c=e>=(o=(g+y)/2))?g=o:y=o,(u=n>=(a=(_+m)/2))?_=a:m=a}while((h=u<<1|c)==(f=(l>=a)<<1|s>=o));return i[f]=d,i[h]=p,t}function dl(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function pl(t){return t[0]}function gl(t){return t[1]}function _l(t,e,n){var r=new yl(null==e?pl:e,null==n?gl:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function yl(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function ml(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var bl=_l.prototype=yl.prototype;function vl(t){return function(){return t}}function xl(t){return 1e-6*(t()-.5)}function wl(t){return t.x+t.vx}function El(t){return t.y+t.vy}function Al(t){return t.index}function Tl(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function Sl(t){var e,n,r,i,o,a,s=Al,l=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},c=vl(30),u=1;function h(r){for(var i=0,s=t.length;i<u;++i)for(var l,c,h,f,d,p,g,_=0;_<s;++_)c=(l=t[_]).source,f=(h=l.target).x+h.vx-c.x-c.vx||xl(a),d=h.y+h.vy-c.y-c.vy||xl(a),f*=p=((p=Math.sqrt(f*f+d*d))-n[_])/p*r*e[_],d*=p,h.vx-=f*(g=o[_]),h.vy-=d*g,c.vx+=f*(g=1-g),c.vy+=d*g}function f(){if(r){var a,l,c=r.length,u=t.length,h=new Map(r.map((t,e)=>[s(t,e,r),t]));for(a=0,i=new Array(c);a<u;++a)(l=t[a]).index=a,"object"!=typeof l.source&&(l.source=Tl(h,l.source)),"object"!=typeof l.target&&(l.target=Tl(h,l.target)),i[l.source.index]=(i[l.source.index]||0)+1,i[l.target.index]=(i[l.target.index]||0)+1;for(a=0,o=new Array(u);a<u;++a)l=t[a],o[a]=i[l.source.index]/(i[l.source.index]+i[l.target.index]);e=new Array(u),d(),n=new Array(u),p()}}function d(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+l(t[n],n,t)}function p(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+c(t[e],e,t)}return null==t&&(t=[]),h.initialize=function(t,e){r=t,a=e,f()},h.links=function(e){return arguments.length?(t=e,f(),h):t},h.id=function(t){return arguments.length?(s=t,h):s},h.iterations=function(t){return arguments.length?(u=+t,h):u},h.strength=function(t){return arguments.length?(l="function"==typeof t?t:vl(+t),d(),h):l},h.distance=function(t){return arguments.length?(c="function"==typeof t?t:vl(+t),p(),h):c},h}bl.copy=function(){var t,e,n=new yl(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=ml(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=ml(e));return n},bl.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return fl(this.cover(e,n),e,n,t)},bl.addAll=function(t){var e,n,r,i,o=t.length,a=new Array(o),s=new Array(o),l=1/0,c=1/0,u=-1/0,h=-1/0;for(n=0;n<o;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(i=+this._y.call(null,e))||(a[n]=r,s[n]=i,r<l&&(l=r),r>u&&(u=r),i<c&&(c=i),i>h&&(h=i));if(l>u||c>h)return this;for(this.cover(l,c).cover(u,h),n=0;n<o;++n)fl(this,a[n],s[n],t[n]);return this},bl.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1;else{for(var a,s,l=i-n||1,c=this._root;n>t||t>=i||r>e||e>=o;)switch(s=(e<r)<<1|t<n,(a=new Array(4))[s]=c,c=a,l*=2,s){case 0:i=n+l,o=r+l;break;case 1:n=i-l,o=r+l;break;case 2:i=n+l,r=o-l;break;case 3:n=i-l,r=o-l}this._root&&this._root.length&&(this._root=c)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this},bl.data=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},bl.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},bl.find=function(t,e,n){var r,i,o,a,s,l,c,u=this._x0,h=this._y0,f=this._x1,d=this._y1,p=[],g=this._root;for(g&&p.push(new dl(g,u,h,f,d)),null==n?n=1/0:(u=t-n,h=e-n,f=t+n,d=e+n,n*=n);l=p.pop();)if(!(!(g=l.node)||(i=l.x0)>f||(o=l.y0)>d||(a=l.x1)<u||(s=l.y1)<h))if(g.length){var _=(i+a)/2,y=(o+s)/2;p.push(new dl(g[3],_,y,a,s),new dl(g[2],i,y,_,s),new dl(g[1],_,o,a,y),new dl(g[0],i,o,_,y)),(c=(e>=y)<<1|t>=_)&&(l=p[p.length-1],p[p.length-1]=p[p.length-1-c],p[p.length-1-c]=l)}else{var m=t-+this._x.call(null,g.data),b=e-+this._y.call(null,g.data),v=m*m+b*b;if(v<n){var x=Math.sqrt(n=v);u=t-x,h=e-x,f=t+x,d=e+x,r=g.data}}return r},bl.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var e,n,r,i,o,a,s,l,c,u,h,f,d=this._root,p=this._x0,g=this._y0,_=this._x1,y=this._y1;if(!d)return this;if(d.length)for(;;){if((c=o>=(s=(p+_)/2))?p=s:_=s,(u=a>=(l=(g+y)/2))?g=l:y=l,e=d,!(d=d[h=u<<1|c]))return this;if(!d.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(n=e,f=h)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):e?(i?e[h]=i:delete e[h],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[f]=d:this._root=d),this):(this._root=i,this)},bl.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},bl.root=function(){return this._root},bl.size=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},bl.visit=function(t){var e,n,r,i,o,a,s=[],l=this._root;for(l&&s.push(new dl(l,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(l=e.node,r=e.x0,i=e.y0,o=e.x1,a=e.y1)&&l.length){var c=(r+o)/2,u=(i+a)/2;(n=l[3])&&s.push(new dl(n,c,u,o,a)),(n=l[2])&&s.push(new dl(n,r,u,c,a)),(n=l[1])&&s.push(new dl(n,c,i,o,u)),(n=l[0])&&s.push(new dl(n,r,i,c,u))}return this},bl.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new dl(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var o,a=e.x0,s=e.y0,l=e.x1,c=e.y1,u=(a+l)/2,h=(s+c)/2;(o=i[0])&&n.push(new dl(o,a,s,u,h)),(o=i[1])&&n.push(new dl(o,u,s,l,h)),(o=i[2])&&n.push(new dl(o,a,h,u,c)),(o=i[3])&&n.push(new dl(o,u,h,l,c))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},bl.x=function(t){return arguments.length?(this._x=t,this):this._x},bl.y=function(t){return arguments.length?(this._y=t,this):this._y};const Cl=4294967296;function kl(t){return t.x}function Ml(t){return t.y}var Rl=Math.PI*(3-Math.sqrt(5));function Ol(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,s=new Map,l=Ti(h),c=Nt("tick","end"),u=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Cl)/Cl}();function h(){f(),c.call("tick",e),n<r&&(l.stop(),c.call("end",e))}function f(r){var l,c,u=t.length;void 0===r&&(r=1);for(var h=0;h<r;++h)for(n+=(o-n)*i,s.forEach(function(t){t(n)}),l=0;l<u;++l)null==(c=t[l]).fx?c.x+=c.vx*=a:(c.x=c.fx,c.vx=0),null==c.fy?c.y+=c.vy*=a:(c.y=c.fy,c.vy=0);return e}function d(){for(var e,n=0,r=t.length;n<r;++n){if((e=t[n]).index=n,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var i=10*Math.sqrt(.5+n),o=n*Rl;e.x=i*Math.cos(o),e.y=i*Math.sin(o)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function p(e){return e.initialize&&e.initialize(t,u),e}return null==t&&(t=[]),d(),e={tick:f,restart:function(){return l.restart(h),e},stop:function(){return l.stop(),e},nodes:function(n){return arguments.length?(t=n,d(),s.forEach(p),e):t},alpha:function(t){return arguments.length?(n=+t,e):n},alphaMin:function(t){return arguments.length?(r=+t,e):r},alphaDecay:function(t){return arguments.length?(i=+t,e):+i},alphaTarget:function(t){return arguments.length?(o=+t,e):o},velocityDecay:function(t){return arguments.length?(a=1-t,e):1-a},randomSource:function(t){return arguments.length?(u=t,s.forEach(p),e):u},force:function(t,n){return arguments.length>1?(null==n?s.delete(t):s.set(t,p(n)),e):s.get(t)},find:function(e,n,r){var i,o,a,s,l,c=0,u=t.length;for(null==r?r=1/0:r*=r,c=0;c<u;++c)(a=(i=e-(s=t[c]).x)*i+(o=n-s.y)*o)<r&&(l=s,r=a);return l},on:function(t,n){return arguments.length>1?(c.on(t,n),e):c.on(t)}}}function Nl(){var t,e,n,r,i,o=vl(-30),a=1,s=1/0,l=.81;function c(n){var i,o=t.length,a=_l(t,kl,Ml).visitAfter(h);for(r=n,i=0;i<o;++i)e=t[i],a.visit(f)}function u(){if(t){var e,n,r=t.length;for(i=new Array(r),e=0;e<r;++e)n=t[e],i[n.index]=+o(n,e,t)}}function h(t){var e,n,r,o,a,s=0,l=0;if(t.length){for(r=o=a=0;a<4;++a)(e=t[a])&&(n=Math.abs(e.value))&&(s+=e.value,l+=n,r+=n*e.x,o+=n*e.y);t.x=r/l,t.y=o/l}else{(e=t).x=e.data.x,e.y=e.data.y;do{s+=i[e.data.index]}while(e=e.next)}t.value=s}function f(t,o,c,u){if(!t.value)return!0;var h=t.x-e.x,f=t.y-e.y,d=u-o,p=h*h+f*f;if(d*d/l<p)return p<s&&(0===h&&(p+=(h=xl(n))*h),0===f&&(p+=(f=xl(n))*f),p<a&&(p=Math.sqrt(a*p)),e.vx+=h*t.value*r/p,e.vy+=f*t.value*r/p),!0;if(!(t.length||p>=s)){(t.data!==e||t.next)&&(0===h&&(p+=(h=xl(n))*h),0===f&&(p+=(f=xl(n))*f),p<a&&(p=Math.sqrt(a*p)));do{t.data!==e&&(d=i[t.data.index]*r/p,e.vx+=h*d,e.vy+=f*d)}while(t=t.next)}}return c.initialize=function(e,r){t=e,n=r,u()},c.strength=function(t){return arguments.length?(o="function"==typeof t?t:vl(+t),u(),c):o},c.distanceMin=function(t){return arguments.length?(a=t*t,c):Math.sqrt(a)},c.distanceMax=function(t){return arguments.length?(s=t*t,c):Math.sqrt(s)},c.theta=function(t){return arguments.length?(l=t*t,c):Math.sqrt(l)},c}function Il(t){var e,n,r,i=vl(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vx+=(r[o]-i.x)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=vl(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:vl(+t),a(),o):i},o.x=function(e){return arguments.length?(t="function"==typeof e?e:vl(+e),a(),o):t},o}function Ll(t){var e,n,r,i=vl(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vy+=(r[o]-i.y)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=vl(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:vl(+t),a(),o):i},o.y=function(e){return arguments.length?(t="function"==typeof e?e:vl(+e),a(),o):t},o}function Pl(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Vl(t){return(t=Pl(Math.abs(t)))?t[1]:NaN}var Dl,Bl=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function zl(t){if(!(e=Bl.exec(t)))throw new Error("invalid format: "+t);var e;return new Fl({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Fl(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Gl(t,e){var n=Pl(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}zl.prototype=Fl.prototype,Fl.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var jl={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Gl(100*t,e),r:Gl,s:function(t,e){var n=Pl(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(Dl=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Pl(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ul(t){return t}var Yl,Hl,ql,Wl=Array.prototype.map,$l=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Xl(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Ul:(e=Wl.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=e[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),o.push(t.substring(i-=s,i+s)),!((l+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?Ul:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(Wl.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function h(t){var e=(t=zl(t)).fill,n=t.align,h=t.sign,f=t.symbol,d=t.zero,p=t.width,g=t.comma,_=t.precision,y=t.trim,m=t.type;"n"===m?(g=!0,m="g"):jl[m]||(void 0===_&&(_=12),y=!0,m="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var b="$"===f?i:"#"===f&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",v="$"===f?o:/[%p]/.test(m)?l:"",x=jl[m],w=/[defgprs%]/.test(m);function E(t){var i,o,l,f=b,E=v;if("c"===m)E=x(t)+E,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:x(Math.abs(t),_),y&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),A&&0===+t&&"+"!==h&&(A=!1),f=(A?"("===h?h:c:"-"===h||"("===h?"":h)+f,E=("s"===m?$l[8+Dl/3]:"")+E+(A&&"("===h?")":""),w)for(i=-1,o=t.length;++i<o;)if(48>(l=t.charCodeAt(i))||l>57){E=(46===l?a+t.slice(i+1):t.slice(i))+E,t=t.slice(0,i);break}}g&&!d&&(t=r(t,1/0));var T=f.length+t.length+E.length,S=T<p?new Array(p-T+1).join(e):"";switch(g&&d&&(t=r(S+t,S.length?p-E.length:1/0),S=""),n){case"<":t=f+t+E+S;break;case"=":t=f+S+t+E;break;case"^":t=S.slice(0,T=S.length>>1)+f+t+E+S.slice(T);break;default:t=S+f+t+E}return s(t)}return _=void 0===_?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_)),E.toString=function(){return t+""},E}return{format:h,formatPrefix:function(t,e){var n=h(((t=zl(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Vl(e)/3))),i=Math.pow(10,-r),o=$l[8+r/3];return function(t){return n(i*t)+o}}}}function Kl(t){return Yl=Xl(t),Hl=Yl.format,ql=Yl.formatPrefix,Yl}function Zl(t){return Math.max(0,-Vl(Math.abs(t)))}function Jl(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Vl(e)/3)))-Vl(Math.abs(t)))}function Ql(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Vl(e)-Vl(t))+1}Kl({thousands:",",grouping:[3],currency:["$",""]});var tc=1e-6,ec=1e-12,nc=Math.PI,rc=nc/2,ic=nc/4,oc=2*nc,ac=180/nc,sc=nc/180,lc=Math.abs,cc=Math.atan,uc=Math.atan2,hc=Math.cos,fc=Math.ceil,dc=Math.exp,pc=Math.hypot,gc=Math.log,_c=Math.pow,yc=Math.sin,mc=Math.sign||function(t){return t>0?1:t<0?-1:0},bc=Math.sqrt,vc=Math.tan;function xc(t){return t>1?0:t<-1?nc:Math.acos(t)}function wc(t){return t>1?rc:t<-1?-rc:Math.asin(t)}function Ec(t){return(t=yc(t/2))*t}function Ac(){}function Tc(t,e){t&&Cc.hasOwnProperty(t.type)&&Cc[t.type](t,e)}var Sc={Feature:function(t,e){Tc(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)Tc(n[r].geometry,e)}},Cc={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){kc(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)kc(n[r],e,0)},Polygon:function(t,e){Mc(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Mc(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)Tc(n[r],e)}};function kc(t,e,n){var r,i=-1,o=t.length-n;for(e.lineStart();++i<o;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function Mc(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)kc(t[n],e,1);e.polygonEnd()}function Rc(t,e){t&&Sc.hasOwnProperty(t.type)?Sc[t.type](t,e):Tc(t,e)}var Oc,Nc,Ic,Lc,Pc,Vc,Dc,Bc,zc,Fc,Gc,jc,Uc,Yc,Hc,qc,Wc=new w,$c=new w,Xc={point:Ac,lineStart:Ac,lineEnd:Ac,polygonStart:function(){Wc=new w,Xc.lineStart=Kc,Xc.lineEnd=Zc},polygonEnd:function(){var t=+Wc;$c.add(t<0?oc+t:t),this.lineStart=this.lineEnd=this.point=Ac},sphere:function(){$c.add(oc)}};function Kc(){Xc.point=Jc}function Zc(){Qc(Oc,Nc)}function Jc(t,e){Xc.point=Qc,Oc=t,Nc=e,Ic=t*=sc,Lc=hc(e=(e*=sc)/2+ic),Pc=yc(e)}function Qc(t,e){var n=(t*=sc)-Ic,r=n>=0?1:-1,i=r*n,o=hc(e=(e*=sc)/2+ic),a=yc(e),s=Pc*a,l=Lc*o+s*hc(i),c=s*r*yc(i);Wc.add(uc(c,l)),Ic=t,Lc=o,Pc=a}function tu(t){return[uc(t[1],t[0]),wc(t[2])]}function eu(t){var e=t[0],n=t[1],r=hc(n);return[r*hc(e),r*yc(e),yc(n)]}function nu(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ru(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function iu(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function ou(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function au(t){var e=bc(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var su,lu,cu,uu,hu,fu,du,pu,gu,_u,yu,mu,bu,vu,xu,wu,Eu={point:Au,lineStart:Su,lineEnd:Cu,polygonStart:function(){Eu.point=ku,Eu.lineStart=Mu,Eu.lineEnd=Ru,Yc=new w,Xc.polygonStart()},polygonEnd:function(){Xc.polygonEnd(),Eu.point=Au,Eu.lineStart=Su,Eu.lineEnd=Cu,Wc<0?(Vc=-(Bc=180),Dc=-(zc=90)):Yc>tc?zc=90:Yc<-1e-6&&(Dc=-90),qc[0]=Vc,qc[1]=Bc},sphere:function(){Vc=-(Bc=180),Dc=-(zc=90)}};function Au(t,e){Hc.push(qc=[Vc=t,Bc=t]),e<Dc&&(Dc=e),e>zc&&(zc=e)}function Tu(t,e){var n=eu([t*sc,e*sc]);if(Uc){var r=ru(Uc,n),i=ru([r[1],-r[0],0],r);au(i),i=tu(i);var o,a=t-Fc,s=a>0?1:-1,l=i[0]*ac*s,c=lc(a)>180;c^(s*Fc<l&&l<s*t)?(o=i[1]*ac)>zc&&(zc=o):c^(s*Fc<(l=(l+360)%360-180)&&l<s*t)?(o=-i[1]*ac)<Dc&&(Dc=o):(e<Dc&&(Dc=e),e>zc&&(zc=e)),c?t<Fc?Ou(Vc,t)>Ou(Vc,Bc)&&(Bc=t):Ou(t,Bc)>Ou(Vc,Bc)&&(Vc=t):Bc>=Vc?(t<Vc&&(Vc=t),t>Bc&&(Bc=t)):t>Fc?Ou(Vc,t)>Ou(Vc,Bc)&&(Bc=t):Ou(t,Bc)>Ou(Vc,Bc)&&(Vc=t)}else Hc.push(qc=[Vc=t,Bc=t]);e<Dc&&(Dc=e),e>zc&&(zc=e),Uc=n,Fc=t}function Su(){Eu.point=Tu}function Cu(){qc[0]=Vc,qc[1]=Bc,Eu.point=Au,Uc=null}function ku(t,e){if(Uc){var n=t-Fc;Yc.add(lc(n)>180?n+(n>0?360:-360):n)}else Gc=t,jc=e;Xc.point(t,e),Tu(t,e)}function Mu(){Xc.lineStart()}function Ru(){ku(Gc,jc),Xc.lineEnd(),lc(Yc)>tc&&(Vc=-(Bc=180)),qc[0]=Vc,qc[1]=Bc,Uc=null}function Ou(t,e){return(e-=t)<0?e+360:e}function Nu(t,e){return t[0]-e[0]}function Iu(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e<t[0]||t[1]<e}var Lu={sphere:Ac,point:Pu,lineStart:Du,lineEnd:Fu,polygonStart:function(){Lu.lineStart=Gu,Lu.lineEnd=ju},polygonEnd:function(){Lu.lineStart=Du,Lu.lineEnd=Fu}};function Pu(t,e){t*=sc;var n=hc(e*=sc);Vu(n*hc(t),n*yc(t),yc(e))}function Vu(t,e,n){++su,cu+=(t-cu)/su,uu+=(e-uu)/su,hu+=(n-hu)/su}function Du(){Lu.point=Bu}function Bu(t,e){t*=sc;var n=hc(e*=sc);vu=n*hc(t),xu=n*yc(t),wu=yc(e),Lu.point=zu,Vu(vu,xu,wu)}function zu(t,e){t*=sc;var n=hc(e*=sc),r=n*hc(t),i=n*yc(t),o=yc(e),a=uc(bc((a=xu*o-wu*i)*a+(a=wu*r-vu*o)*a+(a=vu*i-xu*r)*a),vu*r+xu*i+wu*o);lu+=a,fu+=a*(vu+(vu=r)),du+=a*(xu+(xu=i)),pu+=a*(wu+(wu=o)),Vu(vu,xu,wu)}function Fu(){Lu.point=Pu}function Gu(){Lu.point=Uu}function ju(){Yu(mu,bu),Lu.point=Pu}function Uu(t,e){mu=t,bu=e,t*=sc,e*=sc,Lu.point=Yu;var n=hc(e);vu=n*hc(t),xu=n*yc(t),wu=yc(e),Vu(vu,xu,wu)}function Yu(t,e){t*=sc;var n=hc(e*=sc),r=n*hc(t),i=n*yc(t),o=yc(e),a=xu*o-wu*i,s=wu*r-vu*o,l=vu*i-xu*r,c=pc(a,s,l),u=wc(c),h=c&&-u/c;gu.add(h*a),_u.add(h*s),yu.add(h*l),lu+=u,fu+=u*(vu+(vu=r)),du+=u*(xu+(xu=i)),pu+=u*(wu+(wu=o)),Vu(vu,xu,wu)}function Hu(t){return function(){return t}}function qu(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,r){return(n=e.invert(n,r))&&t.invert(n[0],n[1])}),n}function Wu(t,e){return lc(t)>nc&&(t-=Math.round(t/oc)*oc),[t,e]}function $u(t,e,n){return(t%=oc)?e||n?qu(Ku(t),Zu(e,n)):Ku(t):e||n?Zu(e,n):Wu}function Xu(t){return function(e,n){return lc(e+=t)>nc&&(e-=Math.round(e/oc)*oc),[e,n]}}function Ku(t){var e=Xu(t);return e.invert=Xu(-t),e}function Zu(t,e){var n=hc(t),r=yc(t),i=hc(e),o=yc(e);function a(t,e){var a=hc(e),s=hc(t)*a,l=yc(t)*a,c=yc(e),u=c*n+s*r;return[uc(l*i-u*o,s*n-c*r),wc(u*i+l*o)]}return a.invert=function(t,e){var a=hc(e),s=hc(t)*a,l=yc(t)*a,c=yc(e),u=c*i-l*o;return[uc(l*i+c*o,s*n+u*r),wc(u*n-s*r)]},a}function Ju(t){function e(e){return(e=t(e[0]*sc,e[1]*sc))[0]*=ac,e[1]*=ac,e}return t=$u(t[0]*sc,t[1]*sc,t.length>2?t[2]*sc:0),e.invert=function(e){return(e=t.invert(e[0]*sc,e[1]*sc))[0]*=ac,e[1]*=ac,e},e}function Qu(t,e,n,r,i,o){if(n){var a=hc(e),s=yc(e),l=r*n;null==i?(i=e+r*oc,o=e-l/2):(i=th(a,i),o=th(a,o),(r>0?i<o:i>o)&&(i+=r*oc));for(var c,u=i;r>0?u>o:u<o;u-=l)c=tu([a,-s*hc(u),-s*yc(u)]),t.point(c[0],c[1])}}function th(t,e){(e=eu(e))[0]-=t,au(e);var n=xc(-e[1]);return((-e[2]<0?-n:n)+oc-tc)%oc}function eh(){var t,e=[];return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:Ac,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function nh(t,e){return lc(t[0]-e[0])<tc&&lc(t[1]-e[1])<tc}function rh(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function ih(t,e,n,r,i){var o,a,s=[],l=[];if(t.forEach(function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],a=t[e];if(nh(r,a)){if(!r[2]&&!a[2]){for(i.lineStart(),o=0;o<e;++o)i.point((r=t[o])[0],r[1]);return void i.lineEnd()}a[0]+=2e-6}s.push(n=new rh(r,t,null,!0)),l.push(n.o=new rh(r,null,n,!1)),s.push(n=new rh(a,t,null,!1)),l.push(n.o=new rh(a,null,n,!0))}}),s.length){for(l.sort(e),oh(s),oh(l),o=0,a=l.length;o<a;++o)l[o].e=n=!n;for(var c,u,h=s[0];;){for(var f=h,d=!0;f.v;)if((f=f.n)===h)return;c=f.z,i.lineStart();do{if(f.v=f.o.v=!0,f.e){if(d)for(o=0,a=c.length;o<a;++o)i.point((u=c[o])[0],u[1]);else r(f.x,f.n.x,1,i);f=f.n}else{if(d)for(c=f.p.z,o=c.length-1;o>=0;--o)i.point((u=c[o])[0],u[1]);else r(f.x,f.p.x,-1,i);f=f.p}c=(f=f.o).z,d=!d}while(!f.v);i.lineEnd()}}}function oh(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}function ah(t){return lc(t[0])<=nc?t[0]:mc(t[0])*((lc(t[0])+nc)%oc-nc)}function sh(t,e){var n=ah(e),r=e[1],i=yc(r),o=[yc(n),-hc(n),0],a=0,s=0,l=new w;1===i?r=rc+tc:-1===i&&(r=-rc-tc);for(var c=0,u=t.length;c<u;++c)if(f=(h=t[c]).length)for(var h,f,d=h[f-1],p=ah(d),g=d[1]/2+ic,_=yc(g),y=hc(g),m=0;m<f;++m,p=v,_=E,y=A,d=b){var b=h[m],v=ah(b),x=b[1]/2+ic,E=yc(x),A=hc(x),T=v-p,S=T>=0?1:-1,C=S*T,k=C>nc,M=_*E;if(l.add(uc(M*S*yc(C),y*A+M*hc(C))),a+=k?T+S*oc:T,k^p>=n^v>=n){var R=ru(eu(d),eu(b));au(R);var O=ru(o,R);au(O);var N=(k^T>=0?-1:1)*wc(O[2]);(r>N||r===N&&(R[0]||R[1]))&&(s+=k^T>=0?1:-1)}}return(a<-1e-6||a<tc&&l<-1e-12)^1&s}function lh(t,e,n,r){return function(i){var o,a,s,l=e(i),c=eh(),u=e(c),h=!1,f={point:d,lineStart:g,lineEnd:_,polygonStart:function(){f.point=y,f.lineStart=m,f.lineEnd=b,a=[],o=[]},polygonEnd:function(){f.point=d,f.lineStart=g,f.lineEnd=_,a=ht(a);var t=sh(o,r);a.length?(h||(i.polygonStart(),h=!0),ih(a,uh,t,n,i)):t&&(h||(i.polygonStart(),h=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),h&&(i.polygonEnd(),h=!1),a=o=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(e,n){t(e,n)&&i.point(e,n)}function p(t,e){l.point(t,e)}function g(){f.point=p,l.lineStart()}function _(){f.point=d,l.lineEnd()}function y(t,e){s.push([t,e]),u.point(t,e)}function m(){u.lineStart(),s=[]}function b(){y(s[0][0],s[0][1]),u.lineEnd();var t,e,n,r,l=u.clean(),f=c.result(),d=f.length;if(s.pop(),o.push(s),s=null,d)if(1&l){if((e=(n=f[0]).length-1)>0){for(h||(i.polygonStart(),h=!0),i.lineStart(),t=0;t<e;++t)i.point((r=n[t])[0],r[1]);i.lineEnd()}}else d>1&&2&l&&f.push(f.pop().concat(f.shift())),a.push(f.filter(ch))}return f}}function ch(t){return t.length>1}function uh(t,e){return((t=t.x)[0]<0?t[1]-rc-tc:rc-t[1])-((e=e.x)[0]<0?e[1]-rc-tc:rc-e[1])}Wu.invert=Wu;var hh=lh(function(){return!0},function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?nc:-nc,l=lc(o-n);lc(l-nc)<tc?(t.point(n,r=(r+a)/2>0?rc:-rc),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(o,r),e=0):i!==s&&l>=nc&&(lc(n-i)<tc&&(n-=i*tc),lc(o-s)<tc&&(o-=s*tc),r=function(t,e,n,r){var i,o,a=yc(t-n);return lc(a)>tc?cc((yc(e)*(o=hc(r))*yc(n)-yc(r)*(i=hc(e))*yc(t))/(i*o*a)):(e+r)/2}(n,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),e=0),t.point(n=o,r=a),i=s},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}},function(t,e,n,r){var i;if(null==t)i=n*rc,r.point(-nc,i),r.point(0,i),r.point(nc,i),r.point(nc,0),r.point(nc,-i),r.point(0,-i),r.point(-nc,-i),r.point(-nc,0),r.point(-nc,i);else if(lc(t[0]-e[0])>tc){var o=t[0]<e[0]?nc:-nc;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(e[0],e[1])},[-nc,-rc]);function fh(t){var e=hc(t),n=2*sc,r=e>0,i=lc(e)>tc;function o(t,n){return hc(t)*hc(n)>e}function a(t,n,r){var i=[1,0,0],o=ru(eu(t),eu(n)),a=nu(o,o),s=o[0],l=a-s*s;if(!l)return!r&&t;var c=e*a/l,u=-e*s/l,h=ru(i,o),f=ou(i,c);iu(f,ou(o,u));var d=h,p=nu(f,d),g=nu(d,d),_=p*p-g*(nu(f,f)-1);if(!(_<0)){var y=bc(_),m=ou(d,(-p-y)/g);if(iu(m,f),m=tu(m),!r)return m;var b,v=t[0],x=n[0],w=t[1],E=n[1];x<v&&(b=v,v=x,x=b);var A=x-v,T=lc(A-nc)<tc;if(!T&&E<w&&(b=w,w=E,E=b),T||A<tc?T?w+E>0^m[1]<(lc(m[0]-v)<tc?w:E):w<=m[1]&&m[1]<=E:A>nc^(v<=m[0]&&m[0]<=x)){var S=ou(d,(-p+y)/g);return iu(S,f),[m,tu(S)]}}}function s(e,n){var i=r?t:nc-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return lh(o,function(t){var e,n,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(h,f){var d,p=[h,f],g=o(h,f),_=r?g?0:s(h,f):g?s(h+(h<0?nc:-nc),f):0;if(!e&&(c=l=g)&&t.lineStart(),g!==l&&(!(d=a(e,p))||nh(e,d)||nh(p,d))&&(p[2]=1),g!==l)u=0,g?(t.lineStart(),d=a(p,e),t.point(d[0],d[1])):(d=a(e,p),t.point(d[0],d[1],2),t.lineEnd()),e=d;else if(i&&e&&r^g){var y;_&n||!(y=a(p,e,!0))||(u=0,r?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!g||e&&nh(e,p)||t.point(p[0],p[1]),e=p,l=g,n=_},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return u|(c&&l)<<1}}},function(e,r,i,o){Qu(o,t,n,i,e,r)},r?[0,-t]:[-nc,t-nc])}var dh,ph,gh,_h,yh=1e9,mh=-yh;function bh(t,e,n,r){function i(i,o){return t<=i&&i<=n&&e<=o&&o<=r}function o(i,o,s,c){var u=0,h=0;if(null==i||(u=a(i,s))!==(h=a(o,s))||l(i,o)<0^s>0)do{c.point(0===u||3===u?t:n,u>1?r:e)}while((u=(u+s+4)%4)!==h);else c.point(o[0],o[1])}function a(r,i){return lc(r[0]-t)<tc?i>0?0:3:lc(r[0]-n)<tc?i>0?2:1:lc(r[1]-e)<tc?i>0?1:0:i>0?3:2}function s(t,e){return l(t.x,e.x)}function l(t,e){var n=a(t,1),r=a(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(a){var l,c,u,h,f,d,p,g,_,y,m,b=a,v=eh(),x={point:w,lineStart:function(){x.point=E,c&&c.push(u=[]);y=!0,_=!1,p=g=NaN},lineEnd:function(){l&&(E(h,f),d&&_&&v.rejoin(),l.push(v.result()));x.point=w,_&&b.lineEnd()},polygonStart:function(){b=v,l=[],c=[],m=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=c.length;n<i;++n)for(var o,a,s=c[n],l=1,u=s.length,h=s[0],f=h[0],d=h[1];l<u;++l)o=f,a=d,f=(h=s[l])[0],d=h[1],a<=r?d>r&&(f-o)*(r-a)>(d-a)*(t-o)&&++e:d<=r&&(f-o)*(r-a)<(d-a)*(t-o)&&--e;return e}(),n=m&&e,i=(l=ht(l)).length;(n||i)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&ih(l,s,e,o,a),a.polygonEnd());b=a,l=c=u=null}};function w(t,e){i(t,e)&&b.point(t,e)}function E(o,a){var s=i(o,a);if(c&&u.push([o,a]),y)h=o,f=a,d=s,y=!1,s&&(b.lineStart(),b.point(o,a));else if(s&&_)b.point(o,a);else{var l=[p=Math.max(mh,Math.min(yh,p)),g=Math.max(mh,Math.min(yh,g))],v=[o=Math.max(mh,Math.min(yh,o)),a=Math.max(mh,Math.min(yh,a))];!function(t,e,n,r,i,o){var a,s=t[0],l=t[1],c=0,u=1,h=e[0]-s,f=e[1]-l;if(a=n-s,h||!(a>0)){if(a/=h,h<0){if(a<c)return;a<u&&(u=a)}else if(h>0){if(a>u)return;a>c&&(c=a)}if(a=i-s,h||!(a<0)){if(a/=h,h<0){if(a>u)return;a>c&&(c=a)}else if(h>0){if(a<c)return;a<u&&(u=a)}if(a=r-l,f||!(a>0)){if(a/=f,f<0){if(a<c)return;a<u&&(u=a)}else if(f>0){if(a>u)return;a>c&&(c=a)}if(a=o-l,f||!(a<0)){if(a/=f,f<0){if(a>u)return;a>c&&(c=a)}else if(f>0){if(a<c)return;a<u&&(u=a)}return c>0&&(t[0]=s+c*h,t[1]=l+c*f),u<1&&(e[0]=s+u*h,e[1]=l+u*f),!0}}}}}(l,v,t,e,n,r)?s&&(b.lineStart(),b.point(o,a),m=!1):(_||(b.lineStart(),b.point(l[0],l[1])),b.point(v[0],v[1]),s||b.lineEnd(),m=!1)}p=o,g=a,_=s}return x}}var vh={sphere:Ac,point:Ac,lineStart:function(){vh.point=wh,vh.lineEnd=xh},lineEnd:Ac,polygonStart:Ac,polygonEnd:Ac};function xh(){vh.point=vh.lineEnd=Ac}function wh(t,e){ph=t*=sc,gh=yc(e*=sc),_h=hc(e),vh.point=Eh}function Eh(t,e){t*=sc;var n=yc(e*=sc),r=hc(e),i=lc(t-ph),o=hc(i),a=r*yc(i),s=_h*n-gh*r*o,l=gh*n+_h*r*o;dh.add(uc(bc(a*a+s*s),l)),ph=t,gh=n,_h=r}function Ah(t){return dh=new w,Rc(t,vh),+dh}var Th=[null,null],Sh={type:"LineString",coordinates:Th};function Ch(t,e){return Th[0]=t,Th[1]=e,Ah(Sh)}var kh={Feature:function(t,e){return Rh(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)if(Rh(n[r].geometry,e))return!0;return!1}},Mh={Sphere:function(){return!0},Point:function(t,e){return Oh(t.coordinates,e)},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)if(Oh(n[r],e))return!0;return!1},LineString:function(t,e){return Nh(t.coordinates,e)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)if(Nh(n[r],e))return!0;return!1},Polygon:function(t,e){return Ih(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)if(Ih(n[r],e))return!0;return!1},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)if(Rh(n[r],e))return!0;return!1}};function Rh(t,e){return!(!t||!Mh.hasOwnProperty(t.type))&&Mh[t.type](t,e)}function Oh(t,e){return 0===Ch(t,e)}function Nh(t,e){for(var n,r,i,o=0,a=t.length;o<a;o++){if(0===(r=Ch(t[o],e)))return!0;if(o>0&&(i=Ch(t[o],t[o-1]))>0&&n<=i&&r<=i&&(n+r-i)*(1-Math.pow((n-r)/i,2))<ec*i)return!0;n=r}return!1}function Ih(t,e){return!!sh(t.map(Lh),Ph(e))}function Lh(t){return(t=t.map(Ph)).pop(),t}function Ph(t){return[t[0]*sc,t[1]*sc]}function Vh(t,e,n){var r=dt(t,e-tc,n).concat(e);return function(t){return r.map(function(e){return[t,e]})}}function Dh(t,e,n){var r=dt(t,e-tc,n).concat(e);return function(t){return r.map(function(e){return[e,t]})}}function Bh(){var t,e,n,r,i,o,a,s,l,c,u,h,f=10,d=f,p=90,g=360,_=2.5;function y(){return{type:"MultiLineString",coordinates:m()}}function m(){return dt(fc(r/p)*p,n,p).map(u).concat(dt(fc(s/g)*g,a,g).map(h)).concat(dt(fc(e/f)*f,t,f).filter(function(t){return lc(t%p)>tc}).map(l)).concat(dt(fc(o/d)*d,i,d).filter(function(t){return lc(t%g)>tc}).map(c))}return y.lines=function(){return m().map(function(t){return{type:"LineString",coordinates:t}})},y.outline=function(){return{type:"Polygon",coordinates:[u(r).concat(h(a).slice(1),u(n).reverse().slice(1),h(s).reverse().slice(1))]}},y.extent=function(t){return arguments.length?y.extentMajor(t).extentMinor(t):y.extentMinor()},y.extentMajor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],s=+t[0][1],a=+t[1][1],r>n&&(t=r,r=n,n=t),s>a&&(t=s,s=a,a=t),y.precision(_)):[[r,s],[n,a]]},y.extentMinor=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],o=+n[0][1],i=+n[1][1],e>t&&(n=e,e=t,t=n),o>i&&(n=o,o=i,i=n),y.precision(_)):[[e,o],[t,i]]},y.step=function(t){return arguments.length?y.stepMajor(t).stepMinor(t):y.stepMinor()},y.stepMajor=function(t){return arguments.length?(p=+t[0],g=+t[1],y):[p,g]},y.stepMinor=function(t){return arguments.length?(f=+t[0],d=+t[1],y):[f,d]},y.precision=function(f){return arguments.length?(_=+f,l=Vh(o,i,90),c=Dh(e,t,_),u=Vh(s,a,90),h=Dh(r,n,_),y):_},y.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}var zh,Fh,Gh,jh,Uh=t=>t,Yh=new w,Hh=new w,qh={point:Ac,lineStart:Ac,lineEnd:Ac,polygonStart:function(){qh.lineStart=Wh,qh.lineEnd=Kh},polygonEnd:function(){qh.lineStart=qh.lineEnd=qh.point=Ac,Yh.add(lc(Hh)),Hh=new w},result:function(){var t=Yh/2;return Yh=new w,t}};function Wh(){qh.point=$h}function $h(t,e){qh.point=Xh,zh=Gh=t,Fh=jh=e}function Xh(t,e){Hh.add(jh*t-Gh*e),Gh=t,jh=e}function Kh(){Xh(zh,Fh)}var Zh=1/0,Jh=Zh,Qh=-Zh,tf=Qh,ef={point:function(t,e){t<Zh&&(Zh=t);t>Qh&&(Qh=t);e<Jh&&(Jh=e);e>tf&&(tf=e)},lineStart:Ac,lineEnd:Ac,polygonStart:Ac,polygonEnd:Ac,result:function(){var t=[[Zh,Jh],[Qh,tf]];return Qh=tf=-(Jh=Zh=1/0),t}};var nf,rf,of,af,sf=0,lf=0,cf=0,uf=0,hf=0,ff=0,df=0,pf=0,gf=0,_f={point:yf,lineStart:mf,lineEnd:xf,polygonStart:function(){_f.lineStart=wf,_f.lineEnd=Ef},polygonEnd:function(){_f.point=yf,_f.lineStart=mf,_f.lineEnd=xf},result:function(){var t=gf?[df/gf,pf/gf]:ff?[uf/ff,hf/ff]:cf?[sf/cf,lf/cf]:[NaN,NaN];return sf=lf=cf=uf=hf=ff=df=pf=gf=0,t}};function yf(t,e){sf+=t,lf+=e,++cf}function mf(){_f.point=bf}function bf(t,e){_f.point=vf,yf(of=t,af=e)}function vf(t,e){var n=t-of,r=e-af,i=bc(n*n+r*r);uf+=i*(of+t)/2,hf+=i*(af+e)/2,ff+=i,yf(of=t,af=e)}function xf(){_f.point=yf}function wf(){_f.point=Af}function Ef(){Tf(nf,rf)}function Af(t,e){_f.point=Tf,yf(nf=of=t,rf=af=e)}function Tf(t,e){var n=t-of,r=e-af,i=bc(n*n+r*r);uf+=i*(of+t)/2,hf+=i*(af+e)/2,ff+=i,df+=(i=af*t-of*e)*(of+t),pf+=i*(af+e),gf+=3*i,yf(of=t,af=e)}function Sf(t){this._context=t}Sf.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,oc)}},result:Ac};var Cf,kf,Mf,Rf,Of,Nf=new w,If={point:Ac,lineStart:function(){If.point=Lf},lineEnd:function(){Cf&&Pf(kf,Mf),If.point=Ac},polygonStart:function(){Cf=!0},polygonEnd:function(){Cf=null},result:function(){var t=+Nf;return Nf=new w,t}};function Lf(t,e){If.point=Pf,kf=Rf=t,Mf=Of=e}function Pf(t,e){Rf-=t,Of-=e,Nf.add(bc(Rf*Rf+Of*Of)),Rf=t,Of=e}let Vf,Df,Bf,zf;class Ff{constructor(t){this._append=null==t?Gf:function(t){const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return Gf;if(e!==Vf){const t=10**e;Vf=e,Df=function(e){let n=1;this._+=e[0];for(const r=e.length;n<r;++n)this._+=Math.round(arguments[n]*t)/t+e[n]}}return Df}(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(t,e){switch(this._point){case 0:this._append`M${t},${e}`,this._point=1;break;case 1:this._append`L${t},${e}`;break;default:if(this._append`M${t},${e}`,this._radius!==Bf||this._append!==Df){const t=this._radius,e=this._;this._="",this._append`m0,${t}a${t},${t} 0 1,1 0,${-2*t}a${t},${t} 0 1,1 0,${2*t}z`,Bf=t,Df=this._append,zf=this._,this._=e}this._+=zf}}result(){const t=this._;return this._="",t.length?t:null}}function Gf(t){let e=1;this._+=t[0];for(const n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function jf(t){return function(e){var n=new Uf;for(var r in t)n[r]=t[r];return n.stream=e,n}}function Uf(){}function Yf(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),Rc(n,t.stream(ef)),e(ef.result()),null!=r&&t.clipExtent(r),t}function Hf(t,e,n){return Yf(t,function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,s=+e[0][1]+(i-o*(n[1][1]+n[0][1]))/2;t.scale(150*o).translate([a,s])},n)}function qf(t,e,n){return Hf(t,[[0,0],e],n)}function Wf(t,e,n){return Yf(t,function(n){var r=+e,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];t.scale(150*i).translate([o,a])},n)}function $f(t,e,n){return Yf(t,function(n){var r=+e,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([o,a])},n)}Uf.prototype={constructor:Uf,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Xf=hc(30*sc);function Kf(t,e){return+e?function(t,e){function n(r,i,o,a,s,l,c,u,h,f,d,p,g,_){var y=c-r,m=u-i,b=y*y+m*m;if(b>4*e&&g--){var v=a+f,x=s+d,w=l+p,E=bc(v*v+x*x+w*w),A=wc(w/=E),T=lc(lc(w)-1)<tc||lc(o-h)<tc?(o+h)/2:uc(x,v),S=t(T,A),C=S[0],k=S[1],M=C-r,R=k-i,O=m*M-y*R;(O*O/b>e||lc((y*M+m*R)/b-.5)>.3||a*f+s*d+l*p<Xf)&&(n(r,i,o,a,s,l,C,k,T,v/=E,x/=E,w,g,_),_.point(C,k),n(C,k,T,v,x,w,c,u,h,f,d,p,g,_))}}return function(e){var r,i,o,a,s,l,c,u,h,f,d,p,g={point:_,lineStart:y,lineEnd:b,polygonStart:function(){e.polygonStart(),g.lineStart=v},polygonEnd:function(){e.polygonEnd(),g.lineStart=y}};function _(n,r){n=t(n,r),e.point(n[0],n[1])}function y(){u=NaN,g.point=m,e.lineStart()}function m(r,i){var o=eu([r,i]),a=t(r,i);n(u,h,c,f,d,p,u=a[0],h=a[1],c=r,f=o[0],d=o[1],p=o[2],16,e),e.point(u,h)}function b(){g.point=_,e.lineEnd()}function v(){y(),g.point=x,g.lineEnd=w}function x(t,e){m(r=t,e),i=u,o=h,a=f,s=d,l=p,g.point=m}function w(){n(u,h,c,f,d,p,i,o,r,a,s,l,16,e),g.lineEnd=b,b()}return g}}(t,e):function(t){return jf({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)}var Zf=jf({point:function(t,e){this.stream.point(t*sc,e*sc)}});function Jf(t,e,n,r,i,o){if(!o)return function(t,e,n,r,i){function o(o,a){return[e+t*(o*=r),n-t*(a*=i)]}return o.invert=function(o,a){return[(o-e)/t*r,(n-a)/t*i]},o}(t,e,n,r,i);var a=hc(o),s=yc(o),l=a*t,c=s*t,u=a/t,h=s/t,f=(s*n-a*e)/t,d=(s*e+a*n)/t;function p(t,o){return[l*(t*=r)-c*(o*=i)+e,n-c*t-l*o]}return p.invert=function(t,e){return[r*(u*t-h*e+f),i*(d-h*t-u*e)]},p}function Qf(t){return td(function(){return t})()}function td(t){var e,n,r,i,o,a,s,l,c,u,h=150,f=480,d=250,p=0,g=0,_=0,y=0,m=0,b=0,v=1,x=1,w=null,E=hh,A=null,T=Uh,S=.5;function C(t){return l(t[0]*sc,t[1]*sc)}function k(t){return(t=l.invert(t[0],t[1]))&&[t[0]*ac,t[1]*ac]}function M(){var t=Jf(h,0,0,v,x,b).apply(null,e(p,g)),r=Jf(h,f-t[0],d-t[1],v,x,b);return n=$u(_,y,m),s=qu(e,r),l=qu(n,s),a=Kf(s,S),R()}function R(){return c=u=null,C}return C.stream=function(t){return c&&u===t?c:c=Zf(function(t){return jf({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}(n)(E(a(T(u=t)))))},C.preclip=function(t){return arguments.length?(E=t,w=void 0,R()):E},C.postclip=function(t){return arguments.length?(T=t,A=r=i=o=null,R()):T},C.clipAngle=function(t){return arguments.length?(E=+t?fh(w=t*sc):(w=null,hh),R()):w*ac},C.clipExtent=function(t){return arguments.length?(T=null==t?(A=r=i=o=null,Uh):bh(A=+t[0][0],r=+t[0][1],i=+t[1][0],o=+t[1][1]),R()):null==A?null:[[A,r],[i,o]]},C.scale=function(t){return arguments.length?(h=+t,M()):h},C.translate=function(t){return arguments.length?(f=+t[0],d=+t[1],M()):[f,d]},C.center=function(t){return arguments.length?(p=t[0]%360*sc,g=t[1]%360*sc,M()):[p*ac,g*ac]},C.rotate=function(t){return arguments.length?(_=t[0]%360*sc,y=t[1]%360*sc,m=t.length>2?t[2]%360*sc:0,M()):[_*ac,y*ac,m*ac]},C.angle=function(t){return arguments.length?(b=t%360*sc,M()):b*ac},C.reflectX=function(t){return arguments.length?(v=t?-1:1,M()):v<0},C.reflectY=function(t){return arguments.length?(x=t?-1:1,M()):x<0},C.precision=function(t){return arguments.length?(a=Kf(s,S=t*t),R()):bc(S)},C.fitExtent=function(t,e){return Hf(C,t,e)},C.fitSize=function(t,e){return qf(C,t,e)},C.fitWidth=function(t,e){return Wf(C,t,e)},C.fitHeight=function(t,e){return $f(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&k,M()}}function ed(t){var e=0,n=nc/3,r=td(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*sc,n=t[1]*sc):[e*ac,n*ac]},i}function nd(t,e){var n=yc(t),r=(n+yc(e))/2;if(lc(r)<tc)return function(t){var e=hc(t);function n(t,n){return[t*e,yc(n)/e]}return n.invert=function(t,n){return[t/e,wc(n*e)]},n}(t);var i=1+n*(2*r-n),o=bc(i)/r;function a(t,e){var n=bc(i-2*r*yc(e))/r;return[n*yc(t*=r),o-n*hc(t)]}return a.invert=function(t,e){var n=o-e,a=uc(t,lc(n))*mc(n);return n*r<0&&(a-=nc*mc(t)*mc(n)),[a/r,wc((i-(t*t+n*n)*r*r)/(2*r))]},a}function rd(){return ed(nd).scale(155.424).center([0,33.6442])}function id(){return rd().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function od(t){return function(e,n){var r=hc(e),i=hc(n),o=t(r*i);return o===1/0?[2,0]:[o*i*yc(e),o*yc(n)]}}function ad(t){return function(e,n){var r=bc(e*e+n*n),i=t(r),o=yc(i),a=hc(i);return[uc(e*o,r*a),wc(r&&n*o/r)]}}var sd=od(function(t){return bc(2/(1+t))});sd.invert=ad(function(t){return 2*wc(t/2)});var ld=od(function(t){return(t=xc(t))&&t/yc(t)});function cd(t,e){return[t,gc(vc((rc+e)/2))]}function ud(t){var e,n,r,i=Qf(t),o=i.center,a=i.scale,s=i.translate,l=i.clipExtent,c=null;function u(){var o=nc*a(),s=i(Ju(i.rotate()).invert([0,0]));return l(null==c?[[s[0]-o,s[1]-o],[s[0]+o,s[1]+o]]:t===cd?[[Math.max(s[0]-o,c),e],[Math.min(s[0]+o,n),r]]:[[c,Math.max(s[1]-o,e)],[n,Math.min(s[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),u()):a()},i.translate=function(t){return arguments.length?(s(t),u()):s()},i.center=function(t){return arguments.length?(o(t),u()):o()},i.clipExtent=function(t){return arguments.length?(null==t?c=e=n=r=null:(c=+t[0][0],e=+t[0][1],n=+t[1][0],r=+t[1][1]),u()):null==c?null:[[c,e],[n,r]]},u()}function hd(t){return vc((rc+t)/2)}function fd(t,e){var n=hc(t),r=t===e?yc(t):gc(n/hc(e))/gc(hd(e)/hd(t)),i=n*_c(hd(t),r)/r;if(!r)return cd;function o(t,e){i>0?e<-rc+tc&&(e=-rc+tc):e>rc-tc&&(e=rc-tc);var n=i/_c(hd(e),r);return[n*yc(r*t),i-n*hc(r*t)]}return o.invert=function(t,e){var n=i-e,o=mc(r)*bc(t*t+n*n),a=uc(t,lc(n))*mc(n);return n*r<0&&(a-=nc*mc(t)*mc(n)),[a/r,2*cc(_c(i/o,1/r))-rc]},o}function dd(t,e){return[t,e]}function pd(t,e){var n=hc(t),r=t===e?yc(t):(n-hc(e))/(e-t),i=n/r+t;if(lc(r)<tc)return dd;function o(t,e){var n=i-e,o=r*t;return[n*yc(o),i-n*hc(o)]}return o.invert=function(t,e){var n=i-e,o=uc(t,lc(n))*mc(n);return n*r<0&&(o-=nc*mc(t)*mc(n)),[o/r,i-mc(r)*bc(t*t+n*n)]},o}ld.invert=ad(function(t){return t}),cd.invert=function(t,e){return[t,2*cc(dc(e))-rc]},dd.invert=dd;var gd=1.340264,_d=-.081106,yd=893e-6,md=.003796,bd=bc(3)/2;function vd(t,e){var n=wc(bd*yc(e)),r=n*n,i=r*r*r;return[t*hc(n)/(bd*(gd+3*_d*r+i*(7*yd+9*md*r))),n*(gd+_d*r+i*(yd+md*r))]}function xd(t,e){var n=hc(e),r=hc(t)*n;return[n*yc(t)/r,yc(e)/r]}function wd(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),e*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}function Ed(t,e){return[hc(e)*yc(t),yc(e)]}function Ad(t,e){var n=hc(e),r=1+hc(t)*n;return[n*yc(t)/r,yc(e)/r]}function Td(t,e){return[gc(vc((rc+e)/2)),-t]}function Sd(t,e){return t.parent===e.parent?1:2}function Cd(t,e){return t+e.x}function kd(t,e){return Math.max(t,e.y)}function Md(){var t=Sd,e=1,n=1,r=!1;function i(i){var o,a=0;i.eachAfter(function(e){var n=e.children;n?(e.x=function(t){return t.reduce(Cd,0)/t.length}(n),e.y=function(t){return 1+t.reduce(kd,0)}(n)):(e.x=o?a+=t(e,o):0,e.y=0,o=e)});var s=function(t){for(var e;e=t.children;)t=e[0];return t}(i),l=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(i),c=s.x-t(s,l)/2,u=l.x+t(l,s)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*e,t.y=(i.y-t.y)*n}:function(t){t.x=(t.x-c)/(u-c)*e,t.y=(1-(i.y?t.y/i.y:1))*n})}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}function Rd(t){var e=0,n=t.children,r=n&&n.length;if(r)for(;--r>=0;)e+=n[r].value;else e=1;t.value=e}function Od(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=Id)):void 0===e&&(e=Nd);for(var n,r,i,o,a,s=new Vd(t),l=[s];n=l.pop();)if((i=e(n.data))&&(a=(i=Array.from(i)).length))for(n.children=i,o=a-1;o>=0;--o)l.push(r=i[o]=new Vd(i[o])),r.parent=n,r.depth=n.depth+1;return s.eachBefore(Pd)}function Nd(t){return t.children}function Id(t){return Array.isArray(t)?t[1]:null}function Ld(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function Pd(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function Vd(t){this.data=t,this.depth=this.height=0,this.parent=null}function Dd(t){return null==t?null:Bd(t)}function Bd(t){if("function"!=typeof t)throw new Error;return t}function zd(){return 0}function Fd(t){return function(){return t}}vd.invert=function(t,e){for(var n,r=e,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=n=(r*(gd+_d*i+o*(yd+md*i))-e)/(gd+3*_d*i+o*(7*yd+9*md*i)))*r)*i*i,!(lc(n)<ec));++a);return[bd*t*(gd+3*_d*i+o*(7*yd+9*md*i))/hc(r),wc(yc(r)/bd)]},xd.invert=ad(cc),wd.invert=function(t,e){var n,r=e,i=25;do{var o=r*r,a=o*o;r-=n=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-e)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(lc(n)>tc&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},Ed.invert=ad(wc),Ad.invert=ad(function(t){return 2*cc(t)}),Td.invert=function(t,e){return[-e,2*cc(dc(t))-rc]},Vd.prototype=Od.prototype={constructor:Vd,count:function(){return this.eachAfter(Rd)},each:function(t,e){let n=-1;for(const r of this)t.call(e,r,++n,this);return this},eachAfter:function(t,e){for(var n,r,i,o=this,a=[o],s=[],l=-1;o=a.pop();)if(s.push(o),n=o.children)for(r=0,i=n.length;r<i;++r)a.push(n[r]);for(;o=s.pop();)t.call(e,o,++l,this);return this},eachBefore:function(t,e){for(var n,r,i=this,o=[i],a=-1;i=o.pop();)if(t.call(e,i,++a,this),n=i.children)for(r=n.length-1;r>=0;--r)o.push(n[r]);return this},find:function(t,e){let n=-1;for(const r of this)if(t.call(e,r,++n,this))return r},sum:function(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n})},sort:function(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;t=n.pop(),e=r.pop();for(;t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t},links:function(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e},copy:function(){return Od(this).eachBefore(Ld)},[Symbol.iterator]:function*(){var t,e,n,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,e=i.children)for(n=0,r=e.length;n<r;++n)o.push(e[n])}while(o.length)}};const Gd=4294967296;function jd(){let t=1;return()=>(t=(1664525*t+1013904223)%Gd)/Gd}function Ud(t,e){for(var n,r,i=0,o=(t=function(t,e){let n,r,i=t.length;for(;i;)r=e()*i--|0,n=t[i],t[i]=t[r],t[r]=n;return t}(Array.from(t),e)).length,a=[];i<o;)n=t[i],r&&qd(r,n)?++i:(r=$d(a=Yd(a,n)),i=0);return r}function Yd(t,e){var n,r;if(Wd(e,t))return[e];for(n=0;n<t.length;++n)if(Hd(e,t[n])&&Wd(Xd(t[n],e),t))return[t[n],e];for(n=0;n<t.length-1;++n)for(r=n+1;r<t.length;++r)if(Hd(Xd(t[n],t[r]),e)&&Hd(Xd(t[n],e),t[r])&&Hd(Xd(t[r],e),t[n])&&Wd(Kd(t[n],t[r],e),t))return[t[n],t[r],e];throw new Error}function Hd(t,e){var n=t.r-e.r,r=e.x-t.x,i=e.y-t.y;return n<0||n*n<r*r+i*i}function qd(t,e){var n=t.r-e.r+1e-9*Math.max(t.r,e.r,1),r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function Wd(t,e){for(var n=0;n<e.length;++n)if(!qd(t,e[n]))return!1;return!0}function $d(t){switch(t.length){case 1:return function(t){return{x:t.x,y:t.y,r:t.r}}(t[0]);case 2:return Xd(t[0],t[1]);case 3:return Kd(t[0],t[1],t[2])}}function Xd(t,e){var n=t.x,r=t.y,i=t.r,o=e.x,a=e.y,s=e.r,l=o-n,c=a-r,u=s-i,h=Math.sqrt(l*l+c*c);return{x:(n+o+l/h*u)/2,y:(r+a+c/h*u)/2,r:(h+i+s)/2}}function Kd(t,e,n){var r=t.x,i=t.y,o=t.r,a=e.x,s=e.y,l=e.r,c=n.x,u=n.y,h=n.r,f=r-a,d=r-c,p=i-s,g=i-u,_=l-o,y=h-o,m=r*r+i*i-o*o,b=m-a*a-s*s+l*l,v=m-c*c-u*u+h*h,x=d*p-f*g,w=(p*v-g*b)/(2*x)-r,E=(g*_-p*y)/x,A=(d*b-f*v)/(2*x)-i,T=(f*y-d*_)/x,S=E*E+T*T-1,C=2*(o+w*E+A*T),k=w*w+A*A-o*o,M=-(Math.abs(S)>1e-6?(C+Math.sqrt(C*C-4*S*k))/(2*S):k/C);return{x:r+w+E*M,y:i+A+T*M,r:M}}function Zd(t,e,n){var r,i,o,a,s=t.x-e.x,l=t.y-e.y,c=s*s+l*l;c?(i=e.r+n.r,i*=i,a=t.r+n.r,i>(a*=a)?(r=(c+a-i)/(2*c),o=Math.sqrt(Math.max(0,a/c-r*r)),n.x=t.x-r*s-o*l,n.y=t.y-r*l+o*s):(r=(c+i-a)/(2*c),o=Math.sqrt(Math.max(0,i/c-r*r)),n.x=e.x+r*s-o*l,n.y=e.y+r*l+o*s)):(n.x=e.x+n.r,n.y=e.y)}function Jd(t,e){var n=t.r+e.r-1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function Qd(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,o=(e.y*n.r+n.y*e.r)/r;return i*i+o*o}function tp(t){this._=t,this.next=null,this.previous=null}function ep(t,e){if(!(o=(t=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(t)).length))return 0;var n,r,i,o,a,s,l,c,u,h,f;if((n=t[0]).x=0,n.y=0,!(o>1))return n.r;if(r=t[1],n.x=-r.r,r.x=n.r,r.y=0,!(o>2))return n.r+r.r;Zd(r,n,i=t[2]),n=new tp(n),r=new tp(r),i=new tp(i),n.next=i.previous=r,r.next=n.previous=i,i.next=r.previous=n;t:for(l=3;l<o;++l){Zd(n._,r._,i=t[l]),i=new tp(i),c=r.next,u=n.previous,h=r._.r,f=n._.r;do{if(h<=f){if(Jd(c._,i._)){r=c,n.next=r,r.previous=n,--l;continue t}h+=c._.r,c=c.next}else{if(Jd(u._,i._)){(n=u).next=r,r.previous=n,--l;continue t}f+=u._.r,u=u.previous}}while(c!==u.next);for(i.previous=n,i.next=r,n.next=r.previous=r=i,a=Qd(n);(i=i.next)!==r;)(s=Qd(i))<a&&(n=i,a=s);r=n.next}for(n=[r._],i=r;(i=i.next)!==r;)n.push(i._);for(i=Ud(n,e),l=0;l<o;++l)(n=t[l]).x-=i.x,n.y-=i.y;return i.r}function np(t){return Math.sqrt(t.value)}function rp(){var t=null,e=1,n=1,r=zd;function i(i){const o=jd();return i.x=e/2,i.y=n/2,t?i.eachBefore(ip(t)).eachAfter(op(r,.5,o)).eachBefore(ap(1)):i.eachBefore(ip(np)).eachAfter(op(zd,1,o)).eachAfter(op(r,i.r/Math.min(e,n),o)).eachBefore(ap(Math.min(e,n)/(2*i.r))),i}return i.radius=function(e){return arguments.length?(t=Dd(e),i):t},i.size=function(t){return arguments.length?(e=+t[0],n=+t[1],i):[e,n]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:Fd(+t),i):r},i}function ip(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function op(t,e,n){return function(r){if(i=r.children){var i,o,a,s=i.length,l=t(r)*e||0;if(l)for(o=0;o<s;++o)i[o].r+=l;if(a=ep(i,n),l)for(o=0;o<s;++o)i[o].r-=l;r.r=a+l}}}function ap(t){return function(e){var n=e.parent;e.r*=t,n&&(e.x=n.x+t*e.x,e.y=n.y+t*e.y)}}function sp(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function lp(t,e,n,r,i){for(var o,a=t.children,s=-1,l=a.length,c=t.value&&(r-e)/t.value;++s<l;)(o=a[s]).y0=n,o.y1=i,o.x0=e,o.x1=e+=o.value*c}var cp={depth:-1},up={},hp={};function fp(t){return t.id}function dp(t){return t.parentId}function pp(t){let e=t.length;if(e<2)return"";for(;--e>1&&!gp(t,e););return t.slice(0,e)}function gp(t,e){if("/"===t[e]){let n=0;for(;e>0&&"\\"===t[--e];)++n;if(!(1&n))return!0}return!1}function _p(t,e){return t.parent===e.parent?1:2}function yp(t){var e=t.children;return e?e[0]:t.t}function mp(t){var e=t.children;return e?e[e.length-1]:t.t}function bp(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function vp(t,e,n){return t.a.parent===e.parent?t.a:n}function xp(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function wp(){var t=_p,e=1,n=1,r=null;function i(i){var l=function(t){for(var e,n,r,i,o,a=new xp(t,0),s=[a];e=s.pop();)if(r=e._.children)for(e.children=new Array(o=r.length),i=o-1;i>=0;--i)s.push(n=e.children[i]=new xp(r[i],i)),n.parent=e;return(a.parent=new xp(null,0)).children=[a],a}(i);if(l.eachAfter(o),l.parent.m=-l.z,l.eachBefore(a),r)i.eachBefore(s);else{var c=i,u=i,h=i;i.eachBefore(function(t){t.x<c.x&&(c=t),t.x>u.x&&(u=t),t.depth>h.depth&&(h=t)});var f=c===u?1:t(c,u)/2,d=f-c.x,p=e/(u.x+f+d),g=n/(h.depth||1);i.eachBefore(function(t){t.x=(t.x+d)*p,t.y=t.depth*g})}return i}function o(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(t){for(var e,n=0,r=0,i=t.children,o=i.length;--o>=0;)(e=i[o]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(e);var o=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-o):e.z=o}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,o=e,a=e,s=n,l=o.parent.children[0],c=o.m,u=a.m,h=s.m,f=l.m;s=mp(s),o=yp(o),s&&o;)l=yp(l),(a=mp(a)).a=e,(i=s.z+h-o.z-c+t(s._,o._))>0&&(bp(vp(s,e,r),e,i),c+=i,u+=i),h+=s.m,c+=o.m,f+=l.m,u+=a.m;s&&!mp(a)&&(a.t=s,a.m+=h-u),o&&!yp(l)&&(l.t=o,l.m+=c-f,r=e)}return r}(e,i,e.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}function Ep(t,e,n,r,i){for(var o,a=t.children,s=-1,l=a.length,c=t.value&&(i-n)/t.value;++s<l;)(o=a[s]).x0=e,o.x1=r,o.y0=n,o.y1=n+=o.value*c}xp.prototype=Object.create(Vd.prototype);var Ap=(1+Math.sqrt(5))/2;function Tp(t,e,n,r,i,o){for(var a,s,l,c,u,h,f,d,p,g,_,y=[],m=e.children,b=0,v=0,x=m.length,w=e.value;b<x;){l=i-n,c=o-r;do{u=m[v++].value}while(!u&&v<x);for(h=f=u,_=u*u*(g=Math.max(c/l,l/c)/(w*t)),p=Math.max(f/_,_/h);v<x;++v){if(u+=s=m[v].value,s<h&&(h=s),s>f&&(f=s),_=u*u*g,(d=Math.max(f/_,_/h))>p){u-=s;break}p=d}y.push(a={value:u,dice:l<c,children:m.slice(b,v)}),a.dice?lp(a,n,r,i,w?r+=c*u/w:o):Ep(a,n,r,w?n+=l*u/w:i,o),w-=u,b=v}return y}var Sp=function t(e){function n(t,n,r,i,o){Tp(e,t,n,r,i,o)}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(Ap);function Cp(){var t=Sp,e=!1,n=1,r=1,i=[0],o=zd,a=zd,s=zd,l=zd,c=zd;function u(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(h),i=[0],e&&t.eachBefore(sp),t}function h(e){var n=i[e.depth],r=e.x0+n,u=e.y0+n,h=e.x1-n,f=e.y1-n;h<r&&(r=h=(r+h)/2),f<u&&(u=f=(u+f)/2),e.x0=r,e.y0=u,e.x1=h,e.y1=f,e.children&&(n=i[e.depth+1]=o(e)/2,r+=c(e)-n,u+=a(e)-n,(h-=s(e)-n)<r&&(r=h=(r+h)/2),(f-=l(e)-n)<u&&(u=f=(u+f)/2),t(e,r,u,h,f))}return u.round=function(t){return arguments.length?(e=!!t,u):e},u.size=function(t){return arguments.length?(n=+t[0],r=+t[1],u):[n,r]},u.tile=function(e){return arguments.length?(t=Bd(e),u):t},u.padding=function(t){return arguments.length?u.paddingInner(t).paddingOuter(t):u.paddingInner()},u.paddingInner=function(t){return arguments.length?(o="function"==typeof t?t:Fd(+t),u):o},u.paddingOuter=function(t){return arguments.length?u.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):u.paddingTop()},u.paddingTop=function(t){return arguments.length?(a="function"==typeof t?t:Fd(+t),u):a},u.paddingRight=function(t){return arguments.length?(s="function"==typeof t?t:Fd(+t),u):s},u.paddingBottom=function(t){return arguments.length?(l="function"==typeof t?t:Fd(+t),u):l},u.paddingLeft=function(t){return arguments.length?(c="function"==typeof t?t:Fd(+t),u):c},u}var kp=function t(e){function n(t,n,r,i,o){if((a=t._squarify)&&a.ratio===e)for(var a,s,l,c,u,h=-1,f=a.length,d=t.value;++h<f;){for(l=(s=a[h]).children,c=s.value=0,u=l.length;c<u;++c)s.value+=l[c].value;s.dice?lp(s,n,r,i,d?r+=(o-r)*s.value/d:o):Ep(s,n,r,d?n+=(i-n)*s.value/d:i,o),d-=s.value}else t._squarify=a=Tp(e,t,n,r,i,o),a.ratio=e}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(Ap);function Mp(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function Rp(t,e){return t[0]-e[0]||t[1]-e[1]}function Op(t){const e=t.length,n=[0,1];let r,i=2;for(r=2;r<e;++r){for(;i>1&&Mp(t[n[i-2]],t[n[i-1]],t[r])<=0;)--i;n[i++]=r}return n.slice(0,i)}var Np=Math.random,Ip=function t(e){function n(t,n){return t=null==t?0:+t,n=null==n?1:+n,1===arguments.length?(n=t,t=0):n-=t,function(){return e()*n+t}}return n.source=t,n}(Np),Lp=function t(e){function n(t,n){return arguments.length<2&&(n=t,t=0),t=Math.floor(t),n=Math.floor(n)-t,function(){return Math.floor(e()*n+t)}}return n.source=t,n}(Np),Pp=function t(e){function n(t,n){var r,i;return t=null==t?0:+t,n=null==n?1:+n,function(){var o;if(null!=r)o=r,r=null;else do{r=2*e()-1,o=2*e()-1,i=r*r+o*o}while(!i||i>1);return t+n*o*Math.sqrt(-2*Math.log(i)/i)}}return n.source=t,n}(Np),Vp=function t(e){var n=Pp.source(e);function r(){var t=n.apply(this,arguments);return function(){return Math.exp(t())}}return r.source=t,r}(Np),Dp=function t(e){function n(t){return(t=+t)<=0?()=>0:function(){for(var n=0,r=t;r>1;--r)n+=e();return n+r*e()}}return n.source=t,n}(Np),Bp=function t(e){var n=Dp.source(e);function r(t){if(0===(t=+t))return e;var r=n(t);return function(){return r()/t}}return r.source=t,r}(Np),zp=function t(e){function n(t){return function(){return-Math.log1p(-e())/t}}return n.source=t,n}(Np),Fp=function t(e){function n(t){if((t=+t)<0)throw new RangeError("invalid alpha");return t=1/-t,function(){return Math.pow(1-e(),t)}}return n.source=t,n}(Np),Gp=function t(e){function n(t){if((t=+t)<0||t>1)throw new RangeError("invalid p");return function(){return Math.floor(e()+t)}}return n.source=t,n}(Np),jp=function t(e){function n(t){if((t=+t)<0||t>1)throw new RangeError("invalid p");return 0===t?()=>1/0:1===t?()=>1:(t=Math.log1p(-t),function(){return 1+Math.floor(Math.log1p(-e())/t)})}return n.source=t,n}(Np),Up=function t(e){var n=Pp.source(e)();function r(t,r){if((t=+t)<0)throw new RangeError("invalid k");if(0===t)return()=>0;if(r=null==r?1:+r,1===t)return()=>-Math.log1p(-e())*r;var i=(t<1?t+1:t)-1/3,o=1/(3*Math.sqrt(i)),a=t<1?()=>Math.pow(e(),1/t):()=>1;return function(){do{do{var t=n(),s=1+o*t}while(s<=0);s*=s*s;var l=1-e()}while(l>=1-.0331*t*t*t*t&&Math.log(l)>=.5*t*t+i*(1-s+Math.log(s)));return i*s*a()*r}}return r.source=t,r}(Np),Yp=function t(e){var n=Up.source(e);function r(t,e){var r=n(t),i=n(e);return function(){var t=r();return 0===t?0:t/(t+i())}}return r.source=t,r}(Np),Hp=function t(e){var n=jp.source(e),r=Yp.source(e);function i(t,e){return t=+t,(e=+e)>=1?()=>t:e<=0?()=>0:function(){for(var i=0,o=t,a=e;o*a>16&&o*(1-a)>16;){var s=Math.floor((o+1)*a),l=r(s,o-s+1)();l<=a?(i+=s,o-=s,a=(a-l)/(1-l)):(o=s-1,a/=l)}for(var c=a<.5,u=n(c?a:1-a),h=u(),f=0;h<=o;++f)h+=u();return i+(c?f:o-f)}}return i.source=t,i}(Np),qp=function t(e){function n(t,n,r){var i;return 0===(t=+t)?i=t=>-Math.log(t):(t=1/t,i=e=>Math.pow(e,t)),n=null==n?0:+n,r=null==r?1:+r,function(){return n+r*i(-Math.log1p(-e()))}}return n.source=t,n}(Np),Wp=function t(e){function n(t,n){return t=null==t?0:+t,n=null==n?1:+n,function(){return t+n*Math.tan(Math.PI*e())}}return n.source=t,n}(Np),$p=function t(e){function n(t,n){return t=null==t?0:+t,n=null==n?1:+n,function(){var r=e();return t+n*Math.log(r/(1-r))}}return n.source=t,n}(Np),Xp=function t(e){var n=Up.source(e),r=Hp.source(e);function i(t){return function(){for(var i=0,o=t;o>16;){var a=Math.floor(.875*o),s=n(a)();if(s>o)return i+r(a-1,o/s)();i+=a,o-=s}for(var l=-Math.log1p(-e()),c=0;l<=o;++c)l-=Math.log1p(-e());return i+c}}return i.source=t,i}(Np);const Kp=1/4294967296;function Zp(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Jp(t,e){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof e?this.interpolator(e):this.range(e)}return this}const Qp=Symbol("implicit");function tg(){var t=new E,e=[],n=[],r=Qp;function i(i){let o=t.get(i);if(void 0===o){if(r!==Qp)return r;t.set(i,o=e.push(i)-1)}return n[o%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new E;for(const r of n)t.has(r)||t.set(r,e.push(r)-1);return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return tg(e,n).unknown(r)},Zp.apply(i,arguments),i}function eg(){var t,e,n=tg().unknown(void 0),r=n.domain,i=n.range,o=0,a=1,s=!1,l=0,c=0,u=.5;function h(){var n=r().length,h=a<o,f=h?a:o,d=h?o:a;t=(d-f)/Math.max(1,n-l+2*c),s&&(t=Math.floor(t)),f+=(d-f-t*(n-l))*u,e=t*(1-l),s&&(f=Math.round(f),e=Math.round(e));var p=dt(n).map(function(e){return f+t*e});return i(h?p.reverse():p)}return delete n.unknown,n.domain=function(t){return arguments.length?(r(t),h()):r()},n.range=function(t){return arguments.length?([o,a]=t,o=+o,a=+a,h()):[o,a]},n.rangeRound=function(t){return[o,a]=t,o=+o,a=+a,s=!0,h()},n.bandwidth=function(){return e},n.step=function(){return t},n.round=function(t){return arguments.length?(s=!!t,h()):s},n.padding=function(t){return arguments.length?(l=Math.min(1,c=+t),h()):l},n.paddingInner=function(t){return arguments.length?(l=Math.min(1,t),h()):l},n.paddingOuter=function(t){return arguments.length?(c=+t,h()):c},n.align=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),h()):u},n.copy=function(){return eg(r(),[o,a]).round(s).paddingInner(l).paddingOuter(c).align(u)},Zp.apply(h(),arguments)}function ng(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return ng(e())},t}function rg(){return ng(eg.apply(null,arguments).paddingInner(1))}function ig(t){return+t}var og=[0,1];function ag(t){return t}function sg(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function lg(t,e,n){var r=t[0],i=t[1],o=e[0],a=e[1];return i<r?(r=sg(i,r),o=n(a,o)):(r=sg(r,i),o=n(o,a)),function(t){return o(r(t))}}function cg(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),s=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<r;)i[s]=sg(t[s],t[s+1]),o[s]=n(e[s],e[s+1]);return function(e){var n=a(t,e,1,r)-1;return o[n](i[n](e))}}function ug(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function hg(){var t,e,n,r,i,o,a=og,s=og,l=Hr,c=ag;function u(){var t=Math.min(a.length,s.length);return c!==ag&&(c=function(t,e){var n;return t>e&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(a[0],a[t-1])),r=t>2?cg:lg,i=o=null,h}function h(e){return null==e||isNaN(e=+e)?n:(i||(i=r(a.map(t),s,l)))(t(c(e)))}return h.invert=function(n){return c(e((o||(o=r(s,a.map(t),Fr)))(n)))},h.domain=function(t){return arguments.length?(a=Array.from(t,ig),u()):a.slice()},h.range=function(t){return arguments.length?(s=Array.from(t),u()):s.slice()},h.rangeRound=function(t){return s=Array.from(t),l=qr,u()},h.clamp=function(t){return arguments.length?(c=!!t||ag,u()):c!==ag},h.interpolate=function(t){return arguments.length?(l=t,u()):l},h.unknown=function(t){return arguments.length?(n=t,h):n},function(n,r){return t=n,e=r,u()}}function fg(){return hg()(ag,ag)}function dg(t,e,n,r){var i,o=X(t,e,n);switch((r=zl(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=Jl(o,a))||(r.precision=i),ql(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=Ql(o,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=Zl(o))||(r.precision=i-2*("%"===r.type))}return Hl(r)}function pg(t){var e=t.domain;return t.ticks=function(t){var n=e();return W(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return dg(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i,o=e(),a=0,s=o.length-1,l=o[a],c=o[s],u=10;for(c<l&&(i=l,l=c,c=i,i=a,a=s,s=i);u-- >0;){if((i=$(l,c,n))===r)return o[a]=l,o[s]=c,e(o);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i}r=i}return t},t}function gg(){var t=fg();return t.copy=function(){return ug(t,gg())},Zp.apply(t,arguments),pg(t)}function _g(t,e){var n,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a<o&&(n=r,r=i,i=n,n=o,o=a,a=n),t[r]=e.floor(o),t[i]=e.ceil(a),t}function yg(t){return Math.log(t)}function mg(t){return Math.exp(t)}function bg(t){return-Math.log(-t)}function vg(t){return-Math.exp(-t)}function xg(t){return isFinite(t)?+("1e"+t):t<0?0:t}function wg(t){return(e,n)=>-t(-e,n)}function Eg(t){const e=t(yg,mg),n=e.domain;let r,i,o=10;function a(){return r=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}(o),i=function(t){return 10===t?xg:t===Math.E?Math.exp:e=>Math.pow(t,e)}(o),n()[0]<0?(r=wg(r),i=wg(i),t(bg,vg)):t(yg,mg),e}return e.base=function(t){return arguments.length?(o=+t,a()):o},e.domain=function(t){return arguments.length?(n(t),a()):n()},e.ticks=t=>{const e=n();let a=e[0],s=e[e.length-1];const l=s<a;l&&([a,s]=[s,a]);let c,u,h=r(a),f=r(s);const d=null==t?10:+t;let p=[];if(!(o%1)&&f-h<d){if(h=Math.floor(h),f=Math.ceil(f),a>0){for(;h<=f;++h)for(c=1;c<o;++c)if(u=h<0?c/i(-h):c*i(h),!(u<a)){if(u>s)break;p.push(u)}}else for(;h<=f;++h)for(c=o-1;c>=1;--c)if(u=h>0?c/i(-h):c*i(h),!(u<a)){if(u>s)break;p.push(u)}2*p.length<d&&(p=W(a,s,d))}else p=W(h,f,Math.min(f-h,d)).map(i);return l?p.reverse():p},e.tickFormat=(t,n)=>{if(null==t&&(t=10),null==n&&(n=10===o?"s":","),"function"!=typeof n&&(o%1||null!=(n=zl(n)).precision||(n.trim=!0),n=Hl(n)),t===1/0)return n;const a=Math.max(1,o*t/e.ticks().length);return t=>{let e=t/i(Math.round(r(t)));return e*o<o-.5&&(e*=o),e<=a?n(t):""}},e.nice=()=>n(_g(n(),{floor:t=>i(Math.floor(r(t))),ceil:t=>i(Math.ceil(r(t)))})),e}function Ag(){const t=Eg(hg()).domain([1,10]);return t.copy=()=>ug(t,Ag()).base(t.base()),Zp.apply(t,arguments),t}function Tg(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function Sg(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function Cg(t){var e=1,n=t(Tg(e),Sg(e));return n.constant=function(n){return arguments.length?t(Tg(e=+n),Sg(e)):e},pg(n)}function kg(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Mg(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Rg(t){return t<0?-t*t:t*t}function Og(t){var e=t(ag,ag),n=1;return e.exponent=function(e){return arguments.length?1===(n=+e)?t(ag,ag):.5===n?t(Mg,Rg):t(kg(n),kg(1/n)):n},pg(e)}function Ng(){var t=Og(hg());return t.copy=function(){return ug(t,Ng()).exponent(t.exponent())},Zp.apply(t,arguments),t}function Ig(t){return Math.sign(t)*t*t}const Lg=new Date,Pg=new Date;function Vg(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=e=>(t(e=new Date(+e)),e),i.ceil=n=>(t(n=new Date(n-1)),e(n,1),t(n),n),i.round=t=>{const e=i(t),n=i.ceil(t);return t-e<n-t?e:n},i.offset=(t,n)=>(e(t=new Date(+t),null==n?1:Math.floor(n)),t),i.range=(n,r,o)=>{const a=[];if(n=i.ceil(n),o=null==o?1:Math.floor(o),!(n<r&&o>0))return a;let s;do{a.push(s=new Date(+n)),e(n,o),t(n)}while(s<n&&n<r);return a},i.filter=n=>Vg(e=>{if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)},(t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}),n&&(i.count=(e,r)=>(Lg.setTime(+e),Pg.setTime(+r),t(Lg),t(Pg),Math.floor(n(Lg,Pg))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?e=>r(e)%t===0:e=>i.count(0,e)%t===0):i:null)),i}const Dg=Vg(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Dg.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?Vg(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Dg:null);const Bg=Dg.range,zg=1e3,Fg=6e4,Gg=36e5,jg=864e5,Ug=6048e5,Yg=2592e6,Hg=31536e6,qg=Vg(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*zg)},(t,e)=>(e-t)/zg,t=>t.getUTCSeconds()),Wg=qg.range,$g=Vg(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*zg)},(t,e)=>{t.setTime(+t+e*Fg)},(t,e)=>(e-t)/Fg,t=>t.getMinutes()),Xg=$g.range,Kg=Vg(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Fg)},(t,e)=>(e-t)/Fg,t=>t.getUTCMinutes()),Zg=Kg.range,Jg=Vg(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*zg-t.getMinutes()*Fg)},(t,e)=>{t.setTime(+t+e*Gg)},(t,e)=>(e-t)/Gg,t=>t.getHours()),Qg=Jg.range,t_=Vg(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Gg)},(t,e)=>(e-t)/Gg,t=>t.getUTCHours()),e_=t_.range,n_=Vg(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Fg)/jg,t=>t.getDate()-1),r_=n_.range,i_=Vg(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/jg,t=>t.getUTCDate()-1),o_=i_.range,a_=Vg(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/jg,t=>Math.floor(t/jg)),s_=a_.range;function l_(t){return Vg(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+7*e)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Fg)/Ug)}const c_=l_(0),u_=l_(1),h_=l_(2),f_=l_(3),d_=l_(4),p_=l_(5),g_=l_(6),__=c_.range,y_=u_.range,m_=h_.range,b_=f_.range,v_=d_.range,x_=p_.range,w_=g_.range;function E_(t){return Vg(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)},(t,e)=>(e-t)/Ug)}const A_=E_(0),T_=E_(1),S_=E_(2),C_=E_(3),k_=E_(4),M_=E_(5),R_=E_(6),O_=A_.range,N_=T_.range,I_=S_.range,L_=C_.range,P_=k_.range,V_=M_.range,D_=R_.range,B_=Vg(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),t=>t.getMonth()),z_=B_.range,F_=Vg(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),t=>t.getUTCMonth()),G_=F_.range,j_=Vg(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());j_.every=t=>isFinite(t=Math.floor(t))&&t>0?Vg(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)}):null;const U_=j_.range,Y_=Vg(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Y_.every=t=>isFinite(t=Math.floor(t))&&t>0?Vg(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)}):null;const H_=Y_.range;function q_(t,e,r,i,o,a){const s=[[qg,1,zg],[qg,5,5e3],[qg,15,15e3],[qg,30,3e4],[a,1,Fg],[a,5,3e5],[a,15,9e5],[a,30,18e5],[o,1,Gg],[o,3,108e5],[o,6,216e5],[o,12,432e5],[i,1,jg],[i,2,1728e5],[r,1,Ug],[e,1,Yg],[e,3,7776e6],[t,1,Hg]];function l(e,r,i){const o=Math.abs(r-e)/i,a=n(([,,t])=>t).right(s,o);if(a===s.length)return t.every(X(e/Hg,r/Hg,i));if(0===a)return Dg.every(Math.max(X(e,r,i),1));const[l,c]=s[o/s[a-1][2]<s[a][2]/o?a-1:a];return l.every(c)}return[function(t,e,n){const r=e<t;r&&([t,e]=[e,t]);const i=n&&"function"==typeof n.range?n:l(t,e,n),o=i?i.range(t,+e+1):[];return r?o.reverse():o},l]}const[W_,$_]=q_(Y_,F_,A_,a_,t_,Kg),[X_,K_]=q_(j_,B_,c_,n_,Jg,$g);function Z_(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function J_(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Q_(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function ty(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,s=t.months,l=t.shortMonths,c=fy(i),u=dy(i),h=fy(o),f=dy(o),d=fy(a),p=dy(a),g=fy(s),_=dy(s),y=fy(l),m=dy(l),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:Ly,e:Ly,f:zy,g:Ky,G:Jy,H:Py,I:Vy,j:Dy,L:By,m:Fy,M:Gy,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:xm,s:wm,S:jy,u:Uy,U:Yy,V:qy,w:Wy,W:$y,x:null,X:null,y:Xy,Y:Zy,Z:Qy,"%":vm},v={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:tm,e:tm,f:om,g:_m,G:mm,H:em,I:nm,j:rm,L:im,m:am,M:sm,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:xm,s:wm,S:lm,u:cm,U:um,V:fm,w:dm,W:pm,x:null,X:null,y:gm,Y:ym,Z:bm,"%":vm},x={a:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=h.exec(e.slice(n));return r?(t.w=f.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=y.exec(e.slice(n));return r?(t.m=m.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=g.exec(e.slice(n));return r?(t.m=_.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return A(t,e,n,r)},d:Ay,e:Ay,f:Ry,g:vy,G:by,H:Sy,I:Sy,j:Ty,L:My,m:Ey,M:Cy,p:function(t,e,n){var r=c.exec(e.slice(n));return r?(t.p=u.get(r[0].toLowerCase()),n+r[0].length):-1},q:wy,Q:Ny,s:Iy,S:ky,u:gy,U:_y,V:yy,w:py,W:my,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:vy,Y:by,Z:xy,"%":Oy};function w(t,e){return function(n){var r,i,o,a=[],s=-1,l=0,c=t.length;for(n instanceof Date||(n=new Date(+n));++s<c;)37===t.charCodeAt(s)&&(a.push(t.slice(l,s)),null!=(i=ay[r=t.charAt(++s)])?r=t.charAt(++s):i="e"===r?" ":"0",(o=e[r])&&(r=o(n,i)),a.push(r),l=s+1);return a.push(t.slice(l,s)),a.join("")}}function E(t,e){return function(n){var r,i,o=Q_(1900,void 0,1);if(A(o,t,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(e&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=J_(Q_(o.y,0,1))).getUTCDay(),r=i>4||0===i?T_.ceil(r):T_(r),r=i_.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=Z_(Q_(o.y,0,1))).getDay(),r=i>4||0===i?u_.ceil(r):u_(r),r=n_.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?J_(Q_(o.y,0,1)).getUTCDay():Z_(Q_(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,J_(o)):Z_(o)}}function A(t,e,n,r){for(var i,o,a=0,s=e.length,l=n.length;a<s;){if(r>=l)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=x[i in ay?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return b.x=w(n,b),b.X=w(r,b),b.c=w(e,b),v.x=w(n,v),v.X=w(r,v),v.c=w(e,v),{format:function(t){var e=w(t+="",b);return e.toString=function(){return t},e},parse:function(t){var e=E(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=w(t+="",v);return e.toString=function(){return t},e},utcParse:function(t){var e=E(t+="",!0);return e.toString=function(){return t},e}}}var ey,ny,ry,iy,oy,ay={"-":"",_:" ",0:"0"},sy=/^\s*\d+/,ly=/^%/,cy=/[\\^$*+?|[\]().{}]/g;function uy(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(e)+i:i)}function hy(t){return t.replace(cy,"\\$&")}function fy(t){return new RegExp("^(?:"+t.map(hy).join("|")+")","i")}function dy(t){return new Map(t.map((t,e)=>[t.toLowerCase(),e]))}function py(t,e,n){var r=sy.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function gy(t,e,n){var r=sy.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function _y(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function yy(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function my(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function by(t,e,n){var r=sy.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function vy(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function xy(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function wy(t,e,n){var r=sy.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Ey(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Ay(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Ty(t,e,n){var r=sy.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Sy(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Cy(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function ky(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function My(t,e,n){var r=sy.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Ry(t,e,n){var r=sy.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Oy(t,e,n){var r=ly.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Ny(t,e,n){var r=sy.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Iy(t,e,n){var r=sy.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Ly(t,e){return uy(t.getDate(),e,2)}function Py(t,e){return uy(t.getHours(),e,2)}function Vy(t,e){return uy(t.getHours()%12||12,e,2)}function Dy(t,e){return uy(1+n_.count(j_(t),t),e,3)}function By(t,e){return uy(t.getMilliseconds(),e,3)}function zy(t,e){return By(t,e)+"000"}function Fy(t,e){return uy(t.getMonth()+1,e,2)}function Gy(t,e){return uy(t.getMinutes(),e,2)}function jy(t,e){return uy(t.getSeconds(),e,2)}function Uy(t){var e=t.getDay();return 0===e?7:e}function Yy(t,e){return uy(c_.count(j_(t)-1,t),e,2)}function Hy(t){var e=t.getDay();return e>=4||0===e?d_(t):d_.ceil(t)}function qy(t,e){return t=Hy(t),uy(d_.count(j_(t),t)+(4===j_(t).getDay()),e,2)}function Wy(t){return t.getDay()}function $y(t,e){return uy(u_.count(j_(t)-1,t),e,2)}function Xy(t,e){return uy(t.getFullYear()%100,e,2)}function Ky(t,e){return uy((t=Hy(t)).getFullYear()%100,e,2)}function Zy(t,e){return uy(t.getFullYear()%1e4,e,4)}function Jy(t,e){var n=t.getDay();return uy((t=n>=4||0===n?d_(t):d_.ceil(t)).getFullYear()%1e4,e,4)}function Qy(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+uy(e/60|0,"0",2)+uy(e%60,"0",2)}function tm(t,e){return uy(t.getUTCDate(),e,2)}function em(t,e){return uy(t.getUTCHours(),e,2)}function nm(t,e){return uy(t.getUTCHours()%12||12,e,2)}function rm(t,e){return uy(1+i_.count(Y_(t),t),e,3)}function im(t,e){return uy(t.getUTCMilliseconds(),e,3)}function om(t,e){return im(t,e)+"000"}function am(t,e){return uy(t.getUTCMonth()+1,e,2)}function sm(t,e){return uy(t.getUTCMinutes(),e,2)}function lm(t,e){return uy(t.getUTCSeconds(),e,2)}function cm(t){var e=t.getUTCDay();return 0===e?7:e}function um(t,e){return uy(A_.count(Y_(t)-1,t),e,2)}function hm(t){var e=t.getUTCDay();return e>=4||0===e?k_(t):k_.ceil(t)}function fm(t,e){return t=hm(t),uy(k_.count(Y_(t),t)+(4===Y_(t).getUTCDay()),e,2)}function dm(t){return t.getUTCDay()}function pm(t,e){return uy(T_.count(Y_(t)-1,t),e,2)}function gm(t,e){return uy(t.getUTCFullYear()%100,e,2)}function _m(t,e){return uy((t=hm(t)).getUTCFullYear()%100,e,2)}function ym(t,e){return uy(t.getUTCFullYear()%1e4,e,4)}function mm(t,e){var n=t.getUTCDay();return uy((t=n>=4||0===n?k_(t):k_.ceil(t)).getUTCFullYear()%1e4,e,4)}function bm(){return"+0000"}function vm(){return"%"}function xm(t){return+t}function wm(t){return Math.floor(+t/1e3)}function Em(t){return ey=ty(t),ny=ey.format,ry=ey.parse,iy=ey.utcFormat,oy=ey.utcParse,ey}Em({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var Am="%Y-%m-%dT%H:%M:%S.%LZ";var Tm=Date.prototype.toISOString?function(t){return t.toISOString()}:iy(Am);var Sm=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:oy(Am);function Cm(t){return new Date(t)}function km(t){return t instanceof Date?+t:+new Date(+t)}function Mm(t,e,n,r,i,o,a,s,l,c){var u=fg(),h=u.invert,f=u.domain,d=c(".%L"),p=c(":%S"),g=c("%I:%M"),_=c("%I %p"),y=c("%a %d"),m=c("%b %d"),b=c("%B"),v=c("%Y");function x(t){return(l(t)<t?d:s(t)<t?p:a(t)<t?g:o(t)<t?_:r(t)<t?i(t)<t?y:m:n(t)<t?b:v)(t)}return u.invert=function(t){return new Date(h(t))},u.domain=function(t){return arguments.length?f(Array.from(t,km)):f().map(Cm)},u.ticks=function(e){var n=f();return t(n[0],n[n.length-1],null==e?10:e)},u.tickFormat=function(t,e){return null==e?x:c(e)},u.nice=function(t){var n=f();return t&&"function"==typeof t.range||(t=e(n[0],n[n.length-1],null==t?10:t)),t?f(_g(n,t)):u},u.copy=function(){return ug(u,Mm(t,e,n,r,i,o,a,s,l,c))},u}function Rm(){return Zp.apply(Mm(X_,K_,j_,B_,c_,n_,Jg,$g,qg,ny).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Om(){var t,e,n,r,i,o=0,a=1,s=ag,l=!1;function c(e){return null==e||isNaN(e=+e)?i:s(0===n?.5:(e=(r(e)-t)*n,l?Math.max(0,Math.min(1,e)):e))}function u(t){return function(e){var n,r;return arguments.length?([n,r]=e,s=t(n,r),c):[s(0),s(1)]}}return c.domain=function(i){return arguments.length?([o,a]=i,t=r(o=+o),e=r(a=+a),n=t===e?0:1/(e-t),c):[o,a]},c.clamp=function(t){return arguments.length?(l=!!t,c):l},c.interpolator=function(t){return arguments.length?(s=t,c):s},c.range=u(Hr),c.rangeRound=u(qr),c.unknown=function(t){return arguments.length?(i=t,c):i},function(i){return r=i,t=i(o),e=i(a),n=t===e?0:1/(e-t),c}}function Nm(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Im(){var t=pg(Om()(ag));return t.copy=function(){return Nm(t,Im())},Jp.apply(t,arguments)}function Lm(){var t=Og(Om());return t.copy=function(){return Nm(t,Lm()).exponent(t.exponent())},Jp.apply(t,arguments)}function Pm(){var t,e,n,r,i,o,a,s=0,l=.5,c=1,u=1,h=ag,f=!1;function d(t){return isNaN(t=+t)?a:(t=.5+((t=+o(t))-e)*(u*t<u*e?r:i),h(f?Math.max(0,Math.min(1,t)):t))}function p(t){return function(e){var n,r,i;return arguments.length?([n,r,i]=e,h=hi(t,[n,r,i]),d):[h(0),h(.5),h(1)]}}return d.domain=function(a){return arguments.length?([s,l,c]=a,t=o(s=+s),e=o(l=+l),n=o(c=+c),r=t===e?0:.5/(e-t),i=e===n?0:.5/(n-e),u=e<t?-1:1,d):[s,l,c]},d.clamp=function(t){return arguments.length?(f=!!t,d):f},d.interpolator=function(t){return arguments.length?(h=t,d):h},d.range=p(Hr),d.rangeRound=p(qr),d.unknown=function(t){return arguments.length?(a=t,d):a},function(a){return o=a,t=a(s),e=a(l),n=a(c),r=t===e?0:.5/(e-t),i=e===n?0:.5/(n-e),u=e<t?-1:1,d}}function Vm(){var t=Og(Pm());return t.copy=function(){return Nm(t,Vm()).exponent(t.exponent())},Jp.apply(t,arguments)}function Dm(t){for(var e=t.length/6|0,n=new Array(e),r=0;r<e;)n[r]="#"+t.slice(6*r,6*++r);return n}var Bm=Dm("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),zm=Dm("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),Fm=Dm("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),Gm=Dm("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"),jm=Dm("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),Um=Dm("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),Ym=Dm("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),Hm=Dm("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),qm=Dm("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),Wm=Dm("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"),$m=Dm("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab"),Xm=t=>Lr(t[t.length-1]),Km=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(Dm),Zm=Xm(Km),Jm=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(Dm),Qm=Xm(Jm),tb=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(Dm),eb=Xm(tb),nb=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(Dm),rb=Xm(nb),ib=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(Dm),ob=Xm(ib),ab=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(Dm),sb=Xm(ab),lb=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(Dm),cb=Xm(lb),ub=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(Dm),hb=Xm(ub),fb=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(Dm),db=Xm(fb),pb=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(Dm),gb=Xm(pb),_b=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(Dm),yb=Xm(_b),mb=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(Dm),bb=Xm(mb),vb=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(Dm),xb=Xm(vb),wb=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(Dm),Eb=Xm(wb),Ab=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(Dm),Tb=Xm(Ab),Sb=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(Dm),Cb=Xm(Sb),kb=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(Dm),Mb=Xm(kb),Rb=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(Dm),Ob=Xm(Rb),Nb=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(Dm),Ib=Xm(Nb),Lb=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(Dm),Pb=Xm(Lb),Vb=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(Dm),Db=Xm(Vb),Bb=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(Dm),zb=Xm(Bb),Fb=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(Dm),Gb=Xm(Fb),jb=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(Dm),Ub=Xm(jb),Yb=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(Dm),Hb=Xm(Yb),qb=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(Dm),Wb=Xm(qb),$b=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(Dm),Xb=Xm($b);var Kb=ui(wr(300,.5,0),wr(-240,.5,1)),Zb=ui(wr(-100,.75,.35),wr(80,1.5,.8)),Jb=ui(wr(260,.75,.35),wr(80,1.5,.8)),Qb=wr();var tv=Pn(),ev=Math.PI/3,nv=2*Math.PI/3;function rv(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-14825.05*t)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+707.56*t)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-6838.66*t)))))))+")"}function iv(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}var ov=iv(Dm("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),av=iv(Dm("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),sv=iv(Dm("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),lv=iv(Dm("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function cv(t){return function(){return t}}const uv=Math.abs,hv=Math.atan2,fv=Math.cos,dv=Math.max,pv=Math.min,gv=Math.sin,_v=Math.sqrt,yv=1e-12,mv=Math.PI,bv=mv/2,vv=2*mv;function xv(t){return t>=1?bv:t<=-1?-bv:Math.asin(t)}function wv(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(null==n)e=null;else{const t=Math.floor(n);if(!(t>=0))throw new RangeError(`invalid digits: ${n}`);e=t}return t},()=>new Ta(e)}function Ev(t){return t.innerRadius}function Av(t){return t.outerRadius}function Tv(t){return t.startAngle}function Sv(t){return t.endAngle}function Cv(t){return t&&t.padAngle}function kv(t,e,n,r,i,o,a){var s=t-n,l=e-r,c=(a?o:-o)/_v(s*s+l*l),u=c*l,h=-c*s,f=t+u,d=e+h,p=n+u,g=r+h,_=(f+p)/2,y=(d+g)/2,m=p-f,b=g-d,v=m*m+b*b,x=i-o,w=f*g-p*d,E=(b<0?-1:1)*_v(dv(0,x*x*v-w*w)),A=(w*b-m*E)/v,T=(-w*m-b*E)/v,S=(w*b+m*E)/v,C=(-w*m+b*E)/v,k=A-_,M=T-y,R=S-_,O=C-y;return k*k+M*M>R*R+O*O&&(A=S,T=C),{cx:A,cy:T,x01:-u,y01:-h,x11:A*(i/x-1),y11:T*(i/x-1)}}var Mv=Array.prototype.slice;function Rv(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Ov(t){this._context=t}function Nv(t){return new Ov(t)}function Iv(t){return t[0]}function Lv(t){return t[1]}function Pv(t,e){var n=cv(!0),r=null,i=Nv,o=null,a=wv(s);function s(s){var l,c,u,h=(s=Rv(s)).length,f=!1;for(null==r&&(o=i(u=a())),l=0;l<=h;++l)!(l<h&&n(c=s[l],l,s))===f&&((f=!f)?o.lineStart():o.lineEnd()),f&&o.point(+t(c,l,s),+e(c,l,s));if(u)return o=null,u+""||null}return t="function"==typeof t?t:void 0===t?Iv:cv(t),e="function"==typeof e?e:void 0===e?Lv:cv(e),s.x=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),s):t},s.y=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),s):e},s.defined=function(t){return arguments.length?(n="function"==typeof t?t:cv(!!t),s):n},s.curve=function(t){return arguments.length?(i=t,null!=r&&(o=i(r)),s):i},s.context=function(t){return arguments.length?(null==t?r=o=null:o=i(r=t),s):r},s}function Vv(t,e,n){var r=null,i=cv(!0),o=null,a=Nv,s=null,l=wv(c);function c(c){var u,h,f,d,p,g=(c=Rv(c)).length,_=!1,y=new Array(g),m=new Array(g);for(null==o&&(s=a(p=l())),u=0;u<=g;++u){if(!(u<g&&i(d=c[u],u,c))===_)if(_=!_)h=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=u-1;f>=h;--f)s.point(y[f],m[f]);s.lineEnd(),s.areaEnd()}_&&(y[u]=+t(d,u,c),m[u]=+e(d,u,c),s.point(r?+r(d,u,c):y[u],n?+n(d,u,c):m[u]))}if(p)return s=null,p+""||null}function u(){return Pv().defined(i).curve(a).context(o)}return t="function"==typeof t?t:void 0===t?Iv:cv(+t),e="function"==typeof e?e:cv(void 0===e?0:+e),n="function"==typeof n?n:void 0===n?Lv:cv(+n),c.x=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),r=null,c):t},c.x0=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),c):t},c.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:cv(+t),c):r},c.y=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),n=null,c):e},c.y0=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),c):e},c.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:cv(+t),c):n},c.lineX0=c.lineY0=function(){return u().x(t).y(e)},c.lineY1=function(){return u().x(t).y(n)},c.lineX1=function(){return u().x(r).y(e)},c.defined=function(t){return arguments.length?(i="function"==typeof t?t:cv(!!t),c):i},c.curve=function(t){return arguments.length?(a=t,null!=o&&(s=a(o)),c):a},c.context=function(t){return arguments.length?(null==t?o=s=null:s=a(o=t),c):o},c}function Dv(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}function Bv(t){return t}Ov.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var zv=Gv(Nv);function Fv(t){this._curve=t}function Gv(t){function e(e){return new Fv(t(e))}return e._curve=t,e}function jv(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?e(Gv(t)):e()._curve},t}function Uv(){return jv(Pv().curve(zv))}function Yv(){var t=Vv().curve(zv),e=t.curve,n=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return jv(n())},delete t.lineX0,t.lineEndAngle=function(){return jv(r())},delete t.lineX1,t.lineInnerRadius=function(){return jv(i())},delete t.lineY0,t.lineOuterRadius=function(){return jv(o())},delete t.lineY1,t.curve=function(t){return arguments.length?e(Gv(t)):e()._curve},t}function Hv(t,e){return[(e=+e)*Math.cos(t-=Math.PI/2),e*Math.sin(t)]}Fv.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};class qv{constructor(t,e){this._context=t,this._x=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,e,t,e):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+e)/2,t,this._y0,t,e)}this._x0=t,this._y0=e}}class Wv{constructor(t){this._context=t}lineStart(){this._point=0}lineEnd(){}point(t,e){if(t=+t,e=+e,0===this._point)this._point=1;else{const n=Hv(this._x0,this._y0),r=Hv(this._x0,this._y0=(this._y0+e)/2),i=Hv(t,this._y0),o=Hv(t,e);this._context.moveTo(...n),this._context.bezierCurveTo(...r,...i,...o)}this._x0=t,this._y0=e}}function $v(t){return new qv(t,!0)}function Xv(t){return new qv(t,!1)}function Kv(t){return new Wv(t)}function Zv(t){return t.source}function Jv(t){return t.target}function Qv(t){let e=Zv,n=Jv,r=Iv,i=Lv,o=null,a=null,s=wv(l);function l(){let l;const c=Mv.call(arguments),u=e.apply(this,c),h=n.apply(this,c);if(null==o&&(a=t(l=s())),a.lineStart(),c[0]=u,a.point(+r.apply(this,c),+i.apply(this,c)),c[0]=h,a.point(+r.apply(this,c),+i.apply(this,c)),a.lineEnd(),l)return a=null,l+""||null}return l.source=function(t){return arguments.length?(e=t,l):e},l.target=function(t){return arguments.length?(n=t,l):n},l.x=function(t){return arguments.length?(r="function"==typeof t?t:cv(+t),l):r},l.y=function(t){return arguments.length?(i="function"==typeof t?t:cv(+t),l):i},l.context=function(e){return arguments.length?(null==e?o=a=null:a=t(o=e),l):o},l}function tx(){return Qv($v)}function ex(){return Qv(Xv)}function nx(){const t=Qv(Kv);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t}const rx=_v(3);var ix={draw(t,e){const n=.59436*_v(e+pv(e/28,.75)),r=n/2,i=r*rx;t.moveTo(0,n),t.lineTo(0,-n),t.moveTo(-i,-r),t.lineTo(i,r),t.moveTo(-i,r),t.lineTo(i,-r)}},ox={draw(t,e){const n=_v(e/mv);t.moveTo(n,0),t.arc(0,0,n,0,vv)}},ax={draw(t,e){const n=_v(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}};const sx=_v(1/3),lx=2*sx;var cx={draw(t,e){const n=_v(e/lx),r=n*sx;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},ux={draw(t,e){const n=.62625*_v(e);t.moveTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.lineTo(-n,0),t.closePath()}},hx={draw(t,e){const n=.87559*_v(e-pv(e/7,2));t.moveTo(-n,0),t.lineTo(n,0),t.moveTo(0,n),t.lineTo(0,-n)}},fx={draw(t,e){const n=_v(e),r=-n/2;t.rect(r,r,n,n)}},dx={draw(t,e){const n=.4431*_v(e);t.moveTo(n,n),t.lineTo(n,-n),t.lineTo(-n,-n),t.lineTo(-n,n),t.closePath()}};const px=gv(mv/10)/gv(7*mv/10),gx=gv(vv/10)*px,_x=-fv(vv/10)*px;var yx={draw(t,e){const n=_v(.8908130915292852*e),r=gx*n,i=_x*n;t.moveTo(0,-n),t.lineTo(r,i);for(let e=1;e<5;++e){const o=vv*e/5,a=fv(o),s=gv(o);t.lineTo(s*n,-a*n),t.lineTo(a*r-s*i,s*r+a*i)}t.closePath()}};const mx=_v(3);var bx={draw(t,e){const n=-_v(e/(3*mx));t.moveTo(0,2*n),t.lineTo(-mx*n,-n),t.lineTo(mx*n,-n),t.closePath()}};const vx=_v(3);var xx={draw(t,e){const n=.6824*_v(e),r=n/2,i=n*vx/2;t.moveTo(0,-n),t.lineTo(i,r),t.lineTo(-i,r),t.closePath()}};const wx=-.5,Ex=_v(3)/2,Ax=1/_v(12),Tx=3*(Ax/2+1);var Sx={draw(t,e){const n=_v(e/Tx),r=n/2,i=n*Ax,o=r,a=n*Ax+n,s=-o,l=a;t.moveTo(r,i),t.lineTo(o,a),t.lineTo(s,l),t.lineTo(wx*r-Ex*i,Ex*r+wx*i),t.lineTo(wx*o-Ex*a,Ex*o+wx*a),t.lineTo(wx*s-Ex*l,Ex*s+wx*l),t.lineTo(wx*r+Ex*i,wx*i-Ex*r),t.lineTo(wx*o+Ex*a,wx*a-Ex*o),t.lineTo(wx*s+Ex*l,wx*l-Ex*s),t.closePath()}},Cx={draw(t,e){const n=.6189*_v(e-pv(e/6,1.7));t.moveTo(-n,-n),t.lineTo(n,n),t.moveTo(-n,n),t.lineTo(n,-n)}};const kx=[ox,ax,cx,fx,yx,bx,Sx],Mx=[ox,hx,Cx,xx,ix,dx,ux];function Rx(){}function Ox(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function Nx(t){this._context=t}function Ix(t){return new Nx(t)}function Lx(t){this._context=t}function Px(t){this._context=t}function Vx(t,e){this._basis=new Nx(t),this._beta=e}Nx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Ox(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ox(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Lx.prototype={areaStart:Rx,areaEnd:Rx,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:Ox(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Px.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Ox(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Vx.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r,i=t[0],o=e[0],a=t[n]-i,s=e[n]-o,l=-1;++l<=n;)r=l/n,this._basis.point(this._beta*t[l]+(1-this._beta)*(i+r*a),this._beta*e[l]+(1-this._beta)*(o+r*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var Dx=function t(e){function n(t){return 1===e?new Nx(t):new Vx(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function Bx(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function zx(t,e){this._context=t,this._k=(1-e)/6}zx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Bx(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:Bx(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Fx=function t(e){function n(t){return new zx(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Gx(t,e){this._context=t,this._k=(1-e)/6}Gx.prototype={areaStart:Rx,areaEnd:Rx,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Bx(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var jx=function t(e){function n(t){return new Gx(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Ux(t,e){this._context=t,this._k=(1-e)/6}Ux.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Bx(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Yx=function t(e){function n(t){return new Ux(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Hx(t,e,n){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>yv){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,i=(i*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>yv){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-e*t._l12_2a)/u,a=(a*c+t._y1*t._l23_2a-n*t._l12_2a)/u}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function qx(t,e){this._context=t,this._alpha=e}qx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:Hx(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Wx=function t(e){function n(t){return e?new qx(t,e):new zx(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function $x(t,e){this._context=t,this._alpha=e}$x.prototype={areaStart:Rx,areaEnd:Rx,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Hx(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Xx=function t(e){function n(t){return e?new $x(t,e):new Gx(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Kx(t,e){this._context=t,this._alpha=e}Kx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Hx(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Zx=function t(e){function n(t){return e?new Kx(t,e):new Ux(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Jx(t){this._context=t}function Qx(t){return t<0?-1:1}function tw(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),s=(o*i+a*r)/(r+i);return(Qx(o)+Qx(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function ew(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function nw(t,e,n){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,s=(o-r)/3;t._context.bezierCurveTo(r+s,i+s*e,o-s,a-s*n,o,a)}function rw(t){this._context=t}function iw(t){this._context=new ow(t)}function ow(t){this._context=t}function aw(t){this._context=t}function sw(t){var e,n,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e<r-1;++e)i[e]=1,o[e]=4,a[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,o[r-1]=7,a[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=i[e]/o[e-1],o[e]-=n,a[e]-=n*a[e-1];for(i[r-1]=a[r-1]/o[r-1],e=r-2;e>=0;--e)i[e]=(a[e]-i[e+1])/o[e];for(o[r-1]=(t[r]+i[r-1])/2,e=0;e<r-1;++e)o[e]=2*t[e+1]-i[e+1];return[i,o]}function lw(t){return new aw(t)}function cw(t,e){this._context=t,this._t=e}function uw(t){return new cw(t,.5)}function hw(t,e){if((i=t.length)>1)for(var n,r,i,o=1,a=t[e[0]],s=a.length;o<i;++o)for(r=a,a=t[e[o]],n=0;n<s;++n)a[n][1]+=a[n][0]=isNaN(r[n][1])?r[n][0]:r[n][1]}function fw(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function dw(t,e){return t[e]}function pw(t){const e=[];return e.key=t,e}function gw(t){var e=t.map(_w);return fw(t).sort(function(t,n){return e[t]-e[n]})}function _w(t){for(var e,n=-1,r=0,i=t.length,o=-1/0;++n<i;)(e=+t[n][1])>o&&(o=e,r=n);return r}function yw(t){var e=t.map(mw);return fw(t).sort(function(t,n){return e[t]-e[n]})}function mw(t){for(var e,n=0,r=-1,i=t.length;++r<i;)(e=+t[r][1])&&(n+=e);return n}Jx.prototype={areaStart:Rx,areaEnd:Rx,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}},rw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:nw(this,this._t0,ew(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,nw(this,ew(this,n=tw(this,t,e)),n);break;default:nw(this,this._t0,n=tw(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(iw.prototype=Object.create(rw.prototype)).point=function(t,e){rw.prototype.point.call(this,e,t)},ow.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,o){this._context.bezierCurveTo(e,t,r,n,o,i)}},aw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===n)this._context.lineTo(t[1],e[1]);else for(var r=sw(t),i=sw(e),o=0,a=1;a<n;++o,++a)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],t[a],e[a]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}},cw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};var bw=t=>()=>t;function vw(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function xw(t,e,n){this.k=t,this.x=e,this.y=n}xw.prototype={constructor:xw,scale:function(t){return 1===t?this:new xw(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new xw(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ww=new xw(1,0,0);function Ew(t){for(;!t.__zoom;)if(!(t=t.parentNode))return ww;return t.__zoom}function Aw(t){t.stopImmediatePropagation()}function Tw(t){t.preventDefault(),t.stopImmediatePropagation()}function Sw(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Cw(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function kw(){return this.__zoom||ww}function Mw(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Rw(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ow(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}Ew.prototype=xw.prototype;var Nw=Object.freeze({__proto__:null,Adder:w,Delaunay:Cs,FormatSpecifier:Fl,InternMap:E,InternSet:A,Node:Vd,Path:Ta,Voronoi:xs,ZoomTransform:xw,active:function(t,e){var n,r,i=t.__transition;if(i)for(r in e=null==e?null:e+"",i)if((n=i[r]).state>1&&n.name===e)return new ro([[t]],Do,e,+r);return null},arc:function(){var t=Ev,e=Av,n=cv(0),r=null,i=Tv,o=Sv,a=Cv,s=null,l=wv(c);function c(){var c,u,h=+t.apply(this,arguments),f=+e.apply(this,arguments),d=i.apply(this,arguments)-bv,p=o.apply(this,arguments)-bv,g=uv(p-d),_=p>d;if(s||(s=c=l()),f<h&&(u=f,f=h,h=u),f>yv)if(g>vv-yv)s.moveTo(f*fv(d),f*gv(d)),s.arc(0,0,f,d,p,!_),h>yv&&(s.moveTo(h*fv(p),h*gv(p)),s.arc(0,0,h,p,d,_));else{var y,m,b=d,v=p,x=d,w=p,E=g,A=g,T=a.apply(this,arguments)/2,S=T>yv&&(r?+r.apply(this,arguments):_v(h*h+f*f)),C=pv(uv(f-h)/2,+n.apply(this,arguments)),k=C,M=C;if(S>yv){var R=xv(S/h*gv(T)),O=xv(S/f*gv(T));(E-=2*R)>yv?(x+=R*=_?1:-1,w-=R):(E=0,x=w=(d+p)/2),(A-=2*O)>yv?(b+=O*=_?1:-1,v-=O):(A=0,b=v=(d+p)/2)}var N=f*fv(b),I=f*gv(b),L=h*fv(w),P=h*gv(w);if(C>yv){var V,D=f*fv(v),B=f*gv(v),z=h*fv(x),F=h*gv(x);if(g<mv)if(V=function(t,e,n,r,i,o,a,s){var l=n-t,c=r-e,u=a-i,h=s-o,f=h*l-u*c;if(!(f*f<yv))return[t+(f=(u*(e-o)-h*(t-i))/f)*l,e+f*c]}(N,I,z,F,D,B,L,P)){var G=N-V[0],j=I-V[1],U=D-V[0],Y=B-V[1],H=1/gv(function(t){return t>1?0:t<-1?mv:Math.acos(t)}((G*U+j*Y)/(_v(G*G+j*j)*_v(U*U+Y*Y)))/2),q=_v(V[0]*V[0]+V[1]*V[1]);k=pv(C,(h-q)/(H-1)),M=pv(C,(f-q)/(H+1))}else k=M=0}A>yv?M>yv?(y=kv(z,F,N,I,f,M,_),m=kv(D,B,L,P,f,M,_),s.moveTo(y.cx+y.x01,y.cy+y.y01),M<C?s.arc(y.cx,y.cy,M,hv(y.y01,y.x01),hv(m.y01,m.x01),!_):(s.arc(y.cx,y.cy,M,hv(y.y01,y.x01),hv(y.y11,y.x11),!_),s.arc(0,0,f,hv(y.cy+y.y11,y.cx+y.x11),hv(m.cy+m.y11,m.cx+m.x11),!_),s.arc(m.cx,m.cy,M,hv(m.y11,m.x11),hv(m.y01,m.x01),!_))):(s.moveTo(N,I),s.arc(0,0,f,b,v,!_)):s.moveTo(N,I),h>yv&&E>yv?k>yv?(y=kv(L,P,D,B,h,-k,_),m=kv(N,I,z,F,h,-k,_),s.lineTo(y.cx+y.x01,y.cy+y.y01),k<C?s.arc(y.cx,y.cy,k,hv(y.y01,y.x01),hv(m.y01,m.x01),!_):(s.arc(y.cx,y.cy,k,hv(y.y01,y.x01),hv(y.y11,y.x11),!_),s.arc(0,0,h,hv(y.cy+y.y11,y.cx+y.x11),hv(m.cy+m.y11,m.cx+m.x11),_),s.arc(m.cx,m.cy,k,hv(m.y11,m.x11),hv(m.y01,m.x01),!_))):s.arc(0,0,h,w,x,_):s.lineTo(L,P)}else s.moveTo(0,0);if(s.closePath(),c)return s=null,c+""||null}return c.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-mv/2;return[fv(r)*n,gv(r)*n]},c.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),c):t},c.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),c):e},c.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:cv(+t),c):n},c.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:cv(+t),c):r},c.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:cv(+t),c):i},c.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:cv(+t),c):o},c.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:cv(+t),c):a},c.context=function(t){return arguments.length?(s=null==t?null:t,c):s},c},area:Vv,areaRadial:Yv,ascending:t,autoType:Zs,axisBottom:function(t){return Rt(3,t)},axisLeft:function(t){return Rt(4,t)},axisRight:function(t){return Rt(2,t)},axisTop:function(t){return Rt(1,t)},bin:J,bisect:a,bisectCenter:l,bisectLeft:s,bisectRight:a,bisector:n,blob:function(t,e){return fetch(t,e).then(Qs)},blur:function(t,e){if(!((e=+e)>=0))throw new RangeError("invalid r");let n=t.length;if(!((n=Math.floor(n))>=0))throw new RangeError("invalid length");if(!n||!e)return t;const r=p(e),i=t.slice();return r(t,i,0,n,1),r(i,t,0,n,1),r(t,i,0,n,1),t},blur2:c,blurImage:u,brush:function(){return ca(Jo)},brushSelection:function(t){var e=t.__brush;return e?e.dim.output(e.selection):null},brushX:function(){return ca(Ko)},brushY:function(){return ca(Zo)},buffer:function(t,e){return fetch(t,e).then(tl)},chord:function(){return ba(!1,!1)},chordDirected:function(){return ba(!0,!1)},chordTranspose:function(){return ba(!1,!0)},cluster:Md,color:On,contourDensity:function(){var t=Ka,e=Za,n=Ja,r=960,i=500,o=20,a=2,s=3*o,l=r+2*s>>a,u=i+2*s>>a,h=za(20);function f(r){var i=new Float32Array(l*u),h=Math.pow(2,-a),f=-1;for(const o of r){var d=(t(o,++f,r)+s)*h,p=(e(o,f,r)+s)*h,g=+n(o,f,r);if(g&&d>=0&&d<l&&p>=0&&p<u){var _=Math.floor(d),y=Math.floor(p),m=d-_-.5,b=p-y-.5;i[_+y*l]+=(1-m)*(1-b)*g,i[_+1+y*l]+=m*(1-b)*g,i[_+1+(y+1)*l]+=m*b*g,i[_+(y+1)*l]+=(1-m)*b*g}}return c({data:i,width:l,height:u},o*h),i}function d(t){var e=f(t),n=h(e),r=Math.pow(2,2*a);return Array.isArray(n)||(n=W(Number.MIN_VALUE,Q(e)/r,n)),Ha().size([l,u]).thresholds(n.map(t=>t*r))(e).map((t,e)=>(t.value=+n[e],p(t)))}function p(t){return t.coordinates.forEach(g),t}function g(t){t.forEach(_)}function _(t){t.forEach(y)}function y(t){t[0]=t[0]*Math.pow(2,a)-s,t[1]=t[1]*Math.pow(2,a)-s}function m(){return l=r+2*(s=3*o)>>a,u=i+2*s>>a,d}return d.contours=function(t){var e=f(t),n=Ha().size([l,u]),r=Math.pow(2,2*a),i=t=>{t=+t;var i=p(n.contour(e,t*r));return i.value=t,i};return Object.defineProperty(i,"max",{get:()=>Q(e)/r}),i},d.x=function(e){return arguments.length?(t="function"==typeof e?e:za(+e),d):t},d.y=function(t){return arguments.length?(e="function"==typeof t?t:za(+t),d):e},d.weight=function(t){return arguments.length?(n="function"==typeof t?t:za(+t),d):n},d.size=function(t){if(!arguments.length)return[r,i];var e=+t[0],n=+t[1];if(!(e>=0&&n>=0))throw new Error("invalid size");return r=e,i=n,m()},d.cellSize=function(t){if(!arguments.length)return 1<<a;if(!((t=+t)>=1))throw new Error("invalid cell size");return a=Math.floor(Math.log(t)/Math.LN2),m()},d.thresholds=function(t){return arguments.length?(h="function"==typeof t?t:Array.isArray(t)?za(Da.call(t)):za(t),d):h},d.bandwidth=function(t){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*t*t+1)-1)/2,m()},d},contours:Ha,count:g,create:function(t){return $e(Gt(t).call(document.documentElement))},creator:Gt,cross:function(...t){const e="function"==typeof t[t.length-1]&&function(t){return e=>t(...e)}(t.pop()),n=(t=t.map(m)).map(_),r=t.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(y))return o;for(;;){o.push(i.map((e,n)=>t[n][e]));let a=r;for(;++i[a]===n[a];){if(0===a)return e?o.map(e):o;i[a--]=0}}},csv:il,csvFormat:Bs,csvFormatBody:zs,csvFormatRow:Gs,csvFormatRows:Fs,csvFormatValue:js,csvParse:Vs,csvParseRows:Ds,cubehelix:wr,cumsum:function(t,e){var n=0,r=0;return Float64Array.from(t,void 0===e?t=>n+=+t||0:i=>n+=+e(i,r++,t)||0)},curveBasis:Ix,curveBasisClosed:function(t){return new Lx(t)},curveBasisOpen:function(t){return new Px(t)},curveBumpX:$v,curveBumpY:Xv,curveBundle:Dx,curveCardinal:Fx,curveCardinalClosed:jx,curveCardinalOpen:Yx,curveCatmullRom:Wx,curveCatmullRomClosed:Xx,curveCatmullRomOpen:Zx,curveLinear:Nv,curveLinearClosed:function(t){return new Jx(t)},curveMonotoneX:function(t){return new rw(t)},curveMonotoneY:function(t){return new iw(t)},curveNatural:lw,curveStep:uw,curveStepAfter:function(t){return new cw(t,1)},curveStepBefore:function(t){return new cw(t,0)},descending:e,deviation:v,difference:function(t,...e){t=new A(t);for(const n of e)for(const e of n)t.delete(e);return t},disjoint:function(t,e){const n=e[Symbol.iterator](),r=new A;for(const e of t){if(r.has(e))return!1;let t,i;for(;({value:t,done:i}=n.next())&&!i;){if(Object.is(e,t))return!1;r.add(t)}}return!0},dispatch:Nt,drag:function(){var t,e,n,r,i=cn,o=un,a=hn,s=fn,l={},c=Nt("start","drag","end"),u=0,h=0;function f(t){t.on("mousedown.drag",d).filter(s).on("touchstart.drag",_).on("touchmove.drag",y,tn).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(a,s){if(!r&&i.call(this,a,s)){var l=b(this,o.call(this,a,s),a,s,"mouse");l&&($e(a.view).on("mousemove.drag",p,en).on("mouseup.drag",g,en),on(a.view),nn(a),n=!1,t=a.clientX,e=a.clientY,l("start",a))}}function p(r){if(rn(r),!n){var i=r.clientX-t,o=r.clientY-e;n=i*i+o*o>h}l.mouse("drag",r)}function g(t){$e(t.view).on("mousemove.drag mouseup.drag",null),an(t.view,n),rn(t),l.mouse("end",t)}function _(t,e){if(i.call(this,t,e)){var n,r,a=t.changedTouches,s=o.call(this,t,e),l=a.length;for(n=0;n<l;++n)(r=b(this,s,t,e,a[n].identifier,a[n]))&&(nn(t),r("start",t,a[n]))}}function y(t){var e,n,r=t.changedTouches,i=r.length;for(e=0;e<i;++e)(n=l[r[e].identifier])&&(rn(t),n("drag",t,r[e]))}function m(t){var e,n,i=t.changedTouches,o=i.length;for(r&&clearTimeout(r),r=setTimeout(function(){r=null},500),e=0;e<o;++e)(n=l[i[e].identifier])&&(nn(t),n("end",t,i[e]))}function b(t,e,n,r,i,o){var s,h,d,p=c.copy(),g=Qe(o||n,e);if(null!=(d=a.call(t,new ln("beforestart",{sourceEvent:n,target:f,identifier:i,active:u,x:g[0],y:g[1],dx:0,dy:0,dispatch:p}),r)))return s=d.x-g[0]||0,h=d.y-g[1]||0,function n(o,a,c){var _,y=g;switch(o){case"start":l[i]=n,_=u++;break;case"end":delete l[i],--u;case"drag":g=Qe(c||a,e),_=u}p.call(o,t,new ln(o,{sourceEvent:a,subject:d,target:f,identifier:i,active:_,x:g[0]+s,y:g[1]+h,dx:g[0]-y[0],dy:g[1]-y[1],dispatch:p}),r)}}return f.filter=function(t){return arguments.length?(i="function"==typeof t?t:sn(!!t),f):i},f.container=function(t){return arguments.length?(o="function"==typeof t?t:sn(t),f):o},f.subject=function(t){return arguments.length?(a="function"==typeof t?t:sn(t),f):a},f.touchable=function(t){return arguments.length?(s="function"==typeof t?t:sn(!!t),f):s},f.on=function(){var t=c.on.apply(c,arguments);return t===c?f:t},f.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,f):Math.sqrt(h)},f},dragDisable:on,dragEnable:an,dsv:function(t,e,n,r){3===arguments.length&&"function"==typeof n&&(r=n,n=void 0);var i=Ls(t);return nl(e,n).then(function(t){return i.parse(t,r)})},dsvFormat:Ls,easeBack:Ro,easeBackIn:ko,easeBackInOut:Ro,easeBackOut:Mo,easeBounce:So,easeBounceIn:function(t){return 1-So(1-t)},easeBounceInOut:function(t){return((t*=2)<=1?1-So(1-t):So(t-1)+1)/2},easeBounceOut:So,easeCircle:mo,easeCircleIn:function(t){return 1-Math.sqrt(1-t*t)},easeCircleInOut:mo,easeCircleOut:function(t){return Math.sqrt(1- --t*t)},easeCubic:lo,easeCubicIn:function(t){return t*t*t},easeCubicInOut:lo,easeCubicOut:function(t){return--t*t*t+1},easeElastic:Io,easeElasticIn:No,easeElasticInOut:Lo,easeElasticOut:Io,easeExp:yo,easeExpIn:function(t){return _o(1-+t)},easeExpInOut:yo,easeExpOut:function(t){return 1-_o(t)},easeLinear:t=>+t,easePoly:ho,easePolyIn:co,easePolyInOut:ho,easePolyOut:uo,easeQuad:so,easeQuadIn:function(t){return t*t},easeQuadInOut:so,easeQuadOut:function(t){return t*(2-t)},easeSin:go,easeSinIn:function(t){return 1===+t?1:1-Math.cos(t*po)},easeSinInOut:go,easeSinOut:function(t){return Math.sin(t*po)},every:function(t,e){if("function"!=typeof e)throw new TypeError("test is not a function");let n=-1;for(const r of t)if(!e(r,++n,t))return!1;return!0},extent:x,fcumsum:function(t,e){const n=new w;let r=-1;return Float64Array.from(t,void 0===e?t=>n.add(+t||0):i=>n.add(+e(i,++r,t)||0))},filter:function(t,e){if("function"!=typeof e)throw new TypeError("test is not a function");const n=[];let r=-1;for(const i of t)e(i,++r,t)&&n.push(i);return n},flatGroup:function(t,...e){return N(O(t,...e),e)},flatRollup:function(t,e,...n){return N(L(t,e,...n),n)},forceCenter:hl,forceCollide:function(t){var e,n,r,i=1,o=1;function a(){for(var t,a,l,c,u,h,f,d=e.length,p=0;p<o;++p)for(a=_l(e,wl,El).visitAfter(s),t=0;t<d;++t)l=e[t],h=n[l.index],f=h*h,c=l.x+l.vx,u=l.y+l.vy,a.visit(g);function g(t,e,n,o,a){var s=t.data,d=t.r,p=h+d;if(!s)return e>c+p||o<c-p||n>u+p||a<u-p;if(s.index>l.index){var g=c-s.x-s.vx,_=u-s.y-s.vy,y=g*g+_*_;y<p*p&&(0===g&&(y+=(g=xl(r))*g),0===_&&(y+=(_=xl(r))*_),y=(p-(y=Math.sqrt(y)))/y*i,l.vx+=(g*=y)*(p=(d*=d)/(f+d)),l.vy+=(_*=y)*p,s.vx-=g*(p=1-p),s.vy-=_*p)}}}function s(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function l(){if(e){var r,i,o=e.length;for(n=new Array(o),r=0;r<o;++r)i=e[r],n[i.index]=+t(i,r,e)}}return"function"!=typeof t&&(t=vl(null==t?1:+t)),a.initialize=function(t,n){e=t,r=n,l()},a.iterations=function(t){return arguments.length?(o=+t,a):o},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:vl(+e),l(),a):t},a},forceLink:Sl,forceManyBody:Nl,forceRadial:function(t,e,n){var r,i,o,a=vl(.1);function s(t){for(var a=0,s=r.length;a<s;++a){var l=r[a],c=l.x-e||1e-6,u=l.y-n||1e-6,h=Math.sqrt(c*c+u*u),f=(o[a]-h)*i[a]*t/h;l.vx+=c*f,l.vy+=u*f}}function l(){if(r){var e,n=r.length;for(i=new Array(n),o=new Array(n),e=0;e<n;++e)o[e]=+t(r[e],e,r),i[e]=isNaN(o[e])?0:+a(r[e],e,r)}}return"function"!=typeof t&&(t=vl(+t)),null==e&&(e=0),null==n&&(n=0),s.initialize=function(t){r=t,l()},s.strength=function(t){return arguments.length?(a="function"==typeof t?t:vl(+t),l(),s):a},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:vl(+e),l(),s):t},s.x=function(t){return arguments.length?(e=+t,s):e},s.y=function(t){return arguments.length?(n=+t,s):n},s},forceSimulation:Ol,forceX:Il,forceY:Ll,get format(){return Hl},formatDefaultLocale:Kl,formatLocale:Xl,get formatPrefix(){return ql},formatSpecifier:zl,fsum:function(t,e){const n=new w;if(void 0===e)for(let e of t)(e=+e)&&n.add(e);else{let r=-1;for(let i of t)(i=+e(i,++r,t))&&n.add(i)}return+n},geoAlbers:id,geoAlbersUsa:function(){var t,e,n,r,i,o,a=id(),s=rd().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=rd().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(t,e){o=[t,e]}};function u(t){var e=t[0],a=t[1];return o=null,n.point(e,a),o||(r.point(e,a),o)||(i.point(e,a),o)}function h(){return t=e=null,u}return u.invert=function(t){var e=a.scale(),n=a.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?s:i>=.166&&i<.234&&r>=-.214&&r<-.115?l:a).invert(t)},u.stream=function(n){return t&&e===n?t:(r=[a.stream(e=n),s.stream(n),l.stream(n)],i=r.length,t={point:function(t,e){for(var n=-1;++n<i;)r[n].point(t,e)},sphere:function(){for(var t=-1;++t<i;)r[t].sphere()},lineStart:function(){for(var t=-1;++t<i;)r[t].lineStart()},lineEnd:function(){for(var t=-1;++t<i;)r[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<i;)r[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<i;)r[t].polygonEnd()}});var r,i},u.precision=function(t){return arguments.length?(a.precision(t),s.precision(t),l.precision(t),h()):a.precision()},u.scale=function(t){return arguments.length?(a.scale(t),s.scale(.35*t),l.scale(t),u.translate(a.translate())):a.scale()},u.translate=function(t){if(!arguments.length)return a.translate();var e=a.scale(),o=+t[0],u=+t[1];return n=a.translate(t).clipExtent([[o-.455*e,u-.238*e],[o+.455*e,u+.238*e]]).stream(c),r=s.translate([o-.307*e,u+.201*e]).clipExtent([[o-.425*e+tc,u+.12*e+tc],[o-.214*e-tc,u+.234*e-tc]]).stream(c),i=l.translate([o-.205*e,u+.212*e]).clipExtent([[o-.214*e+tc,u+.166*e+tc],[o-.115*e-tc,u+.234*e-tc]]).stream(c),h()},u.fitExtent=function(t,e){return Hf(u,t,e)},u.fitSize=function(t,e){return qf(u,t,e)},u.fitWidth=function(t,e){return Wf(u,t,e)},u.fitHeight=function(t,e){return $f(u,t,e)},u.scale(1070)},geoArea:function(t){return $c=new w,Rc(t,Xc),2*$c},geoAzimuthalEqualArea:function(){return Qf(sd).scale(124.75).clipAngle(179.999)},geoAzimuthalEqualAreaRaw:sd,geoAzimuthalEquidistant:function(){return Qf(ld).scale(79.4188).clipAngle(179.999)},geoAzimuthalEquidistantRaw:ld,geoBounds:function(t){var e,n,r,i,o,a,s;if(zc=Bc=-(Vc=Dc=1/0),Hc=[],Rc(t,Eu),n=Hc.length){for(Hc.sort(Nu),e=1,o=[r=Hc[0]];e<n;++e)Iu(r,(i=Hc[e])[0])||Iu(r,i[1])?(Ou(r[0],i[1])>Ou(r[0],r[1])&&(r[1]=i[1]),Ou(i[0],r[1])>Ou(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,e=0,r=o[n=o.length-1];e<=n;r=i,++e)i=o[e],(s=Ou(r[1],i[0]))>a&&(a=s,Vc=i[0],Bc=r[1])}return Hc=qc=null,Vc===1/0||Dc===1/0?[[NaN,NaN],[NaN,NaN]]:[[Vc,Dc],[Bc,zc]]},geoCentroid:function(t){su=lu=cu=uu=hu=fu=du=pu=0,gu=new w,_u=new w,yu=new w,Rc(t,Lu);var e=+gu,n=+_u,r=+yu,i=pc(e,n,r);return i<ec&&(e=fu,n=du,r=pu,lu<tc&&(e=cu,n=uu,r=hu),(i=pc(e,n,r))<ec)?[NaN,NaN]:[uc(n,e)*ac,wc(r/i)*ac]},geoCircle:function(){var t,e,n=Hu([0,0]),r=Hu(90),i=Hu(2),o={point:function(n,r){t.push(n=e(n,r)),n[0]*=ac,n[1]*=ac}};function a(){var a=n.apply(this,arguments),s=r.apply(this,arguments)*sc,l=i.apply(this,arguments)*sc;return t=[],e=$u(-a[0]*sc,-a[1]*sc,0).invert,Qu(o,s,l,1),a={type:"Polygon",coordinates:[t]},t=e=null,a}return a.center=function(t){return arguments.length?(n="function"==typeof t?t:Hu([+t[0],+t[1]]),a):n},a.radius=function(t){return arguments.length?(r="function"==typeof t?t:Hu(+t),a):r},a.precision=function(t){return arguments.length?(i="function"==typeof t?t:Hu(+t),a):i},a},geoClipAntimeridian:hh,geoClipCircle:fh,geoClipExtent:function(){var t,e,n,r=0,i=0,o=960,a=500;return n={stream:function(n){return t&&e===n?t:t=bh(r,i,o,a)(e=n)},extent:function(s){return arguments.length?(r=+s[0][0],i=+s[0][1],o=+s[1][0],a=+s[1][1],t=e=null,n):[[r,i],[o,a]]}}},geoClipRectangle:bh,geoConicConformal:function(){return ed(fd).scale(109.5).parallels([30,30])},geoConicConformalRaw:fd,geoConicEqualArea:rd,geoConicEqualAreaRaw:nd,geoConicEquidistant:function(){return ed(pd).scale(131.154).center([0,13.9389])},geoConicEquidistantRaw:pd,geoContains:function(t,e){return(t&&kh.hasOwnProperty(t.type)?kh[t.type]:Rh)(t,e)},geoDistance:Ch,geoEqualEarth:function(){return Qf(vd).scale(177.158)},geoEqualEarthRaw:vd,geoEquirectangular:function(){return Qf(dd).scale(152.63)},geoEquirectangularRaw:dd,geoGnomonic:function(){return Qf(xd).scale(144.049).clipAngle(60)},geoGnomonicRaw:xd,geoGraticule:Bh,geoGraticule10:function(){return Bh()()},geoIdentity:function(){var t,e,n,r,i,o,a,s=1,l=0,c=0,u=1,h=1,f=0,d=null,p=1,g=1,_=jf({point:function(t,e){var n=b([t,e]);this.stream.point(n[0],n[1])}}),y=Uh;function m(){return p=s*u,g=s*h,o=a=null,b}function b(n){var r=n[0]*p,i=n[1]*g;if(f){var o=i*t-r*e;r=r*t+i*e,i=o}return[r+l,i+c]}return b.invert=function(n){var r=n[0]-l,i=n[1]-c;if(f){var o=i*t+r*e;r=r*t-i*e,i=o}return[r/p,i/g]},b.stream=function(t){return o&&a===t?o:o=_(y(a=t))},b.postclip=function(t){return arguments.length?(y=t,d=n=r=i=null,m()):y},b.clipExtent=function(t){return arguments.length?(y=null==t?(d=n=r=i=null,Uh):bh(d=+t[0][0],n=+t[0][1],r=+t[1][0],i=+t[1][1]),m()):null==d?null:[[d,n],[r,i]]},b.scale=function(t){return arguments.length?(s=+t,m()):s},b.translate=function(t){return arguments.length?(l=+t[0],c=+t[1],m()):[l,c]},b.angle=function(n){return arguments.length?(e=yc(f=n%360*sc),t=hc(f),m()):f*ac},b.reflectX=function(t){return arguments.length?(u=t?-1:1,m()):u<0},b.reflectY=function(t){return arguments.length?(h=t?-1:1,m()):h<0},b.fitExtent=function(t,e){return Hf(b,t,e)},b.fitSize=function(t,e){return qf(b,t,e)},b.fitWidth=function(t,e){return Wf(b,t,e)},b.fitHeight=function(t,e){return $f(b,t,e)},b},geoInterpolate:function(t,e){var n=t[0]*sc,r=t[1]*sc,i=e[0]*sc,o=e[1]*sc,a=hc(r),s=yc(r),l=hc(o),c=yc(o),u=a*hc(n),h=a*yc(n),f=l*hc(i),d=l*yc(i),p=2*wc(bc(Ec(o-r)+a*l*Ec(i-n))),g=yc(p),_=p?function(t){var e=yc(t*=p)/g,n=yc(p-t)/g,r=n*u+e*f,i=n*h+e*d,o=n*s+e*c;return[uc(i,r)*ac,uc(o,bc(r*r+i*i))*ac]}:function(){return[n*ac,r*ac]};return _.distance=p,_},geoLength:Ah,geoMercator:function(){return ud(cd).scale(961/oc)},geoMercatorRaw:cd,geoNaturalEarth1:function(){return Qf(wd).scale(175.295)},geoNaturalEarth1Raw:wd,geoOrthographic:function(){return Qf(Ed).scale(249.5).clipAngle(90.000001)},geoOrthographicRaw:Ed,geoPath:function(t,e){let n,r,i=3,o=4.5;function a(t){return t&&("function"==typeof o&&r.pointRadius(+o.apply(this,arguments)),Rc(t,n(r))),r.result()}return a.area=function(t){return Rc(t,n(qh)),qh.result()},a.measure=function(t){return Rc(t,n(If)),If.result()},a.bounds=function(t){return Rc(t,n(ef)),ef.result()},a.centroid=function(t){return Rc(t,n(_f)),_f.result()},a.projection=function(e){return arguments.length?(n=null==e?(t=null,Uh):(t=e).stream,a):t},a.context=function(t){return arguments.length?(r=null==t?(e=null,new Ff(i)):new Sf(e=t),"function"!=typeof o&&r.pointRadius(o),a):e},a.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(r.pointRadius(+t),+t),a):o},a.digits=function(t){if(!arguments.length)return i;if(null==t)i=null;else{const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);i=e}return null===e&&(r=new Ff(i)),a},a.projection(t).digits(i).context(e)},geoProjection:Qf,geoProjectionMutator:td,geoRotation:Ju,geoStereographic:function(){return Qf(Ad).scale(250).clipAngle(142)},geoStereographicRaw:Ad,geoStream:Rc,geoTransform:function(t){return{stream:jf(t)}},geoTransverseMercator:function(){var t=ud(Td),e=t.center,n=t.rotate;return t.center=function(t){return arguments.length?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return arguments.length?n([t[0],t[1],t.length>2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)},geoTransverseMercatorRaw:Td,gray:function(t,e){return new or(t,0,0,null==e?1:e)},greatest:ot,greatestIndex:function(e,n=t){if(1===n.length)return tt(e,n);let r,i=-1,o=-1;for(const t of e)++o,(i<0?0===n(t,t):n(t,r)>0)&&(r=t,i=o);return i},group:R,groupSort:function(e,n,r){return(2!==n.length?B(I(e,n,r),([e,n],[r,i])=>t(n,i)||t(e,r)):B(R(e,r),([e,r],[i,o])=>n(r,o)||t(e,i))).map(([t])=>t)},groups:O,hcl:hr,hierarchy:Od,histogram:J,hsl:Yn,html:cl,image:function(t,e){return new Promise(function(n,r){var i=new Image;for(var o in e)i[o]=e[o];i.onerror=r,i.onload=function(){n(i)},i.src=t})},index:function(t,...e){return V(t,M,P,e)},indexes:function(t,...e){return V(t,Array.from,P,e)},interpolate:Hr,interpolateArray:function(t,e){return(Dr(e)?Vr:Br)(t,e)},interpolateBasis:Tr,interpolateBasisClosed:Sr,interpolateBlues:zb,interpolateBrBG:Zm,interpolateBuGn:gb,interpolateBuPu:yb,interpolateCividis:function(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-t*(35.34-t*(2381.73-t*(6402.7-t*(7024.72-2710.57*t)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+t*(170.73+t*(52.82-t*(131.46-t*(176.58-67.37*t)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+t*(442.36-t*(2482.43-t*(6167.24-t*(6614.94-2475.67*t)))))))+")"},interpolateCool:Jb,interpolateCubehelix:ci,interpolateCubehelixDefault:Kb,interpolateCubehelixLong:ui,interpolateDate:zr,interpolateDiscrete:function(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}},interpolateGnBu:bb,interpolateGreens:Gb,interpolateGreys:Ub,interpolateHcl:ai,interpolateHclLong:si,interpolateHsl:ri,interpolateHslLong:ii,interpolateHue:function(t,e){var n=Mr(+t,+e);return function(t){var e=n(t);return e-360*Math.floor(e/360)}},interpolateInferno:sv,interpolateLab:function(t,e){var n=Or((t=ir(t)).l,(e=ir(e)).l),r=Or(t.a,e.a),i=Or(t.b,e.b),o=Or(t.opacity,e.opacity);return function(e){return t.l=n(e),t.a=r(e),t.b=i(e),t.opacity=o(e),t+""}},interpolateMagma:av,interpolateNumber:Fr,interpolateNumberArray:Vr,interpolateObject:Gr,interpolateOrRd:xb,interpolateOranges:Xb,interpolatePRGn:Qm,interpolatePiYG:eb,interpolatePlasma:lv,interpolatePuBu:Tb,interpolatePuBuGn:Eb,interpolatePuOr:rb,interpolatePuRd:Cb,interpolatePurples:Hb,interpolateRainbow:function(t){(t<0||t>1)&&(t-=Math.floor(t));var e=Math.abs(t-.5);return Qb.h=360*t-100,Qb.s=1.5-1.5*e,Qb.l=.8-.9*e,Qb+""},interpolateRdBu:ob,interpolateRdGy:sb,interpolateRdPu:Mb,interpolateRdYlBu:cb,interpolateRdYlGn:hb,interpolateReds:Wb,interpolateRgb:Nr,interpolateRgbBasis:Lr,interpolateRgbBasisClosed:Pr,interpolateRound:qr,interpolateSinebow:function(t){var e;return t=(.5-t)*Math.PI,tv.r=255*(e=Math.sin(t))*e,tv.g=255*(e=Math.sin(t+ev))*e,tv.b=255*(e=Math.sin(t+nv))*e,tv+""},interpolateSpectral:db,interpolateString:Yr,interpolateTransformCss:Jr,interpolateTransformSvg:Qr,interpolateTurbo:rv,interpolateViridis:ov,interpolateWarm:Zb,interpolateYlGn:Ib,interpolateYlGnBu:Ob,interpolateYlOrBr:Pb,interpolateYlOrRd:Db,interpolateZoom:ei,interrupt:Di,intersection:function(t,...e){t=new A(t),e=e.map(vt);t:for(const n of t)for(const r of e)if(!r.has(n)){t.delete(n);continue t}return t},interval:function(t,e,n){var r=new Ai,i=e;return null==e?(r.restart(t,e,n),r):(r._restart=r.restart,r.restart=function(t,e,n){e=+e,n=null==n?wi():+n,r._restart(function o(a){a+=i,r._restart(o,i+=e,n),t(a)},e,n)},r.restart(t,e,n),r)},isoFormat:Tm,isoParse:Sm,json:function(t,e){return fetch(t,e).then(al)},lab:ir,lch:function(t,e,n,r){return 1===arguments.length?ur(t):new fr(n,e,t,null==r?1:r)},least:function(e,n=t){let r,i=!1;if(1===n.length){let o;for(const a of e){const e=n(a);(i?t(e,o)<0:0===t(e,e))&&(r=a,o=e,i=!0)}}else for(const t of e)(i?n(t,r)<0:0===n(t,t))&&(r=t,i=!0);return r},leastIndex:pt,line:Pv,lineRadial:Uv,link:Qv,linkHorizontal:tx,linkRadial:nx,linkVertical:ex,local:Ke,map:function(t,e){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");if("function"!=typeof e)throw new TypeError("mapper is not a function");return Array.from(t,(n,r)=>e(n,r,t))},matcher:Wt,max:Q,maxIndex:tt,mean:ct,median:ut,medianIndex:function(t,e){return lt(t,.5,e)},merge:ht,min:et,minIndex:nt,mode:function(t,e){const n=new E;if(void 0===e)for(let e of t)null!=e&&e>=e&&n.set(e,(n.get(e)||0)+1);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&i>=i&&n.set(i,(n.get(i)||0)+1)}let r,i=0;for(const[t,e]of n)e>i&&(i=e,r=t);return r},namespace:Bt,namespaces:Dt,nice:K,now:wi,pack:rp,packEnclose:function(t){return Ud(t,jd())},packSiblings:function(t){return ep(t,jd()),t},pairs:function(t,e=ft){const n=[];let r,i=!1;for(const o of t)i&&n.push(e(r,o)),r=o,i=!0;return n},partition:function(){var t=1,e=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/o,i.eachBefore(function(t,e){return function(r){r.children&&lp(r,r.x0,t*(r.depth+1)/e,r.x1,t*(r.depth+2)/e);var i=r.x0,o=r.y0,a=r.x1-n,s=r.y1-n;a<i&&(i=a=(i+a)/2),s<o&&(o=s=(o+s)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=s}}(e,o)),r&&i.eachBefore(sp),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(n){return arguments.length?(t=+n[0],e=+n[1],i):[t,e]},i.padding=function(t){return arguments.length?(n=+t,i):n},i},path:Sa,pathRound:function(t=3){return new Ta(+t)},permute:D,pie:function(){var t=Bv,e=Dv,n=null,r=cv(0),i=cv(vv),o=cv(0);function a(a){var s,l,c,u,h,f=(a=Rv(a)).length,d=0,p=new Array(f),g=new Array(f),_=+r.apply(this,arguments),y=Math.min(vv,Math.max(-vv,i.apply(this,arguments)-_)),m=Math.min(Math.abs(y)/f,o.apply(this,arguments)),b=m*(y<0?-1:1);for(s=0;s<f;++s)(h=g[p[s]=s]=+t(a[s],s,a))>0&&(d+=h);for(null!=e?p.sort(function(t,n){return e(g[t],g[n])}):null!=n&&p.sort(function(t,e){return n(a[t],a[e])}),s=0,c=d?(y-f*b)/d:0;s<f;++s,_=u)l=p[s],u=_+((h=g[l])>0?h*c:0)+b,g[l]={data:a[l],index:s,value:h,startAngle:_,endAngle:u,padAngle:m};return g}return a.value=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),a):t},a.sortValues=function(t){return arguments.length?(e=t,n=null,a):e},a.sort=function(t){return arguments.length?(n=t,e=null,a):n},a.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:cv(+t),a):r},a.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:cv(+t),a):i},a.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:cv(+t),a):o},a},piecewise:hi,pointRadial:Hv,pointer:Qe,pointers:function(t,e){return t.target&&(t=Je(t),void 0===e&&(e=t.currentTarget),t=t.touches||[t]),Array.from(t,t=>Qe(t,e))},polygonArea:function(t){for(var e,n=-1,r=t.length,i=t[r-1],o=0;++n<r;)e=i,i=t[n],o+=e[1]*i[0]-e[0]*i[1];return o/2},polygonCentroid:function(t){for(var e,n,r=-1,i=t.length,o=0,a=0,s=t[i-1],l=0;++r<i;)e=s,s=t[r],l+=n=e[0]*s[1]-s[0]*e[1],o+=(e[0]+s[0])*n,a+=(e[1]+s[1])*n;return[o/(l*=3),a/l]},polygonContains:function(t,e){for(var n,r,i=t.length,o=t[i-1],a=e[0],s=e[1],l=o[0],c=o[1],u=!1,h=0;h<i;++h)n=(o=t[h])[0],(r=o[1])>s!=c>s&&a<(l-n)*(s-r)/(c-r)+n&&(u=!u),l=n,c=r;return u},polygonHull:function(t){if((n=t.length)<3)return null;var e,n,r=new Array(n),i=new Array(n);for(e=0;e<n;++e)r[e]=[+t[e][0],+t[e][1],e];for(r.sort(Rp),e=0;e<n;++e)i[e]=[r[e][0],-r[e][1]];var o=Op(r),a=Op(i),s=a[0]===o[0],l=a[a.length-1]===o[o.length-1],c=[];for(e=o.length-1;e>=0;--e)c.push(t[r[o[e]][2]]);for(e=+s;e<a.length-l;++e)c.push(t[r[a[e]][2]]);return c},polygonLength:function(t){for(var e,n,r=-1,i=t.length,o=t[i-1],a=o[0],s=o[1],l=0;++r<i;)e=a,n=s,e-=a=(o=t[r])[0],n-=s=o[1],l+=Math.hypot(e,n);return l},precisionFixed:Zl,precisionPrefix:Jl,precisionRound:Ql,quadtree:_l,quantile:at,quantileIndex:lt,quantileSorted:st,quantize:function(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t(r/(e-1));return n},quickselect:rt,radialArea:Yv,radialLine:Uv,randomBates:Bp,randomBernoulli:Gp,randomBeta:Yp,randomBinomial:Hp,randomCauchy:Wp,randomExponential:zp,randomGamma:Up,randomGeometric:jp,randomInt:Lp,randomIrwinHall:Dp,randomLcg:function(t=Math.random()){let e=0|(0<=t&&t<1?t/Kp:Math.abs(t));return()=>(e=1664525*e+1013904223|0,Kp*(e>>>0))},randomLogNormal:Vp,randomLogistic:$p,randomNormal:Pp,randomPareto:Fp,randomPoisson:Xp,randomUniform:Ip,randomWeibull:qp,range:dt,rank:function(e,n=t){if("function"!=typeof e[Symbol.iterator])throw new TypeError("values is not iterable");let r=Array.from(e);const i=new Float64Array(r.length);2!==n.length&&(r=r.map(n),n=t);const o=(t,e)=>n(r[t],r[e]);let a,s;return(e=Uint32Array.from(r,(t,e)=>e)).sort(n===t?(t,e)=>F(r[t],r[e]):z(o)),e.forEach((t,e)=>{const n=o(t,void 0===a?t:a);n>=0?((void 0===a||n>0)&&(a=t,s=e),i[t]=s):i[t]=NaN}),i},reduce:function(t,e,n){if("function"!=typeof e)throw new TypeError("reducer is not a function");const r=t[Symbol.iterator]();let i,o,a=-1;if(arguments.length<3){if(({done:i,value:n}=r.next()),i)return;++a}for(;({done:i,value:o}=r.next()),!i;)n=e(n,o,++a,t);return n},reverse:function(t){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");return Array.from(t).reverse()},rgb:Pn,ribbon:function(){return Va()},ribbonArrow:function(){return Va(Pa)},rollup:I,rollups:L,scaleBand:eg,scaleDiverging:function t(){var e=pg(Pm()(ag));return e.copy=function(){return Nm(e,t())},Jp.apply(e,arguments)},scaleDivergingLog:function t(){var e=Eg(Pm()).domain([.1,1,10]);return e.copy=function(){return Nm(e,t()).base(e.base())},Jp.apply(e,arguments)},scaleDivergingPow:Vm,scaleDivergingSqrt:function(){return Vm.apply(null,arguments).exponent(.5)},scaleDivergingSymlog:function t(){var e=Cg(Pm());return e.copy=function(){return Nm(e,t()).constant(e.constant())},Jp.apply(e,arguments)},scaleIdentity:function t(e){var n;function r(t){return null==t||isNaN(t=+t)?n:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=Array.from(t,ig),r):e.slice()},r.unknown=function(t){return arguments.length?(n=t,r):n},r.copy=function(){return t(e).unknown(n)},e=arguments.length?Array.from(e,ig):[0,1],pg(r)},scaleImplicit:Qp,scaleLinear:gg,scaleLog:Ag,scaleOrdinal:tg,scalePoint:rg,scalePow:Ng,scaleQuantile:function e(){var n,r=[],i=[],o=[];function s(){var t=0,e=Math.max(1,i.length);for(o=new Array(e-1);++t<e;)o[t-1]=st(r,t/e);return l}function l(t){return null==t||isNaN(t=+t)?n:i[a(o,t)]}return l.invertExtent=function(t){var e=i.indexOf(t);return e<0?[NaN,NaN]:[e>0?o[e-1]:r[0],e<o.length?o[e]:r[r.length-1]]},l.domain=function(e){if(!arguments.length)return r.slice();r=[];for(let t of e)null==t||isNaN(t=+t)||r.push(t);return r.sort(t),s()},l.range=function(t){return arguments.length?(i=Array.from(t),s()):i.slice()},l.unknown=function(t){return arguments.length?(n=t,l):n},l.quantiles=function(){return o.slice()},l.copy=function(){return e().domain(r).range(i).unknown(n)},Zp.apply(l,arguments)},scaleQuantize:function t(){var e,n=0,r=1,i=1,o=[.5],s=[0,1];function l(t){return null!=t&&t<=t?s[a(o,t,0,i)]:e}function c(){var t=-1;for(o=new Array(i);++t<i;)o[t]=((t+1)*r-(t-i)*n)/(i+1);return l}return l.domain=function(t){return arguments.length?([n,r]=t,n=+n,r=+r,c()):[n,r]},l.range=function(t){return arguments.length?(i=(s=Array.from(t)).length-1,c()):s.slice()},l.invertExtent=function(t){var e=s.indexOf(t);return e<0?[NaN,NaN]:e<1?[n,o[0]]:e>=i?[o[i-1],r]:[o[e-1],o[e]]},l.unknown=function(t){return arguments.length?(e=t,l):l},l.thresholds=function(){return o.slice()},l.copy=function(){return t().domain([n,r]).range(s).unknown(e)},Zp.apply(pg(l),arguments)},scaleRadial:function t(){var e,n=fg(),r=[0,1],i=!1;function o(t){var r=function(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}(n(t));return isNaN(r)?e:i?Math.round(r):r}return o.invert=function(t){return n.invert(Ig(t))},o.domain=function(t){return arguments.length?(n.domain(t),o):n.domain()},o.range=function(t){return arguments.length?(n.range((r=Array.from(t,ig)).map(Ig)),o):r.slice()},o.rangeRound=function(t){return o.range(t).round(!0)},o.round=function(t){return arguments.length?(i=!!t,o):i},o.clamp=function(t){return arguments.length?(n.clamp(t),o):n.clamp()},o.unknown=function(t){return arguments.length?(e=t,o):e},o.copy=function(){return t(n.domain(),r).round(i).clamp(n.clamp()).unknown(e)},Zp.apply(o,arguments),pg(o)},scaleSequential:Im,scaleSequentialLog:function t(){var e=Eg(Om()).domain([1,10]);return e.copy=function(){return Nm(e,t()).base(e.base())},Jp.apply(e,arguments)},scaleSequentialPow:Lm,scaleSequentialQuantile:function e(){var n=[],r=ag;function i(t){if(null!=t&&!isNaN(t=+t))return r((a(n,t,1)-1)/(n.length-1))}return i.domain=function(e){if(!arguments.length)return n.slice();n=[];for(let t of e)null==t||isNaN(t=+t)||n.push(t);return n.sort(t),i},i.interpolator=function(t){return arguments.length?(r=t,i):r},i.range=function(){return n.map((t,e)=>r(e/(n.length-1)))},i.quantiles=function(t){return Array.from({length:t+1},(e,r)=>at(n,r/t))},i.copy=function(){return e(r).domain(n)},Jp.apply(i,arguments)},scaleSequentialSqrt:function(){return Lm.apply(null,arguments).exponent(.5)},scaleSequentialSymlog:function t(){var e=Cg(Om());return e.copy=function(){return Nm(e,t()).constant(e.constant())},Jp.apply(e,arguments)},scaleSqrt:function(){return Ng.apply(null,arguments).exponent(.5)},scaleSymlog:function t(){var e=Cg(hg());return e.copy=function(){return ug(e,t()).constant(e.constant())},Zp.apply(e,arguments)},scaleThreshold:function t(){var e,n=[.5],r=[0,1],i=1;function o(t){return null!=t&&t<=t?r[a(n,t,0,i)]:e}return o.domain=function(t){return arguments.length?(n=Array.from(t),i=Math.min(n.length,r.length-1),o):n.slice()},o.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(n.length,r.length-1),o):r.slice()},o.invertExtent=function(t){var e=r.indexOf(t);return[n[e-1],n[e]]},o.unknown=function(t){return arguments.length?(e=t,o):e},o.copy=function(){return t().domain(n).range(r).unknown(e)},Zp.apply(o,arguments)},scaleTime:Rm,scaleUtc:function(){return Zp.apply(Mm(W_,$_,Y_,F_,A_,i_,t_,Kg,qg,iy).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},scan:function(t,e){const n=pt(t,e);return n<0?void 0:n},schemeAccent:zm,schemeBlues:Bb,schemeBrBG:Km,schemeBuGn:pb,schemeBuPu:_b,schemeCategory10:Bm,schemeDark2:Fm,schemeGnBu:mb,schemeGreens:Fb,schemeGreys:jb,schemeObservable10:Gm,schemeOrRd:vb,schemeOranges:$b,schemePRGn:Jm,schemePaired:jm,schemePastel1:Um,schemePastel2:Ym,schemePiYG:tb,schemePuBu:Ab,schemePuBuGn:wb,schemePuOr:nb,schemePuRd:Sb,schemePurples:Yb,schemeRdBu:ib,schemeRdGy:ab,schemeRdPu:kb,schemeRdYlBu:lb,schemeRdYlGn:ub,schemeReds:qb,schemeSet1:Hm,schemeSet2:qm,schemeSet3:Wm,schemeSpectral:fb,schemeTableau10:$m,schemeYlGn:Nb,schemeYlGnBu:Rb,schemeYlOrBr:Lb,schemeYlOrRd:Vb,select:$e,selectAll:function(t){return"string"==typeof t?new qe([document.querySelectorAll(t)],[document.documentElement]):new qe([Yt(t)],He)},selection:We,selector:Ut,selectorAll:qt,shuffle:gt,shuffler:_t,some:function(t,e){if("function"!=typeof e)throw new TypeError("test is not a function");let n=-1;for(const r of t)if(e(r,++n,t))return!0;return!1},sort:B,stack:function(){var t=cv([]),e=fw,n=hw,r=dw;function i(i){var o,a,s=Array.from(t.apply(this,arguments),pw),l=s.length,c=-1;for(const t of i)for(o=0,++c;o<l;++o)(s[o][c]=[0,+r(t,s[o].key,c,i)]).data=t;for(o=0,a=Rv(e(s));o<l;++o)s[a[o]].index=o;return n(s,a),s}return i.keys=function(e){return arguments.length?(t="function"==typeof e?e:cv(Array.from(e)),i):t},i.value=function(t){return arguments.length?(r="function"==typeof t?t:cv(+t),i):r},i.order=function(t){return arguments.length?(e=null==t?fw:"function"==typeof t?t:cv(Array.from(t)),i):e},i.offset=function(t){return arguments.length?(n=null==t?hw:t,i):n},i},stackOffsetDiverging:function(t,e){if((s=t.length)>0)for(var n,r,i,o,a,s,l=0,c=t[e[0]].length;l<c;++l)for(o=a=0,n=0;n<s;++n)(i=(r=t[e[n]][l])[1]-r[0])>0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=a,r[0]=a+=i):(r[0]=0,r[1]=i)},stackOffsetExpand:function(t,e){if((r=t.length)>0){for(var n,r,i,o=0,a=t[0].length;o<a;++o){for(i=n=0;n<r;++n)i+=t[n][o][1]||0;if(i)for(n=0;n<r;++n)t[n][o][1]/=i}hw(t,e)}},stackOffsetNone:hw,stackOffsetSilhouette:function(t,e){if((n=t.length)>0){for(var n,r=0,i=t[e[0]],o=i.length;r<o;++r){for(var a=0,s=0;a<n;++a)s+=t[a][r][1]||0;i[r][1]+=i[r][0]=-s/2}hw(t,e)}},stackOffsetWiggle:function(t,e){if((i=t.length)>0&&(r=(n=t[e[0]]).length)>0){for(var n,r,i,o=0,a=1;a<r;++a){for(var s=0,l=0,c=0;s<i;++s){for(var u=t[e[s]],h=u[a][1]||0,f=(h-(u[a-1][1]||0))/2,d=0;d<s;++d){var p=t[e[d]];f+=(p[a][1]||0)-(p[a-1][1]||0)}l+=h,c+=f*h}n[a-1][1]+=n[a-1][0]=o,l&&(o-=c/l)}n[a-1][1]+=n[a-1][0]=o,hw(t,e)}},stackOrderAppearance:gw,stackOrderAscending:yw,stackOrderDescending:function(t){return yw(t).reverse()},stackOrderInsideOut:function(t){var e,n,r=t.length,i=t.map(mw),o=gw(t),a=0,s=0,l=[],c=[];for(e=0;e<r;++e)n=o[e],a<s?(a+=i[n],l.push(n)):(s+=i[n],c.push(n));return c.reverse().concat(l)},stackOrderNone:fw,stackOrderReverse:function(t){return fw(t).reverse()},stratify:function(){var t,e=fp,n=dp;function r(r){var i,o,a,s,l,c,u,h,f=Array.from(r),d=e,p=n,g=new Map;if(null!=t){const e=f.map((e,n)=>function(t){t=`${t}`;let e=t.length;gp(t,e-1)&&!gp(t,e-2)&&(t=t.slice(0,-1));return"/"===t[0]?t:`/${t}`}(t(e,n,r))),n=e.map(pp),i=new Set(e).add("");for(const t of n)i.has(t)||(i.add(t),e.push(t),n.push(pp(t)),f.push(hp));d=(t,n)=>e[n],p=(t,e)=>n[e]}for(a=0,i=f.length;a<i;++a)o=f[a],c=f[a]=new Vd(o),null!=(u=d(o,a,r))&&(u+="")&&(h=c.id=u,g.set(h,g.has(h)?up:c)),null!=(u=p(o,a,r))&&(u+="")&&(c.parent=u);for(a=0;a<i;++a)if(u=(c=f[a]).parent){if(!(l=g.get(u)))throw new Error("missing: "+u);if(l===up)throw new Error("ambiguous: "+u);l.children?l.children.push(c):l.children=[c],c.parent=l}else{if(s)throw new Error("multiple roots");s=c}if(!s)throw new Error("no root");if(null!=t){for(;s.data===hp&&1===s.children.length;)s=s.children[0],--i;for(let t=f.length-1;t>=0&&(c=f[t]).data===hp;--t)c.data=null}if(s.parent=cp,s.eachBefore(function(t){t.depth=t.parent.depth+1,--i}).eachBefore(Pd),s.parent=null,i>0)throw new Error("cycle");return s}return r.id=function(t){return arguments.length?(e=Dd(t),r):e},r.parentId=function(t){return arguments.length?(n=Dd(t),r):n},r.path=function(e){return arguments.length?(t=Dd(e),r):t},r},style:_e,subset:function(t,e){return xt(e,t)},sum:yt,superset:xt,svg:ul,symbol:function(t,e){let n=null,r=wv(i);function i(){let i;if(n||(n=i=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),i)return n=null,i+""||null}return t="function"==typeof t?t:cv(t||ox),e="function"==typeof e?e:cv(void 0===e?64:+e),i.type=function(e){return arguments.length?(t="function"==typeof e?e:cv(e),i):t},i.size=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),i):e},i.context=function(t){return arguments.length?(n=null==t?null:t,i):n},i},symbolAsterisk:ix,symbolCircle:ox,symbolCross:ax,symbolDiamond:cx,symbolDiamond2:ux,symbolPlus:hx,symbolSquare:fx,symbolSquare2:dx,symbolStar:yx,symbolTimes:Cx,symbolTriangle:bx,symbolTriangle2:xx,symbolWye:Sx,symbolX:Cx,symbols:kx,symbolsFill:kx,symbolsStroke:Mx,text:nl,thresholdFreedmanDiaconis:function(t,e,n){const r=g(t),i=at(t,.75)-at(t,.25);return r&&i?Math.ceil((n-e)/(2*i*Math.pow(r,-1/3))):1},thresholdScott:function(t,e,n){const r=g(t),i=v(t);return r&&i?Math.ceil((n-e)*Math.cbrt(r)/(3.49*i)):1},thresholdSturges:Z,tickFormat:dg,tickIncrement:$,tickStep:X,ticks:W,timeDay:n_,timeDays:r_,get timeFormat(){return ny},timeFormatDefaultLocale:Em,timeFormatLocale:ty,timeFriday:p_,timeFridays:x_,timeHour:Jg,timeHours:Qg,timeInterval:Vg,timeMillisecond:Dg,timeMilliseconds:Bg,timeMinute:$g,timeMinutes:Xg,timeMonday:u_,timeMondays:y_,timeMonth:B_,timeMonths:z_,get timeParse(){return ry},timeSaturday:g_,timeSaturdays:w_,timeSecond:qg,timeSeconds:Wg,timeSunday:c_,timeSundays:__,timeThursday:d_,timeThursdays:v_,timeTickInterval:K_,timeTicks:X_,timeTuesday:h_,timeTuesdays:m_,timeWednesday:f_,timeWednesdays:b_,timeWeek:c_,timeWeeks:__,timeYear:j_,timeYears:U_,timeout:Ri,timer:Ti,timerFlush:Si,transition:io,transpose:mt,tree:wp,treemap:Cp,treemapBinary:function(t,e,n,r,i){var o,a,s=t.children,l=s.length,c=new Array(l+1);for(c[0]=a=o=0;o<l;++o)c[o+1]=a+=s[o].value;!function t(e,n,r,i,o,a,l){if(e>=n-1){var u=s[e];return u.x0=i,u.y0=o,u.x1=a,void(u.y1=l)}var h=c[e],f=r/2+h,d=e+1,p=n-1;for(;d<p;){var g=d+p>>>1;c[g]<f?d=g+1:p=g}f-c[d-1]<c[d]-f&&e+1<d&&--d;var _=c[d]-h,y=r-_;if(a-i>l-o){var m=r?(i*y+a*_)/r:a;t(e,d,_,i,o,m,l),t(d,n,y,m,o,a,l)}else{var b=r?(o*y+l*_)/r:l;t(e,d,_,i,o,a,b),t(d,n,y,i,b,a,l)}}(0,l,t.value,e,n,r,i)},treemapDice:lp,treemapResquarify:kp,treemapSlice:Ep,treemapSliceDice:function(t,e,n,r,i){(1&t.depth?Ep:lp)(t,e,n,r,i)},treemapSquarify:Sp,tsv:ol,tsvFormat:qs,tsvFormatBody:Ws,tsvFormatRow:Xs,tsvFormatRows:$s,tsvFormatValue:Ks,tsvParse:Ys,tsvParseRows:Hs,union:function(...t){const e=new A;for(const n of t)for(const t of n)e.add(t);return e},unixDay:a_,unixDays:s_,utcDay:i_,utcDays:o_,get utcFormat(){return iy},utcFriday:M_,utcFridays:V_,utcHour:t_,utcHours:e_,utcMillisecond:Dg,utcMilliseconds:Bg,utcMinute:Kg,utcMinutes:Zg,utcMonday:T_,utcMondays:N_,utcMonth:F_,utcMonths:G_,get utcParse(){return oy},utcSaturday:R_,utcSaturdays:D_,utcSecond:qg,utcSeconds:Wg,utcSunday:A_,utcSundays:O_,utcThursday:k_,utcThursdays:P_,utcTickInterval:$_,utcTicks:W_,utcTuesday:S_,utcTuesdays:I_,utcWednesday:C_,utcWednesdays:L_,utcWeek:A_,utcWeeks:O_,utcYear:Y_,utcYears:H_,variance:b,window:fe,xml:ll,zip:function(){return mt(arguments)},zoom:function(){var t,e,n,r=Sw,i=Cw,o=Ow,a=Mw,s=Rw,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,h=ei,f=Nt("start","zoom","end"),d=0,p=10;function g(t){t.property("__zoom",kw).on("wheel.zoom",w,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",A).filter(s).on("touchstart.zoom",T).on("touchmove.zoom",S).on("touchend.zoom touchcancel.zoom",C).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function _(t,e){return(e=Math.max(l[0],Math.min(l[1],e)))===t.k?t:new xw(e,t.x,t.y)}function y(t,e,n){var r=e[0]-n[0]*t.k,i=e[1]-n[1]*t.k;return r===t.x&&i===t.y?t:new xw(t.k,r,i)}function m(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function b(t,e,n,r){t.on("start.zoom",function(){v(this,arguments).event(r).start()}).on("interrupt.zoom end.zoom",function(){v(this,arguments).event(r).end()}).tween("zoom",function(){var t=this,o=arguments,a=v(t,o).event(r),s=i.apply(t,o),l=null==n?m(s):"function"==typeof n?n.apply(t,o):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),u=t.__zoom,f="function"==typeof e?e.apply(t,o):e,d=h(u.invert(l).concat(c/u.k),f.invert(l).concat(c/f.k));return function(t){if(1===t)t=f;else{var e=d(t),n=c/e[2];t=new xw(n,l[0]-e[0]*n,l[1]-e[1]*n)}a.zoom(null,t)}})}function v(t,e,n){return!n&&t.__zooming||new x(t,e)}function x(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,e),this.taps=0}function w(t,...e){if(r.apply(this,arguments)){var n=v(this,e).event(t),i=this.__zoom,s=Math.max(l[0],Math.min(l[1],i.k*Math.pow(2,a.apply(this,arguments)))),u=Qe(t);if(n.wheel)n.mouse[0][0]===u[0]&&n.mouse[0][1]===u[1]||(n.mouse[1]=i.invert(n.mouse[0]=u)),clearTimeout(n.wheel);else{if(i.k===s)return;n.mouse=[u,i.invert(u)],Di(this),n.start()}Tw(t),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",o(y(_(i,s),n.mouse[0],n.mouse[1]),n.extent,c))}}function E(t,...e){if(!n&&r.apply(this,arguments)){var i=t.currentTarget,a=v(this,e,!0).event(t),s=$e(t.view).on("mousemove.zoom",function(t){if(Tw(t),!a.moved){var e=t.clientX-u,n=t.clientY-h;a.moved=e*e+n*n>d}a.event(t).zoom("mouse",o(y(a.that.__zoom,a.mouse[0]=Qe(t,i),a.mouse[1]),a.extent,c))},!0).on("mouseup.zoom",function(t){s.on("mousemove.zoom mouseup.zoom",null),an(t.view,a.moved),Tw(t),a.event(t).end()},!0),l=Qe(t,i),u=t.clientX,h=t.clientY;on(t.view),Aw(t),a.mouse=[l,this.__zoom.invert(l)],Di(this),a.start()}}function A(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,a=Qe(t.changedTouches?t.changedTouches[0]:t,this),s=n.invert(a),l=n.k*(t.shiftKey?.5:2),h=o(y(_(n,l),a,s),i.apply(this,e),c);Tw(t),u>0?$e(this).transition().duration(u).call(b,h,a,t):$e(this).call(g.transform,h,a,t)}}function T(n,...i){if(r.apply(this,arguments)){var o,a,s,l,c=n.touches,u=c.length,h=v(this,i,n.changedTouches.length===u).event(n);for(Aw(n),a=0;a<u;++a)l=[l=Qe(s=c[a],this),this.__zoom.invert(l),s.identifier],h.touch0?h.touch1||h.touch0[2]===l[2]||(h.touch1=l,h.taps=0):(h.touch0=l,o=!0,h.taps=1+!!t);t&&(t=clearTimeout(t)),o&&(h.taps<2&&(e=l[0],t=setTimeout(function(){t=null},500)),Di(this),h.start())}}function S(t,...e){if(this.__zooming){var n,r,i,a,s=v(this,e).event(t),l=t.changedTouches,u=l.length;for(Tw(t),n=0;n<u;++n)i=Qe(r=l[n],this),s.touch0&&s.touch0[2]===r.identifier?s.touch0[0]=i:s.touch1&&s.touch1[2]===r.identifier&&(s.touch1[0]=i);if(r=s.that.__zoom,s.touch1){var h=s.touch0[0],f=s.touch0[1],d=s.touch1[0],p=s.touch1[1],g=(g=d[0]-h[0])*g+(g=d[1]-h[1])*g,m=(m=p[0]-f[0])*m+(m=p[1]-f[1])*m;r=_(r,Math.sqrt(g/m)),i=[(h[0]+d[0])/2,(h[1]+d[1])/2],a=[(f[0]+p[0])/2,(f[1]+p[1])/2]}else{if(!s.touch0)return;i=s.touch0[0],a=s.touch0[1]}s.zoom("touch",o(y(r,i,a),s.extent,c))}}function C(t,...r){if(this.__zooming){var i,o,a=v(this,r).event(t),s=t.changedTouches,l=s.length;for(Aw(t),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),i=0;i<l;++i)o=s[i],a.touch0&&a.touch0[2]===o.identifier?delete a.touch0:a.touch1&&a.touch1[2]===o.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(o=Qe(o,this),Math.hypot(e[0]-o[0],e[1]-o[1])<p)){var c=$e(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return g.transform=function(t,e,n,r){var i=t.selection?t.selection():t;i.property("__zoom",kw),t!==i?b(t,e,n,r):i.interrupt().each(function(){v(this,arguments).event(r).start().zoom(null,"function"==typeof e?e.apply(this,arguments):e).end()})},g.scaleBy=function(t,e,n,r){g.scaleTo(t,function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)},n,r)},g.scaleTo=function(t,e,n,r){g.transform(t,function(){var t=i.apply(this,arguments),r=this.__zoom,a=null==n?m(t):"function"==typeof n?n.apply(this,arguments):n,s=r.invert(a),l="function"==typeof e?e.apply(this,arguments):e;return o(y(_(r,l),a,s),t,c)},n,r)},g.translateBy=function(t,e,n,r){g.transform(t,function(){return o(this.__zoom.translate("function"==typeof e?e.apply(this,arguments):e,"function"==typeof n?n.apply(this,arguments):n),i.apply(this,arguments),c)},null,r)},g.translateTo=function(t,e,n,r,a){g.transform(t,function(){var t=i.apply(this,arguments),a=this.__zoom,s=null==r?m(t):"function"==typeof r?r.apply(this,arguments):r;return o(ww.translate(s[0],s[1]).scale(a.k).translate("function"==typeof e?-e.apply(this,arguments):-e,"function"==typeof n?-n.apply(this,arguments):-n),t,c)},r,a)},x.prototype={event:function(t){return t&&(this.sourceEvent=t),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(t,e){return this.mouse&&"mouse"!==t&&(this.mouse[1]=e.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=e.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=e.invert(this.touch1[0])),this.that.__zoom=e,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){var e=$e(this.that).datum();f.call(t,this.that,new vw(t,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:f}),e)}},g.wheelDelta=function(t){return arguments.length?(a="function"==typeof t?t:bw(+t),g):a},g.filter=function(t){return arguments.length?(r="function"==typeof t?t:bw(!!t),g):r},g.touchable=function(t){return arguments.length?(s="function"==typeof t?t:bw(!!t),g):s},g.extent=function(t){return arguments.length?(i="function"==typeof t?t:bw([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),g):i},g.scaleExtent=function(t){return arguments.length?(l[0]=+t[0],l[1]=+t[1],g):[l[0],l[1]]},g.translateExtent=function(t){return arguments.length?(c[0][0]=+t[0][0],c[1][0]=+t[1][0],c[0][1]=+t[0][1],c[1][1]=+t[1][1],g):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},g.constrain=function(t){return arguments.length?(o=t,g):o},g.duration=function(t){return arguments.length?(u=+t,g):u},g.interpolate=function(t){return arguments.length?(h=t,g):h},g.on=function(){var t=f.on.apply(f,arguments);return t===f?g:t},g.clickDistance=function(t){return arguments.length?(d=(t=+t)*t,g):Math.sqrt(d)},g.tapDistance=function(t){return arguments.length?(p=+t,g):p},g},zoomIdentity:ww,zoomTransform:Ew});class Iw{constructor(t,e,n){this._id="predicate_"+uT(),this._type=t||Lw.POINT,this._variableType=e,this._variableName=n,this._value=void 0}get type(){return this._type}get value(){return this._value}set value(t){this._value=t}get id(){return this._id}get variableType(){return this._variableType}get variableName(){return this._variableName}}const Lw=Object.freeze({POINT:"point",INTERVAL:"interval",LIST:"list"});class Pw extends Iw{constructor(t,e,n){super(t,e,n)}testElement(t){let e;if("attribute"==this._variableType){if(!t.dataScope)return!1;e=t.dataScope.getAttrVal(this._variableName)}else e=t[this._variableName];return this._value[0]<=e&&this._value[1]>=e}testTuple(t){if("attribute"==this._variableType){let e=t[this._variableName];return this._value[0]<=e&&this._value[1]>=e}return!1}}class Vw extends Iw{constructor(t,e,n){super(t,e,n)}addValue(t){this._value||(this._value=[]),this._value.push(t)}resetValue(){this._value=void 0}testElement(t){if("attribute"==this._variableType){if(!t.dataScope)return!1;let e=t.dataScope.getAttributeValues(this._variableName);return 1===e.length&&this._value.indexOf(e[0])>=0}return this._value.indexOf(t[this._variableName])>=0}testTuple(t){if("attribute"==this._variableType){let e=t[this._variableName];return this._value.indexOf(e)>=0}return!1}}class Dw extends Iw{constructor(t,e,n){super(t,e,n)}testElement(t){if("attribute"==this._variableType){if(!t.dataScope)return!1;return t.dataScope.getAttrVal(this._variableName)==this._value}return t[this._variableName]==this._value}testTuple(t){if("attribute"==this._variableType){let e=t[this._variableName];return this._value===e}return!1}equals(t){return this.type===t.type&&this.variableName===t.variableName&&this.value===t.value}}function Bw(t){let e,n="attribute"in t?"attribute":"property",r=t[n];switch(t.type){case Lw.LIST:e=new Vw(t.type,n,r);break;case Lw.INTERVAL:e=new Pw(t.type,n,r);break;case Lw.POINT:default:e=new Dw(t.type,n,r)}return e.value=t.value,e}function zw(t,e){for(let n of e)if(!n.testElement(t))return!1;return!0}const Fw={svg:void 0,getSVG:function(){return window?(void 0===this.svg&&(this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.style.visibility="hidden",this.svg.style.pointerEvents="none",this.svg.setAttribute("aria-hidden","true"),document.body.appendChild(this.svg)),this.svg):null}};function Gw(t,e,n,r,i){const o=i*Math.PI/180,a=t-n,s=e-r;return{x:a*Math.cos(o)-s*Math.sin(o)+n,y:a*Math.sin(o)+s*Math.cos(o)+r}}function jw(t,e,n,r){return Math.sqrt(Math.pow(t-n,2)+Math.pow(e-r,2))}const Uw=Object.freeze({fillColor:"fill",strokeColor:"stroke",strokeWidth:"stroke-width",fillOpacity:"fill-opacity",strokeOpacity:"stroke-opacity",strokeDash:"stroke-dasharray",opacity:"opacity",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",visibility:"visibility",cursor:"cursor"});class Yw{constructor(t,e,n,r){this._x=t+n/2,this._y=e+r/2,this._width=n,this._height=r}translate(t,e){this._x+=t,this._y+=e}toJSON(){let t={};return t.x=this._x,t.y=this._y,t.width=this._width,t.height=this._height,t}union(t){let e=Math.min(this.left,t.left),n=Math.min(this.top,t.top),r=Math.max(this.right,t.right),i=Math.max(this.bottom,t.bottom);return new Yw(e,n,r-e,i-n)}clone(){return new Yw(this.left,this.top,this._width,this._height)}get left(){return this._x-this._width/2}set left(t){this._x=t+this._width/2}get right(){return this._x+this._width/2}set right(t){this._x=t-this._width/2}get top(){return this._y-this._height/2}set top(t){this._y=t+this._height/2}get bottom(){return this._y+this._height/2}set bottom(t){this._y=t-this._height/2}get x(){return this._x}get y(){return this._y}get center(){return this.x}get middle(){return this.y}get width(){return this._width}setWidth(t,e){switch(e){case Xw.RIGHT:this._x=this.right-t/2;break;case Xw.CENTER:this._width=2*t;break;default:this._x=this.left+t/2}this._width=t}get height(){return this._height}setHeight(t,e){switch(e){case Xw.TOP:this._y=this.top+t/2;break;case Xw.MIDDLE:this._height=2*t;break;default:this._y=this.bottom-t/2}this._height=t}contains(t,e){return this.left<=t&&this.right>=t&&this.top<=e&&this.bottom>=e}intersects(t){return!(this.right<t.left||this.bottom<t.top||this.left>t.right||this.top>t.bottom)}}function Hw(t){let e=t[0].clone();for(let n=1;n<t.length;n++)e=e.union(t[n]);return e}function qw(t){return Hw(("vertex"==t[0].type||"segment"==t[0].type?t.map(t=>t.parent):t).map(t=>t.refBounds?t.refBounds:t.bounds))}function Ww(t){return Hw(("vertex"==t[0].type||"segment"==t[0].type?t.map(t=>t.parent):t).map(t=>t.bounds))}function $w(t){let e=Qw(t);for(let t of e)t._updateBounds();let n=[];for(let t of e)t.parent&&!n.includes(t.parent)&&n.push(t.parent);for(let t of n)$w(t)}const Xw=Object.freeze({TOP:"top",LEFT:"left",RIGHT:"right",BOTTOM:"bottom",CENTER:"center",MIDDLE:"middle"});class Kw{constructor(t){if(this._dataScope=void 0,this._type="type"in t?t.type:lT.Mark,this._id=t.id?t.id:this._type+"_"+uT(),this._classId=void 0,this._bounds=void 0,this._rotate=void 0,this._refBounds=void 0,this._dirty=!0,this._clipMask=void 0,this._cursor=void 0,this._styles={},void 0!==t)for(let e in Uw)e in t&&(this.styles[e]=t[e])}get scene(){return aE(this)}set strokeColor(t){this.styles.strokeColor=t,this._dirty=!0}get strokeColor(){return this.styles.strokeColor}set strokeWidth(t){this.styles.strokeWidth=t,this._dirty=!0}get strokeWidth(){return this.styles.strokeWidth}set strokeDash(t){this.styles.strokeDash=t,this._dirty=!0}get strokeDash(){return this.styles.strokeDash}set fillColor(t){this.styles.fillColor=t,this._dirty=!0}get fillColor(){return this.styles.fillColor}get rotation(){return this._rotate}get cursor(){return this._cursor}get id(){return this._id}set id(t){this.getScene()?(delete this.getScene()._itemMap[this._id],this._id=t,this.getScene()._itemMap[t]=this):this._id=t}get classId(){return this._classId?this._classId:this._id}set classId(t){this._classId=t}get type(){return this._type}get bounds(){return this._bounds||this._updateBounds(),this._bounds}get refBounds(){return this._refBounds?this._refBounds:this.bounds}set dataScope(t){this._dataScope=t}get dataScope(){return this._dataScope}get styles(){return this._styles}set styles(t){this._styles=t,this._dirty=!0}set visibility(t){this.styles.visibility=t,this._dirty=!0}get visibility(){return this.styles.visibility?this.styles.visibility:"visible"}get opacity(){return"opacity"in this.styles?this.styles.opacity:1}set opacity(t){this.styles.opacity=t,this._dirty=!0}copyPropertiesTo(t){t.styles=Object.assign({},this.styles),this._dataScope&&(t._dataScope=this._dataScope.clone())}createClipMask(){let t=this._bounds;this._clipMask=new Yw(t.left,t.top,t.width,t.height)}get clipMask(){return this._clipMask}}function Zw(t){return t instanceof Kw&&t.type!==lT.Gridlines}const Jw=Object.freeze({Area:"area",Rect:"rect",Ellipse:"ellipse",Circle:"circle",Pie:"pie",Ring:"ring",Arc:"arc",Line:"line",Path:"path",Image:"image",SimpleText:"text",RichText:"richText",Polygon:"polygon",BezierCurve:"bezierCurve"});function Qw(t,e){let n=aE(t);if("vertex"===t.type||"segment"===t.type)return function(t,e){let n=aE(t),r=e||n;if("vertex"===t.type){return tE(t,nE(r,[{property:"classId",value:t.parent.classId}]))}if("segment"===t.type){return eE(t,nE(r,[{property:"classId",value:t.parent.classId}]))}return t.classId?nE(r,[{property:"classId",value:t.classId}]):[t]}(t,e);if(!t.classId)return[t];if(t.classId&&n._peerIndex.has(t.classId)){let r=n._peerIndex.get(t.classId);return e?r.filter(t=>function(t,e){let n=t.parent;for(;n;){if(n===e)return!0;n=n.parent}return!1}(t,e)):r}return[t]}function tE(t,e){if(!t.classId){if(t.dataScope){let n=t.parent;if(!n)throw new Error("vertex has no parent mark");let r=[];if(n.type===lT.Area){let i=n.vertices.indexOf(t)<n.vertices.length/2;for(let t of e){let e=i?t.vertices.slice(0,t.vertices.length/2):t.vertices.slice(t.vertices.length/2);r=r.concat(e.filter(t=>t.dataScope))}}else for(let t of e)r=r.concat(t.vertices.filter(t=>t.dataScope));return r}{let n=t.parent;if(!n)throw new Error("vertex has no parent mark");let r=n.vertices.indexOf(t),i=[];for(let t of e)i.push(t.vertices[r]);return i}}}function eE(t,e){if(t.dataScope){if(!t.parent)throw new Error("segment has no parent mark");let n=[];for(let t of e)n=n.concat(t.segments);return n}{let n=t.parent;if(!n)throw new Error("segment has no parent mark");let r=n.segments.indexOf(t),i=[];for(let t of e)i.push(t.segments[r]);return i}}function nE(t,e){let n=[];return oE(t,e?e.map(t=>Bw(t)):[],n),n}function rE(t,e){let n=t.children.filter(t=>t.type==lT.Collection);if(0!==n.length)for(let t of n){let n=t;for(;n&&n.dataScope;){if(n.dataScope.hasAttribute(e))return n;n=n.children?n.children[0]:void 0}}}function iE(t){return t.type==lT.Collection?t:t.parent?iE(t.parent):void 0}function oE(t,e,n){if(t)if(zw(t,e)&&n.push(t),t.vertices)for(let r of t.vertices.concat(t.segments))zw(r,e)&&n.push(r);else if(t.children&&t.children.length>0)for(let r of t.children)oE(r,e,n)}function aE(t){let e=t;for(;e;){if(e.type==lT.Scene)return e;e=e.parent}}function sE(t){let e=t;for("vertex"!=e.type&&"segment"!=e.type||(e=e.parent);e.parent&&[lT.Collection,lT.Glyph].includes(e.parent.type);)e=e.parent;return e}function lE(t,e){let n=[];if(cE(t,n),e){let t={};for(let e of n)t[e.classId]=e;return Object.values(t)}return n}function cE(t,e){if(Zw(t))e.push(t);else if(t.children&&!Object.values(cT).includes(t.type))for(let n of t.children)cE(n,e)}function uE(t,e){if(t){if(e(t),t.vertices)for(let n of t.vertices)e(n);if(t.segments)for(let n of t.segments)e(n);if(t.children&&t.children.length>0)for(let n of t.children)uE(n,e)}}class hE{constructor(){this._refElements=[]}addRefElement(t){this._refElements.push(t)}get refElements(){return this._refElements}clearRefElements(){this._refElements=[]}}const fE=Object.freeze({GRID:"grid",STACK:"stack",PACKING:"packing",FORCE:"force",DIRECTED:"directedgraph",TIDYTREE:"tidytree",TREEMAP:"treemap",STRATA:"strata",CIRCULAR:"circular",CLUSTER:"cluster"});function dE(t,e){return!!(t.startsWith("h")&&[Xw.LEFT,Xw.CENTER,Xw.RIGHT].indexOf(e)>=0)||(!!(t.startsWith("v")&&[Xw.TOP,Xw.MIDDLE,Xw.BOTTOM].indexOf(e)>=0)||(console.warn("Invalid alignment:",e),!1))}class pE{constructor(t){this._id=t+"_"+uT(),this._type=t,this._inputVars=[],this._outputVars=[]}run(){}get id(){return this._id}get type(){return this._type}get inputVars(){return this._inputVars}get outputVars(){return this._outputVars}get outputVar(){return this._outputVars[0]}isIsolated(){return 0==this._inputVars.length&&0==this._outputVars.length}}const gE=Object.freeze({CONDUIT:"conduit",ENCODER:"encoder",LAYOUT:"layout",LINK_PLACER:"linkRouter",CONSTRAINT:"constraint",EVAL_BBOX:"evalBBox",EVAL_REFBOUNDS:"evalRefBounds",AFFIXER:"affixer",ALIGNER:"aligner",DATA_EXTRACTOR:"dataExtractor",SCALE_BUILDER:"scaleBuilder",AXIS_PATH_PLACER:"axisPathPlacer",AXIS_TICKS_PLACER:"axisTicksPlacer",AXIS_LABELS_PLACER:"axisLabelsPlacer",AXIS_TITLE_PLACER:"axisTitlePlacer",GRIDLINES_PLACER:"gridlinesPlacer",GRID_LAYOUT:"gridLayout",STACK_LAYOUT:"stackLayout",PACK_LAYOUT:"packLayout",FORCE_LAYOUT:"forceLayout",DIRECTED_LAYOUT:"directedLayout",TIDY_TREE_LAYOUT:"tidyTreeLayout",TREEMAP_LAYOUT:"treemapLayout",STRATA_LAYOUT:"strataLayout",CIRCULAR_LAYOUT:"circularLayout",CLUSTER_LAYOUT:"clusterLayout",BIN_TRANSFORMER:"binTransformer",FILTER_TRANSFORMER:"filterTransformer",KDE_TRANSFORMER:"kdeTransformer",TARGET_EVALUATOR:"targetEvaluator",TARGET_UPDATER:"targetUpdater"});class _E{constructor(t){let e=t||{};this._stops=[],this.type=lT.LinearGradient,this.id=this.type+uT(),this.x1="x1"in e?e.x1:0,this.x2="x2"in e?e.x2:100,this.y1="y1"in e?e.y1:0,this.y2="y2"in e?e.y2:0}toJSON(){let t={};return t.type=this.type,t.id=this.id,t.x1=this.x1,t.x2=this.x2,t.y1=this.y1,t.y2=this.y2,t.stops=this._stops,t}addStop(t,e,n){this._stops.push({offset:t,color:e,opacity:n})}get stops(){return this._stops}}const yE=Object.freeze({RowFirst:"rowFirst",ColumnFirst:"columnFirst"}),mE=Object.freeze({TopLeft:"topLeft",TopRight:"topRight",BottomLeft:"bottomLeft",BottomRight:"bottomRight"}),bE="horizontal",vE="vertical",xE="angular",wE="radial",EE={Left2Right:"l2r",Right2Left:"r2l",Top2Bottom:"t2b",Bottom2Top:"b2t"},AE=Object.freeze({CLOCKWISE:"clockwise",ANTI_CLOCKWISE:"anti-clockwise"}),TE=Object.freeze({INWARD:"inward",OUTWARD:"outward"});class SE{constructor(t,e,n,r){this.type="vertex",this._id=r,this._x=t,this._y=e,this._dataScope=void 0,this.parent=n,this.shape=void 0,this.width=0,this.height=0,this.radius=0,this.fillColor="#555",this.opacity=1,this.strokeWidth=0,this.strokeColor="#aaa",this._polarAngle=void 0}get dataScope(){return this._dataScope}set dataScope(t){this._dataScope=t}get bounds(){switch(this.shape){case"rect":return new Yw(this.x-this.width/2,this.y-this.height/2,this.width,this.height);case"circle":return new Yw(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius);default:return new Yw(this.x-.5,this.y-.5,1,1)}}get id(){return this.parent.id+"_v_"+this._id}_clone(t){let e=new SE(this.x,this.y,t,this._id);return this._dataScope&&(e._dataScope=this._dataScope.clone()),e.shape=this.shape,e.width=this.width,e.height=this.height,e.radius=this.radius,e.fillColor=this.fillColor,e.opacity=this.opacity,e.strokeWidth=this.strokeWidth,e.strokeColor=this.strokeColor,e}get polarAngle(){return this._polarAngle}get scene(){return this.parent.scene}get x(){return this._x}get y(){return this._y}}SE.styles=["vxShape","vxWidth","vxHeight","vxRadius","vxFillColor","vxStrokeColor","vxStrokeWidth","vxOpacity"];class CE{constructor(t,e,n,r){this.type="segment",this._id=r,this.vertex1=t,this.vertex2=e,this.dataScope=void 0,this.parent=n}get id(){return this.parent.id+"_s_"+this._id}get x(){return(this.vertex1.x+this.vertex2.x)/2}get y(){return(this.vertex1.y+this.vertex2.y)/2}get scene(){return this.parent.scene}}class kE extends Kw{constructor(t){super(t),this._type="type"in t?t.type:lT.Path,this.vertices=[],this.vertexCounter=0,this._sortBy={},this.segmentCounter=0,this.segments=[],this.anchor=void 0,this.closed=!1,this.curveMode="linear",this._vxShape=void 0,this._vxWidth=0,this._vxHeight=0,this._vxRadius=0,this._vxFillColor="#555555",this._vxStrokeColor="#aaaaaa",this._vxStrokeWidth=0,this._vxOpacity=1;for(let e of SE.styles)e in t&&(this["_"+e]=t[e]);"vertices"in t&&this._setVertices(t.vertices),this._sourceAnchor="sourceAnchor"in t?t.sourceAnchor:["center","middle"],this._targetAnchor="targetAnchor"in t?t.targetAnchor:["center","middle"],this._sourceOffset="sourceOffset"in t?t.sourceOffset:[0,0],this._targetOffset="targetOffset"in t?t.targetOffset:[0,0],this._strength="strength"in t?t.strength:.85,"strokeColor"in this.styles||(this.styles.strokeColor="#ccc"),"fillColor"in this.styles||(this.styles.fillColor="none"),"strokeWidth"in this.styles||(this.styles.strokeWidth=1),"strokeDash"in this.styles||(this.styles.strokeDash="none")}_setVertices(t){let e;this.vertices=[],this.segments=[],this.vertexCounter=0,this.segmentCounter=0;for(let n=0;n<t.length;n++)if(n!=t.length-1||t[n][0]!==t[0][0]||t[n][1]!==t[0][1]||this.type!==lT.Path){e=new SE(t[n][0],t[n][1],this,this.vertexCounter++);for(let t of SE.styles)if(this[t]){let n=t.replace("vx","");e[n[0].toLowerCase()+n.slice(1)]=this[t]}this.vertices.push(e),n>0&&this.segments.push(new CE(this.vertices[n-1],this.vertices[n],this,this.segmentCounter++))}let n=t[0],r=t[t.length-1];(n[0]===r[0]&&n[1]===r[1]||this.type===lT.Rect)&&(this.closed=!0,"fillColor"in this.styles||(this.styles.fillColor="#fff"),this.segments.push(new CE(this.vertices[this.vertices.length-1],this.vertices[0],this,this.segmentCounter++))),this._dirty=!0}copyPropertiesTo(t){t.attrs=Object.assign({},this.attrs),t.styles=Object.assign({},this.styles);for(let e of SE.styles)this["_"+e]&&(t["_"+e]=this["_"+e]);this._dataScope&&(t._dataScope=this._dataScope.clone()),t.closed=this.closed,t.curveMode=this.curveMode,t.vertices=[],t.segments=[];for(let e of this.vertices)t.vertices.push(e._clone(t));t.segmentCounter=0;for(let e=1;e<t.vertices.length;e++)t.segments.push(new CE(t.vertices[e-1],t.vertices[e],t,t.segmentCounter++));t.closed&&t.segments.push(new CE(t.vertices[t.vertices.length-1],t.vertices[0],t,t.segmentCounter++)),t._sourceAnchor=this._sourceAnchor.slice(),t._targetAnchor=this._targetAnchor.slice(),t._sourceOffset=this._sourceOffset.slice(),t._targetOffset=this._targetOffset.slice(),t._beta=this._beta}get bounds(){return this._bounds||this._updateBounds(),this._bounds}get x(){return this.bounds.x}get y(){return this.bounds.y}get strokeColor(){return this.styles.strokeColor}get strokeWidth(){return this.styles.strokeWidth}get strokeDash(){return this.styles.strokeDash}set strokeDash(t){this.styles.strokeDash=t,this._dirty=!0}resize(t,e,n,r){let i=this.bounds,o=0===i.width?1:i.width,a=0===i.height?1:i.height;if("right"===n)for(let e of this.vertices)e._x=i.right-t/o*(i.right-e.x);else for(let e of this.vertices)e._x=i.left+t/o*(e.x-i.left);if("top"===r)for(let t of this.vertices)t._y=i.top+e/a*(t.y-i.top);else for(let t of this.vertices)t._y=i.bottom-e/a*(i.bottom-t.y);this._updateBounds(),this._dirty=!0}_updateBounds(){let t=[],e=[];if(this._d){const n=this._d.match(/[a-zA-Z][^a-zA-Z]*/g),r=" ";n.forEach(n=>{let i=n.slice(1).trim().split(r).map(Number);for(let[n,r]of i.entries())n%2==0?t.push(r):e.push(r)})}else t=this.vertices.map(t=>t.x),e=this.vertices.map(t=>t.y);let n=Math.min(...t),r=Math.min(...e),i=Math.max(...t),o=Math.max(...e),a=i-n,s=o-r;if(this._bounds=new Yw(n,r,a,s),this.type===lT.Line||this.type===lT.Path){let t=this.styles.strokeWidth?this.styles.strokeWidth:1;n===i?this._bounds=new Yw(n-t/2,r,i-n+t,o-r):r===o&&(this._bounds=new Yw(n,r-t/2,i-n,o-r+t))}}addVertex(t,e,n){let r=new SE(t,e,this,this.vertexCounter++);this.vertices.splice(n,0,r)}sortVertices(t,e){this.vertices.sort((e,n)=>e[t]-n[t]),e&&this.vertices.reverse();for(let t=0;t<this.segments.length;t++){let e=this.segments[t];e.vertex1=this.vertices[t],e.vertex2=this.vertices[(t+1)%this.vertices.length]}this._dirty=!0}sortVerticesByData(t,e,n){let r;r=n?(e,r)=>n.indexOf(e.dataScope.getValue(t))-n.indexOf(r.dataScope.getAttrVal(t)):(e,n)=>e.dataScope.getAttrVal(t)<n.dataScope.getAttrVal(t)?-1:1,this.vertices.sort(r),e&&this.vertices.reverse();for(let t=0;t<this.segments.length;t++){let e=this.segments[t];e.vertex1=this.vertices[t],e.vertex2=this.vertices[(t+1)%this.vertices.length]}this._dirty=!0}getSVGPathData(){if(this._d)return this._d;let t=Sa(),e=this._getD3CurveFunction(this.curveMode)(t);e.lineStart();for(let t of this.vertices)e.point(t.x,t.y);return this.closed&&e.point(this.vertices[0].x,this.vertices[0].y),e.lineEnd(),t._}get firstVertex(){return this.vertices[0]}get firstSegment(){return this.segments[0]}get lastVertex(){return this.vertices[this.vertices.length-1]}get lastSegment(){return this.segments[this.segments.length-1]}_getD3CurveFunction(t){switch(t){case OE.Natural:return lw;case OE.Basis:return Ix;case OE.BumpX:return $v;case OE.BumpY:return Xv;case OE.Linear:return Nv;case OE.Step:return uw;case OE.CatmullRom:return Wx;case OE.Cardinal:return Fx;case OE.Bundle:return Dx.beta(.5);default:return Nv}}get vxShape(){return this._vxShape}get vxWidth(){return this._vxWidth}get vxHeight(){return this._vxHeight}get vxRadius(){return this._vxRadius}get vxFillColor(){return this._vxFillColor}get vxStrokeColor(){return this._vxStrokeColor}get vxStrokeWidth(){return this._vxStrokeWidth}get vxOpacity(){return this._vxOpacity}get sourceAnchor(){return this._sourceAnchor}get targetAnchor(){return this._targetAnchor}get sourceOffset(){return this._sourceOffset}get targetOffset(){return this._targetOffset}}function ME(t,e){const n=Fw.getSVG();let r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d",t.getSVGPathData()),n.appendChild(r);let i=r.getTotalLength();return r.getPointAtLength(i*e)}function RE(t){return t instanceof kE&&t.source&&t.target}const OE={Natural:"natural",Basis:"basis",BumpX:"bumpX",BumpY:"bumpY",Bundle:"bundle",Linear:"linear",Step:"step",CatmullRom:"CatmullRom",Cardinal:"cardinal"};function NE(t,e,n){const r=t.match(/[a-zA-Z][^a-zA-Z]*/g),i=",",o=r.map(t=>{const r=t[0],o=t.slice(1).trim();if("M"===r||"L"===r||"T"===r){const[t,a]=o.split(i).map(Number);return`${r}${t+e} ${a+n}`}if("C"===r){const t=o.split(i).map(Number);return`${r}${t[0]+e} ${t[1]+n} ${t[2]+e} ${t[3]+n} ${t[4]+e} ${t[5]+n}`}if("Q"===r){const t=o.split(i).map(Number);return`${r}${t[0]+e} ${t[1]+n} ${t[2]+e} ${t[3]+n}`}if("A"===r){const t=o.split(i).map(Number);return`${r}${t[0]} ${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]+e} ${t[6]+n}`}return"Z"===r||"z"===r?r:t});return o.join(" ")}class IE extends kE{constructor(t){super(t),this._type=lT.Arc,this.closed=!0,this._x="x"in t?t.x:100,this._y="y"in t?t.y:100,this._innerRadius="innerRadius"in t?t.innerRadius:100,this._outerRadius="outerRadius"in t?t.outerRadius:200,this._thickness="thickness"in t?t.thickness:this._outerRadius-this._innerRadius,this._startAngle="startAngle"in t?t.startAngle:0,this._endAngle="endAngle"in t?t.endAngle:90,this._sr=LE(this._startAngle),this._er=LE(this._endAngle),this._direction="direction"in t?t.direction:AE.ANTI_CLOCKWISE;let e=this._x+this._innerRadius*Math.cos(this._sr),n=this._y-this._innerRadius*Math.sin(this._sr),r=this._x+this._innerRadius*Math.cos(this._er),i=this._y-this._innerRadius*Math.sin(this._er),o=this._x+this._outerRadius*Math.cos(this._sr),a=this._y-this._outerRadius*Math.sin(this._sr),s=this._x+this._outerRadius*Math.cos(this._er),l=this._y-this._outerRadius*Math.sin(this._er);this._setVertices([[e,n],[o,a],[s,l],[r,i]])}get type(){return 0===this._innerRadius?lT.Pie:lT.Arc}get innerRadius(){return this._innerRadius}get outerRadius(){return this._outerRadius}get thickness(){return this._outerRadius-this._innerRadius}get direction(){return this._direction}get x(){return this._x}get y(){return this._y}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}get angle(){return this._endAngle<this._startAngle?this._endAngle+360-this._startAngle:this._endAngle-this._startAngle}setAngles(t,e){this._startAngle=t,this._endAngle=e,this._sr=LE(this._startAngle),this._er=LE(this._endAngle),this.vertices[0]._x=this._x+this._innerRadius*Math.cos(this._sr),this.vertices[0]._y=this._y-this._innerRadius*Math.sin(this._sr),this.vertices[1]._x=this._x+this._outerRadius*Math.cos(this._sr),this.vertices[1]._y=this._y-this._outerRadius*Math.sin(this._sr),this.vertices[2]._x=this._x+this._outerRadius*Math.cos(this._er),this.vertices[2]._y=this._y-this._outerRadius*Math.sin(this._er),this.vertices[3]._x=this._x+this._innerRadius*Math.cos(this._er),this.vertices[3]._y=this._y-this._innerRadius*Math.sin(this._er),this._dirty=!0}_updateBounds(){let t=this.vertices.map(t=>t.x),e=this.vertices.map(t=>t.y),n=Math.min(...t),r=Math.min(...e),i=Math.max(...t)-n,o=Math.max(...e)-r;this._bounds=new Yw(n,r,i,o)}copyPropertiesTo(t){super.copyPropertiesTo(t),t._x=this._x,t._y=this._y,t._innerRadius=this._innerRadius,t._outerRadius=this._outerRadius,t._startAngle=this._startAngle,t._endAngle=this._endAngle,t._thickness=this._thickness,t._direction=this._direction,t._sr=this._sr,t._er=this._er}getSVGPathData(){let t=this._endAngle<this._startAngle?this._endAngle+360-this._startAngle:this._endAngle-this._startAngle,e=t>180?1:0;return["M "+this.vertices[0].x+", "+this.vertices[0].y,"L "+this.vertices[1].x+", "+this.vertices[1].y,"A "+[this._outerRadius,this._outerRadius,t,e,0,this.vertices[2].x,this.vertices[2].y].join(" "),"L "+this.vertices[3].x+", "+this.vertices[3].y,"A "+[this._innerRadius,this._innerRadius,t,e,1,this.vertices[0].x,this.vertices[0].y].join(" ")].join(" ")}}function LE(t){return t*Math.PI/180}function PE(t){return 180*t/Math.PI}function VE(t){return(t%360+360)%360}function DE(t,e,n,r){let i=t-n,o=r-e;return Math.atan2(o,i)*(180/Math.PI)}class BE{constructor(t){this._attr2value={},this._dt=t,this._tuples=this._dt.data}isFullTable(){return 0===Object.keys(this._attr2value).length}isEmpty(){return 0==this._tuples.length}get numTuples(){return this._tuples.length}get attributes(){return Object.keys(this._attr2value)}get dataTable(){return this._dt}get filters(){return this._attr2value}merge(t){let e=new BE(this._dt);for(let t in this._attr2value)e=e.cross(t,this._attr2value[t]);for(let n in t._attr2value)e=e.cross(n,t._attr2value[n]);return e}cross(t,e){if(t in this._attr2value&&this._attr2value[t]!==e)return console.warn("Conflict in attribute values when merging dataScope:",t,this._attr2value[t],e),this;let n=this.clone();return n._attr2value[t]=e,n._updateTuples(t,e),n}derive(t){let e=Object.assign({},this._attr2value);for(let n in t)e[n]=t[n];let n=new BE(this._dt);for(let t in e)n._attr2value[t]=e[t],n._updateTuples(t,e[t]);return n}clone(){let t=new BE(this._dt);return t._attr2value=Object.assign({},this._attr2value),t._tuples=this._tuples.map(t=>t),t}getAttrVal(t){let e=this.getAttributeValues(t);return e.length,e[0]}getAttributeValues(t){let e=this._tuples.map(e=>e[t]);return e=[...new Set(e)],e}getUniqueAttributeValues(t){let e=this._tuples.map(e=>e[t]);return[...new Set(e)]}hasAttribute(t){return t in this._attr2value}getAttributeType(t){return this._dt.getAttributeType(t)}aggregateNumericalAttribute(t,e){let n=this._tuples.map(e=>e[t]);switch(e){case FE.Max:return Math.max(...n);case FE.Min:return Math.min(...n);case FE.Avg:case FE.Mean:return ct(n);case FE.Median:return ut(n);case FE.Count:return n.length;case FE.Percentile25:return at(n,.25);case FE.Percentile75:return at(n,.75);case FE.Sum:default:return yt(n)}}_updateTuples(t,e){this._tuples=this._tuples.filter(n=>n[t]==e)}get tuples(){return this._tuples}}function zE(t){return"vertex"==t.type||"segment"==t.type?t.dataScope?t.dataScope:t.parent.dataScope:t.dataScope}const FE={Max:"max",Min:"min",Avg:"avg",Median:"median",Sum:"sum",Count:"count",Mean:"mean",Percentile25:"percentile 25",Percentile75:"percentile 75"};class GE{constructor(t,e){this._id=lT.TreeData+uT(),this.initialize(t,e)}initialize(t,e){this.url=e,this._data=t,this._nodeList=[],this._linkList=[],this._nodeHash={},this._traverse(t,this._nodeList,this._linkList),this._nodeTable=new hT(this._nodeList,"nodes"),this._linkTable=new hT(this._linkList,"links"),this._nodeTable.tree=this,this._linkTable.tree=this}get nodeTable(){return this._nodeTable}get linkTable(){return this._linkTable}_traverse(t,e,n,r=0){let i={};qE in t||(t[qE]="n"+e.length),e.push(i),t._depth=r;for(let o in t)if("children"==o&&t[o]&&t[o].length>0)for(let i of t[o]){let o=this._traverse(i,e,n,r+1);n.push({parent:t[qE],child:o})}else i[o]=t[o];return this._nodeHash[i[qE]]=i,i[qE]}getNodeDataScope(t){return new BE(this._nodeTable).cross(dT,t[dT])}getNode(t){return this._nodeHash[t]}getRoot(){return this._nodeTable.data[0]}getChildren(t){let e=t[qE],n=[],r=this._linkTable.data,i=this._nodeTable.data;for(let t in r)if(r[t].parent==e){let e=r[t].child,o=i.findIndex(t=>t[qE]==e);n.push(i[o])}return n}getParent(t){let e=t[qE],n=this._linkTable.data,r=this._nodeTable.data;for(let t in n)if(n[t].child==e){let e=n[t].parent,i=r.findIndex(t=>t[qE]==e);return r[i]}}}function jE(t){return t.dataScope._dt.tree}class UE{constructor(t,e){this._id=lT.NetworkData+uT(),this.initialize(t,e)}initialize(t,e){this.url=e,this._nodeTable=new hT(t.nodes,this._id+"_nodes"),this._linkTable=new hT(t.links,this._id+"_links"),this._nodeTable.graph=this,this._linkTable.graph=this,this._rawNodes=t.nodes,this._rawLinks=t.links,this._nodeHash={};for(let e of t.nodes)this._nodeHash[e[qE]]=e}get nodeTable(){return this._nodeTable}get linkTable(){return this._linkTable}get nodeList(){return this._rawNodes}get linkList(){return this._rawLinks}getNode(t){return this._nodeHash[t]}getLinks(t){let e=t[qE],n=this._rawLinks,r=[];for(let t in n)n[t].target!==e&&n[t].source!==e||r.push(n[t]);return r}buildNodeHierarchy(t){let e={};return e[qE]="root",HE(e,this._rawNodes,t),new GE(e,this.url)}}function YE(t){return t.dataScope._dt.graph}function HE(t,e,n){if(0===e.length||0===n.length)return;"children"in t||(t.children=[]);let r={};for(let t of e){let e=t[n[0]];e in r||(r[e]=[]),r[e].push(t)}if(1===n.length)for(let e in r){let n={children:r[e]};n[qE]=e,t.children.push(n)}else for(let e in r){let i={};i[qE]=e,t.children.push(i),HE(i,r[e],n.slice(1))}}const qE="id";function WE(t,e){if(e.hasAttribute(t))return!0;if(e.tree&&e.tree.nodeTable.hasAttribute(t.split(".")[1]))return!0;throw new Error(["Attribute",t,"does not exist in the table",e.name].join(" "))}const $E=Object.freeze({Boolean:"boolean",Integer:"integer",Number:"number",Date:"date",String:"string"});function XE(t){var e=Object.values($E);for(let n=0;n<t.length;n++){let r=t[n];if(null!=r){for(let t=0;t<e.length;t++)KE[e[t]](r)||(e.splice(t,1),t-=1);if(1==e.length)return e[0]}}return e[0]}const KE={boolean:function(t){return"true"===t||"false"===t||!0===t||!1===t||"[object Boolean]"==toString.call(t)},integer:function(t){return KE.number(t)&&(t=+t)===~~t},number:function(t){return!isNaN(+t)&&"[object Date]"!=toString.call(t)},date:function(t){let e=new Date(t);return null!=e&&!isNaN(e)},string:function(t){return!0}};function ZE(t,e){let n={};switch(e){case $E.Boolean:n.trueCount=t.filter(t=>t).length,n.falseCount=t.filter(t=>!t).length;break;case $E.Date:n.min=et(t),n.max=Q(t),n.extent=[n.min,n.max],n.unique=[...new Set(t)];break;case $E.String:n.unique=[...new Set(t)];break;default:n.min=et(t),n.max=Q(t),n.extent=[n.min,n.max],n.mean=ct(t),n.median=ut(t),n.unique=[...new Set(t)]}return n}function JE(t,e,n,r,i){let o=i.getAttributeType(n);if(o!=$E.String&&o!=$E.Date&&o!=$E.Number&&o!=$E.Integer)throw new Error("Densify only works on a string or date attribute: "+n+" is "+o);if(!tA(e))throw new Error("The "+e.type+" is not dividable");switch(e.type){case lT.Line:return function(t,e,n){let r,i,o=Qw(t);for(let a of o){let o=a.dataScope?a.dataScope:new BE(n),s=n.getUniqueAttributeValues(e).map(t=>o.cross(e,t));s=s.filter(t=>!t.isEmpty()),1===s.length&&s.push(s[0].clone());let l=Object.assign({},a.styles);for(let t of SE.styles)a[t]&&(l[t]=a[t]);let c=a.vertices[0].x,u=a.vertices[0].y,h=[],f=a.vertices[1].x-c,d=a.vertices[1].y-u;for(let t=0;t<s.length;t++)h.push([c+t*f/(s.length-1),u+t*d/(s.length-1)]);l.vertices=h,l.type="path";let p=rT(l);i||(i=p.id),p._classId=i,p.dataScope=o,p._updateBounds(),p._refBounds=p.bounds.clone();let g=a.parent;g.addChild(p),g.removeChild(a);for(let[t,e]of p.vertices.entries())e.dataScope?e.dataScope=e.dataScope.merge(s[t]):e.dataScope=s[t];a==t&&(r=p)}return r}(e,n,i);case lT.Circle:return function(t,e,n){let r,i,o=Qw(t),a=n.getAttributeType(e);for(let s of o){let o=s.dataScope?s.dataScope:new BE(n),l=n.getUniqueAttributeValues(e).map(t=>o.cross(e,t));l=a==$E.Number?l:l.filter(t=>!t.isEmpty());let c=l.length;if(c<3)throw new Error("INSUFFICIENT_DATA_SCOPES");let u=90,h=360/c,f=[],d=[],p=-1;for(let t=0;t<l.length;t++){let e=u+p*t*h;d[t]=e;let n=QE(s.x,s.y,s.radius,d[t]);f.push(n)}let g=Object.assign({},s.styles);g.vertices=f,g.type="polygon",g.x=s.x,g.y=s.y,g.radius=s.radius;let _=rT(g);i||(i=_.id),_._classId=i,_.dataScope=o;let y=s.parent;y.addChild(_),y.removeChild(s);for(let[t,e]of _.vertices.entries())e._polarAngle=d[t],t>=l.length?e.dataScope=o.merge(l[2*l.length-1-t]):e.dataScope=o.merge(l[t]);s===t&&(r=_)}return r}(e,n,i);case lT.Rect:return function(t,e,n,r){let i,o,a=Qw(t),s=e||bE;if(s!=bE&&s!=vE)throw new Error("Unknown orientation: "+s);for(let e of a){let a=r.getAttributeType(n),l=e.dataScope?e.dataScope:new BE(r),c=r.getUniqueAttributeValues(n).map(t=>l.cross(n,t));c=a==$E.Number?c:c.filter(t=>!t.isEmpty()),1===c.length&&c.push(c[0].clone()),a!=$E.Number&&a!=$E.Date||c.sort((t,e)=>t._attr2value[n]>e._attr2value[n]?1:-1);let u=Object.assign({},e.styles),h=e.vertices[0].x,f=e.vertices[0].y,d=e.vertices[e.vertices.length-2].x,p=e.vertices[e.vertices.length-2].y,g=[],_=d-h,y=p-f;for(let t=0;t<c.length;t++)g.push(s==vE?[d,f+t*y/(c.length-1)]:[h+t*_/(c.length-1),f]);for(let t=0;t<c.length;t++)g.push(s==vE?[h,f+(c.length-1-t)*y/(c.length-1)]:[h+(c.length-1-t)*_/(c.length-1),p]);u.vertices=g,u.type="area";let m=rT(u);o||(o=m.id),m._classId=o,m.dataScope=l,m.orientation=s,m.baseline=s===bE?Xw.BOTTOM:Xw.LEFT;let b=e.parent;b.addChild(m),b.removeChild(e);for(let[t,e]of m.vertices.entries())t>=c.length?e.dataScope=l.merge(c[2*c.length-1-t]):e.dataScope=l.merge(c[t]);e===t&&(i=m)}return i}(e,r,n,i)}}function QE(t,e,n,r){return[n*Math.cos(LE(r))+t,e-n*Math.sin(LE(r))]}function tA(t){if([lT.Line,lT.Circle,lT.Rect,lT.Area].indexOf(t.type)<0)return!1;if(t.dataScope){let e=Qw(t,t.scene);for(let t of e)if(t.dataScope.numTuples>1)return!0;return!1}return!0}class eA{constructor(t){this._id="v_"+uT(),this._type=t,this._incomings=[],this._outgoings=[],this._undirected=[]}get id(){return this._id}get incomingEdges(){return this._incomings}get outgoingEdges(){return this._outgoings}get undirectedEdges(){return this._undirected}get type(){return this._type}get incomingDataflow(){for(let t of this._incomings)if(t.fromNode&&t.fromNode instanceof pE)return t.fromNode;return null}isIsolated(){return 0==this._incomings.length&&0==this._outgoings.length}}const nA=Object.freeze({CHANNEL:"channel",PROPERTY:"property",ATTRIBUTE:"attribute",ITEMS:"items",DATASCOPE:"datascope",ATTR_VALUE:"dataValue",BOUNDS:"bounds",SCALE:"scale",CONDITION_RESULT:"conditionResult",AFFIXATION:"affixation",ALIGNMENT:"alignment",EVT_CTX:"evtContext"});class rA extends eA{constructor(t,e,n){super(t),this._channel=e,this._elem=n}get channel(){return this._channel}get element(){return this._elem}}const iA=Object.freeze({X:"x",Y:"y",WIDTH:"width",HEIGHT:"height",RADIUS:"radius",FILLCOLOR:"fillColor",STROKECOLOR:"strokeColor",FILLGRADIENT:"fillGradient",TEXT:"text",ANGLE:"angle",THICKNESS:"thickness",AREA:"area",FONTSIZE:"fontSize",RADIALDISTANCE:"radialDistance",STROKEWIDTH:"strokeWidth",OPACITY:"opacity",VISIBILITY:"visibility",STRENGTH:"strength",SRC:"src"});function oA(t,e){delete e._encodings[cA(t.element)][t.channel]}function aA(t,e){let n=t.scene._encodings[cA(t)],r=[];n&&(r=r.concat(Object.values(n)));{let e=t.scene;for(let n in e._encodings){let i=n.split("_");i.pop(),i.join("_")===t.classId&&(r=r.concat(Object.values(e._encodings[n])))}}return r}function sA(t,e,n){for(let r in n._encodings){let i=n._encodings[r];if(i[e]&&i[e].attribute==t)return i[e]}return null}function lA(t,e){let n=t.scene._encodings[cA(t)];return n&&n[e]?n[e]:null}function cA(t){if(Array.isArray(t))return t.map(t=>cA(t)).join("_");if(t.classId)return t.classId;if("vertex"==t.type&&t.dataScope){if(t.parent.type===lT.Area){let e=t.parent.vertices.indexOf(t)<t.parent.vertices.length/2;return t.parent.classId+"_v"+(e?0:t.parent.vertices.length-1)}return t.parent.classId+"_v"}return"vertex"==t.type?t.parent.classId+"_v"+t.parent.vertices.indexOf(t):"segment"==t.type&&t.dataScope?t.parent.classId+"_s":"segment"==t.type?t.parent.classId+"_s"+t.parent.segments.indexOf(t):null}function uA(t,e){if(0==t.children.length)return[];let n=aE(t),r=t.type===lT.Composite?t.children:[t.children[0]],i=Object.keys(n._encodings),o=[];for(let t of r){let e=t;for(;e;){if(e.classId&&o.indexOf(e.classId)<0&&o.push(e.classId),e.type===lT.Glyph){e.children.forEach(t=>o.push(t.classId));break}if(!e.children)break;e=e.children[0]}}let a=[];for(let t of i)for(let r of o)0===t.indexOf(r)&&n._encodings[t][e]&&a.push(n._encodings[t][e]);return a}function hA(t){let e=lA(t,"y"),n=lA(t,"height");return e||n&&n.scales[0].domain[0]<0}function fA(t){let e=lA(t,"x"),n=lA(t,"width");return e||n&&n.scales[0].domain[0]<0}function dA(t,e){let n=function(t){let e=t.parent,n=[];for(;e.type!==lT.Scene;)n.push(e),e=e.parent;return n}(t);for(let t of n)if(lA(t,e))return!1;return n.length>=2?n[n.length-2]:t}function pA(t,e,n){switch(t.type){case lT.Rect:case lT.Path:case lT.Line:case lT.Area:!function(t,e,n){for(let r of t.vertices)gA(r,e,n);t._updateBounds(),t._refBounds&&t._refBounds.translate(e,n)}(t,e,n),0===e&&0===n||(t._dirty=!0);break;case lT.Group:case lT.Collection:case lT.Glyph:!function(t,e,n){for(let r of t.children)pA(r,e,n);t._layout&&(void 0!==t._layout._left&&(t._layout._left+=e),void 0!==t._layout._top&&(t._layout._top+=n),t._layout._cellBounds&&t._layout._cellBounds.forEach(t=>t.translate(e,n)));t._updateBounds(),t._refBounds&&t._refBounds.translate(e,n)}(t,e,n);break;case"segment":!function(t,e,n){gA(t.vertex1,e,n),gA(t.vertex2,e,n)}(t,e,n),0===e&&0===n||(t.parent._dirty=!0);break;case"vertex":gA(t,e,n),0===e&&0===n||(t.parent._dirty=!0);break;default:!function(t,e,n){t._x+=e,t._y+=n,t._updateBounds(),t._refBounds&&t._refBounds.translate(e,n)}(t,e,n),0===e&&0===n||(t._dirty=!0)}}function gA(t,e,n){t._x+=e,t._y+=n}function _A(t,e,n){switch(e){case"x":mA(t,n);break;case"y":bA(t,n);break;case"width":!function(t,e){t.resize(e,t.height)}(t,n);break;case"height":!function(t,e){t.resize(t.width,e)}(t,n);break;case"radius":t.radius=n;break;case"strength":t._strength=n;break;case"area":t.type===lT.Circle?t.radius=Math.sqrt(n/Math.PI):t.type===lT.Rect&&t.resize(Math.sqrt(n),Math.sqrt(n)),t._updateBounds();break;case"text":t._text=n;break;case"curveMode":t.curveMode=n;break;case"baseline":t.baseline=n;break;case"angle":[lT.Arc,lT.Pie].includes(t.type)&&function(t,e){t._endAngle=VE(t._startAngle+e),t._sr=LE(t._startAngle),t._er=LE(t._endAngle),t.vertices[0]._x=t._x+t._innerRadius*Math.cos(t._sr),t.vertices[0]._y=t._y-t._innerRadius*Math.sin(t._sr),t.vertices[1]._x=t._x+t._outerRadius*Math.cos(t._sr),t.vertices[1]._y=t._y-t._outerRadius*Math.sin(t._sr),t.vertices[2]._x=t._x+t._outerRadius*Math.cos(t._er),t.vertices[2]._y=t._y-t._outerRadius*Math.sin(t._er),t.vertices[3]._x=t._x+t._innerRadius*Math.cos(t._er),t.vertices[3]._y=t._y-t._innerRadius*Math.sin(t._er)}(t,n);break;case"startAngle":!function(t,e){let n=t.angle;t._startAngle=e,t._endAngle=VE(t._startAngle+n),t._sr=LE(t._startAngle),t._er=LE(t._endAngle),t.vertices[0]._x=t._x+t._innerRadius*Math.cos(t._sr),t.vertices[0]._y=t._y-t._innerRadius*Math.sin(t._sr),t.vertices[1]._x=t._x+t._outerRadius*Math.cos(t._sr),t.vertices[1]._y=t._y-t._outerRadius*Math.sin(t._sr),t.vertices[2]._x=t._x+t._outerRadius*Math.cos(t._er),t.vertices[2]._y=t._y-t._outerRadius*Math.sin(t._er),t.vertices[3]._x=t._x+t._innerRadius*Math.cos(t._er),t.vertices[3]._y=t._y-t._innerRadius*Math.sin(t._er)}(t,n);break;case"thickness":!function(t,e){yA(t,t._innerRadius+e)}(t,n);break;case"innerRadius":!function(t,e){t._innerRadius=e,t.vertices[0]._x=t._x+t._innerRadius*Math.cos(t._sr),t.vertices[0]._y=t._y-t._innerRadius*Math.sin(t._sr),t.vertices[3]._x=t._x+t._innerRadius*Math.cos(t._er),t.vertices[3]._y=t._y-t._innerRadius*Math.sin(t._er)}(t,n);break;case"outerRadius":yA(t,n);break;case"radialDistance":{let e=QE(t.parent.x,t.parent.y,n,t.polarAngle);mA(t,e[0]),bA(t,e[1]);break}case"visibility":t.visibility=n;break;case"src":t.src=n;break;default:if("vertex"===t.type)t[e]=n;else if(t instanceof qA)for(let r of t.children)_A(r,e,n);else t.styles[e]=n}"vertex"===t.type?t.parent._dirty=!0:t._dirty=!0}function yA(t,e){t._outerRadius=e,t.vertices[1]._x=t._x+t._outerRadius*Math.cos(t._sr),t.vertices[1]._y=t._y-t._outerRadius*Math.sin(t._sr),t.vertices[2]._x=t._x+t._outerRadius*Math.cos(t._er),t.vertices[2]._y=t._y-t._outerRadius*Math.sin(t._er)}function mA(t,e){"vertex"==t.type?t._x=e:pA(t,e-t.x,0)}function bA(t,e){"vertex"==t.type?t._y=e:pA(t,0,e-t.y)}class vA extends kE{constructor(t){super(t)}get width(){return this.vertices[1].x-this.vertices[0].x}get height(){return this.vertices[2].y-this.vertices[1].y}get left(){return this.vertices[0].x}get top(){return this.vertices[0].y}get right(){return this.vertices[1].x}get bottom(){return this.vertices[2].y}get area(){return this.width*this.height}resize(t,e,n,r){t!==this.width&&("right"===n?(this.vertices[1]._x=this.refBounds.right,this.vertices[2]._x=this.refBounds.right,this.vertices[0]._x=this.vertices[1]._x-t,this.vertices[3]._x=this.vertices[0]._x):(this.vertices[0]._x=this.refBounds.left,this.vertices[3]._x=this.refBounds.left,this.vertices[1]._x=this.vertices[0]._x+t,this.vertices[2]._x=this.vertices[1]._x)),e!==this.height&&("top"===r?(this.vertices[0]._y=this.refBounds.top,this.vertices[1]._y=this.refBounds.top,this.vertices[3]._y=this.vertices[0]._y+e,this.vertices[2]._y=this.vertices[3]._y):(this.vertices[2]._y=this.refBounds.bottom,this.vertices[3]._y=this.refBounds.bottom,this.vertices[0]._y=this.vertices[3]._y-e,this.vertices[1]._y=this.vertices[0]._y)),this._dirty=!0}get leftSegment(){return this.segments[3]}get rightSegment(){return this.segments[1]}get topSegment(){return this.segments[0]}get bottomSegment(){return this.segments[2]}}class xA extends kE{constructor(t){super(t),this._type=lT.Area,this.closed=!0,this._orientation="orientation"in t?t.orientation:void 0,this._baseline="baseline"in t?t.baseline:void 0,t&&"vertices"in t&&this.segments.push(new CE(this.vertices[this.vertices.length-1],this.vertices[0],this,this.segmentCounter++))}get topLeftVertex(){return this._orientation===bE?this.vertices[0]:this.vertices[this.vertices.length-1]}get bottomLeftVertex(){return this._orientation===bE?this.vertices[this.vertices.length-1]:this.vertices[this.vertices.length/2]}get topRightVertex(){return this._orientation===bE?this.vertices[this.vertices.length/2-1]:this.vertices[0]}get bottomRightVertex(){return this._orientation===bE?this.vertices[this.vertices.length/2]:this.vertices[this.vertices.length/2-1]}get baseline(){return this._baseline}set baseline(t){this._baseline=t,this._dirty=!0}get orientation(){return this._orientation}set orientation(t){this._orientation=t,this._dirty=!0}get firstVertexPair(){return[this.vertices[0],this.vertices[this.vertices.length-1]]}get width(){return this.vertices[this.vertices.length/2].x-this.vertices[0].x}get height(){return this.vertices[this.vertices.length/2].y-this.vertices[0].y}get left(){return this.vertices[0].x}get top(){return this.vertices[0].y}copyPropertiesTo(t){super.copyPropertiesTo(t),t._baseline=this._baseline,t._orientation=this._orientation}getSVGPathData(){return super.getSVGPathData()+" z"}}class wA extends eA{constructor(t,e){super(t),this._encs={},this._encs[e.channel+"_"+cA(e.element)]=e,this._initialized=!1}addLinkedEncoding(t){this._encs[t.channel+"_"+cA(t.element)]=t}getEncoding(t,e){let n=t+"_"+cA(e);return this._encs[n]}get encodings(){return Object.values(this._encs)}get initialized(){return this._initialized}set initialized(t){this._initialized=t}}class EA extends eA{constructor(t,e,n){super(t),this._result=e,this._condEnc=n}get result(){return this._result}get conditionalEncoding(){return this._condEnc}}class AA extends pE{constructor(t){super(t)}storeValues(t,e){this._storedValues={};let n=Qw(t);for(let t of n)this._storedValues[t.id]=t[e]}_restoreValues(t){let e=this.outputVar.channel;t.forEach(t=>{t.styles[e]!==this._storedValues[t.id]&&(t._dirty=!0,t.styles[e]=this._storedValues[t.id])})}run(){super.run();let t=this.inputVars.find(t=>t instanceof wA),e=this.outputVar,n=Qw(e.element),r=["x","y","width","height","radius"].includes(e.channel);if(t){let n=t.getEncoding(e.channel,e.element);for(let t of n.scales){let e=n.getElements(t);this._doMapping(e,t,n.attrValues,n),r&&this._updateRefBounds(e,t,n)}}else this._restoreValues(n);let i=this._getUsableCondEncodings();if(i.length>0&&this._doCondEncoding(n,i.map(t=>t.conditionalEncoding)),r){$w(["vertex","segment"].includes(e.element.type)?e.element.parent:e.element)}}_updateRefBounds(t,e,n){switch(this.outputVar.channel){case"width":t.forEach(t=>{t._refBounds.setWidth(e.rangeExtent)});break;case"height":t.forEach(t=>{t._refBounds.setHeight(e.rangeExtent)});break;case"radius":t.forEach(t=>{t._refBounds.setWidth(2*e.rangeExtent,Xw.CENTER),t._refBounds.setHeight(2*e.rangeExtent,Xw.MIDDLE)});break;case"x":"vertex"!=t[0].type&&"segment"!=t[0].type||t.forEach(t=>{let r=t.parent._refBounds;t.parent._refBounds=new Yw(n.flipScale?e.range[1]:e.range[0],r.top,e.rangeExtent,r.height)});break;case"y":"vertex"!=t[0].type&&"segment"!=t[0].type||t.forEach(t=>{let r=t.parent._refBounds;t.parent._refBounds=new Yw(r.left,n.flipScale?e.range[0]:e.range[1],r.width,e.rangeExtent)})}}_doMapping(t,e,n,r){switch(this.outputVar.channel){case"width":e.domain[0]<0&&t[0]instanceof vA?function(t,e,n){for(let r=0;r<t.length;r++){let i=t[r],o=i.refBounds.left+e.map(0),a=i.refBounds.left+e.map(n[i.id]);pA(i.leftSegment,o-i.leftSegment.x,0),pA(i.rightSegment,a-i.rightSegment.x,0)}}(t,e,n):e.domain[0]<0&&t[0]instanceof xA||(t[0].type===lT.Area?function(t,e,n){let r=t[0].baseline;if(t[0].orientation===vE)switch(r){case"left":for(let r of t)Qw(r.topLeftVertex,r).forEach(t=>_A(t,"x",r.refBounds.left)),Qw(r.topRightVertex,r).forEach(t=>_A(t,"x",r.refBounds.left+e.map(n[t.id])));break;case"right":for(let r of t)Qw(r.topLeftVertex,r).forEach(t=>_A(t,"x",r.refBounds.right-e.map(n[t.id]))),Qw(r.topRightVertex,r).forEach(t=>_A(t,"x",r.refBounds.right));break;case"center":console.log("center");for(let r of t)Qw(r.topLeftVertex,r).forEach(t=>_A(t,"x",r.refBounds.center-e.map(n[t.id])/2)),Qw(r.topRightVertex,r).forEach(t=>_A(t,"x",r.refBounds.center+e.map(n[t.id])/2))}}(t,e,n):this._doStandardMapping(t,e,n));break;case"height":e.domain[0]<0&&t[0]instanceof vA?function(t,e,n){for(let r=0;r<t.length;r++){let i=t[r],o=i.refBounds.bottom-e.map(0),a=i.refBounds.bottom-e.map(n[i.id]);pA(i.bottomSegment,0,o-i.bottomSegment.y),pA(i.topSegment,0,a-i.topSegment.y)}}(t,e,n):e.domain[0]<0&&t[0]instanceof xA?function(t,e,n){for(let r of t){let t=tE(r.topLeftVertex,[r]);for(let i of t)_A(i,"y",r.refBounds.bottom-e.map(n[i.id]));tE(r.bottomLeftVertex,[r]).forEach(t=>_A(t,"y",r.refBounds.bottom-e.map(0)))}}(t,e,n):t[0].type===lT.Area?function(t,e,n){let r=t[0].baseline;if(t[0].orientation===bE)switch(r){case"top":for(let r of t)Qw(r.bottomLeftVertex,r).forEach(t=>_A(t,"y",r.refBounds.top+e.map(n[t.id]))),Qw(r.topLeftVertex,r).forEach(t=>_A(t,"y",r.refBounds.top));break;case"middle":for(let r of t)Qw(r.topLeftVertex,r).forEach(t=>_A(t,"y",r.refBounds.middle-e.map(n[t.id])/2)),Qw(r.bottomLeftVertex,r).forEach(t=>_A(t,"y",r.refBounds.middle+e.map(n[t.id])/2));break;default:for(let r of t)Qw(r.topLeftVertex,r).forEach(t=>_A(t,"y",r.refBounds.bottom-e.map(n[t.id]))),Qw(r.bottomLeftVertex,r).forEach(t=>_A(t,"y",r.refBounds.bottom))}}(t,e,n):this._doStandardMapping(t,e,n);break;case"text":this._doTextMapping(t,n);break;case"fillGradient":!function(t,e,n,r){for(let i of t){let t=i.vertices.map(t=>n[t.id]),o=Math.min(...t),a=Math.max(...t),s="horizontal"===i.orientation?new _E({x1:0,y1:100,x2:0,y2:0}):new _E({x1:0,y1:0,x2:100,y2:0});if(s.addStop(0,e.map(o),1),r._mapping){let t=Object.keys(r._mapping).map(t=>parseFloat(t)).sort();for(let n of t)n>o&&n<a&&s.addStop(100*(n-o)/(a-o),e.map(n),1)}else"divergingColor"===e.type&&s.addStop(100*-o/(a-o),e.map(0),1);"sequentialColor"===e.type&&s.addStop(100*-o/(a-o),e.map(0),1),s.addStop(100,e.map(a),1),i.fillColor=s}}(t,e,n,r);break;default:this._doStandardMapping(t,e,n)}}_doTextMapping(t,e){let n=this.outputVar.channel;t.forEach(t=>{_A(t,n,e[t.id])})}_doStandardMapping(t,e,n){let r=this.outputVar.channel;t.forEach(t=>{let i=e.map(n[t.id]);_A(t,r,i),t instanceof kE&&t.firstVertex&&t.firstVertex.shape&&"strokeColor"===r&&t.vertices.forEach(t=>t.fillColor=i)})}_doCondEncoding(t,e){let n=t[0].scene;for(let r of t){let t=e.map(t=>t.evalResult.getValue(r.id)).every(t=>t||void 0===t),i=e[0].eventContext;e[0].stylingFunction(t,i,r,n)}}_updateElement(t,e,n,r){let i;"object"==typeof r&&t.triggerElement?"property"in r?i=t.triggerElement[r.property]:"attribute"in r&&(i=t.triggerElement.dataScope.getAttrVal(r.attribute)):i=r,["x","y"].includes(n)&&"offset"in r&&(i+=r.offset),_A(e,n,i)}_getUsableCondEncodings(){return this.inputVars.filter(t=>t instanceof EA)}}class TA extends eA{constructor(t,e,n){super(t),this._property=e,this._elem=n}get property(){return this._property}get element(){return this._elem}}function SA(t){return t in CA?CA[t]:t}const CA=Object.freeze({numCols:"layoutParameter",numRows:"layoutParameter",startCorner:"layoutParameter",direction:"layoutParameter"}),kA=Object.freeze({AXIS_ORIENTATION:"axisOrientation",AXIS_PATH_POSITION:"axisPathPosition",AXIS_TICK_SIZE:"axisTickSize",AXIS_TICK_OFFSET:"axisTickOffset",AXIS_TICKS_POSITION:"axisTicksPosition",AXIS_LABELS_POSITION:"axisLabelsPosition",AXIS_TITLE_POSITION:"axisTitlePosition",AXIS_LABEL_OFFSET:"axisLabelOffset",AXIS_LABEL_FORMAT:"axisLabelFormat",AXIS_FONT_SIZE:"axisFontSize",LEGEND_POSITION:"legendPosition",GRIDLINES_POSITION:"gridlinesPosition",INCLUDE_ZERO:"includeZero",FLIP_SCALE:"flipScale",RANGE_START:"rangeStart",RANGE_EXTENT:"rangeExtent",BASE_LINE:"baseline",LAYOUT_PARAMETER:"layoutParameter",CHILDREN_ORDER:"childrenOrder",TRANSFORM:"transform"});function MA(t,e){if(e.findVariable(nA.BOUNDS,[t]))return;let n=e.getVariable(nA.BOUNDS,t),r=e.createOneWayDependency(gE.EVAL_BBOX);switch(e.connect(r,n),t.type){case lT.Circle:case lT.Polygon:{let n=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"radius",t),a=e.getVariable(nA.CHANNEL,"area",t);e.connect(o,r),e.connect(n,r),e.connect(i,r),e.connect(a,r);break}case lT.Area:case lT.Line:case lT.BezierCurve:case lT.Path:case lT.Image:{let n=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"width",t),a=e.getVariable(nA.CHANNEL,"height",t);e.connect(n,r),e.connect(i,r),e.connect(o,r),e.connect(a,r);break}case lT.Rect:{let n=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"width",t),a=e.getVariable(nA.CHANNEL,"height",t),s=e.getVariable(nA.CHANNEL,"area",t);e.connect(n,r),e.connect(i,r),e.connect(o,r),e.connect(a,r),e.connect(s,r);break}case lT.SimpleText:case lT.RichText:{let n=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"text",t);e.connect(n,r),e.connect(i,r),e.connect(o,r);break}case lT.Ring:{let n=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"innerRadius",t),a=e.getVariable(nA.CHANNEL,"outerRadius",t);e.connect(n,r),e.connect(i,r),e.connect(o,r),e.connect(a,r);break}case lT.Pie:case lT.Arc:{let n=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"innerRadius",t),a=e.getVariable(nA.CHANNEL,"outerRadius",t),s=e.getVariable(nA.CHANNEL,"startAngle",t),l=e.getVariable(nA.CHANNEL,"endAngle",t),c=e.getVariable(nA.CHANNEL,"angle",t),u=e.getVariable(nA.CHANNEL,"thickness",t);e.connect(n,r),e.connect(i,r),e.connect(o,r),e.connect(a,r),e.connect(s,r),e.connect(l,r),e.connect(c,r),e.connect(u,r);break}}r.run()}function RA(t,e){let n=e.findVariablesByElement(t);for(let t in n){let r=n[t];for(let t of r)e.deleteVariable(t)}}function OA(t,e){let n=e.findVariable(nA.CHANNEL,[t.channel,t.element]);n||console.warn("cannot find encoding to remove from the dep graph");let r=n.incomingDataflow;e.deleteOperator(r)}function NA(t,e){if(t.type===lT.Axis){let n=e.findVariable(nA.PROPERTY,[kA.AXIS_PATH_POSITION,t]).incomingDataflow;e.deleteOperator(n),n=e.findVariable(nA.PROPERTY,[kA.AXIS_TICKS_POSITION,t]).incomingDataflow,e.deleteOperator(n),n=e.findVariable(nA.PROPERTY,[kA.AXIS_LABELS_POSITION,t]).incomingDataflow,e.deleteOperator(n)}else if(t.type===lT.Gridlines){let n=e.findVariable(nA.PROPERTY,[kA.GRIDLINES_POSITION,t]).incomingDataflow;e.deleteOperator(n)}}function IA(t,e){if(e.findVariable(nA.BOUNDS,[t]))return;let n=e.getVariable(nA.BOUNDS,t),r=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"width",t),a=e.getVariable(nA.CHANNEL,"height",t),s=e.createOneWayDependency(gE.EVAL_BBOX);e.connect(r,s),e.connect(i,s),e.connect(o,s),e.connect(a,s),e.connect(s,n),s.run()}function LA(t,e){let n=e.getVariable(nA.BOUNDS,t),r=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"width",t),a=e.getVariable(nA.CHANNEL,"height",t),s=e.createOneWayDependency(gE.EVAL_BBOX);e.connect(r,s),e.connect(i,s),e.connect(o,s),e.connect(a,s),e.connect(s,n),s.run()}function PA(t,e,n){let r=n.getVariable(nA.BOUNDS,t),i=n.getVariable(nA.BOUNDS,e),o=n.getIncomingDataflowOperator(gE.EVAL_BBOX,r),a=i.outgoingEdges.find(t=>t.fromNode===i&&t.toNode===o);if(a&&n.disconnect(i,o,a),t.layout){let r=n.getVariable(nA.CHANNEL,"x",e),i=n.getIncomingDataflowOperator(BA(t.layout.type),r);i&&n.deleteOperator(i)}}function VA(t,e,n){let r=n.getVariable(nA.BOUNDS,t),i=n.getVariable(nA.BOUNDS,e),o=n.getIncomingDataflowOperator(gE.EVAL_BBOX,r);n.connect(i,o),n.connect(o,r),t.layout&&FA(t,t.layout,n)}function DA(t,e){let n=e.getVariable(nA.BOUNDS,t),r=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getIncomingDataflowOperator(gE.EVAL_BBOX,n);e.connect(r,o),e.connect(i,o);for(let n of t.children)e.connect(e.getVariable(nA.BOUNDS,n),o);e.connect(o,n),o.run()}function BA(t){switch(t){case fE.GRID:return gE.GRID_LAYOUT;case fE.STACK:return gE.STACK_LAYOUT;case fE.PACKING:return gE.PACK_LAYOUT;case fE.FORCE:return gE.FORCE_LAYOUT;case fE.DIRECTED:return gE.DIRECTED_LAYOUT;case fE.TIDYTREE:return gE.TIDY_TREE_LAYOUT;case fE.TREEMAP:return gE.TREEMAP_LAYOUT;case fE.STRATA:return gE.STRATA_LAYOUT;case fE.CIRCULAR:return gE.CIRCULAR_LAYOUT;case fE.CLUSTER:return gE.CLUSTER_LAYOUT}}function zA(t,e,n){let r=n.getVariable(nA.PROPERTY,kA.CHILDREN_ORDER,t),i=n.getOutgoingDataflowOperator(BA(e.type),r);n.deleteOperator(i)}function FA(t,e,n){let r=e?e.type:"none",i=r===fE.TREEMAP?lE(t)[0]:t.children[0];if(!i)return;let o=n.getVariable(nA.CHANNEL,"width",i),a=n.getVariable(nA.CHANNEL,"height",i),s=n.getVariable(nA.PROPERTY,kA.CHILDREN_ORDER,t),l=n.getVariable(nA.CHANNEL,"x",i),c=n.getVariable(nA.CHANNEL,"y",i),u=n.getVariable(nA.CHANNEL,"visibility",i),h=n.getVariable(nA.PROPERTY,kA.LAYOUT_PARAMETER,e),f=n.getOutgoingDataflowOperator(BA(r),s);if(n.connect(o,f),n.connect(a,f),n.connect(s,f),n.connect(h,f),n.connect(u,f),n.connect(f,l),n.connect(f,c),n.disconnectChannelVarFromBBoxOperator(o),n.disconnectChannelVarFromBBoxOperator(a),i.type===lT.Arc||i.type===lT.Pie){let t=n.getVariable(nA.CHANNEL,"angle",i),e=n.getVariable(nA.CHANNEL,"thickness",i);n.connect(t,f),n.connect(e,f)}else if(i.type===lT.Circle){let t=n.getVariable(nA.CHANNEL,"area",i),e=n.getVariable(nA.CHANNEL,"radius",i);n.connect(t,f),n.connect(e,f),n.disconnectChannelVarFromBBoxOperator(t),n.disconnectChannelVarFromBBoxOperator(e)}else if(i.type===lT.Rect){let t=n.getVariable(nA.CHANNEL,"area",i);n.connect(t,f),n.disconnectChannelVarFromBBoxOperator(t)}if(f.run(),i.links&&GA(i,n),i.children&&i.children[0]){let t=n.getVariable(nA.BOUNDS,i.children[0]),e=n.getVariable(nA.CHANNEL,"x",i).incomingDataflow;e&&n.connect(t,e),n.disconnectChannelVarFromBBoxOperator(t)}}function GA(t,e){let n=t.links[0],r=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"x",n),o=e.getVariable(nA.CHANNEL,"strokeWidth",n),a=e.getVariable(nA.CHANNEL,"strength",n),s=e.createOneWayDependency(gE.LINK_PLACER);e.connect(r,s),e.connect(o,s),e.connect(a,s),e.connect(s,i)}function jA(t,e,n){let r=t.attribute,i=t.channel,o=t.element,a=e.createOneWayDependency(gE.ENCODER);if(["width","height"].includes(t.channel)&&o.type===lT.Area){let t=e.getVariable(nA.PROPERTY,kA.BASE_LINE,o);e.connect(t,a)}if(n){let r=e.getVariable(nA.ATTR_VALUE,n),s=e.getVariable(nA.SCALE,n),l=e.getVariable(nA.CHANNEL,i,o);e.connect(s,a),e.connect(a,l),r.addLinkedEncoding(t),s.addLinkedEncoding(t),r.incomingDataflow.run()}else{let n=e.getVariable(nA.ATTRIBUTE,r,fT(o)),s=e.getVariable(nA.PROPERTY,kA.INCLUDE_ZERO,t),l=e.getVariable(nA.ATTR_VALUE,t),c=e.getVariable(nA.DATASCOPE,o),u=e.getVariable(nA.PROPERTY,kA.TRANSFORM,t),h=e.createOneWayDependency(gE.DATA_EXTRACTOR);e.connect(n,h),e.connect(s,h),e.connect(c,h),e.connect(u,h),e.connect(h,l),h.run();let f=e.getVariable(nA.PROPERTY,kA.RANGE_START,t),d=e.getVariable(nA.PROPERTY,kA.RANGE_EXTENT,t),p=e.getVariable(nA.PROPERTY,kA.FLIP_SCALE,t),g=e.getVariable(nA.SCALE,t),_=e.createOneWayDependency(gE.SCALE_BUILDER);e.connect(f,_),e.connect(d,_),e.connect(p,_),e.connect(l,_),e.connect(_,g),_.run();let y=e.getVariable(nA.CHANNEL,i,o);e.connect(g,a),e.connect(a,y),a.run()}}function UA(t,e){let n=e.getVariable(nA.PROPERTY,kA.AXIS_ORIENTATION,t),r=e.getVariable(nA.BOUNDS,t.elements[0].parent),i=e.getVariable(nA.PROPERTY,kA.AXIS_PATH_POSITION,t),o=e.createOneWayDependency(gE.AXIS_PATH_PLACER);e.connect(n,o),e.connect(r,o),e.connect(o,i),o.run();let a=e.getVariable(nA.PROPERTY,kA.AXIS_TICK_OFFSET,t),s=e.getVariable(nA.PROPERTY,kA.AXIS_TICK_SIZE,t),l=e.createOneWayDependency(gE.AXIS_TICKS_PLACER),c=e.getVariable(nA.PROPERTY,kA.AXIS_TICKS_POSITION,t);e.connect(i,l),e.connect(a,l),e.connect(s,l),e.connect(l,c),l.run();let u=e.getVariable(nA.PROPERTY,kA.AXIS_LABEL_OFFSET,t),h=e.getVariable(nA.PROPERTY,kA.AXIS_LABEL_FORMAT,t),f=e.getVariable(nA.PROPERTY,kA.AXIS_FONT_SIZE,t),d=e.createOneWayDependency(gE.AXIS_LABELS_PLACER),p=e.getVariable(nA.PROPERTY,kA.AXIS_LABELS_POSITION,t);e.connect(i,d),e.connect(u,d),e.connect(h,d),e.connect(f,d),e.connect(d,p),d.run();let g=e.getVariable(nA.PROPERTY,kA.AXIS_TITLE_POSITION,t),_=e.createOneWayDependency(gE.AXIS_TITLE_PLACER);e.connect(i,_),e.connect(_,g),_.run();let y=e.getVariable(nA.BOUNDS,t),m=e.getIncomingDataflowOperator(gE.EVAL_BBOX,y);e.connect(c,m),e.connect(p,m),e.connect(m,y)}function YA(t,e){let n=e.getVariable(nA.PROPERTY,kA.AXIS_ORIENTATION,t),r=e.getVariable(nA.BOUNDS,sE(t.elements[0])),i=e.getVariable(nA.PROPERTY,kA.AXIS_PATH_POSITION,t),o=e.createOneWayDependency(gE.AXIS_PATH_PLACER);e.connect(n,o),e.connect(r,o),e.connect(o,i),o.run();let a=e.getVariable(nA.PROPERTY,kA.AXIS_TICK_OFFSET,t),s=e.getVariable(nA.PROPERTY,kA.AXIS_TICK_SIZE,t),l=e.createOneWayDependency(gE.AXIS_TICKS_PLACER),c=e.getVariable(nA.PROPERTY,kA.AXIS_TICKS_POSITION,t);e.connect(i,l),e.connect(a,l),e.connect(s,l),e.connect(l,c),l.run();let u=e.getVariable(nA.PROPERTY,kA.AXIS_LABEL_OFFSET,t),h=e.getVariable(nA.PROPERTY,kA.AXIS_LABEL_FORMAT,t),f=e.getVariable(nA.PROPERTY,kA.AXIS_FONT_SIZE,t),d=e.createOneWayDependency(gE.AXIS_LABELS_PLACER),p=e.getVariable(nA.PROPERTY,kA.AXIS_LABELS_POSITION,t);e.connect(i,d),e.connect(u,d),e.connect(h,d),e.connect(f,d),e.connect(d,p),d.run();let g=e.getVariable(nA.PROPERTY,kA.AXIS_TITLE_POSITION,t),_=e.createOneWayDependency(gE.AXIS_TITLE_PLACER);e.connect(i,_),e.connect(_,g),_.run();let y=e.getVariable(nA.BOUNDS,t),m=e.getIncomingDataflowOperator(gE.EVAL_BBOX,y);e.connect(c,m),e.connect(p,m),e.connect(m,y)}function HA(t,e){let n=e.getVariable(nA.BOUNDS,sE(t.elements[0])),r=e.getVariable(nA.PROPERTY,kA.GRIDLINES_POSITION,t),i=e.createOneWayDependency(gE.GRIDLINES_PLACER);e.connect(n,i),e.connect(i,r),i.run();let o=e.getVariable(nA.BOUNDS,t),a=e.getIncomingDataflowOperator(gE.EVAL_BBOX,o);e.connect(r,a),e.connect(a,o)}class qA{constructor(){this._id=this.type+uT(),this._type=lT.Group,this._dataScope=void 0,this._bounds=void 0,this._layout=void 0,this._children=[],this._sortBy={property:dT,descending:!1}}get id(){return this._id}get type(){return this._type}get children(){return this._children}addChild(t){this.children.indexOf(t)>=0||(t.parent&&t.parent.removeChild(t),this.children.push(t),t.parent=this)}addChildAt(t,e){t.parent&&t.parent.removeChild(t),this.children.splice(e,0,t),t.parent=this}removeChild(t){let e=this.children.indexOf(t);e>=0&&(this.children.splice(e,1),t.parent=null)}removeChildAt(t){this.children[t].parent=null,this.children.splice(t,1)}removeAll(){for(let t of this.children)t.parent=null;this._children=[]}get dataScope(){return this._dataScope}set dataScope(t){if(this._dataScope=t,void 0===t)for(let e of this.children)e.dataScope=t;else for(let e of this.children)e.dataScope?e.dataScope=e.dataScope.merge(t):e.dataScope=t}getInternalEncodings(t){if(0==this.children.length)return[];let e=this.children[0],n=this.getScene(),r=Object.keys(n.encodings),i=[];for(;e;){if(e.classId&&i.indexOf(e.classId)<0&&i.push(e.classId),e.type===lT.Glyph){e.children.forEach(t=>i.push(t.classId));break}if(!e.children)break;e=e.children[0]}let o=[];for(let e of r){let r=e.split("_");for(let a of i)r[0]==a&&n.encodings[e][t]&&o.push(n.encodings[e][t])}return o}get firstChild(){return this.children[0]}get lastChild(){return this.children[this.children.length-1]}set layout(t){if(this._layout=t,t&&(t.group=this),FA(this,t,this.scene._depGraph),this.children&&this.children.length>0){let t=lE(this,!0);for(let e of t)this.scene.onChange(nA.CHANNEL,"x",e)}}get layout(){return this._layout}get bounds(){return this._bounds||this._updateBounds(),this._bounds}get refBounds(){let t=this.children.map(t=>t.refBounds),e=Math.min(...t.map(t=>t.left)),n=Math.min(...t.map(t=>t.top)),r=Math.max(...t.map(t=>t.right)),i=Math.max(...t.map(t=>t.bottom));return new Yw(e,n,r-e,i-n)}get x(){return this.bounds.x}get y(){return this.bounds.y}_updateBounds(){let t=this.children;if(t.length>0){this._bounds=t[0].bounds.clone();for(let e=1;e<t.length;e++)"hidden"!=t[e].visibility&&(this._bounds=this._bounds.union(t[e].bounds))}else this._bounds=new Yw(0,0,0,0)}set visibility(t){this._visibility="hidden"==t?t:"visible";for(let e of this.children)e.visibility=t}get visibility(){return this._visibility?this._visibility:"visible"}get scene(){return aE(this)}get sortBy(){return this._sortBy}}class WA extends qA{constructor(){super(),this._type=lT.Collection,this._id=this.type+"_"+uT(),this._classId=this.id,this._childrenOrder=void 0,this._clipMask=void 0}get classId(){return this._classId}getSVGPathData(){let t="";for(let e of this.children)if(e.getSVGPathData)t+=e.getSVGPathData();else if(e.bounds){let n=e.bounds;t+=["M",n.left,n.top].join(" "),t+=["L",n.right,n.top].join(" "),t+=["L",n.right,n.bottom].join(" "),t+=["L",n.left,n.bottom,"Z"].join(" ")}return t}createClipMask(){let t=qw(this._children);this._clipMask=new Yw(t.left,t.top,t.width,t.height)}get clipMask(){return this._clipMask}}class $A extends qA{constructor(t){if(super(),this._type=lT.Glyph,this._id=this.type+"_"+uT(),this._classId=this._id,t)for(let e of t)this.addChild(e)}get classId(){return this._classId}}class XA extends kE{constructor(t){super(t),this._type=lT.BezierCurve,this._orientation="orientation"in t?t.orientation:bE}get type(){return this._type}get orientation(){return this._orientation}copyPropertiesTo(t){super.copyPropertiesTo(t),t._orientation=this._orientation}getSVGPathData(){if(this._d)return this._d;let t="M ";return t+=this.vertices[0].x+" "+this.vertices[0].y+" ",t+="C "+this.vertices[1].x+" "+this.vertices[1].y+" ",t+=this.vertices[2].x+" "+this.vertices[2].y+" ",t+=this.vertices[3].x+" "+this.vertices[3].y,t}}class KA extends Kw{constructor(t){super(t),this._type=lT.Circle,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._radius="radius"in t?t.radius:100,"strokeColor"in this.styles||(this.styles.strokeColor="#ccc"),"fillColor"in this.styles||(this.styles.fillColor="none"),"strokeWidth"in this.styles||(this.styles.strokeWidth=1),"strokeDash"in this.styles||(this.styles.strokeDash="none")}get x(){return this._x}get y(){return this._y}get radius(){return this._radius}set radius(t){this._radius=t,this._dirty=!0}get area(){return Math.PI*Math.pow(this._radius,2)}_updateBounds(){if(this._rotate){let t=Gw(this._x,this._y,this._rotate[1],this._rotate[2],this._rotate[0]);this._bounds=new Yw(t.x-this._radius,t.y-this._radius,2*this._radius,2*this._radius)}else this._bounds=new Yw(this._x-this._radius,this._y-this._radius,2*this._radius,2*this._radius)}copyPropertiesTo(t){super.copyPropertiesTo(t),t._x=this._x,t._y=this._y,t._radius=this._radius}getSVGPathData(){return["M",this._x,this._y,"m",-this._radius,", 0 a",this._radius,",",this._radius,"0 1,0",2*this._radius,",0 a",this._radius,",",this._radius,"0 1,0",-2*this._radius,",0"].join(" ")}}let ZA=class extends Kw{constructor(t){super(t),this._type=lT.Image,this._src=t.src,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._width="width"in t?t.width:100,this._height="height"in t?t.height:100}get src(){return this._src}set src(t){this._src=t,this._dirty=!0}get width(){return this._width}set width(t){this._width=t,this._updateBounds(),this._dirty=!0}get height(){return this._height}set height(t){this._height=t,this._updateBounds(),this._dirty=!0}resize(t,e){this._width=t,this._height=e,this._dirty=!0,this._updateBounds()}get x(){return this._x}set x(t){this._x=t,this._dirty=!0,this._updateBounds()}get y(){return this._y}set y(t){this._y=t,this._dirty=!0,this._updateBounds()}get bounds(){return this._bounds||this._updateBounds(),this._bounds}_updateBounds(){this._bounds=new Yw(this._x,this._y,this._width,this._height)}copyPropertiesTo(t){t.attrs=Object.assign({},this.attrs),t.styles=Object.assign({},this.styles),this._dataScope&&(t._dataScope=this._dataScope.clone()),t.x=this._x,t.y=this._y,t.width=this._width,t.height=this._height,t.src=this._src}};class JA extends kE{constructor(t){super(t)}get x1(){return this.vertices[0].x}get y1(){return this.vertices[0].y}get x2(){return this.vertices[1].x}get y2(){return this.vertices[1].y}get x(){return(this.vertices[0].x+this.vertices[1].x)/2}get y(){return(this.vertices[0].y+this.vertices[1].y)/2}set x(t){let e=t-this.x;this.vertices[0]._x+=e,this.vertices[1]._x+=e,this._dirty=!0}set y(t){let e=t-this.y;this.vertices[0]._y+=e,this.vertices[1]._y+=e,this._dirty=!0}set x1(t){this.vertices[0]._x=t,this._dirty=!0}set x2(t){this.vertices[1]._x=t,this._dirty=!0}set y1(t){this.vertices[0]._y=t,this._dirty=!0}set y2(t){this.vertices[1]._y=t,this._dirty=!0}}class QA extends Kw{constructor(t){super(t),this._type=lT.SimpleText,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._text="text"in t?t.text:"",this._anchor="anchor"in t?t.anchor:[Xw.CENTER,Xw.MIDDLE],this._textPath=void 0,this._textPathOffset="50%","fontSize"in this.styles||(this.styles.fontSize="12px"),"fontFamily"in this.styles||(this.styles.fontFamily="Arial, sans-serif"),"fontWeight"in this.styles||(this.styles.fontWeight="normal"),"fillColor"in this.styles||(this.styles.fillColor="black"),"backgroundColor"in t&&(this._backgroundColor=t.backgroundColor),"borderWidth"in t&&(this._borderWidth=t.borderWidth),"borderColor"in t&&(this._borderColor=t.borderColor),this._rotate="rotate"in t?t.rotate:void 0}hasBackground(){return this._backgroundColor||this._borderStroke||this._borderColor}_updateBounds(){let t,e,n=function(t,e,n){const r=Fw.getSVG(),i=document.createElementNS("http://www.w3.org/2000/svg","text");i.setAttribute("font-family",e),i.setAttribute("font-size",n),i.textContent=t,r.appendChild(i);const o=i.getBBox();return r.removeChild(i),{width:o.width,height:o.height}}(this._text,[this.fontWeight,this.fontSize,this.fontFamily].join(" "),parseFloat(this.fontSize)),r=n.width,i=n.height;switch(this._anchor[0]){case Xw.LEFT:t=this._x;break;case Xw.RIGHT:t=this._x-r;break;case Xw.CENTER:t=this._x-r/2;break;default:t=this._x}switch(this._anchor[1]){case Xw.TOP:e=this._y;break;case Xw.BOTTOM:e=this._y-i;break;case Xw.MIDDLE:default:e=this._y-i/2}if(this._rotate&&3===this._rotate.length){let n=[{x:t,y:e},{x:t+r,y:e},{x:t,y:e+i},{x:t+r,y:e+i}].map(t=>Gw(t.x,t.y,this._rotate[1],this._rotate[2],this._rotate[0])),o=Math.min(...n.map(t=>t.x)),a=Math.max(...n.map(t=>t.x)),s=Math.min(...n.map(t=>t.y)),l=Math.max(...n.map(t=>t.y));this._bounds=new Yw(o,s,a-o,l-s)}else this._bounds=new Yw(t,e,r,i)}get x(){return this._x}set x(t){this._x=t,this._dirty=!0}get y(){return this._y}set y(t){this._y=t,this._dirty=!0}get text(){return this._text}set text(t){this._text=t,this._dirty=!0}get anchor(){return this._anchor}get fontFamily(){return this.styles.fontFamily}get fontSize(){return this.styles.fontSize}get fontWeight(){return this.styles.fontWeight}get textPath(){return this._textPath}set textPath(t){this._textPath=t,this._dirty=!0}get textPathOffset(){return this._textPathOffset}set textPathOffset(t){this._textPathOffset=t,this._dirty=!0}get backgroundColor(){return this._backgroundColor?this._backgroundColor:"#fff"}get borderColor(){return this._borderColor?this._borderColor:"#ccc"}get borderWidth(){return this._borderWidth?this._borderWidth:1}copyPropertiesTo(t){t.styles=Object.assign({},this.styles),this._dataScope&&(t._dataScope=this._dataScope.clone()),t._x=this._x,t._y=this._y,t._text=this._text,t._anchor=[this._anchor[0],this._anchor[1]],t._backgroundColor=this._backgroundColor,t._borderColor=this._borderColor,t._borderStroke=this._borderStroke}}class tT extends kE{constructor(t){super(t),this._type=lT.Polygon,this.closed=!0,"x"in t&&(this._x=t.x),"y"in t&&(this._y=t.y),"radius"in t&&(this._radius=t.radius)}get radius(){return this._radius}get x(){return this._x}get y(){return this._y}set x(t){this._x=t,this._dirty=!0}set y(t){this._y=t,this._dirty=!0}set radius(t){this._radius=t,this._dirty=!0}copyPropertiesTo(t){super.copyPropertiesTo(t),t._x=this._x,t._y=this._y,t._radius=this._radius}}class eT extends kE{constructor(t){super(t),this._type=lT.Ring,this.closed=!0,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._innerRadius="innerRadius"in t?t.innerRadius:100,this._outerRadius="outerRadius"in t?t.outerRadius:200}get innerRadius(){return this._innerRadius}get outerRadius(){return this._outerRadius}get x(){return this._x}get y(){return this._y}get thickness(){return this._outerRadius-this._innerRadius}copyPropertiesTo(t){super.copyPropertiesTo(t),t._x=this._x,t._y=this._y,t._innerRadius=this._innerRadius,t._outerRadius=this._outerRadius}getSVGPathData(){return["M "+this._x+" "+this._y,"m 0, -"+this._outerRadius,"a "+this._outerRadius+","+this._outerRadius+", 0, 1, 0, 1, 0","Z","m 0 "+(this._outerRadius-this._innerRadius),"a "+this._innerRadius+", "+this._innerRadius+", 0, 1, 1, -1, 0","Z"].join(" ")}}class nT extends Kw{constructor(t){super(t),this._type=lT.RichText,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._text="text"in t?t.text:"",this._width="width"in t?t.width:200,this._anchor="anchor"in t?t.anchor:[Xw.CENTER,Xw.MIDDLE],"fontSize"in this.styles||(this.styles.fontSize="12px"),"fontFamily"in this.styles||(this.styles.fontFamily="Arial, sans-serif"),"fontWeight"in this.styles||(this.styles.fontWeight="normal"),"fillColor"in this.styles||(this.styles.fillColor="black"),"backgroundColor"in t&&(this._backgroundColor=t.backgroundColor),"borderWidth"in t&&(this._borderWidth=t.borderWidth),"borderColor"in t&&(this._borderColor=t.borderColor),this._rotate="rotate"in t?t.rotate:void 0}hasBackground(){return this._backgroundColor||this._borderStroke||this._borderColor}_updateBounds(){let t,e,n=function(t,e,n){const r=Fw.getSVG(),i=document.createElementNS("http://www.w3.org/2000/svg","text");i.setAttribute("font-family",e),i.setAttribute("font-size",n),i.textContent=t,r.appendChild(i);const o=i.getBBox();return r.removeChild(i),{width:o.width,height:o.height}}(this._text,[this.fontWeight,this.fontSize,this.fontFamily].join(" "),parseFloat(this.fontSize)),r=n.width,i=n.height;switch(this._anchor[0]){case Xw.LEFT:t=this._x;break;case Xw.RIGHT:t=this._x-r;break;case Xw.CENTER:t=this._x-r/2;break;default:t=this._x}switch(this._anchor[1]){case Xw.TOP:e=this._y;break;case Xw.BOTTOM:e=this._y-i;break;case Xw.MIDDLE:default:e=this._y-i/2}if(this._rotate&&3===this._rotate.length){let n=[{x:t,y:e},{x:t+r,y:e},{x:t,y:e+i},{x:t+r,y:e+i}].map(t=>Gw(t.x,t.y,this._rotate[1],this._rotate[2],this._rotate[0])),o=Math.min(...n.map(t=>t.x)),a=Math.max(...n.map(t=>t.x)),s=Math.min(...n.map(t=>t.y)),l=Math.max(...n.map(t=>t.y));this._bounds=new Yw(o,s,a-o,l-s)}else this._bounds=new Yw(t,e,r,i)}get x(){return this._x}get y(){return this._y}get text(){return this._text}get anchor(){return this._anchor}get fontFamily(){return this.styles.fontFamily}get fontSize(){return this.styles.fontSize}get fontWeight(){return this.styles.fontWeight}get textPath(){return this._textPath}set textPath(t){this._textPath=t,this._dirty=!0}get textPathOffset(){return this._textPathOffset}set textPathOffset(t){this._textPathOffset=t,this._dirty=!0}get backgroundColor(){return this._backgroundColor?this._backgroundColor:"#fff"}get borderColor(){return this._borderColor?this._borderColor:"#ccc"}get borderWidth(){return this._borderWidth?this._borderWidth:1}get width(){return this._width}copyPropertiesTo(t){t.styles=Object.assign({},this.styles),this._dataScope&&(t._dataScope=this._dataScope.clone()),t._x=this._x,t._y=this._y,t._text=this._text,t._anchor=[this._anchor[0],this._anchor[1]],t._backgroundColor=this._backgroundColor,t._borderColor=this._borderColor,t._borderStroke=this._borderStroke}}function rT(t){let e=null;switch(t.type){case lT.Circle:e=new KA(t);break;case lT.Line:var n="x1"in t?t.x1:0,r="y1"in t?t.y1:0,i="x2"in t?t.x2:100,o="y2"in t?t.y2:100;t.vertices=[[n,r],[i,o]],e=new JA(t);break;case lT.Rect:var a="top"in t?t.top:0,s="left"in t?t.left:0,l="width"in t?t.width:50,c="height"in t?t.height:30;t.vertices=[[s,a],[s+l,a],[s+l,a+c],[s,a+c]],e=new vA(t);break;case lT.SimpleText:e=new QA(t);break;case lT.RichText:e=new nT(t);break;case lT.Image:e=new ZA(t);break;case lT.BundledPath:case lT.Chord:case lT.Path:e=new kE(t);break;case lT.Area:e=new xA(t);break;case lT.Ring:e=new eT(t);break;case lT.Arc:e=new IE(t);break;case lT.BezierCurve:"vertices"in t||(t.vertices=[[0,100],[20,120],[80,180],[100,200]]),e=new XA(t);break;case lT.Polygon:e=new tT(t)}return e&&e._updateBounds(),e}function iT(t){let e=new WA;return t.addChild(e),t._itemMap[e.id]=e,e}function oT(t){return new $A(t)}function aT(t){switch(t.type){case lT.Collection:return function(t){let e=iT(t.scene);for(let n=0;n<t.children.length;n++){let r=t.children[n];e.addChild(aT(r))}if(e._classId=t.classId,t._layout){let n=t._layout.clone();e._layout=n,n.group=e}return e._updateBounds(),e}(t);case lT.Glyph:return function(t){let e=new $A;for(let n of t.children)e.addChild(aT(n));e._classId=t.classId,t._dataScope&&(e.dataScope=t._dataScope.clone());return e}(t);default:return function(t){let e=rT({type:t.type});t.copyPropertiesTo(e),e._classId=t.classId,e._bounds=t.bounds.clone(),t._refBounds||(t._refBounds=t.bounds.clone());e._refBounds=t._refBounds.clone(),t.dataScope&&(e._dataScope=t.dataScope.clone());if(t.vertices)for(let n=0;n<t.vertices.length;n++)t.vertices[n].dataScope&&(e.vertices[n]._dataScope=t.vertices[n].dataScope.clone());return e}(t)}}const sT=Object.freeze({Rect:"rect",Circle:"circle",Line:"line",Ring:"ring",Path:"path",Image:"image",SimpleText:"text",RichText:"richText",Arc:"arc",BezierCurve:"bezierCurve",BundledPath:"bundledPath",Chord:"chord"}),lT=Object.freeze({Area:"area",Rect:"rect",Ellipse:"ellipse",Circle:"circle",Pie:"pie",Ring:"ring",Arc:"arc",BezierCurve:"bezierCurve",BundledPath:"bundledPath",Chord:"chord",Line:"line",Path:"path",Image:"image",SimpleText:"text",RichText:"richText",Collection:"collection",Group:"group",Composite:"composite",Scene:"scene",Axis:"axis",Glyph:"glyph",Legend:"legend",Polygon:"polygon",Gridlines:"gridlines",LinearGradient:"LinearGradient",Link:"link",DataTable:"datatable",Layout:"layout",NetworkData:"networkdata",TreeData:"treedata"}),cT=Object.freeze({Axis:"axis",Legend:"legend",Gridlines:"gridlines"});function uT(){return Date.now().toString(36)+"_"+Math.random().toString(36).slice(2)}class hT{constructor(t,e,n){this._id=lT.DataTable+uT(),this.initialize(t,e,n)}initialize(t,e,n){if(this.url=e,this._rawData=JSON.parse(JSON.stringify(t)),this._data=t,this._dateMap=new Map,this._attributes=0===this._data.length?[]:Object.keys(this._data[0]),this._newAttribute=0,n)this._attrTypes=n;else{this._attrTypes={};for(let t of this._attributes)this._attrTypes[t]=XE(this.data.map(e=>e[t])),"year"==t.toLowerCase()&&this._attrTypes[t]==$E.Integer&&(this._attrTypes[t]=$E.Date)}this._validate(this.data,this._attrTypes),this._attrSummaries={};for(let t of this._attributes)this._attrSummaries[t]=ZE(this.data.map(e=>e[t]),this._attrTypes[t]);this._attributes.indexOf(dT)<0&&this._addAttribute(dT,$E.String,this.data.map((t,e)=>"r"+e))}clone(){let t=[];for(let e of this._data)t.push(Object.assign({},e));let e=new hT(t,this.url,Object.assign({},this._attrTypes));return e.sourceDataTable=this,e}get id(){return this._id}get name(){return this.url?function(t){var e=t.indexOf("\\")>=0?t.lastIndexOf("\\"):t.lastIndexOf("/"),n=t.substring(e);0!==n.indexOf("\\")&&0!==n.indexOf("/")||(n=n.substring(1));return n}(this.url):this.id}get data(){return this._data}getEncodableAttributes(t){switch(t){case"x":case"y":case"width":case"height":case"radius":case"fillColor":case"strokeColor":case"text":return this.numericAttributes.concat(this.nonNumericAttributes);default:return this.numericAttributes}}_addAttribute(t,e,n){this._data.forEach((e,r)=>e[t]=n[r]),t!==dT&&this._rawData.forEach((e,r)=>e[t]=n[r]),this._attrTypes[t]=e,this._attributes.push(t),this._attrSummaries[t]=ZE(n,e)}getAttributeType(t){return this._attrTypes[t]}get attributes(){return this._attributes}getAttributeSummary(t){return this._attrSummaries[t]}getAttributeValues(t){return this.data.map(e=>e[t])}getUniqueAttributeValues(t){return this._attrSummaries[t].unique}orderAttributeValues(t,e){this._attrSummaries[t].unique=e}getRowCount(){return this.data.length}hasAttribute(t){return this._attributes.indexOf(t)>=0}parseAttributeAsDate(t,e){let n=ry(e);for(let e of this.data){let r=e[t];null==r||null==r?(r="",e[t]=new Date(1899,11,31).getTime()):e[t]=n(r).getTime(),this._dateMap.set(e[t],r)}this._attrTypes[t]=$E.Date,this._attrSummaries[t]=ZE(this.data.map(e=>e[t]),$E.Date)}getRawValue(t,e){return this.getAttributeType(t)===$E.Date?this._dateMap.get(e).toString():e}get nonNumericAttributes(){let t=[];for(let e in this._attrTypes)this._attrTypes[e]!=$E.Number&&this._attrTypes[e]!=$E.Integer&&e!=hT.RowID&&t.push(e);return t.sort((t,e)=>this.getUniqueAttributeValues(t).length-this.getUniqueAttributeValues(e).length),t}get numericAttributes(){let t=[];for(let e in this._attrTypes)this._attrTypes[e]!==$E.Number&&this._attrTypes[e]!==$E.Integer||e==hT.RowID||t.push(e);return t}getAttributesByType(t){let e=[];for(let n in this._attrTypes)this._attrTypes[n]===t&&n!=hT.RowID&&e.push(n);return e}summarize(){for(let t of this._attributes)this._attrSummaries[t]=ZE(this.data.map(e=>e[t]),this._attrTypes[t])}_validate(t,e){for(let n of t)for(let t in e){let r,i=e[t],o=n[t];if(null==n[t]||null==n[t])switch(i){case $E.Boolean:r=!1;break;case $E.Date:r=new Date(1899,11,31).getTime();break;case $E.String:r="";break;default:r=0}else switch(i){case $E.Boolean:r=o;break;case $E.Date:r=Number.isInteger(o)?new Date(o,0).getTime():new Date(o+"").getTime(),this._dateMap.set(r,o);break;case $E.String:r=o.toString();break;default:r=o}n[t]=r}}}function fT(t){let e=zE(t);if(e)return e.dataTable}const dT="mascot_rowId";function pT(t,e){return fetch(e,{method:t}).then(t=>t.ok?t.text():(console.log(t.status),Promise.reject({status:t.status,statusText:t.statusText}))).catch(t=>(console.log(t),Promise.reject({status:t.status,statusText:t.statusText})))}class gT extends eA{constructor(t,e){super(t),this._elem=e}get element(){return this._elem}}class _T extends eA{constructor(t,e){super(t),this._item=e}get element(){return this._item}}class yT{constructor(t){this._id=t+"_"+uT(),this._type=t,this._vars=[],this._edges=[]}get vars(){return this._vars}get edges(){return this._edges}run(){console.log("-",this._type)}}class mT{constructor(t,e,n=!0){this._id="e_"+uT(),this._fromNode=t,this._toNode=e,this._isDirected=n}get id(){return this._id}get fromNode(){return this._fromNode}get toNode(){return this._toNode}get isDirected(){return this._isDirected}get operator(){return this._fromNode instanceof pE||this._fromNode instanceof yT?this._fromNode:this._toNode}}class bT extends eA{constructor(t,e,n){super(t),this._attribute=e,this._dataset=n}get attribute(){return this._attribute}get dataset(){return this._dataset}}class vT{constructor(t,e){switch(this._id="scale_"+uT(),this._type=t,e&&(this._args=e),t){case"linear":this._scale=gg();break;case"point":this._scale=rg();break;case"ordinal":this._scale=tg();break;case"ordinalColor":this._scale=tg(Nw[e.scheme]);break;case"power":this._scale=Ng().exponent(2);break;case"sqrt":this._scale=Ng().exponent(.5);break;case"log":this._scale=Ag();break;case"identity":case"time":this._scale=Rm();break;case"sequentialColor":e.scheme?this._scale=Im(Nw[e.scheme]):this._scale=Im()}}get id(){return this._id}get domain(){return this._scale.domain()}set domain(t){this._scale.domain(t)}get range(){return this._scale.range()}set range(t){this._scale.range(t)}get rangeExtent(){let t=this._scale.range();return Math.abs(t[1]-t[0])}set rangeExtent(t){let e=this._scale.range();e[0]<e[1]?this._scale.range([e[0],e[0]+t]):this._scale.range([e[1]+t,e[1]])}get type(){return this._type}map(t){return this._scale(t)}invert(t,e){let n=Math.min(...this._scale.range()),r=Math.max(...this._scale.range()),i=t;return e||(i=Math.max(n,Math.min(t,r))),"time"===this._type?this._scale.invert(i).getTime():this._scale.invert(i)}}const xT=["schemeBrBG","schemePRGn","schemePiYG","schemePuOr","schemeRdBu","schemeRdGy","schemeRdYlBu","schemeRdYlGn","schemeSpectral"],wT=["schemeBlues","schemeGreens","schemeGreys","schemeOranges","schemePurples","schemeReds","schemeBuGn","schemeBuPu","schemeGnBu","schemeOrRd","schemePuBuGn","schemePuBu","schemePuRd","schemeRdPu","schemeYlGnBu","schemeYlGn","schemeYlOrBr","schemeYlOrRd"];class ET{constructor(){this._map={}}clear(){this._map={}}setValue(t,e){this._map[t]=e}getValue(t){return this._map[t]}}class AT extends eA{constructor(t,e){super(t),this._encs=[e],this._valueMap=new ET}addLinkedEncoding(t){this._encs.push(t)}get encodings(){return this._encs}get attrValues(){return this._valueMap}set attrValues(t){this._valueMap=t}}class TT extends pE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof AT),e=this.outputVar,n=e.encodings,r=n[0],i=r.channel,o=r.attribute,a=t.encodings[0].dataTable.getAttributeType(t.encodings[0].attribute),s=Object.values(t.attrValues);if("angle"===r.channel&&[lT.Arc,lT.Pie].indexOf(r.element.type)>=0)for(let e of t.encodings)for(let t of e.scales){let n=e.getElements(t).map(t=>e.attrValues[t.id]);t.domain=r._preferredDomain?r._preferredDomain:e.dataTable.tree?[0,e.dataTable.tree.getRoot()[o]]:this._getDomainForNumbers(n),console.log("domain for",o,t.domain)}else{let e;e=r._preferredDomain?r._preferredDomain:a==$E.String||"text"===t.encodings[0].channel?this._getDomainForStrings(s):this._getDomainForNumbers(s);for(let n of t.encodings)for(let t of n.scales)t.domain=e.slice()}for(let t=0;t<r.scales.length;t++){let o=r.scales[t],a=r.getElements(o),s=this._buildRange(i,a,r,e);if(s)for(let e of n)e.scales[t].range=s}e.initialized=!0}_getDomainForNumbers(t){let e=this.outputVar.encodings[0],n=[Math.min(...t),Math.max(...t)];if(e.includeZero&&n[0]>0&&(n=[0,Math.max(...t)]),e.mapping)n=Object.keys(e.mapping),n=n.map(t=>parseFloat(t)),n.sort((t,e)=>t-e);else if("sequentialColor"===e.scales[0].type){if(n[0]<0&&n[1]>0){let t=Math.max(Math.abs(n[0]),Math.abs(n[1]));n=[-t,t]}}else if("angle"===e.channel){let e=Object.values(t).reduce((t,e)=>t+e,0);n=[0,e]}return n}_getDomainForStrings(t){let e,n=this.outputVar,r=n.encodings[0];return e="count"==n.encodings[0].aggregator?[0,Math.max(...t)]:Array.from(new Set(t)),r.mapping&&(e=Object.keys(r.mapping)),e}_buildRange(t,e,n,r){return"x"===t?this._buildXRange(e,n,r):"y"===t?this._buildYRange(e,n,r):["width","height","radius","area","fontSize","radialDistance","strokeWidth"].includes(t)?this._buildSizeRange(e,n,r):t.indexOf("Color")>0||"fillGradient"===t?this._buildColorRange(e,n):"angle"===t?this._buildAngleRange(e,n):"thickness"===t?this._buildThicknessRange(e,n,r):"src"===t?n.scales[0].domain.slice():void 0}_buildThicknessRange(t,e,n){let r=t.map(t=>t.outerRadius-t.innerRadius);return[0,n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:Math.max(...r)]}_buildAngleRange(t,e){return[0,360]}_buildColorRange(t,e){if(e.mapping){return e.scales[0].domain.map(t=>e.mapping[t+""])}if("sequentialColor"===e.scales[0].type){let t=this.outputVar,n=e.scales[0].domain;for(let r of t.encodings)if(!e.colorScheme)for(let t of r.scales){let e=t.domain;t._scale=Im(n[0]<0&&n[1]>0?rb:rv),t._scale.domain(e)}}if((xT.indexOf(e.colorScheme)>=0||wT.indexOf(e.colorScheme)>=0)&&"ordinalColor"===e.scales[0].type){let t=this.outputVar,n=e.scales[0].domain;for(let r of t.encodings)for(let t of r.scales){let r=t.domain;t._scale=tg(Nw[e.colorScheme][n.length]),t._scale.domain(r)}}}_buildSizeRange(t,e,n){let r,i;return r=0,i=n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:Math.max(...t.map(t=>"radius"===e.channel?t.refBounds.width/2:"strokeWidth"===e.channel?t.strokeWidth:"radialDistance"===e.channel?t.parent.radius:"area"===e.channel?t.type===lT.Circle?Math.PI*Math.pow(t.radius,2):t.width*t.height:"fontSize"===e.channel?parseFloat(t.fontSize):t.refBounds[e.channel])),[0,0+i]}_buildXRange(t,e,n){let r,i;switch(e.scales[0].type,t[0].type){case"vertex":case"segment":var o=t[0].parent.refBounds?t[0].parent.refBounds:t[0].parent.bounds;r=n.initialized?e.getRangeStart(t[0]):o.left,i=n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:o.width;break;default:r=n.initialized?e.getRangeStart(t[0]):e._preferredRangeStart?e._preferredRangeStart:sE(t[0]).bounds.left+t[0].bounds.width/2,i=n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:Math.max(450,Math.max(...t.map(t=>t.bounds.x))-Math.min(...t.map(t=>t.bounds.x)))}return e.flipScale?[r+i,r]:[r,r+i]}_buildYRange(t,e,n){let r,i;switch(e.scales[0].type,t[0].type){case"vertex":case"segment":var o=t[0].parent.refBounds?t[0].parent.refBounds:t[0].parent.bounds;r=n.initialized?e.getRangeStart(t[0]):o.top,i=n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:o.height;break;default:r=n.initialized?e.getRangeStart(t[0]):sE(t[0]).bounds.top+t[0].bounds.height/2,i=n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:450}return e.flipScale?[r,r+i]:[r+i,r]}}class ST extends pE{constructor(t){super(t)}run(){super.run()}}class CT extends qA{constructor(t){super(),this._type=lT.Axis,this._id=t.id?t.id:this._type+uT(),this._attribute=void 0,this._channel=void 0,this._orientation=void 0,this._strokeColor="strokeColor"in t?t.strokeColor:"#555",this._textColor="textColor"in t?t.textColor:"#555",this._fontSize="fontSize"in t?t.fontSize:"12px",this._tickOffset="tickOffset"in t?t.tickOffset:0,this._tickSize="tickSize"in t?t.tickSize:5,this._tickAnchor=t.tickAnchor,this._tickVisible=!("tickVisible"in t)||t.tickVisible,this._pathVisible=!("pathVisible"in t)||t.pathVisible,this._labelVisible=!("labelVisible"in t)||t.labelVisible,this._labelOffset="labelOffset"in t?t.labelOffset:this._tickSize+this._tickOffset+3,this._labelFormat="labelFormat"in t?t.labelFormat:"",this._titleOffset="titleOffset"in t?t.titleOffset:40,this._rotateYTitle=!("rotateTitle"in t&&!t.rotateTitle),this._showTitle=!("titleVisible"in t)||t.titleVisible,this._labelRotation="labelRotation"in t?t.labelRotation:0,this._ticks=new qA,this._ticks._id=this._id+"_ticks",this.addChild(this._ticks),this._labels=new qA,this._labels._id=this._id+"_labels",this.addChild(this._labels),this._title=new QA({text:this._titleText,fillColor:this._textColor,fontWeight:"bold"}),this._title._id=this.id+"_title",this.addChild(this._title),this._showTitle||(this._title.visibility="hidden"),this._pathPos=void 0,this._args=t}get id(){return this._id}get pathPos(){return this._pathPos}get attribute(){return this._attribute}get channel(){return this._channel}get orientation(){return this._orientation}get tickSize(){return this._tickSize}get tickOffset(){return this._tickOffset}get tickAnchor(){return this._tickAnchor?this._tickAnchor:"x"===this._channel||"width"===this._channel?"center":"middle"}get labelOffset(){return this._labelOffset}get tickValues(){return this._tickValues}get labelValues(){return this._labelValues}get titleOffset(){return this._titleOffset}get boundsWithoutTitle(){let t=this.children.filter(t=>t.type!==lT.SimpleText),e=t[0].bounds.clone();for(let n=1;n<t.length;n++)"hidden"!=t[n].visibility&&(e=e.union(t[n].bounds));return e}}const kT="top",MT="bottom",RT="left";function OT(t,e,n,r){let i,o=t.domain,a=t.range;switch(t.type){case"linear":case"log":{let s=Math.abs(a[0]-a[1]);i="width"==e||"x"==e?45:30;let l,c=Math.max(2,Math.floor(s/i));if("width"==e||"height"==e){let i=!!r&&(r.elements[0].parent.layout&&r.elements[0].parent.layout.type==fE.STACK);o[1]=t._scale.invert(i?Ww(n)[e]:qw(n)[e])}if("log"===t.type){l=[];let e=t._scale.ticks();for(let t of e){let n=Math.log(t)/Math.log(10)+1e-6;Math.abs(n-Math.floor(n))<c/e.length&&l.push(t)}}else l=W(o[0],o[1],c);return l}case"point":{i="width"==e||"x"==e?80:30;let n=Math.floor(t.rangeExtent/o.length),r=Math.ceil(i/n);return"x"==e?o.filter((t,e)=>e%r==0):o}case"time":{i="width"==e||"x"==e?80:30;let t,n,r=Math.floor((a[1]-a[0])/i),s=Math.ceil((o[1]-o[0])/r)/1e3,l=[1,60,3600,86400,2628003,31536e3],c=[Wg,Xg,Qg,r_,z_,U_];for(let e=0;e<l.length-1;e++)if(s>=l[e]&&s<l[e+1])return t=Math.floor(s/l[e]),n=c[e],n(o[0],o[1],t);return s>l[l.length-1]?(t=Math.floor(s/l[l.length-1]),n=c[l.length-1],n(o[0],o[1],t)):[]}default:return[]}}function NT(t,e){e.removeChild(t)}class IT extends CT{constructor(t,e,n,r){super(r),this._encoding=t,this._attribute=this._encoding.attribute,this._channel=this._encoding.channel,this._scale=e,this._elems=n,this._flip="flip"in r&&r.flip,this._posArg="x"==this._channel||"width"==this._channel?r.pathY:r.pathX,this._orientation="orientation"in r?r.orientation:"x"===this._channel||"width"==this._channel?MT:RT,this._titleText="title"in r?r.title:this._encoding.attribute,this._path="angle"===this._channel?new KA({strokeColor:this._strokeColor,id:this._id+"_path"}):new kE({strokeColor:this._strokeColor,id:this._id+"_path"}),this._pathVisible||(this._path.visibility="hidden"),this.addChild(this._path),this.createTicksLabels(r),t.dataTable.getAttributeType(this._attribute)!==$E.Date||"labelFormat"in r||(this._labelFormat="%m/%d/%y"),"radialDistance"===this._channel&&"rotation"in r&&(this._rotate=[-r.rotation,this._elems[0].parent.x,this._elems[0].parent.y])}isFlipped(){return this._flip}get elements(){return this._elems}get scale(){return this._scale}get encoding(){return this._encoding}createTicksLabels(t){"tickValues"in t?(this._tickValues=t.tickValues,this._labelValues=t.tickValues):(this._tickValues=OT(this._scale,this._channel,this._elems,this),this._labelValues=this._tickValues),this._ticks.removeAll();for(let t=0;t<this._tickValues.length;t++){let e=new kE({strokeColor:this._strokeColor,id:this._id+"_tick"+t});this._tickVisible||(e.visibility="hidden"),this._ticks.addChild(e)}let e;switch(this._labels.removeAll(),this._encoding.dataTable.getAttributeType(this._attribute)){case $E.Date:e=iy(this._labelFormat);break;case $E.String:e=function(t){return t};break;default:e=Hl(this._labelFormat)}for(let[t,n]of this._labelValues.entries()){let r=new QA({text:e(n),fontSize:this._fontSize,fillColor:this._textColor,id:this._id+"_label"+t});this._labelVisible||(r.visibility="hidden"),this._labels.addChild(r)}this._title._text=this._titleText}}class LT extends CT{constructor(t,e,n,r){super(r),this._elems=t,this._attribute=n,this._channel=e,this._posArg="x"==this._channel||"width"==this._channel?r.pathY:r.pathX,this._labelAttribute=r.labelAttribute,this._orientation="orientation"in r?r.orientation:"x"===this._channel||"width"==this._channel?MT:RT,this._titleText="title"in r?r.title:this._attribute,this._path="angle"===this._channel?new KA({strokeColor:this._strokeColor,id:this._id+"_path"}):new kE({strokeColor:this._strokeColor,id:this._id+"_path"}),this._pathVisible||(this._path.visibility="hidden"),this.addChild(this._path),this.createTicksLabels(r),this._elems[0].dataScope.dataTable.getAttributeType(this._attribute)!==$E.Date||"labelFormat"in r||(this._labelFormat="%m/%d/%y")}get elements(){if(this.layout.type===fE.CLUSTER){const t=new Map(this._elems.map(t=>[t.dataScope.getAttrVal(qE),t]));return this.layout._d3Root.leaves().map(e=>t.get(e.data[qE]))}return this._elems}get layout(){return this._elems[0].parent.layout}createTicksLabels(t){"tickValues"in t?(this._tickValues=t.tickValues,this._labelValues=t.tickValues):(this._tickValues=this.elements.map(t=>t.dataScope.getAttrVal(this._labelAttribute?this._labelAttribute:this._attribute)),this._labelValues=this._tickValues),this._ticks.removeAll();for(let t=0;t<this._tickValues.length;t++){let e=new kE({strokeColor:this._strokeColor,id:this._id+"_tick"+t});this._tickVisible||(e.visibility="hidden"),this._ticks.addChild(e)}let e;switch(this._labels.removeAll(),this._elems[0].dataScope.dataTable.getAttributeType(this._labelAttribute?this._labelAttribute:this._attribute)){case $E.Date:e=ny(this._labelFormat);break;case $E.String:e=function(t){return t};break;default:e=Hl(this._labelFormat)}for(let[t,n]of this._labelValues.entries()){let r=new QA({text:e(n),fontSize:this._fontSize,fillColor:this._textColor,id:this._id+"_label"+t});this._labels.addChild(r)}this._title._text=this._titleText}}class PT extends pE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof TA&&t.property==kA.AXIS_ORIENTATION).element;t.createTicksLabels(t._args),t instanceof IT?this._runForEncoding(t):t instanceof LT&&this._runForLayout(t),$w(t._path)}_runForLayout(t){let e=t.channel,n=t.elements[0].parent.layout&&t.elements[0].parent.layout.type==fE.STACK?Ww(t.elements):qw(t.elements),r=[];if("x"===e){let e=t.orientation===kT?n.top-2:n.bottom+2;t._pathPos=t._posArg?t._posArg:e,r.push([n.left,t._pathPos]),r.push([n.right,t._pathPos]),t._path._setVertices(r)}else if("y"===e){let e=t.orientation===RT?n.left-2:n.right+2;t._pathPos=t._posArg?t._posArg:e,r.push([t._pathPos,n.top]),r.push([t._pathPos,n.bottom]),t._path._setVertices(r)}else if("angle"===e){let e=t.elements[0].parent.layout;e.type===fE.CLUSTER&&(t._path._x=e.x,t._path._y=e.y,t._path._radius=e.radius)}}_runForEncoding(t){let e=t.channel,n=t.elements,r=n[0].parent.layout&&n[0].parent.layout.type==fE.STACK?Ww(n):qw(n),i=[],o=sE(n[0]);if(o&&o.clipMask&&(r=o.clipMask),"x"===e){let e,o,a=lA(n[0],"y");a?(e=Math.min(...a.getScale(n[0]).range,r.top),o=Math.max(...a.getScale(n[0]).range,r.bottom)):(e=r.top,o=r.bottom);let s=t.orientation===kT?e-2:o+2;t._pathPos=t._posArg?t._posArg:s,i.push([t.scale.range[0],t._pathPos]),i.push([t.scale.range[1],t._pathPos])}else if("width"===e){let e=t.orientation===kT?r.top-2:r.bottom+2;t._pathPos=t._posArg?t._posArg:e,i.push([r.left,t._pathPos]),i.push([r.right,t._pathPos])}else if("radialDistance"===e){let e=t.elements[0].parent,n=e.y;t._pathPos=t._posArg?t._posArg:n,i.push([t.scale.range[0]+e.x,t._pathPos]),i.push([t.scale.range[1]+e.x,t._pathPos])}else if("y"===e){let e,o,a=lA(n[0],"x");a?(e=Math.min(...a.getScale(n[0]).range,r.left),o=Math.max(...a.getScale(n[0]).range,r.right)):(e=r.left,o=r.right);let s=t.orientation===RT?e-2:o+2;t._pathPos=t._posArg?t._posArg:s,i.push([t._pathPos,t.scale.range[0]]),i.push([t._pathPos,t.scale.range[1]])}else if("height"===e){let e=t.orientation===RT?r.left-2:r.right+2;t._pathPos=t._posArg?t._posArg:e,i.push([t._pathPos,r.bottom]),i.push([t._pathPos,r.top])}t._path._setVertices(i)}}class VT extends pE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof TA&&t.property==kA.AXIS_PATH_POSITION).element;t instanceof IT?this._runForEncoding(t):t instanceof LT&&this._runForLayout(t);let e=[];if("width"===t.channel||"x"===t.channel){let n=t._ticks.children.map(t=>t.vertices[0].x),r=[t._path.vertices[0].x,t._path.vertices[1].x];e.push([Math.min(...n.concat(r)),t._path.vertices[0].y]),e.push([Math.max(...n.concat(r)),t._path.vertices[0].y]),t._path._setVertices(e)}else if("height"===t.channel||"y"===t.channel){let n=t._ticks.children.map(t=>t.vertices[0].y),r=[t._path.vertices[0].y,t._path.vertices[1].y];e.push([t._pathPos,Math.min(...n.concat(r))]),e.push([t._pathPos,Math.max(...n.concat(r))]),t._path._setVertices(e)}for(let e of t._ticks.children)e._updateBounds();$w(t._ticks)}_runForLayout(t){let e=t.channel;if("x"==e){let e=t.orientation==MT?t.pathPos+t.tickOffset:t.pathPos-t.tickOffset,n=t.orientation==MT?t.tickSize:-t.tickSize;for(let[r,i]of t._ticks.children.entries()){let o=t.elements[r].bounds[t.tickAnchor];i._setVertices([[o,e],[o,e+n]])}}else if("y"===e){let e=t.orientation==RT?t.pathPos-t.tickOffset:t.pathPos+t.tickOffset,n=t.orientation==RT?-t.tickSize:t.tickSize;for(let[r,i]of t._ticks.children.entries()){let o=t.elements[r].bounds[t.tickAnchor];i._setVertices([[e,o],[e+n,o]])}}else if("angle"===e){let e=t.elements[0].parent.layout;if(e.type===fE.CLUSTER){let n=e._d3Root.leaves();const r=new Map(n.map(t=>[t.data[qE],[t.x,t.y]]));for(let[n,i]of t._ticks.children.entries()){let o=t.elements[n].dataScope.getAttrVal(qE),a=PE(r.get(o)[0])-90;i._setVertices([[e.x+r.get(o)[1]+t.elements[n].bounds.width/2,e.y],[e.x+r.get(o)[1]+t.elements[n].bounds.width/2+t.tickSize,e.y]]),i._rotate=[a,e.x,e.y]}}}}_runForEncoding(t){let e=t.channel,n=qw(t.elements);if("x"==e){let e=t.orientation==MT?t.pathPos+t.tickOffset:t.pathPos-t.tickOffset,n=t.orientation==MT?t.tickSize:-t.tickSize;for(let[r,i]of t._ticks.children.entries())i._setVertices([[t.scale.map(t._tickValues[r]),e],[t.scale.map(t._tickValues[r]),e+n]])}else if("width"==e){let e=t.orientation==MT?t.pathPos+t.tickOffset:t.pathPos-t.tickOffset,r=t.orientation==MT?t.tickSize:-t.tickSize;if(!!(t.isFlipped()||t.elements[0].type===lT.Area&&"right"===t.elements[0].baseline))for(let[i,o]of t._ticks.children.entries())o._setVertices([[n.left+t.scale.rangeExtent-t.scale.map(t._tickValues[i]),e],[n.left+t.scale.rangeExtent-t.scale.map(t._tickValues[i]),e+r]]);else for(let[i,o]of t._ticks.children.entries())o._setVertices([[t.scale.map(t._tickValues[i])+n.left,e],[t.scale.map(t._tickValues[i])+n.left,e+r]])}else if("y"===e){let e=t.orientation==RT?t.pathPos-t.tickOffset:t.pathPos+t.tickOffset,n=t.orientation==RT?-t.tickSize:t.tickSize;for(let[r,i]of t._ticks.children.entries())i._setVertices([[e,t.scale.map(t._tickValues[r])],[e+n,t.scale.map(t._tickValues[r])]])}else if("height"===e){let e=t.orientation==RT?t.pathPos-t.tickOffset:t.pathPos+t.tickOffset,r=t.orientation==RT?-t.tickSize:t.tickSize;if(!!(t.isFlipped()||t.elements[0].type===lT.Area&&"top"===t.elements[0].baseline))for(let[i,o]of t._ticks.children.entries())o._setVertices([[e,n.top+t.scale.map(t._tickValues[i])],[e+r,n.top+t.scale.map(t._tickValues[i])]]);else for(let[i,o]of t._ticks.children.entries()){let a=n.bottom-t.scale.map(t._tickValues[i]);o._setVertices([[e,a],[e+r,a]])}}else if("radialDistance"===e){let e=t.orientation==MT?t.pathPos+t.tickOffset:t.pathPos-t.tickOffset,n=t.orientation==MT?t.tickSize:-t.tickSize,r=t.elements[0].parent;for(let[i,o]of t._ticks.children.entries())o._setVertices([[r.x+t.scale.map(t._tickValues[i]),e],[r.x+t.scale.map(t._tickValues[i]),e+n]])}}}class DT extends pE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof TA&&t.property==kA.AXIS_PATH_POSITION).element;t instanceof IT?this._runForEncoding(t):t instanceof LT&&this._runForLayout(t);for(let e of t._labels.children)e._updateBounds();$w(t._labels)}_runForLayout(t){let e=t.channel;if("x"==e){let e=t.orientation==MT?t.labelOffset:-t.labelOffset,n=t.orientation==MT?[Xw.CENTER,Xw.TOP]:[Xw.CENTER,Xw.BOTTOM];for(let[r,i]of t._labels.children.entries()){let o=t.elements[r].bounds;i.x=o[t.tickAnchor],i._y=t.pathPos+e,i._anchor=n,t._labelRotation&&(i._rotate=[t._labelRotation,i.x,i.y],i._anchor=[Xw.RIGHT,Xw.MIDDLE])}}else if("y"===e){let e=t.orientation==RT?-t.labelOffset:t.labelOffset,n=t.orientation==RT?[Xw.RIGHT,Xw.MIDDLE]:[Xw.LEFT,Xw.MIDDLE];for(let[r,i]of t._labels.children.entries()){let o=t.elements[r].bounds;i.x=t.pathPos+e,i._y=t.tickAnchor==Xw.MIDDLE?o.y:o[t.tickAnchor],i._anchor=n,t._labelRotation&&(i._rotate=[t._labelRotation,i.x,i.y],i._anchor=[Xw.RIGHT,n[1]])}}else if("angle"===e){let e=t.elements[0].parent.layout;if(e.type===fE.CLUSTER){let n=e._d3Root.leaves();const r=new Map(n.map(t=>[t.data[qE],[t.x,t.y]]));let i=5;for(let[n,o]of t._labels.children.entries()){let a=t.elements[n].dataScope.getAttrVal(qE);if(r.get(a)[0]<Math.PI){let s=PE(r.get(a)[0])-90;o._anchor=[Xw.LEFT,Xw.MIDDLE],o.x=e.x+r.get(a)[1]+t.elements[n].bounds.width/2+i,o._y=e.y,o._rotate=[s,e.x,e.y]}else{let s=PE(r.get(a)[0])+90;o._anchor=[Xw.RIGHT,Xw.MIDDLE],o.x=e.x-r.get(a)[1]-t.elements[n].bounds.width/2-i,o._y=e.y,o._rotate=[s,e.x,e.y]}}}}}_runForEncoding(t){let e=t.channel,n=qw(t.elements);if("x"==e){let e=t.orientation==MT?t.labelOffset:-t.labelOffset,n=t.orientation==MT?[Xw.CENTER,Xw.TOP]:[Xw.CENTER,Xw.BOTTOM];for(let[r,i]of t._labels.children.entries())i.x=t.scale.map(t.labelValues[r]),i._y=t.pathPos+e,i._anchor=n,t._labelRotation&&(i._rotate=[t._labelRotation,i.x,i.y],i._anchor=[Xw.RIGHT,n[1]])}else if("width"===e){let e=t.orientation==MT?t.labelOffset:-t.labelOffset,r=t.orientation==MT?[Xw.CENTER,Xw.TOP]:[Xw.CENTER,Xw.BOTTOM],i=!!(t.isFlipped()||t.elements[0].type===lT.Area&&"right"===t.elements[0].baseline);for(let[o,a]of t._labels.children.entries())a.x=i?n.left+t.scale.rangeExtent-t.scale.map(t.labelValues[o]):t.scale.map(t.labelValues[o])+n.left,a._y=t.pathPos+e,a._anchor=r,t._labelRotation&&(a._rotate=[t._labelRotation,a.x,a.y],a._anchor=[Xw.RIGHT,r[1]])}else if("y"===e){let e=t.orientation==RT?-t.labelOffset:t.labelOffset,n=t.orientation==RT?[Xw.RIGHT,Xw.MIDDLE]:[Xw.LEFT,Xw.MIDDLE];for(let[r,i]of t._labels.children.entries())i.x=t.pathPos+e,i._y=t.scale.map(t.labelValues[r]),i._anchor=n,t._labelRotation&&(i._rotate=[t._labelRotation,i.x,i.y],i._anchor=[Xw.RIGHT,n[1]])}else if("height"===e){let e=t.orientation==RT?-t.labelOffset:t.labelOffset,r=t.orientation==RT?[Xw.RIGHT,Xw.MIDDLE]:[Xw.LEFT,Xw.MIDDLE],i=t.elements[0].type===lT.Area&&"top"===t.elements[0].baseline;for(let[o,a]of t._labels.children.entries())a.x=t.pathPos+e,a._y=i?n.top+t.scale.map(t.labelValues[o]):n.bottom-t.scale.map(t.labelValues[o]),a._anchor=r,t._labelRotation&&(a._rotate=[t._labelRotation,a.x,a.y],a._anchor=[Xw.RIGHT,r[1]])}else if("radialDistance"==e){let e=t.orientation==MT?t.labelOffset:-t.labelOffset,n=t.orientation==MT?[Xw.CENTER,Xw.TOP]:[Xw.CENTER,Xw.BOTTOM],r=t.elements[0].parent;for(let[i,o]of t._labels.children.entries())o.x=r.x+t.scale.map(t.labelValues[i]),o._y=t.pathPos+e,o._anchor=n,t._labelRotation&&(o._rotate=[t._labelRotation,o.x,o.y],o._anchor=[Xw.RIGHT,n[1]])}}}class BT extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){let e=t.layout;if(!e)return;this.fillGrid(t,e),this.computeCellBounds(t,e),this.placeElements(t,e)}let n=lE(t,!0);for(let t of n)$w(t)}placeElements(t,e){let n=uA(t,"x"),r=uA(t,"y");for(let n=0;n<t.children.length;n++){let r=t.children[n],i=e.cellBounds[n],o=0,a=0;switch(e._cellHorzAlignment){case Xw.LEFT:o=i.left-r.refBounds.left;break;case Xw.CENTER:o=i.x-r.refBounds.x;break;case Xw.RIGHT:o=i.right-r.refBounds.right}switch(e._cellVertAlignment){case Xw.TOP:a=i.top-r.refBounds.top;break;case Xw.MIDDLE:a=i.y-r.refBounds.y;break;case Xw.BOTTOM:a=i.bottom-r.refBounds.bottom}pA(r,o,a)}if(n.length>0)for(let t of n)for(let n of t.scales){let r=t.getElements(n)[0],i=e.getIndex(r);if(i<0)continue;let o="point"===n.type?e.cellBounds[i].left+r.bounds.width/2:e.cellBounds[i].left,a=o+n.rangeExtent;n.range=n.range[0]<n.range[1]?[o,a]:[a,o]}if(r.length>0)for(let t of r)for(let n of t.scales){let r=t.getElements(n)[0],i=e.getIndex(r);if(i<0)continue;let o="point"===n.type?e.cellBounds[i].top+t.getElements(n)[0].bounds.height/2:e.cellBounds[i].top,a=o+n.rangeExtent;n.range=n.range[0]<n.range[1]?[o,a]:[a,o]}}fillGrid(t,e){e._grid=new Array(e.numRows).fill(null).map(()=>new Array(e.numCols).fill(null));for(let n=0;n<t.children.length;n++){let t=e.getRowCol(n);e._grid[t.row][t.col]=n}}computeCellBounds(t,e){let n=t.children.map(t=>t.refBounds?t.refBounds:t.bounds),r=e._colGap,i=e._rowGap;if(void 0===e._left){let t=n.map(t=>t.left),r=n.map(t=>t.top);e._left=Math.min(...t),e._top=Math.min(...r)}let o=n.map(t=>t.width),a=n.map(t=>t.height),s=Math.max(...o),l=Math.max(...a);e._cellBounds=new Array(t.children.length).fill(null);for(let n=0;n<e.numRows;n++)for(let o=0;o<e.numCols;o++){let a=e._grid[n][o];a>=t.children.length||(e._cellBounds[a]=new Yw(e._left+(s+r)*o+0,e._top+(l+i)*n,s,l))}}}class zT extends pE{constructor(t){super(t)}run(){let t=this.outputVar.element;t.updateValues(),t.scale?this._runForEncoding(t):this._runForLayout(t),$w(t)}_runForLayout(t){let e=t.channel,n=qw(t.elements),r=[];if("x"===e)for(let e=0;e<t.values.length;e++){let i=t.elements[e].refBounds;r.push({x1:i.x,y1:n.bottom,x2:i.x,y2:n.top})}else if("y"===e)for(let e=0;e<t.values.length;e++){let i=t.elements[e].refBounds;r.push({x1:n.left,y1:i.y,x2:n.right,y2:i.y})}t.lines=r,t._dirty=!0}_runForEncoding(t){let e=t.channel,n=qw(t.elements),r=[];if("x"===e){let e,i,o=lA(t.elements[0],"y");o?(e=Math.min(...o.getScale(t.elements[0]).range,n.top),i=Math.max(...o.getScale(t.elements[0]).range,n.bottom)):(e=n.top,i=n.bottom);for(let n of t.values)r.push({x1:t.scale.map(n),y1:i,x2:t.scale.map(n),y2:e})}else if("width"===e)for(let e of t.values)r.push({x1:t.scale.map(e)+n.left,y1:n.bottom,x2:t.scale.map(e)+n.left,y2:n.top});else if("y"===e){let e,i,o=lA(t.elements[0],"x");o?(e=Math.min(...o.getScale(t.elements[0]).range,n.left),i=Math.max(...o.getScale(t.elements[0]).range,n.right)):(e=n.top,i=n.bottom);for(let n of t.values)r.push({x1:e,y1:t.scale.map(n),x2:i,y2:t.scale.map(n)})}else if("height"===e)for(let e of t.values)r.push({x1:n.left,y1:n.bottom-t.scale.map(e),x2:n.right,y2:n.bottom-t.scale.map(e)});else if("radialDistance"===e){let e=t.elements[0].parent;for(let n=0;n<t.values.length;n++)r.push({x:e.x,y:e.y,r:t.scale.map(t.values[n])})}t.lines=r,t._dirty=!0}}class FT extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=lE(t)[0],n=Qw(t.parent);for(let t of n){let n=t.layout;if(!n)return;switch(e.type){case lT.Rect:case lT.Circle:case lT.Image:this._stackRects(t,n);break;case lT.Area:t.children[0].orientation===bE?this._stackAreasVert(t,n):this._stackAreasHorz(t,n);break;case lT.Arc:case lT.Pie:e.parent.classId===t.classId&&this._stackArcs(t,n)}}$w(e)}_stackArcs(t,e){if(e.orientation===xE){let e=90;if((this._direction?this._direction:AE.Clockwise)===AE.Clockwise)for(let n of t.children){let t=VE(e-n.angle);_A(n,"startAngle",t),e=t}else for(let n of t.children){let t=VE(e+n.angle);_A(n,"startAngle",t),e=t}}else if(e.orientation===wE){let e=Math.min(...t.children.map(t=>t.innerRadius));for(let n of t.children){let t=n.outerRadius-n.innerRadius;_A(n,"innerRadius",e),_A(n,"outerRadius",e+t),e=n._outerRadius}}}_stackAreasVert(t,e){let n=t.children.filter(t=>"visible"===t.visibility),r=t.bounds,i=e.vertCellAlignment===Xw.TOP?r.top:r.bottom,o=e.vertCellAlignment===Xw.TOP?1:-1;if(0===n.length)return;e.vertCellAlignment===Xw.BOTTOM&&n.reverse();let a=n[0].vertices.length/2,s=new Array(a).fill(0);for(let t of n){for(let e=0;e<a;e++){let n=t.vertices[e],r=t.vertices[2*a-e-1],l=Math.abs(n.y-r.y),c=i+s[e]*o,u=i+(s[e]+l)*o;pA(n,0,c-n.y),pA(r,0,u-r.y),s[e]+=l}let e=t.bounds.bottom;t._updateBounds(),t._refBounds.translate(0,t.bounds.bottom-e)}if(e.vertCellAlignment===Xw.MIDDLE)for(let t of n){for(let e=0;e<a;e++){let n=t.vertices[e],i=t.vertices[2*a-e-1],o=r.middle+s[e]/2;pA(n,0,o-r.bottom),pA(i,0,o-r.bottom)}let e=t.bounds.bottom;t._updateBounds(),t._refBounds.translate(0,t.bounds.bottom-e)}}_stackAreasHorz(t,e){}_stackRects(t,e){t.scene;let n=e._orientation,r=t.children.map(t=>t.bounds),i=r.map(t=>t.left),o=r.map(t=>t.top),a=r.map(t=>t.width),s=r.map(t=>t.height),l=null==e._left?Math.min(...i):e._left,c=null==e._top?Math.min(...o):e._top,u=Math.max(...a),h=Math.max(...s);if(n==vE)for(let n=0;n<t.children.length;n++){let r=t.children[n],i=0,o=c+r.bounds.height/2-r.bounds.y;c+=r.bounds.height+e._gap,pA(r,i,o),r._updateBounds();let a=0,s=0;if(!fA(r))switch(e._horzCellAlignment){case Xw.LEFT:a=l-r.bounds.left;break;case Xw.CENTER:a=l+u/2-r.bounds.x;break;case Xw.RIGHT:a=l+u-r.bounds.right}pA(r,a,s)}else for(let n=0;n<t.children.length;n++){let r=t.children[n],i=l+r.bounds.width/2-r.bounds.x,o=0;l+=r.bounds.width+e._gap,pA(r,i,o),r._updateBounds();let a=0,s=0;if(!hA(r))switch(e._vertCellAlignment){case Xw.TOP:s=c-r.bounds.top;break;case Xw.MIDDLE:s=c+h/2-r.bounds.y;break;case Xw.BOTTOM:s=c+h-r.bounds.bottom}pA(r,a,s)}}}class GT extends pE{constructor(t){super(t)}run(){super.run()}}class jT extends pE{constructor(t){super(t)}run(){let t=this.inputVars[0],e=this.outputVar,n=t.attribute,r=e.attribute,i=t.dataset,o=e.dataset,a=i.getAttributeValues(n),s=J()(a),l=this._findBin,c=a.map(t=>{let e=l(t,s);return(e.x0+e.x1)/2+""}),u=s.map(t=>(t.x0+t.x1)/2+"");o._addAttribute(r,$E.String,c),o.orderAttributeValues(r,u)}_findBin(t,e){for(let n of e)if(n.indexOf(t)>=0)return n}}class UT extends pE{constructor(t){super(t)}run(){let t=this.outputVar,e=t.dataset,n=t.predicate,r=[];for(let[t,i]of e.data.entries())n.testTuple(i)||r.push(t);r.sort((t,e)=>e-t),r.forEach(t=>{t>=0&&t<e.data.length&&(e._data.splice(t,1),e._rawData.splice(t,1))});for(let t of e._attributes)e._attrSummaries[t]=ZE(e.data.map(e=>e[t]),e._attrTypes[t])}}class YT extends pE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t.type===nA.AFFIXATION).affixation,e=t.base,n=t.element,r=Qw(e),i=Qw(n),o=t.channels,a=t.attribute;if(Zw(n)&&Zw(e)){let t=r.map(t=>t.dataScope.getAttrVal(a));i=i.filter(e=>t.includes(e.dataScope.getAttrVal(a)));let e=(t,e)=>t.dataScope.getAttrVal(a)<e.dataScope.getAttrVal(a)?-1:t.dataScope.getAttrVal(a)>e.dataScope.getAttrVal(a)?1:0;i.sort(e),r.sort(e)}if(o.includes("x")||o.includes("y"))for(let e of o)this._handleXY(e,i,r,t.getElementAnchor(e),t.getBaseAnchor(e),t.getOffset(e));(o.includes("radialDistance")||o.includes("angle"))&&this._handlePolar(i,r,t);let s=lE(n,!0);for(let t of s)$w(t)}_handlePolar(t,e,n){let r=n.hasChannel("radialDistance")?n.getBaseAnchor("radialDistance"):Xw.MIDDLE,i=n.hasChannel("radialDistance")?n.getElementAnchor("radialDistance"):Xw.MIDDLE,o=n.hasChannel("angle")?n.getBaseAnchor("angle"):Xw.CENTER;n.hasChannel("angle")?n.getElementAnchor("angle"):Xw.CENTER;let a=n.hasChannel("radialDistance")?n.getOffset("radialDistance"):0,s=n.hasChannel("angle")?n.getOffset("angle"):0;if([lT.Arc,lT.Ring].indexOf(e[0].type)>=0&&t[0].type==lT.SimpleText)for(let n=0;n<t.length;n++){let i=e[n],s=t[n],l=r===Xw.MIDDLE?(i.outerRadius+i.innerRadius)/2:r===Xw.TOP?i.outerRadius-5:i.innerRadius+5;if(l+=a,i.type===lT.Arc){let t=QE(i.x,i.y,l,i.startAngle),e=QE(i.x,i.y,l,i.endAngle);i.endAngle>=180&&i.endAngle<=360?s._textPath=["M",t[0],t[1],"A",l,l,i.angle,i.angle>=180?1:0,0,e[0],e[1]].join(" "):s._textPath=["M",e[0],e[1],"A",l,l,i.angle,i.angle>=180?1:0,1,t[0],t[1]].join(" ")}else if(i.type===lT.Ring){let t=275,e=265,n=350,r=QE(i.x,i.y,l,t),o=QE(i.x,i.y,l,e);s._textPath=["M",o[0],o[1],"A",l,l,n,1,1,r[0],r[1]].join(" ")}s.textPathOffset=o===Xw.LEFT?"0%":"50%"}else for(let n=0;n<t.length;n++){let l,c,u=e[n],h=t[n];u.type==lT.Arc||u.type==lT.Ring?(c="left"==o?u.endAngle+s:"center"==o?u.startAngle+u.angle/2+s:u.startAngle+s,l="top"==r?u.outerRadius+a:"bottom"==r?u.innerRadius+a:(u.outerRadius+u.innerRadius)/2+a):u.type==lT.Circle&&(c=90,l="top"==r?u.radius+a:"bottom"==r?a:u.radius/2+a),pA(h,u.x-h.x,u.y-l-h.bounds[i]),h._rotate=[90-c,u.x,u.y]}}_handleXY(t,e,n,r,i,o){for(let a=0;a<e.length;a++){let s,l=n[a],c=e[a];if(RE(l)){s=ME(l,[Xw.LEFT,Xw.TOP].includes(i)?0:[Xw.CENTER,Xw.MIDDLE].includes(i)?.5:1)[t]}else s=l.bounds[i]+o;e[0].type===lT.SimpleText?(c.anchor["x"==t?0:1]=r,_A(c,t,s)):"x"==t?pA(c,s-c.bounds[r],0):pA(c,0,s-c.bounds[r])}}}class HT extends eA{constructor(t,e){super(t),this._affx=e}get affixation(){return this._affx}}class qT extends pE{constructor(t){super(t)}run(){let t=this.inputVars[0],e=this.outputVar,n=t.attribute,r=e.attribute,i=t.dataset,o=e.dataset,a=this.args,s="min"in a?a.min:i.getAttributeSummary(n).min,l="max"in a?a.max:i.getAttributeSummary(n).max,c=s,u=[];for(;c<l;)u.push(c),c+=a.interval;u.push(c);let h={},f={};if(a.groupBy)for(let t of i.data){let e=a.groupBy.map(e=>t[e]).join("-");e in h||(h[e]=[],f[e]=a.groupBy.map(e=>t[e])),h[e].push(t[n])}else h[""]=i.data.map(t=>t[n]),f[""]="";let d=[];for(let t in f){let e=WT($T(a.bandwidth),u,h[t]);for(let i of e){let e={};""!==t&&a.groupBy.forEach((n,r)=>e[n]=f[t][r]),e[n]=i[0],e[r]=i[1],d.push(e)}}let p={};if(p[n]=i.getAttributeType(n),p[r]=$E.Number,a.groupBy)for(let t of a.groupBy)p[t]=i.getAttributeType(t);o.initialize(d,o.url,p)}}function WT(t,e,n){return e.map(e=>[e,ct(n,n=>t(e-n))])}function $T(t){return e=>Math.abs(e/=t)<=1?.75*(1-e*e)/t:0}class XT extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){let e=t.layout;if(!e)return;let n=t.children.map(t=>({name:t.id,radius:t.radius,itm:t})),r=n.reduce((t,e)=>t+Math.pow(e.radius,2),0),i=Math.sqrt(r);void 0===e._width&&(e._width=i),void 0===e._height&&(e._height=i);let o=Od({name:"root",children:n}).sum(t=>t.radius?t.radius:0).sort((t,e)=>e.value-t.value);rp().size([e._width,e._height]).radius(t=>t.value)(o);for(let t of o.children){let n=t.data.itm;pA(n,e._x-o.x+t.x-n.x,e._y-o.y+t.y-n.y)}}let n=lE(t,!0);for(let t of n)$w(t)}}class KT extends pE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof TA&&t.property==kA.AXIS_PATH_POSITION).element;t instanceof IT?this._runForEncoding(t):t instanceof LT&&this._runForLayout(t),$w(t._title)}_runForEncoding(t){let e=t.channel,n=qw(t.elements);if("x"==e)t._title.x=(t.scale.range[0]+t.scale.range[1])/2,t._title._y=t.orientation==MT?t.pathPos+t.titleOffset:t.pathPos-t.titleOffset;else if("width"==e)t._title.x=n.left+t.scale.rangeExtent/2,t._title._y=t.orientation==MT?t.pathPos+t.titleOffset:t.pathPos-t.titleOffset;else if("y"===e)t._rotateYTitle?(t._title.x=t.orientation==RT?t.pathPos-t.titleOffset:t.pathPos+t.titleOffset,t._title._y=(t.scale.range[0]+t.scale.range[1])/2,t._title._rotate=t.orientation==RT?[-90,t._title._x,t._title._y]:[90,t._title._x,t._title._y]):(t._title.x=t.orientation==RT?t.pathPos-t.titleOffset:t.pathPos+t.titleOffset,t._title._y=Math.min(t.scale.range[0],t.scale.range[1])-25,t._title._rotate=void 0);else if("height"===e)t._title.x=n.center,t._title._y=(n.top+n.bottom)/2-n.width/2-t.titleOffset,t._title._rotate=t.orientation==RT?[-90,n.center,n.middle]:[90,n.center,n.middle];else if("radialDistance"===e){let e=t.elements[0].parent;t._title.x=e.x+t.scale.rangeExtent/2,t._title._y=t.orientation==MT?t.pathPos+t.titleOffset:t.pathPos-t.titleOffset,t._rotate&&(t._title._rotate=t._rotate.slice())}}_runForLayout(t){let e=t.channel,n=t.elements[0].parent.layout&&t.elements[0].parent.layout.type==fE.STACK?Ww(t.elements):qw(t.elements);if("x"==e)t._title.x=n.center,t._title._y=t.orientation==MT?t.pathPos+t.titleOffset:t.pathPos-t.titleOffset;else if("y"===e)t._title.x=n.center,t._title._y=n.middle-n.width/2-t.titleOffset,t._title._rotate=t.orientation==RT?[-90,n.center,n.middle]:[90,n.center,n.middle];else if("angle"===e){let e=t.elements[0].parent.layout;e.type===fE.CLUSTER&&(t._title.x=e.x,t._title._y=e.y)}}}class ZT extends yT{constructor(t){super(t)}run(){super.run();let t,e=this.vars.find(t=>t.type===nA.ALIGNMENT).alignment,n=e.anchor,r=e.elements;n==Xw.Top||n==Xw.LEFT?t=Math.min(...r.map(t=>t.bounds[n])):n==Xw.BOTTOM||n==Xw.RIGHT?t=Math.max(...r.map(t=>t.bounds[n])):n!=Xw.CENTER&&n!=Xw.MIDDLE||(t=ct(r.map(t=>t.bounds[n])));for(let i of r){let r=dA(i,e.channel);if(r){let o=t-i.bounds[n];pA(r,"x"===e.channel?o:0,"x"===e.channel?0:o)}}for(let t of r)$w(t)}}class JT extends eA{constructor(t,e){super(t),this._aln=e}get alignment(){return this._aln}}class QT extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){let e=t.layout;if(!e)continue;let n=YE(t.children[0]);if(!n)continue;let r=n.linkList.map(t=>({source:n.getNode(t.source),target:n.getNode(t.target)})),i=Ol(n.nodeList).force("charge",Nl().strength(-e._repulsion)).force("link",Sl(r).id(t=>t.id).distance(e._linkDistance)).force("x",Il()).force("y",Ll()).force("center",hl(e._x,e._y).strength(e._attraction));i.stop(),i.tick(e._iterations);for(let e=0;e<t.children.length;e++){let r=t.children[e],i=n.nodeList[e];pA(r,i.x-r.x,i.y-r.y)}}let n=lE(t,!0);for(let t of n)$w(t)}}class tS extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t);switch(t.type){case lT.Arc:this._updateArcLinks(e);break;case lT.BezierCurve:this._updateBezierLinks(e);break;case lT.BundledPath:this._updateBundledLinks(e);break;case lT.Chord:this._updateChordLinks(e);break;case lT.Line:default:this._updateLineLinks(e)}$w(t)}_updateArcLinks(t){for(let e of t){let t=e.source.x<e.target.x?e.source:e.target,n=e.source.x<e.target.x?e.target:e.source;e._x=(t.x+n.x)/2,e._y=(t.y+n.y)/2,e._innerRadius=Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))/2,e._outerRadius=e._innerRadius+e._thickness;let r=DE(t.x,t.y,e._x,e._y),i=DE(n.x,n.y,e._x,e._y);e.direction===AE.CLOCKWISE&&([r,i]=[i,r]),_A(e,"startAngle",r),_A(e,"angle",Math.abs(i-r))}}_updateBezierLinks(t){let e=this._inputVars[0].element,n=Qw(e),r=e.parent.layout;r.type===fE.DIRECTED||r.type===fE.TIDYTREE?this._updateBezierLinksForDirectedGraph(n,t,r):r.type===fE.CLUSTER&&this._updateBezierLinksForClusteredGraph(n,t,r)}_updateBezierLinksForClusteredGraph(t,e,n){const r=n._d3Root.descendants(),i=new Map(r.map(t=>[eS(t),t])),o=new Map(r.map(t=>[t.data[qE],eS(t)]));if(n.isRadial()){const t=nx().angle(t=>t.x).radius(t=>t.y);for(let r of e){let e=r.source,a=r.target,s=e.dataScope.getAttrVal(qE),l=a.dataScope.getAttrVal(qE),c=i.get(o.get(s)),u=i.get(o.get(l));r._d=NE(t({source:c,target:u}),n.x,n.y)}}else if(n.orientation===vE){const t=ex().x(t=>t.x).y(t=>t.y);for(let r of e){let e=r.source,a=r.target,s=e.dataScope.getAttrVal(qE),l=a.dataScope.getAttrVal(qE),c=i.get(o.get(s)),u=i.get(o.get(l));r._d=NE(t({source:c,target:u}),n.left-n._x0,n.top)}}else if(n.orientation===bE){const t=tx().x(t=>t.y).y(t=>t.x);for(let r of e){let e=r.source,a=r.target,s=e.dataScope.getAttrVal(qE),l=a.dataScope.getAttrVal(qE),c=i.get(o.get(s)),u=i.get(o.get(l));r._d=NE(t({source:c,target:u}),n.left,n.top-n._x0)}}}_updateBezierLinksForDirectedGraph(t,e,n){let r={},i={},o={},a={};for(let e of t){i[e.id]=0,r[e.id]=0;let t=e.links.filter(t=>t.source===e),n=e.links.filter(t=>t.target===e);a[e.id]=n.map(t=>t.strokeWidth).reduce((t,e)=>t+e,0),o[e.id]=t.map(t=>t.strokeWidth).reduce((t,e)=>t+e,0)}n.spreadLinks&&("LR"===n.direction||"RL"===n.direction?e.sort((t,e)=>DE(t.target.bounds.x,t.target.bounds.y,t.source.bounds.x,t.source.bounds.y)-DE(e.target.bounds.x,e.target.bounds.y,e.source.bounds.x,e.source.bounds.y)):e.sort((t,e)=>DE(e.target.bounds.x,e.target.bounds.y,e.source.bounds.x,e.source.bounds.y)-DE(t.target.bounds.x,t.target.bounds.y,t.source.bounds.x,t.source.bounds.y)));for(let t of e){let e,s,l,c,u=t.source,h=t.target;n.spreadLinks?"LR"===n.direction||"RL"===n.direction?(e=u.bounds[t.sourceAnchor[0]]+t.sourceOffset[0],l=h.bounds[t.targetAnchor[0]]+t.targetOffset[0],s=u.bounds[t.sourceAnchor[1]]+t.sourceOffset[1]-o[u.id]/2+r[u.id]+t.strokeWidth/2,c=h.bounds[t.targetAnchor[1]]+t.targetOffset[1]-a[h.id]/2+i[h.id]+t.strokeWidth/2,r[u.id]+=t.strokeWidth,i[h.id]+=t.strokeWidth):(s=u.bounds[t.sourceAnchor[1]]+t.sourceOffset[1],c=h.bounds[t.targetAnchor[1]]+t.targetOffset[1],e=u.bounds[t.sourceAnchor[0]]+t.sourceOffset[0]-o[u.id]/2+r[u.id]+t.strokeWidth/2,l=h.bounds[t.targetAnchor[0]]+t.targetOffset[0]-a[h.id]/2+i[h.id]+t.strokeWidth/2,r[u.id]+=t.strokeWidth,i[h.id]+=t.strokeWidth):(e=u.bounds[t.sourceAnchor[0]]+t.sourceOffset[0],s=u.bounds[t.sourceAnchor[1]]+t.sourceOffset[1],l=h.bounds[t.targetAnchor[0]]+t.targetOffset[0],c=h.bounds[t.targetAnchor[1]]+t.targetOffset[1]),t.orientation===bE?t._setVertices([[e,s],[(e+l)/2,s],[e,c],[l,c]]):t.orientation===vE&&t._setVertices([[e,s],[e,(s+c)/2],[l,s],[l,c]])}}_updateBundledLinks(t){let e=this._inputVars[0].element.parent.layout;if(e.type!==fE.CLUSTER)throw"Bundled links must work on a cluster layout";let n=e._d3Root.leaves();const r=new Map(n.map(t=>[eS(t),t])),i=new Map(n.map(t=>[t.data[qE],eS(t)])),o=Uv().curve(Dx.beta(t[0]._strength)).radius(t=>t.y).angle(t=>t.x);for(let n of t){let t=n.source.dataScope.getAttrVal(qE),a=n.target.dataScope.getAttrVal(qE),s=r.get(i.get(t)),l=r.get(i.get(a));(s.outgoing??=[]).push([s,l]),l.incoming??=[];let c=s.path(l);n._d=NE(o(c),e.x,e.y)}}_updateChordLinks(t){for(let e of t){let t=e.source,n=e.target,r=QE(t.x,t.y,t.innerRadius,t.startAngle),i=QE(t.x,t.y,t.innerRadius,t.endAngle),o=QE(n.x,n.y,n.innerRadius,n.startAngle),a=QE(n.x,n.y,n.innerRadius,n.endAngle);e._d=["M",r[0],r[1],"Q",t.x,t.y,a[0],a[1],"A",t.x,t.y,n.angle,n.angle>180?1:0,1,o[0],o[1],"Q",t.x,t.y,i[0],i[1],"A",t.x,t.y,t.angle,t.angle>180?1:0,1,r[0],r[1]].join(" "),e._dirty=!0}}_updateLineLinks(t){for(let e of t){let t=e.source,n=e.target;e.vertices[0]._x=t.bounds.x,e.vertices[0]._y=t.bounds.y,e.vertices[1]._x=n.bounds.x,e.vertices[1]._y=n.bounds.y,e._dirty=!0}}}function eS(t){return`${t.parent?eS(t.parent)+".":""}${t.data[qE]}`}var nS="\0";function rS(t,e){t[e]?t[e]++:t[e]=1}function iS(t,e){--t[e]||delete t[e]}function oS(t,e,n,r){var i=""+e,o=""+n;if(!t&&i>o){var a=i;i=o,o=a}return i+""+o+""+(void 0===r?"\0":r)}function aS(t,e){return oS(t,e.v,e.w,e.name)}var sS=class{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>{};_defaultEdgeLabelFn=()=>{};_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(t){t&&(this._isDirected=!Object.hasOwn(t,"directed")||t.directed,this._isMultigraph=!!Object.hasOwn(t,"multigraph")&&t.multigraph,this._isCompound=!!Object.hasOwn(t,"compound")&&t.compound),this._isCompound&&(this._parent={},this._children={},this._children[nS]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return this._defaultNodeLabelFn=t,"function"!=typeof t&&(this._defaultNodeLabelFn=()=>t),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var t=this;return this.nodes().filter(e=>0===Object.keys(t._in[e]).length)}sinks(){var t=this;return this.nodes().filter(e=>0===Object.keys(t._out[e]).length)}setNodes(t,e){var n=arguments,r=this;return t.forEach(function(t){n.length>1?r.setNode(t,e):r.setNode(t)}),this}setNode(t,e){return Object.hasOwn(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=nS,this._children[t]={},this._children[nS][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return Object.hasOwn(this._nodes,t)}removeNode(t){var e=this;if(Object.hasOwn(this._nodes,t)){var n=t=>e.removeEdge(e._edgeObjs[t]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(function(t){e.setParent(t)}),delete this._children[t]),Object.keys(this._in[t]).forEach(n),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(void 0===e)e=nS;else{for(var n=e+="";void 0!==n;n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var e=this._parent[t];if(e!==nS)return e}}children(t=nS){if(this._isCompound){var e=this._children[t];if(e)return Object.keys(e)}else{if(t===nS)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var e=this._preds[t];if(e)return Object.keys(e)}successors(t){var e=this._sucs[t];if(e)return Object.keys(e)}neighbors(t){var e=this.predecessors(t);if(e){const r=new Set(e);for(var n of this.successors(t))r.add(n);return Array.from(r.values())}}isLeaf(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length}filterNodes(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach(function([n,r]){t(n)&&e.setNode(n,r)}),Object.values(this._edgeObjs).forEach(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,n.edge(t))});var r={};function i(t){var o=n.parent(t);return void 0===o||e.hasNode(o)?(r[t]=o,o):o in r?r[o]:i(o)}return this._isCompound&&e.nodes().forEach(t=>e.setParent(t,i(t))),e}setDefaultEdgeLabel(t){return this._defaultEdgeLabelFn=t,"function"!=typeof t&&(this._defaultEdgeLabelFn=()=>t),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,e){var n=this,r=arguments;return t.reduce(function(t,i){return r.length>1?n.setEdge(t,i,e):n.setEdge(t,i),i}),this}setEdge(){var t,e,n,r,i=!1,o=arguments[0];"object"==typeof o&&null!==o&&"v"in o?(t=o.v,e=o.w,n=o.name,2===arguments.length&&(r=arguments[1],i=!0)):(t=o,e=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],i=!0)),t=""+t,e=""+e,void 0!==n&&(n=""+n);var a=oS(this._isDirected,t,e,n);if(Object.hasOwn(this._edgeLabels,a))return i&&(this._edgeLabels[a]=r),this;if(void 0!==n&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[a]=i?r:this._defaultEdgeLabelFn(t,e,n);var s=function(t,e,n,r){var i=""+e,o=""+n;if(!t&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};r&&(s.name=r);return s}(this._isDirected,t,e,n);return t=s.v,e=s.w,Object.freeze(s),this._edgeObjs[a]=s,rS(this._preds[e],t),rS(this._sucs[t],e),this._in[e][a]=s,this._out[t][a]=s,this._edgeCount++,this}edge(t,e,n){var r=1===arguments.length?aS(this._isDirected,arguments[0]):oS(this._isDirected,t,e,n);return this._edgeLabels[r]}edgeAsObj(){const t=this.edge(...arguments);return"object"!=typeof t?{label:t}:t}hasEdge(t,e,n){var r=1===arguments.length?aS(this._isDirected,arguments[0]):oS(this._isDirected,t,e,n);return Object.hasOwn(this._edgeLabels,r)}removeEdge(t,e,n){var r=1===arguments.length?aS(this._isDirected,arguments[0]):oS(this._isDirected,t,e,n),i=this._edgeObjs[r];return i&&(t=i.v,e=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],iS(this._preds[e],t),iS(this._sucs[t],e),delete this._in[e][r],delete this._out[t][r],this._edgeCount--),this}inEdges(t,e){var n=this._in[t];if(n){var r=Object.values(n);return e?r.filter(t=>t.v===e):r}}outEdges(t,e){var n=this._out[t];if(n){var r=Object.values(n);return e?r.filter(t=>t.w===e):r}}nodeEdges(t,e){var n=this.inEdges(t,e);if(n)return n.concat(this.outEdges(t,e))}},lS={Graph:sS,version:"2.2.4"},cS=sS,uS={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:hS(t),edges:fS(t)};void 0!==t.graph()&&(e.value=structuredClone(t.graph()));return e},read:function(t){var e=new cS(t.options).setGraph(t.value);return t.nodes.forEach(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)}),t.edges.forEach(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)}),e}};function hS(t){return t.nodes().map(function(e){var n=t.node(e),r=t.parent(e),i={v:e};return void 0!==n&&(i.value=n),void 0!==r&&(i.parent=r),i})}function fS(t){return t.edges().map(function(e){var n=t.edge(e),r={v:e.v,w:e.w};return void 0!==e.name&&(r.name=e.name),void 0!==n&&(r.value=n),r})}var dS=function(t){var e,n={},r=[];function i(r){Object.hasOwn(n,r)||(n[r]=!0,e.push(r),t.successors(r).forEach(i),t.predecessors(r).forEach(i))}return t.nodes().forEach(function(t){e=[],i(t),e.length&&r.push(e)}),r};var pS=class{_arr=[];_keyIndices={};size(){return this._arr.length}keys(){return this._arr.map(function(t){return t.key})}has(t){return Object.hasOwn(this._keyIndices,t)}priority(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority}min(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key}add(t,e){var n=this._keyIndices;if(t=String(t),!Object.hasOwn(n,t)){var r=this._arr,i=r.length;return n[t]=i,r.push({key:t,priority:e}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)}_heapify(t){var e=this._arr,n=2*t,r=n+1,i=t;n<e.length&&(i=e[n].priority<e[i].priority?n:i,r<e.length&&(i=e[r].priority<e[i].priority?r:i),i!==t&&(this._swap(t,i),this._heapify(i)))}_decrease(t){for(var e,n=this._arr,r=n[t].priority;0!==t&&!(n[e=t>>1].priority<r);)this._swap(t,e),t=e}_swap(t,e){var n=this._arr,r=this._keyIndices,i=n[t],o=n[e];n[t]=o,n[e]=i,r[o.key]=t,r[i.key]=e}},gS=pS,_S=function(t,e,n,r){return function(t,e,n,r){var i,o,a={},s=new gS,l=function(t){var e=t.v!==i?t.v:t.w,r=a[e],l=n(t),c=o.distance+l;if(l<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+l);c<r.distance&&(r.distance=c,r.predecessor=i,s.decrease(e,c))};t.nodes().forEach(function(t){var n=t===e?0:Number.POSITIVE_INFINITY;a[t]={distance:n},s.add(t,n)});for(;s.size()>0&&(i=s.removeMin(),(o=a[i]).distance!==Number.POSITIVE_INFINITY);)r(i).forEach(l);return a}(t,String(e),n||yS,r||function(e){return t.outEdges(e)})},yS=()=>1;var mS=_S,bS=function(t,e,n){return t.nodes().reduce(function(r,i){return r[i]=mS(t,i,e,n),r},{})};var vS=function(t){var e=0,n=[],r={},i=[];function o(a){var s=r[a]={onStack:!0,lowlink:e,index:e++};if(n.push(a),t.successors(a).forEach(function(t){Object.hasOwn(r,t)?r[t].onStack&&(s.lowlink=Math.min(s.lowlink,r[t].index)):(o(t),s.lowlink=Math.min(s.lowlink,r[t].lowlink))}),s.lowlink===s.index){var l,c=[];do{l=n.pop(),r[l].onStack=!1,c.push(l)}while(a!==l);i.push(c)}}return t.nodes().forEach(function(t){Object.hasOwn(r,t)||o(t)}),i};var xS=vS,wS=function(t){return xS(t).filter(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])})};var ES=function(t,e,n){return function(t,e,n){var r={},i=t.nodes();return i.forEach(function(t){r[t]={},r[t][t]={distance:0},i.forEach(function(e){t!==e&&(r[t][e]={distance:Number.POSITIVE_INFINITY})}),n(t).forEach(function(n){var i=n.v===t?n.w:n.v,o=e(n);r[t][i]={distance:o,predecessor:t}})}),i.forEach(function(t){var e=r[t];i.forEach(function(n){var o=r[n];i.forEach(function(n){var r=o[t],i=e[n],a=o[n],s=r.distance+i.distance;s<a.distance&&(a.distance=s,a.predecessor=i.predecessor)})})}),r}(t,e||AS,n||function(e){return t.outEdges(e)})},AS=()=>1;function TS(t){var e={},n={},r=[];if(t.sinks().forEach(function i(o){if(Object.hasOwn(n,o))throw new SS;Object.hasOwn(e,o)||(n[o]=!0,e[o]=!0,t.predecessors(o).forEach(i),delete n[o],r.push(o))}),Object.keys(e).length!==t.nodeCount())throw new SS;return r}class SS extends Error{constructor(){super(...arguments)}}var CS=TS;TS.CycleException=SS;var kS=CS;var MS=function(t,e,n){Array.isArray(e)||(e=[e]);var r=t.isDirected()?e=>t.successors(e):e=>t.neighbors(e),i="post"===n?RS:OS,o=[],a={};return e.forEach(e=>{if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);i(e,r,a,o)}),o};function RS(t,e,n,r){for(var i=[[t,!1]];i.length>0;){var o=i.pop();o[1]?r.push(o[0]):Object.hasOwn(n,o[0])||(n[o[0]]=!0,i.push([o[0],!0]),NS(e(o[0]),t=>i.push([t,!1])))}}function OS(t,e,n,r){for(var i=[t];i.length>0;){var o=i.pop();Object.hasOwn(n,o)||(n[o]=!0,r.push(o),NS(e(o),t=>i.push(t)))}}function NS(t,e){for(var n=t.length;n--;)e(t[n],n,t);return t}var IS=MS;var LS=MS;var PS=sS,VS=pS,DS=function(t,e){var n,r=new PS,i={},o=new VS;function a(t){var r=t.v===n?t.w:t.v,a=o.priority(r);if(void 0!==a){var s=e(t);s<a&&(i[r]=n,o.decrease(r,s))}}if(0===t.nodeCount())return r;t.nodes().forEach(function(t){o.add(t,Number.POSITIVE_INFINITY),r.setNode(t)}),o.decrease(t.nodes()[0],0);var s=!1;for(;o.size()>0;){if(n=o.removeMin(),Object.hasOwn(i,n))r.setEdge(n,i[n]);else{if(s)throw new Error("Input graph is not connected: "+t);s=!0}t.nodeEdges(n).forEach(a)}return r};var BS={Graph:lS.Graph,json:uS,alg:{components:dS,dijkstra:_S,dijkstraAll:bS,findCycles:wS,floydWarshall:ES,isAcyclic:function(t){try{kS(t)}catch(t){if(t instanceof kS.CycleException)return!1;throw t}return!0},postorder:function(t,e){return IS(t,e,"post")},preorder:function(t,e){return LS(t,e,"pre")},prim:DS,tarjan:vS,topsort:CS},version:lS.version};function zS(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function FS(t,e){if("_next"!==t&&"_prev"!==t)return e}let GS=BS.Graph,jS=class{constructor(){let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,e=t._prev;if(e!==t)return zS(e),e}enqueue(t){let e=this._sentinel;t._prev&&t._next&&zS(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e}toString(){let t=[],e=this._sentinel,n=e._prev;for(;n!==e;)t.push(JSON.stringify(n,FS)),n=n._prev;return"["+t.join(", ")+"]"}};var US=function(t,e){if(t.nodeCount()<=1)return[];let n=function(t,e){let n=new GS,r=0,i=0;t.nodes().forEach(t=>{n.setNode(t,{v:t,in:0,out:0})}),t.edges().forEach(t=>{let o=n.edge(t.v,t.w)||0,a=e(t),s=o+a;n.setEdge(t.v,t.w,s),i=Math.max(i,n.node(t.v).out+=a),r=Math.max(r,n.node(t.w).in+=a)});let o=function(t){const e=[];for(let n=0;n<t;n++)e.push(n);return e}(i+r+3).map(()=>new jS),a=r+1;return n.nodes().forEach(t=>{qS(o,a,n.node(t))}),{graph:n,buckets:o,zeroIdx:a}}(t,e||YS);return function(t,e,n){let r,i=[],o=e[e.length-1],a=e[0];for(;t.nodeCount();){for(;r=a.dequeue();)HS(t,e,n,r);for(;r=o.dequeue();)HS(t,e,n,r);if(t.nodeCount())for(let o=e.length-2;o>0;--o)if(r=e[o].dequeue(),r){i=i.concat(HS(t,e,n,r,!0));break}}return i}(n.graph,n.buckets,n.zeroIdx).flatMap(e=>t.outEdges(e.v,e.w))};let YS=()=>1;function HS(t,e,n,r,i){let o=i?[]:void 0;return t.inEdges(r.v).forEach(r=>{let a=t.edge(r),s=t.node(r.v);i&&o.push({v:r.v,w:r.w}),s.out-=a,qS(e,n,s)}),t.outEdges(r.v).forEach(r=>{let i=t.edge(r),o=r.w,a=t.node(o);a.in-=i,qS(e,n,a)}),t.removeNode(r.v),o}function qS(t,e,n){n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)}let WS=BS.Graph;var $S={addBorderNode:function(t,e,n,r){let i={width:0,height:0};arguments.length>=4&&(i.rank=n,i.order=r);return XS(t,"border",i,e)},addDummyNode:XS,applyWithChunking:ZS,asNonCompoundGraph:function(t){let e=new WS({multigraph:t.isMultigraph()}).setGraph(t.graph());return t.nodes().forEach(n=>{t.children(n).length||e.setNode(n,t.node(n))}),t.edges().forEach(n=>{e.setEdge(n,t.edge(n))}),e},buildLayerMatrix:function(t){let e=eC(JS(t)+1).map(()=>[]);return t.nodes().forEach(n=>{let r=t.node(n),i=r.rank;void 0!==i&&(e[i][r.order]=n)}),e},intersectRect:function(t,e){let n,r,i=t.x,o=t.y,a=e.x-i,s=e.y-o,l=t.width/2,c=t.height/2;if(!a&&!s)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(s)*l>Math.abs(a)*c?(s<0&&(c=-c),n=c*a/s,r=c):(a<0&&(l=-l),n=l,r=l*s/a);return{x:i+n,y:o+r}},mapValues:function(t,e){let n=e;"string"==typeof e&&(n=t=>t[e]);return Object.entries(t).reduce((t,[e,r])=>(t[e]=n(r,e),t),{})},maxRank:JS,normalizeRanks:function(t){let e=t.nodes().map(e=>{let n=t.node(e).rank;return void 0===n?Number.MAX_VALUE:n}),n=ZS(Math.min,e);t.nodes().forEach(e=>{let r=t.node(e);Object.hasOwn(r,"rank")&&(r.rank-=n)})},notime:function(t,e){return e()},partition:function(t,e){let n={lhs:[],rhs:[]};return t.forEach(t=>{e(t)?n.lhs.push(t):n.rhs.push(t)}),n},pick:function(t,e){const n={};for(const r of e)void 0!==t[r]&&(n[r]=t[r]);return n},predecessorWeights:function(t){let e=t.nodes().map(e=>{let n={};return t.inEdges(e).forEach(e=>{n[e.v]=(n[e.v]||0)+t.edge(e).weight}),n});return nC(t.nodes(),e)},range:eC,removeEmptyRanks:function(t){let e=t.nodes().map(e=>t.node(e).rank),n=ZS(Math.min,e),r=[];t.nodes().forEach(e=>{let i=t.node(e).rank-n;r[i]||(r[i]=[]),r[i].push(e)});let i=0,o=t.graph().nodeRankFactor;Array.from(r).forEach((e,n)=>{void 0===e&&n%o!==0?--i:void 0!==e&&i&&e.forEach(e=>t.node(e).rank+=i)})},simplify:function(t){let e=(new WS).setGraph(t.graph());return t.nodes().forEach(n=>e.setNode(n,t.node(n))),t.edges().forEach(n=>{let r=e.edge(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),e},successorWeights:function(t){let e=t.nodes().map(e=>{let n={};return t.outEdges(e).forEach(e=>{n[e.w]=(n[e.w]||0)+t.edge(e).weight}),n});return nC(t.nodes(),e)},time:function(t,e){let n=Date.now();try{return e()}finally{console.log(t+" time: "+(Date.now()-n)+"ms")}},uniqueId:tC,zipObject:nC};function XS(t,e,n,r){for(var i=r;t.hasNode(i);)i=tC(r);return n.dummy=e,t.setNode(i,n),i}const KS=65535;function ZS(t,e){if(e.length>KS){const n=function(t,e=KS){const n=[];for(let r=0;r<t.length;r+=e){const i=t.slice(r,r+e);n.push(i)}return n}(e);return t.apply(null,n.map(e=>t.apply(null,e)))}return t.apply(null,e)}function JS(t){const e=t.nodes().map(e=>{let n=t.node(e).rank;return void 0===n?Number.MIN_VALUE:n});return ZS(Math.max,e)}let QS=0;function tC(t){return t+""+ ++QS}function eC(t,e,n=1){null==e&&(e=t,t=0);let r=t=>t<e;n<0&&(r=t=>e<t);const i=[];for(let e=t;r(e);e+=n)i.push(e);return i}function nC(t,e){return t.reduce((t,n,r)=>(t[n]=e[r],t),{})}let rC=US,iC=$S.uniqueId;var oC={run:function(t){("greedy"===t.graph().acyclicer?rC(t,function(t){return e=>t.edge(e).weight}(t)):function(t){let e=[],n={},r={};function i(o){Object.hasOwn(r,o)||(r[o]=!0,n[o]=!0,t.outEdges(o).forEach(t=>{Object.hasOwn(n,t.w)?e.push(t):i(t.w)}),delete n[o])}return t.nodes().forEach(i),e}(t)).forEach(e=>{let n=t.edge(e);t.removeEdge(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,iC("rev"))})},undo:function(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.reversed){t.removeEdge(e);let r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}})}};let aC=$S;var sC={run:function(t){t.graph().dummyChains=[],t.edges().forEach(e=>function(t,e){let n,r,i,o=e.v,a=t.node(o).rank,s=e.w,l=t.node(s).rank,c=e.name,u=t.edge(e),h=u.labelRank;if(l===a+1)return;for(t.removeEdge(e),i=0,++a;a<l;++i,++a)u.points=[],r={width:0,height:0,edgeLabel:u,edgeObj:e,rank:a},n=aC.addDummyNode(t,"edge",r,"_d"),a===h&&(r.width=u.width,r.height=u.height,r.dummy="edge-label",r.labelpos=u.labelpos),t.setEdge(o,n,{weight:u.weight},c),0===i&&t.graph().dummyChains.push(n),o=n;t.setEdge(o,s,{weight:u.weight},c)}(t,e))},undo:function(t){t.graph().dummyChains.forEach(e=>{let n,r=t.node(e),i=r.edgeLabel;for(t.setEdge(r.edgeObj,i);r.dummy;)n=t.successors(e)[0],t.removeNode(e),i.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height),e=n,r=t.node(e)})}};const{applyWithChunking:lC}=$S;var cC={longestPath:function(t){var e={};t.sources().forEach(function n(r){var i=t.node(r);if(Object.hasOwn(e,r))return i.rank;e[r]=!0;let o=t.outEdges(r).map(e=>null==e?Number.POSITIVE_INFINITY:n(e.w)-t.edge(e).minlen);var a=lC(Math.min,o);return a===Number.POSITIVE_INFINITY&&(a=0),i.rank=a})},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}};var uC=BS.Graph,hC=cC.slack,fC=function(t){var e,n,r=new uC({directed:!1}),i=t.nodes()[0],o=t.nodeCount();r.setNode(i,{});for(;dC(r,t)<o;)e=pC(r,t),n=r.hasNode(e.v)?hC(t,e):-hC(t,e),gC(r,t,n);return r};function dC(t,e){return t.nodes().forEach(function n(r){e.nodeEdges(r).forEach(i=>{var o=i.v,a=r===o?i.w:o;t.hasNode(a)||hC(e,i)||(t.setNode(a,{}),t.setEdge(r,a,{}),n(a))})}),t.nodeCount()}function pC(t,e){return e.edges().reduce((n,r)=>{let i=Number.POSITIVE_INFINITY;return t.hasNode(r.v)!==t.hasNode(r.w)&&(i=hC(e,r)),i<n[0]?[i,r]:n},[Number.POSITIVE_INFINITY,null])[1]}function gC(t,e,n){t.nodes().forEach(t=>e.node(t).rank+=n)}var _C=fC,yC=cC.slack,mC=cC.longestPath,bC=BS.alg.preorder,vC=BS.alg.postorder,xC=$S.simplify,wC=EC;function EC(t){t=xC(t),mC(t);var e,n=_C(t);for(SC(n),AC(n,t);e=kC(n);)RC(n,t,e,MC(n,t,e))}function AC(t,e){var n=vC(t,t.nodes());(n=n.slice(0,n.length-1)).forEach(n=>function(t,e,n){var r=t.node(n),i=r.parent;t.edge(n,i).cutvalue=TC(t,e,n)}(t,e,n))}function TC(t,e,n){var r=t.node(n).parent,i=!0,o=e.edge(n,r),a=0;return o||(i=!1,o=e.edge(r,n)),a=o.weight,e.nodeEdges(n).forEach(o=>{var s=o.v===n,l=s?o.w:o.v;if(l!==r){var c=s===i,u=e.edge(o).weight;if(a+=c?u:-u,function(t,e,n){return t.hasEdge(e,n)}(t,n,l)){var h=t.edge(n,l).cutvalue;a+=c?-h:h}}}),a}function SC(t,e){arguments.length<2&&(e=t.nodes()[0]),CC(t,{},1,e)}function CC(t,e,n,r,i){var o=n,a=t.node(r);return e[r]=!0,t.neighbors(r).forEach(i=>{Object.hasOwn(e,i)||(n=CC(t,e,n,i,r))}),a.low=o,a.lim=n++,i?a.parent=i:delete a.parent,n}function kC(t){return t.edges().find(e=>t.edge(e).cutvalue<0)}function MC(t,e,n){var r=n.v,i=n.w;e.hasEdge(r,i)||(r=n.w,i=n.v);var o=t.node(r),a=t.node(i),s=o,l=!1;o.lim>a.lim&&(s=a,l=!0);var c=e.edges().filter(e=>l===OC(t,t.node(e.v),s)&&l!==OC(t,t.node(e.w),s));return c.reduce((t,n)=>yC(e,n)<yC(e,t)?n:t)}function RC(t,e,n,r){var i=n.v,o=n.w;t.removeEdge(i,o),t.setEdge(r.v,r.w,{}),SC(t),AC(t,e),function(t,e){var n=t.nodes().find(t=>!e.node(t).parent),r=bC(t,n);(r=r.slice(1)).forEach(n=>{var r=t.node(n).parent,i=e.edge(n,r),o=!1;i||(i=e.edge(r,n),o=!0),e.node(n).rank=e.node(r).rank+(o?i.minlen:-i.minlen)})}(t,e)}function OC(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}EC.initLowLimValues=SC,EC.initCutValues=AC,EC.calcCutValue=TC,EC.leaveEdge=kC,EC.enterEdge=MC,EC.exchangeEdges=RC;var NC=cC.longestPath,IC=fC,LC=wC,PC=function(t){var e=t.graph().ranker;if(e instanceof Function)return e(t);switch(t.graph().ranker){case"network-simplex":default:DC(t);break;case"tight-tree":!function(t){NC(t),IC(t)}(t);break;case"longest-path":VC(t);case"none":}};var VC=NC;function DC(t){LC(t)}var BC=function(t){let e=function(t){let e={},n=0;function r(i){let o=n;t.children(i).forEach(r),e[i]={low:o,lim:n++}}return t.children().forEach(r),e}(t);t.graph().dummyChains.forEach(n=>{let r=t.node(n),i=r.edgeObj,o=function(t,e,n,r){let i,o,a=[],s=[],l=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),a.push(i)}while(i&&(e[i].low>l||c>e[i].lim));o=i,i=r;for(;(i=t.parent(i))!==o;)s.push(i);return{path:a.concat(s.reverse()),lca:o}}(t,e,i.v,i.w),a=o.path,s=o.lca,l=0,c=a[l],u=!0;for(;n!==i.w;){if(r=t.node(n),u){for(;(c=a[l])!==s&&t.node(c).maxRank<r.rank;)l++;c===s&&(u=!1)}if(!u){for(;l<a.length-1&&t.node(c=a[l+1]).minRank<=r.rank;)l++;c=a[l]}t.setParent(n,c),n=t.successors(n)[0]}})};let zC=$S;var FC={run:function(t){let e=zC.addDummyNode(t,"root",{},"_root"),n=function(t){var e={};function n(r,i){var o=t.children(r);o&&o.length&&o.forEach(t=>n(t,i+1)),e[r]=i}return t.children().forEach(t=>n(t,1)),e}(t),r=Object.values(n),i=zC.applyWithChunking(Math.max,r)-1,o=2*i+1;t.graph().nestingRoot=e,t.edges().forEach(e=>t.edge(e).minlen*=o);let a=function(t){return t.edges().reduce((e,n)=>e+t.edge(n).weight,0)}(t)+1;t.children().forEach(r=>GC(t,e,o,a,i,n,r)),t.graph().nodeRankFactor=o},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,t.edges().forEach(e=>{t.edge(e).nestingEdge&&t.removeEdge(e)})}};function GC(t,e,n,r,i,o,a){let s=t.children(a);if(!s.length)return void(a!==e&&t.setEdge(e,a,{weight:0,minlen:n}));let l=zC.addBorderNode(t,"_bt"),c=zC.addBorderNode(t,"_bb"),u=t.node(a);t.setParent(l,a),u.borderTop=l,t.setParent(c,a),u.borderBottom=c,s.forEach(s=>{GC(t,e,n,r,i,o,s);let u=t.node(s),h=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,d=u.borderTop?r:2*r,p=h!==f?1:i-o[a]+1;t.setEdge(l,h,{weight:d,minlen:p,nestingEdge:!0}),t.setEdge(f,c,{weight:d,minlen:p,nestingEdge:!0})}),t.parent(a)||t.setEdge(e,l,{weight:0,minlen:i+o[a]})}let jC=$S;var UC=function(t){t.children().forEach(function e(n){let r=t.children(n),i=t.node(n);if(r.length&&r.forEach(e),Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let e=i.minRank,r=i.maxRank+1;e<r;++e)YC(t,"borderLeft","_bl",n,i,e),YC(t,"borderRight","_br",n,i,e)}})};function YC(t,e,n,r,i,o){let a={width:0,height:0,rank:o,borderType:e},s=i[e][o-1],l=jC.addDummyNode(t,"border",a,n);i[e][o]=l,t.setParent(l,r),s&&t.setEdge(s,l,{weight:1})}function HC(t){t.nodes().forEach(e=>qC(t.node(e))),t.edges().forEach(e=>qC(t.edge(e)))}function qC(t){let e=t.width;t.width=t.height,t.height=e}function WC(t){t.y=-t.y}function $C(t){let e=t.x;t.x=t.y,t.y=e}let XC=$S;var KC=function(t){let e={},n=t.nodes().filter(e=>!t.children(e).length),r=n.map(e=>t.node(e).rank),i=XC.applyWithChunking(Math.max,r),o=XC.range(i+1).map(()=>[]);function a(n){if(e[n])return;e[n]=!0;let r=t.node(n);o[r.rank].push(n),t.successors(n).forEach(a)}let s=n.sort((e,n)=>t.node(e).rank-t.node(n).rank);return s.forEach(a),o};let ZC=$S.zipObject;function JC(t,e,n){let r=ZC(n,n.map((t,e)=>e)),i=e.flatMap(e=>t.outEdges(e).map(e=>({pos:r[e.w],weight:t.edge(e).weight})).sort((t,e)=>t.pos-e.pos)),o=1;for(;o<n.length;)o<<=1;let a=2*o-1;o-=1;let s=new Array(a).fill(0),l=0;return i.forEach(t=>{let e=t.pos+o;s[e]+=t.weight;let n=0;for(;e>0;)e%2&&(n+=s[e+1]),e=e-1>>1,s[e]+=t.weight;l+=t.weight*n}),l}let QC=$S;var tk=function(t,e){let n={};return t.forEach((t,e)=>{let r=n[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};void 0!==t.barycenter&&(r.barycenter=t.barycenter,r.weight=t.weight)}),e.edges().forEach(t=>{let e=n[t.v],r=n[t.w];void 0!==e&&void 0!==r&&(r.indegree++,e.out.push(n[t.w]))}),function(t){let e=[];function n(t){return e=>{e.merged||(void 0===e.barycenter||void 0===t.barycenter||e.barycenter>=t.barycenter)&&function(t,e){let n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight);e.weight&&(n+=e.barycenter*e.weight,r+=e.weight);t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}(t,e)}}function r(e){return n=>{n.in.push(e),0===--n.indegree&&t.push(n)}}for(;t.length;){let i=t.pop();e.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return e.filter(t=>!t.merged).map(t=>QC.pick(t,["vs","i","barycenter","weight"]))}(Object.values(n).filter(t=>!t.indegree))};let ek=$S;var nk=function(t,e){let n=ek.partition(t,t=>Object.hasOwn(t,"barycenter")),r=n.lhs,i=n.rhs.sort((t,e)=>e.i-t.i),o=[],a=0,s=0,l=0;r.sort((c=!!e,(t,e)=>t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:c?e.i-t.i:t.i-e.i)),l=rk(o,i,l),r.forEach(t=>{l+=t.vs.length,o.push(t.vs),a+=t.barycenter*t.weight,s+=t.weight,l=rk(o,i,l)});var c;let u={vs:o.flat(!0)};s&&(u.barycenter=a/s,u.weight=s);return u};function rk(t,e,n){let r;for(;e.length&&(r=e[e.length-1]).i<=n;)e.pop(),t.push(r.vs),n++;return n}let ik=function(t,e=[]){return e.map(e=>{let n=t.inEdges(e);if(n.length){let r=n.reduce((e,n)=>{let r=t.edge(n),i=t.node(n.v);return{sum:e.sum+r.weight*i.order,weight:e.weight+r.weight}},{sum:0,weight:0});return{v:e,barycenter:r.sum/r.weight,weight:r.weight}}return{v:e}})},ok=tk,ak=nk;var sk=function t(e,n,r,i){let o=e.children(n),a=e.node(n),s=a?a.borderLeft:void 0,l=a?a.borderRight:void 0,c={};s&&(o=o.filter(t=>t!==s&&t!==l));let u=ik(e,o);u.forEach(n=>{if(e.children(n.v).length){let s=t(e,n.v,r,i);c[n.v]=s,Object.hasOwn(s,"barycenter")&&(a=s,void 0!==(o=n).barycenter?(o.barycenter=(o.barycenter*o.weight+a.barycenter*a.weight)/(o.weight+a.weight),o.weight+=a.weight):(o.barycenter=a.barycenter,o.weight=a.weight))}var o,a});let h=ok(u,r);!function(t,e){t.forEach(t=>{t.vs=t.vs.flatMap(t=>e[t]?e[t].vs:t)})}(h,c);let f=ak(h,i);if(s&&(f.vs=[s,f.vs,l].flat(!0),e.predecessors(s).length)){let t=e.node(e.predecessors(s)[0]),n=e.node(e.predecessors(l)[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+t.order+n.order)/(f.weight+2),f.weight+=2}return f};let lk=BS.Graph,ck=$S;var uk=function(t,e,n,r){r||(r=t.nodes());let i=function(t){var e;for(;t.hasNode(e=ck.uniqueId("_root")););return e}(t),o=new lk({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(e=>t.node(e));return r.forEach(r=>{let a=t.node(r),s=t.parent(r);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(o.setNode(r),o.setParent(r,s||i),t[n](r).forEach(e=>{let n=e.v===r?e.w:e.v,i=o.edge(n,r),a=void 0!==i?i.weight:0;o.setEdge(n,r,{weight:t.edge(e).weight+a})}),Object.hasOwn(a,"minRank")&&o.setNode(r,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))}),o};let hk=KC,fk=function(t,e){let n=0;for(let r=1;r<e.length;++r)n+=JC(t,e[r-1],e[r]);return n},dk=sk,pk=uk,gk=function(t,e,n){let r,i={};n.forEach(n=>{let o,a,s=t.parent(n);for(;s;){if(o=t.parent(s),o?(a=i[o],i[o]=s):(a=r,r=s),a&&a!==s)return void e.setEdge(a,s);s=o}})},_k=BS.Graph,yk=$S;var mk=function t(e,n){if(n&&"function"==typeof n.customOrder)return void n.customOrder(e,t);let r=yk.maxRank(e),i=bk(e,yk.range(1,r+1),"inEdges"),o=bk(e,yk.range(r-1,-1,-1),"outEdges"),a=hk(e);if(xk(e,a),n&&n.disableOptimalOrderHeuristic)return;let s,l=Number.POSITIVE_INFINITY;for(let t=0,n=0;n<4;++t,++n){vk(t%2?i:o,t%4>=2),a=yk.buildLayerMatrix(e);let r=fk(e,a);r<l&&(n=0,s=Object.assign({},a),l=r)}xk(e,s)};function bk(t,e,n){const r=new Map,i=(t,e)=>{r.has(t)||r.set(t,[]),r.get(t).push(e)};for(const e of t.nodes()){const n=t.node(e);if("number"==typeof n.rank&&i(n.rank,e),"number"==typeof n.minRank&&"number"==typeof n.maxRank)for(let t=n.minRank;t<=n.maxRank;t++)t!==n.rank&&i(t,e)}return e.map(function(e){return pk(t,e,n,r.get(e)||[])})}function vk(t,e){let n=new _k;t.forEach(function(t){let r=t.graph().root,i=dk(t,r,n,e);i.vs.forEach((e,n)=>t.node(e).order=n),gk(t,n,i.vs)})}function xk(t,e){Object.values(e).forEach(e=>e.forEach((e,n)=>t.node(e).order=n))}let wk=BS.Graph,Ek=$S;var Ak=function(t){let e,n=Ek.buildLayerMatrix(t),r=Object.assign(function(t,e){let n={};function r(e,r){let i=0,o=0,a=e.length,s=r[r.length-1];return r.forEach((e,l)=>{let c=function(t,e){if(t.node(e).dummy)return t.predecessors(e).find(e=>t.node(e).dummy)}(t,e),u=c?t.node(c).order:a;(c||e===s)&&(r.slice(o,l+1).forEach(e=>{t.predecessors(e).forEach(r=>{let o=t.node(r),a=o.order;!(a<i||u<a)||o.dummy&&t.node(e).dummy||Tk(n,r,e)})}),o=l+1,i=u)}),r}return e.length&&e.reduce(r),n}(t,n),function(t,e){let n={};function r(e,r,i,o,a){let s;Ek.range(r,i).forEach(r=>{s=e[r],t.node(s).dummy&&t.predecessors(s).forEach(e=>{let r=t.node(e);r.dummy&&(r.order<o||r.order>a)&&Tk(n,e,s)})})}function i(e,n){let i,o=-1,a=0;return n.forEach((s,l)=>{if("border"===t.node(s).dummy){let e=t.predecessors(s);e.length&&(i=t.node(e[0]).order,r(n,a,l,o,i),a=l,o=i)}r(n,a,n.length,i,e.length)}),n}return e.length&&e.reduce(i),n}(t,n)),i={};["u","d"].forEach(o=>{e="u"===o?n:Object.values(n).reverse(),["l","r"].forEach(n=>{"r"===n&&(e=e.map(t=>Object.values(t).reverse()));let a=("u"===o?t.predecessors:t.successors).bind(t),s=function(t,e,n,r){let i={},o={},a={};return e.forEach(t=>{t.forEach((t,e)=>{i[t]=t,o[t]=t,a[t]=e})}),e.forEach(t=>{let e=-1;t.forEach(t=>{let s=r(t);if(s.length){s=s.sort((t,e)=>a[t]-a[e]);let r=(s.length-1)/2;for(let l=Math.floor(r),c=Math.ceil(r);l<=c;++l){let r=s[l];o[t]===t&&e<a[r]&&!Sk(n,t,r)&&(o[r]=t,o[t]=i[t]=i[r],e=a[r])}}})}),{root:i,align:o}}(0,e,r,a),l=function(t,e,n,r,i){let o={},a=function(t,e,n,r){let i=new wk,o=t.graph(),a=function(t,e,n){return(r,i,o)=>{let a,s=r.node(i),l=r.node(o),c=0;if(c+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":a=-s.width/2;break;case"r":a=s.width/2}if(a&&(c+=n?a:-a),a=0,c+=(s.dummy?e:t)/2,c+=(l.dummy?e:t)/2,c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":a=l.width/2;break;case"r":a=-l.width/2}return a&&(c+=n?a:-a),a=0,c}}(o.nodesep,o.edgesep,r);return e.forEach(e=>{let r;e.forEach(e=>{let o=n[e];if(i.setNode(o),r){var s=n[r],l=i.edge(s,o);i.setEdge(s,o,Math.max(a(t,e,r),l||0))}r=e})}),i}(t,e,n,i),s=i?"borderLeft":"borderRight";function l(t,e){let n=a.nodes(),r=n.pop(),i={};for(;r;)i[r]?t(r):(i[r]=!0,n.push(r),n=n.concat(e(r))),r=n.pop()}function c(t){o[t]=a.inEdges(t).reduce((t,e)=>Math.max(t,o[e.v]+a.edge(e)),0)}function u(e){let n=a.outEdges(e).reduce((t,e)=>Math.min(t,o[e.w]-a.edge(e)),Number.POSITIVE_INFINITY),r=t.node(e);n!==Number.POSITIVE_INFINITY&&r.borderType!==s&&(o[e]=Math.max(o[e],n))}return l(c,a.predecessors.bind(a)),l(u,a.successors.bind(a)),Object.keys(r).forEach(t=>o[t]=o[n[t]]),o}(t,e,s.root,s.align,"r"===n);"r"===n&&(l=Ek.mapValues(l,t=>-t)),i[o+n]=l})});let o=function(t,e){return Object.values(e).reduce((e,n)=>{let r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(n).forEach(([e,n])=>{let o=function(t,e){return t.node(e).width}(t,e)/2;r=Math.max(n+o,r),i=Math.min(n-o,i)});const o=r-i;return o<e[0]&&(e=[o,n]),e},[Number.POSITIVE_INFINITY,null])[1]}(t,i);return function(t,e){let n=Object.values(e),r=Ek.applyWithChunking(Math.min,n),i=Ek.applyWithChunking(Math.max,n);["u","d"].forEach(n=>{["l","r"].forEach(o=>{let a=n+o,s=t[a];if(s===e)return;let l=Object.values(s),c=r-Ek.applyWithChunking(Math.min,l);"l"!==o&&(c=i-Ek.applyWithChunking(Math.max,l)),c&&(t[a]=Ek.mapValues(s,t=>t+c))})})}(i,o),function(t,e){return Ek.mapValues(t.ul,(n,r)=>{if(e)return t[e.toLowerCase()][r];{let e=Object.values(t).map(t=>t[r]).sort((t,e)=>t-e);return(e[1]+e[2])/2}})}(i,t.graph().align)};function Tk(t,e,n){if(e>n){let t=e;e=n,n=t}let r=t[e];r||(t[e]=r={}),r[n]=!0}function Sk(t,e,n){if(e>n){let t=e;e=n,n=t}return!!t[e]&&Object.hasOwn(t[e],n)}let Ck=$S,kk=Ak;var Mk=function(t){(function(t){let e=Ck.buildLayerMatrix(t),n=t.graph().ranksep,r=0;e.forEach(e=>{const i=e.reduce((e,n)=>{const r=t.node(n).height;return e>r?e:r},0);e.forEach(e=>t.node(e).y=r+i/2),r+=i+n})})(t=Ck.asNonCompoundGraph(t)),Object.entries(kk(t)).forEach(([e,n])=>t.node(e).x=n)};let Rk=oC,Ok=sC,Nk=PC,Ik=$S.normalizeRanks,Lk=BC,Pk=$S.removeEmptyRanks,Vk=FC,Dk=UC,Bk={adjust:function(t){let e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||HC(t)},undo:function(t){let e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){t.nodes().forEach(e=>WC(t.node(e))),t.edges().forEach(e=>{let n=t.edge(e);n.points.forEach(WC),Object.hasOwn(n,"y")&&WC(n)})}(t);"lr"!==e&&"rl"!==e||(!function(t){t.nodes().forEach(e=>$C(t.node(e))),t.edges().forEach(e=>{let n=t.edge(e);n.points.forEach($C),Object.hasOwn(n,"x")&&$C(n)})}(t),HC(t))}},zk=mk,Fk=Mk,Gk=$S,jk=BS.Graph;var Uk=function(t,e){let n=e&&e.debugTiming?Gk.time:Gk.notime;n("layout",()=>{let r=n(" buildLayoutGraph",()=>function(t){let e=new jk({multigraph:!0,compound:!0}),n=Qk(t.graph());return e.setGraph(Object.assign({},Hk,Jk(n,Yk),Gk.pick(n,qk))),t.nodes().forEach(n=>{const r=Jk(Qk(t.node(n)),Wk);Object.keys($k).forEach(t=>{void 0===r[t]&&(r[t]=$k[t])}),e.setNode(n,r),e.setParent(n,t.parent(n))}),t.edges().forEach(n=>{let r=Qk(t.edge(n));e.setEdge(n,Object.assign({},Kk,Jk(r,Xk),Gk.pick(r,Zk)))}),e}(t));n(" runLayout",()=>function(t,e,n){e(" makeSpaceForEdgeLabels",()=>function(t){let e=t.graph();e.ranksep/=2,t.edges().forEach(n=>{let r=t.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)})}(t)),e(" removeSelfEdges",()=>function(t){t.edges().forEach(e=>{if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}(t)),e(" acyclic",()=>Rk.run(t)),e(" nestingGraph.run",()=>Vk.run(t)),e(" rank",()=>Nk(Gk.asNonCompoundGraph(t))),e(" injectEdgeLabelProxies",()=>function(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.width&&n.height){let n=t.node(e.v),r={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e:e};Gk.addDummyNode(t,"edge-proxy",r,"_ep")}})}(t)),e(" removeEmptyRanks",()=>Pk(t)),e(" nestingGraph.cleanup",()=>Vk.cleanup(t)),e(" normalizeRanks",()=>Ik(t)),e(" assignRankMinMax",()=>function(t){let e=0;t.nodes().forEach(n=>{let r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=Math.max(e,r.maxRank))}),t.graph().maxRank=e}(t)),e(" removeEdgeLabelProxies",()=>function(t){t.nodes().forEach(e=>{let n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))})}(t)),e(" normalize.run",()=>Ok.run(t)),e(" parentDummyChains",()=>Lk(t)),e(" addBorderSegments",()=>Dk(t)),e(" order",()=>zk(t,n)),e(" insertSelfEdges",()=>function(t){var e=Gk.buildLayerMatrix(t);e.forEach(e=>{var n=0;e.forEach((e,r)=>{var i=t.node(e);i.order=r+n,(i.selfEdges||[]).forEach(e=>{Gk.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:r+ ++n,e:e.e,label:e.label},"_se")}),delete i.selfEdges})})}(t)),e(" adjustCoordinateSystem",()=>Bk.adjust(t)),e(" position",()=>Fk(t)),e(" positionSelfEdges",()=>function(t){t.nodes().forEach(e=>{var n=t.node(e);if("selfedge"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,o=r.y,a=n.x-i,s=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*a/3,y:o-s},{x:i+5*a/6,y:o-s},{x:i+a,y:o},{x:i+5*a/6,y:o+s},{x:i+2*a/3,y:o+s}],n.label.x=n.x,n.label.y=n.y}})}(t)),e(" removeBorderNodes",()=>function(t){t.nodes().forEach(e=>{if(t.children(e).length){let n=t.node(e),r=t.node(n.borderTop),i=t.node(n.borderBottom),o=t.node(n.borderLeft[n.borderLeft.length-1]),a=t.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-o.x),n.height=Math.abs(i.y-r.y),n.x=o.x+n.width/2,n.y=r.y+n.height/2}}),t.nodes().forEach(e=>{"border"===t.node(e).dummy&&t.removeNode(e)})}(t)),e(" normalize.undo",()=>Ok.undo(t)),e(" fixupEdgeLabelCoords",()=>function(t){t.edges().forEach(e=>{let n=t.edge(e);if(Object.hasOwn(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}})}(t)),e(" undoCoordinateSystem",()=>Bk.undo(t)),e(" translateGraph",()=>function(t){let e=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,i=0,o=t.graph(),a=o.marginx||0,s=o.marginy||0;function l(t){let o=t.x,a=t.y,s=t.width,l=t.height;e=Math.min(e,o-s/2),n=Math.max(n,o+s/2),r=Math.min(r,a-l/2),i=Math.max(i,a+l/2)}t.nodes().forEach(e=>l(t.node(e))),t.edges().forEach(e=>{let n=t.edge(e);Object.hasOwn(n,"x")&&l(n)}),e-=a,r-=s,t.nodes().forEach(n=>{let i=t.node(n);i.x-=e,i.y-=r}),t.edges().forEach(n=>{let i=t.edge(n);i.points.forEach(t=>{t.x-=e,t.y-=r}),Object.hasOwn(i,"x")&&(i.x-=e),Object.hasOwn(i,"y")&&(i.y-=r)}),o.width=n-e+a,o.height=i-r+s}(t)),e(" assignNodeIntersects",()=>function(t){t.edges().forEach(e=>{let n,r,i=t.edge(e),o=t.node(e.v),a=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=a,r=o),i.points.unshift(Gk.intersectRect(o,n)),i.points.push(Gk.intersectRect(a,r))})}(t)),e(" reversePoints",()=>function(t){t.edges().forEach(e=>{let n=t.edge(e);n.reversed&&n.points.reverse()})}(t)),e(" acyclic.undo",()=>Rk.undo(t))}(r,n,e)),n(" updateInputGraph",()=>function(t,e){t.nodes().forEach(n=>{let r=t.node(n),i=e.node(n);r&&(r.x=i.x,r.y=i.y,r.rank=i.rank,e.children(n).length&&(r.width=i.width,r.height=i.height))}),t.edges().forEach(n=>{let r=t.edge(n),i=e.edge(n);r.points=i.points,Object.hasOwn(i,"x")&&(r.x=i.x,r.y=i.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,r))})};let Yk=["nodesep","edgesep","ranksep","marginx","marginy"],Hk={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},qk=["acyclicer","ranker","rankdir","align"],Wk=["width","height","rank"],$k={width:0,height:0},Xk=["minlen","weight","width","height","labeloffset"],Kk={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Zk=["labelpos"];function Jk(t,e){return Gk.mapValues(Gk.pick(t,e),Number)}function Qk(t){var e={};return t&&Object.entries(t).forEach(([t,n])=>{"string"==typeof t&&(t=t.toLowerCase()),e[t]=n}),e}let tM=$S,eM=BS.Graph;var nM={debugOrdering:function(t){let e=tM.buildLayerMatrix(t),n=new eM({compound:!0,multigraph:!0}).setGraph({});return t.nodes().forEach(e=>{n.setNode(e,{label:e}),n.setParent(e,"layer"+t.node(e).rank)}),t.edges().forEach(t=>n.setEdge(t.v,t.w,{},t.name)),e.forEach((t,e)=>{let r="layer"+e;n.setNode(r,{rank:"same"}),t.reduce((t,e)=>(n.setEdge(t,e,{style:"invis"}),e))}),n}};var rM={graphlib:BS,layout:Uk,debug:nM,util:{time:$S.time,notime:$S.notime},version:"1.1.8"};class iM extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){let e=t.layout;if(!e)continue;let r=YE(t.children[0]);if(!r)continue;var n=new rM.graphlib.Graph;n.setGraph({edgesep:e._edgeSep}),n.setDefaultEdgeLabel(function(){return{}}),n.graph().rankdir=this._getDagreDirection(e.direction);let i=new Map;for(let e of t.children){let t=e.dataScope.getAttrVal(qE);i.set(t,t+""),n.setNode(t,{label:e.text?e.text:"",width:e.bounds.width,height:e.bounds.height})}for(let t of r.linkList)n.setEdge(t.source,t.target);rM.layout(n);const o={};let a=Math.min(...n.nodes().map(t=>n.node(t).y)),s=Math.min(...n.nodes().map(t=>n.node(t).x)),l=e.left-s,c=e.top-a;for(const t of n.nodes())o[t]={x:n.node(t).x+l,y:n.node(t).y+c};for(let e of t.children){let t=e.dataScope.getAttrVal(qE);pA(e,o[i.get(t)].x-e.x,o[i.get(t)].y-e.y)}}let r=lE(t,!0);for(let t of r)$w(t)}_getDagreDirection(t){switch(t){case EE.Left2Right:return"LR";case EE.Right2Left:return"RL";case EE.Top2Bottom:return"TB";case EE.Bottom2Top:return"BT"}}}class oM extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){let e=t.layout;if(!e)continue;let n=jE(t.children[0]);if(!n)continue;let r=Od(n._data),i=Math.max(...t.children.map(t=>t.bounds.width)),o=Math.max(...t.children.map(t=>t.bounds.height)),a=e.orientation==bE?[e.height,e.width]:[e.width,e.height],s=wp().nodeSize([i,o]).size(a)(r);this._apply(s,e,t)}$w(t)}_apply(t,e,n){let r,i,o=n.children.filter(e=>e.dataScope.getAttrVal(qE)==t.data[qE])[0];switch(e.orientation){case bE:r=t.y+e.left,i=t.x+e.top;break;case vE:r=t.x+e.left,i=e.top+t.y}if(pA(o,r-o.x,i-o.y),t.children&&t.children.length>0)for(let r of t.children)this._apply(r,e,n)}}class aM extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=this._inputVars.filter(t=>t.type===nA.PROPERTY&&t.property===kA.CHILDREN_ORDER)[0].element,n=e.layout,r=n.width?n.width:e.bounds.width,i=n.height?n.height:e.bounds.height,o=void 0===n.top?e.bounds.top:n.top,a=void 0===n.left?e.bounds.left:n.left,s=Od(e).sum(t=>t.type===lT.Rect?t.width*t.height:0);Cp().size([r,i])(s),this._apply(s,a,o);let l=lE(t,!0);for(let t of l)$w(t)}_apply(t,e,n){if(t.data.type==lT.Collection&&t.children)for(let r of t.children)this._apply(r,e,n);else t.data.type==lT.Rect&&(t.data.resize(t.x1-t.x0,t.y1-t.y0),pA(t.data,t.x0+e-t.data.left,t.y0+n-t.data.top))}}class sM extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){if(!t.layout)continue;if(0===t.children.length)continue;let e=jE(t.children[0]);if(!e)continue;let n={};for(let e of t.children)n[e.dataScope.getAttrVal(qE)]=e;t.children[0].type===lT.Rect?this._layoutRects(e.getRoot(),e,n):this._layoutArcs(e.getRoot(),e,n)}$w(t)}_layoutArcs(t,e,n){let r=e.getChildren(t);if(0===r.length)return;let i=n[t[qE]],o=!i||i.type!=lT.Arc&&i.type!=lT.Pie?60:i.startAngle;for(let t=0;t<r.length;t++){let i=r[t],a=n[i[qE]];if(a.type===lT.Arc){let t=VE(o+a.angle);a.setAngles(o,t),o=t}this._layoutArcs(i,e,n)}}_layoutRects(t,e,n){let r=e.getChildren(t);if(0===r.length)return;let i,o,a=n[t[qE]];this._direction,i=a.left,o=a.bottom;for(let t=0;t<r.length;t++){let a=r[t],s=n[a[qE]];pA(s,i-s.left,o-s.top),i+=s.width,this._layoutRects(a,e,n)}}}class lM extends pE{constructor(t){super(t)}run(){super.run();let t=this.outputVar,e=this.inputVars[0],n=t.conditionalEncoding,r=e.context,i=t.result,o=n.responderComponent;i.clear();let a=Array.isArray(o)?o:[o];if(n.evalFunction)for(let t of a){Qw(t).forEach(t=>i.setValue(t.id,n.evalFunction(r,t)))}}}class cM extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){let e=t.layout;if(!e)continue;let n=360/t.children.length;for(let[r,i]of t.children.entries())pA(i,e.x+e.radius-i.bounds.x,e.y-i.bounds.y),i._rotate=[r*n,e.x,e.y]}let n=lE(t,!0);for(let t of n)$w(t)}}class uM extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let n of e){let e=n.layout;if(!e)continue;let r=Od(e._tree?e._tree._data:jE(n.children[0])._data);if(e.isRadial()){r=Md().size([LE(e.angleExtent),e.radius])(r),e._d3Root=r;const t=new Map(r.descendants().map(t=>[t.data[qE],[t.x,t.y]]));for(let r of n.children){let n=r.dataScope.getAttrVal(qE);pA(r,e.x-r.bounds.x,e.y-t.get(n)[1]-r.bounds.y),r._rotate=[PE(t.get(n)[0]),e.x,e.y]}}else if(e.orientation===vE){!e.width||e.width;let i=e.height?e.height:600;r=Md().nodeSize([t.bounds.width+1,i/(r.height+1)])(r),e._d3Root=r;const o=new Map(r.descendants().map(t=>[t.data[qE],[t.x,t.y]]));let a=1/0,s=-a;r.each(t=>{t.x>s&&(s=t.x),t.x<a&&(a=t.x)}),e._x0=a;for(let t of n.children){let n=t.dataScope.getAttrVal(qE);pA(t,o.get(n)[0]-a+e.left-t.bounds.x,o.get(n)[1]+e.top-t.bounds.y)}}else if(e.orientation===bE){!e.width||e.width;let i=e.height?e.height:600;r=Md().nodeSize([t.bounds.height,i/(r.height+1)])(r),e._d3Root=r;const o=new Map(r.descendants().map(t=>[t.data[qE],[t.x,t.y]]));let a=1/0,s=-a;r.each(t=>{t.x>s&&(s=t.x),t.x<a&&(a=t.x)}),e._x0=a;for(let t of n.children){let n=t.dataScope.getAttrVal(qE);pA(t,o.get(n)[1]+e.left-t.bounds.x,o.get(n)[0]-a+e.top-t.bounds.y)}}}let n=lE(t,!0);for(let t of n)$w(t)}}class hM extends eA{constructor(t,e){super(t),this._cond=e}get context(){return this._cond}}class fM extends pE{constructor(t,e,n){super(t),this._fn=e,this._compnt=n}run(){super.run();let t=this.inputVars.find(t=>t instanceof hM);this.outputVar,this._fn(void 0,t.context,this._compnt)}}class dM extends pE{constructor(t){super(t)}run(){super.run();let t=this.outputVar,e=this.inputVars.find(t=>t instanceof bT),n=t.encodings[0].dataTable.getAttributeType(e.attribute),r={};for(let e of t.encodings){let t=this._computeAttrValues(e,n);Object.assign(r,t)}t.attrValues=r}_computeAttrValues(t,e){let n=Qw(t.element),r={};if(t.element.type===lT.Area&&["width","height","fillGradient"].indexOf(t.channel)>=0)for(let e of n)for(let n of e.vertices)r[n.id]=zE(n).aggregateNumericalAttribute(t.attribute,t.aggregator);else switch(e){case $E.Boolean:break;case $E.Date:for(let e of n)r[e.id]=zE(e).getAttrVal(t.attribute);break;case $E.String:try{if("count"==t.aggregator)for(let e of n)r[e.id]=zE(e).getAttributeValues(t.attribute).length;else for(let e of n)r[e.id]=zE(e).getAttrVal(t.attribute)}catch(e){throw new Error("Cannot bind "+this.channel+" to "+t.attribute+" : "+e)}break;default:if(t.attribute.startsWith("parent.")||t.attribute.startsWith("child.")){let e=t.dataTable.tree.nodeTable,i=t.attribute.split(".")[0],o=t.attribute.split(".")[1];for(let t of n){let n=zE(t).getAttrVal(i);r[t.id]=new BE(e).cross(qE,n).getAttrVal(o)}}else for(let e of n)r[e.id]=zE(e).aggregateNumericalAttribute(t.attribute,t.aggregator)}if(t.transform)for(let e of n)r[e.id]=t.transform(r[e.id],e);return t.attrValues=r,r}}class pM extends eA{constructor(t,e,n){super(t),this._dataset=n,this._predicate=e}get dataset(){return this._dataset}get predicate(){return this._predicate}}class gM{constructor(){this._variables={},this._operators={},this._edges=[]}toJSON(){const t=this._edges.map(t=>({from:t.fromNode.id,to:t.toNode.id,isDirected:t.isDirected})),e={};for(const t in this._variables)e[t]=Object.values(this._variables[t]).map(t=>{let e={id:t.id,type:t.type,incoming:t.incomingEdges.map(t=>t.id),outgoing:t.outgoingEdges.map(t=>t.id),undirected:t.undirectedEdges.map(t=>t.id)};return"ChannelVar"===t.type?(e.channel=t.channel,e.element=t.element):"BoundsVar"===t.type||"DataScopeVar"===t.type?e.element=t.element:"dataValue"===t.type?(e.scale=t.scale,e.attrValues=t.attrValues):"FieldVar"===t.type?(e.field=t.field,e.dataset=t.dataset):"PropertyVar"===t.type?(e.property=t.property,e.element=t.element):e.scale=t.scale,e});const n={};for(const t in this._operators)n[t]=Object.values(this._operators[t]).map(t=>{let e={id:t.id,type:t.type,inputVars:t.inputVars.map(t=>t.id),outputVar:t.outputVar?t.outputVar.id:null};return t.type===gE.DOMAIN_BUILDER?e.aggregator=t.aggregator:t.type===gE.SCALE_BUILDER&&(e.channel=t.channel),e});return{edges:t,variables:e,operators:n}}getVariable(t,...e){if(Object.values(nA).indexOf(t)<0)throw console.log(t),new Error("Variable Type Not Known");let n=this.findVariable(t,e);if(n)return n;switch(t){case nA.CHANNEL:n=new rA(t,e[0],e[1]),"vertex"!=e[1].type&&"segment"!=e[1].type||this._connectPathElement2Size(e[1],n);break;case nA.PROPERTY:n=new TA(t,e[0],e[1]);break;case nA.ATTRIBUTE:n=new bT(t,e[0],e[1]);break;case nA.ITEMS:n=new pM(t,e[0],e[1]);break;case nA.ATTR_VALUE:n=new AT(t,e[0]);break;case nA.DATASCOPE:n=new _T(t,e[0]);break;case nA.BOUNDS:n=new gT(t,e[0]);break;case nA.SCALE:n=new wA(t,e[0]);break;case nA.AFFIXATION:n=new HT(t,e[0]);break;case nA.ALIGNMENT:n=new JT(t,e[0]);break;case nA.EVT_CTX:n=new hM(t,e[0],e[1]);break;case nA.CONDITION_RESULT:n=new EA(t,e[0],e[1])}return t in this._variables||(this._variables[t]={}),this._variables[t][n.id]=n,n}_connectPathElement2Size(t,e){let n=t.parent,r=e.channel,i=this.findVariable(nA.CHANNEL,["x"===r?"width":"height",n]);if(i){let t=i.incomingDataflow;t||(t=this.createOneWayDependency(gE.CONDUIT)),this.connect(e,t),this.connect(t,i)}}findIncomingDataflowOperator(t,e){return e.incomingDataflow&&e.incomingDataflow.type===t?e.incomingDataflow:void 0}getIncomingDataflowOperator(t,e){let n=this.findIncomingDataflowOperator(t,e);return n||this.createOneWayDependency(t)}getOutgoingDataflowOperator(t,e){for(let n of e.outgoingEdges)if(n.toNode instanceof pE&&n.toNode.type===t)return n.toNode;return this.createOneWayDependency(t)}createOneWayDependency(t,...e){if(Object.values(gE).indexOf(t)<0)throw new Error("Dependency Type Not Known");let n;switch(t){case gE.EVAL_BBOX:n=new ST(t);break;case gE.AFFIXER:n=new YT(t);break;case gE.DATA_EXTRACTOR:n=new dM(t,e[0]);break;case gE.SCALE_BUILDER:n=new TT(t,e[0]);break;case gE.ENCODER:n=new AA(t,e[0]);break;case gE.AXIS_PATH_PLACER:n=new PT(t);break;case gE.AXIS_TICKS_PLACER:n=new VT(t);break;case gE.AXIS_LABELS_PLACER:n=new DT(t);break;case gE.AXIS_TITLE_PLACER:n=new KT(t);break;case gE.LINK_PLACER:n=new tS(t);break;case gE.GRID_LAYOUT:n=new BT(t);break;case gE.STACK_LAYOUT:n=new FT(t);break;case gE.PACK_LAYOUT:n=new XT(t);break;case gE.FORCE_LAYOUT:n=new QT(t);break;case gE.DIRECTED_LAYOUT:n=new iM(t);break;case gE.TIDY_TREE_LAYOUT:n=new oM(t);break;case gE.TREEMAP_LAYOUT:n=new aM(t);break;case gE.STRATA_LAYOUT:n=new sM(t);break;case gE.CIRCULAR_LAYOUT:n=new cM(t);break;case gE.CLUSTER_LAYOUT:n=new uM(t);break;case gE.GRIDLINES_PLACER:n=new zT(t);break;case gE.BIN_TRANSFORMER:n=new jT(t);break;case gE.FILTER_TRANSFORMER:n=new UT(t);break;case gE.KDE_TRANSFORMER:n=new qT(t);break;case gE.TARGET_EVALUATOR:n=new lM(t);break;case gE.TARGET_UPDATER:n=new fM(t,e[0],e[1]);break;case gE.CONDUIT:default:n=new GT(t)}return t in this._operators||(this._operators[t]={}),this._operators[t][n.id]=n,n}createMultiWayDependency(t){if(Object.values(gE).indexOf(t)<0)throw new Error("Dependency Type Not Known");let e;return gE.ALIGNER,e=new ZT(t),t in this._operators||(this._operators[t]={}),this._operators[t][e.id]=e,e}connect(t,e,n=!0){if(t instanceof eA&&e instanceof pE){if(!e.inputVars.includes(t)){const r=new mT(t,e,n);this._edges.push(r),t.outgoingEdges.push(r),e.inputVars.push(t)}}else if(t instanceof pE&&e instanceof eA){if(!t.outputVars.includes(e)){const r=new mT(t,e,n);this._edges.push(r),t.outputVars.push(e),e.incomingEdges.push(r)}}else if(t instanceof eA&&e instanceof yT){if(!e.vars.includes(t)){const n=new mT(t,e,!1);this._edges.push(n),e.vars.push(t),e.edges.push(t),t.undirectedEdges.push(n)}}else{if(!(t instanceof yT&&e instanceof eA))throw new Error("An edge must connect a variable and an operator.");if(!t.vars.includes(e)){const n=new mT(e,t,!1);this._edges.push(n),t.vars.push(e),t.edges.push(e),e.undirectedEdges.push(n)}}}disconnectChannelVarFromBBoxOperator(t){let e=this.getOutgoingDataflowOperator(gE.EVAL_BBOX,t),n=t.outgoingEdges.find(n=>n.fromNode===t&&n.toNode===e);n&&this.disconnect(t,e,n)}disconnect(t,e,n){if(t instanceof eA&&e instanceof pE){let r=t.outgoingEdges.findIndex(t=>t===n);r>=0&&(this._edges.splice(this._edges.indexOf(n),1),t.outgoingEdges.splice(r,1));let i=e.inputVars.findIndex(e=>e==t);i>=0&&e.inputVars.splice(i,1)}else if(t instanceof pE&&e instanceof eA){let r=e.incomingEdges.findIndex(t=>t===n);r>=0&&(this._edges.splice(this._edges.indexOf(n),1),e.incomingEdges.splice(r,1));let i=t.outputVars.findIndex(t=>t===e);i>=0&&t.outputVars.splice(i,1)}}deleteVariable(t){for(let e=t.incomingEdges.length-1;e>=0;e--){let n=t.incomingEdges[e],r=n.fromNode;this.disconnect(r,t,n),r.isIsolated()&&delete this._operators[r.type][r.id]}for(let e=t.outgoingEdges.length-1;e>=0;e--){let n=t.outgoingEdges[e],r=n.toNode;this.disconnect(t,r,n),r.isIsolated()&&delete this._operators[r.type][r.id]}delete this._variables[t.type][t.id]}deleteOperator(t){for(let e=t.outputVars.length-1;e>=0;e--){let n=t.outputVars[e],r=n.incomingEdges.find(e=>e.fromNode===t&&e.toNode===n);this.disconnect(t,n,r),n.isIsolated()&&delete this._variables[n.type][n.id]}for(let e=t.inputVars.length-1;e>=0;e--){let n=t.inputVars[e],r=n.outgoingEdges.find(e=>e.fromNode===n&&e.toNode===t);this.disconnect(n,t,r),n.isIsolated()&&delete this._variables[n.type][n.id]}delete this._operators[t.type][t.id]}addInteraction(t){}_dfs(t,e,n){if(t&&0!==t.outgoingEdges.length)for(let r of t.outgoingEdges)r.isDirected&&(e.push(r.toNode),this._dfs(r.toNode.outputVars[0],e.slice(),n));else n.push(e)}processChange(t,e,...n){let r=this.findVariable(t,n);if(r){for(let t of r.outgoingEdges)if(t.isDirected){let n=t.toNode;n.run();let r=n.outputVars;if(r.length>0){let t=r[0];switch(t.type){case nA.ITEMS:this.processChange(t.type,e,t.predicate,t.dataset);break;case nA.ATTRIBUTE:this.processChange(t.type,e,t.attribute,t.dataset);break;case nA.BOUNDS:this.processChange(t.type,e,t.element);break;case nA.CHANNEL:this.processChange(t.type,e,t.channel,t.element);break;case nA.PROPERTY:this.processChange(t.type,e,t.property,t.element);break;case nA.SCALE:case nA.ATTR_VALUE:this.processChange(t.type,e,t.encodings[0]);break;case nA.CONDITION_RESULT:this.processChange(t.type,e,t.result)}}}for(let t of r.undirectedEdges)e.push(t.operator)}else console.warn("Unable to find variables matching the described change: ",t,n)}findVariable(t,e){if(!(t in this._variables))return null;let n=Object.values(this._variables[t]);switch(t){case nA.CHANNEL:return n.find(t=>t.channel==e[0]&&cA(t.element)==cA(e[1]));case nA.PROPERTY:return n.find(t=>t.property==e[0]&&t.element==e[1]);case nA.AFFIXATION:return n.find(t=>t.affixation==e[0]);case nA.ATTRIBUTE:return n.find(t=>t.attribute==e[0]&&t.dataset==e[1]);case nA.ITEMS:return n.find(t=>t.dataset==e[1]);case nA.ATTR_VALUE:case nA.SCALE:return n.find(t=>t.encodings.includes(e[0]));case nA.EVT_CTX:return n.find(t=>t.context===e[0]);case nA.CONDITION_RESULT:return n.find(t=>t.result==e[0]);case nA.DATASCOPE:default:return e[0].classId?n.find(t=>cA(t.element)==cA(e[0])):n.find(t=>t.element.id==e[0].id)}}findVariablesByElement(t){let e={};for(let n in this._variables){let r=Object.values(this._variables[n]).filter(e=>e.element&&cA(e.element)==cA(t));r.length>0&&(e[n]=r)}return e}}function _M(t){return!(!Zw(t)&&t.type!=lT.Glyph||t.dataScope)||t.type===lT.Collection&&t.firstChild.dataScope.numTuples>1}function yM(t,e,n,r){let i=r.getAttributeType(n);if(i!=$E.String&&i!=$E.Date&&i!=$E.Integer)throw new Error("Repeat only works on a string or date attribute: "+n+" is "+i);if(!function(t){if(Array.isArray(t)){if(1===t.length)return _M(t[0]);for(let e of t)if(!Zw(e)||e.dataScope)return!1;return!0}return _M(t)}(e))throw new Error("The "+e.type+" is not repeatable");return function(t,e,n,r){let i=r.getAttributeSummary(n).unique.map(t=>e.dataScope?e.dataScope.cross(n,t):new BE(r).cross(n,t));i=i.filter(t=>!t.isEmpty());let o=iT(t);o.dataScope=e.dataScope?e.dataScope.clone():new BE(r),o.addChild(e),e._refBounds||(e._refBounds=e.bounds.clone());for(let t=1;t<i.length;t++){let t=aT(e);o.addChild(t)}return o.children.forEach((t,e)=>t.dataScope=i[e]),o}(t,e,n,r)}class mM{constructor(t,e,n,r,i){this._id="encoding_"+uT(),this._elem=t,this._channel=e,this._attribute=n,this._table=i.table,this._aggregator=r,this._includeZero=i.includeZero,this._flipScale=i.flipScale,this._mapping=i.mapping,this._preferredRangeExtent=i.rangeExtent,this._preferredRangeStart=i.rangeStart,this._preferredDomain=i.domain,this._scaleType=i.scaleType,this._colorScheme=i.scheme,this._forLegend=i.forLegend,this._transform=i.transform,i.shareScale&&(this._baseEnc=i.shareScale),this._scales=[],this._elemGroups=[],this._elem2scale={},this._refElements=[],["width","height","radius","angle","thickness","radialDistance","strokeWidth","area"].indexOf(this._channel)>=0&&(this._includeZero=!0),this.initialize()}get id(){return this._id}initialize(){this._scales=[];let t=Qw(this._elem);if(this._elemGroups=[],"x"===this._channel||"y"===this._channel){let e=this._elem,n=sE(e);if(n.layout&&n.layout.type==fE.GRID){let t="x"===this._channel?n.layout.getElementsByCol(!0,e):n.layout.getElementsByRow(!0,e);for(let e of t)this._createScaleForElems(e)}else if("vertex"===this._elem.type&&(fA(this._elem.parent)||hA(this._elem.parent))){let t=Qw(this._elem.parent).map(t=>tE(this._elem,[t]));for(let e of t)this._createScaleForElems(e)}else this._createScaleForElems(t)}else if("angle"===this._channel){let e=t.reduce((t,e)=>{const n=e.parent.id;return t[n]||(t[n]=[]),t[n].push(e),t},{}),n=Object.values(e);for(let t of n)this._createScaleForElems(t)}else this._createScaleForElems(t)}_createScaleForElems(t){this._elemGroups.push(t);var e=function(t){if(t.scaleType)return new vT(t.scaleType);if("text"===t.channel)return new vT("ordinal");switch(t.dataTable.getAttributeType(t.attribute)){case $E.Boolean:break;case $E.Date:return new vT("time");case $E.String:if("count"==t.aggregator)return new vT("linear");if(t.channel.indexOf("Color")>=0){let e={};return e.scheme=t.colorScheme?t.colorScheme:"schemeCategory10",new vT("ordinalColor",e)}return"src"===t.channel?new vT("ordinal"):new vT("point");default:return["strokeColor","fillColor","fillGradient"].indexOf(t.channel)>=0?t.mapping?new vT("linear"):new vT("sequentialColor",{scheme:t.colorScheme}):new vT("linear")}}(this);this._scales.push(e);for(let n of t)this._elem2scale[n.id]=e}getScale(t){return this._elem2scale[t.id]}getAttrValue(t,e,n){let r=this.getScale(e).invert(t,n),i=this._attribute;if(this.dataTable.getAttributeType(i)===$E.Date){let t=Qw(e).map(t=>t.dataScope.getAttrVal(i));return t.sort((t,e)=>t-e),t[s(t,r)]}return r}getChannelValue(t,e){return this.getScale(e).map(t)}getElements(t){let e=this._scales.indexOf(t);return this._elemGroups[e]}get element(){return this._elem}get channel(){return this._channel}get attribute(){return this._attribute}get dataTable(){return this._table}get aggregator(){return this._aggregator}hasMultipleScales(){return this._scales.length>0}get scales(){return this._scales}getRangeStart(t){let e=this.getScale(t);return Math.min(...e.range)}getRangeExtent(t){return this.getScale(t).rangeExtent}get domain(){if(1===this._scales.length)return this._scales[0].domain;throw new Error("AttributeEncoding: multiple scales exist, specify element to get domain.")}get rangeExtent(){if(1===this._scales.length)return this._scales[0].rangeExtent;throw new Error("AttributeEncoding: multiple scales exist, specify element to get rangeExtent.")}get scaleType(){return this._scaleType}set scaleType(t){this._scaleType=t}getDomain(t){return this.getScale(t).domain}set domain(t){this._preferredDomain=t;for(let e of this._scales)e._scale.domain(t);for(let t of this._refElements)t instanceof IT&&t.createTicksLabels({});this._elem.scene.onChange(nA.ATTR_VALUE,this)}set rangeExtent(t){for(let e of this._scales)e.rangeExtent=t;for(let t of this._refElements)t instanceof IT&&t.createTicksLabels({});this._elem.scene.onChange(nA.PROPERTY,kA.RANGE_EXTENT,this)}get transform(){return this._transform}set transform(t){this._transform=t,this._elem.scene.onChange(nA.PROPERTY,kA.TRANSFORM,this)}set includeZero(t){this._includeZero=t;for(let t of this._refElements)t instanceof IT&&t.createTicksLabels({});this._elem.scene.onChange(nA.PROPERTY,kA.INCLUDE_ZERO,this)}get includeZero(){return this._includeZero}set flipScale(t){this._flipScale=t,this._elem.scene.onChange(nA.PROPERTY,kA.FLIP_SCALE,this)}get flipScale(){return this._flipScale}set mapping(t){this._mapping=t}get mapping(){return this._mapping}set colorScheme(t){this._colorScheme=t}get colorScheme(){return this._colorScheme}addRefElement(t){this._refElements.indexOf(t)<0&&this._refElements.push(t)}get refElements(){return this._refElements}clearRefElements(){this._refElements=[]}pan(t,e,n){let r=n||this._elem;r.scene.createMask(r);let i=this.getDomain(r),o=Math.min(...i),a=Math.max(...i),s="log"!==this._scales[0].type,l=this.getAttrValue(t,r,s)-this.getAttrValue(t+e,r,s);(s||o+l>0)&&(this.domain=[o+l,a+l])}zoom(t,e,n,r){let i=r||this._elem;i.scene.createMask(i);let o=this.getDomain(i),a=Math.min(...o),s=Math.max(...o),l="log"!==this._scales[0].type,c=this.getAttrValue(e,i,l),u=a-(c-a)*t*n,h=s+(s-c)*t*n;u!==h&&(!l&&u<=0||(this.domain=[u,h]))}}class bM{constructor(){this._vals={},this._vals.elements=[]}set(t,e){this._vals[t]=e}get(t){return this._vals[t]}clear(){this._vals={},this._vals.elements=[]}}class vM{constructor(t,e,n,r){this._respCompnt=e,this._responderEval=n,this._efxFn=r,this._evtCtx=t,this._evalResult=new ET}get responderComponent(){return this._respCompnt}get eventContext(){return this._evtCtx}get evalResult(){return this._evalResult}get evalFunction(){return this._responderEval}get stylingFunction(){return this._efxFn}}class xM extends kE{constructor(t,e,n,r,i){super(i),this._type=lT.Gridlines,this._id=this._type+uT(),this._attribute=e,this._channel=t,this._scale=n,this._elems=r,this._args=i,"strokeColor"in i||(this.styles.strokeColor="#ddd"),"opacity"in i||(this.styles.opacity=.5),this.updateValues(),this._lines=[]}updateValues(){"values"in this._args?this._values=this._args.values:this._scale?this._values=OT(this._scale,this._channel,this._elems):this._values=this._elems.map(t=>t.dataScope.getAttrVal(this._attribute))}get type(){return this._type}get id(){return this._id}getSVGPathData(){let t="";if("radialDistance"===this._channel)for(let e of this._lines)t+="M "+e.x+" "+e.y+" m -"+e.r+" 0 a "+e.r+" "+e.r+" 0 1 0 "+2*e.r+" 0 a "+e.r+" "+e.r+" 0 1 0 -"+2*e.r+" 0 ";else for(let e of this._lines)t+=["M",e.x1,e.y1].join(" ")+[" L",e.x2,e.y2].join(" ")+" ";return t}_updateBounds(){if("radialDistance"===this._channel){let t=this._lines.map(t=>new Yw(t.x-t.r,t.y-t.y,2*t.r,2*t.r));this._bounds=Hw(t)}else{let t=this._lines.map(t=>t.x1).concat(this._lines.map(t=>t.x2)),e=this._lines.map(t=>t.y1).concat(this._lines.map(t=>t.y2)),n=Math.min(...t),r=Math.max(...t),i=Math.min(...e),o=Math.max(...e);this._bounds=new Yw(n,i,r-n,o-i)}}get elements(){return this._elems}get values(){return this._values}get channel(){return this._channel}get attribute(){return this._attribute}get scale(){return this._scale}get lines(){return this._lines}set lines(t){this._lines=t}}class wM extends hE{constructor(t){super(),this.type=fE.STACK,this._orientation=t.orientation,this._direction=t.direction,this._left=t.left,this._top=t.top,this._horzCellAlignment="horzCellAlignment"in t&&t.horzCellAlignment?t.horzCellAlignment:Xw.LEFT,this._vertCellAlignment="vertCellAlignment"in t&&t.vertCellAlignment?t.vertCellAlignment:Xw.BOTTOM,this._gap="gap"in t?t.gap:0}clone(){let t=new wM({orientation:this._orientation,direction:this._direction,left:this._left,top:this._top});return t._horzCellAlignment=this._horzCellAlignment,t._vertCellAlignment=this._vertCellAlignment,t}get horzCellAlignment(){return this._horzCellAlignment}get vertCellAlignment(){return this._vertCellAlignment}get orientation(){return this._orientation}set horzCellAlignment(t){this._horzCellAlignment=t}set vertCellAlignment(t){this._vertCellAlignment=t}set orientation(t){this._orientation=t}}function EM(t,e,n,r,i){let o=i.getAttributeType(n);if(o!=$E.String&&o!=$E.Date&&o!=$E.Integer)throw new Error("Divide only works on a string or date attribute: "+n+" is "+o);if(!AM(e))throw new Error("The "+e.type+" is not dividable");switch(e.type){case lT.Line:case lT.Path:return;case lT.Circle:return function(t,e,n,r,i){let o,a,s,l=Qw(e),c=n||xE;if(c!=xE&&c!=wE)throw new Error("Unknown orientation: "+c);c===xE&&l.forEach(n=>{let l=n.dataScope?n.dataScope:new BE(i),c=i.getUniqueAttributeValues(r).map(t=>l.cross(r,t));c=c.filter(t=>!t.isEmpty());let u=iT(t);null==a&&(a=u.id),u._classId=a,u.dataScope=n.dataScope?n.dataScope:new BE(i);let h=n.parent;h.removeChild(n),delete t._itemMap[n.id];let f=360/c.length,d=90;for(let t=0;t<c.length;t++){let r=rT({type:"arc",innerRadius:0,outerRadius:n.radius,x:n.x,y:n.y,startAngle:VE(d-f*(t+1)),endAngle:VE(d-f*t),strokeColor:n.strokeColor,fillColor:n.fillColor,strokeWidth:n.strokeWidth,opacity:n.opacity});s||(s=r.id),r.classId=s,r.dataScope=c[t],r._updateBounds(),r._refBounds=r.bounds.clone(),u.addChild(r),u._layout=new wM({orientation:xE,direction:AE.CLOCKWISE}),u._layout.group=u,h.removeChild(n),h.addChild(u),n===e&&(o=u)}});return{newMark:o.children[0],collection:o}}(t,e,r,n,i);case lT.Rect:return function(t,e,n,r,i){let o,a=Qw(e),s=n||bE;if(s!=bE&&s!=vE)throw new Error("Unknown orientation: "+s);let l=i.getUniqueAttributeValues(r).map(t=>new BE(i).cross(r,t)),c={},u=0;for(let t of a){let e=l;t.dataScope&&(e=l.map(e=>e.merge(t.dataScope)),e=e.filter(t=>!t.isEmpty())),e.length>u&&(u=e.length),c[t.id]=e}let h,f=rT({type:"rect",left:e.bounds.left,top:e.bounds.top,width:e.bounds.width,height:e.bounds.height,strokeColor:e.strokeColor,fillColor:e.fillColor,strokeWidth:e.strokeWidth,opacity:e.opacity});f._classId=f.id;for(let n of a){let r=iT(t);null==h&&(h=r.id),r._classId=h,r.dataScope=n.dataScope?n.dataScope:new BE(i);let a=n.parent;a.removeChild(n),delete t._itemMap[n.id];let l=c[n.id],u=n.bounds,d=u.left,p=u.top,g=s==bE?u.width/l.length:u.width,_=s==bE?u.height:u.height/l.length;for(let t=0;t<l.length;t++){let e=aT(f);e.dataScope=l[t],e.resize(g,_),e._updateBounds(),e._refBounds=e.bounds.clone(),r.addChild(e)}a.addChild(r),r._layout=new wM({orientation:s,left:d,top:p}),r._layout.group=r,n==e&&(o=r)}return{newMark:o.children[0],collection:o}}(t,e,r,n,i);case lT.Area:return function(t,e,n,r,i){let o,a=Qw(e),s=n||bE;if(s!=bE&&s!=vE)throw new Error("Unknown orientation: "+s);let l,c=i.getUniqueAttributeValues(r).map(t=>new BE(i).cross(r,t)),u={},h=0;for(let t of a){let e=c;t.dataScope&&(e=c.map(e=>e.merge(t.dataScope)),e=e.filter(t=>!t.isEmpty())),e.length>h&&(h=e.length),u[t.id]=e}let f=Object.assign({},e.styles);f.vertices=e.vertices.map(t=>[t.x,t.y]),f.type="area",f.orientation=e.orientation,f.baseline=e.baseline;let d=rT(f);if(d._classId=d.id,e.vertices)for(let t=0;t<e.vertices.length;t++)e.vertices[t].dataScope&&(d.vertices[t]._dataScope=e.vertices[t].dataScope.clone());for(let n of a){let r=iT(t);null==l&&(l=r.id),r._classId=l,r.dataScope=n.dataScope?n.dataScope:new BE(i);let a=n.parent;a.removeChild(n),delete t._itemMap[n.id];let c=u[n.id],h=n.bounds,f=h.left,p=h.top,g=s==bE?h.width/c.length:h.width,_=s==bE?h.height:h.height/c.length;for(let t=0;t<c.length;t++){let e=aT(d);e.dataScope=c[t],console.log(e.dataScope),e.resize(g,_),e._updateBounds(),e._refBounds=e.bounds.clone(),r.addChild(e);for(let t of e.vertices)t.dataScope?t.dataScope=e.dataScope.merge(t.dataScope):t.dataScope=e.dataScope}a.addChild(r),r._layout=new wM({orientation:s,left:f,top:p}),r._layout.group=r,n==e&&(o=r)}return{newMark:o.children[0],collection:o}}(t,e,r,n,i);case lT.Ring:return function(t,e,n,r,i){let o,a,s,l=Qw(e),c=n||xE;if(c!=xE&&c!=wE)throw new Error("Unknown orientation: "+c);c===xE&&l.forEach(n=>{let l=n.dataScope?n.dataScope:new BE(i),c=i.getUniqueAttributeValues(r).map(t=>l.cross(r,t));c=c.filter(t=>!t.isEmpty());let u=iT(t);null==a&&(a=u.id),u._classId=a,u.dataScope=n.dataScope?n.dataScope:new BE(i);let h=n.parent;h.removeChild(n),delete t._itemMap[n.id];let f=360/c.length,d=90;for(let t=0;t<c.length;t++){let r=rT({type:"arc",innerRadius:n.innerRadius,outerRadius:n.outerRadius,x:n.x,y:n.y,startAngle:VE(d-f*(t+1)),endAngle:VE(d-f*t),strokeColor:n.strokeColor,fillColor:n.fillColor,strokeWidth:n.strokeWidth,opacity:n.opacity});s||(s=r.id),r.classId=s,r.dataScope=c[t],r._updateBounds(),r._refBounds=r.bounds.clone(),u.addChild(r),u._layout=new wM({orientation:xE,direction:AE.CLOCKWISE}),u._layout.group=u,h.removeChild(n),h.addChild(u),n===e&&(o=u)}});return{newMark:o.children[0],collection:o}}(t,e,r,n,i);case lT.Pie:case lT.Arc:return function(t,e,n,r,i){let o,a,s,l=Qw(e),c=n||xE;if(c!=xE&&c!=wE)throw new Error("Unknown orientation: "+c);c===xE||l.forEach(n=>{let l=n.dataScope?n.dataScope:new BE(i),c=i.getUniqueAttributeValues(r).map(t=>l.cross(r,t));c=c.filter(t=>!t.isEmpty());let u=iT(t);null==a&&(a=u.id),u._classId=a,u.dataScope=n.dataScope?n.dataScope:new BE(i);let h=n.parent;h.removeChild(n),delete t._itemMap[n.id];for(let t=0;t<c.length;t++){let r=rT({type:"arc",innerRadius:n.innerRadius+t*(n.outerRadius-n.innerRadius)/c.length,outerRadius:n.innerRadius+(t+1)*(n.outerRadius-n.innerRadius)/c.length,x:n.x,y:n.y,startAngle:n.startAngle,endAngle:n.endAngle,strokeColor:n.strokeColor,fillColor:n.fillColor,strokeWidth:n.strokeWidth,opacity:n.opacity});s||(s=r.id),r.classId=s,r.dataScope=c[t],r._updateBounds(),r._refBounds=r.bounds.clone(),u.addChild(r),u._layout=new wM({orientation:wE}),u._layout.group=u,h.removeChild(n),h.addChild(u),n===e&&(o=u)}});return{newMark:o.children[0],collection:o}}(t,e,r,n,i)}}function AM(t){if([lT.Line,lT.Circle,lT.Rect,lT.Area,lT.Ring,lT.Pie,lT.Path].indexOf(t.type)<0)return!1;if(t.type===lT.Path&&(t.closed||!t.firstVertex.dataScope))return!1;if(t.dataScope){let e=Qw(t);for(let t of e)if(t.dataScope.numTuples>1)return!0;return!1}return!0}function TM(t,e,n,r){let i=r.getAttributeType(n);if(i!=$E.String&&i!=$E.Date&&i!=$E.Integer)throw new Error("Repopulate only works on a string or date attribute: "+n+" is "+i);let o=Qw(e);for(let t of o){let e=r.getAttributeSummary(n).unique.map(e=>t.dataScope?t.dataScope.cross(n,e):new BE(r).cross(n,e));e=e.filter(t=>!t.isEmpty());let i=t.children.length-e.length,o=e.length-t.children.length;for(let e=0;e<i;e++)t.removeChildAt(t.children.length-1);let a=t._children.length;for(let e=0;e<o;e++){let n=aT(t._children[e%a]);t.addChild(n)}t.children.forEach((t,n)=>t.dataScope=e[n])}}class SM{constructor(t,e){this._elem=t,this._base=e,this._id=CM(t,e),this._channels={},this._attribute=void 0}get id(){return this._id}get element(){return this._elem}get base(){return this._base}get channels(){return Object.keys(this._channels)}addChannel(t,e){let n={};n.elemAnchor="elementAnchor"in e?e.elementAnchor:"x"==t||"angle"==t?Xw.CENTER:Xw.MIDDLE,n.baseAnchor="baseAnchor"in e?e.baseAnchor:"x"==t||"angle"==t?Xw.CENTER:Xw.MIDDLE,n.offset="offset"in e?e.offset:0,"attribute"in e&&(this._attribute=e.attribute),this._channels[t]=n}hasChannel(t){return t in this._channels}getElementAnchor(t){return this._channels[t].elemAnchor}getBaseAnchor(t){return this._channels[t].baseAnchor}getOffset(t){return this._channels[t].offset}get attribute(){return this._attribute?this._attribute:dT}}function CM(t,e){return(t.classId?t.classId:t.id)+":"+(e.classId?e.classId:e.id)}function kM(t,e,n,r){t.dataScope&&t.dataScope.dataTable.hasAttribute(e)?function(t,e,n,r){if(!t.dataScope.dataTable.hasAttribute(e))return void console.warn("Cannot order collection children by an non-existent attribute",e);let i;if(e===dT)i=(t,n)=>parseInt(t.dataScope.getAttrVal(e).substring(1))-parseInt(n.dataScope.getAttrVal(e).substring(1));else{switch(t.children[0].dataScope.getAttributeType(e)){case $E.Date:break;case $E.Number:case $E.Integer:i=(t,n)=>t.dataScope.aggregateNumericalAttribute(e)-n.dataScope.aggregateNumericalAttribute(e);break;case $E.String:i=r?(t,n)=>r.indexOf(t.dataScope.getAttrVal(e))-r.indexOf(n.dataScope.getAttrVal(e)):(t,n)=>t.dataScope.getAttrVal(e)<n.dataScope.getAttrVal(e)?-1:1}}t.children.sort(i),n&&t.children.reverse()}(t,e,n,r):function(t,e,n){let r;switch(e){case"x":case"y":case"width":case"height":r=(t,n)=>t.bounds[e]-n.bounds[e];break;default:r=(t,n)=>t[e]-n[e]}t._children.sort(r),n&&t.children.reverse()}(t,e,n),t._sortBy={property:e,descending:n,vals:r}}function MM(t,e,n,r){t.vertices[0].dataScope&&t.vertices[0].dataScope.dataTable.hasAttribute(e)?function(t,e,n,r){let i;if(e===dT)i=(t,n)=>parseInt(t.dataScope.getAttrVal(e).substring(1))-parseInt(n.dataScope.getAttrVal(e).substring(1));else{switch(t.vertices[0].dataScope.getAttributeType(e)){case $E.Date:break;case $E.Number:case $E.Integer:i=(t,n)=>t.dataScope.aggregateNumericalAttribute(e)-n.dataScope.aggregateNumericalAttribute(e);break;case $E.String:i=r?(t,n)=>r.indexOf(t.dataScope.getAttrVal(e))-r.indexOf(n.dataScope.getAttrVal(e)):(t,n)=>t.dataScope.getAttrVal(e)<n.dataScope.getAttrVal(e)?-1:1}}t.vertices.sort(i),n&&t.vertices.reverse()}(t,e,n,r):function(t,e,n){let r=(t,n)=>t[e]-n[e];t.vertices.sort(r),n&&t.vertices.reverse()}(t,e,n),t._sortBy={property:e,descending:n,vals:r}}class RM extends hE{constructor(t){super(),this.type=fE.GRID,this._numCols=t.numCols,this._numRows=t.numRows,this._start="start"in t?t.start:mE.TopLeft,this._direction="direction"in t?t.direction:yE.RowFirst,this._rowGap="rowGap"in t&&void 0!==t.rowGap?t.rowGap:5,this._colGap="colGap"in t&&void 0!==t.colGap?t.colGap:5,this._cellHorzAlignment="horzCellAlignment"in t&&dE("h",t.horzCellAlignment)?t.horzCellAlignment:Xw.LEFT,this._cellVertAlignment="vertCellAlignment"in t&&dE("v",t.vertCellAlignment)?t.vertCellAlignment:Xw.BOTTOM,this._numCols||this._numRows||(this._numRows=1),this._left=void 0,this._top=void 0,this._cellBounds=void 0,this._grid=void 0}get cellBounds(){return this._cellBounds}get numCols(){return this._numCols?this._numCols:this._numRows?Math.ceil(this.group.children.length/this._numRows):0}set numCols(t){this._numCols=t}set numRows(t){this._numRows=t}get numRows(){return this._numRows?this._numRows:this._numCols?Math.ceil(this.group.children.length/this._numCols):0}clone(){let t=new RM({numCols:this._numCols,numRows:this._numRows,start:this._start,direction:this._direction,colGap:this._colGap,rowGap:this._rowGap,horzCellAlignment:this._cellHorzAlignment,vertCellAlignment:this._cellVertAlignment});return t._left=this._left,t._top=this._top,this._cellBounds&&(t._cellBounds=this._cellBounds.map(t=>t.clone())),t}getElementsByRow(t,e){let n=[],r=this.group.children;for(let e=0;e<this.numRows;e++){let i=this._grid[e].filter(t=>null!=t).map(t=>r[t]);if(t){let t=[];for(let e of i)t=t.concat(lE(e));n.push(t)}else n.push(i)}return e&&(n=this._filterElementsByExample(n,e)),n}getElementsByCol(t,e){let n=[],r=this.group.children,i=this._grid;for(let e=0;e<this.numCols;e++){let o=i.map(t=>t[e]).filter(t=>null!=t).map(t=>r[t]);if(t){let t=[];for(let e of o)t=t.concat(lE(e));n.push(t)}else n.push(o)}return e&&(n=this._filterElementsByExample(n,e)),n}getElementsByCell(t,e){let n=[],r=this.group.children;for(let e=0;e<r.length;e++)if(t){let t=lE(r[e]);n.push(t)}else n.push(r[e]);return e&&(n=this._filterElementsByExample(n,e)),n}_filterElementsByExample(t,e){let n;return"vertex"===e.type?(n=t.map(t=>t.filter(t=>t.classId===e.parent.classId)),n=n.map(t=>tE(e,t))):"segment"===e.type?(n=t.map(t=>t.filter(t=>t.classId===e.parent.classId)),n=n.map(t=>eE(e,t))):n=t.map(t=>t.filter(t=>t.classId===e.classId)),n}getIndex(t){let e=t;for(;e&&e.parent!==this.group;)e=e.parent;return this.group.children.indexOf(e)}getRowCol(t){let e,n;switch(this._direction){case yE.RowFirst:e=Math.floor(t/this.numCols),n=t%this.numCols;break;case yE.ColumnFirst:e=t%this.numRows,n=Math.floor(t/this.numRows);break;default:throw new Error("Invalid fill direction. Use 'row_first' or 'column_first'.")}return this._start.toLowerCase().includes("bottom")&&(e=this.numRows-1-e),this._start.toLowerCase().includes("right")&&(n=this.numCols-1-n),{row:e,col:n}}get startCorner(){return this._start}set startCorner(t){this._start=t}get direction(){return this._direction}set direction(t){this._direction=t}}class OM extends qA{constructor(t,e){super(),this._type=lT.Axis,this._id=this._type+uT(),this._enc=t,this._textColor="textColor"in e?e.textColor:"#555",this._strokeColor="strokeColor"in e?e.strokeColor:"#555",this._fontSize="fontSize"in e?e.fontSize:"12px",this._x="x"in e?e.x:100,this._y="y"in e?e.y:100,this._showTitle=!("showTitle"in e)||e.showTitle,this._orientation="orientation"in e?e.orientation:vE,this._numberFormat=e.numberFormat?e.numberFormat:""}get attribute(){return this._enc.attribute}get channel(){return this._enc.channel}get attributeType(){return fT(this._enc.element).getFieldType(this.attribute)}get orientation(){return this._orientation}get textColor(){return this._textColor}}class NM extends OM{constructor(t,e){super(t,e),"numCols"in e||"numRows"in e?(this._numCols=e.numCols,this._numRows=e.numRows):this._orientation===vE?this._numCols=1:this._numRows=1,this._initialize()}_initialize(){let t=this._enc.element.scene,e=this._enc.attribute,n=this._enc.scales[0],r=new hT(n.domain.map(t=>({category:t,value:n.map(t)}))),i=r.getUniqueAttributeValues("category").sort((t,e)=>e.length-t.length)[0],o=this._enc.element,a=o instanceof kE&&o.closed&&"strokeColor"!==this._enc.channel?o.strokeWidth:0;if(this._orientation===vE){let n=0;this._showTitle&&(this.addChild(new QA({fillColor:this._textColor,fontSize:this._fontSize,text:e,x:this._x,y:this._y,anchor:["left","top"]})),n=parseFloat(this._fontSize)+5);let s=t.mark("rect",{top:this._y+2+n,left:this._x,width:10,height:10,strokeWidth:a,strokeColor:o.strokeColor,opacity:o.opacity}),l=t.mark("text",{text:i,fillColor:this._textColor,fontSize:this._fontSize,x:this._x+20,y:this._y+n+12+a,anchor:["left","bottom"]}),c=t.glyph(s,l),u=t.repeat(c,r);t.encode(l,{channel:"text",attribute:"category",forLegend:!0}),t.encode(s,{channel:"fillColor",attribute:"category",shareScale:this._enc,forLegend:!0}),u.layout=new RM({numCols:this._numCols,numRows:this._numRows}),this.addChild(u)}else{let e=t.mark("rect",{top:this._y,left:this._x,width:10,height:10,strokeWidth:a,strokeColor:o.strokeColor,opacity:o.opacity}),n=t.mark("text",{text:i,fillColor:this._textColor,fontSize:this._fontSize,x:this._x+15,y:this._y,anchor:["left","top"]}),s=t.glyph(e,n),l=t.repeat(s,r);t.encode(n,{channel:"text",attribute:"category",forLegend:!0}),t.encode(e,{channel:"fillColor",attribute:"category",shareScale:this._enc,forLegend:!0}),l.layout=new RM({numCols:this._numCols,numRows:this._numRows,colGap:15}),this.addChild(l)}}}class IM extends OM{constructor(t,e){super(t,e),this._initialize()}_initialize(){let t,e,n,r=this._enc.element.scene,i=this._enc.attribute;if(this._orientation==vE?(t=15,e=300):(t=300,e=15),this._showTitle){let e=r.mark("text",{fillColor:this._textColor,text:i,x:this._x+t/2,y:this._y,anchor:["center","middle"]});this.addChild(e),n=20}else n=0;let o,a=r.mark("rect",{top:this._y+n,left:this._x,width:t,height:e,strokeWidth:0,opacity:this._enc.element.opacity}),s=Object.values(this._enc.attrValues),l=[Math.min(...s),Math.max(...s)],c=this._enc.mapping,u=[],h=[],f=Hl(this._numberFormat);if(c){let i=Object.keys(c).map(t=>parseFloat(t)).sort((t,e)=>t-e);this._orientation==vE?(o=new _E({x1:0,y1:100,x2:0,y2:0}),i.forEach(i=>{let a=(i-l[0])/(l[1]-l[0]);o.addStop(100*a,c[i],1);let s=r.mark("line",{x1:this._x+t,x2:this._x+t+5,y1:this._y+e-a*e+n,y2:this._y+e-a*e+n,strokeColor:this._strokeColor});h.push(s);let d=r.mark("text",{fillColor:this._textColor,text:this._numberFormat?f(i):i.toFixed(0),x:this._x+t+5+5,y:this._y+e-a*e+n,anchor:["left","middle"]});u.push(d)})):(o=new _E({x1:0,y1:0,x2:100,y2:0}),i.forEach(i=>{let a=(i-l[0])/(l[1]-l[0]);o.addStop(100*a,c[i],1);let s=r.mark("line",{x1:this._x+a*t,x2:this._x+a*t,y1:this._y+20-5+n,y2:this._y+e+5+n,strokeColor:this._strokeColor});h.push(s);let d=r.mark("text",{fillColor:this._textColor,text:this._numberFormat?f(i):i.toFixed(0),x:this._x+a*t,y:this._y+e+5+n,anchor:["center","top"]});u.push(d)}))}else{let a=this._enc.scales[0].domain,s=fT(this._enc.element),l=s.getAttributeType(i),c=[],d=l===$E.Date?s.getUniqueFieldValues(i):[...new Set(Object.values(this._enc.attrValues))];if(d.length<=10)c=d,c.sort((t,e)=>t-e);else if(l===$E.Date){d.sort((t,e)=>t-e);for(let t=0;t<d.length;t+=Math.ceil(d.length/10))c.push(d[t])}else{let t=(a[1]-a[0])/9;for(let e=0;e<10;e++)c.push(a[0]+e*t)}let p=0,g=(c[c.length-1]-c[0])/c.length;for(;g<1;)g*=10,p++;c=c.map(t=>t.toFixed(p)),this._orientation==vE?(o=new _E({x1:0,y1:100,x2:0,y2:0}),c.forEach(c=>{let d=(c-a[0])/(a[1]-a[0]);o.addStop(100*d,this._enc.scales[0].map(c),1);let p=r.mark("line",{x1:this._x+t,x2:this._x+t+5,y1:this._y+e-d*e+n,y2:this._y+e-d*e+n,strokeColor:this._strokeColor});h.push(p);let g=r.mark("text",{fillColor:this._textColor,text:l===$E.Date?s.getRawValue(i,c):this._numberFormat?f(c):c,x:this._x+t+5+5,y:this._y+e-d*e+n,anchor:["left","middle"]});u.push(g)})):(o=new _E({x1:0,y1:0,x2:100,y2:0}),c.forEach(c=>{let f=(c-a[0])/(a[1]-a[0]);o.addStop(100*f,this._enc.scale.map(c),1);let d=r.mark("line",{x1:this._x+f*t,x2:this._x+f*t,y1:this._y+e+n,y2:this._y+e+5+n,strokeColor:this._strokeColor});h.push(d);let p=r.mark("text",{fillColor:this._textColor,text:l===$E.Date?s.getRawValue(i,c):c,x:this._x+f*t,y:this._y+e+5+n,anchor:["center","top"]});u.push(p)}))}a.styles.fillColor=o,this.addChild(a);for(let t of u)this.addChild(t);for(let t of h)this.addChild(t)}}class LM extends qA{constructor(t){super(),this._type=lT.Composite,this._id=t&&t.id?t.id:this._type+uT()}addChild(t){let e=t.parent;super.addChild(t);let n=aE(t)._depGraph;e&&PA(e,t,n),VA(this,t,n)}}class PM{constructor(t,e,n){this._elems=t,this._channel=e,this._anchor=n}get elements(){return this._elems}get channel(){return this._channel}get anchor(){return this._anchor}}class VM extends hE{constructor(t){super(),this.type=fE.STRATA,this._direction=t.direction,this._gap="gap"in t?t.gap:0}clone(){return new VM({direction:this._direction,gap:this._gap})}}function DM(t,e,n,r,i,o){switch(e.type){case lT.Circle:case lT.Ring:return function(t,e,n,r,i,o){let a,s=n||TE.OUTWARD,l=i||50;if(s!==TE.INWARD&&s!==TE.OUTWARD)throw"Unknown direction to stratify";let c,u=Qw(e,t),h=Array.isArray(o)?o:[o];if(r){let n=iT(t);n.dataScope=void 0,null==c&&(c=n.id),n._classId=c;let r=u.map(t=>h[0].getNode(t.dataScope.getAttrVal(qE)));BM(u,r,h[0],n,e.classId?e.classId:e.id,400,350,s,l),a=n}else u.forEach((n,r)=>{let i=iT(t);i.dataScope=void 0,null==c&&(c=i.id),i._classId=c;let o=n.parent;zM(n,e.id,s,l,h[r],h[r].getRoot(),i,t,!0),i._layout=new VM({direction:s}),i._layout.group=i,o.addChild(i),n===e&&(a=i)});return a}(t,e,n,r,i,o);case lT.Rect:return function(t,e,n,r,i,o){let a,s,l=n||EE.Top2Bottom,c=i||50;if(!Object.values(EE).includes(l))throw"Unknown direction to stratify";return Qw(e).forEach(n=>{let r=iT(t);r.dataScope=void 0,null==s&&(s=r.id),r._classId=s;let i=n.parent;FM(n,e.id,l,c,o,o.getRoot(),r,t,!0),r._layout=new VM({direction:l}),r._layout.group=r,i.addChild(r),n===e&&(a=r)}),a}(t,e,n,0,i,o)}}function BM(t,e,n,r,i,o,a,s,l){let c=e.map(t=>n.getParent(t)).filter((t,e,n)=>n.findIndex(e=>e[qE]===t[qE])===e);if(c=c.filter(t=>t!==n.getRoot()),0===c.length)return;let u=[];for(let e of c){let c,h,f,d=t.filter(t=>n.getParent(n.getNode(t.dataScope.getAttrVal(qE)))===e);if(d[0].type===lT.Circle){let t=d.map(t=>jw(o,a,t.bounds.x,t.bounds.y)-t.radius),e=d.map(t=>jw(o,a,t.bounds.x,t.bounds.y)+t.radius);f=s===TE.OUTWARD?Math.max(...e):Math.min(...t)-l;let n=d.map(t=>DE(t.bounds.x,t.bounds.y,o,a)),r=d.map(t=>DE(o+jw(o,a,t.bounds.x,t.bounds.y),a-t.radius,o,a)),i=n.map((t,e)=>t-r[e]),u=n.map((t,e)=>t+r[e]),p=i.concat(u);c=Math.min(...p),h=Math.max(...p)}else d[0].type===lT.Arc&&(c=360,h=-360,d.forEach(t=>{let e=t.startAngle,n=t.endAngle;n<e&&(n+=360),c=Math.min(c,e),h=Math.max(h,n)}),c=VE(c),h=VE(h),f=s===TE.OUTWARD?Math.max(...d.map(t=>t.outerRadius)):Math.min(...d.map(t=>t.innerRadius))-l);let p=rT({type:"arc",innerRadius:f,outerRadius:f+l,x:o,y:a,startAngle:VE(c),endAngle:VE(h),strokeColor:t[0].strokeColor,fillColor:t[0].fillColor,strokeWidth:t[0].strokeWidth,opacity:t[0].opacity});p._updateBounds(),p.dataScope=n.getNodeDataScope(e),p._classId=i,r.addChild(p),u.push(p)}BM(u,c,n,r,i,o,a,s,l)}function zM(t,e,n,r,i,o,a,s,l){l&&(t.dataScope=i.getNodeDataScope(o),t._classId=e);let c=i.getChildren(o);if(0===c.length)return;let u=t.type===lT.Circle||t.type===lT.Ring?60:t.startAngle,h=(t.type===lT.Circle||t.type===lT.Ring?360:t.angle)/c.length;for(let o=0;o<c.length;o++){let s,l;l=n===TE.OUTWARD?t.type===lT.Circle?t.radius:t.outerRadius:t.type===lT.Circle?t.radius-r:t.innerRadius-r,s=rT(360===h?{type:"ring",innerRadius:l,outerRadius:l+r,x:t.x,y:t.y,strokeColor:t.strokeColor,fillColor:t.fillColor,strokeWidth:t.strokeWidth,opacity:t.opacity}:{type:"arc",innerRadius:l,outerRadius:l+r,x:t.x,y:t.y,startAngle:VE(u+h*o),endAngle:VE(u+h*(o+1)),strokeColor:t.strokeColor,fillColor:t.fillColor,strokeWidth:t.strokeWidth,opacity:t.opacity}),s._updateBounds(),s.dataScope=i.getNodeDataScope(c[o]),s._classId=e+"_strata",a.addChild(s),zM(s,e,n,r,i,c[o],a)}}function FM(t,e,n,r,i,o,a,s,l){l&&(t.dataScope=i.getNodeDataScope(o),t._classId=e,a.addChild(t));let c,u,h,f=i.getChildren(o);if(0!==f.length){c=t.left,u=t.bottom,h=t.width/f.length;for(let o=0;o<f.length;o++){let s=aT(t);pA(s,c-s.left,u-s.top),s.resize(h,r),s._updateBounds(),c+=h,s.dataScope=i.getNodeDataScope(f[o]),s._classId=e,a.addChild(s),FM(s,e,n,r,i,f[o],a)}}}class GM{constructor(t,e,n,r){this._id=t,this._event=n,this._target=e,this._evtCtx=new bM,this._cumulative=r}get id(){return this._id}get event(){return this._event}get eventContext(){return this._evtCtx}get target(){return this._target}isCumulative(){return this._cumulative}isMouseDriven(){return["brush","brushX","brushY","click","hover"].includes(this._event)}isKeyboardDriven(){return["keydown","keyup"].includes(this._event)}isWidgetDriven(){return["change","input"].includes(this._event)}}class jM extends qA{constructor(t){super(),this._itemMap={},this._peerIndex=new Map,this._type=lT.Scene,this._id=t&&t.id?t.id:this._type+uT(),t&&t.fillColor&&(this.fillColor=t.fillColor),this._encodings={},this._relations=[],this._triggers={},this._condEncodings={},this._depGraph=new gM}get depGraph(){return this._depGraph}get interactionTriggers(){return this._triggers}buildPeerIndex(){this._peerIndex=new Map;let t=this._peerIndex;uE(this,e=>{e.classId&&(t.has(e.classId)||t.set(e.classId,[]),t.get(e.classId).push(e))})}mark(t,e){if(Object.values(sT).indexOf(t)<0)throw new Error("Mascot does not allow directly creating a "+t);let n=void 0===e?{}:e;n.type=t;let r=rT(n);return null!==r&&(r._classId=r.id,this.addChild(r),this._itemMap[r.id]=r,MA(r,this._depGraph),VA(this,r,this._depGraph)),r}glyph(...t){let e=[];for(let n of t)e.push([n.parent,n]);let n=oT(t);if(null!==n){n._classId=n.id,this.addChild(n),this._itemMap[n.id]=n;for(let t of e)PA(t[0],t[1],this._depGraph);DA(n,this._depGraph),VA(this,n,this._depGraph)}return n}composite(){let t=new LM;return null!==t&&(t._classId=t.id,this.addChild(t),this._itemMap[t.id]=t,LA(t,this._depGraph),VA(this,t,this._depGraph)),t}attach(t,e){if(t.type==lT.Glyph)for(let e of t.children)e._refBounds||(e._refBounds=e.bounds.clone());t.dataScope=new BE(e)}repeat(t,e,n){let r=n||{};if(r.attribute=r.attribute||dT,function(t,e,n){if(!t||void 0===e)throw new Error("Incomplete information to do repeat. You must specify an element, a categorical data attribute and a data table");if(e instanceof GE||e instanceof UE){if(!Array.isArray(t)||2!==t.length)throw new Error("To repeat with a tree or a network, you need to provide two marks, one for node and one for link")}else e instanceof hT&&WE(n.attribute,e);if(n.layout&&!(n.layout instanceof hE))throw new Error("Invalid layout: "+n.layout)}(t,e,r),e instanceof GE||e instanceof UE){let n=t[0].parent,r=t[1].parent,[i,o]=function(t,e,n,r){let i=r.nodeTable.getAttributeSummary(qE).unique.map(t=>e.dataScope?e.dataScope.cross(qE,t):new BE(r.nodeTable).cross(qE,t)),o=iT(t),a=iT(t),s={};a.dataScope=e.dataScope?e.dataScope.clone():new BE(r.nodeTable),a.addChild(e);for(let t=1;t<i.length;t++){let t=aT(e);a.addChild(t)}a.children.forEach((t,e)=>{t.dataScope=i[e],t.links=[],s[t.dataScope.getAttrVal(qE)]=t});let l=r.linkTable.getAttributeSummary(dT).unique.map(t=>n.dataScope?n.dataScope.cross(dT,t):new BE(r.linkTable).cross(dT,t));o.dataScope=n.dataScope?n.dataScope.clone():new BE(r.linkTable),o.addChild(n);for(let t=1;t<l.length;t++){let t=aT(n);o.addChild(t)}o.children.forEach((t,e)=>t.dataScope=l[e]);let c=r instanceof GE?"parent":"source",u=r instanceof GE?"child":"target";for(let t of o.children){let e=t.dataScope.getAttrVal(c),n=t.dataScope.getAttrVal(u),r=s[e],i=s[n];t.source=r,t.target=i,r.links.push(t),i.links.push(t)}return[a,o]}(this,t[0],t[1],e);return this.buildPeerIndex(),PA(n,t[0],this._depGraph),PA(r,t[1],this._depGraph),IA(i,this._depGraph),IA(o,this._depGraph),VA(i,t[0],this._depGraph),VA(i.parent,i,this._depGraph),VA(o,t[1],this._depGraph),VA(o.parent,o,this._depGraph),[i,o]}if(e instanceof hT){let n=t.parent,i=yM(this,t,r.attribute,e);return this.buildPeerIndex(),PA(n,t,this._depGraph),IA(i,this._depGraph),VA(i,t,this._depGraph),VA(i.parent,i,this._depGraph),r.layout&&(i.layout=r.layout),i}}divide(t,e,n){let r=n||{};if(r.attribute=r.attribute||dT,console.log("------ divide by",r.attribute," ----"),function(t,e,n){if(!t||void 0===e)throw new Error("Incomplete information to do divide. You must specify an element, a categorical data attribute and a data table");if(e instanceof hT&&WE(n.attribute,e),n.layout&&!(n.layout instanceof hE))throw new Error("Invalid layout: "+n.layout)}(t,e,r),e instanceof GE||e instanceof UE)throw"Not implemented";if(e instanceof hT){let{newMark:n,collection:i}=EM(this,t,r.attribute,r.orientation,e);return this.buildPeerIndex(),RA(t,this._depGraph),MA(n,this._depGraph),IA(i,this._depGraph),VA(i,n,this._depGraph),i.parent.type!==lT.Scene&&VA(i.parent,i,this._depGraph),this.onChange(nA.CHANNEL,"width",n),{newMark:n,collection:i}}}densify(t,e,n){let r=n||{};if(r.attribute=r.attribute||dT,console.log("------ densify by",r.attribute," ----"),function(t,e,n){if(!t||void 0===e)throw new Error("Incomplete information to do densification. You must specify an element, a categorical data attribute and a data table");e instanceof hT&&WE(n.attribute,e)}(t,e,r),e instanceof GE||e instanceof UE)throw"Not implemented";if(e instanceof hT){let n=JE(0,t,r.attribute,r.orientation,e);return this.buildPeerIndex(),RA(t,this._depGraph),MA(n,this._depGraph),n.parent.type!==lT.Scene&&VA(n.parent,n,this._depGraph),this.onChange(nA.CHANNEL,"width",n),n}}stratify(t,e,n){if(!(e instanceof GE||Array.isArray(e)&&e.every(t=>t instanceof GE)))throw"Cannot stratify on a non-tree dataset";if(![lT.Circle,lT.Rect,lT.Ring].includes(t.type))throw"Cannot stratify elements that are not rects, circles, or rings";let r=n||{},i=r.direction,o=r.size,a=t.parent,s=DM(this,t,i,r.startFromLeaf,o,e);return this.buildPeerIndex(),PA(a,t,this._depGraph),IA(s,this._depGraph),s.children.length>0&&VA(s,s.firstChild,this._depGraph),VA(s.parent,s,this._depGraph),s}repopulate(t,e,n){t.dataScope=void 0;let r=t;for(let t in n){TM(0,r,n[t],e);let i=aA(r.children[0]);for(let t of i){oA(t,this),OA(t,this._depGraph);for(let e of t.refElements)NT(e,this),NA(e,this._depGraph);t.clearRefElements()}let o=Qw(r);for(let t of o)if(t.layout){for(let e of t.layout.refElements)NT(e,this),NA(e,this._depGraph);t.layout.clearRefElements()}r=r.children[0]}t.dataScope=new BE(e),this.buildPeerIndex(),this.onChange(nA.CHANNEL,"width",t.children[0])}classify(t,e){let n=e||{};console.log("------ classify by",n.attribute," ----"),function(t,e,n,r){let i=Qw(e);for(let e of i){let i,o={},a=e.children;for(let t of a){let e=t.dataScope.getAttrVal(n);e in o||(o[e]=[]),o[e].push(t)}let s=fT(a[0]);for(let a in o){let l=iT(t);e.addChild(l),void 0===i&&(i=l.id),l._classId=i,l.dataScope=e.dataScope?e.dataScope.cross(n,a):new BE(s).cross(n,a);for(let t of o[a])l.addChild(t);r&&(l._layout=r.clone(),l._layout.group=l)}}}(this,t,n.attribute,n.layout),this.buildPeerIndex(),PA(t,t.firstChild.firstChild,this._depGraph),IA(t.firstChild,this._depGraph),VA(t.firstChild,t.firstChild.firstChild,this._depGraph),VA(t,t.firstChild,this._depGraph),this.onChange(nA.CHANNEL,"width",t.firstChild.firstChild)}affix(t,e,n,r){t.dataScope.dataTable!==t.dataScope.dataTable&&console.warn("Affix: elements and base elements are not created from the same table");let i=CM(t,e),o=this._relations.find(t=>t.id===i);o||(o=new SM(t,e),this._relations.push(o)),o.addChannel(n,r||{}),function(t,e){let n=e.getVariable(nA.AFFIXATION,t),r=e.getOutgoingDataflowOperator(gE.AFFIXER,n);e.connect(n,r);for(let n of t.channels){let i=e.getVariable(nA.CHANNEL,n,t.element),o=e.getVariable(nA.CHANNEL,n,t.base);e.connect(o,r),e.connect(r,i)}r.run()}(o,this._depGraph)}align(t,e,n){let r=new PM(t,e,n);!function(t,e){let n=e.createMultiWayDependency(gE.ALIGNER),r=e.getVariable(nA.ALIGNMENT,t);e.connect(r,n);for(let r of t.elements){let i=e.getVariable(nA.CHANNEL,t.channel,r);e.connect(i,n)}n.run()}(r,this._depGraph),this._relations.push(r)}encode(t,e){if("rowId"===e.attribute&&(e.attribute=dT),function(t,e){if(!t||!("channel"in e)||!("attribute"in e))throw new Error("Incomplete information to do encoding. You must specify an item, a categorical data attribute and a data table");let n=fT(t);if(n.tree){let t=e.attribute;if(t.indexOf(".")>0&&!n.tree.nodeTable.hasAttribute(t.split(".")[1]))throw new Error("Data attribute does not exist in the data table")}else if(!n||!n.hasAttribute(e.attribute))throw new Error("Data attribute does not exist in the data table");if(!Object.values(iA).includes(e.channel))throw new Error("Channel Not Supported")}(t,e),e.shareScale){let t=e.shareScale;if(t.channel!=e.channel&&t.channel.indexOf("Color")<0&&e.channel.indexOf("Color")<0)throw new Error("Cannot share scales between "+t.channel+" and "+e.channel+" encodings");e.scheme=e.shareScale.colorScheme}!function(t){let e;"vertex"===t.type&&t.parent.type===lT.Area?e=t.parent:t.type===lT.Area&&(e=t),e&&!e._refBounds&&Qw(e).forEach(t=>t._refBounds=t.bounds.clone())}(t);let n=e.aggregator?e.aggregator:"sum";console.log("------ encode",e.channel,e.attribute," --");let r=lA(t,e.channel);if(r&&e.attribute!==r.attribute){oA(r,this),OA(r,this._depGraph);for(let t of r.refElements)NT(t,this),NA(t,this._depGraph);r.clearRefElements()}e.table=fT(t);let i=new mM(t,e.channel,e.attribute,n,e);return this._addAttributeEncoding(i),jA(i,this._depGraph,e.shareScale),e.shareScale?this.onChange(nA.ATTR_VALUE,i):this.onChange(nA.CHANNEL,e.channel,t),i}connect(t,e){let n={};t.forEach(t=>n[t.dataScope.getAttrVal(qE)]=t);let r=e[0].dataScope.dataTable,i=r.tree?"parent":"source",o=r.tree?"child":"target";for(let e of t)e.links=[];for(let t of e){let e=t.dataScope.getAttrVal(i),r=t.dataScope.getAttrVal(o),a=n[e],s=n[r];t.source=a,t.target=s,a.links.push(t),s.links.push(t)}GA(t.find(t=>t.links.length>0),this._depGraph),this.onChange(nA.CHANNEL,"x",t[0])}_addAttributeEncoding(t){let e=cA(t.element);e in this._encodings||(this._encodings[e]={}),this._encodings[e][t.channel]=t}activate(t,e,n,r,i){!function(t,e,n,r,i){if(!("event"in t)||!("target"in t))throw"Target and event must be specified in the trigger";if(!("component"in n))throw"Responder component must be specified";if(Array.isArray(r)){if(!r.every(t=>"function"==typeof t))throw"Styling rules must be a function";if(i&&!Array.isArray(i))throw"An array of effect setters must be accompanied by an array of animation effects";if(i&&Array.isArray(i)&&i.length!==r.length)throw"the length of effect setters is not equal to the length of animation effects"}else if("function"!=typeof r)throw"Styling rules must be a function"}(t,0,e,r,i);let o=t.event,a=function(t){return["string"==typeof t.target?t.target:t.target.classId?t.target.classId:t.target.id,t.event].join("-")}(t);o=0===o.indexOf("brush")?"brush":0===o.indexOf("drag")?"drag":o,o in this._triggers||(this._triggers[o]={}),a in this._triggers[o]||(this._triggers[o][a]=new GM(a,t.target,t.event,t.cumulative));let s=this._triggers[o][a].eventContext,l=new vM(s,e.component,n,r);return a in this._condEncodings||(this._condEncodings[a]=[]),this._condEncodings[a].push(l),function(t,e,n,r){let i=e.responderComponent,o=r.getVariable(nA.EVT_CTX,t),a=n.properties?n.properties:n.channels;if(e.evalFunction){let t=r.getVariable(nA.CONDITION_RESULT,e.evalResult,e),n=r.findIncomingDataflowOperator(gE.TARGET_EVALUATOR,t);n||(n=r.createOneWayDependency(gE.TARGET_EVALUATOR,e.evalFunction)),r.connect(o,n),r.connect(n,t);for(let e of a){let n=Array.isArray(i)?i:[i];for(let i of n){let n=r.getVariable(nA.CHANNEL,e,i),o=n.incomingDataflow;if(o&&o instanceof AA&&o.outputVar.channel===e)r.connect(t,o);else if(!o){let o=r.createOneWayDependency(gE.ENCODER);r.connect(t,o),r.connect(o,n),o.storeValues(i,e)}}}}else for(let t of a){Object.values(iA).includes(t)?r.getVariable(nA.CHANNEL,t,i):r.getVariable(nA.PROPERTY,SA(t),i);let n=r.createOneWayDependency(gE.TARGET_UPDATER,e.stylingFunction,i);r.connect(o,n)}}(s,l,e,this._depGraph),this._triggers[o][a]}onChange(t,...e){if(Object.values(nA).indexOf(t)<0)throw new Error("Unknown Variable Type: "+t);let n=[];this._depGraph.processChange(t,n,...e);for(let t of n)t.run()}gridlines(t,e,n){let r=n||{},i=r.element?lA(r.element,t):sA(e,t,this);if(i){i.attribute!==e&&console.warn("Cannot create a "+t+" axis for "+e);let n=[];if("x"==t)for(let t of i.scales)n.push({scale:t,elems:i.getElements(t)});else if("width"==t){let t=sE(i.element),e=i.scales[0];if(t.layout&&t.layout.type==fE.GRID&&t.layout.numCols>1){let r=t.layout.getElementsByCol(!0);for(let t of r)n.push({scale:e,elems:t})}else n.push({scale:i.scales[0],elems:i.getElements(i.scales[0])})}else if("y"==t){let t=sE(i.element);if(t.layout&&t.layout.type==fE.GRID&&t.layout.numRows>1){let e=t.layout.getElementsByRow(!0,i.element);for(let t of e)n.push({scale:i.getScale(t[0]),elems:t})}else n.push({scale:i.scales[0],elems:i.getElements(i.scales[0])})}else if("height"==t){let t=sE(i.element),e=i.scales[0];if(t.layout&&t.layout.type==fE.GRID&&t.layout.numRows>1){let r=t.layout.getElementsByRow(!0,i.element);for(let t of r)n.push({scale:e,elems:t})}else n.push({scale:e,elems:i.getElements(e)})}else if("radialDistance"==t){let t=r.element?r.element:i.element;n.push({scale:i.scales[0],elems:Qw(t,t.parent)})}for(let t of n){let e=new xM(i.channel,i.attribute,t.scale,t.elems,r);this.addChild(e),i.addRefElement(e),HA(e,this._depGraph),VA(this,e,this._depGraph)}}else{let n=r.element?r.element:rE(this,e);if(!n)return void console.warn("Cannot create "+t+" gridlines for "+e);let i=iE(n.parent);if(!i.layout)return void console.warn("Cannot create "+t+" gridlines for "+e);let o=Qw(i);for(let n of o){let i=[];n.layout.type==fE.GRID&&n.layout.numRows>1&&"x"==t?i=n.layout.getElementsByRow():n.layout.type==fE.GRID&&n.layout.numCols>1&&"y"==t?i=n.layout.getElementsByCol():i.push(n.children);for(let o of i){let i=new xM(t,e,null,o,r);this.addChild(i),n.layout.addRefElement(i),HA(i,this._depGraph),VA(this,i,this._depGraph)}}}}axis(t,e,n){let r=n||{},i="rowId"==e?dT:e,o=[],a=r.element?lA(r.element,t):sA(i,t,this);if(a){a.attribute!==i&&console.warn("Cannot create a "+t+" axis for "+i);let e=[];if("x"==t||"width"==t){let t=sE(r.element?r.element:a.element);if(t.layout&&t.layout.type==fE.GRID&&t.layout.numCols>1){let n=t.layout.getElementsByCell(!0,a.element);for(let t of n)e.push({scale:a.getScale(t[0]),elems:t})}else e.push({scale:a.scales[0],elems:a.getElements(a.scales[0])})}else if("y"==t||"height"==t){let t=sE(r.element?r.element:a.element);if(t.layout&&t.layout.type==fE.GRID&&t.layout.numRows>1){let n=t.layout.getElementsByCell(!0,a.element);for(let t of n)e.push({scale:a.getScale(t[0]),elems:t})}else e.push({scale:a.scales[0],elems:a.getElements(a.scales[0])})}else if("radialDistance"==t){let t=r.element?r.element:a.element;e.push({scale:a.scales[0],elems:Qw(t,t.parent)})}for(let t of e){let e=new IT(a,t.scale,t.elems,r);this.addChild(e),o.push(e),a.addRefElement(e),YA(e,this._depGraph),VA(this,e,this._depGraph),this.onChange(nA.PROPERTY,kA.AXIS_PATH_POSITION,e)}}else{let e=r.element?r.element:rE(this,i);if(!e)return void console.warn("Cannot create a "+t+" axis for "+i);let n=iE(e.parent);if(!n.layout)return void console.warn("Cannot create a "+t+" axis for "+i);let a=Qw(n);for(let e of a){let n=[];e.layout.type==fE.GRID&&e.layout.numRows>1&&"x"==t?n=e.layout.getElementsByRow():e.layout.type==fE.GRID&&e.layout.numCols>1&&"y"==t?n=e.layout.getElementsByCol():n.push(e.children);for(let a of n){let n=new LT(a.slice(),t,i,r);this.addChild(n),o.push(n),e.layout.addRefElement(n),UA(n,this._depGraph),VA(this,n,this._depGraph),this.onChange(nA.PROPERTY,kA.AXIS_PATH_POSITION,n)}}}return o.length>1?o:o[0]}legend(t,e,n){let r=n||{},i="rowId"==e?dT:e,o=r.element?lA(r.element,t):sA(i,t,this);if(o){o.attribute!==e&&console.warn("Cannot create a "+t+" legend for "+e);let n="string"===fT(o.element).getAttributeType(e)?new NM(o,r):new IM(o,r);this.addChild(n),function(t,e){let n=e.getVariable(nA.BOUNDS,t),r=e.getVariable(nA.PROPERTY,kA.LEGEND_POSITION,t),i=e.getIncomingDataflowOperator(gE.EVAL_BBOX,n);e.connect(r,i),e.connect(i,n)}(n,this._depGraph),VA(this,n,this._depGraph),$w(n),this.onChange(nA.PROPERTY,kA.LEGEND_POSITION,n)}else console.warn("Cannot create a "+t+" legend for "+i)}createMask(t){let e=sE(t),n=e||t;n.clipMask||n.createClipMask()}setLayout(t,e){if(t.layout&&(zA(t,t.layout,this._depGraph),e.type===fE.TREEMAP)){let e=t.firstChild;for(;e&&e.type===lT.Collection&&e.layout;)zA(e,e.layout,this._depGraph),e=e.firstChild}if(Qw(t).forEach(t=>{let n=e?e.clone():e;t._layout=n,n&&(n.group=t)}),FA(t,e,this._depGraph),t.children&&t.children.length>0){let e=lE(t,!0);for(let t of e)this.onChange(nA.CHANNEL,"x",t)}}setProperties(t,e,n){let r=n?[t]:Qw(t);r.forEach(t=>{for(const[n,r]of Object.entries(e))_A(t,n,r)}),"width"in e&&r.forEach(t=>{t._refBounds&&t._refBounds.setWidth(e.width)}),"height"in e&&r.forEach(t=>{t._refBounds&&t._refBounds.setHeight(e.height)});for(let n in e)["vertex","segment"].includes(t.type)&&!["x","y"].includes(n)||(Object.values(iA).includes(n)?this.onChange(nA.CHANNEL,n,t):this.onChange(nA.PROPERTY,n,t))}setLayoutParameters(t,e){let n=Qw(t);for(let t of n)for(let n in e)t.layout[n]=e[n];this.onChange(nA.CHANNEL,"width",t.firstChild)}sortChildren(t,e,n,r){if(t instanceof qA)kM(t,e,n,r),this.onChange(nA.PROPERTY,kA.CHILDREN_ORDER,t);else if(t instanceof kE){let i=Qw(t);for(let t of i)MM(t,e,n,r)}}translate(t,e,n){pA(t,e,n);let r=lE(t,!0);for(let t of r)$w(t);for(let t of r)this.onChange(nA.CHANNEL,"x",t)}transform(t,e,n){let r=e.clone();switch(t){case"bin":!function(t,e,n,r,i){let o=i.getVariable(nA.ATTRIBUTE,t,n),a=i.getVariable(nA.ATTRIBUTE,e,r),s=i.createOneWayDependency(gE.BIN_TRANSFORMER);i.connect(o,s),i.connect(s,a),s.run()}(n.attribute,n.newAttribute,e,r,this._depGraph);break;case"filter":!function(t,e,n,r){let i=r.getVariable(nA.ITEMS,void 0,e),o=r.getVariable(nA.ITEMS,t,n),a=r.createOneWayDependency(gE.FILTER_TRANSFORMER);r.connect(i,a),r.connect(a,o),a.run()}(Bw(n),e,r,this._depGraph);break;case"kde":!function(t,e,n,r,i,o){let a=o.getVariable(nA.ATTRIBUTE,t,n),s=o.getVariable(nA.ATTRIBUTE,e,r),l=o.createOneWayDependency(gE.KDE_TRANSFORMER);l.args=i,o.connect(a,l),o.connect(l,s),l.run()}(n.attribute,n.newAttribute,e,r,n,this._depGraph)}return r}getEncodingByAttribute(t,e){return sA(t,e,this)}getEncodingByElement(t,e){return lA(t,e)}getAxis(t,e){return sA(t,e,this).refElements[0]}}function UM(t,e){let n=new BE(e.tables[t.dt]);for(let e in t.attr2value)n._attr2value[e]=t.attr2value[e],n._updateTuples(e,t.attr2value[e]);return n}class YM extends hE{constructor(t){super(),this.type=fE.DIRECTED,this._width="width"in t?t.width:500,this._height="height"in t?t.height:300,this._top="top"in t?t.top:0,this._left="left"in t?t.left:0,this._edgeSep="edgeSep"in t?t.edgeSep:50,this._spreadLinks=!("spreadLinks"in t)||t.spreadLinks,this._direction="direction"in t?t.direction:EE.Top2Bottom}clone(){return new YM({width:this._width,height:this._height,top:this._top,left:this._left,edgeSep:this._edgeSep,spreadLinks:this._spreadLinks,direction:this._direction})}get width(){return this._width}get height(){return this._height}get top(){return this._top}get left(){return this._left}get edgeSep(){return this._edgeSep}get spreadLinks(){return this._spreadLinks}get direction(){return this._direction}}class HM extends hE{constructor(t){super(),this.type=fE.FORCE,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._iterations="iterations"in t?t.iterations:1,this._repulsion="repulsion"in t?t.repulsion:30,this._attraction="attraction"in t?t.attraction:1,this._linkDistance="linkDistance"in t?t.linkDistance:30}clone(){return new HM({x:this._x,y:this._y,iterations:this._iterations,repulsion:this._repulsion,attraction:this._attraction,linkDistance:this._linkDistance})}}class qM extends hE{constructor(t){super(),this.type=fE.PACKING,this._x="x"in t?t.x:400,this._y="y"in t?t.y:400,this._width=t.width,this._height=t.height}clone(){return new qM({x:this._x,y:this._y,width:this._width,height:this._height})}}class WM extends hE{constructor(t){super(),this.type=fE.TIDYTREE,this._width="width"in t?t.width:500,this._height="height"in t?t.height:500,this._left="left"in t?t.left:100,this._top="top"in t?t.top:100,this._orientation="orientation"in t?t.orientation:bE}get width(){return this._width}get height(){return this._height}get top(){return this._top}get left(){return this._left}get orientation(){return this._orientation}clone(){return new WM({width:this._width,height:this._height,top:this._top,left:this._left,orientation:this._orientation})}}class $M extends hE{constructor(t){super(),this.type=fE.TREEMAP,this._width=t.width,this._height=t.height,this._left=t.left,this._top=t.top}get width(){return this._width}get height(){return this._height}get top(){return this._top}get left(){return this._left}clone(){return new $M({width:this._width,height:this._height,top:this._top,left:this._left})}}function XM(t){switch(t.type){case fE.GRID:return function(t){let e=new RM(t.args);"left"in t&&(e._left=t.left);"top"in t&&(e._top=t.top);"cellBounds"in t&&(e._cellBounds=t.cellBounds.map(t=>KM(t)));"grid"in t&&(e._grid=t.grid);return e}(t);case fE.STACK:return function(t){let e=new wM(t.args);return e}(t);case fE.PACKING:return function(t){let e=new qM(t.args);return e}(t);case fE.FORCE:return function(t){return new HM(t.args)}(t);case fE.DIRECTED:return function(t){return new YM(t.args)}(t);case fE.TIDYTREE:return function(t){return new WM(t.args)}(t);case fE.TREEMAP:return function(t){return new $M(t.args)}(t);case fE.STRATA:return function(t){return new VM(t.args)}(t);default:return void console.warn("unsupported layout type for deserialization:",t.type)}}function KM(t){return new Yw(t.x-t.width/2,t.y-t.height/2,t.width,t.height)}function ZM(t,e){t.type===lT.Pie&&(t.type=lT.Arc),t.args.type=t.type;let n=rT(t.args);return t.id&&(n._id=t.id),t.classId&&(n._classId=t.classId),t.dataScope&&(n._dataScope=UM(t.dataScope,e)),t.bounds&&(n._bounds=KM(t.bounds)),t.refBounds&&(n._refBounds=KM(t.refBounds)),function(t,e,n){if(t.vertices){const r=[];for(let i of t.vertices){const t=JM(i,e,n);r.push(t)}e.vertices=r,e.segments=[];let i=0;for(let t=1;t<e.vertices.length;t++)e.segments.push(new CE(e.vertices[t-1],e.vertices[t],e,i++));e.type===lT.Rect&&e.segments.push(new CE(e.vertices[e.vertices.length-1],e.vertices[0],e,i++))}e.vertexCounter=t.vertexCounter,e.segmentCounter=t.segmentCounter,e.curveMode=t.curveMode}(t,n,e),n}function JM(t,e,n){let r=new SE(t.x,t.y,e,t.id);return t.dataScope&&(r._dataScope=UM(t.dataScope,n)),"polarAngle"in t&&(r._polarAngle=t.polarAngle),r.shape=t.shape,r.width=t.width,r.height=t.height,r.radius=t.radius,r.fillColor=t.fillColor,r.opacity=t.opacity,r.strokeWidth=t.strokeWidth,r.strokeColor=t.strokeColor,r}function QM(t){let e={};e.fillColor=t.fillColor;let n=new jM(e);console.log("======== deserialization =========");let r={};if(t.tables)for(let e in t.tables){let n=t.tables[e];r[e]=new hT(n.data,n.url,n.attributeTypes),r[e]._id=n.id}n.tables=r;let i={};if(t.scales)for(let e in t.scales)i[e]=rR(t.scales[e]);if(n.scales=i,nR(t,n,n),eR(t,n),n.buildPeerIndex(),t.encodings){let e={};for(let r of t.encodings){let t=iR(r,n);e[t.id]=t}for(let t in e){n._addAttributeEncoding(e[t]);let r=e[t]._baseEnc?e[e[t]._baseEnc]:void 0;jA(e[t],n._depGraph,r),r?n.onChange(nA.ATTR_VALUE,e[t]):n.onChange(nA.CHANNEL,e[t].channel,e[t].element)}}if(t.axes)for(let e of t.axes){let t=e.args?e.args:{};t.tickValues&&Object.values(n.tables)[0].getAttributeType(e.attr)===$E.Date&&(t.tickValues=t.tickValues.map(t=>new Date(new Date(t).toISOString()))),e.id&&(t.id=e.id),n.axis(e.channel,e.attr,t)}if(t.gridlines)for(let e of t.gridlines)n.gridlines(e.channel,e.attr,e.args);return t.bounds&&(n._bounds=KM(t.bounds)),delete n.tables,delete n.scales,n}function tR(t,e,n){if(t.type===lT.Collection){let r=iT(n);t.classId&&(r._classId=t.classId),e.addChild(r),n._itemMap[r.id]=r,IA(r,n._depGraph),VA(e,r,n._depGraph),nR(t,r,n)}else if(t.type===lT.Glyph){let r=oT();t.classId&&(r._classId=t.classId),e.addChild(r),n._itemMap[r.id]=r,DA(r,n._depGraph),VA(e,r,n._depGraph),nR(t,r,n)}else if(t.type===lT.Composite){let r=new LM;e.addChild(r),n._itemMap[r.id]=r,LA(r,n._depGraph),VA(e,r,n._depGraph),nR(t,r,n),r._bounds=KM(t.bounds)}else if(t.type===lT.Axis){let r=new CT({});e.addChild(r),function(t,e,n){t.id&&(e._id=t.id);if(e._children=[],t.labels){let r=new qA;nR(t.labels,r,n),e._labels=r,e._children.push(r)}t.path&&(e._path=tR(t.path,e,n));if(t.ticks){let r=new qA;nR(t.ticks,r,n),e._ticks=r,e._children.push(r)}t.title&&(e._title=tR(t.title,e,n))}(t,r,n),n._itemMap[r.id]=r}else if(Object.values(Jw).includes(t.type)){let r=ZM(t,n);return n._itemMap[r.id]=r,e.addChild(r),MA(r,n._depGraph),VA(e,r,n._depGraph),r}}function eR(t,e){if(t.children)for(let n of t.children)eR(n,e);else if(Object.values(Jw).includes(t.type)){let n=e._itemMap[t.id];t.links&&(n.links=t.links.map(t=>e._itemMap[t])),t.source&&(n.source=e._itemMap[t.source]),t.target&&(n.target=e._itemMap[t.target])}}function nR(t,e,n){if(t.id&&(e._id=t.id),t.classId&&(e._classId=t.classId),t.dataScope&&(e._dataScope=UM(t.dataScope,n)),t.bounds&&(e._bounds=KM(t.bounds)),e._sortBy=t.sortBy,t.children)for(let r of t.children)tR(r,e,n);t.layout&&(e._layout=XM(t.layout),e._layout.group=e,FA(e,e._layout,n._depGraph))}function rR(t){let e=new vT(t.type,t.args);return e._id=t.id,e.domain=t.domain,e.range=t.range,e}function iR(t,e){let n=oR(t.element,t.elementType,e);n||console.warn("element not created:",t.element,t.elementType);let r=t.args?t.args:{};t.table&&(r.table=e.tables[t.table]);let i=new mM(n,t.channel,t.attr,t.aggregator?t.aggregator:"sum",r);if(i._id=t.id,t.scales&&(i._scales=t.scales.map(t=>e.scales[t])),r.baseEnc&&(i._baseEnc=t.args.baseEnc),t.elemGroups&&(i._elemGroups=t.elemGroups.map(t=>t.map(t=>oR(t,n.type,e)))),t.elem2scale){i._elem2scale={};for(let n in t.elem2scale)i._elem2scale[n]=e.scales[t.elem2scale[n]]}return r.startAngle&&(i.startAngle=r.startAngle),i}function oR(t,e,n){if("vertex"===e){let e=t.split("_v_");return n._itemMap[e[0]].vertices.find(t=>t._id===parseInt(e[1]))}if("segment"===e){let e=t.split("_s_");return n._itemMap[e[0]].segments.find(t=>t._id===parseInt(e[1]))}return n._itemMap[t]}function aR(t){let e={};return e.id=t._id,e.data=t._rawData,e.attributeTypes=t._attrTypes,e.url=t.url,e}function sR(t){let e={};return e.dt=t._dt.id,e.attr2value=Object.assign({},t._attr2value),e}function lR(t,e){e.vertices=[];for(let n of t.vertices)e.vertices.push(cR(n));e.vertexCounter=t.vertexCounter,e.segmentCounter=t.segmentCounter,e.curveMode=t.curveMode}function cR(t){let e={};return e.type=t.type,e.id=t._id,e.x=t.x,e.y=t.y,t._dataScope&&(e.dataScope=sR(t._dataScope)),void 0!==t._polarAngle&&(e.polarAngle=t._polarAngle),e.shape=t.shape,e.width=t.width,e.height=t.height,e.radius=t.radius,e.fillColor=t.fillColor,e.opacity=t.opacity,e.strokeWidth=t.strokeWidth,e.strokeColor=t.strokeColor,e}function uR(t){return t.type===lT.Scene?function(t){let e=dR(t,{});e.fillColor=t.fillColor,e.scales={},e.encodings=[];for(let n in t._encodings)for(let r in t._encodings[n]){let i=t._encodings[n][r];i._forLegend||e.encodings.push(fR(i));for(let t of i._scales)t.id in e.scales||(e.scales[t.id]=hR(t))}e.tables={};let n=function(t){let e={};for(let n in t._encodings)for(let r in t._encodings[n]){let i=t._encodings[n][r];i.dataTable.id in e||i._forLegend||(e[i.dataTable.id]=i.dataTable)}for(let n of t.children)if(![lT.Axis,lT.Legend,lT.Gridlines].includes(n.type)){if(n.dataScope){e[n.dataScope.dataTable.id]=n.dataScope.dataTable;break}if(n.children&&n.children.length>0){let t=n.firstChild;for(;t;){if(t.dataScope){e[t.dataScope.dataTable.id]=t.dataScope.dataTable;break}t=t.children&&t.children.length>0?t.firstChild:void 0}}}return e}(t);for(let t in n)e.tables[t]=aR(n[t]);return console.log("======== serialization ========="),console.log(e),e}(t):[lT.Collection,lT.Glyph,lT.Composite].includes(t.type)?dR(t,{}):t instanceof Kw?function(t){let e={args:{}};e.type=t.type,e.id=t.id,t.classId&&(e.classId=t.classId),t._dataScope&&(e.dataScope=sR(t._dataScope)),t.bounds&&(e.bounds=t.bounds.toJSON()),t.refBounds&&(e.refBounds=t.refBounds.toJSON()),t.links&&(e.links=t.links.map(t=>t.id)),t.source&&(e.source=t.source.id),t.target&&(e.target=t.target.id);for(let n in t.styles)n.indexOf("Color")>0&&t.styles[n]instanceof _E?e.args[n]=t.styles[n].toJSON():e.args[n]=t.styles[n];switch(t.type){case lT.Arc:case lT.Pie:!function(t,e){e.args.x=t._x,e.args.y=t._y,e.args.innerRadius=t._innerRadius,e.args.outerRadius=t._outerRadius,e.args.startAngle=t._startAngle,e.args.endAngle=t._endAngle,e.args.direction=t._direction,e.args.thickness=t._thickness}(t,e),lR(t,e);break;case lT.Area:!function(t,e){e.args.baseline=t._baseline,e.args.orientation=t._orientation}(t,e),lR(t,e);break;case lT.Circle:!function(t,e){e.args.x=t.x,e.args.y=t.y,e.args.radius=t.radius}(t,e);break;case lT.Image:break;case lT.Line:case lT.Path:case lT.BezierCurve:lR(t,e);break;case lT.SimpleText:!function(t,e){e.args.x=t._x,e.args.y=t._y,e.args.text=t._text,e.args.anchor=t._anchor,t._backgroundColor&&(e.args.backgroundColor=t._backgroundColor),t._borderWidth&&(e.args.borderWidth=t._borderWidth),t._borderColor&&(e.args.borderColor=t._borderColor)}(t,e);break;case lT.Polygon:!function(t,e){e.args.x=t._x,e.args.y=t._y,e.args.radius=t._radius}(t,e),lR(t,e);break;case lT.Rect:!function(t,e){e.args.width=t.width,e.args.height=t.height,e.args.top=t.top,e.args.left=t.left}(t,e),lR(t,e);case lT.Ring:}return e}(t):(console.warn("unsupported serialization",t.type),{type:t.type})}function hR(t){let e={};return e.type=t.type,e.id=t.id,t._args&&(e.args=t._args),e.domain=t.domain,e.range=t.range,e}function fR(t){let e={};e.id=t._id,e.element=t._elem.id,e.elementType=t._elem.type,e.channel=t._channel,e.attr=t._attribute,e.aggregator=t._aggregator,e.table=t._table.id,e.args={},e.args.includeZero=t._includeZero,e.args.flipScale=t._flipScale,e.args.mapping=t._mapping,e.args.rangeExtent=t._preferredRangeExtent,e.args.domain=t._preferredDomain,e.args.scaleType=t._scaleType,e.args.scheme=t._colorScheme,t._baseEnc&&(e.args.baseEnc=t._baseEnc.id),e.scales=t._scales.map(t=>t.id),e.elemGroups=t._elemGroups.map(t=>t.map(t=>t.id)),e.elem2scale={};for(let n in t._elem2scale)e.elem2scale[n]=t._elem2scale[n].id;return"angle"==t.channel&&(e.args.startAngle=t.startAngle),e}function dR(t,e){if(e.id=t.id,e.type=t.type,t.classId&&(e.classId=t.classId),t._dataScope&&(e.dataScope=sR(t._dataScope)),e.bounds=t.bounds.toJSON(),t._layout&&(e.layout=function(t){switch(t.type){case fE.GRID:return function(t){let e={args:{}};return e.type=t.type,e.args.numCols=t._numCols,e.args.numRows=t._numRows,e.args.start=t._start,e.args.direction=t._direction,e.args.colGap=t._colGap,e.args.rowGap=t._rowGap,e.args.horzCellAlignment=t._cellHorzAlignment,e.args.vertCellAlignment=t._cellVertAlignment,e.left=t._left,e.top=t._top,e.group=t.group.id,e}(t);case fE.STACK:return function(t){let e={args:{}};return e.type=t.type,e.args.orientation=t._orientation,e.args.direction=t._direction,e.args.left=t._left,e.args.top=t._top,e.args.horzCellAlignment=t._horzCellAlignment,e.args.vertCellAlignment=t._vertCellAlignment,e.args.gap=t._gap,e.group=t.group.id,e}(t);case fE.PACKING:return function(t){let e={args:{}};return e.type=t.type,e.args.x=t._x,e.args.y=t._y,e.args.width=t._width,e.args.height=t._height,e.group=t.group.id,e}(t);case fE.FORCE:return function(t){let e={args:{}};return e.type=t.type,e.args.x=t._x,e.args.y=t._y,e.args.iterations=t._iterations,e.args.repulsion=t._repulsion,e.args.attraction=t._attraction,e.args.linkDistance=t._linkDistance,e.group=t.group.id,e}(t);case fE.CLUSTER:return function(t){let e={args:{}};return e.type=t.type,e.args.size=t._size,e.args.rootX=t._rootX,e.args.rootY=t._rootY,e}(t);case fE.DIRECTED:return function(t){let e={args:{}};return e.type=t.type,e.args.left=t._left,e.args.top=t._top,e.args.width=t._width,e.args.height=t._height,e.args.edgeSep=t._edgeSep,e.args.spreadLinks=t._spreadLinks,e.args.direction=t._direction,e}(t);case fE.TIDYTREE:return function(t){let e={args:{}};return e.type=t.type,e.args.left=t._left,e.args.top=t._top,e.args.width=t._width,e.args.height=t._height,e.args.orientation=t._orientation,e}(t);case fE.TREEMAP:return function(t){let e={args:{}};return e.type=t.type,e.args.left=t._left,e.args.top=t._top,e.args.width=t._width,e.args.height=t._height,e}(t);case fE.STRATA:return function(t){let e={args:{}};return e.type=t.type,e.args.direction=t._direction,e.args.gap=t._gap,e}(t);default:throw new Error("unknow layout type "+t.type)}}(t._layout)),e.children=[],t.children.length>0)for(let n of t.children)n instanceof CT?pR(n,e):n instanceof xM?gR(n,e):e.children.push(uR(n));return e.sortBy=t._sortBy,e}function pR(t,e){e.axes??=[];let n={};n.type=t._type,n.id=t._id,n.attr=t._attribute,n.channel=t._channel,n.args={},n.args.orientation=t._orientation,n.args.strokeColor=t._strokeColor,n.args.textColor=t._textColor,n.args.fontSize=t._fontSize,n.args.tickOffset=t._tickOffset,n.args.tickSize=t._tickSize,n.args.tickAnchor=t._tickAnchor,n.args.tickVisible=t._tickVisible,n.args.pathVisible=t._pathVisible,n.args.labelOffset=t._labelOffset,n.args.labelFormat=t._labelFormat,n.args.titleOffset=t._titleOffset,n.args.title=t._titleText,n.args.rotateTitle=t._rotateTitle,n.args.titleVisible=t._showTitle,n.args.labelRotation=t._labelRotation,e.axes.push(n)}function gR(t,e){e.gridlines??=[];let n={};n.type=t._type,n.id=t._id,n.attr=t._attribute,n.channel=t._channel,n.args=t._args,e.gridlines.push(n)}function _R(t,e){return void 0===t&&void 0===e||void 0!==t&&void 0!==e}function yR(t,e){const n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&(0===n.length||n.every(t=>r.includes(t)))}function mR(t,e){if(!_R(t.layout,e.layout))return console.log("Not both defined or undefined:",t.bounds,e.bounds),!1;let n=t.layout,r=e.layout;if(!n&&!r)return!0;if(n.type!==r.type)return console.log("layout types are different:",n,r),!1;switch(n.type){case fE.GRID:return function(t,e){t._cellBounds.length!==e._cellBounds.length&&console.log("cell bounds length different:",t,e);for(let n=0;n<t._cellBounds;n++)if(!vR(t._cellBounds[n],e._cellBounds[n]))return console.log("cell bounds not equal:",t,e),!1;for(let n=0;n<t._grid.length;n++)for(let r=0;r<t._grid[n].length;r++)if(t._grid[n][r]!==e._grid[n][r])return console.log("grid not equal",t,e),!1;return t._numCols===e._numCols&&t._numRows===e._numRows&&t._start===e._start&&t._direction===e._direction&&t._rowGap===e._rowGap&&t._colGap===e._colGap&&t._cellHorzAlignment===e._cellHorzAlignment&&t._cellVertAlignment===e._cellVertAlignment&&t._left===e._left&&t._top===e._top}(n,r);case fE.STACK:return function(t,e){return t._orientation===e._orientation&&t._direction===e._direction&&t._left===e._left&&t._top===e._top&&t._horzCellAlignment===e._horzCellAlignment&&t._vertCellAlignment===e._vertCellAlignment&&t._gap===e._gap}(n,r);case fE.PACKING:return function(t,e){return t._x===e._x&&t._y===e._y&&t._width===e._width&&t._height===e._height}(n,r);case fE.FORCE:return function(t,e){return t._x===e._x&&t._y===e._y&&t._iterations===e._iterations&&t._repulsion===e._repulsion&&t._attraction===e._attraction&&t._linkDistance===e._linkDistance}(n,r);case fE.DIRECTED:return function(t,e){return t._width===e._width&&t._height===e._height&&t._top===e._top&&t._left===e._left&&t._edgeSep===e._edgeSep&&t._spreadLinks===e._spreadLinks&&t._direction===e._direction}(n,r);case fE.TIDYTREE:return function(t,e){return t._width===e._width&&t._height===e._height&&t._top===e._top&&t._left===e._left&&t._orientation===e._orientation}(n,r);case fE.STRATA:return function(t,e){return t._direction===e._direction&&t._gap===e._gap}(n,r);case fE.TREEMAP:return function(t,e){return t._width===e._width&&t._height===e._height&&t._top===e._top&&t._left===e._left}(n,r);default:return!1}}function bR(t,e){if(!_R(t.bounds,e.bounds))return console.log("Not both defined or undefined:",t.bounds,e.bounds),!1;let n=t.bounds,r=e.bounds;return!n&&!r||vR(n,r)}function vR(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function xR(t,e){if(!_R(t,e))return console.log("Not both defined or undefined:",t,e),!1;if(t.type!==e.type)return console.log("Different mark types:",t,e),!1;if(t.id!==e.id)return console.log("id not equal:",t,e),!1;if(t.classId!==e.classId)return console.log("class id not equal:",t,e),!1;if(!ER(t,e))return console.log("DataScopes not equal",t,e),!1;if(!bR(t,e))return console.log("Bounds not equal",t,e),!1;if(!_R(t.links,e.links))return console.log("Not both defined or undefined: links ",t.links,e.links),!1;if(!_R(t.source,e.source))return console.log("Not both defined or undefined: source ",t.source,e.source),!1;if(!_R(t.target,e.target))return console.log("Not both defined or undefined: links ",t.target,e.target),!1;if(t.links&&e.links&&t.links.length!==e.links.length)return console.log("unequal number of links",t,e),!1;if(t.source&&e.source&&!xR(t.source,e.source))return console.log("different sources",t.source,e.source),!1;if(t.target&&e.target&&!xR(t.target,e.target))return console.log("different targets",t.target,e.target),!1;switch(t.type){case lT.Arc:case lT.Pie:return wR(t,e)?t.x===e.x&&t.y===e.y&&t.innerRadius===e.innerRadius&&t.outerRadius===e.outerRadius&&t.startAngle===e.startAngle&&t.endAngle===e.endAngle&&t.direction===e.direction&&t.thickness===e.thickness:(console.log("vertices not equal:",t,e),!1);case lT.Area:return wR(t,e)?t.baseline===e.baseline&&t.orientation===e.orientation:(console.log("vertices not equal:",t,e),!1);case lT.Circle:return t.x===e.x&&t.y===e.y&&t.radius===e.radius;case lT.Image:return console.warn("not implemented"),!0;case lT.Line:case lT.Path:case lT.BezierCurve:return!!wR(t,e)||(console.log("vertices not equal:",t,e),!1);case lT.SimpleText:return t.x===e.x&&t.y===e.y&&t.text===e.text&&t.anchor[0]===e.anchor[0]&&t.anchor[1]===e.anchor[1];case lT.Polygon:return wR(t,e)?t.x===e.x&&t.y===e.y&&t.radius===e.radius:(console.log("vertices not equal:",t,e),!1);case lT.Rect:return wR(t,e)?t.width===e.width&&t.height===e.height&&t.top===e.top&&t.left===e.left:(console.log("vertices not equal:",t,e),!1);case lT.Ring:default:return console.warn("not implemented"),!0}}function wR(t,e){if(t.vertices.length!==e.vertices.length)return console.log("unequal number of vertices:",t,e),!1;for(let n=0;n<t.vertices.length;n++){let r=t.vertices[n],i=e.vertices[n];return r.id!==i.id?(console.log("vertex id not equal:",r,i),!1):r.x!==i.x||r.y!==i.y?(console.log("vertex position not equal:",r,i),!1):ER(r,i)?r._polarAngle===i._polarAngle&&r.shape===i.shape&&r.width===i.width&&r.height==i.height&&r.radius==i.radius&&r.fillColor==i.fillColor&&r.opacity==i.opacity&&r.strokeWidth==i.strokeWidth&&r.strokeColor==i.strokeColor:(console.log("vertex data scopes not equal:",r.dataScope,i.dataScope),!1)}}function ER(t,e){if(!_R(t.dataScope,e.dataScope))return console.log("Not both defined or undefined:",t.dataScope,e.dataScope),!1;if(!t.dataScope&&!e.dataScope)return!0;let n=t.dataScope,r=e.dataScope;if(!yR(n._attr2value,r._attr2value))return!1;for(let t in n._attr2value)if(n._attr2value[t]!==r._attr2value[t])return!1;return n._dt.id===r._dt.id&&n._tuples.length===r._tuples.length}function AR(t,e){return t.type!==e.type&&console.log("Different types:",t.type,e.type),[lT.Collection,lT.Glyph,lT.Composite].includes(t.type)?TR(t,e):t instanceof Kw?xR(t,e):void 0}function TR(t,e){let n=t.children.filter(t=>!Object.values(cT).includes(t.type)),r=e.children.filter(t=>!Object.values(cT).includes(t.type));if(n.length!==r.length)return console.log("children length not equal:",n,r),!1;if(t.id!==e.id)return console.log("id not equal:",t,e),!1;if(t.classId!==e.classId)return console.log("class id not equal:",t,e),!1;if(!ER(t,e))return console.log("DataScopes not equal",t.dataScope,e.dataScope),!1;if(!bR(t,e))return console.log("Bounds not equal",t,e),!1;if(!mR(t,e))return console.log("Layouts not equal",t,e),!1;if(!function(t,e){if(!yR(t,e))return console.log("different keys",t,e),!1;for(let n in t)if(t[n]!==e[n])return!1;return!0}(t._sortBy,e._sortBy))return console.log("SortBy not equal",t,e),!1;for(let t=0;t<n.length;t++)if(!AR(n[t],r[t]))return console.log("Not equal",n[t],r[t]),!1;return!0}class SR extends hE{constructor(t){super(),this.type=fE.CIRCULAR,this._x="x"in t?t.x:100,this._y="y"in t?t.y:100,this._radius="radius"in t?t.radius:100}get x(){return this._x}get y(){return this._y}get radius(){return this._radius}clone(){return new SR({x:this._x,y:this._y,radius:this._radius})}}class CR extends hE{constructor(t){super(),this.type=fE.CLUSTER,this._isRadial="radial"in t&&t.radial,this._angleExtent="angleExtent"in t?t.angleExtent:360,this._radius="radius"in t?t.radius:300,this._rootX="x"in t?t.x:300,this._rootY="y"in t?t.y:300,this._orientation="orientation"in t?t.orientation:bE,this._width="width"in t?t.width:800,this._height="height"in t?t.height:600,this._left="left"in t?t.left:60,this._top="top"in t?t.top:100,this._tree="tree"in t?t.tree:void 0}get radius(){return this._radius}get angleExtent(){return this._angleExtent}get x(){return this._rootX}get y(){return this._rootY}get width(){return this._width}get height(){return this._height}get left(){return this._left}get top(){return this._top}isRadial(){return this._isRadial}get orientation(){return this._orientation}clone(){return new CR({radius:this._radius,angleExtent:this._angleExtent,x:this._rootX,y:this._rootY,radial:this._isRadial,orientation:this._orientation,left:this._left,top:this._top,width:this._width,height:this._height,tree:this._tree})}}exports.canClassify=function(t){return t.type===lT.Collection&&!(t.children.length<2)},exports.canDensify=tA,exports.canDivide=AM,exports.canRepeat=_M,exports.csv=async function(t){return async function(t){let e=await pT("GET",t),n=Vs(e.trim(),Zs);return new hT(n,t)}(t)},exports.csvString=function(t){return function(t){let e=Vs(t.trim(),Zs);return new hT(e,"fromString")}(t)},exports.deserialize=function(t){return QM(t)},exports.findElements=nE,exports.getLeafMarks=lE,exports.getPeers=Qw,exports.graphJSON=async function(t){return async function(t){let e=await pT("GET",t);return new UE(JSON.parse(e),t)}(t)},exports.isEqual=function(t,e){return function(t,e){return t.fillColor!==e.fillColor?(console.log("fillColor not equal:",t,e),!1):TR(t,e)}(t,e)},exports.isMark=Zw,exports.isRefElement=function(t){return t.type===lT.Axis||t.type===lT.Legend||t.type===lT.Gridlines},exports.layout=function(t,e){let n=e||{};switch(t.toLowerCase()){case fE.STACK:return new wM(n);case fE.PACKING:return new qM(n);case fE.FORCE:return new HM(n);case fE.DIRECTED:return new YM(n);case fE.TIDYTREE:return new WM(n);case fE.TREEMAP:return new $M(n);case fE.CIRCULAR:return new SR(n);case fE.CLUSTER:return new CR(n);case fE.GRID:default:return new RM(n)}},exports.scene=function(t){return new jM(t)},exports.serialize=function(t){return uR(t)},exports.table=function(t){return new hT(t,"")},exports.treeJSON=async function(t){return async function(t){let e=await pT("GET",t);return new GE(JSON.parse(e),t)}(t)};
1
+ // version: 3.4.0
2
+ "use strict";function t(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function e(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function n(n){let i,o,a;function s(t,e,n=0,r=t.length){if(n<r){if(0!==i(e,e))return r;do{const i=n+r>>>1;o(t[i],e)<0?n=i+1:r=i}while(n<r)}return n}return 2!==n.length?(i=t,o=(e,r)=>t(n(e),r),a=(t,e)=>n(t)-e):(i=n===t||n===e?n:r,o=n,a=n),{left:s,center:function(t,e,n=0,r=t.length){const i=s(t,e,n,r-1);return i>n&&a(t[i-1],e)>-a(t[i],e)?i-1:i},right:function(t,e,n=0,r=t.length){if(n<r){if(0!==i(e,e))return r;do{const i=n+r>>>1;o(t[i],e)<=0?n=i+1:r=i}while(n<r)}return n}}}function r(){return 0}function i(t){return null===t?NaN:+t}const o=n(t),a=o.right,s=o.left,l=n(i).center;const c=h(p),u=h(function(t){const e=p(t);return(t,n,r,i,o)=>{e(t,n,(r<<=2)+0,(i<<=2)+0,o<<=2),e(t,n,r+1,i+1,o),e(t,n,r+2,i+2,o),e(t,n,r+3,i+3,o)}});function h(t){return function(e,n,r=n){if(!((n=+n)>=0))throw new RangeError("invalid rx");if(!((r=+r)>=0))throw new RangeError("invalid ry");let{data:i,width:o,height:a}=e;if(!((o=Math.floor(o))>=0))throw new RangeError("invalid width");if(!((a=Math.floor(void 0!==a?a:i.length/o))>=0))throw new RangeError("invalid height");if(!o||!a||!n&&!r)return e;const s=n&&t(n),l=r&&t(r),c=i.slice();return s&&l?(f(s,c,i,o,a),f(s,i,c,o,a),f(s,c,i,o,a),d(l,i,c,o,a),d(l,c,i,o,a),d(l,i,c,o,a)):s?(f(s,i,c,o,a),f(s,c,i,o,a),f(s,i,c,o,a)):l&&(d(l,i,c,o,a),d(l,c,i,o,a),d(l,i,c,o,a)),e}}function f(t,e,n,r,i){for(let o=0,a=r*i;o<a;)t(e,n,o,o+=r,1)}function d(t,e,n,r,i){for(let o=0,a=r*i;o<r;++o)t(e,n,o,o+a,r)}function p(t){const e=Math.floor(t);if(e===t)return function(t){const e=2*t+1;return(n,r,i,o,a)=>{if(!((o-=a)>=i))return;let s=t*r[i];const l=a*t;for(let t=i,e=i+l;t<e;t+=a)s+=r[Math.min(o,t)];for(let t=i,c=o;t<=c;t+=a)s+=r[Math.min(o,t+l)],n[t]=s/e,s-=r[Math.max(i,t-l)]}}(t);const n=t-e,r=2*t+1;return(t,i,o,a,s)=>{if(!((a-=s)>=o))return;let l=e*i[o];const c=s*e,u=c+s;for(let t=o,e=o+c;t<e;t+=s)l+=i[Math.min(a,t)];for(let e=o,h=a;e<=h;e+=s)l+=i[Math.min(a,e+c)],t[e]=(l+n*(i[Math.max(o,e-u)]+i[Math.min(a,e+u)]))/r,l-=i[Math.max(o,e-c)]}}function g(t,e){let n=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&++n;else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(i=+i)>=i&&++n}return n}function _(t){return 0|t.length}function y(t){return!(t>0)}function m(t){return"object"!=typeof t||"length"in t?t:Array.from(t)}function b(t,e){let n,r=0,i=0,o=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(n=e-i,i+=n/++r,o+=n*(e-i));else{let a=-1;for(let s of t)null!=(s=e(s,++a,t))&&(s=+s)>=s&&(n=s-i,i+=n/++r,o+=n*(s-i))}if(r>1)return o/(r-1)}function v(t,e){const n=b(t,e);return n?Math.sqrt(n):n}function x(t,e){let n,r;if(void 0===e)for(const e of t)null!=e&&(void 0===n?e>=e&&(n=r=e):(n>e&&(n=e),r<e&&(r=e)));else{let i=-1;for(let o of t)null!=(o=e(o,++i,t))&&(void 0===n?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)))}return[n,r]}class w{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let n=0;for(let r=0;r<this._n&&r<32;r++){const i=e[r],o=t+i,a=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);a&&(e[n++]=a),t=o}return e[n]=t,this._n=n+1,this}valueOf(){const t=this._partials;let e,n,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(e=o,n=t[--i],o=e+n,r=n-(o-e),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(n=2*r,e=o+n,n==e-o&&(o=e))}return o}}class E extends Map{constructor(t,e=k){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(T(this,t))}has(t){return super.has(T(this,t))}set(t,e){return super.set(S(this,t),e)}delete(t){return super.delete(C(this,t))}}class A extends Set{constructor(t,e=k){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const e of t)this.add(e)}has(t){return super.has(T(this,t))}add(t){return super.add(S(this,t))}delete(t){return super.delete(C(this,t))}}function T({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function S({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function C({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function k(t){return null!==t&&"object"==typeof t?t.valueOf():t}function M(t){return t}function R(t,...e){return V(t,M,M,e)}function O(t,...e){return V(t,Array.from,M,e)}function N(t,e){for(let n=1,r=e.length;n<r;++n)t=t.flatMap(t=>t.pop().map(([e,n])=>[...t,e,n]));return t}function I(t,e,...n){return V(t,M,e,n)}function L(t,e,...n){return V(t,Array.from,e,n)}function P(t){if(1!==t.length)throw new Error("duplicate key");return t[0]}function V(t,e,n,r){return function t(i,o){if(o>=r.length)return n(i);const a=new E,s=r[o++];let l=-1;for(const t of i){const e=s(t,++l,i),n=a.get(e);n?n.push(t):a.set(e,[t])}for(const[e,n]of a)a.set(e,t(n,o));return e(a)}(t,0)}function D(t,e){return Array.from(e,e=>t[e])}function B(t,...e){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");t=Array.from(t);let[n]=e;if(n&&2!==n.length||e.length>1){const r=Uint32Array.from(t,(t,e)=>e);return e.length>1?(e=e.map(e=>t.map(e)),r.sort((t,n)=>{for(const r of e){const e=F(r[t],r[n]);if(e)return e}})):(n=t.map(n),r.sort((t,e)=>F(n[t],n[e]))),D(t,r)}return t.sort(z(n))}function z(e=t){if(e===t)return F;if("function"!=typeof e)throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||0===r?r:(0===e(n,n))-(0===e(t,t))}}function F(t,e){return(null==t||!(t>=t))-(null==e||!(e>=e))||(t<e?-1:t>e?1:0)}var G=Array.prototype.slice;function j(t){return()=>t}const U=Math.sqrt(50),Y=Math.sqrt(10),H=Math.sqrt(2);function q(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=U?10:o>=Y?5:o>=H?2:1;let s,l,c;return i<0?(c=Math.pow(10,-i)/a,s=Math.round(t*c),l=Math.round(e*c),s/c<t&&++s,l/c>e&&--l,c=-c):(c=Math.pow(10,i)*a,s=Math.round(t/c),l=Math.round(e/c),s*c<t&&++s,l*c>e&&--l),l<s&&.5<=n&&n<2?q(t,e,2*n):[s,l,c]}function W(t,e,n){if(!((n=+n)>0))return[];if((t=+t)===(e=+e))return[t];const r=e<t,[i,o,a]=r?q(e,t,n):q(t,e,n);if(!(o>=i))return[];const s=o-i+1,l=new Array(s);if(r)if(a<0)for(let t=0;t<s;++t)l[t]=(o-t)/-a;else for(let t=0;t<s;++t)l[t]=(o-t)*a;else if(a<0)for(let t=0;t<s;++t)l[t]=(i+t)/-a;else for(let t=0;t<s;++t)l[t]=(i+t)*a;return l}function $(t,e,n){return q(t=+t,e=+e,n=+n)[2]}function X(t,e,n){n=+n;const r=(e=+e)<(t=+t),i=r?$(e,t,n):$(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}function K(t,e,n){let r;for(;;){const i=$(t,e,n);if(i===r||0===i||!isFinite(i))return[t,e];i>0?(t=Math.floor(t/i)*i,e=Math.ceil(e/i)*i):i<0&&(t=Math.ceil(t*i)/i,e=Math.floor(e*i)/i),r=i}}function Z(t){return Math.max(1,Math.ceil(Math.log(g(t))/Math.LN2)+1)}function J(){var t=M,e=x,n=Z;function r(r){Array.isArray(r)||(r=Array.from(r));var i,o,s,l=r.length,c=new Array(l);for(i=0;i<l;++i)c[i]=t(r[i],i,r);var u=e(c),h=u[0],f=u[1],d=n(c,h,f);if(!Array.isArray(d)){const t=f,n=+d;if(e===x&&([h,f]=K(h,f,n)),(d=W(h,f,n))[0]<=h&&(s=$(h,f,n)),d[d.length-1]>=f)if(t>=f&&e===x){const t=$(h,f,n);isFinite(t)&&(t>0?f=(Math.floor(f/t)+1)*t:t<0&&(f=(Math.ceil(f*-t)+1)/-t))}else d.pop()}for(var p=d.length,g=0,_=p;d[g]<=h;)++g;for(;d[_-1]>f;)--_;(g||_<p)&&(d=d.slice(g,_),p=_-g);var y,m=new Array(p+1);for(i=0;i<=p;++i)(y=m[i]=[]).x0=i>0?d[i-1]:h,y.x1=i<p?d[i]:f;if(isFinite(s)){if(s>0)for(i=0;i<l;++i)null!=(o=c[i])&&h<=o&&o<=f&&m[Math.min(p,Math.floor((o-h)/s))].push(r[i]);else if(s<0)for(i=0;i<l;++i)if(null!=(o=c[i])&&h<=o&&o<=f){const t=Math.floor((h-o)*s);m[Math.min(p,t+(d[t]<=o))].push(r[i])}}else for(i=0;i<l;++i)null!=(o=c[i])&&h<=o&&o<=f&&m[a(d,o,0,p)].push(r[i]);return m}return r.value=function(e){return arguments.length?(t="function"==typeof e?e:j(e),r):t},r.domain=function(t){return arguments.length?(e="function"==typeof t?t:j([t[0],t[1]]),r):e},r.thresholds=function(t){return arguments.length?(n="function"==typeof t?t:j(Array.isArray(t)?G.call(t):t),r):n},r}function Q(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n<e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n<i||void 0===n&&i>=i)&&(n=i)}return n}function tt(t,e){let n,r=-1,i=-1;if(void 0===e)for(const e of t)++i,null!=e&&(n<e||void 0===n&&e>=e)&&(n=e,r=i);else for(let o of t)null!=(o=e(o,++i,t))&&(n<o||void 0===n&&o>=o)&&(n=o,r=i);return r}function et(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function nt(t,e){let n,r=-1,i=-1;if(void 0===e)for(const e of t)++i,null!=e&&(n>e||void 0===n&&e>=e)&&(n=e,r=i);else for(let o of t)null!=(o=e(o,++i,t))&&(n>o||void 0===n&&o>=o)&&(n=o,r=i);return r}function rt(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=void 0===i?F:z(i);r>n;){if(r-n>600){const o=r-n+1,a=e-n+1,s=Math.log(o),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1);rt(t,e,Math.max(n,Math.floor(e-a*l/o+c)),Math.min(r,Math.floor(e+(o-a)*l/o+c)),i)}const o=t[e];let a=n,s=r;for(it(t,n,e),i(t[r],o)>0&&it(t,n,r);a<s;){for(it(t,a,s),++a,--s;i(t[a],o)<0;)++a;for(;i(t[s],o)>0;)--s}0===i(t[n],o)?it(t,n,s):(++s,it(t,s,r)),s<=e&&(n=s+1),e<=s&&(r=s-1)}return t}function it(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function ot(e,n=t){let r,i=!1;if(1===n.length){let o;for(const a of e){const e=n(a);(i?t(e,o)>0:0===t(e,e))&&(r=a,o=e,i=!0)}}else for(const t of e)(i?n(t,r)>0:0===n(t,t))&&(r=t,i=!0);return r}function at(t,e,n){if(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}}(t,n)),(r=t.length)&&!isNaN(e=+e)){if(e<=0||r<2)return et(t);if(e>=1)return Q(t);var r,i=(r-1)*e,o=Math.floor(i),a=Q(rt(t,o).subarray(0,o+1));return a+(et(t.subarray(o+1))-a)*(i-o)}}function st(t,e,n=i){if((r=t.length)&&!isNaN(e=+e)){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,o=(r-1)*e,a=Math.floor(o),s=+n(t[a],a,t);return s+(+n(t[a+1],a+1,t)-s)*(o-a)}}function lt(t,e,n=i){if(!isNaN(e=+e)){if(r=Float64Array.from(t,(e,r)=>i(n(t[r],r,t))),e<=0)return nt(r);if(e>=1)return tt(r);var r,o=Uint32Array.from(t,(t,e)=>e),a=r.length-1,s=Math.floor(a*e);return rt(o,s,0,a,(t,e)=>F(r[t],r[e])),(s=ot(o.subarray(0,s+1),t=>r[t]))>=0?s:-1}}function ct(t,e){let n=0,r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++n,r+=e);else{let i=-1;for(let o of t)null!=(o=e(o,++i,t))&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n}function ut(t,e){return at(t,.5,e)}function ht(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}function ft(t,e){return[t,e]}function dt(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),o=new Array(i);++r<i;)o[r]=t+r*n;return o}function pt(e,n=t){if(1===n.length)return nt(e,n);let r,i=-1,o=-1;for(const t of e)++o,(i<0?0===n(t,t):n(t,r)<0)&&(r=t,i=o);return i}var gt=_t(Math.random);function _t(t){return function(e,n=0,r=e.length){let i=r-(n=+n);for(;i;){const r=t()*i--|0,o=e[i+n];e[i+n]=e[r+n],e[r+n]=o}return e}}function yt(t,e){let n=0;if(void 0===e)for(let e of t)(e=+e)&&(n+=e);else{let r=-1;for(let i of t)(i=+e(i,++r,t))&&(n+=i)}return n}function mt(t){if(!(i=t.length))return[];for(var e=-1,n=et(t,bt),r=new Array(n);++e<n;)for(var i,o=-1,a=r[e]=new Array(i);++o<i;)a[o]=t[o][e];return r}function bt(t){return t.length}function vt(t){return t instanceof A?t:new A(t)}function xt(t,e){const n=t[Symbol.iterator](),r=new Set;for(const t of e){const e=wt(t);if(r.has(e))continue;let i,o;for(;({value:i,done:o}=n.next());){if(o)return!1;const t=wt(i);if(r.add(t),Object.is(e,t))break}}return!0}function wt(t){return null!==t&&"object"==typeof t?t.valueOf():t}function Et(t){return t}var At=1e-6;function Tt(t){return"translate("+t+",0)"}function St(t){return"translate(0,"+t+")"}function Ct(t){return e=>+t(e)}function kt(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function Mt(){return!this.__axis}function Rt(t,e){var n=[],r=null,i=null,o=6,a=6,s=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=1===t||4===t?-1:1,u=4===t||2===t?"x":"y",h=1===t||3===t?Tt:St;function f(f){var d=null==r?e.ticks?e.ticks.apply(e,n):e.domain():r,p=null==i?e.tickFormat?e.tickFormat.apply(e,n):Et:i,g=Math.max(o,0)+s,_=e.range(),y=+_[0]+l,m=+_[_.length-1]+l,b=(e.bandwidth?kt:Ct)(e.copy(),l),v=f.selection?f.selection():f,x=v.selectAll(".domain").data([null]),w=v.selectAll(".tick").data(d,e).order(),E=w.exit(),A=w.enter().append("g").attr("class","tick"),T=w.select("line"),S=w.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),w=w.merge(A),T=T.merge(A.append("line").attr("stroke","currentColor").attr(u+"2",c*o)),S=S.merge(A.append("text").attr("fill","currentColor").attr(u,c*g).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),f!==v&&(x=x.transition(f),w=w.transition(f),T=T.transition(f),S=S.transition(f),E=E.transition(f).attr("opacity",At).attr("transform",function(t){return isFinite(t=b(t))?h(t+l):this.getAttribute("transform")}),A.attr("opacity",At).attr("transform",function(t){var e=this.parentNode.__axis;return h((e&&isFinite(e=e(t))?e:b(t))+l)})),E.remove(),x.attr("d",4===t||2===t?a?"M"+c*a+","+y+"H"+l+"V"+m+"H"+c*a:"M"+l+","+y+"V"+m:a?"M"+y+","+c*a+"V"+l+"H"+m+"V"+c*a:"M"+y+","+l+"H"+m),w.attr("opacity",1).attr("transform",function(t){return h(b(t)+l)}),T.attr(u+"2",c*o),S.attr(u,c*g).text(p),v.filter(Mt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),v.each(function(){this.__axis=b})}return f.scale=function(t){return arguments.length?(e=t,f):e},f.ticks=function(){return n=Array.from(arguments),f},f.tickArguments=function(t){return arguments.length?(n=null==t?[]:Array.from(t),f):n.slice()},f.tickValues=function(t){return arguments.length?(r=null==t?null:Array.from(t),f):r&&r.slice()},f.tickFormat=function(t){return arguments.length?(i=t,f):i},f.tickSize=function(t){return arguments.length?(o=a=+t,f):o},f.tickSizeInner=function(t){return arguments.length?(o=+t,f):o},f.tickSizeOuter=function(t){return arguments.length?(a=+t,f):a},f.tickPadding=function(t){return arguments.length?(s=+t,f):s},f.offset=function(t){return arguments.length?(l=+t,f):l},f}var Ot={value:()=>{}};function Nt(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new It(r)}function It(t){this._=t}function Lt(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Pt(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Ot,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}It.prototype=Nt.prototype={constructor:It,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)i[n]=Pt(i[n],t.name,e);else if(null==e)for(n in i)i[n]=Pt(i[n],t.name,null);return this}for(;++a<s;)if((n=(t=o[a]).type)&&(n=Lt(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new It(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var Vt="http://www.w3.org/1999/xhtml",Dt={svg:"http://www.w3.org/2000/svg",xhtml:Vt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Bt(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),Dt.hasOwnProperty(e)?{space:Dt[e],local:t}:t}function zt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Vt&&e.documentElement.namespaceURI===Vt?e.createElement(t):e.createElementNS(n,t)}}function Ft(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Gt(t){var e=Bt(t);return(e.local?Ft:zt)(e)}function jt(){}function Ut(t){return null==t?jt:function(){return this.querySelector(t)}}function Yt(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function Ht(){return[]}function qt(t){return null==t?Ht:function(){return this.querySelectorAll(t)}}function Wt(t){return function(){return this.matches(t)}}function $t(t){return function(e){return e.matches(t)}}var Xt=Array.prototype.find;function Kt(){return this.firstElementChild}var Zt=Array.prototype.filter;function Jt(){return Array.from(this.children)}function Qt(t){return new Array(t.length)}function te(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function ee(t,e,n,r,i,o){for(var a,s=0,l=e.length,c=o.length;s<c;++s)(a=e[s])?(a.__data__=o[s],r[s]=a):n[s]=new te(t,o[s]);for(;s<l;++s)(a=e[s])&&(i[s]=a)}function ne(t,e,n,r,i,o,a){var s,l,c,u=new Map,h=e.length,f=o.length,d=new Array(h);for(s=0;s<h;++s)(l=e[s])&&(d[s]=c=a.call(l,l.__data__,s,e)+"",u.has(c)?i[s]=l:u.set(c,l));for(s=0;s<f;++s)c=a.call(t,o[s],s,o)+"",(l=u.get(c))?(r[s]=l,l.__data__=o[s],u.delete(c)):n[s]=new te(t,o[s]);for(s=0;s<h;++s)(l=e[s])&&u.get(d[s])===l&&(i[s]=l)}function re(t){return t.__data__}function ie(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function oe(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ae(t){return function(){this.removeAttribute(t)}}function se(t){return function(){this.removeAttributeNS(t.space,t.local)}}function le(t,e){return function(){this.setAttribute(t,e)}}function ce(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function ue(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function he(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function fe(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function de(t){return function(){this.style.removeProperty(t)}}function pe(t,e,n){return function(){this.style.setProperty(t,e,n)}}function ge(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function _e(t,e){return t.style.getPropertyValue(e)||fe(t).getComputedStyle(t,null).getPropertyValue(e)}function ye(t){return function(){delete this[t]}}function me(t,e){return function(){this[t]=e}}function be(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function ve(t){return t.trim().split(/^|\s+/)}function xe(t){return t.classList||new we(t)}function we(t){this._node=t,this._names=ve(t.getAttribute("class")||"")}function Ee(t,e){for(var n=xe(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function Ae(t,e){for(var n=xe(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function Te(t){return function(){Ee(this,t)}}function Se(t){return function(){Ae(this,t)}}function Ce(t,e){return function(){(e.apply(this,arguments)?Ee:Ae)(this,t)}}function ke(){this.textContent=""}function Me(t){return function(){this.textContent=t}}function Re(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Oe(){this.innerHTML=""}function Ne(t){return function(){this.innerHTML=t}}function Ie(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Le(){this.nextSibling&&this.parentNode.appendChild(this)}function Pe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ve(){return null}function De(){var t=this.parentNode;t&&t.removeChild(this)}function Be(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ze(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Fe(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r<o;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?e.length=i:delete this.__on}}}function Ge(t,e,n){return function(){var r,i=this.__on,o=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var a=0,s=i.length;a<s;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),void(r.value=e);this.addEventListener(t.type,o,n),r={type:t.type,name:t.name,value:e,listener:o,options:n},i?i.push(r):this.__on=[r]}}function je(t,e,n){var r=fe(t),i=r.CustomEvent;"function"==typeof i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Ue(t,e){return function(){return je(this,t,e)}}function Ye(t,e){return function(){return je(this,t,e.apply(this,arguments))}}te.prototype={constructor:te,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},we.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var He=[null];function qe(t,e){this._groups=t,this._parents=e}function We(){return new qe([[document.documentElement]],He)}function $e(t){return"string"==typeof t?new qe([[document.querySelector(t)]],[document.documentElement]):new qe([[t]],He)}qe.prototype=We.prototype={constructor:qe,select:function(t){"function"!=typeof t&&(t=Ut(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a,s=e[i],l=s.length,c=r[i]=new Array(l),u=0;u<l;++u)(o=s[u])&&(a=t.call(o,o.__data__,u,s))&&("__data__"in o&&(a.__data__=o.__data__),c[u]=a);return new qe(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return Yt(t.apply(this,arguments))}}(t):qt(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var a,s=e[o],l=s.length,c=0;c<l;++c)(a=s[c])&&(r.push(t.call(a,a.__data__,c,s)),i.push(a));return new qe(r,i)},selectChild:function(t){return this.select(null==t?Kt:function(t){return function(){return Xt.call(this.children,t)}}("function"==typeof t?t:$t(t)))},selectChildren:function(t){return this.selectAll(null==t?Jt:function(t){return function(){return Zt.call(this.children,t)}}("function"==typeof t?t:$t(t)))},filter:function(t){"function"!=typeof t&&(t=Wt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,l=r[i]=[],c=0;c<s;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&l.push(o);return new qe(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,re);var n=e?ne:ee,r=this._parents,i=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var o=i.length,a=new Array(o),s=new Array(o),l=new Array(o),c=0;c<o;++c){var u=r[c],h=i[c],f=h.length,d=ie(t.call(u,u&&u.__data__,c,r)),p=d.length,g=s[c]=new Array(p),_=a[c]=new Array(p);n(u,h,g,_,l[c]=new Array(f),d,e);for(var y,m,b=0,v=0;b<p;++b)if(y=g[b]){for(b>=v&&(v=b+1);!(m=_[v])&&++v<p;);y._next=m||null}}return(a=new qe(a,r))._enter=s,a._exit=l,a},enter:function(){return new qe(this._enter||this._groups.map(Qt),this._parents)},exit:function(){return new qe(this._exit||this._groups.map(Qt),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==n?o.remove():n(o),r&&i?r.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),l=0;l<a;++l)for(var c,u=n[l],h=r[l],f=u.length,d=s[l]=new Array(f),p=0;p<f;++p)(c=u[p]||h[p])&&(d[p]=c);for(;l<i;++l)s[l]=n[l];return new qe(s,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=oe);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a,s=n[o],l=s.length,c=i[o]=new Array(l),u=0;u<l;++u)(a=s[u])&&(c[u]=a);c.sort(e)}return new qe(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,o=e[n],a=0,s=o.length;a<s;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,e){var n=Bt(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?se:ae:"function"==typeof e?n.local?he:ue:n.local?ce:le)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?de:"function"==typeof e?ge:pe)(t,e,null==n?"":n)):_e(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?ye:"function"==typeof e?be:me)(t,e)):this.node()[t]},classed:function(t,e){var n=ve(t+"");if(arguments.length<2){for(var r=xe(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?Ce:e?Te:Se)(n,e))},text:function(t){return arguments.length?this.each(null==t?ke:("function"==typeof t?Re:Me)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Oe:("function"==typeof t?Ie:Ne)(t)):this.node().innerHTML},raise:function(){return this.each(Le)},lower:function(){return this.each(Pe)},append:function(t){var e="function"==typeof t?t:Gt(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:Gt(t),r=null==e?Ve:"function"==typeof e?e:Ut(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(De)},clone:function(t){return this.select(t?ze:Be)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,o=function(t){return t.trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}(t+""),a=o.length;if(!(arguments.length<2)){for(s=e?Ge:Fe,r=0;r<a;++r)this.each(s(o[r],e,n));return this}var s=this.node().__on;if(s)for(var l,c=0,u=s.length;c<u;++c)for(r=0,l=s[c];r<a;++r)if((i=o[r]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?Ye:Ue)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,i=t[e],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};var Xe=0;function Ke(){return new Ze}function Ze(){this._="@"+(++Xe).toString(36)}function Je(t){let e;for(;e=t.sourceEvent;)t=e;return t}function Qe(t,e){if(t=Je(t),void 0===e&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(e.getScreenCTM().inverse())).x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}Ze.prototype=Ke.prototype={constructor:Ze,get:function(t){for(var e=this._;!(e in t);)if(!(t=t.parentNode))return;return t[e]},set:function(t,e){return t[this._]=e},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};const tn={passive:!1},en={capture:!0,passive:!1};function nn(t){t.stopImmediatePropagation()}function rn(t){t.preventDefault(),t.stopImmediatePropagation()}function on(t){var e=t.document.documentElement,n=$e(t).on("dragstart.drag",rn,en);"onselectstart"in e?n.on("selectstart.drag",rn,en):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function an(t,e){var n=t.document.documentElement,r=$e(t).on("dragstart.drag",null);e&&(r.on("click.drag",rn,en),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var sn=t=>()=>t;function ln(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}function cn(t){return!t.ctrlKey&&!t.button}function un(){return this.parentNode}function hn(t,e){return null==e?{x:t.x,y:t.y}:e}function fn(){return navigator.maxTouchPoints||"ontouchstart"in this}function dn(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function pn(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function gn(){}ln.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var _n=.7,yn=1/_n,mn="\\s*([+-]?\\d+)\\s*",bn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",vn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xn=/^#([0-9a-f]{3,8})$/,wn=new RegExp(`^rgb\\(${mn},${mn},${mn}\\)$`),En=new RegExp(`^rgb\\(${vn},${vn},${vn}\\)$`),An=new RegExp(`^rgba\\(${mn},${mn},${mn},${bn}\\)$`),Tn=new RegExp(`^rgba\\(${vn},${vn},${vn},${bn}\\)$`),Sn=new RegExp(`^hsl\\(${bn},${vn},${vn}\\)$`),Cn=new RegExp(`^hsla\\(${bn},${vn},${vn},${bn}\\)$`),kn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Mn(){return this.rgb().formatHex()}function Rn(){return this.rgb().formatRgb()}function On(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=xn.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Nn(e):3===n?new Vn(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?In(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?In(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=wn.exec(t))?new Vn(e[1],e[2],e[3],1):(e=En.exec(t))?new Vn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=An.exec(t))?In(e[1],e[2],e[3],e[4]):(e=Tn.exec(t))?In(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Sn.exec(t))?jn(e[1],e[2]/100,e[3]/100,1):(e=Cn.exec(t))?jn(e[1],e[2]/100,e[3]/100,e[4]):kn.hasOwnProperty(t)?Nn(kn[t]):"transparent"===t?new Vn(NaN,NaN,NaN,0):null}function Nn(t){return new Vn(t>>16&255,t>>8&255,255&t,1)}function In(t,e,n,r){return r<=0&&(t=e=n=NaN),new Vn(t,e,n,r)}function Ln(t){return t instanceof gn||(t=On(t)),t?new Vn((t=t.rgb()).r,t.g,t.b,t.opacity):new Vn}function Pn(t,e,n,r){return 1===arguments.length?Ln(t):new Vn(t,e,n,null==r?1:r)}function Vn(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Dn(){return`#${Gn(this.r)}${Gn(this.g)}${Gn(this.b)}`}function Bn(){const t=zn(this.opacity);return`${1===t?"rgb(":"rgba("}${Fn(this.r)}, ${Fn(this.g)}, ${Fn(this.b)}${1===t?")":`, ${t})`}`}function zn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Fn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Gn(t){return((t=Fn(t))<16?"0":"")+t.toString(16)}function jn(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Hn(t,e,n,r)}function Un(t){if(t instanceof Hn)return new Hn(t.h,t.s,t.l,t.opacity);if(t instanceof gn||(t=On(t)),!t)return new Hn;if(t instanceof Hn)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n<r):n===o?(r-e)/s+2:(e-n)/s+4,s/=l<.5?o+i:2-o-i,a*=60):s=l>0&&l<1?0:a,new Hn(a,s,l,t.opacity)}function Yn(t,e,n,r){return 1===arguments.length?Un(t):new Hn(t,e,n,null==r?1:r)}function Hn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function qn(t){return(t=(t||0)%360)<0?t+360:t}function Wn(t){return Math.max(0,Math.min(1,t||0))}function $n(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}dn(gn,On,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Mn,formatHex:Mn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Un(this).formatHsl()},formatRgb:Rn,toString:Rn}),dn(Vn,Pn,pn(gn,{brighter(t){return t=null==t?yn:Math.pow(yn,t),new Vn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?_n:Math.pow(_n,t),new Vn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Vn(Fn(this.r),Fn(this.g),Fn(this.b),zn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Dn,formatHex:Dn,formatHex8:function(){return`#${Gn(this.r)}${Gn(this.g)}${Gn(this.b)}${Gn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Bn,toString:Bn})),dn(Hn,Yn,pn(gn,{brighter(t){return t=null==t?yn:Math.pow(yn,t),new Hn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?_n:Math.pow(_n,t),new Hn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Vn($n(t>=240?t-240:t+120,i,r),$n(t,i,r),$n(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Hn(qn(this.h),Wn(this.s),Wn(this.l),zn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=zn(this.opacity);return`${1===t?"hsl(":"hsla("}${qn(this.h)}, ${100*Wn(this.s)}%, ${100*Wn(this.l)}%${1===t?")":`, ${t})`}`}}));const Xn=Math.PI/180,Kn=180/Math.PI,Zn=.96422,Jn=.82521,Qn=4/29,tr=6/29,er=3*tr*tr,nr=tr*tr*tr;function rr(t){if(t instanceof or)return new or(t.l,t.a,t.b,t.opacity);if(t instanceof fr)return dr(t);t instanceof Vn||(t=Ln(t));var e,n,r=cr(t.r),i=cr(t.g),o=cr(t.b),a=ar((.2225045*r+.7168786*i+.0606169*o)/1);return r===i&&i===o?e=n=a:(e=ar((.4360747*r+.3850649*i+.1430804*o)/Zn),n=ar((.0139322*r+.0971045*i+.7141733*o)/Jn)),new or(116*a-16,500*(e-a),200*(a-n),t.opacity)}function ir(t,e,n,r){return 1===arguments.length?rr(t):new or(t,e,n,null==r?1:r)}function or(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function ar(t){return t>nr?Math.pow(t,1/3):t/er+Qn}function sr(t){return t>tr?t*t*t:er*(t-Qn)}function lr(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function cr(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ur(t){if(t instanceof fr)return new fr(t.h,t.c,t.l,t.opacity);if(t instanceof or||(t=rr(t)),0===t.a&&0===t.b)return new fr(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*Kn;return new fr(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function hr(t,e,n,r){return 1===arguments.length?ur(t):new fr(t,e,n,null==r?1:r)}function fr(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function dr(t){if(isNaN(t.h))return new or(t.l,0,0,t.opacity);var e=t.h*Xn;return new or(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}dn(or,ir,pn(gn,{brighter(t){return new or(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new or(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new Vn(lr(3.1338561*(e=Zn*sr(e))-1.6168667*(t=1*sr(t))-.4906146*(n=Jn*sr(n))),lr(-.9787684*e+1.9161415*t+.033454*n),lr(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),dn(fr,hr,pn(gn,{brighter(t){return new fr(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new fr(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return dr(this).rgb()}}));var pr=-.14861,gr=1.78277,_r=-.29227,yr=-.90649,mr=1.97294,br=mr*yr,vr=mr*gr,xr=gr*_r-yr*pr;function wr(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof Er)return new Er(t.h,t.s,t.l,t.opacity);t instanceof Vn||(t=Ln(t));var e=t.r/255,n=t.g/255,r=t.b/255,i=(xr*r+br*e-vr*n)/(xr+br-vr),o=r-i,a=(mr*(n-i)-_r*o)/yr,s=Math.sqrt(a*a+o*o)/(mr*i*(1-i)),l=s?Math.atan2(a,o)*Kn-120:NaN;return new Er(l<0?l+360:l,s,i,t.opacity)}(t):new Er(t,e,n,null==r?1:r)}function Er(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Ar(t,e,n,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*r+a*i)/6}function Tr(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=r<e-1?t[r+2]:2*o-i;return Ar((n-r/e)*e,a,i,o,s)}}function Sr(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),i=t[(r+e-1)%e],o=t[r%e],a=t[(r+1)%e],s=t[(r+2)%e];return Ar((n-r/e)*e,i,o,a,s)}}dn(Er,wr,pn(gn,{brighter(t){return t=null==t?yn:Math.pow(yn,t),new Er(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?_n:Math.pow(_n,t),new Er(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*Xn,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new Vn(255*(e+n*(pr*r+gr*i)),255*(e+n*(_r*r+yr*i)),255*(e+n*(mr*r)),this.opacity)}}));var Cr=t=>()=>t;function kr(t,e){return function(n){return t+n*e}}function Mr(t,e){var n=e-t;return n?kr(t,n>180||n<-180?n-360*Math.round(n/360):n):Cr(isNaN(t)?e:t)}function Rr(t){return 1===(t=+t)?Or:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Cr(isNaN(e)?n:e)}}function Or(t,e){var n=e-t;return n?kr(t,n):Cr(isNaN(t)?e:t)}var Nr=function t(e){var n=Rr(e);function r(t,e){var r=n((t=Pn(t)).r,(e=Pn(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=Or(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function Ir(t){return function(e){var n,r,i=e.length,o=new Array(i),a=new Array(i),s=new Array(i);for(n=0;n<i;++n)r=Pn(e[n]),o[n]=r.r||0,a[n]=r.g||0,s[n]=r.b||0;return o=t(o),a=t(a),s=t(s),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=s(t),r+""}}}var Lr=Ir(Tr),Pr=Ir(Sr);function Vr(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(o){for(n=0;n<r;++n)i[n]=t[n]*(1-o)+e[n]*o;return i}}function Dr(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Br(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(n=0;n<i;++n)o[n]=Hr(t[n],e[n]);for(;n<r;++n)a[n]=e[n];return function(t){for(n=0;n<i;++n)a[n]=o[n](t);return a}}function zr(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Fr(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Gr(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=Hr(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}var jr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ur=new RegExp(jr.source,"g");function Yr(t,e){var n,r,i,o=jr.lastIndex=Ur.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(n=jr.exec(t))&&(r=Ur.exec(e));)(i=r.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:Fr(n,r)})),o=Ur.lastIndex;return o<e.length&&(i=e.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,r=0;r<e;++r)s[(n=l[r]).i]=n.x(t);return s.join("")})}function Hr(t,e){var n,r=typeof e;return null==e||"boolean"===r?Cr(e):("number"===r?Fr:"string"===r?(n=On(e))?(e=n,Nr):Yr:e instanceof On?Nr:e instanceof Date?zr:Dr(e)?Vr:Array.isArray(e)?Br:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Gr:Fr)(t,e)}function qr(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var Wr,$r=180/Math.PI,Xr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Kr(t,e,n,r,i,o){var a,s,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),t*r<e*n&&(t=-t,e=-e,l=-l,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*$r,skewX:Math.atan(l)*$r,scaleX:a,scaleY:s}}function Zr(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var s=[],l=[];return o=t(o),a=t(a),function(t,r,i,o,a,s){if(t!==i||r!==o){var l=a.push("translate(",null,e,null,n);s.push({i:l-4,x:Fr(t,i)},{i:l-2,x:Fr(r,o)})}else(i||o)&&a.push("translate("+i+e+o+n)}(o.translateX,o.translateY,a.translateX,a.translateY,s,l),function(t,e,n,o){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Fr(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,l),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Fr(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,l),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Fr(t,n)},{i:s-2,x:Fr(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,l),o=a=null,function(t){for(var e,n=-1,r=l.length;++n<r;)s[(e=l[n]).i]=e.x(t);return s.join("")}}}var Jr=Zr(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Xr:Kr(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),Qr=Zr(function(t){return null==t?Xr:(Wr||(Wr=document.createElementNS("http://www.w3.org/2000/svg","g")),Wr.setAttribute("transform",t),(t=Wr.transform.baseVal.consolidate())?Kr((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Xr)},", ",")",")");function ti(t){return((t=Math.exp(t))+1/t)/2}var ei=function t(e,n,r){function i(t,i){var o,a,s=t[0],l=t[1],c=t[2],u=i[0],h=i[1],f=i[2],d=u-s,p=h-l,g=d*d+p*p;if(g<1e-12)a=Math.log(f/c)/e,o=function(t){return[s+t*d,l+t*p,c*Math.exp(e*t*a)]};else{var _=Math.sqrt(g),y=(f*f-c*c+r*g)/(2*c*n*_),m=(f*f-c*c-r*g)/(2*f*n*_),b=Math.log(Math.sqrt(y*y+1)-y),v=Math.log(Math.sqrt(m*m+1)-m);a=(v-b)/e,o=function(t){var r=t*a,i=ti(b),o=c/(n*_)*(i*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(e*r+b)-function(t){return((t=Math.exp(t))-1/t)/2}(b));return[s+o*d,l+o*p,c*i/ti(e*r+b)]}}return o.duration=1e3*a*e/Math.SQRT2,o}return i.rho=function(e){var n=Math.max(.001,+e),r=n*n;return t(n,r,r*r)},i}(Math.SQRT2,2,4);function ni(t){return function(e,n){var r=t((e=Yn(e)).h,(n=Yn(n)).h),i=Or(e.s,n.s),o=Or(e.l,n.l),a=Or(e.opacity,n.opacity);return function(t){return e.h=r(t),e.s=i(t),e.l=o(t),e.opacity=a(t),e+""}}}var ri=ni(Mr),ii=ni(Or);function oi(t){return function(e,n){var r=t((e=hr(e)).h,(n=hr(n)).h),i=Or(e.c,n.c),o=Or(e.l,n.l),a=Or(e.opacity,n.opacity);return function(t){return e.h=r(t),e.c=i(t),e.l=o(t),e.opacity=a(t),e+""}}}var ai=oi(Mr),si=oi(Or);function li(t){return function e(n){function r(e,r){var i=t((e=wr(e)).h,(r=wr(r)).h),o=Or(e.s,r.s),a=Or(e.l,r.l),s=Or(e.opacity,r.opacity);return function(t){return e.h=i(t),e.s=o(t),e.l=a(Math.pow(t,n)),e.opacity=s(t),e+""}}return n=+n,r.gamma=e,r}(1)}var ci=li(Mr),ui=li(Or);function hi(t,e){void 0===e&&(e=t,t=Hr);for(var n=0,r=e.length-1,i=e[0],o=new Array(r<0?0:r);n<r;)o[n]=t(i,i=e[++n]);return function(t){var e=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return o[e](t-e)}}var fi,di,pi=0,gi=0,_i=0,yi=0,mi=0,bi=0,vi="object"==typeof performance&&performance.now?performance:Date,xi="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function wi(){return mi||(xi(Ei),mi=vi.now()+bi)}function Ei(){mi=0}function Ai(){this._call=this._time=this._next=null}function Ti(t,e,n){var r=new Ai;return r.restart(t,e,n),r}function Si(){wi(),++pi;for(var t,e=fi;e;)(t=mi-e._time)>=0&&e._call.call(void 0,t),e=e._next;--pi}function Ci(){mi=(yi=vi.now())+bi,pi=gi=0;try{Si()}finally{pi=0,function(){var t,e,n=fi,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:fi=e);di=t,Mi(r)}(),mi=0}}function ki(){var t=vi.now(),e=t-yi;e>1e3&&(bi-=e,yi=t)}function Mi(t){pi||(gi&&(gi=clearTimeout(gi)),t-mi>24?(t<1/0&&(gi=setTimeout(Ci,t-vi.now()-bi)),_i&&(_i=clearInterval(_i))):(_i||(yi=vi.now(),_i=setInterval(ki,1e3)),pi=1,xi(Ci)))}function Ri(t,e,n){var r=new Ai;return e=null==e?0:+e,r.restart(n=>{r.stop(),t(n+e)},e,n),r}Ai.prototype=Ti.prototype={constructor:Ai,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?wi():+n)+(null==e?0:+e),this._next||di===this||(di?di._next=this:fi=this,di=this),this._call=t,this._time=n,Mi()},stop:function(){this._call&&(this._call=null,this._time=1/0,Mi())}};var Oi=Nt("start","end","cancel","interrupt"),Ni=[];function Ii(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(t){n.state=1,n.timer.restart(a,n.delay,n.time),n.delay<=t&&a(t-n.delay)}function a(o){var c,u,h,f;if(1!==n.state)return l();for(c in i)if((f=i[c]).name===n.name){if(3===f.state)return Ri(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[c]):+c<e&&(f.state=6,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete i[c])}if(Ri(function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(o))}),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(h=n.tween.length),c=0,u=-1;c<h;++c)(f=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(r[++u]=f);r.length=u+1}}function s(e){for(var i=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(l),n.state=5,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){for(var r in n.state=6,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=Ti(o,0,n.time)}(t,n,{name:e,index:r,group:i,on:Oi,tween:Ni,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:0})}function Li(t,e){var n=Vi(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function Pi(t,e){var n=Vi(t,e);if(n.state>3)throw new Error("too late; already running");return n}function Vi(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Di(t,e){var n,r,i,o=t.__transition,a=!0;if(o){for(i in e=null==e?null:e+"",o)(n=o[i]).name===e?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):a=!1;a&&delete t.__transition}}function Bi(t,e){var n,r;return function(){var i=Pi(this,t),o=i.tween;if(o!==n)for(var a=0,s=(r=n=o).length;a<s;++a)if(r[a].name===e){(r=r.slice()).splice(a,1);break}i.tween=r}}function zi(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var o=Pi(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:e,value:n},l=0,c=i.length;l<c;++l)if(i[l].name===e){i[l]=s;break}l===c&&i.push(s)}o.tween=i}}function Fi(t,e,n){var r=t._id;return t.each(function(){var t=Pi(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return Vi(t,r).value[e]}}function Gi(t,e){var n;return("number"==typeof e?Fr:e instanceof On?Nr:(n=On(e))?(e=n,Nr):Yr)(t,e)}function ji(t){return function(){this.removeAttribute(t)}}function Ui(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Yi(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=e(r=a,n)}}function Hi(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=e(r=a,n)}}function qi(t,e,n){var r,i,o;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttribute(t))===(s=l+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,l));this.removeAttribute(t)}}function Wi(t,e,n){var r,i,o;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttributeNS(t.space,t.local))===(s=l+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,l));this.removeAttributeNS(t.space,t.local)}}function $i(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,i)),n}return i._value=e,i}function Xi(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,i)),n}return i._value=e,i}function Ki(t,e){return function(){Li(this,t).delay=+e.apply(this,arguments)}}function Zi(t,e){return e=+e,function(){Li(this,t).delay=e}}function Ji(t,e){return function(){Pi(this,t).duration=+e.apply(this,arguments)}}function Qi(t,e){return e=+e,function(){Pi(this,t).duration=e}}var to=We.prototype.constructor;function eo(t){return function(){this.style.removeProperty(t)}}var no=0;function ro(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function io(t){return We().transition(t)}function oo(){return++no}var ao=We.prototype;ro.prototype=io.prototype={constructor:ro,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Ut(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s,l,c=r[a],u=c.length,h=o[a]=new Array(u),f=0;f<u;++f)(s=c[f])&&(l=t.call(s,s.__data__,f,c))&&("__data__"in s&&(l.__data__=s.__data__),h[f]=l,Ii(h[f],e,n,f,h,Vi(s,n)));return new ro(o,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=qt(t));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var l,c=r[s],u=c.length,h=0;h<u;++h)if(l=c[h]){for(var f,d=t.call(l,l.__data__,h,c),p=Vi(l,n),g=0,_=d.length;g<_;++g)(f=d[g])&&Ii(f,e,n,g,d,p);o.push(d),a.push(l)}return new ro(o,a,e,n)},selectChild:ao.selectChild,selectChildren:ao.selectChildren,filter:function(t){"function"!=typeof t&&(t=Wt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,l=r[i]=[],c=0;c<s;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&l.push(o);return new ro(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var l,c=e[s],u=n[s],h=c.length,f=a[s]=new Array(h),d=0;d<h;++d)(l=c[d]||u[d])&&(f[d]=l);for(;s<r;++s)a[s]=e[s];return new ro(a,this._parents,this._name,this._id)},selection:function(){return new to(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=oo(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],l=s.length,c=0;c<l;++c)if(a=s[c]){var u=Vi(a,e);Ii(a,t,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new ro(r,this._parents,t,n)},call:ao.call,nodes:ao.nodes,node:ao.node,size:ao.size,empty:ao.empty,each:ao.each,on:function(t,e){var n=this._id;return arguments.length<2?Vi(this.node(),n).on.on(t):this.each(function(t,e,n){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t})}(e)?Li:Pi;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}(n,t,e))},attr:function(t,e){var n=Bt(t),r="transform"===n?Qr:Gi;return this.attrTween(t,"function"==typeof e?(n.local?Wi:qi)(n,r,Fi(this,"attr."+t,e)):null==e?(n.local?Ui:ji)(n):(n.local?Hi:Yi)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=Bt(t);return this.tween(n,(r.local?$i:Xi)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?Jr:Gi;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=_e(this,t),a=(this.style.removeProperty(t),_e(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,eo(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=_e(this,t),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(t),l=s=_e(this,t)),a===l?null:a===r&&l===i?o:(i=l,o=e(r=a,s))}}(t,r,Fi(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,s="end."+a;return function(){var l=Pi(this,t),c=l.on,u=null==l.value[a]?o||(o=eo(e)):void 0;c===n&&i===u||(r=(n=c).copy()).on(s,i=u),l.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var a=_e(this,t);return a===o?null:a===r?i:i=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Fi(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=Vi(this.node(),n).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==e?Bi:zi)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Ki:Zi)(e,t)):Vi(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Ji:Qi)(e,t)):Vi(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){Pi(this,t).ease=e}}(e,t)):Vi(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;Pi(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(o,a){var s={value:a},l={value:function(){0===--i&&o()}};n.each(function(){var n=Pi(this,r),i=n.on;i!==t&&((e=(t=i).copy())._.cancel.push(s),e._.interrupt.push(s),e._.end.push(l)),n.on=e}),0===i&&o()})},[Symbol.iterator]:ao[Symbol.iterator]};function so(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function lo(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var co=function t(e){function n(t){return Math.pow(t,e)}return e=+e,n.exponent=t,n}(3),uo=function t(e){function n(t){return 1-Math.pow(1-t,e)}return e=+e,n.exponent=t,n}(3),ho=function t(e){function n(t){return((t*=2)<=1?Math.pow(t,e):2-Math.pow(2-t,e))/2}return e=+e,n.exponent=t,n}(3),fo=Math.PI,po=fo/2;function go(t){return(1-Math.cos(fo*t))/2}function _o(t){return 1.0009775171065494*(Math.pow(2,-10*t)-.0009765625)}function yo(t){return((t*=2)<=1?_o(1-t):2-_o(t-1))/2}function mo(t){return((t*=2)<=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}var bo=4/11,vo=6/11,xo=8/11,wo=9/11,Eo=10/11,Ao=21/22,To=7.5625;function So(t){return(t=+t)<bo?To*t*t:t<xo?To*(t-=vo)*t+.75:t<Eo?To*(t-=wo)*t+.9375:To*(t-=Ao)*t+.984375}var Co=1.70158,ko=function t(e){function n(t){return(t=+t)*t*(e*(t-1)+t)}return e=+e,n.overshoot=t,n}(Co),Mo=function t(e){function n(t){return--t*t*((t+1)*e+t)+1}return e=+e,n.overshoot=t,n}(Co),Ro=function t(e){function n(t){return((t*=2)<1?t*t*((e+1)*t-e):(t-=2)*t*((e+1)*t+e)+2)/2}return e=+e,n.overshoot=t,n}(Co),Oo=2*Math.PI,No=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=Oo);function i(t){return e*_o(- --t)*Math.sin((r-t)/n)}return i.amplitude=function(e){return t(e,n*Oo)},i.period=function(n){return t(e,n)},i}(1,.3),Io=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=Oo);function i(t){return 1-e*_o(t=+t)*Math.sin((t+r)/n)}return i.amplitude=function(e){return t(e,n*Oo)},i.period=function(n){return t(e,n)},i}(1,.3),Lo=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=Oo);function i(t){return((t=2*t-1)<0?e*_o(-t)*Math.sin((r-t)/n):2-e*_o(t)*Math.sin((r+t)/n))/2}return i.amplitude=function(e){return t(e,n*Oo)},i.period=function(n){return t(e,n)},i}(1,.3),Po={time:null,delay:0,duration:250,ease:lo};function Vo(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}We.prototype.interrupt=function(t){return this.each(function(){Di(this,t)})},We.prototype.transition=function(t){var e,n;t instanceof ro?(e=t._id,t=t._name):(e=oo(),(n=Po).time=wi(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],l=s.length,c=0;c<l;++c)(a=s[c])&&Ii(a,t,e,c,s,n||Vo(a,e));return new ro(r,this._parents,t,e)};var Do=[null];var Bo=t=>()=>t;function zo(t,{sourceEvent:e,target:n,selection:r,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function Fo(t){t.preventDefault(),t.stopImmediatePropagation()}var Go={name:"drag"},jo={name:"space"},Uo={name:"handle"},Yo={name:"center"};const{abs:Ho,max:qo,min:Wo}=Math;function $o(t){return[+t[0],+t[1]]}function Xo(t){return[$o(t[0]),$o(t[1])]}var Ko={name:"x",handles:["w","e"].map(ia),input:function(t,e){return null==t?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},Zo={name:"y",handles:["n","s"].map(ia),input:function(t,e){return null==t?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},Jo={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(ia),input:function(t){return null==t?null:Xo(t)},output:function(t){return t}},Qo={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},ta={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},ea={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},na={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},ra={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function ia(t){return{type:t}}function oa(t){return!t.ctrlKey&&!t.button}function aa(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function sa(){return navigator.maxTouchPoints||"ontouchstart"in this}function la(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function ca(t){var e,n=aa,r=oa,i=sa,o=!0,a=Nt("start","brush","end"),s=6;function l(e){var n=e.property("__brush",g).selectAll(".overlay").data([ia("overlay")]);n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Qo.overlay).merge(n).each(function(){var t=la(this).extent;$e(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])}),e.selectAll(".selection").data([ia("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Qo.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=e.selectAll(".handle").data(t.handles,function(t){return t.type});r.exit().remove(),r.enter().append("rect").attr("class",function(t){return"handle handle--"+t.type}).attr("cursor",function(t){return Qo[t.type]}),e.each(c).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",f).filter(i).on("touchstart.brush",f).on("touchmove.brush",d).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function c(){var t=$e(this),e=la(this).selection;e?(t.selectAll(".selection").style("display",null).attr("x",e[0][0]).attr("y",e[0][1]).attr("width",e[1][0]-e[0][0]).attr("height",e[1][1]-e[0][1]),t.selectAll(".handle").style("display",null).attr("x",function(t){return"e"===t.type[t.type.length-1]?e[1][0]-s/2:e[0][0]-s/2}).attr("y",function(t){return"s"===t.type[0]?e[1][1]-s/2:e[0][1]-s/2}).attr("width",function(t){return"n"===t.type||"s"===t.type?e[1][0]-e[0][0]+s:s}).attr("height",function(t){return"e"===t.type||"w"===t.type?e[1][1]-e[0][1]+s:s})):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(t,e,n){var r=t.__brush.emitter;return!r||n&&r.clean?new h(t,e,n):r}function h(t,e,n){this.that=t,this.args=e,this.state=t.__brush,this.active=0,this.clean=n}function f(n){if((!e||n.touches)&&r.apply(this,arguments)){var i,a,s,l,h,f,d,p,g,_,y,m=this,b=n.target.__data__.type,v="selection"===(o&&n.metaKey?b="overlay":b)?Go:o&&n.altKey?Yo:Uo,x=t===Zo?null:na[b],w=t===Ko?null:ra[b],E=la(m),A=E.extent,T=E.selection,S=A[0][0],C=A[0][1],k=A[1][0],M=A[1][1],R=0,O=0,N=x&&w&&o&&n.shiftKey,I=Array.from(n.touches||[n],t=>{const e=t.identifier;return(t=Qe(t,m)).point0=t.slice(),t.identifier=e,t});Di(m);var L=u(m,arguments,!0).beforestart();if("overlay"===b){T&&(g=!0);const e=[I[0],I[1]||I[0]];E.selection=T=[[i=t===Zo?S:Wo(e[0][0],e[1][0]),s=t===Ko?C:Wo(e[0][1],e[1][1])],[h=t===Zo?k:qo(e[0][0],e[1][0]),d=t===Ko?M:qo(e[0][1],e[1][1])]],I.length>1&&z(n)}else i=T[0][0],s=T[0][1],h=T[1][0],d=T[1][1];a=i,l=s,f=h,p=d;var P=$e(m).attr("pointer-events","none"),V=P.selectAll(".overlay").attr("cursor",Qo[b]);if(n.touches)L.moved=B,L.ended=F;else{var D=$e(n.view).on("mousemove.brush",B,!0).on("mouseup.brush",F,!0);o&&D.on("keydown.brush",function(t){switch(t.keyCode){case 16:N=x&&w;break;case 18:v===Uo&&(x&&(h=f-R*x,i=a+R*x),w&&(d=p-O*w,s=l+O*w),v=Yo,z(t));break;case 32:v!==Uo&&v!==Yo||(x<0?h=f-R:x>0&&(i=a-R),w<0?d=p-O:w>0&&(s=l-O),v=jo,V.attr("cursor",Qo.selection),z(t));break;default:return}Fo(t)},!0).on("keyup.brush",function(t){switch(t.keyCode){case 16:N&&(_=y=N=!1,z(t));break;case 18:v===Yo&&(x<0?h=f:x>0&&(i=a),w<0?d=p:w>0&&(s=l),v=Uo,z(t));break;case 32:v===jo&&(t.altKey?(x&&(h=f-R*x,i=a+R*x),w&&(d=p-O*w,s=l+O*w),v=Yo):(x<0?h=f:x>0&&(i=a),w<0?d=p:w>0&&(s=l),v=Uo),V.attr("cursor",Qo[b]),z(t));break;default:return}Fo(t)},!0),on(n.view)}c.call(m),L.start(n,v.name)}function B(t){for(const e of t.changedTouches||[t])for(const t of I)t.identifier===e.identifier&&(t.cur=Qe(e,m));if(N&&!_&&!y&&1===I.length){const t=I[0];Ho(t.cur[0]-t[0])>Ho(t.cur[1]-t[1])?y=!0:_=!0}for(const t of I)t.cur&&(t[0]=t.cur[0],t[1]=t.cur[1]);g=!0,Fo(t),z(t)}function z(t){const e=I[0],n=e.point0;var r;switch(R=e[0]-n[0],O=e[1]-n[1],v){case jo:case Go:x&&(R=qo(S-i,Wo(k-h,R)),a=i+R,f=h+R),w&&(O=qo(C-s,Wo(M-d,O)),l=s+O,p=d+O);break;case Uo:I[1]?(x&&(a=qo(S,Wo(k,I[0][0])),f=qo(S,Wo(k,I[1][0])),x=1),w&&(l=qo(C,Wo(M,I[0][1])),p=qo(C,Wo(M,I[1][1])),w=1)):(x<0?(R=qo(S-i,Wo(k-i,R)),a=i+R,f=h):x>0&&(R=qo(S-h,Wo(k-h,R)),a=i,f=h+R),w<0?(O=qo(C-s,Wo(M-s,O)),l=s+O,p=d):w>0&&(O=qo(C-d,Wo(M-d,O)),l=s,p=d+O));break;case Yo:x&&(a=qo(S,Wo(k,i-R*x)),f=qo(S,Wo(k,h+R*x))),w&&(l=qo(C,Wo(M,s-O*w)),p=qo(C,Wo(M,d+O*w)))}f<a&&(x*=-1,r=i,i=h,h=r,r=a,a=f,f=r,b in ta&&V.attr("cursor",Qo[b=ta[b]])),p<l&&(w*=-1,r=s,s=d,d=r,r=l,l=p,p=r,b in ea&&V.attr("cursor",Qo[b=ea[b]])),E.selection&&(T=E.selection),_&&(a=T[0][0],f=T[1][0]),y&&(l=T[0][1],p=T[1][1]),T[0][0]===a&&T[0][1]===l&&T[1][0]===f&&T[1][1]===p||(E.selection=[[a,l],[f,p]],c.call(m),L.brush(t,v.name))}function F(t){if(function(t){t.stopImmediatePropagation()}(t),t.touches){if(t.touches.length)return;e&&clearTimeout(e),e=setTimeout(function(){e=null},500)}else an(t.view,g),D.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);P.attr("pointer-events","all"),V.attr("cursor",Qo.overlay),E.selection&&(T=E.selection),function(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}(T)&&(E.selection=null,c.call(m)),L.end(t,v.name)}}function d(t){u(this,arguments).moved(t)}function p(t){u(this,arguments).ended(t)}function g(){var e=this.__brush||{selection:null};return e.extent=Xo(n.apply(this,arguments)),e.dim=t,e}return l.move=function(e,n,r){e.tween?e.on("start.brush",function(t){u(this,arguments).beforestart().start(t)}).on("interrupt.brush end.brush",function(t){u(this,arguments).end(t)}).tween("brush",function(){var e=this,r=e.__brush,i=u(e,arguments),o=r.selection,a=t.input("function"==typeof n?n.apply(this,arguments):n,r.extent),s=Hr(o,a);function l(t){r.selection=1===t&&null===a?null:s(t),c.call(e),i.brush()}return null!==o&&null!==a?l:l(1)}):e.each(function(){var e=this,i=arguments,o=e.__brush,a=t.input("function"==typeof n?n.apply(e,i):n,o.extent),s=u(e,i).beforestart();Di(e),o.selection=null===a?null:a,c.call(e),s.start(r).brush(r).end(r)})},l.clear=function(t,e){l.move(t,null,e)},h.prototype={beforestart:function(){return 1===++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(t,e){return this.starting?(this.starting=!1,this.emit("start",t,e)):this.emit("brush",t),this},brush:function(t,e){return this.emit("brush",t,e),this},end:function(t,e){return 0===--this.active&&(delete this.state.emitter,this.emit("end",t,e)),this},emit:function(e,n,r){var i=$e(this.that).datum();a.call(e,this.that,new zo(e,{sourceEvent:n,target:l,selection:t.output(this.state.selection),mode:r,dispatch:a}),i)}},l.extent=function(t){return arguments.length?(n="function"==typeof t?t:Bo(Xo(t)),l):n},l.filter=function(t){return arguments.length?(r="function"==typeof t?t:Bo(!!t),l):r},l.touchable=function(t){return arguments.length?(i="function"==typeof t?t:Bo(!!t),l):i},l.handleSize=function(t){return arguments.length?(s=+t,l):s},l.keyModifiers=function(t){return arguments.length?(o=!!t,l):o},l.on=function(){var t=a.on.apply(a,arguments);return t===a?l:t},l}var ua=Math.abs,ha=Math.cos,fa=Math.sin,da=Math.PI,pa=da/2,ga=2*da,_a=Math.max,ya=1e-12;function ma(t,e){return Array.from({length:e-t},(e,n)=>t+n)}function ba(t,e){var n=0,r=null,i=null,o=null;function a(a){var s,l=a.length,c=new Array(l),u=ma(0,l),h=new Array(l*l),f=new Array(l),d=0;a=Float64Array.from({length:l*l},e?(t,e)=>a[e%l][e/l|0]:(t,e)=>a[e/l|0][e%l]);for(let e=0;e<l;++e){let n=0;for(let r=0;r<l;++r)n+=a[e*l+r]+t*a[r*l+e];d+=c[e]=n}s=(d=_a(0,ga-n*l)/d)?n:ga/l;{let e=0;r&&u.sort((t,e)=>r(c[t],c[e]));for(const n of u){const r=e;if(t){const t=ma(1+~l,l).filter(t=>t<0?a[~t*l+n]:a[n*l+t]);i&&t.sort((t,e)=>i(t<0?-a[~t*l+n]:a[n*l+t],e<0?-a[~e*l+n]:a[n*l+e]));for(const r of t)if(r<0){(h[~r*l+n]||(h[~r*l+n]={source:null,target:null})).target={index:n,startAngle:e,endAngle:e+=a[~r*l+n]*d,value:a[~r*l+n]}}else{(h[n*l+r]||(h[n*l+r]={source:null,target:null})).source={index:n,startAngle:e,endAngle:e+=a[n*l+r]*d,value:a[n*l+r]}}f[n]={index:n,startAngle:r,endAngle:e,value:c[n]}}else{const t=ma(0,l).filter(t=>a[n*l+t]||a[t*l+n]);i&&t.sort((t,e)=>i(a[n*l+t],a[n*l+e]));for(const r of t){let t;if(n<r?(t=h[n*l+r]||(h[n*l+r]={source:null,target:null}),t.source={index:n,startAngle:e,endAngle:e+=a[n*l+r]*d,value:a[n*l+r]}):(t=h[r*l+n]||(h[r*l+n]={source:null,target:null}),t.target={index:n,startAngle:e,endAngle:e+=a[n*l+r]*d,value:a[n*l+r]},n===r&&(t.source=t.target)),t.source&&t.target&&t.source.value<t.target.value){const e=t.source;t.source=t.target,t.target=e}}f[n]={index:n,startAngle:r,endAngle:e,value:c[n]}}e+=s}}return(h=Object.values(h)).groups=f,o?h.sort(o):h}return a.padAngle=function(t){return arguments.length?(n=_a(0,t),a):n},a.sortGroups=function(t){return arguments.length?(r=t,a):r},a.sortSubgroups=function(t){return arguments.length?(i=t,a):i},a.sortChords=function(t){return arguments.length?(null==t?o=null:(e=t,o=function(t,n){return e(t.source.value+t.target.value,n.source.value+n.target.value)})._=t,a):o&&o._;var e},a}const va=Math.PI,xa=2*va,wa=1e-6,Ea=xa-wa;function Aa(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}let Ta=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?Aa:function(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Aa;const n=10**e;return function(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=Math.round(arguments[e]*n)/n+t[e]}}(t)}moveTo(t,e){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,e){this._append`L${this._x1=+t},${this._y1=+e}`}quadraticCurveTo(t,e,n,r){this._append`Q${+t},${+e},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(t,e,n,r,i,o){this._append`C${+t},${+e},${+n},${+r},${this._x1=+i},${this._y1=+o}`}arcTo(t,e,n,r,i){if(t=+t,e=+e,n=+n,r=+r,(i=+i)<0)throw new Error(`negative radius: ${i}`);let o=this._x1,a=this._y1,s=n-t,l=r-e,c=o-t,u=a-e,h=c*c+u*u;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(h>wa)if(Math.abs(u*s-l*c)>wa&&i){let f=n-o,d=r-a,p=s*s+l*l,g=f*f+d*d,_=Math.sqrt(p),y=Math.sqrt(h),m=i*Math.tan((va-Math.acos((p+h-g)/(2*_*y)))/2),b=m/y,v=m/_;Math.abs(b-1)>wa&&this._append`L${t+b*c},${e+b*u}`,this._append`A${i},${i},0,0,${+(u*f>c*d)},${this._x1=t+v*s},${this._y1=e+v*l}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,n,r,i,o){if(t=+t,e=+e,o=!!o,(n=+n)<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(r),s=n*Math.sin(r),l=t+a,c=e+s,u=1^o,h=o?r-i:i-r;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>wa||Math.abs(this._y1-c)>wa)&&this._append`L${l},${c}`,n&&(h<0&&(h=h%xa+xa),h>Ea?this._append`A${n},${n},0,1,${u},${t-a},${e-s}A${n},${n},0,1,${u},${this._x1=l},${this._y1=c}`:h>wa&&this._append`A${n},${n},0,${+(h>=va)},${u},${this._x1=t+n*Math.cos(i)},${this._y1=e+n*Math.sin(i)}`)}rect(t,e,n,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function Sa(){return new Ta}Sa.prototype=Ta.prototype;var Ca=Array.prototype.slice;function ka(t){return function(){return t}}function Ma(t){return t.source}function Ra(t){return t.target}function Oa(t){return t.radius}function Na(t){return t.startAngle}function Ia(t){return t.endAngle}function La(){return 0}function Pa(){return 10}function Va(t){var e=Ma,n=Ra,r=Oa,i=Oa,o=Na,a=Ia,s=La,l=null;function c(){var c,u=e.apply(this,arguments),h=n.apply(this,arguments),f=s.apply(this,arguments)/2,d=Ca.call(arguments),p=+r.apply(this,(d[0]=u,d)),g=o.apply(this,d)-pa,_=a.apply(this,d)-pa,y=+i.apply(this,(d[0]=h,d)),m=o.apply(this,d)-pa,b=a.apply(this,d)-pa;if(l||(l=c=Sa()),f>ya&&(ua(_-g)>2*f+ya?_>g?(g+=f,_-=f):(g-=f,_+=f):g=_=(g+_)/2,ua(b-m)>2*f+ya?b>m?(m+=f,b-=f):(m-=f,b+=f):m=b=(m+b)/2),l.moveTo(p*ha(g),p*fa(g)),l.arc(0,0,p,g,_),g!==m||_!==b)if(t){var v=y-+t.apply(this,arguments),x=(m+b)/2;l.quadraticCurveTo(0,0,v*ha(m),v*fa(m)),l.lineTo(y*ha(x),y*fa(x)),l.lineTo(v*ha(b),v*fa(b))}else l.quadraticCurveTo(0,0,y*ha(m),y*fa(m)),l.arc(0,0,y,m,b);if(l.quadraticCurveTo(0,0,p*ha(g),p*fa(g)),l.closePath(),c)return l=null,c+""||null}return t&&(c.headRadius=function(e){return arguments.length?(t="function"==typeof e?e:ka(+e),c):t}),c.radius=function(t){return arguments.length?(r=i="function"==typeof t?t:ka(+t),c):r},c.sourceRadius=function(t){return arguments.length?(r="function"==typeof t?t:ka(+t),c):r},c.targetRadius=function(t){return arguments.length?(i="function"==typeof t?t:ka(+t),c):i},c.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:ka(+t),c):o},c.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:ka(+t),c):a},c.padAngle=function(t){return arguments.length?(s="function"==typeof t?t:ka(+t),c):s},c.source=function(t){return arguments.length?(e=t,c):e},c.target=function(t){return arguments.length?(n=t,c):n},c.context=function(t){return arguments.length?(l=null==t?null:t,c):l},c}var Da=Array.prototype.slice;function Ba(t,e){return t-e}var za=t=>()=>t;function Fa(t,e){for(var n,r=-1,i=e.length;++r<i;)if(n=Ga(t,e[r]))return n;return 0}function Ga(t,e){for(var n=e[0],r=e[1],i=-1,o=0,a=t.length,s=a-1;o<a;s=o++){var l=t[o],c=l[0],u=l[1],h=t[s],f=h[0],d=h[1];if(ja(l,h,e))return 0;u>r!=d>r&&n<(f-c)*(r-u)/(d-u)+c&&(i=-i)}return i}function ja(t,e,n){var r,i,o,a;return function(t,e,n){return(e[0]-t[0])*(n[1]-t[1])===(n[0]-t[0])*(e[1]-t[1])}(t,e,n)&&(i=t[r=+(t[0]===e[0])],o=n[r],a=e[r],i<=o&&o<=a||a<=o&&o<=i)}function Ua(){}var Ya=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function Ha(){var t=1,e=1,n=Z,r=s;function i(t){var e=n(t);if(Array.isArray(e))e=e.slice().sort(Ba);else{const n=x(t,qa);for(e=W(...K(n[0],n[1],e),e);e[e.length-1]>=n[1];)e.pop();for(;e[1]<n[0];)e.shift()}return e.map(e=>o(t,e))}function o(n,i){const o=null==i?NaN:+i;if(isNaN(o))throw new Error(`invalid value: ${i}`);var s=[],l=[];return function(n,r,i){var o,s,l,c,u,h,f=new Array,d=new Array;o=s=-1,c=Wa(n[0],r),Ya[c<<1].forEach(p);for(;++o<t-1;)l=c,c=Wa(n[o+1],r),Ya[l|c<<1].forEach(p);Ya[c|0].forEach(p);for(;++s<e-1;){for(o=-1,c=Wa(n[s*t+t],r),u=Wa(n[s*t],r),Ya[c<<1|u<<2].forEach(p);++o<t-1;)l=c,c=Wa(n[s*t+t+o+1],r),h=u,u=Wa(n[s*t+o+1],r),Ya[l|c<<1|u<<2|h<<3].forEach(p);Ya[c|u<<3].forEach(p)}o=-1,u=n[s*t]>=r,Ya[u<<2].forEach(p);for(;++o<t-1;)h=u,u=Wa(n[s*t+o+1],r),Ya[u<<2|h<<3].forEach(p);function p(t){var e,n,r=[t[0][0]+o,t[0][1]+s],l=[t[1][0]+o,t[1][1]+s],c=a(r),u=a(l);(e=d[c])?(n=f[u])?(delete d[e.end],delete f[n.start],e===n?(e.ring.push(l),i(e.ring)):f[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete d[e.end],e.ring.push(l),d[e.end=u]=e):(e=f[u])?(n=d[c])?(delete f[e.start],delete d[n.end],e===n?(e.ring.push(l),i(e.ring)):f[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete f[e.start],e.ring.unshift(r),f[e.start=c]=e):f[c]=d[u]={start:c,end:u,ring:[r,l]}}Ya[u<<3].forEach(p)}(n,o,function(t){r(t,n,o),function(t){for(var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];++e<n;)r+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return r}(t)>0?s.push([t]):l.push(t)}),l.forEach(function(t){for(var e,n=0,r=s.length;n<r;++n)if(-1!==Fa((e=s[n])[0],t))return void e.push(t)}),{type:"MultiPolygon",value:i,coordinates:s}}function a(e){return 2*e[0]+e[1]*(t+1)*4}function s(n,r,i){n.forEach(function(n){var o=n[0],a=n[1],s=0|o,l=0|a,c=$a(r[l*t+s]);o>0&&o<t&&s===o&&(n[0]=Xa(o,$a(r[l*t+s-1]),c,i)),a>0&&a<e&&l===a&&(n[1]=Xa(a,$a(r[(l-1)*t+s]),c,i))})}return i.contour=o,i.size=function(n){if(!arguments.length)return[t,e];var r=Math.floor(n[0]),o=Math.floor(n[1]);if(!(r>=0&&o>=0))throw new Error("invalid size");return t=r,e=o,i},i.thresholds=function(t){return arguments.length?(n="function"==typeof t?t:Array.isArray(t)?za(Da.call(t)):za(t),i):n},i.smooth=function(t){return arguments.length?(r=t?s:Ua,i):r===s},i}function qa(t){return isFinite(t)?t:NaN}function Wa(t,e){return null!=t&&+t>=e}function $a(t){return null==t||isNaN(t=+t)?-1/0:t}function Xa(t,e,n,r){const i=r-e,o=n-e,a=isFinite(i)||isFinite(o)?i/o:Math.sign(i)/Math.sign(o);return isNaN(a)?t:t+a-.5}function Ka(t){return t[0]}function Za(t){return t[1]}function Ja(){return 1}const Qa=134217729;function ts(t,e,n,r,i){let o,a,s,l,c=e[0],u=r[0],h=0,f=0;u>c==u>-c?(o=c,c=e[++h]):(o=u,u=r[++f]);let d=0;if(h<t&&f<n)for(u>c==u>-c?(a=c+o,s=o-(a-c),c=e[++h]):(a=u+o,s=o-(a-u),u=r[++f]),o=a,0!==s&&(i[d++]=s);h<t&&f<n;)u>c==u>-c?(a=o+c,l=a-o,s=o-(a-l)+(c-l),c=e[++h]):(a=o+u,l=a-o,s=o-(a-l)+(u-l),u=r[++f]),o=a,0!==s&&(i[d++]=s);for(;h<t;)a=o+c,l=a-o,s=o-(a-l)+(c-l),c=e[++h],o=a,0!==s&&(i[d++]=s);for(;f<n;)a=o+u,l=a-o,s=o-(a-l)+(u-l),u=r[++f],o=a,0!==s&&(i[d++]=s);return 0===o&&0!==d||(i[d++]=o),d}function es(t){return new Float64Array(t)}const ns=es(4),rs=es(8),is=es(12),os=es(16),as=es(4);function ss(t,e,n,r,i,o){const a=(e-o)*(n-i),s=(t-i)*(r-o),l=a-s,c=Math.abs(a+s);return Math.abs(l)>=33306690738754716e-32*c?l:-function(t,e,n,r,i,o,a){let s,l,c,u,h,f,d,p,g,_,y,m,b,v,x,w,E,A;const T=t-i,S=n-i,C=e-o,k=r-o;v=T*k,f=Qa*T,d=f-(f-T),p=T-d,f=Qa*k,g=f-(f-k),_=k-g,x=p*_-(v-d*g-p*g-d*_),w=C*S,f=Qa*C,d=f-(f-C),p=C-d,f=Qa*S,g=f-(f-S),_=S-g,E=p*_-(w-d*g-p*g-d*_),y=x-E,h=x-y,ns[0]=x-(y+h)+(h-E),m=v+y,h=m-v,b=v-(m-h)+(y-h),y=b-w,h=b-y,ns[1]=b-(y+h)+(h-w),A=m+y,h=A-m,ns[2]=m-(A-h)+(y-h),ns[3]=A;let M=function(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}(4,ns),R=22204460492503146e-32*a;if(M>=R||-M>=R)return M;if(h=t-T,s=t-(T+h)+(h-i),h=n-S,c=n-(S+h)+(h-i),h=e-C,l=e-(C+h)+(h-o),h=r-k,u=r-(k+h)+(h-o),0===s&&0===l&&0===c&&0===u)return M;if(R=11093356479670487e-47*a+33306690738754706e-32*Math.abs(M),M+=T*u+k*s-(C*c+S*l),M>=R||-M>=R)return M;v=s*k,f=Qa*s,d=f-(f-s),p=s-d,f=Qa*k,g=f-(f-k),_=k-g,x=p*_-(v-d*g-p*g-d*_),w=l*S,f=Qa*l,d=f-(f-l),p=l-d,f=Qa*S,g=f-(f-S),_=S-g,E=p*_-(w-d*g-p*g-d*_),y=x-E,h=x-y,as[0]=x-(y+h)+(h-E),m=v+y,h=m-v,b=v-(m-h)+(y-h),y=b-w,h=b-y,as[1]=b-(y+h)+(h-w),A=m+y,h=A-m,as[2]=m-(A-h)+(y-h),as[3]=A;const O=ts(4,ns,4,as,rs);v=T*u,f=Qa*T,d=f-(f-T),p=T-d,f=Qa*u,g=f-(f-u),_=u-g,x=p*_-(v-d*g-p*g-d*_),w=C*c,f=Qa*C,d=f-(f-C),p=C-d,f=Qa*c,g=f-(f-c),_=c-g,E=p*_-(w-d*g-p*g-d*_),y=x-E,h=x-y,as[0]=x-(y+h)+(h-E),m=v+y,h=m-v,b=v-(m-h)+(y-h),y=b-w,h=b-y,as[1]=b-(y+h)+(h-w),A=m+y,h=A-m,as[2]=m-(A-h)+(y-h),as[3]=A;const N=ts(O,rs,4,as,is);v=s*u,f=Qa*s,d=f-(f-s),p=s-d,f=Qa*u,g=f-(f-u),_=u-g,x=p*_-(v-d*g-p*g-d*_),w=l*c,f=Qa*l,d=f-(f-l),p=l-d,f=Qa*c,g=f-(f-c),_=c-g,E=p*_-(w-d*g-p*g-d*_),y=x-E,h=x-y,as[0]=x-(y+h)+(h-E),m=v+y,h=m-v,b=v-(m-h)+(y-h),y=b-w,h=b-y,as[1]=b-(y+h)+(h-w),A=m+y,h=A-m,as[2]=m-(A-h)+(y-h),as[3]=A;const I=ts(N,is,4,as,os);return os[I-1]}(t,e,n,r,i,o,c)}const ls=Math.pow(2,-52),cs=new Uint32Array(512);class us{static from(t,e=_s,n=ys){const r=t.length,i=new Float64Array(2*r);for(let o=0;o<r;o++){const r=t[o];i[2*o]=e(r),i[2*o+1]=n(r)}return new us(i)}constructor(t){const e=t.length>>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:r,_hullHash:i}=this,o=t.length>>1;let a=1/0,s=1/0,l=-1/0,c=-1/0;for(let e=0;e<o;e++){const n=t[2*e],r=t[2*e+1];n<a&&(a=n),r<s&&(s=r),n>l&&(l=n),r>c&&(c=r),this._ids[e]=e}const u=(a+l)/2,h=(s+c)/2;let f,d,p;for(let e=0,n=1/0;e<o;e++){const r=hs(u,h,t[2*e],t[2*e+1]);r<n&&(f=e,n=r)}const g=t[2*f],_=t[2*f+1];for(let e=0,n=1/0;e<o;e++){if(e===f)continue;const r=hs(g,_,t[2*e],t[2*e+1]);r<n&&r>0&&(d=e,n=r)}let y=t[2*d],m=t[2*d+1],b=1/0;for(let e=0;e<o;e++){if(e===f||e===d)continue;const n=ds(g,_,y,m,t[2*e],t[2*e+1]);n<b&&(p=e,b=n)}let v=t[2*p],x=t[2*p+1];if(b===1/0){for(let e=0;e<o;e++)this._dists[e]=t[2*e]-t[0]||t[2*e+1]-t[1];ps(this._ids,this._dists,0,o-1);const e=new Uint32Array(o);let n=0;for(let t=0,r=-1/0;t<o;t++){const i=this._ids[t],o=this._dists[i];o>r&&(e[n++]=i,r=o)}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(ss(g,_,y,m,v,x)<0){const t=d,e=y,n=m;d=p,y=v,m=x,p=t,v=e,x=n}const w=function(t,e,n,r,i,o){const a=n-t,s=r-e,l=i-t,c=o-e,u=a*a+s*s,h=l*l+c*c,f=.5/(a*c-s*l),d=t+(c*u-s*h)*f,p=e+(a*h-l*u)*f;return{x:d,y:p}}(g,_,y,m,v,x);this._cx=w.x,this._cy=w.y;for(let e=0;e<o;e++)this._dists[e]=hs(t[2*e],t[2*e+1],w.x,w.y);ps(this._ids,this._dists,0,o-1),this._hullStart=f;let E=3;n[f]=e[p]=d,n[d]=e[f]=p,n[p]=e[d]=f,r[f]=0,r[d]=1,r[p]=2,i.fill(-1),i[this._hashKey(g,_)]=f,i[this._hashKey(y,m)]=d,i[this._hashKey(v,x)]=p,this.trianglesLen=0,this._addTriangle(f,d,p,-1,-1,-1);for(let o,a,s=0;s<this._ids.length;s++){const l=this._ids[s],c=t[2*l],u=t[2*l+1];if(s>0&&Math.abs(c-o)<=ls&&Math.abs(u-a)<=ls)continue;if(o=c,a=u,l===f||l===d||l===p)continue;let h=0;for(let t=0,e=this._hashKey(c,u);t<this._hashSize&&(h=i[(e+t)%this._hashSize],-1===h||h===n[h]);t++);h=e[h];let g,_=h;for(;g=n[_],ss(c,u,t[2*_],t[2*_+1],t[2*g],t[2*g+1])>=0;)if(_=g,_===h){_=-1;break}if(-1===_)continue;let y=this._addTriangle(_,l,n[_],-1,-1,r[_]);r[l]=this._legalize(y+2),r[_]=y,E++;let m=n[_];for(;g=n[m],ss(c,u,t[2*m],t[2*m+1],t[2*g],t[2*g+1])<0;)y=this._addTriangle(m,l,g,r[l],-1,r[m]),r[l]=this._legalize(y+2),n[m]=m,E--,m=g;if(_===h)for(;g=e[_],ss(c,u,t[2*g],t[2*g+1],t[2*_],t[2*_+1])<0;)y=this._addTriangle(g,l,_,-1,r[_],r[g]),this._legalize(y+2),r[g]=y,n[_]=_,E--,_=g;this._hullStart=e[l]=_,n[_]=e[m]=l,n[l]=m,i[this._hashKey(c,u)]=l,i[this._hashKey(t[2*_],t[2*_+1])]=_}this.hull=new Uint32Array(E);for(let t=0,e=this._hullStart;t<E;t++)this.hull[t]=e,e=n[e];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,e){return Math.floor(function(t,e){const n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:r}=this;let i=0,o=0;for(;;){const a=n[t],s=t-t%3;if(o=s+(t+2)%3,-1===a){if(0===i)break;t=cs[--i];continue}const l=a-a%3,c=s+(t+1)%3,u=l+(a+2)%3,h=e[o],f=e[t],d=e[c],p=e[u];if(fs(r[2*h],r[2*h+1],r[2*f],r[2*f+1],r[2*d],r[2*d+1],r[2*p],r[2*p+1])){e[t]=p,e[a]=h;const r=n[u];if(-1===r){let e=this._hullStart;do{if(this._hullTri[e]===u){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,r),this._link(a,n[o]),this._link(o,u);const s=l+(a+1)%3;i<cs.length&&(cs[i++]=s)}else{if(0===i)break;t=cs[--i]}}return o}_link(t,e){this._halfedges[t]=e,-1!==e&&(this._halfedges[e]=t)}_addTriangle(t,e,n,r,i,o){const a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=e,this._triangles[a+2]=n,this._link(a,r),this._link(a+1,i),this._link(a+2,o),this.trianglesLen+=3,a}}function hs(t,e,n,r){const i=t-n,o=e-r;return i*i+o*o}function fs(t,e,n,r,i,o,a,s){const l=t-a,c=e-s,u=n-a,h=r-s,f=i-a,d=o-s,p=u*u+h*h,g=f*f+d*d;return l*(h*g-p*d)-c*(u*g-p*f)+(l*l+c*c)*(u*d-h*f)<0}function ds(t,e,n,r,i,o){const a=n-t,s=r-e,l=i-t,c=o-e,u=a*a+s*s,h=l*l+c*c,f=.5/(a*c-s*l),d=(c*u-s*h)*f,p=(a*h-l*u)*f;return d*d+p*p}function ps(t,e,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const r=t[i],o=e[r];let a=i-1;for(;a>=n&&e[t[a]]>o;)t[a+1]=t[a--];t[a+1]=r}else{let i=n+1,o=r;gs(t,n+r>>1,i),e[t[n]]>e[t[r]]&&gs(t,n,r),e[t[i]]>e[t[r]]&&gs(t,i,r),e[t[n]]>e[t[i]]&&gs(t,n,i);const a=t[i],s=e[a];for(;;){do{i++}while(e[t[i]]<s);do{o--}while(e[t[o]]>s);if(o<i)break;gs(t,i,o)}t[n+1]=t[o],t[o]=a,r-i+1>=o-n?(ps(t,e,i,r),ps(t,e,n,o-1)):(ps(t,e,n,o-1),ps(t,e,i,r))}}function gs(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function _s(t){return t[0]}function ys(t){return t[1]}const ms=1e-6;let bs=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,e){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,e){this._+=`L${this._x1=+t},${this._y1=+e}`}arc(t,e,n){const r=(t=+t)+(n=+n),i=e=+e;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>ms||Math.abs(this._y1-i)>ms)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${t-n},${e}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,e,n,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${+n}v${+r}h${-n}Z`}value(){return this._||null}},vs=class{constructor(){this._=[]}moveTo(t,e){this._.push([t,e])}closePath(){this._.push(this._[0].slice())}lineTo(t,e){this._.push([t,e])}value(){return this._.length?this._:null}};class xs{constructor(t,[e,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(e=+e)&&(i=+i)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=e,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:e,triangles:n},vectors:r}=this;let i,o;const a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let r,s,l=0,c=0,u=n.length;l<u;l+=3,c+=2){const u=2*n[l],h=2*n[l+1],f=2*n[l+2],d=t[u],p=t[u+1],g=t[h],_=t[h+1],y=t[f],m=t[f+1],b=g-d,v=_-p,x=y-d,w=m-p,E=2*(b*w-v*x);if(Math.abs(E)<1e-9){if(void 0===i){i=o=0;for(const n of e)i+=t[2*n],o+=t[2*n+1];i/=e.length,o/=e.length}const n=1e9*Math.sign((i-d)*w-(o-p)*x);r=(d+y)/2-n*w,s=(p+m)/2+n*x}else{const t=1/E,e=b*b+v*v,n=x*x+w*w;r=d+(w*e-v*n)*t,s=p+(b*n-x*e)*t}a[c]=r,a[c+1]=s}let s,l,c,u=e[e.length-1],h=4*u,f=t[2*u],d=t[2*u+1];r.fill(0);for(let n=0;n<e.length;++n)u=e[n],s=h,l=f,c=d,h=4*u,f=t[2*u],d=t[2*u+1],r[s+2]=r[h]=c-d,r[s+3]=r[h+1]=f-l}render(t){const e=null==t?t=new bs:void 0,{delaunay:{halfedges:n,inedges:r,hull:i},circumcenters:o,vectors:a}=this;if(i.length<=1)return null;for(let e=0,r=n.length;e<r;++e){const r=n[e];if(r<e)continue;const i=2*Math.floor(e/3),a=2*Math.floor(r/3),s=o[i],l=o[i+1],c=o[a],u=o[a+1];this._renderSegment(s,l,c,u,t)}let s,l=i[i.length-1];for(let e=0;e<i.length;++e){s=l,l=i[e];const n=2*Math.floor(r[l]/3),c=o[n],u=o[n+1],h=4*s,f=this._project(c,u,a[h+2],a[h+3]);f&&this._renderSegment(c,u,f[0],f[1],t)}return e&&e.value()}renderBounds(t){const e=null==t?t=new bs:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),e&&e.value()}renderCell(t,e){const n=null==e?e=new bs:void 0,r=this._clip(t);if(null===r||!r.length)return;e.moveTo(r[0],r[1]);let i=r.length;for(;r[0]===r[i-2]&&r[1]===r[i-1]&&i>1;)i-=2;for(let t=2;t<i;t+=2)r[t]===r[t-2]&&r[t+1]===r[t-1]||e.lineTo(r[t],r[t+1]);return e.closePath(),n&&n.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let e=0,n=t.length/2;e<n;++e){const t=this.cellPolygon(e);t&&(t.index=e,yield t)}}cellPolygon(t){const e=new vs;return this.renderCell(t,e),e.value()}_renderSegment(t,e,n,r,i){let o;const a=this._regioncode(t,e),s=this._regioncode(n,r);0===a&&0===s?(i.moveTo(t,e),i.lineTo(n,r)):(o=this._clipSegment(t,e,n,r,a,s))&&(i.moveTo(o[0],o[1]),i.lineTo(o[2],o[3]))}contains(t,e,n){return(e=+e)==e&&(n=+n)==n&&this.delaunay._step(t,e,n)===t}*neighbors(t){const e=this._clip(t);if(e)for(const n of this.delaunay.neighbors(t)){const t=this._clip(n);if(t)t:for(let r=0,i=e.length;r<i;r+=2)for(let o=0,a=t.length;o<a;o+=2)if(e[r]===t[o]&&e[r+1]===t[o+1]&&e[(r+2)%i]===t[(o+a-2)%a]&&e[(r+3)%i]===t[(o+a-1)%a]){yield n;break t}}}_cell(t){const{circumcenters:e,delaunay:{inedges:n,halfedges:r,triangles:i}}=this,o=n[t];if(-1===o)return null;const a=[];let s=o;do{const n=Math.floor(s/3);if(a.push(e[2*n],e[2*n+1]),s=s%3==2?s-2:s+1,i[s]!==t)break;s=r[s]}while(s!==o&&-1!==s);return a}_clip(t){if(0===t&&1===this.delaunay.hull.length)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const e=this._cell(t);if(null===e)return null;const{vectors:n}=this,r=4*t;return this._simplify(n[r]||n[r+1]?this._clipInfinite(t,e,n[r],n[r+1],n[r+2],n[r+3]):this._clipFinite(t,e))}_clipFinite(t,e){const n=e.length;let r,i,o,a,s=null,l=e[n-2],c=e[n-1],u=this._regioncode(l,c),h=0;for(let f=0;f<n;f+=2)if(r=l,i=c,l=e[f],c=e[f+1],o=u,u=this._regioncode(l,c),0===o&&0===u)a=h,h=0,s?s.push(l,c):s=[l,c];else{let e,n,f,d,p;if(0===o){if(null===(e=this._clipSegment(r,i,l,c,o,u)))continue;[n,f,d,p]=e}else{if(null===(e=this._clipSegment(l,c,r,i,u,o)))continue;[d,p,n,f]=e,a=h,h=this._edgecode(n,f),a&&h&&this._edge(t,a,h,s,s.length),s?s.push(n,f):s=[n,f]}a=h,h=this._edgecode(d,p),a&&h&&this._edge(t,a,h,s,s.length),s?s.push(d,p):s=[d,p]}if(s)a=h,h=this._edgecode(s[0],s[1]),a&&h&&this._edge(t,a,h,s,s.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return s}_clipSegment(t,e,n,r,i,o){const a=i<o;for(a&&([t,e,n,r,i,o]=[n,r,t,e,o,i]);;){if(0===i&&0===o)return a?[n,r,t,e]:[t,e,n,r];if(i&o)return null;let s,l,c=i||o;8&c?(s=t+(n-t)*(this.ymax-e)/(r-e),l=this.ymax):4&c?(s=t+(n-t)*(this.ymin-e)/(r-e),l=this.ymin):2&c?(l=e+(r-e)*(this.xmax-t)/(n-t),s=this.xmax):(l=e+(r-e)*(this.xmin-t)/(n-t),s=this.xmin),i?(t=s,e=l,i=this._regioncode(t,e)):(n=s,r=l,o=this._regioncode(n,r))}}_clipInfinite(t,e,n,r,i,o){let a,s=Array.from(e);if((a=this._project(s[0],s[1],n,r))&&s.unshift(a[0],a[1]),(a=this._project(s[s.length-2],s[s.length-1],i,o))&&s.push(a[0],a[1]),s=this._clipFinite(t,s))for(let e,n=0,r=s.length,i=this._edgecode(s[r-2],s[r-1]);n<r;n+=2)e=i,i=this._edgecode(s[n],s[n+1]),e&&i&&(n=this._edge(t,e,i,s,n),r=s.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(s=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return s}_edge(t,e,n,r,i){for(;e!==n;){let n,o;switch(e){case 5:e=4;continue;case 4:e=6,n=this.xmax,o=this.ymin;break;case 6:e=2;continue;case 2:e=10,n=this.xmax,o=this.ymax;break;case 10:e=8;continue;case 8:e=9,n=this.xmin,o=this.ymax;break;case 9:e=1;continue;case 1:e=5,n=this.xmin,o=this.ymin}r[i]===n&&r[i+1]===o||!this.contains(t,n,o)||(r.splice(i,0,n,o),i+=2)}return i}_project(t,e,n,r){let i,o,a,s=1/0;if(r<0){if(e<=this.ymin)return null;(i=(this.ymin-e)/r)<s&&(a=this.ymin,o=t+(s=i)*n)}else if(r>0){if(e>=this.ymax)return null;(i=(this.ymax-e)/r)<s&&(a=this.ymax,o=t+(s=i)*n)}if(n>0){if(t>=this.xmax)return null;(i=(this.xmax-t)/n)<s&&(o=this.xmax,a=e+(s=i)*r)}else if(n<0){if(t<=this.xmin)return null;(i=(this.xmin-t)/n)<s&&(o=this.xmin,a=e+(s=i)*r)}return[o,a]}_edgecode(t,e){return(t===this.xmin?1:t===this.xmax?2:0)|(e===this.ymin?4:e===this.ymax?8:0)}_regioncode(t,e){return(t<this.xmin?1:t>this.xmax?2:0)|(e<this.ymin?4:e>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let e=0;e<t.length;e+=2){const n=(e+2)%t.length,r=(e+4)%t.length;(t[e]===t[n]&&t[n]===t[r]||t[e+1]===t[n+1]&&t[n+1]===t[r+1])&&(t.splice(n,2),e-=2)}t.length||(t=null)}return t}}const ws=2*Math.PI,Es=Math.pow;function As(t){return t[0]}function Ts(t){return t[1]}function Ss(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}class Cs{static from(t,e=As,n=Ts,r){return new Cs("length"in t?function(t,e,n,r){const i=t.length,o=new Float64Array(2*i);for(let a=0;a<i;++a){const i=t[a];o[2*a]=e.call(r,i,a,t),o[2*a+1]=n.call(r,i,a,t)}return o}(t,e,n,r):Float64Array.from(function*(t,e,n,r){let i=0;for(const o of t)yield e.call(r,o,i,t),yield n.call(r,o,i,t),++i}(t,e,n,r)))}constructor(t){this._delaunator=new us(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,e=this.points;if(t.hull&&t.hull.length>2&&function(t){const{triangles:e,coords:n}=t;for(let t=0;t<e.length;t+=3){const r=2*e[t],i=2*e[t+1],o=2*e[t+2];if((n[o]-n[r])*(n[i+1]-n[r+1])-(n[i]-n[r])*(n[o+1]-n[r+1])>1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:e.length/2},(t,e)=>e).sort((t,n)=>e[2*t]-e[2*n]||e[2*t+1]-e[2*n+1]);const t=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[e[2*t],e[2*t+1],e[2*n],e[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,n=e.length/2;t<n;++t){const n=Ss(e[2*t],e[2*t+1],i);e[2*t]=n[0],e[2*t+1]=n[1]}this._delaunator=new us(e)}else delete this.collinear;const n=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,i=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let t=0,e=n.length;t<e;++t){const e=i[t%3==2?t-2:t+1];-1!==n[t]&&-1!==o[e]||(o[e]=t)}for(let t=0,e=r.length;t<e;++t)a[r[t]]=t;r.length<=2&&r.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],o[r[0]]=1,2===r.length&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(t){return new xs(this,t)}*neighbors(t){const{inedges:e,hull:n,_hullIndex:r,halfedges:i,triangles:o,collinear:a}=this;if(a){const e=a.indexOf(t);return e>0&&(yield a[e-1]),void(e<a.length-1&&(yield a[e+1]))}const s=e[t];if(-1===s)return;let l=s,c=-1;do{if(yield c=o[l],l=l%3==2?l-2:l+1,o[l]!==t)return;if(l=i[l],-1===l){const e=n[(r[t]+1)%n.length];return void(e!==c&&(yield e))}}while(l!==s)}find(t,e,n=0){if((t=+t)!=t||(e=+e)!=e)return-1;const r=n;let i;for(;(i=this._step(n,t,e))>=0&&i!==n&&i!==r;)n=i;return i}_step(t,e,n){const{inedges:r,hull:i,_hullIndex:o,halfedges:a,triangles:s,points:l}=this;if(-1===r[t]||!l.length)return(t+1)%(l.length>>1);let c=t,u=Es(e-l[2*t],2)+Es(n-l[2*t+1],2);const h=r[t];let f=h;do{let r=s[f];const h=Es(e-l[2*r],2)+Es(n-l[2*r+1],2);if(h<u&&(u=h,c=r),f=f%3==2?f-2:f+1,s[f]!==t)break;if(f=a[f],-1===f){if(f=i[(o[t]+1)%i.length],f!==r&&Es(e-l[2*f],2)+Es(n-l[2*f+1],2)<u)return f;break}}while(f!==h);return c}render(t){const e=null==t?t=new bs:void 0,{points:n,halfedges:r,triangles:i}=this;for(let e=0,o=r.length;e<o;++e){const o=r[e];if(o<e)continue;const a=2*i[e],s=2*i[o];t.moveTo(n[a],n[a+1]),t.lineTo(n[s],n[s+1])}return this.renderHull(t),e&&e.value()}renderPoints(t,e){void 0!==e||t&&"function"==typeof t.moveTo||(e=t,t=null),e=null==e?2:+e;const n=null==t?t=new bs:void 0,{points:r}=this;for(let n=0,i=r.length;n<i;n+=2){const i=r[n],o=r[n+1];t.moveTo(i+e,o),t.arc(i,o,e,0,ws)}return n&&n.value()}renderHull(t){const e=null==t?t=new bs:void 0,{hull:n,points:r}=this,i=2*n[0],o=n.length;t.moveTo(r[i],r[i+1]);for(let e=1;e<o;++e){const i=2*n[e];t.lineTo(r[i],r[i+1])}return t.closePath(),e&&e.value()}hullPolygon(){const t=new vs;return this.renderHull(t),t.value()}renderTriangle(t,e){const n=null==e?e=new bs:void 0,{points:r,triangles:i}=this,o=2*i[t*=3],a=2*i[t+1],s=2*i[t+2];return e.moveTo(r[o],r[o+1]),e.lineTo(r[a],r[a+1]),e.lineTo(r[s],r[s+1]),e.closePath(),n&&n.value()}*trianglePolygons(){const{triangles:t}=this;for(let e=0,n=t.length/3;e<n;++e)yield this.trianglePolygon(e)}trianglePolygon(t){const e=new vs;return this.renderTriangle(t,e),e.value()}}var ks={},Ms={};function Rs(t){return new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'}).join(",")+"}")}function Os(t){var e=Object.create(null),n=[];return t.forEach(function(t){for(var r in t)r in e||n.push(e[r]=r)}),n}function Ns(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function Is(t){var e,n=t.getUTCHours(),r=t.getUTCMinutes(),i=t.getUTCSeconds(),o=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":((e=t.getUTCFullYear())<0?"-"+Ns(-e,6):e>9999?"+"+Ns(e,6):Ns(e,4))+"-"+Ns(t.getUTCMonth()+1,2)+"-"+Ns(t.getUTCDate(),2)+(o?"T"+Ns(n,2)+":"+Ns(r,2)+":"+Ns(i,2)+"."+Ns(o,3)+"Z":i?"T"+Ns(n,2)+":"+Ns(r,2)+":"+Ns(i,2)+"Z":r||n?"T"+Ns(n,2)+":"+Ns(r,2)+"Z":"")}function Ls(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],o=t.length,a=0,s=0,l=o<=0,c=!1;function u(){if(l)return Ms;if(c)return c=!1,ks;var e,r,i=a;if(34===t.charCodeAt(i)){for(;a++<o&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(e=a)>=o?l=!0:10===(r=t.charCodeAt(a++))?c=!0:13===r&&(c=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a<o;){if(10===(r=t.charCodeAt(e=a++)))c=!0;else if(13===r)c=!0,10===t.charCodeAt(a)&&++a;else if(r!==n)continue;return t.slice(i,e)}return l=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=u())!==Ms;){for(var h=[];r!==ks&&r!==Ms;)h.push(r),r=u();e&&null==(h=e(h,s++))||i.push(h)}return i}function i(e,n){return e.map(function(e){return n.map(function(t){return a(e[t])}).join(t)})}function o(e){return e.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?Is(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,o=r(t,function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=Rs(t);return function(r,i){return e(n(r),i,t)}}(t,e):Rs(t)});return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=Os(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=Os(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}var Ps=Ls(","),Vs=Ps.parse,Ds=Ps.parseRows,Bs=Ps.format,zs=Ps.formatBody,Fs=Ps.formatRows,Gs=Ps.formatRow,js=Ps.formatValue,Us=Ls("\t"),Ys=Us.parse,Hs=Us.parseRows,qs=Us.format,Ws=Us.formatBody,$s=Us.formatRows,Xs=Us.formatRow,Ks=Us.formatValue;function Zs(t){for(var e in t){var n,r,i=t[e].trim();if(i)if("true"===i)i=!0;else if("false"===i)i=!1;else if("NaN"===i)i=NaN;else if(isNaN(n=+i)){if(!(r=i.match(/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/)))continue;Js&&r[4]&&!r[7]&&(i=i.replace(/-/g,"/").replace(/T/," ")),i=new Date(i)}else i=n;else i=null;t[e]=i}return t}const Js=new Date("2019-01-01T00:00").getHours()||new Date("2019-07-01T00:00").getHours();function Qs(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.blob()}function tl(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.arrayBuffer()}function el(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function nl(t,e){return fetch(t,e).then(el)}function rl(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=void 0),nl(e,n).then(function(e){return t(e,r)})}}var il=rl(Vs),ol=rl(Ys);function al(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}function sl(t){return(e,n)=>nl(e,n).then(e=>(new DOMParser).parseFromString(e,t))}var ll=sl("application/xml"),cl=sl("text/html"),ul=sl("image/svg+xml");function hl(t,e){var n,r=1;function i(){var i,o,a=n.length,s=0,l=0;for(i=0;i<a;++i)s+=(o=n[i]).x,l+=o.y;for(s=(s/a-t)*r,l=(l/a-e)*r,i=0;i<a;++i)(o=n[i]).x-=s,o.y-=l}return null==t&&(t=0),null==e&&(e=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.strength=function(t){return arguments.length?(r=+t,i):r},i}function fl(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,s,l,c,u,h,f,d=t._root,p={data:r},g=t._x0,_=t._y0,y=t._x1,m=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((c=e>=(o=(g+y)/2))?g=o:y=o,(u=n>=(a=(_+m)/2))?_=a:m=a,i=d,!(d=d[h=u<<1|c]))return i[h]=p,t;if(s=+t._x.call(null,d.data),l=+t._y.call(null,d.data),e===s&&n===l)return p.next=d,i?i[h]=p:t._root=p,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(c=e>=(o=(g+y)/2))?g=o:y=o,(u=n>=(a=(_+m)/2))?_=a:m=a}while((h=u<<1|c)==(f=(l>=a)<<1|s>=o));return i[f]=d,i[h]=p,t}function dl(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function pl(t){return t[0]}function gl(t){return t[1]}function _l(t,e,n){var r=new yl(null==e?pl:e,null==n?gl:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function yl(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function ml(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var bl=_l.prototype=yl.prototype;function vl(t){return function(){return t}}function xl(t){return 1e-6*(t()-.5)}function wl(t){return t.x+t.vx}function El(t){return t.y+t.vy}function Al(t){return t.index}function Tl(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function Sl(t){var e,n,r,i,o,a,s=Al,l=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},c=vl(30),u=1;function h(r){for(var i=0,s=t.length;i<u;++i)for(var l,c,h,f,d,p,g,_=0;_<s;++_)c=(l=t[_]).source,f=(h=l.target).x+h.vx-c.x-c.vx||xl(a),d=h.y+h.vy-c.y-c.vy||xl(a),f*=p=((p=Math.sqrt(f*f+d*d))-n[_])/p*r*e[_],d*=p,h.vx-=f*(g=o[_]),h.vy-=d*g,c.vx+=f*(g=1-g),c.vy+=d*g}function f(){if(r){var a,l,c=r.length,u=t.length,h=new Map(r.map((t,e)=>[s(t,e,r),t]));for(a=0,i=new Array(c);a<u;++a)(l=t[a]).index=a,"object"!=typeof l.source&&(l.source=Tl(h,l.source)),"object"!=typeof l.target&&(l.target=Tl(h,l.target)),i[l.source.index]=(i[l.source.index]||0)+1,i[l.target.index]=(i[l.target.index]||0)+1;for(a=0,o=new Array(u);a<u;++a)l=t[a],o[a]=i[l.source.index]/(i[l.source.index]+i[l.target.index]);e=new Array(u),d(),n=new Array(u),p()}}function d(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+l(t[n],n,t)}function p(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+c(t[e],e,t)}return null==t&&(t=[]),h.initialize=function(t,e){r=t,a=e,f()},h.links=function(e){return arguments.length?(t=e,f(),h):t},h.id=function(t){return arguments.length?(s=t,h):s},h.iterations=function(t){return arguments.length?(u=+t,h):u},h.strength=function(t){return arguments.length?(l="function"==typeof t?t:vl(+t),d(),h):l},h.distance=function(t){return arguments.length?(c="function"==typeof t?t:vl(+t),p(),h):c},h}bl.copy=function(){var t,e,n=new yl(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=ml(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=ml(e));return n},bl.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return fl(this.cover(e,n),e,n,t)},bl.addAll=function(t){var e,n,r,i,o=t.length,a=new Array(o),s=new Array(o),l=1/0,c=1/0,u=-1/0,h=-1/0;for(n=0;n<o;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(i=+this._y.call(null,e))||(a[n]=r,s[n]=i,r<l&&(l=r),r>u&&(u=r),i<c&&(c=i),i>h&&(h=i));if(l>u||c>h)return this;for(this.cover(l,c).cover(u,h),n=0;n<o;++n)fl(this,a[n],s[n],t[n]);return this},bl.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1;else{for(var a,s,l=i-n||1,c=this._root;n>t||t>=i||r>e||e>=o;)switch(s=(e<r)<<1|t<n,(a=new Array(4))[s]=c,c=a,l*=2,s){case 0:i=n+l,o=r+l;break;case 1:n=i-l,o=r+l;break;case 2:i=n+l,r=o-l;break;case 3:n=i-l,r=o-l}this._root&&this._root.length&&(this._root=c)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this},bl.data=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},bl.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},bl.find=function(t,e,n){var r,i,o,a,s,l,c,u=this._x0,h=this._y0,f=this._x1,d=this._y1,p=[],g=this._root;for(g&&p.push(new dl(g,u,h,f,d)),null==n?n=1/0:(u=t-n,h=e-n,f=t+n,d=e+n,n*=n);l=p.pop();)if(!(!(g=l.node)||(i=l.x0)>f||(o=l.y0)>d||(a=l.x1)<u||(s=l.y1)<h))if(g.length){var _=(i+a)/2,y=(o+s)/2;p.push(new dl(g[3],_,y,a,s),new dl(g[2],i,y,_,s),new dl(g[1],_,o,a,y),new dl(g[0],i,o,_,y)),(c=(e>=y)<<1|t>=_)&&(l=p[p.length-1],p[p.length-1]=p[p.length-1-c],p[p.length-1-c]=l)}else{var m=t-+this._x.call(null,g.data),b=e-+this._y.call(null,g.data),v=m*m+b*b;if(v<n){var x=Math.sqrt(n=v);u=t-x,h=e-x,f=t+x,d=e+x,r=g.data}}return r},bl.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var e,n,r,i,o,a,s,l,c,u,h,f,d=this._root,p=this._x0,g=this._y0,_=this._x1,y=this._y1;if(!d)return this;if(d.length)for(;;){if((c=o>=(s=(p+_)/2))?p=s:_=s,(u=a>=(l=(g+y)/2))?g=l:y=l,e=d,!(d=d[h=u<<1|c]))return this;if(!d.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(n=e,f=h)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):e?(i?e[h]=i:delete e[h],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[f]=d:this._root=d),this):(this._root=i,this)},bl.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},bl.root=function(){return this._root},bl.size=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},bl.visit=function(t){var e,n,r,i,o,a,s=[],l=this._root;for(l&&s.push(new dl(l,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(l=e.node,r=e.x0,i=e.y0,o=e.x1,a=e.y1)&&l.length){var c=(r+o)/2,u=(i+a)/2;(n=l[3])&&s.push(new dl(n,c,u,o,a)),(n=l[2])&&s.push(new dl(n,r,u,c,a)),(n=l[1])&&s.push(new dl(n,c,i,o,u)),(n=l[0])&&s.push(new dl(n,r,i,c,u))}return this},bl.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new dl(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var o,a=e.x0,s=e.y0,l=e.x1,c=e.y1,u=(a+l)/2,h=(s+c)/2;(o=i[0])&&n.push(new dl(o,a,s,u,h)),(o=i[1])&&n.push(new dl(o,u,s,l,h)),(o=i[2])&&n.push(new dl(o,a,h,u,c)),(o=i[3])&&n.push(new dl(o,u,h,l,c))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},bl.x=function(t){return arguments.length?(this._x=t,this):this._x},bl.y=function(t){return arguments.length?(this._y=t,this):this._y};const Cl=4294967296;function kl(t){return t.x}function Ml(t){return t.y}var Rl=Math.PI*(3-Math.sqrt(5));function Ol(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,s=new Map,l=Ti(h),c=Nt("tick","end"),u=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Cl)/Cl}();function h(){f(),c.call("tick",e),n<r&&(l.stop(),c.call("end",e))}function f(r){var l,c,u=t.length;void 0===r&&(r=1);for(var h=0;h<r;++h)for(n+=(o-n)*i,s.forEach(function(t){t(n)}),l=0;l<u;++l)null==(c=t[l]).fx?c.x+=c.vx*=a:(c.x=c.fx,c.vx=0),null==c.fy?c.y+=c.vy*=a:(c.y=c.fy,c.vy=0);return e}function d(){for(var e,n=0,r=t.length;n<r;++n){if((e=t[n]).index=n,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var i=10*Math.sqrt(.5+n),o=n*Rl;e.x=i*Math.cos(o),e.y=i*Math.sin(o)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function p(e){return e.initialize&&e.initialize(t,u),e}return null==t&&(t=[]),d(),e={tick:f,restart:function(){return l.restart(h),e},stop:function(){return l.stop(),e},nodes:function(n){return arguments.length?(t=n,d(),s.forEach(p),e):t},alpha:function(t){return arguments.length?(n=+t,e):n},alphaMin:function(t){return arguments.length?(r=+t,e):r},alphaDecay:function(t){return arguments.length?(i=+t,e):+i},alphaTarget:function(t){return arguments.length?(o=+t,e):o},velocityDecay:function(t){return arguments.length?(a=1-t,e):1-a},randomSource:function(t){return arguments.length?(u=t,s.forEach(p),e):u},force:function(t,n){return arguments.length>1?(null==n?s.delete(t):s.set(t,p(n)),e):s.get(t)},find:function(e,n,r){var i,o,a,s,l,c=0,u=t.length;for(null==r?r=1/0:r*=r,c=0;c<u;++c)(a=(i=e-(s=t[c]).x)*i+(o=n-s.y)*o)<r&&(l=s,r=a);return l},on:function(t,n){return arguments.length>1?(c.on(t,n),e):c.on(t)}}}function Nl(){var t,e,n,r,i,o=vl(-30),a=1,s=1/0,l=.81;function c(n){var i,o=t.length,a=_l(t,kl,Ml).visitAfter(h);for(r=n,i=0;i<o;++i)e=t[i],a.visit(f)}function u(){if(t){var e,n,r=t.length;for(i=new Array(r),e=0;e<r;++e)n=t[e],i[n.index]=+o(n,e,t)}}function h(t){var e,n,r,o,a,s=0,l=0;if(t.length){for(r=o=a=0;a<4;++a)(e=t[a])&&(n=Math.abs(e.value))&&(s+=e.value,l+=n,r+=n*e.x,o+=n*e.y);t.x=r/l,t.y=o/l}else{(e=t).x=e.data.x,e.y=e.data.y;do{s+=i[e.data.index]}while(e=e.next)}t.value=s}function f(t,o,c,u){if(!t.value)return!0;var h=t.x-e.x,f=t.y-e.y,d=u-o,p=h*h+f*f;if(d*d/l<p)return p<s&&(0===h&&(p+=(h=xl(n))*h),0===f&&(p+=(f=xl(n))*f),p<a&&(p=Math.sqrt(a*p)),e.vx+=h*t.value*r/p,e.vy+=f*t.value*r/p),!0;if(!(t.length||p>=s)){(t.data!==e||t.next)&&(0===h&&(p+=(h=xl(n))*h),0===f&&(p+=(f=xl(n))*f),p<a&&(p=Math.sqrt(a*p)));do{t.data!==e&&(d=i[t.data.index]*r/p,e.vx+=h*d,e.vy+=f*d)}while(t=t.next)}}return c.initialize=function(e,r){t=e,n=r,u()},c.strength=function(t){return arguments.length?(o="function"==typeof t?t:vl(+t),u(),c):o},c.distanceMin=function(t){return arguments.length?(a=t*t,c):Math.sqrt(a)},c.distanceMax=function(t){return arguments.length?(s=t*t,c):Math.sqrt(s)},c.theta=function(t){return arguments.length?(l=t*t,c):Math.sqrt(l)},c}function Il(t){var e,n,r,i=vl(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vx+=(r[o]-i.x)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=vl(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:vl(+t),a(),o):i},o.x=function(e){return arguments.length?(t="function"==typeof e?e:vl(+e),a(),o):t},o}function Ll(t){var e,n,r,i=vl(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vy+=(r[o]-i.y)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=vl(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:vl(+t),a(),o):i},o.y=function(e){return arguments.length?(t="function"==typeof e?e:vl(+e),a(),o):t},o}function Pl(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Vl(t){return(t=Pl(Math.abs(t)))?t[1]:NaN}var Dl,Bl=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function zl(t){if(!(e=Bl.exec(t)))throw new Error("invalid format: "+t);var e;return new Fl({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Fl(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Gl(t,e){var n=Pl(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}zl.prototype=Fl.prototype,Fl.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var jl={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Gl(100*t,e),r:Gl,s:function(t,e){var n=Pl(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(Dl=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Pl(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ul(t){return t}var Yl,Hl,ql,Wl=Array.prototype.map,$l=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Xl(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Ul:(e=Wl.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=e[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),o.push(t.substring(i-=s,i+s)),!((l+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?Ul:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(Wl.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function h(t){var e=(t=zl(t)).fill,n=t.align,h=t.sign,f=t.symbol,d=t.zero,p=t.width,g=t.comma,_=t.precision,y=t.trim,m=t.type;"n"===m?(g=!0,m="g"):jl[m]||(void 0===_&&(_=12),y=!0,m="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var b="$"===f?i:"#"===f&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",v="$"===f?o:/[%p]/.test(m)?l:"",x=jl[m],w=/[defgprs%]/.test(m);function E(t){var i,o,l,f=b,E=v;if("c"===m)E=x(t)+E,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:x(Math.abs(t),_),y&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),A&&0===+t&&"+"!==h&&(A=!1),f=(A?"("===h?h:c:"-"===h||"("===h?"":h)+f,E=("s"===m?$l[8+Dl/3]:"")+E+(A&&"("===h?")":""),w)for(i=-1,o=t.length;++i<o;)if(48>(l=t.charCodeAt(i))||l>57){E=(46===l?a+t.slice(i+1):t.slice(i))+E,t=t.slice(0,i);break}}g&&!d&&(t=r(t,1/0));var T=f.length+t.length+E.length,S=T<p?new Array(p-T+1).join(e):"";switch(g&&d&&(t=r(S+t,S.length?p-E.length:1/0),S=""),n){case"<":t=f+t+E+S;break;case"=":t=f+S+t+E;break;case"^":t=S.slice(0,T=S.length>>1)+f+t+E+S.slice(T);break;default:t=S+f+t+E}return s(t)}return _=void 0===_?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_)),E.toString=function(){return t+""},E}return{format:h,formatPrefix:function(t,e){var n=h(((t=zl(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Vl(e)/3))),i=Math.pow(10,-r),o=$l[8+r/3];return function(t){return n(i*t)+o}}}}function Kl(t){return Yl=Xl(t),Hl=Yl.format,ql=Yl.formatPrefix,Yl}function Zl(t){return Math.max(0,-Vl(Math.abs(t)))}function Jl(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Vl(e)/3)))-Vl(Math.abs(t)))}function Ql(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Vl(e)-Vl(t))+1}Kl({thousands:",",grouping:[3],currency:["$",""]});var tc=1e-6,ec=1e-12,nc=Math.PI,rc=nc/2,ic=nc/4,oc=2*nc,ac=180/nc,sc=nc/180,lc=Math.abs,cc=Math.atan,uc=Math.atan2,hc=Math.cos,fc=Math.ceil,dc=Math.exp,pc=Math.hypot,gc=Math.log,_c=Math.pow,yc=Math.sin,mc=Math.sign||function(t){return t>0?1:t<0?-1:0},bc=Math.sqrt,vc=Math.tan;function xc(t){return t>1?0:t<-1?nc:Math.acos(t)}function wc(t){return t>1?rc:t<-1?-rc:Math.asin(t)}function Ec(t){return(t=yc(t/2))*t}function Ac(){}function Tc(t,e){t&&Cc.hasOwnProperty(t.type)&&Cc[t.type](t,e)}var Sc={Feature:function(t,e){Tc(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)Tc(n[r].geometry,e)}},Cc={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){kc(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)kc(n[r],e,0)},Polygon:function(t,e){Mc(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Mc(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)Tc(n[r],e)}};function kc(t,e,n){var r,i=-1,o=t.length-n;for(e.lineStart();++i<o;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function Mc(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)kc(t[n],e,1);e.polygonEnd()}function Rc(t,e){t&&Sc.hasOwnProperty(t.type)?Sc[t.type](t,e):Tc(t,e)}var Oc,Nc,Ic,Lc,Pc,Vc,Dc,Bc,zc,Fc,Gc,jc,Uc,Yc,Hc,qc,Wc=new w,$c=new w,Xc={point:Ac,lineStart:Ac,lineEnd:Ac,polygonStart:function(){Wc=new w,Xc.lineStart=Kc,Xc.lineEnd=Zc},polygonEnd:function(){var t=+Wc;$c.add(t<0?oc+t:t),this.lineStart=this.lineEnd=this.point=Ac},sphere:function(){$c.add(oc)}};function Kc(){Xc.point=Jc}function Zc(){Qc(Oc,Nc)}function Jc(t,e){Xc.point=Qc,Oc=t,Nc=e,Ic=t*=sc,Lc=hc(e=(e*=sc)/2+ic),Pc=yc(e)}function Qc(t,e){var n=(t*=sc)-Ic,r=n>=0?1:-1,i=r*n,o=hc(e=(e*=sc)/2+ic),a=yc(e),s=Pc*a,l=Lc*o+s*hc(i),c=s*r*yc(i);Wc.add(uc(c,l)),Ic=t,Lc=o,Pc=a}function tu(t){return[uc(t[1],t[0]),wc(t[2])]}function eu(t){var e=t[0],n=t[1],r=hc(n);return[r*hc(e),r*yc(e),yc(n)]}function nu(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ru(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function iu(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function ou(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function au(t){var e=bc(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var su,lu,cu,uu,hu,fu,du,pu,gu,_u,yu,mu,bu,vu,xu,wu,Eu={point:Au,lineStart:Su,lineEnd:Cu,polygonStart:function(){Eu.point=ku,Eu.lineStart=Mu,Eu.lineEnd=Ru,Yc=new w,Xc.polygonStart()},polygonEnd:function(){Xc.polygonEnd(),Eu.point=Au,Eu.lineStart=Su,Eu.lineEnd=Cu,Wc<0?(Vc=-(Bc=180),Dc=-(zc=90)):Yc>tc?zc=90:Yc<-1e-6&&(Dc=-90),qc[0]=Vc,qc[1]=Bc},sphere:function(){Vc=-(Bc=180),Dc=-(zc=90)}};function Au(t,e){Hc.push(qc=[Vc=t,Bc=t]),e<Dc&&(Dc=e),e>zc&&(zc=e)}function Tu(t,e){var n=eu([t*sc,e*sc]);if(Uc){var r=ru(Uc,n),i=ru([r[1],-r[0],0],r);au(i),i=tu(i);var o,a=t-Fc,s=a>0?1:-1,l=i[0]*ac*s,c=lc(a)>180;c^(s*Fc<l&&l<s*t)?(o=i[1]*ac)>zc&&(zc=o):c^(s*Fc<(l=(l+360)%360-180)&&l<s*t)?(o=-i[1]*ac)<Dc&&(Dc=o):(e<Dc&&(Dc=e),e>zc&&(zc=e)),c?t<Fc?Ou(Vc,t)>Ou(Vc,Bc)&&(Bc=t):Ou(t,Bc)>Ou(Vc,Bc)&&(Vc=t):Bc>=Vc?(t<Vc&&(Vc=t),t>Bc&&(Bc=t)):t>Fc?Ou(Vc,t)>Ou(Vc,Bc)&&(Bc=t):Ou(t,Bc)>Ou(Vc,Bc)&&(Vc=t)}else Hc.push(qc=[Vc=t,Bc=t]);e<Dc&&(Dc=e),e>zc&&(zc=e),Uc=n,Fc=t}function Su(){Eu.point=Tu}function Cu(){qc[0]=Vc,qc[1]=Bc,Eu.point=Au,Uc=null}function ku(t,e){if(Uc){var n=t-Fc;Yc.add(lc(n)>180?n+(n>0?360:-360):n)}else Gc=t,jc=e;Xc.point(t,e),Tu(t,e)}function Mu(){Xc.lineStart()}function Ru(){ku(Gc,jc),Xc.lineEnd(),lc(Yc)>tc&&(Vc=-(Bc=180)),qc[0]=Vc,qc[1]=Bc,Uc=null}function Ou(t,e){return(e-=t)<0?e+360:e}function Nu(t,e){return t[0]-e[0]}function Iu(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e<t[0]||t[1]<e}var Lu={sphere:Ac,point:Pu,lineStart:Du,lineEnd:Fu,polygonStart:function(){Lu.lineStart=Gu,Lu.lineEnd=ju},polygonEnd:function(){Lu.lineStart=Du,Lu.lineEnd=Fu}};function Pu(t,e){t*=sc;var n=hc(e*=sc);Vu(n*hc(t),n*yc(t),yc(e))}function Vu(t,e,n){++su,cu+=(t-cu)/su,uu+=(e-uu)/su,hu+=(n-hu)/su}function Du(){Lu.point=Bu}function Bu(t,e){t*=sc;var n=hc(e*=sc);vu=n*hc(t),xu=n*yc(t),wu=yc(e),Lu.point=zu,Vu(vu,xu,wu)}function zu(t,e){t*=sc;var n=hc(e*=sc),r=n*hc(t),i=n*yc(t),o=yc(e),a=uc(bc((a=xu*o-wu*i)*a+(a=wu*r-vu*o)*a+(a=vu*i-xu*r)*a),vu*r+xu*i+wu*o);lu+=a,fu+=a*(vu+(vu=r)),du+=a*(xu+(xu=i)),pu+=a*(wu+(wu=o)),Vu(vu,xu,wu)}function Fu(){Lu.point=Pu}function Gu(){Lu.point=Uu}function ju(){Yu(mu,bu),Lu.point=Pu}function Uu(t,e){mu=t,bu=e,t*=sc,e*=sc,Lu.point=Yu;var n=hc(e);vu=n*hc(t),xu=n*yc(t),wu=yc(e),Vu(vu,xu,wu)}function Yu(t,e){t*=sc;var n=hc(e*=sc),r=n*hc(t),i=n*yc(t),o=yc(e),a=xu*o-wu*i,s=wu*r-vu*o,l=vu*i-xu*r,c=pc(a,s,l),u=wc(c),h=c&&-u/c;gu.add(h*a),_u.add(h*s),yu.add(h*l),lu+=u,fu+=u*(vu+(vu=r)),du+=u*(xu+(xu=i)),pu+=u*(wu+(wu=o)),Vu(vu,xu,wu)}function Hu(t){return function(){return t}}function qu(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,r){return(n=e.invert(n,r))&&t.invert(n[0],n[1])}),n}function Wu(t,e){return lc(t)>nc&&(t-=Math.round(t/oc)*oc),[t,e]}function $u(t,e,n){return(t%=oc)?e||n?qu(Ku(t),Zu(e,n)):Ku(t):e||n?Zu(e,n):Wu}function Xu(t){return function(e,n){return lc(e+=t)>nc&&(e-=Math.round(e/oc)*oc),[e,n]}}function Ku(t){var e=Xu(t);return e.invert=Xu(-t),e}function Zu(t,e){var n=hc(t),r=yc(t),i=hc(e),o=yc(e);function a(t,e){var a=hc(e),s=hc(t)*a,l=yc(t)*a,c=yc(e),u=c*n+s*r;return[uc(l*i-u*o,s*n-c*r),wc(u*i+l*o)]}return a.invert=function(t,e){var a=hc(e),s=hc(t)*a,l=yc(t)*a,c=yc(e),u=c*i-l*o;return[uc(l*i+c*o,s*n+u*r),wc(u*n-s*r)]},a}function Ju(t){function e(e){return(e=t(e[0]*sc,e[1]*sc))[0]*=ac,e[1]*=ac,e}return t=$u(t[0]*sc,t[1]*sc,t.length>2?t[2]*sc:0),e.invert=function(e){return(e=t.invert(e[0]*sc,e[1]*sc))[0]*=ac,e[1]*=ac,e},e}function Qu(t,e,n,r,i,o){if(n){var a=hc(e),s=yc(e),l=r*n;null==i?(i=e+r*oc,o=e-l/2):(i=th(a,i),o=th(a,o),(r>0?i<o:i>o)&&(i+=r*oc));for(var c,u=i;r>0?u>o:u<o;u-=l)c=tu([a,-s*hc(u),-s*yc(u)]),t.point(c[0],c[1])}}function th(t,e){(e=eu(e))[0]-=t,au(e);var n=xc(-e[1]);return((-e[2]<0?-n:n)+oc-tc)%oc}function eh(){var t,e=[];return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:Ac,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function nh(t,e){return lc(t[0]-e[0])<tc&&lc(t[1]-e[1])<tc}function rh(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function ih(t,e,n,r,i){var o,a,s=[],l=[];if(t.forEach(function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],a=t[e];if(nh(r,a)){if(!r[2]&&!a[2]){for(i.lineStart(),o=0;o<e;++o)i.point((r=t[o])[0],r[1]);return void i.lineEnd()}a[0]+=2e-6}s.push(n=new rh(r,t,null,!0)),l.push(n.o=new rh(r,null,n,!1)),s.push(n=new rh(a,t,null,!1)),l.push(n.o=new rh(a,null,n,!0))}}),s.length){for(l.sort(e),oh(s),oh(l),o=0,a=l.length;o<a;++o)l[o].e=n=!n;for(var c,u,h=s[0];;){for(var f=h,d=!0;f.v;)if((f=f.n)===h)return;c=f.z,i.lineStart();do{if(f.v=f.o.v=!0,f.e){if(d)for(o=0,a=c.length;o<a;++o)i.point((u=c[o])[0],u[1]);else r(f.x,f.n.x,1,i);f=f.n}else{if(d)for(c=f.p.z,o=c.length-1;o>=0;--o)i.point((u=c[o])[0],u[1]);else r(f.x,f.p.x,-1,i);f=f.p}c=(f=f.o).z,d=!d}while(!f.v);i.lineEnd()}}}function oh(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}function ah(t){return lc(t[0])<=nc?t[0]:mc(t[0])*((lc(t[0])+nc)%oc-nc)}function sh(t,e){var n=ah(e),r=e[1],i=yc(r),o=[yc(n),-hc(n),0],a=0,s=0,l=new w;1===i?r=rc+tc:-1===i&&(r=-rc-tc);for(var c=0,u=t.length;c<u;++c)if(f=(h=t[c]).length)for(var h,f,d=h[f-1],p=ah(d),g=d[1]/2+ic,_=yc(g),y=hc(g),m=0;m<f;++m,p=v,_=E,y=A,d=b){var b=h[m],v=ah(b),x=b[1]/2+ic,E=yc(x),A=hc(x),T=v-p,S=T>=0?1:-1,C=S*T,k=C>nc,M=_*E;if(l.add(uc(M*S*yc(C),y*A+M*hc(C))),a+=k?T+S*oc:T,k^p>=n^v>=n){var R=ru(eu(d),eu(b));au(R);var O=ru(o,R);au(O);var N=(k^T>=0?-1:1)*wc(O[2]);(r>N||r===N&&(R[0]||R[1]))&&(s+=k^T>=0?1:-1)}}return(a<-1e-6||a<tc&&l<-1e-12)^1&s}function lh(t,e,n,r){return function(i){var o,a,s,l=e(i),c=eh(),u=e(c),h=!1,f={point:d,lineStart:g,lineEnd:_,polygonStart:function(){f.point=y,f.lineStart=m,f.lineEnd=b,a=[],o=[]},polygonEnd:function(){f.point=d,f.lineStart=g,f.lineEnd=_,a=ht(a);var t=sh(o,r);a.length?(h||(i.polygonStart(),h=!0),ih(a,uh,t,n,i)):t&&(h||(i.polygonStart(),h=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),h&&(i.polygonEnd(),h=!1),a=o=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(e,n){t(e,n)&&i.point(e,n)}function p(t,e){l.point(t,e)}function g(){f.point=p,l.lineStart()}function _(){f.point=d,l.lineEnd()}function y(t,e){s.push([t,e]),u.point(t,e)}function m(){u.lineStart(),s=[]}function b(){y(s[0][0],s[0][1]),u.lineEnd();var t,e,n,r,l=u.clean(),f=c.result(),d=f.length;if(s.pop(),o.push(s),s=null,d)if(1&l){if((e=(n=f[0]).length-1)>0){for(h||(i.polygonStart(),h=!0),i.lineStart(),t=0;t<e;++t)i.point((r=n[t])[0],r[1]);i.lineEnd()}}else d>1&&2&l&&f.push(f.pop().concat(f.shift())),a.push(f.filter(ch))}return f}}function ch(t){return t.length>1}function uh(t,e){return((t=t.x)[0]<0?t[1]-rc-tc:rc-t[1])-((e=e.x)[0]<0?e[1]-rc-tc:rc-e[1])}Wu.invert=Wu;var hh=lh(function(){return!0},function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?nc:-nc,l=lc(o-n);lc(l-nc)<tc?(t.point(n,r=(r+a)/2>0?rc:-rc),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(o,r),e=0):i!==s&&l>=nc&&(lc(n-i)<tc&&(n-=i*tc),lc(o-s)<tc&&(o-=s*tc),r=function(t,e,n,r){var i,o,a=yc(t-n);return lc(a)>tc?cc((yc(e)*(o=hc(r))*yc(n)-yc(r)*(i=hc(e))*yc(t))/(i*o*a)):(e+r)/2}(n,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),e=0),t.point(n=o,r=a),i=s},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}},function(t,e,n,r){var i;if(null==t)i=n*rc,r.point(-nc,i),r.point(0,i),r.point(nc,i),r.point(nc,0),r.point(nc,-i),r.point(0,-i),r.point(-nc,-i),r.point(-nc,0),r.point(-nc,i);else if(lc(t[0]-e[0])>tc){var o=t[0]<e[0]?nc:-nc;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(e[0],e[1])},[-nc,-rc]);function fh(t){var e=hc(t),n=2*sc,r=e>0,i=lc(e)>tc;function o(t,n){return hc(t)*hc(n)>e}function a(t,n,r){var i=[1,0,0],o=ru(eu(t),eu(n)),a=nu(o,o),s=o[0],l=a-s*s;if(!l)return!r&&t;var c=e*a/l,u=-e*s/l,h=ru(i,o),f=ou(i,c);iu(f,ou(o,u));var d=h,p=nu(f,d),g=nu(d,d),_=p*p-g*(nu(f,f)-1);if(!(_<0)){var y=bc(_),m=ou(d,(-p-y)/g);if(iu(m,f),m=tu(m),!r)return m;var b,v=t[0],x=n[0],w=t[1],E=n[1];x<v&&(b=v,v=x,x=b);var A=x-v,T=lc(A-nc)<tc;if(!T&&E<w&&(b=w,w=E,E=b),T||A<tc?T?w+E>0^m[1]<(lc(m[0]-v)<tc?w:E):w<=m[1]&&m[1]<=E:A>nc^(v<=m[0]&&m[0]<=x)){var S=ou(d,(-p+y)/g);return iu(S,f),[m,tu(S)]}}}function s(e,n){var i=r?t:nc-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return lh(o,function(t){var e,n,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(h,f){var d,p=[h,f],g=o(h,f),_=r?g?0:s(h,f):g?s(h+(h<0?nc:-nc),f):0;if(!e&&(c=l=g)&&t.lineStart(),g!==l&&(!(d=a(e,p))||nh(e,d)||nh(p,d))&&(p[2]=1),g!==l)u=0,g?(t.lineStart(),d=a(p,e),t.point(d[0],d[1])):(d=a(e,p),t.point(d[0],d[1],2),t.lineEnd()),e=d;else if(i&&e&&r^g){var y;_&n||!(y=a(p,e,!0))||(u=0,r?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!g||e&&nh(e,p)||t.point(p[0],p[1]),e=p,l=g,n=_},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return u|(c&&l)<<1}}},function(e,r,i,o){Qu(o,t,n,i,e,r)},r?[0,-t]:[-nc,t-nc])}var dh,ph,gh,_h,yh=1e9,mh=-yh;function bh(t,e,n,r){function i(i,o){return t<=i&&i<=n&&e<=o&&o<=r}function o(i,o,s,c){var u=0,h=0;if(null==i||(u=a(i,s))!==(h=a(o,s))||l(i,o)<0^s>0)do{c.point(0===u||3===u?t:n,u>1?r:e)}while((u=(u+s+4)%4)!==h);else c.point(o[0],o[1])}function a(r,i){return lc(r[0]-t)<tc?i>0?0:3:lc(r[0]-n)<tc?i>0?2:1:lc(r[1]-e)<tc?i>0?1:0:i>0?3:2}function s(t,e){return l(t.x,e.x)}function l(t,e){var n=a(t,1),r=a(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(a){var l,c,u,h,f,d,p,g,_,y,m,b=a,v=eh(),x={point:w,lineStart:function(){x.point=E,c&&c.push(u=[]);y=!0,_=!1,p=g=NaN},lineEnd:function(){l&&(E(h,f),d&&_&&v.rejoin(),l.push(v.result()));x.point=w,_&&b.lineEnd()},polygonStart:function(){b=v,l=[],c=[],m=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=c.length;n<i;++n)for(var o,a,s=c[n],l=1,u=s.length,h=s[0],f=h[0],d=h[1];l<u;++l)o=f,a=d,f=(h=s[l])[0],d=h[1],a<=r?d>r&&(f-o)*(r-a)>(d-a)*(t-o)&&++e:d<=r&&(f-o)*(r-a)<(d-a)*(t-o)&&--e;return e}(),n=m&&e,i=(l=ht(l)).length;(n||i)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&ih(l,s,e,o,a),a.polygonEnd());b=a,l=c=u=null}};function w(t,e){i(t,e)&&b.point(t,e)}function E(o,a){var s=i(o,a);if(c&&u.push([o,a]),y)h=o,f=a,d=s,y=!1,s&&(b.lineStart(),b.point(o,a));else if(s&&_)b.point(o,a);else{var l=[p=Math.max(mh,Math.min(yh,p)),g=Math.max(mh,Math.min(yh,g))],v=[o=Math.max(mh,Math.min(yh,o)),a=Math.max(mh,Math.min(yh,a))];!function(t,e,n,r,i,o){var a,s=t[0],l=t[1],c=0,u=1,h=e[0]-s,f=e[1]-l;if(a=n-s,h||!(a>0)){if(a/=h,h<0){if(a<c)return;a<u&&(u=a)}else if(h>0){if(a>u)return;a>c&&(c=a)}if(a=i-s,h||!(a<0)){if(a/=h,h<0){if(a>u)return;a>c&&(c=a)}else if(h>0){if(a<c)return;a<u&&(u=a)}if(a=r-l,f||!(a>0)){if(a/=f,f<0){if(a<c)return;a<u&&(u=a)}else if(f>0){if(a>u)return;a>c&&(c=a)}if(a=o-l,f||!(a<0)){if(a/=f,f<0){if(a>u)return;a>c&&(c=a)}else if(f>0){if(a<c)return;a<u&&(u=a)}return c>0&&(t[0]=s+c*h,t[1]=l+c*f),u<1&&(e[0]=s+u*h,e[1]=l+u*f),!0}}}}}(l,v,t,e,n,r)?s&&(b.lineStart(),b.point(o,a),m=!1):(_||(b.lineStart(),b.point(l[0],l[1])),b.point(v[0],v[1]),s||b.lineEnd(),m=!1)}p=o,g=a,_=s}return x}}var vh={sphere:Ac,point:Ac,lineStart:function(){vh.point=wh,vh.lineEnd=xh},lineEnd:Ac,polygonStart:Ac,polygonEnd:Ac};function xh(){vh.point=vh.lineEnd=Ac}function wh(t,e){ph=t*=sc,gh=yc(e*=sc),_h=hc(e),vh.point=Eh}function Eh(t,e){t*=sc;var n=yc(e*=sc),r=hc(e),i=lc(t-ph),o=hc(i),a=r*yc(i),s=_h*n-gh*r*o,l=gh*n+_h*r*o;dh.add(uc(bc(a*a+s*s),l)),ph=t,gh=n,_h=r}function Ah(t){return dh=new w,Rc(t,vh),+dh}var Th=[null,null],Sh={type:"LineString",coordinates:Th};function Ch(t,e){return Th[0]=t,Th[1]=e,Ah(Sh)}var kh={Feature:function(t,e){return Rh(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)if(Rh(n[r].geometry,e))return!0;return!1}},Mh={Sphere:function(){return!0},Point:function(t,e){return Oh(t.coordinates,e)},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)if(Oh(n[r],e))return!0;return!1},LineString:function(t,e){return Nh(t.coordinates,e)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)if(Nh(n[r],e))return!0;return!1},Polygon:function(t,e){return Ih(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)if(Ih(n[r],e))return!0;return!1},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)if(Rh(n[r],e))return!0;return!1}};function Rh(t,e){return!(!t||!Mh.hasOwnProperty(t.type))&&Mh[t.type](t,e)}function Oh(t,e){return 0===Ch(t,e)}function Nh(t,e){for(var n,r,i,o=0,a=t.length;o<a;o++){if(0===(r=Ch(t[o],e)))return!0;if(o>0&&(i=Ch(t[o],t[o-1]))>0&&n<=i&&r<=i&&(n+r-i)*(1-Math.pow((n-r)/i,2))<ec*i)return!0;n=r}return!1}function Ih(t,e){return!!sh(t.map(Lh),Ph(e))}function Lh(t){return(t=t.map(Ph)).pop(),t}function Ph(t){return[t[0]*sc,t[1]*sc]}function Vh(t,e,n){var r=dt(t,e-tc,n).concat(e);return function(t){return r.map(function(e){return[t,e]})}}function Dh(t,e,n){var r=dt(t,e-tc,n).concat(e);return function(t){return r.map(function(e){return[e,t]})}}function Bh(){var t,e,n,r,i,o,a,s,l,c,u,h,f=10,d=f,p=90,g=360,_=2.5;function y(){return{type:"MultiLineString",coordinates:m()}}function m(){return dt(fc(r/p)*p,n,p).map(u).concat(dt(fc(s/g)*g,a,g).map(h)).concat(dt(fc(e/f)*f,t,f).filter(function(t){return lc(t%p)>tc}).map(l)).concat(dt(fc(o/d)*d,i,d).filter(function(t){return lc(t%g)>tc}).map(c))}return y.lines=function(){return m().map(function(t){return{type:"LineString",coordinates:t}})},y.outline=function(){return{type:"Polygon",coordinates:[u(r).concat(h(a).slice(1),u(n).reverse().slice(1),h(s).reverse().slice(1))]}},y.extent=function(t){return arguments.length?y.extentMajor(t).extentMinor(t):y.extentMinor()},y.extentMajor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],s=+t[0][1],a=+t[1][1],r>n&&(t=r,r=n,n=t),s>a&&(t=s,s=a,a=t),y.precision(_)):[[r,s],[n,a]]},y.extentMinor=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],o=+n[0][1],i=+n[1][1],e>t&&(n=e,e=t,t=n),o>i&&(n=o,o=i,i=n),y.precision(_)):[[e,o],[t,i]]},y.step=function(t){return arguments.length?y.stepMajor(t).stepMinor(t):y.stepMinor()},y.stepMajor=function(t){return arguments.length?(p=+t[0],g=+t[1],y):[p,g]},y.stepMinor=function(t){return arguments.length?(f=+t[0],d=+t[1],y):[f,d]},y.precision=function(f){return arguments.length?(_=+f,l=Vh(o,i,90),c=Dh(e,t,_),u=Vh(s,a,90),h=Dh(r,n,_),y):_},y.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}var zh,Fh,Gh,jh,Uh=t=>t,Yh=new w,Hh=new w,qh={point:Ac,lineStart:Ac,lineEnd:Ac,polygonStart:function(){qh.lineStart=Wh,qh.lineEnd=Kh},polygonEnd:function(){qh.lineStart=qh.lineEnd=qh.point=Ac,Yh.add(lc(Hh)),Hh=new w},result:function(){var t=Yh/2;return Yh=new w,t}};function Wh(){qh.point=$h}function $h(t,e){qh.point=Xh,zh=Gh=t,Fh=jh=e}function Xh(t,e){Hh.add(jh*t-Gh*e),Gh=t,jh=e}function Kh(){Xh(zh,Fh)}var Zh=1/0,Jh=Zh,Qh=-Zh,tf=Qh,ef={point:function(t,e){t<Zh&&(Zh=t);t>Qh&&(Qh=t);e<Jh&&(Jh=e);e>tf&&(tf=e)},lineStart:Ac,lineEnd:Ac,polygonStart:Ac,polygonEnd:Ac,result:function(){var t=[[Zh,Jh],[Qh,tf]];return Qh=tf=-(Jh=Zh=1/0),t}};var nf,rf,of,af,sf=0,lf=0,cf=0,uf=0,hf=0,ff=0,df=0,pf=0,gf=0,_f={point:yf,lineStart:mf,lineEnd:xf,polygonStart:function(){_f.lineStart=wf,_f.lineEnd=Ef},polygonEnd:function(){_f.point=yf,_f.lineStart=mf,_f.lineEnd=xf},result:function(){var t=gf?[df/gf,pf/gf]:ff?[uf/ff,hf/ff]:cf?[sf/cf,lf/cf]:[NaN,NaN];return sf=lf=cf=uf=hf=ff=df=pf=gf=0,t}};function yf(t,e){sf+=t,lf+=e,++cf}function mf(){_f.point=bf}function bf(t,e){_f.point=vf,yf(of=t,af=e)}function vf(t,e){var n=t-of,r=e-af,i=bc(n*n+r*r);uf+=i*(of+t)/2,hf+=i*(af+e)/2,ff+=i,yf(of=t,af=e)}function xf(){_f.point=yf}function wf(){_f.point=Af}function Ef(){Tf(nf,rf)}function Af(t,e){_f.point=Tf,yf(nf=of=t,rf=af=e)}function Tf(t,e){var n=t-of,r=e-af,i=bc(n*n+r*r);uf+=i*(of+t)/2,hf+=i*(af+e)/2,ff+=i,df+=(i=af*t-of*e)*(of+t),pf+=i*(af+e),gf+=3*i,yf(of=t,af=e)}function Sf(t){this._context=t}Sf.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,oc)}},result:Ac};var Cf,kf,Mf,Rf,Of,Nf=new w,If={point:Ac,lineStart:function(){If.point=Lf},lineEnd:function(){Cf&&Pf(kf,Mf),If.point=Ac},polygonStart:function(){Cf=!0},polygonEnd:function(){Cf=null},result:function(){var t=+Nf;return Nf=new w,t}};function Lf(t,e){If.point=Pf,kf=Rf=t,Mf=Of=e}function Pf(t,e){Rf-=t,Of-=e,Nf.add(bc(Rf*Rf+Of*Of)),Rf=t,Of=e}let Vf,Df,Bf,zf;class Ff{constructor(t){this._append=null==t?Gf:function(t){const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return Gf;if(e!==Vf){const t=10**e;Vf=e,Df=function(e){let n=1;this._+=e[0];for(const r=e.length;n<r;++n)this._+=Math.round(arguments[n]*t)/t+e[n]}}return Df}(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(t,e){switch(this._point){case 0:this._append`M${t},${e}`,this._point=1;break;case 1:this._append`L${t},${e}`;break;default:if(this._append`M${t},${e}`,this._radius!==Bf||this._append!==Df){const t=this._radius,e=this._;this._="",this._append`m0,${t}a${t},${t} 0 1,1 0,${-2*t}a${t},${t} 0 1,1 0,${2*t}z`,Bf=t,Df=this._append,zf=this._,this._=e}this._+=zf}}result(){const t=this._;return this._="",t.length?t:null}}function Gf(t){let e=1;this._+=t[0];for(const n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function jf(t){return function(e){var n=new Uf;for(var r in t)n[r]=t[r];return n.stream=e,n}}function Uf(){}function Yf(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),Rc(n,t.stream(ef)),e(ef.result()),null!=r&&t.clipExtent(r),t}function Hf(t,e,n){return Yf(t,function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,s=+e[0][1]+(i-o*(n[1][1]+n[0][1]))/2;t.scale(150*o).translate([a,s])},n)}function qf(t,e,n){return Hf(t,[[0,0],e],n)}function Wf(t,e,n){return Yf(t,function(n){var r=+e,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];t.scale(150*i).translate([o,a])},n)}function $f(t,e,n){return Yf(t,function(n){var r=+e,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([o,a])},n)}Uf.prototype={constructor:Uf,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Xf=hc(30*sc);function Kf(t,e){return+e?function(t,e){function n(r,i,o,a,s,l,c,u,h,f,d,p,g,_){var y=c-r,m=u-i,b=y*y+m*m;if(b>4*e&&g--){var v=a+f,x=s+d,w=l+p,E=bc(v*v+x*x+w*w),A=wc(w/=E),T=lc(lc(w)-1)<tc||lc(o-h)<tc?(o+h)/2:uc(x,v),S=t(T,A),C=S[0],k=S[1],M=C-r,R=k-i,O=m*M-y*R;(O*O/b>e||lc((y*M+m*R)/b-.5)>.3||a*f+s*d+l*p<Xf)&&(n(r,i,o,a,s,l,C,k,T,v/=E,x/=E,w,g,_),_.point(C,k),n(C,k,T,v,x,w,c,u,h,f,d,p,g,_))}}return function(e){var r,i,o,a,s,l,c,u,h,f,d,p,g={point:_,lineStart:y,lineEnd:b,polygonStart:function(){e.polygonStart(),g.lineStart=v},polygonEnd:function(){e.polygonEnd(),g.lineStart=y}};function _(n,r){n=t(n,r),e.point(n[0],n[1])}function y(){u=NaN,g.point=m,e.lineStart()}function m(r,i){var o=eu([r,i]),a=t(r,i);n(u,h,c,f,d,p,u=a[0],h=a[1],c=r,f=o[0],d=o[1],p=o[2],16,e),e.point(u,h)}function b(){g.point=_,e.lineEnd()}function v(){y(),g.point=x,g.lineEnd=w}function x(t,e){m(r=t,e),i=u,o=h,a=f,s=d,l=p,g.point=m}function w(){n(u,h,c,f,d,p,i,o,r,a,s,l,16,e),g.lineEnd=b,b()}return g}}(t,e):function(t){return jf({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)}var Zf=jf({point:function(t,e){this.stream.point(t*sc,e*sc)}});function Jf(t,e,n,r,i,o){if(!o)return function(t,e,n,r,i){function o(o,a){return[e+t*(o*=r),n-t*(a*=i)]}return o.invert=function(o,a){return[(o-e)/t*r,(n-a)/t*i]},o}(t,e,n,r,i);var a=hc(o),s=yc(o),l=a*t,c=s*t,u=a/t,h=s/t,f=(s*n-a*e)/t,d=(s*e+a*n)/t;function p(t,o){return[l*(t*=r)-c*(o*=i)+e,n-c*t-l*o]}return p.invert=function(t,e){return[r*(u*t-h*e+f),i*(d-h*t-u*e)]},p}function Qf(t){return td(function(){return t})()}function td(t){var e,n,r,i,o,a,s,l,c,u,h=150,f=480,d=250,p=0,g=0,_=0,y=0,m=0,b=0,v=1,x=1,w=null,E=hh,A=null,T=Uh,S=.5;function C(t){return l(t[0]*sc,t[1]*sc)}function k(t){return(t=l.invert(t[0],t[1]))&&[t[0]*ac,t[1]*ac]}function M(){var t=Jf(h,0,0,v,x,b).apply(null,e(p,g)),r=Jf(h,f-t[0],d-t[1],v,x,b);return n=$u(_,y,m),s=qu(e,r),l=qu(n,s),a=Kf(s,S),R()}function R(){return c=u=null,C}return C.stream=function(t){return c&&u===t?c:c=Zf(function(t){return jf({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}(n)(E(a(T(u=t)))))},C.preclip=function(t){return arguments.length?(E=t,w=void 0,R()):E},C.postclip=function(t){return arguments.length?(T=t,A=r=i=o=null,R()):T},C.clipAngle=function(t){return arguments.length?(E=+t?fh(w=t*sc):(w=null,hh),R()):w*ac},C.clipExtent=function(t){return arguments.length?(T=null==t?(A=r=i=o=null,Uh):bh(A=+t[0][0],r=+t[0][1],i=+t[1][0],o=+t[1][1]),R()):null==A?null:[[A,r],[i,o]]},C.scale=function(t){return arguments.length?(h=+t,M()):h},C.translate=function(t){return arguments.length?(f=+t[0],d=+t[1],M()):[f,d]},C.center=function(t){return arguments.length?(p=t[0]%360*sc,g=t[1]%360*sc,M()):[p*ac,g*ac]},C.rotate=function(t){return arguments.length?(_=t[0]%360*sc,y=t[1]%360*sc,m=t.length>2?t[2]%360*sc:0,M()):[_*ac,y*ac,m*ac]},C.angle=function(t){return arguments.length?(b=t%360*sc,M()):b*ac},C.reflectX=function(t){return arguments.length?(v=t?-1:1,M()):v<0},C.reflectY=function(t){return arguments.length?(x=t?-1:1,M()):x<0},C.precision=function(t){return arguments.length?(a=Kf(s,S=t*t),R()):bc(S)},C.fitExtent=function(t,e){return Hf(C,t,e)},C.fitSize=function(t,e){return qf(C,t,e)},C.fitWidth=function(t,e){return Wf(C,t,e)},C.fitHeight=function(t,e){return $f(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&k,M()}}function ed(t){var e=0,n=nc/3,r=td(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*sc,n=t[1]*sc):[e*ac,n*ac]},i}function nd(t,e){var n=yc(t),r=(n+yc(e))/2;if(lc(r)<tc)return function(t){var e=hc(t);function n(t,n){return[t*e,yc(n)/e]}return n.invert=function(t,n){return[t/e,wc(n*e)]},n}(t);var i=1+n*(2*r-n),o=bc(i)/r;function a(t,e){var n=bc(i-2*r*yc(e))/r;return[n*yc(t*=r),o-n*hc(t)]}return a.invert=function(t,e){var n=o-e,a=uc(t,lc(n))*mc(n);return n*r<0&&(a-=nc*mc(t)*mc(n)),[a/r,wc((i-(t*t+n*n)*r*r)/(2*r))]},a}function rd(){return ed(nd).scale(155.424).center([0,33.6442])}function id(){return rd().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function od(t){return function(e,n){var r=hc(e),i=hc(n),o=t(r*i);return o===1/0?[2,0]:[o*i*yc(e),o*yc(n)]}}function ad(t){return function(e,n){var r=bc(e*e+n*n),i=t(r),o=yc(i),a=hc(i);return[uc(e*o,r*a),wc(r&&n*o/r)]}}var sd=od(function(t){return bc(2/(1+t))});sd.invert=ad(function(t){return 2*wc(t/2)});var ld=od(function(t){return(t=xc(t))&&t/yc(t)});function cd(t,e){return[t,gc(vc((rc+e)/2))]}function ud(t){var e,n,r,i=Qf(t),o=i.center,a=i.scale,s=i.translate,l=i.clipExtent,c=null;function u(){var o=nc*a(),s=i(Ju(i.rotate()).invert([0,0]));return l(null==c?[[s[0]-o,s[1]-o],[s[0]+o,s[1]+o]]:t===cd?[[Math.max(s[0]-o,c),e],[Math.min(s[0]+o,n),r]]:[[c,Math.max(s[1]-o,e)],[n,Math.min(s[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),u()):a()},i.translate=function(t){return arguments.length?(s(t),u()):s()},i.center=function(t){return arguments.length?(o(t),u()):o()},i.clipExtent=function(t){return arguments.length?(null==t?c=e=n=r=null:(c=+t[0][0],e=+t[0][1],n=+t[1][0],r=+t[1][1]),u()):null==c?null:[[c,e],[n,r]]},u()}function hd(t){return vc((rc+t)/2)}function fd(t,e){var n=hc(t),r=t===e?yc(t):gc(n/hc(e))/gc(hd(e)/hd(t)),i=n*_c(hd(t),r)/r;if(!r)return cd;function o(t,e){i>0?e<-rc+tc&&(e=-rc+tc):e>rc-tc&&(e=rc-tc);var n=i/_c(hd(e),r);return[n*yc(r*t),i-n*hc(r*t)]}return o.invert=function(t,e){var n=i-e,o=mc(r)*bc(t*t+n*n),a=uc(t,lc(n))*mc(n);return n*r<0&&(a-=nc*mc(t)*mc(n)),[a/r,2*cc(_c(i/o,1/r))-rc]},o}function dd(t,e){return[t,e]}function pd(t,e){var n=hc(t),r=t===e?yc(t):(n-hc(e))/(e-t),i=n/r+t;if(lc(r)<tc)return dd;function o(t,e){var n=i-e,o=r*t;return[n*yc(o),i-n*hc(o)]}return o.invert=function(t,e){var n=i-e,o=uc(t,lc(n))*mc(n);return n*r<0&&(o-=nc*mc(t)*mc(n)),[o/r,i-mc(r)*bc(t*t+n*n)]},o}ld.invert=ad(function(t){return t}),cd.invert=function(t,e){return[t,2*cc(dc(e))-rc]},dd.invert=dd;var gd=1.340264,_d=-.081106,yd=893e-6,md=.003796,bd=bc(3)/2;function vd(t,e){var n=wc(bd*yc(e)),r=n*n,i=r*r*r;return[t*hc(n)/(bd*(gd+3*_d*r+i*(7*yd+9*md*r))),n*(gd+_d*r+i*(yd+md*r))]}function xd(t,e){var n=hc(e),r=hc(t)*n;return[n*yc(t)/r,yc(e)/r]}function wd(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),e*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}function Ed(t,e){return[hc(e)*yc(t),yc(e)]}function Ad(t,e){var n=hc(e),r=1+hc(t)*n;return[n*yc(t)/r,yc(e)/r]}function Td(t,e){return[gc(vc((rc+e)/2)),-t]}function Sd(t,e){return t.parent===e.parent?1:2}function Cd(t,e){return t+e.x}function kd(t,e){return Math.max(t,e.y)}function Md(){var t=Sd,e=1,n=1,r=!1;function i(i){var o,a=0;i.eachAfter(function(e){var n=e.children;n?(e.x=function(t){return t.reduce(Cd,0)/t.length}(n),e.y=function(t){return 1+t.reduce(kd,0)}(n)):(e.x=o?a+=t(e,o):0,e.y=0,o=e)});var s=function(t){for(var e;e=t.children;)t=e[0];return t}(i),l=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(i),c=s.x-t(s,l)/2,u=l.x+t(l,s)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*e,t.y=(i.y-t.y)*n}:function(t){t.x=(t.x-c)/(u-c)*e,t.y=(1-(i.y?t.y/i.y:1))*n})}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}function Rd(t){var e=0,n=t.children,r=n&&n.length;if(r)for(;--r>=0;)e+=n[r].value;else e=1;t.value=e}function Od(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=Id)):void 0===e&&(e=Nd);for(var n,r,i,o,a,s=new Vd(t),l=[s];n=l.pop();)if((i=e(n.data))&&(a=(i=Array.from(i)).length))for(n.children=i,o=a-1;o>=0;--o)l.push(r=i[o]=new Vd(i[o])),r.parent=n,r.depth=n.depth+1;return s.eachBefore(Pd)}function Nd(t){return t.children}function Id(t){return Array.isArray(t)?t[1]:null}function Ld(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function Pd(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function Vd(t){this.data=t,this.depth=this.height=0,this.parent=null}function Dd(t){return null==t?null:Bd(t)}function Bd(t){if("function"!=typeof t)throw new Error;return t}function zd(){return 0}function Fd(t){return function(){return t}}vd.invert=function(t,e){for(var n,r=e,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=n=(r*(gd+_d*i+o*(yd+md*i))-e)/(gd+3*_d*i+o*(7*yd+9*md*i)))*r)*i*i,!(lc(n)<ec));++a);return[bd*t*(gd+3*_d*i+o*(7*yd+9*md*i))/hc(r),wc(yc(r)/bd)]},xd.invert=ad(cc),wd.invert=function(t,e){var n,r=e,i=25;do{var o=r*r,a=o*o;r-=n=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-e)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(lc(n)>tc&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},Ed.invert=ad(wc),Ad.invert=ad(function(t){return 2*cc(t)}),Td.invert=function(t,e){return[-e,2*cc(dc(t))-rc]},Vd.prototype=Od.prototype={constructor:Vd,count:function(){return this.eachAfter(Rd)},each:function(t,e){let n=-1;for(const r of this)t.call(e,r,++n,this);return this},eachAfter:function(t,e){for(var n,r,i,o=this,a=[o],s=[],l=-1;o=a.pop();)if(s.push(o),n=o.children)for(r=0,i=n.length;r<i;++r)a.push(n[r]);for(;o=s.pop();)t.call(e,o,++l,this);return this},eachBefore:function(t,e){for(var n,r,i=this,o=[i],a=-1;i=o.pop();)if(t.call(e,i,++a,this),n=i.children)for(r=n.length-1;r>=0;--r)o.push(n[r]);return this},find:function(t,e){let n=-1;for(const r of this)if(t.call(e,r,++n,this))return r},sum:function(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n})},sort:function(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;t=n.pop(),e=r.pop();for(;t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t},links:function(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e},copy:function(){return Od(this).eachBefore(Ld)},[Symbol.iterator]:function*(){var t,e,n,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,e=i.children)for(n=0,r=e.length;n<r;++n)o.push(e[n])}while(o.length)}};const Gd=4294967296;function jd(){let t=1;return()=>(t=(1664525*t+1013904223)%Gd)/Gd}function Ud(t,e){for(var n,r,i=0,o=(t=function(t,e){let n,r,i=t.length;for(;i;)r=e()*i--|0,n=t[i],t[i]=t[r],t[r]=n;return t}(Array.from(t),e)).length,a=[];i<o;)n=t[i],r&&qd(r,n)?++i:(r=$d(a=Yd(a,n)),i=0);return r}function Yd(t,e){var n,r;if(Wd(e,t))return[e];for(n=0;n<t.length;++n)if(Hd(e,t[n])&&Wd(Xd(t[n],e),t))return[t[n],e];for(n=0;n<t.length-1;++n)for(r=n+1;r<t.length;++r)if(Hd(Xd(t[n],t[r]),e)&&Hd(Xd(t[n],e),t[r])&&Hd(Xd(t[r],e),t[n])&&Wd(Kd(t[n],t[r],e),t))return[t[n],t[r],e];throw new Error}function Hd(t,e){var n=t.r-e.r,r=e.x-t.x,i=e.y-t.y;return n<0||n*n<r*r+i*i}function qd(t,e){var n=t.r-e.r+1e-9*Math.max(t.r,e.r,1),r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function Wd(t,e){for(var n=0;n<e.length;++n)if(!qd(t,e[n]))return!1;return!0}function $d(t){switch(t.length){case 1:return function(t){return{x:t.x,y:t.y,r:t.r}}(t[0]);case 2:return Xd(t[0],t[1]);case 3:return Kd(t[0],t[1],t[2])}}function Xd(t,e){var n=t.x,r=t.y,i=t.r,o=e.x,a=e.y,s=e.r,l=o-n,c=a-r,u=s-i,h=Math.sqrt(l*l+c*c);return{x:(n+o+l/h*u)/2,y:(r+a+c/h*u)/2,r:(h+i+s)/2}}function Kd(t,e,n){var r=t.x,i=t.y,o=t.r,a=e.x,s=e.y,l=e.r,c=n.x,u=n.y,h=n.r,f=r-a,d=r-c,p=i-s,g=i-u,_=l-o,y=h-o,m=r*r+i*i-o*o,b=m-a*a-s*s+l*l,v=m-c*c-u*u+h*h,x=d*p-f*g,w=(p*v-g*b)/(2*x)-r,E=(g*_-p*y)/x,A=(d*b-f*v)/(2*x)-i,T=(f*y-d*_)/x,S=E*E+T*T-1,C=2*(o+w*E+A*T),k=w*w+A*A-o*o,M=-(Math.abs(S)>1e-6?(C+Math.sqrt(C*C-4*S*k))/(2*S):k/C);return{x:r+w+E*M,y:i+A+T*M,r:M}}function Zd(t,e,n){var r,i,o,a,s=t.x-e.x,l=t.y-e.y,c=s*s+l*l;c?(i=e.r+n.r,i*=i,a=t.r+n.r,i>(a*=a)?(r=(c+a-i)/(2*c),o=Math.sqrt(Math.max(0,a/c-r*r)),n.x=t.x-r*s-o*l,n.y=t.y-r*l+o*s):(r=(c+i-a)/(2*c),o=Math.sqrt(Math.max(0,i/c-r*r)),n.x=e.x+r*s-o*l,n.y=e.y+r*l+o*s)):(n.x=e.x+n.r,n.y=e.y)}function Jd(t,e){var n=t.r+e.r-1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function Qd(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,o=(e.y*n.r+n.y*e.r)/r;return i*i+o*o}function tp(t){this._=t,this.next=null,this.previous=null}function ep(t,e){if(!(o=(t=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(t)).length))return 0;var n,r,i,o,a,s,l,c,u,h,f;if((n=t[0]).x=0,n.y=0,!(o>1))return n.r;if(r=t[1],n.x=-r.r,r.x=n.r,r.y=0,!(o>2))return n.r+r.r;Zd(r,n,i=t[2]),n=new tp(n),r=new tp(r),i=new tp(i),n.next=i.previous=r,r.next=n.previous=i,i.next=r.previous=n;t:for(l=3;l<o;++l){Zd(n._,r._,i=t[l]),i=new tp(i),c=r.next,u=n.previous,h=r._.r,f=n._.r;do{if(h<=f){if(Jd(c._,i._)){r=c,n.next=r,r.previous=n,--l;continue t}h+=c._.r,c=c.next}else{if(Jd(u._,i._)){(n=u).next=r,r.previous=n,--l;continue t}f+=u._.r,u=u.previous}}while(c!==u.next);for(i.previous=n,i.next=r,n.next=r.previous=r=i,a=Qd(n);(i=i.next)!==r;)(s=Qd(i))<a&&(n=i,a=s);r=n.next}for(n=[r._],i=r;(i=i.next)!==r;)n.push(i._);for(i=Ud(n,e),l=0;l<o;++l)(n=t[l]).x-=i.x,n.y-=i.y;return i.r}function np(t){return Math.sqrt(t.value)}function rp(){var t=null,e=1,n=1,r=zd;function i(i){const o=jd();return i.x=e/2,i.y=n/2,t?i.eachBefore(ip(t)).eachAfter(op(r,.5,o)).eachBefore(ap(1)):i.eachBefore(ip(np)).eachAfter(op(zd,1,o)).eachAfter(op(r,i.r/Math.min(e,n),o)).eachBefore(ap(Math.min(e,n)/(2*i.r))),i}return i.radius=function(e){return arguments.length?(t=Dd(e),i):t},i.size=function(t){return arguments.length?(e=+t[0],n=+t[1],i):[e,n]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:Fd(+t),i):r},i}function ip(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function op(t,e,n){return function(r){if(i=r.children){var i,o,a,s=i.length,l=t(r)*e||0;if(l)for(o=0;o<s;++o)i[o].r+=l;if(a=ep(i,n),l)for(o=0;o<s;++o)i[o].r-=l;r.r=a+l}}}function ap(t){return function(e){var n=e.parent;e.r*=t,n&&(e.x=n.x+t*e.x,e.y=n.y+t*e.y)}}function sp(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function lp(t,e,n,r,i){for(var o,a=t.children,s=-1,l=a.length,c=t.value&&(r-e)/t.value;++s<l;)(o=a[s]).y0=n,o.y1=i,o.x0=e,o.x1=e+=o.value*c}var cp={depth:-1},up={},hp={};function fp(t){return t.id}function dp(t){return t.parentId}function pp(t){let e=t.length;if(e<2)return"";for(;--e>1&&!gp(t,e););return t.slice(0,e)}function gp(t,e){if("/"===t[e]){let n=0;for(;e>0&&"\\"===t[--e];)++n;if(!(1&n))return!0}return!1}function _p(t,e){return t.parent===e.parent?1:2}function yp(t){var e=t.children;return e?e[0]:t.t}function mp(t){var e=t.children;return e?e[e.length-1]:t.t}function bp(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function vp(t,e,n){return t.a.parent===e.parent?t.a:n}function xp(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function wp(){var t=_p,e=1,n=1,r=null;function i(i){var l=function(t){for(var e,n,r,i,o,a=new xp(t,0),s=[a];e=s.pop();)if(r=e._.children)for(e.children=new Array(o=r.length),i=o-1;i>=0;--i)s.push(n=e.children[i]=new xp(r[i],i)),n.parent=e;return(a.parent=new xp(null,0)).children=[a],a}(i);if(l.eachAfter(o),l.parent.m=-l.z,l.eachBefore(a),r)i.eachBefore(s);else{var c=i,u=i,h=i;i.eachBefore(function(t){t.x<c.x&&(c=t),t.x>u.x&&(u=t),t.depth>h.depth&&(h=t)});var f=c===u?1:t(c,u)/2,d=f-c.x,p=e/(u.x+f+d),g=n/(h.depth||1);i.eachBefore(function(t){t.x=(t.x+d)*p,t.y=t.depth*g})}return i}function o(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(t){for(var e,n=0,r=0,i=t.children,o=i.length;--o>=0;)(e=i[o]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(e);var o=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-o):e.z=o}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,o=e,a=e,s=n,l=o.parent.children[0],c=o.m,u=a.m,h=s.m,f=l.m;s=mp(s),o=yp(o),s&&o;)l=yp(l),(a=mp(a)).a=e,(i=s.z+h-o.z-c+t(s._,o._))>0&&(bp(vp(s,e,r),e,i),c+=i,u+=i),h+=s.m,c+=o.m,f+=l.m,u+=a.m;s&&!mp(a)&&(a.t=s,a.m+=h-u),o&&!yp(l)&&(l.t=o,l.m+=c-f,r=e)}return r}(e,i,e.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}function Ep(t,e,n,r,i){for(var o,a=t.children,s=-1,l=a.length,c=t.value&&(i-n)/t.value;++s<l;)(o=a[s]).x0=e,o.x1=r,o.y0=n,o.y1=n+=o.value*c}xp.prototype=Object.create(Vd.prototype);var Ap=(1+Math.sqrt(5))/2;function Tp(t,e,n,r,i,o){for(var a,s,l,c,u,h,f,d,p,g,_,y=[],m=e.children,b=0,v=0,x=m.length,w=e.value;b<x;){l=i-n,c=o-r;do{u=m[v++].value}while(!u&&v<x);for(h=f=u,_=u*u*(g=Math.max(c/l,l/c)/(w*t)),p=Math.max(f/_,_/h);v<x;++v){if(u+=s=m[v].value,s<h&&(h=s),s>f&&(f=s),_=u*u*g,(d=Math.max(f/_,_/h))>p){u-=s;break}p=d}y.push(a={value:u,dice:l<c,children:m.slice(b,v)}),a.dice?lp(a,n,r,i,w?r+=c*u/w:o):Ep(a,n,r,w?n+=l*u/w:i,o),w-=u,b=v}return y}var Sp=function t(e){function n(t,n,r,i,o){Tp(e,t,n,r,i,o)}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(Ap);function Cp(){var t=Sp,e=!1,n=1,r=1,i=[0],o=zd,a=zd,s=zd,l=zd,c=zd;function u(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(h),i=[0],e&&t.eachBefore(sp),t}function h(e){var n=i[e.depth],r=e.x0+n,u=e.y0+n,h=e.x1-n,f=e.y1-n;h<r&&(r=h=(r+h)/2),f<u&&(u=f=(u+f)/2),e.x0=r,e.y0=u,e.x1=h,e.y1=f,e.children&&(n=i[e.depth+1]=o(e)/2,r+=c(e)-n,u+=a(e)-n,(h-=s(e)-n)<r&&(r=h=(r+h)/2),(f-=l(e)-n)<u&&(u=f=(u+f)/2),t(e,r,u,h,f))}return u.round=function(t){return arguments.length?(e=!!t,u):e},u.size=function(t){return arguments.length?(n=+t[0],r=+t[1],u):[n,r]},u.tile=function(e){return arguments.length?(t=Bd(e),u):t},u.padding=function(t){return arguments.length?u.paddingInner(t).paddingOuter(t):u.paddingInner()},u.paddingInner=function(t){return arguments.length?(o="function"==typeof t?t:Fd(+t),u):o},u.paddingOuter=function(t){return arguments.length?u.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):u.paddingTop()},u.paddingTop=function(t){return arguments.length?(a="function"==typeof t?t:Fd(+t),u):a},u.paddingRight=function(t){return arguments.length?(s="function"==typeof t?t:Fd(+t),u):s},u.paddingBottom=function(t){return arguments.length?(l="function"==typeof t?t:Fd(+t),u):l},u.paddingLeft=function(t){return arguments.length?(c="function"==typeof t?t:Fd(+t),u):c},u}var kp=function t(e){function n(t,n,r,i,o){if((a=t._squarify)&&a.ratio===e)for(var a,s,l,c,u,h=-1,f=a.length,d=t.value;++h<f;){for(l=(s=a[h]).children,c=s.value=0,u=l.length;c<u;++c)s.value+=l[c].value;s.dice?lp(s,n,r,i,d?r+=(o-r)*s.value/d:o):Ep(s,n,r,d?n+=(i-n)*s.value/d:i,o),d-=s.value}else t._squarify=a=Tp(e,t,n,r,i,o),a.ratio=e}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(Ap);function Mp(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function Rp(t,e){return t[0]-e[0]||t[1]-e[1]}function Op(t){const e=t.length,n=[0,1];let r,i=2;for(r=2;r<e;++r){for(;i>1&&Mp(t[n[i-2]],t[n[i-1]],t[r])<=0;)--i;n[i++]=r}return n.slice(0,i)}var Np=Math.random,Ip=function t(e){function n(t,n){return t=null==t?0:+t,n=null==n?1:+n,1===arguments.length?(n=t,t=0):n-=t,function(){return e()*n+t}}return n.source=t,n}(Np),Lp=function t(e){function n(t,n){return arguments.length<2&&(n=t,t=0),t=Math.floor(t),n=Math.floor(n)-t,function(){return Math.floor(e()*n+t)}}return n.source=t,n}(Np),Pp=function t(e){function n(t,n){var r,i;return t=null==t?0:+t,n=null==n?1:+n,function(){var o;if(null!=r)o=r,r=null;else do{r=2*e()-1,o=2*e()-1,i=r*r+o*o}while(!i||i>1);return t+n*o*Math.sqrt(-2*Math.log(i)/i)}}return n.source=t,n}(Np),Vp=function t(e){var n=Pp.source(e);function r(){var t=n.apply(this,arguments);return function(){return Math.exp(t())}}return r.source=t,r}(Np),Dp=function t(e){function n(t){return(t=+t)<=0?()=>0:function(){for(var n=0,r=t;r>1;--r)n+=e();return n+r*e()}}return n.source=t,n}(Np),Bp=function t(e){var n=Dp.source(e);function r(t){if(0===(t=+t))return e;var r=n(t);return function(){return r()/t}}return r.source=t,r}(Np),zp=function t(e){function n(t){return function(){return-Math.log1p(-e())/t}}return n.source=t,n}(Np),Fp=function t(e){function n(t){if((t=+t)<0)throw new RangeError("invalid alpha");return t=1/-t,function(){return Math.pow(1-e(),t)}}return n.source=t,n}(Np),Gp=function t(e){function n(t){if((t=+t)<0||t>1)throw new RangeError("invalid p");return function(){return Math.floor(e()+t)}}return n.source=t,n}(Np),jp=function t(e){function n(t){if((t=+t)<0||t>1)throw new RangeError("invalid p");return 0===t?()=>1/0:1===t?()=>1:(t=Math.log1p(-t),function(){return 1+Math.floor(Math.log1p(-e())/t)})}return n.source=t,n}(Np),Up=function t(e){var n=Pp.source(e)();function r(t,r){if((t=+t)<0)throw new RangeError("invalid k");if(0===t)return()=>0;if(r=null==r?1:+r,1===t)return()=>-Math.log1p(-e())*r;var i=(t<1?t+1:t)-1/3,o=1/(3*Math.sqrt(i)),a=t<1?()=>Math.pow(e(),1/t):()=>1;return function(){do{do{var t=n(),s=1+o*t}while(s<=0);s*=s*s;var l=1-e()}while(l>=1-.0331*t*t*t*t&&Math.log(l)>=.5*t*t+i*(1-s+Math.log(s)));return i*s*a()*r}}return r.source=t,r}(Np),Yp=function t(e){var n=Up.source(e);function r(t,e){var r=n(t),i=n(e);return function(){var t=r();return 0===t?0:t/(t+i())}}return r.source=t,r}(Np),Hp=function t(e){var n=jp.source(e),r=Yp.source(e);function i(t,e){return t=+t,(e=+e)>=1?()=>t:e<=0?()=>0:function(){for(var i=0,o=t,a=e;o*a>16&&o*(1-a)>16;){var s=Math.floor((o+1)*a),l=r(s,o-s+1)();l<=a?(i+=s,o-=s,a=(a-l)/(1-l)):(o=s-1,a/=l)}for(var c=a<.5,u=n(c?a:1-a),h=u(),f=0;h<=o;++f)h+=u();return i+(c?f:o-f)}}return i.source=t,i}(Np),qp=function t(e){function n(t,n,r){var i;return 0===(t=+t)?i=t=>-Math.log(t):(t=1/t,i=e=>Math.pow(e,t)),n=null==n?0:+n,r=null==r?1:+r,function(){return n+r*i(-Math.log1p(-e()))}}return n.source=t,n}(Np),Wp=function t(e){function n(t,n){return t=null==t?0:+t,n=null==n?1:+n,function(){return t+n*Math.tan(Math.PI*e())}}return n.source=t,n}(Np),$p=function t(e){function n(t,n){return t=null==t?0:+t,n=null==n?1:+n,function(){var r=e();return t+n*Math.log(r/(1-r))}}return n.source=t,n}(Np),Xp=function t(e){var n=Up.source(e),r=Hp.source(e);function i(t){return function(){for(var i=0,o=t;o>16;){var a=Math.floor(.875*o),s=n(a)();if(s>o)return i+r(a-1,o/s)();i+=a,o-=s}for(var l=-Math.log1p(-e()),c=0;l<=o;++c)l-=Math.log1p(-e());return i+c}}return i.source=t,i}(Np);const Kp=1/4294967296;function Zp(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Jp(t,e){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof e?this.interpolator(e):this.range(e)}return this}const Qp=Symbol("implicit");function tg(){var t=new E,e=[],n=[],r=Qp;function i(i){let o=t.get(i);if(void 0===o){if(r!==Qp)return r;t.set(i,o=e.push(i)-1)}return n[o%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new E;for(const r of n)t.has(r)||t.set(r,e.push(r)-1);return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return tg(e,n).unknown(r)},Zp.apply(i,arguments),i}function eg(){var t,e,n=tg().unknown(void 0),r=n.domain,i=n.range,o=0,a=1,s=!1,l=0,c=0,u=.5;function h(){var n=r().length,h=a<o,f=h?a:o,d=h?o:a;t=(d-f)/Math.max(1,n-l+2*c),s&&(t=Math.floor(t)),f+=(d-f-t*(n-l))*u,e=t*(1-l),s&&(f=Math.round(f),e=Math.round(e));var p=dt(n).map(function(e){return f+t*e});return i(h?p.reverse():p)}return delete n.unknown,n.domain=function(t){return arguments.length?(r(t),h()):r()},n.range=function(t){return arguments.length?([o,a]=t,o=+o,a=+a,h()):[o,a]},n.rangeRound=function(t){return[o,a]=t,o=+o,a=+a,s=!0,h()},n.bandwidth=function(){return e},n.step=function(){return t},n.round=function(t){return arguments.length?(s=!!t,h()):s},n.padding=function(t){return arguments.length?(l=Math.min(1,c=+t),h()):l},n.paddingInner=function(t){return arguments.length?(l=Math.min(1,t),h()):l},n.paddingOuter=function(t){return arguments.length?(c=+t,h()):c},n.align=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),h()):u},n.copy=function(){return eg(r(),[o,a]).round(s).paddingInner(l).paddingOuter(c).align(u)},Zp.apply(h(),arguments)}function ng(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return ng(e())},t}function rg(){return ng(eg.apply(null,arguments).paddingInner(1))}function ig(t){return+t}var og=[0,1];function ag(t){return t}function sg(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function lg(t,e,n){var r=t[0],i=t[1],o=e[0],a=e[1];return i<r?(r=sg(i,r),o=n(a,o)):(r=sg(r,i),o=n(o,a)),function(t){return o(r(t))}}function cg(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),s=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<r;)i[s]=sg(t[s],t[s+1]),o[s]=n(e[s],e[s+1]);return function(e){var n=a(t,e,1,r)-1;return o[n](i[n](e))}}function ug(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function hg(){var t,e,n,r,i,o,a=og,s=og,l=Hr,c=ag;function u(){var t=Math.min(a.length,s.length);return c!==ag&&(c=function(t,e){var n;return t>e&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(a[0],a[t-1])),r=t>2?cg:lg,i=o=null,h}function h(e){return null==e||isNaN(e=+e)?n:(i||(i=r(a.map(t),s,l)))(t(c(e)))}return h.invert=function(n){return c(e((o||(o=r(s,a.map(t),Fr)))(n)))},h.domain=function(t){return arguments.length?(a=Array.from(t,ig),u()):a.slice()},h.range=function(t){return arguments.length?(s=Array.from(t),u()):s.slice()},h.rangeRound=function(t){return s=Array.from(t),l=qr,u()},h.clamp=function(t){return arguments.length?(c=!!t||ag,u()):c!==ag},h.interpolate=function(t){return arguments.length?(l=t,u()):l},h.unknown=function(t){return arguments.length?(n=t,h):n},function(n,r){return t=n,e=r,u()}}function fg(){return hg()(ag,ag)}function dg(t,e,n,r){var i,o=X(t,e,n);switch((r=zl(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=Jl(o,a))||(r.precision=i),ql(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=Ql(o,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=Zl(o))||(r.precision=i-2*("%"===r.type))}return Hl(r)}function pg(t){var e=t.domain;return t.ticks=function(t){var n=e();return W(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return dg(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i,o=e(),a=0,s=o.length-1,l=o[a],c=o[s],u=10;for(c<l&&(i=l,l=c,c=i,i=a,a=s,s=i);u-- >0;){if((i=$(l,c,n))===r)return o[a]=l,o[s]=c,e(o);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i}r=i}return t},t}function gg(){var t=fg();return t.copy=function(){return ug(t,gg())},Zp.apply(t,arguments),pg(t)}function _g(t,e){var n,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a<o&&(n=r,r=i,i=n,n=o,o=a,a=n),t[r]=e.floor(o),t[i]=e.ceil(a),t}function yg(t){return Math.log(t)}function mg(t){return Math.exp(t)}function bg(t){return-Math.log(-t)}function vg(t){return-Math.exp(-t)}function xg(t){return isFinite(t)?+("1e"+t):t<0?0:t}function wg(t){return(e,n)=>-t(-e,n)}function Eg(t){const e=t(yg,mg),n=e.domain;let r,i,o=10;function a(){return r=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}(o),i=function(t){return 10===t?xg:t===Math.E?Math.exp:e=>Math.pow(t,e)}(o),n()[0]<0?(r=wg(r),i=wg(i),t(bg,vg)):t(yg,mg),e}return e.base=function(t){return arguments.length?(o=+t,a()):o},e.domain=function(t){return arguments.length?(n(t),a()):n()},e.ticks=t=>{const e=n();let a=e[0],s=e[e.length-1];const l=s<a;l&&([a,s]=[s,a]);let c,u,h=r(a),f=r(s);const d=null==t?10:+t;let p=[];if(!(o%1)&&f-h<d){if(h=Math.floor(h),f=Math.ceil(f),a>0){for(;h<=f;++h)for(c=1;c<o;++c)if(u=h<0?c/i(-h):c*i(h),!(u<a)){if(u>s)break;p.push(u)}}else for(;h<=f;++h)for(c=o-1;c>=1;--c)if(u=h>0?c/i(-h):c*i(h),!(u<a)){if(u>s)break;p.push(u)}2*p.length<d&&(p=W(a,s,d))}else p=W(h,f,Math.min(f-h,d)).map(i);return l?p.reverse():p},e.tickFormat=(t,n)=>{if(null==t&&(t=10),null==n&&(n=10===o?"s":","),"function"!=typeof n&&(o%1||null!=(n=zl(n)).precision||(n.trim=!0),n=Hl(n)),t===1/0)return n;const a=Math.max(1,o*t/e.ticks().length);return t=>{let e=t/i(Math.round(r(t)));return e*o<o-.5&&(e*=o),e<=a?n(t):""}},e.nice=()=>n(_g(n(),{floor:t=>i(Math.floor(r(t))),ceil:t=>i(Math.ceil(r(t)))})),e}function Ag(){const t=Eg(hg()).domain([1,10]);return t.copy=()=>ug(t,Ag()).base(t.base()),Zp.apply(t,arguments),t}function Tg(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function Sg(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function Cg(t){var e=1,n=t(Tg(e),Sg(e));return n.constant=function(n){return arguments.length?t(Tg(e=+n),Sg(e)):e},pg(n)}function kg(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Mg(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Rg(t){return t<0?-t*t:t*t}function Og(t){var e=t(ag,ag),n=1;return e.exponent=function(e){return arguments.length?1===(n=+e)?t(ag,ag):.5===n?t(Mg,Rg):t(kg(n),kg(1/n)):n},pg(e)}function Ng(){var t=Og(hg());return t.copy=function(){return ug(t,Ng()).exponent(t.exponent())},Zp.apply(t,arguments),t}function Ig(t){return Math.sign(t)*t*t}const Lg=new Date,Pg=new Date;function Vg(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=e=>(t(e=new Date(+e)),e),i.ceil=n=>(t(n=new Date(n-1)),e(n,1),t(n),n),i.round=t=>{const e=i(t),n=i.ceil(t);return t-e<n-t?e:n},i.offset=(t,n)=>(e(t=new Date(+t),null==n?1:Math.floor(n)),t),i.range=(n,r,o)=>{const a=[];if(n=i.ceil(n),o=null==o?1:Math.floor(o),!(n<r&&o>0))return a;let s;do{a.push(s=new Date(+n)),e(n,o),t(n)}while(s<n&&n<r);return a},i.filter=n=>Vg(e=>{if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)},(t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}),n&&(i.count=(e,r)=>(Lg.setTime(+e),Pg.setTime(+r),t(Lg),t(Pg),Math.floor(n(Lg,Pg))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?e=>r(e)%t===0:e=>i.count(0,e)%t===0):i:null)),i}const Dg=Vg(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Dg.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?Vg(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Dg:null);const Bg=Dg.range,zg=1e3,Fg=6e4,Gg=36e5,jg=864e5,Ug=6048e5,Yg=2592e6,Hg=31536e6,qg=Vg(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*zg)},(t,e)=>(e-t)/zg,t=>t.getUTCSeconds()),Wg=qg.range,$g=Vg(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*zg)},(t,e)=>{t.setTime(+t+e*Fg)},(t,e)=>(e-t)/Fg,t=>t.getMinutes()),Xg=$g.range,Kg=Vg(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Fg)},(t,e)=>(e-t)/Fg,t=>t.getUTCMinutes()),Zg=Kg.range,Jg=Vg(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*zg-t.getMinutes()*Fg)},(t,e)=>{t.setTime(+t+e*Gg)},(t,e)=>(e-t)/Gg,t=>t.getHours()),Qg=Jg.range,t_=Vg(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Gg)},(t,e)=>(e-t)/Gg,t=>t.getUTCHours()),e_=t_.range,n_=Vg(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Fg)/jg,t=>t.getDate()-1),r_=n_.range,i_=Vg(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/jg,t=>t.getUTCDate()-1),o_=i_.range,a_=Vg(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/jg,t=>Math.floor(t/jg)),s_=a_.range;function l_(t){return Vg(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+7*e)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Fg)/Ug)}const c_=l_(0),u_=l_(1),h_=l_(2),f_=l_(3),d_=l_(4),p_=l_(5),g_=l_(6),__=c_.range,y_=u_.range,m_=h_.range,b_=f_.range,v_=d_.range,x_=p_.range,w_=g_.range;function E_(t){return Vg(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)},(t,e)=>(e-t)/Ug)}const A_=E_(0),T_=E_(1),S_=E_(2),C_=E_(3),k_=E_(4),M_=E_(5),R_=E_(6),O_=A_.range,N_=T_.range,I_=S_.range,L_=C_.range,P_=k_.range,V_=M_.range,D_=R_.range,B_=Vg(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),t=>t.getMonth()),z_=B_.range,F_=Vg(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),t=>t.getUTCMonth()),G_=F_.range,j_=Vg(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());j_.every=t=>isFinite(t=Math.floor(t))&&t>0?Vg(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)}):null;const U_=j_.range,Y_=Vg(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Y_.every=t=>isFinite(t=Math.floor(t))&&t>0?Vg(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)}):null;const H_=Y_.range;function q_(t,e,r,i,o,a){const s=[[qg,1,zg],[qg,5,5e3],[qg,15,15e3],[qg,30,3e4],[a,1,Fg],[a,5,3e5],[a,15,9e5],[a,30,18e5],[o,1,Gg],[o,3,108e5],[o,6,216e5],[o,12,432e5],[i,1,jg],[i,2,1728e5],[r,1,Ug],[e,1,Yg],[e,3,7776e6],[t,1,Hg]];function l(e,r,i){const o=Math.abs(r-e)/i,a=n(([,,t])=>t).right(s,o);if(a===s.length)return t.every(X(e/Hg,r/Hg,i));if(0===a)return Dg.every(Math.max(X(e,r,i),1));const[l,c]=s[o/s[a-1][2]<s[a][2]/o?a-1:a];return l.every(c)}return[function(t,e,n){const r=e<t;r&&([t,e]=[e,t]);const i=n&&"function"==typeof n.range?n:l(t,e,n),o=i?i.range(t,+e+1):[];return r?o.reverse():o},l]}const[W_,$_]=q_(Y_,F_,A_,a_,t_,Kg),[X_,K_]=q_(j_,B_,c_,n_,Jg,$g);function Z_(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function J_(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Q_(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function ty(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,s=t.months,l=t.shortMonths,c=fy(i),u=dy(i),h=fy(o),f=dy(o),d=fy(a),p=dy(a),g=fy(s),_=dy(s),y=fy(l),m=dy(l),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:Ly,e:Ly,f:zy,g:Ky,G:Jy,H:Py,I:Vy,j:Dy,L:By,m:Fy,M:Gy,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:xm,s:wm,S:jy,u:Uy,U:Yy,V:qy,w:Wy,W:$y,x:null,X:null,y:Xy,Y:Zy,Z:Qy,"%":vm},v={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:tm,e:tm,f:om,g:_m,G:mm,H:em,I:nm,j:rm,L:im,m:am,M:sm,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:xm,s:wm,S:lm,u:cm,U:um,V:fm,w:dm,W:pm,x:null,X:null,y:gm,Y:ym,Z:bm,"%":vm},x={a:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=h.exec(e.slice(n));return r?(t.w=f.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=y.exec(e.slice(n));return r?(t.m=m.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=g.exec(e.slice(n));return r?(t.m=_.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return A(t,e,n,r)},d:Ay,e:Ay,f:Ry,g:vy,G:by,H:Sy,I:Sy,j:Ty,L:My,m:Ey,M:Cy,p:function(t,e,n){var r=c.exec(e.slice(n));return r?(t.p=u.get(r[0].toLowerCase()),n+r[0].length):-1},q:wy,Q:Ny,s:Iy,S:ky,u:gy,U:_y,V:yy,w:py,W:my,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:vy,Y:by,Z:xy,"%":Oy};function w(t,e){return function(n){var r,i,o,a=[],s=-1,l=0,c=t.length;for(n instanceof Date||(n=new Date(+n));++s<c;)37===t.charCodeAt(s)&&(a.push(t.slice(l,s)),null!=(i=ay[r=t.charAt(++s)])?r=t.charAt(++s):i="e"===r?" ":"0",(o=e[r])&&(r=o(n,i)),a.push(r),l=s+1);return a.push(t.slice(l,s)),a.join("")}}function E(t,e){return function(n){var r,i,o=Q_(1900,void 0,1);if(A(o,t,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(e&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=J_(Q_(o.y,0,1))).getUTCDay(),r=i>4||0===i?T_.ceil(r):T_(r),r=i_.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=Z_(Q_(o.y,0,1))).getDay(),r=i>4||0===i?u_.ceil(r):u_(r),r=n_.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?J_(Q_(o.y,0,1)).getUTCDay():Z_(Q_(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,J_(o)):Z_(o)}}function A(t,e,n,r){for(var i,o,a=0,s=e.length,l=n.length;a<s;){if(r>=l)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=x[i in ay?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return b.x=w(n,b),b.X=w(r,b),b.c=w(e,b),v.x=w(n,v),v.X=w(r,v),v.c=w(e,v),{format:function(t){var e=w(t+="",b);return e.toString=function(){return t},e},parse:function(t){var e=E(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=w(t+="",v);return e.toString=function(){return t},e},utcParse:function(t){var e=E(t+="",!0);return e.toString=function(){return t},e}}}var ey,ny,ry,iy,oy,ay={"-":"",_:" ",0:"0"},sy=/^\s*\d+/,ly=/^%/,cy=/[\\^$*+?|[\]().{}]/g;function uy(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(e)+i:i)}function hy(t){return t.replace(cy,"\\$&")}function fy(t){return new RegExp("^(?:"+t.map(hy).join("|")+")","i")}function dy(t){return new Map(t.map((t,e)=>[t.toLowerCase(),e]))}function py(t,e,n){var r=sy.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function gy(t,e,n){var r=sy.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function _y(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function yy(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function my(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function by(t,e,n){var r=sy.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function vy(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function xy(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function wy(t,e,n){var r=sy.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Ey(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Ay(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Ty(t,e,n){var r=sy.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Sy(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Cy(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function ky(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function My(t,e,n){var r=sy.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Ry(t,e,n){var r=sy.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Oy(t,e,n){var r=ly.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Ny(t,e,n){var r=sy.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Iy(t,e,n){var r=sy.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Ly(t,e){return uy(t.getDate(),e,2)}function Py(t,e){return uy(t.getHours(),e,2)}function Vy(t,e){return uy(t.getHours()%12||12,e,2)}function Dy(t,e){return uy(1+n_.count(j_(t),t),e,3)}function By(t,e){return uy(t.getMilliseconds(),e,3)}function zy(t,e){return By(t,e)+"000"}function Fy(t,e){return uy(t.getMonth()+1,e,2)}function Gy(t,e){return uy(t.getMinutes(),e,2)}function jy(t,e){return uy(t.getSeconds(),e,2)}function Uy(t){var e=t.getDay();return 0===e?7:e}function Yy(t,e){return uy(c_.count(j_(t)-1,t),e,2)}function Hy(t){var e=t.getDay();return e>=4||0===e?d_(t):d_.ceil(t)}function qy(t,e){return t=Hy(t),uy(d_.count(j_(t),t)+(4===j_(t).getDay()),e,2)}function Wy(t){return t.getDay()}function $y(t,e){return uy(u_.count(j_(t)-1,t),e,2)}function Xy(t,e){return uy(t.getFullYear()%100,e,2)}function Ky(t,e){return uy((t=Hy(t)).getFullYear()%100,e,2)}function Zy(t,e){return uy(t.getFullYear()%1e4,e,4)}function Jy(t,e){var n=t.getDay();return uy((t=n>=4||0===n?d_(t):d_.ceil(t)).getFullYear()%1e4,e,4)}function Qy(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+uy(e/60|0,"0",2)+uy(e%60,"0",2)}function tm(t,e){return uy(t.getUTCDate(),e,2)}function em(t,e){return uy(t.getUTCHours(),e,2)}function nm(t,e){return uy(t.getUTCHours()%12||12,e,2)}function rm(t,e){return uy(1+i_.count(Y_(t),t),e,3)}function im(t,e){return uy(t.getUTCMilliseconds(),e,3)}function om(t,e){return im(t,e)+"000"}function am(t,e){return uy(t.getUTCMonth()+1,e,2)}function sm(t,e){return uy(t.getUTCMinutes(),e,2)}function lm(t,e){return uy(t.getUTCSeconds(),e,2)}function cm(t){var e=t.getUTCDay();return 0===e?7:e}function um(t,e){return uy(A_.count(Y_(t)-1,t),e,2)}function hm(t){var e=t.getUTCDay();return e>=4||0===e?k_(t):k_.ceil(t)}function fm(t,e){return t=hm(t),uy(k_.count(Y_(t),t)+(4===Y_(t).getUTCDay()),e,2)}function dm(t){return t.getUTCDay()}function pm(t,e){return uy(T_.count(Y_(t)-1,t),e,2)}function gm(t,e){return uy(t.getUTCFullYear()%100,e,2)}function _m(t,e){return uy((t=hm(t)).getUTCFullYear()%100,e,2)}function ym(t,e){return uy(t.getUTCFullYear()%1e4,e,4)}function mm(t,e){var n=t.getUTCDay();return uy((t=n>=4||0===n?k_(t):k_.ceil(t)).getUTCFullYear()%1e4,e,4)}function bm(){return"+0000"}function vm(){return"%"}function xm(t){return+t}function wm(t){return Math.floor(+t/1e3)}function Em(t){return ey=ty(t),ny=ey.format,ry=ey.parse,iy=ey.utcFormat,oy=ey.utcParse,ey}Em({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var Am="%Y-%m-%dT%H:%M:%S.%LZ";var Tm=Date.prototype.toISOString?function(t){return t.toISOString()}:iy(Am);var Sm=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:oy(Am);function Cm(t){return new Date(t)}function km(t){return t instanceof Date?+t:+new Date(+t)}function Mm(t,e,n,r,i,o,a,s,l,c){var u=fg(),h=u.invert,f=u.domain,d=c(".%L"),p=c(":%S"),g=c("%I:%M"),_=c("%I %p"),y=c("%a %d"),m=c("%b %d"),b=c("%B"),v=c("%Y");function x(t){return(l(t)<t?d:s(t)<t?p:a(t)<t?g:o(t)<t?_:r(t)<t?i(t)<t?y:m:n(t)<t?b:v)(t)}return u.invert=function(t){return new Date(h(t))},u.domain=function(t){return arguments.length?f(Array.from(t,km)):f().map(Cm)},u.ticks=function(e){var n=f();return t(n[0],n[n.length-1],null==e?10:e)},u.tickFormat=function(t,e){return null==e?x:c(e)},u.nice=function(t){var n=f();return t&&"function"==typeof t.range||(t=e(n[0],n[n.length-1],null==t?10:t)),t?f(_g(n,t)):u},u.copy=function(){return ug(u,Mm(t,e,n,r,i,o,a,s,l,c))},u}function Rm(){return Zp.apply(Mm(X_,K_,j_,B_,c_,n_,Jg,$g,qg,ny).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Om(){var t,e,n,r,i,o=0,a=1,s=ag,l=!1;function c(e){return null==e||isNaN(e=+e)?i:s(0===n?.5:(e=(r(e)-t)*n,l?Math.max(0,Math.min(1,e)):e))}function u(t){return function(e){var n,r;return arguments.length?([n,r]=e,s=t(n,r),c):[s(0),s(1)]}}return c.domain=function(i){return arguments.length?([o,a]=i,t=r(o=+o),e=r(a=+a),n=t===e?0:1/(e-t),c):[o,a]},c.clamp=function(t){return arguments.length?(l=!!t,c):l},c.interpolator=function(t){return arguments.length?(s=t,c):s},c.range=u(Hr),c.rangeRound=u(qr),c.unknown=function(t){return arguments.length?(i=t,c):i},function(i){return r=i,t=i(o),e=i(a),n=t===e?0:1/(e-t),c}}function Nm(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Im(){var t=pg(Om()(ag));return t.copy=function(){return Nm(t,Im())},Jp.apply(t,arguments)}function Lm(){var t=Og(Om());return t.copy=function(){return Nm(t,Lm()).exponent(t.exponent())},Jp.apply(t,arguments)}function Pm(){var t,e,n,r,i,o,a,s=0,l=.5,c=1,u=1,h=ag,f=!1;function d(t){return isNaN(t=+t)?a:(t=.5+((t=+o(t))-e)*(u*t<u*e?r:i),h(f?Math.max(0,Math.min(1,t)):t))}function p(t){return function(e){var n,r,i;return arguments.length?([n,r,i]=e,h=hi(t,[n,r,i]),d):[h(0),h(.5),h(1)]}}return d.domain=function(a){return arguments.length?([s,l,c]=a,t=o(s=+s),e=o(l=+l),n=o(c=+c),r=t===e?0:.5/(e-t),i=e===n?0:.5/(n-e),u=e<t?-1:1,d):[s,l,c]},d.clamp=function(t){return arguments.length?(f=!!t,d):f},d.interpolator=function(t){return arguments.length?(h=t,d):h},d.range=p(Hr),d.rangeRound=p(qr),d.unknown=function(t){return arguments.length?(a=t,d):a},function(a){return o=a,t=a(s),e=a(l),n=a(c),r=t===e?0:.5/(e-t),i=e===n?0:.5/(n-e),u=e<t?-1:1,d}}function Vm(){var t=Og(Pm());return t.copy=function(){return Nm(t,Vm()).exponent(t.exponent())},Jp.apply(t,arguments)}function Dm(t){for(var e=t.length/6|0,n=new Array(e),r=0;r<e;)n[r]="#"+t.slice(6*r,6*++r);return n}var Bm=Dm("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),zm=Dm("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),Fm=Dm("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),Gm=Dm("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"),jm=Dm("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),Um=Dm("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),Ym=Dm("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),Hm=Dm("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),qm=Dm("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),Wm=Dm("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"),$m=Dm("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab"),Xm=t=>Lr(t[t.length-1]),Km=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(Dm),Zm=Xm(Km),Jm=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(Dm),Qm=Xm(Jm),tb=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(Dm),eb=Xm(tb),nb=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(Dm),rb=Xm(nb),ib=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(Dm),ob=Xm(ib),ab=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(Dm),sb=Xm(ab),lb=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(Dm),cb=Xm(lb),ub=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(Dm),hb=Xm(ub),fb=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(Dm),db=Xm(fb),pb=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(Dm),gb=Xm(pb),_b=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(Dm),yb=Xm(_b),mb=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(Dm),bb=Xm(mb),vb=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(Dm),xb=Xm(vb),wb=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(Dm),Eb=Xm(wb),Ab=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(Dm),Tb=Xm(Ab),Sb=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(Dm),Cb=Xm(Sb),kb=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(Dm),Mb=Xm(kb),Rb=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(Dm),Ob=Xm(Rb),Nb=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(Dm),Ib=Xm(Nb),Lb=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(Dm),Pb=Xm(Lb),Vb=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(Dm),Db=Xm(Vb),Bb=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(Dm),zb=Xm(Bb),Fb=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(Dm),Gb=Xm(Fb),jb=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(Dm),Ub=Xm(jb),Yb=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(Dm),Hb=Xm(Yb),qb=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(Dm),Wb=Xm(qb),$b=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(Dm),Xb=Xm($b);var Kb=ui(wr(300,.5,0),wr(-240,.5,1)),Zb=ui(wr(-100,.75,.35),wr(80,1.5,.8)),Jb=ui(wr(260,.75,.35),wr(80,1.5,.8)),Qb=wr();var tv=Pn(),ev=Math.PI/3,nv=2*Math.PI/3;function rv(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-14825.05*t)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+707.56*t)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-6838.66*t)))))))+")"}function iv(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}var ov=iv(Dm("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),av=iv(Dm("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),sv=iv(Dm("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),lv=iv(Dm("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function cv(t){return function(){return t}}const uv=Math.abs,hv=Math.atan2,fv=Math.cos,dv=Math.max,pv=Math.min,gv=Math.sin,_v=Math.sqrt,yv=1e-12,mv=Math.PI,bv=mv/2,vv=2*mv;function xv(t){return t>=1?bv:t<=-1?-bv:Math.asin(t)}function wv(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(null==n)e=null;else{const t=Math.floor(n);if(!(t>=0))throw new RangeError(`invalid digits: ${n}`);e=t}return t},()=>new Ta(e)}function Ev(t){return t.innerRadius}function Av(t){return t.outerRadius}function Tv(t){return t.startAngle}function Sv(t){return t.endAngle}function Cv(t){return t&&t.padAngle}function kv(t,e,n,r,i,o,a){var s=t-n,l=e-r,c=(a?o:-o)/_v(s*s+l*l),u=c*l,h=-c*s,f=t+u,d=e+h,p=n+u,g=r+h,_=(f+p)/2,y=(d+g)/2,m=p-f,b=g-d,v=m*m+b*b,x=i-o,w=f*g-p*d,E=(b<0?-1:1)*_v(dv(0,x*x*v-w*w)),A=(w*b-m*E)/v,T=(-w*m-b*E)/v,S=(w*b+m*E)/v,C=(-w*m+b*E)/v,k=A-_,M=T-y,R=S-_,O=C-y;return k*k+M*M>R*R+O*O&&(A=S,T=C),{cx:A,cy:T,x01:-u,y01:-h,x11:A*(i/x-1),y11:T*(i/x-1)}}var Mv=Array.prototype.slice;function Rv(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Ov(t){this._context=t}function Nv(t){return new Ov(t)}function Iv(t){return t[0]}function Lv(t){return t[1]}function Pv(t,e){var n=cv(!0),r=null,i=Nv,o=null,a=wv(s);function s(s){var l,c,u,h=(s=Rv(s)).length,f=!1;for(null==r&&(o=i(u=a())),l=0;l<=h;++l)!(l<h&&n(c=s[l],l,s))===f&&((f=!f)?o.lineStart():o.lineEnd()),f&&o.point(+t(c,l,s),+e(c,l,s));if(u)return o=null,u+""||null}return t="function"==typeof t?t:void 0===t?Iv:cv(t),e="function"==typeof e?e:void 0===e?Lv:cv(e),s.x=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),s):t},s.y=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),s):e},s.defined=function(t){return arguments.length?(n="function"==typeof t?t:cv(!!t),s):n},s.curve=function(t){return arguments.length?(i=t,null!=r&&(o=i(r)),s):i},s.context=function(t){return arguments.length?(null==t?r=o=null:o=i(r=t),s):r},s}function Vv(t,e,n){var r=null,i=cv(!0),o=null,a=Nv,s=null,l=wv(c);function c(c){var u,h,f,d,p,g=(c=Rv(c)).length,_=!1,y=new Array(g),m=new Array(g);for(null==o&&(s=a(p=l())),u=0;u<=g;++u){if(!(u<g&&i(d=c[u],u,c))===_)if(_=!_)h=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=u-1;f>=h;--f)s.point(y[f],m[f]);s.lineEnd(),s.areaEnd()}_&&(y[u]=+t(d,u,c),m[u]=+e(d,u,c),s.point(r?+r(d,u,c):y[u],n?+n(d,u,c):m[u]))}if(p)return s=null,p+""||null}function u(){return Pv().defined(i).curve(a).context(o)}return t="function"==typeof t?t:void 0===t?Iv:cv(+t),e="function"==typeof e?e:cv(void 0===e?0:+e),n="function"==typeof n?n:void 0===n?Lv:cv(+n),c.x=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),r=null,c):t},c.x0=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),c):t},c.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:cv(+t),c):r},c.y=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),n=null,c):e},c.y0=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),c):e},c.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:cv(+t),c):n},c.lineX0=c.lineY0=function(){return u().x(t).y(e)},c.lineY1=function(){return u().x(t).y(n)},c.lineX1=function(){return u().x(r).y(e)},c.defined=function(t){return arguments.length?(i="function"==typeof t?t:cv(!!t),c):i},c.curve=function(t){return arguments.length?(a=t,null!=o&&(s=a(o)),c):a},c.context=function(t){return arguments.length?(null==t?o=s=null:s=a(o=t),c):o},c}function Dv(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}function Bv(t){return t}Ov.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var zv=Gv(Nv);function Fv(t){this._curve=t}function Gv(t){function e(e){return new Fv(t(e))}return e._curve=t,e}function jv(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?e(Gv(t)):e()._curve},t}function Uv(){return jv(Pv().curve(zv))}function Yv(){var t=Vv().curve(zv),e=t.curve,n=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return jv(n())},delete t.lineX0,t.lineEndAngle=function(){return jv(r())},delete t.lineX1,t.lineInnerRadius=function(){return jv(i())},delete t.lineY0,t.lineOuterRadius=function(){return jv(o())},delete t.lineY1,t.curve=function(t){return arguments.length?e(Gv(t)):e()._curve},t}function Hv(t,e){return[(e=+e)*Math.cos(t-=Math.PI/2),e*Math.sin(t)]}Fv.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};class qv{constructor(t,e){this._context=t,this._x=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,e,t,e):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+e)/2,t,this._y0,t,e)}this._x0=t,this._y0=e}}class Wv{constructor(t){this._context=t}lineStart(){this._point=0}lineEnd(){}point(t,e){if(t=+t,e=+e,0===this._point)this._point=1;else{const n=Hv(this._x0,this._y0),r=Hv(this._x0,this._y0=(this._y0+e)/2),i=Hv(t,this._y0),o=Hv(t,e);this._context.moveTo(...n),this._context.bezierCurveTo(...r,...i,...o)}this._x0=t,this._y0=e}}function $v(t){return new qv(t,!0)}function Xv(t){return new qv(t,!1)}function Kv(t){return new Wv(t)}function Zv(t){return t.source}function Jv(t){return t.target}function Qv(t){let e=Zv,n=Jv,r=Iv,i=Lv,o=null,a=null,s=wv(l);function l(){let l;const c=Mv.call(arguments),u=e.apply(this,c),h=n.apply(this,c);if(null==o&&(a=t(l=s())),a.lineStart(),c[0]=u,a.point(+r.apply(this,c),+i.apply(this,c)),c[0]=h,a.point(+r.apply(this,c),+i.apply(this,c)),a.lineEnd(),l)return a=null,l+""||null}return l.source=function(t){return arguments.length?(e=t,l):e},l.target=function(t){return arguments.length?(n=t,l):n},l.x=function(t){return arguments.length?(r="function"==typeof t?t:cv(+t),l):r},l.y=function(t){return arguments.length?(i="function"==typeof t?t:cv(+t),l):i},l.context=function(e){return arguments.length?(null==e?o=a=null:a=t(o=e),l):o},l}function tx(){return Qv($v)}function ex(){return Qv(Xv)}function nx(){const t=Qv(Kv);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t}const rx=_v(3);var ix={draw(t,e){const n=.59436*_v(e+pv(e/28,.75)),r=n/2,i=r*rx;t.moveTo(0,n),t.lineTo(0,-n),t.moveTo(-i,-r),t.lineTo(i,r),t.moveTo(-i,r),t.lineTo(i,-r)}},ox={draw(t,e){const n=_v(e/mv);t.moveTo(n,0),t.arc(0,0,n,0,vv)}},ax={draw(t,e){const n=_v(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}};const sx=_v(1/3),lx=2*sx;var cx={draw(t,e){const n=_v(e/lx),r=n*sx;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},ux={draw(t,e){const n=.62625*_v(e);t.moveTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.lineTo(-n,0),t.closePath()}},hx={draw(t,e){const n=.87559*_v(e-pv(e/7,2));t.moveTo(-n,0),t.lineTo(n,0),t.moveTo(0,n),t.lineTo(0,-n)}},fx={draw(t,e){const n=_v(e),r=-n/2;t.rect(r,r,n,n)}},dx={draw(t,e){const n=.4431*_v(e);t.moveTo(n,n),t.lineTo(n,-n),t.lineTo(-n,-n),t.lineTo(-n,n),t.closePath()}};const px=gv(mv/10)/gv(7*mv/10),gx=gv(vv/10)*px,_x=-fv(vv/10)*px;var yx={draw(t,e){const n=_v(.8908130915292852*e),r=gx*n,i=_x*n;t.moveTo(0,-n),t.lineTo(r,i);for(let e=1;e<5;++e){const o=vv*e/5,a=fv(o),s=gv(o);t.lineTo(s*n,-a*n),t.lineTo(a*r-s*i,s*r+a*i)}t.closePath()}};const mx=_v(3);var bx={draw(t,e){const n=-_v(e/(3*mx));t.moveTo(0,2*n),t.lineTo(-mx*n,-n),t.lineTo(mx*n,-n),t.closePath()}};const vx=_v(3);var xx={draw(t,e){const n=.6824*_v(e),r=n/2,i=n*vx/2;t.moveTo(0,-n),t.lineTo(i,r),t.lineTo(-i,r),t.closePath()}};const wx=-.5,Ex=_v(3)/2,Ax=1/_v(12),Tx=3*(Ax/2+1);var Sx={draw(t,e){const n=_v(e/Tx),r=n/2,i=n*Ax,o=r,a=n*Ax+n,s=-o,l=a;t.moveTo(r,i),t.lineTo(o,a),t.lineTo(s,l),t.lineTo(wx*r-Ex*i,Ex*r+wx*i),t.lineTo(wx*o-Ex*a,Ex*o+wx*a),t.lineTo(wx*s-Ex*l,Ex*s+wx*l),t.lineTo(wx*r+Ex*i,wx*i-Ex*r),t.lineTo(wx*o+Ex*a,wx*a-Ex*o),t.lineTo(wx*s+Ex*l,wx*l-Ex*s),t.closePath()}},Cx={draw(t,e){const n=.6189*_v(e-pv(e/6,1.7));t.moveTo(-n,-n),t.lineTo(n,n),t.moveTo(-n,n),t.lineTo(n,-n)}};const kx=[ox,ax,cx,fx,yx,bx,Sx],Mx=[ox,hx,Cx,xx,ix,dx,ux];function Rx(){}function Ox(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function Nx(t){this._context=t}function Ix(t){return new Nx(t)}function Lx(t){this._context=t}function Px(t){this._context=t}function Vx(t,e){this._basis=new Nx(t),this._beta=e}Nx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Ox(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ox(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Lx.prototype={areaStart:Rx,areaEnd:Rx,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:Ox(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Px.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Ox(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Vx.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r,i=t[0],o=e[0],a=t[n]-i,s=e[n]-o,l=-1;++l<=n;)r=l/n,this._basis.point(this._beta*t[l]+(1-this._beta)*(i+r*a),this._beta*e[l]+(1-this._beta)*(o+r*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var Dx=function t(e){function n(t){return 1===e?new Nx(t):new Vx(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function Bx(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function zx(t,e){this._context=t,this._k=(1-e)/6}zx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Bx(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:Bx(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Fx=function t(e){function n(t){return new zx(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Gx(t,e){this._context=t,this._k=(1-e)/6}Gx.prototype={areaStart:Rx,areaEnd:Rx,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Bx(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var jx=function t(e){function n(t){return new Gx(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Ux(t,e){this._context=t,this._k=(1-e)/6}Ux.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Bx(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Yx=function t(e){function n(t){return new Ux(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Hx(t,e,n){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>yv){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,i=(i*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>yv){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-e*t._l12_2a)/u,a=(a*c+t._y1*t._l23_2a-n*t._l12_2a)/u}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function qx(t,e){this._context=t,this._alpha=e}qx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:Hx(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Wx=function t(e){function n(t){return e?new qx(t,e):new zx(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function $x(t,e){this._context=t,this._alpha=e}$x.prototype={areaStart:Rx,areaEnd:Rx,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Hx(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Xx=function t(e){function n(t){return e?new $x(t,e):new Gx(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Kx(t,e){this._context=t,this._alpha=e}Kx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Hx(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Zx=function t(e){function n(t){return e?new Kx(t,e):new Ux(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Jx(t){this._context=t}function Qx(t){return t<0?-1:1}function tw(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),s=(o*i+a*r)/(r+i);return(Qx(o)+Qx(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function ew(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function nw(t,e,n){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,s=(o-r)/3;t._context.bezierCurveTo(r+s,i+s*e,o-s,a-s*n,o,a)}function rw(t){this._context=t}function iw(t){this._context=new ow(t)}function ow(t){this._context=t}function aw(t){this._context=t}function sw(t){var e,n,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e<r-1;++e)i[e]=1,o[e]=4,a[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,o[r-1]=7,a[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=i[e]/o[e-1],o[e]-=n,a[e]-=n*a[e-1];for(i[r-1]=a[r-1]/o[r-1],e=r-2;e>=0;--e)i[e]=(a[e]-i[e+1])/o[e];for(o[r-1]=(t[r]+i[r-1])/2,e=0;e<r-1;++e)o[e]=2*t[e+1]-i[e+1];return[i,o]}function lw(t){return new aw(t)}function cw(t,e){this._context=t,this._t=e}function uw(t){return new cw(t,.5)}function hw(t,e){if((i=t.length)>1)for(var n,r,i,o=1,a=t[e[0]],s=a.length;o<i;++o)for(r=a,a=t[e[o]],n=0;n<s;++n)a[n][1]+=a[n][0]=isNaN(r[n][1])?r[n][0]:r[n][1]}function fw(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function dw(t,e){return t[e]}function pw(t){const e=[];return e.key=t,e}function gw(t){var e=t.map(_w);return fw(t).sort(function(t,n){return e[t]-e[n]})}function _w(t){for(var e,n=-1,r=0,i=t.length,o=-1/0;++n<i;)(e=+t[n][1])>o&&(o=e,r=n);return r}function yw(t){var e=t.map(mw);return fw(t).sort(function(t,n){return e[t]-e[n]})}function mw(t){for(var e,n=0,r=-1,i=t.length;++r<i;)(e=+t[r][1])&&(n+=e);return n}Jx.prototype={areaStart:Rx,areaEnd:Rx,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}},rw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:nw(this,this._t0,ew(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,nw(this,ew(this,n=tw(this,t,e)),n);break;default:nw(this,this._t0,n=tw(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(iw.prototype=Object.create(rw.prototype)).point=function(t,e){rw.prototype.point.call(this,e,t)},ow.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,o){this._context.bezierCurveTo(e,t,r,n,o,i)}},aw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===n)this._context.lineTo(t[1],e[1]);else for(var r=sw(t),i=sw(e),o=0,a=1;a<n;++o,++a)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],t[a],e[a]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}},cw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};var bw=t=>()=>t;function vw(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function xw(t,e,n){this.k=t,this.x=e,this.y=n}xw.prototype={constructor:xw,scale:function(t){return 1===t?this:new xw(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new xw(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ww=new xw(1,0,0);function Ew(t){for(;!t.__zoom;)if(!(t=t.parentNode))return ww;return t.__zoom}function Aw(t){t.stopImmediatePropagation()}function Tw(t){t.preventDefault(),t.stopImmediatePropagation()}function Sw(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Cw(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function kw(){return this.__zoom||ww}function Mw(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Rw(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ow(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}Ew.prototype=xw.prototype;var Nw=Object.freeze({__proto__:null,Adder:w,Delaunay:Cs,FormatSpecifier:Fl,InternMap:E,InternSet:A,Node:Vd,Path:Ta,Voronoi:xs,ZoomTransform:xw,active:function(t,e){var n,r,i=t.__transition;if(i)for(r in e=null==e?null:e+"",i)if((n=i[r]).state>1&&n.name===e)return new ro([[t]],Do,e,+r);return null},arc:function(){var t=Ev,e=Av,n=cv(0),r=null,i=Tv,o=Sv,a=Cv,s=null,l=wv(c);function c(){var c,u,h=+t.apply(this,arguments),f=+e.apply(this,arguments),d=i.apply(this,arguments)-bv,p=o.apply(this,arguments)-bv,g=uv(p-d),_=p>d;if(s||(s=c=l()),f<h&&(u=f,f=h,h=u),f>yv)if(g>vv-yv)s.moveTo(f*fv(d),f*gv(d)),s.arc(0,0,f,d,p,!_),h>yv&&(s.moveTo(h*fv(p),h*gv(p)),s.arc(0,0,h,p,d,_));else{var y,m,b=d,v=p,x=d,w=p,E=g,A=g,T=a.apply(this,arguments)/2,S=T>yv&&(r?+r.apply(this,arguments):_v(h*h+f*f)),C=pv(uv(f-h)/2,+n.apply(this,arguments)),k=C,M=C;if(S>yv){var R=xv(S/h*gv(T)),O=xv(S/f*gv(T));(E-=2*R)>yv?(x+=R*=_?1:-1,w-=R):(E=0,x=w=(d+p)/2),(A-=2*O)>yv?(b+=O*=_?1:-1,v-=O):(A=0,b=v=(d+p)/2)}var N=f*fv(b),I=f*gv(b),L=h*fv(w),P=h*gv(w);if(C>yv){var V,D=f*fv(v),B=f*gv(v),z=h*fv(x),F=h*gv(x);if(g<mv)if(V=function(t,e,n,r,i,o,a,s){var l=n-t,c=r-e,u=a-i,h=s-o,f=h*l-u*c;if(!(f*f<yv))return[t+(f=(u*(e-o)-h*(t-i))/f)*l,e+f*c]}(N,I,z,F,D,B,L,P)){var G=N-V[0],j=I-V[1],U=D-V[0],Y=B-V[1],H=1/gv(function(t){return t>1?0:t<-1?mv:Math.acos(t)}((G*U+j*Y)/(_v(G*G+j*j)*_v(U*U+Y*Y)))/2),q=_v(V[0]*V[0]+V[1]*V[1]);k=pv(C,(h-q)/(H-1)),M=pv(C,(f-q)/(H+1))}else k=M=0}A>yv?M>yv?(y=kv(z,F,N,I,f,M,_),m=kv(D,B,L,P,f,M,_),s.moveTo(y.cx+y.x01,y.cy+y.y01),M<C?s.arc(y.cx,y.cy,M,hv(y.y01,y.x01),hv(m.y01,m.x01),!_):(s.arc(y.cx,y.cy,M,hv(y.y01,y.x01),hv(y.y11,y.x11),!_),s.arc(0,0,f,hv(y.cy+y.y11,y.cx+y.x11),hv(m.cy+m.y11,m.cx+m.x11),!_),s.arc(m.cx,m.cy,M,hv(m.y11,m.x11),hv(m.y01,m.x01),!_))):(s.moveTo(N,I),s.arc(0,0,f,b,v,!_)):s.moveTo(N,I),h>yv&&E>yv?k>yv?(y=kv(L,P,D,B,h,-k,_),m=kv(N,I,z,F,h,-k,_),s.lineTo(y.cx+y.x01,y.cy+y.y01),k<C?s.arc(y.cx,y.cy,k,hv(y.y01,y.x01),hv(m.y01,m.x01),!_):(s.arc(y.cx,y.cy,k,hv(y.y01,y.x01),hv(y.y11,y.x11),!_),s.arc(0,0,h,hv(y.cy+y.y11,y.cx+y.x11),hv(m.cy+m.y11,m.cx+m.x11),_),s.arc(m.cx,m.cy,k,hv(m.y11,m.x11),hv(m.y01,m.x01),!_))):s.arc(0,0,h,w,x,_):s.lineTo(L,P)}else s.moveTo(0,0);if(s.closePath(),c)return s=null,c+""||null}return c.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-mv/2;return[fv(r)*n,gv(r)*n]},c.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),c):t},c.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),c):e},c.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:cv(+t),c):n},c.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:cv(+t),c):r},c.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:cv(+t),c):i},c.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:cv(+t),c):o},c.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:cv(+t),c):a},c.context=function(t){return arguments.length?(s=null==t?null:t,c):s},c},area:Vv,areaRadial:Yv,ascending:t,autoType:Zs,axisBottom:function(t){return Rt(3,t)},axisLeft:function(t){return Rt(4,t)},axisRight:function(t){return Rt(2,t)},axisTop:function(t){return Rt(1,t)},bin:J,bisect:a,bisectCenter:l,bisectLeft:s,bisectRight:a,bisector:n,blob:function(t,e){return fetch(t,e).then(Qs)},blur:function(t,e){if(!((e=+e)>=0))throw new RangeError("invalid r");let n=t.length;if(!((n=Math.floor(n))>=0))throw new RangeError("invalid length");if(!n||!e)return t;const r=p(e),i=t.slice();return r(t,i,0,n,1),r(i,t,0,n,1),r(t,i,0,n,1),t},blur2:c,blurImage:u,brush:function(){return ca(Jo)},brushSelection:function(t){var e=t.__brush;return e?e.dim.output(e.selection):null},brushX:function(){return ca(Ko)},brushY:function(){return ca(Zo)},buffer:function(t,e){return fetch(t,e).then(tl)},chord:function(){return ba(!1,!1)},chordDirected:function(){return ba(!0,!1)},chordTranspose:function(){return ba(!1,!0)},cluster:Md,color:On,contourDensity:function(){var t=Ka,e=Za,n=Ja,r=960,i=500,o=20,a=2,s=3*o,l=r+2*s>>a,u=i+2*s>>a,h=za(20);function f(r){var i=new Float32Array(l*u),h=Math.pow(2,-a),f=-1;for(const o of r){var d=(t(o,++f,r)+s)*h,p=(e(o,f,r)+s)*h,g=+n(o,f,r);if(g&&d>=0&&d<l&&p>=0&&p<u){var _=Math.floor(d),y=Math.floor(p),m=d-_-.5,b=p-y-.5;i[_+y*l]+=(1-m)*(1-b)*g,i[_+1+y*l]+=m*(1-b)*g,i[_+1+(y+1)*l]+=m*b*g,i[_+(y+1)*l]+=(1-m)*b*g}}return c({data:i,width:l,height:u},o*h),i}function d(t){var e=f(t),n=h(e),r=Math.pow(2,2*a);return Array.isArray(n)||(n=W(Number.MIN_VALUE,Q(e)/r,n)),Ha().size([l,u]).thresholds(n.map(t=>t*r))(e).map((t,e)=>(t.value=+n[e],p(t)))}function p(t){return t.coordinates.forEach(g),t}function g(t){t.forEach(_)}function _(t){t.forEach(y)}function y(t){t[0]=t[0]*Math.pow(2,a)-s,t[1]=t[1]*Math.pow(2,a)-s}function m(){return l=r+2*(s=3*o)>>a,u=i+2*s>>a,d}return d.contours=function(t){var e=f(t),n=Ha().size([l,u]),r=Math.pow(2,2*a),i=t=>{t=+t;var i=p(n.contour(e,t*r));return i.value=t,i};return Object.defineProperty(i,"max",{get:()=>Q(e)/r}),i},d.x=function(e){return arguments.length?(t="function"==typeof e?e:za(+e),d):t},d.y=function(t){return arguments.length?(e="function"==typeof t?t:za(+t),d):e},d.weight=function(t){return arguments.length?(n="function"==typeof t?t:za(+t),d):n},d.size=function(t){if(!arguments.length)return[r,i];var e=+t[0],n=+t[1];if(!(e>=0&&n>=0))throw new Error("invalid size");return r=e,i=n,m()},d.cellSize=function(t){if(!arguments.length)return 1<<a;if(!((t=+t)>=1))throw new Error("invalid cell size");return a=Math.floor(Math.log(t)/Math.LN2),m()},d.thresholds=function(t){return arguments.length?(h="function"==typeof t?t:Array.isArray(t)?za(Da.call(t)):za(t),d):h},d.bandwidth=function(t){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*t*t+1)-1)/2,m()},d},contours:Ha,count:g,create:function(t){return $e(Gt(t).call(document.documentElement))},creator:Gt,cross:function(...t){const e="function"==typeof t[t.length-1]&&function(t){return e=>t(...e)}(t.pop()),n=(t=t.map(m)).map(_),r=t.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(y))return o;for(;;){o.push(i.map((e,n)=>t[n][e]));let a=r;for(;++i[a]===n[a];){if(0===a)return e?o.map(e):o;i[a--]=0}}},csv:il,csvFormat:Bs,csvFormatBody:zs,csvFormatRow:Gs,csvFormatRows:Fs,csvFormatValue:js,csvParse:Vs,csvParseRows:Ds,cubehelix:wr,cumsum:function(t,e){var n=0,r=0;return Float64Array.from(t,void 0===e?t=>n+=+t||0:i=>n+=+e(i,r++,t)||0)},curveBasis:Ix,curveBasisClosed:function(t){return new Lx(t)},curveBasisOpen:function(t){return new Px(t)},curveBumpX:$v,curveBumpY:Xv,curveBundle:Dx,curveCardinal:Fx,curveCardinalClosed:jx,curveCardinalOpen:Yx,curveCatmullRom:Wx,curveCatmullRomClosed:Xx,curveCatmullRomOpen:Zx,curveLinear:Nv,curveLinearClosed:function(t){return new Jx(t)},curveMonotoneX:function(t){return new rw(t)},curveMonotoneY:function(t){return new iw(t)},curveNatural:lw,curveStep:uw,curveStepAfter:function(t){return new cw(t,1)},curveStepBefore:function(t){return new cw(t,0)},descending:e,deviation:v,difference:function(t,...e){t=new A(t);for(const n of e)for(const e of n)t.delete(e);return t},disjoint:function(t,e){const n=e[Symbol.iterator](),r=new A;for(const e of t){if(r.has(e))return!1;let t,i;for(;({value:t,done:i}=n.next())&&!i;){if(Object.is(e,t))return!1;r.add(t)}}return!0},dispatch:Nt,drag:function(){var t,e,n,r,i=cn,o=un,a=hn,s=fn,l={},c=Nt("start","drag","end"),u=0,h=0;function f(t){t.on("mousedown.drag",d).filter(s).on("touchstart.drag",_).on("touchmove.drag",y,tn).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(a,s){if(!r&&i.call(this,a,s)){var l=b(this,o.call(this,a,s),a,s,"mouse");l&&($e(a.view).on("mousemove.drag",p,en).on("mouseup.drag",g,en),on(a.view),nn(a),n=!1,t=a.clientX,e=a.clientY,l("start",a))}}function p(r){if(rn(r),!n){var i=r.clientX-t,o=r.clientY-e;n=i*i+o*o>h}l.mouse("drag",r)}function g(t){$e(t.view).on("mousemove.drag mouseup.drag",null),an(t.view,n),rn(t),l.mouse("end",t)}function _(t,e){if(i.call(this,t,e)){var n,r,a=t.changedTouches,s=o.call(this,t,e),l=a.length;for(n=0;n<l;++n)(r=b(this,s,t,e,a[n].identifier,a[n]))&&(nn(t),r("start",t,a[n]))}}function y(t){var e,n,r=t.changedTouches,i=r.length;for(e=0;e<i;++e)(n=l[r[e].identifier])&&(rn(t),n("drag",t,r[e]))}function m(t){var e,n,i=t.changedTouches,o=i.length;for(r&&clearTimeout(r),r=setTimeout(function(){r=null},500),e=0;e<o;++e)(n=l[i[e].identifier])&&(nn(t),n("end",t,i[e]))}function b(t,e,n,r,i,o){var s,h,d,p=c.copy(),g=Qe(o||n,e);if(null!=(d=a.call(t,new ln("beforestart",{sourceEvent:n,target:f,identifier:i,active:u,x:g[0],y:g[1],dx:0,dy:0,dispatch:p}),r)))return s=d.x-g[0]||0,h=d.y-g[1]||0,function n(o,a,c){var _,y=g;switch(o){case"start":l[i]=n,_=u++;break;case"end":delete l[i],--u;case"drag":g=Qe(c||a,e),_=u}p.call(o,t,new ln(o,{sourceEvent:a,subject:d,target:f,identifier:i,active:_,x:g[0]+s,y:g[1]+h,dx:g[0]-y[0],dy:g[1]-y[1],dispatch:p}),r)}}return f.filter=function(t){return arguments.length?(i="function"==typeof t?t:sn(!!t),f):i},f.container=function(t){return arguments.length?(o="function"==typeof t?t:sn(t),f):o},f.subject=function(t){return arguments.length?(a="function"==typeof t?t:sn(t),f):a},f.touchable=function(t){return arguments.length?(s="function"==typeof t?t:sn(!!t),f):s},f.on=function(){var t=c.on.apply(c,arguments);return t===c?f:t},f.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,f):Math.sqrt(h)},f},dragDisable:on,dragEnable:an,dsv:function(t,e,n,r){3===arguments.length&&"function"==typeof n&&(r=n,n=void 0);var i=Ls(t);return nl(e,n).then(function(t){return i.parse(t,r)})},dsvFormat:Ls,easeBack:Ro,easeBackIn:ko,easeBackInOut:Ro,easeBackOut:Mo,easeBounce:So,easeBounceIn:function(t){return 1-So(1-t)},easeBounceInOut:function(t){return((t*=2)<=1?1-So(1-t):So(t-1)+1)/2},easeBounceOut:So,easeCircle:mo,easeCircleIn:function(t){return 1-Math.sqrt(1-t*t)},easeCircleInOut:mo,easeCircleOut:function(t){return Math.sqrt(1- --t*t)},easeCubic:lo,easeCubicIn:function(t){return t*t*t},easeCubicInOut:lo,easeCubicOut:function(t){return--t*t*t+1},easeElastic:Io,easeElasticIn:No,easeElasticInOut:Lo,easeElasticOut:Io,easeExp:yo,easeExpIn:function(t){return _o(1-+t)},easeExpInOut:yo,easeExpOut:function(t){return 1-_o(t)},easeLinear:t=>+t,easePoly:ho,easePolyIn:co,easePolyInOut:ho,easePolyOut:uo,easeQuad:so,easeQuadIn:function(t){return t*t},easeQuadInOut:so,easeQuadOut:function(t){return t*(2-t)},easeSin:go,easeSinIn:function(t){return 1===+t?1:1-Math.cos(t*po)},easeSinInOut:go,easeSinOut:function(t){return Math.sin(t*po)},every:function(t,e){if("function"!=typeof e)throw new TypeError("test is not a function");let n=-1;for(const r of t)if(!e(r,++n,t))return!1;return!0},extent:x,fcumsum:function(t,e){const n=new w;let r=-1;return Float64Array.from(t,void 0===e?t=>n.add(+t||0):i=>n.add(+e(i,++r,t)||0))},filter:function(t,e){if("function"!=typeof e)throw new TypeError("test is not a function");const n=[];let r=-1;for(const i of t)e(i,++r,t)&&n.push(i);return n},flatGroup:function(t,...e){return N(O(t,...e),e)},flatRollup:function(t,e,...n){return N(L(t,e,...n),n)},forceCenter:hl,forceCollide:function(t){var e,n,r,i=1,o=1;function a(){for(var t,a,l,c,u,h,f,d=e.length,p=0;p<o;++p)for(a=_l(e,wl,El).visitAfter(s),t=0;t<d;++t)l=e[t],h=n[l.index],f=h*h,c=l.x+l.vx,u=l.y+l.vy,a.visit(g);function g(t,e,n,o,a){var s=t.data,d=t.r,p=h+d;if(!s)return e>c+p||o<c-p||n>u+p||a<u-p;if(s.index>l.index){var g=c-s.x-s.vx,_=u-s.y-s.vy,y=g*g+_*_;y<p*p&&(0===g&&(y+=(g=xl(r))*g),0===_&&(y+=(_=xl(r))*_),y=(p-(y=Math.sqrt(y)))/y*i,l.vx+=(g*=y)*(p=(d*=d)/(f+d)),l.vy+=(_*=y)*p,s.vx-=g*(p=1-p),s.vy-=_*p)}}}function s(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function l(){if(e){var r,i,o=e.length;for(n=new Array(o),r=0;r<o;++r)i=e[r],n[i.index]=+t(i,r,e)}}return"function"!=typeof t&&(t=vl(null==t?1:+t)),a.initialize=function(t,n){e=t,r=n,l()},a.iterations=function(t){return arguments.length?(o=+t,a):o},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:vl(+e),l(),a):t},a},forceLink:Sl,forceManyBody:Nl,forceRadial:function(t,e,n){var r,i,o,a=vl(.1);function s(t){for(var a=0,s=r.length;a<s;++a){var l=r[a],c=l.x-e||1e-6,u=l.y-n||1e-6,h=Math.sqrt(c*c+u*u),f=(o[a]-h)*i[a]*t/h;l.vx+=c*f,l.vy+=u*f}}function l(){if(r){var e,n=r.length;for(i=new Array(n),o=new Array(n),e=0;e<n;++e)o[e]=+t(r[e],e,r),i[e]=isNaN(o[e])?0:+a(r[e],e,r)}}return"function"!=typeof t&&(t=vl(+t)),null==e&&(e=0),null==n&&(n=0),s.initialize=function(t){r=t,l()},s.strength=function(t){return arguments.length?(a="function"==typeof t?t:vl(+t),l(),s):a},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:vl(+e),l(),s):t},s.x=function(t){return arguments.length?(e=+t,s):e},s.y=function(t){return arguments.length?(n=+t,s):n},s},forceSimulation:Ol,forceX:Il,forceY:Ll,get format(){return Hl},formatDefaultLocale:Kl,formatLocale:Xl,get formatPrefix(){return ql},formatSpecifier:zl,fsum:function(t,e){const n=new w;if(void 0===e)for(let e of t)(e=+e)&&n.add(e);else{let r=-1;for(let i of t)(i=+e(i,++r,t))&&n.add(i)}return+n},geoAlbers:id,geoAlbersUsa:function(){var t,e,n,r,i,o,a=id(),s=rd().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=rd().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(t,e){o=[t,e]}};function u(t){var e=t[0],a=t[1];return o=null,n.point(e,a),o||(r.point(e,a),o)||(i.point(e,a),o)}function h(){return t=e=null,u}return u.invert=function(t){var e=a.scale(),n=a.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?s:i>=.166&&i<.234&&r>=-.214&&r<-.115?l:a).invert(t)},u.stream=function(n){return t&&e===n?t:(r=[a.stream(e=n),s.stream(n),l.stream(n)],i=r.length,t={point:function(t,e){for(var n=-1;++n<i;)r[n].point(t,e)},sphere:function(){for(var t=-1;++t<i;)r[t].sphere()},lineStart:function(){for(var t=-1;++t<i;)r[t].lineStart()},lineEnd:function(){for(var t=-1;++t<i;)r[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<i;)r[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<i;)r[t].polygonEnd()}});var r,i},u.precision=function(t){return arguments.length?(a.precision(t),s.precision(t),l.precision(t),h()):a.precision()},u.scale=function(t){return arguments.length?(a.scale(t),s.scale(.35*t),l.scale(t),u.translate(a.translate())):a.scale()},u.translate=function(t){if(!arguments.length)return a.translate();var e=a.scale(),o=+t[0],u=+t[1];return n=a.translate(t).clipExtent([[o-.455*e,u-.238*e],[o+.455*e,u+.238*e]]).stream(c),r=s.translate([o-.307*e,u+.201*e]).clipExtent([[o-.425*e+tc,u+.12*e+tc],[o-.214*e-tc,u+.234*e-tc]]).stream(c),i=l.translate([o-.205*e,u+.212*e]).clipExtent([[o-.214*e+tc,u+.166*e+tc],[o-.115*e-tc,u+.234*e-tc]]).stream(c),h()},u.fitExtent=function(t,e){return Hf(u,t,e)},u.fitSize=function(t,e){return qf(u,t,e)},u.fitWidth=function(t,e){return Wf(u,t,e)},u.fitHeight=function(t,e){return $f(u,t,e)},u.scale(1070)},geoArea:function(t){return $c=new w,Rc(t,Xc),2*$c},geoAzimuthalEqualArea:function(){return Qf(sd).scale(124.75).clipAngle(179.999)},geoAzimuthalEqualAreaRaw:sd,geoAzimuthalEquidistant:function(){return Qf(ld).scale(79.4188).clipAngle(179.999)},geoAzimuthalEquidistantRaw:ld,geoBounds:function(t){var e,n,r,i,o,a,s;if(zc=Bc=-(Vc=Dc=1/0),Hc=[],Rc(t,Eu),n=Hc.length){for(Hc.sort(Nu),e=1,o=[r=Hc[0]];e<n;++e)Iu(r,(i=Hc[e])[0])||Iu(r,i[1])?(Ou(r[0],i[1])>Ou(r[0],r[1])&&(r[1]=i[1]),Ou(i[0],r[1])>Ou(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,e=0,r=o[n=o.length-1];e<=n;r=i,++e)i=o[e],(s=Ou(r[1],i[0]))>a&&(a=s,Vc=i[0],Bc=r[1])}return Hc=qc=null,Vc===1/0||Dc===1/0?[[NaN,NaN],[NaN,NaN]]:[[Vc,Dc],[Bc,zc]]},geoCentroid:function(t){su=lu=cu=uu=hu=fu=du=pu=0,gu=new w,_u=new w,yu=new w,Rc(t,Lu);var e=+gu,n=+_u,r=+yu,i=pc(e,n,r);return i<ec&&(e=fu,n=du,r=pu,lu<tc&&(e=cu,n=uu,r=hu),(i=pc(e,n,r))<ec)?[NaN,NaN]:[uc(n,e)*ac,wc(r/i)*ac]},geoCircle:function(){var t,e,n=Hu([0,0]),r=Hu(90),i=Hu(2),o={point:function(n,r){t.push(n=e(n,r)),n[0]*=ac,n[1]*=ac}};function a(){var a=n.apply(this,arguments),s=r.apply(this,arguments)*sc,l=i.apply(this,arguments)*sc;return t=[],e=$u(-a[0]*sc,-a[1]*sc,0).invert,Qu(o,s,l,1),a={type:"Polygon",coordinates:[t]},t=e=null,a}return a.center=function(t){return arguments.length?(n="function"==typeof t?t:Hu([+t[0],+t[1]]),a):n},a.radius=function(t){return arguments.length?(r="function"==typeof t?t:Hu(+t),a):r},a.precision=function(t){return arguments.length?(i="function"==typeof t?t:Hu(+t),a):i},a},geoClipAntimeridian:hh,geoClipCircle:fh,geoClipExtent:function(){var t,e,n,r=0,i=0,o=960,a=500;return n={stream:function(n){return t&&e===n?t:t=bh(r,i,o,a)(e=n)},extent:function(s){return arguments.length?(r=+s[0][0],i=+s[0][1],o=+s[1][0],a=+s[1][1],t=e=null,n):[[r,i],[o,a]]}}},geoClipRectangle:bh,geoConicConformal:function(){return ed(fd).scale(109.5).parallels([30,30])},geoConicConformalRaw:fd,geoConicEqualArea:rd,geoConicEqualAreaRaw:nd,geoConicEquidistant:function(){return ed(pd).scale(131.154).center([0,13.9389])},geoConicEquidistantRaw:pd,geoContains:function(t,e){return(t&&kh.hasOwnProperty(t.type)?kh[t.type]:Rh)(t,e)},geoDistance:Ch,geoEqualEarth:function(){return Qf(vd).scale(177.158)},geoEqualEarthRaw:vd,geoEquirectangular:function(){return Qf(dd).scale(152.63)},geoEquirectangularRaw:dd,geoGnomonic:function(){return Qf(xd).scale(144.049).clipAngle(60)},geoGnomonicRaw:xd,geoGraticule:Bh,geoGraticule10:function(){return Bh()()},geoIdentity:function(){var t,e,n,r,i,o,a,s=1,l=0,c=0,u=1,h=1,f=0,d=null,p=1,g=1,_=jf({point:function(t,e){var n=b([t,e]);this.stream.point(n[0],n[1])}}),y=Uh;function m(){return p=s*u,g=s*h,o=a=null,b}function b(n){var r=n[0]*p,i=n[1]*g;if(f){var o=i*t-r*e;r=r*t+i*e,i=o}return[r+l,i+c]}return b.invert=function(n){var r=n[0]-l,i=n[1]-c;if(f){var o=i*t+r*e;r=r*t-i*e,i=o}return[r/p,i/g]},b.stream=function(t){return o&&a===t?o:o=_(y(a=t))},b.postclip=function(t){return arguments.length?(y=t,d=n=r=i=null,m()):y},b.clipExtent=function(t){return arguments.length?(y=null==t?(d=n=r=i=null,Uh):bh(d=+t[0][0],n=+t[0][1],r=+t[1][0],i=+t[1][1]),m()):null==d?null:[[d,n],[r,i]]},b.scale=function(t){return arguments.length?(s=+t,m()):s},b.translate=function(t){return arguments.length?(l=+t[0],c=+t[1],m()):[l,c]},b.angle=function(n){return arguments.length?(e=yc(f=n%360*sc),t=hc(f),m()):f*ac},b.reflectX=function(t){return arguments.length?(u=t?-1:1,m()):u<0},b.reflectY=function(t){return arguments.length?(h=t?-1:1,m()):h<0},b.fitExtent=function(t,e){return Hf(b,t,e)},b.fitSize=function(t,e){return qf(b,t,e)},b.fitWidth=function(t,e){return Wf(b,t,e)},b.fitHeight=function(t,e){return $f(b,t,e)},b},geoInterpolate:function(t,e){var n=t[0]*sc,r=t[1]*sc,i=e[0]*sc,o=e[1]*sc,a=hc(r),s=yc(r),l=hc(o),c=yc(o),u=a*hc(n),h=a*yc(n),f=l*hc(i),d=l*yc(i),p=2*wc(bc(Ec(o-r)+a*l*Ec(i-n))),g=yc(p),_=p?function(t){var e=yc(t*=p)/g,n=yc(p-t)/g,r=n*u+e*f,i=n*h+e*d,o=n*s+e*c;return[uc(i,r)*ac,uc(o,bc(r*r+i*i))*ac]}:function(){return[n*ac,r*ac]};return _.distance=p,_},geoLength:Ah,geoMercator:function(){return ud(cd).scale(961/oc)},geoMercatorRaw:cd,geoNaturalEarth1:function(){return Qf(wd).scale(175.295)},geoNaturalEarth1Raw:wd,geoOrthographic:function(){return Qf(Ed).scale(249.5).clipAngle(90.000001)},geoOrthographicRaw:Ed,geoPath:function(t,e){let n,r,i=3,o=4.5;function a(t){return t&&("function"==typeof o&&r.pointRadius(+o.apply(this,arguments)),Rc(t,n(r))),r.result()}return a.area=function(t){return Rc(t,n(qh)),qh.result()},a.measure=function(t){return Rc(t,n(If)),If.result()},a.bounds=function(t){return Rc(t,n(ef)),ef.result()},a.centroid=function(t){return Rc(t,n(_f)),_f.result()},a.projection=function(e){return arguments.length?(n=null==e?(t=null,Uh):(t=e).stream,a):t},a.context=function(t){return arguments.length?(r=null==t?(e=null,new Ff(i)):new Sf(e=t),"function"!=typeof o&&r.pointRadius(o),a):e},a.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(r.pointRadius(+t),+t),a):o},a.digits=function(t){if(!arguments.length)return i;if(null==t)i=null;else{const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);i=e}return null===e&&(r=new Ff(i)),a},a.projection(t).digits(i).context(e)},geoProjection:Qf,geoProjectionMutator:td,geoRotation:Ju,geoStereographic:function(){return Qf(Ad).scale(250).clipAngle(142)},geoStereographicRaw:Ad,geoStream:Rc,geoTransform:function(t){return{stream:jf(t)}},geoTransverseMercator:function(){var t=ud(Td),e=t.center,n=t.rotate;return t.center=function(t){return arguments.length?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return arguments.length?n([t[0],t[1],t.length>2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)},geoTransverseMercatorRaw:Td,gray:function(t,e){return new or(t,0,0,null==e?1:e)},greatest:ot,greatestIndex:function(e,n=t){if(1===n.length)return tt(e,n);let r,i=-1,o=-1;for(const t of e)++o,(i<0?0===n(t,t):n(t,r)>0)&&(r=t,i=o);return i},group:R,groupSort:function(e,n,r){return(2!==n.length?B(I(e,n,r),([e,n],[r,i])=>t(n,i)||t(e,r)):B(R(e,r),([e,r],[i,o])=>n(r,o)||t(e,i))).map(([t])=>t)},groups:O,hcl:hr,hierarchy:Od,histogram:J,hsl:Yn,html:cl,image:function(t,e){return new Promise(function(n,r){var i=new Image;for(var o in e)i[o]=e[o];i.onerror=r,i.onload=function(){n(i)},i.src=t})},index:function(t,...e){return V(t,M,P,e)},indexes:function(t,...e){return V(t,Array.from,P,e)},interpolate:Hr,interpolateArray:function(t,e){return(Dr(e)?Vr:Br)(t,e)},interpolateBasis:Tr,interpolateBasisClosed:Sr,interpolateBlues:zb,interpolateBrBG:Zm,interpolateBuGn:gb,interpolateBuPu:yb,interpolateCividis:function(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-t*(35.34-t*(2381.73-t*(6402.7-t*(7024.72-2710.57*t)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+t*(170.73+t*(52.82-t*(131.46-t*(176.58-67.37*t)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+t*(442.36-t*(2482.43-t*(6167.24-t*(6614.94-2475.67*t)))))))+")"},interpolateCool:Jb,interpolateCubehelix:ci,interpolateCubehelixDefault:Kb,interpolateCubehelixLong:ui,interpolateDate:zr,interpolateDiscrete:function(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}},interpolateGnBu:bb,interpolateGreens:Gb,interpolateGreys:Ub,interpolateHcl:ai,interpolateHclLong:si,interpolateHsl:ri,interpolateHslLong:ii,interpolateHue:function(t,e){var n=Mr(+t,+e);return function(t){var e=n(t);return e-360*Math.floor(e/360)}},interpolateInferno:sv,interpolateLab:function(t,e){var n=Or((t=ir(t)).l,(e=ir(e)).l),r=Or(t.a,e.a),i=Or(t.b,e.b),o=Or(t.opacity,e.opacity);return function(e){return t.l=n(e),t.a=r(e),t.b=i(e),t.opacity=o(e),t+""}},interpolateMagma:av,interpolateNumber:Fr,interpolateNumberArray:Vr,interpolateObject:Gr,interpolateOrRd:xb,interpolateOranges:Xb,interpolatePRGn:Qm,interpolatePiYG:eb,interpolatePlasma:lv,interpolatePuBu:Tb,interpolatePuBuGn:Eb,interpolatePuOr:rb,interpolatePuRd:Cb,interpolatePurples:Hb,interpolateRainbow:function(t){(t<0||t>1)&&(t-=Math.floor(t));var e=Math.abs(t-.5);return Qb.h=360*t-100,Qb.s=1.5-1.5*e,Qb.l=.8-.9*e,Qb+""},interpolateRdBu:ob,interpolateRdGy:sb,interpolateRdPu:Mb,interpolateRdYlBu:cb,interpolateRdYlGn:hb,interpolateReds:Wb,interpolateRgb:Nr,interpolateRgbBasis:Lr,interpolateRgbBasisClosed:Pr,interpolateRound:qr,interpolateSinebow:function(t){var e;return t=(.5-t)*Math.PI,tv.r=255*(e=Math.sin(t))*e,tv.g=255*(e=Math.sin(t+ev))*e,tv.b=255*(e=Math.sin(t+nv))*e,tv+""},interpolateSpectral:db,interpolateString:Yr,interpolateTransformCss:Jr,interpolateTransformSvg:Qr,interpolateTurbo:rv,interpolateViridis:ov,interpolateWarm:Zb,interpolateYlGn:Ib,interpolateYlGnBu:Ob,interpolateYlOrBr:Pb,interpolateYlOrRd:Db,interpolateZoom:ei,interrupt:Di,intersection:function(t,...e){t=new A(t),e=e.map(vt);t:for(const n of t)for(const r of e)if(!r.has(n)){t.delete(n);continue t}return t},interval:function(t,e,n){var r=new Ai,i=e;return null==e?(r.restart(t,e,n),r):(r._restart=r.restart,r.restart=function(t,e,n){e=+e,n=null==n?wi():+n,r._restart(function o(a){a+=i,r._restart(o,i+=e,n),t(a)},e,n)},r.restart(t,e,n),r)},isoFormat:Tm,isoParse:Sm,json:function(t,e){return fetch(t,e).then(al)},lab:ir,lch:function(t,e,n,r){return 1===arguments.length?ur(t):new fr(n,e,t,null==r?1:r)},least:function(e,n=t){let r,i=!1;if(1===n.length){let o;for(const a of e){const e=n(a);(i?t(e,o)<0:0===t(e,e))&&(r=a,o=e,i=!0)}}else for(const t of e)(i?n(t,r)<0:0===n(t,t))&&(r=t,i=!0);return r},leastIndex:pt,line:Pv,lineRadial:Uv,link:Qv,linkHorizontal:tx,linkRadial:nx,linkVertical:ex,local:Ke,map:function(t,e){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");if("function"!=typeof e)throw new TypeError("mapper is not a function");return Array.from(t,(n,r)=>e(n,r,t))},matcher:Wt,max:Q,maxIndex:tt,mean:ct,median:ut,medianIndex:function(t,e){return lt(t,.5,e)},merge:ht,min:et,minIndex:nt,mode:function(t,e){const n=new E;if(void 0===e)for(let e of t)null!=e&&e>=e&&n.set(e,(n.get(e)||0)+1);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&i>=i&&n.set(i,(n.get(i)||0)+1)}let r,i=0;for(const[t,e]of n)e>i&&(i=e,r=t);return r},namespace:Bt,namespaces:Dt,nice:K,now:wi,pack:rp,packEnclose:function(t){return Ud(t,jd())},packSiblings:function(t){return ep(t,jd()),t},pairs:function(t,e=ft){const n=[];let r,i=!1;for(const o of t)i&&n.push(e(r,o)),r=o,i=!0;return n},partition:function(){var t=1,e=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/o,i.eachBefore(function(t,e){return function(r){r.children&&lp(r,r.x0,t*(r.depth+1)/e,r.x1,t*(r.depth+2)/e);var i=r.x0,o=r.y0,a=r.x1-n,s=r.y1-n;a<i&&(i=a=(i+a)/2),s<o&&(o=s=(o+s)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=s}}(e,o)),r&&i.eachBefore(sp),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(n){return arguments.length?(t=+n[0],e=+n[1],i):[t,e]},i.padding=function(t){return arguments.length?(n=+t,i):n},i},path:Sa,pathRound:function(t=3){return new Ta(+t)},permute:D,pie:function(){var t=Bv,e=Dv,n=null,r=cv(0),i=cv(vv),o=cv(0);function a(a){var s,l,c,u,h,f=(a=Rv(a)).length,d=0,p=new Array(f),g=new Array(f),_=+r.apply(this,arguments),y=Math.min(vv,Math.max(-vv,i.apply(this,arguments)-_)),m=Math.min(Math.abs(y)/f,o.apply(this,arguments)),b=m*(y<0?-1:1);for(s=0;s<f;++s)(h=g[p[s]=s]=+t(a[s],s,a))>0&&(d+=h);for(null!=e?p.sort(function(t,n){return e(g[t],g[n])}):null!=n&&p.sort(function(t,e){return n(a[t],a[e])}),s=0,c=d?(y-f*b)/d:0;s<f;++s,_=u)l=p[s],u=_+((h=g[l])>0?h*c:0)+b,g[l]={data:a[l],index:s,value:h,startAngle:_,endAngle:u,padAngle:m};return g}return a.value=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),a):t},a.sortValues=function(t){return arguments.length?(e=t,n=null,a):e},a.sort=function(t){return arguments.length?(n=t,e=null,a):n},a.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:cv(+t),a):r},a.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:cv(+t),a):i},a.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:cv(+t),a):o},a},piecewise:hi,pointRadial:Hv,pointer:Qe,pointers:function(t,e){return t.target&&(t=Je(t),void 0===e&&(e=t.currentTarget),t=t.touches||[t]),Array.from(t,t=>Qe(t,e))},polygonArea:function(t){for(var e,n=-1,r=t.length,i=t[r-1],o=0;++n<r;)e=i,i=t[n],o+=e[1]*i[0]-e[0]*i[1];return o/2},polygonCentroid:function(t){for(var e,n,r=-1,i=t.length,o=0,a=0,s=t[i-1],l=0;++r<i;)e=s,s=t[r],l+=n=e[0]*s[1]-s[0]*e[1],o+=(e[0]+s[0])*n,a+=(e[1]+s[1])*n;return[o/(l*=3),a/l]},polygonContains:function(t,e){for(var n,r,i=t.length,o=t[i-1],a=e[0],s=e[1],l=o[0],c=o[1],u=!1,h=0;h<i;++h)n=(o=t[h])[0],(r=o[1])>s!=c>s&&a<(l-n)*(s-r)/(c-r)+n&&(u=!u),l=n,c=r;return u},polygonHull:function(t){if((n=t.length)<3)return null;var e,n,r=new Array(n),i=new Array(n);for(e=0;e<n;++e)r[e]=[+t[e][0],+t[e][1],e];for(r.sort(Rp),e=0;e<n;++e)i[e]=[r[e][0],-r[e][1]];var o=Op(r),a=Op(i),s=a[0]===o[0],l=a[a.length-1]===o[o.length-1],c=[];for(e=o.length-1;e>=0;--e)c.push(t[r[o[e]][2]]);for(e=+s;e<a.length-l;++e)c.push(t[r[a[e]][2]]);return c},polygonLength:function(t){for(var e,n,r=-1,i=t.length,o=t[i-1],a=o[0],s=o[1],l=0;++r<i;)e=a,n=s,e-=a=(o=t[r])[0],n-=s=o[1],l+=Math.hypot(e,n);return l},precisionFixed:Zl,precisionPrefix:Jl,precisionRound:Ql,quadtree:_l,quantile:at,quantileIndex:lt,quantileSorted:st,quantize:function(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t(r/(e-1));return n},quickselect:rt,radialArea:Yv,radialLine:Uv,randomBates:Bp,randomBernoulli:Gp,randomBeta:Yp,randomBinomial:Hp,randomCauchy:Wp,randomExponential:zp,randomGamma:Up,randomGeometric:jp,randomInt:Lp,randomIrwinHall:Dp,randomLcg:function(t=Math.random()){let e=0|(0<=t&&t<1?t/Kp:Math.abs(t));return()=>(e=1664525*e+1013904223|0,Kp*(e>>>0))},randomLogNormal:Vp,randomLogistic:$p,randomNormal:Pp,randomPareto:Fp,randomPoisson:Xp,randomUniform:Ip,randomWeibull:qp,range:dt,rank:function(e,n=t){if("function"!=typeof e[Symbol.iterator])throw new TypeError("values is not iterable");let r=Array.from(e);const i=new Float64Array(r.length);2!==n.length&&(r=r.map(n),n=t);const o=(t,e)=>n(r[t],r[e]);let a,s;return(e=Uint32Array.from(r,(t,e)=>e)).sort(n===t?(t,e)=>F(r[t],r[e]):z(o)),e.forEach((t,e)=>{const n=o(t,void 0===a?t:a);n>=0?((void 0===a||n>0)&&(a=t,s=e),i[t]=s):i[t]=NaN}),i},reduce:function(t,e,n){if("function"!=typeof e)throw new TypeError("reducer is not a function");const r=t[Symbol.iterator]();let i,o,a=-1;if(arguments.length<3){if(({done:i,value:n}=r.next()),i)return;++a}for(;({done:i,value:o}=r.next()),!i;)n=e(n,o,++a,t);return n},reverse:function(t){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");return Array.from(t).reverse()},rgb:Pn,ribbon:function(){return Va()},ribbonArrow:function(){return Va(Pa)},rollup:I,rollups:L,scaleBand:eg,scaleDiverging:function t(){var e=pg(Pm()(ag));return e.copy=function(){return Nm(e,t())},Jp.apply(e,arguments)},scaleDivergingLog:function t(){var e=Eg(Pm()).domain([.1,1,10]);return e.copy=function(){return Nm(e,t()).base(e.base())},Jp.apply(e,arguments)},scaleDivergingPow:Vm,scaleDivergingSqrt:function(){return Vm.apply(null,arguments).exponent(.5)},scaleDivergingSymlog:function t(){var e=Cg(Pm());return e.copy=function(){return Nm(e,t()).constant(e.constant())},Jp.apply(e,arguments)},scaleIdentity:function t(e){var n;function r(t){return null==t||isNaN(t=+t)?n:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=Array.from(t,ig),r):e.slice()},r.unknown=function(t){return arguments.length?(n=t,r):n},r.copy=function(){return t(e).unknown(n)},e=arguments.length?Array.from(e,ig):[0,1],pg(r)},scaleImplicit:Qp,scaleLinear:gg,scaleLog:Ag,scaleOrdinal:tg,scalePoint:rg,scalePow:Ng,scaleQuantile:function e(){var n,r=[],i=[],o=[];function s(){var t=0,e=Math.max(1,i.length);for(o=new Array(e-1);++t<e;)o[t-1]=st(r,t/e);return l}function l(t){return null==t||isNaN(t=+t)?n:i[a(o,t)]}return l.invertExtent=function(t){var e=i.indexOf(t);return e<0?[NaN,NaN]:[e>0?o[e-1]:r[0],e<o.length?o[e]:r[r.length-1]]},l.domain=function(e){if(!arguments.length)return r.slice();r=[];for(let t of e)null==t||isNaN(t=+t)||r.push(t);return r.sort(t),s()},l.range=function(t){return arguments.length?(i=Array.from(t),s()):i.slice()},l.unknown=function(t){return arguments.length?(n=t,l):n},l.quantiles=function(){return o.slice()},l.copy=function(){return e().domain(r).range(i).unknown(n)},Zp.apply(l,arguments)},scaleQuantize:function t(){var e,n=0,r=1,i=1,o=[.5],s=[0,1];function l(t){return null!=t&&t<=t?s[a(o,t,0,i)]:e}function c(){var t=-1;for(o=new Array(i);++t<i;)o[t]=((t+1)*r-(t-i)*n)/(i+1);return l}return l.domain=function(t){return arguments.length?([n,r]=t,n=+n,r=+r,c()):[n,r]},l.range=function(t){return arguments.length?(i=(s=Array.from(t)).length-1,c()):s.slice()},l.invertExtent=function(t){var e=s.indexOf(t);return e<0?[NaN,NaN]:e<1?[n,o[0]]:e>=i?[o[i-1],r]:[o[e-1],o[e]]},l.unknown=function(t){return arguments.length?(e=t,l):l},l.thresholds=function(){return o.slice()},l.copy=function(){return t().domain([n,r]).range(s).unknown(e)},Zp.apply(pg(l),arguments)},scaleRadial:function t(){var e,n=fg(),r=[0,1],i=!1;function o(t){var r=function(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}(n(t));return isNaN(r)?e:i?Math.round(r):r}return o.invert=function(t){return n.invert(Ig(t))},o.domain=function(t){return arguments.length?(n.domain(t),o):n.domain()},o.range=function(t){return arguments.length?(n.range((r=Array.from(t,ig)).map(Ig)),o):r.slice()},o.rangeRound=function(t){return o.range(t).round(!0)},o.round=function(t){return arguments.length?(i=!!t,o):i},o.clamp=function(t){return arguments.length?(n.clamp(t),o):n.clamp()},o.unknown=function(t){return arguments.length?(e=t,o):e},o.copy=function(){return t(n.domain(),r).round(i).clamp(n.clamp()).unknown(e)},Zp.apply(o,arguments),pg(o)},scaleSequential:Im,scaleSequentialLog:function t(){var e=Eg(Om()).domain([1,10]);return e.copy=function(){return Nm(e,t()).base(e.base())},Jp.apply(e,arguments)},scaleSequentialPow:Lm,scaleSequentialQuantile:function e(){var n=[],r=ag;function i(t){if(null!=t&&!isNaN(t=+t))return r((a(n,t,1)-1)/(n.length-1))}return i.domain=function(e){if(!arguments.length)return n.slice();n=[];for(let t of e)null==t||isNaN(t=+t)||n.push(t);return n.sort(t),i},i.interpolator=function(t){return arguments.length?(r=t,i):r},i.range=function(){return n.map((t,e)=>r(e/(n.length-1)))},i.quantiles=function(t){return Array.from({length:t+1},(e,r)=>at(n,r/t))},i.copy=function(){return e(r).domain(n)},Jp.apply(i,arguments)},scaleSequentialSqrt:function(){return Lm.apply(null,arguments).exponent(.5)},scaleSequentialSymlog:function t(){var e=Cg(Om());return e.copy=function(){return Nm(e,t()).constant(e.constant())},Jp.apply(e,arguments)},scaleSqrt:function(){return Ng.apply(null,arguments).exponent(.5)},scaleSymlog:function t(){var e=Cg(hg());return e.copy=function(){return ug(e,t()).constant(e.constant())},Zp.apply(e,arguments)},scaleThreshold:function t(){var e,n=[.5],r=[0,1],i=1;function o(t){return null!=t&&t<=t?r[a(n,t,0,i)]:e}return o.domain=function(t){return arguments.length?(n=Array.from(t),i=Math.min(n.length,r.length-1),o):n.slice()},o.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(n.length,r.length-1),o):r.slice()},o.invertExtent=function(t){var e=r.indexOf(t);return[n[e-1],n[e]]},o.unknown=function(t){return arguments.length?(e=t,o):e},o.copy=function(){return t().domain(n).range(r).unknown(e)},Zp.apply(o,arguments)},scaleTime:Rm,scaleUtc:function(){return Zp.apply(Mm(W_,$_,Y_,F_,A_,i_,t_,Kg,qg,iy).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},scan:function(t,e){const n=pt(t,e);return n<0?void 0:n},schemeAccent:zm,schemeBlues:Bb,schemeBrBG:Km,schemeBuGn:pb,schemeBuPu:_b,schemeCategory10:Bm,schemeDark2:Fm,schemeGnBu:mb,schemeGreens:Fb,schemeGreys:jb,schemeObservable10:Gm,schemeOrRd:vb,schemeOranges:$b,schemePRGn:Jm,schemePaired:jm,schemePastel1:Um,schemePastel2:Ym,schemePiYG:tb,schemePuBu:Ab,schemePuBuGn:wb,schemePuOr:nb,schemePuRd:Sb,schemePurples:Yb,schemeRdBu:ib,schemeRdGy:ab,schemeRdPu:kb,schemeRdYlBu:lb,schemeRdYlGn:ub,schemeReds:qb,schemeSet1:Hm,schemeSet2:qm,schemeSet3:Wm,schemeSpectral:fb,schemeTableau10:$m,schemeYlGn:Nb,schemeYlGnBu:Rb,schemeYlOrBr:Lb,schemeYlOrRd:Vb,select:$e,selectAll:function(t){return"string"==typeof t?new qe([document.querySelectorAll(t)],[document.documentElement]):new qe([Yt(t)],He)},selection:We,selector:Ut,selectorAll:qt,shuffle:gt,shuffler:_t,some:function(t,e){if("function"!=typeof e)throw new TypeError("test is not a function");let n=-1;for(const r of t)if(e(r,++n,t))return!0;return!1},sort:B,stack:function(){var t=cv([]),e=fw,n=hw,r=dw;function i(i){var o,a,s=Array.from(t.apply(this,arguments),pw),l=s.length,c=-1;for(const t of i)for(o=0,++c;o<l;++o)(s[o][c]=[0,+r(t,s[o].key,c,i)]).data=t;for(o=0,a=Rv(e(s));o<l;++o)s[a[o]].index=o;return n(s,a),s}return i.keys=function(e){return arguments.length?(t="function"==typeof e?e:cv(Array.from(e)),i):t},i.value=function(t){return arguments.length?(r="function"==typeof t?t:cv(+t),i):r},i.order=function(t){return arguments.length?(e=null==t?fw:"function"==typeof t?t:cv(Array.from(t)),i):e},i.offset=function(t){return arguments.length?(n=null==t?hw:t,i):n},i},stackOffsetDiverging:function(t,e){if((s=t.length)>0)for(var n,r,i,o,a,s,l=0,c=t[e[0]].length;l<c;++l)for(o=a=0,n=0;n<s;++n)(i=(r=t[e[n]][l])[1]-r[0])>0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=a,r[0]=a+=i):(r[0]=0,r[1]=i)},stackOffsetExpand:function(t,e){if((r=t.length)>0){for(var n,r,i,o=0,a=t[0].length;o<a;++o){for(i=n=0;n<r;++n)i+=t[n][o][1]||0;if(i)for(n=0;n<r;++n)t[n][o][1]/=i}hw(t,e)}},stackOffsetNone:hw,stackOffsetSilhouette:function(t,e){if((n=t.length)>0){for(var n,r=0,i=t[e[0]],o=i.length;r<o;++r){for(var a=0,s=0;a<n;++a)s+=t[a][r][1]||0;i[r][1]+=i[r][0]=-s/2}hw(t,e)}},stackOffsetWiggle:function(t,e){if((i=t.length)>0&&(r=(n=t[e[0]]).length)>0){for(var n,r,i,o=0,a=1;a<r;++a){for(var s=0,l=0,c=0;s<i;++s){for(var u=t[e[s]],h=u[a][1]||0,f=(h-(u[a-1][1]||0))/2,d=0;d<s;++d){var p=t[e[d]];f+=(p[a][1]||0)-(p[a-1][1]||0)}l+=h,c+=f*h}n[a-1][1]+=n[a-1][0]=o,l&&(o-=c/l)}n[a-1][1]+=n[a-1][0]=o,hw(t,e)}},stackOrderAppearance:gw,stackOrderAscending:yw,stackOrderDescending:function(t){return yw(t).reverse()},stackOrderInsideOut:function(t){var e,n,r=t.length,i=t.map(mw),o=gw(t),a=0,s=0,l=[],c=[];for(e=0;e<r;++e)n=o[e],a<s?(a+=i[n],l.push(n)):(s+=i[n],c.push(n));return c.reverse().concat(l)},stackOrderNone:fw,stackOrderReverse:function(t){return fw(t).reverse()},stratify:function(){var t,e=fp,n=dp;function r(r){var i,o,a,s,l,c,u,h,f=Array.from(r),d=e,p=n,g=new Map;if(null!=t){const e=f.map((e,n)=>function(t){t=`${t}`;let e=t.length;gp(t,e-1)&&!gp(t,e-2)&&(t=t.slice(0,-1));return"/"===t[0]?t:`/${t}`}(t(e,n,r))),n=e.map(pp),i=new Set(e).add("");for(const t of n)i.has(t)||(i.add(t),e.push(t),n.push(pp(t)),f.push(hp));d=(t,n)=>e[n],p=(t,e)=>n[e]}for(a=0,i=f.length;a<i;++a)o=f[a],c=f[a]=new Vd(o),null!=(u=d(o,a,r))&&(u+="")&&(h=c.id=u,g.set(h,g.has(h)?up:c)),null!=(u=p(o,a,r))&&(u+="")&&(c.parent=u);for(a=0;a<i;++a)if(u=(c=f[a]).parent){if(!(l=g.get(u)))throw new Error("missing: "+u);if(l===up)throw new Error("ambiguous: "+u);l.children?l.children.push(c):l.children=[c],c.parent=l}else{if(s)throw new Error("multiple roots");s=c}if(!s)throw new Error("no root");if(null!=t){for(;s.data===hp&&1===s.children.length;)s=s.children[0],--i;for(let t=f.length-1;t>=0&&(c=f[t]).data===hp;--t)c.data=null}if(s.parent=cp,s.eachBefore(function(t){t.depth=t.parent.depth+1,--i}).eachBefore(Pd),s.parent=null,i>0)throw new Error("cycle");return s}return r.id=function(t){return arguments.length?(e=Dd(t),r):e},r.parentId=function(t){return arguments.length?(n=Dd(t),r):n},r.path=function(e){return arguments.length?(t=Dd(e),r):t},r},style:_e,subset:function(t,e){return xt(e,t)},sum:yt,superset:xt,svg:ul,symbol:function(t,e){let n=null,r=wv(i);function i(){let i;if(n||(n=i=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),i)return n=null,i+""||null}return t="function"==typeof t?t:cv(t||ox),e="function"==typeof e?e:cv(void 0===e?64:+e),i.type=function(e){return arguments.length?(t="function"==typeof e?e:cv(e),i):t},i.size=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),i):e},i.context=function(t){return arguments.length?(n=null==t?null:t,i):n},i},symbolAsterisk:ix,symbolCircle:ox,symbolCross:ax,symbolDiamond:cx,symbolDiamond2:ux,symbolPlus:hx,symbolSquare:fx,symbolSquare2:dx,symbolStar:yx,symbolTimes:Cx,symbolTriangle:bx,symbolTriangle2:xx,symbolWye:Sx,symbolX:Cx,symbols:kx,symbolsFill:kx,symbolsStroke:Mx,text:nl,thresholdFreedmanDiaconis:function(t,e,n){const r=g(t),i=at(t,.75)-at(t,.25);return r&&i?Math.ceil((n-e)/(2*i*Math.pow(r,-1/3))):1},thresholdScott:function(t,e,n){const r=g(t),i=v(t);return r&&i?Math.ceil((n-e)*Math.cbrt(r)/(3.49*i)):1},thresholdSturges:Z,tickFormat:dg,tickIncrement:$,tickStep:X,ticks:W,timeDay:n_,timeDays:r_,get timeFormat(){return ny},timeFormatDefaultLocale:Em,timeFormatLocale:ty,timeFriday:p_,timeFridays:x_,timeHour:Jg,timeHours:Qg,timeInterval:Vg,timeMillisecond:Dg,timeMilliseconds:Bg,timeMinute:$g,timeMinutes:Xg,timeMonday:u_,timeMondays:y_,timeMonth:B_,timeMonths:z_,get timeParse(){return ry},timeSaturday:g_,timeSaturdays:w_,timeSecond:qg,timeSeconds:Wg,timeSunday:c_,timeSundays:__,timeThursday:d_,timeThursdays:v_,timeTickInterval:K_,timeTicks:X_,timeTuesday:h_,timeTuesdays:m_,timeWednesday:f_,timeWednesdays:b_,timeWeek:c_,timeWeeks:__,timeYear:j_,timeYears:U_,timeout:Ri,timer:Ti,timerFlush:Si,transition:io,transpose:mt,tree:wp,treemap:Cp,treemapBinary:function(t,e,n,r,i){var o,a,s=t.children,l=s.length,c=new Array(l+1);for(c[0]=a=o=0;o<l;++o)c[o+1]=a+=s[o].value;!function t(e,n,r,i,o,a,l){if(e>=n-1){var u=s[e];return u.x0=i,u.y0=o,u.x1=a,void(u.y1=l)}var h=c[e],f=r/2+h,d=e+1,p=n-1;for(;d<p;){var g=d+p>>>1;c[g]<f?d=g+1:p=g}f-c[d-1]<c[d]-f&&e+1<d&&--d;var _=c[d]-h,y=r-_;if(a-i>l-o){var m=r?(i*y+a*_)/r:a;t(e,d,_,i,o,m,l),t(d,n,y,m,o,a,l)}else{var b=r?(o*y+l*_)/r:l;t(e,d,_,i,o,a,b),t(d,n,y,i,b,a,l)}}(0,l,t.value,e,n,r,i)},treemapDice:lp,treemapResquarify:kp,treemapSlice:Ep,treemapSliceDice:function(t,e,n,r,i){(1&t.depth?Ep:lp)(t,e,n,r,i)},treemapSquarify:Sp,tsv:ol,tsvFormat:qs,tsvFormatBody:Ws,tsvFormatRow:Xs,tsvFormatRows:$s,tsvFormatValue:Ks,tsvParse:Ys,tsvParseRows:Hs,union:function(...t){const e=new A;for(const n of t)for(const t of n)e.add(t);return e},unixDay:a_,unixDays:s_,utcDay:i_,utcDays:o_,get utcFormat(){return iy},utcFriday:M_,utcFridays:V_,utcHour:t_,utcHours:e_,utcMillisecond:Dg,utcMilliseconds:Bg,utcMinute:Kg,utcMinutes:Zg,utcMonday:T_,utcMondays:N_,utcMonth:F_,utcMonths:G_,get utcParse(){return oy},utcSaturday:R_,utcSaturdays:D_,utcSecond:qg,utcSeconds:Wg,utcSunday:A_,utcSundays:O_,utcThursday:k_,utcThursdays:P_,utcTickInterval:$_,utcTicks:W_,utcTuesday:S_,utcTuesdays:I_,utcWednesday:C_,utcWednesdays:L_,utcWeek:A_,utcWeeks:O_,utcYear:Y_,utcYears:H_,variance:b,window:fe,xml:ll,zip:function(){return mt(arguments)},zoom:function(){var t,e,n,r=Sw,i=Cw,o=Ow,a=Mw,s=Rw,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,h=ei,f=Nt("start","zoom","end"),d=0,p=10;function g(t){t.property("__zoom",kw).on("wheel.zoom",w,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",A).filter(s).on("touchstart.zoom",T).on("touchmove.zoom",S).on("touchend.zoom touchcancel.zoom",C).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function _(t,e){return(e=Math.max(l[0],Math.min(l[1],e)))===t.k?t:new xw(e,t.x,t.y)}function y(t,e,n){var r=e[0]-n[0]*t.k,i=e[1]-n[1]*t.k;return r===t.x&&i===t.y?t:new xw(t.k,r,i)}function m(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function b(t,e,n,r){t.on("start.zoom",function(){v(this,arguments).event(r).start()}).on("interrupt.zoom end.zoom",function(){v(this,arguments).event(r).end()}).tween("zoom",function(){var t=this,o=arguments,a=v(t,o).event(r),s=i.apply(t,o),l=null==n?m(s):"function"==typeof n?n.apply(t,o):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),u=t.__zoom,f="function"==typeof e?e.apply(t,o):e,d=h(u.invert(l).concat(c/u.k),f.invert(l).concat(c/f.k));return function(t){if(1===t)t=f;else{var e=d(t),n=c/e[2];t=new xw(n,l[0]-e[0]*n,l[1]-e[1]*n)}a.zoom(null,t)}})}function v(t,e,n){return!n&&t.__zooming||new x(t,e)}function x(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,e),this.taps=0}function w(t,...e){if(r.apply(this,arguments)){var n=v(this,e).event(t),i=this.__zoom,s=Math.max(l[0],Math.min(l[1],i.k*Math.pow(2,a.apply(this,arguments)))),u=Qe(t);if(n.wheel)n.mouse[0][0]===u[0]&&n.mouse[0][1]===u[1]||(n.mouse[1]=i.invert(n.mouse[0]=u)),clearTimeout(n.wheel);else{if(i.k===s)return;n.mouse=[u,i.invert(u)],Di(this),n.start()}Tw(t),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",o(y(_(i,s),n.mouse[0],n.mouse[1]),n.extent,c))}}function E(t,...e){if(!n&&r.apply(this,arguments)){var i=t.currentTarget,a=v(this,e,!0).event(t),s=$e(t.view).on("mousemove.zoom",function(t){if(Tw(t),!a.moved){var e=t.clientX-u,n=t.clientY-h;a.moved=e*e+n*n>d}a.event(t).zoom("mouse",o(y(a.that.__zoom,a.mouse[0]=Qe(t,i),a.mouse[1]),a.extent,c))},!0).on("mouseup.zoom",function(t){s.on("mousemove.zoom mouseup.zoom",null),an(t.view,a.moved),Tw(t),a.event(t).end()},!0),l=Qe(t,i),u=t.clientX,h=t.clientY;on(t.view),Aw(t),a.mouse=[l,this.__zoom.invert(l)],Di(this),a.start()}}function A(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,a=Qe(t.changedTouches?t.changedTouches[0]:t,this),s=n.invert(a),l=n.k*(t.shiftKey?.5:2),h=o(y(_(n,l),a,s),i.apply(this,e),c);Tw(t),u>0?$e(this).transition().duration(u).call(b,h,a,t):$e(this).call(g.transform,h,a,t)}}function T(n,...i){if(r.apply(this,arguments)){var o,a,s,l,c=n.touches,u=c.length,h=v(this,i,n.changedTouches.length===u).event(n);for(Aw(n),a=0;a<u;++a)l=[l=Qe(s=c[a],this),this.__zoom.invert(l),s.identifier],h.touch0?h.touch1||h.touch0[2]===l[2]||(h.touch1=l,h.taps=0):(h.touch0=l,o=!0,h.taps=1+!!t);t&&(t=clearTimeout(t)),o&&(h.taps<2&&(e=l[0],t=setTimeout(function(){t=null},500)),Di(this),h.start())}}function S(t,...e){if(this.__zooming){var n,r,i,a,s=v(this,e).event(t),l=t.changedTouches,u=l.length;for(Tw(t),n=0;n<u;++n)i=Qe(r=l[n],this),s.touch0&&s.touch0[2]===r.identifier?s.touch0[0]=i:s.touch1&&s.touch1[2]===r.identifier&&(s.touch1[0]=i);if(r=s.that.__zoom,s.touch1){var h=s.touch0[0],f=s.touch0[1],d=s.touch1[0],p=s.touch1[1],g=(g=d[0]-h[0])*g+(g=d[1]-h[1])*g,m=(m=p[0]-f[0])*m+(m=p[1]-f[1])*m;r=_(r,Math.sqrt(g/m)),i=[(h[0]+d[0])/2,(h[1]+d[1])/2],a=[(f[0]+p[0])/2,(f[1]+p[1])/2]}else{if(!s.touch0)return;i=s.touch0[0],a=s.touch0[1]}s.zoom("touch",o(y(r,i,a),s.extent,c))}}function C(t,...r){if(this.__zooming){var i,o,a=v(this,r).event(t),s=t.changedTouches,l=s.length;for(Aw(t),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),i=0;i<l;++i)o=s[i],a.touch0&&a.touch0[2]===o.identifier?delete a.touch0:a.touch1&&a.touch1[2]===o.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(o=Qe(o,this),Math.hypot(e[0]-o[0],e[1]-o[1])<p)){var c=$e(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return g.transform=function(t,e,n,r){var i=t.selection?t.selection():t;i.property("__zoom",kw),t!==i?b(t,e,n,r):i.interrupt().each(function(){v(this,arguments).event(r).start().zoom(null,"function"==typeof e?e.apply(this,arguments):e).end()})},g.scaleBy=function(t,e,n,r){g.scaleTo(t,function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)},n,r)},g.scaleTo=function(t,e,n,r){g.transform(t,function(){var t=i.apply(this,arguments),r=this.__zoom,a=null==n?m(t):"function"==typeof n?n.apply(this,arguments):n,s=r.invert(a),l="function"==typeof e?e.apply(this,arguments):e;return o(y(_(r,l),a,s),t,c)},n,r)},g.translateBy=function(t,e,n,r){g.transform(t,function(){return o(this.__zoom.translate("function"==typeof e?e.apply(this,arguments):e,"function"==typeof n?n.apply(this,arguments):n),i.apply(this,arguments),c)},null,r)},g.translateTo=function(t,e,n,r,a){g.transform(t,function(){var t=i.apply(this,arguments),a=this.__zoom,s=null==r?m(t):"function"==typeof r?r.apply(this,arguments):r;return o(ww.translate(s[0],s[1]).scale(a.k).translate("function"==typeof e?-e.apply(this,arguments):-e,"function"==typeof n?-n.apply(this,arguments):-n),t,c)},r,a)},x.prototype={event:function(t){return t&&(this.sourceEvent=t),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(t,e){return this.mouse&&"mouse"!==t&&(this.mouse[1]=e.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=e.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=e.invert(this.touch1[0])),this.that.__zoom=e,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){var e=$e(this.that).datum();f.call(t,this.that,new vw(t,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:f}),e)}},g.wheelDelta=function(t){return arguments.length?(a="function"==typeof t?t:bw(+t),g):a},g.filter=function(t){return arguments.length?(r="function"==typeof t?t:bw(!!t),g):r},g.touchable=function(t){return arguments.length?(s="function"==typeof t?t:bw(!!t),g):s},g.extent=function(t){return arguments.length?(i="function"==typeof t?t:bw([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),g):i},g.scaleExtent=function(t){return arguments.length?(l[0]=+t[0],l[1]=+t[1],g):[l[0],l[1]]},g.translateExtent=function(t){return arguments.length?(c[0][0]=+t[0][0],c[1][0]=+t[1][0],c[0][1]=+t[0][1],c[1][1]=+t[1][1],g):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},g.constrain=function(t){return arguments.length?(o=t,g):o},g.duration=function(t){return arguments.length?(u=+t,g):u},g.interpolate=function(t){return arguments.length?(h=t,g):h},g.on=function(){var t=f.on.apply(f,arguments);return t===f?g:t},g.clickDistance=function(t){return arguments.length?(d=(t=+t)*t,g):Math.sqrt(d)},g.tapDistance=function(t){return arguments.length?(p=+t,g):p},g},zoomIdentity:ww,zoomTransform:Ew});class Iw{constructor(t,e,n){this._id="predicate_"+uT(),this._type=t||Lw.POINT,this._variableType=e,this._variableName=n,this._value=void 0}get type(){return this._type}get value(){return this._value}set value(t){this._value=t}get id(){return this._id}get variableType(){return this._variableType}get variableName(){return this._variableName}}const Lw=Object.freeze({POINT:"point",INTERVAL:"interval",LIST:"list"});class Pw extends Iw{constructor(t,e,n){super(t,e,n)}testElement(t){let e;if("attribute"==this._variableType){if(!t.dataScope)return!1;e=t.dataScope.getAttrVal(this._variableName)}else e=t[this._variableName];return this._value[0]<=e&&this._value[1]>=e}testTuple(t){if("attribute"==this._variableType){let e=t[this._variableName];return this._value[0]<=e&&this._value[1]>=e}return!1}}class Vw extends Iw{constructor(t,e,n){super(t,e,n)}addValue(t){this._value||(this._value=[]),this._value.push(t)}resetValue(){this._value=void 0}testElement(t){if("attribute"==this._variableType){if(!t.dataScope)return!1;let e=t.dataScope.getAttributeValues(this._variableName);return 1===e.length&&this._value.indexOf(e[0])>=0}return this._value.indexOf(t[this._variableName])>=0}testTuple(t){if("attribute"==this._variableType){let e=t[this._variableName];return this._value.indexOf(e)>=0}return!1}}class Dw extends Iw{constructor(t,e,n){super(t,e,n)}testElement(t){if("attribute"==this._variableType){if(!t.dataScope)return!1;return t.dataScope.getAttrVal(this._variableName)==this._value}return t[this._variableName]==this._value}testTuple(t){if("attribute"==this._variableType){let e=t[this._variableName];return this._value===e}return!1}equals(t){return this.type===t.type&&this.variableName===t.variableName&&this.value===t.value}}function Bw(t){let e,n="attribute"in t?"attribute":"property",r=t[n];switch(t.type){case Lw.LIST:e=new Vw(t.type,n,r);break;case Lw.INTERVAL:e=new Pw(t.type,n,r);break;case Lw.POINT:default:e=new Dw(t.type,n,r)}return e.value=t.value,e}function zw(t,e){for(let n of e)if(!n.testElement(t))return!1;return!0}const Fw={svg:void 0,getSVG:function(){return window?(void 0===this.svg&&(this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.style.visibility="hidden",this.svg.style.pointerEvents="none",this.svg.setAttribute("aria-hidden","true"),document.body.appendChild(this.svg)),this.svg):null}};function Gw(t,e,n,r,i){const o=i*Math.PI/180,a=t-n,s=e-r;return{x:a*Math.cos(o)-s*Math.sin(o)+n,y:a*Math.sin(o)+s*Math.cos(o)+r}}function jw(t,e,n,r){return Math.sqrt(Math.pow(t-n,2)+Math.pow(e-r,2))}const Uw=Object.freeze({fillColor:"fill",strokeColor:"stroke",strokeWidth:"stroke-width",fillOpacity:"fill-opacity",strokeOpacity:"stroke-opacity",strokeDash:"stroke-dasharray",opacity:"opacity",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",visibility:"visibility",cursor:"cursor"});class Yw{constructor(t,e,n,r){this._x=t+n/2,this._y=e+r/2,this._width=n,this._height=r}translate(t,e){this._x+=t,this._y+=e}toJSON(){let t={};return t.x=this._x,t.y=this._y,t.width=this._width,t.height=this._height,t}union(t){let e=Math.min(this.left,t.left),n=Math.min(this.top,t.top),r=Math.max(this.right,t.right),i=Math.max(this.bottom,t.bottom);return new Yw(e,n,r-e,i-n)}clone(){return new Yw(this.left,this.top,this._width,this._height)}get left(){return this._x-this._width/2}set left(t){this._x=t+this._width/2}get right(){return this._x+this._width/2}set right(t){this._x=t-this._width/2}get top(){return this._y-this._height/2}set top(t){this._y=t+this._height/2}get bottom(){return this._y+this._height/2}set bottom(t){this._y=t-this._height/2}get x(){return this._x}get y(){return this._y}get center(){return this.x}get middle(){return this.y}get width(){return this._width}setWidth(t,e){switch(e){case Xw.RIGHT:this._x=this.right-t/2;break;case Xw.CENTER:this._width=2*t;break;default:this._x=this.left+t/2}this._width=t}get height(){return this._height}setHeight(t,e){switch(e){case Xw.TOP:this._y=this.top+t/2;break;case Xw.MIDDLE:this._height=2*t;break;default:this._y=this.bottom-t/2}this._height=t}contains(t,e){return this.left<=t&&this.right>=t&&this.top<=e&&this.bottom>=e}intersects(t){return!(this.right<t.left||this.bottom<t.top||this.left>t.right||this.top>t.bottom)}}function Hw(t){let e=t[0].clone();for(let n=1;n<t.length;n++)e=e.union(t[n]);return e}function qw(t){return Hw(("vertex"==t[0].type||"segment"==t[0].type?t.map(t=>t.parent):t).map(t=>t.refBounds?t.refBounds:t.bounds))}function Ww(t){return Hw(("vertex"==t[0].type||"segment"==t[0].type?t.map(t=>t.parent):t).map(t=>t.bounds))}function $w(t){let e=Qw(t);for(let t of e)t._updateBounds();let n=[];for(let t of e)t.parent&&!n.includes(t.parent)&&n.push(t.parent);for(let t of n)$w(t)}const Xw=Object.freeze({TOP:"top",LEFT:"left",RIGHT:"right",BOTTOM:"bottom",CENTER:"center",MIDDLE:"middle"});class Kw{constructor(t){if(this._dataScope=void 0,this._type="type"in t?t.type:lT.Mark,this._id=t.id?t.id:this._type+"_"+uT(),this._classId=void 0,this._bounds=void 0,this._rotate=void 0,this._refBounds=void 0,this._dirty=!0,this._clipMask=void 0,this._cursor=void 0,this._styles={},void 0!==t)for(let e in Uw)e in t&&(this.styles[e]=t[e])}get scene(){return aE(this)}set strokeColor(t){this.styles.strokeColor=t,this._dirty=!0}get strokeColor(){return this.styles.strokeColor}set strokeWidth(t){this.styles.strokeWidth=t,this._dirty=!0}get strokeWidth(){return this.styles.strokeWidth}set strokeDash(t){this.styles.strokeDash=t,this._dirty=!0}get strokeDash(){return this.styles.strokeDash}set fillColor(t){this.styles.fillColor=t,this._dirty=!0}get fillColor(){return this.styles.fillColor}get rotation(){return this._rotate}get cursor(){return this._cursor}get id(){return this._id}set id(t){this.getScene()?(delete this.getScene()._itemMap[this._id],this._id=t,this.getScene()._itemMap[t]=this):this._id=t}get classId(){return this._classId?this._classId:this._id}set classId(t){this._classId=t}get type(){return this._type}get bounds(){return this._bounds||this._updateBounds(),this._bounds}get refBounds(){return this._refBounds?this._refBounds:this.bounds}set dataScope(t){this._dataScope=t}get dataScope(){return this._dataScope}get styles(){return this._styles}set styles(t){this._styles=t,this._dirty=!0}set visibility(t){this.styles.visibility=t,this._dirty=!0}get visibility(){return this.styles.visibility?this.styles.visibility:"visible"}get opacity(){return"opacity"in this.styles?this.styles.opacity:1}set opacity(t){this.styles.opacity=t,this._dirty=!0}copyPropertiesTo(t){t.styles=Object.assign({},this.styles),this._dataScope&&(t._dataScope=this._dataScope.clone())}createClipMask(){let t=this._bounds;this._clipMask=new Yw(t.left,t.top,t.width,t.height)}get clipMask(){return this._clipMask}}function Zw(t){return t instanceof Kw&&t.type!==lT.Gridlines}const Jw=Object.freeze({Area:"area",Rect:"rect",Ellipse:"ellipse",Circle:"circle",Pie:"pie",Ring:"ring",Arc:"arc",Line:"line",Path:"path",Image:"image",SimpleText:"text",RichText:"richText",Polygon:"polygon",BezierCurve:"bezierCurve"});function Qw(t,e){let n=aE(t);if("vertex"===t.type||"segment"===t.type)return function(t,e){let n=aE(t),r=e||n;if("vertex"===t.type){return tE(t,nE(r,[{property:"classId",value:t.parent.classId}]))}if("segment"===t.type){return eE(t,nE(r,[{property:"classId",value:t.parent.classId}]))}return t.classId?nE(r,[{property:"classId",value:t.classId}]):[t]}(t,e);if(!t.classId)return[t];if(t.classId&&n._peerIndex.has(t.classId)){let r=n._peerIndex.get(t.classId);return e?r.filter(t=>function(t,e){let n=t.parent;for(;n;){if(n===e)return!0;n=n.parent}return!1}(t,e)):r}return[t]}function tE(t,e){if(!t.classId){if(t.dataScope){let n=t.parent;if(!n)throw new Error("vertex has no parent mark");let r=[];if(n.type===lT.Area){let i=n.vertices.indexOf(t)<n.vertices.length/2;for(let t of e){let e=i?t.vertices.slice(0,t.vertices.length/2):t.vertices.slice(t.vertices.length/2);r=r.concat(e.filter(t=>t.dataScope))}}else for(let t of e)r=r.concat(t.vertices.filter(t=>t.dataScope));return r}{let n=t.parent;if(!n)throw new Error("vertex has no parent mark");let r=n.vertices.indexOf(t),i=[];for(let t of e)i.push(t.vertices[r]);return i}}}function eE(t,e){if(t.dataScope){if(!t.parent)throw new Error("segment has no parent mark");let n=[];for(let t of e)n=n.concat(t.segments);return n}{let n=t.parent;if(!n)throw new Error("segment has no parent mark");let r=n.segments.indexOf(t),i=[];for(let t of e)i.push(t.segments[r]);return i}}function nE(t,e){let n=[];return oE(t,e?e.map(t=>Bw(t)):[],n),n}function rE(t,e){let n=t.children.filter(t=>t.type==lT.Collection);if(0!==n.length)for(let t of n){let n=t;for(;n&&n.dataScope;){if(n.dataScope.hasAttribute(e))return n;n=n.children?n.children[0]:void 0}}}function iE(t){return t.type==lT.Collection?t:t.parent?iE(t.parent):void 0}function oE(t,e,n){if(t)if(zw(t,e)&&n.push(t),t.vertices)for(let r of t.vertices.concat(t.segments))zw(r,e)&&n.push(r);else if(t.children&&t.children.length>0)for(let r of t.children)oE(r,e,n)}function aE(t){let e=t;for(;e;){if(e.type==lT.Scene)return e;e=e.parent}}function sE(t){let e=t;for("vertex"!=e.type&&"segment"!=e.type||(e=e.parent);e.parent&&[lT.Collection,lT.Glyph].includes(e.parent.type);)e=e.parent;return e}function lE(t,e){let n=[];if(cE(t,n),e){let t={};for(let e of n)t[e.classId]=e;return Object.values(t)}return n}function cE(t,e){if(Zw(t))e.push(t);else if(t.children&&!Object.values(cT).includes(t.type))for(let n of t.children)cE(n,e)}function uE(t,e){if(t){if(e(t),t.vertices)for(let n of t.vertices)e(n);if(t.segments)for(let n of t.segments)e(n);if(t.children&&t.children.length>0)for(let n of t.children)uE(n,e)}}class hE{constructor(){this._refElements=[]}addRefElement(t){this._refElements.push(t)}get refElements(){return this._refElements}clearRefElements(){this._refElements=[]}}const fE=Object.freeze({GRID:"grid",STACK:"stack",PACKING:"packing",FORCE:"force",DIRECTED:"directedgraph",TIDYTREE:"tidytree",TREEMAP:"treemap",STRATA:"strata",CIRCULAR:"circular",CLUSTER:"cluster"});function dE(t,e){return!!(t.startsWith("h")&&[Xw.LEFT,Xw.CENTER,Xw.RIGHT].indexOf(e)>=0)||(!!(t.startsWith("v")&&[Xw.TOP,Xw.MIDDLE,Xw.BOTTOM].indexOf(e)>=0)||(console.warn("Invalid alignment:",e),!1))}class pE{constructor(t){this._id=t+"_"+uT(),this._type=t,this._inputVars=[],this._outputVars=[]}run(){}get id(){return this._id}get type(){return this._type}get inputVars(){return this._inputVars}get outputVars(){return this._outputVars}get outputVar(){return this._outputVars[0]}isIsolated(){return 0==this._inputVars.length&&0==this._outputVars.length}}const gE=Object.freeze({CONDUIT:"conduit",ENCODER:"encoder",LAYOUT:"layout",LINK_PLACER:"linkRouter",CONSTRAINT:"constraint",EVAL_BBOX:"evalBBox",EVAL_REFBOUNDS:"evalRefBounds",AFFIXER:"affixer",ALIGNER:"aligner",DATA_EXTRACTOR:"dataExtractor",SCALE_BUILDER:"scaleBuilder",AXIS_PATH_PLACER:"axisPathPlacer",AXIS_TICKS_PLACER:"axisTicksPlacer",AXIS_LABELS_PLACER:"axisLabelsPlacer",AXIS_TITLE_PLACER:"axisTitlePlacer",GRIDLINES_PLACER:"gridlinesPlacer",GRID_LAYOUT:"gridLayout",STACK_LAYOUT:"stackLayout",PACK_LAYOUT:"packLayout",FORCE_LAYOUT:"forceLayout",DIRECTED_LAYOUT:"directedLayout",TIDY_TREE_LAYOUT:"tidyTreeLayout",TREEMAP_LAYOUT:"treemapLayout",STRATA_LAYOUT:"strataLayout",CIRCULAR_LAYOUT:"circularLayout",CLUSTER_LAYOUT:"clusterLayout",BIN_TRANSFORMER:"binTransformer",FILTER_TRANSFORMER:"filterTransformer",KDE_TRANSFORMER:"kdeTransformer",TARGET_EVALUATOR:"targetEvaluator",TARGET_UPDATER:"targetUpdater"});class _E{constructor(t){let e=t||{};this._stops=[],this.type=lT.LinearGradient,this.id=this.type+uT(),this.x1="x1"in e?e.x1:0,this.x2="x2"in e?e.x2:100,this.y1="y1"in e?e.y1:0,this.y2="y2"in e?e.y2:0}toJSON(){let t={};return t.type=this.type,t.id=this.id,t.x1=this.x1,t.x2=this.x2,t.y1=this.y1,t.y2=this.y2,t.stops=this._stops,t}addStop(t,e,n){this._stops.push({offset:t,color:e,opacity:n})}get stops(){return this._stops}}const yE=Object.freeze({RowFirst:"rowFirst",ColumnFirst:"columnFirst"}),mE=Object.freeze({TopLeft:"topLeft",TopRight:"topRight",BottomLeft:"bottomLeft",BottomRight:"bottomRight"}),bE="horizontal",vE="vertical",xE="angular",wE="radial",EE={Left2Right:"l2r",Right2Left:"r2l",Top2Bottom:"t2b",Bottom2Top:"b2t"},AE=Object.freeze({CLOCKWISE:"clockwise",ANTI_CLOCKWISE:"anti-clockwise"}),TE=Object.freeze({INWARD:"inward",OUTWARD:"outward"});class SE{constructor(t,e,n,r){this.type="vertex",this._id=r,this._x=t,this._y=e,this._dataScope=void 0,this.parent=n,this.shape=void 0,this.width=0,this.height=0,this.radius=0,this.fillColor="#555",this.opacity=1,this.strokeWidth=0,this.strokeColor="#aaa",this._polarAngle=void 0}get dataScope(){return this._dataScope}set dataScope(t){this._dataScope=t}get bounds(){switch(this.shape){case"rect":return new Yw(this.x-this.width/2,this.y-this.height/2,this.width,this.height);case"circle":return new Yw(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius);default:return new Yw(this.x-.5,this.y-.5,1,1)}}get id(){return this.parent.id+"_v_"+this._id}_clone(t){let e=new SE(this.x,this.y,t,this._id);return this._dataScope&&(e._dataScope=this._dataScope.clone()),e.shape=this.shape,e.width=this.width,e.height=this.height,e.radius=this.radius,e.fillColor=this.fillColor,e.opacity=this.opacity,e.strokeWidth=this.strokeWidth,e.strokeColor=this.strokeColor,e}get polarAngle(){return this._polarAngle}get scene(){return this.parent.scene}get x(){return this._x}get y(){return this._y}}SE.styles=["vxShape","vxWidth","vxHeight","vxRadius","vxFillColor","vxStrokeColor","vxStrokeWidth","vxOpacity"];class CE{constructor(t,e,n,r){this.type="segment",this._id=r,this.vertex1=t,this.vertex2=e,this.dataScope=void 0,this.parent=n}get id(){return this.parent.id+"_s_"+this._id}get x(){return(this.vertex1.x+this.vertex2.x)/2}get y(){return(this.vertex1.y+this.vertex2.y)/2}get scene(){return this.parent.scene}}class kE extends Kw{constructor(t){super(t),this._type="type"in t?t.type:lT.Path,this.vertices=[],this.vertexCounter=0,this._sortBy={},this.segmentCounter=0,this.segments=[],this.anchor=void 0,this.closed=!1,this.curveMode="linear",this._vxShape=void 0,this._vxWidth=0,this._vxHeight=0,this._vxRadius=0,this._vxFillColor="#555555",this._vxStrokeColor="#aaaaaa",this._vxStrokeWidth=0,this._vxOpacity=1;for(let e of SE.styles)e in t&&(this["_"+e]=t[e]);"vertices"in t&&this._setVertices(t.vertices),this._sourceAnchor="sourceAnchor"in t?t.sourceAnchor:["center","middle"],this._targetAnchor="targetAnchor"in t?t.targetAnchor:["center","middle"],this._sourceOffset="sourceOffset"in t?t.sourceOffset:[0,0],this._targetOffset="targetOffset"in t?t.targetOffset:[0,0],this._strength="strength"in t?t.strength:.85,"strokeColor"in this.styles||(this.styles.strokeColor="#ccc"),"fillColor"in this.styles||(this.styles.fillColor="none"),"strokeWidth"in this.styles||(this.styles.strokeWidth=1),"strokeDash"in this.styles||(this.styles.strokeDash="none")}_setVertices(t){let e;this.vertices=[],this.segments=[],this.vertexCounter=0,this.segmentCounter=0;for(let n=0;n<t.length;n++)if(n!=t.length-1||t[n][0]!==t[0][0]||t[n][1]!==t[0][1]||this.type!==lT.Path){e=new SE(t[n][0],t[n][1],this,this.vertexCounter++);for(let t of SE.styles)if(this[t]){let n=t.replace("vx","");e[n[0].toLowerCase()+n.slice(1)]=this[t]}this.vertices.push(e),n>0&&this.segments.push(new CE(this.vertices[n-1],this.vertices[n],this,this.segmentCounter++))}let n=t[0],r=t[t.length-1];(n[0]===r[0]&&n[1]===r[1]||this.type===lT.Rect)&&(this.closed=!0,"fillColor"in this.styles||(this.styles.fillColor="#fff"),this.segments.push(new CE(this.vertices[this.vertices.length-1],this.vertices[0],this,this.segmentCounter++))),this._dirty=!0}copyPropertiesTo(t){t.attrs=Object.assign({},this.attrs),t.styles=Object.assign({},this.styles);for(let e of SE.styles)this["_"+e]&&(t["_"+e]=this["_"+e]);this._dataScope&&(t._dataScope=this._dataScope.clone()),t.closed=this.closed,t.curveMode=this.curveMode,t.vertices=[],t.segments=[];for(let e of this.vertices)t.vertices.push(e._clone(t));t.segmentCounter=0;for(let e=1;e<t.vertices.length;e++)t.segments.push(new CE(t.vertices[e-1],t.vertices[e],t,t.segmentCounter++));t.closed&&t.segments.push(new CE(t.vertices[t.vertices.length-1],t.vertices[0],t,t.segmentCounter++)),t._sourceAnchor=this._sourceAnchor.slice(),t._targetAnchor=this._targetAnchor.slice(),t._sourceOffset=this._sourceOffset.slice(),t._targetOffset=this._targetOffset.slice(),t._beta=this._beta}get bounds(){return this._bounds||this._updateBounds(),this._bounds}get x(){return this.bounds.x}get y(){return this.bounds.y}get strokeColor(){return this.styles.strokeColor}get strokeWidth(){return this.styles.strokeWidth}get strokeDash(){return this.styles.strokeDash}set strokeDash(t){this.styles.strokeDash=t,this._dirty=!0}resize(t,e,n,r){let i=this.bounds,o=0===i.width?1:i.width,a=0===i.height?1:i.height;if("right"===n)for(let e of this.vertices)e._x=i.right-t/o*(i.right-e.x);else for(let e of this.vertices)e._x=i.left+t/o*(e.x-i.left);if("top"===r)for(let t of this.vertices)t._y=i.top+e/a*(t.y-i.top);else for(let t of this.vertices)t._y=i.bottom-e/a*(i.bottom-t.y);this._updateBounds(),this._dirty=!0}_updateBounds(){let t=[],e=[];if(this._d){const n=this._d.match(/[a-zA-Z][^a-zA-Z]*/g),r=" ";n.forEach(n=>{let i=n.slice(1).trim().split(r).map(Number);for(let[n,r]of i.entries())n%2==0?t.push(r):e.push(r)})}else t=this.vertices.map(t=>t.x),e=this.vertices.map(t=>t.y);let n=Math.min(...t),r=Math.min(...e),i=Math.max(...t),o=Math.max(...e),a=i-n,s=o-r;if(this._bounds=new Yw(n,r,a,s),this.type===lT.Line||this.type===lT.Path){let t=this.styles.strokeWidth?this.styles.strokeWidth:1;n===i?this._bounds=new Yw(n-t/2,r,i-n+t,o-r):r===o&&(this._bounds=new Yw(n,r-t/2,i-n,o-r+t))}}addVertex(t,e,n){let r=new SE(t,e,this,this.vertexCounter++);this.vertices.splice(n,0,r)}sortVertices(t,e){this.vertices.sort((e,n)=>e[t]-n[t]),e&&this.vertices.reverse();for(let t=0;t<this.segments.length;t++){let e=this.segments[t];e.vertex1=this.vertices[t],e.vertex2=this.vertices[(t+1)%this.vertices.length]}this._dirty=!0}sortVerticesByData(t,e,n){let r;r=n?(e,r)=>n.indexOf(e.dataScope.getValue(t))-n.indexOf(r.dataScope.getAttrVal(t)):(e,n)=>e.dataScope.getAttrVal(t)<n.dataScope.getAttrVal(t)?-1:1,this.vertices.sort(r),e&&this.vertices.reverse();for(let t=0;t<this.segments.length;t++){let e=this.segments[t];e.vertex1=this.vertices[t],e.vertex2=this.vertices[(t+1)%this.vertices.length]}this._dirty=!0}getSVGPathData(){if(this._d)return this._d;let t=Sa(),e=this._getD3CurveFunction(this.curveMode)(t);e.lineStart();for(let t of this.vertices)e.point(t.x,t.y);return this.closed&&e.point(this.vertices[0].x,this.vertices[0].y),e.lineEnd(),t._}get firstVertex(){return this.vertices[0]}get firstSegment(){return this.segments[0]}get lastVertex(){return this.vertices[this.vertices.length-1]}get lastSegment(){return this.segments[this.segments.length-1]}_getD3CurveFunction(t){switch(t){case OE.Natural:return lw;case OE.Basis:return Ix;case OE.BumpX:return $v;case OE.BumpY:return Xv;case OE.Linear:return Nv;case OE.Step:return uw;case OE.CatmullRom:return Wx;case OE.Cardinal:return Fx;case OE.Bundle:return Dx.beta(.5);default:return Nv}}get vxShape(){return this._vxShape}get vxWidth(){return this._vxWidth}get vxHeight(){return this._vxHeight}get vxRadius(){return this._vxRadius}get vxFillColor(){return this._vxFillColor}get vxStrokeColor(){return this._vxStrokeColor}get vxStrokeWidth(){return this._vxStrokeWidth}get vxOpacity(){return this._vxOpacity}get sourceAnchor(){return this._sourceAnchor}get targetAnchor(){return this._targetAnchor}get sourceOffset(){return this._sourceOffset}get targetOffset(){return this._targetOffset}}function ME(t,e){const n=Fw.getSVG();let r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d",t.getSVGPathData()),n.appendChild(r);let i=r.getTotalLength();return r.getPointAtLength(i*e)}function RE(t){return t instanceof kE&&t.source&&t.target}const OE={Natural:"natural",Basis:"basis",BumpX:"bumpX",BumpY:"bumpY",Bundle:"bundle",Linear:"linear",Step:"step",CatmullRom:"CatmullRom",Cardinal:"cardinal"};function NE(t,e,n){const r=t.match(/[a-zA-Z][^a-zA-Z]*/g),i=",",o=r.map(t=>{const r=t[0],o=t.slice(1).trim();if("M"===r||"L"===r||"T"===r){const[t,a]=o.split(i).map(Number);return`${r}${t+e} ${a+n}`}if("C"===r){const t=o.split(i).map(Number);return`${r}${t[0]+e} ${t[1]+n} ${t[2]+e} ${t[3]+n} ${t[4]+e} ${t[5]+n}`}if("Q"===r){const t=o.split(i).map(Number);return`${r}${t[0]+e} ${t[1]+n} ${t[2]+e} ${t[3]+n}`}if("A"===r){const t=o.split(i).map(Number);return`${r}${t[0]} ${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]+e} ${t[6]+n}`}return"Z"===r||"z"===r?r:t});return o.join(" ")}class IE extends kE{constructor(t){super(t),this._type=lT.Arc,this.closed=!0,this._x="x"in t?t.x:100,this._y="y"in t?t.y:100,this._innerRadius="innerRadius"in t?t.innerRadius:100,this._outerRadius="outerRadius"in t?t.outerRadius:200,this._thickness="thickness"in t?t.thickness:this._outerRadius-this._innerRadius,this._startAngle="startAngle"in t?t.startAngle:0,this._endAngle="endAngle"in t?t.endAngle:90,this._sr=LE(this._startAngle),this._er=LE(this._endAngle),this._direction="direction"in t?t.direction:AE.ANTI_CLOCKWISE;let e=this._x+this._innerRadius*Math.cos(this._sr),n=this._y-this._innerRadius*Math.sin(this._sr),r=this._x+this._innerRadius*Math.cos(this._er),i=this._y-this._innerRadius*Math.sin(this._er),o=this._x+this._outerRadius*Math.cos(this._sr),a=this._y-this._outerRadius*Math.sin(this._sr),s=this._x+this._outerRadius*Math.cos(this._er),l=this._y-this._outerRadius*Math.sin(this._er);this._setVertices([[e,n],[o,a],[s,l],[r,i]])}get type(){return 0===this._innerRadius?lT.Pie:lT.Arc}get innerRadius(){return this._innerRadius}get outerRadius(){return this._outerRadius}get thickness(){return this._outerRadius-this._innerRadius}get direction(){return this._direction}get x(){return this._x}get y(){return this._y}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}get angle(){return this._endAngle<this._startAngle?this._endAngle+360-this._startAngle:this._endAngle-this._startAngle}setAngles(t,e){this._startAngle=t,this._endAngle=e,this._sr=LE(this._startAngle),this._er=LE(this._endAngle),this.vertices[0]._x=this._x+this._innerRadius*Math.cos(this._sr),this.vertices[0]._y=this._y-this._innerRadius*Math.sin(this._sr),this.vertices[1]._x=this._x+this._outerRadius*Math.cos(this._sr),this.vertices[1]._y=this._y-this._outerRadius*Math.sin(this._sr),this.vertices[2]._x=this._x+this._outerRadius*Math.cos(this._er),this.vertices[2]._y=this._y-this._outerRadius*Math.sin(this._er),this.vertices[3]._x=this._x+this._innerRadius*Math.cos(this._er),this.vertices[3]._y=this._y-this._innerRadius*Math.sin(this._er),this._dirty=!0}_updateBounds(){let t=this.vertices.map(t=>t.x),e=this.vertices.map(t=>t.y),n=Math.min(...t),r=Math.min(...e),i=Math.max(...t)-n,o=Math.max(...e)-r;this._bounds=new Yw(n,r,i,o)}copyPropertiesTo(t){super.copyPropertiesTo(t),t._x=this._x,t._y=this._y,t._innerRadius=this._innerRadius,t._outerRadius=this._outerRadius,t._startAngle=this._startAngle,t._endAngle=this._endAngle,t._thickness=this._thickness,t._direction=this._direction,t._sr=this._sr,t._er=this._er}getSVGPathData(){let t=this._endAngle<this._startAngle?this._endAngle+360-this._startAngle:this._endAngle-this._startAngle,e=t>180?1:0;return["M "+this.vertices[0].x+", "+this.vertices[0].y,"L "+this.vertices[1].x+", "+this.vertices[1].y,"A "+[this._outerRadius,this._outerRadius,t,e,0,this.vertices[2].x,this.vertices[2].y].join(" "),"L "+this.vertices[3].x+", "+this.vertices[3].y,"A "+[this._innerRadius,this._innerRadius,t,e,1,this.vertices[0].x,this.vertices[0].y].join(" ")].join(" ")}}function LE(t){return t*Math.PI/180}function PE(t){return 180*t/Math.PI}function VE(t){return(t%360+360)%360}function DE(t,e,n,r){let i=t-n,o=r-e;return Math.atan2(o,i)*(180/Math.PI)}class BE{constructor(t){this._attr2value={},this._dt=t,this._tuples=this._dt.data}isFullTable(){return 0===Object.keys(this._attr2value).length}isEmpty(){return 0==this._tuples.length}get numTuples(){return this._tuples.length}get attributes(){return Object.keys(this._attr2value)}get dataTable(){return this._dt}get filters(){return this._attr2value}merge(t){let e=new BE(this._dt);for(let t in this._attr2value)e=e.cross(t,this._attr2value[t]);for(let n in t._attr2value)e=e.cross(n,t._attr2value[n]);return e}cross(t,e){if(t in this._attr2value&&this._attr2value[t]!==e)return console.warn("Conflict in attribute values when merging dataScope:",t,this._attr2value[t],e),this;let n=this.clone();return n._attr2value[t]=e,n._updateTuples(t,e),n}derive(t){let e=Object.assign({},this._attr2value);for(let n in t)e[n]=t[n];let n=new BE(this._dt);for(let t in e)n._attr2value[t]=e[t],n._updateTuples(t,e[t]);return n}clone(){let t=new BE(this._dt);return t._attr2value=Object.assign({},this._attr2value),t._tuples=this._tuples.map(t=>t),t}getAttrVal(t){let e=this.getAttributeValues(t);return e.length,e[0]}getAttributeValues(t){let e=this._tuples.map(e=>e[t]);return e=[...new Set(e)],e}getUniqueAttributeValues(t){let e=this._tuples.map(e=>e[t]);return[...new Set(e)]}hasAttribute(t){return t in this._attr2value}getAttributeType(t){return this._dt.getAttributeType(t)}aggregateNumericalAttribute(t,e){let n=this._tuples.map(e=>e[t]);switch(e){case FE.Max:return Math.max(...n);case FE.Min:return Math.min(...n);case FE.Avg:case FE.Mean:return ct(n);case FE.Median:return ut(n);case FE.Count:return n.length;case FE.Percentile25:return at(n,.25);case FE.Percentile75:return at(n,.75);case FE.Sum:default:return yt(n)}}_updateTuples(t,e){this._tuples=this._tuples.filter(n=>n[t]==e)}get tuples(){return this._tuples}}function zE(t){return"vertex"==t.type||"segment"==t.type?t.dataScope?t.dataScope:t.parent.dataScope:t.dataScope}const FE={Max:"max",Min:"min",Avg:"avg",Median:"median",Sum:"sum",Count:"count",Mean:"mean",Percentile25:"percentile 25",Percentile75:"percentile 75"};class GE{constructor(t,e){this._id=lT.TreeData+uT(),this.initialize(t,e)}initialize(t,e){this.url=e,this._data=t,this._nodeList=[],this._linkList=[],this._nodeHash={},this._traverse(t,this._nodeList,this._linkList),this._nodeTable=new hT(this._nodeList,"nodes"),this._linkTable=new hT(this._linkList,"links"),this._nodeTable.tree=this,this._linkTable.tree=this}get nodeTable(){return this._nodeTable}get linkTable(){return this._linkTable}_traverse(t,e,n,r=0){let i={};qE in t||(t[qE]="n"+e.length),e.push(i),t._depth=r;for(let o in t)if("children"==o&&t[o]&&t[o].length>0)for(let i of t[o]){let o=this._traverse(i,e,n,r+1);n.push({parent:t[qE],child:o})}else i[o]=t[o];return this._nodeHash[i[qE]]=i,i[qE]}getNodeDataScope(t){return new BE(this._nodeTable).cross(dT,t[dT])}getNode(t){return this._nodeHash[t]}getRoot(){return this._nodeTable.data[0]}getChildren(t){let e=t[qE],n=[],r=this._linkTable.data,i=this._nodeTable.data;for(let t in r)if(r[t].parent==e){let e=r[t].child,o=i.findIndex(t=>t[qE]==e);n.push(i[o])}return n}getParent(t){let e=t[qE],n=this._linkTable.data,r=this._nodeTable.data;for(let t in n)if(n[t].child==e){let e=n[t].parent,i=r.findIndex(t=>t[qE]==e);return r[i]}}}function jE(t){return t.dataScope._dt.tree}class UE{constructor(t,e){this._id=lT.NetworkData+uT(),this.initialize(t,e)}initialize(t,e){this.url=e,this._nodeTable=new hT(t.nodes,this._id+"_nodes"),this._linkTable=new hT(t.links,this._id+"_links"),this._nodeTable.graph=this,this._linkTable.graph=this,this._rawNodes=t.nodes,this._rawLinks=t.links,this._nodeHash={};for(let e of t.nodes)this._nodeHash[e[qE]]=e}get nodeTable(){return this._nodeTable}get linkTable(){return this._linkTable}get nodeList(){return this._rawNodes}get linkList(){return this._rawLinks}getNode(t){return this._nodeHash[t]}getLinks(t){let e=t[qE],n=this._rawLinks,r=[];for(let t in n)n[t].target!==e&&n[t].source!==e||r.push(n[t]);return r}buildNodeHierarchy(t){let e={};return e[qE]="root",HE(e,this._rawNodes,t),new GE(e,this.url)}}function YE(t){return t.dataScope._dt.graph}function HE(t,e,n){if(0===e.length||0===n.length)return;"children"in t||(t.children=[]);let r={};for(let t of e){let e=t[n[0]];e in r||(r[e]=[]),r[e].push(t)}if(1===n.length)for(let e in r){let n={children:r[e]};n[qE]=e,t.children.push(n)}else for(let e in r){let i={};i[qE]=e,t.children.push(i),HE(i,r[e],n.slice(1))}}const qE="id";function WE(t,e){if(e.hasAttribute(t))return!0;if(e.tree&&e.tree.nodeTable.hasAttribute(t.split(".")[1]))return!0;throw new Error(["Attribute",t,"does not exist in the table",e.name].join(" "))}const $E=Object.freeze({Boolean:"boolean",Integer:"integer",Number:"number",Date:"date",String:"string"});function XE(t){var e=Object.values($E);for(let n=0;n<t.length;n++){let r=t[n];if(null!=r){for(let t=0;t<e.length;t++)KE[e[t]](r)||(e.splice(t,1),t-=1);if(1==e.length)return e[0]}}return e[0]}const KE={boolean:function(t){return"true"===t||"false"===t||!0===t||!1===t||"[object Boolean]"==toString.call(t)},integer:function(t){return KE.number(t)&&(t=+t)===~~t},number:function(t){return!isNaN(+t)&&"[object Date]"!=toString.call(t)},date:function(t){let e=new Date(t);return null!=e&&!isNaN(e)},string:function(t){return!0}};function ZE(t,e){let n={};switch(e){case $E.Boolean:n.trueCount=t.filter(t=>t).length,n.falseCount=t.filter(t=>!t).length;break;case $E.Date:n.min=et(t),n.max=Q(t),n.extent=[n.min,n.max],n.unique=[...new Set(t)];break;case $E.String:n.unique=[...new Set(t)];break;default:n.min=et(t),n.max=Q(t),n.extent=[n.min,n.max],n.mean=ct(t),n.median=ut(t),n.unique=[...new Set(t)]}return n}function JE(t,e,n,r,i){let o=i.getAttributeType(n);if(o!=$E.String&&o!=$E.Date&&o!=$E.Number&&o!=$E.Integer)throw new Error("Densify only works on a string or date attribute: "+n+" is "+o);if(!tA(e))throw new Error("The "+e.type+" is not dividable");switch(e.type){case lT.Line:return function(t,e,n){let r,i,o=Qw(t);for(let a of o){let o=a.dataScope?a.dataScope:new BE(n),s=n.getUniqueAttributeValues(e).map(t=>o.cross(e,t));s=s.filter(t=>!t.isEmpty()),1===s.length&&s.push(s[0].clone());let l=Object.assign({},a.styles);for(let t of SE.styles)a[t]&&(l[t]=a[t]);let c=a.vertices[0].x,u=a.vertices[0].y,h=[],f=a.vertices[1].x-c,d=a.vertices[1].y-u;for(let t=0;t<s.length;t++)h.push([c+t*f/(s.length-1),u+t*d/(s.length-1)]);l.vertices=h,l.type="path";let p=rT(l);i||(i=p.id),p._classId=i,p.dataScope=o,p._updateBounds(),p._refBounds=p.bounds.clone();let g=a.parent;g.addChild(p),g.removeChild(a);for(let[t,e]of p.vertices.entries())e.dataScope?e.dataScope=e.dataScope.merge(s[t]):e.dataScope=s[t];a==t&&(r=p)}return r}(e,n,i);case lT.Circle:return function(t,e,n){let r,i,o=Qw(t),a=n.getAttributeType(e);for(let s of o){let o=s.dataScope?s.dataScope:new BE(n),l=n.getUniqueAttributeValues(e).map(t=>o.cross(e,t));l=a==$E.Number?l:l.filter(t=>!t.isEmpty());let c=l.length;if(c<3)throw new Error("INSUFFICIENT_DATA_SCOPES");let u=90,h=360/c,f=[],d=[],p=-1;for(let t=0;t<l.length;t++){let e=u+p*t*h;d[t]=e;let n=QE(s.x,s.y,s.radius,d[t]);f.push(n)}let g=Object.assign({},s.styles);g.vertices=f,g.type="polygon",g.x=s.x,g.y=s.y,g.radius=s.radius;let _=rT(g);i||(i=_.id),_._classId=i,_.dataScope=o;let y=s.parent;y.addChild(_),y.removeChild(s);for(let[t,e]of _.vertices.entries())e._polarAngle=d[t],t>=l.length?e.dataScope=o.merge(l[2*l.length-1-t]):e.dataScope=o.merge(l[t]);s===t&&(r=_)}return r}(e,n,i);case lT.Rect:return function(t,e,n,r){let i,o,a=Qw(t),s=e||bE;if(s!=bE&&s!=vE)throw new Error("Unknown orientation: "+s);for(let e of a){let a=r.getAttributeType(n),l=e.dataScope?e.dataScope:new BE(r),c=r.getUniqueAttributeValues(n).map(t=>l.cross(n,t));c=a==$E.Number?c:c.filter(t=>!t.isEmpty()),1===c.length&&c.push(c[0].clone()),a!=$E.Number&&a!=$E.Date||c.sort((t,e)=>t._attr2value[n]>e._attr2value[n]?1:-1);let u=Object.assign({},e.styles),h=e.vertices[0].x,f=e.vertices[0].y,d=e.vertices[e.vertices.length-2].x,p=e.vertices[e.vertices.length-2].y,g=[],_=d-h,y=p-f;for(let t=0;t<c.length;t++)g.push(s==vE?[d,f+t*y/(c.length-1)]:[h+t*_/(c.length-1),f]);for(let t=0;t<c.length;t++)g.push(s==vE?[h,f+(c.length-1-t)*y/(c.length-1)]:[h+(c.length-1-t)*_/(c.length-1),p]);u.vertices=g,u.type="area";let m=rT(u);o||(o=m.id),m._classId=o,m.dataScope=l,m.orientation=s,m.baseline=s===bE?Xw.BOTTOM:Xw.LEFT;let b=e.parent;b.addChild(m),b.removeChild(e);for(let[t,e]of m.vertices.entries())t>=c.length?e.dataScope=l.merge(c[2*c.length-1-t]):e.dataScope=l.merge(c[t]);e===t&&(i=m)}return i}(e,r,n,i)}}function QE(t,e,n,r){return[n*Math.cos(LE(r))+t,e-n*Math.sin(LE(r))]}function tA(t){if([lT.Line,lT.Circle,lT.Rect,lT.Area].indexOf(t.type)<0)return!1;if(t.dataScope){let e=Qw(t,t.scene);for(let t of e)if(t.dataScope.numTuples>1)return!0;return!1}return!0}class eA{constructor(t){this._id="v_"+uT(),this._type=t,this._incomings=[],this._outgoings=[],this._undirected=[]}get id(){return this._id}get incomingEdges(){return this._incomings}get outgoingEdges(){return this._outgoings}get undirectedEdges(){return this._undirected}get type(){return this._type}get incomingDataflow(){for(let t of this._incomings)if(t.fromNode&&t.fromNode instanceof pE)return t.fromNode;return null}isIsolated(){return 0==this._incomings.length&&0==this._outgoings.length}}const nA=Object.freeze({CHANNEL:"channel",PROPERTY:"property",ATTRIBUTE:"attribute",ITEMS:"items",DATASCOPE:"datascope",ATTR_VALUE:"dataValue",BOUNDS:"bounds",SCALE:"scale",CONDITION_RESULT:"conditionResult",AFFIXATION:"affixation",ALIGNMENT:"alignment",EVT_CTX:"evtContext"});class rA extends eA{constructor(t,e,n){super(t),this._channel=e,this._elem=n}get channel(){return this._channel}get element(){return this._elem}}const iA=Object.freeze({X:"x",Y:"y",WIDTH:"width",HEIGHT:"height",RADIUS:"radius",FILLCOLOR:"fillColor",STROKECOLOR:"strokeColor",FILLGRADIENT:"fillGradient",TEXT:"text",ANGLE:"angle",THICKNESS:"thickness",AREA:"area",FONTSIZE:"fontSize",RADIALDISTANCE:"radialDistance",STROKEWIDTH:"strokeWidth",OPACITY:"opacity",VISIBILITY:"visibility",STRENGTH:"strength",SRC:"src"});function oA(t,e){delete e._encodings[cA(t.element)][t.channel]}function aA(t,e){let n=t.scene._encodings[cA(t)],r=[];n&&(r=r.concat(Object.values(n)));{let e=t.scene;for(let n in e._encodings){let i=n.split("_");i.pop(),i.join("_")===t.classId&&(r=r.concat(Object.values(e._encodings[n])))}}return r}function sA(t,e,n){for(let r in n._encodings){let i=n._encodings[r];if(i[e]&&i[e].attribute==t)return i[e]}return null}function lA(t,e){let n=t.scene._encodings[cA(t)];return n&&n[e]?n[e]:null}function cA(t){if(Array.isArray(t))return t.map(t=>cA(t)).join("_");if(t.classId)return t.classId;if("vertex"==t.type&&t.dataScope){if(t.parent.type===lT.Area){let e=t.parent.vertices.indexOf(t)<t.parent.vertices.length/2;return t.parent.classId+"_v"+(e?0:t.parent.vertices.length-1)}return t.parent.classId+"_v"}return"vertex"==t.type?t.parent.classId+"_v"+t.parent.vertices.indexOf(t):"segment"==t.type&&t.dataScope?t.parent.classId+"_s":"segment"==t.type?t.parent.classId+"_s"+t.parent.segments.indexOf(t):null}function uA(t,e){if(0==t.children.length)return[];let n=aE(t),r=t.type===lT.Composite?t.children:[t.children[0]],i=Object.keys(n._encodings),o=[];for(let t of r){let e=t;for(;e;){if(e.classId&&o.indexOf(e.classId)<0&&o.push(e.classId),e.type===lT.Glyph){e.children.forEach(t=>o.push(t.classId));break}if(!e.children)break;e=e.children[0]}}let a=[];for(let t of i)for(let r of o)0===t.indexOf(r)&&n._encodings[t][e]&&a.push(n._encodings[t][e]);return a}function hA(t){let e=lA(t,"y"),n=lA(t,"height");return e||n&&n.scales[0].domain[0]<0}function fA(t){let e=lA(t,"x"),n=lA(t,"width");return e||n&&n.scales[0].domain[0]<0}function dA(t,e){let n=function(t){let e=t.parent,n=[];for(;e.type!==lT.Scene;)n.push(e),e=e.parent;return n}(t);for(let t of n)if(lA(t,e))return!1;return n.length>=2?n[n.length-2]:t}function pA(t,e,n){switch(t.type){case lT.Rect:case lT.Path:case lT.Line:case lT.Area:!function(t,e,n){for(let r of t.vertices)gA(r,e,n);t._updateBounds(),t._refBounds&&t._refBounds.translate(e,n)}(t,e,n),0===e&&0===n||(t._dirty=!0);break;case lT.Group:case lT.Collection:case lT.Glyph:!function(t,e,n){for(let r of t.children)pA(r,e,n);t._layout&&(void 0!==t._layout._left&&(t._layout._left+=e),void 0!==t._layout._top&&(t._layout._top+=n),t._layout._cellBounds&&t._layout._cellBounds.forEach(t=>t.translate(e,n)));t._updateBounds(),t._refBounds&&t._refBounds.translate(e,n)}(t,e,n);break;case"segment":!function(t,e,n){gA(t.vertex1,e,n),gA(t.vertex2,e,n)}(t,e,n),0===e&&0===n||(t.parent._dirty=!0);break;case"vertex":gA(t,e,n),0===e&&0===n||(t.parent._dirty=!0);break;default:!function(t,e,n){t._x+=e,t._y+=n,t._updateBounds(),t._refBounds&&t._refBounds.translate(e,n)}(t,e,n),0===e&&0===n||(t._dirty=!0)}}function gA(t,e,n){t._x+=e,t._y+=n}function _A(t,e,n){switch(e){case"x":mA(t,n);break;case"y":bA(t,n);break;case"width":!function(t,e){t.resize(e,t.height)}(t,n);break;case"height":!function(t,e){t.resize(t.width,e)}(t,n);break;case"radius":t.radius=n;break;case"strength":t._strength=n;break;case"area":t.type===lT.Circle?t.radius=Math.sqrt(n/Math.PI):t.type===lT.Rect&&t.resize(Math.sqrt(n),Math.sqrt(n)),t._updateBounds();break;case"text":t._text=n;break;case"curveMode":t.curveMode=n;break;case"baseline":t.baseline=n;break;case"angle":[lT.Arc,lT.Pie].includes(t.type)&&function(t,e){t._endAngle=VE(t._startAngle+e),t._sr=LE(t._startAngle),t._er=LE(t._endAngle),t.vertices[0]._x=t._x+t._innerRadius*Math.cos(t._sr),t.vertices[0]._y=t._y-t._innerRadius*Math.sin(t._sr),t.vertices[1]._x=t._x+t._outerRadius*Math.cos(t._sr),t.vertices[1]._y=t._y-t._outerRadius*Math.sin(t._sr),t.vertices[2]._x=t._x+t._outerRadius*Math.cos(t._er),t.vertices[2]._y=t._y-t._outerRadius*Math.sin(t._er),t.vertices[3]._x=t._x+t._innerRadius*Math.cos(t._er),t.vertices[3]._y=t._y-t._innerRadius*Math.sin(t._er)}(t,n);break;case"startAngle":!function(t,e){let n=t.angle;t._startAngle=e,t._endAngle=VE(t._startAngle+n),t._sr=LE(t._startAngle),t._er=LE(t._endAngle),t.vertices[0]._x=t._x+t._innerRadius*Math.cos(t._sr),t.vertices[0]._y=t._y-t._innerRadius*Math.sin(t._sr),t.vertices[1]._x=t._x+t._outerRadius*Math.cos(t._sr),t.vertices[1]._y=t._y-t._outerRadius*Math.sin(t._sr),t.vertices[2]._x=t._x+t._outerRadius*Math.cos(t._er),t.vertices[2]._y=t._y-t._outerRadius*Math.sin(t._er),t.vertices[3]._x=t._x+t._innerRadius*Math.cos(t._er),t.vertices[3]._y=t._y-t._innerRadius*Math.sin(t._er)}(t,n);break;case"thickness":!function(t,e){yA(t,t._innerRadius+e)}(t,n);break;case"innerRadius":!function(t,e){t._innerRadius=e,t.vertices[0]._x=t._x+t._innerRadius*Math.cos(t._sr),t.vertices[0]._y=t._y-t._innerRadius*Math.sin(t._sr),t.vertices[3]._x=t._x+t._innerRadius*Math.cos(t._er),t.vertices[3]._y=t._y-t._innerRadius*Math.sin(t._er)}(t,n);break;case"outerRadius":yA(t,n);break;case"radialDistance":{let e=QE(t.parent.x,t.parent.y,n,t.polarAngle);mA(t,e[0]),bA(t,e[1]);break}case"visibility":t.visibility=n;break;case"src":t.src=n;break;default:if("vertex"===t.type)t[e]=n;else if(t instanceof qA)for(let r of t.children)_A(r,e,n);else t.styles[e]=n}"vertex"===t.type?t.parent._dirty=!0:t._dirty=!0}function yA(t,e){t._outerRadius=e,t.vertices[1]._x=t._x+t._outerRadius*Math.cos(t._sr),t.vertices[1]._y=t._y-t._outerRadius*Math.sin(t._sr),t.vertices[2]._x=t._x+t._outerRadius*Math.cos(t._er),t.vertices[2]._y=t._y-t._outerRadius*Math.sin(t._er)}function mA(t,e){"vertex"==t.type?t._x=e:pA(t,e-t.x,0)}function bA(t,e){"vertex"==t.type?t._y=e:pA(t,0,e-t.y)}class vA extends kE{constructor(t){super(t)}get width(){return this.vertices[1].x-this.vertices[0].x}get height(){return this.vertices[2].y-this.vertices[1].y}get left(){return this.vertices[0].x}get top(){return this.vertices[0].y}get right(){return this.vertices[1].x}get bottom(){return this.vertices[2].y}get area(){return this.width*this.height}resize(t,e,n,r){t!==this.width&&("right"===n?(this.vertices[1]._x=this.refBounds.right,this.vertices[2]._x=this.refBounds.right,this.vertices[0]._x=this.vertices[1]._x-t,this.vertices[3]._x=this.vertices[0]._x):(this.vertices[0]._x=this.refBounds.left,this.vertices[3]._x=this.refBounds.left,this.vertices[1]._x=this.vertices[0]._x+t,this.vertices[2]._x=this.vertices[1]._x)),e!==this.height&&("top"===r?(this.vertices[0]._y=this.refBounds.top,this.vertices[1]._y=this.refBounds.top,this.vertices[3]._y=this.vertices[0]._y+e,this.vertices[2]._y=this.vertices[3]._y):(this.vertices[2]._y=this.refBounds.bottom,this.vertices[3]._y=this.refBounds.bottom,this.vertices[0]._y=this.vertices[3]._y-e,this.vertices[1]._y=this.vertices[0]._y)),this._dirty=!0}get leftSegment(){return this.segments[3]}get rightSegment(){return this.segments[1]}get topSegment(){return this.segments[0]}get bottomSegment(){return this.segments[2]}}class xA extends kE{constructor(t){super(t),this._type=lT.Area,this.closed=!0,this._orientation="orientation"in t?t.orientation:void 0,this._baseline="baseline"in t?t.baseline:void 0,t&&"vertices"in t&&this.segments.push(new CE(this.vertices[this.vertices.length-1],this.vertices[0],this,this.segmentCounter++))}get topLeftVertex(){return this._orientation===bE?this.vertices[0]:this.vertices[this.vertices.length-1]}get bottomLeftVertex(){return this._orientation===bE?this.vertices[this.vertices.length-1]:this.vertices[this.vertices.length/2]}get topRightVertex(){return this._orientation===bE?this.vertices[this.vertices.length/2-1]:this.vertices[0]}get bottomRightVertex(){return this._orientation===bE?this.vertices[this.vertices.length/2]:this.vertices[this.vertices.length/2-1]}get baseline(){return this._baseline}set baseline(t){this._baseline=t,this._dirty=!0}get orientation(){return this._orientation}set orientation(t){this._orientation=t,this._dirty=!0}get firstVertexPair(){return[this.vertices[0],this.vertices[this.vertices.length-1]]}get width(){return this.vertices[this.vertices.length/2].x-this.vertices[0].x}get height(){return this.vertices[this.vertices.length/2].y-this.vertices[0].y}get left(){return this.vertices[0].x}get top(){return this.vertices[0].y}copyPropertiesTo(t){super.copyPropertiesTo(t),t._baseline=this._baseline,t._orientation=this._orientation}getSVGPathData(){return super.getSVGPathData()+" z"}}class wA extends eA{constructor(t,e){super(t),this._encs={},this._encs[e.channel+"_"+cA(e.element)]=e,this._initialized=!1}addLinkedEncoding(t){this._encs[t.channel+"_"+cA(t.element)]=t}getEncoding(t,e){let n=t+"_"+cA(e);return this._encs[n]}get encodings(){return Object.values(this._encs)}get initialized(){return this._initialized}set initialized(t){this._initialized=t}}class EA extends eA{constructor(t,e,n){super(t),this._result=e,this._condEnc=n}get result(){return this._result}get conditionalEncoding(){return this._condEnc}}class AA extends pE{constructor(t){super(t)}storeValues(t,e){this._storedValues={};let n=Qw(t);for(let t of n)this._storedValues[t.id]=t[e]}_restoreValues(t){let e=this.outputVar.channel;t.forEach(t=>{t.styles[e]!==this._storedValues[t.id]&&(t._dirty=!0,t.styles[e]=this._storedValues[t.id])})}run(){super.run();let t=this.inputVars.find(t=>t instanceof wA),e=this.outputVar,n=Qw(e.element),r=["x","y","width","height","radius"].includes(e.channel);if(t){let n=t.getEncoding(e.channel,e.element);for(let t of n.scales){let e=n.getElements(t);this._doMapping(e,t,n.attrValues,n),r&&this._updateRefBounds(e,t,n)}}else this._restoreValues(n);let i=this._getUsableCondEncodings();if(i.length>0&&this._doCondEncoding(n,i.map(t=>t.conditionalEncoding)),r){$w(["vertex","segment"].includes(e.element.type)?e.element.parent:e.element)}}_updateRefBounds(t,e,n){switch(this.outputVar.channel){case"width":t.forEach(t=>{t._refBounds.setWidth(e.rangeExtent)});break;case"height":t.forEach(t=>{t._refBounds.setHeight(e.rangeExtent)});break;case"radius":t.forEach(t=>{t._refBounds.setWidth(2*e.rangeExtent,Xw.CENTER),t._refBounds.setHeight(2*e.rangeExtent,Xw.MIDDLE)});break;case"x":"vertex"!=t[0].type&&"segment"!=t[0].type||t.forEach(t=>{let r=t.parent._refBounds;t.parent._refBounds=new Yw(n.flipScale?e.range[1]:e.range[0],r.top,e.rangeExtent,r.height)});break;case"y":"vertex"!=t[0].type&&"segment"!=t[0].type||t.forEach(t=>{let r=t.parent._refBounds;t.parent._refBounds=new Yw(r.left,n.flipScale?e.range[0]:e.range[1],r.width,e.rangeExtent)})}}_doMapping(t,e,n,r){switch(this.outputVar.channel){case"width":e.domain[0]<0&&t[0]instanceof vA?function(t,e,n){for(let r=0;r<t.length;r++){let i=t[r],o=i.refBounds.left+e.map(0),a=i.refBounds.left+e.map(n[i.id]);pA(i.leftSegment,o-i.leftSegment.x,0),pA(i.rightSegment,a-i.rightSegment.x,0)}}(t,e,n):e.domain[0]<0&&t[0]instanceof xA||(t[0].type===lT.Area?function(t,e,n){let r=t[0].baseline;if(t[0].orientation===vE)switch(r){case"left":for(let r of t)Qw(r.topLeftVertex,r).forEach(t=>_A(t,"x",r.refBounds.left)),Qw(r.topRightVertex,r).forEach(t=>_A(t,"x",r.refBounds.left+e.map(n[t.id])));break;case"right":for(let r of t)Qw(r.topLeftVertex,r).forEach(t=>_A(t,"x",r.refBounds.right-e.map(n[t.id]))),Qw(r.topRightVertex,r).forEach(t=>_A(t,"x",r.refBounds.right));break;case"center":console.log("center");for(let r of t)Qw(r.topLeftVertex,r).forEach(t=>_A(t,"x",r.refBounds.center-e.map(n[t.id])/2)),Qw(r.topRightVertex,r).forEach(t=>_A(t,"x",r.refBounds.center+e.map(n[t.id])/2))}}(t,e,n):this._doStandardMapping(t,e,n));break;case"height":e.domain[0]<0&&t[0]instanceof vA?function(t,e,n){for(let r=0;r<t.length;r++){let i=t[r],o=i.refBounds.bottom-e.map(0),a=i.refBounds.bottom-e.map(n[i.id]);pA(i.bottomSegment,0,o-i.bottomSegment.y),pA(i.topSegment,0,a-i.topSegment.y)}}(t,e,n):e.domain[0]<0&&t[0]instanceof xA?function(t,e,n){for(let r of t){let t=tE(r.topLeftVertex,[r]);for(let i of t)_A(i,"y",r.refBounds.bottom-e.map(n[i.id]));tE(r.bottomLeftVertex,[r]).forEach(t=>_A(t,"y",r.refBounds.bottom-e.map(0)))}}(t,e,n):t[0].type===lT.Area?function(t,e,n){let r=t[0].baseline;if(t[0].orientation===bE)switch(r){case"top":for(let r of t)Qw(r.bottomLeftVertex,r).forEach(t=>_A(t,"y",r.refBounds.top+e.map(n[t.id]))),Qw(r.topLeftVertex,r).forEach(t=>_A(t,"y",r.refBounds.top));break;case"middle":for(let r of t)Qw(r.topLeftVertex,r).forEach(t=>_A(t,"y",r.refBounds.middle-e.map(n[t.id])/2)),Qw(r.bottomLeftVertex,r).forEach(t=>_A(t,"y",r.refBounds.middle+e.map(n[t.id])/2));break;default:for(let r of t)Qw(r.topLeftVertex,r).forEach(t=>_A(t,"y",r.refBounds.bottom-e.map(n[t.id]))),Qw(r.bottomLeftVertex,r).forEach(t=>_A(t,"y",r.refBounds.bottom))}}(t,e,n):this._doStandardMapping(t,e,n);break;case"text":this._doTextMapping(t,n);break;case"fillGradient":!function(t,e,n,r){for(let i of t){let t=i.vertices.map(t=>n[t.id]),o=Math.min(...t),a=Math.max(...t),s="horizontal"===i.orientation?new _E({x1:0,y1:100,x2:0,y2:0}):new _E({x1:0,y1:0,x2:100,y2:0});if(s.addStop(0,e.map(o),1),r._mapping){let t=Object.keys(r._mapping).map(t=>parseFloat(t)).sort();for(let n of t)n>o&&n<a&&s.addStop(100*(n-o)/(a-o),e.map(n),1)}else"divergingColor"===e.type&&s.addStop(100*-o/(a-o),e.map(0),1);"sequentialColor"===e.type&&s.addStop(100*-o/(a-o),e.map(0),1),s.addStop(100,e.map(a),1),i.fillColor=s}}(t,e,n,r);break;default:this._doStandardMapping(t,e,n)}}_doTextMapping(t,e){let n=this.outputVar.channel;t.forEach(t=>{_A(t,n,e[t.id])})}_doStandardMapping(t,e,n){let r=this.outputVar.channel;t.forEach(t=>{let i=e.map(n[t.id]);_A(t,r,i),t instanceof kE&&t.firstVertex&&t.firstVertex.shape&&"strokeColor"===r&&t.vertices.forEach(t=>t.fillColor=i)})}_doCondEncoding(t,e){let n=t[0].scene;for(let r of t){let t=e.map(t=>t.evalResult.getValue(r.id)).every(t=>t||void 0===t),i=e[0].eventContext;e[0].stylingFunction(t,i,r,n)}}_updateElement(t,e,n,r){let i;"object"==typeof r&&t.triggerElement?"property"in r?i=t.triggerElement[r.property]:"attribute"in r&&(i=t.triggerElement.dataScope.getAttrVal(r.attribute)):i=r,["x","y"].includes(n)&&"offset"in r&&(i+=r.offset),_A(e,n,i)}_getUsableCondEncodings(){return this.inputVars.filter(t=>t instanceof EA)}}class TA extends eA{constructor(t,e,n){super(t),this._property=e,this._elem=n}get property(){return this._property}get element(){return this._elem}}function SA(t){return t in CA?CA[t]:t}const CA=Object.freeze({numCols:"layoutParameter",numRows:"layoutParameter",startCorner:"layoutParameter",direction:"layoutParameter"}),kA=Object.freeze({AXIS_ORIENTATION:"axisOrientation",AXIS_PATH_POSITION:"axisPathPosition",AXIS_TICK_SIZE:"axisTickSize",AXIS_TICK_OFFSET:"axisTickOffset",AXIS_TICKS_POSITION:"axisTicksPosition",AXIS_LABELS_POSITION:"axisLabelsPosition",AXIS_TITLE_POSITION:"axisTitlePosition",AXIS_LABEL_OFFSET:"axisLabelOffset",AXIS_LABEL_FORMAT:"axisLabelFormat",AXIS_FONT_SIZE:"axisFontSize",LEGEND_POSITION:"legendPosition",GRIDLINES_POSITION:"gridlinesPosition",INCLUDE_ZERO:"includeZero",FLIP_SCALE:"flipScale",RANGE_START:"rangeStart",RANGE_EXTENT:"rangeExtent",BASE_LINE:"baseline",LAYOUT_PARAMETER:"layoutParameter",CHILDREN_ORDER:"childrenOrder",TRANSFORM:"transform"});function MA(t,e){if(e.findVariable(nA.BOUNDS,[t]))return;let n=e.getVariable(nA.BOUNDS,t),r=e.createOneWayDependency(gE.EVAL_BBOX);switch(e.connect(r,n),t.type){case lT.Circle:case lT.Polygon:{let n=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"radius",t),a=e.getVariable(nA.CHANNEL,"area",t);e.connect(o,r),e.connect(n,r),e.connect(i,r),e.connect(a,r);break}case lT.Area:case lT.Line:case lT.BezierCurve:case lT.Path:case lT.Image:{let n=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"width",t),a=e.getVariable(nA.CHANNEL,"height",t);e.connect(n,r),e.connect(i,r),e.connect(o,r),e.connect(a,r);break}case lT.Rect:{let n=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"width",t),a=e.getVariable(nA.CHANNEL,"height",t),s=e.getVariable(nA.CHANNEL,"area",t);e.connect(n,r),e.connect(i,r),e.connect(o,r),e.connect(a,r),e.connect(s,r);break}case lT.SimpleText:case lT.RichText:{let n=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"text",t);e.connect(n,r),e.connect(i,r),e.connect(o,r);break}case lT.Ring:{let n=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"innerRadius",t),a=e.getVariable(nA.CHANNEL,"outerRadius",t);e.connect(n,r),e.connect(i,r),e.connect(o,r),e.connect(a,r);break}case lT.Pie:case lT.Arc:{let n=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"innerRadius",t),a=e.getVariable(nA.CHANNEL,"outerRadius",t),s=e.getVariable(nA.CHANNEL,"startAngle",t),l=e.getVariable(nA.CHANNEL,"endAngle",t),c=e.getVariable(nA.CHANNEL,"angle",t),u=e.getVariable(nA.CHANNEL,"thickness",t);e.connect(n,r),e.connect(i,r),e.connect(o,r),e.connect(a,r),e.connect(s,r),e.connect(l,r),e.connect(c,r),e.connect(u,r);break}}r.run()}function RA(t,e){let n=e.findVariablesByElement(t);for(let t in n){let r=n[t];for(let t of r)e.deleteVariable(t)}}function OA(t,e){let n=e.findVariable(nA.CHANNEL,[t.channel,t.element]);n||console.warn("cannot find encoding to remove from the dep graph");let r=n.incomingDataflow;e.deleteOperator(r)}function NA(t,e){if(t.type===lT.Axis){let n=e.findVariable(nA.PROPERTY,[kA.AXIS_PATH_POSITION,t]).incomingDataflow;e.deleteOperator(n),n=e.findVariable(nA.PROPERTY,[kA.AXIS_TICKS_POSITION,t]).incomingDataflow,e.deleteOperator(n),n=e.findVariable(nA.PROPERTY,[kA.AXIS_LABELS_POSITION,t]).incomingDataflow,e.deleteOperator(n)}else if(t.type===lT.Gridlines){let n=e.findVariable(nA.PROPERTY,[kA.GRIDLINES_POSITION,t]).incomingDataflow;e.deleteOperator(n)}}function IA(t,e){if(e.findVariable(nA.BOUNDS,[t]))return;let n=e.getVariable(nA.BOUNDS,t),r=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"width",t),a=e.getVariable(nA.CHANNEL,"height",t),s=e.createOneWayDependency(gE.EVAL_BBOX);e.connect(r,s),e.connect(i,s),e.connect(o,s),e.connect(a,s),e.connect(s,n),s.run()}function LA(t,e){let n=e.getVariable(nA.BOUNDS,t),r=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"width",t),a=e.getVariable(nA.CHANNEL,"height",t),s=e.createOneWayDependency(gE.EVAL_BBOX);e.connect(r,s),e.connect(i,s),e.connect(o,s),e.connect(a,s),e.connect(s,n),s.run()}function PA(t,e,n){let r=n.getVariable(nA.BOUNDS,t),i=n.getVariable(nA.BOUNDS,e),o=n.getIncomingDataflowOperator(gE.EVAL_BBOX,r),a=i.outgoingEdges.find(t=>t.fromNode===i&&t.toNode===o);if(a&&n.disconnect(i,o,a),t.layout){let r=n.getVariable(nA.CHANNEL,"x",e),i=n.getIncomingDataflowOperator(BA(t.layout.type),r);i&&n.deleteOperator(i)}}function VA(t,e,n){let r=n.getVariable(nA.BOUNDS,t),i=n.getVariable(nA.BOUNDS,e),o=n.getIncomingDataflowOperator(gE.EVAL_BBOX,r);n.connect(i,o),n.connect(o,r),t.layout&&FA(t,t.layout,n)}function DA(t,e){let n=e.getVariable(nA.BOUNDS,t),r=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getIncomingDataflowOperator(gE.EVAL_BBOX,n);e.connect(r,o),e.connect(i,o);for(let n of t.children)e.connect(e.getVariable(nA.BOUNDS,n),o);e.connect(o,n),o.run()}function BA(t){switch(t){case fE.GRID:return gE.GRID_LAYOUT;case fE.STACK:return gE.STACK_LAYOUT;case fE.PACKING:return gE.PACK_LAYOUT;case fE.FORCE:return gE.FORCE_LAYOUT;case fE.DIRECTED:return gE.DIRECTED_LAYOUT;case fE.TIDYTREE:return gE.TIDY_TREE_LAYOUT;case fE.TREEMAP:return gE.TREEMAP_LAYOUT;case fE.STRATA:return gE.STRATA_LAYOUT;case fE.CIRCULAR:return gE.CIRCULAR_LAYOUT;case fE.CLUSTER:return gE.CLUSTER_LAYOUT}}function zA(t,e,n){let r=n.getVariable(nA.PROPERTY,kA.CHILDREN_ORDER,t),i=n.getOutgoingDataflowOperator(BA(e.type),r);n.deleteOperator(i)}function FA(t,e,n){let r=e?e.type:"none",i=r===fE.TREEMAP?lE(t)[0]:t.children[0];if(!i)return;let o=n.getVariable(nA.CHANNEL,"width",i),a=n.getVariable(nA.CHANNEL,"height",i),s=n.getVariable(nA.PROPERTY,kA.CHILDREN_ORDER,t),l=n.getVariable(nA.CHANNEL,"x",i),c=n.getVariable(nA.CHANNEL,"y",i),u=n.getVariable(nA.CHANNEL,"visibility",i),h=n.getVariable(nA.PROPERTY,kA.LAYOUT_PARAMETER,e),f=n.getOutgoingDataflowOperator(BA(r),s);if(n.connect(o,f),n.connect(a,f),n.connect(s,f),n.connect(h,f),n.connect(u,f),n.connect(f,l),n.connect(f,c),n.disconnectChannelVarFromBBoxOperator(o),n.disconnectChannelVarFromBBoxOperator(a),i.type===lT.Arc||i.type===lT.Pie){let t=n.getVariable(nA.CHANNEL,"angle",i),e=n.getVariable(nA.CHANNEL,"thickness",i);n.connect(t,f),n.connect(e,f)}else if(i.type===lT.Circle){let t=n.getVariable(nA.CHANNEL,"area",i),e=n.getVariable(nA.CHANNEL,"radius",i);n.connect(t,f),n.connect(e,f),n.disconnectChannelVarFromBBoxOperator(t),n.disconnectChannelVarFromBBoxOperator(e)}else if(i.type===lT.Rect){let t=n.getVariable(nA.CHANNEL,"area",i);n.connect(t,f),n.disconnectChannelVarFromBBoxOperator(t)}if(f.run(),i.links&&GA(i,n),i.children&&i.children[0]){let t=n.getVariable(nA.BOUNDS,i.children[0]),e=n.getVariable(nA.CHANNEL,"x",i).incomingDataflow;e&&n.connect(t,e),n.disconnectChannelVarFromBBoxOperator(t)}}function GA(t,e){let n=t.links[0],r=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"x",n),o=e.getVariable(nA.CHANNEL,"strokeWidth",n),a=e.getVariable(nA.CHANNEL,"strength",n),s=e.createOneWayDependency(gE.LINK_PLACER);e.connect(r,s),e.connect(o,s),e.connect(a,s),e.connect(s,i)}function jA(t,e,n){let r=t.attribute,i=t.channel,o=t.element,a=e.createOneWayDependency(gE.ENCODER);if(["width","height"].includes(t.channel)&&o.type===lT.Area){let t=e.getVariable(nA.PROPERTY,kA.BASE_LINE,o);e.connect(t,a)}if(n){let r=e.getVariable(nA.ATTR_VALUE,n),s=e.getVariable(nA.SCALE,n),l=e.getVariable(nA.CHANNEL,i,o);e.connect(s,a),e.connect(a,l),r.addLinkedEncoding(t),s.addLinkedEncoding(t),r.incomingDataflow.run()}else{let n=e.getVariable(nA.ATTRIBUTE,r,fT(o)),s=e.getVariable(nA.PROPERTY,kA.INCLUDE_ZERO,t),l=e.getVariable(nA.ATTR_VALUE,t),c=e.getVariable(nA.DATASCOPE,o),u=e.getVariable(nA.PROPERTY,kA.TRANSFORM,t),h=e.createOneWayDependency(gE.DATA_EXTRACTOR);e.connect(n,h),e.connect(s,h),e.connect(c,h),e.connect(u,h),e.connect(h,l),h.run();let f=e.getVariable(nA.PROPERTY,kA.RANGE_START,t),d=e.getVariable(nA.PROPERTY,kA.RANGE_EXTENT,t),p=e.getVariable(nA.PROPERTY,kA.FLIP_SCALE,t),g=e.getVariable(nA.SCALE,t),_=e.createOneWayDependency(gE.SCALE_BUILDER);e.connect(f,_),e.connect(d,_),e.connect(p,_),e.connect(l,_),e.connect(_,g),_.run();let y=e.getVariable(nA.CHANNEL,i,o);e.connect(g,a),e.connect(a,y),a.run()}}function UA(t,e){let n=e.getVariable(nA.PROPERTY,kA.AXIS_ORIENTATION,t),r=e.getVariable(nA.BOUNDS,t.elements[0].parent),i=e.getVariable(nA.PROPERTY,kA.AXIS_PATH_POSITION,t),o=e.createOneWayDependency(gE.AXIS_PATH_PLACER);e.connect(n,o),e.connect(r,o),e.connect(o,i),o.run();let a=e.getVariable(nA.PROPERTY,kA.AXIS_TICK_OFFSET,t),s=e.getVariable(nA.PROPERTY,kA.AXIS_TICK_SIZE,t),l=e.createOneWayDependency(gE.AXIS_TICKS_PLACER),c=e.getVariable(nA.PROPERTY,kA.AXIS_TICKS_POSITION,t);e.connect(i,l),e.connect(a,l),e.connect(s,l),e.connect(l,c),l.run();let u=e.getVariable(nA.PROPERTY,kA.AXIS_LABEL_OFFSET,t),h=e.getVariable(nA.PROPERTY,kA.AXIS_LABEL_FORMAT,t),f=e.getVariable(nA.PROPERTY,kA.AXIS_FONT_SIZE,t),d=e.createOneWayDependency(gE.AXIS_LABELS_PLACER),p=e.getVariable(nA.PROPERTY,kA.AXIS_LABELS_POSITION,t);e.connect(i,d),e.connect(u,d),e.connect(h,d),e.connect(f,d),e.connect(d,p),d.run();let g=e.getVariable(nA.PROPERTY,kA.AXIS_TITLE_POSITION,t),_=e.createOneWayDependency(gE.AXIS_TITLE_PLACER);e.connect(i,_),e.connect(_,g),_.run();let y=e.getVariable(nA.BOUNDS,t),m=e.getIncomingDataflowOperator(gE.EVAL_BBOX,y);e.connect(c,m),e.connect(p,m),e.connect(m,y)}function YA(t,e){let n=e.getVariable(nA.PROPERTY,kA.AXIS_ORIENTATION,t),r=e.getVariable(nA.BOUNDS,sE(t.elements[0])),i=e.getVariable(nA.PROPERTY,kA.AXIS_PATH_POSITION,t),o=e.createOneWayDependency(gE.AXIS_PATH_PLACER);e.connect(n,o),e.connect(r,o),e.connect(o,i),o.run();let a=e.getVariable(nA.PROPERTY,kA.AXIS_TICK_OFFSET,t),s=e.getVariable(nA.PROPERTY,kA.AXIS_TICK_SIZE,t),l=e.createOneWayDependency(gE.AXIS_TICKS_PLACER),c=e.getVariable(nA.PROPERTY,kA.AXIS_TICKS_POSITION,t);e.connect(i,l),e.connect(a,l),e.connect(s,l),e.connect(l,c),l.run();let u=e.getVariable(nA.PROPERTY,kA.AXIS_LABEL_OFFSET,t),h=e.getVariable(nA.PROPERTY,kA.AXIS_LABEL_FORMAT,t),f=e.getVariable(nA.PROPERTY,kA.AXIS_FONT_SIZE,t),d=e.createOneWayDependency(gE.AXIS_LABELS_PLACER),p=e.getVariable(nA.PROPERTY,kA.AXIS_LABELS_POSITION,t);e.connect(i,d),e.connect(u,d),e.connect(h,d),e.connect(f,d),e.connect(d,p),d.run();let g=e.getVariable(nA.PROPERTY,kA.AXIS_TITLE_POSITION,t),_=e.createOneWayDependency(gE.AXIS_TITLE_PLACER);e.connect(i,_),e.connect(_,g),_.run();let y=e.getVariable(nA.BOUNDS,t),m=e.getIncomingDataflowOperator(gE.EVAL_BBOX,y);e.connect(c,m),e.connect(p,m),e.connect(m,y)}function HA(t,e){let n=e.getVariable(nA.BOUNDS,sE(t.elements[0])),r=e.getVariable(nA.PROPERTY,kA.GRIDLINES_POSITION,t),i=e.createOneWayDependency(gE.GRIDLINES_PLACER);e.connect(n,i),e.connect(i,r),i.run();let o=e.getVariable(nA.BOUNDS,t),a=e.getIncomingDataflowOperator(gE.EVAL_BBOX,o);e.connect(r,a),e.connect(a,o)}class qA{constructor(){this._id=this.type+uT(),this._type=lT.Group,this._dataScope=void 0,this._bounds=void 0,this._layout=void 0,this._children=[],this._sortBy={property:dT,descending:!1}}get id(){return this._id}get type(){return this._type}get children(){return this._children}addChild(t){this.children.indexOf(t)>=0||(t.parent&&t.parent.removeChild(t),this.children.push(t),t.parent=this)}addChildAt(t,e){t.parent&&t.parent.removeChild(t),this.children.splice(e,0,t),t.parent=this}removeChild(t){let e=this.children.indexOf(t);e>=0&&(this.children.splice(e,1),t.parent=null)}removeChildAt(t){this.children[t].parent=null,this.children.splice(t,1)}removeAll(){for(let t of this.children)t.parent=null;this._children=[]}get dataScope(){return this._dataScope}set dataScope(t){if(this._dataScope=t,void 0===t)for(let e of this.children)e.dataScope=t;else for(let e of this.children)e.dataScope?e.dataScope=e.dataScope.merge(t):e.dataScope=t}getInternalEncodings(t){if(0==this.children.length)return[];let e=this.children[0],n=this.getScene(),r=Object.keys(n.encodings),i=[];for(;e;){if(e.classId&&i.indexOf(e.classId)<0&&i.push(e.classId),e.type===lT.Glyph){e.children.forEach(t=>i.push(t.classId));break}if(!e.children)break;e=e.children[0]}let o=[];for(let e of r){let r=e.split("_");for(let a of i)r[0]==a&&n.encodings[e][t]&&o.push(n.encodings[e][t])}return o}get firstChild(){return this.children[0]}get lastChild(){return this.children[this.children.length-1]}set layout(t){if(this._layout=t,t&&(t.group=this),FA(this,t,this.scene._depGraph),this.children&&this.children.length>0){let t=lE(this,!0);for(let e of t)this.scene.onChange(nA.CHANNEL,"x",e)}}get layout(){return this._layout}get bounds(){return this._bounds||this._updateBounds(),this._bounds}get refBounds(){let t=this.children.map(t=>t.refBounds),e=Math.min(...t.map(t=>t.left)),n=Math.min(...t.map(t=>t.top)),r=Math.max(...t.map(t=>t.right)),i=Math.max(...t.map(t=>t.bottom));return new Yw(e,n,r-e,i-n)}get x(){return this.bounds.x}get y(){return this.bounds.y}_updateBounds(){let t=this.children;if(t.length>0){this._bounds=t[0].bounds.clone();for(let e=1;e<t.length;e++)"hidden"!=t[e].visibility&&(this._bounds=this._bounds.union(t[e].bounds))}else this._bounds=new Yw(0,0,0,0)}set visibility(t){this._visibility="hidden"==t?t:"visible";for(let e of this.children)e.visibility=t}get visibility(){return this._visibility?this._visibility:"visible"}get scene(){return aE(this)}get sortBy(){return this._sortBy}}class WA extends qA{constructor(){super(),this._type=lT.Collection,this._id=this.type+"_"+uT(),this._classId=this.id,this._childrenOrder=void 0,this._clipMask=void 0}get classId(){return this._classId}getSVGPathData(){let t="";for(let e of this.children)if(e.getSVGPathData)t+=e.getSVGPathData();else if(e.bounds){let n=e.bounds;t+=["M",n.left,n.top].join(" "),t+=["L",n.right,n.top].join(" "),t+=["L",n.right,n.bottom].join(" "),t+=["L",n.left,n.bottom,"Z"].join(" ")}return t}createClipMask(){let t=qw(this._children);this._clipMask=new Yw(t.left,t.top,t.width,t.height)}get clipMask(){return this._clipMask}}class $A extends qA{constructor(t){if(super(),this._type=lT.Glyph,this._id=this.type+"_"+uT(),this._classId=this._id,t)for(let e of t)this.addChild(e)}get classId(){return this._classId}}class XA extends kE{constructor(t){super(t),this._type=lT.BezierCurve,this._orientation="orientation"in t?t.orientation:bE}get type(){return this._type}get orientation(){return this._orientation}copyPropertiesTo(t){super.copyPropertiesTo(t),t._orientation=this._orientation}getSVGPathData(){if(this._d)return this._d;let t="M ";return t+=this.vertices[0].x+" "+this.vertices[0].y+" ",t+="C "+this.vertices[1].x+" "+this.vertices[1].y+" ",t+=this.vertices[2].x+" "+this.vertices[2].y+" ",t+=this.vertices[3].x+" "+this.vertices[3].y,t}}class KA extends Kw{constructor(t){super(t),this._type=lT.Circle,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._radius="radius"in t?t.radius:100,"strokeColor"in this.styles||(this.styles.strokeColor="#ccc"),"fillColor"in this.styles||(this.styles.fillColor="none"),"strokeWidth"in this.styles||(this.styles.strokeWidth=1),"strokeDash"in this.styles||(this.styles.strokeDash="none")}get x(){return this._x}get y(){return this._y}get radius(){return this._radius}set radius(t){this._radius=t,this._dirty=!0}get area(){return Math.PI*Math.pow(this._radius,2)}_updateBounds(){if(this._rotate){let t=Gw(this._x,this._y,this._rotate[1],this._rotate[2],this._rotate[0]);this._bounds=new Yw(t.x-this._radius,t.y-this._radius,2*this._radius,2*this._radius)}else this._bounds=new Yw(this._x-this._radius,this._y-this._radius,2*this._radius,2*this._radius)}copyPropertiesTo(t){super.copyPropertiesTo(t),t._x=this._x,t._y=this._y,t._radius=this._radius}getSVGPathData(){return["M",this._x,this._y,"m",-this._radius,", 0 a",this._radius,",",this._radius,"0 1,0",2*this._radius,",0 a",this._radius,",",this._radius,"0 1,0",-2*this._radius,",0"].join(" ")}}let ZA=class extends Kw{constructor(t){super(t),this._type=lT.Image,this._src=t.src,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._width="width"in t?t.width:100,this._height="height"in t?t.height:100}get src(){return this._src}set src(t){this._src=t,this._dirty=!0}get width(){return this._width}set width(t){this._width=t,this._updateBounds(),this._dirty=!0}get height(){return this._height}set height(t){this._height=t,this._updateBounds(),this._dirty=!0}resize(t,e){this._width=t,this._height=e,this._dirty=!0,this._updateBounds()}get x(){return this._x}set x(t){this._x=t,this._dirty=!0,this._updateBounds()}get y(){return this._y}set y(t){this._y=t,this._dirty=!0,this._updateBounds()}get bounds(){return this._bounds||this._updateBounds(),this._bounds}_updateBounds(){this._bounds=new Yw(this._x,this._y,this._width,this._height)}copyPropertiesTo(t){t.attrs=Object.assign({},this.attrs),t.styles=Object.assign({},this.styles),this._dataScope&&(t._dataScope=this._dataScope.clone()),t.x=this._x,t.y=this._y,t.width=this._width,t.height=this._height,t.src=this._src}};class JA extends kE{constructor(t){super(t)}get x1(){return this.vertices[0].x}get y1(){return this.vertices[0].y}get x2(){return this.vertices[1].x}get y2(){return this.vertices[1].y}get x(){return(this.vertices[0].x+this.vertices[1].x)/2}get y(){return(this.vertices[0].y+this.vertices[1].y)/2}set x(t){let e=t-this.x;this.vertices[0]._x+=e,this.vertices[1]._x+=e,this._dirty=!0}set y(t){let e=t-this.y;this.vertices[0]._y+=e,this.vertices[1]._y+=e,this._dirty=!0}set x1(t){this.vertices[0]._x=t,this._dirty=!0}set x2(t){this.vertices[1]._x=t,this._dirty=!0}set y1(t){this.vertices[0]._y=t,this._dirty=!0}set y2(t){this.vertices[1]._y=t,this._dirty=!0}}class QA extends Kw{constructor(t){super(t),this._type=lT.SimpleText,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._text="text"in t?t.text:"",this._anchor="anchor"in t?t.anchor:[Xw.CENTER,Xw.MIDDLE],this._textPath=void 0,this._textPathOffset="50%","fontSize"in this.styles||(this.styles.fontSize="12px"),"fontFamily"in this.styles||(this.styles.fontFamily="Arial, sans-serif"),"fontWeight"in this.styles||(this.styles.fontWeight="normal"),"fillColor"in this.styles||(this.styles.fillColor="black"),"backgroundColor"in t&&(this._backgroundColor=t.backgroundColor),"borderWidth"in t&&(this._borderWidth=t.borderWidth),"borderColor"in t&&(this._borderColor=t.borderColor),this._rotate="rotate"in t?t.rotate:void 0}hasBackground(){return this._backgroundColor||this._borderStroke||this._borderColor}_updateBounds(){let t,e,n=function(t,e,n){const r=Fw.getSVG(),i=document.createElementNS("http://www.w3.org/2000/svg","text");i.setAttribute("font-family",e),i.setAttribute("font-size",n),i.textContent=t,r.appendChild(i);const o=i.getBBox();return r.removeChild(i),{width:o.width,height:o.height}}(this._text,[this.fontWeight,this.fontSize,this.fontFamily].join(" "),parseFloat(this.fontSize)),r=n.width,i=n.height;switch(this._anchor[0]){case Xw.LEFT:t=this._x;break;case Xw.RIGHT:t=this._x-r;break;case Xw.CENTER:t=this._x-r/2;break;default:t=this._x}switch(this._anchor[1]){case Xw.TOP:e=this._y;break;case Xw.BOTTOM:e=this._y-i;break;case Xw.MIDDLE:default:e=this._y-i/2}if(this._rotate&&3===this._rotate.length){let n=[{x:t,y:e},{x:t+r,y:e},{x:t,y:e+i},{x:t+r,y:e+i}].map(t=>Gw(t.x,t.y,this._rotate[1],this._rotate[2],this._rotate[0])),o=Math.min(...n.map(t=>t.x)),a=Math.max(...n.map(t=>t.x)),s=Math.min(...n.map(t=>t.y)),l=Math.max(...n.map(t=>t.y));this._bounds=new Yw(o,s,a-o,l-s)}else this._bounds=new Yw(t,e,r,i)}get x(){return this._x}set x(t){this._x=t,this._dirty=!0}get y(){return this._y}set y(t){this._y=t,this._dirty=!0}get text(){return this._text}set text(t){this._text=t,this._dirty=!0}get anchor(){return this._anchor}get fontFamily(){return this.styles.fontFamily}get fontSize(){return this.styles.fontSize}get fontWeight(){return this.styles.fontWeight}get textPath(){return this._textPath}set textPath(t){this._textPath=t,this._dirty=!0}get textPathOffset(){return this._textPathOffset}set textPathOffset(t){this._textPathOffset=t,this._dirty=!0}get backgroundColor(){return this._backgroundColor?this._backgroundColor:"#fff"}get borderColor(){return this._borderColor?this._borderColor:"#ccc"}get borderWidth(){return this._borderWidth?this._borderWidth:1}copyPropertiesTo(t){t.styles=Object.assign({},this.styles),this._dataScope&&(t._dataScope=this._dataScope.clone()),t._x=this._x,t._y=this._y,t._text=this._text,t._anchor=[this._anchor[0],this._anchor[1]],t._backgroundColor=this._backgroundColor,t._borderColor=this._borderColor,t._borderStroke=this._borderStroke}}class tT extends kE{constructor(t){super(t),this._type=lT.Polygon,this.closed=!0,"x"in t&&(this._x=t.x),"y"in t&&(this._y=t.y),"radius"in t&&(this._radius=t.radius)}get radius(){return this._radius}get x(){return this._x}get y(){return this._y}set x(t){this._x=t,this._dirty=!0}set y(t){this._y=t,this._dirty=!0}set radius(t){this._radius=t,this._dirty=!0}copyPropertiesTo(t){super.copyPropertiesTo(t),t._x=this._x,t._y=this._y,t._radius=this._radius}}class eT extends kE{constructor(t){super(t),this._type=lT.Ring,this.closed=!0,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._innerRadius="innerRadius"in t?t.innerRadius:100,this._outerRadius="outerRadius"in t?t.outerRadius:200}get innerRadius(){return this._innerRadius}get outerRadius(){return this._outerRadius}get x(){return this._x}get y(){return this._y}get thickness(){return this._outerRadius-this._innerRadius}copyPropertiesTo(t){super.copyPropertiesTo(t),t._x=this._x,t._y=this._y,t._innerRadius=this._innerRadius,t._outerRadius=this._outerRadius}getSVGPathData(){return["M "+this._x+" "+this._y,"m 0, -"+this._outerRadius,"a "+this._outerRadius+","+this._outerRadius+", 0, 1, 0, 1, 0","Z","m 0 "+(this._outerRadius-this._innerRadius),"a "+this._innerRadius+", "+this._innerRadius+", 0, 1, 1, -1, 0","Z"].join(" ")}}class nT extends Kw{constructor(t){super(t),this._type=lT.RichText,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._text="text"in t?t.text:"",this._width="width"in t?t.width:200,this._anchor="anchor"in t?t.anchor:[Xw.CENTER,Xw.MIDDLE],"fontSize"in this.styles||(this.styles.fontSize="12px"),"fontFamily"in this.styles||(this.styles.fontFamily="Arial, sans-serif"),"fontWeight"in this.styles||(this.styles.fontWeight="normal"),"fillColor"in this.styles||(this.styles.fillColor="black"),"backgroundColor"in t&&(this._backgroundColor=t.backgroundColor),"borderWidth"in t&&(this._borderWidth=t.borderWidth),"borderColor"in t&&(this._borderColor=t.borderColor),this._rotate="rotate"in t?t.rotate:void 0}hasBackground(){return this._backgroundColor||this._borderStroke||this._borderColor}_updateBounds(){let t,e,n=function(t,e,n){const r=Fw.getSVG(),i=document.createElementNS("http://www.w3.org/2000/svg","text");i.setAttribute("font-family",e),i.setAttribute("font-size",n),i.textContent=t,r.appendChild(i);const o=i.getBBox();return r.removeChild(i),{width:o.width,height:o.height}}(this._text,[this.fontWeight,this.fontSize,this.fontFamily].join(" "),parseFloat(this.fontSize)),r=n.width,i=n.height;switch(this._anchor[0]){case Xw.LEFT:t=this._x;break;case Xw.RIGHT:t=this._x-r;break;case Xw.CENTER:t=this._x-r/2;break;default:t=this._x}switch(this._anchor[1]){case Xw.TOP:e=this._y;break;case Xw.BOTTOM:e=this._y-i;break;case Xw.MIDDLE:default:e=this._y-i/2}if(this._rotate&&3===this._rotate.length){let n=[{x:t,y:e},{x:t+r,y:e},{x:t,y:e+i},{x:t+r,y:e+i}].map(t=>Gw(t.x,t.y,this._rotate[1],this._rotate[2],this._rotate[0])),o=Math.min(...n.map(t=>t.x)),a=Math.max(...n.map(t=>t.x)),s=Math.min(...n.map(t=>t.y)),l=Math.max(...n.map(t=>t.y));this._bounds=new Yw(o,s,a-o,l-s)}else this._bounds=new Yw(t,e,r,i)}get x(){return this._x}get y(){return this._y}get text(){return this._text}get anchor(){return this._anchor}get fontFamily(){return this.styles.fontFamily}get fontSize(){return this.styles.fontSize}get fontWeight(){return this.styles.fontWeight}get textPath(){return this._textPath}set textPath(t){this._textPath=t,this._dirty=!0}get textPathOffset(){return this._textPathOffset}set textPathOffset(t){this._textPathOffset=t,this._dirty=!0}get backgroundColor(){return this._backgroundColor?this._backgroundColor:"#fff"}get borderColor(){return this._borderColor?this._borderColor:"#ccc"}get borderWidth(){return this._borderWidth?this._borderWidth:1}get width(){return this._width}copyPropertiesTo(t){t.styles=Object.assign({},this.styles),this._dataScope&&(t._dataScope=this._dataScope.clone()),t._x=this._x,t._y=this._y,t._text=this._text,t._anchor=[this._anchor[0],this._anchor[1]],t._backgroundColor=this._backgroundColor,t._borderColor=this._borderColor,t._borderStroke=this._borderStroke}}function rT(t){let e=null;switch(t.type){case lT.Circle:e=new KA(t);break;case lT.Line:var n="x1"in t?t.x1:0,r="y1"in t?t.y1:0,i="x2"in t?t.x2:100,o="y2"in t?t.y2:100;t.vertices=[[n,r],[i,o]],e=new JA(t);break;case lT.Rect:var a="top"in t?t.top:0,s="left"in t?t.left:0,l="width"in t?t.width:50,c="height"in t?t.height:30;t.vertices=[[s,a],[s+l,a],[s+l,a+c],[s,a+c]],e=new vA(t);break;case lT.SimpleText:e=new QA(t);break;case lT.RichText:e=new nT(t);break;case lT.Image:e=new ZA(t);break;case lT.BundledPath:case lT.Chord:case lT.Path:e=new kE(t);break;case lT.Area:e=new xA(t);break;case lT.Ring:e=new eT(t);break;case lT.Arc:e=new IE(t);break;case lT.BezierCurve:"vertices"in t||(t.vertices=[[0,100],[20,120],[80,180],[100,200]]),e=new XA(t);break;case lT.Polygon:e=new tT(t)}return e&&e._updateBounds(),e}function iT(t){let e=new WA;return t.addChild(e),t._itemMap[e.id]=e,e}function oT(t){return new $A(t)}function aT(t){switch(t.type){case lT.Collection:return function(t){let e=iT(t.scene);for(let n=0;n<t.children.length;n++){let r=t.children[n];e.addChild(aT(r))}if(e._classId=t.classId,t._layout){let n=t._layout.clone();e._layout=n,n.group=e}return e._updateBounds(),e}(t);case lT.Glyph:return function(t){let e=new $A;for(let n of t.children)e.addChild(aT(n));e._classId=t.classId,t._dataScope&&(e.dataScope=t._dataScope.clone());return e}(t);default:return function(t){let e=rT({type:t.type});t.copyPropertiesTo(e),e._classId=t.classId,e._bounds=t.bounds.clone(),t._refBounds||(t._refBounds=t.bounds.clone());e._refBounds=t._refBounds.clone(),t.dataScope&&(e._dataScope=t.dataScope.clone());if(t.vertices)for(let n=0;n<t.vertices.length;n++)t.vertices[n].dataScope&&(e.vertices[n]._dataScope=t.vertices[n].dataScope.clone());return e}(t)}}const sT=Object.freeze({Rect:"rect",Circle:"circle",Line:"line",Ring:"ring",Path:"path",Image:"image",SimpleText:"text",RichText:"richText",Arc:"arc",BezierCurve:"bezierCurve",BundledPath:"bundledPath",Chord:"chord"}),lT=Object.freeze({Area:"area",Rect:"rect",Ellipse:"ellipse",Circle:"circle",Pie:"pie",Ring:"ring",Arc:"arc",BezierCurve:"bezierCurve",BundledPath:"bundledPath",Chord:"chord",Line:"line",Path:"path",Image:"image",SimpleText:"text",RichText:"richText",Collection:"collection",Group:"group",Composite:"composite",Scene:"scene",Axis:"axis",Glyph:"glyph",Legend:"legend",Polygon:"polygon",Gridlines:"gridlines",LinearGradient:"LinearGradient",Link:"link",DataTable:"datatable",Layout:"layout",NetworkData:"networkdata",TreeData:"treedata"}),cT=Object.freeze({Axis:"axis",Legend:"legend",Gridlines:"gridlines"});function uT(){return Date.now().toString(36)+"_"+Math.random().toString(36).slice(2)}class hT{constructor(t,e,n){this._id=lT.DataTable+uT(),this.initialize(t,e,n)}initialize(t,e,n){if(this.url=e,this._rawData=JSON.parse(JSON.stringify(t)),this._data=t,this._dateMap=new Map,this._attributes=0===this._data.length?[]:Object.keys(this._data[0]),this._newAttribute=0,n)this._attrTypes=n;else{this._attrTypes={};for(let t of this._attributes)this._attrTypes[t]=XE(this.data.map(e=>e[t])),"year"==t.toLowerCase()&&this._attrTypes[t]==$E.Integer&&(this._attrTypes[t]=$E.Date)}this._validate(this.data,this._attrTypes),this._attrSummaries={};for(let t of this._attributes)this._attrSummaries[t]=ZE(this.data.map(e=>e[t]),this._attrTypes[t]);this._attributes.indexOf(dT)<0&&this._addAttribute(dT,$E.String,this.data.map((t,e)=>"r"+e))}clone(){let t=[];for(let e of this._data)t.push(Object.assign({},e));let e=new hT(t,this.url,Object.assign({},this._attrTypes));return e.sourceDataTable=this,e}get id(){return this._id}get name(){return this.url?function(t){var e=t.indexOf("\\")>=0?t.lastIndexOf("\\"):t.lastIndexOf("/"),n=t.substring(e);0!==n.indexOf("\\")&&0!==n.indexOf("/")||(n=n.substring(1));return n}(this.url):this.id}get data(){return this._data}getEncodableAttributes(t){switch(t){case"x":case"y":case"width":case"height":case"radius":case"fillColor":case"strokeColor":case"text":return this.numericAttributes.concat(this.nonNumericAttributes);default:return this.numericAttributes}}_addAttribute(t,e,n){this._data.forEach((e,r)=>e[t]=n[r]),t!==dT&&this._rawData.forEach((e,r)=>e[t]=n[r]),this._attrTypes[t]=e,this._attributes.push(t),this._attrSummaries[t]=ZE(n,e)}getAttributeType(t){return this._attrTypes[t]}get attributes(){return this._attributes}getAttributeSummary(t){return this._attrSummaries[t]}getAttributeValues(t){return this.data.map(e=>e[t])}getUniqueAttributeValues(t){return this._attrSummaries[t].unique}orderAttributeValues(t,e){this._attrSummaries[t].unique=e}getRowCount(){return this.data.length}hasAttribute(t){return this._attributes.indexOf(t)>=0}parseAttributeAsDate(t,e){let n=ry(e);for(let e of this.data){let r=e[t];null==r||null==r?(r="",e[t]=new Date(1899,11,31).getTime()):e[t]=n(r).getTime(),this._dateMap.set(e[t],r)}this._attrTypes[t]=$E.Date,this._attrSummaries[t]=ZE(this.data.map(e=>e[t]),$E.Date)}getRawValue(t,e){return this.getAttributeType(t)===$E.Date?this._dateMap.get(e).toString():e}get nonNumericAttributes(){let t=[];for(let e in this._attrTypes)this._attrTypes[e]!=$E.Number&&this._attrTypes[e]!=$E.Integer&&e!=hT.RowID&&t.push(e);return t.sort((t,e)=>this.getUniqueAttributeValues(t).length-this.getUniqueAttributeValues(e).length),t}get numericAttributes(){let t=[];for(let e in this._attrTypes)this._attrTypes[e]!==$E.Number&&this._attrTypes[e]!==$E.Integer||e==hT.RowID||t.push(e);return t}getAttributesByType(t){let e=[];for(let n in this._attrTypes)this._attrTypes[n]===t&&n!=hT.RowID&&e.push(n);return e}summarize(){for(let t of this._attributes)this._attrSummaries[t]=ZE(this.data.map(e=>e[t]),this._attrTypes[t])}_validate(t,e){for(let n of t)for(let t in e){let r,i=e[t],o=n[t];if(null==n[t]||null==n[t])switch(i){case $E.Boolean:r=!1;break;case $E.Date:r=new Date(1899,11,31).getTime();break;case $E.String:r="";break;default:r=0}else switch(i){case $E.Boolean:r=o;break;case $E.Date:r=Number.isInteger(o)?new Date(o,0).getTime():new Date(o+"").getTime(),this._dateMap.set(r,o);break;case $E.String:r=o.toString();break;default:r=o}n[t]=r}}}function fT(t){let e=zE(t);if(e)return e.dataTable}const dT="mascot_rowId";function pT(t,e){return fetch(e,{method:t}).then(t=>t.ok?t.text():(console.log(t.status),Promise.reject({status:t.status,statusText:t.statusText}))).catch(t=>(console.log(t),Promise.reject({status:t.status,statusText:t.statusText})))}class gT extends eA{constructor(t,e){super(t),this._elem=e}get element(){return this._elem}}class _T extends eA{constructor(t,e){super(t),this._item=e}get element(){return this._item}}class yT{constructor(t){this._id=t+"_"+uT(),this._type=t,this._vars=[],this._edges=[]}get vars(){return this._vars}get edges(){return this._edges}run(){console.log("-",this._type)}}class mT{constructor(t,e,n=!0){this._id="e_"+uT(),this._fromNode=t,this._toNode=e,this._isDirected=n}get id(){return this._id}get fromNode(){return this._fromNode}get toNode(){return this._toNode}get isDirected(){return this._isDirected}get operator(){return this._fromNode instanceof pE||this._fromNode instanceof yT?this._fromNode:this._toNode}}class bT extends eA{constructor(t,e,n){super(t),this._attribute=e,this._dataset=n}get attribute(){return this._attribute}get dataset(){return this._dataset}}class vT{constructor(t,e){switch(this._id="scale_"+uT(),this._type=t,e&&(this._args=e),t){case"linear":this._scale=gg();break;case"point":this._scale=rg();break;case"ordinal":this._scale=tg();break;case"ordinalColor":this._scale=tg(Nw[e.scheme]);break;case"power":this._scale=Ng().exponent(2);break;case"sqrt":this._scale=Ng().exponent(.5);break;case"log":this._scale=Ag();break;case"identity":case"time":this._scale=Rm();break;case"sequentialColor":e.scheme?this._scale=Im(Nw[e.scheme]):this._scale=Im()}}get id(){return this._id}get domain(){return this._scale.domain()}set domain(t){this._scale.domain(t)}get range(){return this._scale.range()}set range(t){this._scale.range(t)}get rangeExtent(){let t=this._scale.range();return Math.abs(t[1]-t[0])}set rangeExtent(t){let e=this._scale.range();e[0]<e[1]?this._scale.range([e[0],e[0]+t]):this._scale.range([e[1]+t,e[1]])}get type(){return this._type}map(t){return this._scale(t)}invert(t,e){let n=Math.min(...this._scale.range()),r=Math.max(...this._scale.range()),i=t;return e||(i=Math.max(n,Math.min(t,r))),"time"===this._type?this._scale.invert(i).getTime():this._scale.invert(i)}}const xT=["schemeBrBG","schemePRGn","schemePiYG","schemePuOr","schemeRdBu","schemeRdGy","schemeRdYlBu","schemeRdYlGn","schemeSpectral"],wT=["schemeBlues","schemeGreens","schemeGreys","schemeOranges","schemePurples","schemeReds","schemeBuGn","schemeBuPu","schemeGnBu","schemeOrRd","schemePuBuGn","schemePuBu","schemePuRd","schemeRdPu","schemeYlGnBu","schemeYlGn","schemeYlOrBr","schemeYlOrRd"];class ET{constructor(){this._map={}}clear(){this._map={}}setValue(t,e){this._map[t]=e}getValue(t){return this._map[t]}}class AT extends eA{constructor(t,e){super(t),this._encs=[e],this._valueMap=new ET}addLinkedEncoding(t){this._encs.push(t)}get encodings(){return this._encs}get attrValues(){return this._valueMap}set attrValues(t){this._valueMap=t}}class TT extends pE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof AT),e=this.outputVar,n=e.encodings,r=n[0],i=r.channel,o=r.attribute,a=t.encodings[0].dataTable.getAttributeType(t.encodings[0].attribute),s=Object.values(t.attrValues);if("angle"===r.channel&&[lT.Arc,lT.Pie].indexOf(r.element.type)>=0)for(let e of t.encodings)for(let t of e.scales){let n=e.getElements(t).map(t=>e.attrValues[t.id]);t.domain=r._preferredDomain?r._preferredDomain:e.dataTable.tree?[0,e.dataTable.tree.getRoot()[o]]:this._getDomainForNumbers(n),console.log("domain for",o,t.domain)}else{let e;e=r._preferredDomain?r._preferredDomain:a==$E.String||"text"===t.encodings[0].channel?this._getDomainForStrings(s):this._getDomainForNumbers(s);for(let n of t.encodings)for(let t of n.scales)t.domain=e.slice()}for(let t=0;t<r.scales.length;t++){let o=r.scales[t],a=r.getElements(o),s=this._buildRange(i,a,r,e);if(s)for(let e of n)e.scales[t].range=s}e.initialized=!0}_getDomainForNumbers(t){let e=this.outputVar.encodings[0],n=[Math.min(...t),Math.max(...t)];if(e.includeZero&&n[0]>0&&(n=[0,Math.max(...t)]),e.mapping)n=Object.keys(e.mapping),n=n.map(t=>parseFloat(t)),n.sort((t,e)=>t-e);else if("sequentialColor"===e.scales[0].type){if(n[0]<0&&n[1]>0){let t=Math.max(Math.abs(n[0]),Math.abs(n[1]));n=[-t,t]}}else if("angle"===e.channel){let e=Object.values(t).reduce((t,e)=>t+e,0);n=[0,e]}return n}_getDomainForStrings(t){let e,n=this.outputVar,r=n.encodings[0];return e="count"==n.encodings[0].aggregator?[0,Math.max(...t)]:Array.from(new Set(t)),r.mapping&&(e=Object.keys(r.mapping)),e}_buildRange(t,e,n,r){return"x"===t?this._buildXRange(e,n,r):"y"===t?this._buildYRange(e,n,r):["width","height","radius","area","fontSize","radialDistance","strokeWidth"].includes(t)?this._buildSizeRange(e,n,r):t.indexOf("Color")>0||"fillGradient"===t?this._buildColorRange(e,n):"angle"===t?this._buildAngleRange(e,n):"thickness"===t?this._buildThicknessRange(e,n,r):"src"===t?n.scales[0].domain.slice():void 0}_buildThicknessRange(t,e,n){let r=t.map(t=>t.outerRadius-t.innerRadius);return[0,n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:Math.max(...r)]}_buildAngleRange(t,e){return[0,360]}_buildColorRange(t,e){if(e.mapping){return e.scales[0].domain.map(t=>e.mapping[t+""])}if("sequentialColor"===e.scales[0].type){let t=this.outputVar,n=e.scales[0].domain;for(let r of t.encodings)if(!e.colorScheme)for(let t of r.scales){let e=t.domain;t._scale=Im(n[0]<0&&n[1]>0?rb:rv),t._scale.domain(e)}}if((xT.indexOf(e.colorScheme)>=0||wT.indexOf(e.colorScheme)>=0)&&"ordinalColor"===e.scales[0].type){let t=this.outputVar,n=e.scales[0].domain;for(let r of t.encodings)for(let t of r.scales){let r=t.domain;t._scale=tg(Nw[e.colorScheme][n.length]),t._scale.domain(r)}}}_buildSizeRange(t,e,n){let r,i;return r=0,i=n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:Math.max(...t.map(t=>"radius"===e.channel?t.refBounds.width/2:"strokeWidth"===e.channel?t.strokeWidth:"radialDistance"===e.channel?t.parent.radius:"area"===e.channel?t.type===lT.Circle?Math.PI*Math.pow(t.radius,2):t.width*t.height:"fontSize"===e.channel?parseFloat(t.fontSize):t.refBounds[e.channel])),[0,0+i]}_buildXRange(t,e,n){let r,i;switch(e.scales[0].type,t[0].type){case"vertex":case"segment":var o=t[0].parent.refBounds?t[0].parent.refBounds:t[0].parent.bounds;r=n.initialized?e.getRangeStart(t[0]):o.left,i=n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:o.width;break;default:r=n.initialized?e.getRangeStart(t[0]):e._preferredRangeStart?e._preferredRangeStart:sE(t[0]).bounds.left+t[0].bounds.width/2,i=n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:Math.max(450,Math.max(...t.map(t=>t.bounds.x))-Math.min(...t.map(t=>t.bounds.x)))}return e.flipScale?[r+i,r]:[r,r+i]}_buildYRange(t,e,n){let r,i;switch(e.scales[0].type,t[0].type){case"vertex":case"segment":var o=t[0].parent.refBounds?t[0].parent.refBounds:t[0].parent.bounds;r=n.initialized?e.getRangeStart(t[0]):o.top,i=n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:o.height;break;default:r=n.initialized?e.getRangeStart(t[0]):sE(t[0]).bounds.top+t[0].bounds.height/2,i=n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:450}return e.flipScale?[r,r+i]:[r+i,r]}}class ST extends pE{constructor(t){super(t)}run(){super.run()}}class CT extends qA{constructor(t){super(),this._type=lT.Axis,this._id=t.id?t.id:this._type+uT(),this._attribute=void 0,this._channel=void 0,this._orientation=void 0,this._strokeColor="strokeColor"in t?t.strokeColor:"#555",this._textColor="textColor"in t?t.textColor:"#555",this._fontSize="fontSize"in t?t.fontSize:"12px",this._tickOffset="tickOffset"in t?t.tickOffset:0,this._tickSize="tickSize"in t?t.tickSize:5,this._tickAnchor=t.tickAnchor,this._tickVisible=!("tickVisible"in t)||t.tickVisible,this._pathVisible=!("pathVisible"in t)||t.pathVisible,this._labelVisible=!("labelVisible"in t)||t.labelVisible,this._labelOffset="labelOffset"in t?t.labelOffset:this._tickSize+this._tickOffset+3,this._labelFormat="labelFormat"in t?t.labelFormat:"",this._titleOffset="titleOffset"in t?t.titleOffset:40,this._rotateYTitle=!("rotateTitle"in t&&!t.rotateTitle),this._showTitle=!("titleVisible"in t)||t.titleVisible,this._labelRotation="labelRotation"in t?t.labelRotation:0,this._ticks=new qA,this._ticks._id=this._id+"_ticks",this.addChild(this._ticks),this._labels=new qA,this._labels._id=this._id+"_labels",this.addChild(this._labels),this._title=new QA({text:this._titleText,fillColor:this._textColor,fontWeight:"bold"}),this._title._id=this.id+"_title",this.addChild(this._title),this._showTitle||(this._title.visibility="hidden"),this._pathPos=void 0,this._args=t}get id(){return this._id}get pathPos(){return this._pathPos}get attribute(){return this._attribute}get channel(){return this._channel}get orientation(){return this._orientation}get tickSize(){return this._tickSize}get tickOffset(){return this._tickOffset}get tickAnchor(){return this._tickAnchor?this._tickAnchor:"x"===this._channel||"width"===this._channel?"center":"middle"}get labelOffset(){return this._labelOffset}get tickValues(){return this._tickValues}get labelValues(){return this._labelValues}get titleOffset(){return this._titleOffset}get boundsWithoutTitle(){let t=this.children.filter(t=>t.type!==lT.SimpleText),e=t[0].bounds.clone();for(let n=1;n<t.length;n++)"hidden"!=t[n].visibility&&(e=e.union(t[n].bounds));return e}}const kT="top",MT="bottom",RT="left";function OT(t,e,n,r){let i,o=t.domain,a=t.range;switch(t.type){case"linear":case"log":{let s=Math.abs(a[0]-a[1]);i="width"==e||"x"==e?45:30;let l,c=Math.max(2,Math.floor(s/i));if("width"==e||"height"==e){let i=!!r&&(r.elements[0].parent.layout&&r.elements[0].parent.layout.type==fE.STACK);o[1]=t._scale.invert(i?Ww(n)[e]:qw(n)[e])}if("log"===t.type){l=[];let e=t._scale.ticks();for(let t of e){let n=Math.log(t)/Math.log(10)+1e-6;Math.abs(n-Math.floor(n))<c/e.length&&l.push(t)}}else l=W(o[0],o[1],c);return l}case"point":{i="width"==e||"x"==e?80:30;let n=Math.floor(t.rangeExtent/o.length),r=Math.ceil(i/n);return"x"==e?o.filter((t,e)=>e%r==0):o}case"time":{i="width"==e||"x"==e?80:30;let t,n,r=Math.floor((a[1]-a[0])/i),s=Math.ceil((o[1]-o[0])/r)/1e3,l=[1,60,3600,86400,2628003,31536e3],c=[Wg,Xg,Qg,r_,z_,U_];for(let e=0;e<l.length-1;e++)if(s>=l[e]&&s<l[e+1])return t=Math.floor(s/l[e]),n=c[e],n(o[0],o[1],t);return s>l[l.length-1]?(t=Math.floor(s/l[l.length-1]),n=c[l.length-1],n(o[0],o[1],t)):[]}default:return[]}}function NT(t,e){e.removeChild(t)}class IT extends CT{constructor(t,e,n,r){super(r),this._encoding=t,this._attribute=this._encoding.attribute,this._channel=this._encoding.channel,this._scale=e,this._elems=n,this._flip="flip"in r&&r.flip,this._posArg="x"==this._channel||"width"==this._channel?r.pathY:r.pathX,this._orientation="orientation"in r?r.orientation:"x"===this._channel||"width"==this._channel?MT:RT,this._titleText="title"in r?r.title:this._encoding.attribute,this._path="angle"===this._channel?new KA({strokeColor:this._strokeColor,id:this._id+"_path"}):new kE({strokeColor:this._strokeColor,id:this._id+"_path"}),this._pathVisible||(this._path.visibility="hidden"),this.addChild(this._path),this.createTicksLabels(r),t.dataTable.getAttributeType(this._attribute)!==$E.Date||"labelFormat"in r||(this._labelFormat="%m/%d/%y"),"radialDistance"===this._channel&&"rotation"in r&&(this._rotate=[-r.rotation,this._elems[0].parent.x,this._elems[0].parent.y])}isFlipped(){return this._flip}get elements(){return this._elems}get scale(){return this._scale}get encoding(){return this._encoding}createTicksLabels(t){"tickValues"in t?(this._tickValues=t.tickValues,this._labelValues=t.tickValues):(this._tickValues=OT(this._scale,this._channel,this._elems,this),this._labelValues=this._tickValues),this._ticks.removeAll();for(let t=0;t<this._tickValues.length;t++){let e=new kE({strokeColor:this._strokeColor,id:this._id+"_tick"+t});this._tickVisible||(e.visibility="hidden"),this._ticks.addChild(e)}let e;switch(this._labels.removeAll(),this._encoding.dataTable.getAttributeType(this._attribute)){case $E.Date:e=iy(this._labelFormat);break;case $E.String:e=function(t){return t};break;default:e=Hl(this._labelFormat)}for(let[t,n]of this._labelValues.entries()){let r=new QA({text:e(n),fontSize:this._fontSize,fillColor:this._textColor,id:this._id+"_label"+t});this._labelVisible||(r.visibility="hidden"),this._labels.addChild(r)}this._title._text=this._titleText}}class LT extends CT{constructor(t,e,n,r){super(r),this._elems=t,this._attribute=n,this._channel=e,this._posArg="x"==this._channel||"width"==this._channel?r.pathY:r.pathX,this._labelAttribute=r.labelAttribute,this._orientation="orientation"in r?r.orientation:"x"===this._channel||"width"==this._channel?MT:RT,this._titleText="title"in r?r.title:this._attribute,this._path="angle"===this._channel?new KA({strokeColor:this._strokeColor,id:this._id+"_path"}):new kE({strokeColor:this._strokeColor,id:this._id+"_path"}),this._pathVisible||(this._path.visibility="hidden"),this.addChild(this._path),this.createTicksLabels(r),this._elems[0].dataScope.dataTable.getAttributeType(this._attribute)!==$E.Date||"labelFormat"in r||(this._labelFormat="%m/%d/%y")}get elements(){if(this.layout.type===fE.CLUSTER){const t=new Map(this._elems.map(t=>[t.dataScope.getAttrVal(qE),t]));return this.layout._d3Root.leaves().map(e=>t.get(e.data[qE]))}return this._elems}get layout(){return this._elems[0].parent.layout}createTicksLabels(t){"tickValues"in t?(this._tickValues=t.tickValues,this._labelValues=t.tickValues):(this._tickValues=this.elements.map(t=>t.dataScope.getAttrVal(this._labelAttribute?this._labelAttribute:this._attribute)),this._labelValues=this._tickValues),this._ticks.removeAll();for(let t=0;t<this._tickValues.length;t++){let e=new kE({strokeColor:this._strokeColor,id:this._id+"_tick"+t});this._tickVisible||(e.visibility="hidden"),this._ticks.addChild(e)}let e;switch(this._labels.removeAll(),this._elems[0].dataScope.dataTable.getAttributeType(this._labelAttribute?this._labelAttribute:this._attribute)){case $E.Date:e=ny(this._labelFormat);break;case $E.String:e=function(t){return t};break;default:e=Hl(this._labelFormat)}for(let[t,n]of this._labelValues.entries()){let r=new QA({text:e(n),fontSize:this._fontSize,fillColor:this._textColor,id:this._id+"_label"+t});this._labels.addChild(r)}this._title._text=this._titleText}}class PT extends pE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof TA&&t.property==kA.AXIS_ORIENTATION).element;t.createTicksLabels(t._args),t instanceof IT?this._runForEncoding(t):t instanceof LT&&this._runForLayout(t),$w(t._path)}_runForLayout(t){let e=t.channel,n=t.elements[0].parent.layout&&t.elements[0].parent.layout.type==fE.STACK?Ww(t.elements):qw(t.elements),r=[];if("x"===e){let e=t.orientation===kT?n.top-2:n.bottom+2;t._pathPos=t._posArg?t._posArg:e,r.push([n.left,t._pathPos]),r.push([n.right,t._pathPos]),t._path._setVertices(r)}else if("y"===e){let e=t.orientation===RT?n.left-2:n.right+2;t._pathPos=t._posArg?t._posArg:e,r.push([t._pathPos,n.top]),r.push([t._pathPos,n.bottom]),t._path._setVertices(r)}else if("angle"===e){let e=t.elements[0].parent.layout;e.type===fE.CLUSTER&&(t._path._x=e.x,t._path._y=e.y,t._path._radius=e.radius)}}_runForEncoding(t){let e=t.channel,n=t.elements,r=n[0].parent.layout&&n[0].parent.layout.type==fE.STACK?Ww(n):qw(n),i=[],o=sE(n[0]);if(o&&o.clipMask&&(r=o.clipMask),"x"===e){let e,o,a=lA(n[0],"y");a?(e=Math.min(...a.getScale(n[0]).range,r.top),o=Math.max(...a.getScale(n[0]).range,r.bottom)):(e=r.top,o=r.bottom);let s=t.orientation===kT?e-2:o+2;t._pathPos=t._posArg?t._posArg:s,i.push([t.scale.range[0],t._pathPos]),i.push([t.scale.range[1],t._pathPos])}else if("width"===e){let e=t.orientation===kT?r.top-2:r.bottom+2;t._pathPos=t._posArg?t._posArg:e,i.push([r.left,t._pathPos]),i.push([r.right,t._pathPos])}else if("radialDistance"===e){let e=t.elements[0].parent,n=e.y;t._pathPos=t._posArg?t._posArg:n,i.push([t.scale.range[0]+e.x,t._pathPos]),i.push([t.scale.range[1]+e.x,t._pathPos])}else if("y"===e){let e,o,a=lA(n[0],"x");a?(e=Math.min(...a.getScale(n[0]).range,r.left),o=Math.max(...a.getScale(n[0]).range,r.right)):(e=r.left,o=r.right);let s=t.orientation===RT?e-2:o+2;t._pathPos=t._posArg?t._posArg:s,i.push([t._pathPos,t.scale.range[0]]),i.push([t._pathPos,t.scale.range[1]])}else if("height"===e){let e=t.orientation===RT?r.left-2:r.right+2;t._pathPos=t._posArg?t._posArg:e,i.push([t._pathPos,r.bottom]),i.push([t._pathPos,r.top])}t._path._setVertices(i)}}class VT extends pE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof TA&&t.property==kA.AXIS_PATH_POSITION).element;t instanceof IT?this._runForEncoding(t):t instanceof LT&&this._runForLayout(t);let e=[];if("width"===t.channel||"x"===t.channel){let n=t._ticks.children.map(t=>t.vertices[0].x),r=[t._path.vertices[0].x,t._path.vertices[1].x];e.push([Math.min(...n.concat(r)),t._path.vertices[0].y]),e.push([Math.max(...n.concat(r)),t._path.vertices[0].y]),t._path._setVertices(e)}else if("height"===t.channel||"y"===t.channel){let n=t._ticks.children.map(t=>t.vertices[0].y),r=[t._path.vertices[0].y,t._path.vertices[1].y];e.push([t._pathPos,Math.min(...n.concat(r))]),e.push([t._pathPos,Math.max(...n.concat(r))]),t._path._setVertices(e)}for(let e of t._ticks.children)e._updateBounds();$w(t._ticks)}_runForLayout(t){let e=t.channel;if("x"==e){let e=t.orientation==MT?t.pathPos+t.tickOffset:t.pathPos-t.tickOffset,n=t.orientation==MT?t.tickSize:-t.tickSize;for(let[r,i]of t._ticks.children.entries()){let o=t.elements[r].bounds[t.tickAnchor];i._setVertices([[o,e],[o,e+n]])}}else if("y"===e){let e=t.orientation==RT?t.pathPos-t.tickOffset:t.pathPos+t.tickOffset,n=t.orientation==RT?-t.tickSize:t.tickSize;for(let[r,i]of t._ticks.children.entries()){let o=t.elements[r].bounds[t.tickAnchor];i._setVertices([[e,o],[e+n,o]])}}else if("angle"===e){let e=t.elements[0].parent.layout;if(e.type===fE.CLUSTER){let n=e._d3Root.leaves();const r=new Map(n.map(t=>[t.data[qE],[t.x,t.y]]));for(let[n,i]of t._ticks.children.entries()){let o=t.elements[n].dataScope.getAttrVal(qE),a=PE(r.get(o)[0])-90;i._setVertices([[e.x+r.get(o)[1]+t.elements[n].bounds.width/2,e.y],[e.x+r.get(o)[1]+t.elements[n].bounds.width/2+t.tickSize,e.y]]),i._rotate=[a,e.x,e.y]}}}}_runForEncoding(t){let e=t.channel,n=qw(t.elements);if("x"==e){let e=t.orientation==MT?t.pathPos+t.tickOffset:t.pathPos-t.tickOffset,n=t.orientation==MT?t.tickSize:-t.tickSize;for(let[r,i]of t._ticks.children.entries())i._setVertices([[t.scale.map(t._tickValues[r]),e],[t.scale.map(t._tickValues[r]),e+n]])}else if("width"==e){let e=t.orientation==MT?t.pathPos+t.tickOffset:t.pathPos-t.tickOffset,r=t.orientation==MT?t.tickSize:-t.tickSize;if(!!(t.isFlipped()||t.elements[0].type===lT.Area&&"right"===t.elements[0].baseline))for(let[i,o]of t._ticks.children.entries())o._setVertices([[n.left+t.scale.rangeExtent-t.scale.map(t._tickValues[i]),e],[n.left+t.scale.rangeExtent-t.scale.map(t._tickValues[i]),e+r]]);else for(let[i,o]of t._ticks.children.entries())o._setVertices([[t.scale.map(t._tickValues[i])+n.left,e],[t.scale.map(t._tickValues[i])+n.left,e+r]])}else if("y"===e){let e=t.orientation==RT?t.pathPos-t.tickOffset:t.pathPos+t.tickOffset,n=t.orientation==RT?-t.tickSize:t.tickSize;for(let[r,i]of t._ticks.children.entries())i._setVertices([[e,t.scale.map(t._tickValues[r])],[e+n,t.scale.map(t._tickValues[r])]])}else if("height"===e){let e=t.orientation==RT?t.pathPos-t.tickOffset:t.pathPos+t.tickOffset,r=t.orientation==RT?-t.tickSize:t.tickSize;if(!!(t.isFlipped()||t.elements[0].type===lT.Area&&"top"===t.elements[0].baseline))for(let[i,o]of t._ticks.children.entries())o._setVertices([[e,n.top+t.scale.map(t._tickValues[i])],[e+r,n.top+t.scale.map(t._tickValues[i])]]);else for(let[i,o]of t._ticks.children.entries()){let a=n.bottom-t.scale.map(t._tickValues[i]);o._setVertices([[e,a],[e+r,a]])}}else if("radialDistance"===e){let e=t.orientation==MT?t.pathPos+t.tickOffset:t.pathPos-t.tickOffset,n=t.orientation==MT?t.tickSize:-t.tickSize,r=t.elements[0].parent;for(let[i,o]of t._ticks.children.entries())o._setVertices([[r.x+t.scale.map(t._tickValues[i]),e],[r.x+t.scale.map(t._tickValues[i]),e+n]])}}}class DT extends pE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof TA&&t.property==kA.AXIS_PATH_POSITION).element;t instanceof IT?this._runForEncoding(t):t instanceof LT&&this._runForLayout(t);for(let e of t._labels.children)e._updateBounds();$w(t._labels)}_runForLayout(t){let e=t.channel;if("x"==e){let e=t.orientation==MT?t.labelOffset:-t.labelOffset,n=t.orientation==MT?[Xw.CENTER,Xw.TOP]:[Xw.CENTER,Xw.BOTTOM];for(let[r,i]of t._labels.children.entries()){let o=t.elements[r].bounds;i.x=o[t.tickAnchor],i._y=t.pathPos+e,i._anchor=n,t._labelRotation&&(i._rotate=[t._labelRotation,i.x,i.y],i._anchor=[Xw.RIGHT,Xw.MIDDLE])}}else if("y"===e){let e=t.orientation==RT?-t.labelOffset:t.labelOffset,n=t.orientation==RT?[Xw.RIGHT,Xw.MIDDLE]:[Xw.LEFT,Xw.MIDDLE];for(let[r,i]of t._labels.children.entries()){let o=t.elements[r].bounds;i.x=t.pathPos+e,i._y=t.tickAnchor==Xw.MIDDLE?o.y:o[t.tickAnchor],i._anchor=n,t._labelRotation&&(i._rotate=[t._labelRotation,i.x,i.y],i._anchor=[Xw.RIGHT,n[1]])}}else if("angle"===e){let e=t.elements[0].parent.layout;if(e.type===fE.CLUSTER){let n=e._d3Root.leaves();const r=new Map(n.map(t=>[t.data[qE],[t.x,t.y]]));let i=5;for(let[n,o]of t._labels.children.entries()){let a=t.elements[n].dataScope.getAttrVal(qE);if(r.get(a)[0]<Math.PI){let s=PE(r.get(a)[0])-90;o._anchor=[Xw.LEFT,Xw.MIDDLE],o.x=e.x+r.get(a)[1]+t.elements[n].bounds.width/2+i,o._y=e.y,o._rotate=[s,e.x,e.y]}else{let s=PE(r.get(a)[0])+90;o._anchor=[Xw.RIGHT,Xw.MIDDLE],o.x=e.x-r.get(a)[1]-t.elements[n].bounds.width/2-i,o._y=e.y,o._rotate=[s,e.x,e.y]}}}}}_runForEncoding(t){let e=t.channel,n=qw(t.elements);if("x"==e){let e=t.orientation==MT?t.labelOffset:-t.labelOffset,n=t.orientation==MT?[Xw.CENTER,Xw.TOP]:[Xw.CENTER,Xw.BOTTOM];for(let[r,i]of t._labels.children.entries())i.x=t.scale.map(t.labelValues[r]),i._y=t.pathPos+e,i._anchor=n,t._labelRotation&&(i._rotate=[t._labelRotation,i.x,i.y],i._anchor=[Xw.RIGHT,n[1]])}else if("width"===e){let e=t.orientation==MT?t.labelOffset:-t.labelOffset,r=t.orientation==MT?[Xw.CENTER,Xw.TOP]:[Xw.CENTER,Xw.BOTTOM],i=!!(t.isFlipped()||t.elements[0].type===lT.Area&&"right"===t.elements[0].baseline);for(let[o,a]of t._labels.children.entries())a.x=i?n.left+t.scale.rangeExtent-t.scale.map(t.labelValues[o]):t.scale.map(t.labelValues[o])+n.left,a._y=t.pathPos+e,a._anchor=r,t._labelRotation&&(a._rotate=[t._labelRotation,a.x,a.y],a._anchor=[Xw.RIGHT,r[1]])}else if("y"===e){let e=t.orientation==RT?-t.labelOffset:t.labelOffset,n=t.orientation==RT?[Xw.RIGHT,Xw.MIDDLE]:[Xw.LEFT,Xw.MIDDLE];for(let[r,i]of t._labels.children.entries())i.x=t.pathPos+e,i._y=t.scale.map(t.labelValues[r]),i._anchor=n,t._labelRotation&&(i._rotate=[t._labelRotation,i.x,i.y],i._anchor=[Xw.RIGHT,n[1]])}else if("height"===e){let e=t.orientation==RT?-t.labelOffset:t.labelOffset,r=t.orientation==RT?[Xw.RIGHT,Xw.MIDDLE]:[Xw.LEFT,Xw.MIDDLE],i=t.elements[0].type===lT.Area&&"top"===t.elements[0].baseline;for(let[o,a]of t._labels.children.entries())a.x=t.pathPos+e,a._y=i?n.top+t.scale.map(t.labelValues[o]):n.bottom-t.scale.map(t.labelValues[o]),a._anchor=r,t._labelRotation&&(a._rotate=[t._labelRotation,a.x,a.y],a._anchor=[Xw.RIGHT,r[1]])}else if("radialDistance"==e){let e=t.orientation==MT?t.labelOffset:-t.labelOffset,n=t.orientation==MT?[Xw.CENTER,Xw.TOP]:[Xw.CENTER,Xw.BOTTOM],r=t.elements[0].parent;for(let[i,o]of t._labels.children.entries())o.x=r.x+t.scale.map(t.labelValues[i]),o._y=t.pathPos+e,o._anchor=n,t._labelRotation&&(o._rotate=[t._labelRotation,o.x,o.y],o._anchor=[Xw.RIGHT,n[1]])}}}class BT extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){let e=t.layout;if(!e)return;this.fillGrid(t,e),this.computeCellBounds(t,e),this.placeElements(t,e)}let n=lE(t,!0);for(let t of n)$w(t)}placeElements(t,e){let n=uA(t,"x"),r=uA(t,"y");for(let n=0;n<t.children.length;n++){let r=t.children[n],i=e.cellBounds[n],o=0,a=0;switch(e._cellHorzAlignment){case Xw.LEFT:o=i.left-r.refBounds.left;break;case Xw.CENTER:o=i.x-r.refBounds.x;break;case Xw.RIGHT:o=i.right-r.refBounds.right}switch(e._cellVertAlignment){case Xw.TOP:a=i.top-r.refBounds.top;break;case Xw.MIDDLE:a=i.y-r.refBounds.y;break;case Xw.BOTTOM:a=i.bottom-r.refBounds.bottom}pA(r,o,a)}if(n.length>0)for(let t of n)for(let n of t.scales){let r=t.getElements(n)[0],i=e.getIndex(r);if(i<0)continue;let o="point"===n.type?e.cellBounds[i].left+r.bounds.width/2:e.cellBounds[i].left,a=o+n.rangeExtent;n.range=n.range[0]<n.range[1]?[o,a]:[a,o]}if(r.length>0)for(let t of r)for(let n of t.scales){let r=t.getElements(n)[0],i=e.getIndex(r);if(i<0)continue;let o="point"===n.type?e.cellBounds[i].top+t.getElements(n)[0].bounds.height/2:e.cellBounds[i].top,a=o+n.rangeExtent;n.range=n.range[0]<n.range[1]?[o,a]:[a,o]}}fillGrid(t,e){e._grid=new Array(e.numRows).fill(null).map(()=>new Array(e.numCols).fill(null));for(let n=0;n<t.children.length;n++){let t=e.getRowCol(n);e._grid[t.row][t.col]=n}}computeCellBounds(t,e){let n=t.children.map(t=>t.refBounds?t.refBounds:t.bounds),r=e._colGap,i=e._rowGap;if(void 0===e._left){let t=n.map(t=>t.left),r=n.map(t=>t.top);e._left=Math.min(...t),e._top=Math.min(...r)}let o=n.map(t=>t.width),a=n.map(t=>t.height),s=Math.max(...o),l=Math.max(...a);e._cellBounds=new Array(t.children.length).fill(null);for(let n=0;n<e.numRows;n++)for(let o=0;o<e.numCols;o++){let a=e._grid[n][o];a>=t.children.length||(e._cellBounds[a]=new Yw(e._left+(s+r)*o+0,e._top+(l+i)*n,s,l))}}}class zT extends pE{constructor(t){super(t)}run(){let t=this.outputVar.element;t.updateValues(),t.scale?this._runForEncoding(t):this._runForLayout(t),$w(t)}_runForLayout(t){let e=t.channel,n=qw(t.elements),r=[];if("x"===e)for(let e=0;e<t.values.length;e++){let i=t.elements[e].refBounds;r.push({x1:i.x,y1:n.bottom,x2:i.x,y2:n.top})}else if("y"===e)for(let e=0;e<t.values.length;e++){let i=t.elements[e].refBounds;r.push({x1:n.left,y1:i.y,x2:n.right,y2:i.y})}t.lines=r,t._dirty=!0}_runForEncoding(t){let e=t.channel,n=qw(t.elements),r=[];if("x"===e){let e,i,o=lA(t.elements[0],"y");o?(e=Math.min(...o.getScale(t.elements[0]).range,n.top),i=Math.max(...o.getScale(t.elements[0]).range,n.bottom)):(e=n.top,i=n.bottom);for(let n of t.values)r.push({x1:t.scale.map(n),y1:i,x2:t.scale.map(n),y2:e})}else if("width"===e)for(let e of t.values)r.push({x1:t.scale.map(e)+n.left,y1:n.bottom,x2:t.scale.map(e)+n.left,y2:n.top});else if("y"===e){let e,i,o=lA(t.elements[0],"x");o?(e=Math.min(...o.getScale(t.elements[0]).range,n.left),i=Math.max(...o.getScale(t.elements[0]).range,n.right)):(e=n.top,i=n.bottom);for(let n of t.values)r.push({x1:e,y1:t.scale.map(n),x2:i,y2:t.scale.map(n)})}else if("height"===e)for(let e of t.values)r.push({x1:n.left,y1:n.bottom-t.scale.map(e),x2:n.right,y2:n.bottom-t.scale.map(e)});else if("radialDistance"===e){let e=t.elements[0].parent;for(let n=0;n<t.values.length;n++)r.push({x:e.x,y:e.y,r:t.scale.map(t.values[n])})}t.lines=r,t._dirty=!0}}class FT extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=lE(t)[0],n=Qw(t.parent);for(let t of n){let n=t.layout;if(!n)return;switch(e.type){case lT.Rect:case lT.Circle:case lT.Image:this._stackRects(t,n);break;case lT.Area:t.children[0].orientation===bE?this._stackAreasVert(t,n):this._stackAreasHorz(t,n);break;case lT.Arc:case lT.Pie:e.parent.classId===t.classId&&this._stackArcs(t,n)}}$w(e)}_stackArcs(t,e){if(e.orientation===xE){let e=90;if((this._direction?this._direction:AE.Clockwise)===AE.Clockwise)for(let n of t.children){let t=VE(e-n.angle);_A(n,"startAngle",t),e=t}else for(let n of t.children){let t=VE(e+n.angle);_A(n,"startAngle",t),e=t}}else if(e.orientation===wE){let e=Math.min(...t.children.map(t=>t.innerRadius));for(let n of t.children){let t=n.outerRadius-n.innerRadius;_A(n,"innerRadius",e),_A(n,"outerRadius",e+t),e=n._outerRadius}}}_stackAreasVert(t,e){let n=t.children.filter(t=>"visible"===t.visibility),r=t.bounds,i=e.vertCellAlignment===Xw.TOP?r.top:r.bottom,o=e.vertCellAlignment===Xw.TOP?1:-1;if(0===n.length)return;e.vertCellAlignment===Xw.BOTTOM&&n.reverse();let a=n[0].vertices.length/2,s=new Array(a).fill(0);for(let t of n){for(let e=0;e<a;e++){let n=t.vertices[e],r=t.vertices[2*a-e-1],l=Math.abs(n.y-r.y),c=i+s[e]*o,u=i+(s[e]+l)*o;pA(n,0,c-n.y),pA(r,0,u-r.y),s[e]+=l}let e=t.bounds.bottom;t._updateBounds(),t._refBounds.translate(0,t.bounds.bottom-e)}if(e.vertCellAlignment===Xw.MIDDLE)for(let t of n){for(let e=0;e<a;e++){let n=t.vertices[e],i=t.vertices[2*a-e-1],o=r.middle+s[e]/2;pA(n,0,o-r.bottom),pA(i,0,o-r.bottom)}let e=t.bounds.bottom;t._updateBounds(),t._refBounds.translate(0,t.bounds.bottom-e)}}_stackAreasHorz(t,e){}_stackRects(t,e){t.scene;let n=e._orientation,r=t.children.map(t=>t.bounds),i=r.map(t=>t.left),o=r.map(t=>t.top),a=r.map(t=>t.width),s=r.map(t=>t.height),l=null==e._left?Math.min(...i):e._left,c=null==e._top?Math.min(...o):e._top,u=Math.max(...a),h=Math.max(...s);if(n==vE)for(let n=0;n<t.children.length;n++){let r=t.children[n],i=0,o=c+r.bounds.height/2-r.bounds.y;c+=r.bounds.height+e._gap,pA(r,i,o),r._updateBounds();let a=0,s=0;if(!fA(r))switch(e._horzCellAlignment){case Xw.LEFT:a=l-r.bounds.left;break;case Xw.CENTER:a=l+u/2-r.bounds.x;break;case Xw.RIGHT:a=l+u-r.bounds.right}pA(r,a,s)}else for(let n=0;n<t.children.length;n++){let r=t.children[n],i=l+r.bounds.width/2-r.bounds.x,o=0;l+=r.bounds.width+e._gap,pA(r,i,o),r._updateBounds();let a=0,s=0;if(!hA(r))switch(e._vertCellAlignment){case Xw.TOP:s=c-r.bounds.top;break;case Xw.MIDDLE:s=c+h/2-r.bounds.y;break;case Xw.BOTTOM:s=c+h-r.bounds.bottom}pA(r,a,s)}}}class GT extends pE{constructor(t){super(t)}run(){super.run()}}class jT extends pE{constructor(t){super(t)}run(){let t=this.inputVars[0],e=this.outputVar,n=t.attribute,r=e.attribute,i=t.dataset,o=e.dataset,a=i.getAttributeValues(n),s=J()(a),l=this._findBin,c=a.map(t=>{let e=l(t,s);return(e.x0+e.x1)/2+""}),u=s.map(t=>(t.x0+t.x1)/2+"");o._addAttribute(r,$E.String,c),o.orderAttributeValues(r,u)}_findBin(t,e){for(let n of e)if(n.indexOf(t)>=0)return n}}class UT extends pE{constructor(t){super(t)}run(){let t=this.outputVar,e=t.dataset,n=t.predicate,r=[];for(let[t,i]of e.data.entries())n.testTuple(i)||r.push(t);r.sort((t,e)=>e-t),r.forEach(t=>{t>=0&&t<e.data.length&&(e._data.splice(t,1),e._rawData.splice(t,1))});for(let t of e._attributes)e._attrSummaries[t]=ZE(e.data.map(e=>e[t]),e._attrTypes[t])}}class YT extends pE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t.type===nA.AFFIXATION).affixation,e=t.base,n=t.element,r=Qw(e),i=Qw(n),o=t.channels,a=t.attribute;if(Zw(n)&&Zw(e)){let t=r.map(t=>t.dataScope.getAttrVal(a));i=i.filter(e=>t.includes(e.dataScope.getAttrVal(a)));let e=(t,e)=>t.dataScope.getAttrVal(a)<e.dataScope.getAttrVal(a)?-1:t.dataScope.getAttrVal(a)>e.dataScope.getAttrVal(a)?1:0;i.sort(e),r.sort(e)}if(o.includes("x")||o.includes("y"))for(let e of o)this._handleXY(e,i,r,t.getElementAnchor(e),t.getBaseAnchor(e),t.getOffset(e));(o.includes("radialDistance")||o.includes("angle"))&&this._handlePolar(i,r,t);let s=lE(n,!0);for(let t of s)$w(t)}_handlePolar(t,e,n){let r=n.hasChannel("radialDistance")?n.getBaseAnchor("radialDistance"):Xw.MIDDLE,i=n.hasChannel("radialDistance")?n.getElementAnchor("radialDistance"):Xw.MIDDLE,o=n.hasChannel("angle")?n.getBaseAnchor("angle"):Xw.CENTER;n.hasChannel("angle")?n.getElementAnchor("angle"):Xw.CENTER;let a=n.hasChannel("radialDistance")?n.getOffset("radialDistance"):0,s=n.hasChannel("angle")?n.getOffset("angle"):0;if([lT.Arc,lT.Ring].indexOf(e[0].type)>=0&&t[0].type==lT.SimpleText)for(let n=0;n<t.length;n++){let i=e[n],s=t[n],l=r===Xw.MIDDLE?(i.outerRadius+i.innerRadius)/2:r===Xw.TOP?i.outerRadius-5:i.innerRadius+5;if(l+=a,i.type===lT.Arc){let t=QE(i.x,i.y,l,i.startAngle),e=QE(i.x,i.y,l,i.endAngle);i.endAngle>=180&&i.endAngle<=360?s._textPath=["M",t[0],t[1],"A",l,l,i.angle,i.angle>=180?1:0,0,e[0],e[1]].join(" "):s._textPath=["M",e[0],e[1],"A",l,l,i.angle,i.angle>=180?1:0,1,t[0],t[1]].join(" ")}else if(i.type===lT.Ring){let t=275,e=265,n=350,r=QE(i.x,i.y,l,t),o=QE(i.x,i.y,l,e);s._textPath=["M",o[0],o[1],"A",l,l,n,1,1,r[0],r[1]].join(" ")}s.textPathOffset=o===Xw.LEFT?"0%":"50%"}else for(let n=0;n<t.length;n++){let l,c,u=e[n],h=t[n];u.type==lT.Arc||u.type==lT.Ring?(c="left"==o?u.endAngle+s:"center"==o?u.startAngle+u.angle/2+s:u.startAngle+s,l="top"==r?u.outerRadius+a:"bottom"==r?u.innerRadius+a:(u.outerRadius+u.innerRadius)/2+a):u.type==lT.Circle&&(c=90,l="top"==r?u.radius+a:"bottom"==r?a:u.radius/2+a),pA(h,u.x-h.x,u.y-l-h.bounds[i]),h._rotate=[90-c,u.x,u.y]}}_handleXY(t,e,n,r,i,o){for(let a=0;a<e.length;a++){let s,l=n[a],c=e[a];if(RE(l)){s=ME(l,[Xw.LEFT,Xw.TOP].includes(i)?0:[Xw.CENTER,Xw.MIDDLE].includes(i)?.5:1)[t]}else s=l.bounds[i]+o;e[0].type===lT.SimpleText?(c.anchor["x"==t?0:1]=r,_A(c,t,s)):"x"==t?pA(c,s-c.bounds[r],0):pA(c,0,s-c.bounds[r])}}}class HT extends eA{constructor(t,e){super(t),this._affx=e}get affixation(){return this._affx}}class qT extends pE{constructor(t){super(t)}run(){let t=this.inputVars[0],e=this.outputVar,n=t.attribute,r=e.attribute,i=t.dataset,o=e.dataset,a=this.args,s="min"in a?a.min:i.getAttributeSummary(n).min,l="max"in a?a.max:i.getAttributeSummary(n).max,c=s,u=[];for(;c<l;)u.push(c),c+=a.interval;u.push(c);let h={},f={};if(a.groupBy)for(let t of i.data){let e=a.groupBy.map(e=>t[e]).join("-");e in h||(h[e]=[],f[e]=a.groupBy.map(e=>t[e])),h[e].push(t[n])}else h[""]=i.data.map(t=>t[n]),f[""]="";let d=[];for(let t in f){let e=WT($T(a.bandwidth),u,h[t]);for(let i of e){let e={};""!==t&&a.groupBy.forEach((n,r)=>e[n]=f[t][r]),e[n]=i[0],e[r]=i[1],d.push(e)}}let p={};if(p[n]=i.getAttributeType(n),p[r]=$E.Number,a.groupBy)for(let t of a.groupBy)p[t]=i.getAttributeType(t);o.initialize(d,o.url,p)}}function WT(t,e,n){return e.map(e=>[e,ct(n,n=>t(e-n))])}function $T(t){return e=>Math.abs(e/=t)<=1?.75*(1-e*e)/t:0}class XT extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){let e=t.layout;if(!e)return;let n=t.children.map(t=>({name:t.id,radius:t.radius,itm:t})),r=n.reduce((t,e)=>t+Math.pow(e.radius,2),0),i=Math.sqrt(r);void 0===e._width&&(e._width=i),void 0===e._height&&(e._height=i);let o=Od({name:"root",children:n}).sum(t=>t.radius?t.radius:0).sort((t,e)=>e.value-t.value);rp().size([e._width,e._height]).radius(t=>t.value)(o);for(let t of o.children){let n=t.data.itm;pA(n,e._x-o.x+t.x-n.x,e._y-o.y+t.y-n.y)}}let n=lE(t,!0);for(let t of n)$w(t)}}class KT extends pE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof TA&&t.property==kA.AXIS_PATH_POSITION).element;t instanceof IT?this._runForEncoding(t):t instanceof LT&&this._runForLayout(t),$w(t._title)}_runForEncoding(t){let e=t.channel,n=qw(t.elements);if("x"==e)t._title.x=(t.scale.range[0]+t.scale.range[1])/2,t._title._y=t.orientation==MT?t.pathPos+t.titleOffset:t.pathPos-t.titleOffset;else if("width"==e)t._title.x=n.left+t.scale.rangeExtent/2,t._title._y=t.orientation==MT?t.pathPos+t.titleOffset:t.pathPos-t.titleOffset;else if("y"===e)t._rotateYTitle?(t._title.x=t.orientation==RT?t.pathPos-t.titleOffset:t.pathPos+t.titleOffset,t._title._y=(t.scale.range[0]+t.scale.range[1])/2,t._title._rotate=t.orientation==RT?[-90,t._title._x,t._title._y]:[90,t._title._x,t._title._y]):(t._title.x=t.orientation==RT?t.pathPos-t.titleOffset:t.pathPos+t.titleOffset,t._title._y=Math.min(t.scale.range[0],t.scale.range[1])-25,t._title._rotate=void 0);else if("height"===e)t._title.x=n.center,t._title._y=(n.top+n.bottom)/2-n.width/2-t.titleOffset,t._title._rotate=t.orientation==RT?[-90,n.center,n.middle]:[90,n.center,n.middle];else if("radialDistance"===e){let e=t.elements[0].parent;t._title.x=e.x+t.scale.rangeExtent/2,t._title._y=t.orientation==MT?t.pathPos+t.titleOffset:t.pathPos-t.titleOffset,t._rotate&&(t._title._rotate=t._rotate.slice())}}_runForLayout(t){let e=t.channel,n=t.elements[0].parent.layout&&t.elements[0].parent.layout.type==fE.STACK?Ww(t.elements):qw(t.elements);if("x"==e)t._title.x=n.center,t._title._y=t.orientation==MT?t.pathPos+t.titleOffset:t.pathPos-t.titleOffset;else if("y"===e)t._title.x=n.center,t._title._y=n.middle-n.width/2-t.titleOffset,t._title._rotate=t.orientation==RT?[-90,n.center,n.middle]:[90,n.center,n.middle];else if("angle"===e){let e=t.elements[0].parent.layout;e.type===fE.CLUSTER&&(t._title.x=e.x,t._title._y=e.y)}}}class ZT extends yT{constructor(t){super(t)}run(){super.run();let t,e=this.vars.find(t=>t.type===nA.ALIGNMENT).alignment,n=e.anchor,r=e.elements;n==Xw.Top||n==Xw.LEFT?t=Math.min(...r.map(t=>t.bounds[n])):n==Xw.BOTTOM||n==Xw.RIGHT?t=Math.max(...r.map(t=>t.bounds[n])):n!=Xw.CENTER&&n!=Xw.MIDDLE||(t=ct(r.map(t=>t.bounds[n])));for(let i of r){let r=dA(i,e.channel);if(r){let o=t-i.bounds[n];pA(r,"x"===e.channel?o:0,"x"===e.channel?0:o)}}for(let t of r)$w(t)}}class JT extends eA{constructor(t,e){super(t),this._aln=e}get alignment(){return this._aln}}class QT extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){let e=t.layout;if(!e)continue;let n=YE(t.children[0]);if(!n)continue;let r=n.linkList.map(t=>({source:n.getNode(t.source),target:n.getNode(t.target)})),i=Ol(n.nodeList).force("charge",Nl().strength(-e._repulsion)).force("link",Sl(r).id(t=>t.id).distance(e._linkDistance)).force("x",Il()).force("y",Ll()).force("center",hl(e._x,e._y).strength(e._attraction));i.stop(),i.tick(e._iterations);for(let e=0;e<t.children.length;e++){let r=t.children[e],i=n.nodeList[e];pA(r,i.x-r.x,i.y-r.y)}}let n=lE(t,!0);for(let t of n)$w(t)}}class tS extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t);switch(t.type){case lT.Arc:this._updateArcLinks(e);break;case lT.BezierCurve:this._updateBezierLinks(e);break;case lT.BundledPath:this._updateBundledLinks(e);break;case lT.Chord:this._updateChordLinks(e);break;case lT.Line:default:this._updateLineLinks(e)}$w(t)}_updateArcLinks(t){for(let e of t){let t=e.source.x<e.target.x?e.source:e.target,n=e.source.x<e.target.x?e.target:e.source;e._x=(t.x+n.x)/2,e._y=(t.y+n.y)/2,e._innerRadius=Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))/2,e._outerRadius=e._innerRadius+e._thickness;let r=DE(t.x,t.y,e._x,e._y),i=DE(n.x,n.y,e._x,e._y);e.direction===AE.CLOCKWISE&&([r,i]=[i,r]),_A(e,"startAngle",r),_A(e,"angle",Math.abs(i-r))}}_updateBezierLinks(t){let e=this._inputVars[0].element,n=Qw(e),r=e.parent.layout;r.type===fE.DIRECTED||r.type===fE.TIDYTREE?this._updateBezierLinksForDirectedGraph(n,t,r):r.type===fE.CLUSTER&&this._updateBezierLinksForClusteredGraph(n,t,r)}_updateBezierLinksForClusteredGraph(t,e,n){const r=n._d3Root.descendants(),i=new Map(r.map(t=>[eS(t),t])),o=new Map(r.map(t=>[t.data[qE],eS(t)]));if(n.isRadial()){const t=nx().angle(t=>t.x).radius(t=>t.y);for(let r of e){let e=r.source,a=r.target,s=e.dataScope.getAttrVal(qE),l=a.dataScope.getAttrVal(qE),c=i.get(o.get(s)),u=i.get(o.get(l));r._d=NE(t({source:c,target:u}),n.x,n.y)}}else if(n.orientation===vE){const t=ex().x(t=>t.x).y(t=>t.y);for(let r of e){let e=r.source,a=r.target,s=e.dataScope.getAttrVal(qE),l=a.dataScope.getAttrVal(qE),c=i.get(o.get(s)),u=i.get(o.get(l));r._d=NE(t({source:c,target:u}),n.left-n._x0,n.top)}}else if(n.orientation===bE){const t=tx().x(t=>t.y).y(t=>t.x);for(let r of e){let e=r.source,a=r.target,s=e.dataScope.getAttrVal(qE),l=a.dataScope.getAttrVal(qE),c=i.get(o.get(s)),u=i.get(o.get(l));r._d=NE(t({source:c,target:u}),n.left,n.top-n._x0)}}}_updateBezierLinksForDirectedGraph(t,e,n){let r={},i={},o={},a={};for(let e of t){i[e.id]=0,r[e.id]=0;let t=e.links.filter(t=>t.source===e),n=e.links.filter(t=>t.target===e);a[e.id]=n.map(t=>t.strokeWidth).reduce((t,e)=>t+e,0),o[e.id]=t.map(t=>t.strokeWidth).reduce((t,e)=>t+e,0)}n.spreadLinks&&("LR"===n.direction||"RL"===n.direction?e.sort((t,e)=>DE(t.target.bounds.x,t.target.bounds.y,t.source.bounds.x,t.source.bounds.y)-DE(e.target.bounds.x,e.target.bounds.y,e.source.bounds.x,e.source.bounds.y)):e.sort((t,e)=>DE(e.target.bounds.x,e.target.bounds.y,e.source.bounds.x,e.source.bounds.y)-DE(t.target.bounds.x,t.target.bounds.y,t.source.bounds.x,t.source.bounds.y)));for(let t of e){let e,s,l,c,u=t.source,h=t.target;n.spreadLinks?"LR"===n.direction||"RL"===n.direction?(e=u.bounds[t.sourceAnchor[0]]+t.sourceOffset[0],l=h.bounds[t.targetAnchor[0]]+t.targetOffset[0],s=u.bounds[t.sourceAnchor[1]]+t.sourceOffset[1]-o[u.id]/2+r[u.id]+t.strokeWidth/2,c=h.bounds[t.targetAnchor[1]]+t.targetOffset[1]-a[h.id]/2+i[h.id]+t.strokeWidth/2,r[u.id]+=t.strokeWidth,i[h.id]+=t.strokeWidth):(s=u.bounds[t.sourceAnchor[1]]+t.sourceOffset[1],c=h.bounds[t.targetAnchor[1]]+t.targetOffset[1],e=u.bounds[t.sourceAnchor[0]]+t.sourceOffset[0]-o[u.id]/2+r[u.id]+t.strokeWidth/2,l=h.bounds[t.targetAnchor[0]]+t.targetOffset[0]-a[h.id]/2+i[h.id]+t.strokeWidth/2,r[u.id]+=t.strokeWidth,i[h.id]+=t.strokeWidth):(e=u.bounds[t.sourceAnchor[0]]+t.sourceOffset[0],s=u.bounds[t.sourceAnchor[1]]+t.sourceOffset[1],l=h.bounds[t.targetAnchor[0]]+t.targetOffset[0],c=h.bounds[t.targetAnchor[1]]+t.targetOffset[1]),t.orientation===bE?t._setVertices([[e,s],[(e+l)/2,s],[e,c],[l,c]]):t.orientation===vE&&t._setVertices([[e,s],[e,(s+c)/2],[l,s],[l,c]])}}_updateBundledLinks(t){let e=this._inputVars[0].element.parent.layout;if(e.type!==fE.CLUSTER)throw"Bundled links must work on a cluster layout";let n=e._d3Root.leaves();const r=new Map(n.map(t=>[eS(t),t])),i=new Map(n.map(t=>[t.data[qE],eS(t)])),o=Uv().curve(Dx.beta(t[0]._strength)).radius(t=>t.y).angle(t=>t.x);for(let n of t){let t=n.source.dataScope.getAttrVal(qE),a=n.target.dataScope.getAttrVal(qE),s=r.get(i.get(t)),l=r.get(i.get(a));(s.outgoing??=[]).push([s,l]),l.incoming??=[];let c=s.path(l);n._d=NE(o(c),e.x,e.y)}}_updateChordLinks(t){for(let e of t){let t=e.source,n=e.target,r=QE(t.x,t.y,t.innerRadius,t.startAngle),i=QE(t.x,t.y,t.innerRadius,t.endAngle),o=QE(n.x,n.y,n.innerRadius,n.startAngle),a=QE(n.x,n.y,n.innerRadius,n.endAngle);e._d=["M",r[0],r[1],"Q",t.x,t.y,a[0],a[1],"A",t.x,t.y,n.angle,n.angle>180?1:0,1,o[0],o[1],"Q",t.x,t.y,i[0],i[1],"A",t.x,t.y,t.angle,t.angle>180?1:0,1,r[0],r[1]].join(" "),e._dirty=!0}}_updateLineLinks(t){for(let e of t){let t=e.source,n=e.target;e.vertices[0]._x=t.bounds.x,e.vertices[0]._y=t.bounds.y,e.vertices[1]._x=n.bounds.x,e.vertices[1]._y=n.bounds.y,e._dirty=!0}}}function eS(t){return`${t.parent?eS(t.parent)+".":""}${t.data[qE]}`}var nS="\0";function rS(t,e){t[e]?t[e]++:t[e]=1}function iS(t,e){--t[e]||delete t[e]}function oS(t,e,n,r){var i=""+e,o=""+n;if(!t&&i>o){var a=i;i=o,o=a}return i+""+o+""+(void 0===r?"\0":r)}function aS(t,e){return oS(t,e.v,e.w,e.name)}var sS=class{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>{};_defaultEdgeLabelFn=()=>{};_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(t){t&&(this._isDirected=!Object.hasOwn(t,"directed")||t.directed,this._isMultigraph=!!Object.hasOwn(t,"multigraph")&&t.multigraph,this._isCompound=!!Object.hasOwn(t,"compound")&&t.compound),this._isCompound&&(this._parent={},this._children={},this._children[nS]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return this._defaultNodeLabelFn=t,"function"!=typeof t&&(this._defaultNodeLabelFn=()=>t),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var t=this;return this.nodes().filter(e=>0===Object.keys(t._in[e]).length)}sinks(){var t=this;return this.nodes().filter(e=>0===Object.keys(t._out[e]).length)}setNodes(t,e){var n=arguments,r=this;return t.forEach(function(t){n.length>1?r.setNode(t,e):r.setNode(t)}),this}setNode(t,e){return Object.hasOwn(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=nS,this._children[t]={},this._children[nS][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return Object.hasOwn(this._nodes,t)}removeNode(t){var e=this;if(Object.hasOwn(this._nodes,t)){var n=t=>e.removeEdge(e._edgeObjs[t]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(function(t){e.setParent(t)}),delete this._children[t]),Object.keys(this._in[t]).forEach(n),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(void 0===e)e=nS;else{for(var n=e+="";void 0!==n;n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var e=this._parent[t];if(e!==nS)return e}}children(t=nS){if(this._isCompound){var e=this._children[t];if(e)return Object.keys(e)}else{if(t===nS)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var e=this._preds[t];if(e)return Object.keys(e)}successors(t){var e=this._sucs[t];if(e)return Object.keys(e)}neighbors(t){var e=this.predecessors(t);if(e){const r=new Set(e);for(var n of this.successors(t))r.add(n);return Array.from(r.values())}}isLeaf(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length}filterNodes(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach(function([n,r]){t(n)&&e.setNode(n,r)}),Object.values(this._edgeObjs).forEach(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,n.edge(t))});var r={};function i(t){var o=n.parent(t);return void 0===o||e.hasNode(o)?(r[t]=o,o):o in r?r[o]:i(o)}return this._isCompound&&e.nodes().forEach(t=>e.setParent(t,i(t))),e}setDefaultEdgeLabel(t){return this._defaultEdgeLabelFn=t,"function"!=typeof t&&(this._defaultEdgeLabelFn=()=>t),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,e){var n=this,r=arguments;return t.reduce(function(t,i){return r.length>1?n.setEdge(t,i,e):n.setEdge(t,i),i}),this}setEdge(){var t,e,n,r,i=!1,o=arguments[0];"object"==typeof o&&null!==o&&"v"in o?(t=o.v,e=o.w,n=o.name,2===arguments.length&&(r=arguments[1],i=!0)):(t=o,e=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],i=!0)),t=""+t,e=""+e,void 0!==n&&(n=""+n);var a=oS(this._isDirected,t,e,n);if(Object.hasOwn(this._edgeLabels,a))return i&&(this._edgeLabels[a]=r),this;if(void 0!==n&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[a]=i?r:this._defaultEdgeLabelFn(t,e,n);var s=function(t,e,n,r){var i=""+e,o=""+n;if(!t&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};r&&(s.name=r);return s}(this._isDirected,t,e,n);return t=s.v,e=s.w,Object.freeze(s),this._edgeObjs[a]=s,rS(this._preds[e],t),rS(this._sucs[t],e),this._in[e][a]=s,this._out[t][a]=s,this._edgeCount++,this}edge(t,e,n){var r=1===arguments.length?aS(this._isDirected,arguments[0]):oS(this._isDirected,t,e,n);return this._edgeLabels[r]}edgeAsObj(){const t=this.edge(...arguments);return"object"!=typeof t?{label:t}:t}hasEdge(t,e,n){var r=1===arguments.length?aS(this._isDirected,arguments[0]):oS(this._isDirected,t,e,n);return Object.hasOwn(this._edgeLabels,r)}removeEdge(t,e,n){var r=1===arguments.length?aS(this._isDirected,arguments[0]):oS(this._isDirected,t,e,n),i=this._edgeObjs[r];return i&&(t=i.v,e=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],iS(this._preds[e],t),iS(this._sucs[t],e),delete this._in[e][r],delete this._out[t][r],this._edgeCount--),this}inEdges(t,e){var n=this._in[t];if(n){var r=Object.values(n);return e?r.filter(t=>t.v===e):r}}outEdges(t,e){var n=this._out[t];if(n){var r=Object.values(n);return e?r.filter(t=>t.w===e):r}}nodeEdges(t,e){var n=this.inEdges(t,e);if(n)return n.concat(this.outEdges(t,e))}},lS={Graph:sS,version:"2.2.4"},cS=sS,uS={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:hS(t),edges:fS(t)};void 0!==t.graph()&&(e.value=structuredClone(t.graph()));return e},read:function(t){var e=new cS(t.options).setGraph(t.value);return t.nodes.forEach(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)}),t.edges.forEach(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)}),e}};function hS(t){return t.nodes().map(function(e){var n=t.node(e),r=t.parent(e),i={v:e};return void 0!==n&&(i.value=n),void 0!==r&&(i.parent=r),i})}function fS(t){return t.edges().map(function(e){var n=t.edge(e),r={v:e.v,w:e.w};return void 0!==e.name&&(r.name=e.name),void 0!==n&&(r.value=n),r})}var dS=function(t){var e,n={},r=[];function i(r){Object.hasOwn(n,r)||(n[r]=!0,e.push(r),t.successors(r).forEach(i),t.predecessors(r).forEach(i))}return t.nodes().forEach(function(t){e=[],i(t),e.length&&r.push(e)}),r};var pS=class{_arr=[];_keyIndices={};size(){return this._arr.length}keys(){return this._arr.map(function(t){return t.key})}has(t){return Object.hasOwn(this._keyIndices,t)}priority(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority}min(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key}add(t,e){var n=this._keyIndices;if(t=String(t),!Object.hasOwn(n,t)){var r=this._arr,i=r.length;return n[t]=i,r.push({key:t,priority:e}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)}_heapify(t){var e=this._arr,n=2*t,r=n+1,i=t;n<e.length&&(i=e[n].priority<e[i].priority?n:i,r<e.length&&(i=e[r].priority<e[i].priority?r:i),i!==t&&(this._swap(t,i),this._heapify(i)))}_decrease(t){for(var e,n=this._arr,r=n[t].priority;0!==t&&!(n[e=t>>1].priority<r);)this._swap(t,e),t=e}_swap(t,e){var n=this._arr,r=this._keyIndices,i=n[t],o=n[e];n[t]=o,n[e]=i,r[o.key]=t,r[i.key]=e}},gS=pS,_S=function(t,e,n,r){return function(t,e,n,r){var i,o,a={},s=new gS,l=function(t){var e=t.v!==i?t.v:t.w,r=a[e],l=n(t),c=o.distance+l;if(l<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+l);c<r.distance&&(r.distance=c,r.predecessor=i,s.decrease(e,c))};t.nodes().forEach(function(t){var n=t===e?0:Number.POSITIVE_INFINITY;a[t]={distance:n},s.add(t,n)});for(;s.size()>0&&(i=s.removeMin(),(o=a[i]).distance!==Number.POSITIVE_INFINITY);)r(i).forEach(l);return a}(t,String(e),n||yS,r||function(e){return t.outEdges(e)})},yS=()=>1;var mS=_S,bS=function(t,e,n){return t.nodes().reduce(function(r,i){return r[i]=mS(t,i,e,n),r},{})};var vS=function(t){var e=0,n=[],r={},i=[];function o(a){var s=r[a]={onStack:!0,lowlink:e,index:e++};if(n.push(a),t.successors(a).forEach(function(t){Object.hasOwn(r,t)?r[t].onStack&&(s.lowlink=Math.min(s.lowlink,r[t].index)):(o(t),s.lowlink=Math.min(s.lowlink,r[t].lowlink))}),s.lowlink===s.index){var l,c=[];do{l=n.pop(),r[l].onStack=!1,c.push(l)}while(a!==l);i.push(c)}}return t.nodes().forEach(function(t){Object.hasOwn(r,t)||o(t)}),i};var xS=vS,wS=function(t){return xS(t).filter(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])})};var ES=function(t,e,n){return function(t,e,n){var r={},i=t.nodes();return i.forEach(function(t){r[t]={},r[t][t]={distance:0},i.forEach(function(e){t!==e&&(r[t][e]={distance:Number.POSITIVE_INFINITY})}),n(t).forEach(function(n){var i=n.v===t?n.w:n.v,o=e(n);r[t][i]={distance:o,predecessor:t}})}),i.forEach(function(t){var e=r[t];i.forEach(function(n){var o=r[n];i.forEach(function(n){var r=o[t],i=e[n],a=o[n],s=r.distance+i.distance;s<a.distance&&(a.distance=s,a.predecessor=i.predecessor)})})}),r}(t,e||AS,n||function(e){return t.outEdges(e)})},AS=()=>1;function TS(t){var e={},n={},r=[];if(t.sinks().forEach(function i(o){if(Object.hasOwn(n,o))throw new SS;Object.hasOwn(e,o)||(n[o]=!0,e[o]=!0,t.predecessors(o).forEach(i),delete n[o],r.push(o))}),Object.keys(e).length!==t.nodeCount())throw new SS;return r}class SS extends Error{constructor(){super(...arguments)}}var CS=TS;TS.CycleException=SS;var kS=CS;var MS=function(t,e,n){Array.isArray(e)||(e=[e]);var r=t.isDirected()?e=>t.successors(e):e=>t.neighbors(e),i="post"===n?RS:OS,o=[],a={};return e.forEach(e=>{if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);i(e,r,a,o)}),o};function RS(t,e,n,r){for(var i=[[t,!1]];i.length>0;){var o=i.pop();o[1]?r.push(o[0]):Object.hasOwn(n,o[0])||(n[o[0]]=!0,i.push([o[0],!0]),NS(e(o[0]),t=>i.push([t,!1])))}}function OS(t,e,n,r){for(var i=[t];i.length>0;){var o=i.pop();Object.hasOwn(n,o)||(n[o]=!0,r.push(o),NS(e(o),t=>i.push(t)))}}function NS(t,e){for(var n=t.length;n--;)e(t[n],n,t);return t}var IS=MS;var LS=MS;var PS=sS,VS=pS,DS=function(t,e){var n,r=new PS,i={},o=new VS;function a(t){var r=t.v===n?t.w:t.v,a=o.priority(r);if(void 0!==a){var s=e(t);s<a&&(i[r]=n,o.decrease(r,s))}}if(0===t.nodeCount())return r;t.nodes().forEach(function(t){o.add(t,Number.POSITIVE_INFINITY),r.setNode(t)}),o.decrease(t.nodes()[0],0);var s=!1;for(;o.size()>0;){if(n=o.removeMin(),Object.hasOwn(i,n))r.setEdge(n,i[n]);else{if(s)throw new Error("Input graph is not connected: "+t);s=!0}t.nodeEdges(n).forEach(a)}return r};var BS={Graph:lS.Graph,json:uS,alg:{components:dS,dijkstra:_S,dijkstraAll:bS,findCycles:wS,floydWarshall:ES,isAcyclic:function(t){try{kS(t)}catch(t){if(t instanceof kS.CycleException)return!1;throw t}return!0},postorder:function(t,e){return IS(t,e,"post")},preorder:function(t,e){return LS(t,e,"pre")},prim:DS,tarjan:vS,topsort:CS},version:lS.version};function zS(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function FS(t,e){if("_next"!==t&&"_prev"!==t)return e}let GS=BS.Graph,jS=class{constructor(){let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,e=t._prev;if(e!==t)return zS(e),e}enqueue(t){let e=this._sentinel;t._prev&&t._next&&zS(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e}toString(){let t=[],e=this._sentinel,n=e._prev;for(;n!==e;)t.push(JSON.stringify(n,FS)),n=n._prev;return"["+t.join(", ")+"]"}};var US=function(t,e){if(t.nodeCount()<=1)return[];let n=function(t,e){let n=new GS,r=0,i=0;t.nodes().forEach(t=>{n.setNode(t,{v:t,in:0,out:0})}),t.edges().forEach(t=>{let o=n.edge(t.v,t.w)||0,a=e(t),s=o+a;n.setEdge(t.v,t.w,s),i=Math.max(i,n.node(t.v).out+=a),r=Math.max(r,n.node(t.w).in+=a)});let o=function(t){const e=[];for(let n=0;n<t;n++)e.push(n);return e}(i+r+3).map(()=>new jS),a=r+1;return n.nodes().forEach(t=>{qS(o,a,n.node(t))}),{graph:n,buckets:o,zeroIdx:a}}(t,e||YS);return function(t,e,n){let r,i=[],o=e[e.length-1],a=e[0];for(;t.nodeCount();){for(;r=a.dequeue();)HS(t,e,n,r);for(;r=o.dequeue();)HS(t,e,n,r);if(t.nodeCount())for(let o=e.length-2;o>0;--o)if(r=e[o].dequeue(),r){i=i.concat(HS(t,e,n,r,!0));break}}return i}(n.graph,n.buckets,n.zeroIdx).flatMap(e=>t.outEdges(e.v,e.w))};let YS=()=>1;function HS(t,e,n,r,i){let o=i?[]:void 0;return t.inEdges(r.v).forEach(r=>{let a=t.edge(r),s=t.node(r.v);i&&o.push({v:r.v,w:r.w}),s.out-=a,qS(e,n,s)}),t.outEdges(r.v).forEach(r=>{let i=t.edge(r),o=r.w,a=t.node(o);a.in-=i,qS(e,n,a)}),t.removeNode(r.v),o}function qS(t,e,n){n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)}let WS=BS.Graph;var $S={addBorderNode:function(t,e,n,r){let i={width:0,height:0};arguments.length>=4&&(i.rank=n,i.order=r);return XS(t,"border",i,e)},addDummyNode:XS,applyWithChunking:ZS,asNonCompoundGraph:function(t){let e=new WS({multigraph:t.isMultigraph()}).setGraph(t.graph());return t.nodes().forEach(n=>{t.children(n).length||e.setNode(n,t.node(n))}),t.edges().forEach(n=>{e.setEdge(n,t.edge(n))}),e},buildLayerMatrix:function(t){let e=eC(JS(t)+1).map(()=>[]);return t.nodes().forEach(n=>{let r=t.node(n),i=r.rank;void 0!==i&&(e[i][r.order]=n)}),e},intersectRect:function(t,e){let n,r,i=t.x,o=t.y,a=e.x-i,s=e.y-o,l=t.width/2,c=t.height/2;if(!a&&!s)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(s)*l>Math.abs(a)*c?(s<0&&(c=-c),n=c*a/s,r=c):(a<0&&(l=-l),n=l,r=l*s/a);return{x:i+n,y:o+r}},mapValues:function(t,e){let n=e;"string"==typeof e&&(n=t=>t[e]);return Object.entries(t).reduce((t,[e,r])=>(t[e]=n(r,e),t),{})},maxRank:JS,normalizeRanks:function(t){let e=t.nodes().map(e=>{let n=t.node(e).rank;return void 0===n?Number.MAX_VALUE:n}),n=ZS(Math.min,e);t.nodes().forEach(e=>{let r=t.node(e);Object.hasOwn(r,"rank")&&(r.rank-=n)})},notime:function(t,e){return e()},partition:function(t,e){let n={lhs:[],rhs:[]};return t.forEach(t=>{e(t)?n.lhs.push(t):n.rhs.push(t)}),n},pick:function(t,e){const n={};for(const r of e)void 0!==t[r]&&(n[r]=t[r]);return n},predecessorWeights:function(t){let e=t.nodes().map(e=>{let n={};return t.inEdges(e).forEach(e=>{n[e.v]=(n[e.v]||0)+t.edge(e).weight}),n});return nC(t.nodes(),e)},range:eC,removeEmptyRanks:function(t){let e=t.nodes().map(e=>t.node(e).rank),n=ZS(Math.min,e),r=[];t.nodes().forEach(e=>{let i=t.node(e).rank-n;r[i]||(r[i]=[]),r[i].push(e)});let i=0,o=t.graph().nodeRankFactor;Array.from(r).forEach((e,n)=>{void 0===e&&n%o!==0?--i:void 0!==e&&i&&e.forEach(e=>t.node(e).rank+=i)})},simplify:function(t){let e=(new WS).setGraph(t.graph());return t.nodes().forEach(n=>e.setNode(n,t.node(n))),t.edges().forEach(n=>{let r=e.edge(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),e},successorWeights:function(t){let e=t.nodes().map(e=>{let n={};return t.outEdges(e).forEach(e=>{n[e.w]=(n[e.w]||0)+t.edge(e).weight}),n});return nC(t.nodes(),e)},time:function(t,e){let n=Date.now();try{return e()}finally{console.log(t+" time: "+(Date.now()-n)+"ms")}},uniqueId:tC,zipObject:nC};function XS(t,e,n,r){for(var i=r;t.hasNode(i);)i=tC(r);return n.dummy=e,t.setNode(i,n),i}const KS=65535;function ZS(t,e){if(e.length>KS){const n=function(t,e=KS){const n=[];for(let r=0;r<t.length;r+=e){const i=t.slice(r,r+e);n.push(i)}return n}(e);return t.apply(null,n.map(e=>t.apply(null,e)))}return t.apply(null,e)}function JS(t){const e=t.nodes().map(e=>{let n=t.node(e).rank;return void 0===n?Number.MIN_VALUE:n});return ZS(Math.max,e)}let QS=0;function tC(t){return t+""+ ++QS}function eC(t,e,n=1){null==e&&(e=t,t=0);let r=t=>t<e;n<0&&(r=t=>e<t);const i=[];for(let e=t;r(e);e+=n)i.push(e);return i}function nC(t,e){return t.reduce((t,n,r)=>(t[n]=e[r],t),{})}let rC=US,iC=$S.uniqueId;var oC={run:function(t){("greedy"===t.graph().acyclicer?rC(t,function(t){return e=>t.edge(e).weight}(t)):function(t){let e=[],n={},r={};function i(o){Object.hasOwn(r,o)||(r[o]=!0,n[o]=!0,t.outEdges(o).forEach(t=>{Object.hasOwn(n,t.w)?e.push(t):i(t.w)}),delete n[o])}return t.nodes().forEach(i),e}(t)).forEach(e=>{let n=t.edge(e);t.removeEdge(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,iC("rev"))})},undo:function(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.reversed){t.removeEdge(e);let r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}})}};let aC=$S;var sC={run:function(t){t.graph().dummyChains=[],t.edges().forEach(e=>function(t,e){let n,r,i,o=e.v,a=t.node(o).rank,s=e.w,l=t.node(s).rank,c=e.name,u=t.edge(e),h=u.labelRank;if(l===a+1)return;for(t.removeEdge(e),i=0,++a;a<l;++i,++a)u.points=[],r={width:0,height:0,edgeLabel:u,edgeObj:e,rank:a},n=aC.addDummyNode(t,"edge",r,"_d"),a===h&&(r.width=u.width,r.height=u.height,r.dummy="edge-label",r.labelpos=u.labelpos),t.setEdge(o,n,{weight:u.weight},c),0===i&&t.graph().dummyChains.push(n),o=n;t.setEdge(o,s,{weight:u.weight},c)}(t,e))},undo:function(t){t.graph().dummyChains.forEach(e=>{let n,r=t.node(e),i=r.edgeLabel;for(t.setEdge(r.edgeObj,i);r.dummy;)n=t.successors(e)[0],t.removeNode(e),i.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height),e=n,r=t.node(e)})}};const{applyWithChunking:lC}=$S;var cC={longestPath:function(t){var e={};t.sources().forEach(function n(r){var i=t.node(r);if(Object.hasOwn(e,r))return i.rank;e[r]=!0;let o=t.outEdges(r).map(e=>null==e?Number.POSITIVE_INFINITY:n(e.w)-t.edge(e).minlen);var a=lC(Math.min,o);return a===Number.POSITIVE_INFINITY&&(a=0),i.rank=a})},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}};var uC=BS.Graph,hC=cC.slack,fC=function(t){var e,n,r=new uC({directed:!1}),i=t.nodes()[0],o=t.nodeCount();r.setNode(i,{});for(;dC(r,t)<o;)e=pC(r,t),n=r.hasNode(e.v)?hC(t,e):-hC(t,e),gC(r,t,n);return r};function dC(t,e){return t.nodes().forEach(function n(r){e.nodeEdges(r).forEach(i=>{var o=i.v,a=r===o?i.w:o;t.hasNode(a)||hC(e,i)||(t.setNode(a,{}),t.setEdge(r,a,{}),n(a))})}),t.nodeCount()}function pC(t,e){return e.edges().reduce((n,r)=>{let i=Number.POSITIVE_INFINITY;return t.hasNode(r.v)!==t.hasNode(r.w)&&(i=hC(e,r)),i<n[0]?[i,r]:n},[Number.POSITIVE_INFINITY,null])[1]}function gC(t,e,n){t.nodes().forEach(t=>e.node(t).rank+=n)}var _C=fC,yC=cC.slack,mC=cC.longestPath,bC=BS.alg.preorder,vC=BS.alg.postorder,xC=$S.simplify,wC=EC;function EC(t){t=xC(t),mC(t);var e,n=_C(t);for(SC(n),AC(n,t);e=kC(n);)RC(n,t,e,MC(n,t,e))}function AC(t,e){var n=vC(t,t.nodes());(n=n.slice(0,n.length-1)).forEach(n=>function(t,e,n){var r=t.node(n),i=r.parent;t.edge(n,i).cutvalue=TC(t,e,n)}(t,e,n))}function TC(t,e,n){var r=t.node(n).parent,i=!0,o=e.edge(n,r),a=0;return o||(i=!1,o=e.edge(r,n)),a=o.weight,e.nodeEdges(n).forEach(o=>{var s=o.v===n,l=s?o.w:o.v;if(l!==r){var c=s===i,u=e.edge(o).weight;if(a+=c?u:-u,function(t,e,n){return t.hasEdge(e,n)}(t,n,l)){var h=t.edge(n,l).cutvalue;a+=c?-h:h}}}),a}function SC(t,e){arguments.length<2&&(e=t.nodes()[0]),CC(t,{},1,e)}function CC(t,e,n,r,i){var o=n,a=t.node(r);return e[r]=!0,t.neighbors(r).forEach(i=>{Object.hasOwn(e,i)||(n=CC(t,e,n,i,r))}),a.low=o,a.lim=n++,i?a.parent=i:delete a.parent,n}function kC(t){return t.edges().find(e=>t.edge(e).cutvalue<0)}function MC(t,e,n){var r=n.v,i=n.w;e.hasEdge(r,i)||(r=n.w,i=n.v);var o=t.node(r),a=t.node(i),s=o,l=!1;o.lim>a.lim&&(s=a,l=!0);var c=e.edges().filter(e=>l===OC(t,t.node(e.v),s)&&l!==OC(t,t.node(e.w),s));return c.reduce((t,n)=>yC(e,n)<yC(e,t)?n:t)}function RC(t,e,n,r){var i=n.v,o=n.w;t.removeEdge(i,o),t.setEdge(r.v,r.w,{}),SC(t),AC(t,e),function(t,e){var n=t.nodes().find(t=>!e.node(t).parent),r=bC(t,n);(r=r.slice(1)).forEach(n=>{var r=t.node(n).parent,i=e.edge(n,r),o=!1;i||(i=e.edge(r,n),o=!0),e.node(n).rank=e.node(r).rank+(o?i.minlen:-i.minlen)})}(t,e)}function OC(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}EC.initLowLimValues=SC,EC.initCutValues=AC,EC.calcCutValue=TC,EC.leaveEdge=kC,EC.enterEdge=MC,EC.exchangeEdges=RC;var NC=cC.longestPath,IC=fC,LC=wC,PC=function(t){var e=t.graph().ranker;if(e instanceof Function)return e(t);switch(t.graph().ranker){case"network-simplex":default:DC(t);break;case"tight-tree":!function(t){NC(t),IC(t)}(t);break;case"longest-path":VC(t);case"none":}};var VC=NC;function DC(t){LC(t)}var BC=function(t){let e=function(t){let e={},n=0;function r(i){let o=n;t.children(i).forEach(r),e[i]={low:o,lim:n++}}return t.children().forEach(r),e}(t);t.graph().dummyChains.forEach(n=>{let r=t.node(n),i=r.edgeObj,o=function(t,e,n,r){let i,o,a=[],s=[],l=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),a.push(i)}while(i&&(e[i].low>l||c>e[i].lim));o=i,i=r;for(;(i=t.parent(i))!==o;)s.push(i);return{path:a.concat(s.reverse()),lca:o}}(t,e,i.v,i.w),a=o.path,s=o.lca,l=0,c=a[l],u=!0;for(;n!==i.w;){if(r=t.node(n),u){for(;(c=a[l])!==s&&t.node(c).maxRank<r.rank;)l++;c===s&&(u=!1)}if(!u){for(;l<a.length-1&&t.node(c=a[l+1]).minRank<=r.rank;)l++;c=a[l]}t.setParent(n,c),n=t.successors(n)[0]}})};let zC=$S;var FC={run:function(t){let e=zC.addDummyNode(t,"root",{},"_root"),n=function(t){var e={};function n(r,i){var o=t.children(r);o&&o.length&&o.forEach(t=>n(t,i+1)),e[r]=i}return t.children().forEach(t=>n(t,1)),e}(t),r=Object.values(n),i=zC.applyWithChunking(Math.max,r)-1,o=2*i+1;t.graph().nestingRoot=e,t.edges().forEach(e=>t.edge(e).minlen*=o);let a=function(t){return t.edges().reduce((e,n)=>e+t.edge(n).weight,0)}(t)+1;t.children().forEach(r=>GC(t,e,o,a,i,n,r)),t.graph().nodeRankFactor=o},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,t.edges().forEach(e=>{t.edge(e).nestingEdge&&t.removeEdge(e)})}};function GC(t,e,n,r,i,o,a){let s=t.children(a);if(!s.length)return void(a!==e&&t.setEdge(e,a,{weight:0,minlen:n}));let l=zC.addBorderNode(t,"_bt"),c=zC.addBorderNode(t,"_bb"),u=t.node(a);t.setParent(l,a),u.borderTop=l,t.setParent(c,a),u.borderBottom=c,s.forEach(s=>{GC(t,e,n,r,i,o,s);let u=t.node(s),h=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,d=u.borderTop?r:2*r,p=h!==f?1:i-o[a]+1;t.setEdge(l,h,{weight:d,minlen:p,nestingEdge:!0}),t.setEdge(f,c,{weight:d,minlen:p,nestingEdge:!0})}),t.parent(a)||t.setEdge(e,l,{weight:0,minlen:i+o[a]})}let jC=$S;var UC=function(t){t.children().forEach(function e(n){let r=t.children(n),i=t.node(n);if(r.length&&r.forEach(e),Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let e=i.minRank,r=i.maxRank+1;e<r;++e)YC(t,"borderLeft","_bl",n,i,e),YC(t,"borderRight","_br",n,i,e)}})};function YC(t,e,n,r,i,o){let a={width:0,height:0,rank:o,borderType:e},s=i[e][o-1],l=jC.addDummyNode(t,"border",a,n);i[e][o]=l,t.setParent(l,r),s&&t.setEdge(s,l,{weight:1})}function HC(t){t.nodes().forEach(e=>qC(t.node(e))),t.edges().forEach(e=>qC(t.edge(e)))}function qC(t){let e=t.width;t.width=t.height,t.height=e}function WC(t){t.y=-t.y}function $C(t){let e=t.x;t.x=t.y,t.y=e}let XC=$S;var KC=function(t){let e={},n=t.nodes().filter(e=>!t.children(e).length),r=n.map(e=>t.node(e).rank),i=XC.applyWithChunking(Math.max,r),o=XC.range(i+1).map(()=>[]);function a(n){if(e[n])return;e[n]=!0;let r=t.node(n);o[r.rank].push(n),t.successors(n).forEach(a)}let s=n.sort((e,n)=>t.node(e).rank-t.node(n).rank);return s.forEach(a),o};let ZC=$S.zipObject;function JC(t,e,n){let r=ZC(n,n.map((t,e)=>e)),i=e.flatMap(e=>t.outEdges(e).map(e=>({pos:r[e.w],weight:t.edge(e).weight})).sort((t,e)=>t.pos-e.pos)),o=1;for(;o<n.length;)o<<=1;let a=2*o-1;o-=1;let s=new Array(a).fill(0),l=0;return i.forEach(t=>{let e=t.pos+o;s[e]+=t.weight;let n=0;for(;e>0;)e%2&&(n+=s[e+1]),e=e-1>>1,s[e]+=t.weight;l+=t.weight*n}),l}let QC=$S;var tk=function(t,e){let n={};return t.forEach((t,e)=>{let r=n[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};void 0!==t.barycenter&&(r.barycenter=t.barycenter,r.weight=t.weight)}),e.edges().forEach(t=>{let e=n[t.v],r=n[t.w];void 0!==e&&void 0!==r&&(r.indegree++,e.out.push(n[t.w]))}),function(t){let e=[];function n(t){return e=>{e.merged||(void 0===e.barycenter||void 0===t.barycenter||e.barycenter>=t.barycenter)&&function(t,e){let n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight);e.weight&&(n+=e.barycenter*e.weight,r+=e.weight);t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}(t,e)}}function r(e){return n=>{n.in.push(e),0===--n.indegree&&t.push(n)}}for(;t.length;){let i=t.pop();e.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return e.filter(t=>!t.merged).map(t=>QC.pick(t,["vs","i","barycenter","weight"]))}(Object.values(n).filter(t=>!t.indegree))};let ek=$S;var nk=function(t,e){let n=ek.partition(t,t=>Object.hasOwn(t,"barycenter")),r=n.lhs,i=n.rhs.sort((t,e)=>e.i-t.i),o=[],a=0,s=0,l=0;r.sort((c=!!e,(t,e)=>t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:c?e.i-t.i:t.i-e.i)),l=rk(o,i,l),r.forEach(t=>{l+=t.vs.length,o.push(t.vs),a+=t.barycenter*t.weight,s+=t.weight,l=rk(o,i,l)});var c;let u={vs:o.flat(!0)};s&&(u.barycenter=a/s,u.weight=s);return u};function rk(t,e,n){let r;for(;e.length&&(r=e[e.length-1]).i<=n;)e.pop(),t.push(r.vs),n++;return n}let ik=function(t,e=[]){return e.map(e=>{let n=t.inEdges(e);if(n.length){let r=n.reduce((e,n)=>{let r=t.edge(n),i=t.node(n.v);return{sum:e.sum+r.weight*i.order,weight:e.weight+r.weight}},{sum:0,weight:0});return{v:e,barycenter:r.sum/r.weight,weight:r.weight}}return{v:e}})},ok=tk,ak=nk;var sk=function t(e,n,r,i){let o=e.children(n),a=e.node(n),s=a?a.borderLeft:void 0,l=a?a.borderRight:void 0,c={};s&&(o=o.filter(t=>t!==s&&t!==l));let u=ik(e,o);u.forEach(n=>{if(e.children(n.v).length){let s=t(e,n.v,r,i);c[n.v]=s,Object.hasOwn(s,"barycenter")&&(a=s,void 0!==(o=n).barycenter?(o.barycenter=(o.barycenter*o.weight+a.barycenter*a.weight)/(o.weight+a.weight),o.weight+=a.weight):(o.barycenter=a.barycenter,o.weight=a.weight))}var o,a});let h=ok(u,r);!function(t,e){t.forEach(t=>{t.vs=t.vs.flatMap(t=>e[t]?e[t].vs:t)})}(h,c);let f=ak(h,i);if(s&&(f.vs=[s,f.vs,l].flat(!0),e.predecessors(s).length)){let t=e.node(e.predecessors(s)[0]),n=e.node(e.predecessors(l)[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+t.order+n.order)/(f.weight+2),f.weight+=2}return f};let lk=BS.Graph,ck=$S;var uk=function(t,e,n,r){r||(r=t.nodes());let i=function(t){var e;for(;t.hasNode(e=ck.uniqueId("_root")););return e}(t),o=new lk({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(e=>t.node(e));return r.forEach(r=>{let a=t.node(r),s=t.parent(r);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(o.setNode(r),o.setParent(r,s||i),t[n](r).forEach(e=>{let n=e.v===r?e.w:e.v,i=o.edge(n,r),a=void 0!==i?i.weight:0;o.setEdge(n,r,{weight:t.edge(e).weight+a})}),Object.hasOwn(a,"minRank")&&o.setNode(r,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))}),o};let hk=KC,fk=function(t,e){let n=0;for(let r=1;r<e.length;++r)n+=JC(t,e[r-1],e[r]);return n},dk=sk,pk=uk,gk=function(t,e,n){let r,i={};n.forEach(n=>{let o,a,s=t.parent(n);for(;s;){if(o=t.parent(s),o?(a=i[o],i[o]=s):(a=r,r=s),a&&a!==s)return void e.setEdge(a,s);s=o}})},_k=BS.Graph,yk=$S;var mk=function t(e,n){if(n&&"function"==typeof n.customOrder)return void n.customOrder(e,t);let r=yk.maxRank(e),i=bk(e,yk.range(1,r+1),"inEdges"),o=bk(e,yk.range(r-1,-1,-1),"outEdges"),a=hk(e);if(xk(e,a),n&&n.disableOptimalOrderHeuristic)return;let s,l=Number.POSITIVE_INFINITY;for(let t=0,n=0;n<4;++t,++n){vk(t%2?i:o,t%4>=2),a=yk.buildLayerMatrix(e);let r=fk(e,a);r<l&&(n=0,s=Object.assign({},a),l=r)}xk(e,s)};function bk(t,e,n){const r=new Map,i=(t,e)=>{r.has(t)||r.set(t,[]),r.get(t).push(e)};for(const e of t.nodes()){const n=t.node(e);if("number"==typeof n.rank&&i(n.rank,e),"number"==typeof n.minRank&&"number"==typeof n.maxRank)for(let t=n.minRank;t<=n.maxRank;t++)t!==n.rank&&i(t,e)}return e.map(function(e){return pk(t,e,n,r.get(e)||[])})}function vk(t,e){let n=new _k;t.forEach(function(t){let r=t.graph().root,i=dk(t,r,n,e);i.vs.forEach((e,n)=>t.node(e).order=n),gk(t,n,i.vs)})}function xk(t,e){Object.values(e).forEach(e=>e.forEach((e,n)=>t.node(e).order=n))}let wk=BS.Graph,Ek=$S;var Ak=function(t){let e,n=Ek.buildLayerMatrix(t),r=Object.assign(function(t,e){let n={};function r(e,r){let i=0,o=0,a=e.length,s=r[r.length-1];return r.forEach((e,l)=>{let c=function(t,e){if(t.node(e).dummy)return t.predecessors(e).find(e=>t.node(e).dummy)}(t,e),u=c?t.node(c).order:a;(c||e===s)&&(r.slice(o,l+1).forEach(e=>{t.predecessors(e).forEach(r=>{let o=t.node(r),a=o.order;!(a<i||u<a)||o.dummy&&t.node(e).dummy||Tk(n,r,e)})}),o=l+1,i=u)}),r}return e.length&&e.reduce(r),n}(t,n),function(t,e){let n={};function r(e,r,i,o,a){let s;Ek.range(r,i).forEach(r=>{s=e[r],t.node(s).dummy&&t.predecessors(s).forEach(e=>{let r=t.node(e);r.dummy&&(r.order<o||r.order>a)&&Tk(n,e,s)})})}function i(e,n){let i,o=-1,a=0;return n.forEach((s,l)=>{if("border"===t.node(s).dummy){let e=t.predecessors(s);e.length&&(i=t.node(e[0]).order,r(n,a,l,o,i),a=l,o=i)}r(n,a,n.length,i,e.length)}),n}return e.length&&e.reduce(i),n}(t,n)),i={};["u","d"].forEach(o=>{e="u"===o?n:Object.values(n).reverse(),["l","r"].forEach(n=>{"r"===n&&(e=e.map(t=>Object.values(t).reverse()));let a=("u"===o?t.predecessors:t.successors).bind(t),s=function(t,e,n,r){let i={},o={},a={};return e.forEach(t=>{t.forEach((t,e)=>{i[t]=t,o[t]=t,a[t]=e})}),e.forEach(t=>{let e=-1;t.forEach(t=>{let s=r(t);if(s.length){s=s.sort((t,e)=>a[t]-a[e]);let r=(s.length-1)/2;for(let l=Math.floor(r),c=Math.ceil(r);l<=c;++l){let r=s[l];o[t]===t&&e<a[r]&&!Sk(n,t,r)&&(o[r]=t,o[t]=i[t]=i[r],e=a[r])}}})}),{root:i,align:o}}(0,e,r,a),l=function(t,e,n,r,i){let o={},a=function(t,e,n,r){let i=new wk,o=t.graph(),a=function(t,e,n){return(r,i,o)=>{let a,s=r.node(i),l=r.node(o),c=0;if(c+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":a=-s.width/2;break;case"r":a=s.width/2}if(a&&(c+=n?a:-a),a=0,c+=(s.dummy?e:t)/2,c+=(l.dummy?e:t)/2,c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":a=l.width/2;break;case"r":a=-l.width/2}return a&&(c+=n?a:-a),a=0,c}}(o.nodesep,o.edgesep,r);return e.forEach(e=>{let r;e.forEach(e=>{let o=n[e];if(i.setNode(o),r){var s=n[r],l=i.edge(s,o);i.setEdge(s,o,Math.max(a(t,e,r),l||0))}r=e})}),i}(t,e,n,i),s=i?"borderLeft":"borderRight";function l(t,e){let n=a.nodes(),r=n.pop(),i={};for(;r;)i[r]?t(r):(i[r]=!0,n.push(r),n=n.concat(e(r))),r=n.pop()}function c(t){o[t]=a.inEdges(t).reduce((t,e)=>Math.max(t,o[e.v]+a.edge(e)),0)}function u(e){let n=a.outEdges(e).reduce((t,e)=>Math.min(t,o[e.w]-a.edge(e)),Number.POSITIVE_INFINITY),r=t.node(e);n!==Number.POSITIVE_INFINITY&&r.borderType!==s&&(o[e]=Math.max(o[e],n))}return l(c,a.predecessors.bind(a)),l(u,a.successors.bind(a)),Object.keys(r).forEach(t=>o[t]=o[n[t]]),o}(t,e,s.root,s.align,"r"===n);"r"===n&&(l=Ek.mapValues(l,t=>-t)),i[o+n]=l})});let o=function(t,e){return Object.values(e).reduce((e,n)=>{let r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(n).forEach(([e,n])=>{let o=function(t,e){return t.node(e).width}(t,e)/2;r=Math.max(n+o,r),i=Math.min(n-o,i)});const o=r-i;return o<e[0]&&(e=[o,n]),e},[Number.POSITIVE_INFINITY,null])[1]}(t,i);return function(t,e){let n=Object.values(e),r=Ek.applyWithChunking(Math.min,n),i=Ek.applyWithChunking(Math.max,n);["u","d"].forEach(n=>{["l","r"].forEach(o=>{let a=n+o,s=t[a];if(s===e)return;let l=Object.values(s),c=r-Ek.applyWithChunking(Math.min,l);"l"!==o&&(c=i-Ek.applyWithChunking(Math.max,l)),c&&(t[a]=Ek.mapValues(s,t=>t+c))})})}(i,o),function(t,e){return Ek.mapValues(t.ul,(n,r)=>{if(e)return t[e.toLowerCase()][r];{let e=Object.values(t).map(t=>t[r]).sort((t,e)=>t-e);return(e[1]+e[2])/2}})}(i,t.graph().align)};function Tk(t,e,n){if(e>n){let t=e;e=n,n=t}let r=t[e];r||(t[e]=r={}),r[n]=!0}function Sk(t,e,n){if(e>n){let t=e;e=n,n=t}return!!t[e]&&Object.hasOwn(t[e],n)}let Ck=$S,kk=Ak;var Mk=function(t){(function(t){let e=Ck.buildLayerMatrix(t),n=t.graph().ranksep,r=0;e.forEach(e=>{const i=e.reduce((e,n)=>{const r=t.node(n).height;return e>r?e:r},0);e.forEach(e=>t.node(e).y=r+i/2),r+=i+n})})(t=Ck.asNonCompoundGraph(t)),Object.entries(kk(t)).forEach(([e,n])=>t.node(e).x=n)};let Rk=oC,Ok=sC,Nk=PC,Ik=$S.normalizeRanks,Lk=BC,Pk=$S.removeEmptyRanks,Vk=FC,Dk=UC,Bk={adjust:function(t){let e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||HC(t)},undo:function(t){let e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){t.nodes().forEach(e=>WC(t.node(e))),t.edges().forEach(e=>{let n=t.edge(e);n.points.forEach(WC),Object.hasOwn(n,"y")&&WC(n)})}(t);"lr"!==e&&"rl"!==e||(!function(t){t.nodes().forEach(e=>$C(t.node(e))),t.edges().forEach(e=>{let n=t.edge(e);n.points.forEach($C),Object.hasOwn(n,"x")&&$C(n)})}(t),HC(t))}},zk=mk,Fk=Mk,Gk=$S,jk=BS.Graph;var Uk=function(t,e){let n=e&&e.debugTiming?Gk.time:Gk.notime;n("layout",()=>{let r=n(" buildLayoutGraph",()=>function(t){let e=new jk({multigraph:!0,compound:!0}),n=Qk(t.graph());return e.setGraph(Object.assign({},Hk,Jk(n,Yk),Gk.pick(n,qk))),t.nodes().forEach(n=>{const r=Jk(Qk(t.node(n)),Wk);Object.keys($k).forEach(t=>{void 0===r[t]&&(r[t]=$k[t])}),e.setNode(n,r),e.setParent(n,t.parent(n))}),t.edges().forEach(n=>{let r=Qk(t.edge(n));e.setEdge(n,Object.assign({},Kk,Jk(r,Xk),Gk.pick(r,Zk)))}),e}(t));n(" runLayout",()=>function(t,e,n){e(" makeSpaceForEdgeLabels",()=>function(t){let e=t.graph();e.ranksep/=2,t.edges().forEach(n=>{let r=t.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)})}(t)),e(" removeSelfEdges",()=>function(t){t.edges().forEach(e=>{if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}(t)),e(" acyclic",()=>Rk.run(t)),e(" nestingGraph.run",()=>Vk.run(t)),e(" rank",()=>Nk(Gk.asNonCompoundGraph(t))),e(" injectEdgeLabelProxies",()=>function(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.width&&n.height){let n=t.node(e.v),r={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e:e};Gk.addDummyNode(t,"edge-proxy",r,"_ep")}})}(t)),e(" removeEmptyRanks",()=>Pk(t)),e(" nestingGraph.cleanup",()=>Vk.cleanup(t)),e(" normalizeRanks",()=>Ik(t)),e(" assignRankMinMax",()=>function(t){let e=0;t.nodes().forEach(n=>{let r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=Math.max(e,r.maxRank))}),t.graph().maxRank=e}(t)),e(" removeEdgeLabelProxies",()=>function(t){t.nodes().forEach(e=>{let n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))})}(t)),e(" normalize.run",()=>Ok.run(t)),e(" parentDummyChains",()=>Lk(t)),e(" addBorderSegments",()=>Dk(t)),e(" order",()=>zk(t,n)),e(" insertSelfEdges",()=>function(t){var e=Gk.buildLayerMatrix(t);e.forEach(e=>{var n=0;e.forEach((e,r)=>{var i=t.node(e);i.order=r+n,(i.selfEdges||[]).forEach(e=>{Gk.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:r+ ++n,e:e.e,label:e.label},"_se")}),delete i.selfEdges})})}(t)),e(" adjustCoordinateSystem",()=>Bk.adjust(t)),e(" position",()=>Fk(t)),e(" positionSelfEdges",()=>function(t){t.nodes().forEach(e=>{var n=t.node(e);if("selfedge"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,o=r.y,a=n.x-i,s=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*a/3,y:o-s},{x:i+5*a/6,y:o-s},{x:i+a,y:o},{x:i+5*a/6,y:o+s},{x:i+2*a/3,y:o+s}],n.label.x=n.x,n.label.y=n.y}})}(t)),e(" removeBorderNodes",()=>function(t){t.nodes().forEach(e=>{if(t.children(e).length){let n=t.node(e),r=t.node(n.borderTop),i=t.node(n.borderBottom),o=t.node(n.borderLeft[n.borderLeft.length-1]),a=t.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-o.x),n.height=Math.abs(i.y-r.y),n.x=o.x+n.width/2,n.y=r.y+n.height/2}}),t.nodes().forEach(e=>{"border"===t.node(e).dummy&&t.removeNode(e)})}(t)),e(" normalize.undo",()=>Ok.undo(t)),e(" fixupEdgeLabelCoords",()=>function(t){t.edges().forEach(e=>{let n=t.edge(e);if(Object.hasOwn(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}})}(t)),e(" undoCoordinateSystem",()=>Bk.undo(t)),e(" translateGraph",()=>function(t){let e=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,i=0,o=t.graph(),a=o.marginx||0,s=o.marginy||0;function l(t){let o=t.x,a=t.y,s=t.width,l=t.height;e=Math.min(e,o-s/2),n=Math.max(n,o+s/2),r=Math.min(r,a-l/2),i=Math.max(i,a+l/2)}t.nodes().forEach(e=>l(t.node(e))),t.edges().forEach(e=>{let n=t.edge(e);Object.hasOwn(n,"x")&&l(n)}),e-=a,r-=s,t.nodes().forEach(n=>{let i=t.node(n);i.x-=e,i.y-=r}),t.edges().forEach(n=>{let i=t.edge(n);i.points.forEach(t=>{t.x-=e,t.y-=r}),Object.hasOwn(i,"x")&&(i.x-=e),Object.hasOwn(i,"y")&&(i.y-=r)}),o.width=n-e+a,o.height=i-r+s}(t)),e(" assignNodeIntersects",()=>function(t){t.edges().forEach(e=>{let n,r,i=t.edge(e),o=t.node(e.v),a=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=a,r=o),i.points.unshift(Gk.intersectRect(o,n)),i.points.push(Gk.intersectRect(a,r))})}(t)),e(" reversePoints",()=>function(t){t.edges().forEach(e=>{let n=t.edge(e);n.reversed&&n.points.reverse()})}(t)),e(" acyclic.undo",()=>Rk.undo(t))}(r,n,e)),n(" updateInputGraph",()=>function(t,e){t.nodes().forEach(n=>{let r=t.node(n),i=e.node(n);r&&(r.x=i.x,r.y=i.y,r.rank=i.rank,e.children(n).length&&(r.width=i.width,r.height=i.height))}),t.edges().forEach(n=>{let r=t.edge(n),i=e.edge(n);r.points=i.points,Object.hasOwn(i,"x")&&(r.x=i.x,r.y=i.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,r))})};let Yk=["nodesep","edgesep","ranksep","marginx","marginy"],Hk={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},qk=["acyclicer","ranker","rankdir","align"],Wk=["width","height","rank"],$k={width:0,height:0},Xk=["minlen","weight","width","height","labeloffset"],Kk={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Zk=["labelpos"];function Jk(t,e){return Gk.mapValues(Gk.pick(t,e),Number)}function Qk(t){var e={};return t&&Object.entries(t).forEach(([t,n])=>{"string"==typeof t&&(t=t.toLowerCase()),e[t]=n}),e}let tM=$S,eM=BS.Graph;var nM={debugOrdering:function(t){let e=tM.buildLayerMatrix(t),n=new eM({compound:!0,multigraph:!0}).setGraph({});return t.nodes().forEach(e=>{n.setNode(e,{label:e}),n.setParent(e,"layer"+t.node(e).rank)}),t.edges().forEach(t=>n.setEdge(t.v,t.w,{},t.name)),e.forEach((t,e)=>{let r="layer"+e;n.setNode(r,{rank:"same"}),t.reduce((t,e)=>(n.setEdge(t,e,{style:"invis"}),e))}),n}};var rM={graphlib:BS,layout:Uk,debug:nM,util:{time:$S.time,notime:$S.notime},version:"1.1.8"};class iM extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){let e=t.layout;if(!e)continue;let r=YE(t.children[0]);if(!r)continue;var n=new rM.graphlib.Graph;n.setGraph({edgesep:e._edgeSep}),n.setDefaultEdgeLabel(function(){return{}}),n.graph().rankdir=this._getDagreDirection(e.direction);let i=new Map;for(let e of t.children){let t=e.dataScope.getAttrVal(qE);i.set(t,t+""),n.setNode(t,{label:e.text?e.text:"",width:e.bounds.width,height:e.bounds.height})}for(let t of r.linkList)n.setEdge(t.source,t.target);rM.layout(n);const o={};let a=Math.min(...n.nodes().map(t=>n.node(t).y)),s=Math.min(...n.nodes().map(t=>n.node(t).x)),l=e.left-s,c=e.top-a;for(const t of n.nodes())o[t]={x:n.node(t).x+l,y:n.node(t).y+c};for(let e of t.children){let t=e.dataScope.getAttrVal(qE);pA(e,o[i.get(t)].x-e.x,o[i.get(t)].y-e.y)}}let r=lE(t,!0);for(let t of r)$w(t)}_getDagreDirection(t){switch(t){case EE.Left2Right:return"LR";case EE.Right2Left:return"RL";case EE.Top2Bottom:return"TB";case EE.Bottom2Top:return"BT"}}}class oM extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){let e=t.layout;if(!e)continue;let n=jE(t.children[0]);if(!n)continue;let r=Od(n._data),i=Math.max(...t.children.map(t=>t.bounds.width)),o=Math.max(...t.children.map(t=>t.bounds.height)),a=e.orientation==bE?[e.height,e.width]:[e.width,e.height],s=wp().nodeSize([i,o]).size(a)(r);this._apply(s,e,t)}$w(t)}_apply(t,e,n){let r,i,o=n.children.filter(e=>e.dataScope.getAttrVal(qE)==t.data[qE])[0];switch(e.orientation){case bE:r=t.y+e.left,i=t.x+e.top;break;case vE:r=t.x+e.left,i=e.top+t.y}if(pA(o,r-o.x,i-o.y),t.children&&t.children.length>0)for(let r of t.children)this._apply(r,e,n)}}class aM extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=this._inputVars.filter(t=>t.type===nA.PROPERTY&&t.property===kA.CHILDREN_ORDER)[0].element,n=e.layout,r=n.width?n.width:e.bounds.width,i=n.height?n.height:e.bounds.height,o=void 0===n.top?e.bounds.top:n.top,a=void 0===n.left?e.bounds.left:n.left,s=Od(e).sum(t=>t.type===lT.Rect?t.width*t.height:0);Cp().size([r,i])(s),this._apply(s,a,o);let l=lE(t,!0);for(let t of l)$w(t)}_apply(t,e,n){if(t.data.type==lT.Collection&&t.children)for(let r of t.children)this._apply(r,e,n);else t.data.type==lT.Rect&&(t.data.resize(t.x1-t.x0,t.y1-t.y0),pA(t.data,t.x0+e-t.data.left,t.y0+n-t.data.top))}}class sM extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){if(!t.layout)continue;if(0===t.children.length)continue;let e=jE(t.children[0]);if(!e)continue;let n={};for(let e of t.children)n[e.dataScope.getAttrVal(qE)]=e;t.children[0].type===lT.Rect?this._layoutRects(e.getRoot(),e,n):this._layoutArcs(e.getRoot(),e,n)}$w(t)}_layoutArcs(t,e,n){let r=e.getChildren(t);if(0===r.length)return;let i=n[t[qE]],o=!i||i.type!=lT.Arc&&i.type!=lT.Pie?60:i.startAngle;for(let t=0;t<r.length;t++){let i=r[t],a=n[i[qE]];if(a.type===lT.Arc){let t=VE(o+a.angle);a.setAngles(o,t),o=t}this._layoutArcs(i,e,n)}}_layoutRects(t,e,n){let r=e.getChildren(t);if(0===r.length)return;let i,o,a=n[t[qE]];this._direction,i=a.left,o=a.bottom;for(let t=0;t<r.length;t++){let a=r[t],s=n[a[qE]];pA(s,i-s.left,o-s.top),i+=s.width,this._layoutRects(a,e,n)}}}class lM extends pE{constructor(t){super(t)}run(){super.run();let t=this.outputVar,e=this.inputVars[0],n=t.conditionalEncoding,r=e.context,i=t.result,o=n.responderComponent;i.clear();let a=Array.isArray(o)?o:[o];if(n.evalFunction)for(let t of a){Qw(t).forEach(t=>i.setValue(t.id,n.evalFunction(r,t)))}}}class cM extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){let e=t.layout;if(!e)continue;let n=360/t.children.length;for(let[r,i]of t.children.entries())pA(i,e.x+e.radius-i.bounds.x,e.y-i.bounds.y),i._rotate=[r*n,e.x,e.y]}let n=lE(t,!0);for(let t of n)$w(t)}}class uM extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let n of e){let e=n.layout;if(!e)continue;let r=Od(e._tree?e._tree._data:jE(n.children[0])._data);if(e.isRadial()){r=Md().size([LE(e.angleExtent),e.radius])(r),e._d3Root=r;const t=new Map(r.descendants().map(t=>[t.data[qE],[t.x,t.y]]));for(let r of n.children){let n=r.dataScope.getAttrVal(qE);pA(r,e.x-r.bounds.x,e.y-t.get(n)[1]-r.bounds.y),r._rotate=[PE(t.get(n)[0]),e.x,e.y]}}else if(e.orientation===vE){!e.width||e.width;let i=e.height?e.height:600;r=Md().nodeSize([t.bounds.width+1,i/(r.height+1)])(r),e._d3Root=r;const o=new Map(r.descendants().map(t=>[t.data[qE],[t.x,t.y]]));let a=1/0,s=-a;r.each(t=>{t.x>s&&(s=t.x),t.x<a&&(a=t.x)}),e._x0=a;for(let t of n.children){let n=t.dataScope.getAttrVal(qE);pA(t,o.get(n)[0]-a+e.left-t.bounds.x,o.get(n)[1]+e.top-t.bounds.y)}}else if(e.orientation===bE){!e.width||e.width;let i=e.height?e.height:600;r=Md().nodeSize([t.bounds.height,i/(r.height+1)])(r),e._d3Root=r;const o=new Map(r.descendants().map(t=>[t.data[qE],[t.x,t.y]]));let a=1/0,s=-a;r.each(t=>{t.x>s&&(s=t.x),t.x<a&&(a=t.x)}),e._x0=a;for(let t of n.children){let n=t.dataScope.getAttrVal(qE);pA(t,o.get(n)[1]+e.left-t.bounds.x,o.get(n)[0]-a+e.top-t.bounds.y)}}}let n=lE(t,!0);for(let t of n)$w(t)}}class hM extends eA{constructor(t,e){super(t),this._cond=e}get context(){return this._cond}}class fM extends pE{constructor(t,e,n){super(t),this._fn=e,this._compnt=n}run(){super.run();let t=this.inputVars.find(t=>t instanceof hM);this.outputVar,this._fn(void 0,t.context,this._compnt)}}class dM extends pE{constructor(t){super(t)}run(){super.run();let t=this.outputVar,e=this.inputVars.find(t=>t instanceof bT),n=t.encodings[0].dataTable.getAttributeType(e.attribute),r={};for(let e of t.encodings){let t=this._computeAttrValues(e,n);Object.assign(r,t)}t.attrValues=r}_computeAttrValues(t,e){let n=Qw(t.element),r={};if(t.element.type===lT.Area&&["width","height","fillGradient"].indexOf(t.channel)>=0)for(let e of n)for(let n of e.vertices)r[n.id]=zE(n).aggregateNumericalAttribute(t.attribute,t.aggregator);else switch(e){case $E.Boolean:break;case $E.Date:for(let e of n)r[e.id]=zE(e).getAttrVal(t.attribute);break;case $E.String:try{if("count"==t.aggregator)for(let e of n)r[e.id]=zE(e).getAttributeValues(t.attribute).length;else for(let e of n)r[e.id]=zE(e).getAttrVal(t.attribute)}catch(e){throw new Error("Cannot bind "+this.channel+" to "+t.attribute+" : "+e)}break;default:if(t.attribute.startsWith("parent.")||t.attribute.startsWith("child.")){let e=t.dataTable.tree.nodeTable,i=t.attribute.split(".")[0],o=t.attribute.split(".")[1];for(let t of n){let n=zE(t).getAttrVal(i);r[t.id]=new BE(e).cross(qE,n).getAttrVal(o)}}else for(let e of n)r[e.id]=zE(e).aggregateNumericalAttribute(t.attribute,t.aggregator)}if(t.transform)for(let e of n)r[e.id]=t.transform(r[e.id],e);return t.attrValues=r,r}}class pM extends eA{constructor(t,e,n){super(t),this._dataset=n,this._predicate=e}get dataset(){return this._dataset}get predicate(){return this._predicate}}class gM{constructor(){this._variables={},this._operators={},this._edges=[]}toJSON(){const t=this._edges.map(t=>({from:t.fromNode.id,to:t.toNode.id,isDirected:t.isDirected})),e={};for(const t in this._variables)e[t]=Object.values(this._variables[t]).map(t=>{let e={id:t.id,type:t.type,incoming:t.incomingEdges.map(t=>t.id),outgoing:t.outgoingEdges.map(t=>t.id),undirected:t.undirectedEdges.map(t=>t.id)};return"ChannelVar"===t.type?(e.channel=t.channel,e.element=t.element):"BoundsVar"===t.type||"DataScopeVar"===t.type?e.element=t.element:"dataValue"===t.type?(e.scale=t.scale,e.attrValues=t.attrValues):"FieldVar"===t.type?(e.field=t.field,e.dataset=t.dataset):"PropertyVar"===t.type?(e.property=t.property,e.element=t.element):e.scale=t.scale,e});const n={};for(const t in this._operators)n[t]=Object.values(this._operators[t]).map(t=>{let e={id:t.id,type:t.type,inputVars:t.inputVars.map(t=>t.id),outputVar:t.outputVar?t.outputVar.id:null};return t.type===gE.DOMAIN_BUILDER?e.aggregator=t.aggregator:t.type===gE.SCALE_BUILDER&&(e.channel=t.channel),e});return{edges:t,variables:e,operators:n}}getVariable(t,...e){if(Object.values(nA).indexOf(t)<0)throw console.log(t),new Error("Variable Type Not Known");let n=this.findVariable(t,e);if(n)return n;switch(t){case nA.CHANNEL:n=new rA(t,e[0],e[1]),"vertex"!=e[1].type&&"segment"!=e[1].type||this._connectPathElement2Size(e[1],n);break;case nA.PROPERTY:n=new TA(t,e[0],e[1]);break;case nA.ATTRIBUTE:n=new bT(t,e[0],e[1]);break;case nA.ITEMS:n=new pM(t,e[0],e[1]);break;case nA.ATTR_VALUE:n=new AT(t,e[0]);break;case nA.DATASCOPE:n=new _T(t,e[0]);break;case nA.BOUNDS:n=new gT(t,e[0]);break;case nA.SCALE:n=new wA(t,e[0]);break;case nA.AFFIXATION:n=new HT(t,e[0]);break;case nA.ALIGNMENT:n=new JT(t,e[0]);break;case nA.EVT_CTX:n=new hM(t,e[0],e[1]);break;case nA.CONDITION_RESULT:n=new EA(t,e[0],e[1])}return t in this._variables||(this._variables[t]={}),this._variables[t][n.id]=n,n}_connectPathElement2Size(t,e){let n=t.parent,r=e.channel,i=this.findVariable(nA.CHANNEL,["x"===r?"width":"height",n]);if(i){let t=i.incomingDataflow;t||(t=this.createOneWayDependency(gE.CONDUIT)),this.connect(e,t),this.connect(t,i)}}findIncomingDataflowOperator(t,e){return e.incomingDataflow&&e.incomingDataflow.type===t?e.incomingDataflow:void 0}getIncomingDataflowOperator(t,e){let n=this.findIncomingDataflowOperator(t,e);return n||this.createOneWayDependency(t)}getOutgoingDataflowOperator(t,e){for(let n of e.outgoingEdges)if(n.toNode instanceof pE&&n.toNode.type===t)return n.toNode;return this.createOneWayDependency(t)}createOneWayDependency(t,...e){if(Object.values(gE).indexOf(t)<0)throw new Error("Dependency Type Not Known");let n;switch(t){case gE.EVAL_BBOX:n=new ST(t);break;case gE.AFFIXER:n=new YT(t);break;case gE.DATA_EXTRACTOR:n=new dM(t,e[0]);break;case gE.SCALE_BUILDER:n=new TT(t,e[0]);break;case gE.ENCODER:n=new AA(t,e[0]);break;case gE.AXIS_PATH_PLACER:n=new PT(t);break;case gE.AXIS_TICKS_PLACER:n=new VT(t);break;case gE.AXIS_LABELS_PLACER:n=new DT(t);break;case gE.AXIS_TITLE_PLACER:n=new KT(t);break;case gE.LINK_PLACER:n=new tS(t);break;case gE.GRID_LAYOUT:n=new BT(t);break;case gE.STACK_LAYOUT:n=new FT(t);break;case gE.PACK_LAYOUT:n=new XT(t);break;case gE.FORCE_LAYOUT:n=new QT(t);break;case gE.DIRECTED_LAYOUT:n=new iM(t);break;case gE.TIDY_TREE_LAYOUT:n=new oM(t);break;case gE.TREEMAP_LAYOUT:n=new aM(t);break;case gE.STRATA_LAYOUT:n=new sM(t);break;case gE.CIRCULAR_LAYOUT:n=new cM(t);break;case gE.CLUSTER_LAYOUT:n=new uM(t);break;case gE.GRIDLINES_PLACER:n=new zT(t);break;case gE.BIN_TRANSFORMER:n=new jT(t);break;case gE.FILTER_TRANSFORMER:n=new UT(t);break;case gE.KDE_TRANSFORMER:n=new qT(t);break;case gE.TARGET_EVALUATOR:n=new lM(t);break;case gE.TARGET_UPDATER:n=new fM(t,e[0],e[1]);break;case gE.CONDUIT:default:n=new GT(t)}return t in this._operators||(this._operators[t]={}),this._operators[t][n.id]=n,n}createMultiWayDependency(t){if(Object.values(gE).indexOf(t)<0)throw new Error("Dependency Type Not Known");let e;return gE.ALIGNER,e=new ZT(t),t in this._operators||(this._operators[t]={}),this._operators[t][e.id]=e,e}connect(t,e,n=!0){if(t instanceof eA&&e instanceof pE){if(!e.inputVars.includes(t)){const r=new mT(t,e,n);this._edges.push(r),t.outgoingEdges.push(r),e.inputVars.push(t)}}else if(t instanceof pE&&e instanceof eA){if(!t.outputVars.includes(e)){const r=new mT(t,e,n);this._edges.push(r),t.outputVars.push(e),e.incomingEdges.push(r)}}else if(t instanceof eA&&e instanceof yT){if(!e.vars.includes(t)){const n=new mT(t,e,!1);this._edges.push(n),e.vars.push(t),e.edges.push(t),t.undirectedEdges.push(n)}}else{if(!(t instanceof yT&&e instanceof eA))throw new Error("An edge must connect a variable and an operator.");if(!t.vars.includes(e)){const n=new mT(e,t,!1);this._edges.push(n),t.vars.push(e),t.edges.push(e),e.undirectedEdges.push(n)}}}disconnectChannelVarFromBBoxOperator(t){let e=this.getOutgoingDataflowOperator(gE.EVAL_BBOX,t),n=t.outgoingEdges.find(n=>n.fromNode===t&&n.toNode===e);n&&this.disconnect(t,e,n)}disconnect(t,e,n){if(t instanceof eA&&e instanceof pE){let r=t.outgoingEdges.findIndex(t=>t===n);r>=0&&(this._edges.splice(this._edges.indexOf(n),1),t.outgoingEdges.splice(r,1));let i=e.inputVars.findIndex(e=>e==t);i>=0&&e.inputVars.splice(i,1)}else if(t instanceof pE&&e instanceof eA){let r=e.incomingEdges.findIndex(t=>t===n);r>=0&&(this._edges.splice(this._edges.indexOf(n),1),e.incomingEdges.splice(r,1));let i=t.outputVars.findIndex(t=>t===e);i>=0&&t.outputVars.splice(i,1)}}deleteVariable(t){for(let e=t.incomingEdges.length-1;e>=0;e--){let n=t.incomingEdges[e],r=n.fromNode;this.disconnect(r,t,n),r.isIsolated()&&delete this._operators[r.type][r.id]}for(let e=t.outgoingEdges.length-1;e>=0;e--){let n=t.outgoingEdges[e],r=n.toNode;this.disconnect(t,r,n),r.isIsolated()&&delete this._operators[r.type][r.id]}delete this._variables[t.type][t.id]}deleteOperator(t){for(let e=t.outputVars.length-1;e>=0;e--){let n=t.outputVars[e],r=n.incomingEdges.find(e=>e.fromNode===t&&e.toNode===n);this.disconnect(t,n,r),n.isIsolated()&&delete this._variables[n.type][n.id]}for(let e=t.inputVars.length-1;e>=0;e--){let n=t.inputVars[e],r=n.outgoingEdges.find(e=>e.fromNode===n&&e.toNode===t);this.disconnect(n,t,r),n.isIsolated()&&delete this._variables[n.type][n.id]}delete this._operators[t.type][t.id]}addInteraction(t){}_dfs(t,e,n){if(t&&0!==t.outgoingEdges.length)for(let r of t.outgoingEdges)r.isDirected&&(e.push(r.toNode),this._dfs(r.toNode.outputVars[0],e.slice(),n));else n.push(e)}processChange(t,e,...n){let r=this.findVariable(t,n);if(r){for(let t of r.outgoingEdges)if(t.isDirected){let n=t.toNode;n.run();let r=n.outputVars;if(r.length>0){let t=r[0];switch(t.type){case nA.ITEMS:this.processChange(t.type,e,t.predicate,t.dataset);break;case nA.ATTRIBUTE:this.processChange(t.type,e,t.attribute,t.dataset);break;case nA.BOUNDS:this.processChange(t.type,e,t.element);break;case nA.CHANNEL:this.processChange(t.type,e,t.channel,t.element);break;case nA.PROPERTY:this.processChange(t.type,e,t.property,t.element);break;case nA.SCALE:case nA.ATTR_VALUE:this.processChange(t.type,e,t.encodings[0]);break;case nA.CONDITION_RESULT:this.processChange(t.type,e,t.result)}}}for(let t of r.undirectedEdges)e.push(t.operator)}else console.warn("Unable to find variables matching the described change: ",t,n)}findVariable(t,e){if(!(t in this._variables))return null;let n=Object.values(this._variables[t]);switch(t){case nA.CHANNEL:return n.find(t=>t.channel==e[0]&&cA(t.element)==cA(e[1]));case nA.PROPERTY:return n.find(t=>t.property==e[0]&&t.element==e[1]);case nA.AFFIXATION:return n.find(t=>t.affixation==e[0]);case nA.ATTRIBUTE:return n.find(t=>t.attribute==e[0]&&t.dataset==e[1]);case nA.ITEMS:return n.find(t=>t.dataset==e[1]);case nA.ATTR_VALUE:case nA.SCALE:return n.find(t=>t.encodings.includes(e[0]));case nA.EVT_CTX:return n.find(t=>t.context===e[0]);case nA.CONDITION_RESULT:return n.find(t=>t.result==e[0]);case nA.DATASCOPE:default:return e[0].classId?n.find(t=>cA(t.element)==cA(e[0])):n.find(t=>t.element.id==e[0].id)}}findVariablesByElement(t){let e={};for(let n in this._variables){let r=Object.values(this._variables[n]).filter(e=>e.element&&cA(e.element)==cA(t));r.length>0&&(e[n]=r)}return e}}function _M(t){return!(!Zw(t)&&t.type!=lT.Glyph||t.dataScope)||t.type===lT.Collection&&t.firstChild.dataScope.numTuples>1}function yM(t,e,n,r){let i=r.getAttributeType(n);if(i!=$E.String&&i!=$E.Date&&i!=$E.Integer)throw new Error("Repeat only works on a string or date attribute: "+n+" is "+i);if(!function(t){if(Array.isArray(t)){if(1===t.length)return _M(t[0]);for(let e of t)if(!Zw(e)||e.dataScope)return!1;return!0}return _M(t)}(e))throw new Error("The "+e.type+" is not repeatable");return function(t,e,n,r){let i=r.getAttributeSummary(n).unique.map(t=>e.dataScope?e.dataScope.cross(n,t):new BE(r).cross(n,t));i=i.filter(t=>!t.isEmpty());let o=iT(t);o.dataScope=e.dataScope?e.dataScope.clone():new BE(r),o.addChild(e),e._refBounds||(e._refBounds=e.bounds.clone());for(let t=1;t<i.length;t++){let t=aT(e);o.addChild(t)}return o.children.forEach((t,e)=>t.dataScope=i[e]),o}(t,e,n,r)}class mM{constructor(t,e,n,r,i){this._id="encoding_"+uT(),this._elem=t,this._channel=e,this._attribute=n,this._table=i.table,this._aggregator=r,this._includeZero=i.includeZero,this._flipScale=i.flipScale,this._mapping=i.mapping,this._preferredRangeExtent=i.rangeExtent,this._preferredRangeStart=i.rangeStart,this._preferredDomain=i.domain,this._scaleType=i.scaleType,this._colorScheme=i.scheme,this._forLegend=i.forLegend,this._transform=i.transform,i.shareScale&&(this._baseEnc=i.shareScale),this._scales=[],this._elemGroups=[],this._elem2scale={},this._refElements=[],["width","height","radius","angle","thickness","radialDistance","strokeWidth","area"].indexOf(this._channel)>=0&&(this._includeZero=!0),this.initialize()}get id(){return this._id}initialize(){this._scales=[];let t=Qw(this._elem);if(this._elemGroups=[],"x"===this._channel||"y"===this._channel){let e=this._elem,n=sE(e);if(n.layout&&n.layout.type==fE.GRID){let t="x"===this._channel?n.layout.getElementsByCol(!0,e):n.layout.getElementsByRow(!0,e);for(let e of t)this._createScaleForElems(e)}else if("vertex"===this._elem.type&&(fA(this._elem.parent)||hA(this._elem.parent))){let t=Qw(this._elem.parent).map(t=>tE(this._elem,[t]));for(let e of t)this._createScaleForElems(e)}else this._createScaleForElems(t)}else if("angle"===this._channel){let e=t.reduce((t,e)=>{const n=e.parent.id;return t[n]||(t[n]=[]),t[n].push(e),t},{}),n=Object.values(e);for(let t of n)this._createScaleForElems(t)}else this._createScaleForElems(t)}_createScaleForElems(t){this._elemGroups.push(t);var e=function(t){if(t.scaleType)return new vT(t.scaleType);if("text"===t.channel)return new vT("ordinal");switch(t.dataTable.getAttributeType(t.attribute)){case $E.Boolean:break;case $E.Date:return new vT("time");case $E.String:if("count"==t.aggregator)return new vT("linear");if(t.channel.indexOf("Color")>=0){let e={};return e.scheme=t.colorScheme?t.colorScheme:"schemeCategory10",new vT("ordinalColor",e)}return"src"===t.channel?new vT("ordinal"):new vT("point");default:return["strokeColor","fillColor","fillGradient"].indexOf(t.channel)>=0?t.mapping?new vT("linear"):new vT("sequentialColor",{scheme:t.colorScheme}):new vT("linear")}}(this);this._scales.push(e);for(let n of t)this._elem2scale[n.id]=e}getScale(t){return this._elem2scale[t.id]}getAttrValue(t,e,n){let r=this.getScale(e).invert(t,n),i=this._attribute;if(this.dataTable.getAttributeType(i)===$E.Date){let t=Qw(e).map(t=>t.dataScope.getAttrVal(i));return t.sort((t,e)=>t-e),t[s(t,r)]}return r}getChannelValue(t,e){return this.getScale(e).map(t)}getElements(t){let e=this._scales.indexOf(t);return this._elemGroups[e]}get element(){return this._elem}get channel(){return this._channel}get attribute(){return this._attribute}get dataTable(){return this._table}get aggregator(){return this._aggregator}hasMultipleScales(){return this._scales.length>0}get scales(){return this._scales}getRangeStart(t){let e=this.getScale(t);return Math.min(...e.range)}getRangeExtent(t){return this.getScale(t).rangeExtent}get domain(){if(1===this._scales.length)return this._scales[0].domain;throw new Error("AttributeEncoding: multiple scales exist, specify element to get domain.")}get rangeExtent(){if(1===this._scales.length)return this._scales[0].rangeExtent;throw new Error("AttributeEncoding: multiple scales exist, specify element to get rangeExtent.")}get scaleType(){return this._scaleType}set scaleType(t){this._scaleType=t}getDomain(t){return this.getScale(t).domain}set domain(t){this._preferredDomain=t;for(let e of this._scales)e._scale.domain(t);for(let t of this._refElements)t instanceof IT&&t.createTicksLabels({});this._elem.scene.onChange(nA.ATTR_VALUE,this)}set rangeExtent(t){for(let e of this._scales)e.rangeExtent=t;for(let t of this._refElements)t instanceof IT&&t.createTicksLabels({});this._elem.scene.onChange(nA.PROPERTY,kA.RANGE_EXTENT,this)}get transform(){return this._transform}set transform(t){this._transform=t,this._elem.scene.onChange(nA.PROPERTY,kA.TRANSFORM,this)}set includeZero(t){this._includeZero=t;for(let t of this._refElements)t instanceof IT&&t.createTicksLabels({});this._elem.scene.onChange(nA.PROPERTY,kA.INCLUDE_ZERO,this)}get includeZero(){return this._includeZero}set flipScale(t){this._flipScale=t,this._elem.scene.onChange(nA.PROPERTY,kA.FLIP_SCALE,this)}get flipScale(){return this._flipScale}set mapping(t){this._mapping=t}get mapping(){return this._mapping}set colorScheme(t){this._colorScheme=t}get colorScheme(){return this._colorScheme}addRefElement(t){this._refElements.indexOf(t)<0&&this._refElements.push(t)}get refElements(){return this._refElements}clearRefElements(){this._refElements=[]}pan(t,e,n){let r=n||this._elem;r.scene.createMask(r);let i=this.getDomain(r),o=Math.min(...i),a=Math.max(...i),s="log"!==this._scales[0].type,l=this.getAttrValue(t,r,s)-this.getAttrValue(t+e,r,s);(s||o+l>0)&&(this.domain=[o+l,a+l])}zoom(t,e,n,r){let i=r||this._elem;i.scene.createMask(i);let o=this.getDomain(i),a=Math.min(...o),s=Math.max(...o),l="log"!==this._scales[0].type,c=this.getAttrValue(e,i,l),u=a-(c-a)*t*n,h=s+(s-c)*t*n;u!==h&&(!l&&u<=0||(this.domain=[u,h]))}}class bM{constructor(){this._vals={},this._vals.elements=[]}set(t,e){this._vals[t]=e}get(t){return this._vals[t]}clear(){this._vals={},this._vals.elements=[]}}class vM{constructor(t,e,n,r){this._respCompnt=e,this._responderEval=n,this._efxFn=r,this._evtCtx=t,this._evalResult=new ET}get responderComponent(){return this._respCompnt}get eventContext(){return this._evtCtx}get evalResult(){return this._evalResult}get evalFunction(){return this._responderEval}get stylingFunction(){return this._efxFn}}class xM extends kE{constructor(t,e,n,r,i){super(i),this._type=lT.Gridlines,this._id=this._type+uT(),this._attribute=e,this._channel=t,this._scale=n,this._elems=r,this._args=i,"strokeColor"in i||(this.styles.strokeColor="#ddd"),"opacity"in i||(this.styles.opacity=.5),this.updateValues(),this._lines=[]}updateValues(){"values"in this._args?this._values=this._args.values:this._scale?this._values=OT(this._scale,this._channel,this._elems):this._values=this._elems.map(t=>t.dataScope.getAttrVal(this._attribute))}get type(){return this._type}get id(){return this._id}getSVGPathData(){let t="";if("radialDistance"===this._channel)for(let e of this._lines)t+="M "+e.x+" "+e.y+" m -"+e.r+" 0 a "+e.r+" "+e.r+" 0 1 0 "+2*e.r+" 0 a "+e.r+" "+e.r+" 0 1 0 -"+2*e.r+" 0 ";else for(let e of this._lines)t+=["M",e.x1,e.y1].join(" ")+[" L",e.x2,e.y2].join(" ")+" ";return t}_updateBounds(){if("radialDistance"===this._channel){let t=this._lines.map(t=>new Yw(t.x-t.r,t.y-t.y,2*t.r,2*t.r));this._bounds=Hw(t)}else{let t=this._lines.map(t=>t.x1).concat(this._lines.map(t=>t.x2)),e=this._lines.map(t=>t.y1).concat(this._lines.map(t=>t.y2)),n=Math.min(...t),r=Math.max(...t),i=Math.min(...e),o=Math.max(...e);this._bounds=new Yw(n,i,r-n,o-i)}}get elements(){return this._elems}get values(){return this._values}get channel(){return this._channel}get attribute(){return this._attribute}get scale(){return this._scale}get lines(){return this._lines}set lines(t){this._lines=t}}class wM extends hE{constructor(t){super(),this.type=fE.STACK,this._orientation=t.orientation,this._direction=t.direction,this._left=t.left,this._top=t.top,this._horzCellAlignment="horzCellAlignment"in t&&t.horzCellAlignment?t.horzCellAlignment:Xw.LEFT,this._vertCellAlignment="vertCellAlignment"in t&&t.vertCellAlignment?t.vertCellAlignment:Xw.BOTTOM,this._gap="gap"in t?t.gap:0}clone(){let t=new wM({orientation:this._orientation,direction:this._direction,left:this._left,top:this._top});return t._horzCellAlignment=this._horzCellAlignment,t._vertCellAlignment=this._vertCellAlignment,t}get horzCellAlignment(){return this._horzCellAlignment}get vertCellAlignment(){return this._vertCellAlignment}get orientation(){return this._orientation}set horzCellAlignment(t){this._horzCellAlignment=t}set vertCellAlignment(t){this._vertCellAlignment=t}set orientation(t){this._orientation=t}}function EM(t,e,n,r,i){let o=i.getAttributeType(n);if(o!=$E.String&&o!=$E.Date&&o!=$E.Integer)throw new Error("Divide only works on a string or date attribute: "+n+" is "+o);if(!AM(e))throw new Error("The "+e.type+" is not dividable");switch(e.type){case lT.Line:case lT.Path:return;case lT.Circle:return function(t,e,n,r,i){let o,a,s,l=Qw(e),c=n||xE;if(c!=xE&&c!=wE)throw new Error("Unknown orientation: "+c);c===xE&&l.forEach(n=>{let l=n.dataScope?n.dataScope:new BE(i),c=i.getUniqueAttributeValues(r).map(t=>l.cross(r,t));c=c.filter(t=>!t.isEmpty());let u=iT(t);null==a&&(a=u.id),u._classId=a,u.dataScope=n.dataScope?n.dataScope:new BE(i);let h=n.parent;h.removeChild(n),delete t._itemMap[n.id];let f=360/c.length,d=90;for(let t=0;t<c.length;t++){let r=rT({type:"arc",innerRadius:0,outerRadius:n.radius,x:n.x,y:n.y,startAngle:VE(d-f*(t+1)),endAngle:VE(d-f*t),strokeColor:n.strokeColor,fillColor:n.fillColor,strokeWidth:n.strokeWidth,opacity:n.opacity});s||(s=r.id),r.classId=s,r.dataScope=c[t],r._updateBounds(),r._refBounds=r.bounds.clone(),u.addChild(r),u._layout=new wM({orientation:xE,direction:AE.CLOCKWISE}),u._layout.group=u,h.removeChild(n),h.addChild(u),n===e&&(o=u)}});return{newMark:o.children[0],collection:o}}(t,e,r,n,i);case lT.Rect:return function(t,e,n,r,i){let o,a=Qw(e),s=n||bE;if(s!=bE&&s!=vE)throw new Error("Unknown orientation: "+s);let l=i.getUniqueAttributeValues(r).map(t=>new BE(i).cross(r,t)),c={},u=0;for(let t of a){let e=l;t.dataScope&&(e=l.map(e=>e.merge(t.dataScope)),e=e.filter(t=>!t.isEmpty())),e.length>u&&(u=e.length),c[t.id]=e}let h,f=rT({type:"rect",left:e.bounds.left,top:e.bounds.top,width:e.bounds.width,height:e.bounds.height,strokeColor:e.strokeColor,fillColor:e.fillColor,strokeWidth:e.strokeWidth,opacity:e.opacity});f._classId=f.id;for(let n of a){let r=iT(t);null==h&&(h=r.id),r._classId=h,r.dataScope=n.dataScope?n.dataScope:new BE(i);let a=n.parent;a.removeChild(n),delete t._itemMap[n.id];let l=c[n.id],u=n.bounds,d=u.left,p=u.top,g=s==bE?u.width/l.length:u.width,_=s==bE?u.height:u.height/l.length;for(let t=0;t<l.length;t++){let e=aT(f);e.dataScope=l[t],e.resize(g,_),e._updateBounds(),e._refBounds=e.bounds.clone(),r.addChild(e)}a.addChild(r),r._layout=new wM({orientation:s,left:d,top:p}),r._layout.group=r,n==e&&(o=r)}return{newMark:o.children[0],collection:o}}(t,e,r,n,i);case lT.Area:return function(t,e,n,r,i){let o,a=Qw(e),s=n||bE;if(s!=bE&&s!=vE)throw new Error("Unknown orientation: "+s);let l,c=i.getUniqueAttributeValues(r).map(t=>new BE(i).cross(r,t)),u={},h=0;for(let t of a){let e=c;t.dataScope&&(e=c.map(e=>e.merge(t.dataScope)),e=e.filter(t=>!t.isEmpty())),e.length>h&&(h=e.length),u[t.id]=e}let f=Object.assign({},e.styles);f.vertices=e.vertices.map(t=>[t.x,t.y]),f.type="area",f.orientation=e.orientation,f.baseline=e.baseline;let d=rT(f);if(d._classId=d.id,e.vertices)for(let t=0;t<e.vertices.length;t++)e.vertices[t].dataScope&&(d.vertices[t]._dataScope=e.vertices[t].dataScope.clone());for(let n of a){let r=iT(t);null==l&&(l=r.id),r._classId=l,r.dataScope=n.dataScope?n.dataScope:new BE(i);let a=n.parent;a.removeChild(n),delete t._itemMap[n.id];let c=u[n.id],h=n.bounds,f=h.left,p=h.top,g=s==bE?h.width/c.length:h.width,_=s==bE?h.height:h.height/c.length;for(let t=0;t<c.length;t++){let e=aT(d);e.dataScope=c[t],console.log(e.dataScope),e.resize(g,_),e._updateBounds(),e._refBounds=e.bounds.clone(),r.addChild(e);for(let t of e.vertices)t.dataScope?t.dataScope=e.dataScope.merge(t.dataScope):t.dataScope=e.dataScope}a.addChild(r),r._layout=new wM({orientation:s,left:f,top:p}),r._layout.group=r,n==e&&(o=r)}return{newMark:o.children[0],collection:o}}(t,e,r,n,i);case lT.Ring:return function(t,e,n,r,i){let o,a,s,l=Qw(e),c=n||xE;if(c!=xE&&c!=wE)throw new Error("Unknown orientation: "+c);c===xE&&l.forEach(n=>{let l=n.dataScope?n.dataScope:new BE(i),c=i.getUniqueAttributeValues(r).map(t=>l.cross(r,t));c=c.filter(t=>!t.isEmpty());let u=iT(t);null==a&&(a=u.id),u._classId=a,u.dataScope=n.dataScope?n.dataScope:new BE(i);let h=n.parent;h.removeChild(n),delete t._itemMap[n.id];let f=360/c.length,d=90;for(let t=0;t<c.length;t++){let r=rT({type:"arc",innerRadius:n.innerRadius,outerRadius:n.outerRadius,x:n.x,y:n.y,startAngle:VE(d-f*(t+1)),endAngle:VE(d-f*t),strokeColor:n.strokeColor,fillColor:n.fillColor,strokeWidth:n.strokeWidth,opacity:n.opacity});s||(s=r.id),r.classId=s,r.dataScope=c[t],r._updateBounds(),r._refBounds=r.bounds.clone(),u.addChild(r),u._layout=new wM({orientation:xE,direction:AE.CLOCKWISE}),u._layout.group=u,h.removeChild(n),h.addChild(u),n===e&&(o=u)}});return{newMark:o.children[0],collection:o}}(t,e,r,n,i);case lT.Pie:case lT.Arc:return function(t,e,n,r,i){let o,a,s,l=Qw(e),c=n||xE;if(c!=xE&&c!=wE)throw new Error("Unknown orientation: "+c);c===xE||l.forEach(n=>{let l=n.dataScope?n.dataScope:new BE(i),c=i.getUniqueAttributeValues(r).map(t=>l.cross(r,t));c=c.filter(t=>!t.isEmpty());let u=iT(t);null==a&&(a=u.id),u._classId=a,u.dataScope=n.dataScope?n.dataScope:new BE(i);let h=n.parent;h.removeChild(n),delete t._itemMap[n.id];for(let t=0;t<c.length;t++){let r=rT({type:"arc",innerRadius:n.innerRadius+t*(n.outerRadius-n.innerRadius)/c.length,outerRadius:n.innerRadius+(t+1)*(n.outerRadius-n.innerRadius)/c.length,x:n.x,y:n.y,startAngle:n.startAngle,endAngle:n.endAngle,strokeColor:n.strokeColor,fillColor:n.fillColor,strokeWidth:n.strokeWidth,opacity:n.opacity});s||(s=r.id),r.classId=s,r.dataScope=c[t],r._updateBounds(),r._refBounds=r.bounds.clone(),u.addChild(r),u._layout=new wM({orientation:wE}),u._layout.group=u,h.removeChild(n),h.addChild(u),n===e&&(o=u)}});return{newMark:o.children[0],collection:o}}(t,e,r,n,i)}}function AM(t){if([lT.Line,lT.Circle,lT.Rect,lT.Area,lT.Ring,lT.Pie,lT.Path].indexOf(t.type)<0)return!1;if(t.type===lT.Path&&(t.closed||!t.firstVertex.dataScope))return!1;if(t.dataScope){let e=Qw(t);for(let t of e)if(t.dataScope.numTuples>1)return!0;return!1}return!0}function TM(t,e,n,r){let i=r.getAttributeType(n);if(i!=$E.String&&i!=$E.Date&&i!=$E.Integer)throw new Error("Repopulate only works on a string or date attribute: "+n+" is "+i);let o=Qw(e);for(let t of o){let e=r.getAttributeSummary(n).unique.map(e=>t.dataScope?t.dataScope.cross(n,e):new BE(r).cross(n,e));e=e.filter(t=>!t.isEmpty());let i=t.children.length-e.length,o=e.length-t.children.length;for(let e=0;e<i;e++)t.removeChildAt(t.children.length-1);let a=t._children.length;for(let e=0;e<o;e++){let n=aT(t._children[e%a]);t.addChild(n)}t.children.forEach((t,n)=>t.dataScope=e[n])}}class SM{constructor(t,e){this._elem=t,this._base=e,this._id=CM(t,e),this._channels={},this._attribute=void 0}get id(){return this._id}get element(){return this._elem}get base(){return this._base}get channels(){return Object.keys(this._channels)}addChannel(t,e){let n={};n.elemAnchor="elementAnchor"in e?e.elementAnchor:"x"==t||"angle"==t?Xw.CENTER:Xw.MIDDLE,n.baseAnchor="baseAnchor"in e?e.baseAnchor:"x"==t||"angle"==t?Xw.CENTER:Xw.MIDDLE,n.offset="offset"in e?e.offset:0,"attribute"in e&&(this._attribute=e.attribute),this._channels[t]=n}hasChannel(t){return t in this._channels}getElementAnchor(t){return this._channels[t].elemAnchor}getBaseAnchor(t){return this._channels[t].baseAnchor}getOffset(t){return this._channels[t].offset}get attribute(){return this._attribute?this._attribute:dT}}function CM(t,e){return(t.classId?t.classId:t.id)+":"+(e.classId?e.classId:e.id)}function kM(t,e,n,r){t.dataScope&&t.dataScope.dataTable.hasAttribute(e)?function(t,e,n,r){if(!t.dataScope.dataTable.hasAttribute(e))return void console.warn("Cannot order collection children by an non-existent attribute",e);let i;if(e===dT)i=(t,n)=>parseInt(t.dataScope.getAttrVal(e).substring(1))-parseInt(n.dataScope.getAttrVal(e).substring(1));else{switch(t.children[0].dataScope.getAttributeType(e)){case $E.Date:break;case $E.Number:case $E.Integer:i=(t,n)=>t.dataScope.aggregateNumericalAttribute(e)-n.dataScope.aggregateNumericalAttribute(e);break;case $E.String:i=r?(t,n)=>r.indexOf(t.dataScope.getAttrVal(e))-r.indexOf(n.dataScope.getAttrVal(e)):(t,n)=>t.dataScope.getAttrVal(e)<n.dataScope.getAttrVal(e)?-1:1}}t.children.sort(i),n&&t.children.reverse()}(t,e,n,r):function(t,e,n){let r;switch(e){case"x":case"y":case"width":case"height":r=(t,n)=>t.bounds[e]-n.bounds[e];break;default:r=(t,n)=>t[e]-n[e]}t._children.sort(r),n&&t.children.reverse()}(t,e,n),t._sortBy={property:e,descending:n,vals:r}}function MM(t,e,n,r){t.vertices[0].dataScope&&t.vertices[0].dataScope.dataTable.hasAttribute(e)?function(t,e,n,r){let i;if(e===dT)i=(t,n)=>parseInt(t.dataScope.getAttrVal(e).substring(1))-parseInt(n.dataScope.getAttrVal(e).substring(1));else{switch(t.vertices[0].dataScope.getAttributeType(e)){case $E.Date:break;case $E.Number:case $E.Integer:i=(t,n)=>t.dataScope.aggregateNumericalAttribute(e)-n.dataScope.aggregateNumericalAttribute(e);break;case $E.String:i=r?(t,n)=>r.indexOf(t.dataScope.getAttrVal(e))-r.indexOf(n.dataScope.getAttrVal(e)):(t,n)=>t.dataScope.getAttrVal(e)<n.dataScope.getAttrVal(e)?-1:1}}t.vertices.sort(i),n&&t.vertices.reverse()}(t,e,n,r):function(t,e,n){let r=(t,n)=>t[e]-n[e];t.vertices.sort(r),n&&t.vertices.reverse()}(t,e,n),t._sortBy={property:e,descending:n,vals:r}}class RM extends hE{constructor(t){super(),this.type=fE.GRID,this._numCols=t.numCols,this._numRows=t.numRows,this._start="start"in t?t.start:mE.TopLeft,this._direction="direction"in t?t.direction:yE.RowFirst,this._rowGap="rowGap"in t&&void 0!==t.rowGap?t.rowGap:5,this._colGap="colGap"in t&&void 0!==t.colGap?t.colGap:5,this._cellHorzAlignment="horzCellAlignment"in t&&dE("h",t.horzCellAlignment)?t.horzCellAlignment:Xw.LEFT,this._cellVertAlignment="vertCellAlignment"in t&&dE("v",t.vertCellAlignment)?t.vertCellAlignment:Xw.BOTTOM,this._numCols||this._numRows||(this._numRows=1),this._left=void 0,this._top=void 0,this._cellBounds=void 0,this._grid=void 0}get cellBounds(){return this._cellBounds}get numCols(){return this._numCols?this._numCols:this._numRows?Math.ceil(this.group.children.length/this._numRows):0}set numCols(t){this._numCols=t}set numRows(t){this._numRows=t}get numRows(){return this._numRows?this._numRows:this._numCols?Math.ceil(this.group.children.length/this._numCols):0}clone(){let t=new RM({numCols:this._numCols,numRows:this._numRows,start:this._start,direction:this._direction,colGap:this._colGap,rowGap:this._rowGap,horzCellAlignment:this._cellHorzAlignment,vertCellAlignment:this._cellVertAlignment});return t._left=this._left,t._top=this._top,this._cellBounds&&(t._cellBounds=this._cellBounds.map(t=>t.clone())),t}getElementsByRow(t,e){let n=[],r=this.group.children;for(let e=0;e<this.numRows;e++){let i=this._grid[e].filter(t=>null!=t).map(t=>r[t]);if(t){let t=[];for(let e of i)t=t.concat(lE(e));n.push(t)}else n.push(i)}return e&&(n=this._filterElementsByExample(n,e)),n}getElementsByCol(t,e){let n=[],r=this.group.children,i=this._grid;for(let e=0;e<this.numCols;e++){let o=i.map(t=>t[e]).filter(t=>null!=t).map(t=>r[t]);if(t){let t=[];for(let e of o)t=t.concat(lE(e));n.push(t)}else n.push(o)}return e&&(n=this._filterElementsByExample(n,e)),n}getElementsByCell(t,e){let n=[],r=this.group.children;for(let e=0;e<r.length;e++)if(t){let t=lE(r[e]);n.push(t)}else n.push(r[e]);return e&&(n=this._filterElementsByExample(n,e)),n}_filterElementsByExample(t,e){let n;return"vertex"===e.type?(n=t.map(t=>t.filter(t=>t.classId===e.parent.classId)),n=n.map(t=>tE(e,t))):"segment"===e.type?(n=t.map(t=>t.filter(t=>t.classId===e.parent.classId)),n=n.map(t=>eE(e,t))):n=t.map(t=>t.filter(t=>t.classId===e.classId)),n}getIndex(t){let e=t;for(;e&&e.parent!==this.group;)e=e.parent;return this.group.children.indexOf(e)}getRowCol(t){let e,n;switch(this._direction){case yE.RowFirst:e=Math.floor(t/this.numCols),n=t%this.numCols;break;case yE.ColumnFirst:e=t%this.numRows,n=Math.floor(t/this.numRows);break;default:throw new Error("Invalid fill direction. Use 'row_first' or 'column_first'.")}return this._start.toLowerCase().includes("bottom")&&(e=this.numRows-1-e),this._start.toLowerCase().includes("right")&&(n=this.numCols-1-n),{row:e,col:n}}get startCorner(){return this._start}set startCorner(t){this._start=t}get direction(){return this._direction}set direction(t){this._direction=t}}class OM extends qA{constructor(t,e){super(),this._type=lT.Axis,this._id=this._type+uT(),this._enc=t,this._textColor="textColor"in e?e.textColor:"#555",this._strokeColor="strokeColor"in e?e.strokeColor:"#555",this._fontSize="fontSize"in e?e.fontSize:"12px",this._x="x"in e?e.x:100,this._y="y"in e?e.y:100,this._showTitle=!("showTitle"in e)||e.showTitle,this._orientation="orientation"in e?e.orientation:vE,this._numberFormat=e.numberFormat?e.numberFormat:""}get attribute(){return this._enc.attribute}get channel(){return this._enc.channel}get attributeType(){return fT(this._enc.element).getFieldType(this.attribute)}get orientation(){return this._orientation}get textColor(){return this._textColor}}class NM extends OM{constructor(t,e){super(t,e),"numCols"in e||"numRows"in e?(this._numCols=e.numCols,this._numRows=e.numRows):this._orientation===vE?this._numCols=1:this._numRows=1,this._initialize()}_initialize(){let t=this._enc.element.scene,e=this._enc.attribute,n=this._enc.scales[0],r=new hT(n.domain.map(t=>({category:t,value:n.map(t)}))),i=r.getUniqueAttributeValues("category").sort((t,e)=>e.length-t.length)[0],o=this._enc.element,a=o instanceof kE&&o.closed&&"strokeColor"!==this._enc.channel?o.strokeWidth:0;if(this._orientation===vE){let n=0;this._showTitle&&(this.addChild(new QA({fillColor:this._textColor,fontSize:this._fontSize,text:e,x:this._x,y:this._y,anchor:["left","top"]})),n=parseFloat(this._fontSize)+5);let s=t.mark("rect",{top:this._y+2+n,left:this._x,width:10,height:10,strokeWidth:a,strokeColor:o.strokeColor,opacity:o.opacity}),l=t.mark("text",{text:i,fillColor:this._textColor,fontSize:this._fontSize,x:this._x+20,y:this._y+n+12+a,anchor:["left","bottom"]}),c=t.glyph(s,l),u=t.repeat(c,r);t.encode(l,{channel:"text",attribute:"category",forLegend:!0}),t.encode(s,{channel:"fillColor",attribute:"category",shareScale:this._enc,forLegend:!0}),u.layout=new RM({numCols:this._numCols,numRows:this._numRows}),this.addChild(u)}else{let e=t.mark("rect",{top:this._y,left:this._x,width:10,height:10,strokeWidth:a,strokeColor:o.strokeColor,opacity:o.opacity}),n=t.mark("text",{text:i,fillColor:this._textColor,fontSize:this._fontSize,x:this._x+15,y:this._y,anchor:["left","top"]}),s=t.glyph(e,n),l=t.repeat(s,r);t.encode(n,{channel:"text",attribute:"category",forLegend:!0}),t.encode(e,{channel:"fillColor",attribute:"category",shareScale:this._enc,forLegend:!0}),l.layout=new RM({numCols:this._numCols,numRows:this._numRows,colGap:15}),this.addChild(l)}}}class IM extends OM{constructor(t,e){super(t,e),this._initialize()}_initialize(){let t,e,n,r=this._enc.element.scene,i=this._enc.attribute;if(this._orientation==vE?(t=15,e=300):(t=300,e=15),this._showTitle){let e=r.mark("text",{fillColor:this._textColor,text:i,x:this._x+t/2,y:this._y,anchor:["center","middle"]});this.addChild(e),n=20}else n=0;let o,a=r.mark("rect",{top:this._y+n,left:this._x,width:t,height:e,strokeWidth:0,opacity:this._enc.element.opacity}),s=Object.values(this._enc.attrValues),l=[Math.min(...s),Math.max(...s)],c=this._enc.mapping,u=[],h=[],f=Hl(this._numberFormat);if(c){let i=Object.keys(c).map(t=>parseFloat(t)).sort((t,e)=>t-e);this._orientation==vE?(o=new _E({x1:0,y1:100,x2:0,y2:0}),i.forEach(i=>{let a=(i-l[0])/(l[1]-l[0]);o.addStop(100*a,c[i],1);let s=r.mark("line",{x1:this._x+t,x2:this._x+t+5,y1:this._y+e-a*e+n,y2:this._y+e-a*e+n,strokeColor:this._strokeColor});h.push(s);let d=r.mark("text",{fillColor:this._textColor,text:this._numberFormat?f(i):i.toFixed(0),x:this._x+t+5+5,y:this._y+e-a*e+n,anchor:["left","middle"]});u.push(d)})):(o=new _E({x1:0,y1:0,x2:100,y2:0}),i.forEach(i=>{let a=(i-l[0])/(l[1]-l[0]);o.addStop(100*a,c[i],1);let s=r.mark("line",{x1:this._x+a*t,x2:this._x+a*t,y1:this._y+20-5+n,y2:this._y+e+5+n,strokeColor:this._strokeColor});h.push(s);let d=r.mark("text",{fillColor:this._textColor,text:this._numberFormat?f(i):i.toFixed(0),x:this._x+a*t,y:this._y+e+5+n,anchor:["center","top"]});u.push(d)}))}else{let a=this._enc.scales[0].domain,s=fT(this._enc.element),l=s.getAttributeType(i),c=[],d=l===$E.Date?s.getUniqueFieldValues(i):[...new Set(Object.values(this._enc.attrValues))];if(d.length<=10)c=d,c.sort((t,e)=>t-e);else if(l===$E.Date){d.sort((t,e)=>t-e);for(let t=0;t<d.length;t+=Math.ceil(d.length/10))c.push(d[t])}else{let t=(a[1]-a[0])/9;for(let e=0;e<10;e++)c.push(a[0]+e*t)}let p=0,g=(c[c.length-1]-c[0])/c.length;for(;g<1;)g*=10,p++;c=c.map(t=>t.toFixed(p)),this._orientation==vE?(o=new _E({x1:0,y1:100,x2:0,y2:0}),c.forEach(c=>{let d=(c-a[0])/(a[1]-a[0]);o.addStop(100*d,this._enc.scales[0].map(c),1);let p=r.mark("line",{x1:this._x+t,x2:this._x+t+5,y1:this._y+e-d*e+n,y2:this._y+e-d*e+n,strokeColor:this._strokeColor});h.push(p);let g=r.mark("text",{fillColor:this._textColor,text:l===$E.Date?s.getRawValue(i,c):this._numberFormat?f(c):c,x:this._x+t+5+5,y:this._y+e-d*e+n,anchor:["left","middle"]});u.push(g)})):(o=new _E({x1:0,y1:0,x2:100,y2:0}),c.forEach(c=>{let f=(c-a[0])/(a[1]-a[0]);o.addStop(100*f,this._enc.scale.map(c),1);let d=r.mark("line",{x1:this._x+f*t,x2:this._x+f*t,y1:this._y+e+n,y2:this._y+e+5+n,strokeColor:this._strokeColor});h.push(d);let p=r.mark("text",{fillColor:this._textColor,text:l===$E.Date?s.getRawValue(i,c):c,x:this._x+f*t,y:this._y+e+5+n,anchor:["center","top"]});u.push(p)}))}a.styles.fillColor=o,this.addChild(a);for(let t of u)this.addChild(t);for(let t of h)this.addChild(t)}}class LM extends qA{constructor(t){super(),this._type=lT.Composite,this._id=t&&t.id?t.id:this._type+uT()}addChild(t){let e=t.parent;super.addChild(t);let n=aE(t)._depGraph;e&&PA(e,t,n),VA(this,t,n)}}class PM{constructor(t,e,n){this._elems=t,this._channel=e,this._anchor=n}get elements(){return this._elems}get channel(){return this._channel}get anchor(){return this._anchor}}class VM extends hE{constructor(t){super(),this.type=fE.STRATA,this._direction=t.direction,this._gap="gap"in t?t.gap:0}clone(){return new VM({direction:this._direction,gap:this._gap})}}function DM(t,e,n,r,i,o){switch(e.type){case lT.Circle:case lT.Ring:return function(t,e,n,r,i,o){let a,s=n||TE.OUTWARD,l=i||50;if(s!==TE.INWARD&&s!==TE.OUTWARD)throw"Unknown direction to stratify";let c,u=Qw(e,t),h=Array.isArray(o)?o:[o];if(r){let n=iT(t);n.dataScope=void 0,null==c&&(c=n.id),n._classId=c;let r=u.map(t=>h[0].getNode(t.dataScope.getAttrVal(qE)));BM(u,r,h[0],n,e.classId?e.classId:e.id,400,350,s,l),a=n}else u.forEach((n,r)=>{let i=iT(t);i.dataScope=void 0,null==c&&(c=i.id),i._classId=c;let o=n.parent;zM(n,e.id,s,l,h[r],h[r].getRoot(),i,t,!0),i._layout=new VM({direction:s}),i._layout.group=i,o.addChild(i),n===e&&(a=i)});return a}(t,e,n,r,i,o);case lT.Rect:return function(t,e,n,r,i,o){let a,s,l=n||EE.Top2Bottom,c=i||50;if(!Object.values(EE).includes(l))throw"Unknown direction to stratify";return Qw(e).forEach(n=>{let r=iT(t);r.dataScope=void 0,null==s&&(s=r.id),r._classId=s;let i=n.parent;FM(n,e.id,l,c,o,o.getRoot(),r,t,!0),r._layout=new VM({direction:l}),r._layout.group=r,i.addChild(r),n===e&&(a=r)}),a}(t,e,n,0,i,o)}}function BM(t,e,n,r,i,o,a,s,l){let c=e.map(t=>n.getParent(t)).filter((t,e,n)=>n.findIndex(e=>e[qE]===t[qE])===e);if(c=c.filter(t=>t!==n.getRoot()),0===c.length)return;let u=[];for(let e of c){let c,h,f,d=t.filter(t=>n.getParent(n.getNode(t.dataScope.getAttrVal(qE)))===e);if(d[0].type===lT.Circle){let t=d.map(t=>jw(o,a,t.bounds.x,t.bounds.y)-t.radius),e=d.map(t=>jw(o,a,t.bounds.x,t.bounds.y)+t.radius);f=s===TE.OUTWARD?Math.max(...e):Math.min(...t)-l;let n=d.map(t=>DE(t.bounds.x,t.bounds.y,o,a)),r=d.map(t=>DE(o+jw(o,a,t.bounds.x,t.bounds.y),a-t.radius,o,a)),i=n.map((t,e)=>t-r[e]),u=n.map((t,e)=>t+r[e]),p=i.concat(u);c=Math.min(...p),h=Math.max(...p)}else d[0].type===lT.Arc&&(c=360,h=-360,d.forEach(t=>{let e=t.startAngle,n=t.endAngle;n<e&&(n+=360),c=Math.min(c,e),h=Math.max(h,n)}),c=VE(c),h=VE(h),f=s===TE.OUTWARD?Math.max(...d.map(t=>t.outerRadius)):Math.min(...d.map(t=>t.innerRadius))-l);let p=rT({type:"arc",innerRadius:f,outerRadius:f+l,x:o,y:a,startAngle:VE(c),endAngle:VE(h),strokeColor:t[0].strokeColor,fillColor:t[0].fillColor,strokeWidth:t[0].strokeWidth,opacity:t[0].opacity});p._updateBounds(),p.dataScope=n.getNodeDataScope(e),p._classId=i,r.addChild(p),u.push(p)}BM(u,c,n,r,i,o,a,s,l)}function zM(t,e,n,r,i,o,a,s,l){l&&(t.dataScope=i.getNodeDataScope(o),t._classId=e);let c=i.getChildren(o);if(0===c.length)return;let u=t.type===lT.Circle||t.type===lT.Ring?60:t.startAngle,h=(t.type===lT.Circle||t.type===lT.Ring?360:t.angle)/c.length;for(let o=0;o<c.length;o++){let s,l;l=n===TE.OUTWARD?t.type===lT.Circle?t.radius:t.outerRadius:t.type===lT.Circle?t.radius-r:t.innerRadius-r,s=rT(360===h?{type:"ring",innerRadius:l,outerRadius:l+r,x:t.x,y:t.y,strokeColor:t.strokeColor,fillColor:t.fillColor,strokeWidth:t.strokeWidth,opacity:t.opacity}:{type:"arc",innerRadius:l,outerRadius:l+r,x:t.x,y:t.y,startAngle:VE(u+h*o),endAngle:VE(u+h*(o+1)),strokeColor:t.strokeColor,fillColor:t.fillColor,strokeWidth:t.strokeWidth,opacity:t.opacity}),s._updateBounds(),s.dataScope=i.getNodeDataScope(c[o]),s._classId=e+"_strata",a.addChild(s),zM(s,e,n,r,i,c[o],a)}}function FM(t,e,n,r,i,o,a,s,l){l&&(t.dataScope=i.getNodeDataScope(o),t._classId=e,a.addChild(t));let c,u,h,f=i.getChildren(o);if(0!==f.length){c=t.left,u=t.bottom,h=t.width/f.length;for(let o=0;o<f.length;o++){let s=aT(t);pA(s,c-s.left,u-s.top),s.resize(h,r),s._updateBounds(),c+=h,s.dataScope=i.getNodeDataScope(f[o]),s._classId=e,a.addChild(s),FM(s,e,n,r,i,f[o],a)}}}class GM{constructor(t,e,n,r){this._id=t,this._event=n,this._target=e,this._evtCtx=new bM,this._cumulative=r}get id(){return this._id}get event(){return this._event}get eventContext(){return this._evtCtx}get target(){return this._target}isCumulative(){return this._cumulative}isMouseDriven(){return["brush","brushX","brushY","click","hover"].includes(this._event)}isKeyboardDriven(){return["keydown","keyup"].includes(this._event)}isWidgetDriven(){return["change","input"].includes(this._event)}}class jM extends qA{constructor(t){super(),this._itemMap={},this._peerIndex=new Map,this._type=lT.Scene,this._id=t&&t.id?t.id:this._type+uT(),t&&t.fillColor&&(this.fillColor=t.fillColor),this._encodings={},this._relations=[],this._triggers={},this._condEncodings={},this._depGraph=new gM}get depGraph(){return this._depGraph}get interactionTriggers(){return this._triggers}buildPeerIndex(){this._peerIndex=new Map;let t=this._peerIndex;uE(this,e=>{e.classId&&(t.has(e.classId)||t.set(e.classId,[]),t.get(e.classId).push(e))})}mark(t,e){if(Object.values(sT).indexOf(t)<0)throw new Error("Mascot does not allow directly creating a "+t);let n=void 0===e?{}:e;n.type=t;let r=rT(n);return null!==r&&(r._classId=r.id,this.addChild(r),this._itemMap[r.id]=r,MA(r,this._depGraph),VA(this,r,this._depGraph)),r}glyph(...t){let e=[];for(let n of t)e.push([n.parent,n]);let n=oT(t);if(null!==n){n._classId=n.id,this.addChild(n),this._itemMap[n.id]=n;for(let t of e)PA(t[0],t[1],this._depGraph);DA(n,this._depGraph),VA(this,n,this._depGraph)}return n}composite(){let t=new LM;return null!==t&&(t._classId=t.id,this.addChild(t),this._itemMap[t.id]=t,LA(t,this._depGraph),VA(this,t,this._depGraph)),t}attach(t,e){if(t.type==lT.Glyph)for(let e of t.children)e._refBounds||(e._refBounds=e.bounds.clone());t.dataScope=new BE(e)}repeat(t,e,n){let r=n||{};if(r.attribute=r.attribute||dT,function(t,e,n){if(!t||void 0===e)throw new Error("Incomplete information to do repeat. You must specify an element, a categorical data attribute and a data table");if(e instanceof GE||e instanceof UE){if(!Array.isArray(t)||2!==t.length)throw new Error("To repeat with a tree or a network, you need to provide two marks, one for node and one for link")}else e instanceof hT&&WE(n.attribute,e);if(n.layout&&!(n.layout instanceof hE))throw new Error("Invalid layout: "+n.layout)}(t,e,r),e instanceof GE||e instanceof UE){let n=t[0].parent,r=t[1].parent,[i,o]=function(t,e,n,r){let i=r.nodeTable.getAttributeSummary(qE).unique.map(t=>e.dataScope?e.dataScope.cross(qE,t):new BE(r.nodeTable).cross(qE,t)),o=iT(t),a=iT(t),s={};a.dataScope=e.dataScope?e.dataScope.clone():new BE(r.nodeTable),a.addChild(e);for(let t=1;t<i.length;t++){let t=aT(e);a.addChild(t)}a.children.forEach((t,e)=>{t.dataScope=i[e],t.links=[],s[t.dataScope.getAttrVal(qE)]=t});let l=r.linkTable.getAttributeSummary(dT).unique.map(t=>n.dataScope?n.dataScope.cross(dT,t):new BE(r.linkTable).cross(dT,t));o.dataScope=n.dataScope?n.dataScope.clone():new BE(r.linkTable),o.addChild(n);for(let t=1;t<l.length;t++){let t=aT(n);o.addChild(t)}o.children.forEach((t,e)=>t.dataScope=l[e]);let c=r instanceof GE?"parent":"source",u=r instanceof GE?"child":"target";for(let t of o.children){let e=t.dataScope.getAttrVal(c),n=t.dataScope.getAttrVal(u),r=s[e],i=s[n];t.source=r,t.target=i,r.links.push(t),i.links.push(t)}return[a,o]}(this,t[0],t[1],e);return this.buildPeerIndex(),PA(n,t[0],this._depGraph),PA(r,t[1],this._depGraph),IA(i,this._depGraph),IA(o,this._depGraph),VA(i,t[0],this._depGraph),VA(i.parent,i,this._depGraph),VA(o,t[1],this._depGraph),VA(o.parent,o,this._depGraph),[i,o]}if(e instanceof hT){let n=t.parent,i=yM(this,t,r.attribute,e);return this.buildPeerIndex(),PA(n,t,this._depGraph),IA(i,this._depGraph),VA(i,t,this._depGraph),VA(i.parent,i,this._depGraph),r.layout&&(i.layout=r.layout),i}}divide(t,e,n){let r=n||{};if(r.attribute=r.attribute||dT,console.log("------ divide by",r.attribute," ----"),function(t,e,n){if(!t||void 0===e)throw new Error("Incomplete information to do divide. You must specify an element, a categorical data attribute and a data table");if(e instanceof hT&&WE(n.attribute,e),n.layout&&!(n.layout instanceof hE))throw new Error("Invalid layout: "+n.layout)}(t,e,r),e instanceof GE||e instanceof UE)throw"Not implemented";if(e instanceof hT){let{newMark:n,collection:i}=EM(this,t,r.attribute,r.orientation,e);return this.buildPeerIndex(),RA(t,this._depGraph),MA(n,this._depGraph),IA(i,this._depGraph),VA(i,n,this._depGraph),i.parent.type!==lT.Scene&&VA(i.parent,i,this._depGraph),this.onChange(nA.CHANNEL,"width",n),{newMark:n,collection:i}}}densify(t,e,n){let r=n||{};if(r.attribute=r.attribute||dT,console.log("------ densify by",r.attribute," ----"),function(t,e,n){if(!t||void 0===e)throw new Error("Incomplete information to do densification. You must specify an element, a categorical data attribute and a data table");e instanceof hT&&WE(n.attribute,e)}(t,e,r),e instanceof GE||e instanceof UE)throw"Not implemented";if(e instanceof hT){let n=JE(0,t,r.attribute,r.orientation,e);return this.buildPeerIndex(),RA(t,this._depGraph),MA(n,this._depGraph),n.parent.type!==lT.Scene&&VA(n.parent,n,this._depGraph),this.onChange(nA.CHANNEL,"width",n),n}}stratify(t,e,n){if(!(e instanceof GE||Array.isArray(e)&&e.every(t=>t instanceof GE)))throw"Cannot stratify on a non-tree dataset";if(![lT.Circle,lT.Rect,lT.Ring].includes(t.type))throw"Cannot stratify elements that are not rects, circles, or rings";let r=n||{},i=r.direction,o=r.size,a=t.parent,s=DM(this,t,i,r.startFromLeaf,o,e);return this.buildPeerIndex(),PA(a,t,this._depGraph),IA(s,this._depGraph),s.children.length>0&&VA(s,s.firstChild,this._depGraph),VA(s.parent,s,this._depGraph),s}repopulate(t,e,n){t.dataScope=void 0;let r=t;for(let t in n){TM(0,r,n[t],e);let i=aA(r.children[0]);for(let t of i){oA(t,this),OA(t,this._depGraph);for(let e of t.refElements)NT(e,this),NA(e,this._depGraph);t.clearRefElements()}let o=Qw(r);for(let t of o)if(t.layout){for(let e of t.layout.refElements)NT(e,this),NA(e,this._depGraph);t.layout.clearRefElements()}r=r.children[0]}t.dataScope=new BE(e),this.buildPeerIndex(),this.onChange(nA.CHANNEL,"width",t.children[0])}classify(t,e){let n=e||{};console.log("------ classify by",n.attribute," ----"),function(t,e,n,r){let i=Qw(e);for(let e of i){let i,o={},a=e.children;for(let t of a){let e=t.dataScope.getAttrVal(n);e in o||(o[e]=[]),o[e].push(t)}let s=fT(a[0]);for(let a in o){let l=iT(t);e.addChild(l),void 0===i&&(i=l.id),l._classId=i,l.dataScope=e.dataScope?e.dataScope.cross(n,a):new BE(s).cross(n,a);for(let t of o[a])l.addChild(t);r&&(l._layout=r.clone(),l._layout.group=l)}}}(this,t,n.attribute,n.layout),this.buildPeerIndex(),PA(t,t.firstChild.firstChild,this._depGraph),IA(t.firstChild,this._depGraph),VA(t.firstChild,t.firstChild.firstChild,this._depGraph),VA(t,t.firstChild,this._depGraph),this.onChange(nA.CHANNEL,"width",t.firstChild.firstChild)}affix(t,e,n,r){t.dataScope.dataTable!==t.dataScope.dataTable&&console.warn("Affix: elements and base elements are not created from the same table");let i=CM(t,e),o=this._relations.find(t=>t.id===i);o||(o=new SM(t,e),this._relations.push(o)),o.addChannel(n,r||{}),function(t,e){let n=e.getVariable(nA.AFFIXATION,t),r=e.getOutgoingDataflowOperator(gE.AFFIXER,n);e.connect(n,r);for(let n of t.channels){let i=e.getVariable(nA.CHANNEL,n,t.element),o=e.getVariable(nA.CHANNEL,n,t.base);e.connect(o,r),e.connect(r,i)}r.run()}(o,this._depGraph)}align(t,e,n){let r=new PM(t,e,n);!function(t,e){let n=e.createMultiWayDependency(gE.ALIGNER),r=e.getVariable(nA.ALIGNMENT,t);e.connect(r,n);for(let r of t.elements){let i=e.getVariable(nA.CHANNEL,t.channel,r);e.connect(i,n)}n.run()}(r,this._depGraph),this._relations.push(r)}encode(t,e){if("rowId"===e.attribute&&(e.attribute=dT),function(t,e){if(!t||!("channel"in e)||!("attribute"in e))throw new Error("Incomplete information to do encoding. You must specify an item, a categorical data attribute and a data table");let n=fT(t);if(n.tree){let t=e.attribute;if(t.indexOf(".")>0&&!n.tree.nodeTable.hasAttribute(t.split(".")[1]))throw new Error("Data attribute does not exist in the data table")}else if(!n||!n.hasAttribute(e.attribute))throw new Error("Data attribute does not exist in the data table");if(!Object.values(iA).includes(e.channel))throw new Error("Channel Not Supported")}(t,e),e.shareScale){let t=e.shareScale;if(t.channel!=e.channel&&t.channel.indexOf("Color")<0&&e.channel.indexOf("Color")<0)throw new Error("Cannot share scales between "+t.channel+" and "+e.channel+" encodings");e.scheme=e.shareScale.colorScheme}!function(t){let e;"vertex"===t.type&&t.parent.type===lT.Area?e=t.parent:t.type===lT.Area&&(e=t),e&&!e._refBounds&&Qw(e).forEach(t=>t._refBounds=t.bounds.clone())}(t);let n=e.aggregator?e.aggregator:"sum";console.log("------ encode",e.channel,e.attribute," --");let r=lA(t,e.channel);if(r&&e.attribute!==r.attribute){oA(r,this),OA(r,this._depGraph);for(let t of r.refElements)NT(t,this),NA(t,this._depGraph);r.clearRefElements()}e.table=fT(t);let i=new mM(t,e.channel,e.attribute,n,e);return this._addAttributeEncoding(i),jA(i,this._depGraph,e.shareScale),e.shareScale?this.onChange(nA.ATTR_VALUE,i):this.onChange(nA.CHANNEL,e.channel,t),i}connect(t,e){let n={};t.forEach(t=>n[t.dataScope.getAttrVal(qE)]=t);let r=e[0].dataScope.dataTable,i=r.tree?"parent":"source",o=r.tree?"child":"target";for(let e of t)e.links=[];for(let t of e){let e=t.dataScope.getAttrVal(i),r=t.dataScope.getAttrVal(o),a=n[e],s=n[r];t.source=a,t.target=s,a.links.push(t),s.links.push(t)}GA(t.find(t=>t.links.length>0),this._depGraph),this.onChange(nA.CHANNEL,"x",t[0])}_addAttributeEncoding(t){let e=cA(t.element);e in this._encodings||(this._encodings[e]={}),this._encodings[e][t.channel]=t}get tables(){let t={},e=this.children.filter(t=>t.type===lT.Collection);for(let n of e){let e=n.dataScope?n.dataScope.dataTable:null;e&&!(e.id in t)&&(t[e.id]=e)}return t}activate(t,e,n,r,i){!function(t,e,n,r,i){if(!("event"in t)||!("target"in t))throw"Target and event must be specified in the trigger";if(!("component"in n))throw"Responder component must be specified";if(Array.isArray(r)){if(!r.every(t=>"function"==typeof t))throw"Styling rules must be a function";if(i&&!Array.isArray(i))throw"An array of effect setters must be accompanied by an array of animation effects";if(i&&Array.isArray(i)&&i.length!==r.length)throw"the length of effect setters is not equal to the length of animation effects"}else if("function"!=typeof r)throw"Styling rules must be a function"}(t,0,e,r,i);let o=t.event,a=function(t){return["string"==typeof t.target?t.target:t.target.classId?t.target.classId:t.target.id,t.event].join("-")}(t);o=0===o.indexOf("brush")?"brush":0===o.indexOf("drag")?"drag":o,o in this._triggers||(this._triggers[o]={}),a in this._triggers[o]||(this._triggers[o][a]=new GM(a,t.target,t.event,t.cumulative));let s=this._triggers[o][a].eventContext,l=new vM(s,e.component,n,r);return a in this._condEncodings||(this._condEncodings[a]=[]),this._condEncodings[a].push(l),function(t,e,n,r){let i=e.responderComponent,o=r.getVariable(nA.EVT_CTX,t),a=n.properties?n.properties:n.channels;if(e.evalFunction){let t=r.getVariable(nA.CONDITION_RESULT,e.evalResult,e),n=r.findIncomingDataflowOperator(gE.TARGET_EVALUATOR,t);n||(n=r.createOneWayDependency(gE.TARGET_EVALUATOR,e.evalFunction)),r.connect(o,n),r.connect(n,t);for(let e of a){let n=Array.isArray(i)?i:[i];for(let i of n){let n=r.getVariable(nA.CHANNEL,e,i),o=n.incomingDataflow;if(o&&o instanceof AA&&o.outputVar.channel===e)r.connect(t,o);else if(!o){let o=r.createOneWayDependency(gE.ENCODER);r.connect(t,o),r.connect(o,n),o.storeValues(i,e)}}}}else for(let t of a){Object.values(iA).includes(t)?r.getVariable(nA.CHANNEL,t,i):r.getVariable(nA.PROPERTY,SA(t),i);let n=r.createOneWayDependency(gE.TARGET_UPDATER,e.stylingFunction,i);r.connect(o,n)}}(s,l,e,this._depGraph),this._triggers[o][a]}onChange(t,...e){if(Object.values(nA).indexOf(t)<0)throw new Error("Unknown Variable Type: "+t);let n=[];this._depGraph.processChange(t,n,...e);for(let t of n)t.run()}gridlines(t,e,n){let r=n||{},i=r.element?lA(r.element,t):sA(e,t,this);if(i){i.attribute!==e&&console.warn("Cannot create a "+t+" axis for "+e);let n=[];if("x"==t)for(let t of i.scales)n.push({scale:t,elems:i.getElements(t)});else if("width"==t){let t=sE(i.element),e=i.scales[0];if(t.layout&&t.layout.type==fE.GRID&&t.layout.numCols>1){let r=t.layout.getElementsByCol(!0);for(let t of r)n.push({scale:e,elems:t})}else n.push({scale:i.scales[0],elems:i.getElements(i.scales[0])})}else if("y"==t){let t=sE(i.element);if(t.layout&&t.layout.type==fE.GRID&&t.layout.numRows>1){let e=t.layout.getElementsByRow(!0,i.element);for(let t of e)n.push({scale:i.getScale(t[0]),elems:t})}else n.push({scale:i.scales[0],elems:i.getElements(i.scales[0])})}else if("height"==t){let t=sE(i.element),e=i.scales[0];if(t.layout&&t.layout.type==fE.GRID&&t.layout.numRows>1){let r=t.layout.getElementsByRow(!0,i.element);for(let t of r)n.push({scale:e,elems:t})}else n.push({scale:e,elems:i.getElements(e)})}else if("radialDistance"==t){let t=r.element?r.element:i.element;n.push({scale:i.scales[0],elems:Qw(t,t.parent)})}for(let t of n){let e=new xM(i.channel,i.attribute,t.scale,t.elems,r);this.addChild(e),i.addRefElement(e),HA(e,this._depGraph),VA(this,e,this._depGraph)}}else{let n=r.element?r.element:rE(this,e);if(!n)return void console.warn("Cannot create "+t+" gridlines for "+e);let i=iE(n.parent);if(!i.layout)return void console.warn("Cannot create "+t+" gridlines for "+e);let o=Qw(i);for(let n of o){let i=[];n.layout.type==fE.GRID&&n.layout.numRows>1&&"x"==t?i=n.layout.getElementsByRow():n.layout.type==fE.GRID&&n.layout.numCols>1&&"y"==t?i=n.layout.getElementsByCol():i.push(n.children);for(let o of i){let i=new xM(t,e,null,o,r);this.addChild(i),n.layout.addRefElement(i),HA(i,this._depGraph),VA(this,i,this._depGraph)}}}}axis(t,e,n){let r=n||{},i="rowId"==e?dT:e,o=[],a=r.element?lA(r.element,t):sA(i,t,this);if(a){a.attribute!==i&&console.warn("Cannot create a "+t+" axis for "+i);let e=[];if("x"==t||"width"==t){let t=sE(r.element?r.element:a.element);if(t.layout&&t.layout.type==fE.GRID&&t.layout.numCols>1){let n=t.layout.getElementsByCell(!0,a.element);for(let t of n)e.push({scale:a.getScale(t[0]),elems:t})}else e.push({scale:a.scales[0],elems:a.getElements(a.scales[0])})}else if("y"==t||"height"==t){let t=sE(r.element?r.element:a.element);if(t.layout&&t.layout.type==fE.GRID&&t.layout.numRows>1){let n=t.layout.getElementsByCell(!0,a.element);for(let t of n)e.push({scale:a.getScale(t[0]),elems:t})}else e.push({scale:a.scales[0],elems:a.getElements(a.scales[0])})}else if("radialDistance"==t){let t=r.element?r.element:a.element;e.push({scale:a.scales[0],elems:Qw(t,t.parent)})}for(let t of e){let e=new IT(a,t.scale,t.elems,r);this.addChild(e),o.push(e),a.addRefElement(e),YA(e,this._depGraph),VA(this,e,this._depGraph),this.onChange(nA.PROPERTY,kA.AXIS_PATH_POSITION,e)}}else{let e=r.element?r.element:rE(this,i);if(!e)return void console.warn("Cannot create a "+t+" axis for "+i);let n=iE(e.parent);if(!n.layout)return void console.warn("Cannot create a "+t+" axis for "+i);let a=Qw(n);for(let e of a){let n=[];e.layout.type==fE.GRID&&e.layout.numRows>1&&"x"==t?n=e.layout.getElementsByRow():e.layout.type==fE.GRID&&e.layout.numCols>1&&"y"==t?n=e.layout.getElementsByCol():n.push(e.children);for(let a of n){let n=new LT(a.slice(),t,i,r);this.addChild(n),o.push(n),e.layout.addRefElement(n),UA(n,this._depGraph),VA(this,n,this._depGraph),this.onChange(nA.PROPERTY,kA.AXIS_PATH_POSITION,n)}}}return o.length>1?o:o[0]}legend(t,e,n){let r=n||{},i="rowId"==e?dT:e,o=r.element?lA(r.element,t):sA(i,t,this);if(o){o.attribute!==e&&console.warn("Cannot create a "+t+" legend for "+e);let n="string"===fT(o.element).getAttributeType(e)?new NM(o,r):new IM(o,r);this.addChild(n),function(t,e){let n=e.getVariable(nA.BOUNDS,t),r=e.getVariable(nA.PROPERTY,kA.LEGEND_POSITION,t),i=e.getIncomingDataflowOperator(gE.EVAL_BBOX,n);e.connect(r,i),e.connect(i,n)}(n,this._depGraph),VA(this,n,this._depGraph),$w(n),this.onChange(nA.PROPERTY,kA.LEGEND_POSITION,n)}else console.warn("Cannot create a "+t+" legend for "+i)}createMask(t){let e=sE(t),n=e||t;n.clipMask||n.createClipMask()}setLayout(t,e){if(t.layout&&(zA(t,t.layout,this._depGraph),e.type===fE.TREEMAP)){let e=t.firstChild;for(;e&&e.type===lT.Collection&&e.layout;)zA(e,e.layout,this._depGraph),e=e.firstChild}if(Qw(t).forEach(t=>{let n=e?e.clone():e;t._layout=n,n&&(n.group=t)}),FA(t,e,this._depGraph),t.children&&t.children.length>0){let e=lE(t,!0);for(let t of e)this.onChange(nA.CHANNEL,"x",t)}}setProperties(t,e,n){let r=n?[t]:Qw(t);r.forEach(t=>{for(const[n,r]of Object.entries(e))_A(t,n,r)}),"width"in e&&r.forEach(t=>{t._refBounds&&t._refBounds.setWidth(e.width)}),"height"in e&&r.forEach(t=>{t._refBounds&&t._refBounds.setHeight(e.height)});for(let n in e)["vertex","segment"].includes(t.type)&&!["x","y"].includes(n)||(Object.values(iA).includes(n)?this.onChange(nA.CHANNEL,n,t):this.onChange(nA.PROPERTY,n,t))}setLayoutParameters(t,e){let n=Qw(t);for(let t of n)for(let n in e)t.layout[n]=e[n];this.onChange(nA.CHANNEL,"width",t.firstChild)}sortChildren(t,e,n,r){if(t instanceof qA)kM(t,e,n,r),this.onChange(nA.PROPERTY,kA.CHILDREN_ORDER,t);else if(t instanceof kE){let i=Qw(t);for(let t of i)MM(t,e,n,r)}}translate(t,e,n){pA(t,e,n);let r=lE(t,!0);for(let t of r)$w(t);for(let t of r)this.onChange(nA.CHANNEL,"x",t)}transform(t,e,n){let r=e.clone();switch(t){case"bin":!function(t,e,n,r,i){let o=i.getVariable(nA.ATTRIBUTE,t,n),a=i.getVariable(nA.ATTRIBUTE,e,r),s=i.createOneWayDependency(gE.BIN_TRANSFORMER);i.connect(o,s),i.connect(s,a),s.run()}(n.attribute,n.newAttribute,e,r,this._depGraph);break;case"filter":!function(t,e,n,r){let i=r.getVariable(nA.ITEMS,void 0,e),o=r.getVariable(nA.ITEMS,t,n),a=r.createOneWayDependency(gE.FILTER_TRANSFORMER);r.connect(i,a),r.connect(a,o),a.run()}(Bw(n),e,r,this._depGraph);break;case"kde":!function(t,e,n,r,i,o){let a=o.getVariable(nA.ATTRIBUTE,t,n),s=o.getVariable(nA.ATTRIBUTE,e,r),l=o.createOneWayDependency(gE.KDE_TRANSFORMER);l.args=i,o.connect(a,l),o.connect(l,s),l.run()}(n.attribute,n.newAttribute,e,r,n,this._depGraph)}return r}getEncodingByAttribute(t,e){return sA(t,e,this)}getEncodingByElement(t,e){return lA(t,e)}getAxis(t,e){return sA(t,e,this).refElements[0]}}function UM(t,e){let n=new BE(e[t.dt]);for(let e in t.attr2value)n._attr2value[e]=t.attr2value[e],n._updateTuples(e,t.attr2value[e]);return n}class YM extends hE{constructor(t){super(),this.type=fE.DIRECTED,this._width="width"in t?t.width:500,this._height="height"in t?t.height:300,this._top="top"in t?t.top:0,this._left="left"in t?t.left:0,this._edgeSep="edgeSep"in t?t.edgeSep:50,this._spreadLinks=!("spreadLinks"in t)||t.spreadLinks,this._direction="direction"in t?t.direction:EE.Top2Bottom}clone(){return new YM({width:this._width,height:this._height,top:this._top,left:this._left,edgeSep:this._edgeSep,spreadLinks:this._spreadLinks,direction:this._direction})}get width(){return this._width}get height(){return this._height}get top(){return this._top}get left(){return this._left}get edgeSep(){return this._edgeSep}get spreadLinks(){return this._spreadLinks}get direction(){return this._direction}}class HM extends hE{constructor(t){super(),this.type=fE.FORCE,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._iterations="iterations"in t?t.iterations:1,this._repulsion="repulsion"in t?t.repulsion:30,this._attraction="attraction"in t?t.attraction:1,this._linkDistance="linkDistance"in t?t.linkDistance:30}clone(){return new HM({x:this._x,y:this._y,iterations:this._iterations,repulsion:this._repulsion,attraction:this._attraction,linkDistance:this._linkDistance})}}class qM extends hE{constructor(t){super(),this.type=fE.PACKING,this._x="x"in t?t.x:400,this._y="y"in t?t.y:400,this._width=t.width,this._height=t.height}clone(){return new qM({x:this._x,y:this._y,width:this._width,height:this._height})}}class WM extends hE{constructor(t){super(),this.type=fE.TIDYTREE,this._width="width"in t?t.width:500,this._height="height"in t?t.height:500,this._left="left"in t?t.left:100,this._top="top"in t?t.top:100,this._orientation="orientation"in t?t.orientation:bE}get width(){return this._width}get height(){return this._height}get top(){return this._top}get left(){return this._left}get orientation(){return this._orientation}clone(){return new WM({width:this._width,height:this._height,top:this._top,left:this._left,orientation:this._orientation})}}class $M extends hE{constructor(t){super(),this.type=fE.TREEMAP,this._width=t.width,this._height=t.height,this._left=t.left,this._top=t.top}get width(){return this._width}get height(){return this._height}get top(){return this._top}get left(){return this._left}clone(){return new $M({width:this._width,height:this._height,top:this._top,left:this._left})}}function XM(t){switch(t.type){case fE.GRID:return function(t){let e=new RM(t.args);"left"in t&&(e._left=t.left);"top"in t&&(e._top=t.top);"cellBounds"in t&&(e._cellBounds=t.cellBounds.map(t=>KM(t)));"grid"in t&&(e._grid=t.grid);return e}(t);case fE.STACK:return function(t){let e=new wM(t.args);return e}(t);case fE.PACKING:return function(t){let e=new qM(t.args);return e}(t);case fE.FORCE:return function(t){return new HM(t.args)}(t);case fE.DIRECTED:return function(t){return new YM(t.args)}(t);case fE.TIDYTREE:return function(t){return new WM(t.args)}(t);case fE.TREEMAP:return function(t){return new $M(t.args)}(t);case fE.STRATA:return function(t){return new VM(t.args)}(t);default:return void console.warn("unsupported layout type for deserialization:",t.type)}}function KM(t){return new Yw(t.x-t.width/2,t.y-t.height/2,t.width,t.height)}function ZM(t,e,n){t.type===lT.Pie&&(t.type=lT.Arc),t.args.type=t.type;let r=rT(t.args);return t.id&&(r._id=t.id),t.classId&&(r._classId=t.classId),t.dataScope&&(r._dataScope=UM(t.dataScope,n)),t.bounds&&(r._bounds=KM(t.bounds)),t.refBounds&&(r._refBounds=KM(t.refBounds)),function(t,e,n,r){if(t.vertices){const i=[];for(let o of t.vertices){const t=JM(o,e,n,r);i.push(t)}e.vertices=i,e.segments=[];let o=0;for(let t=1;t<e.vertices.length;t++)e.segments.push(new CE(e.vertices[t-1],e.vertices[t],e,o++));e.type===lT.Rect&&e.segments.push(new CE(e.vertices[e.vertices.length-1],e.vertices[0],e,o++))}e.vertexCounter=t.vertexCounter,e.segmentCounter=t.segmentCounter,e.curveMode=t.curveMode}(t,r,e,n),r}function JM(t,e,n,r){let i=new SE(t.x,t.y,e,t.id);return t.dataScope&&(i._dataScope=UM(t.dataScope,r)),"polarAngle"in t&&(i._polarAngle=t.polarAngle),i.shape=t.shape,i.width=t.width,i.height=t.height,i.radius=t.radius,i.fillColor=t.fillColor,i.opacity=t.opacity,i.strokeWidth=t.strokeWidth,i.strokeColor=t.strokeColor,i}function QM(t){let e={};e.fillColor=t.fillColor;let n=new jM(e);console.log("======== deserialization =========");let r={};if(t.tables)for(let e in t.tables){let n=t.tables[e];r[e]=new hT(n.data,n.url,n.attributeTypes),r[e]._id=n.id}let i={};if(t.scales)for(let e in t.scales)i[e]=rR(t.scales[e]);if(n.scales=i,nR(t,n,n,r),eR(t,n),n.buildPeerIndex(),t.encodings){let e={};for(let i of t.encodings){let t=iR(i,n,r);e[t.id]=t}for(let t in e){n._addAttributeEncoding(e[t]);let r=e[t]._baseEnc?e[e[t]._baseEnc]:void 0;jA(e[t],n._depGraph,r),r?n.onChange(nA.ATTR_VALUE,e[t]):n.onChange(nA.CHANNEL,e[t].channel,e[t].element)}}if(t.axes)for(let e of t.axes){let t=e.args?e.args:{};t.tickValues&&Object.values(r)[0].getAttributeType(e.attr)===$E.Date&&(t.tickValues=t.tickValues.map(t=>new Date(new Date(t).toISOString()))),e.id&&(t.id=e.id),n.axis(e.channel,e.attr,t)}if(t.gridlines)for(let e of t.gridlines)n.gridlines(e.channel,e.attr,e.args);return t.bounds&&(n._bounds=KM(t.bounds)),delete n.scales,n}function tR(t,e,n,r){if(t.type===lT.Collection){let i=iT(n);t.classId&&(i._classId=t.classId),e.addChild(i),n._itemMap[i.id]=i,IA(i,n._depGraph),VA(e,i,n._depGraph),nR(t,i,n,r)}else if(t.type===lT.Glyph){let i=oT();t.classId&&(i._classId=t.classId),e.addChild(i),n._itemMap[i.id]=i,DA(i,n._depGraph),VA(e,i,n._depGraph),nR(t,i,n,r)}else if(t.type===lT.Composite){let i=new LM;e.addChild(i),n._itemMap[i.id]=i,LA(i,n._depGraph),VA(e,i,n._depGraph),nR(t,i,n,r),i._bounds=KM(t.bounds)}else if(t.type===lT.Axis){let i=new CT({});e.addChild(i),function(t,e,n,r){t.id&&(e._id=t.id);if(e._children=[],t.labels){let i=new qA;nR(t.labels,i,n,r),e._labels=i,e._children.push(i)}t.path&&(e._path=tR(t.path,e,n,r));if(t.ticks){let i=new qA;nR(t.ticks,i,n,r),e._ticks=i,e._children.push(i)}t.title&&(e._title=tR(t.title,e,n,r))}(t,i,n,r),n._itemMap[i.id]=i}else if(Object.values(Jw).includes(t.type)){let i=ZM(t,n,r);return n._itemMap[i.id]=i,e.addChild(i),MA(i,n._depGraph),VA(e,i,n._depGraph),i}}function eR(t,e,n){if(t.children)for(let n of t.children)eR(n,e);else if(Object.values(Jw).includes(t.type)){let n=e._itemMap[t.id];t.links&&(n.links=t.links.map(t=>e._itemMap[t])),t.source&&(n.source=e._itemMap[t.source]),t.target&&(n.target=e._itemMap[t.target])}}function nR(t,e,n,r){if(t.id&&(e._id=t.id),t.classId&&(e._classId=t.classId),t.dataScope&&(e._dataScope=UM(t.dataScope,r)),t.bounds&&(e._bounds=KM(t.bounds)),e._sortBy=t.sortBy,t.children)for(let i of t.children)tR(i,e,n,r);t.layout&&(e._layout=XM(t.layout),e._layout.group=e,FA(e,e._layout,n._depGraph))}function rR(t){let e=new vT(t.type,t.args);return e._id=t.id,e.domain=t.domain,e.range=t.range,e}function iR(t,e,n){let r=oR(t.element,t.elementType,e);r||console.warn("element not created:",t.element,t.elementType);let i=t.args?t.args:{};t.table&&(i.table=n[t.table]);let o=new mM(r,t.channel,t.attr,t.aggregator?t.aggregator:"sum",i);if(o._id=t.id,t.scales&&(o._scales=t.scales.map(t=>e.scales[t])),i.baseEnc&&(o._baseEnc=t.args.baseEnc),t.elemGroups&&(o._elemGroups=t.elemGroups.map(t=>t.map(t=>oR(t,r.type,e)))),t.elem2scale){o._elem2scale={};for(let n in t.elem2scale)o._elem2scale[n]=e.scales[t.elem2scale[n]]}return i.startAngle&&(o.startAngle=i.startAngle),o}function oR(t,e,n){if("vertex"===e){let e=t.split("_v_");return n._itemMap[e[0]].vertices.find(t=>t._id===parseInt(e[1]))}if("segment"===e){let e=t.split("_s_");return n._itemMap[e[0]].segments.find(t=>t._id===parseInt(e[1]))}return n._itemMap[t]}function aR(t){let e={};return e.id=t._id,e.data=t._rawData,e.attributeTypes=t._attrTypes,e.url=t.url,e}function sR(t){let e={};return e.dt=t._dt.id,e.attr2value=Object.assign({},t._attr2value),e}function lR(t,e){e.vertices=[];for(let n of t.vertices)e.vertices.push(cR(n));e.vertexCounter=t.vertexCounter,e.segmentCounter=t.segmentCounter,e.curveMode=t.curveMode}function cR(t){let e={};return e.type=t.type,e.id=t._id,e.x=t.x,e.y=t.y,t._dataScope&&(e.dataScope=sR(t._dataScope)),void 0!==t._polarAngle&&(e.polarAngle=t._polarAngle),e.shape=t.shape,e.width=t.width,e.height=t.height,e.radius=t.radius,e.fillColor=t.fillColor,e.opacity=t.opacity,e.strokeWidth=t.strokeWidth,e.strokeColor=t.strokeColor,e}function uR(t){return t.type===lT.Scene?function(t){let e=dR(t,{});e.fillColor=t.fillColor,e.scales={},e.encodings=[];for(let n in t._encodings)for(let r in t._encodings[n]){let i=t._encodings[n][r];i._forLegend||e.encodings.push(fR(i));for(let t of i._scales)t.id in e.scales||(e.scales[t.id]=hR(t))}e.tables={};let n=function(t){let e={};for(let n in t._encodings)for(let r in t._encodings[n]){let i=t._encodings[n][r];i.dataTable.id in e||i._forLegend||(e[i.dataTable.id]=i.dataTable)}for(let n of t.children)if(![lT.Axis,lT.Legend,lT.Gridlines].includes(n.type)){if(n.dataScope){e[n.dataScope.dataTable.id]=n.dataScope.dataTable;break}if(n.children&&n.children.length>0){let t=n.firstChild;for(;t;){if(t.dataScope){e[t.dataScope.dataTable.id]=t.dataScope.dataTable;break}t=t.children&&t.children.length>0?t.firstChild:void 0}}}return e}(t);for(let t in n)e.tables[t]=aR(n[t]);return console.log("======== serialization ========="),console.log(e),e}(t):[lT.Collection,lT.Glyph,lT.Composite].includes(t.type)?dR(t,{}):t instanceof Kw?function(t){let e={args:{}};e.type=t.type,e.id=t.id,t.classId&&(e.classId=t.classId),t._dataScope&&(e.dataScope=sR(t._dataScope)),t.bounds&&(e.bounds=t.bounds.toJSON()),t.refBounds&&(e.refBounds=t.refBounds.toJSON()),t.links&&(e.links=t.links.map(t=>t.id)),t.source&&(e.source=t.source.id),t.target&&(e.target=t.target.id);for(let n in t.styles)n.indexOf("Color")>0&&t.styles[n]instanceof _E?e.args[n]=t.styles[n].toJSON():e.args[n]=t.styles[n];switch(t.type){case lT.Arc:case lT.Pie:!function(t,e){e.args.x=t._x,e.args.y=t._y,e.args.innerRadius=t._innerRadius,e.args.outerRadius=t._outerRadius,e.args.startAngle=t._startAngle,e.args.endAngle=t._endAngle,e.args.direction=t._direction,e.args.thickness=t._thickness}(t,e),lR(t,e);break;case lT.Area:!function(t,e){e.args.baseline=t._baseline,e.args.orientation=t._orientation}(t,e),lR(t,e);break;case lT.Circle:!function(t,e){e.args.x=t.x,e.args.y=t.y,e.args.radius=t.radius}(t,e);break;case lT.Image:break;case lT.Line:case lT.Path:case lT.BezierCurve:lR(t,e);break;case lT.SimpleText:!function(t,e){e.args.x=t._x,e.args.y=t._y,e.args.text=t._text,e.args.anchor=t._anchor,t._backgroundColor&&(e.args.backgroundColor=t._backgroundColor),t._borderWidth&&(e.args.borderWidth=t._borderWidth),t._borderColor&&(e.args.borderColor=t._borderColor)}(t,e);break;case lT.Polygon:!function(t,e){e.args.x=t._x,e.args.y=t._y,e.args.radius=t._radius}(t,e),lR(t,e);break;case lT.Rect:!function(t,e){e.args.width=t.width,e.args.height=t.height,e.args.top=t.top,e.args.left=t.left}(t,e),lR(t,e);case lT.Ring:}return e}(t):(console.warn("unsupported serialization",t.type),{type:t.type})}function hR(t){let e={};return e.type=t.type,e.id=t.id,t._args&&(e.args=t._args),e.domain=t.domain,e.range=t.range,e}function fR(t){let e={};e.id=t._id,e.element=t._elem.id,e.elementType=t._elem.type,e.channel=t._channel,e.attr=t._attribute,e.aggregator=t._aggregator,e.table=t._table.id,e.args={},e.args.includeZero=t._includeZero,e.args.flipScale=t._flipScale,e.args.mapping=t._mapping,e.args.rangeExtent=t._preferredRangeExtent,e.args.domain=t._preferredDomain,e.args.scaleType=t._scaleType,e.args.scheme=t._colorScheme,t._baseEnc&&(e.args.baseEnc=t._baseEnc.id),e.scales=t._scales.map(t=>t.id),e.elemGroups=t._elemGroups.map(t=>t.map(t=>t.id)),e.elem2scale={};for(let n in t._elem2scale)e.elem2scale[n]=t._elem2scale[n].id;return"angle"==t.channel&&(e.args.startAngle=t.startAngle),e}function dR(t,e){if(e.id=t.id,e.type=t.type,t.classId&&(e.classId=t.classId),t._dataScope&&(e.dataScope=sR(t._dataScope)),e.bounds=t.bounds.toJSON(),t._layout&&(e.layout=function(t){switch(t.type){case fE.GRID:return function(t){let e={args:{}};return e.type=t.type,e.args.numCols=t._numCols,e.args.numRows=t._numRows,e.args.start=t._start,e.args.direction=t._direction,e.args.colGap=t._colGap,e.args.rowGap=t._rowGap,e.args.horzCellAlignment=t._cellHorzAlignment,e.args.vertCellAlignment=t._cellVertAlignment,e.left=t._left,e.top=t._top,e.group=t.group.id,e}(t);case fE.STACK:return function(t){let e={args:{}};return e.type=t.type,e.args.orientation=t._orientation,e.args.direction=t._direction,e.args.left=t._left,e.args.top=t._top,e.args.horzCellAlignment=t._horzCellAlignment,e.args.vertCellAlignment=t._vertCellAlignment,e.args.gap=t._gap,e.group=t.group.id,e}(t);case fE.PACKING:return function(t){let e={args:{}};return e.type=t.type,e.args.x=t._x,e.args.y=t._y,e.args.width=t._width,e.args.height=t._height,e.group=t.group.id,e}(t);case fE.FORCE:return function(t){let e={args:{}};return e.type=t.type,e.args.x=t._x,e.args.y=t._y,e.args.iterations=t._iterations,e.args.repulsion=t._repulsion,e.args.attraction=t._attraction,e.args.linkDistance=t._linkDistance,e.group=t.group.id,e}(t);case fE.CLUSTER:return function(t){let e={args:{}};return e.type=t.type,e.args.size=t._size,e.args.rootX=t._rootX,e.args.rootY=t._rootY,e}(t);case fE.DIRECTED:return function(t){let e={args:{}};return e.type=t.type,e.args.left=t._left,e.args.top=t._top,e.args.width=t._width,e.args.height=t._height,e.args.edgeSep=t._edgeSep,e.args.spreadLinks=t._spreadLinks,e.args.direction=t._direction,e}(t);case fE.TIDYTREE:return function(t){let e={args:{}};return e.type=t.type,e.args.left=t._left,e.args.top=t._top,e.args.width=t._width,e.args.height=t._height,e.args.orientation=t._orientation,e}(t);case fE.TREEMAP:return function(t){let e={args:{}};return e.type=t.type,e.args.left=t._left,e.args.top=t._top,e.args.width=t._width,e.args.height=t._height,e}(t);case fE.STRATA:return function(t){let e={args:{}};return e.type=t.type,e.args.direction=t._direction,e.args.gap=t._gap,e}(t);default:throw new Error("unknow layout type "+t.type)}}(t._layout)),e.children=[],t.children.length>0)for(let n of t.children)n instanceof CT?pR(n,e):n instanceof xM?gR(n,e):e.children.push(uR(n));return e.sortBy=t._sortBy,e}function pR(t,e){e.axes??=[];let n={};n.type=t._type,n.id=t._id,n.attr=t._attribute,n.channel=t._channel,n.args={},n.args.orientation=t._orientation,n.args.strokeColor=t._strokeColor,n.args.textColor=t._textColor,n.args.fontSize=t._fontSize,n.args.tickOffset=t._tickOffset,n.args.tickSize=t._tickSize,n.args.tickAnchor=t._tickAnchor,n.args.tickVisible=t._tickVisible,n.args.pathVisible=t._pathVisible,n.args.labelOffset=t._labelOffset,n.args.labelFormat=t._labelFormat,n.args.titleOffset=t._titleOffset,n.args.title=t._titleText,n.args.rotateTitle=t._rotateTitle,n.args.titleVisible=t._showTitle,n.args.labelRotation=t._labelRotation,e.axes.push(n)}function gR(t,e){e.gridlines??=[];let n={};n.type=t._type,n.id=t._id,n.attr=t._attribute,n.channel=t._channel,n.args=t._args,e.gridlines.push(n)}function _R(t,e){return void 0===t&&void 0===e||void 0!==t&&void 0!==e}function yR(t,e){const n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&(0===n.length||n.every(t=>r.includes(t)))}function mR(t,e){if(!_R(t.layout,e.layout))return console.log("Not both defined or undefined:",t.bounds,e.bounds),!1;let n=t.layout,r=e.layout;if(!n&&!r)return!0;if(n.type!==r.type)return console.log("layout types are different:",n,r),!1;switch(n.type){case fE.GRID:return function(t,e){t._cellBounds.length!==e._cellBounds.length&&console.log("cell bounds length different:",t,e);for(let n=0;n<t._cellBounds;n++)if(!vR(t._cellBounds[n],e._cellBounds[n]))return console.log("cell bounds not equal:",t,e),!1;for(let n=0;n<t._grid.length;n++)for(let r=0;r<t._grid[n].length;r++)if(t._grid[n][r]!==e._grid[n][r])return console.log("grid not equal",t,e),!1;return t._numCols===e._numCols&&t._numRows===e._numRows&&t._start===e._start&&t._direction===e._direction&&t._rowGap===e._rowGap&&t._colGap===e._colGap&&t._cellHorzAlignment===e._cellHorzAlignment&&t._cellVertAlignment===e._cellVertAlignment&&t._left===e._left&&t._top===e._top}(n,r);case fE.STACK:return function(t,e){return t._orientation===e._orientation&&t._direction===e._direction&&t._left===e._left&&t._top===e._top&&t._horzCellAlignment===e._horzCellAlignment&&t._vertCellAlignment===e._vertCellAlignment&&t._gap===e._gap}(n,r);case fE.PACKING:return function(t,e){return t._x===e._x&&t._y===e._y&&t._width===e._width&&t._height===e._height}(n,r);case fE.FORCE:return function(t,e){return t._x===e._x&&t._y===e._y&&t._iterations===e._iterations&&t._repulsion===e._repulsion&&t._attraction===e._attraction&&t._linkDistance===e._linkDistance}(n,r);case fE.DIRECTED:return function(t,e){return t._width===e._width&&t._height===e._height&&t._top===e._top&&t._left===e._left&&t._edgeSep===e._edgeSep&&t._spreadLinks===e._spreadLinks&&t._direction===e._direction}(n,r);case fE.TIDYTREE:return function(t,e){return t._width===e._width&&t._height===e._height&&t._top===e._top&&t._left===e._left&&t._orientation===e._orientation}(n,r);case fE.STRATA:return function(t,e){return t._direction===e._direction&&t._gap===e._gap}(n,r);case fE.TREEMAP:return function(t,e){return t._width===e._width&&t._height===e._height&&t._top===e._top&&t._left===e._left}(n,r);default:return!1}}function bR(t,e){if(!_R(t.bounds,e.bounds))return console.log("Not both defined or undefined:",t.bounds,e.bounds),!1;let n=t.bounds,r=e.bounds;return!n&&!r||vR(n,r)}function vR(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function xR(t,e){if(!_R(t,e))return console.log("Not both defined or undefined:",t,e),!1;if(t.type!==e.type)return console.log("Different mark types:",t,e),!1;if(t.id!==e.id)return console.log("id not equal:",t,e),!1;if(t.classId!==e.classId)return console.log("class id not equal:",t,e),!1;if(!ER(t,e))return console.log("DataScopes not equal",t,e),!1;if(!bR(t,e))return console.log("Bounds not equal",t,e),!1;if(!_R(t.links,e.links))return console.log("Not both defined or undefined: links ",t.links,e.links),!1;if(!_R(t.source,e.source))return console.log("Not both defined or undefined: source ",t.source,e.source),!1;if(!_R(t.target,e.target))return console.log("Not both defined or undefined: links ",t.target,e.target),!1;if(t.links&&e.links&&t.links.length!==e.links.length)return console.log("unequal number of links",t,e),!1;if(t.source&&e.source&&!xR(t.source,e.source))return console.log("different sources",t.source,e.source),!1;if(t.target&&e.target&&!xR(t.target,e.target))return console.log("different targets",t.target,e.target),!1;switch(t.type){case lT.Arc:case lT.Pie:return wR(t,e)?t.x===e.x&&t.y===e.y&&t.innerRadius===e.innerRadius&&t.outerRadius===e.outerRadius&&t.startAngle===e.startAngle&&t.endAngle===e.endAngle&&t.direction===e.direction&&t.thickness===e.thickness:(console.log("vertices not equal:",t,e),!1);case lT.Area:return wR(t,e)?t.baseline===e.baseline&&t.orientation===e.orientation:(console.log("vertices not equal:",t,e),!1);case lT.Circle:return t.x===e.x&&t.y===e.y&&t.radius===e.radius;case lT.Image:return console.warn("not implemented"),!0;case lT.Line:case lT.Path:case lT.BezierCurve:return!!wR(t,e)||(console.log("vertices not equal:",t,e),!1);case lT.SimpleText:return t.x===e.x&&t.y===e.y&&t.text===e.text&&t.anchor[0]===e.anchor[0]&&t.anchor[1]===e.anchor[1];case lT.Polygon:return wR(t,e)?t.x===e.x&&t.y===e.y&&t.radius===e.radius:(console.log("vertices not equal:",t,e),!1);case lT.Rect:return wR(t,e)?t.width===e.width&&t.height===e.height&&t.top===e.top&&t.left===e.left:(console.log("vertices not equal:",t,e),!1);case lT.Ring:default:return console.warn("not implemented"),!0}}function wR(t,e){if(t.vertices.length!==e.vertices.length)return console.log("unequal number of vertices:",t,e),!1;for(let n=0;n<t.vertices.length;n++){let r=t.vertices[n],i=e.vertices[n];return r.id!==i.id?(console.log("vertex id not equal:",r,i),!1):r.x!==i.x||r.y!==i.y?(console.log("vertex position not equal:",r,i),!1):ER(r,i)?r._polarAngle===i._polarAngle&&r.shape===i.shape&&r.width===i.width&&r.height==i.height&&r.radius==i.radius&&r.fillColor==i.fillColor&&r.opacity==i.opacity&&r.strokeWidth==i.strokeWidth&&r.strokeColor==i.strokeColor:(console.log("vertex data scopes not equal:",r.dataScope,i.dataScope),!1)}}function ER(t,e){if(!_R(t.dataScope,e.dataScope))return console.log("Not both defined or undefined:",t.dataScope,e.dataScope),!1;if(!t.dataScope&&!e.dataScope)return!0;let n=t.dataScope,r=e.dataScope;if(!yR(n._attr2value,r._attr2value))return!1;for(let t in n._attr2value)if(n._attr2value[t]!==r._attr2value[t])return!1;return n._dt.id===r._dt.id&&n._tuples.length===r._tuples.length}function AR(t,e){return t.type!==e.type&&console.log("Different types:",t.type,e.type),[lT.Collection,lT.Glyph,lT.Composite].includes(t.type)?TR(t,e):t instanceof Kw?xR(t,e):void 0}function TR(t,e){let n=t.children.filter(t=>!Object.values(cT).includes(t.type)),r=e.children.filter(t=>!Object.values(cT).includes(t.type));if(n.length!==r.length)return console.log("children length not equal:",n,r),!1;if(t.id!==e.id)return console.log("id not equal:",t,e),!1;if(t.classId!==e.classId)return console.log("class id not equal:",t,e),!1;if(!ER(t,e))return console.log("DataScopes not equal",t.dataScope,e.dataScope),!1;if(!bR(t,e))return console.log("Bounds not equal",t,e),!1;if(!mR(t,e))return console.log("Layouts not equal",t,e),!1;if(!function(t,e){if(!yR(t,e))return console.log("different keys",t,e),!1;for(let n in t)if(t[n]!==e[n])return!1;return!0}(t._sortBy,e._sortBy))return console.log("SortBy not equal",t,e),!1;for(let t=0;t<n.length;t++)if(!AR(n[t],r[t]))return console.log("Not equal",n[t],r[t]),!1;return!0}class SR extends hE{constructor(t){super(),this.type=fE.CIRCULAR,this._x="x"in t?t.x:100,this._y="y"in t?t.y:100,this._radius="radius"in t?t.radius:100}get x(){return this._x}get y(){return this._y}get radius(){return this._radius}clone(){return new SR({x:this._x,y:this._y,radius:this._radius})}}class CR extends hE{constructor(t){super(),this.type=fE.CLUSTER,this._isRadial="radial"in t&&t.radial,this._angleExtent="angleExtent"in t?t.angleExtent:360,this._radius="radius"in t?t.radius:300,this._rootX="x"in t?t.x:300,this._rootY="y"in t?t.y:300,this._orientation="orientation"in t?t.orientation:bE,this._width="width"in t?t.width:800,this._height="height"in t?t.height:600,this._left="left"in t?t.left:60,this._top="top"in t?t.top:100,this._tree="tree"in t?t.tree:void 0}get radius(){return this._radius}get angleExtent(){return this._angleExtent}get x(){return this._rootX}get y(){return this._rootY}get width(){return this._width}get height(){return this._height}get left(){return this._left}get top(){return this._top}isRadial(){return this._isRadial}get orientation(){return this._orientation}clone(){return new CR({radius:this._radius,angleExtent:this._angleExtent,x:this._rootX,y:this._rootY,radial:this._isRadial,orientation:this._orientation,left:this._left,top:this._top,width:this._width,height:this._height,tree:this._tree})}}exports.canClassify=function(t){return t.type===lT.Collection&&!(t.children.length<2)},exports.canDensify=tA,exports.canDivide=AM,exports.canRepeat=_M,exports.csv=async function(t){return async function(t){let e=await pT("GET",t),n=Vs(e.trim(),Zs);return new hT(n,t)}(t)},exports.csvString=function(t){return function(t){let e=Vs(t.trim(),Zs);return new hT(e,"fromString")}(t)},exports.deserialize=function(t){return QM(t)},exports.findElements=nE,exports.getLeafMarks=lE,exports.getPeers=Qw,exports.graphJSON=async function(t){return async function(t){let e=await pT("GET",t);return new UE(JSON.parse(e),t)}(t)},exports.isEqual=function(t,e){return function(t,e){return t.fillColor!==e.fillColor?(console.log("fillColor not equal:",t,e),!1):TR(t,e)}(t,e)},exports.isMark=Zw,exports.isRefElement=function(t){return t.type===lT.Axis||t.type===lT.Legend||t.type===lT.Gridlines},exports.layout=function(t,e){let n=e||{};switch(t.toLowerCase()){case fE.STACK:return new wM(n);case fE.PACKING:return new qM(n);case fE.FORCE:return new HM(n);case fE.DIRECTED:return new YM(n);case fE.TIDYTREE:return new WM(n);case fE.TREEMAP:return new $M(n);case fE.CIRCULAR:return new SR(n);case fE.CLUSTER:return new CR(n);case fE.GRID:default:return new RM(n)}},exports.scene=function(t){return new jM(t)},exports.serialize=function(t){return uR(t)},exports.table=function(t){return new hT(t,"")},exports.treeJSON=async function(t){return async function(t){let e=await pT("GET",t);return new GE(JSON.parse(e),t)}(t)};