UNPKG

@fxi/d3-geo-zoom

Version:

Zoom and Pan D3 Geo projections (Ported from vasturiano/d3-geo-zoom)

1 lines 53.8 kB
(function(D,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(D=typeof globalThis<"u"?globalThis:D||self,T(D.d3=D.d3||{}))})(this,function(D){"use strict";var Io=Object.defineProperty;var qo=(D,T,tt)=>T in D?Io(D,T,{enumerable:!0,configurable:!0,writable:!0,value:tt}):D[T]=tt;var S=(D,T,tt)=>(qo(D,typeof T!="symbol"?T+"":T,tt),tt);function T(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function tt(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function lt(){}var ft=.7,wt=1/ft,at="\\s*([+-]?\\d+)\\s*",ht="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",V="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Jn=/^#([0-9a-f]{3,8})$/,jn=new RegExp(`^rgb\\(${at},${at},${at}\\)$`),te=new RegExp(`^rgb\\(${V},${V},${V}\\)$`),ne=new RegExp(`^rgba\\(${at},${at},${at},${ht}\\)$`),ee=new RegExp(`^rgba\\(${V},${V},${V},${ht}\\)$`),re=new RegExp(`^hsl\\(${ht},${V},${V}\\)$`),ie=new RegExp(`^hsla\\(${ht},${V},${V},${ht}\\)$`),ln={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};T(lt,rt,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:fn,formatHex:fn,formatHex8:oe,formatHsl:se,formatRgb:hn,toString:hn});function fn(){return this.rgb().formatHex()}function oe(){return this.rgb().formatHex8()}function se(){return yn(this).formatHsl()}function hn(){return this.rgb().formatRgb()}function rt(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=Jn.exec(t))?(e=n[1].length,n=parseInt(n[1],16),e===6?pn(n):e===3?new z(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):e===8?xt(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):e===4?xt(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=jn.exec(t))?new z(n[1],n[2],n[3],1):(n=te.exec(t))?new z(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=ne.exec(t))?xt(n[1],n[2],n[3],n[4]):(n=ee.exec(t))?xt(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=re.exec(t))?gn(n[1],n[2]/100,n[3]/100,1):(n=ie.exec(t))?gn(n[1],n[2]/100,n[3]/100,n[4]):ln.hasOwnProperty(t)?pn(ln[t]):t==="transparent"?new z(NaN,NaN,NaN,0):null}function pn(t){return new z(t>>16&255,t>>8&255,t&255,1)}function xt(t,n,e,r){return r<=0&&(t=n=e=NaN),new z(t,n,e,r)}function ae(t){return t instanceof lt||(t=rt(t)),t?(t=t.rgb(),new z(t.r,t.g,t.b,t.opacity)):new z}function Vt(t,n,e,r){return arguments.length===1?ae(t):new z(t,n,e,r??1)}function z(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}T(z,Vt,tt(lt,{brighter(t){return t=t==null?wt:Math.pow(wt,t),new z(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ft:Math.pow(ft,t),new z(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new z(it(this.r),it(this.g),it(this.b),bt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:dn,formatHex:dn,formatHex8:ue,formatRgb:mn,toString:mn}));function dn(){return`#${ot(this.r)}${ot(this.g)}${ot(this.b)}`}function ue(){return`#${ot(this.r)}${ot(this.g)}${ot(this.b)}${ot((isNaN(this.opacity)?1:this.opacity)*255)}`}function mn(){const t=bt(this.opacity);return`${t===1?"rgb(":"rgba("}${it(this.r)}, ${it(this.g)}, ${it(this.b)}${t===1?")":`, ${t})`}`}function bt(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function it(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ot(t){return t=it(t),(t<16?"0":"")+t.toString(16)}function gn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new q(t,n,e,r)}function yn(t){if(t instanceof q)return new q(t.h,t.s,t.l,t.opacity);if(t instanceof lt||(t=rt(t)),!t)return new q;if(t instanceof q)return t;t=t.rgb();var n=t.r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),s=NaN,a=o-i,u=(o+i)/2;return a?(n===o?s=(e-r)/a+(e<r)*6:e===o?s=(r-n)/a+2:s=(n-e)/a+4,a/=u<.5?o+i:2-o-i,s*=60):a=u>0&&u<1?0:s,new q(s,a,u,t.opacity)}function ce(t,n,e,r){return arguments.length===1?yn(t):new q(t,n,e,r??1)}function q(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}T(q,ce,tt(lt,{brighter(t){return t=t==null?wt:Math.pow(wt,t),new q(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ft:Math.pow(ft,t),new q(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,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 z(Yt(t>=240?t-240:t+120,i,r),Yt(t,i,r),Yt(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new q(_n(this.h),Mt(this.s),Mt(this.l),bt(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=bt(this.opacity);return`${t===1?"hsl(":"hsla("}${_n(this.h)}, ${Mt(this.s)*100}%, ${Mt(this.l)*100}%${t===1?")":`, ${t})`}`}}));function _n(t){return t=(t||0)%360,t<0?t+360:t}function Mt(t){return Math.max(0,Math.min(1,t||0))}function Yt(t,n,e){return(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)*255}const Lt=t=>()=>t;function le(t,n){return function(e){return t+e*n}}function fe(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)}}function he(t){return(t=+t)==1?vn:function(n,e){return e-n?fe(n,e,t):Lt(isNaN(n)?e:n)}}function vn(t,n){var e=n-t;return e?le(t,e):Lt(isNaN(t)?n:t)}const At=function t(n){var e=he(n);function r(i,o){var s=e((i=Vt(i)).r,(o=Vt(o)).r),a=e(i.g,o.g),u=e(i.b,o.b),c=vn(i.opacity,o.opacity);return function(l){return i.r=s(l),i.g=a(l),i.b=u(l),i.opacity=c(l),i+""}}return r.gamma=t,r}(1);function pe(t,n){n||(n=[]);var e=t?Math.min(n.length,t.length):0,r=n.slice(),i;return function(o){for(i=0;i<e;++i)r[i]=t[i]*(1-o)+n[i]*o;return r}}function de(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function me(t,n){var e=n?n.length:0,r=t?Math.min(e,t.length):0,i=new Array(r),o=new Array(e),s;for(s=0;s<r;++s)i[s]=pt(t[s],n[s]);for(;s<e;++s)o[s]=n[s];return function(a){for(s=0;s<r;++s)o[s]=i[s](a);return o}}function ge(t,n){var e=new Date;return t=+t,n=+n,function(r){return e.setTime(t*(1-r)+n*r),e}}function Y(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}function ye(t,n){var e={},r={},i;(t===null||typeof t!="object")&&(t={}),(n===null||typeof n!="object")&&(n={});for(i in n)i in t?e[i]=pt(t[i],n[i]):r[i]=n[i];return function(o){for(i in e)r[i]=e[i](o);return r}}var Bt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Gt=new RegExp(Bt.source,"g");function _e(t){return function(){return t}}function ve(t){return function(n){return t(n)+""}}function wn(t,n){var e=Bt.lastIndex=Gt.lastIndex=0,r,i,o,s=-1,a=[],u=[];for(t=t+"",n=n+"";(r=Bt.exec(t))&&(i=Gt.exec(n));)(o=i.index)>e&&(o=n.slice(e,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,u.push({i:s,x:Y(r,i)})),e=Gt.lastIndex;return e<n.length&&(o=n.slice(e),a[s]?a[s]+=o:a[++s]=o),a.length<2?u[0]?ve(u[0].x):_e(n):(n=u.length,function(c){for(var l=0,p;l<n;++l)a[(p=u[l]).i]=p.x(c);return a.join("")})}function pt(t,n){var e=typeof n,r;return n==null||e==="boolean"?Lt(n):(e==="number"?Y:e==="string"?(r=rt(n))?(n=r,At):wn:n instanceof rt?At:n instanceof Date?ge:de(n)?pe:Array.isArray(n)?me:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?ye:Y)(t,n)}var xn=180/Math.PI,Ut={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function bn(t,n,e,r,i,o){var s,a,u;return(s=Math.sqrt(t*t+n*n))&&(t/=s,n/=s),(u=t*e+n*r)&&(e-=t*u,r-=n*u),(a=Math.sqrt(e*e+r*r))&&(e/=a,r/=a,u/=a),t*r<n*e&&(t=-t,n=-n,u=-u,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*xn,skewX:Math.atan(u)*xn,scaleX:s,scaleY:a}}var Et;function we(t){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return n.isIdentity?Ut:bn(n.a,n.b,n.c,n.d,n.e,n.f)}function xe(t){return t==null||(Et||(Et=document.createElementNS("http://www.w3.org/2000/svg","g")),Et.setAttribute("transform",t),!(t=Et.transform.baseVal.consolidate()))?Ut:(t=t.matrix,bn(t.a,t.b,t.c,t.d,t.e,t.f))}function Mn(t,n,e,r){function i(c){return c.length?c.pop()+" ":""}function o(c,l,p,d,m,w){if(c!==p||l!==d){var M=m.push("translate(",null,n,null,e);w.push({i:M-4,x:Y(c,p)},{i:M-2,x:Y(l,d)})}else(p||d)&&m.push("translate("+p+n+d+e)}function s(c,l,p,d){c!==l?(c-l>180?l+=360:l-c>180&&(c+=360),d.push({i:p.push(i(p)+"rotate(",null,r)-2,x:Y(c,l)})):l&&p.push(i(p)+"rotate("+l+r)}function a(c,l,p,d){c!==l?d.push({i:p.push(i(p)+"skewX(",null,r)-2,x:Y(c,l)}):l&&p.push(i(p)+"skewX("+l+r)}function u(c,l,p,d,m,w){if(c!==p||l!==d){var M=m.push(i(m)+"scale(",null,",",null,")");w.push({i:M-4,x:Y(c,p)},{i:M-2,x:Y(l,d)})}else(p!==1||d!==1)&&m.push(i(m)+"scale("+p+","+d+")")}return function(c,l){var p=[],d=[];return c=t(c),l=t(l),o(c.translateX,c.translateY,l.translateX,l.translateY,p,d),s(c.rotate,l.rotate,p,d),a(c.skewX,l.skewX,p,d),u(c.scaleX,c.scaleY,l.scaleX,l.scaleY,p,d),c=l=null,function(m){for(var w=-1,M=d.length,N;++w<M;)p[(N=d[w]).i]=N.x(m);return p.join("")}}}var be=Mn(we,"px, ","px)","deg)"),Me=Mn(xe,", ",")",")"),Ae=1e-12;function An(t){return((t=Math.exp(t))+1/t)/2}function Ee(t){return((t=Math.exp(t))-1/t)/2}function Ne(t){return((t=Math.exp(2*t))-1)/(t+1)}const ke=function t(n,e,r){function i(o,s){var a=o[0],u=o[1],c=o[2],l=s[0],p=s[1],d=s[2],m=l-a,w=p-u,M=m*m+w*w,N,_;if(M<Ae)_=Math.log(d/c)/n,N=function(et){return[a+et*m,u+et*w,c*Math.exp(n*et*_)]};else{var $=Math.sqrt(M),C=(d*d-c*c+r*M)/(2*c*e*$),U=(d*d-c*c-r*M)/(2*d*e*$),O=Math.log(Math.sqrt(C*C+1)-C),X=Math.log(Math.sqrt(U*U+1)-U);_=(X-O)/n,N=function(et){var Xt=et*_,Ft=An(O),Ht=c/(e*$)*(Ft*Ne(n*Xt+O)-Ee(O));return[a+Ht*m,u+Ht*w,c*Ft/An(n*Xt+O)]}}return N.duration=_*1e3*n/Math.SQRT2,N}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s,u=a*a;return t(s,a,u)},i}(Math.SQRT2,2,4);var Zt="http://www.w3.org/1999/xhtml";const En={svg:"http://www.w3.org/2000/svg",xhtml:Zt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Nt(t){var n=t+="",e=n.indexOf(":");return e>=0&&(n=t.slice(0,e))!=="xmlns"&&(t=t.slice(e+1)),En.hasOwnProperty(n)?{space:En[n],local:t}:t}function Se(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===Zt&&n.documentElement.namespaceURI===Zt?n.createElement(t):n.createElementNS(e,t)}}function Te(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Nn(t){var n=Nt(t);return(n.local?Te:Se)(n)}function ze(){}function Kt(t){return t==null?ze:function(){return this.querySelector(t)}}function $e(t){typeof t!="function"&&(t=Kt(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o=n[i],s=o.length,a=r[i]=new Array(s),u,c,l=0;l<s;++l)(u=o[l])&&(c=t.call(u,u.__data__,l,o))&&("__data__"in u&&(c.__data__=u.__data__),a[l]=c);return new R(r,this._parents)}function Ce(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function De(){return[]}function kn(t){return t==null?De:function(){return this.querySelectorAll(t)}}function Re(t){return function(){return Ce(t.apply(this,arguments))}}function Ie(t){typeof t=="function"?t=Re(t):t=kn(t);for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var s=n[o],a=s.length,u,c=0;c<a;++c)(u=s[c])&&(r.push(t.call(u,u.__data__,c,s)),i.push(u));return new R(r,i)}function Sn(t){return function(){return this.matches(t)}}function Tn(t){return function(n){return n.matches(t)}}var qe=Array.prototype.find;function Pe(t){return function(){return qe.call(this.children,t)}}function Oe(){return this.firstElementChild}function Xe(t){return this.select(t==null?Oe:Pe(typeof t=="function"?t:Tn(t)))}var Fe=Array.prototype.filter;function He(){return Array.from(this.children)}function Ve(t){return function(){return Fe.call(this.children,t)}}function Ye(t){return this.selectAll(t==null?He:Ve(typeof t=="function"?t:Tn(t)))}function Le(t){typeof t!="function"&&(t=Sn(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o=n[i],s=o.length,a=r[i]=[],u,c=0;c<s;++c)(u=o[c])&&t.call(u,u.__data__,c,o)&&a.push(u);return new R(r,this._parents)}function zn(t){return new Array(t.length)}function Be(){return new R(this._enter||this._groups.map(zn),this._parents)}function kt(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}kt.prototype={constructor:kt,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)}};function Ge(t){return function(){return t}}function Ue(t,n,e,r,i,o){for(var s=0,a,u=n.length,c=o.length;s<c;++s)(a=n[s])?(a.__data__=o[s],r[s]=a):e[s]=new kt(t,o[s]);for(;s<u;++s)(a=n[s])&&(i[s]=a)}function Ze(t,n,e,r,i,o,s){var a,u,c=new Map,l=n.length,p=o.length,d=new Array(l),m;for(a=0;a<l;++a)(u=n[a])&&(d[a]=m=s.call(u,u.__data__,a,n)+"",c.has(m)?i[a]=u:c.set(m,u));for(a=0;a<p;++a)m=s.call(t,o[a],a,o)+"",(u=c.get(m))?(r[a]=u,u.__data__=o[a],c.delete(m)):e[a]=new kt(t,o[a]);for(a=0;a<l;++a)(u=n[a])&&c.get(d[a])===u&&(i[a]=u)}function Ke(t){return t.__data__}function We(t,n){if(!arguments.length)return Array.from(this,Ke);var e=n?Ze:Ue,r=this._parents,i=this._groups;typeof t!="function"&&(t=Ge(t));for(var o=i.length,s=new Array(o),a=new Array(o),u=new Array(o),c=0;c<o;++c){var l=r[c],p=i[c],d=p.length,m=Qe(t.call(l,l&&l.__data__,c,r)),w=m.length,M=a[c]=new Array(w),N=s[c]=new Array(w),_=u[c]=new Array(d);e(l,p,M,N,_,m,n);for(var $=0,C=0,U,O;$<w;++$)if(U=M[$]){for($>=C&&(C=$+1);!(O=N[C])&&++C<w;);U._next=O||null}}return s=new R(s,r),s._enter=a,s._exit=u,s}function Qe(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Je(){return new R(this._exit||this._groups.map(zn),this._parents)}function je(t,n,e){var r=this.enter(),i=this,o=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),n!=null&&(i=n(i),i&&(i=i.selection())),e==null?o.remove():e(o),r&&i?r.merge(i).order():i}function tr(t){for(var n=t.selection?t.selection():t,e=this._groups,r=n._groups,i=e.length,o=r.length,s=Math.min(i,o),a=new Array(i),u=0;u<s;++u)for(var c=e[u],l=r[u],p=c.length,d=a[u]=new Array(p),m,w=0;w<p;++w)(m=c[w]||l[w])&&(d[w]=m);for(;u<i;++u)a[u]=e[u];return new R(a,this._parents)}function nr(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r=t[n],i=r.length-1,o=r[i],s;--i>=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function er(t){t||(t=rr);function n(p,d){return p&&d?t(p.__data__,d.__data__):!p-!d}for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var s=e[o],a=s.length,u=i[o]=new Array(a),c,l=0;l<a;++l)(c=s[l])&&(u[l]=c);u.sort(n)}return new R(i,this._parents).order()}function rr(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function ir(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function or(){return Array.from(this)}function sr(){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 s=r[i];if(s)return s}return null}function ar(){let t=0;for(const n of this)++t;return t}function ur(){return!this.node()}function cr(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i=n[e],o=0,s=i.length,a;o<s;++o)(a=i[o])&&t.call(a,a.__data__,o,i);return this}function lr(t){return function(){this.removeAttribute(t)}}function fr(t){return function(){this.removeAttributeNS(t.space,t.local)}}function hr(t,n){return function(){this.setAttribute(t,n)}}function pr(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function dr(t,n){return function(){var e=n.apply(this,arguments);e==null?this.removeAttribute(t):this.setAttribute(t,e)}}function mr(t,n){return function(){var e=n.apply(this,arguments);e==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function gr(t,n){var e=Nt(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((n==null?e.local?fr:lr:typeof n=="function"?e.local?mr:dr:e.local?pr:hr)(e,n))}function $n(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function yr(t){return function(){this.style.removeProperty(t)}}function _r(t,n,e){return function(){this.style.setProperty(t,n,e)}}function vr(t,n,e){return function(){var r=n.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function wr(t,n,e){return arguments.length>1?this.each((n==null?yr:typeof n=="function"?vr:_r)(t,n,e??"")):ut(this.node(),t)}function ut(t,n){return t.style.getPropertyValue(n)||$n(t).getComputedStyle(t,null).getPropertyValue(n)}function xr(t){return function(){delete this[t]}}function br(t,n){return function(){this[t]=n}}function Mr(t,n){return function(){var e=n.apply(this,arguments);e==null?delete this[t]:this[t]=e}}function Ar(t,n){return arguments.length>1?this.each((n==null?xr:typeof n=="function"?Mr:br)(t,n)):this.node()[t]}function Cn(t){return t.trim().split(/^|\s+/)}function Wt(t){return t.classList||new Dn(t)}function Dn(t){this._node=t,this._names=Cn(t.getAttribute("class")||"")}Dn.prototype={add:function(t){var n=this._names.indexOf(t);n<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}};function Rn(t,n){for(var e=Wt(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function In(t,n){for(var e=Wt(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function Er(t){return function(){Rn(this,t)}}function Nr(t){return function(){In(this,t)}}function kr(t,n){return function(){(n.apply(this,arguments)?Rn:In)(this,t)}}function Sr(t,n){var e=Cn(t+"");if(arguments.length<2){for(var r=Wt(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each((typeof n=="function"?kr:n?Er:Nr)(e,n))}function Tr(){this.textContent=""}function zr(t){return function(){this.textContent=t}}function $r(t){return function(){var n=t.apply(this,arguments);this.textContent=n??""}}function Cr(t){return arguments.length?this.each(t==null?Tr:(typeof t=="function"?$r:zr)(t)):this.node().textContent}function Dr(){this.innerHTML=""}function Rr(t){return function(){this.innerHTML=t}}function Ir(t){return function(){var n=t.apply(this,arguments);this.innerHTML=n??""}}function qr(t){return arguments.length?this.each(t==null?Dr:(typeof t=="function"?Ir:Rr)(t)):this.node().innerHTML}function Pr(){this.nextSibling&&this.parentNode.appendChild(this)}function Or(){return this.each(Pr)}function Xr(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Fr(){return this.each(Xr)}function Hr(t){var n=typeof t=="function"?t:Nn(t);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function Vr(){return null}function Yr(t,n){var e=typeof t=="function"?t:Nn(t),r=n==null?Vr:typeof n=="function"?n:Kt(n);return this.select(function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)})}function Lr(){var t=this.parentNode;t&&t.removeChild(this)}function Br(){return this.each(Lr)}function Gr(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function Ur(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function Zr(t){return this.select(t?Ur:Gr)}function Kr(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Wr(t){return function(n){t.call(this,n,this.__data__)}}function Qr(t){return t.trim().split(/^|\s+/).map(function(n){var e="",r=n.indexOf(".");return r>=0&&(e=n.slice(r+1),n=n.slice(0,r)),{type:n,name:e}})}function Jr(t){return function(){var n=this.__on;if(n){for(var e=0,r=-1,i=n.length,o;e<i;++e)o=n[e],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):n[++r]=o;++r?n.length=r:delete this.__on}}}function jr(t,n,e){return function(){var r=this.__on,i,o=Wr(n);if(r){for(var s=0,a=r.length;s<a;++s)if((i=r[s]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=e),i.value=n;return}}this.addEventListener(t.type,o,e),i={type:t.type,name:t.name,value:n,listener:o,options:e},r?r.push(i):this.__on=[i]}}function ti(t,n,e){var r=Qr(t+""),i,o=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var u=0,c=a.length,l;u<c;++u)for(i=0,l=a[u];i<o;++i)if((s=r[i]).type===l.type&&s.name===l.name)return l.value}return}for(a=n?jr:Jr,i=0;i<o;++i)this.each(a(r[i],n,e));return this}function qn(t,n,e){var r=$n(t),i=r.CustomEvent;typeof i=="function"?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)}function ni(t,n){return function(){return qn(this,t,n)}}function ei(t,n){return function(){return qn(this,t,n.apply(this,arguments))}}function ri(t,n){return this.each((typeof n=="function"?ei:ni)(t,n))}function*ii(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length,s;i<o;++i)(s=r[i])&&(yield s)}var Pn=[null];function R(t,n){this._groups=t,this._parents=n}function dt(){return new R([[document.documentElement]],Pn)}function oi(){return this}R.prototype=dt.prototype={constructor:R,select:$e,selectAll:Ie,selectChild:Xe,selectChildren:Ye,filter:Le,data:We,enter:Be,exit:Je,join:je,merge:tr,selection:oi,order:nr,sort:er,call:ir,nodes:or,node:sr,size:ar,empty:ur,each:cr,attr:gr,style:wr,property:Ar,classed:Sr,text:Cr,html:qr,raise:Or,lower:Fr,append:Hr,insert:Yr,remove:Br,clone:Zr,datum:Kr,on:ti,dispatch:ri,[Symbol.iterator]:ii};function L(t){return typeof t=="string"?new R([[document.querySelector(t)]],[document.documentElement]):new R([[t]],Pn)}function On(t){let n;for(;n=t.sourceEvent;)t=n;return t}function nt(t,n){if(t=On(t),n===void 0&&(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()),[r.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 si(t,n){return t.target&&(t=On(t),n===void 0&&(n=t.currentTarget),t=t.touches||[t]),Array.from(t,e=>nt(e,n))}var ai={value:()=>{}};function Qt(){for(var t=0,n=arguments.length,e={},r;t<n;++t){if(!(r=arguments[t]+"")||r in e||/[\s.]/.test(r))throw new Error("illegal type: "+r);e[r]=[]}return new St(e)}function St(t){this._=t}function ui(t,n){return t.trim().split(/^|\s+/).map(function(e){var r="",i=e.indexOf(".");if(i>=0&&(r=e.slice(i+1),e=e.slice(0,i)),e&&!n.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:r}})}St.prototype=Qt.prototype={constructor:St,on:function(t,n){var e=this._,r=ui(t+"",e),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(t=r[o]).type)&&(i=ci(e[i],t.name)))return i;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++o<s;)if(i=(t=r[o]).type)e[i]=Xn(e[i],t.name,n);else if(n==null)for(i in e)e[i]=Xn(e[i],t.name,null);return this},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new St(t)},call:function(t,n){if((i=arguments.length-2)>0)for(var e=new Array(i),r=0,i,o;r<i;++r)e[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(n,e)},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)}};function ci(t,n){for(var e=0,r=t.length,i;e<r;++e)if((i=t[e]).name===n)return i.value}function Xn(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=ai,t=t.slice(0,r).concat(t.slice(r+1));break}return e!=null&&t.push({name:n,value:e}),t}const Jt={capture:!0,passive:!1};function jt(t){t.preventDefault(),t.stopImmediatePropagation()}function li(t){var n=t.document.documentElement,e=L(t).on("dragstart.drag",jt,Jt);"onselectstart"in n?e.on("selectstart.drag",jt,Jt):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function fi(t,n){var e=t.document.documentElement,r=L(t).on("dragstart.drag",null);n&&(r.on("click.drag",jt,Jt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}var ct=0,mt=0,gt=0,Fn=1e3,Tt,yt,zt=0,st=0,$t=0,_t=typeof performance=="object"&&performance.now?performance:Date,Hn=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function tn(){return st||(Hn(hi),st=_t.now()+$t)}function hi(){st=0}function Ct(){this._call=this._time=this._next=null}Ct.prototype=Vn.prototype={constructor:Ct,restart:function(t,n,e){if(typeof t!="function")throw new TypeError("callback is not a function");e=(e==null?tn():+e)+(n==null?0:+n),!this._next&&yt!==this&&(yt?yt._next=this:Tt=this,yt=this),this._call=t,this._time=e,nn()},stop:function(){this._call&&(this._call=null,this._time=1/0,nn())}};function Vn(t,n,e){var r=new Ct;return r.restart(t,n,e),r}function pi(){tn(),++ct;for(var t=Tt,n;t;)(n=st-t._time)>=0&&t._call.call(void 0,n),t=t._next;--ct}function Yn(){st=(zt=_t.now())+$t,ct=mt=0;try{pi()}finally{ct=0,mi(),st=0}}function di(){var t=_t.now(),n=t-zt;n>Fn&&($t-=n,zt=t)}function mi(){for(var t,n=Tt,e,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Tt=e);yt=t,nn(r)}function nn(t){if(!ct){mt&&(mt=clearTimeout(mt));var n=t-st;n>24?(t<1/0&&(mt=setTimeout(Yn,t-_t.now()-$t)),gt&&(gt=clearInterval(gt))):(gt||(zt=_t.now(),gt=setInterval(di,Fn)),ct=1,Hn(Yn))}}function Ln(t,n,e){var r=new Ct;return n=n==null?0:+n,r.restart(i=>{r.stop(),t(i+n)},n,e),r}var gi=Qt("start","end","cancel","interrupt"),yi=[],Bn=0,Gn=1,en=2,Dt=3,Un=4,rn=5,Rt=6;function It(t,n,e,r,i,o){var s=t.__transition;if(!s)t.__transition={};else if(e in s)return;_i(t,e,{name:n,index:r,group:i,on:gi,tween:yi,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Bn})}function on(t,n){var e=P(t,n);if(e.state>Bn)throw new Error("too late; already scheduled");return e}function B(t,n){var e=P(t,n);if(e.state>Dt)throw new Error("too late; already running");return e}function P(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function _i(t,n,e){var r=t.__transition,i;r[n]=e,e.timer=Vn(o,0,e.time);function o(c){e.state=Gn,e.timer.restart(s,e.delay,e.time),e.delay<=c&&s(c-e.delay)}function s(c){var l,p,d,m;if(e.state!==Gn)return u();for(l in r)if(m=r[l],m.name===e.name){if(m.state===Dt)return Ln(s);m.state===Un?(m.state=Rt,m.timer.stop(),m.on.call("interrupt",t,t.__data__,m.index,m.group),delete r[l]):+l<n&&(m.state=Rt,m.timer.stop(),m.on.call("cancel",t,t.__data__,m.index,m.group),delete r[l])}if(Ln(function(){e.state===Dt&&(e.state=Un,e.timer.restart(a,e.delay,e.time),a(c))}),e.state=en,e.on.call("start",t,t.__data__,e.index,e.group),e.state===en){for(e.state=Dt,i=new Array(d=e.tween.length),l=0,p=-1;l<d;++l)(m=e.tween[l].value.call(t,t.__data__,e.index,e.group))&&(i[++p]=m);i.length=p+1}}function a(c){for(var l=c<e.duration?e.ease.call(null,c/e.duration):(e.timer.restart(u),e.state=rn,1),p=-1,d=i.length;++p<d;)i[p].call(t,l);e.state===rn&&(e.on.call("end",t,t.__data__,e.index,e.group),u())}function u(){e.state=Rt,e.timer.stop(),delete r[n];for(var c in r)return;delete t.__transition}}function qt(t,n){var e=t.__transition,r,i,o=!0,s;if(e){n=n==null?null:n+"";for(s in e){if((r=e[s]).name!==n){o=!1;continue}i=r.state>en&&r.state<rn,r.state=Rt,r.timer.stop(),r.on.call(i?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete e[s]}o&&delete t.__transition}}function vi(t){return this.each(function(){qt(this,t)})}function wi(t,n){var e,r;return function(){var i=B(this,t),o=i.tween;if(o!==e){r=e=o;for(var s=0,a=r.length;s<a;++s)if(r[s].name===n){r=r.slice(),r.splice(s,1);break}}i.tween=r}}function xi(t,n,e){var r,i;if(typeof e!="function")throw new Error;return function(){var o=B(this,t),s=o.tween;if(s!==r){i=(r=s).slice();for(var a={name:n,value:e},u=0,c=i.length;u<c;++u)if(i[u].name===n){i[u]=a;break}u===c&&i.push(a)}o.tween=i}}function bi(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r=P(this.node(),e).tween,i=0,o=r.length,s;i<o;++i)if((s=r[i]).name===t)return s.value;return null}return this.each((n==null?wi:xi)(e,t,n))}function sn(t,n,e){var r=t._id;return t.each(function(){var i=B(this,r);(i.value||(i.value={}))[n]=e.apply(this,arguments)}),function(i){return P(i,r).value[n]}}function Zn(t,n){var e;return(typeof n=="number"?Y:n instanceof rt?At:(e=rt(n))?(n=e,At):wn)(t,n)}function Mi(t){return function(){this.removeAttribute(t)}}function Ai(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Ei(t,n,e){var r,i=e+"",o;return function(){var s=this.getAttribute(t);return s===i?null:s===r?o:o=n(r=s,e)}}function Ni(t,n,e){var r,i=e+"",o;return function(){var s=this.getAttributeNS(t.space,t.local);return s===i?null:s===r?o:o=n(r=s,e)}}function ki(t,n,e){var r,i,o;return function(){var s,a=e(this),u;return a==null?void this.removeAttribute(t):(s=this.getAttribute(t),u=a+"",s===u?null:s===r&&u===i?o:(i=u,o=n(r=s,a)))}}function Si(t,n,e){var r,i,o;return function(){var s,a=e(this),u;return a==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),u=a+"",s===u?null:s===r&&u===i?o:(i=u,o=n(r=s,a)))}}function Ti(t,n){var e=Nt(t),r=e==="transform"?Me:Zn;return this.attrTween(t,typeof n=="function"?(e.local?Si:ki)(e,r,sn(this,"attr."+t,n)):n==null?(e.local?Ai:Mi)(e):(e.local?Ni:Ei)(e,r,n))}function zi(t,n){return function(e){this.setAttribute(t,n.call(this,e))}}function $i(t,n){return function(e){this.setAttributeNS(t.space,t.local,n.call(this,e))}}function Ci(t,n){var e,r;function i(){var o=n.apply(this,arguments);return o!==r&&(e=(r=o)&&$i(t,o)),e}return i._value=n,i}function Di(t,n){var e,r;function i(){var o=n.apply(this,arguments);return o!==r&&(e=(r=o)&&zi(t,o)),e}return i._value=n,i}function Ri(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(n==null)return this.tween(e,null);if(typeof n!="function")throw new Error;var r=Nt(t);return this.tween(e,(r.local?Ci:Di)(r,n))}function Ii(t,n){return function(){on(this,t).delay=+n.apply(this,arguments)}}function qi(t,n){return n=+n,function(){on(this,t).delay=n}}function Pi(t){var n=this._id;return arguments.length?this.each((typeof t=="function"?Ii:qi)(n,t)):P(this.node(),n).delay}function Oi(t,n){return function(){B(this,t).duration=+n.apply(this,arguments)}}function Xi(t,n){return n=+n,function(){B(this,t).duration=n}}function Fi(t){var n=this._id;return arguments.length?this.each((typeof t=="function"?Oi:Xi)(n,t)):P(this.node(),n).duration}function Hi(t,n){if(typeof n!="function")throw new Error;return function(){B(this,t).ease=n}}function Vi(t){var n=this._id;return arguments.length?this.each(Hi(n,t)):P(this.node(),n).ease}function Yi(t,n){return function(){var e=n.apply(this,arguments);if(typeof e!="function")throw new Error;B(this,t).ease=e}}function Li(t){if(typeof t!="function")throw new Error;return this.each(Yi(this._id,t))}function Bi(t){typeof t!="function"&&(t=Sn(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o=n[i],s=o.length,a=r[i]=[],u,c=0;c<s;++c)(u=o[c])&&t.call(u,u.__data__,c,o)&&a.push(u);return new K(r,this._parents,this._name,this._id)}function Gi(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),s=new Array(r),a=0;a<o;++a)for(var u=n[a],c=e[a],l=u.length,p=s[a]=new Array(l),d,m=0;m<l;++m)(d=u[m]||c[m])&&(p[m]=d);for(;a<r;++a)s[a]=n[a];return new K(s,this._parents,this._name,this._id)}function Ui(t){return(t+"").trim().split(/^|\s+/).every(function(n){var e=n.indexOf(".");return e>=0&&(n=n.slice(0,e)),!n||n==="start"})}function Zi(t,n,e){var r,i,o=Ui(n)?on:B;return function(){var s=o(this,t),a=s.on;a!==r&&(i=(r=a).copy()).on(n,e),s.on=i}}function Ki(t,n){var e=this._id;return arguments.length<2?P(this.node(),e).on.on(t):this.each(Zi(e,t,n))}function Wi(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}function Qi(){return this.on("end.remove",Wi(this._id))}function Ji(t){var n=this._name,e=this._id;typeof t!="function"&&(t=Kt(t));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var a=r[s],u=a.length,c=o[s]=new Array(u),l,p,d=0;d<u;++d)(l=a[d])&&(p=t.call(l,l.__data__,d,a))&&("__data__"in l&&(p.__data__=l.__data__),c[d]=p,It(c[d],n,e,d,c,P(l,e)));return new K(o,this._parents,n,e)}function ji(t){var n=this._name,e=this._id;typeof t!="function"&&(t=kn(t));for(var r=this._groups,i=r.length,o=[],s=[],a=0;a<i;++a)for(var u=r[a],c=u.length,l,p=0;p<c;++p)if(l=u[p]){for(var d=t.call(l,l.__data__,p,u),m,w=P(l,e),M=0,N=d.length;M<N;++M)(m=d[M])&&It(m,n,e,M,d,w);o.push(d),s.push(l)}return new K(o,s,n,e)}var to=dt.prototype.constructor;function no(){return new to(this._groups,this._parents)}function eo(t,n){var e,r,i;return function(){var o=ut(this,t),s=(this.style.removeProperty(t),ut(this,t));return o===s?null:o===e&&s===r?i:i=n(e=o,r=s)}}function Kn(t){return function(){this.style.removeProperty(t)}}function ro(t,n,e){var r,i=e+"",o;return function(){var s=ut(this,t);return s===i?null:s===r?o:o=n(r=s,e)}}function io(t,n,e){var r,i,o;return function(){var s=ut(this,t),a=e(this),u=a+"";return a==null&&(u=a=(this.style.removeProperty(t),ut(this,t))),s===u?null:s===r&&u===i?o:(i=u,o=n(r=s,a))}}function oo(t,n){var e,r,i,o="style."+n,s="end."+o,a;return function(){var u=B(this,t),c=u.on,l=u.value[o]==null?a||(a=Kn(n)):void 0;(c!==e||i!==l)&&(r=(e=c).copy()).on(s,i=l),u.on=r}}function so(t,n,e){var r=(t+="")=="transform"?be:Zn;return n==null?this.styleTween(t,eo(t,r)).on("end.style."+t,Kn(t)):typeof n=="function"?this.styleTween(t,io(t,r,sn(this,"style."+t,n))).each(oo(this._id,t)):this.styleTween(t,ro(t,r,n),e).on("end.style."+t,null)}function ao(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}function uo(t,n,e){var r,i;function o(){var s=n.apply(this,arguments);return s!==i&&(r=(i=s)&&ao(t,s,e)),r}return o._value=n,o}function co(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;return this.tween(r,uo(t,n,e??""))}function lo(t){return function(){this.textContent=t}}function fo(t){return function(){var n=t(this);this.textContent=n??""}}function ho(t){return this.tween("text",typeof t=="function"?fo(sn(this,"text",t)):lo(t==null?"":t+""))}function po(t){return function(n){this.textContent=t.call(this,n)}}function mo(t){var n,e;function r(){var i=t.apply(this,arguments);return i!==e&&(n=(e=i)&&po(i)),n}return r._value=t,r}function go(t){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;return this.tween(n,mo(t))}function yo(){for(var t=this._name,n=this._id,e=Wn(),r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,u,c=0;c<a;++c)if(u=s[c]){var l=P(u,n);It(u,t,e,c,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new K(r,this._parents,t,e)}function _o(){var t,n,e=this,r=e._id,i=e.size();return new Promise(function(o,s){var a={value:s},u={value:function(){--i===0&&o()}};e.each(function(){var c=B(this,r),l=c.on;l!==t&&(n=(t=l).copy(),n._.cancel.push(a),n._.interrupt.push(a),n._.end.push(u)),c.on=n}),i===0&&o()})}var vo=0;function K(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function Wn(){return++vo}var W=dt.prototype;K.prototype={constructor:K,select:Ji,selectAll:ji,selectChild:W.selectChild,selectChildren:W.selectChildren,filter:Bi,merge:Gi,selection:no,transition:yo,call:W.call,nodes:W.nodes,node:W.node,size:W.size,empty:W.empty,each:W.each,on:Ki,attr:Ti,attrTween:Ri,style:so,styleTween:co,text:ho,textTween:go,remove:Qi,tween:bi,delay:Pi,duration:Fi,ease:Vi,easeVarying:Li,end:_o,[Symbol.iterator]:W[Symbol.iterator]};function an(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var wo={time:null,delay:0,duration:250,ease:an};function xo(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))throw new Error(`transition ${n} not found`);return e}function bo(t){var n,e;t instanceof K?(n=t._id,t=t._name):(n=Wn(),(e=wo).time=tn(),t=t==null?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,u,c=0;c<a;++c)(u=s[c])&&It(u,t,n,c,s,e||xo(u,n));return new K(r,this._parents,t,n)}dt.prototype.interrupt=vi,dt.prototype.transition=bo;const Pt=t=>()=>t;function Mo(t,{sourceEvent:n,target:e,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:e,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Q(t,n,e){this.k=t,this.x=n,this.y=e}Q.prototype={constructor:Q,scale:function(t){return t===1?this:new Q(this.k*t,this.x,this.y)},translate:function(t,n){return t===0&n===0?this:new Q(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ot=new Q(1,0,0);Q.prototype;function un(t){t.stopImmediatePropagation()}function vt(t){t.preventDefault(),t.stopImmediatePropagation()}function Ao(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Eo(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Qn(){return this.__zoom||Ot}function No(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function ko(){return navigator.maxTouchPoints||"ontouchstart"in this}function So(t,n,e){var r=t.invertX(n[0][0])-e[0][0],i=t.invertX(n[1][0])-e[1][0],o=t.invertY(n[0][1])-e[0][1],s=t.invertY(n[1][1])-e[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function To(){var t=Ao,n=Eo,e=So,r=No,i=ko,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,u=ke,c=Qt("start","zoom","end"),l,p,d,m=500,w=150,M=0,N=10;function _(f){f.property("__zoom",Qn).on("wheel.zoom",Xt,{passive:!1}).on("mousedown.zoom",Ft).on("dblclick.zoom",Ht).filter(i).on("touchstart.zoom",Co).on("touchmove.zoom",Do).on("touchend.zoom touchcancel.zoom",Ro).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(f,g,h,y){var v=f.selection?f.selection():f;v.property("__zoom",Qn),f!==v?O(f,g,h,y):v.interrupt().each(function(){X(this,arguments).event(y).start().zoom(null,typeof g=="function"?g.apply(this,arguments):g).end()})},_.scaleBy=function(f,g,h,y){_.scaleTo(f,function(){var v=this.__zoom.k,x=typeof g=="function"?g.apply(this,arguments):g;return v*x},h,y)},_.scaleTo=function(f,g,h,y){_.transform(f,function(){var v=n.apply(this,arguments),x=this.__zoom,b=h==null?U(v):typeof h=="function"?h.apply(this,arguments):h,A=x.invert(b),E=typeof g=="function"?g.apply(this,arguments):g;return e(C($(x,E),b,A),v,s)},h,y)},_.translateBy=function(f,g,h,y){_.transform(f,function(){return e(this.__zoom.translate(typeof g=="function"?g.apply(this,arguments):g,typeof h=="function"?h.apply(this,arguments):h),n.apply(this,arguments),s)},null,y)},_.translateTo=function(f,g,h,y,v){_.transform(f,function(){var x=n.apply(this,arguments),b=this.__zoom,A=y==null?U(x):typeof y=="function"?y.apply(this,arguments):y;return e(Ot.translate(A[0],A[1]).scale(b.k).translate(typeof g=="function"?-g.apply(this,arguments):-g,typeof h=="function"?-h.apply(this,arguments):-h),x,s)},y,v)};function $(f,g){return g=Math.max(o[0],Math.min(o[1],g)),g===f.k?f:new Q(g,f.x,f.y)}function C(f,g,h){var y=g[0]-h[0]*f.k,v=g[1]-h[1]*f.k;return y===f.x&&v===f.y?f:new Q(f.k,y,v)}function U(f){return[(+f[0][0]+ +f[1][0])/2,(+f[0][1]+ +f[1][1])/2]}function O(f,g,h,y){f.on("start.zoom",function(){X(this,arguments).event(y).start()}).on("interrupt.zoom end.zoom",function(){X(this,arguments).event(y).end()}).tween("zoom",function(){var v=this,x=arguments,b=X(v,x).event(y),A=n.apply(v,x),E=h==null?U(A):typeof h=="function"?h.apply(v,x):h,Z=Math.max(A[1][0]-A[0][0],A[1][1]-A[0][1]),k=v.__zoom,F=typeof g=="function"?g.apply(v,x):g,J=u(k.invert(E).concat(Z/k.k),F.invert(E).concat(Z/F.k));return function(H){if(H===1)H=F;else{var j=J(H),cn=Z/j[2];H=new Q(cn,E[0]-j[0]*cn,E[1]-j[1]*cn)}b.zoom(null,H)}})}function X(f,g,h){return!h&&f.__zooming||new et(f,g)}function et(f,g){this.that=f,this.args=g,this.active=0,this.sourceEvent=null,this.extent=n.apply(f,g),this.taps=0}et.prototype={event:function(f){return f&&(this.sourceEvent=f),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(f,g){return this.mouse&&f!=="mouse"&&(this.mouse[1]=g.invert(this.mouse[0])),this.touch0&&f!=="touch"&&(this.touch0[1]=g.invert(this.touch0[0])),this.touch1&&f!=="touch"&&(this.touch1[1]=g.invert(this.touch1[0])),this.that.__zoom=g,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(f){var g=L(this.that).datum();c.call(f,this.that,new Mo(f,{sourceEvent:this.sourceEvent,target:_,type:f,transform:this.that.__zoom,dispatch:c}),g)}};function Xt(f,...g){if(!t.apply(this,arguments))return;var h=X(this,g).event(f),y=this.__zoom,v=Math.max(o[0],Math.min(o[1],y.k*Math.pow(2,r.apply(this,arguments)))),x=nt(f);if(h.wheel)(h.mouse[0][0]!==x[0]||h.mouse[0][1]!==x[1])&&(h.mouse[1]=y.invert(h.mouse[0]=x)),clearTimeout(h.wheel);else{if(y.k===v)return;h.mouse=[x,y.invert(x)],qt(this),h.start()}vt(f),h.wheel=setTimeout(b,w),h.zoom("mouse",e(C($(y,v),h.mouse[0],h.mouse[1]),h.extent,s));function b(){h.wheel=null,h.end()}}function Ft(f,...g){if(d||!t.apply(this,arguments))return;var h=f.currentTarget,y=X(this,g,!0).event(f),v=L(f.view).on("mousemove.zoom",E,!0).on("mouseup.zoom",Z,!0),x=nt(f,h),b=f.clientX,A=f.clientY;li(f.view),un(f),y.mouse=[x,this.__zoom.invert(x)],qt(this),y.start();function E(k){if(vt(k),!y.moved){var F=k.clientX-b,J=k.clientY-A;y.moved=F*F+J*J>M}y.event(k).zoom("mouse",e(C(y.that.__zoom,y.mouse[0]=nt(k,h),y.mouse[1]),y.extent,s))}function Z(k){v.on("mousemove.zoom mouseup.zoom",null),fi(k.view,y.moved),vt(k),y.event(k).end()}}function Ht(f,...g){if(t.apply(this,arguments)){var h=this.__zoom,y=nt(f.changedTouches?f.changedTouches[0]:f,this),v=h.invert(y),x=h.k*(f.shiftKey?.5:2),b=e(C($(h,x),y,v),n.apply(this,g),s);vt(f),a>0?L(this).transition().duration(a).call(O,b,y,f):L(this).call(_.transform,b,y,f)}}function Co(f,...g){if(t.apply(this,arguments)){var h=f.touches,y=h.length,v=X(this,g,f.changedTouches.length===y).event(f),x,b,A,E;for(un(f),b=0;b<y;++b)A=h[b],E=nt(A,this),E=[E,this.__zoom.invert(E),A.identifier],v.touch0?!v.touch1&&v.touch0[2]!==E[2]&&(v.touch1=E,v.taps=0):(v.touch0=E,x=!0,v.taps=1+!!l);l&&(l=clearTimeout(l)),x&&(v.taps<2&&(p=E[0],l=setTimeout(function(){l=null},m)),qt(this),v.start())}}function Do(f,...g){if(this.__zooming){var h=X(this,g).event(f),y=f.changedTouches,v=y.length,x,b,A,E;for(vt(f),x=0;x<v;++x)b=y[x],A=nt(b,this),h.touch0&&h.touch0[2]===b.identifier?h.touch0[0]=A:h.touch1&&h.touch1[2]===b.identifier&&(h.touch1[0]=A);if(b=h.that.__zoom,h.touch1){var Z=h.touch0[0],k=h.touch0[1],F=h.touch1[0],J=h.touch1[1],H=(H=F[0]-Z[0])*H+(H=F[1]-Z[1])*H,j=(j=J[0]-k[0])*j+(j=J[1]-k[1])*j;b=$(b,Math.sqrt(H/j)),A=[(Z[0]+F[0])/2,(Z[1]+F[1])/2],E=[(k[0]+J[0])/2,(k[1]+J[1])/2]}else if(h.touch0)A=h.touch0[0],E=h.touch0[1];else return;h.zoom("touch",e(C(b,A,E),h.extent,s))}}function Ro(f,...g){if(this.__zooming){var h=X(this,g).event(f),y=f.changedTouches,v=y.length,x,b;for(un(f),d&&clearTimeout(d),d=setTimeout(function(){d=null},m),x=0;x<v;++x)b=y[x],h.touch0&&h.touch0[2]===b.identifier?delete h.touch0:h.touch1&&h.touch1[2]===b.identifier&&delete h.touch1;if(h.touch1&&!h.touch0&&(h.touch0=h.touch1,delete h.touch1),h.touch0)h.touch0[1]=this.__zoom.invert(h.touch0[0]);else if(h.end(),h.taps===2&&(b=nt(b,this),Math.hypot(p[0]-b[0],p[1]-b[1])<N)){var A=L(this).on("dblclick.zoom");A&&A.apply(this,arguments)}}}return _.wheelDelta=function(f){return arguments.length?(r=typeof f=="function"?f:Pt(+f),_):r},_.filter=function(f){return arguments.length?(t=typeof f=="function"?f:Pt(!!f),_):t},_.touchable=function(f){return arguments.length?(i=typeof f=="function"?f:Pt(!!f),_):i},_.extent=function(f){return arguments.length?(n=typeof f=="function"?f:Pt([[+f[0][0],+f[0][1]],[+f[1][0],+f[1][1]]]),_):n},_.scaleExtent=function(f){return arguments.length?(o[0]=+f[0],o[1]=+f[1],_):[o[0],o[1]]},_.translateExtent=function(f){return arguments.length?(s[0][0]=+f[0][0],s[1][0]=+f[1][0],s[0][1]=+f[0][1],s[1][1]=+f[1][1],_):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},_.constrain=function(f){return arguments.length?(e=f,_):e},_.duration=function(f){return arguments.length?(a=+f,_):a},_.interpolate=function(f){return arguments.length?(u=f,_):u},_.on=function(){var f=c.on.apply(c,arguments);return f===c?_:f},_.clickDistance=function(f){return arguments.length?(M=(f=+f)*f,_):Math.sqrt(M)},_.tapDistance=function(f){return arguments.length?(N=+f,_):N},_}const zo=1e-6,I=class I{static fromAngles(n){if(!Array.isArray(n))throw new Error("fromAngles requires an array");const[e,r,i]=n.map(w=>w*I.DEG_TO_RAD),o=e/2,s=r/2,a=i/2,u=Math.cos(o),c=Math.sin(o),l=Math.cos(s),p=Math.sin(s),d=Math.cos(a),m=Math.sin(a);return[u*l*d+c*p*m,c*l*d-u*p*m,u*p*d+c*l*m,u*l*m-c*p*d]}static toAngles(n){const[e,r,i,o]=n;return[Math.atan2(2*(e*r+i*o),1-2*(r*r+i*i))*I.RAD_TO_DEG,Math.asin(Math.max(-1,Math.min(1,2*(e*i-o*r))))*I.RAD_TO_DEG,Math.atan2(2*(e*o+r*i),1-2*(i*i+o*o))*I.RAD_TO_DEG]}static multiply(n,e){const[r,i,o,s]=n,[a,u,c,l]=e;return[r*a-i*u-o*c-s*l,r*u+i*a+o*l-s*c,r*c-i*l+o*a+s*u,r*l+i*c-o*u+s*a]}static cartesian([n,e]){const r=n*I.DEG_TO_RAD,i=e*I.DEG_TO_RAD,o=Math.cos(i);return[o*Math.cos(r),o*Math.sin(r),Math.sin(i)]}static delta(n,e,r=1){function i([l,p,d],[m,w,M]){return[p*M-d*w,d*m-l*M,l*w-p*m]}function o([l,p,d],[m,w,M]){return l*m+p*w+d*M}const s=i(n,e),a=Math.sqrt(o(s,s));if(a<zo)return[1,0,0,0];const u=r*Math.acos(Math.max(-1,Math.min(1,o(n,e))))/2,c=Math.sin(u);return[Math.cos(u),s[2]/a*c,-s[1]/a*c,s[0]/a*c]}static interpolateAngles(n,e,r){const i=I.fromAngles(n),o=I.fromAngles(e);let s=i[0]*o[0]+i[1]*o[1]+i[2]*o[2]+i[3]*o[3];if(s<0&&(o[0]=-o[0],o[1]=-o[1],o[2]=-o[2],o[3]=-o[3],s=-s),s>.9995)return n.map((w,M)=>{const _=(e[M]-w+180