d3
Version:
2 lines • 264 kB
JavaScript
// https://d3js.org v6.0.0-rc.4 Copyright 2020 Mike Bostock
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).d3=t.d3||{})}(this,function(t){"use strict";function n(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function e(t){var e;return 1===t.length&&(e=t,t=function(t,r){return n(e(t),r)}),{left:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var o=r+i>>>1;t(n[o],e)<0?r=o+1:i=o}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var o=r+i>>>1;t(n[o],e)>0?i=o:r=o+1}return r}}}var r=e(n),i=r.right,o=r.left;function a(t,n){let e=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&++e;else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(i=+i)>=i&&++e}return e}function u(t){return 0|t.length}function c(t){return!(t>0)}function f(t){return"object"!=typeof t||"length"in t?t:Array.from(t)}function s(t,n){let e,r=0,i=0,o=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(o+=(e=n-i)*(n-(i+=e/++r)));else{let a=-1;for(let u of t)null!=(u=n(u,++a,t))&&(u=+u)>=u&&(o+=(e=u-i)*(u-(i+=e/++r)))}if(r>1)return o/(r-1)}function l(t,n){const e=s(t,n);return e?Math.sqrt(e):e}function h(t,n){let e,r;if(void 0===n)for(const n of t)null!=n&&(void 0===e?n>=n&&(e=r=n):(e>n&&(e=n),r<n&&(r=n)));else{let i=-1;for(let o of t)null!=(o=n(o,++i,t))&&(void 0===e?o>=o&&(e=r=o):(e>o&&(e=o),r<o&&(r=o)))}return[e,r]}class d{constructor(){this._partials=new Float64Array(32).fill(0),this._n=0}add(t){const n=this._partials;let e=0;for(let r=0;r<this._n&&r<32;r++){const i=n[r],o=t+i,a=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);a&&(n[e++]=a),t=o}return n[e]=t,this._n=e+1,this}valueOf(){const t=this._partials;let n,e,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(n=o,!(r=(e=t[--i])-((o=n+e)-n))););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(e=2*r)==(n=o+e)-o&&(o=n)}return o}}function p(t){return t}function g(t,n,e,r){return function t(i,o){if(o>=r.length)return e(i);const a=new Map,u=r[o++];let c=-1;for(const t of i){const n=u(t,++c,i),e=a.get(n);e?e.push(t):a.set(n,[t])}for(const[n,e]of a)a.set(n,t(e,o));return n(a)}(t,0)}var y=Array.prototype.slice;function v(t){return function(){return t}}function _(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),o=new Array(i);++r<i;)o[r]=t+r*e;return o}var b=Math.sqrt(50),m=Math.sqrt(10),x=Math.sqrt(2);function w(t,n,e){var r,i,o,a,u=-1;if(e=+e,(t=+t)===(n=+n)&&e>0)return[t];if((r=n<t)&&(i=t,t=n,n=i),0===(a=M(t,n,e))||!isFinite(a))return[];if(a>0)for(t=Math.ceil(t/a),n=Math.floor(n/a),o=new Array(i=Math.ceil(n-t+1));++u<i;)o[u]=(t+u)*a;else for(a=-a,t=Math.floor(t*a),n=Math.ceil(n*a),o=new Array(i=Math.ceil(n-t+1));++u<i;)o[u]=(t+u)/a;return r&&o.reverse(),o}function M(t,n,e){var r=(n-t)/Math.max(0,e),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=b?10:o>=m?5:o>=x?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=b?10:o>=m?5:o>=x?2:1)}function A(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=b?i*=10:o>=m?i*=5:o>=x&&(i*=2),n<t?-i:i}function T(t){return Math.ceil(Math.log(a(t))/Math.LN2)+1}function S(){var t=p,n=h,e=T;function r(r){Array.isArray(r)||(r=Array.from(r));var o,a,u=r.length,c=new Array(u);for(o=0;o<u;++o)c[o]=t(r[o],o,r);var f=n(c),s=f[0],l=f[1],h=e(c,s,l);Array.isArray(h)||(h=A(s,l,h),h=_(Math.ceil(s/h)*h,l,h));for(var d=h.length;h[0]<=s;)h.shift(),--d;for(;h[d-1]>l;)h.pop(),--d;var p,g=new Array(d+1);for(o=0;o<=d;++o)(p=g[o]=[]).x0=o>0?h[o-1]:s,p.x1=o<d?h[o]:l;for(o=0;o<u;++o)s<=(a=c[o])&&a<=l&&g[i(h,a,0,d)].push(r[o]);return g}return r.value=function(n){return arguments.length?(t="function"==typeof n?n:v(n),r):t},r.domain=function(t){return arguments.length?(n="function"==typeof t?t:v([t[0],t[1]]),r):n},r.thresholds=function(t){return arguments.length?(e="function"==typeof t?t:Array.isArray(t)?v(y.call(t)):v(t),r):e},r}function E(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e<n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e<i||void 0===e&&i>=i)&&(e=i)}return e}function k(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e>n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e>i||void 0===e&&i>=i)&&(e=i)}return e}function N(t,e,r=0,i=t.length-1,o=n){for(;i>r;){if(i-r>600){const n=i-r+1,a=e-r+1,u=Math.log(n),c=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*c*(n-c)/n)*(a-n/2<0?-1:1);N(t,e,Math.max(r,Math.floor(e-a*c/n+f)),Math.min(i,Math.floor(e+(n-a)*c/n+f)),o)}const n=t[e];let a=r,u=i;for(C(t,r,e),o(t[i],n)>0&&C(t,r,i);a<u;){for(C(t,a,u),++a,--u;o(t[a],n)<0;)++a;for(;o(t[u],n)>0;)--u}0===o(t[r],n)?C(t,r,u):C(t,++u,i),u<=e&&(r=u+1),e<=u&&(i=u-1)}return t}function C(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function P(t,n,e){if(r=(t=Float64Array.from(function*(t,n){if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(yield n);else{let e=-1;for(let r of t)null!=(r=n(r,++e,t))&&(r=+r)>=r&&(yield r)}}(t,e))).length){if((n=+n)<=0||r<2)return k(t);if(n>=1)return E(t);var r,i=(r-1)*n,o=Math.floor(i),a=E(N(t,o).subarray(0,o+1));return a+(k(t.subarray(o+1))-a)*(i-o)}}function z(t,n){let e,r=-1,i=-1;if(void 0===n)for(const n of t)++i,null!=n&&(e<n||void 0===e&&n>=n)&&(e=n,r=i);else for(let o of t)null!=(o=n(o,++i,t))&&(e<o||void 0===e&&o>=o)&&(e=o,r=i);return r}function D(t){return Array.from(function*(t){for(const n of t)yield*n}(t))}function q(t,n){let e,r=-1,i=-1;if(void 0===n)for(const n of t)++i,null!=n&&(e>n||void 0===e&&n>=n)&&(e=n,r=i);else for(let o of t)null!=(o=n(o,++i,t))&&(e>o||void 0===e&&o>=o)&&(e=o,r=i);return r}function R(t,e=n){if(1===e.length)return q(t,e);let r,i=-1,o=-1;for(const n of t)++o,(i<0?0===e(n,n):e(n,r)<0)&&(r=n,i=o);return i}function F(t){if(!(i=t.length))return[];for(var n=-1,e=k(t,U),r=new Array(e);++n<e;)for(var i,o=-1,a=r[n]=new Array(i);++o<i;)a[o]=t[o][n];return r}function U(t){return t.length}var O=Array.prototype.slice;function I(t){return t}var B=1,Y=2,L=3,j=4,H=1e-6;function X(t){return"translate("+(t+.5)+",0)"}function G(t){return"translate(0,"+(t+.5)+")"}function V(){return!this.__axis}function $(t,n){var e=[],r=null,i=null,o=6,a=6,u=3,c=t===B||t===j?-1:1,f=t===j||t===Y?"x":"y",s=t===B||t===L?X:G;function l(l){var h=null==r?n.ticks?n.ticks.apply(n,e):n.domain():r,d=null==i?n.tickFormat?n.tickFormat.apply(n,e):I:i,p=Math.max(o,0)+u,g=n.range(),y=+g[0]+.5,v=+g[g.length-1]+.5,_=(n.bandwidth?function(t){var n=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(n=Math.round(n)),function(e){return+t(e)+n}}:function(t){return n=>+t(n)})(n.copy()),b=l.selection?l.selection():l,m=b.selectAll(".domain").data([null]),x=b.selectAll(".tick").data(h,n).order(),w=x.exit(),M=x.enter().append("g").attr("class","tick"),A=x.select("line"),T=x.select("text");m=m.merge(m.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),x=x.merge(M),A=A.merge(M.append("line").attr("stroke","currentColor").attr(f+"2",c*o)),T=T.merge(M.append("text").attr("fill","currentColor").attr(f,c*p).attr("dy",t===B?"0em":t===L?"0.71em":"0.32em")),l!==b&&(m=m.transition(l),x=x.transition(l),A=A.transition(l),T=T.transition(l),w=w.transition(l).attr("opacity",H).attr("transform",function(t){return isFinite(t=_(t))?s(t):this.getAttribute("transform")}),M.attr("opacity",H).attr("transform",function(t){var n=this.parentNode.__axis;return s(n&&isFinite(n=n(t))?n:_(t))})),w.remove(),m.attr("d",t===j||t==Y?a?"M"+c*a+","+y+"H0.5V"+v+"H"+c*a:"M0.5,"+y+"V"+v:a?"M"+y+","+c*a+"V0.5H"+v+"V"+c*a:"M"+y+",0.5H"+v),x.attr("opacity",1).attr("transform",function(t){return s(_(t))}),A.attr(f+"2",c*o),T.attr(f,c*p).text(d),b.filter(V).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===Y?"start":t===j?"end":"middle"),b.each(function(){this.__axis=_})}return l.scale=function(t){return arguments.length?(n=t,l):n},l.ticks=function(){return e=O.call(arguments),l},l.tickArguments=function(t){return arguments.length?(e=null==t?[]:O.call(t),l):e.slice()},l.tickValues=function(t){return arguments.length?(r=null==t?null:O.call(t),l):r&&r.slice()},l.tickFormat=function(t){return arguments.length?(i=t,l):i},l.tickSize=function(t){return arguments.length?(o=a=+t,l):o},l.tickSizeInner=function(t){return arguments.length?(o=+t,l):o},l.tickSizeOuter=function(t){return arguments.length?(a=+t,l):a},l.tickPadding=function(t){return arguments.length?(u=+t,l):u},l}var W={value:()=>{}};function Z(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new K(r)}function K(t){this._=t}function Q(t,n){return t.trim().split(/^|\s+/).map(function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})}function J(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function tt(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=W,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}K.prototype=Z.prototype={constructor:K,on:function(t,n){var e,r=this._,i=Q(t+"",r),o=-1,a=i.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++o<a;)if(e=(t=i[o]).type)r[e]=tt(r[e],t.name,n);else if(null==n)for(e in r)r[e]=tt(r[e],t.name,null);return this}for(;++o<a;)if((e=(t=i[o]).type)&&(e=J(r[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new K(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){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(n,e)}};var nt="http://www.w3.org/1999/xhtml",et={svg:"http://www.w3.org/2000/svg",xhtml:nt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function rt(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),et.hasOwnProperty(n)?{space:et[n],local:t}:t}function it(t){var n=rt(t);return(n.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===nt&&n.documentElement.namespaceURI===nt?n.createElement(t):n.createElementNS(e,t)}})(n)}function ot(){}function at(t){return null==t?ot:function(){return this.querySelector(t)}}function ut(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function ct(){return[]}function ft(t){return null==t?ct:function(){return this.querySelectorAll(t)}}function st(t){return function(){return this.matches(t)}}function lt(t){return function(n){return n.matches(t)}}var ht=Array.prototype.find;function dt(){return this.firstElementChild}var pt=Array.prototype.filter;function gt(){return this.children}function yt(t){return new Array(t.length)}function vt(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function _t(t,n,e,r,i,o){for(var a,u=0,c=n.length,f=o.length;u<f;++u)(a=n[u])?(a.__data__=o[u],r[u]=a):e[u]=new vt(t,o[u]);for(;u<c;++u)(a=n[u])&&(i[u]=a)}function bt(t,n,e,r,i,o,a){var u,c,f,s=new Map,l=n.length,h=o.length,d=new Array(l);for(u=0;u<l;++u)(c=n[u])&&(d[u]=f=a.call(c,c.__data__,u,n)+"",s.has(f)?i[u]=c:s.set(f,c));for(u=0;u<h;++u)f=a.call(t,o[u],u,o)+"",(c=s.get(f))?(r[u]=c,c.__data__=o[u],s.delete(f)):e[u]=new vt(t,o[u]);for(u=0;u<l;++u)(c=n[u])&&s.get(d[u])===c&&(i[u]=c)}function mt(t){return t.__data__}function xt(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function wt(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Mt(t,n){return t.style.getPropertyValue(n)||wt(t).getComputedStyle(t,null).getPropertyValue(n)}function At(t){return t.trim().split(/^|\s+/)}function Tt(t){return t.classList||new St(t)}function St(t){this._node=t,this._names=At(t.getAttribute("class")||"")}function Et(t,n){for(var e=Tt(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function kt(t,n){for(var e=Tt(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function Nt(){this.textContent=""}function Ct(){this.innerHTML=""}function Pt(){this.nextSibling&&this.parentNode.appendChild(this)}function zt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Dt(){return null}function qt(){var t=this.parentNode;t&&t.removeChild(this)}function Rt(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function Ft(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function Ut(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.options);++i?n.length=i:delete this.__on}}}function Ot(t,n,e){return function(){var r,i=this.__on,o=function(t){return function(n){t.call(this,n,this.__data__)}}(n);if(i)for(var a=0,u=i.length;a<u;++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=e),void(r.value=n);this.addEventListener(t.type,o,e),r={type:t.type,name:t.name,value:n,listener:o,options:e},i?i.push(r):this.__on=[r]}}function It(t,n,e){var r=wt(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}vt.prototype={constructor:vt,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},St.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Bt=[null];function Yt(t,n){this._groups=t,this._parents=n}function Lt(){return new Yt([[document.documentElement]],Bt)}function jt(t){return"string"==typeof t?new Yt([[document.querySelector(t)]],[document.documentElement]):new Yt([[t]],Bt)}Yt.prototype=Lt.prototype={constructor:Yt,select:function(t){"function"!=typeof t&&(t=at(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a,u=n[i],c=u.length,f=r[i]=new Array(c),s=0;s<c;++s)(o=u[s])&&(a=t.call(o,o.__data__,s,u))&&("__data__"in o&&(a.__data__=o.__data__),f[s]=a);return new Yt(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);return null==n?[]:ut(n)}}(t):ft(t);for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var a,u=n[o],c=u.length,f=0;f<c;++f)(a=u[f])&&(r.push(t.call(a,a.__data__,f,u)),i.push(a));return new Yt(r,i)},selectChild:function(t){return this.select(null==t?dt:function(t){return function(){return ht.call(this.children,t)}}("function"==typeof t?t:lt(t)))},selectChildren:function(t){return this.selectAll(null==t?gt:function(t){return function(){return pt.call(this.children,t)}}("function"==typeof t?t:lt(t)))},filter:function(t){"function"!=typeof t&&(t=st(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,c=r[i]=[],f=0;f<u;++f)(o=a[f])&&t.call(o,o.__data__,f,a)&&c.push(o);return new Yt(r,this._parents)},data:function(t,n){if(!arguments.length)return Array.from(this,mt);var e=n?bt:_t,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),u=new Array(o),c=new Array(o),f=0;f<o;++f){var s=r[f],l=i[f],h=l.length,d=ut(t.call(s,s&&s.__data__,f,r)),p=d.length,g=u[f]=new Array(p),y=a[f]=new Array(p);e(s,l,g,y,c[f]=new Array(h),d,n);for(var v,_,b=0,m=0;b<p;++b)if(v=g[b]){for(b>=m&&(m=b+1);!(_=y[m])&&++m<p;);v._next=_||null}}return(a=new Yt(a,r))._enter=u,a._exit=c,a},enter:function(){return new Yt(this._enter||this._groups.map(yt),this._parents)},exit:function(){return new Yt(this._exit||this._groups.map(yt),this._parents)},join:function(t,n,e){var r=this.enter(),i=this,o=this.exit();return r="function"==typeof t?t(r):r.append(t+""),null!=n&&(i=n(i)),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},merge:function(t){if(!(t instanceof Yt))throw new Error("invalid merge");for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var c,f=n[u],s=e[u],l=f.length,h=a[u]=new Array(l),d=0;d<l;++d)(c=f[d]||s[d])&&(h[d]=c);for(;u<r;++u)a[u]=n[u];return new Yt(a,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],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 n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=xt);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,u=e[o],c=u.length,f=i[o]=new Array(c),s=0;s<c;++s)(a=u[s])&&(f[s]=a);f.sort(n)}return new Yt(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,n=0,e=t.length;n<e;++n)for(var r=t[n],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 n of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=rt(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:"function"==typeof n?e.local?function(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}:function(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}:e.local?function(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}:function(t,n){return function(){this.setAttribute(t,n)}})(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof n?function(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}:function(t,n,e){return function(){this.style.setProperty(t,n,e)}})(t,n,null==e?"":e)):Mt(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?function(t){return function(){delete this[t]}}:"function"==typeof n?function(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}:function(t,n){return function(){this[t]=n}})(t,n)):this.node()[t]},classed:function(t,n){var e=At(t+"");if(arguments.length<2){for(var r=Tt(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?function(t,n){return function(){(n.apply(this,arguments)?Et:kt)(this,t)}}:n?function(t){return function(){Et(this,t)}}:function(t){return function(){kt(this,t)}})(e,n))},text:function(t){return arguments.length?this.each(null==t?Nt:("function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Ct:("function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(Pt)},lower:function(){return this.each(zt)},append:function(t){var n="function"==typeof t?t:it(t);return this.select(function(){return this.appendChild(n.apply(this,arguments))})},insert:function(t,n){var e="function"==typeof t?t:it(t),r=null==n?Dt:"function"==typeof n?n:at(n);return this.select(function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(qt)},clone:function(t){return this.select(t?Ft:Rt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=function(t){return t.trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}(t+""),a=o.length;if(!(arguments.length<2)){for(u=n?Ot:Ut,r=0;r<a;++r)this.each(u(o[r],n,e));return this}var u=this.node().__on;if(u)for(var c,f=0,s=u.length;f<s;++f)for(r=0,c=u[f];r<a;++r)if((i=o[r]).type===c.type&&i.name===c.name)return c.value},dispatch:function(t,n){return this.each(("function"==typeof n?function(t,n){return function(){return It(this,t,n.apply(this,arguments))}}:function(t,n){return function(){return It(this,t,n)}})(t,n))},[Symbol.iterator]:function*(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r,i=t[n],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};var Ht=0;function Xt(){return new Gt}function Gt(){this._="@"+(++Ht).toString(36)}function Vt(t){let n;for(;n=t.sourceEvent;)t=n;return t}function $t(t,n){if(t=Vt(t),void 0===n&&(n=t.currentTarget),n){var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}}return[t.pageX,t.pageY]}function Wt(t){t.stopImmediatePropagation()}function Zt(t){t.preventDefault(),t.stopImmediatePropagation()}function Kt(t){var n=t.document.documentElement,e=jt(t).on("dragstart.drag",Zt,!0);"onselectstart"in n?e.on("selectstart.drag",Zt,!0):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function Qt(t,n){var e=t.document.documentElement,r=jt(t).on("dragstart.drag",null);n&&(r.on("click.drag",Zt,!0),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}Gt.prototype=Xt.prototype={constructor:Gt,get:function(t){for(var n=this._;!(n in t);)if(!(t=t.parentNode))return;return t[n]},set:function(t,n){return t[this._]=n},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};var Jt=t=>()=>t;function tn(t,{sourceEvent:n,subject:e,target:r,identifier:i,active:o,x:a,y:u,dx:c,dy:f,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:e,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:u,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:s}})}function nn(t){return!t.ctrlKey&&!t.button}function en(){return this.parentNode}function rn(t,n){return null==n?{x:t.x,y:t.y}:n}function on(){return navigator.maxTouchPoints||"ontouchstart"in this}function an(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function un(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function cn(){}tn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var fn="\\s*([+-]?\\d+)\\s*",sn="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",ln="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",hn=/^#([0-9a-f]{3,8})$/,dn=new RegExp("^rgb\\("+[fn,fn,fn]+"\\)$"),pn=new RegExp("^rgb\\("+[ln,ln,ln]+"\\)$"),gn=new RegExp("^rgba\\("+[fn,fn,fn,sn]+"\\)$"),yn=new RegExp("^rgba\\("+[ln,ln,ln,sn]+"\\)$"),vn=new RegExp("^hsl\\("+[sn,ln,ln]+"\\)$"),_n=new RegExp("^hsla\\("+[sn,ln,ln,sn]+"\\)$"),bn={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 xn(){return this.rgb().formatRgb()}function wn(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=hn.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?Mn(n):3===e?new En(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?An(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?An(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=dn.exec(t))?new En(n[1],n[2],n[3],1):(n=pn.exec(t))?new En(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=gn.exec(t))?An(n[1],n[2],n[3],n[4]):(n=yn.exec(t))?An(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=vn.exec(t))?Pn(n[1],n[2]/100,n[3]/100,1):(n=_n.exec(t))?Pn(n[1],n[2]/100,n[3]/100,n[4]):bn.hasOwnProperty(t)?Mn(bn[t]):"transparent"===t?new En(NaN,NaN,NaN,0):null}function Mn(t){return new En(t>>16&255,t>>8&255,255&t,1)}function An(t,n,e,r){return r<=0&&(t=n=e=NaN),new En(t,n,e,r)}function Tn(t){return t instanceof cn||(t=wn(t)),t?new En((t=t.rgb()).r,t.g,t.b,t.opacity):new En}function Sn(t,n,e,r){return 1===arguments.length?Tn(t):new En(t,n,e,null==r?1:r)}function En(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function kn(){return"#"+Cn(this.r)+Cn(this.g)+Cn(this.b)}function Nn(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function Cn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Pn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new qn(t,n,e,r)}function zn(t){if(t instanceof qn)return new qn(t.h,t.s,t.l,t.opacity);if(t instanceof cn||(t=wn(t)),!t)return new qn;if(t instanceof qn)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,c=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e<r):e===o?(r-n)/u+2:(n-e)/u+4,u/=c<.5?o+i:2-o-i,a*=60):u=c>0&&c<1?0:a,new qn(a,u,c,t.opacity)}function Dn(t,n,e,r){return 1===arguments.length?zn(t):new qn(t,n,e,null==r?1:r)}function qn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Rn(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}an(cn,wn,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:mn,formatHex:mn,formatHsl:function(){return zn(this).formatHsl()},formatRgb:xn,toString:xn}),an(En,Sn,un(cn,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new En(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new En(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){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:kn,formatHex:kn,formatRgb:Nn,toString:Nn})),an(qn,Dn,un(cn,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new qn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new qn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new En(Rn(t>=240?t-240:t+120,i,r),Rn(t,i,r),Rn(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));const Fn=Math.PI/180,Un=180/Math.PI,On=.96422,In=1,Bn=.82521,Yn=4/29,Ln=6/29,jn=3*Ln*Ln,Hn=Ln*Ln*Ln;function Xn(t){if(t instanceof Vn)return new Vn(t.l,t.a,t.b,t.opacity);if(t instanceof te)return ne(t);t instanceof En||(t=Tn(t));var n,e,r=Kn(t.r),i=Kn(t.g),o=Kn(t.b),a=$n((.2225045*r+.7168786*i+.0606169*o)/In);return r===i&&i===o?n=e=a:(n=$n((.4360747*r+.3850649*i+.1430804*o)/On),e=$n((.0139322*r+.0971045*i+.7141733*o)/Bn)),new Vn(116*a-16,500*(n-a),200*(a-e),t.opacity)}function Gn(t,n,e,r){return 1===arguments.length?Xn(t):new Vn(t,n,e,null==r?1:r)}function Vn(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function $n(t){return t>Hn?Math.pow(t,1/3):t/jn+Yn}function Wn(t){return t>Ln?t*t*t:jn*(t-Yn)}function Zn(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Kn(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Qn(t){if(t instanceof te)return new te(t.h,t.c,t.l,t.opacity);if(t instanceof Vn||(t=Xn(t)),0===t.a&&0===t.b)return new te(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*Un;return new te(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function Jn(t,n,e,r){return 1===arguments.length?Qn(t):new te(t,n,e,null==r?1:r)}function te(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function ne(t){if(isNaN(t.h))return new Vn(t.l,0,0,t.opacity);var n=t.h*Fn;return new Vn(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}an(Vn,Gn,un(cn,{brighter:function(t){return new Vn(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new Vn(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new En(Zn(3.1338561*(n=On*Wn(n))-1.6168667*(t=In*Wn(t))-.4906146*(e=Bn*Wn(e))),Zn(-.9787684*n+1.9161415*t+.033454*e),Zn(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),an(te,Jn,un(cn,{brighter:function(t){return new te(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new te(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return ne(this).rgb()}}));var ee=-.14861,re=1.78277,ie=-.29227,oe=-.90649,ae=1.97294,ue=ae*oe,ce=ae*re,fe=re*ie-oe*ee;function se(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof le)return new le(t.h,t.s,t.l,t.opacity);t instanceof En||(t=Tn(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(fe*r+ue*n-ce*e)/(fe+ue-ce),o=r-i,a=(ae*(e-i)-ie*o)/oe,u=Math.sqrt(a*a+o*o)/(ae*i*(1-i)),c=u?Math.atan2(a,o)*Un-120:NaN;return new le(c<0?c+360:c,u,i,t.opacity)}(t):new le(t,n,e,null==r?1:r)}function le(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function he(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}function de(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,u=r<n-1?t[r+2]:2*o-i;return he((e-r/n)*n,a,i,o,u)}}function pe(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n),i=t[(r+n-1)%n],o=t[r%n],a=t[(r+1)%n],u=t[(r+2)%n];return he((e-r/n)*n,i,o,a,u)}}an(le,se,un(cn,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new le(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new le(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Fn,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new En(255*(n+e*(ee*r+re*i)),255*(n+e*(ie*r+oe*i)),255*(n+e*(ae*r)),this.opacity)}}));var ge=t=>()=>t;function ye(t,n){return function(e){return t+e*n}}function ve(t,n){var e=n-t;return e?ye(t,e>180||e<-180?e-360*Math.round(e/360):e):ge(isNaN(t)?n:t)}function _e(t){return 1==(t=+t)?be:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):ge(isNaN(n)?e:n)}}function be(t,n){var e=n-t;return e?ye(t,e):ge(isNaN(t)?n:t)}var me=function t(n){var e=_e(n);function r(t,n){var r=e((t=Sn(t)).r,(n=Sn(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=be(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function xe(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),u=new Array(i);for(e=0;e<i;++e)r=Sn(n[e]),o[e]=r.r||0,a[e]=r.g||0,u[e]=r.b||0;return o=t(o),a=t(a),u=t(u),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=u(t),r+""}}}var we=xe(de),Me=xe(pe);function Ae(t,n){n||(n=[]);var e,r=t?Math.min(n.length,t.length):0,i=n.slice();return function(o){for(e=0;e<r;++e)i[e]=t[e]*(1-o)+n[e]*o;return i}}function Te(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Se(t,n){var e,r=n?n.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(e=0;e<i;++e)o[e]=De(t[e],n[e]);for(;e<r;++e)a[e]=n[e];return function(t){for(e=0;e<i;++e)a[e]=o[e](t);return a}}function Ee(t,n){var e=new Date;return t=+t,n=+n,function(r){return e.setTime(t*(1-r)+n*r),e}}function ke(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}function Ne(t,n){var e,r={},i={};for(e in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)e in t?r[e]=De(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}}var Ce=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Pe=new RegExp(Ce.source,"g");function ze(t,n){var e,r,i,o=Ce.lastIndex=Pe.lastIndex=0,a=-1,u=[],c=[];for(t+="",n+="";(e=Ce.exec(t))&&(r=Pe.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,c.push({i:a,x:ke(e,r)})),o=Pe.lastIndex;return o<n.length&&(i=n.slice(o),u[a]?u[a]+=i:u[++a]=i),u.length<2?c[0]?function(t){return function(n){return t(n)+""}}(c[0].x):function(t){return function(){return t}}(n):(n=c.length,function(t){for(var e,r=0;r<n;++r)u[(e=c[r]).i]=e.x(t);return u.join("")})}function De(t,n){var e,r=typeof n;return null==n||"boolean"===r?ge(n):("number"===r?ke:"string"===r?(e=wn(n))?(n=e,me):ze:n instanceof wn?me:n instanceof Date?Ee:Te(n)?Ae:Array.isArray(n)?Se:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?Ne:ke)(t,n)}function qe(t,n){return t=+t,n=+n,function(e){return Math.round(t*(1-e)+n*e)}}var Re,Fe=180/Math.PI,Ue={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Oe(t,n,e,r,i,o){var a,u,c;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(c=t*e+n*r)&&(e-=t*c,r-=n*c),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,c/=u),t*r<n*e&&(t=-t,n=-n,c=-c,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*Fe,skewX:Math.atan(c)*Fe,scaleX:a,scaleY:u}}function Ie(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var u=[],c=[];return o=t(o),a=t(a),function(t,r,i,o,a,u){if(t!==i||r!==o){var c=a.push("translate(",null,n,null,e);u.push({i:c-4,x:ke(t,i)},{i:c-2,x:ke(r,o)})}else(i||o)&&a.push("translate("+i+n+o+e)}(o.translateX,o.translateY,a.translateX,a.translateY,u,c),function(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:ke(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,u,c),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:ke(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,u,c),function(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:ke(t,e)},{i:u-2,x:ke(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,c),o=a=null,function(t){for(var n,e=-1,r=c.length;++e<r;)u[(n=c[e]).i]=n.x(t);return u.join("")}}}var Be=Ie(function(t){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return n.isIdentity?Ue:Oe(n.a,n.b,n.c,n.d,n.e,n.f)},"px, ","px)","deg)"),Ye=Ie(function(t){return null==t?Ue:(Re||(Re=document.createElementNS("http://www.w3.org/2000/svg","g")),Re.setAttribute("transform",t),(t=Re.transform.baseVal.consolidate())?Oe((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Ue)},", ",")",")"),Le=1e-12;function je(t){return((t=Math.exp(t))+1/t)/2}var He=function t(n,e,r){function i(t,i){var o,a,u=t[0],c=t[1],f=t[2],s=i[0],l=i[1],h=i[2],d=s-u,p=l-c,g=d*d+p*p;if(g<Le)a=Math.log(h/f)/n,o=function(t){return[u+t*d,c+t*p,f*Math.exp(n*t*a)]};else{var y=Math.sqrt(g),v=(h*h-f*f+r*g)/(2*f*e*y),_=(h*h-f*f-r*g)/(2*h*e*y),b=Math.log(Math.sqrt(v*v+1)-v),m=Math.log(Math.sqrt(_*_+1)-_);a=(m-b)/n,o=function(t){var r=t*a,i=je(b),o=f/(e*y)*(i*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(n*r+b)-function(t){return((t=Math.exp(t))-1/t)/2}(b));return[u+o*d,c+o*p,f*i/je(n*r+b)]}}return o.duration=1e3*a*n/Math.SQRT2,o}return i.rho=function(n){var e=Math.max(.001,+n),r=e*e;return t(e,r,r*r)},i}(Math.SQRT2,2,4);function Xe(t){return function(n,e){var r=t((n=Dn(n)).h,(e=Dn(e)).h),i=be(n.s,e.s),o=be(n.l,e.l),a=be(n.opacity,e.opacity);return function(t){return n.h=r(t),n.s=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var Ge=Xe(ve),Ve=Xe(be);function $e(t){return function(n,e){var r=t((n=Jn(n)).h,(e=Jn(e)).h),i=be(n.c,e.c),o=be(n.l,e.l),a=be(n.opacity,e.opacity);return function(t){return n.h=r(t),n.c=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var We=$e(ve),Ze=$e(be);function Ke(t){return function n(e){function r(n,r){var i=t((n=se(n)).h,(r=se(r)).h),o=be(n.s,r.s),a=be(n.l,r.l),u=be(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=o(t),n.l=a(Math.pow(t,e)),n.opacity=u(t),n+""}}return e=+e,r.gamma=n,r}(1)}var Qe=Ke(ve),Je=Ke(be);function tr(t,n){void 0===n&&(n=t,t=De);for(var e=0,r=n.length-1,i=n[0],o=new Array(r<0?0:r);e<r;)o[e]=t(i,i=n[++e]);return function(t){var n=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return o[n](t-n)}}var nr,er,rr=0,ir=0,or=0,ar=1e3,ur=0,cr=0,fr=0,sr="object"==typeof performance&&performance.now?performance:Date,lr="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function hr(){return cr||(lr(dr),cr=sr.now()+fr)}function dr(){cr=0}function pr(){this._call=this._time=this._next=null}function gr(t,n,e){var r=new pr;return r.restart(t,n,e),r}function yr(){hr(),++rr;for(var t,n=nr;n;)(t=cr-n._time)>=0&&n._call.call(null,t),n=n._next;--rr}function vr(){cr=(ur=sr.now())+fr,rr=ir=0;try{yr()}finally{rr=0,function(){var t,n,e=nr,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:nr=n);er=t,br(r)}(),cr=0}}function _r(){var t=sr.now(),n=t-ur;n>ar&&(fr-=n,ur=t)}function br(t){rr||(ir&&(ir=clearTimeout(ir)),t-cr>24?(t<1/0&&(ir=setTimeout(vr,t-sr.now()-fr)),or&&(or=clearInterval(or))):(or||(ur=sr.now(),or=setInterval(_r,ar)),rr=1,lr(vr)))}function mr(t,n,e){var r=new pr;return n=null==n?0:+n,r.restart(e=>{r.stop(),t(e+n)},n,e),r}pr.prototype=gr.prototype={constructor:pr,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?hr():+e)+(null==n?0:+n),this._next||er===this||(er?er._next=this:nr=this,er=this),this._call=t,this._time=e,br()},stop:function(){this._call&&(this._call=null,this._time=1/0,br())}};var xr=Z("start","end","cancel","interrupt"),wr=[],Mr=0,Ar=1,Tr=2,Sr=3,Er=4,kr=5,Nr=6;function Cr(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(c){var f,s,l,h;if(e.state!==Ar)return u();for(f in i)if((h=i[f]).name===e.name){if(h.state===Sr)return mr(o);h.state===Er?(h.state=Nr,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[f]):+f<n&&(h.state=Nr,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete i[f])}if(mr(function(){e.state===Sr&&(e.state=Er,e.timer.restart(a,e.delay,e.time),a(c))}),e.state=Tr,e.on.call("start",t,t.__data__,e.index,e.group),e.state===Tr){for(e.state=Sr,r=new Array(l=e.tween.length),f=0,s=-1;f<l;++f)(h=e.tween[f].value.call(t,t.__data__,e.index,e.group))&&(r[++s]=h);r.length=s+1}}function a(n){for(var i=n<e.duration?e.ease.call(null,n/e.duration):(e.timer.restart(u),e.state=kr,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);e.state===kr&&(e.on.call("end",t,t.__data__,e.index,e.group),u())}function u(){for(var r in e.state=Nr,e.timer.stop(),delete i[n],i)return;delete t.__transition}i[n]=e,e.timer=gr(function(t){e.state=Ar,e.timer.restart(o,e.delay,e.time),e.delay<=t&&o(t-e.delay)},0,e.time)}(t,e,{name:n,index:r,group:i,on:xr,tween:wr,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Mr})}function Pr(t,n){var e=Dr(t,n);if(e.state>Mr)throw new Error("too late; already scheduled");return e}function zr(t,n){var e=Dr(t,n);if(e.state>Sr)throw new Error("too late; already running");return e}function Dr(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function qr(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>Tr&&e.state<kr,e.state=Nr,e.timer.stop(),e.on.call(r?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete o[i]):a=!1;a&&delete t.__transition}}function Rr(t,n,e){var r=t._id;return t.each(function(){var t=zr(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)}),function(t){return Dr(t,r).value[n]}}function Fr(t,n){var e;return("number"==typeof n?ke:n instanceof wn?me:(e=wn(n))?(n=e,me):ze)(t,n)}var Ur=Lt.prototype.constructor;function Or(t){return function(){this.style.removeProperty(t)}}var Ir=0;function Br(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function Yr(t){return Lt().transition(t)}function Lr(){return++Ir}var jr=Lt.prototype;Br.prototype=Yr.prototype={constructor:Br,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=at(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var u,c,f=r[a],s=f.length,l=o[a]=new Array(s),h=0;h<s;++h)(u=f[h])&&(c=t.call(u,u.__data__,h,f))&&("__data__"in u&&(c.__data__=u.__data__),l[h]=c,Cr(l[h],n,e,h,l,Dr(u,e)));return new Br(o,this._parents,n,e)},selectAll:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=ft(t));for(var r=this._groups,i=r.length,o=[],a=[],u=0;u<i;++u)for(var c,f=r[u],s=f.length,l=0;l<s;++l)if(c=f[l]){for(var h,d=t.call(c,c.__data__,l,f),p=Dr(c,e),g=0,y=d.length;g<y;++g)(h=d[g])&&Cr(h,n,e,g,d,p);o.push(d),a.push(c)}return new Br(o,a,n,e)},filter:function(t){"function"!=typeof t&&(t=st(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,c=r[i]=[],f=0;f<u;++f)(o=a[f])&&t.call(o,o.__data__,f,a)&&c.push(o);return new Br(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var c,f=n[u],s=e[u],l=f.length,h=a[u]=new Array(l),d=0;d<l;++d)(c=f[d]||s[d])&&(h[d]=c);for(;u<r;++u)a[u]=n[u];return new Br(a,this._parents,this._name,this._id)},selection:function(){return new Ur(this._groups,this._parents)},transition:function(){for(var t=this._name,n=this._id,e=Lr(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],c=u.length,f=0;f<c;++f)if(a=u[f]){var s=Dr(a,n);Cr(a,t,e,f,u,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new Br(r,this._parents,t,e)},call:jr.call,nodes:jr.nodes,node:jr.node,size:jr.size,empty:jr.empty,each:jr.each,on:function(t,n){var e=this._id;return arguments.length<2?Dr(this.node(),e).on.on(t):this.each(function(t,n,e){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t})}(n)?Pr:zr;return function(){var a=o(this,t),u=a.on;u!==r&&(i=(r=u).copy()).on(n,e),a.on=i}}(e,t,n))},attr:function(t,n){var e=rt(t),r="transform"===e?Ye:Fr;return this.attrTween(t,"function"==typeof n?(e.local?function(t,n,e){var r,i,o;return function(){var a,u,c=e(this);if(null!=c)return(a=this.getAttributeNS(t.space,t.local))===(u=c+"")?null:a===r&&u===i?o:(i=u,o=n(r=a,c));this.removeAttributeNS(t.space,t.local)}}:function(t,n,e){var r,i,o;return function(){var a,u,c=e(this);if(null!=c)return(a=this.getAttribute(t))===(u=c+"")?null:a===r&&u===i?o:(i=u,o=n(r=a,c));this.removeAttribute(t)}})(e,r,Rr(this,"attr."+t,n)):null==n?(e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(e):(e.local?function(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=n(r=a,e)}}:function(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=n(r=a,e)}})(e,r,n))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=rt(t);return this.tween(e,(r.local?function(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttributeNS(t.space,t.local,n.call(this,e))}}(t,i)),e}return i._value=n,i}:function(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttribute(t,n.call(this,e))}}(t,i)),e}return i._value=n,i})(r,n))},style:function(t,n,e){var r="transform"==(t+="")?Be:Fr;return null==n?this.styleTween(t,function(t,n){var e,r,i;return function(){var o=Mt(this,t),a=(this.style.removeProperty(t),Mt(this,t));return o===a?null:o===e&&a===r?i:i=n(e=o,r=a)}}(t,r)).on("end.style."+t,Or(t)):"function"==typeof n?this.styleTween(t,function(t,n,e){var r,i,o;return function(){var a=Mt(this,t),u=e(this),c=u+"";return null==u&&(this.style.removeProperty(t),c=u=Mt(this,t)),a===c?null:a===r&&c===i?o:(i=c,o=n(r=a,u))}}(t,r,Rr(this,"style."+t,n))).each(function(t,n){var e,r,i,o,a="style."+n,u="end."+a;return function(){var c=zr(this,t),f=c.on,s=null==c.value[a]?o||(o=Or(n)):void 0;f===e&&i===s||(r=(e=f).copy()).on(u,i=s),c.on=r}}(this._id,t)):this.styleTween(t,function(t,n,e){var r,i,o=e+"";return function(){var a=Mt(this,t);return a===o?null:a===r?i:i=n(r=a,e)}}(t,r,n),e).on("end.style."+t,null)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}(t,o,e)),r}return o._value=n,o}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(Rr(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;return this.tween(n,function(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&function(t){return function(n){this.textContent=t.call(this,n)}}(r)),n}return r.