=e-1){var s=u[n];return s.x0=i,s.y0=o,s.x1=a,void(s.y1=c)}var l=f[n],h=r/2+l,d=n+1,p=e-1;for(;d>>1;f[g]c-o){var _=r?(i*v+a*y)/r:a;t(n,d,y,i,o,_,c),t(d,e,v,_,o,a,c)}else{var b=r?(o*v+c*y)/r:c;t(n,d,y,i,o,a,b),t(d,e,v,i,b,a,c)}}(0,c,t.value,n,e,r,i)},t.treemapDice=Hd,t.treemapResquarify=fp,t.treemapSlice=op,t.treemapSliceDice=function(t,n,e,r,i){(1&t.depth?op:Hd)(t,n,e,r,i)},t.treemapSquarify=cp,t.tsv=Qu,t.tsvFormat=Bu,t.tsvFormatBody=Yu,t.tsvFormatRow=ju,t.tsvFormatRows=Lu,t.tsvFormatValue=$u,t.tsvParse=Uu,t.tsvParseRows=Iu,t.union=function(...t){const n=new InternSet;for(const e of t)for(const t of e)n.add(t);return n},t.utcDay=hy,t.utcDays=dy,t.utcFriday=my,t.utcFridays=Ey,t.utcHour=fy,t.utcHours=sy,t.utcMillisecond=vg,t.utcMilliseconds=_g,t.utcMinute=ay,t.utcMinutes=uy,t.utcMonday=yy,t.utcMondays=My,t.utcMonth=Cy,t.utcMonths=Py,t.utcSaturday=xy,t.utcSaturdays=ky,t.utcSecond=Eg,t.utcSeconds=kg,t.utcSunday=gy,t.utcSundays=wy,t.utcThursday=by,t.utcThursdays=Sy,t.utcTickInterval=Oy,t.utcTicks=qy,t.utcTuesday=vy,t.utcTuesdays=Ay,t.utcWednesday=_y,t.utcWednesdays=Ty,t.utcWeek=gy,t.utcWeeks=wy,t.utcYear=Dy,t.utcYears=Ry,t.variance=g,t.version="7.4.4",t.window=en,t.xml=nc,t.zip=function(){return at(arguments)},t.zoom=function(){var t,n,e,r=iw,i=ow,o=fw,a=uw,u=cw,c=[0,1/0],f=[[-1/0,-1/0],[1/0,1/0]],s=250,l=Xr,h=mt("start","zoom","end"),d=500,p=0,g=10;function y(t){t.property("__zoom",aw).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",T).filter(u).on("touchstart.zoom",S).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",k).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(t,n){return(n=Math.max(c[0],Math.min(c[1],n)))===t.k?t:new Jx(n,t.x,t.y)}function _(t,n,e){var r=n[0]-e[0]*t.k,i=n[1]-e[1]*t.k;return r===t.x&&i===t.y?t:new Jx(t.k,r,i)}function b(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function m(t,n,e,r){t.on("start.zoom",(function(){x(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){x(this,arguments).event(r).end()})).tween("zoom",(function(){var t=this,o=arguments,a=x(t,o).event(r),u=i.apply(t,o),c=null==e?b(u):"function"==typeof e?e.apply(t,o):e,f=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),s=t.__zoom,h="function"==typeof n?n.apply(t,o):n,d=l(s.invert(c).concat(f/s.k),h.invert(c).concat(f/h.k));return function(t){if(1===t)t=h;else{var n=d(t),e=f/n[2];t=new Jx(e,c[0]-n[0]*e,c[1]-n[1]*e)}a.zoom(null,t)}}))}function x(t,n,e){return!e&&t.__zooming||new w(t,n)}function w(t,n){this.that=t,this.args=n,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,n),this.taps=0}function M(t,...n){if(r.apply(this,arguments)){var e=x(this,n).event(t),i=this.__zoom,u=Math.max(c[0],Math.min(c[1],i.k*Math.pow(2,a.apply(this,arguments)))),s=Hn(t);if(e.wheel)e.mouse[0][0]===s[0]&&e.mouse[0][1]===s[1]||(e.mouse[1]=i.invert(e.mouse[0]=s)),clearTimeout(e.wheel);else{if(i.k===u)return;e.mouse=[s,i.invert(s)],ki(this),e.start()}rw(t),e.wheel=setTimeout(l,150),e.zoom("mouse",o(_(v(i,u),e.mouse[0],e.mouse[1]),e.extent,f))}function l(){e.wheel=null,e.end()}}function A(t,...n){if(!e&&r.apply(this,arguments)){var i=t.currentTarget,a=x(this,n,!0).event(t),u=Bn(t.view).on("mousemove.zoom",h,!0).on("mouseup.zoom",d,!0),c=Hn(t,i),s=t.clientX,l=t.clientY;Zn(t.view),ew(t),a.mouse=[c,this.__zoom.invert(c)],ki(this),a.start()}function h(t){if(rw(t),!a.moved){var n=t.clientX-s,e=t.clientY-l;a.moved=n*n+e*e>p}a.event(t).zoom("mouse",o(_(a.that.__zoom,a.mouse[0]=Hn(t,i),a.mouse[1]),a.extent,f))}function d(t){u.on("mousemove.zoom mouseup.zoom",null),Kn(t.view,a.moved),rw(t),a.event(t).end()}}function T(t,...n){if(r.apply(this,arguments)){var e=this.__zoom,a=Hn(t.changedTouches?t.changedTouches[0]:t,this),u=e.invert(a),c=e.k*(t.shiftKey?.5:2),l=o(_(v(e,c),a,u),i.apply(this,n),f);rw(t),s>0?Bn(this).transition().duration(s).call(m,l,a,t):Bn(this).call(y.transform,l,a,t)}}function S(e,...i){if(r.apply(this,arguments)){var o,a,u,c,f=e.touches,s=f.length,l=x(this,i,e.changedTouches.length===s).event(e);for(ew(e),a=0;an?1:t>=n?0:NaN}function e(t,n){return null==t||null==n?NaN:nt?1:n>=t?0:NaN}function r(t){let r,o,a;function u(t,n,e=0,i=t.length){if(e>>1;o(t[r],n)<0?e=r+1:i=r}while(en(t(e),r),a=(n,e)=>t(n)-e):(r=t===n||t===e?t:i,o=t,a=t),{left:u,center:function(t,n,e=0,r=t.length){const i=u(t,n,e,r-1);return i>e&&a(t[i-1],n)>-a(t[i],n)?i-1:i},right:function(t,n,e=0,i=t.length){if(e>>1;o(t[r],n)<=0?e=r+1:i=r}while(e=n&&++e;else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(i=+i)>=i&&++e}return e}function h(t){return 0|t.length}function d(t){return!(t>0)}function p(t){return"object"!=typeof t||"length"in t?t:Array.from(t)}function g(t,n){let e,r=0,i=0,o=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(e=n-i,i+=e/++r,o+=e*(n-i));else{let a=-1;for(let u of t)null!=(u=n(u,++a,t))&&(u=+u)>=u&&(e=u-i,i+=e/++r,o+=e*(u-i))}if(r>1)return o/(r-1)}function y(t,n){const e=g(t,n);return e?Math.sqrt(e):e}function v(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=o&&(e=r=o):(e>o&&(e=o),r0){for(o=t[--i];i>0&&(n=o,e=t[--i],o=n+e,r=e-(o-n),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(e=2*r,n=o+e,e==n-o&&(o=n))}return o}}class InternMap extends Map{constructor(t,n=w){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const[n,e]of t)this.set(n,e)}get(t){return super.get(b(this,t))}has(t){return super.has(b(this,t))}set(t,n){return super.set(m(this,t),n)}delete(t){return super.delete(x(this,t))}}class InternSet extends Set{constructor(t,n=w){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const n of t)this.add(n)}has(t){return super.has(b(this,t))}add(t){return super.add(m(this,t))}delete(t){return super.delete(x(this,t))}}function b({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):e}function m({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):(t.set(r,e),e)}function x({_intern:t,_key:n},e){const r=n(e);return t.has(r)&&(e=t.get(r),t.delete(r)),e}function w(t){return null!==t&&"object"==typeof t?t.valueOf():t}function M(t){return t}function A(t,...n){return C(t,M,M,n)}function T(t,...n){return C(t,Array.from,M,n)}function S(t,n){for(let e=1,r=n.length;et.pop().map((([n,e])=>[...t,n,e]))));return t}function E(t,n,...e){return C(t,M,n,e)}function k(t,n,...e){return C(t,Array.from,n,e)}function N(t){if(1!==t.length)throw new Error("duplicate key");return t[0]}function C(t,n,e,r){return function t(i,o){if(o>=r.length)return e(i);const a=new InternMap,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)}function P(t,n){return Array.from(n,(n=>t[n]))}function z(t,...n){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");t=Array.from(t);let[e]=n;if(e&&2!==e.length||n.length>1){const r=Uint32Array.from(t,((t,n)=>n));return n.length>1?(n=n.map((n=>t.map(n))),r.sort(((t,e)=>{for(const r of n){const n=R(r[t],r[e]);if(n)return n}}))):(e=t.map(e),r.sort(((t,n)=>R(e[t],e[n])))),P(t,r)}return t.sort(D(e))}function D(t=n){if(t===n)return R;if("function"!=typeof t)throw new TypeError("compare is not a function");return(n,e)=>{const r=t(n,e);return r||0===r?r:(0===t(e,e))-(0===t(n,n))}}function R(t,n){return(null==t||!(t>=t))-(null==n||!(n>=n))||(tn?1:0)}var F=Array.prototype.slice;function q(t){return()=>t}var O=Math.sqrt(50),U=Math.sqrt(10),I=Math.sqrt(2);function B(t,n,e){var r,i,o,a,u=-1;if(e=+e,(t=+t)===(n=+n)&&e>0)return[t];if((r=n0){let e=Math.round(t/a),r=Math.round(n/a);for(e*an&&--r,o=new Array(i=r-e+1);++un&&--r,o=new Array(i=r-e+1);++u=0?(o>=O?10:o>=U?5:o>=I?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=O?10:o>=U?5:o>=I?2:1)}function L(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>=O?i*=10:o>=U?i*=5:o>=I&&(i*=2),n0?(t=Math.floor(t/i)*i,n=Math.ceil(n/i)*i):i<0&&(t=Math.ceil(t*i)/i,n=Math.floor(n*i)/i),r=i}}function $(t){return Math.ceil(Math.log(l(t))/Math.LN2)+1}function H(){var t=M,n=v,e=$;function r(r){Array.isArray(r)||(r=Array.from(r));var i,o,a,u=r.length,c=new Array(u);for(i=0;i=h)if(t>=h&&n===v){const t=Y(l,h,e);isFinite(t)&&(t>0?h=(Math.floor(h/t)+1)*t:t<0&&(h=(Math.ceil(h*-t)+1)/-t))}else d.pop()}for(var p=d.length;d[0]<=l;)d.shift(),--p;for(;d[p-1]>h;)d.pop(),--p;var g,y=new Array(p+1);for(i=0;i<=p;++i)(g=y[i]=[]).x0=i>0?d[i-1]:l,g.x1=i0)for(i=0;i=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e=i)&&(e=i)}return e}function G(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 V(t,n,e=0,r=t.length-1,i){for(i=void 0===i?R:D(i);r>e;){if(r-e>600){const o=r-e+1,a=n-e+1,u=Math.log(o),c=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*c*(o-c)/o)*(a-o/2<0?-1:1);V(t,n,Math.max(e,Math.floor(n-a*c/o+f)),Math.min(r,Math.floor(n+(o-a)*c/o+f)),i)}const o=t[n];let a=e,u=r;for(W(t,e,n),i(t[r],o)>0&&W(t,e,r);a0;)--u}0===i(t[e],o)?W(t,e,u):(++u,W(t,u,r)),u<=n&&(e=u+1),n<=u&&(r=u-1)}return t}function W(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function Z(t,n,e){if(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)),r=t.length){if((n=+n)<=0||r<2)return G(t);if(n>=1)return X(t);var r,i=(r-1)*n,o=Math.floor(i),a=X(V(t,o).subarray(0,o+1));return a+(G(t.subarray(o+1))-a)*(i-o)}}function K(t,n,e=o){if(r=t.length){if((n=+n)<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,a=Math.floor(i),u=+e(t[a],a,t);return u+(+e(t[a+1],a+1,t)-u)*(i-a)}}function Q(t,n){let e,r=-1,i=-1;if(void 0===n)for(const n of t)++i,null!=n&&(e=n)&&(e=n,r=i);else for(let o of t)null!=(o=n(o,++i,t))&&(e=o)&&(e=o,r=i);return r}function J(t){return Array.from(function*(t){for(const n of t)yield*n}(t))}function tt(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 nt(t,n){return[t,n]}function et(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+t(n)}function yt(t,n){return n=Math.max(0,t.bandwidth()-2*n)/2,t.round()&&(n=Math.round(n)),e=>+t(e)+n}function vt(){return!this.__axis}function _t(t,n){var e=[],r=null,i=null,o=6,a=6,u=3,c="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,f=1===t||4===t?-1:1,s=4===t||2===t?"x":"y",l=1===t||3===t?dt:pt;function h(h){var d=null==r?n.ticks?n.ticks.apply(n,e):n.domain():r,p=null==i?n.tickFormat?n.tickFormat.apply(n,e):lt:i,g=Math.max(o,0)+u,y=n.range(),v=+y[0]+c,_=+y[y.length-1]+c,b=(n.bandwidth?yt:gt)(n.copy(),c),m=h.selection?h.selection():h,x=m.selectAll(".domain").data([null]),w=m.selectAll(".tick").data(d,n).order(),M=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(s+"2",f*o)),S=S.merge(A.append("text").attr("fill","currentColor").attr(s,f*g).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),h!==m&&(x=x.transition(h),w=w.transition(h),T=T.transition(h),S=S.transition(h),M=M.transition(h).attr("opacity",ht).attr("transform",(function(t){return isFinite(t=b(t))?l(t+c):this.getAttribute("transform")})),A.attr("opacity",ht).attr("transform",(function(t){var n=this.parentNode.__axis;return l((n&&isFinite(n=n(t))?n:b(t))+c)}))),M.remove(),x.attr("d",4===t||2===t?a?"M"+f*a+","+v+"H"+c+"V"+_+"H"+f*a:"M"+c+","+v+"V"+_:a?"M"+v+","+f*a+"V"+c+"H"+_+"V"+f*a:"M"+v+","+c+"H"+_),w.attr("opacity",1).attr("transform",(function(t){return l(b(t)+c)})),T.attr(s+"2",f*o),S.attr(s,f*g).text(p),m.filter(vt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),m.each((function(){this.__axis=b}))}return h.scale=function(t){return arguments.length?(n=t,h):n},h.ticks=function(){return e=Array.from(arguments),h},h.tickArguments=function(t){return arguments.length?(e=null==t?[]:Array.from(t),h):e.slice()},h.tickValues=function(t){return arguments.length?(r=null==t?null:Array.from(t),h):r&&r.slice()},h.tickFormat=function(t){return arguments.length?(i=t,h):i},h.tickSize=function(t){return arguments.length?(o=a=+t,h):o},h.tickSizeInner=function(t){return arguments.length?(o=+t,h):o},h.tickSizeOuter=function(t){return arguments.length?(a=+t,h):a},h.tickPadding=function(t){return arguments.length?(u=+t,h):u},h.offset=function(t){return arguments.length?(c=+t,h):c},h}var bt={value:()=>{}};function mt(){for(var t,n=0,e=arguments.length,r={};n=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 Mt(t,n){for(var e,r=0,i=t.length;r0)for(var e,r,i=new Array(e),o=0;o=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),St.hasOwnProperty(n)?{space:St[n],local:t}:t}function kt(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===Tt&&n.documentElement.namespaceURI===Tt?n.createElement(t):n.createElementNS(e,t)}}function Nt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Ct(t){var n=Et(t);return(n.local?Nt:kt)(n)}function Pt(){}function zt(t){return null==t?Pt:function(){return this.querySelector(t)}}function Dt(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function Rt(){return[]}function Ft(t){return null==t?Rt:function(){return this.querySelectorAll(t)}}function qt(t){return function(){return this.matches(t)}}function Ot(t){return function(n){return n.matches(t)}}var Ut=Array.prototype.find;function It(){return this.firstElementChild}var Bt=Array.prototype.filter;function Yt(){return Array.from(this.children)}function Lt(t){return new Array(t.length)}function jt(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function $t(t){return function(){return t}}function Ht(t,n,e,r,i,o){for(var a,u=0,c=n.length,f=o.length;un?1:t>=n?0:NaN}function Zt(t){return function(){this.removeAttribute(t)}}function Kt(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Qt(t,n){return function(){this.setAttribute(t,n)}}function Jt(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function tn(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function nn(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 en(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function rn(t){return function(){this.style.removeProperty(t)}}function on(t,n,e){return function(){this.style.setProperty(t,n,e)}}function an(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function un(t,n){return t.style.getPropertyValue(n)||en(t).getComputedStyle(t,null).getPropertyValue(n)}function cn(t){return function(){delete this[t]}}function fn(t,n){return function(){this[t]=n}}function sn(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function ln(t){return t.trim().split(/^|\s+/)}function hn(t){return t.classList||new dn(t)}function dn(t){this._node=t,this._names=ln(t.getAttribute("class")||"")}function pn(t,n){for(var e=hn(t),r=-1,i=n.length;++r=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}function zn(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var On=[null];function Un(t,n){this._groups=t,this._parents=n}function In(){return new Un([[document.documentElement]],On)}function Bn(t){return"string"==typeof t?new Un([[document.querySelector(t)]],[document.documentElement]):new Un([[t]],On)}Un.prototype=In.prototype={constructor:Un,select:function(t){"function"!=typeof t&&(t=zt(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i=x&&(x=m+1);!(b=y[x])&&++x=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=Wt);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o1?this.each((null==n?rn:"function"==typeof n?an:on)(t,n,null==e?"":e)):un(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?cn:"function"==typeof n?sn:fn)(t,n)):this.node()[t]},classed:function(t,n){var e=ln(t+"");if(arguments.length<2){for(var r=hn(this.node()),i=-1,o=e.length;++i()=>t;function Jn(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 te(t){return!t.ctrlKey&&!t.button}function ne(){return this.parentNode}function ee(t,n){return null==n?{x:t.x,y:t.y}:n}function re(){return navigator.maxTouchPoints||"ontouchstart"in this}function ie(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function oe(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function ae(){}Jn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var ue=.7,ce=1/ue,fe="\\s*([+-]?\\d+)\\s*",se="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",le="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",he=/^#([0-9a-f]{3,8})$/,de=new RegExp(`^rgb\\(${fe},${fe},${fe}\\)$`),pe=new RegExp(`^rgb\\(${le},${le},${le}\\)$`),ge=new RegExp(`^rgba\\(${fe},${fe},${fe},${se}\\)$`),ye=new RegExp(`^rgba\\(${le},${le},${le},${se}\\)$`),ve=new RegExp(`^hsl\\(${se},${le},${le}\\)$`),_e=new RegExp(`^hsla\\(${se},${le},${le},${se}\\)$`),be={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 me(){return this.rgb().formatHex()}function xe(){return this.rgb().formatRgb()}function we(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=he.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?Me(n):3===e?new Ee(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?Ae(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?Ae(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=de.exec(t))?new Ee(n[1],n[2],n[3],1):(n=pe.exec(t))?new Ee(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=ge.exec(t))?Ae(n[1],n[2],n[3],n[4]):(n=ye.exec(t))?Ae(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=ve.exec(t))?De(n[1],n[2]/100,n[3]/100,1):(n=_e.exec(t))?De(n[1],n[2]/100,n[3]/100,n[4]):be.hasOwnProperty(t)?Me(be[t]):"transparent"===t?new Ee(NaN,NaN,NaN,0):null}function Me(t){return new Ee(t>>16&255,t>>8&255,255&t,1)}function Ae(t,n,e,r){return r<=0&&(t=n=e=NaN),new Ee(t,n,e,r)}function Te(t){return t instanceof ae||(t=we(t)),t?new Ee((t=t.rgb()).r,t.g,t.b,t.opacity):new Ee}function Se(t,n,e,r){return 1===arguments.length?Te(t):new Ee(t,n,e,null==r?1:r)}function Ee(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function ke(){return`#${ze(this.r)}${ze(this.g)}${ze(this.b)}`}function Ne(){const t=Ce(this.opacity);return`${1===t?"rgb(":"rgba("}${Pe(this.r)}, ${Pe(this.g)}, ${Pe(this.b)}${1===t?")":`, ${t})`}`}function Ce(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Pe(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ze(t){return((t=Pe(t))<16?"0":"")+t.toString(16)}function De(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new qe(t,n,e,r)}function Re(t){if(t instanceof qe)return new qe(t.h,t.s,t.l,t.opacity);if(t instanceof ae||(t=we(t)),!t)return new qe;if(t instanceof qe)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*(e0&&c<1?0:a,new qe(a,u,c,t.opacity)}function Fe(t,n,e,r){return 1===arguments.length?Re(t):new qe(t,n,e,null==r?1:r)}function qe(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Oe(t){return(t=(t||0)%360)<0?t+360:t}function Ue(t){return Math.max(0,Math.min(1,t||0))}function Ie(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}ie(ae,we,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:me,formatHex:me,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Re(this).formatHsl()},formatRgb:xe,toString:xe}),ie(Ee,Se,oe(ae,{brighter(t){return t=null==t?ce:Math.pow(ce,t),new Ee(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?ue:Math.pow(ue,t),new Ee(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ee(Pe(this.r),Pe(this.g),Pe(this.b),Ce(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:ke,formatHex:ke,formatHex8:function(){return`#${ze(this.r)}${ze(this.g)}${ze(this.b)}${ze(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Ne,toString:Ne})),ie(qe,Fe,oe(ae,{brighter(t){return t=null==t?ce:Math.pow(ce,t),new qe(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?ue:Math.pow(ue,t),new qe(this.h,this.s,this.l*t,this.opacity)},rgb(){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 Ee(Ie(t>=240?t-240:t+120,i,r),Ie(t,i,r),Ie(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new qe(Oe(this.h),Ue(this.s),Ue(this.l),Ce(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=Ce(this.opacity);return`${1===t?"hsl(":"hsla("}${Oe(this.h)}, ${100*Ue(this.s)}%, ${100*Ue(this.l)}%${1===t?")":`, ${t})`}`}}));const Be=Math.PI/180,Ye=180/Math.PI,Le=.96422,je=.82521,$e=4/29,He=6/29,Xe=3*He*He;function Ge(t){if(t instanceof We)return new We(t.l,t.a,t.b,t.opacity);if(t instanceof er)return rr(t);t instanceof Ee||(t=Te(t));var n,e,r=Je(t.r),i=Je(t.g),o=Je(t.b),a=Ze((.2225045*r+.7168786*i+.0606169*o)/1);return r===i&&i===o?n=e=a:(n=Ze((.4360747*r+.3850649*i+.1430804*o)/Le),e=Ze((.0139322*r+.0971045*i+.7141733*o)/je)),new We(116*a-16,500*(n-a),200*(a-e),t.opacity)}function Ve(t,n,e,r){return 1===arguments.length?Ge(t):new We(t,n,e,null==r?1:r)}function We(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function Ze(t){return t>.008856451679035631?Math.pow(t,1/3):t/Xe+$e}function Ke(t){return t>He?t*t*t:Xe*(t-$e)}function Qe(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Je(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function tr(t){if(t instanceof er)return new er(t.h,t.c,t.l,t.opacity);if(t instanceof We||(t=Ge(t)),0===t.a&&0===t.b)return new er(NaN,0=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()=>t;function br(t,n){return function(e){return t+e*n}}function mr(t,n){var e=n-t;return e?br(t,e>180||e<-180?e-360*Math.round(e/360):e):_r(isNaN(t)?n:t)}function xr(t){return 1==(t=+t)?wr: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):_r(isNaN(n)?e:n)}}function wr(t,n){var e=n-t;return e?br(t,e):_r(isNaN(t)?n:t)}var Mr=function t(n){var e=xr(n);function r(t,n){var r=e((t=Se(t)).r,(n=Se(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=wr(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 Ar(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;eo&&(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:Pr(e,r)})),o=Rr.lastIndex;return o180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:Pr(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:Pr(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:Pr(t,e)},{i:u-2,x:Pr(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=0&&n._call.call(void 0,t),n=n._next;--oi}function _i(){fi=(ci=li.now())+si,oi=ai=0;try{vi()}finally{oi=0,function(){var t,n,e=ri,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:ri=n);ii=t,mi(r)}(),fi=0}}function bi(){var t=li.now(),n=t-ci;n>1e3&&(si-=n,ci=t)}function mi(t){oi||(ai&&(ai=clearTimeout(ai)),t-fi>24?(t<1/0&&(ai=setTimeout(_i,t-li.now()-si)),ui&&(ui=clearInterval(ui))):(ui||(ci=li.now(),ui=setInterval(bi,1e3)),oi=1,hi(_i)))}function xi(t,n,e){var r=new gi;return n=null==n?0:+n,r.restart((e=>{r.stop(),t(e+n)}),n,e),r}gi.prototype=yi.prototype={constructor:gi,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?di():+e)+(null==n?0:+n),this._next||ii===this||(ii?ii._next=this:ri=this,ii=this),this._call=t,this._time=e,mi()},stop:function(){this._call&&(this._call=null,this._time=1/0,mi())}};var wi=mt("start","end","cancel","interrupt"),Mi=[];function Ai(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(t){e.state=1,e.timer.restart(a,e.delay,e.time),e.delay<=t&&a(t-e.delay)}function a(o){var f,s,l,h;if(1!==e.state)return c();for(f in i)if((h=i[f]).name===e.name){if(3===h.state)return xi(a);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[f]):+f0)throw new Error("too late; already scheduled");return e}function Si(t,n){var e=Ei(t,n);if(e.state>3)throw new Error("too late; already running");return e}function Ei(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function ki(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>2&&e.state<5,e.state=6,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 Ni(t,n){var e,r;return function(){var i=Si(this,t),o=i.tween;if(o!==e)for(var a=0,u=(r=e=o).length;a=0&&(t=t.slice(0,n)),!t||"start"===t}))}(n)?Ti:Si;return function(){var a=o(this,t),u=a.on;u!==r&&(i=(r=u).copy()).on(n,e),a.on=i}}var Wi=In.prototype.constructor;function Zi(t){return function(){this.style.removeProperty(t)}}function Ki(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}function Qi(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&Ki(t,o,e)),r}return o._value=n,o}function Ji(t){return function(n){this.textContent=t.call(this,n)}}function to(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&Ji(r)),n}return r._value=t,r}var no=0;function eo(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function ro(t){return In().transition(t)}function io(){return++no}var oo=In.prototype;eo.prototype=ro.prototype={constructor:eo,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=zt(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a()=>t;function Do(t,{sourceEvent:n,target:e,selection:r,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:e,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function Ro(t){t.stopImmediatePropagation()}function Fo(t){t.preventDefault(),t.stopImmediatePropagation()}var qo={name:"drag"},Oo={name:"space"},Uo={name:"handle"},Io={name:"center"};const{abs:Bo,max:Yo,min:Lo}=Math;function jo(t){return[+t[0],+t[1]]}function $o(t){return[jo(t[0]),jo(t[1])]}var Ho={name:"x",handles:["w","e"].map(Jo),input:function(t,n){return null==t?null:[[+t[0],n[0][1]],[+t[1],n[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},Xo={name:"y",handles:["n","s"].map(Jo),input:function(t,n){return null==t?null:[[n[0][0],+t[0]],[n[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},Go={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Jo),input:function(t){return null==t?null:$o(t)},output:function(t){return t}},Vo={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"},Wo={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},Zo={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},Ko={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},Qo={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Jo(t){return{type:t}}function ta(t){return!t.ctrlKey&&!t.button}function na(){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 ea(){return navigator.maxTouchPoints||"ontouchstart"in this}function ra(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function ia(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function oa(t){var n,e=na,r=ta,i=ea,o=!0,a=mt("start","brush","end"),u=6;function c(n){var e=n.property("__brush",g).selectAll(".overlay").data([Jo("overlay")]);e.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Vo.overlay).merge(e).each((function(){var t=ra(this).extent;Bn(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])})),n.selectAll(".selection").data([Jo("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Vo.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=n.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 Vo[t.type]})),n.each(f).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",h).filter(i).on("touchstart.brush",h).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 f(){var t=Bn(this),n=ra(this).selection;n?(t.selectAll(".selection").style("display",null).attr("x",n[0][0]).attr("y",n[0][1]).attr("width",n[1][0]-n[0][0]).attr("height",n[1][1]-n[0][1]),t.selectAll(".handle").style("display",null).attr("x",(function(t){return"e"===t.type[t.type.length-1]?n[1][0]-u/2:n[0][0]-u/2})).attr("y",(function(t){return"s"===t.type[0]?n[1][1]-u/2:n[0][1]-u/2})).attr("width",(function(t){return"n"===t.type||"s"===t.type?n[1][0]-n[0][0]+u:u})).attr("height",(function(t){return"e"===t.type||"w"===t.type?n[1][1]-n[0][1]+u:u}))):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function s(t,n,e){var r=t.__brush.emitter;return!r||e&&r.clean?new l(t,n,e):r}function l(t,n,e){this.that=t,this.args=n,this.state=t.__brush,this.active=0,this.clean=e}function h(e){if((!n||e.touches)&&r.apply(this,arguments)){var i,a,u,c,l,h,d,p,g,y,v,_=this,b=e.target.__data__.type,m="selection"===(o&&e.metaKey?b="overlay":b)?qo:o&&e.altKey?Io:Uo,x=t===Xo?null:Ko[b],w=t===Ho?null:Qo[b],M=ra(_),A=M.extent,T=M.selection,S=A[0][0],E=A[0][1],k=A[1][0],N=A[1][1],C=0,P=0,z=x&&w&&o&&e.shiftKey,D=Array.from(e.touches||[e],(t=>{const n=t.identifier;return(t=Hn(t,_)).point0=t.slice(),t.identifier=n,t}));ki(_);var R=s(_,arguments,!0).beforestart();if("overlay"===b){T&&(g=!0);const n=[D[0],D[1]||D[0]];M.selection=T=[[i=t===Xo?S:Lo(n[0][0],n[1][0]),u=t===Ho?E:Lo(n[0][1],n[1][1])],[l=t===Xo?k:Yo(n[0][0],n[1][0]),d=t===Ho?N:Yo(n[0][1],n[1][1])]],D.length>1&&I(e)}else i=T[0][0],u=T[0][1],l=T[1][0],d=T[1][1];a=i,c=u,h=l,p=d;var F=Bn(_).attr("pointer-events","none"),q=F.selectAll(".overlay").attr("cursor",Vo[b]);if(e.touches)R.moved=U,R.ended=B;else{var O=Bn(e.view).on("mousemove.brush",U,!0).on("mouseup.brush",B,!0);o&&O.on("keydown.brush",Y,!0).on("keyup.brush",L,!0),Zn(e.view)}f.call(_),R.start(e,m.name)}function U(t){for(const n of t.changedTouches||[t])for(const t of D)t.identifier===n.identifier&&(t.cur=Hn(n,_));if(z&&!y&&!v&&1===D.length){const t=D[0];Bo(t.cur[0]-t[0])>Bo(t.cur[1]-t[1])?v=!0:y=!0}for(const t of D)t.cur&&(t[0]=t.cur[0],t[1]=t.cur[1]);g=!0,Fo(t),I(t)}function I(t){const n=D[0],e=n.point0;var r;switch(C=n[0]-e[0],P=n[1]-e[1],m){case Oo:case qo:x&&(C=Yo(S-i,Lo(k-l,C)),a=i+C,h=l+C),w&&(P=Yo(E-u,Lo(N-d,P)),c=u+P,p=d+P);break;case Uo:D[1]?(x&&(a=Yo(S,Lo(k,D[0][0])),h=Yo(S,Lo(k,D[1][0])),x=1),w&&(c=Yo(E,Lo(N,D[0][1])),p=Yo(E,Lo(N,D[1][1])),w=1)):(x<0?(C=Yo(S-i,Lo(k-i,C)),a=i+C,h=l):x>0&&(C=Yo(S-l,Lo(k-l,C)),a=i,h=l+C),w<0?(P=Yo(E-u,Lo(N-u,P)),c=u+P,p=d):w>0&&(P=Yo(E-d,Lo(N-d,P)),c=u,p=d+P));break;case Io:x&&(a=Yo(S,Lo(k,i-C*x)),h=Yo(S,Lo(k,l+C*x))),w&&(c=Yo(E,Lo(N,u-P*w)),p=Yo(E,Lo(N,d+P*w)))}h0&&(i=a-C),w<0?d=p-P:w>0&&(u=c-P),m=Oo,q.attr("cursor",Vo.selection),I(t));break;default:return}Fo(t)}function L(t){switch(t.keyCode){case 16:z&&(y=v=z=!1,I(t));break;case 18:m===Io&&(x<0?l=h:x>0&&(i=a),w<0?d=p:w>0&&(u=c),m=Uo,I(t));break;case 32:m===Oo&&(t.altKey?(x&&(l=h-C*x,i=a+C*x),w&&(d=p-P*w,u=c+P*w),m=Io):(x<0?l=h:x>0&&(i=a),w<0?d=p:w>0&&(u=c),m=Uo),q.attr("cursor",Vo[b]),I(t));break;default:return}Fo(t)}}function d(t){s(this,arguments).moved(t)}function p(t){s(this,arguments).ended(t)}function g(){var n=this.__brush||{selection:null};return n.extent=$o(e.apply(this,arguments)),n.dim=t,n}return c.move=function(n,e,r){n.tween?n.on("start.brush",(function(t){s(this,arguments).beforestart().start(t)})).on("interrupt.brush end.brush",(function(t){s(this,arguments).end(t)})).tween("brush",(function(){var n=this,r=n.__brush,i=s(n,arguments),o=r.selection,a=t.input("function"==typeof e?e.apply(this,arguments):e,r.extent),u=qr(o,a);function c(t){r.selection=1===t&&null===a?null:u(t),f.call(n),i.brush()}return null!==o&&null!==a?c:c(1)})):n.each((function(){var n=this,i=arguments,o=n.__brush,a=t.input("function"==typeof e?e.apply(n,i):e,o.extent),u=s(n,i).beforestart();ki(n),o.selection=null===a?null:a,f.call(n),u.start(r).brush(r).end(r)}))},c.clear=function(t,n){c.move(t,null,n)},l.prototype={beforestart:function(){return 1==++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(t,n){return this.starting?(this.starting=!1,this.emit("start",t,n)):this.emit("brush",t),this},brush:function(t,n){return this.emit("brush",t,n),this},end:function(t,n){return 0==--this.active&&(delete this.state.emitter,this.emit("end",t,n)),this},emit:function(n,e,r){var i=Bn(this.that).datum();a.call(n,this.that,new Do(n,{sourceEvent:e,target:c,selection:t.output(this.state.selection),mode:r,dispatch:a}),i)}},c.extent=function(t){return arguments.length?(e="function"==typeof t?t:zo($o(t)),c):e},c.filter=function(t){return arguments.length?(r="function"==typeof t?t:zo(!!t),c):r},c.touchable=function(t){return arguments.length?(i="function"==typeof t?t:zo(!!t),c):i},c.handleSize=function(t){return arguments.length?(u=+t,c):u},c.keyModifiers=function(t){return arguments.length?(o=!!t,c):o},c.on=function(){var t=a.on.apply(a,arguments);return t===a?c:t},c}var aa=Math.abs,ua=Math.cos,ca=Math.sin,fa=Math.PI,sa=fa/2,la=2*fa,ha=Math.max,da=1e-12;function pa(t,n){return Array.from({length:n-t},((n,e)=>t+e))}function ga(t){return function(n,e){return t(n.source.value+n.target.value,e.source.value+e.target.value)}}function ya(t,n){var e=0,r=null,i=null,o=null;function a(a){var u,c=a.length,f=new Array(c),s=pa(0,c),l=new Array(c*c),h=new Array(c),d=0;a=Float64Array.from({length:c*c},n?(t,n)=>a[n%c][n/c|0]:(t,n)=>a[n/c|0][n%c]);for(let n=0;nr(f[t],f[n])));for(const e of s){const r=n;if(t){const t=pa(1+~c,c).filter((t=>t<0?a[~t*c+e]:a[e*c+t]));i&&t.sort(((t,n)=>i(t<0?-a[~t*c+e]:a[e*c+t],n<0?-a[~n*c+e]:a[e*c+n])));for(const r of t)if(r<0){(l[~r*c+e]||(l[~r*c+e]={source:null,target:null})).target={index:e,startAngle:n,endAngle:n+=a[~r*c+e]*d,value:a[~r*c+e]}}else{(l[e*c+r]||(l[e*c+r]={source:null,target:null})).source={index:e,startAngle:n,endAngle:n+=a[e*c+r]*d,value:a[e*c+r]}}h[e]={index:e,startAngle:r,endAngle:n,value:f[e]}}else{const t=pa(0,c).filter((t=>a[e*c+t]||a[t*c+e]));i&&t.sort(((t,n)=>i(a[e*c+t],a[e*c+n])));for(const r of t){let t;if(eba)if(Math.abs(s*u-c*f)>ba&&i){var h=e-o,d=r-a,p=u*u+c*c,g=h*h+d*d,y=Math.sqrt(p),v=Math.sqrt(l),_=i*Math.tan((va-Math.acos((p+l-g)/(2*y*v)))/2),b=_/v,m=_/y;Math.abs(b-1)>ba&&(this._+="L"+(t+b*f)+","+(n+b*s)),this._+="A"+i+","+i+",0,0,"+ +(s*h>f*d)+","+(this._x1=t+m*u)+","+(this._y1=n+m*c)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,e,r,i,o){t=+t,n=+n,o=!!o;var a=(e=+e)*Math.cos(r),u=e*Math.sin(r),c=t+a,f=n+u,s=1^o,l=o?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+c+","+f:(Math.abs(this._x1-c)>ba||Math.abs(this._y1-f)>ba)&&(this._+="L"+c+","+f),e&&(l<0&&(l=l%_a+_a),l>ma?this._+="A"+e+","+e+",0,1,"+s+","+(t-a)+","+(n-u)+"A"+e+","+e+",0,1,"+s+","+(this._x1=c)+","+(this._y1=f):l>ba&&(this._+="A"+e+","+e+",0,"+ +(l>=va)+","+s+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};var Ma=Array.prototype.slice;function Aa(t){return function(){return t}}function Ta(t){return t.source}function Sa(t){return t.target}function Ea(t){return t.radius}function ka(t){return t.startAngle}function Na(t){return t.endAngle}function Ca(){return 0}function Pa(){return 10}function za(t){var n=Ta,e=Sa,r=Ea,i=Ea,o=ka,a=Na,u=Ca,c=null;function f(){var f,s=n.apply(this,arguments),l=e.apply(this,arguments),h=u.apply(this,arguments)/2,d=Ma.call(arguments),p=+r.apply(this,(d[0]=s,d)),g=o.apply(this,d)-sa,y=a.apply(this,d)-sa,v=+i.apply(this,(d[0]=l,d)),_=o.apply(this,d)-sa,b=a.apply(this,d)-sa;if(c||(c=f=wa()),h>da&&(aa(y-g)>2*h+da?y>g?(g+=h,y-=h):(g-=h,y+=h):g=y=(g+y)/2,aa(b-_)>2*h+da?b>_?(_+=h,b-=h):(_-=h,b+=h):_=b=(_+b)/2),c.moveTo(p*ua(g),p*ca(g)),c.arc(0,0,p,g,y),g!==_||y!==b)if(t){var m=+t.apply(this,arguments),x=v-m,w=(_+b)/2;c.quadraticCurveTo(0,0,x*ua(_),x*ca(_)),c.lineTo(v*ua(w),v*ca(w)),c.lineTo(x*ua(b),x*ca(b))}else c.quadraticCurveTo(0,0,v*ua(_),v*ca(_)),c.arc(0,0,v,_,b);if(c.quadraticCurveTo(0,0,p*ua(g),p*ca(g)),c.closePath(),f)return c=null,f+""||null}return t&&(f.headRadius=function(n){return arguments.length?(t="function"==typeof n?n:Aa(+n),f):t}),f.radius=function(t){return arguments.length?(r=i="function"==typeof t?t:Aa(+t),f):r},f.sourceRadius=function(t){return arguments.length?(r="function"==typeof t?t:Aa(+t),f):r},f.targetRadius=function(t){return arguments.length?(i="function"==typeof t?t:Aa(+t),f):i},f.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:Aa(+t),f):o},f.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:Aa(+t),f):a},f.padAngle=function(t){return arguments.length?(u="function"==typeof t?t:Aa(+t),f):u},f.source=function(t){return arguments.length?(n=t,f):n},f.target=function(t){return arguments.length?(e=t,f):e},f.context=function(t){return arguments.length?(c=null==t?null:t,f):c},f}var Da=Array.prototype.slice;function Ra(t,n){return t-n}var Fa=t=>()=>t;function qa(t,n){for(var e,r=-1,i=n.length;++rr!=d>r&&e<(h-f)*(r-s)/(d-s)+f&&(i=-i)}return i}function Ua(t,n,e){var r,i,o,a;return function(t,n,e){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])}(t,n,e)&&(i=t[r=+(t[0]===n[0])],o=e[r],a=n[r],i<=o&&o<=a||a<=o&&o<=i)}function Ia(){}var Ba=[[],[[[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 Ya(){var t=1,n=1,e=$,r=u;function i(t){var n=e(t);if(Array.isArray(n))n=n.slice().sort(Ra);else{const e=v(t),r=L(e[0],e[1],n);n=B(Math.floor(e[0]/r)*r,Math.floor(e[1]/r-1)*r,n)}return n.map((n=>o(t,n)))}function o(e,i){var o=[],u=[];return function(e,r,i){var o,u,c,f,s,l,h=new Array,d=new Array;o=u=-1,f=e[0]>=r,Ba[f<<1].forEach(p);for(;++o=r,Ba[c|f<<1].forEach(p);Ba[f<<0].forEach(p);for(;++u=r,s=e[u*t]>=r,Ba[f<<1|s<<2].forEach(p);++o=r,l=s,s=e[u*t+o+1]>=r,Ba[c|f<<1|s<<2|l<<3].forEach(p);Ba[f|s<<3].forEach(p)}o=-1,s=e[u*t]>=r,Ba[s<<2].forEach(p);for(;++o=r,Ba[s<<2|l<<3].forEach(p);function p(t){var n,e,r=[t[0][0]+o,t[0][1]+u],c=[t[1][0]+o,t[1][1]+u],f=a(r),s=a(c);(n=d[f])?(e=h[s])?(delete d[n.end],delete h[e.start],n===e?(n.ring.push(c),i(n.ring)):h[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete d[n.end],n.ring.push(c),d[n.end=s]=n):(n=h[s])?(e=d[f])?(delete h[n.start],delete d[e.end],n===e?(n.ring.push(c),i(n.ring)):h[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete h[n.start],n.ring.unshift(r),h[n.start=f]=n):h[f]=d[s]={start:f,end:s,ring:[r,c]}}Ba[s<<3].forEach(p)}(e,i,(function(t){r(t,e,i),function(t){for(var n=0,e=t.length,r=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];++n0?o.push([t]):u.push(t)})),u.forEach((function(t){for(var n,e=0,r=o.length;e0&&a0&&u=0&&o>=0))throw new Error("invalid size");return t=r,n=o,i},i.thresholds=function(t){return arguments.length?(e="function"==typeof t?t:Array.isArray(t)?Fa(Da.call(t)):Fa(t),i):e},i.smooth=function(t){return arguments.length?(r=t?u:Ia,i):r===u},i}function La(t,n,e){for(var r=t.width,i=t.height,o=1+(e<<1),a=0;a=e&&(u>=o&&(c-=t.data[u-o+a*r]),n.data[u-e+a*r]=c/Math.min(u+1,r-1+o-u,o))}function ja(t,n,e){for(var r=t.width,i=t.height,o=1+(e<<1),a=0;a=e&&(u>=o&&(c-=t.data[a+(u-o)*r]),n.data[a+(u-e)*r]=c/Math.min(u+1,i-1+o-u,o))}function $a(t){return t[0]}function Ha(t){return t[1]}function Xa(){return 1}const Ga=134217729;function Va(t,n,e,r,i){let o,a,u,c,f=n[0],s=r[0],l=0,h=0;s>f==s>-f?(o=f,f=n[++l]):(o=s,s=r[++h]);let d=0;if(lf==s>-f?(a=f+o,u=o-(a-f),f=n[++l]):(a=s+o,u=o-(a-s),s=r[++h]),o=a,0!==u&&(i[d++]=u);lf==s>-f?(a=o+f,c=a-o,u=o-(a-c)+(f-c),f=n[++l]):(a=o+s,c=a-o,u=o-(a-c)+(s-c),s=r[++h]),o=a,0!==u&&(i[d++]=u);for(;l