genomefeatures
Version:
A D3 based genome feature rendering
1 lines • 226 kB
JavaScript
(function(ee,he){typeof exports=="object"&&typeof module<"u"?he(exports):typeof define=="function"&&define.amd?define(["exports"],he):(ee=typeof globalThis<"u"?globalThis:ee||self,he(ee.GenomeFeatureComponent={}))})(this,function(ee){"use strict";function he(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function co(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function ar(t){let e,n,i;t.length!==2?(e=he,n=(o,f)=>he(t(o),f),i=(o,f)=>t(o)-f):(e=t===he||t===co?t:uo,n=t,i=t);function r(o,f,c=0,u=o.length){if(c<u){if(e(f,f)!==0)return u;do{const m=c+u>>>1;n(o[m],f)<0?c=m+1:u=m}while(c<u)}return c}function a(o,f,c=0,u=o.length){if(c<u){if(e(f,f)!==0)return u;do{const m=c+u>>>1;n(o[m],f)<=0?c=m+1:u=m}while(c<u)}return c}function s(o,f,c=0,u=o.length){const m=r(o,f,c,u-1);return m>c&&i(o[m-1],f)>-i(o[m],f)?m-1:m}return{left:r,center:s,right:a}}function uo(){return 0}function ho(t){return t===null?NaN:+t}const po=ar(he).right;ar(ho).center;const _o=Math.sqrt(50),go=Math.sqrt(10),mo=Math.sqrt(2);function rn(t,e,n){const i=(e-t)/Math.max(0,n),r=Math.floor(Math.log10(i)),a=i/Math.pow(10,r),s=a>=_o?10:a>=go?5:a>=mo?2:1;let o,f,c;return r<0?(c=Math.pow(10,-r)/s,o=Math.round(t*c),f=Math.round(e*c),o/c<t&&++o,f/c>e&&--f,c=-c):(c=Math.pow(10,r)*s,o=Math.round(t/c),f=Math.round(e/c),o*c<t&&++o,f*c>e&&--f),f<o&&.5<=n&&n<2?rn(t,e,n*2):[o,f,c]}function vo(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const i=e<t,[r,a,s]=i?rn(e,t,n):rn(t,e,n);if(!(a>=r))return[];const o=a-r+1,f=new Array(o);if(i)if(s<0)for(let c=0;c<o;++c)f[c]=(a-c)/-s;else for(let c=0;c<o;++c)f[c]=(a-c)*s;else if(s<0)for(let c=0;c<o;++c)f[c]=(r+c)/-s;else for(let c=0;c<o;++c)f[c]=(r+c)*s;return f}function Wn(t,e,n){return e=+e,t=+t,n=+n,rn(t,e,n)[2]}function wo(t,e,n){e=+e,t=+t,n=+n;const i=e<t,r=i?Wn(e,t,n):Wn(t,e,n);return(i?-1:1)*(r<0?1/-r:r)}function yo(t){return t}var an=1,Xn=2,Yn=3,sn=4,sr=1e-6;function xo(t){return"translate("+t+",0)"}function bo(t){return"translate(0,"+t+")"}function ko(t){return e=>+t(e)}function To(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function Eo(){return!this.__axis}function or(t,e){var n=[],i=null,r=null,a=6,s=6,o=3,f=typeof window<"u"&&window.devicePixelRatio>1?0:.5,c=t===an||t===sn?-1:1,u=t===sn||t===Xn?"x":"y",m=t===an||t===Yn?xo:bo;function p(_){var T=i??(e.ticks?e.ticks.apply(e,n):e.domain()),z=r??(e.tickFormat?e.tickFormat.apply(e,n):yo),N=Math.max(a,0)+o,A=e.range(),k=+A[0]+f,b=+A[A.length-1]+f,y=(e.bandwidth?To:ko)(e.copy(),f),S=_.selection?_.selection():_,$=S.selectAll(".domain").data([null]),E=S.selectAll(".tick").data(T,e).order(),F=E.exit(),L=E.enter().append("g").attr("class","tick"),B=E.select("line"),x=E.select("text");$=$.merge($.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),E=E.merge(L),B=B.merge(L.append("line").attr("stroke","currentColor").attr(u+"2",c*a)),x=x.merge(L.append("text").attr("fill","currentColor").attr(u,c*N).attr("dy",t===an?"0em":t===Yn?"0.71em":"0.32em")),_!==S&&($=$.transition(_),E=E.transition(_),B=B.transition(_),x=x.transition(_),F=F.transition(_).attr("opacity",sr).attr("transform",function(U){return isFinite(U=y(U))?m(U+f):this.getAttribute("transform")}),L.attr("opacity",sr).attr("transform",function(U){var H=this.parentNode.__axis;return m((H&&isFinite(H=H(U))?H:y(U))+f)})),F.remove(),$.attr("d",t===sn||t===Xn?s?"M"+c*s+","+k+"H"+f+"V"+b+"H"+c*s:"M"+f+","+k+"V"+b:s?"M"+k+","+c*s+"V"+f+"H"+b+"V"+c*s:"M"+k+","+f+"H"+b),E.attr("opacity",1).attr("transform",function(U){return m(y(U)+f)}),B.attr(u+"2",c*a),x.attr(u,c*N).text(z),S.filter(Eo).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===Xn?"start":t===sn?"end":"middle"),S.each(function(){this.__axis=y})}return p.scale=function(_){return arguments.length?(e=_,p):e},p.ticks=function(){return n=Array.from(arguments),p},p.tickArguments=function(_){return arguments.length?(n=_==null?[]:Array.from(_),p):n.slice()},p.tickValues=function(_){return arguments.length?(i=_==null?null:Array.from(_),p):i&&i.slice()},p.tickFormat=function(_){return arguments.length?(r=_,p):r},p.tickSize=function(_){return arguments.length?(a=s=+_,p):a},p.tickSizeInner=function(_){return arguments.length?(a=+_,p):a},p.tickSizeOuter=function(_){return arguments.length?(s=+_,p):s},p.tickPadding=function(_){return arguments.length?(o=+_,p):o},p.offset=function(_){return arguments.length?(f=+_,p):f},p}function lr(t){return or(an,t)}function So(t){return or(Yn,t)}var Ao={value:()=>{}};function fr(){for(var t=0,e=arguments.length,n={},i;t<e;++t){if(!(i=arguments[t]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new on(n)}function on(t){this._=t}function $o(t,e){return t.trim().split(/^|\s+/).map(function(n){var i="",r=n.indexOf(".");if(r>=0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}on.prototype=fr.prototype={constructor:on,on:function(t,e){var n=this._,i=$o(t+"",n),r,a=-1,s=i.length;if(arguments.length<2){for(;++a<s;)if((r=(t=i[a]).type)&&(r=No(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++a<s;)if(r=(t=i[a]).type)n[r]=cr(n[r],t.name,e);else if(e==null)for(r in n)n[r]=cr(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new on(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var n=new Array(r),i=0,r,a;i<r;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=this._[t],i=0,r=a.length;i<r;++i)a[i].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,a=i.length;r<a;++r)i[r].value.apply(e,n)}};function No(t,e){for(var n=0,i=t.length,r;n<i;++n)if((r=t[n]).name===e)return r.value}function cr(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=Ao,t=t.slice(0,i).concat(t.slice(i+1));break}return n!=null&&t.push({name:e,value:n}),t}var Kn="http://www.w3.org/1999/xhtml";const ur={svg:"http://www.w3.org/2000/svg",xhtml:Kn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ln(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),ur.hasOwnProperty(e)?{space:ur[e],local:t}:t}function Io(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Kn&&e.documentElement.namespaceURI===Kn?e.createElement(t):e.createElementNS(n,t)}}function Do(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function hr(t){var e=ln(t);return(e.local?Do:Io)(e)}function Ro(){}function Jn(t){return t==null?Ro:function(){return this.querySelector(t)}}function Mo(t){typeof t!="function"&&(t=Jn(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var a=e[r],s=a.length,o=i[r]=new Array(s),f,c,u=0;u<s;++u)(f=a[u])&&(c=t.call(f,f.__data__,u,a))&&("__data__"in f&&(c.__data__=f.__data__),o[u]=c);return new Pt(i,this._parents)}function dr(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Oo(){return[]}function pr(t){return t==null?Oo:function(){return this.querySelectorAll(t)}}function Lo(t){return function(){return dr(t.apply(this,arguments))}}function Co(t){typeof t=="function"?t=Lo(t):t=pr(t);for(var e=this._groups,n=e.length,i=[],r=[],a=0;a<n;++a)for(var s=e[a],o=s.length,f,c=0;c<o;++c)(f=s[c])&&(i.push(t.call(f,f.__data__,c,s)),r.push(f));return new Pt(i,r)}function _r(t){return function(){return this.matches(t)}}function gr(t){return function(e){return e.matches(t)}}var Fo=Array.prototype.find;function zo(t){return function(){return Fo.call(this.children,t)}}function Bo(){return this.firstElementChild}function Ho(t){return this.select(t==null?Bo:zo(typeof t=="function"?t:gr(t)))}var Po=Array.prototype.filter;function Vo(){return Array.from(this.children)}function Uo(t){return function(){return Po.call(this.children,t)}}function Zo(t){return this.selectAll(t==null?Vo:Uo(typeof t=="function"?t:gr(t)))}function qo(t){typeof t!="function"&&(t=_r(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var a=e[r],s=a.length,o=i[r]=[],f,c=0;c<s;++c)(f=a[c])&&t.call(f,f.__data__,c,a)&&o.push(f);return new Pt(i,this._parents)}function mr(t){return new Array(t.length)}function Go(){return new Pt(this._enter||this._groups.map(mr),this._parents)}function fn(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}fn.prototype={constructor:fn,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Wo(t){return function(){return t}}function Xo(t,e,n,i,r,a){for(var s=0,o,f=e.length,c=a.length;s<c;++s)(o=e[s])?(o.__data__=a[s],i[s]=o):n[s]=new fn(t,a[s]);for(;s<f;++s)(o=e[s])&&(r[s]=o)}function Yo(t,e,n,i,r,a,s){var o,f,c=new Map,u=e.length,m=a.length,p=new Array(u),_;for(o=0;o<u;++o)(f=e[o])&&(p[o]=_=s.call(f,f.__data__,o,e)+"",c.has(_)?r[o]=f:c.set(_,f));for(o=0;o<m;++o)_=s.call(t,a[o],o,a)+"",(f=c.get(_))?(i[o]=f,f.__data__=a[o],c.delete(_)):n[o]=new fn(t,a[o]);for(o=0;o<u;++o)(f=e[o])&&c.get(p[o])===f&&(r[o]=f)}function Ko(t){return t.__data__}function Jo(t,e){if(!arguments.length)return Array.from(this,Ko);var n=e?Yo:Xo,i=this._parents,r=this._groups;typeof t!="function"&&(t=Wo(t));for(var a=r.length,s=new Array(a),o=new Array(a),f=new Array(a),c=0;c<a;++c){var u=i[c],m=r[c],p=m.length,_=Qo(t.call(u,u&&u.__data__,c,i)),T=_.length,z=o[c]=new Array(T),N=s[c]=new Array(T),A=f[c]=new Array(p);n(u,m,z,N,A,_,e);for(var k=0,b=0,y,S;k<T;++k)if(y=z[k]){for(k>=b&&(b=k+1);!(S=N[b])&&++b<T;);y._next=S||null}}return s=new Pt(s,i),s._enter=o,s._exit=f,s}function Qo(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function jo(){return new Pt(this._exit||this._groups.map(mr),this._parents)}function tl(t,e,n){var i=this.enter(),r=this,a=this.exit();return typeof t=="function"?(i=t(i),i&&(i=i.selection())):i=i.append(t+""),e!=null&&(r=e(r),r&&(r=r.selection())),n==null?a.remove():n(a),i&&r?i.merge(r).order():r}function el(t){for(var e=t.selection?t.selection():t,n=this._groups,i=e._groups,r=n.length,a=i.length,s=Math.min(r,a),o=new Array(r),f=0;f<s;++f)for(var c=n[f],u=i[f],m=c.length,p=o[f]=new Array(m),_,T=0;T<m;++T)(_=c[T]||u[T])&&(p[T]=_);for(;f<r;++f)o[f]=n[f];return new Pt(o,this._parents)}function nl(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i=t[e],r=i.length-1,a=i[r],s;--r>=0;)(s=i[r])&&(a&&s.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(s,a),a=s);return this}function il(t){t||(t=rl);function e(m,p){return m&&p?t(m.__data__,p.__data__):!m-!p}for(var n=this._groups,i=n.length,r=new Array(i),a=0;a<i;++a){for(var s=n[a],o=s.length,f=r[a]=new Array(o),c,u=0;u<o;++u)(c=s[u])&&(f[u]=c);f.sort(e)}return new Pt(r,this._parents).order()}function rl(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function al(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function sl(){return Array.from(this)}function ol(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,a=i.length;r<a;++r){var s=i[r];if(s)return s}return null}function ll(){let t=0;for(const e of this)++t;return t}function fl(){return!this.node()}function cl(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var r=e[n],a=0,s=r.length,o;a<s;++a)(o=r[a])&&t.call(o,o.__data__,a,r);return this}function ul(t){return function(){this.removeAttribute(t)}}function hl(t){return function(){this.removeAttributeNS(t.space,t.local)}}function dl(t,e){return function(){this.setAttribute(t,e)}}function pl(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function _l(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function gl(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function ml(t,e){var n=ln(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((e==null?n.local?hl:ul:typeof e=="function"?n.local?gl:_l:n.local?pl:dl)(n,e))}function vr(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function vl(t){return function(){this.style.removeProperty(t)}}function wl(t,e,n){return function(){this.style.setProperty(t,e,n)}}function yl(t,e,n){return function(){var i=e.apply(this,arguments);i==null?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function xl(t,e,n){return arguments.length>1?this.each((e==null?vl:typeof e=="function"?yl:wl)(t,e,n??"")):Ie(this.node(),t)}function Ie(t,e){return t.style.getPropertyValue(e)||vr(t).getComputedStyle(t,null).getPropertyValue(e)}function bl(t){return function(){delete this[t]}}function kl(t,e){return function(){this[t]=e}}function Tl(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function El(t,e){return arguments.length>1?this.each((e==null?bl:typeof e=="function"?Tl:kl)(t,e)):this.node()[t]}function wr(t){return t.trim().split(/^|\s+/)}function Qn(t){return t.classList||new yr(t)}function yr(t){this._node=t,this._names=wr(t.getAttribute("class")||"")}yr.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function xr(t,e){for(var n=Qn(t),i=-1,r=e.length;++i<r;)n.add(e[i])}function br(t,e){for(var n=Qn(t),i=-1,r=e.length;++i<r;)n.remove(e[i])}function Sl(t){return function(){xr(this,t)}}function Al(t){return function(){br(this,t)}}function $l(t,e){return function(){(e.apply(this,arguments)?xr:br)(this,t)}}function Nl(t,e){var n=wr(t+"");if(arguments.length<2){for(var i=Qn(this.node()),r=-1,a=n.length;++r<a;)if(!i.contains(n[r]))return!1;return!0}return this.each((typeof e=="function"?$l:e?Sl:Al)(n,e))}function Il(){this.textContent=""}function Dl(t){return function(){this.textContent=t}}function Rl(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Ml(t){return arguments.length?this.each(t==null?Il:(typeof t=="function"?Rl:Dl)(t)):this.node().textContent}function Ol(){this.innerHTML=""}function Ll(t){return function(){this.innerHTML=t}}function Cl(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Fl(t){return arguments.length?this.each(t==null?Ol:(typeof t=="function"?Cl:Ll)(t)):this.node().innerHTML}function zl(){this.nextSibling&&this.parentNode.appendChild(this)}function Bl(){return this.each(zl)}function Hl(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Pl(){return this.each(Hl)}function Vl(t){var e=typeof t=="function"?t:hr(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Ul(){return null}function Zl(t,e){var n=typeof t=="function"?t:hr(t),i=e==null?Ul:typeof e=="function"?e:Jn(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})}function ql(){var t=this.parentNode;t&&t.removeChild(this)}function Gl(){return this.each(ql)}function Wl(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Xl(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Yl(t){return this.select(t?Xl:Wl)}function Kl(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Jl(t){return function(e){t.call(this,e,this.__data__)}}function Ql(t){return t.trim().split(/^|\s+/).map(function(e){var n="",i=e.indexOf(".");return i>=0&&(n=e.slice(i+1),e=e.slice(0,i)),{type:e,name:n}})}function jl(t){return function(){var e=this.__on;if(e){for(var n=0,i=-1,r=e.length,a;n<r;++n)a=e[n],(!t.type||a.type===t.type)&&a.name===t.name?this.removeEventListener(a.type,a.listener,a.options):e[++i]=a;++i?e.length=i:delete this.__on}}}function tf(t,e,n){return function(){var i=this.__on,r,a=Jl(e);if(i){for(var s=0,o=i.length;s<o;++s)if((r=i[s]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=a,r.options=n),r.value=e;return}}this.addEventListener(t.type,a,n),r={type:t.type,name:t.name,value:e,listener:a,options:n},i?i.push(r):this.__on=[r]}}function ef(t,e,n){var i=Ql(t+""),r,a=i.length,s;if(arguments.length<2){var o=this.node().__on;if(o){for(var f=0,c=o.length,u;f<c;++f)for(r=0,u=o[f];r<a;++r)if((s=i[r]).type===u.type&&s.name===u.name)return u.value}return}for(o=e?tf:jl,r=0;r<a;++r)this.each(o(i[r],e,n));return this}function kr(t,e,n){var i=vr(t),r=i.CustomEvent;typeof r=="function"?r=new r(e,n):(r=i.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function nf(t,e){return function(){return kr(this,t,e)}}function rf(t,e){return function(){return kr(this,t,e.apply(this,arguments))}}function af(t,e){return this.each((typeof e=="function"?rf:nf)(t,e))}function*sf(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,a=i.length,s;r<a;++r)(s=i[r])&&(yield s)}var jn=[null];function Pt(t,e){this._groups=t,this._parents=e}function ge(){return new Pt([[document.documentElement]],jn)}function of(){return this}Pt.prototype=ge.prototype={constructor:Pt,select:Mo,selectAll:Co,selectChild:Ho,selectChildren:Zo,filter:qo,data:Jo,enter:Go,exit:jo,join:tl,merge:el,selection:of,order:nl,sort:il,call:al,nodes:sl,node:ol,size:ll,empty:fl,each:cl,attr:ml,style:xl,property:El,classed:Nl,text:Ml,html:Fl,raise:Bl,lower:Pl,append:Vl,insert:Zl,remove:Gl,clone:Yl,datum:Kl,on:ef,dispatch:af,[Symbol.iterator]:sf};function Tt(t){return typeof t=="string"?new Pt([[document.querySelector(t)]],[document.documentElement]):new Pt([[t]],jn)}function Kt(t){return typeof t=="string"?new Pt([document.querySelectorAll(t)],[document.documentElement]):new Pt([dr(t)],jn)}function ti(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Tr(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function Ve(){}var Ue=.7,cn=1/Ue,De="\\s*([+-]?\\d+)\\s*",Ze="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ne="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",lf=/^#([0-9a-f]{3,8})$/,ff=new RegExp(`^rgb\\(${De},${De},${De}\\)$`),cf=new RegExp(`^rgb\\(${ne},${ne},${ne}\\)$`),uf=new RegExp(`^rgba\\(${De},${De},${De},${Ze}\\)$`),hf=new RegExp(`^rgba\\(${ne},${ne},${ne},${Ze}\\)$`),df=new RegExp(`^hsl\\(${Ze},${ne},${ne}\\)$`),pf=new RegExp(`^hsla\\(${Ze},${ne},${ne},${Ze}\\)$`),Er={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};ti(Ve,me,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Sr,formatHex:Sr,formatHex8:_f,formatHsl:gf,formatRgb:Ar,toString:Ar});function Sr(){return this.rgb().formatHex()}function _f(){return this.rgb().formatHex8()}function gf(){return Rr(this).formatHsl()}function Ar(){return this.rgb().formatRgb()}function me(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=lf.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?$r(e):n===3?new Vt(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?un(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?un(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=ff.exec(t))?new Vt(e[1],e[2],e[3],1):(e=cf.exec(t))?new Vt(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=uf.exec(t))?un(e[1],e[2],e[3],e[4]):(e=hf.exec(t))?un(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=df.exec(t))?Dr(e[1],e[2]/100,e[3]/100,1):(e=pf.exec(t))?Dr(e[1],e[2]/100,e[3]/100,e[4]):Er.hasOwnProperty(t)?$r(Er[t]):t==="transparent"?new Vt(NaN,NaN,NaN,0):null}function $r(t){return new Vt(t>>16&255,t>>8&255,t&255,1)}function un(t,e,n,i){return i<=0&&(t=e=n=NaN),new Vt(t,e,n,i)}function mf(t){return t instanceof Ve||(t=me(t)),t?(t=t.rgb(),new Vt(t.r,t.g,t.b,t.opacity)):new Vt}function ei(t,e,n,i){return arguments.length===1?mf(t):new Vt(t,e,n,i??1)}function Vt(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}ti(Vt,ei,Tr(Ve,{brighter(t){return t=t==null?cn:Math.pow(cn,t),new Vt(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Ue:Math.pow(Ue,t),new Vt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Vt(ve(this.r),ve(this.g),ve(this.b),hn(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:Nr,formatHex:Nr,formatHex8:vf,formatRgb:Ir,toString:Ir}));function Nr(){return`#${we(this.r)}${we(this.g)}${we(this.b)}`}function vf(){return`#${we(this.r)}${we(this.g)}${we(this.b)}${we((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ir(){const t=hn(this.opacity);return`${t===1?"rgb(":"rgba("}${ve(this.r)}, ${ve(this.g)}, ${ve(this.b)}${t===1?")":`, ${t})`}`}function hn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ve(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function we(t){return t=ve(t),(t<16?"0":"")+t.toString(16)}function Dr(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Jt(t,e,n,i)}function Rr(t){if(t instanceof Jt)return new Jt(t.h,t.s,t.l,t.opacity);if(t instanceof Ve||(t=me(t)),!t)return new Jt;if(t instanceof Jt)return t;t=t.rgb();var e=t.r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),a=Math.max(e,n,i),s=NaN,o=a-r,f=(a+r)/2;return o?(e===a?s=(n-i)/o+(n<i)*6:n===a?s=(i-e)/o+2:s=(e-n)/o+4,o/=f<.5?a+r:2-a-r,s*=60):o=f>0&&f<1?0:s,new Jt(s,o,f,t.opacity)}function wf(t,e,n,i){return arguments.length===1?Rr(t):new Jt(t,e,n,i??1)}function Jt(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}ti(Jt,wf,Tr(Ve,{brighter(t){return t=t==null?cn:Math.pow(cn,t),new Jt(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Ue:Math.pow(Ue,t),new Jt(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new Vt(ni(t>=240?t-240:t+120,r,i),ni(t,r,i),ni(t<120?t+240:t-120,r,i),this.opacity)},clamp(){return new Jt(Mr(this.h),dn(this.s),dn(this.l),hn(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=hn(this.opacity);return`${t===1?"hsl(":"hsla("}${Mr(this.h)}, ${dn(this.s)*100}%, ${dn(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Mr(t){return t=(t||0)%360,t<0?t+360:t}function dn(t){return Math.max(0,Math.min(1,t||0))}function ni(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const ii=t=>()=>t;function yf(t,e){return function(n){return t+n*e}}function xf(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}function bf(t){return(t=+t)==1?Or:function(e,n){return n-e?xf(e,n,t):ii(isNaN(e)?n:e)}}function Or(t,e){var n=e-t;return n?yf(t,n):ii(isNaN(t)?e:t)}const pn=function t(e){var n=bf(e);function i(r,a){var s=n((r=ei(r)).r,(a=ei(a)).r),o=n(r.g,a.g),f=n(r.b,a.b),c=Or(r.opacity,a.opacity);return function(u){return r.r=s(u),r.g=o(u),r.b=f(u),r.opacity=c(u),r+""}}return i.gamma=t,i}(1);function kf(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,i=e.slice(),r;return function(a){for(r=0;r<n;++r)i[r]=t[r]*(1-a)+e[r]*a;return i}}function Tf(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Ef(t,e){var n=e?e.length:0,i=t?Math.min(n,t.length):0,r=new Array(i),a=new Array(n),s;for(s=0;s<i;++s)r[s]=si(t[s],e[s]);for(;s<n;++s)a[s]=e[s];return function(o){for(s=0;s<i;++s)a[s]=r[s](o);return a}}function Sf(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function Qt(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Af(t,e){var n={},i={},r;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in t?n[r]=si(t[r],e[r]):i[r]=e[r];return function(a){for(r in n)i[r]=n[r](a);return i}}var ri=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ai=new RegExp(ri.source,"g");function $f(t){return function(){return t}}function Nf(t){return function(e){return t(e)+""}}function Lr(t,e){var n=ri.lastIndex=ai.lastIndex=0,i,r,a,s=-1,o=[],f=[];for(t=t+"",e=e+"";(i=ri.exec(t))&&(r=ai.exec(e));)(a=r.index)>n&&(a=e.slice(n,a),o[s]?o[s]+=a:o[++s]=a),(i=i[0])===(r=r[0])?o[s]?o[s]+=r:o[++s]=r:(o[++s]=null,f.push({i:s,x:Qt(i,r)})),n=ai.lastIndex;return n<e.length&&(a=e.slice(n),o[s]?o[s]+=a:o[++s]=a),o.length<2?f[0]?Nf(f[0].x):$f(e):(e=f.length,function(c){for(var u=0,m;u<e;++u)o[(m=f[u]).i]=m.x(c);return o.join("")})}function si(t,e){var n=typeof e,i;return e==null||n==="boolean"?ii(e):(n==="number"?Qt:n==="string"?(i=me(e))?(e=i,pn):Lr:e instanceof me?pn:e instanceof Date?Sf:Tf(e)?kf:Array.isArray(e)?Ef:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Af:Qt)(t,e)}function If(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var Cr=180/Math.PI,oi={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Fr(t,e,n,i,r,a){var s,o,f;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(f=t*n+e*i)&&(n-=t*f,i-=e*f),(o=Math.sqrt(n*n+i*i))&&(n/=o,i/=o,f/=o),t*i<e*n&&(t=-t,e=-e,f=-f,s=-s),{translateX:r,translateY:a,rotate:Math.atan2(e,t)*Cr,skewX:Math.atan(f)*Cr,scaleX:s,scaleY:o}}var _n;function Df(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?oi:Fr(e.a,e.b,e.c,e.d,e.e,e.f)}function Rf(t){return t==null||(_n||(_n=document.createElementNS("http://www.w3.org/2000/svg","g")),_n.setAttribute("transform",t),!(t=_n.transform.baseVal.consolidate()))?oi:(t=t.matrix,Fr(t.a,t.b,t.c,t.d,t.e,t.f))}function zr(t,e,n,i){function r(c){return c.length?c.pop()+" ":""}function a(c,u,m,p,_,T){if(c!==m||u!==p){var z=_.push("translate(",null,e,null,n);T.push({i:z-4,x:Qt(c,m)},{i:z-2,x:Qt(u,p)})}else(m||p)&&_.push("translate("+m+e+p+n)}function s(c,u,m,p){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),p.push({i:m.push(r(m)+"rotate(",null,i)-2,x:Qt(c,u)})):u&&m.push(r(m)+"rotate("+u+i)}function o(c,u,m,p){c!==u?p.push({i:m.push(r(m)+"skewX(",null,i)-2,x:Qt(c,u)}):u&&m.push(r(m)+"skewX("+u+i)}function f(c,u,m,p,_,T){if(c!==m||u!==p){var z=_.push(r(_)+"scale(",null,",",null,")");T.push({i:z-4,x:Qt(c,m)},{i:z-2,x:Qt(u,p)})}else(m!==1||p!==1)&&_.push(r(_)+"scale("+m+","+p+")")}return function(c,u){var m=[],p=[];return c=t(c),u=t(u),a(c.translateX,c.translateY,u.translateX,u.translateY,m,p),s(c.rotate,u.rotate,m,p),o(c.skewX,u.skewX,m,p),f(c.scaleX,c.scaleY,u.scaleX,u.scaleY,m,p),c=u=null,function(_){for(var T=-1,z=p.length,N;++T<z;)m[(N=p[T]).i]=N.x(_);return m.join("")}}}var Mf=zr(Df,"px, ","px)","deg)"),Of=zr(Rf,", ",")",")"),Re=0,qe=0,Ge=0,Br=1e3,gn,We,mn=0,ye=0,vn=0,Xe=typeof performance=="object"&&performance.now?performance:Date,Hr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function li(){return ye||(Hr(Lf),ye=Xe.now()+vn)}function Lf(){ye=0}function wn(){this._call=this._time=this._next=null}wn.prototype=Pr.prototype={constructor:wn,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?li():+n)+(e==null?0:+e),!this._next&&We!==this&&(We?We._next=this:gn=this,We=this),this._call=t,this._time=n,fi()},stop:function(){this._call&&(this._call=null,this._time=1/0,fi())}};function Pr(t,e,n){var i=new wn;return i.restart(t,e,n),i}function Cf(){li(),++Re;for(var t=gn,e;t;)(e=ye-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Re}function Vr(){ye=(mn=Xe.now())+vn,Re=qe=0;try{Cf()}finally{Re=0,zf(),ye=0}}function Ff(){var t=Xe.now(),e=t-mn;e>Br&&(vn-=e,mn=t)}function zf(){for(var t,e=gn,n,i=1/0;e;)e._call?(i>e._time&&(i=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:gn=n);We=t,fi(i)}function fi(t){if(!Re){qe&&(qe=clearTimeout(qe));var e=t-ye;e>24?(t<1/0&&(qe=setTimeout(Vr,t-Xe.now()-vn)),Ge&&(Ge=clearInterval(Ge))):(Ge||(mn=Xe.now(),Ge=setInterval(Ff,Br)),Re=1,Hr(Vr))}}function Ur(t,e,n){var i=new wn;return e=e==null?0:+e,i.restart(r=>{i.stop(),t(r+e)},e,n),i}var Bf=fr("start","end","cancel","interrupt"),Hf=[],Zr=0,qr=1,ci=2,yn=3,Gr=4,ui=5,xn=6;function bn(t,e,n,i,r,a){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;Pf(t,n,{name:e,index:i,group:r,on:Bf,tween:Hf,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:Zr})}function hi(t,e){var n=jt(t,e);if(n.state>Zr)throw new Error("too late; already scheduled");return n}function ie(t,e){var n=jt(t,e);if(n.state>yn)throw new Error("too late; already running");return n}function jt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Pf(t,e,n){var i=t.__transition,r;i[e]=n,n.timer=Pr(a,0,n.time);function a(c){n.state=qr,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var u,m,p,_;if(n.state!==qr)return f();for(u in i)if(_=i[u],_.name===n.name){if(_.state===yn)return Ur(s);_.state===Gr?(_.state=xn,_.timer.stop(),_.on.call("interrupt",t,t.__data__,_.index,_.group),delete i[u]):+u<e&&(_.state=xn,_.timer.stop(),_.on.call("cancel",t,t.__data__,_.index,_.group),delete i[u])}if(Ur(function(){n.state===yn&&(n.state=Gr,n.timer.restart(o,n.delay,n.time),o(c))}),n.state=ci,n.on.call("start",t,t.__data__,n.index,n.group),n.state===ci){for(n.state=yn,r=new Array(p=n.tween.length),u=0,m=-1;u<p;++u)(_=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(r[++m]=_);r.length=m+1}}function o(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(f),n.state=ui,1),m=-1,p=r.length;++m<p;)r[m].call(t,u);n.state===ui&&(n.on.call("end",t,t.__data__,n.index,n.group),f())}function f(){n.state=xn,n.timer.stop(),delete i[e];for(var c in i)return;delete t.__transition}}function Vf(t,e){var n=t.__transition,i,r,a=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((i=n[s]).name!==e){a=!1;continue}r=i.state>ci&&i.state<ui,i.state=xn,i.timer.stop(),i.on.call(r?"interrupt":"cancel",t,t.__data__,i.index,i.group),delete n[s]}a&&delete t.__transition}}function Uf(t){return this.each(function(){Vf(this,t)})}function Zf(t,e){var n,i;return function(){var r=ie(this,t),a=r.tween;if(a!==n){i=n=a;for(var s=0,o=i.length;s<o;++s)if(i[s].name===e){i=i.slice(),i.splice(s,1);break}}r.tween=i}}function qf(t,e,n){var i,r;if(typeof n!="function")throw new Error;return function(){var a=ie(this,t),s=a.tween;if(s!==i){r=(i=s).slice();for(var o={name:e,value:n},f=0,c=r.length;f<c;++f)if(r[f].name===e){r[f]=o;break}f===c&&r.push(o)}a.tween=r}}function Gf(t,e){var n=this._id;if(t+="",arguments.length<2){for(var i=jt(this.node(),n).tween,r=0,a=i.length,s;r<a;++r)if((s=i[r]).name===t)return s.value;return null}return this.each((e==null?Zf:qf)(n,t,e))}function di(t,e,n){var i=t._id;return t.each(function(){var r=ie(this,i);(r.value||(r.value={}))[e]=n.apply(this,arguments)}),function(r){return jt(r,i).value[e]}}function Wr(t,e){var n;return(typeof e=="number"?Qt:e instanceof me?pn:(n=me(e))?(e=n,pn):Lr)(t,e)}function Wf(t){return function(){this.removeAttribute(t)}}function Xf(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Yf(t,e,n){var i,r=n+"",a;return function(){var s=this.getAttribute(t);return s===r?null:s===i?a:a=e(i=s,n)}}function Kf(t,e,n){var i,r=n+"",a;return function(){var s=this.getAttributeNS(t.space,t.local);return s===r?null:s===i?a:a=e(i=s,n)}}function Jf(t,e,n){var i,r,a;return function(){var s,o=n(this),f;return o==null?void this.removeAttribute(t):(s=this.getAttribute(t),f=o+"",s===f?null:s===i&&f===r?a:(r=f,a=e(i=s,o)))}}function Qf(t,e,n){var i,r,a;return function(){var s,o=n(this),f;return o==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),f=o+"",s===f?null:s===i&&f===r?a:(r=f,a=e(i=s,o)))}}function jf(t,e){var n=ln(t),i=n==="transform"?Of:Wr;return this.attrTween(t,typeof e=="function"?(n.local?Qf:Jf)(n,i,di(this,"attr."+t,e)):e==null?(n.local?Xf:Wf)(n):(n.local?Kf:Yf)(n,i,e))}function tc(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function ec(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function nc(t,e){var n,i;function r(){var a=e.apply(this,arguments);return a!==i&&(n=(i=a)&&ec(t,a)),n}return r._value=e,r}function ic(t,e){var n,i;function r(){var a=e.apply(this,arguments);return a!==i&&(n=(i=a)&&tc(t,a)),n}return r._value=e,r}function rc(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var i=ln(t);return this.tween(n,(i.local?nc:ic)(i,e))}function ac(t,e){return function(){hi(this,t).delay=+e.apply(this,arguments)}}function sc(t,e){return e=+e,function(){hi(this,t).delay=e}}function oc(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?ac:sc)(e,t)):jt(this.node(),e).delay}function lc(t,e){return function(){ie(this,t).duration=+e.apply(this,arguments)}}function fc(t,e){return e=+e,function(){ie(this,t).duration=e}}function cc(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?lc:fc)(e,t)):jt(this.node(),e).duration}function uc(t,e){if(typeof e!="function")throw new Error;return function(){ie(this,t).ease=e}}function hc(t){var e=this._id;return arguments.length?this.each(uc(e,t)):jt(this.node(),e).ease}function dc(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;ie(this,t).ease=n}}function pc(t){if(typeof t!="function")throw new Error;return this.each(dc(this._id,t))}function _c(t){typeof t!="function"&&(t=_r(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var a=e[r],s=a.length,o=i[r]=[],f,c=0;c<s;++c)(f=a[c])&&t.call(f,f.__data__,c,a)&&o.push(f);return new se(i,this._parents,this._name,this._id)}function gc(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,i=e.length,r=n.length,a=Math.min(i,r),s=new Array(i),o=0;o<a;++o)for(var f=e[o],c=n[o],u=f.length,m=s[o]=new Array(u),p,_=0;_<u;++_)(p=f[_]||c[_])&&(m[_]=p);for(;o<i;++o)s[o]=e[o];return new se(s,this._parents,this._name,this._id)}function mc(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function vc(t,e,n){var i,r,a=mc(e)?hi:ie;return function(){var s=a(this,t),o=s.on;o!==i&&(r=(i=o).copy()).on(e,n),s.on=r}}function wc(t,e){var n=this._id;return arguments.length<2?jt(this.node(),n).on.on(t):this.each(vc(n,t,e))}function yc(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function xc(){return this.on("end.remove",yc(this._id))}function bc(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Jn(t));for(var i=this._groups,r=i.length,a=new Array(r),s=0;s<r;++s)for(var o=i[s],f=o.length,c=a[s]=new Array(f),u,m,p=0;p<f;++p)(u=o[p])&&(m=t.call(u,u.__data__,p,o))&&("__data__"in u&&(m.__data__=u.__data__),c[p]=m,bn(c[p],e,n,p,c,jt(u,n)));return new se(a,this._parents,e,n)}function kc(t){var e=this._name,n=this._id;typeof t!="function"&&(t=pr(t));for(var i=this._groups,r=i.length,a=[],s=[],o=0;o<r;++o)for(var f=i[o],c=f.length,u,m=0;m<c;++m)if(u=f[m]){for(var p=t.call(u,u.__data__,m,f),_,T=jt(u,n),z=0,N=p.length;z<N;++z)(_=p[z])&&bn(_,e,n,z,p,T);a.push(p),s.push(u)}return new se(a,s,e,n)}var Tc=ge.prototype.constructor;function Ec(){return new Tc(this._groups,this._parents)}function Sc(t,e){var n,i,r;return function(){var a=Ie(this,t),s=(this.style.removeProperty(t),Ie(this,t));return a===s?null:a===n&&s===i?r:r=e(n=a,i=s)}}function Xr(t){return function(){this.style.removeProperty(t)}}function Ac(t,e,n){var i,r=n+"",a;return function(){var s=Ie(this,t);return s===r?null:s===i?a:a=e(i=s,n)}}function $c(t,e,n){var i,r,a;return function(){var s=Ie(this,t),o=n(this),f=o+"";return o==null&&(f=o=(this.style.removeProperty(t),Ie(this,t))),s===f?null:s===i&&f===r?a:(r=f,a=e(i=s,o))}}function Nc(t,e){var n,i,r,a="style."+e,s="end."+a,o;return function(){var f=ie(this,t),c=f.on,u=f.value[a]==null?o||(o=Xr(e)):void 0;(c!==n||r!==u)&&(i=(n=c).copy()).on(s,r=u),f.on=i}}function Ic(t,e,n){var i=(t+="")=="transform"?Mf:Wr;return e==null?this.styleTween(t,Sc(t,i)).on("end.style."+t,Xr(t)):typeof e=="function"?this.styleTween(t,$c(t,i,di(this,"style."+t,e))).each(Nc(this._id,t)):this.styleTween(t,Ac(t,i,e),n).on("end.style."+t,null)}function Dc(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}function Rc(t,e,n){var i,r;function a(){var s=e.apply(this,arguments);return s!==r&&(i=(r=s)&&Dc(t,s,n)),i}return a._value=e,a}function Mc(t,e,n){var i="style."+(t+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(e==null)return this.tween(i,null);if(typeof e!="function")throw new Error;return this.tween(i,Rc(t,e,n??""))}function Oc(t){return function(){this.textContent=t}}function Lc(t){return function(){var e=t(this);this.textContent=e??""}}function Cc(t){return this.tween("text",typeof t=="function"?Lc(di(this,"text",t)):Oc(t==null?"":t+""))}function Fc(t){return function(e){this.textContent=t.call(this,e)}}function zc(t){var e,n;function i(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&Fc(r)),e}return i._value=t,i}function Bc(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,zc(t))}function Hc(){for(var t=this._name,e=this._id,n=Yr(),i=this._groups,r=i.length,a=0;a<r;++a)for(var s=i[a],o=s.length,f,c=0;c<o;++c)if(f=s[c]){var u=jt(f,e);bn(f,t,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new se(i,this._parents,t,n)}function Pc(){var t,e,n=this,i=n._id,r=n.size();return new Promise(function(a,s){var o={value:s},f={value:function(){--r===0&&a()}};n.each(function(){var c=ie(this,i),u=c.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(o),e._.interrupt.push(o),e._.end.push(f)),c.on=e}),r===0&&a()})}var Vc=0;function se(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function Yr(){return++Vc}var oe=ge.prototype;se.prototype={constructor:se,select:bc,selectAll:kc,selectChild:oe.selectChild,selectChildren:oe.selectChildren,filter:_c,merge:gc,selection:Ec,transition:Hc,call:oe.call,nodes:oe.nodes,node:oe.node,size:oe.size,empty:oe.empty,each:oe.each,on:wc,attr:jf,attrTween:rc,style:Ic,styleTween:Mc,text:Cc,textTween:Bc,remove:xc,tween:Gf,delay:oc,duration:cc,ease:hc,easeVarying:pc,end:Pc,[Symbol.iterator]:oe[Symbol.iterator]};function Uc(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Zc={time:null,delay:0,duration:250,ease:Uc};function qc(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Gc(t){var e,n;t instanceof se?(e=t._id,t=t._name):(e=Yr(),(n=Zc).time=li(),t=t==null?null:t+"");for(var i=this._groups,r=i.length,a=0;a<r;++a)for(var s=i[a],o=s.length,f,c=0;c<o;++c)(f=s[c])&&bn(f,t,e,c,s,n||qc(f,e));return new se(i,this._parents,t,e)}ge.prototype.interrupt=Uf,ge.prototype.transition=Gc;const pi=Math.PI,_i=2*pi,xe=1e-6,Wc=_i-xe;function Kr(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function Xc(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Kr;const n=10**e;return function(i){this._+=i[0];for(let r=1,a=i.length;r<a;++r)this._+=Math.round(arguments[r]*n)/n+i[r]}}class Yc{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?Kr:Xc(e)}moveTo(e,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,n){this._append`L${this._x1=+e},${this._y1=+n}`}quadraticCurveTo(e,n,i,r){this._append`Q${+e},${+n},${this._x1=+i},${this._y1=+r}`}bezierCurveTo(e,n,i,r,a,s){this._append`C${+e},${+n},${+i},${+r},${this._x1=+a},${this._y1=+s}`}arcTo(e,n,i,r,a){if(e=+e,n=+n,i=+i,r=+r,a=+a,a<0)throw new Error(`negative radius: ${a}`);let s=this._x1,o=this._y1,f=i-e,c=r-n,u=s-e,m=o-n,p=u*u+m*m;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(p>xe)if(!(Math.abs(m*f-c*u)>xe)||!a)this._append`L${this._x1=e},${this._y1=n}`;else{let _=i-s,T=r-o,z=f*f+c*c,N=_*_+T*T,A=Math.sqrt(z),k=Math.sqrt(p),b=a*Math.tan((pi-Math.acos((z+p-N)/(2*A*k)))/2),y=b/k,S=b/A;Math.abs(y-1)>xe&&this._append`L${e+y*u},${n+y*m}`,this._append`A${a},${a},0,0,${+(m*_>u*T)},${this._x1=e+S*f},${this._y1=n+S*c}`}}arc(e,n,i,r,a,s){if(e=+e,n=+n,i=+i,s=!!s,i<0)throw new Error(`negative radius: ${i}`);let o=i*Math.cos(r),f=i*Math.sin(r),c=e+o,u=n+f,m=1^s,p=s?r-a:a-r;this._x1===null?this._append`M${c},${u}`:(Math.abs(this._x1-c)>xe||Math.abs(this._y1-u)>xe)&&this._append`L${c},${u}`,i&&(p<0&&(p=p%_i+_i),p>Wc?this._append`A${i},${i},0,1,${m},${e-o},${n-f}A${i},${i},0,1,${m},${this._x1=c},${this._y1=u}`:p>xe&&this._append`A${i},${i},0,${+(p>=pi)},${m},${this._x1=e+i*Math.cos(a)},${this._y1=n+i*Math.sin(a)}`)}rect(e,n,i,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${i=+i}v${+r}h${-i}Z`}toString(){return this._}}function Kc(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function kn(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,i=t.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+t.slice(n+1)]}function Me(t){return t=kn(Math.abs(t)),t?t[1]:NaN}function Jc(t,e){return function(n,i){for(var r=n.length,a=[],s=0,o=t[0],f=0;r>0&&o>0&&(f+o+1>i&&(o=Math.max(1,i-f)),a.push(n.substring(r-=o,r+o)),!((f+=o+1)>i));)o=t[s=(s+1)%t.length];return a.reverse().join(e)}}function Qc(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var jc=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Tn(t){if(!(e=jc.exec(t)))throw new Error("invalid format: "+t);var e;return new gi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Tn.prototype=gi.prototype;function gi(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}gi.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function tu(t){t:for(var e=t.length,n=1,i=-1,r;n<e;++n)switch(t[n]){case".":i=r=n;break;case"0":i===0&&(i=n),r=n;break;default:if(!+t[n])break t;i>0&&(i=0);break}return i>0?t.slice(0,i)+t.slice(r+1):t}var Jr;function eu(t,e){var n=kn(t,e);if(!n)return t+"";var i=n[0],r=n[1],a=r-(Jr=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,s=i.length;return a===s?i:a>s?i+new Array(a-s+1).join("0"):a>0?i.slice(0,a)+"."+i.slice(a):"0."+new Array(1-a).join("0")+kn(t,Math.max(0,e+a-1))[0]}function Qr(t,e){var n=kn(t,e);if(!n)return t+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}const jr={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Kc,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Qr(t*100,e),r:Qr,s:eu,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function ta(t){return t}var ea=Array.prototype.map,na=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function nu(t){var e=t.grouping===void 0||t.thousands===void 0?ta:Jc(ea.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",i=t.currency===void 0?"":t.currency[1]+"",r=t.decimal===void 0?".":t.decimal+"",a=t.numerals===void 0?ta:Qc(ea.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",o=t.minus===void 0?"−":t.minus+"",f=t.nan===void 0?"NaN":t.nan+"";function c(m){m=Tn(m);var p=m.fill,_=m.align,T=m.sign,z=m.symbol,N=m.zero,A=m.width,k=m.comma,b=m.precision,y=m.trim,S=m.type;S==="n"?(k=!0,S="g"):jr[S]||(b===void 0&&(b=12),y=!0,S="g"),(N||p==="0"&&_==="=")&&(N=!0,p="0",_="=");var $=z==="$"?n:z==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",E=z==="$"?i:/[%p]/.test(S)?s:"",F=jr[S],L=/[defgprs%]/.test(S);b=b===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function B(x){var U=$,H=E,W,at,dt;if(S==="c")H=F(x)+H,x="";else{x=+x;var X=x<0||1/x<0;if(x=isNaN(x)?f:F(Math.abs(x),b),y&&(x=tu(x)),X&&+x==0&&T!=="+"&&(X=!1),U=(X?T==="("?T:o:T==="-"||T==="("?"":T)+U,H=(S==="s"?na[8+Jr/3]:"")+H+(X&&T==="("?")":""),L){for(W=-1,at=x.length;++W<at;)if(dt=x.charCodeAt(W),48>dt||dt>57){H=(dt===46?r+x.slice(W+1):x.slice(W))+H,x=x.slice(0,W);break}}}k&&!N&&(x=e(x,1/0));var Z=U.length+x.length+H.length,V=Z<A?new Array(A-Z+1).join(p):"";switch(k&&N&&(x=e(V+x,V.length?A-H.length:1/0),V=""),_){case"<":x=U+x+H+V;break;case"=":x=U+V+x+H;break;case"^":x=V.slice(0,Z=V.length>>1)+U+x+H+V.slice(Z);break;default:x=V+U+x+H;break}return a(x)}return B.toString=function(){return m+""},B}function u(m,p){var _=c((m=Tn(m),m.type="f",m)),T=Math.max(-8,Math.min(8,Math.floor(Me(p)/3)))*3,z=Math.pow(10,-T),N=na[8+T/3];return function(A){return _(z*A)+N}}return{format:c,formatPrefix:u}}var En,ia,ra;iu({thousands:",",grouping:[3],currency:["$",""]});function iu(t){return En=nu(t),ia=En.format,ra=En.formatPrefix,En}function ru(t){return Math.max(0,-Me(Math.abs(t)))}function au(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Me(e)/3)))*3-Me(Math.abs(t)))}function su(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Me(e)-Me(t))+1}function ou(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function lu(t){return function(){return t}}function fu(t){return+t}var aa=[0,1];function Oe(t){return t}function mi(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:lu(isNaN(e)?NaN:.5)}function cu(t,e){var n;return t>e&&(n=t,t=e,e=n),function(i){return Math.max(t,Math.min(e,i))}}function uu(t,e,n){var i=t[0],r=t[1],a=e[0],s=e[1];return r<i?(i=mi(r,i),a=n(s,a)):(i=mi(i,r),a=n(a,s)),function(o){return a(i(o))}}function hu(t,e,n){var i=Math.min(t.length,e.length)-1,r=new Array(i),a=new Array(i),s=-1;for(t[i]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<i;)r[s]=mi(t[s],t[s+1]),a[s]=n(e[s],e[s+1]);return function(o){var f=po(t,o,1,i)-1;return a[f](r[f](o))}}function du(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function pu(){var t=aa,e=aa,n=si,i,r,a,s=Oe,o,f,c;function u(){var p=Math.min(t.length,e.length);return